From: Cris Di Sclafani Date: Fri, 12 Mar 2021 14:46:18 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.1 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.messaging?a=commitdiff_plain;h=22b4dbc19b8a9b378c7c06ee7bc20f2e5f1b3358;p=motion2.git Built motion from commit (unavailable).|2.5.1 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 8828a70..fa8b03d 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.21", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

We make changes to the APIs from time to time. For more information, see Changelog.

\n

The xCALLY MOTION API consists of several different APIs. Use the left sidebar menu to select one.

\n

The API is a JSON API. XML is not supported. To learn more, see [Working with JSON].

\n

Endpoints are documented with the HTTP method for the request and a partial resource identifier.\nExample:

\n
GET /api/users\n
\n

Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:

\n
https://motion.xcally.com/api/users\n
\n

Curly braces, {}, indicate values you have to supply. Example:

\n
GET  /api/users/{id}\n
\n

The examples in the docs are cURL statements. You can run the statements on a command line to try out different API requests. To learn more, see [Installing and using cURL]. In Windows, you'll need to modify some of the examples in the docs to make them work. See [Using cURL in Windows].

\n

The examples use basic authentication requiring a xCALLY username and password.

\n

Security and Authentication

\n

This is an SSL-only API, regardless of how your account is configured. You can authorize against the API using either basic authentication with your username and password or with an OAuth access token or API Key.

\n

Client-side CORS requests are supported if the request is authenticated with an OAuth access token. The requests are not supported if the request uses basic authentication or API Key.

\n

Basic authentication

\n

Use the following authentication format with your username and password:\n{username}:{password}

\n

Example:

\n
curl -u admin:password https://motion.xcally.com/api/users\n
\n

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

In your requests, specify the access token in an Authorization header as follows:\nAuthorization: Bearer {token}

\n

Example:

\n
curl -H \"Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo\" https://motion.xcally.com/api/users\n
\n

API Key

\n

In your request, specify the API Key in apikey query parameter

\n

Example:

\n
curl https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\n
\n

Request Format

\n

The xCALLY API is a JSON API. You must supply a Content-Type: application/json header in PUT and POST requests. You must set an Accept: application/json header on all requests. You may get a text/plain response in case of an error like a bad request. You should treat this as an error you need to fix.

\n

Response Format

\n

The xCALLY API responds to successful requests with HTTP status codes in the 200 or 300 range. When you create or update a resource, the API renders the resulting JSON representation in the response body.

\n

Responses may have the status codes described in the following sections.

\n

200 range

\n

The request was successful. The status is 200 for successful GET and PUT requests, 201 for most POST requests, and 204 for DELETE requests.

\n

400 range

\n

The request was not successful. The content type of the response may be text/plain for API-level error messages, such as when trying to call the API without SSL. The content type is application/json for business-level error messages because the response includes a JSON object with information about the error.

\n

If you see a response from a known endpoint that looks like plain text, you probably made a syntax error in your request. This type of response commonly occurs when making a request to a nonexistent xCALLY Support instance.

\n

500 range

\n

When building an API client, we recommend treating any 500 status codes as a warning or temporary state. However, if the status persists and we don't have a publicly announced maintenance or service disruption, contact us at support@xcally.com.

\n

If submitting a ticket to Support, provide the complete HTTP response. This helps the Support team track down the request in the logs more quickly.

\n

Data Types

\n

The API returns and accepts JSON values, which can be strings in double quotes, numbers, objects, arrays, true or false, or null. Most programming languages have tools to parse this data.

\n

ID integers

\n

Most xCALLY Support resources such as queues and users are identified by the integer specified by the id attribute of API responses.

\n

The default numeric type in JavaScript, Ruby, Python, and PHP is sufficient to represent xCALLY Support ID integers.

\n

Time stamps

\n

Time stamps use UTC time and are formatted as ISO 8601 strings. Example: 2017-04-16T09:14:57Z

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2021-03-12T14:24:07.185Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); +define({ "name": "xCALLY Motion API", "version": "2.5.21", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

We make changes to the APIs from time to time. For more information, see Changelog.

\n

The xCALLY MOTION API consists of several different APIs. Use the left sidebar menu to select one.

\n

The API is a JSON API. XML is not supported. To learn more, see [Working with JSON].

\n

Endpoints are documented with the HTTP method for the request and a partial resource identifier.\nExample:

\n
GET /api/users\n
\n

Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:

\n
https://motion.xcally.com/api/users\n
\n

Curly braces, {}, indicate values you have to supply. Example:

\n
GET  /api/users/{id}\n
\n

The examples in the docs are cURL statements. You can run the statements on a command line to try out different API requests. To learn more, see [Installing and using cURL]. In Windows, you'll need to modify some of the examples in the docs to make them work. See [Using cURL in Windows].

\n

The examples use basic authentication requiring a xCALLY username and password.

\n

Security and Authentication

\n

This is an SSL-only API, regardless of how your account is configured. You can authorize against the API using either basic authentication with your username and password or with an OAuth access token or API Key.

\n

Client-side CORS requests are supported if the request is authenticated with an OAuth access token. The requests are not supported if the request uses basic authentication or API Key.

\n

Basic authentication

\n

Use the following authentication format with your username and password:\n{username}:{password}

\n

Example:

\n
curl -u admin:password https://motion.xcally.com/api/users\n
\n

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

In your requests, specify the access token in an Authorization header as follows:\nAuthorization: Bearer {token}

\n

Example:

\n
curl -H \"Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo\" https://motion.xcally.com/api/users\n
\n

API Key

\n

In your request, specify the API Key in apikey query parameter

\n

Example:

\n
curl https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\n
\n

Request Format

\n

The xCALLY API is a JSON API. You must supply a Content-Type: application/json header in PUT and POST requests. You must set an Accept: application/json header on all requests. You may get a text/plain response in case of an error like a bad request. You should treat this as an error you need to fix.

\n

Response Format

\n

The xCALLY API responds to successful requests with HTTP status codes in the 200 or 300 range. When you create or update a resource, the API renders the resulting JSON representation in the response body.

\n

Responses may have the status codes described in the following sections.

\n

200 range

\n

The request was successful. The status is 200 for successful GET and PUT requests, 201 for most POST requests, and 204 for DELETE requests.

\n

400 range

\n

The request was not successful. The content type of the response may be text/plain for API-level error messages, such as when trying to call the API without SSL. The content type is application/json for business-level error messages because the response includes a JSON object with information about the error.

\n

If you see a response from a known endpoint that looks like plain text, you probably made a syntax error in your request. This type of response commonly occurs when making a request to a nonexistent xCALLY Support instance.

\n

500 range

\n

When building an API client, we recommend treating any 500 status codes as a warning or temporary state. However, if the status persists and we don't have a publicly announced maintenance or service disruption, contact us at support@xcally.com.

\n

If submitting a ticket to Support, provide the complete HTTP response. This helps the Support team track down the request in the logs more quickly.

\n

Data Types

\n

The API returns and accepts JSON values, which can be strings in double quotes, numbers, objects, arrays, true or false, or null. Most programming languages have tools to parse this data.

\n

ID integers

\n

Most xCALLY Support resources such as queues and users are identified by the integer specified by the id attribute of API responses.

\n

The default numeric type in JavaScript, Ruby, Python, and PHP is sufficient to represent xCALLY Support ID integers.

\n

Time stamps

\n

Time stamps use UTC time and are formatted as ISO 8601 strings. Example: 2017-04-16T09:14:57Z

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2021-03-12T14:38:38.173Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index e95ac4d..54e1529 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.5.21", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

We make changes to the APIs from time to time. For more information, see Changelog.

\n

The xCALLY MOTION API consists of several different APIs. Use the left sidebar menu to select one.

\n

The API is a JSON API. XML is not supported. To learn more, see [Working with JSON].

\n

Endpoints are documented with the HTTP method for the request and a partial resource identifier.\nExample:

\n
GET /api/users\n
\n

Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:

\n
https://motion.xcally.com/api/users\n
\n

Curly braces, {}, indicate values you have to supply. Example:

\n
GET  /api/users/{id}\n
\n

The examples in the docs are cURL statements. You can run the statements on a command line to try out different API requests. To learn more, see [Installing and using cURL]. In Windows, you'll need to modify some of the examples in the docs to make them work. See [Using cURL in Windows].

\n

The examples use basic authentication requiring a xCALLY username and password.

\n

Security and Authentication

\n

This is an SSL-only API, regardless of how your account is configured. You can authorize against the API using either basic authentication with your username and password or with an OAuth access token or API Key.

\n

Client-side CORS requests are supported if the request is authenticated with an OAuth access token. The requests are not supported if the request uses basic authentication or API Key.

\n

Basic authentication

\n

Use the following authentication format with your username and password:\n{username}:{password}

\n

Example:

\n
curl -u admin:password https://motion.xcally.com/api/users\n
\n

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

In your requests, specify the access token in an Authorization header as follows:\nAuthorization: Bearer {token}

\n

Example:

\n
curl -H \"Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo\" https://motion.xcally.com/api/users\n
\n

API Key

\n

In your request, specify the API Key in apikey query parameter

\n

Example:

\n
curl https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\n
\n

Request Format

\n

The xCALLY API is a JSON API. You must supply a Content-Type: application/json header in PUT and POST requests. You must set an Accept: application/json header on all requests. You may get a text/plain response in case of an error like a bad request. You should treat this as an error you need to fix.

\n

Response Format

\n

The xCALLY API responds to successful requests with HTTP status codes in the 200 or 300 range. When you create or update a resource, the API renders the resulting JSON representation in the response body.

\n

Responses may have the status codes described in the following sections.

\n

200 range

\n

The request was successful. The status is 200 for successful GET and PUT requests, 201 for most POST requests, and 204 for DELETE requests.

\n

400 range

\n

The request was not successful. The content type of the response may be text/plain for API-level error messages, such as when trying to call the API without SSL. The content type is application/json for business-level error messages because the response includes a JSON object with information about the error.

\n

If you see a response from a known endpoint that looks like plain text, you probably made a syntax error in your request. This type of response commonly occurs when making a request to a nonexistent xCALLY Support instance.

\n

500 range

\n

When building an API client, we recommend treating any 500 status codes as a warning or temporary state. However, if the status persists and we don't have a publicly announced maintenance or service disruption, contact us at support@xcally.com.

\n

If submitting a ticket to Support, provide the complete HTTP response. This helps the Support team track down the request in the logs more quickly.

\n

Data Types

\n

The API returns and accepts JSON values, which can be strings in double quotes, numbers, objects, arrays, true or false, or null. Most programming languages have tools to parse this data.

\n

ID integers

\n

Most xCALLY Support resources such as queues and users are identified by the integer specified by the id attribute of API responses.

\n

The default numeric type in JavaScript, Ruby, Python, and PHP is sufficient to represent xCALLY Support ID integers.

\n

Time stamps

\n

Time stamps use UTC time and are formatted as ISO 8601 strings. Example: 2017-04-16T09:14:57Z

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2021-03-12T14:24:07.185Z", "url": "http://apidocjs.com", "version": "0.19.0" } } +{ "name": "xCALLY Motion API", "version": "2.5.21", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

We make changes to the APIs from time to time. For more information, see Changelog.

\n

The xCALLY MOTION API consists of several different APIs. Use the left sidebar menu to select one.

\n

The API is a JSON API. XML is not supported. To learn more, see [Working with JSON].

\n

Endpoints are documented with the HTTP method for the request and a partial resource identifier.\nExample:

\n
GET /api/users\n
\n

Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:

\n
https://motion.xcally.com/api/users\n
\n

Curly braces, {}, indicate values you have to supply. Example:

\n
GET  /api/users/{id}\n
\n

The examples in the docs are cURL statements. You can run the statements on a command line to try out different API requests. To learn more, see [Installing and using cURL]. In Windows, you'll need to modify some of the examples in the docs to make them work. See [Using cURL in Windows].

\n

The examples use basic authentication requiring a xCALLY username and password.

\n

Security and Authentication

\n

This is an SSL-only API, regardless of how your account is configured. You can authorize against the API using either basic authentication with your username and password or with an OAuth access token or API Key.

\n

Client-side CORS requests are supported if the request is authenticated with an OAuth access token. The requests are not supported if the request uses basic authentication or API Key.

\n

Basic authentication

\n

Use the following authentication format with your username and password:\n{username}:{password}

\n

Example:

\n
curl -u admin:password https://motion.xcally.com/api/users\n
\n

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

In your requests, specify the access token in an Authorization header as follows:\nAuthorization: Bearer {token}

\n

Example:

\n
curl -H \"Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo\" https://motion.xcally.com/api/users\n
\n

API Key

\n

In your request, specify the API Key in apikey query parameter

\n

Example:

\n
curl https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\n
\n

Request Format

\n

The xCALLY API is a JSON API. You must supply a Content-Type: application/json header in PUT and POST requests. You must set an Accept: application/json header on all requests. You may get a text/plain response in case of an error like a bad request. You should treat this as an error you need to fix.

\n

Response Format

\n

The xCALLY API responds to successful requests with HTTP status codes in the 200 or 300 range. When you create or update a resource, the API renders the resulting JSON representation in the response body.

\n

Responses may have the status codes described in the following sections.

\n

200 range

\n

The request was successful. The status is 200 for successful GET and PUT requests, 201 for most POST requests, and 204 for DELETE requests.

\n

400 range

\n

The request was not successful. The content type of the response may be text/plain for API-level error messages, such as when trying to call the API without SSL. The content type is application/json for business-level error messages because the response includes a JSON object with information about the error.

\n

If you see a response from a known endpoint that looks like plain text, you probably made a syntax error in your request. This type of response commonly occurs when making a request to a nonexistent xCALLY Support instance.

\n

500 range

\n

When building an API client, we recommend treating any 500 status codes as a warning or temporary state. However, if the status persists and we don't have a publicly announced maintenance or service disruption, contact us at support@xcally.com.

\n

If submitting a ticket to Support, provide the complete HTTP response. This helps the Support team track down the request in the logs more quickly.

\n

Data Types

\n

The API returns and accepts JSON values, which can be strings in double quotes, numbers, objects, arrays, true or false, or null. Most programming languages have tools to parse this data.

\n

ID integers

\n

Most xCALLY Support resources such as queues and users are identified by the integer specified by the id attribute of API responses.

\n

The default numeric type in JavaScript, Ruby, Python, and PHP is sufficient to represent xCALLY Support ID integers.

\n

Time stamps

\n

Time stamps use UTC time and are formatted as ISO 8601 strings. Example: 2017-04-16T09:14:57Z

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2021-03-12T14:38:38.173Z", "url": "http://apidocjs.com", "version": "0.19.0" } } diff --git a/server/api/UserChatInteraction/UserChatInteraction.attributes.js b/server/api/UserChatInteraction/UserChatInteraction.attributes.js index d015472..0bb7689 100644 --- a/server/api/UserChatInteraction/UserChatInteraction.attributes.js +++ b/server/api/UserChatInteraction/UserChatInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x150a=['INTEGER','sequelize','exports'];(function(_0x527a1e,_0x3b6c45){var _0x548ddc=function(_0x343c4b){while(--_0x343c4b){_0x527a1e['push'](_0x527a1e['shift']());}};_0x548ddc(++_0x3b6c45);}(_0x150a,0xaf));var _0xa150=function(_0x170b20,_0x49fc52){_0x170b20=_0x170b20-0x0;var _0xbe0395=_0x150a[_0x170b20];return _0xbe0395;};'use strict';var Sequelize=require(_0xa150('0x0'));module[_0xa150('0x1')]={'ChatInteractionId':{'type':Sequelize[_0xa150('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file +var _0xff86=['exports','INTEGER','sequelize'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xff86,0x173));var _0x6ff8=function(_0xb9f4ed,_0x41afa0){_0xb9f4ed=_0xb9f4ed-0x0;var _0x30fbbf=_0xff86[_0xb9f4ed];return _0x30fbbf;};'use strict';var Sequelize=require(_0x6ff8('0x0'));module[_0x6ff8('0x1')]={'ChatInteractionId':{'type':Sequelize[_0x6ff8('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.controller.js b/server/api/UserChatInteraction/UserChatInteraction.controller.js index d7dffc6..5b4b6cd 100644 --- a/server/api/UserChatInteraction/UserChatInteraction.controller.js +++ b/server/api/UserChatInteraction/UserChatInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd7b=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','get','UserChatInteractions','UserProfileResource','error','stack','name','send','index','map','UserChatInteraction','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','filter','options','count','includeAll','include','rows','catch','show','params','rawAttributes','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x31b8ac,_0x1dbe1c){var _0x138333=function(_0xdfa342){while(--_0xdfa342){_0x31b8ac['push'](_0x31b8ac['shift']());}};_0x138333(++_0x1dbe1c);}(_0xbd7b,0x1ec));var _0xbbd7=function(_0x3ea133,_0x30fe05){_0x3ea133=_0x3ea133-0x0;var _0x49a93d=_0xbd7b[_0x3ea133];return _0x49a93d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbbd7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbbd7('0x1'));var rp=require(_0xbbd7('0x2'));var moment=require(_0xbbd7('0x3'));var BPromise=require(_0xbbd7('0x4'));var Mustache=require(_0xbbd7('0x5'));var util=require(_0xbbd7('0x6'));var path=require('path');var sox=require(_0xbbd7('0x7'));var csv=require(_0xbbd7('0x8'));var ejs=require(_0xbbd7('0x9'));var fs=require('fs');var _=require(_0xbbd7('0xa'));var squel=require(_0xbbd7('0xb'));var crypto=require(_0xbbd7('0xc'));var jsforce=require(_0xbbd7('0xd'));var deskjs=require(_0xbbd7('0xe'));var toCsv=require(_0xbbd7('0x8'));var querystring=require('querystring');var Papa=require(_0xbbd7('0xf'));var Redis=require(_0xbbd7('0x10'));var authService=require(_0xbbd7('0x11'));var qs=require(_0xbbd7('0x12'));var as=require(_0xbbd7('0x13'));var hardwareService=require(_0xbbd7('0x14'));var logger=require(_0xbbd7('0x15'))(_0xbbd7('0x16'));var utils=require('../../config/utils');var config=require(_0xbbd7('0x17'));var licenseUtil=require(_0xbbd7('0x18'));var db=require(_0xbbd7('0x19'))['db'];function respondWithStatusCode(_0x1ae09f,_0x40ce29){_0x40ce29=_0x40ce29||0xcc;return function(_0x1a0de1){if(_0x1a0de1){return _0x1ae09f[_0xbbd7('0x1a')](_0x40ce29);}return _0x1ae09f[_0xbbd7('0x1b')](_0x40ce29)[_0xbbd7('0x1c')]();};}function respondWithResult(_0x550929,_0x256c29){_0x256c29=_0x256c29||0xc8;return function(_0x356d47){if(_0x356d47){return _0x550929[_0xbbd7('0x1b')](_0x256c29)['json'](_0x356d47);}};}function respondWithFilteredResult(_0x4e6e73,_0x39b638){return function(_0x2e91ff){if(_0x2e91ff){var _0x9d2788=_0x2e91ff['count'],_0x449654=_0x39b638[_0xbbd7('0x1d')],_0x542d42=_0x39b638['offset']+_0x39b638[_0xbbd7('0x1e')],_0x132b73;if(_0x542d42>=_0x9d2788){_0x542d42=_0x9d2788;_0x132b73=0xc8;}else{_0x132b73=0xce;}_0x4e6e73[_0xbbd7('0x1b')](_0x132b73);return _0x4e6e73[_0xbbd7('0x1f')](_0xbbd7('0x20'),_0x449654+'-'+_0x542d42+'/'+_0x9d2788)[_0xbbd7('0x21')](_0x2e91ff);}return null;};}function patchUpdates(_0x462ffb){return function(_0x4b81ce){try{jsonpatch['apply'](_0x4b81ce,_0x462ffb,!![]);}catch(_0x2c6698){return BPromise[_0xbbd7('0x22')](_0x2c6698);}return _0x4b81ce[_0xbbd7('0x23')]();};}function saveUpdates(_0x140e6f,_0x537be5){return function(_0x5aab7d){if(_0x5aab7d){return _0x5aab7d[_0xbbd7('0x24')](_0x140e6f)[_0xbbd7('0x25')](function(_0x252176){return _0x252176;});}return null;};}function removeEntity(_0x452a96,_0x5623ae){return function(_0x4d1dc9){if(_0x4d1dc9){return _0x4d1dc9[_0xbbd7('0x26')]()[_0xbbd7('0x25')](function(){var _0x1fa8a6=_0x4d1dc9[_0xbbd7('0x27')]({'plain':!![]});var _0x553e62=_0xbbd7('0x28');return db[_0xbbd7('0x29')]['destroy']({'where':{'type':_0x553e62,'resourceId':_0x1fa8a6['id']}})[_0xbbd7('0x25')](function(){return _0x4d1dc9;});})[_0xbbd7('0x25')](function(){_0x452a96[_0xbbd7('0x1b')](0xcc)[_0xbbd7('0x1c')]();});}};}function handleEntityNotFound(_0x494f0c,_0x5ee248){return function(_0x3e657e){if(!_0x3e657e){_0x494f0c[_0xbbd7('0x1a')](0x194);}return _0x3e657e;};}function handleError(_0x5a30e1,_0x5951f6){_0x5951f6=_0x5951f6||0x1f4;return function(_0x27eea9){logger[_0xbbd7('0x2a')](_0x27eea9[_0xbbd7('0x2b')]);if(_0x27eea9[_0xbbd7('0x2c')]){delete _0x27eea9[_0xbbd7('0x2c')];}_0x5a30e1['status'](_0x5951f6)[_0xbbd7('0x2d')](_0x27eea9);};}exports[_0xbbd7('0x2e')]=function(_0x3af87b,_0x36cb34){var _0xeeabef={},_0x20b991={},_0x44adf5={'count':0x0,'rows':[]};var _0x4449d1=_[_0xbbd7('0x2f')](db[_0xbbd7('0x30')]['rawAttributes'],function(_0x122b18){return{'name':_0x122b18[_0xbbd7('0x31')],'type':_0x122b18[_0xbbd7('0x32')][_0xbbd7('0x33')]};});_0x20b991[_0xbbd7('0x34')]=_['map'](_0x4449d1,_0xbbd7('0x2c'));_0x20b991['query']=_['keys'](_0x3af87b[_0xbbd7('0x35')]);_0x20b991['filters']=_[_0xbbd7('0x36')](_0x20b991[_0xbbd7('0x34')],_0x20b991['query']);_0xeeabef[_0xbbd7('0x37')]=_[_0xbbd7('0x36')](_0x20b991[_0xbbd7('0x34')],qs['fields'](_0x3af87b['query'][_0xbbd7('0x38')]));_0xeeabef[_0xbbd7('0x37')]=_0xeeabef[_0xbbd7('0x37')]['length']?_0xeeabef['attributes']:_0x20b991[_0xbbd7('0x34')];if(!_0x3af87b['query'][_0xbbd7('0x39')](_0xbbd7('0x3a'))){_0xeeabef[_0xbbd7('0x1e')]=qs['limit'](_0x3af87b[_0xbbd7('0x35')][_0xbbd7('0x1e')]);_0xeeabef['offset']=qs[_0xbbd7('0x1d')](_0x3af87b['query']['offset']);}_0xeeabef['order']=qs[_0xbbd7('0x3b')](_0x3af87b['query']['sort']);_0xeeabef[_0xbbd7('0x3c')]=qs[_0xbbd7('0x3d')](_[_0xbbd7('0x3e')](_0x3af87b['query'],_0x20b991['filters']),_0x4449d1);if(_0x3af87b[_0xbbd7('0x35')]['filter']){_0xeeabef[_0xbbd7('0x3c')]=_[_0xbbd7('0x3f')](_0xeeabef['where'],{'$or':_[_0xbbd7('0x2f')](_0x4449d1,function(_0x31dc0e){if(_0x31dc0e['type']!=='VIRTUAL'){var _0x390030={};_0x390030[_0x31dc0e['name']]={'$like':'%'+_0x3af87b[_0xbbd7('0x35')][_0xbbd7('0x40')]+'%'};return _0x390030;}})});}_0xeeabef=_[_0xbbd7('0x3f')]({},_0xeeabef,_0x3af87b[_0xbbd7('0x41')]);var _0x216c86={'where':_0xeeabef[_0xbbd7('0x3c')]};return db[_0xbbd7('0x30')][_0xbbd7('0x42')](_0x216c86)['then'](function(_0x3dbcb6){_0x44adf5['count']=_0x3dbcb6;if(_0x3af87b['query'][_0xbbd7('0x43')]){_0xeeabef[_0xbbd7('0x44')]=[{'all':!![]}];}return db[_0xbbd7('0x30')]['findAll'](_0xeeabef);})[_0xbbd7('0x25')](function(_0x522aaf){_0x44adf5[_0xbbd7('0x45')]=_0x522aaf;return _0x44adf5;})[_0xbbd7('0x25')](respondWithFilteredResult(_0x36cb34,_0xeeabef))[_0xbbd7('0x46')](handleError(_0x36cb34,null));};exports[_0xbbd7('0x47')]=function(_0x3ab078,_0x454127){var _0x150051={'raw':!![],'where':{'id':_0x3ab078[_0xbbd7('0x48')]['id']}},_0x51615a={};_0x51615a[_0xbbd7('0x34')]=_['keys'](db[_0xbbd7('0x30')][_0xbbd7('0x49')]);_0x51615a[_0xbbd7('0x35')]=_[_0xbbd7('0x4a')](_0x3ab078['query']);_0x51615a[_0xbbd7('0x3d')]=_[_0xbbd7('0x36')](_0x51615a[_0xbbd7('0x34')],_0x51615a[_0xbbd7('0x35')]);_0x150051['attributes']=_[_0xbbd7('0x36')](_0x51615a['model'],qs[_0xbbd7('0x38')](_0x3ab078[_0xbbd7('0x35')][_0xbbd7('0x38')]));_0x150051[_0xbbd7('0x37')]=_0x150051[_0xbbd7('0x37')][_0xbbd7('0x4b')]?_0x150051['attributes']:_0x51615a[_0xbbd7('0x34')];if(_0x3ab078[_0xbbd7('0x35')][_0xbbd7('0x43')]){_0x150051[_0xbbd7('0x44')]=[{'all':!![]}];}_0x150051=_['merge']({},_0x150051,_0x3ab078[_0xbbd7('0x41')]);return db[_0xbbd7('0x30')][_0xbbd7('0x4c')](_0x150051)['then'](handleEntityNotFound(_0x454127,null))['then'](respondWithResult(_0x454127,null))['catch'](handleError(_0x454127,null));};exports[_0xbbd7('0x4d')]=function(_0x248bc1,_0x54c375){return db[_0xbbd7('0x30')][_0xbbd7('0x4d')](_0x248bc1['body'],{})['then'](function(_0x19027e){var _0x3b8976=_0x248bc1[_0xbbd7('0x4e')]['get']({'plain':!![]});if(!_0x3b8976)throw new Error(_0xbbd7('0x4f'));if(_0x3b8976[_0xbbd7('0x50')]===_0xbbd7('0x4e')){var _0x213eea=_0x19027e[_0xbbd7('0x27')]({'plain':!![]});var _0x4032d0='UserChatInteractions';return db['UserProfileSection'][_0xbbd7('0x4c')]({'where':{'name':_0x4032d0,'userProfileId':_0x3b8976[_0xbbd7('0x51')]},'raw':!![]})[_0xbbd7('0x25')](function(_0x1d65e1){if(_0x1d65e1&&_0x1d65e1[_0xbbd7('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x213eea[_0xbbd7('0x2c')],'resourceId':_0x213eea['id'],'type':_0x1d65e1[_0xbbd7('0x2c')],'sectionId':_0x1d65e1['id']},{})[_0xbbd7('0x25')](function(){return _0x19027e;});}else{return _0x19027e;}})[_0xbbd7('0x46')](function(_0x54d552){logger[_0xbbd7('0x2a')](_0xbbd7('0x53'),_0x54d552);throw _0x54d552;});}return _0x19027e;})[_0xbbd7('0x25')](respondWithResult(_0x54c375,0xc9))['catch'](handleError(_0x54c375,null));};exports['update']=function(_0xeeb66f,_0x486c97){if(_0xeeb66f['body']['id']){delete _0xeeb66f[_0xbbd7('0x54')]['id'];}return db[_0xbbd7('0x30')][_0xbbd7('0x4c')]({'where':{'id':_0xeeb66f[_0xbbd7('0x48')]['id']}})['then'](handleEntityNotFound(_0x486c97,null))[_0xbbd7('0x25')](saveUpdates(_0xeeb66f[_0xbbd7('0x54')],null))[_0xbbd7('0x25')](respondWithResult(_0x486c97,null))[_0xbbd7('0x46')](handleError(_0x486c97,null));};exports[_0xbbd7('0x26')]=function(_0x8ae0a1,_0x471b4f){return db[_0xbbd7('0x30')][_0xbbd7('0x4c')]({'where':{'id':_0x8ae0a1[_0xbbd7('0x48')]['id']}})[_0xbbd7('0x25')](handleEntityNotFound(_0x471b4f,null))[_0xbbd7('0x25')](removeEntity(_0x471b4f,null))[_0xbbd7('0x46')](handleError(_0x471b4f,null));}; \ No newline at end of file +var _0x6629=['sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','UserChatInteractions','end','error','stack','name','send','map','UserChatInteraction','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','includeAll','include','rows','catch','show','params','length','options','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x28192e,_0x579b24){var _0x3f6c9c=function(_0x725af8){while(--_0x725af8){_0x28192e['push'](_0x28192e['shift']());}};_0x3f6c9c(++_0x579b24);}(_0x6629,0x1c2));var _0x9662=function(_0x2b110a,_0x42b678){_0x2b110a=_0x2b110a-0x0;var _0x7e5707=_0x6629[_0x2b110a];return _0x7e5707;};'use strict';var pdf=require(_0x9662('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9662('0x1'));var jsonpatch=require(_0x9662('0x2'));var rp=require(_0x9662('0x3'));var moment=require(_0x9662('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9662('0x5'));var util=require(_0x9662('0x6'));var path=require(_0x9662('0x7'));var sox=require('sox');var csv=require(_0x9662('0x8'));var ejs=require(_0x9662('0x9'));var fs=require('fs');var _=require(_0x9662('0xa'));var squel=require('squel');var crypto=require(_0x9662('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9662('0xc'));var toCsv=require(_0x9662('0x8'));var querystring=require(_0x9662('0xd'));var Papa=require(_0x9662('0xe'));var Redis=require(_0x9662('0xf'));var authService=require(_0x9662('0x10'));var qs=require(_0x9662('0x11'));var as=require(_0x9662('0x12'));var hardwareService=require(_0x9662('0x13'));var logger=require(_0x9662('0x14'))(_0x9662('0x15'));var utils=require('../../config/utils');var config=require(_0x9662('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9662('0x17'))['db'];function respondWithStatusCode(_0x8db665,_0x5d55bd){_0x5d55bd=_0x5d55bd||0xcc;return function(_0x317f88){if(_0x317f88){return _0x8db665[_0x9662('0x18')](_0x5d55bd);}return _0x8db665[_0x9662('0x19')](_0x5d55bd)['end']();};}function respondWithResult(_0x533fc4,_0x2186fc){_0x2186fc=_0x2186fc||0xc8;return function(_0x54b966){if(_0x54b966){return _0x533fc4[_0x9662('0x19')](_0x2186fc)[_0x9662('0x1a')](_0x54b966);}};}function respondWithFilteredResult(_0x25c17c,_0x5a55c5){return function(_0x4d608d){if(_0x4d608d){var _0x531ec5=_0x4d608d[_0x9662('0x1b')],_0x1a6606=_0x5a55c5[_0x9662('0x1c')],_0xd555b6=_0x5a55c5[_0x9662('0x1c')]+_0x5a55c5[_0x9662('0x1d')],_0x4930c5;if(_0xd555b6>=_0x531ec5){_0xd555b6=_0x531ec5;_0x4930c5=0xc8;}else{_0x4930c5=0xce;}_0x25c17c[_0x9662('0x19')](_0x4930c5);return _0x25c17c[_0x9662('0x1e')]('Content-Range',_0x1a6606+'-'+_0xd555b6+'/'+_0x531ec5)[_0x9662('0x1a')](_0x4d608d);}return null;};}function patchUpdates(_0x2dce5d){return function(_0x4e69af){try{jsonpatch[_0x9662('0x1f')](_0x4e69af,_0x2dce5d,!![]);}catch(_0xef0462){return BPromise[_0x9662('0x20')](_0xef0462);}return _0x4e69af[_0x9662('0x21')]();};}function saveUpdates(_0x2e16cf,_0x2ef848){return function(_0x23ca68){if(_0x23ca68){return _0x23ca68[_0x9662('0x22')](_0x2e16cf)[_0x9662('0x23')](function(_0xf2005a){return _0xf2005a;});}return null;};}function removeEntity(_0x5e4083,_0x521094){return function(_0x3178c1){if(_0x3178c1){return _0x3178c1[_0x9662('0x24')]()[_0x9662('0x23')](function(){var _0x12170b=_0x3178c1[_0x9662('0x25')]({'plain':!![]});var _0x3d8d97=_0x9662('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x3d8d97,'resourceId':_0x12170b['id']}})[_0x9662('0x23')](function(){return _0x3178c1;});})[_0x9662('0x23')](function(){_0x5e4083[_0x9662('0x19')](0xcc)[_0x9662('0x27')]();});}};}function handleEntityNotFound(_0x5a16cd,_0x2beb50){return function(_0x2f4d28){if(!_0x2f4d28){_0x5a16cd[_0x9662('0x18')](0x194);}return _0x2f4d28;};}function handleError(_0x3c69ab,_0x3e1af2){_0x3e1af2=_0x3e1af2||0x1f4;return function(_0x402896){logger[_0x9662('0x28')](_0x402896[_0x9662('0x29')]);if(_0x402896['name']){delete _0x402896[_0x9662('0x2a')];}_0x3c69ab[_0x9662('0x19')](_0x3e1af2)[_0x9662('0x2b')](_0x402896);};}exports['index']=function(_0x4f59c7,_0x4f18a9){var _0x56e731={},_0x54a8b4={},_0x481bb5={'count':0x0,'rows':[]};var _0x8a6cad=_[_0x9662('0x2c')](db[_0x9662('0x2d')][_0x9662('0x2e')],function(_0x4ae219){return{'name':_0x4ae219['fieldName'],'type':_0x4ae219[_0x9662('0x2f')]['key']};});_0x54a8b4[_0x9662('0x30')]=_[_0x9662('0x2c')](_0x8a6cad,_0x9662('0x2a'));_0x54a8b4[_0x9662('0x31')]=_[_0x9662('0x32')](_0x4f59c7['query']);_0x54a8b4[_0x9662('0x33')]=_[_0x9662('0x34')](_0x54a8b4[_0x9662('0x30')],_0x54a8b4[_0x9662('0x31')]);_0x56e731[_0x9662('0x35')]=_['intersection'](_0x54a8b4[_0x9662('0x30')],qs['fields'](_0x4f59c7[_0x9662('0x31')][_0x9662('0x36')]));_0x56e731[_0x9662('0x35')]=_0x56e731['attributes']['length']?_0x56e731['attributes']:_0x54a8b4[_0x9662('0x30')];if(!_0x4f59c7[_0x9662('0x31')][_0x9662('0x37')]('nolimit')){_0x56e731[_0x9662('0x1d')]=qs[_0x9662('0x1d')](_0x4f59c7['query'][_0x9662('0x1d')]);_0x56e731[_0x9662('0x1c')]=qs[_0x9662('0x1c')](_0x4f59c7[_0x9662('0x31')]['offset']);}_0x56e731['order']=qs[_0x9662('0x38')](_0x4f59c7[_0x9662('0x31')][_0x9662('0x38')]);_0x56e731['where']=qs[_0x9662('0x33')](_[_0x9662('0x39')](_0x4f59c7[_0x9662('0x31')],_0x54a8b4[_0x9662('0x33')]),_0x8a6cad);if(_0x4f59c7[_0x9662('0x31')][_0x9662('0x3a')]){_0x56e731[_0x9662('0x3b')]=_['merge'](_0x56e731['where'],{'$or':_['map'](_0x8a6cad,function(_0x41fbcc){if(_0x41fbcc['type']!=='VIRTUAL'){var _0x232d7e={};_0x232d7e[_0x41fbcc[_0x9662('0x2a')]]={'$like':'%'+_0x4f59c7['query'][_0x9662('0x3a')]+'%'};return _0x232d7e;}})});}_0x56e731=_[_0x9662('0x3c')]({},_0x56e731,_0x4f59c7['options']);var _0x49ab25={'where':_0x56e731[_0x9662('0x3b')]};return db[_0x9662('0x2d')][_0x9662('0x1b')](_0x49ab25)[_0x9662('0x23')](function(_0x127fed){_0x481bb5['count']=_0x127fed;if(_0x4f59c7['query'][_0x9662('0x3d')]){_0x56e731[_0x9662('0x3e')]=[{'all':!![]}];}return db[_0x9662('0x2d')]['findAll'](_0x56e731);})[_0x9662('0x23')](function(_0x2f01b4){_0x481bb5[_0x9662('0x3f')]=_0x2f01b4;return _0x481bb5;})[_0x9662('0x23')](respondWithFilteredResult(_0x4f18a9,_0x56e731))[_0x9662('0x40')](handleError(_0x4f18a9,null));};exports[_0x9662('0x41')]=function(_0xe6a507,_0x31850c){var _0x47b895={'raw':!![],'where':{'id':_0xe6a507[_0x9662('0x42')]['id']}},_0x5b00b2={};_0x5b00b2[_0x9662('0x30')]=_[_0x9662('0x32')](db[_0x9662('0x2d')][_0x9662('0x2e')]);_0x5b00b2[_0x9662('0x31')]=_[_0x9662('0x32')](_0xe6a507[_0x9662('0x31')]);_0x5b00b2[_0x9662('0x33')]=_[_0x9662('0x34')](_0x5b00b2['model'],_0x5b00b2['query']);_0x47b895['attributes']=_[_0x9662('0x34')](_0x5b00b2['model'],qs[_0x9662('0x36')](_0xe6a507[_0x9662('0x31')][_0x9662('0x36')]));_0x47b895[_0x9662('0x35')]=_0x47b895[_0x9662('0x35')][_0x9662('0x43')]?_0x47b895['attributes']:_0x5b00b2['model'];if(_0xe6a507[_0x9662('0x31')][_0x9662('0x3d')]){_0x47b895[_0x9662('0x3e')]=[{'all':!![]}];}_0x47b895=_[_0x9662('0x3c')]({},_0x47b895,_0xe6a507[_0x9662('0x44')]);return db[_0x9662('0x2d')]['find'](_0x47b895)[_0x9662('0x23')](handleEntityNotFound(_0x31850c,null))[_0x9662('0x23')](respondWithResult(_0x31850c,null))[_0x9662('0x40')](handleError(_0x31850c,null));};exports['create']=function(_0x2a6f55,_0x5b85d0){return db['UserChatInteraction'][_0x9662('0x45')](_0x2a6f55['body'],{})[_0x9662('0x23')](function(_0x4440e5){var _0x228744=_0x2a6f55[_0x9662('0x46')][_0x9662('0x25')]({'plain':!![]});if(!_0x228744)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x228744[_0x9662('0x47')]===_0x9662('0x46')){var _0x247a41=_0x4440e5[_0x9662('0x25')]({'plain':!![]});var _0xe83f20=_0x9662('0x26');return db[_0x9662('0x48')][_0x9662('0x49')]({'where':{'name':_0xe83f20,'userProfileId':_0x228744[_0x9662('0x4a')]},'raw':!![]})[_0x9662('0x23')](function(_0x1bc310){if(_0x1bc310&&_0x1bc310[_0x9662('0x4b')]===0x0){return db[_0x9662('0x4c')][_0x9662('0x45')]({'name':_0x247a41[_0x9662('0x2a')],'resourceId':_0x247a41['id'],'type':_0x1bc310[_0x9662('0x2a')],'sectionId':_0x1bc310['id']},{})[_0x9662('0x23')](function(){return _0x4440e5;});}else{return _0x4440e5;}})['catch'](function(_0x319c10){logger['error'](_0x9662('0x4d'),_0x319c10);throw _0x319c10;});}return _0x4440e5;})['then'](respondWithResult(_0x5b85d0,0xc9))[_0x9662('0x40')](handleError(_0x5b85d0,null));};exports[_0x9662('0x22')]=function(_0x5ea3fd,_0x371037){if(_0x5ea3fd[_0x9662('0x4e')]['id']){delete _0x5ea3fd['body']['id'];}return db['UserChatInteraction']['find']({'where':{'id':_0x5ea3fd[_0x9662('0x42')]['id']}})['then'](handleEntityNotFound(_0x371037,null))[_0x9662('0x23')](saveUpdates(_0x5ea3fd[_0x9662('0x4e')],null))[_0x9662('0x23')](respondWithResult(_0x371037,null))[_0x9662('0x40')](handleError(_0x371037,null));};exports[_0x9662('0x24')]=function(_0x679e56,_0x3dfabc){return db[_0x9662('0x2d')][_0x9662('0x49')]({'where':{'id':_0x679e56[_0x9662('0x42')]['id']}})['then'](handleEntityNotFound(_0x3dfabc,null))[_0x9662('0x23')](removeEntity(_0x3dfabc,null))[_0x9662('0x40')](handleError(_0x3dfabc,null));}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.model.js b/server/api/UserChatInteraction/UserChatInteraction.model.js index c885ccf..5a75d95 100644 --- a/server/api/UserChatInteraction/UserChatInteraction.model.js +++ b/server/api/UserChatInteraction/UserChatInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5eb=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','user_has_chat_interactions','lodash','util'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xe5eb,0x196));var _0xbe5e=function(_0x16a1ae,_0x74d910){_0x16a1ae=_0x16a1ae-0x0;var _0x53b594=_0xe5eb[_0x16a1ae];return _0x53b594;};'use strict';var _=require(_0xbe5e('0x0'));var util=require(_0xbe5e('0x1'));var logger=require(_0xbe5e('0x2'))(_0xbe5e('0x3'));var moment=require('moment');var BPromise=require(_0xbe5e('0x4'));var rp=require(_0xbe5e('0x5'));var fs=require('fs');var path=require(_0xbe5e('0x6'));var rimraf=require(_0xbe5e('0x7'));var config=require(_0xbe5e('0x8'));var attributes=require('./UserChatInteraction.attributes');module[_0xbe5e('0x9')]=function(_0x2c0c8e,_0x3953b6){return _0x2c0c8e[_0xbe5e('0xa')]('UserChatInteraction',attributes,{'tableName':_0xbe5e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ca0=['util','moment','bluebird','request-promise','../../config/environment','exports','define','UserChatInteraction','user_has_chat_interactions','lodash'];(function(_0xe4936,_0x3cd5c0){var _0x254fee=function(_0x3a2b9f){while(--_0x3a2b9f){_0xe4936['push'](_0xe4936['shift']());}};_0x254fee(++_0x3cd5c0);}(_0x6ca0,0x9f));var _0x06ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ca0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x06ca('0x0'));var util=require(_0x06ca('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x06ca('0x2'));var BPromise=require(_0x06ca('0x3'));var rp=require(_0x06ca('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x06ca('0x5'));var attributes=require('./UserChatInteraction.attributes');module[_0x06ca('0x6')]=function(_0x495dca,_0x3a1d75){return _0x495dca[_0x06ca('0x7')](_0x06ca('0x8'),attributes,{'tableName':_0x06ca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.rpc.js b/server/api/UserChatInteraction/UserChatInteraction.rpc.js index 373aeb7..ddba7f9 100644 --- a/server/api/UserChatInteraction/UserChatInteraction.rpc.js +++ b/server/api/UserChatInteraction/UserChatInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe432=['error','code','message','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','UserChatInteraction,\x20%s,\x20%s','request\x20sent','debug','UserChatInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4e9340,_0x247fec){var _0x2b0b5a=function(_0x1b1fd5){while(--_0x1b1fd5){_0x4e9340['push'](_0x4e9340['shift']());}};_0x2b0b5a(++_0x247fec);}(_0xe432,0xe0));var _0x2e43=function(_0x302519,_0x1dbe43){_0x302519=_0x302519-0x0;var _0x127674=_0xe432[_0x302519];return _0x127674;};'use strict';var _=require(_0x2e43('0x0'));var util=require(_0x2e43('0x1'));var moment=require('moment');var BPromise=require(_0x2e43('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e43('0x3'))['db'];var utils=require(_0x2e43('0x4'));var logger=require(_0x2e43('0x5'))(_0x2e43('0x6'));var config=require(_0x2e43('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2e43('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x310898,_0x2a0ea5,_0x4f6246){return new BPromise(function(_0x50826f,_0x5d0bfa){return client[_0x2e43('0x9')](_0x310898,_0x4f6246)[_0x2e43('0xa')](function(_0x5d68f5){logger['info'](_0x2e43('0xb'),_0x2a0ea5,_0x2e43('0xc'));logger[_0x2e43('0xd')](_0x2e43('0xe'),_0x2a0ea5,_0x2e43('0xc'),JSON[_0x2e43('0xf')](_0x5d68f5));if(_0x5d68f5['error']){if(_0x5d68f5[_0x2e43('0x10')][_0x2e43('0x11')]===0x1f4){logger[_0x2e43('0x10')](_0x2e43('0xb'),_0x2a0ea5,_0x5d68f5['error'][_0x2e43('0x12')]);return _0x5d0bfa(_0x5d68f5[_0x2e43('0x10')][_0x2e43('0x12')]);}logger[_0x2e43('0x10')](_0x2e43('0xb'),_0x2a0ea5,_0x5d68f5['error'][_0x2e43('0x12')]);return _0x50826f(_0x5d68f5['error'][_0x2e43('0x12')]);}else{logger['info'](_0x2e43('0xb'),_0x2a0ea5,_0x2e43('0xc'));_0x50826f(_0x5d68f5['result'][_0x2e43('0x12')]);}})[_0x2e43('0x13')](function(_0x18bbaf){logger[_0x2e43('0x10')](_0x2e43('0xb'),_0x2a0ea5,_0x18bbaf);_0x5d0bfa(_0x18bbaf);});});} \ No newline at end of file +var _0xd774=['jayson/promise','client','http','info','UserChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','randomstring','../../mysqldb','rpc','../../config/environment'];(function(_0x3c2bf2,_0x483e7f){var _0x25a0ac=function(_0x47d56c){while(--_0x47d56c){_0x3c2bf2['push'](_0x3c2bf2['shift']());}};_0x25a0ac(++_0x483e7f);}(_0xd774,0xe5));var _0x4d77=function(_0x4bffac,_0x586170){_0x4bffac=_0x4bffac-0x0;var _0x1d8504=_0xd774[_0x4bffac];return _0x1d8504;};'use strict';var _=require(_0x4d77('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d77('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d77('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4d77('0x3'));var config=require(_0x4d77('0x4'));var jayson=require(_0x4d77('0x5'));var client=jayson[_0x4d77('0x6')][_0x4d77('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f5ef7,_0x629bea,_0x1a360f){return new BPromise(function(_0x44a0c3,_0x4c28f1){return client['request'](_0x4f5ef7,_0x1a360f)['then'](function(_0xe78088){logger[_0x4d77('0x8')](_0x4d77('0x9'),_0x629bea,_0x4d77('0xa'));logger[_0x4d77('0xb')]('UserChatInteraction,\x20%s,\x20%s,\x20%s',_0x629bea,_0x4d77('0xa'),JSON[_0x4d77('0xc')](_0xe78088));if(_0xe78088['error']){if(_0xe78088['error'][_0x4d77('0xd')]===0x1f4){logger['error']('UserChatInteraction,\x20%s,\x20%s',_0x629bea,_0xe78088[_0x4d77('0xe')][_0x4d77('0xf')]);return _0x4c28f1(_0xe78088[_0x4d77('0xe')][_0x4d77('0xf')]);}logger[_0x4d77('0xe')](_0x4d77('0x9'),_0x629bea,_0xe78088['error'][_0x4d77('0xf')]);return _0x44a0c3(_0xe78088[_0x4d77('0xe')][_0x4d77('0xf')]);}else{logger[_0x4d77('0x8')](_0x4d77('0x9'),_0x629bea,_0x4d77('0xa'));_0x44a0c3(_0xe78088[_0x4d77('0x10')]['message']);}})[_0x4d77('0x11')](function(_0x5a1277){logger[_0x4d77('0xe')](_0x4d77('0x9'),_0x629bea,_0x5a1277);_0x4c28f1(_0x5a1277);});});} \ No newline at end of file diff --git a/server/api/UserChatInteraction/index.js b/server/api/UserChatInteraction/index.js index 86c9ae0..e17e9fd 100644 --- a/server/api/UserChatInteraction/index.js +++ b/server/api/UserChatInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9303=['util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create','put','delete','destroy','multer'];(function(_0xa74a97,_0x4c7be2){var _0x3fbd6b=function(_0x2ae6e8){while(--_0x2ae6e8){_0xa74a97['push'](_0xa74a97['shift']());}};_0x3fbd6b(++_0x4c7be2);}(_0x9303,0xc2));var _0x3930=function(_0x27e029,_0x17e305){_0x27e029=_0x27e029-0x0;var _0x29bf95=_0x9303[_0x27e029];return _0x29bf95;};'use strict';var multer=require(_0x3930('0x0'));var util=require(_0x3930('0x1'));var path=require('path');var timeout=require(_0x3930('0x2'));var express=require(_0x3930('0x3'));var router=express[_0x3930('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3930('0x5'));var config=require(_0x3930('0x6'));var controller=require('./UserChatInteraction.controller');router[_0x3930('0x7')]('/',auth[_0x3930('0x8')](),controller[_0x3930('0x9')]);router[_0x3930('0x7')](_0x3930('0xa'),auth[_0x3930('0x8')](),controller['show']);router['post']('/',auth[_0x3930('0x8')](),controller[_0x3930('0xb')]);router[_0x3930('0xc')]('/:id',auth[_0x3930('0x8')](),controller['update']);router[_0x3930('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x3930('0xe')]);module['exports']=router; \ No newline at end of file +var _0xbaa4=['../../components/interaction/service','../../config/environment','get','index','show','post','isAuthenticated','create','put','update','delete','/:id','destroy','exports','util','path','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbaa4,0x68));var _0x4baa=function(_0xe8c3f8,_0x4499a3){_0xe8c3f8=_0xe8c3f8-0x0;var _0x13d6ac=_0xbaa4[_0xe8c3f8];return _0x13d6ac;};'use strict';var multer=require('multer');var util=require(_0x4baa('0x0'));var path=require(_0x4baa('0x1'));var timeout=require('connect-timeout');var express=require(_0x4baa('0x2'));var router=express[_0x4baa('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4baa('0x4'));var config=require(_0x4baa('0x5'));var controller=require('./UserChatInteraction.controller');router[_0x4baa('0x6')]('/',auth['isAuthenticated'](),controller[_0x4baa('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4baa('0x8')]);router[_0x4baa('0x9')]('/',auth[_0x4baa('0xa')](),controller[_0x4baa('0xb')]);router[_0x4baa('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x4baa('0xd')]);router[_0x4baa('0xe')](_0x4baa('0xf'),auth[_0x4baa('0xa')](),controller[_0x4baa('0x10')]);module[_0x4baa('0x11')]=router; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js b/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js index 7c711ae..7aa2156 100644 --- a/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js +++ b/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe343=['exports','INTEGER','sequelize'];(function(_0x360673,_0x3038c4){var _0x24c5da=function(_0x2ce13b){while(--_0x2ce13b){_0x360673['push'](_0x360673['shift']());}};_0x24c5da(++_0x3038c4);}(_0xe343,0x6e));var _0x3e34=function(_0x3e0dc4,_0x13971b){_0x3e0dc4=_0x3e0dc4-0x0;var _0x586111=_0xe343[_0x3e0dc4];return _0x586111;};'use strict';var Sequelize=require(_0x3e34('0x0'));module[_0x3e34('0x1')]={'FaxInteractionId':{'type':Sequelize[_0x3e34('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file +var _0xcfd0=['INTEGER','exports'];(function(_0x56646e,_0x4556d5){var _0x5b37c6=function(_0x38e757){while(--_0x38e757){_0x56646e['push'](_0x56646e['shift']());}};_0x5b37c6(++_0x4556d5);}(_0xcfd0,0x1a5));var _0x0cfd=function(_0x360e5b,_0x366396){_0x360e5b=_0x360e5b-0x0;var _0x403393=_0xcfd0[_0x360e5b];return _0x403393;};'use strict';var Sequelize=require('sequelize');module[_0x0cfd('0x0')]={'FaxInteractionId':{'type':Sequelize[_0x0cfd('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x0cfd('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.controller.js b/server/api/UserFaxInteraction/UserFaxInteraction.controller.js index 5f086f8..9e57ddf 100644 --- a/server/api/UserFaxInteraction/UserFaxInteraction.controller.js +++ b/server/api/UserFaxInteraction/UserFaxInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xddd9=['fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','options','includeAll','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','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','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','sendStatus','error','stack','name','send','index','map','UserFaxInteraction','rawAttributes'];(function(_0x2d486b,_0x5f213c){var _0x4291d1=function(_0x2cebcb){while(--_0x2cebcb){_0x2d486b['push'](_0x2d486b['shift']());}};_0x4291d1(++_0x5f213c);}(_0xddd9,0x15b));var _0x9ddd=function(_0x41ab58,_0xffbf0b){_0x41ab58=_0x41ab58-0x0;var _0x2755e3=_0xddd9[_0x41ab58];return _0x2755e3;};'use strict';var pdf=require(_0x9ddd('0x0'));var emlformat=require(_0x9ddd('0x1'));var rimraf=require(_0x9ddd('0x2'));var zipdir=require(_0x9ddd('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ddd('0x4'));var moment=require(_0x9ddd('0x5'));var BPromise=require(_0x9ddd('0x6'));var Mustache=require(_0x9ddd('0x7'));var util=require('util');var path=require('path');var sox=require(_0x9ddd('0x8'));var csv=require(_0x9ddd('0x9'));var ejs=require(_0x9ddd('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9ddd('0xb'));var deskjs=require(_0x9ddd('0xc'));var toCsv=require(_0x9ddd('0x9'));var querystring=require(_0x9ddd('0xd'));var Papa=require(_0x9ddd('0xe'));var Redis=require(_0x9ddd('0xf'));var authService=require(_0x9ddd('0x10'));var qs=require(_0x9ddd('0x11'));var as=require(_0x9ddd('0x12'));var hardwareService=require(_0x9ddd('0x13'));var logger=require(_0x9ddd('0x14'))('api');var utils=require(_0x9ddd('0x15'));var config=require(_0x9ddd('0x16'));var licenseUtil=require(_0x9ddd('0x17'));var db=require(_0x9ddd('0x18'))['db'];function respondWithStatusCode(_0x1a11ca,_0x1ef3d9){_0x1ef3d9=_0x1ef3d9||0xcc;return function(_0x7ece1d){if(_0x7ece1d){return _0x1a11ca['sendStatus'](_0x1ef3d9);}return _0x1a11ca[_0x9ddd('0x19')](_0x1ef3d9)[_0x9ddd('0x1a')]();};}function respondWithResult(_0x2f5dbd,_0x3776de){_0x3776de=_0x3776de||0xc8;return function(_0x2ed843){if(_0x2ed843){return _0x2f5dbd['status'](_0x3776de)[_0x9ddd('0x1b')](_0x2ed843);}};}function respondWithFilteredResult(_0x119834,_0x26dac2){return function(_0x801bc){if(_0x801bc){var _0x16589e=_0x801bc[_0x9ddd('0x1c')],_0x395705=_0x26dac2[_0x9ddd('0x1d')],_0x9c6b02=_0x26dac2['offset']+_0x26dac2[_0x9ddd('0x1e')],_0xc3568d;if(_0x9c6b02>=_0x16589e){_0x9c6b02=_0x16589e;_0xc3568d=0xc8;}else{_0xc3568d=0xce;}_0x119834[_0x9ddd('0x19')](_0xc3568d);return _0x119834[_0x9ddd('0x1f')](_0x9ddd('0x20'),_0x395705+'-'+_0x9c6b02+'/'+_0x16589e)[_0x9ddd('0x1b')](_0x801bc);}return null;};}function patchUpdates(_0x11ffa6){return function(_0x2d75b1){try{jsonpatch[_0x9ddd('0x21')](_0x2d75b1,_0x11ffa6,!![]);}catch(_0x512c27){return BPromise['reject'](_0x512c27);}return _0x2d75b1[_0x9ddd('0x22')]();};}function saveUpdates(_0x4089f3,_0x7820a8){return function(_0x3abac2){if(_0x3abac2){return _0x3abac2[_0x9ddd('0x23')](_0x4089f3)[_0x9ddd('0x24')](function(_0xb8353b){return _0xb8353b;});}return null;};}function removeEntity(_0x472def,_0x5ec367){return function(_0x5e9b46){if(_0x5e9b46){return _0x5e9b46[_0x9ddd('0x25')]()[_0x9ddd('0x24')](function(){var _0x4efd30=_0x5e9b46[_0x9ddd('0x26')]({'plain':!![]});var _0x431b5c='UserFaxInteractions';return db['UserProfileResource'][_0x9ddd('0x25')]({'where':{'type':_0x431b5c,'resourceId':_0x4efd30['id']}})[_0x9ddd('0x24')](function(){return _0x5e9b46;});})[_0x9ddd('0x24')](function(){_0x472def['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x433168,_0x357f55){return function(_0x3e9115){if(!_0x3e9115){_0x433168[_0x9ddd('0x27')](0x194);}return _0x3e9115;};}function handleError(_0x23a346,_0x4567c3){_0x4567c3=_0x4567c3||0x1f4;return function(_0x40cc99){logger[_0x9ddd('0x28')](_0x40cc99[_0x9ddd('0x29')]);if(_0x40cc99['name']){delete _0x40cc99[_0x9ddd('0x2a')];}_0x23a346['status'](_0x4567c3)[_0x9ddd('0x2b')](_0x40cc99);};}exports[_0x9ddd('0x2c')]=function(_0x332048,_0x1a58bb){var _0x15a572={},_0x3582ab={},_0x9dd46c={'count':0x0,'rows':[]};var _0x2b349b=_[_0x9ddd('0x2d')](db[_0x9ddd('0x2e')][_0x9ddd('0x2f')],function(_0x9f190b){return{'name':_0x9f190b[_0x9ddd('0x30')],'type':_0x9f190b[_0x9ddd('0x31')][_0x9ddd('0x32')]};});_0x3582ab[_0x9ddd('0x33')]=_['map'](_0x2b349b,_0x9ddd('0x2a'));_0x3582ab[_0x9ddd('0x34')]=_['keys'](_0x332048['query']);_0x3582ab[_0x9ddd('0x35')]=_[_0x9ddd('0x36')](_0x3582ab[_0x9ddd('0x33')],_0x3582ab['query']);_0x15a572[_0x9ddd('0x37')]=_[_0x9ddd('0x36')](_0x3582ab[_0x9ddd('0x33')],qs[_0x9ddd('0x38')](_0x332048[_0x9ddd('0x34')]['fields']));_0x15a572[_0x9ddd('0x37')]=_0x15a572[_0x9ddd('0x37')][_0x9ddd('0x39')]?_0x15a572[_0x9ddd('0x37')]:_0x3582ab[_0x9ddd('0x33')];if(!_0x332048[_0x9ddd('0x34')][_0x9ddd('0x3a')]('nolimit')){_0x15a572[_0x9ddd('0x1e')]=qs[_0x9ddd('0x1e')](_0x332048[_0x9ddd('0x34')]['limit']);_0x15a572['offset']=qs[_0x9ddd('0x1d')](_0x332048['query'][_0x9ddd('0x1d')]);}_0x15a572[_0x9ddd('0x3b')]=qs[_0x9ddd('0x3c')](_0x332048['query'][_0x9ddd('0x3c')]);_0x15a572[_0x9ddd('0x3d')]=qs[_0x9ddd('0x35')](_['pick'](_0x332048[_0x9ddd('0x34')],_0x3582ab[_0x9ddd('0x35')]),_0x2b349b);if(_0x332048[_0x9ddd('0x34')]['filter']){_0x15a572[_0x9ddd('0x3d')]=_['merge'](_0x15a572['where'],{'$or':_['map'](_0x2b349b,function(_0xe1503){if(_0xe1503[_0x9ddd('0x31')]!=='VIRTUAL'){var _0x4ef220={};_0x4ef220[_0xe1503[_0x9ddd('0x2a')]]={'$like':'%'+_0x332048['query']['filter']+'%'};return _0x4ef220;}})});}_0x15a572=_[_0x9ddd('0x3e')]({},_0x15a572,_0x332048[_0x9ddd('0x3f')]);var _0x200e5c={'where':_0x15a572[_0x9ddd('0x3d')]};return db[_0x9ddd('0x2e')][_0x9ddd('0x1c')](_0x200e5c)[_0x9ddd('0x24')](function(_0x5a2251){_0x9dd46c[_0x9ddd('0x1c')]=_0x5a2251;if(_0x332048[_0x9ddd('0x34')][_0x9ddd('0x40')]){_0x15a572['include']=[{'all':!![]}];}return db[_0x9ddd('0x2e')][_0x9ddd('0x41')](_0x15a572);})['then'](function(_0xc6f26b){_0x9dd46c[_0x9ddd('0x42')]=_0xc6f26b;return _0x9dd46c;})[_0x9ddd('0x24')](respondWithFilteredResult(_0x1a58bb,_0x15a572))[_0x9ddd('0x43')](handleError(_0x1a58bb,null));};exports['show']=function(_0x55f532,_0xb0e4aa){var _0x278b1f={'raw':!![],'where':{'id':_0x55f532[_0x9ddd('0x44')]['id']}},_0x2c1d65={};_0x2c1d65[_0x9ddd('0x33')]=_['keys'](db[_0x9ddd('0x2e')][_0x9ddd('0x2f')]);_0x2c1d65[_0x9ddd('0x34')]=_['keys'](_0x55f532[_0x9ddd('0x34')]);_0x2c1d65[_0x9ddd('0x35')]=_[_0x9ddd('0x36')](_0x2c1d65[_0x9ddd('0x33')],_0x2c1d65['query']);_0x278b1f[_0x9ddd('0x37')]=_[_0x9ddd('0x36')](_0x2c1d65[_0x9ddd('0x33')],qs['fields'](_0x55f532[_0x9ddd('0x34')][_0x9ddd('0x38')]));_0x278b1f[_0x9ddd('0x37')]=_0x278b1f[_0x9ddd('0x37')][_0x9ddd('0x39')]?_0x278b1f['attributes']:_0x2c1d65[_0x9ddd('0x33')];if(_0x55f532[_0x9ddd('0x34')][_0x9ddd('0x40')]){_0x278b1f['include']=[{'all':!![]}];}_0x278b1f=_[_0x9ddd('0x3e')]({},_0x278b1f,_0x55f532['options']);return db[_0x9ddd('0x2e')][_0x9ddd('0x45')](_0x278b1f)['then'](handleEntityNotFound(_0xb0e4aa,null))[_0x9ddd('0x24')](respondWithResult(_0xb0e4aa,null))[_0x9ddd('0x43')](handleError(_0xb0e4aa,null));};exports[_0x9ddd('0x46')]=function(_0x25d2c6,_0x201eda){return db[_0x9ddd('0x2e')][_0x9ddd('0x46')](_0x25d2c6[_0x9ddd('0x47')],{})[_0x9ddd('0x24')](function(_0x3c8769){var _0x278961=_0x25d2c6[_0x9ddd('0x48')][_0x9ddd('0x26')]({'plain':!![]});if(!_0x278961)throw new Error(_0x9ddd('0x49'));if(_0x278961[_0x9ddd('0x4a')]===_0x9ddd('0x48')){var _0x46214e=_0x3c8769[_0x9ddd('0x26')]({'plain':!![]});var _0x30ab16='UserFaxInteractions';return db['UserProfileSection'][_0x9ddd('0x45')]({'where':{'name':_0x30ab16,'userProfileId':_0x278961[_0x9ddd('0x4b')]},'raw':!![]})['then'](function(_0x5372f){if(_0x5372f&&_0x5372f[_0x9ddd('0x4c')]===0x0){return db[_0x9ddd('0x4d')][_0x9ddd('0x46')]({'name':_0x46214e[_0x9ddd('0x2a')],'resourceId':_0x46214e['id'],'type':_0x5372f[_0x9ddd('0x2a')],'sectionId':_0x5372f['id']},{})[_0x9ddd('0x24')](function(){return _0x3c8769;});}else{return _0x3c8769;}})[_0x9ddd('0x43')](function(_0xfe105){logger[_0x9ddd('0x28')](_0x9ddd('0x4e'),_0xfe105);throw _0xfe105;});}return _0x3c8769;})[_0x9ddd('0x24')](respondWithResult(_0x201eda,0xc9))[_0x9ddd('0x43')](handleError(_0x201eda,null));};exports[_0x9ddd('0x23')]=function(_0x612238,_0x5b82d7){if(_0x612238['body']['id']){delete _0x612238[_0x9ddd('0x47')]['id'];}return db[_0x9ddd('0x2e')][_0x9ddd('0x45')]({'where':{'id':_0x612238[_0x9ddd('0x44')]['id']}})[_0x9ddd('0x24')](handleEntityNotFound(_0x5b82d7,null))[_0x9ddd('0x24')](saveUpdates(_0x612238['body'],null))['then'](respondWithResult(_0x5b82d7,null))[_0x9ddd('0x43')](handleError(_0x5b82d7,null));};exports['destroy']=function(_0x3005b6,_0x505524){return db[_0x9ddd('0x2e')][_0x9ddd('0x45')]({'where':{'id':_0x3005b6[_0x9ddd('0x44')]['id']}})[_0x9ddd('0x24')](handleEntityNotFound(_0x505524,null))[_0x9ddd('0x24')](removeEntity(_0x505524,null))[_0x9ddd('0x43')](handleError(_0x505524,null));}; \ No newline at end of file +var _0x5b4d=['index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','UserFaxInteraction','findAll','show','params','keys','length','include','find','catch','create','user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','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','../../mysqldb','status','end','json','count','limit','set','Content-Range','apply','save','then','UserFaxInteractions','UserProfileResource','destroy','sendStatus','error','name'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x5b4d,0x175));var _0xd5b4=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5b4d[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0xd5b4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd5b4('0x1'));var zipdir=require(_0xd5b4('0x2'));var jsonpatch=require(_0xd5b4('0x3'));var rp=require('request-promise');var moment=require(_0xd5b4('0x4'));var BPromise=require(_0xd5b4('0x5'));var Mustache=require(_0xd5b4('0x6'));var util=require(_0xd5b4('0x7'));var path=require(_0xd5b4('0x8'));var sox=require(_0xd5b4('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd5b4('0xa'));var squel=require(_0xd5b4('0xb'));var crypto=require('crypto');var jsforce=require(_0xd5b4('0xc'));var deskjs=require(_0xd5b4('0xd'));var toCsv=require(_0xd5b4('0xe'));var querystring=require(_0xd5b4('0xf'));var Papa=require('papaparse');var Redis=require(_0xd5b4('0x10'));var authService=require(_0xd5b4('0x11'));var qs=require(_0xd5b4('0x12'));var as=require(_0xd5b4('0x13'));var hardwareService=require(_0xd5b4('0x14'));var logger=require(_0xd5b4('0x15'))(_0xd5b4('0x16'));var utils=require(_0xd5b4('0x17'));var config=require(_0xd5b4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd5b4('0x19'))['db'];function respondWithStatusCode(_0x1f47ab,_0x1d97d1){_0x1d97d1=_0x1d97d1||0xcc;return function(_0xe33151){if(_0xe33151){return _0x1f47ab['sendStatus'](_0x1d97d1);}return _0x1f47ab[_0xd5b4('0x1a')](_0x1d97d1)[_0xd5b4('0x1b')]();};}function respondWithResult(_0x2ece15,_0x4e4ef0){_0x4e4ef0=_0x4e4ef0||0xc8;return function(_0x3206f0){if(_0x3206f0){return _0x2ece15['status'](_0x4e4ef0)[_0xd5b4('0x1c')](_0x3206f0);}};}function respondWithFilteredResult(_0x2c7a37,_0x29d67e){return function(_0x125b8b){if(_0x125b8b){var _0x3a8f47=_0x125b8b[_0xd5b4('0x1d')],_0x1e746a=_0x29d67e['offset'],_0x4c9119=_0x29d67e['offset']+_0x29d67e[_0xd5b4('0x1e')],_0x13243c;if(_0x4c9119>=_0x3a8f47){_0x4c9119=_0x3a8f47;_0x13243c=0xc8;}else{_0x13243c=0xce;}_0x2c7a37[_0xd5b4('0x1a')](_0x13243c);return _0x2c7a37[_0xd5b4('0x1f')](_0xd5b4('0x20'),_0x1e746a+'-'+_0x4c9119+'/'+_0x3a8f47)[_0xd5b4('0x1c')](_0x125b8b);}return null;};}function patchUpdates(_0x24b8b0){return function(_0x32f20a){try{jsonpatch[_0xd5b4('0x21')](_0x32f20a,_0x24b8b0,!![]);}catch(_0x54b69d){return BPromise['reject'](_0x54b69d);}return _0x32f20a[_0xd5b4('0x22')]();};}function saveUpdates(_0xef41cb,_0x1ecc52){return function(_0xa3d5ef){if(_0xa3d5ef){return _0xa3d5ef['update'](_0xef41cb)[_0xd5b4('0x23')](function(_0x4c92cc){return _0x4c92cc;});}return null;};}function removeEntity(_0x46d778,_0x36e1f7){return function(_0x1bc942){if(_0x1bc942){return _0x1bc942['destroy']()[_0xd5b4('0x23')](function(){var _0x2253bb=_0x1bc942['get']({'plain':!![]});var _0x4773d5=_0xd5b4('0x24');return db[_0xd5b4('0x25')][_0xd5b4('0x26')]({'where':{'type':_0x4773d5,'resourceId':_0x2253bb['id']}})[_0xd5b4('0x23')](function(){return _0x1bc942;});})['then'](function(){_0x46d778[_0xd5b4('0x1a')](0xcc)[_0xd5b4('0x1b')]();});}};}function handleEntityNotFound(_0x327dd3,_0x10953c){return function(_0x36b341){if(!_0x36b341){_0x327dd3[_0xd5b4('0x27')](0x194);}return _0x36b341;};}function handleError(_0x2baf88,_0x3f626c){_0x3f626c=_0x3f626c||0x1f4;return function(_0x3e7869){logger[_0xd5b4('0x28')](_0x3e7869['stack']);if(_0x3e7869['name']){delete _0x3e7869[_0xd5b4('0x29')];}_0x2baf88[_0xd5b4('0x1a')](_0x3f626c)['send'](_0x3e7869);};}exports[_0xd5b4('0x2a')]=function(_0x1a8d2a,_0x51bcf2){var _0x3d2ce0={},_0x376c93={},_0x1d4201={'count':0x0,'rows':[]};var _0x40b438=_[_0xd5b4('0x2b')](db['UserFaxInteraction'][_0xd5b4('0x2c')],function(_0x3ad94e){return{'name':_0x3ad94e['fieldName'],'type':_0x3ad94e[_0xd5b4('0x2d')][_0xd5b4('0x2e')]};});_0x376c93[_0xd5b4('0x2f')]=_[_0xd5b4('0x2b')](_0x40b438,'name');_0x376c93[_0xd5b4('0x30')]=_['keys'](_0x1a8d2a[_0xd5b4('0x30')]);_0x376c93[_0xd5b4('0x31')]=_[_0xd5b4('0x32')](_0x376c93[_0xd5b4('0x2f')],_0x376c93[_0xd5b4('0x30')]);_0x3d2ce0[_0xd5b4('0x33')]=_[_0xd5b4('0x32')](_0x376c93[_0xd5b4('0x2f')],qs[_0xd5b4('0x34')](_0x1a8d2a[_0xd5b4('0x30')][_0xd5b4('0x34')]));_0x3d2ce0[_0xd5b4('0x33')]=_0x3d2ce0[_0xd5b4('0x33')]['length']?_0x3d2ce0[_0xd5b4('0x33')]:_0x376c93['model'];if(!_0x1a8d2a[_0xd5b4('0x30')][_0xd5b4('0x35')](_0xd5b4('0x36'))){_0x3d2ce0['limit']=qs[_0xd5b4('0x1e')](_0x1a8d2a[_0xd5b4('0x30')][_0xd5b4('0x1e')]);_0x3d2ce0[_0xd5b4('0x37')]=qs[_0xd5b4('0x37')](_0x1a8d2a[_0xd5b4('0x30')]['offset']);}_0x3d2ce0[_0xd5b4('0x38')]=qs['sort'](_0x1a8d2a[_0xd5b4('0x30')][_0xd5b4('0x39')]);_0x3d2ce0[_0xd5b4('0x3a')]=qs[_0xd5b4('0x31')](_[_0xd5b4('0x3b')](_0x1a8d2a['query'],_0x376c93['filters']),_0x40b438);if(_0x1a8d2a['query'][_0xd5b4('0x3c')]){_0x3d2ce0['where']=_['merge'](_0x3d2ce0[_0xd5b4('0x3a')],{'$or':_[_0xd5b4('0x2b')](_0x40b438,function(_0x2839c5){if(_0x2839c5[_0xd5b4('0x2d')]!==_0xd5b4('0x3d')){var _0x8cd422={};_0x8cd422[_0x2839c5[_0xd5b4('0x29')]]={'$like':'%'+_0x1a8d2a['query'][_0xd5b4('0x3c')]+'%'};return _0x8cd422;}})});}_0x3d2ce0=_[_0xd5b4('0x3e')]({},_0x3d2ce0,_0x1a8d2a[_0xd5b4('0x3f')]);var _0x4a44a4={'where':_0x3d2ce0[_0xd5b4('0x3a')]};return db['UserFaxInteraction'][_0xd5b4('0x1d')](_0x4a44a4)[_0xd5b4('0x23')](function(_0x1a52b3){_0x1d4201[_0xd5b4('0x1d')]=_0x1a52b3;if(_0x1a8d2a[_0xd5b4('0x30')][_0xd5b4('0x40')]){_0x3d2ce0['include']=[{'all':!![]}];}return db[_0xd5b4('0x41')][_0xd5b4('0x42')](_0x3d2ce0);})[_0xd5b4('0x23')](function(_0x200738){_0x1d4201['rows']=_0x200738;return _0x1d4201;})[_0xd5b4('0x23')](respondWithFilteredResult(_0x51bcf2,_0x3d2ce0))['catch'](handleError(_0x51bcf2,null));};exports[_0xd5b4('0x43')]=function(_0x5dce4a,_0x1ae9ae){var _0x2fad66={'raw':!![],'where':{'id':_0x5dce4a[_0xd5b4('0x44')]['id']}},_0x3505de={};_0x3505de[_0xd5b4('0x2f')]=_[_0xd5b4('0x45')](db[_0xd5b4('0x41')][_0xd5b4('0x2c')]);_0x3505de[_0xd5b4('0x30')]=_[_0xd5b4('0x45')](_0x5dce4a['query']);_0x3505de[_0xd5b4('0x31')]=_[_0xd5b4('0x32')](_0x3505de[_0xd5b4('0x2f')],_0x3505de[_0xd5b4('0x30')]);_0x2fad66[_0xd5b4('0x33')]=_['intersection'](_0x3505de['model'],qs[_0xd5b4('0x34')](_0x5dce4a[_0xd5b4('0x30')][_0xd5b4('0x34')]));_0x2fad66[_0xd5b4('0x33')]=_0x2fad66['attributes'][_0xd5b4('0x46')]?_0x2fad66[_0xd5b4('0x33')]:_0x3505de['model'];if(_0x5dce4a[_0xd5b4('0x30')]['includeAll']){_0x2fad66[_0xd5b4('0x47')]=[{'all':!![]}];}_0x2fad66=_['merge']({},_0x2fad66,_0x5dce4a[_0xd5b4('0x3f')]);return db[_0xd5b4('0x41')][_0xd5b4('0x48')](_0x2fad66)[_0xd5b4('0x23')](handleEntityNotFound(_0x1ae9ae,null))[_0xd5b4('0x23')](respondWithResult(_0x1ae9ae,null))[_0xd5b4('0x49')](handleError(_0x1ae9ae,null));};exports[_0xd5b4('0x4a')]=function(_0xb383ce,_0x508545){return db['UserFaxInteraction'][_0xd5b4('0x4a')](_0xb383ce['body'],{})['then'](function(_0x152e93){var _0x2e29d4=_0xb383ce[_0xd5b4('0x4b')]['get']({'plain':!![]});if(!_0x2e29d4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e29d4[_0xd5b4('0x4c')]===_0xd5b4('0x4b')){var _0x100406=_0x152e93[_0xd5b4('0x4d')]({'plain':!![]});var _0x3dcd7e=_0xd5b4('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x3dcd7e,'userProfileId':_0x2e29d4[_0xd5b4('0x4e')]},'raw':!![]})['then'](function(_0x3a93be){if(_0x3a93be&&_0x3a93be[_0xd5b4('0x4f')]===0x0){return db[_0xd5b4('0x25')][_0xd5b4('0x4a')]({'name':_0x100406[_0xd5b4('0x29')],'resourceId':_0x100406['id'],'type':_0x3a93be['name'],'sectionId':_0x3a93be['id']},{})[_0xd5b4('0x23')](function(){return _0x152e93;});}else{return _0x152e93;}})['catch'](function(_0x2f0b1a){logger[_0xd5b4('0x28')](_0xd5b4('0x50'),_0x2f0b1a);throw _0x2f0b1a;});}return _0x152e93;})[_0xd5b4('0x23')](respondWithResult(_0x508545,0xc9))[_0xd5b4('0x49')](handleError(_0x508545,null));};exports[_0xd5b4('0x51')]=function(_0x5029c4,_0x555909){if(_0x5029c4[_0xd5b4('0x52')]['id']){delete _0x5029c4['body']['id'];}return db['UserFaxInteraction'][_0xd5b4('0x48')]({'where':{'id':_0x5029c4[_0xd5b4('0x44')]['id']}})[_0xd5b4('0x23')](handleEntityNotFound(_0x555909,null))[_0xd5b4('0x23')](saveUpdates(_0x5029c4['body'],null))[_0xd5b4('0x23')](respondWithResult(_0x555909,null))['catch'](handleError(_0x555909,null));};exports[_0xd5b4('0x26')]=function(_0x58188f,_0x27a296){return db[_0xd5b4('0x41')]['find']({'where':{'id':_0x58188f[_0xd5b4('0x44')]['id']}})[_0xd5b4('0x23')](handleEntityNotFound(_0x27a296,null))[_0xd5b4('0x23')](removeEntity(_0x27a296,null))[_0xd5b4('0x49')](handleError(_0x27a296,null));}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.model.js b/server/api/UserFaxInteraction/UserFaxInteraction.model.js index f513598..afb35cc 100644 --- a/server/api/UserFaxInteraction/UserFaxInteraction.model.js +++ b/server/api/UserFaxInteraction/UserFaxInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','UserFaxInteraction','user_has_fax_interactions','util','api','moment'];(function(_0x233bbf,_0x3d2330){var _0x335c61=function(_0x47b8da){while(--_0x47b8da){_0x233bbf['push'](_0x233bbf['shift']());}};_0x335c61(++_0x3d2330);}(_0xadb5,0xad));var _0x5adb=function(_0x2a3450,_0xf95089){_0x2a3450=_0x2a3450-0x0;var _0x5a7eb6=_0xadb5[_0x2a3450];return _0x5a7eb6;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./UserFaxInteraction.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['exports','define','UserFaxInteraction','user_has_fax_interactions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./UserFaxInteraction.attributes'];(function(_0x217483,_0x422422){var _0x37f8a4=function(_0x7639ac){while(--_0x7639ac){_0x217483['push'](_0x217483['shift']());}};_0x37f8a4(++_0x422422);}(_0x2ef3,0xba));var _0x32ef=function(_0x5594a3,_0x3de08a){_0x5594a3=_0x5594a3-0x0;var _0xe206fc=_0x2ef3[_0x5594a3];return _0xe206fc;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js b/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js index eb50420..ad0cfea 100644 --- a/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js +++ b/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc889=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','request\x20sent','UserFaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','UserFaxInteraction,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x59039c,_0x4d82c2){var _0x3b4947=function(_0x517f42){while(--_0x517f42){_0x59039c['push'](_0x59039c['shift']());}};_0x3b4947(++_0x4d82c2);}(_0xc889,0x1cb));var _0x9c88=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xc889[_0x17928f];return _0x500b63;};'use strict';var _=require(_0x9c88('0x0'));var util=require(_0x9c88('0x1'));var moment=require(_0x9c88('0x2'));var BPromise=require(_0x9c88('0x3'));var rs=require(_0x9c88('0x4'));var fs=require('fs');var Redis=require(_0x9c88('0x5'));var db=require(_0x9c88('0x6'))['db'];var utils=require(_0x9c88('0x7'));var logger=require(_0x9c88('0x8'))(_0x9c88('0x9'));var config=require('../../config/environment');var jayson=require(_0x9c88('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5d53cb,_0x54c3cb,_0xc01f0e){return new BPromise(function(_0x3fb521,_0xb92a13){return client[_0x9c88('0xb')](_0x5d53cb,_0xc01f0e)[_0x9c88('0xc')](function(_0x19fef9){logger[_0x9c88('0xd')]('UserFaxInteraction,\x20%s,\x20%s',_0x54c3cb,_0x9c88('0xe'));logger['debug'](_0x9c88('0xf'),_0x54c3cb,_0x9c88('0xe'),JSON[_0x9c88('0x10')](_0x19fef9));if(_0x19fef9[_0x9c88('0x11')]){if(_0x19fef9[_0x9c88('0x11')]['code']===0x1f4){logger[_0x9c88('0x11')](_0x9c88('0x12'),_0x54c3cb,_0x19fef9[_0x9c88('0x11')][_0x9c88('0x13')]);return _0xb92a13(_0x19fef9['error'][_0x9c88('0x13')]);}logger[_0x9c88('0x11')](_0x9c88('0x12'),_0x54c3cb,_0x19fef9['error'][_0x9c88('0x13')]);return _0x3fb521(_0x19fef9[_0x9c88('0x11')]['message']);}else{logger[_0x9c88('0xd')]('UserFaxInteraction,\x20%s,\x20%s',_0x54c3cb,_0x9c88('0xe'));_0x3fb521(_0x19fef9[_0x9c88('0x14')][_0x9c88('0x13')]);}})[_0x9c88('0x15')](function(_0x1029ad){logger[_0x9c88('0x11')](_0x9c88('0x12'),_0x54c3cb,_0x1029ad);_0xb92a13(_0x1029ad);});});} \ No newline at end of file +var _0x7563=['error','code','UserFaxInteraction,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','UserFaxInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x7563,0x17c));var _0x3756=function(_0x3198a3,_0x3581f2){_0x3198a3=_0x3198a3-0x0;var _0xc34c75=_0x7563[_0x3198a3];return _0xc34c75;};'use strict';var _=require('lodash');var util=require(_0x3756('0x0'));var moment=require(_0x3756('0x1'));var BPromise=require(_0x3756('0x2'));var rs=require(_0x3756('0x3'));var fs=require('fs');var Redis=require(_0x3756('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3756('0x5'));var logger=require('../../config/logger')(_0x3756('0x6'));var config=require(_0x3756('0x7'));var jayson=require(_0x3756('0x8'));var client=jayson[_0x3756('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3bb6b8,_0x2337bf,_0xa20240){return new BPromise(function(_0x576ce0,_0x4e8754){return client['request'](_0x3bb6b8,_0xa20240)[_0x3756('0xa')](function(_0x33f59a){logger[_0x3756('0xb')]('UserFaxInteraction,\x20%s,\x20%s',_0x2337bf,_0x3756('0xc'));logger[_0x3756('0xd')](_0x3756('0xe'),_0x2337bf,_0x3756('0xc'),JSON[_0x3756('0xf')](_0x33f59a));if(_0x33f59a['error']){if(_0x33f59a[_0x3756('0x10')][_0x3756('0x11')]===0x1f4){logger['error'](_0x3756('0x12'),_0x2337bf,_0x33f59a[_0x3756('0x10')]['message']);return _0x4e8754(_0x33f59a[_0x3756('0x10')][_0x3756('0x13')]);}logger[_0x3756('0x10')](_0x3756('0x12'),_0x2337bf,_0x33f59a[_0x3756('0x10')][_0x3756('0x13')]);return _0x576ce0(_0x33f59a[_0x3756('0x10')][_0x3756('0x13')]);}else{logger[_0x3756('0xb')](_0x3756('0x12'),_0x2337bf,_0x3756('0xc'));_0x576ce0(_0x33f59a[_0x3756('0x14')][_0x3756('0x13')]);}})[_0x3756('0x15')](function(_0x4b5563){logger[_0x3756('0x10')]('UserFaxInteraction,\x20%s,\x20%s',_0x2337bf,_0x4b5563);_0x4e8754(_0x4b5563);});});} \ No newline at end of file diff --git a/server/api/UserFaxInteraction/index.js b/server/api/UserFaxInteraction/index.js index 8d2de5b..a23d7b0 100644 --- a/server/api/UserFaxInteraction/index.js +++ b/server/api/UserFaxInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b6e=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./UserFaxInteraction.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x58d2c2,_0xa8582d){var _0x20db23=function(_0x13ec56){while(--_0x13ec56){_0x58d2c2['push'](_0x58d2c2['shift']());}};_0x20db23(++_0xa8582d);}(_0x7b6e,0xde));var _0xe7b6=function(_0x2b76de,_0x2c174c){_0x2b76de=_0x2b76de-0x0;var _0x4bbf3e=_0x7b6e[_0x2b76de];return _0x4bbf3e;};'use strict';var multer=require(_0xe7b6('0x0'));var util=require('util');var path=require(_0xe7b6('0x1'));var timeout=require(_0xe7b6('0x2'));var express=require(_0xe7b6('0x3'));var router=express[_0xe7b6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe7b6('0x5'));var config=require(_0xe7b6('0x6'));var controller=require(_0xe7b6('0x7'));router[_0xe7b6('0x8')]('/',auth[_0xe7b6('0x9')](),controller[_0xe7b6('0xa')]);router[_0xe7b6('0x8')](_0xe7b6('0xb'),auth[_0xe7b6('0x9')](),controller[_0xe7b6('0xc')]);router[_0xe7b6('0xd')]('/',auth[_0xe7b6('0x9')](),controller[_0xe7b6('0xe')]);router[_0xe7b6('0xf')](_0xe7b6('0xb'),auth[_0xe7b6('0x9')](),controller[_0xe7b6('0x10')]);router[_0xe7b6('0x11')](_0xe7b6('0xb'),auth['isAuthenticated'](),controller[_0xe7b6('0x12')]);module[_0xe7b6('0x13')]=router; \ No newline at end of file +var _0x0e0a=['express','Router','./UserFaxInteraction.controller','get','index','isAuthenticated','post','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3c6436,_0x57fa39){var _0x4372ac=function(_0x454c00){while(--_0x454c00){_0x3c6436['push'](_0x3c6436['shift']());}};_0x4372ac(++_0x57fa39);}(_0x0e0a,0x1be));var _0xa0e0=function(_0x5ec655,_0x1b7d41){_0x5ec655=_0x5ec655-0x0;var _0x144c58=_0x0e0a[_0x5ec655];return _0x144c58;};'use strict';var multer=require(_0xa0e0('0x0'));var util=require(_0xa0e0('0x1'));var path=require(_0xa0e0('0x2'));var timeout=require(_0xa0e0('0x3'));var express=require(_0xa0e0('0x4'));var router=express[_0xa0e0('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa0e0('0x6'));router[_0xa0e0('0x7')]('/',auth['isAuthenticated'](),controller[_0xa0e0('0x8')]);router[_0xa0e0('0x7')]('/:id',auth[_0xa0e0('0x9')](),controller['show']);router[_0xa0e0('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa0e0('0xb')]('/:id',auth[_0xa0e0('0x9')](),controller['update']);router[_0xa0e0('0xc')]('/:id',auth[_0xa0e0('0x9')](),controller[_0xa0e0('0xd')]);module[_0xa0e0('0xe')]=router; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.attributes.js b/server/api/UserMailInteraction/UserMailInteraction.attributes.js index 987fa9b..ea782ad 100644 --- a/server/api/UserMailInteraction/UserMailInteraction.attributes.js +++ b/server/api/UserMailInteraction/UserMailInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x05f0=['exports','INTEGER','sequelize'];(function(_0x491d5e,_0x56616e){var _0xed58da=function(_0x1f900d){while(--_0x1f900d){_0x491d5e['push'](_0x491d5e['shift']());}};_0xed58da(++_0x56616e);}(_0x05f0,0xb6));var _0x005f=function(_0x5e238b,_0x17ae49){_0x5e238b=_0x5e238b-0x0;var _0x389bea=_0x05f0[_0x5e238b];return _0x389bea;};'use strict';var Sequelize=require(_0x005f('0x0'));module[_0x005f('0x1')]={'MailInteractionId':{'type':Sequelize[_0x005f('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x005f('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0xe737=['INTEGER','sequelize','exports'];(function(_0xfc2d29,_0x37c077){var _0x129511=function(_0x1fd9c6){while(--_0x1fd9c6){_0xfc2d29['push'](_0xfc2d29['shift']());}};_0x129511(++_0x37c077);}(_0xe737,0x1bd));var _0x7e73=function(_0x23adaa,_0xea5faf){_0x23adaa=_0x23adaa-0x0;var _0x6cd9d1=_0xe737[_0x23adaa];return _0x6cd9d1;};'use strict';var Sequelize=require(_0x7e73('0x0'));module[_0x7e73('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x7e73('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.controller.js b/server/api/UserMailInteraction/UserMailInteraction.controller.js index 6e456ef..18dcbcb 100644 --- a/server/api/UserMailInteraction/UserMailInteraction.controller.js +++ b/server/api/UserMailInteraction/UserMailInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x711e=['length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','bluebird','util','path','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','json','apply','save','update','then','destroy','UserMailInteractions','UserProfileResource','error','name','send','map','UserMailInteraction','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x5b16cd,_0x4e4b12){var _0x14c1a7=function(_0x51f6fe){while(--_0x51f6fe){_0x5b16cd['push'](_0x5b16cd['shift']());}};_0x14c1a7(++_0x4e4b12);}(_0x711e,0x148));var _0xe711=function(_0x27d517,_0x8e5a42){_0x27d517=_0x27d517-0x0;var _0x2c9c65=_0x711e[_0x27d517];return _0x2c9c65;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe711('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe711('0x1'));var jsonpatch=require(_0xe711('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe711('0x3'));var Mustache=require('mustache');var util=require(_0xe711('0x4'));var path=require(_0xe711('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe711('0x6'));var fs=require('fs');var _=require(_0xe711('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe711('0x8'));var deskjs=require(_0xe711('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe711('0xa'));var Redis=require(_0xe711('0xb'));var authService=require(_0xe711('0xc'));var qs=require(_0xe711('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe711('0xe'));var logger=require(_0xe711('0xf'))('api');var utils=require(_0xe711('0x10'));var config=require(_0xe711('0x11'));var licenseUtil=require(_0xe711('0x12'));var db=require(_0xe711('0x13'))['db'];function respondWithStatusCode(_0x530e07,_0xcac939){_0xcac939=_0xcac939||0xcc;return function(_0x5cba06){if(_0x5cba06){return _0x530e07['sendStatus'](_0xcac939);}return _0x530e07[_0xe711('0x14')](_0xcac939)[_0xe711('0x15')]();};}function respondWithResult(_0x73f0fb,_0x26ee85){_0x26ee85=_0x26ee85||0xc8;return function(_0x2a5bf6){if(_0x2a5bf6){return _0x73f0fb[_0xe711('0x14')](_0x26ee85)['json'](_0x2a5bf6);}};}function respondWithFilteredResult(_0x4f432d,_0x53b1ff){return function(_0x5c6390){if(_0x5c6390){var _0x4a4390=_0x5c6390[_0xe711('0x16')],_0x2c6f16=_0x53b1ff[_0xe711('0x17')],_0x2e347c=_0x53b1ff[_0xe711('0x17')]+_0x53b1ff[_0xe711('0x18')],_0x4afa36;if(_0x2e347c>=_0x4a4390){_0x2e347c=_0x4a4390;_0x4afa36=0xc8;}else{_0x4afa36=0xce;}_0x4f432d[_0xe711('0x14')](_0x4afa36);return _0x4f432d[_0xe711('0x19')]('Content-Range',_0x2c6f16+'-'+_0x2e347c+'/'+_0x4a4390)[_0xe711('0x1a')](_0x5c6390);}return null;};}function patchUpdates(_0x79458a){return function(_0x341b92){try{jsonpatch[_0xe711('0x1b')](_0x341b92,_0x79458a,!![]);}catch(_0x1a3d91){return BPromise['reject'](_0x1a3d91);}return _0x341b92[_0xe711('0x1c')]();};}function saveUpdates(_0x26f864,_0x4da78b){return function(_0x17820c){if(_0x17820c){return _0x17820c[_0xe711('0x1d')](_0x26f864)[_0xe711('0x1e')](function(_0x2e1344){return _0x2e1344;});}return null;};}function removeEntity(_0x25c0d5,_0x4eced7){return function(_0x17b8aa){if(_0x17b8aa){return _0x17b8aa[_0xe711('0x1f')]()[_0xe711('0x1e')](function(){var _0x4a6a01=_0x17b8aa['get']({'plain':!![]});var _0x3ec7e3=_0xe711('0x20');return db[_0xe711('0x21')]['destroy']({'where':{'type':_0x3ec7e3,'resourceId':_0x4a6a01['id']}})[_0xe711('0x1e')](function(){return _0x17b8aa;});})['then'](function(){_0x25c0d5[_0xe711('0x14')](0xcc)[_0xe711('0x15')]();});}};}function handleEntityNotFound(_0x3f046a,_0x54ced8){return function(_0x3b20c5){if(!_0x3b20c5){_0x3f046a['sendStatus'](0x194);}return _0x3b20c5;};}function handleError(_0x126436,_0x3ece45){_0x3ece45=_0x3ece45||0x1f4;return function(_0x9f2a51){logger[_0xe711('0x22')](_0x9f2a51['stack']);if(_0x9f2a51[_0xe711('0x23')]){delete _0x9f2a51[_0xe711('0x23')];}_0x126436[_0xe711('0x14')](_0x3ece45)[_0xe711('0x24')](_0x9f2a51);};}exports['index']=function(_0x23854b,_0x2018c3){var _0x3b4935={},_0x11d707={},_0x37bbe0={'count':0x0,'rows':[]};var _0x2b4f4d=_[_0xe711('0x25')](db[_0xe711('0x26')]['rawAttributes'],function(_0x2e7fca){return{'name':_0x2e7fca['fieldName'],'type':_0x2e7fca[_0xe711('0x27')]['key']};});_0x11d707[_0xe711('0x28')]=_[_0xe711('0x25')](_0x2b4f4d,'name');_0x11d707[_0xe711('0x29')]=_[_0xe711('0x2a')](_0x23854b[_0xe711('0x29')]);_0x11d707[_0xe711('0x2b')]=_[_0xe711('0x2c')](_0x11d707[_0xe711('0x28')],_0x11d707[_0xe711('0x29')]);_0x3b4935[_0xe711('0x2d')]=_[_0xe711('0x2c')](_0x11d707[_0xe711('0x28')],qs['fields'](_0x23854b[_0xe711('0x29')][_0xe711('0x2e')]));_0x3b4935[_0xe711('0x2d')]=_0x3b4935[_0xe711('0x2d')][_0xe711('0x2f')]?_0x3b4935[_0xe711('0x2d')]:_0x11d707[_0xe711('0x28')];if(!_0x23854b[_0xe711('0x29')][_0xe711('0x30')](_0xe711('0x31'))){_0x3b4935['limit']=qs['limit'](_0x23854b[_0xe711('0x29')][_0xe711('0x18')]);_0x3b4935['offset']=qs['offset'](_0x23854b['query'][_0xe711('0x17')]);}_0x3b4935['order']=qs[_0xe711('0x32')](_0x23854b[_0xe711('0x29')][_0xe711('0x32')]);_0x3b4935[_0xe711('0x33')]=qs[_0xe711('0x2b')](_[_0xe711('0x34')](_0x23854b[_0xe711('0x29')],_0x11d707[_0xe711('0x2b')]),_0x2b4f4d);if(_0x23854b[_0xe711('0x29')]['filter']){_0x3b4935[_0xe711('0x33')]=_[_0xe711('0x35')](_0x3b4935[_0xe711('0x33')],{'$or':_[_0xe711('0x25')](_0x2b4f4d,function(_0x3431e2){if(_0x3431e2['type']!==_0xe711('0x36')){var _0x46b149={};_0x46b149[_0x3431e2[_0xe711('0x23')]]={'$like':'%'+_0x23854b[_0xe711('0x29')][_0xe711('0x37')]+'%'};return _0x46b149;}})});}_0x3b4935=_['merge']({},_0x3b4935,_0x23854b[_0xe711('0x38')]);var _0x421bba={'where':_0x3b4935[_0xe711('0x33')]};return db[_0xe711('0x26')][_0xe711('0x16')](_0x421bba)['then'](function(_0x17e3e7){_0x37bbe0[_0xe711('0x16')]=_0x17e3e7;if(_0x23854b[_0xe711('0x29')][_0xe711('0x39')]){_0x3b4935[_0xe711('0x3a')]=[{'all':!![]}];}return db[_0xe711('0x26')][_0xe711('0x3b')](_0x3b4935);})[_0xe711('0x1e')](function(_0x183d4c){_0x37bbe0[_0xe711('0x3c')]=_0x183d4c;return _0x37bbe0;})[_0xe711('0x1e')](respondWithFilteredResult(_0x2018c3,_0x3b4935))[_0xe711('0x3d')](handleError(_0x2018c3,null));};exports[_0xe711('0x3e')]=function(_0x5b7635,_0x5f0d09){var _0x589a1b={'raw':!![],'where':{'id':_0x5b7635[_0xe711('0x3f')]['id']}},_0x52e01b={};_0x52e01b[_0xe711('0x28')]=_[_0xe711('0x2a')](db[_0xe711('0x26')][_0xe711('0x40')]);_0x52e01b[_0xe711('0x29')]=_[_0xe711('0x2a')](_0x5b7635[_0xe711('0x29')]);_0x52e01b[_0xe711('0x2b')]=_[_0xe711('0x2c')](_0x52e01b[_0xe711('0x28')],_0x52e01b['query']);_0x589a1b['attributes']=_[_0xe711('0x2c')](_0x52e01b[_0xe711('0x28')],qs['fields'](_0x5b7635['query']['fields']));_0x589a1b['attributes']=_0x589a1b['attributes'][_0xe711('0x2f')]?_0x589a1b['attributes']:_0x52e01b[_0xe711('0x28')];if(_0x5b7635[_0xe711('0x29')][_0xe711('0x39')]){_0x589a1b[_0xe711('0x3a')]=[{'all':!![]}];}_0x589a1b=_[_0xe711('0x35')]({},_0x589a1b,_0x5b7635[_0xe711('0x38')]);return db[_0xe711('0x26')][_0xe711('0x41')](_0x589a1b)[_0xe711('0x1e')](handleEntityNotFound(_0x5f0d09,null))['then'](respondWithResult(_0x5f0d09,null))[_0xe711('0x3d')](handleError(_0x5f0d09,null));};exports[_0xe711('0x42')]=function(_0x1db572,_0x484072){return db[_0xe711('0x26')][_0xe711('0x42')](_0x1db572[_0xe711('0x43')],{})['then'](function(_0x3b2443){var _0x9f7e2a=_0x1db572[_0xe711('0x44')][_0xe711('0x45')]({'plain':!![]});if(!_0x9f7e2a)throw new Error(_0xe711('0x46'));if(_0x9f7e2a[_0xe711('0x47')]===_0xe711('0x44')){var _0x4e0252=_0x3b2443[_0xe711('0x45')]({'plain':!![]});var _0x493fe3='UserMailInteractions';return db[_0xe711('0x48')][_0xe711('0x41')]({'where':{'name':_0x493fe3,'userProfileId':_0x9f7e2a[_0xe711('0x49')]},'raw':!![]})[_0xe711('0x1e')](function(_0xc5c876){if(_0xc5c876&&_0xc5c876[_0xe711('0x4a')]===0x0){return db[_0xe711('0x21')]['create']({'name':_0x4e0252[_0xe711('0x23')],'resourceId':_0x4e0252['id'],'type':_0xc5c876[_0xe711('0x23')],'sectionId':_0xc5c876['id']},{})[_0xe711('0x1e')](function(){return _0x3b2443;});}else{return _0x3b2443;}})['catch'](function(_0x4753a3){logger[_0xe711('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4753a3);throw _0x4753a3;});}return _0x3b2443;})[_0xe711('0x1e')](respondWithResult(_0x484072,0xc9))[_0xe711('0x3d')](handleError(_0x484072,null));};exports[_0xe711('0x1d')]=function(_0x2e154d,_0x3fcaf8){if(_0x2e154d[_0xe711('0x43')]['id']){delete _0x2e154d[_0xe711('0x43')]['id'];}return db[_0xe711('0x26')][_0xe711('0x41')]({'where':{'id':_0x2e154d['params']['id']}})[_0xe711('0x1e')](handleEntityNotFound(_0x3fcaf8,null))[_0xe711('0x1e')](saveUpdates(_0x2e154d['body'],null))[_0xe711('0x1e')](respondWithResult(_0x3fcaf8,null))[_0xe711('0x3d')](handleError(_0x3fcaf8,null));};exports[_0xe711('0x1f')]=function(_0x475709,_0x381ec5){return db[_0xe711('0x26')][_0xe711('0x41')]({'where':{'id':_0x475709[_0xe711('0x3f')]['id']}})[_0xe711('0x1e')](handleEntityNotFound(_0x381ec5,null))[_0xe711('0x1e')](removeEntity(_0x381ec5,null))[_0xe711('0x3d')](handleError(_0x381ec5,null));}; \ No newline at end of file +var _0x8d46=['sendStatus','status','end','json','count','limit','set','apply','reject','save','update','get','then','stack','name','send','index','map','UserMailInteraction','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','offset','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserMailInteractions','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3c8acd,_0x3dcf5a){var _0x2731e2=function(_0x29e0fa){while(--_0x29e0fa){_0x3c8acd['push'](_0x3c8acd['shift']());}};_0x2731e2(++_0x3dcf5a);}(_0x8d46,0xd5));var _0x68d4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8d46[_0x4b369d];return _0x571a98;};'use strict';var pdf=require(_0x68d4('0x0'));var emlformat=require(_0x68d4('0x1'));var rimraf=require(_0x68d4('0x2'));var zipdir=require(_0x68d4('0x3'));var jsonpatch=require(_0x68d4('0x4'));var rp=require(_0x68d4('0x5'));var moment=require('moment');var BPromise=require(_0x68d4('0x6'));var Mustache=require(_0x68d4('0x7'));var util=require(_0x68d4('0x8'));var path=require('path');var sox=require(_0x68d4('0x9'));var csv=require(_0x68d4('0xa'));var ejs=require(_0x68d4('0xb'));var fs=require('fs');var _=require(_0x68d4('0xc'));var squel=require('squel');var crypto=require(_0x68d4('0xd'));var jsforce=require(_0x68d4('0xe'));var deskjs=require(_0x68d4('0xf'));var toCsv=require(_0x68d4('0xa'));var querystring=require(_0x68d4('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x68d4('0x11'));var hardwareService=require(_0x68d4('0x12'));var logger=require(_0x68d4('0x13'))(_0x68d4('0x14'));var utils=require(_0x68d4('0x15'));var config=require(_0x68d4('0x16'));var licenseUtil=require(_0x68d4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b45fc,_0x52f8b4){_0x52f8b4=_0x52f8b4||0xcc;return function(_0x146c73){if(_0x146c73){return _0x3b45fc[_0x68d4('0x18')](_0x52f8b4);}return _0x3b45fc[_0x68d4('0x19')](_0x52f8b4)[_0x68d4('0x1a')]();};}function respondWithResult(_0x3b65fe,_0x3613fc){_0x3613fc=_0x3613fc||0xc8;return function(_0x5ec807){if(_0x5ec807){return _0x3b65fe[_0x68d4('0x19')](_0x3613fc)[_0x68d4('0x1b')](_0x5ec807);}};}function respondWithFilteredResult(_0x39971e,_0x2de18c){return function(_0x1e8cd9){if(_0x1e8cd9){var _0x46017f=_0x1e8cd9[_0x68d4('0x1c')],_0x1986d7=_0x2de18c['offset'],_0xc47d01=_0x2de18c['offset']+_0x2de18c[_0x68d4('0x1d')],_0x222d0f;if(_0xc47d01>=_0x46017f){_0xc47d01=_0x46017f;_0x222d0f=0xc8;}else{_0x222d0f=0xce;}_0x39971e[_0x68d4('0x19')](_0x222d0f);return _0x39971e[_0x68d4('0x1e')]('Content-Range',_0x1986d7+'-'+_0xc47d01+'/'+_0x46017f)['json'](_0x1e8cd9);}return null;};}function patchUpdates(_0x181224){return function(_0x4127d1){try{jsonpatch[_0x68d4('0x1f')](_0x4127d1,_0x181224,!![]);}catch(_0x540a17){return BPromise[_0x68d4('0x20')](_0x540a17);}return _0x4127d1[_0x68d4('0x21')]();};}function saveUpdates(_0x13a254,_0x3c616e){return function(_0x14ee83){if(_0x14ee83){return _0x14ee83[_0x68d4('0x22')](_0x13a254)['then'](function(_0x3736de){return _0x3736de;});}return null;};}function removeEntity(_0x3e4d76,_0x4049ac){return function(_0x232968){if(_0x232968){return _0x232968['destroy']()['then'](function(){var _0x4d3327=_0x232968[_0x68d4('0x23')]({'plain':!![]});var _0x247388='UserMailInteractions';return db['UserProfileResource']['destroy']({'where':{'type':_0x247388,'resourceId':_0x4d3327['id']}})[_0x68d4('0x24')](function(){return _0x232968;});})[_0x68d4('0x24')](function(){_0x3e4d76[_0x68d4('0x19')](0xcc)[_0x68d4('0x1a')]();});}};}function handleEntityNotFound(_0x491e1,_0x3d96c4){return function(_0x50001c){if(!_0x50001c){_0x491e1[_0x68d4('0x18')](0x194);}return _0x50001c;};}function handleError(_0x1a4510,_0x1dea19){_0x1dea19=_0x1dea19||0x1f4;return function(_0x21ffa4){logger['error'](_0x21ffa4[_0x68d4('0x25')]);if(_0x21ffa4[_0x68d4('0x26')]){delete _0x21ffa4[_0x68d4('0x26')];}_0x1a4510[_0x68d4('0x19')](_0x1dea19)[_0x68d4('0x27')](_0x21ffa4);};}exports[_0x68d4('0x28')]=function(_0x4ebe02,_0x2b79d1){var _0x158942={},_0x11722a={},_0x2daac6={'count':0x0,'rows':[]};var _0x4321a8=_[_0x68d4('0x29')](db[_0x68d4('0x2a')]['rawAttributes'],function(_0x3a3f95){return{'name':_0x3a3f95[_0x68d4('0x2b')],'type':_0x3a3f95[_0x68d4('0x2c')][_0x68d4('0x2d')]};});_0x11722a['model']=_[_0x68d4('0x29')](_0x4321a8,_0x68d4('0x26'));_0x11722a[_0x68d4('0x2e')]=_[_0x68d4('0x2f')](_0x4ebe02[_0x68d4('0x2e')]);_0x11722a[_0x68d4('0x30')]=_['intersection'](_0x11722a[_0x68d4('0x31')],_0x11722a[_0x68d4('0x2e')]);_0x158942[_0x68d4('0x32')]=_[_0x68d4('0x33')](_0x11722a[_0x68d4('0x31')],qs[_0x68d4('0x34')](_0x4ebe02[_0x68d4('0x2e')][_0x68d4('0x34')]));_0x158942[_0x68d4('0x32')]=_0x158942[_0x68d4('0x32')][_0x68d4('0x35')]?_0x158942[_0x68d4('0x32')]:_0x11722a[_0x68d4('0x31')];if(!_0x4ebe02[_0x68d4('0x2e')]['hasOwnProperty']('nolimit')){_0x158942[_0x68d4('0x1d')]=qs['limit'](_0x4ebe02['query'][_0x68d4('0x1d')]);_0x158942[_0x68d4('0x36')]=qs[_0x68d4('0x36')](_0x4ebe02[_0x68d4('0x2e')][_0x68d4('0x36')]);}_0x158942['order']=qs[_0x68d4('0x37')](_0x4ebe02['query']['sort']);_0x158942[_0x68d4('0x38')]=qs[_0x68d4('0x30')](_[_0x68d4('0x39')](_0x4ebe02[_0x68d4('0x2e')],_0x11722a['filters']),_0x4321a8);if(_0x4ebe02['query']['filter']){_0x158942['where']=_[_0x68d4('0x3a')](_0x158942[_0x68d4('0x38')],{'$or':_['map'](_0x4321a8,function(_0x403f02){if(_0x403f02[_0x68d4('0x2c')]!=='VIRTUAL'){var _0x30e665={};_0x30e665[_0x403f02[_0x68d4('0x26')]]={'$like':'%'+_0x4ebe02[_0x68d4('0x2e')][_0x68d4('0x3b')]+'%'};return _0x30e665;}})});}_0x158942=_[_0x68d4('0x3a')]({},_0x158942,_0x4ebe02[_0x68d4('0x3c')]);var _0x22a573={'where':_0x158942['where']};return db[_0x68d4('0x2a')][_0x68d4('0x1c')](_0x22a573)[_0x68d4('0x24')](function(_0x12871a){_0x2daac6[_0x68d4('0x1c')]=_0x12871a;if(_0x4ebe02[_0x68d4('0x2e')][_0x68d4('0x3d')]){_0x158942[_0x68d4('0x3e')]=[{'all':!![]}];}return db[_0x68d4('0x2a')][_0x68d4('0x3f')](_0x158942);})[_0x68d4('0x24')](function(_0x15ca8f){_0x2daac6['rows']=_0x15ca8f;return _0x2daac6;})[_0x68d4('0x24')](respondWithFilteredResult(_0x2b79d1,_0x158942))[_0x68d4('0x40')](handleError(_0x2b79d1,null));};exports[_0x68d4('0x41')]=function(_0x54449d,_0x564336){var _0x5d735a={'raw':!![],'where':{'id':_0x54449d[_0x68d4('0x42')]['id']}},_0x106398={};_0x106398['model']=_[_0x68d4('0x2f')](db[_0x68d4('0x2a')]['rawAttributes']);_0x106398[_0x68d4('0x2e')]=_[_0x68d4('0x2f')](_0x54449d[_0x68d4('0x2e')]);_0x106398[_0x68d4('0x30')]=_[_0x68d4('0x33')](_0x106398[_0x68d4('0x31')],_0x106398[_0x68d4('0x2e')]);_0x5d735a[_0x68d4('0x32')]=_['intersection'](_0x106398['model'],qs[_0x68d4('0x34')](_0x54449d[_0x68d4('0x2e')][_0x68d4('0x34')]));_0x5d735a[_0x68d4('0x32')]=_0x5d735a[_0x68d4('0x32')][_0x68d4('0x35')]?_0x5d735a['attributes']:_0x106398[_0x68d4('0x31')];if(_0x54449d['query'][_0x68d4('0x3d')]){_0x5d735a[_0x68d4('0x3e')]=[{'all':!![]}];}_0x5d735a=_[_0x68d4('0x3a')]({},_0x5d735a,_0x54449d[_0x68d4('0x3c')]);return db[_0x68d4('0x2a')]['find'](_0x5d735a)[_0x68d4('0x24')](handleEntityNotFound(_0x564336,null))[_0x68d4('0x24')](respondWithResult(_0x564336,null))[_0x68d4('0x40')](handleError(_0x564336,null));};exports['create']=function(_0x28fb0a,_0x3bb8db){return db[_0x68d4('0x2a')][_0x68d4('0x43')](_0x28fb0a[_0x68d4('0x44')],{})[_0x68d4('0x24')](function(_0x375ae3){var _0x1c1e00=_0x28fb0a[_0x68d4('0x45')]['get']({'plain':!![]});if(!_0x1c1e00)throw new Error(_0x68d4('0x46'));if(_0x1c1e00['role']===_0x68d4('0x45')){var _0x385891=_0x375ae3[_0x68d4('0x23')]({'plain':!![]});var _0x1245f2=_0x68d4('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x1245f2,'userProfileId':_0x1c1e00[_0x68d4('0x48')]},'raw':!![]})['then'](function(_0x1cad6d){if(_0x1cad6d&&_0x1cad6d[_0x68d4('0x49')]===0x0){return db[_0x68d4('0x4a')][_0x68d4('0x43')]({'name':_0x385891[_0x68d4('0x26')],'resourceId':_0x385891['id'],'type':_0x1cad6d[_0x68d4('0x26')],'sectionId':_0x1cad6d['id']},{})['then'](function(){return _0x375ae3;});}else{return _0x375ae3;}})[_0x68d4('0x40')](function(_0x42f2bc){logger[_0x68d4('0x4b')](_0x68d4('0x4c'),_0x42f2bc);throw _0x42f2bc;});}return _0x375ae3;})['then'](respondWithResult(_0x3bb8db,0xc9))[_0x68d4('0x40')](handleError(_0x3bb8db,null));};exports[_0x68d4('0x22')]=function(_0x4a8d2f,_0xa6fb4e){if(_0x4a8d2f[_0x68d4('0x44')]['id']){delete _0x4a8d2f['body']['id'];}return db[_0x68d4('0x2a')][_0x68d4('0x4d')]({'where':{'id':_0x4a8d2f['params']['id']}})[_0x68d4('0x24')](handleEntityNotFound(_0xa6fb4e,null))['then'](saveUpdates(_0x4a8d2f['body'],null))['then'](respondWithResult(_0xa6fb4e,null))[_0x68d4('0x40')](handleError(_0xa6fb4e,null));};exports[_0x68d4('0x4e')]=function(_0x31ed31,_0x5da1d6){return db['UserMailInteraction']['find']({'where':{'id':_0x31ed31[_0x68d4('0x42')]['id']}})['then'](handleEntityNotFound(_0x5da1d6,null))[_0x68d4('0x24')](removeEntity(_0x5da1d6,null))[_0x68d4('0x40')](handleError(_0x5da1d6,null));}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.model.js b/server/api/UserMailInteraction/UserMailInteraction.model.js index 4a6dfc6..7b3b100 100644 --- a/server/api/UserMailInteraction/UserMailInteraction.model.js +++ b/server/api/UserMailInteraction/UserMailInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x98d8=['moment','bluebird','request-promise','../../config/environment','define','user_has_mail_interactions','lodash','util','../../config/logger','api'];(function(_0x402150,_0x194dd6){var _0x275e82=function(_0x1e0a77){while(--_0x1e0a77){_0x402150['push'](_0x402150['shift']());}};_0x275e82(++_0x194dd6);}(_0x98d8,0xce));var _0x898d=function(_0x559da0,_0x371559){_0x559da0=_0x559da0-0x0;var _0x284239=_0x98d8[_0x559da0];return _0x284239;};'use strict';var _=require(_0x898d('0x0'));var util=require(_0x898d('0x1'));var logger=require(_0x898d('0x2'))(_0x898d('0x3'));var moment=require(_0x898d('0x4'));var BPromise=require(_0x898d('0x5'));var rp=require(_0x898d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x898d('0x7'));var attributes=require('./UserMailInteraction.attributes');module['exports']=function(_0x4047bd,_0x5215bf){return _0x4047bd[_0x898d('0x8')]('UserMailInteraction',attributes,{'tableName':_0x898d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71d3=['rimraf','../../config/environment','./UserMailInteraction.attributes','user_has_mail_interactions','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x71d3,0x67));var _0x371d=function(_0x2f5547,_0x4eb6df){_0x2f5547=_0x2f5547-0x0;var _0x29c469=_0x71d3[_0x2f5547];return _0x29c469;};'use strict';var _=require(_0x371d('0x0'));var util=require(_0x371d('0x1'));var logger=require(_0x371d('0x2'))('api');var moment=require(_0x371d('0x3'));var BPromise=require(_0x371d('0x4'));var rp=require(_0x371d('0x5'));var fs=require('fs');var path=require(_0x371d('0x6'));var rimraf=require(_0x371d('0x7'));var config=require(_0x371d('0x8'));var attributes=require(_0x371d('0x9'));module['exports']=function(_0x1c3cb7,_0x26ce75){return _0x1c3cb7['define']('UserMailInteraction',attributes,{'tableName':_0x371d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.rpc.js b/server/api/UserMailInteraction/UserMailInteraction.rpc.js index c0cc412..78e47a6 100644 --- a/server/api/UserMailInteraction/UserMailInteraction.rpc.js +++ b/server/api/UserMailInteraction/UserMailInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd944=['UserMailInteraction,\x20%s,\x20%s','request\x20sent','debug','UserMailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xd944,0x168));var _0x4d94=function(_0x1bdbd7,_0x1e269){_0x1bdbd7=_0x1bdbd7-0x0;var _0x1d98ca=_0xd944[_0x1bdbd7];return _0x1d98ca;};'use strict';var _=require(_0x4d94('0x0'));var util=require(_0x4d94('0x1'));var moment=require(_0x4d94('0x2'));var BPromise=require(_0x4d94('0x3'));var rs=require(_0x4d94('0x4'));var fs=require('fs');var Redis=require(_0x4d94('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4d94('0x6'));var logger=require(_0x4d94('0x7'))(_0x4d94('0x8'));var config=require(_0x4d94('0x9'));var jayson=require(_0x4d94('0xa'));var client=jayson[_0x4d94('0xb')][_0x4d94('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2abe72,_0x59a3c6,_0x590909){return new BPromise(function(_0x4cc0b1,_0x3c4512){return client['request'](_0x2abe72,_0x590909)[_0x4d94('0xd')](function(_0x58675c){logger['info'](_0x4d94('0xe'),_0x59a3c6,_0x4d94('0xf'));logger[_0x4d94('0x10')](_0x4d94('0x11'),_0x59a3c6,_0x4d94('0xf'),JSON[_0x4d94('0x12')](_0x58675c));if(_0x58675c[_0x4d94('0x13')]){if(_0x58675c[_0x4d94('0x13')]['code']===0x1f4){logger[_0x4d94('0x13')]('UserMailInteraction,\x20%s,\x20%s',_0x59a3c6,_0x58675c[_0x4d94('0x13')][_0x4d94('0x14')]);return _0x3c4512(_0x58675c[_0x4d94('0x13')][_0x4d94('0x14')]);}logger[_0x4d94('0x13')](_0x4d94('0xe'),_0x59a3c6,_0x58675c[_0x4d94('0x13')][_0x4d94('0x14')]);return _0x4cc0b1(_0x58675c[_0x4d94('0x13')][_0x4d94('0x14')]);}else{logger['info'](_0x4d94('0xe'),_0x59a3c6,_0x4d94('0xf'));_0x4cc0b1(_0x58675c[_0x4d94('0x15')][_0x4d94('0x14')]);}})['catch'](function(_0x579f5c){logger['error'](_0x4d94('0xe'),_0x59a3c6,_0x579f5c);_0x3c4512(_0x579f5c);});});} \ No newline at end of file +var _0x0dba=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','UserMailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x1bfc72,_0x45f543){var _0x575ab3=function(_0x52202b){while(--_0x52202b){_0x1bfc72['push'](_0x1bfc72['shift']());}};_0x575ab3(++_0x45f543);}(_0x0dba,0xc7));var _0xa0db=function(_0x2cb1f0,_0x3cb809){_0x2cb1f0=_0x2cb1f0-0x0;var _0x4f1e64=_0x0dba[_0x2cb1f0];return _0x4f1e64;};'use strict';var _=require(_0xa0db('0x0'));var util=require(_0xa0db('0x1'));var moment=require(_0xa0db('0x2'));var BPromise=require(_0xa0db('0x3'));var rs=require(_0xa0db('0x4'));var fs=require('fs');var Redis=require(_0xa0db('0x5'));var db=require(_0xa0db('0x6'))['db'];var utils=require(_0xa0db('0x7'));var logger=require(_0xa0db('0x8'))(_0xa0db('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa0db('0xa')][_0xa0db('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x514688,_0x18da03,_0x3e11b3){return new BPromise(function(_0x581a9b,_0x5d6e62){return client[_0xa0db('0xc')](_0x514688,_0x3e11b3)['then'](function(_0xe6812f){logger[_0xa0db('0xd')](_0xa0db('0xe'),_0x18da03,_0xa0db('0xf'));logger[_0xa0db('0x10')]('UserMailInteraction,\x20%s,\x20%s,\x20%s',_0x18da03,_0xa0db('0xf'),JSON[_0xa0db('0x11')](_0xe6812f));if(_0xe6812f[_0xa0db('0x12')]){if(_0xe6812f[_0xa0db('0x12')][_0xa0db('0x13')]===0x1f4){logger[_0xa0db('0x12')](_0xa0db('0xe'),_0x18da03,_0xe6812f[_0xa0db('0x12')]['message']);return _0x5d6e62(_0xe6812f[_0xa0db('0x12')][_0xa0db('0x14')]);}logger[_0xa0db('0x12')](_0xa0db('0xe'),_0x18da03,_0xe6812f['error'][_0xa0db('0x14')]);return _0x581a9b(_0xe6812f[_0xa0db('0x12')][_0xa0db('0x14')]);}else{logger[_0xa0db('0xd')](_0xa0db('0xe'),_0x18da03,'request\x20sent');_0x581a9b(_0xe6812f['result'][_0xa0db('0x14')]);}})[_0xa0db('0x15')](function(_0x3b7cf9){logger['error'](_0xa0db('0xe'),_0x18da03,_0x3b7cf9);_0x5d6e62(_0x3b7cf9);});});} \ No newline at end of file diff --git a/server/api/UserMailInteraction/index.js b/server/api/UserMailInteraction/index.js index e73ea34..7127a26 100644 --- a/server/api/UserMailInteraction/index.js +++ b/server/api/UserMailInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb138=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./UserMailInteraction.controller','get','index','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','multer','util','path'];(function(_0x3c9b91,_0xc8dac9){var _0x379857=function(_0x3722fc){while(--_0x3722fc){_0x3c9b91['push'](_0x3c9b91['shift']());}};_0x379857(++_0xc8dac9);}(_0xb138,0x1dd));var _0x8b13=function(_0x167b08,_0xc4e643){_0x167b08=_0x167b08-0x0;var _0x53c9bb=_0xb138[_0x167b08];return _0x53c9bb;};'use strict';var multer=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var timeout=require(_0x8b13('0x3'));var express=require(_0x8b13('0x4'));var router=express[_0x8b13('0x5')]();var auth=require(_0x8b13('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8b13('0x7'));var controller=require(_0x8b13('0x8'));router[_0x8b13('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b13('0xa')]);router[_0x8b13('0x9')]('/:id',auth[_0x8b13('0xb')](),controller[_0x8b13('0xc')]);router[_0x8b13('0xd')]('/',auth['isAuthenticated'](),controller[_0x8b13('0xe')]);router[_0x8b13('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8b13('0x10')]);router[_0x8b13('0x11')](_0x8b13('0x12'),auth[_0x8b13('0xb')](),controller[_0x8b13('0x13')]);module['exports']=router; \ No newline at end of file +var _0xdbf5=['index','/:id','show','put','update','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserMailInteraction.controller','get','isAuthenticated'];(function(_0x54b1a3,_0x48292){var _0xd0b334=function(_0x3e2694){while(--_0x3e2694){_0x54b1a3['push'](_0x54b1a3['shift']());}};_0xd0b334(++_0x48292);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x2877b1,_0x523a4c){_0x2877b1=_0x2877b1-0x0;var _0x47b93b=_0xdbf5[_0x2877b1];return _0x47b93b;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var auth=require(_0x5dbf('0x3'));var interaction=require(_0x5dbf('0x4'));var config=require(_0x5dbf('0x5'));var controller=require(_0x5dbf('0x6'));router[_0x5dbf('0x7')]('/',auth[_0x5dbf('0x8')](),controller[_0x5dbf('0x9')]);router[_0x5dbf('0x7')](_0x5dbf('0xa'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xb')]);router['post']('/',auth[_0x5dbf('0x8')](),controller['create']);router[_0x5dbf('0xc')](_0x5dbf('0xa'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xd')]);router['delete'](_0x5dbf('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x5dbf('0xe')]=router; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js index 5958aff..3752f8d 100644 --- a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js +++ b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3fc3=['INTEGER'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3fc3,0x150));var _0x33fc=function(_0x54abb4,_0x2964c6){_0x54abb4=_0x54abb4-0x0;var _0x389a63=_0x3fc3[_0x54abb4];return _0x389a63;};'use strict';var Sequelize=require('sequelize');module['exports']={'OpenchannelInteractionId':{'type':Sequelize[_0x33fc('0x0')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x33fc('0x0')],'primaryKey':!![]}}; \ No newline at end of file +var _0x072f=['INTEGER','exports'];(function(_0xf16474,_0x9afe1e){var _0x393e76=function(_0x4a78b1){while(--_0x4a78b1){_0xf16474['push'](_0xf16474['shift']());}};_0x393e76(++_0x9afe1e);}(_0x072f,0x1a7));var _0xf072=function(_0x1e7354,_0x2a9626){_0x1e7354=_0x1e7354-0x0;var _0x2f5f49=_0x072f[_0x1e7354];return _0x2f5f49;};'use strict';var Sequelize=require('sequelize');module[_0xf072('0x0')]={'OpenchannelInteractionId':{'type':Sequelize[_0xf072('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xf072('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js index a2a4e85..27cf628 100644 --- a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js +++ b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c48=['create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','error','name','map','UserOpenchannelInteraction','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','params','includeAll','catch'];(function(_0x559cc1,_0x5c0e97){var _0x56472c=function(_0x789a45){while(--_0x789a45){_0x559cc1['push'](_0x559cc1['shift']());}};_0x56472c(++_0x5c0e97);}(_0x3c48,0x152));var _0x83c4=function(_0x30651c,_0x2f39fb){_0x30651c=_0x30651c-0x0;var _0x2c4882=_0x3c48[_0x30651c];return _0x2c4882;};'use strict';var pdf=require(_0x83c4('0x0'));var emlformat=require(_0x83c4('0x1'));var rimraf=require(_0x83c4('0x2'));var zipdir=require(_0x83c4('0x3'));var jsonpatch=require(_0x83c4('0x4'));var rp=require(_0x83c4('0x5'));var moment=require(_0x83c4('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x83c4('0x7'));var path=require(_0x83c4('0x8'));var sox=require(_0x83c4('0x9'));var csv=require(_0x83c4('0xa'));var ejs=require(_0x83c4('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x83c4('0xc'));var crypto=require(_0x83c4('0xd'));var jsforce=require(_0x83c4('0xe'));var deskjs=require(_0x83c4('0xf'));var toCsv=require(_0x83c4('0xa'));var querystring=require(_0x83c4('0x10'));var Papa=require(_0x83c4('0x11'));var Redis=require(_0x83c4('0x12'));var authService=require(_0x83c4('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x83c4('0x14'));var hardwareService=require(_0x83c4('0x15'));var logger=require(_0x83c4('0x16'))(_0x83c4('0x17'));var utils=require(_0x83c4('0x18'));var config=require(_0x83c4('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16b6e2,_0x44e431){_0x44e431=_0x44e431||0xcc;return function(_0x50ceda){if(_0x50ceda){return _0x16b6e2['sendStatus'](_0x44e431);}return _0x16b6e2[_0x83c4('0x1a')](_0x44e431)[_0x83c4('0x1b')]();};}function respondWithResult(_0x5864a4,_0x4952c2){_0x4952c2=_0x4952c2||0xc8;return function(_0x1b190e){if(_0x1b190e){return _0x5864a4[_0x83c4('0x1a')](_0x4952c2)[_0x83c4('0x1c')](_0x1b190e);}};}function respondWithFilteredResult(_0x3ead18,_0x131dee){return function(_0x36e114){if(_0x36e114){var _0x4f3405=_0x36e114[_0x83c4('0x1d')],_0x1a2a28=_0x131dee['offset'],_0x31e1fc=_0x131dee['offset']+_0x131dee['limit'],_0x77aa87;if(_0x31e1fc>=_0x4f3405){_0x31e1fc=_0x4f3405;_0x77aa87=0xc8;}else{_0x77aa87=0xce;}_0x3ead18[_0x83c4('0x1a')](_0x77aa87);return _0x3ead18[_0x83c4('0x1e')](_0x83c4('0x1f'),_0x1a2a28+'-'+_0x31e1fc+'/'+_0x4f3405)['json'](_0x36e114);}return null;};}function patchUpdates(_0x17824e){return function(_0x2686c4){try{jsonpatch[_0x83c4('0x20')](_0x2686c4,_0x17824e,!![]);}catch(_0x184ea4){return BPromise[_0x83c4('0x21')](_0x184ea4);}return _0x2686c4[_0x83c4('0x22')]();};}function saveUpdates(_0x2429b1,_0xadd2a){return function(_0x2173d3){if(_0x2173d3){return _0x2173d3[_0x83c4('0x23')](_0x2429b1)[_0x83c4('0x24')](function(_0x23c639){return _0x23c639;});}return null;};}function removeEntity(_0x140337,_0x37edff){return function(_0x36a14b){if(_0x36a14b){return _0x36a14b[_0x83c4('0x25')]()[_0x83c4('0x24')](function(){var _0x15e5f8=_0x36a14b['get']({'plain':!![]});var _0x420ed8='UserOpenchannelInteraction';return db[_0x83c4('0x26')][_0x83c4('0x25')]({'where':{'type':_0x420ed8,'resourceId':_0x15e5f8['id']}})[_0x83c4('0x24')](function(){return _0x36a14b;});})[_0x83c4('0x24')](function(){_0x140337[_0x83c4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a11c4,_0x61c2c9){return function(_0x18151e){if(!_0x18151e){_0x2a11c4[_0x83c4('0x27')](0x194);}return _0x18151e;};}function handleError(_0x4f86c6,_0x30481d){_0x30481d=_0x30481d||0x1f4;return function(_0x15a3fb){logger[_0x83c4('0x28')](_0x15a3fb['stack']);if(_0x15a3fb[_0x83c4('0x29')]){delete _0x15a3fb[_0x83c4('0x29')];}_0x4f86c6[_0x83c4('0x1a')](_0x30481d)['send'](_0x15a3fb);};}exports['index']=function(_0x1fb9ec,_0x3a6a1a){var _0x256a94={},_0x2751e8={},_0x5d4caf={'count':0x0,'rows':[]};var _0x35a189=_[_0x83c4('0x2a')](db[_0x83c4('0x2b')]['rawAttributes'],function(_0x5105a4){return{'name':_0x5105a4[_0x83c4('0x2c')],'type':_0x5105a4[_0x83c4('0x2d')][_0x83c4('0x2e')]};});_0x2751e8[_0x83c4('0x2f')]=_['map'](_0x35a189,_0x83c4('0x29'));_0x2751e8[_0x83c4('0x30')]=_[_0x83c4('0x31')](_0x1fb9ec[_0x83c4('0x30')]);_0x2751e8[_0x83c4('0x32')]=_[_0x83c4('0x33')](_0x2751e8[_0x83c4('0x2f')],_0x2751e8[_0x83c4('0x30')]);_0x256a94['attributes']=_[_0x83c4('0x33')](_0x2751e8[_0x83c4('0x2f')],qs[_0x83c4('0x34')](_0x1fb9ec[_0x83c4('0x30')]['fields']));_0x256a94[_0x83c4('0x35')]=_0x256a94[_0x83c4('0x35')][_0x83c4('0x36')]?_0x256a94[_0x83c4('0x35')]:_0x2751e8['model'];if(!_0x1fb9ec[_0x83c4('0x30')][_0x83c4('0x37')](_0x83c4('0x38'))){_0x256a94[_0x83c4('0x39')]=qs['limit'](_0x1fb9ec[_0x83c4('0x30')]['limit']);_0x256a94[_0x83c4('0x3a')]=qs[_0x83c4('0x3a')](_0x1fb9ec[_0x83c4('0x30')]['offset']);}_0x256a94[_0x83c4('0x3b')]=qs[_0x83c4('0x3c')](_0x1fb9ec['query'][_0x83c4('0x3c')]);_0x256a94[_0x83c4('0x3d')]=qs[_0x83c4('0x32')](_[_0x83c4('0x3e')](_0x1fb9ec[_0x83c4('0x30')],_0x2751e8[_0x83c4('0x32')]),_0x35a189);if(_0x1fb9ec[_0x83c4('0x30')][_0x83c4('0x3f')]){_0x256a94[_0x83c4('0x3d')]=_[_0x83c4('0x40')](_0x256a94[_0x83c4('0x3d')],{'$or':_[_0x83c4('0x2a')](_0x35a189,function(_0x12fe7e){if(_0x12fe7e[_0x83c4('0x2d')]!==_0x83c4('0x41')){var _0x26410c={};_0x26410c[_0x12fe7e[_0x83c4('0x29')]]={'$like':'%'+_0x1fb9ec[_0x83c4('0x30')][_0x83c4('0x3f')]+'%'};return _0x26410c;}})});}_0x256a94=_[_0x83c4('0x40')]({},_0x256a94,_0x1fb9ec['options']);var _0x15692f={'where':_0x256a94[_0x83c4('0x3d')]};return db[_0x83c4('0x2b')][_0x83c4('0x1d')](_0x15692f)[_0x83c4('0x24')](function(_0x57ceb6){_0x5d4caf[_0x83c4('0x1d')]=_0x57ceb6;if(_0x1fb9ec['query']['includeAll']){_0x256a94[_0x83c4('0x42')]=[{'all':!![]}];}return db[_0x83c4('0x2b')][_0x83c4('0x43')](_0x256a94);})[_0x83c4('0x24')](function(_0x4af399){_0x5d4caf[_0x83c4('0x44')]=_0x4af399;return _0x5d4caf;})[_0x83c4('0x24')](respondWithFilteredResult(_0x3a6a1a,_0x256a94))['catch'](handleError(_0x3a6a1a,null));};exports['show']=function(_0x1cf023,_0x53a9ca){var _0x1b26d2={'raw':!![],'where':{'id':_0x1cf023[_0x83c4('0x45')]['id']}},_0x5d94c2={};_0x5d94c2['model']=_[_0x83c4('0x31')](db[_0x83c4('0x2b')]['rawAttributes']);_0x5d94c2[_0x83c4('0x30')]=_['keys'](_0x1cf023['query']);_0x5d94c2['filters']=_[_0x83c4('0x33')](_0x5d94c2['model'],_0x5d94c2['query']);_0x1b26d2['attributes']=_[_0x83c4('0x33')](_0x5d94c2[_0x83c4('0x2f')],qs['fields'](_0x1cf023['query']['fields']));_0x1b26d2[_0x83c4('0x35')]=_0x1b26d2['attributes']['length']?_0x1b26d2[_0x83c4('0x35')]:_0x5d94c2[_0x83c4('0x2f')];if(_0x1cf023['query'][_0x83c4('0x46')]){_0x1b26d2['include']=[{'all':!![]}];}_0x1b26d2=_['merge']({},_0x1b26d2,_0x1cf023['options']);return db[_0x83c4('0x2b')]['find'](_0x1b26d2)[_0x83c4('0x24')](handleEntityNotFound(_0x53a9ca,null))[_0x83c4('0x24')](respondWithResult(_0x53a9ca,null))[_0x83c4('0x47')](handleError(_0x53a9ca,null));};exports[_0x83c4('0x48')]=function(_0x2787ac,_0x55d7ad){return db['UserOpenchannelInteraction'][_0x83c4('0x48')](_0x2787ac['body'],{})[_0x83c4('0x24')](function(_0x3771a9){var _0x2b8505=_0x2787ac[_0x83c4('0x49')][_0x83c4('0x4a')]({'plain':!![]});if(!_0x2b8505)throw new Error(_0x83c4('0x4b'));if(_0x2b8505[_0x83c4('0x4c')]==='user'){var _0x236078=_0x3771a9['get']({'plain':!![]});var _0x2f8744=_0x83c4('0x2b');return db[_0x83c4('0x4d')][_0x83c4('0x4e')]({'where':{'name':_0x2f8744,'userProfileId':_0x2b8505[_0x83c4('0x4f')]},'raw':!![]})[_0x83c4('0x24')](function(_0x3e280a){if(_0x3e280a&&_0x3e280a[_0x83c4('0x50')]===0x0){return db[_0x83c4('0x26')][_0x83c4('0x48')]({'name':_0x236078[_0x83c4('0x29')],'resourceId':_0x236078['id'],'type':_0x3e280a[_0x83c4('0x29')],'sectionId':_0x3e280a['id']},{})['then'](function(){return _0x3771a9;});}else{return _0x3771a9;}})[_0x83c4('0x47')](function(_0x17a6ad){logger[_0x83c4('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17a6ad);throw _0x17a6ad;});}return _0x3771a9;})[_0x83c4('0x24')](respondWithResult(_0x55d7ad,0xc9))[_0x83c4('0x47')](handleError(_0x55d7ad,null));};exports[_0x83c4('0x23')]=function(_0x2e05f0,_0x1b52f8){if(_0x2e05f0[_0x83c4('0x51')]['id']){delete _0x2e05f0[_0x83c4('0x51')]['id'];}return db[_0x83c4('0x2b')][_0x83c4('0x4e')]({'where':{'id':_0x2e05f0[_0x83c4('0x45')]['id']}})[_0x83c4('0x24')](handleEntityNotFound(_0x1b52f8,null))[_0x83c4('0x24')](saveUpdates(_0x2e05f0[_0x83c4('0x51')],null))[_0x83c4('0x24')](respondWithResult(_0x1b52f8,null))['catch'](handleError(_0x1b52f8,null));};exports[_0x83c4('0x25')]=function(_0x399a62,_0x231cfb){return db[_0x83c4('0x2b')][_0x83c4('0x4e')]({'where':{'id':_0x399a62[_0x83c4('0x45')]['id']}})[_0x83c4('0x24')](handleEntityNotFound(_0x231cfb,null))[_0x83c4('0x24')](removeEntity(_0x231cfb,null))[_0x83c4('0x47')](handleError(_0x231cfb,null));}; \ No newline at end of file +var _0x92ba=['autoAssociation','UserProfileResource','create','error','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','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','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','update','then','destroy','get','UserOpenchannelInteraction','end','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','params','includeAll','options','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x5b315e,_0x3d096c){var _0x3f81ac=function(_0x3c4a5e){while(--_0x3c4a5e){_0x5b315e['push'](_0x5b315e['shift']());}};_0x3f81ac(++_0x3d096c);}(_0x92ba,0x1ad));var _0xa92b=function(_0x12a3df,_0x22b35b){_0x12a3df=_0x12a3df-0x0;var _0x717ffb=_0x92ba[_0x12a3df];return _0x717ffb;};'use strict';var pdf=require(_0xa92b('0x0'));var emlformat=require(_0xa92b('0x1'));var rimraf=require(_0xa92b('0x2'));var zipdir=require(_0xa92b('0x3'));var jsonpatch=require(_0xa92b('0x4'));var rp=require(_0xa92b('0x5'));var moment=require(_0xa92b('0x6'));var BPromise=require(_0xa92b('0x7'));var Mustache=require(_0xa92b('0x8'));var util=require(_0xa92b('0x9'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa92b('0xa'));var fs=require('fs');var _=require(_0xa92b('0xb'));var squel=require(_0xa92b('0xc'));var crypto=require('crypto');var jsforce=require(_0xa92b('0xd'));var deskjs=require(_0xa92b('0xe'));var toCsv=require(_0xa92b('0xf'));var querystring=require(_0xa92b('0x10'));var Papa=require(_0xa92b('0x11'));var Redis=require(_0xa92b('0x12'));var authService=require(_0xa92b('0x13'));var qs=require(_0xa92b('0x14'));var as=require(_0xa92b('0x15'));var hardwareService=require(_0xa92b('0x16'));var logger=require(_0xa92b('0x17'))(_0xa92b('0x18'));var utils=require(_0xa92b('0x19'));var config=require(_0xa92b('0x1a'));var licenseUtil=require(_0xa92b('0x1b'));var db=require(_0xa92b('0x1c'))['db'];function respondWithStatusCode(_0x44cb8b,_0x54c458){_0x54c458=_0x54c458||0xcc;return function(_0x3abe65){if(_0x3abe65){return _0x44cb8b[_0xa92b('0x1d')](_0x54c458);}return _0x44cb8b['status'](_0x54c458)['end']();};}function respondWithResult(_0x7345fc,_0x2efaad){_0x2efaad=_0x2efaad||0xc8;return function(_0xbcd3bc){if(_0xbcd3bc){return _0x7345fc[_0xa92b('0x1e')](_0x2efaad)[_0xa92b('0x1f')](_0xbcd3bc);}};}function respondWithFilteredResult(_0x48ed30,_0x4add8b){return function(_0x447399){if(_0x447399){var _0x3a5dfb=_0x447399[_0xa92b('0x20')],_0x191b88=_0x4add8b[_0xa92b('0x21')],_0x569f4a=_0x4add8b['offset']+_0x4add8b[_0xa92b('0x22')],_0x237821;if(_0x569f4a>=_0x3a5dfb){_0x569f4a=_0x3a5dfb;_0x237821=0xc8;}else{_0x237821=0xce;}_0x48ed30[_0xa92b('0x1e')](_0x237821);return _0x48ed30['set']('Content-Range',_0x191b88+'-'+_0x569f4a+'/'+_0x3a5dfb)[_0xa92b('0x1f')](_0x447399);}return null;};}function patchUpdates(_0x5437bc){return function(_0x48f41d){try{jsonpatch[_0xa92b('0x23')](_0x48f41d,_0x5437bc,!![]);}catch(_0x1d7a55){return BPromise[_0xa92b('0x24')](_0x1d7a55);}return _0x48f41d['save']();};}function saveUpdates(_0x4aa06e,_0xd30193){return function(_0x4f723f){if(_0x4f723f){return _0x4f723f[_0xa92b('0x25')](_0x4aa06e)[_0xa92b('0x26')](function(_0xa7f4ec){return _0xa7f4ec;});}return null;};}function removeEntity(_0x11756d,_0x3c9f21){return function(_0x40bd75){if(_0x40bd75){return _0x40bd75[_0xa92b('0x27')]()[_0xa92b('0x26')](function(){var _0x4382e0=_0x40bd75[_0xa92b('0x28')]({'plain':!![]});var _0xa1ff1b=_0xa92b('0x29');return db['UserProfileResource'][_0xa92b('0x27')]({'where':{'type':_0xa1ff1b,'resourceId':_0x4382e0['id']}})[_0xa92b('0x26')](function(){return _0x40bd75;});})[_0xa92b('0x26')](function(){_0x11756d[_0xa92b('0x1e')](0xcc)[_0xa92b('0x2a')]();});}};}function handleEntityNotFound(_0x574fd2,_0x4a0fdb){return function(_0x2476a7){if(!_0x2476a7){_0x574fd2[_0xa92b('0x1d')](0x194);}return _0x2476a7;};}function handleError(_0x2b013f,_0x317f20){_0x317f20=_0x317f20||0x1f4;return function(_0x184f6e){logger['error'](_0x184f6e[_0xa92b('0x2b')]);if(_0x184f6e['name']){delete _0x184f6e[_0xa92b('0x2c')];}_0x2b013f[_0xa92b('0x1e')](_0x317f20)[_0xa92b('0x2d')](_0x184f6e);};}exports['index']=function(_0x16247f,_0x1e6f5a){var _0x42b38f={},_0x32e611={},_0x361905={'count':0x0,'rows':[]};var _0x250df4=_[_0xa92b('0x2e')](db[_0xa92b('0x29')][_0xa92b('0x2f')],function(_0x5ddf2a){return{'name':_0x5ddf2a[_0xa92b('0x30')],'type':_0x5ddf2a[_0xa92b('0x31')][_0xa92b('0x32')]};});_0x32e611[_0xa92b('0x33')]=_[_0xa92b('0x2e')](_0x250df4,_0xa92b('0x2c'));_0x32e611[_0xa92b('0x34')]=_[_0xa92b('0x35')](_0x16247f[_0xa92b('0x34')]);_0x32e611[_0xa92b('0x36')]=_[_0xa92b('0x37')](_0x32e611[_0xa92b('0x33')],_0x32e611[_0xa92b('0x34')]);_0x42b38f[_0xa92b('0x38')]=_[_0xa92b('0x37')](_0x32e611[_0xa92b('0x33')],qs['fields'](_0x16247f[_0xa92b('0x34')][_0xa92b('0x39')]));_0x42b38f[_0xa92b('0x38')]=_0x42b38f[_0xa92b('0x38')][_0xa92b('0x3a')]?_0x42b38f[_0xa92b('0x38')]:_0x32e611[_0xa92b('0x33')];if(!_0x16247f[_0xa92b('0x34')][_0xa92b('0x3b')]('nolimit')){_0x42b38f[_0xa92b('0x22')]=qs[_0xa92b('0x22')](_0x16247f[_0xa92b('0x34')][_0xa92b('0x22')]);_0x42b38f[_0xa92b('0x21')]=qs[_0xa92b('0x21')](_0x16247f[_0xa92b('0x34')][_0xa92b('0x21')]);}_0x42b38f[_0xa92b('0x3c')]=qs[_0xa92b('0x3d')](_0x16247f[_0xa92b('0x34')]['sort']);_0x42b38f[_0xa92b('0x3e')]=qs['filters'](_[_0xa92b('0x3f')](_0x16247f[_0xa92b('0x34')],_0x32e611['filters']),_0x250df4);if(_0x16247f[_0xa92b('0x34')][_0xa92b('0x40')]){_0x42b38f[_0xa92b('0x3e')]=_[_0xa92b('0x41')](_0x42b38f[_0xa92b('0x3e')],{'$or':_[_0xa92b('0x2e')](_0x250df4,function(_0x15371f){if(_0x15371f['type']!==_0xa92b('0x42')){var _0x5c4015={};_0x5c4015[_0x15371f[_0xa92b('0x2c')]]={'$like':'%'+_0x16247f['query'][_0xa92b('0x40')]+'%'};return _0x5c4015;}})});}_0x42b38f=_[_0xa92b('0x41')]({},_0x42b38f,_0x16247f['options']);var _0x457368={'where':_0x42b38f[_0xa92b('0x3e')]};return db[_0xa92b('0x29')]['count'](_0x457368)[_0xa92b('0x26')](function(_0x2cd19d){_0x361905[_0xa92b('0x20')]=_0x2cd19d;if(_0x16247f[_0xa92b('0x34')]['includeAll']){_0x42b38f[_0xa92b('0x43')]=[{'all':!![]}];}return db[_0xa92b('0x29')][_0xa92b('0x44')](_0x42b38f);})[_0xa92b('0x26')](function(_0x3c5f83){_0x361905[_0xa92b('0x45')]=_0x3c5f83;return _0x361905;})[_0xa92b('0x26')](respondWithFilteredResult(_0x1e6f5a,_0x42b38f))['catch'](handleError(_0x1e6f5a,null));};exports[_0xa92b('0x46')]=function(_0x384725,_0x287f64){var _0x1109a5={'raw':!![],'where':{'id':_0x384725[_0xa92b('0x47')]['id']}},_0x1a4ff5={};_0x1a4ff5[_0xa92b('0x33')]=_['keys'](db[_0xa92b('0x29')][_0xa92b('0x2f')]);_0x1a4ff5[_0xa92b('0x34')]=_['keys'](_0x384725['query']);_0x1a4ff5[_0xa92b('0x36')]=_[_0xa92b('0x37')](_0x1a4ff5[_0xa92b('0x33')],_0x1a4ff5[_0xa92b('0x34')]);_0x1109a5[_0xa92b('0x38')]=_[_0xa92b('0x37')](_0x1a4ff5[_0xa92b('0x33')],qs[_0xa92b('0x39')](_0x384725[_0xa92b('0x34')][_0xa92b('0x39')]));_0x1109a5['attributes']=_0x1109a5[_0xa92b('0x38')][_0xa92b('0x3a')]?_0x1109a5['attributes']:_0x1a4ff5[_0xa92b('0x33')];if(_0x384725[_0xa92b('0x34')][_0xa92b('0x48')]){_0x1109a5[_0xa92b('0x43')]=[{'all':!![]}];}_0x1109a5=_['merge']({},_0x1109a5,_0x384725[_0xa92b('0x49')]);return db['UserOpenchannelInteraction'][_0xa92b('0x4a')](_0x1109a5)[_0xa92b('0x26')](handleEntityNotFound(_0x287f64,null))['then'](respondWithResult(_0x287f64,null))[_0xa92b('0x4b')](handleError(_0x287f64,null));};exports['create']=function(_0x521481,_0x18378c){return db['UserOpenchannelInteraction']['create'](_0x521481[_0xa92b('0x4c')],{})[_0xa92b('0x26')](function(_0x457cd0){var _0x4092d0=_0x521481[_0xa92b('0x4d')]['get']({'plain':!![]});if(!_0x4092d0)throw new Error(_0xa92b('0x4e'));if(_0x4092d0[_0xa92b('0x4f')]==='user'){var _0x255965=_0x457cd0[_0xa92b('0x28')]({'plain':!![]});var _0x1b7677='UserOpenchannelInteraction';return db[_0xa92b('0x50')][_0xa92b('0x4a')]({'where':{'name':_0x1b7677,'userProfileId':_0x4092d0['userProfileId']},'raw':!![]})[_0xa92b('0x26')](function(_0x4079b9){if(_0x4079b9&&_0x4079b9[_0xa92b('0x51')]===0x0){return db[_0xa92b('0x52')][_0xa92b('0x53')]({'name':_0x255965[_0xa92b('0x2c')],'resourceId':_0x255965['id'],'type':_0x4079b9[_0xa92b('0x2c')],'sectionId':_0x4079b9['id']},{})['then'](function(){return _0x457cd0;});}else{return _0x457cd0;}})['catch'](function(_0x26844d){logger[_0xa92b('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26844d);throw _0x26844d;});}return _0x457cd0;})[_0xa92b('0x26')](respondWithResult(_0x18378c,0xc9))['catch'](handleError(_0x18378c,null));};exports['update']=function(_0x5260fb,_0x2b632e){if(_0x5260fb['body']['id']){delete _0x5260fb[_0xa92b('0x4c')]['id'];}return db[_0xa92b('0x29')][_0xa92b('0x4a')]({'where':{'id':_0x5260fb['params']['id']}})[_0xa92b('0x26')](handleEntityNotFound(_0x2b632e,null))[_0xa92b('0x26')](saveUpdates(_0x5260fb[_0xa92b('0x4c')],null))[_0xa92b('0x26')](respondWithResult(_0x2b632e,null))[_0xa92b('0x4b')](handleError(_0x2b632e,null));};exports[_0xa92b('0x27')]=function(_0x5b2d15,_0x183145){return db[_0xa92b('0x29')][_0xa92b('0x4a')]({'where':{'id':_0x5b2d15[_0xa92b('0x47')]['id']}})[_0xa92b('0x26')](handleEntityNotFound(_0x183145,null))[_0xa92b('0x26')](removeEntity(_0x183145,null))['catch'](handleError(_0x183145,null));}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js index eac47aa..88ddcc7 100644 --- a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js +++ b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5981=['./UserOpenchannelInteraction.attributes','exports','UserOpenchannelInteraction','user_has_openchannel_interactions','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x401676,_0x3f1436){var _0x4f13fe=function(_0xd2f197){while(--_0xd2f197){_0x401676['push'](_0x401676['shift']());}};_0x4f13fe(++_0x3f1436);}(_0x5981,0x67));var _0x1598=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5981[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1598('0x0'));var util=require('util');var logger=require(_0x1598('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1598('0x2'));var rp=require(_0x1598('0x3'));var fs=require('fs');var path=require(_0x1598('0x4'));var rimraf=require(_0x1598('0x5'));var config=require(_0x1598('0x6'));var attributes=require(_0x1598('0x7'));module[_0x1598('0x8')]=function(_0x3a0877,_0x4d9d6e){return _0x3a0877['define'](_0x1598('0x9'),attributes,{'tableName':_0x1598('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33ed=['util','api','moment','request-promise','rimraf','../../config/environment','exports','UserOpenchannelInteraction','user_has_openchannel_interactions','lodash'];(function(_0x9c7074,_0x1fad53){var _0x563dd1=function(_0x33f2b5){while(--_0x33f2b5){_0x9c7074['push'](_0x9c7074['shift']());}};_0x563dd1(++_0x1fad53);}(_0x33ed,0x81));var _0xd33e=function(_0x16dbcd,_0x274516){_0x16dbcd=_0x16dbcd-0x0;var _0x34706e=_0x33ed[_0x16dbcd];return _0x34706e;};'use strict';var _=require(_0xd33e('0x0'));var util=require(_0xd33e('0x1'));var logger=require('../../config/logger')(_0xd33e('0x2'));var moment=require(_0xd33e('0x3'));var BPromise=require('bluebird');var rp=require(_0xd33e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd33e('0x5'));var config=require(_0xd33e('0x6'));var attributes=require('./UserOpenchannelInteraction.attributes');module[_0xd33e('0x7')]=function(_0x359373,_0x10b4a5){return _0x359373['define'](_0xd33e('0x8'),attributes,{'tableName':_0xd33e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.rpc.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.rpc.js index 99207f9..64ff319 100644 --- a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.rpc.js +++ b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80a3=['message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelInteraction,\x20%s,\x20%s'];(function(_0x3fb32b,_0x4a5248){var _0x35ea39=function(_0x28d1b8){while(--_0x28d1b8){_0x3fb32b['push'](_0x3fb32b['shift']());}};_0x35ea39(++_0x4a5248);}(_0x80a3,0x1e6));var _0x380a=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x80a3[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x380a('0x0'));var util=require(_0x380a('0x1'));var moment=require(_0x380a('0x2'));var BPromise=require('bluebird');var rs=require(_0x380a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x380a('0x4'))['db'];var utils=require(_0x380a('0x5'));var logger=require(_0x380a('0x6'))('rpc');var config=require(_0x380a('0x7'));var jayson=require(_0x380a('0x8'));var client=jayson[_0x380a('0x9')][_0x380a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2aeb25,_0x2abac6,_0x1b5f0c){return new BPromise(function(_0x1a1e7b,_0x3e7848){return client[_0x380a('0xb')](_0x2aeb25,_0x1b5f0c)[_0x380a('0xc')](function(_0x3f0e00){logger['info']('UserOpenchannelInteraction,\x20%s,\x20%s',_0x2abac6,_0x380a('0xd'));logger[_0x380a('0xe')](_0x380a('0xf'),_0x2abac6,'request\x20sent',JSON[_0x380a('0x10')](_0x3f0e00));if(_0x3f0e00[_0x380a('0x11')]){if(_0x3f0e00[_0x380a('0x11')][_0x380a('0x12')]===0x1f4){logger[_0x380a('0x11')](_0x380a('0x13'),_0x2abac6,_0x3f0e00[_0x380a('0x11')][_0x380a('0x14')]);return _0x3e7848(_0x3f0e00[_0x380a('0x11')][_0x380a('0x14')]);}logger[_0x380a('0x11')](_0x380a('0x13'),_0x2abac6,_0x3f0e00[_0x380a('0x11')][_0x380a('0x14')]);return _0x1a1e7b(_0x3f0e00[_0x380a('0x11')][_0x380a('0x14')]);}else{logger[_0x380a('0x15')](_0x380a('0x13'),_0x2abac6,_0x380a('0xd'));_0x1a1e7b(_0x3f0e00['result'][_0x380a('0x14')]);}})[_0x380a('0x16')](function(_0x1a6867){logger[_0x380a('0x11')](_0x380a('0x13'),_0x2abac6,_0x1a6867);_0x3e7848(_0x1a6867);});});} \ No newline at end of file +var _0x7b84=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelInteraction,\x20%s,\x20%s','UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x7b84,0x167));var _0x47b8=function(_0x1c9885,_0x223e84){_0x1c9885=_0x1c9885-0x0;var _0x71b7b2=_0x7b84[_0x1c9885];return _0x71b7b2;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47b8('0x3'));var db=require(_0x47b8('0x4'))['db'];var utils=require(_0x47b8('0x5'));var logger=require(_0x47b8('0x6'))(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var jayson=require(_0x47b8('0x9'));var client=jayson[_0x47b8('0xa')][_0x47b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30c35b,_0x81b22f,_0x1ae3b6){return new BPromise(function(_0x129a65,_0x6ad89){return client[_0x47b8('0xc')](_0x30c35b,_0x1ae3b6)[_0x47b8('0xd')](function(_0x46267c){logger[_0x47b8('0xe')](_0x47b8('0xf'),_0x81b22f,'request\x20sent');logger['debug'](_0x47b8('0x10'),_0x81b22f,_0x47b8('0x11'),JSON[_0x47b8('0x12')](_0x46267c));if(_0x46267c[_0x47b8('0x13')]){if(_0x46267c['error'][_0x47b8('0x14')]===0x1f4){logger[_0x47b8('0x13')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x81b22f,_0x46267c[_0x47b8('0x13')][_0x47b8('0x15')]);return _0x6ad89(_0x46267c[_0x47b8('0x13')][_0x47b8('0x15')]);}logger[_0x47b8('0x13')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x81b22f,_0x46267c['error'][_0x47b8('0x15')]);return _0x129a65(_0x46267c['error'][_0x47b8('0x15')]);}else{logger[_0x47b8('0xe')](_0x47b8('0xf'),_0x81b22f,_0x47b8('0x11'));_0x129a65(_0x46267c[_0x47b8('0x16')][_0x47b8('0x15')]);}})[_0x47b8('0x17')](function(_0x35bb3a){logger[_0x47b8('0x13')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x81b22f,_0x35bb3a);_0x6ad89(_0x35bb3a);});});} \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/index.js b/server/api/UserOpenchannelInteraction/index.js index 0d97ba5..6d00e89 100644 --- a/server/api/UserOpenchannelInteraction/index.js +++ b/server/api/UserOpenchannelInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd974=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x2efd13,_0x56fe28){var _0x41f975=function(_0x3cdf21){while(--_0x3cdf21){_0x2efd13['push'](_0x2efd13['shift']());}};_0x41f975(++_0x56fe28);}(_0xd974,0x1ec));var _0x4d97=function(_0x3f475a,_0x592e24){_0x3f475a=_0x3f475a-0x0;var _0x16dc81=_0xd974[_0x3f475a];return _0x16dc81;};'use strict';var multer=require(_0x4d97('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4d97('0x1'));var express=require(_0x4d97('0x2'));var router=express[_0x4d97('0x3')]();var auth=require(_0x4d97('0x4'));var interaction=require(_0x4d97('0x5'));var config=require(_0x4d97('0x6'));var controller=require('./UserOpenchannelInteraction.controller');router[_0x4d97('0x7')]('/',auth['isAuthenticated'](),controller[_0x4d97('0x8')]);router[_0x4d97('0x7')](_0x4d97('0x9'),auth['isAuthenticated'](),controller[_0x4d97('0xa')]);router[_0x4d97('0xb')]('/',auth[_0x4d97('0xc')](),controller[_0x4d97('0xd')]);router[_0x4d97('0xe')](_0x4d97('0x9'),auth['isAuthenticated'](),controller[_0x4d97('0xf')]);router[_0x4d97('0x10')](_0x4d97('0x9'),auth['isAuthenticated'](),controller[_0x4d97('0x11')]);module[_0x4d97('0x12')]=router; \ No newline at end of file +var _0x39cc=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./UserOpenchannelInteraction.controller','get','isAuthenticated','index','/:id','show','update','destroy','multer'];(function(_0x583125,_0x34c12b){var _0x118c4d=function(_0x1b7e93){while(--_0x1b7e93){_0x583125['push'](_0x583125['shift']());}};_0x118c4d(++_0x34c12b);}(_0x39cc,0x11c));var _0xc39c=function(_0x4a496b,_0x5146ad){_0x4a496b=_0x4a496b-0x0;var _0x49f98c=_0x39cc[_0x4a496b];return _0x49f98c;};'use strict';var multer=require(_0xc39c('0x0'));var util=require(_0xc39c('0x1'));var path=require('path');var timeout=require(_0xc39c('0x2'));var express=require(_0xc39c('0x3'));var router=express[_0xc39c('0x4')]();var auth=require(_0xc39c('0x5'));var interaction=require(_0xc39c('0x6'));var config=require('../../config/environment');var controller=require(_0xc39c('0x7'));router[_0xc39c('0x8')]('/',auth[_0xc39c('0x9')](),controller[_0xc39c('0xa')]);router['get'](_0xc39c('0xb'),auth[_0xc39c('0x9')](),controller[_0xc39c('0xc')]);router['post']('/',auth[_0xc39c('0x9')](),controller['create']);router['put'](_0xc39c('0xb'),auth[_0xc39c('0x9')](),controller[_0xc39c('0xd')]);router['delete'](_0xc39c('0xb'),auth[_0xc39c('0x9')](),controller[_0xc39c('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js b/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js index 5dc437a..cf5af44 100644 --- a/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js +++ b/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4dab=['sequelize','exports','INTEGER'];(function(_0x5dd590,_0x23b801){var _0x2cd24d=function(_0x12e316){while(--_0x12e316){_0x5dd590['push'](_0x5dd590['shift']());}};_0x2cd24d(++_0x23b801);}(_0x4dab,0x183));var _0xb4da=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x4dab[_0x37c22c];return _0x119d79;};'use strict';var Sequelize=require(_0xb4da('0x0'));module[_0xb4da('0x1')]={'SmsInteractionId':{'type':Sequelize[_0xb4da('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file +var _0x1cc5=['INTEGER','sequelize'];(function(_0x307f35,_0x12eb51){var _0x32a189=function(_0x1ab64a){while(--_0x1ab64a){_0x307f35['push'](_0x307f35['shift']());}};_0x32a189(++_0x12eb51);}(_0x1cc5,0x11b));var _0x51cc=function(_0x16af88,_0x1c6a15){_0x16af88=_0x16af88-0x0;var _0x376ddd=_0x1cc5[_0x16af88];return _0x376ddd;};'use strict';var Sequelize=require(_0x51cc('0x0'));module['exports']={'SmsInteractionId':{'type':Sequelize[_0x51cc('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x51cc('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.controller.js b/server/api/UserSmsInteraction/UserSmsInteraction.controller.js index 27c23fa..b5fb8dc 100644 --- a/server/api/UserSmsInteraction/UserSmsInteraction.controller.js +++ b/server/api/UserSmsInteraction/UserSmsInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['destroy','then','UserSmsInteractions','UserProfileResource','stack','name','send','index','map','UserSmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x57c6fc,_0x3b41c4){var _0x1e2fc8=function(_0x16a51b){while(--_0x16a51b){_0x57c6fc['push'](_0x57c6fc['shift']());}};_0x1e2fc8(++_0x3b41c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':!![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x47')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x8d6dd1[_0x0a9e('0x48')],{})[_0x0a9e('0x22')](function(_0x45c845){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]['get']({'plain':!![]});if(!_0x37be73)throw new Error(_0x0a9e('0x4a'));if(_0x37be73[_0x0a9e('0x4b')]===_0x0a9e('0x49')){var _0x16f976=_0x45c845[_0x0a9e('0x4c')]({'plain':!![]});var _0x992c77=_0x0a9e('0x23');return db[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'where':{'name':_0x992c77,'userProfileId':_0x37be73['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x3fe430){if(_0x3fe430&&_0x3fe430['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16f976[_0x0a9e('0x26')],'resourceId':_0x16f976['id'],'type':_0x3fe430[_0x0a9e('0x26')],'sectionId':_0x3fe430['id']},{})[_0x0a9e('0x22')](function(){return _0x45c845;});}else{return _0x45c845;}})[_0x0a9e('0x42')](function(_0x61bb17){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0x61bb17);throw _0x61bb17;});}return _0x45c845;})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))['catch'](handleError(_0x562fb4,null));};exports['update']=function(_0x53975a,_0x39d77d){if(_0x53975a[_0x0a9e('0x48')]['id']){delete _0x53975a[_0x0a9e('0x48')]['id'];}return db['UserSmsInteraction'][_0x0a9e('0x4e')]({'where':{'id':_0x53975a[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x39d77d,null))['then'](saveUpdates(_0x53975a[_0x0a9e('0x48')],null))['then'](respondWithResult(_0x39d77d,null))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports['destroy']=function(_0x2e5e62,_0x3c20b2){return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x2e5e62[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3c20b2,null))['then'](removeEntity(_0x3c20b2,null))['catch'](handleError(_0x3c20b2,null));}; \ No newline at end of file +var _0xa9e0=['destroy','then','UserSmsInteractions','UserProfileResource','stack','name','send','index','map','UserSmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x13b4fc,_0x1c71bd){var _0xe44d17=function(_0x3ffd82){while(--_0x3ffd82){_0x13b4fc['push'](_0x13b4fc['shift']());}};_0xe44d17(++_0x1c71bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':!![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x47')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x8d6dd1[_0x0a9e('0x48')],{})[_0x0a9e('0x22')](function(_0x45c845){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]['get']({'plain':!![]});if(!_0x37be73)throw new Error(_0x0a9e('0x4a'));if(_0x37be73[_0x0a9e('0x4b')]===_0x0a9e('0x49')){var _0x16f976=_0x45c845[_0x0a9e('0x4c')]({'plain':!![]});var _0x992c77=_0x0a9e('0x23');return db[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'where':{'name':_0x992c77,'userProfileId':_0x37be73['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x3fe430){if(_0x3fe430&&_0x3fe430['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16f976[_0x0a9e('0x26')],'resourceId':_0x16f976['id'],'type':_0x3fe430[_0x0a9e('0x26')],'sectionId':_0x3fe430['id']},{})[_0x0a9e('0x22')](function(){return _0x45c845;});}else{return _0x45c845;}})[_0x0a9e('0x42')](function(_0x61bb17){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0x61bb17);throw _0x61bb17;});}return _0x45c845;})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))['catch'](handleError(_0x562fb4,null));};exports['update']=function(_0x53975a,_0x39d77d){if(_0x53975a[_0x0a9e('0x48')]['id']){delete _0x53975a[_0x0a9e('0x48')]['id'];}return db['UserSmsInteraction'][_0x0a9e('0x4e')]({'where':{'id':_0x53975a[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x39d77d,null))['then'](saveUpdates(_0x53975a[_0x0a9e('0x48')],null))['then'](respondWithResult(_0x39d77d,null))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports['destroy']=function(_0x2e5e62,_0x3c20b2){return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x2e5e62[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3c20b2,null))['then'](removeEntity(_0x3c20b2,null))['catch'](handleError(_0x3c20b2,null));}; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.model.js b/server/api/UserSmsInteraction/UserSmsInteraction.model.js index b69bac5..5153883 100644 --- a/server/api/UserSmsInteraction/UserSmsInteraction.model.js +++ b/server/api/UserSmsInteraction/UserSmsInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25c4=['exports','UserSmsInteraction','user_has_sms_interactions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./UserSmsInteraction.attributes'];(function(_0x548d7d,_0x2d41fc){var _0xb1c878=function(_0x570f09){while(--_0x570f09){_0x548d7d['push'](_0x548d7d['shift']());}};_0xb1c878(++_0x2d41fc);}(_0x25c4,0x161));var _0x425c=function(_0x5de10b,_0x5af540){_0x5de10b=_0x5de10b-0x0;var _0x477b4a=_0x25c4[_0x5de10b];return _0x477b4a;};'use strict';var _=require(_0x425c('0x0'));var util=require(_0x425c('0x1'));var logger=require(_0x425c('0x2'))(_0x425c('0x3'));var moment=require(_0x425c('0x4'));var BPromise=require(_0x425c('0x5'));var rp=require(_0x425c('0x6'));var fs=require('fs');var path=require(_0x425c('0x7'));var rimraf=require(_0x425c('0x8'));var config=require(_0x425c('0x9'));var attributes=require(_0x425c('0xa'));module[_0x425c('0xb')]=function(_0x34b09b,_0x14d32e){return _0x34b09b['define'](_0x425c('0xc'),attributes,{'tableName':_0x425c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x707f=['define','UserSmsInteraction','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x707f,0x158));var _0xf707=function(_0xc07bf3,_0x245a89){_0xc07bf3=_0xc07bf3-0x0;var _0x575d2c=_0x707f[_0xc07bf3];return _0x575d2c;};'use strict';var _=require(_0xf707('0x0'));var util=require(_0xf707('0x1'));var logger=require(_0xf707('0x2'))(_0xf707('0x3'));var moment=require('moment');var BPromise=require(_0xf707('0x4'));var rp=require(_0xf707('0x5'));var fs=require('fs');var path=require(_0xf707('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./UserSmsInteraction.attributes');module['exports']=function(_0x174933,_0x31a6b2){return _0x174933[_0xf707('0x7')](_0xf707('0x8'),attributes,{'tableName':'user_has_sms_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.rpc.js b/server/api/UserSmsInteraction/UserSmsInteraction.rpc.js index 7d32202..0b9a08a 100644 --- a/server/api/UserSmsInteraction/UserSmsInteraction.rpc.js +++ b/server/api/UserSmsInteraction/UserSmsInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bfa=['client','http','request','then','info','UserSmsInteraction,\x20%s,\x20%s','request\x20sent','debug','UserSmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x8d77f0,_0x28e460){var _0x345dc7=function(_0x1fa20f){while(--_0x1fa20f){_0x8d77f0['push'](_0x8d77f0['shift']());}};_0x345dc7(++_0x28e460);}(_0x3bfa,0x19f));var _0xa3bf=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x3bfa[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0xa3bf('0x0'));var util=require('util');var moment=require(_0xa3bf('0x1'));var BPromise=require(_0xa3bf('0x2'));var rs=require(_0xa3bf('0x3'));var fs=require('fs');var Redis=require(_0xa3bf('0x4'));var db=require(_0xa3bf('0x5'))['db'];var utils=require(_0xa3bf('0x6'));var logger=require(_0xa3bf('0x7'))(_0xa3bf('0x8'));var config=require('../../config/environment');var jayson=require(_0xa3bf('0x9'));var client=jayson[_0xa3bf('0xa')][_0xa3bf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1aa689,_0xac7560,_0x3e0af0){return new BPromise(function(_0x232a3c,_0x3bec83){return client[_0xa3bf('0xc')](_0x1aa689,_0x3e0af0)[_0xa3bf('0xd')](function(_0x41e278){logger[_0xa3bf('0xe')](_0xa3bf('0xf'),_0xac7560,_0xa3bf('0x10'));logger[_0xa3bf('0x11')](_0xa3bf('0x12'),_0xac7560,_0xa3bf('0x10'),JSON[_0xa3bf('0x13')](_0x41e278));if(_0x41e278['error']){if(_0x41e278[_0xa3bf('0x14')][_0xa3bf('0x15')]===0x1f4){logger[_0xa3bf('0x14')]('UserSmsInteraction,\x20%s,\x20%s',_0xac7560,_0x41e278[_0xa3bf('0x14')][_0xa3bf('0x16')]);return _0x3bec83(_0x41e278[_0xa3bf('0x14')][_0xa3bf('0x16')]);}logger[_0xa3bf('0x14')](_0xa3bf('0xf'),_0xac7560,_0x41e278[_0xa3bf('0x14')][_0xa3bf('0x16')]);return _0x232a3c(_0x41e278[_0xa3bf('0x14')][_0xa3bf('0x16')]);}else{logger[_0xa3bf('0xe')]('UserSmsInteraction,\x20%s,\x20%s',_0xac7560,'request\x20sent');_0x232a3c(_0x41e278[_0xa3bf('0x17')]['message']);}})[_0xa3bf('0x18')](function(_0x3891fd){logger[_0xa3bf('0x14')](_0xa3bf('0xf'),_0xac7560,_0x3891fd);_0x3bec83(_0x3891fd);});});} \ No newline at end of file +var _0xe206=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','UserSmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsInteraction,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0xe206,0x146));var _0x6e20=function(_0x215e65,_0x183f97){_0x215e65=_0x215e65-0x0;var _0xa85842=_0xe206[_0x215e65];return _0xa85842;};'use strict';var _=require(_0x6e20('0x0'));var util=require(_0x6e20('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6e20('0x2'));var fs=require('fs');var Redis=require(_0x6e20('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6e20('0x4'))(_0x6e20('0x5'));var config=require(_0x6e20('0x6'));var jayson=require(_0x6e20('0x7'));var client=jayson[_0x6e20('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc55829,_0x1febbf,_0x3bcf56){return new BPromise(function(_0x18ef76,_0x5b085b){return client[_0x6e20('0x9')](_0xc55829,_0x3bcf56)[_0x6e20('0xa')](function(_0x8197ed){logger[_0x6e20('0xb')]('UserSmsInteraction,\x20%s,\x20%s',_0x1febbf,_0x6e20('0xc'));logger[_0x6e20('0xd')](_0x6e20('0xe'),_0x1febbf,_0x6e20('0xc'),JSON[_0x6e20('0xf')](_0x8197ed));if(_0x8197ed[_0x6e20('0x10')]){if(_0x8197ed['error'][_0x6e20('0x11')]===0x1f4){logger['error'](_0x6e20('0x12'),_0x1febbf,_0x8197ed['error']['message']);return _0x5b085b(_0x8197ed[_0x6e20('0x10')][_0x6e20('0x13')]);}logger['error']('UserSmsInteraction,\x20%s,\x20%s',_0x1febbf,_0x8197ed['error']['message']);return _0x18ef76(_0x8197ed[_0x6e20('0x10')]['message']);}else{logger[_0x6e20('0xb')](_0x6e20('0x12'),_0x1febbf,_0x6e20('0xc'));_0x18ef76(_0x8197ed[_0x6e20('0x14')][_0x6e20('0x13')]);}})[_0x6e20('0x15')](function(_0x53d898){logger[_0x6e20('0x10')](_0x6e20('0x12'),_0x1febbf,_0x53d898);_0x5b085b(_0x53d898);});});} \ No newline at end of file diff --git a/server/api/UserSmsInteraction/index.js b/server/api/UserSmsInteraction/index.js index f6ba509..1f1b4be 100644 --- a/server/api/UserSmsInteraction/index.js +++ b/server/api/UserSmsInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9efb=['/:id','isAuthenticated','show','post','create','put','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserSmsInteraction.controller','index','get'];(function(_0x348d7f,_0x589c4e){var _0x55ba76=function(_0x46d583){while(--_0x46d583){_0x348d7f['push'](_0x348d7f['shift']());}};_0x55ba76(++_0x589c4e);}(_0x9efb,0x125));var _0xb9ef=function(_0x5c3b51,_0x11565e){_0x5c3b51=_0x5c3b51-0x0;var _0x546a85=_0x9efb[_0x5c3b51];return _0x546a85;};'use strict';var multer=require(_0xb9ef('0x0'));var util=require(_0xb9ef('0x1'));var path=require('path');var timeout=require(_0xb9ef('0x2'));var express=require(_0xb9ef('0x3'));var router=express[_0xb9ef('0x4')]();var auth=require(_0xb9ef('0x5'));var interaction=require(_0xb9ef('0x6'));var config=require(_0xb9ef('0x7'));var controller=require(_0xb9ef('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb9ef('0x9')]);router[_0xb9ef('0xa')](_0xb9ef('0xb'),auth[_0xb9ef('0xc')](),controller[_0xb9ef('0xd')]);router[_0xb9ef('0xe')]('/',auth['isAuthenticated'](),controller[_0xb9ef('0xf')]);router[_0xb9ef('0x10')](_0xb9ef('0xb'),auth[_0xb9ef('0xc')](),controller[_0xb9ef('0x11')]);router['delete'](_0xb9ef('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xb9ef('0x12')]=router; \ No newline at end of file +var _0x00d7=['show','post','put','/:id','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserSmsInteraction.controller','get','isAuthenticated'];(function(_0x44adba,_0x4a8c7e){var _0x2845a7=function(_0x21e6d6){while(--_0x21e6d6){_0x44adba['push'](_0x44adba['shift']());}};_0x2845a7(++_0x4a8c7e);}(_0x00d7,0xe4));var _0x700d=function(_0x33b25c,_0x2cce34){_0x33b25c=_0x33b25c-0x0;var _0x582468=_0x00d7[_0x33b25c];return _0x582468;};'use strict';var multer=require(_0x700d('0x0'));var util=require('util');var path=require(_0x700d('0x1'));var timeout=require('connect-timeout');var express=require(_0x700d('0x2'));var router=express[_0x700d('0x3')]();var auth=require(_0x700d('0x4'));var interaction=require(_0x700d('0x5'));var config=require(_0x700d('0x6'));var controller=require(_0x700d('0x7'));router[_0x700d('0x8')]('/',auth[_0x700d('0x9')](),controller['index']);router[_0x700d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x700d('0xa')]);router[_0x700d('0xb')]('/',auth[_0x700d('0x9')](),controller['create']);router[_0x700d('0xc')](_0x700d('0xd'),auth[_0x700d('0x9')](),controller['update']);router[_0x700d('0xe')](_0x700d('0xd'),auth[_0x700d('0x9')](),controller[_0x700d('0xf')]);module[_0x700d('0x10')]=router; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js index 78b8d59..9705d69 100644 --- a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js +++ b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x65f4=['INTEGER'];(function(_0x544c0e,_0x5776b6){var _0x2c2ea9=function(_0x4d923c){while(--_0x4d923c){_0x544c0e['push'](_0x544c0e['shift']());}};_0x2c2ea9(++_0x5776b6);}(_0x65f4,0x19a));var _0x465f=function(_0x430f35,_0x509f96){_0x430f35=_0x430f35-0x0;var _0xae3a81=_0x65f4[_0x430f35];return _0xae3a81;};'use strict';var Sequelize=require('sequelize');module['exports']={'WhatsappInteractionId':{'type':Sequelize[_0x465f('0x0')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x465f('0x0')],'primaryKey':!![]}}; \ No newline at end of file +var _0x80a4=['INTEGER'];(function(_0xb9099a,_0x23e926){var _0x3441b1=function(_0x2167c6){while(--_0x2167c6){_0xb9099a['push'](_0xb9099a['shift']());}};_0x3441b1(++_0x23e926);}(_0x80a4,0xdb));var _0x480a=function(_0x1c17e3,_0x5995b9){_0x1c17e3=_0x1c17e3-0x0;var _0x54a18b=_0x80a4[_0x1c17e3];return _0x54a18b;};'use strict';var Sequelize=require('sequelize');module['exports']={'WhatsappInteractionId':{'type':Sequelize[_0x480a('0x0')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js index fd7fa38..b42cb58 100644 --- a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js +++ b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3aa=['error','stack','name','index','map','UserWhatsappInteraction','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','fast-json-patch','request-promise','moment','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','save','update','then','destroy','UserWhatsappInteractions','UserProfileResource','end'];(function(_0x62565c,_0x3ef4fb){var _0x51e852=function(_0x18f1e2){while(--_0x18f1e2){_0x62565c['push'](_0x62565c['shift']());}};_0x51e852(++_0x3ef4fb);}(_0xf3aa,0x1b2));var _0xaf3a=function(_0x585d09,_0x1274bc){_0x585d09=_0x585d09-0x0;var _0x7d9a14=_0xf3aa[_0x585d09];return _0x7d9a14;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaf3a('0x0'));var rp=require(_0xaf3a('0x1'));var moment=require(_0xaf3a('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaf3a('0x3'));var path=require(_0xaf3a('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaf3a('0x5'));var fs=require('fs');var _=require(_0xaf3a('0x6'));var squel=require(_0xaf3a('0x7'));var crypto=require(_0xaf3a('0x8'));var jsforce=require(_0xaf3a('0x9'));var deskjs=require(_0xaf3a('0xa'));var toCsv=require(_0xaf3a('0xb'));var querystring=require(_0xaf3a('0xc'));var Papa=require(_0xaf3a('0xd'));var Redis=require(_0xaf3a('0xe'));var authService=require(_0xaf3a('0xf'));var qs=require(_0xaf3a('0x10'));var as=require(_0xaf3a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf3a('0x12'))(_0xaf3a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaf3a('0x14'))['db'];function respondWithStatusCode(_0x3479bf,_0x243d2a){_0x243d2a=_0x243d2a||0xcc;return function(_0x22ad89){if(_0x22ad89){return _0x3479bf[_0xaf3a('0x15')](_0x243d2a);}return _0x3479bf[_0xaf3a('0x16')](_0x243d2a)['end']();};}function respondWithResult(_0xd89717,_0x54e826){_0x54e826=_0x54e826||0xc8;return function(_0x4bb87f){if(_0x4bb87f){return _0xd89717[_0xaf3a('0x16')](_0x54e826)[_0xaf3a('0x17')](_0x4bb87f);}};}function respondWithFilteredResult(_0x5f08e4,_0xb0f040){return function(_0x13981d){if(_0x13981d){var _0x24e0d1=_0x13981d['count'],_0x16c0ae=_0xb0f040[_0xaf3a('0x18')],_0x202aa0=_0xb0f040['offset']+_0xb0f040['limit'],_0x1ca5d5;if(_0x202aa0>=_0x24e0d1){_0x202aa0=_0x24e0d1;_0x1ca5d5=0xc8;}else{_0x1ca5d5=0xce;}_0x5f08e4[_0xaf3a('0x16')](_0x1ca5d5);return _0x5f08e4[_0xaf3a('0x19')](_0xaf3a('0x1a'),_0x16c0ae+'-'+_0x202aa0+'/'+_0x24e0d1)['json'](_0x13981d);}return null;};}function patchUpdates(_0x4ac21c){return function(_0x28c5ac){try{jsonpatch['apply'](_0x28c5ac,_0x4ac21c,!![]);}catch(_0x5c8bea){return BPromise['reject'](_0x5c8bea);}return _0x28c5ac[_0xaf3a('0x1b')]();};}function saveUpdates(_0x46fc3a,_0x4ed46e){return function(_0x137854){if(_0x137854){return _0x137854[_0xaf3a('0x1c')](_0x46fc3a)[_0xaf3a('0x1d')](function(_0x32dd2f){return _0x32dd2f;});}return null;};}function removeEntity(_0x360745,_0x132a0f){return function(_0x51fa3f){if(_0x51fa3f){return _0x51fa3f[_0xaf3a('0x1e')]()[_0xaf3a('0x1d')](function(){var _0x5052a9=_0x51fa3f['get']({'plain':!![]});var _0x39b782=_0xaf3a('0x1f');return db[_0xaf3a('0x20')]['destroy']({'where':{'type':_0x39b782,'resourceId':_0x5052a9['id']}})[_0xaf3a('0x1d')](function(){return _0x51fa3f;});})['then'](function(){_0x360745[_0xaf3a('0x16')](0xcc)[_0xaf3a('0x21')]();});}};}function handleEntityNotFound(_0x55242f,_0x27f1e1){return function(_0x2ab810){if(!_0x2ab810){_0x55242f[_0xaf3a('0x15')](0x194);}return _0x2ab810;};}function handleError(_0x344d79,_0x521611){_0x521611=_0x521611||0x1f4;return function(_0x3c0471){logger[_0xaf3a('0x22')](_0x3c0471[_0xaf3a('0x23')]);if(_0x3c0471[_0xaf3a('0x24')]){delete _0x3c0471[_0xaf3a('0x24')];}_0x344d79[_0xaf3a('0x16')](_0x521611)['send'](_0x3c0471);};}exports[_0xaf3a('0x25')]=function(_0x198d42,_0x4218ca){var _0x2315cf={},_0x5044e7={},_0x18cc6f={'count':0x0,'rows':[]};var _0x3ffe2b=_[_0xaf3a('0x26')](db[_0xaf3a('0x27')]['rawAttributes'],function(_0x222581){return{'name':_0x222581[_0xaf3a('0x28')],'type':_0x222581[_0xaf3a('0x29')][_0xaf3a('0x2a')]};});_0x5044e7['model']=_['map'](_0x3ffe2b,_0xaf3a('0x24'));_0x5044e7['query']=_[_0xaf3a('0x2b')](_0x198d42[_0xaf3a('0x2c')]);_0x5044e7[_0xaf3a('0x2d')]=_[_0xaf3a('0x2e')](_0x5044e7[_0xaf3a('0x2f')],_0x5044e7[_0xaf3a('0x2c')]);_0x2315cf[_0xaf3a('0x30')]=_[_0xaf3a('0x2e')](_0x5044e7['model'],qs[_0xaf3a('0x31')](_0x198d42[_0xaf3a('0x2c')]['fields']));_0x2315cf[_0xaf3a('0x30')]=_0x2315cf[_0xaf3a('0x30')]['length']?_0x2315cf[_0xaf3a('0x30')]:_0x5044e7[_0xaf3a('0x2f')];if(!_0x198d42[_0xaf3a('0x2c')][_0xaf3a('0x32')](_0xaf3a('0x33'))){_0x2315cf['limit']=qs[_0xaf3a('0x34')](_0x198d42[_0xaf3a('0x2c')][_0xaf3a('0x34')]);_0x2315cf['offset']=qs[_0xaf3a('0x18')](_0x198d42[_0xaf3a('0x2c')][_0xaf3a('0x18')]);}_0x2315cf[_0xaf3a('0x35')]=qs[_0xaf3a('0x36')](_0x198d42[_0xaf3a('0x2c')]['sort']);_0x2315cf[_0xaf3a('0x37')]=qs[_0xaf3a('0x2d')](_[_0xaf3a('0x38')](_0x198d42[_0xaf3a('0x2c')],_0x5044e7['filters']),_0x3ffe2b);if(_0x198d42[_0xaf3a('0x2c')][_0xaf3a('0x39')]){_0x2315cf[_0xaf3a('0x37')]=_['merge'](_0x2315cf[_0xaf3a('0x37')],{'$or':_[_0xaf3a('0x26')](_0x3ffe2b,function(_0x491991){if(_0x491991[_0xaf3a('0x29')]!==_0xaf3a('0x3a')){var _0x5716d7={};_0x5716d7[_0x491991['name']]={'$like':'%'+_0x198d42[_0xaf3a('0x2c')][_0xaf3a('0x39')]+'%'};return _0x5716d7;}})});}_0x2315cf=_[_0xaf3a('0x3b')]({},_0x2315cf,_0x198d42[_0xaf3a('0x3c')]);var _0x379800={'where':_0x2315cf['where']};return db[_0xaf3a('0x27')]['count'](_0x379800)[_0xaf3a('0x1d')](function(_0x5cda0a){_0x18cc6f['count']=_0x5cda0a;if(_0x198d42[_0xaf3a('0x2c')][_0xaf3a('0x3d')]){_0x2315cf[_0xaf3a('0x3e')]=[{'all':!![]}];}return db[_0xaf3a('0x27')][_0xaf3a('0x3f')](_0x2315cf);})[_0xaf3a('0x1d')](function(_0x243da9){_0x18cc6f['rows']=_0x243da9;return _0x18cc6f;})[_0xaf3a('0x1d')](respondWithFilteredResult(_0x4218ca,_0x2315cf))[_0xaf3a('0x40')](handleError(_0x4218ca,null));};exports[_0xaf3a('0x41')]=function(_0x50badb,_0x65167c){var _0x21ef29={'raw':!![],'where':{'id':_0x50badb[_0xaf3a('0x42')]['id']}},_0x16dd09={};_0x16dd09[_0xaf3a('0x2f')]=_[_0xaf3a('0x2b')](db[_0xaf3a('0x27')][_0xaf3a('0x43')]);_0x16dd09[_0xaf3a('0x2c')]=_[_0xaf3a('0x2b')](_0x50badb[_0xaf3a('0x2c')]);_0x16dd09[_0xaf3a('0x2d')]=_[_0xaf3a('0x2e')](_0x16dd09[_0xaf3a('0x2f')],_0x16dd09[_0xaf3a('0x2c')]);_0x21ef29[_0xaf3a('0x30')]=_['intersection'](_0x16dd09[_0xaf3a('0x2f')],qs['fields'](_0x50badb[_0xaf3a('0x2c')][_0xaf3a('0x31')]));_0x21ef29['attributes']=_0x21ef29[_0xaf3a('0x30')][_0xaf3a('0x44')]?_0x21ef29[_0xaf3a('0x30')]:_0x16dd09[_0xaf3a('0x2f')];if(_0x50badb['query'][_0xaf3a('0x3d')]){_0x21ef29[_0xaf3a('0x3e')]=[{'all':!![]}];}_0x21ef29=_['merge']({},_0x21ef29,_0x50badb[_0xaf3a('0x3c')]);return db[_0xaf3a('0x27')]['find'](_0x21ef29)[_0xaf3a('0x1d')](handleEntityNotFound(_0x65167c,null))[_0xaf3a('0x1d')](respondWithResult(_0x65167c,null))['catch'](handleError(_0x65167c,null));};exports[_0xaf3a('0x45')]=function(_0x4b11c5,_0x2b54ab){return db[_0xaf3a('0x27')][_0xaf3a('0x45')](_0x4b11c5[_0xaf3a('0x46')],{})[_0xaf3a('0x1d')](function(_0x5ab7f2){var _0x11558c=_0x4b11c5[_0xaf3a('0x47')][_0xaf3a('0x48')]({'plain':!![]});if(!_0x11558c)throw new Error(_0xaf3a('0x49'));if(_0x11558c['role']===_0xaf3a('0x47')){var _0x12605a=_0x5ab7f2[_0xaf3a('0x48')]({'plain':!![]});var _0x4d447d='UserWhatsappInteractions';return db['UserProfileSection'][_0xaf3a('0x4a')]({'where':{'name':_0x4d447d,'userProfileId':_0x11558c[_0xaf3a('0x4b')]},'raw':!![]})[_0xaf3a('0x1d')](function(_0xb9b737){if(_0xb9b737&&_0xb9b737[_0xaf3a('0x4c')]===0x0){return db[_0xaf3a('0x20')][_0xaf3a('0x45')]({'name':_0x12605a['name'],'resourceId':_0x12605a['id'],'type':_0xb9b737[_0xaf3a('0x24')],'sectionId':_0xb9b737['id']},{})['then'](function(){return _0x5ab7f2;});}else{return _0x5ab7f2;}})['catch'](function(_0x10403f){logger[_0xaf3a('0x22')](_0xaf3a('0x4d'),_0x10403f);throw _0x10403f;});}return _0x5ab7f2;})[_0xaf3a('0x1d')](respondWithResult(_0x2b54ab,0xc9))[_0xaf3a('0x40')](handleError(_0x2b54ab,null));};exports['update']=function(_0x4e5998,_0x207876){if(_0x4e5998[_0xaf3a('0x46')]['id']){delete _0x4e5998[_0xaf3a('0x46')]['id'];}return db[_0xaf3a('0x27')][_0xaf3a('0x4a')]({'where':{'id':_0x4e5998[_0xaf3a('0x42')]['id']}})[_0xaf3a('0x1d')](handleEntityNotFound(_0x207876,null))[_0xaf3a('0x1d')](saveUpdates(_0x4e5998[_0xaf3a('0x46')],null))[_0xaf3a('0x1d')](respondWithResult(_0x207876,null))[_0xaf3a('0x40')](handleError(_0x207876,null));};exports[_0xaf3a('0x1e')]=function(_0x1e4dd1,_0x56aad5){return db[_0xaf3a('0x27')]['find']({'where':{'id':_0x1e4dd1[_0xaf3a('0x42')]['id']}})[_0xaf3a('0x1d')](handleEntityNotFound(_0x56aad5,null))[_0xaf3a('0x1d')](removeEntity(_0x56aad5,null))[_0xaf3a('0x40')](handleError(_0x56aad5,null));}; \ No newline at end of file +var _0xd668=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','end','sendStatus','stack','name','send','index','map','UserWhatsappInteraction','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource'];(function(_0xcc150d,_0x5aa9e2){var _0x2bdf09=function(_0x575c1e){while(--_0x575c1e){_0xcc150d['push'](_0xcc150d['shift']());}};_0x2bdf09(++_0x5aa9e2);}(_0xd668,0x1f4));var _0x8d66=function(_0x10eb40,_0x3f5002){_0x10eb40=_0x10eb40-0x0;var _0x36e2d1=_0xd668[_0x10eb40];return _0x36e2d1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8d66('0x0'));var rimraf=require(_0x8d66('0x1'));var zipdir=require(_0x8d66('0x2'));var jsonpatch=require(_0x8d66('0x3'));var rp=require(_0x8d66('0x4'));var moment=require('moment');var BPromise=require(_0x8d66('0x5'));var Mustache=require(_0x8d66('0x6'));var util=require(_0x8d66('0x7'));var path=require(_0x8d66('0x8'));var sox=require(_0x8d66('0x9'));var csv=require(_0x8d66('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8d66('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8d66('0xc'));var deskjs=require(_0x8d66('0xd'));var toCsv=require(_0x8d66('0xa'));var querystring=require(_0x8d66('0xe'));var Papa=require('papaparse');var Redis=require(_0x8d66('0xf'));var authService=require(_0x8d66('0x10'));var qs=require(_0x8d66('0x11'));var as=require(_0x8d66('0x12'));var hardwareService=require(_0x8d66('0x13'));var logger=require('../../config/logger')(_0x8d66('0x14'));var utils=require(_0x8d66('0x15'));var config=require(_0x8d66('0x16'));var licenseUtil=require(_0x8d66('0x17'));var db=require(_0x8d66('0x18'))['db'];function respondWithStatusCode(_0x4ea413,_0x6fcede){_0x6fcede=_0x6fcede||0xcc;return function(_0x42f4c1){if(_0x42f4c1){return _0x4ea413['sendStatus'](_0x6fcede);}return _0x4ea413[_0x8d66('0x19')](_0x6fcede)['end']();};}function respondWithResult(_0x4b6e91,_0x33cdcf){_0x33cdcf=_0x33cdcf||0xc8;return function(_0xf6f28b){if(_0xf6f28b){return _0x4b6e91['status'](_0x33cdcf)[_0x8d66('0x1a')](_0xf6f28b);}};}function respondWithFilteredResult(_0x4965c4,_0x50f784){return function(_0x252bd2){if(_0x252bd2){var _0x561f88=_0x252bd2[_0x8d66('0x1b')],_0x5f566d=_0x50f784[_0x8d66('0x1c')],_0x165acb=_0x50f784[_0x8d66('0x1c')]+_0x50f784[_0x8d66('0x1d')],_0xea5c13;if(_0x165acb>=_0x561f88){_0x165acb=_0x561f88;_0xea5c13=0xc8;}else{_0xea5c13=0xce;}_0x4965c4[_0x8d66('0x19')](_0xea5c13);return _0x4965c4['set'](_0x8d66('0x1e'),_0x5f566d+'-'+_0x165acb+'/'+_0x561f88)[_0x8d66('0x1a')](_0x252bd2);}return null;};}function patchUpdates(_0x3dccae){return function(_0x16ebbe){try{jsonpatch[_0x8d66('0x1f')](_0x16ebbe,_0x3dccae,!![]);}catch(_0x1ac9cb){return BPromise[_0x8d66('0x20')](_0x1ac9cb);}return _0x16ebbe[_0x8d66('0x21')]();};}function saveUpdates(_0x6b75a4,_0x42ed62){return function(_0x3eba68){if(_0x3eba68){return _0x3eba68[_0x8d66('0x22')](_0x6b75a4)[_0x8d66('0x23')](function(_0x5d5d57){return _0x5d5d57;});}return null;};}function removeEntity(_0x14460c,_0x11c6c7){return function(_0x50ff8d){if(_0x50ff8d){return _0x50ff8d[_0x8d66('0x24')]()[_0x8d66('0x23')](function(){var _0x58fe96=_0x50ff8d[_0x8d66('0x25')]({'plain':!![]});var _0x378245='UserWhatsappInteractions';return db['UserProfileResource']['destroy']({'where':{'type':_0x378245,'resourceId':_0x58fe96['id']}})[_0x8d66('0x23')](function(){return _0x50ff8d;});})[_0x8d66('0x23')](function(){_0x14460c[_0x8d66('0x19')](0xcc)[_0x8d66('0x26')]();});}};}function handleEntityNotFound(_0x5b5a55,_0x31f748){return function(_0x583d2b){if(!_0x583d2b){_0x5b5a55[_0x8d66('0x27')](0x194);}return _0x583d2b;};}function handleError(_0x4dcc55,_0x5e825c){_0x5e825c=_0x5e825c||0x1f4;return function(_0x4aa20d){logger['error'](_0x4aa20d[_0x8d66('0x28')]);if(_0x4aa20d[_0x8d66('0x29')]){delete _0x4aa20d['name'];}_0x4dcc55[_0x8d66('0x19')](_0x5e825c)[_0x8d66('0x2a')](_0x4aa20d);};}exports[_0x8d66('0x2b')]=function(_0x2ac018,_0x311a71){var _0x475f92={},_0x119832={},_0x44261e={'count':0x0,'rows':[]};var _0x56cd0d=_[_0x8d66('0x2c')](db[_0x8d66('0x2d')][_0x8d66('0x2e')],function(_0x399951){return{'name':_0x399951['fieldName'],'type':_0x399951[_0x8d66('0x2f')]['key']};});_0x119832[_0x8d66('0x30')]=_[_0x8d66('0x2c')](_0x56cd0d,_0x8d66('0x29'));_0x119832[_0x8d66('0x31')]=_[_0x8d66('0x32')](_0x2ac018['query']);_0x119832['filters']=_[_0x8d66('0x33')](_0x119832[_0x8d66('0x30')],_0x119832['query']);_0x475f92['attributes']=_[_0x8d66('0x33')](_0x119832[_0x8d66('0x30')],qs[_0x8d66('0x34')](_0x2ac018['query'][_0x8d66('0x34')]));_0x475f92[_0x8d66('0x35')]=_0x475f92[_0x8d66('0x35')][_0x8d66('0x36')]?_0x475f92[_0x8d66('0x35')]:_0x119832[_0x8d66('0x30')];if(!_0x2ac018['query'][_0x8d66('0x37')](_0x8d66('0x38'))){_0x475f92[_0x8d66('0x1d')]=qs[_0x8d66('0x1d')](_0x2ac018['query'][_0x8d66('0x1d')]);_0x475f92[_0x8d66('0x1c')]=qs[_0x8d66('0x1c')](_0x2ac018[_0x8d66('0x31')][_0x8d66('0x1c')]);}_0x475f92[_0x8d66('0x39')]=qs['sort'](_0x2ac018[_0x8d66('0x31')]['sort']);_0x475f92[_0x8d66('0x3a')]=qs['filters'](_[_0x8d66('0x3b')](_0x2ac018['query'],_0x119832['filters']),_0x56cd0d);if(_0x2ac018[_0x8d66('0x31')][_0x8d66('0x3c')]){_0x475f92[_0x8d66('0x3a')]=_[_0x8d66('0x3d')](_0x475f92[_0x8d66('0x3a')],{'$or':_[_0x8d66('0x2c')](_0x56cd0d,function(_0x13de82){if(_0x13de82['type']!==_0x8d66('0x3e')){var _0x2a79de={};_0x2a79de[_0x13de82[_0x8d66('0x29')]]={'$like':'%'+_0x2ac018[_0x8d66('0x31')]['filter']+'%'};return _0x2a79de;}})});}_0x475f92=_[_0x8d66('0x3d')]({},_0x475f92,_0x2ac018[_0x8d66('0x3f')]);var _0x3ecd72={'where':_0x475f92[_0x8d66('0x3a')]};return db[_0x8d66('0x2d')][_0x8d66('0x1b')](_0x3ecd72)[_0x8d66('0x23')](function(_0x84d520){_0x44261e['count']=_0x84d520;if(_0x2ac018[_0x8d66('0x31')][_0x8d66('0x40')]){_0x475f92[_0x8d66('0x41')]=[{'all':!![]}];}return db[_0x8d66('0x2d')][_0x8d66('0x42')](_0x475f92);})['then'](function(_0x5a5844){_0x44261e[_0x8d66('0x43')]=_0x5a5844;return _0x44261e;})[_0x8d66('0x23')](respondWithFilteredResult(_0x311a71,_0x475f92))[_0x8d66('0x44')](handleError(_0x311a71,null));};exports[_0x8d66('0x45')]=function(_0x3537f0,_0x2c3b2a){var _0x206baa={'raw':!![],'where':{'id':_0x3537f0[_0x8d66('0x46')]['id']}},_0xcb614b={};_0xcb614b['model']=_[_0x8d66('0x32')](db[_0x8d66('0x2d')]['rawAttributes']);_0xcb614b[_0x8d66('0x31')]=_[_0x8d66('0x32')](_0x3537f0[_0x8d66('0x31')]);_0xcb614b[_0x8d66('0x47')]=_[_0x8d66('0x33')](_0xcb614b[_0x8d66('0x30')],_0xcb614b[_0x8d66('0x31')]);_0x206baa[_0x8d66('0x35')]=_['intersection'](_0xcb614b[_0x8d66('0x30')],qs['fields'](_0x3537f0[_0x8d66('0x31')][_0x8d66('0x34')]));_0x206baa[_0x8d66('0x35')]=_0x206baa[_0x8d66('0x35')][_0x8d66('0x36')]?_0x206baa['attributes']:_0xcb614b[_0x8d66('0x30')];if(_0x3537f0[_0x8d66('0x31')]['includeAll']){_0x206baa[_0x8d66('0x41')]=[{'all':!![]}];}_0x206baa=_[_0x8d66('0x3d')]({},_0x206baa,_0x3537f0['options']);return db[_0x8d66('0x2d')][_0x8d66('0x48')](_0x206baa)['then'](handleEntityNotFound(_0x2c3b2a,null))[_0x8d66('0x23')](respondWithResult(_0x2c3b2a,null))['catch'](handleError(_0x2c3b2a,null));};exports[_0x8d66('0x49')]=function(_0x5639ca,_0x3728f7){return db['UserWhatsappInteraction'][_0x8d66('0x49')](_0x5639ca[_0x8d66('0x4a')],{})[_0x8d66('0x23')](function(_0x4f309a){var _0x45c330=_0x5639ca[_0x8d66('0x4b')][_0x8d66('0x25')]({'plain':!![]});if(!_0x45c330)throw new Error(_0x8d66('0x4c'));if(_0x45c330[_0x8d66('0x4d')]===_0x8d66('0x4b')){var _0x4c512d=_0x4f309a[_0x8d66('0x25')]({'plain':!![]});var _0x45cab7='UserWhatsappInteractions';return db['UserProfileSection'][_0x8d66('0x48')]({'where':{'name':_0x45cab7,'userProfileId':_0x45c330[_0x8d66('0x4e')]},'raw':!![]})[_0x8d66('0x23')](function(_0x4a27ee){if(_0x4a27ee&&_0x4a27ee[_0x8d66('0x4f')]===0x0){return db[_0x8d66('0x50')][_0x8d66('0x49')]({'name':_0x4c512d[_0x8d66('0x29')],'resourceId':_0x4c512d['id'],'type':_0x4a27ee[_0x8d66('0x29')],'sectionId':_0x4a27ee['id']},{})[_0x8d66('0x23')](function(){return _0x4f309a;});}else{return _0x4f309a;}})[_0x8d66('0x44')](function(_0x2076c5){logger[_0x8d66('0x51')](_0x8d66('0x52'),_0x2076c5);throw _0x2076c5;});}return _0x4f309a;})[_0x8d66('0x23')](respondWithResult(_0x3728f7,0xc9))[_0x8d66('0x44')](handleError(_0x3728f7,null));};exports['update']=function(_0x19338e,_0x544b96){if(_0x19338e[_0x8d66('0x4a')]['id']){delete _0x19338e[_0x8d66('0x4a')]['id'];}return db[_0x8d66('0x2d')][_0x8d66('0x48')]({'where':{'id':_0x19338e[_0x8d66('0x46')]['id']}})[_0x8d66('0x23')](handleEntityNotFound(_0x544b96,null))[_0x8d66('0x23')](saveUpdates(_0x19338e[_0x8d66('0x4a')],null))[_0x8d66('0x23')](respondWithResult(_0x544b96,null))[_0x8d66('0x44')](handleError(_0x544b96,null));};exports[_0x8d66('0x24')]=function(_0x49591d,_0x704ac9){return db[_0x8d66('0x2d')]['find']({'where':{'id':_0x49591d[_0x8d66('0x46')]['id']}})[_0x8d66('0x23')](handleEntityNotFound(_0x704ac9,null))[_0x8d66('0x23')](removeEntity(_0x704ac9,null))[_0x8d66('0x44')](handleError(_0x704ac9,null));}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js index 416e600..f7d1448 100644 --- a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js +++ b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7787=['rimraf','../../config/environment','./UserWhatsappInteraction.attributes','exports','define','UserWhatsappInteraction','user_has_whatsapp_interactions','lodash','../../config/logger','moment','bluebird'];(function(_0x280e5c,_0x1a6278){var _0x14ef0a=function(_0x1deafa){while(--_0x1deafa){_0x280e5c['push'](_0x280e5c['shift']());}};_0x14ef0a(++_0x1a6278);}(_0x7787,0xe3));var _0x7778=function(_0x2d16d5,_0xfbc0d8){_0x2d16d5=_0x2d16d5-0x0;var _0x5ad135=_0x7787[_0x2d16d5];return _0x5ad135;};'use strict';var _=require(_0x7778('0x0'));var util=require('util');var logger=require(_0x7778('0x1'))('api');var moment=require(_0x7778('0x2'));var BPromise=require(_0x7778('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7778('0x4'));var config=require(_0x7778('0x5'));var attributes=require(_0x7778('0x6'));module[_0x7778('0x7')]=function(_0x58daf4,_0xf47f03){return _0x58daf4[_0x7778('0x8')](_0x7778('0x9'),attributes,{'tableName':_0x7778('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c9c=['rimraf','../../config/environment','define','user_has_whatsapp_interactions','util','../../config/logger','api','moment','bluebird','path'];(function(_0x5edc2a,_0x213d51){var _0x1e075e=function(_0x3c9f99){while(--_0x3c9f99){_0x5edc2a['push'](_0x5edc2a['shift']());}};_0x1e075e(++_0x213d51);}(_0x5c9c,0x16c));var _0xc5c9=function(_0x126b54,_0x6d4fe){_0x126b54=_0x126b54-0x0;var _0x23bd55=_0x5c9c[_0x126b54];return _0x23bd55;};'use strict';var _=require('lodash');var util=require(_0xc5c9('0x0'));var logger=require(_0xc5c9('0x1'))(_0xc5c9('0x2'));var moment=require(_0xc5c9('0x3'));var BPromise=require(_0xc5c9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5c9('0x5'));var rimraf=require(_0xc5c9('0x6'));var config=require(_0xc5c9('0x7'));var attributes=require('./UserWhatsappInteraction.attributes');module['exports']=function(_0x3fbb75,_0x4249e3){return _0x3fbb75[_0xc5c9('0x8')]('UserWhatsappInteraction',attributes,{'tableName':_0xc5c9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.rpc.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.rpc.js index 10d1f97..6683a63 100644 --- a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.rpc.js +++ b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbbae=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','UserWhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x5837a4,_0x15c0f7){var _0x1feb62=function(_0x17d586){while(--_0x17d586){_0x5837a4['push'](_0x5837a4['shift']());}};_0x1feb62(++_0x15c0f7);}(_0xbbae,0xda));var _0xebba=function(_0xb301d4,_0x27ed18){_0xb301d4=_0xb301d4-0x0;var _0x3b5bde=_0xbbae[_0xb301d4];return _0x3b5bde;};'use strict';var _=require(_0xebba('0x0'));var util=require(_0xebba('0x1'));var moment=require(_0xebba('0x2'));var BPromise=require(_0xebba('0x3'));var rs=require(_0xebba('0x4'));var fs=require('fs');var Redis=require(_0xebba('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xebba('0x6'));var logger=require(_0xebba('0x7'))('rpc');var config=require(_0xebba('0x8'));var jayson=require(_0xebba('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3cf6d6,_0xa4b0eb,_0x319725){return new BPromise(function(_0x264a5f,_0x48fa49){return client[_0xebba('0xa')](_0x3cf6d6,_0x319725)[_0xebba('0xb')](function(_0x3c3588){logger[_0xebba('0xc')](_0xebba('0xd'),_0xa4b0eb,_0xebba('0xe'));logger[_0xebba('0xf')](_0xebba('0x10'),_0xa4b0eb,_0xebba('0xe'),JSON[_0xebba('0x11')](_0x3c3588));if(_0x3c3588[_0xebba('0x12')]){if(_0x3c3588[_0xebba('0x12')]['code']===0x1f4){logger[_0xebba('0x12')](_0xebba('0xd'),_0xa4b0eb,_0x3c3588[_0xebba('0x12')]['message']);return _0x48fa49(_0x3c3588[_0xebba('0x12')][_0xebba('0x13')]);}logger[_0xebba('0x12')](_0xebba('0xd'),_0xa4b0eb,_0x3c3588[_0xebba('0x12')][_0xebba('0x13')]);return _0x264a5f(_0x3c3588[_0xebba('0x12')][_0xebba('0x13')]);}else{logger['info'](_0xebba('0xd'),_0xa4b0eb,'request\x20sent');_0x264a5f(_0x3c3588[_0xebba('0x14')]['message']);}})[_0xebba('0x15')](function(_0x39118a){logger[_0xebba('0x12')](_0xebba('0xd'),_0xa4b0eb,_0x39118a);_0x48fa49(_0x39118a);});});} \ No newline at end of file +var _0x476b=['UserWhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappInteraction,\x20%s,\x20%s','debug'];(function(_0xc4b20b,_0x37bcfb){var _0x27aa03=function(_0x5d69ed){while(--_0x5d69ed){_0xc4b20b['push'](_0xc4b20b['shift']());}};_0x27aa03(++_0x37bcfb);}(_0x476b,0xd5));var _0xb476=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x476b[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0xb476('0x0'));var moment=require(_0xb476('0x1'));var BPromise=require('bluebird');var rs=require(_0xb476('0x2'));var fs=require('fs');var Redis=require(_0xb476('0x3'));var db=require(_0xb476('0x4'))['db'];var utils=require(_0xb476('0x5'));var logger=require(_0xb476('0x6'))(_0xb476('0x7'));var config=require(_0xb476('0x8'));var jayson=require(_0xb476('0x9'));var client=jayson[_0xb476('0xa')][_0xb476('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c2784,_0x170160,_0x2bd5c6){return new BPromise(function(_0x4961c4,_0x426b62){return client[_0xb476('0xc')](_0x3c2784,_0x2bd5c6)[_0xb476('0xd')](function(_0x4ca4a9){logger[_0xb476('0xe')](_0xb476('0xf'),_0x170160,'request\x20sent');logger[_0xb476('0x10')](_0xb476('0x11'),_0x170160,_0xb476('0x12'),JSON['stringify'](_0x4ca4a9));if(_0x4ca4a9['error']){if(_0x4ca4a9['error']['code']===0x1f4){logger[_0xb476('0x13')](_0xb476('0xf'),_0x170160,_0x4ca4a9[_0xb476('0x13')][_0xb476('0x14')]);return _0x426b62(_0x4ca4a9[_0xb476('0x13')][_0xb476('0x14')]);}logger[_0xb476('0x13')](_0xb476('0xf'),_0x170160,_0x4ca4a9[_0xb476('0x13')]['message']);return _0x4961c4(_0x4ca4a9[_0xb476('0x13')][_0xb476('0x14')]);}else{logger[_0xb476('0xe')](_0xb476('0xf'),_0x170160,_0xb476('0x12'));_0x4961c4(_0x4ca4a9[_0xb476('0x15')][_0xb476('0x14')]);}})[_0xb476('0x16')](function(_0x5db1c0){logger[_0xb476('0x13')]('UserWhatsappInteraction,\x20%s,\x20%s',_0x170160,_0x5db1c0);_0x426b62(_0x5db1c0);});});} \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/index.js b/server/api/UserWhatsappInteraction/index.js index 38ea1b4..4e583f7 100644 --- a/server/api/UserWhatsappInteraction/index.js +++ b/server/api/UserWhatsappInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1775=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserWhatsappInteraction.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0x1775,0x1db));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var auth=require(_0x5177('0x5'));var interaction=require(_0x5177('0x6'));var config=require(_0x5177('0x7'));var controller=require(_0x5177('0x8'));router[_0x5177('0x9')]('/',auth[_0x5177('0xa')](),controller[_0x5177('0xb')]);router[_0x5177('0x9')](_0x5177('0xc'),auth[_0x5177('0xa')](),controller[_0x5177('0xd')]);router[_0x5177('0xe')]('/',auth[_0x5177('0xa')](),controller[_0x5177('0xf')]);router[_0x5177('0x10')](_0x5177('0xc'),auth[_0x5177('0xa')](),controller['update']);router['delete'](_0x5177('0xc'),auth[_0x5177('0xa')](),controller[_0x5177('0x11')]);module[_0x5177('0x12')]=router; \ No newline at end of file +var _0x68b7=['update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','put'];(function(_0x240dfe,_0x23ce92){var _0x25b1e9=function(_0x2053e1){while(--_0x2053e1){_0x240dfe['push'](_0x240dfe['shift']());}};_0x25b1e9(++_0x23ce92);}(_0x68b7,0x8c));var _0x768b=function(_0x4b796f,_0x1d5532){_0x4b796f=_0x4b796f-0x0;var _0x206ef2=_0x68b7[_0x4b796f];return _0x206ef2;};'use strict';var multer=require(_0x768b('0x0'));var util=require('util');var path=require(_0x768b('0x1'));var timeout=require(_0x768b('0x2'));var express=require(_0x768b('0x3'));var router=express['Router']();var auth=require(_0x768b('0x4'));var interaction=require(_0x768b('0x5'));var config=require(_0x768b('0x6'));var controller=require('./UserWhatsappInteraction.controller');router[_0x768b('0x7')]('/',auth[_0x768b('0x8')](),controller[_0x768b('0x9')]);router[_0x768b('0x7')](_0x768b('0xa'),auth[_0x768b('0x8')](),controller[_0x768b('0xb')]);router['post']('/',auth[_0x768b('0x8')](),controller['create']);router[_0x768b('0xc')](_0x768b('0xa'),auth[_0x768b('0x8')](),controller[_0x768b('0xd')]);router[_0x768b('0xe')](_0x768b('0xa'),auth['isAuthenticated'](),controller[_0x768b('0xf')]);module[_0x768b('0x10')]=router; \ No newline at end of file diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index da5b6b1..d15750a 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 _0xc6db=['browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','motionbar[NULL,NULL,WinAppArguments]','sequelize','exports','VIRTUAL','STRING','contactManager','integration','motionbar','jscripty'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xc6db,0x157));var _0xbc6d=function(_0x1bf398,_0x46e49d){_0x1bf398=_0x1bf398-0x0;var _0x1a4a7b=_0xc6db[_0x1bf398];return _0x1a4a7b;};'use strict';var Sequelize=require(_0xbc6d('0x0'));module[_0xbc6d('0x1')]={'name':{'type':Sequelize[_0xbc6d('0x2')],'get':function(_0x130eef){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0xbc6d('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xbc6d('0x4'),_0xbc6d('0x5'),_0xbc6d('0x6'),_0xbc6d('0x7'),'urlForward',_0xbc6d('0x8'),'bot',_0xbc6d('0x9')]],'msg':_0xbc6d('0xa')}},'comment':_0xbc6d('0xa')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xbc6d('0xb')},'data2':{'type':Sequelize[_0xbc6d('0x3')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0xbc6d('0x3')](0x1000),'comment':_0xbc6d('0xc')},'data4':{'type':Sequelize[_0xbc6d('0x3')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0xbc6d('0x3')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xc4e3=['motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','VIRTUAL','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','STRING','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0xc4e3,0xd4));var _0x3c4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4e3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3c4e('0x0'));module['exports']={'name':{'type':Sequelize[_0x3c4e('0x1')],'get':function(_0x56f590){return this['getDataValue']('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x3c4e('0x2'),_0x3c4e('0x3'),_0x3c4e('0x4'),_0x3c4e('0x5'),_0x3c4e('0x6'),_0x3c4e('0x7'),_0x3c4e('0x8'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x3c4e('0x9')](0x1000),'comment':_0x3c4e('0xa')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x3c4e('0xb')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x3c4e('0xc')},'data4':{'type':Sequelize[_0x3c4e('0x9')](0x1000)},'data5':{'type':Sequelize[_0x3c4e('0x9')](0x1000)},'data6':{'type':Sequelize[_0x3c4e('0x9')]},'data7':{'type':Sequelize[_0x3c4e('0xd')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index c1435b1..706ca0e 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 _0x44ff=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','reject','save','then','end','error','stack','name','send','update','body','find','catch','destroy','params','eml-format','rimraf','zip-dir','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x39500f,_0x5875a6){var _0x58f7e5=function(_0x148538){while(--_0x148538){_0x39500f['push'](_0x39500f['shift']());}};_0x58f7e5(++_0x5875a6);}(_0x44ff,0x1c3));var _0xf44f=function(_0x194576,_0x543558){_0x194576=_0x194576-0x0;var _0x67603e=_0x44ff[_0x194576];return _0x67603e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf44f('0x0'));var rimraf=require(_0xf44f('0x1'));var zipdir=require(_0xf44f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf44f('0x3'));var util=require(_0xf44f('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xf44f('0x5'));var ejs=require(_0xf44f('0x6'));var fs=require('fs');var _=require(_0xf44f('0x7'));var squel=require('squel');var crypto=require(_0xf44f('0x8'));var jsforce=require(_0xf44f('0x9'));var deskjs=require(_0xf44f('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf44f('0xb'));var Papa=require(_0xf44f('0xc'));var Redis=require(_0xf44f('0xd'));var authService=require(_0xf44f('0xe'));var qs=require(_0xf44f('0xf'));var as=require(_0xf44f('0x10'));var hardwareService=require(_0xf44f('0x11'));var logger=require(_0xf44f('0x12'))(_0xf44f('0x13'));var utils=require(_0xf44f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf44f('0x15'));var db=require(_0xf44f('0x16'))['db'];function respondWithStatusCode(_0x23b73a,_0x34d3da){_0x34d3da=_0x34d3da||0xcc;return function(_0x10176f){if(_0x10176f){return _0x23b73a[_0xf44f('0x17')](_0x34d3da);}return _0x23b73a[_0xf44f('0x18')](_0x34d3da)['end']();};}function respondWithResult(_0x5d2b86,_0x17e828){_0x17e828=_0x17e828||0xc8;return function(_0x5f20aa){if(_0x5f20aa){return _0x5d2b86['status'](_0x17e828)['json'](_0x5f20aa);}};}function respondWithFilteredResult(_0x3aa2b8,_0x1d2d77){return function(_0x409907){if(_0x409907){var _0x1a5ce4=_0x409907[_0xf44f('0x19')],_0x52171b=_0x1d2d77[_0xf44f('0x1a')],_0x36d3c1=_0x1d2d77[_0xf44f('0x1a')]+_0x1d2d77[_0xf44f('0x1b')],_0x56b1ca;if(_0x36d3c1>=_0x1a5ce4){_0x36d3c1=_0x1a5ce4;_0x56b1ca=0xc8;}else{_0x56b1ca=0xce;}_0x3aa2b8['status'](_0x56b1ca);return _0x3aa2b8['set']('Content-Range',_0x52171b+'-'+_0x36d3c1+'/'+_0x1a5ce4)['json'](_0x409907);}return null;};}function patchUpdates(_0x397f94){return function(_0x4f0292){try{jsonpatch['apply'](_0x4f0292,_0x397f94,!![]);}catch(_0x395bfe){return BPromise[_0xf44f('0x1c')](_0x395bfe);}return _0x4f0292[_0xf44f('0x1d')]();};}function saveUpdates(_0x515ea6,_0x1c317e){return function(_0x11872b){if(_0x11872b){return _0x11872b['update'](_0x515ea6)[_0xf44f('0x1e')](function(_0x5c35f6){return _0x5c35f6;});}return null;};}function removeEntity(_0x1cc24e,_0x166acd){return function(_0x3e0b9c){if(_0x3e0b9c){return _0x3e0b9c['destroy']()[_0xf44f('0x1e')](function(){_0x1cc24e[_0xf44f('0x18')](0xcc)[_0xf44f('0x1f')]();});}};}function handleEntityNotFound(_0x58d4af,_0x1ba9c0){return function(_0x5687d1){if(!_0x5687d1){_0x58d4af[_0xf44f('0x17')](0x194);}return _0x5687d1;};}function handleError(_0x2c660f,_0x1c85cc){_0x1c85cc=_0x1c85cc||0x1f4;return function(_0x5313f5){logger[_0xf44f('0x20')](_0x5313f5[_0xf44f('0x21')]);if(_0x5313f5[_0xf44f('0x22')]){delete _0x5313f5[_0xf44f('0x22')];}_0x2c660f['status'](_0x1c85cc)[_0xf44f('0x23')](_0x5313f5);};}exports[_0xf44f('0x24')]=function(_0x36e7a9,_0x3ea717){if(_0x36e7a9[_0xf44f('0x25')]['id']){delete _0x36e7a9[_0xf44f('0x25')]['id'];}return db['Action'][_0xf44f('0x26')]({'where':{'id':_0x36e7a9['params']['id']}})[_0xf44f('0x1e')](handleEntityNotFound(_0x3ea717,null))[_0xf44f('0x1e')](saveUpdates(_0x36e7a9['body'],null))['then'](respondWithResult(_0x3ea717,null))[_0xf44f('0x27')](handleError(_0x3ea717,null));};exports[_0xf44f('0x28')]=function(_0x3aa3a7,_0xcd3334){return db['Action'][_0xf44f('0x26')]({'where':{'id':_0x3aa3a7[_0xf44f('0x29')]['id']}})['then'](handleEntityNotFound(_0xcd3334,null))[_0xf44f('0x1e')](removeEntity(_0xcd3334,null))[_0xf44f('0x27')](handleError(_0xcd3334,null));}; \ No newline at end of file +var _0xba18=['end','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','body','Action','find','params','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x498334,_0x27b6fe){var _0x13bb70=function(_0x4087b1){while(--_0x4087b1){_0x498334['push'](_0x498334['shift']());}};_0x13bb70(++_0x27b6fe);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x8ba1('0x0'));var emlformat=require(_0x8ba1('0x1'));var rimraf=require(_0x8ba1('0x2'));var zipdir=require(_0x8ba1('0x3'));var jsonpatch=require(_0x8ba1('0x4'));var rp=require(_0x8ba1('0x5'));var moment=require(_0x8ba1('0x6'));var BPromise=require(_0x8ba1('0x7'));var Mustache=require('mustache');var util=require(_0x8ba1('0x8'));var path=require(_0x8ba1('0x9'));var sox=require(_0x8ba1('0xa'));var csv=require(_0x8ba1('0xb'));var ejs=require(_0x8ba1('0xc'));var fs=require('fs');var _=require(_0x8ba1('0xd'));var squel=require('squel');var crypto=require(_0x8ba1('0xe'));var jsforce=require(_0x8ba1('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ba1('0x10'));var Redis=require(_0x8ba1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8ba1('0x12'));var as=require(_0x8ba1('0x13'));var hardwareService=require(_0x8ba1('0x14'));var logger=require(_0x8ba1('0x15'))(_0x8ba1('0x16'));var utils=require('../../config/utils');var config=require(_0x8ba1('0x17'));var licenseUtil=require(_0x8ba1('0x18'));var db=require(_0x8ba1('0x19'))['db'];function respondWithStatusCode(_0x1fcfd7,_0x29adbb){_0x29adbb=_0x29adbb||0xcc;return function(_0x229748){if(_0x229748){return _0x1fcfd7['sendStatus'](_0x29adbb);}return _0x1fcfd7[_0x8ba1('0x1a')](_0x29adbb)[_0x8ba1('0x1b')]();};}function respondWithResult(_0x2e81d1,_0xca53c4){_0xca53c4=_0xca53c4||0xc8;return function(_0x4c8d5c){if(_0x4c8d5c){return _0x2e81d1['status'](_0xca53c4)['json'](_0x4c8d5c);}};}function respondWithFilteredResult(_0x3058ac,_0x398f40){return function(_0x5a3a8a){if(_0x5a3a8a){var _0x1b885b=_0x5a3a8a[_0x8ba1('0x1c')],_0xc72b8d=_0x398f40[_0x8ba1('0x1d')],_0x3880aa=_0x398f40[_0x8ba1('0x1d')]+_0x398f40['limit'],_0x107846;if(_0x3880aa>=_0x1b885b){_0x3880aa=_0x1b885b;_0x107846=0xc8;}else{_0x107846=0xce;}_0x3058ac['status'](_0x107846);return _0x3058ac[_0x8ba1('0x1e')](_0x8ba1('0x1f'),_0xc72b8d+'-'+_0x3880aa+'/'+_0x1b885b)['json'](_0x5a3a8a);}return null;};}function patchUpdates(_0xd8bda0){return function(_0x2e5fba){try{jsonpatch[_0x8ba1('0x20')](_0x2e5fba,_0xd8bda0,!![]);}catch(_0x3355c8){return BPromise[_0x8ba1('0x21')](_0x3355c8);}return _0x2e5fba[_0x8ba1('0x22')]();};}function saveUpdates(_0x5ddcf8,_0x489662){return function(_0x5b09f7){if(_0x5b09f7){return _0x5b09f7[_0x8ba1('0x23')](_0x5ddcf8)[_0x8ba1('0x24')](function(_0x121cc4){return _0x121cc4;});}return null;};}function removeEntity(_0x3dd1d8,_0x4e66e1){return function(_0x1d619c){if(_0x1d619c){return _0x1d619c[_0x8ba1('0x25')]()[_0x8ba1('0x24')](function(){_0x3dd1d8[_0x8ba1('0x1a')](0xcc)[_0x8ba1('0x1b')]();});}};}function handleEntityNotFound(_0x3b70ea,_0x845108){return function(_0x1c51ef){if(!_0x1c51ef){_0x3b70ea[_0x8ba1('0x26')](0x194);}return _0x1c51ef;};}function handleError(_0x31a38c,_0x3b205c){_0x3b205c=_0x3b205c||0x1f4;return function(_0x550d33){logger['error'](_0x550d33[_0x8ba1('0x27')]);if(_0x550d33[_0x8ba1('0x28')]){delete _0x550d33['name'];}_0x31a38c[_0x8ba1('0x1a')](_0x3b205c)[_0x8ba1('0x29')](_0x550d33);};}exports[_0x8ba1('0x23')]=function(_0x326460,_0x15e419){if(_0x326460[_0x8ba1('0x2a')]['id']){delete _0x326460[_0x8ba1('0x2a')]['id'];}return db[_0x8ba1('0x2b')][_0x8ba1('0x2c')]({'where':{'id':_0x326460[_0x8ba1('0x2d')]['id']}})[_0x8ba1('0x24')](handleEntityNotFound(_0x15e419,null))[_0x8ba1('0x24')](saveUpdates(_0x326460[_0x8ba1('0x2a')],null))[_0x8ba1('0x24')](respondWithResult(_0x15e419,null))['catch'](handleError(_0x15e419,null));};exports[_0x8ba1('0x25')]=function(_0x353678,_0x22059f){return db[_0x8ba1('0x2b')][_0x8ba1('0x2c')]({'where':{'id':_0x353678[_0x8ba1('0x2d')]['id']}})['then'](handleEntityNotFound(_0x22059f,null))[_0x8ba1('0x24')](removeEntity(_0x22059f,null))[_0x8ba1('0x2e')](handleError(_0x22059f,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index fc528f5..85aa21c 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 _0x302c=['define','Action','tools_actions','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x302c,0x9f));var _0xc302=function(_0x678121,_0x38e8c4){_0x678121=_0x678121-0x0;var _0x167a1a=_0x302c[_0x678121];return _0x167a1a;};'use strict';var _=require(_0xc302('0x0'));var util=require(_0xc302('0x1'));var logger=require(_0xc302('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc302('0x3'));var rp=require(_0xc302('0x4'));var fs=require('fs');var path=require(_0xc302('0x5'));var rimraf=require(_0xc302('0x6'));var config=require(_0xc302('0x7'));var attributes=require('./action.attributes');module[_0xc302('0x8')]=function(_0x4ee975,_0x42db48){return _0x4ee975[_0xc302('0x9')](_0xc302('0xa'),attributes,{'tableName':_0xc302('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bf8=['request-promise','rimraf','../../config/environment','./action.attributes','exports','Action','tools_actions','../../config/logger','api','moment'];(function(_0x22789a,_0x4a1c8c){var _0xede88=function(_0x49243f){while(--_0x49243f){_0x22789a['push'](_0x22789a['shift']());}};_0xede88(++_0x4a1c8c);}(_0x9bf8,0xc5));var _0x89bf=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9bf8[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x89bf('0x0'))(_0x89bf('0x1'));var moment=require(_0x89bf('0x2'));var BPromise=require('bluebird');var rp=require(_0x89bf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x89bf('0x4'));var config=require(_0x89bf('0x5'));var attributes=require(_0x89bf('0x6'));module[_0x89bf('0x7')]=function(_0x3c901f,_0x49cf92){return _0x3c901f['define'](_0x89bf('0x8'),attributes,{'tableName':_0x89bf('0x9'),'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 9577e14..6594153 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 _0xe706=['http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1685cb,_0x3cee7b){var _0x36a942=function(_0x11ab78){while(--_0x11ab78){_0x1685cb['push'](_0x1685cb['shift']());}};_0x36a942(++_0x3cee7b);}(_0xe706,0xa3));var _0x6e70=function(_0x2c00b3,_0x29b200){_0x2c00b3=_0x2c00b3-0x0;var _0x595512=_0xe706[_0x2c00b3];return _0x595512;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('Action,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('Action,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xbaf0=['client','http','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xd8aad0,_0x4da2cd){var _0x570860=function(_0x1acc03){while(--_0x1acc03){_0xd8aad0['push'](_0xd8aad0['shift']());}};_0x570860(++_0x4da2cd);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('Action,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index cb08c1e..e84fd14 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 _0x91d6=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','put','/:id','isAuthenticated','update','destroy','exports'];(function(_0x37dc7a,_0x199072){var _0x3e33c5=function(_0x98a664){while(--_0x98a664){_0x37dc7a['push'](_0x37dc7a['shift']());}};_0x3e33c5(++_0x199072);}(_0x91d6,0x11e));var _0x691d=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x91d6[_0x187ee1];return _0x388160;};'use strict';var multer=require('multer');var util=require(_0x691d('0x0'));var path=require(_0x691d('0x1'));var timeout=require(_0x691d('0x2'));var express=require(_0x691d('0x3'));var router=express[_0x691d('0x4')]();var auth=require(_0x691d('0x5'));var interaction=require(_0x691d('0x6'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0x691d('0x7')](_0x691d('0x8'),auth[_0x691d('0x9')](),controller[_0x691d('0xa')]);router['delete'](_0x691d('0x8'),auth[_0x691d('0x9')](),controller[_0x691d('0xb')]);module[_0x691d('0xc')]=router; \ No newline at end of file +var _0x543d=['./action.controller','put','/:id','isAuthenticated','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x4974f4,_0x35cf85){var _0x23d9cc=function(_0x48afb5){while(--_0x48afb5){_0x4974f4['push'](_0x4974f4['shift']());}};_0x23d9cc(++_0x35cf85);}(_0x543d,0x7b));var _0xd543=function(_0x18847a,_0xd6898e){_0x18847a=_0x18847a-0x0;var _0x5b68ca=_0x543d[_0x18847a];return _0x5b68ca;};'use strict';var multer=require('multer');var util=require(_0xd543('0x0'));var path=require(_0xd543('0x1'));var timeout=require(_0xd543('0x2'));var express=require(_0xd543('0x3'));var router=express[_0xd543('0x4')]();var auth=require(_0xd543('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd543('0x6'));var controller=require(_0xd543('0x7'));router[_0xd543('0x8')](_0xd543('0x9'),auth[_0xd543('0xa')](),controller[_0xd543('0xb')]);router[_0xd543('0xc')](_0xd543('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index b0cf593..132e5aa 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 _0x42eb=['STRING','TEXT'];(function(_0x1c46c5,_0x41bc70){var _0x4e403c=function(_0x8cf318){while(--_0x8cf318){_0x1c46c5['push'](_0x1c46c5['shift']());}};_0x4e403c(++_0x41bc70);}(_0x42eb,0x158));var _0xb42e=function(_0x3a4f18,_0x1af741){_0x3a4f18=_0x3a4f18-0x0;var _0x4c20fc=_0x42eb[_0x3a4f18];return _0x4c20fc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb42e('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xb42e('0x0')]},'parent':{'type':Sequelize[_0xb42e('0x0')]},'table':{'type':Sequelize[_0xb42e('0x0')]},'conditions':{'type':Sequelize[_0xb42e('0x1')]},'joins':{'type':Sequelize[_0xb42e('0x1')]}}; \ No newline at end of file +var _0xcc84=['STRING','TEXT','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xcc84,0x19d));var _0x4cc8=function(_0x5df7e6,_0x12d771){_0x5df7e6=_0x5df7e6-0x0;var _0xfaba1b=_0xcc84[_0x5df7e6];return _0xfaba1b;};'use strict';var Sequelize=require('sequelize');module[_0x4cc8('0x0')]={'name':{'type':Sequelize[_0x4cc8('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4cc8('0x1')]},'parent':{'type':Sequelize[_0x4cc8('0x1')]},'table':{'type':Sequelize[_0x4cc8('0x1')]},'conditions':{'type':Sequelize[_0x4cc8('0x2')]},'joins':{'type':Sequelize[_0x4cc8('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index ba89d8b..322d16b 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 _0x6901=['Reports','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','preview','join','right_join','cross_join','COUNT(%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)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','findAll','keyBy','select','from','MetricId','function','replace','format','groupBy','orderBy','DESC','joins','parse','includes','parentKey','foreignTable','foreignKey','table','conditions','clone','debug','sequelize','toString','QueryTypes','SELECT','left_join','SUM(%s)','MAX(%s)','HOUR(%s)','IS\x20NULL','IS\x20EMPTY','operator','getFields','Please\x20insert\x20at\x20least\x20one\x20field','metric','order','alias','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','COUNT(DISTINCT\x20%s)','html-pdf','rimraf','zip-dir','moment','bluebird','path','ejs','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','dbH','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','AnalyticCustomReport','includeAll','include','rows','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x6901,0x100));var _0x1690=function(_0x4a292d,_0xf5c650){_0x4a292d=_0x4a292d-0x0;var _0x2cc7d1=_0x6901[_0x4a292d];return _0x2cc7d1;};'use strict';var pdf=require(_0x1690('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1690('0x1'));var zipdir=require(_0x1690('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1690('0x3'));var BPromise=require(_0x1690('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1690('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1690('0x6'));var fs=require('fs');var _=require(_0x1690('0x7'));var squel=require(_0x1690('0x8'));var crypto=require(_0x1690('0x9'));var jsforce=require(_0x1690('0xa'));var deskjs=require(_0x1690('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1690('0xc'));var Papa=require(_0x1690('0xd'));var Redis=require(_0x1690('0xe'));var authService=require(_0x1690('0xf'));var qs=require(_0x1690('0x10'));var as=require(_0x1690('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1690('0x12'))(_0x1690('0x13'));var utils=require('../../config/utils');var config=require(_0x1690('0x14'));var licenseUtil=require(_0x1690('0x15'));var db=require(_0x1690('0x16'))['db'];var dbH=require(_0x1690('0x16'))[_0x1690('0x17')];function respondWithStatusCode(_0x158757,_0x32628a){_0x32628a=_0x32628a||0xcc;return function(_0x4686c1){if(_0x4686c1){return _0x158757[_0x1690('0x18')](_0x32628a);}return _0x158757[_0x1690('0x19')](_0x32628a)['end']();};}function respondWithResult(_0x2adcb3,_0x2d4e75){_0x2d4e75=_0x2d4e75||0xc8;return function(_0x11e9bf){if(_0x11e9bf){return _0x2adcb3['status'](_0x2d4e75)['json'](_0x11e9bf);}};}function respondWithFilteredResult(_0x2d5617,_0x575010){return function(_0x1e2061){if(_0x1e2061){var _0x5295b6=_0x1e2061[_0x1690('0x1a')],_0x4f0417=_0x575010[_0x1690('0x1b')],_0x279032=_0x575010['offset']+_0x575010[_0x1690('0x1c')],_0x55bb34;if(_0x279032>=_0x5295b6){_0x279032=_0x5295b6;_0x55bb34=0xc8;}else{_0x55bb34=0xce;}_0x2d5617[_0x1690('0x19')](_0x55bb34);return _0x2d5617[_0x1690('0x1d')](_0x1690('0x1e'),_0x4f0417+'-'+_0x279032+'/'+_0x5295b6)['json'](_0x1e2061);}return null;};}function patchUpdates(_0xcd6b2e){return function(_0x4d2fb9){try{jsonpatch[_0x1690('0x1f')](_0x4d2fb9,_0xcd6b2e,!![]);}catch(_0x2be44b){return BPromise[_0x1690('0x20')](_0x2be44b);}return _0x4d2fb9[_0x1690('0x21')]();};}function saveUpdates(_0xc5b007,_0x8f5ceb){return function(_0x3a6189){if(_0x3a6189){return _0x3a6189[_0x1690('0x22')](_0xc5b007)[_0x1690('0x23')](function(_0xa7d053){return _0xa7d053;});}return null;};}function removeEntity(_0x74cb9,_0x44986d){return function(_0xb7276e){if(_0xb7276e){return _0xb7276e[_0x1690('0x24')]()[_0x1690('0x23')](function(){var _0x4033c1=_0xb7276e[_0x1690('0x25')]({'plain':!![]});var _0x1b7fc1='CustomReports';return db[_0x1690('0x26')][_0x1690('0x24')]({'where':{'type':_0x1b7fc1,'resourceId':_0x4033c1['id']}})['then'](function(){return _0xb7276e;});})[_0x1690('0x23')](function(){_0x74cb9[_0x1690('0x19')](0xcc)[_0x1690('0x27')]();});}};}function handleEntityNotFound(_0x136567,_0x5afcbb){return function(_0x30755f){if(!_0x30755f){_0x136567[_0x1690('0x18')](0x194);}return _0x30755f;};}function handleError(_0x32dd95,_0x1d7ae2){_0x1d7ae2=_0x1d7ae2||0x1f4;return function(_0x214679){logger[_0x1690('0x28')](_0x214679['stack']);if(_0x214679['name']){delete _0x214679[_0x1690('0x29')];}_0x32dd95['status'](_0x1d7ae2)['send'](_0x214679);};}exports['index']=function(_0x197f60,_0x40ee73){var _0x308e72={},_0x3ba9be={},_0x2bd32e={'count':0x0,'rows':[]};var _0x3022f7=_[_0x1690('0x2a')](db['AnalyticCustomReport'][_0x1690('0x2b')],function(_0x45cddb){return{'name':_0x45cddb[_0x1690('0x2c')],'type':_0x45cddb[_0x1690('0x2d')][_0x1690('0x2e')]};});_0x3ba9be[_0x1690('0x2f')]=_[_0x1690('0x2a')](_0x3022f7,'name');_0x3ba9be[_0x1690('0x30')]=_[_0x1690('0x31')](_0x197f60['query']);_0x3ba9be[_0x1690('0x32')]=_[_0x1690('0x33')](_0x3ba9be[_0x1690('0x2f')],_0x3ba9be[_0x1690('0x30')]);_0x308e72[_0x1690('0x34')]=_[_0x1690('0x33')](_0x3ba9be[_0x1690('0x2f')],qs[_0x1690('0x35')](_0x197f60['query'][_0x1690('0x35')]));_0x308e72[_0x1690('0x34')]=_0x308e72[_0x1690('0x34')][_0x1690('0x36')]?_0x308e72['attributes']:_0x3ba9be['model'];if(!_0x197f60[_0x1690('0x30')][_0x1690('0x37')](_0x1690('0x38'))){_0x308e72[_0x1690('0x1c')]=qs[_0x1690('0x1c')](_0x197f60[_0x1690('0x30')]['limit']);_0x308e72[_0x1690('0x1b')]=qs[_0x1690('0x1b')](_0x197f60['query'][_0x1690('0x1b')]);}_0x308e72['order']=qs['sort'](_0x197f60[_0x1690('0x30')][_0x1690('0x39')]);_0x308e72['where']=qs['filters'](_[_0x1690('0x3a')](_0x197f60[_0x1690('0x30')],_0x3ba9be[_0x1690('0x32')]),_0x3022f7);if(_0x197f60[_0x1690('0x30')][_0x1690('0x3b')]){_0x308e72[_0x1690('0x3c')]=_[_0x1690('0x3d')](_0x308e72[_0x1690('0x3c')],{'$or':_['map'](_0x3022f7,function(_0x3d2104){if(_0x3d2104['type']!==_0x1690('0x3e')){var _0x30170c={};_0x30170c[_0x3d2104[_0x1690('0x29')]]={'$like':'%'+_0x197f60['query'][_0x1690('0x3b')]+'%'};return _0x30170c;}})});}_0x308e72=_[_0x1690('0x3d')]({},_0x308e72,_0x197f60[_0x1690('0x3f')]);var _0x4d1568={'where':_0x308e72[_0x1690('0x3c')]};return db[_0x1690('0x40')][_0x1690('0x1a')](_0x4d1568)[_0x1690('0x23')](function(_0x491bc9){_0x2bd32e['count']=_0x491bc9;if(_0x197f60[_0x1690('0x30')][_0x1690('0x41')]){_0x308e72[_0x1690('0x42')]=[{'all':!![]}];}return db[_0x1690('0x40')]['findAll'](_0x308e72);})[_0x1690('0x23')](function(_0x2e911b){_0x2bd32e[_0x1690('0x43')]=_0x2e911b;return _0x2bd32e;})[_0x1690('0x23')](respondWithFilteredResult(_0x40ee73,_0x308e72))['catch'](handleError(_0x40ee73,null));};exports['show']=function(_0x5f376e,_0x44eeed){var _0x3d5b5d={'raw':![],'where':{'id':_0x5f376e['params']['id']}},_0x415bd0={};_0x415bd0[_0x1690('0x2f')]=_[_0x1690('0x31')](db['AnalyticCustomReport'][_0x1690('0x2b')]);_0x415bd0[_0x1690('0x30')]=_['keys'](_0x5f376e[_0x1690('0x30')]);_0x415bd0['filters']=_[_0x1690('0x33')](_0x415bd0[_0x1690('0x2f')],_0x415bd0[_0x1690('0x30')]);_0x3d5b5d[_0x1690('0x34')]=_[_0x1690('0x33')](_0x415bd0[_0x1690('0x2f')],qs[_0x1690('0x35')](_0x5f376e[_0x1690('0x30')][_0x1690('0x35')]));_0x3d5b5d[_0x1690('0x34')]=_0x3d5b5d[_0x1690('0x34')][_0x1690('0x36')]?_0x3d5b5d[_0x1690('0x34')]:_0x415bd0[_0x1690('0x2f')];if(_0x5f376e['query']['includeAll']){_0x3d5b5d[_0x1690('0x42')]=[{'all':!![]}];}_0x3d5b5d=_['merge']({},_0x3d5b5d,_0x5f376e[_0x1690('0x3f')]);return db[_0x1690('0x40')][_0x1690('0x44')](_0x3d5b5d)[_0x1690('0x23')](handleEntityNotFound(_0x44eeed,null))['then'](respondWithResult(_0x44eeed,null))[_0x1690('0x45')](handleError(_0x44eeed,null));};exports[_0x1690('0x46')]=function(_0x4ec89,_0x55eb4e){return db['AnalyticCustomReport'][_0x1690('0x46')](_0x4ec89['body'],{})[_0x1690('0x23')](function(_0x4b4314){var _0x507cd3=_0x4ec89[_0x1690('0x47')]['get']({'plain':!![]});if(!_0x507cd3)throw new Error(_0x1690('0x48'));if(_0x507cd3[_0x1690('0x49')]===_0x1690('0x47')){var _0x219b7c=_0x4b4314[_0x1690('0x25')]({'plain':!![]});var _0x3d4d95=_0x1690('0x4a');return db[_0x1690('0x4b')]['find']({'where':{'name':_0x3d4d95,'userProfileId':_0x507cd3['userProfileId']},'raw':!![]})[_0x1690('0x23')](function(_0x5a3fa8){if(_0x5a3fa8&&_0x5a3fa8['autoAssociation']===0x0){return db[_0x1690('0x26')][_0x1690('0x46')]({'name':_0x219b7c[_0x1690('0x29')],'resourceId':_0x219b7c['id'],'type':'CustomReports','sectionId':_0x5a3fa8['id']},{})['then'](function(){return _0x4b4314;});}else{return _0x4b4314;}})['catch'](function(_0x86486){logger['error'](_0x1690('0x4c'),_0x86486);throw _0x86486;});}return _0x4b4314;})[_0x1690('0x23')](respondWithResult(_0x55eb4e,0xc9))[_0x1690('0x45')](handleError(_0x55eb4e,null));};exports[_0x1690('0x22')]=function(_0x20a97e,_0x49314a){if(_0x20a97e[_0x1690('0x4d')]['id']){delete _0x20a97e[_0x1690('0x4d')]['id'];}return db[_0x1690('0x40')][_0x1690('0x44')]({'where':{'id':_0x20a97e[_0x1690('0x4e')]['id']}})[_0x1690('0x23')](handleEntityNotFound(_0x49314a,null))[_0x1690('0x23')](saveUpdates(_0x20a97e['body'],null))['then'](respondWithResult(_0x49314a,null))['catch'](handleError(_0x49314a,null));};exports[_0x1690('0x24')]=function(_0x36eb47,_0x4b6ee0){return db['AnalyticCustomReport'][_0x1690('0x44')]({'where':{'id':_0x36eb47['params']['id']}})[_0x1690('0x23')](handleEntityNotFound(_0x4b6ee0,null))[_0x1690('0x23')](removeEntity(_0x4b6ee0,null))['catch'](handleError(_0x4b6ee0,null));};exports[_0x1690('0x4f')]=function(_0x138ada,_0x57fb7a){var _0xeae410=0xa;var _0xe950a7=[_0x1690('0x50'),'left_join',_0x1690('0x51'),_0x1690('0x52')];var _0x1564e7={'SUM':'SUM(%s)','COUNT':_0x1690('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x1690('0x54'),'AVG':_0x1690('0x55'),'GROUP_CONCAT':_0x1690('0x56'),'GROUP_CONCAT ASC':_0x1690('0x57'),'GROUP_CONCAT DESC':_0x1690('0x58')};var _0xba54ca={'SEC_TO_TIME':_0x1690('0x59'),'DATE':_0x1690('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x1690('0x5b'),'UNIX_TIMESTAMP':_0x1690('0x5c')};var _0x35b9ab=function(_0x174951){return!_['includes'](['IS\x20NULL',_0x1690('0x5d'),'IS\x20EMPTY',_0x1690('0x5e')],_0x174951);};var _0x2d23a8=function(_0x2afa21){if(!_0x2afa21||!_0x2afa21[_0x1690('0x5f')]['length']){return'';}for(var _0x45e4fc='(',_0x14d23e=0x0;_0x14d23e<_0x2afa21[_0x1690('0x5f')][_0x1690('0x36')];_0x14d23e+=0x1){_0x14d23e>0x0&&(_0x45e4fc+='\x20'+_0x2afa21['operator']+'\x20');_0x45e4fc+=_0x2afa21[_0x1690('0x5f')][_0x14d23e][_0x1690('0x60')]?_0x2d23a8(_0x2afa21['rules'][_0x14d23e][_0x1690('0x60')]):_0x2afa21[_0x1690('0x5f')][_0x14d23e][_0x1690('0x61')]+'\x20'+_0x2afa21['rules'][_0x14d23e][_0x1690('0x62')]+(_0x35b9ab(_0x2afa21[_0x1690('0x5f')][_0x14d23e][_0x1690('0x62')])?'\x20'+_0x2afa21['rules'][_0x14d23e][_0x1690('0x63')]:'');}return _0x45e4fc+')';};var _0x2f755={'where':{'id':_0x138ada[_0x1690('0x4e')]['id']}},_0x2f8d3a,_0x2ed18f,_0x42c14,_0x27b58b,_0x48ddbe;_0x2f755=_[_0x1690('0x3d')]({},_0x2f755,_0x138ada[_0x1690('0x3f')]);return db[_0x1690('0x40')][_0x1690('0x44')](_0x2f755)['then'](function(_0x3d7217){if(_0x3d7217){_0x2f8d3a=_0x3d7217;return _0x3d7217['getFields']();}return null;})['then'](function(_0x11f464){if(_0x11f464){if(!_0x11f464[_0x1690('0x36')]){throw new db[(_0x1690('0x64'))][(_0x1690('0x65'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2ed18f=_0x11f464;return db[_0x1690('0x66')][_0x1690('0x67')]({'raw':!![]});}return null;})[_0x1690('0x23')](function(_0x2861dc){if(_0x2861dc){_0x42c14=_[_0x1690('0x68')](_0x2861dc,'id');var _0x56614e;var _0x126f38=squel[_0x1690('0x69')]();_0x126f38[_0x1690('0x6a')](_0x2f8d3a['table']);for(var _0x56705b=0x0;_0x56705b<_0x2ed18f[_0x1690('0x36')];_0x56705b+=0x1){_0x56614e=_0x2ed18f[_0x56705b]['MetricId']?_0x42c14[_0x2ed18f[_0x56705b][_0x1690('0x6b')]]['metric']:_0x2ed18f[_0x56705b]['field'];_0x56614e=_0x2ed18f[_0x56705b][_0x1690('0x6c')]?_[_0x1690('0x6d')](_0x1564e7[_0x2ed18f[_0x56705b]['function']],'%s',_0x56614e):_0x56614e;_0x56614e=_0x2ed18f[_0x56705b]['format']?_[_0x1690('0x6d')](_0xba54ca[_0x2ed18f[_0x56705b][_0x1690('0x6e')]],'%s',_0x56614e):_0x56614e;if(_0x2ed18f[_0x56705b][_0x1690('0x6f')]){_0x126f38[_0x1690('0x60')](_0x56614e);}_0x2ed18f[_0x56705b]['orderBy']&&_0x126f38['order'](_0x56614e,_0x2ed18f[_0x56705b][_0x1690('0x70')]===_0x1690('0x71')?![]:!![]);_0x126f38[_0x1690('0x61')](_0x56614e,_0x2ed18f[_0x56705b]['alias']||_0x56614e);}if(_0x2f8d3a[_0x1690('0x72')]){_0x2f8d3a['joins']=JSON[_0x1690('0x73')](_0x2f8d3a[_0x1690('0x72')]);for(var _0x6bc9fc=0x0;_0x6bc9fc<_0x2f8d3a[_0x1690('0x72')][_0x1690('0x36')];_0x6bc9fc+=0x1){if(_0x2f8d3a[_0x1690('0x72')][_0x6bc9fc][_0x1690('0x2d')]&&_[_0x1690('0x74')](_0xe950a7,_0x2f8d3a[_0x1690('0x72')][_0x6bc9fc]['type'])&&_0x2f8d3a[_0x1690('0x72')][_0x6bc9fc][_0x1690('0x75')]&&_0x2f8d3a['joins'][_0x6bc9fc][_0x1690('0x76')]&&_0x2f8d3a['joins'][_0x6bc9fc][_0x1690('0x77')]){_0x126f38[_0x2f8d3a[_0x1690('0x72')][_0x6bc9fc][_0x1690('0x2d')]](_0x2f8d3a[_0x1690('0x72')][_0x6bc9fc][_0x1690('0x76')],null,util[_0x1690('0x6e')]('%s.%s\x20=\x20%s.%s',_0x2f8d3a[_0x1690('0x78')],_0x2f8d3a['joins'][_0x6bc9fc][_0x1690('0x75')],_0x2f8d3a[_0x1690('0x72')][_0x6bc9fc][_0x1690('0x76')],_0x2f8d3a[_0x1690('0x72')][_0x6bc9fc]['foreignKey']));}}}if(_0x2f8d3a[_0x1690('0x79')]){_0x2f8d3a[_0x1690('0x79')]=JSON['parse'](_0x2f8d3a['conditions']);_0x126f38[_0x1690('0x3c')](_0x2d23a8(_0x2f8d3a[_0x1690('0x79')][_0x1690('0x60')]));}_0x48ddbe=_0x126f38[_0x1690('0x7a')]();_0x126f38[_0x1690('0x1c')](_0xeae410);_0x126f38['offset'](0x0);logger[_0x1690('0x7b')]('Limited\x20Query:',_0x126f38['toString']());return dbH[_0x1690('0x7c')][_0x1690('0x30')](_0x126f38[_0x1690('0x7d')](),{'type':dbH[_0x1690('0x7c')][_0x1690('0x7e')][_0x1690('0x7f')]});}})[_0x1690('0x23')](respondWithResult(_0x57fb7a,null))[_0x1690('0x45')](handleError(_0x57fb7a,null));};function runReport(_0x11f99a,_0x44d162,_0x283645){var _0x250faf=_0x44d162[_0x1690('0x29')];var _0x558469=0xa;var _0x42ead8=['join',_0x1690('0x80'),_0x1690('0x51'),'cross_join'];var _0x358afc={'SUM':_0x1690('0x81'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x1690('0x82'),'MIN':_0x1690('0x54'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x1690('0x56'),'GROUP_CONCAT ASC':_0x1690('0x57'),'GROUP_CONCAT DESC':_0x1690('0x58')};var _0x38b905={'SEC_TO_TIME':_0x1690('0x59'),'DATE':_0x1690('0x5a'),'HOUR':_0x1690('0x83'),'ROUND':_0x1690('0x5b'),'UNIX_TIMESTAMP':_0x1690('0x5c')};var _0x4ac2ee=function(_0x43809b){return!_[_0x1690('0x74')]([_0x1690('0x84'),_0x1690('0x5d'),_0x1690('0x85'),_0x1690('0x5e')],_0x43809b);};var _0xc7d199=function(_0x13739d){if(!_0x13739d||!_0x13739d[_0x1690('0x5f')][_0x1690('0x36')]){return'';}for(var _0x1a5685='(',_0x9f8ade=0x0;_0x9f8ade<_0x13739d[_0x1690('0x5f')][_0x1690('0x36')];_0x9f8ade+=0x1){_0x9f8ade>0x0&&(_0x1a5685+='\x20'+_0x13739d[_0x1690('0x86')]+'\x20');_0x1a5685+=_0x13739d[_0x1690('0x5f')][_0x9f8ade]['group']?_0xc7d199(_0x13739d[_0x1690('0x5f')][_0x9f8ade]['group']):_0x13739d[_0x1690('0x5f')][_0x9f8ade][_0x1690('0x61')]+'\x20'+_0x13739d[_0x1690('0x5f')][_0x9f8ade][_0x1690('0x62')]+(_0x4ac2ee(_0x13739d[_0x1690('0x5f')][_0x9f8ade]['condition'])?'\x20'+_0x13739d[_0x1690('0x5f')][_0x9f8ade]['value']:'');}return _0x1a5685+')';};var _0x1419a9={'where':{'id':_0x11f99a['id']}},_0x434ddf,_0x390188,_0x3e46e1,_0x2615d5,_0x7b9e3c;_0x1419a9=_['merge']({},_0x1419a9,_0x283645);return db['AnalyticCustomReport']['find'](_0x1419a9)[_0x1690('0x23')](function(_0x4189ad){if(_0x4189ad){_0x434ddf=_0x4189ad;return _0x4189ad[_0x1690('0x87')]();}return null;})[_0x1690('0x23')](function(_0xd2372e){if(_0xd2372e){if(!_0xd2372e[_0x1690('0x36')]){throw new db['Sequelize'][(_0x1690('0x65'))](_0x1690('0x88'),0x193);}_0x390188=_0xd2372e;return db['AnalyticMetric'][_0x1690('0x67')]({'raw':!![]});}return null;})[_0x1690('0x23')](function(_0xcee291){if(_0xcee291){_0x3e46e1=_[_0x1690('0x68')](_0xcee291,'id');var _0x325514;var _0x276fe0=squel[_0x1690('0x69')]();_0x276fe0[_0x1690('0x6a')](_0x434ddf[_0x1690('0x78')]);for(var _0x878394=0x0;_0x878394<_0x390188[_0x1690('0x36')];_0x878394+=0x1){_0x325514=_0x390188[_0x878394][_0x1690('0x6b')]?_0x3e46e1[_0x390188[_0x878394]['MetricId']][_0x1690('0x89')]:_0x390188[_0x878394][_0x1690('0x61')];_0x325514=_0x390188[_0x878394]['function']?_[_0x1690('0x6d')](_0x358afc[_0x390188[_0x878394][_0x1690('0x6c')]],'%s',_0x325514):_0x325514;_0x325514=_0x390188[_0x878394]['format']?_[_0x1690('0x6d')](_0x38b905[_0x390188[_0x878394][_0x1690('0x6e')]],'%s',_0x325514):_0x325514;if(_0x390188[_0x878394]['groupBy']){_0x276fe0[_0x1690('0x60')](_0x325514);}_0x390188[_0x878394][_0x1690('0x70')]&&_0x276fe0[_0x1690('0x8a')](_0x325514,_0x390188[_0x878394][_0x1690('0x70')]===_0x1690('0x71')?![]:!![]);_0x276fe0[_0x1690('0x61')](_0x325514,_0x390188[_0x878394][_0x1690('0x8b')]||_0x325514);}if(_0x434ddf[_0x1690('0x72')]){_0x434ddf[_0x1690('0x72')]=JSON[_0x1690('0x73')](_0x434ddf[_0x1690('0x72')]);for(var _0x3f259a=0x0;_0x3f259a<_0x434ddf[_0x1690('0x72')][_0x1690('0x36')];_0x3f259a+=0x1){if(_0x434ddf[_0x1690('0x72')][_0x3f259a]['type']&&_[_0x1690('0x74')](_0x42ead8,_0x434ddf[_0x1690('0x72')][_0x3f259a][_0x1690('0x2d')])&&_0x434ddf[_0x1690('0x72')][_0x3f259a][_0x1690('0x75')]&&_0x434ddf[_0x1690('0x72')][_0x3f259a]['foreignTable']&&_0x434ddf['joins'][_0x3f259a]['foreignKey']){_0x276fe0[_0x434ddf['joins'][_0x3f259a][_0x1690('0x2d')]](_0x434ddf[_0x1690('0x72')][_0x3f259a][_0x1690('0x76')],null,util['format'](_0x1690('0x8c'),_0x434ddf[_0x1690('0x78')],_0x434ddf[_0x1690('0x72')][_0x3f259a][_0x1690('0x75')],_0x434ddf[_0x1690('0x72')][_0x3f259a][_0x1690('0x76')],_0x434ddf[_0x1690('0x72')][_0x3f259a][_0x1690('0x77')]));}}}if(_0x434ddf[_0x1690('0x79')]){_0x434ddf[_0x1690('0x79')]=JSON[_0x1690('0x73')](_0x434ddf[_0x1690('0x79')]);_0x276fe0['where'](_0xc7d199(_0x434ddf[_0x1690('0x79')][_0x1690('0x60')]));}_0x7b9e3c=_0x276fe0[_0x1690('0x7a')]();_0x276fe0[_0x1690('0x1c')](_0x558469);_0x276fe0['offset'](0x0);return;}})[_0x1690('0x23')](function(){if(_0x44d162[_0x1690('0x8d')]===_0x1690('0x8e')){return null;}var _0x2c9256=_[_0x1690('0x3d')](_0x44d162,{'name':_0x44d162[_0x1690('0x8f')]||_0x44d162['name']||_0x434ddf[_0x1690('0x29')],'basename':_0x250faf,'savename':util['format'](_0x1690('0x90'),_0x44d162['name']||_0x434ddf[_0x1690('0x29')],require(_0x1690('0x91'))[_0x1690('0x92')](0x4),_0x44d162[_0x1690('0x8d')]||_0x1690('0x93')),'reportId':_0x434ddf['id'],'reportType':_0x1690('0x94')});return db[_0x1690('0x95')][_0x1690('0x46')](_0x2c9256,{'raw':!![]});})[_0x1690('0x23')](function(_0xdf4422){if(_0x434ddf[_0x1690('0x78')]===_0x1690('0x96')){_0x7b9e3c[_0x1690('0x3c')](_0x434ddf['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x44d162[_0x1690('0x97')],_0x44d162[_0x1690('0x98')]);}else{_0x7b9e3c[_0x1690('0x3c')](_0x434ddf[_0x1690('0x78')]+_0x1690('0x99'),_0x44d162[_0x1690('0x97')],_0x44d162[_0x1690('0x98')]);}if(_0xdf4422){logger[_0x1690('0x9a')](_0x1690('0x9b'),_0x7b9e3c[_0x1690('0x7d')]());require(_0x1690('0x9c'))[_0x1690('0x9d')](path[_0x1690('0x50')](__dirname,_0x1690('0x9e'),_0xdf4422[_0x1690('0x8d')]),[_0xdf4422['id'],_0x7b9e3c[_0x1690('0x7d')](),path[_0x1690('0x50')](__dirname,_0x1690('0x9f'),_0xdf4422[_0x1690('0xa0')]),_0x250faf]);return _0xdf4422;}else{var _0xc4e052=squel[_0x1690('0x69')]();_0xc4e052[_0x1690('0x6a')]('('+_0x7b9e3c['toString']()+')',_0x1690('0xa1'));_0xc4e052[_0x1690('0x61')](_0x1690('0xa2'),_0x1690('0x1a'));_0x7b9e3c[_0x1690('0x1c')](_0x44d162[_0x1690('0x1c')]||_0x558469);_0x7b9e3c['offset'](_0x44d162[_0x1690('0x1b')]||0x0);return dbH[_0x1690('0x7c')][_0x1690('0x30')](_0xc4e052[_0x1690('0x7d')](),{'type':dbH[_0x1690('0x7c')][_0x1690('0x7e')][_0x1690('0x7f')]})[_0x1690('0x23')](function(_0x1d42e2){if(!_0x1d42e2[_0x1690('0x36')]){_0x2615d5=0x0;}else{_0x2615d5=_0x1d42e2[0x0][_0x1690('0x1a')]||0x0;}return dbH[_0x1690('0x7c')][_0x1690('0x30')](_0x7b9e3c['toString'](),{'type':dbH[_0x1690('0x7c')][_0x1690('0x7e')][_0x1690('0x7f')]});})['then'](function(_0x25f2f3){return{'rows':_0x25f2f3||[],'count':_0x2615d5};});}});}exports[_0x1690('0xa3')]=function(_0x5d15c1,_0x26f35c){return runReport(_0x5d15c1[_0x1690('0x4e')],_0x5d15c1['query'],_0x5d15c1[_0x1690('0x3f')])[_0x1690('0x23')](respondWithResult(_0x26f35c,null))[_0x1690('0x45')](handleError(_0x26f35c,null));};exports['runReport']=runReport;exports[_0x1690('0x30')]=function(_0x3dce88,_0x1f507e){var _0x5cc28d=0xa;var _0x2c396b=[_0x1690('0x50'),_0x1690('0x80'),_0x1690('0x51'),_0x1690('0x52')];var _0x54e806={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1690('0xa4'),'MAX':'MAX(%s)','MIN':_0x1690('0x54'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x1690('0x56'),'GROUP_CONCAT ASC':_0x1690('0x57'),'GROUP_CONCAT DESC':_0x1690('0x58')};var _0xebf169={'SEC_TO_TIME':_0x1690('0x59'),'DATE':_0x1690('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x1690('0x5b'),'UNIX_TIMESTAMP':_0x1690('0x5c')};var _0x45c9af=function(_0x2e2d66){return!_[_0x1690('0x74')]([_0x1690('0x84'),_0x1690('0x5d'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x2e2d66);};var _0x590edb=function(_0x2ea2fa){if(!_0x2ea2fa||!_0x2ea2fa[_0x1690('0x5f')][_0x1690('0x36')]){return'';}for(var _0x25e000='(',_0x102138=0x0;_0x102138<_0x2ea2fa['rules'][_0x1690('0x36')];_0x102138+=0x1){_0x102138>0x0&&(_0x25e000+='\x20'+_0x2ea2fa[_0x1690('0x86')]+'\x20');_0x25e000+=_0x2ea2fa[_0x1690('0x5f')][_0x102138][_0x1690('0x60')]?_0x590edb(_0x2ea2fa[_0x1690('0x5f')][_0x102138]['group']):_0x2ea2fa[_0x1690('0x5f')][_0x102138][_0x1690('0x61')]+'\x20'+_0x2ea2fa[_0x1690('0x5f')][_0x102138][_0x1690('0x62')]+(_0x45c9af(_0x2ea2fa[_0x1690('0x5f')][_0x102138]['condition'])?'\x20'+_0x2ea2fa[_0x1690('0x5f')][_0x102138][_0x1690('0x63')]:'');}return _0x25e000+')';};var _0x3094cf={'where':{'id':_0x3dce88[_0x1690('0x4e')]['id']}},_0x182a3e,_0x13e85a,_0x5e5c63,_0x3d198a,_0x4565c2;_0x3094cf=_['merge']({},_0x3094cf,_0x3dce88['options']);return db[_0x1690('0x40')][_0x1690('0x44')](_0x3094cf)[_0x1690('0x23')](function(_0x5cdc85){if(_0x5cdc85){_0x182a3e=_0x5cdc85;return _0x5cdc85['getFields']();}return null;})[_0x1690('0x23')](function(_0x480ab1){if(_0x480ab1){if(!_0x480ab1[_0x1690('0x36')]){throw new db[(_0x1690('0x64'))][(_0x1690('0x65'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x13e85a=_0x480ab1;return db[_0x1690('0x66')]['findAll']({'raw':!![]});}return null;})[_0x1690('0x23')](function(_0x4ddff7){if(_0x4ddff7){_0x5e5c63=_[_0x1690('0x68')](_0x4ddff7,'id');var _0x274b65;var _0x529ff7=squel['select']();_0x529ff7[_0x1690('0x6a')](_0x182a3e[_0x1690('0x78')]);for(var _0x422a5d=0x0;_0x422a5d<_0x13e85a[_0x1690('0x36')];_0x422a5d+=0x1){_0x274b65=_0x13e85a[_0x422a5d][_0x1690('0x6b')]?_0x5e5c63[_0x13e85a[_0x422a5d][_0x1690('0x6b')]]['metric']:_0x13e85a[_0x422a5d][_0x1690('0x61')];_0x274b65=_0x13e85a[_0x422a5d][_0x1690('0x6c')]?_[_0x1690('0x6d')](_0x54e806[_0x13e85a[_0x422a5d][_0x1690('0x6c')]],'%s',_0x274b65):_0x274b65;_0x274b65=_0x13e85a[_0x422a5d][_0x1690('0x6e')]?_[_0x1690('0x6d')](_0xebf169[_0x13e85a[_0x422a5d][_0x1690('0x6e')]],'%s',_0x274b65):_0x274b65;if(_0x13e85a[_0x422a5d][_0x1690('0x6f')]){_0x529ff7[_0x1690('0x60')](_0x274b65);}_0x13e85a[_0x422a5d][_0x1690('0x70')]&&_0x529ff7[_0x1690('0x8a')](_0x274b65,_0x13e85a[_0x422a5d][_0x1690('0x70')]===_0x1690('0x71')?![]:!![]);_0x529ff7[_0x1690('0x61')](_0x274b65,_0x13e85a[_0x422a5d][_0x1690('0x8b')]||_0x274b65);}if(_0x182a3e[_0x1690('0x72')]){_0x182a3e['joins']=JSON[_0x1690('0x73')](_0x182a3e[_0x1690('0x72')]);for(var _0x15e62c=0x0;_0x15e62c<_0x182a3e[_0x1690('0x72')][_0x1690('0x36')];_0x15e62c+=0x1){if(_0x182a3e['joins'][_0x15e62c][_0x1690('0x2d')]&&_[_0x1690('0x74')](_0x2c396b,_0x182a3e['joins'][_0x15e62c]['type'])&&_0x182a3e[_0x1690('0x72')][_0x15e62c][_0x1690('0x75')]&&_0x182a3e[_0x1690('0x72')][_0x15e62c][_0x1690('0x76')]&&_0x182a3e[_0x1690('0x72')][_0x15e62c][_0x1690('0x77')]){_0x529ff7[_0x182a3e['joins'][_0x15e62c][_0x1690('0x2d')]](_0x182a3e[_0x1690('0x72')][_0x15e62c][_0x1690('0x76')],null,util[_0x1690('0x6e')](_0x1690('0x8c'),_0x182a3e['table'],_0x182a3e['joins'][_0x15e62c]['parentKey'],_0x182a3e[_0x1690('0x72')][_0x15e62c][_0x1690('0x76')],_0x182a3e[_0x1690('0x72')][_0x15e62c]['foreignKey']));}}}if(_0x182a3e[_0x1690('0x79')]){_0x182a3e[_0x1690('0x79')]=JSON[_0x1690('0x73')](_0x182a3e[_0x1690('0x79')]);_0x529ff7[_0x1690('0x3c')](_0x590edb(_0x182a3e[_0x1690('0x79')][_0x1690('0x60')]));}_0x4565c2=_0x529ff7['clone']();_0x529ff7[_0x1690('0x1c')](_0x5cc28d);_0x529ff7[_0x1690('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x529ff7[_0x1690('0x7d')]());return dbH[_0x1690('0x7c')][_0x1690('0x30')](_0x529ff7['toString'](),{'type':dbH[_0x1690('0x7c')][_0x1690('0x7e')][_0x1690('0x7f')]});}})[_0x1690('0x23')](function(){return{'sql':_0x4565c2[_0x1690('0x7d')]()};})[_0x1690('0x23')](respondWithResult(_0x1f507e,null))[_0x1690('0x45')](handleError(_0x1f507e,null));}; \ No newline at end of file +var _0x5a1b=['Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','field','function','format','replace','groupBy','orderBy','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','SUM(%s)','includes','IS\x20NULL','from','DESC','parse','output','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','DATE(%s)','HOUR(%s)','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','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','count','offset','limit','set','Content-Range','apply','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','body','preview','join','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%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)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value'];(function(_0x25edd2,_0x564c8c){var _0x26eaf6=function(_0x937195){while(--_0x937195){_0x25edd2['push'](_0x25edd2['shift']());}};_0x26eaf6(++_0x564c8c);}(_0x5a1b,0xe6));var _0xb5a1=function(_0x38f5cf,_0x2c455b){_0x38f5cf=_0x38f5cf-0x0;var _0x5af4ac=_0x5a1b[_0x38f5cf];return _0x5af4ac;};'use strict';var pdf=require(_0xb5a1('0x0'));var emlformat=require(_0xb5a1('0x1'));var rimraf=require(_0xb5a1('0x2'));var zipdir=require(_0xb5a1('0x3'));var jsonpatch=require(_0xb5a1('0x4'));var rp=require('request-promise');var moment=require(_0xb5a1('0x5'));var BPromise=require(_0xb5a1('0x6'));var Mustache=require(_0xb5a1('0x7'));var util=require('util');var path=require(_0xb5a1('0x8'));var sox=require('sox');var csv=require(_0xb5a1('0x9'));var ejs=require(_0xb5a1('0xa'));var fs=require('fs');var _=require(_0xb5a1('0xb'));var squel=require('squel');var crypto=require(_0xb5a1('0xc'));var jsforce=require(_0xb5a1('0xd'));var deskjs=require(_0xb5a1('0xe'));var toCsv=require(_0xb5a1('0x9'));var querystring=require('querystring');var Papa=require(_0xb5a1('0xf'));var Redis=require(_0xb5a1('0x10'));var authService=require(_0xb5a1('0x11'));var qs=require(_0xb5a1('0x12'));var as=require(_0xb5a1('0x13'));var hardwareService=require(_0xb5a1('0x14'));var logger=require(_0xb5a1('0x15'))(_0xb5a1('0x16'));var utils=require(_0xb5a1('0x17'));var config=require(_0xb5a1('0x18'));var licenseUtil=require(_0xb5a1('0x19'));var db=require(_0xb5a1('0x1a'))['db'];var dbH=require(_0xb5a1('0x1a'))['dbH'];function respondWithStatusCode(_0x8d5524,_0x493508){_0x493508=_0x493508||0xcc;return function(_0x1c5c0b){if(_0x1c5c0b){return _0x8d5524[_0xb5a1('0x1b')](_0x493508);}return _0x8d5524[_0xb5a1('0x1c')](_0x493508)[_0xb5a1('0x1d')]();};}function respondWithResult(_0x31a540,_0x43386e){_0x43386e=_0x43386e||0xc8;return function(_0x1b7198){if(_0x1b7198){return _0x31a540[_0xb5a1('0x1c')](_0x43386e)[_0xb5a1('0x1e')](_0x1b7198);}};}function respondWithFilteredResult(_0x56932a,_0x4cda72){return function(_0x37da70){if(_0x37da70){var _0x485e0e=_0x37da70[_0xb5a1('0x1f')],_0x5522e1=_0x4cda72[_0xb5a1('0x20')],_0x47c3f9=_0x4cda72[_0xb5a1('0x20')]+_0x4cda72[_0xb5a1('0x21')],_0x5ba229;if(_0x47c3f9>=_0x485e0e){_0x47c3f9=_0x485e0e;_0x5ba229=0xc8;}else{_0x5ba229=0xce;}_0x56932a['status'](_0x5ba229);return _0x56932a[_0xb5a1('0x22')](_0xb5a1('0x23'),_0x5522e1+'-'+_0x47c3f9+'/'+_0x485e0e)['json'](_0x37da70);}return null;};}function patchUpdates(_0x34a4de){return function(_0x10854c){try{jsonpatch[_0xb5a1('0x24')](_0x10854c,_0x34a4de,!![]);}catch(_0x169c5c){return BPromise['reject'](_0x169c5c);}return _0x10854c['save']();};}function saveUpdates(_0x36a2b2,_0x560a91){return function(_0xe283f1){if(_0xe283f1){return _0xe283f1[_0xb5a1('0x25')](_0x36a2b2)[_0xb5a1('0x26')](function(_0x1cc9ab){return _0x1cc9ab;});}return null;};}function removeEntity(_0x51cf17,_0x16977b){return function(_0x295a97){if(_0x295a97){return _0x295a97[_0xb5a1('0x27')]()[_0xb5a1('0x26')](function(){var _0xa425f6=_0x295a97[_0xb5a1('0x28')]({'plain':!![]});var _0x58edd7=_0xb5a1('0x29');return db[_0xb5a1('0x2a')][_0xb5a1('0x27')]({'where':{'type':_0x58edd7,'resourceId':_0xa425f6['id']}})[_0xb5a1('0x26')](function(){return _0x295a97;});})[_0xb5a1('0x26')](function(){_0x51cf17[_0xb5a1('0x1c')](0xcc)[_0xb5a1('0x1d')]();});}};}function handleEntityNotFound(_0x55b363,_0x391293){return function(_0x540e79){if(!_0x540e79){_0x55b363['sendStatus'](0x194);}return _0x540e79;};}function handleError(_0x40e8b7,_0x32e175){_0x32e175=_0x32e175||0x1f4;return function(_0x4d93aa){logger[_0xb5a1('0x2b')](_0x4d93aa[_0xb5a1('0x2c')]);if(_0x4d93aa[_0xb5a1('0x2d')]){delete _0x4d93aa[_0xb5a1('0x2d')];}_0x40e8b7[_0xb5a1('0x1c')](_0x32e175)[_0xb5a1('0x2e')](_0x4d93aa);};}exports[_0xb5a1('0x2f')]=function(_0x2aa0b5,_0x230f2d){var _0x404e6f={},_0x238b1c={},_0x386da7={'count':0x0,'rows':[]};var _0xca3ddc=_[_0xb5a1('0x30')](db[_0xb5a1('0x31')][_0xb5a1('0x32')],function(_0x4267ce){return{'name':_0x4267ce['fieldName'],'type':_0x4267ce[_0xb5a1('0x33')][_0xb5a1('0x34')]};});_0x238b1c[_0xb5a1('0x35')]=_[_0xb5a1('0x30')](_0xca3ddc,_0xb5a1('0x2d'));_0x238b1c['query']=_['keys'](_0x2aa0b5[_0xb5a1('0x36')]);_0x238b1c[_0xb5a1('0x37')]=_[_0xb5a1('0x38')](_0x238b1c[_0xb5a1('0x35')],_0x238b1c['query']);_0x404e6f[_0xb5a1('0x39')]=_[_0xb5a1('0x38')](_0x238b1c[_0xb5a1('0x35')],qs[_0xb5a1('0x3a')](_0x2aa0b5[_0xb5a1('0x36')][_0xb5a1('0x3a')]));_0x404e6f['attributes']=_0x404e6f[_0xb5a1('0x39')][_0xb5a1('0x3b')]?_0x404e6f['attributes']:_0x238b1c[_0xb5a1('0x35')];if(!_0x2aa0b5[_0xb5a1('0x36')][_0xb5a1('0x3c')](_0xb5a1('0x3d'))){_0x404e6f['limit']=qs[_0xb5a1('0x21')](_0x2aa0b5['query']['limit']);_0x404e6f[_0xb5a1('0x20')]=qs[_0xb5a1('0x20')](_0x2aa0b5['query'][_0xb5a1('0x20')]);}_0x404e6f[_0xb5a1('0x3e')]=qs[_0xb5a1('0x3f')](_0x2aa0b5['query'][_0xb5a1('0x3f')]);_0x404e6f[_0xb5a1('0x40')]=qs[_0xb5a1('0x37')](_[_0xb5a1('0x41')](_0x2aa0b5[_0xb5a1('0x36')],_0x238b1c[_0xb5a1('0x37')]),_0xca3ddc);if(_0x2aa0b5['query'][_0xb5a1('0x42')]){_0x404e6f[_0xb5a1('0x40')]=_[_0xb5a1('0x43')](_0x404e6f['where'],{'$or':_['map'](_0xca3ddc,function(_0x16ddaf){if(_0x16ddaf[_0xb5a1('0x33')]!=='VIRTUAL'){var _0x17d4d7={};_0x17d4d7[_0x16ddaf[_0xb5a1('0x2d')]]={'$like':'%'+_0x2aa0b5[_0xb5a1('0x36')][_0xb5a1('0x42')]+'%'};return _0x17d4d7;}})});}_0x404e6f=_[_0xb5a1('0x43')]({},_0x404e6f,_0x2aa0b5[_0xb5a1('0x44')]);var _0x48e4c9={'where':_0x404e6f[_0xb5a1('0x40')]};return db[_0xb5a1('0x31')][_0xb5a1('0x1f')](_0x48e4c9)[_0xb5a1('0x26')](function(_0x23a80){_0x386da7[_0xb5a1('0x1f')]=_0x23a80;if(_0x2aa0b5[_0xb5a1('0x36')]['includeAll']){_0x404e6f[_0xb5a1('0x45')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xb5a1('0x46')](_0x404e6f);})[_0xb5a1('0x26')](function(_0x3def4f){_0x386da7['rows']=_0x3def4f;return _0x386da7;})[_0xb5a1('0x26')](respondWithFilteredResult(_0x230f2d,_0x404e6f))[_0xb5a1('0x47')](handleError(_0x230f2d,null));};exports[_0xb5a1('0x48')]=function(_0x1d2d3f,_0xc6b896){var _0x13c30e={'raw':![],'where':{'id':_0x1d2d3f[_0xb5a1('0x49')]['id']}},_0x181a13={};_0x181a13[_0xb5a1('0x35')]=_[_0xb5a1('0x4a')](db[_0xb5a1('0x31')][_0xb5a1('0x32')]);_0x181a13[_0xb5a1('0x36')]=_[_0xb5a1('0x4a')](_0x1d2d3f['query']);_0x181a13[_0xb5a1('0x37')]=_['intersection'](_0x181a13[_0xb5a1('0x35')],_0x181a13['query']);_0x13c30e['attributes']=_['intersection'](_0x181a13[_0xb5a1('0x35')],qs[_0xb5a1('0x3a')](_0x1d2d3f[_0xb5a1('0x36')]['fields']));_0x13c30e[_0xb5a1('0x39')]=_0x13c30e['attributes'][_0xb5a1('0x3b')]?_0x13c30e['attributes']:_0x181a13['model'];if(_0x1d2d3f['query']['includeAll']){_0x13c30e[_0xb5a1('0x45')]=[{'all':!![]}];}_0x13c30e=_[_0xb5a1('0x43')]({},_0x13c30e,_0x1d2d3f[_0xb5a1('0x44')]);return db[_0xb5a1('0x31')][_0xb5a1('0x4b')](_0x13c30e)[_0xb5a1('0x26')](handleEntityNotFound(_0xc6b896,null))[_0xb5a1('0x26')](respondWithResult(_0xc6b896,null))[_0xb5a1('0x47')](handleError(_0xc6b896,null));};exports[_0xb5a1('0x4c')]=function(_0x2b5260,_0x52cf23){return db['AnalyticCustomReport'][_0xb5a1('0x4c')](_0x2b5260['body'],{})[_0xb5a1('0x26')](function(_0x45c651){var _0x12bee4=_0x2b5260[_0xb5a1('0x4d')]['get']({'plain':!![]});if(!_0x12bee4)throw new Error(_0xb5a1('0x4e'));if(_0x12bee4[_0xb5a1('0x4f')]===_0xb5a1('0x4d')){var _0x359c1e=_0x45c651[_0xb5a1('0x28')]({'plain':!![]});var _0x3e71c0=_0xb5a1('0x50');return db[_0xb5a1('0x51')][_0xb5a1('0x4b')]({'where':{'name':_0x3e71c0,'userProfileId':_0x12bee4[_0xb5a1('0x52')]},'raw':!![]})['then'](function(_0x286dec){if(_0x286dec&&_0x286dec[_0xb5a1('0x53')]===0x0){return db['UserProfileResource'][_0xb5a1('0x4c')]({'name':_0x359c1e[_0xb5a1('0x2d')],'resourceId':_0x359c1e['id'],'type':_0xb5a1('0x29'),'sectionId':_0x286dec['id']},{})[_0xb5a1('0x26')](function(){return _0x45c651;});}else{return _0x45c651;}})['catch'](function(_0x53bcca){logger[_0xb5a1('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53bcca);throw _0x53bcca;});}return _0x45c651;})[_0xb5a1('0x26')](respondWithResult(_0x52cf23,0xc9))[_0xb5a1('0x47')](handleError(_0x52cf23,null));};exports['update']=function(_0x586f53,_0x60bef4){if(_0x586f53['body']['id']){delete _0x586f53[_0xb5a1('0x54')]['id'];}return db[_0xb5a1('0x31')][_0xb5a1('0x4b')]({'where':{'id':_0x586f53[_0xb5a1('0x49')]['id']}})['then'](handleEntityNotFound(_0x60bef4,null))[_0xb5a1('0x26')](saveUpdates(_0x586f53[_0xb5a1('0x54')],null))['then'](respondWithResult(_0x60bef4,null))[_0xb5a1('0x47')](handleError(_0x60bef4,null));};exports[_0xb5a1('0x27')]=function(_0x5dadef,_0x55f574){return db[_0xb5a1('0x31')]['find']({'where':{'id':_0x5dadef['params']['id']}})[_0xb5a1('0x26')](handleEntityNotFound(_0x55f574,null))['then'](removeEntity(_0x55f574,null))[_0xb5a1('0x47')](handleError(_0x55f574,null));};exports[_0xb5a1('0x55')]=function(_0x412098,_0x32c495){var _0x34ee1c=0xa;var _0x5b4b67=[_0xb5a1('0x56'),_0xb5a1('0x57'),_0xb5a1('0x58'),'cross_join'];var _0x317820={'SUM':'SUM(%s)','COUNT':_0xb5a1('0x59'),'COUNT DISTINCT':_0xb5a1('0x5a'),'MAX':_0xb5a1('0x5b'),'MIN':_0xb5a1('0x5c'),'AVG':_0xb5a1('0x5d'),'GROUP_CONCAT':_0xb5a1('0x5e'),'GROUP_CONCAT ASC':_0xb5a1('0x5f'),'GROUP_CONCAT DESC':_0xb5a1('0x60')};var _0x547f06={'SEC_TO_TIME':_0xb5a1('0x61'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xb5a1('0x62'),'UNIX_TIMESTAMP':_0xb5a1('0x63')};var _0x4a3344=function(_0x53bc2c){return!_['includes'](['IS\x20NULL',_0xb5a1('0x64'),_0xb5a1('0x65'),_0xb5a1('0x66')],_0x53bc2c);};var _0x2bf986=function(_0x70dfca){if(!_0x70dfca||!_0x70dfca[_0xb5a1('0x67')]['length']){return'';}for(var _0x11eb3c='(',_0x6dc627=0x0;_0x6dc627<_0x70dfca[_0xb5a1('0x67')][_0xb5a1('0x3b')];_0x6dc627+=0x1){_0x6dc627>0x0&&(_0x11eb3c+='\x20'+_0x70dfca[_0xb5a1('0x68')]+'\x20');_0x11eb3c+=_0x70dfca[_0xb5a1('0x67')][_0x6dc627]['group']?_0x2bf986(_0x70dfca[_0xb5a1('0x67')][_0x6dc627][_0xb5a1('0x69')]):_0x70dfca[_0xb5a1('0x67')][_0x6dc627]['field']+'\x20'+_0x70dfca['rules'][_0x6dc627][_0xb5a1('0x6a')]+(_0x4a3344(_0x70dfca[_0xb5a1('0x67')][_0x6dc627][_0xb5a1('0x6a')])?'\x20'+_0x70dfca[_0xb5a1('0x67')][_0x6dc627][_0xb5a1('0x6b')]:'');}return _0x11eb3c+')';};var _0x176fd7={'where':{'id':_0x412098[_0xb5a1('0x49')]['id']}},_0x10b7f9,_0x2c5d36,_0x48a1d7,_0x10d31e,_0x505633;_0x176fd7=_[_0xb5a1('0x43')]({},_0x176fd7,_0x412098['options']);return db[_0xb5a1('0x31')]['find'](_0x176fd7)['then'](function(_0x32ff7d){if(_0x32ff7d){_0x10b7f9=_0x32ff7d;return _0x32ff7d['getFields']();}return null;})[_0xb5a1('0x26')](function(_0xc0184f){if(_0xc0184f){if(!_0xc0184f[_0xb5a1('0x3b')]){throw new db[(_0xb5a1('0x6c'))][(_0xb5a1('0x6d'))](_0xb5a1('0x6e'),0x193);}_0x2c5d36=_0xc0184f;return db[_0xb5a1('0x6f')]['findAll']({'raw':!![]});}return null;})[_0xb5a1('0x26')](function(_0x333425){if(_0x333425){_0x48a1d7=_[_0xb5a1('0x70')](_0x333425,'id');var _0x1cd464;var _0x14b346=squel[_0xb5a1('0x71')]();_0x14b346['from'](_0x10b7f9[_0xb5a1('0x72')]);for(var _0x568235=0x0;_0x568235<_0x2c5d36[_0xb5a1('0x3b')];_0x568235+=0x1){_0x1cd464=_0x2c5d36[_0x568235][_0xb5a1('0x73')]?_0x48a1d7[_0x2c5d36[_0x568235][_0xb5a1('0x73')]][_0xb5a1('0x74')]:_0x2c5d36[_0x568235][_0xb5a1('0x75')];_0x1cd464=_0x2c5d36[_0x568235][_0xb5a1('0x76')]?_['replace'](_0x317820[_0x2c5d36[_0x568235]['function']],'%s',_0x1cd464):_0x1cd464;_0x1cd464=_0x2c5d36[_0x568235][_0xb5a1('0x77')]?_[_0xb5a1('0x78')](_0x547f06[_0x2c5d36[_0x568235]['format']],'%s',_0x1cd464):_0x1cd464;if(_0x2c5d36[_0x568235][_0xb5a1('0x79')]){_0x14b346[_0xb5a1('0x69')](_0x1cd464);}_0x2c5d36[_0x568235][_0xb5a1('0x7a')]&&_0x14b346['order'](_0x1cd464,_0x2c5d36[_0x568235][_0xb5a1('0x7a')]==='DESC'?![]:!![]);_0x14b346[_0xb5a1('0x75')](_0x1cd464,_0x2c5d36[_0x568235][_0xb5a1('0x7b')]||_0x1cd464);}if(_0x10b7f9['joins']){_0x10b7f9[_0xb5a1('0x7c')]=JSON['parse'](_0x10b7f9[_0xb5a1('0x7c')]);for(var _0x58f492=0x0;_0x58f492<_0x10b7f9[_0xb5a1('0x7c')]['length'];_0x58f492+=0x1){if(_0x10b7f9[_0xb5a1('0x7c')][_0x58f492]['type']&&_['includes'](_0x5b4b67,_0x10b7f9[_0xb5a1('0x7c')][_0x58f492][_0xb5a1('0x33')])&&_0x10b7f9['joins'][_0x58f492][_0xb5a1('0x7d')]&&_0x10b7f9[_0xb5a1('0x7c')][_0x58f492]['foreignTable']&&_0x10b7f9[_0xb5a1('0x7c')][_0x58f492][_0xb5a1('0x7e')]){_0x14b346[_0x10b7f9[_0xb5a1('0x7c')][_0x58f492][_0xb5a1('0x33')]](_0x10b7f9['joins'][_0x58f492][_0xb5a1('0x7f')],null,util[_0xb5a1('0x77')](_0xb5a1('0x80'),_0x10b7f9['table'],_0x10b7f9['joins'][_0x58f492][_0xb5a1('0x7d')],_0x10b7f9[_0xb5a1('0x7c')][_0x58f492][_0xb5a1('0x7f')],_0x10b7f9[_0xb5a1('0x7c')][_0x58f492]['foreignKey']));}}}if(_0x10b7f9['conditions']){_0x10b7f9[_0xb5a1('0x81')]=JSON['parse'](_0x10b7f9['conditions']);_0x14b346['where'](_0x2bf986(_0x10b7f9[_0xb5a1('0x81')]['group']));}_0x505633=_0x14b346[_0xb5a1('0x82')]();_0x14b346[_0xb5a1('0x21')](_0x34ee1c);_0x14b346['offset'](0x0);logger[_0xb5a1('0x83')](_0xb5a1('0x84'),_0x14b346[_0xb5a1('0x85')]());return dbH[_0xb5a1('0x86')][_0xb5a1('0x36')](_0x14b346[_0xb5a1('0x85')](),{'type':dbH[_0xb5a1('0x86')][_0xb5a1('0x87')][_0xb5a1('0x88')]});}})[_0xb5a1('0x26')](respondWithResult(_0x32c495,null))[_0xb5a1('0x47')](handleError(_0x32c495,null));};function runReport(_0x5880fe,_0x3b5eda,_0x1dc1da){var _0x3398a7=_0x3b5eda['name'];var _0x48ef7e=0xa;var _0x2ef385=[_0xb5a1('0x56'),'left_join',_0xb5a1('0x58'),_0xb5a1('0x89')];var _0x19f165={'SUM':_0xb5a1('0x8a'),'COUNT':_0xb5a1('0x59'),'COUNT DISTINCT':_0xb5a1('0x5a'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xb5a1('0x5d'),'GROUP_CONCAT':_0xb5a1('0x5e'),'GROUP_CONCAT ASC':_0xb5a1('0x5f'),'GROUP_CONCAT DESC':_0xb5a1('0x60')};var _0x3822d1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xb5a1('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3da986=function(_0x342a5a){return!_[_0xb5a1('0x8b')]([_0xb5a1('0x8c'),'IS\x20NOT\x20NULL',_0xb5a1('0x65'),_0xb5a1('0x66')],_0x342a5a);};var _0x3fff0e=function(_0x42b0a8){if(!_0x42b0a8||!_0x42b0a8[_0xb5a1('0x67')][_0xb5a1('0x3b')]){return'';}for(var _0x329b74='(',_0x2b0ab6=0x0;_0x2b0ab6<_0x42b0a8[_0xb5a1('0x67')]['length'];_0x2b0ab6+=0x1){_0x2b0ab6>0x0&&(_0x329b74+='\x20'+_0x42b0a8[_0xb5a1('0x68')]+'\x20');_0x329b74+=_0x42b0a8[_0xb5a1('0x67')][_0x2b0ab6][_0xb5a1('0x69')]?_0x3fff0e(_0x42b0a8[_0xb5a1('0x67')][_0x2b0ab6][_0xb5a1('0x69')]):_0x42b0a8[_0xb5a1('0x67')][_0x2b0ab6][_0xb5a1('0x75')]+'\x20'+_0x42b0a8[_0xb5a1('0x67')][_0x2b0ab6][_0xb5a1('0x6a')]+(_0x3da986(_0x42b0a8['rules'][_0x2b0ab6][_0xb5a1('0x6a')])?'\x20'+_0x42b0a8[_0xb5a1('0x67')][_0x2b0ab6][_0xb5a1('0x6b')]:'');}return _0x329b74+')';};var _0x2ae3b8={'where':{'id':_0x5880fe['id']}},_0x3c8008,_0x47a238,_0x1d292a,_0x1258ea,_0x39462e;_0x2ae3b8=_[_0xb5a1('0x43')]({},_0x2ae3b8,_0x1dc1da);return db[_0xb5a1('0x31')]['find'](_0x2ae3b8)[_0xb5a1('0x26')](function(_0x1209f8){if(_0x1209f8){_0x3c8008=_0x1209f8;return _0x1209f8['getFields']();}return null;})['then'](function(_0x4463a9){if(_0x4463a9){if(!_0x4463a9['length']){throw new db[(_0xb5a1('0x6c'))][(_0xb5a1('0x6d'))](_0xb5a1('0x6e'),0x193);}_0x47a238=_0x4463a9;return db['AnalyticMetric'][_0xb5a1('0x46')]({'raw':!![]});}return null;})[_0xb5a1('0x26')](function(_0x252b2e){if(_0x252b2e){_0x1d292a=_[_0xb5a1('0x70')](_0x252b2e,'id');var _0x4fcfe3;var _0x12ad89=squel[_0xb5a1('0x71')]();_0x12ad89[_0xb5a1('0x8d')](_0x3c8008[_0xb5a1('0x72')]);for(var _0x20fedf=0x0;_0x20fedf<_0x47a238[_0xb5a1('0x3b')];_0x20fedf+=0x1){_0x4fcfe3=_0x47a238[_0x20fedf]['MetricId']?_0x1d292a[_0x47a238[_0x20fedf][_0xb5a1('0x73')]][_0xb5a1('0x74')]:_0x47a238[_0x20fedf][_0xb5a1('0x75')];_0x4fcfe3=_0x47a238[_0x20fedf][_0xb5a1('0x76')]?_[_0xb5a1('0x78')](_0x19f165[_0x47a238[_0x20fedf]['function']],'%s',_0x4fcfe3):_0x4fcfe3;_0x4fcfe3=_0x47a238[_0x20fedf][_0xb5a1('0x77')]?_[_0xb5a1('0x78')](_0x3822d1[_0x47a238[_0x20fedf][_0xb5a1('0x77')]],'%s',_0x4fcfe3):_0x4fcfe3;if(_0x47a238[_0x20fedf][_0xb5a1('0x79')]){_0x12ad89[_0xb5a1('0x69')](_0x4fcfe3);}_0x47a238[_0x20fedf]['orderBy']&&_0x12ad89[_0xb5a1('0x3e')](_0x4fcfe3,_0x47a238[_0x20fedf][_0xb5a1('0x7a')]===_0xb5a1('0x8e')?![]:!![]);_0x12ad89[_0xb5a1('0x75')](_0x4fcfe3,_0x47a238[_0x20fedf][_0xb5a1('0x7b')]||_0x4fcfe3);}if(_0x3c8008[_0xb5a1('0x7c')]){_0x3c8008[_0xb5a1('0x7c')]=JSON[_0xb5a1('0x8f')](_0x3c8008[_0xb5a1('0x7c')]);for(var _0xbf1d53=0x0;_0xbf1d53<_0x3c8008[_0xb5a1('0x7c')][_0xb5a1('0x3b')];_0xbf1d53+=0x1){if(_0x3c8008[_0xb5a1('0x7c')][_0xbf1d53][_0xb5a1('0x33')]&&_[_0xb5a1('0x8b')](_0x2ef385,_0x3c8008['joins'][_0xbf1d53][_0xb5a1('0x33')])&&_0x3c8008[_0xb5a1('0x7c')][_0xbf1d53][_0xb5a1('0x7d')]&&_0x3c8008['joins'][_0xbf1d53][_0xb5a1('0x7f')]&&_0x3c8008[_0xb5a1('0x7c')][_0xbf1d53][_0xb5a1('0x7e')]){_0x12ad89[_0x3c8008[_0xb5a1('0x7c')][_0xbf1d53][_0xb5a1('0x33')]](_0x3c8008[_0xb5a1('0x7c')][_0xbf1d53][_0xb5a1('0x7f')],null,util[_0xb5a1('0x77')](_0xb5a1('0x80'),_0x3c8008[_0xb5a1('0x72')],_0x3c8008[_0xb5a1('0x7c')][_0xbf1d53][_0xb5a1('0x7d')],_0x3c8008[_0xb5a1('0x7c')][_0xbf1d53][_0xb5a1('0x7f')],_0x3c8008[_0xb5a1('0x7c')][_0xbf1d53][_0xb5a1('0x7e')]));}}}if(_0x3c8008[_0xb5a1('0x81')]){_0x3c8008[_0xb5a1('0x81')]=JSON[_0xb5a1('0x8f')](_0x3c8008[_0xb5a1('0x81')]);_0x12ad89[_0xb5a1('0x40')](_0x3fff0e(_0x3c8008[_0xb5a1('0x81')][_0xb5a1('0x69')]));}_0x39462e=_0x12ad89[_0xb5a1('0x82')]();_0x12ad89['limit'](_0x48ef7e);_0x12ad89[_0xb5a1('0x20')](0x0);return;}})[_0xb5a1('0x26')](function(){if(_0x3b5eda[_0xb5a1('0x90')]===_0xb5a1('0x91')){return null;}var _0x418d7f=_[_0xb5a1('0x43')](_0x3b5eda,{'name':_0x3b5eda[_0xb5a1('0x92')]||_0x3b5eda['name']||_0x3c8008[_0xb5a1('0x2d')],'basename':_0x3398a7,'savename':util[_0xb5a1('0x77')]('%s-%s.%s',_0x3b5eda[_0xb5a1('0x2d')]||_0x3c8008[_0xb5a1('0x2d')],require(_0xb5a1('0x93'))[_0xb5a1('0x94')](0x4),_0x3b5eda[_0xb5a1('0x90')]||_0xb5a1('0x95')),'reportId':_0x3c8008['id'],'reportType':_0xb5a1('0x96')});return db[_0xb5a1('0x97')][_0xb5a1('0x4c')](_0x418d7f,{'raw':!![]});})[_0xb5a1('0x26')](function(_0x3f84c0){if(_0x3c8008[_0xb5a1('0x72')]===_0xb5a1('0x98')){_0x39462e['where'](_0x3c8008[_0xb5a1('0x72')]+_0xb5a1('0x99'),_0x3b5eda[_0xb5a1('0x9a')],_0x3b5eda['endDate']);}else{_0x39462e[_0xb5a1('0x40')](_0x3c8008[_0xb5a1('0x72')]+_0xb5a1('0x9b'),_0x3b5eda[_0xb5a1('0x9a')],_0x3b5eda[_0xb5a1('0x9c')]);}if(_0x3f84c0){logger[_0xb5a1('0x9d')]('Run\x20Query:',_0x39462e['toString']());require(_0xb5a1('0x9e'))[_0xb5a1('0x9f')](path[_0xb5a1('0x56')](__dirname,_0xb5a1('0xa0'),_0x3f84c0[_0xb5a1('0x90')]),[_0x3f84c0['id'],_0x39462e['toString'](),path[_0xb5a1('0x56')](__dirname,_0xb5a1('0xa1'),_0x3f84c0[_0xb5a1('0xa2')]),_0x3398a7]);return _0x3f84c0;}else{var _0x19446c=squel[_0xb5a1('0x71')]();_0x19446c['from']('('+_0x39462e['toString']()+')','countTable');_0x19446c[_0xb5a1('0x75')](_0xb5a1('0xa3'),'count');_0x39462e[_0xb5a1('0x21')](_0x3b5eda[_0xb5a1('0x21')]||_0x48ef7e);_0x39462e[_0xb5a1('0x20')](_0x3b5eda[_0xb5a1('0x20')]||0x0);return dbH[_0xb5a1('0x86')][_0xb5a1('0x36')](_0x19446c[_0xb5a1('0x85')](),{'type':dbH['sequelize'][_0xb5a1('0x87')][_0xb5a1('0x88')]})[_0xb5a1('0x26')](function(_0x25c030){if(!_0x25c030[_0xb5a1('0x3b')]){_0x1258ea=0x0;}else{_0x1258ea=_0x25c030[0x0][_0xb5a1('0x1f')]||0x0;}return dbH['sequelize']['query'](_0x39462e[_0xb5a1('0x85')](),{'type':dbH[_0xb5a1('0x86')][_0xb5a1('0x87')][_0xb5a1('0x88')]});})[_0xb5a1('0x26')](function(_0x33eb44){return{'rows':_0x33eb44||[],'count':_0x1258ea};});}});}exports[_0xb5a1('0xa4')]=function(_0x5c8912,_0x3840a8){return runReport(_0x5c8912[_0xb5a1('0x49')],_0x5c8912[_0xb5a1('0x36')],_0x5c8912['options'])[_0xb5a1('0x26')](respondWithResult(_0x3840a8,null))[_0xb5a1('0x47')](handleError(_0x3840a8,null));};exports[_0xb5a1('0xa5')]=runReport;exports[_0xb5a1('0x36')]=function(_0x5dfb61,_0x5c5c4e){var _0xe83ef5=0xa;var _0x17fa6e=[_0xb5a1('0x56'),'left_join',_0xb5a1('0x58'),_0xb5a1('0x89')];var _0x466238={'SUM':_0xb5a1('0x8a'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb5a1('0x5a'),'MAX':_0xb5a1('0x5b'),'MIN':'MIN(%s)','AVG':_0xb5a1('0x5d'),'GROUP_CONCAT':_0xb5a1('0x5e'),'GROUP_CONCAT ASC':_0xb5a1('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1db6a7={'SEC_TO_TIME':_0xb5a1('0x61'),'DATE':_0xb5a1('0xa6'),'HOUR':_0xb5a1('0xa7'),'ROUND':_0xb5a1('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x31ef40=function(_0x5aaa6d){return!_[_0xb5a1('0x8b')]([_0xb5a1('0x8c'),_0xb5a1('0x64'),_0xb5a1('0x65'),_0xb5a1('0x66')],_0x5aaa6d);};var _0x161e05=function(_0x391a83){if(!_0x391a83||!_0x391a83[_0xb5a1('0x67')][_0xb5a1('0x3b')]){return'';}for(var _0x3969f7='(',_0x2a9ba9=0x0;_0x2a9ba9<_0x391a83['rules'][_0xb5a1('0x3b')];_0x2a9ba9+=0x1){_0x2a9ba9>0x0&&(_0x3969f7+='\x20'+_0x391a83[_0xb5a1('0x68')]+'\x20');_0x3969f7+=_0x391a83[_0xb5a1('0x67')][_0x2a9ba9][_0xb5a1('0x69')]?_0x161e05(_0x391a83[_0xb5a1('0x67')][_0x2a9ba9][_0xb5a1('0x69')]):_0x391a83['rules'][_0x2a9ba9]['field']+'\x20'+_0x391a83[_0xb5a1('0x67')][_0x2a9ba9][_0xb5a1('0x6a')]+(_0x31ef40(_0x391a83[_0xb5a1('0x67')][_0x2a9ba9]['condition'])?'\x20'+_0x391a83[_0xb5a1('0x67')][_0x2a9ba9][_0xb5a1('0x6b')]:'');}return _0x3969f7+')';};var _0x540dcd={'where':{'id':_0x5dfb61[_0xb5a1('0x49')]['id']}},_0x4dd37d,_0x1e882d,_0x1fd3a2,_0x32afd0,_0x4e152a;_0x540dcd=_['merge']({},_0x540dcd,_0x5dfb61['options']);return db[_0xb5a1('0x31')][_0xb5a1('0x4b')](_0x540dcd)[_0xb5a1('0x26')](function(_0x53836f){if(_0x53836f){_0x4dd37d=_0x53836f;return _0x53836f[_0xb5a1('0xa8')]();}return null;})[_0xb5a1('0x26')](function(_0x57f309){if(_0x57f309){if(!_0x57f309[_0xb5a1('0x3b')]){throw new db['Sequelize'][(_0xb5a1('0x6d'))](_0xb5a1('0x6e'),0x193);}_0x1e882d=_0x57f309;return db[_0xb5a1('0x6f')][_0xb5a1('0x46')]({'raw':!![]});}return null;})['then'](function(_0x3df21a){if(_0x3df21a){_0x1fd3a2=_[_0xb5a1('0x70')](_0x3df21a,'id');var _0x15d119;var _0x150028=squel[_0xb5a1('0x71')]();_0x150028[_0xb5a1('0x8d')](_0x4dd37d[_0xb5a1('0x72')]);for(var _0x3961ca=0x0;_0x3961ca<_0x1e882d[_0xb5a1('0x3b')];_0x3961ca+=0x1){_0x15d119=_0x1e882d[_0x3961ca]['MetricId']?_0x1fd3a2[_0x1e882d[_0x3961ca][_0xb5a1('0x73')]]['metric']:_0x1e882d[_0x3961ca][_0xb5a1('0x75')];_0x15d119=_0x1e882d[_0x3961ca][_0xb5a1('0x76')]?_[_0xb5a1('0x78')](_0x466238[_0x1e882d[_0x3961ca][_0xb5a1('0x76')]],'%s',_0x15d119):_0x15d119;_0x15d119=_0x1e882d[_0x3961ca][_0xb5a1('0x77')]?_[_0xb5a1('0x78')](_0x1db6a7[_0x1e882d[_0x3961ca][_0xb5a1('0x77')]],'%s',_0x15d119):_0x15d119;if(_0x1e882d[_0x3961ca][_0xb5a1('0x79')]){_0x150028['group'](_0x15d119);}_0x1e882d[_0x3961ca]['orderBy']&&_0x150028['order'](_0x15d119,_0x1e882d[_0x3961ca][_0xb5a1('0x7a')]==='DESC'?![]:!![]);_0x150028[_0xb5a1('0x75')](_0x15d119,_0x1e882d[_0x3961ca][_0xb5a1('0x7b')]||_0x15d119);}if(_0x4dd37d[_0xb5a1('0x7c')]){_0x4dd37d[_0xb5a1('0x7c')]=JSON['parse'](_0x4dd37d['joins']);for(var _0x375695=0x0;_0x375695<_0x4dd37d[_0xb5a1('0x7c')]['length'];_0x375695+=0x1){if(_0x4dd37d[_0xb5a1('0x7c')][_0x375695][_0xb5a1('0x33')]&&_[_0xb5a1('0x8b')](_0x17fa6e,_0x4dd37d['joins'][_0x375695][_0xb5a1('0x33')])&&_0x4dd37d['joins'][_0x375695][_0xb5a1('0x7d')]&&_0x4dd37d['joins'][_0x375695][_0xb5a1('0x7f')]&&_0x4dd37d[_0xb5a1('0x7c')][_0x375695][_0xb5a1('0x7e')]){_0x150028[_0x4dd37d['joins'][_0x375695][_0xb5a1('0x33')]](_0x4dd37d[_0xb5a1('0x7c')][_0x375695]['foreignTable'],null,util['format'](_0xb5a1('0x80'),_0x4dd37d[_0xb5a1('0x72')],_0x4dd37d['joins'][_0x375695][_0xb5a1('0x7d')],_0x4dd37d[_0xb5a1('0x7c')][_0x375695][_0xb5a1('0x7f')],_0x4dd37d['joins'][_0x375695][_0xb5a1('0x7e')]));}}}if(_0x4dd37d['conditions']){_0x4dd37d[_0xb5a1('0x81')]=JSON[_0xb5a1('0x8f')](_0x4dd37d[_0xb5a1('0x81')]);_0x150028['where'](_0x161e05(_0x4dd37d[_0xb5a1('0x81')][_0xb5a1('0x69')]));}_0x4e152a=_0x150028[_0xb5a1('0x82')]();_0x150028[_0xb5a1('0x21')](_0xe83ef5);_0x150028[_0xb5a1('0x20')](0x0);logger[_0xb5a1('0x83')](_0xb5a1('0x84'),_0x150028[_0xb5a1('0x85')]());return dbH['sequelize']['query'](_0x150028[_0xb5a1('0x85')](),{'type':dbH[_0xb5a1('0x86')][_0xb5a1('0x87')]['SELECT']});}})['then'](function(){return{'sql':_0x4e152a[_0xb5a1('0x85')]()};})['then'](respondWithResult(_0x5c5c4e,null))[_0xb5a1('0x47')](handleError(_0x5c5c4e,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index a7734aa..0ffbfc6 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 _0x880d=['exports','AnalyticCustomReport','analytics_custom_reports','api','bluebird','path','rimraf','../../config/environment'];(function(_0x478e0f,_0x30362c){var _0x222b19=function(_0x455b5d){while(--_0x455b5d){_0x478e0f['push'](_0x478e0f['shift']());}};_0x222b19(++_0x30362c);}(_0x880d,0x16b));var _0xd880=function(_0xb875ee,_0x583042){_0xb875ee=_0xb875ee-0x0;var _0x4c7f3a=_0x880d[_0xb875ee];return _0x4c7f3a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd880('0x0'));var moment=require('moment');var BPromise=require(_0xd880('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd880('0x2'));var rimraf=require(_0xd880('0x3'));var config=require(_0xd880('0x4'));var attributes=require('./analyticCustomReport.attributes');module[_0xd880('0x5')]=function(_0x2e3cb9,_0x54b62b){return _0x2e3cb9['define'](_0xd880('0x6'),attributes,{'tableName':_0xd880('0x7'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8777=['bluebird','path','../../config/environment','./analyticCustomReport.attributes','exports','util','../../config/logger','api','moment'];(function(_0x3f2c28,_0xf9593b){var _0x2b942a=function(_0x4954d3){while(--_0x4954d3){_0x3f2c28['push'](_0x3f2c28['shift']());}};_0x2b942a(++_0xf9593b);}(_0x8777,0x1e2));var _0x7877=function(_0x19c829,_0x468e83){_0x19c829=_0x19c829-0x0;var _0x46be66=_0x8777[_0x19c829];return _0x46be66;};'use strict';var _=require('lodash');var util=require(_0x7877('0x0'));var logger=require(_0x7877('0x1'))(_0x7877('0x2'));var moment=require(_0x7877('0x3'));var BPromise=require(_0x7877('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7877('0x5'));var rimraf=require('rimraf');var config=require(_0x7877('0x6'));var attributes=require(_0x7877('0x7'));module[_0x7877('0x8')]=function(_0x2950d7,_0x3d22b2){return _0x2950d7['define']('AnalyticCustomReport',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 b926666..474a4a1 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 _0xfa9f=['../../config/utils','rpc','../../config/environment','client','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x3d71c5,_0x573747){var _0x5d0e9d=function(_0x1efb62){while(--_0x1efb62){_0x3d71c5['push'](_0x3d71c5['shift']());}};_0x5d0e9d(++_0x573747);}(_0xfa9f,0x93));var _0xffa9=function(_0x4ef734,_0x5826d){_0x4ef734=_0x4ef734-0x0;var _0x33a7cb=_0xfa9f[_0x4ef734];return _0x33a7cb;};'use strict';var _=require('lodash');var util=require(_0xffa9('0x0'));var moment=require(_0xffa9('0x1'));var BPromise=require(_0xffa9('0x2'));var rs=require(_0xffa9('0x3'));var fs=require('fs');var Redis=require(_0xffa9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xffa9('0x5'));var logger=require('../../config/logger')(_0xffa9('0x6'));var config=require(_0xffa9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xffa9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4948c0,_0x1fe01a,_0x1fe931){return new BPromise(function(_0x249501,_0x13c3d0){return client['request'](_0x4948c0,_0x1fe931)[_0xffa9('0x9')](function(_0x1685c7){logger[_0xffa9('0xa')](_0xffa9('0xb'),_0x1fe01a,_0xffa9('0xc'));logger[_0xffa9('0xd')](_0xffa9('0xe'),_0x1fe01a,_0xffa9('0xc'),JSON[_0xffa9('0xf')](_0x1685c7));if(_0x1685c7[_0xffa9('0x10')]){if(_0x1685c7[_0xffa9('0x10')]['code']===0x1f4){logger[_0xffa9('0x10')](_0xffa9('0xb'),_0x1fe01a,_0x1685c7[_0xffa9('0x10')][_0xffa9('0x11')]);return _0x13c3d0(_0x1685c7[_0xffa9('0x10')][_0xffa9('0x11')]);}logger[_0xffa9('0x10')](_0xffa9('0xb'),_0x1fe01a,_0x1685c7[_0xffa9('0x10')][_0xffa9('0x11')]);return _0x249501(_0x1685c7['error'][_0xffa9('0x11')]);}else{logger['info'](_0xffa9('0xb'),_0x1fe01a,_0xffa9('0xc'));_0x249501(_0x1685c7['result'][_0xffa9('0x11')]);}})[_0xffa9('0x12')](function(_0x1ce6c3){logger['error'](_0xffa9('0xb'),_0x1fe01a,_0x1ce6c3);_0x13c3d0(_0x1ce6c3);});});} \ No newline at end of file +var _0xdd1d=['debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd1d,0xf7));var _0xddd1=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xdd1d[_0x3c8e9a];return _0x2d4c57;};'use strict';var _=require(_0xddd1('0x0'));var util=require(_0xddd1('0x1'));var moment=require(_0xddd1('0x2'));var BPromise=require(_0xddd1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xddd1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xddd1('0x5'))(_0xddd1('0x6'));var config=require(_0xddd1('0x7'));var jayson=require(_0xddd1('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x304806,_0x5d4ebc,_0x5469e1){return new BPromise(function(_0xbca7e5,_0x2d2785){return client[_0xddd1('0x9')](_0x304806,_0x5469e1)[_0xddd1('0xa')](function(_0x44a929){logger['info'](_0xddd1('0xb'),_0x5d4ebc,_0xddd1('0xc'));logger[_0xddd1('0xd')](_0xddd1('0xe'),_0x5d4ebc,_0xddd1('0xc'),JSON['stringify'](_0x44a929));if(_0x44a929[_0xddd1('0xf')]){if(_0x44a929[_0xddd1('0xf')][_0xddd1('0x10')]===0x1f4){logger[_0xddd1('0xf')](_0xddd1('0xb'),_0x5d4ebc,_0x44a929[_0xddd1('0xf')][_0xddd1('0x11')]);return _0x2d2785(_0x44a929['error'][_0xddd1('0x11')]);}logger[_0xddd1('0xf')](_0xddd1('0xb'),_0x5d4ebc,_0x44a929[_0xddd1('0xf')][_0xddd1('0x11')]);return _0xbca7e5(_0x44a929[_0xddd1('0xf')][_0xddd1('0x11')]);}else{logger[_0xddd1('0x12')](_0xddd1('0xb'),_0x5d4ebc,_0xddd1('0xc'));_0xbca7e5(_0x44a929[_0xddd1('0x13')][_0xddd1('0x11')]);}})['catch'](function(_0x3e2bf5){logger['error'](_0xddd1('0xb'),_0x5d4ebc,_0x3e2bf5);_0x2d2785(_0x3e2bf5);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 406d453..101e944 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 _0x9637=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','run','/:id/query','query','create','put','/:id'];(function(_0xde494a,_0x316794){var _0x40c0c5=function(_0x406ac9){while(--_0x406ac9){_0xde494a['push'](_0xde494a['shift']());}};_0x40c0c5(++_0x316794);}(_0x9637,0x194));var _0x7963=function(_0x311d54,_0x1c2458){_0x311d54=_0x311d54-0x0;var _0x200c2b=_0x9637[_0x311d54];return _0x200c2b;};'use strict';var multer=require(_0x7963('0x0'));var util=require('util');var path=require(_0x7963('0x1'));var timeout=require(_0x7963('0x2'));var express=require(_0x7963('0x3'));var router=express[_0x7963('0x4')]();var auth=require(_0x7963('0x5'));var interaction=require(_0x7963('0x6'));var config=require(_0x7963('0x7'));var controller=require('./analyticCustomReport.controller');router[_0x7963('0x8')]('/',auth[_0x7963('0x9')](),controller[_0x7963('0xa')]);router['get']('/:id',auth[_0x7963('0x9')](),controller[_0x7963('0xb')]);router[_0x7963('0x8')](_0x7963('0xc'),auth[_0x7963('0x9')](),controller[_0x7963('0xd')]);router['get'](_0x7963('0xe'),auth[_0x7963('0x9')](),controller[_0x7963('0xf')]);router['get'](_0x7963('0x10'),auth[_0x7963('0x9')](),controller[_0x7963('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7963('0x12')]);router[_0x7963('0x13')](_0x7963('0x14'),auth[_0x7963('0x9')](),controller[_0x7963('0x15')]);router[_0x7963('0x16')](_0x7963('0x14'),auth[_0x7963('0x9')](),controller[_0x7963('0x17')]);module[_0x7963('0x18')]=router; \ No newline at end of file +var _0x0788=['exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','/:id/preview','preview','run','/:id/query','query','post','put','update','delete','destroy'];(function(_0x5ae8f1,_0x58098e){var _0x4ac982=function(_0x469656){while(--_0x469656){_0x5ae8f1['push'](_0x5ae8f1['shift']());}};_0x4ac982(++_0x58098e);}(_0x0788,0x191));var _0x8078=function(_0x30b457,_0x5f2c58){_0x30b457=_0x30b457-0x0;var _0x8133ee=_0x0788[_0x30b457];return _0x8133ee;};'use strict';var multer=require(_0x8078('0x0'));var util=require(_0x8078('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8078('0x2'));var router=express[_0x8078('0x3')]();var auth=require(_0x8078('0x4'));var interaction=require(_0x8078('0x5'));var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0x8078('0x6')]('/',auth[_0x8078('0x7')](),controller['index']);router[_0x8078('0x6')](_0x8078('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x8078('0x6')](_0x8078('0x9'),auth[_0x8078('0x7')](),controller[_0x8078('0xa')]);router[_0x8078('0x6')]('/:id/run',auth['isAuthenticated'](),controller[_0x8078('0xb')]);router[_0x8078('0x6')](_0x8078('0xc'),auth['isAuthenticated'](),controller[_0x8078('0xd')]);router[_0x8078('0xe')]('/',auth[_0x8078('0x7')](),controller['create']);router[_0x8078('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8078('0x10')]);router[_0x8078('0x11')](_0x8078('0x8'),auth[_0x8078('0x7')](),controller[_0x8078('0x12')]);module[_0x8078('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 2331431..6738740 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 _0x91ec=['STRING','TEXT','sequelize'];(function(_0x4a5da9,_0x54e522){var _0x2709d2=function(_0x4a8ae0){while(--_0x4a8ae0){_0x4a5da9['push'](_0x4a5da9['shift']());}};_0x2709d2(++_0x54e522);}(_0x91ec,0x9b));var _0xc91e=function(_0x265d85,_0x2038ef){_0x265d85=_0x265d85-0x0;var _0xc49b38=_0x91ec[_0x265d85];return _0xc49b38;};'use strict';var Sequelize=require(_0xc91e('0x0'));module['exports']={'name':{'type':Sequelize[_0xc91e('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc91e('0x1')]},'parent':{'type':Sequelize[_0xc91e('0x1')]},'table':{'type':Sequelize[_0xc91e('0x1')]},'conditions':{'type':Sequelize[_0xc91e('0x2')]},'joins':{'type':Sequelize[_0xc91e('0x2')]}}; \ No newline at end of file +var _0xbc4c=['TEXT','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc4c,0x69));var _0xcbc4=function(_0x21de89,_0x367053){_0x21de89=_0x21de89-0x0;var _0x290b7e=_0xbc4c[_0x21de89];return _0x290b7e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcbc4('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xcbc4('0x0')]},'parent':{'type':Sequelize[_0xcbc4('0x0')]},'table':{'type':Sequelize[_0xcbc4('0x0')]},'conditions':{'type':Sequelize[_0xcbc4('0x1')]},'joins':{'type':Sequelize[_0xcbc4('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 026b58f..d11362f 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 _0x0e1f=['limit','status','Content-Range','reject','update','destroy','then','get','end','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','condition','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','table','MetricId','metric','function','replace','format','groupBy','order','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20EMPTY','value','getFields','from','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','COUNT(*)','QueryTypes','SELECT','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','dbH','sendStatus','json','offset'];(function(_0x1be3b9,_0x2f2a3b){var _0x94d4a7=function(_0x3cb2b9){while(--_0x3cb2b9){_0x1be3b9['push'](_0x1be3b9['shift']());}};_0x94d4a7(++_0x2f2a3b);}(_0x0e1f,0x87));var _0xf0e1=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0e1f[_0x432682];return _0x463d05;};'use strict';var pdf=require(_0xf0e1('0x0'));var emlformat=require(_0xf0e1('0x1'));var rimraf=require(_0xf0e1('0x2'));var zipdir=require(_0xf0e1('0x3'));var jsonpatch=require(_0xf0e1('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0e1('0x5'));var Mustache=require(_0xf0e1('0x6'));var util=require(_0xf0e1('0x7'));var path=require(_0xf0e1('0x8'));var sox=require(_0xf0e1('0x9'));var csv=require(_0xf0e1('0xa'));var ejs=require(_0xf0e1('0xb'));var fs=require('fs');var _=require(_0xf0e1('0xc'));var squel=require(_0xf0e1('0xd'));var crypto=require(_0xf0e1('0xe'));var jsforce=require(_0xf0e1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf0e1('0xa'));var querystring=require(_0xf0e1('0x10'));var Papa=require(_0xf0e1('0x11'));var Redis=require(_0xf0e1('0x12'));var authService=require(_0xf0e1('0x13'));var qs=require(_0xf0e1('0x14'));var as=require(_0xf0e1('0x15'));var hardwareService=require(_0xf0e1('0x16'));var logger=require(_0xf0e1('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xf0e1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf0e1('0x19'))['db'];var dbH=require(_0xf0e1('0x19'))[_0xf0e1('0x1a')];function respondWithStatusCode(_0x5e5556,_0x12df18){_0x12df18=_0x12df18||0xcc;return function(_0x3e0c28){if(_0x3e0c28){return _0x5e5556[_0xf0e1('0x1b')](_0x12df18);}return _0x5e5556['status'](_0x12df18)['end']();};}function respondWithResult(_0x19afbb,_0xe2d1b9){_0xe2d1b9=_0xe2d1b9||0xc8;return function(_0x176535){if(_0x176535){return _0x19afbb['status'](_0xe2d1b9)[_0xf0e1('0x1c')](_0x176535);}};}function respondWithFilteredResult(_0x463f26,_0x5cbc5c){return function(_0x300bcd){if(_0x300bcd){var _0x51feb4=_0x300bcd['count'],_0x23dd40=_0x5cbc5c[_0xf0e1('0x1d')],_0x490565=_0x5cbc5c[_0xf0e1('0x1d')]+_0x5cbc5c[_0xf0e1('0x1e')],_0x4bf0be;if(_0x490565>=_0x51feb4){_0x490565=_0x51feb4;_0x4bf0be=0xc8;}else{_0x4bf0be=0xce;}_0x463f26[_0xf0e1('0x1f')](_0x4bf0be);return _0x463f26['set'](_0xf0e1('0x20'),_0x23dd40+'-'+_0x490565+'/'+_0x51feb4)['json'](_0x300bcd);}return null;};}function patchUpdates(_0x5da7e5){return function(_0x33662b){try{jsonpatch['apply'](_0x33662b,_0x5da7e5,!![]);}catch(_0x583e32){return BPromise[_0xf0e1('0x21')](_0x583e32);}return _0x33662b['save']();};}function saveUpdates(_0x2dcb90,_0x370c40){return function(_0x277786){if(_0x277786){return _0x277786[_0xf0e1('0x22')](_0x2dcb90)['then'](function(_0x4ebdf4){return _0x4ebdf4;});}return null;};}function removeEntity(_0x418e8a,_0xa3865){return function(_0x4dca79){if(_0x4dca79){return _0x4dca79[_0xf0e1('0x23')]()[_0xf0e1('0x24')](function(){var _0xc71b98=_0x4dca79[_0xf0e1('0x25')]({'plain':!![]});var _0x2872e0='DefaultReports';return db['UserProfileResource'][_0xf0e1('0x23')]({'where':{'type':_0x2872e0,'resourceId':_0xc71b98['id']}})[_0xf0e1('0x24')](function(){return _0x4dca79;});})[_0xf0e1('0x24')](function(){_0x418e8a[_0xf0e1('0x1f')](0xcc)[_0xf0e1('0x26')]();});}};}function handleEntityNotFound(_0x339968,_0x2e1c40){return function(_0x2c8234){if(!_0x2c8234){_0x339968['sendStatus'](0x194);}return _0x2c8234;};}function handleError(_0x65ccf6,_0x10c30e){_0x10c30e=_0x10c30e||0x1f4;return function(_0x1c5b47){logger['error'](_0x1c5b47['stack']);if(_0x1c5b47['name']){delete _0x1c5b47[_0xf0e1('0x27')];}_0x65ccf6[_0xf0e1('0x1f')](_0x10c30e)[_0xf0e1('0x28')](_0x1c5b47);};}exports[_0xf0e1('0x29')]=function(_0x154a57,_0x4f261d){var _0x3bd47d={},_0x42acc5={},_0x3002a2={'count':0x0,'rows':[]};var _0x2e20a0=_[_0xf0e1('0x2a')](db[_0xf0e1('0x2b')][_0xf0e1('0x2c')],function(_0x2ed812){return{'name':_0x2ed812[_0xf0e1('0x2d')],'type':_0x2ed812[_0xf0e1('0x2e')][_0xf0e1('0x2f')]};});_0x42acc5[_0xf0e1('0x30')]=_[_0xf0e1('0x2a')](_0x2e20a0,'name');_0x42acc5[_0xf0e1('0x31')]=_[_0xf0e1('0x32')](_0x154a57[_0xf0e1('0x31')]);_0x42acc5[_0xf0e1('0x33')]=_[_0xf0e1('0x34')](_0x42acc5[_0xf0e1('0x30')],_0x42acc5[_0xf0e1('0x31')]);_0x3bd47d[_0xf0e1('0x35')]=_[_0xf0e1('0x34')](_0x42acc5['model'],qs[_0xf0e1('0x36')](_0x154a57[_0xf0e1('0x31')][_0xf0e1('0x36')]));_0x3bd47d['attributes']=_0x3bd47d[_0xf0e1('0x35')][_0xf0e1('0x37')]?_0x3bd47d[_0xf0e1('0x35')]:_0x42acc5[_0xf0e1('0x30')];if(!_0x154a57[_0xf0e1('0x31')][_0xf0e1('0x38')](_0xf0e1('0x39'))){_0x3bd47d[_0xf0e1('0x1e')]=qs[_0xf0e1('0x1e')](_0x154a57[_0xf0e1('0x31')][_0xf0e1('0x1e')]);_0x3bd47d['offset']=qs[_0xf0e1('0x1d')](_0x154a57[_0xf0e1('0x31')]['offset']);}_0x3bd47d['order']=qs['sort'](_0x154a57[_0xf0e1('0x31')][_0xf0e1('0x3a')]);_0x3bd47d[_0xf0e1('0x3b')]=qs[_0xf0e1('0x33')](_[_0xf0e1('0x3c')](_0x154a57[_0xf0e1('0x31')],_0x42acc5[_0xf0e1('0x33')]),_0x2e20a0);if(_0x154a57[_0xf0e1('0x31')][_0xf0e1('0x3d')]){_0x3bd47d['where']=_['merge'](_0x3bd47d[_0xf0e1('0x3b')],{'$or':_[_0xf0e1('0x2a')](_0x2e20a0,function(_0x274349){if(_0x274349['type']!==_0xf0e1('0x3e')){var _0x33df0d={};_0x33df0d[_0x274349[_0xf0e1('0x27')]]={'$like':'%'+_0x154a57[_0xf0e1('0x31')][_0xf0e1('0x3d')]+'%'};return _0x33df0d;}})});}_0x3bd47d=_[_0xf0e1('0x3f')]({},_0x3bd47d,_0x154a57[_0xf0e1('0x40')]);var _0x3b5b1e={'where':_0x3bd47d['where']};return db[_0xf0e1('0x2b')][_0xf0e1('0x41')](_0x3b5b1e)[_0xf0e1('0x24')](function(_0x29a098){_0x3002a2['count']=_0x29a098;if(_0x154a57[_0xf0e1('0x31')][_0xf0e1('0x42')]){_0x3bd47d[_0xf0e1('0x43')]=[{'all':!![]}];}return db['AnalyticDefaultReport']['findAll'](_0x3bd47d);})[_0xf0e1('0x24')](function(_0x2cb3cf){_0x3002a2[_0xf0e1('0x44')]=_0x2cb3cf;return _0x3002a2;})[_0xf0e1('0x24')](respondWithFilteredResult(_0x4f261d,_0x3bd47d))[_0xf0e1('0x45')](handleError(_0x4f261d,null));};exports[_0xf0e1('0x46')]=function(_0x4e70a5,_0x40f14d){var _0x447db6={'raw':!![],'where':{'id':_0x4e70a5['params']['id']}},_0x31d0b2={};_0x31d0b2[_0xf0e1('0x30')]=_[_0xf0e1('0x32')](db[_0xf0e1('0x2b')]['rawAttributes']);_0x31d0b2[_0xf0e1('0x31')]=_[_0xf0e1('0x32')](_0x4e70a5[_0xf0e1('0x31')]);_0x31d0b2[_0xf0e1('0x33')]=_[_0xf0e1('0x34')](_0x31d0b2['model'],_0x31d0b2[_0xf0e1('0x31')]);_0x447db6['attributes']=_[_0xf0e1('0x34')](_0x31d0b2[_0xf0e1('0x30')],qs[_0xf0e1('0x36')](_0x4e70a5['query'][_0xf0e1('0x36')]));_0x447db6[_0xf0e1('0x35')]=_0x447db6['attributes']['length']?_0x447db6[_0xf0e1('0x35')]:_0x31d0b2[_0xf0e1('0x30')];if(_0x4e70a5['query'][_0xf0e1('0x42')]){_0x447db6['include']=[{'all':!![]}];}_0x447db6=_['merge']({},_0x447db6,_0x4e70a5[_0xf0e1('0x40')]);return db['AnalyticDefaultReport']['find'](_0x447db6)[_0xf0e1('0x24')](handleEntityNotFound(_0x40f14d,null))[_0xf0e1('0x24')](respondWithResult(_0x40f14d,null))[_0xf0e1('0x45')](handleError(_0x40f14d,null));};exports['create']=function(_0xadd613,_0x202ba1){return db['AnalyticDefaultReport'][_0xf0e1('0x47')](_0xadd613[_0xf0e1('0x48')],{})[_0xf0e1('0x24')](function(_0x2157d4){var _0x4108b7=_0xadd613[_0xf0e1('0x49')]['get']({'plain':!![]});if(!_0x4108b7)throw new Error(_0xf0e1('0x4a'));if(_0x4108b7['role']===_0xf0e1('0x49')){var _0x213820=_0x2157d4[_0xf0e1('0x25')]({'plain':!![]});var _0x1db03e=_0xf0e1('0x4b');return db[_0xf0e1('0x4c')][_0xf0e1('0x4d')]({'where':{'name':_0x1db03e,'userProfileId':_0x4108b7['userProfileId']},'raw':!![]})[_0xf0e1('0x24')](function(_0x476428){if(_0x476428&&_0x476428[_0xf0e1('0x4e')]===0x0){return db['UserProfileResource'][_0xf0e1('0x47')]({'name':_0x213820[_0xf0e1('0x27')],'resourceId':_0x213820['id'],'type':'DefaultReports','sectionId':_0x476428['id']},{})[_0xf0e1('0x24')](function(){return _0x2157d4;});}else{return _0x2157d4;}})[_0xf0e1('0x45')](function(_0x43f07b){logger[_0xf0e1('0x4f')](_0xf0e1('0x50'),_0x43f07b);throw _0x43f07b;});}return _0x2157d4;})[_0xf0e1('0x24')](respondWithResult(_0x202ba1,0xc9))[_0xf0e1('0x45')](handleError(_0x202ba1,null));};exports[_0xf0e1('0x22')]=function(_0x157e63,_0x521fbd){if(_0x157e63[_0xf0e1('0x48')]['id']){delete _0x157e63[_0xf0e1('0x48')]['id'];}return db[_0xf0e1('0x2b')][_0xf0e1('0x4d')]({'where':{'id':_0x157e63[_0xf0e1('0x51')]['id']}})[_0xf0e1('0x24')](handleEntityNotFound(_0x521fbd,null))[_0xf0e1('0x24')](saveUpdates(_0x157e63[_0xf0e1('0x48')],null))[_0xf0e1('0x24')](respondWithResult(_0x521fbd,null))[_0xf0e1('0x45')](handleError(_0x521fbd,null));};exports['destroy']=function(_0xa7d8e1,_0x2bcad8){return db['AnalyticDefaultReport']['find']({'where':{'id':_0xa7d8e1[_0xf0e1('0x51')]['id']}})['then'](handleEntityNotFound(_0x2bcad8,null))['then'](removeEntity(_0x2bcad8,null))[_0xf0e1('0x45')](handleError(_0x2bcad8,null));};exports[_0xf0e1('0x52')]=function(_0x1b8970,_0x24cc6d){var _0x7258c9=0xa;var _0x2a351e=[_0xf0e1('0x53'),_0xf0e1('0x54'),_0xf0e1('0x55'),_0xf0e1('0x56')];var _0x1d845b={'SUM':_0xf0e1('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xf0e1('0x58'),'MAX':_0xf0e1('0x59'),'MIN':'MIN(%s)','AVG':_0xf0e1('0x5a'),'GROUP_CONCAT':_0xf0e1('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3227a4={'SEC_TO_TIME':_0xf0e1('0x5c'),'DATE':_0xf0e1('0x5d'),'HOUR':_0xf0e1('0x5e'),'ROUND':_0xf0e1('0x5f'),'UNIX_TIMESTAMP':_0xf0e1('0x60')};var _0x269a4d=function(_0x2ee5b0){return!_['includes']([_0xf0e1('0x61'),_0xf0e1('0x62'),_0xf0e1('0x63'),'IS\x20NOT\x20EMPTY'],_0x2ee5b0);};var _0x3ac54c=function(_0x53b0f6){if(!_0x53b0f6||!_0x53b0f6[_0xf0e1('0x64')][_0xf0e1('0x37')]){return'';}for(var _0x92a691='(',_0x2d5bfa=0x0;_0x2d5bfa<_0x53b0f6[_0xf0e1('0x64')][_0xf0e1('0x37')];_0x2d5bfa+=0x1){_0x2d5bfa>0x0&&(_0x92a691+='\x20'+_0x53b0f6['operator']+'\x20');_0x92a691+=_0x53b0f6[_0xf0e1('0x64')][_0x2d5bfa][_0xf0e1('0x65')]?_0x3ac54c(_0x53b0f6[_0xf0e1('0x64')][_0x2d5bfa][_0xf0e1('0x65')]):_0x53b0f6['rules'][_0x2d5bfa][_0xf0e1('0x66')]+'\x20'+_0x53b0f6[_0xf0e1('0x64')][_0x2d5bfa]['condition']+(_0x269a4d(_0x53b0f6[_0xf0e1('0x64')][_0x2d5bfa][_0xf0e1('0x67')])?'\x20'+_0x53b0f6[_0xf0e1('0x64')][_0x2d5bfa]['value']:'');}return _0x92a691+')';};var _0x1a5f5d={'where':{'id':_0x1b8970[_0xf0e1('0x51')]['id']}},_0x76d25b,_0x1f7c27,_0x3b516b,_0x16aaa0,_0x28321a;_0x1a5f5d=_[_0xf0e1('0x3f')]({},_0x1a5f5d,_0x1b8970['options']);return db['AnalyticDefaultReport'][_0xf0e1('0x4d')](_0x1a5f5d)[_0xf0e1('0x24')](function(_0x108b01){if(_0x108b01){_0x76d25b=_0x108b01;return _0x108b01['getFields']();}return null;})[_0xf0e1('0x24')](function(_0x640abb){if(_0x640abb){if(!_0x640abb[_0xf0e1('0x37')]){throw new db[(_0xf0e1('0x68'))][(_0xf0e1('0x69'))](_0xf0e1('0x6a'),0x193);}_0x1f7c27=_0x640abb;return db[_0xf0e1('0x6b')][_0xf0e1('0x6c')]({'raw':!![]});}return null;})['then'](function(_0x48269b){if(_0x48269b){_0x3b516b=_[_0xf0e1('0x6d')](_0x48269b,'id');var _0x4ab415;var _0x2576f2=squel[_0xf0e1('0x6e')]();_0x2576f2['from'](_0x76d25b[_0xf0e1('0x6f')]);for(var _0xb79120=0x0;_0xb79120<_0x1f7c27['length'];_0xb79120+=0x1){_0x4ab415=_0x1f7c27[_0xb79120][_0xf0e1('0x70')]?_0x3b516b[_0x1f7c27[_0xb79120][_0xf0e1('0x70')]][_0xf0e1('0x71')]:_0x1f7c27[_0xb79120]['field'];_0x4ab415=_0x1f7c27[_0xb79120][_0xf0e1('0x72')]?_['replace'](_0x1d845b[_0x1f7c27[_0xb79120][_0xf0e1('0x72')]],'%s',_0x4ab415):_0x4ab415;_0x4ab415=_0x1f7c27[_0xb79120]['format']?_[_0xf0e1('0x73')](_0x3227a4[_0x1f7c27[_0xb79120][_0xf0e1('0x74')]],'%s',_0x4ab415):_0x4ab415;if(_0x1f7c27[_0xb79120][_0xf0e1('0x75')]){_0x2576f2[_0xf0e1('0x65')](_0x4ab415);}_0x1f7c27[_0xb79120]['orderBy']&&_0x2576f2[_0xf0e1('0x76')](_0x4ab415,_0x1f7c27[_0xb79120][_0xf0e1('0x77')]===_0xf0e1('0x78')?![]:!![]);_0x2576f2[_0xf0e1('0x66')](_0x4ab415,_0x1f7c27[_0xb79120][_0xf0e1('0x79')]||_0x4ab415);}if(_0x76d25b[_0xf0e1('0x7a')]){_0x76d25b[_0xf0e1('0x7a')]=JSON[_0xf0e1('0x7b')](_0x76d25b['joins']);for(var _0x17269b=0x0;_0x17269b<_0x76d25b[_0xf0e1('0x7a')][_0xf0e1('0x37')];_0x17269b+=0x1){if(_0x76d25b[_0xf0e1('0x7a')][_0x17269b][_0xf0e1('0x2e')]&&_[_0xf0e1('0x7c')](_0x2a351e,_0x76d25b[_0xf0e1('0x7a')][_0x17269b][_0xf0e1('0x2e')])&&_0x76d25b[_0xf0e1('0x7a')][_0x17269b][_0xf0e1('0x7d')]&&_0x76d25b['joins'][_0x17269b][_0xf0e1('0x7e')]&&_0x76d25b[_0xf0e1('0x7a')][_0x17269b][_0xf0e1('0x7f')]){_0x2576f2[_0x76d25b[_0xf0e1('0x7a')][_0x17269b][_0xf0e1('0x2e')]](_0x76d25b[_0xf0e1('0x7a')][_0x17269b]['foreignTable'],null,util[_0xf0e1('0x74')](_0xf0e1('0x80'),_0x76d25b[_0xf0e1('0x6f')],_0x76d25b[_0xf0e1('0x7a')][_0x17269b][_0xf0e1('0x7d')],_0x76d25b[_0xf0e1('0x7a')][_0x17269b][_0xf0e1('0x7e')],_0x76d25b[_0xf0e1('0x7a')][_0x17269b][_0xf0e1('0x7f')]));}}}if(_0x76d25b[_0xf0e1('0x81')]){_0x76d25b[_0xf0e1('0x81')]=JSON['parse'](_0x76d25b[_0xf0e1('0x81')]);_0x2576f2[_0xf0e1('0x3b')](_0x3ac54c(_0x76d25b[_0xf0e1('0x81')][_0xf0e1('0x65')]));}_0x28321a=_0x2576f2['clone']();_0x2576f2['limit'](_0x7258c9);_0x2576f2['offset'](0x0);logger[_0xf0e1('0x82')](_0xf0e1('0x83'),_0x2576f2[_0xf0e1('0x84')]());return dbH[_0xf0e1('0x85')][_0xf0e1('0x31')](_0x2576f2['toString'](),{'type':dbH[_0xf0e1('0x85')]['QueryTypes']['SELECT']});}})[_0xf0e1('0x24')](respondWithResult(_0x24cc6d,null))['catch'](handleError(_0x24cc6d,null));};function runReport(_0x44b23c,_0x332599,_0x289dbc){var _0x136cea=_0x332599['name'];var _0x52c7b4=0xa;var _0x535b0f=[_0xf0e1('0x53'),'left_join',_0xf0e1('0x55'),_0xf0e1('0x56')];var _0x2039cb={'SUM':_0xf0e1('0x57'),'COUNT':_0xf0e1('0x86'),'COUNT DISTINCT':_0xf0e1('0x58'),'MAX':_0xf0e1('0x59'),'MIN':_0xf0e1('0x87'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf0e1('0x5b'),'GROUP_CONCAT ASC':_0xf0e1('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x534ef9={'SEC_TO_TIME':_0xf0e1('0x5c'),'DATE':_0xf0e1('0x5d'),'HOUR':_0xf0e1('0x5e'),'ROUND':_0xf0e1('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x12a065=function(_0x5a694b){return!_[_0xf0e1('0x7c')]([_0xf0e1('0x61'),_0xf0e1('0x62'),_0xf0e1('0x63'),_0xf0e1('0x89')],_0x5a694b);};var _0x37b052=function(_0x4a0ada){if(!_0x4a0ada||!_0x4a0ada['rules']['length']){return'';}for(var _0x324041='(',_0x134cb0=0x0;_0x134cb0<_0x4a0ada[_0xf0e1('0x64')]['length'];_0x134cb0+=0x1){_0x134cb0>0x0&&(_0x324041+='\x20'+_0x4a0ada['operator']+'\x20');_0x324041+=_0x4a0ada[_0xf0e1('0x64')][_0x134cb0]['group']?_0x37b052(_0x4a0ada[_0xf0e1('0x64')][_0x134cb0][_0xf0e1('0x65')]):_0x4a0ada[_0xf0e1('0x64')][_0x134cb0]['field']+'\x20'+_0x4a0ada[_0xf0e1('0x64')][_0x134cb0][_0xf0e1('0x67')]+(_0x12a065(_0x4a0ada['rules'][_0x134cb0][_0xf0e1('0x67')])?'\x20'+_0x4a0ada['rules'][_0x134cb0][_0xf0e1('0x8a')]:'');}return _0x324041+')';};var _0x383b41={'where':{'id':_0x44b23c['id']}},_0x4f4f78,_0x4a74ba,_0x248c50,_0x53700c,_0x3e3e9b;_0x383b41=_[_0xf0e1('0x3f')]({},_0x383b41,_0x289dbc);return db['AnalyticDefaultReport']['find'](_0x383b41)[_0xf0e1('0x24')](function(_0x41786f){if(_0x41786f){_0x4f4f78=_0x41786f;return _0x41786f[_0xf0e1('0x8b')]();}return null;})[_0xf0e1('0x24')](function(_0x37571d){if(_0x37571d){if(!_0x37571d['length']){throw new db[(_0xf0e1('0x68'))][(_0xf0e1('0x69'))](_0xf0e1('0x6a'),0x193);}_0x4a74ba=_0x37571d;return db[_0xf0e1('0x6b')]['findAll']({'raw':!![]});}return null;})[_0xf0e1('0x24')](function(_0xa25742){if(_0xa25742){_0x248c50=_['keyBy'](_0xa25742,'id');var _0x4c0422;var _0x220552=squel[_0xf0e1('0x6e')]();_0x220552[_0xf0e1('0x8c')](_0x4f4f78[_0xf0e1('0x6f')]);for(var _0x5072cf=0x0;_0x5072cf<_0x4a74ba[_0xf0e1('0x37')];_0x5072cf+=0x1){_0x4c0422=_0x4a74ba[_0x5072cf][_0xf0e1('0x70')]?_0x248c50[_0x4a74ba[_0x5072cf][_0xf0e1('0x70')]][_0xf0e1('0x71')]:_0x4a74ba[_0x5072cf][_0xf0e1('0x66')];_0x4c0422=_0x4a74ba[_0x5072cf][_0xf0e1('0x72')]?_[_0xf0e1('0x73')](_0x2039cb[_0x4a74ba[_0x5072cf]['function']],'%s',_0x4c0422):_0x4c0422;_0x4c0422=_0x4a74ba[_0x5072cf][_0xf0e1('0x74')]?_[_0xf0e1('0x73')](_0x534ef9[_0x4a74ba[_0x5072cf][_0xf0e1('0x74')]],'%s',_0x4c0422):_0x4c0422;if(_0x4a74ba[_0x5072cf]['groupBy']){_0x220552[_0xf0e1('0x65')](_0x4c0422);}_0x4a74ba[_0x5072cf]['orderBy']&&_0x220552['order'](_0x4c0422,_0x4a74ba[_0x5072cf][_0xf0e1('0x77')]===_0xf0e1('0x78')?![]:!![]);_0x220552[_0xf0e1('0x66')](_0x4c0422,_0x4a74ba[_0x5072cf][_0xf0e1('0x79')]||_0x4c0422);}if(_0x4f4f78[_0xf0e1('0x7a')]){_0x4f4f78[_0xf0e1('0x7a')]=JSON[_0xf0e1('0x7b')](_0x4f4f78['joins']);for(var _0x2ef116=0x0;_0x2ef116<_0x4f4f78[_0xf0e1('0x7a')][_0xf0e1('0x37')];_0x2ef116+=0x1){if(_0x4f4f78[_0xf0e1('0x7a')][_0x2ef116][_0xf0e1('0x2e')]&&_['includes'](_0x535b0f,_0x4f4f78['joins'][_0x2ef116]['type'])&&_0x4f4f78[_0xf0e1('0x7a')][_0x2ef116][_0xf0e1('0x7d')]&&_0x4f4f78['joins'][_0x2ef116][_0xf0e1('0x7e')]&&_0x4f4f78[_0xf0e1('0x7a')][_0x2ef116][_0xf0e1('0x7f')]){_0x220552[_0x4f4f78[_0xf0e1('0x7a')][_0x2ef116][_0xf0e1('0x2e')]](_0x4f4f78[_0xf0e1('0x7a')][_0x2ef116]['foreignTable'],null,util[_0xf0e1('0x74')](_0xf0e1('0x80'),_0x4f4f78[_0xf0e1('0x6f')],_0x4f4f78['joins'][_0x2ef116][_0xf0e1('0x7d')],_0x4f4f78['joins'][_0x2ef116][_0xf0e1('0x7e')],_0x4f4f78[_0xf0e1('0x7a')][_0x2ef116]['foreignKey']));}}}if(_0x4f4f78['conditions']){_0x4f4f78['conditions']=JSON[_0xf0e1('0x7b')](_0x4f4f78[_0xf0e1('0x81')]);_0x220552['where'](_0x37b052(_0x4f4f78[_0xf0e1('0x81')]['group']));}_0x3e3e9b=_0x220552[_0xf0e1('0x8d')]();_0x220552[_0xf0e1('0x1e')](_0x52c7b4);_0x220552[_0xf0e1('0x1d')](0x0);return;}})[_0xf0e1('0x24')](function(){if(_0x332599[_0xf0e1('0x8e')]===_0xf0e1('0x8f')){return null;}var _0x5ccfdc=_['merge'](_0x332599,{'name':_0x332599[_0xf0e1('0x90')]||_0x332599[_0xf0e1('0x27')]||_0x4f4f78[_0xf0e1('0x27')],'basename':_0x136cea,'savename':util[_0xf0e1('0x74')](_0xf0e1('0x91'),_0x332599['name']||_0x4f4f78[_0xf0e1('0x27')],require(_0xf0e1('0x92'))[_0xf0e1('0x93')](0x4),_0x332599[_0xf0e1('0x8e')]||_0xf0e1('0x94')),'reportId':_0x4f4f78['id'],'reportType':_0xf0e1('0x95')});return db[_0xf0e1('0x96')][_0xf0e1('0x47')](_0x5ccfdc,{'raw':!![]});})['then'](function(_0x4372c8){if(_0x4f4f78[_0xf0e1('0x6f')]==='cdr'){_0x3e3e9b['where'](_0x4f4f78['table']+_0xf0e1('0x97'),_0x332599['startDate'],_0x332599[_0xf0e1('0x98')]);}else{_0x3e3e9b[_0xf0e1('0x3b')](_0x4f4f78[_0xf0e1('0x6f')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x332599['startDate'],_0x332599[_0xf0e1('0x98')]);}if(_0x4372c8){logger[_0xf0e1('0x99')](_0xf0e1('0x9a'),_0x3e3e9b[_0xf0e1('0x84')]());require(_0xf0e1('0x9b'))[_0xf0e1('0x9c')](path['join'](__dirname,_0xf0e1('0x9d'),_0x4372c8['output']),[_0x4372c8['id'],_0x3e3e9b[_0xf0e1('0x84')](),path[_0xf0e1('0x53')](__dirname,_0xf0e1('0x9e'),_0x4372c8['savename']),_0x136cea]);return _0x4372c8;}else{var _0x459351=squel[_0xf0e1('0x6e')]();_0x459351[_0xf0e1('0x8c')]('('+_0x3e3e9b[_0xf0e1('0x84')]()+')','countTable');_0x459351[_0xf0e1('0x66')](_0xf0e1('0x9f'),_0xf0e1('0x41'));_0x3e3e9b[_0xf0e1('0x1e')](_0x332599[_0xf0e1('0x1e')]||_0x52c7b4);_0x3e3e9b[_0xf0e1('0x1d')](_0x332599[_0xf0e1('0x1d')]||0x0);return dbH[_0xf0e1('0x85')]['query'](_0x459351['toString'](),{'type':dbH['sequelize'][_0xf0e1('0xa0')][_0xf0e1('0xa1')]})['then'](function(_0xfdca5c){if(!_0xfdca5c[_0xf0e1('0x37')]){_0x53700c=0x0;}else{_0x53700c=_0xfdca5c[0x0][_0xf0e1('0x41')]||0x0;}return dbH[_0xf0e1('0x85')]['query'](_0x3e3e9b['toString'](),{'type':dbH[_0xf0e1('0x85')]['QueryTypes'][_0xf0e1('0xa1')]});})['then'](function(_0x1fc1a8){return{'rows':_0x1fc1a8||[],'count':_0x53700c};});}});}exports[_0xf0e1('0xa2')]=function(_0x2faae5,_0x4ee5cf){return runReport(_0x2faae5['params'],_0x2faae5[_0xf0e1('0x31')],_0x2faae5[_0xf0e1('0x40')])[_0xf0e1('0x24')](respondWithResult(_0x4ee5cf,null))[_0xf0e1('0x45')](handleError(_0x4ee5cf,null));};exports[_0xf0e1('0xa3')]=runReport;exports[_0xf0e1('0x31')]=function(_0x15d803,_0x3b3548){var _0x24d07d=0xa;var _0x5b5ed7=[_0xf0e1('0x53'),_0xf0e1('0x54'),_0xf0e1('0x55'),_0xf0e1('0x56')];var _0x3bb86a={'SUM':'SUM(%s)','COUNT':_0xf0e1('0x86'),'COUNT DISTINCT':_0xf0e1('0x58'),'MAX':_0xf0e1('0x59'),'MIN':_0xf0e1('0x87'),'AVG':_0xf0e1('0x5a'),'GROUP_CONCAT':_0xf0e1('0x5b'),'GROUP_CONCAT ASC':_0xf0e1('0x88'),'GROUP_CONCAT DESC':_0xf0e1('0xa4')};var _0x3e573d={'SEC_TO_TIME':_0xf0e1('0x5c'),'DATE':_0xf0e1('0x5d'),'HOUR':_0xf0e1('0x5e'),'ROUND':_0xf0e1('0x5f'),'UNIX_TIMESTAMP':_0xf0e1('0x60')};var _0x2c175b=function(_0x21d714){return!_[_0xf0e1('0x7c')]([_0xf0e1('0x61'),'IS\x20NOT\x20NULL',_0xf0e1('0x63'),_0xf0e1('0x89')],_0x21d714);};var _0xf8e083=function(_0x4dfbf4){if(!_0x4dfbf4||!_0x4dfbf4['rules'][_0xf0e1('0x37')]){return'';}for(var _0x560209='(',_0x34655e=0x0;_0x34655e<_0x4dfbf4[_0xf0e1('0x64')]['length'];_0x34655e+=0x1){_0x34655e>0x0&&(_0x560209+='\x20'+_0x4dfbf4['operator']+'\x20');_0x560209+=_0x4dfbf4['rules'][_0x34655e][_0xf0e1('0x65')]?_0xf8e083(_0x4dfbf4['rules'][_0x34655e][_0xf0e1('0x65')]):_0x4dfbf4[_0xf0e1('0x64')][_0x34655e]['field']+'\x20'+_0x4dfbf4[_0xf0e1('0x64')][_0x34655e]['condition']+(_0x2c175b(_0x4dfbf4[_0xf0e1('0x64')][_0x34655e][_0xf0e1('0x67')])?'\x20'+_0x4dfbf4['rules'][_0x34655e]['value']:'');}return _0x560209+')';};var _0x547111={'where':{'id':_0x15d803[_0xf0e1('0x51')]['id']}},_0x2bf82a,_0x3cbe26,_0x1acb6a,_0x1c59d9,_0x1771ce;_0x547111=_[_0xf0e1('0x3f')]({},_0x547111,_0x15d803[_0xf0e1('0x40')]);return db[_0xf0e1('0x2b')][_0xf0e1('0x4d')](_0x547111)['then'](function(_0x1d9709){if(_0x1d9709){_0x2bf82a=_0x1d9709;return _0x1d9709[_0xf0e1('0x8b')]();}return null;})[_0xf0e1('0x24')](function(_0x2444ce){if(_0x2444ce){if(!_0x2444ce[_0xf0e1('0x37')]){throw new db['Sequelize'][(_0xf0e1('0x69'))](_0xf0e1('0x6a'),0x193);}_0x3cbe26=_0x2444ce;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xf0e1('0x24')](function(_0x3ad72b){if(_0x3ad72b){_0x1acb6a=_[_0xf0e1('0x6d')](_0x3ad72b,'id');var _0x3c0ee8;var _0x56363f=squel[_0xf0e1('0x6e')]();_0x56363f[_0xf0e1('0x8c')](_0x2bf82a[_0xf0e1('0x6f')]);for(var _0x2fe0c4=0x0;_0x2fe0c4<_0x3cbe26[_0xf0e1('0x37')];_0x2fe0c4+=0x1){_0x3c0ee8=_0x3cbe26[_0x2fe0c4][_0xf0e1('0x70')]?_0x1acb6a[_0x3cbe26[_0x2fe0c4][_0xf0e1('0x70')]][_0xf0e1('0x71')]:_0x3cbe26[_0x2fe0c4][_0xf0e1('0x66')];_0x3c0ee8=_0x3cbe26[_0x2fe0c4][_0xf0e1('0x72')]?_[_0xf0e1('0x73')](_0x3bb86a[_0x3cbe26[_0x2fe0c4][_0xf0e1('0x72')]],'%s',_0x3c0ee8):_0x3c0ee8;_0x3c0ee8=_0x3cbe26[_0x2fe0c4][_0xf0e1('0x74')]?_[_0xf0e1('0x73')](_0x3e573d[_0x3cbe26[_0x2fe0c4][_0xf0e1('0x74')]],'%s',_0x3c0ee8):_0x3c0ee8;if(_0x3cbe26[_0x2fe0c4][_0xf0e1('0x75')]){_0x56363f[_0xf0e1('0x65')](_0x3c0ee8);}_0x3cbe26[_0x2fe0c4]['orderBy']&&_0x56363f[_0xf0e1('0x76')](_0x3c0ee8,_0x3cbe26[_0x2fe0c4][_0xf0e1('0x77')]===_0xf0e1('0x78')?![]:!![]);_0x56363f[_0xf0e1('0x66')](_0x3c0ee8,_0x3cbe26[_0x2fe0c4]['alias']||_0x3c0ee8);}if(_0x2bf82a[_0xf0e1('0x7a')]){_0x2bf82a['joins']=JSON['parse'](_0x2bf82a[_0xf0e1('0x7a')]);for(var _0x29f839=0x0;_0x29f839<_0x2bf82a[_0xf0e1('0x7a')][_0xf0e1('0x37')];_0x29f839+=0x1){if(_0x2bf82a[_0xf0e1('0x7a')][_0x29f839][_0xf0e1('0x2e')]&&_[_0xf0e1('0x7c')](_0x5b5ed7,_0x2bf82a['joins'][_0x29f839][_0xf0e1('0x2e')])&&_0x2bf82a[_0xf0e1('0x7a')][_0x29f839]['parentKey']&&_0x2bf82a['joins'][_0x29f839]['foreignTable']&&_0x2bf82a[_0xf0e1('0x7a')][_0x29f839][_0xf0e1('0x7f')]){_0x56363f[_0x2bf82a[_0xf0e1('0x7a')][_0x29f839][_0xf0e1('0x2e')]](_0x2bf82a[_0xf0e1('0x7a')][_0x29f839]['foreignTable'],null,util[_0xf0e1('0x74')]('%s.%s\x20=\x20%s.%s',_0x2bf82a[_0xf0e1('0x6f')],_0x2bf82a[_0xf0e1('0x7a')][_0x29f839]['parentKey'],_0x2bf82a['joins'][_0x29f839][_0xf0e1('0x7e')],_0x2bf82a[_0xf0e1('0x7a')][_0x29f839][_0xf0e1('0x7f')]));}}}if(_0x2bf82a[_0xf0e1('0x81')]){_0x2bf82a['conditions']=JSON['parse'](_0x2bf82a[_0xf0e1('0x81')]);_0x56363f[_0xf0e1('0x3b')](_0xf8e083(_0x2bf82a['conditions']['group']));}_0x1771ce=_0x56363f['clone']();_0x56363f[_0xf0e1('0x1e')](_0x24d07d);_0x56363f[_0xf0e1('0x1d')](0x0);logger['debug'](_0xf0e1('0x83'),_0x56363f[_0xf0e1('0x84')]());return dbH[_0xf0e1('0x85')][_0xf0e1('0x31')](_0x56363f[_0xf0e1('0x84')](),{'type':dbH[_0xf0e1('0x85')]['QueryTypes'][_0xf0e1('0xa1')]});}})['then'](function(){return{'sql':_0x1771ce[_0xf0e1('0x84')]()};})[_0xf0e1('0x24')](respondWithResult(_0x3b3548,null))[_0xf0e1('0x45')](handleError(_0x3b3548,null));}; \ No newline at end of file +var _0xcd59=['endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','Limited\x20Query:','SELECT','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','DefaultReports','error','stack','name','index','map','AnalyticDefaultReport','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%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\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','MetricId','metric','function','groupBy','group','orderBy','DESC','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','conditions','clone','debug','toString','sequelize','QueryTypes','COUNT(%s)','AVG(%s)','IS\x20NOT\x20NULL','Sequelize','keyBy','replace','format','alias','output','web','fullPath','%s-%s.%s','randomstring','default','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?'];(function(_0x9eb9cc,_0x129c6d){var _0x5e8af8=function(_0x20c929){while(--_0x20c929){_0x9eb9cc['push'](_0x9eb9cc['shift']());}};_0x5e8af8(++_0x129c6d);}(_0xcd59,0xb7));var _0x9cd5=function(_0x3c126c,_0x22f353){_0x3c126c=_0x3c126c-0x0;var _0x3b89e4=_0xcd59[_0x3c126c];return _0x3b89e4;};'use strict';var pdf=require(_0x9cd5('0x0'));var emlformat=require(_0x9cd5('0x1'));var rimraf=require(_0x9cd5('0x2'));var zipdir=require(_0x9cd5('0x3'));var jsonpatch=require(_0x9cd5('0x4'));var rp=require(_0x9cd5('0x5'));var moment=require('moment');var BPromise=require(_0x9cd5('0x6'));var Mustache=require(_0x9cd5('0x7'));var util=require(_0x9cd5('0x8'));var path=require(_0x9cd5('0x9'));var sox=require(_0x9cd5('0xa'));var csv=require('to-csv');var ejs=require(_0x9cd5('0xb'));var fs=require('fs');var _=require(_0x9cd5('0xc'));var squel=require(_0x9cd5('0xd'));var crypto=require(_0x9cd5('0xe'));var jsforce=require(_0x9cd5('0xf'));var deskjs=require(_0x9cd5('0x10'));var toCsv=require(_0x9cd5('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9cd5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9cd5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9cd5('0x14'));var logger=require(_0x9cd5('0x15'))(_0x9cd5('0x16'));var utils=require(_0x9cd5('0x17'));var config=require(_0x9cd5('0x18'));var licenseUtil=require(_0x9cd5('0x19'));var db=require(_0x9cd5('0x1a'))['db'];var dbH=require('../../mysqldb')[_0x9cd5('0x1b')];function respondWithStatusCode(_0x197e05,_0x4d66ba){_0x4d66ba=_0x4d66ba||0xcc;return function(_0x2edb71){if(_0x2edb71){return _0x197e05[_0x9cd5('0x1c')](_0x4d66ba);}return _0x197e05[_0x9cd5('0x1d')](_0x4d66ba)[_0x9cd5('0x1e')]();};}function respondWithResult(_0x8b5ec6,_0x15052c){_0x15052c=_0x15052c||0xc8;return function(_0x55491a){if(_0x55491a){return _0x8b5ec6[_0x9cd5('0x1d')](_0x15052c)['json'](_0x55491a);}};}function respondWithFilteredResult(_0x11f0f6,_0x20af4b){return function(_0x2e57c9){if(_0x2e57c9){var _0x1d5d3f=_0x2e57c9[_0x9cd5('0x1f')],_0x5d37f7=_0x20af4b[_0x9cd5('0x20')],_0x13c2e4=_0x20af4b['offset']+_0x20af4b[_0x9cd5('0x21')],_0x127273;if(_0x13c2e4>=_0x1d5d3f){_0x13c2e4=_0x1d5d3f;_0x127273=0xc8;}else{_0x127273=0xce;}_0x11f0f6['status'](_0x127273);return _0x11f0f6[_0x9cd5('0x22')](_0x9cd5('0x23'),_0x5d37f7+'-'+_0x13c2e4+'/'+_0x1d5d3f)['json'](_0x2e57c9);}return null;};}function patchUpdates(_0x1bd827){return function(_0x144c84){try{jsonpatch['apply'](_0x144c84,_0x1bd827,!![]);}catch(_0x1c1978){return BPromise[_0x9cd5('0x24')](_0x1c1978);}return _0x144c84[_0x9cd5('0x25')]();};}function saveUpdates(_0x2b1e18,_0x3549ad){return function(_0x2e5fa6){if(_0x2e5fa6){return _0x2e5fa6[_0x9cd5('0x26')](_0x2b1e18)[_0x9cd5('0x27')](function(_0x13f55f){return _0x13f55f;});}return null;};}function removeEntity(_0x160388,_0x5a2ffc){return function(_0x533b38){if(_0x533b38){return _0x533b38[_0x9cd5('0x28')]()['then'](function(){var _0x1a6482=_0x533b38['get']({'plain':!![]});var _0x595ca1=_0x9cd5('0x29');return db['UserProfileResource'][_0x9cd5('0x28')]({'where':{'type':_0x595ca1,'resourceId':_0x1a6482['id']}})[_0x9cd5('0x27')](function(){return _0x533b38;});})[_0x9cd5('0x27')](function(){_0x160388[_0x9cd5('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54fa13,_0xe159b0){return function(_0x3b07f6){if(!_0x3b07f6){_0x54fa13[_0x9cd5('0x1c')](0x194);}return _0x3b07f6;};}function handleError(_0x1c0fcd,_0xa2682e){_0xa2682e=_0xa2682e||0x1f4;return function(_0x59c29d){logger[_0x9cd5('0x2a')](_0x59c29d[_0x9cd5('0x2b')]);if(_0x59c29d['name']){delete _0x59c29d[_0x9cd5('0x2c')];}_0x1c0fcd['status'](_0xa2682e)['send'](_0x59c29d);};}exports[_0x9cd5('0x2d')]=function(_0x531f40,_0x288430){var _0x187eba={},_0x4a2727={},_0x1c129c={'count':0x0,'rows':[]};var _0x45f17f=_[_0x9cd5('0x2e')](db[_0x9cd5('0x2f')][_0x9cd5('0x30')],function(_0x312356){return{'name':_0x312356[_0x9cd5('0x31')],'type':_0x312356['type'][_0x9cd5('0x32')]};});_0x4a2727['model']=_['map'](_0x45f17f,_0x9cd5('0x2c'));_0x4a2727['query']=_['keys'](_0x531f40[_0x9cd5('0x33')]);_0x4a2727[_0x9cd5('0x34')]=_['intersection'](_0x4a2727[_0x9cd5('0x35')],_0x4a2727[_0x9cd5('0x33')]);_0x187eba[_0x9cd5('0x36')]=_[_0x9cd5('0x37')](_0x4a2727[_0x9cd5('0x35')],qs[_0x9cd5('0x38')](_0x531f40[_0x9cd5('0x33')][_0x9cd5('0x38')]));_0x187eba['attributes']=_0x187eba[_0x9cd5('0x36')]['length']?_0x187eba['attributes']:_0x4a2727[_0x9cd5('0x35')];if(!_0x531f40[_0x9cd5('0x33')]['hasOwnProperty'](_0x9cd5('0x39'))){_0x187eba[_0x9cd5('0x21')]=qs[_0x9cd5('0x21')](_0x531f40[_0x9cd5('0x33')]['limit']);_0x187eba[_0x9cd5('0x20')]=qs['offset'](_0x531f40['query']['offset']);}_0x187eba[_0x9cd5('0x3a')]=qs[_0x9cd5('0x3b')](_0x531f40[_0x9cd5('0x33')][_0x9cd5('0x3b')]);_0x187eba[_0x9cd5('0x3c')]=qs[_0x9cd5('0x34')](_[_0x9cd5('0x3d')](_0x531f40[_0x9cd5('0x33')],_0x4a2727[_0x9cd5('0x34')]),_0x45f17f);if(_0x531f40[_0x9cd5('0x33')][_0x9cd5('0x3e')]){_0x187eba[_0x9cd5('0x3c')]=_[_0x9cd5('0x3f')](_0x187eba['where'],{'$or':_[_0x9cd5('0x2e')](_0x45f17f,function(_0x2ada40){if(_0x2ada40[_0x9cd5('0x40')]!==_0x9cd5('0x41')){var _0x5babe0={};_0x5babe0[_0x2ada40[_0x9cd5('0x2c')]]={'$like':'%'+_0x531f40[_0x9cd5('0x33')][_0x9cd5('0x3e')]+'%'};return _0x5babe0;}})});}_0x187eba=_[_0x9cd5('0x3f')]({},_0x187eba,_0x531f40[_0x9cd5('0x42')]);var _0x245d14={'where':_0x187eba[_0x9cd5('0x3c')]};return db['AnalyticDefaultReport'][_0x9cd5('0x1f')](_0x245d14)[_0x9cd5('0x27')](function(_0x294385){_0x1c129c['count']=_0x294385;if(_0x531f40[_0x9cd5('0x33')][_0x9cd5('0x43')]){_0x187eba[_0x9cd5('0x44')]=[{'all':!![]}];}return db[_0x9cd5('0x2f')][_0x9cd5('0x45')](_0x187eba);})[_0x9cd5('0x27')](function(_0xf89456){_0x1c129c[_0x9cd5('0x46')]=_0xf89456;return _0x1c129c;})[_0x9cd5('0x27')](respondWithFilteredResult(_0x288430,_0x187eba))[_0x9cd5('0x47')](handleError(_0x288430,null));};exports['show']=function(_0x130516,_0x76eda7){var _0x1ac87c={'raw':!![],'where':{'id':_0x130516[_0x9cd5('0x48')]['id']}},_0x54cfb7={};_0x54cfb7['model']=_[_0x9cd5('0x49')](db['AnalyticDefaultReport'][_0x9cd5('0x30')]);_0x54cfb7[_0x9cd5('0x33')]=_[_0x9cd5('0x49')](_0x130516[_0x9cd5('0x33')]);_0x54cfb7['filters']=_[_0x9cd5('0x37')](_0x54cfb7['model'],_0x54cfb7[_0x9cd5('0x33')]);_0x1ac87c[_0x9cd5('0x36')]=_[_0x9cd5('0x37')](_0x54cfb7[_0x9cd5('0x35')],qs['fields'](_0x130516[_0x9cd5('0x33')][_0x9cd5('0x38')]));_0x1ac87c[_0x9cd5('0x36')]=_0x1ac87c[_0x9cd5('0x36')][_0x9cd5('0x4a')]?_0x1ac87c[_0x9cd5('0x36')]:_0x54cfb7[_0x9cd5('0x35')];if(_0x130516[_0x9cd5('0x33')][_0x9cd5('0x43')]){_0x1ac87c[_0x9cd5('0x44')]=[{'all':!![]}];}_0x1ac87c=_[_0x9cd5('0x3f')]({},_0x1ac87c,_0x130516[_0x9cd5('0x42')]);return db[_0x9cd5('0x2f')][_0x9cd5('0x4b')](_0x1ac87c)['then'](handleEntityNotFound(_0x76eda7,null))[_0x9cd5('0x27')](respondWithResult(_0x76eda7,null))[_0x9cd5('0x47')](handleError(_0x76eda7,null));};exports['create']=function(_0x1d3d05,_0x2707b1){return db['AnalyticDefaultReport']['create'](_0x1d3d05[_0x9cd5('0x4c')],{})[_0x9cd5('0x27')](function(_0xe55355){var _0x184009=_0x1d3d05[_0x9cd5('0x4d')][_0x9cd5('0x4e')]({'plain':!![]});if(!_0x184009)throw new Error(_0x9cd5('0x4f'));if(_0x184009[_0x9cd5('0x50')]===_0x9cd5('0x4d')){var _0x120b1b=_0xe55355[_0x9cd5('0x4e')]({'plain':!![]});var _0x5b2dce='Reports';return db[_0x9cd5('0x51')][_0x9cd5('0x4b')]({'where':{'name':_0x5b2dce,'userProfileId':_0x184009['userProfileId']},'raw':!![]})[_0x9cd5('0x27')](function(_0x2380db){if(_0x2380db&&_0x2380db[_0x9cd5('0x52')]===0x0){return db[_0x9cd5('0x53')][_0x9cd5('0x54')]({'name':_0x120b1b[_0x9cd5('0x2c')],'resourceId':_0x120b1b['id'],'type':'DefaultReports','sectionId':_0x2380db['id']},{})['then'](function(){return _0xe55355;});}else{return _0xe55355;}})[_0x9cd5('0x47')](function(_0x1f0148){logger[_0x9cd5('0x2a')](_0x9cd5('0x55'),_0x1f0148);throw _0x1f0148;});}return _0xe55355;})[_0x9cd5('0x27')](respondWithResult(_0x2707b1,0xc9))['catch'](handleError(_0x2707b1,null));};exports[_0x9cd5('0x26')]=function(_0x519dfc,_0x55d51a){if(_0x519dfc[_0x9cd5('0x4c')]['id']){delete _0x519dfc[_0x9cd5('0x4c')]['id'];}return db['AnalyticDefaultReport']['find']({'where':{'id':_0x519dfc[_0x9cd5('0x48')]['id']}})[_0x9cd5('0x27')](handleEntityNotFound(_0x55d51a,null))['then'](saveUpdates(_0x519dfc[_0x9cd5('0x4c')],null))['then'](respondWithResult(_0x55d51a,null))[_0x9cd5('0x47')](handleError(_0x55d51a,null));};exports['destroy']=function(_0x3e15f0,_0x194de){return db[_0x9cd5('0x2f')][_0x9cd5('0x4b')]({'where':{'id':_0x3e15f0['params']['id']}})[_0x9cd5('0x27')](handleEntityNotFound(_0x194de,null))[_0x9cd5('0x27')](removeEntity(_0x194de,null))['catch'](handleError(_0x194de,null));};exports[_0x9cd5('0x56')]=function(_0x32bd1a,_0x3e112a){var _0x24b394=0xa;var _0x2adc85=[_0x9cd5('0x57'),_0x9cd5('0x58'),_0x9cd5('0x59'),_0x9cd5('0x5a')];var _0x589210={'SUM':_0x9cd5('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9cd5('0x5c'),'MAX':_0x9cd5('0x5d'),'MIN':_0x9cd5('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x9cd5('0x5f'),'GROUP_CONCAT ASC':_0x9cd5('0x60'),'GROUP_CONCAT DESC':_0x9cd5('0x61')};var _0x57bdd6={'SEC_TO_TIME':_0x9cd5('0x62'),'DATE':_0x9cd5('0x63'),'HOUR':_0x9cd5('0x64'),'ROUND':_0x9cd5('0x65'),'UNIX_TIMESTAMP':_0x9cd5('0x66')};var _0x1671a5=function(_0x1e0d5e){return!_[_0x9cd5('0x67')]([_0x9cd5('0x68'),'IS\x20NOT\x20NULL',_0x9cd5('0x69'),_0x9cd5('0x6a')],_0x1e0d5e);};var _0x21cbc1=function(_0x53f1ef){if(!_0x53f1ef||!_0x53f1ef['rules'][_0x9cd5('0x4a')]){return'';}for(var _0x5801ba='(',_0x30c698=0x0;_0x30c698<_0x53f1ef[_0x9cd5('0x6b')][_0x9cd5('0x4a')];_0x30c698+=0x1){_0x30c698>0x0&&(_0x5801ba+='\x20'+_0x53f1ef[_0x9cd5('0x6c')]+'\x20');_0x5801ba+=_0x53f1ef[_0x9cd5('0x6b')][_0x30c698]['group']?_0x21cbc1(_0x53f1ef[_0x9cd5('0x6b')][_0x30c698]['group']):_0x53f1ef[_0x9cd5('0x6b')][_0x30c698][_0x9cd5('0x6d')]+'\x20'+_0x53f1ef[_0x9cd5('0x6b')][_0x30c698][_0x9cd5('0x6e')]+(_0x1671a5(_0x53f1ef[_0x9cd5('0x6b')][_0x30c698][_0x9cd5('0x6e')])?'\x20'+_0x53f1ef[_0x9cd5('0x6b')][_0x30c698][_0x9cd5('0x6f')]:'');}return _0x5801ba+')';};var _0x4ab98a={'where':{'id':_0x32bd1a[_0x9cd5('0x48')]['id']}},_0x38573f,_0x3ac17e,_0x3e6a2c,_0x272194,_0x296c15;_0x4ab98a=_[_0x9cd5('0x3f')]({},_0x4ab98a,_0x32bd1a[_0x9cd5('0x42')]);return db[_0x9cd5('0x2f')]['find'](_0x4ab98a)['then'](function(_0x12bbec){if(_0x12bbec){_0x38573f=_0x12bbec;return _0x12bbec[_0x9cd5('0x70')]();}return null;})[_0x9cd5('0x27')](function(_0x66cb1a){if(_0x66cb1a){if(!_0x66cb1a[_0x9cd5('0x4a')]){throw new db['Sequelize'][(_0x9cd5('0x71'))](_0x9cd5('0x72'),0x193);}_0x3ac17e=_0x66cb1a;return db[_0x9cd5('0x73')][_0x9cd5('0x45')]({'raw':!![]});}return null;})[_0x9cd5('0x27')](function(_0x5c4003){if(_0x5c4003){_0x3e6a2c=_['keyBy'](_0x5c4003,'id');var _0x59c996;var _0x419eb0=squel[_0x9cd5('0x74')]();_0x419eb0[_0x9cd5('0x75')](_0x38573f['table']);for(var _0x2c0ec2=0x0;_0x2c0ec2<_0x3ac17e[_0x9cd5('0x4a')];_0x2c0ec2+=0x1){_0x59c996=_0x3ac17e[_0x2c0ec2]['MetricId']?_0x3e6a2c[_0x3ac17e[_0x2c0ec2][_0x9cd5('0x76')]][_0x9cd5('0x77')]:_0x3ac17e[_0x2c0ec2][_0x9cd5('0x6d')];_0x59c996=_0x3ac17e[_0x2c0ec2][_0x9cd5('0x78')]?_['replace'](_0x589210[_0x3ac17e[_0x2c0ec2]['function']],'%s',_0x59c996):_0x59c996;_0x59c996=_0x3ac17e[_0x2c0ec2]['format']?_['replace'](_0x57bdd6[_0x3ac17e[_0x2c0ec2]['format']],'%s',_0x59c996):_0x59c996;if(_0x3ac17e[_0x2c0ec2][_0x9cd5('0x79')]){_0x419eb0[_0x9cd5('0x7a')](_0x59c996);}_0x3ac17e[_0x2c0ec2][_0x9cd5('0x7b')]&&_0x419eb0[_0x9cd5('0x3a')](_0x59c996,_0x3ac17e[_0x2c0ec2][_0x9cd5('0x7b')]===_0x9cd5('0x7c')?![]:!![]);_0x419eb0[_0x9cd5('0x6d')](_0x59c996,_0x3ac17e[_0x2c0ec2]['alias']||_0x59c996);}if(_0x38573f[_0x9cd5('0x7d')]){_0x38573f[_0x9cd5('0x7d')]=JSON[_0x9cd5('0x7e')](_0x38573f[_0x9cd5('0x7d')]);for(var _0x582a5c=0x0;_0x582a5c<_0x38573f['joins'][_0x9cd5('0x4a')];_0x582a5c+=0x1){if(_0x38573f[_0x9cd5('0x7d')][_0x582a5c][_0x9cd5('0x40')]&&_[_0x9cd5('0x67')](_0x2adc85,_0x38573f[_0x9cd5('0x7d')][_0x582a5c][_0x9cd5('0x40')])&&_0x38573f['joins'][_0x582a5c][_0x9cd5('0x7f')]&&_0x38573f[_0x9cd5('0x7d')][_0x582a5c]['foreignTable']&&_0x38573f[_0x9cd5('0x7d')][_0x582a5c]['foreignKey']){_0x419eb0[_0x38573f[_0x9cd5('0x7d')][_0x582a5c][_0x9cd5('0x40')]](_0x38573f[_0x9cd5('0x7d')][_0x582a5c][_0x9cd5('0x80')],null,util['format'](_0x9cd5('0x81'),_0x38573f[_0x9cd5('0x82')],_0x38573f['joins'][_0x582a5c][_0x9cd5('0x7f')],_0x38573f[_0x9cd5('0x7d')][_0x582a5c]['foreignTable'],_0x38573f[_0x9cd5('0x7d')][_0x582a5c][_0x9cd5('0x83')]));}}}if(_0x38573f['conditions']){_0x38573f[_0x9cd5('0x84')]=JSON[_0x9cd5('0x7e')](_0x38573f[_0x9cd5('0x84')]);_0x419eb0[_0x9cd5('0x3c')](_0x21cbc1(_0x38573f[_0x9cd5('0x84')][_0x9cd5('0x7a')]));}_0x296c15=_0x419eb0[_0x9cd5('0x85')]();_0x419eb0['limit'](_0x24b394);_0x419eb0[_0x9cd5('0x20')](0x0);logger[_0x9cd5('0x86')]('Limited\x20Query:',_0x419eb0[_0x9cd5('0x87')]());return dbH[_0x9cd5('0x88')][_0x9cd5('0x33')](_0x419eb0[_0x9cd5('0x87')](),{'type':dbH[_0x9cd5('0x88')][_0x9cd5('0x89')]['SELECT']});}})[_0x9cd5('0x27')](respondWithResult(_0x3e112a,null))[_0x9cd5('0x47')](handleError(_0x3e112a,null));};function runReport(_0x4dcffa,_0x21f6e5,_0x31213b){var _0x2e3696=_0x21f6e5[_0x9cd5('0x2c')];var _0x1ce10c=0xa;var _0x208694=[_0x9cd5('0x57'),_0x9cd5('0x58'),_0x9cd5('0x59'),'cross_join'];var _0xe4e3d8={'SUM':_0x9cd5('0x5b'),'COUNT':_0x9cd5('0x8a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9cd5('0x5d'),'MIN':_0x9cd5('0x5e'),'AVG':_0x9cd5('0x8b'),'GROUP_CONCAT':_0x9cd5('0x5f'),'GROUP_CONCAT ASC':_0x9cd5('0x60'),'GROUP_CONCAT DESC':_0x9cd5('0x61')};var _0x536302={'SEC_TO_TIME':_0x9cd5('0x62'),'DATE':_0x9cd5('0x63'),'HOUR':_0x9cd5('0x64'),'ROUND':_0x9cd5('0x65'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x103026=function(_0x323cee){return!_['includes']([_0x9cd5('0x68'),_0x9cd5('0x8c'),_0x9cd5('0x69'),'IS\x20NOT\x20EMPTY'],_0x323cee);};var _0x2c5296=function(_0x89b9b8){if(!_0x89b9b8||!_0x89b9b8['rules'][_0x9cd5('0x4a')]){return'';}for(var _0x5a96b6='(',_0x30a44e=0x0;_0x30a44e<_0x89b9b8['rules'][_0x9cd5('0x4a')];_0x30a44e+=0x1){_0x30a44e>0x0&&(_0x5a96b6+='\x20'+_0x89b9b8[_0x9cd5('0x6c')]+'\x20');_0x5a96b6+=_0x89b9b8[_0x9cd5('0x6b')][_0x30a44e]['group']?_0x2c5296(_0x89b9b8[_0x9cd5('0x6b')][_0x30a44e][_0x9cd5('0x7a')]):_0x89b9b8[_0x9cd5('0x6b')][_0x30a44e][_0x9cd5('0x6d')]+'\x20'+_0x89b9b8['rules'][_0x30a44e][_0x9cd5('0x6e')]+(_0x103026(_0x89b9b8[_0x9cd5('0x6b')][_0x30a44e][_0x9cd5('0x6e')])?'\x20'+_0x89b9b8[_0x9cd5('0x6b')][_0x30a44e]['value']:'');}return _0x5a96b6+')';};var _0x1d7f30={'where':{'id':_0x4dcffa['id']}},_0x2307da,_0x2dff8e,_0x5706b6,_0x329b03,_0x47de70;_0x1d7f30=_[_0x9cd5('0x3f')]({},_0x1d7f30,_0x31213b);return db[_0x9cd5('0x2f')][_0x9cd5('0x4b')](_0x1d7f30)[_0x9cd5('0x27')](function(_0x164773){if(_0x164773){_0x2307da=_0x164773;return _0x164773[_0x9cd5('0x70')]();}return null;})[_0x9cd5('0x27')](function(_0x97b03b){if(_0x97b03b){if(!_0x97b03b[_0x9cd5('0x4a')]){throw new db[(_0x9cd5('0x8d'))][(_0x9cd5('0x71'))](_0x9cd5('0x72'),0x193);}_0x2dff8e=_0x97b03b;return db[_0x9cd5('0x73')][_0x9cd5('0x45')]({'raw':!![]});}return null;})[_0x9cd5('0x27')](function(_0x74767d){if(_0x74767d){_0x5706b6=_[_0x9cd5('0x8e')](_0x74767d,'id');var _0x551a79;var _0x14e9fc=squel[_0x9cd5('0x74')]();_0x14e9fc[_0x9cd5('0x75')](_0x2307da['table']);for(var _0x1616de=0x0;_0x1616de<_0x2dff8e[_0x9cd5('0x4a')];_0x1616de+=0x1){_0x551a79=_0x2dff8e[_0x1616de][_0x9cd5('0x76')]?_0x5706b6[_0x2dff8e[_0x1616de][_0x9cd5('0x76')]][_0x9cd5('0x77')]:_0x2dff8e[_0x1616de][_0x9cd5('0x6d')];_0x551a79=_0x2dff8e[_0x1616de][_0x9cd5('0x78')]?_[_0x9cd5('0x8f')](_0xe4e3d8[_0x2dff8e[_0x1616de][_0x9cd5('0x78')]],'%s',_0x551a79):_0x551a79;_0x551a79=_0x2dff8e[_0x1616de][_0x9cd5('0x90')]?_['replace'](_0x536302[_0x2dff8e[_0x1616de]['format']],'%s',_0x551a79):_0x551a79;if(_0x2dff8e[_0x1616de][_0x9cd5('0x79')]){_0x14e9fc['group'](_0x551a79);}_0x2dff8e[_0x1616de][_0x9cd5('0x7b')]&&_0x14e9fc[_0x9cd5('0x3a')](_0x551a79,_0x2dff8e[_0x1616de][_0x9cd5('0x7b')]===_0x9cd5('0x7c')?![]:!![]);_0x14e9fc[_0x9cd5('0x6d')](_0x551a79,_0x2dff8e[_0x1616de][_0x9cd5('0x91')]||_0x551a79);}if(_0x2307da[_0x9cd5('0x7d')]){_0x2307da[_0x9cd5('0x7d')]=JSON[_0x9cd5('0x7e')](_0x2307da[_0x9cd5('0x7d')]);for(var _0x44d918=0x0;_0x44d918<_0x2307da['joins'][_0x9cd5('0x4a')];_0x44d918+=0x1){if(_0x2307da['joins'][_0x44d918]['type']&&_[_0x9cd5('0x67')](_0x208694,_0x2307da[_0x9cd5('0x7d')][_0x44d918]['type'])&&_0x2307da['joins'][_0x44d918][_0x9cd5('0x7f')]&&_0x2307da[_0x9cd5('0x7d')][_0x44d918][_0x9cd5('0x80')]&&_0x2307da[_0x9cd5('0x7d')][_0x44d918][_0x9cd5('0x83')]){_0x14e9fc[_0x2307da[_0x9cd5('0x7d')][_0x44d918][_0x9cd5('0x40')]](_0x2307da[_0x9cd5('0x7d')][_0x44d918][_0x9cd5('0x80')],null,util[_0x9cd5('0x90')](_0x9cd5('0x81'),_0x2307da[_0x9cd5('0x82')],_0x2307da['joins'][_0x44d918][_0x9cd5('0x7f')],_0x2307da[_0x9cd5('0x7d')][_0x44d918]['foreignTable'],_0x2307da[_0x9cd5('0x7d')][_0x44d918][_0x9cd5('0x83')]));}}}if(_0x2307da['conditions']){_0x2307da[_0x9cd5('0x84')]=JSON['parse'](_0x2307da[_0x9cd5('0x84')]);_0x14e9fc[_0x9cd5('0x3c')](_0x2c5296(_0x2307da[_0x9cd5('0x84')]['group']));}_0x47de70=_0x14e9fc[_0x9cd5('0x85')]();_0x14e9fc['limit'](_0x1ce10c);_0x14e9fc[_0x9cd5('0x20')](0x0);return;}})[_0x9cd5('0x27')](function(){if(_0x21f6e5[_0x9cd5('0x92')]===_0x9cd5('0x93')){return null;}var _0x373803=_['merge'](_0x21f6e5,{'name':_0x21f6e5[_0x9cd5('0x94')]||_0x21f6e5[_0x9cd5('0x2c')]||_0x2307da[_0x9cd5('0x2c')],'basename':_0x2e3696,'savename':util[_0x9cd5('0x90')](_0x9cd5('0x95'),_0x21f6e5[_0x9cd5('0x2c')]||_0x2307da[_0x9cd5('0x2c')],require(_0x9cd5('0x96'))['generate'](0x4),_0x21f6e5[_0x9cd5('0x92')]||'csv'),'reportId':_0x2307da['id'],'reportType':_0x9cd5('0x97')});return db['AnalyticExtractedReport'][_0x9cd5('0x54')](_0x373803,{'raw':!![]});})[_0x9cd5('0x27')](function(_0x13a2af){if(_0x2307da[_0x9cd5('0x82')]===_0x9cd5('0x98')){_0x47de70[_0x9cd5('0x3c')](_0x2307da['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x21f6e5[_0x9cd5('0x99')],_0x21f6e5['endDate']);}else{_0x47de70[_0x9cd5('0x3c')](_0x2307da[_0x9cd5('0x82')]+_0x9cd5('0x9a'),_0x21f6e5[_0x9cd5('0x99')],_0x21f6e5[_0x9cd5('0x9b')]);}if(_0x13a2af){logger[_0x9cd5('0x9c')](_0x9cd5('0x9d'),_0x47de70[_0x9cd5('0x87')]());require(_0x9cd5('0x9e'))[_0x9cd5('0x9f')](path['join'](__dirname,_0x9cd5('0xa0'),_0x13a2af['output']),[_0x13a2af['id'],_0x47de70[_0x9cd5('0x87')](),path[_0x9cd5('0x57')](__dirname,_0x9cd5('0xa1'),_0x13a2af[_0x9cd5('0xa2')]),_0x2e3696]);return _0x13a2af;}else{var _0xafe80f=squel[_0x9cd5('0x74')]();_0xafe80f[_0x9cd5('0x75')]('('+_0x47de70[_0x9cd5('0x87')]()+')',_0x9cd5('0xa3'));_0xafe80f[_0x9cd5('0x6d')](_0x9cd5('0xa4'),'count');_0x47de70[_0x9cd5('0x21')](_0x21f6e5['limit']||_0x1ce10c);_0x47de70[_0x9cd5('0x20')](_0x21f6e5[_0x9cd5('0x20')]||0x0);return dbH[_0x9cd5('0x88')][_0x9cd5('0x33')](_0xafe80f['toString'](),{'type':dbH[_0x9cd5('0x88')][_0x9cd5('0x89')]['SELECT']})[_0x9cd5('0x27')](function(_0xff21bc){if(!_0xff21bc[_0x9cd5('0x4a')]){_0x329b03=0x0;}else{_0x329b03=_0xff21bc[0x0][_0x9cd5('0x1f')]||0x0;}return dbH[_0x9cd5('0x88')]['query'](_0x47de70['toString'](),{'type':dbH[_0x9cd5('0x88')][_0x9cd5('0x89')]['SELECT']});})['then'](function(_0xf7841f){return{'rows':_0xf7841f||[],'count':_0x329b03};});}});}exports[_0x9cd5('0xa5')]=function(_0x945028,_0x3f58c5){return runReport(_0x945028['params'],_0x945028['query'],_0x945028[_0x9cd5('0x42')])[_0x9cd5('0x27')](respondWithResult(_0x3f58c5,null))['catch'](handleError(_0x3f58c5,null));};exports[_0x9cd5('0xa6')]=runReport;exports['query']=function(_0x3a9516,_0x57aecd){var _0x242045=0xa;var _0x4ebd13=['join',_0x9cd5('0x58'),_0x9cd5('0x59'),_0x9cd5('0x5a')];var _0x480a33={'SUM':_0x9cd5('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9cd5('0x5c'),'MAX':_0x9cd5('0x5d'),'MIN':_0x9cd5('0x5e'),'AVG':_0x9cd5('0x8b'),'GROUP_CONCAT':_0x9cd5('0x5f'),'GROUP_CONCAT ASC':_0x9cd5('0x60'),'GROUP_CONCAT DESC':_0x9cd5('0x61')};var _0x37fc74={'SEC_TO_TIME':_0x9cd5('0x62'),'DATE':_0x9cd5('0x63'),'HOUR':_0x9cd5('0x64'),'ROUND':_0x9cd5('0x65'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x9bee13=function(_0x57407e){return!_[_0x9cd5('0x67')]([_0x9cd5('0x68'),_0x9cd5('0x8c'),_0x9cd5('0x69'),_0x9cd5('0x6a')],_0x57407e);};var _0x41c07b=function(_0x4a9ff0){if(!_0x4a9ff0||!_0x4a9ff0[_0x9cd5('0x6b')]['length']){return'';}for(var _0x420b31='(',_0x26503e=0x0;_0x26503e<_0x4a9ff0[_0x9cd5('0x6b')][_0x9cd5('0x4a')];_0x26503e+=0x1){_0x26503e>0x0&&(_0x420b31+='\x20'+_0x4a9ff0[_0x9cd5('0x6c')]+'\x20');_0x420b31+=_0x4a9ff0[_0x9cd5('0x6b')][_0x26503e][_0x9cd5('0x7a')]?_0x41c07b(_0x4a9ff0[_0x9cd5('0x6b')][_0x26503e][_0x9cd5('0x7a')]):_0x4a9ff0[_0x9cd5('0x6b')][_0x26503e][_0x9cd5('0x6d')]+'\x20'+_0x4a9ff0[_0x9cd5('0x6b')][_0x26503e][_0x9cd5('0x6e')]+(_0x9bee13(_0x4a9ff0[_0x9cd5('0x6b')][_0x26503e][_0x9cd5('0x6e')])?'\x20'+_0x4a9ff0[_0x9cd5('0x6b')][_0x26503e]['value']:'');}return _0x420b31+')';};var _0x2f4289={'where':{'id':_0x3a9516['params']['id']}},_0x46d12b,_0x50c1c7,_0x3b7742,_0x3d4cf7,_0x3bd1b9;_0x2f4289=_[_0x9cd5('0x3f')]({},_0x2f4289,_0x3a9516[_0x9cd5('0x42')]);return db[_0x9cd5('0x2f')][_0x9cd5('0x4b')](_0x2f4289)[_0x9cd5('0x27')](function(_0x1ffa7d){if(_0x1ffa7d){_0x46d12b=_0x1ffa7d;return _0x1ffa7d[_0x9cd5('0x70')]();}return null;})[_0x9cd5('0x27')](function(_0x3c799c){if(_0x3c799c){if(!_0x3c799c[_0x9cd5('0x4a')]){throw new db['Sequelize'][(_0x9cd5('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x50c1c7=_0x3c799c;return db[_0x9cd5('0x73')][_0x9cd5('0x45')]({'raw':!![]});}return null;})['then'](function(_0x25e69f){if(_0x25e69f){_0x3b7742=_[_0x9cd5('0x8e')](_0x25e69f,'id');var _0x40610;var _0x5b9c96=squel['select']();_0x5b9c96['from'](_0x46d12b[_0x9cd5('0x82')]);for(var _0x3ecd1d=0x0;_0x3ecd1d<_0x50c1c7[_0x9cd5('0x4a')];_0x3ecd1d+=0x1){_0x40610=_0x50c1c7[_0x3ecd1d]['MetricId']?_0x3b7742[_0x50c1c7[_0x3ecd1d][_0x9cd5('0x76')]][_0x9cd5('0x77')]:_0x50c1c7[_0x3ecd1d][_0x9cd5('0x6d')];_0x40610=_0x50c1c7[_0x3ecd1d][_0x9cd5('0x78')]?_[_0x9cd5('0x8f')](_0x480a33[_0x50c1c7[_0x3ecd1d]['function']],'%s',_0x40610):_0x40610;_0x40610=_0x50c1c7[_0x3ecd1d]['format']?_['replace'](_0x37fc74[_0x50c1c7[_0x3ecd1d][_0x9cd5('0x90')]],'%s',_0x40610):_0x40610;if(_0x50c1c7[_0x3ecd1d][_0x9cd5('0x79')]){_0x5b9c96['group'](_0x40610);}_0x50c1c7[_0x3ecd1d][_0x9cd5('0x7b')]&&_0x5b9c96[_0x9cd5('0x3a')](_0x40610,_0x50c1c7[_0x3ecd1d][_0x9cd5('0x7b')]===_0x9cd5('0x7c')?![]:!![]);_0x5b9c96[_0x9cd5('0x6d')](_0x40610,_0x50c1c7[_0x3ecd1d][_0x9cd5('0x91')]||_0x40610);}if(_0x46d12b[_0x9cd5('0x7d')]){_0x46d12b[_0x9cd5('0x7d')]=JSON[_0x9cd5('0x7e')](_0x46d12b[_0x9cd5('0x7d')]);for(var _0x4f524e=0x0;_0x4f524e<_0x46d12b[_0x9cd5('0x7d')][_0x9cd5('0x4a')];_0x4f524e+=0x1){if(_0x46d12b[_0x9cd5('0x7d')][_0x4f524e][_0x9cd5('0x40')]&&_['includes'](_0x4ebd13,_0x46d12b[_0x9cd5('0x7d')][_0x4f524e][_0x9cd5('0x40')])&&_0x46d12b[_0x9cd5('0x7d')][_0x4f524e][_0x9cd5('0x7f')]&&_0x46d12b[_0x9cd5('0x7d')][_0x4f524e][_0x9cd5('0x80')]&&_0x46d12b[_0x9cd5('0x7d')][_0x4f524e][_0x9cd5('0x83')]){_0x5b9c96[_0x46d12b[_0x9cd5('0x7d')][_0x4f524e]['type']](_0x46d12b['joins'][_0x4f524e]['foreignTable'],null,util[_0x9cd5('0x90')](_0x9cd5('0x81'),_0x46d12b[_0x9cd5('0x82')],_0x46d12b[_0x9cd5('0x7d')][_0x4f524e][_0x9cd5('0x7f')],_0x46d12b[_0x9cd5('0x7d')][_0x4f524e][_0x9cd5('0x80')],_0x46d12b[_0x9cd5('0x7d')][_0x4f524e][_0x9cd5('0x83')]));}}}if(_0x46d12b[_0x9cd5('0x84')]){_0x46d12b[_0x9cd5('0x84')]=JSON[_0x9cd5('0x7e')](_0x46d12b[_0x9cd5('0x84')]);_0x5b9c96[_0x9cd5('0x3c')](_0x41c07b(_0x46d12b[_0x9cd5('0x84')][_0x9cd5('0x7a')]));}_0x3bd1b9=_0x5b9c96[_0x9cd5('0x85')]();_0x5b9c96[_0x9cd5('0x21')](_0x242045);_0x5b9c96[_0x9cd5('0x20')](0x0);logger[_0x9cd5('0x86')](_0x9cd5('0xa7'),_0x5b9c96['toString']());return dbH[_0x9cd5('0x88')][_0x9cd5('0x33')](_0x5b9c96['toString'](),{'type':dbH[_0x9cd5('0x88')][_0x9cd5('0x89')][_0x9cd5('0xa8')]});}})[_0x9cd5('0x27')](function(){return{'sql':_0x3bd1b9[_0x9cd5('0x87')]()};})[_0x9cd5('0x27')](respondWithResult(_0x57aecd,null))['catch'](handleError(_0x57aecd,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index e344d88..1d70a18 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 _0x9a6a=['api','bluebird','path','rimraf','../../config/environment','exports','define','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x5a3f63,_0x1743f3){var _0xb1c19f=function(_0x813262){while(--_0x813262){_0x5a3f63['push'](_0x5a3f63['shift']());}};_0xb1c19f(++_0x1743f3);}(_0x9a6a,0x110));var _0xa9a6=function(_0x25e971,_0x42c741){_0x25e971=_0x25e971-0x0;var _0x102231=_0x9a6a[_0x25e971];return _0x102231;};'use strict';var _=require(_0xa9a6('0x0'));var util=require(_0xa9a6('0x1'));var logger=require(_0xa9a6('0x2'))(_0xa9a6('0x3'));var moment=require('moment');var BPromise=require(_0xa9a6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa9a6('0x5'));var rimraf=require(_0xa9a6('0x6'));var config=require(_0xa9a6('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0xa9a6('0x8')]=function(_0x42e4b7,_0x1d5dda){return _0x42e4b7[_0xa9a6('0x9')]('AnalyticDefaultReport',attributes,{'tableName':_0xa9a6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16ea=['exports','define','analytics_default_reports','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x339ade,_0x343c2a){var _0x4f5e4b=function(_0xe2e5d9){while(--_0xe2e5d9){_0x339ade['push'](_0x339ade['shift']());}};_0x4f5e4b(++_0x343c2a);}(_0x16ea,0x78));var _0xa16e=function(_0x2f30de,_0x5d86ff){_0x2f30de=_0x2f30de-0x0;var _0x1ce460=_0x16ea[_0x2f30de];return _0x1ce460;};'use strict';var _=require('lodash');var util=require(_0xa16e('0x0'));var logger=require(_0xa16e('0x1'))(_0xa16e('0x2'));var moment=require(_0xa16e('0x3'));var BPromise=require(_0xa16e('0x4'));var rp=require(_0xa16e('0x5'));var fs=require('fs');var path=require(_0xa16e('0x6'));var rimraf=require(_0xa16e('0x7'));var config=require(_0xa16e('0x8'));var attributes=require(_0xa16e('0x9'));module[_0xa16e('0xa')]=function(_0xe84d74,_0x3db5d8){return _0xe84d74[_0xa16e('0xb')]('AnalyticDefaultReport',attributes,{'tableName':_0xa16e('0xc'),'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 9c7fd49..2d80282 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 _0x2917=['info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x52ed18,_0x722adb){var _0x5d0a9e=function(_0x464a){while(--_0x464a){_0x52ed18['push'](_0x52ed18['shift']());}};_0x5d0a9e(++_0x722adb);}(_0x2917,0x142));var _0x7291=function(_0x1ca29f,_0x318ac5){_0x1ca29f=_0x1ca29f-0x0;var _0x576c3b=_0x2917[_0x1ca29f];return _0x576c3b;};'use strict';var _=require(_0x7291('0x0'));var util=require(_0x7291('0x1'));var moment=require(_0x7291('0x2'));var BPromise=require(_0x7291('0x3'));var rs=require(_0x7291('0x4'));var fs=require('fs');var Redis=require(_0x7291('0x5'));var db=require(_0x7291('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7291('0x7'));var config=require(_0x7291('0x8'));var jayson=require(_0x7291('0x9'));var client=jayson[_0x7291('0xa')][_0x7291('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x237997,_0x4609af,_0x1f0fd8){return new BPromise(function(_0x452fc5,_0xb013b3){return client[_0x7291('0xc')](_0x237997,_0x1f0fd8)[_0x7291('0xd')](function(_0x27f037){logger[_0x7291('0xe')](_0x7291('0xf'),_0x4609af,'request\x20sent');logger[_0x7291('0x10')](_0x7291('0x11'),_0x4609af,_0x7291('0x12'),JSON[_0x7291('0x13')](_0x27f037));if(_0x27f037[_0x7291('0x14')]){if(_0x27f037[_0x7291('0x14')]['code']===0x1f4){logger['error'](_0x7291('0xf'),_0x4609af,_0x27f037[_0x7291('0x14')][_0x7291('0x15')]);return _0xb013b3(_0x27f037[_0x7291('0x14')][_0x7291('0x15')]);}logger[_0x7291('0x14')](_0x7291('0xf'),_0x4609af,_0x27f037['error'][_0x7291('0x15')]);return _0x452fc5(_0x27f037[_0x7291('0x14')][_0x7291('0x15')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x4609af,_0x7291('0x12'));_0x452fc5(_0x27f037[_0x7291('0x16')][_0x7291('0x15')]);}})[_0x7291('0x17')](function(_0x427602){logger[_0x7291('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4609af,_0x427602);_0xb013b3(_0x427602);});});} \ No newline at end of file +var _0x58a7=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5978b4,_0x341665){var _0x52ab25=function(_0x5d06eb){while(--_0x5d06eb){_0x5978b4['push'](_0x5978b4['shift']());}};_0x52ab25(++_0x341665);}(_0x58a7,0xf7));var _0x758a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x58a7[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x758a('0x0'));var util=require(_0x758a('0x1'));var moment=require(_0x758a('0x2'));var BPromise=require(_0x758a('0x3'));var rs=require(_0x758a('0x4'));var fs=require('fs');var Redis=require(_0x758a('0x5'));var db=require(_0x758a('0x6'))['db'];var utils=require(_0x758a('0x7'));var logger=require('../../config/logger')(_0x758a('0x8'));var config=require(_0x758a('0x9'));var jayson=require(_0x758a('0xa'));var client=jayson[_0x758a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52bc94,_0x232c83,_0x514bca){return new BPromise(function(_0x227bdb,_0x31311b){return client[_0x758a('0xc')](_0x52bc94,_0x514bca)[_0x758a('0xd')](function(_0x1e5665){logger[_0x758a('0xe')](_0x758a('0xf'),_0x232c83,_0x758a('0x10'));logger[_0x758a('0x11')](_0x758a('0x12'),_0x232c83,_0x758a('0x10'),JSON['stringify'](_0x1e5665));if(_0x1e5665['error']){if(_0x1e5665[_0x758a('0x13')][_0x758a('0x14')]===0x1f4){logger[_0x758a('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x232c83,_0x1e5665[_0x758a('0x13')][_0x758a('0x15')]);return _0x31311b(_0x1e5665[_0x758a('0x13')][_0x758a('0x15')]);}logger[_0x758a('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x232c83,_0x1e5665['error'][_0x758a('0x15')]);return _0x227bdb(_0x1e5665[_0x758a('0x13')][_0x758a('0x15')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x232c83,'request\x20sent');_0x227bdb(_0x1e5665['result'][_0x758a('0x15')]);}})[_0x758a('0x16')](function(_0x520883){logger[_0x758a('0x13')](_0x758a('0xf'),_0x232c83,_0x520883);_0x31311b(_0x520883);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 336e164..b5f50eb 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 _0x2734=['get','isAuthenticated','/:id','show','/:id/preview','run','/:id/query','query','create','update','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x2734,0x116));var _0x4273=function(_0x1021e5,_0x1b5e25){_0x1021e5=_0x1021e5-0x0;var _0x20b207=_0x2734[_0x1021e5];return _0x20b207;};'use strict';var multer=require(_0x4273('0x0'));var util=require('util');var path=require(_0x4273('0x1'));var timeout=require('connect-timeout');var express=require(_0x4273('0x2'));var router=express[_0x4273('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4273('0x4'));var config=require(_0x4273('0x5'));var controller=require(_0x4273('0x6'));router[_0x4273('0x7')]('/',auth[_0x4273('0x8')](),controller['index']);router['get'](_0x4273('0x9'),auth['isAuthenticated'](),controller[_0x4273('0xa')]);router[_0x4273('0x7')](_0x4273('0xb'),auth[_0x4273('0x8')](),controller['preview']);router['get']('/:id/run',auth[_0x4273('0x8')](),controller[_0x4273('0xc')]);router['get'](_0x4273('0xd'),auth['isAuthenticated'](),controller[_0x4273('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4273('0xf')]);router['put'](_0x4273('0x9'),auth[_0x4273('0x8')](),controller[_0x4273('0x10')]);router['delete'](_0x4273('0x9'),auth[_0x4273('0x8')](),controller[_0x4273('0x11')]);module[_0x4273('0x12')]=router; \ No newline at end of file +var _0x483f=['/:id/run','/:id/query','query','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','show','/:id/preview','preview'];(function(_0x3fcc20,_0x57c31b){var _0x15d3ce=function(_0x575619){while(--_0x575619){_0x3fcc20['push'](_0x3fcc20['shift']());}};_0x15d3ce(++_0x57c31b);}(_0x483f,0x142));var _0xf483=function(_0x522924,_0x4e61ea){_0x522924=_0x522924-0x0;var _0x326539=_0x483f[_0x522924];return _0x326539;};'use strict';var multer=require(_0xf483('0x0'));var util=require(_0xf483('0x1'));var path=require(_0xf483('0x2'));var timeout=require(_0xf483('0x3'));var express=require(_0xf483('0x4'));var router=express['Router']();var auth=require(_0xf483('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf483('0x6'));var controller=require(_0xf483('0x7'));router[_0xf483('0x8')]('/',auth[_0xf483('0x9')](),controller[_0xf483('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf483('0xb')]);router[_0xf483('0x8')](_0xf483('0xc'),auth['isAuthenticated'](),controller[_0xf483('0xd')]);router[_0xf483('0x8')](_0xf483('0xe'),auth[_0xf483('0x9')](),controller['run']);router[_0xf483('0x8')](_0xf483('0xf'),auth[_0xf483('0x9')](),controller[_0xf483('0x10')]);router[_0xf483('0x11')]('/',auth[_0xf483('0x9')](),controller[_0xf483('0x12')]);router[_0xf483('0x13')](_0xf483('0x14'),auth['isAuthenticated'](),controller[_0xf483('0x15')]);router['delete'](_0xf483('0x14'),auth[_0xf483('0x9')](),controller[_0xf483('0x16')]);module[_0xf483('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 6abb1b8..b11b038 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 _0xbbe7=['STRING','pdf','xlsx','csv','DATE','Loading','ENUM','manual','INTEGER','sequelize','moment'];(function(_0xf9ce6c,_0x9c1fbf){var _0x551a2b=function(_0x2091ae){while(--_0x2091ae){_0xf9ce6c['push'](_0xf9ce6c['shift']());}};_0x551a2b(++_0x9c1fbf);}(_0xbbe7,0xda));var _0x7bbe=function(_0x315f1a,_0x21414d){_0x315f1a=_0x315f1a-0x0;var _0x2b9890=_0xbbe7[_0x315f1a];return _0x2b9890;};'use strict';var Sequelize=require(_0x7bbe('0x0'));var moment=require(_0x7bbe('0x1'));module['exports']={'name':{'type':Sequelize[_0x7bbe('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0x7bbe('0x3'),_0x7bbe('0x4')),'allowNull':![],'defaultValue':_0x7bbe('0x5')},'savename':{'type':Sequelize[_0x7bbe('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x7bbe('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x7bbe('0x2')],'defaultValue':_0x7bbe('0x7')},'type':{'type':Sequelize[_0x7bbe('0x8')](_0x7bbe('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x7bbe('0x9')},'reportId':{'type':Sequelize[_0x7bbe('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8e28=['STRING','ENUM','csv','pdf','DATE','Loading','scheduled','INTEGER','UNSIGNED','moment','exports'];(function(_0x1ae51f,_0x42b687){var _0x5eeb5d=function(_0x4dcf7d){while(--_0x4dcf7d){_0x1ae51f['push'](_0x1ae51f['shift']());}};_0x5eeb5d(++_0x42b687);}(_0x8e28,0x127));var _0x88e2=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x8e28[_0x263a74];return _0x2aa86c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x88e2('0x0'));module[_0x88e2('0x1')]={'name':{'type':Sequelize[_0x88e2('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x88e2('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x88e2('0x3')](_0x88e2('0x4'),_0x88e2('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x88e2('0x4')},'savename':{'type':Sequelize[_0x88e2('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x88e2('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x88e2('0x2')],'defaultValue':_0x88e2('0x7')},'type':{'type':Sequelize['ENUM']('manual',_0x88e2('0x8')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x88e2('0x9')](0xb)[_0x88e2('0xa')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index c265b2c..c8f1db9 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 _0xbd87=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','get','ExtractedReports','sendStatus','stack','name','send','AnalyticExtractedReport','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','output','join','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','root','format','%s.%s','basename','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xbd87,0xaf));var _0x7bd8=function(_0x41de08,_0x404f17){_0x41de08=_0x41de08-0x0;var _0x44fbe5=_0xbd87[_0x41de08];return _0x44fbe5;};'use strict';var pdf=require(_0x7bd8('0x0'));var emlformat=require(_0x7bd8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7bd8('0x2'));var jsonpatch=require(_0x7bd8('0x3'));var rp=require(_0x7bd8('0x4'));var moment=require(_0x7bd8('0x5'));var BPromise=require(_0x7bd8('0x6'));var Mustache=require('mustache');var util=require(_0x7bd8('0x7'));var path=require(_0x7bd8('0x8'));var sox=require(_0x7bd8('0x9'));var csv=require(_0x7bd8('0xa'));var ejs=require(_0x7bd8('0xb'));var fs=require('fs');var _=require(_0x7bd8('0xc'));var squel=require(_0x7bd8('0xd'));var crypto=require(_0x7bd8('0xe'));var jsforce=require(_0x7bd8('0xf'));var deskjs=require(_0x7bd8('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7bd8('0x11'));var Papa=require(_0x7bd8('0x12'));var Redis=require(_0x7bd8('0x13'));var authService=require(_0x7bd8('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7bd8('0x15'));var hardwareService=require(_0x7bd8('0x16'));var logger=require(_0x7bd8('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x7bd8('0x18'));var licenseUtil=require(_0x7bd8('0x19'));var db=require(_0x7bd8('0x1a'))['db'];function respondWithStatusCode(_0x32d404,_0x2b8209){_0x2b8209=_0x2b8209||0xcc;return function(_0x4e576c){if(_0x4e576c){return _0x32d404['sendStatus'](_0x2b8209);}return _0x32d404[_0x7bd8('0x1b')](_0x2b8209)[_0x7bd8('0x1c')]();};}function respondWithResult(_0x22ed25,_0x37e1f6){_0x37e1f6=_0x37e1f6||0xc8;return function(_0xe22aeb){if(_0xe22aeb){return _0x22ed25[_0x7bd8('0x1b')](_0x37e1f6)[_0x7bd8('0x1d')](_0xe22aeb);}};}function respondWithFilteredResult(_0x2f07f8,_0x48cd4a){return function(_0x32d08e){if(_0x32d08e){var _0xc67e7c=_0x32d08e[_0x7bd8('0x1e')],_0x2d18a6=_0x48cd4a[_0x7bd8('0x1f')],_0xea7c10=_0x48cd4a['offset']+_0x48cd4a[_0x7bd8('0x20')],_0x2fe5b2;if(_0xea7c10>=_0xc67e7c){_0xea7c10=_0xc67e7c;_0x2fe5b2=0xc8;}else{_0x2fe5b2=0xce;}_0x2f07f8[_0x7bd8('0x1b')](_0x2fe5b2);return _0x2f07f8[_0x7bd8('0x21')](_0x7bd8('0x22'),_0x2d18a6+'-'+_0xea7c10+'/'+_0xc67e7c)[_0x7bd8('0x1d')](_0x32d08e);}return null;};}function patchUpdates(_0x36da88){return function(_0x3cc1ea){try{jsonpatch['apply'](_0x3cc1ea,_0x36da88,!![]);}catch(_0x4469fa){return BPromise[_0x7bd8('0x23')](_0x4469fa);}return _0x3cc1ea['save']();};}function saveUpdates(_0x3abbff,_0x2604cd){return function(_0x290d6f){if(_0x290d6f){return _0x290d6f[_0x7bd8('0x24')](_0x3abbff)[_0x7bd8('0x25')](function(_0x3dfe32){return _0x3dfe32;});}return null;};}function removeEntity(_0x588f9b,_0x2e1231){return function(_0x521365){if(_0x521365){return _0x521365[_0x7bd8('0x26')]()['then'](function(){var _0x10b97b=_0x521365[_0x7bd8('0x27')]({'plain':!![]});var _0x1b4ac0=_0x7bd8('0x28');return db['UserProfileResource'][_0x7bd8('0x26')]({'where':{'type':_0x1b4ac0,'resourceId':_0x10b97b['id']}})['then'](function(){return _0x521365;});})[_0x7bd8('0x25')](function(){_0x588f9b[_0x7bd8('0x1b')](0xcc)[_0x7bd8('0x1c')]();});}};}function handleEntityNotFound(_0xe66a0a,_0x556ba8){return function(_0x41e693){if(!_0x41e693){_0xe66a0a[_0x7bd8('0x29')](0x194);}return _0x41e693;};}function handleError(_0x24d83a,_0x57df9e){_0x57df9e=_0x57df9e||0x1f4;return function(_0x283ee7){logger['error'](_0x283ee7[_0x7bd8('0x2a')]);if(_0x283ee7[_0x7bd8('0x2b')]){delete _0x283ee7[_0x7bd8('0x2b')];}_0x24d83a[_0x7bd8('0x1b')](_0x57df9e)[_0x7bd8('0x2c')](_0x283ee7);};}exports['index']=function(_0x42289c,_0x1e6649){var _0x384612={},_0x4b0c91={},_0x4e2295={'count':0x0,'rows':[]};var _0x357c40=_['map'](db[_0x7bd8('0x2d')][_0x7bd8('0x2e')],function(_0x485588){return{'name':_0x485588[_0x7bd8('0x2f')],'type':_0x485588[_0x7bd8('0x30')][_0x7bd8('0x31')]};});_0x4b0c91['model']=_[_0x7bd8('0x32')](_0x357c40,_0x7bd8('0x2b'));_0x4b0c91[_0x7bd8('0x33')]=_['keys'](_0x42289c[_0x7bd8('0x33')]);_0x4b0c91[_0x7bd8('0x34')]=_[_0x7bd8('0x35')](_0x4b0c91[_0x7bd8('0x36')],_0x4b0c91[_0x7bd8('0x33')]);_0x384612[_0x7bd8('0x37')]=_[_0x7bd8('0x35')](_0x4b0c91[_0x7bd8('0x36')],qs[_0x7bd8('0x38')](_0x42289c['query'][_0x7bd8('0x38')]));_0x384612[_0x7bd8('0x37')]=_0x384612[_0x7bd8('0x37')]['length']?_0x384612[_0x7bd8('0x37')]:_0x4b0c91[_0x7bd8('0x36')];if(!_0x42289c[_0x7bd8('0x33')]['hasOwnProperty']('nolimit')){_0x384612['limit']=qs[_0x7bd8('0x20')](_0x42289c[_0x7bd8('0x33')]['limit']);_0x384612[_0x7bd8('0x1f')]=qs[_0x7bd8('0x1f')](_0x42289c[_0x7bd8('0x33')]['offset']);}_0x384612['order']=qs[_0x7bd8('0x39')](_0x42289c[_0x7bd8('0x33')][_0x7bd8('0x39')]);_0x384612[_0x7bd8('0x3a')]=qs[_0x7bd8('0x34')](_[_0x7bd8('0x3b')](_0x42289c['query'],_0x4b0c91[_0x7bd8('0x34')]),_0x357c40);if(_0x42289c[_0x7bd8('0x33')]['filter']){_0x384612['where']=_[_0x7bd8('0x3c')](_0x384612[_0x7bd8('0x3a')],{'$or':_[_0x7bd8('0x32')](_0x357c40,function(_0x73163d){if(_0x73163d[_0x7bd8('0x30')]!==_0x7bd8('0x3d')){var _0x3220de={};_0x3220de[_0x73163d[_0x7bd8('0x2b')]]={'$like':'%'+_0x42289c['query'][_0x7bd8('0x3e')]+'%'};return _0x3220de;}})});}_0x384612=_[_0x7bd8('0x3c')]({},_0x384612,_0x42289c[_0x7bd8('0x3f')]);var _0x296eb1={'where':_0x384612[_0x7bd8('0x3a')]};return db['AnalyticExtractedReport'][_0x7bd8('0x1e')](_0x296eb1)[_0x7bd8('0x25')](function(_0x551dd8){_0x4e2295['count']=_0x551dd8;if(_0x42289c[_0x7bd8('0x33')][_0x7bd8('0x40')]){_0x384612[_0x7bd8('0x41')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x7bd8('0x42')](_0x384612);})['then'](function(_0x179086){_0x4e2295[_0x7bd8('0x43')]=_0x179086;return _0x4e2295;})[_0x7bd8('0x25')](respondWithFilteredResult(_0x1e6649,_0x384612))[_0x7bd8('0x44')](handleError(_0x1e6649,null));};exports[_0x7bd8('0x45')]=function(_0x285ed1,_0xa24f13){var _0x141f7e={'raw':!![],'where':{'id':_0x285ed1[_0x7bd8('0x46')]['id']}},_0x1b3989={};_0x1b3989['model']=_['keys'](db[_0x7bd8('0x2d')]['rawAttributes']);_0x1b3989['query']=_[_0x7bd8('0x47')](_0x285ed1[_0x7bd8('0x33')]);_0x1b3989[_0x7bd8('0x34')]=_['intersection'](_0x1b3989[_0x7bd8('0x36')],_0x1b3989[_0x7bd8('0x33')]);_0x141f7e[_0x7bd8('0x37')]=_[_0x7bd8('0x35')](_0x1b3989[_0x7bd8('0x36')],qs[_0x7bd8('0x38')](_0x285ed1[_0x7bd8('0x33')][_0x7bd8('0x38')]));_0x141f7e['attributes']=_0x141f7e[_0x7bd8('0x37')][_0x7bd8('0x48')]?_0x141f7e['attributes']:_0x1b3989[_0x7bd8('0x36')];if(_0x285ed1[_0x7bd8('0x33')][_0x7bd8('0x40')]){_0x141f7e[_0x7bd8('0x41')]=[{'all':!![]}];}_0x141f7e=_[_0x7bd8('0x3c')]({},_0x141f7e,_0x285ed1[_0x7bd8('0x3f')]);return db[_0x7bd8('0x2d')][_0x7bd8('0x49')](_0x141f7e)[_0x7bd8('0x25')](handleEntityNotFound(_0xa24f13,null))[_0x7bd8('0x25')](respondWithResult(_0xa24f13,null))['catch'](handleError(_0xa24f13,null));};exports[_0x7bd8('0x4a')]=function(_0x5649c2,_0x3a6eb2){return db[_0x7bd8('0x2d')][_0x7bd8('0x4a')](_0x5649c2[_0x7bd8('0x4b')],{})[_0x7bd8('0x25')](function(_0x393863){var _0x1b9128=_0x5649c2[_0x7bd8('0x4c')][_0x7bd8('0x27')]({'plain':!![]});if(!_0x1b9128)throw new Error(_0x7bd8('0x4d'));if(_0x1b9128[_0x7bd8('0x4e')]===_0x7bd8('0x4c')){var _0xedbe0=_0x393863[_0x7bd8('0x27')]({'plain':!![]});var _0x40c08d=_0x7bd8('0x28');return db[_0x7bd8('0x4f')][_0x7bd8('0x49')]({'where':{'name':_0x40c08d,'userProfileId':_0x1b9128['userProfileId']},'raw':!![]})[_0x7bd8('0x25')](function(_0x705f34){if(_0x705f34&&_0x705f34[_0x7bd8('0x50')]===0x0){return db[_0x7bd8('0x51')][_0x7bd8('0x4a')]({'name':_0xedbe0[_0x7bd8('0x2b')],'resourceId':_0xedbe0['id'],'type':_0x705f34['name'],'sectionId':_0x705f34['id']},{})['then'](function(){return _0x393863;});}else{return _0x393863;}})[_0x7bd8('0x44')](function(_0x18eb7c){logger[_0x7bd8('0x52')](_0x7bd8('0x53'),_0x18eb7c);throw _0x18eb7c;});}return _0x393863;})[_0x7bd8('0x25')](respondWithResult(_0x3a6eb2,0xc9))[_0x7bd8('0x44')](handleError(_0x3a6eb2,null));};exports[_0x7bd8('0x24')]=function(_0x4eacac,_0x37f146){if(_0x4eacac[_0x7bd8('0x4b')]['id']){delete _0x4eacac['body']['id'];}return db['AnalyticExtractedReport'][_0x7bd8('0x49')]({'where':{'id':_0x4eacac['params']['id']}})[_0x7bd8('0x25')](handleEntityNotFound(_0x37f146,null))[_0x7bd8('0x25')](saveUpdates(_0x4eacac[_0x7bd8('0x4b')],null))['then'](respondWithResult(_0x37f146,null))[_0x7bd8('0x44')](handleError(_0x37f146,null));};exports[_0x7bd8('0x26')]=function(_0x247a7c,_0x6e55b5){return db[_0x7bd8('0x2d')][_0x7bd8('0x49')]({'where':{'id':_0x247a7c[_0x7bd8('0x46')]['id']}})[_0x7bd8('0x25')](handleEntityNotFound(_0x6e55b5,null))['then'](removeEntity(_0x6e55b5,null))[_0x7bd8('0x44')](handleError(_0x6e55b5,null));};exports[_0x7bd8('0x54')]=function(_0x1c64f2,_0x3891d4,_0x2fc54c){return db['AnalyticExtractedReport'][_0x7bd8('0x49')]({'where':{'id':_0x1c64f2[_0x7bd8('0x46')]['id']},'attributes':['name','basename','savename',_0x7bd8('0x55')],'raw':!![]})[_0x7bd8('0x25')](handleEntityNotFound(_0x3891d4,null))['then'](function(_0x44c218){if(_0x44c218){if(!fs['existsSync'](path[_0x7bd8('0x56')](config['root'],_0x7bd8('0x57'),_0x44c218[_0x7bd8('0x58')]))){throw new db[(_0x7bd8('0x59'))][(_0x7bd8('0x5a'))](_0x7bd8('0x5b'));}if(_0x1c64f2[_0x7bd8('0x33')]['exists']){return _0x3891d4['sendStatus'](0xc8);}return _0x3891d4[_0x7bd8('0x54')](path['join'](config[_0x7bd8('0x5c')],_0x7bd8('0x57'),_0x44c218[_0x7bd8('0x58')]),util[_0x7bd8('0x5d')](_0x7bd8('0x5e'),_0x44c218[_0x7bd8('0x5f')]||_0x44c218['name'],_0x44c218[_0x7bd8('0x55')]['toLowerCase']()));}})['catch'](handleError(_0x3891d4,null));}; \ No newline at end of file +var _0x4d87=['model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','AnalyticExtractedReport','rows','catch','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','lodash','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','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','then','destroy','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName'];(function(_0x14a3e9,_0x47c0d6){var _0x262274=function(_0x3b9437){while(--_0x3b9437){_0x14a3e9['push'](_0x14a3e9['shift']());}};_0x262274(++_0x47c0d6);}(_0x4d87,0x153));var _0x74d8=function(_0x25be38,_0x1d989a){_0x25be38=_0x25be38-0x0;var _0x2f546b=_0x4d87[_0x25be38];return _0x2f546b;};'use strict';var pdf=require(_0x74d8('0x0'));var emlformat=require(_0x74d8('0x1'));var rimraf=require(_0x74d8('0x2'));var zipdir=require(_0x74d8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74d8('0x4'));var moment=require(_0x74d8('0x5'));var BPromise=require(_0x74d8('0x6'));var Mustache=require(_0x74d8('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x74d8('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x74d8('0x9'));var squel=require('squel');var crypto=require(_0x74d8('0xa'));var jsforce=require(_0x74d8('0xb'));var deskjs=require(_0x74d8('0xc'));var toCsv=require(_0x74d8('0x8'));var querystring=require(_0x74d8('0xd'));var Papa=require(_0x74d8('0xe'));var Redis=require('ioredis');var authService=require(_0x74d8('0xf'));var qs=require(_0x74d8('0x10'));var as=require(_0x74d8('0x11'));var hardwareService=require(_0x74d8('0x12'));var logger=require(_0x74d8('0x13'))(_0x74d8('0x14'));var utils=require(_0x74d8('0x15'));var config=require(_0x74d8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x74d8('0x17'))['db'];function respondWithStatusCode(_0x5687c4,_0x47bbf3){_0x47bbf3=_0x47bbf3||0xcc;return function(_0x515c7b){if(_0x515c7b){return _0x5687c4[_0x74d8('0x18')](_0x47bbf3);}return _0x5687c4[_0x74d8('0x19')](_0x47bbf3)[_0x74d8('0x1a')]();};}function respondWithResult(_0x401c9c,_0x14ee54){_0x14ee54=_0x14ee54||0xc8;return function(_0x1f2e67){if(_0x1f2e67){return _0x401c9c['status'](_0x14ee54)['json'](_0x1f2e67);}};}function respondWithFilteredResult(_0xb1ce3,_0x53e57e){return function(_0x463228){if(_0x463228){var _0x46dd1a=_0x463228[_0x74d8('0x1b')],_0x3247fe=_0x53e57e[_0x74d8('0x1c')],_0x19cfa0=_0x53e57e[_0x74d8('0x1c')]+_0x53e57e[_0x74d8('0x1d')],_0x18b02a;if(_0x19cfa0>=_0x46dd1a){_0x19cfa0=_0x46dd1a;_0x18b02a=0xc8;}else{_0x18b02a=0xce;}_0xb1ce3[_0x74d8('0x19')](_0x18b02a);return _0xb1ce3[_0x74d8('0x1e')](_0x74d8('0x1f'),_0x3247fe+'-'+_0x19cfa0+'/'+_0x46dd1a)[_0x74d8('0x20')](_0x463228);}return null;};}function patchUpdates(_0x37b3d0){return function(_0x45e160){try{jsonpatch[_0x74d8('0x21')](_0x45e160,_0x37b3d0,!![]);}catch(_0x468f26){return BPromise[_0x74d8('0x22')](_0x468f26);}return _0x45e160['save']();};}function saveUpdates(_0x736335,_0x32891e){return function(_0x3ae527){if(_0x3ae527){return _0x3ae527['update'](_0x736335)[_0x74d8('0x23')](function(_0x2357ec){return _0x2357ec;});}return null;};}function removeEntity(_0x33b5f2,_0x7e6f71){return function(_0x5ea759){if(_0x5ea759){return _0x5ea759[_0x74d8('0x24')]()[_0x74d8('0x23')](function(){var _0x5abfc4=_0x5ea759['get']({'plain':!![]});var _0x13cfc9='ExtractedReports';return db[_0x74d8('0x25')]['destroy']({'where':{'type':_0x13cfc9,'resourceId':_0x5abfc4['id']}})[_0x74d8('0x23')](function(){return _0x5ea759;});})['then'](function(){_0x33b5f2[_0x74d8('0x19')](0xcc)[_0x74d8('0x1a')]();});}};}function handleEntityNotFound(_0x4fed5d,_0x1266e6){return function(_0x413d59){if(!_0x413d59){_0x4fed5d[_0x74d8('0x18')](0x194);}return _0x413d59;};}function handleError(_0x1eca83,_0x371468){_0x371468=_0x371468||0x1f4;return function(_0x1c5059){logger[_0x74d8('0x26')](_0x1c5059[_0x74d8('0x27')]);if(_0x1c5059[_0x74d8('0x28')]){delete _0x1c5059[_0x74d8('0x28')];}_0x1eca83[_0x74d8('0x19')](_0x371468)[_0x74d8('0x29')](_0x1c5059);};}exports[_0x74d8('0x2a')]=function(_0x39d9e7,_0x1e0ab4){var _0x4f0934={},_0x33e358={},_0x4f2891={'count':0x0,'rows':[]};var _0x16fceb=_['map'](db['AnalyticExtractedReport'][_0x74d8('0x2b')],function(_0x3a0c05){return{'name':_0x3a0c05[_0x74d8('0x2c')],'type':_0x3a0c05['type']['key']};});_0x33e358[_0x74d8('0x2d')]=_[_0x74d8('0x2e')](_0x16fceb,_0x74d8('0x28'));_0x33e358[_0x74d8('0x2f')]=_[_0x74d8('0x30')](_0x39d9e7[_0x74d8('0x2f')]);_0x33e358['filters']=_[_0x74d8('0x31')](_0x33e358[_0x74d8('0x2d')],_0x33e358[_0x74d8('0x2f')]);_0x4f0934[_0x74d8('0x32')]=_['intersection'](_0x33e358[_0x74d8('0x2d')],qs[_0x74d8('0x33')](_0x39d9e7['query']['fields']));_0x4f0934[_0x74d8('0x32')]=_0x4f0934[_0x74d8('0x32')][_0x74d8('0x34')]?_0x4f0934[_0x74d8('0x32')]:_0x33e358['model'];if(!_0x39d9e7[_0x74d8('0x2f')]['hasOwnProperty'](_0x74d8('0x35'))){_0x4f0934[_0x74d8('0x1d')]=qs['limit'](_0x39d9e7['query'][_0x74d8('0x1d')]);_0x4f0934[_0x74d8('0x1c')]=qs[_0x74d8('0x1c')](_0x39d9e7[_0x74d8('0x2f')][_0x74d8('0x1c')]);}_0x4f0934[_0x74d8('0x36')]=qs[_0x74d8('0x37')](_0x39d9e7[_0x74d8('0x2f')][_0x74d8('0x37')]);_0x4f0934[_0x74d8('0x38')]=qs[_0x74d8('0x39')](_[_0x74d8('0x3a')](_0x39d9e7[_0x74d8('0x2f')],_0x33e358[_0x74d8('0x39')]),_0x16fceb);if(_0x39d9e7['query'][_0x74d8('0x3b')]){_0x4f0934[_0x74d8('0x38')]=_[_0x74d8('0x3c')](_0x4f0934['where'],{'$or':_['map'](_0x16fceb,function(_0x4759a5){if(_0x4759a5[_0x74d8('0x3d')]!==_0x74d8('0x3e')){var _0x3cf601={};_0x3cf601[_0x4759a5[_0x74d8('0x28')]]={'$like':'%'+_0x39d9e7['query'][_0x74d8('0x3b')]+'%'};return _0x3cf601;}})});}_0x4f0934=_[_0x74d8('0x3c')]({},_0x4f0934,_0x39d9e7[_0x74d8('0x3f')]);var _0x5dbcb8={'where':_0x4f0934[_0x74d8('0x38')]};return db['AnalyticExtractedReport'][_0x74d8('0x1b')](_0x5dbcb8)[_0x74d8('0x23')](function(_0x26ed75){_0x4f2891[_0x74d8('0x1b')]=_0x26ed75;if(_0x39d9e7[_0x74d8('0x2f')][_0x74d8('0x40')]){_0x4f0934[_0x74d8('0x41')]=[{'all':!![]}];}return db[_0x74d8('0x42')]['findAll'](_0x4f0934);})[_0x74d8('0x23')](function(_0x549350){_0x4f2891[_0x74d8('0x43')]=_0x549350;return _0x4f2891;})[_0x74d8('0x23')](respondWithFilteredResult(_0x1e0ab4,_0x4f0934))[_0x74d8('0x44')](handleError(_0x1e0ab4,null));};exports[_0x74d8('0x45')]=function(_0x58187e,_0x18f1b4){var _0x5bd56e={'raw':!![],'where':{'id':_0x58187e[_0x74d8('0x46')]['id']}},_0xed43cb={};_0xed43cb['model']=_['keys'](db[_0x74d8('0x42')][_0x74d8('0x2b')]);_0xed43cb[_0x74d8('0x2f')]=_[_0x74d8('0x30')](_0x58187e[_0x74d8('0x2f')]);_0xed43cb[_0x74d8('0x39')]=_['intersection'](_0xed43cb[_0x74d8('0x2d')],_0xed43cb['query']);_0x5bd56e[_0x74d8('0x32')]=_[_0x74d8('0x31')](_0xed43cb['model'],qs[_0x74d8('0x33')](_0x58187e[_0x74d8('0x2f')][_0x74d8('0x33')]));_0x5bd56e['attributes']=_0x5bd56e[_0x74d8('0x32')][_0x74d8('0x34')]?_0x5bd56e[_0x74d8('0x32')]:_0xed43cb[_0x74d8('0x2d')];if(_0x58187e['query'][_0x74d8('0x40')]){_0x5bd56e[_0x74d8('0x41')]=[{'all':!![]}];}_0x5bd56e=_['merge']({},_0x5bd56e,_0x58187e[_0x74d8('0x3f')]);return db[_0x74d8('0x42')][_0x74d8('0x47')](_0x5bd56e)[_0x74d8('0x23')](handleEntityNotFound(_0x18f1b4,null))[_0x74d8('0x23')](respondWithResult(_0x18f1b4,null))[_0x74d8('0x44')](handleError(_0x18f1b4,null));};exports[_0x74d8('0x48')]=function(_0x56b250,_0x3b0375){return db['AnalyticExtractedReport'][_0x74d8('0x48')](_0x56b250['body'],{})[_0x74d8('0x23')](function(_0x47f008){var _0x981a63=_0x56b250[_0x74d8('0x49')][_0x74d8('0x4a')]({'plain':!![]});if(!_0x981a63)throw new Error(_0x74d8('0x4b'));if(_0x981a63[_0x74d8('0x4c')]===_0x74d8('0x49')){var _0x40bfae=_0x47f008['get']({'plain':!![]});var _0xed6dcd=_0x74d8('0x4d');return db[_0x74d8('0x4e')][_0x74d8('0x47')]({'where':{'name':_0xed6dcd,'userProfileId':_0x981a63[_0x74d8('0x4f')]},'raw':!![]})[_0x74d8('0x23')](function(_0x5e6604){if(_0x5e6604&&_0x5e6604[_0x74d8('0x50')]===0x0){return db[_0x74d8('0x25')]['create']({'name':_0x40bfae[_0x74d8('0x28')],'resourceId':_0x40bfae['id'],'type':_0x5e6604['name'],'sectionId':_0x5e6604['id']},{})[_0x74d8('0x23')](function(){return _0x47f008;});}else{return _0x47f008;}})[_0x74d8('0x44')](function(_0x31a959){logger[_0x74d8('0x26')](_0x74d8('0x51'),_0x31a959);throw _0x31a959;});}return _0x47f008;})[_0x74d8('0x23')](respondWithResult(_0x3b0375,0xc9))[_0x74d8('0x44')](handleError(_0x3b0375,null));};exports['update']=function(_0x50319e,_0x3e3b62){if(_0x50319e['body']['id']){delete _0x50319e[_0x74d8('0x52')]['id'];}return db['AnalyticExtractedReport'][_0x74d8('0x47')]({'where':{'id':_0x50319e[_0x74d8('0x46')]['id']}})[_0x74d8('0x23')](handleEntityNotFound(_0x3e3b62,null))['then'](saveUpdates(_0x50319e['body'],null))['then'](respondWithResult(_0x3e3b62,null))[_0x74d8('0x44')](handleError(_0x3e3b62,null));};exports[_0x74d8('0x24')]=function(_0x1c8a97,_0x5d2b26){return db['AnalyticExtractedReport'][_0x74d8('0x47')]({'where':{'id':_0x1c8a97[_0x74d8('0x46')]['id']}})[_0x74d8('0x23')](handleEntityNotFound(_0x5d2b26,null))[_0x74d8('0x23')](removeEntity(_0x5d2b26,null))[_0x74d8('0x44')](handleError(_0x5d2b26,null));};exports[_0x74d8('0x53')]=function(_0x12addb,_0x48d7ff,_0x16ca6d){return db['AnalyticExtractedReport'][_0x74d8('0x47')]({'where':{'id':_0x12addb['params']['id']},'attributes':['name',_0x74d8('0x54'),_0x74d8('0x55'),_0x74d8('0x56')],'raw':!![]})[_0x74d8('0x23')](handleEntityNotFound(_0x48d7ff,null))[_0x74d8('0x23')](function(_0x38ca69){if(_0x38ca69){if(!fs[_0x74d8('0x57')](path[_0x74d8('0x58')](config[_0x74d8('0x59')],_0x74d8('0x5a'),_0x38ca69[_0x74d8('0x55')]))){throw new db[(_0x74d8('0x5b'))][(_0x74d8('0x5c'))](_0x74d8('0x5d'));}if(_0x12addb['query'][_0x74d8('0x5e')]){return _0x48d7ff[_0x74d8('0x18')](0xc8);}return _0x48d7ff[_0x74d8('0x53')](path[_0x74d8('0x58')](config[_0x74d8('0x59')],_0x74d8('0x5a'),_0x38ca69[_0x74d8('0x55')]),util['format']('%s.%s',_0x38ca69[_0x74d8('0x54')]||_0x38ca69[_0x74d8('0x28')],_0x38ca69[_0x74d8('0x56')][_0x74d8('0x5f')]()));}})[_0x74d8('0x44')](handleError(_0x48d7ff,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 5b93a1d..b5e4895 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 _0x7c7b=['exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2e54ca,_0x1d3829){var _0x5a40a7=function(_0x27c13a){while(--_0x27c13a){_0x2e54ca['push'](_0x2e54ca['shift']());}};_0x5a40a7(++_0x1d3829);}(_0x7c7b,0x79));var _0xb7c7=function(_0x2abd13,_0x501317){_0x2abd13=_0x2abd13-0x0;var _0x5ad645=_0x7c7b[_0x2abd13];return _0x5ad645;};'use strict';var _=require(_0xb7c7('0x0'));var util=require(_0xb7c7('0x1'));var logger=require(_0xb7c7('0x2'))(_0xb7c7('0x3'));var moment=require(_0xb7c7('0x4'));var BPromise=require(_0xb7c7('0x5'));var rp=require(_0xb7c7('0x6'));var fs=require('fs');var path=require(_0xb7c7('0x7'));var rimraf=require(_0xb7c7('0x8'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0xb7c7('0x9')]=function(_0x54ccd4,_0x595b2b){return _0x54ccd4[_0xb7c7('0xa')](_0xb7c7('0xb'),attributes,{'tableName':_0xb7c7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e9d=['api','moment','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','lodash'];(function(_0x27d9ee,_0x4ead1d){var _0x4ef0d6=function(_0x3bd5a2){while(--_0x3bd5a2){_0x27d9ee['push'](_0x27d9ee['shift']());}};_0x4ef0d6(++_0x4ead1d);}(_0x4e9d,0x171));var _0xd4e9=function(_0x248c51,_0xdf9962){_0x248c51=_0x248c51-0x0;var _0x28c4ce=_0x4e9d[_0x248c51];return _0x28c4ce;};'use strict';var _=require(_0xd4e9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd4e9('0x1'));var moment=require(_0xd4e9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4e9('0x3'));var rimraf=require(_0xd4e9('0x4'));var config=require(_0xd4e9('0x5'));var attributes=require(_0xd4e9('0x6'));module[_0xd4e9('0x7')]=function(_0x5ed83d,_0x15bed1){return _0x5ed83d[_0xd4e9('0x8')]('AnalyticExtractedReport',attributes,{'tableName':_0xd4e9('0x9'),'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 9a404b2..4b207b7 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 _0x6d43=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x5cf1d6,_0x4a4fb6){var _0x408043=function(_0x44a725){while(--_0x44a725){_0x5cf1d6['push'](_0x5cf1d6['shift']());}};_0x408043(++_0x4a4fb6);}(_0x6d43,0x18c));var _0x36d4=function(_0x320486,_0x6bd2a4){_0x320486=_0x320486-0x0;var _0x214ab3=_0x6d43[_0x320486];return _0x214ab3;};'use strict';var _=require(_0x36d4('0x0'));var util=require(_0x36d4('0x1'));var moment=require('moment');var BPromise=require(_0x36d4('0x2'));var rs=require(_0x36d4('0x3'));var fs=require('fs');var Redis=require(_0x36d4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x36d4('0x5'));var logger=require(_0x36d4('0x6'))(_0x36d4('0x7'));var config=require(_0x36d4('0x8'));var jayson=require(_0x36d4('0x9'));var client=jayson[_0x36d4('0xa')][_0x36d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fa455,_0x5ec5b9,_0x308341){return new BPromise(function(_0x208279,_0x558bec){return client[_0x36d4('0xc')](_0x3fa455,_0x308341)['then'](function(_0x283c0f){logger[_0x36d4('0xd')](_0x36d4('0xe'),_0x5ec5b9,_0x36d4('0xf'));logger[_0x36d4('0x10')](_0x36d4('0x11'),_0x5ec5b9,_0x36d4('0xf'),JSON[_0x36d4('0x12')](_0x283c0f));if(_0x283c0f['error']){if(_0x283c0f[_0x36d4('0x13')]['code']===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x5ec5b9,_0x283c0f[_0x36d4('0x13')]['message']);return _0x558bec(_0x283c0f[_0x36d4('0x13')][_0x36d4('0x14')]);}logger[_0x36d4('0x13')](_0x36d4('0xe'),_0x5ec5b9,_0x283c0f[_0x36d4('0x13')][_0x36d4('0x14')]);return _0x208279(_0x283c0f[_0x36d4('0x13')][_0x36d4('0x14')]);}else{logger[_0x36d4('0xd')](_0x36d4('0xe'),_0x5ec5b9,_0x36d4('0xf'));_0x208279(_0x283c0f['result'][_0x36d4('0x14')]);}})[_0x36d4('0x15')](function(_0x4430f4){logger['error'](_0x36d4('0xe'),_0x5ec5b9,_0x4430f4);_0x558bec(_0x4430f4);});});} \ No newline at end of file +var _0x15a1=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x18ddd8,_0x263229){var _0x72af0a=function(_0x58130d){while(--_0x58130d){_0x18ddd8['push'](_0x18ddd8['shift']());}};_0x72af0a(++_0x263229);}(_0x15a1,0x125));var _0x115a=function(_0x5c0927,_0x3de68){_0x5c0927=_0x5c0927-0x0;var _0x46ea03=_0x15a1[_0x5c0927];return _0x46ea03;};'use strict';var _=require(_0x115a('0x0'));var util=require(_0x115a('0x1'));var moment=require(_0x115a('0x2'));var BPromise=require(_0x115a('0x3'));var rs=require(_0x115a('0x4'));var fs=require('fs');var Redis=require(_0x115a('0x5'));var db=require(_0x115a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x115a('0x7'))(_0x115a('0x8'));var config=require(_0x115a('0x9'));var jayson=require(_0x115a('0xa'));var client=jayson[_0x115a('0xb')][_0x115a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x57bc65,_0x45a587,_0xa32b96){return new BPromise(function(_0x30ac98,_0x4bbbd5){return client[_0x115a('0xd')](_0x57bc65,_0xa32b96)[_0x115a('0xe')](function(_0x487ebc){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x45a587,_0x115a('0xf'));logger[_0x115a('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x45a587,_0x115a('0xf'),JSON[_0x115a('0x11')](_0x487ebc));if(_0x487ebc[_0x115a('0x12')]){if(_0x487ebc[_0x115a('0x12')][_0x115a('0x13')]===0x1f4){logger['error'](_0x115a('0x14'),_0x45a587,_0x487ebc[_0x115a('0x12')]['message']);return _0x4bbbd5(_0x487ebc[_0x115a('0x12')][_0x115a('0x15')]);}logger[_0x115a('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x45a587,_0x487ebc[_0x115a('0x12')][_0x115a('0x15')]);return _0x30ac98(_0x487ebc[_0x115a('0x12')][_0x115a('0x15')]);}else{logger[_0x115a('0x16')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x45a587,_0x115a('0xf'));_0x30ac98(_0x487ebc[_0x115a('0x17')][_0x115a('0x15')]);}})[_0x115a('0x18')](function(_0x5586f9){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x45a587,_0x5586f9);_0x4bbbd5(_0x5586f9);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 1bba0b9..09d1b8c 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 _0xcaff=['../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','index','show','/:id/download','post','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x319cb9,_0x4b8d35){var _0x1735fc=function(_0x43b061){while(--_0x43b061){_0x319cb9['push'](_0x319cb9['shift']());}};_0x1735fc(++_0x4b8d35);}(_0xcaff,0x73));var _0xfcaf=function(_0x4dcbed,_0x29fb71){_0x4dcbed=_0x4dcbed-0x0;var _0x613e2f=_0xcaff[_0x4dcbed];return _0x613e2f;};'use strict';var multer=require(_0xfcaf('0x0'));var util=require('util');var path=require(_0xfcaf('0x1'));var timeout=require(_0xfcaf('0x2'));var express=require(_0xfcaf('0x3'));var router=express[_0xfcaf('0x4')]();var auth=require(_0xfcaf('0x5'));var interaction=require(_0xfcaf('0x6'));var config=require('../../config/environment');var controller=require(_0xfcaf('0x7'));router[_0xfcaf('0x8')]('/',auth[_0xfcaf('0x9')](),controller[_0xfcaf('0xa')]);router[_0xfcaf('0x8')]('/:id',auth[_0xfcaf('0x9')](),controller[_0xfcaf('0xb')]);router[_0xfcaf('0x8')](_0xfcaf('0xc'),auth[_0xfcaf('0x9')](),controller['download']);router[_0xfcaf('0xd')]('/',auth[_0xfcaf('0x9')](),controller[_0xfcaf('0xe')]);router[_0xfcaf('0xf')](_0xfcaf('0x10'),auth[_0xfcaf('0x9')](),controller[_0xfcaf('0x11')]);router['delete'](_0xfcaf('0x10'),auth[_0xfcaf('0x9')](),controller[_0xfcaf('0x12')]);module[_0xfcaf('0x13')]=router; \ No newline at end of file +var _0x484a=['/:id','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/download','download','create','put','delete'];(function(_0x3e31b2,_0x2e95b3){var _0x1f4574=function(_0x210699){while(--_0x210699){_0x3e31b2['push'](_0x3e31b2['shift']());}};_0x1f4574(++_0x2e95b3);}(_0x484a,0x191));var _0xa484=function(_0x10dcf0,_0x2d67a8){_0x10dcf0=_0x10dcf0-0x0;var _0x128c8a=_0x484a[_0x10dcf0];return _0x128c8a;};'use strict';var multer=require(_0xa484('0x0'));var util=require(_0xa484('0x1'));var path=require('path');var timeout=require(_0xa484('0x2'));var express=require('express');var router=express[_0xa484('0x3')]();var auth=require(_0xa484('0x4'));var interaction=require(_0xa484('0x5'));var config=require(_0xa484('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0xa484('0x7')]('/',auth[_0xa484('0x8')](),controller[_0xa484('0x9')]);router[_0xa484('0x7')]('/:id',auth[_0xa484('0x8')](),controller['show']);router[_0xa484('0x7')](_0xa484('0xa'),auth[_0xa484('0x8')](),controller[_0xa484('0xb')]);router['post']('/',auth[_0xa484('0x8')](),controller[_0xa484('0xc')]);router[_0xa484('0xd')]('/:id',auth[_0xa484('0x8')](),controller['update']);router[_0xa484('0xe')](_0xa484('0xf'),auth[_0xa484('0x8')](),controller['destroy']);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 f7aa43a..c01e28a 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 _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x355463,_0x3a8a58){var _0x39c721=function(_0x5db6ed){while(--_0x5db6ed){_0x355463['push'](_0x355463['shift']());}};_0x39c721(++_0x3a8a58);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x5fc3[_0x2b7764];return _0x848dcb;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x35fc('0x2')]},'function':{'type':Sequelize[_0x35fc('0x2')]},'format':{'type':Sequelize[_0x35fc('0x2')]},'groupBy':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35fc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7217=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x61c374,_0xc9d5e4){var _0x3a2120=function(_0x955f6a){while(--_0x955f6a){_0x61c374['push'](_0x61c374['shift']());}};_0x3a2120(++_0xc9d5e4);}(_0x7217,0x19e));var _0x7721=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x7217[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'field':{'type':Sequelize[_0x7721('0x1')]},'alias':{'type':Sequelize[_0x7721('0x2')]},'function':{'type':Sequelize[_0x7721('0x2')]},'format':{'type':Sequelize[_0x7721('0x2')]},'groupBy':{'type':Sequelize[_0x7721('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 418c6a4..3c58529 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 _0xd3ef=['moment','mustache','util','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','update','then','sendStatus','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','map','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','find','create','bulkCreate','body','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','html-pdf','zip-dir','fast-json-patch','request-promise'];(function(_0x48dd24,_0x51d0ab){var _0x246705=function(_0x48efc6){while(--_0x48efc6){_0x48dd24['push'](_0x48dd24['shift']());}};_0x246705(++_0x51d0ab);}(_0xd3ef,0xec));var _0xfd3e=function(_0x521a01,_0x400383){_0x521a01=_0x521a01-0x0;var _0x156998=_0xd3ef[_0x521a01];return _0x156998;};'use strict';var pdf=require(_0xfd3e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfd3e('0x1'));var jsonpatch=require(_0xfd3e('0x2'));var rp=require(_0xfd3e('0x3'));var moment=require(_0xfd3e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfd3e('0x5'));var util=require(_0xfd3e('0x6'));var path=require('path');var sox=require(_0xfd3e('0x7'));var csv=require(_0xfd3e('0x8'));var ejs=require(_0xfd3e('0x9'));var fs=require('fs');var _=require(_0xfd3e('0xa'));var squel=require('squel');var crypto=require(_0xfd3e('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfd3e('0x8'));var querystring=require(_0xfd3e('0xc'));var Papa=require(_0xfd3e('0xd'));var Redis=require(_0xfd3e('0xe'));var authService=require(_0xfd3e('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfd3e('0x10'))(_0xfd3e('0x11'));var utils=require(_0xfd3e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xfd3e('0x13'));var db=require(_0xfd3e('0x14'))['db'];function respondWithStatusCode(_0x59cf4a,_0x4e98e4){_0x4e98e4=_0x4e98e4||0xcc;return function(_0x1f7990){if(_0x1f7990){return _0x59cf4a['sendStatus'](_0x4e98e4);}return _0x59cf4a[_0xfd3e('0x15')](_0x4e98e4)[_0xfd3e('0x16')]();};}function respondWithResult(_0x3c38de,_0x10faf2){_0x10faf2=_0x10faf2||0xc8;return function(_0x51b8b5){if(_0x51b8b5){return _0x3c38de['status'](_0x10faf2)[_0xfd3e('0x17')](_0x51b8b5);}};}function respondWithFilteredResult(_0x24e730,_0x1f7851){return function(_0x49d422){if(_0x49d422){var _0x4fe409=_0x49d422[_0xfd3e('0x18')],_0x57137a=_0x1f7851[_0xfd3e('0x19')],_0x42253e=_0x1f7851[_0xfd3e('0x19')]+_0x1f7851['limit'],_0x13319a;if(_0x42253e>=_0x4fe409){_0x42253e=_0x4fe409;_0x13319a=0xc8;}else{_0x13319a=0xce;}_0x24e730[_0xfd3e('0x15')](_0x13319a);return _0x24e730[_0xfd3e('0x1a')](_0xfd3e('0x1b'),_0x57137a+'-'+_0x42253e+'/'+_0x4fe409)[_0xfd3e('0x17')](_0x49d422);}return null;};}function patchUpdates(_0x2b762d){return function(_0x50b526){try{jsonpatch[_0xfd3e('0x1c')](_0x50b526,_0x2b762d,!![]);}catch(_0x1b1841){return BPromise['reject'](_0x1b1841);}return _0x50b526['save']();};}function saveUpdates(_0x27a50f,_0x4ccb34){return function(_0x558f25){if(_0x558f25){return _0x558f25[_0xfd3e('0x1d')](_0x27a50f)['then'](function(_0x27e070){return _0x27e070;});}return null;};}function removeEntity(_0x1a8954,_0x1f6690){return function(_0x2f1c30){if(_0x2f1c30){return _0x2f1c30['destroy']()[_0xfd3e('0x1e')](function(){_0x1a8954['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x166ded,_0x36904b){return function(_0x516912){if(!_0x516912){_0x166ded[_0xfd3e('0x1f')](0x194);}return _0x516912;};}function handleError(_0x19331f,_0x1e7236){_0x1e7236=_0x1e7236||0x1f4;return function(_0x3b9420){logger[_0xfd3e('0x20')](_0x3b9420[_0xfd3e('0x21')]);if(_0x3b9420[_0xfd3e('0x22')]){delete _0x3b9420[_0xfd3e('0x22')];}_0x19331f['status'](_0x1e7236)[_0xfd3e('0x23')](_0x3b9420);};}exports[_0xfd3e('0x24')]=function(_0x3a47e6,_0x455c33){var _0x51251d={},_0x3cb44f={},_0xdee716={'count':0x0,'rows':[]};var _0x15332c=_['map'](db[_0xfd3e('0x25')][_0xfd3e('0x26')],function(_0x466fad){return{'name':_0x466fad['fieldName'],'type':_0x466fad['type'][_0xfd3e('0x27')]};});_0x3cb44f[_0xfd3e('0x28')]=_['map'](_0x15332c,'name');_0x3cb44f['query']=_[_0xfd3e('0x29')](_0x3a47e6[_0xfd3e('0x2a')]);_0x3cb44f[_0xfd3e('0x2b')]=_[_0xfd3e('0x2c')](_0x3cb44f[_0xfd3e('0x28')],_0x3cb44f['query']);_0x51251d[_0xfd3e('0x2d')]=_['intersection'](_0x3cb44f[_0xfd3e('0x28')],qs[_0xfd3e('0x2e')](_0x3a47e6[_0xfd3e('0x2a')][_0xfd3e('0x2e')]));_0x51251d[_0xfd3e('0x2d')]=_0x51251d[_0xfd3e('0x2d')][_0xfd3e('0x2f')]?_0x51251d['attributes']:_0x3cb44f['model'];if(!_0x3a47e6[_0xfd3e('0x2a')][_0xfd3e('0x30')](_0xfd3e('0x31'))){_0x51251d[_0xfd3e('0x32')]=qs[_0xfd3e('0x32')](_0x3a47e6[_0xfd3e('0x2a')]['limit']);_0x51251d[_0xfd3e('0x19')]=qs[_0xfd3e('0x19')](_0x3a47e6[_0xfd3e('0x2a')][_0xfd3e('0x19')]);}_0x51251d[_0xfd3e('0x33')]=qs[_0xfd3e('0x34')](_0x3a47e6[_0xfd3e('0x2a')]['sort']);_0x51251d[_0xfd3e('0x35')]=qs[_0xfd3e('0x2b')](_[_0xfd3e('0x36')](_0x3a47e6['query'],_0x3cb44f[_0xfd3e('0x2b')]),_0x15332c);if(_0x3a47e6[_0xfd3e('0x2a')]['filter']){_0x51251d['where']=_[_0xfd3e('0x37')](_0x51251d[_0xfd3e('0x35')],{'$or':_[_0xfd3e('0x38')](_0x15332c,function(_0x52de59){if(_0x52de59[_0xfd3e('0x39')]!==_0xfd3e('0x3a')){var _0x38f0e5={};_0x38f0e5[_0x52de59[_0xfd3e('0x22')]]={'$like':'%'+_0x3a47e6[_0xfd3e('0x2a')][_0xfd3e('0x3b')]+'%'};return _0x38f0e5;}})});}_0x51251d=_['merge']({},_0x51251d,_0x3a47e6[_0xfd3e('0x3c')]);var _0x58dc70={'where':_0x51251d['where']};return db['AnalyticFieldReport'][_0xfd3e('0x18')](_0x58dc70)[_0xfd3e('0x1e')](function(_0x2b4d02){_0xdee716[_0xfd3e('0x18')]=_0x2b4d02;if(_0x3a47e6[_0xfd3e('0x2a')][_0xfd3e('0x3d')]){_0x51251d['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xfd3e('0x3e')](_0x51251d);})['then'](function(_0xbba2c3){_0xdee716[_0xfd3e('0x3f')]=_0xbba2c3;return _0xdee716;})[_0xfd3e('0x1e')](respondWithFilteredResult(_0x455c33,_0x51251d))[_0xfd3e('0x40')](handleError(_0x455c33,null));};exports[_0xfd3e('0x41')]=function(_0x1a153b,_0x1014dd){var _0x68b6e2={'raw':![],'where':{'id':_0x1a153b[_0xfd3e('0x42')]['id']}},_0x1aa2a7={};_0x1aa2a7['model']=_[_0xfd3e('0x29')](db[_0xfd3e('0x25')][_0xfd3e('0x26')]);_0x1aa2a7[_0xfd3e('0x2a')]=_[_0xfd3e('0x29')](_0x1a153b['query']);_0x1aa2a7[_0xfd3e('0x2b')]=_[_0xfd3e('0x2c')](_0x1aa2a7[_0xfd3e('0x28')],_0x1aa2a7[_0xfd3e('0x2a')]);_0x68b6e2['attributes']=_[_0xfd3e('0x2c')](_0x1aa2a7[_0xfd3e('0x28')],qs[_0xfd3e('0x2e')](_0x1a153b['query'][_0xfd3e('0x2e')]));_0x68b6e2[_0xfd3e('0x2d')]=_0x68b6e2[_0xfd3e('0x2d')][_0xfd3e('0x2f')]?_0x68b6e2[_0xfd3e('0x2d')]:_0x1aa2a7[_0xfd3e('0x28')];if(_0x1a153b[_0xfd3e('0x2a')]['includeAll']){_0x68b6e2[_0xfd3e('0x43')]=[{'all':!![]}];}_0x68b6e2=_[_0xfd3e('0x37')]({},_0x68b6e2,_0x1a153b[_0xfd3e('0x3c')]);return db[_0xfd3e('0x25')][_0xfd3e('0x44')](_0x68b6e2)[_0xfd3e('0x1e')](handleEntityNotFound(_0x1014dd,null))['then'](respondWithResult(_0x1014dd,null))[_0xfd3e('0x40')](handleError(_0x1014dd,null));};exports[_0xfd3e('0x45')]=function(_0x3e79cb,_0x25ff63){return db[_0xfd3e('0x25')]['create'](_0x3e79cb['body'],{})[_0xfd3e('0x1e')](respondWithResult(_0x25ff63,0xc9))[_0xfd3e('0x40')](handleError(_0x25ff63,null));};exports[_0xfd3e('0x46')]=function(_0xf4f41e,_0x1c74c1){return db[_0xfd3e('0x25')][_0xfd3e('0x46')](_0xf4f41e[_0xfd3e('0x47')],{'raw':![],'individualHooks':!![]})[_0xfd3e('0x1e')](respondWithResult(_0x1c74c1,0xc9))['catch'](handleError(_0x1c74c1,null));};exports[_0xfd3e('0x1d')]=function(_0x31468f,_0xde678c){if(_0x31468f[_0xfd3e('0x47')]['id']){delete _0x31468f['body']['id'];}return db['AnalyticFieldReport'][_0xfd3e('0x44')]({'where':{'id':_0x31468f[_0xfd3e('0x42')]['id']}})[_0xfd3e('0x1e')](handleEntityNotFound(_0xde678c,null))['then'](saveUpdates(_0x31468f[_0xfd3e('0x47')],null))[_0xfd3e('0x1e')](respondWithResult(_0xde678c,null))[_0xfd3e('0x40')](handleError(_0xde678c,null));};exports[_0xfd3e('0x48')]=function(_0x1b3e79,_0x317437){return db['AnalyticFieldReport'][_0xfd3e('0x44')]({'where':{'id':_0x1b3e79['params']['id']}})[_0xfd3e('0x1e')](handleEntityNotFound(_0x317437,null))[_0xfd3e('0x1e')](removeEntity(_0x317437,null))['catch'](handleError(_0x317437,null));};exports[_0xfd3e('0x49')]=function(_0x320998,_0x421bf8){return db[_0xfd3e('0x25')][_0xfd3e('0x48')]({'where':{'id':_0x320998['query'][_0xfd3e('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0xfd3e('0x1e')](respondWithResult(_0x421bf8,0xcc))[_0xfd3e('0x40')](handleError(_0x421bf8,null));};exports[_0xfd3e('0x4b')]=function(_0x4cfe22,_0x41d8e2,_0x560b7e){return db[_0xfd3e('0x4c')][_0xfd3e('0x4d')]({'where':{'id':_0x4cfe22[_0xfd3e('0x42')]['id']}})['then'](handleEntityNotFound(_0x41d8e2,null))[_0xfd3e('0x1e')](function(_0x48b14f){if(_0x48b14f){return db[_0xfd3e('0x4e')][_0xfd3e('0x4f')](function(_0x24403c){return db[_0xfd3e('0x25')]['destroy']({'where':{'CustomReportId':_0x4cfe22[_0xfd3e('0x42')]['id']},'transaction':_0x24403c})[_0xfd3e('0x1e')](function(_0x2fa279){var _0x4929c1=_[_0xfd3e('0x38')](_0x4cfe22[_0xfd3e('0x47')],function(_0x444d8d){delete _0x444d8d['id'];_0x444d8d['CustomReportId']=_0x4cfe22[_0xfd3e('0x42')]['id'];return _0x444d8d;});return db[_0xfd3e('0x25')][_0xfd3e('0x46')](_0x4929c1,{'transaction':_0x24403c});});})['then'](function(){return db[_0xfd3e('0x25')][_0xfd3e('0x3e')]({'where':{'CustomReportId':_0x4cfe22['params']['id']}});});}})[_0xfd3e('0x1e')](respondWithResult(_0x41d8e2,null))['catch'](handleError(_0x41d8e2,null));}; \ No newline at end of file +var _0x001b=['limit','set','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','map','AnalyticFieldReport','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','include','catch','create','body','bulkCreate','find','bulkDestroy','addFields','CustomReportId','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x001b,0x11c));var _0xb001=function(_0x574d9c,_0x3c49fe){_0x574d9c=_0x574d9c-0x0;var _0x2629ba=_0x001b[_0x574d9c];return _0x2629ba;};'use strict';var pdf=require(_0xb001('0x0'));var emlformat=require(_0xb001('0x1'));var rimraf=require(_0xb001('0x2'));var zipdir=require(_0xb001('0x3'));var jsonpatch=require(_0xb001('0x4'));var rp=require(_0xb001('0x5'));var moment=require(_0xb001('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xb001('0x7'));var util=require('util');var path=require(_0xb001('0x8'));var sox=require(_0xb001('0x9'));var csv=require(_0xb001('0xa'));var ejs=require(_0xb001('0xb'));var fs=require('fs');var _=require(_0xb001('0xc'));var squel=require('squel');var crypto=require(_0xb001('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb001('0xa'));var querystring=require('querystring');var Papa=require(_0xb001('0xe'));var Redis=require(_0xb001('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb001('0x10'));var as=require(_0xb001('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb001('0x12'))(_0xb001('0x13'));var utils=require(_0xb001('0x14'));var config=require(_0xb001('0x15'));var licenseUtil=require(_0xb001('0x16'));var db=require(_0xb001('0x17'))['db'];function respondWithStatusCode(_0x2c1320,_0x6de31d){_0x6de31d=_0x6de31d||0xcc;return function(_0x890452){if(_0x890452){return _0x2c1320[_0xb001('0x18')](_0x6de31d);}return _0x2c1320[_0xb001('0x19')](_0x6de31d)['end']();};}function respondWithResult(_0x1bd63b,_0x231c8d){_0x231c8d=_0x231c8d||0xc8;return function(_0x54ba1c){if(_0x54ba1c){return _0x1bd63b[_0xb001('0x19')](_0x231c8d)['json'](_0x54ba1c);}};}function respondWithFilteredResult(_0xd69892,_0x325d77){return function(_0x52ea30){if(_0x52ea30){var _0x536f0a=_0x52ea30[_0xb001('0x1a')],_0x49fc36=_0x325d77[_0xb001('0x1b')],_0x49155b=_0x325d77[_0xb001('0x1b')]+_0x325d77[_0xb001('0x1c')],_0x280caf;if(_0x49155b>=_0x536f0a){_0x49155b=_0x536f0a;_0x280caf=0xc8;}else{_0x280caf=0xce;}_0xd69892['status'](_0x280caf);return _0xd69892[_0xb001('0x1d')](_0xb001('0x1e'),_0x49fc36+'-'+_0x49155b+'/'+_0x536f0a)['json'](_0x52ea30);}return null;};}function patchUpdates(_0xbd8ebb){return function(_0x52b54e){try{jsonpatch['apply'](_0x52b54e,_0xbd8ebb,!![]);}catch(_0x15988d){return BPromise[_0xb001('0x1f')](_0x15988d);}return _0x52b54e[_0xb001('0x20')]();};}function saveUpdates(_0x4fc519,_0x5049c9){return function(_0x5c5dc6){if(_0x5c5dc6){return _0x5c5dc6[_0xb001('0x21')](_0x4fc519)['then'](function(_0x160778){return _0x160778;});}return null;};}function removeEntity(_0x1cb902,_0x1da8e6){return function(_0x2cd349){if(_0x2cd349){return _0x2cd349[_0xb001('0x22')]()[_0xb001('0x23')](function(){_0x1cb902[_0xb001('0x19')](0xcc)[_0xb001('0x24')]();});}};}function handleEntityNotFound(_0x44ea88,_0x46f4ac){return function(_0x3f28c5){if(!_0x3f28c5){_0x44ea88['sendStatus'](0x194);}return _0x3f28c5;};}function handleError(_0x3ebc1b,_0x29ba94){_0x29ba94=_0x29ba94||0x1f4;return function(_0xd8fec7){logger[_0xb001('0x25')](_0xd8fec7[_0xb001('0x26')]);if(_0xd8fec7[_0xb001('0x27')]){delete _0xd8fec7[_0xb001('0x27')];}_0x3ebc1b['status'](_0x29ba94)[_0xb001('0x28')](_0xd8fec7);};}exports[_0xb001('0x29')]=function(_0x1b815f,_0x3b7075){var _0x555c60={},_0x3aa33a={},_0x1c1d66={'count':0x0,'rows':[]};var _0xd0f29b=_[_0xb001('0x2a')](db[_0xb001('0x2b')]['rawAttributes'],function(_0xe51ae8){return{'name':_0xe51ae8[_0xb001('0x2c')],'type':_0xe51ae8['type'][_0xb001('0x2d')]};});_0x3aa33a[_0xb001('0x2e')]=_[_0xb001('0x2a')](_0xd0f29b,_0xb001('0x27'));_0x3aa33a['query']=_[_0xb001('0x2f')](_0x1b815f[_0xb001('0x30')]);_0x3aa33a[_0xb001('0x31')]=_[_0xb001('0x32')](_0x3aa33a['model'],_0x3aa33a[_0xb001('0x30')]);_0x555c60[_0xb001('0x33')]=_[_0xb001('0x32')](_0x3aa33a['model'],qs[_0xb001('0x34')](_0x1b815f[_0xb001('0x30')][_0xb001('0x34')]));_0x555c60['attributes']=_0x555c60['attributes'][_0xb001('0x35')]?_0x555c60[_0xb001('0x33')]:_0x3aa33a[_0xb001('0x2e')];if(!_0x1b815f['query'][_0xb001('0x36')](_0xb001('0x37'))){_0x555c60[_0xb001('0x1c')]=qs['limit'](_0x1b815f[_0xb001('0x30')][_0xb001('0x1c')]);_0x555c60['offset']=qs['offset'](_0x1b815f[_0xb001('0x30')][_0xb001('0x1b')]);}_0x555c60[_0xb001('0x38')]=qs[_0xb001('0x39')](_0x1b815f[_0xb001('0x30')][_0xb001('0x39')]);_0x555c60[_0xb001('0x3a')]=qs[_0xb001('0x31')](_[_0xb001('0x3b')](_0x1b815f[_0xb001('0x30')],_0x3aa33a[_0xb001('0x31')]),_0xd0f29b);if(_0x1b815f[_0xb001('0x30')][_0xb001('0x3c')]){_0x555c60[_0xb001('0x3a')]=_['merge'](_0x555c60[_0xb001('0x3a')],{'$or':_[_0xb001('0x2a')](_0xd0f29b,function(_0x4e012f){if(_0x4e012f[_0xb001('0x3d')]!==_0xb001('0x3e')){var _0x5eb7b8={};_0x5eb7b8[_0x4e012f[_0xb001('0x27')]]={'$like':'%'+_0x1b815f[_0xb001('0x30')][_0xb001('0x3c')]+'%'};return _0x5eb7b8;}})});}_0x555c60=_['merge']({},_0x555c60,_0x1b815f[_0xb001('0x3f')]);var _0x57a1d5={'where':_0x555c60[_0xb001('0x3a')]};return db[_0xb001('0x2b')][_0xb001('0x1a')](_0x57a1d5)['then'](function(_0x3d9374){_0x1c1d66[_0xb001('0x1a')]=_0x3d9374;if(_0x1b815f['query'][_0xb001('0x40')]){_0x555c60['include']=[{'all':!![]}];}return db[_0xb001('0x2b')][_0xb001('0x41')](_0x555c60);})[_0xb001('0x23')](function(_0x925465){_0x1c1d66['rows']=_0x925465;return _0x1c1d66;})[_0xb001('0x23')](respondWithFilteredResult(_0x3b7075,_0x555c60))['catch'](handleError(_0x3b7075,null));};exports[_0xb001('0x42')]=function(_0x35f171,_0x408f99){var _0x5022f0={'raw':![],'where':{'id':_0x35f171[_0xb001('0x43')]['id']}},_0x56dc29={};_0x56dc29[_0xb001('0x2e')]=_[_0xb001('0x2f')](db[_0xb001('0x2b')][_0xb001('0x44')]);_0x56dc29[_0xb001('0x30')]=_[_0xb001('0x2f')](_0x35f171['query']);_0x56dc29[_0xb001('0x31')]=_['intersection'](_0x56dc29[_0xb001('0x2e')],_0x56dc29['query']);_0x5022f0[_0xb001('0x33')]=_['intersection'](_0x56dc29[_0xb001('0x2e')],qs[_0xb001('0x34')](_0x35f171[_0xb001('0x30')][_0xb001('0x34')]));_0x5022f0[_0xb001('0x33')]=_0x5022f0[_0xb001('0x33')][_0xb001('0x35')]?_0x5022f0['attributes']:_0x56dc29[_0xb001('0x2e')];if(_0x35f171[_0xb001('0x30')]['includeAll']){_0x5022f0[_0xb001('0x45')]=[{'all':!![]}];}_0x5022f0=_['merge']({},_0x5022f0,_0x35f171['options']);return db[_0xb001('0x2b')]['find'](_0x5022f0)[_0xb001('0x23')](handleEntityNotFound(_0x408f99,null))[_0xb001('0x23')](respondWithResult(_0x408f99,null))[_0xb001('0x46')](handleError(_0x408f99,null));};exports[_0xb001('0x47')]=function(_0x41cf98,_0x5d522c){return db['AnalyticFieldReport']['create'](_0x41cf98[_0xb001('0x48')],{})['then'](respondWithResult(_0x5d522c,0xc9))[_0xb001('0x46')](handleError(_0x5d522c,null));};exports[_0xb001('0x49')]=function(_0x79fa5f,_0x448555){return db[_0xb001('0x2b')][_0xb001('0x49')](_0x79fa5f['body'],{'raw':![],'individualHooks':!![]})[_0xb001('0x23')](respondWithResult(_0x448555,0xc9))[_0xb001('0x46')](handleError(_0x448555,null));};exports[_0xb001('0x21')]=function(_0x288cd8,_0x305ad1){if(_0x288cd8[_0xb001('0x48')]['id']){delete _0x288cd8[_0xb001('0x48')]['id'];}return db[_0xb001('0x2b')][_0xb001('0x4a')]({'where':{'id':_0x288cd8[_0xb001('0x43')]['id']}})[_0xb001('0x23')](handleEntityNotFound(_0x305ad1,null))[_0xb001('0x23')](saveUpdates(_0x288cd8[_0xb001('0x48')],null))[_0xb001('0x23')](respondWithResult(_0x305ad1,null))[_0xb001('0x46')](handleError(_0x305ad1,null));};exports[_0xb001('0x22')]=function(_0x292c85,_0x2092ce){return db[_0xb001('0x2b')][_0xb001('0x4a')]({'where':{'id':_0x292c85[_0xb001('0x43')]['id']}})[_0xb001('0x23')](handleEntityNotFound(_0x2092ce,null))[_0xb001('0x23')](removeEntity(_0x2092ce,null))[_0xb001('0x46')](handleError(_0x2092ce,null));};exports[_0xb001('0x4b')]=function(_0x55eb1d,_0x33098e){return db[_0xb001('0x2b')][_0xb001('0x22')]({'where':{'id':_0x55eb1d['query']['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x33098e,0xcc))[_0xb001('0x46')](handleError(_0x33098e,null));};exports[_0xb001('0x4c')]=function(_0x1b7e9d,_0x172894,_0x4ea3c9){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x1b7e9d[_0xb001('0x43')]['id']}})[_0xb001('0x23')](handleEntityNotFound(_0x172894,null))[_0xb001('0x23')](function(_0x26f166){if(_0x26f166){return db['sequelize']['transaction'](function(_0x3ad806){return db[_0xb001('0x2b')][_0xb001('0x22')]({'where':{'CustomReportId':_0x1b7e9d[_0xb001('0x43')]['id']},'transaction':_0x3ad806})['then'](function(_0x5c08bf){var _0x23ae5a=_[_0xb001('0x2a')](_0x1b7e9d['body'],function(_0x2377ba){delete _0x2377ba['id'];_0x2377ba[_0xb001('0x4d')]=_0x1b7e9d[_0xb001('0x43')]['id'];return _0x2377ba;});return db[_0xb001('0x2b')][_0xb001('0x49')](_0x23ae5a,{'transaction':_0x3ad806});});})[_0xb001('0x23')](function(){return db[_0xb001('0x2b')]['findAll']({'where':{'CustomReportId':_0x1b7e9d['params']['id']}});});}})[_0xb001('0x23')](respondWithResult(_0x172894,null))[_0xb001('0x46')](handleError(_0x172894,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index f50973b..ac3a1f2 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 _0x5623=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','analytics_report_fields'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x5623,0x108));var _0x3562=function(_0xe76091,_0x3ed7f9){_0xe76091=_0xe76091-0x0;var _0x1274db=_0x5623[_0xe76091];return _0x1274db;};'use strict';var _=require(_0x3562('0x0'));var util=require('util');var logger=require(_0x3562('0x1'))(_0x3562('0x2'));var moment=require(_0x3562('0x3'));var BPromise=require(_0x3562('0x4'));var rp=require(_0x3562('0x5'));var fs=require('fs');var path=require(_0x3562('0x6'));var rimraf=require('rimraf');var config=require(_0x3562('0x7'));var attributes=require(_0x3562('0x8'));module[_0x3562('0x9')]=function(_0x1bdaf5,_0x234e89){return _0x1bdaf5['define']('AnalyticFieldReport',attributes,{'tableName':_0x3562('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58ce=['exports','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x209c34,_0x4ec17b){var _0x8d73ed=function(_0x450536){while(--_0x450536){_0x209c34['push'](_0x209c34['shift']());}};_0x8d73ed(++_0x4ec17b);}(_0x58ce,0x15f));var _0xe58c=function(_0x217bb0,_0x383c5b){_0x217bb0=_0x217bb0-0x0;var _0x40d985=_0x58ce[_0x217bb0];return _0x40d985;};'use strict';var _=require(_0xe58c('0x0'));var util=require('util');var logger=require(_0xe58c('0x1'))('api');var moment=require(_0xe58c('0x2'));var BPromise=require(_0xe58c('0x3'));var rp=require(_0xe58c('0x4'));var fs=require('fs');var path=require(_0xe58c('0x5'));var rimraf=require(_0xe58c('0x6'));var config=require(_0xe58c('0x7'));var attributes=require(_0xe58c('0x8'));module[_0xe58c('0x9')]=function(_0x179c8a,_0xbab602){return _0x179c8a['define'](_0xe58c('0xa'),attributes,{'tableName':_0xe58c('0xb'),'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 bd4f455..b17fffc 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 _0xd2ec=['catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','AnalyticFieldReport,\x20%s,\x20%s','result'];(function(_0x374954,_0x18dc36){var _0x42073e=function(_0x1cb45f){while(--_0x1cb45f){_0x374954['push'](_0x374954['shift']());}};_0x42073e(++_0x18dc36);}(_0xd2ec,0x14b));var _0xcd2e=function(_0x3f823a,_0x29330a){_0x3f823a=_0x3f823a-0x0;var _0x440e40=_0xd2ec[_0x3f823a];return _0x440e40;};'use strict';var _=require(_0xcd2e('0x0'));var util=require(_0xcd2e('0x1'));var moment=require(_0xcd2e('0x2'));var BPromise=require('bluebird');var rs=require(_0xcd2e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd2e('0x4'))['db'];var utils=require(_0xcd2e('0x5'));var logger=require(_0xcd2e('0x6'))(_0xcd2e('0x7'));var config=require('../../config/environment');var jayson=require(_0xcd2e('0x8'));var client=jayson['client'][_0xcd2e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39dc2,_0x32ebe0,_0x13aaae){return new BPromise(function(_0x1851d7,_0x600dbe){return client[_0xcd2e('0xa')](_0x39dc2,_0x13aaae)[_0xcd2e('0xb')](function(_0x475fd4){logger[_0xcd2e('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x32ebe0,_0xcd2e('0xd'));logger[_0xcd2e('0xe')](_0xcd2e('0xf'),_0x32ebe0,_0xcd2e('0xd'),JSON['stringify'](_0x475fd4));if(_0x475fd4[_0xcd2e('0x10')]){if(_0x475fd4[_0xcd2e('0x10')][_0xcd2e('0x11')]===0x1f4){logger[_0xcd2e('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x32ebe0,_0x475fd4[_0xcd2e('0x10')][_0xcd2e('0x12')]);return _0x600dbe(_0x475fd4[_0xcd2e('0x10')][_0xcd2e('0x12')]);}logger[_0xcd2e('0x10')](_0xcd2e('0x13'),_0x32ebe0,_0x475fd4[_0xcd2e('0x10')]['message']);return _0x1851d7(_0x475fd4[_0xcd2e('0x10')][_0xcd2e('0x12')]);}else{logger['info'](_0xcd2e('0x13'),_0x32ebe0,_0xcd2e('0xd'));_0x1851d7(_0x475fd4[_0xcd2e('0x14')][_0xcd2e('0x12')]);}})[_0xcd2e('0x15')](function(_0x2ddd27){logger[_0xcd2e('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x32ebe0,_0x2ddd27);_0x600dbe(_0x2ddd27);});});} \ No newline at end of file +var _0xfb0b=['stringify','error','code','message','info','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','AnalyticFieldReport,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb0b,0xb1));var _0xbfb0=function(_0x15a106,_0xbc5c2a){_0x15a106=_0x15a106-0x0;var _0xe9013a=_0xfb0b[_0x15a106];return _0xe9013a;};'use strict';var _=require(_0xbfb0('0x0'));var util=require('util');var moment=require(_0xbfb0('0x1'));var BPromise=require('bluebird');var rs=require(_0xbfb0('0x2'));var fs=require('fs');var Redis=require(_0xbfb0('0x3'));var db=require(_0xbfb0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfb0('0x5'))(_0xbfb0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfb0('0x7')][_0xbfb0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58e88b,_0x2ca208,_0x4df3eb){return new BPromise(function(_0x2e90ff,_0x74acba){return client[_0xbfb0('0x9')](_0x58e88b,_0x4df3eb)['then'](function(_0x951491){logger['info'](_0xbfb0('0xa'),_0x2ca208,'request\x20sent');logger[_0xbfb0('0xb')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x2ca208,_0xbfb0('0xc'),JSON[_0xbfb0('0xd')](_0x951491));if(_0x951491['error']){if(_0x951491[_0xbfb0('0xe')][_0xbfb0('0xf')]===0x1f4){logger[_0xbfb0('0xe')](_0xbfb0('0xa'),_0x2ca208,_0x951491[_0xbfb0('0xe')][_0xbfb0('0x10')]);return _0x74acba(_0x951491[_0xbfb0('0xe')][_0xbfb0('0x10')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x2ca208,_0x951491['error'][_0xbfb0('0x10')]);return _0x2e90ff(_0x951491[_0xbfb0('0xe')]['message']);}else{logger[_0xbfb0('0x11')](_0xbfb0('0xa'),_0x2ca208,_0xbfb0('0xc'));_0x2e90ff(_0x951491[_0xbfb0('0x12')][_0xbfb0('0x10')]);}})['catch'](function(_0x12c39e){logger[_0xbfb0('0xe')](_0xbfb0('0xa'),_0x2ca208,_0x12c39e);_0x74acba(_0x12c39e);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 3ff3781..d283037 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 _0x9957=['../../config/environment','get','isAuthenticated','index','/:id','post','/create_many','bulkCreate','/:id/create_many','put','update','delete','/destroy_many','bulkDestroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./analyticFieldReport.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0xc')](_0x7995('0xd'),auth[_0x7995('0x9')](),controller[_0x7995('0xe')]);router[_0x7995('0xc')](_0x7995('0xf'),auth[_0x7995('0x9')](),controller['addFields']);router[_0x7995('0x10')](_0x7995('0xb'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0x13'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x12')](_0x7995('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file +var _0x326f=['/:id','show','post','/create_many','bulkCreate','/:id/create_many','addFields','update','/destroy_many','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x326f,0xd1));var _0xf326=function(_0x1f70ab,_0x3b297d){_0x1f70ab=_0x1f70ab-0x0;var _0x378dcd=_0x326f[_0x1f70ab];return _0x378dcd;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xf326('0xe'),auth[_0xf326('0x9')](),controller[_0xf326('0xf')]);router[_0xf326('0xd')](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['put'](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x12')]);router['delete'](_0xf326('0x13'),auth[_0xf326('0x9')](),controller['bulkDestroy']);router[_0xf326('0x14')](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 1f4173e..d9fa674 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 _0x4213=['exports','STRING','name','TEXT','sequelize'];(function(_0x3d2930,_0x4a3044){var _0x336b9d=function(_0x2a0183){while(--_0x2a0183){_0x3d2930['push'](_0x3d2930['shift']());}};_0x336b9d(++_0x4a3044);}(_0x4213,0x77));var _0x3421=function(_0x85da44,_0x47d858){_0x85da44=_0x85da44-0x0;var _0x13831a=_0x4213[_0x85da44];return _0x13831a;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'name':{'type':Sequelize[_0x3421('0x2')],'allowNull':![],'unique':_0x3421('0x3')},'table':{'type':Sequelize[_0x3421('0x2')]},'metric':{'type':Sequelize[_0x3421('0x4')]},'description':{'type':Sequelize[_0x3421('0x2')]}}; \ No newline at end of file +var _0x07be=['TEXT','sequelize','exports','STRING','name'];(function(_0x2eeb31,_0x4917f5){var _0x13f89b=function(_0x5cc746){while(--_0x5cc746){_0x2eeb31['push'](_0x2eeb31['shift']());}};_0x13f89b(++_0x4917f5);}(_0x07be,0xfb));var _0xe07b=function(_0x35ec3d,_0x676597){_0x35ec3d=_0x35ec3d-0x0;var _0x29f9ce=_0x07be[_0x35ec3d];return _0x29f9ce;};'use strict';var Sequelize=require(_0xe07b('0x0'));module[_0xe07b('0x1')]={'name':{'type':Sequelize[_0xe07b('0x2')],'allowNull':![],'unique':_0xe07b('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xe07b('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 27b4fe2..db6b365 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 _0xa2af=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','stack','name','index','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','AnalyticMetric','findAll','catch','show','params','rawAttributes','includeAll','include','find','create'];(function(_0x77d104,_0x34ebba){var _0x2c4beb=function(_0x305169){while(--_0x305169){_0x77d104['push'](_0x77d104['shift']());}};_0x2c4beb(++_0x34ebba);}(_0xa2af,0x102));var _0xfa2a=function(_0x3fcc7a,_0x3de365){_0x3fcc7a=_0x3fcc7a-0x0;var _0x55ce9a=_0xa2af[_0x3fcc7a];return _0x55ce9a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfa2a('0x0'));var jsonpatch=require(_0xfa2a('0x1'));var rp=require(_0xfa2a('0x2'));var moment=require(_0xfa2a('0x3'));var BPromise=require(_0xfa2a('0x4'));var Mustache=require(_0xfa2a('0x5'));var util=require(_0xfa2a('0x6'));var path=require('path');var sox=require(_0xfa2a('0x7'));var csv=require(_0xfa2a('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfa2a('0x9'));var squel=require(_0xfa2a('0xa'));var crypto=require(_0xfa2a('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfa2a('0x8'));var querystring=require(_0xfa2a('0xc'));var Papa=require(_0xfa2a('0xd'));var Redis=require(_0xfa2a('0xe'));var authService=require(_0xfa2a('0xf'));var qs=require(_0xfa2a('0x10'));var as=require(_0xfa2a('0x11'));var hardwareService=require(_0xfa2a('0x12'));var logger=require(_0xfa2a('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xfa2a('0x14'));var licenseUtil=require(_0xfa2a('0x15'));var db=require(_0xfa2a('0x16'))['db'];function respondWithStatusCode(_0x5ab855,_0x5a5de0){_0x5a5de0=_0x5a5de0||0xcc;return function(_0x4291ea){if(_0x4291ea){return _0x5ab855[_0xfa2a('0x17')](_0x5a5de0);}return _0x5ab855['status'](_0x5a5de0)[_0xfa2a('0x18')]();};}function respondWithResult(_0x4afa3e,_0x3ab123){_0x3ab123=_0x3ab123||0xc8;return function(_0x3fc056){if(_0x3fc056){return _0x4afa3e[_0xfa2a('0x19')](_0x3ab123)[_0xfa2a('0x1a')](_0x3fc056);}};}function respondWithFilteredResult(_0x425f18,_0x4dd92d){return function(_0x591970){if(_0x591970){var _0x121589=_0x591970[_0xfa2a('0x1b')],_0x1fc4fe=_0x4dd92d[_0xfa2a('0x1c')],_0x31d6c9=_0x4dd92d[_0xfa2a('0x1c')]+_0x4dd92d[_0xfa2a('0x1d')],_0x1abaf6;if(_0x31d6c9>=_0x121589){_0x31d6c9=_0x121589;_0x1abaf6=0xc8;}else{_0x1abaf6=0xce;}_0x425f18[_0xfa2a('0x19')](_0x1abaf6);return _0x425f18['set'](_0xfa2a('0x1e'),_0x1fc4fe+'-'+_0x31d6c9+'/'+_0x121589)[_0xfa2a('0x1a')](_0x591970);}return null;};}function patchUpdates(_0x2dcbb9){return function(_0x5ac2bf){try{jsonpatch[_0xfa2a('0x1f')](_0x5ac2bf,_0x2dcbb9,!![]);}catch(_0x5e6d1a){return BPromise[_0xfa2a('0x20')](_0x5e6d1a);}return _0x5ac2bf[_0xfa2a('0x21')]();};}function saveUpdates(_0x51d824,_0xf5e86e){return function(_0x4496fe){if(_0x4496fe){return _0x4496fe[_0xfa2a('0x22')](_0x51d824)[_0xfa2a('0x23')](function(_0x51a7aa){return _0x51a7aa;});}return null;};}function removeEntity(_0x58da9e,_0x59d14d){return function(_0x435226){if(_0x435226){return _0x435226[_0xfa2a('0x24')]()[_0xfa2a('0x23')](function(){var _0x46a60b=_0x435226[_0xfa2a('0x25')]({'plain':!![]});var _0x593e6c=_0xfa2a('0x26');return db['UserProfileResource'][_0xfa2a('0x24')]({'where':{'type':_0x593e6c,'resourceId':_0x46a60b['id']}})['then'](function(){return _0x435226;});})[_0xfa2a('0x23')](function(){_0x58da9e['status'](0xcc)[_0xfa2a('0x18')]();});}};}function handleEntityNotFound(_0x321b28,_0x3e8d16){return function(_0x524a25){if(!_0x524a25){_0x321b28[_0xfa2a('0x17')](0x194);}return _0x524a25;};}function handleError(_0x5a6497,_0x1475ff){_0x1475ff=_0x1475ff||0x1f4;return function(_0x11bebf){logger['error'](_0x11bebf[_0xfa2a('0x27')]);if(_0x11bebf[_0xfa2a('0x28')]){delete _0x11bebf[_0xfa2a('0x28')];}_0x5a6497[_0xfa2a('0x19')](_0x1475ff)['send'](_0x11bebf);};}exports[_0xfa2a('0x29')]=function(_0x221247,_0xf19944){var _0x258b18={},_0x4c5b78={},_0x1eb8bb={'count':0x0,'rows':[]};var _0x39d8d6=_['map'](db['AnalyticMetric']['rawAttributes'],function(_0x34796f){return{'name':_0x34796f[_0xfa2a('0x2a')],'type':_0x34796f[_0xfa2a('0x2b')][_0xfa2a('0x2c')]};});_0x4c5b78[_0xfa2a('0x2d')]=_['map'](_0x39d8d6,'name');_0x4c5b78[_0xfa2a('0x2e')]=_[_0xfa2a('0x2f')](_0x221247[_0xfa2a('0x2e')]);_0x4c5b78['filters']=_[_0xfa2a('0x30')](_0x4c5b78[_0xfa2a('0x2d')],_0x4c5b78[_0xfa2a('0x2e')]);_0x258b18[_0xfa2a('0x31')]=_['intersection'](_0x4c5b78[_0xfa2a('0x2d')],qs[_0xfa2a('0x32')](_0x221247[_0xfa2a('0x2e')]['fields']));_0x258b18[_0xfa2a('0x31')]=_0x258b18[_0xfa2a('0x31')][_0xfa2a('0x33')]?_0x258b18['attributes']:_0x4c5b78[_0xfa2a('0x2d')];if(!_0x221247['query'][_0xfa2a('0x34')](_0xfa2a('0x35'))){_0x258b18[_0xfa2a('0x1d')]=qs[_0xfa2a('0x1d')](_0x221247[_0xfa2a('0x2e')]['limit']);_0x258b18[_0xfa2a('0x1c')]=qs[_0xfa2a('0x1c')](_0x221247[_0xfa2a('0x2e')][_0xfa2a('0x1c')]);}_0x258b18[_0xfa2a('0x36')]=qs[_0xfa2a('0x37')](_0x221247['query']['sort']);_0x258b18[_0xfa2a('0x38')]=qs[_0xfa2a('0x39')](_[_0xfa2a('0x3a')](_0x221247[_0xfa2a('0x2e')],_0x4c5b78[_0xfa2a('0x39')]),_0x39d8d6);if(_0x221247['query'][_0xfa2a('0x3b')]){_0x258b18[_0xfa2a('0x38')]=_[_0xfa2a('0x3c')](_0x258b18[_0xfa2a('0x38')],{'$or':_[_0xfa2a('0x3d')](_0x39d8d6,function(_0x30329b){if(_0x30329b[_0xfa2a('0x2b')]!==_0xfa2a('0x3e')){var _0x113bd6={};_0x113bd6[_0x30329b[_0xfa2a('0x28')]]={'$like':'%'+_0x221247[_0xfa2a('0x2e')][_0xfa2a('0x3b')]+'%'};return _0x113bd6;}})});}_0x258b18=_[_0xfa2a('0x3c')]({},_0x258b18,_0x221247[_0xfa2a('0x3f')]);var _0x4a49e5={'where':_0x258b18[_0xfa2a('0x38')]};return db[_0xfa2a('0x40')]['count'](_0x4a49e5)[_0xfa2a('0x23')](function(_0x2665da){_0x1eb8bb['count']=_0x2665da;if(_0x221247[_0xfa2a('0x2e')]['includeAll']){_0x258b18['include']=[{'all':!![]}];}return db[_0xfa2a('0x40')][_0xfa2a('0x41')](_0x258b18);})[_0xfa2a('0x23')](function(_0x55ef1f){_0x1eb8bb['rows']=_0x55ef1f;return _0x1eb8bb;})[_0xfa2a('0x23')](respondWithFilteredResult(_0xf19944,_0x258b18))[_0xfa2a('0x42')](handleError(_0xf19944,null));};exports[_0xfa2a('0x43')]=function(_0x226b41,_0x2837cc){var _0x463568={'raw':!![],'where':{'id':_0x226b41[_0xfa2a('0x44')]['id']}},_0x782ace={};_0x782ace['model']=_[_0xfa2a('0x2f')](db[_0xfa2a('0x40')][_0xfa2a('0x45')]);_0x782ace[_0xfa2a('0x2e')]=_[_0xfa2a('0x2f')](_0x226b41['query']);_0x782ace[_0xfa2a('0x39')]=_['intersection'](_0x782ace[_0xfa2a('0x2d')],_0x782ace[_0xfa2a('0x2e')]);_0x463568[_0xfa2a('0x31')]=_[_0xfa2a('0x30')](_0x782ace['model'],qs['fields'](_0x226b41[_0xfa2a('0x2e')]['fields']));_0x463568[_0xfa2a('0x31')]=_0x463568[_0xfa2a('0x31')][_0xfa2a('0x33')]?_0x463568[_0xfa2a('0x31')]:_0x782ace[_0xfa2a('0x2d')];if(_0x226b41['query'][_0xfa2a('0x46')]){_0x463568[_0xfa2a('0x47')]=[{'all':!![]}];}_0x463568=_[_0xfa2a('0x3c')]({},_0x463568,_0x226b41['options']);return db[_0xfa2a('0x40')][_0xfa2a('0x48')](_0x463568)[_0xfa2a('0x23')](handleEntityNotFound(_0x2837cc,null))['then'](respondWithResult(_0x2837cc,null))['catch'](handleError(_0x2837cc,null));};exports[_0xfa2a('0x49')]=function(_0x1b1ac6,_0x19ad5b){return db[_0xfa2a('0x40')]['create'](_0x1b1ac6['body'],{})[_0xfa2a('0x23')](function(_0x1b6880){var _0x536888=_0x1b1ac6[_0xfa2a('0x4a')][_0xfa2a('0x25')]({'plain':!![]});if(!_0x536888)throw new Error(_0xfa2a('0x4b'));if(_0x536888[_0xfa2a('0x4c')]===_0xfa2a('0x4a')){var _0x421a81=_0x1b6880[_0xfa2a('0x25')]({'plain':!![]});var _0x5a8ad8='Metrics';return db[_0xfa2a('0x4d')][_0xfa2a('0x48')]({'where':{'name':_0x5a8ad8,'userProfileId':_0x536888[_0xfa2a('0x4e')]},'raw':!![]})[_0xfa2a('0x23')](function(_0x16910f){if(_0x16910f&&_0x16910f[_0xfa2a('0x4f')]===0x0){return db[_0xfa2a('0x50')]['create']({'name':_0x421a81['name'],'resourceId':_0x421a81['id'],'type':_0x16910f['name'],'sectionId':_0x16910f['id']},{})['then'](function(){return _0x1b6880;});}else{return _0x1b6880;}})['catch'](function(_0x2f1de3){logger[_0xfa2a('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f1de3);throw _0x2f1de3;});}return _0x1b6880;})['then'](respondWithResult(_0x19ad5b,0xc9))['catch'](handleError(_0x19ad5b,null));};exports[_0xfa2a('0x22')]=function(_0x42c075,_0x5497d1){if(_0x42c075[_0xfa2a('0x52')]['id']){delete _0x42c075['body']['id'];}return db[_0xfa2a('0x40')][_0xfa2a('0x48')]({'where':{'id':_0x42c075[_0xfa2a('0x44')]['id']}})[_0xfa2a('0x23')](handleEntityNotFound(_0x5497d1,null))[_0xfa2a('0x23')](saveUpdates(_0x42c075[_0xfa2a('0x52')],null))['then'](respondWithResult(_0x5497d1,null))[_0xfa2a('0x42')](handleError(_0x5497d1,null));};exports[_0xfa2a('0x24')]=function(_0x102024,_0x2259c6){return db['AnalyticMetric'][_0xfa2a('0x48')]({'where':{'id':_0x102024['params']['id']}})['then'](handleEntityNotFound(_0x2259c6,null))[_0xfa2a('0x23')](removeEntity(_0x2259c6,null))[_0xfa2a('0x42')](handleError(_0x2259c6,null));}; \ No newline at end of file +var _0xddad=['filter','merge','VIRTUAL','include','findAll','catch','show','params','length','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x59647,_0x315257){var _0x334a9e=function(_0x5bcd37){while(--_0x5bcd37){_0x59647['push'](_0x59647['shift']());}};_0x334a9e(++_0x315257);}(_0xddad,0x1b4));var _0xddda=function(_0x8c8176,_0x5360a1){_0x8c8176=_0x8c8176-0x0;var _0x4dc47b=_0xddad[_0x8c8176];return _0x4dc47b;};'use strict';var pdf=require(_0xddda('0x0'));var emlformat=require(_0xddda('0x1'));var rimraf=require(_0xddda('0x2'));var zipdir=require(_0xddda('0x3'));var jsonpatch=require(_0xddda('0x4'));var rp=require(_0xddda('0x5'));var moment=require(_0xddda('0x6'));var BPromise=require(_0xddda('0x7'));var Mustache=require(_0xddda('0x8'));var util=require(_0xddda('0x9'));var path=require(_0xddda('0xa'));var sox=require(_0xddda('0xb'));var csv=require(_0xddda('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xddda('0xd'));var squel=require(_0xddda('0xe'));var crypto=require(_0xddda('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xddda('0x10'));var toCsv=require('to-csv');var querystring=require(_0xddda('0x11'));var Papa=require('papaparse');var Redis=require(_0xddda('0x12'));var authService=require(_0xddda('0x13'));var qs=require(_0xddda('0x14'));var as=require(_0xddda('0x15'));var hardwareService=require(_0xddda('0x16'));var logger=require(_0xddda('0x17'))(_0xddda('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xddda('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11e24f,_0x14159b){_0x14159b=_0x14159b||0xcc;return function(_0x50d739){if(_0x50d739){return _0x11e24f[_0xddda('0x1a')](_0x14159b);}return _0x11e24f['status'](_0x14159b)[_0xddda('0x1b')]();};}function respondWithResult(_0x3d45b8,_0x11ff99){_0x11ff99=_0x11ff99||0xc8;return function(_0x191816){if(_0x191816){return _0x3d45b8[_0xddda('0x1c')](_0x11ff99)[_0xddda('0x1d')](_0x191816);}};}function respondWithFilteredResult(_0x25975f,_0x3716ad){return function(_0x42812e){if(_0x42812e){var _0x3f8ce3=_0x42812e[_0xddda('0x1e')],_0x2eba00=_0x3716ad[_0xddda('0x1f')],_0x1e71ba=_0x3716ad[_0xddda('0x1f')]+_0x3716ad[_0xddda('0x20')],_0x537128;if(_0x1e71ba>=_0x3f8ce3){_0x1e71ba=_0x3f8ce3;_0x537128=0xc8;}else{_0x537128=0xce;}_0x25975f[_0xddda('0x1c')](_0x537128);return _0x25975f['set'](_0xddda('0x21'),_0x2eba00+'-'+_0x1e71ba+'/'+_0x3f8ce3)['json'](_0x42812e);}return null;};}function patchUpdates(_0x165393){return function(_0x49384a){try{jsonpatch[_0xddda('0x22')](_0x49384a,_0x165393,!![]);}catch(_0x2b012f){return BPromise['reject'](_0x2b012f);}return _0x49384a[_0xddda('0x23')]();};}function saveUpdates(_0x3b2051,_0x575c53){return function(_0x3f0924){if(_0x3f0924){return _0x3f0924[_0xddda('0x24')](_0x3b2051)[_0xddda('0x25')](function(_0x382d54){return _0x382d54;});}return null;};}function removeEntity(_0x59210d,_0x4aa5ea){return function(_0x2979ba){if(_0x2979ba){return _0x2979ba[_0xddda('0x26')]()[_0xddda('0x25')](function(){var _0x18f919=_0x2979ba[_0xddda('0x27')]({'plain':!![]});var _0x31f646='Metrics';return db[_0xddda('0x28')][_0xddda('0x26')]({'where':{'type':_0x31f646,'resourceId':_0x18f919['id']}})[_0xddda('0x25')](function(){return _0x2979ba;});})[_0xddda('0x25')](function(){_0x59210d[_0xddda('0x1c')](0xcc)[_0xddda('0x1b')]();});}};}function handleEntityNotFound(_0x385285,_0x4ac032){return function(_0x110006){if(!_0x110006){_0x385285[_0xddda('0x1a')](0x194);}return _0x110006;};}function handleError(_0x47079c,_0x131dd5){_0x131dd5=_0x131dd5||0x1f4;return function(_0x2a3ddc){logger[_0xddda('0x29')](_0x2a3ddc[_0xddda('0x2a')]);if(_0x2a3ddc['name']){delete _0x2a3ddc[_0xddda('0x2b')];}_0x47079c['status'](_0x131dd5)['send'](_0x2a3ddc);};}exports['index']=function(_0x3af6ea,_0x28b687){var _0x47db0a={},_0x1a0047={},_0x396434={'count':0x0,'rows':[]};var _0xdb99ab=_[_0xddda('0x2c')](db[_0xddda('0x2d')][_0xddda('0x2e')],function(_0x1bde98){return{'name':_0x1bde98[_0xddda('0x2f')],'type':_0x1bde98[_0xddda('0x30')][_0xddda('0x31')]};});_0x1a0047[_0xddda('0x32')]=_['map'](_0xdb99ab,'name');_0x1a0047[_0xddda('0x33')]=_[_0xddda('0x34')](_0x3af6ea['query']);_0x1a0047[_0xddda('0x35')]=_['intersection'](_0x1a0047[_0xddda('0x32')],_0x1a0047[_0xddda('0x33')]);_0x47db0a[_0xddda('0x36')]=_[_0xddda('0x37')](_0x1a0047['model'],qs[_0xddda('0x38')](_0x3af6ea[_0xddda('0x33')]['fields']));_0x47db0a['attributes']=_0x47db0a[_0xddda('0x36')]['length']?_0x47db0a['attributes']:_0x1a0047[_0xddda('0x32')];if(!_0x3af6ea[_0xddda('0x33')][_0xddda('0x39')](_0xddda('0x3a'))){_0x47db0a[_0xddda('0x20')]=qs['limit'](_0x3af6ea[_0xddda('0x33')][_0xddda('0x20')]);_0x47db0a[_0xddda('0x1f')]=qs['offset'](_0x3af6ea[_0xddda('0x33')][_0xddda('0x1f')]);}_0x47db0a['order']=qs['sort'](_0x3af6ea['query'][_0xddda('0x3b')]);_0x47db0a[_0xddda('0x3c')]=qs[_0xddda('0x35')](_[_0xddda('0x3d')](_0x3af6ea[_0xddda('0x33')],_0x1a0047[_0xddda('0x35')]),_0xdb99ab);if(_0x3af6ea[_0xddda('0x33')][_0xddda('0x3e')]){_0x47db0a['where']=_[_0xddda('0x3f')](_0x47db0a[_0xddda('0x3c')],{'$or':_[_0xddda('0x2c')](_0xdb99ab,function(_0x16a841){if(_0x16a841[_0xddda('0x30')]!==_0xddda('0x40')){var _0x72779d={};_0x72779d[_0x16a841[_0xddda('0x2b')]]={'$like':'%'+_0x3af6ea['query'][_0xddda('0x3e')]+'%'};return _0x72779d;}})});}_0x47db0a=_[_0xddda('0x3f')]({},_0x47db0a,_0x3af6ea['options']);var _0x4d819f={'where':_0x47db0a[_0xddda('0x3c')]};return db[_0xddda('0x2d')][_0xddda('0x1e')](_0x4d819f)[_0xddda('0x25')](function(_0x44744e){_0x396434[_0xddda('0x1e')]=_0x44744e;if(_0x3af6ea[_0xddda('0x33')]['includeAll']){_0x47db0a[_0xddda('0x41')]=[{'all':!![]}];}return db[_0xddda('0x2d')][_0xddda('0x42')](_0x47db0a);})[_0xddda('0x25')](function(_0x34aade){_0x396434['rows']=_0x34aade;return _0x396434;})['then'](respondWithFilteredResult(_0x28b687,_0x47db0a))[_0xddda('0x43')](handleError(_0x28b687,null));};exports[_0xddda('0x44')]=function(_0x56127b,_0x3175f9){var _0x5d6813={'raw':!![],'where':{'id':_0x56127b[_0xddda('0x45')]['id']}},_0x5634e0={};_0x5634e0[_0xddda('0x32')]=_['keys'](db['AnalyticMetric'][_0xddda('0x2e')]);_0x5634e0['query']=_[_0xddda('0x34')](_0x56127b['query']);_0x5634e0[_0xddda('0x35')]=_[_0xddda('0x37')](_0x5634e0[_0xddda('0x32')],_0x5634e0[_0xddda('0x33')]);_0x5d6813[_0xddda('0x36')]=_[_0xddda('0x37')](_0x5634e0[_0xddda('0x32')],qs[_0xddda('0x38')](_0x56127b[_0xddda('0x33')][_0xddda('0x38')]));_0x5d6813[_0xddda('0x36')]=_0x5d6813[_0xddda('0x36')][_0xddda('0x46')]?_0x5d6813[_0xddda('0x36')]:_0x5634e0[_0xddda('0x32')];if(_0x56127b['query'][_0xddda('0x47')]){_0x5d6813[_0xddda('0x41')]=[{'all':!![]}];}_0x5d6813=_['merge']({},_0x5d6813,_0x56127b[_0xddda('0x48')]);return db[_0xddda('0x2d')][_0xddda('0x49')](_0x5d6813)[_0xddda('0x25')](handleEntityNotFound(_0x3175f9,null))[_0xddda('0x25')](respondWithResult(_0x3175f9,null))[_0xddda('0x43')](handleError(_0x3175f9,null));};exports[_0xddda('0x4a')]=function(_0x37582b,_0xa9989d){return db[_0xddda('0x2d')][_0xddda('0x4a')](_0x37582b['body'],{})['then'](function(_0x129455){var _0x5af923=_0x37582b[_0xddda('0x4b')][_0xddda('0x27')]({'plain':!![]});if(!_0x5af923)throw new Error(_0xddda('0x4c'));if(_0x5af923[_0xddda('0x4d')]===_0xddda('0x4b')){var _0x69f782=_0x129455[_0xddda('0x27')]({'plain':!![]});var _0x5ce5e6=_0xddda('0x4e');return db['UserProfileSection'][_0xddda('0x49')]({'where':{'name':_0x5ce5e6,'userProfileId':_0x5af923[_0xddda('0x4f')]},'raw':!![]})['then'](function(_0xd3ba3d){if(_0xd3ba3d&&_0xd3ba3d[_0xddda('0x50')]===0x0){return db[_0xddda('0x28')]['create']({'name':_0x69f782[_0xddda('0x2b')],'resourceId':_0x69f782['id'],'type':_0xd3ba3d[_0xddda('0x2b')],'sectionId':_0xd3ba3d['id']},{})[_0xddda('0x25')](function(){return _0x129455;});}else{return _0x129455;}})[_0xddda('0x43')](function(_0x167347){logger[_0xddda('0x29')](_0xddda('0x51'),_0x167347);throw _0x167347;});}return _0x129455;})[_0xddda('0x25')](respondWithResult(_0xa9989d,0xc9))['catch'](handleError(_0xa9989d,null));};exports[_0xddda('0x24')]=function(_0x246a48,_0x3735ca){if(_0x246a48['body']['id']){delete _0x246a48[_0xddda('0x52')]['id'];}return db[_0xddda('0x2d')][_0xddda('0x49')]({'where':{'id':_0x246a48[_0xddda('0x45')]['id']}})[_0xddda('0x25')](handleEntityNotFound(_0x3735ca,null))[_0xddda('0x25')](saveUpdates(_0x246a48[_0xddda('0x52')],null))['then'](respondWithResult(_0x3735ca,null))['catch'](handleError(_0x3735ca,null));};exports['destroy']=function(_0x4ecc61,_0x2c5e84){return db[_0xddda('0x2d')][_0xddda('0x49')]({'where':{'id':_0x4ecc61[_0xddda('0x45')]['id']}})[_0xddda('0x25')](handleEntityNotFound(_0x2c5e84,null))[_0xddda('0x25')](removeEntity(_0x2c5e84,null))['catch'](handleError(_0x2c5e84,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 610784a..5511f30 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 _0x4853=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0x4853,0x19a));var _0x3485=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4853[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3485('0x0'))(_0x3485('0x1'));var moment=require('moment');var BPromise=require(_0x3485('0x2'));var rp=require(_0x3485('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3485('0x4'));var config=require(_0x3485('0x5'));var attributes=require(_0x3485('0x6'));module['exports']=function(_0x1c1578,_0x52de9c){return _0x1c1578[_0x3485('0x7')](_0x3485('0x8'),attributes,{'tableName':_0x3485('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f18=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics'];(function(_0x257b25,_0x197cee){var _0x39ad84=function(_0x304660){while(--_0x304660){_0x257b25['push'](_0x257b25['shift']());}};_0x39ad84(++_0x197cee);}(_0x5f18,0x1c0));var _0x85f1=function(_0x3d1170,_0x32785c){_0x3d1170=_0x3d1170-0x0;var _0x1c3a3e=_0x5f18[_0x3d1170];return _0x1c3a3e;};'use strict';var _=require(_0x85f1('0x0'));var util=require(_0x85f1('0x1'));var logger=require(_0x85f1('0x2'))(_0x85f1('0x3'));var moment=require(_0x85f1('0x4'));var BPromise=require('bluebird');var rp=require(_0x85f1('0x5'));var fs=require('fs');var path=require(_0x85f1('0x6'));var rimraf=require(_0x85f1('0x7'));var config=require(_0x85f1('0x8'));var attributes=require(_0x85f1('0x9'));module[_0x85f1('0xa')]=function(_0x1c4ae7,_0x280454){return _0x1c4ae7[_0x85f1('0xb')](_0x85f1('0xc'),attributes,{'tableName':_0x85f1('0xd'),'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 8c3b469..ad07303 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 _0x68f8=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird'];(function(_0x5cd47e,_0x584d23){var _0x1043ab=function(_0x643b96){while(--_0x643b96){_0x5cd47e['push'](_0x5cd47e['shift']());}};_0x1043ab(++_0x584d23);}(_0x68f8,0x1b5));var _0x868f=function(_0x44afc6,_0x35aa54){_0x44afc6=_0x44afc6-0x0;var _0xd5f006=_0x68f8[_0x44afc6];return _0xd5f006;};'use strict';var _=require(_0x868f('0x0'));var util=require(_0x868f('0x1'));var moment=require('moment');var BPromise=require(_0x868f('0x2'));var rs=require(_0x868f('0x3'));var fs=require('fs');var Redis=require(_0x868f('0x4'));var db=require(_0x868f('0x5'))['db'];var utils=require(_0x868f('0x6'));var logger=require(_0x868f('0x7'))('rpc');var config=require(_0x868f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x868f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dcffb,_0x431181,_0xcdb115){return new BPromise(function(_0x456af3,_0x518016){return client[_0x868f('0xa')](_0x1dcffb,_0xcdb115)[_0x868f('0xb')](function(_0x454825){logger['info'](_0x868f('0xc'),_0x431181,_0x868f('0xd'));logger[_0x868f('0xe')](_0x868f('0xf'),_0x431181,_0x868f('0xd'),JSON['stringify'](_0x454825));if(_0x454825[_0x868f('0x10')]){if(_0x454825[_0x868f('0x10')][_0x868f('0x11')]===0x1f4){logger[_0x868f('0x10')](_0x868f('0xc'),_0x431181,_0x454825[_0x868f('0x10')][_0x868f('0x12')]);return _0x518016(_0x454825[_0x868f('0x10')][_0x868f('0x12')]);}logger[_0x868f('0x10')](_0x868f('0xc'),_0x431181,_0x454825['error'][_0x868f('0x12')]);return _0x456af3(_0x454825[_0x868f('0x10')][_0x868f('0x12')]);}else{logger[_0x868f('0x13')](_0x868f('0xc'),_0x431181,_0x868f('0xd'));_0x456af3(_0x454825[_0x868f('0x14')]['message']);}})[_0x868f('0x15')](function(_0x4ddad7){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x431181,_0x4ddad7);_0x518016(_0x4ddad7);});});} \ No newline at end of file +var _0xe347=['result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x98cada,_0x46c804){var _0x1c7f85=function(_0x4e447a){while(--_0x4e447a){_0x98cada['push'](_0x98cada['shift']());}};_0x1c7f85(++_0x46c804);}(_0xe347,0x87));var _0x7e34=function(_0x5e9689,_0x48e034){_0x5e9689=_0x5e9689-0x0;var _0x2fac94=_0xe347[_0x5e9689];return _0x2fac94;};'use strict';var _=require(_0x7e34('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7e34('0x1'));var rs=require(_0x7e34('0x2'));var fs=require('fs');var Redis=require(_0x7e34('0x3'));var db=require(_0x7e34('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7e34('0x5'));var config=require('../../config/environment');var jayson=require(_0x7e34('0x6'));var client=jayson[_0x7e34('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x204379,_0x3b7168,_0x1ad7d4){return new BPromise(function(_0xd4d213,_0x207066){return client[_0x7e34('0x8')](_0x204379,_0x1ad7d4)[_0x7e34('0x9')](function(_0x20c989){logger['info'](_0x7e34('0xa'),_0x3b7168,_0x7e34('0xb'));logger[_0x7e34('0xc')](_0x7e34('0xd'),_0x3b7168,_0x7e34('0xb'),JSON['stringify'](_0x20c989));if(_0x20c989[_0x7e34('0xe')]){if(_0x20c989['error']['code']===0x1f4){logger['error'](_0x7e34('0xa'),_0x3b7168,_0x20c989[_0x7e34('0xe')][_0x7e34('0xf')]);return _0x207066(_0x20c989[_0x7e34('0xe')]['message']);}logger['error'](_0x7e34('0xa'),_0x3b7168,_0x20c989[_0x7e34('0xe')][_0x7e34('0xf')]);return _0xd4d213(_0x20c989[_0x7e34('0xe')]['message']);}else{logger[_0x7e34('0x10')](_0x7e34('0xa'),_0x3b7168,_0x7e34('0xb'));_0xd4d213(_0x20c989[_0x7e34('0x11')][_0x7e34('0xf')]);}})[_0x7e34('0x12')](function(_0x5eaadb){logger[_0x7e34('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x3b7168,_0x5eaadb);_0x207066(_0x5eaadb);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 2e8253d..ddbc32f 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 _0x7880=['Router','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x30bef2,_0x3d4186){var _0x567d67=function(_0x1acf17){while(--_0x1acf17){_0x30bef2['push'](_0x30bef2['shift']());}};_0x567d67(++_0x3d4186);}(_0x7880,0x1f4));var _0x0788=function(_0x4200e3,_0xb34e23){_0x4200e3=_0x4200e3-0x0;var _0x26ac37=_0x7880[_0x4200e3];return _0x26ac37;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var auth=require(_0x0788('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0788('0x6'));var controller=require(_0x0788('0x7'));router[_0x0788('0x8')]('/',auth[_0x0788('0x9')](),controller[_0x0788('0xa')]);router[_0x0788('0x8')](_0x0788('0xb'),auth[_0x0788('0x9')](),controller[_0x0788('0xc')]);router[_0x0788('0xd')]('/',auth['isAuthenticated'](),controller[_0x0788('0xe')]);router['put'](_0x0788('0xb'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router[_0x0788('0x10')](_0x0788('0xb'),auth[_0x0788('0x9')](),controller[_0x0788('0x11')]);module['exports']=router; \ No newline at end of file +var _0x57ca=['isAuthenticated','index','/:id','show','post','create','delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2c219c,_0x3ed4d8){var _0x1b7002=function(_0x271c7a){while(--_0x271c7a){_0x2c219c['push'](_0x2c219c['shift']());}};_0x1b7002(++_0x3ed4d8);}(_0x57ca,0x108));var _0xa57c=function(_0x3fcfb6,_0x515024){_0x3fcfb6=_0x3fcfb6-0x0;var _0x3b99a7=_0x57ca[_0x3fcfb6];return _0x3b99a7;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var auth=require(_0xa57c('0x4'));var interaction=require(_0xa57c('0x5'));var config=require(_0xa57c('0x6'));var controller=require('./analyticMetric.controller');router[_0xa57c('0x7')]('/',auth[_0xa57c('0x8')](),controller[_0xa57c('0x9')]);router[_0xa57c('0x7')](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller[_0xa57c('0xb')]);router[_0xa57c('0xc')]('/',auth['isAuthenticated'](),controller[_0xa57c('0xd')]);router['put'](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller['update']);router[_0xa57c('0xe')]('/:id',auth[_0xa57c('0x8')](),controller[_0xa57c('0xf')]);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 72ff2f3..711acdd 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 _0xcafa=['exports','sequelize'];(function(_0x54d49e,_0x5d9911){var _0x4af0f1=function(_0xf117b3){while(--_0xf117b3){_0x54d49e['push'](_0x54d49e['shift']());}};_0x4af0f1(++_0x5d9911);}(_0xcafa,0x111));var _0xacaf=function(_0x30a41e,_0x5cc300){_0x30a41e=_0x30a41e-0x0;var _0x34b508=_0xcafa[_0x30a41e];return _0x34b508;};'use strict';var Sequelize=require(_0xacaf('0x0'));module[_0xacaf('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x9d1a=['TEXT','sequelize'];(function(_0x57d370,_0x3ed0f6){var _0x550fd2=function(_0x59634f){while(--_0x59634f){_0x57d370['push'](_0x57d370['shift']());}};_0x550fd2(++_0x3ed0f6);}(_0x9d1a,0x1af));var _0xa9d1=function(_0x366e51,_0x3a0178){_0x366e51=_0x366e51-0x0;var _0x4e23e3=_0x9d1a[_0x366e51];return _0x4e23e3;};'use strict';var Sequelize=require(_0xa9d1('0x0'));module['exports']={'tree':{'type':Sequelize[_0xa9d1('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 89c5b96..bf41767 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 _0x4b17=['keys','filters','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','AnalyticTreeReport','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/utils','../../mysqldb','status','json','offset','set','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','rawAttributes','type','model','map','query'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b17,0x1ef));var _0x74b1=function(_0xa388a2,_0x40bde6){_0xa388a2=_0xa388a2-0x0;var _0x7ce7f6=_0x4b17[_0xa388a2];return _0x7ce7f6;};'use strict';var pdf=require(_0x74b1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x74b1('0x1'));var zipdir=require(_0x74b1('0x2'));var jsonpatch=require(_0x74b1('0x3'));var rp=require('request-promise');var moment=require(_0x74b1('0x4'));var BPromise=require(_0x74b1('0x5'));var Mustache=require(_0x74b1('0x6'));var util=require(_0x74b1('0x7'));var path=require(_0x74b1('0x8'));var sox=require('sox');var csv=require(_0x74b1('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x74b1('0xa'));var squel=require(_0x74b1('0xb'));var crypto=require(_0x74b1('0xc'));var jsforce=require(_0x74b1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x74b1('0x9'));var querystring=require(_0x74b1('0xe'));var Papa=require(_0x74b1('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x74b1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x74b1('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x74b1('0x12'))['db'];function respondWithStatusCode(_0x9d2efe,_0x2585a0){_0x2585a0=_0x2585a0||0xcc;return function(_0x5a8659){if(_0x5a8659){return _0x9d2efe['sendStatus'](_0x2585a0);}return _0x9d2efe[_0x74b1('0x13')](_0x2585a0)['end']();};}function respondWithResult(_0x4ee3ed,_0x16902b){_0x16902b=_0x16902b||0xc8;return function(_0x51a13b){if(_0x51a13b){return _0x4ee3ed[_0x74b1('0x13')](_0x16902b)[_0x74b1('0x14')](_0x51a13b);}};}function respondWithFilteredResult(_0x56bbbc,_0x1b2ffe){return function(_0x3dc65e){if(_0x3dc65e){var _0x156bff=_0x3dc65e['count'],_0x2bd975=_0x1b2ffe[_0x74b1('0x15')],_0x3d4a02=_0x1b2ffe[_0x74b1('0x15')]+_0x1b2ffe['limit'],_0xa9bb77;if(_0x3d4a02>=_0x156bff){_0x3d4a02=_0x156bff;_0xa9bb77=0xc8;}else{_0xa9bb77=0xce;}_0x56bbbc[_0x74b1('0x13')](_0xa9bb77);return _0x56bbbc[_0x74b1('0x16')]('Content-Range',_0x2bd975+'-'+_0x3d4a02+'/'+_0x156bff)[_0x74b1('0x14')](_0x3dc65e);}return null;};}function patchUpdates(_0x4ffa03){return function(_0xa54aa9){try{jsonpatch[_0x74b1('0x17')](_0xa54aa9,_0x4ffa03,!![]);}catch(_0x38f183){return BPromise[_0x74b1('0x18')](_0x38f183);}return _0xa54aa9[_0x74b1('0x19')]();};}function saveUpdates(_0x593bd8,_0x4f88b9){return function(_0x2dbb98){if(_0x2dbb98){return _0x2dbb98[_0x74b1('0x1a')](_0x593bd8)[_0x74b1('0x1b')](function(_0x3815fb){return _0x3815fb;});}return null;};}function removeEntity(_0x3c6bc2,_0x45892a){return function(_0x24ae52){if(_0x24ae52){return _0x24ae52[_0x74b1('0x1c')]()[_0x74b1('0x1b')](function(){_0x3c6bc2[_0x74b1('0x13')](0xcc)[_0x74b1('0x1d')]();});}};}function handleEntityNotFound(_0x58a2d9,_0x5bbfc8){return function(_0x4eb025){if(!_0x4eb025){_0x58a2d9[_0x74b1('0x1e')](0x194);}return _0x4eb025;};}function handleError(_0x55ced9,_0x149cad){_0x149cad=_0x149cad||0x1f4;return function(_0x51b877){logger[_0x74b1('0x1f')](_0x51b877[_0x74b1('0x20')]);if(_0x51b877[_0x74b1('0x21')]){delete _0x51b877[_0x74b1('0x21')];}_0x55ced9['status'](_0x149cad)[_0x74b1('0x22')](_0x51b877);};}exports[_0x74b1('0x23')]=function(_0x351516,_0x1b1793){var _0x2307a6={},_0x387122={},_0x26b8c6={'count':0x0,'rows':[]};var _0x3eb43d=_['map'](db['AnalyticTreeReport'][_0x74b1('0x24')],function(_0x38fd51){return{'name':_0x38fd51['fieldName'],'type':_0x38fd51[_0x74b1('0x25')]['key']};});_0x387122[_0x74b1('0x26')]=_[_0x74b1('0x27')](_0x3eb43d,_0x74b1('0x21'));_0x387122[_0x74b1('0x28')]=_[_0x74b1('0x29')](_0x351516['query']);_0x387122[_0x74b1('0x2a')]=_['intersection'](_0x387122[_0x74b1('0x26')],_0x387122[_0x74b1('0x28')]);_0x2307a6[_0x74b1('0x2b')]=_['intersection'](_0x387122[_0x74b1('0x26')],qs[_0x74b1('0x2c')](_0x351516['query'][_0x74b1('0x2c')]));_0x2307a6['attributes']=_0x2307a6[_0x74b1('0x2b')]['length']?_0x2307a6[_0x74b1('0x2b')]:_0x387122[_0x74b1('0x26')];if(!_0x351516[_0x74b1('0x28')][_0x74b1('0x2d')]('nolimit')){_0x2307a6[_0x74b1('0x2e')]=qs[_0x74b1('0x2e')](_0x351516[_0x74b1('0x28')][_0x74b1('0x2e')]);_0x2307a6[_0x74b1('0x15')]=qs[_0x74b1('0x15')](_0x351516[_0x74b1('0x28')]['offset']);}_0x2307a6[_0x74b1('0x2f')]=qs[_0x74b1('0x30')](_0x351516[_0x74b1('0x28')][_0x74b1('0x30')]);_0x2307a6[_0x74b1('0x31')]=qs[_0x74b1('0x2a')](_[_0x74b1('0x32')](_0x351516[_0x74b1('0x28')],_0x387122[_0x74b1('0x2a')]),_0x3eb43d);if(_0x351516[_0x74b1('0x28')]['filter']){_0x2307a6['where']=_['merge'](_0x2307a6[_0x74b1('0x31')],{'$or':_[_0x74b1('0x27')](_0x3eb43d,function(_0x489e56){if(_0x489e56[_0x74b1('0x25')]!==_0x74b1('0x33')){var _0x245e5b={};_0x245e5b[_0x489e56[_0x74b1('0x21')]]={'$like':'%'+_0x351516[_0x74b1('0x28')][_0x74b1('0x34')]+'%'};return _0x245e5b;}})});}_0x2307a6=_[_0x74b1('0x35')]({},_0x2307a6,_0x351516[_0x74b1('0x36')]);var _0x5dc9a9={'where':_0x2307a6[_0x74b1('0x31')]};return db[_0x74b1('0x37')]['count'](_0x5dc9a9)[_0x74b1('0x1b')](function(_0x1f3cb7){_0x26b8c6['count']=_0x1f3cb7;if(_0x351516['query'][_0x74b1('0x38')]){_0x2307a6['include']=[{'all':!![]}];}return db[_0x74b1('0x37')][_0x74b1('0x39')](_0x2307a6);})['then'](function(_0x2b2f9e){_0x26b8c6[_0x74b1('0x3a')]=_0x2b2f9e;return _0x26b8c6;})[_0x74b1('0x1b')](respondWithFilteredResult(_0x1b1793,_0x2307a6))[_0x74b1('0x3b')](handleError(_0x1b1793,null));};exports[_0x74b1('0x3c')]=function(_0x81834,_0x4c643d){var _0x492428={'raw':!![],'where':{'id':_0x81834[_0x74b1('0x3d')]['id']}},_0x34fedf={};_0x34fedf[_0x74b1('0x26')]=_[_0x74b1('0x29')](db[_0x74b1('0x37')][_0x74b1('0x24')]);_0x34fedf['query']=_[_0x74b1('0x29')](_0x81834['query']);_0x34fedf[_0x74b1('0x2a')]=_[_0x74b1('0x3e')](_0x34fedf[_0x74b1('0x26')],_0x34fedf['query']);_0x492428[_0x74b1('0x2b')]=_[_0x74b1('0x3e')](_0x34fedf[_0x74b1('0x26')],qs['fields'](_0x81834['query'][_0x74b1('0x2c')]));_0x492428[_0x74b1('0x2b')]=_0x492428['attributes']['length']?_0x492428['attributes']:_0x34fedf['model'];if(_0x81834[_0x74b1('0x28')][_0x74b1('0x38')]){_0x492428[_0x74b1('0x3f')]=[{'all':!![]}];}_0x492428=_[_0x74b1('0x35')]({},_0x492428,_0x81834[_0x74b1('0x36')]);return db[_0x74b1('0x37')][_0x74b1('0x40')](_0x492428)['then'](handleEntityNotFound(_0x4c643d,null))[_0x74b1('0x1b')](respondWithResult(_0x4c643d,null))[_0x74b1('0x3b')](handleError(_0x4c643d,null));};exports[_0x74b1('0x41')]=function(_0x3b0554,_0x3a3023){return db[_0x74b1('0x37')][_0x74b1('0x41')](_0x3b0554[_0x74b1('0x42')],{})[_0x74b1('0x1b')](respondWithResult(_0x3a3023,0xc9))[_0x74b1('0x3b')](handleError(_0x3a3023,null));};exports[_0x74b1('0x1a')]=function(_0x403b59,_0x461035){if(_0x403b59['body']['id']){delete _0x403b59['body']['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x403b59['params']['id']}})[_0x74b1('0x1b')](handleEntityNotFound(_0x461035,null))[_0x74b1('0x1b')](saveUpdates(_0x403b59[_0x74b1('0x42')],null))[_0x74b1('0x1b')](respondWithResult(_0x461035,null))[_0x74b1('0x3b')](handleError(_0x461035,null));};exports[_0x74b1('0x1c')]=function(_0x286c19,_0x24e9fa){return db['AnalyticTreeReport'][_0x74b1('0x40')]({'where':{'id':_0x286c19['params']['id']}})['then'](handleEntityNotFound(_0x24e9fa,null))['then'](removeEntity(_0x24e9fa,null))[_0x74b1('0x3b')](handleError(_0x24e9fa,null));}; \ No newline at end of file +var _0x4e4e=['count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','map','AnalyticTreeReport','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','rows','catch','params','rawAttributes','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','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','json'];(function(_0x27ca87,_0x559fd7){var _0x26ed60=function(_0x9a05ce){while(--_0x9a05ce){_0x27ca87['push'](_0x27ca87['shift']());}};_0x26ed60(++_0x559fd7);}(_0x4e4e,0x1eb));var _0xe4e4=function(_0x537625,_0x324deb){_0x537625=_0x537625-0x0;var _0x10158b=_0x4e4e[_0x537625];return _0x10158b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe4e4('0x0'));var rimraf=require(_0xe4e4('0x1'));var zipdir=require(_0xe4e4('0x2'));var jsonpatch=require(_0xe4e4('0x3'));var rp=require(_0xe4e4('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe4e4('0x5'));var util=require(_0xe4e4('0x6'));var path=require('path');var sox=require(_0xe4e4('0x7'));var csv=require(_0xe4e4('0x8'));var ejs=require(_0xe4e4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe4e4('0xa'));var crypto=require(_0xe4e4('0xb'));var jsforce=require(_0xe4e4('0xc'));var deskjs=require(_0xe4e4('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4e4('0xe'));var authService=require(_0xe4e4('0xf'));var qs=require(_0xe4e4('0x10'));var as=require(_0xe4e4('0x11'));var hardwareService=require(_0xe4e4('0x12'));var logger=require(_0xe4e4('0x13'))('api');var utils=require(_0xe4e4('0x14'));var config=require(_0xe4e4('0x15'));var licenseUtil=require(_0xe4e4('0x16'));var db=require(_0xe4e4('0x17'))['db'];function respondWithStatusCode(_0x38cf50,_0x4e7620){_0x4e7620=_0x4e7620||0xcc;return function(_0x4a2464){if(_0x4a2464){return _0x38cf50[_0xe4e4('0x18')](_0x4e7620);}return _0x38cf50['status'](_0x4e7620)['end']();};}function respondWithResult(_0x270022,_0x25fda2){_0x25fda2=_0x25fda2||0xc8;return function(_0x51a370){if(_0x51a370){return _0x270022[_0xe4e4('0x19')](_0x25fda2)[_0xe4e4('0x1a')](_0x51a370);}};}function respondWithFilteredResult(_0x545f46,_0xe77447){return function(_0x21c577){if(_0x21c577){var _0x14f061=_0x21c577[_0xe4e4('0x1b')],_0x1ea821=_0xe77447[_0xe4e4('0x1c')],_0x3cdf22=_0xe77447[_0xe4e4('0x1c')]+_0xe77447['limit'],_0x2bb574;if(_0x3cdf22>=_0x14f061){_0x3cdf22=_0x14f061;_0x2bb574=0xc8;}else{_0x2bb574=0xce;}_0x545f46[_0xe4e4('0x19')](_0x2bb574);return _0x545f46[_0xe4e4('0x1d')](_0xe4e4('0x1e'),_0x1ea821+'-'+_0x3cdf22+'/'+_0x14f061)[_0xe4e4('0x1a')](_0x21c577);}return null;};}function patchUpdates(_0x3f04a6){return function(_0x5e667d){try{jsonpatch[_0xe4e4('0x1f')](_0x5e667d,_0x3f04a6,!![]);}catch(_0x5e6a59){return BPromise[_0xe4e4('0x20')](_0x5e6a59);}return _0x5e667d['save']();};}function saveUpdates(_0x11c1ef,_0x19796f){return function(_0x511fce){if(_0x511fce){return _0x511fce[_0xe4e4('0x21')](_0x11c1ef)[_0xe4e4('0x22')](function(_0x3a0ce0){return _0x3a0ce0;});}return null;};}function removeEntity(_0x10523a,_0x2f1797){return function(_0x26de0d){if(_0x26de0d){return _0x26de0d[_0xe4e4('0x23')]()[_0xe4e4('0x22')](function(){_0x10523a[_0xe4e4('0x19')](0xcc)[_0xe4e4('0x24')]();});}};}function handleEntityNotFound(_0x10ad0a,_0x4f5424){return function(_0x317ac6){if(!_0x317ac6){_0x10ad0a[_0xe4e4('0x18')](0x194);}return _0x317ac6;};}function handleError(_0x14b17c,_0x3bf2b1){_0x3bf2b1=_0x3bf2b1||0x1f4;return function(_0x437a09){logger[_0xe4e4('0x25')](_0x437a09[_0xe4e4('0x26')]);if(_0x437a09[_0xe4e4('0x27')]){delete _0x437a09[_0xe4e4('0x27')];}_0x14b17c[_0xe4e4('0x19')](_0x3bf2b1)[_0xe4e4('0x28')](_0x437a09);};}exports['index']=function(_0x35439b,_0x413dca){var _0x5de720={},_0x29d368={},_0x7fc175={'count':0x0,'rows':[]};var _0x3f99e7=_[_0xe4e4('0x29')](db[_0xe4e4('0x2a')]['rawAttributes'],function(_0x4899a0){return{'name':_0x4899a0[_0xe4e4('0x2b')],'type':_0x4899a0[_0xe4e4('0x2c')][_0xe4e4('0x2d')]};});_0x29d368[_0xe4e4('0x2e')]=_[_0xe4e4('0x29')](_0x3f99e7,_0xe4e4('0x27'));_0x29d368['query']=_[_0xe4e4('0x2f')](_0x35439b[_0xe4e4('0x30')]);_0x29d368['filters']=_[_0xe4e4('0x31')](_0x29d368[_0xe4e4('0x2e')],_0x29d368[_0xe4e4('0x30')]);_0x5de720[_0xe4e4('0x32')]=_[_0xe4e4('0x31')](_0x29d368['model'],qs['fields'](_0x35439b[_0xe4e4('0x30')][_0xe4e4('0x33')]));_0x5de720['attributes']=_0x5de720[_0xe4e4('0x32')][_0xe4e4('0x34')]?_0x5de720[_0xe4e4('0x32')]:_0x29d368['model'];if(!_0x35439b[_0xe4e4('0x30')][_0xe4e4('0x35')](_0xe4e4('0x36'))){_0x5de720[_0xe4e4('0x37')]=qs[_0xe4e4('0x37')](_0x35439b[_0xe4e4('0x30')]['limit']);_0x5de720[_0xe4e4('0x1c')]=qs[_0xe4e4('0x1c')](_0x35439b[_0xe4e4('0x30')]['offset']);}_0x5de720[_0xe4e4('0x38')]=qs[_0xe4e4('0x39')](_0x35439b[_0xe4e4('0x30')][_0xe4e4('0x39')]);_0x5de720[_0xe4e4('0x3a')]=qs[_0xe4e4('0x3b')](_[_0xe4e4('0x3c')](_0x35439b['query'],_0x29d368['filters']),_0x3f99e7);if(_0x35439b['query']['filter']){_0x5de720['where']=_[_0xe4e4('0x3d')](_0x5de720[_0xe4e4('0x3a')],{'$or':_[_0xe4e4('0x29')](_0x3f99e7,function(_0x3097aa){if(_0x3097aa[_0xe4e4('0x2c')]!==_0xe4e4('0x3e')){var _0x5b17bb={};_0x5b17bb[_0x3097aa[_0xe4e4('0x27')]]={'$like':'%'+_0x35439b[_0xe4e4('0x30')][_0xe4e4('0x3f')]+'%'};return _0x5b17bb;}})});}_0x5de720=_[_0xe4e4('0x3d')]({},_0x5de720,_0x35439b['options']);var _0x33b58a={'where':_0x5de720[_0xe4e4('0x3a')]};return db[_0xe4e4('0x2a')]['count'](_0x33b58a)['then'](function(_0x42b615){_0x7fc175['count']=_0x42b615;if(_0x35439b[_0xe4e4('0x30')][_0xe4e4('0x40')]){_0x5de720['include']=[{'all':!![]}];}return db[_0xe4e4('0x2a')]['findAll'](_0x5de720);})[_0xe4e4('0x22')](function(_0x5744d0){_0x7fc175[_0xe4e4('0x41')]=_0x5744d0;return _0x7fc175;})[_0xe4e4('0x22')](respondWithFilteredResult(_0x413dca,_0x5de720))[_0xe4e4('0x42')](handleError(_0x413dca,null));};exports['show']=function(_0x16f425,_0x2c9d1c){var _0x569a3c={'raw':!![],'where':{'id':_0x16f425[_0xe4e4('0x43')]['id']}},_0x3df250={};_0x3df250[_0xe4e4('0x2e')]=_['keys'](db[_0xe4e4('0x2a')][_0xe4e4('0x44')]);_0x3df250[_0xe4e4('0x30')]=_[_0xe4e4('0x2f')](_0x16f425[_0xe4e4('0x30')]);_0x3df250[_0xe4e4('0x3b')]=_[_0xe4e4('0x31')](_0x3df250[_0xe4e4('0x2e')],_0x3df250['query']);_0x569a3c['attributes']=_[_0xe4e4('0x31')](_0x3df250[_0xe4e4('0x2e')],qs['fields'](_0x16f425[_0xe4e4('0x30')][_0xe4e4('0x33')]));_0x569a3c[_0xe4e4('0x32')]=_0x569a3c['attributes'][_0xe4e4('0x34')]?_0x569a3c['attributes']:_0x3df250['model'];if(_0x16f425['query'][_0xe4e4('0x40')]){_0x569a3c[_0xe4e4('0x45')]=[{'all':!![]}];}_0x569a3c=_[_0xe4e4('0x3d')]({},_0x569a3c,_0x16f425[_0xe4e4('0x46')]);return db[_0xe4e4('0x2a')][_0xe4e4('0x47')](_0x569a3c)[_0xe4e4('0x22')](handleEntityNotFound(_0x2c9d1c,null))[_0xe4e4('0x22')](respondWithResult(_0x2c9d1c,null))[_0xe4e4('0x42')](handleError(_0x2c9d1c,null));};exports[_0xe4e4('0x48')]=function(_0x5d5ed0,_0x261b63){return db[_0xe4e4('0x2a')]['create'](_0x5d5ed0['body'],{})[_0xe4e4('0x22')](respondWithResult(_0x261b63,0xc9))[_0xe4e4('0x42')](handleError(_0x261b63,null));};exports['update']=function(_0x21d42a,_0x499092){if(_0x21d42a[_0xe4e4('0x49')]['id']){delete _0x21d42a[_0xe4e4('0x49')]['id'];}return db[_0xe4e4('0x2a')]['find']({'where':{'id':_0x21d42a[_0xe4e4('0x43')]['id']}})[_0xe4e4('0x22')](handleEntityNotFound(_0x499092,null))['then'](saveUpdates(_0x21d42a[_0xe4e4('0x49')],null))['then'](respondWithResult(_0x499092,null))[_0xe4e4('0x42')](handleError(_0x499092,null));};exports[_0xe4e4('0x23')]=function(_0x453da4,_0x14e772){return db[_0xe4e4('0x2a')]['find']({'where':{'id':_0x453da4[_0xe4e4('0x43')]['id']}})[_0xe4e4('0x22')](handleEntityNotFound(_0x14e772,null))[_0xe4e4('0x22')](removeEntity(_0x14e772,null))['catch'](handleError(_0x14e772,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index cce0dbd..ec2a688 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 _0x5324=['./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x335ba8,_0x321121){var _0xed9217=function(_0x825e6d){while(--_0x825e6d){_0x335ba8['push'](_0x335ba8['shift']());}};_0xed9217(++_0x321121);}(_0x5324,0x154));var _0x4532=function(_0x1063f5,_0xac8c5b){_0x1063f5=_0x1063f5-0x0;var _0x5b49f0=_0x5324[_0x1063f5];return _0x5b49f0;};'use strict';var _=require(_0x4532('0x0'));var util=require(_0x4532('0x1'));var logger=require(_0x4532('0x2'))(_0x4532('0x3'));var moment=require('moment');var BPromise=require(_0x4532('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4532('0x5'));var rimraf=require(_0x4532('0x6'));var config=require(_0x4532('0x7'));var attributes=require(_0x4532('0x8'));module[_0x4532('0x9')]=function(_0x3f68e2,_0x2672ec){return _0x3f68e2[_0x4532('0xa')]('AnalyticTreeReport',attributes,{'tableName':_0x4532('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8411=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0x8411,0x118));var _0x1841=function(_0x1a99cb,_0x23c826){_0x1a99cb=_0x1a99cb-0x0;var _0xe981e8=_0x8411[_0x1a99cb];return _0xe981e8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1841('0x0'))(_0x1841('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1841('0x2'));var fs=require('fs');var path=require(_0x1841('0x3'));var rimraf=require(_0x1841('0x4'));var config=require(_0x1841('0x5'));var attributes=require(_0x1841('0x6'));module['exports']=function(_0x3432f2,_0x54a581){return _0x3432f2[_0x1841('0x7')](_0x1841('0x8'),attributes,{'tableName':_0x1841('0x9'),'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 95d0b82..019cbe6 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 _0x2e32=['stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x24daa2,_0x308147){var _0xc61b1=function(_0x415b5f){while(--_0x415b5f){_0x24daa2['push'](_0x24daa2['shift']());}};_0xc61b1(++_0x308147);}(_0x2e32,0x15c));var _0x22e3=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x2e32[_0x725b8e];return _0x43ac45;};'use strict';var _=require(_0x22e3('0x0'));var util=require('util');var moment=require(_0x22e3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22e3('0x2'));var db=require(_0x22e3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x22e3('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x22e3('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5b3665,_0x16b3b3,_0x467661){return new BPromise(function(_0x585211,_0x1f1539){return client[_0x22e3('0x6')](_0x5b3665,_0x467661)[_0x22e3('0x7')](function(_0x4e1eeb){logger[_0x22e3('0x8')](_0x22e3('0x9'),_0x16b3b3,'request\x20sent');logger[_0x22e3('0xa')](_0x22e3('0xb'),_0x16b3b3,_0x22e3('0xc'),JSON[_0x22e3('0xd')](_0x4e1eeb));if(_0x4e1eeb['error']){if(_0x4e1eeb[_0x22e3('0xe')][_0x22e3('0xf')]===0x1f4){logger[_0x22e3('0xe')]('AnalyticTreeReport,\x20%s,\x20%s',_0x16b3b3,_0x4e1eeb[_0x22e3('0xe')][_0x22e3('0x10')]);return _0x1f1539(_0x4e1eeb['error'][_0x22e3('0x10')]);}logger[_0x22e3('0xe')]('AnalyticTreeReport,\x20%s,\x20%s',_0x16b3b3,_0x4e1eeb[_0x22e3('0xe')]['message']);return _0x585211(_0x4e1eeb[_0x22e3('0xe')][_0x22e3('0x10')]);}else{logger['info'](_0x22e3('0x9'),_0x16b3b3,_0x22e3('0xc'));_0x585211(_0x4e1eeb[_0x22e3('0x11')][_0x22e3('0x10')]);}})[_0x22e3('0x12')](function(_0x50adb6){logger[_0x22e3('0xe')]('AnalyticTreeReport,\x20%s,\x20%s',_0x16b3b3,_0x50adb6);_0x1f1539(_0x50adb6);});});} \ No newline at end of file +var _0x73b0=['jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc'];(function(_0x5a86c1,_0x30b562){var _0x24abbf=function(_0x5463cb){while(--_0x5463cb){_0x5a86c1['push'](_0x5a86c1['shift']());}};_0x24abbf(++_0x30b562);}(_0x73b0,0x1d9));var _0x073b=function(_0x5443c6,_0x544e39){_0x5443c6=_0x5443c6-0x0;var _0x2a0bab=_0x73b0[_0x5443c6];return _0x2a0bab;};'use strict';var _=require(_0x073b('0x0'));var util=require(_0x073b('0x1'));var moment=require(_0x073b('0x2'));var BPromise=require(_0x073b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x073b('0x4'));var db=require(_0x073b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x073b('0x6'));var config=require('../../config/environment');var jayson=require(_0x073b('0x7'));var client=jayson[_0x073b('0x8')][_0x073b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a6372,_0x2ac2ec,_0x2f36bd){return new BPromise(function(_0x44f641,_0x5e6d99){return client[_0x073b('0xa')](_0x3a6372,_0x2f36bd)[_0x073b('0xb')](function(_0xe97c4b){logger[_0x073b('0xc')](_0x073b('0xd'),_0x2ac2ec,'request\x20sent');logger[_0x073b('0xe')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x2ac2ec,'request\x20sent',JSON[_0x073b('0xf')](_0xe97c4b));if(_0xe97c4b[_0x073b('0x10')]){if(_0xe97c4b['error'][_0x073b('0x11')]===0x1f4){logger[_0x073b('0x10')](_0x073b('0xd'),_0x2ac2ec,_0xe97c4b['error'][_0x073b('0x12')]);return _0x5e6d99(_0xe97c4b[_0x073b('0x10')][_0x073b('0x12')]);}logger[_0x073b('0x10')]('AnalyticTreeReport,\x20%s,\x20%s',_0x2ac2ec,_0xe97c4b[_0x073b('0x10')][_0x073b('0x12')]);return _0x44f641(_0xe97c4b['error'][_0x073b('0x12')]);}else{logger[_0x073b('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x2ac2ec,_0x073b('0x13'));_0x44f641(_0xe97c4b['result']['message']);}})['catch'](function(_0x2b6e18){logger[_0x073b('0x10')](_0x073b('0xd'),_0x2ac2ec,_0x2b6e18);_0x5e6d99(_0x2b6e18);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index ca88067..f18008f 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 _0xec3e=['/:id','post','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated'];(function(_0x3686f4,_0xd4a373){var _0x168f2b=function(_0x352038){while(--_0x352038){_0x3686f4['push'](_0x3686f4['shift']());}};_0x168f2b(++_0xd4a373);}(_0xec3e,0x1a5));var _0xeec3=function(_0x1095c8,_0x582fdb){_0x1095c8=_0x1095c8-0x0;var _0xe753b9=_0xec3e[_0x1095c8];return _0xe753b9;};'use strict';var multer=require(_0xeec3('0x0'));var util=require(_0xeec3('0x1'));var path=require(_0xeec3('0x2'));var timeout=require(_0xeec3('0x3'));var express=require(_0xeec3('0x4'));var router=express[_0xeec3('0x5')]();var auth=require(_0xeec3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xeec3('0x7'));var controller=require(_0xeec3('0x8'));router[_0xeec3('0x9')]('/',auth[_0xeec3('0xa')](),controller['index']);router[_0xeec3('0x9')](_0xeec3('0xb'),auth[_0xeec3('0xa')](),controller['show']);router[_0xeec3('0xc')]('/',auth[_0xeec3('0xa')](),controller['create']);router[_0xeec3('0xd')](_0xeec3('0xb'),auth[_0xeec3('0xa')](),controller['update']);router[_0xeec3('0xe')](_0xeec3('0xb'),auth[_0xeec3('0xa')](),controller['destroy']);module[_0xeec3('0xf')]=router; \ No newline at end of file +var _0xf456=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','exports','util'];(function(_0x4b1122,_0xef5923){var _0x24b956=function(_0x4cc15e){while(--_0x4cc15e){_0x4b1122['push'](_0x4b1122['shift']());}};_0x24b956(++_0xef5923);}(_0xf456,0x168));var _0x6f45=function(_0x2ff16c,_0x42189c){_0x2ff16c=_0x2ff16c-0x0;var _0x2dd982=_0xf456[_0x2ff16c];return _0x2dd982;};'use strict';var multer=require('multer');var util=require(_0x6f45('0x0'));var path=require(_0x6f45('0x1'));var timeout=require('connect-timeout');var express=require(_0x6f45('0x2'));var router=express[_0x6f45('0x3')]();var auth=require(_0x6f45('0x4'));var interaction=require(_0x6f45('0x5'));var config=require(_0x6f45('0x6'));var controller=require(_0x6f45('0x7'));router[_0x6f45('0x8')]('/',auth[_0x6f45('0x9')](),controller[_0x6f45('0xa')]);router[_0x6f45('0x8')]('/:id',auth[_0x6f45('0x9')](),controller[_0x6f45('0xb')]);router[_0x6f45('0xc')]('/',auth['isAuthenticated'](),controller[_0x6f45('0xd')]);router['put'](_0x6f45('0xe'),auth['isAuthenticated'](),controller[_0x6f45('0xf')]);router[_0x6f45('0x10')](_0x6f45('0xe'),auth[_0x6f45('0x9')](),controller[_0x6f45('0x11')]);module[_0x6f45('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 6df6274..9e9e8d4 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 _0x1256=['STRING','sequelize','exports'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x1256,0x1ae));var _0x6125=function(_0x4b679a,_0x396d09){_0x4b679a=_0x4b679a-0x0;var _0x32b50a=_0x1256[_0x4b679a];return _0x32b50a;};'use strict';var Sequelize=require(_0x6125('0x0'));module[_0x6125('0x1')]={'name':{'type':Sequelize[_0x6125('0x2')]},'basename':{'type':Sequelize[_0x6125('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5da4=['STRING','sequelize','exports'];(function(_0x522c6d,_0x4d250d){var _0x26300d=function(_0x3ab228){while(--_0x3ab228){_0x522c6d['push'](_0x522c6d['shift']());}};_0x26300d(++_0x4d250d);}(_0x5da4,0x118));var _0x45da=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5da4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x45da('0x0'));module[_0x45da('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x45da('0x2')]},'type':{'type':Sequelize[_0x45da('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 4bbe2fb..71c2604 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 _0x2669=['params','clone','find','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','findOne','join','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','json','apply','save','update','then','destroy','sendStatus','stack','name','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x2669,0x11a));var _0x9266=function(_0x4fb4c8,_0x141745){_0x4fb4c8=_0x4fb4c8-0x0;var _0x1b6740=_0x2669[_0x4fb4c8];return _0x1b6740;};'use strict';var pdf=require(_0x9266('0x0'));var emlformat=require(_0x9266('0x1'));var rimraf=require(_0x9266('0x2'));var zipdir=require(_0x9266('0x3'));var jsonpatch=require(_0x9266('0x4'));var rp=require('request-promise');var moment=require(_0x9266('0x5'));var BPromise=require(_0x9266('0x6'));var Mustache=require(_0x9266('0x7'));var util=require(_0x9266('0x8'));var path=require(_0x9266('0x9'));var sox=require('sox');var csv=require(_0x9266('0xa'));var ejs=require(_0x9266('0xb'));var fs=require('fs');var _=require(_0x9266('0xc'));var squel=require(_0x9266('0xd'));var crypto=require(_0x9266('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9266('0xf'));var toCsv=require(_0x9266('0xa'));var querystring=require('querystring');var Papa=require(_0x9266('0x10'));var Redis=require(_0x9266('0x11'));var authService=require(_0x9266('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9266('0x13'));var hardwareService=require(_0x9266('0x14'));var logger=require(_0x9266('0x15'))(_0x9266('0x16'));var utils=require(_0x9266('0x17'));var config=require(_0x9266('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9266('0x19'))['db'];function respondWithStatusCode(_0x3e70bf,_0x5460aa){_0x5460aa=_0x5460aa||0xcc;return function(_0x4a257c){if(_0x4a257c){return _0x3e70bf['sendStatus'](_0x5460aa);}return _0x3e70bf[_0x9266('0x1a')](_0x5460aa)[_0x9266('0x1b')]();};}function respondWithResult(_0x2be7b8,_0x26c6a7){_0x26c6a7=_0x26c6a7||0xc8;return function(_0x25e6e8){if(_0x25e6e8){return _0x2be7b8['status'](_0x26c6a7)['json'](_0x25e6e8);}};}function respondWithFilteredResult(_0x45ac5d,_0x4886fd){return function(_0x26f6f5){if(_0x26f6f5){var _0x3b38f6=_0x26f6f5[_0x9266('0x1c')],_0x11f732=_0x4886fd[_0x9266('0x1d')],_0x3545e4=_0x4886fd[_0x9266('0x1d')]+_0x4886fd[_0x9266('0x1e')],_0x5cdce8;if(_0x3545e4>=_0x3b38f6){_0x3545e4=_0x3b38f6;_0x5cdce8=0xc8;}else{_0x5cdce8=0xce;}_0x45ac5d['status'](_0x5cdce8);return _0x45ac5d['set']('Content-Range',_0x11f732+'-'+_0x3545e4+'/'+_0x3b38f6)[_0x9266('0x1f')](_0x26f6f5);}return null;};}function patchUpdates(_0x44f1c8){return function(_0x3c9b40){try{jsonpatch[_0x9266('0x20')](_0x3c9b40,_0x44f1c8,!![]);}catch(_0x72d970){return BPromise['reject'](_0x72d970);}return _0x3c9b40[_0x9266('0x21')]();};}function saveUpdates(_0x48d17a,_0x321ad2){return function(_0x41d2ec){if(_0x41d2ec){return _0x41d2ec[_0x9266('0x22')](_0x48d17a)[_0x9266('0x23')](function(_0x2c4c01){return _0x2c4c01;});}return null;};}function removeEntity(_0xba7352,_0x5bc5ac){return function(_0x1cd27f){if(_0x1cd27f){return _0x1cd27f[_0x9266('0x24')]()['then'](function(){_0xba7352[_0x9266('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20bc3e,_0x48b939){return function(_0x16cee7){if(!_0x16cee7){_0x20bc3e[_0x9266('0x25')](0x194);}return _0x16cee7;};}function handleError(_0x585a37,_0x22cadf){_0x22cadf=_0x22cadf||0x1f4;return function(_0x27a15e){logger['error'](_0x27a15e[_0x9266('0x26')]);if(_0x27a15e[_0x9266('0x27')]){delete _0x27a15e['name'];}_0x585a37[_0x9266('0x1a')](_0x22cadf)['send'](_0x27a15e);};}exports[_0x9266('0x28')]=function(_0x434f58,_0x2a1150){var _0x3bc40f={},_0x4051de={},_0x976979={'count':0x0,'rows':[]};var _0x20b78d=_[_0x9266('0x29')](db[_0x9266('0x2a')][_0x9266('0x2b')],function(_0x3f15b5){return{'name':_0x3f15b5[_0x9266('0x2c')],'type':_0x3f15b5[_0x9266('0x2d')][_0x9266('0x2e')]};});_0x4051de[_0x9266('0x2f')]=_[_0x9266('0x29')](_0x20b78d,_0x9266('0x27'));_0x4051de[_0x9266('0x30')]=_[_0x9266('0x31')](_0x434f58[_0x9266('0x30')]);_0x4051de[_0x9266('0x32')]=_[_0x9266('0x33')](_0x4051de[_0x9266('0x2f')],_0x4051de[_0x9266('0x30')]);_0x3bc40f['attributes']=_[_0x9266('0x33')](_0x4051de['model'],qs[_0x9266('0x34')](_0x434f58[_0x9266('0x30')][_0x9266('0x34')]));_0x3bc40f[_0x9266('0x35')]=_0x3bc40f[_0x9266('0x35')][_0x9266('0x36')]?_0x3bc40f[_0x9266('0x35')]:_0x4051de['model'];if(!_0x434f58['query']['hasOwnProperty'](_0x9266('0x37'))){_0x3bc40f[_0x9266('0x1e')]=qs[_0x9266('0x1e')](_0x434f58[_0x9266('0x30')]['limit']);_0x3bc40f[_0x9266('0x1d')]=qs['offset'](_0x434f58['query'][_0x9266('0x1d')]);}_0x3bc40f[_0x9266('0x38')]=qs[_0x9266('0x39')](_0x434f58[_0x9266('0x30')][_0x9266('0x39')]);_0x3bc40f[_0x9266('0x3a')]=qs[_0x9266('0x32')](_[_0x9266('0x3b')](_0x434f58[_0x9266('0x30')],_0x4051de[_0x9266('0x32')]),_0x20b78d);if(_0x434f58[_0x9266('0x30')][_0x9266('0x3c')]){_0x3bc40f[_0x9266('0x3a')]=_['merge'](_0x3bc40f['where'],{'$or':_['map'](_0x20b78d,function(_0x11371f){if(_0x11371f[_0x9266('0x2d')]!==_0x9266('0x3d')){var _0x42519e={};_0x42519e[_0x11371f[_0x9266('0x27')]]={'$like':'%'+_0x434f58[_0x9266('0x30')][_0x9266('0x3c')]+'%'};return _0x42519e;}})});}_0x3bc40f=_[_0x9266('0x3e')]({},_0x3bc40f,_0x434f58[_0x9266('0x3f')]);var _0x2173db={'where':_0x3bc40f[_0x9266('0x3a')]};return db[_0x9266('0x2a')][_0x9266('0x1c')](_0x2173db)[_0x9266('0x23')](function(_0x249633){_0x976979[_0x9266('0x1c')]=_0x249633;if(_0x434f58[_0x9266('0x30')][_0x9266('0x40')]){_0x3bc40f[_0x9266('0x41')]=[{'all':!![]}];}return db[_0x9266('0x2a')][_0x9266('0x42')](_0x3bc40f);})['then'](function(_0x38a7ea){_0x976979[_0x9266('0x43')]=_0x38a7ea;return _0x976979;})[_0x9266('0x23')](respondWithFilteredResult(_0x2a1150,_0x3bc40f))[_0x9266('0x44')](handleError(_0x2a1150,null));};exports[_0x9266('0x45')]=function(_0x1890b3,_0x177e49){var _0x5f54e6={'raw':!![],'where':{'id':_0x1890b3[_0x9266('0x46')]['id']}},_0x1b3ea3={};_0x1b3ea3[_0x9266('0x2f')]=_['keys'](db[_0x9266('0x2a')][_0x9266('0x2b')]);_0x1b3ea3['query']=_[_0x9266('0x31')](_0x1890b3['query']);_0x1b3ea3[_0x9266('0x32')]=_[_0x9266('0x33')](_0x1b3ea3['model'],_0x1b3ea3[_0x9266('0x30')]);_0x5f54e6[_0x9266('0x35')]=_[_0x9266('0x33')](_0x1b3ea3[_0x9266('0x2f')],qs[_0x9266('0x34')](_0x1890b3['query'][_0x9266('0x34')]));_0x5f54e6[_0x9266('0x35')]=_0x5f54e6[_0x9266('0x35')]['length']?_0x5f54e6['attributes']:_0x1b3ea3[_0x9266('0x2f')];if(_0x1890b3[_0x9266('0x30')]['includeAll']){_0x5f54e6[_0x9266('0x41')]=[{'all':!![]}];}_0x5f54e6=_[_0x9266('0x3e')]({},_0x5f54e6,_0x1890b3[_0x9266('0x3f')]);return db[_0x9266('0x2a')]['find'](_0x5f54e6)['then'](handleEntityNotFound(_0x177e49,null))[_0x9266('0x23')](respondWithResult(_0x177e49,null))[_0x9266('0x44')](handleError(_0x177e49,null));};exports[_0x9266('0x47')]=function(_0x243077,_0x3be47b){var _0x2c73b={'where':{'id':_0x243077[_0x9266('0x46')]['id']}},_0x2de0a1={};_0x2de0a1['model']=_[_0x9266('0x31')](db[_0x9266('0x2a')][_0x9266('0x2b')]);_0x2c73b[_0x9266('0x35')]=_[_0x9266('0x33')](_0x2de0a1['model'],qs[_0x9266('0x34')](_0x243077[_0x9266('0x30')][_0x9266('0x34')]));_0x2c73b['attributes']=_0x2c73b[_0x9266('0x35')]['length']?_0x2c73b[_0x9266('0x35')]:_0x2de0a1[_0x9266('0x2f')];if(_0x243077[_0x9266('0x30')][_0x9266('0x40')]){_0x2c73b[_0x9266('0x41')]=[{'all':!![]}];}_0x2c73b=_['merge']({},_0x2c73b,_0x243077[_0x9266('0x3f')]);return db[_0x9266('0x2a')][_0x9266('0x48')](_0x2c73b)[_0x9266('0x23')](handleEntityNotFound(_0x3be47b,null))[_0x9266('0x23')](function(_0xa34f62){if(_0xa34f62){var _0x186bae=_0xa34f62[_0x9266('0x49')]({'plain':!![]});_0x186bae=qs[_0x9266('0x4a')](_0x186bae,['id',_0x9266('0x4b'),_0x9266('0x4c')]);_0x243077['body']=_[_0x9266('0x4a')](_0x243077[_0x9266('0x4d')],['id','createdAt','updatedAt']);return db[_0x9266('0x2a')][_0x9266('0x4e')](_[_0x9266('0x3e')](_0x186bae,_0x243077[_0x9266('0x4d')]),{'include':_0x243077[_0x9266('0x30')][_0x9266('0x40')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x3be47b,0xc9))[_0x9266('0x44')](handleError(_0x3be47b,null));};exports[_0x9266('0x22')]=function(_0x1f02bd,_0x4564fa){if(_0x1f02bd[_0x9266('0x4d')]['id']){delete _0x1f02bd[_0x9266('0x4d')]['id'];}return db[_0x9266('0x2a')][_0x9266('0x48')]({'where':{'id':_0x1f02bd['params']['id']}})[_0x9266('0x23')](handleEntityNotFound(_0x4564fa,null))[_0x9266('0x23')](saveUpdates(_0x1f02bd[_0x9266('0x4d')],null))[_0x9266('0x23')](respondWithResult(_0x4564fa,null))[_0x9266('0x44')](handleError(_0x4564fa,null));};exports[_0x9266('0x24')]=function(_0x124922,_0x4adf7b){return db[_0x9266('0x2a')][_0x9266('0x48')]({'where':{'id':_0x124922[_0x9266('0x46')]['id']}})['then'](handleEntityNotFound(_0x4adf7b,null))[_0x9266('0x23')](removeEntity(_0x4adf7b,null))[_0x9266('0x44')](handleError(_0x4adf7b,null));};exports[_0x9266('0x4e')]=function(_0xea94c8,_0x368957,_0x35976f){_0xea94c8[_0x9266('0x4d')][_0x9266('0x27')]=_0xea94c8[_0x9266('0x4f')][_0x9266('0x50')];_0xea94c8[_0x9266('0x4d')][_0x9266('0x51')]=_0xea94c8[_0x9266('0x4f')][_0x9266('0x52')];_0xea94c8[_0x9266('0x4d')]['type']=_0xea94c8[_0x9266('0x4f')][_0x9266('0x53')];return db['Attachment'][_0x9266('0x4e')](_0xea94c8[_0x9266('0x4d')])[_0x9266('0x23')](respondWithResult(_0x368957,0xc9))['catch'](handleError(_0x368957,null));};exports[_0x9266('0x54')]=function(_0x1513be,_0x3863c4,_0x3fcc85){return db[_0x9266('0x2a')][_0x9266('0x55')]({'where':{'id':_0x1513be[_0x9266('0x46')]['id']},'raw':!![]})[_0x9266('0x23')](handleEntityNotFound(_0x3863c4,null))[_0x9266('0x23')](function(_0x2caf1d){if(_0x2caf1d){return _0x3863c4['download'](path[_0x9266('0x56')](config['root'],_0x9266('0x57'),_0x2caf1d[_0x9266('0x51')]));}})[_0x9266('0x44')](handleError(_0x3863c4,null));}; \ No newline at end of file +var _0xe4ba=['Content-Range','reject','save','destroy','then','sendStatus','stack','name','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','options','Attachment','include','findAll','rows','show','params','keys','includeAll','merge','catch','rawAttributes','get','omit','createdAt','updatedAt','body','create','find','file','originalname','filename','mimetype','download','join','root','basename','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','count','offset','set'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xe4ba,0x175));var _0xae4b=function(_0x346060,_0x1cab15){_0x346060=_0x346060-0x0;var _0x37289b=_0xe4ba[_0x346060];return _0x37289b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xae4b('0x0'));var rimraf=require(_0xae4b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae4b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xae4b('0x3'));var Mustache=require('mustache');var util=require(_0xae4b('0x4'));var path=require(_0xae4b('0x5'));var sox=require(_0xae4b('0x6'));var csv=require(_0xae4b('0x7'));var ejs=require(_0xae4b('0x8'));var fs=require('fs');var _=require(_0xae4b('0x9'));var squel=require(_0xae4b('0xa'));var crypto=require('crypto');var jsforce=require(_0xae4b('0xb'));var deskjs=require(_0xae4b('0xc'));var toCsv=require(_0xae4b('0x7'));var querystring=require(_0xae4b('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xae4b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xae4b('0xf'));var hardwareService=require(_0xae4b('0x10'));var logger=require(_0xae4b('0x11'))(_0xae4b('0x12'));var utils=require('../../config/utils');var config=require(_0xae4b('0x13'));var licenseUtil=require(_0xae4b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5692ed,_0x57e89b){_0x57e89b=_0x57e89b||0xcc;return function(_0x4d33ba){if(_0x4d33ba){return _0x5692ed['sendStatus'](_0x57e89b);}return _0x5692ed[_0xae4b('0x15')](_0x57e89b)[_0xae4b('0x16')]();};}function respondWithResult(_0x16b4b8,_0x360070){_0x360070=_0x360070||0xc8;return function(_0x46d02a){if(_0x46d02a){return _0x16b4b8['status'](_0x360070)[_0xae4b('0x17')](_0x46d02a);}};}function respondWithFilteredResult(_0xc8c213,_0x21cea0){return function(_0x4b6c81){if(_0x4b6c81){var _0x19d276=_0x4b6c81[_0xae4b('0x18')],_0x262075=_0x21cea0['offset'],_0x11ea2b=_0x21cea0[_0xae4b('0x19')]+_0x21cea0['limit'],_0x5d0819;if(_0x11ea2b>=_0x19d276){_0x11ea2b=_0x19d276;_0x5d0819=0xc8;}else{_0x5d0819=0xce;}_0xc8c213[_0xae4b('0x15')](_0x5d0819);return _0xc8c213[_0xae4b('0x1a')](_0xae4b('0x1b'),_0x262075+'-'+_0x11ea2b+'/'+_0x19d276)[_0xae4b('0x17')](_0x4b6c81);}return null;};}function patchUpdates(_0x4380df){return function(_0x1b8771){try{jsonpatch['apply'](_0x1b8771,_0x4380df,!![]);}catch(_0x3581a8){return BPromise[_0xae4b('0x1c')](_0x3581a8);}return _0x1b8771[_0xae4b('0x1d')]();};}function saveUpdates(_0x40e64e,_0xc30357){return function(_0x232602){if(_0x232602){return _0x232602['update'](_0x40e64e)['then'](function(_0x1b7ba6){return _0x1b7ba6;});}return null;};}function removeEntity(_0x3d3777,_0x10f23d){return function(_0xba3129){if(_0xba3129){return _0xba3129[_0xae4b('0x1e')]()[_0xae4b('0x1f')](function(){_0x3d3777[_0xae4b('0x15')](0xcc)[_0xae4b('0x16')]();});}};}function handleEntityNotFound(_0x4cdfc8,_0x2054e6){return function(_0x488563){if(!_0x488563){_0x4cdfc8[_0xae4b('0x20')](0x194);}return _0x488563;};}function handleError(_0x5215cd,_0x4c08da){_0x4c08da=_0x4c08da||0x1f4;return function(_0x105ea5){logger['error'](_0x105ea5[_0xae4b('0x21')]);if(_0x105ea5['name']){delete _0x105ea5[_0xae4b('0x22')];}_0x5215cd['status'](_0x4c08da)['send'](_0x105ea5);};}exports['index']=function(_0x2d366e,_0x12d4fa){var _0x355db6={},_0x5bcd3a={},_0x358e17={'count':0x0,'rows':[]};var _0x1133de=_['map'](db['Attachment']['rawAttributes'],function(_0x498aee){return{'name':_0x498aee[_0xae4b('0x23')],'type':_0x498aee[_0xae4b('0x24')][_0xae4b('0x25')]};});_0x5bcd3a['model']=_[_0xae4b('0x26')](_0x1133de,_0xae4b('0x22'));_0x5bcd3a[_0xae4b('0x27')]=_['keys'](_0x2d366e[_0xae4b('0x27')]);_0x5bcd3a[_0xae4b('0x28')]=_[_0xae4b('0x29')](_0x5bcd3a[_0xae4b('0x2a')],_0x5bcd3a[_0xae4b('0x27')]);_0x355db6['attributes']=_[_0xae4b('0x29')](_0x5bcd3a[_0xae4b('0x2a')],qs['fields'](_0x2d366e[_0xae4b('0x27')][_0xae4b('0x2b')]));_0x355db6[_0xae4b('0x2c')]=_0x355db6[_0xae4b('0x2c')][_0xae4b('0x2d')]?_0x355db6[_0xae4b('0x2c')]:_0x5bcd3a[_0xae4b('0x2a')];if(!_0x2d366e[_0xae4b('0x27')][_0xae4b('0x2e')](_0xae4b('0x2f'))){_0x355db6[_0xae4b('0x30')]=qs['limit'](_0x2d366e['query'][_0xae4b('0x30')]);_0x355db6[_0xae4b('0x19')]=qs[_0xae4b('0x19')](_0x2d366e[_0xae4b('0x27')]['offset']);}_0x355db6['order']=qs[_0xae4b('0x31')](_0x2d366e['query'][_0xae4b('0x31')]);_0x355db6[_0xae4b('0x32')]=qs[_0xae4b('0x28')](_[_0xae4b('0x33')](_0x2d366e[_0xae4b('0x27')],_0x5bcd3a[_0xae4b('0x28')]),_0x1133de);if(_0x2d366e[_0xae4b('0x27')][_0xae4b('0x34')]){_0x355db6['where']=_['merge'](_0x355db6[_0xae4b('0x32')],{'$or':_[_0xae4b('0x26')](_0x1133de,function(_0x4fab8){if(_0x4fab8[_0xae4b('0x24')]!=='VIRTUAL'){var _0xe458fc={};_0xe458fc[_0x4fab8[_0xae4b('0x22')]]={'$like':'%'+_0x2d366e['query'][_0xae4b('0x34')]+'%'};return _0xe458fc;}})});}_0x355db6=_['merge']({},_0x355db6,_0x2d366e[_0xae4b('0x35')]);var _0xaf369d={'where':_0x355db6[_0xae4b('0x32')]};return db[_0xae4b('0x36')][_0xae4b('0x18')](_0xaf369d)[_0xae4b('0x1f')](function(_0x18b2d1){_0x358e17['count']=_0x18b2d1;if(_0x2d366e[_0xae4b('0x27')]['includeAll']){_0x355db6[_0xae4b('0x37')]=[{'all':!![]}];}return db[_0xae4b('0x36')][_0xae4b('0x38')](_0x355db6);})[_0xae4b('0x1f')](function(_0x17395b){_0x358e17[_0xae4b('0x39')]=_0x17395b;return _0x358e17;})[_0xae4b('0x1f')](respondWithFilteredResult(_0x12d4fa,_0x355db6))['catch'](handleError(_0x12d4fa,null));};exports[_0xae4b('0x3a')]=function(_0x13afbe,_0xbbab9){var _0x26dc54={'raw':!![],'where':{'id':_0x13afbe[_0xae4b('0x3b')]['id']}},_0x10d8fe={};_0x10d8fe[_0xae4b('0x2a')]=_['keys'](db['Attachment']['rawAttributes']);_0x10d8fe[_0xae4b('0x27')]=_[_0xae4b('0x3c')](_0x13afbe['query']);_0x10d8fe[_0xae4b('0x28')]=_[_0xae4b('0x29')](_0x10d8fe[_0xae4b('0x2a')],_0x10d8fe[_0xae4b('0x27')]);_0x26dc54[_0xae4b('0x2c')]=_[_0xae4b('0x29')](_0x10d8fe['model'],qs[_0xae4b('0x2b')](_0x13afbe[_0xae4b('0x27')][_0xae4b('0x2b')]));_0x26dc54[_0xae4b('0x2c')]=_0x26dc54[_0xae4b('0x2c')][_0xae4b('0x2d')]?_0x26dc54['attributes']:_0x10d8fe['model'];if(_0x13afbe[_0xae4b('0x27')][_0xae4b('0x3d')]){_0x26dc54[_0xae4b('0x37')]=[{'all':!![]}];}_0x26dc54=_[_0xae4b('0x3e')]({},_0x26dc54,_0x13afbe[_0xae4b('0x35')]);return db[_0xae4b('0x36')]['find'](_0x26dc54)[_0xae4b('0x1f')](handleEntityNotFound(_0xbbab9,null))[_0xae4b('0x1f')](respondWithResult(_0xbbab9,null))[_0xae4b('0x3f')](handleError(_0xbbab9,null));};exports['clone']=function(_0x44c252,_0x25c03a){var _0x54589d={'where':{'id':_0x44c252[_0xae4b('0x3b')]['id']}},_0xfd6faa={};_0xfd6faa[_0xae4b('0x2a')]=_[_0xae4b('0x3c')](db[_0xae4b('0x36')][_0xae4b('0x40')]);_0x54589d[_0xae4b('0x2c')]=_[_0xae4b('0x29')](_0xfd6faa[_0xae4b('0x2a')],qs[_0xae4b('0x2b')](_0x44c252['query'][_0xae4b('0x2b')]));_0x54589d[_0xae4b('0x2c')]=_0x54589d[_0xae4b('0x2c')][_0xae4b('0x2d')]?_0x54589d[_0xae4b('0x2c')]:_0xfd6faa['model'];if(_0x44c252[_0xae4b('0x27')]['includeAll']){_0x54589d[_0xae4b('0x37')]=[{'all':!![]}];}_0x54589d=_[_0xae4b('0x3e')]({},_0x54589d,_0x44c252[_0xae4b('0x35')]);return db[_0xae4b('0x36')]['find'](_0x54589d)[_0xae4b('0x1f')](handleEntityNotFound(_0x25c03a,null))[_0xae4b('0x1f')](function(_0x3dda1d){if(_0x3dda1d){var _0x3d0d5d=_0x3dda1d[_0xae4b('0x41')]({'plain':!![]});_0x3d0d5d=qs[_0xae4b('0x42')](_0x3d0d5d,['id',_0xae4b('0x43'),_0xae4b('0x44')]);_0x44c252[_0xae4b('0x45')]=_[_0xae4b('0x42')](_0x44c252[_0xae4b('0x45')],['id',_0xae4b('0x43'),_0xae4b('0x44')]);return db['Attachment'][_0xae4b('0x46')](_[_0xae4b('0x3e')](_0x3d0d5d,_0x44c252['body']),{'include':_0x44c252[_0xae4b('0x27')][_0xae4b('0x3d')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x25c03a,0xc9))[_0xae4b('0x3f')](handleError(_0x25c03a,null));};exports['update']=function(_0x564e6d,_0x4131a3){if(_0x564e6d[_0xae4b('0x45')]['id']){delete _0x564e6d[_0xae4b('0x45')]['id'];}return db[_0xae4b('0x36')][_0xae4b('0x47')]({'where':{'id':_0x564e6d[_0xae4b('0x3b')]['id']}})['then'](handleEntityNotFound(_0x4131a3,null))['then'](saveUpdates(_0x564e6d['body'],null))[_0xae4b('0x1f')](respondWithResult(_0x4131a3,null))['catch'](handleError(_0x4131a3,null));};exports[_0xae4b('0x1e')]=function(_0x551ef9,_0x2ce3db){return db[_0xae4b('0x36')]['find']({'where':{'id':_0x551ef9[_0xae4b('0x3b')]['id']}})[_0xae4b('0x1f')](handleEntityNotFound(_0x2ce3db,null))['then'](removeEntity(_0x2ce3db,null))[_0xae4b('0x3f')](handleError(_0x2ce3db,null));};exports['create']=function(_0x6bdce5,_0x53dbde,_0x5a4fed){_0x6bdce5['body'][_0xae4b('0x22')]=_0x6bdce5[_0xae4b('0x48')][_0xae4b('0x49')];_0x6bdce5['body']['basename']=_0x6bdce5[_0xae4b('0x48')][_0xae4b('0x4a')];_0x6bdce5['body'][_0xae4b('0x24')]=_0x6bdce5['file'][_0xae4b('0x4b')];return db[_0xae4b('0x36')][_0xae4b('0x46')](_0x6bdce5[_0xae4b('0x45')])[_0xae4b('0x1f')](respondWithResult(_0x53dbde,0xc9))[_0xae4b('0x3f')](handleError(_0x53dbde,null));};exports[_0xae4b('0x4c')]=function(_0x533e98,_0x21ba21,_0x21f5f3){return db[_0xae4b('0x36')]['findOne']({'where':{'id':_0x533e98[_0xae4b('0x3b')]['id']},'raw':!![]})[_0xae4b('0x1f')](handleEntityNotFound(_0x21ba21,null))[_0xae4b('0x1f')](function(_0x1b9445){if(_0x1b9445){return _0x21ba21[_0xae4b('0x4c')](path[_0xae4b('0x4d')](config[_0xae4b('0x4e')],'server/files/attachments/',_0x1b9445[_0xae4b('0x4f')]));}})[_0xae4b('0x3f')](handleError(_0x21ba21,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 0efdb0e..bc7c640 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 _0xf4ce=['Attachment','attachments','lodash','api','moment','bluebird','request-promise','define'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf4ce,0xf2));var _0xef4c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf4ce[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xef4c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xef4c('0x1'));var moment=require(_0xef4c('0x2'));var BPromise=require(_0xef4c('0x3'));var rp=require(_0xef4c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./attachment.attributes');module['exports']=function(_0x2488f4,_0x3e7b2a){return _0x2488f4[_0xef4c('0x5')](_0xef4c('0x6'),attributes,{'tableName':_0xef4c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa35e=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment'];(function(_0x5bdee0,_0x40b482){var _0x1a7f2f=function(_0x1ac279){while(--_0x1ac279){_0x5bdee0['push'](_0x5bdee0['shift']());}};_0x1a7f2f(++_0x40b482);}(_0xa35e,0x111));var _0xea35=function(_0x16e705,_0x3c1245){_0x16e705=_0x16e705-0x0;var _0x1008fd=_0xa35e[_0x16e705];return _0x1008fd;};'use strict';var _=require(_0xea35('0x0'));var util=require('util');var logger=require(_0xea35('0x1'))(_0xea35('0x2'));var moment=require(_0xea35('0x3'));var BPromise=require(_0xea35('0x4'));var rp=require(_0xea35('0x5'));var fs=require('fs');var path=require(_0xea35('0x6'));var rimraf=require(_0xea35('0x7'));var config=require(_0xea35('0x8'));var attributes=require(_0xea35('0x9'));module[_0xea35('0xa')]=function(_0x3d2b41,_0x3dc645){return _0x3d2b41[_0xea35('0xb')](_0xea35('0xc'),attributes,{'tableName':'attachments','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 2209e60..08289b9 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 _0x7998=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','Attachment,\x20%s,\x20%s','message','result','create','body','options','raw','CreateAttachment'];(function(_0x361235,_0x2fb387){var _0x2ec319=function(_0x56f177){while(--_0x56f177){_0x361235['push'](_0x361235['shift']());}};_0x2ec319(++_0x2fb387);}(_0x7998,0xa8));var _0x8799=function(_0x77a933,_0x1cdd24){_0x77a933=_0x77a933-0x0;var _0x9df572=_0x7998[_0x77a933];return _0x9df572;};'use strict';var _=require(_0x8799('0x0'));var util=require(_0x8799('0x1'));var moment=require('moment');var BPromise=require(_0x8799('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8799('0x3'));var db=require(_0x8799('0x4'))['db'];var utils=require(_0x8799('0x5'));var logger=require(_0x8799('0x6'))(_0x8799('0x7'));var config=require('../../config/environment');var jayson=require(_0x8799('0x8'));var client=jayson[_0x8799('0x9')][_0x8799('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42659d,_0x22f61f,_0xe8de9){return new BPromise(function(_0xc05043,_0x4634bd){return client[_0x8799('0xb')](_0x42659d,_0xe8de9)[_0x8799('0xc')](function(_0x392b67){logger[_0x8799('0xd')]('Attachment,\x20%s,\x20%s',_0x22f61f,_0x8799('0xe'));logger[_0x8799('0xf')](_0x8799('0x10'),_0x22f61f,_0x8799('0xe'),JSON[_0x8799('0x11')](_0x392b67));if(_0x392b67[_0x8799('0x12')]){if(_0x392b67[_0x8799('0x12')][_0x8799('0x13')]===0x1f4){logger[_0x8799('0x12')](_0x8799('0x14'),_0x22f61f,_0x392b67[_0x8799('0x12')][_0x8799('0x15')]);return _0x4634bd(_0x392b67[_0x8799('0x12')][_0x8799('0x15')]);}logger[_0x8799('0x12')](_0x8799('0x14'),_0x22f61f,_0x392b67[_0x8799('0x12')][_0x8799('0x15')]);return _0xc05043(_0x392b67[_0x8799('0x12')]['message']);}else{logger[_0x8799('0xd')](_0x8799('0x14'),_0x22f61f,_0x8799('0xe'));_0xc05043(_0x392b67[_0x8799('0x16')][_0x8799('0x15')]);}})['catch'](function(_0x59a812){logger[_0x8799('0x12')](_0x8799('0x14'),_0x22f61f,_0x59a812);_0x4634bd(_0x59a812);});});}exports['CreateAttachment']=function(_0x265ccd){var _0x4ff7e7=this;return new Promise(function(_0x3d8053,_0x321fce){return db['Attachment'][_0x8799('0x17')](_0x265ccd[_0x8799('0x18')],{'raw':_0x265ccd[_0x8799('0x19')]?_0x265ccd['options'][_0x8799('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4d1ce1){logger[_0x8799('0xd')]('CreateAttachment',_0x265ccd);logger[_0x8799('0xf')](_0x8799('0x1b'),_0x265ccd,JSON[_0x8799('0x11')](_0x4d1ce1));_0x3d8053(_0x4d1ce1);})['catch'](function(_0xb0fb7b){logger[_0x8799('0x12')](_0x8799('0x1b'),_0xb0fb7b['message'],_0x265ccd);_0x321fce(_0x4ff7e7[_0x8799('0x12')](0x1f4,_0xb0fb7b['message']));});});}; \ No newline at end of file +var _0x2015=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','Attachment,\x20%s,\x20%s','message','info','result','catch','CreateAttachment','Attachment','body','options'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x2015,0x1d0));var _0x5201=function(_0xce1b62,_0x3688c5){_0xce1b62=_0xce1b62-0x0;var _0x19aca0=_0x2015[_0xce1b62];return _0x19aca0;};'use strict';var _=require(_0x5201('0x0'));var util=require(_0x5201('0x1'));var moment=require(_0x5201('0x2'));var BPromise=require(_0x5201('0x3'));var rs=require(_0x5201('0x4'));var fs=require('fs');var Redis=require(_0x5201('0x5'));var db=require(_0x5201('0x6'))['db'];var utils=require(_0x5201('0x7'));var logger=require(_0x5201('0x8'))('rpc');var config=require(_0x5201('0x9'));var jayson=require(_0x5201('0xa'));var client=jayson[_0x5201('0xb')][_0x5201('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x803edf,_0x4d74c9,_0x126536){return new BPromise(function(_0x5e8883,_0x55b4b3){return client[_0x5201('0xd')](_0x803edf,_0x126536)[_0x5201('0xe')](function(_0x403f87){logger['info']('Attachment,\x20%s,\x20%s',_0x4d74c9,_0x5201('0xf'));logger[_0x5201('0x10')]('Attachment,\x20%s,\x20%s,\x20%s',_0x4d74c9,_0x5201('0xf'),JSON[_0x5201('0x11')](_0x403f87));if(_0x403f87[_0x5201('0x12')]){if(_0x403f87[_0x5201('0x12')][_0x5201('0x13')]===0x1f4){logger[_0x5201('0x12')](_0x5201('0x14'),_0x4d74c9,_0x403f87[_0x5201('0x12')][_0x5201('0x15')]);return _0x55b4b3(_0x403f87[_0x5201('0x12')][_0x5201('0x15')]);}logger[_0x5201('0x12')](_0x5201('0x14'),_0x4d74c9,_0x403f87[_0x5201('0x12')][_0x5201('0x15')]);return _0x5e8883(_0x403f87[_0x5201('0x12')][_0x5201('0x15')]);}else{logger[_0x5201('0x16')](_0x5201('0x14'),_0x4d74c9,'request\x20sent');_0x5e8883(_0x403f87[_0x5201('0x17')][_0x5201('0x15')]);}})[_0x5201('0x18')](function(_0x101888){logger[_0x5201('0x12')](_0x5201('0x14'),_0x4d74c9,_0x101888);_0x55b4b3(_0x101888);});});}exports[_0x5201('0x19')]=function(_0x3cca){var _0x3958b4=this;return new Promise(function(_0x14b376,_0x271f5f){return db[_0x5201('0x1a')]['create'](_0x3cca[_0x5201('0x1b')],{'raw':_0x3cca[_0x5201('0x1c')]?_0x3cca[_0x5201('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x5201('0xe')](function(_0x4bd62d){logger[_0x5201('0x16')](_0x5201('0x19'),_0x3cca);logger[_0x5201('0x10')](_0x5201('0x19'),_0x3cca,JSON[_0x5201('0x11')](_0x4bd62d));_0x14b376(_0x4bd62d);})[_0x5201('0x18')](function(_0x361e3f){logger['error']('CreateAttachment',_0x361e3f[_0x5201('0x15')],_0x3cca);_0x271f5f(_0x3958b4['error'](0x1f4,_0x361e3f[_0x5201('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index aec68a0..5cf2b10 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 _0xb846=['multer','connect-timeout','express','Router','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','show','/:id/download','clone','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','post','single','create','/:id','update','delete','destroy','exports'];(function(_0x3fbd8f,_0x27a986){var _0x416587=function(_0x89990e){while(--_0x89990e){_0x3fbd8f['push'](_0x3fbd8f['shift']());}};_0x416587(++_0x27a986);}(_0xb846,0x1d0));var _0x6b84=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xb846[_0x1d24eb];return _0x1dc576;};'use strict';var multer=require(_0x6b84('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6b84('0x1'));var express=require(_0x6b84('0x2'));var router=express[_0x6b84('0x3')]();var auth=require(_0x6b84('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6b84('0x5'));router[_0x6b84('0x6')]('/',auth[_0x6b84('0x7')](),controller[_0x6b84('0x8')]);router[_0x6b84('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x6b84('0x9')]);router['get'](_0x6b84('0xa'),auth[_0x6b84('0x7')](),controller['download']);router['post']('/:id/clone',auth[_0x6b84('0x7')](),controller[_0x6b84('0xb')]);var upload=multer({'storage':multer[_0x6b84('0xc')]({'destination':function(_0x4895a4,_0x4b8942,_0x4919cf){_0x4919cf(null,path[_0x6b84('0xd')](config[_0x6b84('0xe')],_0x6b84('0xf')));},'filename':function(_0xcffdaa,_0x306c51,_0x44543a){_0x44543a(null,util[_0x6b84('0x10')](_0x6b84('0x11'),Date[_0x6b84('0x12')](),_0x306c51[_0x6b84('0x13')][_0x6b84('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x6b84('0x15')]('/',upload[_0x6b84('0x16')]('file'),controller[_0x6b84('0x17')]);router['put'](_0x6b84('0x18'),auth[_0x6b84('0x7')](),controller[_0x6b84('0x19')]);router[_0x6b84('0x1a')](_0x6b84('0x18'),auth[_0x6b84('0x7')](),controller[_0x6b84('0x1b')]);module[_0x6b84('0x1c')]=router; \ No newline at end of file +var _0xb4c3=['file','create','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s','replace','single'];(function(_0x8b69e9,_0x1407f9){var _0x485d2d=function(_0x3b9ce1){while(--_0x3b9ce1){_0x8b69e9['push'](_0x8b69e9['shift']());}};_0x485d2d(++_0x1407f9);}(_0xb4c3,0x115));var _0x3b4c=function(_0xba33b6,_0x53e429){_0xba33b6=_0xba33b6-0x0;var _0x7ce659=_0xb4c3[_0xba33b6];return _0x7ce659;};'use strict';var multer=require(_0x3b4c('0x0'));var util=require('util');var path=require(_0x3b4c('0x1'));var timeout=require(_0x3b4c('0x2'));var express=require(_0x3b4c('0x3'));var router=express[_0x3b4c('0x4')]();var auth=require(_0x3b4c('0x5'));var interaction=require(_0x3b4c('0x6'));var config=require(_0x3b4c('0x7'));var controller=require('./attachment.controller');router[_0x3b4c('0x8')]('/',auth['isAuthenticated'](),controller[_0x3b4c('0x9')]);router[_0x3b4c('0x8')]('/:id',auth[_0x3b4c('0xa')](),controller[_0x3b4c('0xb')]);router[_0x3b4c('0x8')](_0x3b4c('0xc'),auth[_0x3b4c('0xa')](),controller[_0x3b4c('0xd')]);router[_0x3b4c('0xe')](_0x3b4c('0xf'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0x3b4c('0x10')]({'destination':function(_0x3288eb,_0x43ac72,_0x14cb65){_0x14cb65(null,path[_0x3b4c('0x11')](config['root'],_0x3b4c('0x12')));},'filename':function(_0x153500,_0x2e1f99,_0x2769f6){_0x2769f6(null,util[_0x3b4c('0x13')](_0x3b4c('0x14'),Date['now'](),_0x2e1f99['originalname'][_0x3b4c('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x3b4c('0xe')]('/',upload[_0x3b4c('0x16')](_0x3b4c('0x17')),controller[_0x3b4c('0x18')]);router[_0x3b4c('0x19')](_0x3b4c('0x1a'),auth[_0x3b4c('0xa')](),controller[_0x3b4c('0x1b')]);router[_0x3b4c('0x1c')](_0x3b4c('0x1a'),auth['isAuthenticated'](),controller[_0x3b4c('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 5af70c2..e1ca086 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 _0x507f=['../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile','email','callback','use','clientID','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','User','find','map','emails','value','admin','user','agent','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb'];(function(_0xc0d9bc,_0x2bd6be){var _0x32ff73=function(_0x28c592){while(--_0x28c592){_0xc0d9bc['push'](_0xc0d9bc['shift']());}};_0x32ff73(++_0x2bd6be);}(_0x507f,0x7b));var _0xf507=function(_0x4fb3ca,_0x50a89c){_0x4fb3ca=_0x4fb3ca-0x0;var _0x17e972=_0x507f[_0x4fb3ca];return _0x17e972;};'use strict';var _=require(_0xf507('0x0'));var passport=require(_0xf507('0x1'));var GoogleStrategy=require(_0xf507('0x2'))[_0xf507('0x3')];var moment=require(_0xf507('0x4'));var db=require(_0xf507('0x5'))['db'];var config=require(_0xf507('0x6'));var signToken=require(_0xf507('0x7'))[_0xf507('0x8')];var utils=require(_0xf507('0x9'));exports[_0xf507('0xa')]=passport[_0xf507('0xb')](_0xf507('0xc'),{'failureRedirect':_0xf507('0xd'),'scope':[_0xf507('0xe'),_0xf507('0xf')],'session':![]});exports[_0xf507('0x10')]=passport['authenticate'](_0xf507('0xc'),{'failureRedirect':_0xf507('0xd'),'session':![]});passport[_0xf507('0x11')](new GoogleStrategy({'clientID':config[_0xf507('0xc')]?config[_0xf507('0xc')][_0xf507('0x12')]:'id','clientSecret':config[_0xf507('0xc')]?config[_0xf507('0xc')]['clientSecret']:_0xf507('0x13'),'callbackURL':config[_0xf507('0xc')]?config[_0xf507('0xc')][_0xf507('0x14')]:''},function(_0x683e2d,_0x2ed3cc,_0x1ad3c9,_0x2d0ac2){var _0x33a805,_0x1c0154;return db[_0xf507('0x15')][_0xf507('0x16')]({'where':{'id':0x1},'attributes':[_0xf507('0x17'),_0xf507('0x18')],'raw':!![]})['then'](function(_0x2a7c8e){_0x33a805=_0x2a7c8e;return db[_0xf507('0x19')][_0xf507('0x1a')]({'where':{'email':_[_0xf507('0x1b')](_0x1ad3c9[_0xf507('0x1c')],_0xf507('0x1d')),'role':{'$or':[_0xf507('0x1e'),_0xf507('0x1f'),_0xf507('0x20')]}}});})[_0xf507('0x21')](function(_0x1cecea){_0x1c0154=_0x1cecea;if(_0x1c0154){if(_0x1c0154[_0xf507('0x22')]){return _0x2d0ac2(_0xf507('0x23'));}else if(_0x33a805[_0xf507('0x18')]>0x0){if(_0x1c0154[_0xf507('0x24')]){if(moment(_0x1c0154[_0xf507('0x25')])[_0xf507('0x26')](_0x33a805[_0xf507('0x18')],_0xf507('0x27'))>moment()){return _0x2d0ac2('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0xf507('0x28')](_0x1c0154,0x0,![],null)[_0xf507('0x21')](function(){return utils[_0xf507('0x29')](_0x1c0154);})[_0xf507('0x21')](function(){return _0x2d0ac2(null,_0x1c0154);});}}else{return utils[_0xf507('0x29')](_0x1c0154)[_0xf507('0x21')](function(){return _0x2d0ac2(null,_0x1c0154);});}}else{return utils[_0xf507('0x29')](_0x1c0154)['then'](function(){return _0x2d0ac2(null,_0x1c0154);});}}return _0x2d0ac2(_0xf507('0x23'));})[_0xf507('0x2a')](function(_0x1c1712){_0x2d0ac2(_0x1c1712);});})); \ No newline at end of file +var _0x21cd=['add','blockDuration','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../components/auth/service','authenticate','google','/login','profile','email','callback','use','clientSecret','secret','callbackURL','Setting','findOne','find','map','emails','value','user','agent','then','disabled','blocked','blockedAt'];(function(_0x4bb0eb,_0x598f72){var _0x1d8d8f=function(_0x323482){while(--_0x323482){_0x4bb0eb['push'](_0x4bb0eb['shift']());}};_0x1d8d8f(++_0x598f72);}(_0x21cd,0x1e2));var _0xd21c=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x21cd[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require('lodash');var passport=require(_0xd21c('0x0'));var GoogleStrategy=require(_0xd21c('0x1'))[_0xd21c('0x2')];var moment=require(_0xd21c('0x3'));var db=require(_0xd21c('0x4'))['db'];var config=require('../../config/environment');var signToken=require(_0xd21c('0x5'))['signToken'];var utils=require('../../config/utils');exports['login']=passport[_0xd21c('0x6')](_0xd21c('0x7'),{'failureRedirect':_0xd21c('0x8'),'scope':[_0xd21c('0x9'),_0xd21c('0xa')],'session':![]});exports[_0xd21c('0xb')]=passport[_0xd21c('0x6')]('google',{'failureRedirect':_0xd21c('0x8'),'session':![]});passport[_0xd21c('0xc')](new GoogleStrategy({'clientID':config[_0xd21c('0x7')]?config['google']['clientID']:'id','clientSecret':config['google']?config['google'][_0xd21c('0xd')]:_0xd21c('0xe'),'callbackURL':config[_0xd21c('0x7')]?config['google'][_0xd21c('0xf')]:''},function(_0x403771,_0x100037,_0x539b30,_0x3a6353){var _0x3f36c7,_0x228a78;return db[_0xd21c('0x10')][_0xd21c('0x11')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0x4742e0){_0x3f36c7=_0x4742e0;return db['User'][_0xd21c('0x12')]({'where':{'email':_[_0xd21c('0x13')](_0x539b30[_0xd21c('0x14')],_0xd21c('0x15')),'role':{'$or':['admin',_0xd21c('0x16'),_0xd21c('0x17')]}}});})[_0xd21c('0x18')](function(_0xc5b1e5){_0x228a78=_0xc5b1e5;if(_0x228a78){if(_0x228a78[_0xd21c('0x19')]){return _0x3a6353('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x3f36c7['blockDuration']>0x0){if(_0x228a78[_0xd21c('0x1a')]){if(moment(_0x228a78[_0xd21c('0x1b')])[_0xd21c('0x1c')](_0x3f36c7[_0xd21c('0x1d')],'minutes')>moment()){return _0x3a6353(_0xd21c('0x1e'));}else{return utils[_0xd21c('0x1f')](_0x228a78,0x0,![],null)['then'](function(){return utils[_0xd21c('0x20')](_0x228a78);})[_0xd21c('0x18')](function(){return _0x3a6353(null,_0x228a78);});}}else{return utils[_0xd21c('0x20')](_0x228a78)['then'](function(){return _0x3a6353(null,_0x228a78);});}}else{return utils[_0xd21c('0x20')](_0x228a78)['then'](function(){return _0x3a6353(null,_0x228a78);});}}return _0x3a6353(_0xd21c('0x1e'));})[_0xd21c('0x21')](function(_0xc93a15){_0x3a6353(_0xc93a15);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 857c194..e5f4776 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 _0x5db8=['../user/user.controller.js','../../components/auth/service','get','/callback','callback','isMiddleware','login','express','passport','Router'];(function(_0x3e2748,_0x1de417){var _0x172b9a=function(_0x285e34){while(--_0x285e34){_0x3e2748['push'](_0x3e2748['shift']());}};_0x172b9a(++_0x1de417);}(_0x5db8,0xbb));var _0x85db=function(_0x3a6922,_0xc728be){_0x3a6922=_0x3a6922-0x0;var _0x9c1b44=_0x5db8[_0x3a6922];return _0x9c1b44;};'use strict';var express=require(_0x85db('0x0'));var passport=require(_0x85db('0x1'));var router=express[_0x85db('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x85db('0x3'));var authService=require(_0x85db('0x4'));router[_0x85db('0x5')]('/',controller['login']);router['get'](_0x85db('0x6'),controller[_0x85db('0x7')],authService[_0x85db('0x8')],userController[_0x85db('0x9')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +var _0x8c99=['../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8c99,0x1a8));var _0x98c9=function(_0x5ad190,_0xd39c9e){_0x5ad190=_0x5ad190-0x0;var _0x518ed3=_0x8c99[_0x5ad190];return _0x518ed3;};'use strict';var express=require(_0x98c9('0x0'));var passport=require(_0x98c9('0x1'));var router=express[_0x98c9('0x2')]();var controller=require(_0x98c9('0x3'));var userController=require(_0x98c9('0x4'));var authService=require(_0x98c9('0x5'));router[_0x98c9('0x6')]('/',controller[_0x98c9('0x7')]);router[_0x98c9('0x6')](_0x98c9('0x8'),controller[_0x98c9('0x9')],authService[_0x98c9('0xa')],userController['login'],authService[_0x98c9('0xb')]);module[_0x98c9('0xc')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 22bdc6d..a5d24bb 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 _0x3d04=['headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','passwordHistoryLimit','resetPasswordExpires','Password\x20reset!','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','password','salt','role','disabled','blockedAt','loginAttempts','user','agent','then','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockDuration','clearBlockUser','add','minutes','catch','getLicense','MailAccount','find','email','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','authenticate','local','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','body','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'];(function(_0xa1ccb0,_0xea0e02){var _0x5cd561=function(_0x1a56a3){while(--_0x1a56a3){_0xa1ccb0['push'](_0xa1ccb0['shift']());}};_0x5cd561(++_0xea0e02);}(_0x3d04,0xbe));var _0x43d0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3d04[_0x5b644e];return _0x49c6bf;};'use strict';var util=require(_0x43d0('0x0'));var passport=require(_0x43d0('0x1'));var LocalStrategy=require(_0x43d0('0x2'))[_0x43d0('0x3')];var jayson=require(_0x43d0('0x4'));var _=require(_0x43d0('0x5'));var rs=require(_0x43d0('0x6'));var moment=require(_0x43d0('0x7'));var db=require('../../mysqldb')['db'];var authService=require(_0x43d0('0x8'));var utils=require(_0x43d0('0x9'));var client=jayson[_0x43d0('0xa')][_0x43d0('0xb')]({'port':0x232b});function localAuthenticate(_0x5e284f,_0x484271,_0x50919e,_0x5efb95){var _0x457550,_0x3344d3;return db[_0x43d0('0xc')][_0x43d0('0xd')]({'where':{'id':0x1},'attributes':[_0x43d0('0xe'),'blockDuration'],'raw':!![]})['then'](function(_0x198aa0){_0x457550=_0x198aa0;return _0x5e284f['findOne']({'attributes':['id','name',_0x43d0('0xf'),_0x43d0('0x10'),_0x43d0('0x11'),_0x43d0('0x12'),'blocked',_0x43d0('0x13'),_0x43d0('0x14')],'where':{'name':_0x484271,'role':{'$or':['admin',_0x43d0('0x15'),_0x43d0('0x16')]}}});})[_0x43d0('0x17')](function(_0x5ed340){if(!_0x5ed340||_0x5ed340&&_0x5ed340[_0x43d0('0x18')]!==_0x484271){throw new Error(_0x43d0('0x19'));}else{_0x3344d3=_0x5ed340;return _0x3344d3;}})[_0x43d0('0x17')](function(){_0x3344d3['authenticate'](_0x50919e,function(_0x257510,_0x357f87){var _0x44e6ec=_0x3344d3[_0x43d0('0x14')]+0x1;if(_0x257510){return _0x5efb95(_0x257510);}else if(!_0x357f87){if(_0x3344d3[_0x43d0('0x12')]){return _0x5efb95(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x457550['allowedLoginAttempts']>0x0){if(_0x3344d3[_0x43d0('0x1a')]){if(_0x457550[_0x43d0('0x1b')]>0x0){if(moment(_0x3344d3[_0x43d0('0x13')])['add'](_0x457550[_0x43d0('0x1b')],'minutes')>moment()){return _0x5efb95(null,![],{'message':_0x43d0('0x19')});}else{return utils[_0x43d0('0x1c')](_0x3344d3,_0x44e6ec,![],null)[_0x43d0('0x17')](function(){return _0x5efb95(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x5efb95(null,![],{'message':_0x43d0('0x19')});}}else{if(_0x44e6ec>=_0x457550[_0x43d0('0xe')]){return utils['clearBlockUser'](_0x3344d3,0x0,!![],moment())[_0x43d0('0x17')](function(){return _0x5efb95(null,![],{'message':_0x43d0('0x19')});});}else{return utils[_0x43d0('0x1c')](_0x3344d3,_0x44e6ec,![],null)[_0x43d0('0x17')](function(){return _0x5efb95(null,![],{'message':_0x43d0('0x19')});});}}}else{return _0x5efb95(null,![],{'message':_0x43d0('0x19')});}}else{if(_0x3344d3[_0x43d0('0x12')]){return _0x5efb95(null,![],{'message':_0x43d0('0x19')});}else if(_0x457550[_0x43d0('0xe')]>0x0){if(_0x3344d3[_0x43d0('0x1a')]){if(_0x457550[_0x43d0('0x1b')]>0x0){if(moment(_0x3344d3[_0x43d0('0x13')])[_0x43d0('0x1d')](_0x457550[_0x43d0('0x1b')],_0x43d0('0x1e'))>moment()){return _0x5efb95(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x43d0('0x1c')](_0x3344d3,0x0,![],null)[_0x43d0('0x17')](function(){return utils['getLicense'](_0x3344d3);})[_0x43d0('0x17')](function(){return _0x5efb95(null,_0x3344d3);});}}else{return _0x5efb95(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x43d0('0x1c')](_0x3344d3,0x0,![],null)[_0x43d0('0x17')](function(){return utils['getLicense'](_0x3344d3);})[_0x43d0('0x17')](function(){return _0x5efb95(null,_0x3344d3);})[_0x43d0('0x1f')](function(_0x5ac4c0){return _0x5efb95(null,![],_0x5ac4c0);});}}else{if(_0x3344d3[_0x43d0('0x1a')]){return _0x5efb95(null,![],{'message':_0x43d0('0x19')});}else{return utils[_0x43d0('0x20')](_0x3344d3)['then'](function(){return _0x5efb95(null,_0x3344d3);});}}}});})[_0x43d0('0x1f')](function(_0x38e89e){return _0x5efb95(null,![],_0x38e89e);});}function sendServiceMail(_0x2c4f3f){return db[_0x43d0('0x21')][_0x43d0('0x22')]({'where':{'service':!![]},'attributes':['id',_0x43d0('0x18'),_0x43d0('0x23')],'include':[{'model':db['MailServerOut'],'as':_0x43d0('0x24')}]})[_0x43d0('0x17')](function(_0x6bc471){if(!_0x6bc471){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x4bfce9={'tls':{'rejectUnauthorized':![]}};if(_0x6bc471['Smtp'][_0x43d0('0x25')]){_0x4bfce9[_0x43d0('0x25')]=_0x6bc471[_0x43d0('0x24')][_0x43d0('0x25')];}else{_0x4bfce9[_0x43d0('0x26')]=_0x6bc471[_0x43d0('0x24')]['host'];_0x4bfce9[_0x43d0('0x27')]=_0x6bc471[_0x43d0('0x24')][_0x43d0('0x27')];_0x4bfce9[_0x43d0('0x28')]=_0x6bc471[_0x43d0('0x24')][_0x43d0('0x28')];}if(_0x6bc471[_0x43d0('0x24')][_0x43d0('0x29')]){_0x4bfce9[_0x43d0('0x2a')]={'user':_0x6bc471[_0x43d0('0x24')][_0x43d0('0x15')],'pass':_0x6bc471['Smtp'][_0x43d0('0x2b')]};}var _0x1f1713={'account':_0x4bfce9,'message':_[_0x43d0('0x2c')]({'from':util[_0x43d0('0x2d')]('\x22%s\x22\x20<%s>',_0x6bc471[_0x43d0('0x18')],_0x6bc471['email']||_0x6bc471[_0x43d0('0x24')][_0x43d0('0x15')])},_0x2c4f3f)};return client['request'](_0x43d0('0x2e'),_0x1f1713);})[_0x43d0('0x17')](function(_0x2aea11){if(_0x2aea11[_0x43d0('0x2f')]){throw new Error(util[_0x43d0('0x2d')](_0x43d0('0x30'),_0x2aea11[_0x43d0('0x2f')][_0x43d0('0x31')]||JSON[_0x43d0('0x32')](_0x2aea11[_0x43d0('0x2f')])));}return!![];});}function handleError(_0x41ff64,_0x498334,_0x3afb3b){return _0x41ff64[_0x43d0('0x33')](_0x498334||0x1f4)[_0x43d0('0x34')]({'message':_0x3afb3b?_0x3afb3b[_0x43d0('0x31')]||_0x3afb3b:''});}exports[_0x43d0('0x35')]=function(_0x201453,_0x314360,_0xf5b750){passport[_0x43d0('0x36')](_0x43d0('0x37'),function(_0x235fb2,_0x1f0092,_0x19843c){var _0x9cfc45=_0x235fb2||_0x19843c;if(_0x9cfc45){return handleError(_0x314360,0x191,_0x9cfc45);}if(!_0x1f0092){return handleError(_0x314360,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x898576={'payload':{'id':_0x1f0092['id'],'role':_0x1f0092[_0x43d0('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x43d0('0x38')](_0x898576)[_0x43d0('0x17')](function(_0x227fc9){_0x314360[_0x43d0('0x39')]({'id':_0x1f0092['id'],'token':_0x227fc9,'statusCall':'','isAlreadyLogged':_0x1f0092[_0x43d0('0x3a')]});});}})(_0x201453,_0x314360,_0xf5b750);};exports[_0x43d0('0x3b')]=function(_0x4ae965,_0x5b536c,_0x45566a){if(!_0x4ae965['body']['email']){return handleError(_0x5b536c,0x1f4,{'message':_0x43d0('0x3c')});}var _0x56947e=rs[_0x43d0('0x3d')]();_0x4ae965['body'][_0x43d0('0x23')]=_0x4ae965['body'][_0x43d0('0x23')][_0x43d0('0x3e')]()[_0x43d0('0x3f')]();var _0x4e817e;return db[_0x43d0('0xc')]['findOne']({'where':{'id':0x1},'attributes':[_0x43d0('0xe'),'blockDuration'],'raw':!![]})['then'](function(_0x32fdcd){_0x4e817e=_0x32fdcd;return db[_0x43d0('0x40')]['find']({'where':{'email':_0x4ae965[_0x43d0('0x41')][_0x43d0('0x23')]}});})[_0x43d0('0x17')](function(_0x134586){if(!_0x134586){throw new Error(_0x43d0('0x42'));}if(_0x134586['disabled']){throw new Error(_0x43d0('0x43'));}if(_0x134586[_0x43d0('0x1a')]){if(moment(_0x134586[_0x43d0('0x13')])[_0x43d0('0x1d')](_0x4e817e['blockDuration'],_0x43d0('0x1e'))>moment()){throw new Error(_0x43d0('0x44'));}else{_0x134586[_0x43d0('0x1a')]=![];_0x134586[_0x43d0('0x13')]=null;}}_0x134586[_0x43d0('0x45')]=_0x56947e;_0x134586['resetPasswordExpires']=Date[_0x43d0('0x46')]()+0x36ee80;return _0x134586[_0x43d0('0x47')]();})['then'](function(){return sendServiceMail({'to':_0x4ae965[_0x43d0('0x41')][_0x43d0('0x23')],'subject':_0x43d0('0x48'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x43d0('0x49')+'https://'+_0x4ae965[_0x43d0('0x4a')]['host']+_0x43d0('0x4b')+_0x56947e+'\x0a\x0a'+_0x43d0('0x4c')});})[_0x43d0('0x17')](function(){_0x5b536c[_0x43d0('0x33')](0xc8)[_0x43d0('0x34')]({'message':'Reset\x20Email\x20sent!'});})[_0x43d0('0x1f')](function(_0x4bb2a0){return handleError(_0x5b536c,0x1f4,_0x4bb2a0);});};exports[_0x43d0('0x4d')]=function(_0x3e7392,_0xddcadc,_0x94df19){return db[_0x43d0('0x40')][_0x43d0('0x22')]({'where':{'resetPasswordToken':_0x3e7392[_0x43d0('0x4e')][_0x43d0('0x4f')],'resetPasswordExpires':{'$gt':Date[_0x43d0('0x46')]()}}})[_0x43d0('0x17')](function(_0x27affd){if(!_0x27affd){throw new Error(_0x43d0('0x50'));}return db['Setting'][_0x43d0('0xd')]({'attributes':['id',_0x43d0('0x51'),_0x43d0('0x52'),'passwordHistoryLimit']})[_0x43d0('0x17')](function(_0x5f229e){if(_0x5f229e['securePassword'])authService[_0x43d0('0x53')](_0x3e7392[_0x43d0('0x41')][_0x43d0('0xf')]);if(!_0x5f229e[_0x43d0('0x52')]||!_0x27affd[_0x43d0('0x54')])return _0x27affd;authService['validatePasswordHistory'](_0x3e7392['body'][_0x43d0('0xf')],_0x27affd['previousPasswords'],_0x5f229e[_0x43d0('0x55')]);return _0x27affd;})[_0x43d0('0x17')](function(){_0x27affd['password']=_0x3e7392['body']['password'];_0x27affd[_0x43d0('0x45')]=null;_0x27affd[_0x43d0('0x56')]=null;return _0x27affd[_0x43d0('0x47')]();});})[_0x43d0('0x17')](function(){_0xddcadc[_0x43d0('0x33')](0xc8)[_0x43d0('0x34')]({'message':_0x43d0('0x57')});})[_0x43d0('0x1f')](function(_0x366e44){return handleError(_0xddcadc,0x1f4,_0x366e44);});};passport['use'](new LocalStrategy({'usernameField':_0x43d0('0x18'),'passwordField':_0x43d0('0xf')},function(_0x2561c9,_0x33f91b,_0x44feea){return localAuthenticate(db[_0x43d0('0x40')],_0x2561c9,_0x33f91b,_0x44feea);})); \ No newline at end of file +var _0x323f=['merge','format','request','error','message','stringify','send','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','save','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','resetPasswordToken','Password\x20reset!','use','passport','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','user','pass'];(function(_0x39e8fd,_0x556307){var _0x353ca5=function(_0x15a443){while(--_0x15a443){_0x39e8fd['push'](_0x39e8fd['shift']());}};_0x353ca5(++_0x556307);}(_0x323f,0x1ee));var _0xf323=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x323f[_0x1ac595];return _0x455fff;};'use strict';var util=require('util');var passport=require(_0xf323('0x0'));var LocalStrategy=require('passport-local')[_0xf323('0x1')];var jayson=require(_0xf323('0x2'));var _=require(_0xf323('0x3'));var rs=require(_0xf323('0x4'));var moment=require(_0xf323('0x5'));var db=require(_0xf323('0x6'))['db'];var authService=require(_0xf323('0x7'));var utils=require(_0xf323('0x8'));var client=jayson[_0xf323('0x9')][_0xf323('0xa')]({'port':0x232b});function localAuthenticate(_0x5d7d60,_0xb9a667,_0x444cba,_0x1af70d){var _0x2c8271,_0x8abeac;return db[_0xf323('0xb')][_0xf323('0xc')]({'where':{'id':0x1},'attributes':[_0xf323('0xd'),_0xf323('0xe')],'raw':!![]})[_0xf323('0xf')](function(_0x22fd48){_0x2c8271=_0x22fd48;return _0x5d7d60[_0xf323('0xc')]({'attributes':['id',_0xf323('0x10'),_0xf323('0x11'),_0xf323('0x12'),_0xf323('0x13'),_0xf323('0x14'),'blocked',_0xf323('0x15'),_0xf323('0x16')],'where':{'name':_0xb9a667,'role':{'$or':[_0xf323('0x17'),'user',_0xf323('0x18')]}}});})[_0xf323('0xf')](function(_0x367db4){if(!_0x367db4||_0x367db4&&_0x367db4[_0xf323('0x10')]!==_0xb9a667){throw new Error(_0xf323('0x19'));}else{_0x8abeac=_0x367db4;return _0x8abeac;}})[_0xf323('0xf')](function(){_0x8abeac['authenticate'](_0x444cba,function(_0x4cc3ce,_0x874219){var _0x447517=_0x8abeac[_0xf323('0x16')]+0x1;if(_0x4cc3ce){return _0x1af70d(_0x4cc3ce);}else if(!_0x874219){if(_0x8abeac[_0xf323('0x14')]){return _0x1af70d(null,![],{'message':_0xf323('0x19')});}else if(_0x2c8271['allowedLoginAttempts']>0x0){if(_0x8abeac[_0xf323('0x1a')]){if(_0x2c8271[_0xf323('0xe')]>0x0){if(moment(_0x8abeac[_0xf323('0x15')])[_0xf323('0x1b')](_0x2c8271['blockDuration'],_0xf323('0x1c'))>moment()){return _0x1af70d(null,![],{'message':_0xf323('0x19')});}else{return utils[_0xf323('0x1d')](_0x8abeac,_0x447517,![],null)[_0xf323('0xf')](function(){return _0x1af70d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x1af70d(null,![],{'message':_0xf323('0x19')});}}else{if(_0x447517>=_0x2c8271[_0xf323('0xd')]){return utils['clearBlockUser'](_0x8abeac,0x0,!![],moment())[_0xf323('0xf')](function(){return _0x1af70d(null,![],{'message':_0xf323('0x19')});});}else{return utils[_0xf323('0x1d')](_0x8abeac,_0x447517,![],null)[_0xf323('0xf')](function(){return _0x1af70d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x1af70d(null,![],{'message':_0xf323('0x19')});}}else{if(_0x8abeac[_0xf323('0x14')]){return _0x1af70d(null,![],{'message':_0xf323('0x19')});}else if(_0x2c8271['allowedLoginAttempts']>0x0){if(_0x8abeac[_0xf323('0x1a')]){if(_0x2c8271[_0xf323('0xe')]>0x0){if(moment(_0x8abeac[_0xf323('0x15')])[_0xf323('0x1b')](_0x2c8271[_0xf323('0xe')],_0xf323('0x1c'))>moment()){return _0x1af70d(null,![],{'message':_0xf323('0x19')});}else{return utils[_0xf323('0x1d')](_0x8abeac,0x0,![],null)[_0xf323('0xf')](function(){return utils['getLicense'](_0x8abeac);})[_0xf323('0xf')](function(){return _0x1af70d(null,_0x8abeac);});}}else{return _0x1af70d(null,![],{'message':_0xf323('0x19')});}}else{return utils[_0xf323('0x1d')](_0x8abeac,0x0,![],null)[_0xf323('0xf')](function(){return utils[_0xf323('0x1e')](_0x8abeac);})[_0xf323('0xf')](function(){return _0x1af70d(null,_0x8abeac);})['catch'](function(_0x30ed93){return _0x1af70d(null,![],_0x30ed93);});}}else{if(_0x8abeac['blocked']){return _0x1af70d(null,![],{'message':_0xf323('0x19')});}else{return utils[_0xf323('0x1e')](_0x8abeac)['then'](function(){return _0x1af70d(null,_0x8abeac);});}}}});})[_0xf323('0x1f')](function(_0x3c95ce){return _0x1af70d(null,![],_0x3c95ce);});}function sendServiceMail(_0x2b6254){return db[_0xf323('0x20')][_0xf323('0x21')]({'where':{'service':!![]},'attributes':['id','name',_0xf323('0x22')],'include':[{'model':db[_0xf323('0x23')],'as':_0xf323('0x24')}]})[_0xf323('0xf')](function(_0x4260f3){if(!_0x4260f3){throw new Error(_0xf323('0x25'));}var _0x17cb4d={'tls':{'rejectUnauthorized':![]}};if(_0x4260f3[_0xf323('0x24')][_0xf323('0x26')]){_0x17cb4d['service']=_0x4260f3[_0xf323('0x24')][_0xf323('0x26')];}else{_0x17cb4d[_0xf323('0x27')]=_0x4260f3[_0xf323('0x24')][_0xf323('0x27')];_0x17cb4d['port']=_0x4260f3[_0xf323('0x24')][_0xf323('0x28')];_0x17cb4d[_0xf323('0x29')]=_0x4260f3[_0xf323('0x24')][_0xf323('0x29')];}if(_0x4260f3['Smtp'][_0xf323('0x2a')]){_0x17cb4d[_0xf323('0x2b')]={'user':_0x4260f3[_0xf323('0x24')][_0xf323('0x2c')],'pass':_0x4260f3['Smtp'][_0xf323('0x2d')]};}var _0x5658db={'account':_0x17cb4d,'message':_[_0xf323('0x2e')]({'from':util[_0xf323('0x2f')]('\x22%s\x22\x20<%s>',_0x4260f3[_0xf323('0x10')],_0x4260f3['email']||_0x4260f3[_0xf323('0x24')]['user'])},_0x2b6254)};return client[_0xf323('0x30')]('SendMail',_0x5658db);})[_0xf323('0xf')](function(_0x82a6ca){if(_0x82a6ca['error']){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x82a6ca[_0xf323('0x31')][_0xf323('0x32')]||JSON[_0xf323('0x33')](_0x82a6ca[_0xf323('0x31')])));}return!![];});}function handleError(_0x223fb7,_0x49e458,_0x54104a){return _0x223fb7['status'](_0x49e458||0x1f4)[_0xf323('0x34')]({'message':_0x54104a?_0x54104a['message']||_0x54104a:''});}exports[_0xf323('0x35')]=function(_0x47e7a2,_0x431bc,_0x1f7b34){passport[_0xf323('0x36')](_0xf323('0x37'),function(_0x325248,_0x48a6c4,_0x3d8ddb){var _0x3bbe02=_0x325248||_0x3d8ddb;if(_0x3bbe02){return handleError(_0x431bc,0x191,_0x3bbe02);}if(!_0x48a6c4){return handleError(_0x431bc,0x194,{'message':_0xf323('0x38')});}else{var _0x27ddcc={'payload':{'id':_0x48a6c4['id'],'role':_0x48a6c4[_0xf323('0x13')]},'options':{'expiresIn':0x15180}};return authService[_0xf323('0x39')](_0x27ddcc)[_0xf323('0xf')](function(_0x2dcb00){_0x431bc[_0xf323('0x3a')]({'id':_0x48a6c4['id'],'token':_0x2dcb00,'statusCall':'','isAlreadyLogged':_0x48a6c4[_0xf323('0x3b')]});});}})(_0x47e7a2,_0x431bc,_0x1f7b34);};exports[_0xf323('0x3c')]=function(_0x45287b,_0xc48a6e,_0x388d80){if(!_0x45287b[_0xf323('0x3d')][_0xf323('0x22')]){return handleError(_0xc48a6e,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x502114=rs[_0xf323('0x3e')]();_0x45287b[_0xf323('0x3d')][_0xf323('0x22')]=_0x45287b[_0xf323('0x3d')][_0xf323('0x22')][_0xf323('0x3f')]()[_0xf323('0x40')]();var _0x125047;return db[_0xf323('0xb')][_0xf323('0xc')]({'where':{'id':0x1},'attributes':[_0xf323('0xd'),_0xf323('0xe')],'raw':!![]})[_0xf323('0xf')](function(_0x48d4df){_0x125047=_0x48d4df;return db[_0xf323('0x41')]['find']({'where':{'email':_0x45287b['body'][_0xf323('0x22')]}});})['then'](function(_0x5ddb5b){if(!_0x5ddb5b){throw new Error(_0xf323('0x42'));}if(_0x5ddb5b[_0xf323('0x14')]){throw new Error(_0xf323('0x43'));}if(_0x5ddb5b[_0xf323('0x1a')]){if(moment(_0x5ddb5b[_0xf323('0x15')])[_0xf323('0x1b')](_0x125047[_0xf323('0xe')],_0xf323('0x1c'))>moment()){throw new Error(_0xf323('0x44'));}else{_0x5ddb5b[_0xf323('0x1a')]=![];_0x5ddb5b[_0xf323('0x15')]=null;}}_0x5ddb5b['resetPasswordToken']=_0x502114;_0x5ddb5b[_0xf323('0x45')]=Date['now']()+0x36ee80;return _0x5ddb5b[_0xf323('0x46')]();})[_0xf323('0xf')](function(){return sendServiceMail({'to':_0x45287b[_0xf323('0x3d')][_0xf323('0x22')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xf323('0x47')+'https://'+_0x45287b[_0xf323('0x48')]['host']+_0xf323('0x49')+_0x502114+'\x0a\x0a'+_0xf323('0x4a')});})['then'](function(){_0xc48a6e[_0xf323('0x4b')](0xc8)[_0xf323('0x34')]({'message':_0xf323('0x4c')});})[_0xf323('0x1f')](function(_0x1e50b3){return handleError(_0xc48a6e,0x1f4,_0x1e50b3);});};exports[_0xf323('0x4d')]=function(_0x34268e,_0x103cc9,_0x1cb5fa){return db[_0xf323('0x41')][_0xf323('0x21')]({'where':{'resetPasswordToken':_0x34268e[_0xf323('0x4e')][_0xf323('0x4f')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xf323('0xf')](function(_0x18ad3e){if(!_0x18ad3e){throw new Error(_0xf323('0x50'));}return db[_0xf323('0xb')][_0xf323('0xc')]({'attributes':['id',_0xf323('0x51'),'enforcePasswordHistory',_0xf323('0x52')]})[_0xf323('0xf')](function(_0x5caa1c){if(_0x5caa1c[_0xf323('0x51')])authService[_0xf323('0x53')](_0x34268e['body']['password']);if(!_0x5caa1c[_0xf323('0x54')]||!_0x18ad3e[_0xf323('0x55')])return _0x18ad3e;authService[_0xf323('0x56')](_0x34268e[_0xf323('0x3d')][_0xf323('0x11')],_0x18ad3e[_0xf323('0x55')],_0x5caa1c[_0xf323('0x52')]);return _0x18ad3e;})[_0xf323('0xf')](function(){_0x18ad3e['password']=_0x34268e[_0xf323('0x3d')][_0xf323('0x11')];_0x18ad3e[_0xf323('0x57')]=null;_0x18ad3e[_0xf323('0x45')]=null;return _0x18ad3e[_0xf323('0x46')]();});})[_0xf323('0xf')](function(){_0x103cc9[_0xf323('0x4b')](0xc8)['send']({'message':_0xf323('0x58')});})[_0xf323('0x1f')](function(_0x277aa0){return handleError(_0x103cc9,0x1f4,_0x277aa0);});};passport[_0xf323('0x59')](new LocalStrategy({'usernameField':_0xf323('0x10'),'passwordField':_0xf323('0x11')},function(_0x4621f2,_0x728994,_0x3f0cfe){return localAuthenticate(db['User'],_0x4621f2,_0x728994,_0x3f0cfe);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index dad859e..6952a14 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 _0xb013=['exports','express','Router','./authLocal.controller','login','post','forgot','/reset/:token','reset'];(function(_0x5b3615,_0xf8a555){var _0x1e4687=function(_0x11af50){while(--_0x11af50){_0x5b3615['push'](_0x5b3615['shift']());}};_0x1e4687(++_0xf8a555);}(_0xb013,0x91));var _0x3b01=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xb013[_0x17406a];return _0x1501ff;};'use strict';var express=require(_0x3b01('0x0'));var router=express[_0x3b01('0x1')]();var controller=require(_0x3b01('0x2'));router['post']('/',controller[_0x3b01('0x3')]);router[_0x3b01('0x4')]('/forgot',controller[_0x3b01('0x5')]);router['post'](_0x3b01('0x6'),controller[_0x3b01('0x7')]);module[_0x3b01('0x8')]=router; \ No newline at end of file +var _0x7cca=['/reset/:token','reset','exports','express','Router','login','post','/forgot','forgot'];(function(_0x1b406b,_0x67b0ce){var _0x29ad55=function(_0xc61d78){while(--_0xc61d78){_0x1b406b['push'](_0x1b406b['shift']());}};_0x29ad55(++_0x67b0ce);}(_0x7cca,0xff));var _0xa7cc=function(_0x2706ee,_0x122496){_0x2706ee=_0x2706ee-0x0;var _0x5d0e50=_0x7cca[_0x2706ee];return _0x5d0e50;};'use strict';var express=require(_0xa7cc('0x0'));var router=express[_0xa7cc('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller[_0xa7cc('0x2')]);router[_0xa7cc('0x3')](_0xa7cc('0x4'),controller[_0xa7cc('0x5')]);router[_0xa7cc('0x3')](_0xa7cc('0x6'),controller[_0xa7cc('0x7')]);module[_0xa7cc('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 2d099a1..34a75e3 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 _0xd32b=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0xd32b,0x93));var _0xbd32=function(_0x38ef3a,_0x3724e4){_0x38ef3a=_0x38ef3a-0x0;var _0x26da7c=_0xd32b[_0x38ef3a];return _0x26da7c;};'use strict';var Sequelize=require(_0xbd32('0x0'));module[_0xbd32('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xbd32('0x2')]},'description':{'type':Sequelize[_0xbd32('0x2')]},'status':{'type':Sequelize[_0xbd32('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xbd32('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x9bce=['STRING','INTEGER','sequelize'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x9bce,0x119));var _0xe9bc=function(_0x503476,_0x552f95){_0x503476=_0x503476-0x0;var _0x416471=_0x9bce[_0x503476];return _0x416471;};'use strict';var Sequelize=require(_0xe9bc('0x0'));module['exports']={'name':{'type':Sequelize[_0xe9bc('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xe9bc('0x1')]},'description':{'type':Sequelize[_0xe9bc('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe9bc('0x2')],'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 e0bfbc4..3779f9b 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 _0xa9e0=['apply','reject','save','update','destroy','then','name','send','map','Automation','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','hasOwnProperty','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range'];(function(_0x1e09e3,_0x2fdf9a){var _0x4b48cf=function(_0xfba438){while(--_0xfba438){_0x1e09e3['push'](_0x1e09e3['shift']());}};_0x4b48cf(++_0x2fdf9a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['Automation'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x46')][_0x0a9e('0x41')]({'where':{'id':_0x4f7240[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4ae14b,null))[_0x0a9e('0x22')](function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0a9e('0x45')](_0x4f7240[_0x0a9e('0x44')]['ids'],_['omit'](_0x4f7240['body'],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports['getConditions']=function(_0x2b69d9,_0x161aa7,_0x53d113){var _0x5a88da={};var _0x2ef381={};var _0x59c6ff;var _0x443e72;return db['Automation'][_0x0a9e('0x48')]({'where':{'id':_0x2b69d9[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x161aa7,null))['then'](function(_0x2f82da){if(_0x2f82da){_0x59c6ff=_0x2f82da;_0x2ef381[_0x0a9e('0x2a')]=_['keys'](db['Condition'][_0x0a9e('0x27')]);_0x2ef381[_0x0a9e('0x2b')]=_['keys'](_0x2b69d9[_0x0a9e('0x2b')]);_0x2ef381['filters']=_[_0x0a9e('0x2d')](_0x2ef381['model'],_0x2ef381[_0x0a9e('0x2b')]);_0x5a88da['attributes']=_['intersection'](_0x2ef381['model'],qs[_0x0a9e('0x2f')](_0x2b69d9['query'][_0x0a9e('0x2f')]));_0x5a88da[_0x0a9e('0x2e')]=_0x5a88da[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5a88da[_0x0a9e('0x2e')]:_0x2ef381[_0x0a9e('0x2a')];_0x5a88da[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x2b69d9['query'][_0x0a9e('0x33')]);_0x5a88da[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x49')](_0x2b69d9[_0x0a9e('0x2b')],_0x2ef381[_0x0a9e('0x2c')]));if(_0x2b69d9['query'][_0x0a9e('0x35')]){_0x5a88da[_0x0a9e('0x34')]=_['merge'](_0x5a88da[_0x0a9e('0x34')],{'$or':_['map'](_0x5a88da[_0x0a9e('0x2e')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x2b69d9['query'][_0x0a9e('0x35')]+'%'};return _0x4b3c1a;})});}_0x5a88da=_['merge']({},_0x5a88da,_0x2b69d9[_0x0a9e('0x40')]);return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})[_0x0a9e('0x22')](function(_0x7be420){if(_0x7be420){_0x443e72=_0x7be420[_0x0a9e('0x30')];if(!_0x2b69d9[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x5a88da['limit']=qs[_0x0a9e('0x1a')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x5a88da['offset']=qs[_0x0a9e('0x19')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){return _0x1d0dc8?{'count':_0x443e72,'rows':_0x1d0dc8}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x161aa7,null))['catch'](handleError(_0x161aa7,null));};exports[_0x0a9e('0x4b')]=function(_0x17e88c,_0x88dcbf,_0x409b29){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x17e88c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x88dcbf,null))[_0x0a9e('0x22')](function(_0x47bb43){if(_0x47bb43){return _0x47bb43[_0x0a9e('0x4b')](_0x17e88c['body']['ids'],_[_0x0a9e('0x4d')](_0x17e88c[_0x0a9e('0x44')],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x88dcbf,null))[_0x0a9e('0x42')](handleError(_0x88dcbf,null));};exports[_0x0a9e('0x4e')]=function(_0x387489,_0x54a37d,_0x2d7205){var _0x1cc4f3={};var _0x2e89b7={};var _0x19012b;var _0x2bbb86;return db[_0x0a9e('0x26')][_0x0a9e('0x48')]({'where':{'id':_0x387489[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x54a37d,null))[_0x0a9e('0x22')](function(_0x5150a4){if(_0x5150a4){_0x19012b=_0x5150a4;_0x2e89b7[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x4c')]['rawAttributes']);_0x2e89b7[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x387489['query']);_0x2e89b7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x2e89b7[_0x0a9e('0x2a')],_0x2e89b7[_0x0a9e('0x2b')]);_0x1cc4f3[_0x0a9e('0x2e')]=_['intersection'](_0x2e89b7['model'],qs['fields'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x1cc4f3[_0x0a9e('0x2e')]=_0x1cc4f3[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x1cc4f3[_0x0a9e('0x2e')]:_0x2e89b7[_0x0a9e('0x2a')];_0x1cc4f3[_0x0a9e('0x32')]=qs['sort'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x1cc4f3[_0x0a9e('0x34')]=qs['filters'](_[_0x0a9e('0x49')](_0x387489['query'],_0x2e89b7[_0x0a9e('0x2c')]));if(_0x387489[_0x0a9e('0x2b')]['filter']){_0x1cc4f3[_0x0a9e('0x34')]=_[_0x0a9e('0x37')](_0x1cc4f3[_0x0a9e('0x34')],{'$or':_[_0x0a9e('0x25')](_0x1cc4f3['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x2e9552;})});}_0x1cc4f3=_['merge']({},_0x1cc4f3,_0x387489[_0x0a9e('0x40')]);return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0x361b21){if(_0x361b21){_0x2bbb86=_0x361b21['length'];if(!_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x4f')](_0x0a9e('0x31'))){_0x1cc4f3[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x1cc4f3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0xe0749e){if(_0xe0749e){return _0xe0749e?{'count':_0x2bbb86,'rows':_0xe0749e}:null;}})['then'](respondWithResult(_0x54a37d,null))[_0x0a9e('0x42')](handleError(_0x54a37d,null));}; \ No newline at end of file +var _0xa9e0=['apply','reject','save','update','destroy','then','name','send','map','Automation','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','hasOwnProperty','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range'];(function(_0x256b0c,_0x78abcd){var _0x37da7c=function(_0x4f36e6){while(--_0x4f36e6){_0x256b0c['push'](_0x256b0c['shift']());}};_0x37da7c(++_0x78abcd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['Automation'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x46')][_0x0a9e('0x41')]({'where':{'id':_0x4f7240[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4ae14b,null))[_0x0a9e('0x22')](function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0a9e('0x45')](_0x4f7240[_0x0a9e('0x44')]['ids'],_['omit'](_0x4f7240['body'],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports['getConditions']=function(_0x2b69d9,_0x161aa7,_0x53d113){var _0x5a88da={};var _0x2ef381={};var _0x59c6ff;var _0x443e72;return db['Automation'][_0x0a9e('0x48')]({'where':{'id':_0x2b69d9[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x161aa7,null))['then'](function(_0x2f82da){if(_0x2f82da){_0x59c6ff=_0x2f82da;_0x2ef381[_0x0a9e('0x2a')]=_['keys'](db['Condition'][_0x0a9e('0x27')]);_0x2ef381[_0x0a9e('0x2b')]=_['keys'](_0x2b69d9[_0x0a9e('0x2b')]);_0x2ef381['filters']=_[_0x0a9e('0x2d')](_0x2ef381['model'],_0x2ef381[_0x0a9e('0x2b')]);_0x5a88da['attributes']=_['intersection'](_0x2ef381['model'],qs[_0x0a9e('0x2f')](_0x2b69d9['query'][_0x0a9e('0x2f')]));_0x5a88da[_0x0a9e('0x2e')]=_0x5a88da[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5a88da[_0x0a9e('0x2e')]:_0x2ef381[_0x0a9e('0x2a')];_0x5a88da[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x2b69d9['query'][_0x0a9e('0x33')]);_0x5a88da[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x49')](_0x2b69d9[_0x0a9e('0x2b')],_0x2ef381[_0x0a9e('0x2c')]));if(_0x2b69d9['query'][_0x0a9e('0x35')]){_0x5a88da[_0x0a9e('0x34')]=_['merge'](_0x5a88da[_0x0a9e('0x34')],{'$or':_['map'](_0x5a88da[_0x0a9e('0x2e')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x2b69d9['query'][_0x0a9e('0x35')]+'%'};return _0x4b3c1a;})});}_0x5a88da=_['merge']({},_0x5a88da,_0x2b69d9[_0x0a9e('0x40')]);return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})[_0x0a9e('0x22')](function(_0x7be420){if(_0x7be420){_0x443e72=_0x7be420[_0x0a9e('0x30')];if(!_0x2b69d9[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x5a88da['limit']=qs[_0x0a9e('0x1a')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x5a88da['offset']=qs[_0x0a9e('0x19')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){return _0x1d0dc8?{'count':_0x443e72,'rows':_0x1d0dc8}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x161aa7,null))['catch'](handleError(_0x161aa7,null));};exports[_0x0a9e('0x4b')]=function(_0x17e88c,_0x88dcbf,_0x409b29){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x17e88c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x88dcbf,null))[_0x0a9e('0x22')](function(_0x47bb43){if(_0x47bb43){return _0x47bb43[_0x0a9e('0x4b')](_0x17e88c['body']['ids'],_[_0x0a9e('0x4d')](_0x17e88c[_0x0a9e('0x44')],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x88dcbf,null))[_0x0a9e('0x42')](handleError(_0x88dcbf,null));};exports[_0x0a9e('0x4e')]=function(_0x387489,_0x54a37d,_0x2d7205){var _0x1cc4f3={};var _0x2e89b7={};var _0x19012b;var _0x2bbb86;return db[_0x0a9e('0x26')][_0x0a9e('0x48')]({'where':{'id':_0x387489[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x54a37d,null))[_0x0a9e('0x22')](function(_0x5150a4){if(_0x5150a4){_0x19012b=_0x5150a4;_0x2e89b7[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x4c')]['rawAttributes']);_0x2e89b7[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x387489['query']);_0x2e89b7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x2e89b7[_0x0a9e('0x2a')],_0x2e89b7[_0x0a9e('0x2b')]);_0x1cc4f3[_0x0a9e('0x2e')]=_['intersection'](_0x2e89b7['model'],qs['fields'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x1cc4f3[_0x0a9e('0x2e')]=_0x1cc4f3[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x1cc4f3[_0x0a9e('0x2e')]:_0x2e89b7[_0x0a9e('0x2a')];_0x1cc4f3[_0x0a9e('0x32')]=qs['sort'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x1cc4f3[_0x0a9e('0x34')]=qs['filters'](_[_0x0a9e('0x49')](_0x387489['query'],_0x2e89b7[_0x0a9e('0x2c')]));if(_0x387489[_0x0a9e('0x2b')]['filter']){_0x1cc4f3[_0x0a9e('0x34')]=_[_0x0a9e('0x37')](_0x1cc4f3[_0x0a9e('0x34')],{'$or':_[_0x0a9e('0x25')](_0x1cc4f3['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x2e9552;})});}_0x1cc4f3=_['merge']({},_0x1cc4f3,_0x387489[_0x0a9e('0x40')]);return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0x361b21){if(_0x361b21){_0x2bbb86=_0x361b21['length'];if(!_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x4f')](_0x0a9e('0x31'))){_0x1cc4f3[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x1cc4f3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0xe0749e){if(_0xe0749e){return _0xe0749e?{'count':_0x2bbb86,'rows':_0xe0749e}:null;}})['then'](respondWithResult(_0x54a37d,null))[_0x0a9e('0x42')](handleError(_0x54a37d,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 7a77762..0093699 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 _0xb1a6=['api','bluebird','request-promise','path','rimraf','exports','define','Automation','tools_automations','lodash','util','../../config/logger'];(function(_0x117495,_0x534730){var _0x34220c=function(_0x4e4194){while(--_0x4e4194){_0x117495['push'](_0x117495['shift']());}};_0x34220c(++_0x534730);}(_0xb1a6,0xbd));var _0x6b1a=function(_0x440202,_0x4d478f){_0x440202=_0x440202-0x0;var _0x422360=_0xb1a6[_0x440202];return _0x422360;};'use strict';var _=require(_0x6b1a('0x0'));var util=require(_0x6b1a('0x1'));var logger=require(_0x6b1a('0x2'))(_0x6b1a('0x3'));var moment=require('moment');var BPromise=require(_0x6b1a('0x4'));var rp=require(_0x6b1a('0x5'));var fs=require('fs');var path=require(_0x6b1a('0x6'));var rimraf=require(_0x6b1a('0x7'));var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0x6b1a('0x8')]=function(_0x5bae04,_0x35cbd0){return _0x5bae04[_0x6b1a('0x9')](_0x6b1a('0xa'),attributes,{'tableName':_0x6b1a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc17d=['exports','define','util','moment','bluebird','path','rimraf','./automation.attributes'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc17d,0x10a));var _0xdc17=function(_0x292deb,_0x7b3a71){_0x292deb=_0x292deb-0x0;var _0x4526fa=_0xc17d[_0x292deb];return _0x4526fa;};'use strict';var _=require('lodash');var util=require(_0xdc17('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xdc17('0x1'));var BPromise=require(_0xdc17('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc17('0x3'));var rimraf=require(_0xdc17('0x4'));var config=require('../../config/environment');var attributes=require(_0xdc17('0x5'));module[_0xdc17('0x6')]=function(_0x1c2238,_0x2801c5){return _0x1c2238[_0xdc17('0x7')]('Automation',attributes,{'tableName':'tools_automations','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 7f26118..e7ac037 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 _0xe443=['request','then','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','Automation,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x70b5a,_0x1d79f3){var _0x159fcc=function(_0x503d52){while(--_0x503d52){_0x70b5a['push'](_0x70b5a['shift']());}};_0x159fcc(++_0x1d79f3);}(_0xe443,0x14e));var _0x3e44=function(_0x92079f,_0x4bbaab){_0x92079f=_0x92079f-0x0;var _0x42c644=_0xe443[_0x92079f];return _0x42c644;};'use strict';var _=require(_0x3e44('0x0'));var util=require(_0x3e44('0x1'));var moment=require(_0x3e44('0x2'));var BPromise=require(_0x3e44('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e44('0x4'));var db=require(_0x3e44('0x5'))['db'];var utils=require(_0x3e44('0x6'));var logger=require(_0x3e44('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32087e,_0x270723,_0x3a1436){return new BPromise(function(_0x726b62,_0x356b2e){return client[_0x3e44('0x8')](_0x32087e,_0x3a1436)[_0x3e44('0x9')](function(_0x5bbeaf){logger['info']('Automation,\x20%s,\x20%s',_0x270723,_0x3e44('0xa'));logger['debug'](_0x3e44('0xb'),_0x270723,_0x3e44('0xa'),JSON[_0x3e44('0xc')](_0x5bbeaf));if(_0x5bbeaf[_0x3e44('0xd')]){if(_0x5bbeaf['error']['code']===0x1f4){logger[_0x3e44('0xd')]('Automation,\x20%s,\x20%s',_0x270723,_0x5bbeaf['error'][_0x3e44('0xe')]);return _0x356b2e(_0x5bbeaf['error'][_0x3e44('0xe')]);}logger[_0x3e44('0xd')](_0x3e44('0xf'),_0x270723,_0x5bbeaf[_0x3e44('0xd')][_0x3e44('0xe')]);return _0x726b62(_0x5bbeaf[_0x3e44('0xd')][_0x3e44('0xe')]);}else{logger[_0x3e44('0x10')](_0x3e44('0xf'),_0x270723,_0x3e44('0xa'));_0x726b62(_0x5bbeaf[_0x3e44('0x11')][_0x3e44('0xe')]);}})[_0x3e44('0x12')](function(_0x46ddbb){logger[_0x3e44('0xd')](_0x3e44('0xf'),_0x270723,_0x46ddbb);_0x356b2e(_0x46ddbb);});});} \ No newline at end of file +var _0xacc3=['Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Automation,\x20%s,\x20%s','debug'];(function(_0xc8db6b,_0x320abd){var _0x12cb81=function(_0x417540){while(--_0x417540){_0xc8db6b['push'](_0xc8db6b['shift']());}};_0x12cb81(++_0x320abd);}(_0xacc3,0x1a6));var _0x3acc=function(_0x35e8d6,_0x1179f3){_0x35e8d6=_0x35e8d6-0x0;var _0x2036cb=_0xacc3[_0x35e8d6];return _0x2036cb;};'use strict';var _=require(_0x3acc('0x0'));var util=require(_0x3acc('0x1'));var moment=require(_0x3acc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3acc('0x3'));var db=require(_0x3acc('0x4'))['db'];var utils=require(_0x3acc('0x5'));var logger=require(_0x3acc('0x6'))('rpc');var config=require(_0x3acc('0x7'));var jayson=require(_0x3acc('0x8'));var client=jayson[_0x3acc('0x9')][_0x3acc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f2adf,_0xa6323b,_0x5a33d4){return new BPromise(function(_0x2cc529,_0x1ad293){return client[_0x3acc('0xb')](_0x2f2adf,_0x5a33d4)[_0x3acc('0xc')](function(_0x1742cb){logger['info'](_0x3acc('0xd'),_0xa6323b,'request\x20sent');logger[_0x3acc('0xe')](_0x3acc('0xf'),_0xa6323b,_0x3acc('0x10'),JSON[_0x3acc('0x11')](_0x1742cb));if(_0x1742cb[_0x3acc('0x12')]){if(_0x1742cb['error'][_0x3acc('0x13')]===0x1f4){logger[_0x3acc('0x12')]('Automation,\x20%s,\x20%s',_0xa6323b,_0x1742cb[_0x3acc('0x12')][_0x3acc('0x14')]);return _0x1ad293(_0x1742cb[_0x3acc('0x12')][_0x3acc('0x14')]);}logger[_0x3acc('0x12')](_0x3acc('0xd'),_0xa6323b,_0x1742cb[_0x3acc('0x12')][_0x3acc('0x14')]);return _0x2cc529(_0x1742cb[_0x3acc('0x12')][_0x3acc('0x14')]);}else{logger['info'](_0x3acc('0xd'),_0xa6323b,'request\x20sent');_0x2cc529(_0x1742cb[_0x3acc('0x15')]['message']);}})[_0x3acc('0x16')](function(_0x4c33c6){logger[_0x3acc('0x12')]('Automation,\x20%s,\x20%s',_0xa6323b,_0x4c33c6);_0x1ad293(_0x4c33c6);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 28feda1..c0266b7 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 _0x13cc=['post','create','addActions','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id','isAuthenticated','show','/:id/conditions','getConditions','getActions'];(function(_0x60be97,_0x48d3ab){var _0x3a5714=function(_0x221274){while(--_0x221274){_0x60be97['push'](_0x60be97['shift']());}};_0x3a5714(++_0x48d3ab);}(_0x13cc,0x161));var _0xc13c=function(_0x474770,_0x5d4303){_0x474770=_0x474770-0x0;var _0x365f02=_0x13cc[_0x474770];return _0x365f02;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc13c('0x0'));var timeout=require(_0xc13c('0x1'));var express=require('express');var router=express[_0xc13c('0x2')]();var auth=require(_0xc13c('0x3'));var interaction=require(_0xc13c('0x4'));var config=require(_0xc13c('0x5'));var controller=require(_0xc13c('0x6'));router[_0xc13c('0x7')]('/',auth['isAuthenticated'](),controller[_0xc13c('0x8')]);router['get'](_0xc13c('0x9'),auth[_0xc13c('0xa')](),controller[_0xc13c('0xb')]);router[_0xc13c('0x7')](_0xc13c('0xc'),auth[_0xc13c('0xa')](),controller[_0xc13c('0xd')]);router['get']('/:id/actions',auth['isAuthenticated'](),controller[_0xc13c('0xe')]);router[_0xc13c('0xf')]('/',auth[_0xc13c('0xa')](),controller[_0xc13c('0x10')]);router[_0xc13c('0xf')]('/:id/conditions',auth[_0xc13c('0xa')](),controller['addConditions']);router[_0xc13c('0xf')]('/:id/actions',auth['isAuthenticated'](),controller[_0xc13c('0x11')]);router[_0xc13c('0x12')](_0xc13c('0x9'),auth[_0xc13c('0xa')](),controller[_0xc13c('0x13')]);router[_0xc13c('0x14')](_0xc13c('0x9'),auth[_0xc13c('0xa')](),controller[_0xc13c('0x15')]);module[_0xc13c('0x16')]=router; \ No newline at end of file +var _0xdcda=['destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','getConditions','getActions','post','create','/:id/actions','addActions','put','update'];(function(_0x47809f,_0x17a9d2){var _0x5bfd78=function(_0x36fc46){while(--_0x36fc46){_0x47809f['push'](_0x47809f['shift']());}};_0x5bfd78(++_0x17a9d2);}(_0xdcda,0xa3));var _0xadcd=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xdcda[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xadcd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xadcd('0x1'));var express=require(_0xadcd('0x2'));var router=express[_0xadcd('0x3')]();var auth=require(_0xadcd('0x4'));var interaction=require(_0xadcd('0x5'));var config=require(_0xadcd('0x6'));var controller=require(_0xadcd('0x7'));router[_0xadcd('0x8')]('/',auth[_0xadcd('0x9')](),controller[_0xadcd('0xa')]);router[_0xadcd('0x8')](_0xadcd('0xb'),auth[_0xadcd('0x9')](),controller[_0xadcd('0xc')]);router['get']('/:id/conditions',auth[_0xadcd('0x9')](),controller[_0xadcd('0xd')]);router['get']('/:id/actions',auth[_0xadcd('0x9')](),controller[_0xadcd('0xe')]);router[_0xadcd('0xf')]('/',auth['isAuthenticated'](),controller[_0xadcd('0x10')]);router[_0xadcd('0xf')]('/:id/conditions',auth['isAuthenticated'](),controller['addConditions']);router[_0xadcd('0xf')](_0xadcd('0x11'),auth['isAuthenticated'](),controller[_0xadcd('0x12')]);router[_0xadcd('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xadcd('0x14')]);router['delete'](_0xadcd('0xb'),auth[_0xadcd('0x9')](),controller[_0xadcd('0x15')]);module[_0xadcd('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 efccb14..79fac4f 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 _0xc5eb=['#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#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)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','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)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence'];(function(_0x4f30bc,_0x2af4c1){var _0x19ffc2=function(_0x3a6720){while(--_0x3a6720){_0x4f30bc['push'](_0x4f30bc['shift']());}};_0x19ffc2(++_0x2af4c1);}(_0xc5eb,0x82));var _0xbc5e=function(_0x419183,_0x2780c6){_0x419183=_0x419183-0x0;var _0x2547fb=_0xc5eb[_0x419183];return _0x2547fb;};'use strict';var Sequelize=require(_0xbc5e('0x0'));module[_0xbc5e('0x1')]={'name':{'type':Sequelize[_0xbc5e('0x2')],'unique':_0xbc5e('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xbc5e('0x4')]('ivr'),'allowNull':![],'defaultValue':_0xbc5e('0x5')},'description':{'type':Sequelize[_0xbc5e('0x2')]},'active':{'type':Sequelize[_0xbc5e('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xbc5e('0x7')](0x4)[_0xbc5e('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xbc5e('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xbc5e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xbc5e('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbc5e('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbc5e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbc5e('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xbc5e('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbc5e('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xbc5e('0x7')](0x3)[_0xbc5e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbc5e('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xbc5e('0x7')](0x5)[_0xbc5e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbc5e('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xbc5e('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xbc5e('0x7')](0x5)[_0xbc5e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbc5e('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xbc5e('0x10')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xbc5e('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0xbc5e('0x4')](_0xbc5e('0x12'),'never',_0xbc5e('0x13')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xbc5e('0x6')],'defaultValue':0x0,'comment':_0xbc5e('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0xbc5e('0x7')](0x9)[_0xbc5e('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xbc5e('0x15')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xbc5e('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xbc5e('0x7')](0x9)[_0xbc5e('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xbc5e('0x7')](0x9)[_0xbc5e('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbc5e('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xbc5e('0x7')](0x9)[_0xbc5e('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xbc5e('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xbc5e('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xbc5e('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xbc5e('0x7')](0x9)[_0xbc5e('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xbc5e('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xbc5e('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xbc5e('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xbc5e('0x7')](0x9)[_0xbc5e('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbc5e('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0xbc5e('0x4')](_0xbc5e('0x1c'),_0xbc5e('0x1d')),'defaultValue':_0xbc5e('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xbc5e('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbc5e('0x1e')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbc5e('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xbc5e('0x7')](0x3)[_0xbc5e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbc5e('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xbc5e('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbc5e('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0xbc5e('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbc5e('0x22')},'dialDropRetryFrequency':{'type':Sequelize[_0xbc5e('0x7')](0x5)[_0xbc5e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xbc5e('0x7')](0x3)[_0xbc5e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbc5e('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xbc5e('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbc5e('0x24')},'dialMachineMaxRetry':{'type':Sequelize[_0xbc5e('0x7')](0x3)[_0xbc5e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xbc5e('0x7')](0x5)[_0xbc5e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xbc5e('0x7')](0x3)[_0xbc5e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbc5e('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xbc5e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x8f9d=['Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','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','ENUM','ivr','STRING','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','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)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)'];(function(_0x480ce6,_0x3721a7){var _0x3683fc=function(_0x300e99){while(--_0x300e99){_0x480ce6['push'](_0x480ce6['shift']());}};_0x3683fc(++_0x3721a7);}(_0x8f9d,0xbf));var _0xd8f9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8f9d[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xd8f9('0x0'));module[_0xd8f9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd8f9('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd8f9('0x3')](_0xd8f9('0x4')),'allowNull':![],'defaultValue':_0xd8f9('0x4')},'description':{'type':Sequelize[_0xd8f9('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xd8f9('0x6')},'limitCalls':{'type':Sequelize[_0xd8f9('0x7')](0x4)[_0xd8f9('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xd8f9('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xd8f9('0x7')](0x3)[_0xd8f9('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8f9('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd8f9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd8f9('0x7')](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8f9('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xd8f9('0x7')](0x3)[_0xd8f9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xd8f9('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8f9('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd8f9('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd8f9('0x7')](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8f9('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xd8f9('0x7')](0x3)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd8f9('0xd')},'dialTimezone':{'type':Sequelize[_0xd8f9('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xd8f9('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xd8f9('0x3')](_0xd8f9('0xf'),_0xd8f9('0x10'),_0xd8f9('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xd8f9('0x12')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xd8f9('0x7')](0x9)[_0xd8f9('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd8f9('0x13')},'dialAMDGreeting':{'type':Sequelize[_0xd8f9('0x7')](0x9)[_0xd8f9('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd8f9('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd8f9('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd8f9('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd8f9('0x7')](0x9)[_0xd8f9('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd8f9('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xd8f9('0x7')](0x9)[_0xd8f9('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd8f9('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd8f9('0x7')](0x9)[_0xd8f9('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd8f9('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd8f9('0x7')](0x9)[_0xd8f9('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd8f9('0x7')](0x5)[_0xd8f9('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd8f9('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd8f9('0x7')](0x9)[_0xd8f9('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xd8f9('0x3')](_0xd8f9('0x1a'),_0xd8f9('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd8f9('0x7')](0x3)[_0xd8f9('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd8f9('0x1c')},'dialCutDigit':{'type':Sequelize[_0xd8f9('0x7')](0x3)[_0xd8f9('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd8f9('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd8f9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd8f9('0x7')](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xd8f9('0x7')](0x3)[_0xd8f9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8f9('0x1e')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8f9('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd8f9('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8f9('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd8f9('0x7')](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xd8f9('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8f9('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0xd8f9('0x7')](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8f9('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd8f9('0x7')](0x3)[_0xd8f9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd8f9('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd8f9('0x7')](0x5)[_0xd8f9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd8f9('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 5a4b52b..441aaa1 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 _0x9937=['key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Campaign','includeAll','include','findAll','rows','catch','rawAttributes','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','IvrCampaigns','getHoppers','findOne','CmHopper','hasOwnProperty','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','fromQuery','phone','scheduledAt','field','ContactId','CmListId','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','into','ListId','ListId\x20=\x20?','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','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','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','name','index','map','fieldName','type'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x9937,0x164));var _0x7993=function(_0x15f193,_0xb098de){_0x15f193=_0x15f193-0x0;var _0x419705=_0x9937[_0x15f193];return _0x419705;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7993('0x0'));var rimraf=require(_0x7993('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7993('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7993('0x3'));var Mustache=require('mustache');var util=require(_0x7993('0x4'));var path=require(_0x7993('0x5'));var sox=require(_0x7993('0x6'));var csv=require(_0x7993('0x7'));var ejs=require(_0x7993('0x8'));var fs=require('fs');var _=require(_0x7993('0x9'));var squel=require(_0x7993('0xa'));var crypto=require(_0x7993('0xb'));var jsforce=require(_0x7993('0xc'));var deskjs=require(_0x7993('0xd'));var toCsv=require(_0x7993('0x7'));var querystring=require(_0x7993('0xe'));var Papa=require(_0x7993('0xf'));var Redis=require(_0x7993('0x10'));var authService=require(_0x7993('0x11'));var qs=require(_0x7993('0x12'));var as=require(_0x7993('0x13'));var hardwareService=require(_0x7993('0x14'));var logger=require(_0x7993('0x15'))('api');var utils=require(_0x7993('0x16'));var config=require(_0x7993('0x17'));var licenseUtil=require(_0x7993('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x114fdf,_0x3da2fa){_0x3da2fa=_0x3da2fa||0xcc;return function(_0x3fa3f3){if(_0x3fa3f3){return _0x114fdf[_0x7993('0x19')](_0x3da2fa);}return _0x114fdf[_0x7993('0x1a')](_0x3da2fa)[_0x7993('0x1b')]();};}function respondWithResult(_0x3a775e,_0x4dd7d2){_0x4dd7d2=_0x4dd7d2||0xc8;return function(_0x478d8e){if(_0x478d8e){return _0x3a775e[_0x7993('0x1a')](_0x4dd7d2)['json'](_0x478d8e);}};}function respondWithFilteredResult(_0x5a390c,_0x4b193e){return function(_0x8ee169){if(_0x8ee169){var _0x4e2d00=_0x8ee169[_0x7993('0x1c')],_0x57c9c3=_0x4b193e[_0x7993('0x1d')],_0x429364=_0x4b193e[_0x7993('0x1d')]+_0x4b193e[_0x7993('0x1e')],_0x3082ab;if(_0x429364>=_0x4e2d00){_0x429364=_0x4e2d00;_0x3082ab=0xc8;}else{_0x3082ab=0xce;}_0x5a390c[_0x7993('0x1a')](_0x3082ab);return _0x5a390c[_0x7993('0x1f')](_0x7993('0x20'),_0x57c9c3+'-'+_0x429364+'/'+_0x4e2d00)['json'](_0x8ee169);}return null;};}function patchUpdates(_0x2da64c){return function(_0x2f2c1f){try{jsonpatch['apply'](_0x2f2c1f,_0x2da64c,!![]);}catch(_0x5ea55b){return BPromise[_0x7993('0x21')](_0x5ea55b);}return _0x2f2c1f[_0x7993('0x22')]();};}function saveUpdates(_0x1ab5e4,_0x1e62eb){return function(_0x17e5e7){if(_0x17e5e7){return _0x17e5e7['update'](_0x1ab5e4)[_0x7993('0x23')](function(_0x4df238){return _0x4df238;});}return null;};}function removeEntity(_0x137b68,_0x214822){return function(_0xf10ce){if(_0xf10ce){return _0xf10ce[_0x7993('0x24')]()[_0x7993('0x23')](function(){var _0x53b069=_0xf10ce[_0x7993('0x25')]({'plain':!![]});var _0x4f7f64='IvrCampaigns';return db['UserProfileResource'][_0x7993('0x24')]({'where':{'type':_0x4f7f64,'resourceId':_0x53b069['id']}})[_0x7993('0x23')](function(){return _0xf10ce;});})[_0x7993('0x23')](function(){_0x137b68[_0x7993('0x1a')](0xcc)[_0x7993('0x1b')]();});}};}function handleEntityNotFound(_0x5ab3bf,_0x49c163){return function(_0x389aca){if(!_0x389aca){_0x5ab3bf[_0x7993('0x19')](0x194);}return _0x389aca;};}function handleError(_0x4934f1,_0x3d2dfc){_0x3d2dfc=_0x3d2dfc||0x1f4;return function(_0x494bd2){logger['error'](_0x494bd2['stack']);if(_0x494bd2[_0x7993('0x26')]){delete _0x494bd2['name'];}_0x4934f1['status'](_0x3d2dfc)['send'](_0x494bd2);};}exports[_0x7993('0x27')]=function(_0x3c77cd,_0xa1ccb1){var _0x50966d={},_0x212f85={},_0x3d6ca6={'count':0x0,'rows':[]};var _0x469f2d=_[_0x7993('0x28')](db['Campaign']['rawAttributes'],function(_0x595607){return{'name':_0x595607[_0x7993('0x29')],'type':_0x595607[_0x7993('0x2a')][_0x7993('0x2b')]};});_0x212f85[_0x7993('0x2c')]=_['map'](_0x469f2d,_0x7993('0x26'));_0x212f85['query']=_[_0x7993('0x2d')](_0x3c77cd[_0x7993('0x2e')]);_0x212f85[_0x7993('0x2f')]=_[_0x7993('0x30')](_0x212f85['model'],_0x212f85[_0x7993('0x2e')]);_0x50966d[_0x7993('0x31')]=_[_0x7993('0x30')](_0x212f85[_0x7993('0x2c')],qs[_0x7993('0x32')](_0x3c77cd[_0x7993('0x2e')][_0x7993('0x32')]));_0x50966d['attributes']=_0x50966d['attributes']['length']?_0x50966d[_0x7993('0x31')]:_0x212f85[_0x7993('0x2c')];if(!_0x3c77cd[_0x7993('0x2e')]['hasOwnProperty'](_0x7993('0x33'))){_0x50966d[_0x7993('0x1e')]=qs[_0x7993('0x1e')](_0x3c77cd[_0x7993('0x2e')][_0x7993('0x1e')]);_0x50966d[_0x7993('0x1d')]=qs[_0x7993('0x1d')](_0x3c77cd[_0x7993('0x2e')][_0x7993('0x1d')]);}_0x50966d[_0x7993('0x34')]=qs[_0x7993('0x35')](_0x3c77cd[_0x7993('0x2e')][_0x7993('0x35')]);_0x50966d[_0x7993('0x36')]=qs[_0x7993('0x2f')](_[_0x7993('0x37')](_0x3c77cd[_0x7993('0x2e')],_0x212f85[_0x7993('0x2f')]),_0x469f2d);if(_0x3c77cd[_0x7993('0x2e')][_0x7993('0x38')]){_0x50966d[_0x7993('0x36')]=_[_0x7993('0x39')](_0x50966d[_0x7993('0x36')],{'$or':_[_0x7993('0x28')](_0x469f2d,function(_0x7e4202){if(_0x7e4202[_0x7993('0x2a')]!==_0x7993('0x3a')){var _0x1e348b={};_0x1e348b[_0x7e4202['name']]={'$like':'%'+_0x3c77cd['query'][_0x7993('0x38')]+'%'};return _0x1e348b;}})});}_0x50966d=_[_0x7993('0x39')]({},_0x50966d,_0x3c77cd[_0x7993('0x3b')]);var _0x18d9f5={'where':_0x50966d[_0x7993('0x36')]};return db[_0x7993('0x3c')][_0x7993('0x1c')](_0x18d9f5)[_0x7993('0x23')](function(_0x2b47de){_0x3d6ca6['count']=_0x2b47de;if(_0x3c77cd[_0x7993('0x2e')][_0x7993('0x3d')]){_0x50966d[_0x7993('0x3e')]=[{'all':!![]}];}return db[_0x7993('0x3c')][_0x7993('0x3f')](_0x50966d);})[_0x7993('0x23')](function(_0xfeaed8){_0x3d6ca6[_0x7993('0x40')]=_0xfeaed8;return _0x3d6ca6;})[_0x7993('0x23')](respondWithFilteredResult(_0xa1ccb1,_0x50966d))[_0x7993('0x41')](handleError(_0xa1ccb1,null));};exports['show']=function(_0x2936d2,_0x59c158){var _0x497164={'raw':![],'where':{'id':_0x2936d2['params']['id']}},_0x5355ae={};_0x5355ae['model']=_[_0x7993('0x2d')](db[_0x7993('0x3c')][_0x7993('0x42')]);_0x5355ae[_0x7993('0x2e')]=_['keys'](_0x2936d2[_0x7993('0x2e')]);_0x5355ae[_0x7993('0x2f')]=_['intersection'](_0x5355ae[_0x7993('0x2c')],_0x5355ae[_0x7993('0x2e')]);_0x497164[_0x7993('0x31')]=_[_0x7993('0x30')](_0x5355ae[_0x7993('0x2c')],qs[_0x7993('0x32')](_0x2936d2[_0x7993('0x2e')][_0x7993('0x32')]));_0x497164[_0x7993('0x31')]=_0x497164[_0x7993('0x31')][_0x7993('0x43')]?_0x497164[_0x7993('0x31')]:_0x5355ae['model'];if(_0x2936d2[_0x7993('0x2e')]['includeAll']){_0x497164[_0x7993('0x3e')]=[{'all':!![]}];}_0x497164=_[_0x7993('0x39')]({},_0x497164,_0x2936d2[_0x7993('0x3b')]);return db[_0x7993('0x3c')][_0x7993('0x44')](_0x497164)['then'](handleEntityNotFound(_0x59c158,null))[_0x7993('0x23')](respondWithResult(_0x59c158,null))[_0x7993('0x41')](handleError(_0x59c158,null));};exports['create']=function(_0x2c23ee,_0x1ab172){return db[_0x7993('0x3c')]['create'](_0x2c23ee[_0x7993('0x45')],{})['then'](function(_0x34b5a5){var _0x1115a4=_0x2c23ee[_0x7993('0x46')]['get']({'plain':!![]});if(!_0x1115a4)throw new Error(_0x7993('0x47'));if(_0x1115a4[_0x7993('0x48')]==='user'){var _0x5dbb97=_0x34b5a5[_0x7993('0x25')]({'plain':!![]});var _0x9b44ba='IvrCampaigns';return db[_0x7993('0x49')]['find']({'where':{'name':_0x9b44ba,'userProfileId':_0x1115a4[_0x7993('0x4a')]},'raw':!![]})[_0x7993('0x23')](function(_0x1a6dd4){if(_0x1a6dd4&&_0x1a6dd4[_0x7993('0x4b')]===0x0){return db[_0x7993('0x4c')][_0x7993('0x4d')]({'name':_0x5dbb97[_0x7993('0x26')],'resourceId':_0x5dbb97['id'],'type':_0x1a6dd4[_0x7993('0x26')],'sectionId':_0x1a6dd4['id']},{})[_0x7993('0x23')](function(){return _0x34b5a5;});}else{return _0x34b5a5;}})[_0x7993('0x41')](function(_0x4b9ce4){logger[_0x7993('0x4e')](_0x7993('0x4f'),_0x4b9ce4);throw _0x4b9ce4;});}return _0x34b5a5;})['then'](respondWithResult(_0x1ab172,0xc9))['catch'](handleError(_0x1ab172,null));};exports[_0x7993('0x50')]=function(_0x53d939,_0x10ba52){var _0x371273={'where':{'id':_0x53d939[_0x7993('0x51')]['id']}},_0x4ac388={};_0x4ac388[_0x7993('0x2c')]=_[_0x7993('0x2d')](db[_0x7993('0x3c')][_0x7993('0x42')]);_0x371273[_0x7993('0x31')]=_[_0x7993('0x30')](_0x4ac388[_0x7993('0x2c')],qs[_0x7993('0x32')](_0x53d939[_0x7993('0x2e')]['fields']));_0x371273[_0x7993('0x31')]=_0x371273[_0x7993('0x31')][_0x7993('0x43')]?_0x371273[_0x7993('0x31')]:_0x4ac388[_0x7993('0x2c')];if(_0x53d939[_0x7993('0x2e')][_0x7993('0x3d')]){_0x371273[_0x7993('0x3e')]=[{'all':!![]}];}_0x371273=_[_0x7993('0x39')]({},_0x371273,_0x53d939[_0x7993('0x3b')]);return db[_0x7993('0x3c')][_0x7993('0x44')](_0x371273)[_0x7993('0x23')](handleEntityNotFound(_0x10ba52,null))['then'](function(_0x2374d4){if(_0x2374d4){var _0x33bb4e=_0x2374d4[_0x7993('0x25')]({'plain':!![]});_0x33bb4e=qs[_0x7993('0x52')](_0x33bb4e,['id',_0x7993('0x53'),_0x7993('0x54')]);_0x53d939[_0x7993('0x45')]=_['omit'](_0x53d939[_0x7993('0x45')],['id',_0x7993('0x53'),_0x7993('0x54')]);return db['Campaign'][_0x7993('0x4d')](_[_0x7993('0x39')](_0x33bb4e,_0x53d939[_0x7993('0x45')]),{'include':_0x53d939[_0x7993('0x2e')]['includeAll']?[{'all':!![]}]:undefined})[_0x7993('0x23')](function(_0x4fd196){var _0xd59447=_0x53d939[_0x7993('0x46')][_0x7993('0x25')]({'plain':!![]});if(!_0xd59447)throw new Error(_0x7993('0x47'));if(_0xd59447[_0x7993('0x48')]===_0x7993('0x46')){var _0x17a73f=_0x4fd196['get']({'plain':!![]});var _0x277ec3=_0x7993('0x55');return db[_0x7993('0x49')][_0x7993('0x44')]({'where':{'name':_0x277ec3,'userProfileId':_0xd59447[_0x7993('0x4a')]},'raw':!![]})[_0x7993('0x23')](function(_0x5c4687){if(_0x5c4687&&_0x5c4687[_0x7993('0x4b')]===0x0){return db[_0x7993('0x4c')]['create']({'name':_0x17a73f['name'],'resourceId':_0x17a73f['id'],'type':_0x5c4687[_0x7993('0x26')],'sectionId':_0x5c4687['id']},{})[_0x7993('0x23')](function(){return _0x4fd196;});}else{return _0x4fd196;}})[_0x7993('0x41')](function(_0x46bd89){logger[_0x7993('0x4e')](_0x7993('0x4f'),_0x46bd89);throw _0x46bd89;});}return _0x4fd196;});}})[_0x7993('0x23')](respondWithResult(_0x10ba52,0xc9))[_0x7993('0x41')](handleError(_0x10ba52,null));};exports['update']=function(_0x5bc045,_0x34db9d){if(_0x5bc045['body']['id']){delete _0x5bc045[_0x7993('0x45')]['id'];}return db['Campaign']['find']({'where':{'id':_0x5bc045[_0x7993('0x51')]['id']}})[_0x7993('0x23')](handleEntityNotFound(_0x34db9d,null))[_0x7993('0x23')](saveUpdates(_0x5bc045[_0x7993('0x45')],null))[_0x7993('0x23')](respondWithResult(_0x34db9d,null))[_0x7993('0x41')](handleError(_0x34db9d,null));};exports[_0x7993('0x24')]=function(_0x58894d,_0x224c88){return db[_0x7993('0x3c')]['find']({'where':{'id':_0x58894d['params']['id']}})[_0x7993('0x23')](handleEntityNotFound(_0x224c88,null))['then'](removeEntity(_0x224c88,null))[_0x7993('0x41')](handleError(_0x224c88,null));};exports[_0x7993('0x56')]=function(_0x7c575c,_0x5b6443,_0x698c32){var _0x24213a={'raw':!![],'where':{}};var _0x3b036c={};var _0x20e2c2={'count':0x0,'rows':[]};return db['Campaign'][_0x7993('0x57')]({'where':{'id':_0x7c575c[_0x7993('0x51')]['id']}})['then'](handleEntityNotFound(_0x5b6443,null))[_0x7993('0x23')](function(_0x45779b){if(_0x45779b){_0x3b036c[_0x7993('0x2c')]=_[_0x7993('0x2d')](db[_0x7993('0x58')][_0x7993('0x42')]);_0x3b036c[_0x7993('0x2e')]=_[_0x7993('0x2d')](_0x7c575c[_0x7993('0x2e')]);_0x3b036c[_0x7993('0x2f')]=_[_0x7993('0x30')](_0x3b036c[_0x7993('0x2c')],_0x3b036c['query']);_0x24213a[_0x7993('0x31')]=_['intersection'](_0x3b036c['model'],qs[_0x7993('0x32')](_0x7c575c[_0x7993('0x2e')][_0x7993('0x32')]));_0x24213a[_0x7993('0x31')]=_0x24213a[_0x7993('0x31')][_0x7993('0x43')]?_0x24213a['attributes']:_0x3b036c['model'];if(!_0x7c575c[_0x7993('0x2e')][_0x7993('0x59')]('nolimit')){_0x24213a['limit']=qs[_0x7993('0x1e')](_0x7c575c[_0x7993('0x2e')][_0x7993('0x1e')]);_0x24213a['offset']=qs[_0x7993('0x1d')](_0x7c575c[_0x7993('0x2e')][_0x7993('0x1d')]);}_0x24213a[_0x7993('0x34')]=qs[_0x7993('0x35')](_0x7c575c[_0x7993('0x2e')][_0x7993('0x35')]);_0x24213a[_0x7993('0x36')]=qs[_0x7993('0x2f')](_[_0x7993('0x37')](_0x7c575c['query'],_0x3b036c['filters']));_0x24213a[_0x7993('0x36')]['CampaignId']=_0x45779b['id'];if(_0x7c575c[_0x7993('0x2e')][_0x7993('0x38')]){_0x24213a[_0x7993('0x36')]=_[_0x7993('0x39')](_0x24213a[_0x7993('0x36')],{'$or':_[_0x7993('0x28')](_0x24213a['attributes'],function(_0xe0f7f){var _0x5e014c={};_0x5e014c[_0xe0f7f]={'$like':'%'+_0x7c575c['query']['filter']+'%'};return _0x5e014c;})});}_0x24213a=_['merge']({},_0x24213a,_0x7c575c[_0x7993('0x3b')]);return db[_0x7993('0x58')][_0x7993('0x1c')]({'where':_0x24213a[_0x7993('0x36')]})['then'](function(_0x380196){_0x20e2c2['count']=_0x380196;if(_0x7c575c[_0x7993('0x2e')][_0x7993('0x3d')]){_0x24213a[_0x7993('0x3e')]=[{'all':!![]}];}return db[_0x7993('0x58')][_0x7993('0x3f')](_0x24213a);})['then'](function(_0x139155){_0x20e2c2['rows']=_0x139155;return _0x20e2c2;});}})[_0x7993('0x23')](respondWithFilteredResult(_0x5b6443,_0x24213a))[_0x7993('0x41')](handleError(_0x5b6443,null));};exports['getHopperHistories']=function(_0x329c4e,_0x1f6c06,_0x3148f2){var _0x129ebf={'raw':!![],'where':{}};var _0x56a373={};var _0x1fe0e5={'count':0x0,'rows':[]};return db[_0x7993('0x3c')][_0x7993('0x57')]({'where':{'id':_0x329c4e[_0x7993('0x51')]['id']}})['then'](handleEntityNotFound(_0x1f6c06,null))[_0x7993('0x23')](function(_0x1f8109){if(_0x1f8109){_0x56a373[_0x7993('0x2c')]=_[_0x7993('0x2d')](db[_0x7993('0x5a')][_0x7993('0x42')]);_0x56a373[_0x7993('0x2e')]=_[_0x7993('0x2d')](_0x329c4e['query']);_0x56a373['filters']=_[_0x7993('0x30')](_0x56a373[_0x7993('0x2c')],_0x56a373[_0x7993('0x2e')]);_0x129ebf[_0x7993('0x31')]=_[_0x7993('0x30')](_0x56a373[_0x7993('0x2c')],qs[_0x7993('0x32')](_0x329c4e['query'][_0x7993('0x32')]));_0x129ebf[_0x7993('0x31')]=_0x129ebf['attributes'][_0x7993('0x43')]?_0x129ebf[_0x7993('0x31')]:_0x56a373[_0x7993('0x2c')];if(!_0x329c4e[_0x7993('0x2e')][_0x7993('0x59')](_0x7993('0x33'))){_0x129ebf[_0x7993('0x1e')]=qs[_0x7993('0x1e')](_0x329c4e['query'][_0x7993('0x1e')]);_0x129ebf['offset']=qs[_0x7993('0x1d')](_0x329c4e['query']['offset']);}_0x129ebf[_0x7993('0x34')]=qs[_0x7993('0x35')](_0x329c4e['query']['sort']);_0x129ebf[_0x7993('0x36')]=qs['filters'](_[_0x7993('0x37')](_0x329c4e[_0x7993('0x2e')],_0x56a373[_0x7993('0x2f')]));_0x129ebf[_0x7993('0x36')][_0x7993('0x5b')]=_0x1f8109['id'];if(_0x329c4e['query'][_0x7993('0x38')]){_0x129ebf[_0x7993('0x36')]=_[_0x7993('0x39')](_0x129ebf[_0x7993('0x36')],{'$or':_[_0x7993('0x28')](_0x129ebf[_0x7993('0x31')],function(_0x16c902){var _0x35a7ae={};_0x35a7ae[_0x16c902]={'$like':'%'+_0x329c4e[_0x7993('0x2e')]['filter']+'%'};return _0x35a7ae;})});}_0x129ebf=_[_0x7993('0x39')]({},_0x129ebf,_0x329c4e[_0x7993('0x3b')]);return db['CmHopperHistory'][_0x7993('0x1c')]({'where':_0x129ebf[_0x7993('0x36')]})['then'](function(_0x453139){_0x1fe0e5[_0x7993('0x1c')]=_0x453139;if(_0x329c4e[_0x7993('0x2e')][_0x7993('0x3d')]){_0x129ebf[_0x7993('0x3e')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x7993('0x3f')](_0x129ebf);})[_0x7993('0x23')](function(_0x5ae2c8){_0x1fe0e5[_0x7993('0x40')]=_0x5ae2c8;return _0x1fe0e5;});}})[_0x7993('0x23')](respondWithFilteredResult(_0x1f6c06,_0x129ebf))[_0x7993('0x41')](handleError(_0x1f6c06,null));};exports[_0x7993('0x5c')]=function(_0x1cff8a,_0x4e0af6,_0x13a904){var _0x45ea99={'raw':!![],'where':{}};var _0x5228f2={};var _0x304345={'count':0x0,'rows':[]};return db[_0x7993('0x3c')][_0x7993('0x57')]({'where':{'id':_0x1cff8a[_0x7993('0x51')]['id']}})[_0x7993('0x23')](handleEntityNotFound(_0x4e0af6,null))[_0x7993('0x23')](function(_0x358890){if(_0x358890){_0x5228f2['model']=_[_0x7993('0x2d')](db['CmHopperFinal'][_0x7993('0x42')]);_0x5228f2[_0x7993('0x2e')]=_[_0x7993('0x2d')](_0x1cff8a[_0x7993('0x2e')]);_0x5228f2[_0x7993('0x2f')]=_['intersection'](_0x5228f2[_0x7993('0x2c')],_0x5228f2[_0x7993('0x2e')]);_0x45ea99['attributes']=_[_0x7993('0x30')](_0x5228f2['model'],qs[_0x7993('0x32')](_0x1cff8a[_0x7993('0x2e')]['fields']));_0x45ea99[_0x7993('0x31')]=_0x45ea99[_0x7993('0x31')][_0x7993('0x43')]?_0x45ea99[_0x7993('0x31')]:_0x5228f2['model'];if(!_0x1cff8a[_0x7993('0x2e')]['hasOwnProperty'](_0x7993('0x33'))){_0x45ea99[_0x7993('0x1e')]=qs[_0x7993('0x1e')](_0x1cff8a['query']['limit']);_0x45ea99[_0x7993('0x1d')]=qs[_0x7993('0x1d')](_0x1cff8a[_0x7993('0x2e')]['offset']);}_0x45ea99[_0x7993('0x34')]=qs[_0x7993('0x35')](_0x1cff8a[_0x7993('0x2e')]['sort']);_0x45ea99['where']=qs[_0x7993('0x2f')](_[_0x7993('0x37')](_0x1cff8a[_0x7993('0x2e')],_0x5228f2[_0x7993('0x2f')]));_0x45ea99[_0x7993('0x36')][_0x7993('0x5b')]=_0x358890['id'];if(_0x1cff8a[_0x7993('0x2e')][_0x7993('0x38')]){_0x45ea99[_0x7993('0x36')]=_['merge'](_0x45ea99[_0x7993('0x36')],{'$or':_[_0x7993('0x28')](_0x45ea99[_0x7993('0x31')],function(_0xbdeb96){var _0x435234={};_0x435234[_0xbdeb96]={'$like':'%'+_0x1cff8a['query']['filter']+'%'};return _0x435234;})});}_0x45ea99=_[_0x7993('0x39')]({},_0x45ea99,_0x1cff8a[_0x7993('0x3b')]);return db['CmHopperFinal']['count']({'where':_0x45ea99[_0x7993('0x36')]})[_0x7993('0x23')](function(_0x4478d6){_0x304345['count']=_0x4478d6;if(_0x1cff8a[_0x7993('0x2e')][_0x7993('0x3d')]){_0x45ea99['include']=[{'all':!![]}];}return db[_0x7993('0x5d')][_0x7993('0x3f')](_0x45ea99);})[_0x7993('0x23')](function(_0x23d6a0){_0x304345[_0x7993('0x40')]=_0x23d6a0;return _0x304345;});}})['then'](respondWithFilteredResult(_0x4e0af6,_0x45ea99))[_0x7993('0x41')](handleError(_0x4e0af6,null));};exports[_0x7993('0x5e')]=function(_0x23a8d7,_0x5bb6c5,_0x49e8e6){var _0x57ad0d={'raw':!![],'where':{}};var _0x451dce={};var _0x5bda86={'count':0x0,'rows':[]};return db['Campaign'][_0x7993('0x57')]({'where':{'id':_0x23a8d7['params']['id']}})['then'](handleEntityNotFound(_0x5bb6c5,null))['then'](function(_0x35bc31){if(_0x35bc31){_0x451dce[_0x7993('0x2c')]=_[_0x7993('0x2d')](db[_0x7993('0x5f')]['rawAttributes']);_0x451dce[_0x7993('0x2e')]=_[_0x7993('0x2d')](_0x23a8d7[_0x7993('0x2e')]);_0x451dce[_0x7993('0x2f')]=_['intersection'](_0x451dce['model'],_0x451dce[_0x7993('0x2e')]);_0x57ad0d[_0x7993('0x31')]=_['intersection'](_0x451dce['model'],qs[_0x7993('0x32')](_0x23a8d7[_0x7993('0x2e')][_0x7993('0x32')]));_0x57ad0d[_0x7993('0x31')]=_0x57ad0d[_0x7993('0x31')][_0x7993('0x43')]?_0x57ad0d['attributes']:_0x451dce[_0x7993('0x2c')];if(!_0x23a8d7[_0x7993('0x2e')][_0x7993('0x59')](_0x7993('0x33'))){_0x57ad0d['limit']=qs[_0x7993('0x1e')](_0x23a8d7['query'][_0x7993('0x1e')]);_0x57ad0d['offset']=qs[_0x7993('0x1d')](_0x23a8d7['query']['offset']);}_0x57ad0d[_0x7993('0x34')]=qs['sort'](_0x23a8d7[_0x7993('0x2e')][_0x7993('0x35')]);_0x57ad0d[_0x7993('0x36')]=qs['filters'](_[_0x7993('0x37')](_0x23a8d7[_0x7993('0x2e')],_0x451dce[_0x7993('0x2f')]));_0x57ad0d[_0x7993('0x36')][_0x7993('0x5b')]=_0x35bc31['id'];if(_0x23a8d7[_0x7993('0x2e')][_0x7993('0x38')]){_0x57ad0d[_0x7993('0x36')]=_[_0x7993('0x39')](_0x57ad0d[_0x7993('0x36')],{'$or':_[_0x7993('0x28')](_0x57ad0d[_0x7993('0x31')],function(_0x5cd479){var _0x59d6e3={};_0x59d6e3[_0x5cd479]={'$like':'%'+_0x23a8d7[_0x7993('0x2e')][_0x7993('0x38')]+'%'};return _0x59d6e3;})});}_0x57ad0d=_[_0x7993('0x39')]({},_0x57ad0d,_0x23a8d7['options']);return db['CmHopperBlack'][_0x7993('0x1c')]({'where':_0x57ad0d[_0x7993('0x36')]})[_0x7993('0x23')](function(_0x4e24f8){_0x5bda86[_0x7993('0x1c')]=_0x4e24f8;if(_0x23a8d7[_0x7993('0x2e')]['includeAll']){_0x57ad0d[_0x7993('0x3e')]=[{'all':!![]}];}return db[_0x7993('0x5f')][_0x7993('0x3f')](_0x57ad0d);})[_0x7993('0x23')](function(_0x28dc66){_0x5bda86['rows']=_0x28dc66;return _0x5bda86;});}})[_0x7993('0x23')](respondWithFilteredResult(_0x5bb6c5,_0x57ad0d))[_0x7993('0x41')](handleError(_0x5bb6c5,null));};exports[_0x7993('0x60')]=function(_0x5daa19,_0x443aae,_0x5d7cb8){var _0x74e26a={};var _0x32f94d={};var _0x2026d1;var _0x46cc73;return db['Campaign'][_0x7993('0x57')]({'where':{'id':_0x5daa19['params']['id']}})[_0x7993('0x23')](handleEntityNotFound(_0x443aae,null))[_0x7993('0x23')](function(_0x10f9d2){if(_0x10f9d2){_0x2026d1=_0x10f9d2;_0x32f94d[_0x7993('0x2c')]=_[_0x7993('0x2d')](db[_0x7993('0x61')][_0x7993('0x42')]);_0x32f94d[_0x7993('0x2e')]=_['keys'](_0x5daa19['query']);_0x32f94d[_0x7993('0x2f')]=_[_0x7993('0x30')](_0x32f94d[_0x7993('0x2c')],_0x32f94d[_0x7993('0x2e')]);_0x74e26a[_0x7993('0x31')]=_[_0x7993('0x30')](_0x32f94d['model'],qs[_0x7993('0x32')](_0x5daa19[_0x7993('0x2e')]['fields']));_0x74e26a[_0x7993('0x31')]=_0x74e26a[_0x7993('0x31')][_0x7993('0x43')]?_0x74e26a[_0x7993('0x31')]:_0x32f94d[_0x7993('0x2c')];_0x74e26a[_0x7993('0x34')]=qs[_0x7993('0x35')](_0x5daa19['query'][_0x7993('0x35')]);_0x74e26a[_0x7993('0x36')]=qs[_0x7993('0x2f')](_[_0x7993('0x37')](_0x5daa19[_0x7993('0x2e')],_0x32f94d['filters']));if(_0x5daa19['query'][_0x7993('0x38')]){_0x74e26a['where']=_[_0x7993('0x39')](_0x74e26a[_0x7993('0x36')],{'$or':_[_0x7993('0x28')](_0x74e26a[_0x7993('0x31')],function(_0x490cdd){var _0x2350bb={};_0x2350bb[_0x490cdd]={'$like':'%'+_0x5daa19[_0x7993('0x2e')][_0x7993('0x38')]+'%'};return _0x2350bb;})});}_0x74e26a=_[_0x7993('0x39')]({},_0x74e26a,_0x5daa19['options']);return _0x2026d1[_0x7993('0x60')](_0x74e26a);}})[_0x7993('0x23')](function(_0x2ecef3){if(_0x2ecef3){_0x46cc73=_0x2ecef3['length'];if(!_0x5daa19[_0x7993('0x2e')][_0x7993('0x59')](_0x7993('0x33'))){_0x74e26a[_0x7993('0x1e')]=qs[_0x7993('0x1e')](_0x5daa19[_0x7993('0x2e')][_0x7993('0x1e')]);_0x74e26a[_0x7993('0x1d')]=qs['offset'](_0x5daa19[_0x7993('0x2e')][_0x7993('0x1d')]);}return _0x2026d1[_0x7993('0x60')](_0x74e26a);}})[_0x7993('0x23')](function(_0x5472a8){if(_0x5472a8){return _0x5472a8?{'count':_0x46cc73,'rows':_0x5472a8}:null;}})[_0x7993('0x23')](respondWithResult(_0x443aae,null))[_0x7993('0x41')](handleError(_0x443aae,null));};exports['addLists']=function(_0x56f7e1,_0x248345,_0x5cddc6){var _0x38a04e,_0x486660;return db[_0x7993('0x3c')]['find']({'where':{'id':_0x56f7e1[_0x7993('0x51')]['id']}})[_0x7993('0x23')](handleEntityNotFound(_0x248345,null))['then'](function(_0x438400){if(_0x438400){_0x486660=_0x438400;return _0x438400[_0x7993('0x62')](_0x56f7e1[_0x7993('0x45')][_0x7993('0x63')],_['omit'](_0x56f7e1[_0x7993('0x45')],[_0x7993('0x63'),'id'])||{});}return null;})[_0x7993('0x64')](function(_0x26c37a){var _0x53a7be;_0x38a04e=_0x26c37a||[];var _0x1ab29b=[];if(_0x26c37a){for(var _0x4664c1=0x0;_0x4664c1<_0x26c37a['length'];_0x4664c1+=0x1){var _0xdc3349=_0x26c37a[_0x4664c1]['get']({'plain':!![]});_0x486660[_0x7993('0x65')]=_0x56f7e1[_0x7993('0x45')]['dialCheckDuplicateType']?_0x56f7e1[_0x7993('0x45')][_0x7993('0x65')]:_0x486660[_0x7993('0x65')];switch(_0x486660[_0x7993('0x65')]){case _0x7993('0x66'):_0x53a7be=squel[_0x7993('0x67')]()['into']('cm_hopper')[_0x7993('0x68')]([_0x7993('0x69'),_0x7993('0x6a'),'ContactId','ListId',_0x7993('0x5b'),_0x7993('0x53'),_0x7993('0x54')],squel['select']()[_0x7993('0x6b')](_0x7993('0x69'),_0x7993('0x69'))[_0x7993('0x6b')]('NOW()','scheduledAt')[_0x7993('0x6b')]('id',_0x7993('0x6c'))[_0x7993('0x6b')](_0xdc3349[_0x7993('0x6d')][_0x7993('0x6e')](),'ListId')[_0x7993('0x6b')](_0x56f7e1[_0x7993('0x51')]['id']['toString'](),_0x7993('0x5b'))[_0x7993('0x6b')]('NOW()',_0x7993('0x53'))[_0x7993('0x6b')](_0x7993('0x6f'),'updatedAt')[_0x7993('0x70')](_0x7993('0x71'))[_0x7993('0x36')](_0x7993('0x72'))[_0x7993('0x36')]('ListId\x20=\x20?',_0xdc3349[_0x7993('0x6d')][_0x7993('0x6e')]())['where'](_0x7993('0x73'))[_0x7993('0x36')](_0x7993('0x74'),squel[_0x7993('0x75')]()[_0x7993('0x6b')]('COALESCE(calleridnum,\x27\x27)')[_0x7993('0x70')](_0x7993('0x76'))[_0x7993('0x36')](_0x7993('0x77'),_0x56f7e1['params']['id'][_0x7993('0x6e')]()))['where'](_0x7993('0x74'),squel['select']()[_0x7993('0x6b')](_0x7993('0x78'))[_0x7993('0x70')](_0x7993('0x79'))[_0x7993('0x36')](_0x7993('0x77'),_0x56f7e1[_0x7993('0x51')]['id'][_0x7993('0x6e')]())))[_0x7993('0x6e')]();break;case _0x7993('0x7a'):_0x53a7be=squel[_0x7993('0x67')]()[_0x7993('0x7b')]('cm_hopper')[_0x7993('0x68')]([_0x7993('0x69'),'scheduledAt',_0x7993('0x6c'),_0x7993('0x7c'),_0x7993('0x5b'),_0x7993('0x53'),_0x7993('0x54')],squel[_0x7993('0x75')]()[_0x7993('0x6b')]('phone',_0x7993('0x69'))[_0x7993('0x6b')](_0x7993('0x6f'),_0x7993('0x6a'))[_0x7993('0x6b')]('id','ContactId')[_0x7993('0x6b')](_0xdc3349['CmListId'][_0x7993('0x6e')](),'ListId')[_0x7993('0x6b')](_0x56f7e1[_0x7993('0x51')]['id'][_0x7993('0x6e')](),_0x7993('0x5b'))['field'](_0x7993('0x6f'),_0x7993('0x53'))[_0x7993('0x6b')](_0x7993('0x6f'),_0x7993('0x54'))[_0x7993('0x70')]('cm_contacts')[_0x7993('0x36')](_0x7993('0x72'))[_0x7993('0x36')]('ListId\x20=\x20?',_0xdc3349['CmListId'][_0x7993('0x6e')]())['where'](_0x7993('0x73'))[_0x7993('0x36')](_0x7993('0x74'),squel[_0x7993('0x75')]()['field']('COALESCE(phone,\x27\x27)')[_0x7993('0x70')](_0x7993('0x79'))[_0x7993('0x36')](_0x7993('0x77'),_0x56f7e1[_0x7993('0x51')]['id'][_0x7993('0x6e')]())))[_0x7993('0x6e')]();break;default:_0x53a7be=squel[_0x7993('0x67')]()[_0x7993('0x7b')](_0x7993('0x79'))['fromQuery']([_0x7993('0x69'),_0x7993('0x6a'),_0x7993('0x6c'),_0x7993('0x7c'),_0x7993('0x5b'),'createdAt','updatedAt'],squel[_0x7993('0x75')]()['field'](_0x7993('0x69'),_0x7993('0x69'))[_0x7993('0x6b')](_0x7993('0x6f'),'scheduledAt')['field']('id',_0x7993('0x6c'))['field'](_0xdc3349['CmListId'][_0x7993('0x6e')](),'ListId')['field'](_0x56f7e1[_0x7993('0x51')]['id']['toString'](),_0x7993('0x5b'))['field'](_0x7993('0x6f'),'createdAt')[_0x7993('0x6b')](_0x7993('0x6f'),'updatedAt')['from'](_0x7993('0x71'))[_0x7993('0x36')]('deletedAt\x20IS\x20NULL')[_0x7993('0x36')](_0x7993('0x7d'),_0xdc3349['CmListId'][_0x7993('0x6e')]())[_0x7993('0x36')](_0x7993('0x73')))[_0x7993('0x6e')]();}_0x1ab29b['push'](db[_0x7993('0x7e')]['query'](_0x53a7be));}return BPromise['all'](_0x1ab29b);}})[_0x7993('0x23')](function(){return _0x38a04e;})[_0x7993('0x23')](respondWithResult(_0x248345,null))[_0x7993('0x41')](handleError(_0x248345,null));};exports[_0x7993('0x7f')]=function(_0x315a45,_0x1a78a3,_0x3c159a){return db[_0x7993('0x3c')][_0x7993('0x44')]({'where':{'id':_0x315a45[_0x7993('0x51')]['id']}})[_0x7993('0x23')](handleEntityNotFound(_0x1a78a3,null))['then'](function(_0x51cb97){if(_0x51cb97){return _0x51cb97['removeLists'](_0x315a45[_0x7993('0x2e')][_0x7993('0x63')]);}})[_0x7993('0x23')](function(_0x27400a){if(_0x27400a){return db[_0x7993('0x58')][_0x7993('0x24')]({'where':{'ListId':_0x315a45[_0x7993('0x2e')][_0x7993('0x63')],'CampaignId':_0x315a45[_0x7993('0x51')]['id']}})['then'](function(){return _0x27400a;});}})[_0x7993('0x23')](respondWithStatusCode(_0x1a78a3,null))[_0x7993('0x41')](handleError(_0x1a78a3,null));};exports[_0x7993('0x80')]=function(_0x57a078,_0x58a35a,_0x22c0b2){var _0x3e5691={};var _0x5526b5={};var _0x18beb3;var _0x1ab2bb;return db[_0x7993('0x3c')][_0x7993('0x57')]({'where':{'id':_0x57a078[_0x7993('0x51')]['id']}})['then'](handleEntityNotFound(_0x58a35a,null))['then'](function(_0x3f74f4){if(_0x3f74f4){_0x18beb3=_0x3f74f4;_0x5526b5['model']=_[_0x7993('0x2d')](db[_0x7993('0x61')][_0x7993('0x42')]);_0x5526b5['query']=_[_0x7993('0x2d')](_0x57a078['query']);_0x5526b5[_0x7993('0x2f')]=_[_0x7993('0x30')](_0x5526b5[_0x7993('0x2c')],_0x5526b5[_0x7993('0x2e')]);_0x3e5691[_0x7993('0x31')]=_[_0x7993('0x30')](_0x5526b5[_0x7993('0x2c')],qs[_0x7993('0x32')](_0x57a078[_0x7993('0x2e')][_0x7993('0x32')]));_0x3e5691[_0x7993('0x31')]=_0x3e5691[_0x7993('0x31')][_0x7993('0x43')]?_0x3e5691[_0x7993('0x31')]:_0x5526b5['model'];_0x3e5691[_0x7993('0x34')]=qs[_0x7993('0x35')](_0x57a078[_0x7993('0x2e')][_0x7993('0x35')]);_0x3e5691[_0x7993('0x36')]=qs[_0x7993('0x2f')](_[_0x7993('0x37')](_0x57a078[_0x7993('0x2e')],_0x5526b5[_0x7993('0x2f')]));if(_0x57a078[_0x7993('0x2e')][_0x7993('0x38')]){_0x3e5691[_0x7993('0x36')]=_[_0x7993('0x39')](_0x3e5691[_0x7993('0x36')],{'$or':_[_0x7993('0x28')](_0x3e5691[_0x7993('0x31')],function(_0x4d8531){var _0x1740fc={};_0x1740fc[_0x4d8531]={'$like':'%'+_0x57a078['query'][_0x7993('0x38')]+'%'};return _0x1740fc;})});}_0x3e5691=_[_0x7993('0x39')]({},_0x3e5691,_0x57a078[_0x7993('0x3b')]);return _0x18beb3[_0x7993('0x80')](_0x3e5691);}})[_0x7993('0x23')](function(_0x1bba48){if(_0x1bba48){_0x1ab2bb=_0x1bba48[_0x7993('0x43')];if(!_0x57a078[_0x7993('0x2e')][_0x7993('0x59')](_0x7993('0x33'))){_0x3e5691[_0x7993('0x1e')]=qs[_0x7993('0x1e')](_0x57a078[_0x7993('0x2e')][_0x7993('0x1e')]);_0x3e5691[_0x7993('0x1d')]=qs[_0x7993('0x1d')](_0x57a078[_0x7993('0x2e')][_0x7993('0x1d')]);}return _0x18beb3[_0x7993('0x80')](_0x3e5691);}})[_0x7993('0x23')](function(_0x3d5146){if(_0x3d5146){return _0x3d5146?{'count':_0x1ab2bb,'rows':_0x3d5146}:null;}})[_0x7993('0x23')](respondWithResult(_0x58a35a,null))[_0x7993('0x41')](handleError(_0x58a35a,null));};exports[_0x7993('0x81')]=function(_0x4782f6,_0x556f1d,_0x5ab296){var _0x8d56b8,_0x450544;return db[_0x7993('0x3c')]['find']({'where':{'id':_0x4782f6[_0x7993('0x51')]['id']}})[_0x7993('0x23')](handleEntityNotFound(_0x556f1d,null))[_0x7993('0x23')](function(_0x49f339){if(_0x49f339){_0x450544=_0x49f339;return _0x49f339[_0x7993('0x81')](_0x4782f6[_0x7993('0x45')][_0x7993('0x63')],_['omit'](_0x4782f6[_0x7993('0x45')],[_0x7993('0x63'),'id'])||{});}return null;})['spread'](function(_0x153e4d){var _0x209f27;_0x8d56b8=_0x153e4d||[];var _0x3ac06d=[];if(_0x153e4d){for(var _0x5b64da=0x0;_0x5b64da<_0x153e4d['length'];_0x5b64da+=0x1){var _0x2fcb27=_0x153e4d[_0x5b64da][_0x7993('0x25')]({'plain':!![]});_0x209f27=squel[_0x7993('0x67')]()[_0x7993('0x7b')](_0x7993('0x82'))[_0x7993('0x68')]([_0x7993('0x69'),_0x7993('0x6c'),_0x7993('0x7c'),_0x7993('0x5b'),'createdAt','updatedAt'],squel['select']()[_0x7993('0x6b')](_0x7993('0x69'),_0x7993('0x69'))[_0x7993('0x6b')]('id','ContactId')['field'](_0x2fcb27[_0x7993('0x6d')][_0x7993('0x6e')](),'ListId')['field'](_0x4782f6[_0x7993('0x51')]['id'][_0x7993('0x6e')](),'CampaignId')[_0x7993('0x6b')](_0x7993('0x6f'),_0x7993('0x53'))[_0x7993('0x6b')](_0x7993('0x6f'),_0x7993('0x54'))[_0x7993('0x70')](_0x7993('0x71'))[_0x7993('0x36')](_0x7993('0x72'))['where'](_0x7993('0x7d'),_0x2fcb27[_0x7993('0x6d')][_0x7993('0x6e')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x7993('0x6e')]();_0x3ac06d['push'](db[_0x7993('0x7e')][_0x7993('0x2e')](_0x209f27));}return BPromise[_0x7993('0x83')](_0x3ac06d);}})[_0x7993('0x23')](function(){return _0x8d56b8;})[_0x7993('0x23')](respondWithResult(_0x556f1d,null))[_0x7993('0x41')](handleError(_0x556f1d,null));};exports[_0x7993('0x84')]=function(_0x18ef65,_0x18a2cc,_0x4d9fc3){return db[_0x7993('0x3c')][_0x7993('0x44')]({'where':{'id':_0x18ef65[_0x7993('0x51')]['id']}})[_0x7993('0x23')](handleEntityNotFound(_0x18a2cc,null))['then'](function(_0xd9a63f){if(_0xd9a63f){return _0xd9a63f['removeBlackLists'](_0x18ef65['query']['ids']);}})[_0x7993('0x23')](function(_0x2e6f5c){if(_0x2e6f5c){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x18ef65[_0x7993('0x2e')][_0x7993('0x63')],'CampaignId':_0x18ef65[_0x7993('0x51')]['id']}})[_0x7993('0x23')](function(){return _0x2e6f5c;});}})['then'](respondWithStatusCode(_0x18a2cc,null))[_0x7993('0x41')](handleError(_0x18a2cc,null));}; \ No newline at end of file +var _0x5cd5=['removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','IvrCampaigns','error','name','send','Campaign','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','clone','omit','createdAt','updatedAt','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','CampaignId','findAll','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','scheduledAt','push','all','removeLists','ids','getBlackLists','addBlackLists','spread','cm_hopper_black','fromQuery','sequelize'];(function(_0x1a5f67,_0x21d8d5){var _0x51f104=function(_0x21517e){while(--_0x21517e){_0x1a5f67['push'](_0x1a5f67['shift']());}};_0x51f104(++_0x21d8d5);}(_0x5cd5,0x10b));var _0x55cd=function(_0x2661f1,_0x1e0f14){_0x2661f1=_0x2661f1-0x0;var _0x44cead=_0x5cd5[_0x2661f1];return _0x44cead;};'use strict';var pdf=require(_0x55cd('0x0'));var emlformat=require(_0x55cd('0x1'));var rimraf=require(_0x55cd('0x2'));var zipdir=require(_0x55cd('0x3'));var jsonpatch=require(_0x55cd('0x4'));var rp=require(_0x55cd('0x5'));var moment=require('moment');var BPromise=require(_0x55cd('0x6'));var Mustache=require(_0x55cd('0x7'));var util=require(_0x55cd('0x8'));var path=require(_0x55cd('0x9'));var sox=require(_0x55cd('0xa'));var csv=require(_0x55cd('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x55cd('0xc'));var squel=require('squel');var crypto=require(_0x55cd('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x55cd('0xe'));var toCsv=require(_0x55cd('0xb'));var querystring=require(_0x55cd('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x55cd('0x10'));var qs=require(_0x55cd('0x11'));var as=require(_0x55cd('0x12'));var hardwareService=require(_0x55cd('0x13'));var logger=require(_0x55cd('0x14'))(_0x55cd('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x55cd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43b7f2,_0x2357fe){_0x2357fe=_0x2357fe||0xcc;return function(_0x5adcc2){if(_0x5adcc2){return _0x43b7f2[_0x55cd('0x17')](_0x2357fe);}return _0x43b7f2['status'](_0x2357fe)['end']();};}function respondWithResult(_0x45030b,_0x569e9e){_0x569e9e=_0x569e9e||0xc8;return function(_0x30b9c2){if(_0x30b9c2){return _0x45030b[_0x55cd('0x18')](_0x569e9e)[_0x55cd('0x19')](_0x30b9c2);}};}function respondWithFilteredResult(_0xa7eb2d,_0xfceec9){return function(_0x11c498){if(_0x11c498){var _0x5c850b=_0x11c498[_0x55cd('0x1a')],_0x26fcd6=_0xfceec9['offset'],_0xf7907b=_0xfceec9[_0x55cd('0x1b')]+_0xfceec9[_0x55cd('0x1c')],_0x277e1e;if(_0xf7907b>=_0x5c850b){_0xf7907b=_0x5c850b;_0x277e1e=0xc8;}else{_0x277e1e=0xce;}_0xa7eb2d['status'](_0x277e1e);return _0xa7eb2d[_0x55cd('0x1d')](_0x55cd('0x1e'),_0x26fcd6+'-'+_0xf7907b+'/'+_0x5c850b)[_0x55cd('0x19')](_0x11c498);}return null;};}function patchUpdates(_0x30cd24){return function(_0x2ccaf6){try{jsonpatch['apply'](_0x2ccaf6,_0x30cd24,!![]);}catch(_0x552c72){return BPromise[_0x55cd('0x1f')](_0x552c72);}return _0x2ccaf6[_0x55cd('0x20')]();};}function saveUpdates(_0x1ea4e4,_0x5592e6){return function(_0x254b4b){if(_0x254b4b){return _0x254b4b[_0x55cd('0x21')](_0x1ea4e4)[_0x55cd('0x22')](function(_0x1eba6d){return _0x1eba6d;});}return null;};}function removeEntity(_0x3a43dc,_0x26ad37){return function(_0x581218){if(_0x581218){return _0x581218[_0x55cd('0x23')]()[_0x55cd('0x22')](function(){var _0x5e8a4b=_0x581218['get']({'plain':!![]});var _0x24e78f=_0x55cd('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x24e78f,'resourceId':_0x5e8a4b['id']}})[_0x55cd('0x22')](function(){return _0x581218;});})[_0x55cd('0x22')](function(){_0x3a43dc[_0x55cd('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x209339,_0xdac999){return function(_0x141c2f){if(!_0x141c2f){_0x209339[_0x55cd('0x17')](0x194);}return _0x141c2f;};}function handleError(_0x27c80b,_0x15ebef){_0x15ebef=_0x15ebef||0x1f4;return function(_0x2d592c){logger[_0x55cd('0x25')](_0x2d592c['stack']);if(_0x2d592c['name']){delete _0x2d592c[_0x55cd('0x26')];}_0x27c80b[_0x55cd('0x18')](_0x15ebef)[_0x55cd('0x27')](_0x2d592c);};}exports['index']=function(_0x4ad8b6,_0x70a565){var _0x61d2af={},_0x4b2cde={},_0x7b7a97={'count':0x0,'rows':[]};var _0x534dfc=_['map'](db[_0x55cd('0x28')]['rawAttributes'],function(_0x3ad984){return{'name':_0x3ad984[_0x55cd('0x29')],'type':_0x3ad984[_0x55cd('0x2a')]['key']};});_0x4b2cde[_0x55cd('0x2b')]=_[_0x55cd('0x2c')](_0x534dfc,_0x55cd('0x26'));_0x4b2cde[_0x55cd('0x2d')]=_[_0x55cd('0x2e')](_0x4ad8b6[_0x55cd('0x2d')]);_0x4b2cde[_0x55cd('0x2f')]=_[_0x55cd('0x30')](_0x4b2cde[_0x55cd('0x2b')],_0x4b2cde[_0x55cd('0x2d')]);_0x61d2af['attributes']=_['intersection'](_0x4b2cde['model'],qs[_0x55cd('0x31')](_0x4ad8b6[_0x55cd('0x2d')][_0x55cd('0x31')]));_0x61d2af[_0x55cd('0x32')]=_0x61d2af[_0x55cd('0x32')][_0x55cd('0x33')]?_0x61d2af['attributes']:_0x4b2cde[_0x55cd('0x2b')];if(!_0x4ad8b6[_0x55cd('0x2d')][_0x55cd('0x34')](_0x55cd('0x35'))){_0x61d2af[_0x55cd('0x1c')]=qs['limit'](_0x4ad8b6[_0x55cd('0x2d')]['limit']);_0x61d2af['offset']=qs[_0x55cd('0x1b')](_0x4ad8b6[_0x55cd('0x2d')][_0x55cd('0x1b')]);}_0x61d2af[_0x55cd('0x36')]=qs[_0x55cd('0x37')](_0x4ad8b6[_0x55cd('0x2d')][_0x55cd('0x37')]);_0x61d2af['where']=qs['filters'](_[_0x55cd('0x38')](_0x4ad8b6[_0x55cd('0x2d')],_0x4b2cde[_0x55cd('0x2f')]),_0x534dfc);if(_0x4ad8b6[_0x55cd('0x2d')][_0x55cd('0x39')]){_0x61d2af[_0x55cd('0x3a')]=_[_0x55cd('0x3b')](_0x61d2af[_0x55cd('0x3a')],{'$or':_[_0x55cd('0x2c')](_0x534dfc,function(_0x439f6c){if(_0x439f6c[_0x55cd('0x2a')]!==_0x55cd('0x3c')){var _0x2f922f={};_0x2f922f[_0x439f6c['name']]={'$like':'%'+_0x4ad8b6[_0x55cd('0x2d')]['filter']+'%'};return _0x2f922f;}})});}_0x61d2af=_[_0x55cd('0x3b')]({},_0x61d2af,_0x4ad8b6[_0x55cd('0x3d')]);var _0x2d8def={'where':_0x61d2af[_0x55cd('0x3a')]};return db['Campaign'][_0x55cd('0x1a')](_0x2d8def)[_0x55cd('0x22')](function(_0x48cb28){_0x7b7a97[_0x55cd('0x1a')]=_0x48cb28;if(_0x4ad8b6[_0x55cd('0x2d')][_0x55cd('0x3e')]){_0x61d2af[_0x55cd('0x3f')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x61d2af);})[_0x55cd('0x22')](function(_0x3f926c){_0x7b7a97[_0x55cd('0x40')]=_0x3f926c;return _0x7b7a97;})['then'](respondWithFilteredResult(_0x70a565,_0x61d2af))[_0x55cd('0x41')](handleError(_0x70a565,null));};exports[_0x55cd('0x42')]=function(_0x246aee,_0x24fdce){var _0x195190={'raw':![],'where':{'id':_0x246aee[_0x55cd('0x43')]['id']}},_0x14ad12={};_0x14ad12['model']=_[_0x55cd('0x2e')](db[_0x55cd('0x28')][_0x55cd('0x44')]);_0x14ad12[_0x55cd('0x2d')]=_[_0x55cd('0x2e')](_0x246aee['query']);_0x14ad12['filters']=_[_0x55cd('0x30')](_0x14ad12[_0x55cd('0x2b')],_0x14ad12[_0x55cd('0x2d')]);_0x195190[_0x55cd('0x32')]=_[_0x55cd('0x30')](_0x14ad12[_0x55cd('0x2b')],qs[_0x55cd('0x31')](_0x246aee[_0x55cd('0x2d')]['fields']));_0x195190[_0x55cd('0x32')]=_0x195190[_0x55cd('0x32')][_0x55cd('0x33')]?_0x195190[_0x55cd('0x32')]:_0x14ad12[_0x55cd('0x2b')];if(_0x246aee['query']['includeAll']){_0x195190[_0x55cd('0x3f')]=[{'all':!![]}];}_0x195190=_[_0x55cd('0x3b')]({},_0x195190,_0x246aee[_0x55cd('0x3d')]);return db[_0x55cd('0x28')][_0x55cd('0x45')](_0x195190)[_0x55cd('0x22')](handleEntityNotFound(_0x24fdce,null))[_0x55cd('0x22')](respondWithResult(_0x24fdce,null))[_0x55cd('0x41')](handleError(_0x24fdce,null));};exports[_0x55cd('0x46')]=function(_0x2b6101,_0x3f6063){return db['Campaign'][_0x55cd('0x46')](_0x2b6101[_0x55cd('0x47')],{})[_0x55cd('0x22')](function(_0x55e171){var _0x49dee8=_0x2b6101[_0x55cd('0x48')][_0x55cd('0x49')]({'plain':!![]});if(!_0x49dee8)throw new Error(_0x55cd('0x4a'));if(_0x49dee8[_0x55cd('0x4b')]===_0x55cd('0x48')){var _0x34c526=_0x55e171[_0x55cd('0x49')]({'plain':!![]});var _0x36c160=_0x55cd('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x36c160,'userProfileId':_0x49dee8[_0x55cd('0x4c')]},'raw':!![]})[_0x55cd('0x22')](function(_0x2136ec){if(_0x2136ec&&_0x2136ec['autoAssociation']===0x0){return db[_0x55cd('0x4d')][_0x55cd('0x46')]({'name':_0x34c526[_0x55cd('0x26')],'resourceId':_0x34c526['id'],'type':_0x2136ec[_0x55cd('0x26')],'sectionId':_0x2136ec['id']},{})[_0x55cd('0x22')](function(){return _0x55e171;});}else{return _0x55e171;}})[_0x55cd('0x41')](function(_0x420a2a){logger[_0x55cd('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x420a2a);throw _0x420a2a;});}return _0x55e171;})[_0x55cd('0x22')](respondWithResult(_0x3f6063,0xc9))[_0x55cd('0x41')](handleError(_0x3f6063,null));};exports[_0x55cd('0x4e')]=function(_0x36ca11,_0x23104f){var _0x41656d={'where':{'id':_0x36ca11['params']['id']}},_0xd3edbb={};_0xd3edbb[_0x55cd('0x2b')]=_[_0x55cd('0x2e')](db['Campaign'][_0x55cd('0x44')]);_0x41656d[_0x55cd('0x32')]=_[_0x55cd('0x30')](_0xd3edbb[_0x55cd('0x2b')],qs[_0x55cd('0x31')](_0x36ca11[_0x55cd('0x2d')][_0x55cd('0x31')]));_0x41656d[_0x55cd('0x32')]=_0x41656d[_0x55cd('0x32')][_0x55cd('0x33')]?_0x41656d[_0x55cd('0x32')]:_0xd3edbb[_0x55cd('0x2b')];if(_0x36ca11['query'][_0x55cd('0x3e')]){_0x41656d['include']=[{'all':!![]}];}_0x41656d=_[_0x55cd('0x3b')]({},_0x41656d,_0x36ca11['options']);return db[_0x55cd('0x28')][_0x55cd('0x45')](_0x41656d)[_0x55cd('0x22')](handleEntityNotFound(_0x23104f,null))[_0x55cd('0x22')](function(_0x4e4c50){if(_0x4e4c50){var _0xfa6bf7=_0x4e4c50[_0x55cd('0x49')]({'plain':!![]});_0xfa6bf7=qs[_0x55cd('0x4f')](_0xfa6bf7,['id',_0x55cd('0x50'),_0x55cd('0x51')]);_0x36ca11['body']=_[_0x55cd('0x4f')](_0x36ca11['body'],['id','createdAt',_0x55cd('0x51')]);return db[_0x55cd('0x28')]['create'](_[_0x55cd('0x3b')](_0xfa6bf7,_0x36ca11[_0x55cd('0x47')]),{'include':_0x36ca11[_0x55cd('0x2d')][_0x55cd('0x3e')]?[{'all':!![]}]:undefined})[_0x55cd('0x22')](function(_0x4f166c){var _0x3ed250=_0x36ca11[_0x55cd('0x48')]['get']({'plain':!![]});if(!_0x3ed250)throw new Error(_0x55cd('0x4a'));if(_0x3ed250[_0x55cd('0x4b')]===_0x55cd('0x48')){var _0x439d92=_0x4f166c[_0x55cd('0x49')]({'plain':!![]});var _0x4d44af='IvrCampaigns';return db['UserProfileSection'][_0x55cd('0x45')]({'where':{'name':_0x4d44af,'userProfileId':_0x3ed250[_0x55cd('0x4c')]},'raw':!![]})[_0x55cd('0x22')](function(_0x524e64){if(_0x524e64&&_0x524e64[_0x55cd('0x52')]===0x0){return db[_0x55cd('0x4d')]['create']({'name':_0x439d92['name'],'resourceId':_0x439d92['id'],'type':_0x524e64[_0x55cd('0x26')],'sectionId':_0x524e64['id']},{})[_0x55cd('0x22')](function(){return _0x4f166c;});}else{return _0x4f166c;}})['catch'](function(_0x45952e){logger[_0x55cd('0x25')](_0x55cd('0x53'),_0x45952e);throw _0x45952e;});}return _0x4f166c;});}})[_0x55cd('0x22')](respondWithResult(_0x23104f,0xc9))[_0x55cd('0x41')](handleError(_0x23104f,null));};exports[_0x55cd('0x21')]=function(_0x3835f8,_0x421b4c){if(_0x3835f8[_0x55cd('0x47')]['id']){delete _0x3835f8['body']['id'];}return db[_0x55cd('0x28')][_0x55cd('0x45')]({'where':{'id':_0x3835f8['params']['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0x421b4c,null))[_0x55cd('0x22')](saveUpdates(_0x3835f8['body'],null))['then'](respondWithResult(_0x421b4c,null))[_0x55cd('0x41')](handleError(_0x421b4c,null));};exports[_0x55cd('0x23')]=function(_0x21448d,_0x37b751){return db[_0x55cd('0x28')]['find']({'where':{'id':_0x21448d[_0x55cd('0x43')]['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0x37b751,null))['then'](removeEntity(_0x37b751,null))[_0x55cd('0x41')](handleError(_0x37b751,null));};exports[_0x55cd('0x54')]=function(_0x50ebf4,_0x30dd83,_0x3a029c){var _0x441c29={'raw':!![],'where':{}};var _0xba85ef={};var _0x217176={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x50ebf4[_0x55cd('0x43')]['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0x30dd83,null))[_0x55cd('0x22')](function(_0x5161ae){if(_0x5161ae){_0xba85ef[_0x55cd('0x2b')]=_[_0x55cd('0x2e')](db[_0x55cd('0x55')]['rawAttributes']);_0xba85ef['query']=_[_0x55cd('0x2e')](_0x50ebf4['query']);_0xba85ef[_0x55cd('0x2f')]=_[_0x55cd('0x30')](_0xba85ef[_0x55cd('0x2b')],_0xba85ef[_0x55cd('0x2d')]);_0x441c29['attributes']=_[_0x55cd('0x30')](_0xba85ef['model'],qs['fields'](_0x50ebf4[_0x55cd('0x2d')][_0x55cd('0x31')]));_0x441c29[_0x55cd('0x32')]=_0x441c29[_0x55cd('0x32')][_0x55cd('0x33')]?_0x441c29[_0x55cd('0x32')]:_0xba85ef[_0x55cd('0x2b')];if(!_0x50ebf4[_0x55cd('0x2d')][_0x55cd('0x34')]('nolimit')){_0x441c29[_0x55cd('0x1c')]=qs[_0x55cd('0x1c')](_0x50ebf4[_0x55cd('0x2d')]['limit']);_0x441c29[_0x55cd('0x1b')]=qs[_0x55cd('0x1b')](_0x50ebf4['query']['offset']);}_0x441c29[_0x55cd('0x36')]=qs[_0x55cd('0x37')](_0x50ebf4[_0x55cd('0x2d')][_0x55cd('0x37')]);_0x441c29['where']=qs[_0x55cd('0x2f')](_[_0x55cd('0x38')](_0x50ebf4[_0x55cd('0x2d')],_0xba85ef[_0x55cd('0x2f')]));_0x441c29[_0x55cd('0x3a')][_0x55cd('0x56')]=_0x5161ae['id'];if(_0x50ebf4[_0x55cd('0x2d')][_0x55cd('0x39')]){_0x441c29['where']=_[_0x55cd('0x3b')](_0x441c29[_0x55cd('0x3a')],{'$or':_[_0x55cd('0x2c')](_0x441c29[_0x55cd('0x32')],function(_0x2cb94d){var _0x42eebd={};_0x42eebd[_0x2cb94d]={'$like':'%'+_0x50ebf4['query'][_0x55cd('0x39')]+'%'};return _0x42eebd;})});}_0x441c29=_['merge']({},_0x441c29,_0x50ebf4[_0x55cd('0x3d')]);return db[_0x55cd('0x55')][_0x55cd('0x1a')]({'where':_0x441c29['where']})[_0x55cd('0x22')](function(_0x5075b5){_0x217176['count']=_0x5075b5;if(_0x50ebf4[_0x55cd('0x2d')][_0x55cd('0x3e')]){_0x441c29['include']=[{'all':!![]}];}return db[_0x55cd('0x55')][_0x55cd('0x57')](_0x441c29);})['then'](function(_0xcf0ad6){_0x217176[_0x55cd('0x40')]=_0xcf0ad6;return _0x217176;});}})['then'](respondWithFilteredResult(_0x30dd83,_0x441c29))['catch'](handleError(_0x30dd83,null));};exports[_0x55cd('0x58')]=function(_0x5810e2,_0xe972f3,_0x6a8e15){var _0x388254={'raw':!![],'where':{}};var _0x1d094a={};var _0x3c68a4={'count':0x0,'rows':[]};return db['Campaign'][_0x55cd('0x59')]({'where':{'id':_0x5810e2[_0x55cd('0x43')]['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0xe972f3,null))[_0x55cd('0x22')](function(_0x3290c6){if(_0x3290c6){_0x1d094a[_0x55cd('0x2b')]=_['keys'](db[_0x55cd('0x5a')][_0x55cd('0x44')]);_0x1d094a[_0x55cd('0x2d')]=_[_0x55cd('0x2e')](_0x5810e2[_0x55cd('0x2d')]);_0x1d094a[_0x55cd('0x2f')]=_[_0x55cd('0x30')](_0x1d094a[_0x55cd('0x2b')],_0x1d094a[_0x55cd('0x2d')]);_0x388254['attributes']=_[_0x55cd('0x30')](_0x1d094a[_0x55cd('0x2b')],qs[_0x55cd('0x31')](_0x5810e2['query'][_0x55cd('0x31')]));_0x388254[_0x55cd('0x32')]=_0x388254[_0x55cd('0x32')][_0x55cd('0x33')]?_0x388254[_0x55cd('0x32')]:_0x1d094a[_0x55cd('0x2b')];if(!_0x5810e2[_0x55cd('0x2d')][_0x55cd('0x34')]('nolimit')){_0x388254[_0x55cd('0x1c')]=qs['limit'](_0x5810e2[_0x55cd('0x2d')][_0x55cd('0x1c')]);_0x388254[_0x55cd('0x1b')]=qs[_0x55cd('0x1b')](_0x5810e2[_0x55cd('0x2d')]['offset']);}_0x388254[_0x55cd('0x36')]=qs[_0x55cd('0x37')](_0x5810e2[_0x55cd('0x2d')][_0x55cd('0x37')]);_0x388254[_0x55cd('0x3a')]=qs[_0x55cd('0x2f')](_[_0x55cd('0x38')](_0x5810e2[_0x55cd('0x2d')],_0x1d094a[_0x55cd('0x2f')]));_0x388254[_0x55cd('0x3a')][_0x55cd('0x56')]=_0x3290c6['id'];if(_0x5810e2['query'][_0x55cd('0x39')]){_0x388254[_0x55cd('0x3a')]=_['merge'](_0x388254[_0x55cd('0x3a')],{'$or':_['map'](_0x388254[_0x55cd('0x32')],function(_0x293c99){var _0x591943={};_0x591943[_0x293c99]={'$like':'%'+_0x5810e2[_0x55cd('0x2d')][_0x55cd('0x39')]+'%'};return _0x591943;})});}_0x388254=_['merge']({},_0x388254,_0x5810e2[_0x55cd('0x3d')]);return db['CmHopperHistory'][_0x55cd('0x1a')]({'where':_0x388254[_0x55cd('0x3a')]})[_0x55cd('0x22')](function(_0x2840d2){_0x3c68a4[_0x55cd('0x1a')]=_0x2840d2;if(_0x5810e2[_0x55cd('0x2d')][_0x55cd('0x3e')]){_0x388254[_0x55cd('0x3f')]=[{'all':!![]}];}return db[_0x55cd('0x5a')][_0x55cd('0x57')](_0x388254);})[_0x55cd('0x22')](function(_0x8b8c71){_0x3c68a4['rows']=_0x8b8c71;return _0x3c68a4;});}})['then'](respondWithFilteredResult(_0xe972f3,_0x388254))[_0x55cd('0x41')](handleError(_0xe972f3,null));};exports['getHopperFinals']=function(_0xa7ea87,_0x4118d7,_0x35b4a0){var _0x161bb3={'raw':!![],'where':{}};var _0x2c4abf={};var _0x37bc3f={'count':0x0,'rows':[]};return db[_0x55cd('0x28')][_0x55cd('0x59')]({'where':{'id':_0xa7ea87[_0x55cd('0x43')]['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0x4118d7,null))[_0x55cd('0x22')](function(_0x2c8721){if(_0x2c8721){_0x2c4abf[_0x55cd('0x2b')]=_[_0x55cd('0x2e')](db[_0x55cd('0x5b')][_0x55cd('0x44')]);_0x2c4abf[_0x55cd('0x2d')]=_[_0x55cd('0x2e')](_0xa7ea87['query']);_0x2c4abf[_0x55cd('0x2f')]=_[_0x55cd('0x30')](_0x2c4abf[_0x55cd('0x2b')],_0x2c4abf['query']);_0x161bb3[_0x55cd('0x32')]=_[_0x55cd('0x30')](_0x2c4abf[_0x55cd('0x2b')],qs[_0x55cd('0x31')](_0xa7ea87['query'][_0x55cd('0x31')]));_0x161bb3[_0x55cd('0x32')]=_0x161bb3[_0x55cd('0x32')][_0x55cd('0x33')]?_0x161bb3[_0x55cd('0x32')]:_0x2c4abf[_0x55cd('0x2b')];if(!_0xa7ea87['query']['hasOwnProperty']('nolimit')){_0x161bb3['limit']=qs['limit'](_0xa7ea87[_0x55cd('0x2d')][_0x55cd('0x1c')]);_0x161bb3[_0x55cd('0x1b')]=qs['offset'](_0xa7ea87[_0x55cd('0x2d')][_0x55cd('0x1b')]);}_0x161bb3[_0x55cd('0x36')]=qs[_0x55cd('0x37')](_0xa7ea87[_0x55cd('0x2d')][_0x55cd('0x37')]);_0x161bb3[_0x55cd('0x3a')]=qs[_0x55cd('0x2f')](_[_0x55cd('0x38')](_0xa7ea87[_0x55cd('0x2d')],_0x2c4abf[_0x55cd('0x2f')]));_0x161bb3[_0x55cd('0x3a')][_0x55cd('0x56')]=_0x2c8721['id'];if(_0xa7ea87[_0x55cd('0x2d')][_0x55cd('0x39')]){_0x161bb3['where']=_[_0x55cd('0x3b')](_0x161bb3['where'],{'$or':_[_0x55cd('0x2c')](_0x161bb3[_0x55cd('0x32')],function(_0x3d3896){var _0x33a9b6={};_0x33a9b6[_0x3d3896]={'$like':'%'+_0xa7ea87[_0x55cd('0x2d')][_0x55cd('0x39')]+'%'};return _0x33a9b6;})});}_0x161bb3=_['merge']({},_0x161bb3,_0xa7ea87[_0x55cd('0x3d')]);return db[_0x55cd('0x5b')][_0x55cd('0x1a')]({'where':_0x161bb3[_0x55cd('0x3a')]})[_0x55cd('0x22')](function(_0x371882){_0x37bc3f[_0x55cd('0x1a')]=_0x371882;if(_0xa7ea87[_0x55cd('0x2d')][_0x55cd('0x3e')]){_0x161bb3[_0x55cd('0x3f')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x161bb3);})['then'](function(_0xed322b){_0x37bc3f[_0x55cd('0x40')]=_0xed322b;return _0x37bc3f;});}})[_0x55cd('0x22')](respondWithFilteredResult(_0x4118d7,_0x161bb3))['catch'](handleError(_0x4118d7,null));};exports[_0x55cd('0x5c')]=function(_0x559deb,_0x451221,_0x32e16a){var _0x3c817e={'raw':!![],'where':{}};var _0x55d37d={};var _0x1497f6={'count':0x0,'rows':[]};return db[_0x55cd('0x28')]['findOne']({'where':{'id':_0x559deb[_0x55cd('0x43')]['id']}})['then'](handleEntityNotFound(_0x451221,null))[_0x55cd('0x22')](function(_0x5cc876){if(_0x5cc876){_0x55d37d['model']=_[_0x55cd('0x2e')](db[_0x55cd('0x5d')][_0x55cd('0x44')]);_0x55d37d['query']=_['keys'](_0x559deb[_0x55cd('0x2d')]);_0x55d37d[_0x55cd('0x2f')]=_[_0x55cd('0x30')](_0x55d37d[_0x55cd('0x2b')],_0x55d37d[_0x55cd('0x2d')]);_0x3c817e[_0x55cd('0x32')]=_[_0x55cd('0x30')](_0x55d37d[_0x55cd('0x2b')],qs[_0x55cd('0x31')](_0x559deb['query']['fields']));_0x3c817e[_0x55cd('0x32')]=_0x3c817e['attributes']['length']?_0x3c817e['attributes']:_0x55d37d[_0x55cd('0x2b')];if(!_0x559deb[_0x55cd('0x2d')][_0x55cd('0x34')](_0x55cd('0x35'))){_0x3c817e[_0x55cd('0x1c')]=qs[_0x55cd('0x1c')](_0x559deb['query'][_0x55cd('0x1c')]);_0x3c817e[_0x55cd('0x1b')]=qs[_0x55cd('0x1b')](_0x559deb[_0x55cd('0x2d')][_0x55cd('0x1b')]);}_0x3c817e[_0x55cd('0x36')]=qs[_0x55cd('0x37')](_0x559deb[_0x55cd('0x2d')][_0x55cd('0x37')]);_0x3c817e[_0x55cd('0x3a')]=qs['filters'](_[_0x55cd('0x38')](_0x559deb[_0x55cd('0x2d')],_0x55d37d[_0x55cd('0x2f')]));_0x3c817e[_0x55cd('0x3a')][_0x55cd('0x56')]=_0x5cc876['id'];if(_0x559deb['query'][_0x55cd('0x39')]){_0x3c817e[_0x55cd('0x3a')]=_['merge'](_0x3c817e['where'],{'$or':_[_0x55cd('0x2c')](_0x3c817e[_0x55cd('0x32')],function(_0x5615a3){var _0x3273e5={};_0x3273e5[_0x5615a3]={'$like':'%'+_0x559deb['query'][_0x55cd('0x39')]+'%'};return _0x3273e5;})});}_0x3c817e=_[_0x55cd('0x3b')]({},_0x3c817e,_0x559deb[_0x55cd('0x3d')]);return db['CmHopperBlack']['count']({'where':_0x3c817e[_0x55cd('0x3a')]})[_0x55cd('0x22')](function(_0x5341f0){_0x1497f6[_0x55cd('0x1a')]=_0x5341f0;if(_0x559deb[_0x55cd('0x2d')][_0x55cd('0x3e')]){_0x3c817e[_0x55cd('0x3f')]=[{'all':!![]}];}return db[_0x55cd('0x5d')][_0x55cd('0x57')](_0x3c817e);})[_0x55cd('0x22')](function(_0x3f35be){_0x1497f6[_0x55cd('0x40')]=_0x3f35be;return _0x1497f6;});}})[_0x55cd('0x22')](respondWithFilteredResult(_0x451221,_0x3c817e))['catch'](handleError(_0x451221,null));};exports[_0x55cd('0x5e')]=function(_0x28ea09,_0x195b72,_0x18ce38){var _0x366000={};var _0xd78c98={};var _0x5a1401;var _0x5b3f27;return db[_0x55cd('0x28')][_0x55cd('0x59')]({'where':{'id':_0x28ea09[_0x55cd('0x43')]['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0x195b72,null))[_0x55cd('0x22')](function(_0x1e2e9b){if(_0x1e2e9b){_0x5a1401=_0x1e2e9b;_0xd78c98[_0x55cd('0x2b')]=_[_0x55cd('0x2e')](db[_0x55cd('0x5f')][_0x55cd('0x44')]);_0xd78c98[_0x55cd('0x2d')]=_[_0x55cd('0x2e')](_0x28ea09['query']);_0xd78c98[_0x55cd('0x2f')]=_[_0x55cd('0x30')](_0xd78c98[_0x55cd('0x2b')],_0xd78c98[_0x55cd('0x2d')]);_0x366000[_0x55cd('0x32')]=_['intersection'](_0xd78c98[_0x55cd('0x2b')],qs['fields'](_0x28ea09[_0x55cd('0x2d')][_0x55cd('0x31')]));_0x366000[_0x55cd('0x32')]=_0x366000['attributes'][_0x55cd('0x33')]?_0x366000['attributes']:_0xd78c98[_0x55cd('0x2b')];_0x366000[_0x55cd('0x36')]=qs[_0x55cd('0x37')](_0x28ea09[_0x55cd('0x2d')][_0x55cd('0x37')]);_0x366000[_0x55cd('0x3a')]=qs[_0x55cd('0x2f')](_[_0x55cd('0x38')](_0x28ea09['query'],_0xd78c98[_0x55cd('0x2f')]));if(_0x28ea09['query'][_0x55cd('0x39')]){_0x366000[_0x55cd('0x3a')]=_['merge'](_0x366000['where'],{'$or':_[_0x55cd('0x2c')](_0x366000[_0x55cd('0x32')],function(_0x16c2db){var _0x4c20ca={};_0x4c20ca[_0x16c2db]={'$like':'%'+_0x28ea09[_0x55cd('0x2d')][_0x55cd('0x39')]+'%'};return _0x4c20ca;})});}_0x366000=_[_0x55cd('0x3b')]({},_0x366000,_0x28ea09['options']);return _0x5a1401['getLists'](_0x366000);}})[_0x55cd('0x22')](function(_0x568de0){if(_0x568de0){_0x5b3f27=_0x568de0['length'];if(!_0x28ea09[_0x55cd('0x2d')][_0x55cd('0x34')](_0x55cd('0x35'))){_0x366000[_0x55cd('0x1c')]=qs[_0x55cd('0x1c')](_0x28ea09['query'][_0x55cd('0x1c')]);_0x366000[_0x55cd('0x1b')]=qs[_0x55cd('0x1b')](_0x28ea09[_0x55cd('0x2d')][_0x55cd('0x1b')]);}return _0x5a1401[_0x55cd('0x5e')](_0x366000);}})[_0x55cd('0x22')](function(_0x1ad679){if(_0x1ad679){return _0x1ad679?{'count':_0x5b3f27,'rows':_0x1ad679}:null;}})[_0x55cd('0x22')](respondWithResult(_0x195b72,null))[_0x55cd('0x41')](handleError(_0x195b72,null));};exports[_0x55cd('0x60')]=function(_0x3d937d,_0x2d8fc1,_0x283198){var _0x53afc8,_0x37a801;return db[_0x55cd('0x28')][_0x55cd('0x45')]({'where':{'id':_0x3d937d['params']['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0x2d8fc1,null))[_0x55cd('0x22')](function(_0x28fdc8){if(_0x28fdc8){_0x37a801=_0x28fdc8;return _0x28fdc8[_0x55cd('0x60')](_0x3d937d['body']['ids'],_['omit'](_0x3d937d[_0x55cd('0x47')],['ids','id'])||{});}return null;})['spread'](function(_0x450157){var _0xa310ba;_0x53afc8=_0x450157||[];var _0x17389e=[];if(_0x450157){for(var _0x5b1f36=0x0;_0x5b1f36<_0x450157[_0x55cd('0x33')];_0x5b1f36+=0x1){var _0x1fafba=_0x450157[_0x5b1f36]['get']({'plain':!![]});_0x37a801[_0x55cd('0x61')]=_0x3d937d[_0x55cd('0x47')][_0x55cd('0x61')]?_0x3d937d[_0x55cd('0x47')][_0x55cd('0x61')]:_0x37a801[_0x55cd('0x61')];switch(_0x37a801[_0x55cd('0x61')]){case _0x55cd('0x62'):_0xa310ba=squel[_0x55cd('0x63')]()[_0x55cd('0x64')](_0x55cd('0x65'))['fromQuery']([_0x55cd('0x66'),'scheduledAt',_0x55cd('0x67'),_0x55cd('0x68'),_0x55cd('0x56'),_0x55cd('0x50'),_0x55cd('0x51')],squel[_0x55cd('0x69')]()[_0x55cd('0x6a')](_0x55cd('0x66'),_0x55cd('0x66'))['field'](_0x55cd('0x6b'),'scheduledAt')[_0x55cd('0x6a')]('id',_0x55cd('0x67'))['field'](_0x1fafba[_0x55cd('0x6c')][_0x55cd('0x6d')](),_0x55cd('0x68'))[_0x55cd('0x6a')](_0x3d937d['params']['id']['toString'](),_0x55cd('0x56'))[_0x55cd('0x6a')]('NOW()',_0x55cd('0x50'))['field'](_0x55cd('0x6b'),_0x55cd('0x51'))[_0x55cd('0x6e')](_0x55cd('0x6f'))[_0x55cd('0x3a')]('deletedAt\x20IS\x20NULL')[_0x55cd('0x3a')](_0x55cd('0x70'),_0x1fafba['CmListId'][_0x55cd('0x6d')]())[_0x55cd('0x3a')](_0x55cd('0x71'))[_0x55cd('0x3a')](_0x55cd('0x72'),squel[_0x55cd('0x69')]()[_0x55cd('0x6a')](_0x55cd('0x73'))[_0x55cd('0x6e')](_0x55cd('0x74'))[_0x55cd('0x3a')]('CampaignId\x20=\x20?',_0x3d937d[_0x55cd('0x43')]['id']['toString']()))[_0x55cd('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x55cd('0x6a')]('COALESCE(phone,\x27\x27)')[_0x55cd('0x6e')]('cm_hopper')[_0x55cd('0x3a')](_0x55cd('0x75'),_0x3d937d[_0x55cd('0x43')]['id'][_0x55cd('0x6d')]())))['toString']();break;case _0x55cd('0x76'):_0xa310ba=squel['insert']()[_0x55cd('0x64')](_0x55cd('0x65'))['fromQuery']([_0x55cd('0x66'),'scheduledAt',_0x55cd('0x67'),_0x55cd('0x68'),_0x55cd('0x56'),_0x55cd('0x50'),_0x55cd('0x51')],squel[_0x55cd('0x69')]()['field'](_0x55cd('0x66'),'phone')['field'](_0x55cd('0x6b'),'scheduledAt')[_0x55cd('0x6a')]('id','ContactId')[_0x55cd('0x6a')](_0x1fafba[_0x55cd('0x6c')][_0x55cd('0x6d')](),'ListId')[_0x55cd('0x6a')](_0x3d937d['params']['id'][_0x55cd('0x6d')](),_0x55cd('0x56'))[_0x55cd('0x6a')](_0x55cd('0x6b'),_0x55cd('0x50'))[_0x55cd('0x6a')](_0x55cd('0x6b'),'updatedAt')['from'](_0x55cd('0x6f'))[_0x55cd('0x3a')](_0x55cd('0x77'))[_0x55cd('0x3a')](_0x55cd('0x70'),_0x1fafba[_0x55cd('0x6c')][_0x55cd('0x6d')]())[_0x55cd('0x3a')](_0x55cd('0x71'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x55cd('0x69')]()[_0x55cd('0x6a')](_0x55cd('0x78'))[_0x55cd('0x6e')]('cm_hopper')[_0x55cd('0x3a')](_0x55cd('0x75'),_0x3d937d[_0x55cd('0x43')]['id']['toString']())))[_0x55cd('0x6d')]();break;default:_0xa310ba=squel[_0x55cd('0x63')]()['into'](_0x55cd('0x65'))['fromQuery'](['phone',_0x55cd('0x79'),_0x55cd('0x67'),_0x55cd('0x68'),_0x55cd('0x56'),_0x55cd('0x50'),_0x55cd('0x51')],squel[_0x55cd('0x69')]()['field']('phone',_0x55cd('0x66'))[_0x55cd('0x6a')](_0x55cd('0x6b'),_0x55cd('0x79'))[_0x55cd('0x6a')]('id',_0x55cd('0x67'))[_0x55cd('0x6a')](_0x1fafba['CmListId']['toString'](),_0x55cd('0x68'))[_0x55cd('0x6a')](_0x3d937d[_0x55cd('0x43')]['id']['toString'](),_0x55cd('0x56'))[_0x55cd('0x6a')]('NOW()',_0x55cd('0x50'))[_0x55cd('0x6a')](_0x55cd('0x6b'),'updatedAt')[_0x55cd('0x6e')](_0x55cd('0x6f'))['where'](_0x55cd('0x77'))[_0x55cd('0x3a')]('ListId\x20=\x20?',_0x1fafba['CmListId'][_0x55cd('0x6d')]())[_0x55cd('0x3a')](_0x55cd('0x71')))[_0x55cd('0x6d')]();}_0x17389e[_0x55cd('0x7a')](db['sequelize'][_0x55cd('0x2d')](_0xa310ba));}return BPromise[_0x55cd('0x7b')](_0x17389e);}})[_0x55cd('0x22')](function(){return _0x53afc8;})['then'](respondWithResult(_0x2d8fc1,null))[_0x55cd('0x41')](handleError(_0x2d8fc1,null));};exports['removeLists']=function(_0x2769a3,_0x5292f4,_0x445075){return db[_0x55cd('0x28')][_0x55cd('0x45')]({'where':{'id':_0x2769a3[_0x55cd('0x43')]['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0x5292f4,null))[_0x55cd('0x22')](function(_0x2758e6){if(_0x2758e6){return _0x2758e6[_0x55cd('0x7c')](_0x2769a3[_0x55cd('0x2d')][_0x55cd('0x7d')]);}})[_0x55cd('0x22')](function(_0x47831a){if(_0x47831a){return db[_0x55cd('0x55')][_0x55cd('0x23')]({'where':{'ListId':_0x2769a3['query'][_0x55cd('0x7d')],'CampaignId':_0x2769a3[_0x55cd('0x43')]['id']}})['then'](function(){return _0x47831a;});}})['then'](respondWithStatusCode(_0x5292f4,null))['catch'](handleError(_0x5292f4,null));};exports[_0x55cd('0x7e')]=function(_0x264335,_0x3ff7f9,_0x53ec73){var _0x5a3b21={};var _0x214ab0={};var _0x1481f2;var _0x11565a;return db[_0x55cd('0x28')]['findOne']({'where':{'id':_0x264335[_0x55cd('0x43')]['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0x3ff7f9,null))[_0x55cd('0x22')](function(_0x37d965){if(_0x37d965){_0x1481f2=_0x37d965;_0x214ab0[_0x55cd('0x2b')]=_['keys'](db[_0x55cd('0x5f')][_0x55cd('0x44')]);_0x214ab0[_0x55cd('0x2d')]=_[_0x55cd('0x2e')](_0x264335[_0x55cd('0x2d')]);_0x214ab0['filters']=_['intersection'](_0x214ab0[_0x55cd('0x2b')],_0x214ab0[_0x55cd('0x2d')]);_0x5a3b21[_0x55cd('0x32')]=_[_0x55cd('0x30')](_0x214ab0['model'],qs[_0x55cd('0x31')](_0x264335[_0x55cd('0x2d')][_0x55cd('0x31')]));_0x5a3b21[_0x55cd('0x32')]=_0x5a3b21[_0x55cd('0x32')][_0x55cd('0x33')]?_0x5a3b21[_0x55cd('0x32')]:_0x214ab0[_0x55cd('0x2b')];_0x5a3b21['order']=qs[_0x55cd('0x37')](_0x264335[_0x55cd('0x2d')][_0x55cd('0x37')]);_0x5a3b21['where']=qs[_0x55cd('0x2f')](_['pick'](_0x264335[_0x55cd('0x2d')],_0x214ab0[_0x55cd('0x2f')]));if(_0x264335['query'][_0x55cd('0x39')]){_0x5a3b21['where']=_[_0x55cd('0x3b')](_0x5a3b21['where'],{'$or':_[_0x55cd('0x2c')](_0x5a3b21[_0x55cd('0x32')],function(_0x4861d4){var _0x306689={};_0x306689[_0x4861d4]={'$like':'%'+_0x264335[_0x55cd('0x2d')]['filter']+'%'};return _0x306689;})});}_0x5a3b21=_[_0x55cd('0x3b')]({},_0x5a3b21,_0x264335[_0x55cd('0x3d')]);return _0x1481f2[_0x55cd('0x7e')](_0x5a3b21);}})[_0x55cd('0x22')](function(_0x1f6acc){if(_0x1f6acc){_0x11565a=_0x1f6acc[_0x55cd('0x33')];if(!_0x264335[_0x55cd('0x2d')]['hasOwnProperty'](_0x55cd('0x35'))){_0x5a3b21[_0x55cd('0x1c')]=qs[_0x55cd('0x1c')](_0x264335['query'][_0x55cd('0x1c')]);_0x5a3b21[_0x55cd('0x1b')]=qs[_0x55cd('0x1b')](_0x264335[_0x55cd('0x2d')]['offset']);}return _0x1481f2['getBlackLists'](_0x5a3b21);}})[_0x55cd('0x22')](function(_0x212e21){if(_0x212e21){return _0x212e21?{'count':_0x11565a,'rows':_0x212e21}:null;}})[_0x55cd('0x22')](respondWithResult(_0x3ff7f9,null))[_0x55cd('0x41')](handleError(_0x3ff7f9,null));};exports[_0x55cd('0x7f')]=function(_0x20a72f,_0x169955,_0x3ac6f1){var _0x474a5c,_0x2ee94c;return db[_0x55cd('0x28')]['find']({'where':{'id':_0x20a72f[_0x55cd('0x43')]['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0x169955,null))['then'](function(_0x3b548a){if(_0x3b548a){_0x2ee94c=_0x3b548a;return _0x3b548a[_0x55cd('0x7f')](_0x20a72f['body'][_0x55cd('0x7d')],_['omit'](_0x20a72f[_0x55cd('0x47')],[_0x55cd('0x7d'),'id'])||{});}return null;})[_0x55cd('0x80')](function(_0x4e15da){var _0xf54691;_0x474a5c=_0x4e15da||[];var _0x24c45a=[];if(_0x4e15da){for(var _0x28b64d=0x0;_0x28b64d<_0x4e15da[_0x55cd('0x33')];_0x28b64d+=0x1){var _0x21e968=_0x4e15da[_0x28b64d][_0x55cd('0x49')]({'plain':!![]});_0xf54691=squel[_0x55cd('0x63')]()[_0x55cd('0x64')](_0x55cd('0x81'))[_0x55cd('0x82')](['phone','ContactId',_0x55cd('0x68'),'CampaignId',_0x55cd('0x50'),_0x55cd('0x51')],squel[_0x55cd('0x69')]()[_0x55cd('0x6a')](_0x55cd('0x66'),_0x55cd('0x66'))['field']('id','ContactId')['field'](_0x21e968['CmListId'][_0x55cd('0x6d')](),'ListId')[_0x55cd('0x6a')](_0x20a72f[_0x55cd('0x43')]['id'][_0x55cd('0x6d')](),_0x55cd('0x56'))[_0x55cd('0x6a')](_0x55cd('0x6b'),_0x55cd('0x50'))[_0x55cd('0x6a')](_0x55cd('0x6b'),_0x55cd('0x51'))['from'](_0x55cd('0x6f'))[_0x55cd('0x3a')]('deletedAt\x20IS\x20NULL')[_0x55cd('0x3a')]('ListId\x20=\x20?',_0x21e968[_0x55cd('0x6c')]['toString']())[_0x55cd('0x3a')](_0x55cd('0x71')))[_0x55cd('0x6d')]();_0x24c45a[_0x55cd('0x7a')](db[_0x55cd('0x83')][_0x55cd('0x2d')](_0xf54691));}return BPromise['all'](_0x24c45a);}})[_0x55cd('0x22')](function(){return _0x474a5c;})[_0x55cd('0x22')](respondWithResult(_0x169955,null))[_0x55cd('0x41')](handleError(_0x169955,null));};exports[_0x55cd('0x84')]=function(_0xab8418,_0x4bd3db,_0x585838){return db[_0x55cd('0x28')][_0x55cd('0x45')]({'where':{'id':_0xab8418[_0x55cd('0x43')]['id']}})[_0x55cd('0x22')](handleEntityNotFound(_0x4bd3db,null))[_0x55cd('0x22')](function(_0x379522){if(_0x379522){return _0x379522[_0x55cd('0x84')](_0xab8418[_0x55cd('0x2d')][_0x55cd('0x7d')]);}})[_0x55cd('0x22')](function(_0x499ee5){if(_0x499ee5){return db[_0x55cd('0x5d')][_0x55cd('0x23')]({'where':{'ListId':_0xab8418['query']['ids'],'CampaignId':_0xab8418[_0x55cd('0x43')]['id']}})[_0x55cd('0x22')](function(){return _0x499ee5;});}})[_0x55cd('0x22')](respondWithStatusCode(_0x4bd3db,null))[_0x55cd('0x41')](handleError(_0x4bd3db,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 0e162f6..58b350c 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 _0x8f62=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','define','Campaign','lodash'];(function(_0x4f9ed0,_0xae76a8){var _0xf21a74=function(_0x2fa415){while(--_0x2fa415){_0x4f9ed0['push'](_0x4f9ed0['shift']());}};_0xf21a74(++_0xae76a8);}(_0x8f62,0xa8));var _0x28f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8f62[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x28f6('0x0'));var util=require(_0x28f6('0x1'));var logger=require('../../config/logger')(_0x28f6('0x2'));var moment=require(_0x28f6('0x3'));var BPromise=require(_0x28f6('0x4'));var rp=require(_0x28f6('0x5'));var fs=require('fs');var path=require(_0x28f6('0x6'));var rimraf=require(_0x28f6('0x7'));var config=require(_0x28f6('0x8'));var attributes=require(_0x28f6('0x9'));module[_0x28f6('0xa')]=function(_0x237830,_0x104796){return _0x237830[_0x28f6('0xb')](_0x28f6('0xc'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc698=['request-promise','path','rimraf','../../config/environment','./campaign.attributes','Campaign','lodash','util','bluebird'];(function(_0x14ddd4,_0x5b527d){var _0x421616=function(_0x4f0a42){while(--_0x4f0a42){_0x14ddd4['push'](_0x14ddd4['shift']());}};_0x421616(++_0x5b527d);}(_0xc698,0x189));var _0x8c69=function(_0xd299c3,_0x4ba0f1){_0xd299c3=_0xd299c3-0x0;var _0x376574=_0xc698[_0xd299c3];return _0x376574;};'use strict';var _=require(_0x8c69('0x0'));var util=require(_0x8c69('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8c69('0x2'));var rp=require(_0x8c69('0x3'));var fs=require('fs');var path=require(_0x8c69('0x4'));var rimraf=require(_0x8c69('0x5'));var config=require(_0x8c69('0x6'));var attributes=require(_0x8c69('0x7'));module['exports']=function(_0x35a9f4,_0x389dda){return _0x35a9f4['define'](_0x8c69('0x8'),attributes,{'tableName':'campaigns','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 a59a3bc..a4e12c6 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 _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x29ba39,_0x1056f9){var _0x5dbb2b=function(_0x427d45){while(--_0x427d45){_0x29ba39['push'](_0x29ba39['shift']());}};_0x5dbb2b(++_0x1056f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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['GetCampaign']=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')]));});});}; \ No newline at end of file +var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x10844b,_0x1fdc2d){var _0x9af234=function(_0x25a32f){while(--_0x25a32f){_0x10844b['push'](_0x10844b['shift']());}};_0x9af234(++_0x1fdc2d);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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']('Campaign,\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);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index a79325d..c193dfb 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 _0x9fd4=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','destroy','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3ca8b3,_0x251f5d){var _0x529778=function(_0xebce5a){while(--_0xebce5a){_0x3ca8b3['push'](_0x3ca8b3['shift']());}};_0x529778(++_0x251f5d);}(_0x9fd4,0x16c));var _0x49fd=function(_0x1c2fd7,_0x595cf1){_0x1c2fd7=_0x1c2fd7-0x0;var _0x369e9d=_0x9fd4[_0x1c2fd7];return _0x369e9d;};'use strict';var multer=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var path=require(_0x49fd('0x2'));var timeout=require(_0x49fd('0x3'));var express=require(_0x49fd('0x4'));var router=express[_0x49fd('0x5')]();var auth=require(_0x49fd('0x6'));var interaction=require(_0x49fd('0x7'));var config=require(_0x49fd('0x8'));var controller=require('./campaign.controller');router['get']('/',auth[_0x49fd('0x9')](),controller[_0x49fd('0xa')]);router[_0x49fd('0xb')](_0x49fd('0xc'),auth['isAuthenticated'](),controller[_0x49fd('0xd')]);router[_0x49fd('0xb')](_0x49fd('0xe'),auth[_0x49fd('0x9')](),controller[_0x49fd('0xf')]);router['get'](_0x49fd('0x10'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x11')]);router[_0x49fd('0xb')](_0x49fd('0x12'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x13')]);router['get'](_0x49fd('0x14'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x15')]);router[_0x49fd('0xb')](_0x49fd('0x16'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x17')]);router[_0x49fd('0xb')](_0x49fd('0x18'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x19')]);router[_0x49fd('0x1a')]('/',auth[_0x49fd('0x9')](),controller[_0x49fd('0x1b')]);router[_0x49fd('0x1a')](_0x49fd('0x1c'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x1d')]);router[_0x49fd('0x1a')](_0x49fd('0x16'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x1e')]);router[_0x49fd('0x1a')](_0x49fd('0x18'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x1f')]);router['put'](_0x49fd('0xc'),auth[_0x49fd('0x9')](),controller['update']);router['delete'](_0x49fd('0xc'),auth['isAuthenticated'](),controller[_0x49fd('0x20')]);router[_0x49fd('0x21')]('/:id/lists',auth[_0x49fd('0x9')](),controller[_0x49fd('0x22')]);router['delete'](_0x49fd('0x18'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x23')]);module[_0x49fd('0x24')]=router; \ No newline at end of file +var _0x51ba=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','post','/:id/clone','clone','addLists','put','update','destroy','delete','removeBlackLists','multer','util','path','connect-timeout','express'];(function(_0x1b9f58,_0x398fb4){var _0x57751e=function(_0x39dfdc){while(--_0x39dfdc){_0x1b9f58['push'](_0x1b9f58['shift']());}};_0x57751e(++_0x398fb4);}(_0x51ba,0x10b));var _0xa51b=function(_0x528a34,_0x4533eb){_0x528a34=_0x528a34-0x0;var _0x2fbedf=_0x51ba[_0x528a34];return _0x2fbedf;};'use strict';var multer=require(_0xa51b('0x0'));var util=require(_0xa51b('0x1'));var path=require(_0xa51b('0x2'));var timeout=require(_0xa51b('0x3'));var express=require(_0xa51b('0x4'));var router=express[_0xa51b('0x5')]();var auth=require(_0xa51b('0x6'));var interaction=require(_0xa51b('0x7'));var config=require(_0xa51b('0x8'));var controller=require(_0xa51b('0x9'));router[_0xa51b('0xa')]('/',auth[_0xa51b('0xb')](),controller[_0xa51b('0xc')]);router[_0xa51b('0xa')](_0xa51b('0xd'),auth['isAuthenticated'](),controller[_0xa51b('0xe')]);router[_0xa51b('0xa')](_0xa51b('0xf'),auth[_0xa51b('0xb')](),controller[_0xa51b('0x10')]);router[_0xa51b('0xa')](_0xa51b('0x11'),auth[_0xa51b('0xb')](),controller[_0xa51b('0x12')]);router['get'](_0xa51b('0x13'),auth['isAuthenticated'](),controller[_0xa51b('0x14')]);router['get'](_0xa51b('0x15'),auth[_0xa51b('0xb')](),controller[_0xa51b('0x16')]);router[_0xa51b('0xa')](_0xa51b('0x17'),auth['isAuthenticated'](),controller['getLists']);router[_0xa51b('0xa')](_0xa51b('0x18'),auth[_0xa51b('0xb')](),controller['getBlackLists']);router[_0xa51b('0x19')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xa51b('0x1a'),auth[_0xa51b('0xb')](),controller[_0xa51b('0x1b')]);router['post'](_0xa51b('0x17'),auth[_0xa51b('0xb')](),controller[_0xa51b('0x1c')]);router[_0xa51b('0x19')](_0xa51b('0x18'),auth[_0xa51b('0xb')](),controller['addBlackLists']);router[_0xa51b('0x1d')](_0xa51b('0xd'),auth[_0xa51b('0xb')](),controller[_0xa51b('0x1e')]);router['delete'](_0xa51b('0xd'),auth[_0xa51b('0xb')](),controller[_0xa51b('0x1f')]);router[_0xa51b('0x20')](_0xa51b('0x17'),auth[_0xa51b('0xb')](),controller['removeLists']);router[_0xa51b('0x20')](_0xa51b('0x18'),auth[_0xa51b('0xb')](),controller[_0xa51b('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 195acac..061d3aa 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 _0x445e=['exports','TEXT','STRING','VIRTUAL','getDataValue','key','sequelize'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x445e,0xfb));var _0xe445=function(_0x1a3ab5,_0x36fd01){_0x1a3ab5=_0x1a3ab5-0x0;var _0x3d2d66=_0x445e[_0x1a3ab5];return _0x3d2d66;};'use strict';var Sequelize=require(_0xe445('0x0'));module[_0xe445('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xe445('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe445('0x3')]},'name':{'type':Sequelize[_0xe445('0x4')],'get':function(){return this[_0xe445('0x5')](_0xe445('0x6'));}}}; \ No newline at end of file +var _0x42d0=['key','STRING','VIRTUAL','getDataValue'];(function(_0x18d72d,_0xe7e88e){var _0x37b91e=function(_0x41cdc7){while(--_0x41cdc7){_0x18d72d['push'](_0x18d72d['shift']());}};_0x37b91e(++_0xe7e88e);}(_0x42d0,0x1c9));var _0x042d=function(_0x2067e9,_0x5e6a97){_0x2067e9=_0x2067e9-0x0;var _0x280ce4=_0x42d0[_0x2067e9];return _0x280ce4;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0x042d('0x0')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x042d('0x0')]},'name':{'type':Sequelize[_0x042d('0x1')],'get':function(){return this[_0x042d('0x2')](_0x042d('0x3'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index c0c4666..670daba 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 _0xa9e0=['filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','CannedAnswers','UserProfileResource','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x596f37,_0x36dde3){var _0x25130e=function(_0x187de5){while(--_0x187de5){_0x596f37['push'](_0x596f37['shift']());}};_0x25130e(++_0x36dde3);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':!![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x47')]['id']){delete _0x8d6dd1[_0x0a9e('0x47')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x16f976[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x49')]=function(_0x4f7240,_0x4ae14b){var _0x5ddf84={'key':_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x2e')]};if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')]){_0x5ddf84[_0x0a9e('0x4a')]=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')];}else if(_0x4f7240[_0x0a9e('0x47')]['SmsAccountId']){_0x5ddf84['SmsAccountId']=_0x4f7240['body'][_0x0a9e('0x4b')];}else if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')]){_0x5ddf84['OpenchannelAccountId']=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')];}else if(_0x4f7240['body']['ChatWebsiteId']){_0x5ddf84[_0x0a9e('0x4d')]=_0x4f7240['body'][_0x0a9e('0x4d')];}return db['CannedAnswer'][_0x0a9e('0x48')]({'where':_0x5ddf84})[_0x0a9e('0x22')](function(_0x439340){if(_0x439340){throw new db['Sequelize'][(_0x0a9e('0x4e'))](_0x0a9e('0x4f'));}return db['CannedAnswer']['create'](_0x4f7240[_0x0a9e('0x47')]);})[_0x0a9e('0x22')](function(_0x49c095){var _0x145931=_0x4f7240['user'][_0x0a9e('0x50')]({'plain':!![]});if(!_0x145931)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x145931[_0x0a9e('0x51')]==='user'){var _0x5da27d=_0x49c095['get']({'plain':!![]});return db[_0x0a9e('0x52')]['find']({'where':{'name':_0x0a9e('0x23'),'userProfileId':_0x145931[_0x0a9e('0x53')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x19b4df){if(_0x19b4df&&_0x19b4df[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x49')]({'name':_0x5da27d[_0x0a9e('0x26')],'resourceId':_0x5da27d['id'],'type':_0x19b4df['name'],'sectionId':_0x19b4df['id']},{})[_0x0a9e('0x22')](function(){return _0x49c095;});}else{return _0x49c095;}})[_0x0a9e('0x42')](function(_0x2642bb){logger[_0x0a9e('0x55')](_0x0a9e('0x56'),_0x2642bb);throw _0x2642bb;});}return _0x49c095;})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,0xc9))['catch'](handleError(_0x4ae14b,null));}; \ No newline at end of file +var _0xa9e0=['filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','CannedAnswers','UserProfileResource','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x13e482,_0x150dc2){var _0x10a28f=function(_0x2b4bad){while(--_0x2b4bad){_0x13e482['push'](_0x13e482['shift']());}};_0x10a28f(++_0x150dc2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':!![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x47')]['id']){delete _0x8d6dd1[_0x0a9e('0x47')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x16f976[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x49')]=function(_0x4f7240,_0x4ae14b){var _0x5ddf84={'key':_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x2e')]};if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')]){_0x5ddf84[_0x0a9e('0x4a')]=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')];}else if(_0x4f7240[_0x0a9e('0x47')]['SmsAccountId']){_0x5ddf84['SmsAccountId']=_0x4f7240['body'][_0x0a9e('0x4b')];}else if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')]){_0x5ddf84['OpenchannelAccountId']=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')];}else if(_0x4f7240['body']['ChatWebsiteId']){_0x5ddf84[_0x0a9e('0x4d')]=_0x4f7240['body'][_0x0a9e('0x4d')];}return db['CannedAnswer'][_0x0a9e('0x48')]({'where':_0x5ddf84})[_0x0a9e('0x22')](function(_0x439340){if(_0x439340){throw new db['Sequelize'][(_0x0a9e('0x4e'))](_0x0a9e('0x4f'));}return db['CannedAnswer']['create'](_0x4f7240[_0x0a9e('0x47')]);})[_0x0a9e('0x22')](function(_0x49c095){var _0x145931=_0x4f7240['user'][_0x0a9e('0x50')]({'plain':!![]});if(!_0x145931)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x145931[_0x0a9e('0x51')]==='user'){var _0x5da27d=_0x49c095['get']({'plain':!![]});return db[_0x0a9e('0x52')]['find']({'where':{'name':_0x0a9e('0x23'),'userProfileId':_0x145931[_0x0a9e('0x53')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x19b4df){if(_0x19b4df&&_0x19b4df[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x49')]({'name':_0x5da27d[_0x0a9e('0x26')],'resourceId':_0x5da27d['id'],'type':_0x19b4df['name'],'sectionId':_0x19b4df['id']},{})[_0x0a9e('0x22')](function(){return _0x49c095;});}else{return _0x49c095;}})[_0x0a9e('0x42')](function(_0x2642bb){logger[_0x0a9e('0x55')](_0x0a9e('0x56'),_0x2642bb);throw _0x2642bb;});}return _0x49c095;})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,0xc9))['catch'](handleError(_0x4ae14b,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 0ee4611..0462720 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 _0xba40=['./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xba40,0x7b));var _0x0ba4=function(_0xd2cdd6,_0x3a4d82){_0xd2cdd6=_0xd2cdd6-0x0;var _0x290e94=_0xba40[_0xd2cdd6];return _0x290e94;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0ba4('0x0'))(_0x0ba4('0x1'));var moment=require('moment');var BPromise=require(_0x0ba4('0x2'));var rp=require(_0x0ba4('0x3'));var fs=require('fs');var path=require(_0x0ba4('0x4'));var rimraf=require(_0x0ba4('0x5'));var config=require(_0x0ba4('0x6'));var attributes=require(_0x0ba4('0x7'));module[_0x0ba4('0x8')]=function(_0x3665ee,_0x517498){return _0x3665ee[_0x0ba4('0x9')](_0x0ba4('0xa'),attributes,{'tableName':_0x0ba4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0ba4('0xc')});}; \ No newline at end of file +var _0xcb67=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4b87dc,_0x65bfba){var _0x4c3b12=function(_0xf7ff85){while(--_0xf7ff85){_0x4b87dc['push'](_0x4b87dc['shift']());}};_0x4c3b12(++_0x65bfba);}(_0xcb67,0x104));var _0x7cb6=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0xcb67[_0x56f7e2];return _0x36240b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7cb6('0x0'));var moment=require(_0x7cb6('0x1'));var BPromise=require(_0x7cb6('0x2'));var rp=require(_0x7cb6('0x3'));var fs=require('fs');var path=require(_0x7cb6('0x4'));var rimraf=require(_0x7cb6('0x5'));var config=require(_0x7cb6('0x6'));var attributes=require(_0x7cb6('0x7'));module['exports']=function(_0x1a0505,_0x4b9f51){return _0x1a0505[_0x7cb6('0x8')](_0x7cb6('0x9'),attributes,{'tableName':_0x7cb6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7cb6('0xb'),'collate':_0x7cb6('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index de3a93b..b788ecc 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 _0xd97e=['request\x20sent','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x1406c8,_0x40a801){var _0x3ec6f8=function(_0xc1183a){while(--_0xc1183a){_0x1406c8['push'](_0x1406c8['shift']());}};_0x3ec6f8(++_0x40a801);}(_0xd97e,0x1ba));var _0xed97=function(_0x461b72,_0xa585cf){_0x461b72=_0x461b72-0x0;var _0x1b7c22=_0xd97e[_0x461b72];return _0x1b7c22;};'use strict';var _=require(_0xed97('0x0'));var util=require(_0xed97('0x1'));var moment=require(_0xed97('0x2'));var BPromise=require(_0xed97('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed97('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xed97('0x5'))(_0xed97('0x6'));var config=require(_0xed97('0x7'));var jayson=require(_0xed97('0x8'));var client=jayson[_0xed97('0x9')][_0xed97('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1843cb,_0x3f0fdc,_0x32dd5c){return new BPromise(function(_0xc1c927,_0x1f9cd2){return client[_0xed97('0xb')](_0x1843cb,_0x32dd5c)[_0xed97('0xc')](function(_0x1dc958){logger[_0xed97('0xd')](_0xed97('0xe'),_0x3f0fdc,'request\x20sent');logger[_0xed97('0xf')](_0xed97('0x10'),_0x3f0fdc,'request\x20sent',JSON['stringify'](_0x1dc958));if(_0x1dc958[_0xed97('0x11')]){if(_0x1dc958[_0xed97('0x11')][_0xed97('0x12')]===0x1f4){logger['error'](_0xed97('0xe'),_0x3f0fdc,_0x1dc958['error'][_0xed97('0x13')]);return _0x1f9cd2(_0x1dc958[_0xed97('0x11')]['message']);}logger['error'](_0xed97('0xe'),_0x3f0fdc,_0x1dc958[_0xed97('0x11')]['message']);return _0xc1c927(_0x1dc958[_0xed97('0x11')][_0xed97('0x13')]);}else{logger[_0xed97('0xd')](_0xed97('0xe'),_0x3f0fdc,_0xed97('0x14'));_0xc1c927(_0x1dc958['result'][_0xed97('0x13')]);}})[_0xed97('0x15')](function(_0x39650b){logger[_0xed97('0x11')](_0xed97('0xe'),_0x3f0fdc,_0x39650b);_0x1f9cd2(_0x39650b);});});} \ No newline at end of file +var _0xf6d9=['ioredis','../../config/utils','../../config/logger','rpc','http','then','info','request\x20sent','error','CannedAnswer,\x20%s,\x20%s','message','moment','randomstring'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xf6d9,0x1ab));var _0x9f6d=function(_0x4ab7f4,_0x5442c9){_0x4ab7f4=_0x4ab7f4-0x0;var _0x89ee6b=_0xf6d9[_0x4ab7f4];return _0x89ee6b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9f6d('0x0'));var BPromise=require('bluebird');var rs=require(_0x9f6d('0x1'));var fs=require('fs');var Redis=require(_0x9f6d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9f6d('0x3'));var logger=require(_0x9f6d('0x4'))(_0x9f6d('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9f6d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x11a375,_0x28f51c,_0x4aa666){return new BPromise(function(_0x350053,_0x43a7d7){return client['request'](_0x11a375,_0x4aa666)[_0x9f6d('0x7')](function(_0x36e3cb){logger[_0x9f6d('0x8')]('CannedAnswer,\x20%s,\x20%s',_0x28f51c,_0x9f6d('0x9'));logger['debug']('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x28f51c,_0x9f6d('0x9'),JSON['stringify'](_0x36e3cb));if(_0x36e3cb[_0x9f6d('0xa')]){if(_0x36e3cb[_0x9f6d('0xa')]['code']===0x1f4){logger[_0x9f6d('0xa')](_0x9f6d('0xb'),_0x28f51c,_0x36e3cb[_0x9f6d('0xa')][_0x9f6d('0xc')]);return _0x43a7d7(_0x36e3cb[_0x9f6d('0xa')][_0x9f6d('0xc')]);}logger[_0x9f6d('0xa')](_0x9f6d('0xb'),_0x28f51c,_0x36e3cb[_0x9f6d('0xa')][_0x9f6d('0xc')]);return _0x350053(_0x36e3cb[_0x9f6d('0xa')][_0x9f6d('0xc')]);}else{logger[_0x9f6d('0x8')](_0x9f6d('0xb'),_0x28f51c,'request\x20sent');_0x350053(_0x36e3cb['result'][_0x9f6d('0xc')]);}})['catch'](function(_0x2ad3a9){logger[_0x9f6d('0xa')]('CannedAnswer,\x20%s,\x20%s',_0x28f51c,_0x2ad3a9);_0x43a7d7(_0x2ad3a9);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index d369f66..11e16ba 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 _0x57b5=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x44216d,_0x4938a7){var _0xeca523=function(_0x11faf1){while(--_0x11faf1){_0x44216d['push'](_0x44216d['shift']());}};_0xeca523(++_0x4938a7);}(_0x57b5,0x1bc));var _0x557b=function(_0x505df9,_0x14138e){_0x505df9=_0x505df9-0x0;var _0x1cc025=_0x57b5[_0x505df9];return _0x1cc025;};'use strict';var multer=require('multer');var util=require(_0x557b('0x0'));var path=require(_0x557b('0x1'));var timeout=require(_0x557b('0x2'));var express=require(_0x557b('0x3'));var router=express[_0x557b('0x4')]();var auth=require(_0x557b('0x5'));var interaction=require(_0x557b('0x6'));var config=require(_0x557b('0x7'));var controller=require('./cannedAnswer.controller');router[_0x557b('0x8')]('/',auth[_0x557b('0x9')](),controller[_0x557b('0xa')]);router[_0x557b('0x8')](_0x557b('0xb'),auth[_0x557b('0x9')](),controller[_0x557b('0xc')]);router[_0x557b('0xd')]('/',auth[_0x557b('0x9')](),controller['create']);router[_0x557b('0xe')](_0x557b('0xb'),auth['isAuthenticated'](),controller[_0x557b('0xf')]);router['delete'](_0x557b('0xb'),auth['isAuthenticated'](),controller[_0x557b('0x10')]);module[_0x557b('0x11')]=router; \ No newline at end of file +var _0xa0a1=['express','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','destroy','multer','path','connect-timeout'];(function(_0x405dc0,_0x5f2898){var _0x1ed46d=function(_0x5efad7){while(--_0x5efad7){_0x405dc0['push'](_0x405dc0['shift']());}};_0x1ed46d(++_0x5f2898);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x293d88,_0x21a47c){_0x293d88=_0x293d88-0x0;var _0x3c53b7=_0xa0a1[_0x293d88];return _0x3c53b7;};'use strict';var multer=require(_0x1a0a('0x0'));var util=require('util');var path=require(_0x1a0a('0x1'));var timeout=require(_0x1a0a('0x2'));var express=require(_0x1a0a('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1a0a('0x4'));var config=require(_0x1a0a('0x5'));var controller=require('./cannedAnswer.controller');router[_0x1a0a('0x6')]('/',auth[_0x1a0a('0x7')](),controller['index']);router[_0x1a0a('0x6')](_0x1a0a('0x8'),auth[_0x1a0a('0x7')](),controller[_0x1a0a('0x9')]);router[_0x1a0a('0xa')]('/',auth['isAuthenticated'](),controller[_0x1a0a('0xb')]);router[_0x1a0a('0xc')](_0x1a0a('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x1a0a('0x8'),auth[_0x1a0a('0x7')](),controller[_0x1a0a('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 5df80e2..fad949b 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 _0x680b=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x680b,0xd7));var _0xb680=function(_0x28040e,_0x38d2eb){_0x28040e=_0x28040e-0x0;var _0x10c801=_0x680b[_0x28040e];return _0x10c801;};'use strict';var Sequelize=require(_0xb680('0x0'));module[_0xb680('0x1')]={'calldate':{'type':Sequelize[_0xb680('0x2')],'allowNull':![],'defaultValue':_0xb680('0x3')},'clid':{'type':Sequelize[_0xb680('0x4')]},'src':{'type':Sequelize[_0xb680('0x4')]},'dst':{'type':Sequelize[_0xb680('0x4')]},'dcontext':{'type':Sequelize[_0xb680('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xb680('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xb680('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xb680('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb680('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xb680('0x4')]},'userfield':{'type':Sequelize[_0xb680('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xb680('0x4')]},'sequence':{'type':Sequelize[_0xb680('0x4')]},'peeraccount':{'type':Sequelize[_0xb680('0x4')]},'type':{'type':Sequelize[_0xb680('0x4')]},'tag':{'type':Sequelize[_0xb680('0x4')]}}; \ No newline at end of file +var _0xc747=['INTEGER','sequelize','STRING'];(function(_0x5af6eb,_0x4dcee0){var _0x29b21f=function(_0x46c873){while(--_0x46c873){_0x5af6eb['push'](_0x5af6eb['shift']());}};_0x29b21f(++_0x4dcee0);}(_0xc747,0x76));var _0x7c74=function(_0x1fb7c9,_0xb14ddf){_0x1fb7c9=_0x1fb7c9-0x0;var _0x5f0c3a=_0xc747[_0x1fb7c9];return _0x5f0c3a;};'use strict';var Sequelize=require(_0x7c74('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x7c74('0x1')]},'dcontext':{'type':Sequelize[_0x7c74('0x1')]},'channel':{'type':Sequelize[_0x7c74('0x1')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x7c74('0x1')]},'lastdata':{'type':Sequelize[_0x7c74('0x1')]},'duration':{'type':Sequelize[_0x7c74('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x7c74('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7c74('0x1')]},'amaflags':{'type':Sequelize[_0x7c74('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x7c74('0x1')]},'userfield':{'type':Sequelize[_0x7c74('0x1')]},'uniqueid':{'type':Sequelize[_0x7c74('0x1')]},'linkedid':{'type':Sequelize[_0x7c74('0x1')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x7c74('0x1')]},'type':{'type':Sequelize[_0x7c74('0x1')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 103ec7f..3ab9637 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 _0x076f=['html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','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','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','include','findAll','catch','params','includeAll','find','create','body','describe'];(function(_0x8a97e,_0x334a3d){var _0x300074=function(_0x1e77dc){while(--_0x1e77dc){_0x8a97e['push'](_0x8a97e['shift']());}};_0x300074(++_0x334a3d);}(_0x076f,0x1d4));var _0xf076=function(_0x5d6b41,_0x3d1c8f){_0x5d6b41=_0x5d6b41-0x0;var _0x1c2dd6=_0x076f[_0x5d6b41];return _0x1c2dd6;};'use strict';var pdf=require(_0xf076('0x0'));var emlformat=require(_0xf076('0x1'));var rimraf=require(_0xf076('0x2'));var zipdir=require(_0xf076('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf076('0x4'));var moment=require(_0xf076('0x5'));var BPromise=require(_0xf076('0x6'));var Mustache=require(_0xf076('0x7'));var util=require(_0xf076('0x8'));var path=require(_0xf076('0x9'));var sox=require(_0xf076('0xa'));var csv=require(_0xf076('0xb'));var ejs=require(_0xf076('0xc'));var fs=require('fs');var _=require(_0xf076('0xd'));var squel=require(_0xf076('0xe'));var crypto=require(_0xf076('0xf'));var jsforce=require(_0xf076('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf076('0xb'));var querystring=require('querystring');var Papa=require(_0xf076('0x11'));var Redis=require('ioredis');var authService=require(_0xf076('0x12'));var qs=require(_0xf076('0x13'));var as=require(_0xf076('0x14'));var hardwareService=require(_0xf076('0x15'));var logger=require(_0xf076('0x16'))(_0xf076('0x17'));var utils=require('../../config/utils');var config=require(_0xf076('0x18'));var licenseUtil=require(_0xf076('0x19'));var db=require(_0xf076('0x1a'))['db'];function respondWithStatusCode(_0x2be026,_0x42a425){_0x42a425=_0x42a425||0xcc;return function(_0x2a3995){if(_0x2a3995){return _0x2be026[_0xf076('0x1b')](_0x42a425);}return _0x2be026[_0xf076('0x1c')](_0x42a425)[_0xf076('0x1d')]();};}function respondWithResult(_0x5b2ac6,_0x3fb4ba){_0x3fb4ba=_0x3fb4ba||0xc8;return function(_0x154cf4){if(_0x154cf4){return _0x5b2ac6[_0xf076('0x1c')](_0x3fb4ba)[_0xf076('0x1e')](_0x154cf4);}};}function respondWithFilteredResult(_0xc3ef2a,_0x186d02){return function(_0x4e4783){if(_0x4e4783){var _0x1a82a9=_0x4e4783[_0xf076('0x1f')],_0x9641c4=_0x186d02['offset'],_0x5048c0=_0x186d02[_0xf076('0x20')]+_0x186d02[_0xf076('0x21')],_0x219f4f;if(_0x5048c0>=_0x1a82a9){_0x5048c0=_0x1a82a9;_0x219f4f=0xc8;}else{_0x219f4f=0xce;}_0xc3ef2a['status'](_0x219f4f);return _0xc3ef2a[_0xf076('0x22')](_0xf076('0x23'),_0x9641c4+'-'+_0x5048c0+'/'+_0x1a82a9)['json'](_0x4e4783);}return null;};}function patchUpdates(_0x47fbc4){return function(_0xe6ec29){try{jsonpatch[_0xf076('0x24')](_0xe6ec29,_0x47fbc4,!![]);}catch(_0x3affbc){return BPromise[_0xf076('0x25')](_0x3affbc);}return _0xe6ec29[_0xf076('0x26')]();};}function saveUpdates(_0x16ea63,_0x206ddc){return function(_0x18fb76){if(_0x18fb76){return _0x18fb76[_0xf076('0x27')](_0x16ea63)[_0xf076('0x28')](function(_0x2e785f){return _0x2e785f;});}return null;};}function removeEntity(_0x531324,_0xa83394){return function(_0x2ddad1){if(_0x2ddad1){return _0x2ddad1[_0xf076('0x29')]()[_0xf076('0x28')](function(){_0x531324[_0xf076('0x1c')](0xcc)[_0xf076('0x1d')]();});}};}function handleEntityNotFound(_0x493828,_0x28ac7e){return function(_0x5a7c9a){if(!_0x5a7c9a){_0x493828[_0xf076('0x1b')](0x194);}return _0x5a7c9a;};}function handleError(_0x44aed7,_0x3a4f19){_0x3a4f19=_0x3a4f19||0x1f4;return function(_0x1308a6){logger[_0xf076('0x2a')](_0x1308a6[_0xf076('0x2b')]);if(_0x1308a6[_0xf076('0x2c')]){delete _0x1308a6[_0xf076('0x2c')];}_0x44aed7[_0xf076('0x1c')](_0x3a4f19)[_0xf076('0x2d')](_0x1308a6);};}exports[_0xf076('0x2e')]=function(_0x51a73d,_0x37ae96){var _0x1e7a31={},_0x4a8154={},_0x16c72f={'count':0x0,'rows':[]};var _0x424c43=_[_0xf076('0x2f')](db[_0xf076('0x30')][_0xf076('0x31')],function(_0xf001db){return{'name':_0xf001db[_0xf076('0x32')],'type':_0xf001db[_0xf076('0x33')]['key']};});_0x4a8154[_0xf076('0x34')]=_['map'](_0x424c43,_0xf076('0x2c'));_0x4a8154[_0xf076('0x35')]=_[_0xf076('0x36')](_0x51a73d['query']);_0x4a8154['filters']=_['intersection'](_0x4a8154[_0xf076('0x34')],_0x4a8154['query']);_0x1e7a31[_0xf076('0x37')]=_[_0xf076('0x38')](_0x4a8154[_0xf076('0x34')],qs[_0xf076('0x39')](_0x51a73d[_0xf076('0x35')]['fields']));_0x1e7a31[_0xf076('0x37')]=_0x1e7a31[_0xf076('0x37')][_0xf076('0x3a')]?_0x1e7a31[_0xf076('0x37')]:_0x4a8154[_0xf076('0x34')];if(!_0x51a73d['query']['hasOwnProperty'](_0xf076('0x3b'))){_0x1e7a31['limit']=qs[_0xf076('0x21')](_0x51a73d['query']['limit']);_0x1e7a31[_0xf076('0x20')]=qs[_0xf076('0x20')](_0x51a73d['query'][_0xf076('0x20')]);}_0x1e7a31[_0xf076('0x3c')]=qs['sort'](_0x51a73d[_0xf076('0x35')][_0xf076('0x3d')]);_0x1e7a31[_0xf076('0x3e')]=qs['filters'](_[_0xf076('0x3f')](_0x51a73d[_0xf076('0x35')],_0x4a8154[_0xf076('0x40')]),_0x424c43);if(_0x51a73d['query']['filter']){_0x1e7a31[_0xf076('0x3e')]=_[_0xf076('0x41')](_0x1e7a31[_0xf076('0x3e')],{'$or':_[_0xf076('0x2f')](_0x424c43,function(_0x38f4e8){if(_0x38f4e8[_0xf076('0x33')]!==_0xf076('0x42')){var _0x317050={};_0x317050[_0x38f4e8[_0xf076('0x2c')]]={'$like':'%'+_0x51a73d[_0xf076('0x35')][_0xf076('0x43')]+'%'};return _0x317050;}})});}_0x1e7a31=_[_0xf076('0x41')]({},_0x1e7a31,_0x51a73d[_0xf076('0x44')]);var _0x1d7981={'where':_0x1e7a31[_0xf076('0x3e')]};return db[_0xf076('0x30')][_0xf076('0x1f')](_0x1d7981)[_0xf076('0x28')](function(_0x4fdcd1){_0x16c72f['count']=_0x4fdcd1;if(_0x51a73d[_0xf076('0x35')]['includeAll']){_0x1e7a31[_0xf076('0x45')]=[{'all':!![]}];}return db['Cdr'][_0xf076('0x46')](_0x1e7a31);})[_0xf076('0x28')](function(_0x11394e){_0x16c72f['rows']=_0x11394e;return _0x16c72f;})[_0xf076('0x28')](respondWithFilteredResult(_0x37ae96,_0x1e7a31))[_0xf076('0x47')](handleError(_0x37ae96,null));};exports['show']=function(_0x47bf86,_0x654d3b){var _0x2ebbc3={'raw':!![],'where':{'id':_0x47bf86[_0xf076('0x48')]['id']}},_0x5a4415={};_0x5a4415[_0xf076('0x34')]=_['keys'](db[_0xf076('0x30')][_0xf076('0x31')]);_0x5a4415[_0xf076('0x35')]=_[_0xf076('0x36')](_0x47bf86[_0xf076('0x35')]);_0x5a4415[_0xf076('0x40')]=_[_0xf076('0x38')](_0x5a4415['model'],_0x5a4415[_0xf076('0x35')]);_0x2ebbc3[_0xf076('0x37')]=_[_0xf076('0x38')](_0x5a4415['model'],qs[_0xf076('0x39')](_0x47bf86[_0xf076('0x35')]['fields']));_0x2ebbc3['attributes']=_0x2ebbc3[_0xf076('0x37')][_0xf076('0x3a')]?_0x2ebbc3[_0xf076('0x37')]:_0x5a4415[_0xf076('0x34')];if(_0x47bf86[_0xf076('0x35')][_0xf076('0x49')]){_0x2ebbc3[_0xf076('0x45')]=[{'all':!![]}];}_0x2ebbc3=_[_0xf076('0x41')]({},_0x2ebbc3,_0x47bf86['options']);return db[_0xf076('0x30')][_0xf076('0x4a')](_0x2ebbc3)[_0xf076('0x28')](handleEntityNotFound(_0x654d3b,null))[_0xf076('0x28')](respondWithResult(_0x654d3b,null))[_0xf076('0x47')](handleError(_0x654d3b,null));};exports[_0xf076('0x4b')]=function(_0x4a45b1,_0x77582c){return db[_0xf076('0x30')]['create'](_0x4a45b1['body'],{})[_0xf076('0x28')](respondWithResult(_0x77582c,0xc9))['catch'](handleError(_0x77582c,null));};exports[_0xf076('0x27')]=function(_0x59fa27,_0x2bb908){if(_0x59fa27[_0xf076('0x4c')]['id']){delete _0x59fa27[_0xf076('0x4c')]['id'];}return db['Cdr'][_0xf076('0x4a')]({'where':{'id':_0x59fa27['params']['id']}})[_0xf076('0x28')](handleEntityNotFound(_0x2bb908,null))[_0xf076('0x28')](saveUpdates(_0x59fa27[_0xf076('0x4c')],null))[_0xf076('0x28')](respondWithResult(_0x2bb908,null))['catch'](handleError(_0x2bb908,null));};exports[_0xf076('0x29')]=function(_0x38800c,_0x269eaf){return db[_0xf076('0x30')][_0xf076('0x4a')]({'where':{'id':_0x38800c[_0xf076('0x48')]['id']}})[_0xf076('0x28')](handleEntityNotFound(_0x269eaf,null))['then'](removeEntity(_0x269eaf,null))['catch'](handleError(_0x269eaf,null));};exports[_0xf076('0x4d')]=function(_0x4dbd68,_0x2180f7){return db[_0xf076('0x30')][_0xf076('0x4d')]()[_0xf076('0x28')](respondWithResult(_0x2180f7,null))['catch'](handleError(_0x2180f7,null));}; \ No newline at end of file +var _0xe4d4=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','json','apply','reject','update','then','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','catch','show','params','include','find','create','body','destroy','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x313025,_0x643fac){var _0x5dc8c9=function(_0x2ab3c7){while(--_0x2ab3c7){_0x313025['push'](_0x313025['shift']());}};_0x5dc8c9(++_0x643fac);}(_0xe4d4,0x192));var _0x4e4d=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0xe4d4[_0x380307];return _0x9ea14b;};'use strict';var pdf=require(_0x4e4d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4e4d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4e4d('0x2'));var rp=require(_0x4e4d('0x3'));var moment=require(_0x4e4d('0x4'));var BPromise=require(_0x4e4d('0x5'));var Mustache=require('mustache');var util=require(_0x4e4d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x4e4d('0x7'));var ejs=require(_0x4e4d('0x8'));var fs=require('fs');var _=require(_0x4e4d('0x9'));var squel=require('squel');var crypto=require(_0x4e4d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4e4d('0xb'));var toCsv=require(_0x4e4d('0x7'));var querystring=require('querystring');var Papa=require(_0x4e4d('0xc'));var Redis=require(_0x4e4d('0xd'));var authService=require(_0x4e4d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4e4d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e4d('0x10'))(_0x4e4d('0x11'));var utils=require(_0x4e4d('0x12'));var config=require(_0x4e4d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4e4d('0x14'))['db'];function respondWithStatusCode(_0x4126cc,_0x1a50c0){_0x1a50c0=_0x1a50c0||0xcc;return function(_0x30ea92){if(_0x30ea92){return _0x4126cc[_0x4e4d('0x15')](_0x1a50c0);}return _0x4126cc[_0x4e4d('0x16')](_0x1a50c0)[_0x4e4d('0x17')]();};}function respondWithResult(_0x526a51,_0x43b5d4){_0x43b5d4=_0x43b5d4||0xc8;return function(_0x54886b){if(_0x54886b){return _0x526a51['status'](_0x43b5d4)['json'](_0x54886b);}};}function respondWithFilteredResult(_0x155933,_0x3574e2){return function(_0x2fa22d){if(_0x2fa22d){var _0x44c75c=_0x2fa22d[_0x4e4d('0x18')],_0x519e73=_0x3574e2[_0x4e4d('0x19')],_0x13ffff=_0x3574e2[_0x4e4d('0x19')]+_0x3574e2['limit'],_0xd2933d;if(_0x13ffff>=_0x44c75c){_0x13ffff=_0x44c75c;_0xd2933d=0xc8;}else{_0xd2933d=0xce;}_0x155933[_0x4e4d('0x16')](_0xd2933d);return _0x155933[_0x4e4d('0x1a')]('Content-Range',_0x519e73+'-'+_0x13ffff+'/'+_0x44c75c)[_0x4e4d('0x1b')](_0x2fa22d);}return null;};}function patchUpdates(_0x323328){return function(_0x26fdf6){try{jsonpatch[_0x4e4d('0x1c')](_0x26fdf6,_0x323328,!![]);}catch(_0x142db5){return BPromise[_0x4e4d('0x1d')](_0x142db5);}return _0x26fdf6['save']();};}function saveUpdates(_0x33acc7,_0x1801ac){return function(_0x37017c){if(_0x37017c){return _0x37017c[_0x4e4d('0x1e')](_0x33acc7)['then'](function(_0x3beb65){return _0x3beb65;});}return null;};}function removeEntity(_0x1fbd82,_0x2d0950){return function(_0x2a01e0){if(_0x2a01e0){return _0x2a01e0['destroy']()[_0x4e4d('0x1f')](function(){_0x1fbd82[_0x4e4d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d3fe8,_0x4a7a4e){return function(_0x2beb18){if(!_0x2beb18){_0x5d3fe8[_0x4e4d('0x15')](0x194);}return _0x2beb18;};}function handleError(_0x181d97,_0x40fa3e){_0x40fa3e=_0x40fa3e||0x1f4;return function(_0x43b21b){logger[_0x4e4d('0x20')](_0x43b21b[_0x4e4d('0x21')]);if(_0x43b21b[_0x4e4d('0x22')]){delete _0x43b21b[_0x4e4d('0x22')];}_0x181d97[_0x4e4d('0x16')](_0x40fa3e)[_0x4e4d('0x23')](_0x43b21b);};}exports[_0x4e4d('0x24')]=function(_0x36b72b,_0x1a1298){var _0x1d9c37={},_0x10cc29={},_0x2ce2a7={'count':0x0,'rows':[]};var _0x26fc55=_[_0x4e4d('0x25')](db[_0x4e4d('0x26')][_0x4e4d('0x27')],function(_0x4df318){return{'name':_0x4df318[_0x4e4d('0x28')],'type':_0x4df318[_0x4e4d('0x29')][_0x4e4d('0x2a')]};});_0x10cc29[_0x4e4d('0x2b')]=_[_0x4e4d('0x25')](_0x26fc55,_0x4e4d('0x22'));_0x10cc29[_0x4e4d('0x2c')]=_[_0x4e4d('0x2d')](_0x36b72b['query']);_0x10cc29['filters']=_[_0x4e4d('0x2e')](_0x10cc29[_0x4e4d('0x2b')],_0x10cc29[_0x4e4d('0x2c')]);_0x1d9c37[_0x4e4d('0x2f')]=_['intersection'](_0x10cc29[_0x4e4d('0x2b')],qs['fields'](_0x36b72b[_0x4e4d('0x2c')][_0x4e4d('0x30')]));_0x1d9c37[_0x4e4d('0x2f')]=_0x1d9c37['attributes'][_0x4e4d('0x31')]?_0x1d9c37[_0x4e4d('0x2f')]:_0x10cc29[_0x4e4d('0x2b')];if(!_0x36b72b[_0x4e4d('0x2c')]['hasOwnProperty'](_0x4e4d('0x32'))){_0x1d9c37[_0x4e4d('0x33')]=qs['limit'](_0x36b72b[_0x4e4d('0x2c')][_0x4e4d('0x33')]);_0x1d9c37[_0x4e4d('0x19')]=qs['offset'](_0x36b72b[_0x4e4d('0x2c')][_0x4e4d('0x19')]);}_0x1d9c37[_0x4e4d('0x34')]=qs[_0x4e4d('0x35')](_0x36b72b[_0x4e4d('0x2c')][_0x4e4d('0x35')]);_0x1d9c37[_0x4e4d('0x36')]=qs[_0x4e4d('0x37')](_[_0x4e4d('0x38')](_0x36b72b[_0x4e4d('0x2c')],_0x10cc29[_0x4e4d('0x37')]),_0x26fc55);if(_0x36b72b['query']['filter']){_0x1d9c37[_0x4e4d('0x36')]=_[_0x4e4d('0x39')](_0x1d9c37[_0x4e4d('0x36')],{'$or':_[_0x4e4d('0x25')](_0x26fc55,function(_0x4c974){if(_0x4c974[_0x4e4d('0x29')]!==_0x4e4d('0x3a')){var _0x37f6f7={};_0x37f6f7[_0x4c974[_0x4e4d('0x22')]]={'$like':'%'+_0x36b72b[_0x4e4d('0x2c')]['filter']+'%'};return _0x37f6f7;}})});}_0x1d9c37=_['merge']({},_0x1d9c37,_0x36b72b[_0x4e4d('0x3b')]);var _0x357f03={'where':_0x1d9c37[_0x4e4d('0x36')]};return db[_0x4e4d('0x26')]['count'](_0x357f03)[_0x4e4d('0x1f')](function(_0x2256f9){_0x2ce2a7[_0x4e4d('0x18')]=_0x2256f9;if(_0x36b72b[_0x4e4d('0x2c')][_0x4e4d('0x3c')]){_0x1d9c37['include']=[{'all':!![]}];}return db[_0x4e4d('0x26')]['findAll'](_0x1d9c37);})[_0x4e4d('0x1f')](function(_0x1d4638){_0x2ce2a7['rows']=_0x1d4638;return _0x2ce2a7;})[_0x4e4d('0x1f')](respondWithFilteredResult(_0x1a1298,_0x1d9c37))[_0x4e4d('0x3d')](handleError(_0x1a1298,null));};exports[_0x4e4d('0x3e')]=function(_0x433930,_0x39ffae){var _0x492b03={'raw':!![],'where':{'id':_0x433930[_0x4e4d('0x3f')]['id']}},_0x1c49ad={};_0x1c49ad[_0x4e4d('0x2b')]=_[_0x4e4d('0x2d')](db[_0x4e4d('0x26')]['rawAttributes']);_0x1c49ad['query']=_[_0x4e4d('0x2d')](_0x433930[_0x4e4d('0x2c')]);_0x1c49ad['filters']=_[_0x4e4d('0x2e')](_0x1c49ad[_0x4e4d('0x2b')],_0x1c49ad['query']);_0x492b03[_0x4e4d('0x2f')]=_['intersection'](_0x1c49ad[_0x4e4d('0x2b')],qs[_0x4e4d('0x30')](_0x433930['query'][_0x4e4d('0x30')]));_0x492b03[_0x4e4d('0x2f')]=_0x492b03[_0x4e4d('0x2f')][_0x4e4d('0x31')]?_0x492b03[_0x4e4d('0x2f')]:_0x1c49ad[_0x4e4d('0x2b')];if(_0x433930['query'][_0x4e4d('0x3c')]){_0x492b03[_0x4e4d('0x40')]=[{'all':!![]}];}_0x492b03=_[_0x4e4d('0x39')]({},_0x492b03,_0x433930[_0x4e4d('0x3b')]);return db[_0x4e4d('0x26')][_0x4e4d('0x41')](_0x492b03)['then'](handleEntityNotFound(_0x39ffae,null))[_0x4e4d('0x1f')](respondWithResult(_0x39ffae,null))[_0x4e4d('0x3d')](handleError(_0x39ffae,null));};exports[_0x4e4d('0x42')]=function(_0x135c4d,_0x3cad10){return db[_0x4e4d('0x26')][_0x4e4d('0x42')](_0x135c4d[_0x4e4d('0x43')],{})[_0x4e4d('0x1f')](respondWithResult(_0x3cad10,0xc9))['catch'](handleError(_0x3cad10,null));};exports[_0x4e4d('0x1e')]=function(_0x5c5aea,_0x27427d){if(_0x5c5aea[_0x4e4d('0x43')]['id']){delete _0x5c5aea['body']['id'];}return db[_0x4e4d('0x26')][_0x4e4d('0x41')]({'where':{'id':_0x5c5aea['params']['id']}})[_0x4e4d('0x1f')](handleEntityNotFound(_0x27427d,null))[_0x4e4d('0x1f')](saveUpdates(_0x5c5aea['body'],null))[_0x4e4d('0x1f')](respondWithResult(_0x27427d,null))[_0x4e4d('0x3d')](handleError(_0x27427d,null));};exports[_0x4e4d('0x44')]=function(_0x5bdf65,_0x3ce5f5){return db[_0x4e4d('0x26')][_0x4e4d('0x41')]({'where':{'id':_0x5bdf65[_0x4e4d('0x3f')]['id']}})[_0x4e4d('0x1f')](handleEntityNotFound(_0x3ce5f5,null))[_0x4e4d('0x1f')](removeEntity(_0x3ce5f5,null))[_0x4e4d('0x3d')](handleError(_0x3ce5f5,null));};exports[_0x4e4d('0x45')]=function(_0x4e9640,_0x334e9e){return db[_0x4e4d('0x26')][_0x4e4d('0x45')]()[_0x4e4d('0x1f')](respondWithResult(_0x334e9e,null))[_0x4e4d('0x3d')](handleError(_0x334e9e,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 9308515..1b1f3ab 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 _0x33af=['src','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst'];(function(_0x59311c,_0x337c8a){var _0x1f7b2a=function(_0x4cda88){while(--_0x4cda88){_0x59311c['push'](_0x59311c['shift']());}};_0x1f7b2a(++_0x337c8a);}(_0x33af,0xec));var _0xf33a=function(_0x1ac562,_0x270a2d){_0x1ac562=_0x1ac562-0x0;var _0x483610=_0x33af[_0x1ac562];return _0x483610;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var logger=require('../../config/logger')(_0xf33a('0x1'));var moment=require(_0xf33a('0x2'));var BPromise=require(_0xf33a('0x3'));var rp=require(_0xf33a('0x4'));var fs=require('fs');var path=require(_0xf33a('0x5'));var rimraf=require(_0xf33a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf33a('0x7'));module[_0xf33a('0x8')]=function(_0x583e54,_0xc0dd13){return _0x583e54[_0xf33a('0x9')](_0xf33a('0xa'),attributes,{'tableName':_0xf33a('0xb'),'paranoid':![],'indexes':[{'name':_0xf33a('0xc'),'fields':[_0xf33a('0xc')]},{'name':'calldate','fields':[_0xf33a('0xd')]},{'name':_0xf33a('0xe'),'fields':[_0xf33a('0xe')]},{'name':_0xf33a('0xf'),'fields':[_0xf33a('0xf')]},{'name':_0xf33a('0x10'),'fields':['src']},{'name':'uniqueid','fields':[_0xf33a('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1623=['disposition','src','uniqueid','lodash','api','moment','bluebird','request-promise','path','./cdr.attributes','Cdr','cdr','accountcode','calldate'];(function(_0x5ddf45,_0x3ec271){var _0x560fc0=function(_0x100bd6){while(--_0x100bd6){_0x5ddf45['push'](_0x5ddf45['shift']());}};_0x560fc0(++_0x3ec271);}(_0x1623,0xab));var _0x3162=function(_0x44def1,_0x459fb8){_0x44def1=_0x44def1-0x0;var _0x43fa48=_0x1623[_0x44def1];return _0x43fa48;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3162('0x1'));var moment=require(_0x3162('0x2'));var BPromise=require(_0x3162('0x3'));var rp=require(_0x3162('0x4'));var fs=require('fs');var path=require(_0x3162('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3162('0x6'));module['exports']=function(_0x1b55f2,_0x428de6){return _0x1b55f2['define'](_0x3162('0x7'),attributes,{'tableName':_0x3162('0x8'),'paranoid':![],'indexes':[{'name':_0x3162('0x9'),'fields':[_0x3162('0x9')]},{'name':_0x3162('0xa'),'fields':[_0x3162('0xa')]},{'name':_0x3162('0xb'),'fields':[_0x3162('0xb')]},{'name':'dst','fields':['dst']},{'name':_0x3162('0xc'),'fields':[_0x3162('0xc')]},{'name':_0x3162('0xd'),'fields':[_0x3162('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 12754c6..438e24b 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 _0x4e58=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x5cf1a1,_0x1ab924){var _0x52cbcc=function(_0xdc1230){while(--_0xdc1230){_0x5cf1a1['push'](_0x5cf1a1['shift']());}};_0x52cbcc(++_0x1ab924);}(_0x4e58,0xa2));var _0x84e5=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0x4e58[_0x1bc0ae];return _0x501104;};'use strict';var _=require('lodash');var util=require(_0x84e5('0x0'));var moment=require(_0x84e5('0x1'));var BPromise=require(_0x84e5('0x2'));var rs=require(_0x84e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x84e5('0x4'))['db'];var utils=require(_0x84e5('0x5'));var logger=require(_0x84e5('0x6'))(_0x84e5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x84e5('0x8')][_0x84e5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cd4a8,_0x5e2b91,_0x32c54d){return new BPromise(function(_0x28b3fc,_0x2c7d84){return client[_0x84e5('0xa')](_0x1cd4a8,_0x32c54d)[_0x84e5('0xb')](function(_0x3f66c3){logger['info'](_0x84e5('0xc'),_0x5e2b91,'request\x20sent');logger[_0x84e5('0xd')](_0x84e5('0xe'),_0x5e2b91,_0x84e5('0xf'),JSON[_0x84e5('0x10')](_0x3f66c3));if(_0x3f66c3[_0x84e5('0x11')]){if(_0x3f66c3[_0x84e5('0x11')][_0x84e5('0x12')]===0x1f4){logger['error'](_0x84e5('0xc'),_0x5e2b91,_0x3f66c3[_0x84e5('0x11')][_0x84e5('0x13')]);return _0x2c7d84(_0x3f66c3['error'][_0x84e5('0x13')]);}logger[_0x84e5('0x11')](_0x84e5('0xc'),_0x5e2b91,_0x3f66c3['error'][_0x84e5('0x13')]);return _0x28b3fc(_0x3f66c3['error'][_0x84e5('0x13')]);}else{logger[_0x84e5('0x14')](_0x84e5('0xc'),_0x5e2b91,_0x84e5('0xf'));_0x28b3fc(_0x3f66c3[_0x84e5('0x15')][_0x84e5('0x13')]);}})[_0x84e5('0x16')](function(_0x954aff){logger[_0x84e5('0x11')](_0x84e5('0xc'),_0x5e2b91,_0x954aff);_0x2c7d84(_0x954aff);});});} \ No newline at end of file +var _0x4d4c=['result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Cdr,\x20%s,\x20%s'];(function(_0x24e893,_0x130483){var _0x437e82=function(_0x5dbb8c){while(--_0x5dbb8c){_0x24e893['push'](_0x24e893['shift']());}};_0x437e82(++_0x130483);}(_0x4d4c,0xd4));var _0xc4d4=function(_0x29ae80,_0x3579f1){_0x29ae80=_0x29ae80-0x0;var _0x5d6d71=_0x4d4c[_0x29ae80];return _0x5d6d71;};'use strict';var _=require(_0xc4d4('0x0'));var util=require(_0xc4d4('0x1'));var moment=require('moment');var BPromise=require(_0xc4d4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4d4('0x3'));var db=require(_0xc4d4('0x4'))['db'];var utils=require(_0xc4d4('0x5'));var logger=require(_0xc4d4('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc4d4('0x7'));var client=jayson[_0xc4d4('0x8')][_0xc4d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b81a8,_0xc9943b,_0x5d0196){return new BPromise(function(_0x442190,_0x6371d4){return client['request'](_0x5b81a8,_0x5d0196)[_0xc4d4('0xa')](function(_0x28313c){logger[_0xc4d4('0xb')]('Cdr,\x20%s,\x20%s',_0xc9943b,'request\x20sent');logger['debug'](_0xc4d4('0xc'),_0xc9943b,_0xc4d4('0xd'),JSON[_0xc4d4('0xe')](_0x28313c));if(_0x28313c[_0xc4d4('0xf')]){if(_0x28313c[_0xc4d4('0xf')][_0xc4d4('0x10')]===0x1f4){logger[_0xc4d4('0xf')]('Cdr,\x20%s,\x20%s',_0xc9943b,_0x28313c['error'][_0xc4d4('0x11')]);return _0x6371d4(_0x28313c[_0xc4d4('0xf')][_0xc4d4('0x11')]);}logger[_0xc4d4('0xf')](_0xc4d4('0x12'),_0xc9943b,_0x28313c[_0xc4d4('0xf')]['message']);return _0x442190(_0x28313c[_0xc4d4('0xf')]['message']);}else{logger[_0xc4d4('0xb')]('Cdr,\x20%s,\x20%s',_0xc9943b,_0xc4d4('0xd'));_0x442190(_0x28313c[_0xc4d4('0x13')][_0xc4d4('0x11')]);}})[_0xc4d4('0x14')](function(_0x27c9f1){logger[_0xc4d4('0xf')](_0xc4d4('0x12'),_0xc9943b,_0x27c9f1);_0x6371d4(_0x27c9f1);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 292e33a..35635c4 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 _0xad0a=['delete','destroy','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','index','/describe','/:id','create','put','update'];(function(_0x474c66,_0xbce925){var _0xcbd9bf=function(_0x44019d){while(--_0x44019d){_0x474c66['push'](_0x474c66['shift']());}};_0xcbd9bf(++_0xbce925);}(_0xad0a,0x1e9));var _0xaad0=function(_0xd6b74f,_0x424ed6){_0xd6b74f=_0xd6b74f-0x0;var _0x4b0371=_0xad0a[_0xd6b74f];return _0x4b0371;};'use strict';var multer=require('multer');var util=require(_0xaad0('0x0'));var path=require(_0xaad0('0x1'));var timeout=require('connect-timeout');var express=require(_0xaad0('0x2'));var router=express[_0xaad0('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xaad0('0x4'));var config=require(_0xaad0('0x5'));var controller=require(_0xaad0('0x6'));router[_0xaad0('0x7')]('/',auth[_0xaad0('0x8')](),controller[_0xaad0('0x9')]);router[_0xaad0('0x7')](_0xaad0('0xa'),auth[_0xaad0('0x8')](),controller['describe']);router['get'](_0xaad0('0xb'),auth[_0xaad0('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xaad0('0xc')]);router[_0xaad0('0xd')](_0xaad0('0xb'),auth[_0xaad0('0x8')](),controller[_0xaad0('0xe')]);router[_0xaad0('0xf')]('/:id',auth[_0xaad0('0x8')](),controller[_0xaad0('0x10')]);module[_0xaad0('0x11')]=router; \ No newline at end of file +var _0x5d4f=['Router','../../components/interaction/service','../../config/environment','./cdr.controller','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','multer','connect-timeout','express'];(function(_0x159264,_0x5540de){var _0x2fd8e5=function(_0xd192fc){while(--_0xd192fc){_0x159264['push'](_0x159264['shift']());}};_0x2fd8e5(++_0x5540de);}(_0x5d4f,0x1dd));var _0xf5d4=function(_0x2c7c91,_0x4ebb5c){_0x2c7c91=_0x2c7c91-0x0;var _0x5ab590=_0x5d4f[_0x2c7c91];return _0x5ab590;};'use strict';var multer=require(_0xf5d4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf5d4('0x1'));var express=require(_0xf5d4('0x2'));var router=express[_0xf5d4('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf5d4('0x4'));var config=require(_0xf5d4('0x5'));var controller=require(_0xf5d4('0x6'));router['get']('/',auth[_0xf5d4('0x7')](),controller[_0xf5d4('0x8')]);router['get'](_0xf5d4('0x9'),auth[_0xf5d4('0x7')](),controller[_0xf5d4('0xa')]);router['get'](_0xf5d4('0xb'),auth[_0xf5d4('0x7')](),controller[_0xf5d4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf5d4('0xd')]);router[_0xf5d4('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xf5d4('0xf')]);router['delete'](_0xf5d4('0xb'),auth[_0xf5d4('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 1e2f4cc..27431f2 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 _0x7232=['*,*,*,*','sequelize','exports','INTEGER','TEXT','STRING'];(function(_0x5430ce,_0x21bb2e){var _0x3331b5=function(_0x32b195){while(--_0x32b195){_0x5430ce['push'](_0x5430ce['shift']());}};_0x3331b5(++_0x21bb2e);}(_0x7232,0x151));var _0x2723=function(_0x3912bf,_0xf10b0f){_0x3912bf=_0x3912bf-0x0;var _0xe85bc5=_0x7232[_0x3912bf];return _0xe85bc5;};'use strict';var Sequelize=require(_0x2723('0x0'));module[_0x2723('0x1')]={'priority':{'type':Sequelize[_0x2723('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2723('0x3')]()},'description':{'type':Sequelize[_0x2723('0x4')]},'interval':{'type':Sequelize[_0x2723('0x4')],'defaultValue':_0x2723('0x5')}}; \ No newline at end of file +var _0xcc42=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x1edfa,_0x30bb3d){var _0x47c0c1=function(_0x361120){while(--_0x361120){_0x1edfa['push'](_0x1edfa['shift']());}};_0x47c0c1(++_0x30bb3d);}(_0xcc42,0x9b));var _0x2cc4=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0xcc42[_0x30cd7e];return _0x462a02;};'use strict';var Sequelize=require(_0x2cc4('0x0'));module[_0x2cc4('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2cc4('0x2')],'allowNull':![],'defaultValue':_0x2cc4('0x3')},'appdata':{'type':Sequelize[_0x2cc4('0x4')]()},'description':{'type':Sequelize[_0x2cc4('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2cc4('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 89a7627..15a8e57 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 _0x4766=['fields','length','includeAll','include','merge','options','catch','body','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes'];(function(_0x71a6e0,_0x19ff83){var _0x264938=function(_0x598f5a){while(--_0x598f5a){_0x71a6e0['push'](_0x71a6e0['shift']());}};_0x264938(++_0x19ff83);}(_0x4766,0xe6));var _0x6476=function(_0x55bd19,_0x1409ee){_0x55bd19=_0x55bd19-0x0;var _0x30e1f1=_0x4766[_0x55bd19];return _0x30e1f1;};'use strict';var pdf=require(_0x6476('0x0'));var emlformat=require(_0x6476('0x1'));var rimraf=require(_0x6476('0x2'));var zipdir=require(_0x6476('0x3'));var jsonpatch=require(_0x6476('0x4'));var rp=require('request-promise');var moment=require(_0x6476('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6476('0x6'));var util=require(_0x6476('0x7'));var path=require(_0x6476('0x8'));var sox=require('sox');var csv=require(_0x6476('0x9'));var ejs=require(_0x6476('0xa'));var fs=require('fs');var _=require(_0x6476('0xb'));var squel=require(_0x6476('0xc'));var crypto=require(_0x6476('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6476('0x9'));var querystring=require(_0x6476('0xe'));var Papa=require('papaparse');var Redis=require(_0x6476('0xf'));var authService=require(_0x6476('0x10'));var qs=require(_0x6476('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6476('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x6476('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6476('0x14'))['db'];function respondWithStatusCode(_0x611cc3,_0x47a692){_0x47a692=_0x47a692||0xcc;return function(_0x3ea5ce){if(_0x3ea5ce){return _0x611cc3[_0x6476('0x15')](_0x47a692);}return _0x611cc3[_0x6476('0x16')](_0x47a692)[_0x6476('0x17')]();};}function respondWithResult(_0x57e428,_0x54aa39){_0x54aa39=_0x54aa39||0xc8;return function(_0x3459b2){if(_0x3459b2){return _0x57e428['status'](_0x54aa39)['json'](_0x3459b2);}};}function respondWithFilteredResult(_0x9f2c21,_0x387316){return function(_0x406a5e){if(_0x406a5e){var _0x1a8047=_0x406a5e['count'],_0x350c48=_0x387316[_0x6476('0x18')],_0xc55444=_0x387316[_0x6476('0x18')]+_0x387316[_0x6476('0x19')],_0xc8698b;if(_0xc55444>=_0x1a8047){_0xc55444=_0x1a8047;_0xc8698b=0xc8;}else{_0xc8698b=0xce;}_0x9f2c21[_0x6476('0x16')](_0xc8698b);return _0x9f2c21[_0x6476('0x1a')](_0x6476('0x1b'),_0x350c48+'-'+_0xc55444+'/'+_0x1a8047)['json'](_0x406a5e);}return null;};}function patchUpdates(_0x146dd2){return function(_0x34e953){try{jsonpatch[_0x6476('0x1c')](_0x34e953,_0x146dd2,!![]);}catch(_0x40359a){return BPromise[_0x6476('0x1d')](_0x40359a);}return _0x34e953[_0x6476('0x1e')]();};}function saveUpdates(_0x107d2e,_0x4cdfc6){return function(_0x124956){if(_0x124956){return _0x124956[_0x6476('0x1f')](_0x107d2e)[_0x6476('0x20')](function(_0xca8296){return _0xca8296;});}return null;};}function removeEntity(_0x10dcad,_0x53df1f){return function(_0x363dad){if(_0x363dad){return _0x363dad[_0x6476('0x21')]()['then'](function(){_0x10dcad[_0x6476('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa9e358,_0x3108ff){return function(_0x31a4dd){if(!_0x31a4dd){_0xa9e358[_0x6476('0x15')](0x194);}return _0x31a4dd;};}function handleError(_0x2cdf0d,_0x296173){_0x296173=_0x296173||0x1f4;return function(_0x316f55){logger[_0x6476('0x22')](_0x316f55[_0x6476('0x23')]);if(_0x316f55[_0x6476('0x24')]){delete _0x316f55['name'];}_0x2cdf0d[_0x6476('0x16')](_0x296173)['send'](_0x316f55);};}exports['show']=function(_0x51923f,_0x4f166e){var _0xd05b44={'raw':!![],'where':{'id':_0x51923f['params']['id']}},_0x3e2860={};_0x3e2860[_0x6476('0x25')]=_[_0x6476('0x26')](db[_0x6476('0x27')][_0x6476('0x28')]);_0x3e2860['query']=_['keys'](_0x51923f[_0x6476('0x29')]);_0x3e2860[_0x6476('0x2a')]=_[_0x6476('0x2b')](_0x3e2860[_0x6476('0x25')],_0x3e2860['query']);_0xd05b44[_0x6476('0x2c')]=_['intersection'](_0x3e2860[_0x6476('0x25')],qs[_0x6476('0x2d')](_0x51923f['query'][_0x6476('0x2d')]));_0xd05b44['attributes']=_0xd05b44[_0x6476('0x2c')][_0x6476('0x2e')]?_0xd05b44['attributes']:_0x3e2860[_0x6476('0x25')];if(_0x51923f[_0x6476('0x29')][_0x6476('0x2f')]){_0xd05b44[_0x6476('0x30')]=[{'all':!![]}];}_0xd05b44=_[_0x6476('0x31')]({},_0xd05b44,_0x51923f[_0x6476('0x32')]);return db[_0x6476('0x27')]['find'](_0xd05b44)['then'](handleEntityNotFound(_0x4f166e,null))[_0x6476('0x20')](respondWithResult(_0x4f166e,null))[_0x6476('0x33')](handleError(_0x4f166e,null));};exports['update']=function(_0x38a735,_0x4975ac){if(_0x38a735[_0x6476('0x34')]['id']){delete _0x38a735[_0x6476('0x34')]['id'];}return db['ChatApplication'][_0x6476('0x35')]({'where':{'id':_0x38a735[_0x6476('0x36')]['id']}})[_0x6476('0x20')](handleEntityNotFound(_0x4975ac,null))[_0x6476('0x20')](saveUpdates(_0x38a735['body'],null))['then'](respondWithResult(_0x4975ac,null))[_0x6476('0x33')](handleError(_0x4975ac,null));};exports[_0x6476('0x21')]=function(_0x2587b7,_0x426c09){return db[_0x6476('0x27')][_0x6476('0x35')]({'where':{'id':_0x2587b7[_0x6476('0x36')]['id']}})['then'](handleEntityNotFound(_0x426c09,null))[_0x6476('0x20')](removeEntity(_0x426c09,null))[_0x6476('0x33')](handleError(_0x426c09,null));}; \ No newline at end of file +var _0xe70c=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','show','params','ChatApplication','query','keys','model','attributes','intersection','fields','length','includeAll','include','merge','options','find','update','body','catch','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x23b19d,_0x443d14){var _0x5283f6=function(_0x5d4bb2){while(--_0x5d4bb2){_0x23b19d['push'](_0x23b19d['shift']());}};_0x5283f6(++_0x443d14);}(_0xe70c,0x1a8));var _0xce70=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xe70c[_0x2b10c6];return _0x3789d2;};'use strict';var pdf=require(_0xce70('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xce70('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce70('0x2'));var rp=require(_0xce70('0x3'));var moment=require('moment');var BPromise=require(_0xce70('0x4'));var Mustache=require(_0xce70('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xce70('0x6'));var ejs=require(_0xce70('0x7'));var fs=require('fs');var _=require(_0xce70('0x8'));var squel=require(_0xce70('0x9'));var crypto=require('crypto');var jsforce=require(_0xce70('0xa'));var deskjs=require(_0xce70('0xb'));var toCsv=require(_0xce70('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xce70('0xc'));var as=require(_0xce70('0xd'));var hardwareService=require(_0xce70('0xe'));var logger=require(_0xce70('0xf'))(_0xce70('0x10'));var utils=require(_0xce70('0x11'));var config=require(_0xce70('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xce70('0x13'))['db'];function respondWithStatusCode(_0x2b7b14,_0x31bb5a){_0x31bb5a=_0x31bb5a||0xcc;return function(_0x348245){if(_0x348245){return _0x2b7b14[_0xce70('0x14')](_0x31bb5a);}return _0x2b7b14[_0xce70('0x15')](_0x31bb5a)['end']();};}function respondWithResult(_0x13f84d,_0x391bc4){_0x391bc4=_0x391bc4||0xc8;return function(_0x1d2384){if(_0x1d2384){return _0x13f84d[_0xce70('0x15')](_0x391bc4)[_0xce70('0x16')](_0x1d2384);}};}function respondWithFilteredResult(_0x518944,_0x307ee4){return function(_0x3ad2ed){if(_0x3ad2ed){var _0x2c1bd0=_0x3ad2ed[_0xce70('0x17')],_0x540083=_0x307ee4['offset'],_0x40ab4f=_0x307ee4[_0xce70('0x18')]+_0x307ee4[_0xce70('0x19')],_0x1cecdf;if(_0x40ab4f>=_0x2c1bd0){_0x40ab4f=_0x2c1bd0;_0x1cecdf=0xc8;}else{_0x1cecdf=0xce;}_0x518944[_0xce70('0x15')](_0x1cecdf);return _0x518944[_0xce70('0x1a')](_0xce70('0x1b'),_0x540083+'-'+_0x40ab4f+'/'+_0x2c1bd0)['json'](_0x3ad2ed);}return null;};}function patchUpdates(_0x1e2699){return function(_0x43b0d4){try{jsonpatch[_0xce70('0x1c')](_0x43b0d4,_0x1e2699,!![]);}catch(_0x2c7f23){return BPromise[_0xce70('0x1d')](_0x2c7f23);}return _0x43b0d4[_0xce70('0x1e')]();};}function saveUpdates(_0x1cac42,_0x5743a9){return function(_0x3d814d){if(_0x3d814d){return _0x3d814d['update'](_0x1cac42)[_0xce70('0x1f')](function(_0x47a0cb){return _0x47a0cb;});}return null;};}function removeEntity(_0x3c1a61,_0x167329){return function(_0x2e68b5){if(_0x2e68b5){return _0x2e68b5[_0xce70('0x20')]()['then'](function(){_0x3c1a61[_0xce70('0x15')](0xcc)[_0xce70('0x21')]();});}};}function handleEntityNotFound(_0x3b83da,_0x579595){return function(_0x38283d){if(!_0x38283d){_0x3b83da[_0xce70('0x14')](0x194);}return _0x38283d;};}function handleError(_0x534475,_0x23ef5e){_0x23ef5e=_0x23ef5e||0x1f4;return function(_0xca4b19){logger[_0xce70('0x22')](_0xca4b19['stack']);if(_0xca4b19[_0xce70('0x23')]){delete _0xca4b19[_0xce70('0x23')];}_0x534475[_0xce70('0x15')](_0x23ef5e)[_0xce70('0x24')](_0xca4b19);};}exports[_0xce70('0x25')]=function(_0xb7c940,_0x471760){var _0x194109={'raw':!![],'where':{'id':_0xb7c940[_0xce70('0x26')]['id']}},_0x2216ee={};_0x2216ee['model']=_['keys'](db[_0xce70('0x27')]['rawAttributes']);_0x2216ee[_0xce70('0x28')]=_[_0xce70('0x29')](_0xb7c940['query']);_0x2216ee['filters']=_['intersection'](_0x2216ee[_0xce70('0x2a')],_0x2216ee[_0xce70('0x28')]);_0x194109[_0xce70('0x2b')]=_[_0xce70('0x2c')](_0x2216ee[_0xce70('0x2a')],qs['fields'](_0xb7c940[_0xce70('0x28')][_0xce70('0x2d')]));_0x194109['attributes']=_0x194109[_0xce70('0x2b')][_0xce70('0x2e')]?_0x194109['attributes']:_0x2216ee['model'];if(_0xb7c940['query'][_0xce70('0x2f')]){_0x194109[_0xce70('0x30')]=[{'all':!![]}];}_0x194109=_[_0xce70('0x31')]({},_0x194109,_0xb7c940[_0xce70('0x32')]);return db['ChatApplication'][_0xce70('0x33')](_0x194109)[_0xce70('0x1f')](handleEntityNotFound(_0x471760,null))[_0xce70('0x1f')](respondWithResult(_0x471760,null))['catch'](handleError(_0x471760,null));};exports[_0xce70('0x34')]=function(_0x361e04,_0x238975){if(_0x361e04[_0xce70('0x35')]['id']){delete _0x361e04['body']['id'];}return db[_0xce70('0x27')]['find']({'where':{'id':_0x361e04[_0xce70('0x26')]['id']}})['then'](handleEntityNotFound(_0x238975,null))[_0xce70('0x1f')](saveUpdates(_0x361e04[_0xce70('0x35')],null))['then'](respondWithResult(_0x238975,null))[_0xce70('0x36')](handleError(_0x238975,null));};exports['destroy']=function(_0x1a7646,_0x399fbb){return db[_0xce70('0x27')][_0xce70('0x33')]({'where':{'id':_0x1a7646[_0xce70('0x26')]['id']}})['then'](handleEntityNotFound(_0x399fbb,null))[_0xce70('0x1f')](removeEntity(_0x399fbb,null))['catch'](handleError(_0x399fbb,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 0fe3e03..14a5bc2 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 _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_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 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':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 914153b..e0d29f9 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 _0x1cbb=['ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x1cbb,0x17e));var _0xb1cb=function(_0x3a56e1,_0x9fe9e3){_0x3a56e1=_0x3a56e1-0x0;var _0x2a83bc=_0x1cbb[_0x3a56e1];return _0x2a83bc;};'use strict';var _=require(_0xb1cb('0x0'));var util=require(_0xb1cb('0x1'));var moment=require(_0xb1cb('0x2'));var BPromise=require(_0xb1cb('0x3'));var rs=require(_0xb1cb('0x4'));var fs=require('fs');var Redis=require(_0xb1cb('0x5'));var db=require(_0xb1cb('0x6'))['db'];var utils=require(_0xb1cb('0x7'));var logger=require(_0xb1cb('0x8'))('rpc');var config=require(_0xb1cb('0x9'));var jayson=require(_0xb1cb('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ee7b5,_0x445428,_0x1fdbfd){return new BPromise(function(_0x11e6a6,_0x516079){return client[_0xb1cb('0xb')](_0x3ee7b5,_0x1fdbfd)[_0xb1cb('0xc')](function(_0x5bb4e7){logger[_0xb1cb('0xd')](_0xb1cb('0xe'),_0x445428,_0xb1cb('0xf'));logger[_0xb1cb('0x10')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x445428,'request\x20sent',JSON[_0xb1cb('0x11')](_0x5bb4e7));if(_0x5bb4e7[_0xb1cb('0x12')]){if(_0x5bb4e7[_0xb1cb('0x12')][_0xb1cb('0x13')]===0x1f4){logger[_0xb1cb('0x12')](_0xb1cb('0xe'),_0x445428,_0x5bb4e7[_0xb1cb('0x12')]['message']);return _0x516079(_0x5bb4e7[_0xb1cb('0x12')][_0xb1cb('0x14')]);}logger['error'](_0xb1cb('0xe'),_0x445428,_0x5bb4e7[_0xb1cb('0x12')][_0xb1cb('0x14')]);return _0x11e6a6(_0x5bb4e7[_0xb1cb('0x12')][_0xb1cb('0x14')]);}else{logger[_0xb1cb('0xd')](_0xb1cb('0xe'),_0x445428,_0xb1cb('0xf'));_0x11e6a6(_0x5bb4e7[_0xb1cb('0x15')][_0xb1cb('0x14')]);}})['catch'](function(_0x47d9a1){logger[_0xb1cb('0x12')](_0xb1cb('0xe'),_0x445428,_0x47d9a1);_0x516079(_0x47d9a1);});});} \ No newline at end of file +var _0xad14=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x560c2f,_0x236d1c){var _0x398306=function(_0x45bc74){while(--_0x45bc74){_0x560c2f['push'](_0x560c2f['shift']());}};_0x398306(++_0x236d1c);}(_0xad14,0x10a));var _0x4ad1=function(_0x4914ad,_0x551a18){_0x4914ad=_0x4914ad-0x0;var _0x3cd61f=_0xad14[_0x4914ad];return _0x3cd61f;};'use strict';var _=require(_0x4ad1('0x0'));var util=require(_0x4ad1('0x1'));var moment=require(_0x4ad1('0x2'));var BPromise=require(_0x4ad1('0x3'));var rs=require(_0x4ad1('0x4'));var fs=require('fs');var Redis=require(_0x4ad1('0x5'));var db=require(_0x4ad1('0x6'))['db'];var utils=require(_0x4ad1('0x7'));var logger=require(_0x4ad1('0x8'))(_0x4ad1('0x9'));var config=require(_0x4ad1('0xa'));var jayson=require(_0x4ad1('0xb'));var client=jayson[_0x4ad1('0xc')][_0x4ad1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1bddd3,_0x548f20,_0x76c4ab){return new BPromise(function(_0x4c1315,_0x5b9850){return client[_0x4ad1('0xe')](_0x1bddd3,_0x76c4ab)[_0x4ad1('0xf')](function(_0x489b63){logger[_0x4ad1('0x10')](_0x4ad1('0x11'),_0x548f20,_0x4ad1('0x12'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x548f20,'request\x20sent',JSON[_0x4ad1('0x13')](_0x489b63));if(_0x489b63[_0x4ad1('0x14')]){if(_0x489b63[_0x4ad1('0x14')]['code']===0x1f4){logger['error'](_0x4ad1('0x11'),_0x548f20,_0x489b63[_0x4ad1('0x14')][_0x4ad1('0x15')]);return _0x5b9850(_0x489b63[_0x4ad1('0x14')]['message']);}logger[_0x4ad1('0x14')]('ChatApplication,\x20%s,\x20%s',_0x548f20,_0x489b63['error'][_0x4ad1('0x15')]);return _0x4c1315(_0x489b63[_0x4ad1('0x14')][_0x4ad1('0x15')]);}else{logger['info'](_0x4ad1('0x11'),_0x548f20,_0x4ad1('0x12'));_0x4c1315(_0x489b63[_0x4ad1('0x16')][_0x4ad1('0x15')]);}})[_0x4ad1('0x17')](function(_0x22dc6f){logger[_0x4ad1('0x14')](_0x4ad1('0x11'),_0x548f20,_0x22dc6f);_0x5b9850(_0x22dc6f);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index e248670..6dc5813 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 _0xdaa7=['Router','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4c1c08,_0x2578c4){var _0x173fe0=function(_0x2dc3ce){while(--_0x2dc3ce){_0x4c1c08['push'](_0x4c1c08['shift']());}};_0x173fe0(++_0x2578c4);}(_0xdaa7,0x154));var _0x7daa=function(_0x623e7,_0x1bef7d){_0x623e7=_0x623e7-0x0;var _0x121131=_0xdaa7[_0x623e7];return _0x121131;};'use strict';var multer=require(_0x7daa('0x0'));var util=require(_0x7daa('0x1'));var path=require(_0x7daa('0x2'));var timeout=require(_0x7daa('0x3'));var express=require(_0x7daa('0x4'));var router=express[_0x7daa('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7daa('0x6'));var config=require(_0x7daa('0x7'));var controller=require(_0x7daa('0x8'));router[_0x7daa('0x9')](_0x7daa('0xa'),auth[_0x7daa('0xb')](),controller['show']);router['put'](_0x7daa('0xa'),auth[_0x7daa('0xb')](),controller[_0x7daa('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7daa('0xd')]);module[_0x7daa('0xe')]=router; \ No newline at end of file +var _0xa223=['../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','destroy','exports','multer','util','path','Router'];(function(_0x340756,_0xad31ae){var _0x2ef745=function(_0x59ffde){while(--_0x59ffde){_0x340756['push'](_0x340756['shift']());}};_0x2ef745(++_0xad31ae);}(_0xa223,0xec));var _0x3a22=function(_0x4fdab1,_0x26cfeb){_0x4fdab1=_0x4fdab1-0x0;var _0x265935=_0xa223[_0x4fdab1];return _0x265935;};'use strict';var multer=require(_0x3a22('0x0'));var util=require(_0x3a22('0x1'));var path=require(_0x3a22('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3a22('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3a22('0x4'));var config=require(_0x3a22('0x5'));var controller=require(_0x3a22('0x6'));router[_0x3a22('0x7')](_0x3a22('0x8'),auth[_0x3a22('0x9')](),controller[_0x3a22('0xa')]);router[_0x3a22('0xb')](_0x3a22('0x8'),auth[_0x3a22('0x9')](),controller[_0x3a22('0xc')]);router['delete'](_0x3a22('0x8'),auth[_0x3a22('0x9')](),controller[_0x3a22('0xd')]);module[_0x3a22('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 4975c02..ceab65b 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 _0x26ed=['BOOLEAN','sequelize','exports','STRING'];(function(_0x405288,_0x55f39d){var _0x1d2075=function(_0x47f854){while(--_0x47f854){_0x405288['push'](_0x405288['shift']());}};_0x1d2075(++_0x55f39d);}(_0x26ed,0x145));var _0xd26e=function(_0x2132a3,_0x4639e9){_0x2132a3=_0x2132a3-0x0;var _0x21890c=_0x26ed[_0x2132a3];return _0x21890c;};'use strict';var Sequelize=require(_0xd26e('0x0'));module[_0xd26e('0x1')]={'name':{'type':Sequelize[_0xd26e('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xd26e('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x73f9=['sequelize','exports','STRING','BOOLEAN'];(function(_0x7abd7,_0x1ca3f9){var _0x3a2577=function(_0x18456d){while(--_0x18456d){_0x7abd7['push'](_0x7abd7['shift']());}};_0x3a2577(++_0x1ca3f9);}(_0x73f9,0xdc));var _0x973f=function(_0x7c0a21,_0x47b41b){_0x7c0a21=_0x7c0a21-0x0;var _0x4fe65a=_0x73f9[_0x7c0a21];return _0x4fe65a;};'use strict';var Sequelize=require(_0x973f('0x0'));module[_0x973f('0x1')]={'name':{'type':Sequelize[_0x973f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x973f('0x2')]},'write':{'type':Sequelize[_0x973f('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 2efa1fb..4ae961e 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 _0xfef9=['split','format','getMessages','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatGroup.socket','register','jayson/promise','client','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','json','limit','set','Content-Range','apply','save','update','destroy','end','stack','name','map','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','sort','where','pick','merge','filter','ChatGroup','count','includeAll','include','findAll','show','params','keys','rawAttributes','length','options','find','catch','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','getMembers','findOne','order','removeMembers','addMessage','ChatGroupId','$gte'];(function(_0x329437,_0x1de73a){var _0x3789d9=function(_0x37832e){while(--_0x37832e){_0x329437['push'](_0x329437['shift']());}};_0x3789d9(++_0x1de73a);}(_0xfef9,0xd3));var _0x9fef=function(_0x6173fc,_0x32aadf){_0x6173fc=_0x6173fc-0x0;var _0x965fbe=_0xfef9[_0x6173fc];return _0x965fbe;};'use strict';var pdf=require(_0x9fef('0x0'));var emlformat=require(_0x9fef('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9fef('0x2'));var jsonpatch=require(_0x9fef('0x3'));var rp=require('request-promise');var moment=require(_0x9fef('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9fef('0x5'));var util=require('util');var path=require(_0x9fef('0x6'));var sox=require(_0x9fef('0x7'));var csv=require('to-csv');var ejs=require(_0x9fef('0x8'));var fs=require('fs');var _=require(_0x9fef('0x9'));var squel=require('squel');var crypto=require(_0x9fef('0xa'));var jsforce=require(_0x9fef('0xb'));var deskjs=require(_0x9fef('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9fef('0xd'));var Papa=require(_0x9fef('0xe'));var Redis=require(_0x9fef('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9fef('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9fef('0x11'));var logger=require(_0x9fef('0x12'))(_0x9fef('0x13'));var utils=require(_0x9fef('0x14'));var config=require(_0x9fef('0x15'));var licenseUtil=require(_0x9fef('0x16'));var db=require(_0x9fef('0x17'))['db'];config['redis']=_[_0x9fef('0x18')](config[_0x9fef('0x19')],{'host':_0x9fef('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9fef('0x19')]));require(_0x9fef('0x1b'))[_0x9fef('0x1c')](socket);var jayson=require(_0x9fef('0x1d'));var client=jayson[_0x9fef('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a1a29,_0x4ee2e3,_0x4d5054,_0x47bc6a){return new BPromise(function(_0x2a3fb6,_0x43017a){var _0x4d9197=_0x47bc6a||client;return _0x4d9197[_0x9fef('0x1f')](_0x2a1a29,_0x4d5054)[_0x9fef('0x20')](function(_0x20eb7a){logger['info'](_0x9fef('0x21'),_0x4ee2e3,_0x9fef('0x22'));logger[_0x9fef('0x23')](_0x9fef('0x24'),_0x4ee2e3,'request\x20sent',JSON[_0x9fef('0x25')](_0x20eb7a));if(_0x20eb7a[_0x9fef('0x26')]){if(_0x20eb7a[_0x9fef('0x26')][_0x9fef('0x27')]===0x1f4){logger[_0x9fef('0x26')](_0x9fef('0x21'),_0x4ee2e3,_0x20eb7a['error'][_0x9fef('0x28')]);return _0x43017a(_0x20eb7a[_0x9fef('0x26')][_0x9fef('0x28')]);}logger[_0x9fef('0x26')](_0x9fef('0x21'),_0x4ee2e3,_0x20eb7a[_0x9fef('0x26')][_0x9fef('0x28')]);return _0x2a3fb6(_0x20eb7a[_0x9fef('0x26')][_0x9fef('0x28')]);}else{logger[_0x9fef('0x29')]('ChatGroup,\x20%s,\x20%s',_0x4ee2e3,_0x9fef('0x22'));_0x2a3fb6(_0x20eb7a[_0x9fef('0x2a')][_0x9fef('0x28')]);}})['catch'](function(_0x5eb90d){logger[_0x9fef('0x26')](_0x9fef('0x21'),_0x4ee2e3,_0x5eb90d);_0x43017a(_0x5eb90d);});});}function respondWithStatusCode(_0x2965db,_0x3bff2c){_0x3bff2c=_0x3bff2c||0xcc;return function(_0x2787c4){if(_0x2787c4){return _0x2965db[_0x9fef('0x2b')](_0x3bff2c);}return _0x2965db[_0x9fef('0x2c')](_0x3bff2c)['end']();};}function respondWithResult(_0xe8514c,_0x51ec28){_0x51ec28=_0x51ec28||0xc8;return function(_0x55ef3e){if(_0x55ef3e){return _0xe8514c[_0x9fef('0x2c')](_0x51ec28)[_0x9fef('0x2d')](_0x55ef3e);}};}function respondWithFilteredResult(_0x5dbc6f,_0x17fe34){return function(_0x4ed4db){if(_0x4ed4db){var _0x4b8344=_0x4ed4db['count'],_0xce6526=_0x17fe34['offset'],_0x5734ae=_0x17fe34['offset']+_0x17fe34[_0x9fef('0x2e')],_0x5a74aa;if(_0x5734ae>=_0x4b8344){_0x5734ae=_0x4b8344;_0x5a74aa=0xc8;}else{_0x5a74aa=0xce;}_0x5dbc6f[_0x9fef('0x2c')](_0x5a74aa);return _0x5dbc6f[_0x9fef('0x2f')](_0x9fef('0x30'),_0xce6526+'-'+_0x5734ae+'/'+_0x4b8344)[_0x9fef('0x2d')](_0x4ed4db);}return null;};}function patchUpdates(_0xbe1d5d){return function(_0x13f442){try{jsonpatch[_0x9fef('0x31')](_0x13f442,_0xbe1d5d,!![]);}catch(_0x54bcd9){return BPromise['reject'](_0x54bcd9);}return _0x13f442[_0x9fef('0x32')]();};}function saveUpdates(_0x16a417,_0x23598e){return function(_0x102272){if(_0x102272){return _0x102272[_0x9fef('0x33')](_0x16a417)['then'](function(_0x26d808){return _0x26d808;});}return null;};}function removeEntity(_0xa72d01,_0x535909){return function(_0x42700e){if(_0x42700e){return _0x42700e[_0x9fef('0x34')]()[_0x9fef('0x20')](function(){_0xa72d01[_0x9fef('0x2c')](0xcc)[_0x9fef('0x35')]();});}};}function handleEntityNotFound(_0x458da0,_0x5bb911){return function(_0x4f591b){if(!_0x4f591b){_0x458da0['sendStatus'](0x194);}return _0x4f591b;};}function handleError(_0x4f570f,_0xf1b394){_0xf1b394=_0xf1b394||0x1f4;return function(_0xd1b2a3){logger[_0x9fef('0x26')](_0xd1b2a3[_0x9fef('0x36')]);if(_0xd1b2a3[_0x9fef('0x37')]){delete _0xd1b2a3[_0x9fef('0x37')];}_0x4f570f[_0x9fef('0x2c')](_0xf1b394)['send'](_0xd1b2a3);};}exports['index']=function(_0x262e22,_0x582393){var _0x48f277={},_0x3c68c6={},_0x5770e2={'count':0x0,'rows':[]};var _0x171897=_[_0x9fef('0x38')](db['ChatGroup']['rawAttributes'],function(_0x1d1d2e){return{'name':_0x1d1d2e[_0x9fef('0x39')],'type':_0x1d1d2e[_0x9fef('0x3a')]['key']};});_0x3c68c6[_0x9fef('0x3b')]=_[_0x9fef('0x38')](_0x171897,_0x9fef('0x37'));_0x3c68c6['query']=_['keys'](_0x262e22[_0x9fef('0x3c')]);_0x3c68c6[_0x9fef('0x3d')]=_[_0x9fef('0x3e')](_0x3c68c6[_0x9fef('0x3b')],_0x3c68c6['query']);_0x48f277[_0x9fef('0x3f')]=_[_0x9fef('0x3e')](_0x3c68c6[_0x9fef('0x3b')],qs[_0x9fef('0x40')](_0x262e22['query'][_0x9fef('0x40')]));_0x48f277['attributes']=_0x48f277[_0x9fef('0x3f')]['length']?_0x48f277[_0x9fef('0x3f')]:_0x3c68c6['model'];if(!_0x262e22[_0x9fef('0x3c')][_0x9fef('0x41')](_0x9fef('0x42'))){_0x48f277[_0x9fef('0x2e')]=qs[_0x9fef('0x2e')](_0x262e22[_0x9fef('0x3c')]['limit']);_0x48f277[_0x9fef('0x43')]=qs[_0x9fef('0x43')](_0x262e22[_0x9fef('0x3c')][_0x9fef('0x43')]);}_0x48f277['order']=qs[_0x9fef('0x44')](_0x262e22[_0x9fef('0x3c')][_0x9fef('0x44')]);_0x48f277[_0x9fef('0x45')]=qs[_0x9fef('0x3d')](_[_0x9fef('0x46')](_0x262e22['query'],_0x3c68c6[_0x9fef('0x3d')]),_0x171897);if(_0x262e22['query']['filter']){_0x48f277[_0x9fef('0x45')]=_[_0x9fef('0x47')](_0x48f277[_0x9fef('0x45')],{'$or':_['map'](_0x171897,function(_0x4cdb53){if(_0x4cdb53[_0x9fef('0x3a')]!=='VIRTUAL'){var _0x3863b6={};_0x3863b6[_0x4cdb53[_0x9fef('0x37')]]={'$like':'%'+_0x262e22[_0x9fef('0x3c')][_0x9fef('0x48')]+'%'};return _0x3863b6;}})});}_0x48f277=_['merge']({},_0x48f277,_0x262e22['options']);var _0x308b89={'where':_0x48f277[_0x9fef('0x45')]};return db[_0x9fef('0x49')][_0x9fef('0x4a')](_0x308b89)[_0x9fef('0x20')](function(_0x2d65d1){_0x5770e2['count']=_0x2d65d1;if(_0x262e22[_0x9fef('0x3c')][_0x9fef('0x4b')]){_0x48f277[_0x9fef('0x4c')]=[{'all':!![]}];}return db[_0x9fef('0x49')][_0x9fef('0x4d')](_0x48f277);})[_0x9fef('0x20')](function(_0x2f8516){_0x5770e2['rows']=_0x2f8516;return _0x5770e2;})[_0x9fef('0x20')](respondWithFilteredResult(_0x582393,_0x48f277))['catch'](handleError(_0x582393,null));};exports[_0x9fef('0x4e')]=function(_0x50d978,_0x173acc){var _0xf8e178={'raw':!![],'where':{'id':_0x50d978[_0x9fef('0x4f')]['id']}},_0x4b7e82={};_0x4b7e82[_0x9fef('0x3b')]=_[_0x9fef('0x50')](db[_0x9fef('0x49')][_0x9fef('0x51')]);_0x4b7e82[_0x9fef('0x3c')]=_['keys'](_0x50d978[_0x9fef('0x3c')]);_0x4b7e82['filters']=_[_0x9fef('0x3e')](_0x4b7e82[_0x9fef('0x3b')],_0x4b7e82['query']);_0xf8e178[_0x9fef('0x3f')]=_['intersection'](_0x4b7e82['model'],qs[_0x9fef('0x40')](_0x50d978[_0x9fef('0x3c')][_0x9fef('0x40')]));_0xf8e178[_0x9fef('0x3f')]=_0xf8e178[_0x9fef('0x3f')][_0x9fef('0x52')]?_0xf8e178[_0x9fef('0x3f')]:_0x4b7e82[_0x9fef('0x3b')];if(_0x50d978[_0x9fef('0x3c')]['includeAll']){_0xf8e178[_0x9fef('0x4c')]=[{'all':!![]}];}_0xf8e178=_[_0x9fef('0x47')]({},_0xf8e178,_0x50d978[_0x9fef('0x53')]);return db[_0x9fef('0x49')][_0x9fef('0x54')](_0xf8e178)[_0x9fef('0x20')](handleEntityNotFound(_0x173acc,null))[_0x9fef('0x20')](respondWithResult(_0x173acc,null))[_0x9fef('0x55')](handleError(_0x173acc,null));};exports['create']=function(_0x4b2e13,_0x31bdce){return db[_0x9fef('0x49')][_0x9fef('0x56')](_0x4b2e13[_0x9fef('0x57')],{})['then'](respondWithResult(_0x31bdce,0xc9))[_0x9fef('0x55')](handleError(_0x31bdce,null));};exports[_0x9fef('0x33')]=function(_0x3ad0fd,_0xd90817){if(_0x3ad0fd[_0x9fef('0x57')]['id']){delete _0x3ad0fd[_0x9fef('0x57')]['id'];}return db[_0x9fef('0x49')][_0x9fef('0x54')]({'where':{'id':_0x3ad0fd[_0x9fef('0x4f')]['id']}})[_0x9fef('0x20')](handleEntityNotFound(_0xd90817,null))['then'](saveUpdates(_0x3ad0fd[_0x9fef('0x57')],null))['then'](respondWithResult(_0xd90817,null))[_0x9fef('0x55')](handleError(_0xd90817,null));};exports['destroy']=function(_0x2ec458,_0x59a55d){return db[_0x9fef('0x49')][_0x9fef('0x54')]({'where':{'id':_0x2ec458['params']['id']}})[_0x9fef('0x20')](handleEntityNotFound(_0x59a55d,null))[_0x9fef('0x20')](removeEntity(_0x59a55d,null))[_0x9fef('0x55')](handleError(_0x59a55d,null));};exports[_0x9fef('0x58')]=function(_0x559e44,_0x1e7457){return db[_0x9fef('0x49')][_0x9fef('0x58')]()[_0x9fef('0x20')](respondWithResult(_0x1e7457,null))['catch'](handleError(_0x1e7457,null));};exports[_0x9fef('0x59')]=function(_0x5b42e3,_0x166ddc,_0x28f458){return db[_0x9fef('0x5a')][_0x9fef('0x4a')]({'where':{'ChatGroupId':_0x5b42e3[_0x9fef('0x4f')]['id'],'ToId':_0x5b42e3['user']['id'],'read':![]}})[_0x9fef('0x20')](function(_0x476aae){return{'id':_[_0x9fef('0x5b')](_0x5b42e3[_0x9fef('0x4f')]['id']),'count':_0x476aae};})[_0x9fef('0x20')](respondWithResult(_0x166ddc,null))[_0x9fef('0x55')](handleError(_0x166ddc,null));};exports[_0x9fef('0x5c')]=function(_0x189cb4,_0x5a9785,_0x3eae1f){return db[_0x9fef('0x49')][_0x9fef('0x54')]({'where':{'id':_0x189cb4[_0x9fef('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5a9785,null))[_0x9fef('0x20')](function(_0x47b51a){if(_0x47b51a){return _0x47b51a[_0x9fef('0x5c')](_0x189cb4[_0x9fef('0x57')][_0x9fef('0x5d')],_['omit'](_0x189cb4[_0x9fef('0x57')],[_0x9fef('0x5d'),'id'])||{});}})[_0x9fef('0x20')](respondWithResult(_0x5a9785,null))['catch'](handleError(_0x5a9785,null));};exports[_0x9fef('0x5e')]=function(_0x38e92b,_0x537116,_0x5de5fa){var _0x56a093={};var _0x550961={};var _0x35c71a;var _0x41e5ae;return db[_0x9fef('0x49')][_0x9fef('0x5f')]({'where':{'id':_0x38e92b['params']['id']}})[_0x9fef('0x20')](handleEntityNotFound(_0x537116,null))[_0x9fef('0x20')](function(_0x4b0e6b){if(_0x4b0e6b){_0x35c71a=_0x4b0e6b;_0x550961[_0x9fef('0x3b')]=_['keys'](db['User']['rawAttributes']);_0x550961[_0x9fef('0x3c')]=_[_0x9fef('0x50')](_0x38e92b[_0x9fef('0x3c')]);_0x550961[_0x9fef('0x3d')]=_[_0x9fef('0x3e')](_0x550961[_0x9fef('0x3b')],_0x550961[_0x9fef('0x3c')]);_0x56a093[_0x9fef('0x3f')]=_[_0x9fef('0x3e')](_0x550961[_0x9fef('0x3b')],qs[_0x9fef('0x40')](_0x38e92b[_0x9fef('0x3c')][_0x9fef('0x40')]));_0x56a093[_0x9fef('0x3f')]=_0x56a093[_0x9fef('0x3f')][_0x9fef('0x52')]?_0x56a093[_0x9fef('0x3f')]:_0x550961[_0x9fef('0x3b')];_0x56a093[_0x9fef('0x60')]=qs[_0x9fef('0x44')](_0x38e92b[_0x9fef('0x3c')][_0x9fef('0x44')]);_0x56a093[_0x9fef('0x45')]=qs['filters'](_[_0x9fef('0x46')](_0x38e92b[_0x9fef('0x3c')],_0x550961[_0x9fef('0x3d')]));if(_0x38e92b[_0x9fef('0x3c')][_0x9fef('0x48')]){_0x56a093[_0x9fef('0x45')]=_['merge'](_0x56a093['where'],{'$or':_[_0x9fef('0x38')](_0x56a093[_0x9fef('0x3f')],function(_0x51fae8){var _0x1e66bb={};_0x1e66bb[_0x51fae8]={'$like':'%'+_0x38e92b[_0x9fef('0x3c')][_0x9fef('0x48')]+'%'};return _0x1e66bb;})});}_0x56a093=_[_0x9fef('0x47')]({},_0x56a093,_0x38e92b[_0x9fef('0x53')]);return _0x35c71a[_0x9fef('0x5e')](_0x56a093);}})[_0x9fef('0x20')](function(_0x3bab5d){if(_0x3bab5d){_0x41e5ae=_0x3bab5d[_0x9fef('0x52')];if(!_0x38e92b[_0x9fef('0x3c')][_0x9fef('0x41')](_0x9fef('0x42'))){_0x56a093[_0x9fef('0x2e')]=qs[_0x9fef('0x2e')](_0x38e92b[_0x9fef('0x3c')][_0x9fef('0x2e')]);_0x56a093['offset']=qs[_0x9fef('0x43')](_0x38e92b[_0x9fef('0x3c')][_0x9fef('0x43')]);}return _0x35c71a['getMembers'](_0x56a093);}})[_0x9fef('0x20')](function(_0x536ad6){if(_0x536ad6){return _0x536ad6?{'count':_0x41e5ae,'rows':_0x536ad6}:null;}})[_0x9fef('0x20')](respondWithResult(_0x537116,null))['catch'](handleError(_0x537116,null));};exports[_0x9fef('0x61')]=function(_0x278701,_0x10976a,_0x6ec9c6){return db[_0x9fef('0x49')][_0x9fef('0x54')]({'where':{'id':_0x278701[_0x9fef('0x4f')]['id']}})[_0x9fef('0x20')](handleEntityNotFound(_0x10976a,null))[_0x9fef('0x20')](function(_0x53b1cd){if(_0x53b1cd){return _0x53b1cd['removeMembers'](_0x278701[_0x9fef('0x3c')][_0x9fef('0x5d')]);}})[_0x9fef('0x20')](respondWithStatusCode(_0x10976a,null))[_0x9fef('0x55')](handleError(_0x10976a,null));};exports[_0x9fef('0x62')]=function(_0x5e1d02,_0x2a6e92,_0x408374){if(_0x5e1d02['body']['id']){delete _0x5e1d02['body']['id'];}return db[_0x9fef('0x49')][_0x9fef('0x54')]({'where':{'id':_0x5e1d02[_0x9fef('0x4f')]['id']}})[_0x9fef('0x20')](handleEntityNotFound(_0x2a6e92,null))[_0x9fef('0x20')](function(_0x248690){if(_0x248690){_0x5e1d02[_0x9fef('0x57')][_0x9fef('0x63')]=_0x248690['id'];return db['ChatInternalMessage'][_0x9fef('0x56')](_0x5e1d02[_0x9fef('0x57')]);}})[_0x9fef('0x20')](respondWithResult(_0x2a6e92,null))[_0x9fef('0x55')](handleError(_0x2a6e92,null));};exports['getMessages']=function(_0x524efa,_0x1cf070,_0x8fb1ed){var _0x39083e={};var _0x2d1285={};var _0x142f7f;var _0x825c29;return db[_0x9fef('0x49')][_0x9fef('0x5f')]({'where':{'id':_0x524efa['params']['id']}})[_0x9fef('0x20')](handleEntityNotFound(_0x1cf070,null))[_0x9fef('0x20')](function(_0xe9fe91){if(_0xe9fe91){_0x142f7f=_0xe9fe91;_0x2d1285[_0x9fef('0x3b')]=_[_0x9fef('0x50')](db[_0x9fef('0x5a')][_0x9fef('0x51')]);_0x2d1285[_0x9fef('0x3c')]=_[_0x9fef('0x50')](_0x524efa[_0x9fef('0x3c')]);_0x2d1285['filters']=_[_0x9fef('0x3e')](_0x2d1285[_0x9fef('0x3b')],_0x2d1285[_0x9fef('0x3c')]);_0x39083e[_0x9fef('0x3f')]=_[_0x9fef('0x3e')](_0x2d1285[_0x9fef('0x3b')],qs[_0x9fef('0x40')](_0x524efa[_0x9fef('0x3c')]['fields']));_0x39083e[_0x9fef('0x3f')]=_0x39083e[_0x9fef('0x3f')][_0x9fef('0x52')]?_0x39083e[_0x9fef('0x3f')]:_0x2d1285[_0x9fef('0x3b')];_0x39083e[_0x9fef('0x60')]=qs[_0x9fef('0x44')](_0x524efa[_0x9fef('0x3c')][_0x9fef('0x44')]);_0x39083e[_0x9fef('0x45')]=qs['filters'](_[_0x9fef('0x46')](_0x524efa['query'],_0x2d1285[_0x9fef('0x3d')]));if(_0x524efa[_0x9fef('0x3c')][_0x9fef('0x48')]){_0x39083e[_0x9fef('0x45')]=_[_0x9fef('0x47')](_0x39083e[_0x9fef('0x45')],{'$or':_[_0x9fef('0x38')](_0x39083e['attributes'],function(_0x32633a){var _0x3a50dc={};_0x3a50dc[_0x32633a]={'$like':'%'+_0x524efa[_0x9fef('0x3c')][_0x9fef('0x48')]+'%'};return _0x3a50dc;})});}if(_0x524efa[_0x9fef('0x3c')][_0x9fef('0x64')]){var _0x23a853=_0x524efa['query'][_0x9fef('0x64')][_0x9fef('0x65')](',');var _0x39fec5={};_0x39fec5[_0x23a853[0x0]]={'$gte':moment(_0x23a853[0x1])[_0x9fef('0x66')]('YYYY-MM-DD\x20HH:mm:ss')};_0x39083e[_0x9fef('0x45')]=_[_0x9fef('0x47')](_0x39083e[_0x9fef('0x45')],_0x39fec5);}_0x39083e=_[_0x9fef('0x47')]({},_0x39083e,_0x524efa[_0x9fef('0x53')]);return _0x142f7f['getMessages'](_0x39083e);}})['then'](function(_0x8c9539){if(_0x8c9539){_0x825c29=_0x8c9539['length'];if(!_0x524efa[_0x9fef('0x3c')][_0x9fef('0x41')](_0x9fef('0x42'))){_0x39083e[_0x9fef('0x2e')]=qs[_0x9fef('0x2e')](_0x524efa[_0x9fef('0x3c')][_0x9fef('0x2e')]);_0x39083e['offset']=qs[_0x9fef('0x43')](_0x524efa[_0x9fef('0x3c')][_0x9fef('0x43')]);}return _0x142f7f[_0x9fef('0x67')](_0x39083e);}})[_0x9fef('0x20')](function(_0x51b2f5){if(_0x51b2f5){return _0x51b2f5?{'count':_0x825c29,'rows':_0x51b2f5}:null;}})[_0x9fef('0x20')](respondWithResult(_0x1cf070,null))[_0x9fef('0x55')](handleError(_0x1cf070,null));}; \ No newline at end of file +var _0xafc4=['request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','limit','set','Content-Range','json','apply','reject','save','update','destroy','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','merge','where','VIRTUAL','filter','ChatGroup','count','includeAll','include','findAll','show','params','rawAttributes','options','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','getMessages','pick','$gte','split','format','html-pdf','rimraf','fast-json-patch'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xafc4,0x69));var _0x4afc=function(_0x50503c,_0x4af617){_0x50503c=_0x50503c-0x0;var _0x4eeed6=_0xafc4[_0x50503c];return _0x4eeed6;};'use strict';var pdf=require(_0x4afc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4afc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4afc('0x2'));var rp=require(_0x4afc('0x3'));var moment=require(_0x4afc('0x4'));var BPromise=require(_0x4afc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4afc('0x6'));var csv=require(_0x4afc('0x7'));var ejs=require(_0x4afc('0x8'));var fs=require('fs');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('0x7'));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'];config[_0x4afc('0x16')]=_[_0x4afc('0x17')](config[_0x4afc('0x16')],{'host':_0x4afc('0x18'),'port':0x18eb});var socket=require(_0x4afc('0x19'))(new Redis(config[_0x4afc('0x16')]));require('./chatGroup.socket')[_0x4afc('0x1a')](socket);var jayson=require(_0x4afc('0x1b'));var client=jayson[_0x4afc('0x1c')][_0x4afc('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5f2dc9,_0x4e32e8,_0x2452ae,_0x4f3127){return new BPromise(function(_0x23ae30,_0x24ed6d){var _0x2b928b=_0x4f3127||client;return _0x2b928b[_0x4afc('0x1e')](_0x5f2dc9,_0x2452ae)[_0x4afc('0x1f')](function(_0x3ebdc8){logger[_0x4afc('0x20')](_0x4afc('0x21'),_0x4e32e8,_0x4afc('0x22'));logger[_0x4afc('0x23')](_0x4afc('0x24'),_0x4e32e8,'request\x20sent',JSON[_0x4afc('0x25')](_0x3ebdc8));if(_0x3ebdc8[_0x4afc('0x26')]){if(_0x3ebdc8[_0x4afc('0x26')][_0x4afc('0x27')]===0x1f4){logger['error'](_0x4afc('0x21'),_0x4e32e8,_0x3ebdc8[_0x4afc('0x26')][_0x4afc('0x28')]);return _0x24ed6d(_0x3ebdc8[_0x4afc('0x26')][_0x4afc('0x28')]);}logger[_0x4afc('0x26')](_0x4afc('0x21'),_0x4e32e8,_0x3ebdc8['error'][_0x4afc('0x28')]);return _0x23ae30(_0x3ebdc8[_0x4afc('0x26')]['message']);}else{logger[_0x4afc('0x20')]('ChatGroup,\x20%s,\x20%s',_0x4e32e8,_0x4afc('0x22'));_0x23ae30(_0x3ebdc8[_0x4afc('0x29')][_0x4afc('0x28')]);}})[_0x4afc('0x2a')](function(_0x86dbd4){logger[_0x4afc('0x26')](_0x4afc('0x21'),_0x4e32e8,_0x86dbd4);_0x24ed6d(_0x86dbd4);});});}function respondWithStatusCode(_0x383a71,_0x2bb837){_0x2bb837=_0x2bb837||0xcc;return function(_0x100220){if(_0x100220){return _0x383a71[_0x4afc('0x2b')](_0x2bb837);}return _0x383a71[_0x4afc('0x2c')](_0x2bb837)[_0x4afc('0x2d')]();};}function respondWithResult(_0x55842c,_0xc3952e){_0xc3952e=_0xc3952e||0xc8;return function(_0x244f6c){if(_0x244f6c){return _0x55842c[_0x4afc('0x2c')](_0xc3952e)['json'](_0x244f6c);}};}function respondWithFilteredResult(_0x52212d,_0x54433f){return function(_0x426e9d){if(_0x426e9d){var _0x5db47e=_0x426e9d['count'],_0x5e4747=_0x54433f['offset'],_0xd26d2f=_0x54433f['offset']+_0x54433f[_0x4afc('0x2e')],_0x628e42;if(_0xd26d2f>=_0x5db47e){_0xd26d2f=_0x5db47e;_0x628e42=0xc8;}else{_0x628e42=0xce;}_0x52212d[_0x4afc('0x2c')](_0x628e42);return _0x52212d[_0x4afc('0x2f')](_0x4afc('0x30'),_0x5e4747+'-'+_0xd26d2f+'/'+_0x5db47e)[_0x4afc('0x31')](_0x426e9d);}return null;};}function patchUpdates(_0x28cd3e){return function(_0x566389){try{jsonpatch[_0x4afc('0x32')](_0x566389,_0x28cd3e,!![]);}catch(_0x3d1693){return BPromise[_0x4afc('0x33')](_0x3d1693);}return _0x566389[_0x4afc('0x34')]();};}function saveUpdates(_0x2b115d,_0xf95893){return function(_0xbabe1e){if(_0xbabe1e){return _0xbabe1e[_0x4afc('0x35')](_0x2b115d)['then'](function(_0x1383cf){return _0x1383cf;});}return null;};}function removeEntity(_0x51660d,_0x539b61){return function(_0x324a12){if(_0x324a12){return _0x324a12[_0x4afc('0x36')]()[_0x4afc('0x1f')](function(){_0x51660d[_0x4afc('0x2c')](0xcc)[_0x4afc('0x2d')]();});}};}function handleEntityNotFound(_0x3f50cc,_0x523520){return function(_0x380f9f){if(!_0x380f9f){_0x3f50cc[_0x4afc('0x2b')](0x194);}return _0x380f9f;};}function handleError(_0x111dbf,_0x127ac8){_0x127ac8=_0x127ac8||0x1f4;return function(_0x3127e6){logger[_0x4afc('0x26')](_0x3127e6['stack']);if(_0x3127e6[_0x4afc('0x37')]){delete _0x3127e6[_0x4afc('0x37')];}_0x111dbf[_0x4afc('0x2c')](_0x127ac8)[_0x4afc('0x38')](_0x3127e6);};}exports['index']=function(_0x4be1e6,_0x43c341){var _0x22bd75={},_0x17ea03={},_0x5edfe1={'count':0x0,'rows':[]};var _0x5790a2=_[_0x4afc('0x39')](db['ChatGroup']['rawAttributes'],function(_0x295b53){return{'name':_0x295b53[_0x4afc('0x3a')],'type':_0x295b53[_0x4afc('0x3b')][_0x4afc('0x3c')]};});_0x17ea03[_0x4afc('0x3d')]=_[_0x4afc('0x39')](_0x5790a2,_0x4afc('0x37'));_0x17ea03[_0x4afc('0x3e')]=_[_0x4afc('0x3f')](_0x4be1e6[_0x4afc('0x3e')]);_0x17ea03[_0x4afc('0x40')]=_[_0x4afc('0x41')](_0x17ea03[_0x4afc('0x3d')],_0x17ea03[_0x4afc('0x3e')]);_0x22bd75[_0x4afc('0x42')]=_['intersection'](_0x17ea03[_0x4afc('0x3d')],qs[_0x4afc('0x43')](_0x4be1e6[_0x4afc('0x3e')][_0x4afc('0x43')]));_0x22bd75[_0x4afc('0x42')]=_0x22bd75[_0x4afc('0x42')][_0x4afc('0x44')]?_0x22bd75['attributes']:_0x17ea03['model'];if(!_0x4be1e6['query'][_0x4afc('0x45')](_0x4afc('0x46'))){_0x22bd75['limit']=qs[_0x4afc('0x2e')](_0x4be1e6[_0x4afc('0x3e')][_0x4afc('0x2e')]);_0x22bd75[_0x4afc('0x47')]=qs['offset'](_0x4be1e6[_0x4afc('0x3e')][_0x4afc('0x47')]);}_0x22bd75[_0x4afc('0x48')]=qs[_0x4afc('0x49')](_0x4be1e6[_0x4afc('0x3e')][_0x4afc('0x49')]);_0x22bd75['where']=qs[_0x4afc('0x40')](_['pick'](_0x4be1e6[_0x4afc('0x3e')],_0x17ea03[_0x4afc('0x40')]),_0x5790a2);if(_0x4be1e6[_0x4afc('0x3e')]['filter']){_0x22bd75['where']=_[_0x4afc('0x4a')](_0x22bd75[_0x4afc('0x4b')],{'$or':_[_0x4afc('0x39')](_0x5790a2,function(_0x12e97d){if(_0x12e97d[_0x4afc('0x3b')]!==_0x4afc('0x4c')){var _0x42ecb6={};_0x42ecb6[_0x12e97d[_0x4afc('0x37')]]={'$like':'%'+_0x4be1e6['query'][_0x4afc('0x4d')]+'%'};return _0x42ecb6;}})});}_0x22bd75=_[_0x4afc('0x4a')]({},_0x22bd75,_0x4be1e6['options']);var _0x1f2604={'where':_0x22bd75['where']};return db[_0x4afc('0x4e')][_0x4afc('0x4f')](_0x1f2604)[_0x4afc('0x1f')](function(_0x5e0ebd){_0x5edfe1[_0x4afc('0x4f')]=_0x5e0ebd;if(_0x4be1e6[_0x4afc('0x3e')][_0x4afc('0x50')]){_0x22bd75[_0x4afc('0x51')]=[{'all':!![]}];}return db[_0x4afc('0x4e')][_0x4afc('0x52')](_0x22bd75);})['then'](function(_0x4e470d){_0x5edfe1['rows']=_0x4e470d;return _0x5edfe1;})[_0x4afc('0x1f')](respondWithFilteredResult(_0x43c341,_0x22bd75))[_0x4afc('0x2a')](handleError(_0x43c341,null));};exports[_0x4afc('0x53')]=function(_0x269c24,_0xb5cca9){var _0x122cbc={'raw':!![],'where':{'id':_0x269c24[_0x4afc('0x54')]['id']}},_0x22e8b0={};_0x22e8b0[_0x4afc('0x3d')]=_[_0x4afc('0x3f')](db['ChatGroup'][_0x4afc('0x55')]);_0x22e8b0['query']=_['keys'](_0x269c24[_0x4afc('0x3e')]);_0x22e8b0['filters']=_[_0x4afc('0x41')](_0x22e8b0[_0x4afc('0x3d')],_0x22e8b0[_0x4afc('0x3e')]);_0x122cbc[_0x4afc('0x42')]=_['intersection'](_0x22e8b0[_0x4afc('0x3d')],qs['fields'](_0x269c24[_0x4afc('0x3e')][_0x4afc('0x43')]));_0x122cbc[_0x4afc('0x42')]=_0x122cbc[_0x4afc('0x42')][_0x4afc('0x44')]?_0x122cbc[_0x4afc('0x42')]:_0x22e8b0[_0x4afc('0x3d')];if(_0x269c24[_0x4afc('0x3e')][_0x4afc('0x50')]){_0x122cbc[_0x4afc('0x51')]=[{'all':!![]}];}_0x122cbc=_[_0x4afc('0x4a')]({},_0x122cbc,_0x269c24[_0x4afc('0x56')]);return db['ChatGroup'][_0x4afc('0x57')](_0x122cbc)[_0x4afc('0x1f')](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x1f')](respondWithResult(_0xb5cca9,null))[_0x4afc('0x2a')](handleError(_0xb5cca9,null));};exports[_0x4afc('0x58')]=function(_0x285c25,_0x2fd538){return db[_0x4afc('0x4e')][_0x4afc('0x58')](_0x285c25[_0x4afc('0x59')],{})[_0x4afc('0x1f')](respondWithResult(_0x2fd538,0xc9))[_0x4afc('0x2a')](handleError(_0x2fd538,null));};exports[_0x4afc('0x35')]=function(_0x5c1421,_0x2abf25){if(_0x5c1421['body']['id']){delete _0x5c1421[_0x4afc('0x59')]['id'];}return db[_0x4afc('0x4e')][_0x4afc('0x57')]({'where':{'id':_0x5c1421[_0x4afc('0x54')]['id']}})['then'](handleEntityNotFound(_0x2abf25,null))['then'](saveUpdates(_0x5c1421[_0x4afc('0x59')],null))[_0x4afc('0x1f')](respondWithResult(_0x2abf25,null))['catch'](handleError(_0x2abf25,null));};exports[_0x4afc('0x36')]=function(_0x3af52c,_0xb1c023){return db[_0x4afc('0x4e')][_0x4afc('0x57')]({'where':{'id':_0x3af52c[_0x4afc('0x54')]['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0xb1c023,null))[_0x4afc('0x1f')](removeEntity(_0xb1c023,null))[_0x4afc('0x2a')](handleError(_0xb1c023,null));};exports[_0x4afc('0x5a')]=function(_0x4295a5,_0x1a4d15){return db[_0x4afc('0x4e')][_0x4afc('0x5a')]()['then'](respondWithResult(_0x1a4d15,null))[_0x4afc('0x2a')](handleError(_0x1a4d15,null));};exports[_0x4afc('0x5b')]=function(_0x2d1d06,_0x19cb0b,_0x16cff0){return db[_0x4afc('0x5c')][_0x4afc('0x4f')]({'where':{'ChatGroupId':_0x2d1d06['params']['id'],'ToId':_0x2d1d06[_0x4afc('0x5d')]['id'],'read':![]}})[_0x4afc('0x1f')](function(_0x543dce){return{'id':_['toInteger'](_0x2d1d06[_0x4afc('0x54')]['id']),'count':_0x543dce};})[_0x4afc('0x1f')](respondWithResult(_0x19cb0b,null))[_0x4afc('0x2a')](handleError(_0x19cb0b,null));};exports[_0x4afc('0x5e')]=function(_0x258fed,_0x193850,_0x37cfa6){return db[_0x4afc('0x4e')][_0x4afc('0x57')]({'where':{'id':_0x258fed[_0x4afc('0x54')]['id']}})['then'](handleEntityNotFound(_0x193850,null))['then'](function(_0x458533){if(_0x458533){return _0x458533[_0x4afc('0x5e')](_0x258fed['body'][_0x4afc('0x5f')],_[_0x4afc('0x60')](_0x258fed['body'],['ids','id'])||{});}})[_0x4afc('0x1f')](respondWithResult(_0x193850,null))[_0x4afc('0x2a')](handleError(_0x193850,null));};exports[_0x4afc('0x61')]=function(_0x53792a,_0x3875f8,_0x4a9df1){var _0x5a2be2={};var _0x10e5c6={};var _0x37b5aa;var _0x53f9ca;return db[_0x4afc('0x4e')][_0x4afc('0x62')]({'where':{'id':_0x53792a[_0x4afc('0x54')]['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0x3875f8,null))[_0x4afc('0x1f')](function(_0x3d1825){if(_0x3d1825){_0x37b5aa=_0x3d1825;_0x10e5c6['model']=_[_0x4afc('0x3f')](db[_0x4afc('0x63')][_0x4afc('0x55')]);_0x10e5c6['query']=_['keys'](_0x53792a['query']);_0x10e5c6[_0x4afc('0x40')]=_[_0x4afc('0x41')](_0x10e5c6[_0x4afc('0x3d')],_0x10e5c6['query']);_0x5a2be2[_0x4afc('0x42')]=_['intersection'](_0x10e5c6['model'],qs['fields'](_0x53792a[_0x4afc('0x3e')][_0x4afc('0x43')]));_0x5a2be2[_0x4afc('0x42')]=_0x5a2be2['attributes'][_0x4afc('0x44')]?_0x5a2be2[_0x4afc('0x42')]:_0x10e5c6[_0x4afc('0x3d')];_0x5a2be2['order']=qs[_0x4afc('0x49')](_0x53792a[_0x4afc('0x3e')][_0x4afc('0x49')]);_0x5a2be2[_0x4afc('0x4b')]=qs[_0x4afc('0x40')](_['pick'](_0x53792a['query'],_0x10e5c6[_0x4afc('0x40')]));if(_0x53792a[_0x4afc('0x3e')][_0x4afc('0x4d')]){_0x5a2be2['where']=_[_0x4afc('0x4a')](_0x5a2be2[_0x4afc('0x4b')],{'$or':_[_0x4afc('0x39')](_0x5a2be2[_0x4afc('0x42')],function(_0x3a7a19){var _0x4bc6e5={};_0x4bc6e5[_0x3a7a19]={'$like':'%'+_0x53792a[_0x4afc('0x3e')][_0x4afc('0x4d')]+'%'};return _0x4bc6e5;})});}_0x5a2be2=_['merge']({},_0x5a2be2,_0x53792a[_0x4afc('0x56')]);return _0x37b5aa[_0x4afc('0x61')](_0x5a2be2);}})[_0x4afc('0x1f')](function(_0x4ca3e8){if(_0x4ca3e8){_0x53f9ca=_0x4ca3e8[_0x4afc('0x44')];if(!_0x53792a[_0x4afc('0x3e')][_0x4afc('0x45')](_0x4afc('0x46'))){_0x5a2be2[_0x4afc('0x2e')]=qs[_0x4afc('0x2e')](_0x53792a[_0x4afc('0x3e')][_0x4afc('0x2e')]);_0x5a2be2['offset']=qs[_0x4afc('0x47')](_0x53792a['query']['offset']);}return _0x37b5aa[_0x4afc('0x61')](_0x5a2be2);}})[_0x4afc('0x1f')](function(_0x1354f1){if(_0x1354f1){return _0x1354f1?{'count':_0x53f9ca,'rows':_0x1354f1}:null;}})['then'](respondWithResult(_0x3875f8,null))['catch'](handleError(_0x3875f8,null));};exports[_0x4afc('0x64')]=function(_0x222e68,_0xa3f8b7,_0xb34abf){return db[_0x4afc('0x4e')][_0x4afc('0x57')]({'where':{'id':_0x222e68[_0x4afc('0x54')]['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0xa3f8b7,null))[_0x4afc('0x1f')](function(_0x396cb5){if(_0x396cb5){return _0x396cb5[_0x4afc('0x64')](_0x222e68[_0x4afc('0x3e')][_0x4afc('0x5f')]);}})[_0x4afc('0x1f')](respondWithStatusCode(_0xa3f8b7,null))[_0x4afc('0x2a')](handleError(_0xa3f8b7,null));};exports[_0x4afc('0x65')]=function(_0x4f8b24,_0x2d7d36,_0x33eeb0){if(_0x4f8b24[_0x4afc('0x59')]['id']){delete _0x4f8b24[_0x4afc('0x59')]['id'];}return db[_0x4afc('0x4e')][_0x4afc('0x57')]({'where':{'id':_0x4f8b24[_0x4afc('0x54')]['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0x2d7d36,null))[_0x4afc('0x1f')](function(_0x4d3da7){if(_0x4d3da7){_0x4f8b24[_0x4afc('0x59')][_0x4afc('0x66')]=_0x4d3da7['id'];return db[_0x4afc('0x5c')][_0x4afc('0x58')](_0x4f8b24['body']);}})[_0x4afc('0x1f')](respondWithResult(_0x2d7d36,null))[_0x4afc('0x2a')](handleError(_0x2d7d36,null));};exports[_0x4afc('0x67')]=function(_0x4956b2,_0x46fe52,_0x96f84d){var _0x248f10={};var _0xf9b232={};var _0x253d25;var _0x2b20ad;return db['ChatGroup'][_0x4afc('0x62')]({'where':{'id':_0x4956b2[_0x4afc('0x54')]['id']}})['then'](handleEntityNotFound(_0x46fe52,null))[_0x4afc('0x1f')](function(_0x41a3a9){if(_0x41a3a9){_0x253d25=_0x41a3a9;_0xf9b232[_0x4afc('0x3d')]=_['keys'](db[_0x4afc('0x5c')][_0x4afc('0x55')]);_0xf9b232[_0x4afc('0x3e')]=_[_0x4afc('0x3f')](_0x4956b2['query']);_0xf9b232[_0x4afc('0x40')]=_[_0x4afc('0x41')](_0xf9b232['model'],_0xf9b232[_0x4afc('0x3e')]);_0x248f10[_0x4afc('0x42')]=_[_0x4afc('0x41')](_0xf9b232['model'],qs['fields'](_0x4956b2[_0x4afc('0x3e')][_0x4afc('0x43')]));_0x248f10[_0x4afc('0x42')]=_0x248f10[_0x4afc('0x42')][_0x4afc('0x44')]?_0x248f10[_0x4afc('0x42')]:_0xf9b232[_0x4afc('0x3d')];_0x248f10[_0x4afc('0x48')]=qs[_0x4afc('0x49')](_0x4956b2[_0x4afc('0x3e')][_0x4afc('0x49')]);_0x248f10[_0x4afc('0x4b')]=qs[_0x4afc('0x40')](_[_0x4afc('0x68')](_0x4956b2[_0x4afc('0x3e')],_0xf9b232[_0x4afc('0x40')]));if(_0x4956b2['query'][_0x4afc('0x4d')]){_0x248f10[_0x4afc('0x4b')]=_['merge'](_0x248f10[_0x4afc('0x4b')],{'$or':_['map'](_0x248f10['attributes'],function(_0x6ac9ae){var _0x4ae14b={};_0x4ae14b[_0x6ac9ae]={'$like':'%'+_0x4956b2['query'][_0x4afc('0x4d')]+'%'};return _0x4ae14b;})});}if(_0x4956b2['query'][_0x4afc('0x69')]){var _0x492301=_0x4956b2[_0x4afc('0x3e')][_0x4afc('0x69')][_0x4afc('0x6a')](',');var _0x40536f={};_0x40536f[_0x492301[0x0]]={'$gte':moment(_0x492301[0x1])[_0x4afc('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x248f10[_0x4afc('0x4b')]=_[_0x4afc('0x4a')](_0x248f10['where'],_0x40536f);}_0x248f10=_['merge']({},_0x248f10,_0x4956b2[_0x4afc('0x56')]);return _0x253d25[_0x4afc('0x67')](_0x248f10);}})[_0x4afc('0x1f')](function(_0x115121){if(_0x115121){_0x2b20ad=_0x115121[_0x4afc('0x44')];if(!_0x4956b2['query'][_0x4afc('0x45')](_0x4afc('0x46'))){_0x248f10[_0x4afc('0x2e')]=qs[_0x4afc('0x2e')](_0x4956b2['query'][_0x4afc('0x2e')]);_0x248f10['offset']=qs[_0x4afc('0x47')](_0x4956b2[_0x4afc('0x3e')][_0x4afc('0x47')]);}return _0x253d25[_0x4afc('0x67')](_0x248f10);}})[_0x4afc('0x1f')](function(_0x29c8aa){if(_0x29c8aa){return _0x29c8aa?{'count':_0x2b20ad,'rows':_0x29c8aa}:null;}})[_0x4afc('0x1f')](respondWithResult(_0x46fe52,null))[_0x4afc('0x2a')](handleError(_0x46fe52,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 4959d87..a2db18f 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 _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x3dea70,_0x23f401){var _0x28f16e=function(_0x444bab){while(--_0x444bab){_0x3dea70['push'](_0x3dea70['shift']());}};_0x28f16e(++_0x23f401);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x65f6('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){ChatGroupEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);ChatGroupEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x163ff3,_0x260b31){var _0x4e87f6=function(_0x29cfb9){while(--_0x29cfb9){_0x163ff3['push'](_0x163ff3['shift']());}};_0x4e87f6(++_0x260b31);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x65f6('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){ChatGroupEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);ChatGroupEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index ecc7bd7..89f1fce 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 _0x8efc=['moment','request-promise','path','./chatGroup.attributes','define','ChatGroup','chat_groups','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8efc,0x8f));var _0xc8ef=function(_0x46ef1d,_0x24926){_0x46ef1d=_0x46ef1d-0x0;var _0x49ce69=_0x8efc[_0x46ef1d];return _0x49ce69;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc8ef('0x0'))('api');var moment=require(_0xc8ef('0x1'));var BPromise=require('bluebird');var rp=require(_0xc8ef('0x2'));var fs=require('fs');var path=require(_0xc8ef('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc8ef('0x4'));module['exports']=function(_0x1d65c1,_0x1b4901){return _0x1d65c1[_0xc8ef('0x5')](_0xc8ef('0x6'),attributes,{'tableName':_0xc8ef('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf611=['path','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','util','../../config/logger','api'];(function(_0x2947b9,_0x48ac26){var _0x23ae65=function(_0x477e38){while(--_0x477e38){_0x2947b9['push'](_0x2947b9['shift']());}};_0x23ae65(++_0x48ac26);}(_0xf611,0x7b));var _0x1f61=function(_0x4145ed,_0x1965e3){_0x4145ed=_0x4145ed-0x0;var _0x2294a6=_0xf611[_0x4145ed];return _0x2294a6;};'use strict';var _=require('lodash');var util=require(_0x1f61('0x0'));var logger=require(_0x1f61('0x1'))(_0x1f61('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f61('0x3'));var rimraf=require('rimraf');var config=require(_0x1f61('0x4'));var attributes=require(_0x1f61('0x5'));module['exports']=function(_0x4faa5b,_0x290165){return _0x4faa5b[_0x1f61('0x6')](_0x1f61('0x7'),attributes,{'tableName':_0x1f61('0x8'),'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 8f534df..5e89d86 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 _0x7375=['jayson/promise','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x26ce5a,_0x5743db){var _0x4bc231=function(_0x5cf4d8){while(--_0x5cf4d8){_0x26ce5a['push'](_0x26ce5a['shift']());}};_0x4bc231(++_0x5743db);}(_0x7375,0x76));var _0x5737=function(_0x54ab12,_0x2cc565){_0x54ab12=_0x54ab12-0x0;var _0x5e70a4=_0x7375[_0x54ab12];return _0x5e70a4;};'use strict';var _=require(_0x5737('0x0'));var util=require(_0x5737('0x1'));var moment=require('moment');var BPromise=require(_0x5737('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5737('0x3'))['db'];var utils=require(_0x5737('0x4'));var logger=require(_0x5737('0x5'))('rpc');var config=require(_0x5737('0x6'));var jayson=require(_0x5737('0x7'));var client=jayson['client'][_0x5737('0x8')]({'port':0x232a});config[_0x5737('0x9')]=_['defaults'](config[_0x5737('0x9')],{'host':_0x5737('0xa'),'port':0x18eb});var socket=require(_0x5737('0xb'))(new Redis(config[_0x5737('0x9')]));require(_0x5737('0xc'))[_0x5737('0xd')](socket);function respondWithRpcPromise(_0x5ebb76,_0x4764fb,_0xa0a81){return new BPromise(function(_0x37d27b,_0x42c560){return client[_0x5737('0xe')](_0x5ebb76,_0xa0a81)['then'](function(_0x55d2ea){logger[_0x5737('0xf')](_0x5737('0x10'),_0x4764fb,'request\x20sent');logger['debug'](_0x5737('0x11'),_0x4764fb,_0x5737('0x12'),JSON[_0x5737('0x13')](_0x55d2ea));if(_0x55d2ea[_0x5737('0x14')]){if(_0x55d2ea[_0x5737('0x14')][_0x5737('0x15')]===0x1f4){logger['error'](_0x5737('0x10'),_0x4764fb,_0x55d2ea['error'][_0x5737('0x16')]);return _0x42c560(_0x55d2ea[_0x5737('0x14')]['message']);}logger[_0x5737('0x14')](_0x5737('0x10'),_0x4764fb,_0x55d2ea[_0x5737('0x14')]['message']);return _0x37d27b(_0x55d2ea[_0x5737('0x14')][_0x5737('0x16')]);}else{logger[_0x5737('0xf')]('ChatGroup,\x20%s,\x20%s',_0x4764fb,_0x5737('0x12'));_0x37d27b(_0x55d2ea[_0x5737('0x17')][_0x5737('0x16')]);}})[_0x5737('0x18')](function(_0x2e80af){logger[_0x5737('0x14')](_0x5737('0x10'),_0x4764fb,_0x2e80af);_0x42c560(_0x2e80af);});});} \ No newline at end of file +var _0x2472=['error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2472,0x1cf));var _0x2247=function(_0x4cb27c,_0x5bdac2){_0x4cb27c=_0x4cb27c-0x0;var _0x1bda3a=_0x2472[_0x4cb27c];return _0x1bda3a;};'use strict';var _=require(_0x2247('0x0'));var util=require(_0x2247('0x1'));var moment=require(_0x2247('0x2'));var BPromise=require('bluebird');var rs=require(_0x2247('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2247('0x4'))['db'];var utils=require(_0x2247('0x5'));var logger=require('../../config/logger')(_0x2247('0x6'));var config=require(_0x2247('0x7'));var jayson=require(_0x2247('0x8'));var client=jayson[_0x2247('0x9')][_0x2247('0xa')]({'port':0x232a});config[_0x2247('0xb')]=_[_0x2247('0xc')](config[_0x2247('0xb')],{'host':_0x2247('0xd'),'port':0x18eb});var socket=require(_0x2247('0xe'))(new Redis(config[_0x2247('0xb')]));require(_0x2247('0xf'))[_0x2247('0x10')](socket);function respondWithRpcPromise(_0x19be06,_0xfb1b9e,_0x5cf6b0){return new BPromise(function(_0x4e05d5,_0x35485a){return client['request'](_0x19be06,_0x5cf6b0)[_0x2247('0x11')](function(_0xf4be){logger[_0x2247('0x12')](_0x2247('0x13'),_0xfb1b9e,_0x2247('0x14'));logger[_0x2247('0x15')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0xfb1b9e,_0x2247('0x14'),JSON[_0x2247('0x16')](_0xf4be));if(_0xf4be[_0x2247('0x17')]){if(_0xf4be[_0x2247('0x17')][_0x2247('0x18')]===0x1f4){logger['error'](_0x2247('0x13'),_0xfb1b9e,_0xf4be[_0x2247('0x17')][_0x2247('0x19')]);return _0x35485a(_0xf4be[_0x2247('0x17')][_0x2247('0x19')]);}logger[_0x2247('0x17')](_0x2247('0x13'),_0xfb1b9e,_0xf4be[_0x2247('0x17')][_0x2247('0x19')]);return _0x4e05d5(_0xf4be['error']['message']);}else{logger[_0x2247('0x12')](_0x2247('0x13'),_0xfb1b9e,_0x2247('0x14'));_0x4e05d5(_0xf4be['result'][_0x2247('0x19')]);}})[_0x2247('0x1a')](function(_0x1d1ab0){logger[_0x2247('0x17')](_0x2247('0x13'),_0xfb1b9e,_0x1d1ab0);_0x35485a(_0x1d1ab0);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 2aaad97..a11a63d 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 _0x878f=['emit','removeListener','register','chatGroup:','./chatGroup.events','save','remove'];(function(_0x4ca350,_0x47af51){var _0x1219fc=function(_0x4efa06){while(--_0x4efa06){_0x4ca350['push'](_0x4ca350['shift']());}};_0x1219fc(++_0x47af51);}(_0x878f,0x15b));var _0xf878=function(_0x4909a9,_0x45de94){_0x4909a9=_0x4909a9-0x0;var _0x34623c=_0x878f[_0x4909a9];return _0x34623c;};'use strict';var ChatGroupEvents=require(_0xf878('0x0'));var events=[_0xf878('0x1'),_0xf878('0x2'),'update'];function createListener(_0x575346,_0x49fc5f){return function(_0x20f01b){_0x49fc5f[_0xf878('0x3')](_0x575346,_0x20f01b);};}function removeListener(_0x39720d,_0x1df876){return function(){ChatGroupEvents[_0xf878('0x4')](_0x39720d,_0x1df876);};}exports[_0xf878('0x5')]=function(_0x303821){for(var _0x55eaf6=0x0,_0xd692ac=events['length'];_0x55eaf6<_0xd692ac;_0x55eaf6++){var _0x4dd31a=events[_0x55eaf6];var _0x1aaf5b=createListener(_0xf878('0x6')+_0x4dd31a,_0x303821);ChatGroupEvents['on'](_0x4dd31a,_0x1aaf5b);}}; \ No newline at end of file +var _0xed9b=['chatGroup:','./chatGroup.events','save','remove','update','emit','removeListener','register'];(function(_0x19be04,_0x166c55){var _0x2b0ed0=function(_0x3d8900){while(--_0x3d8900){_0x19be04['push'](_0x19be04['shift']());}};_0x2b0ed0(++_0x166c55);}(_0xed9b,0x189));var _0xbed9=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xed9b[_0x82129b];return _0x2ae5dc;};'use strict';var ChatGroupEvents=require(_0xbed9('0x0'));var events=[_0xbed9('0x1'),_0xbed9('0x2'),_0xbed9('0x3')];function createListener(_0x1499eb,_0x3f6dbb){return function(_0x162f2c){_0x3f6dbb[_0xbed9('0x4')](_0x1499eb,_0x162f2c);};}function removeListener(_0x3eb923,_0x4c701e){return function(){ChatGroupEvents[_0xbed9('0x5')](_0x3eb923,_0x4c701e);};}exports[_0xbed9('0x6')]=function(_0x51bdd2){for(var _0xaf2b9c=0x0,_0x56f04d=events['length'];_0xaf2b9c<_0x56f04d;_0xaf2b9c++){var _0x56c589=events[_0xaf2b9c];var _0x292a8f=createListener(_0xbed9('0x7')+_0x56c589,_0x51bdd2);ChatGroupEvents['on'](_0x56c589,_0x292a8f);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index d9c3834..e16b528 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 _0x5900=['update','delete','removeMembers','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/unread','/:id/members','getMembers','/:id/messages','create','post','addMessage','put'];(function(_0x3ec9c5,_0x1d17e1){var _0x206179=function(_0xa46572){while(--_0xa46572){_0x3ec9c5['push'](_0x3ec9c5['shift']());}};_0x206179(++_0x1d17e1);}(_0x5900,0xf6));var _0x0590=function(_0x606bde,_0x42866b){_0x606bde=_0x606bde-0x0;var _0x24ed48=_0x5900[_0x606bde];return _0x24ed48;};'use strict';var multer=require(_0x0590('0x0'));var util=require('util');var path=require(_0x0590('0x1'));var timeout=require(_0x0590('0x2'));var express=require('express');var router=express[_0x0590('0x3')]();var auth=require(_0x0590('0x4'));var interaction=require(_0x0590('0x5'));var config=require(_0x0590('0x6'));var controller=require('./chatGroup.controller');router[_0x0590('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0590('0x7')]('/describe',auth[_0x0590('0x8')](),controller['describe']);router[_0x0590('0x7')](_0x0590('0x9'),auth[_0x0590('0x8')](),controller['show']);router['get'](_0x0590('0xa'),auth[_0x0590('0x8')](),controller['getUnread']);router[_0x0590('0x7')](_0x0590('0xb'),auth[_0x0590('0x8')](),controller[_0x0590('0xc')]);router[_0x0590('0x7')](_0x0590('0xd'),auth[_0x0590('0x8')](),controller['getMessages']);router['post']('/',auth[_0x0590('0x8')](),controller[_0x0590('0xe')]);router[_0x0590('0xf')]('/:id/members',auth[_0x0590('0x8')](),controller['addMembers']);router[_0x0590('0xf')](_0x0590('0xd'),auth[_0x0590('0x8')](),controller[_0x0590('0x10')]);router[_0x0590('0x11')](_0x0590('0x9'),auth[_0x0590('0x8')](),controller[_0x0590('0x12')]);router[_0x0590('0x13')]('/:id',auth[_0x0590('0x8')](),controller['destroy']);router['delete'](_0x0590('0xb'),auth[_0x0590('0x8')](),controller[_0x0590('0x14')]);module[_0x0590('0x15')]=router; \ No newline at end of file +var _0x2230=['isAuthenticated','/describe','describe','/:id','show','getUnread','getMembers','getMessages','post','/:id/members','/:id/messages','put','update','delete','destroy','removeMembers','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1fae5f,_0x46b58c){var _0x2ba661=function(_0x3923dd){while(--_0x3923dd){_0x1fae5f['push'](_0x1fae5f['shift']());}};_0x2ba661(++_0x46b58c);}(_0x2230,0xd9));var _0x0223=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2230[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x0223('0x0'));var path=require(_0x0223('0x1'));var timeout=require(_0x0223('0x2'));var express=require('express');var router=express[_0x0223('0x3')]();var auth=require(_0x0223('0x4'));var interaction=require(_0x0223('0x5'));var config=require(_0x0223('0x6'));var controller=require('./chatGroup.controller');router[_0x0223('0x7')]('/',auth[_0x0223('0x8')](),controller['index']);router[_0x0223('0x7')](_0x0223('0x9'),auth['isAuthenticated'](),controller[_0x0223('0xa')]);router[_0x0223('0x7')](_0x0223('0xb'),auth['isAuthenticated'](),controller[_0x0223('0xc')]);router[_0x0223('0x7')]('/:id/unread',auth[_0x0223('0x8')](),controller[_0x0223('0xd')]);router[_0x0223('0x7')]('/:id/members',auth[_0x0223('0x8')](),controller[_0x0223('0xe')]);router[_0x0223('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0x0223('0xf')]);router[_0x0223('0x10')]('/',auth[_0x0223('0x8')](),controller['create']);router[_0x0223('0x10')](_0x0223('0x11'),auth['isAuthenticated'](),controller['addMembers']);router[_0x0223('0x10')](_0x0223('0x12'),auth[_0x0223('0x8')](),controller['addMessage']);router[_0x0223('0x13')]('/:id',auth[_0x0223('0x8')](),controller[_0x0223('0x14')]);router[_0x0223('0x15')](_0x0223('0xb'),auth[_0x0223('0x8')](),controller[_0x0223('0x16')]);router[_0x0223('0x15')](_0x0223('0x11'),auth['isAuthenticated'](),controller[_0x0223('0x17')]);module[_0x0223('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 4959ddd..5482ba8 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 _0x4173=['INTEGER','ENUM','star','TEXT','STRING','long','DATE','sequelize','exports','BOOLEAN'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x4173,0x101));var _0x3417=function(_0x29dd82,_0x3f45c3){_0x29dd82=_0x29dd82-0x0;var _0x272a06=_0x4173[_0x29dd82];return _0x272a06;};'use strict';var Sequelize=require(_0x3417('0x0'));module[_0x3417('0x1')]={'closed':{'type':Sequelize[_0x3417('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x3417('0x3')]},'ratingType':{'type':Sequelize[_0x3417('0x4')](_0x3417('0x5'),'thumb'),'defaultValue':_0x3417('0x5')},'ratingMessage':{'type':Sequelize[_0x3417('0x6')]},'pathTranscript':{'type':Sequelize[_0x3417('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3417('0x7')]},'thirdDisposition':{'type':Sequelize[_0x3417('0x7')]},'note':{'type':Sequelize[_0x3417('0x7')]},'browserName':{'type':Sequelize[_0x3417('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x3417('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x3417('0x7')]},'deviceVendor':{'type':Sequelize[_0x3417('0x7')]},'deviceType':{'type':Sequelize[_0x3417('0x7')]},'referer':{'type':Sequelize[_0x3417('0x6')]},'customerIp':{'type':Sequelize[_0x3417('0x7')]},'formData':{'type':Sequelize[_0x3417('0x6')](_0x3417('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x3417('0x9')]},'lastMsgDirection':{'type':Sequelize[_0x3417('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x3417('0x6')]}}; \ No newline at end of file +var _0x4453=['exports','BOOLEAN','INTEGER','ENUM','thumb','star','TEXT','STRING','DATE','out','sequelize'];(function(_0xa89478,_0x5c4cdc){var _0xf49237=function(_0x48ab1f){while(--_0x48ab1f){_0xa89478['push'](_0xa89478['shift']());}};_0xf49237(++_0x5c4cdc);}(_0x4453,0x18b));var _0x3445=function(_0x44aaed,_0x5c9172){_0x44aaed=_0x44aaed-0x0;var _0x1bc121=_0x4453[_0x44aaed];return _0x1bc121;};'use strict';var Sequelize=require(_0x3445('0x0'));module[_0x3445('0x1')]={'closed':{'type':Sequelize[_0x3445('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x3445('0x3')]},'ratingType':{'type':Sequelize[_0x3445('0x4')]('star',_0x3445('0x5')),'defaultValue':_0x3445('0x6')},'ratingMessage':{'type':Sequelize[_0x3445('0x7')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x3445('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x3445('0x9')]},'disposition':{'type':Sequelize[_0x3445('0x8')]},'secondDisposition':{'type':Sequelize[_0x3445('0x8')]},'thirdDisposition':{'type':Sequelize[_0x3445('0x8')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x3445('0x8')]},'browserVersion':{'type':Sequelize[_0x3445('0x8')]},'osName':{'type':Sequelize[_0x3445('0x8')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x3445('0x8')]},'deviceVendor':{'type':Sequelize[_0x3445('0x8')]},'deviceType':{'type':Sequelize[_0x3445('0x8')]},'referer':{'type':Sequelize[_0x3445('0x7')]},'customerIp':{'type':Sequelize[_0x3445('0x8')]},'formData':{'type':Sequelize[_0x3445('0x7')]('long')},'read1stAt':{'type':Sequelize[_0x3445('0x9')]},'lastMsgAt':{'type':Sequelize[_0x3445('0x9')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x3445('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x3445('0x8')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x3445('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 933d68e..a8e752a 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 _0x3f20=['Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','update','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','mimetype','Unauthorized','Attachment','attachId','join','server/files/attachments/','basename','close','root','server/files/chat/upload/','format','transcript-%s.txt','ChatMessage','Messages','CmContact','%s%d','agentAlias','System','customer','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','Smtp','service','host','port','secure','authentication','auth','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','pick','ChatInteractionId','filter','$gte','include','findAll','rows','getMyMessages','includeAgent','addTags','spread','emit','chatInteractionTags:save','removeTags','server','files','attachments','transcript-%d-%s.zip','push','firstName','lastName','Account','Owner','mkdirSync','10px','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','renderFile','views','downloadInteraction.html','transcript-','log','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','client','then','info','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','ChatInteraction,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','Users','map','fullname','TagIds','Tags','split','index','ChatInteraction','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','select','field','color','from','u.id','u.fullname','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','having','Contact','operator','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','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','buildExpression','body','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','replace','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','Sequelize','QueryTypes','SELECT','clone','unreadMessages','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','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','i.*','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','all','show','params','rawAttributes','includeAll','options','create','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out'];(function(_0x199b38,_0x66def6){var _0x123b80=function(_0x322b70){while(--_0x322b70){_0x199b38['push'](_0x199b38['shift']());}};_0x123b80(++_0x66def6);}(_0x3f20,0x6c));var _0x03f2=function(_0x3e69ea,_0x307377){_0x3e69ea=_0x3e69ea-0x0;var _0x350d8f=_0x3f20[_0x3e69ea];return _0x350d8f;};'use strict';var pdf=require(_0x03f2('0x0'));var emlformat=require(_0x03f2('0x1'));var rimraf=require(_0x03f2('0x2'));var zipdir=require(_0x03f2('0x3'));var jsonpatch=require(_0x03f2('0x4'));var rp=require(_0x03f2('0x5'));var moment=require(_0x03f2('0x6'));var BPromise=require(_0x03f2('0x7'));var Mustache=require(_0x03f2('0x8'));var util=require(_0x03f2('0x9'));var path=require('path');var sox=require(_0x03f2('0xa'));var csv=require('to-csv');var ejs=require(_0x03f2('0xb'));var fs=require('fs');var _=require(_0x03f2('0xc'));var squel=require(_0x03f2('0xd'));var crypto=require('crypto');var jsforce=require(_0x03f2('0xe'));var deskjs=require(_0x03f2('0xf'));var toCsv=require(_0x03f2('0x10'));var querystring=require(_0x03f2('0x11'));var Papa=require('papaparse');var Redis=require(_0x03f2('0x12'));var authService=require(_0x03f2('0x13'));var qs=require(_0x03f2('0x14'));var as=require(_0x03f2('0x15'));var hardwareService=require(_0x03f2('0x16'));var logger=require('../../config/logger')(_0x03f2('0x17'));var utils=require(_0x03f2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x03f2('0x19'));var db=require('../../mysqldb')['db'];config[_0x03f2('0x1a')]=_[_0x03f2('0x1b')](config[_0x03f2('0x1a')],{'host':_0x03f2('0x1c'),'port':0x18eb});var socket=require(_0x03f2('0x1d'))(new Redis(config[_0x03f2('0x1a')]));require(_0x03f2('0x1e'))[_0x03f2('0x1f')](socket);var jayson=require(_0x03f2('0x20'));var client=jayson['client'][_0x03f2('0x21')]({'port':0x232b});var client9004=jayson[_0x03f2('0x22')][_0x03f2('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x51d13b,_0x3136ee,_0x3defc5,_0x413491){return new BPromise(function(_0x2fa63e,_0x3aed00){var _0x282200=_0x413491||client;return _0x282200['request'](_0x51d13b,_0x3defc5)[_0x03f2('0x23')](function(_0x4c37f9){logger[_0x03f2('0x24')]('ChatInteraction,\x20%s,\x20%s',_0x3136ee,'request\x20sent');logger['debug'](_0x03f2('0x25'),_0x3136ee,_0x03f2('0x26'),JSON['stringify'](_0x4c37f9));if(_0x4c37f9[_0x03f2('0x27')]){if(_0x4c37f9[_0x03f2('0x27')]['code']===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x3136ee,_0x4c37f9['error']['message']);return _0x3aed00(_0x4c37f9[_0x03f2('0x27')][_0x03f2('0x28')]);}logger[_0x03f2('0x27')](_0x03f2('0x29'),_0x3136ee,_0x4c37f9[_0x03f2('0x27')]['message']);return _0x2fa63e(_0x4c37f9['error'][_0x03f2('0x28')]);}else{logger['info'](_0x03f2('0x29'),_0x3136ee,_0x03f2('0x26'));_0x2fa63e(_0x4c37f9[_0x03f2('0x2a')][_0x03f2('0x28')]);}})[_0x03f2('0x2b')](function(_0x324c7f){logger[_0x03f2('0x27')](_0x03f2('0x29'),_0x3136ee,_0x324c7f);_0x3aed00(_0x324c7f);});});}function respondWithStatusCode(_0x97917b,_0x599679){_0x599679=_0x599679||0xcc;return function(_0xfc839a){if(_0xfc839a){return _0x97917b[_0x03f2('0x2c')](_0x599679);}return _0x97917b[_0x03f2('0x2d')](_0x599679)[_0x03f2('0x2e')]();};}function respondWithResult(_0x4ebb17,_0x1eb689){_0x1eb689=_0x1eb689||0xc8;return function(_0x2df8c2){if(_0x2df8c2){return _0x4ebb17[_0x03f2('0x2d')](_0x1eb689)[_0x03f2('0x2f')](_0x2df8c2);}};}function respondWithFilteredResult(_0x1ef39d,_0x4d3b7c){return function(_0x430427){if(_0x430427){var _0x2c9f5b=_0x430427[_0x03f2('0x30')],_0x155ddb=_0x4d3b7c[_0x03f2('0x31')],_0x411790=_0x4d3b7c['offset']+_0x4d3b7c['limit'],_0x2c4801;if(_0x411790>=_0x2c9f5b){_0x411790=_0x2c9f5b;_0x2c4801=0xc8;}else{_0x2c4801=0xce;}_0x1ef39d[_0x03f2('0x2d')](_0x2c4801);return _0x1ef39d[_0x03f2('0x32')](_0x03f2('0x33'),_0x155ddb+'-'+_0x411790+'/'+_0x2c9f5b)[_0x03f2('0x2f')](_0x430427);}return null;};}function patchUpdates(_0x176f50){return function(_0x364804){try{jsonpatch[_0x03f2('0x34')](_0x364804,_0x176f50,!![]);}catch(_0x498088){return BPromise[_0x03f2('0x35')](_0x498088);}return _0x364804[_0x03f2('0x36')]();};}function saveUpdates(_0x511546,_0x53e4ef){return function(_0x8d3c6b){if(_0x8d3c6b){return _0x8d3c6b['update'](_0x511546)['then'](function(_0x58c88d){return _0x58c88d;});}return null;};}function removeEntity(_0x59732b,_0x338a3a){return function(_0x1a8803){if(_0x1a8803){return _0x1a8803[_0x03f2('0x37')]()[_0x03f2('0x23')](function(){_0x59732b[_0x03f2('0x2d')](0xcc)[_0x03f2('0x2e')]();});}};}function handleEntityNotFound(_0x501cdb,_0xc86010){return function(_0x53d22c){if(!_0x53d22c){_0x501cdb[_0x03f2('0x2c')](0x194);}return _0x53d22c;};}function handleError(_0xaf16f8,_0x1f7731){_0x1f7731=_0x1f7731||0x1f4;return function(_0x105355){logger[_0x03f2('0x27')](_0x105355[_0x03f2('0x38')]);if(_0x105355[_0x03f2('0x39')]){delete _0x105355[_0x03f2('0x39')];}_0xaf16f8[_0x03f2('0x2d')](_0x1f7731)[_0x03f2('0x3a')](_0x105355);};}function getInteractionUsers(_0x23b972,_0x11dc07){return new BPromise(function(_0x959986,_0x51d198){try{if(_0x11dc07[_0x23b972['id']]){_0x23b972[_0x03f2('0x3b')]=_[_0x03f2('0x3c')](_0x11dc07[_0x23b972['id']],function(_0xb8e383){return{'id':_0xb8e383['id'],'fullname':_0xb8e383[_0x03f2('0x3d')]};});}}catch(_0x1df857){_0x51d198(_0x1df857);}_0x959986(_0x23b972);});}function getInteractionTags(_0x2d309b,_0x2c7dcb){return new BPromise(function(_0x1d04c5,_0x1230f5){try{if(_0x2d309b[_0x03f2('0x3e')]){_0x2d309b[_0x03f2('0x3f')]=[];_0x2d309b[_0x03f2('0x3e')][_0x03f2('0x40')](',')['forEach'](function(_0xecea54){_0x2d309b['Tags']['push'](_0x2c7dcb[_0xecea54]);});}delete _0x2d309b[_0x03f2('0x3e')];}catch(_0x54a3d0){_0x1230f5(_0x54a3d0);}_0x1d04c5(_0x2d309b);});}function updateChatInteraction(_0x330894,_0x32f5fa,_0x150288){return new BPromise(function(_0x501b4c,_0x480f06){return getInteractionUsers(_0x330894,_0x150288)['then'](function(_0x44d330){return getInteractionTags(_0x44d330,_0x32f5fa);})[_0x03f2('0x23')](function(_0x1980d0){_0x501b4c(_0x1980d0);})['catch'](function(_0x2ffef7){_0x480f06(_0x2ffef7);});});}exports[_0x03f2('0x41')]=function(_0x153d13,_0x209f79){var _0x2c580c={},_0x3ea8e8={},_0x4b192d={'count':0x0,'rows':[]};var _0x176ac4=_['map'](db[_0x03f2('0x42')]['rawAttributes'],function(_0x5dc16c){return{'name':_0x5dc16c[_0x03f2('0x43')],'type':_0x5dc16c[_0x03f2('0x44')][_0x03f2('0x45')]};});_0x3ea8e8[_0x03f2('0x46')]=_[_0x03f2('0x3c')](_0x176ac4,_0x03f2('0x39'));_0x3ea8e8['query']=_[_0x03f2('0x47')](_0x153d13[_0x03f2('0x48')]);_0x3ea8e8[_0x03f2('0x49')]=_[_0x03f2('0x4a')](_0x3ea8e8['model'],_0x3ea8e8[_0x03f2('0x48')]);_0x2c580c[_0x03f2('0x4b')]=_['intersection'](_0x3ea8e8[_0x03f2('0x46')],qs[_0x03f2('0x4c')](_0x153d13[_0x03f2('0x48')]['fields']));_0x2c580c[_0x03f2('0x4b')]=_0x2c580c[_0x03f2('0x4b')][_0x03f2('0x4d')]?_0x2c580c[_0x03f2('0x4b')]:_0x3ea8e8['model'];if(!_0x153d13[_0x03f2('0x48')][_0x03f2('0x4e')](_0x03f2('0x4f'))){_0x2c580c[_0x03f2('0x50')]=qs['limit'](_0x153d13['query'][_0x03f2('0x50')]);_0x2c580c[_0x03f2('0x31')]=qs[_0x03f2('0x31')](_0x153d13[_0x03f2('0x48')][_0x03f2('0x31')]);}_0x2c580c[_0x03f2('0x51')]=qs[_0x03f2('0x52')](_0x153d13['query'][_0x03f2('0x52')]);_0x2c580c[_0x03f2('0x53')]=qs[_0x03f2('0x49')](_['pick'](_0x153d13[_0x03f2('0x48')],_0x3ea8e8[_0x03f2('0x49')]),_0x176ac4);var _0x20e8c0=[];var _0xaaeee7=squel[_0x03f2('0x54')]()[_0x03f2('0x55')]('id')[_0x03f2('0x55')](_0x03f2('0x39'))[_0x03f2('0x55')](_0x03f2('0x56'))[_0x03f2('0x57')]('tools_tags');var _0x36d398=squel['select']()[_0x03f2('0x55')](_0x03f2('0x58'))[_0x03f2('0x55')](_0x03f2('0x59'))[_0x03f2('0x55')]('ui.ChatInteractionId')['from'](_0x03f2('0x5a'),'ui')[_0x03f2('0x5b')](_0x03f2('0x5c'),'u',_0x03f2('0x5d'));var _0x553d75=squel[_0x03f2('0x54')]()[_0x03f2('0x57')](_0x03f2('0x5e'),'i')['left_join'](_0x03f2('0x5f'),'c',_0x03f2('0x60'))[_0x03f2('0x5b')](_0x03f2('0x5c'),'o',_0x03f2('0x61'))[_0x03f2('0x5b')](_0x03f2('0x62'),'a',_0x03f2('0x63'))[_0x03f2('0x5b')]('chat_messages','me',_0x03f2('0x64'))[_0x03f2('0x5b')](_0x03f2('0x65'),'it','it.ChatInteractionId\x20=\x20i.id')[_0x03f2('0x5b')]('tools_tags','t',_0x03f2('0x66'));var _0x11731c=squel[_0x03f2('0x67')]();var _0x3f7e30=[];var _0x58b5e5=squel[_0x03f2('0x67')]();var _0x1100ec;if(_0x153d13[_0x03f2('0x48')][_0x03f2('0x68')]){_0x1100ec=as['parseSearch'](_0x153d13[_0x03f2('0x48')][_0x03f2('0x68')]);var _0x567f00=_0x1100ec[_0x03f2('0x69')];for(var _0x599c62=0x0;_0x599c62<_0x1100ec[_0x03f2('0x6a')][_0x03f2('0x4d')];_0x599c62++){var _0x203212=_0x1100ec[_0x03f2('0x6a')][_0x599c62];var _0x2ea994='i';var _0x1935f4=_['find'](_0x176ac4,[_0x03f2('0x39'),_0x203212[_0x03f2('0x55')]]);if(!_0x1935f4){switch(_0x203212[_0x03f2('0x55')]){case'unreadMessages':if(_0x203212['value']==0x1){_0x553d75[_0x03f2('0x6b')]('`'+_0x203212[_0x03f2('0x55')]+'`\x20=\x200');}else{_0x553d75[_0x03f2('0x6b')]('`'+_0x203212[_0x03f2('0x55')]+'`\x20>\x200');}break;case _0x03f2('0x6c'):if(_0x203212[_0x03f2('0x6d')]==='$substring'){if(_0x203212[_0x03f2('0x6e')][_0x03f2('0x40')]('\x20')[_0x03f2('0x4d')]>0x1){_0x11731c[_0x567f00](_0x03f2('0x6f'),qs[_0x03f2('0x70')](_0x203212[_0x03f2('0x6e')]),null);}else{var _0x4f6ee0='%'+_0x203212[_0x03f2('0x6e')]+'%';_0x11731c[_0x567f00](_0x03f2('0x71'),_0x4f6ee0,_0x4f6ee0,_0x4f6ee0);}}else{_0x1935f4=_['find'](_0x176ac4,[_0x03f2('0x39'),_0x03f2('0x72')]);_0x203212['field']=_0x03f2('0x72');_0x8dbf2b=as['buildExpression'](_0x2ea994,_0x1935f4[_0x03f2('0x44')],_0x203212);_0x11731c[_0x567f00](_0x8dbf2b[_0x03f2('0x73')],_0x8dbf2b['value'][_0x03f2('0x74')],_0x8dbf2b[_0x03f2('0x6e')][_0x03f2('0x2e')]);}break;case _0x03f2('0x75'):var _0x2e14cb=_0x203212[_0x03f2('0x6e')][_0x03f2('0x40')](',')[_0x03f2('0x3c')](function(_0x2a4de4){return Number(_0x2a4de4);});_0x2e14cb[_0x03f2('0x76')](function(_0x28f6ba){_0x58b5e5['or'](_0x03f2('0x77'),'%,'+_0x28f6ba+',%');});_0x3f7e30=_[_0x03f2('0x78')](_0x3f7e30,_0x2e14cb);break;case _0x03f2('0x79'):if(_0x203212[_0x03f2('0x6d')]===_0x03f2('0x7a')){_0x11731c[_0x567f00](_0x03f2('0x7b'),'%'+_0x203212[_0x03f2('0x6e')]+'%',null);}else{_0x1935f4=_[_0x03f2('0x7c')](_0x176ac4,['name','UserId']);_0x203212['field']='UserId';_0x8dbf2b=as[_0x03f2('0x7d')](_0x2ea994,_0x1935f4[_0x03f2('0x44')],_0x203212);_0x11731c[_0x567f00](_0x8dbf2b[_0x03f2('0x73')],_0x8dbf2b[_0x03f2('0x6e')][_0x03f2('0x74')],_0x8dbf2b[_0x03f2('0x6e')]['end']);}break;case _0x03f2('0x7e'):_0x8dbf2b=as[_0x03f2('0x7d')]('me',null,_0x203212);_0x11731c[_0x567f00](_0x8dbf2b['text'],_0x8dbf2b[_0x03f2('0x6e')][_0x03f2('0x74')],_0x8dbf2b[_0x03f2('0x6e')][_0x03f2('0x2e')]);break;}}else{var _0x8dbf2b=as[_0x03f2('0x7d')](_0x2ea994,_0x1935f4[_0x03f2('0x44')],_0x203212);_0x11731c[_0x567f00](_0x8dbf2b['text'],_0x8dbf2b[_0x03f2('0x6e')]['start'],_0x8dbf2b[_0x03f2('0x6e')]['end']);}}}else{var _0x1d9ec8=_(_0x153d13[_0x03f2('0x48')])[_0x03f2('0x47')]()[_0x03f2('0x3c')](function(_0x4a53a0){return _['some'](_0x176ac4,[_0x03f2('0x39'),_0x4a53a0])?_0x4a53a0:undefined;})[_0x03f2('0x7f')]()[_0x03f2('0x6e')]();if(!_[_0x03f2('0x80')](_0x1d9ec8)){_0x1d9ec8['forEach'](function(_0x486d05){if(_0x486d05===_0x03f2('0x81')){_0x553d75['where'](_0x03f2('0x82'),[][_0x03f2('0x83')](_0x153d13[_0x03f2('0x48')][_0x486d05]));}else if(_0x486d05===_0x03f2('0x84')){var _0x503827=JSON[_0x03f2('0x85')](_0x153d13['query'][_0x486d05])['$gte'];var _0x546a31=JSON[_0x03f2('0x85')](_0x153d13[_0x03f2('0x48')][_0x486d05])[_0x03f2('0x86')];_0x553d75[_0x03f2('0x53')](_0x03f2('0x87'),_0x503827,_0x546a31);}else{if(_0x153d13['query'][_0x486d05]===_0x03f2('0x88')){_0x553d75[_0x03f2('0x53')]('i.'+_0x486d05+_0x03f2('0x89'));}else{_0x553d75[_0x03f2('0x53')]('i.'+_0x486d05+_0x03f2('0x8a'),_0x153d13[_0x03f2('0x48')][_0x486d05]);}}});}if(_0x153d13['query'][_0x03f2('0x8b')]){if(_0x153d13['query'][_0x03f2('0x8b')]==0x1){_0x553d75[_0x03f2('0x6b')]('`unreadMessages`\x20=\x200');}else{_0x553d75[_0x03f2('0x6b')](_0x03f2('0x8c'));}}if(_0x153d13[_0x03f2('0x48')][_0x03f2('0x8d')]){_0x3f7e30=_[_0x03f2('0x8e')](_0x153d13[_0x03f2('0x48')][_0x03f2('0x8d')])?_0x153d13[_0x03f2('0x48')][_0x03f2('0x8d')]:new Array(_0x153d13[_0x03f2('0x48')]['tag']);_0x3f7e30[_0x03f2('0x76')](function(_0x459a30){_0x58b5e5['or'](_0x03f2('0x77'),'%,'+_0x459a30+',%');});}if(_0x153d13[_0x03f2('0x48')]['filter']){var _0x3e8352=_0x153d13['query']['filter']['replace']('\x5c','\x5c\x5c')[_0x03f2('0x8f')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3e8352)){_0x11731c['or'](_0x03f2('0x90'),_0x3e8352+'%');}else{_0x11731c['or'](_0x03f2('0x91'),qs[_0x03f2('0x70')](_0x3e8352))['or'](_0x03f2('0x92'),_0x3e8352+'%');}}}_0x553d75['where'](_0x11731c);_0x553d75[_0x03f2('0x93')](_0x03f2('0x94'));var _0x577c6c={'type':db[_0x03f2('0x95')][_0x03f2('0x96')][_0x03f2('0x97')],'raw':!![]};var _0x533a79=_0x553d75[_0x03f2('0x98')]();_0x533a79['field'](_0x03f2('0x94'));_0x533a79['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x03f2('0x99'));if(_0x2c580c[_0x03f2('0x51')]){_0x2c580c[_0x03f2('0x51')][_0x03f2('0x76')](function(_0x3461ae){var _0xba82b0=_0x3461ae[0x0]==='contactName'?_0x3461ae[0x0]:'i.'+_0x3461ae[0x0];_0x553d75[_0x03f2('0x51')](_0xba82b0,_0x3461ae[0x1]===_0x03f2('0x9a')?![]:!![]);});}if(!_[_0x03f2('0x80')](_0x3f7e30)){_0x553d75[_0x03f2('0x6b')](_0x58b5e5);_0x533a79[_0x03f2('0x53')](_0x03f2('0x9b'),_0x3f7e30);}BPromise[_0x03f2('0x9c')]()[_0x03f2('0x23')](function(){if(!_0x1100ec){if(_0x153d13[_0x03f2('0x48')][_0x03f2('0x81')])return;_0x533a79[_0x03f2('0x53')](_0x03f2('0x9d'));_0x553d75[_0x03f2('0x53')](_0x03f2('0x9d'));return;}if(_0x153d13[_0x03f2('0x9e')][_0x03f2('0x9f')]!=='agent')return;return _0x153d13['user'][_0x03f2('0xa0')]({'attributes':['id'],'raw':!![]})[_0x03f2('0x23')](function(_0x2f5134){if(_['isEmpty'](_0x2f5134)){_0x533a79[_0x03f2('0x53')](_0x03f2('0xa1'));_0x553d75[_0x03f2('0x53')](_0x03f2('0xa1'));}else{_0x533a79[_0x03f2('0x53')](_0x03f2('0x82'),_['map'](_0x2f5134,'id'));_0x553d75[_0x03f2('0x53')](_0x03f2('0x82'),_[_0x03f2('0x3c')](_0x2f5134,'id'));}});})[_0x03f2('0x23')](function(){if(_0x153d13['user'][_0x03f2('0x9f')]==='agent'&&!_0x1100ec&&!_0x153d13[_0x03f2('0x48')][_0x03f2('0x81')])return[];return db[_0x03f2('0xa2')][_0x03f2('0x48')](_0x533a79[_0x03f2('0xa3')](),_0x577c6c);})['then'](function(_0x5d4f56){_0x4b192d[_0x03f2('0x30')]=_0x5d4f56[_0x03f2('0x4d')];if(_0x4b192d[_0x03f2('0x30')]===0x0)return[];return db[_0x03f2('0xa2')][_0x03f2('0x48')](_0xaaeee7[_0x03f2('0xa3')](),_0x577c6c)[_0x03f2('0x23')](function(_0x4725c8){_0x20e8c0=_[_0x03f2('0xa4')](_0x4725c8,'id');_0x577c6c=_[_0x03f2('0xa5')](_0x577c6c,{'model':db[_0x03f2('0x42')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x153d13[_0x03f2('0x48')][_0x03f2('0x4c')]){_0x2c580c[_0x03f2('0x4b')][_0x03f2('0x76')](function(_0x55cece){_0x553d75['field']('i.'+_0x55cece);});}else{_0x553d75[_0x03f2('0x55')](_0x03f2('0xa6'),_0x03f2('0x99'));_0x553d75[_0x03f2('0x55')](_0x03f2('0xa7'),_0x03f2('0xa8'));_0x553d75[_0x03f2('0x55')](_0x03f2('0xa9'),_0x03f2('0xaa'));_0x553d75['field'](_0x03f2('0xab'),_0x03f2('0xac'));_0x553d75[_0x03f2('0x55')](_0x03f2('0xad'));_0x553d75['field']('c.firstName','Contact.firstName');_0x553d75[_0x03f2('0x55')]('c.lastName',_0x03f2('0xae'));_0x553d75['field'](_0x03f2('0xaf'),_0x03f2('0xb0'));_0x553d75['field']('c.phone',_0x03f2('0xb1'));_0x553d75['field'](_0x03f2('0xb2'),_0x03f2('0xb3'));_0x553d75[_0x03f2('0x55')](_0x03f2('0xb4'),_0x03f2('0xb5'));_0x553d75['field'](_0x03f2('0xb6'),_0x03f2('0xb7'));_0x553d75['field'](_0x03f2('0xb8'),_0x03f2('0xb9'));_0x553d75[_0x03f2('0x55')](_0x03f2('0xba'),'TagIds');}if(_0x2c580c[_0x03f2('0x50')])_0x553d75[_0x03f2('0x50')](_0x2c580c[_0x03f2('0x50')]);if(_0x2c580c['offset'])_0x553d75[_0x03f2('0x31')](_0x2c580c['offset']);return db['sequelize'][_0x03f2('0x48')](_0x553d75[_0x03f2('0xa3')](),_0x577c6c);})[_0x03f2('0x23')](function(_0x184827){_0x36d398['where'](_0x03f2('0xbb'),_[_0x03f2('0x3c')](_0x184827,'id'));return db['sequelize'][_0x03f2('0x48')](_0x36d398['toString'](),_0x577c6c)[_0x03f2('0x23')](function(_0x4365ec){var _0x370c08=_['groupBy'](_0x4365ec,'ChatInteractionId');var _0x536f76=[];_0x184827['forEach'](function(_0x485546){_0x536f76['push'](updateChatInteraction(_0x485546,_0x20e8c0,_0x370c08));});return BPromise[_0x03f2('0xbc')](_0x536f76);});});})['then'](function(_0x3588dd){_0x4b192d['rows']=_0x3588dd;return _0x4b192d;})['then'](respondWithFilteredResult(_0x209f79,_0x2c580c))[_0x03f2('0x2b')](handleError(_0x209f79,null));};exports[_0x03f2('0xbd')]=function(_0x27f0db,_0x18a6bc){var _0x365c5e={'raw':![],'where':{'id':_0x27f0db[_0x03f2('0xbe')]['id']}},_0x1beab7={};_0x1beab7[_0x03f2('0x46')]=_[_0x03f2('0x47')](db[_0x03f2('0x42')][_0x03f2('0xbf')]);_0x1beab7[_0x03f2('0x48')]=_[_0x03f2('0x47')](_0x27f0db['query']);_0x1beab7[_0x03f2('0x49')]=_[_0x03f2('0x4a')](_0x1beab7[_0x03f2('0x46')],_0x1beab7['query']);_0x365c5e[_0x03f2('0x4b')]=_[_0x03f2('0x4a')](_0x1beab7[_0x03f2('0x46')],qs[_0x03f2('0x4c')](_0x27f0db[_0x03f2('0x48')]['fields']));_0x365c5e[_0x03f2('0x4b')]=_0x365c5e[_0x03f2('0x4b')][_0x03f2('0x4d')]?_0x365c5e['attributes']:_0x1beab7[_0x03f2('0x46')];if(_0x27f0db[_0x03f2('0x48')][_0x03f2('0xc0')]){_0x365c5e['include']=[{'all':!![]}];}_0x365c5e=_[_0x03f2('0xa5')]({},_0x365c5e,_0x27f0db[_0x03f2('0xc1')]);return db['ChatInteraction'][_0x03f2('0x7c')](_0x365c5e)[_0x03f2('0x23')](handleEntityNotFound(_0x18a6bc,null))[_0x03f2('0x23')](respondWithResult(_0x18a6bc,null))['catch'](handleError(_0x18a6bc,null));};exports[_0x03f2('0xc2')]=function(_0x4fa0ec,_0x4edbb0){return db[_0x03f2('0x42')][_0x03f2('0xc2')](_0x4fa0ec['body'],{})[_0x03f2('0x23')](respondWithResult(_0x4edbb0,0xc9))['catch'](handleError(_0x4edbb0,null));};exports['update']=function(_0x4f91f1,_0x4ad2f7){if(_0x4f91f1[_0x03f2('0x7e')]['id']){delete _0x4f91f1[_0x03f2('0x7e')]['id'];}return db[_0x03f2('0x42')]['find']({'where':{'id':_0x4f91f1[_0x03f2('0xbe')]['id']}})[_0x03f2('0x23')](handleEntityNotFound(_0x4ad2f7,null))[_0x03f2('0x23')](saveUpdates(_0x4f91f1[_0x03f2('0x7e')],null))['then'](respondWithResult(_0x4ad2f7,null))[_0x03f2('0x2b')](handleError(_0x4ad2f7,null));};exports['destroy']=function(_0x469e98,_0x858fa7){return db['ChatInteraction'][_0x03f2('0x7c')]({'where':{'id':_0x469e98[_0x03f2('0xbe')]['id']}})[_0x03f2('0x23')](handleEntityNotFound(_0x858fa7,null))[_0x03f2('0x23')](removeEntity(_0x858fa7,null))[_0x03f2('0x2b')](handleError(_0x858fa7,null));};exports[_0x03f2('0xc3')]=function(_0x12738b,_0x26a57c){return db[_0x03f2('0x42')][_0x03f2('0xc3')]()[_0x03f2('0x23')](respondWithResult(_0x26a57c,null))['catch'](handleError(_0x26a57c,null));};exports['createVidaooSession']=function(_0x3bc289,_0x5f33d3){var _0x5a5ec9=_0x3bc289['params']['id'];var _0x5dbaa3;var _0x2dfe5c;var _0x5d3155;return db[_0x03f2('0x42')][_0x03f2('0xc4')]({'where':{'id':_0x5a5ec9}})[_0x03f2('0x23')](function(_0x1e6526){_0x5dbaa3=_0x1e6526;return db[_0x03f2('0xc5')][_0x03f2('0xc4')]({'where':{'id':_0x1e6526[_0x03f2('0x81')]},'attributes':['id',_0x03f2('0xc6'),_0x03f2('0xc7')],'raw':!![]});})['then'](function(_0x255f0a){if(_0x255f0a&&_0x255f0a[_0x03f2('0xc6')]&&_0x255f0a[_0x03f2('0xc7')]){_0x2dfe5c=_0x255f0a;var _0x53de5e={'rejectUnauthorized':![],'method':'POST','uri':_0x03f2('0xc8'),'headers':{'X-APIKEY':_0x255f0a[_0x03f2('0xc6')]},'body':{'name':_0x03f2('0xc9')+_0x5a5ec9},'redirect':_0x03f2('0xca'),'json':!![]};return rp(_0x53de5e);}else{throw new db['Sequelize'][(_0x03f2('0xcb'))](_0x03f2('0xcc'));}})['then'](function(_0x586767){_0x5d3155=_0x586767;if(_0x5d3155['id']){var _0x48953e={'body':_0x5d3155[_0x03f2('0xcd')],'ChatWebsiteId':_0x2dfe5c['id'],'ChatInteractionId':_0x5dbaa3['id'],'direction':_0x03f2('0xce'),'UserId':_0x3bc289[_0x03f2('0x9e')]['id']};return db['ChatMessage'][_0x03f2('0xc2')](_0x48953e,{});}else{throw new db['Sequelize'][(_0x03f2('0xcb'))](_0x03f2('0xcf'));}})[_0x03f2('0x23')](function(){return _0x5dbaa3[_0x03f2('0xd0')]({'vidaooSessionId':_0x5d3155['id']});})[_0x03f2('0x23')](respondWithResult(_0x5f33d3,null))['catch'](handleError(_0x5f33d3,null));};exports[_0x03f2('0xd1')]=function(_0x9fd540,_0x1eb920){if(_0x9fd540[_0x03f2('0x7e')]['id']){delete _0x9fd540[_0x03f2('0x7e')]['id'];}return db[_0x03f2('0x42')]['find']({'where':{'id':_0x9fd540[_0x03f2('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1eb920,null))[_0x03f2('0x23')](saveUpdates(_0x9fd540[_0x03f2('0x7e')],null))[_0x03f2('0x23')](respondWithResult(_0x1eb920,null))[_0x03f2('0x2b')](handleError(_0x1eb920,null));};exports[_0x03f2('0xd2')]=function(_0x3f17b6,_0x214e0a,_0x3d3b1c){if(_0x3f17b6[_0x03f2('0x7e')]['id']){delete _0x3f17b6[_0x03f2('0x7e')]['id'];}return db[_0x03f2('0x42')][_0x03f2('0x7c')]({'where':{'id':_0x3f17b6[_0x03f2('0xbe')]['id']}})['then'](function(_0x5aa1ad){if(!_0x5aa1ad){logger[_0x03f2('0x27')](_0x03f2('0xd3'),_0x03f2('0xd2'),0x194,_0x03f2('0xd4'));_0x214e0a[_0x03f2('0x2c')](0x194);}else{if(_0x5aa1ad[_0x03f2('0xd5')]){throw new db['Sequelize']['ValidationError'](_0x03f2('0xd6'));}}return _0x5aa1ad;})[_0x03f2('0x23')](function(_0x242d94){if(_0x242d94){return _0x242d94[_0x03f2('0xd7')]({'closed':_0x3f17b6['body'][_0x03f2('0xd8')],'disposition':_0x3f17b6[_0x03f2('0x7e')][_0x03f2('0xd9')]})[_0x03f2('0x23')](function(_0xe6d64f){return _0xe6d64f;});}})[_0x03f2('0x23')](function(_0x2b47a9){return respondWithRpcPromise(_0x03f2('0xda'),'abandon',_0x3f17b6['body'],client9004);})['then'](respondWithResult(_0x214e0a,null))[_0x03f2('0x2b')](handleError(_0x214e0a,null));};exports[_0x03f2('0xdb')]=function(_0x187437,_0x295152,_0x642f15){_0x187437[_0x03f2('0x7e')]['name']=_0x187437[_0x03f2('0xdc')][_0x03f2('0xdd')];_0x187437[_0x03f2('0x7e')]['basename']=_0x187437[_0x03f2('0xdc')]['filename'];_0x187437['body'][_0x03f2('0x44')]=_0x187437[_0x03f2('0xdc')][_0x03f2('0xde')];return db['Attachment'][_0x03f2('0xc2')](_0x187437['body'])[_0x03f2('0x23')](respondWithResult(_0x295152,0xc9))[_0x03f2('0x2b')](handleError(_0x295152,null));};exports['attachmentDownload']=function(_0xd0581d,_0x37eb31,_0x41c09f){return db['ChatInteraction']['findOne']({'where':{'id':_0xd0581d[_0x03f2('0xbe')]['id']},'raw':!![]})[_0x03f2('0x23')](handleEntityNotFound(_0x37eb31,null))['then'](function(_0x168388){if(_0x168388){if(_0x168388[_0x03f2('0xd8')]){return _0x37eb31[_0x03f2('0x2d')](0x193)[_0x03f2('0x2f')]({'status':0x193,'message':_0x03f2('0xdf')});}return db[_0x03f2('0xe0')][_0x03f2('0xc4')]({'where':{'id':_0xd0581d[_0x03f2('0x48')][_0x03f2('0xe1')]},'raw':!![]})[_0x03f2('0x23')](handleEntityNotFound(_0x37eb31,null));}})['then'](function(_0x2962c9){if(_0x2962c9){return _0x37eb31['download'](path[_0x03f2('0xe2')](config['root'],_0x03f2('0xe3'),_0x2962c9[_0x03f2('0xe4')]));}})['catch'](handleError(_0x37eb31,null));};exports[_0x03f2('0xe5')]=function(_0x52d06f,_0x5f34d7){var _0x52335e=null;var _0x218182=null;var _0x34ed3a=null;var _0x272425=null;if(_0x52d06f[_0x03f2('0x7e')]['id']){delete _0x52d06f['body']['id'];}if(_0x52d06f[_0x03f2('0x7e')]['mailTranscript']){_0x272425=path['join'](config[_0x03f2('0xe6')],_0x03f2('0xe7'),util[_0x03f2('0xe8')](_0x03f2('0xe9'),Date['now']()));_0x52d06f[_0x03f2('0x7e')]['pathTranscript']=_0x272425;}return db['ChatInteraction'][_0x03f2('0x7c')]({'where':{'id':_0x52d06f[_0x03f2('0xbe')]['id']},'include':[{'model':db[_0x03f2('0xea')],'as':_0x03f2('0xeb'),'include':[{'model':db[_0x03f2('0x79')],'as':_0x03f2('0x79')}]}]})[_0x03f2('0x23')](handleEntityNotFound(_0x5f34d7,null))[_0x03f2('0x23')](saveUpdates(_0x52d06f[_0x03f2('0x7e')],null))[_0x03f2('0x23')](function(_0x2a566e){if(_0x2a566e){_0x52335e=_0x2a566e;return db[_0x03f2('0xc5')]['find']({'where':{'id':_0x52335e['ChatWebsiteId']}});}})[_0x03f2('0x23')](function(_0x477f92){if(_0x477f92){_0x34ed3a=_0x477f92;return db[_0x03f2('0xec')][_0x03f2('0x7c')]({'where':{'id':_0x52335e['ContactId']}});}})[_0x03f2('0x23')](function(_0x2296f3){if(_0x2296f3){_0x218182=_0x2296f3;if(_0x272425){var _0x5d7ba3=null;for(var _0xfa96e6=0x1;_0xfa96e6<_0x52335e['Messages'][_0x03f2('0x4d')];++_0xfa96e6){_0x5d7ba3=_0x52335e[_0x03f2('0xeb')][_0xfa96e6];var _0x351334=_0x5d7ba3[_0x03f2('0xd5')]?util[_0x03f2('0xe8')](_0x03f2('0xed'),_0x34ed3a[_0x03f2('0xee')],_0x5d7ba3[_0x03f2('0xd5')]):_0x03f2('0xef');var _0x461ac1=_0x52d06f[_0x03f2('0x7e')][_0x03f2('0xf0')]||util['format'](_0x03f2('0xed'),'Visitor',_0x5d7ba3[_0x03f2('0x72')]);switch(_0x34ed3a[_0x03f2('0xf1')]){case _0x03f2('0xf2'):_0x351334=_0x5d7ba3[_0x03f2('0xd5')]?util[_0x03f2('0xe8')](_0x03f2('0xed'),_0x34ed3a[_0x03f2('0xee')],_0x5d7ba3[_0x03f2('0xd5')]):_0x03f2('0xef');break;case _0x03f2('0xf3'):_0x351334=_0x5d7ba3[_0x03f2('0xd5')]?_0x5d7ba3[_0x03f2('0x79')][_0x03f2('0xf4')]||_0x5d7ba3[_0x03f2('0x79')][_0x03f2('0x3d')]:_0x03f2('0xef');break;case _0x03f2('0xf5'):_0x351334=_0x5d7ba3['UserId']?_0x5d7ba3[_0x03f2('0x79')][_0x03f2('0x3d')]:_0x03f2('0xef');break;default:_0x351334=_0x5d7ba3[_0x03f2('0xd5')]?util[_0x03f2('0xe8')](_0x03f2('0xed'),_0x34ed3a['agentAlias'],_0x5d7ba3[_0x03f2('0xd5')]):'System';}var _0x2f9477=util[_0x03f2('0xe8')](_0x03f2('0xf6'),moment(_0x5d7ba3[_0x03f2('0x84')])[_0x03f2('0xe8')](_0x03f2('0xf7')),_0x5d7ba3[_0x03f2('0xf8')]==='in'?_0x461ac1:_0x351334,_0x5d7ba3[_0x03f2('0x7e')]);if(!_0x5d7ba3[_0x03f2('0xf9')]){fs[_0x03f2('0xfa')](_0x272425,_0x2f9477);}}return db['MailAccount'][_0x03f2('0xc4')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}}})[_0x03f2('0x23')](function(_0x8fe8d8){if(_0x8fe8d8&&_0x8fe8d8[_0x03f2('0xfb')]&&_0x52d06f['body']){var _0x34d2fa={'tls':{'rejectUnauthorized':![]}};if(_0x8fe8d8[_0x03f2('0xfb')]['service']){_0x34d2fa['service']=_0x8fe8d8[_0x03f2('0xfb')][_0x03f2('0xfc')];}else{_0x34d2fa['host']=_0x8fe8d8[_0x03f2('0xfb')][_0x03f2('0xfd')];_0x34d2fa[_0x03f2('0xfe')]=_0x8fe8d8[_0x03f2('0xfb')][_0x03f2('0xfe')];_0x34d2fa['secure']=_0x8fe8d8[_0x03f2('0xfb')][_0x03f2('0xff')];}if(_0x8fe8d8[_0x03f2('0xfb')][_0x03f2('0x100')]){_0x34d2fa[_0x03f2('0x101')]={'user':_0x8fe8d8[_0x03f2('0xfb')][_0x03f2('0x9e')],'pass':_0x8fe8d8[_0x03f2('0xfb')]['pass']};}return respondWithRpcPromise(_0x03f2('0x102'),_0x03f2('0x103'),{'account':_0x34d2fa,'message':{'from':util[_0x03f2('0xe8')]('\x22%s\x22\x20<%s>',_0x8fe8d8[_0x03f2('0x39')],_0x8fe8d8['email']||_0x8fe8d8['Smtp'][_0x03f2('0x9e')]),'to':_0x52d06f[_0x03f2('0x7e')][_0x03f2('0x104')],'subject':_0x03f2('0x105'),'text':util[_0x03f2('0xe8')](_0x03f2('0x106'),_0x52d06f[_0x03f2('0x7e')][_0x03f2('0x104')]),'attachments':[{'path':_0x272425}]}})['then'](function(){return _0x52335e;})[_0x03f2('0x2b')](function(_0x540a45){console[_0x03f2('0x27')](_0x540a45);});}else{return _0x52335e;}})[_0x03f2('0x23')](respondWithStatusCode(_0x5f34d7,0xc8))['catch'](handleError(_0x5f34d7,null));};exports[_0x03f2('0x107')]=function(_0x2dcb48,_0x5bceaa,_0xfa9b79){return db[_0x03f2('0xea')][_0x03f2('0x7c')]({'where':{'id':_0x2dcb48[_0x03f2('0xbe')]['id']}})['then'](handleEntityNotFound(_0x5bceaa,null))['then'](function(_0x1acefe){if(_0x1acefe){return _0x1acefe[_0x03f2('0x107')](_0x2dcb48[_0x03f2('0x7e')][_0x03f2('0x108')],_[_0x03f2('0x109')](_0x2dcb48[_0x03f2('0x7e')],[_0x03f2('0x108'),'id'])||{});}})['then'](respondWithResult(_0x5bceaa,null))[_0x03f2('0x2b')](handleError(_0x5bceaa,null));};exports[_0x03f2('0x10a')]=function(_0x7d7b7c,_0x4050ba,_0x3bc03b){var _0x645c39={'raw':![],'where':{}};var _0x991ea2={};var _0x1bb490={'count':0x0,'rows':[]};return db[_0x03f2('0x42')][_0x03f2('0xc4')]({'where':{'id':_0x7d7b7c[_0x03f2('0xbe')]['id']}})[_0x03f2('0x23')](handleEntityNotFound(_0x4050ba,null))[_0x03f2('0x23')](function(_0x43da46){if(_0x43da46){_0x991ea2[_0x03f2('0x46')]=_[_0x03f2('0x47')](db[_0x03f2('0xea')][_0x03f2('0xbf')]);_0x991ea2['query']=_['keys'](_0x7d7b7c[_0x03f2('0x48')]);_0x991ea2[_0x03f2('0x49')]=_[_0x03f2('0x4a')](_0x991ea2[_0x03f2('0x46')],_0x991ea2[_0x03f2('0x48')]);_0x645c39[_0x03f2('0x4b')]=_['intersection'](_0x991ea2[_0x03f2('0x46')],qs[_0x03f2('0x4c')](_0x7d7b7c['query'][_0x03f2('0x4c')]));_0x645c39[_0x03f2('0x4b')]=_0x645c39['attributes'][_0x03f2('0x4d')]?_0x645c39[_0x03f2('0x4b')]:_0x991ea2['model'];if(!_0x7d7b7c['query'][_0x03f2('0x4e')](_0x03f2('0x4f'))){_0x645c39['limit']=qs['limit'](_0x7d7b7c[_0x03f2('0x48')]['limit']);_0x645c39[_0x03f2('0x31')]=qs[_0x03f2('0x31')](_0x7d7b7c['query'][_0x03f2('0x31')]);}_0x645c39[_0x03f2('0x51')]=qs['sort'](_0x7d7b7c[_0x03f2('0x48')][_0x03f2('0x52')]);_0x645c39[_0x03f2('0x53')]=qs['filters'](_[_0x03f2('0x10b')](_0x7d7b7c[_0x03f2('0x48')],_0x991ea2[_0x03f2('0x49')]));_0x645c39['where'][_0x03f2('0x10c')]=_0x43da46['id'];if(_0x7d7b7c[_0x03f2('0x48')][_0x03f2('0x10d')]){_0x645c39[_0x03f2('0x53')]=_[_0x03f2('0xa5')](_0x645c39[_0x03f2('0x53')],{'$or':_[_0x03f2('0x3c')](_0x645c39[_0x03f2('0x4b')],function(_0x3d87a6){var _0x512bea={};_0x512bea[_0x3d87a6]={'$like':'%'+_0x7d7b7c[_0x03f2('0x48')][_0x03f2('0x10d')]+'%'};return _0x512bea;})});}if(_0x7d7b7c[_0x03f2('0x48')][_0x03f2('0x10e')]){var _0x1cb43b=_0x7d7b7c[_0x03f2('0x48')]['$gte'][_0x03f2('0x40')](',');var _0x313d2b={};_0x313d2b[_0x1cb43b[0x0]]={'$gte':moment(_0x1cb43b[0x1])[_0x03f2('0xe8')]('YYYY-MM-DD\x20HH:mm:ss')};_0x645c39[_0x03f2('0x53')]=_['merge'](_0x645c39['where'],_0x313d2b);}_0x645c39=_['merge']({},_0x645c39,_0x7d7b7c[_0x03f2('0xc1')]);return db[_0x03f2('0xea')][_0x03f2('0x30')]({'where':_0x645c39['where']})[_0x03f2('0x23')](function(_0x597ea0){_0x1bb490[_0x03f2('0x30')]=_0x597ea0;if(_0x7d7b7c[_0x03f2('0x48')][_0x03f2('0xc0')]){_0x645c39[_0x03f2('0x10f')]=[{'all':!![]}];}return db['ChatMessage'][_0x03f2('0x110')](_0x645c39);})['then'](function(_0x1f4cc2){_0x1bb490[_0x03f2('0x111')]=_0x1f4cc2;return _0x1bb490;});}})[_0x03f2('0x23')](respondWithFilteredResult(_0x4050ba,_0x645c39))['catch'](handleError(_0x4050ba,null));};exports[_0x03f2('0x112')]=function(_0x5ac6c2,_0x3c65b4,_0x3a4988){var _0x26b295={'where':{}},_0x2d2dcf={},_0x18d027={'count':0x0,'rows':[]};return db[_0x03f2('0x42')][_0x03f2('0xc4')]({'where':{'id':_0x5ac6c2['params']['id']}})[_0x03f2('0x23')](handleEntityNotFound(_0x3c65b4,null))[_0x03f2('0x23')](function(_0x226e9a){if(_0x226e9a){_0x2d2dcf[_0x03f2('0x46')]=_['keys'](db['ChatMessage'][_0x03f2('0xbf')]);_0x2d2dcf[_0x03f2('0x48')]=_[_0x03f2('0x47')](_0x5ac6c2[_0x03f2('0x48')]);_0x2d2dcf[_0x03f2('0x49')]=_[_0x03f2('0x4a')](_0x2d2dcf[_0x03f2('0x46')],_0x2d2dcf[_0x03f2('0x48')]);_0x26b295['attributes']=_[_0x03f2('0x4a')](_0x2d2dcf['model'],qs['fields'](_0x5ac6c2[_0x03f2('0x48')]['fields']));_0x26b295[_0x03f2('0x4b')]=_0x26b295[_0x03f2('0x4b')][_0x03f2('0x4d')]?_0x26b295[_0x03f2('0x4b')]:_0x2d2dcf['model'];if(!_0x5ac6c2[_0x03f2('0x48')][_0x03f2('0x4e')](_0x03f2('0x4f'))){_0x26b295[_0x03f2('0x50')]=qs[_0x03f2('0x50')](_0x5ac6c2[_0x03f2('0x48')][_0x03f2('0x50')]);_0x26b295[_0x03f2('0x31')]=qs['offset'](_0x5ac6c2['query']['offset']);}_0x26b295[_0x03f2('0x51')]=qs[_0x03f2('0x52')](_0x5ac6c2[_0x03f2('0x48')]['sort']);_0x26b295[_0x03f2('0x53')]=qs['filters'](_[_0x03f2('0x10b')](_0x5ac6c2[_0x03f2('0x48')],_0x2d2dcf[_0x03f2('0x49')]));_0x26b295['where'][_0x03f2('0x10c')]=_0x226e9a['id'];if(_0x5ac6c2[_0x03f2('0x48')][_0x03f2('0x10d')]){_0x26b295[_0x03f2('0x53')]=_[_0x03f2('0xa5')](_0x26b295[_0x03f2('0x53')],{'$or':_[_0x03f2('0x3c')](_0x26b295['attributes'],function(_0x279971){var _0x3c1c81={};_0x3c1c81[_0x279971]={'$like':'%'+_0x5ac6c2[_0x03f2('0x48')][_0x03f2('0x10d')]+'%'};return _0x3c1c81;})});}_0x26b295[_0x03f2('0x53')][_0x03f2('0xf9')]=![];if(_0x5ac6c2['query']['id']){_0x26b295[_0x03f2('0x53')]['id']={'$gt':_0x5ac6c2['query']['id']};}_0x26b295=_['merge']({},_0x26b295,_0x5ac6c2['options']);return db['ChatMessage'][_0x03f2('0x30')]({'where':_0x26b295[_0x03f2('0x53')]})[_0x03f2('0x23')](function(_0x578026){_0x18d027['count']=_0x578026;_0x26b295[_0x03f2('0x10f')]=[];if(_0x5ac6c2[_0x03f2('0x48')][_0x03f2('0x113')]){_0x26b295[_0x03f2('0x10f')]['push']({'model':db[_0x03f2('0x79')],'as':_0x03f2('0x79'),'attributes':['id','fullname',_0x03f2('0xf4')]});}if(_0x5ac6c2['query'][_0x03f2('0xc0')]){_0x26b295[_0x03f2('0x10f')]=[{'all':!![]}];}return db[_0x03f2('0xea')]['findAll'](_0x26b295);})[_0x03f2('0x23')](function(_0x191a84){_0x18d027[_0x03f2('0x111')]=_0x191a84;return _0x18d027;});}})['then'](respondWithFilteredResult(_0x3c65b4,_0x26b295))['catch'](handleError(_0x3c65b4,null));};exports[_0x03f2('0x114')]=function(_0x4f6212,_0x20cd65,_0x47b4d8){return db['ChatInteraction'][_0x03f2('0x7c')]({'where':{'id':_0x4f6212[_0x03f2('0xbe')]['id']}})[_0x03f2('0x23')](handleEntityNotFound(_0x20cd65,null))[_0x03f2('0x23')](function(_0x29096d){if(_0x29096d){return _0x29096d['setTags'](_0x4f6212[_0x03f2('0x7e')][_0x03f2('0x108')],_['omit'](_0x4f6212['body'],[_0x03f2('0x108'),'id'])||{})[_0x03f2('0x115')](function(){return db[_0x03f2('0x75')]['findAll']({'attributes':['id',_0x03f2('0x39'),'color'],'where':{'id':_0x4f6212[_0x03f2('0x7e')][_0x03f2('0x108')]}});})[_0x03f2('0x23')](function(_0x166164){socket[_0x03f2('0x116')](_0x03f2('0x117'),{'id':Number(_0x4f6212[_0x03f2('0xbe')]['id']),'tags':_0x166164||[]});return{'id':Number(_0x4f6212[_0x03f2('0xbe')]['id']),'tags':_0x166164||[]};});}})[_0x03f2('0x23')](respondWithResult(_0x20cd65,null))[_0x03f2('0x2b')](handleError(_0x20cd65,null));};exports[_0x03f2('0x118')]=function(_0x3f30ad,_0x539723,_0x5b1388){return db[_0x03f2('0x42')]['find']({'where':{'id':_0x3f30ad[_0x03f2('0xbe')]['id']}})['then'](handleEntityNotFound(_0x539723,null))[_0x03f2('0x23')](function(_0x4958d4){if(_0x4958d4){return _0x4958d4['removeTags'](_0x3f30ad[_0x03f2('0x48')][_0x03f2('0x108')]);}})[_0x03f2('0x23')](respondWithStatusCode(_0x539723,null))[_0x03f2('0x2b')](handleError(_0x539723,null));};exports['download']=function(_0x53a1e7,_0x9385){var _0x258574=moment()['unix']()[_0x03f2('0xa3')]();var _0x420cd0=path[_0x03f2('0xe2')](config[_0x03f2('0xe6')],_0x03f2('0x119'),_0x03f2('0x11a'),'tmp');var _0x318186=path['join'](config['root'],'server',_0x03f2('0x11a'),_0x03f2('0x11b'));var _0x566bc5=path['join'](_0x420cd0,_0x258574);var _0x3a41b8=util[_0x03f2('0xe8')](_0x03f2('0x11c'),_0x53a1e7[_0x03f2('0xbe')]['id'],_0x258574);var _0x5895f8=path[_0x03f2('0xe2')](_0x420cd0,_0x3a41b8);var _0x16ad6a=[];_0x16ad6a[_0x03f2('0x11d')]({'model':db['User'],'as':_0x03f2('0x79'),'attributes':['id',_0x03f2('0x3d')],'raw':!![]});_0x16ad6a['push']({'model':db[_0x03f2('0xec')],'as':_0x03f2('0x6c'),'attributes':['id',_0x03f2('0x11e'),_0x03f2('0x11f')],'raw':!![]});if(_0x53a1e7[_0x03f2('0x48')][_0x03f2('0x11b')]){_0x16ad6a[_0x03f2('0x11d')]({'model':db['Attachment'],'as':_0x03f2('0xe0'),'raw':!![]});}var _0x722155=[{'model':db['ChatMessage'],'as':_0x03f2('0xeb'),'attributes':['id',_0x03f2('0x7e'),'createdAt',_0x03f2('0xf8'),_0x03f2('0xf9'),_0x03f2('0x8b')],'include':_0x16ad6a}];_0x722155[_0x03f2('0x11d')]({'model':db['ChatWebsite'],'as':_0x03f2('0x120'),'attributes':['id','name']});_0x722155[_0x03f2('0x11d')]({'model':db[_0x03f2('0x79')],'as':_0x03f2('0x121'),'attributes':['id','fullname']});return db[_0x03f2('0x42')][_0x03f2('0x7c')]({'where':{'id':_0x53a1e7[_0x03f2('0xbe')]['id']},'include':_0x722155})[_0x03f2('0x23')](handleEntityNotFound(_0x9385,null))[_0x03f2('0x23')](function(_0x509f9b){if(_0x509f9b){var _0xff6f32=_0x509f9b['get']({'plain':!![]});fs[_0x03f2('0x122')](_0x566bc5);var _0x3e9611={'format':'A4','border':_0x03f2('0x123'),'header':{'height':_0x03f2('0x124'),'contents':{'first':_0x03f2('0x125')}},'footer':{'height':'30px','contents':{'default':util[_0x03f2('0xe8')](_0x03f2('0x126'),util[_0x03f2('0xe8')](_0x03f2('0x127'),_0x03f2('0x128'),_0xff6f32['id']),moment()[_0x03f2('0xe8')](_0x03f2('0x129'))[_0x03f2('0xa3')]())}}};var _0x2c5f41={'channel':_0x03f2('0x128'),'account':_0xff6f32['Account'][_0x03f2('0x39')],'agent':_0xff6f32['Owner']?_0xff6f32['Owner'][_0x03f2('0x3d')]:_0x03f2('0x12a'),'createdAt':moment(_0xff6f32['createdAt'])[_0x03f2('0xe8')]('YYYY-MM-DD\x20HH:mm:ss')[_0x03f2('0xa3')](),'closedAt':_0xff6f32[_0x03f2('0xd8')]?moment(_0xff6f32['closedAt'])[_0x03f2('0xe8')](_0x03f2('0x12b'))[_0x03f2('0xa3')]():'','disposition':_0xff6f32[_0x03f2('0xd9')],'chatInfo':{'browser':_0xff6f32[_0x03f2('0x12c')],'os':_0xff6f32[_0x03f2('0x12d')],'referer':_0xff6f32[_0x03f2('0x12e')],'customerIp':_0xff6f32[_0x03f2('0x12f')],'customerPort':_0xff6f32['customerPort']?_0xff6f32[_0x03f2('0x130')]:_0x03f2('0x12a')},'messages':_(_0xff6f32[_0x03f2('0xeb')])[_0x03f2('0x131')]()[_0x03f2('0x10d')]({'secret':![]})['map'](function(_0x537eac){if(_0x537eac[_0x03f2('0xe0')]){var _0x54d644=path['join'](_0x318186,_0x537eac[_0x03f2('0xe0')][_0x03f2('0xe4')]);if(fs[_0x03f2('0x132')](_0x54d644)){fs[_0x03f2('0x133')](_0x54d644)['pipe'](fs[_0x03f2('0x134')](path['join'](_0x566bc5,_0x537eac['Attachment']['basename'])));}}return{'date':moment(_0x537eac['createdAt'])['format'](_0x03f2('0x12b'))['toString'](),'sender':_0x537eac[_0x03f2('0xf8')]===_0x03f2('0xce')?_0x537eac[_0x03f2('0x79')]?_0x537eac[_0x03f2('0x79')][_0x03f2('0x3d')]:'System':_0x537eac[_0x03f2('0x6c')]['firstName']+(_0x537eac['Contact']['lastName']?'\x20'+_0x537eac[_0x03f2('0x6c')]['lastName']:''),'body':_0x537eac['Attachment']?_0x537eac[_0x03f2('0xe0')][_0x03f2('0xe4')]:_0x537eac[_0x03f2('0x7e')],'direction':_0x537eac[_0x03f2('0xf8')]===_0x03f2('0xce')?'A':'C','secret':_0x537eac[_0x03f2('0xf9')],'read':_0x537eac[_0x03f2('0x8b')],'attachment':_0x537eac[_0x03f2('0xe0')]};})[_0x03f2('0x6e')]()};return ejs[_0x03f2('0x135')](path[_0x03f2('0xe2')](config['root'],_0x03f2('0x119'),_0x03f2('0x136'),_0x03f2('0x137')),{'interaction':_0x2c5f41})['then'](function(_0x462b40){return new BPromise(function(_0x2a6b7a,_0x286816){pdf['create'](_0x462b40,_0x3e9611)['toFile'](path[_0x03f2('0xe2')](_0x566bc5,_0x03f2('0x138')+_0xff6f32['id']+'-'+_0x258574+'.pdf'),function(_0x2fcdcb,_0xe2194d){if(_0x2fcdcb)return _0x286816(_0x2fcdcb);_0x2a6b7a(_0xe2194d);});});})[_0x03f2('0x23')](function(){return new BPromise(function(_0x3ed189,_0xce3fc2){zipdir(_0x566bc5,{'saveTo':_0x5895f8},function(_0x178c42,_0x5f2bb6){if(_0x178c42)return _0xce3fc2(_0x178c42);return _0x3ed189(_0x5f2bb6);});})[_0x03f2('0x23')](function(){return new BPromise(function(_0x2f4834,_0x43019f){rimraf(_0x566bc5,function(_0x8e82fe){if(_0x8e82fe)_0x43019f(_0x8e82fe);return _0x2f4834();});});})[_0x03f2('0x23')](function(){return _0x9385['download'](_0x5895f8,_0x3a41b8,function(_0x56c81c){if(_0x56c81c){console[_0x03f2('0x139')](_0x03f2('0x13a'),_0x56c81c);}else{fs['unlinkSync'](_0x5895f8);}});});});}else{return _0x9385['sendStatus'](0xc8);}})[_0x03f2('0x2b')](handleError(_0x9385,null));}; \ No newline at end of file +var _0xdacb=['renderFile','transcript-','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','sendStatus','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','index','ChatInteraction','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','left_join','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','length','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','where','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','user','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','ChatWebsiteId','sequelize','toString','merge','Account.key','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.internal','Owner.internal','groupBy','ChatInteractionId','push','all','rows','show','params','includeAll','options','create','update','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','follow','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','closed','disposition','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','download','join','mailTranscript','format','transcript-%s.txt','now','Messages','User','customer','%s%d','agentIdentifier','website_alias','agentAlias','System','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','pick','include','findAll','getMyMessages','includeAgent','addTags','setTags','spread','emit','chatInteractionTags:save','unix','root','files','tmp','server','attachments','firstName','Account','get','10px','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','YYYY-MM-DD','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','lastName'];(function(_0x3bf043,_0x439342){var _0x35a484=function(_0x3ad0ab){while(--_0x3ad0ab){_0x3bf043['push'](_0x3bf043['shift']());}};_0x35a484(++_0x439342);}(_0xdacb,0x137));var _0xbdac=function(_0x34b946,_0xa61ab2){_0x34b946=_0x34b946-0x0;var _0x1d7632=_0xdacb[_0x34b946];return _0x1d7632;};'use strict';var pdf=require(_0xbdac('0x0'));var emlformat=require(_0xbdac('0x1'));var rimraf=require(_0xbdac('0x2'));var zipdir=require(_0xbdac('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbdac('0x4'));var moment=require(_0xbdac('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbdac('0x6'));var util=require('util');var path=require(_0xbdac('0x7'));var sox=require('sox');var csv=require(_0xbdac('0x8'));var ejs=require(_0xbdac('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbdac('0xa'));var toCsv=require(_0xbdac('0x8'));var querystring=require(_0xbdac('0xb'));var Papa=require(_0xbdac('0xc'));var Redis=require(_0xbdac('0xd'));var authService=require(_0xbdac('0xe'));var qs=require(_0xbdac('0xf'));var as=require(_0xbdac('0x10'));var hardwareService=require(_0xbdac('0x11'));var logger=require('../../config/logger')(_0xbdac('0x12'));var utils=require(_0xbdac('0x13'));var config=require(_0xbdac('0x14'));var licenseUtil=require(_0xbdac('0x15'));var db=require(_0xbdac('0x16'))['db'];config[_0xbdac('0x17')]=_[_0xbdac('0x18')](config[_0xbdac('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xbdac('0x19'))(new Redis(config['redis']));require(_0xbdac('0x1a'))[_0xbdac('0x1b')](socket);var jayson=require(_0xbdac('0x1c'));var client=jayson[_0xbdac('0x1d')][_0xbdac('0x1e')]({'port':0x232b});var client9004=jayson['client'][_0xbdac('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x58a7d7,_0x3ecd1d,_0x2a6645,_0x5360cb){return new BPromise(function(_0x1d552a,_0x209183){var _0xc9ae16=_0x5360cb||client;return _0xc9ae16[_0xbdac('0x1f')](_0x58a7d7,_0x2a6645)[_0xbdac('0x20')](function(_0x377248){logger['info'](_0xbdac('0x21'),_0x3ecd1d,_0xbdac('0x22'));logger[_0xbdac('0x23')](_0xbdac('0x24'),_0x3ecd1d,_0xbdac('0x22'),JSON[_0xbdac('0x25')](_0x377248));if(_0x377248[_0xbdac('0x26')]){if(_0x377248[_0xbdac('0x26')][_0xbdac('0x27')]===0x1f4){logger['error'](_0xbdac('0x21'),_0x3ecd1d,_0x377248[_0xbdac('0x26')][_0xbdac('0x28')]);return _0x209183(_0x377248[_0xbdac('0x26')]['message']);}logger[_0xbdac('0x26')](_0xbdac('0x21'),_0x3ecd1d,_0x377248['error'][_0xbdac('0x28')]);return _0x1d552a(_0x377248[_0xbdac('0x26')]['message']);}else{logger[_0xbdac('0x29')]('ChatInteraction,\x20%s,\x20%s',_0x3ecd1d,_0xbdac('0x22'));_0x1d552a(_0x377248[_0xbdac('0x2a')]['message']);}})[_0xbdac('0x2b')](function(_0x3984ef){logger[_0xbdac('0x26')](_0xbdac('0x21'),_0x3ecd1d,_0x3984ef);_0x209183(_0x3984ef);});});}function respondWithStatusCode(_0x478e3c,_0x14642d){_0x14642d=_0x14642d||0xcc;return function(_0x3d4bb6){if(_0x3d4bb6){return _0x478e3c['sendStatus'](_0x14642d);}return _0x478e3c[_0xbdac('0x2c')](_0x14642d)[_0xbdac('0x2d')]();};}function respondWithResult(_0x57506e,_0x529fc2){_0x529fc2=_0x529fc2||0xc8;return function(_0x30f8b2){if(_0x30f8b2){return _0x57506e[_0xbdac('0x2c')](_0x529fc2)[_0xbdac('0x2e')](_0x30f8b2);}};}function respondWithFilteredResult(_0x58bf11,_0x63e7f4){return function(_0x29c10e){if(_0x29c10e){var _0x1f85d4=_0x29c10e[_0xbdac('0x2f')],_0x5b8741=_0x63e7f4[_0xbdac('0x30')],_0x54d8d6=_0x63e7f4['offset']+_0x63e7f4[_0xbdac('0x31')],_0x373701;if(_0x54d8d6>=_0x1f85d4){_0x54d8d6=_0x1f85d4;_0x373701=0xc8;}else{_0x373701=0xce;}_0x58bf11[_0xbdac('0x2c')](_0x373701);return _0x58bf11[_0xbdac('0x32')](_0xbdac('0x33'),_0x5b8741+'-'+_0x54d8d6+'/'+_0x1f85d4)[_0xbdac('0x2e')](_0x29c10e);}return null;};}function patchUpdates(_0x44848c){return function(_0x1835fd){try{jsonpatch[_0xbdac('0x34')](_0x1835fd,_0x44848c,!![]);}catch(_0x2f935b){return BPromise[_0xbdac('0x35')](_0x2f935b);}return _0x1835fd['save']();};}function saveUpdates(_0x361713,_0x12aa66){return function(_0x34a6a8){if(_0x34a6a8){return _0x34a6a8['update'](_0x361713)[_0xbdac('0x20')](function(_0x47231d){return _0x47231d;});}return null;};}function removeEntity(_0x5946a0,_0x3208dd){return function(_0x439b6a){if(_0x439b6a){return _0x439b6a[_0xbdac('0x36')]()[_0xbdac('0x20')](function(){_0x5946a0['status'](0xcc)[_0xbdac('0x2d')]();});}};}function handleEntityNotFound(_0xff83bc,_0x369aa8){return function(_0x5c71e6){if(!_0x5c71e6){_0xff83bc[_0xbdac('0x37')](0x194);}return _0x5c71e6;};}function handleError(_0x5f2a78,_0x505ed5){_0x505ed5=_0x505ed5||0x1f4;return function(_0x1e7554){logger[_0xbdac('0x26')](_0x1e7554[_0xbdac('0x38')]);if(_0x1e7554[_0xbdac('0x39')]){delete _0x1e7554['name'];}_0x5f2a78[_0xbdac('0x2c')](_0x505ed5)[_0xbdac('0x3a')](_0x1e7554);};}function getInteractionUsers(_0x4b075b,_0x143ade){return new BPromise(function(_0x291b25,_0x28bb59){try{if(_0x143ade[_0x4b075b['id']]){_0x4b075b[_0xbdac('0x3b')]=_[_0xbdac('0x3c')](_0x143ade[_0x4b075b['id']],function(_0x792821){return{'id':_0x792821['id'],'fullname':_0x792821[_0xbdac('0x3d')]};});}}catch(_0x4b0692){_0x28bb59(_0x4b0692);}_0x291b25(_0x4b075b);});}function getInteractionTags(_0x526975,_0x378394){return new BPromise(function(_0x3f4193,_0x4b2230){try{if(_0x526975['TagIds']){_0x526975[_0xbdac('0x3e')]=[];_0x526975[_0xbdac('0x3f')][_0xbdac('0x40')](',')[_0xbdac('0x41')](function(_0x18f45c){_0x526975['Tags']['push'](_0x378394[_0x18f45c]);});}delete _0x526975[_0xbdac('0x3f')];}catch(_0x276c8a){_0x4b2230(_0x276c8a);}_0x3f4193(_0x526975);});}function updateChatInteraction(_0x474185,_0x5c5a7e,_0x2fe4e5){return new BPromise(function(_0x47dbfc,_0x33646b){return getInteractionUsers(_0x474185,_0x2fe4e5)[_0xbdac('0x20')](function(_0x4c7aac){return getInteractionTags(_0x4c7aac,_0x5c5a7e);})[_0xbdac('0x20')](function(_0x1a52ef){_0x47dbfc(_0x1a52ef);})[_0xbdac('0x2b')](function(_0x44f515){_0x33646b(_0x44f515);});});}exports[_0xbdac('0x42')]=function(_0x437719,_0x17da66){var _0x334492={},_0x2ffa73={},_0x4a8699={'count':0x0,'rows':[]};var _0x4f8aad=_['map'](db[_0xbdac('0x43')][_0xbdac('0x44')],function(_0x4c5459){return{'name':_0x4c5459[_0xbdac('0x45')],'type':_0x4c5459[_0xbdac('0x46')]['key']};});_0x2ffa73[_0xbdac('0x47')]=_[_0xbdac('0x3c')](_0x4f8aad,_0xbdac('0x39'));_0x2ffa73[_0xbdac('0x48')]=_[_0xbdac('0x49')](_0x437719[_0xbdac('0x48')]);_0x2ffa73[_0xbdac('0x4a')]=_[_0xbdac('0x4b')](_0x2ffa73['model'],_0x2ffa73[_0xbdac('0x48')]);_0x334492[_0xbdac('0x4c')]=_[_0xbdac('0x4b')](_0x2ffa73[_0xbdac('0x47')],qs[_0xbdac('0x4d')](_0x437719[_0xbdac('0x48')]['fields']));_0x334492[_0xbdac('0x4c')]=_0x334492['attributes']['length']?_0x334492[_0xbdac('0x4c')]:_0x2ffa73['model'];if(!_0x437719[_0xbdac('0x48')][_0xbdac('0x4e')]('nolimit')){_0x334492['limit']=qs[_0xbdac('0x31')](_0x437719[_0xbdac('0x48')][_0xbdac('0x31')]);_0x334492['offset']=qs['offset'](_0x437719[_0xbdac('0x48')][_0xbdac('0x30')]);}_0x334492[_0xbdac('0x4f')]=qs[_0xbdac('0x50')](_0x437719[_0xbdac('0x48')][_0xbdac('0x50')]);_0x334492['where']=qs[_0xbdac('0x4a')](_['pick'](_0x437719[_0xbdac('0x48')],_0x2ffa73[_0xbdac('0x4a')]),_0x4f8aad);var _0x3f50f9=[];var _0x1ac44b=squel[_0xbdac('0x51')]()[_0xbdac('0x52')]('id')['field']('name')[_0xbdac('0x52')](_0xbdac('0x53'))[_0xbdac('0x54')](_0xbdac('0x55'));var _0x144b97=squel['select']()[_0xbdac('0x52')](_0xbdac('0x56'))[_0xbdac('0x52')](_0xbdac('0x57'))[_0xbdac('0x52')](_0xbdac('0x58'))['from']('user_has_chat_interactions','ui')[_0xbdac('0x59')]('users','u',_0xbdac('0x5a'));var _0x401b40=squel[_0xbdac('0x51')]()[_0xbdac('0x54')](_0xbdac('0x5b'),'i')[_0xbdac('0x59')]('cm_contacts','c',_0xbdac('0x5c'))['left_join']('users','o','o.id\x20=\x20i.UserId')['left_join'](_0xbdac('0x5d'),'a',_0xbdac('0x5e'))[_0xbdac('0x59')](_0xbdac('0x5f'),'me','me.ChatInteractionId\x20=\x20i.id')['left_join'](_0xbdac('0x60'),'it',_0xbdac('0x61'))['left_join'](_0xbdac('0x55'),'t',_0xbdac('0x62'));var _0x58e9e8=squel[_0xbdac('0x63')]();var _0x2c43d5=[];var _0x1f49fb=squel['expr']();var _0x2d4770;if(_0x437719[_0xbdac('0x48')]['search']){_0x2d4770=as[_0xbdac('0x64')](_0x437719['query'][_0xbdac('0x65')]);var _0x18c132=_0x2d4770[_0xbdac('0x66')];for(var _0x5a93d1=0x0;_0x5a93d1<_0x2d4770[_0xbdac('0x67')][_0xbdac('0x68')];_0x5a93d1++){var _0x16e1e7=_0x2d4770[_0xbdac('0x67')][_0x5a93d1];var _0x2236cf='i';var _0x16272a=_[_0xbdac('0x69')](_0x4f8aad,[_0xbdac('0x39'),_0x16e1e7['field']]);if(!_0x16272a){switch(_0x16e1e7['field']){case _0xbdac('0x6a'):if(_0x16e1e7[_0xbdac('0x6b')]==0x1){_0x401b40['having']('`'+_0x16e1e7[_0xbdac('0x52')]+_0xbdac('0x6c'));}else{_0x401b40[_0xbdac('0x6d')]('`'+_0x16e1e7[_0xbdac('0x52')]+_0xbdac('0x6e'));}break;case _0xbdac('0x6f'):if(_0x16e1e7[_0xbdac('0x70')]==='$substring'){if(_0x16e1e7[_0xbdac('0x6b')]['split']('\x20')['length']>0x1){_0x58e9e8[_0x18c132]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xbdac('0x71')](_0x16e1e7[_0xbdac('0x6b')]),null);}else{var _0x3952fe='%'+_0x16e1e7['value']+'%';_0x58e9e8[_0x18c132](_0xbdac('0x72'),_0x3952fe,_0x3952fe,_0x3952fe);}}else{_0x16272a=_['find'](_0x4f8aad,['name',_0xbdac('0x73')]);_0x16e1e7[_0xbdac('0x52')]=_0xbdac('0x73');_0x2e41f3=as[_0xbdac('0x74')](_0x2236cf,_0x16272a['type'],_0x16e1e7);_0x58e9e8[_0x18c132](_0x2e41f3['text'],_0x2e41f3[_0xbdac('0x6b')][_0xbdac('0x75')],_0x2e41f3[_0xbdac('0x6b')][_0xbdac('0x2d')]);}break;case _0xbdac('0x76'):var _0x1112f8=_0x16e1e7[_0xbdac('0x6b')][_0xbdac('0x40')](',')[_0xbdac('0x3c')](function(_0x24f0c4){return Number(_0x24f0c4);});_0x1112f8[_0xbdac('0x41')](function(_0x2f2ab0){_0x1f49fb['or'](_0xbdac('0x77'),'%,'+_0x2f2ab0+',%');});_0x2c43d5=_[_0xbdac('0x78')](_0x2c43d5,_0x1112f8);break;case'User':if(_0x16e1e7[_0xbdac('0x70')]===_0xbdac('0x79')){_0x58e9e8[_0x18c132](_0xbdac('0x7a'),'%'+_0x16e1e7['value']+'%',null);}else{_0x16272a=_[_0xbdac('0x69')](_0x4f8aad,[_0xbdac('0x39'),'UserId']);_0x16e1e7[_0xbdac('0x52')]=_0xbdac('0x7b');_0x2e41f3=as['buildExpression'](_0x2236cf,_0x16272a[_0xbdac('0x46')],_0x16e1e7);_0x58e9e8[_0x18c132](_0x2e41f3[_0xbdac('0x7c')],_0x2e41f3[_0xbdac('0x6b')][_0xbdac('0x75')],_0x2e41f3['value']['end']);}break;case _0xbdac('0x7d'):_0x2e41f3=as['buildExpression']('me',null,_0x16e1e7);_0x58e9e8[_0x18c132](_0x2e41f3[_0xbdac('0x7c')],_0x2e41f3[_0xbdac('0x6b')][_0xbdac('0x75')],_0x2e41f3[_0xbdac('0x6b')][_0xbdac('0x2d')]);break;}}else{var _0x2e41f3=as[_0xbdac('0x74')](_0x2236cf,_0x16272a[_0xbdac('0x46')],_0x16e1e7);_0x58e9e8[_0x18c132](_0x2e41f3[_0xbdac('0x7c')],_0x2e41f3[_0xbdac('0x6b')][_0xbdac('0x75')],_0x2e41f3[_0xbdac('0x6b')]['end']);}}}else{var _0x29531f=_(_0x437719['query'])[_0xbdac('0x49')]()[_0xbdac('0x3c')](function(_0x4f8c71){return _[_0xbdac('0x7e')](_0x4f8aad,['name',_0x4f8c71])?_0x4f8c71:undefined;})[_0xbdac('0x7f')]()[_0xbdac('0x6b')]();if(!_[_0xbdac('0x80')](_0x29531f)){_0x29531f[_0xbdac('0x41')](function(_0x2a2a63){if(_0x2a2a63==='ChatWebsiteId'){_0x401b40['where'](_0xbdac('0x81'),[][_0xbdac('0x82')](_0x437719['query'][_0x2a2a63]));}else if(_0x2a2a63===_0xbdac('0x83')){var _0x4c8ba6=JSON[_0xbdac('0x84')](_0x437719[_0xbdac('0x48')][_0x2a2a63])[_0xbdac('0x85')];var _0x4e465e=JSON[_0xbdac('0x84')](_0x437719['query'][_0x2a2a63])[_0xbdac('0x86')];_0x401b40[_0xbdac('0x87')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4c8ba6,_0x4e465e);}else{if(_0x437719[_0xbdac('0x48')][_0x2a2a63]===_0xbdac('0x88')){_0x401b40[_0xbdac('0x87')]('i.'+_0x2a2a63+_0xbdac('0x89'));}else{_0x401b40['where']('i.'+_0x2a2a63+_0xbdac('0x8a'),_0x437719[_0xbdac('0x48')][_0x2a2a63]);}}});}if(_0x437719[_0xbdac('0x48')][_0xbdac('0x8b')]){if(_0x437719[_0xbdac('0x48')][_0xbdac('0x8b')]==0x1){_0x401b40['having'](_0xbdac('0x8c'));}else{_0x401b40[_0xbdac('0x6d')](_0xbdac('0x8d'));}}if(_0x437719['query'][_0xbdac('0x8e')]){_0x2c43d5=_[_0xbdac('0x8f')](_0x437719[_0xbdac('0x48')][_0xbdac('0x8e')])?_0x437719[_0xbdac('0x48')][_0xbdac('0x8e')]:new Array(_0x437719[_0xbdac('0x48')][_0xbdac('0x8e')]);_0x2c43d5[_0xbdac('0x41')](function(_0x430c3c){_0x1f49fb['or'](_0xbdac('0x77'),'%,'+_0x430c3c+',%');});}if(_0x437719[_0xbdac('0x48')][_0xbdac('0x90')]){var _0x5dc240=_0x437719[_0xbdac('0x48')][_0xbdac('0x90')][_0xbdac('0x91')]('\x5c','\x5c\x5c')[_0xbdac('0x91')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5dc240)){_0x58e9e8['or']('i.id\x20LIKE\x20?',_0x5dc240+'%');}else{_0x58e9e8['or'](_0xbdac('0x92'),qs[_0xbdac('0x71')](_0x5dc240))['or'](_0xbdac('0x93'),_0x5dc240+'%');}}}_0x401b40['where'](_0x58e9e8);_0x401b40[_0xbdac('0x94')](_0xbdac('0x95'));var _0x3cc2e5={'type':db['Sequelize'][_0xbdac('0x96')][_0xbdac('0x97')],'raw':!![]};var _0x483c60=_0x401b40[_0xbdac('0x98')]();_0x483c60[_0xbdac('0x52')](_0xbdac('0x95'));_0x483c60['field'](_0xbdac('0x99'),_0xbdac('0x6a'));if(_0x334492['order']){_0x334492[_0xbdac('0x4f')][_0xbdac('0x41')](function(_0x47fb11){var _0x1bcd63=_0x47fb11[0x0]===_0xbdac('0x9a')?_0x47fb11[0x0]:'i.'+_0x47fb11[0x0];_0x401b40[_0xbdac('0x4f')](_0x1bcd63,_0x47fb11[0x1]===_0xbdac('0x9b')?![]:!![]);});}if(!_[_0xbdac('0x80')](_0x2c43d5)){_0x401b40['having'](_0x1f49fb);_0x483c60[_0xbdac('0x87')](_0xbdac('0x9c'),_0x2c43d5);}BPromise['resolve']()['then'](function(){if(!_0x2d4770){if(_0x437719[_0xbdac('0x48')]['ChatWebsiteId'])return;_0x483c60[_0xbdac('0x87')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x401b40[_0xbdac('0x87')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x437719[_0xbdac('0x9d')][_0xbdac('0x9e')]!==_0xbdac('0x9f'))return;return _0x437719[_0xbdac('0x9d')][_0xbdac('0xa0')]({'attributes':['id'],'raw':!![]})[_0xbdac('0x20')](function(_0x201d0b){if(_[_0xbdac('0x80')](_0x201d0b)){_0x483c60[_0xbdac('0x87')]('i.ChatWebsiteId\x20IS\x20NULL');_0x401b40[_0xbdac('0x87')](_0xbdac('0xa1'));}else{_0x483c60[_0xbdac('0x87')](_0xbdac('0x81'),_[_0xbdac('0x3c')](_0x201d0b,'id'));_0x401b40[_0xbdac('0x87')](_0xbdac('0x81'),_[_0xbdac('0x3c')](_0x201d0b,'id'));}});})[_0xbdac('0x20')](function(){if(_0x437719[_0xbdac('0x9d')][_0xbdac('0x9e')]===_0xbdac('0x9f')&&!_0x2d4770&&!_0x437719[_0xbdac('0x48')][_0xbdac('0xa2')])return[];return db[_0xbdac('0xa3')]['query'](_0x483c60[_0xbdac('0xa4')](),_0x3cc2e5);})[_0xbdac('0x20')](function(_0x3a353f){_0x4a8699[_0xbdac('0x2f')]=_0x3a353f[_0xbdac('0x68')];if(_0x4a8699['count']===0x0)return[];return db[_0xbdac('0xa3')][_0xbdac('0x48')](_0x1ac44b['toString'](),_0x3cc2e5)[_0xbdac('0x20')](function(_0x38a9c2){_0x3f50f9=_['keyBy'](_0x38a9c2,'id');_0x3cc2e5=_[_0xbdac('0xa5')](_0x3cc2e5,{'model':db[_0xbdac('0x43')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x437719[_0xbdac('0x48')][_0xbdac('0x4d')]){_0x334492[_0xbdac('0x4c')][_0xbdac('0x41')](function(_0x970cc){_0x401b40[_0xbdac('0x52')]('i.'+_0x970cc);});}else{_0x401b40[_0xbdac('0x52')](_0xbdac('0x99'),_0xbdac('0x6a'));_0x401b40[_0xbdac('0x52')]('a.key',_0xbdac('0xa6'));_0x401b40[_0xbdac('0x52')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x401b40['field']('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');_0x401b40[_0xbdac('0x52')](_0xbdac('0xa7'));_0x401b40[_0xbdac('0x52')](_0xbdac('0xa8'),_0xbdac('0xa9'));_0x401b40[_0xbdac('0x52')](_0xbdac('0xaa'),_0xbdac('0xab'));_0x401b40[_0xbdac('0x52')](_0xbdac('0xac'),_0xbdac('0xad'));_0x401b40[_0xbdac('0x52')](_0xbdac('0xae'),_0xbdac('0xaf'));_0x401b40[_0xbdac('0x52')](_0xbdac('0xb0'),'Contact.mobile');_0x401b40[_0xbdac('0x52')]('c.fax',_0xbdac('0xb1'));_0x401b40[_0xbdac('0x52')]('o.fullname','Owner.fullname');_0x401b40[_0xbdac('0x52')](_0xbdac('0xb2'),_0xbdac('0xb3'));_0x401b40[_0xbdac('0x52')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xbdac('0x3f'));}if(_0x334492[_0xbdac('0x31')])_0x401b40[_0xbdac('0x31')](_0x334492[_0xbdac('0x31')]);if(_0x334492[_0xbdac('0x30')])_0x401b40['offset'](_0x334492['offset']);return db[_0xbdac('0xa3')][_0xbdac('0x48')](_0x401b40[_0xbdac('0xa4')](),_0x3cc2e5);})['then'](function(_0x28f252){_0x144b97[_0xbdac('0x87')]('ui.ChatInteractionId\x20IN\x20?',_[_0xbdac('0x3c')](_0x28f252,'id'));return db[_0xbdac('0xa3')]['query'](_0x144b97[_0xbdac('0xa4')](),_0x3cc2e5)[_0xbdac('0x20')](function(_0x43ed7e){var _0x4d6b44=_[_0xbdac('0xb4')](_0x43ed7e,_0xbdac('0xb5'));var _0x49feb1=[];_0x28f252[_0xbdac('0x41')](function(_0xfabdea){_0x49feb1[_0xbdac('0xb6')](updateChatInteraction(_0xfabdea,_0x3f50f9,_0x4d6b44));});return BPromise[_0xbdac('0xb7')](_0x49feb1);});});})[_0xbdac('0x20')](function(_0x1a5110){_0x4a8699[_0xbdac('0xb8')]=_0x1a5110;return _0x4a8699;})[_0xbdac('0x20')](respondWithFilteredResult(_0x17da66,_0x334492))[_0xbdac('0x2b')](handleError(_0x17da66,null));};exports[_0xbdac('0xb9')]=function(_0xd9e58e,_0x55ae9e){var _0x596977={'raw':![],'where':{'id':_0xd9e58e[_0xbdac('0xba')]['id']}},_0x1b19f8={};_0x1b19f8[_0xbdac('0x47')]=_[_0xbdac('0x49')](db[_0xbdac('0x43')][_0xbdac('0x44')]);_0x1b19f8[_0xbdac('0x48')]=_[_0xbdac('0x49')](_0xd9e58e[_0xbdac('0x48')]);_0x1b19f8[_0xbdac('0x4a')]=_[_0xbdac('0x4b')](_0x1b19f8[_0xbdac('0x47')],_0x1b19f8[_0xbdac('0x48')]);_0x596977[_0xbdac('0x4c')]=_['intersection'](_0x1b19f8[_0xbdac('0x47')],qs[_0xbdac('0x4d')](_0xd9e58e[_0xbdac('0x48')][_0xbdac('0x4d')]));_0x596977['attributes']=_0x596977[_0xbdac('0x4c')]['length']?_0x596977[_0xbdac('0x4c')]:_0x1b19f8[_0xbdac('0x47')];if(_0xd9e58e[_0xbdac('0x48')][_0xbdac('0xbb')]){_0x596977['include']=[{'all':!![]}];}_0x596977=_[_0xbdac('0xa5')]({},_0x596977,_0xd9e58e[_0xbdac('0xbc')]);return db['ChatInteraction'][_0xbdac('0x69')](_0x596977)[_0xbdac('0x20')](handleEntityNotFound(_0x55ae9e,null))['then'](respondWithResult(_0x55ae9e,null))[_0xbdac('0x2b')](handleError(_0x55ae9e,null));};exports[_0xbdac('0xbd')]=function(_0x20461a,_0x378f2c){return db[_0xbdac('0x43')][_0xbdac('0xbd')](_0x20461a[_0xbdac('0x7d')],{})['then'](respondWithResult(_0x378f2c,0xc9))['catch'](handleError(_0x378f2c,null));};exports[_0xbdac('0xbe')]=function(_0x3bb42d,_0x25d913){if(_0x3bb42d['body']['id']){delete _0x3bb42d[_0xbdac('0x7d')]['id'];}return db[_0xbdac('0x43')][_0xbdac('0x69')]({'where':{'id':_0x3bb42d['params']['id']}})[_0xbdac('0x20')](handleEntityNotFound(_0x25d913,null))[_0xbdac('0x20')](saveUpdates(_0x3bb42d[_0xbdac('0x7d')],null))[_0xbdac('0x20')](respondWithResult(_0x25d913,null))[_0xbdac('0x2b')](handleError(_0x25d913,null));};exports['destroy']=function(_0x5551f4,_0x2f2514){return db[_0xbdac('0x43')][_0xbdac('0x69')]({'where':{'id':_0x5551f4[_0xbdac('0xba')]['id']}})['then'](handleEntityNotFound(_0x2f2514,null))[_0xbdac('0x20')](removeEntity(_0x2f2514,null))[_0xbdac('0x2b')](handleError(_0x2f2514,null));};exports[_0xbdac('0xbf')]=function(_0x329767,_0xa07efa){return db[_0xbdac('0x43')][_0xbdac('0xbf')]()[_0xbdac('0x20')](respondWithResult(_0xa07efa,null))['catch'](handleError(_0xa07efa,null));};exports[_0xbdac('0xc0')]=function(_0x55766e,_0x9ea734){var _0x22c0c1=_0x55766e['params']['id'];var _0x178aaf;var _0xa208f9;var _0x4696ed;return db[_0xbdac('0x43')][_0xbdac('0xc1')]({'where':{'id':_0x22c0c1}})[_0xbdac('0x20')](function(_0x19ca31){_0x178aaf=_0x19ca31;return db[_0xbdac('0xc2')]['findOne']({'where':{'id':_0x19ca31[_0xbdac('0xa2')]},'attributes':['id',_0xbdac('0xc3'),_0xbdac('0xc4')],'raw':!![]});})['then'](function(_0x21b6fc){if(_0x21b6fc&&_0x21b6fc['vidaooApiKey']&&_0x21b6fc[_0xbdac('0xc4')]){_0xa208f9=_0x21b6fc;var _0x2b9c5b={'rejectUnauthorized':![],'method':_0xbdac('0xc5'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x21b6fc['vidaooApiKey']},'body':{'name':'MotionCWB:'+_0x22c0c1},'redirect':_0xbdac('0xc6'),'json':!![]};return rp(_0x2b9c5b);}else{throw new db[(_0xbdac('0xc7'))]['ValidationError'](_0xbdac('0xc8'));}})[_0xbdac('0x20')](function(_0x2da5d6){_0x4696ed=_0x2da5d6;if(_0x4696ed['id']){var _0x1ee390={'body':_0x4696ed[_0xbdac('0xc9')],'ChatWebsiteId':_0xa208f9['id'],'ChatInteractionId':_0x178aaf['id'],'direction':_0xbdac('0xca'),'UserId':_0x55766e[_0xbdac('0x9d')]['id']};return db[_0xbdac('0xcb')][_0xbdac('0xbd')](_0x1ee390,{});}else{throw new db[(_0xbdac('0xc7'))][(_0xbdac('0xcc'))](_0xbdac('0xcd'));}})['then'](function(){return _0x178aaf[_0xbdac('0xce')]({'vidaooSessionId':_0x4696ed['id']});})[_0xbdac('0x20')](respondWithResult(_0x9ea734,null))[_0xbdac('0x2b')](handleError(_0x9ea734,null));};exports[_0xbdac('0xcf')]=function(_0x2221ff,_0x135f15){if(_0x2221ff[_0xbdac('0x7d')]['id']){delete _0x2221ff[_0xbdac('0x7d')]['id'];}return db['ChatInteraction'][_0xbdac('0x69')]({'where':{'id':_0x2221ff[_0xbdac('0xba')]['id']}})[_0xbdac('0x20')](handleEntityNotFound(_0x135f15,null))[_0xbdac('0x20')](saveUpdates(_0x2221ff[_0xbdac('0x7d')],null))[_0xbdac('0x20')](respondWithResult(_0x135f15,null))[_0xbdac('0x2b')](handleError(_0x135f15,null));};exports[_0xbdac('0xd0')]=function(_0x13bdc3,_0x59bd7f,_0xdc5023){if(_0x13bdc3[_0xbdac('0x7d')]['id']){delete _0x13bdc3[_0xbdac('0x7d')]['id'];}return db[_0xbdac('0x43')][_0xbdac('0x69')]({'where':{'id':_0x13bdc3['params']['id']}})['then'](function(_0x59adff){if(!_0x59adff){logger[_0xbdac('0x26')](_0xbdac('0xd1'),_0xbdac('0xd0'),0x194,_0xbdac('0xd2'));_0x59bd7f[_0xbdac('0x37')](0x194);}else{if(_0x59adff[_0xbdac('0x7b')]){throw new db[(_0xbdac('0xc7'))][(_0xbdac('0xcc'))]('Interaction\x20already\x20assigned');}}return _0x59adff;})[_0xbdac('0x20')](function(_0x5b48a5){if(_0x5b48a5){return _0x5b48a5[_0xbdac('0xbe')]({'closed':_0x13bdc3[_0xbdac('0x7d')][_0xbdac('0xd3')],'disposition':_0x13bdc3[_0xbdac('0x7d')][_0xbdac('0xd4')]})[_0xbdac('0x20')](function(_0x555613){return _0x555613;});}})['then'](function(_0xfc5f67){return respondWithRpcPromise('AbandonInteraction',_0xbdac('0xd0'),_0x13bdc3[_0xbdac('0x7d')],client9004);})[_0xbdac('0x20')](respondWithResult(_0x59bd7f,null))[_0xbdac('0x2b')](handleError(_0x59bd7f,null));};exports[_0xbdac('0xd5')]=function(_0xadba88,_0xf85da9,_0x4f9cc1){_0xadba88[_0xbdac('0x7d')][_0xbdac('0x39')]=_0xadba88[_0xbdac('0xd6')][_0xbdac('0xd7')];_0xadba88[_0xbdac('0x7d')][_0xbdac('0xd8')]=_0xadba88[_0xbdac('0xd6')][_0xbdac('0xd9')];_0xadba88['body'][_0xbdac('0x46')]=_0xadba88['file'][_0xbdac('0xda')];return db[_0xbdac('0xdb')][_0xbdac('0xbd')](_0xadba88[_0xbdac('0x7d')])[_0xbdac('0x20')](respondWithResult(_0xf85da9,0xc9))[_0xbdac('0x2b')](handleError(_0xf85da9,null));};exports[_0xbdac('0xdc')]=function(_0x22a043,_0x46fc58,_0x4f4dae){return db[_0xbdac('0x43')][_0xbdac('0xc1')]({'where':{'id':_0x22a043[_0xbdac('0xba')]['id']},'raw':!![]})[_0xbdac('0x20')](handleEntityNotFound(_0x46fc58,null))[_0xbdac('0x20')](function(_0x56d003){if(_0x56d003){if(_0x56d003[_0xbdac('0xd3')]){return _0x46fc58[_0xbdac('0x2c')](0x193)[_0xbdac('0x2e')]({'status':0x193,'message':_0xbdac('0xdd')});}return db['Attachment']['findOne']({'where':{'id':_0x22a043[_0xbdac('0x48')][_0xbdac('0xde')]},'raw':!![]})['then'](handleEntityNotFound(_0x46fc58,null));}})['then'](function(_0xa35ecd){if(_0xa35ecd){return _0x46fc58[_0xbdac('0xdf')](path[_0xbdac('0xe0')](config['root'],'server/files/attachments/',_0xa35ecd[_0xbdac('0xd8')]));}})[_0xbdac('0x2b')](handleError(_0x46fc58,null));};exports['close']=function(_0x2ce32a,_0x5ec87a){var _0x422c3e=null;var _0x55f9da=null;var _0x5370c4=null;var _0xbc1b24=null;if(_0x2ce32a[_0xbdac('0x7d')]['id']){delete _0x2ce32a[_0xbdac('0x7d')]['id'];}if(_0x2ce32a['body'][_0xbdac('0xe1')]){_0xbc1b24=path[_0xbdac('0xe0')](config['root'],'server/files/chat/upload/',util[_0xbdac('0xe2')](_0xbdac('0xe3'),Date[_0xbdac('0xe4')]()));_0x2ce32a[_0xbdac('0x7d')]['pathTranscript']=_0xbc1b24;}return db[_0xbdac('0x43')][_0xbdac('0x69')]({'where':{'id':_0x2ce32a[_0xbdac('0xba')]['id']},'include':[{'model':db[_0xbdac('0xcb')],'as':_0xbdac('0xe5'),'include':[{'model':db[_0xbdac('0xe6')],'as':_0xbdac('0xe6')}]}]})[_0xbdac('0x20')](handleEntityNotFound(_0x5ec87a,null))[_0xbdac('0x20')](saveUpdates(_0x2ce32a['body'],null))[_0xbdac('0x20')](function(_0x1ea03e){if(_0x1ea03e){_0x422c3e=_0x1ea03e;return db['ChatWebsite'][_0xbdac('0x69')]({'where':{'id':_0x422c3e['ChatWebsiteId']}});}})['then'](function(_0x5904a9){if(_0x5904a9){_0x5370c4=_0x5904a9;return db['CmContact'][_0xbdac('0x69')]({'where':{'id':_0x422c3e[_0xbdac('0x73')]}});}})[_0xbdac('0x20')](function(_0x2b11ad){if(_0x2b11ad){_0x55f9da=_0x2b11ad;if(_0xbc1b24){var _0x307d77=null;for(var _0x390581=0x1;_0x390581<_0x422c3e['Messages'][_0xbdac('0x68')];++_0x390581){_0x307d77=_0x422c3e[_0xbdac('0xe5')][_0x390581];var _0x12ecc7=_0x307d77[_0xbdac('0x7b')]?util['format']('%s%d',_0x5370c4['agentAlias'],_0x307d77[_0xbdac('0x7b')]):'System';var _0x4e9347=_0x2ce32a[_0xbdac('0x7d')][_0xbdac('0xe7')]||util[_0xbdac('0xe2')](_0xbdac('0xe8'),'Visitor',_0x307d77[_0xbdac('0x73')]);switch(_0x5370c4[_0xbdac('0xe9')]){case _0xbdac('0xea'):_0x12ecc7=_0x307d77[_0xbdac('0x7b')]?util[_0xbdac('0xe2')](_0xbdac('0xe8'),_0x5370c4[_0xbdac('0xeb')],_0x307d77[_0xbdac('0x7b')]):_0xbdac('0xec');break;case'agent_alias':_0x12ecc7=_0x307d77[_0xbdac('0x7b')]?_0x307d77['User'][_0xbdac('0xed')]||_0x307d77[_0xbdac('0xe6')]['fullname']:_0xbdac('0xec');break;case _0xbdac('0xee'):_0x12ecc7=_0x307d77[_0xbdac('0x7b')]?_0x307d77[_0xbdac('0xe6')]['fullname']:'System';break;default:_0x12ecc7=_0x307d77[_0xbdac('0x7b')]?util[_0xbdac('0xe2')]('%s%d',_0x5370c4['agentAlias'],_0x307d77['UserId']):_0xbdac('0xec');}var _0xec96a8=util[_0xbdac('0xe2')](_0xbdac('0xef'),moment(_0x307d77[_0xbdac('0x83')])['format'](_0xbdac('0xf0')),_0x307d77[_0xbdac('0xf1')]==='in'?_0x4e9347:_0x12ecc7,_0x307d77[_0xbdac('0x7d')]);if(!_0x307d77[_0xbdac('0xf2')]){fs[_0xbdac('0xf3')](_0xbc1b24,_0xec96a8);}}return db[_0xbdac('0xf4')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}}})[_0xbdac('0x20')](function(_0x3b01c6){if(_0x3b01c6&&_0x3b01c6[_0xbdac('0xf5')]&&_0x2ce32a[_0xbdac('0x7d')]){var _0x382cb9={'tls':{'rejectUnauthorized':![]}};if(_0x3b01c6[_0xbdac('0xf5')][_0xbdac('0xf6')]){_0x382cb9[_0xbdac('0xf6')]=_0x3b01c6['Smtp'][_0xbdac('0xf6')];}else{_0x382cb9[_0xbdac('0xf7')]=_0x3b01c6[_0xbdac('0xf5')]['host'];_0x382cb9[_0xbdac('0xf8')]=_0x3b01c6[_0xbdac('0xf5')][_0xbdac('0xf8')];_0x382cb9[_0xbdac('0xf9')]=_0x3b01c6['Smtp']['secure'];}if(_0x3b01c6[_0xbdac('0xf5')][_0xbdac('0xfa')]){_0x382cb9[_0xbdac('0xfb')]={'user':_0x3b01c6['Smtp'][_0xbdac('0x9d')],'pass':_0x3b01c6[_0xbdac('0xf5')][_0xbdac('0xfc')]};}return respondWithRpcPromise(_0xbdac('0xfd'),_0xbdac('0xfe'),{'account':_0x382cb9,'message':{'from':util[_0xbdac('0xe2')](_0xbdac('0xff'),_0x3b01c6['name'],_0x3b01c6['email']||_0x3b01c6[_0xbdac('0xf5')][_0xbdac('0x9d')]),'to':_0x2ce32a[_0xbdac('0x7d')][_0xbdac('0xe1')],'subject':'Mail\x20Transcript','text':util[_0xbdac('0xe2')](_0xbdac('0x100'),_0x2ce32a['body'][_0xbdac('0xe1')]),'attachments':[{'path':_0xbc1b24}]}})[_0xbdac('0x20')](function(){return _0x422c3e;})[_0xbdac('0x2b')](function(_0x9a87ce){console[_0xbdac('0x26')](_0x9a87ce);});}else{return _0x422c3e;}})[_0xbdac('0x20')](respondWithStatusCode(_0x5ec87a,0xc8))[_0xbdac('0x2b')](handleError(_0x5ec87a,null));};exports[_0xbdac('0x101')]=function(_0x2f4807,_0x4faa27,_0x4fa3f6){return db[_0xbdac('0xcb')][_0xbdac('0x69')]({'where':{'id':_0x2f4807['params']['id']}})[_0xbdac('0x20')](handleEntityNotFound(_0x4faa27,null))[_0xbdac('0x20')](function(_0x3dd7b4){if(_0x3dd7b4){return _0x3dd7b4['addMessage'](_0x2f4807[_0xbdac('0x7d')]['ids'],_[_0xbdac('0x102')](_0x2f4807[_0xbdac('0x7d')],[_0xbdac('0x103'),'id'])||{});}})[_0xbdac('0x20')](respondWithResult(_0x4faa27,null))[_0xbdac('0x2b')](handleError(_0x4faa27,null));};exports[_0xbdac('0x104')]=function(_0x1b1dcb,_0x9fe2bd,_0x4fe877){var _0x358749={'raw':![],'where':{}};var _0x3e8377={};var _0x2ee791={'count':0x0,'rows':[]};return db[_0xbdac('0x43')][_0xbdac('0xc1')]({'where':{'id':_0x1b1dcb[_0xbdac('0xba')]['id']}})['then'](handleEntityNotFound(_0x9fe2bd,null))['then'](function(_0x100975){if(_0x100975){_0x3e8377[_0xbdac('0x47')]=_['keys'](db[_0xbdac('0xcb')][_0xbdac('0x44')]);_0x3e8377[_0xbdac('0x48')]=_[_0xbdac('0x49')](_0x1b1dcb[_0xbdac('0x48')]);_0x3e8377[_0xbdac('0x4a')]=_['intersection'](_0x3e8377[_0xbdac('0x47')],_0x3e8377[_0xbdac('0x48')]);_0x358749[_0xbdac('0x4c')]=_[_0xbdac('0x4b')](_0x3e8377[_0xbdac('0x47')],qs[_0xbdac('0x4d')](_0x1b1dcb[_0xbdac('0x48')]['fields']));_0x358749['attributes']=_0x358749[_0xbdac('0x4c')][_0xbdac('0x68')]?_0x358749[_0xbdac('0x4c')]:_0x3e8377[_0xbdac('0x47')];if(!_0x1b1dcb['query'][_0xbdac('0x4e')]('nolimit')){_0x358749[_0xbdac('0x31')]=qs[_0xbdac('0x31')](_0x1b1dcb['query'][_0xbdac('0x31')]);_0x358749[_0xbdac('0x30')]=qs[_0xbdac('0x30')](_0x1b1dcb['query'][_0xbdac('0x30')]);}_0x358749[_0xbdac('0x4f')]=qs[_0xbdac('0x50')](_0x1b1dcb['query']['sort']);_0x358749[_0xbdac('0x87')]=qs[_0xbdac('0x4a')](_[_0xbdac('0x105')](_0x1b1dcb[_0xbdac('0x48')],_0x3e8377[_0xbdac('0x4a')]));_0x358749[_0xbdac('0x87')][_0xbdac('0xb5')]=_0x100975['id'];if(_0x1b1dcb[_0xbdac('0x48')][_0xbdac('0x90')]){_0x358749[_0xbdac('0x87')]=_[_0xbdac('0xa5')](_0x358749[_0xbdac('0x87')],{'$or':_[_0xbdac('0x3c')](_0x358749[_0xbdac('0x4c')],function(_0x2c473a){var _0x389f95={};_0x389f95[_0x2c473a]={'$like':'%'+_0x1b1dcb[_0xbdac('0x48')][_0xbdac('0x90')]+'%'};return _0x389f95;})});}if(_0x1b1dcb[_0xbdac('0x48')][_0xbdac('0x85')]){var _0x1115ef=_0x1b1dcb[_0xbdac('0x48')]['$gte'][_0xbdac('0x40')](',');var _0x5a7f63={};_0x5a7f63[_0x1115ef[0x0]]={'$gte':moment(_0x1115ef[0x1])[_0xbdac('0xe2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x358749[_0xbdac('0x87')]=_['merge'](_0x358749[_0xbdac('0x87')],_0x5a7f63);}_0x358749=_[_0xbdac('0xa5')]({},_0x358749,_0x1b1dcb[_0xbdac('0xbc')]);return db[_0xbdac('0xcb')][_0xbdac('0x2f')]({'where':_0x358749[_0xbdac('0x87')]})[_0xbdac('0x20')](function(_0x5b354b){_0x2ee791[_0xbdac('0x2f')]=_0x5b354b;if(_0x1b1dcb[_0xbdac('0x48')]['includeAll']){_0x358749[_0xbdac('0x106')]=[{'all':!![]}];}return db[_0xbdac('0xcb')][_0xbdac('0x107')](_0x358749);})[_0xbdac('0x20')](function(_0x13bdb4){_0x2ee791[_0xbdac('0xb8')]=_0x13bdb4;return _0x2ee791;});}})[_0xbdac('0x20')](respondWithFilteredResult(_0x9fe2bd,_0x358749))[_0xbdac('0x2b')](handleError(_0x9fe2bd,null));};exports[_0xbdac('0x108')]=function(_0x11e80d,_0x2154da,_0x4c96f4){var _0x5a6868={'where':{}},_0x5f1d9b={},_0x169a1c={'count':0x0,'rows':[]};return db[_0xbdac('0x43')][_0xbdac('0xc1')]({'where':{'id':_0x11e80d[_0xbdac('0xba')]['id']}})[_0xbdac('0x20')](handleEntityNotFound(_0x2154da,null))['then'](function(_0x287035){if(_0x287035){_0x5f1d9b['model']=_[_0xbdac('0x49')](db[_0xbdac('0xcb')]['rawAttributes']);_0x5f1d9b[_0xbdac('0x48')]=_[_0xbdac('0x49')](_0x11e80d[_0xbdac('0x48')]);_0x5f1d9b[_0xbdac('0x4a')]=_['intersection'](_0x5f1d9b['model'],_0x5f1d9b[_0xbdac('0x48')]);_0x5a6868[_0xbdac('0x4c')]=_[_0xbdac('0x4b')](_0x5f1d9b[_0xbdac('0x47')],qs['fields'](_0x11e80d[_0xbdac('0x48')][_0xbdac('0x4d')]));_0x5a6868[_0xbdac('0x4c')]=_0x5a6868['attributes']['length']?_0x5a6868['attributes']:_0x5f1d9b['model'];if(!_0x11e80d[_0xbdac('0x48')]['hasOwnProperty']('nolimit')){_0x5a6868[_0xbdac('0x31')]=qs['limit'](_0x11e80d[_0xbdac('0x48')][_0xbdac('0x31')]);_0x5a6868[_0xbdac('0x30')]=qs[_0xbdac('0x30')](_0x11e80d[_0xbdac('0x48')][_0xbdac('0x30')]);}_0x5a6868[_0xbdac('0x4f')]=qs[_0xbdac('0x50')](_0x11e80d[_0xbdac('0x48')][_0xbdac('0x50')]);_0x5a6868[_0xbdac('0x87')]=qs['filters'](_[_0xbdac('0x105')](_0x11e80d['query'],_0x5f1d9b[_0xbdac('0x4a')]));_0x5a6868['where'][_0xbdac('0xb5')]=_0x287035['id'];if(_0x11e80d[_0xbdac('0x48')][_0xbdac('0x90')]){_0x5a6868[_0xbdac('0x87')]=_[_0xbdac('0xa5')](_0x5a6868[_0xbdac('0x87')],{'$or':_[_0xbdac('0x3c')](_0x5a6868['attributes'],function(_0x1e2f6c){var _0x461e10={};_0x461e10[_0x1e2f6c]={'$like':'%'+_0x11e80d[_0xbdac('0x48')]['filter']+'%'};return _0x461e10;})});}_0x5a6868[_0xbdac('0x87')]['secret']=![];if(_0x11e80d[_0xbdac('0x48')]['id']){_0x5a6868[_0xbdac('0x87')]['id']={'$gt':_0x11e80d['query']['id']};}_0x5a6868=_[_0xbdac('0xa5')]({},_0x5a6868,_0x11e80d[_0xbdac('0xbc')]);return db[_0xbdac('0xcb')][_0xbdac('0x2f')]({'where':_0x5a6868['where']})[_0xbdac('0x20')](function(_0x23deec){_0x169a1c[_0xbdac('0x2f')]=_0x23deec;_0x5a6868[_0xbdac('0x106')]=[];if(_0x11e80d[_0xbdac('0x48')][_0xbdac('0x109')]){_0x5a6868['include'][_0xbdac('0xb6')]({'model':db[_0xbdac('0xe6')],'as':_0xbdac('0xe6'),'attributes':['id','fullname',_0xbdac('0xed')]});}if(_0x11e80d[_0xbdac('0x48')][_0xbdac('0xbb')]){_0x5a6868[_0xbdac('0x106')]=[{'all':!![]}];}return db[_0xbdac('0xcb')][_0xbdac('0x107')](_0x5a6868);})[_0xbdac('0x20')](function(_0x219095){_0x169a1c[_0xbdac('0xb8')]=_0x219095;return _0x169a1c;});}})['then'](respondWithFilteredResult(_0x2154da,_0x5a6868))['catch'](handleError(_0x2154da,null));};exports[_0xbdac('0x10a')]=function(_0xa932f4,_0x4f5631,_0x1f2312){return db[_0xbdac('0x43')]['find']({'where':{'id':_0xa932f4[_0xbdac('0xba')]['id']}})[_0xbdac('0x20')](handleEntityNotFound(_0x4f5631,null))[_0xbdac('0x20')](function(_0x34c13e){if(_0x34c13e){return _0x34c13e[_0xbdac('0x10b')](_0xa932f4['body']['ids'],_[_0xbdac('0x102')](_0xa932f4[_0xbdac('0x7d')],[_0xbdac('0x103'),'id'])||{})[_0xbdac('0x10c')](function(){return db[_0xbdac('0x76')][_0xbdac('0x107')]({'attributes':['id',_0xbdac('0x39'),_0xbdac('0x53')],'where':{'id':_0xa932f4[_0xbdac('0x7d')]['ids']}});})[_0xbdac('0x20')](function(_0x40b21d){socket[_0xbdac('0x10d')](_0xbdac('0x10e'),{'id':Number(_0xa932f4[_0xbdac('0xba')]['id']),'tags':_0x40b21d||[]});return{'id':Number(_0xa932f4['params']['id']),'tags':_0x40b21d||[]};});}})[_0xbdac('0x20')](respondWithResult(_0x4f5631,null))[_0xbdac('0x2b')](handleError(_0x4f5631,null));};exports['removeTags']=function(_0x219f03,_0x3bf083,_0x3108c0){return db[_0xbdac('0x43')][_0xbdac('0x69')]({'where':{'id':_0x219f03[_0xbdac('0xba')]['id']}})[_0xbdac('0x20')](handleEntityNotFound(_0x3bf083,null))['then'](function(_0x4da676){if(_0x4da676){return _0x4da676['removeTags'](_0x219f03['query'][_0xbdac('0x103')]);}})[_0xbdac('0x20')](respondWithStatusCode(_0x3bf083,null))[_0xbdac('0x2b')](handleError(_0x3bf083,null));};exports[_0xbdac('0xdf')]=function(_0x3d4e28,_0x242587){var _0x386ead=moment()[_0xbdac('0x10f')]()['toString']();var _0x4520b1=path[_0xbdac('0xe0')](config[_0xbdac('0x110')],'server',_0xbdac('0x111'),_0xbdac('0x112'));var _0x39a719=path['join'](config['root'],_0xbdac('0x113'),_0xbdac('0x111'),_0xbdac('0x114'));var _0xa80301=path[_0xbdac('0xe0')](_0x4520b1,_0x386ead);var _0x1ed563=util[_0xbdac('0xe2')]('transcript-%d-%s.zip',_0x3d4e28['params']['id'],_0x386ead);var _0x52fef2=path['join'](_0x4520b1,_0x1ed563);var _0x7e813f=[];_0x7e813f[_0xbdac('0xb6')]({'model':db['User'],'as':_0xbdac('0xe6'),'attributes':['id',_0xbdac('0x3d')],'raw':!![]});_0x7e813f['push']({'model':db['CmContact'],'as':_0xbdac('0x6f'),'attributes':['id',_0xbdac('0x115'),'lastName'],'raw':!![]});if(_0x3d4e28[_0xbdac('0x48')][_0xbdac('0x114')]){_0x7e813f['push']({'model':db[_0xbdac('0xdb')],'as':_0xbdac('0xdb'),'raw':!![]});}var _0x3cde99=[{'model':db[_0xbdac('0xcb')],'as':_0xbdac('0xe5'),'attributes':['id',_0xbdac('0x7d'),'createdAt',_0xbdac('0xf1'),'secret',_0xbdac('0x8b')],'include':_0x7e813f}];_0x3cde99[_0xbdac('0xb6')]({'model':db['ChatWebsite'],'as':_0xbdac('0x116'),'attributes':['id','name']});_0x3cde99['push']({'model':db[_0xbdac('0xe6')],'as':'Owner','attributes':['id',_0xbdac('0x3d')]});return db[_0xbdac('0x43')][_0xbdac('0x69')]({'where':{'id':_0x3d4e28[_0xbdac('0xba')]['id']},'include':_0x3cde99})[_0xbdac('0x20')](handleEntityNotFound(_0x242587,null))[_0xbdac('0x20')](function(_0x28ce74){if(_0x28ce74){var _0x3e76ee=_0x28ce74[_0xbdac('0x117')]({'plain':!![]});fs['mkdirSync'](_0xa80301);var _0x5197c2={'format':'A4','border':_0xbdac('0x118'),'header':{'height':_0xbdac('0x119'),'contents':{'first':_0xbdac('0x11a')}},'footer':{'height':_0xbdac('0x11b'),'contents':{'default':util[_0xbdac('0xe2')](_0xbdac('0x11c'),util[_0xbdac('0xe2')](_0xbdac('0x11d'),'Chat',_0x3e76ee['id']),moment()[_0xbdac('0xe2')](_0xbdac('0x11e'))[_0xbdac('0xa4')]())}}};var _0x49e9f0={'channel':'Chat','account':_0x3e76ee[_0xbdac('0x116')][_0xbdac('0x39')],'agent':_0x3e76ee[_0xbdac('0x11f')]?_0x3e76ee[_0xbdac('0x11f')]['fullname']:_0xbdac('0x120'),'createdAt':moment(_0x3e76ee['createdAt'])[_0xbdac('0xe2')](_0xbdac('0x121'))[_0xbdac('0xa4')](),'closedAt':_0x3e76ee[_0xbdac('0xd3')]?moment(_0x3e76ee[_0xbdac('0x122')])['format'](_0xbdac('0x121'))[_0xbdac('0xa4')]():'','disposition':_0x3e76ee[_0xbdac('0xd4')],'chatInfo':{'browser':_0x3e76ee[_0xbdac('0x123')],'os':_0x3e76ee[_0xbdac('0x124')],'referer':_0x3e76ee[_0xbdac('0x125')],'customerIp':_0x3e76ee[_0xbdac('0x126')],'customerPort':_0x3e76ee[_0xbdac('0x127')]?_0x3e76ee[_0xbdac('0x127')]:_0xbdac('0x120')},'messages':_(_0x3e76ee['Messages'])['tail']()[_0xbdac('0x90')]({'secret':![]})['map'](function(_0x367bea){if(_0x367bea[_0xbdac('0xdb')]){var _0x4768de=path[_0xbdac('0xe0')](_0x39a719,_0x367bea['Attachment'][_0xbdac('0xd8')]);if(fs[_0xbdac('0x128')](_0x4768de)){fs[_0xbdac('0x129')](_0x4768de)[_0xbdac('0x12a')](fs[_0xbdac('0x12b')](path['join'](_0xa80301,_0x367bea[_0xbdac('0xdb')][_0xbdac('0xd8')])));}}return{'date':moment(_0x367bea[_0xbdac('0x83')])[_0xbdac('0xe2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xbdac('0xa4')](),'sender':_0x367bea[_0xbdac('0xf1')]===_0xbdac('0xca')?_0x367bea[_0xbdac('0xe6')]?_0x367bea['User']['fullname']:_0xbdac('0xec'):_0x367bea['Contact'][_0xbdac('0x115')]+(_0x367bea['Contact'][_0xbdac('0x12c')]?'\x20'+_0x367bea[_0xbdac('0x6f')][_0xbdac('0x12c')]:''),'body':_0x367bea[_0xbdac('0xdb')]?_0x367bea['Attachment']['basename']:_0x367bea[_0xbdac('0x7d')],'direction':_0x367bea[_0xbdac('0xf1')]===_0xbdac('0xca')?'A':'C','secret':_0x367bea['secret'],'read':_0x367bea[_0xbdac('0x8b')],'attachment':_0x367bea[_0xbdac('0xdb')]};})[_0xbdac('0x6b')]()};return ejs[_0xbdac('0x12d')](path['join'](config[_0xbdac('0x110')],_0xbdac('0x113'),'views','downloadInteraction.html'),{'interaction':_0x49e9f0})[_0xbdac('0x20')](function(_0x545dc3){return new BPromise(function(_0x5e94e9,_0x15cb13){pdf['create'](_0x545dc3,_0x5197c2)['toFile'](path[_0xbdac('0xe0')](_0xa80301,_0xbdac('0x12e')+_0x3e76ee['id']+'-'+_0x386ead+'.pdf'),function(_0xba16b2,_0x42cdc1){if(_0xba16b2)return _0x15cb13(_0xba16b2);_0x5e94e9(_0x42cdc1);});});})[_0xbdac('0x20')](function(){return new BPromise(function(_0x58896c,_0x81fa91){zipdir(_0xa80301,{'saveTo':_0x52fef2},function(_0x178e75,_0x821535){if(_0x178e75)return _0x81fa91(_0x178e75);return _0x58896c(_0x821535);});})[_0xbdac('0x20')](function(){return new BPromise(function(_0x1093b0,_0x5071e5){rimraf(_0xa80301,function(_0x1d96a2){if(_0x1d96a2)_0x5071e5(_0x1d96a2);return _0x1093b0();});});})[_0xbdac('0x20')](function(){return _0x242587[_0xbdac('0xdf')](_0x52fef2,_0x1ed563,function(_0x2c58ed){if(_0x2c58ed){console[_0xbdac('0x12f')](_0xbdac('0x130'),_0x2c58ed);}else{fs[_0xbdac('0x131')](_0x52fef2);}});});});}else{return _0x242587[_0xbdac('0x37')](0xc8);}})[_0xbdac('0x2b')](handleError(_0x242587,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index f9917c4..43233c3 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 _0x299c=['Users','unreadMessages','length','emit','hook','exports','events','ChatInteraction','ChatMessage','setMaxListeners','update','remove','getUsers','setDataValue'];(function(_0x39dd97,_0x40de8a){var _0xb8b3e3=function(_0x38a5d2){while(--_0x38a5d2){_0x39dd97['push'](_0x39dd97['shift']());}};_0xb8b3e3(++_0x40de8a);}(_0x299c,0x180));var _0xc299=function(_0x2461c9,_0x186167){_0x2461c9=_0x2461c9-0x0;var _0x4d6d48=_0x299c[_0x2461c9];return _0x4d6d48;};'use strict';var EventEmitter=require(_0xc299('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xc299('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0xc299('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xc299('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc299('0x4'),'afterDestroy':_0xc299('0x5')};function emitEvent(_0x453b10){return function(_0x577391,_0x36e4e9,_0x2e4c78){_0x577391[_0xc299('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x66d9ab){_0x577391[_0xc299('0x7')](_0xc299('0x8'),_0x66d9ab['map'](function(_0x2cfa1e){return{'id':_0x2cfa1e['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x577391['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x43fa69){_0x577391[_0xc299('0x7')](_0xc299('0x9'),_0x43fa69[_0xc299('0xa')]);ChatInteractionEvents['emit'](_0x453b10+':'+_0x577391['id'],_0x577391);ChatInteractionEvents[_0xc299('0xb')](_0x453b10,_0x577391);_0x2e4c78(null);})['catch'](_0x2e4c78(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xc299('0xc')](e,emitEvent(event));}}module[_0xc299('0xd')]=ChatInteractionEvents; \ No newline at end of file +var _0x7d95=['emit','catch','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','getUsers','then','setDataValue','map','findAll','unreadMessages'];(function(_0x2f376e,_0x555d2e){var _0x34a46d=function(_0x4fada1){while(--_0x4fada1){_0x2f376e['push'](_0x2f376e['shift']());}};_0x34a46d(++_0x555d2e);}(_0x7d95,0x1ec));var _0x57d9=function(_0x60286b,_0x3247c1){_0x60286b=_0x60286b-0x0;var _0x5dff69=_0x7d95[_0x60286b];return _0x5dff69;};'use strict';var EventEmitter=require(_0x57d9('0x0'));var ChatInteraction=require(_0x57d9('0x1'))['db'][_0x57d9('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x57d9('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x57d9('0x4')](0x0);var events={'afterCreate':_0x57d9('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1c5448){return function(_0x46fdc6,_0x314a2d,_0x181c62){_0x46fdc6[_0x57d9('0x6')]({'attributes':['id'],'raw':!![]})[_0x57d9('0x7')](function(_0x54b72e){_0x46fdc6[_0x57d9('0x8')]('Users',_0x54b72e[_0x57d9('0x9')](function(_0x20a4f5){return{'id':_0x20a4f5['id']};}));return ChatMessage[_0x57d9('0xa')]({'where':{'ChatInteractionId':_0x46fdc6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x57d9('0x7')](function(_0x2c5738){_0x46fdc6[_0x57d9('0x8')](_0x57d9('0xb'),_0x2c5738['length']);ChatInteractionEvents[_0x57d9('0xc')](_0x1c5448+':'+_0x46fdc6['id'],_0x46fdc6);ChatInteractionEvents[_0x57d9('0xc')](_0x1c5448,_0x46fdc6);_0x181c62(null);})[_0x57d9('0xd')](_0x181c62(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 9a03c95..66c9486 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 _0x69d6=['closedAt','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','closed'];(function(_0x2d4bbe,_0x2ae454){var _0x284da6=function(_0x3ff962){while(--_0x3ff962){_0x2d4bbe['push'](_0x2d4bbe['shift']());}};_0x284da6(++_0x2ae454);}(_0x69d6,0x179));var _0x669d=function(_0x4ad493,_0x421d2a){_0x4ad493=_0x4ad493-0x0;var _0x45cf27=_0x69d6[_0x4ad493];return _0x45cf27;};'use strict';var _=require(_0x669d('0x0'));var util=require(_0x669d('0x1'));var logger=require(_0x669d('0x2'))(_0x669d('0x3'));var moment=require(_0x669d('0x4'));var BPromise=require('bluebird');var rp=require(_0x669d('0x5'));var fs=require('fs');var path=require(_0x669d('0x6'));var rimraf=require(_0x669d('0x7'));var config=require(_0x669d('0x8'));var attributes=require(_0x669d('0x9'));module['exports']=function(_0x447829,_0x3eeade){return _0x447829[_0x669d('0xa')](_0x669d('0xb'),attributes,{'tableName':_0x669d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b3cdc,_0x166301,_0x413fbc){if(_0x4b3cdc['changed'](_0x669d('0xd'))){_0x4b3cdc[_0x669d('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x413fbc(null,_0x4b3cdc);}},'charset':_0x669d('0xf'),'collate':_0x669d('0x10')});}; \ No newline at end of file +var _0x47ae=['util','moment','bluebird','path','rimraf','../../config/environment','exports','define','changed','closed','format','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4c10a8,_0x57c4ec){var _0xf73423=function(_0x5cd99f){while(--_0x5cd99f){_0x4c10a8['push'](_0x4c10a8['shift']());}};_0xf73423(++_0x57c4ec);}(_0x47ae,0x117));var _0xe47a=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x47ae[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0xe47a('0x0'));var util=require(_0xe47a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe47a('0x2'));var BPromise=require(_0xe47a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe47a('0x4'));var rimraf=require(_0xe47a('0x5'));var config=require(_0xe47a('0x6'));var attributes=require('./chatInteraction.attributes');module[_0xe47a('0x7')]=function(_0x18b3b3,_0x1ec6c5){return _0x18b3b3[_0xe47a('0x8')]('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x53a12a,_0x4ee5d0,_0x5e99dc){if(_0x53a12a[_0xe47a('0x9')](_0xe47a('0xa'))){_0x53a12a['closedAt']=moment()[_0xe47a('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5e99dc(null,_0x53a12a);}},'charset':_0xe47a('0xc'),'collate':_0xe47a('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index ad87da9..05daff1 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 _0xd058=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./chatInteraction.socket','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ChatInteraction','update','body','options','raw','where','UpdateChatInteraction','AddTagsToChatInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0xfbdbd1,_0x2dc9d9){var _0x3e55b7=function(_0x1c569b){while(--_0x1c569b){_0xfbdbd1['push'](_0xfbdbd1['shift']());}};_0x3e55b7(++_0x2dc9d9);}(_0xd058,0xd1));var _0x8d05=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xd058[_0x174ef5];return _0x1cc379;};'use strict';var _=require(_0x8d05('0x0'));var util=require(_0x8d05('0x1'));var moment=require(_0x8d05('0x2'));var BPromise=require(_0x8d05('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d05('0x4'));var db=require(_0x8d05('0x5'))['db'];var utils=require(_0x8d05('0x6'));var logger=require(_0x8d05('0x7'))(_0x8d05('0x8'));var config=require(_0x8d05('0x9'));var jayson=require(_0x8d05('0xa'));var client=jayson[_0x8d05('0xb')][_0x8d05('0xc')]({'port':0x232a});config['redis']=_[_0x8d05('0xd')](config[_0x8d05('0xe')],{'host':_0x8d05('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8d05('0xe')]));require(_0x8d05('0x10'))['register'](socket);function respondWithRpcPromise(_0x291428,_0x27a0e9,_0x576fb4){return new BPromise(function(_0x506efe,_0x457bc1){return client[_0x8d05('0x11')](_0x291428,_0x576fb4)[_0x8d05('0x12')](function(_0x5f11c9){logger['info'](_0x8d05('0x13'),_0x27a0e9,_0x8d05('0x14'));logger[_0x8d05('0x15')](_0x8d05('0x16'),_0x27a0e9,_0x8d05('0x14'),JSON[_0x8d05('0x17')](_0x5f11c9));if(_0x5f11c9[_0x8d05('0x18')]){if(_0x5f11c9[_0x8d05('0x18')][_0x8d05('0x19')]===0x1f4){logger[_0x8d05('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x27a0e9,_0x5f11c9[_0x8d05('0x18')][_0x8d05('0x1a')]);return _0x457bc1(_0x5f11c9[_0x8d05('0x18')][_0x8d05('0x1a')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x27a0e9,_0x5f11c9[_0x8d05('0x18')][_0x8d05('0x1a')]);return _0x506efe(_0x5f11c9['error']['message']);}else{logger[_0x8d05('0x1b')](_0x8d05('0x13'),_0x27a0e9,'request\x20sent');_0x506efe(_0x5f11c9[_0x8d05('0x1c')][_0x8d05('0x1a')]);}})[_0x8d05('0x1d')](function(_0x4ec484){logger[_0x8d05('0x18')](_0x8d05('0x13'),_0x27a0e9,_0x4ec484);_0x457bc1(_0x4ec484);});});}exports['UpdateChatInteraction']=function(_0x6ed6d1){var _0x156f62=this;return new Promise(function(_0x30eb23,_0x5903f9){return db[_0x8d05('0x1e')][_0x8d05('0x1f')](_0x6ed6d1[_0x8d05('0x20')],{'raw':_0x6ed6d1[_0x8d05('0x21')]?_0x6ed6d1[_0x8d05('0x21')][_0x8d05('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6ed6d1['options']?_0x6ed6d1['options'][_0x8d05('0x23')]||null:null,'attributes':_0x6ed6d1[_0x8d05('0x21')]?_0x6ed6d1[_0x8d05('0x21')]['attributes']||null:null,'limit':_0x6ed6d1[_0x8d05('0x21')]?_0x6ed6d1[_0x8d05('0x21')]['limit']||null:null})[_0x8d05('0x12')](function(_0x435532){logger[_0x8d05('0x1b')](_0x8d05('0x24'),_0x6ed6d1);logger['debug'](_0x8d05('0x24'),_0x6ed6d1,JSON[_0x8d05('0x17')](_0x435532));_0x30eb23(_0x435532);})['catch'](function(_0x1c3724){logger[_0x8d05('0x18')](_0x8d05('0x24'),_0x1c3724[_0x8d05('0x1a')],_0x6ed6d1);_0x5903f9(_0x156f62[_0x8d05('0x18')](0x1f4,_0x1c3724['message']));});});};exports[_0x8d05('0x25')]=function(_0xcfecf4){return new Promise(function(_0x3c588d,_0x1caec8){return db[_0x8d05('0x1e')][_0x8d05('0x26')]({'where':_0xcfecf4[_0x8d05('0x21')]?_0xcfecf4['options'][_0x8d05('0x23')]||null:null})[_0x8d05('0x12')](function(_0x2bc0d1){if(_0x2bc0d1){return _0x2bc0d1[_0x8d05('0x27')](_0xcfecf4[_0x8d05('0x20')][_0x8d05('0x28')],_['omit'](_0xcfecf4['body'],['ids','id'])||{});}})[_0x8d05('0x29')](function(_0x2b5e60){logger[_0x8d05('0x1b')](_0x8d05('0x2a'),_0xcfecf4);logger[_0x8d05('0x15')](_0x8d05('0x2a'),_0xcfecf4,JSON[_0x8d05('0x17')](_0x2b5e60));_0x3c588d(_0x2b5e60);})[_0x8d05('0x1d')](function(_0x5c6f25){logger[_0x8d05('0x18')](_0x8d05('0x2a'),_0x5c6f25[_0x8d05('0x1a')],_0xcfecf4);_0x1caec8(_this['error'](0x1f4,_0x5c6f25[_0x8d05('0x1a')]));});});}; \ No newline at end of file +var _0xc723=['limit','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc723,0x16f));var _0x3c72=function(_0x3bf3f1,_0x5b8238){_0x3bf3f1=_0x3bf3f1-0x0;var _0x5a0c0c=_0xc723[_0x3bf3f1];return _0x5a0c0c;};'use strict';var _=require(_0x3c72('0x0'));var util=require(_0x3c72('0x1'));var moment=require(_0x3c72('0x2'));var BPromise=require(_0x3c72('0x3'));var rs=require(_0x3c72('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c72('0x5'))['db'];var utils=require(_0x3c72('0x6'));var logger=require('../../config/logger')(_0x3c72('0x7'));var config=require('../../config/environment');var jayson=require(_0x3c72('0x8'));var client=jayson[_0x3c72('0x9')]['http']({'port':0x232a});config[_0x3c72('0xa')]=_[_0x3c72('0xb')](config[_0x3c72('0xa')],{'host':_0x3c72('0xc'),'port':0x18eb});var socket=require(_0x3c72('0xd'))(new Redis(config[_0x3c72('0xa')]));require(_0x3c72('0xe'))['register'](socket);function respondWithRpcPromise(_0x4ba720,_0x115824,_0x1931c5){return new BPromise(function(_0x32af51,_0x14187c){return client[_0x3c72('0xf')](_0x4ba720,_0x1931c5)[_0x3c72('0x10')](function(_0x2beca4){logger[_0x3c72('0x11')](_0x3c72('0x12'),_0x115824,_0x3c72('0x13'));logger[_0x3c72('0x14')](_0x3c72('0x15'),_0x115824,_0x3c72('0x13'),JSON[_0x3c72('0x16')](_0x2beca4));if(_0x2beca4[_0x3c72('0x17')]){if(_0x2beca4[_0x3c72('0x17')]['code']===0x1f4){logger[_0x3c72('0x17')](_0x3c72('0x12'),_0x115824,_0x2beca4[_0x3c72('0x17')][_0x3c72('0x18')]);return _0x14187c(_0x2beca4[_0x3c72('0x17')][_0x3c72('0x18')]);}logger[_0x3c72('0x17')](_0x3c72('0x12'),_0x115824,_0x2beca4[_0x3c72('0x17')]['message']);return _0x32af51(_0x2beca4[_0x3c72('0x17')]['message']);}else{logger[_0x3c72('0x11')](_0x3c72('0x12'),_0x115824,_0x3c72('0x13'));_0x32af51(_0x2beca4['result'][_0x3c72('0x18')]);}})[_0x3c72('0x19')](function(_0x377ff1){logger[_0x3c72('0x17')](_0x3c72('0x12'),_0x115824,_0x377ff1);_0x14187c(_0x377ff1);});});}exports[_0x3c72('0x1a')]=function(_0xfdcad4){var _0x223ff9=this;return new Promise(function(_0x4512d6,_0x33c0d3){return db[_0x3c72('0x1b')][_0x3c72('0x1c')](_0xfdcad4[_0x3c72('0x1d')],{'raw':_0xfdcad4[_0x3c72('0x1e')]?_0xfdcad4['options'][_0x3c72('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfdcad4[_0x3c72('0x1e')]?_0xfdcad4['options'][_0x3c72('0x20')]||null:null,'attributes':_0xfdcad4[_0x3c72('0x1e')]?_0xfdcad4[_0x3c72('0x1e')]['attributes']||null:null,'limit':_0xfdcad4['options']?_0xfdcad4[_0x3c72('0x1e')][_0x3c72('0x21')]||null:null})['then'](function(_0x4d4dca){logger[_0x3c72('0x11')]('UpdateChatInteraction',_0xfdcad4);logger[_0x3c72('0x14')](_0x3c72('0x1a'),_0xfdcad4,JSON[_0x3c72('0x16')](_0x4d4dca));_0x4512d6(_0x4d4dca);})[_0x3c72('0x19')](function(_0x2f5b79){logger[_0x3c72('0x17')]('UpdateChatInteraction',_0x2f5b79['message'],_0xfdcad4);_0x33c0d3(_0x223ff9['error'](0x1f4,_0x2f5b79[_0x3c72('0x18')]));});});};exports['AddTagsToChatInteraction']=function(_0x3a7aac){return new Promise(function(_0x13be0b,_0x47aff4){return db[_0x3c72('0x1b')][_0x3c72('0x22')]({'where':_0x3a7aac[_0x3c72('0x1e')]?_0x3a7aac['options'][_0x3c72('0x20')]||null:null})[_0x3c72('0x10')](function(_0x34ae10){if(_0x34ae10){return _0x34ae10[_0x3c72('0x23')](_0x3a7aac[_0x3c72('0x1d')][_0x3c72('0x24')],_[_0x3c72('0x25')](_0x3a7aac['body'],[_0x3c72('0x24'),'id'])||{});}})[_0x3c72('0x26')](function(_0x572b20){logger[_0x3c72('0x11')](_0x3c72('0x27'),_0x3a7aac);logger['debug'](_0x3c72('0x27'),_0x3a7aac,JSON[_0x3c72('0x16')](_0x572b20));_0x13be0b(_0x572b20);})[_0x3c72('0x19')](function(_0x5749db){logger['error'](_0x3c72('0x27'),_0x5749db[_0x3c72('0x18')],_0x3a7aac);_0x47aff4(_this[_0x3c72('0x17')](0x1f4,_0x5749db[_0x3c72('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 3a84e5e..8f035a8 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 _0xbb2c=['emit','removeListener','length','save','remove','update'];(function(_0x11175c,_0x551b83){var _0x4ae4c2=function(_0x142ca7){while(--_0x142ca7){_0x11175c['push'](_0x11175c['shift']());}};_0x4ae4c2(++_0x551b83);}(_0xbb2c,0xb1));var _0xcbb2=function(_0x4efa24,_0x7d2092){_0x4efa24=_0x4efa24-0x0;var _0x12ea37=_0xbb2c[_0x4efa24];return _0x12ea37;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xcbb2('0x0'),_0xcbb2('0x1'),_0xcbb2('0x2')];function createListener(_0x425aa2,_0x144dde){return function(_0x5b4546){_0x144dde[_0xcbb2('0x3')](_0x425aa2,_0x5b4546);};}function removeListener(_0x5e1875,_0x432f41){return function(){ChatInteractionEvents[_0xcbb2('0x4')](_0x5e1875,_0x432f41);};}exports['register']=function(_0x5783ca){for(var _0x420612=0x0,_0x509f9a=events[_0xcbb2('0x5')];_0x420612<_0x509f9a;_0x420612++){var _0x3bdce7=events[_0x420612];var _0x12357a=createListener('chatInteraction:'+_0x3bdce7,_0x5783ca);ChatInteractionEvents['on'](_0x3bdce7,_0x12357a);}}; \ No newline at end of file +var _0x5ff6=['length','./chatInteraction.events','remove','update','removeListener','register'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5ff6,0x15d));var _0x65ff=function(_0x2cd559,_0x5da3bd){_0x2cd559=_0x2cd559-0x0;var _0x1d5f80=_0x5ff6[_0x2cd559];return _0x1d5f80;};'use strict';var ChatInteractionEvents=require(_0x65ff('0x0'));var events=['save',_0x65ff('0x1'),_0x65ff('0x2')];function createListener(_0x47cb78,_0x2e0e15){return function(_0x145726){_0x2e0e15['emit'](_0x47cb78,_0x145726);};}function removeListener(_0x4e347a,_0x2c2812){return function(){ChatInteractionEvents[_0x65ff('0x3')](_0x4e347a,_0x2c2812);};}exports[_0x65ff('0x4')]=function(_0x5eb14e){for(var _0x4540aa=0x0,_0x591089=events[_0x65ff('0x5')];_0x4540aa<_0x591089;_0x4540aa++){var _0x1ee6b4=events[_0x4540aa];var _0x1d3e98=createListener('chatInteraction:'+_0x1ee6b4,_0x5eb14e);ChatInteractionEvents['on'](_0x1ee6b4,_0x1d3e98);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 0814318..526732f 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 _0xa94c=['chatinteraction:update','update','/:id/custom_update','customUpdate','put','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','/describe','isAuthenticated','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','/:id/messages','/:id/tags','chat','chatinteraction:addtags','addTags'];(function(_0x313434,_0x2631b2){var _0x275a0c=function(_0x55d4b4){while(--_0x55d4b4){_0x313434['push'](_0x313434['shift']());}};_0x275a0c(++_0x2631b2);}(_0xa94c,0x1bb));var _0xca94=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xa94c[_0x580576];return _0x3f55a0;};'use strict';var multer=require(_0xca94('0x0'));var util=require('util');var path=require(_0xca94('0x1'));var timeout=require(_0xca94('0x2'));var express=require(_0xca94('0x3'));var router=express['Router']();var auth=require(_0xca94('0x4'));var interaction=require(_0xca94('0x5'));var config=require(_0xca94('0x6'));var controller=require(_0xca94('0x7'));router[_0xca94('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xca94('0x8')](_0xca94('0x9'),auth[_0xca94('0xa')](),controller['describe']);router[_0xca94('0x8')](_0xca94('0xb'),auth[_0xca94('0xc')](),controller['show']);router[_0xca94('0x8')](_0xca94('0xd'),auth[_0xca94('0xc')](),controller[_0xca94('0xe')]);router[_0xca94('0x8')]('/:id/messages',auth[_0xca94('0xa')](),controller['getMessages']);router['get'](_0xca94('0xf'),auth['isChatInteractionAuthorized'](),controller[_0xca94('0x10')]);router[_0xca94('0x8')](_0xca94('0x11'),auth['isAuthenticated'](),controller[_0xca94('0x12')]);router['post']('/',auth[_0xca94('0xa')](),controller[_0xca94('0x13')]);router[_0xca94('0x14')](_0xca94('0x15'),auth[_0xca94('0xa')](),controller[_0xca94('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4ffa11,_0x2da0a5,_0x561d01){_0x561d01(null,path[_0xca94('0x17')](config[_0xca94('0x18')],_0xca94('0x19')));},'filename':function(_0x2272f5,_0x12f834,_0x33b7ce){_0x33b7ce(null,util[_0xca94('0x1a')](_0xca94('0x1b'),Date[_0xca94('0x1c')](),_0x12f834[_0xca94('0x1d')][_0xca94('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xca94('0x14')](_0xca94('0x1f'),upload['single']('file'),controller['attachmentUpload']);router[_0xca94('0x14')](_0xca94('0x20'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0xca94('0x14')](_0xca94('0x21'),auth[_0xca94('0xa')](),interaction['tracked'](_0xca94('0x22'),_0xca94('0x23')),controller[_0xca94('0x24')]);router['put'](_0xca94('0xb'),auth[_0xca94('0xa')](),interaction['tracked']('chat',_0xca94('0x25')),controller[_0xca94('0x26')]);router['put'](_0xca94('0x27'),controller[_0xca94('0x28')]);router[_0xca94('0x29')]('/:id/abandon',auth[_0xca94('0xc')](),controller['abandon']);router['put'](_0xca94('0x2a'),controller['close']);router[_0xca94('0x2b')](_0xca94('0xb'),auth['isAuthenticated'](),interaction['tracked']('chat',_0xca94('0x2c')),controller[_0xca94('0x2d')]);router['delete'](_0xca94('0x21'),auth['isAuthenticated'](),controller[_0xca94('0x2e')]);module[_0xca94('0x2f')]=router; \ No newline at end of file +var _0xef1e=['addTags','put','update','/:id/custom_update','/:id/abandon','abandon','/:id/close','close','delete','destroy','removeTags','exports','multer','util','express','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat'];(function(_0xc42e34,_0x30d16b){var _0x5e65ef=function(_0x3b22c5){while(--_0x3b22c5){_0xc42e34['push'](_0xc42e34['shift']());}};_0x5e65ef(++_0x30d16b);}(_0xef1e,0x10b));var _0xeef1=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xef1e[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xeef1('0x0'));var util=require(_0xeef1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xeef1('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xeef1('0x3'));var config=require(_0xeef1('0x4'));var controller=require(_0xeef1('0x5'));router[_0xeef1('0x6')]('/',auth['isAuthenticated'](),controller[_0xeef1('0x7')]);router['get'](_0xeef1('0x8'),auth[_0xeef1('0x9')](),controller[_0xeef1('0xa')]);router['get'](_0xeef1('0xb'),auth[_0xeef1('0xc')](),controller['show']);router[_0xeef1('0x6')](_0xeef1('0xd'),auth[_0xeef1('0xc')](),controller[_0xeef1('0xe')]);router['get'](_0xeef1('0xf'),auth[_0xeef1('0x9')](),controller[_0xeef1('0x10')]);router[_0xeef1('0x6')](_0xeef1('0x11'),auth['isChatInteractionAuthorized'](),controller[_0xeef1('0x12')]);router[_0xeef1('0x6')](_0xeef1('0x13'),auth[_0xeef1('0x9')](),controller[_0xeef1('0x14')]);router[_0xeef1('0x15')]('/',auth['isAuthenticated'](),controller[_0xeef1('0x16')]);router[_0xeef1('0x15')](_0xeef1('0x17'),auth[_0xeef1('0x9')](),controller[_0xeef1('0x18')]);var upload=multer({'storage':multer[_0xeef1('0x19')]({'destination':function(_0x331fab,_0x5f2e9e,_0xbc15a2){_0xbc15a2(null,path['join'](config['root'],_0xeef1('0x1a')));},'filename':function(_0x4a4983,_0x286b8e,_0x3ddea3){_0x3ddea3(null,util[_0xeef1('0x1b')]('%s-%s',Date[_0xeef1('0x1c')](),_0x286b8e[_0xeef1('0x1d')][_0xeef1('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xeef1('0x15')](_0xeef1('0x1f'),upload[_0xeef1('0x20')](_0xeef1('0x21')),controller[_0xeef1('0x22')]);router[_0xeef1('0x15')](_0xeef1('0xf'),auth[_0xeef1('0xc')](),controller[_0xeef1('0x23')]);router[_0xeef1('0x15')](_0xeef1('0x24'),auth[_0xeef1('0x9')](),interaction[_0xeef1('0x25')](_0xeef1('0x26'),'chatinteraction:addtags'),controller[_0xeef1('0x27')]);router[_0xeef1('0x28')](_0xeef1('0xb'),auth[_0xeef1('0x9')](),interaction[_0xeef1('0x25')](_0xeef1('0x26'),'chatinteraction:update'),controller[_0xeef1('0x29')]);router['put'](_0xeef1('0x2a'),controller['customUpdate']);router[_0xeef1('0x28')](_0xeef1('0x2b'),auth['isChatInteractionAuthorized'](),controller[_0xeef1('0x2c')]);router[_0xeef1('0x28')](_0xeef1('0x2d'),controller[_0xeef1('0x2e')]);router[_0xeef1('0x2f')]('/:id',auth[_0xeef1('0x9')](),interaction[_0xeef1('0x25')](_0xeef1('0x26'),'chatinteraction:destroy'),controller[_0xeef1('0x30')]);router[_0xeef1('0x2f')](_0xeef1('0x24'),auth[_0xeef1('0x9')](),controller[_0xeef1('0x31')]);module[_0xeef1('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index e70b194..f3b7c92 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 _0xdb28=['medium','INTEGER','sequelize','exports','TEXT'];(function(_0x31299b,_0x28a431){var _0x1f661e=function(_0x1cb742){while(--_0x1cb742){_0x31299b['push'](_0x31299b['shift']());}};_0x1f661e(++_0x28a431);}(_0xdb28,0x106));var _0x8db2=function(_0x1eb0ba,_0x54affb){_0x1eb0ba=_0x1eb0ba-0x0;var _0x173c1b=_0xdb28[_0x1eb0ba];return _0x173c1b;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8db2('0x4')]}}; \ No newline at end of file +var _0x2ef3=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x75b343,_0x5e3960){var _0x469faf=function(_0x3109fe){while(--_0x3109fe){_0x75b343['push'](_0x75b343['shift']());}};_0x469faf(++_0x5e3960);}(_0x2ef3,0xba));var _0x32ef=function(_0x5e8ba1,_0x3a8d18){_0x5e8ba1=_0x5e8ba1-0x0;var _0x214e2d=_0x2ef3[_0x5e8ba1];return _0x214e2d;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'body':{'type':Sequelize[_0x32ef('0x2')](_0x32ef('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x32ef('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x32ef('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 592cf1b..6b64cbc 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 _0x84b9=['filter','merge','VIRTUAL','options','includeAll','include','ChatInternalMessage','findAll','rows','catch','params','find','create','body','describe','createdAt','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','User','agent','admin','user','role','userpic','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','messages','ToId','read','all','html-pdf','fast-json-patch','bluebird','mustache','sox','ejs','crypto','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x20a345,_0x183acf){var _0x2a374b=function(_0x1ccb24){while(--_0x1ccb24){_0x20a345['push'](_0x20a345['shift']());}};_0x2a374b(++_0x183acf);}(_0x84b9,0x1b4));var _0x984b=function(_0x2ecb67,_0x8ec62d){_0x2ecb67=_0x2ecb67-0x0;var _0x168079=_0x84b9[_0x2ecb67];return _0x168079;};'use strict';var pdf=require(_0x984b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x984b('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x984b('0x2'));var Mustache=require(_0x984b('0x3'));var util=require('util');var path=require('path');var sox=require(_0x984b('0x4'));var csv=require('to-csv');var ejs=require(_0x984b('0x5'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x984b('0x6'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x984b('0x7'));var querystring=require(_0x984b('0x8'));var Papa=require(_0x984b('0x9'));var Redis=require(_0x984b('0xa'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x984b('0xb'));var logger=require('../../config/logger')(_0x984b('0xc'));var utils=require('../../config/utils');var config=require(_0x984b('0xd'));var licenseUtil=require('../../config/license/util');var db=require(_0x984b('0xe'))['db'];config[_0x984b('0xf')]=_[_0x984b('0x10')](config[_0x984b('0xf')],{'host':_0x984b('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x984b('0xf')]));require(_0x984b('0x12'))['register'](socket);function respondWithStatusCode(_0x3f18a1,_0x2570b8){_0x2570b8=_0x2570b8||0xcc;return function(_0x5da6fa){if(_0x5da6fa){return _0x3f18a1[_0x984b('0x13')](_0x2570b8);}return _0x3f18a1[_0x984b('0x14')](_0x2570b8)[_0x984b('0x15')]();};}function respondWithResult(_0x2f78bb,_0x2b3740){_0x2b3740=_0x2b3740||0xc8;return function(_0x9acf93){if(_0x9acf93){return _0x2f78bb[_0x984b('0x14')](_0x2b3740)[_0x984b('0x16')](_0x9acf93);}};}function respondWithFilteredResult(_0x4378e2,_0x14b507){return function(_0x911a63){if(_0x911a63){var _0x271de7=_0x911a63[_0x984b('0x17')],_0x290a7e=_0x14b507[_0x984b('0x18')],_0x1a4572=_0x14b507[_0x984b('0x18')]+_0x14b507[_0x984b('0x19')],_0x2cc91a;if(_0x1a4572>=_0x271de7){_0x1a4572=_0x271de7;_0x2cc91a=0xc8;}else{_0x2cc91a=0xce;}_0x4378e2[_0x984b('0x14')](_0x2cc91a);return _0x4378e2['set'](_0x984b('0x1a'),_0x290a7e+'-'+_0x1a4572+'/'+_0x271de7)[_0x984b('0x16')](_0x911a63);}return null;};}function patchUpdates(_0x729319){return function(_0x12c7e0){try{jsonpatch[_0x984b('0x1b')](_0x12c7e0,_0x729319,!![]);}catch(_0x2dc250){return BPromise[_0x984b('0x1c')](_0x2dc250);}return _0x12c7e0[_0x984b('0x1d')]();};}function saveUpdates(_0x144fde,_0x3183e9){return function(_0x596611){if(_0x596611){return _0x596611[_0x984b('0x1e')](_0x144fde)[_0x984b('0x1f')](function(_0x8612ea){return _0x8612ea;});}return null;};}function removeEntity(_0x5cebd6,_0x1745c5){return function(_0x583617){if(_0x583617){return _0x583617[_0x984b('0x20')]()[_0x984b('0x1f')](function(){_0x5cebd6[_0x984b('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0xafa2eb,_0x495481){return function(_0xccad3f){if(!_0xccad3f){_0xafa2eb[_0x984b('0x13')](0x194);}return _0xccad3f;};}function handleError(_0x48635d,_0x86150d){_0x86150d=_0x86150d||0x1f4;return function(_0x1adadd){logger['error'](_0x1adadd[_0x984b('0x21')]);if(_0x1adadd[_0x984b('0x22')]){delete _0x1adadd[_0x984b('0x22')];}_0x48635d[_0x984b('0x14')](_0x86150d)[_0x984b('0x23')](_0x1adadd);};}exports['index']=function(_0x4a84bd,_0x2ff714){var _0x3dfc2a={},_0x5b97a9={},_0x1711ec={'count':0x0,'rows':[]};var _0x108abc=_[_0x984b('0x24')](db['ChatInternalMessage'][_0x984b('0x25')],function(_0x3e8d53){return{'name':_0x3e8d53[_0x984b('0x26')],'type':_0x3e8d53[_0x984b('0x27')]['key']};});_0x5b97a9[_0x984b('0x28')]=_['map'](_0x108abc,_0x984b('0x22'));_0x5b97a9[_0x984b('0x29')]=_[_0x984b('0x2a')](_0x4a84bd[_0x984b('0x29')]);_0x5b97a9[_0x984b('0x2b')]=_[_0x984b('0x2c')](_0x5b97a9['model'],_0x5b97a9[_0x984b('0x29')]);_0x3dfc2a[_0x984b('0x2d')]=_[_0x984b('0x2c')](_0x5b97a9['model'],qs['fields'](_0x4a84bd['query'][_0x984b('0x2e')]));_0x3dfc2a[_0x984b('0x2d')]=_0x3dfc2a['attributes'][_0x984b('0x2f')]?_0x3dfc2a[_0x984b('0x2d')]:_0x5b97a9[_0x984b('0x28')];if(!_0x4a84bd['query'][_0x984b('0x30')](_0x984b('0x31'))){_0x3dfc2a[_0x984b('0x19')]=qs[_0x984b('0x19')](_0x4a84bd[_0x984b('0x29')][_0x984b('0x19')]);_0x3dfc2a[_0x984b('0x18')]=qs[_0x984b('0x18')](_0x4a84bd[_0x984b('0x29')][_0x984b('0x18')]);}_0x3dfc2a[_0x984b('0x32')]=qs[_0x984b('0x33')](_0x4a84bd[_0x984b('0x29')][_0x984b('0x33')]);_0x3dfc2a[_0x984b('0x34')]=qs[_0x984b('0x2b')](_[_0x984b('0x35')](_0x4a84bd['query'],_0x5b97a9['filters']),_0x108abc);if(_0x4a84bd[_0x984b('0x29')][_0x984b('0x36')]){_0x3dfc2a[_0x984b('0x34')]=_[_0x984b('0x37')](_0x3dfc2a[_0x984b('0x34')],{'$or':_['map'](_0x108abc,function(_0x315bb6){if(_0x315bb6[_0x984b('0x27')]!==_0x984b('0x38')){var _0x29f344={};_0x29f344[_0x315bb6[_0x984b('0x22')]]={'$like':'%'+_0x4a84bd['query'][_0x984b('0x36')]+'%'};return _0x29f344;}})});}_0x3dfc2a=_['merge']({},_0x3dfc2a,_0x4a84bd[_0x984b('0x39')]);var _0x448bec={'where':_0x3dfc2a[_0x984b('0x34')]};return db['ChatInternalMessage'][_0x984b('0x17')](_0x448bec)['then'](function(_0x16a96c){_0x1711ec[_0x984b('0x17')]=_0x16a96c;if(_0x4a84bd['query'][_0x984b('0x3a')]){_0x3dfc2a[_0x984b('0x3b')]=[{'all':!![]}];}return db[_0x984b('0x3c')][_0x984b('0x3d')](_0x3dfc2a);})['then'](function(_0x4f3021){_0x1711ec[_0x984b('0x3e')]=_0x4f3021;return _0x1711ec;})[_0x984b('0x1f')](respondWithFilteredResult(_0x2ff714,_0x3dfc2a))[_0x984b('0x3f')](handleError(_0x2ff714,null));};exports['show']=function(_0x211e25,_0x10cc39){var _0x20b13a={'raw':!![],'where':{'id':_0x211e25[_0x984b('0x40')]['id']}},_0x20c456={};_0x20c456['model']=_[_0x984b('0x2a')](db[_0x984b('0x3c')][_0x984b('0x25')]);_0x20c456[_0x984b('0x29')]=_[_0x984b('0x2a')](_0x211e25[_0x984b('0x29')]);_0x20c456[_0x984b('0x2b')]=_['intersection'](_0x20c456[_0x984b('0x28')],_0x20c456[_0x984b('0x29')]);_0x20b13a[_0x984b('0x2d')]=_[_0x984b('0x2c')](_0x20c456['model'],qs[_0x984b('0x2e')](_0x211e25[_0x984b('0x29')][_0x984b('0x2e')]));_0x20b13a[_0x984b('0x2d')]=_0x20b13a['attributes'][_0x984b('0x2f')]?_0x20b13a[_0x984b('0x2d')]:_0x20c456[_0x984b('0x28')];if(_0x211e25['query'][_0x984b('0x3a')]){_0x20b13a[_0x984b('0x3b')]=[{'all':!![]}];}_0x20b13a=_[_0x984b('0x37')]({},_0x20b13a,_0x211e25['options']);return db[_0x984b('0x3c')][_0x984b('0x41')](_0x20b13a)['then'](handleEntityNotFound(_0x10cc39,null))['then'](respondWithResult(_0x10cc39,null))['catch'](handleError(_0x10cc39,null));};exports[_0x984b('0x42')]=function(_0x3db223,_0x5b1814){return db[_0x984b('0x3c')][_0x984b('0x42')](_0x3db223[_0x984b('0x43')],{})['then'](respondWithResult(_0x5b1814,0xc9))['catch'](handleError(_0x5b1814,null));};exports['update']=function(_0x504b7a,_0x2e59f3){if(_0x504b7a[_0x984b('0x43')]['id']){delete _0x504b7a['body']['id'];}return db[_0x984b('0x3c')][_0x984b('0x41')]({'where':{'id':_0x504b7a[_0x984b('0x40')]['id']}})[_0x984b('0x1f')](handleEntityNotFound(_0x2e59f3,null))[_0x984b('0x1f')](saveUpdates(_0x504b7a[_0x984b('0x43')],null))[_0x984b('0x1f')](respondWithResult(_0x2e59f3,null))['catch'](handleError(_0x2e59f3,null));};exports[_0x984b('0x20')]=function(_0x551e1e,_0x1ec0e5){return db['ChatInternalMessage'][_0x984b('0x41')]({'where':{'id':_0x551e1e[_0x984b('0x40')]['id']}})[_0x984b('0x1f')](handleEntityNotFound(_0x1ec0e5,null))[_0x984b('0x1f')](removeEntity(_0x1ec0e5,null))[_0x984b('0x3f')](handleError(_0x1ec0e5,null));};exports[_0x984b('0x44')]=function(_0x27b8a9,_0x2aa7f1){return db[_0x984b('0x3c')]['describe']()[_0x984b('0x1f')](respondWithResult(_0x2aa7f1,null))[_0x984b('0x3f')](handleError(_0x2aa7f1,null));};function wrapUser(_0x588411){return function(_0xd564ac){var _0x1cf6d3=_0x588411['get']({'plain':!![]});_0x1cf6d3['messages']=[];if(_0xd564ac){_0x1cf6d3['lastMessageAt']=_0xd564ac[_0x984b('0x45')];_0x1cf6d3['lastMessage']=_0xd564ac;}else{_0x1cf6d3[_0x984b('0x46')]=moment(0x0)[_0x984b('0x47')](_0x984b('0x48'));_0x1cf6d3[_0x984b('0x49')]={};}return _0x1cf6d3;};}exports['getUsers']=function(_0x57f1c5,_0x407ddd,_0x5504fe){var _0x1508c3=[];return db[_0x984b('0x4a')][_0x984b('0x3d')]({'where':{'role':[_0x984b('0x4b'),_0x984b('0x4c'),_0x984b('0x4d')]},'attributes':['id','fullname',_0x984b('0x22'),_0x984b('0x4e'),_0x984b('0x4f'),'internal','online',_0x984b('0x50'),'allowmessenger',_0x984b('0x51')],'order':qs[_0x984b('0x33')](_0x984b('0x52')),'include':[{'model':db[_0x984b('0x53')],'as':_0x984b('0x54'),'attributes':['id','name',_0x984b('0x27')],'through':{'attributes':[]}}]})[_0x984b('0x1f')](function(_0xd8b869){if(_0xd8b869){var _0x14f0e8=_0x57f1c5['user'][_0x984b('0x55')]({'plain':!![]});if(!_0x14f0e8)throw new Error(_0x984b('0x56'));if(_0x14f0e8[_0x984b('0x4e')]===_0x984b('0x4d')){return db['UserProfileSection'][_0x984b('0x41')]({'where':{'name':_0x984b('0x57'),'userProfileId':_0x14f0e8[_0x984b('0x58')]},'raw':!![]})[_0x984b('0x1f')](function(_0x4fc167){if(_0x4fc167){if(_0x4fc167[_0x984b('0x59')]===0x0){return db[_0x984b('0x5a')]['findAll']({'where':{'sectionId':_0x4fc167['id']},'raw':!![]})[_0x984b('0x1f')](function(_0x199f49){var _0x736ca3=[];if(_[_0x984b('0x5b')](_0x199f49)){_0x736ca3=_[_0x984b('0x36')](_0xd8b869,function(_0x217ac1){if(_0x217ac1['role']!==_0x984b('0x4b')){return _0x217ac1;}});return _0x736ca3;}else{for(var _0x1fb317=0x0;_0x1fb317<_0xd8b869[_0x984b('0x2f')];_0x1fb317++){var _0x251962=_0xd8b869[_0x1fb317];if(_0x251962[_0x984b('0x4e')]==='agent'){var _0x50fe1c=_[_0x984b('0x41')](_0x199f49,function(_0xd7db1d){return _0xd7db1d[_0x984b('0x5c')]===_0x251962['id'];});if(_0x50fe1c)_0x736ca3['push'](_0x251962);}else{_0x736ca3[_0x984b('0x5d')](_0x251962);}}return _0x736ca3;}});}else{return _0xd8b869;}}else{var _0x1e2cef=_[_0x984b('0x36')](_0xd8b869,function(_0x12a2d7){if(_0x12a2d7[_0x984b('0x4e')]!==_0x984b('0x4b')){return _0x12a2d7;}});return _0x1e2cef;}});}else{return _0xd8b869;}}})[_0x984b('0x1f')](function(_0x59f67a){var _0x1eb58b=[];if(_0x59f67a){_0x1508c3=_0x59f67a;for(var _0x5f0a35=0x0;_0x5f0a35<_0x59f67a['length'];_0x5f0a35+=0x1){_0x1508c3[_0x5f0a35][_0x984b('0x5e')]=[];_0x1eb58b['push'](db['ChatInternalMessage'][_0x984b('0x41')]({'where':{'FromId':[_0x57f1c5['user']['id'],_0x59f67a[_0x5f0a35]['id']],'ToId':[_0x57f1c5[_0x984b('0x4d')]['id'],_0x59f67a[_0x5f0a35]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0x984b('0x5f'),_0x984b('0x60'),_0x984b('0x43')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x59f67a[_0x5f0a35])));}return BPromise[_0x984b('0x61')](_0x1eb58b);}return[];})[_0x984b('0x1f')](function(_0x37a907){return{'rows':_0x37a907,'count':_0x37a907[_0x984b('0x2f')]};})[_0x984b('0x1f')](respondWithResult(_0x407ddd,null))[_0x984b('0x3f')](handleError(_0x407ddd,null));}; \ No newline at end of file +var _0x65c4=['FromId','ToId','read','-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','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','redis','localhost','socket.io-emitter','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','catch','show','length','include','create','body','find','params','describe','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','messages'];(function(_0x531d15,_0x599af5){var _0x271a18=function(_0x31284d){while(--_0x31284d){_0x531d15['push'](_0x531d15['shift']());}};_0x271a18(++_0x599af5);}(_0x65c4,0x1d1));var _0x465c=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x65c4[_0x411add];return _0x238242;};'use strict';var pdf=require(_0x465c('0x0'));var emlformat=require(_0x465c('0x1'));var rimraf=require(_0x465c('0x2'));var zipdir=require(_0x465c('0x3'));var jsonpatch=require(_0x465c('0x4'));var rp=require(_0x465c('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x465c('0x6'));var util=require(_0x465c('0x7'));var path=require(_0x465c('0x8'));var sox=require(_0x465c('0x9'));var csv=require(_0x465c('0xa'));var ejs=require(_0x465c('0xb'));var fs=require('fs');var _=require(_0x465c('0xc'));var squel=require('squel');var crypto=require(_0x465c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x465c('0xe'));var toCsv=require(_0x465c('0xa'));var querystring=require('querystring');var Papa=require(_0x465c('0xf'));var Redis=require(_0x465c('0x10'));var authService=require(_0x465c('0x11'));var qs=require(_0x465c('0x12'));var as=require(_0x465c('0x13'));var hardwareService=require(_0x465c('0x14'));var logger=require(_0x465c('0x15'))(_0x465c('0x16'));var utils=require(_0x465c('0x17'));var config=require(_0x465c('0x18'));var licenseUtil=require(_0x465c('0x19'));var db=require(_0x465c('0x1a'))['db'];config['redis']=_['defaults'](config[_0x465c('0x1b')],{'host':_0x465c('0x1c'),'port':0x18eb});var socket=require(_0x465c('0x1d'))(new Redis(config[_0x465c('0x1b')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x31c188,_0xd940c1){_0xd940c1=_0xd940c1||0xcc;return function(_0x3d3986){if(_0x3d3986){return _0x31c188[_0x465c('0x1e')](_0xd940c1);}return _0x31c188['status'](_0xd940c1)[_0x465c('0x1f')]();};}function respondWithResult(_0x1852bd,_0x4874b0){_0x4874b0=_0x4874b0||0xc8;return function(_0x5a8411){if(_0x5a8411){return _0x1852bd[_0x465c('0x20')](_0x4874b0)[_0x465c('0x21')](_0x5a8411);}};}function respondWithFilteredResult(_0x2480cf,_0x96ba43){return function(_0x48aafd){if(_0x48aafd){var _0x5df0dd=_0x48aafd[_0x465c('0x22')],_0x3f9e15=_0x96ba43[_0x465c('0x23')],_0x53089e=_0x96ba43[_0x465c('0x23')]+_0x96ba43[_0x465c('0x24')],_0x1dfcbe;if(_0x53089e>=_0x5df0dd){_0x53089e=_0x5df0dd;_0x1dfcbe=0xc8;}else{_0x1dfcbe=0xce;}_0x2480cf['status'](_0x1dfcbe);return _0x2480cf[_0x465c('0x25')](_0x465c('0x26'),_0x3f9e15+'-'+_0x53089e+'/'+_0x5df0dd)[_0x465c('0x21')](_0x48aafd);}return null;};}function patchUpdates(_0x50e2e9){return function(_0x37dc5e){try{jsonpatch[_0x465c('0x27')](_0x37dc5e,_0x50e2e9,!![]);}catch(_0x107770){return BPromise[_0x465c('0x28')](_0x107770);}return _0x37dc5e[_0x465c('0x29')]();};}function saveUpdates(_0x3c9d8b,_0xa85b22){return function(_0x201dc7){if(_0x201dc7){return _0x201dc7[_0x465c('0x2a')](_0x3c9d8b)[_0x465c('0x2b')](function(_0x69b617){return _0x69b617;});}return null;};}function removeEntity(_0x1202d9,_0x472f6c){return function(_0x7fead3){if(_0x7fead3){return _0x7fead3[_0x465c('0x2c')]()['then'](function(){_0x1202d9[_0x465c('0x20')](0xcc)[_0x465c('0x1f')]();});}};}function handleEntityNotFound(_0x4139b4,_0x442a59){return function(_0x43b76a){if(!_0x43b76a){_0x4139b4[_0x465c('0x1e')](0x194);}return _0x43b76a;};}function handleError(_0x5bbfff,_0x1c0369){_0x1c0369=_0x1c0369||0x1f4;return function(_0x77984b){logger[_0x465c('0x2d')](_0x77984b['stack']);if(_0x77984b[_0x465c('0x2e')]){delete _0x77984b['name'];}_0x5bbfff[_0x465c('0x20')](_0x1c0369)[_0x465c('0x2f')](_0x77984b);};}exports[_0x465c('0x30')]=function(_0x3b002b,_0x53aa31){var _0x549709={},_0x36e360={},_0x44b112={'count':0x0,'rows':[]};var _0x43eeb5=_['map'](db[_0x465c('0x31')][_0x465c('0x32')],function(_0x4246e8){return{'name':_0x4246e8[_0x465c('0x33')],'type':_0x4246e8[_0x465c('0x34')]['key']};});_0x36e360[_0x465c('0x35')]=_[_0x465c('0x36')](_0x43eeb5,_0x465c('0x2e'));_0x36e360[_0x465c('0x37')]=_[_0x465c('0x38')](_0x3b002b[_0x465c('0x37')]);_0x36e360[_0x465c('0x39')]=_[_0x465c('0x3a')](_0x36e360[_0x465c('0x35')],_0x36e360[_0x465c('0x37')]);_0x549709[_0x465c('0x3b')]=_[_0x465c('0x3a')](_0x36e360[_0x465c('0x35')],qs[_0x465c('0x3c')](_0x3b002b[_0x465c('0x37')][_0x465c('0x3c')]));_0x549709[_0x465c('0x3b')]=_0x549709[_0x465c('0x3b')]['length']?_0x549709['attributes']:_0x36e360[_0x465c('0x35')];if(!_0x3b002b['query'][_0x465c('0x3d')](_0x465c('0x3e'))){_0x549709[_0x465c('0x24')]=qs[_0x465c('0x24')](_0x3b002b[_0x465c('0x37')]['limit']);_0x549709[_0x465c('0x23')]=qs[_0x465c('0x23')](_0x3b002b[_0x465c('0x37')][_0x465c('0x23')]);}_0x549709[_0x465c('0x3f')]=qs[_0x465c('0x40')](_0x3b002b[_0x465c('0x37')][_0x465c('0x40')]);_0x549709[_0x465c('0x41')]=qs[_0x465c('0x39')](_[_0x465c('0x42')](_0x3b002b[_0x465c('0x37')],_0x36e360['filters']),_0x43eeb5);if(_0x3b002b[_0x465c('0x37')][_0x465c('0x43')]){_0x549709['where']=_['merge'](_0x549709['where'],{'$or':_[_0x465c('0x36')](_0x43eeb5,function(_0x2e057e){if(_0x2e057e[_0x465c('0x34')]!==_0x465c('0x44')){var _0x4bfc3d={};_0x4bfc3d[_0x2e057e['name']]={'$like':'%'+_0x3b002b[_0x465c('0x37')][_0x465c('0x43')]+'%'};return _0x4bfc3d;}})});}_0x549709=_['merge']({},_0x549709,_0x3b002b[_0x465c('0x45')]);var _0x232c2d={'where':_0x549709['where']};return db[_0x465c('0x31')][_0x465c('0x22')](_0x232c2d)['then'](function(_0x201ec0){_0x44b112[_0x465c('0x22')]=_0x201ec0;if(_0x3b002b[_0x465c('0x37')][_0x465c('0x46')]){_0x549709['include']=[{'all':!![]}];}return db[_0x465c('0x31')][_0x465c('0x47')](_0x549709);})[_0x465c('0x2b')](function(_0x116248){_0x44b112['rows']=_0x116248;return _0x44b112;})[_0x465c('0x2b')](respondWithFilteredResult(_0x53aa31,_0x549709))[_0x465c('0x48')](handleError(_0x53aa31,null));};exports[_0x465c('0x49')]=function(_0x416f2b,_0x3ed80d){var _0x49345a={'raw':!![],'where':{'id':_0x416f2b['params']['id']}},_0x10405c={};_0x10405c[_0x465c('0x35')]=_[_0x465c('0x38')](db[_0x465c('0x31')][_0x465c('0x32')]);_0x10405c['query']=_[_0x465c('0x38')](_0x416f2b['query']);_0x10405c[_0x465c('0x39')]=_[_0x465c('0x3a')](_0x10405c[_0x465c('0x35')],_0x10405c[_0x465c('0x37')]);_0x49345a[_0x465c('0x3b')]=_['intersection'](_0x10405c['model'],qs[_0x465c('0x3c')](_0x416f2b[_0x465c('0x37')][_0x465c('0x3c')]));_0x49345a[_0x465c('0x3b')]=_0x49345a['attributes'][_0x465c('0x4a')]?_0x49345a['attributes']:_0x10405c[_0x465c('0x35')];if(_0x416f2b[_0x465c('0x37')][_0x465c('0x46')]){_0x49345a[_0x465c('0x4b')]=[{'all':!![]}];}_0x49345a=_['merge']({},_0x49345a,_0x416f2b['options']);return db[_0x465c('0x31')]['find'](_0x49345a)[_0x465c('0x2b')](handleEntityNotFound(_0x3ed80d,null))[_0x465c('0x2b')](respondWithResult(_0x3ed80d,null))[_0x465c('0x48')](handleError(_0x3ed80d,null));};exports['create']=function(_0x124ece,_0x1c91b7){return db[_0x465c('0x31')][_0x465c('0x4c')](_0x124ece[_0x465c('0x4d')],{})[_0x465c('0x2b')](respondWithResult(_0x1c91b7,0xc9))[_0x465c('0x48')](handleError(_0x1c91b7,null));};exports[_0x465c('0x2a')]=function(_0x26e4f7,_0x38bb9c){if(_0x26e4f7['body']['id']){delete _0x26e4f7[_0x465c('0x4d')]['id'];}return db[_0x465c('0x31')][_0x465c('0x4e')]({'where':{'id':_0x26e4f7[_0x465c('0x4f')]['id']}})[_0x465c('0x2b')](handleEntityNotFound(_0x38bb9c,null))[_0x465c('0x2b')](saveUpdates(_0x26e4f7['body'],null))[_0x465c('0x2b')](respondWithResult(_0x38bb9c,null))[_0x465c('0x48')](handleError(_0x38bb9c,null));};exports['destroy']=function(_0x2fc222,_0xcb5d8d){return db[_0x465c('0x31')][_0x465c('0x4e')]({'where':{'id':_0x2fc222['params']['id']}})[_0x465c('0x2b')](handleEntityNotFound(_0xcb5d8d,null))[_0x465c('0x2b')](removeEntity(_0xcb5d8d,null))['catch'](handleError(_0xcb5d8d,null));};exports[_0x465c('0x50')]=function(_0x5a331f,_0x4d10c4){return db['ChatInternalMessage'][_0x465c('0x50')]()[_0x465c('0x2b')](respondWithResult(_0x4d10c4,null))[_0x465c('0x48')](handleError(_0x4d10c4,null));};function wrapUser(_0x3965af){return function(_0x44c298){var _0x5ee9b2=_0x3965af['get']({'plain':!![]});_0x5ee9b2['messages']=[];if(_0x44c298){_0x5ee9b2['lastMessageAt']=_0x44c298[_0x465c('0x51')];_0x5ee9b2[_0x465c('0x52')]=_0x44c298;}else{_0x5ee9b2[_0x465c('0x53')]=moment(0x0)[_0x465c('0x54')](_0x465c('0x55'));_0x5ee9b2[_0x465c('0x52')]={};}return _0x5ee9b2;};}exports[_0x465c('0x56')]=function(_0x4e3dae,_0x5aed38,_0x3aac0b){var _0x5b9d9a=[];return db['User']['findAll']({'where':{'role':[_0x465c('0x57'),_0x465c('0x58'),_0x465c('0x59')]},'attributes':['id',_0x465c('0x5a'),_0x465c('0x2e'),_0x465c('0x5b'),_0x465c('0x5c'),_0x465c('0x5d'),_0x465c('0x5e'),_0x465c('0x5f'),_0x465c('0x60'),_0x465c('0x61')],'order':qs['sort'](_0x465c('0x62')),'include':[{'model':db[_0x465c('0x63')],'as':_0x465c('0x64'),'attributes':['id',_0x465c('0x2e'),_0x465c('0x34')],'through':{'attributes':[]}}]})[_0x465c('0x2b')](function(_0xa84d38){if(_0xa84d38){var _0x2a25b7=_0x4e3dae[_0x465c('0x59')]['get']({'plain':!![]});if(!_0x2a25b7)throw new Error(_0x465c('0x65'));if(_0x2a25b7[_0x465c('0x5b')]===_0x465c('0x59')){return db[_0x465c('0x66')]['find']({'where':{'name':_0x465c('0x67'),'userProfileId':_0x2a25b7[_0x465c('0x68')]},'raw':!![]})[_0x465c('0x2b')](function(_0x224233){if(_0x224233){if(_0x224233[_0x465c('0x69')]===0x0){return db[_0x465c('0x6a')][_0x465c('0x47')]({'where':{'sectionId':_0x224233['id']},'raw':!![]})[_0x465c('0x2b')](function(_0x5db7ec){var _0x505be3=[];if(_['isEmpty'](_0x5db7ec)){_0x505be3=_[_0x465c('0x43')](_0xa84d38,function(_0x434259){if(_0x434259[_0x465c('0x5b')]!==_0x465c('0x57')){return _0x434259;}});return _0x505be3;}else{for(var _0x5bb67f=0x0;_0x5bb67f<_0xa84d38[_0x465c('0x4a')];_0x5bb67f++){var _0x30d00c=_0xa84d38[_0x5bb67f];if(_0x30d00c[_0x465c('0x5b')]===_0x465c('0x57')){var _0x565169=_[_0x465c('0x4e')](_0x5db7ec,function(_0x49b588){return _0x49b588[_0x465c('0x6b')]===_0x30d00c['id'];});if(_0x565169)_0x505be3[_0x465c('0x6c')](_0x30d00c);}else{_0x505be3['push'](_0x30d00c);}}return _0x505be3;}});}else{return _0xa84d38;}}else{var _0x59b4b7=_[_0x465c('0x43')](_0xa84d38,function(_0x2bc4c9){if(_0x2bc4c9[_0x465c('0x5b')]!==_0x465c('0x57')){return _0x2bc4c9;}});return _0x59b4b7;}});}else{return _0xa84d38;}}})[_0x465c('0x2b')](function(_0x489e05){var _0x3f7891=[];if(_0x489e05){_0x5b9d9a=_0x489e05;for(var _0x588197=0x0;_0x588197<_0x489e05[_0x465c('0x4a')];_0x588197+=0x1){_0x5b9d9a[_0x588197][_0x465c('0x6d')]=[];_0x3f7891[_0x465c('0x6c')](db[_0x465c('0x31')][_0x465c('0x4e')]({'where':{'FromId':[_0x4e3dae[_0x465c('0x59')]['id'],_0x489e05[_0x588197]['id']],'ToId':[_0x4e3dae['user']['id'],_0x489e05[_0x588197]['id']],'ChatGroupId':null},'attributes':['id',_0x465c('0x51'),_0x465c('0x6e'),_0x465c('0x6f'),_0x465c('0x70'),_0x465c('0x4d')],'order':qs[_0x465c('0x40')](_0x465c('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x489e05[_0x588197])));}return BPromise[_0x465c('0x72')](_0x3f7891);}return[];})[_0x465c('0x2b')](function(_0x4e681f){return{'rows':_0x4e681f,'count':_0x4e681f[_0x465c('0x4a')]};})['then'](respondWithResult(_0x5aed38,null))[_0x465c('0x48')](handleError(_0x5aed38,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 59a6938..838294c 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 _0x9485=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','update'];(function(_0x7d869c,_0x396fca){var _0x141baa=function(_0x222fad){while(--_0x222fad){_0x7d869c['push'](_0x7d869c['shift']());}};_0x141baa(++_0x396fca);}(_0x9485,0x8b));var _0x5948=function(_0x30336a,_0x3a74a1){_0x30336a=_0x30336a-0x0;var _0x202ce2=_0x9485[_0x30336a];return _0x202ce2;};'use strict';var EventEmitter=require(_0x5948('0x0'));var ChatInternalMessage=require(_0x5948('0x1'))['db'][_0x5948('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x5948('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5948('0x4'),'afterDestroy':_0x5948('0x5')};function emitEvent(_0x41e5d0){return function(_0x47b3f3,_0xcfd4b6,_0x430fee){ChatInternalMessageEvents[_0x5948('0x6')](_0x41e5d0+':'+_0x47b3f3['id'],_0x47b3f3);ChatInternalMessageEvents[_0x5948('0x6')](_0x41e5d0,_0x47b3f3);_0x430fee(null);};}for(var e in events){if(events[_0x5948('0x7')](e)){var event=events[e];ChatInternalMessage[_0x5948('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x1c9a=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x2ebcb4,_0xae69ec){var _0x3edec0=function(_0x46ad43){while(--_0x46ad43){_0x2ebcb4['push'](_0x2ebcb4['shift']());}};_0x3edec0(++_0xae69ec);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0xbf7e33,_0x219087){_0xbf7e33=_0xbf7e33-0x0;var _0x21f488=_0x1c9a[_0xbf7e33];return _0x21f488;};'use strict';var EventEmitter=require(_0xa1c9('0x0'));var ChatInternalMessage=require(_0xa1c9('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xa1c9('0x2')](0x0);var events={'afterCreate':_0xa1c9('0x3'),'afterUpdate':_0xa1c9('0x4'),'afterDestroy':_0xa1c9('0x5')};function emitEvent(_0x3d8576){return function(_0x4a0d3d,_0x2f883c,_0x5bccfd){ChatInternalMessageEvents[_0xa1c9('0x6')](_0x3d8576+':'+_0x4a0d3d['id'],_0x4a0d3d);ChatInternalMessageEvents[_0xa1c9('0x6')](_0x3d8576,_0x4a0d3d);_0x5bccfd(null);};}for(var e in events){if(events[_0xa1c9('0x7')](e)){var event=events[e];ChatInternalMessage[_0xa1c9('0x8')](e,emitEvent(event));}}module[_0xa1c9('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 8589658..63158dd 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 _0xaa88=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage'];(function(_0x42458e,_0x3593ff){var _0x3e988a=function(_0x2922ad){while(--_0x2922ad){_0x42458e['push'](_0x42458e['shift']());}};_0x3e988a(++_0x3593ff);}(_0xaa88,0x137));var _0x8aa8=function(_0x17882c,_0x4b964b){_0x17882c=_0x17882c-0x0;var _0x355a59=_0xaa88[_0x17882c];return _0x355a59;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8aa8('0xc'),'collate':_0x8aa8('0xd')});}; \ No newline at end of file +var _0x0713=['../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_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':[],'timestamps':!![],'charset':_0x3071('0xc'),'collate':_0x3071('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index ec9cd6f..2b194db 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 _0xe8d6=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x2d13e5,_0x12542b){var _0x2b9f6e=function(_0x46de65){while(--_0x46de65){_0x2d13e5['push'](_0x2d13e5['shift']());}};_0x2b9f6e(++_0x12542b);}(_0xe8d6,0x136));var _0x6e8d=function(_0x13de14,_0x58cb78){_0x13de14=_0x13de14-0x0;var _0x583742=_0xe8d6[_0x13de14];return _0x583742;};'use strict';var _=require(_0x6e8d('0x0'));var util=require(_0x6e8d('0x1'));var moment=require('moment');var BPromise=require(_0x6e8d('0x2'));var rs=require(_0x6e8d('0x3'));var fs=require('fs');var Redis=require(_0x6e8d('0x4'));var db=require(_0x6e8d('0x5'))['db'];var utils=require(_0x6e8d('0x6'));var logger=require(_0x6e8d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6e8d('0x8'));var client=jayson[_0x6e8d('0x9')][_0x6e8d('0xa')]({'port':0x232a});config['redis']=_[_0x6e8d('0xb')](config[_0x6e8d('0xc')],{'host':_0x6e8d('0xd'),'port':0x18eb});var socket=require(_0x6e8d('0xe'))(new Redis(config[_0x6e8d('0xc')]));require(_0x6e8d('0xf'))[_0x6e8d('0x10')](socket);function respondWithRpcPromise(_0x2a98b5,_0x559b50,_0x10c3dc){return new BPromise(function(_0x28485a,_0x1f1ecf){return client[_0x6e8d('0x11')](_0x2a98b5,_0x10c3dc)[_0x6e8d('0x12')](function(_0x4cd6a4){logger[_0x6e8d('0x13')](_0x6e8d('0x14'),_0x559b50,_0x6e8d('0x15'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x559b50,_0x6e8d('0x15'),JSON[_0x6e8d('0x16')](_0x4cd6a4));if(_0x4cd6a4[_0x6e8d('0x17')]){if(_0x4cd6a4['error'][_0x6e8d('0x18')]===0x1f4){logger[_0x6e8d('0x17')](_0x6e8d('0x14'),_0x559b50,_0x4cd6a4[_0x6e8d('0x17')][_0x6e8d('0x19')]);return _0x1f1ecf(_0x4cd6a4['error'][_0x6e8d('0x19')]);}logger[_0x6e8d('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x559b50,_0x4cd6a4[_0x6e8d('0x17')][_0x6e8d('0x19')]);return _0x28485a(_0x4cd6a4[_0x6e8d('0x17')][_0x6e8d('0x19')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x559b50,'request\x20sent');_0x28485a(_0x4cd6a4[_0x6e8d('0x1a')][_0x6e8d('0x19')]);}})[_0x6e8d('0x1b')](function(_0x232ae9){logger[_0x6e8d('0x17')](_0x6e8d('0x14'),_0x559b50,_0x232ae9);_0x1f1ecf(_0x232ae9);});});} \ No newline at end of file +var _0xd929=['rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0xd929,0xaf));var _0x9d92=function(_0x46edf9,_0x52387f){_0x46edf9=_0x46edf9-0x0;var _0x52ca52=_0xd929[_0x46edf9];return _0x52ca52;};'use strict';var _=require(_0x9d92('0x0'));var util=require('util');var moment=require(_0x9d92('0x1'));var BPromise=require(_0x9d92('0x2'));var rs=require(_0x9d92('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d92('0x4'))['db'];var utils=require(_0x9d92('0x5'));var logger=require(_0x9d92('0x6'))(_0x9d92('0x7'));var config=require(_0x9d92('0x8'));var jayson=require(_0x9d92('0x9'));var client=jayson[_0x9d92('0xa')]['http']({'port':0x232a});config['redis']=_[_0x9d92('0xb')](config[_0x9d92('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x9d92('0xd'))(new Redis(config[_0x9d92('0xc')]));require(_0x9d92('0xe'))[_0x9d92('0xf')](socket);function respondWithRpcPromise(_0x5ec25f,_0x8eb713,_0x574129){return new BPromise(function(_0x534fbf,_0x7439e6){return client[_0x9d92('0x10')](_0x5ec25f,_0x574129)[_0x9d92('0x11')](function(_0x395b8d){logger[_0x9d92('0x12')](_0x9d92('0x13'),_0x8eb713,'request\x20sent');logger[_0x9d92('0x14')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x8eb713,_0x9d92('0x15'),JSON[_0x9d92('0x16')](_0x395b8d));if(_0x395b8d['error']){if(_0x395b8d[_0x9d92('0x17')][_0x9d92('0x18')]===0x1f4){logger[_0x9d92('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x8eb713,_0x395b8d[_0x9d92('0x17')][_0x9d92('0x19')]);return _0x7439e6(_0x395b8d[_0x9d92('0x17')][_0x9d92('0x19')]);}logger[_0x9d92('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x8eb713,_0x395b8d[_0x9d92('0x17')][_0x9d92('0x19')]);return _0x534fbf(_0x395b8d[_0x9d92('0x17')][_0x9d92('0x19')]);}else{logger[_0x9d92('0x12')](_0x9d92('0x13'),_0x8eb713,'request\x20sent');_0x534fbf(_0x395b8d['result'][_0x9d92('0x19')]);}})['catch'](function(_0x3122b1){logger[_0x9d92('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x8eb713,_0x3122b1);_0x7439e6(_0x3122b1);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index c13cfc8..dee90b3 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 _0x04de=['save','remove','update','emit','removeListener','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x04de,0x107));var _0xe04d=function(_0x5372b5,_0x4df845){_0x5372b5=_0x5372b5-0x0;var _0x2d462b=_0x04de[_0x5372b5];return _0x2d462b;};'use strict';var ChatInternalMessageEvents=require(_0xe04d('0x0'));var events=[_0xe04d('0x1'),_0xe04d('0x2'),_0xe04d('0x3')];function createListener(_0x1e650d,_0x28f63f){return function(_0x1113af){_0x28f63f[_0xe04d('0x4')](_0x1e650d,_0x1113af);};}function removeListener(_0x2593a4,_0x70ead0){return function(){ChatInternalMessageEvents[_0xe04d('0x5')](_0x2593a4,_0x70ead0);};}exports['register']=function(_0x4bb925){for(var _0x4f7637=0x0,_0x531688=events[_0xe04d('0x6')];_0x4f7637<_0x531688;_0x4f7637++){var _0x210e93=events[_0x4f7637];var _0x72b1ce=createListener(_0xe04d('0x7')+_0x210e93,_0x4bb925);ChatInternalMessageEvents['on'](_0x210e93,_0x72b1ce);}}; \ No newline at end of file +var _0x6921=['register','length','chatInternalMessage:','save','update','removeListener'];(function(_0x5854d6,_0x439c2e){var _0x3b35c3=function(_0xe0516d){while(--_0xe0516d){_0x5854d6['push'](_0x5854d6['shift']());}};_0x3b35c3(++_0x439c2e);}(_0x6921,0x1d1));var _0x1692=function(_0xf66077,_0x3530fa){_0xf66077=_0xf66077-0x0;var _0x5978a2=_0x6921[_0xf66077];return _0x5978a2;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x1692('0x0'),'remove',_0x1692('0x1')];function createListener(_0x557c3c,_0x434ea2){return function(_0x13a03b){_0x434ea2['emit'](_0x557c3c,_0x13a03b);};}function removeListener(_0x3995b3,_0x577497){return function(){ChatInternalMessageEvents[_0x1692('0x2')](_0x3995b3,_0x577497);};}exports[_0x1692('0x3')]=function(_0x15f20e){for(var _0x14fbfe=0x0,_0x2825c9=events[_0x1692('0x4')];_0x14fbfe<_0x2825c9;_0x14fbfe++){var _0x2d694f=events[_0x14fbfe];var _0x3ffe29=createListener(_0x1692('0x5')+_0x2d694f,_0x15f20e);ChatInternalMessageEvents['on'](_0x2d694f,_0x3ffe29);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 4d19b4c..c5b3627 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 _0xd8b0=['put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','index','get','/describe','describe','isAuthenticated','getUsers','/:id','show','post'];(function(_0x366802,_0x34c82a){var _0x5c081d=function(_0x25f13b){while(--_0x25f13b){_0x366802['push'](_0x366802['shift']());}};_0x5c081d(++_0x34c82a);}(_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 auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/users',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')]('/',auth[_0x0d8b('0xb')](),controller['create']);router[_0x0d8b('0x10')]('/:id',controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);module[_0x0d8b('0x14')]=router; \ No newline at end of file +var _0xd8b0=['put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','index','get','/describe','describe','isAuthenticated','getUsers','/:id','show','post'];(function(_0x1be69b,_0x517ce2){var _0x5b56cd=function(_0x2ee114){while(--_0x2ee114){_0x1be69b['push'](_0x1be69b['shift']());}};_0x5b56cd(++_0x517ce2);}(_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 auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/users',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')]('/',auth[_0x0d8b('0xb')](),controller['create']);router[_0x0d8b('0x10')]('/:id',controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);module[_0x0d8b('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 0cd3747..13bcddc 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 _0x2966=['sequelize','exports','TEXT','BOOLEAN','DATE'];(function(_0x43576f,_0x1356ed){var _0x4d2466=function(_0x865deb){while(--_0x865deb){_0x43576f['push'](_0x43576f['shift']());}};_0x4d2466(++_0x1356ed);}(_0x2966,0x12c));var _0x6296=function(_0x15cc05,_0x526746){_0x15cc05=_0x15cc05-0x0;var _0x521808=_0x2966[_0x15cc05];return _0x521808;};'use strict';var Sequelize=require(_0x6296('0x0'));module[_0x6296('0x1')]={'body':{'type':Sequelize[_0x6296('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x6296('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x6296('0x4')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x72fd=['DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x72fd,0xc2));var _0xd72f=function(_0x252d71,_0x367b81){_0x252d71=_0x252d71-0x0;var _0x2495cf=_0x72fd[_0x252d71];return _0x2495cf;};'use strict';var Sequelize=require(_0xd72f('0x0'));module[_0xd72f('0x1')]={'body':{'type':Sequelize[_0xd72f('0x2')](_0xd72f('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xd72f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd72f('0x5')),'defaultValue':_0xd72f('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd72f('0x6')]},'providerName':{'type':Sequelize[_0xd72f('0x7')]},'providerResponse':{'type':Sequelize[_0xd72f('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index f9482fa..ba0edab 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 _0x3349=['stringify','error','message','result','catch','sendStatus','end','status','json','count','offset','set','apply','save','update','destroy','stack','name','send','index','map','ChatMessage','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','options','include','findAll','show','params','rawAttributes','fields','includeAll','find','create','body','describe','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','ChatInteraction','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','manual','SIP/%s','channel','EventManager','acceptmessage','parse','formData','chat-interactions','reject','chat','agent','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','event','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x44da5d,_0x3a6770){var _0x3f6a00=function(_0x34cbf6){while(--_0x34cbf6){_0x44da5d['push'](_0x44da5d['shift']());}};_0x3f6a00(++_0x3a6770);}(_0x3349,0x142));var _0x9334=function(_0x24a956,_0x1a7a4f){_0x24a956=_0x24a956-0x0;var _0x38aac9=_0x3349[_0x24a956];return _0x38aac9;};'use strict';var pdf=require(_0x9334('0x0'));var emlformat=require(_0x9334('0x1'));var rimraf=require(_0x9334('0x2'));var zipdir=require(_0x9334('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9334('0x4'));var moment=require('moment');var BPromise=require(_0x9334('0x5'));var Mustache=require(_0x9334('0x6'));var util=require(_0x9334('0x7'));var path=require('path');var sox=require(_0x9334('0x8'));var csv=require(_0x9334('0x9'));var ejs=require(_0x9334('0xa'));var fs=require('fs');var _=require(_0x9334('0xb'));var squel=require('squel');var crypto=require(_0x9334('0xc'));var jsforce=require(_0x9334('0xd'));var deskjs=require(_0x9334('0xe'));var toCsv=require(_0x9334('0x9'));var querystring=require(_0x9334('0xf'));var Papa=require(_0x9334('0x10'));var Redis=require(_0x9334('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9334('0x12'));var logger=require(_0x9334('0x13'))('api');var utils=require(_0x9334('0x14'));var config=require(_0x9334('0x15'));var licenseUtil=require(_0x9334('0x16'));var db=require('../../mysqldb')['db'];config[_0x9334('0x17')]=_[_0x9334('0x18')](config['redis'],{'host':_0x9334('0x19'),'port':0x18eb});var socket=require(_0x9334('0x1a'))(new Redis(config['redis']));require('./chatMessage.socket')[_0x9334('0x1b')](socket);var jayson=require(_0x9334('0x1c'));var client=jayson['client'][_0x9334('0x1d')]({'port':0x232c});var client9002=jayson[_0x9334('0x1e')][_0x9334('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2c9120,_0x4193fe,_0x55fae9,_0x2855a1){return new BPromise(function(_0x4fd26c,_0x158292){var _0xadc57a=_0x2855a1||client;return _0xadc57a[_0x9334('0x1f')](_0x2c9120,_0x55fae9)[_0x9334('0x20')](function(_0x2076df){logger[_0x9334('0x21')](_0x9334('0x22'),_0x4193fe,_0x9334('0x23'));logger[_0x9334('0x24')](_0x9334('0x25'),_0x4193fe,_0x9334('0x23'),JSON[_0x9334('0x26')](_0x2076df));if(_0x2076df[_0x9334('0x27')]){if(_0x2076df['error']['code']===0x1f4){logger[_0x9334('0x27')](_0x9334('0x22'),_0x4193fe,_0x2076df[_0x9334('0x27')][_0x9334('0x28')]);return _0x158292(_0x2076df[_0x9334('0x27')]['message']);}logger[_0x9334('0x27')](_0x9334('0x22'),_0x4193fe,_0x2076df[_0x9334('0x27')][_0x9334('0x28')]);return _0x4fd26c(_0x2076df['error'][_0x9334('0x28')]);}else{logger[_0x9334('0x21')]('ChatMessage,\x20%s,\x20%s',_0x4193fe,'request\x20sent');_0x4fd26c(_0x2076df[_0x9334('0x29')]['message']);}})[_0x9334('0x2a')](function(_0x3eaad6){logger['error']('ChatMessage,\x20%s,\x20%s',_0x4193fe,_0x3eaad6);_0x158292(_0x3eaad6);});});}function respondWithStatusCode(_0x4dc936,_0x551401){_0x551401=_0x551401||0xcc;return function(_0x26c98e){if(_0x26c98e){return _0x4dc936[_0x9334('0x2b')](_0x551401);}return _0x4dc936['status'](_0x551401)[_0x9334('0x2c')]();};}function respondWithResult(_0x1e16a5,_0x1a474e){_0x1a474e=_0x1a474e||0xc8;return function(_0x1cfa1e){if(_0x1cfa1e){return _0x1e16a5[_0x9334('0x2d')](_0x1a474e)[_0x9334('0x2e')](_0x1cfa1e);}};}function respondWithFilteredResult(_0x52b567,_0x12a203){return function(_0x471814){if(_0x471814){var _0x38b2d5=_0x471814[_0x9334('0x2f')],_0x13cb78=_0x12a203['offset'],_0x330412=_0x12a203[_0x9334('0x30')]+_0x12a203['limit'],_0x17ea31;if(_0x330412>=_0x38b2d5){_0x330412=_0x38b2d5;_0x17ea31=0xc8;}else{_0x17ea31=0xce;}_0x52b567[_0x9334('0x2d')](_0x17ea31);return _0x52b567[_0x9334('0x31')]('Content-Range',_0x13cb78+'-'+_0x330412+'/'+_0x38b2d5)[_0x9334('0x2e')](_0x471814);}return null;};}function patchUpdates(_0x3d7ccb){return function(_0x143c06){try{jsonpatch[_0x9334('0x32')](_0x143c06,_0x3d7ccb,!![]);}catch(_0x57c49c){return BPromise['reject'](_0x57c49c);}return _0x143c06[_0x9334('0x33')]();};}function saveUpdates(_0x534022,_0x31676e){return function(_0x1acef2){if(_0x1acef2){return _0x1acef2[_0x9334('0x34')](_0x534022)[_0x9334('0x20')](function(_0x330882){return _0x330882;});}return null;};}function removeEntity(_0x1d3736,_0x391a70){return function(_0x3fb0e3){if(_0x3fb0e3){return _0x3fb0e3[_0x9334('0x35')]()[_0x9334('0x20')](function(){_0x1d3736['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x318bbb,_0x1b68ba){return function(_0x36b587){if(!_0x36b587){_0x318bbb[_0x9334('0x2b')](0x194);}return _0x36b587;};}function handleError(_0x2f831a,_0x183bf8){_0x183bf8=_0x183bf8||0x1f4;return function(_0x3d11f0){logger['error'](_0x3d11f0[_0x9334('0x36')]);if(_0x3d11f0[_0x9334('0x37')]){delete _0x3d11f0['name'];}_0x2f831a['status'](_0x183bf8)[_0x9334('0x38')](_0x3d11f0);};}exports[_0x9334('0x39')]=function(_0x424eb1,_0x696d29){var _0x1c19ff={},_0x2248a1={},_0xaa40d5={'count':0x0,'rows':[]};var _0x2ac8fe=_[_0x9334('0x3a')](db[_0x9334('0x3b')]['rawAttributes'],function(_0x3e60fe){return{'name':_0x3e60fe[_0x9334('0x3c')],'type':_0x3e60fe[_0x9334('0x3d')][_0x9334('0x3e')]};});_0x2248a1[_0x9334('0x3f')]=_[_0x9334('0x3a')](_0x2ac8fe,_0x9334('0x37'));_0x2248a1[_0x9334('0x40')]=_[_0x9334('0x41')](_0x424eb1[_0x9334('0x40')]);_0x2248a1['filters']=_[_0x9334('0x42')](_0x2248a1['model'],_0x2248a1[_0x9334('0x40')]);_0x1c19ff[_0x9334('0x43')]=_['intersection'](_0x2248a1[_0x9334('0x3f')],qs['fields'](_0x424eb1['query']['fields']));_0x1c19ff['attributes']=_0x1c19ff[_0x9334('0x43')][_0x9334('0x44')]?_0x1c19ff[_0x9334('0x43')]:_0x2248a1['model'];if(!_0x424eb1[_0x9334('0x40')][_0x9334('0x45')]('nolimit')){_0x1c19ff[_0x9334('0x46')]=qs[_0x9334('0x46')](_0x424eb1[_0x9334('0x40')][_0x9334('0x46')]);_0x1c19ff[_0x9334('0x30')]=qs[_0x9334('0x30')](_0x424eb1[_0x9334('0x40')][_0x9334('0x30')]);}_0x1c19ff[_0x9334('0x47')]=qs[_0x9334('0x48')](_0x424eb1[_0x9334('0x40')][_0x9334('0x48')]);_0x1c19ff[_0x9334('0x49')]=qs[_0x9334('0x4a')](_[_0x9334('0x4b')](_0x424eb1[_0x9334('0x40')],_0x2248a1['filters']),_0x2ac8fe);if(_0x424eb1['query'][_0x9334('0x4c')]){_0x1c19ff[_0x9334('0x49')]=_[_0x9334('0x4d')](_0x1c19ff['where'],{'$or':_[_0x9334('0x3a')](_0x2ac8fe,function(_0x542bf1){if(_0x542bf1['type']!=='VIRTUAL'){var _0x499df3={};_0x499df3[_0x542bf1[_0x9334('0x37')]]={'$like':'%'+_0x424eb1[_0x9334('0x40')][_0x9334('0x4c')]+'%'};return _0x499df3;}})});}_0x1c19ff=_[_0x9334('0x4d')]({},_0x1c19ff,_0x424eb1[_0x9334('0x4e')]);var _0x1fc75d={'where':_0x1c19ff[_0x9334('0x49')]};return db['ChatMessage']['count'](_0x1fc75d)[_0x9334('0x20')](function(_0x30986b){_0xaa40d5[_0x9334('0x2f')]=_0x30986b;if(_0x424eb1['query']['includeAll']){_0x1c19ff[_0x9334('0x4f')]=[{'all':!![]}];}return db['ChatMessage'][_0x9334('0x50')](_0x1c19ff);})[_0x9334('0x20')](function(_0x41693e){_0xaa40d5['rows']=_0x41693e;return _0xaa40d5;})[_0x9334('0x20')](respondWithFilteredResult(_0x696d29,_0x1c19ff))['catch'](handleError(_0x696d29,null));};exports[_0x9334('0x51')]=function(_0x34eb8f,_0x36e1f7){var _0x1976ab={'raw':!![],'where':{'id':_0x34eb8f[_0x9334('0x52')]['id']}},_0x4772e5={};_0x4772e5[_0x9334('0x3f')]=_['keys'](db['ChatMessage'][_0x9334('0x53')]);_0x4772e5[_0x9334('0x40')]=_[_0x9334('0x41')](_0x34eb8f[_0x9334('0x40')]);_0x4772e5[_0x9334('0x4a')]=_[_0x9334('0x42')](_0x4772e5['model'],_0x4772e5[_0x9334('0x40')]);_0x1976ab[_0x9334('0x43')]=_[_0x9334('0x42')](_0x4772e5[_0x9334('0x3f')],qs[_0x9334('0x54')](_0x34eb8f['query'][_0x9334('0x54')]));_0x1976ab[_0x9334('0x43')]=_0x1976ab[_0x9334('0x43')]['length']?_0x1976ab[_0x9334('0x43')]:_0x4772e5['model'];if(_0x34eb8f[_0x9334('0x40')][_0x9334('0x55')]){_0x1976ab['include']=[{'all':!![]}];}_0x1976ab=_['merge']({},_0x1976ab,_0x34eb8f[_0x9334('0x4e')]);return db[_0x9334('0x3b')][_0x9334('0x56')](_0x1976ab)[_0x9334('0x20')](handleEntityNotFound(_0x36e1f7,null))[_0x9334('0x20')](respondWithResult(_0x36e1f7,null))[_0x9334('0x2a')](handleError(_0x36e1f7,null));};exports[_0x9334('0x57')]=function(_0x30b04c,_0x455314){return db['ChatMessage'][_0x9334('0x57')](_0x30b04c[_0x9334('0x58')],{})[_0x9334('0x20')](respondWithResult(_0x455314,0xc9))[_0x9334('0x2a')](handleError(_0x455314,null));};exports[_0x9334('0x34')]=function(_0x1be184,_0x166cee){if(_0x1be184['body']['id']){delete _0x1be184[_0x9334('0x58')]['id'];}return db[_0x9334('0x3b')][_0x9334('0x56')]({'where':{'id':_0x1be184[_0x9334('0x52')]['id']}})[_0x9334('0x20')](handleEntityNotFound(_0x166cee,null))[_0x9334('0x20')](saveUpdates(_0x1be184[_0x9334('0x58')],null))[_0x9334('0x20')](respondWithResult(_0x166cee,null))['catch'](handleError(_0x166cee,null));};exports['destroy']=function(_0x5c4686,_0x57b3d7){return db[_0x9334('0x3b')]['find']({'where':{'id':_0x5c4686['params']['id']}})[_0x9334('0x20')](handleEntityNotFound(_0x57b3d7,null))[_0x9334('0x20')](removeEntity(_0x57b3d7,null))[_0x9334('0x2a')](handleError(_0x57b3d7,null));};exports[_0x9334('0x59')]=function(_0x4999ea,_0x236732){return db[_0x9334('0x3b')]['describe']()['then'](respondWithResult(_0x236732,null))[_0x9334('0x2a')](handleError(_0x236732,null));};var interaction_log=require(_0x9334('0x13'))('chat-interactions');exports['accept']=function(_0x482737,_0x1b4d96,_0x3bd7c4){var _0x179692={'agent':{},'channel':'chat'};if(_0x482737[_0x9334('0x58')]['id']){delete _0x482737[_0x9334('0x58')]['id'];}_0x482737['body']['read']=!![];_0x482737[_0x9334('0x58')]['readAt']=moment()[_0x9334('0x5a')](_0x9334('0x5b'));_0x482737[_0x9334('0x58')]['UserId']=_0x482737[_0x9334('0x58')][_0x9334('0x5c')]||_0x482737[_0x9334('0x5d')]['id'];_0x179692['agent']['id']=_0x482737['body']['UserId'];return db[_0x9334('0x3b')][_0x9334('0x56')]({'where':{'id':_0x482737['params']['id'],'UserId':null},'include':[{'model':db[_0x9334('0x5e')],'as':_0x9334('0x5f')}]})[_0x9334('0x20')](handleEntityNotFound(_0x1b4d96,null))[_0x9334('0x20')](saveUpdates(_0x482737[_0x9334('0x58')],null))[_0x9334('0x20')](function(_0x226d16){if(_0x226d16){_0x179692[_0x9334('0x28')]=_0x226d16[_0x9334('0x60')]({'plain':!![]});return db[_0x9334('0x61')][_0x9334('0x56')]({'where':{'id':_0x226d16['ChatInteractionId']}});}return null;})[_0x9334('0x20')](handleEntityNotFound(_0x1b4d96,null))[_0x9334('0x20')](function(_0x32a2c6){if(_0x32a2c6){return _0x32a2c6[_0x9334('0x34')]({'UserId':_0x482737[_0x9334('0x58')][_0x9334('0x5c')],'read1stAt':_['isNil'](_0x32a2c6[_0x9334('0x62')])?moment()[_0x9334('0x5a')](_0x9334('0x5b')):undefined});}return null;})[_0x9334('0x20')](function(_0x77c30e){if(_0x77c30e){_0x179692[_0x9334('0x63')]=_0x77c30e[_0x9334('0x60')]({'plain':!![]});interaction_log['info'](_0x9334('0x64'),_0x482737['user']['id'],_0x482737[_0x9334('0x5d')][_0x9334('0x37')],_0x482737[_0x9334('0x5d')][_0x9334('0x65')],_0x179692[_0x9334('0x63')]['id'],_0x482737['body']?JSON[_0x9334('0x26')](_0x482737['body']):'null');return respondWithRpcPromise(_0x9334('0x66'),'acceptMessage',_0x179692);}return null;})['then'](function(_0x5dbfb1){if(_0x5dbfb1){if(_0x482737['body'][_0x9334('0x67')]){_0x179692[_0x9334('0x28')]['interface']=util[_0x9334('0x5a')](_0x9334('0x68'),_0x482737[_0x9334('0x5d')][_0x9334('0x37')]);_0x179692[_0x9334('0x28')][_0x9334('0x69')]=_0x179692[_0x9334('0x69')];_0x179692[_0x9334('0x28')]['event']='accept';return respondWithRpcPromise(_0x9334('0x6a'),_0x9334('0x6a'),{'event':_0x9334('0x6b'),'message':_[_0x9334('0x4d')](_0x179692[_0x9334('0x28')],JSON[_0x9334('0x6c')](_0x179692['interaction'][_0x9334('0x6d')]))},client9002)[_0x9334('0x20')](function(){return _0x179692;});}return _0x179692;}return null;})[_0x9334('0x20')](respondWithResult(_0x1b4d96,null))['catch'](handleError(_0x1b4d96,null));};var interaction_log=require(_0x9334('0x13'))(_0x9334('0x6e'));exports[_0x9334('0x6f')]=function(_0x55f588,_0x2ebb13,_0x54c78c){var _0x370d42={'agent':{},'channel':_0x9334('0x70')};if(_0x55f588['body']['id']){delete _0x55f588['body']['id'];}_0x55f588[_0x9334('0x58')]['UserId']=_0x55f588[_0x9334('0x58')][_0x9334('0x5c')]||_0x55f588['user']['id'];_0x370d42[_0x9334('0x71')]['id']=_0x55f588[_0x9334('0x58')][_0x9334('0x5c')];return db[_0x9334('0x3b')][_0x9334('0x56')]({'where':{'id':_0x55f588[_0x9334('0x52')]['id'],'UserId':null}})[_0x9334('0x20')](handleEntityNotFound(_0x2ebb13,null))[_0x9334('0x20')](function(_0x206c89){if(_0x206c89){_0x370d42['message']=_0x206c89[_0x9334('0x60')]({'plain':!![]});return db[_0x9334('0x61')]['find']({'where':{'id':_0x206c89[_0x9334('0x72')]}});}return null;})[_0x9334('0x20')](handleEntityNotFound(_0x2ebb13,null))['then'](function(_0x579fc7){if(_0x579fc7){_0x370d42[_0x9334('0x63')]=_0x579fc7[_0x9334('0x60')]({'plain':!![]});interaction_log[_0x9334('0x21')](_0x9334('0x73'),_0x55f588[_0x9334('0x5d')]['id'],_0x55f588[_0x9334('0x5d')][_0x9334('0x37')],_0x55f588[_0x9334('0x5d')][_0x9334('0x65')],_0x370d42['interaction']['id'],_0x55f588[_0x9334('0x58')]?JSON['stringify'](_0x55f588['body']):'null');return respondWithRpcPromise(_0x9334('0x74'),_0x9334('0x75'),_0x370d42);}return null;})[_0x9334('0x20')](function(_0x579785){if(_0x579785){_0x579785[_0x9334('0x28')][_0x9334('0x76')]=util[_0x9334('0x5a')](_0x9334('0x68'),_0x55f588[_0x9334('0x5d')]['name']);_0x579785['message'][_0x9334('0x69')]=_0x370d42[_0x9334('0x69')];_0x579785[_0x9334('0x28')][_0x9334('0x77')]=_0x9334('0x6f');respondWithRpcPromise('EventManager',_0x9334('0x6a'),{'event':'rejectmessage','message':_0x579785[_0x9334('0x28')]},client9002);return _0x370d42;}return null;})[_0x9334('0x20')](respondWithResult(_0x2ebb13,null))[_0x9334('0x2a')](handleError(_0x2ebb13,null));}; \ No newline at end of file +var _0xcdd8=['rows','params','keys','include','merge','find','create','body','describe','../../config/logger','chat-interactions','chat','read','readAt','format','UserId','user','agent','CmContact','get','ChatInteraction','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','formData','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','ejs','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','http','client','then','info','request\x20sent','debug','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','ChatMessage','includeAll','findAll'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xcdd8,0x19d));var _0x8cdd=function(_0x112c13,_0x3d073f){_0x112c13=_0x112c13-0x0;var _0x2aea28=_0xcdd8[_0x112c13];return _0x2aea28;};'use strict';var pdf=require(_0x8cdd('0x0'));var emlformat=require(_0x8cdd('0x1'));var rimraf=require(_0x8cdd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8cdd('0x3'));var moment=require(_0x8cdd('0x4'));var BPromise=require(_0x8cdd('0x5'));var Mustache=require(_0x8cdd('0x6'));var util=require(_0x8cdd('0x7'));var path=require('path');var sox=require(_0x8cdd('0x8'));var csv=require('to-csv');var ejs=require(_0x8cdd('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8cdd('0xa'));var deskjs=require(_0x8cdd('0xb'));var toCsv=require(_0x8cdd('0xc'));var querystring=require(_0x8cdd('0xd'));var Papa=require(_0x8cdd('0xe'));var Redis=require(_0x8cdd('0xf'));var authService=require(_0x8cdd('0x10'));var qs=require(_0x8cdd('0x11'));var as=require(_0x8cdd('0x12'));var hardwareService=require(_0x8cdd('0x13'));var logger=require('../../config/logger')(_0x8cdd('0x14'));var utils=require(_0x8cdd('0x15'));var config=require(_0x8cdd('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8cdd('0x17'))['db'];config['redis']=_[_0x8cdd('0x18')](config[_0x8cdd('0x19')],{'host':_0x8cdd('0x1a'),'port':0x18eb});var socket=require(_0x8cdd('0x1b'))(new Redis(config['redis']));require(_0x8cdd('0x1c'))[_0x8cdd('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8cdd('0x1e')]({'port':0x232c});var client9002=jayson[_0x8cdd('0x1f')][_0x8cdd('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x48f976,_0x4eccd7,_0x1ed13a,_0x53bbc1){return new BPromise(function(_0x52b066,_0x3b339b){var _0x1b9ceb=_0x53bbc1||client;return _0x1b9ceb['request'](_0x48f976,_0x1ed13a)[_0x8cdd('0x20')](function(_0x376207){logger[_0x8cdd('0x21')]('ChatMessage,\x20%s,\x20%s',_0x4eccd7,_0x8cdd('0x22'));logger[_0x8cdd('0x23')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4eccd7,_0x8cdd('0x22'),JSON[_0x8cdd('0x24')](_0x376207));if(_0x376207['error']){if(_0x376207[_0x8cdd('0x25')][_0x8cdd('0x26')]===0x1f4){logger[_0x8cdd('0x25')](_0x8cdd('0x27'),_0x4eccd7,_0x376207['error'][_0x8cdd('0x28')]);return _0x3b339b(_0x376207[_0x8cdd('0x25')][_0x8cdd('0x28')]);}logger[_0x8cdd('0x25')](_0x8cdd('0x27'),_0x4eccd7,_0x376207['error'][_0x8cdd('0x28')]);return _0x52b066(_0x376207['error'][_0x8cdd('0x28')]);}else{logger[_0x8cdd('0x21')](_0x8cdd('0x27'),_0x4eccd7,_0x8cdd('0x22'));_0x52b066(_0x376207[_0x8cdd('0x29')][_0x8cdd('0x28')]);}})[_0x8cdd('0x2a')](function(_0x452480){logger[_0x8cdd('0x25')](_0x8cdd('0x27'),_0x4eccd7,_0x452480);_0x3b339b(_0x452480);});});}function respondWithStatusCode(_0x38d7ae,_0x2733b8){_0x2733b8=_0x2733b8||0xcc;return function(_0x25210e){if(_0x25210e){return _0x38d7ae[_0x8cdd('0x2b')](_0x2733b8);}return _0x38d7ae[_0x8cdd('0x2c')](_0x2733b8)[_0x8cdd('0x2d')]();};}function respondWithResult(_0x50b75a,_0xd9f7fa){_0xd9f7fa=_0xd9f7fa||0xc8;return function(_0x106967){if(_0x106967){return _0x50b75a[_0x8cdd('0x2c')](_0xd9f7fa)[_0x8cdd('0x2e')](_0x106967);}};}function respondWithFilteredResult(_0x13c6fd,_0x3d9c94){return function(_0xd37016){if(_0xd37016){var _0x8d50b4=_0xd37016[_0x8cdd('0x2f')],_0x5df973=_0x3d9c94[_0x8cdd('0x30')],_0x1937b8=_0x3d9c94[_0x8cdd('0x30')]+_0x3d9c94[_0x8cdd('0x31')],_0x26cb78;if(_0x1937b8>=_0x8d50b4){_0x1937b8=_0x8d50b4;_0x26cb78=0xc8;}else{_0x26cb78=0xce;}_0x13c6fd[_0x8cdd('0x2c')](_0x26cb78);return _0x13c6fd[_0x8cdd('0x32')]('Content-Range',_0x5df973+'-'+_0x1937b8+'/'+_0x8d50b4)[_0x8cdd('0x2e')](_0xd37016);}return null;};}function patchUpdates(_0x1e583e){return function(_0x174f74){try{jsonpatch[_0x8cdd('0x33')](_0x174f74,_0x1e583e,!![]);}catch(_0x1c3498){return BPromise[_0x8cdd('0x34')](_0x1c3498);}return _0x174f74[_0x8cdd('0x35')]();};}function saveUpdates(_0x2902b8,_0x3b0c79){return function(_0x31da19){if(_0x31da19){return _0x31da19[_0x8cdd('0x36')](_0x2902b8)[_0x8cdd('0x20')](function(_0x516c6a){return _0x516c6a;});}return null;};}function removeEntity(_0x4859e0,_0x250034){return function(_0x2f884b){if(_0x2f884b){return _0x2f884b[_0x8cdd('0x37')]()[_0x8cdd('0x20')](function(){_0x4859e0['status'](0xcc)[_0x8cdd('0x2d')]();});}};}function handleEntityNotFound(_0x106055,_0xc7464f){return function(_0x2cf7b2){if(!_0x2cf7b2){_0x106055['sendStatus'](0x194);}return _0x2cf7b2;};}function handleError(_0x85a51b,_0x39873c){_0x39873c=_0x39873c||0x1f4;return function(_0x1b40f5){logger['error'](_0x1b40f5[_0x8cdd('0x38')]);if(_0x1b40f5['name']){delete _0x1b40f5[_0x8cdd('0x39')];}_0x85a51b[_0x8cdd('0x2c')](_0x39873c)[_0x8cdd('0x3a')](_0x1b40f5);};}exports[_0x8cdd('0x3b')]=function(_0x2ce658,_0x1a10b4){var _0x8a8994={},_0x1346b4={},_0x40f9fd={'count':0x0,'rows':[]};var _0x494f90=_[_0x8cdd('0x3c')](db['ChatMessage'][_0x8cdd('0x3d')],function(_0xe5bb6f){return{'name':_0xe5bb6f[_0x8cdd('0x3e')],'type':_0xe5bb6f[_0x8cdd('0x3f')]['key']};});_0x1346b4['model']=_['map'](_0x494f90,'name');_0x1346b4['query']=_['keys'](_0x2ce658[_0x8cdd('0x40')]);_0x1346b4[_0x8cdd('0x41')]=_[_0x8cdd('0x42')](_0x1346b4['model'],_0x1346b4[_0x8cdd('0x40')]);_0x8a8994['attributes']=_[_0x8cdd('0x42')](_0x1346b4['model'],qs[_0x8cdd('0x43')](_0x2ce658[_0x8cdd('0x40')][_0x8cdd('0x43')]));_0x8a8994[_0x8cdd('0x44')]=_0x8a8994['attributes'][_0x8cdd('0x45')]?_0x8a8994[_0x8cdd('0x44')]:_0x1346b4[_0x8cdd('0x46')];if(!_0x2ce658['query'][_0x8cdd('0x47')](_0x8cdd('0x48'))){_0x8a8994[_0x8cdd('0x31')]=qs[_0x8cdd('0x31')](_0x2ce658[_0x8cdd('0x40')][_0x8cdd('0x31')]);_0x8a8994[_0x8cdd('0x30')]=qs[_0x8cdd('0x30')](_0x2ce658[_0x8cdd('0x40')][_0x8cdd('0x30')]);}_0x8a8994[_0x8cdd('0x49')]=qs[_0x8cdd('0x4a')](_0x2ce658[_0x8cdd('0x40')][_0x8cdd('0x4a')]);_0x8a8994[_0x8cdd('0x4b')]=qs['filters'](_[_0x8cdd('0x4c')](_0x2ce658[_0x8cdd('0x40')],_0x1346b4[_0x8cdd('0x41')]),_0x494f90);if(_0x2ce658[_0x8cdd('0x40')]['filter']){_0x8a8994[_0x8cdd('0x4b')]=_['merge'](_0x8a8994[_0x8cdd('0x4b')],{'$or':_[_0x8cdd('0x3c')](_0x494f90,function(_0x136671){if(_0x136671[_0x8cdd('0x3f')]!==_0x8cdd('0x4d')){var _0x3b1ad7={};_0x3b1ad7[_0x136671[_0x8cdd('0x39')]]={'$like':'%'+_0x2ce658[_0x8cdd('0x40')][_0x8cdd('0x4e')]+'%'};return _0x3b1ad7;}})});}_0x8a8994=_['merge']({},_0x8a8994,_0x2ce658[_0x8cdd('0x4f')]);var _0x5ddaed={'where':_0x8a8994[_0x8cdd('0x4b')]};return db[_0x8cdd('0x50')]['count'](_0x5ddaed)[_0x8cdd('0x20')](function(_0x7314c4){_0x40f9fd[_0x8cdd('0x2f')]=_0x7314c4;if(_0x2ce658[_0x8cdd('0x40')][_0x8cdd('0x51')]){_0x8a8994['include']=[{'all':!![]}];}return db['ChatMessage'][_0x8cdd('0x52')](_0x8a8994);})['then'](function(_0x39ee4a){_0x40f9fd[_0x8cdd('0x53')]=_0x39ee4a;return _0x40f9fd;})['then'](respondWithFilteredResult(_0x1a10b4,_0x8a8994))[_0x8cdd('0x2a')](handleError(_0x1a10b4,null));};exports['show']=function(_0x33d142,_0x1f7aa1){var _0x5a2fab={'raw':!![],'where':{'id':_0x33d142[_0x8cdd('0x54')]['id']}},_0x5d3a6b={};_0x5d3a6b[_0x8cdd('0x46')]=_['keys'](db['ChatMessage'][_0x8cdd('0x3d')]);_0x5d3a6b[_0x8cdd('0x40')]=_[_0x8cdd('0x55')](_0x33d142['query']);_0x5d3a6b[_0x8cdd('0x41')]=_['intersection'](_0x5d3a6b[_0x8cdd('0x46')],_0x5d3a6b['query']);_0x5a2fab['attributes']=_[_0x8cdd('0x42')](_0x5d3a6b[_0x8cdd('0x46')],qs['fields'](_0x33d142[_0x8cdd('0x40')][_0x8cdd('0x43')]));_0x5a2fab['attributes']=_0x5a2fab[_0x8cdd('0x44')][_0x8cdd('0x45')]?_0x5a2fab[_0x8cdd('0x44')]:_0x5d3a6b[_0x8cdd('0x46')];if(_0x33d142[_0x8cdd('0x40')][_0x8cdd('0x51')]){_0x5a2fab[_0x8cdd('0x56')]=[{'all':!![]}];}_0x5a2fab=_[_0x8cdd('0x57')]({},_0x5a2fab,_0x33d142[_0x8cdd('0x4f')]);return db[_0x8cdd('0x50')][_0x8cdd('0x58')](_0x5a2fab)['then'](handleEntityNotFound(_0x1f7aa1,null))[_0x8cdd('0x20')](respondWithResult(_0x1f7aa1,null))[_0x8cdd('0x2a')](handleError(_0x1f7aa1,null));};exports[_0x8cdd('0x59')]=function(_0x304ab5,_0x15c315){return db['ChatMessage'][_0x8cdd('0x59')](_0x304ab5[_0x8cdd('0x5a')],{})[_0x8cdd('0x20')](respondWithResult(_0x15c315,0xc9))['catch'](handleError(_0x15c315,null));};exports[_0x8cdd('0x36')]=function(_0x5a3fa5,_0xda93a8){if(_0x5a3fa5[_0x8cdd('0x5a')]['id']){delete _0x5a3fa5[_0x8cdd('0x5a')]['id'];}return db[_0x8cdd('0x50')][_0x8cdd('0x58')]({'where':{'id':_0x5a3fa5['params']['id']}})[_0x8cdd('0x20')](handleEntityNotFound(_0xda93a8,null))[_0x8cdd('0x20')](saveUpdates(_0x5a3fa5[_0x8cdd('0x5a')],null))[_0x8cdd('0x20')](respondWithResult(_0xda93a8,null))['catch'](handleError(_0xda93a8,null));};exports['destroy']=function(_0x5a9207,_0x54d7aa){return db['ChatMessage']['find']({'where':{'id':_0x5a9207[_0x8cdd('0x54')]['id']}})[_0x8cdd('0x20')](handleEntityNotFound(_0x54d7aa,null))['then'](removeEntity(_0x54d7aa,null))[_0x8cdd('0x2a')](handleError(_0x54d7aa,null));};exports[_0x8cdd('0x5b')]=function(_0x55d2eb,_0x2ea3e7){return db['ChatMessage']['describe']()[_0x8cdd('0x20')](respondWithResult(_0x2ea3e7,null))[_0x8cdd('0x2a')](handleError(_0x2ea3e7,null));};var interaction_log=require(_0x8cdd('0x5c'))(_0x8cdd('0x5d'));exports['accept']=function(_0x3add54,_0x3260dc,_0x5d4c8c){var _0x9db4d={'agent':{},'channel':_0x8cdd('0x5e')};if(_0x3add54[_0x8cdd('0x5a')]['id']){delete _0x3add54[_0x8cdd('0x5a')]['id'];}_0x3add54[_0x8cdd('0x5a')][_0x8cdd('0x5f')]=!![];_0x3add54[_0x8cdd('0x5a')][_0x8cdd('0x60')]=moment()[_0x8cdd('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x3add54[_0x8cdd('0x5a')][_0x8cdd('0x62')]=_0x3add54[_0x8cdd('0x5a')][_0x8cdd('0x62')]||_0x3add54[_0x8cdd('0x63')]['id'];_0x9db4d[_0x8cdd('0x64')]['id']=_0x3add54[_0x8cdd('0x5a')]['UserId'];return db['ChatMessage'][_0x8cdd('0x58')]({'where':{'id':_0x3add54['params']['id'],'UserId':null},'include':[{'model':db[_0x8cdd('0x65')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x3260dc,null))[_0x8cdd('0x20')](saveUpdates(_0x3add54[_0x8cdd('0x5a')],null))[_0x8cdd('0x20')](function(_0x4dee5a){if(_0x4dee5a){_0x9db4d['message']=_0x4dee5a[_0x8cdd('0x66')]({'plain':!![]});return db[_0x8cdd('0x67')][_0x8cdd('0x58')]({'where':{'id':_0x4dee5a['ChatInteractionId']}});}return null;})[_0x8cdd('0x20')](handleEntityNotFound(_0x3260dc,null))[_0x8cdd('0x20')](function(_0x535cf5){if(_0x535cf5){return _0x535cf5[_0x8cdd('0x36')]({'UserId':_0x3add54[_0x8cdd('0x5a')][_0x8cdd('0x62')],'read1stAt':_[_0x8cdd('0x68')](_0x535cf5[_0x8cdd('0x69')])?moment()[_0x8cdd('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x8cdd('0x20')](function(_0x494b42){if(_0x494b42){_0x9db4d[_0x8cdd('0x6a')]=_0x494b42[_0x8cdd('0x66')]({'plain':!![]});interaction_log['info'](_0x8cdd('0x6b'),_0x3add54[_0x8cdd('0x63')]['id'],_0x3add54['user'][_0x8cdd('0x39')],_0x3add54['user']['role'],_0x9db4d[_0x8cdd('0x6a')]['id'],_0x3add54[_0x8cdd('0x5a')]?JSON[_0x8cdd('0x24')](_0x3add54[_0x8cdd('0x5a')]):_0x8cdd('0x6c'));return respondWithRpcPromise(_0x8cdd('0x6d'),_0x8cdd('0x6e'),_0x9db4d);}return null;})[_0x8cdd('0x20')](function(_0x437657){if(_0x437657){if(_0x3add54['body'][_0x8cdd('0x6f')]){_0x9db4d[_0x8cdd('0x28')][_0x8cdd('0x70')]=util[_0x8cdd('0x61')](_0x8cdd('0x71'),_0x3add54[_0x8cdd('0x63')][_0x8cdd('0x39')]);_0x9db4d[_0x8cdd('0x28')][_0x8cdd('0x72')]=_0x9db4d[_0x8cdd('0x72')];_0x9db4d[_0x8cdd('0x28')][_0x8cdd('0x73')]=_0x8cdd('0x74');return respondWithRpcPromise(_0x8cdd('0x75'),_0x8cdd('0x75'),{'event':_0x8cdd('0x76'),'message':_['merge'](_0x9db4d[_0x8cdd('0x28')],JSON['parse'](_0x9db4d[_0x8cdd('0x6a')][_0x8cdd('0x77')]))},client9002)[_0x8cdd('0x20')](function(){return _0x9db4d;});}return _0x9db4d;}return null;})[_0x8cdd('0x20')](respondWithResult(_0x3260dc,null))['catch'](handleError(_0x3260dc,null));};var interaction_log=require(_0x8cdd('0x5c'))(_0x8cdd('0x5d'));exports[_0x8cdd('0x34')]=function(_0x1de6ff,_0x3899a0,_0x28e6c0){var _0xab20b0={'agent':{},'channel':_0x8cdd('0x5e')};if(_0x1de6ff['body']['id']){delete _0x1de6ff[_0x8cdd('0x5a')]['id'];}_0x1de6ff['body']['UserId']=_0x1de6ff[_0x8cdd('0x5a')][_0x8cdd('0x62')]||_0x1de6ff[_0x8cdd('0x63')]['id'];_0xab20b0[_0x8cdd('0x64')]['id']=_0x1de6ff[_0x8cdd('0x5a')][_0x8cdd('0x62')];return db[_0x8cdd('0x50')][_0x8cdd('0x58')]({'where':{'id':_0x1de6ff[_0x8cdd('0x54')]['id'],'UserId':null}})[_0x8cdd('0x20')](handleEntityNotFound(_0x3899a0,null))[_0x8cdd('0x20')](function(_0x1f4c47){if(_0x1f4c47){_0xab20b0[_0x8cdd('0x28')]=_0x1f4c47[_0x8cdd('0x66')]({'plain':!![]});return db[_0x8cdd('0x67')][_0x8cdd('0x58')]({'where':{'id':_0x1f4c47[_0x8cdd('0x78')]}});}return null;})[_0x8cdd('0x20')](handleEntityNotFound(_0x3899a0,null))[_0x8cdd('0x20')](function(_0x4ae189){if(_0x4ae189){_0xab20b0['interaction']=_0x4ae189['get']({'plain':!![]});interaction_log['info'](_0x8cdd('0x79'),_0x1de6ff['user']['id'],_0x1de6ff[_0x8cdd('0x63')]['name'],_0x1de6ff[_0x8cdd('0x63')][_0x8cdd('0x7a')],_0xab20b0[_0x8cdd('0x6a')]['id'],_0x1de6ff[_0x8cdd('0x5a')]?JSON[_0x8cdd('0x24')](_0x1de6ff[_0x8cdd('0x5a')]):_0x8cdd('0x6c'));return respondWithRpcPromise('RejectMessage',_0x8cdd('0x7b'),_0xab20b0);}return null;})['then'](function(_0x5c399d){if(_0x5c399d){_0x5c399d[_0x8cdd('0x28')][_0x8cdd('0x70')]=util[_0x8cdd('0x61')](_0x8cdd('0x71'),_0x1de6ff[_0x8cdd('0x63')][_0x8cdd('0x39')]);_0x5c399d[_0x8cdd('0x28')]['channel']=_0xab20b0[_0x8cdd('0x72')];_0x5c399d[_0x8cdd('0x28')]['event']=_0x8cdd('0x34');respondWithRpcPromise(_0x8cdd('0x75'),_0x8cdd('0x75'),{'event':'rejectmessage','message':_0x5c399d['message']},client9002);return _0xab20b0;}return null;})['then'](respondWithResult(_0x3899a0,null))['catch'](handleError(_0x3899a0,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 667b044..7b77793 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 _0xcba9=['hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','update','emit'];(function(_0x20e81e,_0x2ad41f){var _0x3e6654=function(_0x3f2904){while(--_0x3f2904){_0x20e81e['push'](_0x20e81e['shift']());}};_0x3e6654(++_0x2ad41f);}(_0xcba9,0x72));var _0x9cba=function(_0x1afc73,_0x1e3ecb){_0x1afc73=_0x1afc73-0x0;var _0x23f0d2=_0xcba9[_0x1afc73];return _0x23f0d2;};'use strict';var EventEmitter=require(_0x9cba('0x0'));var ChatMessage=require(_0x9cba('0x1'))['db'][_0x9cba('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x9cba('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9cba('0x4'),'afterDestroy':'remove'};function emitEvent(_0x51ff86){return function(_0x58d1cd,_0x18392b,_0x43ccad){ChatMessageEvents[_0x9cba('0x5')](_0x51ff86+':'+_0x58d1cd['id'],_0x58d1cd);ChatMessageEvents['emit'](_0x51ff86,_0x58d1cd);_0x43ccad(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x9cba('0x6')](e,emitEvent(event));}}module[_0x9cba('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x9cef=['events','ChatMessage','save','update','remove','emit','hook'];(function(_0x299655,_0x1cc80e){var _0xdd4ca8=function(_0x5f3259){while(--_0x5f3259){_0x299655['push'](_0x299655['shift']());}};_0xdd4ca8(++_0x1cc80e);}(_0x9cef,0xd9));var _0xf9ce=function(_0x480a51,_0x3aecea){_0x480a51=_0x480a51-0x0;var _0x19673b=_0x9cef[_0x480a51];return _0x19673b;};'use strict';var EventEmitter=require(_0xf9ce('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xf9ce('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf9ce('0x2'),'afterUpdate':_0xf9ce('0x3'),'afterDestroy':_0xf9ce('0x4')};function emitEvent(_0x567666){return function(_0x48ad3d,_0x594322,_0x3cafc6){ChatMessageEvents['emit'](_0x567666+':'+_0x48ad3d['id'],_0x48ad3d);ChatMessageEvents[_0xf9ce('0x5')](_0x567666,_0x48ad3d);_0x3cafc6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xf9ce('0x6')](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 82f96d0..619931a 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 _0xaf0a=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes','exports','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','ChatInteractionId','update','createdAt','catch','error','utf8mb4'];(function(_0x41fccf,_0x5eb805){var _0x385109=function(_0x212e7e){while(--_0x212e7e){_0x41fccf['push'](_0x41fccf['shift']());}};_0x385109(++_0x5eb805);}(_0xaf0a,0xd3));var _0xaaf0=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xaf0a[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xaaf0('0x0'));var util=require(_0xaaf0('0x1'));var logger=require(_0xaaf0('0x2'))(_0xaaf0('0x3'));var moment=require(_0xaaf0('0x4'));var BPromise=require(_0xaaf0('0x5'));var rp=require(_0xaaf0('0x6'));var fs=require('fs');var path=require(_0xaaf0('0x7'));var rimraf=require(_0xaaf0('0x8'));var config=require('../../config/environment');var attributes=require(_0xaaf0('0x9'));module[_0xaaf0('0xa')]=function(_0x366a1c,_0x4523fa){return _0x366a1c['define']('ChatMessage',attributes,{'tableName':_0xaaf0('0xb'),'paranoid':![],'indexes':[{'name':_0xaaf0('0xc'),'fields':[_0xaaf0('0xd')],'type':_0xaaf0('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x49fdcb,_0x16ea73,_0x4053fd){var _0xab6f5b=_0x366a1c[_0xaaf0('0xf')];var _0x5b99b0=_0x49fdcb[_0xaaf0('0x10')]({'plain':!![]});if(_0x5b99b0[_0xaaf0('0x11')][_0xaaf0('0x12')]()==='in'||_0x5b99b0[_0xaaf0('0x11')]['toLowerCase']()==='out'&&!_0x5b99b0[_0xaaf0('0x13')]&&!_[_0xaaf0('0x14')](_0x5b99b0[_0xaaf0('0x15')])){_0xab6f5b[_0xaaf0('0x16')]['findOne']({'where':{'id':_0x5b99b0[_0xaaf0('0x17')]}})['then'](function(_0x1fac88){if(_0x1fac88){_0x1fac88[_0xaaf0('0x18')]({'lastMsgAt':_0x5b99b0[_0xaaf0('0x19')],'lastMsgDirection':_0x5b99b0[_0xaaf0('0x11')][_0xaaf0('0x12')]()});}})[_0xaaf0('0x1a')](function(_0x2fec71){console[_0xaaf0('0x1b')](_0x2fec71);});}_0x4053fd();}},'charset':_0xaaf0('0x1c'),'collate':_0xaaf0('0x1d')});}; \ No newline at end of file +var _0x7044=['findOne','ChatInteractionId','then','update','createdAt','toLowerCase','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','out','secret','isNil','UserId','ChatInteraction'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x7044,0xd0));var _0x4704=function(_0xb0ef57,_0x22011d){_0xb0ef57=_0xb0ef57-0x0;var _0x3ddf63=_0x7044[_0xb0ef57];return _0x3ddf63;};'use strict';var _=require(_0x4704('0x0'));var util=require(_0x4704('0x1'));var logger=require(_0x4704('0x2'))(_0x4704('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4704('0x4'));var fs=require('fs');var path=require(_0x4704('0x5'));var rimraf=require(_0x4704('0x6'));var config=require(_0x4704('0x7'));var attributes=require(_0x4704('0x8'));module[_0x4704('0x9')]=function(_0x357dcf,_0x4ef5a6){return _0x357dcf[_0x4704('0xa')](_0x4704('0xb'),attributes,{'tableName':_0x4704('0xc'),'paranoid':![],'indexes':[{'name':_0x4704('0xd'),'fields':[_0x4704('0xe')],'type':_0x4704('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3db52f,_0x2844b0,_0xd1fbf1){var _0x3e1f60=_0x357dcf[_0x4704('0x10')];var _0x1f6c6f=_0x3db52f['get']({'plain':!![]});if(_0x1f6c6f['direction']['toLowerCase']()==='in'||_0x1f6c6f[_0x4704('0x11')]['toLowerCase']()===_0x4704('0x12')&&!_0x1f6c6f[_0x4704('0x13')]&&!_[_0x4704('0x14')](_0x1f6c6f[_0x4704('0x15')])){_0x3e1f60[_0x4704('0x16')][_0x4704('0x17')]({'where':{'id':_0x1f6c6f[_0x4704('0x18')]}})[_0x4704('0x19')](function(_0x32bd66){if(_0x32bd66){_0x32bd66[_0x4704('0x1a')]({'lastMsgAt':_0x1f6c6f[_0x4704('0x1b')],'lastMsgDirection':_0x1f6c6f[_0x4704('0x11')][_0x4704('0x1c')]()});}})[_0x4704('0x1d')](function(_0x4c831a){console[_0x4704('0x1e')](_0x4c831a);});}_0xd1fbf1();}},'charset':_0x4704('0x1f'),'collate':_0x4704('0x20')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 79d3827..3700f63 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 _0x9a66=['register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateChatMessage','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter'];(function(_0x1d66fc,_0x1da8ad){var _0x5fa21e=function(_0x5d0d3f){while(--_0x5d0d3f){_0x1d66fc['push'](_0x1d66fc['shift']());}};_0x5fa21e(++_0x1da8ad);}(_0x9a66,0x10a));var _0x69a6=function(_0x4f1492,_0x40f6fd){_0x4f1492=_0x4f1492-0x0;var _0x49aa60=_0x9a66[_0x4f1492];return _0x49aa60;};'use strict';var _=require(_0x69a6('0x0'));var util=require(_0x69a6('0x1'));var moment=require(_0x69a6('0x2'));var BPromise=require(_0x69a6('0x3'));var rs=require(_0x69a6('0x4'));var fs=require('fs');var Redis=require(_0x69a6('0x5'));var db=require(_0x69a6('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x69a6('0x7'));var config=require(_0x69a6('0x8'));var jayson=require(_0x69a6('0x9'));var client=jayson['client'][_0x69a6('0xa')]({'port':0x232a});config[_0x69a6('0xb')]=_[_0x69a6('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x69a6('0xd'))(new Redis(config[_0x69a6('0xb')]));require('./chatMessage.socket')[_0x69a6('0xe')](socket);function respondWithRpcPromise(_0x5c66e0,_0x326f08,_0x42f8d4){return new BPromise(function(_0x4f3d79,_0x412896){return client[_0x69a6('0xf')](_0x5c66e0,_0x42f8d4)[_0x69a6('0x10')](function(_0x48382a){logger['info'](_0x69a6('0x11'),_0x326f08,_0x69a6('0x12'));logger['debug'](_0x69a6('0x13'),_0x326f08,'request\x20sent',JSON[_0x69a6('0x14')](_0x48382a));if(_0x48382a[_0x69a6('0x15')]){if(_0x48382a[_0x69a6('0x15')]['code']===0x1f4){logger[_0x69a6('0x15')](_0x69a6('0x11'),_0x326f08,_0x48382a[_0x69a6('0x15')][_0x69a6('0x16')]);return _0x412896(_0x48382a[_0x69a6('0x15')][_0x69a6('0x16')]);}logger[_0x69a6('0x15')](_0x69a6('0x11'),_0x326f08,_0x48382a[_0x69a6('0x15')]['message']);return _0x4f3d79(_0x48382a[_0x69a6('0x15')][_0x69a6('0x16')]);}else{logger[_0x69a6('0x17')]('ChatMessage,\x20%s,\x20%s',_0x326f08,_0x69a6('0x12'));_0x4f3d79(_0x48382a[_0x69a6('0x18')][_0x69a6('0x16')]);}})[_0x69a6('0x19')](function(_0x136a1a){logger[_0x69a6('0x15')](_0x69a6('0x11'),_0x326f08,_0x136a1a);_0x412896(_0x136a1a);});});}exports[_0x69a6('0x1a')]=function(_0x5ea820){var _0x2a3aba=this;return new Promise(function(_0x2fe110,_0x1221c4){return db['ChatMessage']['create'](_0x5ea820['body'],{'raw':_0x5ea820['options']?_0x5ea820['options']['raw']===undefined?!![]:![]:!![]})[_0x69a6('0x10')](function(_0x4bc716){logger[_0x69a6('0x17')](_0x69a6('0x1a'),_0x5ea820);logger[_0x69a6('0x1b')]('CreateChatMessage',_0x5ea820,JSON['stringify'](_0x4bc716));_0x2fe110(_0x4bc716);})[_0x69a6('0x19')](function(_0x3d26de){logger[_0x69a6('0x15')](_0x69a6('0x1a'),_0x3d26de[_0x69a6('0x16')],_0x5ea820);_0x1221c4(_0x2a3aba[_0x69a6('0x15')](0x1f4,_0x3d26de['message']));});});}; \ No newline at end of file +var _0xe6d5=['http','localhost','socket.io-emitter','redis','register','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','CreateChatMessage','ChatMessage','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3ce0e2,_0x3ca132){var _0x36fb36=function(_0x24fd4c){while(--_0x24fd4c){_0x3ce0e2['push'](_0x3ce0e2['shift']());}};_0x36fb36(++_0x3ca132);}(_0xe6d5,0xcd));var _0x5e6d=function(_0x44a3b0,_0x352810){_0x44a3b0=_0x44a3b0-0x0;var _0x39e6f6=_0xe6d5[_0x44a3b0];return _0x39e6f6;};'use strict';var _=require(_0x5e6d('0x0'));var util=require(_0x5e6d('0x1'));var moment=require(_0x5e6d('0x2'));var BPromise=require(_0x5e6d('0x3'));var rs=require(_0x5e6d('0x4'));var fs=require('fs');var Redis=require(_0x5e6d('0x5'));var db=require(_0x5e6d('0x6'))['db'];var utils=require(_0x5e6d('0x7'));var logger=require(_0x5e6d('0x8'))('rpc');var config=require(_0x5e6d('0x9'));var jayson=require(_0x5e6d('0xa'));var client=jayson[_0x5e6d('0xb')][_0x5e6d('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x5e6d('0xd'),'port':0x18eb});var socket=require(_0x5e6d('0xe'))(new Redis(config[_0x5e6d('0xf')]));require('./chatMessage.socket')[_0x5e6d('0x10')](socket);function respondWithRpcPromise(_0x51e6ea,_0x28dc52,_0x2b7bcb){return new BPromise(function(_0x427dfb,_0x1e77c7){return client[_0x5e6d('0x11')](_0x51e6ea,_0x2b7bcb)[_0x5e6d('0x12')](function(_0x53dc51){logger[_0x5e6d('0x13')]('ChatMessage,\x20%s,\x20%s',_0x28dc52,_0x5e6d('0x14'));logger[_0x5e6d('0x15')](_0x5e6d('0x16'),_0x28dc52,_0x5e6d('0x14'),JSON[_0x5e6d('0x17')](_0x53dc51));if(_0x53dc51[_0x5e6d('0x18')]){if(_0x53dc51[_0x5e6d('0x18')]['code']===0x1f4){logger['error'](_0x5e6d('0x19'),_0x28dc52,_0x53dc51['error'][_0x5e6d('0x1a')]);return _0x1e77c7(_0x53dc51[_0x5e6d('0x18')][_0x5e6d('0x1a')]);}logger[_0x5e6d('0x18')](_0x5e6d('0x19'),_0x28dc52,_0x53dc51[_0x5e6d('0x18')]['message']);return _0x427dfb(_0x53dc51['error'][_0x5e6d('0x1a')]);}else{logger[_0x5e6d('0x13')](_0x5e6d('0x19'),_0x28dc52,'request\x20sent');_0x427dfb(_0x53dc51['result']['message']);}})['catch'](function(_0x20e0fd){logger[_0x5e6d('0x18')](_0x5e6d('0x19'),_0x28dc52,_0x20e0fd);_0x1e77c7(_0x20e0fd);});});}exports[_0x5e6d('0x1b')]=function(_0x572490){var _0x4064c1=this;return new Promise(function(_0x5f2027,_0xb53512){return db[_0x5e6d('0x1c')]['create'](_0x572490['body'],{'raw':_0x572490[_0x5e6d('0x1d')]?_0x572490['options'][_0x5e6d('0x1e')]===undefined?!![]:![]:!![]})[_0x5e6d('0x12')](function(_0x56421c){logger[_0x5e6d('0x13')]('CreateChatMessage',_0x572490);logger[_0x5e6d('0x15')](_0x5e6d('0x1b'),_0x572490,JSON[_0x5e6d('0x17')](_0x56421c));_0x5f2027(_0x56421c);})['catch'](function(_0x4ea4a9){logger[_0x5e6d('0x18')](_0x5e6d('0x1b'),_0x4ea4a9[_0x5e6d('0x1a')],_0x572490);_0xb53512(_0x4064c1[_0x5e6d('0x18')](0x1f4,_0x4ea4a9['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 619e747..bc6a307 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 _0xd117=['save','remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events'];(function(_0x5237fa,_0x3f9c94){var _0x5c295f=function(_0x15c47b){while(--_0x15c47b){_0x5237fa['push'](_0x5237fa['shift']());}};_0x5c295f(++_0x3f9c94);}(_0xd117,0x182));var _0x7d11=function(_0x2d36a6,_0x2f8cd0){_0x2d36a6=_0x2d36a6-0x0;var _0x59cec0=_0xd117[_0x2d36a6];return _0x59cec0;};'use strict';var ChatMessageEvents=require(_0x7d11('0x0'));var events=[_0x7d11('0x1'),_0x7d11('0x2'),_0x7d11('0x3')];function createListener(_0x454387,_0x26e0f0){return function(_0x306ae4){_0x26e0f0[_0x7d11('0x4')](_0x454387,_0x306ae4);};}function removeListener(_0x3c07be,_0x31fcb0){return function(){ChatMessageEvents[_0x7d11('0x5')](_0x3c07be,_0x31fcb0);};}exports[_0x7d11('0x6')]=function(_0x27d7e8){for(var _0x40c3c4=0x0,_0x345602=events[_0x7d11('0x7')];_0x40c3c4<_0x345602;_0x40c3c4++){var _0x47b5e6=events[_0x40c3c4];var _0x3803b5=createListener(_0x7d11('0x8')+_0x47b5e6,_0x27d7e8);ChatMessageEvents['on'](_0x47b5e6,_0x3803b5);}}; \ No newline at end of file +var _0xfdbd=['removeListener','chatMessage:','./chatMessage.events','save','remove','update','emit'];(function(_0x42a8b1,_0x4fef9c){var _0x2d7dcd=function(_0x220513){while(--_0x220513){_0x42a8b1['push'](_0x42a8b1['shift']());}};_0x2d7dcd(++_0x4fef9c);}(_0xfdbd,0xf0));var _0xdfdb=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0xfdbd[_0xbe40ad];return _0x50fac9;};'use strict';var ChatMessageEvents=require(_0xdfdb('0x0'));var events=[_0xdfdb('0x1'),_0xdfdb('0x2'),_0xdfdb('0x3')];function createListener(_0x28f05d,_0x3078f0){return function(_0x11218a){_0x3078f0[_0xdfdb('0x4')](_0x28f05d,_0x11218a);};}function removeListener(_0x330ad3,_0x5945e0){return function(){ChatMessageEvents[_0xdfdb('0x5')](_0x330ad3,_0x5945e0);};}exports['register']=function(_0x453ef6){for(var _0x41bd5e=0x0,_0x489f19=events['length'];_0x41bd5e<_0x489f19;_0x41bd5e++){var _0x590b5d=events[_0x41bd5e];var _0x188508=createListener(_0xdfdb('0x6')+_0x590b5d,_0x453ef6);ChatMessageEvents['on'](_0x590b5d,_0x188508);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 37fa6b7..e13e801 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 _0x6156=['/:id/accept','accept','/:id/reject','reject','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','post','tracked','chat','chatmessage:create','create','put','/:id'];(function(_0x542c11,_0x35d5df){var _0xd5ba30=function(_0x352bff){while(--_0x352bff){_0x542c11['push'](_0x542c11['shift']());}};_0xd5ba30(++_0x35d5df);}(_0x6156,0x109));var _0x6615=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x6156[_0x231e16];return _0x570a7c;};'use strict';var multer=require(_0x6615('0x0'));var util=require(_0x6615('0x1'));var path=require(_0x6615('0x2'));var timeout=require(_0x6615('0x3'));var express=require(_0x6615('0x4'));var router=express[_0x6615('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x6615('0x6'));var config=require(_0x6615('0x7'));var controller=require(_0x6615('0x8'));router[_0x6615('0x9')]('/',auth[_0x6615('0xa')](),controller[_0x6615('0xb')]);router[_0x6615('0x9')](_0x6615('0xc'),auth[_0x6615('0xa')](),controller[_0x6615('0xd')]);router[_0x6615('0x9')]('/:id',auth[_0x6615('0xa')](),controller['show']);router[_0x6615('0xe')]('/',auth[_0x6615('0xa')](),interaction[_0x6615('0xf')](_0x6615('0x10'),_0x6615('0x11')),controller[_0x6615('0x12')]);router[_0x6615('0x13')](_0x6615('0x14'),controller['update']);router['put'](_0x6615('0x15'),auth['isAuthenticated'](),controller[_0x6615('0x16')]);router[_0x6615('0x13')](_0x6615('0x17'),auth[_0x6615('0xa')](),controller[_0x6615('0x18')]);router['delete'](_0x6615('0x14'),auth[_0x6615('0xa')](),controller['destroy']);module[_0x6615('0x19')]=router; \ No newline at end of file +var _0x9e58=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','update','put','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x50b0d3,_0x289142){var _0x41118f=function(_0x431b98){while(--_0x431b98){_0x50b0d3['push'](_0x50b0d3['shift']());}};_0x41118f(++_0x289142);}(_0x9e58,0xfc));var _0x89e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e58[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x89e5('0x0'));var path=require(_0x89e5('0x1'));var timeout=require(_0x89e5('0x2'));var express=require(_0x89e5('0x3'));var router=express['Router']();var auth=require(_0x89e5('0x4'));var interaction=require(_0x89e5('0x5'));var config=require(_0x89e5('0x6'));var controller=require(_0x89e5('0x7'));router[_0x89e5('0x8')]('/',auth[_0x89e5('0x9')](),controller[_0x89e5('0xa')]);router[_0x89e5('0x8')](_0x89e5('0xb'),auth[_0x89e5('0x9')](),controller[_0x89e5('0xc')]);router[_0x89e5('0x8')](_0x89e5('0xd'),auth[_0x89e5('0x9')](),controller[_0x89e5('0xe')]);router[_0x89e5('0xf')]('/',auth['isAuthenticated'](),interaction[_0x89e5('0x10')](_0x89e5('0x11'),_0x89e5('0x12')),controller[_0x89e5('0x13')]);router['put'](_0x89e5('0xd'),controller[_0x89e5('0x14')]);router[_0x89e5('0x15')]('/:id/accept',auth[_0x89e5('0x9')](),controller[_0x89e5('0x16')]);router[_0x89e5('0x15')](_0x89e5('0x17'),auth['isAuthenticated'](),controller[_0x89e5('0x18')]);router[_0x89e5('0x19')]('/:id',auth[_0x89e5('0x9')](),controller[_0x89e5('0x1a')]);module[_0x89e5('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index b475015..78724cc 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 _0xe13f=['sequelize','TEXT'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xe13f,0x1ca));var _0xfe13=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xe13f[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0xfe13('0x0'));module['exports']={'body':{'type':Sequelize[_0xfe13('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0xe9c1=['TEXT','medium'];(function(_0x5b0135,_0x50ce54){var _0x372c9d=function(_0x106963){while(--_0x106963){_0x5b0135['push'](_0x5b0135['shift']());}};_0x372c9d(++_0x50ce54);}(_0xe9c1,0x1e0));var _0x1e9c=function(_0x1eec33,_0x529d1d){_0x1eec33=_0x1eec33-0x0;var _0x50c904=_0xe9c1[_0x1eec33];return _0x50c904;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x1e9c('0x0')](_0x1e9c('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 4520e3b..b78b372 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 _0x19f6=['include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','status','set','Content-Range','reject','save','then','destroy','stack','name','send','index','map','ChatOfflineMessage','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','merge','VIRTUAL','options'];(function(_0x470d01,_0x7729a5){var _0x10be53=function(_0x177e3f){while(--_0x177e3f){_0x470d01['push'](_0x470d01['shift']());}};_0x10be53(++_0x7729a5);}(_0x19f6,0x1ce));var _0x619f=function(_0x200482,_0x57df38){_0x200482=_0x200482-0x0;var _0x66a253=_0x19f6[_0x200482];return _0x66a253;};'use strict';var pdf=require(_0x619f('0x0'));var emlformat=require(_0x619f('0x1'));var rimraf=require(_0x619f('0x2'));var zipdir=require(_0x619f('0x3'));var jsonpatch=require(_0x619f('0x4'));var rp=require(_0x619f('0x5'));var moment=require(_0x619f('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x619f('0x7'));var util=require(_0x619f('0x8'));var path=require('path');var sox=require(_0x619f('0x9'));var csv=require('to-csv');var ejs=require(_0x619f('0xa'));var fs=require('fs');var _=require(_0x619f('0xb'));var squel=require(_0x619f('0xc'));var crypto=require(_0x619f('0xd'));var jsforce=require(_0x619f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x619f('0xf'));var querystring=require(_0x619f('0x10'));var Papa=require('papaparse');var Redis=require(_0x619f('0x11'));var authService=require(_0x619f('0x12'));var qs=require(_0x619f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x619f('0x14'));var logger=require(_0x619f('0x15'))(_0x619f('0x16'));var utils=require(_0x619f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x619f('0x18'));var db=require(_0x619f('0x19'))['db'];function respondWithStatusCode(_0x53fc02,_0x50b4fc){_0x50b4fc=_0x50b4fc||0xcc;return function(_0x5753de){if(_0x5753de){return _0x53fc02[_0x619f('0x1a')](_0x50b4fc);}return _0x53fc02['status'](_0x50b4fc)[_0x619f('0x1b')]();};}function respondWithResult(_0x2fbf5f,_0x5d3498){_0x5d3498=_0x5d3498||0xc8;return function(_0x3d17e8){if(_0x3d17e8){return _0x2fbf5f['status'](_0x5d3498)[_0x619f('0x1c')](_0x3d17e8);}};}function respondWithFilteredResult(_0x481439,_0x4a9530){return function(_0x2d139a){if(_0x2d139a){var _0x1d4785=_0x2d139a[_0x619f('0x1d')],_0x4b8f5a=_0x4a9530[_0x619f('0x1e')],_0x3f0cd8=_0x4a9530[_0x619f('0x1e')]+_0x4a9530['limit'],_0x41bcd4;if(_0x3f0cd8>=_0x1d4785){_0x3f0cd8=_0x1d4785;_0x41bcd4=0xc8;}else{_0x41bcd4=0xce;}_0x481439[_0x619f('0x1f')](_0x41bcd4);return _0x481439[_0x619f('0x20')](_0x619f('0x21'),_0x4b8f5a+'-'+_0x3f0cd8+'/'+_0x1d4785)[_0x619f('0x1c')](_0x2d139a);}return null;};}function patchUpdates(_0x4ec265){return function(_0x157916){try{jsonpatch['apply'](_0x157916,_0x4ec265,!![]);}catch(_0x27e8c3){return BPromise[_0x619f('0x22')](_0x27e8c3);}return _0x157916[_0x619f('0x23')]();};}function saveUpdates(_0x148443,_0xae6263){return function(_0x5b460d){if(_0x5b460d){return _0x5b460d['update'](_0x148443)[_0x619f('0x24')](function(_0x530189){return _0x530189;});}return null;};}function removeEntity(_0x36497f,_0x45a8ab){return function(_0x4598f6){if(_0x4598f6){return _0x4598f6[_0x619f('0x25')]()[_0x619f('0x24')](function(){_0x36497f[_0x619f('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49c391,_0x2184dd){return function(_0x346799){if(!_0x346799){_0x49c391[_0x619f('0x1a')](0x194);}return _0x346799;};}function handleError(_0x41fafd,_0xe8b700){_0xe8b700=_0xe8b700||0x1f4;return function(_0x2df559){logger['error'](_0x2df559[_0x619f('0x26')]);if(_0x2df559[_0x619f('0x27')]){delete _0x2df559['name'];}_0x41fafd[_0x619f('0x1f')](_0xe8b700)[_0x619f('0x28')](_0x2df559);};}exports[_0x619f('0x29')]=function(_0x3f3ed9,_0x1ed6bb){var _0x15ef7b={},_0x24937a={},_0x643d84={'count':0x0,'rows':[]};var _0x2e81e7=_[_0x619f('0x2a')](db[_0x619f('0x2b')]['rawAttributes'],function(_0x188411){return{'name':_0x188411[_0x619f('0x2c')],'type':_0x188411[_0x619f('0x2d')][_0x619f('0x2e')]};});_0x24937a[_0x619f('0x2f')]=_[_0x619f('0x2a')](_0x2e81e7,_0x619f('0x27'));_0x24937a[_0x619f('0x30')]=_['keys'](_0x3f3ed9['query']);_0x24937a[_0x619f('0x31')]=_[_0x619f('0x32')](_0x24937a[_0x619f('0x2f')],_0x24937a[_0x619f('0x30')]);_0x15ef7b[_0x619f('0x33')]=_[_0x619f('0x32')](_0x24937a['model'],qs[_0x619f('0x34')](_0x3f3ed9[_0x619f('0x30')][_0x619f('0x34')]));_0x15ef7b[_0x619f('0x33')]=_0x15ef7b[_0x619f('0x33')][_0x619f('0x35')]?_0x15ef7b[_0x619f('0x33')]:_0x24937a['model'];if(!_0x3f3ed9['query'][_0x619f('0x36')](_0x619f('0x37'))){_0x15ef7b[_0x619f('0x38')]=qs[_0x619f('0x38')](_0x3f3ed9[_0x619f('0x30')][_0x619f('0x38')]);_0x15ef7b['offset']=qs['offset'](_0x3f3ed9[_0x619f('0x30')][_0x619f('0x1e')]);}_0x15ef7b['order']=qs[_0x619f('0x39')](_0x3f3ed9[_0x619f('0x30')][_0x619f('0x39')]);_0x15ef7b['where']=qs[_0x619f('0x31')](_[_0x619f('0x3a')](_0x3f3ed9[_0x619f('0x30')],_0x24937a[_0x619f('0x31')]),_0x2e81e7);if(_0x3f3ed9[_0x619f('0x30')][_0x619f('0x3b')]){_0x15ef7b['where']=_[_0x619f('0x3c')](_0x15ef7b['where'],{'$or':_[_0x619f('0x2a')](_0x2e81e7,function(_0x1bb4d1){if(_0x1bb4d1[_0x619f('0x2d')]!==_0x619f('0x3d')){var _0x21daaa={};_0x21daaa[_0x1bb4d1[_0x619f('0x27')]]={'$like':'%'+_0x3f3ed9[_0x619f('0x30')][_0x619f('0x3b')]+'%'};return _0x21daaa;}})});}_0x15ef7b=_['merge']({},_0x15ef7b,_0x3f3ed9[_0x619f('0x3e')]);var _0x5c5b3e={'where':_0x15ef7b['where']};return db['ChatOfflineMessage']['count'](_0x5c5b3e)[_0x619f('0x24')](function(_0xe08d18){_0x643d84[_0x619f('0x1d')]=_0xe08d18;if(_0x3f3ed9['query']['includeAll']){_0x15ef7b[_0x619f('0x3f')]=[{'all':!![]}];}return db[_0x619f('0x2b')][_0x619f('0x40')](_0x15ef7b);})[_0x619f('0x24')](function(_0x2f998f){_0x643d84[_0x619f('0x41')]=_0x2f998f;return _0x643d84;})[_0x619f('0x24')](respondWithFilteredResult(_0x1ed6bb,_0x15ef7b))[_0x619f('0x42')](handleError(_0x1ed6bb,null));};exports[_0x619f('0x43')]=function(_0xf6d6aa,_0x13bfb7){var _0x2a340d={'raw':!![],'where':{'id':_0xf6d6aa[_0x619f('0x44')]['id']}},_0x3bc731={};_0x3bc731[_0x619f('0x2f')]=_['keys'](db[_0x619f('0x2b')]['rawAttributes']);_0x3bc731[_0x619f('0x30')]=_[_0x619f('0x45')](_0xf6d6aa['query']);_0x3bc731[_0x619f('0x31')]=_[_0x619f('0x32')](_0x3bc731[_0x619f('0x2f')],_0x3bc731[_0x619f('0x30')]);_0x2a340d['attributes']=_['intersection'](_0x3bc731[_0x619f('0x2f')],qs[_0x619f('0x34')](_0xf6d6aa['query'][_0x619f('0x34')]));_0x2a340d[_0x619f('0x33')]=_0x2a340d[_0x619f('0x33')][_0x619f('0x35')]?_0x2a340d[_0x619f('0x33')]:_0x3bc731[_0x619f('0x2f')];if(_0xf6d6aa[_0x619f('0x30')][_0x619f('0x46')]){_0x2a340d['include']=[{'all':!![]}];}_0x2a340d=_[_0x619f('0x3c')]({},_0x2a340d,_0xf6d6aa[_0x619f('0x3e')]);return db[_0x619f('0x2b')][_0x619f('0x47')](_0x2a340d)[_0x619f('0x24')](handleEntityNotFound(_0x13bfb7,null))[_0x619f('0x24')](respondWithResult(_0x13bfb7,null))['catch'](handleError(_0x13bfb7,null));};exports[_0x619f('0x48')]=function(_0x4a739d,_0x18c9a4){return db[_0x619f('0x2b')]['create'](_0x4a739d[_0x619f('0x49')],{})[_0x619f('0x24')](respondWithResult(_0x18c9a4,0xc9))['catch'](handleError(_0x18c9a4,null));};exports['update']=function(_0x3f1108,_0x30ba0e){if(_0x3f1108[_0x619f('0x49')]['id']){delete _0x3f1108[_0x619f('0x49')]['id'];}return db[_0x619f('0x2b')][_0x619f('0x47')]({'where':{'id':_0x3f1108[_0x619f('0x44')]['id']}})[_0x619f('0x24')](handleEntityNotFound(_0x30ba0e,null))[_0x619f('0x24')](saveUpdates(_0x3f1108[_0x619f('0x49')],null))[_0x619f('0x24')](respondWithResult(_0x30ba0e,null))[_0x619f('0x42')](handleError(_0x30ba0e,null));};exports['destroy']=function(_0x4c37dc,_0x39b0d8){return db[_0x619f('0x2b')]['find']({'where':{'id':_0x4c37dc[_0x619f('0x44')]['id']}})[_0x619f('0x24')](handleEntityNotFound(_0x39b0d8,null))[_0x619f('0x24')](removeEntity(_0x39b0d8,null))['catch'](handleError(_0x39b0d8,null));};exports[_0x619f('0x4a')]=function(_0x58f53a,_0x4143c6){return db[_0x619f('0x2b')][_0x619f('0x4a')]()[_0x619f('0x24')](respondWithResult(_0x4143c6,null))[_0x619f('0x42')](handleError(_0x4143c6,null));}; \ No newline at end of file +var _0x7aa0=['catch','show','params','find','create','body','update','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','set','apply','save','then','end','sendStatus','error','name','index','map','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','rows'];(function(_0x5b0ebc,_0x9bb654){var _0x3a27ba=function(_0x4aa556){while(--_0x4aa556){_0x5b0ebc['push'](_0x5b0ebc['shift']());}};_0x3a27ba(++_0x9bb654);}(_0x7aa0,0xa1));var _0x07aa=function(_0xd33602,_0x19a74d){_0xd33602=_0xd33602-0x0;var _0x4f6f3b=_0x7aa0[_0xd33602];return _0x4f6f3b;};'use strict';var pdf=require(_0x07aa('0x0'));var emlformat=require(_0x07aa('0x1'));var rimraf=require(_0x07aa('0x2'));var zipdir=require(_0x07aa('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x07aa('0x4'));var BPromise=require(_0x07aa('0x5'));var Mustache=require(_0x07aa('0x6'));var util=require(_0x07aa('0x7'));var path=require(_0x07aa('0x8'));var sox=require(_0x07aa('0x9'));var csv=require('to-csv');var ejs=require(_0x07aa('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x07aa('0xb'));var crypto=require('crypto');var jsforce=require(_0x07aa('0xc'));var deskjs=require(_0x07aa('0xd'));var toCsv=require(_0x07aa('0xe'));var querystring=require(_0x07aa('0xf'));var Papa=require(_0x07aa('0x10'));var Redis=require(_0x07aa('0x11'));var authService=require(_0x07aa('0x12'));var qs=require(_0x07aa('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x07aa('0x14'));var logger=require('../../config/logger')(_0x07aa('0x15'));var utils=require(_0x07aa('0x16'));var config=require(_0x07aa('0x17'));var licenseUtil=require(_0x07aa('0x18'));var db=require(_0x07aa('0x19'))['db'];function respondWithStatusCode(_0x56e8d6,_0x3fb3ad){_0x3fb3ad=_0x3fb3ad||0xcc;return function(_0x82b55a){if(_0x82b55a){return _0x56e8d6['sendStatus'](_0x3fb3ad);}return _0x56e8d6[_0x07aa('0x1a')](_0x3fb3ad)['end']();};}function respondWithResult(_0x32df91,_0x54d592){_0x54d592=_0x54d592||0xc8;return function(_0x1d358c){if(_0x1d358c){return _0x32df91[_0x07aa('0x1a')](_0x54d592)[_0x07aa('0x1b')](_0x1d358c);}};}function respondWithFilteredResult(_0x4b96b3,_0x59028c){return function(_0x2d1b51){if(_0x2d1b51){var _0x986040=_0x2d1b51['count'],_0x41c0ca=_0x59028c[_0x07aa('0x1c')],_0xe6ff5f=_0x59028c[_0x07aa('0x1c')]+_0x59028c['limit'],_0x1bf857;if(_0xe6ff5f>=_0x986040){_0xe6ff5f=_0x986040;_0x1bf857=0xc8;}else{_0x1bf857=0xce;}_0x4b96b3[_0x07aa('0x1a')](_0x1bf857);return _0x4b96b3[_0x07aa('0x1d')]('Content-Range',_0x41c0ca+'-'+_0xe6ff5f+'/'+_0x986040)[_0x07aa('0x1b')](_0x2d1b51);}return null;};}function patchUpdates(_0x1177ce){return function(_0x33fd2b){try{jsonpatch[_0x07aa('0x1e')](_0x33fd2b,_0x1177ce,!![]);}catch(_0xd18462){return BPromise['reject'](_0xd18462);}return _0x33fd2b[_0x07aa('0x1f')]();};}function saveUpdates(_0x517ea1,_0x32e63b){return function(_0x345b38){if(_0x345b38){return _0x345b38['update'](_0x517ea1)['then'](function(_0x3b0b8e){return _0x3b0b8e;});}return null;};}function removeEntity(_0x29e4f0,_0x39087d){return function(_0xd94526){if(_0xd94526){return _0xd94526['destroy']()[_0x07aa('0x20')](function(){_0x29e4f0[_0x07aa('0x1a')](0xcc)[_0x07aa('0x21')]();});}};}function handleEntityNotFound(_0x3f9451,_0x15ee2f){return function(_0x1c7d75){if(!_0x1c7d75){_0x3f9451[_0x07aa('0x22')](0x194);}return _0x1c7d75;};}function handleError(_0x4fa901,_0x172c52){_0x172c52=_0x172c52||0x1f4;return function(_0x11cdd9){logger[_0x07aa('0x23')](_0x11cdd9['stack']);if(_0x11cdd9[_0x07aa('0x24')]){delete _0x11cdd9[_0x07aa('0x24')];}_0x4fa901[_0x07aa('0x1a')](_0x172c52)['send'](_0x11cdd9);};}exports[_0x07aa('0x25')]=function(_0x4aacbd,_0x352cca){var _0x4aca7f={},_0x327a2a={},_0xefe3d6={'count':0x0,'rows':[]};var _0x232102=_[_0x07aa('0x26')](db[_0x07aa('0x27')][_0x07aa('0x28')],function(_0x20155c){return{'name':_0x20155c[_0x07aa('0x29')],'type':_0x20155c[_0x07aa('0x2a')][_0x07aa('0x2b')]};});_0x327a2a[_0x07aa('0x2c')]=_[_0x07aa('0x26')](_0x232102,_0x07aa('0x24'));_0x327a2a[_0x07aa('0x2d')]=_[_0x07aa('0x2e')](_0x4aacbd['query']);_0x327a2a[_0x07aa('0x2f')]=_[_0x07aa('0x30')](_0x327a2a[_0x07aa('0x2c')],_0x327a2a[_0x07aa('0x2d')]);_0x4aca7f[_0x07aa('0x31')]=_[_0x07aa('0x30')](_0x327a2a[_0x07aa('0x2c')],qs[_0x07aa('0x32')](_0x4aacbd[_0x07aa('0x2d')]['fields']));_0x4aca7f[_0x07aa('0x31')]=_0x4aca7f[_0x07aa('0x31')][_0x07aa('0x33')]?_0x4aca7f[_0x07aa('0x31')]:_0x327a2a['model'];if(!_0x4aacbd[_0x07aa('0x2d')][_0x07aa('0x34')](_0x07aa('0x35'))){_0x4aca7f[_0x07aa('0x36')]=qs[_0x07aa('0x36')](_0x4aacbd['query'][_0x07aa('0x36')]);_0x4aca7f['offset']=qs[_0x07aa('0x1c')](_0x4aacbd[_0x07aa('0x2d')][_0x07aa('0x1c')]);}_0x4aca7f[_0x07aa('0x37')]=qs[_0x07aa('0x38')](_0x4aacbd[_0x07aa('0x2d')][_0x07aa('0x38')]);_0x4aca7f['where']=qs[_0x07aa('0x2f')](_[_0x07aa('0x39')](_0x4aacbd[_0x07aa('0x2d')],_0x327a2a[_0x07aa('0x2f')]),_0x232102);if(_0x4aacbd[_0x07aa('0x2d')][_0x07aa('0x3a')]){_0x4aca7f[_0x07aa('0x3b')]=_['merge'](_0x4aca7f[_0x07aa('0x3b')],{'$or':_[_0x07aa('0x26')](_0x232102,function(_0x5a3545){if(_0x5a3545[_0x07aa('0x2a')]!==_0x07aa('0x3c')){var _0x94b7c8={};_0x94b7c8[_0x5a3545['name']]={'$like':'%'+_0x4aacbd['query'][_0x07aa('0x3a')]+'%'};return _0x94b7c8;}})});}_0x4aca7f=_[_0x07aa('0x3d')]({},_0x4aca7f,_0x4aacbd[_0x07aa('0x3e')]);var _0x524393={'where':_0x4aca7f['where']};return db[_0x07aa('0x27')][_0x07aa('0x3f')](_0x524393)[_0x07aa('0x20')](function(_0x4ae535){_0xefe3d6[_0x07aa('0x3f')]=_0x4ae535;if(_0x4aacbd['query'][_0x07aa('0x40')]){_0x4aca7f[_0x07aa('0x41')]=[{'all':!![]}];}return db[_0x07aa('0x27')]['findAll'](_0x4aca7f);})['then'](function(_0x446566){_0xefe3d6[_0x07aa('0x42')]=_0x446566;return _0xefe3d6;})['then'](respondWithFilteredResult(_0x352cca,_0x4aca7f))[_0x07aa('0x43')](handleError(_0x352cca,null));};exports[_0x07aa('0x44')]=function(_0x4b8dcc,_0x178c98){var _0x5b9c1e={'raw':!![],'where':{'id':_0x4b8dcc[_0x07aa('0x45')]['id']}},_0x3d3838={};_0x3d3838['model']=_[_0x07aa('0x2e')](db[_0x07aa('0x27')][_0x07aa('0x28')]);_0x3d3838[_0x07aa('0x2d')]=_[_0x07aa('0x2e')](_0x4b8dcc['query']);_0x3d3838['filters']=_[_0x07aa('0x30')](_0x3d3838[_0x07aa('0x2c')],_0x3d3838[_0x07aa('0x2d')]);_0x5b9c1e['attributes']=_['intersection'](_0x3d3838['model'],qs[_0x07aa('0x32')](_0x4b8dcc[_0x07aa('0x2d')][_0x07aa('0x32')]));_0x5b9c1e[_0x07aa('0x31')]=_0x5b9c1e[_0x07aa('0x31')][_0x07aa('0x33')]?_0x5b9c1e[_0x07aa('0x31')]:_0x3d3838['model'];if(_0x4b8dcc['query'][_0x07aa('0x40')]){_0x5b9c1e[_0x07aa('0x41')]=[{'all':!![]}];}_0x5b9c1e=_['merge']({},_0x5b9c1e,_0x4b8dcc[_0x07aa('0x3e')]);return db[_0x07aa('0x27')][_0x07aa('0x46')](_0x5b9c1e)['then'](handleEntityNotFound(_0x178c98,null))[_0x07aa('0x20')](respondWithResult(_0x178c98,null))[_0x07aa('0x43')](handleError(_0x178c98,null));};exports['create']=function(_0xbc3db,_0x41ab4f){return db[_0x07aa('0x27')][_0x07aa('0x47')](_0xbc3db[_0x07aa('0x48')],{})[_0x07aa('0x20')](respondWithResult(_0x41ab4f,0xc9))[_0x07aa('0x43')](handleError(_0x41ab4f,null));};exports[_0x07aa('0x49')]=function(_0x46484c,_0x4db992){if(_0x46484c[_0x07aa('0x48')]['id']){delete _0x46484c['body']['id'];}return db[_0x07aa('0x27')][_0x07aa('0x46')]({'where':{'id':_0x46484c[_0x07aa('0x45')]['id']}})[_0x07aa('0x20')](handleEntityNotFound(_0x4db992,null))['then'](saveUpdates(_0x46484c[_0x07aa('0x48')],null))[_0x07aa('0x20')](respondWithResult(_0x4db992,null))[_0x07aa('0x43')](handleError(_0x4db992,null));};exports[_0x07aa('0x4a')]=function(_0x48fe2b,_0x1468f7){return db[_0x07aa('0x27')][_0x07aa('0x46')]({'where':{'id':_0x48fe2b[_0x07aa('0x45')]['id']}})[_0x07aa('0x20')](handleEntityNotFound(_0x1468f7,null))[_0x07aa('0x20')](removeEntity(_0x1468f7,null))['catch'](handleError(_0x1468f7,null));};exports[_0x07aa('0x4b')]=function(_0x54b4fd,_0x1368fd){return db[_0x07aa('0x27')][_0x07aa('0x4b')]()[_0x07aa('0x20')](respondWithResult(_0x1368fd,null))[_0x07aa('0x43')](handleError(_0x1368fd,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index f5b0418..7c9f8ca 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 _0xd0bb=['util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x49e572,_0x149db5){var _0xaf4a3a=function(_0x454073){while(--_0x454073){_0x49e572['push'](_0x49e572['shift']());}};_0xaf4a3a(++_0x149db5);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x2e067a,_0xab528c){_0x2e067a=_0x2e067a-0x0;var _0xc64976=_0xd0bb[_0x2e067a];return _0xc64976;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var logger=require(_0xbd0b('0x2'))('api');var moment=require(_0xbd0b('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd0b('0x4'));var fs=require('fs');var path=require(_0xbd0b('0x5'));var rimraf=require('rimraf');var config=require(_0xbd0b('0x6'));var attributes=require('./chatOfflineMessage.attributes');module[_0xbd0b('0x7')]=function(_0x1b2499,_0x158b5c){return _0x1b2499[_0xbd0b('0x8')](_0xbd0b('0x9'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbd0b('0xa'),'collate':_0xbd0b('0xb')});}; \ No newline at end of file +var _0x0faf=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x2a6193,_0x2ec097){var _0x317a31=function(_0x478fa1){while(--_0x478fa1){_0x2a6193['push'](_0x2a6193['shift']());}};_0x317a31(++_0x2ec097);}(_0x0faf,0x132));var _0xf0fa=function(_0x55a89e,_0x1a05ab){_0x55a89e=_0x55a89e-0x0;var _0x3aa2bd=_0x0faf[_0x55a89e];return _0x3aa2bd;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var logger=require(_0xf0fa('0x1'))(_0xf0fa('0x2'));var moment=require(_0xf0fa('0x3'));var BPromise=require(_0xf0fa('0x4'));var rp=require(_0xf0fa('0x5'));var fs=require('fs');var path=require(_0xf0fa('0x6'));var rimraf=require(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var attributes=require(_0xf0fa('0x9'));module['exports']=function(_0x3637a3,_0x44ffa0){return _0x3637a3[_0xf0fa('0xa')](_0xf0fa('0xb'),attributes,{'tableName':_0xf0fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf0fa('0xd')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index eea934e..4b3fa66 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 _0x4703=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1c5916,_0x2be108){var _0x37dcd5=function(_0x335d0d){while(--_0x335d0d){_0x1c5916['push'](_0x1c5916['shift']());}};_0x37dcd5(++_0x2be108);}(_0x4703,0xc0));var _0x3470=function(_0x574fcf,_0x488cc8){_0x574fcf=_0x574fcf-0x0;var _0x24b36c=_0x4703[_0x574fcf];return _0x24b36c;};'use strict';var _=require(_0x3470('0x0'));var util=require(_0x3470('0x1'));var moment=require(_0x3470('0x2'));var BPromise=require(_0x3470('0x3'));var rs=require(_0x3470('0x4'));var fs=require('fs');var Redis=require(_0x3470('0x5'));var db=require(_0x3470('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3470('0x7'))(_0x3470('0x8'));var config=require(_0x3470('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3470('0xa')][_0x3470('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa3413,_0x48a08e,_0x5e532e){return new BPromise(function(_0x1ce7b7,_0x1bdab1){return client['request'](_0xa3413,_0x5e532e)['then'](function(_0x564c09){logger[_0x3470('0xc')](_0x3470('0xd'),_0x48a08e,_0x3470('0xe'));logger['debug'](_0x3470('0xf'),_0x48a08e,_0x3470('0xe'),JSON['stringify'](_0x564c09));if(_0x564c09[_0x3470('0x10')]){if(_0x564c09['error'][_0x3470('0x11')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x48a08e,_0x564c09[_0x3470('0x10')]['message']);return _0x1bdab1(_0x564c09[_0x3470('0x10')][_0x3470('0x12')]);}logger[_0x3470('0x10')](_0x3470('0xd'),_0x48a08e,_0x564c09[_0x3470('0x10')]['message']);return _0x1ce7b7(_0x564c09['error'][_0x3470('0x12')]);}else{logger[_0x3470('0xc')](_0x3470('0xd'),_0x48a08e,_0x3470('0xe'));_0x1ce7b7(_0x564c09[_0x3470('0x13')][_0x3470('0x12')]);}})[_0x3470('0x14')](function(_0x4e303c){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x48a08e,_0x4e303c);_0x1bdab1(_0x4e303c);});});} \ No newline at end of file +var _0x8c6a=['http','request','info','ChatOfflineMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2068d8,_0x2f0834){var _0x399ce9=function(_0x18ecd5){while(--_0x18ecd5){_0x2068d8['push'](_0x2068d8['shift']());}};_0x399ce9(++_0x2f0834);}(_0x8c6a,0x13b));var _0xa8c6=function(_0x323d87,_0x4ef3f9){_0x323d87=_0x323d87-0x0;var _0x5e8f74=_0x8c6a[_0x323d87];return _0x5e8f74;};'use strict';var _=require(_0xa8c6('0x0'));var util=require(_0xa8c6('0x1'));var moment=require(_0xa8c6('0x2'));var BPromise=require('bluebird');var rs=require(_0xa8c6('0x3'));var fs=require('fs');var Redis=require(_0xa8c6('0x4'));var db=require(_0xa8c6('0x5'))['db'];var utils=require(_0xa8c6('0x6'));var logger=require('../../config/logger')(_0xa8c6('0x7'));var config=require(_0xa8c6('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa8c6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ced79,_0x40068b,_0x1f196a){return new BPromise(function(_0x35fc6f,_0x2ab003){return client[_0xa8c6('0xa')](_0x5ced79,_0x1f196a)['then'](function(_0x5a060e){logger[_0xa8c6('0xb')](_0xa8c6('0xc'),_0x40068b,'request\x20sent');logger[_0xa8c6('0xd')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x40068b,_0xa8c6('0xe'),JSON[_0xa8c6('0xf')](_0x5a060e));if(_0x5a060e[_0xa8c6('0x10')]){if(_0x5a060e[_0xa8c6('0x10')]['code']===0x1f4){logger[_0xa8c6('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x40068b,_0x5a060e[_0xa8c6('0x10')][_0xa8c6('0x11')]);return _0x2ab003(_0x5a060e[_0xa8c6('0x10')]['message']);}logger[_0xa8c6('0x10')](_0xa8c6('0xc'),_0x40068b,_0x5a060e[_0xa8c6('0x10')]['message']);return _0x35fc6f(_0x5a060e[_0xa8c6('0x10')]['message']);}else{logger[_0xa8c6('0xb')](_0xa8c6('0xc'),_0x40068b,_0xa8c6('0xe'));_0x35fc6f(_0x5a060e['result']['message']);}})['catch'](function(_0x4de8dc){logger['error'](_0xa8c6('0xc'),_0x40068b,_0x4de8dc);_0x2ab003(_0x4de8dc);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index d630731..87c2b73 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 _0xcdbe=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','delete','exports'];(function(_0x242bb9,_0x162438){var _0x1bc612=function(_0x2d444b){while(--_0x2d444b){_0x242bb9['push'](_0x242bb9['shift']());}};_0x1bc612(++_0x162438);}(_0xcdbe,0x6c));var _0xecdb=function(_0x33bad8,_0xa77a59){_0x33bad8=_0x33bad8-0x0;var _0xed1658=_0xcdbe[_0x33bad8];return _0xed1658;};'use strict';var multer=require('multer');var util=require(_0xecdb('0x0'));var path=require(_0xecdb('0x1'));var timeout=require(_0xecdb('0x2'));var express=require(_0xecdb('0x3'));var router=express[_0xecdb('0x4')]();var auth=require(_0xecdb('0x5'));var interaction=require(_0xecdb('0x6'));var config=require('../../config/environment');var controller=require(_0xecdb('0x7'));router[_0xecdb('0x8')]('/',auth[_0xecdb('0x9')](),controller['index']);router[_0xecdb('0x8')](_0xecdb('0xa'),auth[_0xecdb('0x9')](),controller[_0xecdb('0xb')]);router[_0xecdb('0x8')](_0xecdb('0xc'),auth['isAuthenticated'](),controller[_0xecdb('0xd')]);router[_0xecdb('0xe')]('/',auth['isAuthenticated'](),controller[_0xecdb('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xecdb('0x10')](_0xecdb('0xc'),auth[_0xecdb('0x9')](),controller['destroy']);module[_0xecdb('0x11')]=router; \ No newline at end of file +var _0x29ab=['update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','post','create','put','/:id'];(function(_0xfb2512,_0x187a37){var _0x41b2ba=function(_0x2765aa){while(--_0x2765aa){_0xfb2512['push'](_0xfb2512['shift']());}};_0x41b2ba(++_0x187a37);}(_0x29ab,0x158));var _0xb29a=function(_0x115410,_0x3e3e95){_0x115410=_0x115410-0x0;var _0x4ac622=_0x29ab[_0x115410];return _0x4ac622;};'use strict';var multer=require(_0xb29a('0x0'));var util=require(_0xb29a('0x1'));var path=require(_0xb29a('0x2'));var timeout=require(_0xb29a('0x3'));var express=require(_0xb29a('0x4'));var router=express[_0xb29a('0x5')]();var auth=require(_0xb29a('0x6'));var interaction=require(_0xb29a('0x7'));var config=require(_0xb29a('0x8'));var controller=require(_0xb29a('0x9'));router['get']('/',auth[_0xb29a('0xa')](),controller[_0xb29a('0xb')]);router[_0xb29a('0xc')]('/describe',auth[_0xb29a('0xa')](),controller['describe']);router['get']('/:id',auth[_0xb29a('0xa')](),controller['show']);router[_0xb29a('0xd')]('/',auth[_0xb29a('0xa')](),controller[_0xb29a('0xe')]);router[_0xb29a('0xf')](_0xb29a('0x10'),auth[_0xb29a('0xa')](),controller[_0xb29a('0x11')]);router['delete']('/:id',auth[_0xb29a('0xa')](),controller[_0xb29a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index f28c2f2..54cb820 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 _0xa705=['exports','STRING','mouseOver','timeout','INTEGER','sequelize'];(function(_0x189d3c,_0x5efebf){var _0x485959=function(_0x1161da){while(--_0x1161da){_0x189d3c['push'](_0x189d3c['shift']());}};_0x485959(++_0x5efebf);}(_0xa705,0x17f));var _0x5a70=function(_0x5edd43,_0x469e29){_0x5edd43=_0x5edd43-0x0;var _0x4f2406=_0xa705[_0x5edd43];return _0x4f2406;};'use strict';var Sequelize=require(_0x5a70('0x0'));module[_0x5a70('0x1')]={'name':{'type':Sequelize[_0x5a70('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x5a70('0x3'),_0x5a70('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x5a70('0x2')]},'timeout':{'type':Sequelize[_0x5a70('0x5')]}}; \ No newline at end of file +var _0x5e31=['timeout','INTEGER','sequelize','STRING','ENUM','mouseOver'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e31,0x15e));var _0x15e3=function(_0x467488,_0x38c7ae){_0x467488=_0x467488-0x0;var _0x56107f=_0x5e31[_0x467488];return _0x56107f;};'use strict';var Sequelize=require(_0x15e3('0x0'));module['exports']={'name':{'type':Sequelize[_0x15e3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x15e3('0x2')](_0x15e3('0x3'),_0x15e3('0x4')),'defaultValue':_0x15e3('0x3')},'selector':{'type':Sequelize[_0x15e3('0x1')]},'timeout':{'type':Sequelize[_0x15e3('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 98d73d4..b78d12c 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 _0x0dec=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','limit','set','apply','reject','save','update','then','error','name','show','params','model','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','attributes','fields','merge','options','find','catch','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','lodash','squel','crypto'];(function(_0x41790a,_0x446918){var _0x2b3453=function(_0x28402e){while(--_0x28402e){_0x41790a['push'](_0x41790a['shift']());}};_0x2b3453(++_0x446918);}(_0x0dec,0x102));var _0xc0de=function(_0x294990,_0x39fcf7){_0x294990=_0x294990-0x0;var _0x477e41=_0x0dec[_0x294990];return _0x477e41;};'use strict';var pdf=require(_0xc0de('0x0'));var emlformat=require(_0xc0de('0x1'));var rimraf=require(_0xc0de('0x2'));var zipdir=require(_0xc0de('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc0de('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc0de('0x5'));var util=require('util');var path=require(_0xc0de('0x6'));var sox=require(_0xc0de('0x7'));var csv=require(_0xc0de('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc0de('0x9'));var squel=require(_0xc0de('0xa'));var crypto=require(_0xc0de('0xb'));var jsforce=require(_0xc0de('0xc'));var deskjs=require(_0xc0de('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc0de('0xe'));var Papa=require(_0xc0de('0xf'));var Redis=require(_0xc0de('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc0de('0x11'));var as=require(_0xc0de('0x12'));var hardwareService=require(_0xc0de('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc0de('0x14'));var licenseUtil=require(_0xc0de('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x389c32,_0x312b94){_0x312b94=_0x312b94||0xcc;return function(_0x5730f8){if(_0x5730f8){return _0x389c32[_0xc0de('0x16')](_0x312b94);}return _0x389c32[_0xc0de('0x17')](_0x312b94)[_0xc0de('0x18')]();};}function respondWithResult(_0x24f938,_0x58778b){_0x58778b=_0x58778b||0xc8;return function(_0x181579){if(_0x181579){return _0x24f938[_0xc0de('0x17')](_0x58778b)[_0xc0de('0x19')](_0x181579);}};}function respondWithFilteredResult(_0x8636e1,_0x41a4fe){return function(_0x55e104){if(_0x55e104){var _0x4ffcae=_0x55e104[_0xc0de('0x1a')],_0x43eb8c=_0x41a4fe['offset'],_0x3cec37=_0x41a4fe['offset']+_0x41a4fe[_0xc0de('0x1b')],_0x330ad1;if(_0x3cec37>=_0x4ffcae){_0x3cec37=_0x4ffcae;_0x330ad1=0xc8;}else{_0x330ad1=0xce;}_0x8636e1[_0xc0de('0x17')](_0x330ad1);return _0x8636e1[_0xc0de('0x1c')]('Content-Range',_0x43eb8c+'-'+_0x3cec37+'/'+_0x4ffcae)[_0xc0de('0x19')](_0x55e104);}return null;};}function patchUpdates(_0x1c7476){return function(_0x46ee26){try{jsonpatch[_0xc0de('0x1d')](_0x46ee26,_0x1c7476,!![]);}catch(_0x1a3727){return BPromise[_0xc0de('0x1e')](_0x1a3727);}return _0x46ee26[_0xc0de('0x1f')]();};}function saveUpdates(_0x48159e,_0x4c16d3){return function(_0x88676f){if(_0x88676f){return _0x88676f[_0xc0de('0x20')](_0x48159e)[_0xc0de('0x21')](function(_0x30d416){return _0x30d416;});}return null;};}function removeEntity(_0x161b9c,_0x1fae98){return function(_0x1d1ddf){if(_0x1d1ddf){return _0x1d1ddf['destroy']()[_0xc0de('0x21')](function(){_0x161b9c[_0xc0de('0x17')](0xcc)[_0xc0de('0x18')]();});}};}function handleEntityNotFound(_0x1d4df5,_0x35ec84){return function(_0x3f751a){if(!_0x3f751a){_0x1d4df5[_0xc0de('0x16')](0x194);}return _0x3f751a;};}function handleError(_0x2c7e77,_0x2d3f8e){_0x2d3f8e=_0x2d3f8e||0x1f4;return function(_0x1d9858){logger[_0xc0de('0x22')](_0x1d9858['stack']);if(_0x1d9858[_0xc0de('0x23')]){delete _0x1d9858[_0xc0de('0x23')];}_0x2c7e77[_0xc0de('0x17')](_0x2d3f8e)['send'](_0x1d9858);};}exports[_0xc0de('0x24')]=function(_0x5201c0,_0x36af6e){var _0x3c1481={'raw':!![],'where':{'id':_0x5201c0[_0xc0de('0x25')]['id']}},_0x997e62={};_0x997e62[_0xc0de('0x26')]=_['keys'](db[_0xc0de('0x27')][_0xc0de('0x28')]);_0x997e62[_0xc0de('0x29')]=_[_0xc0de('0x2a')](_0x5201c0['query']);_0x997e62[_0xc0de('0x2b')]=_[_0xc0de('0x2c')](_0x997e62[_0xc0de('0x26')],_0x997e62[_0xc0de('0x29')]);_0x3c1481[_0xc0de('0x2d')]=_[_0xc0de('0x2c')](_0x997e62[_0xc0de('0x26')],qs['fields'](_0x5201c0[_0xc0de('0x29')][_0xc0de('0x2e')]));_0x3c1481['attributes']=_0x3c1481['attributes']['length']?_0x3c1481[_0xc0de('0x2d')]:_0x997e62[_0xc0de('0x26')];if(_0x5201c0[_0xc0de('0x29')]['includeAll']){_0x3c1481['include']=[{'all':!![]}];}_0x3c1481=_[_0xc0de('0x2f')]({},_0x3c1481,_0x5201c0[_0xc0de('0x30')]);return db[_0xc0de('0x27')][_0xc0de('0x31')](_0x3c1481)[_0xc0de('0x21')](handleEntityNotFound(_0x36af6e,null))[_0xc0de('0x21')](respondWithResult(_0x36af6e,null))[_0xc0de('0x32')](handleError(_0x36af6e,null));};exports[_0xc0de('0x33')]=function(_0x48c405,_0x33940f){return db[_0xc0de('0x27')]['create'](_0x48c405[_0xc0de('0x34')],{})[_0xc0de('0x21')](respondWithResult(_0x33940f,0xc9))[_0xc0de('0x32')](handleError(_0x33940f,null));};exports[_0xc0de('0x20')]=function(_0x59e920,_0x4c704c){if(_0x59e920[_0xc0de('0x34')]['id']){delete _0x59e920[_0xc0de('0x34')]['id'];}return db['ChatProactiveAction'][_0xc0de('0x31')]({'where':{'id':_0x59e920['params']['id']}})[_0xc0de('0x21')](handleEntityNotFound(_0x4c704c,null))[_0xc0de('0x21')](saveUpdates(_0x59e920['body'],null))['then'](respondWithResult(_0x4c704c,null))[_0xc0de('0x32')](handleError(_0x4c704c,null));};exports[_0xc0de('0x35')]=function(_0x104284,_0xd564d4){return db[_0xc0de('0x27')][_0xc0de('0x31')]({'where':{'id':_0x104284[_0xc0de('0x25')]['id']}})[_0xc0de('0x21')](handleEntityNotFound(_0xd564d4,null))[_0xc0de('0x21')](removeEntity(_0xd564d4,null))['catch'](handleError(_0xd564d4,null));}; \ No newline at end of file +var _0x0f25=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','show','model','keys','ChatProactiveAction','query','filters','attributes','intersection','fields','length','include','merge','options','find','create','body','catch','params','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x2226f8,_0x350f4c){var _0x151cfe=function(_0x3001d9){while(--_0x3001d9){_0x2226f8['push'](_0x2226f8['shift']());}};_0x151cfe(++_0x350f4c);}(_0x0f25,0x1dc));var _0x50f2=function(_0x4769f8,_0x55854a){_0x4769f8=_0x4769f8-0x0;var _0xdc249c=_0x0f25[_0x4769f8];return _0xdc249c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x50f2('0x0'));var rimraf=require(_0x50f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50f2('0x2'));var rp=require('request-promise');var moment=require(_0x50f2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x50f2('0x4'));var util=require(_0x50f2('0x5'));var path=require(_0x50f2('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x50f2('0x7'));var squel=require(_0x50f2('0x8'));var crypto=require(_0x50f2('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x50f2('0xa'));var toCsv=require(_0x50f2('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x50f2('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x50f2('0xd'));var as=require(_0x50f2('0xe'));var hardwareService=require(_0x50f2('0xf'));var logger=require(_0x50f2('0x10'))('api');var utils=require(_0x50f2('0x11'));var config=require(_0x50f2('0x12'));var licenseUtil=require(_0x50f2('0x13'));var db=require(_0x50f2('0x14'))['db'];function respondWithStatusCode(_0x541097,_0x2c96d9){_0x2c96d9=_0x2c96d9||0xcc;return function(_0x4a3fb4){if(_0x4a3fb4){return _0x541097[_0x50f2('0x15')](_0x2c96d9);}return _0x541097['status'](_0x2c96d9)[_0x50f2('0x16')]();};}function respondWithResult(_0x5da9b6,_0x473b82){_0x473b82=_0x473b82||0xc8;return function(_0x3cc610){if(_0x3cc610){return _0x5da9b6[_0x50f2('0x17')](_0x473b82)[_0x50f2('0x18')](_0x3cc610);}};}function respondWithFilteredResult(_0x161a8a,_0x35d4e5){return function(_0x435cc3){if(_0x435cc3){var _0x29932e=_0x435cc3[_0x50f2('0x19')],_0x351eca=_0x35d4e5[_0x50f2('0x1a')],_0x5103eb=_0x35d4e5['offset']+_0x35d4e5['limit'],_0x28eea5;if(_0x5103eb>=_0x29932e){_0x5103eb=_0x29932e;_0x28eea5=0xc8;}else{_0x28eea5=0xce;}_0x161a8a[_0x50f2('0x17')](_0x28eea5);return _0x161a8a[_0x50f2('0x1b')](_0x50f2('0x1c'),_0x351eca+'-'+_0x5103eb+'/'+_0x29932e)['json'](_0x435cc3);}return null;};}function patchUpdates(_0x3048f9){return function(_0xadcd79){try{jsonpatch[_0x50f2('0x1d')](_0xadcd79,_0x3048f9,!![]);}catch(_0x34ecbc){return BPromise[_0x50f2('0x1e')](_0x34ecbc);}return _0xadcd79[_0x50f2('0x1f')]();};}function saveUpdates(_0x41977c,_0x1f10ec){return function(_0x5e3a70){if(_0x5e3a70){return _0x5e3a70[_0x50f2('0x20')](_0x41977c)[_0x50f2('0x21')](function(_0x525ac8){return _0x525ac8;});}return null;};}function removeEntity(_0x48485d,_0x59ae01){return function(_0x50945d){if(_0x50945d){return _0x50945d['destroy']()[_0x50f2('0x21')](function(){_0x48485d[_0x50f2('0x17')](0xcc)[_0x50f2('0x16')]();});}};}function handleEntityNotFound(_0x172d02,_0x443af4){return function(_0xf5196c){if(!_0xf5196c){_0x172d02[_0x50f2('0x15')](0x194);}return _0xf5196c;};}function handleError(_0x285f76,_0x22f14e){_0x22f14e=_0x22f14e||0x1f4;return function(_0x18b55e){logger['error'](_0x18b55e[_0x50f2('0x22')]);if(_0x18b55e['name']){delete _0x18b55e[_0x50f2('0x23')];}_0x285f76[_0x50f2('0x17')](_0x22f14e)[_0x50f2('0x24')](_0x18b55e);};}exports[_0x50f2('0x25')]=function(_0xe8496f,_0x4bc7b4){var _0x22a83f={'raw':!![],'where':{'id':_0xe8496f['params']['id']}},_0x33faa7={};_0x33faa7[_0x50f2('0x26')]=_[_0x50f2('0x27')](db[_0x50f2('0x28')]['rawAttributes']);_0x33faa7['query']=_['keys'](_0xe8496f[_0x50f2('0x29')]);_0x33faa7[_0x50f2('0x2a')]=_['intersection'](_0x33faa7[_0x50f2('0x26')],_0x33faa7[_0x50f2('0x29')]);_0x22a83f[_0x50f2('0x2b')]=_[_0x50f2('0x2c')](_0x33faa7[_0x50f2('0x26')],qs[_0x50f2('0x2d')](_0xe8496f[_0x50f2('0x29')][_0x50f2('0x2d')]));_0x22a83f[_0x50f2('0x2b')]=_0x22a83f['attributes'][_0x50f2('0x2e')]?_0x22a83f['attributes']:_0x33faa7['model'];if(_0xe8496f[_0x50f2('0x29')]['includeAll']){_0x22a83f[_0x50f2('0x2f')]=[{'all':!![]}];}_0x22a83f=_[_0x50f2('0x30')]({},_0x22a83f,_0xe8496f[_0x50f2('0x31')]);return db[_0x50f2('0x28')][_0x50f2('0x32')](_0x22a83f)['then'](handleEntityNotFound(_0x4bc7b4,null))[_0x50f2('0x21')](respondWithResult(_0x4bc7b4,null))['catch'](handleError(_0x4bc7b4,null));};exports[_0x50f2('0x33')]=function(_0x2770dd,_0xf3e79f){return db[_0x50f2('0x28')][_0x50f2('0x33')](_0x2770dd[_0x50f2('0x34')],{})[_0x50f2('0x21')](respondWithResult(_0xf3e79f,0xc9))[_0x50f2('0x35')](handleError(_0xf3e79f,null));};exports[_0x50f2('0x20')]=function(_0x59c7e2,_0x1072ab){if(_0x59c7e2['body']['id']){delete _0x59c7e2[_0x50f2('0x34')]['id'];}return db[_0x50f2('0x28')][_0x50f2('0x32')]({'where':{'id':_0x59c7e2[_0x50f2('0x36')]['id']}})[_0x50f2('0x21')](handleEntityNotFound(_0x1072ab,null))[_0x50f2('0x21')](saveUpdates(_0x59c7e2[_0x50f2('0x34')],null))['then'](respondWithResult(_0x1072ab,null))[_0x50f2('0x35')](handleError(_0x1072ab,null));};exports['destroy']=function(_0x464bec,_0x133327){return db[_0x50f2('0x28')]['find']({'where':{'id':_0x464bec[_0x50f2('0x36')]['id']}})[_0x50f2('0x21')](handleEntityNotFound(_0x133327,null))[_0x50f2('0x21')](removeEntity(_0x133327,null))[_0x50f2('0x35')](handleError(_0x133327,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 62a91ee..bf923da 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 _0x9de0=['api','rimraf','exports','define','ChatProactiveAction','lodash','util'];(function(_0x283bd0,_0x4ea670){var _0x32f854=function(_0x137582){while(--_0x137582){_0x283bd0['push'](_0x283bd0['shift']());}};_0x32f854(++_0x4ea670);}(_0x9de0,0x1d3));var _0x09de=function(_0x1d7f57,_0x35699e){_0x1d7f57=_0x1d7f57-0x0;var _0x39d73f=_0x9de0[_0x1d7f57];return _0x39d73f;};'use strict';var _=require(_0x09de('0x0'));var util=require(_0x09de('0x1'));var logger=require('../../config/logger')(_0x09de('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x09de('0x3'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0x09de('0x4')]=function(_0x17fe14,_0x2b2280){return _0x17fe14[_0x09de('0x5')](_0x09de('0x6'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3bd5=['request-promise','path','rimraf','../../config/environment','define','chat_proactive_actions','../../config/logger','api','bluebird'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x3bd5,0xe7));var _0x53bd=function(_0x1034ea,_0x4fe295){_0x1034ea=_0x1034ea-0x0;var _0xc5c83=_0x3bd5[_0x1034ea];return _0xc5c83;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x53bd('0x0'))(_0x53bd('0x1'));var moment=require('moment');var BPromise=require(_0x53bd('0x2'));var rp=require(_0x53bd('0x3'));var fs=require('fs');var path=require(_0x53bd('0x4'));var rimraf=require(_0x53bd('0x5'));var config=require(_0x53bd('0x6'));var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x443882,_0x21567b){return _0x443882[_0x53bd('0x7')]('ChatProactiveAction',attributes,{'tableName':_0x53bd('0x8'),'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 ffc0ed9..64052d1 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 _0xa1d3=['debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','ChatProactiveAction,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xa1d3,0x1c0));var _0x3a1d=function(_0x356a22,_0x241023){_0x356a22=_0x356a22-0x0;var _0x3b9add=_0xa1d3[_0x356a22];return _0x3b9add;};'use strict';var _=require(_0x3a1d('0x0'));var util=require(_0x3a1d('0x1'));var moment=require(_0x3a1d('0x2'));var BPromise=require(_0x3a1d('0x3'));var rs=require(_0x3a1d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a1d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a1d('0x6'))('rpc');var config=require(_0x3a1d('0x7'));var jayson=require(_0x3a1d('0x8'));var client=jayson[_0x3a1d('0x9')][_0x3a1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18fe29,_0x340450,_0x51087d){return new BPromise(function(_0x51083d,_0x5dc998){return client[_0x3a1d('0xb')](_0x18fe29,_0x51087d)['then'](function(_0x294691){logger[_0x3a1d('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x340450,_0x3a1d('0xd'));logger[_0x3a1d('0xe')](_0x3a1d('0xf'),_0x340450,_0x3a1d('0xd'),JSON['stringify'](_0x294691));if(_0x294691[_0x3a1d('0x10')]){if(_0x294691[_0x3a1d('0x10')][_0x3a1d('0x11')]===0x1f4){logger[_0x3a1d('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x340450,_0x294691[_0x3a1d('0x10')][_0x3a1d('0x12')]);return _0x5dc998(_0x294691[_0x3a1d('0x10')][_0x3a1d('0x12')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x340450,_0x294691['error']['message']);return _0x51083d(_0x294691[_0x3a1d('0x10')][_0x3a1d('0x12')]);}else{logger[_0x3a1d('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x340450,_0x3a1d('0xd'));_0x51083d(_0x294691[_0x3a1d('0x13')][_0x3a1d('0x12')]);}})['catch'](function(_0x41933e){logger[_0x3a1d('0x10')](_0x3a1d('0x14'),_0x340450,_0x41933e);_0x5dc998(_0x41933e);});});} \ No newline at end of file +var _0x8977=['then','info','ChatProactiveAction,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','http','request'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8977,0x75));var _0x7897=function(_0x32a385,_0x196d83){_0x32a385=_0x32a385-0x0;var _0x3ad492=_0x8977[_0x32a385];return _0x3ad492;};'use strict';var _=require(_0x7897('0x0'));var util=require('util');var moment=require(_0x7897('0x1'));var BPromise=require(_0x7897('0x2'));var rs=require(_0x7897('0x3'));var fs=require('fs');var Redis=require(_0x7897('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7897('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7897('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7897('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x56129b,_0x433ed2,_0x133e00){return new BPromise(function(_0x57d161,_0x5d7de4){return client[_0x7897('0x8')](_0x56129b,_0x133e00)[_0x7897('0x9')](function(_0x6bb12){logger[_0x7897('0xa')](_0x7897('0xb'),_0x433ed2,'request\x20sent');logger[_0x7897('0xc')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x433ed2,_0x7897('0xd'),JSON['stringify'](_0x6bb12));if(_0x6bb12[_0x7897('0xe')]){if(_0x6bb12[_0x7897('0xe')][_0x7897('0xf')]===0x1f4){logger['error'](_0x7897('0xb'),_0x433ed2,_0x6bb12[_0x7897('0xe')][_0x7897('0x10')]);return _0x5d7de4(_0x6bb12[_0x7897('0xe')][_0x7897('0x10')]);}logger[_0x7897('0xe')](_0x7897('0xb'),_0x433ed2,_0x6bb12[_0x7897('0xe')]['message']);return _0x57d161(_0x6bb12[_0x7897('0xe')]['message']);}else{logger[_0x7897('0xa')]('ChatProactiveAction,\x20%s,\x20%s',_0x433ed2,_0x7897('0xd'));_0x57d161(_0x6bb12['result'][_0x7897('0x10')]);}})[_0x7897('0x11')](function(_0xbf4cdb){logger['error'](_0x7897('0xb'),_0x433ed2,_0xbf4cdb);_0x5d7de4(_0xbf4cdb);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index b95deea..414f28b 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 _0x5203=['delete','destroy','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','put','update'];(function(_0x3f2fea,_0x3c4ea8){var _0x69a4d5=function(_0x223109){while(--_0x223109){_0x3f2fea['push'](_0x3f2fea['shift']());}};_0x69a4d5(++_0x3c4ea8);}(_0x5203,0xd3));var _0x3520=function(_0x3adeb7,_0x3b97e2){_0x3adeb7=_0x3adeb7-0x0;var _0x2c5ef8=_0x5203[_0x3adeb7];return _0x2c5ef8;};'use strict';var multer=require(_0x3520('0x0'));var util=require(_0x3520('0x1'));var path=require(_0x3520('0x2'));var timeout=require('connect-timeout');var express=require(_0x3520('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3520('0x4'));var config=require(_0x3520('0x5'));var controller=require(_0x3520('0x6'));router[_0x3520('0x7')](_0x3520('0x8'),auth[_0x3520('0x9')](),controller[_0x3520('0xa')]);router['post']('/',auth[_0x3520('0x9')](),controller['create']);router[_0x3520('0xb')](_0x3520('0x8'),auth[_0x3520('0x9')](),controller[_0x3520('0xc')]);router[_0x3520('0xd')](_0x3520('0x8'),auth['isAuthenticated'](),controller[_0x3520('0xe')]);module[_0x3520('0xf')]=router; \ No newline at end of file +var _0x3442=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','show','post','put','isAuthenticated'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3442,0x194));var _0x2344=function(_0x1a7096,_0x924837){_0x1a7096=_0x1a7096-0x0;var _0x51eec2=_0x3442[_0x1a7096];return _0x51eec2;};'use strict';var multer=require(_0x2344('0x0'));var util=require(_0x2344('0x1'));var path=require(_0x2344('0x2'));var timeout=require(_0x2344('0x3'));var express=require(_0x2344('0x4'));var router=express[_0x2344('0x5')]();var auth=require(_0x2344('0x6'));var interaction=require(_0x2344('0x7'));var config=require(_0x2344('0x8'));var controller=require(_0x2344('0x9'));router[_0x2344('0xa')](_0x2344('0xb'),auth['isAuthenticated'](),controller[_0x2344('0xc')]);router[_0x2344('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2344('0xe')](_0x2344('0xb'),auth[_0x2344('0xf')](),controller[_0x2344('0x10')]);router[_0x2344('0x11')](_0x2344('0xb'),auth[_0x2344('0xf')](),controller[_0x2344('0x12')]);module[_0x2344('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 8080733..c19aad9 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 _0xd461=['roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x4404ff,_0x13d7a9){var _0x5e7b19=function(_0x13847a){while(--_0x13847a){_0x4404ff['push'](_0x4404ff['shift']());}};_0x5e7b19(++_0x13d7a9);}(_0xd461,0x118));var _0x1d46=function(_0x288ec6,_0x5242d8){_0x288ec6=_0x288ec6-0x0;var _0x10e704=_0xd461[_0x288ec6];return _0x10e704;};'use strict';var Sequelize=require(_0x1d46('0x0'));module[_0x1d46('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1d46('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1d46('0x3')]},'timeout':{'type':Sequelize[_0x1d46('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1d46('0x5')](_0x1d46('0x6'),_0x1d46('0x7'),_0x1d46('0x8'))}}; \ No newline at end of file +var _0xaf9a=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x477bb3,_0x1af649){var _0x3a2f31=function(_0x1ba1c4){while(--_0x1ba1c4){_0x477bb3['push'](_0x477bb3['shift']());}};_0x3a2f31(++_0x1af649);}(_0xaf9a,0x124));var _0xaaf9=function(_0x3eee60,_0xc4a39e){_0x3eee60=_0x3eee60-0x0;var _0x3ef42a=_0xaf9a[_0x3eee60];return _0x3ef42a;};'use strict';var Sequelize=require(_0xaaf9('0x0'));module[_0xaaf9('0x1')]={'name':{'type':Sequelize[_0xaaf9('0x2')],'unique':_0xaaf9('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xaaf9('0x2')]},'timeout':{'type':Sequelize[_0xaaf9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xaaf9('0x5')](_0xaaf9('0x6'),_0xaaf9('0x7'),_0xaaf9('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index e030a0f..e294ff5 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 _0x8e5e=['tq.TeamId','from','join','user_has_teams','ChatQueueId\x20=\x20?','Agents','clone','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','includes','all','union','value','isEmpty','forEach','userChatQueue:remove','addAgents','spread','removeAgents','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','jayson/promise','client','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','set','json','apply','reject','save','update','get','ChatQueues','UserProfileResource','destroy','name','send','index','ChatQueue','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserChatQueue','pick','ChatQueueId','User','findAndCountAll','UserId','chatPause','createdAt','format','SIP','updatedAt','getTeams','findOne','Team','filter','addTeams','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userChatQueue:save','removeTeams','ids','select','field'];(function(_0x3e0e2f,_0x2dc4f9){var _0x3f46d7=function(_0x4c709d){while(--_0x4c709d){_0x3e0e2f['push'](_0x3e0e2f['shift']());}};_0x3f46d7(++_0x2dc4f9);}(_0x8e5e,0x147));var _0xe8e5=function(_0x348652,_0x1ab849){_0x348652=_0x348652-0x0;var _0x18a9ea=_0x8e5e[_0x348652];return _0x18a9ea;};'use strict';var pdf=require(_0xe8e5('0x0'));var emlformat=require(_0xe8e5('0x1'));var rimraf=require(_0xe8e5('0x2'));var zipdir=require(_0xe8e5('0x3'));var jsonpatch=require(_0xe8e5('0x4'));var rp=require(_0xe8e5('0x5'));var moment=require(_0xe8e5('0x6'));var BPromise=require(_0xe8e5('0x7'));var Mustache=require('mustache');var util=require(_0xe8e5('0x8'));var path=require(_0xe8e5('0x9'));var sox=require(_0xe8e5('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe8e5('0xb'));var squel=require('squel');var crypto=require(_0xe8e5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe8e5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe8e5('0xe'));var Redis=require(_0xe8e5('0xf'));var authService=require(_0xe8e5('0x10'));var qs=require(_0xe8e5('0x11'));var as=require(_0xe8e5('0x12'));var hardwareService=require(_0xe8e5('0x13'));var logger=require('../../config/logger')(_0xe8e5('0x14'));var utils=require('../../config/utils');var config=require(_0xe8e5('0x15'));var licenseUtil=require(_0xe8e5('0x16'));var db=require(_0xe8e5('0x17'))['db'];config[_0xe8e5('0x18')]=_[_0xe8e5('0x19')](config[_0xe8e5('0x18')],{'host':_0xe8e5('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe8e5('0x18')]));require(_0xe8e5('0x1b'))[_0xe8e5('0x1c')](socket);var jayson=require(_0xe8e5('0x1d'));var client=jayson[_0xe8e5('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38f96a,_0x465500,_0x2d1113,_0x5f1f8d){return new BPromise(function(_0x255627,_0xb48d0){var _0xe1b26=_0x5f1f8d||client;return _0xe1b26[_0xe8e5('0x1f')](_0x38f96a,_0x2d1113)[_0xe8e5('0x20')](function(_0x59d175){logger[_0xe8e5('0x21')](_0xe8e5('0x22'),_0x465500,_0xe8e5('0x23'));logger[_0xe8e5('0x24')](_0xe8e5('0x25'),_0x465500,_0xe8e5('0x23'),JSON[_0xe8e5('0x26')](_0x59d175));if(_0x59d175[_0xe8e5('0x27')]){if(_0x59d175['error'][_0xe8e5('0x28')]===0x1f4){logger[_0xe8e5('0x27')](_0xe8e5('0x22'),_0x465500,_0x59d175[_0xe8e5('0x27')][_0xe8e5('0x29')]);return _0xb48d0(_0x59d175[_0xe8e5('0x27')][_0xe8e5('0x29')]);}logger[_0xe8e5('0x27')](_0xe8e5('0x22'),_0x465500,_0x59d175[_0xe8e5('0x27')]['message']);return _0x255627(_0x59d175['error'][_0xe8e5('0x29')]);}else{logger[_0xe8e5('0x21')](_0xe8e5('0x22'),_0x465500,'request\x20sent');_0x255627(_0x59d175[_0xe8e5('0x2a')][_0xe8e5('0x29')]);}})[_0xe8e5('0x2b')](function(_0x5edecb){logger[_0xe8e5('0x27')](_0xe8e5('0x22'),_0x465500,_0x5edecb);_0xb48d0(_0x5edecb);});});}function respondWithStatusCode(_0x3dee38,_0xce66f8){_0xce66f8=_0xce66f8||0xcc;return function(_0x124ed6){if(_0x124ed6){return _0x3dee38[_0xe8e5('0x2c')](_0xce66f8);}return _0x3dee38[_0xe8e5('0x2d')](_0xce66f8)[_0xe8e5('0x2e')]();};}function respondWithResult(_0x5765e6,_0x19eaea){_0x19eaea=_0x19eaea||0xc8;return function(_0xd786f){if(_0xd786f){return _0x5765e6[_0xe8e5('0x2d')](_0x19eaea)['json'](_0xd786f);}};}function respondWithFilteredResult(_0x38c81f,_0x310b1a){return function(_0x57bc1b){if(_0x57bc1b){var _0x2ed351=_0x57bc1b[_0xe8e5('0x2f')],_0x289c90=_0x310b1a[_0xe8e5('0x30')],_0x588c74=_0x310b1a['offset']+_0x310b1a['limit'],_0x4aab11;if(_0x588c74>=_0x2ed351){_0x588c74=_0x2ed351;_0x4aab11=0xc8;}else{_0x4aab11=0xce;}_0x38c81f[_0xe8e5('0x2d')](_0x4aab11);return _0x38c81f[_0xe8e5('0x31')]('Content-Range',_0x289c90+'-'+_0x588c74+'/'+_0x2ed351)[_0xe8e5('0x32')](_0x57bc1b);}return null;};}function patchUpdates(_0x592392){return function(_0x4d094c){try{jsonpatch[_0xe8e5('0x33')](_0x4d094c,_0x592392,!![]);}catch(_0x13c994){return BPromise[_0xe8e5('0x34')](_0x13c994);}return _0x4d094c[_0xe8e5('0x35')]();};}function saveUpdates(_0x1a5af3,_0x3c4f92){return function(_0x2292a8){if(_0x2292a8){return _0x2292a8[_0xe8e5('0x36')](_0x1a5af3)[_0xe8e5('0x20')](function(_0x308b70){return _0x308b70;});}return null;};}function removeEntity(_0x180551,_0x5044f0){return function(_0x2a566e){if(_0x2a566e){return _0x2a566e['destroy']()[_0xe8e5('0x20')](function(){var _0xdbe3=_0x2a566e[_0xe8e5('0x37')]({'plain':!![]});var _0x3741f4=_0xe8e5('0x38');return db[_0xe8e5('0x39')][_0xe8e5('0x3a')]({'where':{'type':_0x3741f4,'resourceId':_0xdbe3['id']}})[_0xe8e5('0x20')](function(){return _0x2a566e;});})[_0xe8e5('0x20')](function(){_0x180551[_0xe8e5('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4263bf,_0x3ca7d4){return function(_0x393ac1){if(!_0x393ac1){_0x4263bf[_0xe8e5('0x2c')](0x194);}return _0x393ac1;};}function handleError(_0x5264de,_0x48de70){_0x48de70=_0x48de70||0x1f4;return function(_0x506b19){logger[_0xe8e5('0x27')](_0x506b19['stack']);if(_0x506b19[_0xe8e5('0x3b')]){delete _0x506b19[_0xe8e5('0x3b')];}_0x5264de[_0xe8e5('0x2d')](_0x48de70)[_0xe8e5('0x3c')](_0x506b19);};}exports[_0xe8e5('0x3d')]=function(_0x3ac0f1,_0x92aa50){var _0xf12dfd={},_0x330859={},_0x3537d4={'count':0x0,'rows':[]};var _0x43113e=_['map'](db[_0xe8e5('0x3e')][_0xe8e5('0x3f')],function(_0x12fa56){return{'name':_0x12fa56['fieldName'],'type':_0x12fa56[_0xe8e5('0x40')]['key']};});_0x330859[_0xe8e5('0x41')]=_[_0xe8e5('0x42')](_0x43113e,'name');_0x330859[_0xe8e5('0x43')]=_[_0xe8e5('0x44')](_0x3ac0f1[_0xe8e5('0x43')]);_0x330859[_0xe8e5('0x45')]=_[_0xe8e5('0x46')](_0x330859[_0xe8e5('0x41')],_0x330859['query']);_0xf12dfd[_0xe8e5('0x47')]=_[_0xe8e5('0x46')](_0x330859[_0xe8e5('0x41')],qs[_0xe8e5('0x48')](_0x3ac0f1[_0xe8e5('0x43')][_0xe8e5('0x48')]));_0xf12dfd[_0xe8e5('0x47')]=_0xf12dfd[_0xe8e5('0x47')][_0xe8e5('0x49')]?_0xf12dfd[_0xe8e5('0x47')]:_0x330859[_0xe8e5('0x41')];if(!_0x3ac0f1[_0xe8e5('0x43')][_0xe8e5('0x4a')](_0xe8e5('0x4b'))){_0xf12dfd['limit']=qs[_0xe8e5('0x4c')](_0x3ac0f1['query'][_0xe8e5('0x4c')]);_0xf12dfd[_0xe8e5('0x30')]=qs[_0xe8e5('0x30')](_0x3ac0f1[_0xe8e5('0x43')]['offset']);}_0xf12dfd[_0xe8e5('0x4d')]=qs['sort'](_0x3ac0f1[_0xe8e5('0x43')][_0xe8e5('0x4e')]);_0xf12dfd[_0xe8e5('0x4f')]=qs[_0xe8e5('0x45')](_['pick'](_0x3ac0f1[_0xe8e5('0x43')],_0x330859[_0xe8e5('0x45')]),_0x43113e);if(_0x3ac0f1[_0xe8e5('0x43')]['filter']){_0xf12dfd['where']=_[_0xe8e5('0x50')](_0xf12dfd[_0xe8e5('0x4f')],{'$or':_[_0xe8e5('0x42')](_0x43113e,function(_0x18df19){if(_0x18df19[_0xe8e5('0x40')]!==_0xe8e5('0x51')){var _0x4ff527={};_0x4ff527[_0x18df19['name']]={'$like':'%'+_0x3ac0f1[_0xe8e5('0x43')]['filter']+'%'};return _0x4ff527;}})});}_0xf12dfd=_[_0xe8e5('0x50')]({},_0xf12dfd,_0x3ac0f1[_0xe8e5('0x52')]);var _0x42832f={'where':_0xf12dfd[_0xe8e5('0x4f')]};return db[_0xe8e5('0x3e')][_0xe8e5('0x2f')](_0x42832f)[_0xe8e5('0x20')](function(_0xa38ee5){_0x3537d4[_0xe8e5('0x2f')]=_0xa38ee5;if(_0x3ac0f1['query']['includeAll']){_0xf12dfd[_0xe8e5('0x53')]=[{'all':!![]}];}return db[_0xe8e5('0x3e')][_0xe8e5('0x54')](_0xf12dfd);})[_0xe8e5('0x20')](function(_0x2239cc){_0x3537d4[_0xe8e5('0x55')]=_0x2239cc;return _0x3537d4;})[_0xe8e5('0x20')](respondWithFilteredResult(_0x92aa50,_0xf12dfd))[_0xe8e5('0x2b')](handleError(_0x92aa50,null));};exports[_0xe8e5('0x56')]=function(_0x4db620,_0x2578d0){var _0x38c408={'raw':!![],'where':{'id':_0x4db620[_0xe8e5('0x57')]['id']}},_0x360597={};_0x360597[_0xe8e5('0x41')]=_[_0xe8e5('0x44')](db[_0xe8e5('0x3e')][_0xe8e5('0x3f')]);_0x360597[_0xe8e5('0x43')]=_[_0xe8e5('0x44')](_0x4db620['query']);_0x360597[_0xe8e5('0x45')]=_['intersection'](_0x360597['model'],_0x360597[_0xe8e5('0x43')]);_0x38c408['attributes']=_[_0xe8e5('0x46')](_0x360597[_0xe8e5('0x41')],qs[_0xe8e5('0x48')](_0x4db620[_0xe8e5('0x43')][_0xe8e5('0x48')]));_0x38c408[_0xe8e5('0x47')]=_0x38c408[_0xe8e5('0x47')]['length']?_0x38c408[_0xe8e5('0x47')]:_0x360597[_0xe8e5('0x41')];if(_0x4db620['query'][_0xe8e5('0x58')]){_0x38c408[_0xe8e5('0x53')]=[{'all':!![]}];}_0x38c408=_[_0xe8e5('0x50')]({},_0x38c408,_0x4db620[_0xe8e5('0x52')]);return db[_0xe8e5('0x3e')][_0xe8e5('0x59')](_0x38c408)['then'](handleEntityNotFound(_0x2578d0,null))[_0xe8e5('0x20')](respondWithResult(_0x2578d0,null))[_0xe8e5('0x2b')](handleError(_0x2578d0,null));};exports[_0xe8e5('0x5a')]=function(_0x510897,_0x2593ee){return db['ChatQueue']['create'](_0x510897[_0xe8e5('0x5b')],{})[_0xe8e5('0x20')](function(_0xfc909){var _0x1eaee0=_0x510897[_0xe8e5('0x5c')]['get']({'plain':!![]});if(!_0x1eaee0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1eaee0[_0xe8e5('0x5d')]===_0xe8e5('0x5c')){var _0x2fe658=_0xfc909['get']({'plain':!![]});var _0x209fb0=_0xe8e5('0x38');return db[_0xe8e5('0x5e')][_0xe8e5('0x59')]({'where':{'name':_0x209fb0,'userProfileId':_0x1eaee0[_0xe8e5('0x5f')]},'raw':!![]})[_0xe8e5('0x20')](function(_0x1ba3a3){if(_0x1ba3a3&&_0x1ba3a3['autoAssociation']===0x0){return db[_0xe8e5('0x39')][_0xe8e5('0x5a')]({'name':_0x2fe658['name'],'resourceId':_0x2fe658['id'],'type':_0x1ba3a3[_0xe8e5('0x3b')],'sectionId':_0x1ba3a3['id']},{})[_0xe8e5('0x20')](function(){return _0xfc909;});}else{return _0xfc909;}})['catch'](function(_0x5e06f1){logger[_0xe8e5('0x27')](_0xe8e5('0x60'),_0x5e06f1);throw _0x5e06f1;});}return _0xfc909;})[_0xe8e5('0x20')](respondWithResult(_0x2593ee,0xc9))[_0xe8e5('0x2b')](handleError(_0x2593ee,null));};exports[_0xe8e5('0x36')]=function(_0x3be2fb,_0x5290b7){if(_0x3be2fb['body']['id']){delete _0x3be2fb['body']['id'];}return db['ChatQueue'][_0xe8e5('0x59')]({'where':{'id':_0x3be2fb[_0xe8e5('0x57')]['id']}})[_0xe8e5('0x20')](handleEntityNotFound(_0x5290b7,null))['then'](saveUpdates(_0x3be2fb['body'],null))[_0xe8e5('0x20')](respondWithResult(_0x5290b7,null))[_0xe8e5('0x2b')](handleError(_0x5290b7,null));};exports['destroy']=function(_0x10e28d,_0x60f949){return db['ChatQueue'][_0xe8e5('0x59')]({'where':{'id':_0x10e28d[_0xe8e5('0x57')]['id']}})[_0xe8e5('0x20')](handleEntityNotFound(_0x60f949,null))[_0xe8e5('0x20')](removeEntity(_0x60f949,null))[_0xe8e5('0x2b')](handleError(_0x60f949,null));};exports[_0xe8e5('0x61')]=function(_0x529ad2,_0x12cee8){return db[_0xe8e5('0x3e')][_0xe8e5('0x61')]()[_0xe8e5('0x20')](respondWithResult(_0x12cee8,null))[_0xe8e5('0x2b')](handleError(_0x12cee8,null));};exports[_0xe8e5('0x62')]=function(_0x721ac9,_0x1417a2,_0x3b64aa){var _0x24fd3a={'raw':!![],'where':{}},_0x38971a={},_0x3ac6dc;return db[_0xe8e5('0x3e')]['findOne']({'where':{'id':_0x721ac9[_0xe8e5('0x57')]['id']}})[_0xe8e5('0x20')](handleEntityNotFound(_0x1417a2,null))[_0xe8e5('0x20')](function(_0x336a43){if(_0x336a43){_0x3ac6dc=_0x336a43[_0xe8e5('0x37')]({'plain':!![]});_0x38971a[_0xe8e5('0x41')]=_[_0xe8e5('0x44')](db[_0xe8e5('0x63')][_0xe8e5('0x3f')]);_0x38971a[_0xe8e5('0x43')]=_[_0xe8e5('0x44')](_0x721ac9[_0xe8e5('0x43')]);_0x38971a[_0xe8e5('0x45')]=_[_0xe8e5('0x46')](_0x38971a['model'],_0x38971a['query']);_0x24fd3a['attributes']=_['intersection'](_0x38971a[_0xe8e5('0x41')],qs[_0xe8e5('0x48')](_0x721ac9['query'][_0xe8e5('0x48')]));_0x24fd3a[_0xe8e5('0x47')]=_0x24fd3a[_0xe8e5('0x47')]['length']?_0x24fd3a[_0xe8e5('0x47')]:_0x38971a[_0xe8e5('0x41')];if(!_0x721ac9[_0xe8e5('0x43')]['hasOwnProperty'](_0xe8e5('0x4b'))){_0x24fd3a[_0xe8e5('0x4c')]=qs['limit'](_0x721ac9[_0xe8e5('0x43')][_0xe8e5('0x4c')]);_0x24fd3a[_0xe8e5('0x30')]=qs[_0xe8e5('0x30')](_0x721ac9['query'][_0xe8e5('0x30')]);}_0x24fd3a[_0xe8e5('0x4d')]=qs[_0xe8e5('0x4e')](_0x721ac9[_0xe8e5('0x43')]['sort']);_0x24fd3a['where']=qs[_0xe8e5('0x45')](_[_0xe8e5('0x64')](_0x721ac9[_0xe8e5('0x43')],_0x38971a['filters']));_0x24fd3a[_0xe8e5('0x4f')][_0xe8e5('0x65')]=_0x336a43['id'];if(_0x721ac9[_0xe8e5('0x43')]['filter']){_0x24fd3a[_0xe8e5('0x4f')]=_[_0xe8e5('0x50')](_0x24fd3a[_0xe8e5('0x4f')],{'$or':_[_0xe8e5('0x42')](_0x24fd3a[_0xe8e5('0x47')],function(_0x22914e){var _0x1c4910={};_0x1c4910[_0x22914e]={'$like':'%'+_0x721ac9['query']['filter']+'%'};return _0x1c4910;})});}_0x24fd3a=_[_0xe8e5('0x50')]({},_0x24fd3a,_0x721ac9['options']);return db['UserChatQueue'][_0xe8e5('0x54')](_0x24fd3a);}})[_0xe8e5('0x20')](function(_0x1a4775){if(_0x1a4775){return db[_0xe8e5('0x66')][_0xe8e5('0x67')]({'where':{'id':_[_0xe8e5('0x42')](_0x1a4775,_0xe8e5('0x68')),'role':'agent'},'attributes':['id',_0xe8e5('0x3b'),_0xe8e5('0x69'),'updatedAt',_0xe8e5('0x6a')]});}})['then'](function(_0x132910){if(_0x132910){return{'count':_0x132910[_0xe8e5('0x2f')],'rows':_[_0xe8e5('0x42')](_0x132910[_0xe8e5('0x55')],function(_0xaa3581){return{'membername':_0xaa3581[_0xe8e5('0x3b')],'UserId':_0xaa3581['id'],'queue_name':_0x3ac6dc[_0xe8e5('0x3b')],'ChatQueueId':_0x3ac6dc['id'],'interface':util[_0xe8e5('0x6b')]('%s/%s',_0xe8e5('0x6c'),_0xaa3581['name']),'penalty':0x0,'paused':_0xaa3581[_0xe8e5('0x69')],'createdAt':_0xaa3581['createdAt'],'updatedAt':_0xaa3581[_0xe8e5('0x6d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe8e5('0x20')](respondWithFilteredResult(_0x1417a2,_0x24fd3a))[_0xe8e5('0x2b')](handleError(_0x1417a2,null));};exports[_0xe8e5('0x6e')]=function(_0x582c1e,_0x56f393,_0x229c2b){var _0x47e108={};var _0x248583={};var _0x286b5d;var _0x15cbc5;return db[_0xe8e5('0x3e')][_0xe8e5('0x6f')]({'where':{'id':_0x582c1e[_0xe8e5('0x57')]['id']}})[_0xe8e5('0x20')](handleEntityNotFound(_0x56f393,null))[_0xe8e5('0x20')](function(_0x1739ca){if(_0x1739ca){_0x286b5d=_0x1739ca;_0x248583[_0xe8e5('0x41')]=_['keys'](db[_0xe8e5('0x70')][_0xe8e5('0x3f')]);_0x248583[_0xe8e5('0x43')]=_[_0xe8e5('0x44')](_0x582c1e[_0xe8e5('0x43')]);_0x248583[_0xe8e5('0x45')]=_[_0xe8e5('0x46')](_0x248583[_0xe8e5('0x41')],_0x248583[_0xe8e5('0x43')]);_0x47e108[_0xe8e5('0x47')]=_['intersection'](_0x248583[_0xe8e5('0x41')],qs[_0xe8e5('0x48')](_0x582c1e[_0xe8e5('0x43')][_0xe8e5('0x48')]));_0x47e108['attributes']=_0x47e108[_0xe8e5('0x47')][_0xe8e5('0x49')]?_0x47e108['attributes']:_0x248583[_0xe8e5('0x41')];_0x47e108[_0xe8e5('0x4d')]=qs[_0xe8e5('0x4e')](_0x582c1e[_0xe8e5('0x43')][_0xe8e5('0x4e')]);_0x47e108[_0xe8e5('0x4f')]=qs[_0xe8e5('0x45')](_['pick'](_0x582c1e['query'],_0x248583[_0xe8e5('0x45')]));if(_0x582c1e['query'][_0xe8e5('0x71')]){_0x47e108[_0xe8e5('0x4f')]=_[_0xe8e5('0x50')](_0x47e108[_0xe8e5('0x4f')],{'$or':_[_0xe8e5('0x42')](_0x47e108[_0xe8e5('0x47')],function(_0x21af96){var _0x225115={};_0x225115[_0x21af96]={'$like':'%'+_0x582c1e['query'][_0xe8e5('0x71')]+'%'};return _0x225115;})});}_0x47e108=_[_0xe8e5('0x50')]({},_0x47e108,_0x582c1e[_0xe8e5('0x52')]);return _0x286b5d['getTeams'](_0x47e108);}})[_0xe8e5('0x20')](function(_0x2aa286){if(_0x2aa286){_0x15cbc5=_0x2aa286['length'];if(!_0x582c1e[_0xe8e5('0x43')][_0xe8e5('0x4a')]('nolimit')){_0x47e108[_0xe8e5('0x4c')]=qs[_0xe8e5('0x4c')](_0x582c1e['query']['limit']);_0x47e108['offset']=qs[_0xe8e5('0x30')](_0x582c1e[_0xe8e5('0x43')]['offset']);}return _0x286b5d[_0xe8e5('0x6e')](_0x47e108);}})[_0xe8e5('0x20')](function(_0x1708f3){if(_0x1708f3){return _0x1708f3?{'count':_0x15cbc5,'rows':_0x1708f3}:null;}})[_0xe8e5('0x20')](respondWithResult(_0x56f393,null))[_0xe8e5('0x2b')](handleError(_0x56f393,null));};exports[_0xe8e5('0x72')]=function(_0x443dd1,_0xe8b74c,_0x357214){var _0x106aa2=_0x443dd1[_0xe8e5('0x5b')]['ids'];return db[_0xe8e5('0x70')][_0xe8e5('0x54')]({'where':{'id':_0x106aa2},'attributes':['id'],'include':[{'model':db[_0xe8e5('0x66')],'as':'Agents','attributes':['id',_0xe8e5('0x3b'),_0xe8e5('0x73'),_0xe8e5('0x74'),_0xe8e5('0x75')],'raw':!![]}]})[_0xe8e5('0x20')](function(_0x22de25){if(_0x22de25){var _0x4fd40b=_[_0xe8e5('0x76')](_0x22de25,function(_0xe7a2a5){var _0x5592b7=_0xe7a2a5[_0xe8e5('0x37')]({'plain':!![]});return _0x5592b7['Agents'];});return db[_0xe8e5('0x3e')][_0xe8e5('0x59')]({'where':{'id':_0x443dd1['params']['id']}})[_0xe8e5('0x20')](function(_0x2c99f0){return db[_0xe8e5('0x77')][_0xe8e5('0x78')](function(_0x340042){return _0x2c99f0[_0xe8e5('0x72')](_0x106aa2,{'transaction':_0x340042})['then'](function(){return BPromise[_0xe8e5('0x79')](_0x4fd40b,function(_0x9b2d2b){return db[_0xe8e5('0x63')][_0xe8e5('0x7a')]({'where':{'UserId':_0x9b2d2b['id'],'ChatQueueId':_0x443dd1['params']['id']},'transaction':_0x340042});});})['then'](function(){_0x4fd40b['forEach'](function(_0x1eba33){socket[_0xe8e5('0x7b')](_0xe8e5('0x7c'),{'UserId':_0x1eba33['id'],'ChatQueueId':_0x2c99f0['id']});});});});});}})[_0xe8e5('0x20')](respondWithStatusCode(_0xe8b74c,null))[_0xe8e5('0x2b')](handleError(_0xe8b74c,null));};exports[_0xe8e5('0x7d')]=function(_0x1007f8,_0x3895fd,_0xf0b692){return db['Team'][_0xe8e5('0x54')]({'where':{'id':_0x1007f8[_0xe8e5('0x43')][_0xe8e5('0x7e')]},'attributes':['id'],'include':[{'model':db[_0xe8e5('0x66')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe8e5('0x20')](handleEntityNotFound(_0x3895fd,null))[_0xe8e5('0x20')](function(_0x16498c){var _0x132f96=_['map'](_0x16498c,'id');var _0x4143b8=[];var _0x3ce72c=[];var _0x540480=squel[_0xe8e5('0x7f')]();_0x540480[_0xe8e5('0x80')](_0xe8e5('0x81'))[_0xe8e5('0x82')]('team_has_chat_queues','tq')[_0xe8e5('0x83')](_0xe8e5('0x84'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xe8e5('0x85'),_0x1007f8['params']['id']);for(var _0x433ed0=0x0;_0x433ed0<_0x16498c[_0xe8e5('0x49')];_0x433ed0+=0x1){let _0x314b1b=_0x16498c[_0x433ed0];for(var _0x157104=0x0;_0x157104<_0x314b1b[_0xe8e5('0x86')][_0xe8e5('0x49')];_0x157104+=0x1){let _0x27c9dd=_0x314b1b[_0xe8e5('0x86')][_0x157104];var _0x3a4fc0=_0x540480[_0xe8e5('0x87')]();_0x3a4fc0[_0xe8e5('0x4f')](_0xe8e5('0x88'),_0x27c9dd['id']);_0x3ce72c[_0xe8e5('0x89')](db[_0xe8e5('0x77')][_0xe8e5('0x43')](_0x3a4fc0[_0xe8e5('0x8a')](),{'type':db[_0xe8e5('0x77')]['QueryTypes'][_0xe8e5('0x8b')]})[_0xe8e5('0x20')](function(_0x2c2f62){if(_0x2c2f62[_0xe8e5('0x49')]===0x1){return _0x27c9dd['id'];}else{var _0x30748f=_['every'](_[_0xe8e5('0x42')](_0x2c2f62,_0xe8e5('0x8c')),function(_0x36abe4){return _[_0xe8e5('0x8d')](_0x132f96,_0x36abe4);});if(_0x30748f){return _0x27c9dd['id'];}}}));}}return BPromise[_0xe8e5('0x8e')](_0x3ce72c)[_0xe8e5('0x20')](function(_0x1856c6){_0x4143b8=_(_0x4143b8)[_0xe8e5('0x8f')](_0x1856c6)['compact']()[_0xe8e5('0x90')]();return db[_0xe8e5('0x3e')][_0xe8e5('0x59')]({'where':{'id':_0x1007f8['params']['id']}})[_0xe8e5('0x20')](function(_0x5bd51c){return db[_0xe8e5('0x77')][_0xe8e5('0x78')](function(_0x374565){return _0x5bd51c['removeTeams'](_0x1007f8[_0xe8e5('0x43')][_0xe8e5('0x7e')],{'transaction':_0x374565})[_0xe8e5('0x20')](function(){if(!_[_0xe8e5('0x91')](_0x4143b8)){return _0x5bd51c['removeAgents'](_0x4143b8,{'transaction':_0x374565});}})['then'](function(){_0x4143b8[_0xe8e5('0x92')](function(_0x5d0c09){socket[_0xe8e5('0x7b')](_0xe8e5('0x93'),{'UserId':_0x5d0c09,'ChatQueueId':_0x5bd51c['id']});});});});});});})['then'](respondWithStatusCode(_0x3895fd,null))[_0xe8e5('0x2b')](handleError(_0x3895fd,null));};exports['addAgents']=function(_0x52c5a8,_0x1524ef,_0x2bfee4){return db[_0xe8e5('0x3e')][_0xe8e5('0x59')]({'where':{'id':_0x52c5a8[_0xe8e5('0x57')]['id']}})[_0xe8e5('0x20')](handleEntityNotFound(_0x1524ef,null))[_0xe8e5('0x20')](function(_0x2b9bab){if(_0x2b9bab){return _0x2b9bab[_0xe8e5('0x94')](_0x52c5a8[_0xe8e5('0x5b')]['ids'],_['omit'](_0x52c5a8['body'],[_0xe8e5('0x7e'),'id'])||{})[_0xe8e5('0x95')](function(_0x5deb20){for(var _0xbfb7fb=0x0;_0xbfb7fb<_0x52c5a8[_0xe8e5('0x5b')]['ids'][_0xe8e5('0x49')];_0xbfb7fb+=0x1){socket['emit'](_0xe8e5('0x7c'),{'UserId':_0x52c5a8[_0xe8e5('0x5b')][_0xe8e5('0x7e')][_0xbfb7fb],'ChatQueueId':_0x52c5a8[_0xe8e5('0x57')]['id']});}return _0x5deb20;});}})[_0xe8e5('0x20')](respondWithResult(_0x1524ef,null))[_0xe8e5('0x2b')](handleError(_0x1524ef,null));};exports['removeAgents']=function(_0x862dcc,_0x30d669,_0x50cc09){return db[_0xe8e5('0x3e')]['find']({'where':{'id':_0x862dcc['params']['id']}})[_0xe8e5('0x20')](handleEntityNotFound(_0x30d669,null))[_0xe8e5('0x20')](function(_0x3f6a83){if(_0x3f6a83){return _0x3f6a83[_0xe8e5('0x96')](_0x862dcc[_0xe8e5('0x43')][_0xe8e5('0x7e')])[_0xe8e5('0x20')](function(){if(_['isArray'](_0x862dcc[_0xe8e5('0x43')]['ids'])){for(var _0x59a5e0=0x0;_0x59a5e0<_0x862dcc[_0xe8e5('0x43')][_0xe8e5('0x7e')][_0xe8e5('0x49')];_0x59a5e0+=0x1){socket[_0xe8e5('0x7b')](_0xe8e5('0x93'),{'UserId':Number(_0x862dcc[_0xe8e5('0x43')][_0xe8e5('0x7e')][_0x59a5e0]),'ChatQueueId':Number(_0x862dcc[_0xe8e5('0x57')]['id'])});}}else{socket[_0xe8e5('0x7b')](_0xe8e5('0x93'),{'UserId':Number(_0x862dcc[_0xe8e5('0x43')]['ids']),'ChatQueueId':Number(_0x862dcc[_0xe8e5('0x57')]['id'])});}});}})[_0xe8e5('0x20')](respondWithStatusCode(_0x30d669,null))[_0xe8e5('0x2b')](handleError(_0x30d669,null));};exports[_0xe8e5('0x97')]=function(_0x943788,_0x400bdb,_0x46baff){var _0x533d87={};var _0x88dedf={};var _0x1770aa;var _0x3fea1e;return db[_0xe8e5('0x3e')][_0xe8e5('0x6f')]({'where':{'id':_0x943788[_0xe8e5('0x57')]['id']}})[_0xe8e5('0x20')](handleEntityNotFound(_0x400bdb,null))[_0xe8e5('0x20')](function(_0x153ec9){if(_0x153ec9){_0x1770aa=_0x153ec9;_0x88dedf[_0xe8e5('0x41')]=_[_0xe8e5('0x44')](db[_0xe8e5('0x66')][_0xe8e5('0x3f')]);_0x88dedf['query']=_[_0xe8e5('0x44')](_0x943788['query']);_0x88dedf[_0xe8e5('0x45')]=_[_0xe8e5('0x46')](_0x88dedf[_0xe8e5('0x41')],_0x88dedf[_0xe8e5('0x43')]);_0x533d87[_0xe8e5('0x47')]=_['intersection'](_0x88dedf[_0xe8e5('0x41')],qs[_0xe8e5('0x48')](_0x943788[_0xe8e5('0x43')][_0xe8e5('0x48')]));_0x533d87['attributes']=_0x533d87[_0xe8e5('0x47')]['length']?_0x533d87[_0xe8e5('0x47')]:_0x88dedf[_0xe8e5('0x41')];_0x533d87[_0xe8e5('0x4d')]=qs[_0xe8e5('0x4e')](_0x943788['query'][_0xe8e5('0x4e')]);_0x533d87[_0xe8e5('0x4f')]=qs[_0xe8e5('0x45')](_[_0xe8e5('0x64')](_0x943788[_0xe8e5('0x43')],_0x88dedf[_0xe8e5('0x45')]));if(_0x943788[_0xe8e5('0x43')][_0xe8e5('0x71')]){_0x533d87['where']=_[_0xe8e5('0x50')](_0x533d87['where'],{'$or':_[_0xe8e5('0x42')](_0x533d87[_0xe8e5('0x47')],function(_0x224865){var _0x41b706={};_0x41b706[_0x224865]={'$like':'%'+_0x943788[_0xe8e5('0x43')][_0xe8e5('0x71')]+'%'};return _0x41b706;})});}_0x533d87=_[_0xe8e5('0x50')]({},_0x533d87,_0x943788['options']);return _0x1770aa[_0xe8e5('0x97')](_0x533d87);}})[_0xe8e5('0x20')](function(_0x54b35b){if(_0x54b35b){_0x3fea1e=_0x54b35b[_0xe8e5('0x49')];if(!_0x943788[_0xe8e5('0x43')][_0xe8e5('0x4a')](_0xe8e5('0x4b'))){_0x533d87[_0xe8e5('0x4c')]=qs[_0xe8e5('0x4c')](_0x943788[_0xe8e5('0x43')][_0xe8e5('0x4c')]);_0x533d87[_0xe8e5('0x30')]=qs[_0xe8e5('0x30')](_0x943788['query'][_0xe8e5('0x30')]);}return _0x1770aa[_0xe8e5('0x97')](_0x533d87);}})['then'](function(_0x39560e){if(_0x39560e){return _0x39560e?{'count':_0x3fea1e,'rows':_0x39560e}:null;}})[_0xe8e5('0x20')](respondWithResult(_0x400bdb,null))['catch'](handleError(_0x400bdb,null));}; \ No newline at end of file +var _0xbd01=['find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','keys','hasOwnProperty','ChatQueueId','UserChatQueue','findAndCountAll','UserId','chatPause','format','SIP','updatedAt','Team','getTeams','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','userChatQueue:save','removeTeams','User','tq.TeamId','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','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','redis','defaults','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueue,\x20%s,\x20%s','result','sendStatus','status','json','count','offset','set','Content-Range','update','destroy','get','ChatQueues','UserProfileResource','end','name','send','index','map','ChatQueue','fieldName','type','key','model','query','filters','intersection','attributes','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','show','params','rawAttributes','fields','includeAll'];(function(_0x2997ea,_0x1e25e0){var _0x4a6c39=function(_0x12d7c7){while(--_0x12d7c7){_0x2997ea['push'](_0x2997ea['shift']());}};_0x4a6c39(++_0x1e25e0);}(_0xbd01,0xd4));var _0x1bd0=function(_0x1dc849,_0x53faa2){_0x1dc849=_0x1dc849-0x0;var _0x3a0a43=_0xbd01[_0x1dc849];return _0x3a0a43;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1bd0('0x0'));var rimraf=require(_0x1bd0('0x1'));var zipdir=require(_0x1bd0('0x2'));var jsonpatch=require(_0x1bd0('0x3'));var rp=require(_0x1bd0('0x4'));var moment=require(_0x1bd0('0x5'));var BPromise=require(_0x1bd0('0x6'));var Mustache=require(_0x1bd0('0x7'));var util=require(_0x1bd0('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x1bd0('0x9'));var ejs=require(_0x1bd0('0xa'));var fs=require('fs');var _=require(_0x1bd0('0xb'));var squel=require('squel');var crypto=require(_0x1bd0('0xc'));var jsforce=require(_0x1bd0('0xd'));var deskjs=require(_0x1bd0('0xe'));var toCsv=require(_0x1bd0('0x9'));var querystring=require(_0x1bd0('0xf'));var Papa=require(_0x1bd0('0x10'));var Redis=require(_0x1bd0('0x11'));var authService=require(_0x1bd0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1bd0('0x13'));var hardwareService=require(_0x1bd0('0x14'));var logger=require(_0x1bd0('0x15'))(_0x1bd0('0x16'));var utils=require(_0x1bd0('0x17'));var config=require(_0x1bd0('0x18'));var licenseUtil=require(_0x1bd0('0x19'));var db=require(_0x1bd0('0x1a'))['db'];config[_0x1bd0('0x1b')]=_[_0x1bd0('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1bd0('0x1d'))(new Redis(config['redis']));require(_0x1bd0('0x1e'))[_0x1bd0('0x1f')](socket);var jayson=require(_0x1bd0('0x20'));var client=jayson[_0x1bd0('0x21')][_0x1bd0('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x4a340a,_0x393488,_0x5cc757,_0x11ffd4){return new BPromise(function(_0x59f8d3,_0x1fa7f3){var _0xf4e6f9=_0x11ffd4||client;return _0xf4e6f9[_0x1bd0('0x23')](_0x4a340a,_0x5cc757)[_0x1bd0('0x24')](function(_0x5ec1f4){logger['info']('ChatQueue,\x20%s,\x20%s',_0x393488,_0x1bd0('0x25'));logger[_0x1bd0('0x26')](_0x1bd0('0x27'),_0x393488,_0x1bd0('0x25'),JSON[_0x1bd0('0x28')](_0x5ec1f4));if(_0x5ec1f4[_0x1bd0('0x29')]){if(_0x5ec1f4[_0x1bd0('0x29')][_0x1bd0('0x2a')]===0x1f4){logger[_0x1bd0('0x29')]('ChatQueue,\x20%s,\x20%s',_0x393488,_0x5ec1f4[_0x1bd0('0x29')][_0x1bd0('0x2b')]);return _0x1fa7f3(_0x5ec1f4[_0x1bd0('0x29')][_0x1bd0('0x2b')]);}logger[_0x1bd0('0x29')]('ChatQueue,\x20%s,\x20%s',_0x393488,_0x5ec1f4[_0x1bd0('0x29')][_0x1bd0('0x2b')]);return _0x59f8d3(_0x5ec1f4[_0x1bd0('0x29')][_0x1bd0('0x2b')]);}else{logger['info'](_0x1bd0('0x2c'),_0x393488,_0x1bd0('0x25'));_0x59f8d3(_0x5ec1f4[_0x1bd0('0x2d')][_0x1bd0('0x2b')]);}})['catch'](function(_0x29cc12){logger[_0x1bd0('0x29')](_0x1bd0('0x2c'),_0x393488,_0x29cc12);_0x1fa7f3(_0x29cc12);});});}function respondWithStatusCode(_0x4ab7fa,_0x4806b5){_0x4806b5=_0x4806b5||0xcc;return function(_0x12452e){if(_0x12452e){return _0x4ab7fa[_0x1bd0('0x2e')](_0x4806b5);}return _0x4ab7fa[_0x1bd0('0x2f')](_0x4806b5)['end']();};}function respondWithResult(_0x608fb3,_0x1b6162){_0x1b6162=_0x1b6162||0xc8;return function(_0xba3472){if(_0xba3472){return _0x608fb3['status'](_0x1b6162)[_0x1bd0('0x30')](_0xba3472);}};}function respondWithFilteredResult(_0x628ac5,_0x4d9f95){return function(_0x14c6b6){if(_0x14c6b6){var _0x358b7f=_0x14c6b6[_0x1bd0('0x31')],_0x2f94b3=_0x4d9f95[_0x1bd0('0x32')],_0x108956=_0x4d9f95['offset']+_0x4d9f95['limit'],_0xb87aba;if(_0x108956>=_0x358b7f){_0x108956=_0x358b7f;_0xb87aba=0xc8;}else{_0xb87aba=0xce;}_0x628ac5[_0x1bd0('0x2f')](_0xb87aba);return _0x628ac5[_0x1bd0('0x33')](_0x1bd0('0x34'),_0x2f94b3+'-'+_0x108956+'/'+_0x358b7f)[_0x1bd0('0x30')](_0x14c6b6);}return null;};}function patchUpdates(_0xe0b9b7){return function(_0x5a8624){try{jsonpatch['apply'](_0x5a8624,_0xe0b9b7,!![]);}catch(_0x3ed490){return BPromise['reject'](_0x3ed490);}return _0x5a8624['save']();};}function saveUpdates(_0x1a9801,_0x2eb7f8){return function(_0x1860d1){if(_0x1860d1){return _0x1860d1[_0x1bd0('0x35')](_0x1a9801)[_0x1bd0('0x24')](function(_0x38f9a6){return _0x38f9a6;});}return null;};}function removeEntity(_0x101660,_0x33c103){return function(_0x1d5a54){if(_0x1d5a54){return _0x1d5a54[_0x1bd0('0x36')]()['then'](function(){var _0xb98ac7=_0x1d5a54[_0x1bd0('0x37')]({'plain':!![]});var _0x3a1d6c=_0x1bd0('0x38');return db[_0x1bd0('0x39')][_0x1bd0('0x36')]({'where':{'type':_0x3a1d6c,'resourceId':_0xb98ac7['id']}})[_0x1bd0('0x24')](function(){return _0x1d5a54;});})[_0x1bd0('0x24')](function(){_0x101660['status'](0xcc)[_0x1bd0('0x3a')]();});}};}function handleEntityNotFound(_0x35ef0d,_0x1d18fa){return function(_0x2b6bf0){if(!_0x2b6bf0){_0x35ef0d[_0x1bd0('0x2e')](0x194);}return _0x2b6bf0;};}function handleError(_0x30f692,_0x17dea0){_0x17dea0=_0x17dea0||0x1f4;return function(_0x550ece){logger[_0x1bd0('0x29')](_0x550ece['stack']);if(_0x550ece[_0x1bd0('0x3b')]){delete _0x550ece[_0x1bd0('0x3b')];}_0x30f692[_0x1bd0('0x2f')](_0x17dea0)[_0x1bd0('0x3c')](_0x550ece);};}exports[_0x1bd0('0x3d')]=function(_0x52553f,_0x1ddd1e){var _0x6f1f5b={},_0x41d3ae={},_0x23fd8a={'count':0x0,'rows':[]};var _0x141c4a=_[_0x1bd0('0x3e')](db[_0x1bd0('0x3f')]['rawAttributes'],function(_0x1416eb){return{'name':_0x1416eb[_0x1bd0('0x40')],'type':_0x1416eb[_0x1bd0('0x41')][_0x1bd0('0x42')]};});_0x41d3ae[_0x1bd0('0x43')]=_['map'](_0x141c4a,_0x1bd0('0x3b'));_0x41d3ae[_0x1bd0('0x44')]=_['keys'](_0x52553f[_0x1bd0('0x44')]);_0x41d3ae[_0x1bd0('0x45')]=_[_0x1bd0('0x46')](_0x41d3ae[_0x1bd0('0x43')],_0x41d3ae['query']);_0x6f1f5b['attributes']=_[_0x1bd0('0x46')](_0x41d3ae['model'],qs['fields'](_0x52553f[_0x1bd0('0x44')]['fields']));_0x6f1f5b['attributes']=_0x6f1f5b[_0x1bd0('0x47')][_0x1bd0('0x48')]?_0x6f1f5b['attributes']:_0x41d3ae['model'];if(!_0x52553f[_0x1bd0('0x44')]['hasOwnProperty'](_0x1bd0('0x49'))){_0x6f1f5b[_0x1bd0('0x4a')]=qs[_0x1bd0('0x4a')](_0x52553f[_0x1bd0('0x44')][_0x1bd0('0x4a')]);_0x6f1f5b[_0x1bd0('0x32')]=qs[_0x1bd0('0x32')](_0x52553f[_0x1bd0('0x44')][_0x1bd0('0x32')]);}_0x6f1f5b[_0x1bd0('0x4b')]=qs[_0x1bd0('0x4c')](_0x52553f[_0x1bd0('0x44')]['sort']);_0x6f1f5b[_0x1bd0('0x4d')]=qs['filters'](_[_0x1bd0('0x4e')](_0x52553f[_0x1bd0('0x44')],_0x41d3ae[_0x1bd0('0x45')]),_0x141c4a);if(_0x52553f['query'][_0x1bd0('0x4f')]){_0x6f1f5b[_0x1bd0('0x4d')]=_['merge'](_0x6f1f5b[_0x1bd0('0x4d')],{'$or':_[_0x1bd0('0x3e')](_0x141c4a,function(_0x259118){if(_0x259118[_0x1bd0('0x41')]!==_0x1bd0('0x50')){var _0x20e31e={};_0x20e31e[_0x259118[_0x1bd0('0x3b')]]={'$like':'%'+_0x52553f[_0x1bd0('0x44')][_0x1bd0('0x4f')]+'%'};return _0x20e31e;}})});}_0x6f1f5b=_[_0x1bd0('0x51')]({},_0x6f1f5b,_0x52553f[_0x1bd0('0x52')]);var _0x201521={'where':_0x6f1f5b[_0x1bd0('0x4d')]};return db[_0x1bd0('0x3f')][_0x1bd0('0x31')](_0x201521)[_0x1bd0('0x24')](function(_0x4ab30f){_0x23fd8a[_0x1bd0('0x31')]=_0x4ab30f;if(_0x52553f['query']['includeAll']){_0x6f1f5b['include']=[{'all':!![]}];}return db[_0x1bd0('0x3f')][_0x1bd0('0x53')](_0x6f1f5b);})[_0x1bd0('0x24')](function(_0x2ffb51){_0x23fd8a[_0x1bd0('0x54')]=_0x2ffb51;return _0x23fd8a;})[_0x1bd0('0x24')](respondWithFilteredResult(_0x1ddd1e,_0x6f1f5b))['catch'](handleError(_0x1ddd1e,null));};exports[_0x1bd0('0x55')]=function(_0x94989,_0x49c6e4){var _0x1263fb={'raw':!![],'where':{'id':_0x94989[_0x1bd0('0x56')]['id']}},_0x3012a3={};_0x3012a3[_0x1bd0('0x43')]=_['keys'](db[_0x1bd0('0x3f')][_0x1bd0('0x57')]);_0x3012a3[_0x1bd0('0x44')]=_['keys'](_0x94989[_0x1bd0('0x44')]);_0x3012a3[_0x1bd0('0x45')]=_[_0x1bd0('0x46')](_0x3012a3['model'],_0x3012a3[_0x1bd0('0x44')]);_0x1263fb['attributes']=_['intersection'](_0x3012a3[_0x1bd0('0x43')],qs[_0x1bd0('0x58')](_0x94989[_0x1bd0('0x44')][_0x1bd0('0x58')]));_0x1263fb['attributes']=_0x1263fb[_0x1bd0('0x47')][_0x1bd0('0x48')]?_0x1263fb[_0x1bd0('0x47')]:_0x3012a3[_0x1bd0('0x43')];if(_0x94989[_0x1bd0('0x44')][_0x1bd0('0x59')]){_0x1263fb['include']=[{'all':!![]}];}_0x1263fb=_[_0x1bd0('0x51')]({},_0x1263fb,_0x94989[_0x1bd0('0x52')]);return db[_0x1bd0('0x3f')][_0x1bd0('0x5a')](_0x1263fb)[_0x1bd0('0x24')](handleEntityNotFound(_0x49c6e4,null))['then'](respondWithResult(_0x49c6e4,null))[_0x1bd0('0x5b')](handleError(_0x49c6e4,null));};exports[_0x1bd0('0x5c')]=function(_0x5b840c,_0x4de65e){return db[_0x1bd0('0x3f')][_0x1bd0('0x5c')](_0x5b840c[_0x1bd0('0x5d')],{})[_0x1bd0('0x24')](function(_0x1dca76){var _0x261aca=_0x5b840c[_0x1bd0('0x5e')][_0x1bd0('0x37')]({'plain':!![]});if(!_0x261aca)throw new Error(_0x1bd0('0x5f'));if(_0x261aca[_0x1bd0('0x60')]===_0x1bd0('0x5e')){var _0x54c6be=_0x1dca76[_0x1bd0('0x37')]({'plain':!![]});var _0x24f2a4=_0x1bd0('0x38');return db['UserProfileSection'][_0x1bd0('0x5a')]({'where':{'name':_0x24f2a4,'userProfileId':_0x261aca['userProfileId']},'raw':!![]})[_0x1bd0('0x24')](function(_0x4d22a0){if(_0x4d22a0&&_0x4d22a0['autoAssociation']===0x0){return db[_0x1bd0('0x39')][_0x1bd0('0x5c')]({'name':_0x54c6be['name'],'resourceId':_0x54c6be['id'],'type':_0x4d22a0[_0x1bd0('0x3b')],'sectionId':_0x4d22a0['id']},{})[_0x1bd0('0x24')](function(){return _0x1dca76;});}else{return _0x1dca76;}})[_0x1bd0('0x5b')](function(_0x23275e){logger[_0x1bd0('0x29')](_0x1bd0('0x61'),_0x23275e);throw _0x23275e;});}return _0x1dca76;})[_0x1bd0('0x24')](respondWithResult(_0x4de65e,0xc9))[_0x1bd0('0x5b')](handleError(_0x4de65e,null));};exports['update']=function(_0x50a614,_0x3ccd5d){if(_0x50a614['body']['id']){delete _0x50a614[_0x1bd0('0x5d')]['id'];}return db[_0x1bd0('0x3f')]['find']({'where':{'id':_0x50a614[_0x1bd0('0x56')]['id']}})[_0x1bd0('0x24')](handleEntityNotFound(_0x3ccd5d,null))['then'](saveUpdates(_0x50a614[_0x1bd0('0x5d')],null))[_0x1bd0('0x24')](respondWithResult(_0x3ccd5d,null))[_0x1bd0('0x5b')](handleError(_0x3ccd5d,null));};exports['destroy']=function(_0x28a4e9,_0x5ed2f2){return db[_0x1bd0('0x3f')][_0x1bd0('0x5a')]({'where':{'id':_0x28a4e9[_0x1bd0('0x56')]['id']}})[_0x1bd0('0x24')](handleEntityNotFound(_0x5ed2f2,null))[_0x1bd0('0x24')](removeEntity(_0x5ed2f2,null))[_0x1bd0('0x5b')](handleError(_0x5ed2f2,null));};exports['describe']=function(_0x57a894,_0x115c23){return db['ChatQueue'][_0x1bd0('0x62')]()[_0x1bd0('0x24')](respondWithResult(_0x115c23,null))[_0x1bd0('0x5b')](handleError(_0x115c23,null));};exports[_0x1bd0('0x63')]=function(_0x47452d,_0x3262da,_0x25116c){var _0x335cc3={'raw':!![],'where':{}},_0x4732b9={},_0x19f5b;return db[_0x1bd0('0x3f')][_0x1bd0('0x64')]({'where':{'id':_0x47452d[_0x1bd0('0x56')]['id']}})[_0x1bd0('0x24')](handleEntityNotFound(_0x3262da,null))[_0x1bd0('0x24')](function(_0x5b88c3){if(_0x5b88c3){_0x19f5b=_0x5b88c3[_0x1bd0('0x37')]({'plain':!![]});_0x4732b9[_0x1bd0('0x43')]=_[_0x1bd0('0x65')](db['UserChatQueue']['rawAttributes']);_0x4732b9[_0x1bd0('0x44')]=_[_0x1bd0('0x65')](_0x47452d[_0x1bd0('0x44')]);_0x4732b9['filters']=_[_0x1bd0('0x46')](_0x4732b9[_0x1bd0('0x43')],_0x4732b9[_0x1bd0('0x44')]);_0x335cc3['attributes']=_['intersection'](_0x4732b9[_0x1bd0('0x43')],qs[_0x1bd0('0x58')](_0x47452d[_0x1bd0('0x44')][_0x1bd0('0x58')]));_0x335cc3['attributes']=_0x335cc3[_0x1bd0('0x47')][_0x1bd0('0x48')]?_0x335cc3['attributes']:_0x4732b9[_0x1bd0('0x43')];if(!_0x47452d[_0x1bd0('0x44')][_0x1bd0('0x66')]('nolimit')){_0x335cc3[_0x1bd0('0x4a')]=qs[_0x1bd0('0x4a')](_0x47452d['query'][_0x1bd0('0x4a')]);_0x335cc3[_0x1bd0('0x32')]=qs[_0x1bd0('0x32')](_0x47452d[_0x1bd0('0x44')][_0x1bd0('0x32')]);}_0x335cc3[_0x1bd0('0x4b')]=qs['sort'](_0x47452d[_0x1bd0('0x44')][_0x1bd0('0x4c')]);_0x335cc3[_0x1bd0('0x4d')]=qs[_0x1bd0('0x45')](_[_0x1bd0('0x4e')](_0x47452d[_0x1bd0('0x44')],_0x4732b9[_0x1bd0('0x45')]));_0x335cc3[_0x1bd0('0x4d')][_0x1bd0('0x67')]=_0x5b88c3['id'];if(_0x47452d[_0x1bd0('0x44')][_0x1bd0('0x4f')]){_0x335cc3[_0x1bd0('0x4d')]=_[_0x1bd0('0x51')](_0x335cc3[_0x1bd0('0x4d')],{'$or':_[_0x1bd0('0x3e')](_0x335cc3[_0x1bd0('0x47')],function(_0x5f1e3a){var _0x5bb2f5={};_0x5bb2f5[_0x5f1e3a]={'$like':'%'+_0x47452d['query'][_0x1bd0('0x4f')]+'%'};return _0x5bb2f5;})});}_0x335cc3=_['merge']({},_0x335cc3,_0x47452d[_0x1bd0('0x52')]);return db[_0x1bd0('0x68')][_0x1bd0('0x53')](_0x335cc3);}})[_0x1bd0('0x24')](function(_0x11a1c1){if(_0x11a1c1){return db['User'][_0x1bd0('0x69')]({'where':{'id':_[_0x1bd0('0x3e')](_0x11a1c1,_0x1bd0('0x6a')),'role':'agent'},'attributes':['id',_0x1bd0('0x3b'),_0x1bd0('0x6b'),'updatedAt','createdAt']});}})[_0x1bd0('0x24')](function(_0x410f52){if(_0x410f52){return{'count':_0x410f52[_0x1bd0('0x31')],'rows':_[_0x1bd0('0x3e')](_0x410f52[_0x1bd0('0x54')],function(_0x3258bd){return{'membername':_0x3258bd['name'],'UserId':_0x3258bd['id'],'queue_name':_0x19f5b[_0x1bd0('0x3b')],'ChatQueueId':_0x19f5b['id'],'interface':util[_0x1bd0('0x6c')]('%s/%s',_0x1bd0('0x6d'),_0x3258bd[_0x1bd0('0x3b')]),'penalty':0x0,'paused':_0x3258bd[_0x1bd0('0x6b')],'createdAt':_0x3258bd['createdAt'],'updatedAt':_0x3258bd[_0x1bd0('0x6e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1bd0('0x24')](respondWithFilteredResult(_0x3262da,_0x335cc3))['catch'](handleError(_0x3262da,null));};exports['getTeams']=function(_0x5e0217,_0x1819a9,_0x1d1ba2){var _0x23c168={};var _0x3f04eb={};var _0x5d692c;var _0x4d2813;return db['ChatQueue'][_0x1bd0('0x64')]({'where':{'id':_0x5e0217['params']['id']}})[_0x1bd0('0x24')](handleEntityNotFound(_0x1819a9,null))['then'](function(_0x3cd69b){if(_0x3cd69b){_0x5d692c=_0x3cd69b;_0x3f04eb[_0x1bd0('0x43')]=_[_0x1bd0('0x65')](db[_0x1bd0('0x6f')][_0x1bd0('0x57')]);_0x3f04eb[_0x1bd0('0x44')]=_[_0x1bd0('0x65')](_0x5e0217['query']);_0x3f04eb[_0x1bd0('0x45')]=_[_0x1bd0('0x46')](_0x3f04eb[_0x1bd0('0x43')],_0x3f04eb['query']);_0x23c168[_0x1bd0('0x47')]=_[_0x1bd0('0x46')](_0x3f04eb[_0x1bd0('0x43')],qs['fields'](_0x5e0217[_0x1bd0('0x44')][_0x1bd0('0x58')]));_0x23c168[_0x1bd0('0x47')]=_0x23c168['attributes'][_0x1bd0('0x48')]?_0x23c168['attributes']:_0x3f04eb[_0x1bd0('0x43')];_0x23c168['order']=qs[_0x1bd0('0x4c')](_0x5e0217[_0x1bd0('0x44')][_0x1bd0('0x4c')]);_0x23c168[_0x1bd0('0x4d')]=qs[_0x1bd0('0x45')](_[_0x1bd0('0x4e')](_0x5e0217[_0x1bd0('0x44')],_0x3f04eb['filters']));if(_0x5e0217[_0x1bd0('0x44')][_0x1bd0('0x4f')]){_0x23c168[_0x1bd0('0x4d')]=_[_0x1bd0('0x51')](_0x23c168['where'],{'$or':_[_0x1bd0('0x3e')](_0x23c168[_0x1bd0('0x47')],function(_0x2c9e1f){var _0x549b47={};_0x549b47[_0x2c9e1f]={'$like':'%'+_0x5e0217['query']['filter']+'%'};return _0x549b47;})});}_0x23c168=_[_0x1bd0('0x51')]({},_0x23c168,_0x5e0217['options']);return _0x5d692c[_0x1bd0('0x70')](_0x23c168);}})['then'](function(_0x130633){if(_0x130633){_0x4d2813=_0x130633[_0x1bd0('0x48')];if(!_0x5e0217[_0x1bd0('0x44')][_0x1bd0('0x66')](_0x1bd0('0x49'))){_0x23c168['limit']=qs['limit'](_0x5e0217[_0x1bd0('0x44')][_0x1bd0('0x4a')]);_0x23c168[_0x1bd0('0x32')]=qs['offset'](_0x5e0217['query']['offset']);}return _0x5d692c['getTeams'](_0x23c168);}})[_0x1bd0('0x24')](function(_0x2ae2f8){if(_0x2ae2f8){return _0x2ae2f8?{'count':_0x4d2813,'rows':_0x2ae2f8}:null;}})[_0x1bd0('0x24')](respondWithResult(_0x1819a9,null))[_0x1bd0('0x5b')](handleError(_0x1819a9,null));};exports[_0x1bd0('0x71')]=function(_0x25a2ef,_0x33df72,_0x47a310){var _0x3151f3=_0x25a2ef[_0x1bd0('0x5d')][_0x1bd0('0x72')];return db[_0x1bd0('0x6f')][_0x1bd0('0x53')]({'where':{'id':_0x3151f3},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1bd0('0x73'),'attributes':['id','name',_0x1bd0('0x74'),'voicePause',_0x1bd0('0x75')],'raw':!![]}]})[_0x1bd0('0x24')](function(_0x174c24){if(_0x174c24){var _0x228c76=_[_0x1bd0('0x76')](_0x174c24,function(_0x3174ed){var _0x4e096e=_0x3174ed[_0x1bd0('0x37')]({'plain':!![]});return _0x4e096e[_0x1bd0('0x73')];});return db[_0x1bd0('0x3f')]['find']({'where':{'id':_0x25a2ef[_0x1bd0('0x56')]['id']}})[_0x1bd0('0x24')](function(_0x1046ee){return db[_0x1bd0('0x77')][_0x1bd0('0x78')](function(_0x4ef841){return _0x1046ee[_0x1bd0('0x71')](_0x3151f3,{'transaction':_0x4ef841})[_0x1bd0('0x24')](function(){return BPromise['each'](_0x228c76,function(_0xc24b8f){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0xc24b8f['id'],'ChatQueueId':_0x25a2ef[_0x1bd0('0x56')]['id']},'transaction':_0x4ef841});});})[_0x1bd0('0x24')](function(){_0x228c76['forEach'](function(_0x3a95db){socket['emit'](_0x1bd0('0x79'),{'UserId':_0x3a95db['id'],'ChatQueueId':_0x1046ee['id']});});});});});}})[_0x1bd0('0x24')](respondWithStatusCode(_0x33df72,null))[_0x1bd0('0x5b')](handleError(_0x33df72,null));};exports[_0x1bd0('0x7a')]=function(_0x130f17,_0x4a083c,_0x937b1a){return db['Team'][_0x1bd0('0x53')]({'where':{'id':_0x130f17[_0x1bd0('0x44')][_0x1bd0('0x72')]},'attributes':['id'],'include':[{'model':db[_0x1bd0('0x7b')],'as':_0x1bd0('0x73'),'attributes':['id'],'raw':!![]}]})[_0x1bd0('0x24')](handleEntityNotFound(_0x4a083c,null))[_0x1bd0('0x24')](function(_0x2920ba){var _0x527365=_[_0x1bd0('0x3e')](_0x2920ba,'id');var _0x21cf73=[];var _0x30a493=[];var _0x266fb8=squel['select']();_0x266fb8['field'](_0x1bd0('0x7c'))[_0x1bd0('0x7d')](_0x1bd0('0x7e'),'tq')['join'](_0x1bd0('0x7f'),'ut',_0x1bd0('0x80'))[_0x1bd0('0x4d')](_0x1bd0('0x81'),_0x130f17[_0x1bd0('0x56')]['id']);for(var _0x58c971=0x0;_0x58c971<_0x2920ba['length'];_0x58c971+=0x1){let _0x1f5306=_0x2920ba[_0x58c971];for(var _0xfaaff1=0x0;_0xfaaff1<_0x1f5306[_0x1bd0('0x73')][_0x1bd0('0x48')];_0xfaaff1+=0x1){let _0x2b4190=_0x1f5306[_0x1bd0('0x73')][_0xfaaff1];var _0xe29fb2=_0x266fb8[_0x1bd0('0x82')]();_0xe29fb2[_0x1bd0('0x4d')]('ut.UserId\x20=\x20?',_0x2b4190['id']);_0x30a493['push'](db[_0x1bd0('0x77')][_0x1bd0('0x44')](_0xe29fb2[_0x1bd0('0x83')](),{'type':db[_0x1bd0('0x77')][_0x1bd0('0x84')][_0x1bd0('0x85')]})[_0x1bd0('0x24')](function(_0x3d426b){if(_0x3d426b[_0x1bd0('0x48')]===0x1){return _0x2b4190['id'];}else{var _0x265417=_[_0x1bd0('0x86')](_['map'](_0x3d426b,_0x1bd0('0x87')),function(_0x2b7449){return _[_0x1bd0('0x88')](_0x527365,_0x2b7449);});if(_0x265417){return _0x2b4190['id'];}}}));}}return BPromise[_0x1bd0('0x89')](_0x30a493)[_0x1bd0('0x24')](function(_0x5afa1b){_0x21cf73=_(_0x21cf73)[_0x1bd0('0x8a')](_0x5afa1b)[_0x1bd0('0x8b')]()[_0x1bd0('0x8c')]();return db[_0x1bd0('0x3f')]['find']({'where':{'id':_0x130f17[_0x1bd0('0x56')]['id']}})[_0x1bd0('0x24')](function(_0x585f73){return db[_0x1bd0('0x77')][_0x1bd0('0x78')](function(_0x2be27f){return _0x585f73[_0x1bd0('0x7a')](_0x130f17[_0x1bd0('0x44')]['ids'],{'transaction':_0x2be27f})[_0x1bd0('0x24')](function(){if(!_[_0x1bd0('0x8d')](_0x21cf73)){return _0x585f73[_0x1bd0('0x8e')](_0x21cf73,{'transaction':_0x2be27f});}})[_0x1bd0('0x24')](function(){_0x21cf73[_0x1bd0('0x8f')](function(_0x2cd101){socket[_0x1bd0('0x90')](_0x1bd0('0x91'),{'UserId':_0x2cd101,'ChatQueueId':_0x585f73['id']});});});});});});})[_0x1bd0('0x24')](respondWithStatusCode(_0x4a083c,null))[_0x1bd0('0x5b')](handleError(_0x4a083c,null));};exports[_0x1bd0('0x92')]=function(_0x1ca0c9,_0x317b07,_0xecd864){return db[_0x1bd0('0x3f')][_0x1bd0('0x5a')]({'where':{'id':_0x1ca0c9[_0x1bd0('0x56')]['id']}})['then'](handleEntityNotFound(_0x317b07,null))[_0x1bd0('0x24')](function(_0x5383b3){if(_0x5383b3){return _0x5383b3[_0x1bd0('0x92')](_0x1ca0c9['body'][_0x1bd0('0x72')],_[_0x1bd0('0x93')](_0x1ca0c9[_0x1bd0('0x5d')],[_0x1bd0('0x72'),'id'])||{})[_0x1bd0('0x94')](function(_0x76965d){for(var _0x330ca9=0x0;_0x330ca9<_0x1ca0c9[_0x1bd0('0x5d')][_0x1bd0('0x72')][_0x1bd0('0x48')];_0x330ca9+=0x1){socket['emit']('userChatQueue:save',{'UserId':_0x1ca0c9[_0x1bd0('0x5d')][_0x1bd0('0x72')][_0x330ca9],'ChatQueueId':_0x1ca0c9[_0x1bd0('0x56')]['id']});}return _0x76965d;});}})['then'](respondWithResult(_0x317b07,null))[_0x1bd0('0x5b')](handleError(_0x317b07,null));};exports['removeAgents']=function(_0x17160d,_0x3d6d8e,_0xba041d){return db[_0x1bd0('0x3f')]['find']({'where':{'id':_0x17160d[_0x1bd0('0x56')]['id']}})['then'](handleEntityNotFound(_0x3d6d8e,null))[_0x1bd0('0x24')](function(_0x2f6a2f){if(_0x2f6a2f){return _0x2f6a2f[_0x1bd0('0x8e')](_0x17160d[_0x1bd0('0x44')][_0x1bd0('0x72')])[_0x1bd0('0x24')](function(){if(_[_0x1bd0('0x95')](_0x17160d[_0x1bd0('0x44')]['ids'])){for(var _0x34bca5=0x0;_0x34bca5<_0x17160d[_0x1bd0('0x44')][_0x1bd0('0x72')][_0x1bd0('0x48')];_0x34bca5+=0x1){socket[_0x1bd0('0x90')](_0x1bd0('0x91'),{'UserId':Number(_0x17160d['query'][_0x1bd0('0x72')][_0x34bca5]),'ChatQueueId':Number(_0x17160d['params']['id'])});}}else{socket[_0x1bd0('0x90')](_0x1bd0('0x91'),{'UserId':Number(_0x17160d[_0x1bd0('0x44')]['ids']),'ChatQueueId':Number(_0x17160d[_0x1bd0('0x56')]['id'])});}});}})[_0x1bd0('0x24')](respondWithStatusCode(_0x3d6d8e,null))['catch'](handleError(_0x3d6d8e,null));};exports[_0x1bd0('0x96')]=function(_0x4eca83,_0x82298a,_0x33d9be){var _0x535a7a={};var _0x2450ec={};var _0x4e2b8c;var _0x24d5c8;return db[_0x1bd0('0x3f')][_0x1bd0('0x64')]({'where':{'id':_0x4eca83[_0x1bd0('0x56')]['id']}})['then'](handleEntityNotFound(_0x82298a,null))[_0x1bd0('0x24')](function(_0x554928){if(_0x554928){_0x4e2b8c=_0x554928;_0x2450ec[_0x1bd0('0x43')]=_['keys'](db['User'][_0x1bd0('0x57')]);_0x2450ec['query']=_[_0x1bd0('0x65')](_0x4eca83['query']);_0x2450ec[_0x1bd0('0x45')]=_['intersection'](_0x2450ec[_0x1bd0('0x43')],_0x2450ec['query']);_0x535a7a['attributes']=_[_0x1bd0('0x46')](_0x2450ec[_0x1bd0('0x43')],qs[_0x1bd0('0x58')](_0x4eca83[_0x1bd0('0x44')][_0x1bd0('0x58')]));_0x535a7a[_0x1bd0('0x47')]=_0x535a7a[_0x1bd0('0x47')]['length']?_0x535a7a[_0x1bd0('0x47')]:_0x2450ec[_0x1bd0('0x43')];_0x535a7a['order']=qs[_0x1bd0('0x4c')](_0x4eca83[_0x1bd0('0x44')]['sort']);_0x535a7a[_0x1bd0('0x4d')]=qs[_0x1bd0('0x45')](_[_0x1bd0('0x4e')](_0x4eca83[_0x1bd0('0x44')],_0x2450ec[_0x1bd0('0x45')]));if(_0x4eca83[_0x1bd0('0x44')][_0x1bd0('0x4f')]){_0x535a7a['where']=_[_0x1bd0('0x51')](_0x535a7a['where'],{'$or':_['map'](_0x535a7a[_0x1bd0('0x47')],function(_0x393dfd){var _0x11a2b3={};_0x11a2b3[_0x393dfd]={'$like':'%'+_0x4eca83['query'][_0x1bd0('0x4f')]+'%'};return _0x11a2b3;})});}_0x535a7a=_['merge']({},_0x535a7a,_0x4eca83['options']);return _0x4e2b8c[_0x1bd0('0x96')](_0x535a7a);}})['then'](function(_0x496ab9){if(_0x496ab9){_0x24d5c8=_0x496ab9[_0x1bd0('0x48')];if(!_0x4eca83[_0x1bd0('0x44')][_0x1bd0('0x66')](_0x1bd0('0x49'))){_0x535a7a[_0x1bd0('0x4a')]=qs[_0x1bd0('0x4a')](_0x4eca83[_0x1bd0('0x44')]['limit']);_0x535a7a['offset']=qs[_0x1bd0('0x32')](_0x4eca83['query']['offset']);}return _0x4e2b8c['getAgents'](_0x535a7a);}})[_0x1bd0('0x24')](function(_0x154915){if(_0x154915){return _0x154915?{'count':_0x24d5c8,'rows':_0x154915}:null;}})['then'](respondWithResult(_0x82298a,null))[_0x1bd0('0x5b')](handleError(_0x82298a,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index e56f9c7..81bc6e1 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x398d1b,_0xc7c3fc){var _0x3cb998=function(_0x489d2d){while(--_0x489d2d){_0x398d1b['push'](_0x398d1b['shift']());}};_0x3cb998(++_0xc7c3fc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5c082a,_0x19ac27){_0x5c082a=_0x5c082a-0x0;var _0x3b60ac=_0x5f2f[_0x5c082a];return _0x3b60ac;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x1807aa,_0xccd2cc){var _0x1b9a83=function(_0x58789c){while(--_0x58789c){_0x1807aa['push'](_0x1807aa['shift']());}};_0x1b9a83(++_0xccd2cc);}(_0x0b0e,0x187));var _0xe0b0=function(_0xdd0313,_0x251c2b){_0xdd0313=_0xdd0313-0x0;var _0x2bd7e8=_0x0b0e[_0xdd0313];return _0x2bd7e8;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatQueueEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatQueueEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatQueue[_0xe0b0('0x7')](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 925d2f5..fec98d7 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 _0x06ed=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatQueue.attributes','define','ChatQueue','lodash','util'];(function(_0x329dd2,_0x3f0016){var _0x50d16b=function(_0x316a7d){while(--_0x316a7d){_0x329dd2['push'](_0x329dd2['shift']());}};_0x50d16b(++_0x3f0016);}(_0x06ed,0x1d2));var _0xd06e=function(_0x437887,_0x489dd8){_0x437887=_0x437887-0x0;var _0x1b7e0d=_0x06ed[_0x437887];return _0x1b7e0d;};'use strict';var _=require(_0xd06e('0x0'));var util=require(_0xd06e('0x1'));var logger=require(_0xd06e('0x2'))(_0xd06e('0x3'));var moment=require(_0xd06e('0x4'));var BPromise=require(_0xd06e('0x5'));var rp=require(_0xd06e('0x6'));var fs=require('fs');var path=require(_0xd06e('0x7'));var rimraf=require('rimraf');var config=require(_0xd06e('0x8'));var attributes=require(_0xd06e('0x9'));module['exports']=function(_0x397629,_0x1dc5dd){return _0x397629[_0xd06e('0xa')](_0xd06e('0xb'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e79=['define','ChatQueue','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x4faeb4,_0x3f3a19){var _0x3b00f1=function(_0x52d8ae){while(--_0x52d8ae){_0x4faeb4['push'](_0x4faeb4['shift']());}};_0x3b00f1(++_0x3f3a19);}(_0x9e79,0xbd));var _0x99e7=function(_0x273f1b,_0x22b88f){_0x273f1b=_0x273f1b-0x0;var _0x38aab0=_0x9e79[_0x273f1b];return _0x38aab0;};'use strict';var _=require(_0x99e7('0x0'));var util=require(_0x99e7('0x1'));var logger=require(_0x99e7('0x2'))('api');var moment=require(_0x99e7('0x3'));var BPromise=require(_0x99e7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99e7('0x5'));var rimraf=require(_0x99e7('0x6'));var config=require(_0x99e7('0x7'));var attributes=require('./chatQueue.attributes');module[_0x99e7('0x8')]=function(_0x39be82,_0x2f98e6){return _0x39be82[_0x99e7('0x9')](_0x99e7('0xa'),attributes,{'tableName':'chat_queues','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 051dcb8..1761657 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 _0x6124=['stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','attributes','limit','include','map','model','ShowChatQueue','find','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6124,0x140));var _0x4612=function(_0x8c9f25,_0x3e5b33){_0x8c9f25=_0x8c9f25-0x0;var _0x2004f0=_0x6124[_0x8c9f25];return _0x2004f0;};'use strict';var _=require(_0x4612('0x0'));var util=require(_0x4612('0x1'));var moment=require(_0x4612('0x2'));var BPromise=require('bluebird');var rs=require(_0x4612('0x3'));var fs=require('fs');var Redis=require(_0x4612('0x4'));var db=require(_0x4612('0x5'))['db'];var utils=require(_0x4612('0x6'));var logger=require(_0x4612('0x7'))(_0x4612('0x8'));var config=require(_0x4612('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4612('0xa')][_0x4612('0xb')]({'port':0x232a});config[_0x4612('0xc')]=_[_0x4612('0xd')](config['redis'],{'host':_0x4612('0xe'),'port':0x18eb});var socket=require(_0x4612('0xf'))(new Redis(config[_0x4612('0xc')]));require(_0x4612('0x10'))[_0x4612('0x11')](socket);function respondWithRpcPromise(_0x1b37a5,_0x1ce67b,_0x13fddb){return new BPromise(function(_0xfbd14a,_0xc649d1){return client[_0x4612('0x12')](_0x1b37a5,_0x13fddb)[_0x4612('0x13')](function(_0x28339f){logger[_0x4612('0x14')](_0x4612('0x15'),_0x1ce67b,_0x4612('0x16'));logger[_0x4612('0x17')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x1ce67b,_0x4612('0x16'),JSON[_0x4612('0x18')](_0x28339f));if(_0x28339f[_0x4612('0x19')]){if(_0x28339f[_0x4612('0x19')][_0x4612('0x1a')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x1ce67b,_0x28339f[_0x4612('0x19')]['message']);return _0xc649d1(_0x28339f['error'][_0x4612('0x1b')]);}logger[_0x4612('0x19')](_0x4612('0x15'),_0x1ce67b,_0x28339f[_0x4612('0x19')][_0x4612('0x1b')]);return _0xfbd14a(_0x28339f[_0x4612('0x19')][_0x4612('0x1b')]);}else{logger[_0x4612('0x14')](_0x4612('0x15'),_0x1ce67b,_0x4612('0x16'));_0xfbd14a(_0x28339f[_0x4612('0x1c')][_0x4612('0x1b')]);}})[_0x4612('0x1d')](function(_0x2945e4){logger[_0x4612('0x19')]('ChatQueue,\x20%s,\x20%s',_0x1ce67b,_0x2945e4);_0xc649d1(_0x2945e4);});});}exports[_0x4612('0x1e')]=function(_0x1c3b97){var _0x19aa98=this;return new Promise(function(_0x125fc0,_0xe527f8){return db[_0x4612('0x1f')][_0x4612('0x20')]({'raw':_0x1c3b97[_0x4612('0x21')]?_0x1c3b97[_0x4612('0x21')][_0x4612('0x22')]===undefined?!![]:![]:!![],'where':_0x1c3b97[_0x4612('0x21')]?_0x1c3b97[_0x4612('0x21')]['where']||null:null,'attributes':_0x1c3b97[_0x4612('0x21')]?_0x1c3b97[_0x4612('0x21')][_0x4612('0x23')]||null:null,'limit':_0x1c3b97['options']?_0x1c3b97[_0x4612('0x21')][_0x4612('0x24')]||null:null,'include':_0x1c3b97[_0x4612('0x21')]?_0x1c3b97[_0x4612('0x21')][_0x4612('0x25')]?_[_0x4612('0x26')](_0x1c3b97[_0x4612('0x21')][_0x4612('0x25')],function(_0x2c85dd){return{'model':db[_0x2c85dd[_0x4612('0x27')]],'as':_0x2c85dd['as'],'attributes':_0x2c85dd[_0x4612('0x23')],'include':_0x2c85dd['include']?_[_0x4612('0x26')](_0x2c85dd[_0x4612('0x25')],function(_0x328359){return{'model':db[_0x328359[_0x4612('0x27')]],'as':_0x328359['as'],'attributes':_0x328359['attributes'],'include':_0x328359['include']?_[_0x4612('0x26')](_0x328359[_0x4612('0x25')],function(_0x504e31){return{'model':db[_0x504e31[_0x4612('0x27')]],'as':_0x504e31['as'],'attributes':_0x504e31[_0x4612('0x23')]};}):[]};}):[]};}):[]:[]})[_0x4612('0x13')](function(_0x11893c){logger[_0x4612('0x14')](_0x4612('0x1e'),_0x1c3b97);logger[_0x4612('0x17')](_0x4612('0x1e'),_0x1c3b97,JSON[_0x4612('0x18')](_0x11893c));_0x125fc0(_0x11893c);})[_0x4612('0x1d')](function(_0x5af8d2){logger[_0x4612('0x19')](_0x4612('0x1e'),_0x5af8d2[_0x4612('0x1b')],_0x1c3b97);_0xe527f8(_0x19aa98['error'](0x1f4,_0x5af8d2[_0x4612('0x1b')]));});});};exports[_0x4612('0x28')]=function(_0x555d60){var _0x544cf0=this;return new Promise(function(_0x2ae261,_0x54139a){return db['ChatQueue'][_0x4612('0x29')]({'raw':_0x555d60[_0x4612('0x21')]?_0x555d60[_0x4612('0x21')][_0x4612('0x22')]===undefined?!![]:![]:!![],'where':_0x555d60['options']?_0x555d60['options'][_0x4612('0x2a')]||null:null,'attributes':_0x555d60[_0x4612('0x21')]?_0x555d60['options'][_0x4612('0x23')]||null:null,'include':_0x555d60[_0x4612('0x21')]?_0x555d60[_0x4612('0x21')][_0x4612('0x25')]?_[_0x4612('0x26')](_0x555d60['options'][_0x4612('0x25')],function(_0x1062f8){return{'model':db[_0x1062f8[_0x4612('0x27')]],'as':_0x1062f8['as'],'attributes':_0x1062f8['attributes'],'include':_0x1062f8['include']?_[_0x4612('0x26')](_0x1062f8['include'],function(_0x1f786c){return{'model':db[_0x1f786c['model']],'as':_0x1f786c['as'],'attributes':_0x1f786c[_0x4612('0x23')],'include':_0x1f786c[_0x4612('0x25')]?_[_0x4612('0x26')](_0x1f786c[_0x4612('0x25')],function(_0x107723){return{'model':db[_0x107723[_0x4612('0x27')]],'as':_0x107723['as'],'attributes':_0x107723[_0x4612('0x23')]};}):[]};}):[]};}):[]:[]})[_0x4612('0x13')](function(_0x3aeb76){logger[_0x4612('0x14')](_0x4612('0x28'),_0x555d60);logger[_0x4612('0x17')]('ShowChatQueue',_0x555d60,JSON[_0x4612('0x18')](_0x3aeb76));_0x2ae261(_0x3aeb76);})[_0x4612('0x1d')](function(_0x352e83){logger['error'](_0x4612('0x28'),_0x352e83[_0x4612('0x1b')],_0x555d60);_0x54139a(_0x544cf0[_0x4612('0x19')](0x1f4,_0x352e83['message']));});});}; \ No newline at end of file +var _0x73f5=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','redis','./chatQueue.socket','register','request','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueue,\x20%s,\x20%s','message','info','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowChatQueue','find','lodash','util','moment'];(function(_0x2806cd,_0x1a0454){var _0x5bf0f2=function(_0x387bad){while(--_0x387bad){_0x2806cd['push'](_0x2806cd['shift']());}};_0x5bf0f2(++_0x1a0454);}(_0x73f5,0x1cb));var _0x573f=function(_0x3abc2d,_0x38b34f){_0x3abc2d=_0x3abc2d-0x0;var _0x1c876d=_0x73f5[_0x3abc2d];return _0x1c876d;};'use strict';var _=require(_0x573f('0x0'));var util=require(_0x573f('0x1'));var moment=require(_0x573f('0x2'));var BPromise=require(_0x573f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x573f('0x4'));var db=require(_0x573f('0x5'))['db'];var utils=require(_0x573f('0x6'));var logger=require(_0x573f('0x7'))(_0x573f('0x8'));var config=require(_0x573f('0x9'));var jayson=require(_0x573f('0xa'));var client=jayson['client'][_0x573f('0xb')]({'port':0x232a});config['redis']=_[_0x573f('0xc')](config['redis'],{'host':_0x573f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x573f('0xe')]));require(_0x573f('0xf'))[_0x573f('0x10')](socket);function respondWithRpcPromise(_0x5af20d,_0x444114,_0x4ca7b1){return new BPromise(function(_0x33f70c,_0x2c0c0e){return client[_0x573f('0x11')](_0x5af20d,_0x4ca7b1)[_0x573f('0x12')](function(_0x513b1b){logger['info']('ChatQueue,\x20%s,\x20%s',_0x444114,_0x573f('0x13'));logger[_0x573f('0x14')](_0x573f('0x15'),_0x444114,_0x573f('0x13'),JSON[_0x573f('0x16')](_0x513b1b));if(_0x513b1b['error']){if(_0x513b1b['error']['code']===0x1f4){logger[_0x573f('0x17')](_0x573f('0x18'),_0x444114,_0x513b1b[_0x573f('0x17')]['message']);return _0x2c0c0e(_0x513b1b[_0x573f('0x17')]['message']);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x444114,_0x513b1b[_0x573f('0x17')][_0x573f('0x19')]);return _0x33f70c(_0x513b1b[_0x573f('0x17')][_0x573f('0x19')]);}else{logger[_0x573f('0x1a')]('ChatQueue,\x20%s,\x20%s',_0x444114,'request\x20sent');_0x33f70c(_0x513b1b[_0x573f('0x1b')][_0x573f('0x19')]);}})[_0x573f('0x1c')](function(_0x52b193){logger[_0x573f('0x17')](_0x573f('0x18'),_0x444114,_0x52b193);_0x2c0c0e(_0x52b193);});});}exports[_0x573f('0x1d')]=function(_0x17ebd0){var _0x2ff1c0=this;return new Promise(function(_0x443f68,_0x5c4308){return db[_0x573f('0x1e')][_0x573f('0x1f')]({'raw':_0x17ebd0[_0x573f('0x20')]?_0x17ebd0[_0x573f('0x20')][_0x573f('0x21')]===undefined?!![]:![]:!![],'where':_0x17ebd0[_0x573f('0x20')]?_0x17ebd0[_0x573f('0x20')][_0x573f('0x22')]||null:null,'attributes':_0x17ebd0[_0x573f('0x20')]?_0x17ebd0[_0x573f('0x20')][_0x573f('0x23')]||null:null,'limit':_0x17ebd0[_0x573f('0x20')]?_0x17ebd0[_0x573f('0x20')][_0x573f('0x24')]||null:null,'include':_0x17ebd0[_0x573f('0x20')]?_0x17ebd0[_0x573f('0x20')][_0x573f('0x25')]?_['map'](_0x17ebd0['options'][_0x573f('0x25')],function(_0x31e7cd){return{'model':db[_0x31e7cd['model']],'as':_0x31e7cd['as'],'attributes':_0x31e7cd['attributes'],'include':_0x31e7cd[_0x573f('0x25')]?_[_0x573f('0x26')](_0x31e7cd[_0x573f('0x25')],function(_0x54ae1a){return{'model':db[_0x54ae1a[_0x573f('0x27')]],'as':_0x54ae1a['as'],'attributes':_0x54ae1a[_0x573f('0x23')],'include':_0x54ae1a[_0x573f('0x25')]?_[_0x573f('0x26')](_0x54ae1a[_0x573f('0x25')],function(_0x54eef1){return{'model':db[_0x54eef1[_0x573f('0x27')]],'as':_0x54eef1['as'],'attributes':_0x54eef1[_0x573f('0x23')]};}):[]};}):[]};}):[]:[]})[_0x573f('0x12')](function(_0xf92f26){logger['info']('GetChatQueue',_0x17ebd0);logger[_0x573f('0x14')](_0x573f('0x1d'),_0x17ebd0,JSON[_0x573f('0x16')](_0xf92f26));_0x443f68(_0xf92f26);})[_0x573f('0x1c')](function(_0x30c1b4){logger[_0x573f('0x17')](_0x573f('0x1d'),_0x30c1b4[_0x573f('0x19')],_0x17ebd0);_0x5c4308(_0x2ff1c0['error'](0x1f4,_0x30c1b4[_0x573f('0x19')]));});});};exports[_0x573f('0x28')]=function(_0x454012){var _0x41c3d9=this;return new Promise(function(_0x448647,_0x4ea70d){return db[_0x573f('0x1e')][_0x573f('0x29')]({'raw':_0x454012[_0x573f('0x20')]?_0x454012['options'][_0x573f('0x21')]===undefined?!![]:![]:!![],'where':_0x454012[_0x573f('0x20')]?_0x454012[_0x573f('0x20')]['where']||null:null,'attributes':_0x454012[_0x573f('0x20')]?_0x454012[_0x573f('0x20')][_0x573f('0x23')]||null:null,'include':_0x454012['options']?_0x454012['options']['include']?_[_0x573f('0x26')](_0x454012['options'][_0x573f('0x25')],function(_0x5b7401){return{'model':db[_0x5b7401[_0x573f('0x27')]],'as':_0x5b7401['as'],'attributes':_0x5b7401['attributes'],'include':_0x5b7401[_0x573f('0x25')]?_[_0x573f('0x26')](_0x5b7401[_0x573f('0x25')],function(_0x26d973){return{'model':db[_0x26d973[_0x573f('0x27')]],'as':_0x26d973['as'],'attributes':_0x26d973[_0x573f('0x23')],'include':_0x26d973[_0x573f('0x25')]?_[_0x573f('0x26')](_0x26d973[_0x573f('0x25')],function(_0x3b5017){return{'model':db[_0x3b5017[_0x573f('0x27')]],'as':_0x3b5017['as'],'attributes':_0x3b5017['attributes']};}):[]};}):[]};}):[]:[]})[_0x573f('0x12')](function(_0x68f3a8){logger['info'](_0x573f('0x28'),_0x454012);logger[_0x573f('0x14')](_0x573f('0x28'),_0x454012,JSON[_0x573f('0x16')](_0x68f3a8));_0x448647(_0x68f3a8);})['catch'](function(_0x2b4fc5){logger[_0x573f('0x17')](_0x573f('0x28'),_0x2b4fc5[_0x573f('0x19')],_0x454012);_0x4ea70d(_0x41c3d9['error'](0x1f4,_0x2b4fc5['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index b7eb8db..ad7fde6 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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x4ddb4e,_0x38c020){var _0x1c2f4c=function(_0x4cf0cb){while(--_0x4cf0cb){_0x4ddb4e['push'](_0x4ddb4e['shift']());}};_0x1c2f4c(++_0x38c020);}(_0x5f2f,0x73));var _0xf5f2=function(_0x40f550,_0x3ada84){_0x40f550=_0x40f550-0x0;var _0xa688ed=_0x5f2f[_0x40f550];return _0xa688ed;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x2299b8,_0x31ea5e){var _0xa70342=function(_0x1fb0c2){while(--_0x1fb0c2){_0x2299b8['push'](_0x2299b8['shift']());}};_0xa70342(++_0x31ea5e);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4e7844,_0x30ce77){_0x4e7844=_0x4e7844-0x0;var _0x336119=_0x0b0e[_0x4e7844];return _0x336119;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 3d77aad..cd44517 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 _0xdd61=['get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','post','addTeams','/:id/users','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatQueue.controller'];(function(_0x13a0a3,_0xbb6a71){var _0x1fac00=function(_0xb250f8){while(--_0xb250f8){_0x13a0a3['push'](_0x13a0a3['shift']());}};_0x1fac00(++_0xbb6a71);}(_0xdd61,0x165));var _0x1dd6=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xdd61[_0x174ef5];return _0x1cc379;};'use strict';var multer=require(_0x1dd6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1dd6('0x1'));var express=require(_0x1dd6('0x2'));var router=express[_0x1dd6('0x3')]();var auth=require(_0x1dd6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1dd6('0x5'));var controller=require(_0x1dd6('0x6'));router[_0x1dd6('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x1dd6('0x8')](),controller[_0x1dd6('0x9')]);router[_0x1dd6('0x7')](_0x1dd6('0xa'),auth[_0x1dd6('0x8')](),controller[_0x1dd6('0xb')]);router['get'](_0x1dd6('0xc'),auth[_0x1dd6('0x8')](),controller[_0x1dd6('0xd')]);router[_0x1dd6('0x7')](_0x1dd6('0xe'),auth[_0x1dd6('0x8')](),controller[_0x1dd6('0xf')]);router[_0x1dd6('0x7')]('/:id/users',auth[_0x1dd6('0x8')](),controller[_0x1dd6('0x10')]);router['post']('/',auth[_0x1dd6('0x8')](),controller[_0x1dd6('0x11')]);router[_0x1dd6('0x12')]('/:id/teams',auth[_0x1dd6('0x8')](),controller[_0x1dd6('0x13')]);router[_0x1dd6('0x12')](_0x1dd6('0x14'),auth[_0x1dd6('0x8')](),controller[_0x1dd6('0x15')]);router[_0x1dd6('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1dd6('0x17')]('/:id',auth[_0x1dd6('0x8')](),controller[_0x1dd6('0x18')]);router['delete']('/:id/teams',auth[_0x1dd6('0x8')](),controller[_0x1dd6('0x19')]);router[_0x1dd6('0x17')]('/:id/users',auth[_0x1dd6('0x8')](),controller[_0x1dd6('0x1a')]);module[_0x1dd6('0x1b')]=router; \ No newline at end of file +var _0x70f0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x40fc45,_0x5518bc){var _0x179e2d=function(_0x584129){while(--_0x584129){_0x40fc45['push'](_0x40fc45['shift']());}};_0x179e2d(++_0x5518bc);}(_0x70f0,0x17a));var _0x070f=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0x70f0[_0x2a56ad];return _0x425175;};'use strict';var multer=require(_0x070f('0x0'));var util=require(_0x070f('0x1'));var path=require(_0x070f('0x2'));var timeout=require(_0x070f('0x3'));var express=require(_0x070f('0x4'));var router=express[_0x070f('0x5')]();var auth=require(_0x070f('0x6'));var interaction=require(_0x070f('0x7'));var config=require(_0x070f('0x8'));var controller=require(_0x070f('0x9'));router[_0x070f('0xa')]('/',auth[_0x070f('0xb')](),controller[_0x070f('0xc')]);router[_0x070f('0xa')]('/describe',auth[_0x070f('0xb')](),controller[_0x070f('0xd')]);router[_0x070f('0xa')](_0x070f('0xe'),auth['isAuthenticated'](),controller[_0x070f('0xf')]);router[_0x070f('0xa')](_0x070f('0x10'),auth[_0x070f('0xb')](),controller['getMembers']);router[_0x070f('0xa')](_0x070f('0x11'),auth[_0x070f('0xb')](),controller[_0x070f('0x12')]);router[_0x070f('0xa')](_0x070f('0x13'),auth[_0x070f('0xb')](),controller[_0x070f('0x14')]);router[_0x070f('0x15')]('/',auth[_0x070f('0xb')](),controller[_0x070f('0x16')]);router[_0x070f('0x15')]('/:id/teams',auth['isAuthenticated'](),controller[_0x070f('0x17')]);router['post']('/:id/users',auth[_0x070f('0xb')](),controller[_0x070f('0x18')]);router[_0x070f('0x19')](_0x070f('0xe'),auth[_0x070f('0xb')](),controller[_0x070f('0x1a')]);router[_0x070f('0x1b')](_0x070f('0xe'),auth[_0x070f('0xb')](),controller[_0x070f('0x1c')]);router[_0x070f('0x1b')]('/:id/teams',auth[_0x070f('0xb')](),controller[_0x070f('0x1d')]);router[_0x070f('0x1b')](_0x070f('0x13'),auth[_0x070f('0xb')](),controller[_0x070f('0x1e')]);module[_0x070f('0x1f')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 68f734d..a037612 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 _0x53cd=['DATE','moment','sequelize','exports','STRING'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0x53cd,0x100));var _0xd53c=function(_0x1e3dc1,_0x5cb7be){_0x1e3dc1=_0x1e3dc1-0x0;var _0x589055=_0x53cd[_0x1e3dc1];return _0x589055;};'use strict';var moment=require(_0xd53c('0x0'));var Sequelize=require(_0xd53c('0x1'));module[_0xd53c('0x2')]={'uniqueid':{'type':Sequelize[_0xd53c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd53c('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd53c('0x4')]},'acceptAt':{'type':Sequelize[_0xd53c('0x4')]},'exitAt':{'type':Sequelize[_0xd53c('0x4')]},'reason':{'type':Sequelize[_0xd53c('0x3')]}}; \ No newline at end of file +var _0x3d70=['moment','STRING','DATE'];(function(_0x39d961,_0x1dbce3){var _0x3dfa92=function(_0x71caf2){while(--_0x71caf2){_0x39d961['push'](_0x39d961['shift']());}};_0x3dfa92(++_0x1dbce3);}(_0x3d70,0x144));var _0x03d7=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x3d70[_0x5471ec];return _0x121d4c;};'use strict';var moment=require(_0x03d7('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x03d7('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x03d7('0x1')]},'joinAt':{'type':Sequelize[_0x03d7('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x03d7('0x2')]},'reason':{'type':Sequelize[_0x03d7('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 150d494..2004f4d 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 _0xa1df=['end','offset','limit','set','Content-Range','json','reject','save','update','then','error','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','type','query','keys','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','intersection','length','find','create','body','destroy','describe','eml-format','zip-dir','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/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x13c883,_0xd03ba9){var _0x45ae25=function(_0x2a9300){while(--_0x2a9300){_0x13c883['push'](_0x13c883['shift']());}};_0x45ae25(++_0xd03ba9);}(_0xa1df,0x1ac));var _0xfa1d=function(_0x33e591,_0x473168){_0x33e591=_0x33e591-0x0;var _0x4d60a8=_0xa1df[_0x33e591];return _0x4d60a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfa1d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfa1d('0x1'));var jsonpatch=require(_0xfa1d('0x2'));var rp=require(_0xfa1d('0x3'));var moment=require(_0xfa1d('0x4'));var BPromise=require(_0xfa1d('0x5'));var Mustache=require(_0xfa1d('0x6'));var util=require(_0xfa1d('0x7'));var path=require(_0xfa1d('0x8'));var sox=require(_0xfa1d('0x9'));var csv=require(_0xfa1d('0xa'));var ejs=require(_0xfa1d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfa1d('0xc'));var crypto=require(_0xfa1d('0xd'));var jsforce=require(_0xfa1d('0xe'));var deskjs=require(_0xfa1d('0xf'));var toCsv=require(_0xfa1d('0xa'));var querystring=require('querystring');var Papa=require(_0xfa1d('0x10'));var Redis=require(_0xfa1d('0x11'));var authService=require(_0xfa1d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfa1d('0x13'));var hardwareService=require(_0xfa1d('0x14'));var logger=require(_0xfa1d('0x15'))('api');var utils=require(_0xfa1d('0x16'));var config=require(_0xfa1d('0x17'));var licenseUtil=require(_0xfa1d('0x18'));var db=require(_0xfa1d('0x19'))['db'];function respondWithStatusCode(_0x575c4d,_0x2f670c){_0x2f670c=_0x2f670c||0xcc;return function(_0x4de46b){if(_0x4de46b){return _0x575c4d[_0xfa1d('0x1a')](_0x2f670c);}return _0x575c4d[_0xfa1d('0x1b')](_0x2f670c)[_0xfa1d('0x1c')]();};}function respondWithResult(_0x29245e,_0x4cecc0){_0x4cecc0=_0x4cecc0||0xc8;return function(_0xcb3012){if(_0xcb3012){return _0x29245e['status'](_0x4cecc0)['json'](_0xcb3012);}};}function respondWithFilteredResult(_0x30f529,_0x3bba4f){return function(_0x3666a2){if(_0x3666a2){var _0x5b2797=_0x3666a2['count'],_0x44797a=_0x3bba4f[_0xfa1d('0x1d')],_0x2cc9af=_0x3bba4f[_0xfa1d('0x1d')]+_0x3bba4f[_0xfa1d('0x1e')],_0xda73aa;if(_0x2cc9af>=_0x5b2797){_0x2cc9af=_0x5b2797;_0xda73aa=0xc8;}else{_0xda73aa=0xce;}_0x30f529[_0xfa1d('0x1b')](_0xda73aa);return _0x30f529[_0xfa1d('0x1f')](_0xfa1d('0x20'),_0x44797a+'-'+_0x2cc9af+'/'+_0x5b2797)[_0xfa1d('0x21')](_0x3666a2);}return null;};}function patchUpdates(_0x552b7c){return function(_0x5eeb6e){try{jsonpatch['apply'](_0x5eeb6e,_0x552b7c,!![]);}catch(_0x408fe2){return BPromise[_0xfa1d('0x22')](_0x408fe2);}return _0x5eeb6e[_0xfa1d('0x23')]();};}function saveUpdates(_0x890542,_0x1035ee){return function(_0x3e0598){if(_0x3e0598){return _0x3e0598[_0xfa1d('0x24')](_0x890542)[_0xfa1d('0x25')](function(_0x47199d){return _0x47199d;});}return null;};}function removeEntity(_0x426842,_0x57397b){return function(_0x5228c1){if(_0x5228c1){return _0x5228c1['destroy']()[_0xfa1d('0x25')](function(){_0x426842[_0xfa1d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3548e3,_0x1dd585){return function(_0x3abe62){if(!_0x3abe62){_0x3548e3['sendStatus'](0x194);}return _0x3abe62;};}function handleError(_0x3b9e44,_0x185faa){_0x185faa=_0x185faa||0x1f4;return function(_0x496385){logger[_0xfa1d('0x26')](_0x496385[_0xfa1d('0x27')]);if(_0x496385[_0xfa1d('0x28')]){delete _0x496385[_0xfa1d('0x28')];}_0x3b9e44[_0xfa1d('0x1b')](_0x185faa)['send'](_0x496385);};}exports[_0xfa1d('0x29')]=function(_0x91b88e,_0x31275e){var _0x24048a={},_0x1effbd={},_0x531702={'count':0x0,'rows':[]};var _0x4f4fa1=_[_0xfa1d('0x2a')](db[_0xfa1d('0x2b')][_0xfa1d('0x2c')],function(_0x5b2c5f){return{'name':_0x5b2c5f[_0xfa1d('0x2d')],'type':_0x5b2c5f[_0xfa1d('0x2e')]['key']};});_0x1effbd['model']=_[_0xfa1d('0x2a')](_0x4f4fa1,_0xfa1d('0x28'));_0x1effbd[_0xfa1d('0x2f')]=_[_0xfa1d('0x30')](_0x91b88e[_0xfa1d('0x2f')]);_0x1effbd['filters']=_['intersection'](_0x1effbd[_0xfa1d('0x31')],_0x1effbd[_0xfa1d('0x2f')]);_0x24048a[_0xfa1d('0x32')]=_['intersection'](_0x1effbd[_0xfa1d('0x31')],qs[_0xfa1d('0x33')](_0x91b88e[_0xfa1d('0x2f')][_0xfa1d('0x33')]));_0x24048a[_0xfa1d('0x32')]=_0x24048a['attributes']['length']?_0x24048a[_0xfa1d('0x32')]:_0x1effbd[_0xfa1d('0x31')];if(!_0x91b88e['query'][_0xfa1d('0x34')]('nolimit')){_0x24048a['limit']=qs[_0xfa1d('0x1e')](_0x91b88e[_0xfa1d('0x2f')]['limit']);_0x24048a['offset']=qs[_0xfa1d('0x1d')](_0x91b88e[_0xfa1d('0x2f')]['offset']);}_0x24048a[_0xfa1d('0x35')]=qs['sort'](_0x91b88e[_0xfa1d('0x2f')][_0xfa1d('0x36')]);_0x24048a[_0xfa1d('0x37')]=qs[_0xfa1d('0x38')](_[_0xfa1d('0x39')](_0x91b88e[_0xfa1d('0x2f')],_0x1effbd[_0xfa1d('0x38')]),_0x4f4fa1);if(_0x91b88e[_0xfa1d('0x2f')]['filter']){_0x24048a[_0xfa1d('0x37')]=_[_0xfa1d('0x3a')](_0x24048a[_0xfa1d('0x37')],{'$or':_[_0xfa1d('0x2a')](_0x4f4fa1,function(_0x3317d0){if(_0x3317d0[_0xfa1d('0x2e')]!==_0xfa1d('0x3b')){var _0x47377f={};_0x47377f[_0x3317d0['name']]={'$like':'%'+_0x91b88e[_0xfa1d('0x2f')]['filter']+'%'};return _0x47377f;}})});}_0x24048a=_['merge']({},_0x24048a,_0x91b88e[_0xfa1d('0x3c')]);var _0x5a763b={'where':_0x24048a[_0xfa1d('0x37')]};return db['ChatQueueReport'][_0xfa1d('0x3d')](_0x5a763b)[_0xfa1d('0x25')](function(_0xfa3256){_0x531702['count']=_0xfa3256;if(_0x91b88e[_0xfa1d('0x2f')][_0xfa1d('0x3e')]){_0x24048a[_0xfa1d('0x3f')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xfa1d('0x40')](_0x24048a);})[_0xfa1d('0x25')](function(_0x5c186e){_0x531702[_0xfa1d('0x41')]=_0x5c186e;return _0x531702;})[_0xfa1d('0x25')](respondWithFilteredResult(_0x31275e,_0x24048a))[_0xfa1d('0x42')](handleError(_0x31275e,null));};exports[_0xfa1d('0x43')]=function(_0x131aca,_0x58acc8){var _0x4746fe={'raw':!![],'where':{'id':_0x131aca[_0xfa1d('0x44')]['id']}},_0x2d76e4={};_0x2d76e4['model']=_['keys'](db[_0xfa1d('0x2b')][_0xfa1d('0x2c')]);_0x2d76e4[_0xfa1d('0x2f')]=_[_0xfa1d('0x30')](_0x131aca[_0xfa1d('0x2f')]);_0x2d76e4[_0xfa1d('0x38')]=_[_0xfa1d('0x45')](_0x2d76e4[_0xfa1d('0x31')],_0x2d76e4[_0xfa1d('0x2f')]);_0x4746fe[_0xfa1d('0x32')]=_[_0xfa1d('0x45')](_0x2d76e4[_0xfa1d('0x31')],qs[_0xfa1d('0x33')](_0x131aca['query'][_0xfa1d('0x33')]));_0x4746fe[_0xfa1d('0x32')]=_0x4746fe[_0xfa1d('0x32')][_0xfa1d('0x46')]?_0x4746fe[_0xfa1d('0x32')]:_0x2d76e4['model'];if(_0x131aca[_0xfa1d('0x2f')][_0xfa1d('0x3e')]){_0x4746fe[_0xfa1d('0x3f')]=[{'all':!![]}];}_0x4746fe=_['merge']({},_0x4746fe,_0x131aca[_0xfa1d('0x3c')]);return db[_0xfa1d('0x2b')][_0xfa1d('0x47')](_0x4746fe)['then'](handleEntityNotFound(_0x58acc8,null))[_0xfa1d('0x25')](respondWithResult(_0x58acc8,null))[_0xfa1d('0x42')](handleError(_0x58acc8,null));};exports[_0xfa1d('0x48')]=function(_0x1accc8,_0x4ba4f4){return db['ChatQueueReport'][_0xfa1d('0x48')](_0x1accc8[_0xfa1d('0x49')],{})[_0xfa1d('0x25')](respondWithResult(_0x4ba4f4,0xc9))[_0xfa1d('0x42')](handleError(_0x4ba4f4,null));};exports['update']=function(_0x28c377,_0x56ecbe){if(_0x28c377[_0xfa1d('0x49')]['id']){delete _0x28c377[_0xfa1d('0x49')]['id'];}return db[_0xfa1d('0x2b')][_0xfa1d('0x47')]({'where':{'id':_0x28c377['params']['id']}})['then'](handleEntityNotFound(_0x56ecbe,null))[_0xfa1d('0x25')](saveUpdates(_0x28c377[_0xfa1d('0x49')],null))['then'](respondWithResult(_0x56ecbe,null))[_0xfa1d('0x42')](handleError(_0x56ecbe,null));};exports[_0xfa1d('0x4a')]=function(_0x423880,_0x1cb4f9){return db[_0xfa1d('0x2b')][_0xfa1d('0x47')]({'where':{'id':_0x423880[_0xfa1d('0x44')]['id']}})['then'](handleEntityNotFound(_0x1cb4f9,null))[_0xfa1d('0x25')](removeEntity(_0x1cb4f9,null))[_0xfa1d('0x42')](handleError(_0x1cb4f9,null));};exports[_0xfa1d('0x4b')]=function(_0x65d1b5,_0x6ea045){return db['ChatQueueReport'][_0xfa1d('0x4b')]()[_0xfa1d('0x25')](respondWithResult(_0x6ea045,null))[_0xfa1d('0x42')](handleError(_0x6ea045,null));}; \ No newline at end of file +var _0x9bd8=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','end','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','params','intersection','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x19449a,_0x190b60){var _0x4d0acd=function(_0xfb4226){while(--_0xfb4226){_0x19449a['push'](_0x19449a['shift']());}};_0x4d0acd(++_0x190b60);}(_0x9bd8,0x1f4));var _0x89bd=function(_0x8ec6b4,_0x31ef52){_0x8ec6b4=_0x8ec6b4-0x0;var _0x52c0d0=_0x9bd8[_0x8ec6b4];return _0x52c0d0;};'use strict';var pdf=require(_0x89bd('0x0'));var emlformat=require(_0x89bd('0x1'));var rimraf=require(_0x89bd('0x2'));var zipdir=require(_0x89bd('0x3'));var jsonpatch=require(_0x89bd('0x4'));var rp=require(_0x89bd('0x5'));var moment=require(_0x89bd('0x6'));var BPromise=require(_0x89bd('0x7'));var Mustache=require(_0x89bd('0x8'));var util=require(_0x89bd('0x9'));var path=require(_0x89bd('0xa'));var sox=require(_0x89bd('0xb'));var csv=require(_0x89bd('0xc'));var ejs=require(_0x89bd('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x89bd('0xe'));var crypto=require(_0x89bd('0xf'));var jsforce=require(_0x89bd('0x10'));var deskjs=require(_0x89bd('0x11'));var toCsv=require(_0x89bd('0xc'));var querystring=require(_0x89bd('0x12'));var Papa=require(_0x89bd('0x13'));var Redis=require('ioredis');var authService=require(_0x89bd('0x14'));var qs=require(_0x89bd('0x15'));var as=require(_0x89bd('0x16'));var hardwareService=require(_0x89bd('0x17'));var logger=require(_0x89bd('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x89bd('0x19'));var licenseUtil=require(_0x89bd('0x1a'));var db=require(_0x89bd('0x1b'))['db'];function respondWithStatusCode(_0x398cea,_0x440426){_0x440426=_0x440426||0xcc;return function(_0x331f94){if(_0x331f94){return _0x398cea[_0x89bd('0x1c')](_0x440426);}return _0x398cea['status'](_0x440426)['end']();};}function respondWithResult(_0x478903,_0x5d8dc4){_0x5d8dc4=_0x5d8dc4||0xc8;return function(_0x4e8579){if(_0x4e8579){return _0x478903[_0x89bd('0x1d')](_0x5d8dc4)[_0x89bd('0x1e')](_0x4e8579);}};}function respondWithFilteredResult(_0x3627d4,_0x42540f){return function(_0x56bf6f){if(_0x56bf6f){var _0xe6aa9=_0x56bf6f[_0x89bd('0x1f')],_0x52b50e=_0x42540f[_0x89bd('0x20')],_0x5724cd=_0x42540f[_0x89bd('0x20')]+_0x42540f[_0x89bd('0x21')],_0x34a4f0;if(_0x5724cd>=_0xe6aa9){_0x5724cd=_0xe6aa9;_0x34a4f0=0xc8;}else{_0x34a4f0=0xce;}_0x3627d4[_0x89bd('0x1d')](_0x34a4f0);return _0x3627d4[_0x89bd('0x22')](_0x89bd('0x23'),_0x52b50e+'-'+_0x5724cd+'/'+_0xe6aa9)['json'](_0x56bf6f);}return null;};}function patchUpdates(_0x3824eb){return function(_0x2d56c2){try{jsonpatch[_0x89bd('0x24')](_0x2d56c2,_0x3824eb,!![]);}catch(_0x41a7b8){return BPromise['reject'](_0x41a7b8);}return _0x2d56c2['save']();};}function saveUpdates(_0x4da497,_0x12e174){return function(_0x35ed21){if(_0x35ed21){return _0x35ed21[_0x89bd('0x25')](_0x4da497)[_0x89bd('0x26')](function(_0x46a0be){return _0x46a0be;});}return null;};}function removeEntity(_0x4e0f93,_0x24d3bf){return function(_0x57fe0e){if(_0x57fe0e){return _0x57fe0e[_0x89bd('0x27')]()['then'](function(){_0x4e0f93['status'](0xcc)[_0x89bd('0x28')]();});}};}function handleEntityNotFound(_0x1a10a8,_0x137300){return function(_0x1b72c3){if(!_0x1b72c3){_0x1a10a8['sendStatus'](0x194);}return _0x1b72c3;};}function handleError(_0x4805d6,_0x1425bc){_0x1425bc=_0x1425bc||0x1f4;return function(_0x1077a2){logger[_0x89bd('0x29')](_0x1077a2[_0x89bd('0x2a')]);if(_0x1077a2[_0x89bd('0x2b')]){delete _0x1077a2[_0x89bd('0x2b')];}_0x4805d6[_0x89bd('0x1d')](_0x1425bc)[_0x89bd('0x2c')](_0x1077a2);};}exports[_0x89bd('0x2d')]=function(_0x464d78,_0x1a34fb){var _0x3cbb77={},_0x31b79c={},_0x44302c={'count':0x0,'rows':[]};var _0x1d3edd=_[_0x89bd('0x2e')](db[_0x89bd('0x2f')][_0x89bd('0x30')],function(_0x46abe7){return{'name':_0x46abe7['fieldName'],'type':_0x46abe7['type']['key']};});_0x31b79c[_0x89bd('0x31')]=_['map'](_0x1d3edd,_0x89bd('0x2b'));_0x31b79c['query']=_[_0x89bd('0x32')](_0x464d78[_0x89bd('0x33')]);_0x31b79c[_0x89bd('0x34')]=_['intersection'](_0x31b79c['model'],_0x31b79c[_0x89bd('0x33')]);_0x3cbb77[_0x89bd('0x35')]=_['intersection'](_0x31b79c[_0x89bd('0x31')],qs[_0x89bd('0x36')](_0x464d78[_0x89bd('0x33')][_0x89bd('0x36')]));_0x3cbb77[_0x89bd('0x35')]=_0x3cbb77[_0x89bd('0x35')]['length']?_0x3cbb77[_0x89bd('0x35')]:_0x31b79c['model'];if(!_0x464d78[_0x89bd('0x33')][_0x89bd('0x37')](_0x89bd('0x38'))){_0x3cbb77[_0x89bd('0x21')]=qs[_0x89bd('0x21')](_0x464d78[_0x89bd('0x33')][_0x89bd('0x21')]);_0x3cbb77[_0x89bd('0x20')]=qs[_0x89bd('0x20')](_0x464d78[_0x89bd('0x33')][_0x89bd('0x20')]);}_0x3cbb77[_0x89bd('0x39')]=qs[_0x89bd('0x3a')](_0x464d78[_0x89bd('0x33')][_0x89bd('0x3a')]);_0x3cbb77[_0x89bd('0x3b')]=qs[_0x89bd('0x34')](_[_0x89bd('0x3c')](_0x464d78[_0x89bd('0x33')],_0x31b79c['filters']),_0x1d3edd);if(_0x464d78[_0x89bd('0x33')][_0x89bd('0x3d')]){_0x3cbb77[_0x89bd('0x3b')]=_[_0x89bd('0x3e')](_0x3cbb77[_0x89bd('0x3b')],{'$or':_[_0x89bd('0x2e')](_0x1d3edd,function(_0x4e1251){if(_0x4e1251['type']!=='VIRTUAL'){var _0x227d03={};_0x227d03[_0x4e1251[_0x89bd('0x2b')]]={'$like':'%'+_0x464d78[_0x89bd('0x33')][_0x89bd('0x3d')]+'%'};return _0x227d03;}})});}_0x3cbb77=_['merge']({},_0x3cbb77,_0x464d78[_0x89bd('0x3f')]);var _0x578e4f={'where':_0x3cbb77['where']};return db[_0x89bd('0x2f')][_0x89bd('0x1f')](_0x578e4f)[_0x89bd('0x26')](function(_0x347610){_0x44302c[_0x89bd('0x1f')]=_0x347610;if(_0x464d78[_0x89bd('0x33')][_0x89bd('0x40')]){_0x3cbb77[_0x89bd('0x41')]=[{'all':!![]}];}return db[_0x89bd('0x2f')]['findAll'](_0x3cbb77);})[_0x89bd('0x26')](function(_0x22fd87){_0x44302c[_0x89bd('0x42')]=_0x22fd87;return _0x44302c;})['then'](respondWithFilteredResult(_0x1a34fb,_0x3cbb77))[_0x89bd('0x43')](handleError(_0x1a34fb,null));};exports['show']=function(_0x3cfd32,_0x1cd8f7){var _0x159a2c={'raw':!![],'where':{'id':_0x3cfd32[_0x89bd('0x44')]['id']}},_0x4b4637={};_0x4b4637[_0x89bd('0x31')]=_[_0x89bd('0x32')](db[_0x89bd('0x2f')]['rawAttributes']);_0x4b4637[_0x89bd('0x33')]=_[_0x89bd('0x32')](_0x3cfd32[_0x89bd('0x33')]);_0x4b4637[_0x89bd('0x34')]=_[_0x89bd('0x45')](_0x4b4637[_0x89bd('0x31')],_0x4b4637[_0x89bd('0x33')]);_0x159a2c['attributes']=_[_0x89bd('0x45')](_0x4b4637[_0x89bd('0x31')],qs['fields'](_0x3cfd32[_0x89bd('0x33')]['fields']));_0x159a2c[_0x89bd('0x35')]=_0x159a2c[_0x89bd('0x35')][_0x89bd('0x46')]?_0x159a2c[_0x89bd('0x35')]:_0x4b4637[_0x89bd('0x31')];if(_0x3cfd32[_0x89bd('0x33')][_0x89bd('0x40')]){_0x159a2c[_0x89bd('0x41')]=[{'all':!![]}];}_0x159a2c=_[_0x89bd('0x3e')]({},_0x159a2c,_0x3cfd32[_0x89bd('0x3f')]);return db[_0x89bd('0x2f')][_0x89bd('0x47')](_0x159a2c)[_0x89bd('0x26')](handleEntityNotFound(_0x1cd8f7,null))[_0x89bd('0x26')](respondWithResult(_0x1cd8f7,null))['catch'](handleError(_0x1cd8f7,null));};exports[_0x89bd('0x48')]=function(_0x389386,_0x575c86){return db['ChatQueueReport']['create'](_0x389386[_0x89bd('0x49')],{})['then'](respondWithResult(_0x575c86,0xc9))[_0x89bd('0x43')](handleError(_0x575c86,null));};exports[_0x89bd('0x25')]=function(_0x4e03cf,_0x11576f){if(_0x4e03cf['body']['id']){delete _0x4e03cf[_0x89bd('0x49')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x4e03cf[_0x89bd('0x44')]['id']}})[_0x89bd('0x26')](handleEntityNotFound(_0x11576f,null))['then'](saveUpdates(_0x4e03cf[_0x89bd('0x49')],null))[_0x89bd('0x26')](respondWithResult(_0x11576f,null))[_0x89bd('0x43')](handleError(_0x11576f,null));};exports[_0x89bd('0x27')]=function(_0x28c3b2,_0x12328c){return db[_0x89bd('0x2f')]['find']({'where':{'id':_0x28c3b2[_0x89bd('0x44')]['id']}})['then'](handleEntityNotFound(_0x12328c,null))[_0x89bd('0x26')](removeEntity(_0x12328c,null))[_0x89bd('0x43')](handleError(_0x12328c,null));};exports['describe']=function(_0x3a221f,_0x50b8ec){return db[_0x89bd('0x2f')][_0x89bd('0x4a')]()[_0x89bd('0x26')](respondWithResult(_0x50b8ec,null))[_0x89bd('0x43')](handleError(_0x50b8ec,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index a352a7f..bf340cd 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 _0xb193=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','util','../../config/logger'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb193,0x10f));var _0x3b19=function(_0x35f83e,_0x30ec55){_0x35f83e=_0x35f83e-0x0;var _0x249b05=_0xb193[_0x35f83e];return _0x249b05;};'use strict';var _=require('lodash');var util=require(_0x3b19('0x0'));var logger=require(_0x3b19('0x1'))(_0x3b19('0x2'));var moment=require(_0x3b19('0x3'));var BPromise=require(_0x3b19('0x4'));var rp=require(_0x3b19('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b19('0x6'));var config=require(_0x3b19('0x7'));var attributes=require(_0x3b19('0x8'));module[_0x3b19('0x9')]=function(_0xaa3372,_0x965df3){return _0xaa3372[_0x3b19('0xa')]('ChatQueueReport',attributes,{'tableName':_0x3b19('0xb'),'paranoid':![],'indexes':[{'name':_0x3b19('0xc'),'fields':[_0x3b19('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfcd8=['./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x415f7e,_0x4630b6){var _0x311ff4=function(_0x19c19d){while(--_0x19c19d){_0x415f7e['push'](_0x415f7e['shift']());}};_0x311ff4(++_0x4630b6);}(_0xfcd8,0x131));var _0x8fcd=function(_0x42b9cd,_0x2a5af6){_0x42b9cd=_0x42b9cd-0x0;var _0x42bd9a=_0xfcd8[_0x42b9cd];return _0x42bd9a;};'use strict';var _=require(_0x8fcd('0x0'));var util=require(_0x8fcd('0x1'));var logger=require(_0x8fcd('0x2'))(_0x8fcd('0x3'));var moment=require(_0x8fcd('0x4'));var BPromise=require(_0x8fcd('0x5'));var rp=require(_0x8fcd('0x6'));var fs=require('fs');var path=require(_0x8fcd('0x7'));var rimraf=require(_0x8fcd('0x8'));var config=require(_0x8fcd('0x9'));var attributes=require(_0x8fcd('0xa'));module[_0x8fcd('0xb')]=function(_0x3b9f65,_0x5d6e8e){return _0x3b9f65[_0x8fcd('0xc')](_0x8fcd('0xd'),attributes,{'tableName':_0x8fcd('0xe'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 160f852..e9703a0 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 _0x1d2a=['then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ChatQueueReport','create','body','options','raw','CreateChatQueueReport','UpdateChatQueueReport','where','attributes','limit','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x20ac42,_0x5e9bb5){var _0x242ff6=function(_0x464ced){while(--_0x464ced){_0x20ac42['push'](_0x20ac42['shift']());}};_0x242ff6(++_0x5e9bb5);}(_0x1d2a,0xf5));var _0xa1d2=function(_0x3a2105,_0x46b106){_0x3a2105=_0x3a2105-0x0;var _0x6a7c5d=_0x1d2a[_0x3a2105];return _0x6a7c5d;};'use strict';var _=require(_0xa1d2('0x0'));var util=require(_0xa1d2('0x1'));var moment=require(_0xa1d2('0x2'));var BPromise=require(_0xa1d2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa1d2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa1d2('0x5'));var config=require(_0xa1d2('0x6'));var jayson=require(_0xa1d2('0x7'));var client=jayson[_0xa1d2('0x8')][_0xa1d2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x278d12,_0x331dba,_0x458541){return new BPromise(function(_0x4ece38,_0x4f10){return client[_0xa1d2('0xa')](_0x278d12,_0x458541)[_0xa1d2('0xb')](function(_0x185da5){logger[_0xa1d2('0xc')](_0xa1d2('0xd'),_0x331dba,_0xa1d2('0xe'));logger[_0xa1d2('0xf')](_0xa1d2('0x10'),_0x331dba,'request\x20sent',JSON[_0xa1d2('0x11')](_0x185da5));if(_0x185da5[_0xa1d2('0x12')]){if(_0x185da5[_0xa1d2('0x12')]['code']===0x1f4){logger['error'](_0xa1d2('0xd'),_0x331dba,_0x185da5[_0xa1d2('0x12')][_0xa1d2('0x13')]);return _0x4f10(_0x185da5['error']['message']);}logger['error'](_0xa1d2('0xd'),_0x331dba,_0x185da5[_0xa1d2('0x12')]['message']);return _0x4ece38(_0x185da5[_0xa1d2('0x12')][_0xa1d2('0x13')]);}else{logger[_0xa1d2('0xc')](_0xa1d2('0xd'),_0x331dba,_0xa1d2('0xe'));_0x4ece38(_0x185da5[_0xa1d2('0x14')][_0xa1d2('0x13')]);}})[_0xa1d2('0x15')](function(_0x55abb9){logger[_0xa1d2('0x12')](_0xa1d2('0xd'),_0x331dba,_0x55abb9);_0x4f10(_0x55abb9);});});}exports['CreateChatQueueReport']=function(_0x36998a){var _0x5ed58d=this;return new Promise(function(_0x206f9b,_0x4465b7){return db[_0xa1d2('0x16')][_0xa1d2('0x17')](_0x36998a[_0xa1d2('0x18')],{'raw':_0x36998a[_0xa1d2('0x19')]?_0x36998a[_0xa1d2('0x19')][_0xa1d2('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1b931c){logger[_0xa1d2('0xc')](_0xa1d2('0x1b'),_0x36998a);logger[_0xa1d2('0xf')](_0xa1d2('0x1b'),_0x36998a,JSON['stringify'](_0x1b931c));_0x206f9b(_0x1b931c);})[_0xa1d2('0x15')](function(_0x2bd6c6){logger[_0xa1d2('0x12')](_0xa1d2('0x1b'),_0x2bd6c6[_0xa1d2('0x13')],_0x36998a);_0x4465b7(_0x5ed58d[_0xa1d2('0x12')](0x1f4,_0x2bd6c6[_0xa1d2('0x13')]));});});};exports[_0xa1d2('0x1c')]=function(_0x547db4){var _0x217943=this;return new Promise(function(_0x5debe9,_0x46e3f3){return db[_0xa1d2('0x16')]['update'](_0x547db4[_0xa1d2('0x18')],{'raw':_0x547db4[_0xa1d2('0x19')]?_0x547db4[_0xa1d2('0x19')][_0xa1d2('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x547db4[_0xa1d2('0x19')]?_0x547db4[_0xa1d2('0x19')][_0xa1d2('0x1d')]||null:null,'attributes':_0x547db4['options']?_0x547db4[_0xa1d2('0x19')][_0xa1d2('0x1e')]||null:null,'limit':_0x547db4[_0xa1d2('0x19')]?_0x547db4[_0xa1d2('0x19')][_0xa1d2('0x1f')]||null:null})[_0xa1d2('0xb')](function(_0x3fbd7a){logger[_0xa1d2('0xc')]('UpdateChatQueueReport',_0x547db4);logger[_0xa1d2('0xf')](_0xa1d2('0x1c'),_0x547db4,JSON['stringify'](_0x3fbd7a));_0x5debe9(_0x3fbd7a);})[_0xa1d2('0x15')](function(_0x29168b){logger[_0xa1d2('0x12')](_0xa1d2('0x1c'),_0x29168b['message'],_0x547db4);_0x46e3f3(_0x217943[_0xa1d2('0x12')](0x1f4,_0x29168b[_0xa1d2('0x13')]));});});}; \ No newline at end of file +var _0x552a=['update','body','options','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','raw','UpdateChatQueueReport'];(function(_0x5aa373,_0x54c7f4){var _0x590e8e=function(_0x505e62){while(--_0x505e62){_0x5aa373['push'](_0x5aa373['shift']());}};_0x590e8e(++_0x54c7f4);}(_0x552a,0x1e2));var _0xa552=function(_0x44dfeb,_0x5bfd54){_0x44dfeb=_0x44dfeb-0x0;var _0x2710c0=_0x552a[_0x44dfeb];return _0x2710c0;};'use strict';var _=require(_0xa552('0x0'));var util=require(_0xa552('0x1'));var moment=require(_0xa552('0x2'));var BPromise=require(_0xa552('0x3'));var rs=require(_0xa552('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa552('0x5'))['db'];var utils=require(_0xa552('0x6'));var logger=require(_0xa552('0x7'))(_0xa552('0x8'));var config=require(_0xa552('0x9'));var jayson=require(_0xa552('0xa'));var client=jayson[_0xa552('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x79506,_0x5c9cd6,_0x395ef5){return new BPromise(function(_0x1e8f35,_0x506fc4){return client[_0xa552('0xc')](_0x79506,_0x395ef5)[_0xa552('0xd')](function(_0x398284){logger[_0xa552('0xe')](_0xa552('0xf'),_0x5c9cd6,'request\x20sent');logger[_0xa552('0x10')](_0xa552('0x11'),_0x5c9cd6,_0xa552('0x12'),JSON[_0xa552('0x13')](_0x398284));if(_0x398284[_0xa552('0x14')]){if(_0x398284[_0xa552('0x14')]['code']===0x1f4){logger['error'](_0xa552('0xf'),_0x5c9cd6,_0x398284[_0xa552('0x14')][_0xa552('0x15')]);return _0x506fc4(_0x398284[_0xa552('0x14')][_0xa552('0x15')]);}logger[_0xa552('0x14')](_0xa552('0xf'),_0x5c9cd6,_0x398284[_0xa552('0x14')][_0xa552('0x15')]);return _0x1e8f35(_0x398284[_0xa552('0x14')][_0xa552('0x15')]);}else{logger[_0xa552('0xe')](_0xa552('0xf'),_0x5c9cd6,_0xa552('0x12'));_0x1e8f35(_0x398284[_0xa552('0x16')][_0xa552('0x15')]);}})[_0xa552('0x17')](function(_0x35e97f){logger[_0xa552('0x14')](_0xa552('0xf'),_0x5c9cd6,_0x35e97f);_0x506fc4(_0x35e97f);});});}exports[_0xa552('0x18')]=function(_0x54a3e8){var _0x2fb388=this;return new Promise(function(_0x35f93f,_0x1a5d1c){return db[_0xa552('0x19')]['create'](_0x54a3e8['body'],{'raw':_0x54a3e8['options']?_0x54a3e8['options'][_0xa552('0x1a')]===undefined?!![]:![]:!![]})[_0xa552('0xd')](function(_0x480cb1){logger[_0xa552('0xe')](_0xa552('0x18'),_0x54a3e8);logger[_0xa552('0x10')]('CreateChatQueueReport',_0x54a3e8,JSON[_0xa552('0x13')](_0x480cb1));_0x35f93f(_0x480cb1);})[_0xa552('0x17')](function(_0x231500){logger[_0xa552('0x14')](_0xa552('0x18'),_0x231500[_0xa552('0x15')],_0x54a3e8);_0x1a5d1c(_0x2fb388[_0xa552('0x14')](0x1f4,_0x231500['message']));});});};exports[_0xa552('0x1b')]=function(_0x1dc727){var _0x188474=this;return new Promise(function(_0x595ea8,_0x5230e6){return db[_0xa552('0x19')][_0xa552('0x1c')](_0x1dc727[_0xa552('0x1d')],{'raw':_0x1dc727[_0xa552('0x1e')]?_0x1dc727[_0xa552('0x1e')][_0xa552('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1dc727['options']?_0x1dc727[_0xa552('0x1e')][_0xa552('0x1f')]||null:null,'attributes':_0x1dc727[_0xa552('0x1e')]?_0x1dc727['options'][_0xa552('0x20')]||null:null,'limit':_0x1dc727[_0xa552('0x1e')]?_0x1dc727[_0xa552('0x1e')][_0xa552('0x21')]||null:null})[_0xa552('0xd')](function(_0x5ba43c){logger[_0xa552('0xe')](_0xa552('0x1b'),_0x1dc727);logger[_0xa552('0x10')](_0xa552('0x1b'),_0x1dc727,JSON[_0xa552('0x13')](_0x5ba43c));_0x595ea8(_0x5ba43c);})[_0xa552('0x17')](function(_0x55c155){logger[_0xa552('0x14')](_0xa552('0x1b'),_0x55c155[_0xa552('0x15')],_0x1dc727);_0x5230e6(_0x188474[_0xa552('0x14')](0x1f4,_0x55c155[_0xa552('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index e59459f..c20a7a9 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 _0x681a=['index','/describe','describe','/:id','create','update','delete','destroy','exports','multer','connect-timeout','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated'];(function(_0x3e9940,_0x2b3883){var _0x5c86b9=function(_0x39a1da){while(--_0x39a1da){_0x3e9940['push'](_0x3e9940['shift']());}};_0x5c86b9(++_0x2b3883);}(_0x681a,0x99));var _0xa681=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0x681a[_0x879e31];return _0x3467e8;};'use strict';var multer=require(_0xa681('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa681('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xa681('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xa681('0x3'));var controller=require(_0xa681('0x4'));router[_0xa681('0x5')]('/',auth[_0xa681('0x6')](),controller[_0xa681('0x7')]);router[_0xa681('0x5')](_0xa681('0x8'),auth['isAuthenticated'](),controller[_0xa681('0x9')]);router[_0xa681('0x5')](_0xa681('0xa'),auth[_0xa681('0x6')](),controller['show']);router['post']('/',auth[_0xa681('0x6')](),controller[_0xa681('0xb')]);router['put'](_0xa681('0xa'),auth[_0xa681('0x6')](),controller[_0xa681('0xc')]);router[_0xa681('0xd')](_0xa681('0xa'),auth[_0xa681('0x6')](),controller[_0xa681('0xe')]);module[_0xa681('0xf')]=router; \ No newline at end of file +var _0x41d9=['Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x25fd7c,_0x4a8990){var _0x2623b9=function(_0x1604d3){while(--_0x1604d3){_0x25fd7c['push'](_0x25fd7c['shift']());}};_0x2623b9(++_0x4a8990);}(_0x41d9,0x1b3));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x941d('0x0'));var util=require(_0x941d('0x1'));var path=require(_0x941d('0x2'));var timeout=require(_0x941d('0x3'));var express=require(_0x941d('0x4'));var router=express[_0x941d('0x5')]();var auth=require(_0x941d('0x6'));var interaction=require(_0x941d('0x7'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x941d('0x8')]('/',auth['isAuthenticated'](),controller[_0x941d('0x9')]);router[_0x941d('0x8')](_0x941d('0xa'),auth[_0x941d('0xb')](),controller[_0x941d('0xc')]);router['get'](_0x941d('0xd'),auth[_0x941d('0xb')](),controller['show']);router[_0x941d('0xe')]('/',auth['isAuthenticated'](),controller[_0x941d('0xf')]);router['put'](_0x941d('0xd'),auth[_0x941d('0xb')](),controller[_0x941d('0x10')]);router[_0x941d('0x11')](_0x941d('0xd'),auth[_0x941d('0xb')](),controller[_0x941d('0x12')]);module[_0x941d('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 3039da1..f9f2a0f 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 _0x2bdb=['sequelize','exports','STRING','queue','DATE','moment'];(function(_0xf6f160,_0x20915a){var _0xd6aa49=function(_0x22796f){while(--_0x22796f){_0xf6f160['push'](_0xf6f160['shift']());}};_0xd6aa49(++_0x20915a);}(_0x2bdb,0xd7));var _0xb2bd=function(_0xb97bab,_0x18d834){_0xb97bab=_0xb97bab-0x0;var _0x1fc4bd=_0x2bdb[_0xb97bab];return _0x1fc4bd;};'use strict';var moment=require(_0xb2bd('0x0'));var Sequelize=require(_0xb2bd('0x1'));module[_0xb2bd('0x2')]={'uniqueid':{'type':Sequelize[_0xb2bd('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent',_0xb2bd('0x4')),'allowNull':![],'defaultValue':_0xb2bd('0x4')},'transferredAt':{'type':Sequelize[_0xb2bd('0x5')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x320f=['agent','queue','DATE','moment','sequelize','exports','ENUM'];(function(_0x5b2eb5,_0x50f39e){var _0x2ad9bc=function(_0xf1ebc){while(--_0xf1ebc){_0x5b2eb5['push'](_0x5b2eb5['shift']());}};_0x2ad9bc(++_0x50f39e);}(_0x320f,0x129));var _0xf320=function(_0x43422c,_0x17388f){_0x43422c=_0x43422c-0x0;var _0x5f20b8=_0x320f[_0x43422c];return _0x5f20b8;};'use strict';var moment=require(_0xf320('0x0'));var Sequelize=require(_0xf320('0x1'));module[_0xf320('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf320('0x3')]('account',_0xf320('0x4'),_0xf320('0x5')),'allowNull':![],'defaultValue':_0xf320('0x5')},'transferredAt':{'type':Sequelize[_0xf320('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 1509256..891a5fd 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 _0xcdc8=['include','findAll','rows','catch','params','rawAttributes','keys','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','save','update','then','destroy','error','stack','name','index','map','ChatTransferReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x202ea3,_0x38ab41){var _0x58787b=function(_0x1dce0b){while(--_0x1dce0b){_0x202ea3['push'](_0x202ea3['shift']());}};_0x58787b(++_0x38ab41);}(_0xcdc8,0x1a9));var _0x8cdc=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xcdc8[_0x618414];return _0x21c19a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8cdc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8cdc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8cdc('0x2'));var moment=require(_0x8cdc('0x3'));var BPromise=require(_0x8cdc('0x4'));var Mustache=require('mustache');var util=require(_0x8cdc('0x5'));var path=require(_0x8cdc('0x6'));var sox=require(_0x8cdc('0x7'));var csv=require(_0x8cdc('0x8'));var ejs=require(_0x8cdc('0x9'));var fs=require('fs');var _=require(_0x8cdc('0xa'));var squel=require('squel');var crypto=require(_0x8cdc('0xb'));var jsforce=require(_0x8cdc('0xc'));var deskjs=require(_0x8cdc('0xd'));var toCsv=require(_0x8cdc('0x8'));var querystring=require('querystring');var Papa=require(_0x8cdc('0xe'));var Redis=require(_0x8cdc('0xf'));var authService=require(_0x8cdc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8cdc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8cdc('0x12'));var utils=require(_0x8cdc('0x13'));var config=require(_0x8cdc('0x14'));var licenseUtil=require(_0x8cdc('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39e0c4,_0x5c6ef5){_0x5c6ef5=_0x5c6ef5||0xcc;return function(_0x2f88e8){if(_0x2f88e8){return _0x39e0c4[_0x8cdc('0x16')](_0x5c6ef5);}return _0x39e0c4[_0x8cdc('0x17')](_0x5c6ef5)[_0x8cdc('0x18')]();};}function respondWithResult(_0x535c38,_0x59261b){_0x59261b=_0x59261b||0xc8;return function(_0x484bc2){if(_0x484bc2){return _0x535c38[_0x8cdc('0x17')](_0x59261b)[_0x8cdc('0x19')](_0x484bc2);}};}function respondWithFilteredResult(_0x3e1b28,_0x251f52){return function(_0x5c3926){if(_0x5c3926){var _0x5cbd98=_0x5c3926[_0x8cdc('0x1a')],_0x4adb6d=_0x251f52[_0x8cdc('0x1b')],_0x30ffe9=_0x251f52[_0x8cdc('0x1b')]+_0x251f52[_0x8cdc('0x1c')],_0x1b3c79;if(_0x30ffe9>=_0x5cbd98){_0x30ffe9=_0x5cbd98;_0x1b3c79=0xc8;}else{_0x1b3c79=0xce;}_0x3e1b28[_0x8cdc('0x17')](_0x1b3c79);return _0x3e1b28['set'](_0x8cdc('0x1d'),_0x4adb6d+'-'+_0x30ffe9+'/'+_0x5cbd98)[_0x8cdc('0x19')](_0x5c3926);}return null;};}function patchUpdates(_0x56fb9a){return function(_0x2baf5d){try{jsonpatch['apply'](_0x2baf5d,_0x56fb9a,!![]);}catch(_0x4babd9){return BPromise['reject'](_0x4babd9);}return _0x2baf5d[_0x8cdc('0x1e')]();};}function saveUpdates(_0x10ef90,_0x3dea43){return function(_0x5406a4){if(_0x5406a4){return _0x5406a4[_0x8cdc('0x1f')](_0x10ef90)[_0x8cdc('0x20')](function(_0x25c5be){return _0x25c5be;});}return null;};}function removeEntity(_0x4a1715,_0x5edbcb){return function(_0x5e70ff){if(_0x5e70ff){return _0x5e70ff[_0x8cdc('0x21')]()[_0x8cdc('0x20')](function(){_0x4a1715['status'](0xcc)[_0x8cdc('0x18')]();});}};}function handleEntityNotFound(_0x36a3bf,_0x43ed33){return function(_0x35e729){if(!_0x35e729){_0x36a3bf[_0x8cdc('0x16')](0x194);}return _0x35e729;};}function handleError(_0x489952,_0x4ce0b9){_0x4ce0b9=_0x4ce0b9||0x1f4;return function(_0x3de1c8){logger[_0x8cdc('0x22')](_0x3de1c8[_0x8cdc('0x23')]);if(_0x3de1c8[_0x8cdc('0x24')]){delete _0x3de1c8[_0x8cdc('0x24')];}_0x489952[_0x8cdc('0x17')](_0x4ce0b9)['send'](_0x3de1c8);};}exports[_0x8cdc('0x25')]=function(_0x365299,_0x11aad7){var _0xfc9ff4={},_0x120a0e={},_0x43f28f={'count':0x0,'rows':[]};var _0x490b9a=_[_0x8cdc('0x26')](db[_0x8cdc('0x27')]['rawAttributes'],function(_0xc151f3){return{'name':_0xc151f3[_0x8cdc('0x28')],'type':_0xc151f3[_0x8cdc('0x29')][_0x8cdc('0x2a')]};});_0x120a0e[_0x8cdc('0x2b')]=_[_0x8cdc('0x26')](_0x490b9a,'name');_0x120a0e[_0x8cdc('0x2c')]=_['keys'](_0x365299[_0x8cdc('0x2c')]);_0x120a0e[_0x8cdc('0x2d')]=_[_0x8cdc('0x2e')](_0x120a0e[_0x8cdc('0x2b')],_0x120a0e['query']);_0xfc9ff4[_0x8cdc('0x2f')]=_[_0x8cdc('0x2e')](_0x120a0e[_0x8cdc('0x2b')],qs[_0x8cdc('0x30')](_0x365299[_0x8cdc('0x2c')][_0x8cdc('0x30')]));_0xfc9ff4[_0x8cdc('0x2f')]=_0xfc9ff4[_0x8cdc('0x2f')][_0x8cdc('0x31')]?_0xfc9ff4[_0x8cdc('0x2f')]:_0x120a0e[_0x8cdc('0x2b')];if(!_0x365299[_0x8cdc('0x2c')][_0x8cdc('0x32')]('nolimit')){_0xfc9ff4[_0x8cdc('0x1c')]=qs['limit'](_0x365299[_0x8cdc('0x2c')][_0x8cdc('0x1c')]);_0xfc9ff4['offset']=qs['offset'](_0x365299['query'][_0x8cdc('0x1b')]);}_0xfc9ff4['order']=qs[_0x8cdc('0x33')](_0x365299['query'][_0x8cdc('0x33')]);_0xfc9ff4[_0x8cdc('0x34')]=qs[_0x8cdc('0x2d')](_[_0x8cdc('0x35')](_0x365299['query'],_0x120a0e[_0x8cdc('0x2d')]),_0x490b9a);if(_0x365299[_0x8cdc('0x2c')][_0x8cdc('0x36')]){_0xfc9ff4['where']=_['merge'](_0xfc9ff4['where'],{'$or':_[_0x8cdc('0x26')](_0x490b9a,function(_0x2ef5af){if(_0x2ef5af[_0x8cdc('0x29')]!==_0x8cdc('0x37')){var _0x19c0d8={};_0x19c0d8[_0x2ef5af[_0x8cdc('0x24')]]={'$like':'%'+_0x365299[_0x8cdc('0x2c')]['filter']+'%'};return _0x19c0d8;}})});}_0xfc9ff4=_[_0x8cdc('0x38')]({},_0xfc9ff4,_0x365299[_0x8cdc('0x39')]);var _0x9ee886={'where':_0xfc9ff4[_0x8cdc('0x34')]};return db['ChatTransferReport'][_0x8cdc('0x1a')](_0x9ee886)[_0x8cdc('0x20')](function(_0x316f17){_0x43f28f[_0x8cdc('0x1a')]=_0x316f17;if(_0x365299['query']['includeAll']){_0xfc9ff4[_0x8cdc('0x3a')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x8cdc('0x3b')](_0xfc9ff4);})[_0x8cdc('0x20')](function(_0x1cf129){_0x43f28f[_0x8cdc('0x3c')]=_0x1cf129;return _0x43f28f;})[_0x8cdc('0x20')](respondWithFilteredResult(_0x11aad7,_0xfc9ff4))[_0x8cdc('0x3d')](handleError(_0x11aad7,null));};exports['show']=function(_0x2d8157,_0x5347bd){var _0x4d34a8={'raw':!![],'where':{'id':_0x2d8157[_0x8cdc('0x3e')]['id']}},_0x1a4682={};_0x1a4682[_0x8cdc('0x2b')]=_['keys'](db['ChatTransferReport'][_0x8cdc('0x3f')]);_0x1a4682['query']=_[_0x8cdc('0x40')](_0x2d8157[_0x8cdc('0x2c')]);_0x1a4682[_0x8cdc('0x2d')]=_['intersection'](_0x1a4682['model'],_0x1a4682['query']);_0x4d34a8[_0x8cdc('0x2f')]=_['intersection'](_0x1a4682['model'],qs['fields'](_0x2d8157['query']['fields']));_0x4d34a8[_0x8cdc('0x2f')]=_0x4d34a8[_0x8cdc('0x2f')][_0x8cdc('0x31')]?_0x4d34a8[_0x8cdc('0x2f')]:_0x1a4682[_0x8cdc('0x2b')];if(_0x2d8157[_0x8cdc('0x2c')]['includeAll']){_0x4d34a8[_0x8cdc('0x3a')]=[{'all':!![]}];}_0x4d34a8=_[_0x8cdc('0x38')]({},_0x4d34a8,_0x2d8157[_0x8cdc('0x39')]);return db[_0x8cdc('0x27')][_0x8cdc('0x41')](_0x4d34a8)['then'](handleEntityNotFound(_0x5347bd,null))[_0x8cdc('0x20')](respondWithResult(_0x5347bd,null))['catch'](handleError(_0x5347bd,null));};exports[_0x8cdc('0x42')]=function(_0x1680fd,_0x328015){return db[_0x8cdc('0x27')][_0x8cdc('0x42')](_0x1680fd[_0x8cdc('0x43')],{})['then'](respondWithResult(_0x328015,0xc9))[_0x8cdc('0x3d')](handleError(_0x328015,null));};exports[_0x8cdc('0x1f')]=function(_0x2b5d76,_0x2f3877){if(_0x2b5d76['body']['id']){delete _0x2b5d76[_0x8cdc('0x43')]['id'];}return db[_0x8cdc('0x27')]['find']({'where':{'id':_0x2b5d76[_0x8cdc('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2f3877,null))[_0x8cdc('0x20')](saveUpdates(_0x2b5d76[_0x8cdc('0x43')],null))[_0x8cdc('0x20')](respondWithResult(_0x2f3877,null))[_0x8cdc('0x3d')](handleError(_0x2f3877,null));};exports['destroy']=function(_0x107a1c,_0x57e11f){return db[_0x8cdc('0x27')][_0x8cdc('0x41')]({'where':{'id':_0x107a1c[_0x8cdc('0x3e')]['id']}})[_0x8cdc('0x20')](handleEntityNotFound(_0x57e11f,null))['then'](removeEntity(_0x57e11f,null))[_0x8cdc('0x3d')](handleError(_0x57e11f,null));};exports[_0x8cdc('0x44')]=function(_0x47fe37,_0x17b0d3){return db[_0x8cdc('0x27')][_0x8cdc('0x44')]()['then'](respondWithResult(_0x17b0d3,null))['catch'](handleError(_0x17b0d3,null));}; \ No newline at end of file +var _0xfe64=['count','offset','limit','set','Content-Range','update','then','error','stack','name','send','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','ChatTransferReport','findAll','rows','show','params','rawAttributes','keys','includeAll','catch','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x1ccda2,_0x52a5de){var _0x553ec9=function(_0x1fd9c2){while(--_0x1fd9c2){_0x1ccda2['push'](_0x1ccda2['shift']());}};_0x553ec9(++_0x52a5de);}(_0xfe64,0x7a));var _0x4fe6=function(_0x2ec54a,_0x4968d7){_0x2ec54a=_0x2ec54a-0x0;var _0x3db721=_0xfe64[_0x2ec54a];return _0x3db721;};'use strict';var pdf=require(_0x4fe6('0x0'));var emlformat=require(_0x4fe6('0x1'));var rimraf=require(_0x4fe6('0x2'));var zipdir=require(_0x4fe6('0x3'));var jsonpatch=require(_0x4fe6('0x4'));var rp=require(_0x4fe6('0x5'));var moment=require(_0x4fe6('0x6'));var BPromise=require(_0x4fe6('0x7'));var Mustache=require('mustache');var util=require(_0x4fe6('0x8'));var path=require(_0x4fe6('0x9'));var sox=require('sox');var csv=require(_0x4fe6('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4fe6('0xb'));var squel=require(_0x4fe6('0xc'));var crypto=require(_0x4fe6('0xd'));var jsforce=require(_0x4fe6('0xe'));var deskjs=require(_0x4fe6('0xf'));var toCsv=require(_0x4fe6('0xa'));var querystring=require(_0x4fe6('0x10'));var Papa=require(_0x4fe6('0x11'));var Redis=require(_0x4fe6('0x12'));var authService=require(_0x4fe6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4fe6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4fe6('0x15'));var utils=require(_0x4fe6('0x16'));var config=require(_0x4fe6('0x17'));var licenseUtil=require(_0x4fe6('0x18'));var db=require(_0x4fe6('0x19'))['db'];function respondWithStatusCode(_0x309627,_0x5c3b75){_0x5c3b75=_0x5c3b75||0xcc;return function(_0x848894){if(_0x848894){return _0x309627[_0x4fe6('0x1a')](_0x5c3b75);}return _0x309627[_0x4fe6('0x1b')](_0x5c3b75)[_0x4fe6('0x1c')]();};}function respondWithResult(_0x46bcfa,_0x315ffd){_0x315ffd=_0x315ffd||0xc8;return function(_0x28120a){if(_0x28120a){return _0x46bcfa[_0x4fe6('0x1b')](_0x315ffd)[_0x4fe6('0x1d')](_0x28120a);}};}function respondWithFilteredResult(_0x2379f3,_0x55c195){return function(_0x2e6e14){if(_0x2e6e14){var _0x4ad8bd=_0x2e6e14[_0x4fe6('0x1e')],_0x15d9e2=_0x55c195[_0x4fe6('0x1f')],_0x28cb88=_0x55c195[_0x4fe6('0x1f')]+_0x55c195[_0x4fe6('0x20')],_0x2b8063;if(_0x28cb88>=_0x4ad8bd){_0x28cb88=_0x4ad8bd;_0x2b8063=0xc8;}else{_0x2b8063=0xce;}_0x2379f3['status'](_0x2b8063);return _0x2379f3[_0x4fe6('0x21')](_0x4fe6('0x22'),_0x15d9e2+'-'+_0x28cb88+'/'+_0x4ad8bd)[_0x4fe6('0x1d')](_0x2e6e14);}return null;};}function patchUpdates(_0x3b982f){return function(_0xb99e22){try{jsonpatch['apply'](_0xb99e22,_0x3b982f,!![]);}catch(_0x2e5230){return BPromise['reject'](_0x2e5230);}return _0xb99e22['save']();};}function saveUpdates(_0x5e0dfb,_0x3a802a){return function(_0x1b8210){if(_0x1b8210){return _0x1b8210[_0x4fe6('0x23')](_0x5e0dfb)[_0x4fe6('0x24')](function(_0x1449ab){return _0x1449ab;});}return null;};}function removeEntity(_0x1e64ca,_0x55a4ce){return function(_0xf3d4a5){if(_0xf3d4a5){return _0xf3d4a5['destroy']()['then'](function(){_0x1e64ca[_0x4fe6('0x1b')](0xcc)[_0x4fe6('0x1c')]();});}};}function handleEntityNotFound(_0x240619,_0xbb8589){return function(_0x304f03){if(!_0x304f03){_0x240619[_0x4fe6('0x1a')](0x194);}return _0x304f03;};}function handleError(_0x1cefaf,_0x475e4c){_0x475e4c=_0x475e4c||0x1f4;return function(_0x300629){logger[_0x4fe6('0x25')](_0x300629[_0x4fe6('0x26')]);if(_0x300629[_0x4fe6('0x27')]){delete _0x300629[_0x4fe6('0x27')];}_0x1cefaf['status'](_0x475e4c)[_0x4fe6('0x28')](_0x300629);};}exports['index']=function(_0x2cf3b3,_0x5b440c){var _0x2c4950={},_0x16d409={},_0x17f60a={'count':0x0,'rows':[]};var _0x134a15=_[_0x4fe6('0x29')](db['ChatTransferReport']['rawAttributes'],function(_0x5e4a69){return{'name':_0x5e4a69[_0x4fe6('0x2a')],'type':_0x5e4a69[_0x4fe6('0x2b')][_0x4fe6('0x2c')]};});_0x16d409[_0x4fe6('0x2d')]=_['map'](_0x134a15,_0x4fe6('0x27'));_0x16d409[_0x4fe6('0x2e')]=_['keys'](_0x2cf3b3[_0x4fe6('0x2e')]);_0x16d409[_0x4fe6('0x2f')]=_[_0x4fe6('0x30')](_0x16d409[_0x4fe6('0x2d')],_0x16d409['query']);_0x2c4950[_0x4fe6('0x31')]=_[_0x4fe6('0x30')](_0x16d409[_0x4fe6('0x2d')],qs[_0x4fe6('0x32')](_0x2cf3b3[_0x4fe6('0x2e')][_0x4fe6('0x32')]));_0x2c4950[_0x4fe6('0x31')]=_0x2c4950[_0x4fe6('0x31')][_0x4fe6('0x33')]?_0x2c4950[_0x4fe6('0x31')]:_0x16d409['model'];if(!_0x2cf3b3[_0x4fe6('0x2e')][_0x4fe6('0x34')](_0x4fe6('0x35'))){_0x2c4950[_0x4fe6('0x20')]=qs[_0x4fe6('0x20')](_0x2cf3b3[_0x4fe6('0x2e')][_0x4fe6('0x20')]);_0x2c4950['offset']=qs[_0x4fe6('0x1f')](_0x2cf3b3['query'][_0x4fe6('0x1f')]);}_0x2c4950[_0x4fe6('0x36')]=qs[_0x4fe6('0x37')](_0x2cf3b3[_0x4fe6('0x2e')][_0x4fe6('0x37')]);_0x2c4950[_0x4fe6('0x38')]=qs['filters'](_['pick'](_0x2cf3b3[_0x4fe6('0x2e')],_0x16d409[_0x4fe6('0x2f')]),_0x134a15);if(_0x2cf3b3[_0x4fe6('0x2e')][_0x4fe6('0x39')]){_0x2c4950[_0x4fe6('0x38')]=_[_0x4fe6('0x3a')](_0x2c4950[_0x4fe6('0x38')],{'$or':_[_0x4fe6('0x29')](_0x134a15,function(_0x34f313){if(_0x34f313[_0x4fe6('0x2b')]!==_0x4fe6('0x3b')){var _0x37505a={};_0x37505a[_0x34f313[_0x4fe6('0x27')]]={'$like':'%'+_0x2cf3b3['query'][_0x4fe6('0x39')]+'%'};return _0x37505a;}})});}_0x2c4950=_[_0x4fe6('0x3a')]({},_0x2c4950,_0x2cf3b3[_0x4fe6('0x3c')]);var _0x14e9c2={'where':_0x2c4950[_0x4fe6('0x38')]};return db['ChatTransferReport'][_0x4fe6('0x1e')](_0x14e9c2)['then'](function(_0x6d929d){_0x17f60a[_0x4fe6('0x1e')]=_0x6d929d;if(_0x2cf3b3[_0x4fe6('0x2e')]['includeAll']){_0x2c4950[_0x4fe6('0x3d')]=[{'all':!![]}];}return db[_0x4fe6('0x3e')][_0x4fe6('0x3f')](_0x2c4950);})[_0x4fe6('0x24')](function(_0x427d58){_0x17f60a[_0x4fe6('0x40')]=_0x427d58;return _0x17f60a;})[_0x4fe6('0x24')](respondWithFilteredResult(_0x5b440c,_0x2c4950))['catch'](handleError(_0x5b440c,null));};exports[_0x4fe6('0x41')]=function(_0x27a2b2,_0x21da08){var _0x2676ea={'raw':!![],'where':{'id':_0x27a2b2[_0x4fe6('0x42')]['id']}},_0x3dab99={};_0x3dab99['model']=_['keys'](db['ChatTransferReport'][_0x4fe6('0x43')]);_0x3dab99[_0x4fe6('0x2e')]=_[_0x4fe6('0x44')](_0x27a2b2[_0x4fe6('0x2e')]);_0x3dab99[_0x4fe6('0x2f')]=_[_0x4fe6('0x30')](_0x3dab99['model'],_0x3dab99[_0x4fe6('0x2e')]);_0x2676ea['attributes']=_[_0x4fe6('0x30')](_0x3dab99[_0x4fe6('0x2d')],qs[_0x4fe6('0x32')](_0x27a2b2[_0x4fe6('0x2e')][_0x4fe6('0x32')]));_0x2676ea[_0x4fe6('0x31')]=_0x2676ea['attributes'][_0x4fe6('0x33')]?_0x2676ea['attributes']:_0x3dab99[_0x4fe6('0x2d')];if(_0x27a2b2[_0x4fe6('0x2e')][_0x4fe6('0x45')]){_0x2676ea[_0x4fe6('0x3d')]=[{'all':!![]}];}_0x2676ea=_['merge']({},_0x2676ea,_0x27a2b2['options']);return db['ChatTransferReport']['find'](_0x2676ea)['then'](handleEntityNotFound(_0x21da08,null))[_0x4fe6('0x24')](respondWithResult(_0x21da08,null))[_0x4fe6('0x46')](handleError(_0x21da08,null));};exports[_0x4fe6('0x47')]=function(_0x35025d,_0x30c830){return db[_0x4fe6('0x3e')]['create'](_0x35025d[_0x4fe6('0x48')],{})[_0x4fe6('0x24')](respondWithResult(_0x30c830,0xc9))[_0x4fe6('0x46')](handleError(_0x30c830,null));};exports[_0x4fe6('0x23')]=function(_0x1b2da8,_0x1bd74a){if(_0x1b2da8[_0x4fe6('0x48')]['id']){delete _0x1b2da8['body']['id'];}return db[_0x4fe6('0x3e')][_0x4fe6('0x49')]({'where':{'id':_0x1b2da8['params']['id']}})['then'](handleEntityNotFound(_0x1bd74a,null))[_0x4fe6('0x24')](saveUpdates(_0x1b2da8[_0x4fe6('0x48')],null))[_0x4fe6('0x24')](respondWithResult(_0x1bd74a,null))[_0x4fe6('0x46')](handleError(_0x1bd74a,null));};exports[_0x4fe6('0x4a')]=function(_0x313e29,_0x5f1536){return db['ChatTransferReport']['find']({'where':{'id':_0x313e29[_0x4fe6('0x42')]['id']}})[_0x4fe6('0x24')](handleEntityNotFound(_0x5f1536,null))[_0x4fe6('0x24')](removeEntity(_0x5f1536,null))[_0x4fe6('0x46')](handleError(_0x5f1536,null));};exports[_0x4fe6('0x4b')]=function(_0x3ede4a,_0x14db5a){return db['ChatTransferReport'][_0x4fe6('0x4b')]()[_0x4fe6('0x24')](respondWithResult(_0x14db5a,null))[_0x4fe6('0x46')](handleError(_0x14db5a,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index b8ea9ab..f02aca8 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 _0xdd79=['bluebird','request-promise','path','rimraf','../../config/environment','exports','uniqueid','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd79,0x15c));var _0x9dd7=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xdd79[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x9dd7('0x0'));var util=require(_0x9dd7('0x1'));var logger=require(_0x9dd7('0x2'))(_0x9dd7('0x3'));var moment=require('moment');var BPromise=require(_0x9dd7('0x4'));var rp=require(_0x9dd7('0x5'));var fs=require('fs');var path=require(_0x9dd7('0x6'));var rimraf=require(_0x9dd7('0x7'));var config=require(_0x9dd7('0x8'));var attributes=require('./chatTransferReport.attributes');module[_0x9dd7('0x9')]=function(_0x4009b3,_0x314155){return _0x4009b3['define']('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x9dd7('0xa'),'fields':[_0x9dd7('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b83=['define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x592f6e,_0x23c902){var _0x1504ea=function(_0x38b54e){while(--_0x38b54e){_0x592f6e['push'](_0x592f6e['shift']());}};_0x1504ea(++_0x23c902);}(_0x4b83,0xba));var _0x34b8=function(_0x4d6f62,_0x1342d4){_0x4d6f62=_0x4d6f62-0x0;var _0x26c1cf=_0x4b83[_0x4d6f62];return _0x26c1cf;};'use strict';var _=require(_0x34b8('0x0'));var util=require(_0x34b8('0x1'));var logger=require(_0x34b8('0x2'))('api');var moment=require(_0x34b8('0x3'));var BPromise=require(_0x34b8('0x4'));var rp=require(_0x34b8('0x5'));var fs=require('fs');var path=require(_0x34b8('0x6'));var rimraf=require(_0x34b8('0x7'));var config=require(_0x34b8('0x8'));var attributes=require('./chatTransferReport.attributes');module[_0x34b8('0x9')]=function(_0x527f7b,_0x1ff371){return _0x527f7b[_0x34b8('0xa')](_0x34b8('0xb'),attributes,{'tableName':_0x34b8('0xc'),'paranoid':![],'indexes':[{'name':_0x34b8('0xd'),'fields':[_0x34b8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index cabfc8c..1966f6f 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 _0x9599=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x24a739,_0x48a02f){var _0x539aa5=function(_0x4d8249){while(--_0x4d8249){_0x24a739['push'](_0x24a739['shift']());}};_0x539aa5(++_0x48a02f);}(_0x9599,0xa2));var _0x9959=function(_0x5c697c,_0x294022){_0x5c697c=_0x5c697c-0x0;var _0x2b4ac0=_0x9599[_0x5c697c];return _0x2b4ac0;};'use strict';var _=require(_0x9959('0x0'));var util=require(_0x9959('0x1'));var moment=require(_0x9959('0x2'));var BPromise=require(_0x9959('0x3'));var rs=require(_0x9959('0x4'));var fs=require('fs');var Redis=require(_0x9959('0x5'));var db=require(_0x9959('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9959('0x7'));var config=require(_0x9959('0x8'));var jayson=require(_0x9959('0x9'));var client=jayson[_0x9959('0xa')][_0x9959('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x408e65,_0x5eeed2,_0x427eae){return new BPromise(function(_0xd2c885,_0x3edd04){return client['request'](_0x408e65,_0x427eae)[_0x9959('0xc')](function(_0x6e31ec){logger[_0x9959('0xd')](_0x9959('0xe'),_0x5eeed2,_0x9959('0xf'));logger[_0x9959('0x10')](_0x9959('0x11'),_0x5eeed2,_0x9959('0xf'),JSON[_0x9959('0x12')](_0x6e31ec));if(_0x6e31ec[_0x9959('0x13')]){if(_0x6e31ec[_0x9959('0x13')][_0x9959('0x14')]===0x1f4){logger[_0x9959('0x13')](_0x9959('0xe'),_0x5eeed2,_0x6e31ec[_0x9959('0x13')][_0x9959('0x15')]);return _0x3edd04(_0x6e31ec[_0x9959('0x13')]['message']);}logger[_0x9959('0x13')](_0x9959('0xe'),_0x5eeed2,_0x6e31ec[_0x9959('0x13')][_0x9959('0x15')]);return _0xd2c885(_0x6e31ec['error'][_0x9959('0x15')]);}else{logger[_0x9959('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x5eeed2,'request\x20sent');_0xd2c885(_0x6e31ec[_0x9959('0x16')][_0x9959('0x15')]);}})[_0x9959('0x17')](function(_0x59b1f6){logger[_0x9959('0x13')](_0x9959('0xe'),_0x5eeed2,_0x59b1f6);_0x3edd04(_0x59b1f6);});});} \ No newline at end of file +var _0x0793=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x4d3f9d,_0x19acd4){var _0x14f5d4=function(_0x5dfe8d){while(--_0x5dfe8d){_0x4d3f9d['push'](_0x4d3f9d['shift']());}};_0x14f5d4(++_0x19acd4);}(_0x0793,0x131));var _0x3079=function(_0x52e9a9,_0x346b5f){_0x52e9a9=_0x52e9a9-0x0;var _0x3e7432=_0x0793[_0x52e9a9];return _0x3e7432;};'use strict';var _=require(_0x3079('0x0'));var util=require(_0x3079('0x1'));var moment=require(_0x3079('0x2'));var BPromise=require('bluebird');var rs=require(_0x3079('0x3'));var fs=require('fs');var Redis=require(_0x3079('0x4'));var db=require(_0x3079('0x5'))['db'];var utils=require(_0x3079('0x6'));var logger=require(_0x3079('0x7'))('rpc');var config=require(_0x3079('0x8'));var jayson=require(_0x3079('0x9'));var client=jayson[_0x3079('0xa')][_0x3079('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e150e,_0x549973,_0x1591b3){return new BPromise(function(_0x3d4bec,_0x41a2d8){return client['request'](_0x2e150e,_0x1591b3)['then'](function(_0x3b0100){logger[_0x3079('0xc')](_0x3079('0xd'),_0x549973,_0x3079('0xe'));logger[_0x3079('0xf')](_0x3079('0x10'),_0x549973,_0x3079('0xe'),JSON[_0x3079('0x11')](_0x3b0100));if(_0x3b0100[_0x3079('0x12')]){if(_0x3b0100['error']['code']===0x1f4){logger['error'](_0x3079('0xd'),_0x549973,_0x3b0100[_0x3079('0x12')]['message']);return _0x41a2d8(_0x3b0100[_0x3079('0x12')][_0x3079('0x13')]);}logger[_0x3079('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x549973,_0x3b0100['error'][_0x3079('0x13')]);return _0x3d4bec(_0x3b0100[_0x3079('0x12')]['message']);}else{logger[_0x3079('0xc')](_0x3079('0xd'),_0x549973,_0x3079('0xe'));_0x3d4bec(_0x3b0100[_0x3079('0x14')]['message']);}})[_0x3079('0x15')](function(_0x354f01){logger['error'](_0x3079('0xd'),_0x549973,_0x354f01);_0x41a2d8(_0x354f01);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 09b133d..ec22a1f 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 _0x0b0e=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','delete','exports'];(function(_0x32ef27,_0x1b425a){var _0x20610d=function(_0x3330d2){while(--_0x3330d2){_0x32ef27['push'](_0x32ef27['shift']());}};_0x20610d(++_0x1b425a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x92d580,_0x4928fb){_0x92d580=_0x92d580-0x0;var _0x4ee344=_0x0b0e[_0x92d580];return _0x4ee344;};'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 auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['post']('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['update']);router[_0xe0b0('0xf')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['destroy']);module[_0xe0b0('0x10')]=router; \ No newline at end of file +var _0x0b0e=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','delete','exports'];(function(_0x2b6dd0,_0x3cd07b){var _0x29e9a5=function(_0x3a70b2){while(--_0x3a70b2){_0x2b6dd0['push'](_0x2b6dd0['shift']());}};_0x29e9a5(++_0x3cd07b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x478414,_0xcf142d){_0x478414=_0x478414-0x0;var _0x5eb6b9=_0x0b0e[_0x478414];return _0x5eb6b9;};'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 auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['post']('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['update']);router[_0xe0b0('0xf')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['destroy']);module[_0xe0b0('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index fd5fe5b..5b19058 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 _0x28aa=['System','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Thanks\x20you\x20for\x20your\x20time!','Send','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','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','alternate','#fafafa'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0x28aa,0xf8));var _0xa28a=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x28aa[_0x2bf141];return _0x48277b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xa28a('0x0'));module[_0xa28a('0x1')]={'name':{'type':Sequelize[_0xa28a('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xa28a('0x2')],'allowNull':![],'unique':_0xa28a('0x3')},'description':{'type':Sequelize[_0xa28a('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xa28a('0x4')},'mapKeyOffline':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':_0xa28a('0x4')},'key':{'type':Sequelize[_0xa28a('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xa28a('0x5')},'customerAlias':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xa28a('0x2')],'allowNull':![],'defaultValue':_0xa28a('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xa28a('0x2')],'allowNull':![],'defaultValue':_0xa28a('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xa28a('0x2')],'allowNull':![],'defaultValue':_0xa28a('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xa28a('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xa28a('0x2')]},'animation':{'type':Sequelize[_0xa28a('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xa28a('0xa')](_0xa28a('0xb'),_0xa28a('0xc')),'defaultValue':_0xa28a('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xa28a('0xd')},'start_chat_button':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':_0xa28a('0xe')},'offline_chat_button':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':_0xa28a('0xf')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xa28a('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':_0xa28a('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0xa28a('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xa28a('0x11')]},'closingQuestion':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':_0xa28a('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':_0xa28a('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':_0xa28a('0x14')},'placeholderMessage':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':_0xa28a('0x15')},'closingMessageButton':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':_0xa28a('0x16')},'skipMessageButton':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xa28a('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':_0xa28a('0x17')},'ratingType':{'type':Sequelize[_0xa28a('0xa')](_0xa28a('0x18'),_0xa28a('0x19')),'defaultValue':_0xa28a('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xa28a('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xa28a('0x11')],'defaultValue':function(){return JSON[_0xa28a('0x1a')]({'items':[{'type':_0xa28a('0x1b'),'variable':null,'config':{'placeholder':_0xa28a('0x1c'),'type':_0xa28a('0x1d'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xa28a('0x1b'),'props':{'title':_0xa28a('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xa28a('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xa28a('0x1e')](_0xa28a('0x1f'))?JSON['parse'](this[_0xa28a('0x1e')](_0xa28a('0x1f'))):{};},'set':function(_0xa3541b){return this[_0xa28a('0x20')](_0xa28a('0x1f'),JSON['stringify'](_0xa3541b));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xa28a('0x1a')]({'items':[{'type':'input','props':{'title':_0xa28a('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0xa28a('0x21'),'config':{'placeholder':_0xa28a('0x22')},'props':{'title':_0xa28a('0x22'),'helpText':_0xa28a('0x23')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xa28a('0x24'))?JSON['parse'](this[_0xa28a('0x1e')](_0xa28a('0x24'))):{};},'set':function(_0x2b029f){return this[_0xa28a('0x20')](_0xa28a('0x24'),JSON[_0xa28a('0x1a')](_0x2b029f));}},'token':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':function(){return rs[_0xa28a('0x25')]();}},'autoclose':{'type':Sequelize[_0xa28a('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xa28a('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xa28a('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xa28a('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':_0xa28a('0x26')},'waitingMessage':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':_0xa28a('0x27')},'offlineMessageBody':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':_0xa28a('0x28')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':_0xa28a('0x29')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xa28a('0x2a')},'sendUnmanaged':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':_0xa28a('0x16')},'enableCustomerAttachment':{'type':Sequelize[_0xa28a('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xa28a('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xa28a('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xa28a('0x2')]},'notificationTemplate':{'type':Sequelize[_0xa28a('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xa28a('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa28a('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':_0xa28a('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0xa28a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xa28a('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':_0xa28a('0x2c')},'defaultTitle':{'type':Sequelize[_0xa28a('0x2')]},'customerAvatar':{'type':Sequelize[_0xa28a('0x11')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xa28a('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xa28a('0x2')],'allowNull':![],'defaultValue':_0xa28a('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa28a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':_0xa28a('0x2e')},'systemAvatar':{'type':Sequelize[_0xa28a('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa28a('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xa28a('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2b6039){if(!_0x2b6039)this['setDataValue'](_0xa28a('0x2f'),null);this[_0xa28a('0x20')](_0xa28a('0x30'),_0x2b6039);}},'vidaooEscalation':{'type':Sequelize[_0xa28a('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xa28a('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x6cca=['stringify','input','text','name','getDataValue','onlineForm','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','parse','generate','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','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','INTEGER','bottom_right','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','address','email','#011F6A','#ffffff','rounded','squared','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','BOOLEAN','Feedback','ENUM','star','thumb'];(function(_0x125777,_0x308240){var _0x24208f=function(_0x3d179f){while(--_0x3d179f){_0x125777['push'](_0x125777['shift']());}};_0x24208f(++_0x308240);}(_0x6cca,0x10e));var _0xa6cc=function(_0x38cbb6,_0x5c73ec){_0x38cbb6=_0x38cbb6-0x0;var _0x4fe3fe=_0x6cca[_0x38cbb6];return _0x4fe3fe;};'use strict';var Sequelize=require(_0xa6cc('0x0'));var rs=require(_0xa6cc('0x1'));module['exports']={'name':{'type':Sequelize[_0xa6cc('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xa6cc('0x2')],'allowNull':![],'unique':_0xa6cc('0x3')},'description':{'type':Sequelize[_0xa6cc('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xa6cc('0x4')},'mapKeyOffline':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x4')},'key':{'type':Sequelize[_0xa6cc('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xa6cc('0x2')],'allowNull':![],'defaultValue':_0xa6cc('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xa6cc('0x2')],'allowNull':![],'defaultValue':_0xa6cc('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa6cc('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xa6cc('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xa6cc('0x7'),_0xa6cc('0x8')),'defaultValue':_0xa6cc('0x7')},'header_online':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x9')},'offline_chat_button':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0xa')},'header_offline':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0xb')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0xc')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xa6cc('0xd')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xa6cc('0xe')},'formSubmitSuccessMessage':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x10')},'noteTitle':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x11')},'placeholderMessage':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x12')},'closingMessage':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0xa')},'skipMessageButton':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xa6cc('0x14')},'ratingType':{'type':Sequelize[_0xa6cc('0x15')](_0xa6cc('0x16'),_0xa6cc('0x17')),'defaultValue':_0xa6cc('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xa6cc('0xd')],'defaultValue':function(){return JSON[_0xa6cc('0x18')]({'items':[{'type':_0xa6cc('0x19'),'variable':null,'config':{'placeholder':'name','type':_0xa6cc('0x1a'),'required':!![]},'props':{'title':_0xa6cc('0x1b'),'helpText':''}},{'type':_0xa6cc('0x19'),'props':{'title':_0xa6cc('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xa6cc('0x4'),'type':_0xa6cc('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xa6cc('0x1c')](_0xa6cc('0x1d'))?JSON['parse'](this[_0xa6cc('0x1c')](_0xa6cc('0x1d'))):{};},'set':function(_0x1aa1ba){return this[_0xa6cc('0x1e')]('onlineForm',JSON[_0xa6cc('0x18')](_0x1aa1ba));}},'offlineForm':{'type':Sequelize[_0xa6cc('0xd')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xa6cc('0x19'),'props':{'title':_0xa6cc('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xa6cc('0x4'),'type':_0xa6cc('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0xa6cc('0x1f'),'helpText':_0xa6cc('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0xa6cc('0x1c')](_0xa6cc('0x21'))?JSON[_0xa6cc('0x22')](this[_0xa6cc('0x1c')](_0xa6cc('0x21'))):{};},'set':function(_0x55eb9b){return this['setDataValue'](_0xa6cc('0x21'),JSON[_0xa6cc('0x18')](_0x55eb9b));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xa6cc('0x23')]();}},'autoclose':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xa6cc('0x2')]},'waitingTitle':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xa6cc('0x24')},'offlineMessageSubject':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x26')},'skipUnmanaged':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x27')},'sendUnmanaged':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xa6cc('0xd')]},'showAgentAvatar':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xa6cc('0xd')],'defaultValue':function(){return _0xa6cc('0x28');}},'notificationSound':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xa6cc('0x2a')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x2b')},'verticalAlignment':{'type':Sequelize[_0xa6cc('0x2a')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xa6cc('0xd')]},'showCustomerAvatar':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xa6cc('0x2')],'allowNull':![],'defaultValue':_0xa6cc('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa6cc('0x2a')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':_0xa6cc('0x2d')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa6cc('0x2a')],'comment':_0xa6cc('0x2e')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x34c4ac){if(!_0x34c4ac)this[_0xa6cc('0x1e')](_0xa6cc('0x2f'),null);this[_0xa6cc('0x1e')](_0xa6cc('0x30'),_0x34c4ac);}},'vidaooEscalation':{'type':Sequelize[_0xa6cc('0x13')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xa6cc('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index ebfddc1..b22d5b7 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 _0xc015=['addAvatar','agentAvatar','filename','addCustomerAvatar','addSystemAvatar','join','server/files/images/logos/default_logo.svg','sitepic','getLicense','custom','isNil','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','customerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','user-agent','chat','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from','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','ChatApplication','List','account','applications','Applications','list','orderBy','asc','Contacts','contact','headers','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','forcedOwnership','Start','startRouting','EventManager','offline','no\x20available\x20attributes','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','toPairs','offlineMessageBody','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','auth','SendMail','email','offlineMessageSubject','addInteraction','omit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','timezone','interval','indexOf','info','ONLINE','OFFLINE','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.js','x-real-ip','connection','remoteAddress','replace','render','alignment','verticalAlignment','textColor','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','priority','getApplications','ChatProactiveAction','getFields','online','false','offlineForm','items','fromKey','ChatOfflineMessage','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','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','./chatWebsite.socket','register','jayson/promise','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','save','get','UserProfileResource','destroy','stack','name','send','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','Pause','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','nolimit','rows','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','addLogo','file'];(function(_0x55464f,_0x3761a4){var _0x4a90f8=function(_0xf5d40e){while(--_0xf5d40e){_0x55464f['push'](_0x55464f['shift']());}};_0x4a90f8(++_0x3761a4);}(_0xc015,0xaa));var _0x5c01=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0xc015[_0x2fee96];return _0x2e6ad1;};'use strict';var pdf=require(_0x5c01('0x0'));var emlformat=require(_0x5c01('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5c01('0x2'));var jsonpatch=require(_0x5c01('0x3'));var rp=require(_0x5c01('0x4'));var moment=require(_0x5c01('0x5'));var BPromise=require(_0x5c01('0x6'));var Mustache=require(_0x5c01('0x7'));var util=require(_0x5c01('0x8'));var path=require(_0x5c01('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5c01('0xa'));var squel=require(_0x5c01('0xb'));var crypto=require(_0x5c01('0xc'));var jsforce=require(_0x5c01('0xd'));var deskjs=require(_0x5c01('0xe'));var toCsv=require(_0x5c01('0xf'));var querystring=require(_0x5c01('0x10'));var Papa=require(_0x5c01('0x11'));var Redis=require('ioredis');var authService=require(_0x5c01('0x12'));var qs=require(_0x5c01('0x13'));var as=require(_0x5c01('0x14'));var hardwareService=require(_0x5c01('0x15'));var logger=require('../../config/logger')(_0x5c01('0x16'));var utils=require(_0x5c01('0x17'));var config=require(_0x5c01('0x18'));var licenseUtil=require(_0x5c01('0x19'));var db=require(_0x5c01('0x1a'))['db'];config[_0x5c01('0x1b')]=_['defaults'](config[_0x5c01('0x1b')],{'host':_0x5c01('0x1c'),'port':0x18eb});var socket=require(_0x5c01('0x1d'))(new Redis(config[_0x5c01('0x1b')]));require(_0x5c01('0x1e'))[_0x5c01('0x1f')](socket);var jayson=require(_0x5c01('0x20'));var client=jayson[_0x5c01('0x21')]['http']({'port':0x232c});var client9002=jayson['client'][_0x5c01('0x22')]({'port':0x232a});var client9003=jayson[_0x5c01('0x21')][_0x5c01('0x22')]({'port':0x232b});function respondWithRpcPromise(_0x43d726,_0x3fb062,_0x474172,_0x4ce200){return new BPromise(function(_0x11a71a,_0x41adb9){var _0x153a4d=_0x4ce200||client;return _0x153a4d[_0x5c01('0x23')](_0x43d726,_0x474172)[_0x5c01('0x24')](function(_0x3a733b){logger['info'](_0x5c01('0x25'),_0x3fb062,_0x5c01('0x26'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x3fb062,_0x5c01('0x26'),JSON[_0x5c01('0x27')](_0x3a733b));if(_0x3a733b['error']){if(_0x3a733b[_0x5c01('0x28')]['code']===0x1f4){logger[_0x5c01('0x28')](_0x5c01('0x25'),_0x3fb062,_0x3a733b[_0x5c01('0x28')][_0x5c01('0x29')]);return _0x41adb9(_0x3a733b['error'][_0x5c01('0x29')]);}logger[_0x5c01('0x28')](_0x5c01('0x25'),_0x3fb062,_0x3a733b[_0x5c01('0x28')][_0x5c01('0x29')]);return _0x11a71a(_0x3a733b[_0x5c01('0x28')][_0x5c01('0x29')]);}else{logger['info'](_0x5c01('0x25'),_0x3fb062,_0x5c01('0x26'));_0x11a71a(_0x3a733b['result']['message']);}})[_0x5c01('0x2a')](function(_0x4cfa5b){logger[_0x5c01('0x28')](_0x5c01('0x25'),_0x3fb062,_0x4cfa5b);_0x41adb9(_0x4cfa5b);});});}function respondWithStatusCode(_0x168b08,_0x41dee6){_0x41dee6=_0x41dee6||0xcc;return function(_0x818326){if(_0x818326){return _0x168b08[_0x5c01('0x2b')](_0x41dee6);}return _0x168b08['status'](_0x41dee6)[_0x5c01('0x2c')]();};}function respondWithResult(_0x1207c5,_0x4bb32d){_0x4bb32d=_0x4bb32d||0xc8;return function(_0x16efc2){if(_0x16efc2){return _0x1207c5[_0x5c01('0x2d')](_0x4bb32d)['json'](_0x16efc2);}};}function respondWithFilteredResult(_0x14cddf,_0x3f1adf){return function(_0x22972a){if(_0x22972a){var _0x4adca9=_0x22972a['count'],_0x29b262=_0x3f1adf[_0x5c01('0x2e')],_0x18d4a4=_0x3f1adf[_0x5c01('0x2e')]+_0x3f1adf[_0x5c01('0x2f')],_0x2b086e;if(_0x18d4a4>=_0x4adca9){_0x18d4a4=_0x4adca9;_0x2b086e=0xc8;}else{_0x2b086e=0xce;}_0x14cddf[_0x5c01('0x2d')](_0x2b086e);return _0x14cddf[_0x5c01('0x30')](_0x5c01('0x31'),_0x29b262+'-'+_0x18d4a4+'/'+_0x4adca9)[_0x5c01('0x32')](_0x22972a);}return null;};}function patchUpdates(_0x5f20b6){return function(_0xea9f41){try{jsonpatch[_0x5c01('0x33')](_0xea9f41,_0x5f20b6,!![]);}catch(_0x3a6673){return BPromise['reject'](_0x3a6673);}return _0xea9f41[_0x5c01('0x34')]();};}function saveUpdates(_0x339e67,_0x443012){return function(_0x286ed){if(_0x286ed){return _0x286ed['update'](_0x339e67)[_0x5c01('0x24')](function(_0xaa8ace){return _0xaa8ace;});}return null;};}function removeEntity(_0xa0c760,_0x874034){return function(_0x53d3bb){if(_0x53d3bb){return _0x53d3bb['destroy']()[_0x5c01('0x24')](function(){var _0x1fca46=_0x53d3bb[_0x5c01('0x35')]({'plain':!![]});var _0x4faa62='ChatWebsites';return db[_0x5c01('0x36')][_0x5c01('0x37')]({'where':{'type':_0x4faa62,'resourceId':_0x1fca46['id']}})[_0x5c01('0x24')](function(){return _0x53d3bb;});})['then'](function(){_0xa0c760[_0x5c01('0x2d')](0xcc)[_0x5c01('0x2c')]();});}};}function handleEntityNotFound(_0x483785,_0x3d7395){return function(_0x5e3c6a){if(!_0x5e3c6a){_0x483785[_0x5c01('0x2b')](0x194);}return _0x5e3c6a;};}function handleError(_0x42c87d,_0x40701e){_0x40701e=_0x40701e||0x1f4;return function(_0x25aed4){logger['error'](_0x25aed4[_0x5c01('0x38')]);if(_0x25aed4[_0x5c01('0x39')]){delete _0x25aed4[_0x5c01('0x39')];}_0x42c87d[_0x5c01('0x2d')](_0x40701e)[_0x5c01('0x3a')](_0x25aed4);};}exports['index']=function(_0x5ca174,_0x171ff3){var _0x53ae2d={'include':[{'model':db['Pause'],'as':_0x5c01('0x3b')}]},_0x7a16ee={},_0x559e55={'count':0x0,'rows':[]};var _0x17da7e=_['map'](db[_0x5c01('0x3c')][_0x5c01('0x3d')],function(_0x503472){return{'name':_0x503472[_0x5c01('0x3e')],'type':_0x503472['type'][_0x5c01('0x3f')]};});_0x7a16ee[_0x5c01('0x40')]=_[_0x5c01('0x41')](_0x17da7e,'name');_0x7a16ee[_0x5c01('0x42')]=_[_0x5c01('0x43')](_0x5ca174['query']);_0x7a16ee[_0x5c01('0x44')]=_[_0x5c01('0x45')](_0x7a16ee[_0x5c01('0x40')],_0x7a16ee['query']);_0x53ae2d['attributes']=_['intersection'](_0x7a16ee[_0x5c01('0x40')],qs[_0x5c01('0x46')](_0x5ca174[_0x5c01('0x42')][_0x5c01('0x46')]));_0x53ae2d['attributes']=_0x53ae2d[_0x5c01('0x47')][_0x5c01('0x48')]?_0x53ae2d['attributes']:_0x7a16ee[_0x5c01('0x40')];if(!_0x5ca174['query'][_0x5c01('0x49')]('nolimit')){_0x53ae2d['limit']=qs[_0x5c01('0x2f')](_0x5ca174[_0x5c01('0x42')][_0x5c01('0x2f')]);_0x53ae2d['offset']=qs[_0x5c01('0x2e')](_0x5ca174[_0x5c01('0x42')][_0x5c01('0x2e')]);}_0x53ae2d[_0x5c01('0x4a')]=qs[_0x5c01('0x4b')](_0x5ca174[_0x5c01('0x42')][_0x5c01('0x4b')]);_0x53ae2d[_0x5c01('0x4c')]=qs['filters'](_[_0x5c01('0x4d')](_0x5ca174[_0x5c01('0x42')],_0x7a16ee['filters']),_0x17da7e);if(_0x5ca174['query'][_0x5c01('0x4e')]){_0x53ae2d[_0x5c01('0x4c')]=_[_0x5c01('0x4f')](_0x53ae2d[_0x5c01('0x4c')],{'$or':_[_0x5c01('0x41')](_0x17da7e,function(_0x3c85cb){if(_0x3c85cb[_0x5c01('0x50')]!==_0x5c01('0x51')){var _0x1aa46e={};_0x1aa46e[_0x3c85cb['name']]={'$like':'%'+_0x5ca174[_0x5c01('0x42')][_0x5c01('0x4e')]+'%'};return _0x1aa46e;}})});}_0x53ae2d=_[_0x5c01('0x4f')]({},_0x53ae2d,_0x5ca174[_0x5c01('0x52')]);var _0x37655d={'where':_0x53ae2d[_0x5c01('0x4c')]};return db[_0x5c01('0x3c')][_0x5c01('0x53')](_0x37655d)[_0x5c01('0x24')](function(_0x54e2bb){_0x559e55[_0x5c01('0x53')]=_0x54e2bb;if(_0x5ca174[_0x5c01('0x42')]['includeAll']){_0x53ae2d[_0x5c01('0x54')]=[{'all':!![]}];}return db[_0x5c01('0x3c')][_0x5c01('0x55')](_0x53ae2d);})[_0x5c01('0x24')](function(_0x243b01){_0x559e55['rows']=_0x243b01;return _0x559e55;})[_0x5c01('0x24')](respondWithFilteredResult(_0x171ff3,_0x53ae2d))[_0x5c01('0x2a')](handleError(_0x171ff3,null));};exports[_0x5c01('0x56')]=function(_0x2dba75,_0x5cfaf2){var _0x3ca08d={'raw':![],'where':{'id':_0x2dba75[_0x5c01('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x5c01('0x3b')}]},_0x59bb91={};_0x59bb91['model']=_[_0x5c01('0x43')](db[_0x5c01('0x3c')]['rawAttributes']);_0x59bb91['query']=_['keys'](_0x2dba75[_0x5c01('0x42')]);_0x59bb91[_0x5c01('0x44')]=_[_0x5c01('0x45')](_0x59bb91[_0x5c01('0x40')],_0x59bb91[_0x5c01('0x42')]);_0x3ca08d[_0x5c01('0x47')]=_[_0x5c01('0x45')](_0x59bb91['model'],qs[_0x5c01('0x46')](_0x2dba75[_0x5c01('0x42')][_0x5c01('0x46')]));_0x3ca08d[_0x5c01('0x47')]=_0x3ca08d['attributes'][_0x5c01('0x48')]?_0x3ca08d[_0x5c01('0x47')]:_0x59bb91[_0x5c01('0x40')];if(_0x2dba75[_0x5c01('0x42')][_0x5c01('0x58')]){_0x3ca08d['include']=[{'all':!![]}];}_0x3ca08d=_[_0x5c01('0x4f')]({},_0x3ca08d,_0x2dba75['options']);return db['ChatWebsite'][_0x5c01('0x59')](_0x3ca08d)[_0x5c01('0x24')](handleEntityNotFound(_0x5cfaf2,null))[_0x5c01('0x24')](respondWithResult(_0x5cfaf2,null))[_0x5c01('0x2a')](handleError(_0x5cfaf2,null));};exports[_0x5c01('0x5a')]=function(_0x42c9d3,_0x3b2450){return db[_0x5c01('0x3c')][_0x5c01('0x5a')](_0x42c9d3[_0x5c01('0x5b')],{})[_0x5c01('0x24')](function(_0x49c995){var _0x109889=_0x42c9d3[_0x5c01('0x5c')][_0x5c01('0x35')]({'plain':!![]});if(!_0x109889)throw new Error(_0x5c01('0x5d'));if(_0x109889['role']==='user'){var _0x372827=_0x49c995[_0x5c01('0x35')]({'plain':!![]});var _0x153527='ChatWebsites';return db[_0x5c01('0x5e')][_0x5c01('0x59')]({'where':{'name':_0x153527,'userProfileId':_0x109889[_0x5c01('0x5f')]},'raw':!![]})[_0x5c01('0x24')](function(_0x5231ff){if(_0x5231ff&&_0x5231ff[_0x5c01('0x60')]===0x0){return db[_0x5c01('0x36')][_0x5c01('0x5a')]({'name':_0x372827[_0x5c01('0x39')],'resourceId':_0x372827['id'],'type':_0x5231ff['name'],'sectionId':_0x5231ff['id']},{})[_0x5c01('0x24')](function(){return _0x49c995;});}else{return _0x49c995;}})[_0x5c01('0x2a')](function(_0x4eb03a){logger[_0x5c01('0x28')](_0x5c01('0x61'),_0x4eb03a);throw _0x4eb03a;});}return _0x49c995;})[_0x5c01('0x24')](respondWithResult(_0x3b2450,0xc9))[_0x5c01('0x2a')](handleError(_0x3b2450,null));};exports[_0x5c01('0x62')]=function(_0x80bc9d,_0x5b5f60){if(_0x80bc9d[_0x5c01('0x5b')]['id']){delete _0x80bc9d['body']['id'];}return db['ChatWebsite'][_0x5c01('0x59')]({'where':{'id':_0x80bc9d['params']['id']},'include':[{'model':db[_0x5c01('0x63')],'as':_0x5c01('0x3b')}]})['then'](handleEntityNotFound(_0x5b5f60,null))[_0x5c01('0x24')](saveUpdates(_0x80bc9d[_0x5c01('0x5b')],null))[_0x5c01('0x24')](respondWithResult(_0x5b5f60,null))['catch'](handleError(_0x5b5f60,null));};exports[_0x5c01('0x37')]=function(_0x317bbc,_0x17d851){return db[_0x5c01('0x3c')][_0x5c01('0x59')]({'where':{'id':_0x317bbc[_0x5c01('0x57')]['id']}})['then'](handleEntityNotFound(_0x17d851,null))[_0x5c01('0x24')](removeEntity(_0x17d851,null))[_0x5c01('0x2a')](handleError(_0x17d851,null));};exports[_0x5c01('0x64')]=function(_0x471187,_0x326f3d){return db[_0x5c01('0x3c')][_0x5c01('0x64')]()[_0x5c01('0x24')](respondWithResult(_0x326f3d,null))[_0x5c01('0x2a')](handleError(_0x326f3d,null));};exports[_0x5c01('0x65')]=function(_0x2ab447,_0x13544b,_0x31e7f7){if(_0x2ab447[_0x5c01('0x5b')]['id']){delete _0x2ab447['body']['id'];}return db[_0x5c01('0x3c')][_0x5c01('0x59')]({'where':{'id':_0x2ab447[_0x5c01('0x57')]['id']}})['then'](handleEntityNotFound(_0x13544b,null))['then'](function(_0x55defd){if(_0x55defd){_0x2ab447['body'][_0x5c01('0x66')]=_0x55defd['id'];return db[_0x5c01('0x67')][_0x5c01('0x5a')](_0x2ab447[_0x5c01('0x5b')]);}})['then'](respondWithResult(_0x13544b,null))[_0x5c01('0x2a')](handleError(_0x13544b,null));};exports[_0x5c01('0x68')]=function(_0x2ff5ec,_0x9400d0,_0x1733c3){var _0x416706={'raw':![],'where':{}};var _0xdc87af={};var _0x633cb4={'count':0x0,'rows':[]};return db[_0x5c01('0x3c')][_0x5c01('0x69')]({'where':{'id':_0x2ff5ec[_0x5c01('0x57')]['id']}})[_0x5c01('0x24')](handleEntityNotFound(_0x9400d0,null))[_0x5c01('0x24')](function(_0x57c239){if(_0x57c239){_0xdc87af['model']=_[_0x5c01('0x43')](db['Disposition'][_0x5c01('0x3d')]);_0xdc87af[_0x5c01('0x42')]=_[_0x5c01('0x43')](_0x2ff5ec['query']);_0xdc87af[_0x5c01('0x44')]=_[_0x5c01('0x45')](_0xdc87af[_0x5c01('0x40')],_0xdc87af[_0x5c01('0x42')]);_0x416706['attributes']=_[_0x5c01('0x45')](_0xdc87af[_0x5c01('0x40')],qs[_0x5c01('0x46')](_0x2ff5ec[_0x5c01('0x42')][_0x5c01('0x46')]));_0x416706[_0x5c01('0x47')]=_0x416706[_0x5c01('0x47')][_0x5c01('0x48')]?_0x416706['attributes']:_0xdc87af[_0x5c01('0x40')];if(!_0x2ff5ec[_0x5c01('0x42')][_0x5c01('0x49')](_0x5c01('0x6a'))){_0x416706[_0x5c01('0x2f')]=qs[_0x5c01('0x2f')](_0x2ff5ec[_0x5c01('0x42')][_0x5c01('0x2f')]);_0x416706[_0x5c01('0x2e')]=qs[_0x5c01('0x2e')](_0x2ff5ec['query'][_0x5c01('0x2e')]);}_0x416706['order']=qs[_0x5c01('0x4b')](_0x2ff5ec['query'][_0x5c01('0x4b')]);_0x416706[_0x5c01('0x4c')]=qs[_0x5c01('0x44')](_[_0x5c01('0x4d')](_0x2ff5ec[_0x5c01('0x42')],_0xdc87af[_0x5c01('0x44')]));_0x416706[_0x5c01('0x4c')][_0x5c01('0x66')]=_0x57c239['id'];if(_0x2ff5ec[_0x5c01('0x42')][_0x5c01('0x4e')]){_0x416706['where']=_[_0x5c01('0x4f')](_0x416706[_0x5c01('0x4c')],{'$or':_['map'](_0x416706['attributes'],function(_0x1ac0df){var _0x2ccb7d={};_0x2ccb7d[_0x1ac0df]={'$like':'%'+_0x2ff5ec['query'][_0x5c01('0x4e')]+'%'};return _0x2ccb7d;})});}_0x416706=_[_0x5c01('0x4f')]({},_0x416706,_0x2ff5ec[_0x5c01('0x52')]);return db['Disposition'][_0x5c01('0x53')]({'where':_0x416706[_0x5c01('0x4c')]})['then'](function(_0x2d96f5){_0x633cb4[_0x5c01('0x53')]=_0x2d96f5;if(_0x2ff5ec[_0x5c01('0x42')][_0x5c01('0x58')]){_0x416706[_0x5c01('0x54')]=[{'all':!![]}];}return db[_0x5c01('0x67')]['findAll'](_0x416706);})['then'](function(_0x3805dc){_0x633cb4[_0x5c01('0x6b')]=_0x3805dc;return _0x633cb4;});}})['then'](respondWithFilteredResult(_0x9400d0,_0x416706))[_0x5c01('0x2a')](handleError(_0x9400d0,null));};exports['removeDispositions']=function(_0x58aa1a,_0x1d3910,_0x3bddb9){return db[_0x5c01('0x3c')]['find']({'where':{'id':_0x58aa1a['params']['id']}})[_0x5c01('0x24')](handleEntityNotFound(_0x1d3910,null))['then'](function(_0x20d91b){if(_0x20d91b){return _0x20d91b[_0x5c01('0x6c')](_0x58aa1a[_0x5c01('0x42')]['ids']);}})[_0x5c01('0x24')](respondWithStatusCode(_0x1d3910,null))[_0x5c01('0x2a')](handleError(_0x1d3910,null));};exports[_0x5c01('0x6d')]=function(_0xf89906,_0x12028a,_0x21a6ba){if(_0xf89906[_0x5c01('0x5b')]['id']){delete _0xf89906[_0x5c01('0x5b')]['id'];}return db[_0x5c01('0x3c')]['find']({'where':{'id':_0xf89906[_0x5c01('0x57')]['id']}})[_0x5c01('0x24')](handleEntityNotFound(_0x12028a,null))[_0x5c01('0x24')](function(_0x54fa71){if(_0x54fa71){_0xf89906[_0x5c01('0x5b')][_0x5c01('0x66')]=_0x54fa71['id'];return db['CannedAnswer']['create'](_0xf89906['body']);}})['then'](respondWithResult(_0x12028a,null))['catch'](handleError(_0x12028a,null));};exports[_0x5c01('0x6e')]=function(_0x1d8506,_0x402fef,_0x19d59c){var _0x19445d={'raw':![],'where':{}};var _0xe054d5={};var _0x32530b={'count':0x0,'rows':[]};return db[_0x5c01('0x3c')]['findOne']({'where':{'id':_0x1d8506['params']['id']}})['then'](handleEntityNotFound(_0x402fef,null))[_0x5c01('0x24')](function(_0x2a3d33){if(_0x2a3d33){_0xe054d5[_0x5c01('0x40')]=_['keys'](db['CannedAnswer'][_0x5c01('0x3d')]);_0xe054d5[_0x5c01('0x42')]=_[_0x5c01('0x43')](_0x1d8506[_0x5c01('0x42')]);_0xe054d5[_0x5c01('0x44')]=_[_0x5c01('0x45')](_0xe054d5[_0x5c01('0x40')],_0xe054d5['query']);_0x19445d[_0x5c01('0x47')]=_['intersection'](_0xe054d5[_0x5c01('0x40')],qs[_0x5c01('0x46')](_0x1d8506['query'][_0x5c01('0x46')]));_0x19445d[_0x5c01('0x47')]=_0x19445d[_0x5c01('0x47')]['length']?_0x19445d[_0x5c01('0x47')]:_0xe054d5[_0x5c01('0x40')];if(!_0x1d8506[_0x5c01('0x42')][_0x5c01('0x49')](_0x5c01('0x6a'))){_0x19445d[_0x5c01('0x2f')]=qs['limit'](_0x1d8506[_0x5c01('0x42')][_0x5c01('0x2f')]);_0x19445d[_0x5c01('0x2e')]=qs['offset'](_0x1d8506[_0x5c01('0x42')]['offset']);}_0x19445d[_0x5c01('0x4a')]=qs[_0x5c01('0x4b')](_0x1d8506[_0x5c01('0x42')]['sort']);_0x19445d['where']=qs['filters'](_[_0x5c01('0x4d')](_0x1d8506[_0x5c01('0x42')],_0xe054d5[_0x5c01('0x44')]));_0x19445d[_0x5c01('0x4c')][_0x5c01('0x66')]=_0x2a3d33['id'];if(_0x1d8506[_0x5c01('0x42')]['filter']){_0x19445d['where']=_[_0x5c01('0x4f')](_0x19445d[_0x5c01('0x4c')],{'$or':_['map'](_0x19445d['attributes'],function(_0x316ea6){var _0x1195ce={};_0x1195ce[_0x316ea6]={'$like':'%'+_0x1d8506[_0x5c01('0x42')][_0x5c01('0x4e')]+'%'};return _0x1195ce;})});}_0x19445d=_[_0x5c01('0x4f')]({},_0x19445d,_0x1d8506[_0x5c01('0x52')]);return db[_0x5c01('0x6f')][_0x5c01('0x53')]({'where':_0x19445d['where']})[_0x5c01('0x24')](function(_0x34632a){_0x32530b['count']=_0x34632a;if(_0x1d8506[_0x5c01('0x42')][_0x5c01('0x58')]){_0x19445d[_0x5c01('0x54')]=[{'all':!![]}];}return db[_0x5c01('0x6f')]['findAll'](_0x19445d);})['then'](function(_0x49feac){_0x32530b[_0x5c01('0x6b')]=_0x49feac;return _0x32530b;});}})[_0x5c01('0x24')](respondWithFilteredResult(_0x402fef,_0x19445d))[_0x5c01('0x2a')](handleError(_0x402fef,null));};exports[_0x5c01('0x70')]=function(_0x2e2cd3,_0x29aef9,_0x13e8cc){return db[_0x5c01('0x3c')]['find']({'where':{'id':_0x2e2cd3[_0x5c01('0x57')]['id']}})[_0x5c01('0x24')](handleEntityNotFound(_0x29aef9,null))['then'](function(_0x39a3d6){if(_0x39a3d6){return _0x39a3d6['removeAnswers'](_0x2e2cd3[_0x5c01('0x42')][_0x5c01('0x71')]);}})['then'](respondWithStatusCode(_0x29aef9,null))[_0x5c01('0x2a')](handleError(_0x29aef9,null));};exports[_0x5c01('0x72')]=function(_0x243cab,_0x4998c6,_0x5900f5){_0x243cab[_0x5c01('0x5b')]['sitepic']=_0x243cab[_0x5c01('0x73')]['filename'];return db['ChatWebsite'][_0x5c01('0x59')]({'where':{'id':_0x243cab['params']['id']}})[_0x5c01('0x24')](handleEntityNotFound(_0x4998c6,null))[_0x5c01('0x24')](saveUpdates(_0x243cab[_0x5c01('0x5b')],null))[_0x5c01('0x24')](respondWithResult(_0x4998c6,null))['catch'](handleError(_0x4998c6,null));};exports[_0x5c01('0x74')]=function(_0x2c93fa,_0x27f111,_0x5bd43e){_0x2c93fa[_0x5c01('0x5b')][_0x5c01('0x75')]=_0x2c93fa[_0x5c01('0x73')][_0x5c01('0x76')];return db['ChatWebsite'][_0x5c01('0x59')]({'where':{'id':_0x2c93fa[_0x5c01('0x57')]['id']}})[_0x5c01('0x24')](handleEntityNotFound(_0x27f111,null))['then'](saveUpdates(_0x2c93fa[_0x5c01('0x5b')],null))[_0x5c01('0x24')](respondWithResult(_0x27f111,null))[_0x5c01('0x2a')](handleError(_0x27f111,null));};exports[_0x5c01('0x77')]=function(_0x1757c3,_0x38a9c5,_0x1f581a){_0x1757c3[_0x5c01('0x5b')]['customerAvatar']=_0x1757c3[_0x5c01('0x73')][_0x5c01('0x76')];return db[_0x5c01('0x3c')][_0x5c01('0x59')]({'where':{'id':_0x1757c3['params']['id']}})['then'](handleEntityNotFound(_0x38a9c5,null))['then'](saveUpdates(_0x1757c3[_0x5c01('0x5b')],null))[_0x5c01('0x24')](respondWithResult(_0x38a9c5,null))[_0x5c01('0x2a')](handleError(_0x38a9c5,null));};exports[_0x5c01('0x78')]=function(_0x4bead0,_0x1459ae,_0x3fe4d6){_0x4bead0[_0x5c01('0x5b')]['systemAvatar']=_0x4bead0[_0x5c01('0x73')]['filename'];return db[_0x5c01('0x3c')][_0x5c01('0x59')]({'where':{'id':_0x4bead0['params']['id']}})[_0x5c01('0x24')](handleEntityNotFound(_0x1459ae,null))[_0x5c01('0x24')](saveUpdates(_0x4bead0[_0x5c01('0x5b')],null))[_0x5c01('0x24')](respondWithResult(_0x1459ae,null))[_0x5c01('0x2a')](handleError(_0x1459ae,null));};exports['getLogo']=function(_0x57e45e,_0x1e5d47,_0xc0a8fb){var _0x16b400=path[_0x5c01('0x79')](config['root'],_0x5c01('0x7a'));var _0x5961b3={'where':{'id':_0x57e45e[_0x5c01('0x57')]['id']},'attributes':['id',_0x5c01('0x7b')],'raw':!![]};var _0x351199=![];return require(_0x5c01('0x19'))[_0x5c01('0x7c')]()[_0x5c01('0x24')](function(_0x32d637){if(_0x32d637){_0x351199=_0x32d637[_0x5c01('0x7d')];}})[_0x5c01('0x24')](function(){return db[_0x5c01('0x3c')][_0x5c01('0x59')](_0x5961b3);})[_0x5c01('0x24')](handleEntityNotFound(_0x1e5d47,null))[_0x5c01('0x24')](function(_0xec0670){if(_0xec0670){if(!_[_0x5c01('0x7e')](_0xec0670[_0x5c01('0x7b')])){if(fs[_0x5c01('0x7f')](path[_0x5c01('0x79')](config[_0x5c01('0x80')],'server/files/images/logos/',_0xec0670['sitepic']))&&_0x351199){_0x16b400=path[_0x5c01('0x79')](config[_0x5c01('0x80')],_0x5c01('0x81'),_0xec0670[_0x5c01('0x7b')]);}}return _0x1e5d47[_0x5c01('0x82')](_0x16b400);}})[_0x5c01('0x2a')](handleError(_0x1e5d47,null));};exports[_0x5c01('0x83')]=function(_0x462a8c,_0x17d5c5,_0x5bc5f6){var _0x4ec6ab=path[_0x5c01('0x79')](config[_0x5c01('0x80')],'server/files/images/avatars/default_avatar.png');var _0xf7d8a5={'where':{'id':_0x462a8c[_0x5c01('0x57')]['id']},'attributes':['id',_0x5c01('0x75')],'raw':!![]};return db[_0x5c01('0x3c')][_0x5c01('0x59')](_0xf7d8a5)['then'](handleEntityNotFound(_0x17d5c5,null))[_0x5c01('0x24')](function(_0x4e8f91){if(_0x4e8f91){if(!_[_0x5c01('0x7e')](_0x4e8f91[_0x5c01('0x75')])){if(fs[_0x5c01('0x7f')](path[_0x5c01('0x79')](config[_0x5c01('0x80')],'server/files/images/avatars/',_0x4e8f91[_0x5c01('0x75')]))){_0x4ec6ab=path[_0x5c01('0x79')](config[_0x5c01('0x80')],_0x5c01('0x84'),_0x4e8f91['agentAvatar']);}}return _0x17d5c5[_0x5c01('0x82')](_0x4ec6ab);}})[_0x5c01('0x2a')](handleError(_0x17d5c5,null));};exports[_0x5c01('0x85')]=function(_0x43f059,_0x45a20d,_0x23a9f1){var _0x5353cc=path[_0x5c01('0x79')](config['root'],_0x5c01('0x86'));var _0x2c2884={'where':{'id':_0x43f059[_0x5c01('0x57')]['id']},'attributes':['id','customerAvatar',_0x5c01('0x87')],'raw':!![]};return db['ChatWebsite'][_0x5c01('0x59')](_0x2c2884)[_0x5c01('0x24')](handleEntityNotFound(_0x45a20d,null))[_0x5c01('0x24')](function(_0x5ef57e){if(_0x5ef57e){if(!_[_0x5c01('0x7e')](_0x5ef57e['customerAvatar'])){if(fs[_0x5c01('0x7f')](path[_0x5c01('0x79')](config[_0x5c01('0x80')],_0x5c01('0x84'),_0x5ef57e[_0x5c01('0x88')]))&&_0x5ef57e[_0x5c01('0x87')]){_0x5353cc=path[_0x5c01('0x79')](config['root'],'server/files/images/avatars/',_0x5ef57e[_0x5c01('0x88')]);}}return _0x45a20d[_0x5c01('0x82')](_0x5353cc);}})[_0x5c01('0x2a')](handleError(_0x45a20d,null));};exports[_0x5c01('0x89')]=function(_0x4227c9,_0x3162e3,_0x29785e){var _0x4cbf92=path[_0x5c01('0x79')](config[_0x5c01('0x80')],_0x5c01('0x8a'));var _0x2b24ba={'where':{'id':_0x4227c9[_0x5c01('0x57')]['id']},'attributes':['id',_0x5c01('0x8b')],'raw':!![]};return db[_0x5c01('0x3c')]['find'](_0x2b24ba)['then'](handleEntityNotFound(_0x3162e3,null))[_0x5c01('0x24')](function(_0x4ca350){if(_0x4ca350){if(!_[_0x5c01('0x7e')](_0x4ca350[_0x5c01('0x8b')])){if(fs[_0x5c01('0x7f')](path[_0x5c01('0x79')](config['root'],_0x5c01('0x84'),_0x4ca350[_0x5c01('0x8b')]))){_0x4cbf92=path[_0x5c01('0x79')](config[_0x5c01('0x80')],_0x5c01('0x84'),_0x4ca350[_0x5c01('0x8b')]);}}return _0x3162e3[_0x5c01('0x82')](_0x4cbf92);}})[_0x5c01('0x2a')](handleError(_0x3162e3,null));};exports[_0x5c01('0x8c')]=function(_0x4ad511,_0xf5ca24,_0x4b5c94){var _0x54ce7d=require(_0x5c01('0x8d'));var _0x2e6267=new _0x54ce7d();var _0x580e8f=_0x2e6267['setUA'](_0x4ad511['headers'][_0x5c01('0x8e')])['getResult']();var _0x55f058={'body':_0x4ad511[_0x5c01('0x5b')],'channel':_0x5c01('0x8f')};var _0x2383f5=[];var _0x173960=[];var _0x271730={};var _0x3df24c=![];return db[_0x5c01('0x90')][_0x5c01('0x64')]()[_0x5c01('0x24')](function(_0x1466b4){if(!_0x1466b4){throw new db[(_0x5c01('0x91'))][(_0x5c01('0x92'))]('no\x20available\x20attributes');}_0x2383f5=_[_0x5c01('0x93')](_[_0x5c01('0x43')](_0x1466b4),[_0x5c01('0x94'),_0x5c01('0x95')]);_0x173960=_[_0x5c01('0x93')](_[_0x5c01('0x43')](_0x1466b4),[_0x5c01('0x94'),_0x5c01('0x95'),_0x5c01('0x96'),_0x5c01('0x97')]);if(_0x4ad511[_0x5c01('0x5b')]['id']){delete _0x4ad511[_0x5c01('0x5b')]['id'];}if(_[_0x5c01('0x7e')](_0x4ad511[_0x5c01('0x5b')][_0x5c01('0x98')])){throw new db[(_0x5c01('0x91'))][(_0x5c01('0x92'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x4ad511[_0x5c01('0x5b')]['body'])||_0x4ad511[_0x5c01('0x5b')][_0x5c01('0x5b')]===''){throw new db[(_0x5c01('0x91'))][(_0x5c01('0x92'))](_0x5c01('0x99'));}if(_[_0x5c01('0x7e')](_0x4ad511[_0x5c01('0x5b')][_0x5c01('0x9a')])){throw new db[(_0x5c01('0x91'))]['ValidationError'](_0x5c01('0x9b')+_0x173960);}if(!_[_0x5c01('0x9c')](_0x173960,_0x4ad511['body'][_0x5c01('0x9a')])){throw new db[(_0x5c01('0x91'))][(_0x5c01('0x92'))](_0x5c01('0x9d')+_0x173960);}_0x271730[_0x4ad511[_0x5c01('0x5b')][_0x5c01('0x9a')]]=_0x4ad511['body']['from'];})[_0x5c01('0x24')](function(){return db[_0x5c01('0x3c')]['find']({'where':{'id':_0x4ad511[_0x5c01('0x57')]['id']},'include':[{'model':db[_0x5c01('0x9e')],'as':'List','include':[{'model':db[_0x5c01('0x90')],'as':'Contacts','where':_0x271730,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x5c01('0x9f')],'as':'Applications'}]});})[_0x5c01('0x24')](handleEntityNotFound(_0xf5ca24,null))['then'](function(_0x13beae){if(_0x13beae&&_0x13beae[_0x5c01('0xa0')]){_0x55f058[_0x5c01('0xa1')]=_0x13beae;_0x55f058[_0x5c01('0xa2')]=_0x13beae[_0x5c01('0xa3')];_0x55f058[_0x5c01('0xa4')]=_0x13beae['List'];_0x55f058[_0x5c01('0xa2')]=_[_0x5c01('0xa5')](_0x55f058[_0x5c01('0xa2')],['priority'],[_0x5c01('0xa6')]);if(_0x55f058['account'][_0x5c01('0xa3')]){delete _0x55f058[_0x5c01('0xa1')][_0x5c01('0xa3')];}if(_0x55f058['account'][_0x5c01('0xa0')]&&_0x55f058[_0x5c01('0xa1')][_0x5c01('0xa0')][_0x5c01('0xa7')][_0x5c01('0x48')]){return _0x55f058[_0x5c01('0xa1')][_0x5c01('0xa0')][_0x5c01('0xa7')][0x0];}var _0x571272=_['defaults'](_0x4ad511[_0x5c01('0x5b')],{'firstName':_0x4ad511[_0x5c01('0x5b')]['from'],'ListId':_0x13beae['ListId']});_0x571272[_0x4ad511['body'][_0x5c01('0x9a')]]=_0x4ad511[_0x5c01('0x5b')][_0x5c01('0x98')];return db['CmContact'][_0x5c01('0x5a')](_0x571272,{'fields':_0x2383f5,'raw':!![]});}})[_0x5c01('0x24')](handleEntityNotFound(_0xf5ca24,null))[_0x5c01('0x24')](function(_0x5bfbdc){_0x55f058[_0x5c01('0xa8')]=_0x5bfbdc;var _0x41169a=_0x4ad511[_0x5c01('0x5b')]['customerIp'];if(_0x4ad511[_0x5c01('0xa9')][_0x5c01('0xaa')]){_0x41169a=_0x4ad511[_0x5c01('0xa9')]['cf-connecting-ip'];}else if(_0x4ad511['headers']['x-forwarded-for']){_0x41169a=_[_0x5c01('0xab')](_0x4ad511[_0x5c01('0xa9')][_0x5c01('0xac')][_0x5c01('0xad')](','));}if(_0x5bfbdc){var _0x599b54={'ContactId':_0x5bfbdc['id'],'ChatWebsiteId':_0x4ad511[_0x5c01('0x57')]['id'],'from':(_0x5bfbdc[_0x5c01('0xae')]||'')+'\x20'+(_0x5bfbdc[_0x5c01('0xaf')]||''),'customerIp':_0x41169a,'customerPort':_0x4ad511['headers'][_0x5c01('0xb0')]?_0x4ad511[_0x5c01('0xa9')][_0x5c01('0xb0')]:null,'referer':_0x4ad511[_0x5c01('0x5b')][_0x5c01('0xb1')],'browserName':_0x580e8f[_0x5c01('0xb2')][_0x5c01('0x39')]&&_0x580e8f[_0x5c01('0xb2')]['version']?util[_0x5c01('0xb3')](_0x5c01('0xb4'),_0x580e8f[_0x5c01('0xb2')]['name'],_0x580e8f[_0x5c01('0xb2')][_0x5c01('0xb5')]):_0x5c01('0xb6'),'browserVersion':_0x580e8f[_0x5c01('0xb2')][_0x5c01('0xb5')]||'unknown','osName':util[_0x5c01('0xb3')](_0x5c01('0xb4'),_0x580e8f['os']['name'],_0x580e8f['os'][_0x5c01('0xb5')]),'osVersion':_0x580e8f['os'][_0x5c01('0xb5')],'deviceModel':_0x580e8f[_0x5c01('0xb7')][_0x5c01('0x40')]&&_0x580e8f[_0x5c01('0xb7')][_0x5c01('0xb8')]?util['format'](_0x5c01('0xb9'),_0x580e8f[_0x5c01('0xb7')][_0x5c01('0x40')],_0x580e8f['device'][_0x5c01('0xb8')],_0x580e8f['device'][_0x5c01('0x50')]):null,'deviceVendor':_0x580e8f[_0x5c01('0xb7')]['vendor'],'deviceType':_0x580e8f[_0x5c01('0xb7')][_0x5c01('0x50')],'formData':JSON['stringify'](_0x4ad511['body'])};var _0x21fad2={'ChatWebsiteId':_0x4ad511[_0x5c01('0x57')]['id'],'closed':![]};if(_0x4ad511['body']['threadId']){_0x21fad2['threadId']=_0x4ad511[_0x5c01('0x5b')][_0x5c01('0xba')];return db[_0x5c01('0xbb')]['find']({'where':_0x21fad2})[_0x5c01('0x24')](function(_0xca52e4){if(_0xca52e4){return[_0xca52e4,![]];}_0x599b54[_0x5c01('0xba')]=_0x4ad511['body'][_0x5c01('0xba')];_0x599b54[_0x5c01('0xbc')]=_0x4ad511[_0x5c01('0x5b')][_0x5c01('0xbc')];return db['ChatInteraction'][_0x5c01('0x5a')](_0x599b54)[_0x5c01('0x24')](function(_0x204a39){return[_0x204a39,!![]];});});}_0x21fad2[_0x5c01('0xbd')]=_0x5bfbdc['id'];if(_0x4ad511[_0x5c01('0x5b')][_0x5c01('0xbe')]&&_0x4ad511[_0x5c01('0x5b')]['interaction']['id']){_0x21fad2['id']=_0x4ad511[_0x5c01('0x5b')][_0x5c01('0xbe')]['id'];return db[_0x5c01('0xbb')][_0x5c01('0x59')]({'where':_0x21fad2})['then'](function(_0x5c42ee){if(_0x5c42ee){return[_0x5c42ee,![]];}return db[_0x5c01('0xbb')][_0x5c01('0x5a')](_0x599b54)[_0x5c01('0x24')](function(_0x5c7b58){return[_0x5c7b58,!![]];});});}return db['ChatInteraction'][_0x5c01('0x5a')](_0x599b54)[_0x5c01('0x24')](function(_0x8de885){return[_0x8de885,!![]];});}})[_0x5c01('0xbf')](function(_0x26e13f,_0x38ae4b){if(_0x26e13f){_0x3df24c=_0x38ae4b;if(!_0x38ae4b){var _0x56696d={'from':(_0x55f058['contact']['firstName']||'')+'\x20'+(_0x55f058[_0x5c01('0xa8')]['lastName']||'')};if(_0x4ad511['body'][_0x5c01('0xba')]&&_0x4ad511[_0x5c01('0x5b')][_0x5c01('0xc0')]&&_0x4ad511[_0x5c01('0x5b')][_0x5c01('0xba')]!=_0x4ad511['body'][_0x5c01('0xc0')]){_0x56696d[_0x5c01('0xba')]=_0x4ad511[_0x5c01('0x5b')][_0x5c01('0xc0')];}return _0x26e13f[_0x5c01('0x62')](_0x56696d);}else{return _0x26e13f;}}})[_0x5c01('0x24')](function(_0x2c0a57){_0x55f058[_0x5c01('0xbe')]=_0x2c0a57['get']({'plain':!![]});_0x55f058[_0x5c01('0xbe')][_0x5c01('0xc1')]=_0x3df24c;if(_0x55f058[_0x5c01('0xbe')][_0x5c01('0xc1')]){if(_0x55f058['account'][_0x5c01('0xc2')]){_0x55f058[_0x5c01('0xa2')][_0x5c01('0xc3')]({'id':0x0,'priority':_0x55f058['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x5c01('0xc4')});}}return db[_0x5c01('0xc5')][_0x5c01('0x5a')]({'body':_0x4ad511[_0x5c01('0x5b')][_0x5c01('0x5b')],'ChatWebsiteId':_0x4ad511[_0x5c01('0x57')]['id'],'ChatInteractionId':_0x2c0a57['id'],'direction':'in','ContactId':_0x55f058[_0x5c01('0xa8')]['id'],'AttachmentId':_0x4ad511[_0x5c01('0x5b')][_0x5c01('0xc6')]});})['then'](function(_0x29f4f2){_0x55f058[_0x5c01('0x29')]=_0x29f4f2;if(_0x55f058[_0x5c01('0xbe')][_0x5c01('0xc7')]){return db[_0x5c01('0xc8')][_0x5c01('0x59')]({'attributes':['id','name'],'where':{'id':_0x55f058[_0x5c01('0xbe')]['UserId']}})[_0x5c01('0x24')](function(_0x56851a){if(_0x56851a){_0x55f058[_0x5c01('0xa2')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5c01('0xc9'),'appdata':_0x56851a['name']+','+(_0x55f058[_0x5c01('0xa1')]['waitForTheAssignedAgent']||0xa),'interval':_0x5c01('0xc4')});_0x55f058[_0x5c01('0xca')]=!![];}return respondWithRpcPromise(_0x5c01('0xcb'),_0x5c01('0xcc'),_0x55f058);});}return respondWithRpcPromise(_0x5c01('0xcb'),_0x5c01('0xcc'),_0x55f058);})['then'](function(_0x4c6b27){respondWithRpcPromise(_0x5c01('0xcd'),_0x5c01('0xcd'),{'event':'notify','message':_0x4c6b27},client9002);return _0x4c6b27;})[_0x5c01('0x24')](respondWithResult(_0xf5ca24,null))[_0x5c01('0x2a')](handleError(_0xf5ca24,null));};exports[_0x5c01('0xce')]=function(_0xd3fac5,_0x3d7903,_0x2b1f72){var _0x30779d,_0x12a7d8,_0x31646d;var _0x4a4741=[];var _0x163ca0=[];var _0x1bba33={};return db[_0x5c01('0x90')][_0x5c01('0x64')]()[_0x5c01('0x24')](function(_0x41c52d){if(!_0x41c52d){throw new db['Sequelize']['ValidationError'](_0x5c01('0xcf'));}_0x163ca0=_[_0x5c01('0x93')](_[_0x5c01('0x43')](_0x41c52d),[_0x5c01('0x94'),_0x5c01('0x95')]);_0x4a4741=_[_0x5c01('0x93')](_[_0x5c01('0x43')](_0x41c52d),[_0x5c01('0x94'),_0x5c01('0x95'),_0x5c01('0x96'),'ListId']);if(_0xd3fac5[_0x5c01('0x5b')]['id']){delete _0xd3fac5[_0x5c01('0x5b')]['id'];}if(_[_0x5c01('0x7e')](_0xd3fac5[_0x5c01('0x5b')][_0x5c01('0x98')])){throw _0x3d7903[_0x5c01('0x2d')](0x1f4)[_0x5c01('0x3a')](new db['Sequelize'][(_0x5c01('0x92'))]('from\x20is\x20mandatory'));}if(_[_0x5c01('0x7e')](_0xd3fac5[_0x5c01('0x5b')]['body'])||_0xd3fac5[_0x5c01('0x5b')]['body']===''){throw _0x3d7903[_0x5c01('0x2d')](0x1f4)[_0x5c01('0x3a')](new db[(_0x5c01('0x91'))][(_0x5c01('0x92'))](_0x5c01('0x99')));}if(_['isNil'](_0xd3fac5['body'][_0x5c01('0xd0')])){throw _0x3d7903[_0x5c01('0x2d')](0x1f4)[_0x5c01('0x3a')](new db['Sequelize'][(_0x5c01('0x92'))](_0x5c01('0xd1')+_0x4a4741));}if(!_[_0x5c01('0x9c')](_0x4a4741,_0xd3fac5[_0x5c01('0x5b')][_0x5c01('0xd0')])){throw _0x3d7903['status'](0x1f4)[_0x5c01('0x3a')](new db[(_0x5c01('0x91'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4a4741));}_0x1bba33[_0xd3fac5[_0x5c01('0x5b')][_0x5c01('0xd0')]]=_0xd3fac5[_0x5c01('0x5b')][_0x5c01('0x98')];})[_0x5c01('0x24')](function(){return db[_0x5c01('0x3c')]['find']({'where':{'id':_0xd3fac5[_0x5c01('0x57')]['id']},'include':[{'model':db[_0x5c01('0x9e')],'as':'List'}]});})['then'](handleEntityNotFound(_0x3d7903,null))['then'](function(_0x17f484){if(_0x17f484&&_0x17f484[_0x5c01('0xa0')]){_0x12a7d8=_0x17f484;var _0x20802c=_['defaults'](_0xd3fac5[_0x5c01('0x5b')],{'firstName':_0xd3fac5['body'][_0x5c01('0x98')],'phone':_0xd3fac5[_0x5c01('0x5b')][_0x5c01('0x98')],'ListId':_0x17f484['ListId']});_0x20802c[_0xd3fac5[_0x5c01('0x5b')]['mapKeyOffline']]=_0xd3fac5[_0x5c01('0x5b')]['from'];return db[_0x5c01('0x90')][_0x5c01('0xd2')]({'where':_0x1bba33,'defaults':_0x20802c});}})[_0x5c01('0xbf')](function(_0x11c938){if(_0x11c938){_0x31646d=_0x11c938;var _0x377cd8=fs[_0x5c01('0xd3')](path[_0x5c01('0x79')](config[_0x5c01('0x80')],_0x5c01('0xd4')),'utf8');var _0x4b1a76=ejs['render'](_0x377cd8,{'body':_[_0x5c01('0xd5')](_0xd3fac5[_0x5c01('0x5b')][_0x5c01('0x5b')]),'bodyTitle':_0x12a7d8[_0x5c01('0xd6')]});return db['ChatOfflineMessage'][_0x5c01('0x5a')]({'body':_0x4b1a76,'ContactId':_0x11c938['id'],'ChatWebsiteId':_0x12a7d8['id']});}})[_0x5c01('0x24')](function(_0x136336){if(_0x136336){_0x30779d=_0x136336;return db[_0x5c01('0xd7')][_0x5c01('0x69')]({'where':{'service':!![]},'include':[{'model':db[_0x5c01('0xd8')],'as':_0x5c01('0xd9'),'raw':!![]}]});}})['then'](function(_0x1b260a){if(_0x1b260a&&_0x1b260a[_0x5c01('0xd9')]&&_0x12a7d8[_0x5c01('0xda')]){var _0x45abcf={'tls':{'rejectUnauthorized':![]}};if(_0x1b260a[_0x5c01('0xd9')][_0x5c01('0xdb')]){_0x45abcf['service']=_0x1b260a[_0x5c01('0xd9')]['service'];}else{_0x45abcf[_0x5c01('0xdc')]=_0x1b260a[_0x5c01('0xd9')][_0x5c01('0xdc')];_0x45abcf[_0x5c01('0xdd')]=_0x1b260a[_0x5c01('0xd9')][_0x5c01('0xdd')];_0x45abcf[_0x5c01('0xde')]=_0x1b260a[_0x5c01('0xd9')][_0x5c01('0xde')];}if(_0x1b260a[_0x5c01('0xd9')]['authentication']){_0x45abcf[_0x5c01('0xdf')]={'user':_0x1b260a[_0x5c01('0xd9')][_0x5c01('0x5c')],'pass':_0x1b260a[_0x5c01('0xd9')]['pass']};}return respondWithRpcPromise(_0x5c01('0xe0'),'sendMail',{'account':_0x45abcf,'message':{'from':util[_0x5c01('0xb3')]('\x22%s\x22\x20<%s>',_0x1b260a[_0x5c01('0x39')],_0x1b260a[_0x5c01('0xe1')]||_0x1b260a[_0x5c01('0xd9')][_0x5c01('0x5c')]),'to':_0x12a7d8[_0x5c01('0xda')],'subject':_0x12a7d8[_0x5c01('0xe2')],'text':_0x30779d[_0x5c01('0x5b')]}},client9003)[_0x5c01('0x24')](function(){return _0x30779d;})[_0x5c01('0x2a')](function(_0x5306cf){console[_0x5c01('0x28')](_0x5306cf);});}})[_0x5c01('0x24')](function(){if(_0x30779d){return _0x30779d;}})[_0x5c01('0x24')](respondWithResult(_0x3d7903,null))['catch'](handleError(_0x3d7903,null));};exports[_0x5c01('0xe3')]=function(_0x370744,_0x26e0b2,_0x191dfe){return db['ChatInteraction'][_0x5c01('0x59')]({'where':{'id':_0x370744[_0x5c01('0x57')]['id']}})[_0x5c01('0x24')](handleEntityNotFound(_0x26e0b2,null))[_0x5c01('0x24')](function(_0x1bf527){if(_0x1bf527){return _0x1bf527[_0x5c01('0xe3')](_0x370744['body']['ids'],_[_0x5c01('0xe4')](_0x370744[_0x5c01('0x5b')],[_0x5c01('0x71'),'id'])||{});}})[_0x5c01('0x24')](respondWithResult(_0x26e0b2,null))[_0x5c01('0x2a')](handleError(_0x26e0b2,null));};exports['getInteractions']=function(_0x34e1c8,_0x44a36d,_0x543678){var _0x5ad062={'raw':![],'where':{}};var _0xac8566={};var _0x4dbcb2={'count':0x0,'rows':[]};return db[_0x5c01('0x3c')]['findOne']({'where':{'id':_0x34e1c8[_0x5c01('0x57')]['id']}})[_0x5c01('0x24')](handleEntityNotFound(_0x44a36d,null))[_0x5c01('0x24')](function(_0x5abd74){if(_0x5abd74){_0xac8566[_0x5c01('0x40')]=_[_0x5c01('0x43')](db[_0x5c01('0xbb')][_0x5c01('0x3d')]);_0xac8566[_0x5c01('0x42')]=_[_0x5c01('0x43')](_0x34e1c8[_0x5c01('0x42')]);_0xac8566[_0x5c01('0x44')]=_[_0x5c01('0x45')](_0xac8566[_0x5c01('0x40')],_0xac8566['query']);_0x5ad062[_0x5c01('0x47')]=_[_0x5c01('0x45')](_0xac8566[_0x5c01('0x40')],qs[_0x5c01('0x46')](_0x34e1c8[_0x5c01('0x42')]['fields']));_0x5ad062[_0x5c01('0x47')]=_0x5ad062[_0x5c01('0x47')][_0x5c01('0x48')]?_0x5ad062['attributes']:_0xac8566[_0x5c01('0x40')];if(!_0x34e1c8[_0x5c01('0x42')]['hasOwnProperty'](_0x5c01('0x6a'))){_0x5ad062['limit']=qs['limit'](_0x34e1c8[_0x5c01('0x42')][_0x5c01('0x2f')]);_0x5ad062[_0x5c01('0x2e')]=qs[_0x5c01('0x2e')](_0x34e1c8[_0x5c01('0x42')][_0x5c01('0x2e')]);}_0x5ad062[_0x5c01('0x4a')]=qs[_0x5c01('0x4b')](_0x34e1c8[_0x5c01('0x42')][_0x5c01('0x4b')]);_0x5ad062['where']=qs[_0x5c01('0x44')](_[_0x5c01('0x4d')](_0x34e1c8['query'],_0xac8566[_0x5c01('0x44')]));_0x5ad062[_0x5c01('0x4c')][_0x5c01('0x66')]=_0x5abd74['id'];if(_0x34e1c8[_0x5c01('0x42')][_0x5c01('0x4e')]){_0x5ad062[_0x5c01('0x4c')]=_['merge'](_0x5ad062['where'],{'$or':_[_0x5c01('0x41')](_0x5ad062['attributes'],function(_0x30aa5f){var _0x5812b5={};_0x5812b5[_0x30aa5f]={'$like':'%'+_0x34e1c8[_0x5c01('0x42')][_0x5c01('0x4e')]+'%'};return _0x5812b5;})});}_0x5ad062=_[_0x5c01('0x4f')]({},_0x5ad062,_0x34e1c8['options']);return db['ChatInteraction'][_0x5c01('0x53')]({'where':_0x5ad062[_0x5c01('0x4c')]})[_0x5c01('0x24')](function(_0x22373f){_0x4dbcb2[_0x5c01('0x53')]=_0x22373f;if(_0x34e1c8[_0x5c01('0x42')][_0x5c01('0x58')]){_0x5ad062[_0x5c01('0x54')]=[{'model':db[_0x5c01('0x90')],'as':_0x5c01('0xe5'),'required':![]},{'model':db[_0x5c01('0xc8')],'as':_0x5c01('0xe6'),'attributes':['name',_0x5c01('0xe7'),_0x5c01('0xe8')],'required':![]},{'model':db[_0x5c01('0xe9')],'as':_0x5c01('0xea'),'attributes':['id','name',_0x5c01('0xeb')],'where':_0x34e1c8[_0x5c01('0x42')]['tag']?{'id':_0x34e1c8[_0x5c01('0x42')]['tag']}:undefined,'required':_0x34e1c8['query'][_0x5c01('0xec')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x5ad062);})[_0x5c01('0x24')](function(_0x4bd93b){_0x4dbcb2[_0x5c01('0x6b')]=_0x4bd93b;return _0x4dbcb2;});}})['then'](respondWithFilteredResult(_0x44a36d,_0x5ad062))[_0x5c01('0x2a')](handleError(_0x44a36d,null));};function iftimePromise(_0x1147d7,_0x1e37cf){return respondWithRpcPromise('Command','getSnippet',{'command':_0x1e37cf[_0x5c01('0xed')]?util['format']('iftime\x20%s,%s',_0x1147d7[_0x5c01('0xee')],_0x1e37cf[_0x5c01('0xed')]):util[_0x5c01('0xb3')]('iftime\x20%s',_0x1147d7[_0x5c01('0xee')])},client9002)[_0x5c01('0x24')](function(_0x3476e8){var _0x43e02b=_0x3476e8&&_0x3476e8[_0x5c01('0xef')]('true')>=0x0?!![]:![];logger[_0x5c01('0xf0')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1e37cf['id'],_0x1147d7['id'],_0x1147d7[_0x5c01('0xee')],_0x43e02b?_0x5c01('0xf1'):_0x5c01('0xf2'),_0x1e37cf[_0x5c01('0xed')]?_0x1e37cf[_0x5c01('0xed')]:'No\x20timezone');return _0x43e02b;})['catch'](function(_0x31b072){logger[_0x5c01('0x28')](_0x5c01('0xf3'),_0x1e37cf['id'],_0x1147d7['id'],_0x1147d7[_0x5c01('0xee')],util[_0x5c01('0xf4')](_0x31b072,{'showHidden':![],'depth':null}),_0x1e37cf[_0x5c01('0xed')]?_0x1e37cf['timezone']:_0x5c01('0xf5'));return![];});}exports['getSnippet']=function(_0x1f5274,_0x1d4304,_0x4bcbfc){var _0x3a463d=0x0;var _0x57455d=0x0;var _0x2e1466=![];var _0xa6747f;var _0x5a468c;return db[_0x5c01('0x3c')]['find']({'where':{'id':_0x1f5274[_0x5c01('0x57')]['id']},'include':[{'model':db[_0x5c01('0xf6')],'as':_0x5c01('0xf6'),'include':[{'model':db[_0x5c01('0xf6')],'as':_0x5c01('0xf7'),'attributes':['id',_0x5c01('0xee')],'raw':!![]}]}]})[_0x5c01('0x24')](handleEntityNotFound(_0x1d4304,null))[_0x5c01('0x24')](function(_0x3ed837){if(_0x3ed837){_0xa6747f=_0x3ed837;return _0x3ed837[_0x5c01('0xf8')]({'raw':!![]});}})[_0x5c01('0x24')](function(_0xb8d61c){if(_0xa6747f){if(_0xb8d61c){_0x5a468c=_0xb8d61c;}}return require(_0x5c01('0x19'))['getLicense']();})[_0x5c01('0x24')](function(_0x1cc5a1){if(_0x1cc5a1){_0x57455d=_0x1cc5a1[_0x5c01('0xf9')];_0x2e1466=_0x1cc5a1[_0x5c01('0x7d')];}})[_0x5c01('0x24')](function(){return db[_0x5c01('0xbb')][_0x5c01('0x53')]({'where':{'closed':![]}});})['then'](function(_0x41af53){_0x3a463d=_0x41af53;if(_0x57455d&&_0x41af53>_0x57455d){return db[_0x5c01('0xfa')][_0x5c01('0x69')]({'where':{'id':0x1}})[_0x5c01('0x24')](function(_0x22c680){if(_0x22c680){_0x22c680[_0x5c01('0xfb')](_0x5c01('0xfc'));}});}})[_0x5c01('0x24')](function(){if(_0xa6747f['Interval']&&_0xa6747f[_0x5c01('0xf6')][_0x5c01('0xf7')]){var _0x27c9a4=[];for(var _0x3b220e=0x0;_0x3b220e<_0xa6747f[_0x5c01('0xf6')][_0x5c01('0xf7')][_0x5c01('0x48')];_0x3b220e++){var _0x347261=_0xa6747f[_0x5c01('0xf6')][_0x5c01('0xf7')][_0x3b220e][_0x5c01('0x35')]({'plain':!![]});_0x27c9a4[_0x5c01('0xc3')](iftimePromise(_0x347261,_0xa6747f));}return BPromise[_0x5c01('0xfd')](_0x27c9a4)[_0x5c01('0x24')](function(_0x4db4dc){return _[_0x5c01('0xfe')](_0x4db4dc);});}else{return!![];}})['then'](function(_0x13769e){var _0x337965=fs[_0x5c01('0xd3')](path[_0x5c01('0x79')](config['root'],_0x5c01('0xff')),'utf8');var _0x491438={'remote':_0xa6747f['remote'],'query':querystring[_0x5c01('0x27')](_[_0x5c01('0x4f')](_0xa6747f[_0x5c01('0x35')]({'plain':!![]}),{'customerIp':_0x1f5274[_0x5c01('0xa9')][_0x5c01('0xac')]||_0x1f5274[_0x5c01('0xa9')][_0x5c01('0x100')]||_0x1f5274[_0x5c01('0x101')][_0x5c01('0x102')]||_0x1f5274['ip'],'referer':_0x1f5274[_0x5c01('0xa9')][_0x5c01('0xb1')],'openedInteractions':_0x3a463d,'maxInteractions':_0x57455d,'virtual':_0x2e1466[_0x5c01('0xf9')],'online':_0x13769e,'custom':_0x2e1466}))[_0x5c01('0x103')](/'/g,'\x5c\x27')};_0x1d4304[_0x5c01('0x3a')](ejs[_0x5c01('0x104')](Mustache[_0x5c01('0x104')](_0x337965,_0x491438),{'proactiveActions':_0x5a468c,'alignment':_0xa6747f[_0x5c01('0x105')],'verticalAlignment':_0xa6747f[_0x5c01('0x106')],'div_color':_0xa6747f[_0x5c01('0xeb')],'text_color':_0xa6747f[_0x5c01('0x107')]}));})[_0x5c01('0x2a')](handleError(_0x1d4304,null));};exports[_0x5c01('0x108')]=function(_0x5cd81d,_0x4f09a7,_0x3c5229){return db[_0x5c01('0x3c')]['findOne']({'where':{'id':_0x5cd81d[_0x5c01('0x57')]['id']}})[_0x5c01('0x24')](handleEntityNotFound(_0x4f09a7,null))[_0x5c01('0x24')](function(_0x2e8bde){if(_0x2e8bde){return db[_0x5c01('0x109')][_0x5c01('0x10a')](function(_0x1ad6c8){return db[_0x5c01('0x9f')][_0x5c01('0x37')]({'where':{'ChatWebsiteId':_0x5cd81d[_0x5c01('0x57')]['id']},'transaction':_0x1ad6c8})['then'](function(_0x291547){var _0x364b6c=_[_0x5c01('0x41')](_0x5cd81d[_0x5c01('0x5b')],function(_0x5c57d4){_0x5c57d4[_0x5c01('0x66')]=_0x5cd81d[_0x5c01('0x57')]['id'];return _0x5c57d4;});return db[_0x5c01('0x9f')][_0x5c01('0x10b')](_0x364b6c,{'transaction':_0x1ad6c8});});})[_0x5c01('0x24')](function(){return db[_0x5c01('0x9f')][_0x5c01('0x10c')]({'where':{'ChatWebsiteId':_0x5cd81d[_0x5c01('0x57')]['id']},'order':_0x5c01('0x10d')});});}})[_0x5c01('0x24')](respondWithResult(_0x4f09a7,null))['catch'](handleError(_0x4f09a7,null));};exports[_0x5c01('0x10e')]=function(_0x525f2e,_0x1356f5,_0x32cdf2){var _0x8720a1={};var _0x588979={};var _0x32dd56;var _0x249dab;return db['ChatWebsite']['findOne']({'where':{'id':_0x525f2e[_0x5c01('0x57')]['id']}})[_0x5c01('0x24')](handleEntityNotFound(_0x1356f5,null))['then'](function(_0x2b44ba){if(_0x2b44ba){_0x32dd56=_0x2b44ba;_0x588979['model']=_[_0x5c01('0x43')](db[_0x5c01('0x9f')][_0x5c01('0x3d')]);_0x588979[_0x5c01('0x42')]=_[_0x5c01('0x43')](_0x525f2e[_0x5c01('0x42')]);_0x588979[_0x5c01('0x44')]=_['intersection'](_0x588979['model'],_0x588979[_0x5c01('0x42')]);_0x8720a1[_0x5c01('0x47')]=_['intersection'](_0x588979['model'],qs['fields'](_0x525f2e[_0x5c01('0x42')][_0x5c01('0x46')]));_0x8720a1[_0x5c01('0x47')]=_0x8720a1[_0x5c01('0x47')][_0x5c01('0x48')]?_0x8720a1[_0x5c01('0x47')]:_0x588979[_0x5c01('0x40')];_0x8720a1[_0x5c01('0x4a')]=qs[_0x5c01('0x4b')](_0x525f2e[_0x5c01('0x42')][_0x5c01('0x4b')]);_0x8720a1[_0x5c01('0x4c')]=qs['filters'](_[_0x5c01('0x4d')](_0x525f2e[_0x5c01('0x42')],_0x588979[_0x5c01('0x44')]));if(_0x525f2e[_0x5c01('0x42')][_0x5c01('0x4e')]){_0x8720a1[_0x5c01('0x4c')]=_[_0x5c01('0x4f')](_0x8720a1[_0x5c01('0x4c')],{'$or':_[_0x5c01('0x41')](_0x8720a1['attributes'],function(_0x5a522c){var _0x4d3b21={};_0x4d3b21[_0x5a522c]={'$like':'%'+_0x525f2e[_0x5c01('0x42')][_0x5c01('0x4e')]+'%'};return _0x4d3b21;})});}_0x8720a1=_['merge']({},_0x8720a1,_0x525f2e['options']);return _0x32dd56[_0x5c01('0x10e')](_0x8720a1);}})[_0x5c01('0x24')](function(_0xfc97e6){if(_0xfc97e6){_0x249dab=_0xfc97e6['length'];if(!_0x525f2e[_0x5c01('0x42')]['hasOwnProperty'](_0x5c01('0x6a'))){_0x8720a1[_0x5c01('0x2f')]=qs[_0x5c01('0x2f')](_0x525f2e[_0x5c01('0x42')][_0x5c01('0x2f')]);_0x8720a1[_0x5c01('0x2e')]=qs[_0x5c01('0x2e')](_0x525f2e[_0x5c01('0x42')][_0x5c01('0x2e')]);}return _0x32dd56[_0x5c01('0x10e')](_0x8720a1);}})['then'](function(_0x4b31ae){if(_0x4b31ae){return _0x4b31ae?{'count':_0x249dab,'rows':_0x4b31ae}:null;}})['then'](respondWithResult(_0x1356f5,null))['catch'](handleError(_0x1356f5,null));};exports['addProactiveActions']=function(_0x106cad,_0x35b21c,_0x343597){return db['chatProactiveAction']['find']({'where':{'id':_0x106cad[_0x5c01('0x57')]['id']}})[_0x5c01('0x24')](handleEntityNotFound(_0x35b21c,null))[_0x5c01('0x24')](function(_0x35764e){if(_0x35764e){return _0x35764e['addProactiveActions'](_0x106cad[_0x5c01('0x5b')][_0x5c01('0x71')],_['omit'](_0x106cad[_0x5c01('0x5b')],[_0x5c01('0x71'),'id'])||{});}})['then'](respondWithResult(_0x35b21c,null))[_0x5c01('0x2a')](handleError(_0x35b21c,null));};exports[_0x5c01('0xf8')]=function(_0x3fe3ba,_0x2673fe,_0x310370){var _0x58b717={};var _0x5d2c4b={};var _0x32a8eb;var _0x16d782;return db[_0x5c01('0x3c')][_0x5c01('0x69')]({'where':{'id':_0x3fe3ba['params']['id']}})['then'](handleEntityNotFound(_0x2673fe,null))[_0x5c01('0x24')](function(_0x3c5842){if(_0x3c5842){_0x32a8eb=_0x3c5842;_0x5d2c4b['model']=_[_0x5c01('0x43')](db[_0x5c01('0x10f')][_0x5c01('0x3d')]);_0x5d2c4b['query']=_[_0x5c01('0x43')](_0x3fe3ba[_0x5c01('0x42')]);_0x5d2c4b[_0x5c01('0x44')]=_[_0x5c01('0x45')](_0x5d2c4b[_0x5c01('0x40')],_0x5d2c4b[_0x5c01('0x42')]);_0x58b717[_0x5c01('0x47')]=_[_0x5c01('0x45')](_0x5d2c4b[_0x5c01('0x40')],qs[_0x5c01('0x46')](_0x3fe3ba['query'][_0x5c01('0x46')]));_0x58b717[_0x5c01('0x47')]=_0x58b717[_0x5c01('0x47')][_0x5c01('0x48')]?_0x58b717[_0x5c01('0x47')]:_0x5d2c4b[_0x5c01('0x40')];_0x58b717[_0x5c01('0x4a')]=qs['sort'](_0x3fe3ba[_0x5c01('0x42')][_0x5c01('0x4b')]);_0x58b717[_0x5c01('0x4c')]=qs[_0x5c01('0x44')](_['pick'](_0x3fe3ba[_0x5c01('0x42')],_0x5d2c4b['filters']));if(_0x3fe3ba[_0x5c01('0x42')][_0x5c01('0x4e')]){_0x58b717[_0x5c01('0x4c')]=_[_0x5c01('0x4f')](_0x58b717['where'],{'$or':_[_0x5c01('0x41')](_0x58b717['attributes'],function(_0x2824a5){var _0x35bf9f={};_0x35bf9f[_0x2824a5]={'$like':'%'+_0x3fe3ba[_0x5c01('0x42')]['filter']+'%'};return _0x35bf9f;})});}_0x58b717=_['merge']({},_0x58b717,_0x3fe3ba[_0x5c01('0x52')]);return _0x32a8eb[_0x5c01('0xf8')](_0x58b717);}})[_0x5c01('0x24')](function(_0x5394cd){if(_0x5394cd){_0x16d782=_0x5394cd['length'];if(!_0x3fe3ba[_0x5c01('0x42')][_0x5c01('0x49')](_0x5c01('0x6a'))){_0x58b717['limit']=qs[_0x5c01('0x2f')](_0x3fe3ba['query'][_0x5c01('0x2f')]);_0x58b717[_0x5c01('0x2e')]=qs[_0x5c01('0x2e')](_0x3fe3ba[_0x5c01('0x42')]['offset']);}return _0x32a8eb[_0x5c01('0xf8')](_0x58b717);}})[_0x5c01('0x24')](function(_0x230f27){if(_0x230f27){return _0x230f27?{'count':_0x16d782,'rows':_0x230f27}:null;}})[_0x5c01('0x24')](respondWithResult(_0x2673fe,null))[_0x5c01('0x2a')](handleError(_0x2673fe,null));};exports[_0x5c01('0x110')]=function(_0x3d1df8,_0xcd99ec,_0x4801ff){var _0x54d765=_0x3d1df8[_0x5c01('0x42')][_0x5c01('0x111')]===_0x5c01('0x112')?_0x5c01('0x113'):'onlineForm';return db[_0x5c01('0x3c')]['find']({'attributes':['id',_0x54d765],'where':{'id':_0x3d1df8[_0x5c01('0x57')]['id']}})[_0x5c01('0x24')](handleEntityNotFound(_0xcd99ec,null))['then'](function(_0x53c332){if(_0x53c332){var _0x13e2b4=_0x53c332[_0x54d765];var _0x59c58c=_0x13e2b4&&_0x13e2b4[_0x5c01('0x114')]?_0x13e2b4[_0x5c01('0x114')]:[];_0xcd99ec[_0x5c01('0x3a')]({'fromKey':_[_0x5c01('0x7e')](_0x13e2b4[_0x5c01('0x115')])?undefined:_0x13e2b4['fromKey'],'count':_0x59c58c[_0x5c01('0x48')],'rows':_0x59c58c});}})[_0x5c01('0x2a')](handleError(_0xcd99ec,null));};exports['getOfflineMessages']=function(_0x4e5fde,_0x1feb68,_0x3d4874){var _0x595b46={'raw':![],'where':{}};var _0x5df2bb={};var _0x5e55ce={'count':0x0,'rows':[]};return db[_0x5c01('0x3c')][_0x5c01('0x69')]({'where':{'id':_0x4e5fde[_0x5c01('0x57')]['id']}})['then'](handleEntityNotFound(_0x1feb68,null))['then'](function(_0x59dc1a){if(_0x59dc1a){_0x5df2bb[_0x5c01('0x40')]=_[_0x5c01('0x43')](db[_0x5c01('0x116')]['rawAttributes']);_0x5df2bb['query']=_[_0x5c01('0x43')](_0x4e5fde['query']);_0x5df2bb[_0x5c01('0x44')]=_['intersection'](_0x5df2bb[_0x5c01('0x40')],_0x5df2bb[_0x5c01('0x42')]);_0x595b46[_0x5c01('0x47')]=_[_0x5c01('0x45')](_0x5df2bb[_0x5c01('0x40')],qs[_0x5c01('0x46')](_0x4e5fde[_0x5c01('0x42')][_0x5c01('0x46')]));_0x595b46[_0x5c01('0x47')]=_0x595b46[_0x5c01('0x47')][_0x5c01('0x48')]?_0x595b46[_0x5c01('0x47')]:_0x5df2bb[_0x5c01('0x40')];if(!_0x4e5fde[_0x5c01('0x42')][_0x5c01('0x49')](_0x5c01('0x6a'))){_0x595b46[_0x5c01('0x2f')]=qs[_0x5c01('0x2f')](_0x4e5fde[_0x5c01('0x42')][_0x5c01('0x2f')]);_0x595b46['offset']=qs['offset'](_0x4e5fde['query'][_0x5c01('0x2e')]);}_0x595b46['order']=qs[_0x5c01('0x4b')](_0x4e5fde[_0x5c01('0x42')][_0x5c01('0x4b')]);_0x595b46[_0x5c01('0x4c')]=qs[_0x5c01('0x44')](_[_0x5c01('0x4d')](_0x4e5fde['query'],_0x5df2bb[_0x5c01('0x44')]));_0x595b46[_0x5c01('0x4c')]['ChatWebsiteId']=_0x59dc1a['id'];if(_0x4e5fde[_0x5c01('0x42')][_0x5c01('0x4e')]){_0x595b46[_0x5c01('0x4c')]=_['merge'](_0x595b46['where'],{'$or':_[_0x5c01('0x41')](_0x595b46[_0x5c01('0x47')],function(_0x1cb789){var _0x24144d={};_0x24144d[_0x1cb789]={'$like':'%'+_0x4e5fde[_0x5c01('0x42')][_0x5c01('0x4e')]+'%'};return _0x24144d;})});}_0x595b46=_[_0x5c01('0x4f')]({},_0x595b46,_0x4e5fde[_0x5c01('0x52')]);return db['ChatOfflineMessage'][_0x5c01('0x53')]({'where':_0x595b46['where']})[_0x5c01('0x24')](function(_0x5498f3){_0x5e55ce[_0x5c01('0x53')]=_0x5498f3;if(_0x4e5fde['query'][_0x5c01('0x58')]){_0x595b46['include']=[{'all':!![]}];}else{_0x595b46[_0x5c01('0x54')]=[{'model':db[_0x5c01('0x90')],'as':_0x5c01('0xe5'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x595b46);})[_0x5c01('0x24')](function(_0x1c5c4d){_0x5e55ce[_0x5c01('0x6b')]=_0x1c5c4d;return _0x5e55ce;});}})[_0x5c01('0x24')](respondWithFilteredResult(_0x1feb68,_0x595b46))[_0x5c01('0x2a')](handleError(_0x1feb68,null));};exports[_0x5c01('0x117')]=function(_0x49368b,_0x3f5e77,_0x3fb019){return db[_0x5c01('0x3c')][_0x5c01('0x59')]({'where':{'id':_0x49368b[_0x5c01('0x57')]['id']}})[_0x5c01('0x24')](handleEntityNotFound(_0x3f5e77,null))[_0x5c01('0x24')](function(_0xfa2f6c){if(_0xfa2f6c){return _0xfa2f6c[_0x5c01('0x117')](_0x49368b[_0x5c01('0x5b')][_0x5c01('0x71')],_[_0x5c01('0xe4')](_0x49368b[_0x5c01('0x5b')],['ids','id'])||{})['spread'](function(_0x15d99f){for(var _0x389ebf=0x0;_0x389ebf<_0x49368b[_0x5c01('0x5b')]['ids'][_0x5c01('0x48')];_0x389ebf+=0x1){socket[_0x5c01('0x118')](_0x5c01('0x119'),{'UserId':_0x49368b[_0x5c01('0x5b')][_0x5c01('0x71')][_0x389ebf],'ChatWebsiteId':_0x49368b['params']['id']});}return _0x15d99f;});}})[_0x5c01('0x24')](respondWithResult(_0x3f5e77,null))[_0x5c01('0x2a')](handleError(_0x3f5e77,null));};exports[_0x5c01('0x11a')]=function(_0x595d3c,_0x129180,_0xa29388){return db['ChatWebsite']['find']({'where':{'id':_0x595d3c[_0x5c01('0x57')]['id']}})['then'](handleEntityNotFound(_0x129180,null))[_0x5c01('0x24')](function(_0x502ede){if(_0x502ede){return _0x502ede[_0x5c01('0x11a')](_0x595d3c[_0x5c01('0x42')][_0x5c01('0x71')])[_0x5c01('0x24')](function(){if(_[_0x5c01('0x11b')](_0x595d3c[_0x5c01('0x42')]['ids'])){for(var _0x164c6a=0x0;_0x164c6a<_0x595d3c[_0x5c01('0x42')][_0x5c01('0x71')][_0x5c01('0x48')];_0x164c6a+=0x1){socket[_0x5c01('0x118')](_0x5c01('0x11c'),{'UserId':Number(_0x595d3c[_0x5c01('0x42')][_0x5c01('0x71')][_0x164c6a]),'ChatWebsiteId':Number(_0x595d3c[_0x5c01('0x57')]['id'])});}}else{socket[_0x5c01('0x118')](_0x5c01('0x11c'),{'UserId':Number(_0x595d3c[_0x5c01('0x42')][_0x5c01('0x71')]),'ChatWebsiteId':Number(_0x595d3c[_0x5c01('0x57')]['id'])});}});}})[_0x5c01('0x24')](respondWithStatusCode(_0x129180,null))['catch'](handleError(_0x129180,null));};exports['getAgents']=function(_0x878fba,_0x4393a8,_0x32f1fa){var _0x53268d={};var _0x363542={};var _0x34113b;var _0x384f9e;return db[_0x5c01('0x3c')][_0x5c01('0x69')]({'where':{'id':_0x878fba[_0x5c01('0x57')]['id']}})[_0x5c01('0x24')](handleEntityNotFound(_0x4393a8,null))[_0x5c01('0x24')](function(_0x5c2cd5){if(_0x5c2cd5){_0x34113b=_0x5c2cd5;_0x363542['model']=_[_0x5c01('0x43')](db[_0x5c01('0xc8')][_0x5c01('0x3d')]);_0x363542[_0x5c01('0x42')]=_[_0x5c01('0x43')](_0x878fba[_0x5c01('0x42')]);_0x363542[_0x5c01('0x44')]=_[_0x5c01('0x45')](_0x363542['model'],_0x363542[_0x5c01('0x42')]);_0x53268d[_0x5c01('0x47')]=_['intersection'](_0x363542[_0x5c01('0x40')],qs[_0x5c01('0x46')](_0x878fba[_0x5c01('0x42')][_0x5c01('0x46')]));_0x53268d[_0x5c01('0x47')]=_0x53268d[_0x5c01('0x47')][_0x5c01('0x48')]?_0x53268d[_0x5c01('0x47')]:_0x363542[_0x5c01('0x40')];_0x53268d[_0x5c01('0x4a')]=qs[_0x5c01('0x4b')](_0x878fba[_0x5c01('0x42')][_0x5c01('0x4b')]);_0x53268d[_0x5c01('0x4c')]=qs['filters'](_[_0x5c01('0x4d')](_0x878fba['query'],_0x363542[_0x5c01('0x44')]));if(_0x878fba['query'][_0x5c01('0x4e')]){_0x53268d[_0x5c01('0x4c')]=_['merge'](_0x53268d[_0x5c01('0x4c')],{'$or':_[_0x5c01('0x41')](_0x53268d[_0x5c01('0x47')],function(_0xd273ef){var _0x4107b7={};_0x4107b7[_0xd273ef]={'$like':'%'+_0x878fba['query'][_0x5c01('0x4e')]+'%'};return _0x4107b7;})});}_0x53268d=_[_0x5c01('0x4f')]({},_0x53268d,_0x878fba['options']);return _0x34113b['getAgents'](_0x53268d);}})[_0x5c01('0x24')](function(_0x3ac500){if(_0x3ac500){_0x384f9e=_0x3ac500[_0x5c01('0x48')];if(!_0x878fba[_0x5c01('0x42')][_0x5c01('0x49')](_0x5c01('0x6a'))){_0x53268d[_0x5c01('0x2f')]=qs[_0x5c01('0x2f')](_0x878fba[_0x5c01('0x42')][_0x5c01('0x2f')]);_0x53268d[_0x5c01('0x2e')]=qs['offset'](_0x878fba[_0x5c01('0x42')][_0x5c01('0x2e')]);}return _0x34113b[_0x5c01('0x11d')](_0x53268d);}})[_0x5c01('0x24')](function(_0x2d0a39){if(_0x2d0a39){return _0x2d0a39?{'count':_0x384f9e,'rows':_0x2d0a39}:null;}})[_0x5c01('0x24')](respondWithResult(_0x4393a8,null))[_0x5c01('0x2a')](handleError(_0x4393a8,null));}; \ No newline at end of file +var _0x6ad8=['mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','CmContact','ChatApplication','account','Applications','list','applications','orderBy','priority','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','UserId','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','omit','getInteractions','Contact','User','Owner','fullname','internal','color','tag','getSnippet','timezone','interval','iftime\x20%s','ONLINE','OFFLINE','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','License','increment','chatLicenseExceeded','some','remote','x-real-ip','connection','replace','render','alignment','verticalAlignment','textColor','addApplications','sequelize','bulkCreate','getApplications','addProactiveActions','getFields','online','offlineForm','onlineForm','items','fromKey','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','UserProfileResource','end','stack','name','send','index','Pause','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','ChatWebsite','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','keys','find','create','body','user','get','role','ChatWebsites','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','addLogo','filename','addAvatar','file','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','headers','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey'];(function(_0x52a145,_0x6e566b){var _0x162422=function(_0x57b7af){while(--_0x57b7af){_0x52a145['push'](_0x52a145['shift']());}};_0x162422(++_0x6e566b);}(_0x6ad8,0x19e));var _0x86ad=function(_0x4b02f7,_0x48cf70){_0x4b02f7=_0x4b02f7-0x0;var _0x251219=_0x6ad8[_0x4b02f7];return _0x251219;};'use strict';var pdf=require(_0x86ad('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x86ad('0x1'));var zipdir=require(_0x86ad('0x2'));var jsonpatch=require(_0x86ad('0x3'));var rp=require(_0x86ad('0x4'));var moment=require(_0x86ad('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x86ad('0x6'));var util=require(_0x86ad('0x7'));var path=require(_0x86ad('0x8'));var sox=require(_0x86ad('0x9'));var csv=require(_0x86ad('0xa'));var ejs=require(_0x86ad('0xb'));var fs=require('fs');var _=require(_0x86ad('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x86ad('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x86ad('0xa'));var querystring=require(_0x86ad('0xe'));var Papa=require(_0x86ad('0xf'));var Redis=require(_0x86ad('0x10'));var authService=require(_0x86ad('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x86ad('0x12'));var hardwareService=require(_0x86ad('0x13'));var logger=require(_0x86ad('0x14'))(_0x86ad('0x15'));var utils=require(_0x86ad('0x16'));var config=require(_0x86ad('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x86ad('0x18'))['db'];config[_0x86ad('0x19')]=_[_0x86ad('0x1a')](config[_0x86ad('0x19')],{'host':_0x86ad('0x1b'),'port':0x18eb});var socket=require(_0x86ad('0x1c'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x86ad('0x1d')](socket);var jayson=require(_0x86ad('0x1e'));var client=jayson[_0x86ad('0x1f')][_0x86ad('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0x86ad('0x1f')][_0x86ad('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x40fc76,_0xf267c0,_0x147341,_0x665866){return new BPromise(function(_0x118686,_0x1801f2){var _0x1267d4=_0x665866||client;return _0x1267d4['request'](_0x40fc76,_0x147341)[_0x86ad('0x21')](function(_0x5948a6){logger['info'](_0x86ad('0x22'),_0xf267c0,'request\x20sent');logger[_0x86ad('0x23')](_0x86ad('0x24'),_0xf267c0,_0x86ad('0x25'),JSON[_0x86ad('0x26')](_0x5948a6));if(_0x5948a6[_0x86ad('0x27')]){if(_0x5948a6['error'][_0x86ad('0x28')]===0x1f4){logger[_0x86ad('0x27')](_0x86ad('0x22'),_0xf267c0,_0x5948a6[_0x86ad('0x27')][_0x86ad('0x29')]);return _0x1801f2(_0x5948a6[_0x86ad('0x27')][_0x86ad('0x29')]);}logger[_0x86ad('0x27')](_0x86ad('0x22'),_0xf267c0,_0x5948a6['error'][_0x86ad('0x29')]);return _0x118686(_0x5948a6[_0x86ad('0x27')]['message']);}else{logger[_0x86ad('0x2a')](_0x86ad('0x22'),_0xf267c0,'request\x20sent');_0x118686(_0x5948a6[_0x86ad('0x2b')][_0x86ad('0x29')]);}})[_0x86ad('0x2c')](function(_0x146345){logger['error'](_0x86ad('0x22'),_0xf267c0,_0x146345);_0x1801f2(_0x146345);});});}function respondWithStatusCode(_0x394968,_0x465195){_0x465195=_0x465195||0xcc;return function(_0x59de2d){if(_0x59de2d){return _0x394968[_0x86ad('0x2d')](_0x465195);}return _0x394968['status'](_0x465195)['end']();};}function respondWithResult(_0x5b68f9,_0x454eb9){_0x454eb9=_0x454eb9||0xc8;return function(_0x401adb){if(_0x401adb){return _0x5b68f9[_0x86ad('0x2e')](_0x454eb9)[_0x86ad('0x2f')](_0x401adb);}};}function respondWithFilteredResult(_0x24e8d1,_0x2afb36){return function(_0x210313){if(_0x210313){var _0x59f691=_0x210313[_0x86ad('0x30')],_0x30ca8f=_0x2afb36['offset'],_0x38785b=_0x2afb36[_0x86ad('0x31')]+_0x2afb36[_0x86ad('0x32')],_0x48db1e;if(_0x38785b>=_0x59f691){_0x38785b=_0x59f691;_0x48db1e=0xc8;}else{_0x48db1e=0xce;}_0x24e8d1[_0x86ad('0x2e')](_0x48db1e);return _0x24e8d1[_0x86ad('0x33')](_0x86ad('0x34'),_0x30ca8f+'-'+_0x38785b+'/'+_0x59f691)['json'](_0x210313);}return null;};}function patchUpdates(_0x6834b8){return function(_0x317468){try{jsonpatch['apply'](_0x317468,_0x6834b8,!![]);}catch(_0x485c38){return BPromise[_0x86ad('0x35')](_0x485c38);}return _0x317468[_0x86ad('0x36')]();};}function saveUpdates(_0x2c78c8,_0x45ef0d){return function(_0x5ee46e){if(_0x5ee46e){return _0x5ee46e[_0x86ad('0x37')](_0x2c78c8)[_0x86ad('0x21')](function(_0xb9431b){return _0xb9431b;});}return null;};}function removeEntity(_0x3dfdc4,_0x53779d){return function(_0x393f47){if(_0x393f47){return _0x393f47[_0x86ad('0x38')]()[_0x86ad('0x21')](function(){var _0x1da834=_0x393f47['get']({'plain':!![]});var _0x315f1a='ChatWebsites';return db[_0x86ad('0x39')][_0x86ad('0x38')]({'where':{'type':_0x315f1a,'resourceId':_0x1da834['id']}})['then'](function(){return _0x393f47;});})[_0x86ad('0x21')](function(){_0x3dfdc4[_0x86ad('0x2e')](0xcc)[_0x86ad('0x3a')]();});}};}function handleEntityNotFound(_0x1f1c15,_0x3c4f7f){return function(_0x4a785c){if(!_0x4a785c){_0x1f1c15[_0x86ad('0x2d')](0x194);}return _0x4a785c;};}function handleError(_0x4bbab3,_0x17c148){_0x17c148=_0x17c148||0x1f4;return function(_0x55e7d6){logger[_0x86ad('0x27')](_0x55e7d6[_0x86ad('0x3b')]);if(_0x55e7d6['name']){delete _0x55e7d6[_0x86ad('0x3c')];}_0x4bbab3[_0x86ad('0x2e')](_0x17c148)[_0x86ad('0x3d')](_0x55e7d6);};}exports[_0x86ad('0x3e')]=function(_0x4e67c5,_0x769e3e){var _0xfaca30={'include':[{'model':db[_0x86ad('0x3f')],'as':'mandatoryDispositionPause'}]},_0x24643e={},_0x472d88={'count':0x0,'rows':[]};var _0x402556=_['map'](db['ChatWebsite'][_0x86ad('0x40')],function(_0x2afc22){return{'name':_0x2afc22[_0x86ad('0x41')],'type':_0x2afc22[_0x86ad('0x42')][_0x86ad('0x43')]};});_0x24643e['model']=_['map'](_0x402556,_0x86ad('0x3c'));_0x24643e[_0x86ad('0x44')]=_['keys'](_0x4e67c5[_0x86ad('0x44')]);_0x24643e[_0x86ad('0x45')]=_['intersection'](_0x24643e[_0x86ad('0x46')],_0x24643e[_0x86ad('0x44')]);_0xfaca30[_0x86ad('0x47')]=_[_0x86ad('0x48')](_0x24643e['model'],qs[_0x86ad('0x49')](_0x4e67c5[_0x86ad('0x44')][_0x86ad('0x49')]));_0xfaca30[_0x86ad('0x47')]=_0xfaca30[_0x86ad('0x47')][_0x86ad('0x4a')]?_0xfaca30[_0x86ad('0x47')]:_0x24643e['model'];if(!_0x4e67c5[_0x86ad('0x44')][_0x86ad('0x4b')](_0x86ad('0x4c'))){_0xfaca30[_0x86ad('0x32')]=qs['limit'](_0x4e67c5[_0x86ad('0x44')][_0x86ad('0x32')]);_0xfaca30[_0x86ad('0x31')]=qs[_0x86ad('0x31')](_0x4e67c5[_0x86ad('0x44')]['offset']);}_0xfaca30[_0x86ad('0x4d')]=qs[_0x86ad('0x4e')](_0x4e67c5[_0x86ad('0x44')][_0x86ad('0x4e')]);_0xfaca30[_0x86ad('0x4f')]=qs['filters'](_[_0x86ad('0x50')](_0x4e67c5[_0x86ad('0x44')],_0x24643e[_0x86ad('0x45')]),_0x402556);if(_0x4e67c5[_0x86ad('0x44')][_0x86ad('0x51')]){_0xfaca30['where']=_['merge'](_0xfaca30[_0x86ad('0x4f')],{'$or':_[_0x86ad('0x52')](_0x402556,function(_0x7f7ec){if(_0x7f7ec['type']!==_0x86ad('0x53')){var _0x29d288={};_0x29d288[_0x7f7ec[_0x86ad('0x3c')]]={'$like':'%'+_0x4e67c5[_0x86ad('0x44')][_0x86ad('0x51')]+'%'};return _0x29d288;}})});}_0xfaca30=_[_0x86ad('0x54')]({},_0xfaca30,_0x4e67c5[_0x86ad('0x55')]);var _0x7fd43b={'where':_0xfaca30['where']};return db[_0x86ad('0x56')][_0x86ad('0x30')](_0x7fd43b)[_0x86ad('0x21')](function(_0x307320){_0x472d88['count']=_0x307320;if(_0x4e67c5[_0x86ad('0x44')][_0x86ad('0x57')]){_0xfaca30[_0x86ad('0x58')]=[{'all':!![]}];}return db[_0x86ad('0x56')][_0x86ad('0x59')](_0xfaca30);})['then'](function(_0x17b279){_0x472d88[_0x86ad('0x5a')]=_0x17b279;return _0x472d88;})[_0x86ad('0x21')](respondWithFilteredResult(_0x769e3e,_0xfaca30))['catch'](handleError(_0x769e3e,null));};exports[_0x86ad('0x5b')]=function(_0x4e309d,_0x1e6d33){var _0x201400={'raw':![],'where':{'id':_0x4e309d[_0x86ad('0x5c')]['id']},'include':[{'model':db[_0x86ad('0x3f')],'as':_0x86ad('0x5d')}]},_0x1362d7={};_0x1362d7[_0x86ad('0x46')]=_['keys'](db['ChatWebsite'][_0x86ad('0x40')]);_0x1362d7[_0x86ad('0x44')]=_[_0x86ad('0x5e')](_0x4e309d[_0x86ad('0x44')]);_0x1362d7['filters']=_['intersection'](_0x1362d7[_0x86ad('0x46')],_0x1362d7[_0x86ad('0x44')]);_0x201400['attributes']=_[_0x86ad('0x48')](_0x1362d7['model'],qs[_0x86ad('0x49')](_0x4e309d[_0x86ad('0x44')][_0x86ad('0x49')]));_0x201400['attributes']=_0x201400[_0x86ad('0x47')][_0x86ad('0x4a')]?_0x201400['attributes']:_0x1362d7[_0x86ad('0x46')];if(_0x4e309d[_0x86ad('0x44')]['includeAll']){_0x201400[_0x86ad('0x58')]=[{'all':!![]}];}_0x201400=_[_0x86ad('0x54')]({},_0x201400,_0x4e309d[_0x86ad('0x55')]);return db['ChatWebsite'][_0x86ad('0x5f')](_0x201400)[_0x86ad('0x21')](handleEntityNotFound(_0x1e6d33,null))[_0x86ad('0x21')](respondWithResult(_0x1e6d33,null))['catch'](handleError(_0x1e6d33,null));};exports[_0x86ad('0x60')]=function(_0x129159,_0x2bdc91){return db[_0x86ad('0x56')][_0x86ad('0x60')](_0x129159[_0x86ad('0x61')],{})[_0x86ad('0x21')](function(_0x307f71){var _0x1823aa=_0x129159[_0x86ad('0x62')][_0x86ad('0x63')]({'plain':!![]});if(!_0x1823aa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1823aa[_0x86ad('0x64')]==='user'){var _0x4bb854=_0x307f71[_0x86ad('0x63')]({'plain':!![]});var _0x421420=_0x86ad('0x65');return db['UserProfileSection']['find']({'where':{'name':_0x421420,'userProfileId':_0x1823aa[_0x86ad('0x66')]},'raw':!![]})[_0x86ad('0x21')](function(_0x56025a){if(_0x56025a&&_0x56025a[_0x86ad('0x67')]===0x0){return db[_0x86ad('0x39')][_0x86ad('0x60')]({'name':_0x4bb854['name'],'resourceId':_0x4bb854['id'],'type':_0x56025a[_0x86ad('0x3c')],'sectionId':_0x56025a['id']},{})[_0x86ad('0x21')](function(){return _0x307f71;});}else{return _0x307f71;}})[_0x86ad('0x2c')](function(_0x46629c){logger[_0x86ad('0x27')](_0x86ad('0x68'),_0x46629c);throw _0x46629c;});}return _0x307f71;})[_0x86ad('0x21')](respondWithResult(_0x2bdc91,0xc9))[_0x86ad('0x2c')](handleError(_0x2bdc91,null));};exports[_0x86ad('0x37')]=function(_0xc68c1b,_0x5b5d2c){if(_0xc68c1b[_0x86ad('0x61')]['id']){delete _0xc68c1b[_0x86ad('0x61')]['id'];}return db['ChatWebsite'][_0x86ad('0x5f')]({'where':{'id':_0xc68c1b[_0x86ad('0x5c')]['id']},'include':[{'model':db[_0x86ad('0x3f')],'as':'mandatoryDispositionPause'}]})[_0x86ad('0x21')](handleEntityNotFound(_0x5b5d2c,null))[_0x86ad('0x21')](saveUpdates(_0xc68c1b['body'],null))[_0x86ad('0x21')](respondWithResult(_0x5b5d2c,null))[_0x86ad('0x2c')](handleError(_0x5b5d2c,null));};exports['destroy']=function(_0xeb4690,_0x5898a4){return db[_0x86ad('0x56')]['find']({'where':{'id':_0xeb4690[_0x86ad('0x5c')]['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x5898a4,null))['then'](removeEntity(_0x5898a4,null))[_0x86ad('0x2c')](handleError(_0x5898a4,null));};exports[_0x86ad('0x69')]=function(_0x584af3,_0x27df1f){return db[_0x86ad('0x56')][_0x86ad('0x69')]()[_0x86ad('0x21')](respondWithResult(_0x27df1f,null))[_0x86ad('0x2c')](handleError(_0x27df1f,null));};exports[_0x86ad('0x6a')]=function(_0x4a84f4,_0x5a421b,_0x5df9ad){if(_0x4a84f4[_0x86ad('0x61')]['id']){delete _0x4a84f4['body']['id'];}return db['ChatWebsite'][_0x86ad('0x5f')]({'where':{'id':_0x4a84f4[_0x86ad('0x5c')]['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x5a421b,null))[_0x86ad('0x21')](function(_0x16db6e){if(_0x16db6e){_0x4a84f4[_0x86ad('0x61')][_0x86ad('0x6b')]=_0x16db6e['id'];return db[_0x86ad('0x6c')]['create'](_0x4a84f4[_0x86ad('0x61')]);}})[_0x86ad('0x21')](respondWithResult(_0x5a421b,null))[_0x86ad('0x2c')](handleError(_0x5a421b,null));};exports[_0x86ad('0x6d')]=function(_0x299378,_0x143853,_0x1297d4){var _0x3dc894={'raw':![],'where':{}};var _0x2daf9a={};var _0x3d0b2e={'count':0x0,'rows':[]};return db[_0x86ad('0x56')][_0x86ad('0x6e')]({'where':{'id':_0x299378[_0x86ad('0x5c')]['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x143853,null))[_0x86ad('0x21')](function(_0x366d5b){if(_0x366d5b){_0x2daf9a['model']=_[_0x86ad('0x5e')](db[_0x86ad('0x6c')][_0x86ad('0x40')]);_0x2daf9a[_0x86ad('0x44')]=_['keys'](_0x299378[_0x86ad('0x44')]);_0x2daf9a[_0x86ad('0x45')]=_[_0x86ad('0x48')](_0x2daf9a['model'],_0x2daf9a['query']);_0x3dc894[_0x86ad('0x47')]=_[_0x86ad('0x48')](_0x2daf9a[_0x86ad('0x46')],qs[_0x86ad('0x49')](_0x299378[_0x86ad('0x44')][_0x86ad('0x49')]));_0x3dc894[_0x86ad('0x47')]=_0x3dc894[_0x86ad('0x47')][_0x86ad('0x4a')]?_0x3dc894[_0x86ad('0x47')]:_0x2daf9a[_0x86ad('0x46')];if(!_0x299378[_0x86ad('0x44')]['hasOwnProperty']('nolimit')){_0x3dc894[_0x86ad('0x32')]=qs[_0x86ad('0x32')](_0x299378[_0x86ad('0x44')][_0x86ad('0x32')]);_0x3dc894[_0x86ad('0x31')]=qs[_0x86ad('0x31')](_0x299378[_0x86ad('0x44')][_0x86ad('0x31')]);}_0x3dc894['order']=qs[_0x86ad('0x4e')](_0x299378[_0x86ad('0x44')][_0x86ad('0x4e')]);_0x3dc894[_0x86ad('0x4f')]=qs[_0x86ad('0x45')](_[_0x86ad('0x50')](_0x299378['query'],_0x2daf9a[_0x86ad('0x45')]));_0x3dc894[_0x86ad('0x4f')][_0x86ad('0x6b')]=_0x366d5b['id'];if(_0x299378['query']['filter']){_0x3dc894[_0x86ad('0x4f')]=_[_0x86ad('0x54')](_0x3dc894[_0x86ad('0x4f')],{'$or':_['map'](_0x3dc894['attributes'],function(_0x13ce11){var _0x252654={};_0x252654[_0x13ce11]={'$like':'%'+_0x299378[_0x86ad('0x44')][_0x86ad('0x51')]+'%'};return _0x252654;})});}_0x3dc894=_[_0x86ad('0x54')]({},_0x3dc894,_0x299378[_0x86ad('0x55')]);return db[_0x86ad('0x6c')][_0x86ad('0x30')]({'where':_0x3dc894[_0x86ad('0x4f')]})[_0x86ad('0x21')](function(_0x5d32df){_0x3d0b2e['count']=_0x5d32df;if(_0x299378[_0x86ad('0x44')][_0x86ad('0x57')]){_0x3dc894['include']=[{'all':!![]}];}return db[_0x86ad('0x6c')]['findAll'](_0x3dc894);})[_0x86ad('0x21')](function(_0x37363e){_0x3d0b2e[_0x86ad('0x5a')]=_0x37363e;return _0x3d0b2e;});}})[_0x86ad('0x21')](respondWithFilteredResult(_0x143853,_0x3dc894))[_0x86ad('0x2c')](handleError(_0x143853,null));};exports[_0x86ad('0x6f')]=function(_0x5449b6,_0x224ac4,_0x13131f){return db['ChatWebsite'][_0x86ad('0x5f')]({'where':{'id':_0x5449b6['params']['id']}})['then'](handleEntityNotFound(_0x224ac4,null))[_0x86ad('0x21')](function(_0x1e36cd){if(_0x1e36cd){return _0x1e36cd[_0x86ad('0x6f')](_0x5449b6['query']['ids']);}})[_0x86ad('0x21')](respondWithStatusCode(_0x224ac4,null))[_0x86ad('0x2c')](handleError(_0x224ac4,null));};exports[_0x86ad('0x70')]=function(_0x3134df,_0x41ab13,_0x959e35){if(_0x3134df[_0x86ad('0x61')]['id']){delete _0x3134df[_0x86ad('0x61')]['id'];}return db[_0x86ad('0x56')][_0x86ad('0x5f')]({'where':{'id':_0x3134df[_0x86ad('0x5c')]['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x41ab13,null))[_0x86ad('0x21')](function(_0x2f7965){if(_0x2f7965){_0x3134df[_0x86ad('0x61')][_0x86ad('0x6b')]=_0x2f7965['id'];return db[_0x86ad('0x71')][_0x86ad('0x60')](_0x3134df[_0x86ad('0x61')]);}})[_0x86ad('0x21')](respondWithResult(_0x41ab13,null))[_0x86ad('0x2c')](handleError(_0x41ab13,null));};exports['getAnswers']=function(_0x4a431c,_0x440eeb,_0x50d5a0){var _0x251bef={'raw':![],'where':{}};var _0x3ad8b2={};var _0x2b3ed0={'count':0x0,'rows':[]};return db[_0x86ad('0x56')][_0x86ad('0x6e')]({'where':{'id':_0x4a431c[_0x86ad('0x5c')]['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x440eeb,null))['then'](function(_0x425e49){if(_0x425e49){_0x3ad8b2['model']=_['keys'](db['CannedAnswer'][_0x86ad('0x40')]);_0x3ad8b2['query']=_[_0x86ad('0x5e')](_0x4a431c[_0x86ad('0x44')]);_0x3ad8b2[_0x86ad('0x45')]=_['intersection'](_0x3ad8b2['model'],_0x3ad8b2['query']);_0x251bef['attributes']=_[_0x86ad('0x48')](_0x3ad8b2[_0x86ad('0x46')],qs[_0x86ad('0x49')](_0x4a431c['query'][_0x86ad('0x49')]));_0x251bef['attributes']=_0x251bef[_0x86ad('0x47')][_0x86ad('0x4a')]?_0x251bef[_0x86ad('0x47')]:_0x3ad8b2[_0x86ad('0x46')];if(!_0x4a431c['query'][_0x86ad('0x4b')]('nolimit')){_0x251bef[_0x86ad('0x32')]=qs[_0x86ad('0x32')](_0x4a431c[_0x86ad('0x44')]['limit']);_0x251bef['offset']=qs[_0x86ad('0x31')](_0x4a431c[_0x86ad('0x44')][_0x86ad('0x31')]);}_0x251bef['order']=qs[_0x86ad('0x4e')](_0x4a431c['query']['sort']);_0x251bef[_0x86ad('0x4f')]=qs['filters'](_[_0x86ad('0x50')](_0x4a431c[_0x86ad('0x44')],_0x3ad8b2[_0x86ad('0x45')]));_0x251bef[_0x86ad('0x4f')][_0x86ad('0x6b')]=_0x425e49['id'];if(_0x4a431c['query'][_0x86ad('0x51')]){_0x251bef['where']=_[_0x86ad('0x54')](_0x251bef['where'],{'$or':_[_0x86ad('0x52')](_0x251bef['attributes'],function(_0x47ab53){var _0x156e69={};_0x156e69[_0x47ab53]={'$like':'%'+_0x4a431c[_0x86ad('0x44')]['filter']+'%'};return _0x156e69;})});}_0x251bef=_[_0x86ad('0x54')]({},_0x251bef,_0x4a431c[_0x86ad('0x55')]);return db[_0x86ad('0x71')][_0x86ad('0x30')]({'where':_0x251bef['where']})['then'](function(_0x2c6e7b){_0x2b3ed0[_0x86ad('0x30')]=_0x2c6e7b;if(_0x4a431c[_0x86ad('0x44')][_0x86ad('0x57')]){_0x251bef[_0x86ad('0x58')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x251bef);})[_0x86ad('0x21')](function(_0x42dc4b){_0x2b3ed0[_0x86ad('0x5a')]=_0x42dc4b;return _0x2b3ed0;});}})[_0x86ad('0x21')](respondWithFilteredResult(_0x440eeb,_0x251bef))[_0x86ad('0x2c')](handleError(_0x440eeb,null));};exports[_0x86ad('0x72')]=function(_0x35dba7,_0x4635f7,_0x22402d){return db['ChatWebsite']['find']({'where':{'id':_0x35dba7[_0x86ad('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4635f7,null))[_0x86ad('0x21')](function(_0x5d785f){if(_0x5d785f){return _0x5d785f['removeAnswers'](_0x35dba7[_0x86ad('0x44')][_0x86ad('0x73')]);}})[_0x86ad('0x21')](respondWithStatusCode(_0x4635f7,null))['catch'](handleError(_0x4635f7,null));};exports[_0x86ad('0x74')]=function(_0x41b0b8,_0x26a231,_0x53a749){_0x41b0b8['body']['sitepic']=_0x41b0b8['file'][_0x86ad('0x75')];return db[_0x86ad('0x56')][_0x86ad('0x5f')]({'where':{'id':_0x41b0b8['params']['id']}})['then'](handleEntityNotFound(_0x26a231,null))[_0x86ad('0x21')](saveUpdates(_0x41b0b8[_0x86ad('0x61')],null))[_0x86ad('0x21')](respondWithResult(_0x26a231,null))['catch'](handleError(_0x26a231,null));};exports[_0x86ad('0x76')]=function(_0x1dca1a,_0x433f32,_0x423b00){_0x1dca1a[_0x86ad('0x61')]['agentAvatar']=_0x1dca1a[_0x86ad('0x77')]['filename'];return db[_0x86ad('0x56')]['find']({'where':{'id':_0x1dca1a['params']['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x433f32,null))['then'](saveUpdates(_0x1dca1a[_0x86ad('0x61')],null))[_0x86ad('0x21')](respondWithResult(_0x433f32,null))['catch'](handleError(_0x433f32,null));};exports['addCustomerAvatar']=function(_0x129d59,_0x35c460,_0x24f9f1){_0x129d59[_0x86ad('0x61')][_0x86ad('0x78')]=_0x129d59['file'][_0x86ad('0x75')];return db[_0x86ad('0x56')][_0x86ad('0x5f')]({'where':{'id':_0x129d59[_0x86ad('0x5c')]['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x35c460,null))[_0x86ad('0x21')](saveUpdates(_0x129d59[_0x86ad('0x61')],null))[_0x86ad('0x21')](respondWithResult(_0x35c460,null))[_0x86ad('0x2c')](handleError(_0x35c460,null));};exports[_0x86ad('0x79')]=function(_0x494082,_0xb07210,_0x20f0e9){_0x494082['body'][_0x86ad('0x7a')]=_0x494082[_0x86ad('0x77')][_0x86ad('0x75')];return db[_0x86ad('0x56')][_0x86ad('0x5f')]({'where':{'id':_0x494082[_0x86ad('0x5c')]['id']}})['then'](handleEntityNotFound(_0xb07210,null))[_0x86ad('0x21')](saveUpdates(_0x494082[_0x86ad('0x61')],null))['then'](respondWithResult(_0xb07210,null))[_0x86ad('0x2c')](handleError(_0xb07210,null));};exports[_0x86ad('0x7b')]=function(_0x2f4d0a,_0x460d3d,_0x268bd2){var _0x581f94=path[_0x86ad('0x7c')](config[_0x86ad('0x7d')],_0x86ad('0x7e'));var _0x13f7d4={'where':{'id':_0x2f4d0a[_0x86ad('0x5c')]['id']},'attributes':['id',_0x86ad('0x7f')],'raw':!![]};var _0x391017=![];return require('../../config/license/util')[_0x86ad('0x80')]()['then'](function(_0xff8dd5){if(_0xff8dd5){_0x391017=_0xff8dd5[_0x86ad('0x81')];}})['then'](function(){return db['ChatWebsite']['find'](_0x13f7d4);})[_0x86ad('0x21')](handleEntityNotFound(_0x460d3d,null))[_0x86ad('0x21')](function(_0x11840f){if(_0x11840f){if(!_[_0x86ad('0x82')](_0x11840f['sitepic'])){if(fs[_0x86ad('0x83')](path[_0x86ad('0x7c')](config[_0x86ad('0x7d')],_0x86ad('0x84'),_0x11840f[_0x86ad('0x7f')]))&&_0x391017){_0x581f94=path[_0x86ad('0x7c')](config[_0x86ad('0x7d')],'server/files/images/logos/',_0x11840f[_0x86ad('0x7f')]);}}return _0x460d3d[_0x86ad('0x85')](_0x581f94);}})['catch'](handleError(_0x460d3d,null));};exports[_0x86ad('0x86')]=function(_0x1e7755,_0x2cb3bb,_0x5c98d9){var _0x481736=path[_0x86ad('0x7c')](config['root'],_0x86ad('0x87'));var _0x8244e7={'where':{'id':_0x1e7755['params']['id']},'attributes':['id',_0x86ad('0x88')],'raw':!![]};return db[_0x86ad('0x56')][_0x86ad('0x5f')](_0x8244e7)[_0x86ad('0x21')](handleEntityNotFound(_0x2cb3bb,null))[_0x86ad('0x21')](function(_0x3676ec){if(_0x3676ec){if(!_[_0x86ad('0x82')](_0x3676ec[_0x86ad('0x88')])){if(fs[_0x86ad('0x83')](path[_0x86ad('0x7c')](config[_0x86ad('0x7d')],_0x86ad('0x89'),_0x3676ec[_0x86ad('0x88')]))){_0x481736=path[_0x86ad('0x7c')](config[_0x86ad('0x7d')],_0x86ad('0x89'),_0x3676ec[_0x86ad('0x88')]);}}return _0x2cb3bb['download'](_0x481736);}})[_0x86ad('0x2c')](handleError(_0x2cb3bb,null));};exports[_0x86ad('0x8a')]=function(_0x56ae7f,_0x540f0c,_0x597a5e){var _0x581891=path[_0x86ad('0x7c')](config[_0x86ad('0x7d')],_0x86ad('0x8b'));var _0x2af4b7={'where':{'id':_0x56ae7f[_0x86ad('0x5c')]['id']},'attributes':['id',_0x86ad('0x78'),_0x86ad('0x8c')],'raw':!![]};return db[_0x86ad('0x56')]['find'](_0x2af4b7)[_0x86ad('0x21')](handleEntityNotFound(_0x540f0c,null))['then'](function(_0x3fff42){if(_0x3fff42){if(!_[_0x86ad('0x82')](_0x3fff42[_0x86ad('0x78')])){if(fs[_0x86ad('0x83')](path['join'](config[_0x86ad('0x7d')],_0x86ad('0x89'),_0x3fff42[_0x86ad('0x78')]))&&_0x3fff42['showCustomerAvatar']){_0x581891=path[_0x86ad('0x7c')](config[_0x86ad('0x7d')],_0x86ad('0x89'),_0x3fff42[_0x86ad('0x78')]);}}return _0x540f0c['download'](_0x581891);}})['catch'](handleError(_0x540f0c,null));};exports['getSystemAvatar']=function(_0x498bb0,_0xec1d07,_0x445e3a){var _0x1b998a=path['join'](config[_0x86ad('0x7d')],'server/files/images/avatars/system_avatar.png');var _0x2597e9={'where':{'id':_0x498bb0[_0x86ad('0x5c')]['id']},'attributes':['id',_0x86ad('0x7a')],'raw':!![]};return db[_0x86ad('0x56')][_0x86ad('0x5f')](_0x2597e9)['then'](handleEntityNotFound(_0xec1d07,null))[_0x86ad('0x21')](function(_0x1400ad){if(_0x1400ad){if(!_[_0x86ad('0x82')](_0x1400ad[_0x86ad('0x7a')])){if(fs[_0x86ad('0x83')](path[_0x86ad('0x7c')](config[_0x86ad('0x7d')],'server/files/images/avatars/',_0x1400ad['systemAvatar']))){_0x1b998a=path[_0x86ad('0x7c')](config[_0x86ad('0x7d')],_0x86ad('0x89'),_0x1400ad[_0x86ad('0x7a')]);}}return _0xec1d07[_0x86ad('0x85')](_0x1b998a);}})[_0x86ad('0x2c')](handleError(_0xec1d07,null));};exports['notify']=function(_0x6e3687,_0x4232fc,_0x19f3a6){var _0xace0df=require('user-agent-parser');var _0x1948b8=new _0xace0df();var _0x2ee892=_0x1948b8['setUA'](_0x6e3687[_0x86ad('0x8d')][_0x86ad('0x8e')])[_0x86ad('0x8f')]();var _0x2fa0bc={'body':_0x6e3687[_0x86ad('0x61')],'channel':_0x86ad('0x90')};var _0x855a29=[];var _0xecf8c4=[];var _0x3cc933={};var _0x30b26b=![];return db['CmContact'][_0x86ad('0x69')]()['then'](function(_0x1f917d){if(!_0x1f917d){throw new db[(_0x86ad('0x91'))][(_0x86ad('0x92'))](_0x86ad('0x93'));}_0x855a29=_['difference'](_[_0x86ad('0x5e')](_0x1f917d),[_0x86ad('0x94'),'updatedAt']);_0xecf8c4=_[_0x86ad('0x95')](_['keys'](_0x1f917d),['createdAt',_0x86ad('0x96'),_0x86ad('0x97'),_0x86ad('0x98')]);if(_0x6e3687[_0x86ad('0x61')]['id']){delete _0x6e3687[_0x86ad('0x61')]['id'];}if(_[_0x86ad('0x82')](_0x6e3687['body'][_0x86ad('0x99')])){throw new db['Sequelize']['ValidationError'](_0x86ad('0x9a'));}if(_[_0x86ad('0x82')](_0x6e3687['body'][_0x86ad('0x61')])||_0x6e3687['body'][_0x86ad('0x61')]===''){throw new db['Sequelize'][(_0x86ad('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x86ad('0x82')](_0x6e3687['body'][_0x86ad('0x9b')])){throw new db[(_0x86ad('0x91'))][(_0x86ad('0x92'))](_0x86ad('0x9c')+_0xecf8c4);}if(!_[_0x86ad('0x9d')](_0xecf8c4,_0x6e3687[_0x86ad('0x61')]['mapKey'])){throw new db[(_0x86ad('0x91'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xecf8c4);}_0x3cc933[_0x6e3687['body'][_0x86ad('0x9b')]]=_0x6e3687['body'][_0x86ad('0x99')];})[_0x86ad('0x21')](function(){return db[_0x86ad('0x56')][_0x86ad('0x5f')]({'where':{'id':_0x6e3687[_0x86ad('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0x86ad('0x9e'),'include':[{'model':db[_0x86ad('0x9f')],'as':'Contacts','where':_0x3cc933,'limit':0x1,'order':[[_0x86ad('0x96'),'DESC']]}]},{'model':db[_0x86ad('0xa0')],'as':'Applications'}]});})[_0x86ad('0x21')](handleEntityNotFound(_0x4232fc,null))[_0x86ad('0x21')](function(_0x4a5b31){if(_0x4a5b31&&_0x4a5b31[_0x86ad('0x9e')]){_0x2fa0bc[_0x86ad('0xa1')]=_0x4a5b31;_0x2fa0bc['applications']=_0x4a5b31[_0x86ad('0xa2')];_0x2fa0bc[_0x86ad('0xa3')]=_0x4a5b31[_0x86ad('0x9e')];_0x2fa0bc[_0x86ad('0xa4')]=_[_0x86ad('0xa5')](_0x2fa0bc['applications'],[_0x86ad('0xa6')],['asc']);if(_0x2fa0bc[_0x86ad('0xa1')][_0x86ad('0xa2')]){delete _0x2fa0bc[_0x86ad('0xa1')]['Applications'];}if(_0x2fa0bc[_0x86ad('0xa1')][_0x86ad('0x9e')]&&_0x2fa0bc['account']['List']['Contacts'][_0x86ad('0x4a')]){return _0x2fa0bc['account'][_0x86ad('0x9e')]['Contacts'][0x0];}var _0x529494=_[_0x86ad('0x1a')](_0x6e3687[_0x86ad('0x61')],{'firstName':_0x6e3687[_0x86ad('0x61')][_0x86ad('0x99')],'ListId':_0x4a5b31[_0x86ad('0x98')]});_0x529494[_0x6e3687['body']['mapKey']]=_0x6e3687[_0x86ad('0x61')]['from'];return db[_0x86ad('0x9f')][_0x86ad('0x60')](_0x529494,{'fields':_0x855a29,'raw':!![]});}})['then'](handleEntityNotFound(_0x4232fc,null))[_0x86ad('0x21')](function(_0x52c29a){_0x2fa0bc[_0x86ad('0xa7')]=_0x52c29a;var _0x2f4b13=_0x6e3687['body'][_0x86ad('0xa8')];if(_0x6e3687['headers'][_0x86ad('0xa9')]){_0x2f4b13=_0x6e3687[_0x86ad('0x8d')]['cf-connecting-ip'];}else if(_0x6e3687['headers'][_0x86ad('0xaa')]){_0x2f4b13=_[_0x86ad('0xab')](_0x6e3687['headers'][_0x86ad('0xaa')]['split'](','));}if(_0x52c29a){var _0x39b531={'ContactId':_0x52c29a['id'],'ChatWebsiteId':_0x6e3687[_0x86ad('0x5c')]['id'],'from':(_0x52c29a[_0x86ad('0xac')]||'')+'\x20'+(_0x52c29a[_0x86ad('0xad')]||''),'customerIp':_0x2f4b13,'customerPort':_0x6e3687['headers'][_0x86ad('0xae')]?_0x6e3687[_0x86ad('0x8d')][_0x86ad('0xae')]:null,'referer':_0x6e3687[_0x86ad('0x61')][_0x86ad('0xaf')],'browserName':_0x2ee892[_0x86ad('0xb0')][_0x86ad('0x3c')]&&_0x2ee892['browser'][_0x86ad('0xb1')]?util[_0x86ad('0xb2')](_0x86ad('0xb3'),_0x2ee892['browser']['name'],_0x2ee892['browser'][_0x86ad('0xb1')]):_0x86ad('0xb4'),'browserVersion':_0x2ee892['browser'][_0x86ad('0xb1')]||_0x86ad('0xb4'),'osName':util[_0x86ad('0xb2')](_0x86ad('0xb3'),_0x2ee892['os'][_0x86ad('0x3c')],_0x2ee892['os'][_0x86ad('0xb1')]),'osVersion':_0x2ee892['os']['version'],'deviceModel':_0x2ee892[_0x86ad('0xb5')][_0x86ad('0x46')]&&_0x2ee892[_0x86ad('0xb5')][_0x86ad('0xb6')]?util[_0x86ad('0xb2')](_0x86ad('0xb7'),_0x2ee892['device'][_0x86ad('0x46')],_0x2ee892[_0x86ad('0xb5')][_0x86ad('0xb6')],_0x2ee892[_0x86ad('0xb5')][_0x86ad('0x42')]):null,'deviceVendor':_0x2ee892[_0x86ad('0xb5')][_0x86ad('0xb6')],'deviceType':_0x2ee892['device'][_0x86ad('0x42')],'formData':JSON[_0x86ad('0x26')](_0x6e3687['body'])};var _0x12359={'ChatWebsiteId':_0x6e3687[_0x86ad('0x5c')]['id'],'closed':![]};if(_0x6e3687[_0x86ad('0x61')][_0x86ad('0xb8')]){_0x12359[_0x86ad('0xb8')]=_0x6e3687[_0x86ad('0x61')][_0x86ad('0xb8')];return db[_0x86ad('0xb9')]['find']({'where':_0x12359})[_0x86ad('0x21')](function(_0x4cd555){if(_0x4cd555){return[_0x4cd555,![]];}_0x39b531[_0x86ad('0xb8')]=_0x6e3687[_0x86ad('0x61')][_0x86ad('0xb8')];_0x39b531[_0x86ad('0xba')]=_0x6e3687[_0x86ad('0x61')][_0x86ad('0xba')];return db[_0x86ad('0xb9')]['create'](_0x39b531)[_0x86ad('0x21')](function(_0x40db64){return[_0x40db64,!![]];});});}_0x12359[_0x86ad('0xbb')]=_0x52c29a['id'];if(_0x6e3687[_0x86ad('0x61')][_0x86ad('0xbc')]&&_0x6e3687[_0x86ad('0x61')]['interaction']['id']){_0x12359['id']=_0x6e3687[_0x86ad('0x61')][_0x86ad('0xbc')]['id'];return db[_0x86ad('0xb9')][_0x86ad('0x5f')]({'where':_0x12359})['then'](function(_0x11da97){if(_0x11da97){return[_0x11da97,![]];}return db[_0x86ad('0xb9')]['create'](_0x39b531)['then'](function(_0x5b66a0){return[_0x5b66a0,!![]];});});}return db['ChatInteraction'][_0x86ad('0x60')](_0x39b531)[_0x86ad('0x21')](function(_0xd27d99){return[_0xd27d99,!![]];});}})[_0x86ad('0xbd')](function(_0x4d2876,_0x13b6ef){if(_0x4d2876){_0x30b26b=_0x13b6ef;if(!_0x13b6ef){var _0x39bfb3={'from':(_0x2fa0bc[_0x86ad('0xa7')][_0x86ad('0xac')]||'')+'\x20'+(_0x2fa0bc[_0x86ad('0xa7')][_0x86ad('0xad')]||'')};if(_0x6e3687[_0x86ad('0x61')][_0x86ad('0xb8')]&&_0x6e3687['body'][_0x86ad('0xbe')]&&_0x6e3687[_0x86ad('0x61')]['threadId']!=_0x6e3687['body'][_0x86ad('0xbe')]){_0x39bfb3[_0x86ad('0xb8')]=_0x6e3687[_0x86ad('0x61')][_0x86ad('0xbe')];}return _0x4d2876['update'](_0x39bfb3);}else{return _0x4d2876;}}})[_0x86ad('0x21')](function(_0x412a7f){_0x2fa0bc[_0x86ad('0xbc')]=_0x412a7f[_0x86ad('0x63')]({'plain':!![]});_0x2fa0bc['interaction'][_0x86ad('0xbf')]=_0x30b26b;if(_0x2fa0bc[_0x86ad('0xbc')][_0x86ad('0xbf')]){if(_0x2fa0bc[_0x86ad('0xa1')][_0x86ad('0xc0')]){_0x2fa0bc[_0x86ad('0xa4')][_0x86ad('0xc1')]({'id':0x0,'priority':_0x2fa0bc[_0x86ad('0xa4')]['length']+0x1,'app':_0x86ad('0xc2'),'appdata':_0x86ad('0xc3'),'interval':'*,*,*,*'});}}return db[_0x86ad('0xc4')]['create']({'body':_0x6e3687[_0x86ad('0x61')][_0x86ad('0x61')],'ChatWebsiteId':_0x6e3687[_0x86ad('0x5c')]['id'],'ChatInteractionId':_0x412a7f['id'],'direction':'in','ContactId':_0x2fa0bc['contact']['id'],'AttachmentId':_0x6e3687[_0x86ad('0x61')][_0x86ad('0xc5')]});})[_0x86ad('0x21')](function(_0x5e2f03){_0x2fa0bc[_0x86ad('0x29')]=_0x5e2f03;if(_0x2fa0bc[_0x86ad('0xbc')][_0x86ad('0xc6')]){return db['User']['find']({'attributes':['id',_0x86ad('0x3c')],'where':{'id':_0x2fa0bc[_0x86ad('0xbc')]['UserId']}})['then'](function(_0x5ae628){if(_0x5ae628){_0x2fa0bc[_0x86ad('0xa4')]['unshift']({'id':0x0,'priority':0x0,'app':_0x86ad('0xc7'),'appdata':_0x5ae628[_0x86ad('0x3c')]+','+(_0x2fa0bc[_0x86ad('0xa1')]['waitForTheAssignedAgent']||0xa),'interval':_0x86ad('0xc8')});_0x2fa0bc[_0x86ad('0xc9')]=!![];}return respondWithRpcPromise(_0x86ad('0xca'),_0x86ad('0xcb'),_0x2fa0bc);});}return respondWithRpcPromise('Start',_0x86ad('0xcb'),_0x2fa0bc);})[_0x86ad('0x21')](function(_0x778276){respondWithRpcPromise(_0x86ad('0xcc'),'EventManager',{'event':_0x86ad('0xcd'),'message':_0x778276},client9002);return _0x778276;})['then'](respondWithResult(_0x4232fc,null))[_0x86ad('0x2c')](handleError(_0x4232fc,null));};exports[_0x86ad('0xce')]=function(_0x4490f3,_0x5befb5,_0xc7cd8d){var _0x46e6d5,_0x40b89c,_0x47ed23;var _0x1a7c6b=[];var _0x258724=[];var _0x4ecd33={};return db[_0x86ad('0x9f')][_0x86ad('0x69')]()[_0x86ad('0x21')](function(_0x1c19d6){if(!_0x1c19d6){throw new db[(_0x86ad('0x91'))][(_0x86ad('0x92'))](_0x86ad('0x93'));}_0x258724=_[_0x86ad('0x95')](_[_0x86ad('0x5e')](_0x1c19d6),[_0x86ad('0x94'),_0x86ad('0x96')]);_0x1a7c6b=_[_0x86ad('0x95')](_[_0x86ad('0x5e')](_0x1c19d6),[_0x86ad('0x94'),_0x86ad('0x96'),'CompanyId',_0x86ad('0x98')]);if(_0x4490f3[_0x86ad('0x61')]['id']){delete _0x4490f3[_0x86ad('0x61')]['id'];}if(_[_0x86ad('0x82')](_0x4490f3[_0x86ad('0x61')][_0x86ad('0x99')])){throw _0x5befb5[_0x86ad('0x2e')](0x1f4)[_0x86ad('0x3d')](new db[(_0x86ad('0x91'))]['ValidationError'](_0x86ad('0x9a')));}if(_['isNil'](_0x4490f3['body']['body'])||_0x4490f3[_0x86ad('0x61')][_0x86ad('0x61')]===''){throw _0x5befb5[_0x86ad('0x2e')](0x1f4)[_0x86ad('0x3d')](new db['Sequelize'][(_0x86ad('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x86ad('0x82')](_0x4490f3[_0x86ad('0x61')][_0x86ad('0xcf')])){throw _0x5befb5[_0x86ad('0x2e')](0x1f4)[_0x86ad('0x3d')](new db['Sequelize'][(_0x86ad('0x92'))](_0x86ad('0xd0')+_0x1a7c6b));}if(!_[_0x86ad('0x9d')](_0x1a7c6b,_0x4490f3[_0x86ad('0x61')][_0x86ad('0xcf')])){throw _0x5befb5[_0x86ad('0x2e')](0x1f4)['send'](new db[(_0x86ad('0x91'))][(_0x86ad('0x92'))](_0x86ad('0xd1')+_0x1a7c6b));}_0x4ecd33[_0x4490f3[_0x86ad('0x61')]['mapKeyOffline']]=_0x4490f3[_0x86ad('0x61')][_0x86ad('0x99')];})[_0x86ad('0x21')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x4490f3['params']['id']},'include':[{'model':db[_0x86ad('0xd2')],'as':_0x86ad('0x9e')}]});})['then'](handleEntityNotFound(_0x5befb5,null))['then'](function(_0x22589b){if(_0x22589b&&_0x22589b[_0x86ad('0x9e')]){_0x40b89c=_0x22589b;var _0x29fd91=_[_0x86ad('0x1a')](_0x4490f3['body'],{'firstName':_0x4490f3[_0x86ad('0x61')][_0x86ad('0x99')],'phone':_0x4490f3[_0x86ad('0x61')]['from'],'ListId':_0x22589b[_0x86ad('0x98')]});_0x29fd91[_0x4490f3[_0x86ad('0x61')]['mapKeyOffline']]=_0x4490f3['body'][_0x86ad('0x99')];return db[_0x86ad('0x9f')][_0x86ad('0xd3')]({'where':_0x4ecd33,'defaults':_0x29fd91});}})['spread'](function(_0x594238){if(_0x594238){_0x47ed23=_0x594238;var _0x376ecc=fs[_0x86ad('0xd4')](path['join'](config[_0x86ad('0x7d')],_0x86ad('0xd5')),_0x86ad('0xd6'));var _0x306aae=ejs['render'](_0x376ecc,{'body':_[_0x86ad('0xd7')](_0x4490f3['body']['body']),'bodyTitle':_0x40b89c[_0x86ad('0xd8')]});return db[_0x86ad('0xd9')][_0x86ad('0x60')]({'body':_0x306aae,'ContactId':_0x594238['id'],'ChatWebsiteId':_0x40b89c['id']});}})[_0x86ad('0x21')](function(_0x56e18f){if(_0x56e18f){_0x46e6d5=_0x56e18f;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x86ad('0xda')],'as':_0x86ad('0xdb'),'raw':!![]}]});}})[_0x86ad('0x21')](function(_0x5d5f33){if(_0x5d5f33&&_0x5d5f33[_0x86ad('0xdb')]&&_0x40b89c[_0x86ad('0xdc')]){var _0x347081={'tls':{'rejectUnauthorized':![]}};if(_0x5d5f33[_0x86ad('0xdb')][_0x86ad('0xdd')]){_0x347081[_0x86ad('0xdd')]=_0x5d5f33[_0x86ad('0xdb')][_0x86ad('0xdd')];}else{_0x347081[_0x86ad('0xde')]=_0x5d5f33['Smtp']['host'];_0x347081[_0x86ad('0xdf')]=_0x5d5f33[_0x86ad('0xdb')]['port'];_0x347081[_0x86ad('0xe0')]=_0x5d5f33[_0x86ad('0xdb')][_0x86ad('0xe0')];}if(_0x5d5f33[_0x86ad('0xdb')][_0x86ad('0xe1')]){_0x347081[_0x86ad('0xe2')]={'user':_0x5d5f33['Smtp'][_0x86ad('0x62')],'pass':_0x5d5f33[_0x86ad('0xdb')][_0x86ad('0xe3')]};}return respondWithRpcPromise(_0x86ad('0xe4'),_0x86ad('0xe5'),{'account':_0x347081,'message':{'from':util[_0x86ad('0xb2')](_0x86ad('0xe6'),_0x5d5f33[_0x86ad('0x3c')],_0x5d5f33[_0x86ad('0xe7')]||_0x5d5f33[_0x86ad('0xdb')]['user']),'to':_0x40b89c['forwardOfflineAddress'],'subject':_0x40b89c['offlineMessageSubject'],'text':_0x46e6d5[_0x86ad('0x61')]}},client9003)[_0x86ad('0x21')](function(){return _0x46e6d5;})[_0x86ad('0x2c')](function(_0x133f62){console[_0x86ad('0x27')](_0x133f62);});}})[_0x86ad('0x21')](function(){if(_0x46e6d5){return _0x46e6d5;}})[_0x86ad('0x21')](respondWithResult(_0x5befb5,null))[_0x86ad('0x2c')](handleError(_0x5befb5,null));};exports['addInteraction']=function(_0x5c4ef9,_0x383473,_0x2b4707){return db[_0x86ad('0xb9')]['find']({'where':{'id':_0x5c4ef9[_0x86ad('0x5c')]['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x383473,null))[_0x86ad('0x21')](function(_0x1eca11){if(_0x1eca11){return _0x1eca11['addInteraction'](_0x5c4ef9[_0x86ad('0x61')][_0x86ad('0x73')],_[_0x86ad('0xe8')](_0x5c4ef9[_0x86ad('0x61')],[_0x86ad('0x73'),'id'])||{});}})[_0x86ad('0x21')](respondWithResult(_0x383473,null))[_0x86ad('0x2c')](handleError(_0x383473,null));};exports[_0x86ad('0xe9')]=function(_0x1260b0,_0x2c44b1,_0x3f47a1){var _0x51629c={'raw':![],'where':{}};var _0x843294={};var _0x322924={'count':0x0,'rows':[]};return db[_0x86ad('0x56')][_0x86ad('0x6e')]({'where':{'id':_0x1260b0['params']['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x2c44b1,null))[_0x86ad('0x21')](function(_0x37c655){if(_0x37c655){_0x843294[_0x86ad('0x46')]=_[_0x86ad('0x5e')](db[_0x86ad('0xb9')][_0x86ad('0x40')]);_0x843294[_0x86ad('0x44')]=_[_0x86ad('0x5e')](_0x1260b0[_0x86ad('0x44')]);_0x843294[_0x86ad('0x45')]=_[_0x86ad('0x48')](_0x843294['model'],_0x843294[_0x86ad('0x44')]);_0x51629c[_0x86ad('0x47')]=_[_0x86ad('0x48')](_0x843294[_0x86ad('0x46')],qs[_0x86ad('0x49')](_0x1260b0[_0x86ad('0x44')]['fields']));_0x51629c[_0x86ad('0x47')]=_0x51629c[_0x86ad('0x47')]['length']?_0x51629c[_0x86ad('0x47')]:_0x843294['model'];if(!_0x1260b0['query'][_0x86ad('0x4b')](_0x86ad('0x4c'))){_0x51629c[_0x86ad('0x32')]=qs[_0x86ad('0x32')](_0x1260b0['query'][_0x86ad('0x32')]);_0x51629c[_0x86ad('0x31')]=qs[_0x86ad('0x31')](_0x1260b0[_0x86ad('0x44')][_0x86ad('0x31')]);}_0x51629c[_0x86ad('0x4d')]=qs['sort'](_0x1260b0['query'][_0x86ad('0x4e')]);_0x51629c[_0x86ad('0x4f')]=qs[_0x86ad('0x45')](_[_0x86ad('0x50')](_0x1260b0['query'],_0x843294['filters']));_0x51629c[_0x86ad('0x4f')][_0x86ad('0x6b')]=_0x37c655['id'];if(_0x1260b0['query'][_0x86ad('0x51')]){_0x51629c[_0x86ad('0x4f')]=_[_0x86ad('0x54')](_0x51629c[_0x86ad('0x4f')],{'$or':_[_0x86ad('0x52')](_0x51629c[_0x86ad('0x47')],function(_0x4542ab){var _0x5ca411={};_0x5ca411[_0x4542ab]={'$like':'%'+_0x1260b0['query']['filter']+'%'};return _0x5ca411;})});}_0x51629c=_['merge']({},_0x51629c,_0x1260b0[_0x86ad('0x55')]);return db[_0x86ad('0xb9')][_0x86ad('0x30')]({'where':_0x51629c[_0x86ad('0x4f')]})['then'](function(_0x36fc2f){_0x322924[_0x86ad('0x30')]=_0x36fc2f;if(_0x1260b0['query']['includeAll']){_0x51629c['include']=[{'model':db['CmContact'],'as':_0x86ad('0xea'),'required':![]},{'model':db[_0x86ad('0xeb')],'as':_0x86ad('0xec'),'attributes':[_0x86ad('0x3c'),_0x86ad('0xed'),_0x86ad('0xee')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0x86ad('0xef')],'where':_0x1260b0[_0x86ad('0x44')][_0x86ad('0xf0')]?{'id':_0x1260b0[_0x86ad('0x44')][_0x86ad('0xf0')]}:undefined,'required':_0x1260b0[_0x86ad('0x44')]['tag']?!![]:![]}];}return db[_0x86ad('0xb9')][_0x86ad('0x59')](_0x51629c);})['then'](function(_0x5a7299){_0x322924[_0x86ad('0x5a')]=_0x5a7299;return _0x322924;});}})[_0x86ad('0x21')](respondWithFilteredResult(_0x2c44b1,_0x51629c))[_0x86ad('0x2c')](handleError(_0x2c44b1,null));};function iftimePromise(_0x79c6b9,_0x567ef2){return respondWithRpcPromise('Command',_0x86ad('0xf1'),{'command':_0x567ef2[_0x86ad('0xf2')]?util[_0x86ad('0xb2')]('iftime\x20%s,%s',_0x79c6b9[_0x86ad('0xf3')],_0x567ef2['timezone']):util['format'](_0x86ad('0xf4'),_0x79c6b9[_0x86ad('0xf3')])},client9002)[_0x86ad('0x21')](function(_0x1390e0){var _0x316e9a=_0x1390e0&&_0x1390e0['indexOf']('true')>=0x0?!![]:![];logger[_0x86ad('0x2a')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x567ef2['id'],_0x79c6b9['id'],_0x79c6b9[_0x86ad('0xf3')],_0x316e9a?_0x86ad('0xf5'):_0x86ad('0xf6'),_0x567ef2[_0x86ad('0xf2')]?_0x567ef2[_0x86ad('0xf2')]:'No\x20timezone');return _0x316e9a;})[_0x86ad('0x2c')](function(_0x2db7bd){logger[_0x86ad('0x27')](_0x86ad('0xf7'),_0x567ef2['id'],_0x79c6b9['id'],_0x79c6b9['interval'],util[_0x86ad('0xf8')](_0x2db7bd,{'showHidden':![],'depth':null}),_0x567ef2[_0x86ad('0xf2')]?_0x567ef2[_0x86ad('0xf2')]:_0x86ad('0xf9'));return![];});}exports[_0x86ad('0xf1')]=function(_0x45a097,_0x5a0037,_0x1a4382){var _0x2bb3b5=0x0;var _0x584fde=0x0;var _0x53703b=![];var _0x206ff2;var _0x4e6f68;return db[_0x86ad('0x56')]['find']({'where':{'id':_0x45a097[_0x86ad('0x5c')]['id']},'include':[{'model':db[_0x86ad('0xfa')],'as':'Interval','include':[{'model':db[_0x86ad('0xfa')],'as':_0x86ad('0xfb'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x5a0037,null))[_0x86ad('0x21')](function(_0x27a3d7){if(_0x27a3d7){_0x206ff2=_0x27a3d7;return _0x27a3d7[_0x86ad('0xfc')]({'raw':!![]});}})[_0x86ad('0x21')](function(_0x378439){if(_0x206ff2){if(_0x378439){_0x4e6f68=_0x378439;}}return require(_0x86ad('0xfd'))[_0x86ad('0x80')]();})[_0x86ad('0x21')](function(_0x4a02fa){if(_0x4a02fa){_0x584fde=_0x4a02fa[_0x86ad('0xfe')];_0x53703b=_0x4a02fa['custom'];}})[_0x86ad('0x21')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})['then'](function(_0x4d6af1){_0x2bb3b5=_0x4d6af1;if(_0x584fde&&_0x4d6af1>_0x584fde){return db[_0x86ad('0xff')][_0x86ad('0x6e')]({'where':{'id':0x1}})[_0x86ad('0x21')](function(_0x14409a){if(_0x14409a){_0x14409a[_0x86ad('0x100')](_0x86ad('0x101'));}});}})['then'](function(){if(_0x206ff2[_0x86ad('0xfa')]&&_0x206ff2[_0x86ad('0xfa')]['Intervals']){var _0x1e0225=[];for(var _0x5e2874=0x0;_0x5e2874<_0x206ff2[_0x86ad('0xfa')][_0x86ad('0xfb')][_0x86ad('0x4a')];_0x5e2874++){var _0x257d87=_0x206ff2[_0x86ad('0xfa')][_0x86ad('0xfb')][_0x5e2874][_0x86ad('0x63')]({'plain':!![]});_0x1e0225[_0x86ad('0xc1')](iftimePromise(_0x257d87,_0x206ff2));}return BPromise['all'](_0x1e0225)[_0x86ad('0x21')](function(_0x153e09){return _[_0x86ad('0x102')](_0x153e09);});}else{return!![];}})['then'](function(_0x3439b0){var _0x1cb7bd=fs[_0x86ad('0xd4')](path[_0x86ad('0x7c')](config[_0x86ad('0x7d')],'server/files/chat/iframe.js'),'utf8');var _0x3f9b41={'remote':_0x206ff2[_0x86ad('0x103')],'query':querystring['stringify'](_[_0x86ad('0x54')](_0x206ff2['get']({'plain':!![]}),{'customerIp':_0x45a097[_0x86ad('0x8d')]['x-forwarded-for']||_0x45a097[_0x86ad('0x8d')][_0x86ad('0x104')]||_0x45a097[_0x86ad('0x105')]['remoteAddress']||_0x45a097['ip'],'referer':_0x45a097[_0x86ad('0x8d')][_0x86ad('0xaf')],'openedInteractions':_0x2bb3b5,'maxInteractions':_0x584fde,'virtual':_0x53703b[_0x86ad('0xfe')],'online':_0x3439b0,'custom':_0x53703b}))[_0x86ad('0x106')](/'/g,'\x5c\x27')};_0x5a0037['send'](ejs[_0x86ad('0x107')](Mustache[_0x86ad('0x107')](_0x1cb7bd,_0x3f9b41),{'proactiveActions':_0x4e6f68,'alignment':_0x206ff2[_0x86ad('0x108')],'verticalAlignment':_0x206ff2[_0x86ad('0x109')],'div_color':_0x206ff2[_0x86ad('0xef')],'text_color':_0x206ff2[_0x86ad('0x10a')]}));})[_0x86ad('0x2c')](handleError(_0x5a0037,null));};exports[_0x86ad('0x10b')]=function(_0x387a47,_0x34252e,_0x48d321){return db[_0x86ad('0x56')][_0x86ad('0x6e')]({'where':{'id':_0x387a47[_0x86ad('0x5c')]['id']}})['then'](handleEntityNotFound(_0x34252e,null))[_0x86ad('0x21')](function(_0x1105e2){if(_0x1105e2){return db[_0x86ad('0x10c')]['transaction'](function(_0xf5faa1){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x387a47['params']['id']},'transaction':_0xf5faa1})[_0x86ad('0x21')](function(_0x27d991){var _0x5b9694=_[_0x86ad('0x52')](_0x387a47[_0x86ad('0x61')],function(_0x573030){_0x573030['ChatWebsiteId']=_0x387a47['params']['id'];return _0x573030;});return db[_0x86ad('0xa0')][_0x86ad('0x10d')](_0x5b9694,{'transaction':_0xf5faa1});});})['then'](function(){return db[_0x86ad('0xa0')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x387a47[_0x86ad('0x5c')]['id']},'order':_0x86ad('0xa6')});});}})[_0x86ad('0x21')](respondWithResult(_0x34252e,null))[_0x86ad('0x2c')](handleError(_0x34252e,null));};exports[_0x86ad('0x10e')]=function(_0x4e7cd3,_0x2533d4,_0x2c1c24){var _0x3ff100={};var _0x3ffdd4={};var _0x1e963e;var _0x8ebccc;return db[_0x86ad('0x56')][_0x86ad('0x6e')]({'where':{'id':_0x4e7cd3['params']['id']}})['then'](handleEntityNotFound(_0x2533d4,null))['then'](function(_0x51c516){if(_0x51c516){_0x1e963e=_0x51c516;_0x3ffdd4['model']=_[_0x86ad('0x5e')](db['ChatApplication']['rawAttributes']);_0x3ffdd4[_0x86ad('0x44')]=_[_0x86ad('0x5e')](_0x4e7cd3[_0x86ad('0x44')]);_0x3ffdd4['filters']=_['intersection'](_0x3ffdd4[_0x86ad('0x46')],_0x3ffdd4['query']);_0x3ff100[_0x86ad('0x47')]=_[_0x86ad('0x48')](_0x3ffdd4['model'],qs['fields'](_0x4e7cd3['query'][_0x86ad('0x49')]));_0x3ff100[_0x86ad('0x47')]=_0x3ff100['attributes'][_0x86ad('0x4a')]?_0x3ff100[_0x86ad('0x47')]:_0x3ffdd4[_0x86ad('0x46')];_0x3ff100[_0x86ad('0x4d')]=qs[_0x86ad('0x4e')](_0x4e7cd3['query']['sort']);_0x3ff100['where']=qs[_0x86ad('0x45')](_[_0x86ad('0x50')](_0x4e7cd3['query'],_0x3ffdd4[_0x86ad('0x45')]));if(_0x4e7cd3['query']['filter']){_0x3ff100['where']=_[_0x86ad('0x54')](_0x3ff100[_0x86ad('0x4f')],{'$or':_[_0x86ad('0x52')](_0x3ff100['attributes'],function(_0x2771c){var _0x5f40c5={};_0x5f40c5[_0x2771c]={'$like':'%'+_0x4e7cd3[_0x86ad('0x44')][_0x86ad('0x51')]+'%'};return _0x5f40c5;})});}_0x3ff100=_[_0x86ad('0x54')]({},_0x3ff100,_0x4e7cd3[_0x86ad('0x55')]);return _0x1e963e['getApplications'](_0x3ff100);}})[_0x86ad('0x21')](function(_0x56ef77){if(_0x56ef77){_0x8ebccc=_0x56ef77[_0x86ad('0x4a')];if(!_0x4e7cd3[_0x86ad('0x44')][_0x86ad('0x4b')](_0x86ad('0x4c'))){_0x3ff100[_0x86ad('0x32')]=qs[_0x86ad('0x32')](_0x4e7cd3[_0x86ad('0x44')][_0x86ad('0x32')]);_0x3ff100['offset']=qs[_0x86ad('0x31')](_0x4e7cd3[_0x86ad('0x44')][_0x86ad('0x31')]);}return _0x1e963e['getApplications'](_0x3ff100);}})[_0x86ad('0x21')](function(_0x588f45){if(_0x588f45){return _0x588f45?{'count':_0x8ebccc,'rows':_0x588f45}:null;}})[_0x86ad('0x21')](respondWithResult(_0x2533d4,null))['catch'](handleError(_0x2533d4,null));};exports[_0x86ad('0x10f')]=function(_0x274d29,_0x55422c,_0x1ba115){return db['chatProactiveAction'][_0x86ad('0x5f')]({'where':{'id':_0x274d29[_0x86ad('0x5c')]['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x55422c,null))['then'](function(_0x508c99){if(_0x508c99){return _0x508c99['addProactiveActions'](_0x274d29['body'][_0x86ad('0x73')],_[_0x86ad('0xe8')](_0x274d29[_0x86ad('0x61')],[_0x86ad('0x73'),'id'])||{});}})[_0x86ad('0x21')](respondWithResult(_0x55422c,null))['catch'](handleError(_0x55422c,null));};exports[_0x86ad('0xfc')]=function(_0x2b6e8f,_0x33914c,_0x129956){var _0x4d174b={};var _0x4faeb5={};var _0xb1079e;var _0x10004b;return db[_0x86ad('0x56')]['findOne']({'where':{'id':_0x2b6e8f[_0x86ad('0x5c')]['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x33914c,null))[_0x86ad('0x21')](function(_0x4aa2c6){if(_0x4aa2c6){_0xb1079e=_0x4aa2c6;_0x4faeb5[_0x86ad('0x46')]=_[_0x86ad('0x5e')](db['ChatProactiveAction'][_0x86ad('0x40')]);_0x4faeb5[_0x86ad('0x44')]=_[_0x86ad('0x5e')](_0x2b6e8f[_0x86ad('0x44')]);_0x4faeb5[_0x86ad('0x45')]=_['intersection'](_0x4faeb5[_0x86ad('0x46')],_0x4faeb5[_0x86ad('0x44')]);_0x4d174b[_0x86ad('0x47')]=_[_0x86ad('0x48')](_0x4faeb5['model'],qs[_0x86ad('0x49')](_0x2b6e8f[_0x86ad('0x44')][_0x86ad('0x49')]));_0x4d174b['attributes']=_0x4d174b['attributes'][_0x86ad('0x4a')]?_0x4d174b[_0x86ad('0x47')]:_0x4faeb5['model'];_0x4d174b[_0x86ad('0x4d')]=qs[_0x86ad('0x4e')](_0x2b6e8f[_0x86ad('0x44')][_0x86ad('0x4e')]);_0x4d174b[_0x86ad('0x4f')]=qs[_0x86ad('0x45')](_[_0x86ad('0x50')](_0x2b6e8f[_0x86ad('0x44')],_0x4faeb5['filters']));if(_0x2b6e8f[_0x86ad('0x44')][_0x86ad('0x51')]){_0x4d174b['where']=_['merge'](_0x4d174b['where'],{'$or':_[_0x86ad('0x52')](_0x4d174b[_0x86ad('0x47')],function(_0x69dcb3){var _0x4a854e={};_0x4a854e[_0x69dcb3]={'$like':'%'+_0x2b6e8f['query'][_0x86ad('0x51')]+'%'};return _0x4a854e;})});}_0x4d174b=_[_0x86ad('0x54')]({},_0x4d174b,_0x2b6e8f[_0x86ad('0x55')]);return _0xb1079e['getProactiveActions'](_0x4d174b);}})['then'](function(_0x235c77){if(_0x235c77){_0x10004b=_0x235c77['length'];if(!_0x2b6e8f['query'][_0x86ad('0x4b')](_0x86ad('0x4c'))){_0x4d174b['limit']=qs[_0x86ad('0x32')](_0x2b6e8f[_0x86ad('0x44')]['limit']);_0x4d174b['offset']=qs[_0x86ad('0x31')](_0x2b6e8f[_0x86ad('0x44')]['offset']);}return _0xb1079e[_0x86ad('0xfc')](_0x4d174b);}})[_0x86ad('0x21')](function(_0x4d15f9){if(_0x4d15f9){return _0x4d15f9?{'count':_0x10004b,'rows':_0x4d15f9}:null;}})[_0x86ad('0x21')](respondWithResult(_0x33914c,null))[_0x86ad('0x2c')](handleError(_0x33914c,null));};exports[_0x86ad('0x110')]=function(_0x1ce300,_0x3496e2,_0x36db19){var _0xc6df02=_0x1ce300[_0x86ad('0x44')][_0x86ad('0x111')]==='false'?_0x86ad('0x112'):_0x86ad('0x113');return db[_0x86ad('0x56')][_0x86ad('0x5f')]({'attributes':['id',_0xc6df02],'where':{'id':_0x1ce300['params']['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x3496e2,null))[_0x86ad('0x21')](function(_0x3a2f5b){if(_0x3a2f5b){var _0x5cd6ba=_0x3a2f5b[_0xc6df02];var _0xd8bca1=_0x5cd6ba&&_0x5cd6ba[_0x86ad('0x114')]?_0x5cd6ba[_0x86ad('0x114')]:[];_0x3496e2['send']({'fromKey':_[_0x86ad('0x82')](_0x5cd6ba[_0x86ad('0x115')])?undefined:_0x5cd6ba[_0x86ad('0x115')],'count':_0xd8bca1[_0x86ad('0x4a')],'rows':_0xd8bca1});}})[_0x86ad('0x2c')](handleError(_0x3496e2,null));};exports['getOfflineMessages']=function(_0x8e9ba8,_0x4aae92,_0x39dbd1){var _0x1720ed={'raw':![],'where':{}};var _0xa18382={};var _0x2b20b6={'count':0x0,'rows':[]};return db[_0x86ad('0x56')][_0x86ad('0x6e')]({'where':{'id':_0x8e9ba8[_0x86ad('0x5c')]['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x4aae92,null))[_0x86ad('0x21')](function(_0x8de820){if(_0x8de820){_0xa18382[_0x86ad('0x46')]=_[_0x86ad('0x5e')](db['ChatOfflineMessage'][_0x86ad('0x40')]);_0xa18382[_0x86ad('0x44')]=_[_0x86ad('0x5e')](_0x8e9ba8[_0x86ad('0x44')]);_0xa18382[_0x86ad('0x45')]=_[_0x86ad('0x48')](_0xa18382[_0x86ad('0x46')],_0xa18382[_0x86ad('0x44')]);_0x1720ed[_0x86ad('0x47')]=_[_0x86ad('0x48')](_0xa18382[_0x86ad('0x46')],qs['fields'](_0x8e9ba8['query']['fields']));_0x1720ed[_0x86ad('0x47')]=_0x1720ed[_0x86ad('0x47')][_0x86ad('0x4a')]?_0x1720ed[_0x86ad('0x47')]:_0xa18382[_0x86ad('0x46')];if(!_0x8e9ba8[_0x86ad('0x44')][_0x86ad('0x4b')](_0x86ad('0x4c'))){_0x1720ed['limit']=qs['limit'](_0x8e9ba8[_0x86ad('0x44')][_0x86ad('0x32')]);_0x1720ed['offset']=qs[_0x86ad('0x31')](_0x8e9ba8['query'][_0x86ad('0x31')]);}_0x1720ed[_0x86ad('0x4d')]=qs['sort'](_0x8e9ba8['query']['sort']);_0x1720ed['where']=qs[_0x86ad('0x45')](_[_0x86ad('0x50')](_0x8e9ba8[_0x86ad('0x44')],_0xa18382['filters']));_0x1720ed['where'][_0x86ad('0x6b')]=_0x8de820['id'];if(_0x8e9ba8[_0x86ad('0x44')]['filter']){_0x1720ed[_0x86ad('0x4f')]=_[_0x86ad('0x54')](_0x1720ed[_0x86ad('0x4f')],{'$or':_[_0x86ad('0x52')](_0x1720ed[_0x86ad('0x47')],function(_0x47afde){var _0x55d7cf={};_0x55d7cf[_0x47afde]={'$like':'%'+_0x8e9ba8['query'][_0x86ad('0x51')]+'%'};return _0x55d7cf;})});}_0x1720ed=_[_0x86ad('0x54')]({},_0x1720ed,_0x8e9ba8[_0x86ad('0x55')]);return db[_0x86ad('0xd9')]['count']({'where':_0x1720ed[_0x86ad('0x4f')]})['then'](function(_0x5c097d){_0x2b20b6[_0x86ad('0x30')]=_0x5c097d;if(_0x8e9ba8[_0x86ad('0x44')][_0x86ad('0x57')]){_0x1720ed[_0x86ad('0x58')]=[{'all':!![]}];}else{_0x1720ed[_0x86ad('0x58')]=[{'model':db[_0x86ad('0x9f')],'as':_0x86ad('0xea'),'required':![]}];}return db[_0x86ad('0xd9')][_0x86ad('0x59')](_0x1720ed);})[_0x86ad('0x21')](function(_0xdc365e){_0x2b20b6['rows']=_0xdc365e;return _0x2b20b6;});}})['then'](respondWithFilteredResult(_0x4aae92,_0x1720ed))[_0x86ad('0x2c')](handleError(_0x4aae92,null));};exports[_0x86ad('0x116')]=function(_0x12bc36,_0x14d575,_0x25cb44){return db[_0x86ad('0x56')][_0x86ad('0x5f')]({'where':{'id':_0x12bc36[_0x86ad('0x5c')]['id']}})['then'](handleEntityNotFound(_0x14d575,null))[_0x86ad('0x21')](function(_0x5aa324){if(_0x5aa324){return _0x5aa324[_0x86ad('0x116')](_0x12bc36[_0x86ad('0x61')]['ids'],_['omit'](_0x12bc36['body'],['ids','id'])||{})[_0x86ad('0xbd')](function(_0x2b5a65){for(var _0x38b7a9=0x0;_0x38b7a9<_0x12bc36[_0x86ad('0x61')][_0x86ad('0x73')][_0x86ad('0x4a')];_0x38b7a9+=0x1){socket['emit'](_0x86ad('0x117'),{'UserId':_0x12bc36[_0x86ad('0x61')]['ids'][_0x38b7a9],'ChatWebsiteId':_0x12bc36['params']['id']});}return _0x2b5a65;});}})[_0x86ad('0x21')](respondWithResult(_0x14d575,null))[_0x86ad('0x2c')](handleError(_0x14d575,null));};exports[_0x86ad('0x118')]=function(_0x51fc09,_0x3c0035,_0x629ec1){return db[_0x86ad('0x56')][_0x86ad('0x5f')]({'where':{'id':_0x51fc09[_0x86ad('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3c0035,null))[_0x86ad('0x21')](function(_0x206117){if(_0x206117){return _0x206117['removeAgents'](_0x51fc09[_0x86ad('0x44')]['ids'])[_0x86ad('0x21')](function(){if(_[_0x86ad('0x119')](_0x51fc09[_0x86ad('0x44')][_0x86ad('0x73')])){for(var _0x50a323=0x0;_0x50a323<_0x51fc09[_0x86ad('0x44')][_0x86ad('0x73')][_0x86ad('0x4a')];_0x50a323+=0x1){socket[_0x86ad('0x11a')](_0x86ad('0x11b'),{'UserId':Number(_0x51fc09[_0x86ad('0x44')][_0x86ad('0x73')][_0x50a323]),'ChatWebsiteId':Number(_0x51fc09['params']['id'])});}}else{socket['emit'](_0x86ad('0x11b'),{'UserId':Number(_0x51fc09[_0x86ad('0x44')]['ids']),'ChatWebsiteId':Number(_0x51fc09[_0x86ad('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x3c0035,null))[_0x86ad('0x2c')](handleError(_0x3c0035,null));};exports[_0x86ad('0x11c')]=function(_0x375cf4,_0x1194de,_0x288bd1){var _0x4cb275={};var _0x9ca5e4={};var _0x10910b;var _0x1bbbca;return db['ChatWebsite'][_0x86ad('0x6e')]({'where':{'id':_0x375cf4['params']['id']}})[_0x86ad('0x21')](handleEntityNotFound(_0x1194de,null))[_0x86ad('0x21')](function(_0x12a1e8){if(_0x12a1e8){_0x10910b=_0x12a1e8;_0x9ca5e4[_0x86ad('0x46')]=_['keys'](db[_0x86ad('0xeb')][_0x86ad('0x40')]);_0x9ca5e4[_0x86ad('0x44')]=_['keys'](_0x375cf4[_0x86ad('0x44')]);_0x9ca5e4['filters']=_[_0x86ad('0x48')](_0x9ca5e4['model'],_0x9ca5e4[_0x86ad('0x44')]);_0x4cb275[_0x86ad('0x47')]=_[_0x86ad('0x48')](_0x9ca5e4[_0x86ad('0x46')],qs[_0x86ad('0x49')](_0x375cf4[_0x86ad('0x44')]['fields']));_0x4cb275[_0x86ad('0x47')]=_0x4cb275[_0x86ad('0x47')][_0x86ad('0x4a')]?_0x4cb275[_0x86ad('0x47')]:_0x9ca5e4[_0x86ad('0x46')];_0x4cb275['order']=qs[_0x86ad('0x4e')](_0x375cf4['query']['sort']);_0x4cb275[_0x86ad('0x4f')]=qs[_0x86ad('0x45')](_[_0x86ad('0x50')](_0x375cf4[_0x86ad('0x44')],_0x9ca5e4['filters']));if(_0x375cf4['query'][_0x86ad('0x51')]){_0x4cb275[_0x86ad('0x4f')]=_[_0x86ad('0x54')](_0x4cb275[_0x86ad('0x4f')],{'$or':_[_0x86ad('0x52')](_0x4cb275[_0x86ad('0x47')],function(_0x17ad02){var _0x372cce={};_0x372cce[_0x17ad02]={'$like':'%'+_0x375cf4[_0x86ad('0x44')][_0x86ad('0x51')]+'%'};return _0x372cce;})});}_0x4cb275=_[_0x86ad('0x54')]({},_0x4cb275,_0x375cf4['options']);return _0x10910b[_0x86ad('0x11c')](_0x4cb275);}})[_0x86ad('0x21')](function(_0x5ddc14){if(_0x5ddc14){_0x1bbbca=_0x5ddc14[_0x86ad('0x4a')];if(!_0x375cf4[_0x86ad('0x44')][_0x86ad('0x4b')](_0x86ad('0x4c'))){_0x4cb275['limit']=qs[_0x86ad('0x32')](_0x375cf4['query']['limit']);_0x4cb275[_0x86ad('0x31')]=qs[_0x86ad('0x31')](_0x375cf4['query'][_0x86ad('0x31')]);}return _0x10910b[_0x86ad('0x11c')](_0x4cb275);}})[_0x86ad('0x21')](function(_0x2f6dab){if(_0x2f6dab){return _0x2f6dab?{'count':_0x1bbbca,'rows':_0x2f6dab}:null;}})[_0x86ad('0x21')](respondWithResult(_0x1194de,null))[_0x86ad('0x2c')](handleError(_0x1194de,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 06c8e23..58e7178 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 _0x4f82=['../../mysqldb','setMaxListeners','update','emit','hook','exports','events'];(function(_0x51cc31,_0x1cc5e1){var _0x52befc=function(_0x472952){while(--_0x472952){_0x51cc31['push'](_0x51cc31['shift']());}};_0x52befc(++_0x1cc5e1);}(_0x4f82,0xbc));var _0x24f8=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x4f82[_0x2df507];return _0x1f7167;};'use strict';var EventEmitter=require(_0x24f8('0x0'));var ChatWebsite=require(_0x24f8('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x24f8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x24f8('0x3'),'afterDestroy':'remove'};function emitEvent(_0x28802e){return function(_0x555fab,_0x39b5e0,_0x4093e2){ChatWebsiteEvents[_0x24f8('0x4')](_0x28802e+':'+_0x555fab['id'],_0x555fab);ChatWebsiteEvents[_0x24f8('0x4')](_0x28802e,_0x555fab);_0x4093e2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x24f8('0x5')](e,emitEvent(event));}}module[_0x24f8('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0x84ab=['../../mysqldb','ChatWebsite','setMaxListeners','save','remove','emit','exports','events'];(function(_0x4555d1,_0x3ac745){var _0x154a85=function(_0x4dfedc){while(--_0x4dfedc){_0x4555d1['push'](_0x4555d1['shift']());}};_0x154a85(++_0x3ac745);}(_0x84ab,0x12f));var _0xb84a=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0x84ab[_0x27d958];return _0x53e63e;};'use strict';var EventEmitter=require(_0xb84a('0x0'));var ChatWebsite=require(_0xb84a('0x1'))['db'][_0xb84a('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xb84a('0x3')](0x0);var events={'afterCreate':_0xb84a('0x4'),'afterUpdate':'update','afterDestroy':_0xb84a('0x5')};function emitEvent(_0x18a4a5){return function(_0x47b8e3,_0x9d3a00,_0xe72ccd){ChatWebsiteEvents[_0xb84a('0x6')](_0x18a4a5+':'+_0x47b8e3['id'],_0x47b8e3);ChatWebsiteEvents['emit'](_0x18a4a5,_0x47b8e3);_0xe72ccd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xb84a('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index d9111b4..83303bb 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 _0xbb53=['define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5e1722,_0x31a78e){var _0x4450c3=function(_0x258248){while(--_0x258248){_0x5e1722['push'](_0x5e1722['shift']());}};_0x4450c3(++_0x31a78e);}(_0xbb53,0x121));var _0x3bb5=function(_0x249a0e,_0x3f63ce){_0x249a0e=_0x249a0e-0x0;var _0xf83420=_0xbb53[_0x249a0e];return _0xf83420;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var logger=require(_0x3bb5('0x2'))(_0x3bb5('0x3'));var moment=require(_0x3bb5('0x4'));var BPromise=require(_0x3bb5('0x5'));var rp=require(_0x3bb5('0x6'));var fs=require('fs');var path=require(_0x3bb5('0x7'));var rimraf=require(_0x3bb5('0x8'));var config=require(_0x3bb5('0x9'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x23f11e,_0x2460b0){return _0x23f11e[_0x3bb5('0xa')](_0x3bb5('0xb'),attributes,{'tableName':_0x3bb5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd404=['util','api','moment','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','chat_websites','lodash'];(function(_0x919445,_0x5467dc){var _0x511b3e=function(_0xde10f3){while(--_0xde10f3){_0x919445['push'](_0x919445['shift']());}};_0x511b3e(++_0x5467dc);}(_0xd404,0x15b));var _0x4d40=function(_0x4179e2,_0xf2dbb){_0x4179e2=_0x4179e2-0x0;var _0x24cb50=_0xd404[_0x4179e2];return _0x24cb50;};'use strict';var _=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var logger=require('../../config/logger')(_0x4d40('0x2'));var moment=require(_0x4d40('0x3'));var BPromise=require('bluebird');var rp=require(_0x4d40('0x4'));var fs=require('fs');var path=require(_0x4d40('0x5'));var rimraf=require(_0x4d40('0x6'));var config=require(_0x4d40('0x7'));var attributes=require(_0x4d40('0x8'));module[_0x4d40('0x9')]=function(_0xc2a9db,_0x24a237){return _0xc2a9db[_0x4d40('0xa')]('ChatWebsite',attributes,{'tableName':_0x4d40('0xb'),'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 98467b3..23be01e 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 _0x33af=['result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x30be28,_0x53288a){var _0x2c8096=function(_0x302549){while(--_0x302549){_0x30be28['push'](_0x30be28['shift']());}};_0x2c8096(++_0x53288a);}(_0x33af,0xec));var _0xf33a=function(_0x31daa8,_0x291f42){_0x31daa8=_0x31daa8-0x0;var _0x379d4c=_0x33af[_0x31daa8];return _0x379d4c;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});config[_0xf33a('0xa')]=_[_0xf33a('0xb')](config[_0xf33a('0xa')],{'host':_0xf33a('0xc'),'port':0x18eb});var socket=require(_0xf33a('0xd'))(new Redis(config['redis']));require(_0xf33a('0xe'))[_0xf33a('0xf')](socket);function respondWithRpcPromise(_0x115e08,_0x457b3b,_0x44ee7f){return new BPromise(function(_0x27f30a,_0x5074a2){return client['request'](_0x115e08,_0x44ee7f)[_0xf33a('0x10')](function(_0xb47cde){logger[_0xf33a('0x11')](_0xf33a('0x12'),_0x457b3b,_0xf33a('0x13'));logger['debug'](_0xf33a('0x14'),_0x457b3b,_0xf33a('0x13'),JSON['stringify'](_0xb47cde));if(_0xb47cde['error']){if(_0xb47cde[_0xf33a('0x15')][_0xf33a('0x16')]===0x1f4){logger[_0xf33a('0x15')](_0xf33a('0x12'),_0x457b3b,_0xb47cde[_0xf33a('0x15')][_0xf33a('0x17')]);return _0x5074a2(_0xb47cde[_0xf33a('0x15')][_0xf33a('0x17')]);}logger['error'](_0xf33a('0x12'),_0x457b3b,_0xb47cde['error'][_0xf33a('0x17')]);return _0x27f30a(_0xb47cde[_0xf33a('0x15')]['message']);}else{logger[_0xf33a('0x11')](_0xf33a('0x12'),_0x457b3b,'request\x20sent');_0x27f30a(_0xb47cde[_0xf33a('0x18')][_0xf33a('0x17')]);}})[_0xf33a('0x19')](function(_0x2a9f0e){logger['error'](_0xf33a('0x12'),_0x457b3b,_0x2a9f0e);_0x5074a2(_0x2a9f0e);});});} \ No newline at end of file +var _0x7880=['defaults','localhost','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7880,0x1f4));var _0x0788=function(_0x252ef1,_0x2e0041){_0x252ef1=_0x252ef1-0x0;var _0x25817c=_0x7880[_0x252ef1];return _0x25817c;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));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(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});config[_0x0788('0xc')]=_[_0x0788('0xd')](config[_0x0788('0xc')],{'host':_0x0788('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0788('0xc')]));require('./chatWebsite.socket')[_0x0788('0xf')](socket);function respondWithRpcPromise(_0x53b2f2,_0x433c26,_0x3c6d18){return new BPromise(function(_0x1f9ff6,_0xee8670){return client[_0x0788('0x10')](_0x53b2f2,_0x3c6d18)['then'](function(_0x1920b3){logger[_0x0788('0x11')](_0x0788('0x12'),_0x433c26,_0x0788('0x13'));logger[_0x0788('0x14')](_0x0788('0x15'),_0x433c26,_0x0788('0x13'),JSON['stringify'](_0x1920b3));if(_0x1920b3[_0x0788('0x16')]){if(_0x1920b3[_0x0788('0x16')][_0x0788('0x17')]===0x1f4){logger[_0x0788('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x433c26,_0x1920b3[_0x0788('0x16')]['message']);return _0xee8670(_0x1920b3[_0x0788('0x16')][_0x0788('0x18')]);}logger[_0x0788('0x16')](_0x0788('0x12'),_0x433c26,_0x1920b3[_0x0788('0x16')][_0x0788('0x18')]);return _0x1f9ff6(_0x1920b3['error']['message']);}else{logger[_0x0788('0x11')](_0x0788('0x12'),_0x433c26,'request\x20sent');_0x1f9ff6(_0x1920b3[_0x0788('0x19')][_0x0788('0x18')]);}})[_0x0788('0x1a')](function(_0x52c339){logger[_0x0788('0x16')](_0x0788('0x12'),_0x433c26,_0x52c339);_0xee8670(_0x52c339);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index c4159b0..f21e530 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 _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x33df1a,_0x16add1){var _0x9a1753=function(_0x5b4956){while(--_0x5b4956){_0x33df1a['push'](_0x33df1a['shift']());}};_0x9a1753(++_0x16add1);}(_0x7a54,0x106));var _0x47a5=function(_0x4cc2c5,_0x3f84ba){_0x4cc2c5=_0x4cc2c5-0x0;var _0x27a50c=_0x7a54[_0x4cc2c5];return _0x27a50c;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x4ebdf4,_0x57d47f){var _0x18d1c1=function(_0x83f2a0){while(--_0x83f2a0){_0x4ebdf4['push'](_0x4ebdf4['shift']());}};_0x18d1c1(++_0x57d47f);}(_0xb10b,0x12a));var _0xbb10=function(_0x193a6e,_0x45dd00){_0x193a6e=_0x193a6e-0x0;var _0x599a9b=_0xb10b[_0x193a6e];return _0x599a9b;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 12e9c7d..a10f0b9 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 _0xc106=['removeDispositions','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getAgents','addDisposition','post','join','root','format','%s-%s','now','originalname','single','file','diskStorage','server/files/images/avatars/','addAvatar','addSystemAvatar','notify','/:id/offline','offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','/:id/users','addAgents','put','update','delete','destroy'];(function(_0xb9ccf0,_0xe5fb7b){var _0x36b619=function(_0x1905f0){while(--_0x1905f0){_0xb9ccf0['push'](_0xb9ccf0['shift']());}};_0x36b619(++_0xe5fb7b);}(_0xc106,0x17d));var _0x6c10=function(_0x4ef486,_0x34aab6){_0x4ef486=_0x4ef486-0x0;var _0x4ffdd1=_0xc106[_0x4ef486];return _0x4ffdd1;};'use strict';var multer=require(_0x6c10('0x0'));var util=require(_0x6c10('0x1'));var path=require(_0x6c10('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c10('0x3'));var router=express[_0x6c10('0x4')]();var auth=require(_0x6c10('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6c10('0x6'));var controller=require(_0x6c10('0x7'));router['get']('/',auth[_0x6c10('0x8')](),controller[_0x6c10('0x9')]);router[_0x6c10('0xa')](_0x6c10('0xb'),auth[_0x6c10('0x8')](),controller['describe']);router['get'](_0x6c10('0xc'),auth[_0x6c10('0x8')](),controller['show']);router[_0x6c10('0xa')](_0x6c10('0xd'),auth[_0x6c10('0x8')](),controller['getDispositions']);router[_0x6c10('0xa')](_0x6c10('0xe'),auth[_0x6c10('0x8')](),controller[_0x6c10('0xf')]);router[_0x6c10('0xa')](_0x6c10('0x10'),controller[_0x6c10('0x11')]);router[_0x6c10('0xa')](_0x6c10('0x12'),controller[_0x6c10('0x13')]);router[_0x6c10('0xa')](_0x6c10('0x14'),controller[_0x6c10('0x15')]);router[_0x6c10('0xa')](_0x6c10('0x16'),controller[_0x6c10('0x17')]);router[_0x6c10('0xa')]('/:id/interactions',auth[_0x6c10('0x8')](),controller[_0x6c10('0x18')]);router['get'](_0x6c10('0x19'),controller[_0x6c10('0x1a')]);router[_0x6c10('0xa')](_0x6c10('0x1b'),auth['isAuthenticated'](),controller['getApplications']);router[_0x6c10('0xa')](_0x6c10('0x1c'),auth[_0x6c10('0x8')](),controller[_0x6c10('0x1d')]);router['get'](_0x6c10('0x1e'),controller['getFields']);router['get'](_0x6c10('0x1f'),auth[_0x6c10('0x8')](),controller['getOfflineMessages']);router['get']('/:id/users',auth[_0x6c10('0x8')](),controller[_0x6c10('0x20')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/dispositions',auth[_0x6c10('0x8')](),controller[_0x6c10('0x21')]);router[_0x6c10('0x22')](_0x6c10('0xe'),auth[_0x6c10('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5ec980,_0x3b1c21,_0x54b3c5){_0x54b3c5(null,path[_0x6c10('0x23')](config[_0x6c10('0x24')],'server/files/images/logos/'));},'filename':function(_0x3c85c9,_0x4421af,_0x5cdb50){_0x5cdb50(null,util[_0x6c10('0x25')](_0x6c10('0x26'),Date[_0x6c10('0x27')](),_0x4421af[_0x6c10('0x28')]));}})});router['post'](_0x6c10('0x10'),upload[_0x6c10('0x29')](_0x6c10('0x2a')),controller['addLogo']);var upload=multer({'storage':multer[_0x6c10('0x2b')]({'destination':function(_0x29059d,_0x5902d0,_0x128418){_0x128418(null,path[_0x6c10('0x23')](config[_0x6c10('0x24')],_0x6c10('0x2c')));},'filename':function(_0x12da09,_0x502d74,_0x52d5de){_0x52d5de(null,util[_0x6c10('0x25')](_0x6c10('0x26'),Date[_0x6c10('0x27')](),_0x502d74[_0x6c10('0x28')]));}})});router[_0x6c10('0x22')](_0x6c10('0x12'),upload[_0x6c10('0x29')](_0x6c10('0x2a')),controller[_0x6c10('0x2d')]);var upload=multer({'storage':multer[_0x6c10('0x2b')]({'destination':function(_0x546376,_0x23032e,_0x416743){_0x416743(null,path[_0x6c10('0x23')](config[_0x6c10('0x24')],_0x6c10('0x2c')));},'filename':function(_0x16d800,_0xc3d900,_0x3ae0e4){_0x3ae0e4(null,util[_0x6c10('0x25')]('%s-%s',Date[_0x6c10('0x27')](),_0xc3d900[_0x6c10('0x28')]));}})});router[_0x6c10('0x22')](_0x6c10('0x14'),upload[_0x6c10('0x29')](_0x6c10('0x2a')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x6c10('0x2b')]({'destination':function(_0x4d588a,_0x40e7ce,_0x511fc5){_0x511fc5(null,path[_0x6c10('0x23')](config[_0x6c10('0x24')],_0x6c10('0x2c')));},'filename':function(_0x5eaa48,_0x2673b6,_0x25d7db){_0x25d7db(null,util['format'](_0x6c10('0x26'),Date[_0x6c10('0x27')](),_0x2673b6['originalname']));}})});router[_0x6c10('0x22')](_0x6c10('0x16'),upload[_0x6c10('0x29')](_0x6c10('0x2a')),controller[_0x6c10('0x2e')]);router['post']('/:id/notify',controller[_0x6c10('0x2f')]);router['post'](_0x6c10('0x30'),controller[_0x6c10('0x31')]);router[_0x6c10('0x22')](_0x6c10('0x32'),auth[_0x6c10('0x8')](),controller[_0x6c10('0x33')]);router[_0x6c10('0x22')](_0x6c10('0x1b'),auth['isAuthenticated'](),controller[_0x6c10('0x34')]);router['post'](_0x6c10('0x1c'),auth['isAuthenticated'](),controller[_0x6c10('0x35')]);router[_0x6c10('0x22')](_0x6c10('0x36'),auth[_0x6c10('0x8')](),controller[_0x6c10('0x37')]);router[_0x6c10('0x38')](_0x6c10('0xc'),auth['isAuthenticated'](),controller[_0x6c10('0x39')]);router[_0x6c10('0x3a')]('/:id',auth[_0x6c10('0x8')](),controller[_0x6c10('0x3b')]);router['delete'](_0x6c10('0xd'),auth['isAuthenticated'](),controller[_0x6c10('0x3c')]);router[_0x6c10('0x3a')](_0x6c10('0xe'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x6c10('0x3a')](_0x6c10('0x36'),auth[_0x6c10('0x8')](),controller[_0x6c10('0x3d')]);module[_0x6c10('0x3e')]=router; \ No newline at end of file +var _0x81a8=['getCustomerAvatar','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar','/:id/customer_avatar','addCustomerAvatar','/:id/system_avatar','notify','/:id/offline','/:id/interactions','addInteraction','/:id/proactive_actions','/:id/users','addAgents','put','/:id','update','delete','destroy','removeAgents','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x81a8,0x1cf));var _0x881a=function(_0x3eff21,_0x5bf36c){_0x3eff21=_0x3eff21-0x0;var _0x1945bb=_0x81a8[_0x3eff21];return _0x1945bb;};'use strict';var multer=require('multer');var util=require(_0x881a('0x0'));var path=require(_0x881a('0x1'));var timeout=require('connect-timeout');var express=require(_0x881a('0x2'));var router=express['Router']();var auth=require(_0x881a('0x3'));var interaction=require(_0x881a('0x4'));var config=require(_0x881a('0x5'));var controller=require('./chatWebsite.controller');router[_0x881a('0x6')]('/',auth[_0x881a('0x7')](),controller[_0x881a('0x8')]);router[_0x881a('0x6')](_0x881a('0x9'),auth[_0x881a('0x7')](),controller['describe']);router[_0x881a('0x6')]('/:id',auth[_0x881a('0x7')](),controller[_0x881a('0xa')]);router[_0x881a('0x6')](_0x881a('0xb'),auth['isAuthenticated'](),controller[_0x881a('0xc')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x881a('0xd')]);router[_0x881a('0x6')](_0x881a('0xe'),controller[_0x881a('0xf')]);router['get'](_0x881a('0x10'),controller['getAvatar']);router[_0x881a('0x6')]('/:id/customer_avatar',controller[_0x881a('0x11')]);router[_0x881a('0x6')]('/:id/system_avatar',controller['getSystemAvatar']);router['get']('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0x881a('0x6')]('/:id/snippet',controller[_0x881a('0x12')]);router['get'](_0x881a('0x13'),auth[_0x881a('0x7')](),controller[_0x881a('0x14')]);router[_0x881a('0x6')]('/:id/proactive_actions',auth[_0x881a('0x7')](),controller[_0x881a('0x15')]);router[_0x881a('0x6')](_0x881a('0x16'),controller[_0x881a('0x17')]);router['get'](_0x881a('0x18'),auth[_0x881a('0x7')](),controller[_0x881a('0x19')]);router[_0x881a('0x6')]('/:id/users',auth[_0x881a('0x7')](),controller[_0x881a('0x1a')]);router['post']('/',auth[_0x881a('0x7')](),controller['create']);router[_0x881a('0x1b')](_0x881a('0xb'),auth[_0x881a('0x7')](),controller['addDisposition']);router[_0x881a('0x1b')](_0x881a('0x1c'),auth[_0x881a('0x7')](),controller[_0x881a('0x1d')]);var upload=multer({'storage':multer[_0x881a('0x1e')]({'destination':function(_0x3d89e6,_0x3a8661,_0x195ffa){_0x195ffa(null,path[_0x881a('0x1f')](config[_0x881a('0x20')],_0x881a('0x21')));},'filename':function(_0x460c20,_0x42f75c,_0x111fa8){_0x111fa8(null,util[_0x881a('0x22')](_0x881a('0x23'),Date[_0x881a('0x24')](),_0x42f75c[_0x881a('0x25')]));}})});router['post'](_0x881a('0xe'),upload[_0x881a('0x26')](_0x881a('0x27')),controller[_0x881a('0x28')]);var upload=multer({'storage':multer[_0x881a('0x1e')]({'destination':function(_0xa19f86,_0x3b4ce7,_0xca305d){_0xca305d(null,path[_0x881a('0x1f')](config[_0x881a('0x20')],_0x881a('0x29')));},'filename':function(_0x3d6c61,_0x3d0709,_0x127f80){_0x127f80(null,util[_0x881a('0x22')](_0x881a('0x23'),Date['now'](),_0x3d0709['originalname']));}})});router[_0x881a('0x1b')](_0x881a('0x10'),upload[_0x881a('0x26')]('file'),controller[_0x881a('0x2a')]);var upload=multer({'storage':multer[_0x881a('0x1e')]({'destination':function(_0x37e704,_0x396680,_0x242a47){_0x242a47(null,path[_0x881a('0x1f')](config[_0x881a('0x20')],_0x881a('0x29')));},'filename':function(_0x371f77,_0x4d8369,_0x31f4c1){_0x31f4c1(null,util['format'](_0x881a('0x23'),Date[_0x881a('0x24')](),_0x4d8369[_0x881a('0x25')]));}})});router[_0x881a('0x1b')](_0x881a('0x2b'),upload[_0x881a('0x26')]('file'),controller[_0x881a('0x2c')]);var upload=multer({'storage':multer[_0x881a('0x1e')]({'destination':function(_0x5b39ea,_0x161d9a,_0x4d6e0d){_0x4d6e0d(null,path[_0x881a('0x1f')](config[_0x881a('0x20')],_0x881a('0x29')));},'filename':function(_0x21663e,_0x586144,_0x45cf89){_0x45cf89(null,util[_0x881a('0x22')](_0x881a('0x23'),Date['now'](),_0x586144[_0x881a('0x25')]));}})});router[_0x881a('0x1b')](_0x881a('0x2d'),upload[_0x881a('0x26')](_0x881a('0x27')),controller['addSystemAvatar']);router[_0x881a('0x1b')]('/:id/notify',controller[_0x881a('0x2e')]);router['post'](_0x881a('0x2f'),controller['offline']);router[_0x881a('0x1b')](_0x881a('0x30'),auth['isAuthenticated'](),controller[_0x881a('0x31')]);router[_0x881a('0x1b')]('/:id/applications',auth[_0x881a('0x7')](),controller['addApplications']);router[_0x881a('0x1b')](_0x881a('0x32'),auth[_0x881a('0x7')](),controller['addProactiveActions']);router[_0x881a('0x1b')](_0x881a('0x33'),auth[_0x881a('0x7')](),controller[_0x881a('0x34')]);router[_0x881a('0x35')](_0x881a('0x36'),auth[_0x881a('0x7')](),controller[_0x881a('0x37')]);router[_0x881a('0x38')](_0x881a('0x36'),auth['isAuthenticated'](),controller[_0x881a('0x39')]);router[_0x881a('0x38')](_0x881a('0xb'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x881a('0x38')]('/:id/canned_answers',auth[_0x881a('0x7')](),controller['removeAnswers']);router[_0x881a('0x38')](_0x881a('0x33'),auth[_0x881a('0x7')](),controller[_0x881a('0x3a')]);module[_0x881a('0x3b')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index b53f6d9..99eb04a 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 _0xdc59=['sequelize','exports','STRING','Google'];(function(_0x53bc44,_0x3ba0e9){var _0x5fb9e8=function(_0x15c99d){while(--_0x15c99d){_0x53bc44['push'](_0x53bc44['shift']());}};_0x5fb9e8(++_0x3ba0e9);}(_0xdc59,0x12c));var _0x9dc5=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xdc59[_0x119d5a];return _0x15bff4;};'use strict';var Sequelize=require(_0x9dc5('0x0'));module[_0x9dc5('0x1')]={'name':{'type':Sequelize[_0x9dc5('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0x9dc5('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x9dc5('0x2')]},'data2':{'type':Sequelize[_0x9dc5('0x2')]}}; \ No newline at end of file +var _0xbd3c=['exports','STRING','AmazonAWS','Google','sequelize'];(function(_0x3ef819,_0x288818){var _0x424e3a=function(_0x113da0){while(--_0x113da0){_0x3ef819['push'](_0x3ef819['shift']());}};_0x424e3a(++_0x288818);}(_0xbd3c,0xc2));var _0xcbd3=function(_0x2f5d1f,_0x483df0){_0x2f5d1f=_0x2f5d1f-0x0;var _0x1091c2=_0xbd3c[_0x2f5d1f];return _0x1091c2;};'use strict';var Sequelize=require(_0xcbd3('0x0'));module[_0xcbd3('0x1')]={'name':{'type':Sequelize[_0xcbd3('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xcbd3('0x3'),_0xcbd3('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xcbd3('0x2')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 89c5f51..9f74f5e 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 _0x4202=['sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','catch','show','length','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CloudProvider','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','order'];(function(_0x3cf4d3,_0x48065e){var _0x4e547b=function(_0x28f85a){while(--_0x28f85a){_0x3cf4d3['push'](_0x3cf4d3['shift']());}};_0x4e547b(++_0x48065e);}(_0x4202,0xe8));var _0x2420=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0x4202[_0xb6e2ea];return _0x2a57bb;};'use strict';var pdf=require(_0x2420('0x0'));var emlformat=require(_0x2420('0x1'));var rimraf=require(_0x2420('0x2'));var zipdir=require(_0x2420('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2420('0x4'));var moment=require('moment');var BPromise=require(_0x2420('0x5'));var Mustache=require(_0x2420('0x6'));var util=require(_0x2420('0x7'));var path=require(_0x2420('0x8'));var sox=require(_0x2420('0x9'));var csv=require('to-csv');var ejs=require(_0x2420('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2420('0xb'));var crypto=require('crypto');var jsforce=require(_0x2420('0xc'));var deskjs=require(_0x2420('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2420('0xe'));var Papa=require('papaparse');var Redis=require(_0x2420('0xf'));var authService=require(_0x2420('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2420('0x11'));var hardwareService=require(_0x2420('0x12'));var logger=require(_0x2420('0x13'))(_0x2420('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2420('0x15'));var db=require(_0x2420('0x16'))['db'];function respondWithStatusCode(_0x5ac7d8,_0xfd3878){_0xfd3878=_0xfd3878||0xcc;return function(_0x46ab1e){if(_0x46ab1e){return _0x5ac7d8[_0x2420('0x17')](_0xfd3878);}return _0x5ac7d8[_0x2420('0x18')](_0xfd3878)[_0x2420('0x19')]();};}function respondWithResult(_0xd2e25e,_0x461888){_0x461888=_0x461888||0xc8;return function(_0x271c99){if(_0x271c99){return _0xd2e25e[_0x2420('0x18')](_0x461888)[_0x2420('0x1a')](_0x271c99);}};}function respondWithFilteredResult(_0x152fb1,_0x39d1fe){return function(_0x5161cd){if(_0x5161cd){var _0xce2ef0=_0x5161cd[_0x2420('0x1b')],_0x164261=_0x39d1fe[_0x2420('0x1c')],_0x2d159f=_0x39d1fe['offset']+_0x39d1fe[_0x2420('0x1d')],_0x297160;if(_0x2d159f>=_0xce2ef0){_0x2d159f=_0xce2ef0;_0x297160=0xc8;}else{_0x297160=0xce;}_0x152fb1[_0x2420('0x18')](_0x297160);return _0x152fb1[_0x2420('0x1e')](_0x2420('0x1f'),_0x164261+'-'+_0x2d159f+'/'+_0xce2ef0)[_0x2420('0x1a')](_0x5161cd);}return null;};}function patchUpdates(_0x179cdf){return function(_0x2c6a31){try{jsonpatch[_0x2420('0x20')](_0x2c6a31,_0x179cdf,!![]);}catch(_0x1afb83){return BPromise[_0x2420('0x21')](_0x1afb83);}return _0x2c6a31[_0x2420('0x22')]();};}function saveUpdates(_0x361622,_0x3c52c4){return function(_0x1620d9){if(_0x1620d9){return _0x1620d9[_0x2420('0x23')](_0x361622)[_0x2420('0x24')](function(_0xab6b00){return _0xab6b00;});}return null;};}function removeEntity(_0xc9963d,_0x453357){return function(_0x2e9542){if(_0x2e9542){return _0x2e9542[_0x2420('0x25')]()[_0x2420('0x24')](function(){_0xc9963d[_0x2420('0x18')](0xcc)[_0x2420('0x19')]();});}};}function handleEntityNotFound(_0x225ee0,_0x5d53a3){return function(_0x49e49e){if(!_0x49e49e){_0x225ee0[_0x2420('0x17')](0x194);}return _0x49e49e;};}function handleError(_0x4dd2fd,_0x56333e){_0x56333e=_0x56333e||0x1f4;return function(_0x2636d7){logger[_0x2420('0x26')](_0x2636d7[_0x2420('0x27')]);if(_0x2636d7[_0x2420('0x28')]){delete _0x2636d7['name'];}_0x4dd2fd[_0x2420('0x18')](_0x56333e)[_0x2420('0x29')](_0x2636d7);};}exports[_0x2420('0x2a')]=function(_0x1d4734,_0x2eff4f){var _0x5160c5={},_0x25630e={},_0x4cc71e={'count':0x0,'rows':[]};var _0x484e82=_[_0x2420('0x2b')](db[_0x2420('0x2c')][_0x2420('0x2d')],function(_0x51f3a1){return{'name':_0x51f3a1['fieldName'],'type':_0x51f3a1[_0x2420('0x2e')][_0x2420('0x2f')]};});_0x25630e[_0x2420('0x30')]=_['map'](_0x484e82,_0x2420('0x28'));_0x25630e['query']=_[_0x2420('0x31')](_0x1d4734[_0x2420('0x32')]);_0x25630e['filters']=_[_0x2420('0x33')](_0x25630e[_0x2420('0x30')],_0x25630e['query']);_0x5160c5['attributes']=_[_0x2420('0x33')](_0x25630e['model'],qs[_0x2420('0x34')](_0x1d4734[_0x2420('0x32')]['fields']));_0x5160c5['attributes']=_0x5160c5[_0x2420('0x35')]['length']?_0x5160c5[_0x2420('0x35')]:_0x25630e[_0x2420('0x30')];if(!_0x1d4734[_0x2420('0x32')][_0x2420('0x36')]('nolimit')){_0x5160c5['limit']=qs[_0x2420('0x1d')](_0x1d4734[_0x2420('0x32')][_0x2420('0x1d')]);_0x5160c5[_0x2420('0x1c')]=qs[_0x2420('0x1c')](_0x1d4734[_0x2420('0x32')]['offset']);}_0x5160c5[_0x2420('0x37')]=qs['sort'](_0x1d4734[_0x2420('0x32')][_0x2420('0x38')]);_0x5160c5['where']=qs['filters'](_[_0x2420('0x39')](_0x1d4734[_0x2420('0x32')],_0x25630e['filters']),_0x484e82);if(_0x1d4734[_0x2420('0x32')][_0x2420('0x3a')]){_0x5160c5['where']=_[_0x2420('0x3b')](_0x5160c5[_0x2420('0x3c')],{'$or':_[_0x2420('0x2b')](_0x484e82,function(_0x5bc1bc){if(_0x5bc1bc[_0x2420('0x2e')]!==_0x2420('0x3d')){var _0x2ef1e3={};_0x2ef1e3[_0x5bc1bc['name']]={'$like':'%'+_0x1d4734['query']['filter']+'%'};return _0x2ef1e3;}})});}_0x5160c5=_[_0x2420('0x3b')]({},_0x5160c5,_0x1d4734[_0x2420('0x3e')]);var _0x267dfb={'where':_0x5160c5[_0x2420('0x3c')]};return db[_0x2420('0x2c')][_0x2420('0x1b')](_0x267dfb)[_0x2420('0x24')](function(_0x27a093){_0x4cc71e[_0x2420('0x1b')]=_0x27a093;if(_0x1d4734['query'][_0x2420('0x3f')]){_0x5160c5[_0x2420('0x40')]=[{'all':!![]}];}return db[_0x2420('0x2c')]['findAll'](_0x5160c5);})[_0x2420('0x24')](function(_0x18ef4c){_0x4cc71e['rows']=_0x18ef4c;return _0x4cc71e;})[_0x2420('0x24')](respondWithFilteredResult(_0x2eff4f,_0x5160c5))[_0x2420('0x41')](handleError(_0x2eff4f,null));};exports[_0x2420('0x42')]=function(_0x40e5a0,_0x4dfecc){var _0x2786bd={'raw':!![],'where':{'id':_0x40e5a0['params']['id']}},_0x32f1b8={};_0x32f1b8[_0x2420('0x30')]=_['keys'](db['CloudProvider'][_0x2420('0x2d')]);_0x32f1b8['query']=_[_0x2420('0x31')](_0x40e5a0[_0x2420('0x32')]);_0x32f1b8['filters']=_['intersection'](_0x32f1b8[_0x2420('0x30')],_0x32f1b8['query']);_0x2786bd[_0x2420('0x35')]=_[_0x2420('0x33')](_0x32f1b8[_0x2420('0x30')],qs['fields'](_0x40e5a0[_0x2420('0x32')][_0x2420('0x34')]));_0x2786bd[_0x2420('0x35')]=_0x2786bd[_0x2420('0x35')][_0x2420('0x43')]?_0x2786bd[_0x2420('0x35')]:_0x32f1b8[_0x2420('0x30')];if(_0x40e5a0[_0x2420('0x32')][_0x2420('0x3f')]){_0x2786bd[_0x2420('0x40')]=[{'all':!![]}];}_0x2786bd=_[_0x2420('0x3b')]({},_0x2786bd,_0x40e5a0[_0x2420('0x3e')]);return db[_0x2420('0x2c')][_0x2420('0x44')](_0x2786bd)['then'](handleEntityNotFound(_0x4dfecc,null))[_0x2420('0x24')](respondWithResult(_0x4dfecc,null))[_0x2420('0x41')](handleError(_0x4dfecc,null));};exports[_0x2420('0x45')]=function(_0x390ba6,_0x3ac44a){return db[_0x2420('0x2c')][_0x2420('0x45')](_0x390ba6[_0x2420('0x46')],{})[_0x2420('0x24')](respondWithResult(_0x3ac44a,0xc9))[_0x2420('0x41')](handleError(_0x3ac44a,null));};exports['update']=function(_0x5bbd8f,_0x460c80){if(_0x5bbd8f[_0x2420('0x46')]['id']){delete _0x5bbd8f[_0x2420('0x46')]['id'];}return db[_0x2420('0x2c')]['find']({'where':{'id':_0x5bbd8f[_0x2420('0x47')]['id']}})[_0x2420('0x24')](handleEntityNotFound(_0x460c80,null))[_0x2420('0x24')](saveUpdates(_0x5bbd8f[_0x2420('0x46')],null))[_0x2420('0x24')](respondWithResult(_0x460c80,null))[_0x2420('0x41')](handleError(_0x460c80,null));};exports[_0x2420('0x25')]=function(_0x2ded9c,_0x34fa74){return db[_0x2420('0x2c')][_0x2420('0x44')]({'where':{'id':_0x2ded9c['params']['id']}})[_0x2420('0x24')](handleEntityNotFound(_0x34fa74,null))['then'](removeEntity(_0x34fa74,null))[_0x2420('0x41')](handleError(_0x34fa74,null));}; \ No newline at end of file +var _0x5eae=['merge','options','count','include','findAll','rows','catch','show','includeAll','find','create','body','params','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','index','map','CloudProvider','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter'];(function(_0x17882e,_0x4da367){var _0x2c3016=function(_0x246c3a){while(--_0x246c3a){_0x17882e['push'](_0x17882e['shift']());}};_0x2c3016(++_0x4da367);}(_0x5eae,0x9b));var _0xe5ea=function(_0x2d0599,_0x299dbf){_0x2d0599=_0x2d0599-0x0;var _0x31ec14=_0x5eae[_0x2d0599];return _0x31ec14;};'use strict';var pdf=require(_0xe5ea('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe5ea('0x1'));var jsonpatch=require(_0xe5ea('0x2'));var rp=require(_0xe5ea('0x3'));var moment=require('moment');var BPromise=require(_0xe5ea('0x4'));var Mustache=require(_0xe5ea('0x5'));var util=require(_0xe5ea('0x6'));var path=require(_0xe5ea('0x7'));var sox=require(_0xe5ea('0x8'));var csv=require(_0xe5ea('0x9'));var ejs=require(_0xe5ea('0xa'));var fs=require('fs');var _=require(_0xe5ea('0xb'));var squel=require('squel');var crypto=require(_0xe5ea('0xc'));var jsforce=require(_0xe5ea('0xd'));var deskjs=require(_0xe5ea('0xe'));var toCsv=require(_0xe5ea('0x9'));var querystring=require(_0xe5ea('0xf'));var Papa=require(_0xe5ea('0x10'));var Redis=require(_0xe5ea('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe5ea('0x12'));var as=require(_0xe5ea('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe5ea('0x14'));var utils=require(_0xe5ea('0x15'));var config=require(_0xe5ea('0x16'));var licenseUtil=require(_0xe5ea('0x17'));var db=require(_0xe5ea('0x18'))['db'];function respondWithStatusCode(_0x2d8b34,_0x1a5d33){_0x1a5d33=_0x1a5d33||0xcc;return function(_0x4b568b){if(_0x4b568b){return _0x2d8b34[_0xe5ea('0x19')](_0x1a5d33);}return _0x2d8b34[_0xe5ea('0x1a')](_0x1a5d33)[_0xe5ea('0x1b')]();};}function respondWithResult(_0x5bc359,_0x543267){_0x543267=_0x543267||0xc8;return function(_0x353a86){if(_0x353a86){return _0x5bc359[_0xe5ea('0x1a')](_0x543267)[_0xe5ea('0x1c')](_0x353a86);}};}function respondWithFilteredResult(_0x1945c,_0x54150d){return function(_0x23a739){if(_0x23a739){var _0x55ac93=_0x23a739['count'],_0x3b02fe=_0x54150d[_0xe5ea('0x1d')],_0x40823c=_0x54150d[_0xe5ea('0x1d')]+_0x54150d[_0xe5ea('0x1e')],_0x55548f;if(_0x40823c>=_0x55ac93){_0x40823c=_0x55ac93;_0x55548f=0xc8;}else{_0x55548f=0xce;}_0x1945c[_0xe5ea('0x1a')](_0x55548f);return _0x1945c[_0xe5ea('0x1f')](_0xe5ea('0x20'),_0x3b02fe+'-'+_0x40823c+'/'+_0x55ac93)['json'](_0x23a739);}return null;};}function patchUpdates(_0x4ce2cd){return function(_0x31ab6c){try{jsonpatch['apply'](_0x31ab6c,_0x4ce2cd,!![]);}catch(_0x4c21db){return BPromise[_0xe5ea('0x21')](_0x4c21db);}return _0x31ab6c[_0xe5ea('0x22')]();};}function saveUpdates(_0x5aeaf9,_0x17e672){return function(_0x4c6fa0){if(_0x4c6fa0){return _0x4c6fa0[_0xe5ea('0x23')](_0x5aeaf9)[_0xe5ea('0x24')](function(_0x2f55f2){return _0x2f55f2;});}return null;};}function removeEntity(_0x337541,_0x3138a7){return function(_0x3b042c){if(_0x3b042c){return _0x3b042c[_0xe5ea('0x25')]()[_0xe5ea('0x24')](function(){_0x337541[_0xe5ea('0x1a')](0xcc)[_0xe5ea('0x1b')]();});}};}function handleEntityNotFound(_0x292b15,_0xf60e75){return function(_0x32b049){if(!_0x32b049){_0x292b15[_0xe5ea('0x19')](0x194);}return _0x32b049;};}function handleError(_0x4ea5b8,_0x4b4647){_0x4b4647=_0x4b4647||0x1f4;return function(_0x67f97e){logger[_0xe5ea('0x26')](_0x67f97e['stack']);if(_0x67f97e[_0xe5ea('0x27')]){delete _0x67f97e[_0xe5ea('0x27')];}_0x4ea5b8[_0xe5ea('0x1a')](_0x4b4647)['send'](_0x67f97e);};}exports[_0xe5ea('0x28')]=function(_0x287fd8,_0x212830){var _0x37ed01={},_0x142749={},_0x1e5866={'count':0x0,'rows':[]};var _0x4d54df=_[_0xe5ea('0x29')](db[_0xe5ea('0x2a')][_0xe5ea('0x2b')],function(_0x4790ab){return{'name':_0x4790ab['fieldName'],'type':_0x4790ab[_0xe5ea('0x2c')]['key']};});_0x142749[_0xe5ea('0x2d')]=_[_0xe5ea('0x29')](_0x4d54df,_0xe5ea('0x27'));_0x142749[_0xe5ea('0x2e')]=_[_0xe5ea('0x2f')](_0x287fd8[_0xe5ea('0x2e')]);_0x142749[_0xe5ea('0x30')]=_[_0xe5ea('0x31')](_0x142749[_0xe5ea('0x2d')],_0x142749['query']);_0x37ed01['attributes']=_['intersection'](_0x142749[_0xe5ea('0x2d')],qs['fields'](_0x287fd8[_0xe5ea('0x2e')][_0xe5ea('0x32')]));_0x37ed01[_0xe5ea('0x33')]=_0x37ed01[_0xe5ea('0x33')][_0xe5ea('0x34')]?_0x37ed01[_0xe5ea('0x33')]:_0x142749[_0xe5ea('0x2d')];if(!_0x287fd8[_0xe5ea('0x2e')][_0xe5ea('0x35')]('nolimit')){_0x37ed01[_0xe5ea('0x1e')]=qs[_0xe5ea('0x1e')](_0x287fd8[_0xe5ea('0x2e')]['limit']);_0x37ed01[_0xe5ea('0x1d')]=qs[_0xe5ea('0x1d')](_0x287fd8[_0xe5ea('0x2e')]['offset']);}_0x37ed01[_0xe5ea('0x36')]=qs[_0xe5ea('0x37')](_0x287fd8[_0xe5ea('0x2e')][_0xe5ea('0x37')]);_0x37ed01[_0xe5ea('0x38')]=qs[_0xe5ea('0x30')](_['pick'](_0x287fd8[_0xe5ea('0x2e')],_0x142749[_0xe5ea('0x30')]),_0x4d54df);if(_0x287fd8[_0xe5ea('0x2e')][_0xe5ea('0x39')]){_0x37ed01['where']=_[_0xe5ea('0x3a')](_0x37ed01['where'],{'$or':_[_0xe5ea('0x29')](_0x4d54df,function(_0x52a471){if(_0x52a471[_0xe5ea('0x2c')]!=='VIRTUAL'){var _0x53fc82={};_0x53fc82[_0x52a471[_0xe5ea('0x27')]]={'$like':'%'+_0x287fd8[_0xe5ea('0x2e')][_0xe5ea('0x39')]+'%'};return _0x53fc82;}})});}_0x37ed01=_['merge']({},_0x37ed01,_0x287fd8[_0xe5ea('0x3b')]);var _0x3bfd38={'where':_0x37ed01[_0xe5ea('0x38')]};return db[_0xe5ea('0x2a')][_0xe5ea('0x3c')](_0x3bfd38)[_0xe5ea('0x24')](function(_0x247096){_0x1e5866[_0xe5ea('0x3c')]=_0x247096;if(_0x287fd8[_0xe5ea('0x2e')]['includeAll']){_0x37ed01[_0xe5ea('0x3d')]=[{'all':!![]}];}return db[_0xe5ea('0x2a')][_0xe5ea('0x3e')](_0x37ed01);})[_0xe5ea('0x24')](function(_0x899140){_0x1e5866[_0xe5ea('0x3f')]=_0x899140;return _0x1e5866;})['then'](respondWithFilteredResult(_0x212830,_0x37ed01))[_0xe5ea('0x40')](handleError(_0x212830,null));};exports[_0xe5ea('0x41')]=function(_0x51ac67,_0x4c2666){var _0x34773a={'raw':!![],'where':{'id':_0x51ac67['params']['id']}},_0x60965d={};_0x60965d[_0xe5ea('0x2d')]=_[_0xe5ea('0x2f')](db[_0xe5ea('0x2a')][_0xe5ea('0x2b')]);_0x60965d['query']=_[_0xe5ea('0x2f')](_0x51ac67[_0xe5ea('0x2e')]);_0x60965d[_0xe5ea('0x30')]=_[_0xe5ea('0x31')](_0x60965d['model'],_0x60965d[_0xe5ea('0x2e')]);_0x34773a[_0xe5ea('0x33')]=_[_0xe5ea('0x31')](_0x60965d['model'],qs['fields'](_0x51ac67[_0xe5ea('0x2e')][_0xe5ea('0x32')]));_0x34773a['attributes']=_0x34773a['attributes'][_0xe5ea('0x34')]?_0x34773a[_0xe5ea('0x33')]:_0x60965d[_0xe5ea('0x2d')];if(_0x51ac67[_0xe5ea('0x2e')][_0xe5ea('0x42')]){_0x34773a[_0xe5ea('0x3d')]=[{'all':!![]}];}_0x34773a=_[_0xe5ea('0x3a')]({},_0x34773a,_0x51ac67[_0xe5ea('0x3b')]);return db[_0xe5ea('0x2a')][_0xe5ea('0x43')](_0x34773a)[_0xe5ea('0x24')](handleEntityNotFound(_0x4c2666,null))['then'](respondWithResult(_0x4c2666,null))[_0xe5ea('0x40')](handleError(_0x4c2666,null));};exports[_0xe5ea('0x44')]=function(_0x1e1748,_0x31845e){return db['CloudProvider'][_0xe5ea('0x44')](_0x1e1748['body'],{})[_0xe5ea('0x24')](respondWithResult(_0x31845e,0xc9))[_0xe5ea('0x40')](handleError(_0x31845e,null));};exports[_0xe5ea('0x23')]=function(_0x263de8,_0x9a78ed){if(_0x263de8[_0xe5ea('0x45')]['id']){delete _0x263de8[_0xe5ea('0x45')]['id'];}return db['CloudProvider'][_0xe5ea('0x43')]({'where':{'id':_0x263de8[_0xe5ea('0x46')]['id']}})[_0xe5ea('0x24')](handleEntityNotFound(_0x9a78ed,null))[_0xe5ea('0x24')](saveUpdates(_0x263de8[_0xe5ea('0x45')],null))['then'](respondWithResult(_0x9a78ed,null))[_0xe5ea('0x40')](handleError(_0x9a78ed,null));};exports[_0xe5ea('0x25')]=function(_0x2f9305,_0xeb660e){return db[_0xe5ea('0x2a')]['find']({'where':{'id':_0x2f9305[_0xe5ea('0x46')]['id']}})['then'](handleEntityNotFound(_0xeb660e,null))['then'](removeEntity(_0xeb660e,null))[_0xe5ea('0x40')](handleError(_0xeb660e,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 977036e..86e3ebf 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 _0xcc41=['exports','CloudProvider','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x37bd28,_0x23360c){var _0x5a96bd=function(_0x4182c5){while(--_0x4182c5){_0x37bd28['push'](_0x37bd28['shift']());}};_0x5a96bd(++_0x23360c);}(_0xcc41,0xec));var _0x1cc4=function(_0x30b4dc,_0xaba989){_0x30b4dc=_0x30b4dc-0x0;var _0x3a4dab=_0xcc41[_0x30b4dc];return _0x3a4dab;};'use strict';var _=require(_0x1cc4('0x0'));var util=require(_0x1cc4('0x1'));var logger=require(_0x1cc4('0x2'))('api');var moment=require(_0x1cc4('0x3'));var BPromise=require(_0x1cc4('0x4'));var rp=require(_0x1cc4('0x5'));var fs=require('fs');var path=require(_0x1cc4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0x1cc4('0x7')]=function(_0x2744ed,_0x4c33fa){return _0x2744ed['define'](_0x1cc4('0x8'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x284c=['define','CloudProvider','cloud_providers','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x250e3d,_0x3cfc4e){var _0x3b687d=function(_0x52fd68){while(--_0x52fd68){_0x250e3d['push'](_0x250e3d['shift']());}};_0x3b687d(++_0x3cfc4e);}(_0x284c,0x158));var _0xc284=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x284c[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xc284('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc284('0x1'));var moment=require('moment');var BPromise=require(_0xc284('0x2'));var rp=require(_0xc284('0x3'));var fs=require('fs');var path=require(_0xc284('0x4'));var rimraf=require(_0xc284('0x5'));var config=require(_0xc284('0x6'));var attributes=require('./cloudProvider.attributes');module[_0xc284('0x7')]=function(_0x11c499,_0x2d21ed){return _0x11c499[_0xc284('0x8')](_0xc284('0x9'),attributes,{'tableName':_0xc284('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 831b2e5..ed43937 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 _0x337c=['then','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','CloudProvider,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x584c6b,_0x462c27){var _0x1ab81c=function(_0x492728){while(--_0x492728){_0x584c6b['push'](_0x584c6b['shift']());}};_0x1ab81c(++_0x462c27);}(_0x337c,0x1d6));var _0xc337=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x337c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc337('0x0'));var util=require(_0xc337('0x1'));var moment=require(_0xc337('0x2'));var BPromise=require(_0xc337('0x3'));var rs=require(_0xc337('0x4'));var fs=require('fs');var Redis=require(_0xc337('0x5'));var db=require(_0xc337('0x6'))['db'];var utils=require(_0xc337('0x7'));var logger=require(_0xc337('0x8'))(_0xc337('0x9'));var config=require(_0xc337('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc337('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a3e24,_0x33205d,_0x192ebb){return new BPromise(function(_0xc9e749,_0xe3fd4a){return client[_0xc337('0xc')](_0x4a3e24,_0x192ebb)[_0xc337('0xd')](function(_0x307a3a){logger['info']('CloudProvider,\x20%s,\x20%s',_0x33205d,_0xc337('0xe'));logger[_0xc337('0xf')](_0xc337('0x10'),_0x33205d,_0xc337('0xe'),JSON['stringify'](_0x307a3a));if(_0x307a3a[_0xc337('0x11')]){if(_0x307a3a['error'][_0xc337('0x12')]===0x1f4){logger['error'](_0xc337('0x13'),_0x33205d,_0x307a3a['error'][_0xc337('0x14')]);return _0xe3fd4a(_0x307a3a[_0xc337('0x11')][_0xc337('0x14')]);}logger['error'](_0xc337('0x13'),_0x33205d,_0x307a3a[_0xc337('0x11')][_0xc337('0x14')]);return _0xc9e749(_0x307a3a[_0xc337('0x11')][_0xc337('0x14')]);}else{logger[_0xc337('0x15')]('CloudProvider,\x20%s,\x20%s',_0x33205d,'request\x20sent');_0xc9e749(_0x307a3a['result'][_0xc337('0x14')]);}})[_0xc337('0x16')](function(_0x42b7d6){logger[_0xc337('0x11')](_0xc337('0x13'),_0x33205d,_0x42b7d6);_0xe3fd4a(_0x42b7d6);});});} \ No newline at end of file +var _0x9abb=['request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','CloudProvider,\x20%s,\x20%s'];(function(_0x5d4db9,_0x2adda5){var _0x129cf7=function(_0x465d60){while(--_0x465d60){_0x5d4db9['push'](_0x5d4db9['shift']());}};_0x129cf7(++_0x2adda5);}(_0x9abb,0x9e));var _0xb9ab=function(_0x5c3014,_0x872c2){_0x5c3014=_0x5c3014-0x0;var _0x3da0ed=_0x9abb[_0x5c3014];return _0x3da0ed;};'use strict';var _=require(_0xb9ab('0x0'));var util=require(_0xb9ab('0x1'));var moment=require('moment');var BPromise=require(_0xb9ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9ab('0x3'));var db=require(_0xb9ab('0x4'))['db'];var utils=require(_0xb9ab('0x5'));var logger=require(_0xb9ab('0x6'))('rpc');var config=require(_0xb9ab('0x7'));var jayson=require(_0xb9ab('0x8'));var client=jayson['client'][_0xb9ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e4a5d,_0xa3688d,_0x454ffb){return new BPromise(function(_0x1a2b9a,_0x16a63e){return client[_0xb9ab('0xa')](_0x2e4a5d,_0x454ffb)['then'](function(_0x560eb5){logger[_0xb9ab('0xb')](_0xb9ab('0xc'),_0xa3688d,_0xb9ab('0xd'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0xa3688d,_0xb9ab('0xd'),JSON[_0xb9ab('0xe')](_0x560eb5));if(_0x560eb5[_0xb9ab('0xf')]){if(_0x560eb5['error'][_0xb9ab('0x10')]===0x1f4){logger[_0xb9ab('0xf')](_0xb9ab('0xc'),_0xa3688d,_0x560eb5[_0xb9ab('0xf')][_0xb9ab('0x11')]);return _0x16a63e(_0x560eb5[_0xb9ab('0xf')][_0xb9ab('0x11')]);}logger[_0xb9ab('0xf')]('CloudProvider,\x20%s,\x20%s',_0xa3688d,_0x560eb5[_0xb9ab('0xf')]['message']);return _0x1a2b9a(_0x560eb5[_0xb9ab('0xf')][_0xb9ab('0x11')]);}else{logger[_0xb9ab('0xb')]('CloudProvider,\x20%s,\x20%s',_0xa3688d,_0xb9ab('0xd'));_0x1a2b9a(_0x560eb5[_0xb9ab('0x12')]['message']);}})['catch'](function(_0x3fb19a){logger[_0xb9ab('0xf')](_0xb9ab('0xc'),_0xa3688d,_0x3fb19a);_0x16a63e(_0x3fb19a);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 7478e3e..d1cfb28 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 _0xa38f=['update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','index','/:id','post','isAuthenticated','create'];(function(_0x550a42,_0x2238a1){var _0x45f415=function(_0x67d5c0){while(--_0x67d5c0){_0x550a42['push'](_0x550a42['shift']());}};_0x45f415(++_0x2238a1);}(_0xa38f,0x1a5));var _0xfa38=function(_0x5a1682,_0xb24f35){_0x5a1682=_0x5a1682-0x0;var _0xc289ca=_0xa38f[_0x5a1682];return _0xc289ca;};'use strict';var multer=require(_0xfa38('0x0'));var util=require(_0xfa38('0x1'));var path=require(_0xfa38('0x2'));var timeout=require(_0xfa38('0x3'));var express=require(_0xfa38('0x4'));var router=express[_0xfa38('0x5')]();var auth=require(_0xfa38('0x6'));var interaction=require(_0xfa38('0x7'));var config=require(_0xfa38('0x8'));var controller=require(_0xfa38('0x9'));router[_0xfa38('0xa')]('/',auth['isAuthenticated'](),controller[_0xfa38('0xb')]);router['get'](_0xfa38('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xfa38('0xd')]('/',auth[_0xfa38('0xe')](),controller[_0xfa38('0xf')]);router['put']('/:id',auth[_0xfa38('0xe')](),controller[_0xfa38('0x10')]);router[_0xfa38('0x11')](_0xfa38('0xc'),auth[_0xfa38('0xe')](),controller['destroy']);module[_0xfa38('0x12')]=router; \ No newline at end of file +var _0x7b58=['../../config/environment','./cloudProvider.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','exports','path','express','Router'];(function(_0x34ac51,_0x47b509){var _0xea1dc5=function(_0x5f3fb4){while(--_0x5f3fb4){_0x34ac51['push'](_0x34ac51['shift']());}};_0xea1dc5(++_0x47b509);}(_0x7b58,0xad));var _0x87b5=function(_0x5e7e92,_0xdb0f1){_0x5e7e92=_0x5e7e92-0x0;var _0x412746=_0x7b58[_0x5e7e92];return _0x412746;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x87b5('0x0'));var timeout=require('connect-timeout');var express=require(_0x87b5('0x1'));var router=express[_0x87b5('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x87b5('0x3'));var controller=require(_0x87b5('0x4'));router['get']('/',auth[_0x87b5('0x5')](),controller[_0x87b5('0x6')]);router[_0x87b5('0x7')](_0x87b5('0x8'),auth[_0x87b5('0x5')](),controller[_0x87b5('0x9')]);router['post']('/',auth[_0x87b5('0x5')](),controller[_0x87b5('0xa')]);router[_0x87b5('0xb')](_0x87b5('0x8'),auth['isAuthenticated'](),controller[_0x87b5('0xc')]);router[_0x87b5('0xd')](_0x87b5('0x8'),auth['isAuthenticated'](),controller[_0x87b5('0xe')]);module[_0x87b5('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index a54932a..7d7d0c9 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 _0x16b2=['sequelize','exports','STRING'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x16b2,0x105));var _0x216b=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x16b2[_0x819464];return _0x49dcc0;};'use strict';var Sequelize=require(_0x216b('0x0'));module[_0x216b('0x1')]={'name':{'type':Sequelize[_0x216b('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x216b('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x216b('0x2')]},'phone':{'type':Sequelize[_0x216b('0x2')]},'fax':{'type':Sequelize[_0x216b('0x2')]},'type':{'type':Sequelize[_0x216b('0x2')]},'street':{'type':Sequelize[_0x216b('0x2')]},'postalCode':{'type':Sequelize[_0x216b('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x216b('0x2')]},'email':{'type':Sequelize[_0x216b('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x216b('0x2')]},'sPostalCode':{'type':Sequelize[_0x216b('0x2')]},'sCity':{'type':Sequelize[_0x216b('0x2')]},'sCountry':{'type':Sequelize[_0x216b('0x2')]},'description':{'type':Sequelize[_0x216b('0x2')]}}; \ No newline at end of file +var _0xce67=['sequelize','exports','STRING','name'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xce67,0x94));var _0x7ce6=function(_0x2b6293,_0x45cd27){_0x2b6293=_0x2b6293-0x0;var _0x255502=_0xce67[_0x2b6293];return _0x255502;};'use strict';var Sequelize=require(_0x7ce6('0x0'));module[_0x7ce6('0x1')]={'name':{'type':Sequelize[_0x7ce6('0x2')],'unique':_0x7ce6('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x7ce6('0x2')]},'companyId':{'type':Sequelize[_0x7ce6('0x2')]},'website':{'type':Sequelize[_0x7ce6('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x7ce6('0x2')]},'type':{'type':Sequelize[_0x7ce6('0x2')]},'street':{'type':Sequelize[_0x7ce6('0x2')]},'postalCode':{'type':Sequelize[_0x7ce6('0x2')]},'city':{'type':Sequelize[_0x7ce6('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7ce6('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x7ce6('0x2')]},'sStreet':{'type':Sequelize[_0x7ce6('0x2')]},'sPostalCode':{'type':Sequelize[_0x7ce6('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x7ce6('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index ad7c9ac..d3cae54 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 _0xc853=['findOne','html-pdf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','apply','update','then','UserProfileResource','destroy','sendStatus','error','stack','name','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','map','filter','count','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Companies','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContact','addContacts','ids','getContacts'];(function(_0x43a5c7,_0x2286bf){var _0x3b12a2=function(_0x1f8f53){while(--_0x1f8f53){_0x43a5c7['push'](_0x43a5c7['shift']());}};_0x3b12a2(++_0x2286bf);}(_0xc853,0xf1));var _0x3c85=function(_0x18f413,_0x22e0ab){_0x18f413=_0x18f413-0x0;var _0x18f2c8=_0xc853[_0x18f413];return _0x18f2c8;};'use strict';var pdf=require(_0x3c85('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3c85('0x1'));var jsonpatch=require(_0x3c85('0x2'));var rp=require(_0x3c85('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3c85('0x4'));var csv=require(_0x3c85('0x5'));var ejs=require(_0x3c85('0x6'));var fs=require('fs');var _=require(_0x3c85('0x7'));var squel=require(_0x3c85('0x8'));var crypto=require(_0x3c85('0x9'));var jsforce=require(_0x3c85('0xa'));var deskjs=require(_0x3c85('0xb'));var toCsv=require(_0x3c85('0x5'));var querystring=require(_0x3c85('0xc'));var Papa=require(_0x3c85('0xd'));var Redis=require(_0x3c85('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3c85('0xf'));var as=require(_0x3c85('0x10'));var hardwareService=require(_0x3c85('0x11'));var logger=require(_0x3c85('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x3c85('0x13'));var licenseUtil=require(_0x3c85('0x14'));var db=require(_0x3c85('0x15'))['db'];function respondWithStatusCode(_0xe60160,_0x4a1404){_0x4a1404=_0x4a1404||0xcc;return function(_0x51cf22){if(_0x51cf22){return _0xe60160['sendStatus'](_0x4a1404);}return _0xe60160[_0x3c85('0x16')](_0x4a1404)[_0x3c85('0x17')]();};}function respondWithResult(_0x3ca352,_0x2b767d){_0x2b767d=_0x2b767d||0xc8;return function(_0x3a4039){if(_0x3a4039){return _0x3ca352[_0x3c85('0x16')](_0x2b767d)[_0x3c85('0x18')](_0x3a4039);}};}function respondWithFilteredResult(_0x2fac18,_0x317c16){return function(_0x3a932d){if(_0x3a932d){var _0x3f5e43=_0x3a932d['count'],_0x194567=_0x317c16[_0x3c85('0x19')],_0x34cec8=_0x317c16['offset']+_0x317c16[_0x3c85('0x1a')],_0x21ffc3;if(_0x34cec8>=_0x3f5e43){_0x34cec8=_0x3f5e43;_0x21ffc3=0xc8;}else{_0x21ffc3=0xce;}_0x2fac18[_0x3c85('0x16')](_0x21ffc3);return _0x2fac18['set']('Content-Range',_0x194567+'-'+_0x34cec8+'/'+_0x3f5e43)[_0x3c85('0x18')](_0x3a932d);}return null;};}function patchUpdates(_0x1610ed){return function(_0x270af5){try{jsonpatch[_0x3c85('0x1b')](_0x270af5,_0x1610ed,!![]);}catch(_0x5ef7e9){return BPromise['reject'](_0x5ef7e9);}return _0x270af5['save']();};}function saveUpdates(_0x46cfe8,_0x293f18){return function(_0xe165e3){if(_0xe165e3){return _0xe165e3[_0x3c85('0x1c')](_0x46cfe8)[_0x3c85('0x1d')](function(_0x2db2a2){return _0x2db2a2;});}return null;};}function removeEntity(_0x122803,_0x28d56a){return function(_0x408d81){if(_0x408d81){return _0x408d81['destroy']()[_0x3c85('0x1d')](function(){var _0x576c77=_0x408d81['get']({'plain':!![]});var _0x2a2521='Companies';return db[_0x3c85('0x1e')][_0x3c85('0x1f')]({'where':{'type':_0x2a2521,'resourceId':_0x576c77['id']}})['then'](function(){return _0x408d81;});})['then'](function(){_0x122803[_0x3c85('0x16')](0xcc)[_0x3c85('0x17')]();});}};}function handleEntityNotFound(_0x44bab7,_0xd43744){return function(_0x23340e){if(!_0x23340e){_0x44bab7[_0x3c85('0x20')](0x194);}return _0x23340e;};}function handleError(_0x434975,_0x432fd4){_0x432fd4=_0x432fd4||0x1f4;return function(_0x4eb026){logger[_0x3c85('0x21')](_0x4eb026[_0x3c85('0x22')]);if(_0x4eb026[_0x3c85('0x23')]){delete _0x4eb026[_0x3c85('0x23')];}_0x434975['status'](_0x432fd4)['send'](_0x4eb026);};}exports[_0x3c85('0x24')]=function(_0x45c251,_0x5d08af){var _0x24332d={},_0x1c709b={},_0x30cc1b={'count':0x0,'rows':[]};return db[_0x3c85('0x25')][_0x3c85('0x26')]()[_0x3c85('0x1d')](function(_0x507e97){_0x1c709b[_0x3c85('0x27')]=_[_0x3c85('0x28')](_0x507e97);_0x1c709b[_0x3c85('0x29')]=_['keys'](_0x45c251['query']);_0x1c709b[_0x3c85('0x2a')]=_[_0x3c85('0x2b')](_0x1c709b[_0x3c85('0x27')],_0x1c709b[_0x3c85('0x29')]);_0x24332d[_0x3c85('0x2c')]=_[_0x3c85('0x2b')](_0x1c709b['model'],qs[_0x3c85('0x2d')](_0x45c251[_0x3c85('0x29')]['fields']));_0x24332d[_0x3c85('0x2c')]=_0x24332d[_0x3c85('0x2c')][_0x3c85('0x2e')]?_0x24332d[_0x3c85('0x2c')]:_0x1c709b['model'];if(!_0x45c251[_0x3c85('0x29')][_0x3c85('0x2f')](_0x3c85('0x30'))){_0x24332d[_0x3c85('0x1a')]=qs[_0x3c85('0x1a')](_0x45c251['query'][_0x3c85('0x1a')]);_0x24332d[_0x3c85('0x19')]=qs[_0x3c85('0x19')](_0x45c251[_0x3c85('0x29')]['offset']);}_0x24332d['order']=qs[_0x3c85('0x31')](_0x45c251[_0x3c85('0x29')][_0x3c85('0x31')]);_0x24332d[_0x3c85('0x32')]=qs['filters'](_[_0x3c85('0x33')](_0x45c251[_0x3c85('0x29')],_0x1c709b[_0x3c85('0x2a')]),_0x507e97);if(_0x45c251[_0x3c85('0x29')]['filter']){_0x24332d['where']=_[_0x3c85('0x34')](_0x24332d['where'],{'$or':_[_0x3c85('0x35')](_0x24332d['attributes'],function(_0x28013e){var _0x26f232={};_0x26f232[_0x28013e]={'$like':'%'+_0x45c251[_0x3c85('0x29')][_0x3c85('0x36')]+'%'};return _0x26f232;})});}_0x24332d=_['merge']({},_0x24332d,_0x45c251['options']);var _0x5c430e={'where':_0x24332d['where']};return db['CmCompany'][_0x3c85('0x37')](_0x5c430e)[_0x3c85('0x1d')](function(_0xc7358c){_0x30cc1b['count']=_0xc7358c;if(_0x45c251[_0x3c85('0x29')]['includeAll']){_0x24332d[_0x3c85('0x38')]=[{'all':!![]}];}return db[_0x3c85('0x25')][_0x3c85('0x39')](_0x24332d);})['then'](function(_0x34b2b6){_0x30cc1b[_0x3c85('0x3a')]=_0x34b2b6;return _0x30cc1b;})[_0x3c85('0x1d')](respondWithFilteredResult(_0x5d08af,_0x24332d))[_0x3c85('0x3b')](handleError(_0x5d08af,null));})[_0x3c85('0x3b')](handleError(_0x5d08af,null));};exports[_0x3c85('0x3c')]=function(_0x8969e,_0xe297b7){var _0x51e070={'raw':![],'where':{'id':_0x8969e[_0x3c85('0x3d')]['id']}},_0x1d0f65={};_0x1d0f65[_0x3c85('0x27')]=_['keys'](db[_0x3c85('0x25')][_0x3c85('0x3e')]);_0x1d0f65[_0x3c85('0x29')]=_[_0x3c85('0x28')](_0x8969e['query']);_0x1d0f65[_0x3c85('0x2a')]=_['intersection'](_0x1d0f65[_0x3c85('0x27')],_0x1d0f65['query']);_0x51e070['attributes']=_[_0x3c85('0x2b')](_0x1d0f65[_0x3c85('0x27')],qs[_0x3c85('0x2d')](_0x8969e[_0x3c85('0x29')][_0x3c85('0x2d')]));_0x51e070['attributes']=_0x51e070[_0x3c85('0x2c')]['length']?_0x51e070['attributes']:_0x1d0f65['model'];if(_0x8969e[_0x3c85('0x29')][_0x3c85('0x3f')]){_0x51e070[_0x3c85('0x38')]=[{'all':!![]}];}_0x51e070=_[_0x3c85('0x34')]({},_0x51e070,_0x8969e[_0x3c85('0x40')]);return db[_0x3c85('0x25')][_0x3c85('0x41')](_0x51e070)[_0x3c85('0x1d')](handleEntityNotFound(_0xe297b7,null))['then'](respondWithResult(_0xe297b7,null))[_0x3c85('0x3b')](handleError(_0xe297b7,null));};exports['create']=function(_0x32d6de,_0x16758d){return db['CmCompany']['create'](_0x32d6de['body'],{})[_0x3c85('0x1d')](function(_0x238d86){var _0x255439=_0x32d6de[_0x3c85('0x42')][_0x3c85('0x43')]({'plain':!![]});if(!_0x255439)throw new Error(_0x3c85('0x44'));if(_0x255439['role']===_0x3c85('0x42')){var _0x3cd9db=_0x238d86[_0x3c85('0x43')]({'plain':!![]});var _0x17c3f5=_0x3c85('0x45');return db[_0x3c85('0x46')][_0x3c85('0x41')]({'where':{'name':_0x17c3f5,'userProfileId':_0x255439['userProfileId']},'raw':!![]})[_0x3c85('0x1d')](function(_0x274ead){if(_0x274ead&&_0x274ead[_0x3c85('0x47')]===0x0){return db[_0x3c85('0x1e')][_0x3c85('0x48')]({'name':_0x3cd9db['name'],'resourceId':_0x3cd9db['id'],'type':_0x274ead[_0x3c85('0x23')],'sectionId':_0x274ead['id']},{})[_0x3c85('0x1d')](function(){return _0x238d86;});}else{return _0x238d86;}})[_0x3c85('0x3b')](function(_0x30b0be){logger[_0x3c85('0x21')](_0x3c85('0x49'),_0x30b0be);throw _0x30b0be;});}return _0x238d86;})[_0x3c85('0x1d')](respondWithResult(_0x16758d,0xc9))['catch'](handleError(_0x16758d,null));};exports[_0x3c85('0x1c')]=function(_0x1da4a2,_0x5d0283){if(_0x1da4a2['body']['id']){delete _0x1da4a2[_0x3c85('0x4a')]['id'];}return db[_0x3c85('0x25')][_0x3c85('0x41')]({'where':{'id':_0x1da4a2[_0x3c85('0x3d')]['id']}})[_0x3c85('0x1d')](handleEntityNotFound(_0x5d0283,null))[_0x3c85('0x1d')](saveUpdates(_0x1da4a2[_0x3c85('0x4a')],null))[_0x3c85('0x1d')](respondWithResult(_0x5d0283,null))['catch'](handleError(_0x5d0283,null));};exports[_0x3c85('0x1f')]=function(_0x14718c,_0x507eab){return db['CmCompany'][_0x3c85('0x41')]({'where':{'id':_0x14718c[_0x3c85('0x3d')]['id']}})[_0x3c85('0x1d')](handleEntityNotFound(_0x507eab,null))[_0x3c85('0x1d')](removeEntity(_0x507eab,null))[_0x3c85('0x3b')](handleError(_0x507eab,null));};exports[_0x3c85('0x26')]=function(_0x4381d4,_0x537048){return db[_0x3c85('0x25')][_0x3c85('0x26')]()[_0x3c85('0x1d')](respondWithResult(_0x537048,null))['catch'](handleError(_0x537048,null));};exports['addContacts']=function(_0x597993,_0x5b8a76,_0x341f86){return db[_0x3c85('0x4b')][_0x3c85('0x41')]({'where':{'id':_0x597993[_0x3c85('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5b8a76,null))[_0x3c85('0x1d')](function(_0x46ceb1){if(_0x46ceb1){return _0x46ceb1[_0x3c85('0x4c')](_0x597993['body'][_0x3c85('0x4d')],_['omit'](_0x597993[_0x3c85('0x4a')],['ids','id'])||{});}})[_0x3c85('0x1d')](respondWithResult(_0x5b8a76,null))[_0x3c85('0x3b')](handleError(_0x5b8a76,null));};exports[_0x3c85('0x4e')]=function(_0x14bb02,_0x340b5b,_0x1ff9be){var _0x4585b8={};var _0x58791f={};var _0x4f9295;var _0x3aa0a5;return db[_0x3c85('0x25')][_0x3c85('0x4f')]({'where':{'id':_0x14bb02['params']['id']}})[_0x3c85('0x1d')](handleEntityNotFound(_0x340b5b,null))['then'](function(_0x5bef54){if(_0x5bef54){_0x4f9295=_0x5bef54;_0x58791f[_0x3c85('0x27')]=_[_0x3c85('0x28')](db[_0x3c85('0x4b')][_0x3c85('0x3e')]);_0x58791f[_0x3c85('0x29')]=_['keys'](_0x14bb02[_0x3c85('0x29')]);_0x58791f[_0x3c85('0x2a')]=_['intersection'](_0x58791f[_0x3c85('0x27')],_0x58791f[_0x3c85('0x29')]);_0x4585b8[_0x3c85('0x2c')]=_[_0x3c85('0x2b')](_0x58791f[_0x3c85('0x27')],qs[_0x3c85('0x2d')](_0x14bb02[_0x3c85('0x29')][_0x3c85('0x2d')]));_0x4585b8['attributes']=_0x4585b8['attributes'][_0x3c85('0x2e')]?_0x4585b8['attributes']:_0x58791f[_0x3c85('0x27')];_0x4585b8['order']=qs[_0x3c85('0x31')](_0x14bb02['query'][_0x3c85('0x31')]);_0x4585b8[_0x3c85('0x32')]=qs[_0x3c85('0x2a')](_[_0x3c85('0x33')](_0x14bb02[_0x3c85('0x29')],_0x58791f[_0x3c85('0x2a')]));if(_0x14bb02[_0x3c85('0x29')][_0x3c85('0x36')]){_0x4585b8['where']=_[_0x3c85('0x34')](_0x4585b8['where'],{'$or':_[_0x3c85('0x35')](_0x4585b8['attributes'],function(_0x40073d){var _0x270ee3={};_0x270ee3[_0x40073d]={'$like':'%'+_0x14bb02[_0x3c85('0x29')][_0x3c85('0x36')]+'%'};return _0x270ee3;})});}_0x4585b8=_[_0x3c85('0x34')]({},_0x4585b8,_0x14bb02[_0x3c85('0x40')]);return _0x4f9295['getContacts'](_0x4585b8);}})[_0x3c85('0x1d')](function(_0x32ce78){if(_0x32ce78){_0x3aa0a5=_0x32ce78[_0x3c85('0x2e')];if(!_0x14bb02[_0x3c85('0x29')]['hasOwnProperty'](_0x3c85('0x30'))){_0x4585b8[_0x3c85('0x1a')]=qs['limit'](_0x14bb02['query'][_0x3c85('0x1a')]);_0x4585b8[_0x3c85('0x19')]=qs[_0x3c85('0x19')](_0x14bb02[_0x3c85('0x29')][_0x3c85('0x19')]);}return _0x4f9295[_0x3c85('0x4e')](_0x4585b8);}})[_0x3c85('0x1d')](function(_0x10b019){if(_0x10b019){return _0x10b019?{'count':_0x3aa0a5,'rows':_0x10b019}:null;}})[_0x3c85('0x1d')](respondWithResult(_0x340b5b,null))[_0x3c85('0x3b')](handleError(_0x340b5b,null));}; \ No newline at end of file +var _0x9d01=['ejs','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','json','count','offset','limit','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','describe','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','filter','where','merge','map','options','includeAll','include','findAll','rows','catch','CmCompany','rawAttributes','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Companies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','ids','omit','getContacts','findOne','CmContact','order','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv'];(function(_0x4de9e8,_0x565ffa){var _0x4db0de=function(_0x12279d){while(--_0x12279d){_0x4de9e8['push'](_0x4de9e8['shift']());}};_0x4db0de(++_0x565ffa);}(_0x9d01,0x9f));var _0x19d0=function(_0x264f8d,_0xac465a){_0x264f8d=_0x264f8d-0x0;var _0xed26c1=_0x9d01[_0x264f8d];return _0xed26c1;};'use strict';var pdf=require(_0x19d0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x19d0('0x1'));var zipdir=require(_0x19d0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x19d0('0x3'));var moment=require('moment');var BPromise=require(_0x19d0('0x4'));var Mustache=require(_0x19d0('0x5'));var util=require(_0x19d0('0x6'));var path=require(_0x19d0('0x7'));var sox=require('sox');var csv=require(_0x19d0('0x8'));var ejs=require(_0x19d0('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x19d0('0xa'));var toCsv=require(_0x19d0('0x8'));var querystring=require('querystring');var Papa=require(_0x19d0('0xb'));var Redis=require(_0x19d0('0xc'));var authService=require(_0x19d0('0xd'));var qs=require(_0x19d0('0xe'));var as=require(_0x19d0('0xf'));var hardwareService=require(_0x19d0('0x10'));var logger=require(_0x19d0('0x11'))(_0x19d0('0x12'));var utils=require(_0x19d0('0x13'));var config=require(_0x19d0('0x14'));var licenseUtil=require(_0x19d0('0x15'));var db=require(_0x19d0('0x16'))['db'];function respondWithStatusCode(_0x24d583,_0x43033b){_0x43033b=_0x43033b||0xcc;return function(_0x5672fb){if(_0x5672fb){return _0x24d583[_0x19d0('0x17')](_0x43033b);}return _0x24d583[_0x19d0('0x18')](_0x43033b)['end']();};}function respondWithResult(_0x157da2,_0x5837bb){_0x5837bb=_0x5837bb||0xc8;return function(_0xc85787){if(_0xc85787){return _0x157da2[_0x19d0('0x18')](_0x5837bb)[_0x19d0('0x19')](_0xc85787);}};}function respondWithFilteredResult(_0x1cee00,_0x175604){return function(_0x1dd603){if(_0x1dd603){var _0x109c4d=_0x1dd603[_0x19d0('0x1a')],_0x4dd62f=_0x175604[_0x19d0('0x1b')],_0x24bcef=_0x175604[_0x19d0('0x1b')]+_0x175604[_0x19d0('0x1c')],_0x50c61b;if(_0x24bcef>=_0x109c4d){_0x24bcef=_0x109c4d;_0x50c61b=0xc8;}else{_0x50c61b=0xce;}_0x1cee00['status'](_0x50c61b);return _0x1cee00['set']('Content-Range',_0x4dd62f+'-'+_0x24bcef+'/'+_0x109c4d)['json'](_0x1dd603);}return null;};}function patchUpdates(_0x3499fe){return function(_0xd320d8){try{jsonpatch[_0x19d0('0x1d')](_0xd320d8,_0x3499fe,!![]);}catch(_0x44257f){return BPromise[_0x19d0('0x1e')](_0x44257f);}return _0xd320d8[_0x19d0('0x1f')]();};}function saveUpdates(_0x37be22,_0x355e46){return function(_0x3fde5f){if(_0x3fde5f){return _0x3fde5f[_0x19d0('0x20')](_0x37be22)[_0x19d0('0x21')](function(_0x23794f){return _0x23794f;});}return null;};}function removeEntity(_0x5d8f3e,_0x44427a){return function(_0x20d217){if(_0x20d217){return _0x20d217[_0x19d0('0x22')]()[_0x19d0('0x21')](function(){var _0x25ab72=_0x20d217['get']({'plain':!![]});var _0x330769='Companies';return db[_0x19d0('0x23')][_0x19d0('0x22')]({'where':{'type':_0x330769,'resourceId':_0x25ab72['id']}})[_0x19d0('0x21')](function(){return _0x20d217;});})[_0x19d0('0x21')](function(){_0x5d8f3e[_0x19d0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b3735,_0x48e895){return function(_0x3ea867){if(!_0x3ea867){_0x5b3735[_0x19d0('0x17')](0x194);}return _0x3ea867;};}function handleError(_0x2817c4,_0x3b2782){_0x3b2782=_0x3b2782||0x1f4;return function(_0x18d9d8){logger[_0x19d0('0x24')](_0x18d9d8[_0x19d0('0x25')]);if(_0x18d9d8[_0x19d0('0x26')]){delete _0x18d9d8[_0x19d0('0x26')];}_0x2817c4[_0x19d0('0x18')](_0x3b2782)[_0x19d0('0x27')](_0x18d9d8);};}exports[_0x19d0('0x28')]=function(_0x238e70,_0xaa3acb){var _0x48d623={},_0x137273={},_0x52bed1={'count':0x0,'rows':[]};return db['CmCompany'][_0x19d0('0x29')]()[_0x19d0('0x21')](function(_0x732b05){_0x137273[_0x19d0('0x2a')]=_[_0x19d0('0x2b')](_0x732b05);_0x137273[_0x19d0('0x2c')]=_[_0x19d0('0x2b')](_0x238e70[_0x19d0('0x2c')]);_0x137273['filters']=_[_0x19d0('0x2d')](_0x137273['model'],_0x137273[_0x19d0('0x2c')]);_0x48d623[_0x19d0('0x2e')]=_[_0x19d0('0x2d')](_0x137273['model'],qs[_0x19d0('0x2f')](_0x238e70[_0x19d0('0x2c')][_0x19d0('0x2f')]));_0x48d623[_0x19d0('0x2e')]=_0x48d623[_0x19d0('0x2e')]['length']?_0x48d623[_0x19d0('0x2e')]:_0x137273['model'];if(!_0x238e70[_0x19d0('0x2c')][_0x19d0('0x30')](_0x19d0('0x31'))){_0x48d623['limit']=qs[_0x19d0('0x1c')](_0x238e70[_0x19d0('0x2c')]['limit']);_0x48d623[_0x19d0('0x1b')]=qs['offset'](_0x238e70['query'][_0x19d0('0x1b')]);}_0x48d623['order']=qs[_0x19d0('0x32')](_0x238e70[_0x19d0('0x2c')]['sort']);_0x48d623['where']=qs['filters'](_['pick'](_0x238e70[_0x19d0('0x2c')],_0x137273[_0x19d0('0x33')]),_0x732b05);if(_0x238e70['query'][_0x19d0('0x34')]){_0x48d623[_0x19d0('0x35')]=_[_0x19d0('0x36')](_0x48d623['where'],{'$or':_[_0x19d0('0x37')](_0x48d623[_0x19d0('0x2e')],function(_0x244ad8){var _0x4251e0={};_0x4251e0[_0x244ad8]={'$like':'%'+_0x238e70[_0x19d0('0x2c')][_0x19d0('0x34')]+'%'};return _0x4251e0;})});}_0x48d623=_[_0x19d0('0x36')]({},_0x48d623,_0x238e70[_0x19d0('0x38')]);var _0x4290c3={'where':_0x48d623['where']};return db['CmCompany'][_0x19d0('0x1a')](_0x4290c3)['then'](function(_0xb89562){_0x52bed1[_0x19d0('0x1a')]=_0xb89562;if(_0x238e70['query'][_0x19d0('0x39')]){_0x48d623[_0x19d0('0x3a')]=[{'all':!![]}];}return db['CmCompany'][_0x19d0('0x3b')](_0x48d623);})['then'](function(_0x31c405){_0x52bed1[_0x19d0('0x3c')]=_0x31c405;return _0x52bed1;})[_0x19d0('0x21')](respondWithFilteredResult(_0xaa3acb,_0x48d623))[_0x19d0('0x3d')](handleError(_0xaa3acb,null));})[_0x19d0('0x3d')](handleError(_0xaa3acb,null));};exports['show']=function(_0x28d38f,_0x441acf){var _0x26a40b={'raw':![],'where':{'id':_0x28d38f['params']['id']}},_0x4f9fe4={};_0x4f9fe4[_0x19d0('0x2a')]=_['keys'](db[_0x19d0('0x3e')][_0x19d0('0x3f')]);_0x4f9fe4[_0x19d0('0x2c')]=_['keys'](_0x28d38f[_0x19d0('0x2c')]);_0x4f9fe4['filters']=_[_0x19d0('0x2d')](_0x4f9fe4[_0x19d0('0x2a')],_0x4f9fe4[_0x19d0('0x2c')]);_0x26a40b[_0x19d0('0x2e')]=_['intersection'](_0x4f9fe4[_0x19d0('0x2a')],qs['fields'](_0x28d38f[_0x19d0('0x2c')]['fields']));_0x26a40b[_0x19d0('0x2e')]=_0x26a40b[_0x19d0('0x2e')][_0x19d0('0x40')]?_0x26a40b[_0x19d0('0x2e')]:_0x4f9fe4[_0x19d0('0x2a')];if(_0x28d38f['query'][_0x19d0('0x39')]){_0x26a40b[_0x19d0('0x3a')]=[{'all':!![]}];}_0x26a40b=_['merge']({},_0x26a40b,_0x28d38f[_0x19d0('0x38')]);return db['CmCompany'][_0x19d0('0x41')](_0x26a40b)[_0x19d0('0x21')](handleEntityNotFound(_0x441acf,null))[_0x19d0('0x21')](respondWithResult(_0x441acf,null))[_0x19d0('0x3d')](handleError(_0x441acf,null));};exports[_0x19d0('0x42')]=function(_0x57131b,_0xadb10e){return db[_0x19d0('0x3e')]['create'](_0x57131b[_0x19d0('0x43')],{})['then'](function(_0x36514b){var _0x532f6b=_0x57131b['user'][_0x19d0('0x44')]({'plain':!![]});if(!_0x532f6b)throw new Error(_0x19d0('0x45'));if(_0x532f6b['role']===_0x19d0('0x46')){var _0x2e124a=_0x36514b['get']({'plain':!![]});var _0xb0233a=_0x19d0('0x47');return db[_0x19d0('0x48')][_0x19d0('0x41')]({'where':{'name':_0xb0233a,'userProfileId':_0x532f6b[_0x19d0('0x49')]},'raw':!![]})[_0x19d0('0x21')](function(_0x3c1bc6){if(_0x3c1bc6&&_0x3c1bc6[_0x19d0('0x4a')]===0x0){return db[_0x19d0('0x23')]['create']({'name':_0x2e124a[_0x19d0('0x26')],'resourceId':_0x2e124a['id'],'type':_0x3c1bc6[_0x19d0('0x26')],'sectionId':_0x3c1bc6['id']},{})[_0x19d0('0x21')](function(){return _0x36514b;});}else{return _0x36514b;}})[_0x19d0('0x3d')](function(_0x58bd81){logger['error'](_0x19d0('0x4b'),_0x58bd81);throw _0x58bd81;});}return _0x36514b;})[_0x19d0('0x21')](respondWithResult(_0xadb10e,0xc9))['catch'](handleError(_0xadb10e,null));};exports['update']=function(_0x7b26f9,_0x45e364){if(_0x7b26f9[_0x19d0('0x43')]['id']){delete _0x7b26f9[_0x19d0('0x43')]['id'];}return db[_0x19d0('0x3e')][_0x19d0('0x41')]({'where':{'id':_0x7b26f9['params']['id']}})[_0x19d0('0x21')](handleEntityNotFound(_0x45e364,null))[_0x19d0('0x21')](saveUpdates(_0x7b26f9[_0x19d0('0x43')],null))[_0x19d0('0x21')](respondWithResult(_0x45e364,null))['catch'](handleError(_0x45e364,null));};exports['destroy']=function(_0x5274e8,_0x154901){return db['CmCompany'][_0x19d0('0x41')]({'where':{'id':_0x5274e8[_0x19d0('0x4c')]['id']}})[_0x19d0('0x21')](handleEntityNotFound(_0x154901,null))[_0x19d0('0x21')](removeEntity(_0x154901,null))[_0x19d0('0x3d')](handleError(_0x154901,null));};exports[_0x19d0('0x29')]=function(_0x2e0a3b,_0x48405a){return db[_0x19d0('0x3e')][_0x19d0('0x29')]()[_0x19d0('0x21')](respondWithResult(_0x48405a,null))['catch'](handleError(_0x48405a,null));};exports['addContacts']=function(_0x252dc9,_0x4ccbbe,_0x1c8dde){return db['CmContact'][_0x19d0('0x41')]({'where':{'id':_0x252dc9[_0x19d0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4ccbbe,null))[_0x19d0('0x21')](function(_0x3829dd){if(_0x3829dd){return _0x3829dd[_0x19d0('0x4d')](_0x252dc9['body'][_0x19d0('0x4e')],_[_0x19d0('0x4f')](_0x252dc9['body'],[_0x19d0('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x4ccbbe,null))[_0x19d0('0x3d')](handleError(_0x4ccbbe,null));};exports[_0x19d0('0x50')]=function(_0x1bedd6,_0x31c174,_0x1ad804){var _0x107305={};var _0x39ad20={};var _0x383881;var _0x3c875c;return db['CmCompany'][_0x19d0('0x51')]({'where':{'id':_0x1bedd6['params']['id']}})[_0x19d0('0x21')](handleEntityNotFound(_0x31c174,null))['then'](function(_0xac0d57){if(_0xac0d57){_0x383881=_0xac0d57;_0x39ad20[_0x19d0('0x2a')]=_[_0x19d0('0x2b')](db[_0x19d0('0x52')][_0x19d0('0x3f')]);_0x39ad20[_0x19d0('0x2c')]=_[_0x19d0('0x2b')](_0x1bedd6[_0x19d0('0x2c')]);_0x39ad20[_0x19d0('0x33')]=_[_0x19d0('0x2d')](_0x39ad20[_0x19d0('0x2a')],_0x39ad20['query']);_0x107305[_0x19d0('0x2e')]=_[_0x19d0('0x2d')](_0x39ad20['model'],qs[_0x19d0('0x2f')](_0x1bedd6[_0x19d0('0x2c')][_0x19d0('0x2f')]));_0x107305[_0x19d0('0x2e')]=_0x107305[_0x19d0('0x2e')][_0x19d0('0x40')]?_0x107305[_0x19d0('0x2e')]:_0x39ad20[_0x19d0('0x2a')];_0x107305[_0x19d0('0x53')]=qs[_0x19d0('0x32')](_0x1bedd6[_0x19d0('0x2c')][_0x19d0('0x32')]);_0x107305[_0x19d0('0x35')]=qs[_0x19d0('0x33')](_['pick'](_0x1bedd6['query'],_0x39ad20[_0x19d0('0x33')]));if(_0x1bedd6[_0x19d0('0x2c')][_0x19d0('0x34')]){_0x107305[_0x19d0('0x35')]=_['merge'](_0x107305[_0x19d0('0x35')],{'$or':_['map'](_0x107305[_0x19d0('0x2e')],function(_0x1ec2f5){var _0x43023d={};_0x43023d[_0x1ec2f5]={'$like':'%'+_0x1bedd6[_0x19d0('0x2c')][_0x19d0('0x34')]+'%'};return _0x43023d;})});}_0x107305=_[_0x19d0('0x36')]({},_0x107305,_0x1bedd6[_0x19d0('0x38')]);return _0x383881[_0x19d0('0x50')](_0x107305);}})[_0x19d0('0x21')](function(_0x11c194){if(_0x11c194){_0x3c875c=_0x11c194[_0x19d0('0x40')];if(!_0x1bedd6[_0x19d0('0x2c')][_0x19d0('0x30')](_0x19d0('0x31'))){_0x107305[_0x19d0('0x1c')]=qs[_0x19d0('0x1c')](_0x1bedd6[_0x19d0('0x2c')]['limit']);_0x107305[_0x19d0('0x1b')]=qs[_0x19d0('0x1b')](_0x1bedd6['query'][_0x19d0('0x1b')]);}return _0x383881[_0x19d0('0x50')](_0x107305);}})[_0x19d0('0x21')](function(_0x1feff5){if(_0x1feff5){return _0x1feff5?{'count':_0x3c875c,'rows':_0x1feff5}:null;}})[_0x19d0('0x21')](respondWithResult(_0x31c174,null))[_0x19d0('0x3d')](handleError(_0x31c174,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index c253b98..596eb69 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 _0x7764=['moment','bluebird','request-promise','path','rimraf','../../config/environment','CmCompany','cm_companies','lodash','util','../../config/logger','api'];(function(_0x1d30a3,_0x5f428c){var _0x32bba1=function(_0x5a60cc){while(--_0x5a60cc){_0x1d30a3['push'](_0x1d30a3['shift']());}};_0x32bba1(++_0x5f428c);}(_0x7764,0xa4));var _0x4776=function(_0x218994,_0x2cf487){_0x218994=_0x218994-0x0;var _0x3f350b=_0x7764[_0x218994];return _0x3f350b;};'use strict';var _=require(_0x4776('0x0'));var util=require(_0x4776('0x1'));var logger=require(_0x4776('0x2'))(_0x4776('0x3'));var moment=require(_0x4776('0x4'));var BPromise=require(_0x4776('0x5'));var rp=require(_0x4776('0x6'));var fs=require('fs');var path=require(_0x4776('0x7'));var rimraf=require(_0x4776('0x8'));var config=require(_0x4776('0x9'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0xc431bf,_0x3eff9c){return _0xc431bf['define'](_0x4776('0xa'),attributes,{'tableName':_0x4776('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd13e=['bluebird','path','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','util','../../config/logger','api'];(function(_0x2e112f,_0x11d82f){var _0x4928be=function(_0x21738b){while(--_0x21738b){_0x2e112f['push'](_0x2e112f['shift']());}};_0x4928be(++_0x11d82f);}(_0xd13e,0x193));var _0xed13=function(_0x41437f,_0x1d126f){_0x41437f=_0x41437f-0x0;var _0x1e35ab=_0xd13e[_0x41437f];return _0x1e35ab;};'use strict';var _=require(_0xed13('0x0'));var util=require(_0xed13('0x1'));var logger=require(_0xed13('0x2'))(_0xed13('0x3'));var moment=require('moment');var BPromise=require(_0xed13('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed13('0x5'));var rimraf=require('rimraf');var config=require(_0xed13('0x6'));var attributes=require(_0xed13('0x7'));module['exports']=function(_0x50de44,_0x5142bd){return _0x50de44[_0xed13('0x8')](_0xed13('0x9'),attributes,{'tableName':_0xed13('0xa'),'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 217dd9a..f431a89 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 _0xe2d7=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x571f15,_0x3ce78c){var _0x56ab8a=function(_0x487351){while(--_0x487351){_0x571f15['push'](_0x571f15['shift']());}};_0x56ab8a(++_0x3ce78c);}(_0xe2d7,0x182));var _0x7e2d=function(_0xaf237,_0x543496){_0xaf237=_0xaf237-0x0;var _0x176b7d=_0xe2d7[_0xaf237];return _0x176b7d;};'use strict';var _=require(_0x7e2d('0x0'));var util=require(_0x7e2d('0x1'));var moment=require(_0x7e2d('0x2'));var BPromise=require(_0x7e2d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e2d('0x4'));var db=require(_0x7e2d('0x5'))['db'];var utils=require(_0x7e2d('0x6'));var logger=require(_0x7e2d('0x7'))(_0x7e2d('0x8'));var config=require(_0x7e2d('0x9'));var jayson=require(_0x7e2d('0xa'));var client=jayson[_0x7e2d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x440351,_0x302fe4,_0x25f26b){return new BPromise(function(_0x2c88f8,_0x592b48){return client['request'](_0x440351,_0x25f26b)[_0x7e2d('0xc')](function(_0x377d68){logger[_0x7e2d('0xd')](_0x7e2d('0xe'),_0x302fe4,_0x7e2d('0xf'));logger[_0x7e2d('0x10')](_0x7e2d('0x11'),_0x302fe4,_0x7e2d('0xf'),JSON[_0x7e2d('0x12')](_0x377d68));if(_0x377d68[_0x7e2d('0x13')]){if(_0x377d68['error'][_0x7e2d('0x14')]===0x1f4){logger[_0x7e2d('0x13')]('CmCompany,\x20%s,\x20%s',_0x302fe4,_0x377d68['error'][_0x7e2d('0x15')]);return _0x592b48(_0x377d68['error']['message']);}logger[_0x7e2d('0x13')](_0x7e2d('0xe'),_0x302fe4,_0x377d68['error'][_0x7e2d('0x15')]);return _0x2c88f8(_0x377d68['error'][_0x7e2d('0x15')]);}else{logger[_0x7e2d('0xd')](_0x7e2d('0xe'),_0x302fe4,_0x7e2d('0xf'));_0x2c88f8(_0x377d68['result'][_0x7e2d('0x15')]);}})[_0x7e2d('0x16')](function(_0x212e39){logger[_0x7e2d('0x13')](_0x7e2d('0xe'),_0x302fe4,_0x212e39);_0x592b48(_0x212e39);});});} \ No newline at end of file +var _0x7b14=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x7b14,0x112));var _0x47b1=function(_0x2007b4,_0x384151){_0x2007b4=_0x2007b4-0x0;var _0x2067cd=_0x7b14[_0x2007b4];return _0x2067cd;};'use strict';var _=require(_0x47b1('0x0'));var util=require(_0x47b1('0x1'));var moment=require(_0x47b1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47b1('0x3'));var db=require(_0x47b1('0x4'))['db'];var utils=require(_0x47b1('0x5'));var logger=require(_0x47b1('0x6'))(_0x47b1('0x7'));var config=require(_0x47b1('0x8'));var jayson=require(_0x47b1('0x9'));var client=jayson[_0x47b1('0xa')][_0x47b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x468a96,_0x1e672c,_0x599848){return new BPromise(function(_0x49a6cb,_0x59fe1a){return client[_0x47b1('0xc')](_0x468a96,_0x599848)[_0x47b1('0xd')](function(_0x38fac7){logger[_0x47b1('0xe')](_0x47b1('0xf'),_0x1e672c,'request\x20sent');logger[_0x47b1('0x10')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x1e672c,_0x47b1('0x11'),JSON[_0x47b1('0x12')](_0x38fac7));if(_0x38fac7[_0x47b1('0x13')]){if(_0x38fac7[_0x47b1('0x13')][_0x47b1('0x14')]===0x1f4){logger['error'](_0x47b1('0xf'),_0x1e672c,_0x38fac7['error'][_0x47b1('0x15')]);return _0x59fe1a(_0x38fac7[_0x47b1('0x13')][_0x47b1('0x15')]);}logger[_0x47b1('0x13')](_0x47b1('0xf'),_0x1e672c,_0x38fac7['error'][_0x47b1('0x15')]);return _0x49a6cb(_0x38fac7[_0x47b1('0x13')][_0x47b1('0x15')]);}else{logger[_0x47b1('0xe')](_0x47b1('0xf'),_0x1e672c,_0x47b1('0x11'));_0x49a6cb(_0x38fac7[_0x47b1('0x16')]['message']);}})['catch'](function(_0x4ae160){logger['error'](_0x47b1('0xf'),_0x1e672c,_0x4ae160);_0x59fe1a(_0x4ae160);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 06c19e5..f381986 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 _0x6050=['./cmCompany.controller','get','/:id','isAuthenticated','show','getContacts','post','create','/:id/contacts','addContacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x76ffb9,_0x59d259){var _0x2fbb0a=function(_0x197e9f){while(--_0x197e9f){_0x76ffb9['push'](_0x76ffb9['shift']());}};_0x2fbb0a(++_0x59d259);}(_0x6050,0x196));var _0x0605=function(_0x16f255,_0x46d9c1){_0x16f255=_0x16f255-0x0;var _0xceb302=_0x6050[_0x16f255];return _0xceb302;};'use strict';var multer=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var path=require(_0x0605('0x2'));var timeout=require(_0x0605('0x3'));var express=require(_0x0605('0x4'));var router=express[_0x0605('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0605('0x6'));var config=require(_0x0605('0x7'));var controller=require(_0x0605('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0605('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x0605('0x9')](_0x0605('0xa'),auth[_0x0605('0xb')](),controller[_0x0605('0xc')]);router[_0x0605('0x9')]('/:id/contacts',auth[_0x0605('0xb')](),controller[_0x0605('0xd')]);router[_0x0605('0xe')]('/',auth[_0x0605('0xb')](),controller[_0x0605('0xf')]);router[_0x0605('0xe')](_0x0605('0x10'),auth[_0x0605('0xb')](),controller[_0x0605('0x11')]);router[_0x0605('0x12')](_0x0605('0xa'),auth[_0x0605('0xb')](),controller[_0x0605('0x13')]);router[_0x0605('0x14')](_0x0605('0xa'),auth[_0x0605('0xb')](),controller[_0x0605('0x15')]);module[_0x0605('0x16')]=router; \ No newline at end of file +var _0xa30a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/contacts','post','addContacts','update','destroy','exports','multer','util','path','express','Router'];(function(_0x34105f,_0x3f464b){var _0xd6d36e=function(_0x1c82ef){while(--_0x1c82ef){_0x34105f['push'](_0x34105f['shift']());}};_0xd6d36e(++_0x3f464b);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var path=require(_0xaa30('0x2'));var timeout=require('connect-timeout');var express=require(_0xaa30('0x3'));var router=express[_0xaa30('0x4')]();var auth=require(_0xaa30('0x5'));var interaction=require(_0xaa30('0x6'));var config=require(_0xaa30('0x7'));var controller=require(_0xaa30('0x8'));router[_0xaa30('0x9')]('/',auth['isAuthenticated'](),controller[_0xaa30('0xa')]);router['get'](_0xaa30('0xb'),auth[_0xaa30('0xc')](),controller[_0xaa30('0xd')]);router['get'](_0xaa30('0xe'),auth[_0xaa30('0xc')](),controller[_0xaa30('0xf')]);router[_0xaa30('0x9')](_0xaa30('0x10'),auth[_0xaa30('0xc')](),controller['getContacts']);router['post']('/',auth[_0xaa30('0xc')](),controller['create']);router[_0xaa30('0x11')](_0xaa30('0x10'),auth[_0xaa30('0xc')](),controller[_0xaa30('0x12')]);router['put'](_0xaa30('0xe'),auth[_0xaa30('0xc')](),controller[_0xaa30('0x13')]);router['delete'](_0xaa30('0xe'),auth[_0xaa30('0xc')](),controller[_0xaa30('0x14')]);module[_0xaa30('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 a3d4351..74aa520 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 _0x85c3=['lodash','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW'];(function(_0x5c08b2,_0x38ac9f){var _0x37abde=function(_0x4bdaf2){while(--_0x4bdaf2){_0x5c08b2['push'](_0x5c08b2['shift']());}};_0x37abde(++_0x38ac9f);}(_0x85c3,0x1d8));var _0x385c=function(_0x1055d9,_0x145961){_0x1055d9=_0x1055d9-0x0;var _0x26b603=_0x85c3[_0x1055d9];return _0x26b603;};'use strict';var _=require(_0x385c('0x0'));var Sequelize=require('sequelize');module[_0x385c('0x1')]={'firstName':{'type':Sequelize[_0x385c('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x385c('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x385c('0x2')]},'country':{'type':Sequelize[_0x385c('0x2')]},'dateOfBirth':{'type':Sequelize[_0x385c('0x2')]},'description':{'type':Sequelize[_0x385c('0x3')]},'phone':{'type':Sequelize[_0x385c('0x2')]},'mobile':{'type':Sequelize[_0x385c('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x385c('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x385c('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x385c('0x2')]},'skype':{'type':Sequelize[_0x385c('0x2')]},'teams':{'type':Sequelize[_0x385c('0x2')]},'viber':{'type':Sequelize[_0x385c('0x2')]},'line':{'type':Sequelize[_0x385c('0x2')]},'wechat':{'type':Sequelize[_0x385c('0x2')]},'telegram':{'type':Sequelize[_0x385c('0x2')]},'UserId':{'type':Sequelize[_0x385c('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x385c('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x385c('0x6')],'defaultValue':Sequelize[_0x385c('0x7')]}}; \ No newline at end of file +var _0x25fa=['exports','STRING','TEXT','INTEGER','DATE','NOW','lodash','sequelize'];(function(_0x3e8426,_0x49a842){var _0x874e2e=function(_0x3b3699){while(--_0x3b3699){_0x3e8426['push'](_0x3e8426['shift']());}};_0x874e2e(++_0x49a842);}(_0x25fa,0x13e));var _0xa25f=function(_0x66a9c5,_0x8474b7){_0x66a9c5=_0x66a9c5-0x0;var _0x580d0e=_0x25fa[_0x66a9c5];return _0x580d0e;};'use strict';var _=require(_0xa25f('0x0'));var Sequelize=require(_0xa25f('0x1'));module[_0xa25f('0x2')]={'firstName':{'type':Sequelize[_0xa25f('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xa25f('0x3')]},'postalCode':{'type':Sequelize[_0xa25f('0x3')]},'city':{'type':Sequelize[_0xa25f('0x3')]},'country':{'type':Sequelize[_0xa25f('0x3')]},'dateOfBirth':{'type':Sequelize[_0xa25f('0x3')]},'description':{'type':Sequelize[_0xa25f('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xa25f('0x3')]},'email':{'type':Sequelize[_0xa25f('0x3')]},'url':{'type':Sequelize[_0xa25f('0x3')]},'facebook':{'type':Sequelize[_0xa25f('0x3')]},'fb_data':{'type':Sequelize[_0xa25f('0x3')]},'twitter':{'type':Sequelize[_0xa25f('0x3')]},'skype':{'type':Sequelize[_0xa25f('0x3')]},'teams':{'type':Sequelize[_0xa25f('0x3')]},'viber':{'type':Sequelize[_0xa25f('0x3')]},'line':{'type':Sequelize[_0xa25f('0x3')]},'wechat':{'type':Sequelize[_0xa25f('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xa25f('0x5')]},'priority':{'type':Sequelize[_0xa25f('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa25f('0x6')],'defaultValue':Sequelize[_0xa25f('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index c1737c7..81a3f1a 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 _0xeebe=['reject','save','update','then','destroy','error','stack','name','send','index','CmContact','describe','length','keys','startsWith','cf_','push','trimStart','all','fieldType','type','query','filters','intersection','model','fields','attributes','nolimit','limit','order','sort','where','pick','field','color','tools_tags','select','from','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','parseSearch','sqlOperator','conditions','find','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','datetime','castTo','DATE','buildExpression','text','start','isNil','Contact','isEmpty','concat','tag','isArray','filter','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','clone','DESC','having','resolve','user','role','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','agent','ListId','sequelize','toString','keyBy','c.firstName','c.phone','c.mobile','c.fax','c.ListId','c.createdAt','c.CompanyId','TagIds','Tags','rows','params','catch','tags','findAll','columnName','displayName','alias','custom','values','hasOwnProperty','merge','body','get','mergeWith','[CmContact][merge]\x20to\x20%s\x20from\x20%s','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatOfflineMessage','MailMessage','MailInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappQueueReport','create','join','each','duplicates','$or','findOrCreate','$and','omit','cf_%d','pickBy','format','table','cm_contacts','setFields','toParam','phone','CmHopper','rawAttributes','options','getTags','findOne','setTags','ids','getHoppers','ContactId','includeAll','include','getHopperHistories','CmHopperHistory','getHopperFinals','getJscriptySessions','binding_keys','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','firstName','root','server/files/tmp','file','filename','chmodSync','0777','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','upload','createReadStream','meta','import','No\x20ListId\x20specified','binding','No\x20phone\x20column\x20specified','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','getJourney','mail','sms','openchannel','fax','whatsapp','voice','-createdAt','includes','channel','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','userSecondDisposition','userThirdDisposition','fullname','createdAt','VoiceCallReport','findAndCountAll','startCase','chat','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','UserId','Owner','browserName','customerPort','osName','ratingMessage','ratingType','ratingValue','referer','substatus','threadId','Interaction','sortBy','reverse','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','end','json','count','offset','apply'];(function(_0x1b8d87,_0x4168fb){var _0x182b74=function(_0x12b570){while(--_0x12b570){_0x1b8d87['push'](_0x1b8d87['shift']());}};_0x182b74(++_0x4168fb);}(_0xeebe,0xff));var _0xeeeb=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xeebe[_0x5d4607];return _0x5e4a86;};'use strict';var pdf=require(_0xeeeb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xeeeb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeeeb('0x2'));var rp=require(_0xeeeb('0x3'));var moment=require(_0xeeeb('0x4'));var BPromise=require(_0xeeeb('0x5'));var Mustache=require(_0xeeeb('0x6'));var util=require(_0xeeeb('0x7'));var path=require(_0xeeeb('0x8'));var sox=require(_0xeeeb('0x9'));var csv=require(_0xeeeb('0xa'));var ejs=require(_0xeeeb('0xb'));var fs=require('fs');var _=require(_0xeeeb('0xc'));var squel=require(_0xeeeb('0xd'));var crypto=require(_0xeeeb('0xe'));var jsforce=require(_0xeeeb('0xf'));var deskjs=require(_0xeeeb('0x10'));var toCsv=require(_0xeeeb('0xa'));var querystring=require(_0xeeeb('0x11'));var Papa=require(_0xeeeb('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeeeb('0x13'));var as=require(_0xeeeb('0x14'));var hardwareService=require(_0xeeeb('0x15'));var logger=require('../../config/logger')(_0xeeeb('0x16'));var utils=require(_0xeeeb('0x17'));var config=require(_0xeeeb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xeeeb('0x19'))['db'];config['redis']=_['defaults'](config[_0xeeeb('0x1a')],{'host':_0xeeeb('0x1b'),'port':0x18eb});var socket=require(_0xeeeb('0x1c'))(new Redis(config[_0xeeeb('0x1a')]));require(_0xeeeb('0x1d'))[_0xeeeb('0x1e')](socket);function respondWithStatusCode(_0x17a038,_0x2ebb9a){_0x2ebb9a=_0x2ebb9a||0xcc;return function(_0x40b8e8){if(_0x40b8e8){return _0x17a038[_0xeeeb('0x1f')](_0x2ebb9a);}return _0x17a038[_0xeeeb('0x20')](_0x2ebb9a)[_0xeeeb('0x21')]();};}function respondWithResult(_0x1cbbbc,_0x25a5be){_0x25a5be=_0x25a5be||0xc8;return function(_0x253cf4){if(_0x253cf4){return _0x1cbbbc[_0xeeeb('0x20')](_0x25a5be)[_0xeeeb('0x22')](_0x253cf4);}};}function respondWithFilteredResult(_0x192efe,_0x106a84){return function(_0x2db8b1){if(_0x2db8b1){var _0x37efe6=_0x2db8b1[_0xeeeb('0x23')],_0x1af658=_0x106a84[_0xeeeb('0x24')],_0x2dba71=_0x106a84[_0xeeeb('0x24')]+_0x106a84['limit'],_0x313862;if(_0x2dba71>=_0x37efe6){_0x2dba71=_0x37efe6;_0x313862=0xc8;}else{_0x313862=0xce;}_0x192efe[_0xeeeb('0x20')](_0x313862);return _0x192efe['set']('Content-Range',_0x1af658+'-'+_0x2dba71+'/'+_0x37efe6)['json'](_0x2db8b1);}return null;};}function patchUpdates(_0x5b3cc8){return function(_0x9bf651){try{jsonpatch[_0xeeeb('0x25')](_0x9bf651,_0x5b3cc8,!![]);}catch(_0x506519){return BPromise[_0xeeeb('0x26')](_0x506519);}return _0x9bf651[_0xeeeb('0x27')]();};}function saveUpdates(_0x4acdc7,_0x4d4281){return function(_0x3409aa){if(_0x3409aa){return _0x3409aa[_0xeeeb('0x28')](_0x4acdc7)[_0xeeeb('0x29')](function(_0x70ce3c){return _0x70ce3c;});}return null;};}function removeEntity(_0x15aa09,_0x52db77){return function(_0x163471){if(_0x163471){return _0x163471[_0xeeeb('0x2a')]()['then'](function(){_0x15aa09['status'](0xcc)[_0xeeeb('0x21')]();});}};}function handleEntityNotFound(_0x3df022,_0x20ee2d){return function(_0xf0b577){if(!_0xf0b577){_0x3df022[_0xeeeb('0x1f')](0x194);}return _0xf0b577;};}function handleError(_0x192698,_0x22a67c){_0x22a67c=_0x22a67c||0x1f4;return function(_0x2f5854){logger[_0xeeeb('0x2b')](_0x2f5854[_0xeeeb('0x2c')]);if(_0x2f5854[_0xeeeb('0x2d')]){delete _0x2f5854['name'];}_0x192698['status'](_0x22a67c)[_0xeeeb('0x2e')](_0x2f5854);};}exports[_0xeeeb('0x2f')]=function(_0xc79799,_0x49e349){var _0x1d7c1e={},_0x210acb={},_0x5862bd={'count':0x0,'rows':[]};return db[_0xeeeb('0x30')][_0xeeeb('0x31')]()[_0xeeeb('0x29')](function(_0x230d38){var _0x725b79=[];for(var _0x1db147=0x0;_0x1db1470x1){_0x62dd6d['or'](_0xeeeb('0x6d'),qs[_0xeeeb('0x6e')](_0x2299a9),null);}else{if(qs[_0xeeeb('0x6f')](_0x2299a9)){_0x62dd6d['or']('c.id\x20LIKE\x20?',_0x2299a9+'%');_0x62dd6d['or'](_0xeeeb('0x70'),_0x2299a9+'%');_0x62dd6d['or'](_0xeeeb('0x71'),_0x2299a9+'%');_0x62dd6d['or'](_0xeeeb('0x72'),_0x2299a9+'%');}else if(qs[_0xeeeb('0x73')](_0x2299a9)){_0x62dd6d['or']('c.email\x20LIKE\x20?',_0x2299a9+'%');}else{_0x62dd6d['or'](_0xeeeb('0x74'),'%'+_0x2299a9+'%');_0x62dd6d['or'](_0xeeeb('0x75'),'%'+_0x2299a9+'%');_0x62dd6d['or']('c.email\x20LIKE\x20?','%'+_0x2299a9+'%');}}}}_0x2ce956[_0xeeeb('0x45')](_0x62dd6d);_0x2ce956[_0xeeeb('0x76')](_0xeeeb('0x77'));var _0x12dc4f={'type':db[_0xeeeb('0x78')][_0xeeeb('0x79')]['SELECT'],'raw':!![]};var _0x261761=_0x2ce956[_0xeeeb('0x7a')]()['field'](_0xeeeb('0x77'));if(_0x1d7c1e[_0xeeeb('0x43')]){_0x1d7c1e[_0xeeeb('0x43')][_0xeeeb('0x5a')](function(_0x1672a7){_0x2ce956[_0xeeeb('0x43')]('c.'+_0x1672a7[0x0],_0x1672a7[0x1]===_0xeeeb('0x7b')?![]:!![]);});}if(!_[_0xeeeb('0x67')](_0x37d7a0)){_0x2ce956[_0xeeeb('0x7c')](_0x52d9a6);_0x261761[_0xeeeb('0x45')]('t.id\x20IN\x20?',_0x37d7a0);}BPromise[_0xeeeb('0x7d')]()['then'](function(){if(!_0x7de8de)return;if(_0xc79799[_0xeeeb('0x7e')][_0xeeeb('0x7f')]!=='agent')return;if(!_['some'](_0x7de8de[_0xeeeb('0x54')],['field',_0xeeeb('0x5d')])){return _0xc79799[_0xeeeb('0x7e')]['getLists']({'attributes':['id'],'raw':!![]})[_0xeeeb('0x29')](function(_0x1655f6){if(_[_0xeeeb('0x67')](_0x1655f6)){_0x261761[_0xeeeb('0x45')](_0xeeeb('0x80'));_0x2ce956[_0xeeeb('0x45')](_0xeeeb('0x80'));}else{_0x261761[_0xeeeb('0x45')]('c.ListId\x20IN\x20?',_[_0xeeeb('0x59')](_0x1655f6,'id'));_0x2ce956[_0xeeeb('0x45')](_0xeeeb('0x81'),_[_0xeeeb('0x59')](_0x1655f6,'id'));}});}})[_0xeeeb('0x29')](function(){if(_0xc79799[_0xeeeb('0x7e')]['role']===_0xeeeb('0x82')&&!_0x7de8de&&!_0xc79799[_0xeeeb('0x3b')][_0xeeeb('0x83')])return[];return db[_0xeeeb('0x84')][_0xeeeb('0x3b')](_0x261761[_0xeeeb('0x85')](),_0x12dc4f);})[_0xeeeb('0x29')](function(_0x5b4d5c){_0x5862bd['count']=_0x5b4d5c[_0xeeeb('0x32')];if(_0x5862bd['count']===0x0)return[];return db[_0xeeeb('0x84')][_0xeeeb('0x3b')](_0x5ebea3[_0xeeeb('0x85')](),_0x12dc4f)['then'](function(_0x206a5f){_0x4df294=_[_0xeeeb('0x86')](_0x206a5f,'id');_0x12dc4f=_['merge'](_0x12dc4f,{'model':db[_0xeeeb('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xc79799['query'][_0xeeeb('0x3f')]){_0x1d7c1e['attributes'][_0xeeeb('0x5a')](function(_0xbca82b){_0x2ce956[_0xeeeb('0x47')]('c.'+_0xbca82b);});}else{_0x2ce956['field'](_0xeeeb('0x77'));_0x2ce956['field'](_0xeeeb('0x87'));_0x2ce956['field']('c.lastName');_0x2ce956['field'](_0xeeeb('0x88'));_0x2ce956[_0xeeeb('0x47')](_0xeeeb('0x89'));_0x2ce956['field'](_0xeeeb('0x8a'));_0x2ce956[_0xeeeb('0x47')]('c.email');_0x2ce956[_0xeeeb('0x47')](_0xeeeb('0x8b'));_0x2ce956[_0xeeeb('0x47')](_0xeeeb('0x8c'));_0x2ce956['field']('c.deletedAt');_0x2ce956[_0xeeeb('0x47')](_0xeeeb('0x8d'));_0x2ce956[_0xeeeb('0x47')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xeeeb('0x8e'));}if(_0x1d7c1e['limit'])_0x2ce956[_0xeeeb('0x42')](_0x1d7c1e['limit']);if(_0x1d7c1e[_0xeeeb('0x24')])_0x2ce956[_0xeeeb('0x24')](_0x1d7c1e[_0xeeeb('0x24')]);return db[_0xeeeb('0x84')][_0xeeeb('0x3b')](_0x2ce956[_0xeeeb('0x85')](),_0x12dc4f);});})['then'](function(_0x476b32){_0x476b32[_0xeeeb('0x5a')](function(_0x468f1c){if(_0x468f1c[_0xeeeb('0x8e')]){_0x468f1c[_0xeeeb('0x8f')]=[];_0x468f1c['TagIds'][_0xeeeb('0x58')](',')['forEach'](function(_0x251a65){_0x468f1c['Tags'][_0xeeeb('0x36')](_0x4df294[_0x251a65]);});}delete _0x468f1c['TagIds'];});_0x5862bd[_0xeeeb('0x90')]=_0x476b32;return _0x5862bd;})[_0xeeeb('0x29')](respondWithFilteredResult(_0x49e349,_0x1d7c1e));})['catch'](handleError(_0x49e349,null));};exports[_0xeeeb('0x2a')]=function(_0x56fbdc,_0x49e49c){return db[_0xeeeb('0x30')][_0xeeeb('0x55')]({'where':{'id':_0x56fbdc[_0xeeeb('0x91')]['id']}})['then'](handleEntityNotFound(_0x49e49c,null))['then'](removeEntity(_0x49e49c,null))[_0xeeeb('0x92')](handleError(_0x49e49c,null));};exports['describe']=function(_0x20dd64,_0x449f8a){return db[_0xeeeb('0x30')][_0xeeeb('0x31')]()[_0xeeeb('0x29')](function(_0x4192a3){delete _0x4192a3[_0xeeeb('0x93')];for(var _0x4931cb=0x0;_0x4931cb=_0x5f2172){_0x43a192=_0x5f2172;_0x48421e=0xc8;}else{_0x48421e=0xce;}_0x41a11e['status'](_0x48421e);return _0x41a11e[_0x8194('0x24')]('Content-Range',_0x37b048+'-'+_0x43a192+'/'+_0x5f2172)[_0x8194('0x25')](_0x55e4c2);}return null;};}function patchUpdates(_0x24d1ff){return function(_0x9421f5){try{jsonpatch['apply'](_0x9421f5,_0x24d1ff,!![]);}catch(_0x3cdb81){return BPromise[_0x8194('0x26')](_0x3cdb81);}return _0x9421f5[_0x8194('0x27')]();};}function saveUpdates(_0x28df4f,_0x1babf1){return function(_0x17dcde){if(_0x17dcde){return _0x17dcde[_0x8194('0x28')](_0x28df4f)[_0x8194('0x29')](function(_0x269a22){return _0x269a22;});}return null;};}function removeEntity(_0x263093,_0xbb64b7){return function(_0x300491){if(_0x300491){return _0x300491['destroy']()[_0x8194('0x29')](function(){_0x263093[_0x8194('0x20')](0xcc)[_0x8194('0x21')]();});}};}function handleEntityNotFound(_0x46a242,_0x55b0d9){return function(_0x34c430){if(!_0x34c430){_0x46a242[_0x8194('0x1f')](0x194);}return _0x34c430;};}function handleError(_0x425a1d,_0x42c3b0){_0x42c3b0=_0x42c3b0||0x1f4;return function(_0x3e8cb3){logger['error'](_0x3e8cb3['stack']);if(_0x3e8cb3[_0x8194('0x2a')]){delete _0x3e8cb3[_0x8194('0x2a')];}_0x425a1d[_0x8194('0x20')](_0x42c3b0)[_0x8194('0x2b')](_0x3e8cb3);};}exports[_0x8194('0x2c')]=function(_0x56c512,_0x4af9cc){var _0x5624a0={},_0x1ea1f={},_0x56b5bc={'count':0x0,'rows':[]};return db['CmContact'][_0x8194('0x2d')]()[_0x8194('0x29')](function(_0x4ee84e){var _0x1ef19a=[];for(var _0x58f209=0x0;_0x58f2090x1){_0x4c0350['or'](_0x8194('0x6c'),qs['getFullTextValue'](_0xfaa533),null);}else{if(qs[_0x8194('0x6d')](_0xfaa533)){_0x4c0350['or'](_0x8194('0x6e'),_0xfaa533+'%');_0x4c0350['or'](_0x8194('0x6f'),_0xfaa533+'%');_0x4c0350['or'](_0x8194('0x70'),_0xfaa533+'%');_0x4c0350['or'](_0x8194('0x71'),_0xfaa533+'%');}else if(qs[_0x8194('0x72')](_0xfaa533)){_0x4c0350['or'](_0x8194('0x73'),_0xfaa533+'%');}else{_0x4c0350['or'](_0x8194('0x74'),'%'+_0xfaa533+'%');_0x4c0350['or'](_0x8194('0x75'),'%'+_0xfaa533+'%');_0x4c0350['or'](_0x8194('0x73'),'%'+_0xfaa533+'%');}}}}_0x369856[_0x8194('0x66')](_0x4c0350);_0x369856[_0x8194('0x76')](_0x8194('0x77'));var _0x545068={'type':db['Sequelize']['QueryTypes'][_0x8194('0x78')],'raw':!![]};var _0x42f541=_0x369856[_0x8194('0x79')]()['field'](_0x8194('0x77'));if(_0x5624a0[_0x8194('0x3e')]){_0x5624a0['order'][_0x8194('0x56')](function(_0x494f0f){_0x369856['order']('c.'+_0x494f0f[0x0],_0x494f0f[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x573003)){_0x369856[_0x8194('0x7a')](_0x1200c8);_0x42f541[_0x8194('0x66')](_0x8194('0x7b'),_0x573003);}BPromise[_0x8194('0x7c')]()['then'](function(){if(!_0x958766)return;if(_0x56c512[_0x8194('0x7d')][_0x8194('0x7e')]!==_0x8194('0x7f'))return;if(!_[_0x8194('0x80')](_0x958766[_0x8194('0x50')],[_0x8194('0x42'),_0x8194('0x59')])){return _0x56c512[_0x8194('0x7d')][_0x8194('0x81')]({'attributes':['id'],'raw':!![]})[_0x8194('0x29')](function(_0x4b4c70){if(_['isEmpty'](_0x4b4c70)){_0x42f541['where'](_0x8194('0x82'));_0x369856[_0x8194('0x66')]('c.ListId\x20IS\x20NULL');}else{_0x42f541[_0x8194('0x66')](_0x8194('0x83'),_['map'](_0x4b4c70,'id'));_0x369856['where'](_0x8194('0x83'),_[_0x8194('0x55')](_0x4b4c70,'id'));}});}})[_0x8194('0x29')](function(){if(_0x56c512[_0x8194('0x7d')][_0x8194('0x7e')]==='agent'&&!_0x958766&&!_0x56c512['query']['ListId'])return[];return db[_0x8194('0x84')][_0x8194('0x35')](_0x42f541[_0x8194('0x85')](),_0x545068);})['then'](function(_0x24b6f9){_0x56b5bc['count']=_0x24b6f9[_0x8194('0x3b')];if(_0x56b5bc[_0x8194('0x22')]===0x0)return[];return db[_0x8194('0x84')]['query'](_0x4aa53a[_0x8194('0x85')](),_0x545068)['then'](function(_0x5e0778){_0x2256d8=_['keyBy'](_0x5e0778,'id');_0x545068=_[_0x8194('0x86')](_0x545068,{'model':db[_0x8194('0x87')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x56c512[_0x8194('0x35')][_0x8194('0x3a')]){_0x5624a0['attributes'][_0x8194('0x56')](function(_0x5a3a29){_0x369856[_0x8194('0x42')]('c.'+_0x5a3a29);});}else{_0x369856[_0x8194('0x42')](_0x8194('0x77'));_0x369856['field']('c.firstName');_0x369856[_0x8194('0x42')](_0x8194('0x88'));_0x369856[_0x8194('0x42')](_0x8194('0x89'));_0x369856[_0x8194('0x42')](_0x8194('0x8a'));_0x369856[_0x8194('0x42')](_0x8194('0x8b'));_0x369856[_0x8194('0x42')](_0x8194('0x8c'));_0x369856[_0x8194('0x42')]('c.ListId');_0x369856['field']('c.createdAt');_0x369856[_0x8194('0x42')](_0x8194('0x8d'));_0x369856[_0x8194('0x42')]('c.CompanyId');_0x369856[_0x8194('0x42')](_0x8194('0x8e'),_0x8194('0x8f'));}if(_0x5624a0['limit'])_0x369856[_0x8194('0x3d')](_0x5624a0[_0x8194('0x3d')]);if(_0x5624a0[_0x8194('0x23')])_0x369856[_0x8194('0x23')](_0x5624a0[_0x8194('0x23')]);return db['sequelize'][_0x8194('0x35')](_0x369856[_0x8194('0x85')](),_0x545068);});})['then'](function(_0x3ee59e){_0x3ee59e['forEach'](function(_0x1a2062){if(_0x1a2062[_0x8194('0x8f')]){_0x1a2062[_0x8194('0x90')]=[];_0x1a2062[_0x8194('0x8f')][_0x8194('0x54')](',')[_0x8194('0x56')](function(_0x29aaa6){_0x1a2062[_0x8194('0x90')]['push'](_0x2256d8[_0x29aaa6]);});}delete _0x1a2062[_0x8194('0x8f')];});_0x56b5bc[_0x8194('0x91')]=_0x3ee59e;return _0x56b5bc;})['then'](respondWithFilteredResult(_0x4af9cc,_0x5624a0));})['catch'](handleError(_0x4af9cc,null));};exports[_0x8194('0x92')]=function(_0x1c92d8,_0x8b3c28){return db[_0x8194('0x87')][_0x8194('0x51')]({'where':{'id':_0x1c92d8['params']['id']}})[_0x8194('0x29')](handleEntityNotFound(_0x8b3c28,null))[_0x8194('0x29')](removeEntity(_0x8b3c28,null))['catch'](handleError(_0x8b3c28,null));};exports[_0x8194('0x2d')]=function(_0x5acb38,_0x345cd7){return db['CmContact'][_0x8194('0x2d')]()[_0x8194('0x29')](function(_0x286d9d){delete _0x286d9d['tags'];for(var _0x55a34d=0x0;_0x55a34d{}\s\\|]/g,'-');_0x210ca4(null,util[_0x0ae6('0x27')](_0x0ae6('0x28'),path[_0x0ae6('0x29')](_0xb4e6af[_0x0ae6('0x25')],path['extname'](_0xb4e6af[_0x0ae6('0x25')])),Date[_0x0ae6('0x2a')](),path[_0x0ae6('0x2b')](_0xb4e6af[_0x0ae6('0x25')])));}})});router[_0x0ae6('0x1a')](_0x0ae6('0x2c'),upload['single'](_0x0ae6('0x2d')),controller[_0x0ae6('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x55dbe1,_0x44eb95,_0x3255a7){_0x3255a7(null,path[_0x0ae6('0x22')](config['root'],_0x0ae6('0x24')));},'filename':function(_0xb68cbe,_0x2533c2,_0x4df796){_0x2533c2[_0x0ae6('0x25')]=_0x2533c2[_0x0ae6('0x25')][_0x0ae6('0x26')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4df796(null,util[_0x0ae6('0x27')](_0x0ae6('0x28'),path[_0x0ae6('0x29')](_0x2533c2['originalname'],path['extname'](_0x2533c2[_0x0ae6('0x25')])),Date[_0x0ae6('0x2a')](),path['extname'](_0x2533c2['originalname'])));}})});router[_0x0ae6('0x1a')](_0x0ae6('0x2f'),upload[_0x0ae6('0x30')](_0x0ae6('0x2d')),controller['upload']);router[_0x0ae6('0x1a')](_0x0ae6('0x31'),auth[_0x0ae6('0x8')](),controller['import']);router[_0x0ae6('0x32')](_0x0ae6('0xd'),auth[_0x0ae6('0x8')](),controller[_0x0ae6('0x33')]);router[_0x0ae6('0x34')](_0x0ae6('0xd'),auth[_0x0ae6('0x8')](),controller[_0x0ae6('0x35')]);module[_0x0ae6('0x36')]=router; \ No newline at end of file +var _0x195e=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/tags','getTags','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','getJscriptySessions','post','merge','create','/create_many','bulkCreate','setTags','diskStorage','join','server/files/tmp','format','%s-%s%s','basename','originalname','extname','now','/csv','single','file','root','replace','/upload','upload','put','update','delete','destroy'];(function(_0x3124b0,_0xc41eba){var _0xfe72f9=function(_0xa2dffe){while(--_0xa2dffe){_0x3124b0['push'](_0x3124b0['shift']());}};_0xfe72f9(++_0xc41eba);}(_0x195e,0xfb));var _0xe195=function(_0x40e38c,_0xb765fc){_0x40e38c=_0x40e38c-0x0;var _0x5b9ac4=_0x195e[_0x40e38c];return _0x5b9ac4;};'use strict';var multer=require(_0xe195('0x0'));var util=require(_0xe195('0x1'));var path=require(_0xe195('0x2'));var timeout=require(_0xe195('0x3'));var express=require(_0xe195('0x4'));var router=express[_0xe195('0x5')]();var auth=require(_0xe195('0x6'));var interaction=require(_0xe195('0x7'));var config=require(_0xe195('0x8'));var controller=require(_0xe195('0x9'));router[_0xe195('0xa')]('/',auth[_0xe195('0xb')](),controller[_0xe195('0xc')]);router['get'](_0xe195('0xd'),auth[_0xe195('0xb')](),controller[_0xe195('0xe')]);router[_0xe195('0xa')](_0xe195('0xf'),auth['isAuthenticated'](),controller['show']);router['get'](_0xe195('0x10'),auth[_0xe195('0xb')](),controller[_0xe195('0x11')]);router[_0xe195('0xa')]('/:id/hoppers',auth[_0xe195('0xb')](),controller[_0xe195('0x12')]);router[_0xe195('0xa')]('/:id/hopper_histories',auth[_0xe195('0xb')](),controller[_0xe195('0x13')]);router['get'](_0xe195('0x14'),auth[_0xe195('0xb')](),controller[_0xe195('0x15')]);router[_0xe195('0xa')]('/:id/jscripty_sessions',auth[_0xe195('0xb')](),controller[_0xe195('0x16')]);router['get']('/:id/journey',auth[_0xe195('0xb')](),controller['getJourney']);router[_0xe195('0x17')]('/merge',auth['isAuthenticated'](),controller[_0xe195('0x18')]);router[_0xe195('0x17')]('/',auth[_0xe195('0xb')](),controller[_0xe195('0x19')]);router[_0xe195('0x17')](_0xe195('0x1a'),auth[_0xe195('0xb')](),controller[_0xe195('0x1b')]);router[_0xe195('0x17')](_0xe195('0x10'),auth['isAuthenticated'](),controller[_0xe195('0x1c')]);var upload=multer({'storage':multer[_0xe195('0x1d')]({'destination':function(_0xdf735a,_0x2cb300,_0x3f4326){_0x3f4326(null,path[_0xe195('0x1e')](config['root'],_0xe195('0x1f')));},'filename':function(_0x3e65b2,_0x334b4a,_0x1797ba){_0x334b4a['originalname']=_0x334b4a['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1797ba(null,util[_0xe195('0x20')](_0xe195('0x21'),path[_0xe195('0x22')](_0x334b4a[_0xe195('0x23')],path[_0xe195('0x24')](_0x334b4a[_0xe195('0x23')])),Date[_0xe195('0x25')](),path[_0xe195('0x24')](_0x334b4a[_0xe195('0x23')])));}})});router[_0xe195('0x17')](_0xe195('0x26'),upload[_0xe195('0x27')](_0xe195('0x28')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xe195('0x1d')]({'destination':function(_0x334cb8,_0x147563,_0x2a0504){_0x2a0504(null,path[_0xe195('0x1e')](config[_0xe195('0x29')],_0xe195('0x1f')));},'filename':function(_0x401808,_0x998af8,_0x1f1ca7){_0x998af8['originalname']=_0x998af8[_0xe195('0x23')][_0xe195('0x2a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1f1ca7(null,util[_0xe195('0x20')](_0xe195('0x21'),path[_0xe195('0x22')](_0x998af8['originalname'],path['extname'](_0x998af8[_0xe195('0x23')])),Date[_0xe195('0x25')](),path[_0xe195('0x24')](_0x998af8[_0xe195('0x23')])));}})});router[_0xe195('0x17')](_0xe195('0x2b'),upload['single'](_0xe195('0x28')),controller[_0xe195('0x2c')]);router[_0xe195('0x17')]('/upload/:id',auth[_0xe195('0xb')](),controller['import']);router[_0xe195('0x2d')](_0xe195('0xf'),auth['isAuthenticated'](),controller[_0xe195('0x2e')]);router[_0xe195('0x2f')](_0xe195('0xf'),auth['isAuthenticated'](),controller[_0xe195('0x30')]);module[_0xe195('0x31')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index c0c6de2..eec61f3 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x965d=['STRING','INTEGER','sequelize','exports'];(function(_0x2c9824,_0xc74186){var _0x2e3d41=function(_0x1dee17){while(--_0x1dee17){_0x2c9824['push'](_0x2c9824['shift']());}};_0x2e3d41(++_0xc74186);}(_0x965d,0x1be));var _0xd965=function(_0x42ee6c,_0x27c445){_0x42ee6c=_0x42ee6c-0x0;var _0x3e7ec4=_0x965d[_0x42ee6c];return _0x3e7ec4;};'use strict';var Sequelize=require(_0xd965('0x0'));module[_0xd965('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xd965('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xd965('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xd965('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xd965('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x885a=['exports','INTEGER','STRING','PHONE'];(function(_0x550a2b,_0x220da0){var _0x4ac9b4=function(_0x1c956c){while(--_0x1c956c){_0x550a2b['push'](_0x550a2b['shift']());}};_0x4ac9b4(++_0x220da0);}(_0x885a,0x180));var _0xa885=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x885a[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require('sequelize');module[_0xa885('0x0')]={'CmContactId':{'type':Sequelize[_0xa885('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xa885('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xa885('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xa885('0x3')},'OrderBy':{'type':Sequelize[_0xa885('0x1')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index d5d63aa..d114686 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0dfa=['to-csv','lodash','squel','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','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','CmContactHasItem','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','options','find','create','user','role','userProfileId','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x5455c9,_0x51d49d){var _0x4d0e51=function(_0x4b810e){while(--_0x4b810e){_0x5455c9['push'](_0x5455c9['shift']());}};_0x4d0e51(++_0x51d49d);}(_0x0dfa,0x13e));var _0xa0df=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x0dfa[_0x138adb];return _0x1b27f2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa0df('0x0'));var rimraf=require(_0xa0df('0x1'));var zipdir=require(_0xa0df('0x2'));var jsonpatch=require(_0xa0df('0x3'));var rp=require(_0xa0df('0x4'));var moment=require(_0xa0df('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa0df('0x6'));var util=require(_0xa0df('0x7'));var path=require(_0xa0df('0x8'));var sox=require(_0xa0df('0x9'));var csv=require(_0xa0df('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa0df('0xb'));var squel=require(_0xa0df('0xc'));var crypto=require('crypto');var jsforce=require(_0xa0df('0xd'));var deskjs=require(_0xa0df('0xe'));var toCsv=require(_0xa0df('0xa'));var querystring=require(_0xa0df('0xf'));var Papa=require(_0xa0df('0x10'));var Redis=require('ioredis');var authService=require(_0xa0df('0x11'));var qs=require(_0xa0df('0x12'));var as=require(_0xa0df('0x13'));var hardwareService=require(_0xa0df('0x14'));var logger=require(_0xa0df('0x15'))(_0xa0df('0x16'));var utils=require(_0xa0df('0x17'));var config=require(_0xa0df('0x18'));var licenseUtil=require(_0xa0df('0x19'));var db=require(_0xa0df('0x1a'))['db'];function respondWithStatusCode(_0x4f2a21,_0x5a7dc8){_0x5a7dc8=_0x5a7dc8||0xcc;return function(_0xe534ff){if(_0xe534ff){return _0x4f2a21[_0xa0df('0x1b')](_0x5a7dc8);}return _0x4f2a21[_0xa0df('0x1c')](_0x5a7dc8)[_0xa0df('0x1d')]();};}function respondWithResult(_0x2cb0e3,_0x40bc16){_0x40bc16=_0x40bc16||0xc8;return function(_0x4e3281){if(_0x4e3281){return _0x2cb0e3[_0xa0df('0x1c')](_0x40bc16)[_0xa0df('0x1e')](_0x4e3281);}};}function respondWithFilteredResult(_0x7ec566,_0x6fe413){return function(_0x267991){if(_0x267991){var _0x1c6147=_0x267991[_0xa0df('0x1f')],_0x533ce7=_0x6fe413[_0xa0df('0x20')],_0x53ebad=_0x6fe413[_0xa0df('0x20')]+_0x6fe413[_0xa0df('0x21')],_0x13fd78;if(_0x53ebad>=_0x1c6147){_0x53ebad=_0x1c6147;_0x13fd78=0xc8;}else{_0x13fd78=0xce;}_0x7ec566['status'](_0x13fd78);return _0x7ec566[_0xa0df('0x22')]('Content-Range',_0x533ce7+'-'+_0x53ebad+'/'+_0x1c6147)[_0xa0df('0x1e')](_0x267991);}return null;};}function patchUpdates(_0x31cee7){return function(_0x336dd8){try{jsonpatch[_0xa0df('0x23')](_0x336dd8,_0x31cee7,!![]);}catch(_0x5ac136){return BPromise[_0xa0df('0x24')](_0x5ac136);}return _0x336dd8[_0xa0df('0x25')]();};}function saveUpdates(_0x2eca3f,_0x2e1139){return function(_0xcf08db){if(_0xcf08db){return _0xcf08db['update'](_0x2eca3f)[_0xa0df('0x26')](function(_0x38c6c8){return _0x38c6c8;});}return null;};}function removeEntity(_0x24d626,_0x2a5990){return function(_0x269356){if(_0x269356){return _0x269356[_0xa0df('0x27')]()['then'](function(){var _0xbddf36=_0x269356[_0xa0df('0x28')]({'plain':!![]});var _0x4db95f=_0xa0df('0x29');return db[_0xa0df('0x2a')][_0xa0df('0x27')]({'where':{'type':_0x4db95f,'resourceId':_0xbddf36['id']}})[_0xa0df('0x26')](function(){return _0x269356;});})[_0xa0df('0x26')](function(){_0x24d626[_0xa0df('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4866bb,_0x1cb58d){return function(_0xea69fd){if(!_0xea69fd){_0x4866bb[_0xa0df('0x1b')](0x194);}return _0xea69fd;};}function handleError(_0x225d82,_0x3e8a2c){_0x3e8a2c=_0x3e8a2c||0x1f4;return function(_0x2199f9){logger[_0xa0df('0x2b')](_0x2199f9[_0xa0df('0x2c')]);if(_0x2199f9['name']){delete _0x2199f9[_0xa0df('0x2d')];}_0x225d82[_0xa0df('0x1c')](_0x3e8a2c)[_0xa0df('0x2e')](_0x2199f9);};}exports[_0xa0df('0x2f')]=function(_0x2d3b3f,_0x47890d){var _0x2de1e8={},_0x36c2c2={},_0x49bf76={'count':0x0,'rows':[]};var _0x524e2b=_['map'](db[_0xa0df('0x30')][_0xa0df('0x31')],function(_0x14e9d2){return{'name':_0x14e9d2[_0xa0df('0x32')],'type':_0x14e9d2[_0xa0df('0x33')]['key']};});_0x36c2c2[_0xa0df('0x34')]=_[_0xa0df('0x35')](_0x524e2b,_0xa0df('0x2d'));_0x36c2c2[_0xa0df('0x36')]=_[_0xa0df('0x37')](_0x2d3b3f[_0xa0df('0x36')]);_0x36c2c2[_0xa0df('0x38')]=_['intersection'](_0x36c2c2[_0xa0df('0x34')],_0x36c2c2['query']);_0x2de1e8[_0xa0df('0x39')]=_[_0xa0df('0x3a')](_0x36c2c2[_0xa0df('0x34')],qs[_0xa0df('0x3b')](_0x2d3b3f[_0xa0df('0x36')]['fields']));_0x2de1e8['attributes']=_0x2de1e8[_0xa0df('0x39')][_0xa0df('0x3c')]?_0x2de1e8['attributes']:_0x36c2c2[_0xa0df('0x34')];if(!_0x2d3b3f[_0xa0df('0x36')][_0xa0df('0x3d')](_0xa0df('0x3e'))){_0x2de1e8[_0xa0df('0x21')]=qs[_0xa0df('0x21')](_0x2d3b3f[_0xa0df('0x36')]['limit']);_0x2de1e8['offset']=qs[_0xa0df('0x20')](_0x2d3b3f['query'][_0xa0df('0x20')]);}_0x2de1e8[_0xa0df('0x3f')]=qs[_0xa0df('0x40')](_0x2d3b3f['query'][_0xa0df('0x40')]);_0x2de1e8[_0xa0df('0x41')]=qs['filters'](_['pick'](_0x2d3b3f[_0xa0df('0x36')],_0x36c2c2[_0xa0df('0x38')]),_0x524e2b);if(_0x2d3b3f['query'][_0xa0df('0x42')]){_0x2de1e8['where']=_[_0xa0df('0x43')](_0x2de1e8[_0xa0df('0x41')],{'$or':_[_0xa0df('0x35')](_0x524e2b,function(_0xcce15c){if(_0xcce15c[_0xa0df('0x33')]!==_0xa0df('0x44')){var _0x575a41={};_0x575a41[_0xcce15c[_0xa0df('0x2d')]]={'$like':'%'+_0x2d3b3f[_0xa0df('0x36')][_0xa0df('0x42')]+'%'};return _0x575a41;}})});}_0x2de1e8=_[_0xa0df('0x43')]({},_0x2de1e8,_0x2d3b3f['options']);var _0x5cb4ec={'where':_0x2de1e8[_0xa0df('0x41')]};return db[_0xa0df('0x30')][_0xa0df('0x1f')](_0x5cb4ec)[_0xa0df('0x26')](function(_0x10f485){_0x49bf76[_0xa0df('0x1f')]=_0x10f485;if(_0x2d3b3f[_0xa0df('0x36')][_0xa0df('0x45')]){_0x2de1e8['include']=[{'all':!![]}];}return db[_0xa0df('0x30')][_0xa0df('0x46')](_0x2de1e8);})[_0xa0df('0x26')](function(_0xf2f54b){_0x49bf76[_0xa0df('0x47')]=_0xf2f54b;return _0x49bf76;})[_0xa0df('0x26')](respondWithFilteredResult(_0x47890d,_0x2de1e8))[_0xa0df('0x48')](handleError(_0x47890d,null));};exports[_0xa0df('0x49')]=function(_0x924bce,_0x2289b4){var _0x379019={'raw':!![],'where':{'id':_0x924bce[_0xa0df('0x4a')]['id']}},_0x431ebb={};_0x431ebb['model']=_[_0xa0df('0x37')](db[_0xa0df('0x30')][_0xa0df('0x31')]);_0x431ebb[_0xa0df('0x36')]=_['keys'](_0x924bce[_0xa0df('0x36')]);_0x431ebb[_0xa0df('0x38')]=_[_0xa0df('0x3a')](_0x431ebb[_0xa0df('0x34')],_0x431ebb['query']);_0x379019['attributes']=_['intersection'](_0x431ebb[_0xa0df('0x34')],qs[_0xa0df('0x3b')](_0x924bce[_0xa0df('0x36')]['fields']));_0x379019[_0xa0df('0x39')]=_0x379019[_0xa0df('0x39')][_0xa0df('0x3c')]?_0x379019[_0xa0df('0x39')]:_0x431ebb[_0xa0df('0x34')];if(_0x924bce[_0xa0df('0x36')][_0xa0df('0x45')]){_0x379019['include']=[{'all':!![]}];}_0x379019=_[_0xa0df('0x43')]({},_0x379019,_0x924bce[_0xa0df('0x4b')]);return db[_0xa0df('0x30')][_0xa0df('0x4c')](_0x379019)['then'](handleEntityNotFound(_0x2289b4,null))[_0xa0df('0x26')](respondWithResult(_0x2289b4,null))[_0xa0df('0x48')](handleError(_0x2289b4,null));};exports[_0xa0df('0x4d')]=function(_0x44cafb,_0x844b5e){return db[_0xa0df('0x30')][_0xa0df('0x4d')](_0x44cafb['body'],{})[_0xa0df('0x26')](function(_0xf06132){var _0x1c6023=_0x44cafb[_0xa0df('0x4e')][_0xa0df('0x28')]({'plain':!![]});if(!_0x1c6023)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c6023[_0xa0df('0x4f')]===_0xa0df('0x4e')){var _0x4e2a9c=_0xf06132['get']({'plain':!![]});var _0x2828c9=_0xa0df('0x29');return db['UserProfileSection'][_0xa0df('0x4c')]({'where':{'name':_0x2828c9,'userProfileId':_0x1c6023[_0xa0df('0x50')]},'raw':!![]})['then'](function(_0x1ede66){if(_0x1ede66&&_0x1ede66['autoAssociation']===0x0){return db['UserProfileResource'][_0xa0df('0x4d')]({'name':_0x4e2a9c['name'],'resourceId':_0x4e2a9c['id'],'type':_0x1ede66[_0xa0df('0x2d')],'sectionId':_0x1ede66['id']},{})['then'](function(){return _0xf06132;});}else{return _0xf06132;}})[_0xa0df('0x48')](function(_0x3bb955){logger[_0xa0df('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bb955);throw _0x3bb955;});}return _0xf06132;})[_0xa0df('0x26')](respondWithResult(_0x844b5e,0xc9))['catch'](handleError(_0x844b5e,null));};exports['update']=function(_0x282790,_0x3793ca){if(_0x282790[_0xa0df('0x51')]['id']){delete _0x282790[_0xa0df('0x51')]['id'];}return db[_0xa0df('0x30')][_0xa0df('0x4c')]({'where':{'id':_0x282790[_0xa0df('0x4a')]['id']}})[_0xa0df('0x26')](handleEntityNotFound(_0x3793ca,null))[_0xa0df('0x26')](saveUpdates(_0x282790[_0xa0df('0x51')],null))[_0xa0df('0x26')](respondWithResult(_0x3793ca,null))[_0xa0df('0x48')](handleError(_0x3793ca,null));};exports[_0xa0df('0x27')]=function(_0x413667,_0x13d855){return db['CmContactHasItem'][_0xa0df('0x4c')]({'where':{'id':_0x413667[_0xa0df('0x4a')]['id']}})['then'](handleEntityNotFound(_0x13d855,null))[_0xa0df('0x26')](removeEntity(_0x13d855,null))['catch'](handleError(_0x13d855,null));}; \ No newline at end of file +var _0xc8fc=['merge','type','includeAll','include','findAll','rows','catch','params','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','CmContactHasItems','then','error','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter'];(function(_0x475b7d,_0x3e1f95){var _0x2ad527=function(_0x191883){while(--_0x191883){_0x475b7d['push'](_0x475b7d['shift']());}};_0x2ad527(++_0x3e1f95);}(_0xc8fc,0x118));var _0xcc8f=function(_0x25febc,_0xa928d){_0x25febc=_0x25febc-0x0;var _0x21b031=_0xc8fc[_0x25febc];return _0x21b031;};'use strict';var pdf=require(_0xcc8f('0x0'));var emlformat=require(_0xcc8f('0x1'));var rimraf=require(_0xcc8f('0x2'));var zipdir=require(_0xcc8f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc8f('0x4'));var moment=require(_0xcc8f('0x5'));var BPromise=require(_0xcc8f('0x6'));var Mustache=require(_0xcc8f('0x7'));var util=require(_0xcc8f('0x8'));var path=require(_0xcc8f('0x9'));var sox=require(_0xcc8f('0xa'));var csv=require(_0xcc8f('0xb'));var ejs=require(_0xcc8f('0xc'));var fs=require('fs');var _=require(_0xcc8f('0xd'));var squel=require(_0xcc8f('0xe'));var crypto=require(_0xcc8f('0xf'));var jsforce=require(_0xcc8f('0x10'));var deskjs=require(_0xcc8f('0x11'));var toCsv=require(_0xcc8f('0xb'));var querystring=require(_0xcc8f('0x12'));var Papa=require(_0xcc8f('0x13'));var Redis=require('ioredis');var authService=require(_0xcc8f('0x14'));var qs=require(_0xcc8f('0x15'));var as=require(_0xcc8f('0x16'));var hardwareService=require(_0xcc8f('0x17'));var logger=require(_0xcc8f('0x18'))(_0xcc8f('0x19'));var utils=require(_0xcc8f('0x1a'));var config=require(_0xcc8f('0x1b'));var licenseUtil=require(_0xcc8f('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15a9b8,_0xcd40e7){_0xcd40e7=_0xcd40e7||0xcc;return function(_0x539ca3){if(_0x539ca3){return _0x15a9b8[_0xcc8f('0x1d')](_0xcd40e7);}return _0x15a9b8['status'](_0xcd40e7)[_0xcc8f('0x1e')]();};}function respondWithResult(_0x48f01c,_0x4adada){_0x4adada=_0x4adada||0xc8;return function(_0x1c78c1){if(_0x1c78c1){return _0x48f01c[_0xcc8f('0x1f')](_0x4adada)[_0xcc8f('0x20')](_0x1c78c1);}};}function respondWithFilteredResult(_0x44b3d3,_0x50d516){return function(_0x1fdfe4){if(_0x1fdfe4){var _0x5a0023=_0x1fdfe4[_0xcc8f('0x21')],_0x3ac3cc=_0x50d516[_0xcc8f('0x22')],_0x1990a0=_0x50d516[_0xcc8f('0x22')]+_0x50d516[_0xcc8f('0x23')],_0xf236e5;if(_0x1990a0>=_0x5a0023){_0x1990a0=_0x5a0023;_0xf236e5=0xc8;}else{_0xf236e5=0xce;}_0x44b3d3[_0xcc8f('0x1f')](_0xf236e5);return _0x44b3d3[_0xcc8f('0x24')](_0xcc8f('0x25'),_0x3ac3cc+'-'+_0x1990a0+'/'+_0x5a0023)[_0xcc8f('0x20')](_0x1fdfe4);}return null;};}function patchUpdates(_0xdd2fad){return function(_0x56b930){try{jsonpatch[_0xcc8f('0x26')](_0x56b930,_0xdd2fad,!![]);}catch(_0x406d5a){return BPromise[_0xcc8f('0x27')](_0x406d5a);}return _0x56b930[_0xcc8f('0x28')]();};}function saveUpdates(_0x15400d,_0x443b2b){return function(_0x4d2d44){if(_0x4d2d44){return _0x4d2d44[_0xcc8f('0x29')](_0x15400d)['then'](function(_0x20727d){return _0x20727d;});}return null;};}function removeEntity(_0x34b3a2,_0x925e12){return function(_0x32edef){if(_0x32edef){return _0x32edef[_0xcc8f('0x2a')]()['then'](function(){var _0x22b0b9=_0x32edef[_0xcc8f('0x2b')]({'plain':!![]});var _0x287188=_0xcc8f('0x2c');return db['UserProfileResource'][_0xcc8f('0x2a')]({'where':{'type':_0x287188,'resourceId':_0x22b0b9['id']}})[_0xcc8f('0x2d')](function(){return _0x32edef;});})[_0xcc8f('0x2d')](function(){_0x34b3a2[_0xcc8f('0x1f')](0xcc)[_0xcc8f('0x1e')]();});}};}function handleEntityNotFound(_0x2b5739,_0x575187){return function(_0x5b8cdf){if(!_0x5b8cdf){_0x2b5739['sendStatus'](0x194);}return _0x5b8cdf;};}function handleError(_0x100dcf,_0x11ee07){_0x11ee07=_0x11ee07||0x1f4;return function(_0xaa4d2b){logger[_0xcc8f('0x2e')](_0xaa4d2b['stack']);if(_0xaa4d2b[_0xcc8f('0x2f')]){delete _0xaa4d2b[_0xcc8f('0x2f')];}_0x100dcf['status'](_0x11ee07)[_0xcc8f('0x30')](_0xaa4d2b);};}exports[_0xcc8f('0x31')]=function(_0x60b08,_0x5e3939){var _0x57e2e7={},_0x125cee={},_0x4e6674={'count':0x0,'rows':[]};var _0x4bd057=_[_0xcc8f('0x32')](db[_0xcc8f('0x33')][_0xcc8f('0x34')],function(_0x212ca3){return{'name':_0x212ca3[_0xcc8f('0x35')],'type':_0x212ca3['type'][_0xcc8f('0x36')]};});_0x125cee[_0xcc8f('0x37')]=_[_0xcc8f('0x32')](_0x4bd057,_0xcc8f('0x2f'));_0x125cee[_0xcc8f('0x38')]=_['keys'](_0x60b08[_0xcc8f('0x38')]);_0x125cee['filters']=_[_0xcc8f('0x39')](_0x125cee[_0xcc8f('0x37')],_0x125cee[_0xcc8f('0x38')]);_0x57e2e7['attributes']=_[_0xcc8f('0x39')](_0x125cee[_0xcc8f('0x37')],qs[_0xcc8f('0x3a')](_0x60b08['query'][_0xcc8f('0x3a')]));_0x57e2e7[_0xcc8f('0x3b')]=_0x57e2e7[_0xcc8f('0x3b')][_0xcc8f('0x3c')]?_0x57e2e7[_0xcc8f('0x3b')]:_0x125cee['model'];if(!_0x60b08[_0xcc8f('0x38')][_0xcc8f('0x3d')](_0xcc8f('0x3e'))){_0x57e2e7[_0xcc8f('0x23')]=qs['limit'](_0x60b08[_0xcc8f('0x38')]['limit']);_0x57e2e7[_0xcc8f('0x22')]=qs[_0xcc8f('0x22')](_0x60b08[_0xcc8f('0x38')][_0xcc8f('0x22')]);}_0x57e2e7[_0xcc8f('0x3f')]=qs[_0xcc8f('0x40')](_0x60b08[_0xcc8f('0x38')]['sort']);_0x57e2e7[_0xcc8f('0x41')]=qs[_0xcc8f('0x42')](_['pick'](_0x60b08[_0xcc8f('0x38')],_0x125cee[_0xcc8f('0x42')]),_0x4bd057);if(_0x60b08[_0xcc8f('0x38')][_0xcc8f('0x43')]){_0x57e2e7[_0xcc8f('0x41')]=_[_0xcc8f('0x44')](_0x57e2e7[_0xcc8f('0x41')],{'$or':_[_0xcc8f('0x32')](_0x4bd057,function(_0x26dd38){if(_0x26dd38[_0xcc8f('0x45')]!=='VIRTUAL'){var _0x18a291={};_0x18a291[_0x26dd38['name']]={'$like':'%'+_0x60b08[_0xcc8f('0x38')][_0xcc8f('0x43')]+'%'};return _0x18a291;}})});}_0x57e2e7=_['merge']({},_0x57e2e7,_0x60b08['options']);var _0x424c71={'where':_0x57e2e7[_0xcc8f('0x41')]};return db[_0xcc8f('0x33')][_0xcc8f('0x21')](_0x424c71)[_0xcc8f('0x2d')](function(_0x2b0126){_0x4e6674[_0xcc8f('0x21')]=_0x2b0126;if(_0x60b08[_0xcc8f('0x38')][_0xcc8f('0x46')]){_0x57e2e7[_0xcc8f('0x47')]=[{'all':!![]}];}return db[_0xcc8f('0x33')][_0xcc8f('0x48')](_0x57e2e7);})[_0xcc8f('0x2d')](function(_0x562e16){_0x4e6674[_0xcc8f('0x49')]=_0x562e16;return _0x4e6674;})[_0xcc8f('0x2d')](respondWithFilteredResult(_0x5e3939,_0x57e2e7))[_0xcc8f('0x4a')](handleError(_0x5e3939,null));};exports['show']=function(_0x1b87a9,_0x25ba73){var _0x4b49c2={'raw':!![],'where':{'id':_0x1b87a9[_0xcc8f('0x4b')]['id']}},_0x1e82af={};_0x1e82af[_0xcc8f('0x37')]=_[_0xcc8f('0x4c')](db['CmContactHasItem'][_0xcc8f('0x34')]);_0x1e82af[_0xcc8f('0x38')]=_[_0xcc8f('0x4c')](_0x1b87a9[_0xcc8f('0x38')]);_0x1e82af[_0xcc8f('0x42')]=_['intersection'](_0x1e82af[_0xcc8f('0x37')],_0x1e82af[_0xcc8f('0x38')]);_0x4b49c2['attributes']=_[_0xcc8f('0x39')](_0x1e82af[_0xcc8f('0x37')],qs[_0xcc8f('0x3a')](_0x1b87a9[_0xcc8f('0x38')][_0xcc8f('0x3a')]));_0x4b49c2[_0xcc8f('0x3b')]=_0x4b49c2[_0xcc8f('0x3b')][_0xcc8f('0x3c')]?_0x4b49c2['attributes']:_0x1e82af['model'];if(_0x1b87a9['query'][_0xcc8f('0x46')]){_0x4b49c2[_0xcc8f('0x47')]=[{'all':!![]}];}_0x4b49c2=_['merge']({},_0x4b49c2,_0x1b87a9[_0xcc8f('0x4d')]);return db[_0xcc8f('0x33')][_0xcc8f('0x4e')](_0x4b49c2)['then'](handleEntityNotFound(_0x25ba73,null))[_0xcc8f('0x2d')](respondWithResult(_0x25ba73,null))[_0xcc8f('0x4a')](handleError(_0x25ba73,null));};exports['create']=function(_0x2f7800,_0x3f2314){return db[_0xcc8f('0x33')][_0xcc8f('0x4f')](_0x2f7800['body'],{})[_0xcc8f('0x2d')](function(_0x4a4941){var _0x256f21=_0x2f7800[_0xcc8f('0x50')]['get']({'plain':!![]});if(!_0x256f21)throw new Error(_0xcc8f('0x51'));if(_0x256f21[_0xcc8f('0x52')]===_0xcc8f('0x50')){var _0x72e808=_0x4a4941[_0xcc8f('0x2b')]({'plain':!![]});var _0x3a44fd=_0xcc8f('0x2c');return db['UserProfileSection'][_0xcc8f('0x4e')]({'where':{'name':_0x3a44fd,'userProfileId':_0x256f21['userProfileId']},'raw':!![]})[_0xcc8f('0x2d')](function(_0x1d9687){if(_0x1d9687&&_0x1d9687[_0xcc8f('0x53')]===0x0){return db[_0xcc8f('0x54')]['create']({'name':_0x72e808[_0xcc8f('0x2f')],'resourceId':_0x72e808['id'],'type':_0x1d9687[_0xcc8f('0x2f')],'sectionId':_0x1d9687['id']},{})[_0xcc8f('0x2d')](function(){return _0x4a4941;});}else{return _0x4a4941;}})[_0xcc8f('0x4a')](function(_0x38698e){logger[_0xcc8f('0x2e')](_0xcc8f('0x55'),_0x38698e);throw _0x38698e;});}return _0x4a4941;})['then'](respondWithResult(_0x3f2314,0xc9))[_0xcc8f('0x4a')](handleError(_0x3f2314,null));};exports['update']=function(_0x1cf852,_0x498a26){if(_0x1cf852['body']['id']){delete _0x1cf852['body']['id'];}return db[_0xcc8f('0x33')][_0xcc8f('0x4e')]({'where':{'id':_0x1cf852[_0xcc8f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x498a26,null))[_0xcc8f('0x2d')](saveUpdates(_0x1cf852[_0xcc8f('0x56')],null))['then'](respondWithResult(_0x498a26,null))[_0xcc8f('0x4a')](handleError(_0x498a26,null));};exports[_0xcc8f('0x2a')]=function(_0x6ad9b8,_0x6a10d3){return db[_0xcc8f('0x33')][_0xcc8f('0x4e')]({'where':{'id':_0x6ad9b8['params']['id']}})['then'](handleEntityNotFound(_0x6a10d3,null))['then'](removeEntity(_0x6a10d3,null))[_0xcc8f('0x4a')](handleError(_0x6a10d3,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 4e94449..0ef1ba4 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8958=['define','CmContactHasItem','cm_contact_has_items','util','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x23aa17,_0x45e444){var _0x2563fa=function(_0x1a1297){while(--_0x1a1297){_0x23aa17['push'](_0x23aa17['shift']());}};_0x2563fa(++_0x45e444);}(_0x8958,0x93));var _0x8895=function(_0x419018,_0x23a46c){_0x419018=_0x419018-0x0;var _0x2197ef=_0x8958[_0x419018];return _0x2197ef;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));module['exports']=function(_0x22fa52,_0x2f03ad){return _0x22fa52[_0x8895('0x5')](_0x8895('0x6'),attributes,{'tableName':_0x8895('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f9d=['define','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x2ac756,_0x33408b){var _0xa621fb=function(_0x5a316f){while(--_0x5a316f){_0x2ac756['push'](_0x2ac756['shift']());}};_0xa621fb(++_0x33408b);}(_0x8f9d,0x93));var _0xd8f9=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8f9d[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xd8f9('0x0'));var util=require('util');var logger=require(_0xd8f9('0x1'))('api');var moment=require(_0xd8f9('0x2'));var BPromise=require(_0xd8f9('0x3'));var rp=require(_0xd8f9('0x4'));var fs=require('fs');var path=require(_0xd8f9('0x5'));var rimraf=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var attributes=require(_0xd8f9('0x8'));module['exports']=function(_0x1c37be,_0x24dd1e){return _0x1c37be[_0xd8f9('0x9')](_0xd8f9('0xa'),attributes,{'tableName':_0xd8f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index c530720..12c3724 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3da6=['CmContactHasItem,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x550079,_0x153e1f){var _0x232e84=function(_0xdae8de){while(--_0xdae8de){_0x550079['push'](_0x550079['shift']());}};_0x232e84(++_0x153e1f);}(_0x3da6,0x17a));var _0x63da=function(_0x52ed6f,_0x31ec9a){_0x52ed6f=_0x52ed6f-0x0;var _0x19e934=_0x3da6[_0x52ed6f];return _0x19e934;};'use strict';var _=require(_0x63da('0x0'));var util=require('util');var moment=require(_0x63da('0x1'));var BPromise=require(_0x63da('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x63da('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x63da('0x4'));var logger=require(_0x63da('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x63da('0x6'));var client=jayson[_0x63da('0x7')][_0x63da('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x559b56,_0x1191c0,_0x2d333e){return new BPromise(function(_0x34475e,_0x58d89f){return client[_0x63da('0x9')](_0x559b56,_0x2d333e)[_0x63da('0xa')](function(_0x3104a9){logger[_0x63da('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x1191c0,_0x63da('0xc'));logger[_0x63da('0xd')](_0x63da('0xe'),_0x1191c0,_0x63da('0xc'),JSON[_0x63da('0xf')](_0x3104a9));if(_0x3104a9[_0x63da('0x10')]){if(_0x3104a9[_0x63da('0x10')][_0x63da('0x11')]===0x1f4){logger[_0x63da('0x10')](_0x63da('0x12'),_0x1191c0,_0x3104a9[_0x63da('0x10')]['message']);return _0x58d89f(_0x3104a9[_0x63da('0x10')]['message']);}logger[_0x63da('0x10')](_0x63da('0x12'),_0x1191c0,_0x3104a9[_0x63da('0x10')][_0x63da('0x13')]);return _0x34475e(_0x3104a9[_0x63da('0x10')]['message']);}else{logger['info'](_0x63da('0x12'),_0x1191c0,'request\x20sent');_0x34475e(_0x3104a9[_0x63da('0x14')][_0x63da('0x13')]);}})[_0x63da('0x15')](function(_0x1f1912){logger['error'](_0x63da('0x12'),_0x1191c0,_0x1f1912);_0x58d89f(_0x1f1912);});});} \ No newline at end of file +var _0x938a=['jayson/promise','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x938a,0x1f2));var _0xa938=function(_0x430524,_0x23b611){_0x430524=_0x430524-0x0;var _0x3a726d=_0x938a[_0x430524];return _0x3a726d;};'use strict';var _=require(_0xa938('0x0'));var util=require(_0xa938('0x1'));var moment=require(_0xa938('0x2'));var BPromise=require(_0xa938('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa938('0x4'))['db'];var utils=require(_0xa938('0x5'));var logger=require(_0xa938('0x6'))('rpc');var config=require(_0xa938('0x7'));var jayson=require(_0xa938('0x8'));var client=jayson['client'][_0xa938('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22b3bc,_0x5ead46,_0x56ad1d){return new BPromise(function(_0x570280,_0x1de832){return client[_0xa938('0xa')](_0x22b3bc,_0x56ad1d)[_0xa938('0xb')](function(_0x5c6366){logger[_0xa938('0xc')](_0xa938('0xd'),_0x5ead46,_0xa938('0xe'));logger[_0xa938('0xf')](_0xa938('0x10'),_0x5ead46,'request\x20sent',JSON[_0xa938('0x11')](_0x5c6366));if(_0x5c6366[_0xa938('0x12')]){if(_0x5c6366[_0xa938('0x12')]['code']===0x1f4){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x5ead46,_0x5c6366['error']['message']);return _0x1de832(_0x5c6366[_0xa938('0x12')][_0xa938('0x13')]);}logger['error'](_0xa938('0xd'),_0x5ead46,_0x5c6366[_0xa938('0x12')][_0xa938('0x13')]);return _0x570280(_0x5c6366['error'][_0xa938('0x13')]);}else{logger[_0xa938('0xc')](_0xa938('0xd'),_0x5ead46,_0xa938('0xe'));_0x570280(_0x5c6366[_0xa938('0x14')]['message']);}})[_0xa938('0x15')](function(_0x7c29b3){logger[_0xa938('0x12')](_0xa938('0xd'),_0x5ead46,_0x7c29b3);_0x1de832(_0x7c29b3);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 2bc6b41..c4450cb 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x947f=['get','isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x947f,0x1bf));var _0xf947=function(_0x427d3a,_0x23724c){_0x427d3a=_0x427d3a-0x0;var _0xe5c521=_0x947f[_0x427d3a];return _0xe5c521;};'use strict';var multer=require(_0xf947('0x0'));var util=require(_0xf947('0x1'));var path=require(_0xf947('0x2'));var timeout=require(_0xf947('0x3'));var express=require(_0xf947('0x4'));var router=express[_0xf947('0x5')]();var auth=require(_0xf947('0x6'));var interaction=require(_0xf947('0x7'));var config=require('../../config/environment');var controller=require(_0xf947('0x8'));router[_0xf947('0x9')]('/',auth[_0xf947('0xa')](),controller[_0xf947('0xb')]);router['get'](_0xf947('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf947('0xd')]('/',auth[_0xf947('0xa')](),controller[_0xf947('0xe')]);router[_0xf947('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf947('0x10')](_0xf947('0xc'),auth[_0xf947('0xa')](),controller[_0xf947('0x11')]);module[_0xf947('0x12')]=router; \ No newline at end of file +var _0x87f0=['../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x2db79f,_0x51f8dd){var _0x162aac=function(_0x5c8240){while(--_0x5c8240){_0x2db79f['push'](_0x2db79f['shift']());}};_0x162aac(++_0x51f8dd);}(_0x87f0,0x187));var _0x087f=function(_0x285749,_0x52705d){_0x285749=_0x285749-0x0;var _0x42db52=_0x87f0[_0x285749];return _0x42db52;};'use strict';var multer=require(_0x087f('0x0'));var util=require(_0x087f('0x1'));var path=require(_0x087f('0x2'));var timeout=require('connect-timeout');var express=require(_0x087f('0x3'));var router=express[_0x087f('0x4')]();var auth=require(_0x087f('0x5'));var interaction=require(_0x087f('0x6'));var config=require('../../config/environment');var controller=require(_0x087f('0x7'));router['get']('/',auth[_0x087f('0x8')](),controller[_0x087f('0x9')]);router[_0x087f('0xa')](_0x087f('0xb'),auth[_0x087f('0x8')](),controller[_0x087f('0xc')]);router[_0x087f('0xd')]('/',auth[_0x087f('0x8')](),controller['create']);router[_0x087f('0xe')](_0x087f('0xb'),auth[_0x087f('0x8')](),controller[_0x087f('0xf')]);router[_0x087f('0x10')](_0x087f('0xb'),auth[_0x087f('0x8')](),controller['destroy']);module[_0x087f('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 24003c8..803a99d 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2883=['INTEGER','STRING','exports'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x2883,0x1df));var _0x3288=function(_0x5ddc5c,_0x35f17c){_0x5ddc5c=_0x5ddc5c-0x0;var _0x58fc05=_0x2883[_0x5ddc5c];return _0x58fc05;};'use strict';var Sequelize=require('sequelize');module[_0x3288('0x0')]={'CmContactId':{'type':Sequelize[_0x3288('0x1')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x3288('0x2')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0xc50f=['exports','INTEGER','STRING'];(function(_0xcfeda9,_0xd418ae){var _0x4826c7=function(_0x45dc9d){while(--_0x45dc9d){_0xcfeda9['push'](_0xcfeda9['shift']());}};_0x4826c7(++_0xd418ae);}(_0xc50f,0x13e));var _0xfc50=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xc50f[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module[_0xfc50('0x0')]={'CmContactId':{'type':Sequelize[_0xfc50('0x1')],'primaryKey':!![]},'phone':{'type':Sequelize[_0xfc50('0x2')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index f271693..a713521 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f0d=['api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','CmContactHasPhones','UserProfileResource','destroy','error','name','send','index','CmContactHasPhone','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','user','get','role','UserProfileSection','userProfileId','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x5f0d,0x12b));var _0xd5f0=function(_0x76e1cd,_0xdcd4b6){_0x76e1cd=_0x76e1cd-0x0;var _0x42679b=_0x5f0d[_0x76e1cd];return _0x42679b;};'use strict';var pdf=require(_0xd5f0('0x0'));var emlformat=require(_0xd5f0('0x1'));var rimraf=require(_0xd5f0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd5f0('0x3'));var rp=require(_0xd5f0('0x4'));var moment=require(_0xd5f0('0x5'));var BPromise=require(_0xd5f0('0x6'));var Mustache=require(_0xd5f0('0x7'));var util=require(_0xd5f0('0x8'));var path=require(_0xd5f0('0x9'));var sox=require(_0xd5f0('0xa'));var csv=require('to-csv');var ejs=require(_0xd5f0('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd5f0('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd5f0('0xd'));var toCsv=require(_0xd5f0('0xe'));var querystring=require('querystring');var Papa=require(_0xd5f0('0xf'));var Redis=require(_0xd5f0('0x10'));var authService=require(_0xd5f0('0x11'));var qs=require(_0xd5f0('0x12'));var as=require(_0xd5f0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5f0('0x14'))(_0xd5f0('0x15'));var utils=require('../../config/utils');var config=require(_0xd5f0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd5f0('0x17'))['db'];function respondWithStatusCode(_0x57d9d2,_0xb59be1){_0xb59be1=_0xb59be1||0xcc;return function(_0x584452){if(_0x584452){return _0x57d9d2[_0xd5f0('0x18')](_0xb59be1);}return _0x57d9d2['status'](_0xb59be1)[_0xd5f0('0x19')]();};}function respondWithResult(_0x534678,_0x31be6d){_0x31be6d=_0x31be6d||0xc8;return function(_0x564993){if(_0x564993){return _0x534678[_0xd5f0('0x1a')](_0x31be6d)[_0xd5f0('0x1b')](_0x564993);}};}function respondWithFilteredResult(_0x5a28ce,_0x15d164){return function(_0x43b738){if(_0x43b738){var _0x33fb13=_0x43b738[_0xd5f0('0x1c')],_0xd1794e=_0x15d164[_0xd5f0('0x1d')],_0x21e63c=_0x15d164['offset']+_0x15d164[_0xd5f0('0x1e')],_0x561937;if(_0x21e63c>=_0x33fb13){_0x21e63c=_0x33fb13;_0x561937=0xc8;}else{_0x561937=0xce;}_0x5a28ce['status'](_0x561937);return _0x5a28ce[_0xd5f0('0x1f')]('Content-Range',_0xd1794e+'-'+_0x21e63c+'/'+_0x33fb13)['json'](_0x43b738);}return null;};}function patchUpdates(_0x158fca){return function(_0x19621d){try{jsonpatch[_0xd5f0('0x20')](_0x19621d,_0x158fca,!![]);}catch(_0x37a482){return BPromise[_0xd5f0('0x21')](_0x37a482);}return _0x19621d[_0xd5f0('0x22')]();};}function saveUpdates(_0x47a98e,_0x171082){return function(_0x5caaac){if(_0x5caaac){return _0x5caaac[_0xd5f0('0x23')](_0x47a98e)[_0xd5f0('0x24')](function(_0x18c2fa){return _0x18c2fa;});}return null;};}function removeEntity(_0x5ce71c,_0x2ca3bc){return function(_0x56f603){if(_0x56f603){return _0x56f603['destroy']()['then'](function(){var _0x576991=_0x56f603['get']({'plain':!![]});var _0x20cba5=_0xd5f0('0x25');return db[_0xd5f0('0x26')][_0xd5f0('0x27')]({'where':{'type':_0x20cba5,'resourceId':_0x576991['id']}})[_0xd5f0('0x24')](function(){return _0x56f603;});})['then'](function(){_0x5ce71c[_0xd5f0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd49378,_0x5e7f7f){return function(_0x42b13c){if(!_0x42b13c){_0xd49378['sendStatus'](0x194);}return _0x42b13c;};}function handleError(_0x1beecb,_0x32417e){_0x32417e=_0x32417e||0x1f4;return function(_0x2d3f09){logger[_0xd5f0('0x28')](_0x2d3f09['stack']);if(_0x2d3f09[_0xd5f0('0x29')]){delete _0x2d3f09['name'];}_0x1beecb[_0xd5f0('0x1a')](_0x32417e)[_0xd5f0('0x2a')](_0x2d3f09);};}exports[_0xd5f0('0x2b')]=function(_0x22e391,_0x21d0ad){var _0x25db35={},_0x4cea4c={},_0x369018={'count':0x0,'rows':[]};var _0x124f54=_['map'](db[_0xd5f0('0x2c')][_0xd5f0('0x2d')],function(_0x1477c8){return{'name':_0x1477c8[_0xd5f0('0x2e')],'type':_0x1477c8[_0xd5f0('0x2f')]['key']};});_0x4cea4c[_0xd5f0('0x30')]=_[_0xd5f0('0x31')](_0x124f54,_0xd5f0('0x29'));_0x4cea4c['query']=_[_0xd5f0('0x32')](_0x22e391[_0xd5f0('0x33')]);_0x4cea4c[_0xd5f0('0x34')]=_[_0xd5f0('0x35')](_0x4cea4c[_0xd5f0('0x30')],_0x4cea4c[_0xd5f0('0x33')]);_0x25db35['attributes']=_[_0xd5f0('0x35')](_0x4cea4c['model'],qs[_0xd5f0('0x36')](_0x22e391[_0xd5f0('0x33')][_0xd5f0('0x36')]));_0x25db35['attributes']=_0x25db35['attributes'][_0xd5f0('0x37')]?_0x25db35[_0xd5f0('0x38')]:_0x4cea4c[_0xd5f0('0x30')];if(!_0x22e391[_0xd5f0('0x33')][_0xd5f0('0x39')](_0xd5f0('0x3a'))){_0x25db35[_0xd5f0('0x1e')]=qs[_0xd5f0('0x1e')](_0x22e391[_0xd5f0('0x33')][_0xd5f0('0x1e')]);_0x25db35[_0xd5f0('0x1d')]=qs[_0xd5f0('0x1d')](_0x22e391[_0xd5f0('0x33')][_0xd5f0('0x1d')]);}_0x25db35[_0xd5f0('0x3b')]=qs[_0xd5f0('0x3c')](_0x22e391[_0xd5f0('0x33')][_0xd5f0('0x3c')]);_0x25db35[_0xd5f0('0x3d')]=qs[_0xd5f0('0x34')](_['pick'](_0x22e391[_0xd5f0('0x33')],_0x4cea4c[_0xd5f0('0x34')]),_0x124f54);if(_0x22e391[_0xd5f0('0x33')][_0xd5f0('0x3e')]){_0x25db35['where']=_[_0xd5f0('0x3f')](_0x25db35[_0xd5f0('0x3d')],{'$or':_['map'](_0x124f54,function(_0xbdcfbb){if(_0xbdcfbb[_0xd5f0('0x2f')]!==_0xd5f0('0x40')){var _0x239b69={};_0x239b69[_0xbdcfbb[_0xd5f0('0x29')]]={'$like':'%'+_0x22e391[_0xd5f0('0x33')][_0xd5f0('0x3e')]+'%'};return _0x239b69;}})});}_0x25db35=_['merge']({},_0x25db35,_0x22e391[_0xd5f0('0x41')]);var _0x3cedc9={'where':_0x25db35[_0xd5f0('0x3d')]};return db[_0xd5f0('0x2c')][_0xd5f0('0x1c')](_0x3cedc9)[_0xd5f0('0x24')](function(_0xaa7f87){_0x369018[_0xd5f0('0x1c')]=_0xaa7f87;if(_0x22e391['query'][_0xd5f0('0x42')]){_0x25db35[_0xd5f0('0x43')]=[{'all':!![]}];}return db['CmContactHasPhone'][_0xd5f0('0x44')](_0x25db35);})['then'](function(_0x422d31){_0x369018['rows']=_0x422d31;return _0x369018;})['then'](respondWithFilteredResult(_0x21d0ad,_0x25db35))[_0xd5f0('0x45')](handleError(_0x21d0ad,null));};exports[_0xd5f0('0x46')]=function(_0x549b3d,_0x4b25e7){var _0x1b69b8={'raw':!![],'where':{'id':_0x549b3d[_0xd5f0('0x47')]['id']}},_0x1216e1={};_0x1216e1[_0xd5f0('0x30')]=_[_0xd5f0('0x32')](db[_0xd5f0('0x2c')][_0xd5f0('0x2d')]);_0x1216e1[_0xd5f0('0x33')]=_[_0xd5f0('0x32')](_0x549b3d[_0xd5f0('0x33')]);_0x1216e1[_0xd5f0('0x34')]=_['intersection'](_0x1216e1[_0xd5f0('0x30')],_0x1216e1[_0xd5f0('0x33')]);_0x1b69b8[_0xd5f0('0x38')]=_[_0xd5f0('0x35')](_0x1216e1['model'],qs['fields'](_0x549b3d[_0xd5f0('0x33')][_0xd5f0('0x36')]));_0x1b69b8['attributes']=_0x1b69b8[_0xd5f0('0x38')][_0xd5f0('0x37')]?_0x1b69b8[_0xd5f0('0x38')]:_0x1216e1['model'];if(_0x549b3d[_0xd5f0('0x33')]['includeAll']){_0x1b69b8[_0xd5f0('0x43')]=[{'all':!![]}];}_0x1b69b8=_[_0xd5f0('0x3f')]({},_0x1b69b8,_0x549b3d[_0xd5f0('0x41')]);return db['CmContactHasPhone'][_0xd5f0('0x48')](_0x1b69b8)[_0xd5f0('0x24')](handleEntityNotFound(_0x4b25e7,null))[_0xd5f0('0x24')](respondWithResult(_0x4b25e7,null))[_0xd5f0('0x45')](handleError(_0x4b25e7,null));};exports[_0xd5f0('0x49')]=function(_0x1f2821,_0x1bbc62){return db[_0xd5f0('0x2c')][_0xd5f0('0x49')](_0x1f2821[_0xd5f0('0x4a')],{})['then'](function(_0x59698f){var _0x102fc8=_0x1f2821[_0xd5f0('0x4b')][_0xd5f0('0x4c')]({'plain':!![]});if(!_0x102fc8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x102fc8[_0xd5f0('0x4d')]==='user'){var _0x38cb64=_0x59698f[_0xd5f0('0x4c')]({'plain':!![]});var _0x3270f1=_0xd5f0('0x25');return db[_0xd5f0('0x4e')]['find']({'where':{'name':_0x3270f1,'userProfileId':_0x102fc8[_0xd5f0('0x4f')]},'raw':!![]})[_0xd5f0('0x24')](function(_0x1738ce){if(_0x1738ce&&_0x1738ce['autoAssociation']===0x0){return db[_0xd5f0('0x26')]['create']({'name':_0x38cb64['name'],'resourceId':_0x38cb64['id'],'type':_0x1738ce[_0xd5f0('0x29')],'sectionId':_0x1738ce['id']},{})[_0xd5f0('0x24')](function(){return _0x59698f;});}else{return _0x59698f;}})['catch'](function(_0x78e8ce){logger[_0xd5f0('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x78e8ce);throw _0x78e8ce;});}return _0x59698f;})[_0xd5f0('0x24')](respondWithResult(_0x1bbc62,0xc9))[_0xd5f0('0x45')](handleError(_0x1bbc62,null));};exports[_0xd5f0('0x23')]=function(_0xb74e18,_0x57f7d6){if(_0xb74e18[_0xd5f0('0x4a')]['id']){delete _0xb74e18[_0xd5f0('0x4a')]['id'];}return db['CmContactHasPhone']['find']({'where':{'id':_0xb74e18[_0xd5f0('0x47')]['id']}})['then'](handleEntityNotFound(_0x57f7d6,null))[_0xd5f0('0x24')](saveUpdates(_0xb74e18[_0xd5f0('0x4a')],null))[_0xd5f0('0x24')](respondWithResult(_0x57f7d6,null))[_0xd5f0('0x45')](handleError(_0x57f7d6,null));};exports[_0xd5f0('0x27')]=function(_0x221e39,_0xbc4d9a){return db[_0xd5f0('0x2c')][_0xd5f0('0x48')]({'where':{'id':_0x221e39[_0xd5f0('0x47')]['id']}})[_0xd5f0('0x24')](handleEntityNotFound(_0xbc4d9a,null))[_0xd5f0('0x24')](removeEntity(_0xbc4d9a,null))[_0xd5f0('0x45')](handleError(_0xbc4d9a,null));}; \ No newline at end of file +var _0xb481=['keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','CmContactHasPhone','includeAll','include','findAll','catch','rawAttributes','options','find','create','user','role','CmContactHasPhones','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','name','send','index','map','type','key','query'];(function(_0x50ee2b,_0x26adfb){var _0x23a568=function(_0x3a7dbb){while(--_0x3a7dbb){_0x50ee2b['push'](_0x50ee2b['shift']());}};_0x23a568(++_0x26adfb);}(_0xb481,0x11a));var _0x1b48=function(_0x7baac8,_0x481055){_0x7baac8=_0x7baac8-0x0;var _0x572f4e=_0xb481[_0x7baac8];return _0x572f4e;};'use strict';var pdf=require(_0x1b48('0x0'));var emlformat=require(_0x1b48('0x1'));var rimraf=require(_0x1b48('0x2'));var zipdir=require(_0x1b48('0x3'));var jsonpatch=require(_0x1b48('0x4'));var rp=require(_0x1b48('0x5'));var moment=require('moment');var BPromise=require(_0x1b48('0x6'));var Mustache=require(_0x1b48('0x7'));var util=require(_0x1b48('0x8'));var path=require(_0x1b48('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1b48('0xa'));var fs=require('fs');var _=require(_0x1b48('0xb'));var squel=require('squel');var crypto=require(_0x1b48('0xc'));var jsforce=require(_0x1b48('0xd'));var deskjs=require(_0x1b48('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1b48('0xf'));var Papa=require('papaparse');var Redis=require(_0x1b48('0x10'));var authService=require(_0x1b48('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1b48('0x12'));var hardwareService=require(_0x1b48('0x13'));var logger=require(_0x1b48('0x14'))(_0x1b48('0x15'));var utils=require(_0x1b48('0x16'));var config=require(_0x1b48('0x17'));var licenseUtil=require(_0x1b48('0x18'));var db=require(_0x1b48('0x19'))['db'];function respondWithStatusCode(_0x52cbe3,_0x1df5a0){_0x1df5a0=_0x1df5a0||0xcc;return function(_0x13e690){if(_0x13e690){return _0x52cbe3['sendStatus'](_0x1df5a0);}return _0x52cbe3[_0x1b48('0x1a')](_0x1df5a0)[_0x1b48('0x1b')]();};}function respondWithResult(_0x52455c,_0x2d5f17){_0x2d5f17=_0x2d5f17||0xc8;return function(_0x334621){if(_0x334621){return _0x52455c['status'](_0x2d5f17)[_0x1b48('0x1c')](_0x334621);}};}function respondWithFilteredResult(_0x20a0bd,_0x32d4da){return function(_0x46ba17){if(_0x46ba17){var _0x3bb29a=_0x46ba17[_0x1b48('0x1d')],_0x4cc6d6=_0x32d4da[_0x1b48('0x1e')],_0x4f4477=_0x32d4da[_0x1b48('0x1e')]+_0x32d4da[_0x1b48('0x1f')],_0x701704;if(_0x4f4477>=_0x3bb29a){_0x4f4477=_0x3bb29a;_0x701704=0xc8;}else{_0x701704=0xce;}_0x20a0bd[_0x1b48('0x1a')](_0x701704);return _0x20a0bd[_0x1b48('0x20')](_0x1b48('0x21'),_0x4cc6d6+'-'+_0x4f4477+'/'+_0x3bb29a)[_0x1b48('0x1c')](_0x46ba17);}return null;};}function patchUpdates(_0x28e099){return function(_0x416118){try{jsonpatch[_0x1b48('0x22')](_0x416118,_0x28e099,!![]);}catch(_0x8e0db6){return BPromise[_0x1b48('0x23')](_0x8e0db6);}return _0x416118[_0x1b48('0x24')]();};}function saveUpdates(_0x486685,_0x176f02){return function(_0xa3ebe3){if(_0xa3ebe3){return _0xa3ebe3[_0x1b48('0x25')](_0x486685)[_0x1b48('0x26')](function(_0x4fc79d){return _0x4fc79d;});}return null;};}function removeEntity(_0x22a80f,_0x5802bd){return function(_0x172224){if(_0x172224){return _0x172224[_0x1b48('0x27')]()[_0x1b48('0x26')](function(){var _0x37d240=_0x172224[_0x1b48('0x28')]({'plain':!![]});var _0x7ca71c='CmContactHasPhones';return db[_0x1b48('0x29')]['destroy']({'where':{'type':_0x7ca71c,'resourceId':_0x37d240['id']}})[_0x1b48('0x26')](function(){return _0x172224;});})[_0x1b48('0x26')](function(){_0x22a80f[_0x1b48('0x1a')](0xcc)[_0x1b48('0x1b')]();});}};}function handleEntityNotFound(_0x1d8e37,_0x8adbdd){return function(_0x24b4ab){if(!_0x24b4ab){_0x1d8e37[_0x1b48('0x2a')](0x194);}return _0x24b4ab;};}function handleError(_0x529b61,_0x3224d6){_0x3224d6=_0x3224d6||0x1f4;return function(_0xa69a5d){logger['error'](_0xa69a5d['stack']);if(_0xa69a5d['name']){delete _0xa69a5d[_0x1b48('0x2b')];}_0x529b61['status'](_0x3224d6)[_0x1b48('0x2c')](_0xa69a5d);};}exports[_0x1b48('0x2d')]=function(_0x4d68eb,_0x169ddd){var _0x4b948f={},_0x139e4e={},_0x51b2b5={'count':0x0,'rows':[]};var _0x400057=_[_0x1b48('0x2e')](db['CmContactHasPhone']['rawAttributes'],function(_0xfe98f6){return{'name':_0xfe98f6['fieldName'],'type':_0xfe98f6[_0x1b48('0x2f')][_0x1b48('0x30')]};});_0x139e4e['model']=_['map'](_0x400057,_0x1b48('0x2b'));_0x139e4e[_0x1b48('0x31')]=_[_0x1b48('0x32')](_0x4d68eb[_0x1b48('0x31')]);_0x139e4e[_0x1b48('0x33')]=_[_0x1b48('0x34')](_0x139e4e[_0x1b48('0x35')],_0x139e4e[_0x1b48('0x31')]);_0x4b948f[_0x1b48('0x36')]=_[_0x1b48('0x34')](_0x139e4e['model'],qs['fields'](_0x4d68eb['query'][_0x1b48('0x37')]));_0x4b948f[_0x1b48('0x36')]=_0x4b948f[_0x1b48('0x36')][_0x1b48('0x38')]?_0x4b948f[_0x1b48('0x36')]:_0x139e4e[_0x1b48('0x35')];if(!_0x4d68eb[_0x1b48('0x31')]['hasOwnProperty'](_0x1b48('0x39'))){_0x4b948f[_0x1b48('0x1f')]=qs[_0x1b48('0x1f')](_0x4d68eb[_0x1b48('0x31')]['limit']);_0x4b948f[_0x1b48('0x1e')]=qs[_0x1b48('0x1e')](_0x4d68eb['query'][_0x1b48('0x1e')]);}_0x4b948f[_0x1b48('0x3a')]=qs[_0x1b48('0x3b')](_0x4d68eb[_0x1b48('0x31')][_0x1b48('0x3b')]);_0x4b948f['where']=qs[_0x1b48('0x33')](_[_0x1b48('0x3c')](_0x4d68eb['query'],_0x139e4e[_0x1b48('0x33')]),_0x400057);if(_0x4d68eb[_0x1b48('0x31')][_0x1b48('0x3d')]){_0x4b948f[_0x1b48('0x3e')]=_[_0x1b48('0x3f')](_0x4b948f[_0x1b48('0x3e')],{'$or':_[_0x1b48('0x2e')](_0x400057,function(_0x8f1933){if(_0x8f1933['type']!==_0x1b48('0x40')){var _0x551a26={};_0x551a26[_0x8f1933[_0x1b48('0x2b')]]={'$like':'%'+_0x4d68eb[_0x1b48('0x31')][_0x1b48('0x3d')]+'%'};return _0x551a26;}})});}_0x4b948f=_[_0x1b48('0x3f')]({},_0x4b948f,_0x4d68eb['options']);var _0x396d4f={'where':_0x4b948f[_0x1b48('0x3e')]};return db[_0x1b48('0x41')][_0x1b48('0x1d')](_0x396d4f)[_0x1b48('0x26')](function(_0x2f9d42){_0x51b2b5[_0x1b48('0x1d')]=_0x2f9d42;if(_0x4d68eb[_0x1b48('0x31')][_0x1b48('0x42')]){_0x4b948f[_0x1b48('0x43')]=[{'all':!![]}];}return db[_0x1b48('0x41')][_0x1b48('0x44')](_0x4b948f);})[_0x1b48('0x26')](function(_0x3321a8){_0x51b2b5['rows']=_0x3321a8;return _0x51b2b5;})[_0x1b48('0x26')](respondWithFilteredResult(_0x169ddd,_0x4b948f))[_0x1b48('0x45')](handleError(_0x169ddd,null));};exports['show']=function(_0x388229,_0x5e7bbc){var _0xb8de1={'raw':!![],'where':{'id':_0x388229['params']['id']}},_0x40aa4a={};_0x40aa4a[_0x1b48('0x35')]=_[_0x1b48('0x32')](db[_0x1b48('0x41')][_0x1b48('0x46')]);_0x40aa4a[_0x1b48('0x31')]=_[_0x1b48('0x32')](_0x388229[_0x1b48('0x31')]);_0x40aa4a[_0x1b48('0x33')]=_[_0x1b48('0x34')](_0x40aa4a[_0x1b48('0x35')],_0x40aa4a[_0x1b48('0x31')]);_0xb8de1[_0x1b48('0x36')]=_[_0x1b48('0x34')](_0x40aa4a[_0x1b48('0x35')],qs[_0x1b48('0x37')](_0x388229[_0x1b48('0x31')][_0x1b48('0x37')]));_0xb8de1[_0x1b48('0x36')]=_0xb8de1['attributes'][_0x1b48('0x38')]?_0xb8de1[_0x1b48('0x36')]:_0x40aa4a[_0x1b48('0x35')];if(_0x388229[_0x1b48('0x31')]['includeAll']){_0xb8de1[_0x1b48('0x43')]=[{'all':!![]}];}_0xb8de1=_[_0x1b48('0x3f')]({},_0xb8de1,_0x388229[_0x1b48('0x47')]);return db[_0x1b48('0x41')][_0x1b48('0x48')](_0xb8de1)['then'](handleEntityNotFound(_0x5e7bbc,null))[_0x1b48('0x26')](respondWithResult(_0x5e7bbc,null))[_0x1b48('0x45')](handleError(_0x5e7bbc,null));};exports['create']=function(_0x5f9d5e,_0xfe52f2){return db['CmContactHasPhone'][_0x1b48('0x49')](_0x5f9d5e['body'],{})[_0x1b48('0x26')](function(_0x3a4df6){var _0x12e256=_0x5f9d5e[_0x1b48('0x4a')][_0x1b48('0x28')]({'plain':!![]});if(!_0x12e256)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12e256[_0x1b48('0x4b')]===_0x1b48('0x4a')){var _0xfee19f=_0x3a4df6['get']({'plain':!![]});var _0x3f3313=_0x1b48('0x4c');return db[_0x1b48('0x4d')]['find']({'where':{'name':_0x3f3313,'userProfileId':_0x12e256[_0x1b48('0x4e')]},'raw':!![]})[_0x1b48('0x26')](function(_0x1f3e84){if(_0x1f3e84&&_0x1f3e84['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xfee19f['name'],'resourceId':_0xfee19f['id'],'type':_0x1f3e84[_0x1b48('0x2b')],'sectionId':_0x1f3e84['id']},{})[_0x1b48('0x26')](function(){return _0x3a4df6;});}else{return _0x3a4df6;}})[_0x1b48('0x45')](function(_0x401199){logger[_0x1b48('0x4f')](_0x1b48('0x50'),_0x401199);throw _0x401199;});}return _0x3a4df6;})[_0x1b48('0x26')](respondWithResult(_0xfe52f2,0xc9))['catch'](handleError(_0xfe52f2,null));};exports['update']=function(_0x1e5c6a,_0x1b4724){if(_0x1e5c6a[_0x1b48('0x51')]['id']){delete _0x1e5c6a[_0x1b48('0x51')]['id'];}return db[_0x1b48('0x41')][_0x1b48('0x48')]({'where':{'id':_0x1e5c6a[_0x1b48('0x52')]['id']}})[_0x1b48('0x26')](handleEntityNotFound(_0x1b4724,null))['then'](saveUpdates(_0x1e5c6a['body'],null))[_0x1b48('0x26')](respondWithResult(_0x1b4724,null))[_0x1b48('0x45')](handleError(_0x1b4724,null));};exports[_0x1b48('0x27')]=function(_0x48da2c,_0x3d9232){return db['CmContactHasPhone'][_0x1b48('0x48')]({'where':{'id':_0x48da2c['params']['id']}})[_0x1b48('0x26')](handleEntityNotFound(_0x3d9232,null))['then'](removeEntity(_0x3d9232,null))[_0x1b48('0x45')](handleError(_0x3d9232,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 2c9ea4b..be78078 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.model.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe027=['api','bluebird','request-promise','rimraf','define','CmContactHasPhone','lodash','util','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe027,0xf9));var _0x7e02=function(_0x371c8a,_0x3ccf08){_0x371c8a=_0x371c8a-0x0;var _0x3f10f0=_0xe027[_0x371c8a];return _0x3f10f0;};'use strict';var _=require(_0x7e02('0x0'));var util=require(_0x7e02('0x1'));var logger=require(_0x7e02('0x2'))(_0x7e02('0x3'));var moment=require('moment');var BPromise=require(_0x7e02('0x4'));var rp=require(_0x7e02('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e02('0x6'));var config=require('../../config/environment');var attributes=require('./cmContactHasPhone.attributes');module['exports']=function(_0x3d2275,_0x4bb36f){return _0x3d2275[_0x7e02('0x7')](_0x7e02('0x8'),attributes,{'tableName':'cm_contact_has_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecd0=['define','CmContactHasPhone','cm_contact_has_phones','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3e8a3f,_0x3fd3f0){var _0x5d3ff6=function(_0x4eaa29){while(--_0x4eaa29){_0x3e8a3f['push'](_0x3e8a3f['shift']());}};_0x5d3ff6(++_0x3fd3f0);}(_0xecd0,0x162));var _0x0ecd=function(_0x459a0a,_0x25c46f){_0x459a0a=_0x459a0a-0x0;var _0x4ab46c=_0xecd0[_0x459a0a];return _0x4ab46c;};'use strict';var _=require(_0x0ecd('0x0'));var util=require(_0x0ecd('0x1'));var logger=require(_0x0ecd('0x2'))(_0x0ecd('0x3'));var moment=require(_0x0ecd('0x4'));var BPromise=require('bluebird');var rp=require(_0x0ecd('0x5'));var fs=require('fs');var path=require(_0x0ecd('0x6'));var rimraf=require(_0x0ecd('0x7'));var config=require(_0x0ecd('0x8'));var attributes=require('./cmContactHasPhone.attributes');module[_0x0ecd('0x9')]=function(_0x1cde06,_0xff2f1c){return _0x1cde06[_0x0ecd('0xa')](_0x0ecd('0xb'),attributes,{'tableName':_0x0ecd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js index f625bc5..7b422d9 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66ef=['jayson/promise','client','http','then','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','CmContactHasPhone,\x20%s,\x20%s,\x20%s','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x54b907,_0x29ff96){var _0x363d89=function(_0x184d8f){while(--_0x184d8f){_0x54b907['push'](_0x54b907['shift']());}};_0x363d89(++_0x29ff96);}(_0x66ef,0x123));var _0xf66e=function(_0x1800d5,_0x2ee31a){_0x1800d5=_0x1800d5-0x0;var _0x4f4bd3=_0x66ef[_0x1800d5];return _0x4f4bd3;};'use strict';var _=require(_0xf66e('0x0'));var util=require(_0xf66e('0x1'));var moment=require(_0xf66e('0x2'));var BPromise=require(_0xf66e('0x3'));var rs=require(_0xf66e('0x4'));var fs=require('fs');var Redis=require(_0xf66e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf66e('0x6'))(_0xf66e('0x7'));var config=require(_0xf66e('0x8'));var jayson=require(_0xf66e('0x9'));var client=jayson[_0xf66e('0xa')][_0xf66e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1adace,_0x327a94,_0x3e6bfe){return new BPromise(function(_0x140b0a,_0x1b715f){return client['request'](_0x1adace,_0x3e6bfe)[_0xf66e('0xc')](function(_0xf86a80){logger['info'](_0xf66e('0xd'),_0x327a94,_0xf66e('0xe'));logger['debug'](_0xf66e('0xf'),_0x327a94,'request\x20sent',JSON['stringify'](_0xf86a80));if(_0xf86a80[_0xf66e('0x10')]){if(_0xf86a80['error']['code']===0x1f4){logger[_0xf66e('0x10')](_0xf66e('0xd'),_0x327a94,_0xf86a80[_0xf66e('0x10')][_0xf66e('0x11')]);return _0x1b715f(_0xf86a80[_0xf66e('0x10')][_0xf66e('0x11')]);}logger[_0xf66e('0x10')](_0xf66e('0xd'),_0x327a94,_0xf86a80[_0xf66e('0x10')][_0xf66e('0x11')]);return _0x140b0a(_0xf86a80['error'][_0xf66e('0x11')]);}else{logger[_0xf66e('0x12')](_0xf66e('0xd'),_0x327a94,_0xf66e('0xe'));_0x140b0a(_0xf86a80[_0xf66e('0x13')][_0xf66e('0x11')]);}})['catch'](function(_0x584962){logger[_0xf66e('0x10')](_0xf66e('0xd'),_0x327a94,_0x584962);_0x1b715f(_0x584962);});});} \ No newline at end of file +var _0xb48c=['client','http','request','then','info','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x2f6541,_0x363cba){var _0x4d76d8=function(_0x86404){while(--_0x86404){_0x2f6541['push'](_0x2f6541['shift']());}};_0x4d76d8(++_0x363cba);}(_0xb48c,0xdd));var _0xcb48=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb48c[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xcb48('0x0'));var util=require(_0xcb48('0x1'));var moment=require(_0xcb48('0x2'));var BPromise=require('bluebird');var rs=require(_0xcb48('0x3'));var fs=require('fs');var Redis=require(_0xcb48('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb48('0x5'));var logger=require(_0xcb48('0x6'))(_0xcb48('0x7'));var config=require('../../config/environment');var jayson=require(_0xcb48('0x8'));var client=jayson[_0xcb48('0x9')][_0xcb48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a477d,_0x4db4fa,_0x1c1256){return new BPromise(function(_0x4a67fb,_0x43dc84){return client[_0xcb48('0xb')](_0x5a477d,_0x1c1256)[_0xcb48('0xc')](function(_0x584cbf){logger[_0xcb48('0xd')](_0xcb48('0xe'),_0x4db4fa,_0xcb48('0xf'));logger[_0xcb48('0x10')](_0xcb48('0x11'),_0x4db4fa,'request\x20sent',JSON[_0xcb48('0x12')](_0x584cbf));if(_0x584cbf[_0xcb48('0x13')]){if(_0x584cbf['error']['code']===0x1f4){logger[_0xcb48('0x13')](_0xcb48('0xe'),_0x4db4fa,_0x584cbf[_0xcb48('0x13')][_0xcb48('0x14')]);return _0x43dc84(_0x584cbf[_0xcb48('0x13')][_0xcb48('0x14')]);}logger[_0xcb48('0x13')]('CmContactHasPhone,\x20%s,\x20%s',_0x4db4fa,_0x584cbf[_0xcb48('0x13')][_0xcb48('0x14')]);return _0x4a67fb(_0x584cbf[_0xcb48('0x13')][_0xcb48('0x14')]);}else{logger[_0xcb48('0xd')](_0xcb48('0xe'),_0x4db4fa,_0xcb48('0xf'));_0x4a67fb(_0x584cbf[_0xcb48('0x15')][_0xcb48('0x14')]);}})[_0xcb48('0x16')](function(_0x502940){logger[_0xcb48('0x13')]('CmContactHasPhone,\x20%s,\x20%s',_0x4db4fa,_0x502940);_0x43dc84(_0x502940);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 985fce3..8c37714 100644 --- a/server/api/cmContactHasPhone/index.js +++ b/server/api/cmContactHasPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe6c=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x53fcd0,_0x294576){var _0x456acb=function(_0x3a28d2){while(--_0x3a28d2){_0x53fcd0['push'](_0x53fcd0['shift']());}};_0x456acb(++_0x294576);}(_0xbe6c,0x139));var _0xcbe6=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xbe6c[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require('multer');var util=require(_0xcbe6('0x0'));var path=require(_0xcbe6('0x1'));var timeout=require(_0xcbe6('0x2'));var express=require(_0xcbe6('0x3'));var router=express[_0xcbe6('0x4')]();var auth=require(_0xcbe6('0x5'));var interaction=require(_0xcbe6('0x6'));var config=require(_0xcbe6('0x7'));var controller=require(_0xcbe6('0x8'));router[_0xcbe6('0x9')]('/',auth['isAuthenticated'](),controller[_0xcbe6('0xa')]);router['get'](_0xcbe6('0xb'),auth[_0xcbe6('0xc')](),controller[_0xcbe6('0xd')]);router[_0xcbe6('0xe')]('/',auth[_0xcbe6('0xc')](),controller[_0xcbe6('0xf')]);router[_0xcbe6('0x10')](_0xcbe6('0xb'),auth[_0xcbe6('0xc')](),controller[_0xcbe6('0x11')]);router[_0xcbe6('0x12')]('/:id',auth[_0xcbe6('0xc')](),controller[_0xcbe6('0x13')]);module[_0xcbe6('0x14')]=router; \ No newline at end of file +var _0x249a=['post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated','index','/:id'];(function(_0x54b0c5,_0x9c7637){var _0x1039fb=function(_0x297916){while(--_0x297916){_0x54b0c5['push'](_0x54b0c5['shift']());}};_0x1039fb(++_0x9c7637);}(_0x249a,0x124));var _0xa249=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x249a[_0x47fd36];return _0x21a0fc;};'use strict';var multer=require('multer');var util=require(_0xa249('0x0'));var path=require(_0xa249('0x1'));var timeout=require(_0xa249('0x2'));var express=require('express');var router=express[_0xa249('0x3')]();var auth=require(_0xa249('0x4'));var interaction=require(_0xa249('0x5'));var config=require(_0xa249('0x6'));var controller=require(_0xa249('0x7'));router[_0xa249('0x8')]('/',auth[_0xa249('0x9')](),controller[_0xa249('0xa')]);router[_0xa249('0x8')](_0xa249('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xa249('0xc')]('/',auth[_0xa249('0x9')](),controller[_0xa249('0xd')]);router[_0xa249('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xa249('0xf')]);router[_0xa249('0x10')](_0xa249('0xb'),auth[_0xa249('0x9')](),controller[_0xa249('0x11')]);module[_0xa249('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index b769589..a90d6d6 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 _0xe181=['ENUM','voice','sequelize','exports','VIRTUAL','getDataValue','alias','STRING','TEXT','long','type','select','values','isArray','stringify','setDataValue','BOOLEAN'];(function(_0x40aaa4,_0x3b22f4){var _0x4e21e5=function(_0x35d2f3){while(--_0x35d2f3){_0x40aaa4['push'](_0x40aaa4['shift']());}};_0x4e21e5(++_0x3b22f4);}(_0xe181,0x68));var _0x1e18=function(_0x16c50c,_0x1256df){_0x16c50c=_0x16c50c-0x0;var _0x50575f=_0xe181[_0x16c50c];return _0x50575f;};'use strict';var Sequelize=require(_0x1e18('0x0'));var _=require('lodash');module[_0x1e18('0x1')]={'name':{'type':Sequelize[_0x1e18('0x2')],'get':function(_0x19e683){return this[_0x1e18('0x3')](_0x1e18('0x4'));}},'alias':{'type':Sequelize[_0x1e18('0x5')],'allowNull':![],'set':function(_0x3ec619){this['setDataValue'](_0x1e18('0x4'),_0x3ec619?_0x3ec619:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x1e18('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x1e18('0x6')](_0x1e18('0x7')),'get':function(){if(this[_0x1e18('0x3')](_0x1e18('0x8'))===_0x1e18('0x9')){return JSON['parse'](this[_0x1e18('0x3')](_0x1e18('0xa')));}else{return this[_0x1e18('0x3')](_0x1e18('0xa'));}},'set':function(_0x19d0bc){if(Array[_0x1e18('0xb')](_0x19d0bc)){this['setDataValue'](_0x1e18('0xa'),JSON[_0x1e18('0xc')](_0x19d0bc));}else{this[_0x1e18('0xd')](_0x1e18('0xa'),_0x19d0bc);}}},'required':{'type':Sequelize[_0x1e18('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x1e18('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x1e18('0xf')](_0x1e18('0x10'))}}; \ No newline at end of file +var _0x6737=['ENUM','voice','lodash','exports','getDataValue','alias','STRING','setDataValue','name','select','values','isArray','stringify','BOOLEAN'];(function(_0x5ae761,_0x9afc7c){var _0x42add3=function(_0x5e0fa8){while(--_0x5e0fa8){_0x5ae761['push'](_0x5ae761['shift']());}};_0x42add3(++_0x9afc7c);}(_0x6737,0xe2));var _0x7673=function(_0x4fb876,_0x45ab98){_0x4fb876=_0x4fb876-0x0;var _0x52b6c9=_0x6737[_0x4fb876];return _0x52b6c9;};'use strict';var Sequelize=require('sequelize');var _=require(_0x7673('0x0'));module[_0x7673('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2f05d4){return this[_0x7673('0x2')](_0x7673('0x3'));}},'alias':{'type':Sequelize[_0x7673('0x4')],'allowNull':![],'set':function(_0x54002e){this[_0x7673('0x5')](_0x7673('0x3'),_0x54002e?_0x54002e:this['getDataValue'](_0x7673('0x6')));}},'type':{'type':Sequelize[_0x7673('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this['getDataValue']('type')===_0x7673('0x7')){return JSON['parse'](this[_0x7673('0x2')](_0x7673('0x8')));}else{return this['getDataValue'](_0x7673('0x8'));}},'set':function(_0x331f57){if(Array[_0x7673('0x9')](_0x331f57)){this['setDataValue']('values',JSON[_0x7673('0xa')](_0x331f57));}else{this['setDataValue'](_0x7673('0x8'),_0x331f57);}}},'required':{'type':Sequelize[_0x7673('0xb')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x7673('0xb')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x7673('0xc')](_0x7673('0xd'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 9ae573b..aa404f8 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 _0xe859=['switch','queryInterface','addColumn','cm_contacts','format','cf_%d','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','sendStatus','error','send','map','CmCustomField','fieldName','type','key','model','differenceBy','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','then','show','params','rawAttributes','catch','body','find','destroy','sequelize','transaction','create','TEXT','text','Sequelize','number','INTEGER'];(function(_0x46d8f1,_0x194555){var _0x17e7ff=function(_0x2a2043){while(--_0x2a2043){_0x46d8f1['push'](_0x46d8f1['shift']());}};_0x17e7ff(++_0x194555);}(_0xe859,0xba));var _0x9e85=function(_0x24a60f,_0x5ec8de){_0x24a60f=_0x24a60f-0x0;var _0x2ca7ea=_0xe859[_0x24a60f];return _0x2ca7ea;};'use strict';var pdf=require(_0x9e85('0x0'));var emlformat=require(_0x9e85('0x1'));var rimraf=require(_0x9e85('0x2'));var zipdir=require(_0x9e85('0x3'));var jsonpatch=require(_0x9e85('0x4'));var rp=require(_0x9e85('0x5'));var moment=require(_0x9e85('0x6'));var BPromise=require(_0x9e85('0x7'));var Mustache=require(_0x9e85('0x8'));var util=require(_0x9e85('0x9'));var path=require(_0x9e85('0xa'));var sox=require(_0x9e85('0xb'));var csv=require(_0x9e85('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9e85('0xd'));var squel=require(_0x9e85('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9e85('0xf'));var toCsv=require(_0x9e85('0xc'));var querystring=require(_0x9e85('0x10'));var Papa=require(_0x9e85('0x11'));var Redis=require(_0x9e85('0x12'));var authService=require(_0x9e85('0x13'));var qs=require(_0x9e85('0x14'));var as=require(_0x9e85('0x15'));var hardwareService=require(_0x9e85('0x16'));var logger=require('../../config/logger')(_0x9e85('0x17'));var utils=require(_0x9e85('0x18'));var config=require(_0x9e85('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x9e85('0x1a'))['db'];function respondWithStatusCode(_0x6306e8,_0x56a237){_0x56a237=_0x56a237||0xcc;return function(_0x5d7af8){if(_0x5d7af8){return _0x6306e8['sendStatus'](_0x56a237);}return _0x6306e8['status'](_0x56a237)[_0x9e85('0x1b')]();};}function respondWithResult(_0x42f271,_0x459a04){_0x459a04=_0x459a04||0xc8;return function(_0x1632d8){if(_0x1632d8){return _0x42f271[_0x9e85('0x1c')](_0x459a04)[_0x9e85('0x1d')](_0x1632d8);}};}function respondWithFilteredResult(_0x464f92,_0x140b90){return function(_0x16a27b){if(_0x16a27b){var _0x55aa41=_0x16a27b[_0x9e85('0x1e')],_0x3813ce=_0x140b90[_0x9e85('0x1f')],_0x4f1429=_0x140b90[_0x9e85('0x1f')]+_0x140b90[_0x9e85('0x20')],_0x5a1d6b;if(_0x4f1429>=_0x55aa41){_0x4f1429=_0x55aa41;_0x5a1d6b=0xc8;}else{_0x5a1d6b=0xce;}_0x464f92[_0x9e85('0x1c')](_0x5a1d6b);return _0x464f92['set'](_0x9e85('0x21'),_0x3813ce+'-'+_0x4f1429+'/'+_0x55aa41)['json'](_0x16a27b);}return null;};}function patchUpdates(_0x4d74ce){return function(_0x9ab72c){try{jsonpatch[_0x9e85('0x22')](_0x9ab72c,_0x4d74ce,!![]);}catch(_0x3ed026){return BPromise[_0x9e85('0x23')](_0x3ed026);}return _0x9ab72c[_0x9e85('0x24')]();};}function saveUpdates(_0x34ac0b,_0xa2c13){return function(_0x5ce5d3){if(_0x5ce5d3){return _0x5ce5d3[_0x9e85('0x25')](_0x34ac0b)['then'](function(_0x27c493){return _0x27c493;});}return null;};}function removeEntity(_0x4205be,_0x55e30d){return function(_0x369797){if(_0x369797){return _0x369797['destroy']()['then'](function(){_0x4205be[_0x9e85('0x1c')](0xcc)[_0x9e85('0x1b')]();});}};}function handleEntityNotFound(_0x176d55,_0x56fa12){return function(_0x38cef6){if(!_0x38cef6){_0x176d55[_0x9e85('0x26')](0x194);}return _0x38cef6;};}function handleError(_0x2246d6,_0x326a53){_0x326a53=_0x326a53||0x1f4;return function(_0x36b1e9){logger[_0x9e85('0x27')](_0x36b1e9['stack']);if(_0x36b1e9['name']){delete _0x36b1e9['name'];}_0x2246d6[_0x9e85('0x1c')](_0x326a53)[_0x9e85('0x28')](_0x36b1e9);};}exports['index']=function(_0x94e5eb,_0x3ecc17){var _0x474ab7={},_0x1837ed={},_0x57d466={'count':0x0,'rows':[]};var _0x3da1a7=_[_0x9e85('0x29')](db[_0x9e85('0x2a')]['rawAttributes'],function(_0x4db349){return{'name':_0x4db349[_0x9e85('0x2b')],'type':_0x4db349[_0x9e85('0x2c')][_0x9e85('0x2d')]};});_0x1837ed[_0x9e85('0x2e')]=_[_0x9e85('0x2f')](_[_0x9e85('0x29')](_0x3da1a7,_0x9e85('0x30')),['name']);_0x1837ed['query']=_[_0x9e85('0x31')](_0x94e5eb[_0x9e85('0x32')]);_0x1837ed[_0x9e85('0x33')]=_['intersection'](_0x1837ed['model'],_0x1837ed['query']);_0x474ab7[_0x9e85('0x34')]=_[_0x9e85('0x35')](_0x1837ed[_0x9e85('0x2e')],qs[_0x9e85('0x36')](_0x94e5eb[_0x9e85('0x32')][_0x9e85('0x36')]));_0x474ab7['attributes']=_0x474ab7[_0x9e85('0x34')][_0x9e85('0x37')]?_0x474ab7[_0x9e85('0x34')]:_0x1837ed['model'];if(!_0x94e5eb[_0x9e85('0x32')][_0x9e85('0x38')](_0x9e85('0x39'))){_0x474ab7['limit']=qs[_0x9e85('0x20')](_0x94e5eb[_0x9e85('0x32')][_0x9e85('0x20')]);_0x474ab7['offset']=qs['offset'](_0x94e5eb[_0x9e85('0x32')][_0x9e85('0x1f')]);}_0x474ab7['order']=qs[_0x9e85('0x3a')](_0x94e5eb[_0x9e85('0x32')][_0x9e85('0x3a')]);_0x474ab7[_0x9e85('0x3b')]=qs['filters'](_[_0x9e85('0x3c')](_0x94e5eb[_0x9e85('0x32')],_0x1837ed[_0x9e85('0x33')]),_0x3da1a7);if(_0x94e5eb['query'][_0x9e85('0x3d')]){_0x474ab7[_0x9e85('0x3b')]=_[_0x9e85('0x3e')](_0x474ab7['where'],{'$or':_[_0x9e85('0x29')](_0x3da1a7,function(_0x277799){if(_0x277799[_0x9e85('0x2c')]!==_0x9e85('0x3f')){var _0xa1d5b9={};_0xa1d5b9[_0x277799['name']]={'$like':'%'+_0x94e5eb[_0x9e85('0x32')][_0x9e85('0x3d')]+'%'};return _0xa1d5b9;}})});}_0x474ab7=_[_0x9e85('0x3e')]({},_0x474ab7,_0x94e5eb[_0x9e85('0x40')]);var _0x384640={'where':_0x474ab7[_0x9e85('0x3b')]};return db[_0x9e85('0x2a')][_0x9e85('0x1e')](_0x384640)['then'](function(_0x4bf202){_0x57d466[_0x9e85('0x1e')]=_0x4bf202;if(_0x94e5eb['query'][_0x9e85('0x41')]){_0x474ab7[_0x9e85('0x42')]=[{'all':!![]}];}return db[_0x9e85('0x2a')][_0x9e85('0x43')](_0x474ab7);})['then'](function(_0x5b71ef){_0x57d466['rows']=_0x5b71ef;return _0x57d466;})[_0x9e85('0x44')](respondWithFilteredResult(_0x3ecc17,_0x474ab7))['catch'](handleError(_0x3ecc17,null));};exports[_0x9e85('0x45')]=function(_0x54a7fd,_0x2877b1){var _0x534646={'raw':!![],'where':{'id':_0x54a7fd[_0x9e85('0x46')]['id']}},_0x4add2c={};_0x4add2c[_0x9e85('0x2e')]=_[_0x9e85('0x31')](db[_0x9e85('0x2a')][_0x9e85('0x47')]);_0x4add2c[_0x9e85('0x32')]=_[_0x9e85('0x31')](_0x54a7fd[_0x9e85('0x32')]);_0x4add2c[_0x9e85('0x33')]=_[_0x9e85('0x35')](_0x4add2c[_0x9e85('0x2e')],_0x4add2c[_0x9e85('0x32')]);_0x534646[_0x9e85('0x34')]=_[_0x9e85('0x35')](_0x4add2c[_0x9e85('0x2e')],qs[_0x9e85('0x36')](_0x54a7fd[_0x9e85('0x32')][_0x9e85('0x36')]));_0x534646['attributes']=_0x534646[_0x9e85('0x34')]['length']?_0x534646[_0x9e85('0x34')]:_0x4add2c[_0x9e85('0x2e')];if(_0x54a7fd['query'][_0x9e85('0x41')]){_0x534646[_0x9e85('0x42')]=[{'all':!![]}];}_0x534646=_[_0x9e85('0x3e')]({},_0x534646,_0x54a7fd[_0x9e85('0x40')]);return db[_0x9e85('0x2a')]['find'](_0x534646)['then'](handleEntityNotFound(_0x2877b1,null))[_0x9e85('0x44')](respondWithResult(_0x2877b1,null))[_0x9e85('0x48')](handleError(_0x2877b1,null));};exports[_0x9e85('0x25')]=function(_0x265e4b,_0x2217aa){if(_0x265e4b[_0x9e85('0x49')]['id']){delete _0x265e4b[_0x9e85('0x49')]['id'];}return db['CmCustomField'][_0x9e85('0x4a')]({'where':{'id':_0x265e4b[_0x9e85('0x46')]['id']}})[_0x9e85('0x44')](handleEntityNotFound(_0x2217aa,null))[_0x9e85('0x44')](saveUpdates(_0x265e4b[_0x9e85('0x49')],null))[_0x9e85('0x44')](respondWithResult(_0x2217aa,null))[_0x9e85('0x48')](handleError(_0x2217aa,null));};exports[_0x9e85('0x4b')]=function(_0x5f5bb7,_0x4bf987){return db[_0x9e85('0x2a')]['find']({'where':{'id':_0x5f5bb7['params']['id']}})[_0x9e85('0x44')](handleEntityNotFound(_0x4bf987,null))[_0x9e85('0x44')](removeEntity(_0x4bf987,null))[_0x9e85('0x48')](handleError(_0x4bf987,null));};exports['create']=function(_0x562d10,_0x1c1820){var _0x572cd4;return db[_0x9e85('0x4c')][_0x9e85('0x4d')](function(_0xbb496f){return db[_0x9e85('0x2a')][_0x9e85('0x4e')](_0x562d10[_0x9e85('0x49')],{'transaction':_0xbb496f})['then'](function(_0x47e024){_0x572cd4=_0x47e024;var _0x20a4c1={'type':db['Sequelize'][_0x9e85('0x4f')],'transaction':_0xbb496f};switch(_0x562d10['body'][_0x9e85('0x2c')]){case _0x9e85('0x50'):_0x20a4c1[_0x9e85('0x2c')]=db[_0x9e85('0x51')][_0x9e85('0x4f')];break;case _0x9e85('0x52'):_0x20a4c1['type']=db[_0x9e85('0x51')][_0x9e85('0x53')];break;case _0x9e85('0x54'):_0x20a4c1[_0x9e85('0x2c')]=db[_0x9e85('0x51')]['BOOLEAN'];_0x20a4c1['defaultValue']=![];break;default:}return db['sequelize'][_0x9e85('0x55')][_0x9e85('0x56')](_0x9e85('0x57'),util[_0x9e85('0x58')](_0x9e85('0x59'),_0x572cd4['id']),_0x20a4c1);})['then'](function(){return _0x572cd4;});})[_0x9e85('0x44')](respondWithResult(_0x1c1820,0xc9))[_0x9e85('0x48')](handleError(_0x1c1820,null));}; \ No newline at end of file +var _0x0dbf=['lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','body','create','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','html-pdf','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x4325be,_0x29692c){var _0x3cf5a6=function(_0x2ba6f6){while(--_0x2ba6f6){_0x4325be['push'](_0x4325be['shift']());}};_0x3cf5a6(++_0x29692c);}(_0x0dbf,0x1a9));var _0xf0db=function(_0x1fa759,_0x4ecdce){_0x1fa759=_0x1fa759-0x0;var _0x2da9f4=_0x0dbf[_0x1fa759];return _0x2da9f4;};'use strict';var pdf=require(_0xf0db('0x0'));var emlformat=require(_0xf0db('0x1'));var rimraf=require(_0xf0db('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf0db('0x3'));var BPromise=require(_0xf0db('0x4'));var Mustache=require(_0xf0db('0x5'));var util=require('util');var path=require(_0xf0db('0x6'));var sox=require(_0xf0db('0x7'));var csv=require(_0xf0db('0x8'));var ejs=require(_0xf0db('0x9'));var fs=require('fs');var _=require(_0xf0db('0xa'));var squel=require(_0xf0db('0xb'));var crypto=require(_0xf0db('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf0db('0x8'));var querystring=require(_0xf0db('0xd'));var Papa=require('papaparse');var Redis=require(_0xf0db('0xe'));var authService=require(_0xf0db('0xf'));var qs=require(_0xf0db('0x10'));var as=require(_0xf0db('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0db('0x12'))(_0xf0db('0x13'));var utils=require(_0xf0db('0x14'));var config=require(_0xf0db('0x15'));var licenseUtil=require(_0xf0db('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10ed1a,_0x18a351){_0x18a351=_0x18a351||0xcc;return function(_0x5b6e8b){if(_0x5b6e8b){return _0x10ed1a[_0xf0db('0x17')](_0x18a351);}return _0x10ed1a[_0xf0db('0x18')](_0x18a351)[_0xf0db('0x19')]();};}function respondWithResult(_0x53bef9,_0xc8f9e1){_0xc8f9e1=_0xc8f9e1||0xc8;return function(_0x4fa1c0){if(_0x4fa1c0){return _0x53bef9[_0xf0db('0x18')](_0xc8f9e1)[_0xf0db('0x1a')](_0x4fa1c0);}};}function respondWithFilteredResult(_0x237e6f,_0x445c85){return function(_0x5b13ad){if(_0x5b13ad){var _0x13b5a7=_0x5b13ad[_0xf0db('0x1b')],_0xa19108=_0x445c85[_0xf0db('0x1c')],_0x2fc126=_0x445c85[_0xf0db('0x1c')]+_0x445c85[_0xf0db('0x1d')],_0x4982fa;if(_0x2fc126>=_0x13b5a7){_0x2fc126=_0x13b5a7;_0x4982fa=0xc8;}else{_0x4982fa=0xce;}_0x237e6f[_0xf0db('0x18')](_0x4982fa);return _0x237e6f[_0xf0db('0x1e')]('Content-Range',_0xa19108+'-'+_0x2fc126+'/'+_0x13b5a7)[_0xf0db('0x1a')](_0x5b13ad);}return null;};}function patchUpdates(_0x32d334){return function(_0x346a41){try{jsonpatch[_0xf0db('0x1f')](_0x346a41,_0x32d334,!![]);}catch(_0x21dbc3){return BPromise[_0xf0db('0x20')](_0x21dbc3);}return _0x346a41[_0xf0db('0x21')]();};}function saveUpdates(_0x5715af,_0x30f9a2){return function(_0x4213ee){if(_0x4213ee){return _0x4213ee[_0xf0db('0x22')](_0x5715af)[_0xf0db('0x23')](function(_0x450b90){return _0x450b90;});}return null;};}function removeEntity(_0x2cf6e7,_0x2676b5){return function(_0x2ee523){if(_0x2ee523){return _0x2ee523[_0xf0db('0x24')]()[_0xf0db('0x23')](function(){_0x2cf6e7[_0xf0db('0x18')](0xcc)[_0xf0db('0x19')]();});}};}function handleEntityNotFound(_0x4f1f76,_0x102960){return function(_0xec85b){if(!_0xec85b){_0x4f1f76[_0xf0db('0x17')](0x194);}return _0xec85b;};}function handleError(_0x37d989,_0x1cc976){_0x1cc976=_0x1cc976||0x1f4;return function(_0x3c48ca){logger[_0xf0db('0x25')](_0x3c48ca['stack']);if(_0x3c48ca[_0xf0db('0x26')]){delete _0x3c48ca['name'];}_0x37d989[_0xf0db('0x18')](_0x1cc976)[_0xf0db('0x27')](_0x3c48ca);};}exports['index']=function(_0x1e23e1,_0x18eac2){var _0x4217d8={},_0x4dfcc4={},_0x8a8c07={'count':0x0,'rows':[]};var _0x343fb8=_[_0xf0db('0x28')](db[_0xf0db('0x29')][_0xf0db('0x2a')],function(_0x1f7c98){return{'name':_0x1f7c98[_0xf0db('0x2b')],'type':_0x1f7c98[_0xf0db('0x2c')][_0xf0db('0x2d')]};});_0x4dfcc4[_0xf0db('0x2e')]=_[_0xf0db('0x2f')](_[_0xf0db('0x28')](_0x343fb8,'name'),[_0xf0db('0x26')]);_0x4dfcc4[_0xf0db('0x30')]=_[_0xf0db('0x31')](_0x1e23e1['query']);_0x4dfcc4[_0xf0db('0x32')]=_[_0xf0db('0x33')](_0x4dfcc4[_0xf0db('0x2e')],_0x4dfcc4[_0xf0db('0x30')]);_0x4217d8[_0xf0db('0x34')]=_[_0xf0db('0x33')](_0x4dfcc4[_0xf0db('0x2e')],qs[_0xf0db('0x35')](_0x1e23e1[_0xf0db('0x30')][_0xf0db('0x35')]));_0x4217d8[_0xf0db('0x34')]=_0x4217d8[_0xf0db('0x34')][_0xf0db('0x36')]?_0x4217d8[_0xf0db('0x34')]:_0x4dfcc4[_0xf0db('0x2e')];if(!_0x1e23e1[_0xf0db('0x30')][_0xf0db('0x37')]('nolimit')){_0x4217d8['limit']=qs['limit'](_0x1e23e1[_0xf0db('0x30')][_0xf0db('0x1d')]);_0x4217d8[_0xf0db('0x1c')]=qs[_0xf0db('0x1c')](_0x1e23e1['query'][_0xf0db('0x1c')]);}_0x4217d8[_0xf0db('0x38')]=qs[_0xf0db('0x39')](_0x1e23e1[_0xf0db('0x30')]['sort']);_0x4217d8['where']=qs[_0xf0db('0x32')](_[_0xf0db('0x3a')](_0x1e23e1['query'],_0x4dfcc4[_0xf0db('0x32')]),_0x343fb8);if(_0x1e23e1['query'][_0xf0db('0x3b')]){_0x4217d8[_0xf0db('0x3c')]=_[_0xf0db('0x3d')](_0x4217d8[_0xf0db('0x3c')],{'$or':_[_0xf0db('0x28')](_0x343fb8,function(_0x3984cd){if(_0x3984cd[_0xf0db('0x2c')]!==_0xf0db('0x3e')){var _0x59ffb3={};_0x59ffb3[_0x3984cd[_0xf0db('0x26')]]={'$like':'%'+_0x1e23e1[_0xf0db('0x30')][_0xf0db('0x3b')]+'%'};return _0x59ffb3;}})});}_0x4217d8=_[_0xf0db('0x3d')]({},_0x4217d8,_0x1e23e1[_0xf0db('0x3f')]);var _0x194fb1={'where':_0x4217d8['where']};return db[_0xf0db('0x29')][_0xf0db('0x1b')](_0x194fb1)[_0xf0db('0x23')](function(_0x35a11d){_0x8a8c07['count']=_0x35a11d;if(_0x1e23e1[_0xf0db('0x30')][_0xf0db('0x40')]){_0x4217d8[_0xf0db('0x41')]=[{'all':!![]}];}return db[_0xf0db('0x29')][_0xf0db('0x42')](_0x4217d8);})['then'](function(_0x25996d){_0x8a8c07['rows']=_0x25996d;return _0x8a8c07;})[_0xf0db('0x23')](respondWithFilteredResult(_0x18eac2,_0x4217d8))[_0xf0db('0x43')](handleError(_0x18eac2,null));};exports[_0xf0db('0x44')]=function(_0x5b7f9f,_0x550016){var _0x153b64={'raw':!![],'where':{'id':_0x5b7f9f[_0xf0db('0x45')]['id']}},_0x198a39={};_0x198a39[_0xf0db('0x2e')]=_[_0xf0db('0x31')](db['CmCustomField'][_0xf0db('0x2a')]);_0x198a39['query']=_[_0xf0db('0x31')](_0x5b7f9f[_0xf0db('0x30')]);_0x198a39[_0xf0db('0x32')]=_[_0xf0db('0x33')](_0x198a39[_0xf0db('0x2e')],_0x198a39[_0xf0db('0x30')]);_0x153b64[_0xf0db('0x34')]=_[_0xf0db('0x33')](_0x198a39[_0xf0db('0x2e')],qs[_0xf0db('0x35')](_0x5b7f9f['query'][_0xf0db('0x35')]));_0x153b64[_0xf0db('0x34')]=_0x153b64[_0xf0db('0x34')]['length']?_0x153b64['attributes']:_0x198a39['model'];if(_0x5b7f9f[_0xf0db('0x30')]['includeAll']){_0x153b64[_0xf0db('0x41')]=[{'all':!![]}];}_0x153b64=_[_0xf0db('0x3d')]({},_0x153b64,_0x5b7f9f[_0xf0db('0x3f')]);return db[_0xf0db('0x29')][_0xf0db('0x46')](_0x153b64)[_0xf0db('0x23')](handleEntityNotFound(_0x550016,null))[_0xf0db('0x23')](respondWithResult(_0x550016,null))[_0xf0db('0x43')](handleError(_0x550016,null));};exports['update']=function(_0x35ca40,_0xfac9d9){if(_0x35ca40['body']['id']){delete _0x35ca40[_0xf0db('0x47')]['id'];}return db[_0xf0db('0x29')][_0xf0db('0x46')]({'where':{'id':_0x35ca40[_0xf0db('0x45')]['id']}})[_0xf0db('0x23')](handleEntityNotFound(_0xfac9d9,null))['then'](saveUpdates(_0x35ca40[_0xf0db('0x47')],null))[_0xf0db('0x23')](respondWithResult(_0xfac9d9,null))[_0xf0db('0x43')](handleError(_0xfac9d9,null));};exports['destroy']=function(_0x3c531d,_0x4cd660){return db[_0xf0db('0x29')]['find']({'where':{'id':_0x3c531d[_0xf0db('0x45')]['id']}})[_0xf0db('0x23')](handleEntityNotFound(_0x4cd660,null))[_0xf0db('0x23')](removeEntity(_0x4cd660,null))[_0xf0db('0x43')](handleError(_0x4cd660,null));};exports[_0xf0db('0x48')]=function(_0x238180,_0x5b5121){var _0x10294c;return db['sequelize'][_0xf0db('0x49')](function(_0x54a544){return db[_0xf0db('0x29')][_0xf0db('0x48')](_0x238180['body'],{'transaction':_0x54a544})['then'](function(_0x251fbd){_0x10294c=_0x251fbd;var _0x3f181b={'type':db[_0xf0db('0x4a')][_0xf0db('0x4b')],'transaction':_0x54a544};switch(_0x238180['body'][_0xf0db('0x2c')]){case _0xf0db('0x4c'):_0x3f181b['type']=db[_0xf0db('0x4a')][_0xf0db('0x4b')];break;case _0xf0db('0x4d'):_0x3f181b[_0xf0db('0x2c')]=db[_0xf0db('0x4a')][_0xf0db('0x4e')];break;case _0xf0db('0x4f'):_0x3f181b['type']=db[_0xf0db('0x4a')][_0xf0db('0x50')];_0x3f181b[_0xf0db('0x51')]=![];break;default:}return db['sequelize'][_0xf0db('0x52')][_0xf0db('0x53')](_0xf0db('0x54'),util[_0xf0db('0x55')](_0xf0db('0x56'),_0x10294c['id']),_0x3f181b);})[_0xf0db('0x23')](function(){return _0x10294c;});})[_0xf0db('0x23')](respondWithResult(_0x5b5121,0xc9))[_0xf0db('0x43')](handleError(_0x5b5121,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 1049d54..3b83d60 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 _0x116c=['lodash','util','../../config/logger','api','rimraf','../../config/environment','./cmCustomField.attributes','exports','CmCustomField'];(function(_0x5458fe,_0x487e4d){var _0x54458f=function(_0x370490){while(--_0x370490){_0x5458fe['push'](_0x5458fe['shift']());}};_0x54458f(++_0x487e4d);}(_0x116c,0xfc));var _0xc116=function(_0x5d3651,_0x4b6349){_0x5d3651=_0x5d3651-0x0;var _0x458c73=_0x116c[_0x5d3651];return _0x458c73;};'use strict';var _=require(_0xc116('0x0'));var util=require(_0xc116('0x1'));var logger=require(_0xc116('0x2'))(_0xc116('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(_0xc116('0x4'));var config=require(_0xc116('0x5'));var attributes=require(_0xc116('0x6'));module[_0xc116('0x7')]=function(_0x245059,_0x4a48a6){return _0x245059['define'](_0xc116('0x8'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b9c=['rimraf','./cmCustomField.attributes','exports','define','cm_custom_fields','api','moment','request-promise'];(function(_0x3a1f7b,_0x376f6a){var _0x2156a4=function(_0x13acd9){while(--_0x13acd9){_0x3a1f7b['push'](_0x3a1f7b['shift']());}};_0x2156a4(++_0x376f6a);}(_0x5b9c,0x1ad));var _0xc5b9=function(_0x4c06f7,_0x5642c7){_0x4c06f7=_0x4c06f7-0x0;var _0x129ac9=_0x5b9c[_0x4c06f7];return _0x129ac9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc5b9('0x0'));var moment=require(_0xc5b9('0x1'));var BPromise=require('bluebird');var rp=require(_0xc5b9('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc5b9('0x3'));var config=require('../../config/environment');var attributes=require(_0xc5b9('0x4'));module[_0xc5b9('0x5')]=function(_0x38166c,_0x684fa9){return _0x38166c[_0xc5b9('0x6')]('CmCustomField',attributes,{'tableName':_0xc5b9('0x7'),'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 cbc215d..7083d69 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 _0x0a9a=['CmCustomField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x21ba39,_0x413046){var _0x7a1e4f=function(_0x734831){while(--_0x734831){_0x21ba39['push'](_0x21ba39['shift']());}};_0x7a1e4f(++_0x413046);}(_0x0a9a,0x183));var _0xa0a9=function(_0x249dfc,_0x3d8be9){_0x249dfc=_0x249dfc-0x0;var _0x3b2907=_0x0a9a[_0x249dfc];return _0x3b2907;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('CmCustomField,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('CmCustomField,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});} \ No newline at end of file +var _0x6737=['stringify','error','code','message','info','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1c56be,_0x2564b1){var _0x2d1e98=function(_0x35d3d1){while(--_0x35d3d1){_0x1c56be['push'](_0x1c56be['shift']());}};_0x2d1e98(++_0x2564b1);}(_0x6737,0xe2));var _0x7673=function(_0x249693,_0x3c22b2){_0x249693=_0x249693-0x0;var _0x2af704=_0x6737[_0x249693];return _0x2af704;};'use strict';var _=require('lodash');var util=require(_0x7673('0x0'));var moment=require(_0x7673('0x1'));var BPromise=require('bluebird');var rs=require(_0x7673('0x2'));var fs=require('fs');var Redis=require(_0x7673('0x3'));var db=require(_0x7673('0x4'))['db'];var utils=require(_0x7673('0x5'));var logger=require('../../config/logger')(_0x7673('0x6'));var config=require(_0x7673('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7673('0x8')][_0x7673('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5af802,_0x4e4b24,_0x53d67d){return new BPromise(function(_0x5292f7,_0x285c6d){return client['request'](_0x5af802,_0x53d67d)[_0x7673('0xa')](function(_0x1fb769){logger['info'](_0x7673('0xb'),_0x4e4b24,_0x7673('0xc'));logger[_0x7673('0xd')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x4e4b24,'request\x20sent',JSON[_0x7673('0xe')](_0x1fb769));if(_0x1fb769['error']){if(_0x1fb769[_0x7673('0xf')][_0x7673('0x10')]===0x1f4){logger[_0x7673('0xf')](_0x7673('0xb'),_0x4e4b24,_0x1fb769[_0x7673('0xf')][_0x7673('0x11')]);return _0x285c6d(_0x1fb769[_0x7673('0xf')][_0x7673('0x11')]);}logger[_0x7673('0xf')](_0x7673('0xb'),_0x4e4b24,_0x1fb769['error'][_0x7673('0x11')]);return _0x5292f7(_0x1fb769[_0x7673('0xf')][_0x7673('0x11')]);}else{logger[_0x7673('0x12')](_0x7673('0xb'),_0x4e4b24,_0x7673('0xc'));_0x5292f7(_0x1fb769[_0x7673('0x13')]['message']);}})['catch'](function(_0x164d05){logger[_0x7673('0xf')]('CmCustomField,\x20%s,\x20%s',_0x4e4b24,_0x164d05);_0x285c6d(_0x164d05);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 5b7d559..202754e 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 _0xd5b0=['create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','post'];(function(_0x2db9ab,_0x37a475){var _0x87dde3=function(_0x4f2cd2){while(--_0x4f2cd2){_0x2db9ab['push'](_0x2db9ab['shift']());}};_0x87dde3(++_0x37a475);}(_0xd5b0,0x16e));var _0x0d5b=function(_0x3583d5,_0x378d6f){_0x3583d5=_0x3583d5-0x0;var _0x5c4786=_0xd5b0[_0x3583d5];return _0x5c4786;};'use strict';var multer=require(_0x0d5b('0x0'));var util=require(_0x0d5b('0x1'));var path=require(_0x0d5b('0x2'));var timeout=require(_0x0d5b('0x3'));var express=require('express');var router=express[_0x0d5b('0x4')]();var auth=require(_0x0d5b('0x5'));var interaction=require(_0x0d5b('0x6'));var config=require(_0x0d5b('0x7'));var controller=require(_0x0d5b('0x8'));router[_0x0d5b('0x9')]('/',auth[_0x0d5b('0xa')](),controller[_0x0d5b('0xb')]);router[_0x0d5b('0x9')](_0x0d5b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0d5b('0xd')]('/',auth[_0x0d5b('0xa')](),controller[_0x0d5b('0xe')]);router[_0x0d5b('0xf')](_0x0d5b('0xc'),auth[_0x0d5b('0xa')](),controller[_0x0d5b('0x10')]);router['delete'](_0x0d5b('0xc'),auth['isAuthenticated'](),controller[_0x0d5b('0x11')]);module[_0x0d5b('0x12')]=router; \ No newline at end of file +var _0x3eea=['index','/:id','post','create','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0x3eea,0x1bd));var _0xa3ee=function(_0x2174b3,_0x428f53){_0x2174b3=_0x2174b3-0x0;var _0x57370e=_0x3eea[_0x2174b3];return _0x57370e;};'use strict';var multer=require(_0xa3ee('0x0'));var util=require(_0xa3ee('0x1'));var path=require(_0xa3ee('0x2'));var timeout=require('connect-timeout');var express=require(_0xa3ee('0x3'));var router=express[_0xa3ee('0x4')]();var auth=require(_0xa3ee('0x5'));var interaction=require(_0xa3ee('0x6'));var config=require(_0xa3ee('0x7'));var controller=require(_0xa3ee('0x8'));router[_0xa3ee('0x9')]('/',auth[_0xa3ee('0xa')](),controller[_0xa3ee('0xb')]);router[_0xa3ee('0x9')](_0xa3ee('0xc'),auth[_0xa3ee('0xa')](),controller['show']);router[_0xa3ee('0xd')]('/',auth[_0xa3ee('0xa')](),controller[_0xa3ee('0xe')]);router[_0xa3ee('0xf')](_0xa3ee('0xc'),auth['isAuthenticated'](),controller[_0xa3ee('0x10')]);router[_0xa3ee('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa3ee('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 7f9d612..07ce360 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 _0x25fa=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','BOOLEAN','contactListQueue','moment','exports','STRING','DATE','format'];(function(_0x18e52b,_0x1fae35){var _0x3d3062=function(_0x133b14){while(--_0x133b14){_0x18e52b['push'](_0x18e52b['shift']());}};_0x3d3062(++_0x1fae35);}(_0x25fa,0x109));var _0xa25f=function(_0x163545,_0x521b43){_0x163545=_0x163545-0x0;var _0xf5657=_0x25fa[_0x163545];return _0xf5657;};'use strict';var moment=require(_0xa25f('0x0'));var Sequelize=require('sequelize');module[_0xa25f('0x1')]={'phone':{'type':Sequelize[_0xa25f('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa25f('0x3')],'defaultValue':moment()[_0xa25f('0x4')](_0xa25f('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa25f('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa25f('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa25f('0x3')]},'priority':{'type':Sequelize[_0xa25f('0x6')](0x2)[_0xa25f('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xa25f('0x8')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa25f('0x6')],'unique':_0xa25f('0x9')},'ListId':{'type':Sequelize[_0xa25f('0x6')],'unique':_0xa25f('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xa25f('0x6')],'unique':_0xa25f('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xa25f('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa25f('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa25f('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa25f('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7c09=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','sequelize','exports','BOOLEAN'];(function(_0x8e9597,_0x2aa555){var _0x3be06a=function(_0x7a8e7a){while(--_0x7a8e7a){_0x8e9597['push'](_0x8e9597['shift']());}};_0x3be06a(++_0x2aa555);}(_0x7c09,0x102));var _0x97c0=function(_0x29ac91,_0x3a726d){_0x29ac91=_0x29ac91-0x0;var _0x159849=_0x7c09[_0x29ac91];return _0x159849;};'use strict';var moment=require('moment');var Sequelize=require(_0x97c0('0x0'));module[_0x97c0('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x97c0('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x97c0('0x3')],'defaultValue':moment()[_0x97c0('0x4')](_0x97c0('0x5'))},'countbusyretry':{'type':Sequelize[_0x97c0('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x97c0('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x97c0('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x97c0('0x6')](0x2)[_0x97c0('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x97c0('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x97c0('0x6')],'unique':_0x97c0('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x97c0('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x97c0('0x6')],'unique':_0x97c0('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x97c0('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x97c0('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x97c0('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x97c0('0x6')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 6f276f8..d428e2b 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 _0x9780=['isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','sequelize','literal','findOne','scheduledat','LOCK','Contact','CmCompany','Company','CmList','dialActive','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','CmHopper','rawAttributes','type','model','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','user','UserId','format','calleridnum','phone','queue','ivr','ContactId','firstName','isNil','calleridname','lastName','finally','getPreview','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev'];(function(_0x420a7c,_0x3ef0bc){var _0x311c52=function(_0x217b82){while(--_0x217b82){_0x420a7c['push'](_0x420a7c['shift']());}};_0x311c52(++_0x3ef0bc);}(_0x9780,0x1d4));var _0x0978=function(_0x23f4cc,_0x4b6d1a){_0x23f4cc=_0x23f4cc-0x0;var _0x8d3d1a=_0x9780[_0x23f4cc];return _0x8d3d1a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x0978('0x0'));var zipdir=require(_0x0978('0x1'));var jsonpatch=require(_0x0978('0x2'));var rp=require(_0x0978('0x3'));var moment=require(_0x0978('0x4'));var BPromise=require(_0x0978('0x5'));var Mustache=require(_0x0978('0x6'));var util=require(_0x0978('0x7'));var path=require(_0x0978('0x8'));var sox=require(_0x0978('0x9'));var csv=require(_0x0978('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0978('0xb'));var squel=require(_0x0978('0xc'));var crypto=require(_0x0978('0xd'));var jsforce=require(_0x0978('0xe'));var deskjs=require(_0x0978('0xf'));var toCsv=require(_0x0978('0xa'));var querystring=require(_0x0978('0x10'));var Papa=require(_0x0978('0x11'));var Redis=require(_0x0978('0x12'));var authService=require(_0x0978('0x13'));var qs=require(_0x0978('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0978('0x15'));var logger=require('../../config/logger')(_0x0978('0x16'));var utils=require(_0x0978('0x17'));var config=require(_0x0978('0x18'));var licenseUtil=require(_0x0978('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3db101,_0x4cb5f5){_0x4cb5f5=_0x4cb5f5||0xcc;return function(_0x3cc5e6){if(_0x3cc5e6){return _0x3db101[_0x0978('0x1a')](_0x4cb5f5);}return _0x3db101[_0x0978('0x1b')](_0x4cb5f5)[_0x0978('0x1c')]();};}function respondWithResult(_0x155a71,_0xe18785){_0xe18785=_0xe18785||0xc8;return function(_0x1fc724){if(_0x1fc724){return _0x155a71[_0x0978('0x1b')](_0xe18785)['json'](_0x1fc724);}};}function respondWithFilteredResult(_0x28d1b8,_0x2177e0){return function(_0x1fe6a9){if(_0x1fe6a9){var _0x20e9ab=_0x1fe6a9[_0x0978('0x1d')],_0x3024e1=_0x2177e0[_0x0978('0x1e')],_0x20a78d=_0x2177e0['offset']+_0x2177e0[_0x0978('0x1f')],_0xb41163;if(_0x20a78d>=_0x20e9ab){_0x20a78d=_0x20e9ab;_0xb41163=0xc8;}else{_0xb41163=0xce;}_0x28d1b8[_0x0978('0x1b')](_0xb41163);return _0x28d1b8[_0x0978('0x20')](_0x0978('0x21'),_0x3024e1+'-'+_0x20a78d+'/'+_0x20e9ab)[_0x0978('0x22')](_0x1fe6a9);}return null;};}function patchUpdates(_0x397ccd){return function(_0x1cdd40){try{jsonpatch[_0x0978('0x23')](_0x1cdd40,_0x397ccd,!![]);}catch(_0x3003ab){return BPromise['reject'](_0x3003ab);}return _0x1cdd40[_0x0978('0x24')]();};}function saveUpdates(_0xad6a1d,_0x346ffc){return function(_0x57a4e7){if(_0x57a4e7){return _0x57a4e7[_0x0978('0x25')](_0xad6a1d)[_0x0978('0x26')](function(_0x376124){return _0x376124;});}return null;};}function removeEntity(_0x5b6558,_0x1c97a9){return function(_0x5b3c5c){if(_0x5b3c5c){return _0x5b3c5c[_0x0978('0x27')]()['then'](function(){_0x5b6558[_0x0978('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a968d,_0x58e40d){return function(_0x39c5aa){if(!_0x39c5aa){_0x1a968d['sendStatus'](0x194);}return _0x39c5aa;};}function handleError(_0x584da0,_0x369a39){_0x369a39=_0x369a39||0x1f4;return function(_0x45d953){logger[_0x0978('0x28')](_0x45d953[_0x0978('0x29')]);if(_0x45d953[_0x0978('0x2a')]){delete _0x45d953[_0x0978('0x2a')];}_0x584da0[_0x0978('0x1b')](_0x369a39)[_0x0978('0x2b')](_0x45d953);};}exports[_0x0978('0x2c')]=function(_0x29c9aa,_0x30e7ec){var _0x46c522={},_0x44422c={},_0x1c1e6b={'count':0x0,'rows':[]};var _0xd49f71=_[_0x0978('0x2d')](db[_0x0978('0x2e')][_0x0978('0x2f')],function(_0x111966){return{'name':_0x111966['fieldName'],'type':_0x111966[_0x0978('0x30')]['key']};});_0x44422c[_0x0978('0x31')]=_[_0x0978('0x2d')](_0xd49f71,_0x0978('0x2a'));_0x44422c[_0x0978('0x32')]=_[_0x0978('0x33')](_0x29c9aa[_0x0978('0x32')]);_0x44422c[_0x0978('0x34')]=_[_0x0978('0x35')](_0x44422c[_0x0978('0x31')],_0x44422c[_0x0978('0x32')]);_0x44422c[_0x0978('0x34')]=_[_0x0978('0x36')](_0x44422c[_0x0978('0x34')],[_0x0978('0x37'),_0x0978('0x38'),_0x0978('0x39'),_0x0978('0x3a'),_0x0978('0x3b'),'$lte',_0x0978('0x3c'),_0x0978('0x3d'),_0x0978('0x3e'),_0x0978('0x3f'),_0x0978('0x40'),'$in',_0x0978('0x41'),_0x0978('0x42'),_0x0978('0x43'),_0x0978('0x44'),'$notILike','$like',_0x0978('0x45'),_0x0978('0x46'),_0x0978('0x47'),'$any']);_0x46c522[_0x0978('0x48')]=_[_0x0978('0x35')](_0x44422c[_0x0978('0x31')],qs[_0x0978('0x49')](_0x29c9aa['query'][_0x0978('0x49')]));_0x46c522['attributes']=_0x46c522[_0x0978('0x48')][_0x0978('0x4a')]?_0x46c522[_0x0978('0x48')]:_0x44422c[_0x0978('0x31')];if(!_0x29c9aa[_0x0978('0x32')][_0x0978('0x4b')](_0x0978('0x4c'))){_0x46c522['limit']=qs[_0x0978('0x1f')](_0x29c9aa[_0x0978('0x32')][_0x0978('0x1f')]);_0x46c522['offset']=qs[_0x0978('0x1e')](_0x29c9aa[_0x0978('0x32')][_0x0978('0x1e')]);}_0x46c522[_0x0978('0x4d')]=qs['sort'](_0x29c9aa['query'][_0x0978('0x4e')]);_0x46c522['where']=qs[_0x0978('0x34')](_[_0x0978('0x4f')](_0x29c9aa[_0x0978('0x32')],_0x44422c[_0x0978('0x34')]),_0xd49f71);if(_0x29c9aa[_0x0978('0x32')][_0x0978('0x50')]){_0x46c522['where']=_['merge'](_0x46c522['where'],{'$or':_[_0x0978('0x2d')](_0xd49f71,function(_0x54a4e5){if(_0x54a4e5[_0x0978('0x30')]!=='VIRTUAL'){var _0x2aa418={};_0x2aa418[_0x54a4e5['name']]={'$like':'%'+_0x29c9aa[_0x0978('0x32')]['filter']+'%'};return _0x2aa418;}})});}_0x46c522=_[_0x0978('0x51')]({},_0x46c522,_0x29c9aa[_0x0978('0x52')]);var _0x41e104={'where':_0x46c522['where']};return db['CmHopper']['count'](_0x41e104)[_0x0978('0x26')](function(_0x228fae){_0x1c1e6b[_0x0978('0x1d')]=_0x228fae;if(_0x29c9aa['query'][_0x0978('0x53')]){_0x46c522[_0x0978('0x54')]=[{'all':!![]}];}return db[_0x0978('0x2e')][_0x0978('0x55')](_0x46c522);})[_0x0978('0x26')](function(_0x1d4bca){_0x1c1e6b['rows']=_0x1d4bca;return _0x1c1e6b;})[_0x0978('0x26')](respondWithFilteredResult(_0x30e7ec,_0x46c522))[_0x0978('0x56')](handleError(_0x30e7ec,null));};exports[_0x0978('0x57')]=function(_0x371230,_0xbbae33){var _0x53181d={'raw':!![],'where':{'id':_0x371230[_0x0978('0x58')]['id']}},_0x167aa4={};_0x167aa4['model']=_[_0x0978('0x33')](db[_0x0978('0x2e')][_0x0978('0x2f')]);_0x167aa4[_0x0978('0x32')]=_['keys'](_0x371230[_0x0978('0x32')]);_0x167aa4[_0x0978('0x34')]=_[_0x0978('0x35')](_0x167aa4['model'],_0x167aa4[_0x0978('0x32')]);_0x53181d['attributes']=_[_0x0978('0x35')](_0x167aa4[_0x0978('0x31')],qs[_0x0978('0x49')](_0x371230[_0x0978('0x32')]['fields']));_0x53181d['attributes']=_0x53181d[_0x0978('0x48')][_0x0978('0x4a')]?_0x53181d[_0x0978('0x48')]:_0x167aa4[_0x0978('0x31')];if(_0x371230[_0x0978('0x32')][_0x0978('0x53')]){_0x53181d[_0x0978('0x54')]=[{'all':!![]}];}_0x53181d=_[_0x0978('0x51')]({},_0x53181d,_0x371230[_0x0978('0x52')]);return db[_0x0978('0x2e')][_0x0978('0x59')](_0x53181d)['then'](handleEntityNotFound(_0xbbae33,null))[_0x0978('0x26')](respondWithResult(_0xbbae33,null))[_0x0978('0x56')](handleError(_0xbbae33,null));};exports[_0x0978('0x5a')]=function(_0x53b043,_0x15bcbf){return db[_0x0978('0x2e')]['create'](_0x53b043['body'],{})['then'](respondWithResult(_0x15bcbf,0xc9))[_0x0978('0x56')](handleError(_0x15bcbf,null));};exports['update']=function(_0x177080,_0x6bef28){if(_0x177080[_0x0978('0x5b')]['id']){delete _0x177080[_0x0978('0x5b')]['id'];}return db[_0x0978('0x2e')][_0x0978('0x59')]({'where':{'id':_0x177080['params']['id']}})[_0x0978('0x26')](handleEntityNotFound(_0x6bef28,null))['then'](saveUpdates(_0x177080[_0x0978('0x5b')],null))[_0x0978('0x26')](respondWithResult(_0x6bef28,null))['catch'](handleError(_0x6bef28,null));};exports[_0x0978('0x5c')]=function(_0x40548d,_0x51abe0){return db[_0x0978('0x2e')]['describe']()[_0x0978('0x26')](respondWithResult(_0x51abe0,null))[_0x0978('0x56')](handleError(_0x51abe0,null));};exports[_0x0978('0x27')]=function(_0x2e3317,_0x5cb364){var _0x12d647;return db[_0x0978('0x2e')][_0x0978('0x59')]({'where':{'id':_0x2e3317[_0x0978('0x58')]['id']}})[_0x0978('0x26')](handleEntityNotFound(_0x5cb364,null))['then'](function(_0xc25bda){if(_0xc25bda){return _0xc25bda[_0x0978('0x27')]()[_0x0978('0x26')](function(_0x59441f){return _0x59441f;});}})['then'](function(_0x56471d){_0x12d647=_0x56471d;if(_0x56471d){if(_0x56471d[_0x0978('0x5d')]||_0x56471d[_0x0978('0x5e')]){return db[_0x56471d[_0x0978('0x5d')]?_0x0978('0x5f'):_0x0978('0x60')]['find']({'where':{'id':_0x56471d['VoiceQueueId']?_0x56471d['VoiceQueueId']:_0x56471d[_0x0978('0x5e')]},'attributes':['id',_0x0978('0x2a')],'raw':!![]});}}})[_0x0978('0x26')](function(_0x464690){var _0x4e2996={};if(_0x464690){_[_0x0978('0x51')](_0x4e2996,_[_0x0978('0x61')](_0x12d647[_0x0978('0x62')],[_0x0978('0x63'),_0x0978('0x64'),'id']));_0x4e2996[_0x0978('0x65')]=0x15;_0x4e2996[_0x0978('0x66')]=_0x0978('0x67');_0x4e2996[_0x0978('0x68')]=_0x464690['name'];_0x4e2996['membername']=_0x2e3317[_0x0978('0x69')][_0x0978('0x2a')];_0x4e2996[_0x0978('0x6a')]=_0x2e3317[_0x0978('0x69')]['id'];_0x4e2996['deleted']=!![];_0x4e2996['deletedat']=moment()[_0x0978('0x6b')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e2996[_0x0978('0x6c')]=_0x12d647[_0x0978('0x6d')];_0x4e2996['campaigntype']=_0x12d647['VoiceQueueId']?_0x0978('0x6e'):_0x0978('0x6f');return db['CmContact']['find']({'where':{'id':_0x4e2996[_0x0978('0x70')]},'attributes':[_0x0978('0x71'),'lastName']})[_0x0978('0x26')](function(_0x188e96){if(!_[_0x0978('0x72')](_0x5cb364)&&!_[_0x0978('0x72')](_0x188e96[_0x0978('0x71')])){_0x4e2996[_0x0978('0x73')]=_0x188e96[_0x0978('0x71')];if(!_[_0x0978('0x72')](_0x188e96[_0x0978('0x74')])){_0x4e2996[_0x0978('0x73')]+='\x20'+_0x188e96[_0x0978('0x74')];}}})[_0x0978('0x75')](function(){return db['CmHopperFinal'][_0x0978('0x5a')](_0x4e2996);});}})[_0x0978('0x26')](function(){return _0x5cb364[_0x0978('0x1b')](0xcc)[_0x0978('0x1c')]();})[_0x0978('0x56')](handleError(_0x5cb364,null));};exports[_0x0978('0x76')]=function(_0x6ce090,_0x2e95f1,_0xfa62a0){var _0x23c72c=[];return db[_0x0978('0x77')]['describe']()[_0x0978('0x26')](function(_0x46aafe){_0x23c72c=_[_0x0978('0x33')](_0x46aafe);return _0x6ce090[_0x0978('0x69')][_0x0978('0x78')]({'where':{'type':_0x0978('0x79'),'dialActive':!![],'dialMethod':_0x0978('0x7a')},'attributes':['id',_0x0978('0x7b')],'raw':!![]});})[_0x0978('0x26')](function(_0xaeb80c){if(_0xaeb80c&&_0xaeb80c[_0x0978('0x4a')]){return db['sequelize'][_0x0978('0x7c')](function(_0x157809){var _0x5b6ef8={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x0978('0x7d'))},'VoiceQueueId':{'$in':_[_0x0978('0x2d')](_0xaeb80c,'id')},'$or':[{'UserId':null},{'UserId':_0x6ce090[_0x0978('0x69')]['id']}]};var _0x39aad6=[];if(_0x6ce090[_0x0978('0x5b')][_0x0978('0x7e')]&&_0x6ce090['body'][_0x0978('0x7e')]===_0x0978('0x7f')){if(!_[_0x0978('0x80')](_0x6ce090['body'][_0x0978('0x81')])){_0x5b6ef8['id']={'$in':_0x6ce090['body'][_0x0978('0x81')]};}_0x39aad6=[[_0x0978('0x82'),_0x0978('0x83')],[_0x0978('0x84'),_0xaeb80c[0x0][_0x0978('0x7b')]===_0x0978('0x83')?_0x0978('0x85'):_0x0978('0x83')],db['sequelize']['literal'](_0x0978('0x86')),['id',_0x0978('0x85')]];}else{if(!_['isEmpty'](_0x6ce090[_0x0978('0x5b')][_0x0978('0x81')])){_0x5b6ef8['id']={'$notIn':_0x6ce090[_0x0978('0x5b')][_0x0978('0x81')]};}_0x39aad6=[['priority','DESC'],[_0x0978('0x84'),_0xaeb80c[0x0][_0x0978('0x7b')]],db[_0x0978('0x87')][_0x0978('0x88')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x0978('0x83')]];}return db[_0x0978('0x2e')][_0x0978('0x89')]({'attributes':['id',_0x0978('0x8a')],'where':_0x5b6ef8,'order':_0x39aad6,'transaction':_0x157809,'lock':_0x157809[_0x0978('0x8b')]['UPDATE'],'include':[{'model':db[_0x0978('0x77')],'as':_0x0978('0x8c'),'attributes':_0x23c72c,'include':[{'model':db[_0x0978('0x8d')],'as':_0x0978('0x8e'),'attributes':['id','name']}]},{'model':db[_0x0978('0x8f')],'as':'List','attributes':['id','name']},{'model':db[_0x0978('0x5f')],'as':'Queue','attributes':['id',_0x0978('0x2a'),_0x0978('0x90')]}]})[_0x0978('0x26')](function(_0x53d138){if(_0x53d138){return _0x53d138[_0x0978('0x25')]({'UserId':_0x6ce090[_0x0978('0x69')]['id']},{'transaction':_0x157809});}});});}})[_0x0978('0x26')](handleEntityNotFound(_0x2e95f1,null))[_0x0978('0x26')](respondWithResult(_0x2e95f1,null))[_0x0978('0x56')](handleError(_0x2e95f1,null));};exports['getOpenContacts']=function(_0x3a20a1,_0x5bfcd9,_0x266b21){return _0x3a20a1[_0x0978('0x69')][_0x0978('0x78')]({'where':{'type':_0x0978('0x79'),'dialActive':!![],'dialMethod':_0x0978('0x7a')},'attributes':['id'],'raw':!![]})[_0x0978('0x26')](function(_0x2d4470){if(_0x2d4470&&_0x2d4470[_0x0978('0x4a')]){return db[_0x0978('0x2e')][_0x0978('0x1d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0978('0x6b')](_0x0978('0x7d'))},'VoiceQueueId':{'$in':_[_0x0978('0x2d')](_0x2d4470,'id')},'$or':[{'UserId':null},{'UserId':_0x3a20a1[_0x0978('0x69')]['id']}]}});}return 0x0;})[_0x0978('0x26')](function(_0x3f762c){if(!_[_0x0978('0x72')](_0x3f762c)&&_[_0x0978('0x91')](_0x3f762c)){return _0x5bfcd9[_0x0978('0x1b')](0xc8)[_0x0978('0x22')]({'contacts':_0x3f762c});}else{logger[_0x0978('0x28')](_0x0978('0x92'),_0x0978('0x93'),0x194,_0x0978('0x94'));_0x5bfcd9['sendStatus'](0x194);}})['catch'](handleError(_0x5bfcd9,null));}; \ No newline at end of file +var _0xefe3=['apply','reject','save','then','error','stack','name','index','map','CmHopper','fieldName','type','query','keys','filters','intersection','concat','$and','$gt','$ne','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','createdAt','state','statedesc','deleted','campaign','user','UserId','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','ivr','CmContact','firstName','isNil','lastName','finally','CmHopperFinal','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','format','direction','prev','priority','ASC','scheduledAt','DESC','isEmpty','hopperIds','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','List','Queue','dialActive','update','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','html-pdf','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range'];(function(_0x356127,_0x4873ac){var _0x5d4c75=function(_0x4fe60c){while(--_0x4fe60c){_0x356127['push'](_0x356127['shift']());}};_0x5d4c75(++_0x4873ac);}(_0xefe3,0xf5));var _0x3efe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xefe3[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x3efe('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3efe('0x1'));var rp=require(_0x3efe('0x2'));var moment=require(_0x3efe('0x3'));var BPromise=require(_0x3efe('0x4'));var Mustache=require('mustache');var util=require(_0x3efe('0x5'));var path=require('path');var sox=require(_0x3efe('0x6'));var csv=require('to-csv');var ejs=require(_0x3efe('0x7'));var fs=require('fs');var _=require(_0x3efe('0x8'));var squel=require(_0x3efe('0x9'));var crypto=require(_0x3efe('0xa'));var jsforce=require(_0x3efe('0xb'));var deskjs=require(_0x3efe('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3efe('0xd'));var Papa=require('papaparse');var Redis=require(_0x3efe('0xe'));var authService=require(_0x3efe('0xf'));var qs=require(_0x3efe('0x10'));var as=require(_0x3efe('0x11'));var hardwareService=require(_0x3efe('0x12'));var logger=require(_0x3efe('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x3efe('0x14'));var licenseUtil=require(_0x3efe('0x15'));var db=require(_0x3efe('0x16'))['db'];function respondWithStatusCode(_0x3ad584,_0x11b9b4){_0x11b9b4=_0x11b9b4||0xcc;return function(_0x3778ec){if(_0x3778ec){return _0x3ad584[_0x3efe('0x17')](_0x11b9b4);}return _0x3ad584[_0x3efe('0x18')](_0x11b9b4)[_0x3efe('0x19')]();};}function respondWithResult(_0x44bdbf,_0x2dd99f){_0x2dd99f=_0x2dd99f||0xc8;return function(_0x49f4ff){if(_0x49f4ff){return _0x44bdbf[_0x3efe('0x18')](_0x2dd99f)[_0x3efe('0x1a')](_0x49f4ff);}};}function respondWithFilteredResult(_0x1e1ce9,_0x230785){return function(_0x4a3d0d){if(_0x4a3d0d){var _0x219ecf=_0x4a3d0d['count'],_0x13730a=_0x230785[_0x3efe('0x1b')],_0x18b4c2=_0x230785[_0x3efe('0x1b')]+_0x230785[_0x3efe('0x1c')],_0x515e1b;if(_0x18b4c2>=_0x219ecf){_0x18b4c2=_0x219ecf;_0x515e1b=0xc8;}else{_0x515e1b=0xce;}_0x1e1ce9[_0x3efe('0x18')](_0x515e1b);return _0x1e1ce9[_0x3efe('0x1d')](_0x3efe('0x1e'),_0x13730a+'-'+_0x18b4c2+'/'+_0x219ecf)['json'](_0x4a3d0d);}return null;};}function patchUpdates(_0x21abe1){return function(_0x30b3fb){try{jsonpatch[_0x3efe('0x1f')](_0x30b3fb,_0x21abe1,!![]);}catch(_0x182a6f){return BPromise[_0x3efe('0x20')](_0x182a6f);}return _0x30b3fb[_0x3efe('0x21')]();};}function saveUpdates(_0x41cfcd,_0x2b2c09){return function(_0x34d520){if(_0x34d520){return _0x34d520['update'](_0x41cfcd)[_0x3efe('0x22')](function(_0x3103bb){return _0x3103bb;});}return null;};}function removeEntity(_0x3403ce,_0x3b6464){return function(_0x4a3fdb){if(_0x4a3fdb){return _0x4a3fdb['destroy']()[_0x3efe('0x22')](function(){_0x3403ce[_0x3efe('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c8b1d,_0x2aec5c){return function(_0x8c746e){if(!_0x8c746e){_0x5c8b1d[_0x3efe('0x17')](0x194);}return _0x8c746e;};}function handleError(_0x252c27,_0x394716){_0x394716=_0x394716||0x1f4;return function(_0x39fc88){logger[_0x3efe('0x23')](_0x39fc88[_0x3efe('0x24')]);if(_0x39fc88[_0x3efe('0x25')]){delete _0x39fc88['name'];}_0x252c27[_0x3efe('0x18')](_0x394716)['send'](_0x39fc88);};}exports[_0x3efe('0x26')]=function(_0x21c15d,_0x5cbe1a){var _0x25bf85={},_0x14908e={},_0x331a83={'count':0x0,'rows':[]};var _0x4cedac=_[_0x3efe('0x27')](db[_0x3efe('0x28')]['rawAttributes'],function(_0x730e5c){return{'name':_0x730e5c[_0x3efe('0x29')],'type':_0x730e5c[_0x3efe('0x2a')]['key']};});_0x14908e['model']=_[_0x3efe('0x27')](_0x4cedac,_0x3efe('0x25'));_0x14908e[_0x3efe('0x2b')]=_[_0x3efe('0x2c')](_0x21c15d[_0x3efe('0x2b')]);_0x14908e[_0x3efe('0x2d')]=_[_0x3efe('0x2e')](_0x14908e['model'],_0x14908e[_0x3efe('0x2b')]);_0x14908e['filters']=_[_0x3efe('0x2f')](_0x14908e['filters'],[_0x3efe('0x30'),'$or',_0x3efe('0x31'),'$gte','$lt','$lte',_0x3efe('0x32'),'$eq','$not','$between',_0x3efe('0x33'),_0x3efe('0x34'),'$notIn',_0x3efe('0x35'),_0x3efe('0x36'),_0x3efe('0x37'),_0x3efe('0x38'),_0x3efe('0x35'),_0x3efe('0x39'),_0x3efe('0x3a'),_0x3efe('0x3b'),_0x3efe('0x3c')]);_0x25bf85[_0x3efe('0x3d')]=_[_0x3efe('0x2e')](_0x14908e[_0x3efe('0x3e')],qs[_0x3efe('0x3f')](_0x21c15d[_0x3efe('0x2b')][_0x3efe('0x3f')]));_0x25bf85[_0x3efe('0x3d')]=_0x25bf85[_0x3efe('0x3d')][_0x3efe('0x40')]?_0x25bf85[_0x3efe('0x3d')]:_0x14908e[_0x3efe('0x3e')];if(!_0x21c15d['query'][_0x3efe('0x41')](_0x3efe('0x42'))){_0x25bf85['limit']=qs[_0x3efe('0x1c')](_0x21c15d['query'][_0x3efe('0x1c')]);_0x25bf85[_0x3efe('0x1b')]=qs[_0x3efe('0x1b')](_0x21c15d[_0x3efe('0x2b')]['offset']);}_0x25bf85['order']=qs[_0x3efe('0x43')](_0x21c15d['query'][_0x3efe('0x43')]);_0x25bf85[_0x3efe('0x44')]=qs[_0x3efe('0x2d')](_[_0x3efe('0x45')](_0x21c15d[_0x3efe('0x2b')],_0x14908e[_0x3efe('0x2d')]),_0x4cedac);if(_0x21c15d['query'][_0x3efe('0x46')]){_0x25bf85[_0x3efe('0x44')]=_[_0x3efe('0x47')](_0x25bf85[_0x3efe('0x44')],{'$or':_[_0x3efe('0x27')](_0x4cedac,function(_0x2f2580){if(_0x2f2580['type']!==_0x3efe('0x48')){var _0xf2622c={};_0xf2622c[_0x2f2580[_0x3efe('0x25')]]={'$like':'%'+_0x21c15d['query'][_0x3efe('0x46')]+'%'};return _0xf2622c;}})});}_0x25bf85=_[_0x3efe('0x47')]({},_0x25bf85,_0x21c15d['options']);var _0x5e06ee={'where':_0x25bf85['where']};return db[_0x3efe('0x28')][_0x3efe('0x49')](_0x5e06ee)['then'](function(_0x3f5e0d){_0x331a83[_0x3efe('0x49')]=_0x3f5e0d;if(_0x21c15d['query'][_0x3efe('0x4a')]){_0x25bf85['include']=[{'all':!![]}];}return db[_0x3efe('0x28')][_0x3efe('0x4b')](_0x25bf85);})[_0x3efe('0x22')](function(_0x5e6e60){_0x331a83[_0x3efe('0x4c')]=_0x5e6e60;return _0x331a83;})[_0x3efe('0x22')](respondWithFilteredResult(_0x5cbe1a,_0x25bf85))[_0x3efe('0x4d')](handleError(_0x5cbe1a,null));};exports['show']=function(_0x1280bb,_0x38cd15){var _0x51672b={'raw':!![],'where':{'id':_0x1280bb[_0x3efe('0x4e')]['id']}},_0x472b6b={};_0x472b6b[_0x3efe('0x3e')]=_[_0x3efe('0x2c')](db[_0x3efe('0x28')][_0x3efe('0x4f')]);_0x472b6b[_0x3efe('0x2b')]=_[_0x3efe('0x2c')](_0x1280bb[_0x3efe('0x2b')]);_0x472b6b[_0x3efe('0x2d')]=_[_0x3efe('0x2e')](_0x472b6b['model'],_0x472b6b['query']);_0x51672b[_0x3efe('0x3d')]=_[_0x3efe('0x2e')](_0x472b6b[_0x3efe('0x3e')],qs[_0x3efe('0x3f')](_0x1280bb['query'][_0x3efe('0x3f')]));_0x51672b[_0x3efe('0x3d')]=_0x51672b['attributes'][_0x3efe('0x40')]?_0x51672b[_0x3efe('0x3d')]:_0x472b6b[_0x3efe('0x3e')];if(_0x1280bb[_0x3efe('0x2b')]['includeAll']){_0x51672b[_0x3efe('0x50')]=[{'all':!![]}];}_0x51672b=_[_0x3efe('0x47')]({},_0x51672b,_0x1280bb['options']);return db[_0x3efe('0x28')][_0x3efe('0x51')](_0x51672b)[_0x3efe('0x22')](handleEntityNotFound(_0x38cd15,null))[_0x3efe('0x22')](respondWithResult(_0x38cd15,null))[_0x3efe('0x4d')](handleError(_0x38cd15,null));};exports[_0x3efe('0x52')]=function(_0x2a512e,_0x311d68){return db[_0x3efe('0x28')][_0x3efe('0x52')](_0x2a512e['body'],{})['then'](respondWithResult(_0x311d68,0xc9))[_0x3efe('0x4d')](handleError(_0x311d68,null));};exports['update']=function(_0x2f61cd,_0x1bbfd9){if(_0x2f61cd['body']['id']){delete _0x2f61cd[_0x3efe('0x53')]['id'];}return db[_0x3efe('0x28')][_0x3efe('0x51')]({'where':{'id':_0x2f61cd[_0x3efe('0x4e')]['id']}})[_0x3efe('0x22')](handleEntityNotFound(_0x1bbfd9,null))['then'](saveUpdates(_0x2f61cd[_0x3efe('0x53')],null))['then'](respondWithResult(_0x1bbfd9,null))[_0x3efe('0x4d')](handleError(_0x1bbfd9,null));};exports[_0x3efe('0x54')]=function(_0x2a5545,_0xce63d9){return db[_0x3efe('0x28')][_0x3efe('0x54')]()[_0x3efe('0x22')](respondWithResult(_0xce63d9,null))[_0x3efe('0x4d')](handleError(_0xce63d9,null));};exports[_0x3efe('0x55')]=function(_0x411cc8,_0x4dec6e){var _0x2ab7c6;return db['CmHopper'][_0x3efe('0x51')]({'where':{'id':_0x411cc8[_0x3efe('0x4e')]['id']}})[_0x3efe('0x22')](handleEntityNotFound(_0x4dec6e,null))[_0x3efe('0x22')](function(_0x263ba7){if(_0x263ba7){return _0x263ba7[_0x3efe('0x55')]()[_0x3efe('0x22')](function(_0x44b328){return _0x44b328;});}})[_0x3efe('0x22')](function(_0x5d1c76){_0x2ab7c6=_0x5d1c76;if(_0x5d1c76){if(_0x5d1c76[_0x3efe('0x56')]||_0x5d1c76[_0x3efe('0x57')]){return db[_0x5d1c76[_0x3efe('0x56')]?_0x3efe('0x58'):_0x3efe('0x59')][_0x3efe('0x51')]({'where':{'id':_0x5d1c76['VoiceQueueId']?_0x5d1c76[_0x3efe('0x56')]:_0x5d1c76[_0x3efe('0x57')]},'attributes':['id','name'],'raw':!![]});}}})[_0x3efe('0x22')](function(_0x31ccd4){var _0x1e314b={};if(_0x31ccd4){_['merge'](_0x1e314b,_['omit'](_0x2ab7c6['dataValues'],[_0x3efe('0x5a'),'updatedAt','id']));_0x1e314b[_0x3efe('0x5b')]=0x15;_0x1e314b[_0x3efe('0x5c')]=_0x3efe('0x5d');_0x1e314b[_0x3efe('0x5e')]=_0x31ccd4[_0x3efe('0x25')];_0x1e314b['membername']=_0x411cc8[_0x3efe('0x5f')][_0x3efe('0x25')];_0x1e314b[_0x3efe('0x60')]=_0x411cc8[_0x3efe('0x5f')]['id'];_0x1e314b[_0x3efe('0x5d')]=!![];_0x1e314b['deletedat']=moment()['format'](_0x3efe('0x61'));_0x1e314b[_0x3efe('0x62')]=_0x2ab7c6['phone'];_0x1e314b[_0x3efe('0x63')]=_0x2ab7c6['VoiceQueueId']?'queue':_0x3efe('0x64');return db[_0x3efe('0x65')]['find']({'where':{'id':_0x1e314b['ContactId']},'attributes':[_0x3efe('0x66'),'lastName']})[_0x3efe('0x22')](function(_0x4a909c){if(!_[_0x3efe('0x67')](_0x4dec6e)&&!_[_0x3efe('0x67')](_0x4a909c[_0x3efe('0x66')])){_0x1e314b['calleridname']=_0x4a909c[_0x3efe('0x66')];if(!_['isNil'](_0x4a909c['lastName'])){_0x1e314b['calleridname']+='\x20'+_0x4a909c[_0x3efe('0x68')];}}})[_0x3efe('0x69')](function(){return db[_0x3efe('0x6a')][_0x3efe('0x52')](_0x1e314b);});}})[_0x3efe('0x22')](function(){return _0x4dec6e['status'](0xcc)['end']();})['catch'](handleError(_0x4dec6e,null));};exports['getPreview']=function(_0x3cbcd0,_0x16d235,_0x5c45a0){var _0x5b4f86=[];return db['CmContact'][_0x3efe('0x54')]()[_0x3efe('0x22')](function(_0x3da866){_0x5b4f86=_['keys'](_0x3da866);return _0x3cbcd0['user'][_0x3efe('0x6b')]({'where':{'type':_0x3efe('0x6c'),'dialActive':!![],'dialMethod':_0x3efe('0x6d')},'attributes':['id',_0x3efe('0x6e')],'raw':!![]});})[_0x3efe('0x22')](function(_0x3df712){if(_0x3df712&&_0x3df712[_0x3efe('0x40')]){return db[_0x3efe('0x6f')][_0x3efe('0x70')](function(_0x54fd9f){var _0x185da1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3efe('0x71')](_0x3efe('0x61'))},'VoiceQueueId':{'$in':_[_0x3efe('0x27')](_0x3df712,'id')},'$or':[{'UserId':null},{'UserId':_0x3cbcd0[_0x3efe('0x5f')]['id']}]};var _0x146d09=[];if(_0x3cbcd0[_0x3efe('0x53')][_0x3efe('0x72')]&&_0x3cbcd0[_0x3efe('0x53')]['direction']===_0x3efe('0x73')){if(!_['isEmpty'](_0x3cbcd0['body']['hopperIds'])){_0x185da1['id']={'$in':_0x3cbcd0[_0x3efe('0x53')]['hopperIds']};}_0x146d09=[[_0x3efe('0x74'),_0x3efe('0x75')],[_0x3efe('0x76'),_0x3df712[0x0][_0x3efe('0x6e')]==='ASC'?'DESC':'ASC'],db[_0x3efe('0x6f')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x3efe('0x77')]];}else{if(!_[_0x3efe('0x78')](_0x3cbcd0[_0x3efe('0x53')][_0x3efe('0x79')])){_0x185da1['id']={'$notIn':_0x3cbcd0['body'][_0x3efe('0x79')]};}_0x146d09=[[_0x3efe('0x74'),'DESC'],['scheduledAt',_0x3df712[0x0][_0x3efe('0x6e')]],db[_0x3efe('0x6f')][_0x3efe('0x7a')](_0x3efe('0x7b')),['id',_0x3efe('0x75')]];}return db[_0x3efe('0x28')]['findOne']({'attributes':['id',_0x3efe('0x7c')],'where':_0x185da1,'order':_0x146d09,'transaction':_0x54fd9f,'lock':_0x54fd9f[_0x3efe('0x7d')][_0x3efe('0x7e')],'include':[{'model':db[_0x3efe('0x65')],'as':_0x3efe('0x7f'),'attributes':_0x5b4f86,'include':[{'model':db[_0x3efe('0x80')],'as':_0x3efe('0x81'),'attributes':['id',_0x3efe('0x25')]}]},{'model':db['CmList'],'as':_0x3efe('0x82'),'attributes':['id',_0x3efe('0x25')]},{'model':db[_0x3efe('0x58')],'as':_0x3efe('0x83'),'attributes':['id','name',_0x3efe('0x84')]}]})[_0x3efe('0x22')](function(_0x4d6883){if(_0x4d6883){return _0x4d6883[_0x3efe('0x85')]({'UserId':_0x3cbcd0[_0x3efe('0x5f')]['id']},{'transaction':_0x54fd9f});}});});}})[_0x3efe('0x22')](handleEntityNotFound(_0x16d235,null))[_0x3efe('0x22')](respondWithResult(_0x16d235,null))[_0x3efe('0x4d')](handleError(_0x16d235,null));};exports['getOpenContacts']=function(_0x2ab0f8,_0x2650cb,_0x15d7b0){return _0x2ab0f8[_0x3efe('0x5f')][_0x3efe('0x6b')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x3efe('0x6d')},'attributes':['id'],'raw':!![]})[_0x3efe('0x22')](function(_0x1a4589){if(_0x1a4589&&_0x1a4589[_0x3efe('0x40')]){return db['CmHopper'][_0x3efe('0x49')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3efe('0x71')](_0x3efe('0x61'))},'VoiceQueueId':{'$in':_['map'](_0x1a4589,'id')},'$or':[{'UserId':null},{'UserId':_0x2ab0f8['user']['id']}]}});}return 0x0;})['then'](function(_0x2019de){if(!_[_0x3efe('0x67')](_0x2019de)&&_[_0x3efe('0x86')](_0x2019de)){return _0x2650cb[_0x3efe('0x18')](0xc8)['json']({'contacts':_0x2019de});}else{logger['error'](_0x3efe('0x87'),_0x3efe('0x88'),0x194,_0x3efe('0x89'));_0x2650cb[_0x3efe('0x17')](0x194);}})['catch'](handleError(_0x2650cb,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index b9a2d18..d320cac 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 _0x3de7=['path','../../config/environment','./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','lodash','../../config/logger','api','moment','request-promise'];(function(_0xa92400,_0x536c4f){var _0x3e5eb5=function(_0x43f8e2){while(--_0x43f8e2){_0xa92400['push'](_0xa92400['shift']());}};_0x3e5eb5(++_0x536c4f);}(_0x3de7,0x174));var _0x73de=function(_0x3955ef,_0x1910e0){_0x3955ef=_0x3955ef-0x0;var _0x48a385=_0x3de7[_0x3955ef];return _0x48a385;};'use strict';var _=require(_0x73de('0x0'));var util=require('util');var logger=require(_0x73de('0x1'))(_0x73de('0x2'));var moment=require(_0x73de('0x3'));var BPromise=require('bluebird');var rp=require(_0x73de('0x4'));var fs=require('fs');var path=require(_0x73de('0x5'));var rimraf=require('rimraf');var config=require(_0x73de('0x6'));var attributes=require(_0x73de('0x7'));module[_0x73de('0x8')]=function(_0x14d4d1,_0xf66c3e){return _0x14d4d1['define'](_0x73de('0x9'),attributes,{'tableName':_0x73de('0xa'),'paranoid':![],'indexes':[{'name':_0x73de('0xb'),'fields':[_0x73de('0xb')]},{'name':_0x73de('0xc'),'fields':['phone']},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb00f=['path','rimraf','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority','util','../../config/logger','api','moment','request-promise'];(function(_0x36b037,_0x2b234e){var _0x409194=function(_0xddc9dc){while(--_0xddc9dc){_0x36b037['push'](_0x36b037['shift']());}};_0x409194(++_0x2b234e);}(_0xb00f,0x70));var _0xfb00=function(_0x17b7b6,_0x403509){_0x17b7b6=_0x17b7b6-0x0;var _0x40b94b=_0xb00f[_0x17b7b6];return _0x40b94b;};'use strict';var _=require('lodash');var util=require(_0xfb00('0x0'));var logger=require(_0xfb00('0x1'))(_0xfb00('0x2'));var moment=require(_0xfb00('0x3'));var BPromise=require('bluebird');var rp=require(_0xfb00('0x4'));var fs=require('fs');var path=require(_0xfb00('0x5'));var rimraf=require(_0xfb00('0x6'));var config=require('../../config/environment');var attributes=require(_0xfb00('0x7'));module['exports']=function(_0x294e92,_0x3a3ed7){return _0x294e92[_0xfb00('0x8')]('CmHopper',attributes,{'tableName':_0xfb00('0x9'),'paranoid':![],'indexes':[{'name':_0xfb00('0xa'),'fields':['scheduledat']},{'name':_0xfb00('0xb'),'fields':[_0xfb00('0xb')]},{'name':_0xfb00('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 6d54ac2..e7b8891 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 _0x8485=['GetContactRecallMe','UPDATE','GetCmHopperPreview','Contact','keys','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','stringify','error','code','message','CmHopper,\x20%s,\x20%s','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','map','include','model','find','ShowCmHopper','body','CreateCmHopper','UpdateCmHopper','update','limit','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','order','LOCK','User','Agent','name','voicePause','length','UserId','push','all','MoveContactManagedDialer','transaction','CmHopperFinal','CountReScheduled','COUNT','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled'];(function(_0x38eaa2,_0x5759f5){var _0x1d42cc=function(_0x237f60){while(--_0x237f60){_0x38eaa2['push'](_0x38eaa2['shift']());}};_0x1d42cc(++_0x5759f5);}(_0x8485,0x1a3));var _0x5848=function(_0x4316e8,_0xb2bddf){_0x4316e8=_0x4316e8-0x0;var _0x3c8b8e=_0x8485[_0x4316e8];return _0x3c8b8e;};'use strict';var _=require('lodash');var util=require(_0x5848('0x0'));var moment=require('moment');var BPromise=require(_0x5848('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5848('0x2'))['db'];var utils=require(_0x5848('0x3'));var logger=require(_0x5848('0x4'))(_0x5848('0x5'));var config=require(_0x5848('0x6'));var jayson=require(_0x5848('0x7'));var client=jayson['client'][_0x5848('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c81f3,_0x1c4a8c,_0x413712){return new BPromise(function(_0x36f6f9,_0x57d6c0){return client['request'](_0x1c81f3,_0x413712)[_0x5848('0x9')](function(_0x370ad6){logger[_0x5848('0xa')]('CmHopper,\x20%s,\x20%s',_0x1c4a8c,_0x5848('0xb'));logger[_0x5848('0xc')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x1c4a8c,_0x5848('0xb'),JSON[_0x5848('0xd')](_0x370ad6));if(_0x370ad6[_0x5848('0xe')]){if(_0x370ad6[_0x5848('0xe')][_0x5848('0xf')]===0x1f4){logger[_0x5848('0xe')]('CmHopper,\x20%s,\x20%s',_0x1c4a8c,_0x370ad6[_0x5848('0xe')][_0x5848('0x10')]);return _0x57d6c0(_0x370ad6[_0x5848('0xe')][_0x5848('0x10')]);}logger[_0x5848('0xe')](_0x5848('0x11'),_0x1c4a8c,_0x370ad6[_0x5848('0xe')][_0x5848('0x10')]);return _0x36f6f9(_0x370ad6[_0x5848('0xe')][_0x5848('0x10')]);}else{logger[_0x5848('0xa')](_0x5848('0x11'),_0x1c4a8c,_0x5848('0xb'));_0x36f6f9(_0x370ad6[_0x5848('0x12')][_0x5848('0x10')]);}})[_0x5848('0x13')](function(_0x4e85bb){logger[_0x5848('0xe')]('CmHopper,\x20%s,\x20%s',_0x1c4a8c,_0x4e85bb);_0x57d6c0(_0x4e85bb);});});}exports[_0x5848('0x14')]=function(_0x2cad81){var _0x8108e0=this;return new Promise(function(_0x465fe4,_0x3d3cfb){return db[_0x5848('0x15')][_0x5848('0x16')]({'raw':_0x2cad81[_0x5848('0x17')]?_0x2cad81[_0x5848('0x17')][_0x5848('0x18')]===undefined?!![]:![]:!![],'where':_0x2cad81[_0x5848('0x17')]?_0x2cad81[_0x5848('0x17')][_0x5848('0x19')]||null:null,'attributes':_0x2cad81['options']?_0x2cad81[_0x5848('0x17')][_0x5848('0x1a')]||null:null,'limit':_0x2cad81['options']?_0x2cad81[_0x5848('0x17')]['limit']||null:null,'include':_0x2cad81['options']?_0x2cad81[_0x5848('0x17')]['include']?_[_0x5848('0x1b')](_0x2cad81['options'][_0x5848('0x1c')],function(_0x22ca59){return{'model':db[_0x22ca59['model']],'as':_0x22ca59['as'],'attributes':_0x22ca59[_0x5848('0x1a')],'include':_0x22ca59['include']?_[_0x5848('0x1b')](_0x22ca59[_0x5848('0x1c')],function(_0x539c3a){return{'model':db[_0x539c3a[_0x5848('0x1d')]],'as':_0x539c3a['as'],'attributes':_0x539c3a[_0x5848('0x1a')],'include':_0x539c3a[_0x5848('0x1c')]?_[_0x5848('0x1b')](_0x539c3a[_0x5848('0x1c')],function(_0x47c918){return{'model':db[_0x47c918[_0x5848('0x1d')]],'as':_0x47c918['as'],'attributes':_0x47c918[_0x5848('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5848('0x9')](function(_0xfd15e5){logger[_0x5848('0xa')](_0x5848('0x14'),_0x2cad81);logger[_0x5848('0xc')]('GetCmHopper',_0x2cad81,JSON[_0x5848('0xd')](_0xfd15e5));_0x465fe4(_0xfd15e5);})[_0x5848('0x13')](function(_0x10192c){logger[_0x5848('0xe')](_0x5848('0x14'),_0x10192c[_0x5848('0x10')],_0x2cad81);_0x3d3cfb(_0x8108e0[_0x5848('0xe')](0x1f4,_0x10192c[_0x5848('0x10')]));});});};exports['ShowCmHopper']=function(_0x14e4b8){var _0x1717ef=this;return new Promise(function(_0x112974,_0x2858fb){return db[_0x5848('0x15')][_0x5848('0x1e')]({'raw':_0x14e4b8['options']?_0x14e4b8['options'][_0x5848('0x18')]===undefined?!![]:![]:!![],'where':_0x14e4b8['options']?_0x14e4b8[_0x5848('0x17')][_0x5848('0x19')]||null:null,'attributes':_0x14e4b8['options']?_0x14e4b8['options'][_0x5848('0x1a')]||null:null,'include':_0x14e4b8[_0x5848('0x17')]?_0x14e4b8[_0x5848('0x17')][_0x5848('0x1c')]?_['map'](_0x14e4b8[_0x5848('0x17')]['include'],function(_0x50d3df){return{'model':db[_0x50d3df[_0x5848('0x1d')]],'as':_0x50d3df['as'],'attributes':_0x50d3df[_0x5848('0x1a')],'include':_0x50d3df['include']?_[_0x5848('0x1b')](_0x50d3df[_0x5848('0x1c')],function(_0x247cf9){return{'model':db[_0x247cf9[_0x5848('0x1d')]],'as':_0x247cf9['as'],'attributes':_0x247cf9['attributes'],'include':_0x247cf9[_0x5848('0x1c')]?_[_0x5848('0x1b')](_0x247cf9[_0x5848('0x1c')],function(_0x350746){return{'model':db[_0x350746[_0x5848('0x1d')]],'as':_0x350746['as'],'attributes':_0x350746[_0x5848('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb9deeb){logger['info'](_0x5848('0x1f'),_0x14e4b8);logger[_0x5848('0xc')](_0x5848('0x1f'),_0x14e4b8,JSON[_0x5848('0xd')](_0xb9deeb));_0x112974(_0xb9deeb);})[_0x5848('0x13')](function(_0x3e4e94){logger['error'](_0x5848('0x1f'),_0x3e4e94[_0x5848('0x10')],_0x14e4b8);_0x2858fb(_0x1717ef[_0x5848('0xe')](0x1f4,_0x3e4e94[_0x5848('0x10')]));});});};exports['CreateCmHopper']=function(_0x31d226){var _0x1bd6bc=this;return new Promise(function(_0x12e6fd,_0x4afed7){return db[_0x5848('0x15')]['create'](_0x31d226[_0x5848('0x20')],{'raw':_0x31d226['options']?_0x31d226[_0x5848('0x17')][_0x5848('0x18')]===undefined?!![]:![]:!![]})[_0x5848('0x9')](function(_0x3acae9){logger['info']('CreateCmHopper',_0x31d226);logger[_0x5848('0xc')](_0x5848('0x21'),_0x31d226,JSON[_0x5848('0xd')](_0x3acae9));_0x12e6fd(_0x3acae9);})[_0x5848('0x13')](function(_0x33bcd2){logger['error'](_0x5848('0x21'),_0x33bcd2['message'],_0x31d226);_0x4afed7(_0x1bd6bc['error'](0x1f4,_0x33bcd2[_0x5848('0x10')]));});});};exports[_0x5848('0x22')]=function(_0xc6229b){var _0x297efb=this;return new Promise(function(_0x27807b,_0x32374d){return db[_0x5848('0x15')][_0x5848('0x23')](_0xc6229b[_0x5848('0x20')],{'raw':_0xc6229b[_0x5848('0x17')]?_0xc6229b[_0x5848('0x17')][_0x5848('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc6229b[_0x5848('0x17')]?_0xc6229b[_0x5848('0x17')][_0x5848('0x19')]||null:null,'attributes':_0xc6229b[_0x5848('0x17')]?_0xc6229b[_0x5848('0x17')][_0x5848('0x1a')]||null:null,'limit':_0xc6229b['options']?_0xc6229b[_0x5848('0x17')][_0x5848('0x24')]||null:null})[_0x5848('0x9')](function(_0x51b6a0){logger[_0x5848('0xa')](_0x5848('0x22'),_0xc6229b);logger[_0x5848('0xc')](_0x5848('0x22'),_0xc6229b,JSON[_0x5848('0xd')](_0x51b6a0));_0x27807b(_0x51b6a0);})[_0x5848('0x13')](function(_0x2f395f){logger[_0x5848('0xe')](_0x5848('0x22'),_0x2f395f[_0x5848('0x10')],_0xc6229b);_0x32374d(_0x297efb['error'](0x1f4,_0x2f395f[_0x5848('0x10')]));});});};exports[_0x5848('0x25')]=function(_0x1fbf88){var _0x1cfac9=this;return new Promise(function(_0x41f873,_0x1964f5){return db[_0x5848('0x15')][_0x5848('0x26')]({'where':_0x1fbf88[_0x5848('0x17')]?_0x1fbf88[_0x5848('0x17')][_0x5848('0x19')]||null:null})['then'](function(_0x182e5f){logger[_0x5848('0xa')](_0x5848('0x25'),_0x1fbf88);logger[_0x5848('0xc')]('DestroyCmHopper',_0x1fbf88,JSON[_0x5848('0xd')](_0x182e5f));_0x41f873(_0x182e5f);})[_0x5848('0x13')](function(_0x5aa883){logger['error'](_0x5848('0x25'),_0x5aa883['message'],_0x1fbf88);_0x1964f5(_0x1cfac9[_0x5848('0xe')](0x1f4,_0x5aa883[_0x5848('0x10')]));});});};exports[_0x5848('0x27')]=function(_0x5eb092){var _0x3e8e61=this;return new Promise(function(_0x445946,_0x2670b7){return db[_0x5848('0x28')][_0x5848('0x29')]()[_0x5848('0x9')](function(_0xaae2eb){return db[_0x5848('0x2a')]['transaction'](function(_0x3db9fb){return db[_0x5848('0x15')][_0x5848('0x16')]({'where':_0x5eb092[_0x5848('0x17')]?_0x5eb092[_0x5848('0x17')][_0x5848('0x19')]||null:null,'attributes':_0x5eb092[_0x5848('0x17')]?_0x5eb092[_0x5848('0x17')][_0x5848('0x1a')]||null:null,'limit':_0x5eb092[_0x5848('0x17')]?_0x5eb092[_0x5848('0x17')]['limit']||null:null,'order':_0x5eb092[_0x5848('0x17')]?_0x5eb092[_0x5848('0x17')][_0x5848('0x2b')]||null:null,'transaction':_0x3db9fb,'lock':_0x3db9fb[_0x5848('0x2c')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_['keys'](_0xaae2eb)},{'model':db[_0x5848('0x2d')],'as':_0x5848('0x2e'),'attributes':['id',_0x5848('0x2f'),_0x5848('0x30')]}]})[_0x5848('0x9')](function(_0x4bc38a){var _0x460087=[];var _0x788f63=[];for(var _0x19b2ab=0x0;_0x19b2ab<_0x4bc38a[_0x5848('0x31')];_0x19b2ab+=0x1){if(!_0x788f63['includes'](_0x4bc38a[_0x19b2ab][_0x5848('0x32')])){_0x788f63[_0x5848('0x33')](_0x4bc38a[_0x19b2ab][_0x5848('0x32')]);_0x460087[_0x5848('0x33')](_0x4bc38a[_0x19b2ab]['update'](_0x5eb092[_0x5848('0x20')],{'transaction':_0x3db9fb}));}}return BPromise[_0x5848('0x34')](_0x460087);});})[_0x5848('0x9')](function(_0x336ae1){logger[_0x5848('0xa')](_0x5848('0x27'),_0x5eb092);logger[_0x5848('0xc')](_0x5848('0x27'),_0x5eb092,JSON[_0x5848('0xd')](_0x336ae1));_0x445946(_0x336ae1);})['catch'](function(_0x584d6d){logger[_0x5848('0xe')](_0x5848('0x27'),_0x584d6d[_0x5848('0x10')],_0x5eb092);_0x2670b7(_0x3e8e61['error'](0x1f4,_0x584d6d[_0x5848('0x10')]));});});});};exports[_0x5848('0x35')]=function(_0x1d99e7){var _0x4b6320=this;return new Promise(function(_0x3efdc5,_0x22287a){return db[_0x5848('0x2a')][_0x5848('0x36')](function(_0x1c7482){return db[_0x5848('0x37')]['create'](_0x1d99e7[_0x5848('0x20')],{'raw':_0x1d99e7['options']?_0x1d99e7[_0x5848('0x17')][_0x5848('0x18')]===undefined?!![]:![]:!![],'transaction':_0x1c7482})[_0x5848('0x9')](function(){return db[_0x5848('0x15')][_0x5848('0x26')]({'where':_0x1d99e7[_0x5848('0x17')]?_0x1d99e7[_0x5848('0x17')][_0x5848('0x19')]||null:null,'transaction':_0x1c7482});});})[_0x5848('0x9')](function(_0x197657){logger[_0x5848('0xa')](_0x5848('0x35'),_0x1d99e7);logger['debug'](_0x5848('0x35'),_0x1d99e7,JSON['stringify'](_0x197657));_0x3efdc5(_0x197657);})[_0x5848('0x13')](function(_0x43c8b5){logger[_0x5848('0xe')](_0x5848('0x35'),_0x43c8b5[_0x5848('0x10')],_0x1d99e7);_0x22287a(_0x4b6320['error'](0x1f4,_0x43c8b5[_0x5848('0x10')]));});});};exports[_0x5848('0x38')]=function(_0x864475){var _0x10dfb0=this;return new Promise(function(_0x11381a,_0xd9b552){return db[_0x5848('0x15')]['findAll']({'raw':_0x864475[_0x5848('0x17')]?_0x864475[_0x5848('0x17')][_0x5848('0x18')]===undefined?!![]:![]:!![],'where':_0x864475['options']?_0x864475['options'][_0x5848('0x19')]||null:null,'attributes':[[db[_0x5848('0x2a')]['fn'](_0x5848('0x39'),db['sequelize']['fn']('IF',db['sequelize'][_0x5848('0x3a')]('`scheduledat`\x20>=\x20'+util[_0x5848('0x3b')](_0x5848('0x3c'),moment()[_0x5848('0x3b')](_0x5848('0x3d')))+_0x5848('0x3e')))),_0x5848('0x3f')]]})[_0x5848('0x9')](function(_0x133c70){logger[_0x5848('0xa')](_0x5848('0x38'),_0x864475);logger[_0x5848('0xc')](_0x5848('0x38'),_0x864475,JSON[_0x5848('0xd')](_0x133c70));_0x11381a(_0x133c70);})[_0x5848('0x13')](function(_0x527646){logger[_0x5848('0xe')](_0x5848('0x38'),_0x527646[_0x5848('0x10')],_0x864475);_0xd9b552(_0x10dfb0['error'](0x1f4,_0x527646[_0x5848('0x10')]));});});};exports[_0x5848('0x40')]=function(_0x23d3e7){var _0x46bccf=this;return new Promise(function(_0x4f1e91,_0x34dc80){return db[_0x5848('0x28')][_0x5848('0x29')]()[_0x5848('0x9')](function(_0x212833){return db['sequelize']['transaction'](function(_0x2c9dc7){return db[_0x5848('0x15')][_0x5848('0x16')]({'where':_0x23d3e7[_0x5848('0x17')]?_0x23d3e7[_0x5848('0x17')]['where']||null:null,'attributes':_0x23d3e7[_0x5848('0x17')]?_0x23d3e7[_0x5848('0x17')][_0x5848('0x1a')]||null:null,'limit':0x1,'order':_0x23d3e7['options']?_0x23d3e7['options'][_0x5848('0x2b')]||null:null,'group':db[_0x5848('0x15')][_0x5848('0x32')],'transaction':_0x2c9dc7,'lock':_0x2c9dc7[_0x5848('0x2c')][_0x5848('0x41')],'include':_0x23d3e7[_0x5848('0x17')]?_0x23d3e7[_0x5848('0x17')][_0x5848('0x1c')]?_[_0x5848('0x1b')](_0x23d3e7['options'][_0x5848('0x1c')],function(_0x15a19a){return{'model':db[_0x15a19a['model']],'as':_0x15a19a['as'],'attributes':_0x15a19a['attributes'],'include':_0x15a19a[_0x5848('0x1c')]?_['map'](_0x15a19a['include'],function(_0x2b9348){return{'model':db[_0x2b9348[_0x5848('0x1d')]],'as':_0x2b9348['as'],'attributes':_0x2b9348['attributes'],'include':_0x2b9348['include']?_[_0x5848('0x1b')](_0x2b9348[_0x5848('0x1c')],function(_0xc897d2){return{'model':db[_0xc897d2['model']],'as':_0xc897d2['as'],'attributes':_0xc897d2[_0x5848('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5848('0x9')](function(_0x3d9ae8){var _0x51f3a8=[];for(var _0xaa61a9=0x0;_0xaa61a9<_0x3d9ae8[_0x5848('0x31')];_0xaa61a9+=0x1){_0x51f3a8['push'](_0x3d9ae8[_0xaa61a9][_0x5848('0x23')](_0x23d3e7[_0x5848('0x20')],{'transaction':_0x2c9dc7}));}return BPromise['all'](_0x51f3a8);});})[_0x5848('0x9')](function(_0x5020d2){logger[_0x5848('0xa')](_0x5848('0x40'),_0x23d3e7);logger['debug'](_0x5848('0x40'),_0x23d3e7,JSON[_0x5848('0xd')](_0x5020d2));_0x4f1e91(_0x5020d2);})['catch'](function(_0xad1e82){logger['error'](_0x5848('0x40'),_0xad1e82['message'],_0x23d3e7);_0x34dc80(_0x46bccf[_0x5848('0xe')](0x1f4,_0xad1e82[_0x5848('0x10')]));});});});};exports[_0x5848('0x42')]=function(_0xb8513c){var _0x1e5865=this;return new Promise(function(_0x1d11b8,_0x2e7215){db[_0x5848('0x28')][_0x5848('0x29')]()[_0x5848('0x9')](function(_0x29df14){return db[_0x5848('0x15')][_0x5848('0x16')]({'raw':_0xb8513c[_0x5848('0x17')]?_0xb8513c[_0x5848('0x17')][_0x5848('0x18')]===undefined?!![]:![]:!![],'where':_0xb8513c[_0x5848('0x17')]?_0xb8513c[_0x5848('0x17')][_0x5848('0x19')]||null:null,'attributes':_0xb8513c[_0x5848('0x17')]?_0xb8513c[_0x5848('0x17')]['attributes']||null:null,'limit':_0xb8513c['options']?_0xb8513c['options'][_0x5848('0x24')]||null:null,'include':_0xb8513c[_0x5848('0x17')]?_0xb8513c[_0x5848('0x17')][_0x5848('0x1c')]?_[_0x5848('0x1b')](_0xb8513c[_0x5848('0x17')]['include'],function(_0x5df7b8){return{'model':db[_0x5df7b8['model']],'as':_0x5df7b8['as'],'attributes':_0x5df7b8['as']===_0x5848('0x43')?_[_0x5848('0x44')](_0x29df14):_0x5df7b8[_0x5848('0x1a')],'include':_0x5df7b8[_0x5848('0x1c')]?_['map'](_0x5df7b8[_0x5848('0x1c')],function(_0x5fa84c){return{'model':db[_0x5fa84c[_0x5848('0x1d')]],'as':_0x5fa84c['as'],'attributes':_0x5fa84c[_0x5848('0x1a')],'include':_0x5fa84c[_0x5848('0x1c')]?_[_0x5848('0x1b')](_0x5fa84c[_0x5848('0x1c')],function(_0x2adfb8){return{'model':db[_0x2adfb8[_0x5848('0x1d')]],'as':_0x2adfb8['as'],'attributes':_0x2adfb8[_0x5848('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x25b7a2){logger[_0x5848('0xa')](_0x5848('0x14'),_0xb8513c);logger[_0x5848('0xc')](_0x5848('0x14'),_0xb8513c,JSON[_0x5848('0xd')](_0x25b7a2));_0x1d11b8(_0x25b7a2);})[_0x5848('0x13')](function(_0x2580ec){logger[_0x5848('0xe')](_0x5848('0x14'),_0x2580ec['message'],_0xb8513c);_0x2e7215(_0x1e5865[_0x5848('0xe')](0x1f4,_0x2580ec['message']));});});});}; \ No newline at end of file +var _0xad2e=['name','voicePause','length','includes','UserId','push','sequelize','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','all','GetContactRecallMe','GetCmHopperPreview','Contact','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','attributes','map','model','debug','find','ShowCmHopper','create','body','CreateCmHopper','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','keys','User','Agent'];(function(_0x145fc7,_0x3907f4){var _0x241a7d=function(_0x49c355){while(--_0x49c355){_0x145fc7['push'](_0x145fc7['shift']());}};_0x241a7d(++_0x3907f4);}(_0xad2e,0xa4));var _0xead2=function(_0xed80dc,_0x1fa8dc){_0xed80dc=_0xed80dc-0x0;var _0x124c4d=_0xad2e[_0xed80dc];return _0x124c4d;};'use strict';var _=require('lodash');var util=require(_0xead2('0x0'));var moment=require(_0xead2('0x1'));var BPromise=require(_0xead2('0x2'));var rs=require(_0xead2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xead2('0x4'))['db'];var utils=require(_0xead2('0x5'));var logger=require(_0xead2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xead2('0x7'));var client=jayson[_0xead2('0x8')][_0xead2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x116dc8,_0xe506e8,_0x5dee3e){return new BPromise(function(_0x4a9845,_0x16e36c){return client[_0xead2('0xa')](_0x116dc8,_0x5dee3e)[_0xead2('0xb')](function(_0x534b1d){logger[_0xead2('0xc')](_0xead2('0xd'),_0xe506e8,_0xead2('0xe'));logger['debug']('CmHopper,\x20%s,\x20%s,\x20%s',_0xe506e8,_0xead2('0xe'),JSON[_0xead2('0xf')](_0x534b1d));if(_0x534b1d[_0xead2('0x10')]){if(_0x534b1d[_0xead2('0x10')][_0xead2('0x11')]===0x1f4){logger[_0xead2('0x10')](_0xead2('0xd'),_0xe506e8,_0x534b1d[_0xead2('0x10')][_0xead2('0x12')]);return _0x16e36c(_0x534b1d[_0xead2('0x10')]['message']);}logger[_0xead2('0x10')](_0xead2('0xd'),_0xe506e8,_0x534b1d[_0xead2('0x10')]['message']);return _0x4a9845(_0x534b1d[_0xead2('0x10')][_0xead2('0x12')]);}else{logger['info'](_0xead2('0xd'),_0xe506e8,_0xead2('0xe'));_0x4a9845(_0x534b1d[_0xead2('0x13')][_0xead2('0x12')]);}})[_0xead2('0x14')](function(_0x5f33bb){logger['error']('CmHopper,\x20%s,\x20%s',_0xe506e8,_0x5f33bb);_0x16e36c(_0x5f33bb);});});}exports[_0xead2('0x15')]=function(_0x5c6d69){var _0x5d2483=this;return new Promise(function(_0xdbbd6b,_0x19a24a){return db[_0xead2('0x16')][_0xead2('0x17')]({'raw':_0x5c6d69['options']?_0x5c6d69[_0xead2('0x18')][_0xead2('0x19')]===undefined?!![]:![]:!![],'where':_0x5c6d69[_0xead2('0x18')]?_0x5c6d69['options'][_0xead2('0x1a')]||null:null,'attributes':_0x5c6d69[_0xead2('0x18')]?_0x5c6d69[_0xead2('0x18')]['attributes']||null:null,'limit':_0x5c6d69[_0xead2('0x18')]?_0x5c6d69[_0xead2('0x18')][_0xead2('0x1b')]||null:null,'include':_0x5c6d69['options']?_0x5c6d69[_0xead2('0x18')][_0xead2('0x1c')]?_['map'](_0x5c6d69[_0xead2('0x18')][_0xead2('0x1c')],function(_0xf9e726){return{'model':db[_0xf9e726['model']],'as':_0xf9e726['as'],'attributes':_0xf9e726[_0xead2('0x1d')],'include':_0xf9e726[_0xead2('0x1c')]?_[_0xead2('0x1e')](_0xf9e726['include'],function(_0x4388df){return{'model':db[_0x4388df[_0xead2('0x1f')]],'as':_0x4388df['as'],'attributes':_0x4388df['attributes'],'include':_0x4388df['include']?_[_0xead2('0x1e')](_0x4388df[_0xead2('0x1c')],function(_0xfbf38d){return{'model':db[_0xfbf38d[_0xead2('0x1f')]],'as':_0xfbf38d['as'],'attributes':_0xfbf38d[_0xead2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xead2('0xb')](function(_0x2cd202){logger[_0xead2('0xc')]('GetCmHopper',_0x5c6d69);logger[_0xead2('0x20')](_0xead2('0x15'),_0x5c6d69,JSON[_0xead2('0xf')](_0x2cd202));_0xdbbd6b(_0x2cd202);})['catch'](function(_0x399201){logger[_0xead2('0x10')]('GetCmHopper',_0x399201[_0xead2('0x12')],_0x5c6d69);_0x19a24a(_0x5d2483[_0xead2('0x10')](0x1f4,_0x399201['message']));});});};exports['ShowCmHopper']=function(_0x3c9948){var _0x12a28e=this;return new Promise(function(_0x4afa7e,_0x3819ea){return db[_0xead2('0x16')][_0xead2('0x21')]({'raw':_0x3c9948[_0xead2('0x18')]?_0x3c9948[_0xead2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3c9948[_0xead2('0x18')]?_0x3c9948[_0xead2('0x18')]['where']||null:null,'attributes':_0x3c9948[_0xead2('0x18')]?_0x3c9948[_0xead2('0x18')][_0xead2('0x1d')]||null:null,'include':_0x3c9948[_0xead2('0x18')]?_0x3c9948[_0xead2('0x18')][_0xead2('0x1c')]?_[_0xead2('0x1e')](_0x3c9948[_0xead2('0x18')]['include'],function(_0x49b385){return{'model':db[_0x49b385[_0xead2('0x1f')]],'as':_0x49b385['as'],'attributes':_0x49b385[_0xead2('0x1d')],'include':_0x49b385[_0xead2('0x1c')]?_['map'](_0x49b385[_0xead2('0x1c')],function(_0x5e4517){return{'model':db[_0x5e4517[_0xead2('0x1f')]],'as':_0x5e4517['as'],'attributes':_0x5e4517['attributes'],'include':_0x5e4517[_0xead2('0x1c')]?_[_0xead2('0x1e')](_0x5e4517[_0xead2('0x1c')],function(_0xaf2f97){return{'model':db[_0xaf2f97[_0xead2('0x1f')]],'as':_0xaf2f97['as'],'attributes':_0xaf2f97[_0xead2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xead2('0xb')](function(_0x283b23){logger[_0xead2('0xc')]('ShowCmHopper',_0x3c9948);logger['debug'](_0xead2('0x22'),_0x3c9948,JSON['stringify'](_0x283b23));_0x4afa7e(_0x283b23);})[_0xead2('0x14')](function(_0x21a113){logger[_0xead2('0x10')](_0xead2('0x22'),_0x21a113[_0xead2('0x12')],_0x3c9948);_0x3819ea(_0x12a28e[_0xead2('0x10')](0x1f4,_0x21a113['message']));});});};exports['CreateCmHopper']=function(_0x1070f6){var _0x3c9884=this;return new Promise(function(_0x526f5a,_0x1d9278){return db[_0xead2('0x16')][_0xead2('0x23')](_0x1070f6[_0xead2('0x24')],{'raw':_0x1070f6[_0xead2('0x18')]?_0x1070f6['options'][_0xead2('0x19')]===undefined?!![]:![]:!![]})[_0xead2('0xb')](function(_0x4aefb1){logger[_0xead2('0xc')](_0xead2('0x25'),_0x1070f6);logger[_0xead2('0x20')](_0xead2('0x25'),_0x1070f6,JSON[_0xead2('0xf')](_0x4aefb1));_0x526f5a(_0x4aefb1);})[_0xead2('0x14')](function(_0x70a52d){logger[_0xead2('0x10')](_0xead2('0x25'),_0x70a52d['message'],_0x1070f6);_0x1d9278(_0x3c9884[_0xead2('0x10')](0x1f4,_0x70a52d[_0xead2('0x12')]));});});};exports[_0xead2('0x26')]=function(_0x1c4ee2){var _0xeed8b6=this;return new Promise(function(_0x526156,_0x2dcc2d){return db[_0xead2('0x16')][_0xead2('0x27')](_0x1c4ee2[_0xead2('0x24')],{'raw':_0x1c4ee2['options']?_0x1c4ee2[_0xead2('0x18')][_0xead2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c4ee2[_0xead2('0x18')]?_0x1c4ee2[_0xead2('0x18')]['where']||null:null,'attributes':_0x1c4ee2[_0xead2('0x18')]?_0x1c4ee2['options'][_0xead2('0x1d')]||null:null,'limit':_0x1c4ee2['options']?_0x1c4ee2['options']['limit']||null:null})['then'](function(_0x55193a){logger[_0xead2('0xc')](_0xead2('0x26'),_0x1c4ee2);logger[_0xead2('0x20')](_0xead2('0x26'),_0x1c4ee2,JSON['stringify'](_0x55193a));_0x526156(_0x55193a);})[_0xead2('0x14')](function(_0x4b4af6){logger[_0xead2('0x10')]('UpdateCmHopper',_0x4b4af6['message'],_0x1c4ee2);_0x2dcc2d(_0xeed8b6['error'](0x1f4,_0x4b4af6[_0xead2('0x12')]));});});};exports[_0xead2('0x28')]=function(_0x278b63){var _0x198226=this;return new Promise(function(_0x226a47,_0xa86640){return db[_0xead2('0x16')][_0xead2('0x29')]({'where':_0x278b63[_0xead2('0x18')]?_0x278b63[_0xead2('0x18')][_0xead2('0x1a')]||null:null})[_0xead2('0xb')](function(_0x33f614){logger[_0xead2('0xc')]('DestroyCmHopper',_0x278b63);logger[_0xead2('0x20')]('DestroyCmHopper',_0x278b63,JSON[_0xead2('0xf')](_0x33f614));_0x226a47(_0x33f614);})[_0xead2('0x14')](function(_0x15aec1){logger[_0xead2('0x10')](_0xead2('0x28'),_0x15aec1['message'],_0x278b63);_0xa86640(_0x198226[_0xead2('0x10')](0x1f4,_0x15aec1[_0xead2('0x12')]));});});};exports[_0xead2('0x2a')]=function(_0x6bbfca){var _0x1fb53e=this;return new Promise(function(_0x1c86c1,_0x227e94){return db[_0xead2('0x2b')][_0xead2('0x2c')]()[_0xead2('0xb')](function(_0x24c0a1){return db['sequelize'][_0xead2('0x2d')](function(_0x373881){return db[_0xead2('0x16')]['findAll']({'where':_0x6bbfca['options']?_0x6bbfca[_0xead2('0x18')][_0xead2('0x1a')]||null:null,'attributes':_0x6bbfca[_0xead2('0x18')]?_0x6bbfca['options'][_0xead2('0x1d')]||null:null,'limit':_0x6bbfca[_0xead2('0x18')]?_0x6bbfca['options']['limit']||null:null,'order':_0x6bbfca['options']?_0x6bbfca[_0xead2('0x18')][_0xead2('0x2e')]||null:null,'transaction':_0x373881,'lock':_0x373881[_0xead2('0x2f')][_0xead2('0x30')],'include':[{'model':db[_0xead2('0x2b')],'as':'Contact','attributes':_[_0xead2('0x31')](_0x24c0a1)},{'model':db[_0xead2('0x32')],'as':_0xead2('0x33'),'attributes':['id',_0xead2('0x34'),_0xead2('0x35')]}]})['then'](function(_0x53f37a){var _0x44c0e9=[];var _0x5cb5ea=[];for(var _0x3ca0b1=0x0;_0x3ca0b1<_0x53f37a[_0xead2('0x36')];_0x3ca0b1+=0x1){if(!_0x5cb5ea[_0xead2('0x37')](_0x53f37a[_0x3ca0b1][_0xead2('0x38')])){_0x5cb5ea[_0xead2('0x39')](_0x53f37a[_0x3ca0b1][_0xead2('0x38')]);_0x44c0e9[_0xead2('0x39')](_0x53f37a[_0x3ca0b1][_0xead2('0x27')](_0x6bbfca[_0xead2('0x24')],{'transaction':_0x373881}));}}return BPromise['all'](_0x44c0e9);});})['then'](function(_0x4152d2){logger[_0xead2('0xc')](_0xead2('0x2a'),_0x6bbfca);logger[_0xead2('0x20')](_0xead2('0x2a'),_0x6bbfca,JSON[_0xead2('0xf')](_0x4152d2));_0x1c86c1(_0x4152d2);})[_0xead2('0x14')](function(_0x25661a){logger[_0xead2('0x10')](_0xead2('0x2a'),_0x25661a[_0xead2('0x12')],_0x6bbfca);_0x227e94(_0x1fb53e[_0xead2('0x10')](0x1f4,_0x25661a[_0xead2('0x12')]));});});});};exports['MoveContactManagedDialer']=function(_0x46bc8f){var _0xda1dfe=this;return new Promise(function(_0x2085e1,_0x240b84){return db[_0xead2('0x3a')][_0xead2('0x2d')](function(_0x31d2b8){return db[_0xead2('0x3b')]['create'](_0x46bc8f[_0xead2('0x24')],{'raw':_0x46bc8f[_0xead2('0x18')]?_0x46bc8f['options'][_0xead2('0x19')]===undefined?!![]:![]:!![],'transaction':_0x31d2b8})[_0xead2('0xb')](function(){return db[_0xead2('0x16')][_0xead2('0x29')]({'where':_0x46bc8f[_0xead2('0x18')]?_0x46bc8f[_0xead2('0x18')][_0xead2('0x1a')]||null:null,'transaction':_0x31d2b8});});})[_0xead2('0xb')](function(_0x48927a){logger[_0xead2('0xc')]('MoveContactManagedDialer',_0x46bc8f);logger[_0xead2('0x20')]('MoveContactManagedDialer',_0x46bc8f,JSON[_0xead2('0xf')](_0x48927a));_0x2085e1(_0x48927a);})[_0xead2('0x14')](function(_0x50f960){logger[_0xead2('0x10')]('MoveContactManagedDialer',_0x50f960['message'],_0x46bc8f);_0x240b84(_0xda1dfe[_0xead2('0x10')](0x1f4,_0x50f960[_0xead2('0x12')]));});});};exports[_0xead2('0x3c')]=function(_0x45ac0e){var _0x1f00b8=this;return new Promise(function(_0x3e9e4f,_0x5e85e4){return db['CmHopper']['findAll']({'raw':_0x45ac0e[_0xead2('0x18')]?_0x45ac0e[_0xead2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x45ac0e[_0xead2('0x18')]?_0x45ac0e['options'][_0xead2('0x1a')]||null:null,'attributes':[[db['sequelize']['fn'](_0xead2('0x3d'),db[_0xead2('0x3a')]['fn']('IF',db[_0xead2('0x3a')][_0xead2('0x3e')](_0xead2('0x3f')+util[_0xead2('0x40')]('\x22%s\x22',moment()[_0xead2('0x40')](_0xead2('0x41')))+_0xead2('0x42')))),_0xead2('0x43')]]})['then'](function(_0x217484){logger[_0xead2('0xc')](_0xead2('0x3c'),_0x45ac0e);logger[_0xead2('0x20')]('CountReScheduled',_0x45ac0e,JSON['stringify'](_0x217484));_0x3e9e4f(_0x217484);})['catch'](function(_0x5bbc61){logger[_0xead2('0x10')](_0xead2('0x3c'),_0x5bbc61[_0xead2('0x12')],_0x45ac0e);_0x5e85e4(_0x1f00b8['error'](0x1f4,_0x5bbc61[_0xead2('0x12')]));});});};exports['GetContactRecallMe']=function(_0x45616a){var _0x2ddb2d=this;return new Promise(function(_0x3760d4,_0x1e140d){return db[_0xead2('0x2b')][_0xead2('0x2c')]()['then'](function(_0x3e1d0d){return db[_0xead2('0x3a')][_0xead2('0x2d')](function(_0x5cd59c){return db[_0xead2('0x16')][_0xead2('0x17')]({'where':_0x45616a[_0xead2('0x18')]?_0x45616a[_0xead2('0x18')]['where']||null:null,'attributes':_0x45616a[_0xead2('0x18')]?_0x45616a[_0xead2('0x18')]['attributes']||null:null,'limit':0x1,'order':_0x45616a['options']?_0x45616a[_0xead2('0x18')]['order']||null:null,'group':db[_0xead2('0x16')][_0xead2('0x38')],'transaction':_0x5cd59c,'lock':_0x5cd59c[_0xead2('0x2f')][_0xead2('0x30')],'include':_0x45616a[_0xead2('0x18')]?_0x45616a[_0xead2('0x18')]['include']?_[_0xead2('0x1e')](_0x45616a['options'][_0xead2('0x1c')],function(_0x52a5a6){return{'model':db[_0x52a5a6[_0xead2('0x1f')]],'as':_0x52a5a6['as'],'attributes':_0x52a5a6[_0xead2('0x1d')],'include':_0x52a5a6['include']?_[_0xead2('0x1e')](_0x52a5a6['include'],function(_0x3ff043){return{'model':db[_0x3ff043[_0xead2('0x1f')]],'as':_0x3ff043['as'],'attributes':_0x3ff043['attributes'],'include':_0x3ff043[_0xead2('0x1c')]?_[_0xead2('0x1e')](_0x3ff043[_0xead2('0x1c')],function(_0x303f15){return{'model':db[_0x303f15[_0xead2('0x1f')]],'as':_0x303f15['as'],'attributes':_0x303f15[_0xead2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xead2('0xb')](function(_0x50a6cf){var _0x51b7df=[];for(var _0x3c0ea5=0x0;_0x3c0ea5<_0x50a6cf[_0xead2('0x36')];_0x3c0ea5+=0x1){_0x51b7df[_0xead2('0x39')](_0x50a6cf[_0x3c0ea5]['update'](_0x45616a[_0xead2('0x24')],{'transaction':_0x5cd59c}));}return BPromise[_0xead2('0x44')](_0x51b7df);});})[_0xead2('0xb')](function(_0x4320c6){logger[_0xead2('0xc')]('GetContactRecallMe',_0x45616a);logger['debug'](_0xead2('0x45'),_0x45616a,JSON[_0xead2('0xf')](_0x4320c6));_0x3760d4(_0x4320c6);})['catch'](function(_0x35b15c){logger[_0xead2('0x10')]('GetContactRecallMe',_0x35b15c['message'],_0x45616a);_0x1e140d(_0x2ddb2d[_0xead2('0x10')](0x1f4,_0x35b15c['message']));});});});};exports[_0xead2('0x46')]=function(_0x40871e){var _0x10a903=this;return new Promise(function(_0x81f95b,_0x3b25d7){db['CmContact'][_0xead2('0x2c')]()[_0xead2('0xb')](function(_0x389d3f){return db[_0xead2('0x16')][_0xead2('0x17')]({'raw':_0x40871e[_0xead2('0x18')]?_0x40871e['options'][_0xead2('0x19')]===undefined?!![]:![]:!![],'where':_0x40871e[_0xead2('0x18')]?_0x40871e[_0xead2('0x18')][_0xead2('0x1a')]||null:null,'attributes':_0x40871e[_0xead2('0x18')]?_0x40871e[_0xead2('0x18')][_0xead2('0x1d')]||null:null,'limit':_0x40871e[_0xead2('0x18')]?_0x40871e[_0xead2('0x18')][_0xead2('0x1b')]||null:null,'include':_0x40871e[_0xead2('0x18')]?_0x40871e[_0xead2('0x18')][_0xead2('0x1c')]?_[_0xead2('0x1e')](_0x40871e[_0xead2('0x18')][_0xead2('0x1c')],function(_0x2ec1a2){return{'model':db[_0x2ec1a2[_0xead2('0x1f')]],'as':_0x2ec1a2['as'],'attributes':_0x2ec1a2['as']===_0xead2('0x47')?_['keys'](_0x389d3f):_0x2ec1a2['attributes'],'include':_0x2ec1a2[_0xead2('0x1c')]?_[_0xead2('0x1e')](_0x2ec1a2[_0xead2('0x1c')],function(_0x10ed29){return{'model':db[_0x10ed29[_0xead2('0x1f')]],'as':_0x10ed29['as'],'attributes':_0x10ed29[_0xead2('0x1d')],'include':_0x10ed29[_0xead2('0x1c')]?_[_0xead2('0x1e')](_0x10ed29[_0xead2('0x1c')],function(_0x4857bf){return{'model':db[_0x4857bf['model']],'as':_0x4857bf['as'],'attributes':_0x4857bf[_0xead2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xead2('0xb')](function(_0x518665){logger[_0xead2('0xc')](_0xead2('0x15'),_0x40871e);logger[_0xead2('0x20')]('GetCmHopper',_0x40871e,JSON[_0xead2('0xf')](_0x518665));_0x81f95b(_0x518665);})[_0xead2('0x14')](function(_0x5cdc28){logger['error']('GetCmHopper',_0x5cdc28[_0xead2('0x12')],_0x40871e);_0x3b25d7(_0x10a903[_0xead2('0x10')](0x1f4,_0x5cdc28[_0xead2('0x12')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 07d838c..24aff44 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 _0xafcd=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmHopper.controller','get','index','/describe','describe','/opencontacts','isAuthenticated','getOpenContacts','/:id','show','post','/preview','getPreview','put','destroy','multer','util'];(function(_0x4c9d50,_0x118495){var _0x3f97e4=function(_0x405f52){while(--_0x405f52){_0x4c9d50['push'](_0x4c9d50['shift']());}};_0x3f97e4(++_0x118495);}(_0xafcd,0x157));var _0xdafc=function(_0x1ca9eb,_0x99a10b){_0x1ca9eb=_0x1ca9eb-0x0;var _0x2e284e=_0xafcd[_0x1ca9eb];return _0x2e284e;};'use strict';var multer=require(_0xdafc('0x0'));var util=require(_0xdafc('0x1'));var path=require(_0xdafc('0x2'));var timeout=require(_0xdafc('0x3'));var express=require(_0xdafc('0x4'));var router=express[_0xdafc('0x5')]();var auth=require(_0xdafc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdafc('0x7'));var controller=require(_0xdafc('0x8'));router[_0xdafc('0x9')]('/',auth['isAuthenticated'](),controller[_0xdafc('0xa')]);router[_0xdafc('0x9')](_0xdafc('0xb'),auth['isAuthenticated'](),controller[_0xdafc('0xc')]);router[_0xdafc('0x9')](_0xdafc('0xd'),auth[_0xdafc('0xe')](),controller[_0xdafc('0xf')]);router[_0xdafc('0x9')](_0xdafc('0x10'),auth[_0xdafc('0xe')](),controller[_0xdafc('0x11')]);router[_0xdafc('0x12')]('/',auth[_0xdafc('0xe')](),controller['create']);router['post'](_0xdafc('0x13'),auth[_0xdafc('0xe')](),controller[_0xdafc('0x14')]);router[_0xdafc('0x15')](_0xdafc('0x10'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xdafc('0x10'),auth['isAuthenticated'](),controller[_0xdafc('0x16')]);module['exports']=router; \ No newline at end of file +var _0x6f75=['../../config/environment','./cmHopper.controller','get','/describe','isAuthenticated','getOpenContacts','/:id','show','post','create','/preview','getPreview','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0x6f75,0x71));var _0x56f7=function(_0x44f26d,_0x10af74){_0x44f26d=_0x44f26d-0x0;var _0x45b98c=_0x6f75[_0x44f26d];return _0x45b98c;};'use strict';var multer=require(_0x56f7('0x0'));var util=require(_0x56f7('0x1'));var path=require(_0x56f7('0x2'));var timeout=require(_0x56f7('0x3'));var express=require(_0x56f7('0x4'));var router=express[_0x56f7('0x5')]();var auth=require(_0x56f7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x56f7('0x7'));var controller=require(_0x56f7('0x8'));router[_0x56f7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x56f7('0xa'),auth[_0x56f7('0xb')](),controller['describe']);router[_0x56f7('0x9')]('/opencontacts',auth['isAuthenticated'](),controller[_0x56f7('0xc')]);router[_0x56f7('0x9')](_0x56f7('0xd'),auth[_0x56f7('0xb')](),controller[_0x56f7('0xe')]);router[_0x56f7('0xf')]('/',auth[_0x56f7('0xb')](),controller[_0x56f7('0x10')]);router[_0x56f7('0xf')](_0x56f7('0x11'),auth[_0x56f7('0xb')](),controller[_0x56f7('0x12')]);router[_0x56f7('0x13')](_0x56f7('0xd'),auth['isAuthenticated'](),controller[_0x56f7('0x14')]);router[_0x56f7('0x15')](_0x56f7('0xd'),auth[_0x56f7('0xb')](),controller[_0x56f7('0x16')]);module[_0x56f7('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 44780c8..b443cd0 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf36c=['DATE','sequelize','exports','INTEGER'];(function(_0x578887,_0x5b9cb7){var _0x3a61d3=function(_0x1117a2){while(--_0x1117a2){_0x578887['push'](_0x578887['shift']());}};_0x3a61d3(++_0x5b9cb7);}(_0xf36c,0x95));var _0xcf36=function(_0xe82a9e,_0x11f6cd){_0xe82a9e=_0xe82a9e-0x0;var _0x4abfe7=_0xf36c[_0xe82a9e];return _0x4abfe7;};'use strict';var moment=require('moment');var Sequelize=require(_0xcf36('0x0'));module[_0xcf36('0x1')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xcf36('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xcf36('0x3')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xcf36('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcf36('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xcf36('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcf36('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x99c9=['DATE','format','moment','exports','INTEGER','STRING'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0x99c9,0x1be));var _0x999c=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x99c9[_0x4e676e];return _0x336a3c;};'use strict';var moment=require(_0x999c('0x0'));var Sequelize=require('sequelize');module[_0x999c('0x1')]={'CmHopperId':{'type':Sequelize[_0x999c('0x2')]},'phone':{'type':Sequelize[_0x999c('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x999c('0x4')],'defaultValue':moment()[_0x999c('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x999c('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x999c('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x999c('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x999c('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x999c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index fad98bb..5c430d6 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9303=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','Content-Range','save','update','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','end','error','stack','name','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','zip-dir','request-promise','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../config/logger','api'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x9303,0xd7));var _0x3930=function(_0x75b25d,_0x3fbae3){_0x75b25d=_0x75b25d-0x0;var _0x3400de=_0x9303[_0x75b25d];return _0x3400de;};'use strict';var pdf=require(_0x3930('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3930('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3930('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3930('0x3'));var util=require(_0x3930('0x4'));var path=require(_0x3930('0x5'));var sox=require(_0x3930('0x6'));var csv=require('to-csv');var ejs=require(_0x3930('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3930('0x8'));var jsforce=require(_0x3930('0x9'));var deskjs=require(_0x3930('0xa'));var toCsv=require(_0x3930('0xb'));var querystring=require(_0x3930('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3930('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3930('0xe'))(_0x3930('0xf'));var utils=require(_0x3930('0x10'));var config=require(_0x3930('0x11'));var licenseUtil=require(_0x3930('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13b928,_0x55130d){_0x55130d=_0x55130d||0xcc;return function(_0x185659){if(_0x185659){return _0x13b928[_0x3930('0x13')](_0x55130d);}return _0x13b928[_0x3930('0x14')](_0x55130d)['end']();};}function respondWithResult(_0x11b256,_0x15f039){_0x15f039=_0x15f039||0xc8;return function(_0x4ef6c4){if(_0x4ef6c4){return _0x11b256[_0x3930('0x14')](_0x15f039)[_0x3930('0x15')](_0x4ef6c4);}};}function respondWithFilteredResult(_0x3bc35e,_0x135498){return function(_0x5db060){if(_0x5db060){var _0x55ec9b=_0x5db060['count'],_0x3a2ac0=_0x135498[_0x3930('0x16')],_0x49468d=_0x135498[_0x3930('0x16')]+_0x135498['limit'],_0x2a2562;if(_0x49468d>=_0x55ec9b){_0x49468d=_0x55ec9b;_0x2a2562=0xc8;}else{_0x2a2562=0xce;}_0x3bc35e['status'](_0x2a2562);return _0x3bc35e['set'](_0x3930('0x17'),_0x3a2ac0+'-'+_0x49468d+'/'+_0x55ec9b)[_0x3930('0x15')](_0x5db060);}return null;};}function patchUpdates(_0x41f3b5){return function(_0x5b5f55){try{jsonpatch['apply'](_0x5b5f55,_0x41f3b5,!![]);}catch(_0x4f4e2e){return BPromise['reject'](_0x4f4e2e);}return _0x5b5f55[_0x3930('0x18')]();};}function saveUpdates(_0x2ba9ba,_0x2e650d){return function(_0x31938b){if(_0x31938b){return _0x31938b[_0x3930('0x19')](_0x2ba9ba)['then'](function(_0x1e19c3){return _0x1e19c3;});}return null;};}function removeEntity(_0x315f73,_0x1c5f4a){return function(_0x4a4307){if(_0x4a4307){return _0x4a4307[_0x3930('0x1a')]()[_0x3930('0x1b')](function(){var _0x12eeb7=_0x4a4307[_0x3930('0x1c')]({'plain':!![]});var _0x2bcc3b=_0x3930('0x1d');return db[_0x3930('0x1e')][_0x3930('0x1a')]({'where':{'type':_0x2bcc3b,'resourceId':_0x12eeb7['id']}})['then'](function(){return _0x4a4307;});})[_0x3930('0x1b')](function(){_0x315f73[_0x3930('0x14')](0xcc)[_0x3930('0x1f')]();});}};}function handleEntityNotFound(_0x11358e,_0x454138){return function(_0x5b4c56){if(!_0x5b4c56){_0x11358e[_0x3930('0x13')](0x194);}return _0x5b4c56;};}function handleError(_0x7b6825,_0x2489e6){_0x2489e6=_0x2489e6||0x1f4;return function(_0x5b20a7){logger[_0x3930('0x20')](_0x5b20a7[_0x3930('0x21')]);if(_0x5b20a7[_0x3930('0x22')]){delete _0x5b20a7[_0x3930('0x22')];}_0x7b6825[_0x3930('0x14')](_0x2489e6)['send'](_0x5b20a7);};}exports[_0x3930('0x23')]=function(_0x121cce,_0xca904a){var _0x51ceb9={},_0x3b9168={},_0x46339d={'count':0x0,'rows':[]};var _0x63acd5=_[_0x3930('0x24')](db[_0x3930('0x25')][_0x3930('0x26')],function(_0xcd21b7){return{'name':_0xcd21b7[_0x3930('0x27')],'type':_0xcd21b7[_0x3930('0x28')][_0x3930('0x29')]};});_0x3b9168[_0x3930('0x2a')]=_[_0x3930('0x24')](_0x63acd5,_0x3930('0x22'));_0x3b9168[_0x3930('0x2b')]=_[_0x3930('0x2c')](_0x121cce[_0x3930('0x2b')]);_0x3b9168[_0x3930('0x2d')]=_[_0x3930('0x2e')](_0x3b9168[_0x3930('0x2a')],_0x3b9168[_0x3930('0x2b')]);_0x51ceb9['attributes']=_['intersection'](_0x3b9168['model'],qs[_0x3930('0x2f')](_0x121cce[_0x3930('0x2b')]['fields']));_0x51ceb9[_0x3930('0x30')]=_0x51ceb9[_0x3930('0x30')]['length']?_0x51ceb9[_0x3930('0x30')]:_0x3b9168['model'];if(!_0x121cce[_0x3930('0x2b')][_0x3930('0x31')](_0x3930('0x32'))){_0x51ceb9[_0x3930('0x33')]=qs[_0x3930('0x33')](_0x121cce[_0x3930('0x2b')][_0x3930('0x33')]);_0x51ceb9[_0x3930('0x16')]=qs[_0x3930('0x16')](_0x121cce[_0x3930('0x2b')][_0x3930('0x16')]);}_0x51ceb9[_0x3930('0x34')]=qs[_0x3930('0x35')](_0x121cce[_0x3930('0x2b')][_0x3930('0x35')]);_0x51ceb9[_0x3930('0x36')]=qs['filters'](_[_0x3930('0x37')](_0x121cce['query'],_0x3b9168[_0x3930('0x2d')]),_0x63acd5);if(_0x121cce['query'][_0x3930('0x38')]){_0x51ceb9['where']=_['merge'](_0x51ceb9[_0x3930('0x36')],{'$or':_[_0x3930('0x24')](_0x63acd5,function(_0x504cd6){if(_0x504cd6['type']!==_0x3930('0x39')){var _0x58bfe2={};_0x58bfe2[_0x504cd6[_0x3930('0x22')]]={'$like':'%'+_0x121cce[_0x3930('0x2b')][_0x3930('0x38')]+'%'};return _0x58bfe2;}})});}_0x51ceb9=_[_0x3930('0x3a')]({},_0x51ceb9,_0x121cce[_0x3930('0x3b')]);var _0x29ca47={'where':_0x51ceb9[_0x3930('0x36')]};return db[_0x3930('0x25')]['count'](_0x29ca47)['then'](function(_0xc821be){_0x46339d[_0x3930('0x3c')]=_0xc821be;if(_0x121cce['query']['includeAll']){_0x51ceb9[_0x3930('0x3d')]=[{'all':!![]}];}return db[_0x3930('0x25')][_0x3930('0x3e')](_0x51ceb9);})['then'](function(_0x5003fd){_0x46339d[_0x3930('0x3f')]=_0x5003fd;return _0x46339d;})[_0x3930('0x1b')](respondWithFilteredResult(_0xca904a,_0x51ceb9))[_0x3930('0x40')](handleError(_0xca904a,null));};exports[_0x3930('0x41')]=function(_0x5cc6d8,_0x5e7718){var _0x3c251d={'raw':!![],'where':{'id':_0x5cc6d8[_0x3930('0x42')]['id']}},_0x4a9d9c={};_0x4a9d9c[_0x3930('0x2a')]=_['keys'](db[_0x3930('0x25')]['rawAttributes']);_0x4a9d9c[_0x3930('0x2b')]=_[_0x3930('0x2c')](_0x5cc6d8[_0x3930('0x2b')]);_0x4a9d9c[_0x3930('0x2d')]=_[_0x3930('0x2e')](_0x4a9d9c[_0x3930('0x2a')],_0x4a9d9c[_0x3930('0x2b')]);_0x3c251d[_0x3930('0x30')]=_[_0x3930('0x2e')](_0x4a9d9c[_0x3930('0x2a')],qs[_0x3930('0x2f')](_0x5cc6d8[_0x3930('0x2b')][_0x3930('0x2f')]));_0x3c251d[_0x3930('0x30')]=_0x3c251d[_0x3930('0x30')]['length']?_0x3c251d[_0x3930('0x30')]:_0x4a9d9c[_0x3930('0x2a')];if(_0x5cc6d8[_0x3930('0x2b')][_0x3930('0x43')]){_0x3c251d[_0x3930('0x3d')]=[{'all':!![]}];}_0x3c251d=_[_0x3930('0x3a')]({},_0x3c251d,_0x5cc6d8['options']);return db[_0x3930('0x25')][_0x3930('0x44')](_0x3c251d)[_0x3930('0x1b')](handleEntityNotFound(_0x5e7718,null))[_0x3930('0x1b')](respondWithResult(_0x5e7718,null))['catch'](handleError(_0x5e7718,null));};exports[_0x3930('0x45')]=function(_0x5ae7fb,_0x168b40){return db['CmHopperAdditionalPhone']['create'](_0x5ae7fb[_0x3930('0x46')],{})[_0x3930('0x1b')](function(_0x5cbb07){var _0x2bdb26=_0x5ae7fb[_0x3930('0x47')][_0x3930('0x1c')]({'plain':!![]});if(!_0x2bdb26)throw new Error(_0x3930('0x48'));if(_0x2bdb26['role']===_0x3930('0x47')){var _0x5a1a23=_0x5cbb07[_0x3930('0x1c')]({'plain':!![]});var _0x6a4764='CmHopperAdditionalPhones';return db[_0x3930('0x49')][_0x3930('0x44')]({'where':{'name':_0x6a4764,'userProfileId':_0x2bdb26[_0x3930('0x4a')]},'raw':!![]})[_0x3930('0x1b')](function(_0x338b5f){if(_0x338b5f&&_0x338b5f[_0x3930('0x4b')]===0x0){return db['UserProfileResource'][_0x3930('0x45')]({'name':_0x5a1a23[_0x3930('0x22')],'resourceId':_0x5a1a23['id'],'type':_0x338b5f['name'],'sectionId':_0x338b5f['id']},{})[_0x3930('0x1b')](function(){return _0x5cbb07;});}else{return _0x5cbb07;}})['catch'](function(_0x28d074){logger[_0x3930('0x20')](_0x3930('0x4c'),_0x28d074);throw _0x28d074;});}return _0x5cbb07;})[_0x3930('0x1b')](respondWithResult(_0x168b40,0xc9))['catch'](handleError(_0x168b40,null));};exports[_0x3930('0x19')]=function(_0x1e320b,_0x331ad3){if(_0x1e320b[_0x3930('0x46')]['id']){delete _0x1e320b[_0x3930('0x46')]['id'];}return db[_0x3930('0x25')][_0x3930('0x44')]({'where':{'id':_0x1e320b[_0x3930('0x42')]['id']}})[_0x3930('0x1b')](handleEntityNotFound(_0x331ad3,null))[_0x3930('0x1b')](saveUpdates(_0x1e320b['body'],null))[_0x3930('0x1b')](respondWithResult(_0x331ad3,null))[_0x3930('0x40')](handleError(_0x331ad3,null));};exports[_0x3930('0x1a')]=function(_0x5841af,_0x430e8c){return db['CmHopperAdditionalPhone'][_0x3930('0x44')]({'where':{'id':_0x5841af['params']['id']}})[_0x3930('0x1b')](handleEntityNotFound(_0x430e8c,null))[_0x3930('0x1b')](removeEntity(_0x430e8c,null))[_0x3930('0x40')](handleError(_0x430e8c,null));}; \ No newline at end of file +var _0x78f4=['index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','UserProfileResource','stack','name','send'];(function(_0x146155,_0x5f30f4){var _0xbe70a5=function(_0xdf2f65){while(--_0xdf2f65){_0x146155['push'](_0x146155['shift']());}};_0xbe70a5(++_0x5f30f4);}(_0x78f4,0x1c8));var _0x478f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78f4[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x478f('0x0'));var rimraf=require(_0x478f('0x1'));var zipdir=require(_0x478f('0x2'));var jsonpatch=require(_0x478f('0x3'));var rp=require('request-promise');var moment=require(_0x478f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x478f('0x5'));var util=require(_0x478f('0x6'));var path=require(_0x478f('0x7'));var sox=require('sox');var csv=require(_0x478f('0x8'));var ejs=require(_0x478f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x478f('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x478f('0xb'));var toCsv=require('to-csv');var querystring=require(_0x478f('0xc'));var Papa=require(_0x478f('0xd'));var Redis=require(_0x478f('0xe'));var authService=require(_0x478f('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x478f('0x10'));var logger=require(_0x478f('0x11'))(_0x478f('0x12'));var utils=require(_0x478f('0x13'));var config=require(_0x478f('0x14'));var licenseUtil=require(_0x478f('0x15'));var db=require(_0x478f('0x16'))['db'];function respondWithStatusCode(_0x3c91d0,_0x551169){_0x551169=_0x551169||0xcc;return function(_0x1fbb84){if(_0x1fbb84){return _0x3c91d0[_0x478f('0x17')](_0x551169);}return _0x3c91d0[_0x478f('0x18')](_0x551169)[_0x478f('0x19')]();};}function respondWithResult(_0x165dfd,_0xbcfcb4){_0xbcfcb4=_0xbcfcb4||0xc8;return function(_0x41eaae){if(_0x41eaae){return _0x165dfd[_0x478f('0x18')](_0xbcfcb4)['json'](_0x41eaae);}};}function respondWithFilteredResult(_0x3de264,_0x1c8990){return function(_0x36e13a){if(_0x36e13a){var _0x2f1266=_0x36e13a[_0x478f('0x1a')],_0x528142=_0x1c8990[_0x478f('0x1b')],_0x10e21d=_0x1c8990['offset']+_0x1c8990[_0x478f('0x1c')],_0x4f2aeb;if(_0x10e21d>=_0x2f1266){_0x10e21d=_0x2f1266;_0x4f2aeb=0xc8;}else{_0x4f2aeb=0xce;}_0x3de264['status'](_0x4f2aeb);return _0x3de264[_0x478f('0x1d')](_0x478f('0x1e'),_0x528142+'-'+_0x10e21d+'/'+_0x2f1266)[_0x478f('0x1f')](_0x36e13a);}return null;};}function patchUpdates(_0x23b455){return function(_0x3c4b01){try{jsonpatch[_0x478f('0x20')](_0x3c4b01,_0x23b455,!![]);}catch(_0x3e97d2){return BPromise[_0x478f('0x21')](_0x3e97d2);}return _0x3c4b01[_0x478f('0x22')]();};}function saveUpdates(_0x341cd0,_0x47160a){return function(_0x427a8a){if(_0x427a8a){return _0x427a8a[_0x478f('0x23')](_0x341cd0)[_0x478f('0x24')](function(_0x185706){return _0x185706;});}return null;};}function removeEntity(_0x32b512,_0x424427){return function(_0x3b92f5){if(_0x3b92f5){return _0x3b92f5[_0x478f('0x25')]()[_0x478f('0x24')](function(){var _0x4e4a2d=_0x3b92f5['get']({'plain':!![]});var _0x3934b4='CmHopperAdditionalPhones';return db[_0x478f('0x26')][_0x478f('0x25')]({'where':{'type':_0x3934b4,'resourceId':_0x4e4a2d['id']}})[_0x478f('0x24')](function(){return _0x3b92f5;});})[_0x478f('0x24')](function(){_0x32b512[_0x478f('0x18')](0xcc)[_0x478f('0x19')]();});}};}function handleEntityNotFound(_0x4ced66,_0x5ecfd8){return function(_0x65ef4){if(!_0x65ef4){_0x4ced66['sendStatus'](0x194);}return _0x65ef4;};}function handleError(_0x1c0e91,_0x49cb67){_0x49cb67=_0x49cb67||0x1f4;return function(_0x101952){logger['error'](_0x101952[_0x478f('0x27')]);if(_0x101952[_0x478f('0x28')]){delete _0x101952[_0x478f('0x28')];}_0x1c0e91[_0x478f('0x18')](_0x49cb67)[_0x478f('0x29')](_0x101952);};}exports[_0x478f('0x2a')]=function(_0x4e48cd,_0x238967){var _0x28b7b0={},_0x2f9384={},_0x892248={'count':0x0,'rows':[]};var _0xc4e899=_[_0x478f('0x2b')](db[_0x478f('0x2c')][_0x478f('0x2d')],function(_0x3aff4e){return{'name':_0x3aff4e[_0x478f('0x2e')],'type':_0x3aff4e[_0x478f('0x2f')]['key']};});_0x2f9384[_0x478f('0x30')]=_[_0x478f('0x2b')](_0xc4e899,'name');_0x2f9384[_0x478f('0x31')]=_[_0x478f('0x32')](_0x4e48cd[_0x478f('0x31')]);_0x2f9384[_0x478f('0x33')]=_[_0x478f('0x34')](_0x2f9384[_0x478f('0x30')],_0x2f9384['query']);_0x28b7b0[_0x478f('0x35')]=_[_0x478f('0x34')](_0x2f9384[_0x478f('0x30')],qs[_0x478f('0x36')](_0x4e48cd[_0x478f('0x31')][_0x478f('0x36')]));_0x28b7b0[_0x478f('0x35')]=_0x28b7b0['attributes'][_0x478f('0x37')]?_0x28b7b0[_0x478f('0x35')]:_0x2f9384[_0x478f('0x30')];if(!_0x4e48cd[_0x478f('0x31')][_0x478f('0x38')](_0x478f('0x39'))){_0x28b7b0[_0x478f('0x1c')]=qs[_0x478f('0x1c')](_0x4e48cd['query'][_0x478f('0x1c')]);_0x28b7b0[_0x478f('0x1b')]=qs['offset'](_0x4e48cd[_0x478f('0x31')]['offset']);}_0x28b7b0[_0x478f('0x3a')]=qs[_0x478f('0x3b')](_0x4e48cd['query'][_0x478f('0x3b')]);_0x28b7b0[_0x478f('0x3c')]=qs[_0x478f('0x33')](_['pick'](_0x4e48cd['query'],_0x2f9384[_0x478f('0x33')]),_0xc4e899);if(_0x4e48cd[_0x478f('0x31')][_0x478f('0x3d')]){_0x28b7b0[_0x478f('0x3c')]=_[_0x478f('0x3e')](_0x28b7b0['where'],{'$or':_['map'](_0xc4e899,function(_0x34d65c){if(_0x34d65c[_0x478f('0x2f')]!=='VIRTUAL'){var _0x59c805={};_0x59c805[_0x34d65c[_0x478f('0x28')]]={'$like':'%'+_0x4e48cd[_0x478f('0x31')][_0x478f('0x3d')]+'%'};return _0x59c805;}})});}_0x28b7b0=_[_0x478f('0x3e')]({},_0x28b7b0,_0x4e48cd[_0x478f('0x3f')]);var _0x30c32d={'where':_0x28b7b0[_0x478f('0x3c')]};return db[_0x478f('0x2c')][_0x478f('0x1a')](_0x30c32d)[_0x478f('0x24')](function(_0x185413){_0x892248['count']=_0x185413;if(_0x4e48cd[_0x478f('0x31')][_0x478f('0x40')]){_0x28b7b0['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x478f('0x41')](_0x28b7b0);})[_0x478f('0x24')](function(_0x21c13d){_0x892248[_0x478f('0x42')]=_0x21c13d;return _0x892248;})[_0x478f('0x24')](respondWithFilteredResult(_0x238967,_0x28b7b0))['catch'](handleError(_0x238967,null));};exports[_0x478f('0x43')]=function(_0x74793e,_0x348bae){var _0x1697ad={'raw':!![],'where':{'id':_0x74793e[_0x478f('0x44')]['id']}},_0xc46353={};_0xc46353['model']=_['keys'](db[_0x478f('0x2c')][_0x478f('0x2d')]);_0xc46353[_0x478f('0x31')]=_[_0x478f('0x32')](_0x74793e[_0x478f('0x31')]);_0xc46353['filters']=_['intersection'](_0xc46353['model'],_0xc46353[_0x478f('0x31')]);_0x1697ad['attributes']=_[_0x478f('0x34')](_0xc46353[_0x478f('0x30')],qs[_0x478f('0x36')](_0x74793e[_0x478f('0x31')][_0x478f('0x36')]));_0x1697ad['attributes']=_0x1697ad[_0x478f('0x35')][_0x478f('0x37')]?_0x1697ad[_0x478f('0x35')]:_0xc46353[_0x478f('0x30')];if(_0x74793e['query'][_0x478f('0x40')]){_0x1697ad[_0x478f('0x45')]=[{'all':!![]}];}_0x1697ad=_[_0x478f('0x3e')]({},_0x1697ad,_0x74793e['options']);return db['CmHopperAdditionalPhone'][_0x478f('0x46')](_0x1697ad)[_0x478f('0x24')](handleEntityNotFound(_0x348bae,null))[_0x478f('0x24')](respondWithResult(_0x348bae,null))[_0x478f('0x47')](handleError(_0x348bae,null));};exports[_0x478f('0x48')]=function(_0x5cb7fc,_0x5769b1){return db[_0x478f('0x2c')][_0x478f('0x48')](_0x5cb7fc['body'],{})[_0x478f('0x24')](function(_0x1c8e53){var _0x465364=_0x5cb7fc[_0x478f('0x49')][_0x478f('0x4a')]({'plain':!![]});if(!_0x465364)throw new Error(_0x478f('0x4b'));if(_0x465364[_0x478f('0x4c')]===_0x478f('0x49')){var _0x249d01=_0x1c8e53[_0x478f('0x4a')]({'plain':!![]});var _0x3bd9bf=_0x478f('0x4d');return db['UserProfileSection'][_0x478f('0x46')]({'where':{'name':_0x3bd9bf,'userProfileId':_0x465364[_0x478f('0x4e')]},'raw':!![]})['then'](function(_0x27bf73){if(_0x27bf73&&_0x27bf73[_0x478f('0x4f')]===0x0){return db[_0x478f('0x26')][_0x478f('0x48')]({'name':_0x249d01['name'],'resourceId':_0x249d01['id'],'type':_0x27bf73[_0x478f('0x28')],'sectionId':_0x27bf73['id']},{})[_0x478f('0x24')](function(){return _0x1c8e53;});}else{return _0x1c8e53;}})[_0x478f('0x47')](function(_0x9ed68d){logger[_0x478f('0x50')](_0x478f('0x51'),_0x9ed68d);throw _0x9ed68d;});}return _0x1c8e53;})[_0x478f('0x24')](respondWithResult(_0x5769b1,0xc9))[_0x478f('0x47')](handleError(_0x5769b1,null));};exports['update']=function(_0xccd14b,_0x55c00c){if(_0xccd14b[_0x478f('0x52')]['id']){delete _0xccd14b[_0x478f('0x52')]['id'];}return db[_0x478f('0x2c')]['find']({'where':{'id':_0xccd14b['params']['id']}})['then'](handleEntityNotFound(_0x55c00c,null))['then'](saveUpdates(_0xccd14b[_0x478f('0x52')],null))[_0x478f('0x24')](respondWithResult(_0x55c00c,null))[_0x478f('0x47')](handleError(_0x55c00c,null));};exports[_0x478f('0x25')]=function(_0x55afe2,_0x527363){return db[_0x478f('0x2c')][_0x478f('0x46')]({'where':{'id':_0x55afe2[_0x478f('0x44')]['id']}})[_0x478f('0x24')](handleEntityNotFound(_0x527363,null))[_0x478f('0x24')](removeEntity(_0x527363,null))[_0x478f('0x47')](handleError(_0x527363,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 7b12bdd..793c087 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7e8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','../../config/logger','api'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xd7e8,0x99));var _0x8d7e=function(_0x5a44db,_0x3a2b55){_0x5a44db=_0x5a44db-0x0;var _0x542972=_0xd7e8[_0x5a44db];return _0x542972;};'use strict';var _=require(_0x8d7e('0x0'));var util=require('util');var logger=require(_0x8d7e('0x1'))(_0x8d7e('0x2'));var moment=require(_0x8d7e('0x3'));var BPromise=require(_0x8d7e('0x4'));var rp=require(_0x8d7e('0x5'));var fs=require('fs');var path=require(_0x8d7e('0x6'));var rimraf=require(_0x8d7e('0x7'));var config=require(_0x8d7e('0x8'));var attributes=require(_0x8d7e('0x9'));module[_0x8d7e('0xa')]=function(_0x3501a1,_0x329b43){return _0x3501a1['define'](_0x8d7e('0xb'),attributes,{'tableName':_0x8d7e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe004=['define','CmHopperAdditionalPhone','util','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports'];(function(_0x442d83,_0x41c218){var _0x5651be=function(_0x24dc9e){while(--_0x24dc9e){_0x442d83['push'](_0x442d83['shift']());}};_0x5651be(++_0x41c218);}(_0xe004,0x1a4));var _0x4e00=function(_0x6545ca,_0x5f257f){_0x6545ca=_0x6545ca-0x0;var _0x5f3bfe=_0xe004[_0x6545ca];return _0x5f3bfe;};'use strict';var _=require('lodash');var util=require(_0x4e00('0x0'));var logger=require('../../config/logger')(_0x4e00('0x1'));var moment=require(_0x4e00('0x2'));var BPromise=require(_0x4e00('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e00('0x4'));var rimraf=require(_0x4e00('0x5'));var config=require(_0x4e00('0x6'));var attributes=require(_0x4e00('0x7'));module[_0x4e00('0x8')]=function(_0x38bbd1,_0x4bc449){return _0x38bbd1[_0x4e00('0x9')](_0x4e00('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index e46730a..aee147f 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa561=['../../config/logger','../../config/environment','jayson/promise','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','OrderBy','ASC','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','findOne','countbusyretry','countnoanswerretry','countagentrejectretry','SwapAdditionalPhones','CampaignId','duration','info','scheduledat','minutes','add','phone','createdAt','isNil','updatedAt','additionalToHop','sequelize','transaction','update','IncrementPreviewCounters','field','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x480702,_0x5471f4){var _0x27ad31=function(_0x278969){while(--_0x278969){_0x480702['push'](_0x480702['shift']());}};_0x27ad31(++_0x5471f4);}(_0xa561,0xda));var _0x1a56=function(_0x5d91ab,_0x327a49){_0x5d91ab=_0x5d91ab-0x0;var _0x448045=_0xa561[_0x5d91ab];return _0x448045;};'use strict';var _=require('lodash');var util=require(_0x1a56('0x0'));var moment=require(_0x1a56('0x1'));var BPromise=require(_0x1a56('0x2'));var rs=require(_0x1a56('0x3'));var fs=require('fs');var Redis=require(_0x1a56('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a56('0x5'));var logger=require(_0x1a56('0x6'))('rpc');var config=require(_0x1a56('0x7'));var jayson=require(_0x1a56('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5db881,_0x39ec4b,_0xef7a5b){return new BPromise(function(_0x45e3d5,_0x5d7d90){return client[_0x1a56('0x9')](_0x5db881,_0xef7a5b)[_0x1a56('0xa')](function(_0x198867){logger['info'](_0x1a56('0xb'),_0x39ec4b,_0x1a56('0xc'));logger['debug'](_0x1a56('0xd'),_0x39ec4b,_0x1a56('0xc'),JSON['stringify'](_0x198867));if(_0x198867[_0x1a56('0xe')]){if(_0x198867[_0x1a56('0xe')][_0x1a56('0xf')]===0x1f4){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x39ec4b,_0x198867['error']['message']);return _0x5d7d90(_0x198867[_0x1a56('0xe')][_0x1a56('0x10')]);}logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x39ec4b,_0x198867['error'][_0x1a56('0x10')]);return _0x45e3d5(_0x198867[_0x1a56('0xe')][_0x1a56('0x10')]);}else{logger['info'](_0x1a56('0xb'),_0x39ec4b,_0x1a56('0xc'));_0x45e3d5(_0x198867[_0x1a56('0x11')][_0x1a56('0x10')]);}})[_0x1a56('0x12')](function(_0x545371){logger[_0x1a56('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x39ec4b,_0x545371);_0x5d7d90(_0x545371);});});}exports[_0x1a56('0x13')]=function(_0x95b051){var _0x2405a2=this;return new Promise(function(_0x5a7396,_0x1f7a9a){return db[_0x1a56('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0x95b051[_0x1a56('0x15')][_0x1a56('0x16')],'ListId':_0x95b051[_0x1a56('0x15')][_0x1a56('0x17')],'VoiceQueueId':_0x95b051['body'][_0x1a56('0x18')]===undefined?null:_0x95b051[_0x1a56('0x15')][_0x1a56('0x18')],'CampaignId':_0x95b051['body']['CampaignId']===undefined?null:_0x95b051[_0x1a56('0x15')]['CampaignId']}})[_0x1a56('0xa')](function(_0xa2184c){if(_0xa2184c!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0xa2184c['id'],'OrderBy':{'$gt':_0xa2184c['OrderBy']}},'order':[[_0x1a56('0x19'),_0x1a56('0x1a')]]})[_0x1a56('0xa')](function(_0x5c16ab){var _0x5a037f=0x0;if(_0x5c16ab){if(_0x5c16ab['countbusyretry']+_0x5c16ab[_0x1a56('0x1b')]+_0x5c16ab['countnoanswerretry']+_0x5c16ab[_0x1a56('0x1c')]+_0x5c16ab[_0x1a56('0x1d')]+_0x5c16ab[_0x1a56('0x1e')]+_0x5c16ab[_0x1a56('0x1f')]+_0x5c16ab['countagentrejectretry']<_0x95b051[_0x1a56('0x20')][_0x1a56('0x21')])_0x5a037f=0x1;_0x5a7396({'additional':_0x5a037f});}else{return db[_0x1a56('0x22')][_0x1a56('0x23')]({'raw':!![],'where':{'CmHopperId':_0xa2184c['id']},'order':[[_0x1a56('0x19'),_0x1a56('0x1a')]]})[_0x1a56('0xa')](function(_0xe8347a){var _0x2bca2e=0x0;if(_0xe8347a){if(_0xe8347a[_0x1a56('0x24')]+_0xe8347a['countcongestionretry']+_0xe8347a[_0x1a56('0x25')]+_0xe8347a[_0x1a56('0x1c')]+_0xe8347a['countdropretry']+_0xe8347a['countabandonedretry']+_0xe8347a[_0x1a56('0x1f')]+_0xe8347a[_0x1a56('0x26')]<_0x95b051[_0x1a56('0x20')][_0x1a56('0x21')])_0x2bca2e=0x1;_0x5a7396({'additional':_0x2bca2e});}else{_0x5a7396({'additional':0x0});}})[_0x1a56('0x12')](function(_0x557016){logger[_0x1a56('0xe')](_0x1a56('0x13'),_0x557016[_0x1a56('0x10')],_0x95b051);_0x1f7a9a(_0x2405a2[_0x1a56('0xe')](0x1f4,_0x557016[_0x1a56('0x10')]));});}})[_0x1a56('0x12')](function(_0xdeeb0e){logger['error']('VerifyAdditionalPhones',_0xdeeb0e[_0x1a56('0x10')],_0x95b051);_0x1f7a9a(_0x2405a2[_0x1a56('0xe')](0x1f4,_0xdeeb0e['message']));});}else _0x5a7396({'additional':0x0});});});};exports[_0x1a56('0x27')]=function(_0x23e626){var _0x2bc945=this;return new Promise(function(_0x5b7ff6,_0x4e4366){return db[_0x1a56('0x14')][_0x1a56('0x23')]({'raw':!![],'where':{'ContactId':_0x23e626[_0x1a56('0x15')][_0x1a56('0x16')],'ListId':_0x23e626[_0x1a56('0x15')][_0x1a56('0x17')],'VoiceQueueId':_0x23e626[_0x1a56('0x15')][_0x1a56('0x18')]===undefined?null:_0x23e626[_0x1a56('0x15')]['VoiceQueueId'],'CampaignId':_0x23e626[_0x1a56('0x15')][_0x1a56('0x28')]===undefined?null:_0x23e626['body']['CampaignId']}})['then'](function(_0x3f048f){if(_0x3f048f!=null){return db[_0x1a56('0x22')][_0x1a56('0x23')]({'raw':!![],'where':{'CmHopperId':_0x3f048f['id'],'OrderBy':{'$gt':_0x3f048f[_0x1a56('0x19')]}},'order':[[_0x1a56('0x19'),_0x1a56('0x1a')]]})[_0x1a56('0xa')](function(_0x7e76f5){if(_0x7e76f5)return activateAdditionalPhone(_0x3f048f,_0x23e626[_0x1a56('0x15')],_0x7e76f5,_0x23e626[_0x1a56('0x29')],_0x23e626['waitTime'])[_0x1a56('0xa')](function(_0x345613){_0x5b7ff6(_0x345613);});else{return db[_0x1a56('0x22')][_0x1a56('0x23')]({'raw':!![],'where':{'CmHopperId':_0x3f048f['id']},'order':[[_0x1a56('0x19'),_0x1a56('0x1a')]]})[_0x1a56('0xa')](function(_0x50c526){if(_0x50c526)return activateAdditionalPhone(_0x3f048f,_0x23e626[_0x1a56('0x15')],_0x50c526,_0x23e626['duration'],_0x23e626['waitTime'])[_0x1a56('0xa')](function(_0x4ec5f8){_0x5b7ff6(_0x4ec5f8);});else{_0x5b7ff6({'id':_0x3f048f['id'],'phone':''});}})['catch'](function(_0x9bb0f1){logger['error'](_0x1a56('0x13'),_0x9bb0f1['message'],_0x23e626);_0x4e4366(_0x2bc945[_0x1a56('0xe')](0x1f4,_0x9bb0f1[_0x1a56('0x10')]));});}})[_0x1a56('0x12')](function(_0x39bec6){logger[_0x1a56('0xe')]('VerifyAdditionalPhones',_0x39bec6[_0x1a56('0x10')],_0x23e626);_0x4e4366(_0x2bc945[_0x1a56('0xe')](0x1f4,_0x39bec6[_0x1a56('0x10')]));});}else _0x5b7ff6(0x1);});});};function activateAdditionalPhone(_0x4b69c8,_0x1f9331,_0x4a7a53,_0x31c9db,_0x15e23b){return new Promise(function(_0x26f540,_0x5d86a3){logger[_0x1a56('0x2a')](_0x1a56('0x13'),_0x4a7a53);var _0x13f569;if(moment()>moment(_0x4a7a53[_0x1a56('0x2b')])){_0x13f569=moment()['add'](_0x15e23b||0x3,_0x1a56('0x2c'));}else{if(_0x4a7a53[_0x1a56('0x19')]==0x0){_0x13f569=moment(_0x4a7a53[_0x1a56('0x2b')]);}else{_0x13f569=moment()[_0x1a56('0x2d')](_0x15e23b||0x3,_0x1a56('0x2c'));}}var _0x59aac7={'phone':_0x4b69c8[_0x1a56('0x2e')],'active':0x0,'OrderBy':_['isNil'](_0x4b69c8[_0x1a56('0x19')])?0x0:_0x4b69c8[_0x1a56('0x19')],'scheduledat':moment()['add'](_0x31c9db||0x1,_0x1a56('0x2c')),'countbusyretry':_0x1f9331[_0x1a56('0x24')],'countcongestionretry':_0x1f9331[_0x1a56('0x1b')],'countnoanswerretry':_0x1f9331[_0x1a56('0x25')],'countnosuchnumberretry':_0x1f9331[_0x1a56('0x1c')],'countdropretry':_0x1f9331[_0x1a56('0x1d')],'countabandonedretry':_0x1f9331[_0x1a56('0x1e')],'countmachineretry':_0x1f9331[_0x1a56('0x1f')],'countagentrejectretry':_0x1f9331[_0x1a56('0x26')],'createdAt':_0x1f9331[_0x1a56('0x2f')],'updatedAt':_0x1f9331['updatedAt']};var _0x1f3491={'CmHopperId':_0x4b69c8['id'],'phone':_0x4a7a53[_0x1a56('0x2e')],'active':0x0,'OrderBy':_[_0x1a56('0x30')](_0x4a7a53['OrderBy'])?0x0:_0x4a7a53[_0x1a56('0x19')],'scheduledat':_0x13f569,'countbusyretry':_0x4a7a53[_0x1a56('0x24')],'countcongestionretry':_0x4a7a53[_0x1a56('0x1b')],'countnoanswerretry':_0x4a7a53[_0x1a56('0x25')],'countnosuchnumberretry':_0x1f9331[_0x1a56('0x1c')],'countdropretry':_0x1f9331[_0x1a56('0x1d')],'countabandonedretry':_0x1f9331[_0x1a56('0x1e')],'countmachineretry':_0x1f9331[_0x1a56('0x1f')],'countagentrejectretry':_0x1f9331[_0x1a56('0x26')],'createdAt':_0x4a7a53[_0x1a56('0x2f')],'updatedAt':_0x4a7a53[_0x1a56('0x31')]};logger[_0x1a56('0x2a')]('hopperToAdd',_0x59aac7);logger[_0x1a56('0x2a')](_0x1a56('0x32'),_0x1f3491);return db[_0x1a56('0x33')][_0x1a56('0x34')](function(_0x148168){return db[_0x1a56('0x22')][_0x1a56('0x35')](_0x59aac7,{'where':{'id':_0x4a7a53['id']}},{'transaction':_0x148168})[_0x1a56('0xa')](function(){return db[_0x1a56('0x14')][_0x1a56('0x35')](_0x1f3491,{'where':{'id':_0x4b69c8['id']}},{'transaction':_0x148168});});})[_0x1a56('0xa')](function(_0x4036a4){_0x26f540({'id':_0x4b69c8['id'],'phone':_0x4a7a53[_0x1a56('0x2e')]});})['catch'](function(_0xd4b096){logger[_0x1a56('0xe')]('VerifyAdditionalPhones',_0xd4b096[_0x1a56('0x10')],req);_0x5d86a3(_this[_0x1a56('0xe')](0x1f4,_0xd4b096[_0x1a56('0x10')]));});});}exports[_0x1a56('0x36')]=function(_0x41579a){var _0x1867ac=this;return new Promise(function(_0x3e536f,_0x23125c){return db[_0x1a56('0x14')]['update'](_0x41579a['body'][_0x1a56('0x37')],{'where':{'id':_0x41579a[_0x1a56('0x15')]['id']}})[_0x1a56('0xa')](function(_0x3e20fd){_0x3e536f(_0x3e20fd);})[_0x1a56('0x12')](function(_0x315919){logger[_0x1a56('0xe')](_0x1a56('0x36'),_0x315919['message'],_0x41579a);_0x23125c(_0x1867ac['error'](0x1f4,_0x315919[_0x1a56('0x10')]));});});}; \ No newline at end of file +var _0xcae9=['updatedAt','additionalToHop','sequelize','update','IncrementPreviewCounters','field','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','request\x20sent','debug','stringify','error','code','message','CmHopperAdditionalPhone,\x20%s,\x20%s','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','CmHopperAdditionalPhone','countcongestionretry','countabandonedretry','entity','SwapAdditionalPhones','ListId','waitTime','scheduledat','add','minutes','phone','isNil','createdAt'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xcae9,0xe2));var _0x9cae=function(_0x15cae3,_0x458cb9){_0x15cae3=_0x15cae3-0x0;var _0x20596f=_0xcae9[_0x15cae3];return _0x20596f;};'use strict';var _=require(_0x9cae('0x0'));var util=require('util');var moment=require(_0x9cae('0x1'));var BPromise=require(_0x9cae('0x2'));var rs=require(_0x9cae('0x3'));var fs=require('fs');var Redis=require(_0x9cae('0x4'));var db=require(_0x9cae('0x5'))['db'];var utils=require(_0x9cae('0x6'));var logger=require(_0x9cae('0x7'))('rpc');var config=require(_0x9cae('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9cae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bf641,_0x52fe2f,_0x2b0a1b){return new BPromise(function(_0x1e600a,_0x3152c3){return client['request'](_0x3bf641,_0x2b0a1b)[_0x9cae('0xa')](function(_0x56b11e){logger[_0x9cae('0xb')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x52fe2f,_0x9cae('0xc'));logger[_0x9cae('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x52fe2f,_0x9cae('0xc'),JSON[_0x9cae('0xe')](_0x56b11e));if(_0x56b11e['error']){if(_0x56b11e[_0x9cae('0xf')][_0x9cae('0x10')]===0x1f4){logger[_0x9cae('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x52fe2f,_0x56b11e[_0x9cae('0xf')][_0x9cae('0x11')]);return _0x3152c3(_0x56b11e['error'][_0x9cae('0x11')]);}logger[_0x9cae('0xf')](_0x9cae('0x12'),_0x52fe2f,_0x56b11e[_0x9cae('0xf')][_0x9cae('0x11')]);return _0x1e600a(_0x56b11e[_0x9cae('0xf')]['message']);}else{logger[_0x9cae('0xb')](_0x9cae('0x12'),_0x52fe2f,_0x9cae('0xc'));_0x1e600a(_0x56b11e[_0x9cae('0x13')][_0x9cae('0x11')]);}})[_0x9cae('0x14')](function(_0x2952c5){logger[_0x9cae('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x52fe2f,_0x2952c5);_0x3152c3(_0x2952c5);});});}exports[_0x9cae('0x15')]=function(_0x473d30){var _0x1f5e73=this;return new Promise(function(_0x34d084,_0x5ea393){return db[_0x9cae('0x16')][_0x9cae('0x17')]({'raw':!![],'where':{'ContactId':_0x473d30[_0x9cae('0x18')]['ContactId'],'ListId':_0x473d30[_0x9cae('0x18')]['ListId'],'VoiceQueueId':_0x473d30['body']['VoiceQueueId']===undefined?null:_0x473d30[_0x9cae('0x18')][_0x9cae('0x19')],'CampaignId':_0x473d30[_0x9cae('0x18')][_0x9cae('0x1a')]===undefined?null:_0x473d30[_0x9cae('0x18')]['CampaignId']}})[_0x9cae('0xa')](function(_0x1efe82){if(_0x1efe82!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x1efe82['id'],'OrderBy':{'$gt':_0x1efe82[_0x9cae('0x1b')]}},'order':[[_0x9cae('0x1b'),_0x9cae('0x1c')]]})[_0x9cae('0xa')](function(_0x57a836){var _0xcb9b59=0x0;if(_0x57a836){if(_0x57a836[_0x9cae('0x1d')]+_0x57a836['countcongestionretry']+_0x57a836[_0x9cae('0x1e')]+_0x57a836[_0x9cae('0x1f')]+_0x57a836[_0x9cae('0x20')]+_0x57a836['countabandonedretry']+_0x57a836[_0x9cae('0x21')]+_0x57a836[_0x9cae('0x22')]<_0x473d30['entity'][_0x9cae('0x23')])_0xcb9b59=0x1;_0x34d084({'additional':_0xcb9b59});}else{return db[_0x9cae('0x24')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1efe82['id']},'order':[[_0x9cae('0x1b'),_0x9cae('0x1c')]]})[_0x9cae('0xa')](function(_0x34a77f){var _0x2a41ea=0x0;if(_0x34a77f){if(_0x34a77f[_0x9cae('0x1d')]+_0x34a77f[_0x9cae('0x25')]+_0x34a77f['countnoanswerretry']+_0x34a77f['countnosuchnumberretry']+_0x34a77f['countdropretry']+_0x34a77f[_0x9cae('0x26')]+_0x34a77f[_0x9cae('0x21')]+_0x34a77f['countagentrejectretry']<_0x473d30[_0x9cae('0x27')][_0x9cae('0x23')])_0x2a41ea=0x1;_0x34d084({'additional':_0x2a41ea});}else{_0x34d084({'additional':0x0});}})[_0x9cae('0x14')](function(_0x12750a){logger[_0x9cae('0xf')](_0x9cae('0x15'),_0x12750a[_0x9cae('0x11')],_0x473d30);_0x5ea393(_0x1f5e73[_0x9cae('0xf')](0x1f4,_0x12750a['message']));});}})[_0x9cae('0x14')](function(_0x48971a){logger[_0x9cae('0xf')](_0x9cae('0x15'),_0x48971a[_0x9cae('0x11')],_0x473d30);_0x5ea393(_0x1f5e73[_0x9cae('0xf')](0x1f4,_0x48971a['message']));});}else _0x34d084({'additional':0x0});});});};exports[_0x9cae('0x28')]=function(_0xc599af){var _0x4c3238=this;return new Promise(function(_0x38da2c,_0x5b0674){return db[_0x9cae('0x16')][_0x9cae('0x17')]({'raw':!![],'where':{'ContactId':_0xc599af[_0x9cae('0x18')]['ContactId'],'ListId':_0xc599af[_0x9cae('0x18')][_0x9cae('0x29')],'VoiceQueueId':_0xc599af[_0x9cae('0x18')][_0x9cae('0x19')]===undefined?null:_0xc599af[_0x9cae('0x18')]['VoiceQueueId'],'CampaignId':_0xc599af['body'][_0x9cae('0x1a')]===undefined?null:_0xc599af[_0x9cae('0x18')]['CampaignId']}})[_0x9cae('0xa')](function(_0x3fab11){if(_0x3fab11!=null){return db[_0x9cae('0x24')][_0x9cae('0x17')]({'raw':!![],'where':{'CmHopperId':_0x3fab11['id'],'OrderBy':{'$gt':_0x3fab11[_0x9cae('0x1b')]}},'order':[[_0x9cae('0x1b'),'ASC']]})[_0x9cae('0xa')](function(_0x4adae4){if(_0x4adae4)return activateAdditionalPhone(_0x3fab11,_0xc599af[_0x9cae('0x18')],_0x4adae4,_0xc599af['duration'],_0xc599af[_0x9cae('0x2a')])[_0x9cae('0xa')](function(_0x4755f9){_0x38da2c(_0x4755f9);});else{return db[_0x9cae('0x24')][_0x9cae('0x17')]({'raw':!![],'where':{'CmHopperId':_0x3fab11['id']},'order':[['OrderBy',_0x9cae('0x1c')]]})['then'](function(_0x37d80d){if(_0x37d80d)return activateAdditionalPhone(_0x3fab11,_0xc599af[_0x9cae('0x18')],_0x37d80d,_0xc599af['duration'],_0xc599af[_0x9cae('0x2a')])[_0x9cae('0xa')](function(_0x549f3e){_0x38da2c(_0x549f3e);});else{_0x38da2c({'id':_0x3fab11['id'],'phone':''});}})[_0x9cae('0x14')](function(_0x12617b){logger[_0x9cae('0xf')](_0x9cae('0x15'),_0x12617b[_0x9cae('0x11')],_0xc599af);_0x5b0674(_0x4c3238[_0x9cae('0xf')](0x1f4,_0x12617b[_0x9cae('0x11')]));});}})[_0x9cae('0x14')](function(_0xff8e0b){logger['error'](_0x9cae('0x15'),_0xff8e0b['message'],_0xc599af);_0x5b0674(_0x4c3238[_0x9cae('0xf')](0x1f4,_0xff8e0b['message']));});}else _0x38da2c(0x1);});});};function activateAdditionalPhone(_0x535e72,_0x3822d7,_0x23c514,_0x57e0ff,_0x44bc7a){return new Promise(function(_0x5002b5,_0x409b04){logger[_0x9cae('0xb')]('VerifyAdditionalPhones',_0x23c514);var _0x29e766;if(moment()>moment(_0x23c514[_0x9cae('0x2b')])){_0x29e766=moment()[_0x9cae('0x2c')](_0x44bc7a||0x3,_0x9cae('0x2d'));}else{if(_0x23c514['OrderBy']==0x0){_0x29e766=moment(_0x23c514[_0x9cae('0x2b')]);}else{_0x29e766=moment()[_0x9cae('0x2c')](_0x44bc7a||0x3,_0x9cae('0x2d'));}}var _0x1907f9={'phone':_0x535e72[_0x9cae('0x2e')],'active':0x0,'OrderBy':_[_0x9cae('0x2f')](_0x535e72[_0x9cae('0x1b')])?0x0:_0x535e72[_0x9cae('0x1b')],'scheduledat':moment()[_0x9cae('0x2c')](_0x57e0ff||0x1,_0x9cae('0x2d')),'countbusyretry':_0x3822d7[_0x9cae('0x1d')],'countcongestionretry':_0x3822d7[_0x9cae('0x25')],'countnoanswerretry':_0x3822d7[_0x9cae('0x1e')],'countnosuchnumberretry':_0x3822d7[_0x9cae('0x1f')],'countdropretry':_0x3822d7[_0x9cae('0x20')],'countabandonedretry':_0x3822d7[_0x9cae('0x26')],'countmachineretry':_0x3822d7['countmachineretry'],'countagentrejectretry':_0x3822d7[_0x9cae('0x22')],'createdAt':_0x3822d7[_0x9cae('0x30')],'updatedAt':_0x3822d7['updatedAt']};var _0x451335={'CmHopperId':_0x535e72['id'],'phone':_0x23c514[_0x9cae('0x2e')],'active':0x0,'OrderBy':_[_0x9cae('0x2f')](_0x23c514[_0x9cae('0x1b')])?0x0:_0x23c514[_0x9cae('0x1b')],'scheduledat':_0x29e766,'countbusyretry':_0x23c514[_0x9cae('0x1d')],'countcongestionretry':_0x23c514[_0x9cae('0x25')],'countnoanswerretry':_0x23c514[_0x9cae('0x1e')],'countnosuchnumberretry':_0x3822d7['countnosuchnumberretry'],'countdropretry':_0x3822d7[_0x9cae('0x20')],'countabandonedretry':_0x3822d7['countabandonedretry'],'countmachineretry':_0x3822d7['countmachineretry'],'countagentrejectretry':_0x3822d7['countagentrejectretry'],'createdAt':_0x23c514[_0x9cae('0x30')],'updatedAt':_0x23c514[_0x9cae('0x31')]};logger[_0x9cae('0xb')]('hopperToAdd',_0x1907f9);logger[_0x9cae('0xb')](_0x9cae('0x32'),_0x451335);return db[_0x9cae('0x33')]['transaction'](function(_0x210764){return db[_0x9cae('0x24')][_0x9cae('0x34')](_0x1907f9,{'where':{'id':_0x23c514['id']}},{'transaction':_0x210764})[_0x9cae('0xa')](function(){return db[_0x9cae('0x16')][_0x9cae('0x34')](_0x451335,{'where':{'id':_0x535e72['id']}},{'transaction':_0x210764});});})['then'](function(_0x3b3d3c){_0x5002b5({'id':_0x535e72['id'],'phone':_0x23c514[_0x9cae('0x2e')]});})[_0x9cae('0x14')](function(_0x55f25b){logger['error'](_0x9cae('0x15'),_0x55f25b[_0x9cae('0x11')],req);_0x409b04(_this[_0x9cae('0xf')](0x1f4,_0x55f25b[_0x9cae('0x11')]));});});}exports[_0x9cae('0x35')]=function(_0x35d9fe){var _0x56128b=this;return new Promise(function(_0x30d432,_0x1a43c6){return db[_0x9cae('0x16')][_0x9cae('0x34')](_0x35d9fe[_0x9cae('0x18')][_0x9cae('0x36')],{'where':{'id':_0x35d9fe[_0x9cae('0x18')]['id']}})[_0x9cae('0xa')](function(_0x449081){_0x30d432(_0x449081);})[_0x9cae('0x14')](function(_0x580aa5){logger[_0x9cae('0xf')](_0x9cae('0x35'),_0x580aa5['message'],_0x35d9fe);_0x1a43c6(_0x56128b[_0x9cae('0xf')](0x1f4,_0x580aa5[_0x9cae('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 019876c..e4bac5f 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf889=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','multer'];(function(_0x3e80f7,_0x491855){var _0x164d72=function(_0x36f5e7){while(--_0x36f5e7){_0x3e80f7['push'](_0x3e80f7['shift']());}};_0x164d72(++_0x491855);}(_0xf889,0x1db));var _0x9f88=function(_0xd20260,_0x23808d){_0xd20260=_0xd20260-0x0;var _0x50d930=_0xf889[_0xd20260];return _0x50d930;};'use strict';var multer=require(_0x9f88('0x0'));var util=require(_0x9f88('0x1'));var path=require(_0x9f88('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9f88('0x3')]();var auth=require(_0x9f88('0x4'));var interaction=require(_0x9f88('0x5'));var config=require(_0x9f88('0x6'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x9f88('0x7')]('/',auth['isAuthenticated'](),controller[_0x9f88('0x8')]);router['get'](_0x9f88('0x9'),auth[_0x9f88('0xa')](),controller[_0x9f88('0xb')]);router[_0x9f88('0xc')]('/',auth[_0x9f88('0xa')](),controller[_0x9f88('0xd')]);router[_0x9f88('0xe')](_0x9f88('0x9'),auth[_0x9f88('0xa')](),controller[_0x9f88('0xf')]);router['delete'](_0x9f88('0x9'),auth[_0x9f88('0xa')](),controller[_0x9f88('0x10')]);module['exports']=router; \ No newline at end of file +var _0xc41a=['update','delete','/:id','destroy','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','show','post','create'];(function(_0x5e8205,_0x4d16a6){var _0x1376c7=function(_0x46dcc3){while(--_0x46dcc3){_0x5e8205['push'](_0x5e8205['shift']());}};_0x1376c7(++_0x4d16a6);}(_0xc41a,0x19c));var _0xac41=function(_0x5e0257,_0x25bc85){_0x5e0257=_0x5e0257-0x0;var _0x4493ce=_0xc41a[_0x5e0257];return _0x4493ce;};'use strict';var multer=require(_0xac41('0x0'));var util=require(_0xac41('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xac41('0x2')]();var auth=require(_0xac41('0x3'));var interaction=require(_0xac41('0x4'));var config=require(_0xac41('0x5'));var controller=require(_0xac41('0x6'));router['get']('/',auth[_0xac41('0x7')](),controller[_0xac41('0x8')]);router[_0xac41('0x9')]('/:id',auth[_0xac41('0x7')](),controller[_0xac41('0xa')]);router[_0xac41('0xb')]('/',auth[_0xac41('0x7')](),controller[_0xac41('0xc')]);router['put']('/:id',auth[_0xac41('0x7')](),controller[_0xac41('0xd')]);router[_0xac41('0xe')](_0xac41('0xf'),auth[_0xac41('0x7')](),controller[_0xac41('0x10')]);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 234c354..76dc7d1 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 _0x8d7e=['sequelize','exports','STRING','contactListQueue','INTEGER','moment'];(function(_0x5b30b3,_0x374892){var _0x33f228=function(_0x19d739){while(--_0x19d739){_0x5b30b3['push'](_0x5b30b3['shift']());}};_0x33f228(++_0x374892);}(_0x8d7e,0x173));var _0xe8d7=function(_0x141fb9,_0x4b88f8){_0x141fb9=_0x141fb9-0x0;var _0x2e0083=_0x8d7e[_0x141fb9];return _0x2e0083;};'use strict';var moment=require(_0xe8d7('0x0'));var Sequelize=require(_0xe8d7('0x1'));module[_0xe8d7('0x2')]={'phone':{'type':Sequelize[_0xe8d7('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xe8d7('0x4')},'ListId':{'type':Sequelize[_0xe8d7('0x5')],'unique':_0xe8d7('0x4')},'VoiceQueueId':{'type':Sequelize[_0xe8d7('0x5')],'unique':_0xe8d7('0x4')}}; \ No newline at end of file +var _0x844a=['exports','INTEGER','contactListQueue','moment','sequelize'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x844a,0x8a));var _0xa844=function(_0x4fc7e5,_0x278c25){_0x4fc7e5=_0x4fc7e5-0x0;var _0x122086=_0x844a[_0x4fc7e5];return _0x122086;};'use strict';var moment=require(_0xa844('0x0'));var Sequelize=require(_0xa844('0x1'));module[_0xa844('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa844('0x3')],'unique':_0xa844('0x4')},'ListId':{'type':Sequelize[_0xa844('0x3')],'unique':_0xa844('0x4')},'VoiceQueueId':{'type':Sequelize[_0xa844('0x3')],'unique':_0xa844('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 816adc6..7fed15c 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 _0xcf21=['mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','then','stack','name','send','map','CmHopperBlack','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','fields','find','body','params','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment'];(function(_0x411b75,_0x4de4ca){var _0x5a9239=function(_0x1c600f){while(--_0x1c600f){_0x411b75['push'](_0x411b75['shift']());}};_0x5a9239(++_0x4de4ca);}(_0xcf21,0xca));var _0x1cf2=function(_0x56ab60,_0x49068b){_0x56ab60=_0x56ab60-0x0;var _0xdd3fbd=_0xcf21[_0x56ab60];return _0xdd3fbd;};'use strict';var pdf=require(_0x1cf2('0x0'));var emlformat=require(_0x1cf2('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1cf2('0x2'));var rp=require(_0x1cf2('0x3'));var moment=require(_0x1cf2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1cf2('0x5'));var util=require('util');var path=require(_0x1cf2('0x6'));var sox=require(_0x1cf2('0x7'));var csv=require(_0x1cf2('0x8'));var ejs=require(_0x1cf2('0x9'));var fs=require('fs');var _=require(_0x1cf2('0xa'));var squel=require(_0x1cf2('0xb'));var crypto=require(_0x1cf2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1cf2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1cf2('0xe'));var Papa=require(_0x1cf2('0xf'));var Redis=require(_0x1cf2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1cf2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1cf2('0x12'));var logger=require(_0x1cf2('0x13'))(_0x1cf2('0x14'));var utils=require(_0x1cf2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1cf2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38e3d9,_0xb1af08){_0xb1af08=_0xb1af08||0xcc;return function(_0x48d406){if(_0x48d406){return _0x38e3d9[_0x1cf2('0x17')](_0xb1af08);}return _0x38e3d9[_0x1cf2('0x18')](_0xb1af08)[_0x1cf2('0x19')]();};}function respondWithResult(_0x36d506,_0x3425ad){_0x3425ad=_0x3425ad||0xc8;return function(_0x7ee64a){if(_0x7ee64a){return _0x36d506[_0x1cf2('0x18')](_0x3425ad)[_0x1cf2('0x1a')](_0x7ee64a);}};}function respondWithFilteredResult(_0x354052,_0xd85486){return function(_0x18c23f){if(_0x18c23f){var _0x33ded1=_0x18c23f[_0x1cf2('0x1b')],_0x2eb2ba=_0xd85486['offset'],_0x3d543c=_0xd85486[_0x1cf2('0x1c')]+_0xd85486[_0x1cf2('0x1d')],_0x5851cd;if(_0x3d543c>=_0x33ded1){_0x3d543c=_0x33ded1;_0x5851cd=0xc8;}else{_0x5851cd=0xce;}_0x354052[_0x1cf2('0x18')](_0x5851cd);return _0x354052[_0x1cf2('0x1e')](_0x1cf2('0x1f'),_0x2eb2ba+'-'+_0x3d543c+'/'+_0x33ded1)[_0x1cf2('0x1a')](_0x18c23f);}return null;};}function patchUpdates(_0x328cd3){return function(_0x30a26f){try{jsonpatch['apply'](_0x30a26f,_0x328cd3,!![]);}catch(_0x13f53b){return BPromise['reject'](_0x13f53b);}return _0x30a26f[_0x1cf2('0x20')]();};}function saveUpdates(_0x1e8a87,_0x4348bb){return function(_0x4cf377){if(_0x4cf377){return _0x4cf377[_0x1cf2('0x21')](_0x1e8a87)['then'](function(_0x5d43e3){return _0x5d43e3;});}return null;};}function removeEntity(_0x4cf576,_0x543408){return function(_0xd20d5d){if(_0xd20d5d){return _0xd20d5d[_0x1cf2('0x22')]()[_0x1cf2('0x23')](function(){_0x4cf576['status'](0xcc)[_0x1cf2('0x19')]();});}};}function handleEntityNotFound(_0x4fdc19,_0x453fbf){return function(_0x357b73){if(!_0x357b73){_0x4fdc19['sendStatus'](0x194);}return _0x357b73;};}function handleError(_0x206a7d,_0x31b1ed){_0x31b1ed=_0x31b1ed||0x1f4;return function(_0x1b4bf2){logger['error'](_0x1b4bf2[_0x1cf2('0x24')]);if(_0x1b4bf2[_0x1cf2('0x25')]){delete _0x1b4bf2[_0x1cf2('0x25')];}_0x206a7d[_0x1cf2('0x18')](_0x31b1ed)[_0x1cf2('0x26')](_0x1b4bf2);};}exports['index']=function(_0x40b606,_0x3683c8){var _0x1804ed={},_0xccd750={},_0x8cc780={'count':0x0,'rows':[]};var _0x29cc6a=_[_0x1cf2('0x27')](db[_0x1cf2('0x28')]['rawAttributes'],function(_0x2bee71){return{'name':_0x2bee71[_0x1cf2('0x29')],'type':_0x2bee71[_0x1cf2('0x2a')][_0x1cf2('0x2b')]};});_0xccd750[_0x1cf2('0x2c')]=_['map'](_0x29cc6a,'name');_0xccd750[_0x1cf2('0x2d')]=_[_0x1cf2('0x2e')](_0x40b606[_0x1cf2('0x2d')]);_0xccd750[_0x1cf2('0x2f')]=_[_0x1cf2('0x30')](_0xccd750['model'],_0xccd750[_0x1cf2('0x2d')]);_0x1804ed[_0x1cf2('0x31')]=_['intersection'](_0xccd750[_0x1cf2('0x2c')],qs['fields'](_0x40b606[_0x1cf2('0x2d')]['fields']));_0x1804ed[_0x1cf2('0x31')]=_0x1804ed[_0x1cf2('0x31')][_0x1cf2('0x32')]?_0x1804ed['attributes']:_0xccd750[_0x1cf2('0x2c')];if(!_0x40b606[_0x1cf2('0x2d')][_0x1cf2('0x33')]('nolimit')){_0x1804ed[_0x1cf2('0x1d')]=qs[_0x1cf2('0x1d')](_0x40b606['query'][_0x1cf2('0x1d')]);_0x1804ed[_0x1cf2('0x1c')]=qs[_0x1cf2('0x1c')](_0x40b606[_0x1cf2('0x2d')][_0x1cf2('0x1c')]);}_0x1804ed[_0x1cf2('0x34')]=qs[_0x1cf2('0x35')](_0x40b606[_0x1cf2('0x2d')][_0x1cf2('0x35')]);_0x1804ed[_0x1cf2('0x36')]=qs['filters'](_['pick'](_0x40b606[_0x1cf2('0x2d')],_0xccd750[_0x1cf2('0x2f')]),_0x29cc6a);if(_0x40b606['query']['filter']){_0x1804ed[_0x1cf2('0x36')]=_[_0x1cf2('0x37')](_0x1804ed[_0x1cf2('0x36')],{'$or':_['map'](_0x29cc6a,function(_0x6fd4cf){if(_0x6fd4cf[_0x1cf2('0x2a')]!=='VIRTUAL'){var _0x499a8e={};_0x499a8e[_0x6fd4cf['name']]={'$like':'%'+_0x40b606[_0x1cf2('0x2d')]['filter']+'%'};return _0x499a8e;}})});}_0x1804ed=_[_0x1cf2('0x37')]({},_0x1804ed,_0x40b606[_0x1cf2('0x38')]);var _0x4b45be={'where':_0x1804ed[_0x1cf2('0x36')]};return db[_0x1cf2('0x28')]['count'](_0x4b45be)['then'](function(_0x50aa9c){_0x8cc780[_0x1cf2('0x1b')]=_0x50aa9c;if(_0x40b606['query'][_0x1cf2('0x39')]){_0x1804ed[_0x1cf2('0x3a')]=[{'all':!![]}];}return db[_0x1cf2('0x28')][_0x1cf2('0x3b')](_0x1804ed);})['then'](function(_0x130388){_0x8cc780[_0x1cf2('0x3c')]=_0x130388;return _0x8cc780;})[_0x1cf2('0x23')](respondWithFilteredResult(_0x3683c8,_0x1804ed))[_0x1cf2('0x3d')](handleError(_0x3683c8,null));};exports[_0x1cf2('0x3e')]=function(_0x2230a3,_0x3539f7){var _0x1d7979={'raw':!![],'where':{'id':_0x2230a3['params']['id']}},_0x4b624d={};_0x4b624d[_0x1cf2('0x2c')]=_[_0x1cf2('0x2e')](db['CmHopperBlack'][_0x1cf2('0x3f')]);_0x4b624d['query']=_[_0x1cf2('0x2e')](_0x2230a3[_0x1cf2('0x2d')]);_0x4b624d[_0x1cf2('0x2f')]=_['intersection'](_0x4b624d['model'],_0x4b624d[_0x1cf2('0x2d')]);_0x1d7979[_0x1cf2('0x31')]=_[_0x1cf2('0x30')](_0x4b624d['model'],qs[_0x1cf2('0x40')](_0x2230a3[_0x1cf2('0x2d')]['fields']));_0x1d7979[_0x1cf2('0x31')]=_0x1d7979[_0x1cf2('0x31')][_0x1cf2('0x32')]?_0x1d7979['attributes']:_0x4b624d[_0x1cf2('0x2c')];if(_0x2230a3['query'][_0x1cf2('0x39')]){_0x1d7979['include']=[{'all':!![]}];}_0x1d7979=_['merge']({},_0x1d7979,_0x2230a3[_0x1cf2('0x38')]);return db[_0x1cf2('0x28')][_0x1cf2('0x41')](_0x1d7979)[_0x1cf2('0x23')](handleEntityNotFound(_0x3539f7,null))[_0x1cf2('0x23')](respondWithResult(_0x3539f7,null))[_0x1cf2('0x3d')](handleError(_0x3539f7,null));};exports[_0x1cf2('0x21')]=function(_0x53e536,_0x123a14){if(_0x53e536[_0x1cf2('0x42')]['id']){delete _0x53e536[_0x1cf2('0x42')]['id'];}return db[_0x1cf2('0x28')][_0x1cf2('0x41')]({'where':{'id':_0x53e536[_0x1cf2('0x43')]['id']}})[_0x1cf2('0x23')](handleEntityNotFound(_0x123a14,null))[_0x1cf2('0x23')](saveUpdates(_0x53e536[_0x1cf2('0x42')],null))[_0x1cf2('0x23')](respondWithResult(_0x123a14,null))[_0x1cf2('0x3d')](handleError(_0x123a14,null));};exports[_0x1cf2('0x22')]=function(_0x43245d,_0x38b06d){return db[_0x1cf2('0x28')]['find']({'where':{'id':_0x43245d[_0x1cf2('0x43')]['id']}})['then'](handleEntityNotFound(_0x38b06d,null))['then'](removeEntity(_0x38b06d,null))[_0x1cf2('0x3d')](handleError(_0x38b06d,null));};exports[_0x1cf2('0x44')]=function(_0x59f7dc,_0x52aef3){return db[_0x1cf2('0x28')][_0x1cf2('0x44')]()['then'](respondWithResult(_0x52aef3,null))[_0x1cf2('0x3d')](handleError(_0x52aef3,null));}; \ No newline at end of file +var _0x5149=['keys','include','options','find','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','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/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','includeAll','rows','catch','params'];(function(_0xa9859c,_0x50500d){var _0x3e23f9=function(_0x4f242a){while(--_0x4f242a){_0xa9859c['push'](_0xa9859c['shift']());}};_0x3e23f9(++_0x50500d);}(_0x5149,0x127));var _0x9514=function(_0x718a85,_0x5272fb){_0x718a85=_0x718a85-0x0;var _0x180486=_0x5149[_0x718a85];return _0x180486;};'use strict';var pdf=require(_0x9514('0x0'));var emlformat=require(_0x9514('0x1'));var rimraf=require(_0x9514('0x2'));var zipdir=require(_0x9514('0x3'));var jsonpatch=require(_0x9514('0x4'));var rp=require('request-promise');var moment=require(_0x9514('0x5'));var BPromise=require(_0x9514('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9514('0x7'));var csv=require(_0x9514('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9514('0x9'));var squel=require(_0x9514('0xa'));var crypto=require(_0x9514('0xb'));var jsforce=require(_0x9514('0xc'));var deskjs=require(_0x9514('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9514('0xe'));var Papa=require(_0x9514('0xf'));var Redis=require(_0x9514('0x10'));var authService=require(_0x9514('0x11'));var qs=require(_0x9514('0x12'));var as=require(_0x9514('0x13'));var hardwareService=require(_0x9514('0x14'));var logger=require(_0x9514('0x15'))(_0x9514('0x16'));var utils=require('../../config/utils');var config=require(_0x9514('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9514('0x18'))['db'];function respondWithStatusCode(_0x1cf3af,_0x3295e9){_0x3295e9=_0x3295e9||0xcc;return function(_0x164fa6){if(_0x164fa6){return _0x1cf3af[_0x9514('0x19')](_0x3295e9);}return _0x1cf3af[_0x9514('0x1a')](_0x3295e9)[_0x9514('0x1b')]();};}function respondWithResult(_0x43ca14,_0x5cee42){_0x5cee42=_0x5cee42||0xc8;return function(_0x3289c7){if(_0x3289c7){return _0x43ca14['status'](_0x5cee42)['json'](_0x3289c7);}};}function respondWithFilteredResult(_0x26a1ba,_0x1680c4){return function(_0x57f7d2){if(_0x57f7d2){var _0x323590=_0x57f7d2[_0x9514('0x1c')],_0x480520=_0x1680c4[_0x9514('0x1d')],_0x25b63b=_0x1680c4[_0x9514('0x1d')]+_0x1680c4[_0x9514('0x1e')],_0x48db2c;if(_0x25b63b>=_0x323590){_0x25b63b=_0x323590;_0x48db2c=0xc8;}else{_0x48db2c=0xce;}_0x26a1ba[_0x9514('0x1a')](_0x48db2c);return _0x26a1ba[_0x9514('0x1f')](_0x9514('0x20'),_0x480520+'-'+_0x25b63b+'/'+_0x323590)[_0x9514('0x21')](_0x57f7d2);}return null;};}function patchUpdates(_0x2a63e7){return function(_0x45b03b){try{jsonpatch[_0x9514('0x22')](_0x45b03b,_0x2a63e7,!![]);}catch(_0x354c1b){return BPromise['reject'](_0x354c1b);}return _0x45b03b[_0x9514('0x23')]();};}function saveUpdates(_0x26bc2c,_0x5c1fab){return function(_0x4b1835){if(_0x4b1835){return _0x4b1835[_0x9514('0x24')](_0x26bc2c)[_0x9514('0x25')](function(_0x408545){return _0x408545;});}return null;};}function removeEntity(_0x567ad7,_0x503663){return function(_0x2e186d){if(_0x2e186d){return _0x2e186d['destroy']()[_0x9514('0x25')](function(){_0x567ad7[_0x9514('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1816da,_0x267fc1){return function(_0x535e4d){if(!_0x535e4d){_0x1816da[_0x9514('0x19')](0x194);}return _0x535e4d;};}function handleError(_0x4d6a3f,_0x569e1b){_0x569e1b=_0x569e1b||0x1f4;return function(_0x211a1e){logger['error'](_0x211a1e[_0x9514('0x26')]);if(_0x211a1e[_0x9514('0x27')]){delete _0x211a1e[_0x9514('0x27')];}_0x4d6a3f['status'](_0x569e1b)[_0x9514('0x28')](_0x211a1e);};}exports[_0x9514('0x29')]=function(_0x1449a6,_0xf9dfaa){var _0x4816d3={},_0x36c2a6={},_0x2415dc={'count':0x0,'rows':[]};var _0x1cf192=_['map'](db[_0x9514('0x2a')][_0x9514('0x2b')],function(_0x2c7a5c){return{'name':_0x2c7a5c[_0x9514('0x2c')],'type':_0x2c7a5c[_0x9514('0x2d')][_0x9514('0x2e')]};});_0x36c2a6[_0x9514('0x2f')]=_[_0x9514('0x30')](_0x1cf192,_0x9514('0x27'));_0x36c2a6[_0x9514('0x31')]=_['keys'](_0x1449a6[_0x9514('0x31')]);_0x36c2a6[_0x9514('0x32')]=_[_0x9514('0x33')](_0x36c2a6[_0x9514('0x2f')],_0x36c2a6[_0x9514('0x31')]);_0x4816d3['attributes']=_[_0x9514('0x33')](_0x36c2a6[_0x9514('0x2f')],qs['fields'](_0x1449a6[_0x9514('0x31')][_0x9514('0x34')]));_0x4816d3['attributes']=_0x4816d3[_0x9514('0x35')][_0x9514('0x36')]?_0x4816d3[_0x9514('0x35')]:_0x36c2a6[_0x9514('0x2f')];if(!_0x1449a6[_0x9514('0x31')]['hasOwnProperty'](_0x9514('0x37'))){_0x4816d3['limit']=qs['limit'](_0x1449a6[_0x9514('0x31')][_0x9514('0x1e')]);_0x4816d3[_0x9514('0x1d')]=qs['offset'](_0x1449a6['query'][_0x9514('0x1d')]);}_0x4816d3[_0x9514('0x38')]=qs[_0x9514('0x39')](_0x1449a6[_0x9514('0x31')][_0x9514('0x39')]);_0x4816d3[_0x9514('0x3a')]=qs[_0x9514('0x32')](_[_0x9514('0x3b')](_0x1449a6['query'],_0x36c2a6['filters']),_0x1cf192);if(_0x1449a6[_0x9514('0x31')]['filter']){_0x4816d3[_0x9514('0x3a')]=_[_0x9514('0x3c')](_0x4816d3[_0x9514('0x3a')],{'$or':_[_0x9514('0x30')](_0x1cf192,function(_0x1e737d){if(_0x1e737d[_0x9514('0x2d')]!=='VIRTUAL'){var _0x2a5cc9={};_0x2a5cc9[_0x1e737d['name']]={'$like':'%'+_0x1449a6[_0x9514('0x31')]['filter']+'%'};return _0x2a5cc9;}})});}_0x4816d3=_['merge']({},_0x4816d3,_0x1449a6['options']);var _0x35e83f={'where':_0x4816d3[_0x9514('0x3a')]};return db['CmHopperBlack'][_0x9514('0x1c')](_0x35e83f)[_0x9514('0x25')](function(_0x2857c6){_0x2415dc[_0x9514('0x1c')]=_0x2857c6;if(_0x1449a6['query'][_0x9514('0x3d')]){_0x4816d3['include']=[{'all':!![]}];}return db[_0x9514('0x2a')]['findAll'](_0x4816d3);})[_0x9514('0x25')](function(_0x205a5e){_0x2415dc[_0x9514('0x3e')]=_0x205a5e;return _0x2415dc;})['then'](respondWithFilteredResult(_0xf9dfaa,_0x4816d3))[_0x9514('0x3f')](handleError(_0xf9dfaa,null));};exports['show']=function(_0xa4ce5d,_0x171068){var _0x1c3014={'raw':!![],'where':{'id':_0xa4ce5d[_0x9514('0x40')]['id']}},_0x136634={};_0x136634[_0x9514('0x2f')]=_['keys'](db[_0x9514('0x2a')][_0x9514('0x2b')]);_0x136634[_0x9514('0x31')]=_[_0x9514('0x41')](_0xa4ce5d['query']);_0x136634[_0x9514('0x32')]=_[_0x9514('0x33')](_0x136634[_0x9514('0x2f')],_0x136634['query']);_0x1c3014[_0x9514('0x35')]=_['intersection'](_0x136634[_0x9514('0x2f')],qs[_0x9514('0x34')](_0xa4ce5d[_0x9514('0x31')][_0x9514('0x34')]));_0x1c3014['attributes']=_0x1c3014[_0x9514('0x35')][_0x9514('0x36')]?_0x1c3014['attributes']:_0x136634[_0x9514('0x2f')];if(_0xa4ce5d[_0x9514('0x31')][_0x9514('0x3d')]){_0x1c3014[_0x9514('0x42')]=[{'all':!![]}];}_0x1c3014=_[_0x9514('0x3c')]({},_0x1c3014,_0xa4ce5d[_0x9514('0x43')]);return db[_0x9514('0x2a')][_0x9514('0x44')](_0x1c3014)['then'](handleEntityNotFound(_0x171068,null))[_0x9514('0x25')](respondWithResult(_0x171068,null))[_0x9514('0x3f')](handleError(_0x171068,null));};exports[_0x9514('0x24')]=function(_0x407f0e,_0xe7a3d5){if(_0x407f0e[_0x9514('0x45')]['id']){delete _0x407f0e[_0x9514('0x45')]['id'];}return db[_0x9514('0x2a')][_0x9514('0x44')]({'where':{'id':_0x407f0e['params']['id']}})[_0x9514('0x25')](handleEntityNotFound(_0xe7a3d5,null))['then'](saveUpdates(_0x407f0e[_0x9514('0x45')],null))['then'](respondWithResult(_0xe7a3d5,null))[_0x9514('0x3f')](handleError(_0xe7a3d5,null));};exports[_0x9514('0x46')]=function(_0x45c017,_0x372b69){return db[_0x9514('0x2a')][_0x9514('0x44')]({'where':{'id':_0x45c017['params']['id']}})[_0x9514('0x25')](handleEntityNotFound(_0x372b69,null))[_0x9514('0x25')](removeEntity(_0x372b69,null))[_0x9514('0x3f')](handleError(_0x372b69,null));};exports['describe']=function(_0x3e8868,_0x51964b){return db[_0x9514('0x2a')][_0x9514('0x47')]()[_0x9514('0x25')](respondWithResult(_0x51964b,null))[_0x9514('0x3f')](handleError(_0x51964b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 8382f89..c2dd6a9 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 _0xdf30=['exports','define','CmHopperBlack','cm_hopper_black','util','moment','rimraf','./cmHopperBlack.attributes'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xdf30,0x1a4));var _0x0df3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf30[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x0df3('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0df3('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0df3('0x2'));var config=require('../../config/environment');var attributes=require(_0x0df3('0x3'));module[_0x0df3('0x4')]=function(_0x1b0f09,_0x2815ce){return _0x1b0f09[_0x0df3('0x5')](_0x0df3('0x6'),attributes,{'tableName':_0x0df3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x525c=['util','../../config/logger','api','moment','bluebird','request-promise','path','./cmHopperBlack.attributes','exports','cm_hopper_black','lodash'];(function(_0x9c0336,_0x500ffb){var _0x53caa4=function(_0x2f2c8b){while(--_0x2f2c8b){_0x9c0336['push'](_0x9c0336['shift']());}};_0x53caa4(++_0x500ffb);}(_0x525c,0xfc));var _0xc525=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x525c[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xc525('0x0'));var util=require(_0xc525('0x1'));var logger=require(_0xc525('0x2'))(_0xc525('0x3'));var moment=require(_0xc525('0x4'));var BPromise=require(_0xc525('0x5'));var rp=require(_0xc525('0x6'));var fs=require('fs');var path=require(_0xc525('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc525('0x8'));module[_0xc525('0x9')]=function(_0x509474,_0x1daa95){return _0x509474['define']('CmHopperBlack',attributes,{'tableName':_0xc525('0xa'),'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 7efe98c..92f048f 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 _0xb30d=['stringify','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','map','model'];(function(_0x29f41d,_0x1e70c0){var _0x3a02f9=function(_0x329ec5){while(--_0x329ec5){_0x29f41d['push'](_0x29f41d['shift']());}};_0x3a02f9(++_0x1e70c0);}(_0xb30d,0x18b));var _0xdb30=function(_0x3a1ea5,_0x349f01){_0x3a1ea5=_0x3a1ea5-0x0;var _0xfac9b2=_0xb30d[_0x3a1ea5];return _0xfac9b2;};'use strict';var _=require(_0xdb30('0x0'));var util=require(_0xdb30('0x1'));var moment=require(_0xdb30('0x2'));var BPromise=require('bluebird');var rs=require(_0xdb30('0x3'));var fs=require('fs');var Redis=require(_0xdb30('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb30('0x5'));var logger=require(_0xdb30('0x6'))(_0xdb30('0x7'));var config=require(_0xdb30('0x8'));var jayson=require(_0xdb30('0x9'));var client=jayson[_0xdb30('0xa')][_0xdb30('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21708e,_0x429206,_0x46c996){return new BPromise(function(_0x2bb9e3,_0x56d60c){return client[_0xdb30('0xc')](_0x21708e,_0x46c996)[_0xdb30('0xd')](function(_0x3fb58b){logger[_0xdb30('0xe')](_0xdb30('0xf'),_0x429206,'request\x20sent');logger[_0xdb30('0x10')](_0xdb30('0x11'),_0x429206,_0xdb30('0x12'),JSON['stringify'](_0x3fb58b));if(_0x3fb58b[_0xdb30('0x13')]){if(_0x3fb58b['error'][_0xdb30('0x14')]===0x1f4){logger[_0xdb30('0x13')](_0xdb30('0xf'),_0x429206,_0x3fb58b[_0xdb30('0x13')][_0xdb30('0x15')]);return _0x56d60c(_0x3fb58b[_0xdb30('0x13')][_0xdb30('0x15')]);}logger[_0xdb30('0x13')](_0xdb30('0xf'),_0x429206,_0x3fb58b[_0xdb30('0x13')]['message']);return _0x2bb9e3(_0x3fb58b['error'][_0xdb30('0x15')]);}else{logger[_0xdb30('0xe')](_0xdb30('0xf'),_0x429206,'request\x20sent');_0x2bb9e3(_0x3fb58b[_0xdb30('0x16')]['message']);}})[_0xdb30('0x17')](function(_0x435c2a){logger[_0xdb30('0x13')](_0xdb30('0xf'),_0x429206,_0x435c2a);_0x56d60c(_0x435c2a);});});}exports[_0xdb30('0x18')]=function(_0x2f8dfa){var _0x106cee=this;return new Promise(function(_0x143ba5,_0x5006fa){return db[_0xdb30('0x19')]['findAll']({'raw':_0x2f8dfa['options']?_0x2f8dfa[_0xdb30('0x1a')][_0xdb30('0x1b')]===undefined?!![]:![]:!![],'where':_0x2f8dfa['options']?_0x2f8dfa[_0xdb30('0x1a')][_0xdb30('0x1c')]||null:null,'attributes':_0x2f8dfa[_0xdb30('0x1a')]?_0x2f8dfa['options'][_0xdb30('0x1d')]||null:null,'limit':_0x2f8dfa['options']?_0x2f8dfa[_0xdb30('0x1a')][_0xdb30('0x1e')]||null:null,'include':_0x2f8dfa['options']?_0x2f8dfa[_0xdb30('0x1a')][_0xdb30('0x1f')]?_[_0xdb30('0x20')](_0x2f8dfa[_0xdb30('0x1a')][_0xdb30('0x1f')],function(_0x573293){return{'model':db[_0x573293[_0xdb30('0x21')]],'as':_0x573293['as'],'attributes':_0x573293['attributes'],'include':_0x573293[_0xdb30('0x1f')]?_[_0xdb30('0x20')](_0x573293[_0xdb30('0x1f')],function(_0x1c85a3){return{'model':db[_0x1c85a3[_0xdb30('0x21')]],'as':_0x1c85a3['as'],'attributes':_0x1c85a3[_0xdb30('0x1d')],'include':_0x1c85a3[_0xdb30('0x1f')]?_[_0xdb30('0x20')](_0x1c85a3[_0xdb30('0x1f')],function(_0x5e7e1e){return{'model':db[_0x5e7e1e[_0xdb30('0x21')]],'as':_0x5e7e1e['as'],'attributes':_0x5e7e1e[_0xdb30('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2edeb9){logger[_0xdb30('0xe')](_0xdb30('0x18'),_0x2f8dfa);logger[_0xdb30('0x10')]('GetCmHopperBlack',_0x2f8dfa,JSON[_0xdb30('0x22')](_0x2edeb9));_0x143ba5(_0x2edeb9);})[_0xdb30('0x17')](function(_0x1ed822){logger['error'](_0xdb30('0x18'),_0x1ed822[_0xdb30('0x15')],_0x2f8dfa);_0x5006fa(_0x106cee[_0xdb30('0x13')](0x1f4,_0x1ed822[_0xdb30('0x15')]));});});};exports[_0xdb30('0x23')]=function(_0x42c295){var _0x14ae90=this;return new Promise(function(_0xe10b52,_0x1cabda){return db[_0xdb30('0x19')][_0xdb30('0x24')](_0x42c295[_0xdb30('0x25')],{'raw':_0x42c295[_0xdb30('0x1a')]?_0x42c295[_0xdb30('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42c295[_0xdb30('0x1a')]?_0x42c295[_0xdb30('0x1a')]['where']||null:null,'attributes':_0x42c295[_0xdb30('0x1a')]?_0x42c295[_0xdb30('0x1a')][_0xdb30('0x1d')]||null:null,'limit':_0x42c295[_0xdb30('0x1a')]?_0x42c295[_0xdb30('0x1a')][_0xdb30('0x1e')]||null:null})['then'](function(_0x48a9ad){logger['info']('UpdateCmHopperBlack',_0x42c295);logger[_0xdb30('0x10')](_0xdb30('0x23'),_0x42c295,JSON[_0xdb30('0x22')](_0x48a9ad));_0xe10b52(_0x48a9ad);})[_0xdb30('0x17')](function(_0x29761e){logger['error'](_0xdb30('0x23'),_0x29761e[_0xdb30('0x15')],_0x42c295);_0x1cabda(_0x14ae90[_0xdb30('0x13')](0x1f4,_0x29761e[_0xdb30('0x15')]));});});};exports[_0xdb30('0x26')]=function(_0x1b0338){var _0x5631f2=this;return new Promise(function(_0x52a08c,_0x264a70){return db[_0xdb30('0x19')]['destroy']({'where':_0x1b0338['options']?_0x1b0338[_0xdb30('0x1a')]['where']||null:null})[_0xdb30('0xd')](function(_0xc347e4){logger[_0xdb30('0xe')](_0xdb30('0x26'),_0x1b0338);logger[_0xdb30('0x10')](_0xdb30('0x26'),_0x1b0338,JSON[_0xdb30('0x22')](_0xc347e4));_0x52a08c(_0xc347e4);})[_0xdb30('0x17')](function(_0x31e1ed){logger[_0xdb30('0x13')]('DestroyCmHopperBlack',_0x31e1ed[_0xdb30('0x15')],_0x1b0338);_0x264a70(_0x5631f2[_0xdb30('0x13')](0x1f4,_0x31e1ed[_0xdb30('0x15')]));});});}; \ No newline at end of file +var _0x0db0=['update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','model','map','catch'];(function(_0x4d688b,_0x28a0a4){var _0x11f2b8=function(_0x3dde93){while(--_0x3dde93){_0x4d688b['push'](_0x4d688b['shift']());}};_0x11f2b8(++_0x28a0a4);}(_0x0db0,0x176));var _0x00db=function(_0x1eeb15,_0x539688){_0x1eeb15=_0x1eeb15-0x0;var _0x12a9ce=_0x0db0[_0x1eeb15];return _0x12a9ce;};'use strict';var _=require(_0x00db('0x0'));var util=require(_0x00db('0x1'));var moment=require('moment');var BPromise=require(_0x00db('0x2'));var rs=require(_0x00db('0x3'));var fs=require('fs');var Redis=require(_0x00db('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x00db('0x5'));var logger=require(_0x00db('0x6'))('rpc');var config=require(_0x00db('0x7'));var jayson=require(_0x00db('0x8'));var client=jayson[_0x00db('0x9')][_0x00db('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54dc29,_0x525616,_0x4b9d8a){return new BPromise(function(_0x47f5cd,_0x4a9134){return client[_0x00db('0xb')](_0x54dc29,_0x4b9d8a)[_0x00db('0xc')](function(_0x101766){logger['info'](_0x00db('0xd'),_0x525616,_0x00db('0xe'));logger[_0x00db('0xf')](_0x00db('0x10'),_0x525616,'request\x20sent',JSON[_0x00db('0x11')](_0x101766));if(_0x101766[_0x00db('0x12')]){if(_0x101766['error']['code']===0x1f4){logger[_0x00db('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x525616,_0x101766['error'][_0x00db('0x13')]);return _0x4a9134(_0x101766[_0x00db('0x12')][_0x00db('0x13')]);}logger[_0x00db('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x525616,_0x101766[_0x00db('0x12')][_0x00db('0x13')]);return _0x47f5cd(_0x101766['error'][_0x00db('0x13')]);}else{logger[_0x00db('0x14')](_0x00db('0xd'),_0x525616,'request\x20sent');_0x47f5cd(_0x101766[_0x00db('0x15')][_0x00db('0x13')]);}})['catch'](function(_0x56c5da){logger[_0x00db('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x525616,_0x56c5da);_0x4a9134(_0x56c5da);});});}exports[_0x00db('0x16')]=function(_0x5a48ea){var _0x39c2b4=this;return new Promise(function(_0x13924a,_0x3bbc8d){return db[_0x00db('0x17')]['findAll']({'raw':_0x5a48ea[_0x00db('0x18')]?_0x5a48ea[_0x00db('0x18')][_0x00db('0x19')]===undefined?!![]:![]:!![],'where':_0x5a48ea[_0x00db('0x18')]?_0x5a48ea[_0x00db('0x18')][_0x00db('0x1a')]||null:null,'attributes':_0x5a48ea[_0x00db('0x18')]?_0x5a48ea[_0x00db('0x18')][_0x00db('0x1b')]||null:null,'limit':_0x5a48ea[_0x00db('0x18')]?_0x5a48ea[_0x00db('0x18')][_0x00db('0x1c')]||null:null,'include':_0x5a48ea[_0x00db('0x18')]?_0x5a48ea[_0x00db('0x18')][_0x00db('0x1d')]?_['map'](_0x5a48ea['options'][_0x00db('0x1d')],function(_0x5e69ad){return{'model':db[_0x5e69ad[_0x00db('0x1e')]],'as':_0x5e69ad['as'],'attributes':_0x5e69ad[_0x00db('0x1b')],'include':_0x5e69ad[_0x00db('0x1d')]?_[_0x00db('0x1f')](_0x5e69ad[_0x00db('0x1d')],function(_0x1fe0b3){return{'model':db[_0x1fe0b3['model']],'as':_0x1fe0b3['as'],'attributes':_0x1fe0b3['attributes'],'include':_0x1fe0b3[_0x00db('0x1d')]?_[_0x00db('0x1f')](_0x1fe0b3[_0x00db('0x1d')],function(_0x10627d){return{'model':db[_0x10627d[_0x00db('0x1e')]],'as':_0x10627d['as'],'attributes':_0x10627d[_0x00db('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x00db('0xc')](function(_0x15147a){logger[_0x00db('0x14')](_0x00db('0x16'),_0x5a48ea);logger[_0x00db('0xf')](_0x00db('0x16'),_0x5a48ea,JSON[_0x00db('0x11')](_0x15147a));_0x13924a(_0x15147a);})[_0x00db('0x20')](function(_0x45aff0){logger[_0x00db('0x12')]('GetCmHopperBlack',_0x45aff0['message'],_0x5a48ea);_0x3bbc8d(_0x39c2b4[_0x00db('0x12')](0x1f4,_0x45aff0[_0x00db('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0xe61da7){var _0x568cd7=this;return new Promise(function(_0x4e7fef,_0x31e1ad){return db[_0x00db('0x17')][_0x00db('0x21')](_0xe61da7[_0x00db('0x22')],{'raw':_0xe61da7[_0x00db('0x18')]?_0xe61da7[_0x00db('0x18')][_0x00db('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe61da7['options']?_0xe61da7[_0x00db('0x18')]['where']||null:null,'attributes':_0xe61da7[_0x00db('0x18')]?_0xe61da7[_0x00db('0x18')][_0x00db('0x1b')]||null:null,'limit':_0xe61da7['options']?_0xe61da7[_0x00db('0x18')][_0x00db('0x1c')]||null:null})[_0x00db('0xc')](function(_0x52ed5d){logger[_0x00db('0x14')](_0x00db('0x23'),_0xe61da7);logger[_0x00db('0xf')](_0x00db('0x23'),_0xe61da7,JSON['stringify'](_0x52ed5d));_0x4e7fef(_0x52ed5d);})[_0x00db('0x20')](function(_0x179034){logger[_0x00db('0x12')]('UpdateCmHopperBlack',_0x179034[_0x00db('0x13')],_0xe61da7);_0x31e1ad(_0x568cd7[_0x00db('0x12')](0x1f4,_0x179034[_0x00db('0x13')]));});});};exports[_0x00db('0x24')]=function(_0x486598){var _0x496aa1=this;return new Promise(function(_0x5891cd,_0x14d58d){return db[_0x00db('0x17')]['destroy']({'where':_0x486598[_0x00db('0x18')]?_0x486598[_0x00db('0x18')][_0x00db('0x1a')]||null:null})[_0x00db('0xc')](function(_0x516412){logger[_0x00db('0x14')](_0x00db('0x24'),_0x486598);logger[_0x00db('0xf')](_0x00db('0x24'),_0x486598,JSON[_0x00db('0x11')](_0x516412));_0x5891cd(_0x516412);})['catch'](function(_0x133664){logger[_0x00db('0x12')](_0x00db('0x24'),_0x133664[_0x00db('0x13')],_0x486598);_0x14d58d(_0x496aa1['error'](0x1f4,_0x133664[_0x00db('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index bef9d04..ed613aa 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 _0xbec5=['../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','/:id','show','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x771708,_0x1edfc5){var _0x4a6462=function(_0x68444a){while(--_0x68444a){_0x771708['push'](_0x771708['shift']());}};_0x4a6462(++_0x1edfc5);}(_0xbec5,0xe5));var _0x5bec=function(_0x53b133,_0x176261){_0x53b133=_0x53b133-0x0;var _0x5647e0=_0xbec5[_0x53b133];return _0x5647e0;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var auth=require(_0x5bec('0x5'));var interaction=require(_0x5bec('0x6'));var config=require('../../config/environment');var controller=require(_0x5bec('0x7'));router[_0x5bec('0x8')]('/',auth[_0x5bec('0x9')](),controller['index']);router[_0x5bec('0x8')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xb')]);router[_0x5bec('0x8')](_0x5bec('0xc'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xd')]);router['put'](_0x5bec('0xc'),auth['isAuthenticated'](),controller[_0x5bec('0xe')]);router[_0x5bec('0xf')](_0x5bec('0xc'),auth['isAuthenticated'](),controller[_0x5bec('0x10')]);module[_0x5bec('0x11')]=router; \ No newline at end of file +var _0x7dfd=['index','/describe','describe','/:id','show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated'];(function(_0x1a0642,_0x2d6007){var _0x1c803d=function(_0x37cb6f){while(--_0x37cb6f){_0x1a0642['push'](_0x1a0642['shift']());}};_0x1c803d(++_0x2d6007);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var auth=require(_0xd7df('0x6'));var interaction=require(_0xd7df('0x7'));var config=require(_0xd7df('0x8'));var controller=require(_0xd7df('0x9'));router[_0xd7df('0xa')]('/',auth[_0xd7df('0xb')](),controller[_0xd7df('0xc')]);router[_0xd7df('0xa')](_0xd7df('0xd'),auth[_0xd7df('0xb')](),controller[_0xd7df('0xe')]);router['get'](_0xd7df('0xf'),auth[_0xd7df('0xb')](),controller[_0xd7df('0x10')]);router[_0xd7df('0x11')]('/:id',auth[_0xd7df('0xb')](),controller['update']);router[_0xd7df('0x12')]('/:id',auth[_0xd7df('0xb')](),controller[_0xd7df('0x13')]);module[_0xd7df('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index f0e6d42..dacd581 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 _0x45a8=['seconds','dispositionat','BOOLEAN','sequelize','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff'];(function(_0x1b8f5a,_0x57c154){var _0x594189=function(_0x15b277){while(--_0x15b277){_0x1b8f5a['push'](_0x1b8f5a['shift']());}};_0x594189(++_0x57c154);}(_0x45a8,0x9f));var _0x845a=function(_0xd9b5b8,_0x26d60c){_0xd9b5b8=_0xd9b5b8-0x0;var _0x59b128=_0x45a8[_0xd9b5b8];return _0x59b128;};'use strict';var Sequelize=require(_0x845a('0x0'));var moment=require('moment');module['exports']={'state':{'type':Sequelize[_0x845a('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x845a('0x2')]},'scheduledat':{'type':Sequelize[_0x845a('0x3')]},'countbusyretry':{'type':Sequelize[_0x845a('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x845a('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x845a('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x845a('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x845a('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x845a('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x845a('0x2')]},'calleridname':{'type':Sequelize[_0x845a('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x845a('0x3')]},'droptime':{'type':Sequelize[_0x845a('0x3')]},'endtime':{'type':Sequelize[_0x845a('0x3')]},'ringtime':{'type':Sequelize[_0x845a('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x845a('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x845a('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x845a('0x2')]},'campaign':{'type':Sequelize[_0x845a('0x2')]},'campaigntype':{'type':Sequelize[_0x845a('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x845a('0x2')]},'secondDisposition':{'type':Sequelize[_0x845a('0x2')]},'thirdDisposition':{'type':Sequelize[_0x845a('0x2')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x5e6559){var _0x4b85d4=this[_0x845a('0x4')](_0x845a('0x5'));if(_0x4b85d4&&_0x5e6559){this[_0x845a('0x6')](_0x845a('0x7'),moment(_0x5e6559)[_0x845a('0x8')](moment(_0x4b85d4),_0x845a('0x9')));}return this['setDataValue'](_0x845a('0xa'),_0x5e6559);}},'amd':{'type':Sequelize[_0x845a('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x845a('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x845a('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x845a('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x845a('0x3')]},'callback':{'type':Sequelize[_0x845a('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x845a('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x845a('0x3')]},'deleted':{'type':Sequelize[_0x845a('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x845a('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x845a('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x845a('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x845a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7612=['moment','exports','INTEGER','STRING','DATE','endtime','followuptime','diff','seconds','setDataValue','dispositionat','BOOLEAN','sequelize'];(function(_0x43794c,_0x4b4158){var _0xa31045=function(_0x2201e7){while(--_0x2201e7){_0x43794c['push'](_0x43794c['shift']());}};_0xa31045(++_0x4b4158);}(_0x7612,0x192));var _0x2761=function(_0x33fcbb,_0x291d0f){_0x33fcbb=_0x33fcbb-0x0;var _0x2efe40=_0x7612[_0x33fcbb];return _0x2efe40;};'use strict';var Sequelize=require(_0x2761('0x0'));var moment=require(_0x2761('0x1'));module[_0x2761('0x2')]={'state':{'type':Sequelize[_0x2761('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x2761('0x4')]},'scheduledat':{'type':Sequelize[_0x2761('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2761('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2761('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2761('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x2761('0x4')]},'originatecalleridname':{'type':Sequelize[_0x2761('0x4')]},'calleridnum':{'type':Sequelize[_0x2761('0x4')]},'calleridname':{'type':Sequelize[_0x2761('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x2761('0x5')]},'answertime':{'type':Sequelize[_0x2761('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x2761('0x5')]},'ringtime':{'type':Sequelize[_0x2761('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2761('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2761('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x2761('0x4')]},'campaigntype':{'type':Sequelize[_0x2761('0x4')]},'membername':{'type':Sequelize[_0x2761('0x4')]},'reason':{'type':Sequelize[_0x2761('0x4')]},'disposition':{'type':Sequelize[_0x2761('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2761('0x4')]},'dispositionat':{'type':Sequelize[_0x2761('0x5')],'set':function(_0x544f5a){var _0x234aef=this['getDataValue'](_0x2761('0x6'));if(_0x234aef&&_0x544f5a){this['setDataValue'](_0x2761('0x7'),moment(_0x544f5a)[_0x2761('0x8')](moment(_0x234aef),_0x2761('0x9')));}return this[_0x2761('0xa')](_0x2761('0xb'),_0x544f5a);}},'amd':{'type':Sequelize[_0x2761('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2761('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x2761('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x2761('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x2761('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2761('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2761('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x2761('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x2761('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2761('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2761('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2761('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2761('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 6bf1964..8ba5dff 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 _0x00b3=['fast-json-patch','moment','mustache','path','sox','to-csv','ejs','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','map','CmHopperFinal','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','describe','body','uniqueid','find','params','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','noSuchContacts','noAnswerContacts','abandonedContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','group','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','state\x20=\x204','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir'];(function(_0x2df170,_0xb37eca){var _0x2c157f=function(_0x37e6ff){while(--_0x37e6ff){_0x2df170['push'](_0x2df170['shift']());}};_0x2c157f(++_0xb37eca);}(_0x00b3,0x17a));var _0x300b=function(_0x2a6f21,_0xceac82){_0x2a6f21=_0x2a6f21-0x0;var _0xa00ba0=_0x00b3[_0x2a6f21];return _0xa00ba0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x300b('0x0'));var rimraf=require(_0x300b('0x1'));var zipdir=require(_0x300b('0x2'));var jsonpatch=require(_0x300b('0x3'));var rp=require('request-promise');var moment=require(_0x300b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x300b('0x5'));var util=require('util');var path=require(_0x300b('0x6'));var sox=require(_0x300b('0x7'));var csv=require(_0x300b('0x8'));var ejs=require(_0x300b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x300b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x300b('0x8'));var querystring=require(_0x300b('0xb'));var Papa=require(_0x300b('0xc'));var Redis=require('ioredis');var authService=require(_0x300b('0xd'));var qs=require(_0x300b('0xe'));var as=require(_0x300b('0xf'));var hardwareService=require(_0x300b('0x10'));var logger=require('../../config/logger')(_0x300b('0x11'));var utils=require(_0x300b('0x12'));var config=require(_0x300b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x300b('0x14'))['db'];function respondWithStatusCode(_0xea95bb,_0x138efb){_0x138efb=_0x138efb||0xcc;return function(_0x40c03b){if(_0x40c03b){return _0xea95bb[_0x300b('0x15')](_0x138efb);}return _0xea95bb[_0x300b('0x16')](_0x138efb)[_0x300b('0x17')]();};}function respondWithResult(_0x10bb41,_0x58746b){_0x58746b=_0x58746b||0xc8;return function(_0x54c3ee){if(_0x54c3ee){return _0x10bb41['status'](_0x58746b)['json'](_0x54c3ee);}};}function respondWithFilteredResult(_0x44e61b,_0x26c0e5){return function(_0xfb49f){if(_0xfb49f){var _0xd252fa=_0xfb49f[_0x300b('0x18')],_0x51186d=_0x26c0e5[_0x300b('0x19')],_0x509089=_0x26c0e5[_0x300b('0x19')]+_0x26c0e5['limit'],_0x35b1d7;if(_0x509089>=_0xd252fa){_0x509089=_0xd252fa;_0x35b1d7=0xc8;}else{_0x35b1d7=0xce;}_0x44e61b[_0x300b('0x16')](_0x35b1d7);return _0x44e61b[_0x300b('0x1a')](_0x300b('0x1b'),_0x51186d+'-'+_0x509089+'/'+_0xd252fa)['json'](_0xfb49f);}return null;};}function patchUpdates(_0x47551b){return function(_0x10174b){try{jsonpatch[_0x300b('0x1c')](_0x10174b,_0x47551b,!![]);}catch(_0x1e12da){return BPromise['reject'](_0x1e12da);}return _0x10174b[_0x300b('0x1d')]();};}function saveUpdates(_0x16bfc6,_0x971d15){return function(_0x4a5f75){if(_0x4a5f75){return _0x4a5f75[_0x300b('0x1e')](_0x16bfc6)[_0x300b('0x1f')](function(_0x30a057){return _0x30a057;});}return null;};}function removeEntity(_0x502c5f,_0x26913f){return function(_0x5b14ed){if(_0x5b14ed){return _0x5b14ed['destroy']()[_0x300b('0x1f')](function(){_0x502c5f[_0x300b('0x16')](0xcc)[_0x300b('0x17')]();});}};}function handleEntityNotFound(_0x3ea40b,_0x3219aa){return function(_0x44e6a6){if(!_0x44e6a6){_0x3ea40b[_0x300b('0x15')](0x194);}return _0x44e6a6;};}function handleError(_0x2fa577,_0x118dbd){_0x118dbd=_0x118dbd||0x1f4;return function(_0x544658){logger[_0x300b('0x20')](_0x544658[_0x300b('0x21')]);if(_0x544658[_0x300b('0x22')]){delete _0x544658[_0x300b('0x22')];}_0x2fa577['status'](_0x118dbd)['send'](_0x544658);};}exports['index']=function(_0x39794a,_0x4a1300){var _0x1241c7={},_0x2496e0={},_0x60bb0c={'count':0x0,'rows':[]};var _0x30b260=_[_0x300b('0x23')](db[_0x300b('0x24')][_0x300b('0x25')],function(_0x159b63){return{'name':_0x159b63[_0x300b('0x26')],'type':_0x159b63[_0x300b('0x27')]['key']};});_0x2496e0['model']=_[_0x300b('0x23')](_0x30b260,_0x300b('0x22'));_0x2496e0[_0x300b('0x28')]=_[_0x300b('0x29')](_0x39794a['query']);_0x2496e0[_0x300b('0x2a')]=_['intersection'](_0x2496e0['model'],_0x2496e0['query']);_0x1241c7[_0x300b('0x2b')]=_[_0x300b('0x2c')](_0x2496e0['model'],qs[_0x300b('0x2d')](_0x39794a[_0x300b('0x28')]['fields']));_0x1241c7[_0x300b('0x2b')]=_0x1241c7['attributes'][_0x300b('0x2e')]?_0x1241c7[_0x300b('0x2b')]:_0x2496e0[_0x300b('0x2f')];if(!_0x39794a[_0x300b('0x28')][_0x300b('0x30')](_0x300b('0x31'))){_0x1241c7[_0x300b('0x32')]=qs['limit'](_0x39794a[_0x300b('0x28')]['limit']);_0x1241c7[_0x300b('0x19')]=qs[_0x300b('0x19')](_0x39794a['query'][_0x300b('0x19')]);}_0x1241c7[_0x300b('0x33')]=qs['sort'](_0x39794a[_0x300b('0x28')][_0x300b('0x34')]);_0x1241c7[_0x300b('0x35')]=qs['filters'](_[_0x300b('0x36')](_0x39794a[_0x300b('0x28')],_0x2496e0[_0x300b('0x2a')]),_0x30b260);if(_0x39794a[_0x300b('0x28')][_0x300b('0x37')]){_0x1241c7[_0x300b('0x35')]=_[_0x300b('0x38')](_0x1241c7['where'],{'$or':_[_0x300b('0x23')](_0x30b260,function(_0x30b72){if(_0x30b72['type']!==_0x300b('0x39')){var _0x5dc5e2={};_0x5dc5e2[_0x30b72['name']]={'$like':'%'+_0x39794a[_0x300b('0x28')][_0x300b('0x37')]+'%'};return _0x5dc5e2;}})});}_0x1241c7=_[_0x300b('0x38')]({},_0x1241c7,_0x39794a[_0x300b('0x3a')]);var _0xa9c0bf={'where':_0x1241c7['where']};return db[_0x300b('0x24')][_0x300b('0x18')](_0xa9c0bf)['then'](function(_0x43af8f){_0x60bb0c['count']=_0x43af8f;if(_0x39794a[_0x300b('0x28')][_0x300b('0x3b')]){_0x1241c7[_0x300b('0x3c')]=[{'all':!![]}];}return db[_0x300b('0x24')][_0x300b('0x3d')](_0x1241c7);})[_0x300b('0x1f')](function(_0x256536){_0x60bb0c[_0x300b('0x3e')]=_0x256536;return _0x60bb0c;})[_0x300b('0x1f')](respondWithFilteredResult(_0x4a1300,_0x1241c7))[_0x300b('0x3f')](handleError(_0x4a1300,null));};exports[_0x300b('0x40')]=function(_0x479779,_0x4ee1d0){var _0x320a7c={'raw':!![],'where':{'id':_0x479779['params']['id']}},_0x566af2={};_0x566af2[_0x300b('0x2f')]=_[_0x300b('0x29')](db[_0x300b('0x24')]['rawAttributes']);_0x566af2[_0x300b('0x28')]=_['keys'](_0x479779['query']);_0x566af2[_0x300b('0x2a')]=_[_0x300b('0x2c')](_0x566af2['model'],_0x566af2[_0x300b('0x28')]);_0x320a7c[_0x300b('0x2b')]=_['intersection'](_0x566af2[_0x300b('0x2f')],qs[_0x300b('0x2d')](_0x479779['query'][_0x300b('0x2d')]));_0x320a7c[_0x300b('0x2b')]=_0x320a7c[_0x300b('0x2b')][_0x300b('0x2e')]?_0x320a7c[_0x300b('0x2b')]:_0x566af2[_0x300b('0x2f')];if(_0x479779[_0x300b('0x28')][_0x300b('0x3b')]){_0x320a7c['include']=[{'all':!![]}];}_0x320a7c=_['merge']({},_0x320a7c,_0x479779[_0x300b('0x3a')]);return db['CmHopperFinal']['find'](_0x320a7c)[_0x300b('0x1f')](handleEntityNotFound(_0x4ee1d0,null))[_0x300b('0x1f')](respondWithResult(_0x4ee1d0,null))[_0x300b('0x3f')](handleError(_0x4ee1d0,null));};exports[_0x300b('0x41')]=function(_0x1406e8,_0x33f978){return db['CmHopperFinal'][_0x300b('0x41')]()['then'](respondWithResult(_0x33f978,null))['catch'](handleError(_0x33f978,null));};exports[_0x300b('0x1e')]=function(_0x44d1b4,_0x5814dc){if(_0x44d1b4[_0x300b('0x42')][_0x300b('0x43')]){delete _0x44d1b4[_0x300b('0x42')][_0x300b('0x43')];}return db['CmHopperFinal'][_0x300b('0x44')]({'where':{'uniqueid':_0x44d1b4[_0x300b('0x45')]['id']}})['then'](handleEntityNotFound(_0x5814dc,null))[_0x300b('0x1f')](saveUpdates(_0x44d1b4[_0x300b('0x42')],null))[_0x300b('0x1f')](respondWithResult(_0x5814dc,null))['catch'](handleError(_0x5814dc,null));};exports[_0x300b('0x46')]=function(_0x3be837,_0x22a1a9,_0x355522){return db[_0x300b('0x24')][_0x300b('0x3d')]({'raw':![],'where':{'VoiceQueueId':_0x3be837[_0x300b('0x45')]['id']},'attributes':[[db[_0x300b('0x47')]['fn'](_0x300b('0x48'),db[_0x300b('0x47')]['fn']('IF',db[_0x300b('0x47')][_0x300b('0x49')](_0x300b('0x4a')))),'noSuchContacts'],[db['sequelize']['fn'](_0x300b('0x48'),db[_0x300b('0x47')]['fn']('IF',db[_0x300b('0x47')]['literal'](_0x300b('0x4b')))),'noAnswerContacts'],[db[_0x300b('0x47')]['fn'](_0x300b('0x48'),db['sequelize']['fn']('IF',db[_0x300b('0x47')][_0x300b('0x49')](_0x300b('0x4c')))),_0x300b('0x4d')],[db['sequelize']['fn'](_0x300b('0x48'),db['sequelize']['fn']('IF',db[_0x300b('0x47')][_0x300b('0x49')](_0x300b('0x4e')))),_0x300b('0x4f')],[db[_0x300b('0x47')]['fn'](_0x300b('0x48'),db[_0x300b('0x47')]['fn']('IF',db[_0x300b('0x47')][_0x300b('0x49')](_0x300b('0x50')))),_0x300b('0x51')],[db[_0x300b('0x47')]['fn'](_0x300b('0x48'),db[_0x300b('0x47')]['fn']('IF',db['sequelize'][_0x300b('0x49')](_0x300b('0x52')))),'abandonedContacts'],[db['sequelize']['fn'](_0x300b('0x48'),db[_0x300b('0x47')]['fn']('IF',db[_0x300b('0x47')][_0x300b('0x49')](_0x300b('0x53')))),_0x300b('0x54')],[db[_0x300b('0x47')]['fn']('COUNT',db[_0x300b('0x47')]['fn']('IF',db[_0x300b('0x47')]['literal'](_0x300b('0x55')))),'answeringMachine']]})[_0x300b('0x1f')](handleEntityNotFound(_0x22a1a9,null))[_0x300b('0x1f')](respondWithResult(_0x22a1a9,null))[_0x300b('0x3f')](handleError(_0x22a1a9,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x1edcc5,_0x3abd98,_0x371396){return db[_0x300b('0x24')]['findAll']({'raw':![],'where':{'CampaignId':_0x1edcc5[_0x300b('0x45')]['id']},'attributes':[[db['sequelize']['fn'](_0x300b('0x48'),db[_0x300b('0x47')]['fn']('IF',db['sequelize'][_0x300b('0x49')](_0x300b('0x4a')))),_0x300b('0x56')],[db['sequelize']['fn'](_0x300b('0x48'),db[_0x300b('0x47')]['fn']('IF',db['sequelize'][_0x300b('0x49')]('`state`\x20=\x203,\x201,\x20null'))),_0x300b('0x57')],[db[_0x300b('0x47')]['fn'](_0x300b('0x48'),db[_0x300b('0x47')]['fn']('IF',db[_0x300b('0x47')][_0x300b('0x49')](_0x300b('0x4c')))),_0x300b('0x4d')],[db[_0x300b('0x47')]['fn'](_0x300b('0x48'),db[_0x300b('0x47')]['fn']('IF',db[_0x300b('0x47')][_0x300b('0x49')](_0x300b('0x4e')))),_0x300b('0x4f')],[db[_0x300b('0x47')]['fn'](_0x300b('0x48'),db[_0x300b('0x47')]['fn']('IF',db[_0x300b('0x47')][_0x300b('0x49')](_0x300b('0x50')))),_0x300b('0x51')],[db[_0x300b('0x47')]['fn']('COUNT',db[_0x300b('0x47')]['fn']('IF',db['sequelize'][_0x300b('0x49')](_0x300b('0x52')))),_0x300b('0x58')],[db[_0x300b('0x47')]['fn'](_0x300b('0x48'),db[_0x300b('0x47')]['fn']('IF',db[_0x300b('0x47')][_0x300b('0x49')]('`state`\x20=\x2022,\x201,\x20null'))),_0x300b('0x54')],[db['sequelize']['fn']('COUNT',db[_0x300b('0x47')]['fn']('IF',db[_0x300b('0x47')][_0x300b('0x49')](_0x300b('0x55')))),_0x300b('0x59')]]})['then'](handleEntityNotFound(_0x3abd98,null))[_0x300b('0x1f')](respondWithResult(_0x3abd98,null))[_0x300b('0x3f')](handleError(_0x3abd98,null));};exports[_0x300b('0x5a')]=function(_0x24c09f,_0x135a4a,_0x2760a5){return db[_0x300b('0x5b')]['find']({'where':{'id':_0x24c09f[_0x300b('0x45')]['id']}})[_0x300b('0x1f')](handleEntityNotFound(_0x135a4a,null))[_0x300b('0x1f')](function(_0x2d15c5){var _0x37935f;if(_0x2d15c5){_0x37935f=squel[_0x300b('0x5c')]()[_0x300b('0x5d')](_0x300b('0x5e'))['fromQuery'](['phone',_0x300b('0x5f'),_0x300b('0x60'),_0x300b('0x61'),_0x300b('0x62'),_0x300b('0x63'),_0x300b('0x64')],squel[_0x300b('0x65')]()[_0x300b('0x66')](_0x300b('0x67'),_0x300b('0x68'))[_0x300b('0x66')]('NOW()','scheduledAt')[_0x300b('0x66')](_0x300b('0x69'),_0x300b('0x60'))['field'](_0x300b('0x6a'),'ListId')['field'](_0x300b('0x6b'),_0x300b('0x62'))[_0x300b('0x66')](_0x300b('0x6c'),'createdAt')['field'](_0x300b('0x6c'),_0x300b('0x64'))[_0x300b('0x6d')](_0x300b('0x6e'))[_0x300b('0x35')](_0x300b('0x6f'),_0x24c09f[_0x300b('0x45')]['id'][_0x300b('0x70')]())[_0x300b('0x35')]('state\x20=\x20?',_0x24c09f['body'][_0x300b('0x71')]['toString']())['where'](_0x300b('0x72'))[_0x300b('0x35')](_0x300b('0x73'),squel['select']()[_0x300b('0x66')](_0x300b('0x68'))['from'](_0x300b('0x5e'))[_0x300b('0x35')](_0x300b('0x6f'),_0x24c09f[_0x300b('0x45')]['id'][_0x300b('0x70')]()))[_0x300b('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x300b('0x74'))[_0x300b('0x6d')](_0x300b('0x6e'))[_0x300b('0x35')](_0x300b('0x6f'),_0x24c09f['params']['id'][_0x300b('0x70')]())[_0x300b('0x35')]('state\x20=\x204'))[_0x300b('0x75')](_0x300b('0x60')))[_0x300b('0x70')]();return db[_0x300b('0x47')][_0x300b('0x28')](_0x37935f);}return[];})[_0x300b('0x1f')](respondWithResult(_0x135a4a,null))[_0x300b('0x3f')](handleError(_0x135a4a,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x4d5b09,_0x33423f,_0x404b84){return db[_0x300b('0x76')][_0x300b('0x44')]({'where':{'id':_0x4d5b09['params']['id']}})[_0x300b('0x1f')](handleEntityNotFound(_0x33423f,null))['then'](function(_0x3dc216){var _0x5a7c85;if(_0x3dc216){_0x5a7c85=squel['insert']()[_0x300b('0x5d')]('cm_hopper')['fromQuery']([_0x300b('0x68'),_0x300b('0x5f'),_0x300b('0x60'),_0x300b('0x61'),_0x300b('0x77'),_0x300b('0x63'),_0x300b('0x64')],squel[_0x300b('0x65')]()[_0x300b('0x66')]('ANY_VALUE(calleridnum)',_0x300b('0x68'))[_0x300b('0x66')](_0x300b('0x6c'),_0x300b('0x5f'))[_0x300b('0x66')]('ANY_VALUE(ContactId)',_0x300b('0x60'))[_0x300b('0x66')](_0x300b('0x6a'),_0x300b('0x61'))[_0x300b('0x66')](_0x300b('0x78'),_0x300b('0x77'))[_0x300b('0x66')](_0x300b('0x6c'),_0x300b('0x63'))[_0x300b('0x66')](_0x300b('0x6c'),_0x300b('0x64'))[_0x300b('0x6d')]('cm_hopper_final')[_0x300b('0x35')](_0x300b('0x79'),_0x4d5b09[_0x300b('0x45')]['id'][_0x300b('0x70')]())[_0x300b('0x35')](_0x300b('0x7a'),_0x4d5b09[_0x300b('0x42')][_0x300b('0x71')][_0x300b('0x70')]())['where'](_0x300b('0x72'))[_0x300b('0x35')](_0x300b('0x73'),squel['select']()['field'](_0x300b('0x68'))[_0x300b('0x6d')](_0x300b('0x5e'))[_0x300b('0x35')]('CampaignId\x20=\x20?',_0x4d5b09['params']['id']['toString']()))[_0x300b('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x300b('0x65')]()[_0x300b('0x66')]('calleridnum')[_0x300b('0x6d')]('cm_hopper_final')[_0x300b('0x35')](_0x300b('0x79'),_0x4d5b09['params']['id'][_0x300b('0x70')]())[_0x300b('0x35')](_0x300b('0x7b')))[_0x300b('0x75')](_0x300b('0x60')))['toString']();return db['sequelize']['query'](_0x5a7c85);}return[];})['then'](respondWithResult(_0x33423f,null))['catch'](handleError(_0x33423f,null));};exports[_0x300b('0x7c')]=function(_0x36e342,_0x533905,_0x5396b1){return db[_0x300b('0x7d')][_0x300b('0x7e')]({'where':{'VoiceQueueId':_0x36e342[_0x300b('0x42')][_0x300b('0x62')],'CampaignId':_0x36e342[_0x300b('0x42')][_0x300b('0x77')],'ContactId':_0x36e342[_0x300b('0x42')]['ContactId']}})['then'](handleEntityNotFound(_0x533905,null))[_0x300b('0x1f')](function(_0x3f9495){if(_0x3f9495){return _0x3f9495;}return null;})[_0x300b('0x1f')](respondWithResult(_0x533905,null))[_0x300b('0x3f')](handleError(_0x533905,null));}; \ No newline at end of file +var _0x9649=['reCallContacts','VoiceQueue','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','state','CampaignId\x20=\x20?','checkContactHopper','CmHopper','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','describe','body','uniqueid','find','params','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine'];(function(_0x4f0797,_0x258af1){var _0x3ebec2=function(_0x1630ab){while(--_0x1630ab){_0x4f0797['push'](_0x4f0797['shift']());}};_0x3ebec2(++_0x258af1);}(_0x9649,0x19f));var _0x9964=function(_0x220f29,_0x1266a8){_0x220f29=_0x220f29-0x0;var _0x12612d=_0x9649[_0x220f29];return _0x12612d;};'use strict';var pdf=require(_0x9964('0x0'));var emlformat=require(_0x9964('0x1'));var rimraf=require(_0x9964('0x2'));var zipdir=require(_0x9964('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9964('0x4'));var moment=require(_0x9964('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9964('0x6'));var util=require('util');var path=require(_0x9964('0x7'));var sox=require(_0x9964('0x8'));var csv=require(_0x9964('0x9'));var ejs=require(_0x9964('0xa'));var fs=require('fs');var _=require(_0x9964('0xb'));var squel=require(_0x9964('0xc'));var crypto=require(_0x9964('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9964('0xe'));var toCsv=require(_0x9964('0x9'));var querystring=require('querystring');var Papa=require(_0x9964('0xf'));var Redis=require(_0x9964('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9964('0x11'));var hardwareService=require(_0x9964('0x12'));var logger=require(_0x9964('0x13'))(_0x9964('0x14'));var utils=require(_0x9964('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9964('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56a69d,_0x39c624){_0x39c624=_0x39c624||0xcc;return function(_0x547b98){if(_0x547b98){return _0x56a69d[_0x9964('0x17')](_0x39c624);}return _0x56a69d[_0x9964('0x18')](_0x39c624)['end']();};}function respondWithResult(_0x1fd4b4,_0x463dbf){_0x463dbf=_0x463dbf||0xc8;return function(_0x11dfc9){if(_0x11dfc9){return _0x1fd4b4[_0x9964('0x18')](_0x463dbf)[_0x9964('0x19')](_0x11dfc9);}};}function respondWithFilteredResult(_0x5f002e,_0x411544){return function(_0x226e78){if(_0x226e78){var _0x57b330=_0x226e78[_0x9964('0x1a')],_0x2fd50d=_0x411544[_0x9964('0x1b')],_0x3fe796=_0x411544[_0x9964('0x1b')]+_0x411544[_0x9964('0x1c')],_0x57fe55;if(_0x3fe796>=_0x57b330){_0x3fe796=_0x57b330;_0x57fe55=0xc8;}else{_0x57fe55=0xce;}_0x5f002e['status'](_0x57fe55);return _0x5f002e[_0x9964('0x1d')](_0x9964('0x1e'),_0x2fd50d+'-'+_0x3fe796+'/'+_0x57b330)['json'](_0x226e78);}return null;};}function patchUpdates(_0x2eb3a8){return function(_0x3f6472){try{jsonpatch[_0x9964('0x1f')](_0x3f6472,_0x2eb3a8,!![]);}catch(_0x1477b5){return BPromise[_0x9964('0x20')](_0x1477b5);}return _0x3f6472[_0x9964('0x21')]();};}function saveUpdates(_0x400bb5,_0x414649){return function(_0x1072b5){if(_0x1072b5){return _0x1072b5[_0x9964('0x22')](_0x400bb5)['then'](function(_0x455b62){return _0x455b62;});}return null;};}function removeEntity(_0x447026,_0x4c479f){return function(_0x2b03a8){if(_0x2b03a8){return _0x2b03a8['destroy']()[_0x9964('0x23')](function(){_0x447026[_0x9964('0x18')](0xcc)[_0x9964('0x24')]();});}};}function handleEntityNotFound(_0x167525,_0x2d049c){return function(_0x62eda6){if(!_0x62eda6){_0x167525['sendStatus'](0x194);}return _0x62eda6;};}function handleError(_0x452c96,_0x378e34){_0x378e34=_0x378e34||0x1f4;return function(_0x5961e9){logger[_0x9964('0x25')](_0x5961e9[_0x9964('0x26')]);if(_0x5961e9[_0x9964('0x27')]){delete _0x5961e9[_0x9964('0x27')];}_0x452c96[_0x9964('0x18')](_0x378e34)['send'](_0x5961e9);};}exports[_0x9964('0x28')]=function(_0x4c2b44,_0x44cb60){var _0x512f6b={},_0x17b29f={},_0x5dc789={'count':0x0,'rows':[]};var _0x432f81=_[_0x9964('0x29')](db[_0x9964('0x2a')][_0x9964('0x2b')],function(_0x11cdce){return{'name':_0x11cdce[_0x9964('0x2c')],'type':_0x11cdce[_0x9964('0x2d')][_0x9964('0x2e')]};});_0x17b29f[_0x9964('0x2f')]=_['map'](_0x432f81,'name');_0x17b29f['query']=_['keys'](_0x4c2b44[_0x9964('0x30')]);_0x17b29f[_0x9964('0x31')]=_[_0x9964('0x32')](_0x17b29f[_0x9964('0x2f')],_0x17b29f[_0x9964('0x30')]);_0x512f6b[_0x9964('0x33')]=_[_0x9964('0x32')](_0x17b29f[_0x9964('0x2f')],qs[_0x9964('0x34')](_0x4c2b44['query'][_0x9964('0x34')]));_0x512f6b[_0x9964('0x33')]=_0x512f6b['attributes'][_0x9964('0x35')]?_0x512f6b[_0x9964('0x33')]:_0x17b29f[_0x9964('0x2f')];if(!_0x4c2b44[_0x9964('0x30')]['hasOwnProperty']('nolimit')){_0x512f6b[_0x9964('0x1c')]=qs['limit'](_0x4c2b44['query'][_0x9964('0x1c')]);_0x512f6b[_0x9964('0x1b')]=qs['offset'](_0x4c2b44['query'][_0x9964('0x1b')]);}_0x512f6b[_0x9964('0x36')]=qs['sort'](_0x4c2b44[_0x9964('0x30')]['sort']);_0x512f6b['where']=qs['filters'](_[_0x9964('0x37')](_0x4c2b44[_0x9964('0x30')],_0x17b29f[_0x9964('0x31')]),_0x432f81);if(_0x4c2b44[_0x9964('0x30')][_0x9964('0x38')]){_0x512f6b[_0x9964('0x39')]=_[_0x9964('0x3a')](_0x512f6b[_0x9964('0x39')],{'$or':_[_0x9964('0x29')](_0x432f81,function(_0x526c96){if(_0x526c96[_0x9964('0x2d')]!==_0x9964('0x3b')){var _0x39cd4a={};_0x39cd4a[_0x526c96[_0x9964('0x27')]]={'$like':'%'+_0x4c2b44['query']['filter']+'%'};return _0x39cd4a;}})});}_0x512f6b=_[_0x9964('0x3a')]({},_0x512f6b,_0x4c2b44[_0x9964('0x3c')]);var _0x3d9cbf={'where':_0x512f6b[_0x9964('0x39')]};return db[_0x9964('0x2a')]['count'](_0x3d9cbf)[_0x9964('0x23')](function(_0xca740f){_0x5dc789[_0x9964('0x1a')]=_0xca740f;if(_0x4c2b44[_0x9964('0x30')][_0x9964('0x3d')]){_0x512f6b[_0x9964('0x3e')]=[{'all':!![]}];}return db[_0x9964('0x2a')][_0x9964('0x3f')](_0x512f6b);})[_0x9964('0x23')](function(_0x29efe7){_0x5dc789[_0x9964('0x40')]=_0x29efe7;return _0x5dc789;})[_0x9964('0x23')](respondWithFilteredResult(_0x44cb60,_0x512f6b))[_0x9964('0x41')](handleError(_0x44cb60,null));};exports[_0x9964('0x42')]=function(_0x35348a,_0x2f625e){var _0x57e107={'raw':!![],'where':{'id':_0x35348a['params']['id']}},_0x344c6c={};_0x344c6c[_0x9964('0x2f')]=_[_0x9964('0x43')](db[_0x9964('0x2a')]['rawAttributes']);_0x344c6c[_0x9964('0x30')]=_['keys'](_0x35348a[_0x9964('0x30')]);_0x344c6c['filters']=_[_0x9964('0x32')](_0x344c6c[_0x9964('0x2f')],_0x344c6c[_0x9964('0x30')]);_0x57e107[_0x9964('0x33')]=_[_0x9964('0x32')](_0x344c6c[_0x9964('0x2f')],qs[_0x9964('0x34')](_0x35348a[_0x9964('0x30')]['fields']));_0x57e107[_0x9964('0x33')]=_0x57e107[_0x9964('0x33')][_0x9964('0x35')]?_0x57e107[_0x9964('0x33')]:_0x344c6c[_0x9964('0x2f')];if(_0x35348a[_0x9964('0x30')][_0x9964('0x3d')]){_0x57e107[_0x9964('0x3e')]=[{'all':!![]}];}_0x57e107=_[_0x9964('0x3a')]({},_0x57e107,_0x35348a[_0x9964('0x3c')]);return db['CmHopperFinal']['find'](_0x57e107)[_0x9964('0x23')](handleEntityNotFound(_0x2f625e,null))['then'](respondWithResult(_0x2f625e,null))[_0x9964('0x41')](handleError(_0x2f625e,null));};exports['describe']=function(_0x485dfc,_0x5d8720){return db[_0x9964('0x2a')][_0x9964('0x44')]()[_0x9964('0x23')](respondWithResult(_0x5d8720,null))['catch'](handleError(_0x5d8720,null));};exports['update']=function(_0x652882,_0x4aefaa){if(_0x652882[_0x9964('0x45')][_0x9964('0x46')]){delete _0x652882[_0x9964('0x45')][_0x9964('0x46')];}return db[_0x9964('0x2a')][_0x9964('0x47')]({'where':{'uniqueid':_0x652882['params']['id']}})[_0x9964('0x23')](handleEntityNotFound(_0x4aefaa,null))[_0x9964('0x23')](saveUpdates(_0x652882[_0x9964('0x45')],null))[_0x9964('0x23')](respondWithResult(_0x4aefaa,null))[_0x9964('0x41')](handleError(_0x4aefaa,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x1e7c32,_0x3873f5,_0x2847e8){return db['CmHopperFinal'][_0x9964('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x1e7c32[_0x9964('0x48')]['id']},'attributes':[[db[_0x9964('0x49')]['fn'](_0x9964('0x4a'),db[_0x9964('0x49')]['fn']('IF',db[_0x9964('0x49')][_0x9964('0x4b')](_0x9964('0x4c')))),'noSuchContacts'],[db[_0x9964('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9964('0x49')]['literal'](_0x9964('0x4d')))),_0x9964('0x4e')],[db[_0x9964('0x49')]['fn']('COUNT',db[_0x9964('0x49')]['fn']('IF',db[_0x9964('0x49')][_0x9964('0x4b')](_0x9964('0x4f')))),_0x9964('0x50')],[db[_0x9964('0x49')]['fn'](_0x9964('0x4a'),db[_0x9964('0x49')]['fn']('IF',db[_0x9964('0x49')]['literal'](_0x9964('0x51')))),'congestionContacts'],[db[_0x9964('0x49')]['fn'](_0x9964('0x4a'),db[_0x9964('0x49')]['fn']('IF',db['sequelize'][_0x9964('0x4b')](_0x9964('0x52')))),_0x9964('0x53')],[db[_0x9964('0x49')]['fn'](_0x9964('0x4a'),db['sequelize']['fn']('IF',db[_0x9964('0x49')][_0x9964('0x4b')](_0x9964('0x54')))),_0x9964('0x55')],[db[_0x9964('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x9964('0x56')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0x9964('0x49')]['fn']('IF',db['sequelize'][_0x9964('0x4b')](_0x9964('0x57')))),_0x9964('0x58')]]})['then'](handleEntityNotFound(_0x3873f5,null))[_0x9964('0x23')](respondWithResult(_0x3873f5,null))['catch'](handleError(_0x3873f5,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x3e4944,_0x192a2c,_0x2ffa8e){return db['CmHopperFinal'][_0x9964('0x3f')]({'raw':![],'where':{'CampaignId':_0x3e4944[_0x9964('0x48')]['id']},'attributes':[[db[_0x9964('0x49')]['fn']('COUNT',db[_0x9964('0x49')]['fn']('IF',db[_0x9964('0x49')][_0x9964('0x4b')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x9964('0x49')]['fn'](_0x9964('0x4a'),db[_0x9964('0x49')]['fn']('IF',db[_0x9964('0x49')][_0x9964('0x4b')](_0x9964('0x4d')))),_0x9964('0x4e')],[db[_0x9964('0x49')]['fn'](_0x9964('0x4a'),db[_0x9964('0x49')]['fn']('IF',db[_0x9964('0x49')][_0x9964('0x4b')](_0x9964('0x4f')))),_0x9964('0x50')],[db[_0x9964('0x49')]['fn']('COUNT',db[_0x9964('0x49')]['fn']('IF',db[_0x9964('0x49')][_0x9964('0x4b')](_0x9964('0x51')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x9964('0x4b')](_0x9964('0x52')))),'dropContacts'],[db[_0x9964('0x49')]['fn'](_0x9964('0x4a'),db[_0x9964('0x49')]['fn']('IF',db[_0x9964('0x49')][_0x9964('0x4b')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x9964('0x55')],[db[_0x9964('0x49')]['fn']('COUNT',db[_0x9964('0x49')]['fn']('IF',db['sequelize'][_0x9964('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),_0x9964('0x59')],[db[_0x9964('0x49')]['fn']('COUNT',db[_0x9964('0x49')]['fn']('IF',db['sequelize']['literal'](_0x9964('0x57')))),'answeringMachine']]})[_0x9964('0x23')](handleEntityNotFound(_0x192a2c,null))['then'](respondWithResult(_0x192a2c,null))[_0x9964('0x41')](handleError(_0x192a2c,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x19c6f2,_0xe4a9a8,_0x336f52){return db[_0x9964('0x5a')][_0x9964('0x47')]({'where':{'id':_0x19c6f2[_0x9964('0x48')]['id']}})['then'](handleEntityNotFound(_0xe4a9a8,null))[_0x9964('0x23')](function(_0x2d90c9){var _0xa59931;if(_0x2d90c9){_0xa59931=squel['insert']()[_0x9964('0x5b')](_0x9964('0x5c'))[_0x9964('0x5d')]([_0x9964('0x5e'),_0x9964('0x5f'),_0x9964('0x60'),_0x9964('0x61'),_0x9964('0x62'),_0x9964('0x63'),_0x9964('0x64')],squel[_0x9964('0x65')]()['field'](_0x9964('0x66'),'phone')[_0x9964('0x67')](_0x9964('0x68'),_0x9964('0x5f'))[_0x9964('0x67')]('ANY_VALUE(ContactId)',_0x9964('0x60'))[_0x9964('0x67')](_0x9964('0x69'),_0x9964('0x61'))[_0x9964('0x67')](_0x9964('0x6a'),_0x9964('0x62'))[_0x9964('0x67')](_0x9964('0x68'),_0x9964('0x63'))['field'](_0x9964('0x68'),_0x9964('0x64'))[_0x9964('0x6b')](_0x9964('0x6c'))[_0x9964('0x39')](_0x9964('0x6d'),_0x19c6f2['params']['id'][_0x9964('0x6e')]())[_0x9964('0x39')](_0x9964('0x6f'),_0x19c6f2[_0x9964('0x45')]['state']['toString']())['where'](_0x9964('0x70'))[_0x9964('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9964('0x65')]()[_0x9964('0x67')](_0x9964('0x5e'))['from'](_0x9964('0x5c'))[_0x9964('0x39')]('VoiceQueueId\x20=\x20?',_0x19c6f2[_0x9964('0x48')]['id'][_0x9964('0x6e')]()))['where'](_0x9964('0x71'),squel[_0x9964('0x65')]()[_0x9964('0x67')](_0x9964('0x72'))[_0x9964('0x6b')]('cm_hopper_final')[_0x9964('0x39')]('VoiceQueueId\x20=\x20?',_0x19c6f2[_0x9964('0x48')]['id'][_0x9964('0x6e')]())['where'](_0x9964('0x73')))[_0x9964('0x74')](_0x9964('0x60')))[_0x9964('0x6e')]();return db['sequelize'][_0x9964('0x30')](_0xa59931);}return[];})[_0x9964('0x23')](respondWithResult(_0xe4a9a8,null))[_0x9964('0x41')](handleError(_0xe4a9a8,null));};exports[_0x9964('0x75')]=function(_0x364b64,_0x265d7e,_0x128882){return db[_0x9964('0x76')][_0x9964('0x47')]({'where':{'id':_0x364b64[_0x9964('0x48')]['id']}})[_0x9964('0x23')](handleEntityNotFound(_0x265d7e,null))[_0x9964('0x23')](function(_0x4d6ac6){var _0x424e6e;if(_0x4d6ac6){_0x424e6e=squel['insert']()[_0x9964('0x5b')](_0x9964('0x5c'))['fromQuery']([_0x9964('0x5e'),_0x9964('0x5f'),_0x9964('0x60'),_0x9964('0x61'),_0x9964('0x77'),_0x9964('0x63'),_0x9964('0x64')],squel[_0x9964('0x65')]()['field'](_0x9964('0x66'),_0x9964('0x5e'))[_0x9964('0x67')]('NOW()',_0x9964('0x5f'))[_0x9964('0x67')](_0x9964('0x78'),'ContactId')[_0x9964('0x67')](_0x9964('0x69'),_0x9964('0x61'))[_0x9964('0x67')](_0x9964('0x79'),_0x9964('0x77'))[_0x9964('0x67')](_0x9964('0x68'),_0x9964('0x63'))['field'](_0x9964('0x68'),_0x9964('0x64'))[_0x9964('0x6b')]('cm_hopper_final')[_0x9964('0x39')]('CampaignId\x20=\x20?',_0x364b64[_0x9964('0x48')]['id'][_0x9964('0x6e')]())[_0x9964('0x39')]('state\x20=\x20?',_0x364b64[_0x9964('0x45')][_0x9964('0x7a')][_0x9964('0x6e')]())['where'](_0x9964('0x70'))[_0x9964('0x39')](_0x9964('0x71'),squel['select']()[_0x9964('0x67')](_0x9964('0x5e'))[_0x9964('0x6b')]('cm_hopper')[_0x9964('0x39')](_0x9964('0x7b'),_0x364b64[_0x9964('0x48')]['id']['toString']()))[_0x9964('0x39')](_0x9964('0x71'),squel[_0x9964('0x65')]()[_0x9964('0x67')](_0x9964('0x72'))[_0x9964('0x6b')]('cm_hopper_final')[_0x9964('0x39')](_0x9964('0x7b'),_0x364b64[_0x9964('0x48')]['id'][_0x9964('0x6e')]())[_0x9964('0x39')](_0x9964('0x73')))[_0x9964('0x74')]('ContactId'))[_0x9964('0x6e')]();return db[_0x9964('0x49')][_0x9964('0x30')](_0x424e6e);}return[];})[_0x9964('0x23')](respondWithResult(_0x265d7e,null))[_0x9964('0x41')](handleError(_0x265d7e,null));};exports[_0x9964('0x7c')]=function(_0xf24f8a,_0x3b03af,_0x2a9a53){return db[_0x9964('0x7d')]['findOne']({'where':{'VoiceQueueId':_0xf24f8a['body']['VoiceQueueId'],'CampaignId':_0xf24f8a['body'][_0x9964('0x77')],'ContactId':_0xf24f8a[_0x9964('0x45')][_0x9964('0x60')]}})[_0x9964('0x23')](handleEntityNotFound(_0x3b03af,null))[_0x9964('0x23')](function(_0xf61611){if(_0xf61611){return _0xf61611;}return null;})[_0x9964('0x23')](respondWithResult(_0x3b03af,null))['catch'](handleError(_0x3b03af,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 5b409a3..d0ee823 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 _0x9b52=['cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','moment','bluebird','path','rimraf','./cmHopperFinal.attributes','exports','CmHopperFinal'];(function(_0x4d97eb,_0x1cf134){var _0x5d54eb=function(_0x24261a){while(--_0x24261a){_0x4d97eb['push'](_0x4d97eb['shift']());}};_0x5d54eb(++_0x1cf134);}(_0x9b52,0xf3));var _0x29b5=function(_0x16e8a1,_0x4da812){_0x16e8a1=_0x16e8a1-0x0;var _0x573867=_0x9b52[_0x16e8a1];return _0x573867;};'use strict';var _=require(_0x29b5('0x0'));var util=require('util');var logger=require(_0x29b5('0x1'))('api');var moment=require(_0x29b5('0x2'));var BPromise=require(_0x29b5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x29b5('0x4'));var rimraf=require(_0x29b5('0x5'));var config=require('../../config/environment');var attributes=require(_0x29b5('0x6'));module[_0x29b5('0x7')]=function(_0x5dfca6,_0x546148){return _0x5dfca6['define'](_0x29b5('0x8'),attributes,{'tableName':_0x29b5('0x9'),'paranoid':![],'indexes':[{'name':_0x29b5('0xa'),'fields':[_0x29b5('0xa')]},{'name':_0x29b5('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xca25=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','define'];(function(_0x369829,_0x5149ad){var _0xb9c603=function(_0x2fc8c9){while(--_0x2fc8c9){_0x369829['push'](_0x369829['shift']());}};_0xb9c603(++_0x5149ad);}(_0xca25,0xa0));var _0x5ca2=function(_0x149f32,_0x4273f7){_0x149f32=_0x149f32-0x0;var _0x11f475=_0xca25[_0x149f32];return _0x11f475;};'use strict';var _=require(_0x5ca2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5ca2('0x1'));var moment=require(_0x5ca2('0x2'));var BPromise=require('bluebird');var rp=require(_0x5ca2('0x3'));var fs=require('fs');var path=require(_0x5ca2('0x4'));var rimraf=require(_0x5ca2('0x5'));var config=require(_0x5ca2('0x6'));var attributes=require(_0x5ca2('0x7'));module['exports']=function(_0x4bd7ef,_0x7217b1){return _0x4bd7ef[_0x5ca2('0x8')](_0x5ca2('0x9'),attributes,{'tableName':_0x5ca2('0xa'),'paranoid':![],'indexes':[{'name':_0x5ca2('0xb'),'fields':['calleridnum']},{'name':_0x5ca2('0xc'),'fields':[_0x5ca2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 44edfb1..ef0abd4 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 _0x4590=['CreateCmHopperFinal','CmHopperFinal','body','options','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','CmHopperFinal,\x20%s,\x20%s','request\x20sent','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3aa992,_0x1f7f25){var _0x305c22=function(_0x7b9c2){while(--_0x7b9c2){_0x3aa992['push'](_0x3aa992['shift']());}};_0x305c22(++_0x1f7f25);}(_0x4590,0x1df));var _0x0459=function(_0x3771af,_0x20119f){_0x3771af=_0x3771af-0x0;var _0x21c4fd=_0x4590[_0x3771af];return _0x21c4fd;};'use strict';var _=require(_0x0459('0x0'));var util=require(_0x0459('0x1'));var moment=require('moment');var BPromise=require(_0x0459('0x2'));var rs=require(_0x0459('0x3'));var fs=require('fs');var Redis=require(_0x0459('0x4'));var db=require(_0x0459('0x5'))['db'];var utils=require(_0x0459('0x6'));var logger=require('../../config/logger')(_0x0459('0x7'));var config=require(_0x0459('0x8'));var jayson=require(_0x0459('0x9'));var client=jayson[_0x0459('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x119b83,_0x390d04,_0x42d469){return new BPromise(function(_0x27ab25,_0x1657a6){return client['request'](_0x119b83,_0x42d469)[_0x0459('0xb')](function(_0x24a026){logger['info'](_0x0459('0xc'),_0x390d04,_0x0459('0xd'));logger['debug'](_0x0459('0xe'),_0x390d04,_0x0459('0xd'),JSON[_0x0459('0xf')](_0x24a026));if(_0x24a026[_0x0459('0x10')]){if(_0x24a026[_0x0459('0x10')][_0x0459('0x11')]===0x1f4){logger[_0x0459('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x390d04,_0x24a026['error'][_0x0459('0x12')]);return _0x1657a6(_0x24a026[_0x0459('0x10')][_0x0459('0x12')]);}logger[_0x0459('0x10')](_0x0459('0xc'),_0x390d04,_0x24a026[_0x0459('0x10')][_0x0459('0x12')]);return _0x27ab25(_0x24a026['error']['message']);}else{logger['info'](_0x0459('0xc'),_0x390d04,'request\x20sent');_0x27ab25(_0x24a026[_0x0459('0x13')][_0x0459('0x12')]);}})[_0x0459('0x14')](function(_0x263e75){logger['error'](_0x0459('0xc'),_0x390d04,_0x263e75);_0x1657a6(_0x263e75);});});}exports[_0x0459('0x15')]=function(_0x2fdf07){var _0x5d1d38=this;return new Promise(function(_0x2726ff,_0x2382dd){return db[_0x0459('0x16')]['create'](_0x2fdf07[_0x0459('0x17')],{'raw':_0x2fdf07[_0x0459('0x18')]?_0x2fdf07[_0x0459('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x0459('0xb')](function(_0x4f9c5d){logger['info'](_0x0459('0x15'),_0x2fdf07);logger['debug'](_0x0459('0x15'),_0x2fdf07,JSON['stringify'](_0x4f9c5d));_0x2726ff(_0x4f9c5d);})['catch'](function(_0x322b3f){logger[_0x0459('0x10')](_0x0459('0x15'),_0x322b3f[_0x0459('0x12')],_0x2fdf07);_0x2382dd(_0x5d1d38['error'](0x1f4,_0x322b3f[_0x0459('0x12')]));});});}; \ No newline at end of file +var _0x7985=['client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','options','raw','lodash','util','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x451762,_0x5069dd){var _0x5726fa=function(_0x39958a){while(--_0x39958a){_0x451762['push'](_0x451762['shift']());}};_0x5726fa(++_0x5069dd);}(_0x7985,0x119));var _0x5798=function(_0x5ba353,_0x11fd8b){_0x5ba353=_0x5ba353-0x0;var _0x149f6b=_0x7985[_0x5ba353];return _0x149f6b;};'use strict';var _=require(_0x5798('0x0'));var util=require(_0x5798('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5798('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5798('0x3'));var logger=require('../../config/logger')(_0x5798('0x4'));var config=require(_0x5798('0x5'));var jayson=require(_0x5798('0x6'));var client=jayson[_0x5798('0x7')][_0x5798('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x433085,_0xf99a47,_0x520900){return new BPromise(function(_0x21705e,_0x7a3952){return client[_0x5798('0x9')](_0x433085,_0x520900)[_0x5798('0xa')](function(_0x1c5bff){logger[_0x5798('0xb')](_0x5798('0xc'),_0xf99a47,'request\x20sent');logger[_0x5798('0xd')](_0x5798('0xe'),_0xf99a47,_0x5798('0xf'),JSON[_0x5798('0x10')](_0x1c5bff));if(_0x1c5bff[_0x5798('0x11')]){if(_0x1c5bff[_0x5798('0x11')]['code']===0x1f4){logger['error'](_0x5798('0xc'),_0xf99a47,_0x1c5bff[_0x5798('0x11')][_0x5798('0x12')]);return _0x7a3952(_0x1c5bff[_0x5798('0x11')][_0x5798('0x12')]);}logger[_0x5798('0x11')](_0x5798('0xc'),_0xf99a47,_0x1c5bff[_0x5798('0x11')]['message']);return _0x21705e(_0x1c5bff[_0x5798('0x11')][_0x5798('0x12')]);}else{logger[_0x5798('0xb')](_0x5798('0xc'),_0xf99a47,_0x5798('0xf'));_0x21705e(_0x1c5bff[_0x5798('0x13')]['message']);}})['catch'](function(_0x1527cb){logger[_0x5798('0x11')](_0x5798('0xc'),_0xf99a47,_0x1527cb);_0x7a3952(_0x1527cb);});});}exports[_0x5798('0x14')]=function(_0x50a693){var _0x40b22c=this;return new Promise(function(_0x41945e,_0x3ae4ab){return db[_0x5798('0x15')]['create'](_0x50a693['body'],{'raw':_0x50a693[_0x5798('0x16')]?_0x50a693[_0x5798('0x16')][_0x5798('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x2664d7){logger['info']('CreateCmHopperFinal',_0x50a693);logger[_0x5798('0xd')](_0x5798('0x14'),_0x50a693,JSON['stringify'](_0x2664d7));_0x41945e(_0x2664d7);})['catch'](function(_0x53a46a){logger[_0x5798('0x11')]('CreateCmHopperFinal',_0x53a46a['message'],_0x50a693);_0x3ae4ab(_0x40b22c[_0x5798('0x11')](0x1f4,_0x53a46a[_0x5798('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 0961d01..431c177 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 _0x8819=['/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','update','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show'];(function(_0x5187c9,_0x1b46ac){var _0x354e6d=function(_0x9ccdfb){while(--_0x9ccdfb){_0x5187c9['push'](_0x5187c9['shift']());}};_0x354e6d(++_0x1b46ac);}(_0x8819,0x9b));var _0x9881=function(_0x20f752,_0x58b67b){_0x20f752=_0x20f752-0x0;var _0x4412b2=_0x8819[_0x20f752];return _0x4412b2;};'use strict';var multer=require(_0x9881('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9881('0x1'));var express=require(_0x9881('0x2'));var router=express[_0x9881('0x3')]();var auth=require(_0x9881('0x4'));var interaction=require(_0x9881('0x5'));var config=require(_0x9881('0x6'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0x9881('0x7')](),controller[_0x9881('0x8')]);router[_0x9881('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x9881('0xa')]);router[_0x9881('0x9')](_0x9881('0xb'),auth['isAuthenticated'](),controller[_0x9881('0xc')]);router[_0x9881('0x9')](_0x9881('0xd'),auth[_0x9881('0x7')](),controller[_0x9881('0xe')]);router[_0x9881('0x9')](_0x9881('0xf'),auth[_0x9881('0x7')](),controller[_0x9881('0x10')]);router[_0x9881('0x11')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0x9881('0x12')]);router[_0x9881('0x11')](_0x9881('0x13'),auth[_0x9881('0x7')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x9881('0x11')](_0x9881('0x14'),auth[_0x9881('0x7')](),controller[_0x9881('0x15')]);router[_0x9881('0x16')](_0x9881('0xb'),auth[_0x9881('0x7')](),controller[_0x9881('0x17')]);module['exports']=router; \ No newline at end of file +var _0xea9d=['countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x276015,_0x57eb3d){var _0x385345=function(_0x3c5bb4){while(--_0x3c5bb4){_0x276015['push'](_0x276015['shift']());}};_0x385345(++_0x57eb3d);}(_0xea9d,0x1a3));var _0xdea9=function(_0x22811e,_0x873f03){_0x22811e=_0x22811e-0x0;var _0x217145=_0xea9d[_0x22811e];return _0x217145;};'use strict';var multer=require(_0xdea9('0x0'));var util=require(_0xdea9('0x1'));var path=require(_0xdea9('0x2'));var timeout=require('connect-timeout');var express=require(_0xdea9('0x3'));var router=express[_0xdea9('0x4')]();var auth=require(_0xdea9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdea9('0x6'));var controller=require('./cmHopperFinal.controller');router[_0xdea9('0x7')]('/',auth[_0xdea9('0x8')](),controller[_0xdea9('0x9')]);router[_0xdea9('0x7')](_0xdea9('0xa'),auth[_0xdea9('0x8')](),controller[_0xdea9('0xb')]);router[_0xdea9('0x7')](_0xdea9('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xdea9('0x7')]('/voice/queue/countAttributes/:id',auth[_0xdea9('0x8')](),controller[_0xdea9('0xd')]);router['get'](_0xdea9('0xe'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0xdea9('0xf')](_0xdea9('0x10'),auth[_0xdea9('0x8')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xdea9('0xf')](_0xdea9('0x11'),auth[_0xdea9('0x8')](),controller[_0xdea9('0x12')]);router[_0xdea9('0xf')](_0xdea9('0x13'),auth[_0xdea9('0x8')](),controller[_0xdea9('0x14')]);router[_0xdea9('0x15')](_0xdea9('0xc'),auth[_0xdea9('0x8')](),controller[_0xdea9('0x16')]);module[_0xdea9('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index a51cbf0..6907078 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 _0x0f0f=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x1a4cac,_0x116f47){var _0x142f2f=function(_0x4a1e47){while(--_0x4a1e47){_0x1a4cac['push'](_0x1a4cac['shift']());}};_0x142f2f(++_0x116f47);}(_0x0f0f,0x1e4));var _0xf0f0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0f0f[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xf0f0('0x0'));module[_0xf0f0('0x1')]={'state':{'type':Sequelize[_0xf0f0('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf0f0('0x3')]},'scheduledat':{'type':Sequelize[_0xf0f0('0x4')]},'countbusyretry':{'type':Sequelize[_0xf0f0('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf0f0('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf0f0('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf0f0('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xf0f0('0x3')]},'originatecalleridname':{'type':Sequelize[_0xf0f0('0x3')]},'calleridnum':{'type':Sequelize[_0xf0f0('0x3')]},'calleridname':{'type':Sequelize[_0xf0f0('0x3')]},'starttime':{'type':Sequelize[_0xf0f0('0x4')]},'responsetime':{'type':Sequelize[_0xf0f0('0x4')]},'answertime':{'type':Sequelize[_0xf0f0('0x4')]},'droptime':{'type':Sequelize[_0xf0f0('0x4')]},'endtime':{'type':Sequelize[_0xf0f0('0x4')]},'ringtime':{'type':Sequelize[_0xf0f0('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf0f0('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf0f0('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf0f0('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf0f0('0x3')]},'campaign':{'type':Sequelize[_0xf0f0('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xf0f0('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xf0f0('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xf0f0('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf0f0('0x4')]},'recallme':{'type':Sequelize[_0xf0f0('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xf0f0('0x4')]},'edited':{'type':Sequelize[_0xf0f0('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf0f0('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf0f0('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf9ab=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x269afe,_0x107775){var _0x17d6ba=function(_0x4b6735){while(--_0x4b6735){_0x269afe['push'](_0x269afe['shift']());}};_0x17d6ba(++_0x107775);}(_0xf9ab,0x155));var _0xbf9a=function(_0x13d617,_0x554d30){_0x13d617=_0x13d617-0x0;var _0x8bbfaa=_0xf9ab[_0x13d617];return _0x8bbfaa;};'use strict';var Sequelize=require(_0xbf9a('0x0'));module[_0xbf9a('0x1')]={'state':{'type':Sequelize[_0xbf9a('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbf9a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbf9a('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbf9a('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xbf9a('0x3')]},'calleridnum':{'type':Sequelize[_0xbf9a('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xbf9a('0x4')]},'responsetime':{'type':Sequelize[_0xbf9a('0x4')]},'answertime':{'type':Sequelize[_0xbf9a('0x4')]},'droptime':{'type':Sequelize[_0xbf9a('0x4')]},'endtime':{'type':Sequelize[_0xbf9a('0x4')]},'ringtime':{'type':Sequelize[_0xbf9a('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbf9a('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbf9a('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbf9a('0x3')]},'campaign':{'type':Sequelize[_0xbf9a('0x3')]},'campaigntype':{'type':Sequelize[_0xbf9a('0x3')]},'membername':{'type':Sequelize[_0xbf9a('0x3')]},'reason':{'type':Sequelize[_0xbf9a('0x3')]},'amd':{'type':Sequelize[_0xbf9a('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xbf9a('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbf9a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbf9a('0x4')]},'recallme':{'type':Sequelize[_0xbf9a('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xbf9a('0x4')]},'edited':{'type':Sequelize[_0xbf9a('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xbf9a('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbf9a('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbf9a('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbf9a('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 49a71bb..2507ef8 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 _0x9773=['include','findAll','catch','show','params','keys','includeAll','find','create','body','describe','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','count'];(function(_0x4d67df,_0x2d32b5){var _0x1fe4ac=function(_0x20dfc9){while(--_0x20dfc9){_0x4d67df['push'](_0x4d67df['shift']());}};_0x1fe4ac(++_0x2d32b5);}(_0x9773,0xfc));var _0x3977=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9773[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x3977('0x0'));var emlformat=require(_0x3977('0x1'));var rimraf=require(_0x3977('0x2'));var zipdir=require(_0x3977('0x3'));var jsonpatch=require(_0x3977('0x4'));var rp=require(_0x3977('0x5'));var moment=require(_0x3977('0x6'));var BPromise=require(_0x3977('0x7'));var Mustache=require(_0x3977('0x8'));var util=require('util');var path=require(_0x3977('0x9'));var sox=require('sox');var csv=require(_0x3977('0xa'));var ejs=require(_0x3977('0xb'));var fs=require('fs');var _=require(_0x3977('0xc'));var squel=require('squel');var crypto=require(_0x3977('0xd'));var jsforce=require(_0x3977('0xe'));var deskjs=require(_0x3977('0xf'));var toCsv=require(_0x3977('0xa'));var querystring=require(_0x3977('0x10'));var Papa=require(_0x3977('0x11'));var Redis=require(_0x3977('0x12'));var authService=require(_0x3977('0x13'));var qs=require(_0x3977('0x14'));var as=require(_0x3977('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3977('0x16'));var utils=require(_0x3977('0x17'));var config=require(_0x3977('0x18'));var licenseUtil=require(_0x3977('0x19'));var db=require(_0x3977('0x1a'))['db'];function respondWithStatusCode(_0x47af69,_0x3a1e6){_0x3a1e6=_0x3a1e6||0xcc;return function(_0x2c3030){if(_0x2c3030){return _0x47af69['sendStatus'](_0x3a1e6);}return _0x47af69['status'](_0x3a1e6)[_0x3977('0x1b')]();};}function respondWithResult(_0xec4641,_0x295649){_0x295649=_0x295649||0xc8;return function(_0x1120b9){if(_0x1120b9){return _0xec4641[_0x3977('0x1c')](_0x295649)[_0x3977('0x1d')](_0x1120b9);}};}function respondWithFilteredResult(_0x38daa9,_0x27bd89){return function(_0x2cc15d){if(_0x2cc15d){var _0x58ac23=_0x2cc15d['count'],_0x43c1c5=_0x27bd89[_0x3977('0x1e')],_0x44ce3c=_0x27bd89[_0x3977('0x1e')]+_0x27bd89[_0x3977('0x1f')],_0x2da23c;if(_0x44ce3c>=_0x58ac23){_0x44ce3c=_0x58ac23;_0x2da23c=0xc8;}else{_0x2da23c=0xce;}_0x38daa9['status'](_0x2da23c);return _0x38daa9['set'](_0x3977('0x20'),_0x43c1c5+'-'+_0x44ce3c+'/'+_0x58ac23)[_0x3977('0x1d')](_0x2cc15d);}return null;};}function patchUpdates(_0x2a0171){return function(_0x5e8d28){try{jsonpatch[_0x3977('0x21')](_0x5e8d28,_0x2a0171,!![]);}catch(_0x4b5747){return BPromise[_0x3977('0x22')](_0x4b5747);}return _0x5e8d28[_0x3977('0x23')]();};}function saveUpdates(_0x1ff0fc,_0x141fdb){return function(_0x27a43c){if(_0x27a43c){return _0x27a43c[_0x3977('0x24')](_0x1ff0fc)[_0x3977('0x25')](function(_0xde5d5e){return _0xde5d5e;});}return null;};}function removeEntity(_0x5c12ed,_0x1e3047){return function(_0x377def){if(_0x377def){return _0x377def[_0x3977('0x26')]()[_0x3977('0x25')](function(){_0x5c12ed[_0x3977('0x1c')](0xcc)[_0x3977('0x1b')]();});}};}function handleEntityNotFound(_0x430b4e,_0x339a6a){return function(_0x5db6d4){if(!_0x5db6d4){_0x430b4e[_0x3977('0x27')](0x194);}return _0x5db6d4;};}function handleError(_0x18354b,_0x23a71b){_0x23a71b=_0x23a71b||0x1f4;return function(_0x2eab6f){logger[_0x3977('0x28')](_0x2eab6f[_0x3977('0x29')]);if(_0x2eab6f[_0x3977('0x2a')]){delete _0x2eab6f['name'];}_0x18354b[_0x3977('0x1c')](_0x23a71b)[_0x3977('0x2b')](_0x2eab6f);};}exports[_0x3977('0x2c')]=function(_0x5d972a,_0xeb0566){var _0x14699f={},_0x511b02={},_0x5dec1c={'count':0x0,'rows':[]};var _0x4a7de3=_[_0x3977('0x2d')](db[_0x3977('0x2e')][_0x3977('0x2f')],function(_0x2d83f3){return{'name':_0x2d83f3[_0x3977('0x30')],'type':_0x2d83f3['type'][_0x3977('0x31')]};});_0x511b02[_0x3977('0x32')]=_[_0x3977('0x2d')](_0x4a7de3,_0x3977('0x2a'));_0x511b02['query']=_['keys'](_0x5d972a['query']);_0x511b02[_0x3977('0x33')]=_[_0x3977('0x34')](_0x511b02['model'],_0x511b02[_0x3977('0x35')]);_0x14699f[_0x3977('0x36')]=_['intersection'](_0x511b02[_0x3977('0x32')],qs[_0x3977('0x37')](_0x5d972a[_0x3977('0x35')]['fields']));_0x14699f[_0x3977('0x36')]=_0x14699f[_0x3977('0x36')][_0x3977('0x38')]?_0x14699f[_0x3977('0x36')]:_0x511b02[_0x3977('0x32')];if(!_0x5d972a[_0x3977('0x35')][_0x3977('0x39')](_0x3977('0x3a'))){_0x14699f[_0x3977('0x1f')]=qs[_0x3977('0x1f')](_0x5d972a[_0x3977('0x35')]['limit']);_0x14699f['offset']=qs[_0x3977('0x1e')](_0x5d972a[_0x3977('0x35')]['offset']);}_0x14699f[_0x3977('0x3b')]=qs[_0x3977('0x3c')](_0x5d972a[_0x3977('0x35')][_0x3977('0x3c')]);_0x14699f[_0x3977('0x3d')]=qs['filters'](_['pick'](_0x5d972a[_0x3977('0x35')],_0x511b02[_0x3977('0x33')]),_0x4a7de3);if(_0x5d972a[_0x3977('0x35')]['filter']){_0x14699f['where']=_[_0x3977('0x3e')](_0x14699f[_0x3977('0x3d')],{'$or':_['map'](_0x4a7de3,function(_0x39354d){if(_0x39354d[_0x3977('0x3f')]!==_0x3977('0x40')){var _0x190c7e={};_0x190c7e[_0x39354d[_0x3977('0x2a')]]={'$like':'%'+_0x5d972a[_0x3977('0x35')][_0x3977('0x41')]+'%'};return _0x190c7e;}})});}_0x14699f=_['merge']({},_0x14699f,_0x5d972a[_0x3977('0x42')]);var _0x1b5fd3={'where':_0x14699f[_0x3977('0x3d')]};return db[_0x3977('0x2e')][_0x3977('0x43')](_0x1b5fd3)['then'](function(_0xb888be){_0x5dec1c[_0x3977('0x43')]=_0xb888be;if(_0x5d972a[_0x3977('0x35')]['includeAll']){_0x14699f[_0x3977('0x44')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x3977('0x45')](_0x14699f);})[_0x3977('0x25')](function(_0x494210){_0x5dec1c['rows']=_0x494210;return _0x5dec1c;})['then'](respondWithFilteredResult(_0xeb0566,_0x14699f))[_0x3977('0x46')](handleError(_0xeb0566,null));};exports[_0x3977('0x47')]=function(_0x3c4ee8,_0x765bcb){var _0x1bdaf3={'raw':!![],'where':{'id':_0x3c4ee8[_0x3977('0x48')]['id']}},_0x5c7f6d={};_0x5c7f6d[_0x3977('0x32')]=_[_0x3977('0x49')](db['CmHopperHistory'][_0x3977('0x2f')]);_0x5c7f6d[_0x3977('0x35')]=_['keys'](_0x3c4ee8[_0x3977('0x35')]);_0x5c7f6d[_0x3977('0x33')]=_['intersection'](_0x5c7f6d['model'],_0x5c7f6d[_0x3977('0x35')]);_0x1bdaf3[_0x3977('0x36')]=_[_0x3977('0x34')](_0x5c7f6d[_0x3977('0x32')],qs[_0x3977('0x37')](_0x3c4ee8[_0x3977('0x35')]['fields']));_0x1bdaf3['attributes']=_0x1bdaf3['attributes']['length']?_0x1bdaf3[_0x3977('0x36')]:_0x5c7f6d['model'];if(_0x3c4ee8[_0x3977('0x35')][_0x3977('0x4a')]){_0x1bdaf3[_0x3977('0x44')]=[{'all':!![]}];}_0x1bdaf3=_['merge']({},_0x1bdaf3,_0x3c4ee8[_0x3977('0x42')]);return db['CmHopperHistory'][_0x3977('0x4b')](_0x1bdaf3)[_0x3977('0x25')](handleEntityNotFound(_0x765bcb,null))[_0x3977('0x25')](respondWithResult(_0x765bcb,null))[_0x3977('0x46')](handleError(_0x765bcb,null));};exports[_0x3977('0x4c')]=function(_0x27c358,_0x461e40){return db[_0x3977('0x2e')][_0x3977('0x4c')](_0x27c358[_0x3977('0x4d')],{})[_0x3977('0x25')](respondWithResult(_0x461e40,0xc9))[_0x3977('0x46')](handleError(_0x461e40,null));};exports[_0x3977('0x4e')]=function(_0x1c7be4,_0x32bb66){return db[_0x3977('0x2e')][_0x3977('0x4e')]()['then'](respondWithResult(_0x32bb66,null))[_0x3977('0x46')](handleError(_0x32bb66,null));};exports[_0x3977('0x24')]=function(_0x57b235,_0x55a58c){if(_0x57b235['body'][_0x3977('0x4f')]){delete _0x57b235['body'][_0x3977('0x4f')];}return db[_0x3977('0x2e')]['find']({'where':{'uniqueid':_0x57b235[_0x3977('0x48')]['id']}})[_0x3977('0x25')](handleEntityNotFound(_0x55a58c,null))[_0x3977('0x25')](saveUpdates(_0x57b235[_0x3977('0x4d')],null))[_0x3977('0x25')](respondWithResult(_0x55a58c,null))['catch'](handleError(_0x55a58c,null));}; \ No newline at end of file +var _0x94ec=['include','findAll','rows','show','params','find','catch','create','body','describe','uniqueid','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','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','count','offset','limit','set','Content-Range','save','update','then','destroy','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll'];(function(_0x304fa5,_0x330004){var _0x59aec9=function(_0x262bb5){while(--_0x262bb5){_0x304fa5['push'](_0x304fa5['shift']());}};_0x59aec9(++_0x330004);}(_0x94ec,0x1df));var _0xc94e=function(_0x11ce5d,_0x53f225){_0x11ce5d=_0x11ce5d-0x0;var _0x49874e=_0x94ec[_0x11ce5d];return _0x49874e;};'use strict';var pdf=require(_0xc94e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc94e('0x1'));var zipdir=require(_0xc94e('0x2'));var jsonpatch=require(_0xc94e('0x3'));var rp=require(_0xc94e('0x4'));var moment=require(_0xc94e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc94e('0x6'));var csv=require('to-csv');var ejs=require(_0xc94e('0x7'));var fs=require('fs');var _=require(_0xc94e('0x8'));var squel=require(_0xc94e('0x9'));var crypto=require(_0xc94e('0xa'));var jsforce=require(_0xc94e('0xb'));var deskjs=require(_0xc94e('0xc'));var toCsv=require(_0xc94e('0xd'));var querystring=require(_0xc94e('0xe'));var Papa=require(_0xc94e('0xf'));var Redis=require(_0xc94e('0x10'));var authService=require(_0xc94e('0x11'));var qs=require(_0xc94e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc94e('0x13'));var logger=require(_0xc94e('0x14'))(_0xc94e('0x15'));var utils=require(_0xc94e('0x16'));var config=require(_0xc94e('0x17'));var licenseUtil=require(_0xc94e('0x18'));var db=require(_0xc94e('0x19'))['db'];function respondWithStatusCode(_0x36067e,_0x25d3da){_0x25d3da=_0x25d3da||0xcc;return function(_0x2d0f98){if(_0x2d0f98){return _0x36067e[_0xc94e('0x1a')](_0x25d3da);}return _0x36067e[_0xc94e('0x1b')](_0x25d3da)[_0xc94e('0x1c')]();};}function respondWithResult(_0xbc1f68,_0x195df7){_0x195df7=_0x195df7||0xc8;return function(_0x5de258){if(_0x5de258){return _0xbc1f68[_0xc94e('0x1b')](_0x195df7)[_0xc94e('0x1d')](_0x5de258);}};}function respondWithFilteredResult(_0x4434b8,_0x584546){return function(_0x109c82){if(_0x109c82){var _0x17b70b=_0x109c82[_0xc94e('0x1e')],_0x4fb6e3=_0x584546[_0xc94e('0x1f')],_0x4cbe27=_0x584546[_0xc94e('0x1f')]+_0x584546[_0xc94e('0x20')],_0x4af116;if(_0x4cbe27>=_0x17b70b){_0x4cbe27=_0x17b70b;_0x4af116=0xc8;}else{_0x4af116=0xce;}_0x4434b8['status'](_0x4af116);return _0x4434b8[_0xc94e('0x21')](_0xc94e('0x22'),_0x4fb6e3+'-'+_0x4cbe27+'/'+_0x17b70b)[_0xc94e('0x1d')](_0x109c82);}return null;};}function patchUpdates(_0x26b98b){return function(_0x57fe63){try{jsonpatch['apply'](_0x57fe63,_0x26b98b,!![]);}catch(_0xedaf02){return BPromise['reject'](_0xedaf02);}return _0x57fe63[_0xc94e('0x23')]();};}function saveUpdates(_0x4984f1,_0x94d18c){return function(_0x2aee5b){if(_0x2aee5b){return _0x2aee5b[_0xc94e('0x24')](_0x4984f1)[_0xc94e('0x25')](function(_0x1c4677){return _0x1c4677;});}return null;};}function removeEntity(_0x30956a,_0x546e64){return function(_0xaba54b){if(_0xaba54b){return _0xaba54b[_0xc94e('0x26')]()[_0xc94e('0x25')](function(){_0x30956a[_0xc94e('0x1b')](0xcc)[_0xc94e('0x1c')]();});}};}function handleEntityNotFound(_0xfc8012,_0x38323f){return function(_0x2279c4){if(!_0x2279c4){_0xfc8012['sendStatus'](0x194);}return _0x2279c4;};}function handleError(_0x4361fe,_0x1df663){_0x1df663=_0x1df663||0x1f4;return function(_0x206635){logger['error'](_0x206635[_0xc94e('0x27')]);if(_0x206635['name']){delete _0x206635[_0xc94e('0x28')];}_0x4361fe[_0xc94e('0x1b')](_0x1df663)['send'](_0x206635);};}exports[_0xc94e('0x29')]=function(_0x562305,_0x4365fc){var _0x2f8e5e={},_0x343542={},_0x344f1d={'count':0x0,'rows':[]};var _0x18a984=_[_0xc94e('0x2a')](db[_0xc94e('0x2b')][_0xc94e('0x2c')],function(_0x48c079){return{'name':_0x48c079[_0xc94e('0x2d')],'type':_0x48c079[_0xc94e('0x2e')][_0xc94e('0x2f')]};});_0x343542[_0xc94e('0x30')]=_[_0xc94e('0x2a')](_0x18a984,_0xc94e('0x28'));_0x343542[_0xc94e('0x31')]=_[_0xc94e('0x32')](_0x562305['query']);_0x343542[_0xc94e('0x33')]=_[_0xc94e('0x34')](_0x343542['model'],_0x343542[_0xc94e('0x31')]);_0x2f8e5e['attributes']=_[_0xc94e('0x34')](_0x343542[_0xc94e('0x30')],qs['fields'](_0x562305[_0xc94e('0x31')][_0xc94e('0x35')]));_0x2f8e5e[_0xc94e('0x36')]=_0x2f8e5e[_0xc94e('0x36')][_0xc94e('0x37')]?_0x2f8e5e[_0xc94e('0x36')]:_0x343542['model'];if(!_0x562305['query'][_0xc94e('0x38')](_0xc94e('0x39'))){_0x2f8e5e[_0xc94e('0x20')]=qs[_0xc94e('0x20')](_0x562305[_0xc94e('0x31')]['limit']);_0x2f8e5e[_0xc94e('0x1f')]=qs[_0xc94e('0x1f')](_0x562305[_0xc94e('0x31')][_0xc94e('0x1f')]);}_0x2f8e5e[_0xc94e('0x3a')]=qs['sort'](_0x562305[_0xc94e('0x31')][_0xc94e('0x3b')]);_0x2f8e5e[_0xc94e('0x3c')]=qs[_0xc94e('0x33')](_[_0xc94e('0x3d')](_0x562305[_0xc94e('0x31')],_0x343542['filters']),_0x18a984);if(_0x562305['query'][_0xc94e('0x3e')]){_0x2f8e5e[_0xc94e('0x3c')]=_['merge'](_0x2f8e5e[_0xc94e('0x3c')],{'$or':_[_0xc94e('0x2a')](_0x18a984,function(_0x3d79cb){if(_0x3d79cb[_0xc94e('0x2e')]!==_0xc94e('0x3f')){var _0x12475b={};_0x12475b[_0x3d79cb['name']]={'$like':'%'+_0x562305[_0xc94e('0x31')][_0xc94e('0x3e')]+'%'};return _0x12475b;}})});}_0x2f8e5e=_[_0xc94e('0x40')]({},_0x2f8e5e,_0x562305[_0xc94e('0x41')]);var _0x4456dc={'where':_0x2f8e5e[_0xc94e('0x3c')]};return db[_0xc94e('0x2b')][_0xc94e('0x1e')](_0x4456dc)[_0xc94e('0x25')](function(_0x51cd29){_0x344f1d['count']=_0x51cd29;if(_0x562305[_0xc94e('0x31')][_0xc94e('0x42')]){_0x2f8e5e[_0xc94e('0x43')]=[{'all':!![]}];}return db[_0xc94e('0x2b')][_0xc94e('0x44')](_0x2f8e5e);})[_0xc94e('0x25')](function(_0x166297){_0x344f1d[_0xc94e('0x45')]=_0x166297;return _0x344f1d;})['then'](respondWithFilteredResult(_0x4365fc,_0x2f8e5e))['catch'](handleError(_0x4365fc,null));};exports[_0xc94e('0x46')]=function(_0x549746,_0x46d1b7){var _0x2dfd59={'raw':!![],'where':{'id':_0x549746[_0xc94e('0x47')]['id']}},_0x52062e={};_0x52062e[_0xc94e('0x30')]=_[_0xc94e('0x32')](db[_0xc94e('0x2b')]['rawAttributes']);_0x52062e[_0xc94e('0x31')]=_[_0xc94e('0x32')](_0x549746[_0xc94e('0x31')]);_0x52062e[_0xc94e('0x33')]=_[_0xc94e('0x34')](_0x52062e[_0xc94e('0x30')],_0x52062e[_0xc94e('0x31')]);_0x2dfd59[_0xc94e('0x36')]=_['intersection'](_0x52062e['model'],qs[_0xc94e('0x35')](_0x549746[_0xc94e('0x31')][_0xc94e('0x35')]));_0x2dfd59[_0xc94e('0x36')]=_0x2dfd59[_0xc94e('0x36')][_0xc94e('0x37')]?_0x2dfd59['attributes']:_0x52062e[_0xc94e('0x30')];if(_0x549746[_0xc94e('0x31')]['includeAll']){_0x2dfd59['include']=[{'all':!![]}];}_0x2dfd59=_['merge']({},_0x2dfd59,_0x549746[_0xc94e('0x41')]);return db[_0xc94e('0x2b')][_0xc94e('0x48')](_0x2dfd59)[_0xc94e('0x25')](handleEntityNotFound(_0x46d1b7,null))[_0xc94e('0x25')](respondWithResult(_0x46d1b7,null))[_0xc94e('0x49')](handleError(_0x46d1b7,null));};exports[_0xc94e('0x4a')]=function(_0x3df387,_0x51be3c){return db[_0xc94e('0x2b')][_0xc94e('0x4a')](_0x3df387[_0xc94e('0x4b')],{})[_0xc94e('0x25')](respondWithResult(_0x51be3c,0xc9))[_0xc94e('0x49')](handleError(_0x51be3c,null));};exports[_0xc94e('0x4c')]=function(_0x361e14,_0x4cbb17){return db['CmHopperHistory'][_0xc94e('0x4c')]()[_0xc94e('0x25')](respondWithResult(_0x4cbb17,null))[_0xc94e('0x49')](handleError(_0x4cbb17,null));};exports[_0xc94e('0x24')]=function(_0x990ab5,_0x2bcc12){if(_0x990ab5[_0xc94e('0x4b')][_0xc94e('0x4d')]){delete _0x990ab5[_0xc94e('0x4b')][_0xc94e('0x4d')];}return db[_0xc94e('0x2b')]['find']({'where':{'uniqueid':_0x990ab5['params']['id']}})[_0xc94e('0x25')](handleEntityNotFound(_0x2bcc12,null))[_0xc94e('0x25')](saveUpdates(_0x990ab5['body'],null))[_0xc94e('0x25')](respondWithResult(_0x2bcc12,null))[_0xc94e('0x49')](handleError(_0x2bcc12,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 97c5fb9..e4978db 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 _0xff37=['../../config/environment','define','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xb35caa,_0x3d2d7a){var _0x3a63da=function(_0x15c2cd){while(--_0x15c2cd){_0xb35caa['push'](_0xb35caa['shift']());}};_0x3a63da(++_0x3d2d7a);}(_0xff37,0xb9));var _0x7ff3=function(_0x30e8eb,_0x86b5df){_0x30e8eb=_0x30e8eb-0x0;var _0xc3dc41=_0xff37[_0x30e8eb];return _0xc3dc41;};'use strict';var _=require(_0x7ff3('0x0'));var util=require('util');var logger=require(_0x7ff3('0x1'))(_0x7ff3('0x2'));var moment=require(_0x7ff3('0x3'));var BPromise=require(_0x7ff3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ff3('0x5'));var rimraf=require(_0x7ff3('0x6'));var config=require(_0x7ff3('0x7'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x5f294,_0x581840){return _0x5f294[_0x7ff3('0x8')]('CmHopperHistory',attributes,{'tableName':_0x7ff3('0x9'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x7ff3('0xa')]},{'name':'uniqueid','fields':[_0x7ff3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x183b=['moment','path','rimraf','../../config/environment','./cmHopperHistory.attributes','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger'];(function(_0x3680e3,_0x5bf3a1){var _0x4c37b9=function(_0xf9990f){while(--_0xf9990f){_0x3680e3['push'](_0x3680e3['shift']());}};_0x4c37b9(++_0x5bf3a1);}(_0x183b,0x99));var _0xb183=function(_0x3c5aac,_0x972ee1){_0x3c5aac=_0x3c5aac-0x0;var _0x5cff78=_0x183b[_0x3c5aac];return _0x5cff78;};'use strict';var _=require(_0xb183('0x0'));var util=require(_0xb183('0x1'));var logger=require(_0xb183('0x2'))('api');var moment=require(_0xb183('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb183('0x4'));var rimraf=require(_0xb183('0x5'));var config=require(_0xb183('0x6'));var attributes=require(_0xb183('0x7'));module['exports']=function(_0x4ec3ad,_0x75f5e6){return _0x4ec3ad['define'](_0xb183('0x8'),attributes,{'tableName':_0xb183('0x9'),'paranoid':![],'indexes':[{'name':_0xb183('0xa'),'fields':[_0xb183('0xa')]},{'name':_0xb183('0xb'),'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 42b6db4..6fb4e1c 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 _0x1401=['`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','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','moment','bluebird','randomstring','../../mysqldb','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CreateCmHopperHistory','CmHopperHistory','options','raw','debug','where','sequelize','COUNT','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','AVG','literal','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','catch','GetVoiceQueueHopperHistory','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x1401,0xdb));var _0x1140=function(_0x39663f,_0x3c942f){_0x39663f=_0x39663f-0x0;var _0x2f9d6c=_0x1401[_0x39663f];return _0x2f9d6c;};'use strict';var _=require(_0x1140('0x0'));var util=require('util');var moment=require(_0x1140('0x1'));var BPromise=require(_0x1140('0x2'));var rs=require(_0x1140('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1140('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1140('0x5'));var client=jayson[_0x1140('0x6')][_0x1140('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xe4a4ff,_0xb7fb1c,_0x1e55d3){return new BPromise(function(_0x241efe,_0x10a6ef){return client[_0x1140('0x8')](_0xe4a4ff,_0x1e55d3)[_0x1140('0x9')](function(_0x5d779a){logger[_0x1140('0xa')](_0x1140('0xb'),_0xb7fb1c,'request\x20sent');logger['debug'](_0x1140('0xc'),_0xb7fb1c,_0x1140('0xd'),JSON[_0x1140('0xe')](_0x5d779a));if(_0x5d779a[_0x1140('0xf')]){if(_0x5d779a[_0x1140('0xf')][_0x1140('0x10')]===0x1f4){logger[_0x1140('0xf')](_0x1140('0xb'),_0xb7fb1c,_0x5d779a[_0x1140('0xf')][_0x1140('0x11')]);return _0x10a6ef(_0x5d779a['error']['message']);}logger[_0x1140('0xf')](_0x1140('0xb'),_0xb7fb1c,_0x5d779a['error'][_0x1140('0x11')]);return _0x241efe(_0x5d779a[_0x1140('0xf')][_0x1140('0x11')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0xb7fb1c,_0x1140('0xd'));_0x241efe(_0x5d779a['result']['message']);}})['catch'](function(_0x735804){logger[_0x1140('0xf')](_0x1140('0xb'),_0xb7fb1c,_0x735804);_0x10a6ef(_0x735804);});});}exports[_0x1140('0x12')]=function(_0x460d4a){var _0x5bdea9=this;return new Promise(function(_0x243912,_0x5c338b){return db[_0x1140('0x13')]['create'](_0x460d4a['body'],{'raw':_0x460d4a[_0x1140('0x14')]?_0x460d4a[_0x1140('0x14')][_0x1140('0x15')]===undefined?!![]:![]:!![]})[_0x1140('0x9')](function(_0x455463){logger['info'](_0x1140('0x12'),_0x460d4a);logger[_0x1140('0x16')](_0x1140('0x12'),_0x460d4a,JSON[_0x1140('0xe')](_0x455463));_0x243912(_0x455463);})['catch'](function(_0x5ce7e7){logger[_0x1140('0xf')](_0x1140('0x12'),_0x5ce7e7[_0x1140('0x11')],_0x460d4a);_0x5c338b(_0x5bdea9['error'](0x1f4,_0x5ce7e7[_0x1140('0x11')]));});});};exports['AvgHandleTime']=function(_0x2ab569){var _0x39c1ef=this;return new Promise(function(_0x12a880,_0x5834cb){return db['CmHopperHistory']['findAll']({'raw':_0x2ab569[_0x1140('0x14')]?_0x2ab569[_0x1140('0x14')][_0x1140('0x15')]===undefined?!![]:![]:!![],'where':_0x2ab569[_0x1140('0x14')]?_0x2ab569[_0x1140('0x14')][_0x1140('0x17')]||null:null,'attributes':[[db[_0x1140('0x18')]['fn'](_0x1140('0x19'),db[_0x1140('0x18')]['col']('id')),_0x1140('0x1a')],[db[_0x1140('0x18')]['fn']('COUNT',db[_0x1140('0x18')]['fn']('IF',db[_0x1140('0x18')]['literal'](_0x1140('0x1b')))),_0x1140('0x1c')],[db['sequelize']['fn'](_0x1140('0x19'),db[_0x1140('0x18')]['fn']('IF',db['sequelize']['literal'](_0x1140('0x1d')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x1140('0x18')]['fn'](_0x1140('0x19'),db[_0x1140('0x18')]['fn']('IF',db['sequelize']['literal'](_0x1140('0x1e')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x1140('0x18')]['fn'](_0x1140('0x1f'),db[_0x1140('0x18')]['fn']('IF',db['sequelize'][_0x1140('0x20')](_0x1140('0x21')))),_0x1140('0x22')],[db['sequelize']['fn']('AVG',db[_0x1140('0x18')]['fn']('IF',db[_0x1140('0x18')]['literal'](_0x1140('0x23')))),_0x1140('0x24')]]})['then'](function(_0xb09cc4){logger[_0x1140('0xa')](_0x1140('0x25'),_0x2ab569);logger[_0x1140('0x16')](_0x1140('0x25'),_0x2ab569,JSON[_0x1140('0xe')](_0xb09cc4));_0x12a880(_0xb09cc4);})[_0x1140('0x26')](function(_0x3e6d62){logger[_0x1140('0xf')](_0x1140('0x25'),_0x3e6d62['message'],_0x2ab569);_0x5834cb(_0x39c1ef[_0x1140('0xf')](0x1f4,_0x3e6d62[_0x1140('0x11')]));});});};exports[_0x1140('0x27')]=function(_0x18f598){var _0x3099f6=this;return new Promise(function(_0x316467,_0x47f815){return db[_0x1140('0x13')][_0x1140('0x28')]({'raw':_0x18f598[_0x1140('0x14')]?_0x18f598[_0x1140('0x14')][_0x1140('0x15')]===undefined?!![]:![]:!![],'where':_0x18f598[_0x1140('0x14')]?_0x18f598[_0x1140('0x14')][_0x1140('0x17')]||null:null,'attributes':[[_0x1140('0x29'),_0x1140('0x2a')],[db[_0x1140('0x18')]['fn'](_0x1140('0x19'),db[_0x1140('0x18')]['fn']('IF',db[_0x1140('0x18')]['literal'](_0x1140('0x2b')))),_0x1140('0x2c')],[db[_0x1140('0x18')]['fn'](_0x1140('0x19'),db[_0x1140('0x18')]['fn']('IF',db[_0x1140('0x18')][_0x1140('0x20')]('`state`\x20=\x203,\x201,\x20null'))),_0x1140('0x2d')],[db[_0x1140('0x18')]['fn'](_0x1140('0x19'),db['sequelize']['fn']('IF',db[_0x1140('0x18')][_0x1140('0x20')](_0x1140('0x1b')))),_0x1140('0x2e')],[db[_0x1140('0x18')]['fn'](_0x1140('0x19'),db['sequelize']['fn']('IF',db[_0x1140('0x18')]['literal'](_0x1140('0x2f')))),_0x1140('0x30')],[db[_0x1140('0x18')]['fn']('COUNT',db[_0x1140('0x18')]['fn']('IF',db[_0x1140('0x18')][_0x1140('0x20')](_0x1140('0x31')))),_0x1140('0x32')],[db[_0x1140('0x18')]['fn'](_0x1140('0x19'),db['sequelize']['fn']('IF',db[_0x1140('0x18')][_0x1140('0x20')](_0x1140('0x33')))),_0x1140('0x34')],[db[_0x1140('0x18')]['fn'](_0x1140('0x19'),db[_0x1140('0x18')]['fn']('IF',db[_0x1140('0x18')][_0x1140('0x20')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x1140('0x35')],[db['sequelize']['fn'](_0x1140('0x19'),db[_0x1140('0x18')]['fn']('IF',db[_0x1140('0x18')]['literal'](_0x1140('0x36')))),_0x1140('0x37')],[db[_0x1140('0x18')]['fn'](_0x1140('0x19'),db[_0x1140('0x18')]['fn']('IF',db['sequelize'][_0x1140('0x20')](_0x1140('0x38')))),_0x1140('0x39')],[db[_0x1140('0x18')]['fn'](_0x1140('0x19'),db[_0x1140('0x18')]['fn']('IF',db[_0x1140('0x18')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),_0x1140('0x3a')],[db['sequelize']['fn'](_0x1140('0x19'),db[_0x1140('0x18')]['fn']('IF',db[_0x1140('0x18')][_0x1140('0x20')](_0x1140('0x3b')))),'outboundRejectCallsDay'],[db[_0x1140('0x18')]['fn'](_0x1140('0x19'),db[_0x1140('0x18')]['fn']('IF',db[_0x1140('0x18')][_0x1140('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0x1140('0x19'),db[_0x1140('0x18')]['fn']('IF',db[_0x1140('0x18')][_0x1140('0x20')](_0x1140('0x3c')))),_0x1140('0x3d')],[db[_0x1140('0x18')]['fn'](_0x1140('0x19'),db['sequelize']['fn']('IF',db[_0x1140('0x18')][_0x1140('0x20')](_0x1140('0x3e')))),_0x1140('0x3f')]],'group':[_0x1140('0x29')]})['then'](function(_0x42cc96){logger[_0x1140('0xa')](_0x1140('0x27'),_0x18f598);logger[_0x1140('0x16')]('GetVoiceQueueHopperHistory',_0x18f598,JSON[_0x1140('0xe')](_0x42cc96));_0x316467(_0x42cc96);})[_0x1140('0x26')](function(_0x413fc5){logger['error'](_0x1140('0x27'),_0x413fc5[_0x1140('0x11')],_0x18f598);_0x47f815(_0x3099f6[_0x1140('0xf')](0x1f4,_0x413fc5['message']));});});};exports[_0x1140('0x40')]=function(_0x472c7b){var _0x3b543e=this;return new Promise(function(_0x37d01b,_0x38fb1c){return db[_0x1140('0x13')][_0x1140('0x28')]({'raw':_0x472c7b[_0x1140('0x14')]?_0x472c7b[_0x1140('0x14')][_0x1140('0x15')]===undefined?!![]:![]:!![],'where':_0x472c7b[_0x1140('0x14')]?_0x472c7b[_0x1140('0x14')][_0x1140('0x17')]||null:null,'attributes':[[_0x1140('0x29'),_0x1140('0x2a')],[db[_0x1140('0x18')]['fn'](_0x1140('0x19'),db[_0x1140('0x18')]['col']('id')),_0x1140('0x41')],[db[_0x1140('0x18')]['fn'](_0x1140('0x19'),db[_0x1140('0x18')]['fn']('IF',db[_0x1140('0x18')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x1140('0x42')]],'group':[_0x1140('0x29')]})[_0x1140('0x9')](function(_0x1f836b){logger[_0x1140('0xa')](_0x1140('0x40'),_0x472c7b);logger['debug']('GetCampaignHopperHistory',_0x472c7b,JSON['stringify'](_0x1f836b));_0x37d01b(_0x1f836b);})[_0x1140('0x26')](function(_0x2e559f){logger[_0x1140('0xf')](_0x1140('0x40'),_0x2e559f[_0x1140('0x11')],_0x472c7b);_0x38fb1c(_0x3b543e[_0x1140('0xf')](0x1f4,_0x2e559f[_0x1140('0x11')]));});});}; \ No newline at end of file +var _0xc1e8=['ivrAnswerCallsDay','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','info','CmHopperHistory,\x20%s,\x20%s','catch','CreateCmHopperHistory','CmHopperHistory','create','body','AvgHandleTime','options','raw','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','literal','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','stringify','GetCampaignHopperHistory','ivrTotalCallsDays'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xc1e8,0x83));var _0x8c1e=function(_0x29d87d,_0x23dc31){_0x29d87d=_0x29d87d-0x0;var _0x1fd84b=_0xc1e8[_0x29d87d];return _0x1fd84b;};'use strict';var _=require(_0x8c1e('0x0'));var util=require(_0x8c1e('0x1'));var moment=require(_0x8c1e('0x2'));var BPromise=require('bluebird');var rs=require(_0x8c1e('0x3'));var fs=require('fs');var Redis=require(_0x8c1e('0x4'));var db=require(_0x8c1e('0x5'))['db'];var utils=require(_0x8c1e('0x6'));var logger=require('../../config/logger')(_0x8c1e('0x7'));var config=require(_0x8c1e('0x8'));var jayson=require(_0x8c1e('0x9'));var client=jayson['client'][_0x8c1e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x127480,_0x5a713e,_0x1dcfa4){return new BPromise(function(_0x4ddb8b,_0xecea62){return client['request'](_0x127480,_0x1dcfa4)[_0x8c1e('0xb')](function(_0x2ffaf1){logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x5a713e,_0x8c1e('0xc'));logger[_0x8c1e('0xd')](_0x8c1e('0xe'),_0x5a713e,_0x8c1e('0xc'),JSON['stringify'](_0x2ffaf1));if(_0x2ffaf1[_0x8c1e('0xf')]){if(_0x2ffaf1[_0x8c1e('0xf')][_0x8c1e('0x10')]===0x1f4){logger[_0x8c1e('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x5a713e,_0x2ffaf1[_0x8c1e('0xf')][_0x8c1e('0x11')]);return _0xecea62(_0x2ffaf1[_0x8c1e('0xf')]['message']);}logger[_0x8c1e('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x5a713e,_0x2ffaf1[_0x8c1e('0xf')][_0x8c1e('0x11')]);return _0x4ddb8b(_0x2ffaf1[_0x8c1e('0xf')][_0x8c1e('0x11')]);}else{logger[_0x8c1e('0x12')](_0x8c1e('0x13'),_0x5a713e,_0x8c1e('0xc'));_0x4ddb8b(_0x2ffaf1['result'][_0x8c1e('0x11')]);}})[_0x8c1e('0x14')](function(_0x3dd07c){logger[_0x8c1e('0xf')](_0x8c1e('0x13'),_0x5a713e,_0x3dd07c);_0xecea62(_0x3dd07c);});});}exports[_0x8c1e('0x15')]=function(_0x1e8f6d){var _0x37c4e5=this;return new Promise(function(_0x32ce09,_0x4b761a){return db[_0x8c1e('0x16')][_0x8c1e('0x17')](_0x1e8f6d[_0x8c1e('0x18')],{'raw':_0x1e8f6d['options']?_0x1e8f6d['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x10f80f){logger['info'](_0x8c1e('0x15'),_0x1e8f6d);logger[_0x8c1e('0xd')]('CreateCmHopperHistory',_0x1e8f6d,JSON['stringify'](_0x10f80f));_0x32ce09(_0x10f80f);})['catch'](function(_0x2f5ea9){logger[_0x8c1e('0xf')](_0x8c1e('0x15'),_0x2f5ea9[_0x8c1e('0x11')],_0x1e8f6d);_0x4b761a(_0x37c4e5[_0x8c1e('0xf')](0x1f4,_0x2f5ea9['message']));});});};exports[_0x8c1e('0x19')]=function(_0x528d6a){var _0x33f108=this;return new Promise(function(_0x3196de,_0x459672){return db[_0x8c1e('0x16')]['findAll']({'raw':_0x528d6a[_0x8c1e('0x1a')]?_0x528d6a[_0x8c1e('0x1a')][_0x8c1e('0x1b')]===undefined?!![]:![]:!![],'where':_0x528d6a['options']?_0x528d6a[_0x8c1e('0x1a')]['where']||null:null,'attributes':[[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')][_0x8c1e('0x1e')]('id')),_0x8c1e('0x1f')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db['sequelize']['literal'](_0x8c1e('0x20')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')]('`state`\x20=\x2010,\x201,\x20null'))),_0x8c1e('0x22')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')](_0x8c1e('0x23')))),_0x8c1e('0x24')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x25'),db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x25'),db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')](_0x8c1e('0x26')))),_0x8c1e('0x27')]]})[_0x8c1e('0xb')](function(_0x44d095){logger['info'](_0x8c1e('0x19'),_0x528d6a);logger['debug'](_0x8c1e('0x19'),_0x528d6a,JSON['stringify'](_0x44d095));_0x3196de(_0x44d095);})[_0x8c1e('0x14')](function(_0x4c443d){logger['error'](_0x8c1e('0x19'),_0x4c443d['message'],_0x528d6a);_0x459672(_0x33f108['error'](0x1f4,_0x4c443d[_0x8c1e('0x11')]));});});};exports[_0x8c1e('0x28')]=function(_0x36000d){var _0x45fc92=this;return new Promise(function(_0x3190f7,_0x5bc3fb){return db[_0x8c1e('0x16')][_0x8c1e('0x29')]({'raw':_0x36000d[_0x8c1e('0x1a')]?_0x36000d[_0x8c1e('0x1a')][_0x8c1e('0x1b')]===undefined?!![]:![]:!![],'where':_0x36000d[_0x8c1e('0x1a')]?_0x36000d[_0x8c1e('0x1a')][_0x8c1e('0x2a')]||null:null,'attributes':[[_0x8c1e('0x2b'),_0x8c1e('0x2c')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db['sequelize']['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')](_0x8c1e('0x2d')))),_0x8c1e('0x2e')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')]('`state`\x20=\x203,\x201,\x20null'))),_0x8c1e('0x2f')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db['sequelize']['fn']('IF',db[_0x8c1e('0x1c')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')]('`state`\x20=\x205,\x201,\x20null'))),_0x8c1e('0x30')],[db[_0x8c1e('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')](_0x8c1e('0x31')))),_0x8c1e('0x32')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')](_0x8c1e('0x33')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')](_0x8c1e('0x34')))),_0x8c1e('0x35')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')]('`state`\x20=\x2012,\x201,\x20null'))),_0x8c1e('0x36')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2013,\x201,\x20null'))),_0x8c1e('0x37')],[db['sequelize']['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')]('`state`\x20=\x2014,\x201,\x20null'))),_0x8c1e('0x38')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')](_0x8c1e('0x39')))),_0x8c1e('0x3a')],[db[_0x8c1e('0x1c')]['fn']('COUNT',db[_0x8c1e('0x1c')]['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')]('`state`\x20=\x2016,\x201,\x20null'))),_0x8c1e('0x3b')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db['sequelize'][_0x8c1e('0x21')]('`state`\x20=\x2020,\x201,\x20null'))),_0x8c1e('0x3a')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')]['fn']('IF',db['sequelize']['literal'](_0x8c1e('0x3c')))),'outboundReCallsDay']],'group':['campaign']})['then'](function(_0x54b6a5){logger['info'](_0x8c1e('0x28'),_0x36000d);logger[_0x8c1e('0xd')]('GetVoiceQueueHopperHistory',_0x36000d,JSON[_0x8c1e('0x3d')](_0x54b6a5));_0x3190f7(_0x54b6a5);})[_0x8c1e('0x14')](function(_0xfed240){logger[_0x8c1e('0xf')](_0x8c1e('0x28'),_0xfed240[_0x8c1e('0x11')],_0x36000d);_0x5bc3fb(_0x45fc92[_0x8c1e('0xf')](0x1f4,_0xfed240[_0x8c1e('0x11')]));});});};exports[_0x8c1e('0x3e')]=function(_0x4001e9){var _0x13cf7a=this;return new Promise(function(_0x5c8d15,_0x479f09){return db[_0x8c1e('0x16')][_0x8c1e('0x29')]({'raw':_0x4001e9[_0x8c1e('0x1a')]?_0x4001e9['options'][_0x8c1e('0x1b')]===undefined?!![]:![]:!![],'where':_0x4001e9['options']?_0x4001e9[_0x8c1e('0x1a')][_0x8c1e('0x2a')]||null:null,'attributes':[[_0x8c1e('0x2b'),_0x8c1e('0x2c')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db[_0x8c1e('0x1c')][_0x8c1e('0x1e')]('id')),_0x8c1e('0x3f')],[db[_0x8c1e('0x1c')]['fn'](_0x8c1e('0x1d'),db['sequelize']['fn']('IF',db[_0x8c1e('0x1c')][_0x8c1e('0x21')](_0x8c1e('0x20')))),_0x8c1e('0x40')]],'group':[_0x8c1e('0x2b')]})[_0x8c1e('0xb')](function(_0x5cae1a){logger[_0x8c1e('0x12')](_0x8c1e('0x3e'),_0x4001e9);logger['debug'](_0x8c1e('0x3e'),_0x4001e9,JSON[_0x8c1e('0x3d')](_0x5cae1a));_0x5c8d15(_0x5cae1a);})['catch'](function(_0xee8957){logger[_0x8c1e('0xf')](_0x8c1e('0x3e'),_0xee8957[_0x8c1e('0x11')],_0x4001e9);_0x479f09(_0x13cf7a[_0x8c1e('0xf')](0x1f4,_0xee8957['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 84b8067..2f807bc 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 _0x0df5=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','create','put','exports'];(function(_0x4518bd,_0x105b86){var _0x3daed3=function(_0xb639ea){while(--_0xb639ea){_0x4518bd['push'](_0x4518bd['shift']());}};_0x3daed3(++_0x105b86);}(_0x0df5,0xaa));var _0x50df=function(_0x3f98fc,_0x3fb7bd){_0x3f98fc=_0x3f98fc-0x0;var _0x33aaa0=_0x0df5[_0x3f98fc];return _0x33aaa0;};'use strict';var multer=require(_0x50df('0x0'));var util=require(_0x50df('0x1'));var path=require('path');var timeout=require(_0x50df('0x2'));var express=require(_0x50df('0x3'));var router=express[_0x50df('0x4')]();var auth=require(_0x50df('0x5'));var interaction=require(_0x50df('0x6'));var config=require(_0x50df('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x50df('0x8')]('/',auth[_0x50df('0x9')](),controller[_0x50df('0xa')]);router['get']('/describe',auth[_0x50df('0x9')](),controller[_0x50df('0xb')]);router[_0x50df('0x8')](_0x50df('0xc'),auth['isAuthenticated'](),controller[_0x50df('0xd')]);router['post']('/',auth[_0x50df('0x9')](),controller[_0x50df('0xe')]);router[_0x50df('0xf')](_0x50df('0xc'),auth['isAuthenticated'](),controller['update']);module[_0x50df('0x10')]=router; \ No newline at end of file +var _0x0182=['create','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','isAuthenticated','get','/describe','describe','/:id'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0182,0x18a));var _0x2018=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0x0182[_0x382a62];return _0x490a25;};'use strict';var multer=require(_0x2018('0x0'));var util=require(_0x2018('0x1'));var path=require(_0x2018('0x2'));var timeout=require(_0x2018('0x3'));var express=require(_0x2018('0x4'));var router=express[_0x2018('0x5')]();var auth=require(_0x2018('0x6'));var interaction=require(_0x2018('0x7'));var config=require('../../config/environment');var controller=require(_0x2018('0x8'));router['get']('/',auth[_0x2018('0x9')](),controller['index']);router[_0x2018('0xa')](_0x2018('0xb'),auth[_0x2018('0x9')](),controller[_0x2018('0xc')]);router[_0x2018('0xa')](_0x2018('0xd'),auth[_0x2018('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x2018('0xe')]);router[_0x2018('0xf')](_0x2018('0xd'),auth['isAuthenticated'](),controller[_0x2018('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 5ba1473..a4cf56b 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 _0x1477=['name','sequelize','exports','STRING'];(function(_0x3eab98,_0x33ba45){var _0x3bd6d2=function(_0x2047c2){while(--_0x2047c2){_0x3eab98['push'](_0x3eab98['shift']());}};_0x3bd6d2(++_0x33ba45);}(_0x1477,0x175));var _0x7147=function(_0x21e511,_0x3d2f8b){_0x21e511=_0x21e511-0x0;var _0x2eba6d=_0x1477[_0x21e511];return _0x2eba6d;};'use strict';var Sequelize=require(_0x7147('0x0'));module[_0x7147('0x1')]={'name':{'type':Sequelize[_0x7147('0x2')],'unique':_0x7147('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7147('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xed29=['STRING','sequelize'];(function(_0x954b3a,_0x10a7c1){var _0x3a313e=function(_0x1070ad){while(--_0x1070ad){_0x954b3a['push'](_0x954b3a['shift']());}};_0x3a313e(++_0x10a7c1);}(_0xed29,0x1a3));var _0x9ed2=function(_0xc8a598,_0x8ffd7c){_0xc8a598=_0xc8a598-0x0;var _0x2a6225=_0xed29[_0xc8a598];return _0x2a6225;};'use strict';var Sequelize=require(_0x9ed2('0x0'));module['exports']={'name':{'type':Sequelize[_0x9ed2('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9ed2('0x1')]},'dialPrefix':{'type':Sequelize[_0x9ed2('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index a54bf98..b483564 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 _0xa9e0=['number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','getCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addDisposition','Disposition','getDispositions','findOne','ListId','ids','CmContact','describe','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','hasOwnProperty','raw','getContactsCsv','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT'];(function(_0x134353,_0x599b37){var _0x3ef328=function(_0x2c6e8b){while(--_0x2c6e8b){_0x134353['push'](_0x134353['shift']());}};_0x3ef328(++_0x599b37);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x16b1ca=_0x4d00e6['get']({'plain':!![]});var _0x59181e=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0x59181e,'resourceId':_0x16b1ca['id']}})[_0x0a9e('0x22')](function(){return _0x4d00e6;});})['then'](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a1e7,_0x5bfb33){return function(_0x1dc186){if(!_0x1dc186){_0x45a1e7[_0x0a9e('0x25')](0x194);}return _0x1dc186;};}function handleError(_0x25fba9,_0x14433c){_0x14433c=_0x14433c||0x1f4;return function(_0x140511){logger[_0x0a9e('0x26')](_0x140511[_0x0a9e('0x27')]);if(_0x140511[_0x0a9e('0x28')]){delete _0x140511['name'];}_0x25fba9[_0x0a9e('0x1a')](_0x14433c)[_0x0a9e('0x29')](_0x140511);};}exports[_0x0a9e('0x2a')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x2e')],'type':_0x2e8759['type'][_0x0a9e('0x2f')]};});_0x40e7a3['model']=_[_0x0a9e('0x2b')](_0x824a4f,_0x0a9e('0x28'));_0x40e7a3[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2ec755[_0x0a9e('0x30')]);_0x40e7a3['filters']=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],_0x40e7a3[_0x0a9e('0x30')]);_0x15b200[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x2ec755[_0x0a9e('0x30')]['fields']));_0x15b200[_0x0a9e('0x34')]=_0x15b200['attributes'][_0x0a9e('0x36')]?_0x15b200[_0x0a9e('0x34')]:_0x40e7a3[_0x0a9e('0x33')];if(!_0x2ec755[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x15b200[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x30')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1c')](_0x2ec755['query'][_0x0a9e('0x1c')]);}_0x15b200[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x2ec755[_0x0a9e('0x30')]['sort']);_0x15b200[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x3b')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x3e')]!==_0x0a9e('0x3f')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x28')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x40')]({},_0x15b200,_0x2ec755[_0x0a9e('0x41')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x3a')]};return db[_0x0a9e('0x2c')][_0x0a9e('0x1b')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1b')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x15b200[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')][_0x0a9e('0x44')](_0x15b200);})[_0x0a9e('0x22')](function(_0x23b089){_0x1843b2[_0x0a9e('0x45')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x46')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x47')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':![],'where':{'id':_0x11ca30[_0x0a9e('0x48')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')]);_0x52628e[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x11ca30[_0x0a9e('0x30')]);_0x52628e[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],_0x52628e[_0x0a9e('0x30')]);_0x4d04c8['attributes']=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x11ca30[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x4d04c8[_0x0a9e('0x34')]=_0x4d04c8[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x33')];if(_0x11ca30['query'][_0x0a9e('0x42')]){_0x4d04c8[_0x0a9e('0x43')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x40')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x2c')][_0x0a9e('0x49')](_0x4d04c8)[_0x0a9e('0x22')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x22')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x46')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x4a')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x2c')][_0x0a9e('0x4a')](_0x45bf7f[_0x0a9e('0x4b')],{})[_0x0a9e('0x22')](function(_0x409789){var _0x992c77=_0x45bf7f[_0x0a9e('0x4c')][_0x0a9e('0x4d')]({'plain':!![]});if(!_0x992c77)throw new Error(_0x0a9e('0x4e'));if(_0x992c77['role']===_0x0a9e('0x4c')){var _0x3fe430=_0x409789['get']({'plain':!![]});var _0x4ae14b='Lists';return db[_0x0a9e('0x4f')][_0x0a9e('0x49')]({'where':{'name':_0x4ae14b,'userProfileId':_0x992c77[_0x0a9e('0x50')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x61bb17){if(_0x61bb17&&_0x61bb17[_0x0a9e('0x51')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x4a')]({'name':_0x3fe430['name'],'resourceId':_0x3fe430['id'],'type':_0x61bb17['name'],'sectionId':_0x61bb17['id']},{})['then'](function(){return _0x409789;});}else{return _0x409789;}})[_0x0a9e('0x46')](function(_0x204173){logger[_0x0a9e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204173);throw _0x204173;});}return _0x409789;})[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x46')](handleError(_0x5bbcde,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x5a88da[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x4b')],null))[_0x0a9e('0x22')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x46')](handleError(_0x3aedd0,null));};exports['describe']=function(_0x5da27d,_0x5df0ad){return db[_0x0a9e('0x2c')]['describe']()[_0x0a9e('0x22')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x46')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x52')]=function(_0x19b4df,_0x232830,_0x272738){if(_0x19b4df[_0x0a9e('0x4b')]['id']){delete _0x19b4df[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x19b4df[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x232830,null))[_0x0a9e('0x22')](function(_0xb83dfd){if(_0xb83dfd){_0x19b4df[_0x0a9e('0x4b')]['ListId']=_0xb83dfd['id'];return db[_0x0a9e('0x53')][_0x0a9e('0x4a')](_0x19b4df['body']);}})[_0x0a9e('0x22')](respondWithResult(_0x232830,null))['catch'](handleError(_0x232830,null));};exports[_0x0a9e('0x54')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'raw':![],'where':{}};var _0x49d231={};var _0x2244d6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x22')](function(_0x49eed0){if(_0x49eed0){_0x49d231[_0x0a9e('0x33')]=_['keys'](db[_0x0a9e('0x53')][_0x0a9e('0x2d')]);_0x49d231[_0x0a9e('0x30')]=_['keys'](_0x5ba1f9[_0x0a9e('0x30')]);_0x49d231[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x49d231[_0x0a9e('0x33')],_0x49d231['query']);_0x273cb5[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x49d231['model'],qs[_0x0a9e('0x35')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x273cb5[_0x0a9e('0x34')]=_0x273cb5[_0x0a9e('0x34')]['length']?_0x273cb5[_0x0a9e('0x34')]:_0x49d231[_0x0a9e('0x33')];if(!_0x5ba1f9[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x273cb5['limit']=qs['limit'](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x273cb5[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x273cb5[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x273cb5[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x5ba1f9[_0x0a9e('0x30')],_0x49d231[_0x0a9e('0x3b')]));_0x273cb5[_0x0a9e('0x3a')][_0x0a9e('0x56')]=_0x49eed0['id'];if(_0x5ba1f9[_0x0a9e('0x30')]['filter']){_0x273cb5[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x273cb5[_0x0a9e('0x3a')],{'$or':_['map'](_0x273cb5[_0x0a9e('0x34')],function(_0x30944e){var _0x4b341d={};_0x4b341d[_0x30944e]={'$like':'%'+_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x4b341d;})});}_0x273cb5=_[_0x0a9e('0x40')]({},_0x273cb5,_0x5ba1f9[_0x0a9e('0x41')]);return db[_0x0a9e('0x53')]['count']({'where':_0x273cb5['where']})['then'](function(_0x40fb85){_0x2244d6[_0x0a9e('0x1b')]=_0x40fb85;if(_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x273cb5[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x53')][_0x0a9e('0x44')](_0x273cb5);})[_0x0a9e('0x22')](function(_0x5512d1){_0x2244d6[_0x0a9e('0x45')]=_0x5512d1;return _0x2244d6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4b3c1a,_0x273cb5))[_0x0a9e('0x46')](handleError(_0x4b3c1a,null));};exports['removeDispositions']=function(_0x2bdc44,_0x583b2e,_0x4437ff){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x2bdc44[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x583b2e,null))[_0x0a9e('0x22')](function(_0x317c0c){if(_0x317c0c){return _0x317c0c['removeDispositions'](_0x2bdc44[_0x0a9e('0x30')][_0x0a9e('0x57')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x583b2e,null))[_0x0a9e('0x46')](handleError(_0x583b2e,null));};exports['addContacts']=function(_0x109ccb,_0x3d91db,_0x2d5506){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x109ccb[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3d91db,null))[_0x0a9e('0x22')](function(_0xf410e5){if(_0xf410e5){var _0x332367=[];var _0xdb98ca={'success':[],'errors':[]};return db[_0x0a9e('0x58')][_0x0a9e('0x59')]()[_0x0a9e('0x22')](function(_0x336dc3){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]&&_[_0x0a9e('0x5b')](_0x109ccb[_0x0a9e('0x4b')]['tags'])){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x36')]){_0x109ccb['body'][_0x0a9e('0x5a')]=_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x5c')](';')+';';}else{_0x109ccb['body']['tags']=null;}}else{_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]=null;}if(_0x109ccb['body']&&_[_0x0a9e('0x5b')](_0x109ccb['body'])){for(var _0x260f4b=0x0;_0x260f4b<_0x109ccb[_0x0a9e('0x4b')]['length'];_0x260f4b+=0x1){_0x109ccb[_0x0a9e('0x4b')][_0x260f4b][_0x0a9e('0x56')]=_0x109ccb[_0x0a9e('0x48')]['id'];_0x332367[_0x0a9e('0x5d')](_0x109ccb[_0x0a9e('0x4b')][_0x260f4b]);}return BPromise[_0x0a9e('0x5e')](_0x332367,function(_0x444f1f){return db['CmContact'][_0x0a9e('0x4a')](_[_0x0a9e('0x5f')](_0x444f1f,[_0x0a9e('0x57'),'id'])||{},{'fields':_[_0x0a9e('0x31')](_0x336dc3),'raw':!![]})['then'](function(_0xf51744){_0xdb98ca[_0x0a9e('0x60')]['push'](_0xf51744[_0x0a9e('0x61')]);})['catch'](function(_0x163710){_0xdb98ca[_0x0a9e('0x62')][_0x0a9e('0x5d')]({'data':_0x444f1f,'error':_0x163710[_0x0a9e('0x63')]});});})['then'](function(_0x51ccd7){return _0xdb98ca;})[_0x0a9e('0x46')](function(_0x2b9c01){return _0x2b9c01;});}else{_0x3d91db[_0x0a9e('0x1a')](0x190)['json']({'message':_0x0a9e('0x64')});}});}})[_0x0a9e('0x22')](respondWithResult(_0x3d91db,null))['catch'](handleError(_0x3d91db,null));};exports['getContacts']=function(_0xf0a802,_0x56acca,_0x5ea541){var _0x4dc6b3;return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0xf0a802[_0x0a9e('0x48')]['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x56acca,null))['then'](function(_0x5fd5db){if(_0x5fd5db){_0x4dc6b3=_0x5fd5db;return db['CmContact'][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x18ad56){if(_0x18ad56){var _0x4566b0={};var _0x50f8d7={};_0x50f8d7[_0x0a9e('0x33')]=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x18ad56),_['map'](_0x4dc6b3[_0x0a9e('0x66')],function(_0x21e592){return util[_0x0a9e('0x68')](_0x0a9e('0x69'),_0x21e592['id']);}));_0x50f8d7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0xf0a802[_0x0a9e('0x30')]);_0x50f8d7[_0x0a9e('0x3b')]=_['intersection'](_0x50f8d7[_0x0a9e('0x33')],_0x50f8d7[_0x0a9e('0x30')]);_0x4566b0['attributes']=_[_0x0a9e('0x32')](_0x50f8d7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0xf0a802['query'][_0x0a9e('0x35')]));_0x4566b0['attributes']=_0x4566b0[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4566b0[_0x0a9e('0x34')]:_0x50f8d7[_0x0a9e('0x33')];if(!_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x4566b0[_0x0a9e('0x1d')]=qs['limit'](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x4566b0[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x4566b0[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x4566b0[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0xf0a802['query'],_0x50f8d7[_0x0a9e('0x3b')]));_0x4566b0[_0x0a9e('0x6b')]=!![];if(_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x4566b0[_0x0a9e('0x3a')]=_['merge'](_0x4566b0[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x4566b0['attributes'],function(_0x23b447){var _0x5e725e={};_0x5e725e[_0x23b447]={'$like':'%'+_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x5e725e;})});}_0x4566b0=_[_0x0a9e('0x40')]({},_0x4566b0,_0xf0a802[_0x0a9e('0x41')]);return _0x4dc6b3['getContacts'](_0x4566b0);}})[_0x0a9e('0x22')](respondWithResult(_0x56acca,null))['catch'](handleError(_0x56acca,null));};exports[_0x0a9e('0x6c')]=function(_0x3d0a77,_0x5e5b89,_0x231c6a){var _0x63c9f7;return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x3d0a77['params']['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x5e5b89,null))[_0x0a9e('0x22')](function(_0x3f2f40){if(_0x3f2f40){_0x63c9f7=_0x3f2f40;return db[_0x0a9e('0x58')][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x3f8124){if(_0x3f8124){var _0x586510={};var _0x3156c7={};_0x3156c7['model']=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x3f8124),_[_0x0a9e('0x2b')](_0x63c9f7[_0x0a9e('0x66')],function(_0x1b61d5){return util['format'](_0x0a9e('0x69'),_0x1b61d5['id']);}));_0x3156c7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x3d0a77[_0x0a9e('0x30')]);_0x3156c7[_0x0a9e('0x3b')]=_['intersection'](_0x3156c7['model'],_0x3156c7[_0x0a9e('0x30')]);_0x586510['attributes']=_[_0x0a9e('0x32')](_0x3156c7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x586510[_0x0a9e('0x34')]=_0x586510['attributes']['length']?_0x586510[_0x0a9e('0x34')]:_0x3156c7['model'];if(!_0x3d0a77[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x586510['limit']=qs['limit'](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x586510['offset']=qs[_0x0a9e('0x1c')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x586510[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x3d0a77['query']['sort']);_0x586510[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x3d0a77[_0x0a9e('0x30')],_0x3156c7[_0x0a9e('0x3b')]));_0x586510['raw']=!![];if(_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x586510['where']=_[_0x0a9e('0x40')](_0x586510[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x586510[_0x0a9e('0x34')],function(_0x23b25b){var _0x23b39e={};_0x23b39e[_0x23b25b]={'$like':'%'+_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x23b39e;})});}_0x586510=_[_0x0a9e('0x40')]({},_0x586510,_0x3d0a77[_0x0a9e('0x41')]);return _0x63c9f7['getContacts'](_0x586510);}})[_0x0a9e('0x22')](function(_0x301047){if(!_[_0x0a9e('0x6d')](_0x301047)){var _0x1c4232=toCsv(_0x301047);var _0x1d0b02=Date['now']();fs['writeFileSync'](util[_0x0a9e('0x68')](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02),_0x1c4232);_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x70'),_0x0a9e('0x71')+util['format'](_0x0a9e('0x72'),_0x63c9f7['id'],_0x1d0b02));_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x73'),'text/csv');return _0x5e5b89[_0x0a9e('0x74')](util['format'](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02));}else{return _0x5e5b89['sendStatus'](0xcc);}})[_0x0a9e('0x46')](handleError(_0x5e5b89,null));};exports[_0x0a9e('0x75')]=function(_0xe339b1,_0x5c500c,_0xc9529d){var _0x5ed560;delete _0xe339b1[_0x0a9e('0x4b')]['id'];return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0xe339b1[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5c500c,null))[_0x0a9e('0x22')](function(_0x4014c7){if(_0x4014c7){return db[_0x0a9e('0x76')][_0x0a9e('0x77')](function(_0x27d1f5){return db[_0x0a9e('0x65')][_0x0a9e('0x4a')](_0xe339b1[_0x0a9e('0x4b')],{'transaction':_0x27d1f5})[_0x0a9e('0x22')](function(_0x98c62c){_0x5ed560=_0x98c62c;return _0x4014c7[_0x0a9e('0x78')](_0x98c62c,{'transaction':_0x27d1f5});})['then'](function(){var _0x556443={'type':db[_0x0a9e('0x79')]['TEXT'],'transaction':_0x27d1f5};switch(_0xe339b1[_0x0a9e('0x4b')][_0x0a9e('0x3e')]){case'text':_0x556443[_0x0a9e('0x3e')]=db[_0x0a9e('0x79')][_0x0a9e('0x7a')];break;case _0x0a9e('0x7b'):_0x556443['type']=db[_0x0a9e('0x79')][_0x0a9e('0x7c')];break;case _0x0a9e('0x7d'):_0x556443[_0x0a9e('0x3e')]=db['Sequelize'][_0x0a9e('0x7e')];_0x556443[_0x0a9e('0x7f')]=![];break;default:}return db[_0x0a9e('0x76')]['queryInterface'][_0x0a9e('0x80')](_0x0a9e('0x81'),util[_0x0a9e('0x68')]('cf_%s',_0x5ed560['id']),_0x556443);})[_0x0a9e('0x22')](function(){return _0x5ed560;});});}})[_0x0a9e('0x22')](respondWithResult(_0x5c500c,null))[_0x0a9e('0x46')](handleError(_0x5c500c,null));};exports[_0x0a9e('0x82')]=function(_0x2394d3,_0x555780,_0x3211d2){var _0x289e65={};var _0x4795ae={};var _0x3bab3e;var _0x1fcfe6;return db[_0x0a9e('0x2c')]['findOne']({'where':{'id':_0x2394d3['params']['id']}})['then'](handleEntityNotFound(_0x555780,null))[_0x0a9e('0x22')](function(_0x4a70ce){if(_0x4a70ce){_0x3bab3e=_0x4a70ce;_0x4795ae['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x65')][_0x0a9e('0x2d')]);_0x4795ae['query']=_[_0x0a9e('0x31')](_0x2394d3[_0x0a9e('0x30')]);_0x4795ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],_0x4795ae[_0x0a9e('0x30')]);_0x289e65[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],qs['fields'](_0x2394d3[_0x0a9e('0x30')]['fields']));_0x289e65[_0x0a9e('0x34')]=_0x289e65[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x289e65[_0x0a9e('0x34')]:_0x4795ae[_0x0a9e('0x33')];_0x289e65[_0x0a9e('0x38')]=qs['sort'](_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x289e65[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x2394d3[_0x0a9e('0x30')],_0x4795ae[_0x0a9e('0x3b')]));_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':[{'ListId':_0x4a70ce['id']},{'ListId':null}]});if(_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':_['map'](_0x289e65[_0x0a9e('0x34')],function(_0x88b25f){var _0x2ff265={};_0x2ff265[_0x88b25f]={'$like':'%'+_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x2ff265;})});}_0x289e65=_[_0x0a9e('0x40')]({},_0x289e65,_0x2394d3[_0x0a9e('0x41')]);return db[_0x0a9e('0x65')]['findAndCountAll'](_0x289e65);}})[_0x0a9e('0x22')](respondWithResult(_0x555780,null))[_0x0a9e('0x46')](handleError(_0x555780,null));};exports[_0x0a9e('0x83')]=function(_0x5c65fc,_0x1402c7,_0x41e446){return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0x5c65fc[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1402c7,null))[_0x0a9e('0x22')](function(_0x336a19){if(_0x336a19){return _0x336a19[_0x0a9e('0x83')](_0x5c65fc[_0x0a9e('0x4b')]['ids'],_[_0x0a9e('0x5f')](_0x5c65fc[_0x0a9e('0x4b')],[_0x0a9e('0x57'),'id'])||{})[_0x0a9e('0x84')](function(_0x2b624e){for(var _0x3942fd=0x0;_0x3942fd<_0x5c65fc['body'][_0x0a9e('0x57')]['length'];_0x3942fd+=0x1){socket['emit']('userCmList:save',{'UserId':_0x5c65fc[_0x0a9e('0x4b')][_0x0a9e('0x57')][_0x3942fd],'CmListId':_0x5c65fc[_0x0a9e('0x48')]['id']});}return _0x2b624e;});}})[_0x0a9e('0x22')](respondWithResult(_0x1402c7,null))['catch'](handleError(_0x1402c7,null));};exports[_0x0a9e('0x85')]=function(_0x309fa9,_0x3ddbc7,_0x1fdb10){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x309fa9['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3ddbc7,null))[_0x0a9e('0x22')](function(_0x2a293f){if(_0x2a293f){return _0x2a293f['removeAgents'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])[_0x0a9e('0x22')](function(){if(_['isArray'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])){for(var _0x15ba6b=0x0;_0x15ba6b<_0x309fa9['query'][_0x0a9e('0x57')][_0x0a9e('0x36')];_0x15ba6b+=0x1){socket[_0x0a9e('0x86')]('userCmList:remove',{'UserId':Number(_0x309fa9['query']['ids'][_0x15ba6b]),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}}else{socket[_0x0a9e('0x86')](_0x0a9e('0x87'),{'UserId':Number(_0x309fa9[_0x0a9e('0x30')]['ids']),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ddbc7,null))[_0x0a9e('0x46')](handleError(_0x3ddbc7,null));};exports[_0x0a9e('0x88')]=function(_0x242f23,_0x57f673,_0x33b4b3){var _0x33a26c={};var _0xb8a476={};var _0x580dd6;var _0x40eb5d;return db['CmList'][_0x0a9e('0x55')]({'where':{'id':_0x242f23['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x57f673,null))['then'](function(_0xb14971){if(_0xb14971){_0x580dd6=_0xb14971;_0xb8a476[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x89')][_0x0a9e('0x2d')]);_0xb8a476[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x242f23['query']);_0xb8a476[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0xb8a476['model'],_0xb8a476[_0x0a9e('0x30')]);_0x33a26c[_0x0a9e('0x34')]=_['intersection'](_0xb8a476[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x242f23[_0x0a9e('0x30')]['fields']));_0x33a26c[_0x0a9e('0x34')]=_0x33a26c[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x33a26c[_0x0a9e('0x34')]:_0xb8a476[_0x0a9e('0x33')];_0x33a26c[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x33a26c[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3c')](_0x242f23['query'],_0xb8a476[_0x0a9e('0x3b')]));if(_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x33a26c[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x33a26c[_0x0a9e('0x3a')],{'$or':_['map'](_0x33a26c[_0x0a9e('0x34')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x242f23['query'][_0x0a9e('0x3d')]+'%'};return _0x2977a7;})});}_0x33a26c=_[_0x0a9e('0x40')]({},_0x33a26c,_0x242f23[_0x0a9e('0x41')]);return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1d0a78){if(_0x1d0a78){_0x40eb5d=_0x1d0a78[_0x0a9e('0x36')];if(!_0x242f23['query'][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x33a26c[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x33a26c[_0x0a9e('0x1c')]=qs['offset'](_0x242f23['query'][_0x0a9e('0x1c')]);}return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1bf692){if(_0x1bf692){return _0x1bf692?{'count':_0x40eb5d,'rows':_0x1bf692}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x57f673,null))[_0x0a9e('0x46')](handleError(_0x57f673,null));}; \ No newline at end of file +var _0xa9e0=['number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','getCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addDisposition','Disposition','getDispositions','findOne','ListId','ids','CmContact','describe','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','hasOwnProperty','raw','getContactsCsv','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT'];(function(_0x3173f2,_0x5d4f2f){var _0x488bb6=function(_0x5ae4ae){while(--_0x5ae4ae){_0x3173f2['push'](_0x3173f2['shift']());}};_0x488bb6(++_0x5d4f2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x16b1ca=_0x4d00e6['get']({'plain':!![]});var _0x59181e=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0x59181e,'resourceId':_0x16b1ca['id']}})[_0x0a9e('0x22')](function(){return _0x4d00e6;});})['then'](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a1e7,_0x5bfb33){return function(_0x1dc186){if(!_0x1dc186){_0x45a1e7[_0x0a9e('0x25')](0x194);}return _0x1dc186;};}function handleError(_0x25fba9,_0x14433c){_0x14433c=_0x14433c||0x1f4;return function(_0x140511){logger[_0x0a9e('0x26')](_0x140511[_0x0a9e('0x27')]);if(_0x140511[_0x0a9e('0x28')]){delete _0x140511['name'];}_0x25fba9[_0x0a9e('0x1a')](_0x14433c)[_0x0a9e('0x29')](_0x140511);};}exports[_0x0a9e('0x2a')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x2e')],'type':_0x2e8759['type'][_0x0a9e('0x2f')]};});_0x40e7a3['model']=_[_0x0a9e('0x2b')](_0x824a4f,_0x0a9e('0x28'));_0x40e7a3[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2ec755[_0x0a9e('0x30')]);_0x40e7a3['filters']=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],_0x40e7a3[_0x0a9e('0x30')]);_0x15b200[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x2ec755[_0x0a9e('0x30')]['fields']));_0x15b200[_0x0a9e('0x34')]=_0x15b200['attributes'][_0x0a9e('0x36')]?_0x15b200[_0x0a9e('0x34')]:_0x40e7a3[_0x0a9e('0x33')];if(!_0x2ec755[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x15b200[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x30')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1c')](_0x2ec755['query'][_0x0a9e('0x1c')]);}_0x15b200[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x2ec755[_0x0a9e('0x30')]['sort']);_0x15b200[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x3b')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x3e')]!==_0x0a9e('0x3f')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x28')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x40')]({},_0x15b200,_0x2ec755[_0x0a9e('0x41')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x3a')]};return db[_0x0a9e('0x2c')][_0x0a9e('0x1b')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1b')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x15b200[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')][_0x0a9e('0x44')](_0x15b200);})[_0x0a9e('0x22')](function(_0x23b089){_0x1843b2[_0x0a9e('0x45')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x46')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x47')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':![],'where':{'id':_0x11ca30[_0x0a9e('0x48')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')]);_0x52628e[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x11ca30[_0x0a9e('0x30')]);_0x52628e[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],_0x52628e[_0x0a9e('0x30')]);_0x4d04c8['attributes']=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x11ca30[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x4d04c8[_0x0a9e('0x34')]=_0x4d04c8[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x33')];if(_0x11ca30['query'][_0x0a9e('0x42')]){_0x4d04c8[_0x0a9e('0x43')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x40')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x2c')][_0x0a9e('0x49')](_0x4d04c8)[_0x0a9e('0x22')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x22')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x46')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x4a')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x2c')][_0x0a9e('0x4a')](_0x45bf7f[_0x0a9e('0x4b')],{})[_0x0a9e('0x22')](function(_0x409789){var _0x992c77=_0x45bf7f[_0x0a9e('0x4c')][_0x0a9e('0x4d')]({'plain':!![]});if(!_0x992c77)throw new Error(_0x0a9e('0x4e'));if(_0x992c77['role']===_0x0a9e('0x4c')){var _0x3fe430=_0x409789['get']({'plain':!![]});var _0x4ae14b='Lists';return db[_0x0a9e('0x4f')][_0x0a9e('0x49')]({'where':{'name':_0x4ae14b,'userProfileId':_0x992c77[_0x0a9e('0x50')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x61bb17){if(_0x61bb17&&_0x61bb17[_0x0a9e('0x51')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x4a')]({'name':_0x3fe430['name'],'resourceId':_0x3fe430['id'],'type':_0x61bb17['name'],'sectionId':_0x61bb17['id']},{})['then'](function(){return _0x409789;});}else{return _0x409789;}})[_0x0a9e('0x46')](function(_0x204173){logger[_0x0a9e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204173);throw _0x204173;});}return _0x409789;})[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x46')](handleError(_0x5bbcde,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x5a88da[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x4b')],null))[_0x0a9e('0x22')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x46')](handleError(_0x3aedd0,null));};exports['describe']=function(_0x5da27d,_0x5df0ad){return db[_0x0a9e('0x2c')]['describe']()[_0x0a9e('0x22')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x46')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x52')]=function(_0x19b4df,_0x232830,_0x272738){if(_0x19b4df[_0x0a9e('0x4b')]['id']){delete _0x19b4df[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x19b4df[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x232830,null))[_0x0a9e('0x22')](function(_0xb83dfd){if(_0xb83dfd){_0x19b4df[_0x0a9e('0x4b')]['ListId']=_0xb83dfd['id'];return db[_0x0a9e('0x53')][_0x0a9e('0x4a')](_0x19b4df['body']);}})[_0x0a9e('0x22')](respondWithResult(_0x232830,null))['catch'](handleError(_0x232830,null));};exports[_0x0a9e('0x54')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'raw':![],'where':{}};var _0x49d231={};var _0x2244d6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x22')](function(_0x49eed0){if(_0x49eed0){_0x49d231[_0x0a9e('0x33')]=_['keys'](db[_0x0a9e('0x53')][_0x0a9e('0x2d')]);_0x49d231[_0x0a9e('0x30')]=_['keys'](_0x5ba1f9[_0x0a9e('0x30')]);_0x49d231[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x49d231[_0x0a9e('0x33')],_0x49d231['query']);_0x273cb5[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x49d231['model'],qs[_0x0a9e('0x35')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x273cb5[_0x0a9e('0x34')]=_0x273cb5[_0x0a9e('0x34')]['length']?_0x273cb5[_0x0a9e('0x34')]:_0x49d231[_0x0a9e('0x33')];if(!_0x5ba1f9[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x273cb5['limit']=qs['limit'](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x273cb5[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x273cb5[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x273cb5[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x5ba1f9[_0x0a9e('0x30')],_0x49d231[_0x0a9e('0x3b')]));_0x273cb5[_0x0a9e('0x3a')][_0x0a9e('0x56')]=_0x49eed0['id'];if(_0x5ba1f9[_0x0a9e('0x30')]['filter']){_0x273cb5[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x273cb5[_0x0a9e('0x3a')],{'$or':_['map'](_0x273cb5[_0x0a9e('0x34')],function(_0x30944e){var _0x4b341d={};_0x4b341d[_0x30944e]={'$like':'%'+_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x4b341d;})});}_0x273cb5=_[_0x0a9e('0x40')]({},_0x273cb5,_0x5ba1f9[_0x0a9e('0x41')]);return db[_0x0a9e('0x53')]['count']({'where':_0x273cb5['where']})['then'](function(_0x40fb85){_0x2244d6[_0x0a9e('0x1b')]=_0x40fb85;if(_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x273cb5[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x53')][_0x0a9e('0x44')](_0x273cb5);})[_0x0a9e('0x22')](function(_0x5512d1){_0x2244d6[_0x0a9e('0x45')]=_0x5512d1;return _0x2244d6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4b3c1a,_0x273cb5))[_0x0a9e('0x46')](handleError(_0x4b3c1a,null));};exports['removeDispositions']=function(_0x2bdc44,_0x583b2e,_0x4437ff){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x2bdc44[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x583b2e,null))[_0x0a9e('0x22')](function(_0x317c0c){if(_0x317c0c){return _0x317c0c['removeDispositions'](_0x2bdc44[_0x0a9e('0x30')][_0x0a9e('0x57')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x583b2e,null))[_0x0a9e('0x46')](handleError(_0x583b2e,null));};exports['addContacts']=function(_0x109ccb,_0x3d91db,_0x2d5506){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x109ccb[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3d91db,null))[_0x0a9e('0x22')](function(_0xf410e5){if(_0xf410e5){var _0x332367=[];var _0xdb98ca={'success':[],'errors':[]};return db[_0x0a9e('0x58')][_0x0a9e('0x59')]()[_0x0a9e('0x22')](function(_0x336dc3){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]&&_[_0x0a9e('0x5b')](_0x109ccb[_0x0a9e('0x4b')]['tags'])){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x36')]){_0x109ccb['body'][_0x0a9e('0x5a')]=_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x5c')](';')+';';}else{_0x109ccb['body']['tags']=null;}}else{_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]=null;}if(_0x109ccb['body']&&_[_0x0a9e('0x5b')](_0x109ccb['body'])){for(var _0x260f4b=0x0;_0x260f4b<_0x109ccb[_0x0a9e('0x4b')]['length'];_0x260f4b+=0x1){_0x109ccb[_0x0a9e('0x4b')][_0x260f4b][_0x0a9e('0x56')]=_0x109ccb[_0x0a9e('0x48')]['id'];_0x332367[_0x0a9e('0x5d')](_0x109ccb[_0x0a9e('0x4b')][_0x260f4b]);}return BPromise[_0x0a9e('0x5e')](_0x332367,function(_0x444f1f){return db['CmContact'][_0x0a9e('0x4a')](_[_0x0a9e('0x5f')](_0x444f1f,[_0x0a9e('0x57'),'id'])||{},{'fields':_[_0x0a9e('0x31')](_0x336dc3),'raw':!![]})['then'](function(_0xf51744){_0xdb98ca[_0x0a9e('0x60')]['push'](_0xf51744[_0x0a9e('0x61')]);})['catch'](function(_0x163710){_0xdb98ca[_0x0a9e('0x62')][_0x0a9e('0x5d')]({'data':_0x444f1f,'error':_0x163710[_0x0a9e('0x63')]});});})['then'](function(_0x51ccd7){return _0xdb98ca;})[_0x0a9e('0x46')](function(_0x2b9c01){return _0x2b9c01;});}else{_0x3d91db[_0x0a9e('0x1a')](0x190)['json']({'message':_0x0a9e('0x64')});}});}})[_0x0a9e('0x22')](respondWithResult(_0x3d91db,null))['catch'](handleError(_0x3d91db,null));};exports['getContacts']=function(_0xf0a802,_0x56acca,_0x5ea541){var _0x4dc6b3;return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0xf0a802[_0x0a9e('0x48')]['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x56acca,null))['then'](function(_0x5fd5db){if(_0x5fd5db){_0x4dc6b3=_0x5fd5db;return db['CmContact'][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x18ad56){if(_0x18ad56){var _0x4566b0={};var _0x50f8d7={};_0x50f8d7[_0x0a9e('0x33')]=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x18ad56),_['map'](_0x4dc6b3[_0x0a9e('0x66')],function(_0x21e592){return util[_0x0a9e('0x68')](_0x0a9e('0x69'),_0x21e592['id']);}));_0x50f8d7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0xf0a802[_0x0a9e('0x30')]);_0x50f8d7[_0x0a9e('0x3b')]=_['intersection'](_0x50f8d7[_0x0a9e('0x33')],_0x50f8d7[_0x0a9e('0x30')]);_0x4566b0['attributes']=_[_0x0a9e('0x32')](_0x50f8d7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0xf0a802['query'][_0x0a9e('0x35')]));_0x4566b0['attributes']=_0x4566b0[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4566b0[_0x0a9e('0x34')]:_0x50f8d7[_0x0a9e('0x33')];if(!_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x4566b0[_0x0a9e('0x1d')]=qs['limit'](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x4566b0[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x4566b0[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x4566b0[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0xf0a802['query'],_0x50f8d7[_0x0a9e('0x3b')]));_0x4566b0[_0x0a9e('0x6b')]=!![];if(_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x4566b0[_0x0a9e('0x3a')]=_['merge'](_0x4566b0[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x4566b0['attributes'],function(_0x23b447){var _0x5e725e={};_0x5e725e[_0x23b447]={'$like':'%'+_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x5e725e;})});}_0x4566b0=_[_0x0a9e('0x40')]({},_0x4566b0,_0xf0a802[_0x0a9e('0x41')]);return _0x4dc6b3['getContacts'](_0x4566b0);}})[_0x0a9e('0x22')](respondWithResult(_0x56acca,null))['catch'](handleError(_0x56acca,null));};exports[_0x0a9e('0x6c')]=function(_0x3d0a77,_0x5e5b89,_0x231c6a){var _0x63c9f7;return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x3d0a77['params']['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x5e5b89,null))[_0x0a9e('0x22')](function(_0x3f2f40){if(_0x3f2f40){_0x63c9f7=_0x3f2f40;return db[_0x0a9e('0x58')][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x3f8124){if(_0x3f8124){var _0x586510={};var _0x3156c7={};_0x3156c7['model']=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x3f8124),_[_0x0a9e('0x2b')](_0x63c9f7[_0x0a9e('0x66')],function(_0x1b61d5){return util['format'](_0x0a9e('0x69'),_0x1b61d5['id']);}));_0x3156c7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x3d0a77[_0x0a9e('0x30')]);_0x3156c7[_0x0a9e('0x3b')]=_['intersection'](_0x3156c7['model'],_0x3156c7[_0x0a9e('0x30')]);_0x586510['attributes']=_[_0x0a9e('0x32')](_0x3156c7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x586510[_0x0a9e('0x34')]=_0x586510['attributes']['length']?_0x586510[_0x0a9e('0x34')]:_0x3156c7['model'];if(!_0x3d0a77[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x586510['limit']=qs['limit'](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x586510['offset']=qs[_0x0a9e('0x1c')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x586510[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x3d0a77['query']['sort']);_0x586510[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x3d0a77[_0x0a9e('0x30')],_0x3156c7[_0x0a9e('0x3b')]));_0x586510['raw']=!![];if(_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x586510['where']=_[_0x0a9e('0x40')](_0x586510[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x586510[_0x0a9e('0x34')],function(_0x23b25b){var _0x23b39e={};_0x23b39e[_0x23b25b]={'$like':'%'+_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x23b39e;})});}_0x586510=_[_0x0a9e('0x40')]({},_0x586510,_0x3d0a77[_0x0a9e('0x41')]);return _0x63c9f7['getContacts'](_0x586510);}})[_0x0a9e('0x22')](function(_0x301047){if(!_[_0x0a9e('0x6d')](_0x301047)){var _0x1c4232=toCsv(_0x301047);var _0x1d0b02=Date['now']();fs['writeFileSync'](util[_0x0a9e('0x68')](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02),_0x1c4232);_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x70'),_0x0a9e('0x71')+util['format'](_0x0a9e('0x72'),_0x63c9f7['id'],_0x1d0b02));_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x73'),'text/csv');return _0x5e5b89[_0x0a9e('0x74')](util['format'](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02));}else{return _0x5e5b89['sendStatus'](0xcc);}})[_0x0a9e('0x46')](handleError(_0x5e5b89,null));};exports[_0x0a9e('0x75')]=function(_0xe339b1,_0x5c500c,_0xc9529d){var _0x5ed560;delete _0xe339b1[_0x0a9e('0x4b')]['id'];return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0xe339b1[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5c500c,null))[_0x0a9e('0x22')](function(_0x4014c7){if(_0x4014c7){return db[_0x0a9e('0x76')][_0x0a9e('0x77')](function(_0x27d1f5){return db[_0x0a9e('0x65')][_0x0a9e('0x4a')](_0xe339b1[_0x0a9e('0x4b')],{'transaction':_0x27d1f5})[_0x0a9e('0x22')](function(_0x98c62c){_0x5ed560=_0x98c62c;return _0x4014c7[_0x0a9e('0x78')](_0x98c62c,{'transaction':_0x27d1f5});})['then'](function(){var _0x556443={'type':db[_0x0a9e('0x79')]['TEXT'],'transaction':_0x27d1f5};switch(_0xe339b1[_0x0a9e('0x4b')][_0x0a9e('0x3e')]){case'text':_0x556443[_0x0a9e('0x3e')]=db[_0x0a9e('0x79')][_0x0a9e('0x7a')];break;case _0x0a9e('0x7b'):_0x556443['type']=db[_0x0a9e('0x79')][_0x0a9e('0x7c')];break;case _0x0a9e('0x7d'):_0x556443[_0x0a9e('0x3e')]=db['Sequelize'][_0x0a9e('0x7e')];_0x556443[_0x0a9e('0x7f')]=![];break;default:}return db[_0x0a9e('0x76')]['queryInterface'][_0x0a9e('0x80')](_0x0a9e('0x81'),util[_0x0a9e('0x68')]('cf_%s',_0x5ed560['id']),_0x556443);})[_0x0a9e('0x22')](function(){return _0x5ed560;});});}})[_0x0a9e('0x22')](respondWithResult(_0x5c500c,null))[_0x0a9e('0x46')](handleError(_0x5c500c,null));};exports[_0x0a9e('0x82')]=function(_0x2394d3,_0x555780,_0x3211d2){var _0x289e65={};var _0x4795ae={};var _0x3bab3e;var _0x1fcfe6;return db[_0x0a9e('0x2c')]['findOne']({'where':{'id':_0x2394d3['params']['id']}})['then'](handleEntityNotFound(_0x555780,null))[_0x0a9e('0x22')](function(_0x4a70ce){if(_0x4a70ce){_0x3bab3e=_0x4a70ce;_0x4795ae['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x65')][_0x0a9e('0x2d')]);_0x4795ae['query']=_[_0x0a9e('0x31')](_0x2394d3[_0x0a9e('0x30')]);_0x4795ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],_0x4795ae[_0x0a9e('0x30')]);_0x289e65[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],qs['fields'](_0x2394d3[_0x0a9e('0x30')]['fields']));_0x289e65[_0x0a9e('0x34')]=_0x289e65[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x289e65[_0x0a9e('0x34')]:_0x4795ae[_0x0a9e('0x33')];_0x289e65[_0x0a9e('0x38')]=qs['sort'](_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x289e65[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x2394d3[_0x0a9e('0x30')],_0x4795ae[_0x0a9e('0x3b')]));_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':[{'ListId':_0x4a70ce['id']},{'ListId':null}]});if(_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':_['map'](_0x289e65[_0x0a9e('0x34')],function(_0x88b25f){var _0x2ff265={};_0x2ff265[_0x88b25f]={'$like':'%'+_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x2ff265;})});}_0x289e65=_[_0x0a9e('0x40')]({},_0x289e65,_0x2394d3[_0x0a9e('0x41')]);return db[_0x0a9e('0x65')]['findAndCountAll'](_0x289e65);}})[_0x0a9e('0x22')](respondWithResult(_0x555780,null))[_0x0a9e('0x46')](handleError(_0x555780,null));};exports[_0x0a9e('0x83')]=function(_0x5c65fc,_0x1402c7,_0x41e446){return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0x5c65fc[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1402c7,null))[_0x0a9e('0x22')](function(_0x336a19){if(_0x336a19){return _0x336a19[_0x0a9e('0x83')](_0x5c65fc[_0x0a9e('0x4b')]['ids'],_[_0x0a9e('0x5f')](_0x5c65fc[_0x0a9e('0x4b')],[_0x0a9e('0x57'),'id'])||{})[_0x0a9e('0x84')](function(_0x2b624e){for(var _0x3942fd=0x0;_0x3942fd<_0x5c65fc['body'][_0x0a9e('0x57')]['length'];_0x3942fd+=0x1){socket['emit']('userCmList:save',{'UserId':_0x5c65fc[_0x0a9e('0x4b')][_0x0a9e('0x57')][_0x3942fd],'CmListId':_0x5c65fc[_0x0a9e('0x48')]['id']});}return _0x2b624e;});}})[_0x0a9e('0x22')](respondWithResult(_0x1402c7,null))['catch'](handleError(_0x1402c7,null));};exports[_0x0a9e('0x85')]=function(_0x309fa9,_0x3ddbc7,_0x1fdb10){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x309fa9['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3ddbc7,null))[_0x0a9e('0x22')](function(_0x2a293f){if(_0x2a293f){return _0x2a293f['removeAgents'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])[_0x0a9e('0x22')](function(){if(_['isArray'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])){for(var _0x15ba6b=0x0;_0x15ba6b<_0x309fa9['query'][_0x0a9e('0x57')][_0x0a9e('0x36')];_0x15ba6b+=0x1){socket[_0x0a9e('0x86')]('userCmList:remove',{'UserId':Number(_0x309fa9['query']['ids'][_0x15ba6b]),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}}else{socket[_0x0a9e('0x86')](_0x0a9e('0x87'),{'UserId':Number(_0x309fa9[_0x0a9e('0x30')]['ids']),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ddbc7,null))[_0x0a9e('0x46')](handleError(_0x3ddbc7,null));};exports[_0x0a9e('0x88')]=function(_0x242f23,_0x57f673,_0x33b4b3){var _0x33a26c={};var _0xb8a476={};var _0x580dd6;var _0x40eb5d;return db['CmList'][_0x0a9e('0x55')]({'where':{'id':_0x242f23['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x57f673,null))['then'](function(_0xb14971){if(_0xb14971){_0x580dd6=_0xb14971;_0xb8a476[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x89')][_0x0a9e('0x2d')]);_0xb8a476[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x242f23['query']);_0xb8a476[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0xb8a476['model'],_0xb8a476[_0x0a9e('0x30')]);_0x33a26c[_0x0a9e('0x34')]=_['intersection'](_0xb8a476[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x242f23[_0x0a9e('0x30')]['fields']));_0x33a26c[_0x0a9e('0x34')]=_0x33a26c[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x33a26c[_0x0a9e('0x34')]:_0xb8a476[_0x0a9e('0x33')];_0x33a26c[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x33a26c[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3c')](_0x242f23['query'],_0xb8a476[_0x0a9e('0x3b')]));if(_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x33a26c[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x33a26c[_0x0a9e('0x3a')],{'$or':_['map'](_0x33a26c[_0x0a9e('0x34')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x242f23['query'][_0x0a9e('0x3d')]+'%'};return _0x2977a7;})});}_0x33a26c=_[_0x0a9e('0x40')]({},_0x33a26c,_0x242f23[_0x0a9e('0x41')]);return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1d0a78){if(_0x1d0a78){_0x40eb5d=_0x1d0a78[_0x0a9e('0x36')];if(!_0x242f23['query'][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x33a26c[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x33a26c[_0x0a9e('0x1c')]=qs['offset'](_0x242f23['query'][_0x0a9e('0x1c')]);}return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1bf692){if(_0x1bf692){return _0x1bf692?{'count':_0x40eb5d,'rows':_0x1bf692}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x57f673,null))[_0x0a9e('0x46')](handleError(_0x57f673,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 5ee7e8c..29a32b5 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 _0x46a6=['setMaxListeners','save','update','emit','hook','exports','events','CmList'];(function(_0x4ddb5a,_0x4ac1e7){var _0x3cc697=function(_0x4de92c){while(--_0x4de92c){_0x4ddb5a['push'](_0x4ddb5a['shift']());}};_0x3cc697(++_0x4ac1e7);}(_0x46a6,0x66));var _0x646a=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x46a6[_0x396466];return _0x5e9ab4;};'use strict';var EventEmitter=require(_0x646a('0x0'));var CmList=require('../../mysqldb')['db'][_0x646a('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x646a('0x2')](0x0);var events={'afterCreate':_0x646a('0x3'),'afterUpdate':_0x646a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x21a23a){return function(_0x4e84e5,_0x585e4d,_0x4e330b){CmListEvents[_0x646a('0x5')](_0x21a23a+':'+_0x4e84e5['id'],_0x4e84e5);CmListEvents[_0x646a('0x5')](_0x21a23a,_0x4e84e5);_0x4e330b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x646a('0x6')](e,emitEvent(event));}}module[_0x646a('0x7')]=CmListEvents; \ No newline at end of file +var _0xceb3=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','CmList','save'];(function(_0x192681,_0x991e0b){var _0x4c50da=function(_0x4f7d8f){while(--_0x4f7d8f){_0x192681['push'](_0x192681['shift']());}};_0x4c50da(++_0x991e0b);}(_0xceb3,0x94));var _0x3ceb=function(_0x4f6f84,_0x31e197){_0x4f6f84=_0x4f6f84-0x0;var _0x20d989=_0xceb3[_0x4f6f84];return _0x20d989;};'use strict';var EventEmitter=require(_0x3ceb('0x0'));var CmList=require(_0x3ceb('0x1'))['db'][_0x3ceb('0x2')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3ceb('0x3'),'afterUpdate':'update','afterDestroy':_0x3ceb('0x4')};function emitEvent(_0x454d8d){return function(_0x4e9a10,_0x1a430b,_0x19d374){CmListEvents[_0x3ceb('0x5')](_0x454d8d+':'+_0x4e9a10['id'],_0x4e9a10);CmListEvents['emit'](_0x454d8d,_0x4e9a10);_0x19d374(null);};}for(var e in events){if(events[_0x3ceb('0x6')](e)){var event=events[e];CmList[_0x3ceb('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 751ae3e..32f12e1 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 _0xed73=['./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x56ff48,_0x1c2845){var _0x41bd56=function(_0x2c11ac){while(--_0x2c11ac){_0x56ff48['push'](_0x56ff48['shift']());}};_0x41bd56(++_0x1c2845);}(_0xed73,0x17e));var _0x3ed7=function(_0x22997b,_0x386172){_0x22997b=_0x22997b-0x0;var _0x1722bf=_0xed73[_0x22997b];return _0x1722bf;};'use strict';var _=require(_0x3ed7('0x0'));var util=require(_0x3ed7('0x1'));var logger=require(_0x3ed7('0x2'))(_0x3ed7('0x3'));var moment=require(_0x3ed7('0x4'));var BPromise=require(_0x3ed7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ed7('0x6'));var rimraf=require('rimraf');var config=require(_0x3ed7('0x7'));var attributes=require(_0x3ed7('0x8'));module[_0x3ed7('0x9')]=function(_0x568b68,_0x3dfd0a){return _0x568b68[_0x3ed7('0xa')](_0x3ed7('0xb'),attributes,{'tableName':_0x3ed7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c88=['./cmList.attributes','exports','define','CmList','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2099e5,_0x45825c){var _0x58e8f=function(_0x2aad5e){while(--_0x2aad5e){_0x2099e5['push'](_0x2099e5['shift']());}};_0x58e8f(++_0x45825c);}(_0x0c88,0x72));var _0x80c8=function(_0x387dc1,_0x3ba649){_0x387dc1=_0x387dc1-0x0;var _0x17567c=_0x0c88[_0x387dc1];return _0x17567c;};'use strict';var _=require(_0x80c8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x80c8('0x1'));var moment=require(_0x80c8('0x2'));var BPromise=require(_0x80c8('0x3'));var rp=require(_0x80c8('0x4'));var fs=require('fs');var path=require(_0x80c8('0x5'));var rimraf=require(_0x80c8('0x6'));var config=require('../../config/environment');var attributes=require(_0x80c8('0x7'));module[_0x80c8('0x8')]=function(_0x25621f,_0xca9727){return _0x25621f[_0x80c8('0x9')](_0x80c8('0xa'),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 61690f5..b952ac0 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 _0x840b=['request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s'];(function(_0x46adb5,_0x5a1766){var _0x5909f6=function(_0x396940){while(--_0x396940){_0x46adb5['push'](_0x46adb5['shift']());}};_0x5909f6(++_0x5a1766);}(_0x840b,0xd8));var _0xb840=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x840b[_0x474bc0];return _0x4b24cf;};'use strict';var _=require('lodash');var util=require(_0xb840('0x0'));var moment=require('moment');var BPromise=require(_0xb840('0x1'));var rs=require(_0xb840('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb840('0x3'))['db'];var utils=require(_0xb840('0x4'));var logger=require(_0xb840('0x5'))('rpc');var config=require(_0xb840('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb840('0x7')][_0xb840('0x8')]({'port':0x232a});config['redis']=_[_0xb840('0x9')](config[_0xb840('0xa')],{'host':_0xb840('0xb'),'port':0x18eb});var socket=require(_0xb840('0xc'))(new Redis(config['redis']));require(_0xb840('0xd'))[_0xb840('0xe')](socket);function respondWithRpcPromise(_0x22cb67,_0x25255f,_0x356c0f){return new BPromise(function(_0x26c369,_0x5ce2f7){return client['request'](_0x22cb67,_0x356c0f)[_0xb840('0xf')](function(_0x2bbc16){logger[_0xb840('0x10')](_0xb840('0x11'),_0x25255f,_0xb840('0x12'));logger[_0xb840('0x13')](_0xb840('0x14'),_0x25255f,_0xb840('0x12'),JSON['stringify'](_0x2bbc16));if(_0x2bbc16[_0xb840('0x15')]){if(_0x2bbc16[_0xb840('0x15')][_0xb840('0x16')]===0x1f4){logger['error'](_0xb840('0x11'),_0x25255f,_0x2bbc16['error'][_0xb840('0x17')]);return _0x5ce2f7(_0x2bbc16[_0xb840('0x15')]['message']);}logger[_0xb840('0x15')](_0xb840('0x11'),_0x25255f,_0x2bbc16[_0xb840('0x15')]['message']);return _0x26c369(_0x2bbc16['error'][_0xb840('0x17')]);}else{logger['info'](_0xb840('0x11'),_0x25255f,'request\x20sent');_0x26c369(_0x2bbc16[_0xb840('0x18')][_0xb840('0x17')]);}})[_0xb840('0x19')](function(_0x537a8a){logger[_0xb840('0x15')](_0xb840('0x11'),_0x25255f,_0x537a8a);_0x5ce2f7(_0x537a8a);});});} \ No newline at end of file +var _0x6a8d=['./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x36549f,_0x5c74f9){var _0x174066=function(_0x211330){while(--_0x211330){_0x36549f['push'](_0x36549f['shift']());}};_0x174066(++_0x5c74f9);}(_0x6a8d,0x1ed));var _0xd6a8=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x6a8d[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0xd6a8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6a8('0x1'));var db=require(_0xd6a8('0x2'))['db'];var utils=require(_0xd6a8('0x3'));var logger=require(_0xd6a8('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd6a8('0x5'));var client=jayson[_0xd6a8('0x6')][_0xd6a8('0x7')]({'port':0x232a});config[_0xd6a8('0x8')]=_['defaults'](config[_0xd6a8('0x8')],{'host':_0xd6a8('0x9'),'port':0x18eb});var socket=require(_0xd6a8('0xa'))(new Redis(config[_0xd6a8('0x8')]));require(_0xd6a8('0xb'))[_0xd6a8('0xc')](socket);function respondWithRpcPromise(_0x4781e5,_0x52aa7c,_0x16c4c0){return new BPromise(function(_0x1a75e1,_0xb5f533){return client[_0xd6a8('0xd')](_0x4781e5,_0x16c4c0)['then'](function(_0x361b18){logger[_0xd6a8('0xe')](_0xd6a8('0xf'),_0x52aa7c,_0xd6a8('0x10'));logger[_0xd6a8('0x11')](_0xd6a8('0x12'),_0x52aa7c,'request\x20sent',JSON[_0xd6a8('0x13')](_0x361b18));if(_0x361b18[_0xd6a8('0x14')]){if(_0x361b18[_0xd6a8('0x14')][_0xd6a8('0x15')]===0x1f4){logger[_0xd6a8('0x14')](_0xd6a8('0xf'),_0x52aa7c,_0x361b18[_0xd6a8('0x14')]['message']);return _0xb5f533(_0x361b18[_0xd6a8('0x14')][_0xd6a8('0x16')]);}logger[_0xd6a8('0x14')](_0xd6a8('0xf'),_0x52aa7c,_0x361b18[_0xd6a8('0x14')][_0xd6a8('0x16')]);return _0x1a75e1(_0x361b18[_0xd6a8('0x14')]['message']);}else{logger[_0xd6a8('0xe')](_0xd6a8('0xf'),_0x52aa7c,_0xd6a8('0x10'));_0x1a75e1(_0x361b18['result']['message']);}})[_0xd6a8('0x17')](function(_0x10943d){logger[_0xd6a8('0x14')](_0xd6a8('0xf'),_0x52aa7c,_0x10943d);_0xb5f533(_0x10943d);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 10c3dc7..2237ca3 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 _0xee3c=['length','cmList:','./cmList.events','save','remove','update','removeListener','register'];(function(_0x3184b6,_0xd7db19){var _0x77e3e=function(_0x3a326f){while(--_0x3a326f){_0x3184b6['push'](_0x3184b6['shift']());}};_0x77e3e(++_0xd7db19);}(_0xee3c,0x14a));var _0xcee3=function(_0xe5521d,_0x49294d){_0xe5521d=_0xe5521d-0x0;var _0x2a5aea=_0xee3c[_0xe5521d];return _0x2a5aea;};'use strict';var CmListEvents=require(_0xcee3('0x0'));var events=[_0xcee3('0x1'),_0xcee3('0x2'),_0xcee3('0x3')];function createListener(_0x3077e7,_0x853001){return function(_0x4f216c){_0x853001['emit'](_0x3077e7,_0x4f216c);};}function removeListener(_0x435892,_0x4cd398){return function(){CmListEvents[_0xcee3('0x4')](_0x435892,_0x4cd398);};}exports[_0xcee3('0x5')]=function(_0x9350f3){for(var _0x44e46f=0x0,_0x3b8ffe=events[_0xcee3('0x6')];_0x44e46f<_0x3b8ffe;_0x44e46f++){var _0x22953c=events[_0x44e46f];var _0x364eb2=createListener(_0xcee3('0x7')+_0x22953c,_0x9350f3);CmListEvents['on'](_0x22953c,_0x364eb2);}}; \ No newline at end of file +var _0x9c63=['./cmList.events','save','remove','update','emit','removeListener','register','length','cmList:'];(function(_0x2b9305,_0x1ce6a7){var _0x281243=function(_0x59892c){while(--_0x59892c){_0x2b9305['push'](_0x2b9305['shift']());}};_0x281243(++_0x1ce6a7);}(_0x9c63,0x1a7));var _0x39c6=function(_0x1da60f,_0x1cb7a0){_0x1da60f=_0x1da60f-0x0;var _0x2a67a4=_0x9c63[_0x1da60f];return _0x2a67a4;};'use strict';var CmListEvents=require(_0x39c6('0x0'));var events=[_0x39c6('0x1'),_0x39c6('0x2'),_0x39c6('0x3')];function createListener(_0xcdf16c,_0x5dccd9){return function(_0x15f661){_0x5dccd9[_0x39c6('0x4')](_0xcdf16c,_0x15f661);};}function removeListener(_0x521670,_0x59c413){return function(){CmListEvents[_0x39c6('0x5')](_0x521670,_0x59c413);};}exports[_0x39c6('0x6')]=function(_0x1071e8){for(var _0xf47b0d=0x0,_0x435078=events[_0x39c6('0x7')];_0xf47b0d<_0x435078;_0xf47b0d++){var _0x48e68f=events[_0xf47b0d];var _0x364ad5=createListener(_0x39c6('0x8')+_0x48e68f,_0x1071e8);CmListEvents['on'](_0x48e68f,_0x364ad5);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 98cbc09..e561b27 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 _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file +var _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index a0e8702..6a02294 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 _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x4c6bdd,_0x58c754){var _0x458d4f=function(_0x5f1971){while(--_0x5f1971){_0x4c6bdd['push'](_0x4c6bdd['shift']());}};_0x458d4f(++_0x58c754);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x18c601,_0x46b6aa){var _0x2ef994=function(_0x151917){while(--_0x151917){_0x18c601['push'](_0x18c601['shift']());}};_0x2ef994(++_0x46b6aa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('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 ec38254..bec0679 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 _0x115f=['status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','params','catch','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x368e09,_0x2c1517){var _0x14b7df=function(_0x5002af){while(--_0x5002af){_0x368e09['push'](_0x368e09['shift']());}};_0x14b7df(++_0x2c1517);}(_0x115f,0x105));var _0xf115=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x115f[_0x17d9e3];return _0x14192d;};'use strict';var pdf=require(_0xf115('0x0'));var emlformat=require(_0xf115('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf115('0x2'));var jsonpatch=require(_0xf115('0x3'));var rp=require(_0xf115('0x4'));var moment=require(_0xf115('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf115('0x6'));var util=require(_0xf115('0x7'));var path=require('path');var sox=require(_0xf115('0x8'));var csv=require('to-csv');var ejs=require(_0xf115('0x9'));var fs=require('fs');var _=require(_0xf115('0xa'));var squel=require(_0xf115('0xb'));var crypto=require(_0xf115('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf115('0xd'));var toCsv=require(_0xf115('0xe'));var querystring=require(_0xf115('0xf'));var Papa=require(_0xf115('0x10'));var Redis=require(_0xf115('0x11'));var authService=require(_0xf115('0x12'));var qs=require(_0xf115('0x13'));var as=require(_0xf115('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf115('0x15'))(_0xf115('0x16'));var utils=require(_0xf115('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf115('0x18'));var db=require(_0xf115('0x19'))['db'];function respondWithStatusCode(_0x25db4d,_0x4286fe){_0x4286fe=_0x4286fe||0xcc;return function(_0x5d4dd2){if(_0x5d4dd2){return _0x25db4d[_0xf115('0x1a')](_0x4286fe);}return _0x25db4d[_0xf115('0x1b')](_0x4286fe)[_0xf115('0x1c')]();};}function respondWithResult(_0x4406b7,_0x38d5d4){_0x38d5d4=_0x38d5d4||0xc8;return function(_0x5491e9){if(_0x5491e9){return _0x4406b7['status'](_0x38d5d4)[_0xf115('0x1d')](_0x5491e9);}};}function respondWithFilteredResult(_0xdc8fc1,_0x290b22){return function(_0x1135c0){if(_0x1135c0){var _0x10488e=_0x1135c0[_0xf115('0x1e')],_0x182afc=_0x290b22['offset'],_0x18748=_0x290b22[_0xf115('0x1f')]+_0x290b22[_0xf115('0x20')],_0x2353e0;if(_0x18748>=_0x10488e){_0x18748=_0x10488e;_0x2353e0=0xc8;}else{_0x2353e0=0xce;}_0xdc8fc1[_0xf115('0x1b')](_0x2353e0);return _0xdc8fc1['set']('Content-Range',_0x182afc+'-'+_0x18748+'/'+_0x10488e)[_0xf115('0x1d')](_0x1135c0);}return null;};}function patchUpdates(_0x8c647){return function(_0x295580){try{jsonpatch[_0xf115('0x21')](_0x295580,_0x8c647,!![]);}catch(_0x54738c){return BPromise[_0xf115('0x22')](_0x54738c);}return _0x295580[_0xf115('0x23')]();};}function saveUpdates(_0x4eeffe,_0x3267da){return function(_0x413ddf){if(_0x413ddf){return _0x413ddf[_0xf115('0x24')](_0x4eeffe)[_0xf115('0x25')](function(_0x37ce2c){return _0x37ce2c;});}return null;};}function removeEntity(_0xecaf39,_0x50093c){return function(_0x346667){if(_0x346667){return _0x346667[_0xf115('0x26')]()[_0xf115('0x25')](function(){_0xecaf39[_0xf115('0x1b')](0xcc)[_0xf115('0x1c')]();});}};}function handleEntityNotFound(_0x59ff09,_0x1f7104){return function(_0x1e35ca){if(!_0x1e35ca){_0x59ff09[_0xf115('0x1a')](0x194);}return _0x1e35ca;};}function handleError(_0x26c50c,_0x4737e3){_0x4737e3=_0x4737e3||0x1f4;return function(_0x30d142){logger[_0xf115('0x27')](_0x30d142[_0xf115('0x28')]);if(_0x30d142[_0xf115('0x29')]){delete _0x30d142[_0xf115('0x29')];}_0x26c50c[_0xf115('0x1b')](_0x4737e3)[_0xf115('0x2a')](_0x30d142);};}exports[_0xf115('0x24')]=function(_0x3c7e89,_0x5e7447){if(_0x3c7e89[_0xf115('0x2b')]['id']){delete _0x3c7e89[_0xf115('0x2b')]['id'];}return db[_0xf115('0x2c')][_0xf115('0x2d')]({'where':{'id':_0x3c7e89['params']['id']}})['then'](handleEntityNotFound(_0x5e7447,null))[_0xf115('0x25')](saveUpdates(_0x3c7e89['body'],null))[_0xf115('0x25')](respondWithResult(_0x5e7447,null))['catch'](handleError(_0x5e7447,null));};exports[_0xf115('0x26')]=function(_0x3244b5,_0x249e40){return db[_0xf115('0x2c')][_0xf115('0x2d')]({'where':{'id':_0x3244b5[_0xf115('0x2e')]['id']}})[_0xf115('0x25')](handleEntityNotFound(_0x249e40,null))[_0xf115('0x25')](removeEntity(_0x249e40,null))[_0xf115('0x2f')](handleError(_0x249e40,null));}; \ No newline at end of file +var _0x3518=['then','destroy','error','stack','name','send','body','find','params','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update'];(function(_0x8d3282,_0x23704e){var _0x4355ec=function(_0x22a7b9){while(--_0x22a7b9){_0x8d3282['push'](_0x8d3282['shift']());}};_0x4355ec(++_0x23704e);}(_0x3518,0xbe));var _0x8351=function(_0x36e059,_0x19ee27){_0x36e059=_0x36e059-0x0;var _0x52ee13=_0x3518[_0x36e059];return _0x52ee13;};'use strict';var pdf=require(_0x8351('0x0'));var emlformat=require(_0x8351('0x1'));var rimraf=require(_0x8351('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8351('0x3'));var rp=require(_0x8351('0x4'));var moment=require(_0x8351('0x5'));var BPromise=require(_0x8351('0x6'));var Mustache=require(_0x8351('0x7'));var util=require('util');var path=require(_0x8351('0x8'));var sox=require(_0x8351('0x9'));var csv=require(_0x8351('0xa'));var ejs=require(_0x8351('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8351('0xc'));var crypto=require(_0x8351('0xd'));var jsforce=require(_0x8351('0xe'));var deskjs=require(_0x8351('0xf'));var toCsv=require(_0x8351('0xa'));var querystring=require(_0x8351('0x10'));var Papa=require(_0x8351('0x11'));var Redis=require(_0x8351('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8351('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8351('0x14'));var logger=require('../../config/logger')(_0x8351('0x15'));var utils=require('../../config/utils');var config=require(_0x8351('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8351('0x17'))['db'];function respondWithStatusCode(_0x45e7e4,_0x32f509){_0x32f509=_0x32f509||0xcc;return function(_0x55b8a7){if(_0x55b8a7){return _0x45e7e4[_0x8351('0x18')](_0x32f509);}return _0x45e7e4[_0x8351('0x19')](_0x32f509)[_0x8351('0x1a')]();};}function respondWithResult(_0x295e43,_0x5be0fa){_0x5be0fa=_0x5be0fa||0xc8;return function(_0x17aa72){if(_0x17aa72){return _0x295e43['status'](_0x5be0fa)[_0x8351('0x1b')](_0x17aa72);}};}function respondWithFilteredResult(_0x5c9be3,_0x203b9){return function(_0x4c4bf2){if(_0x4c4bf2){var _0x52416a=_0x4c4bf2[_0x8351('0x1c')],_0x528a93=_0x203b9[_0x8351('0x1d')],_0xeb12a9=_0x203b9[_0x8351('0x1d')]+_0x203b9[_0x8351('0x1e')],_0xfa6f25;if(_0xeb12a9>=_0x52416a){_0xeb12a9=_0x52416a;_0xfa6f25=0xc8;}else{_0xfa6f25=0xce;}_0x5c9be3[_0x8351('0x19')](_0xfa6f25);return _0x5c9be3['set'](_0x8351('0x1f'),_0x528a93+'-'+_0xeb12a9+'/'+_0x52416a)['json'](_0x4c4bf2);}return null;};}function patchUpdates(_0x7b87a){return function(_0x3bdceb){try{jsonpatch[_0x8351('0x20')](_0x3bdceb,_0x7b87a,!![]);}catch(_0x5ac99a){return BPromise[_0x8351('0x21')](_0x5ac99a);}return _0x3bdceb['save']();};}function saveUpdates(_0x253951,_0x33f16d){return function(_0x3292fa){if(_0x3292fa){return _0x3292fa[_0x8351('0x22')](_0x253951)[_0x8351('0x23')](function(_0x1d96a2){return _0x1d96a2;});}return null;};}function removeEntity(_0x5f3822,_0xb1ee54){return function(_0x22e2cf){if(_0x22e2cf){return _0x22e2cf[_0x8351('0x24')]()[_0x8351('0x23')](function(){_0x5f3822[_0x8351('0x19')](0xcc)[_0x8351('0x1a')]();});}};}function handleEntityNotFound(_0x180e06,_0x25b4d9){return function(_0x1a11fe){if(!_0x1a11fe){_0x180e06[_0x8351('0x18')](0x194);}return _0x1a11fe;};}function handleError(_0x284380,_0x321287){_0x321287=_0x321287||0x1f4;return function(_0x446947){logger[_0x8351('0x25')](_0x446947[_0x8351('0x26')]);if(_0x446947[_0x8351('0x27')]){delete _0x446947['name'];}_0x284380[_0x8351('0x19')](_0x321287)[_0x8351('0x28')](_0x446947);};}exports[_0x8351('0x22')]=function(_0x41e78d,_0x407253){if(_0x41e78d[_0x8351('0x29')]['id']){delete _0x41e78d[_0x8351('0x29')]['id'];}return db['Condition'][_0x8351('0x2a')]({'where':{'id':_0x41e78d[_0x8351('0x2b')]['id']}})['then'](handleEntityNotFound(_0x407253,null))[_0x8351('0x23')](saveUpdates(_0x41e78d[_0x8351('0x29')],null))['then'](respondWithResult(_0x407253,null))['catch'](handleError(_0x407253,null));};exports[_0x8351('0x24')]=function(_0x54593c,_0x7e7a30){return db['Condition'][_0x8351('0x2a')]({'where':{'id':_0x54593c[_0x8351('0x2b')]['id']}})[_0x8351('0x23')](handleEntityNotFound(_0x7e7a30,null))[_0x8351('0x23')](removeEntity(_0x7e7a30,null))[_0x8351('0x2c')](handleError(_0x7e7a30,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 72f2da2..5aeaf59 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 _0x69ce=['rimraf','../../config/environment','./condition.attributes','exports','Condition','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x234cc1,_0x58d9f5){var _0x52347f=function(_0x1cb49e){while(--_0x1cb49e){_0x234cc1['push'](_0x234cc1['shift']());}};_0x52347f(++_0x58d9f5);}(_0x69ce,0x69));var _0xe69c=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x69ce[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe69c('0x0'))(_0xe69c('0x1'));var moment=require(_0xe69c('0x2'));var BPromise=require(_0xe69c('0x3'));var rp=require(_0xe69c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe69c('0x5'));var config=require(_0xe69c('0x6'));var attributes=require(_0xe69c('0x7'));module[_0xe69c('0x8')]=function(_0x5532fa,_0x2ec4de){return _0x5532fa['define'](_0xe69c('0x9'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfec3=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./condition.attributes','exports','define','Condition','lodash'];(function(_0x652209,_0x243c43){var _0x443cbc=function(_0x1135cd){while(--_0x1135cd){_0x652209['push'](_0x652209['shift']());}};_0x443cbc(++_0x243c43);}(_0xfec3,0x12a));var _0x3fec=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xfec3[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x3fec('0x0'));var util=require(_0x3fec('0x1'));var logger=require(_0x3fec('0x2'))(_0x3fec('0x3'));var moment=require(_0x3fec('0x4'));var BPromise=require(_0x3fec('0x5'));var rp=require(_0x3fec('0x6'));var fs=require('fs');var path=require(_0x3fec('0x7'));var rimraf=require('rimraf');var config=require(_0x3fec('0x8'));var attributes=require(_0x3fec('0x9'));module[_0x3fec('0xa')]=function(_0x153e9f,_0x2e039d){return _0x153e9f[_0x3fec('0xb')](_0x3fec('0xc'),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 642cdfe..31482cd 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 _0xe996=['debug','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0x34a6e9,_0x25cabe){var _0x11015c=function(_0x5c2ced){while(--_0x5c2ced){_0x34a6e9['push'](_0x34a6e9['shift']());}};_0x11015c(++_0x25cabe);}(_0xe996,0x1e8));var _0x6e99=function(_0x1933e3,_0x933d8e){_0x1933e3=_0x1933e3-0x0;var _0x5a30e4=_0xe996[_0x1933e3];return _0x5a30e4;};'use strict';var _=require(_0x6e99('0x0'));var util=require('util');var moment=require(_0x6e99('0x1'));var BPromise=require(_0x6e99('0x2'));var rs=require(_0x6e99('0x3'));var fs=require('fs');var Redis=require(_0x6e99('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e99('0x5'));var logger=require(_0x6e99('0x6'))(_0x6e99('0x7'));var config=require(_0x6e99('0x8'));var jayson=require(_0x6e99('0x9'));var client=jayson[_0x6e99('0xa')][_0x6e99('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a30a8,_0x2858d3,_0x5b421e){return new BPromise(function(_0x275ba9,_0x32b65a){return client[_0x6e99('0xc')](_0x3a30a8,_0x5b421e)['then'](function(_0x2bc4af){logger[_0x6e99('0xd')](_0x6e99('0xe'),_0x2858d3,_0x6e99('0xf'));logger[_0x6e99('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x2858d3,_0x6e99('0xf'),JSON['stringify'](_0x2bc4af));if(_0x2bc4af['error']){if(_0x2bc4af[_0x6e99('0x11')][_0x6e99('0x12')]===0x1f4){logger[_0x6e99('0x11')](_0x6e99('0xe'),_0x2858d3,_0x2bc4af[_0x6e99('0x11')][_0x6e99('0x13')]);return _0x32b65a(_0x2bc4af[_0x6e99('0x11')][_0x6e99('0x13')]);}logger[_0x6e99('0x11')]('Condition,\x20%s,\x20%s',_0x2858d3,_0x2bc4af[_0x6e99('0x11')]['message']);return _0x275ba9(_0x2bc4af['error'][_0x6e99('0x13')]);}else{logger[_0x6e99('0xd')](_0x6e99('0xe'),_0x2858d3,_0x6e99('0xf'));_0x275ba9(_0x2bc4af[_0x6e99('0x14')][_0x6e99('0x13')]);}})['catch'](function(_0x1bd32a){logger[_0x6e99('0x11')]('Condition,\x20%s,\x20%s',_0x2858d3,_0x1bd32a);_0x32b65a(_0x1bd32a);});});} \ No newline at end of file +var _0xccb9=['request','then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x20c3d1,_0x48c3ba){var _0x3e5849=function(_0x5a7b4c){while(--_0x5a7b4c){_0x20c3d1['push'](_0x20c3d1['shift']());}};_0x3e5849(++_0x48c3ba);}(_0xccb9,0x79));var _0x9ccb=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xccb9[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0x9ccb('0x0'));var util=require(_0x9ccb('0x1'));var moment=require(_0x9ccb('0x2'));var BPromise=require('bluebird');var rs=require(_0x9ccb('0x3'));var fs=require('fs');var Redis=require(_0x9ccb('0x4'));var db=require(_0x9ccb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ccb('0x6'))(_0x9ccb('0x7'));var config=require('../../config/environment');var jayson=require(_0x9ccb('0x8'));var client=jayson[_0x9ccb('0x9')][_0x9ccb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x380f4e,_0x567e4a,_0x429bd4){return new BPromise(function(_0xca438c,_0x5263c8){return client[_0x9ccb('0xb')](_0x380f4e,_0x429bd4)[_0x9ccb('0xc')](function(_0x10f6fd){logger[_0x9ccb('0xd')](_0x9ccb('0xe'),_0x567e4a,_0x9ccb('0xf'));logger['debug'](_0x9ccb('0x10'),_0x567e4a,_0x9ccb('0xf'),JSON[_0x9ccb('0x11')](_0x10f6fd));if(_0x10f6fd['error']){if(_0x10f6fd[_0x9ccb('0x12')][_0x9ccb('0x13')]===0x1f4){logger[_0x9ccb('0x12')](_0x9ccb('0xe'),_0x567e4a,_0x10f6fd[_0x9ccb('0x12')][_0x9ccb('0x14')]);return _0x5263c8(_0x10f6fd[_0x9ccb('0x12')][_0x9ccb('0x14')]);}logger[_0x9ccb('0x12')](_0x9ccb('0xe'),_0x567e4a,_0x10f6fd[_0x9ccb('0x12')][_0x9ccb('0x14')]);return _0xca438c(_0x10f6fd[_0x9ccb('0x12')][_0x9ccb('0x14')]);}else{logger[_0x9ccb('0xd')]('Condition,\x20%s,\x20%s',_0x567e4a,_0x9ccb('0xf'));_0xca438c(_0x10f6fd['result'][_0x9ccb('0x14')]);}})[_0x9ccb('0x15')](function(_0x5559fe){logger[_0x9ccb('0x12')](_0x9ccb('0xe'),_0x567e4a,_0x5559fe);_0x5263c8(_0x5559fe);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index c32ad9b..e316ae1 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 _0xe63f=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','util','path','connect-timeout'];(function(_0x159b7f,_0x27e760){var _0x401efb=function(_0x7b23a5){while(--_0x7b23a5){_0x159b7f['push'](_0x159b7f['shift']());}};_0x401efb(++_0x27e760);}(_0xe63f,0x1bd));var _0xfe63=function(_0x5e3a22,_0x25a30c){_0x5e3a22=_0x5e3a22-0x0;var _0x251e73=_0xe63f[_0x5e3a22];return _0x251e73;};'use strict';var multer=require('multer');var util=require(_0xfe63('0x0'));var path=require(_0xfe63('0x1'));var timeout=require(_0xfe63('0x2'));var express=require(_0xfe63('0x3'));var router=express[_0xfe63('0x4')]();var auth=require(_0xfe63('0x5'));var interaction=require(_0xfe63('0x6'));var config=require(_0xfe63('0x7'));var controller=require('./condition.controller');router[_0xfe63('0x8')](_0xfe63('0x9'),auth[_0xfe63('0xa')](),controller[_0xfe63('0xb')]);router[_0xfe63('0xc')](_0xfe63('0x9'),auth[_0xfe63('0xa')](),controller[_0xfe63('0xd')]);module['exports']=router; \ No newline at end of file +var _0x5f1f=['util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','update','delete','isAuthenticated','destroy','exports'];(function(_0x26f113,_0x4b01c9){var _0x4eb310=function(_0x5d7e62){while(--_0x5d7e62){_0x26f113['push'](_0x26f113['shift']());}};_0x4eb310(++_0x4b01c9);}(_0x5f1f,0x16c));var _0xf5f1=function(_0x2a9153,_0x44fd73){_0x2a9153=_0x2a9153-0x0;var _0x2f6615=_0x5f1f[_0x2a9153];return _0x2f6615;};'use strict';var multer=require('multer');var util=require(_0xf5f1('0x0'));var path=require('path');var timeout=require(_0xf5f1('0x1'));var express=require(_0xf5f1('0x2'));var router=express[_0xf5f1('0x3')]();var auth=require(_0xf5f1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf5f1('0x5'));var controller=require(_0xf5f1('0x6'));router[_0xf5f1('0x7')](_0xf5f1('0x8'),auth['isAuthenticated'](),controller[_0xf5f1('0x9')]);router[_0xf5f1('0xa')](_0xf5f1('0x8'),auth[_0xf5f1('0xb')](),controller[_0xf5f1('0xc')]);module[_0xf5f1('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index a78080e..26b3609 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x503a=['STRING','sequelize','exports','name'];(function(_0x51539c,_0x25f587){var _0x4f7914=function(_0x4c666e){while(--_0x4c666e){_0x51539c['push'](_0x51539c['shift']());}};_0x4f7914(++_0x25f587);}(_0x503a,0x19d));var _0xa503=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x503a[_0x5f1391];return _0x50ebe3;};'use strict';var Sequelize=require(_0xa503('0x0'));module[_0xa503('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa503('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xa503('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0x9a19=['sequelize','exports','STRING','INTEGER'];(function(_0x1fbe59,_0x45dd45){var _0x315b32=function(_0x403fe){while(--_0x403fe){_0x1fbe59['push'](_0x1fbe59['shift']());}};_0x315b32(++_0x45dd45);}(_0x9a19,0x114));var _0x99a1=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x9a19[_0x5eaa0b];return _0x28b295;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'name':{'type':Sequelize[_0x99a1('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x99a1('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x99a1('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index f52ce0a..cdf06ce 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe928=['includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','json','apply','update','then','ContactItemTypes','UserProfileResource','destroy','end','stack','name','send','ContactItemType','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','pick','filter','where','VIRTUAL','merge','options','include','catch'];(function(_0x2221f2,_0x490837){var _0x510427=function(_0x406ab3){while(--_0x406ab3){_0x2221f2['push'](_0x2221f2['shift']());}};_0x510427(++_0x490837);}(_0xe928,0x145));var _0x8e92=function(_0x5849bd,_0x2b8e4d){_0x5849bd=_0x5849bd-0x0;var _0x397d14=_0xe928[_0x5849bd];return _0x397d14;};'use strict';var pdf=require(_0x8e92('0x0'));var emlformat=require(_0x8e92('0x1'));var rimraf=require(_0x8e92('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e92('0x3'));var rp=require('request-promise');var moment=require(_0x8e92('0x4'));var BPromise=require(_0x8e92('0x5'));var Mustache=require(_0x8e92('0x6'));var util=require(_0x8e92('0x7'));var path=require('path');var sox=require(_0x8e92('0x8'));var csv=require('to-csv');var ejs=require(_0x8e92('0x9'));var fs=require('fs');var _=require(_0x8e92('0xa'));var squel=require(_0x8e92('0xb'));var crypto=require(_0x8e92('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8e92('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8e92('0xe'));var Papa=require(_0x8e92('0xf'));var Redis=require(_0x8e92('0x10'));var authService=require(_0x8e92('0x11'));var qs=require(_0x8e92('0x12'));var as=require(_0x8e92('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e92('0x14'))(_0x8e92('0x15'));var utils=require(_0x8e92('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8e92('0x17'));var db=require(_0x8e92('0x18'))['db'];function respondWithStatusCode(_0x3cbe0a,_0x3b19fa){_0x3b19fa=_0x3b19fa||0xcc;return function(_0x324f3f){if(_0x324f3f){return _0x3cbe0a[_0x8e92('0x19')](_0x3b19fa);}return _0x3cbe0a[_0x8e92('0x1a')](_0x3b19fa)['end']();};}function respondWithResult(_0x97be72,_0x5c06fd){_0x5c06fd=_0x5c06fd||0xc8;return function(_0x1cf5ee){if(_0x1cf5ee){return _0x97be72[_0x8e92('0x1a')](_0x5c06fd)['json'](_0x1cf5ee);}};}function respondWithFilteredResult(_0x101ea1,_0x57ff38){return function(_0x1d866f){if(_0x1d866f){var _0x26cce1=_0x1d866f[_0x8e92('0x1b')],_0x43b20e=_0x57ff38[_0x8e92('0x1c')],_0x1380ef=_0x57ff38[_0x8e92('0x1c')]+_0x57ff38['limit'],_0x1c4b12;if(_0x1380ef>=_0x26cce1){_0x1380ef=_0x26cce1;_0x1c4b12=0xc8;}else{_0x1c4b12=0xce;}_0x101ea1[_0x8e92('0x1a')](_0x1c4b12);return _0x101ea1[_0x8e92('0x1d')](_0x8e92('0x1e'),_0x43b20e+'-'+_0x1380ef+'/'+_0x26cce1)[_0x8e92('0x1f')](_0x1d866f);}return null;};}function patchUpdates(_0x250988){return function(_0x5ab67b){try{jsonpatch[_0x8e92('0x20')](_0x5ab67b,_0x250988,!![]);}catch(_0x263f05){return BPromise['reject'](_0x263f05);}return _0x5ab67b['save']();};}function saveUpdates(_0x558694,_0x334628){return function(_0x4d93ea){if(_0x4d93ea){return _0x4d93ea[_0x8e92('0x21')](_0x558694)[_0x8e92('0x22')](function(_0x63cf41){return _0x63cf41;});}return null;};}function removeEntity(_0x3147ef,_0x368253){return function(_0x70f846){if(_0x70f846){return _0x70f846['destroy']()['then'](function(){var _0x53b5aa=_0x70f846['get']({'plain':!![]});var _0x322765=_0x8e92('0x23');return db[_0x8e92('0x24')][_0x8e92('0x25')]({'where':{'type':_0x322765,'resourceId':_0x53b5aa['id']}})[_0x8e92('0x22')](function(){return _0x70f846;});})[_0x8e92('0x22')](function(){_0x3147ef['status'](0xcc)[_0x8e92('0x26')]();});}};}function handleEntityNotFound(_0x22cdbe,_0x12eba1){return function(_0x127fff){if(!_0x127fff){_0x22cdbe[_0x8e92('0x19')](0x194);}return _0x127fff;};}function handleError(_0x2aaf1d,_0x4cd951){_0x4cd951=_0x4cd951||0x1f4;return function(_0x5840bf){logger['error'](_0x5840bf[_0x8e92('0x27')]);if(_0x5840bf['name']){delete _0x5840bf[_0x8e92('0x28')];}_0x2aaf1d['status'](_0x4cd951)[_0x8e92('0x29')](_0x5840bf);};}exports['index']=function(_0x208384,_0x57c4de){var _0xc7e9c0={},_0x3c8897={},_0x3fc5c6={'count':0x0,'rows':[]};var _0x115789=_['map'](db[_0x8e92('0x2a')][_0x8e92('0x2b')],function(_0x4c11ef){return{'name':_0x4c11ef[_0x8e92('0x2c')],'type':_0x4c11ef['type'][_0x8e92('0x2d')]};});_0x3c8897[_0x8e92('0x2e')]=_['map'](_0x115789,_0x8e92('0x28'));_0x3c8897[_0x8e92('0x2f')]=_[_0x8e92('0x30')](_0x208384[_0x8e92('0x2f')]);_0x3c8897[_0x8e92('0x31')]=_[_0x8e92('0x32')](_0x3c8897[_0x8e92('0x2e')],_0x3c8897[_0x8e92('0x2f')]);_0xc7e9c0[_0x8e92('0x33')]=_['intersection'](_0x3c8897['model'],qs[_0x8e92('0x34')](_0x208384['query']['fields']));_0xc7e9c0[_0x8e92('0x33')]=_0xc7e9c0[_0x8e92('0x33')][_0x8e92('0x35')]?_0xc7e9c0['attributes']:_0x3c8897[_0x8e92('0x2e')];if(!_0x208384[_0x8e92('0x2f')][_0x8e92('0x36')]('nolimit')){_0xc7e9c0['limit']=qs[_0x8e92('0x37')](_0x208384['query'][_0x8e92('0x37')]);_0xc7e9c0[_0x8e92('0x1c')]=qs[_0x8e92('0x1c')](_0x208384[_0x8e92('0x2f')][_0x8e92('0x1c')]);}_0xc7e9c0['order']=qs[_0x8e92('0x38')](_0x208384[_0x8e92('0x2f')][_0x8e92('0x38')]);_0xc7e9c0['where']=qs['filters'](_[_0x8e92('0x39')](_0x208384['query'],_0x3c8897[_0x8e92('0x31')]),_0x115789);if(_0x208384[_0x8e92('0x2f')][_0x8e92('0x3a')]){_0xc7e9c0[_0x8e92('0x3b')]=_['merge'](_0xc7e9c0['where'],{'$or':_['map'](_0x115789,function(_0x206534){if(_0x206534['type']!==_0x8e92('0x3c')){var _0x502690={};_0x502690[_0x206534['name']]={'$like':'%'+_0x208384['query'][_0x8e92('0x3a')]+'%'};return _0x502690;}})});}_0xc7e9c0=_[_0x8e92('0x3d')]({},_0xc7e9c0,_0x208384[_0x8e92('0x3e')]);var _0x132554={'where':_0xc7e9c0[_0x8e92('0x3b')]};return db[_0x8e92('0x2a')]['count'](_0x132554)[_0x8e92('0x22')](function(_0x31d024){_0x3fc5c6[_0x8e92('0x1b')]=_0x31d024;if(_0x208384[_0x8e92('0x2f')]['includeAll']){_0xc7e9c0[_0x8e92('0x3f')]=[{'all':!![]}];}return db[_0x8e92('0x2a')]['findAll'](_0xc7e9c0);})[_0x8e92('0x22')](function(_0x368096){_0x3fc5c6['rows']=_0x368096;return _0x3fc5c6;})['then'](respondWithFilteredResult(_0x57c4de,_0xc7e9c0))[_0x8e92('0x40')](handleError(_0x57c4de,null));};exports['show']=function(_0x543e7f,_0x4e9683){var _0x121bae={'raw':!![],'where':{'id':_0x543e7f['params']['id']}},_0x23c940={};_0x23c940[_0x8e92('0x2e')]=_[_0x8e92('0x30')](db[_0x8e92('0x2a')][_0x8e92('0x2b')]);_0x23c940['query']=_[_0x8e92('0x30')](_0x543e7f['query']);_0x23c940[_0x8e92('0x31')]=_[_0x8e92('0x32')](_0x23c940['model'],_0x23c940[_0x8e92('0x2f')]);_0x121bae[_0x8e92('0x33')]=_[_0x8e92('0x32')](_0x23c940[_0x8e92('0x2e')],qs[_0x8e92('0x34')](_0x543e7f[_0x8e92('0x2f')][_0x8e92('0x34')]));_0x121bae[_0x8e92('0x33')]=_0x121bae[_0x8e92('0x33')][_0x8e92('0x35')]?_0x121bae[_0x8e92('0x33')]:_0x23c940[_0x8e92('0x2e')];if(_0x543e7f['query'][_0x8e92('0x41')]){_0x121bae[_0x8e92('0x3f')]=[{'all':!![]}];}_0x121bae=_[_0x8e92('0x3d')]({},_0x121bae,_0x543e7f[_0x8e92('0x3e')]);return db['ContactItemType'][_0x8e92('0x42')](_0x121bae)[_0x8e92('0x22')](handleEntityNotFound(_0x4e9683,null))[_0x8e92('0x22')](respondWithResult(_0x4e9683,null))['catch'](handleError(_0x4e9683,null));};exports[_0x8e92('0x43')]=function(_0x268f4c,_0x3fd175){return db[_0x8e92('0x2a')][_0x8e92('0x43')](_0x268f4c[_0x8e92('0x44')],{})[_0x8e92('0x22')](function(_0x399047){var _0x113a6a=_0x268f4c[_0x8e92('0x45')][_0x8e92('0x46')]({'plain':!![]});if(!_0x113a6a)throw new Error(_0x8e92('0x47'));if(_0x113a6a['role']===_0x8e92('0x45')){var _0x1fb8cf=_0x399047[_0x8e92('0x46')]({'plain':!![]});var _0x193df0=_0x8e92('0x23');return db[_0x8e92('0x48')]['find']({'where':{'name':_0x193df0,'userProfileId':_0x113a6a[_0x8e92('0x49')]},'raw':!![]})[_0x8e92('0x22')](function(_0x31d987){if(_0x31d987&&_0x31d987[_0x8e92('0x4a')]===0x0){return db[_0x8e92('0x24')][_0x8e92('0x43')]({'name':_0x1fb8cf[_0x8e92('0x28')],'resourceId':_0x1fb8cf['id'],'type':_0x31d987[_0x8e92('0x28')],'sectionId':_0x31d987['id']},{})[_0x8e92('0x22')](function(){return _0x399047;});}else{return _0x399047;}})[_0x8e92('0x40')](function(_0x2373ef){logger[_0x8e92('0x4b')](_0x8e92('0x4c'),_0x2373ef);throw _0x2373ef;});}return _0x399047;})[_0x8e92('0x22')](respondWithResult(_0x3fd175,0xc9))['catch'](handleError(_0x3fd175,null));};exports[_0x8e92('0x21')]=function(_0x5eb91f,_0x5163c2){if(_0x5eb91f[_0x8e92('0x44')]['id']){delete _0x5eb91f[_0x8e92('0x44')]['id'];}return db['ContactItemType']['find']({'where':{'id':_0x5eb91f[_0x8e92('0x4d')]['id']}})[_0x8e92('0x22')](handleEntityNotFound(_0x5163c2,null))[_0x8e92('0x22')](saveUpdates(_0x5eb91f[_0x8e92('0x44')],null))[_0x8e92('0x22')](respondWithResult(_0x5163c2,null))[_0x8e92('0x40')](handleError(_0x5163c2,null));};exports[_0x8e92('0x25')]=function(_0x3a31d9,_0xc3da5f){return db[_0x8e92('0x2a')][_0x8e92('0x42')]({'where':{'id':_0x3a31d9[_0x8e92('0x4d')]['id']}})[_0x8e92('0x22')](handleEntityNotFound(_0xc3da5f,null))[_0x8e92('0x22')](removeEntity(_0xc3da5f,null))[_0x8e92('0x40')](handleError(_0xc3da5f,null));}; \ No newline at end of file +var _0xea4e=['reject','update','destroy','get','ContactItemTypes','then','error','stack','name','send','index','map','ContactItemType','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','catch','params','rawAttributes','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply'];(function(_0x1da8f5,_0xc052c4){var _0x2973a4=function(_0x260e37){while(--_0x260e37){_0x1da8f5['push'](_0x1da8f5['shift']());}};_0x2973a4(++_0xc052c4);}(_0xea4e,0x10c));var _0xeea4=function(_0x25292e,_0x44f47f){_0x25292e=_0x25292e-0x0;var _0x48de57=_0xea4e[_0x25292e];return _0x48de57;};'use strict';var pdf=require(_0xeea4('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xeea4('0x1'));var rp=require('request-promise');var moment=require(_0xeea4('0x2'));var BPromise=require(_0xeea4('0x3'));var Mustache=require('mustache');var util=require(_0xeea4('0x4'));var path=require(_0xeea4('0x5'));var sox=require(_0xeea4('0x6'));var csv=require(_0xeea4('0x7'));var ejs=require(_0xeea4('0x8'));var fs=require('fs');var _=require(_0xeea4('0x9'));var squel=require(_0xeea4('0xa'));var crypto=require(_0xeea4('0xb'));var jsforce=require(_0xeea4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xeea4('0x7'));var querystring=require('querystring');var Papa=require(_0xeea4('0xd'));var Redis=require(_0xeea4('0xe'));var authService=require(_0xeea4('0xf'));var qs=require(_0xeea4('0x10'));var as=require(_0xeea4('0x11'));var hardwareService=require(_0xeea4('0x12'));var logger=require(_0xeea4('0x13'))(_0xeea4('0x14'));var utils=require('../../config/utils');var config=require(_0xeea4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xeea4('0x16'))['db'];function respondWithStatusCode(_0x216785,_0x3c18ed){_0x3c18ed=_0x3c18ed||0xcc;return function(_0x3dbf8c){if(_0x3dbf8c){return _0x216785[_0xeea4('0x17')](_0x3c18ed);}return _0x216785[_0xeea4('0x18')](_0x3c18ed)[_0xeea4('0x19')]();};}function respondWithResult(_0x9d04aa,_0x4d6605){_0x4d6605=_0x4d6605||0xc8;return function(_0x169fc5){if(_0x169fc5){return _0x9d04aa[_0xeea4('0x18')](_0x4d6605)['json'](_0x169fc5);}};}function respondWithFilteredResult(_0x44f13a,_0x4d47b0){return function(_0x2d5a6c){if(_0x2d5a6c){var _0x44f573=_0x2d5a6c[_0xeea4('0x1a')],_0x8b4b62=_0x4d47b0[_0xeea4('0x1b')],_0x12f574=_0x4d47b0[_0xeea4('0x1b')]+_0x4d47b0[_0xeea4('0x1c')],_0x308034;if(_0x12f574>=_0x44f573){_0x12f574=_0x44f573;_0x308034=0xc8;}else{_0x308034=0xce;}_0x44f13a[_0xeea4('0x18')](_0x308034);return _0x44f13a['set'](_0xeea4('0x1d'),_0x8b4b62+'-'+_0x12f574+'/'+_0x44f573)[_0xeea4('0x1e')](_0x2d5a6c);}return null;};}function patchUpdates(_0x5c4e7b){return function(_0x36a9b3){try{jsonpatch[_0xeea4('0x1f')](_0x36a9b3,_0x5c4e7b,!![]);}catch(_0x4c039c){return BPromise[_0xeea4('0x20')](_0x4c039c);}return _0x36a9b3['save']();};}function saveUpdates(_0x3f7316,_0x54cf4d){return function(_0x592e81){if(_0x592e81){return _0x592e81[_0xeea4('0x21')](_0x3f7316)['then'](function(_0x2acc9b){return _0x2acc9b;});}return null;};}function removeEntity(_0x12ba5b,_0x3e162c){return function(_0x19b2a8){if(_0x19b2a8){return _0x19b2a8[_0xeea4('0x22')]()['then'](function(){var _0x3f2cd2=_0x19b2a8[_0xeea4('0x23')]({'plain':!![]});var _0x290983=_0xeea4('0x24');return db['UserProfileResource'][_0xeea4('0x22')]({'where':{'type':_0x290983,'resourceId':_0x3f2cd2['id']}})[_0xeea4('0x25')](function(){return _0x19b2a8;});})[_0xeea4('0x25')](function(){_0x12ba5b[_0xeea4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x594258,_0x1ac8f3){return function(_0x28d8f9){if(!_0x28d8f9){_0x594258[_0xeea4('0x17')](0x194);}return _0x28d8f9;};}function handleError(_0x197573,_0x2ca258){_0x2ca258=_0x2ca258||0x1f4;return function(_0x5b35e1){logger[_0xeea4('0x26')](_0x5b35e1[_0xeea4('0x27')]);if(_0x5b35e1['name']){delete _0x5b35e1[_0xeea4('0x28')];}_0x197573['status'](_0x2ca258)[_0xeea4('0x29')](_0x5b35e1);};}exports[_0xeea4('0x2a')]=function(_0x2eb38c,_0x134f24){var _0x1217b4={},_0x5b651f={},_0x1abc8c={'count':0x0,'rows':[]};var _0x4e68c4=_[_0xeea4('0x2b')](db[_0xeea4('0x2c')]['rawAttributes'],function(_0x48a047){return{'name':_0x48a047['fieldName'],'type':_0x48a047[_0xeea4('0x2d')]['key']};});_0x5b651f[_0xeea4('0x2e')]=_[_0xeea4('0x2b')](_0x4e68c4,_0xeea4('0x28'));_0x5b651f[_0xeea4('0x2f')]=_[_0xeea4('0x30')](_0x2eb38c['query']);_0x5b651f[_0xeea4('0x31')]=_[_0xeea4('0x32')](_0x5b651f[_0xeea4('0x2e')],_0x5b651f['query']);_0x1217b4[_0xeea4('0x33')]=_[_0xeea4('0x32')](_0x5b651f[_0xeea4('0x2e')],qs[_0xeea4('0x34')](_0x2eb38c[_0xeea4('0x2f')][_0xeea4('0x34')]));_0x1217b4[_0xeea4('0x33')]=_0x1217b4[_0xeea4('0x33')][_0xeea4('0x35')]?_0x1217b4[_0xeea4('0x33')]:_0x5b651f['model'];if(!_0x2eb38c['query'][_0xeea4('0x36')](_0xeea4('0x37'))){_0x1217b4[_0xeea4('0x1c')]=qs[_0xeea4('0x1c')](_0x2eb38c[_0xeea4('0x2f')][_0xeea4('0x1c')]);_0x1217b4[_0xeea4('0x1b')]=qs['offset'](_0x2eb38c[_0xeea4('0x2f')][_0xeea4('0x1b')]);}_0x1217b4[_0xeea4('0x38')]=qs['sort'](_0x2eb38c[_0xeea4('0x2f')][_0xeea4('0x39')]);_0x1217b4['where']=qs[_0xeea4('0x31')](_[_0xeea4('0x3a')](_0x2eb38c[_0xeea4('0x2f')],_0x5b651f[_0xeea4('0x31')]),_0x4e68c4);if(_0x2eb38c[_0xeea4('0x2f')][_0xeea4('0x3b')]){_0x1217b4[_0xeea4('0x3c')]=_[_0xeea4('0x3d')](_0x1217b4['where'],{'$or':_[_0xeea4('0x2b')](_0x4e68c4,function(_0x1091a2){if(_0x1091a2['type']!==_0xeea4('0x3e')){var _0x9c419={};_0x9c419[_0x1091a2[_0xeea4('0x28')]]={'$like':'%'+_0x2eb38c[_0xeea4('0x2f')][_0xeea4('0x3b')]+'%'};return _0x9c419;}})});}_0x1217b4=_[_0xeea4('0x3d')]({},_0x1217b4,_0x2eb38c[_0xeea4('0x3f')]);var _0x4ad5e3={'where':_0x1217b4[_0xeea4('0x3c')]};return db[_0xeea4('0x2c')]['count'](_0x4ad5e3)[_0xeea4('0x25')](function(_0x4e2d1c){_0x1abc8c[_0xeea4('0x1a')]=_0x4e2d1c;if(_0x2eb38c[_0xeea4('0x2f')]['includeAll']){_0x1217b4['include']=[{'all':!![]}];}return db[_0xeea4('0x2c')]['findAll'](_0x1217b4);})[_0xeea4('0x25')](function(_0x62d5fc){_0x1abc8c['rows']=_0x62d5fc;return _0x1abc8c;})[_0xeea4('0x25')](respondWithFilteredResult(_0x134f24,_0x1217b4))[_0xeea4('0x40')](handleError(_0x134f24,null));};exports['show']=function(_0xb56e01,_0x13a30c){var _0x1cd6a9={'raw':!![],'where':{'id':_0xb56e01[_0xeea4('0x41')]['id']}},_0xa04588={};_0xa04588[_0xeea4('0x2e')]=_[_0xeea4('0x30')](db['ContactItemType'][_0xeea4('0x42')]);_0xa04588[_0xeea4('0x2f')]=_[_0xeea4('0x30')](_0xb56e01[_0xeea4('0x2f')]);_0xa04588['filters']=_[_0xeea4('0x32')](_0xa04588[_0xeea4('0x2e')],_0xa04588[_0xeea4('0x2f')]);_0x1cd6a9['attributes']=_['intersection'](_0xa04588[_0xeea4('0x2e')],qs[_0xeea4('0x34')](_0xb56e01['query']['fields']));_0x1cd6a9[_0xeea4('0x33')]=_0x1cd6a9[_0xeea4('0x33')][_0xeea4('0x35')]?_0x1cd6a9[_0xeea4('0x33')]:_0xa04588[_0xeea4('0x2e')];if(_0xb56e01['query'][_0xeea4('0x43')]){_0x1cd6a9['include']=[{'all':!![]}];}_0x1cd6a9=_[_0xeea4('0x3d')]({},_0x1cd6a9,_0xb56e01[_0xeea4('0x3f')]);return db[_0xeea4('0x2c')]['find'](_0x1cd6a9)[_0xeea4('0x25')](handleEntityNotFound(_0x13a30c,null))['then'](respondWithResult(_0x13a30c,null))['catch'](handleError(_0x13a30c,null));};exports[_0xeea4('0x44')]=function(_0x111cbd,_0x15461a){return db[_0xeea4('0x2c')]['create'](_0x111cbd['body'],{})[_0xeea4('0x25')](function(_0x18bb53){var _0x208282=_0x111cbd['user'][_0xeea4('0x23')]({'plain':!![]});if(!_0x208282)throw new Error(_0xeea4('0x45'));if(_0x208282['role']==='user'){var _0x47eac8=_0x18bb53[_0xeea4('0x23')]({'plain':!![]});var _0x3a4a27=_0xeea4('0x24');return db[_0xeea4('0x46')][_0xeea4('0x47')]({'where':{'name':_0x3a4a27,'userProfileId':_0x208282[_0xeea4('0x48')]},'raw':!![]})[_0xeea4('0x25')](function(_0x471825){if(_0x471825&&_0x471825['autoAssociation']===0x0){return db['UserProfileResource'][_0xeea4('0x44')]({'name':_0x47eac8['name'],'resourceId':_0x47eac8['id'],'type':_0x471825[_0xeea4('0x28')],'sectionId':_0x471825['id']},{})['then'](function(){return _0x18bb53;});}else{return _0x18bb53;}})[_0xeea4('0x40')](function(_0xfb11fd){logger['error'](_0xeea4('0x49'),_0xfb11fd);throw _0xfb11fd;});}return _0x18bb53;})[_0xeea4('0x25')](respondWithResult(_0x15461a,0xc9))[_0xeea4('0x40')](handleError(_0x15461a,null));};exports['update']=function(_0x23d152,_0x828b){if(_0x23d152[_0xeea4('0x4a')]['id']){delete _0x23d152['body']['id'];}return db[_0xeea4('0x2c')][_0xeea4('0x47')]({'where':{'id':_0x23d152[_0xeea4('0x41')]['id']}})[_0xeea4('0x25')](handleEntityNotFound(_0x828b,null))[_0xeea4('0x25')](saveUpdates(_0x23d152[_0xeea4('0x4a')],null))[_0xeea4('0x25')](respondWithResult(_0x828b,null))[_0xeea4('0x40')](handleError(_0x828b,null));};exports[_0xeea4('0x22')]=function(_0x3862f0,_0x142086){return db[_0xeea4('0x2c')][_0xeea4('0x47')]({'where':{'id':_0x3862f0['params']['id']}})[_0xeea4('0x25')](handleEntityNotFound(_0x142086,null))['then'](removeEntity(_0x142086,null))['catch'](handleError(_0x142086,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 64ea1fd..f22d3e1 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bae=['../../config/environment','exports','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3d2565,_0x30aa0e){var _0x4fb016=function(_0x21857f){while(--_0x21857f){_0x3d2565['push'](_0x3d2565['shift']());}};_0x4fb016(++_0x30aa0e);}(_0x2bae,0x164));var _0xe2ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bae[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe2ba('0x0'));var util=require(_0xe2ba('0x1'));var logger=require(_0xe2ba('0x2'))(_0xe2ba('0x3'));var moment=require(_0xe2ba('0x4'));var BPromise=require(_0xe2ba('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe2ba('0x6'));var rimraf=require('rimraf');var config=require(_0xe2ba('0x7'));var attributes=require('./contactItemType.attributes');module[_0xe2ba('0x8')]=function(_0x129677,_0x21601e){return _0x129677['define'](_0xe2ba('0x9'),attributes,{'tableName':_0xe2ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4677=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define'];(function(_0x34c542,_0x220b05){var _0x5b9ec2=function(_0x51dc4f){while(--_0x51dc4f){_0x34c542['push'](_0x34c542['shift']());}};_0x5b9ec2(++_0x220b05);}(_0x4677,0x155));var _0x7467=function(_0x59a2f1,_0x3281d4){_0x59a2f1=_0x59a2f1-0x0;var _0xee03b3=_0x4677[_0x59a2f1];return _0xee03b3;};'use strict';var _=require(_0x7467('0x0'));var util=require('util');var logger=require(_0x7467('0x1'))(_0x7467('0x2'));var moment=require(_0x7467('0x3'));var BPromise=require('bluebird');var rp=require(_0x7467('0x4'));var fs=require('fs');var path=require(_0x7467('0x5'));var rimraf=require(_0x7467('0x6'));var config=require(_0x7467('0x7'));var attributes=require(_0x7467('0x8'));module[_0x7467('0x9')]=function(_0x36fc81,_0x40a9c6){return _0x36fc81[_0x7467('0xa')]('ContactItemType',attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 12371f2..a674c10 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01fe=['http','request','then','info','request\x20sent','debug','error','code','ContactItemType,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x2f0ae4,_0x157cd7){var _0x10b965=function(_0x3ad6bd){while(--_0x3ad6bd){_0x2f0ae4['push'](_0x2f0ae4['shift']());}};_0x10b965(++_0x157cd7);}(_0x01fe,0x102));var _0xe01f=function(_0x5506de,_0x6ddbca){_0x5506de=_0x5506de-0x0;var _0x518618=_0x01fe[_0x5506de];return _0x518618;};'use strict';var _=require(_0xe01f('0x0'));var util=require('util');var moment=require(_0xe01f('0x1'));var BPromise=require(_0xe01f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe01f('0x3'))['db'];var utils=require(_0xe01f('0x4'));var logger=require(_0xe01f('0x5'))(_0xe01f('0x6'));var config=require('../../config/environment');var jayson=require(_0xe01f('0x7'));var client=jayson['client'][_0xe01f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b754f,_0x45431b,_0x40376f){return new BPromise(function(_0x377881,_0x4d1775){return client[_0xe01f('0x9')](_0x3b754f,_0x40376f)[_0xe01f('0xa')](function(_0x47dc30){logger[_0xe01f('0xb')]('ContactItemType,\x20%s,\x20%s',_0x45431b,_0xe01f('0xc'));logger[_0xe01f('0xd')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x45431b,_0xe01f('0xc'),JSON['stringify'](_0x47dc30));if(_0x47dc30[_0xe01f('0xe')]){if(_0x47dc30[_0xe01f('0xe')][_0xe01f('0xf')]===0x1f4){logger[_0xe01f('0xe')](_0xe01f('0x10'),_0x45431b,_0x47dc30[_0xe01f('0xe')][_0xe01f('0x11')]);return _0x4d1775(_0x47dc30[_0xe01f('0xe')]['message']);}logger[_0xe01f('0xe')](_0xe01f('0x10'),_0x45431b,_0x47dc30[_0xe01f('0xe')][_0xe01f('0x11')]);return _0x377881(_0x47dc30[_0xe01f('0xe')][_0xe01f('0x11')]);}else{logger[_0xe01f('0xb')]('ContactItemType,\x20%s,\x20%s',_0x45431b,'request\x20sent');_0x377881(_0x47dc30['result'][_0xe01f('0x11')]);}})[_0xe01f('0x12')](function(_0x88606f){logger[_0xe01f('0xe')](_0xe01f('0x10'),_0x45431b,_0x88606f);_0x4d1775(_0x88606f);});});} \ No newline at end of file +var _0x8c38=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash'];(function(_0x486ab6,_0x257c0a){var _0x1ce5ea=function(_0x1443a5){while(--_0x1443a5){_0x486ab6['push'](_0x486ab6['shift']());}};_0x1ce5ea(++_0x257c0a);}(_0x8c38,0x83));var _0x88c3=function(_0x92a92f,_0x43b003){_0x92a92f=_0x92a92f-0x0;var _0x2174d8=_0x8c38[_0x92a92f];return _0x2174d8;};'use strict';var _=require(_0x88c3('0x0'));var util=require(_0x88c3('0x1'));var moment=require('moment');var BPromise=require(_0x88c3('0x2'));var rs=require(_0x88c3('0x3'));var fs=require('fs');var Redis=require(_0x88c3('0x4'));var db=require(_0x88c3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x88c3('0x6'))(_0x88c3('0x7'));var config=require(_0x88c3('0x8'));var jayson=require(_0x88c3('0x9'));var client=jayson[_0x88c3('0xa')][_0x88c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcdbc28,_0x25e385,_0x5020c9){return new BPromise(function(_0x350a11,_0x4efd63){return client[_0x88c3('0xc')](_0xcdbc28,_0x5020c9)['then'](function(_0x760391){logger['info'](_0x88c3('0xd'),_0x25e385,_0x88c3('0xe'));logger[_0x88c3('0xf')](_0x88c3('0x10'),_0x25e385,'request\x20sent',JSON[_0x88c3('0x11')](_0x760391));if(_0x760391[_0x88c3('0x12')]){if(_0x760391[_0x88c3('0x12')]['code']===0x1f4){logger[_0x88c3('0x12')]('ContactItemType,\x20%s,\x20%s',_0x25e385,_0x760391['error'][_0x88c3('0x13')]);return _0x4efd63(_0x760391[_0x88c3('0x12')][_0x88c3('0x13')]);}logger[_0x88c3('0x12')](_0x88c3('0xd'),_0x25e385,_0x760391['error'][_0x88c3('0x13')]);return _0x350a11(_0x760391[_0x88c3('0x12')][_0x88c3('0x13')]);}else{logger[_0x88c3('0x14')]('ContactItemType,\x20%s,\x20%s',_0x25e385,_0x88c3('0xe'));_0x350a11(_0x760391['result'][_0x88c3('0x13')]);}})[_0x88c3('0x15')](function(_0x26019e){logger[_0x88c3('0x12')]('ContactItemType,\x20%s,\x20%s',_0x25e385,_0x26019e);_0x4efd63(_0x26019e);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index a634c93..889d2b4 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd464=['update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create'];(function(_0x4b8156,_0x437af2){var _0x4a819c=function(_0xe21347){while(--_0xe21347){_0x4b8156['push'](_0x4b8156['shift']());}};_0x4a819c(++_0x437af2);}(_0xd464,0xad));var _0x4d46=function(_0x41cf95,_0x19611){_0x41cf95=_0x41cf95-0x0;var _0x1924cf=_0xd464[_0x41cf95];return _0x1924cf;};'use strict';var multer=require(_0x4d46('0x0'));var util=require('util');var path=require(_0x4d46('0x1'));var timeout=require(_0x4d46('0x2'));var express=require(_0x4d46('0x3'));var router=express[_0x4d46('0x4')]();var auth=require(_0x4d46('0x5'));var interaction=require(_0x4d46('0x6'));var config=require(_0x4d46('0x7'));var controller=require('./contactItemType.controller');router[_0x4d46('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4d46('0x9'),auth[_0x4d46('0xa')](),controller[_0x4d46('0xb')]);router[_0x4d46('0xc')]('/',auth[_0x4d46('0xa')](),controller[_0x4d46('0xd')]);router['put'](_0x4d46('0x9'),auth[_0x4d46('0xa')](),controller[_0x4d46('0xe')]);router[_0x4d46('0xf')]('/:id',auth[_0x4d46('0xa')](),controller['destroy']);module[_0x4d46('0x10')]=router; \ No newline at end of file +var _0xb27f=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0xb27f,0x13d));var _0xfb27=function(_0x4f61c8,_0x431d2f){_0x4f61c8=_0x4f61c8-0x0;var _0x14a5d6=_0xb27f[_0x4f61c8];return _0x14a5d6;};'use strict';var multer=require(_0xfb27('0x0'));var util=require(_0xfb27('0x1'));var path=require(_0xfb27('0x2'));var timeout=require(_0xfb27('0x3'));var express=require(_0xfb27('0x4'));var router=express['Router']();var auth=require(_0xfb27('0x5'));var interaction=require(_0xfb27('0x6'));var config=require(_0xfb27('0x7'));var controller=require(_0xfb27('0x8'));router[_0xfb27('0x9')]('/',auth[_0xfb27('0xa')](),controller['index']);router['get'](_0xfb27('0xb'),auth[_0xfb27('0xa')](),controller[_0xfb27('0xc')]);router[_0xfb27('0xd')]('/',auth['isAuthenticated'](),controller[_0xfb27('0xe')]);router[_0xfb27('0xf')](_0xfb27('0xb'),auth[_0xfb27('0xa')](),controller[_0xfb27('0x10')]);router[_0xfb27('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xfb27('0x12')]);module[_0xfb27('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index b9ceb0b..492b5df 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 _0xe685=['STRING','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe685,0x1ed));var _0x5e68=function(_0x721ee1,_0x280b55){_0x721ee1=_0x721ee1-0x0;var _0x353eb4=_0xe685[_0x721ee1];return _0x353eb4;};'use strict';var Sequelize=require('sequelize');module[_0x5e68('0x0')]={'name':{'type':Sequelize[_0x5e68('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x5e68('0x1')]}}; \ No newline at end of file +var _0xafbf=['name','STRING','exports'];(function(_0x2bc664,_0x190d17){var _0x1e417d=function(_0x193336){while(--_0x193336){_0x2bc664['push'](_0x2bc664['shift']());}};_0x1e417d(++_0x190d17);}(_0xafbf,0x65));var _0xfafb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xafbf[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0xfafb('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfafb('0x1')},'description':{'type':Sequelize[_0xfafb('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 9651d0c..30c6a0c 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 _0xdf8e=['to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Dashboard','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','addItem','DashboardItem','getItems','findOne','filter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js'];(function(_0x1508ae,_0x4b9240){var _0x3a76e4=function(_0xd5d249){while(--_0xd5d249){_0x1508ae['push'](_0x1508ae['shift']());}};_0x3a76e4(++_0x4b9240);}(_0xdf8e,0x6c));var _0xedf8=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xdf8e[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xedf8('0x0'));var rimraf=require(_0xedf8('0x1'));var zipdir=require(_0xedf8('0x2'));var jsonpatch=require(_0xedf8('0x3'));var rp=require(_0xedf8('0x4'));var moment=require(_0xedf8('0x5'));var BPromise=require(_0xedf8('0x6'));var Mustache=require(_0xedf8('0x7'));var util=require(_0xedf8('0x8'));var path=require(_0xedf8('0x9'));var sox=require(_0xedf8('0xa'));var csv=require('to-csv');var ejs=require(_0xedf8('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xedf8('0xc'));var crypto=require(_0xedf8('0xd'));var jsforce=require(_0xedf8('0xe'));var deskjs=require(_0xedf8('0xf'));var toCsv=require(_0xedf8('0x10'));var querystring=require(_0xedf8('0x11'));var Papa=require(_0xedf8('0x12'));var Redis=require(_0xedf8('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xedf8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xedf8('0x15'));var logger=require(_0xedf8('0x16'))('api');var utils=require(_0xedf8('0x17'));var config=require(_0xedf8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xedf8('0x19'))['db'];config[_0xedf8('0x1a')]=_[_0xedf8('0x1b')](config['redis'],{'host':_0xedf8('0x1c'),'port':0x18eb});var socket=require(_0xedf8('0x1d'))(new Redis(config[_0xedf8('0x1a')]));require(_0xedf8('0x1e'))[_0xedf8('0x1f')](socket);function respondWithStatusCode(_0x2949d0,_0x1fea27){_0x1fea27=_0x1fea27||0xcc;return function(_0x2c7ad2){if(_0x2c7ad2){return _0x2949d0['sendStatus'](_0x1fea27);}return _0x2949d0[_0xedf8('0x20')](_0x1fea27)['end']();};}function respondWithResult(_0x14a694,_0x8b02b0){_0x8b02b0=_0x8b02b0||0xc8;return function(_0x25fed1){if(_0x25fed1){return _0x14a694['status'](_0x8b02b0)[_0xedf8('0x21')](_0x25fed1);}};}function respondWithFilteredResult(_0x585315,_0x371369){return function(_0x4ab04d){if(_0x4ab04d){var _0x4012fb=_0x4ab04d[_0xedf8('0x22')],_0x5c10da=_0x371369[_0xedf8('0x23')],_0x43b799=_0x371369['offset']+_0x371369[_0xedf8('0x24')],_0x368187;if(_0x43b799>=_0x4012fb){_0x43b799=_0x4012fb;_0x368187=0xc8;}else{_0x368187=0xce;}_0x585315[_0xedf8('0x20')](_0x368187);return _0x585315[_0xedf8('0x25')](_0xedf8('0x26'),_0x5c10da+'-'+_0x43b799+'/'+_0x4012fb)[_0xedf8('0x21')](_0x4ab04d);}return null;};}function patchUpdates(_0x1dcd9c){return function(_0x4338b8){try{jsonpatch[_0xedf8('0x27')](_0x4338b8,_0x1dcd9c,!![]);}catch(_0x595179){return BPromise[_0xedf8('0x28')](_0x595179);}return _0x4338b8[_0xedf8('0x29')]();};}function saveUpdates(_0x47b9b5,_0x2006e7){return function(_0x2a4134){if(_0x2a4134){return _0x2a4134[_0xedf8('0x2a')](_0x47b9b5)[_0xedf8('0x2b')](function(_0x3b5183){return _0x3b5183;});}return null;};}function removeEntity(_0x169e2a,_0x8de2f8){return function(_0x516f1b){if(_0x516f1b){return _0x516f1b[_0xedf8('0x2c')]()[_0xedf8('0x2b')](function(){var _0x318380=_0x516f1b[_0xedf8('0x2d')]({'plain':!![]});var _0x57de44='CustomDashboards';return db[_0xedf8('0x2e')][_0xedf8('0x2c')]({'where':{'type':_0x57de44,'resourceId':_0x318380['id']}})[_0xedf8('0x2b')](function(){return _0x516f1b;});})[_0xedf8('0x2b')](function(){_0x169e2a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd85371,_0x2ef978){return function(_0x308fc4){if(!_0x308fc4){_0xd85371['sendStatus'](0x194);}return _0x308fc4;};}function handleError(_0x47abe9,_0x3c01ed){_0x3c01ed=_0x3c01ed||0x1f4;return function(_0x293e85){logger[_0xedf8('0x2f')](_0x293e85[_0xedf8('0x30')]);if(_0x293e85[_0xedf8('0x31')]){delete _0x293e85[_0xedf8('0x31')];}_0x47abe9['status'](_0x3c01ed)[_0xedf8('0x32')](_0x293e85);};}exports[_0xedf8('0x33')]=function(_0x3ce95a,_0x29e473){var _0x406e4b={},_0x451d2d={},_0x52c586={'count':0x0,'rows':[]};var _0x24f745=_[_0xedf8('0x34')](db[_0xedf8('0x35')]['rawAttributes'],function(_0x1b5a66){return{'name':_0x1b5a66[_0xedf8('0x36')],'type':_0x1b5a66['type'][_0xedf8('0x37')]};});_0x451d2d['model']=_[_0xedf8('0x34')](_0x24f745,_0xedf8('0x31'));_0x451d2d[_0xedf8('0x38')]=_[_0xedf8('0x39')](_0x3ce95a[_0xedf8('0x38')]);_0x451d2d[_0xedf8('0x3a')]=_[_0xedf8('0x3b')](_0x451d2d['model'],_0x451d2d[_0xedf8('0x38')]);_0x406e4b[_0xedf8('0x3c')]=_[_0xedf8('0x3b')](_0x451d2d[_0xedf8('0x3d')],qs['fields'](_0x3ce95a[_0xedf8('0x38')][_0xedf8('0x3e')]));_0x406e4b[_0xedf8('0x3c')]=_0x406e4b[_0xedf8('0x3c')][_0xedf8('0x3f')]?_0x406e4b[_0xedf8('0x3c')]:_0x451d2d[_0xedf8('0x3d')];if(!_0x3ce95a[_0xedf8('0x38')][_0xedf8('0x40')](_0xedf8('0x41'))){_0x406e4b[_0xedf8('0x24')]=qs[_0xedf8('0x24')](_0x3ce95a[_0xedf8('0x38')][_0xedf8('0x24')]);_0x406e4b[_0xedf8('0x23')]=qs[_0xedf8('0x23')](_0x3ce95a[_0xedf8('0x38')][_0xedf8('0x23')]);}_0x406e4b[_0xedf8('0x42')]=qs[_0xedf8('0x43')](_0x3ce95a[_0xedf8('0x38')][_0xedf8('0x43')]);_0x406e4b[_0xedf8('0x44')]=qs[_0xedf8('0x3a')](_[_0xedf8('0x45')](_0x3ce95a[_0xedf8('0x38')],_0x451d2d[_0xedf8('0x3a')]),_0x24f745);if(_0x3ce95a[_0xedf8('0x38')]['filter']){_0x406e4b['where']=_['merge'](_0x406e4b[_0xedf8('0x44')],{'$or':_['map'](_0x24f745,function(_0x21f8c3){if(_0x21f8c3[_0xedf8('0x46')]!==_0xedf8('0x47')){var _0x28a893={};_0x28a893[_0x21f8c3[_0xedf8('0x31')]]={'$like':'%'+_0x3ce95a[_0xedf8('0x38')]['filter']+'%'};return _0x28a893;}})});}_0x406e4b=_['merge']({},_0x406e4b,_0x3ce95a[_0xedf8('0x48')]);var _0x23d936={'where':_0x406e4b[_0xedf8('0x44')]};return db['Dashboard'][_0xedf8('0x22')](_0x23d936)[_0xedf8('0x2b')](function(_0x5568a9){_0x52c586['count']=_0x5568a9;if(_0x3ce95a[_0xedf8('0x38')][_0xedf8('0x49')]){_0x406e4b['include']=[{'all':!![]}];}return db[_0xedf8('0x35')][_0xedf8('0x4a')](_0x406e4b);})['then'](function(_0x58dbeb){_0x52c586[_0xedf8('0x4b')]=_0x58dbeb;return _0x52c586;})[_0xedf8('0x2b')](respondWithFilteredResult(_0x29e473,_0x406e4b))[_0xedf8('0x4c')](handleError(_0x29e473,null));};exports[_0xedf8('0x4d')]=function(_0x2e6594,_0x2d0982){var _0x5f0eca={'raw':![],'where':{'id':_0x2e6594[_0xedf8('0x4e')]['id']}},_0x5ef852={};_0x5ef852[_0xedf8('0x3d')]=_['keys'](db['Dashboard'][_0xedf8('0x4f')]);_0x5ef852[_0xedf8('0x38')]=_[_0xedf8('0x39')](_0x2e6594['query']);_0x5ef852[_0xedf8('0x3a')]=_[_0xedf8('0x3b')](_0x5ef852[_0xedf8('0x3d')],_0x5ef852[_0xedf8('0x38')]);_0x5f0eca[_0xedf8('0x3c')]=_['intersection'](_0x5ef852[_0xedf8('0x3d')],qs[_0xedf8('0x3e')](_0x2e6594['query'][_0xedf8('0x3e')]));_0x5f0eca['attributes']=_0x5f0eca[_0xedf8('0x3c')]['length']?_0x5f0eca[_0xedf8('0x3c')]:_0x5ef852[_0xedf8('0x3d')];if(_0x2e6594[_0xedf8('0x38')]['includeAll']){_0x5f0eca['include']=[{'all':!![]}];}_0x5f0eca=_[_0xedf8('0x50')]({},_0x5f0eca,_0x2e6594['options']);return db[_0xedf8('0x35')][_0xedf8('0x51')](_0x5f0eca)[_0xedf8('0x2b')](handleEntityNotFound(_0x2d0982,null))['then'](respondWithResult(_0x2d0982,null))[_0xedf8('0x4c')](handleError(_0x2d0982,null));};exports[_0xedf8('0x52')]=function(_0x162b60,_0x3169dd){return db[_0xedf8('0x35')][_0xedf8('0x52')](_0x162b60[_0xedf8('0x53')],{})[_0xedf8('0x2b')](function(_0x45b10e){var _0x10156a=_0x162b60[_0xedf8('0x54')][_0xedf8('0x2d')]({'plain':!![]});if(!_0x10156a)throw new Error(_0xedf8('0x55'));if(_0x10156a[_0xedf8('0x56')]===_0xedf8('0x54')){var _0x31b86c=_0x45b10e[_0xedf8('0x2d')]({'plain':!![]});var _0xc13877=_0xedf8('0x57');return db['UserProfileSection'][_0xedf8('0x51')]({'where':{'name':_0xc13877,'userProfileId':_0x10156a['userProfileId']},'raw':!![]})['then'](function(_0x1859f6){if(_0x1859f6&&_0x1859f6['autoAssociation']===0x0){return db[_0xedf8('0x2e')][_0xedf8('0x52')]({'name':_0x31b86c[_0xedf8('0x31')],'resourceId':_0x31b86c['id'],'type':_0x1859f6[_0xedf8('0x31')],'sectionId':_0x1859f6['id']},{})['then'](function(){return _0x45b10e;});}else{return _0x45b10e;}})[_0xedf8('0x4c')](function(_0x3f3575){logger[_0xedf8('0x2f')](_0xedf8('0x58'),_0x3f3575);throw _0x3f3575;});}return _0x45b10e;})[_0xedf8('0x2b')](respondWithResult(_0x3169dd,0xc9))[_0xedf8('0x4c')](handleError(_0x3169dd,null));};exports[_0xedf8('0x59')]=function(_0x358528,_0x335752){var _0x9441bd={'where':{'id':_0x358528[_0xedf8('0x4e')]['id']}},_0x5affa4={};_0x5affa4[_0xedf8('0x3d')]=_[_0xedf8('0x39')](db[_0xedf8('0x35')][_0xedf8('0x4f')]);_0x9441bd[_0xedf8('0x3c')]=_[_0xedf8('0x3b')](_0x5affa4[_0xedf8('0x3d')],qs[_0xedf8('0x3e')](_0x358528['query'][_0xedf8('0x3e')]));_0x9441bd[_0xedf8('0x3c')]=_0x9441bd[_0xedf8('0x3c')]['length']?_0x9441bd[_0xedf8('0x3c')]:_0x5affa4[_0xedf8('0x3d')];if(_0x358528[_0xedf8('0x38')][_0xedf8('0x49')]){_0x9441bd[_0xedf8('0x5a')]=[{'all':!![]}];}_0x9441bd=_[_0xedf8('0x50')]({},_0x9441bd,_0x358528['options']);return db['Dashboard'][_0xedf8('0x51')](_0x9441bd)[_0xedf8('0x2b')](handleEntityNotFound(_0x335752,null))[_0xedf8('0x2b')](function(_0x45dd26){if(_0x45dd26){var _0x117145=_0x45dd26[_0xedf8('0x2d')]({'plain':!![]});_0x117145=qs[_0xedf8('0x5b')](_0x117145,['id',_0xedf8('0x5c'),'updatedAt']);_0x358528[_0xedf8('0x53')]=_[_0xedf8('0x5b')](_0x358528[_0xedf8('0x53')],['id',_0xedf8('0x5c'),_0xedf8('0x5d')]);return db[_0xedf8('0x35')][_0xedf8('0x52')](_[_0xedf8('0x50')](_0x117145,_0x358528[_0xedf8('0x53')]),{'include':_0x358528[_0xedf8('0x38')][_0xedf8('0x49')]?[{'all':!![]}]:undefined})[_0xedf8('0x2b')](function(_0x23643c){var _0x2b447d=_0x358528[_0xedf8('0x54')]['get']({'plain':!![]});if(!_0x2b447d)throw new Error(_0xedf8('0x55'));if(_0x2b447d[_0xedf8('0x56')]==='user'){var _0x15d88c=_0x23643c[_0xedf8('0x2d')]({'plain':!![]});var _0x14f6c3='CustomDashboards';return db['UserProfileSection'][_0xedf8('0x51')]({'where':{'name':_0x14f6c3,'userProfileId':_0x2b447d['userProfileId']},'raw':!![]})['then'](function(_0x1f84f6){if(_0x1f84f6&&_0x1f84f6['autoAssociation']===0x0){return db[_0xedf8('0x2e')][_0xedf8('0x52')]({'name':_0x15d88c[_0xedf8('0x31')],'resourceId':_0x15d88c['id'],'type':_0x1f84f6[_0xedf8('0x31')],'sectionId':_0x1f84f6['id']},{})['then'](function(){return _0x23643c;});}else{return _0x23643c;}})['catch'](function(_0x491fc2){logger[_0xedf8('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x491fc2);throw _0x491fc2;});}return _0x23643c;});}})[_0xedf8('0x2b')](respondWithResult(_0x335752,0xc9))['catch'](handleError(_0x335752,null));};exports[_0xedf8('0x2a')]=function(_0x12a4cf,_0x53d68c){if(_0x12a4cf['body']['id']){delete _0x12a4cf['body']['id'];}return db['Dashboard'][_0xedf8('0x51')]({'where':{'id':_0x12a4cf[_0xedf8('0x4e')]['id']}})[_0xedf8('0x2b')](handleEntityNotFound(_0x53d68c,null))[_0xedf8('0x2b')](saveUpdates(_0x12a4cf[_0xedf8('0x53')],null))[_0xedf8('0x2b')](respondWithResult(_0x53d68c,null))[_0xedf8('0x4c')](handleError(_0x53d68c,null));};exports[_0xedf8('0x2c')]=function(_0x34e050,_0x83a5da){return db[_0xedf8('0x35')]['find']({'where':{'id':_0x34e050[_0xedf8('0x4e')]['id']}})['then'](handleEntityNotFound(_0x83a5da,null))[_0xedf8('0x2b')](removeEntity(_0x83a5da,null))['catch'](handleError(_0x83a5da,null));};function widgetAttributes(_0x36741a){try{switch(_0x36741a[_0xedf8('0x46')]){case _0xedf8('0x5e'):return[{'name':_0xedf8('0x5f'),'value':_0x36741a[_0xedf8('0x5f')]||(_0x36741a[_0xedf8('0x60')]&&_0x36741a[_0xedf8('0x60')][0x0]?_0x36741a['attrs'][0x0][_0xedf8('0x61')]:undefined)||_0xedf8('0x62')}];case _0xedf8('0x63'):return[{'name':'attrPath','value':_0x36741a[_0xedf8('0x64')]||(_0x36741a[_0xedf8('0x60')]&&_0x36741a['attrs'][0x0]?_0x36741a[_0xedf8('0x60')][0x0][_0xedf8('0x61')]:undefined)||''}];case _0xedf8('0x65'):return[{'name':_0xedf8('0x66'),'value':_0x36741a[_0xedf8('0x66')]||(_0x36741a[_0xedf8('0x60')]&&_0x36741a[_0xedf8('0x60')][0x0]?_0x36741a['attrs'][0x0][_0xedf8('0x61')]:undefined)||_0xedf8('0x67')},{'name':_0xedf8('0x68'),'value':_0x36741a[_0xedf8('0x68')]||(_0x36741a[_0xedf8('0x60')]&&_0x36741a['attrs'][0x1]?_0x36741a['attrs'][0x1][_0xedf8('0x61')]:undefined)||_0xedf8('0x69')},{'name':_0xedf8('0x6a'),'value':_0x36741a[_0xedf8('0x6a')]||(_0x36741a['attrs']&&_0x36741a[_0xedf8('0x60')][0x2]?_0x36741a[_0xedf8('0x60')][0x2][_0xedf8('0x61')]:undefined)||0xc}];case _0xedf8('0x6b'):return[{'name':'attrMetric','value':_0x36741a[_0xedf8('0x6c')]||(_0x36741a['attrs']&&_0x36741a[_0xedf8('0x60')][0x0]?_0x36741a[_0xedf8('0x60')][0x0][_0xedf8('0x61')]:undefined)||'total'},{'name':_0xedf8('0x6d'),'value':_0x36741a[_0xedf8('0x6d')]||(_0x36741a[_0xedf8('0x60')]&&_0x36741a['attrs'][0x1]?_0x36741a[_0xedf8('0x60')][0x1][_0xedf8('0x61')]:undefined)||[]},{'name':'attrFontSize','value':_0x36741a[_0xedf8('0x6a')]||(_0x36741a[_0xedf8('0x60')]&&_0x36741a[_0xedf8('0x60')][0x2]?_0x36741a['attrs'][0x2]['value']:undefined)||0x14}];case _0xedf8('0x6e'):case _0xedf8('0x6f'):return[{'name':_0xedf8('0x70'),'value':_0x36741a[_0xedf8('0x70')]||(_0x36741a['attrs']&&_0x36741a[_0xedf8('0x60')][0x0]?_0x36741a[_0xedf8('0x60')][0x0][_0xedf8('0x61')]:undefined)||_0xedf8('0x71')},{'name':_0xedf8('0x72'),'value':_0x36741a[_0xedf8('0x72')]||(_0x36741a[_0xedf8('0x60')]&&_0x36741a[_0xedf8('0x60')][0x1]?_0x36741a[_0xedf8('0x60')][0x1][_0xedf8('0x61')]:undefined)||null},{'name':_0xedf8('0x73'),'value':_0x36741a[_0xedf8('0x73')]||(_0x36741a[_0xedf8('0x60')]&&_0x36741a[_0xedf8('0x60')][0x2]?_0x36741a[_0xedf8('0x60')][0x2][_0xedf8('0x61')]:undefined)||null},{'name':_0xedf8('0x6d'),'value':_0x36741a[_0xedf8('0x6d')]||(_0x36741a[_0xedf8('0x60')]&&_0x36741a['attrs'][0x3]?_0x36741a[_0xedf8('0x60')][0x3][_0xedf8('0x61')]:undefined)||[]}];case'web-report':return[{'name':_0xedf8('0x74'),'type':_0x36741a[_0xedf8('0x75')]||(_0x36741a[_0xedf8('0x60')]&&_0x36741a[_0xedf8('0x60')][0x0]?_0x36741a[_0xedf8('0x60')][0x0][_0xedf8('0x46')]:undefined)||null,'value':_0x36741a['attrReport']||(_0x36741a[_0xedf8('0x60')]&&_0x36741a[_0xedf8('0x60')][0x0]?_0x36741a['attrs'][0x0][_0xedf8('0x61')]:undefined)||null},{'name':_0xedf8('0x76'),'value':_0x36741a[_0xedf8('0x76')]||(_0x36741a[_0xedf8('0x60')]&&_0x36741a[_0xedf8('0x60')][0x1]?_0x36741a[_0xedf8('0x60')][0x1][_0xedf8('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x58e431){logger[_0xedf8('0x2f')]('widgetAttributes:\x20%s',JSON['stringify'](_0x58e431));return[];}}exports[_0xedf8('0x77')]=function(_0x7fd98e,_0x22e2b6,_0x170230){if(_0x7fd98e[_0xedf8('0x53')]['id']){delete _0x7fd98e['body']['id'];}return db[_0xedf8('0x35')][_0xedf8('0x51')]({'where':{'id':_0x7fd98e[_0xedf8('0x4e')]['id']}})[_0xedf8('0x2b')](handleEntityNotFound(_0x22e2b6,null))[_0xedf8('0x2b')](function(_0x5bf41e){if(_0x5bf41e){_0x7fd98e[_0xedf8('0x53')]['DashboardId']=_0x5bf41e['id'];_0x7fd98e[_0xedf8('0x53')][_0xedf8('0x60')]=widgetAttributes(_0x7fd98e[_0xedf8('0x53')]);return db[_0xedf8('0x78')][_0xedf8('0x52')](_0x7fd98e[_0xedf8('0x53')]);}})[_0xedf8('0x2b')](respondWithResult(_0x22e2b6,null))[_0xedf8('0x4c')](handleError(_0x22e2b6,null));};exports[_0xedf8('0x79')]=function(_0x3f5eca,_0xb4d513,_0x7b4bc6){var _0x22ae7f={};var _0x4be80a={};var _0x2813fd;var _0x28f942;return db[_0xedf8('0x35')][_0xedf8('0x7a')]({'where':{'id':_0x3f5eca[_0xedf8('0x4e')]['id']}})['then'](handleEntityNotFound(_0xb4d513,null))[_0xedf8('0x2b')](function(_0xe98b3f){if(_0xe98b3f){_0x2813fd=_0xe98b3f;_0x4be80a[_0xedf8('0x3d')]=_[_0xedf8('0x39')](db['DashboardItem'][_0xedf8('0x4f')]);_0x4be80a['query']=_['keys'](_0x3f5eca['query']);_0x4be80a[_0xedf8('0x3a')]=_[_0xedf8('0x3b')](_0x4be80a[_0xedf8('0x3d')],_0x4be80a[_0xedf8('0x38')]);_0x22ae7f[_0xedf8('0x3c')]=_[_0xedf8('0x3b')](_0x4be80a[_0xedf8('0x3d')],qs[_0xedf8('0x3e')](_0x3f5eca['query'][_0xedf8('0x3e')]));_0x22ae7f[_0xedf8('0x3c')]=_0x22ae7f[_0xedf8('0x3c')][_0xedf8('0x3f')]?_0x22ae7f[_0xedf8('0x3c')]:_0x4be80a['model'];_0x22ae7f['order']=qs[_0xedf8('0x43')](_0x3f5eca['query'][_0xedf8('0x43')]);_0x22ae7f[_0xedf8('0x44')]=qs[_0xedf8('0x3a')](_[_0xedf8('0x45')](_0x3f5eca[_0xedf8('0x38')],_0x4be80a[_0xedf8('0x3a')]));if(_0x3f5eca['query'][_0xedf8('0x7b')]){_0x22ae7f[_0xedf8('0x44')]=_[_0xedf8('0x50')](_0x22ae7f[_0xedf8('0x44')],{'$or':_[_0xedf8('0x34')](_0x22ae7f[_0xedf8('0x3c')],function(_0x163cfe){var _0x3cb5de={};_0x3cb5de[_0x163cfe]={'$like':'%'+_0x3f5eca['query']['filter']+'%'};return _0x3cb5de;})});}_0x22ae7f=_[_0xedf8('0x50')]({},_0x22ae7f,_0x3f5eca[_0xedf8('0x48')]);return _0x2813fd['getItems'](_0x22ae7f);}})[_0xedf8('0x2b')](function(_0x4b9866){if(_0x4b9866){_0x28f942=_0x4b9866[_0xedf8('0x3f')];if(!_0x3f5eca[_0xedf8('0x38')][_0xedf8('0x40')](_0xedf8('0x41'))){_0x22ae7f[_0xedf8('0x24')]=qs[_0xedf8('0x24')](_0x3f5eca[_0xedf8('0x38')][_0xedf8('0x24')]);_0x22ae7f[_0xedf8('0x23')]=qs[_0xedf8('0x23')](_0x3f5eca['query'][_0xedf8('0x23')]);}return _0x2813fd['getItems'](_0x22ae7f);}})[_0xedf8('0x2b')](function(_0x446fdf){if(_0x446fdf){return _0x446fdf?{'count':_0x28f942,'rows':_0x446fdf}:null;}})['then'](respondWithResult(_0xb4d513,null))[_0xedf8('0x4c')](handleError(_0xb4d513,null));}; \ No newline at end of file +var _0x81f9=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','CustomDashboards','UserProfileResource','stack','name','send','index','map','Dashboard','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','length','omit','createdAt','updatedAt','body','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','findOne','order','pick','getItems','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','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'];(function(_0x18d5d7,_0x19074b){var _0x30a9ea=function(_0x514f3f){while(--_0x514f3f){_0x18d5d7['push'](_0x18d5d7['shift']());}};_0x30a9ea(++_0x19074b);}(_0x81f9,0x1e8));var _0x981f=function(_0x396aba,_0x3ef523){_0x396aba=_0x396aba-0x0;var _0x74213e=_0x81f9[_0x396aba];return _0x74213e;};'use strict';var pdf=require(_0x981f('0x0'));var emlformat=require(_0x981f('0x1'));var rimraf=require(_0x981f('0x2'));var zipdir=require(_0x981f('0x3'));var jsonpatch=require(_0x981f('0x4'));var rp=require(_0x981f('0x5'));var moment=require('moment');var BPromise=require(_0x981f('0x6'));var Mustache=require(_0x981f('0x7'));var util=require('util');var path=require(_0x981f('0x8'));var sox=require(_0x981f('0x9'));var csv=require(_0x981f('0xa'));var ejs=require(_0x981f('0xb'));var fs=require('fs');var _=require(_0x981f('0xc'));var squel=require(_0x981f('0xd'));var crypto=require(_0x981f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x981f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x981f('0x10'));var Papa=require(_0x981f('0x11'));var Redis=require(_0x981f('0x12'));var authService=require(_0x981f('0x13'));var qs=require(_0x981f('0x14'));var as=require(_0x981f('0x15'));var hardwareService=require(_0x981f('0x16'));var logger=require(_0x981f('0x17'))(_0x981f('0x18'));var utils=require(_0x981f('0x19'));var config=require(_0x981f('0x1a'));var licenseUtil=require(_0x981f('0x1b'));var db=require(_0x981f('0x1c'))['db'];config[_0x981f('0x1d')]=_[_0x981f('0x1e')](config[_0x981f('0x1d')],{'host':_0x981f('0x1f'),'port':0x18eb});var socket=require(_0x981f('0x20'))(new Redis(config['redis']));require('./dashboard.socket')[_0x981f('0x21')](socket);function respondWithStatusCode(_0xb4fbcb,_0xc526bd){_0xc526bd=_0xc526bd||0xcc;return function(_0x50da4f){if(_0x50da4f){return _0xb4fbcb[_0x981f('0x22')](_0xc526bd);}return _0xb4fbcb[_0x981f('0x23')](_0xc526bd)[_0x981f('0x24')]();};}function respondWithResult(_0x3aa4fc,_0x3fa9f3){_0x3fa9f3=_0x3fa9f3||0xc8;return function(_0x55a5d7){if(_0x55a5d7){return _0x3aa4fc[_0x981f('0x23')](_0x3fa9f3)[_0x981f('0x25')](_0x55a5d7);}};}function respondWithFilteredResult(_0x564fc6,_0x4ca01f){return function(_0x1ee9a6){if(_0x1ee9a6){var _0x3091ec=_0x1ee9a6[_0x981f('0x26')],_0x55fed9=_0x4ca01f[_0x981f('0x27')],_0x2a908d=_0x4ca01f['offset']+_0x4ca01f['limit'],_0x2f711e;if(_0x2a908d>=_0x3091ec){_0x2a908d=_0x3091ec;_0x2f711e=0xc8;}else{_0x2f711e=0xce;}_0x564fc6[_0x981f('0x23')](_0x2f711e);return _0x564fc6[_0x981f('0x28')](_0x981f('0x29'),_0x55fed9+'-'+_0x2a908d+'/'+_0x3091ec)['json'](_0x1ee9a6);}return null;};}function patchUpdates(_0x206d38){return function(_0x4ccd3e){try{jsonpatch[_0x981f('0x2a')](_0x4ccd3e,_0x206d38,!![]);}catch(_0x591f55){return BPromise[_0x981f('0x2b')](_0x591f55);}return _0x4ccd3e[_0x981f('0x2c')]();};}function saveUpdates(_0x2f09e1,_0x225287){return function(_0x197ca2){if(_0x197ca2){return _0x197ca2[_0x981f('0x2d')](_0x2f09e1)['then'](function(_0x2ee347){return _0x2ee347;});}return null;};}function removeEntity(_0x3a9ded,_0x64c106){return function(_0x39d92c){if(_0x39d92c){return _0x39d92c[_0x981f('0x2e')]()[_0x981f('0x2f')](function(){var _0x2593c6=_0x39d92c['get']({'plain':!![]});var _0x55862b=_0x981f('0x30');return db[_0x981f('0x31')][_0x981f('0x2e')]({'where':{'type':_0x55862b,'resourceId':_0x2593c6['id']}})['then'](function(){return _0x39d92c;});})[_0x981f('0x2f')](function(){_0x3a9ded['status'](0xcc)[_0x981f('0x24')]();});}};}function handleEntityNotFound(_0x3c64e8,_0x3c3aa8){return function(_0x3cf3f2){if(!_0x3cf3f2){_0x3c64e8[_0x981f('0x22')](0x194);}return _0x3cf3f2;};}function handleError(_0x4dbc49,_0x1573b8){_0x1573b8=_0x1573b8||0x1f4;return function(_0x57d506){logger['error'](_0x57d506[_0x981f('0x32')]);if(_0x57d506[_0x981f('0x33')]){delete _0x57d506['name'];}_0x4dbc49[_0x981f('0x23')](_0x1573b8)[_0x981f('0x34')](_0x57d506);};}exports[_0x981f('0x35')]=function(_0x58ed39,_0x501fae){var _0x20db58={},_0x250f0c={},_0x564eaa={'count':0x0,'rows':[]};var _0x542d40=_[_0x981f('0x36')](db[_0x981f('0x37')]['rawAttributes'],function(_0x412378){return{'name':_0x412378['fieldName'],'type':_0x412378['type'][_0x981f('0x38')]};});_0x250f0c[_0x981f('0x39')]=_[_0x981f('0x36')](_0x542d40,_0x981f('0x33'));_0x250f0c['query']=_[_0x981f('0x3a')](_0x58ed39[_0x981f('0x3b')]);_0x250f0c[_0x981f('0x3c')]=_[_0x981f('0x3d')](_0x250f0c[_0x981f('0x39')],_0x250f0c[_0x981f('0x3b')]);_0x20db58[_0x981f('0x3e')]=_['intersection'](_0x250f0c['model'],qs[_0x981f('0x3f')](_0x58ed39[_0x981f('0x3b')]['fields']));_0x20db58['attributes']=_0x20db58[_0x981f('0x3e')]['length']?_0x20db58[_0x981f('0x3e')]:_0x250f0c[_0x981f('0x39')];if(!_0x58ed39[_0x981f('0x3b')][_0x981f('0x40')]('nolimit')){_0x20db58[_0x981f('0x41')]=qs[_0x981f('0x41')](_0x58ed39[_0x981f('0x3b')][_0x981f('0x41')]);_0x20db58[_0x981f('0x27')]=qs['offset'](_0x58ed39['query'][_0x981f('0x27')]);}_0x20db58['order']=qs[_0x981f('0x42')](_0x58ed39[_0x981f('0x3b')][_0x981f('0x42')]);_0x20db58['where']=qs[_0x981f('0x3c')](_['pick'](_0x58ed39[_0x981f('0x3b')],_0x250f0c[_0x981f('0x3c')]),_0x542d40);if(_0x58ed39['query'][_0x981f('0x43')]){_0x20db58[_0x981f('0x44')]=_[_0x981f('0x45')](_0x20db58[_0x981f('0x44')],{'$or':_[_0x981f('0x36')](_0x542d40,function(_0x513dd5){if(_0x513dd5['type']!==_0x981f('0x46')){var _0x529e14={};_0x529e14[_0x513dd5[_0x981f('0x33')]]={'$like':'%'+_0x58ed39[_0x981f('0x3b')][_0x981f('0x43')]+'%'};return _0x529e14;}})});}_0x20db58=_[_0x981f('0x45')]({},_0x20db58,_0x58ed39[_0x981f('0x47')]);var _0x1be7be={'where':_0x20db58[_0x981f('0x44')]};return db['Dashboard'][_0x981f('0x26')](_0x1be7be)[_0x981f('0x2f')](function(_0x57c62a){_0x564eaa[_0x981f('0x26')]=_0x57c62a;if(_0x58ed39['query'][_0x981f('0x48')]){_0x20db58[_0x981f('0x49')]=[{'all':!![]}];}return db[_0x981f('0x37')][_0x981f('0x4a')](_0x20db58);})[_0x981f('0x2f')](function(_0x58cb12){_0x564eaa[_0x981f('0x4b')]=_0x58cb12;return _0x564eaa;})['then'](respondWithFilteredResult(_0x501fae,_0x20db58))[_0x981f('0x4c')](handleError(_0x501fae,null));};exports[_0x981f('0x4d')]=function(_0x43a180,_0x3fef4d){var _0x3a1aa6={'raw':![],'where':{'id':_0x43a180[_0x981f('0x4e')]['id']}},_0x182c7f={};_0x182c7f[_0x981f('0x39')]=_[_0x981f('0x3a')](db['Dashboard']['rawAttributes']);_0x182c7f[_0x981f('0x3b')]=_[_0x981f('0x3a')](_0x43a180[_0x981f('0x3b')]);_0x182c7f[_0x981f('0x3c')]=_[_0x981f('0x3d')](_0x182c7f['model'],_0x182c7f[_0x981f('0x3b')]);_0x3a1aa6[_0x981f('0x3e')]=_[_0x981f('0x3d')](_0x182c7f[_0x981f('0x39')],qs[_0x981f('0x3f')](_0x43a180[_0x981f('0x3b')][_0x981f('0x3f')]));_0x3a1aa6['attributes']=_0x3a1aa6[_0x981f('0x3e')]['length']?_0x3a1aa6[_0x981f('0x3e')]:_0x182c7f[_0x981f('0x39')];if(_0x43a180[_0x981f('0x3b')][_0x981f('0x48')]){_0x3a1aa6[_0x981f('0x49')]=[{'all':!![]}];}_0x3a1aa6=_[_0x981f('0x45')]({},_0x3a1aa6,_0x43a180['options']);return db[_0x981f('0x37')][_0x981f('0x4f')](_0x3a1aa6)[_0x981f('0x2f')](handleEntityNotFound(_0x3fef4d,null))[_0x981f('0x2f')](respondWithResult(_0x3fef4d,null))[_0x981f('0x4c')](handleError(_0x3fef4d,null));};exports[_0x981f('0x50')]=function(_0x5096cf,_0x33ab2b){return db[_0x981f('0x37')][_0x981f('0x50')](_0x5096cf['body'],{})[_0x981f('0x2f')](function(_0x43dbf6){var _0x3f13d8=_0x5096cf[_0x981f('0x51')][_0x981f('0x52')]({'plain':!![]});if(!_0x3f13d8)throw new Error(_0x981f('0x53'));if(_0x3f13d8[_0x981f('0x54')]==='user'){var _0x40a461=_0x43dbf6[_0x981f('0x52')]({'plain':!![]});var _0x242364=_0x981f('0x30');return db[_0x981f('0x55')][_0x981f('0x4f')]({'where':{'name':_0x242364,'userProfileId':_0x3f13d8['userProfileId']},'raw':!![]})[_0x981f('0x2f')](function(_0x1c0a2b){if(_0x1c0a2b&&_0x1c0a2b[_0x981f('0x56')]===0x0){return db['UserProfileResource'][_0x981f('0x50')]({'name':_0x40a461['name'],'resourceId':_0x40a461['id'],'type':_0x1c0a2b[_0x981f('0x33')],'sectionId':_0x1c0a2b['id']},{})[_0x981f('0x2f')](function(){return _0x43dbf6;});}else{return _0x43dbf6;}})[_0x981f('0x4c')](function(_0x311b63){logger['error'](_0x981f('0x57'),_0x311b63);throw _0x311b63;});}return _0x43dbf6;})[_0x981f('0x2f')](respondWithResult(_0x33ab2b,0xc9))[_0x981f('0x4c')](handleError(_0x33ab2b,null));};exports[_0x981f('0x58')]=function(_0x7c6b,_0x30ed81){var _0xc52fd8={'where':{'id':_0x7c6b[_0x981f('0x4e')]['id']}},_0x3407dd={};_0x3407dd[_0x981f('0x39')]=_['keys'](db[_0x981f('0x37')][_0x981f('0x59')]);_0xc52fd8['attributes']=_[_0x981f('0x3d')](_0x3407dd[_0x981f('0x39')],qs[_0x981f('0x3f')](_0x7c6b[_0x981f('0x3b')][_0x981f('0x3f')]));_0xc52fd8['attributes']=_0xc52fd8['attributes'][_0x981f('0x5a')]?_0xc52fd8[_0x981f('0x3e')]:_0x3407dd['model'];if(_0x7c6b[_0x981f('0x3b')][_0x981f('0x48')]){_0xc52fd8['include']=[{'all':!![]}];}_0xc52fd8=_['merge']({},_0xc52fd8,_0x7c6b[_0x981f('0x47')]);return db[_0x981f('0x37')][_0x981f('0x4f')](_0xc52fd8)[_0x981f('0x2f')](handleEntityNotFound(_0x30ed81,null))['then'](function(_0xdf5faf){if(_0xdf5faf){var _0x28ff0e=_0xdf5faf[_0x981f('0x52')]({'plain':!![]});_0x28ff0e=qs[_0x981f('0x5b')](_0x28ff0e,['id',_0x981f('0x5c'),_0x981f('0x5d')]);_0x7c6b[_0x981f('0x5e')]=_[_0x981f('0x5b')](_0x7c6b['body'],['id',_0x981f('0x5c'),_0x981f('0x5d')]);return db['Dashboard'][_0x981f('0x50')](_[_0x981f('0x45')](_0x28ff0e,_0x7c6b['body']),{'include':_0x7c6b[_0x981f('0x3b')][_0x981f('0x48')]?[{'all':!![]}]:undefined})[_0x981f('0x2f')](function(_0x251650){var _0xcaa834=_0x7c6b[_0x981f('0x51')][_0x981f('0x52')]({'plain':!![]});if(!_0xcaa834)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcaa834[_0x981f('0x54')]===_0x981f('0x51')){var _0x36030a=_0x251650[_0x981f('0x52')]({'plain':!![]});var _0x50da00='CustomDashboards';return db[_0x981f('0x55')][_0x981f('0x4f')]({'where':{'name':_0x50da00,'userProfileId':_0xcaa834['userProfileId']},'raw':!![]})[_0x981f('0x2f')](function(_0x5778f9){if(_0x5778f9&&_0x5778f9[_0x981f('0x56')]===0x0){return db[_0x981f('0x31')][_0x981f('0x50')]({'name':_0x36030a['name'],'resourceId':_0x36030a['id'],'type':_0x5778f9[_0x981f('0x33')],'sectionId':_0x5778f9['id']},{})[_0x981f('0x2f')](function(){return _0x251650;});}else{return _0x251650;}})[_0x981f('0x4c')](function(_0x1b784a){logger['error'](_0x981f('0x57'),_0x1b784a);throw _0x1b784a;});}return _0x251650;});}})['then'](respondWithResult(_0x30ed81,0xc9))[_0x981f('0x4c')](handleError(_0x30ed81,null));};exports[_0x981f('0x2d')]=function(_0x462c25,_0xd2966a){if(_0x462c25['body']['id']){delete _0x462c25[_0x981f('0x5e')]['id'];}return db[_0x981f('0x37')][_0x981f('0x4f')]({'where':{'id':_0x462c25[_0x981f('0x4e')]['id']}})['then'](handleEntityNotFound(_0xd2966a,null))[_0x981f('0x2f')](saveUpdates(_0x462c25[_0x981f('0x5e')],null))[_0x981f('0x2f')](respondWithResult(_0xd2966a,null))[_0x981f('0x4c')](handleError(_0xd2966a,null));};exports[_0x981f('0x2e')]=function(_0x43ff4c,_0x366321){return db[_0x981f('0x37')][_0x981f('0x4f')]({'where':{'id':_0x43ff4c[_0x981f('0x4e')]['id']}})[_0x981f('0x2f')](handleEntityNotFound(_0x366321,null))['then'](removeEntity(_0x366321,null))[_0x981f('0x4c')](handleError(_0x366321,null));};function widgetAttributes(_0x4b68fd){try{switch(_0x4b68fd[_0x981f('0x5f')]){case'iframe':return[{'name':_0x981f('0x60'),'value':_0x4b68fd[_0x981f('0x60')]||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd['attrs'][0x0]?_0x4b68fd[_0x981f('0x61')][0x0][_0x981f('0x62')]:undefined)||_0x981f('0x63')}];case _0x981f('0x64'):return[{'name':'attrPath','value':_0x4b68fd[_0x981f('0x65')]||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd[_0x981f('0x61')][0x0]?_0x4b68fd[_0x981f('0x61')][0x0][_0x981f('0x62')]:undefined)||''}];case _0x981f('0x66'):return[{'name':_0x981f('0x67'),'value':_0x4b68fd['attrHourFormat']||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd[_0x981f('0x61')][0x0]?_0x4b68fd[_0x981f('0x61')][0x0][_0x981f('0x62')]:undefined)||_0x981f('0x68')},{'name':_0x981f('0x69'),'value':_0x4b68fd[_0x981f('0x69')]||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd['attrs'][0x1]?_0x4b68fd[_0x981f('0x61')][0x1][_0x981f('0x62')]:undefined)||_0x981f('0x6a')},{'name':_0x981f('0x6b'),'value':_0x4b68fd[_0x981f('0x6b')]||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd[_0x981f('0x61')][0x2]?_0x4b68fd[_0x981f('0x61')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x981f('0x6c'),'value':_0x4b68fd[_0x981f('0x6c')]||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd[_0x981f('0x61')][0x0]?_0x4b68fd[_0x981f('0x61')][0x0][_0x981f('0x62')]:undefined)||'total'},{'name':_0x981f('0x6d'),'value':_0x4b68fd[_0x981f('0x6d')]||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd[_0x981f('0x61')][0x1]?_0x4b68fd[_0x981f('0x61')][0x1][_0x981f('0x62')]:undefined)||[]},{'name':_0x981f('0x6b'),'value':_0x4b68fd[_0x981f('0x6b')]||(_0x4b68fd['attrs']&&_0x4b68fd['attrs'][0x2]?_0x4b68fd[_0x981f('0x61')][0x2]['value']:undefined)||0x14}];case _0x981f('0x6e'):case _0x981f('0x6f'):return[{'name':_0x981f('0x70'),'value':_0x4b68fd[_0x981f('0x70')]||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd[_0x981f('0x61')][0x0]?_0x4b68fd[_0x981f('0x61')][0x0][_0x981f('0x62')]:undefined)||_0x981f('0x71')},{'name':_0x981f('0x72'),'value':_0x4b68fd[_0x981f('0x72')]||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd[_0x981f('0x61')][0x1]?_0x4b68fd[_0x981f('0x61')][0x1]['value']:undefined)||null},{'name':_0x981f('0x73'),'value':_0x4b68fd[_0x981f('0x73')]||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd[_0x981f('0x61')][0x2]?_0x4b68fd[_0x981f('0x61')][0x2]['value']:undefined)||null},{'name':_0x981f('0x6d'),'value':_0x4b68fd[_0x981f('0x6d')]||(_0x4b68fd['attrs']&&_0x4b68fd[_0x981f('0x61')][0x3]?_0x4b68fd[_0x981f('0x61')][0x3][_0x981f('0x62')]:undefined)||[]}];case _0x981f('0x74'):return[{'name':'attrReport','type':_0x4b68fd[_0x981f('0x75')]||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd[_0x981f('0x61')][0x0]?_0x4b68fd[_0x981f('0x61')][0x0][_0x981f('0x5f')]:undefined)||null,'value':_0x4b68fd['attrReport']||(_0x4b68fd[_0x981f('0x61')]&&_0x4b68fd[_0x981f('0x61')][0x0]?_0x4b68fd[_0x981f('0x61')][0x0][_0x981f('0x62')]:undefined)||null},{'name':_0x981f('0x76'),'value':_0x4b68fd[_0x981f('0x76')]||(_0x4b68fd['attrs']&&_0x4b68fd[_0x981f('0x61')][0x1]?_0x4b68fd[_0x981f('0x61')][0x1][_0x981f('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x4fd87f){logger[_0x981f('0x77')](_0x981f('0x78'),JSON[_0x981f('0x79')](_0x4fd87f));return[];}}exports[_0x981f('0x7a')]=function(_0x1c2fc7,_0x547b93,_0x274b41){if(_0x1c2fc7[_0x981f('0x5e')]['id']){delete _0x1c2fc7[_0x981f('0x5e')]['id'];}return db[_0x981f('0x37')]['find']({'where':{'id':_0x1c2fc7['params']['id']}})[_0x981f('0x2f')](handleEntityNotFound(_0x547b93,null))[_0x981f('0x2f')](function(_0x409f90){if(_0x409f90){_0x1c2fc7[_0x981f('0x5e')]['DashboardId']=_0x409f90['id'];_0x1c2fc7[_0x981f('0x5e')][_0x981f('0x61')]=widgetAttributes(_0x1c2fc7[_0x981f('0x5e')]);return db[_0x981f('0x7b')][_0x981f('0x50')](_0x1c2fc7[_0x981f('0x5e')]);}})['then'](respondWithResult(_0x547b93,null))[_0x981f('0x4c')](handleError(_0x547b93,null));};exports['getItems']=function(_0x491bb3,_0x743370,_0x534db5){var _0x290e5c={};var _0x584d4b={};var _0x2f563d;var _0x4b0d3e;return db[_0x981f('0x37')][_0x981f('0x7c')]({'where':{'id':_0x491bb3['params']['id']}})[_0x981f('0x2f')](handleEntityNotFound(_0x743370,null))[_0x981f('0x2f')](function(_0x3b3cb6){if(_0x3b3cb6){_0x2f563d=_0x3b3cb6;_0x584d4b['model']=_[_0x981f('0x3a')](db[_0x981f('0x7b')][_0x981f('0x59')]);_0x584d4b[_0x981f('0x3b')]=_['keys'](_0x491bb3[_0x981f('0x3b')]);_0x584d4b[_0x981f('0x3c')]=_[_0x981f('0x3d')](_0x584d4b['model'],_0x584d4b[_0x981f('0x3b')]);_0x290e5c['attributes']=_[_0x981f('0x3d')](_0x584d4b[_0x981f('0x39')],qs[_0x981f('0x3f')](_0x491bb3[_0x981f('0x3b')]['fields']));_0x290e5c[_0x981f('0x3e')]=_0x290e5c['attributes']['length']?_0x290e5c[_0x981f('0x3e')]:_0x584d4b[_0x981f('0x39')];_0x290e5c[_0x981f('0x7d')]=qs[_0x981f('0x42')](_0x491bb3[_0x981f('0x3b')][_0x981f('0x42')]);_0x290e5c[_0x981f('0x44')]=qs[_0x981f('0x3c')](_[_0x981f('0x7e')](_0x491bb3[_0x981f('0x3b')],_0x584d4b['filters']));if(_0x491bb3[_0x981f('0x3b')][_0x981f('0x43')]){_0x290e5c[_0x981f('0x44')]=_[_0x981f('0x45')](_0x290e5c[_0x981f('0x44')],{'$or':_[_0x981f('0x36')](_0x290e5c[_0x981f('0x3e')],function(_0x4ef761){var _0x379010={};_0x379010[_0x4ef761]={'$like':'%'+_0x491bb3['query'][_0x981f('0x43')]+'%'};return _0x379010;})});}_0x290e5c=_[_0x981f('0x45')]({},_0x290e5c,_0x491bb3[_0x981f('0x47')]);return _0x2f563d[_0x981f('0x7f')](_0x290e5c);}})['then'](function(_0x2d136d){if(_0x2d136d){_0x4b0d3e=_0x2d136d['length'];if(!_0x491bb3[_0x981f('0x3b')][_0x981f('0x40')](_0x981f('0x80'))){_0x290e5c[_0x981f('0x41')]=qs[_0x981f('0x41')](_0x491bb3[_0x981f('0x3b')][_0x981f('0x41')]);_0x290e5c[_0x981f('0x27')]=qs['offset'](_0x491bb3[_0x981f('0x3b')][_0x981f('0x27')]);}return _0x2f563d[_0x981f('0x7f')](_0x290e5c);}})[_0x981f('0x2f')](function(_0x168641){if(_0x168641){return _0x168641?{'count':_0x4b0d3e,'rows':_0x168641}:null;}})[_0x981f('0x2f')](respondWithResult(_0x743370,null))[_0x981f('0x4c')](handleError(_0x743370,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 17faa34..373677a 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 _0xc272=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xc272,0xe6));var _0x2c27=function(_0x339129,_0x86dcc6){_0x339129=_0x339129-0x0;var _0x1570df=_0xc272[_0x339129];return _0x1570df;};'use strict';var EventEmitter=require(_0x2c27('0x0'));var Dashboard=require(_0x2c27('0x1'))['db'][_0x2c27('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x2c27('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2c27('0x4'),'afterDestroy':'remove'};function emitEvent(_0x138b5b){return function(_0x425db6,_0x39e472,_0x430987){DashboardEvents[_0x2c27('0x5')](_0x138b5b+':'+_0x425db6['id'],_0x425db6);DashboardEvents[_0x2c27('0x5')](_0x138b5b,_0x425db6);_0x430987(null);};}for(var e in events){if(events[_0x2c27('0x6')](e)){var event=events[e];Dashboard[_0x2c27('0x7')](e,emitEvent(event));}}module[_0x2c27('0x8')]=DashboardEvents; \ No newline at end of file +var _0x5815=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','hasOwnProperty','hook'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x5815,0xb5));var _0x5581=function(_0x1f4694,_0x29ab44){_0x1f4694=_0x1f4694-0x0;var _0x2be28f=_0x5815[_0x1f4694];return _0x2be28f;};'use strict';var EventEmitter=require(_0x5581('0x0'));var Dashboard=require(_0x5581('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5581('0x2')](0x0);var events={'afterCreate':_0x5581('0x3'),'afterUpdate':_0x5581('0x4'),'afterDestroy':_0x5581('0x5')};function emitEvent(_0x43d60a){return function(_0x1d3354,_0x170e31,_0x410599){DashboardEvents['emit'](_0x43d60a+':'+_0x1d3354['id'],_0x1d3354);DashboardEvents['emit'](_0x43d60a,_0x1d3354);_0x410599(null);};}for(var e in events){if(events[_0x5581('0x6')](e)){var event=events[e];Dashboard[_0x5581('0x7')](e,emitEvent(event));}}module[_0x5581('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 1fda94b..fd38260 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 _0x9caf=['path','../../config/environment','./dashboard.attributes','define','Dashboard','dashboards','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0x9caf,0x8a));var _0xf9ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9caf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf9ca('0x0'));var util=require('util');var logger=require(_0xf9ca('0x1'))(_0xf9ca('0x2'));var moment=require(_0xf9ca('0x3'));var BPromise=require(_0xf9ca('0x4'));var rp=require(_0xf9ca('0x5'));var fs=require('fs');var path=require(_0xf9ca('0x6'));var rimraf=require('rimraf');var config=require(_0xf9ca('0x7'));var attributes=require(_0xf9ca('0x8'));module['exports']=function(_0x170403,_0x4deeec){return _0x170403[_0xf9ca('0x9')](_0xf9ca('0xa'),attributes,{'tableName':_0xf9ca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5855=['request-promise','rimraf','./dashboard.attributes','exports','define','Dashboard','dashboards','util','../../config/logger','api','moment'];(function(_0x5504d5,_0x29a41b){var _0x3df904=function(_0x524c88){while(--_0x524c88){_0x5504d5['push'](_0x5504d5['shift']());}};_0x3df904(++_0x29a41b);}(_0x5855,0x1e0));var _0x5585=function(_0x589ac8,_0x10ac6e){_0x589ac8=_0x589ac8-0x0;var _0x1bb5dc=_0x5855[_0x589ac8];return _0x1bb5dc;};'use strict';var _=require('lodash');var util=require(_0x5585('0x0'));var logger=require(_0x5585('0x1'))(_0x5585('0x2'));var moment=require(_0x5585('0x3'));var BPromise=require('bluebird');var rp=require(_0x5585('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5585('0x5'));var config=require('../../config/environment');var attributes=require(_0x5585('0x6'));module[_0x5585('0x7')]=function(_0x3af97c,_0xb3a082){return _0x3af97c[_0x5585('0x8')](_0x5585('0x9'),attributes,{'tableName':_0x5585('0xa'),'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 0083dc6..346543c 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 _0x1bc1=['info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then'];(function(_0x112182,_0x5da656){var _0x210661=function(_0x37001c){while(--_0x37001c){_0x112182['push'](_0x112182['shift']());}};_0x210661(++_0x5da656);}(_0x1bc1,0xea));var _0x11bc=function(_0x4146ef,_0x1b007b){_0x4146ef=_0x4146ef-0x0;var _0x2998f9=_0x1bc1[_0x4146ef];return _0x2998f9;};'use strict';var _=require(_0x11bc('0x0'));var util=require(_0x11bc('0x1'));var moment=require(_0x11bc('0x2'));var BPromise=require(_0x11bc('0x3'));var rs=require(_0x11bc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x11bc('0x5'))['db'];var utils=require(_0x11bc('0x6'));var logger=require(_0x11bc('0x7'))(_0x11bc('0x8'));var config=require('../../config/environment');var jayson=require(_0x11bc('0x9'));var client=jayson[_0x11bc('0xa')][_0x11bc('0xb')]({'port':0x232a});config[_0x11bc('0xc')]=_[_0x11bc('0xd')](config[_0x11bc('0xc')],{'host':_0x11bc('0xe'),'port':0x18eb});var socket=require(_0x11bc('0xf'))(new Redis(config[_0x11bc('0xc')]));require('./dashboard.socket')[_0x11bc('0x10')](socket);function respondWithRpcPromise(_0xcb96f8,_0x5ab709,_0x5cb346){return new BPromise(function(_0xc6014c,_0x6eb21f){return client['request'](_0xcb96f8,_0x5cb346)[_0x11bc('0x11')](function(_0x1e1e8b){logger[_0x11bc('0x12')](_0x11bc('0x13'),_0x5ab709,_0x11bc('0x14'));logger[_0x11bc('0x15')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x5ab709,'request\x20sent',JSON[_0x11bc('0x16')](_0x1e1e8b));if(_0x1e1e8b[_0x11bc('0x17')]){if(_0x1e1e8b[_0x11bc('0x17')][_0x11bc('0x18')]===0x1f4){logger[_0x11bc('0x17')]('Dashboard,\x20%s,\x20%s',_0x5ab709,_0x1e1e8b['error'][_0x11bc('0x19')]);return _0x6eb21f(_0x1e1e8b[_0x11bc('0x17')][_0x11bc('0x19')]);}logger[_0x11bc('0x17')](_0x11bc('0x13'),_0x5ab709,_0x1e1e8b[_0x11bc('0x17')][_0x11bc('0x19')]);return _0xc6014c(_0x1e1e8b[_0x11bc('0x17')][_0x11bc('0x19')]);}else{logger[_0x11bc('0x12')]('Dashboard,\x20%s,\x20%s',_0x5ab709,_0x11bc('0x14'));_0xc6014c(_0x1e1e8b[_0x11bc('0x1a')][_0x11bc('0x19')]);}})[_0x11bc('0x1b')](function(_0x3dc786){logger[_0x11bc('0x17')]('Dashboard,\x20%s,\x20%s',_0x5ab709,_0x3dc786);_0x6eb21f(_0x3dc786);});});} \ No newline at end of file +var _0x9512=['debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s'];(function(_0x45c284,_0x4e93d1){var _0x4af76c=function(_0x4942c6){while(--_0x4942c6){_0x45c284['push'](_0x45c284['shift']());}};_0x4af76c(++_0x4e93d1);}(_0x9512,0x1ac));var _0x2951=function(_0x575228,_0x3f9bc1){_0x575228=_0x575228-0x0;var _0x4cb11e=_0x9512[_0x575228];return _0x4cb11e;};'use strict';var _=require(_0x2951('0x0'));var util=require(_0x2951('0x1'));var moment=require(_0x2951('0x2'));var BPromise=require('bluebird');var rs=require(_0x2951('0x3'));var fs=require('fs');var Redis=require(_0x2951('0x4'));var db=require(_0x2951('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2951('0x6'));var config=require(_0x2951('0x7'));var jayson=require(_0x2951('0x8'));var client=jayson[_0x2951('0x9')][_0x2951('0xa')]({'port':0x232a});config[_0x2951('0xb')]=_[_0x2951('0xc')](config[_0x2951('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2951('0xd'))(new Redis(config[_0x2951('0xb')]));require(_0x2951('0xe'))[_0x2951('0xf')](socket);function respondWithRpcPromise(_0x31771e,_0x414aba,_0x15ec09){return new BPromise(function(_0x54cb63,_0x14cd96){return client[_0x2951('0x10')](_0x31771e,_0x15ec09)[_0x2951('0x11')](function(_0x163e33){logger[_0x2951('0x12')](_0x2951('0x13'),_0x414aba,'request\x20sent');logger[_0x2951('0x14')](_0x2951('0x15'),_0x414aba,_0x2951('0x16'),JSON[_0x2951('0x17')](_0x163e33));if(_0x163e33[_0x2951('0x18')]){if(_0x163e33[_0x2951('0x18')][_0x2951('0x19')]===0x1f4){logger['error'](_0x2951('0x13'),_0x414aba,_0x163e33[_0x2951('0x18')][_0x2951('0x1a')]);return _0x14cd96(_0x163e33[_0x2951('0x18')]['message']);}logger[_0x2951('0x18')](_0x2951('0x13'),_0x414aba,_0x163e33[_0x2951('0x18')][_0x2951('0x1a')]);return _0x54cb63(_0x163e33[_0x2951('0x18')][_0x2951('0x1a')]);}else{logger[_0x2951('0x12')]('Dashboard,\x20%s,\x20%s',_0x414aba,_0x2951('0x16'));_0x54cb63(_0x163e33['result'][_0x2951('0x1a')]);}})[_0x2951('0x1b')](function(_0x371f2e){logger[_0x2951('0x18')](_0x2951('0x13'),_0x414aba,_0x371f2e);_0x14cd96(_0x371f2e);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 3fdef30..dc4d29c 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 _0xcb69=['./dashboard.events','save','remove','update','emit','removeListener','register','length','dashboard:'];(function(_0x1c94d9,_0x4c218a){var _0x1dc86d=function(_0xd39260){while(--_0xd39260){_0x1c94d9['push'](_0x1c94d9['shift']());}};_0x1dc86d(++_0x4c218a);}(_0xcb69,0xea));var _0x9cb6=function(_0x4438b5,_0x48cdbe){_0x4438b5=_0x4438b5-0x0;var _0x1f5f36=_0xcb69[_0x4438b5];return _0x1f5f36;};'use strict';var DashboardEvents=require(_0x9cb6('0x0'));var events=[_0x9cb6('0x1'),_0x9cb6('0x2'),_0x9cb6('0x3')];function createListener(_0x4b9d4e,_0x566420){return function(_0x579b89){_0x566420[_0x9cb6('0x4')](_0x4b9d4e,_0x579b89);};}function removeListener(_0x1889b1,_0x8b6ef3){return function(){DashboardEvents[_0x9cb6('0x5')](_0x1889b1,_0x8b6ef3);};}exports[_0x9cb6('0x6')]=function(_0x2308ff){for(var _0x587629=0x0,_0x5d1c5=events[_0x9cb6('0x7')];_0x587629<_0x5d1c5;_0x587629++){var _0xe2821c=events[_0x587629];var _0x54f274=createListener(_0x9cb6('0x8')+_0xe2821c,_0x2308ff);DashboardEvents['on'](_0xe2821c,_0x54f274);}}; \ No newline at end of file +var _0xd37a=['./dashboard.events','save','update','emit','removeListener','register','dashboard:'];(function(_0x2276c0,_0x48e46a){var _0x185f33=function(_0x8e5000){while(--_0x8e5000){_0x2276c0['push'](_0x2276c0['shift']());}};_0x185f33(++_0x48e46a);}(_0xd37a,0x10a));var _0xad37=function(_0x355644,_0xb79867){_0x355644=_0x355644-0x0;var _0x3a7e95=_0xd37a[_0x355644];return _0x3a7e95;};'use strict';var DashboardEvents=require(_0xad37('0x0'));var events=[_0xad37('0x1'),'remove',_0xad37('0x2')];function createListener(_0x16eba3,_0x842f3c){return function(_0x38316e){_0x842f3c[_0xad37('0x3')](_0x16eba3,_0x38316e);};}function removeListener(_0x4ed390,_0x21aeb7){return function(){DashboardEvents[_0xad37('0x4')](_0x4ed390,_0x21aeb7);};}exports[_0xad37('0x5')]=function(_0x1dfdf1){for(var _0x5ce3fd=0x0,_0x1603dc=events['length'];_0x5ce3fd<_0x1603dc;_0x5ce3fd++){var _0x23526c=events[_0x5ce3fd];var _0x6bdf9e=createListener(_0xad37('0x6')+_0x23526c,_0x1dfdf1);DashboardEvents['on'](_0x23526c,_0x6bdf9e);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index f971842..65a68af 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 _0xa9e0=['/:id','/:id/items','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated'];(function(_0x17c17d,_0x581840){var _0x420ac1=function(_0xab3213){while(--_0xab3213){_0x17c17d['push'](_0x17c17d['shift']());}};_0x420ac1(++_0x581840);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getItems']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xb')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['clone']);router['post']('/:id/items',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file +var _0xb7e7=['addItem','put','update','delete','multer','path','express','../../components/auth/service','../../config/environment','./dashboard.controller','get','/:id','isAuthenticated','/:id/items','getItems','post','create','/:id/clone','clone'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0xb7e7[_0x4e6ae6];return _0x23c108;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['post'](_0x7b7e('0xd'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xe')]);router[_0x7b7e('0xb')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0x7'),auth['isAuthenticated'](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x12')]('/:id',auth[_0x7b7e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 3103ae0..fbf49ea 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 _0x24ad=['#2196f3','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff'];(function(_0x5bd052,_0x4af36d){var _0x5988e3=function(_0x5b3167){while(--_0x5b3167){_0x5bd052['push'](_0x5bd052['shift']());}};_0x5988e3(++_0x4af36d);}(_0x24ad,0xd3));var _0xd24a=function(_0x167dde,_0x4456a1){_0x167dde=_0x167dde-0x0;var _0x44945a=_0x24ad[_0x167dde];return _0x44945a;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xd24a('0x0'));var _=require(_0xd24a('0x1'));module[_0xd24a('0x2')]={'title':{'type':Sequelize[_0xd24a('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xd24a('0x4')](_0xd24a('0x5')),'get':function(){try{return JSON[_0xd24a('0x6')](this[_0xd24a('0x7')](_0xd24a('0x8')));}catch(_0x2c5328){return[];}},'set':function(_0x141098){try{this['setDataValue'](_0xd24a('0x8'),JSON['stringify'](_0x141098));}catch(_0xad322b){this[_0xd24a('0x9')](_0xd24a('0x8'),JSON[_0xd24a('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0xd24a('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xd24a('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xd24a('0xb')]},'col':{'type':Sequelize[_0xd24a('0xb')]},'background':{'type':Sequelize[_0xd24a('0x3')],'allowNull':![],'defaultValue':_0xd24a('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd24a('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xd24a('0x3')]},'titleFontSize':{'type':Sequelize[_0xd24a('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0xdf68=['lodash','exports','STRING','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','squel'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0xdf68,0x1ac));var _0x8df6=function(_0x49ad79,_0x48ee93){_0x49ad79=_0x49ad79-0x0;var _0xa4e38a=_0xdf68[_0x49ad79];return _0xa4e38a;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x8df6('0x0'));var _=require(_0x8df6('0x1'));module[_0x8df6('0x2')]={'title':{'type':Sequelize[_0x8df6('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8df6('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON[_0x8df6('0x4')](this[_0x8df6('0x5')](_0x8df6('0x6')));}catch(_0x1abc17){return[];}},'set':function(_0x13f7e8){try{this[_0x8df6('0x7')](_0x8df6('0x6'),JSON[_0x8df6('0x8')](_0x13f7e8));}catch(_0x35d4f9){this['setDataValue']('attrs',JSON[_0x8df6('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x8df6('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x8df6('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x8df6('0x9')]},'col':{'type':Sequelize[_0x8df6('0x9')]},'background':{'type':Sequelize[_0x8df6('0x3')],'allowNull':![],'defaultValue':_0x8df6('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x8df6('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8df6('0x3')]},'titleFontSize':{'type':Sequelize[_0x8df6('0x9')],'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 0a30a0d..fe1ccbf 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 _0x1a77=['attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','then','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','options','DashboardItem','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2'];(function(_0x37062a,_0x3e5b02){var _0x16978b=function(_0x20052e){while(--_0x20052e){_0x37062a['push'](_0x37062a['shift']());}};_0x16978b(++_0x3e5b02);}(_0x1a77,0x17e));var _0x71a7=function(_0x3af830,_0x289e0d){_0x3af830=_0x3af830-0x0;var _0x324fb0=_0x1a77[_0x3af830];return _0x324fb0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x71a7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x71a7('0x1'));var rp=require(_0x71a7('0x2'));var moment=require(_0x71a7('0x3'));var BPromise=require(_0x71a7('0x4'));var Mustache=require('mustache');var util=require(_0x71a7('0x5'));var path=require(_0x71a7('0x6'));var sox=require(_0x71a7('0x7'));var csv=require('to-csv');var ejs=require(_0x71a7('0x8'));var fs=require('fs');var _=require(_0x71a7('0x9'));var squel=require(_0x71a7('0xa'));var crypto=require(_0x71a7('0xb'));var jsforce=require(_0x71a7('0xc'));var deskjs=require(_0x71a7('0xd'));var toCsv=require(_0x71a7('0xe'));var querystring=require(_0x71a7('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x71a7('0x10'));var qs=require(_0x71a7('0x11'));var as=require(_0x71a7('0x12'));var hardwareService=require(_0x71a7('0x13'));var logger=require(_0x71a7('0x14'))(_0x71a7('0x15'));var utils=require('../../config/utils');var config=require(_0x71a7('0x16'));var licenseUtil=require(_0x71a7('0x17'));var db=require(_0x71a7('0x18'))['db'];config['redis']=_[_0x71a7('0x19')](config[_0x71a7('0x1a')],{'host':_0x71a7('0x1b'),'port':0x18eb});var socket=require(_0x71a7('0x1c'))(new Redis(config[_0x71a7('0x1a')]));require(_0x71a7('0x1d'))[_0x71a7('0x1e')](socket);function respondWithStatusCode(_0x33aa14,_0x1a8c95){_0x1a8c95=_0x1a8c95||0xcc;return function(_0x2803c3){if(_0x2803c3){return _0x33aa14[_0x71a7('0x1f')](_0x1a8c95);}return _0x33aa14['status'](_0x1a8c95)['end']();};}function respondWithResult(_0x1f3954,_0x4ef3c8){_0x4ef3c8=_0x4ef3c8||0xc8;return function(_0x351bb5){if(_0x351bb5){return _0x1f3954[_0x71a7('0x20')](_0x4ef3c8)[_0x71a7('0x21')](_0x351bb5);}};}function respondWithFilteredResult(_0x5ef4e6,_0x3fd19f){return function(_0x35037d){if(_0x35037d){var _0x3288a3=_0x35037d[_0x71a7('0x22')],_0x46979a=_0x3fd19f['offset'],_0x5e1d8a=_0x3fd19f[_0x71a7('0x23')]+_0x3fd19f[_0x71a7('0x24')],_0x578122;if(_0x5e1d8a>=_0x3288a3){_0x5e1d8a=_0x3288a3;_0x578122=0xc8;}else{_0x578122=0xce;}_0x5ef4e6[_0x71a7('0x20')](_0x578122);return _0x5ef4e6[_0x71a7('0x25')](_0x71a7('0x26'),_0x46979a+'-'+_0x5e1d8a+'/'+_0x3288a3)[_0x71a7('0x21')](_0x35037d);}return null;};}function patchUpdates(_0x36cd27){return function(_0x5a75de){try{jsonpatch[_0x71a7('0x27')](_0x5a75de,_0x36cd27,!![]);}catch(_0x2df7da){return BPromise[_0x71a7('0x28')](_0x2df7da);}return _0x5a75de['save']();};}function saveUpdates(_0x1b8731,_0x206a2){return function(_0x52b367){if(_0x52b367){return _0x52b367['update'](_0x1b8731)['then'](function(_0x4548ef){return _0x4548ef;});}return null;};}function removeEntity(_0x46248f,_0xd25d5a){return function(_0x3b2e68){if(_0x3b2e68){return _0x3b2e68['destroy']()[_0x71a7('0x29')](function(){_0x46248f[_0x71a7('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32babe,_0x444b55){return function(_0x4c5887){if(!_0x4c5887){_0x32babe[_0x71a7('0x1f')](0x194);}return _0x4c5887;};}function handleError(_0x33f5e3,_0x315a2c){_0x315a2c=_0x315a2c||0x1f4;return function(_0x3ad641){logger[_0x71a7('0x2a')](_0x3ad641[_0x71a7('0x2b')]);if(_0x3ad641['name']){delete _0x3ad641[_0x71a7('0x2c')];}_0x33f5e3[_0x71a7('0x20')](_0x315a2c)[_0x71a7('0x2d')](_0x3ad641);};}exports[_0x71a7('0x2e')]=function(_0xd8f128,_0x2996ba){var _0x14f96c={'raw':![],'where':{'id':_0xd8f128[_0x71a7('0x2f')]['id']}},_0x262607={};_0x262607[_0x71a7('0x30')]=_[_0x71a7('0x31')](db['DashboardItem'][_0x71a7('0x32')]);_0x262607[_0x71a7('0x33')]=_[_0x71a7('0x31')](_0xd8f128['query']);_0x262607[_0x71a7('0x34')]=_[_0x71a7('0x35')](_0x262607[_0x71a7('0x30')],_0x262607[_0x71a7('0x33')]);_0x14f96c['attributes']=_['intersection'](_0x262607[_0x71a7('0x30')],qs[_0x71a7('0x36')](_0xd8f128[_0x71a7('0x33')][_0x71a7('0x36')]));_0x14f96c[_0x71a7('0x37')]=_0x14f96c[_0x71a7('0x37')][_0x71a7('0x38')]?_0x14f96c[_0x71a7('0x37')]:_0x262607[_0x71a7('0x30')];if(_0xd8f128['query'][_0x71a7('0x39')]){_0x14f96c[_0x71a7('0x3a')]=[{'all':!![]}];}_0x14f96c=_['merge']({},_0x14f96c,_0xd8f128[_0x71a7('0x3b')]);return db[_0x71a7('0x3c')][_0x71a7('0x3d')](_0x14f96c)[_0x71a7('0x29')](handleEntityNotFound(_0x2996ba,null))[_0x71a7('0x29')](respondWithResult(_0x2996ba,null))[_0x71a7('0x3e')](handleError(_0x2996ba,null));};exports['destroy']=function(_0x2b737e,_0x4ed2ee){return db[_0x71a7('0x3c')]['find']({'where':{'id':_0x2b737e[_0x71a7('0x2f')]['id']}})[_0x71a7('0x29')](handleEntityNotFound(_0x4ed2ee,null))['then'](removeEntity(_0x4ed2ee,null))['catch'](handleError(_0x4ed2ee,null));};function widgetAttributes(_0x15f725){try{switch(_0x15f725[_0x71a7('0x3f')]){case _0x71a7('0x40'):return[{'name':_0x71a7('0x41'),'value':_0x15f725[_0x71a7('0x41')]||(_0x15f725[_0x71a7('0x42')]&&_0x15f725['attrs'][0x0]?_0x15f725[_0x71a7('0x42')][0x0][_0x71a7('0x43')]:undefined)||_0x71a7('0x44')}];case _0x71a7('0x45'):return[{'name':_0x71a7('0x46'),'value':_0x15f725[_0x71a7('0x46')]||(_0x15f725['attrs']&&_0x15f725[_0x71a7('0x42')][0x0]?_0x15f725[_0x71a7('0x42')][0x0][_0x71a7('0x43')]:undefined)||''}];case'clock':return[{'name':_0x71a7('0x47'),'value':_0x15f725['attrHourFormat']||(_0x15f725[_0x71a7('0x42')]&&_0x15f725[_0x71a7('0x42')][0x0]?_0x15f725[_0x71a7('0x42')][0x0]['value']:undefined)||_0x71a7('0x48')},{'name':_0x71a7('0x49'),'value':_0x15f725[_0x71a7('0x49')]||(_0x15f725['attrs']&&_0x15f725[_0x71a7('0x42')][0x1]?_0x15f725[_0x71a7('0x42')][0x1][_0x71a7('0x43')]:undefined)||_0x71a7('0x4a')},{'name':'attrFontSize','value':_0x15f725[_0x71a7('0x4b')]||(_0x15f725[_0x71a7('0x42')]&&_0x15f725[_0x71a7('0x42')][0x2]?_0x15f725[_0x71a7('0x42')][0x2][_0x71a7('0x43')]:undefined)||0xc}];case'counter':return[{'name':_0x71a7('0x4c'),'value':_0x15f725[_0x71a7('0x4c')]||(_0x15f725[_0x71a7('0x42')]&&_0x15f725['attrs'][0x0]?_0x15f725[_0x71a7('0x42')][0x0][_0x71a7('0x43')]:undefined)||_0x71a7('0x4d')},{'name':_0x71a7('0x4e'),'value':_0x15f725[_0x71a7('0x4e')]||(_0x15f725['attrs']&&_0x15f725[_0x71a7('0x42')][0x1]?_0x15f725[_0x71a7('0x42')][0x1]['value']:undefined)||[]},{'name':_0x71a7('0x4b'),'value':_0x15f725[_0x71a7('0x4b')]||(_0x15f725[_0x71a7('0x42')]&&_0x15f725[_0x71a7('0x42')][0x2]?_0x15f725[_0x71a7('0x42')][0x2]['value']:undefined)||0x14}];case _0x71a7('0x4f'):case _0x71a7('0x50'):return[{'name':_0x71a7('0x51'),'value':_0x15f725[_0x71a7('0x51')]||(_0x15f725[_0x71a7('0x42')]&&_0x15f725['attrs'][0x0]?_0x15f725['attrs'][0x0][_0x71a7('0x43')]:undefined)||_0x71a7('0x4d')},{'name':_0x71a7('0x52'),'value':_0x15f725[_0x71a7('0x52')]||(_0x15f725[_0x71a7('0x42')]&&_0x15f725['attrs'][0x1]?_0x15f725['attrs'][0x1][_0x71a7('0x43')]:undefined)||null},{'name':'attrSerie3','value':_0x15f725[_0x71a7('0x53')]||(_0x15f725['attrs']&&_0x15f725[_0x71a7('0x42')][0x2]?_0x15f725['attrs'][0x2][_0x71a7('0x43')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x15f725[_0x71a7('0x4e')]||(_0x15f725['attrs']&&_0x15f725[_0x71a7('0x42')][0x3]?_0x15f725[_0x71a7('0x42')][0x3][_0x71a7('0x43')]:undefined)||[]}];case _0x71a7('0x54'):return[{'name':'attrReport','type':_0x15f725[_0x71a7('0x55')]||(_0x15f725[_0x71a7('0x42')]&&_0x15f725[_0x71a7('0x42')][0x0]?_0x15f725[_0x71a7('0x42')][0x0][_0x71a7('0x3f')]:undefined)||null,'value':_0x15f725[_0x71a7('0x56')]||(_0x15f725[_0x71a7('0x42')]&&_0x15f725[_0x71a7('0x42')][0x0]?_0x15f725[_0x71a7('0x42')][0x0][_0x71a7('0x43')]:undefined)||null},{'name':_0x71a7('0x57'),'value':_0x15f725[_0x71a7('0x57')]||(_0x15f725[_0x71a7('0x42')]&&_0x15f725[_0x71a7('0x42')][0x1]?_0x15f725['attrs'][0x1][_0x71a7('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x14196f){logger[_0x71a7('0x2a')](_0x71a7('0x58'),JSON[_0x71a7('0x59')](_0x14196f));return[];}}exports[_0x71a7('0x5a')]=function(_0x35c7b9,_0x542847){if(_0x35c7b9[_0x71a7('0x5b')]){_0x35c7b9['body'][_0x71a7('0x42')]=widgetAttributes(_0x35c7b9[_0x71a7('0x5b')]);}return db[_0x71a7('0x3c')][_0x71a7('0x5a')](_0x35c7b9[_0x71a7('0x5b')],{})[_0x71a7('0x29')](respondWithResult(_0x542847,0xc9))[_0x71a7('0x3e')](handleError(_0x542847,null));};exports[_0x71a7('0x5c')]=function(_0x51e483,_0x432635){if(_0x51e483['body']['id']){delete _0x51e483[_0x71a7('0x5b')]['id'];}_0x51e483['body'][_0x71a7('0x42')]=widgetAttributes(_0x51e483['body']);return db['DashboardItem'][_0x71a7('0x3d')]({'where':{'id':_0x51e483[_0x71a7('0x2f')]['id']}})['then'](handleEntityNotFound(_0x432635,null))[_0x71a7('0x29')](saveUpdates(_0x51e483[_0x71a7('0x5b')],null))[_0x71a7('0x29')](respondWithResult(_0x432635,null))['catch'](handleError(_0x432635,null));}; \ No newline at end of file +var _0xa4fb=['stringify','create','body','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./dashboardItem.socket','sendStatus','end','status','json','offset','set','apply','reject','save','update','then','destroy','error','name','send','show','params','keys','DashboardItem','rawAttributes','query','filters','model','attributes','intersection','length','includeAll','merge','options','find','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s'];(function(_0x5b973c,_0x46c0d0){var _0xc3a214=function(_0xff037a){while(--_0xff037a){_0x5b973c['push'](_0x5b973c['shift']());}};_0xc3a214(++_0x46c0d0);}(_0xa4fb,0xb0));var _0xba4f=function(_0x30c2ae,_0x4c98a2){_0x30c2ae=_0x30c2ae-0x0;var _0x1ee1cc=_0xa4fb[_0x30c2ae];return _0x1ee1cc;};'use strict';var pdf=require(_0xba4f('0x0'));var emlformat=require(_0xba4f('0x1'));var rimraf=require(_0xba4f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xba4f('0x3'));var rp=require(_0xba4f('0x4'));var moment=require(_0xba4f('0x5'));var BPromise=require(_0xba4f('0x6'));var Mustache=require('mustache');var util=require(_0xba4f('0x7'));var path=require(_0xba4f('0x8'));var sox=require('sox');var csv=require(_0xba4f('0x9'));var ejs=require(_0xba4f('0xa'));var fs=require('fs');var _=require(_0xba4f('0xb'));var squel=require('squel');var crypto=require(_0xba4f('0xc'));var jsforce=require(_0xba4f('0xd'));var deskjs=require(_0xba4f('0xe'));var toCsv=require(_0xba4f('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xba4f('0xf'));var authService=require(_0xba4f('0x10'));var qs=require(_0xba4f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba4f('0x12'));var logger=require('../../config/logger')(_0xba4f('0x13'));var utils=require('../../config/utils');var config=require(_0xba4f('0x14'));var licenseUtil=require(_0xba4f('0x15'));var db=require(_0xba4f('0x16'))['db'];config[_0xba4f('0x17')]=_[_0xba4f('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba4f('0x17')]));require(_0xba4f('0x19'))['register'](socket);function respondWithStatusCode(_0x2d7d68,_0x1a4d2a){_0x1a4d2a=_0x1a4d2a||0xcc;return function(_0x41f855){if(_0x41f855){return _0x2d7d68[_0xba4f('0x1a')](_0x1a4d2a);}return _0x2d7d68['status'](_0x1a4d2a)[_0xba4f('0x1b')]();};}function respondWithResult(_0x482ace,_0x52ca6e){_0x52ca6e=_0x52ca6e||0xc8;return function(_0x215949){if(_0x215949){return _0x482ace[_0xba4f('0x1c')](_0x52ca6e)[_0xba4f('0x1d')](_0x215949);}};}function respondWithFilteredResult(_0x4b3e17,_0xe31451){return function(_0x4e0638){if(_0x4e0638){var _0x129a18=_0x4e0638['count'],_0x1210a1=_0xe31451[_0xba4f('0x1e')],_0x29de25=_0xe31451[_0xba4f('0x1e')]+_0xe31451['limit'],_0x14db67;if(_0x29de25>=_0x129a18){_0x29de25=_0x129a18;_0x14db67=0xc8;}else{_0x14db67=0xce;}_0x4b3e17[_0xba4f('0x1c')](_0x14db67);return _0x4b3e17[_0xba4f('0x1f')]('Content-Range',_0x1210a1+'-'+_0x29de25+'/'+_0x129a18)[_0xba4f('0x1d')](_0x4e0638);}return null;};}function patchUpdates(_0x55b528){return function(_0x1f6a4b){try{jsonpatch[_0xba4f('0x20')](_0x1f6a4b,_0x55b528,!![]);}catch(_0x171dba){return BPromise[_0xba4f('0x21')](_0x171dba);}return _0x1f6a4b[_0xba4f('0x22')]();};}function saveUpdates(_0x121b8b,_0x4298b3){return function(_0x1a32ac){if(_0x1a32ac){return _0x1a32ac[_0xba4f('0x23')](_0x121b8b)[_0xba4f('0x24')](function(_0x8c0f84){return _0x8c0f84;});}return null;};}function removeEntity(_0x526bc7,_0x4af237){return function(_0x4cd35e){if(_0x4cd35e){return _0x4cd35e[_0xba4f('0x25')]()[_0xba4f('0x24')](function(){_0x526bc7[_0xba4f('0x1c')](0xcc)[_0xba4f('0x1b')]();});}};}function handleEntityNotFound(_0x2aaa14,_0xeae738){return function(_0x35dcc4){if(!_0x35dcc4){_0x2aaa14[_0xba4f('0x1a')](0x194);}return _0x35dcc4;};}function handleError(_0x3d3b56,_0x19d6eb){_0x19d6eb=_0x19d6eb||0x1f4;return function(_0x4c3945){logger[_0xba4f('0x26')](_0x4c3945['stack']);if(_0x4c3945['name']){delete _0x4c3945[_0xba4f('0x27')];}_0x3d3b56['status'](_0x19d6eb)[_0xba4f('0x28')](_0x4c3945);};}exports[_0xba4f('0x29')]=function(_0x444df8,_0xbe946e){var _0x3e4cb1={'raw':![],'where':{'id':_0x444df8[_0xba4f('0x2a')]['id']}},_0x29c79b={};_0x29c79b['model']=_[_0xba4f('0x2b')](db[_0xba4f('0x2c')][_0xba4f('0x2d')]);_0x29c79b[_0xba4f('0x2e')]=_['keys'](_0x444df8[_0xba4f('0x2e')]);_0x29c79b[_0xba4f('0x2f')]=_['intersection'](_0x29c79b[_0xba4f('0x30')],_0x29c79b[_0xba4f('0x2e')]);_0x3e4cb1[_0xba4f('0x31')]=_[_0xba4f('0x32')](_0x29c79b[_0xba4f('0x30')],qs['fields'](_0x444df8[_0xba4f('0x2e')]['fields']));_0x3e4cb1[_0xba4f('0x31')]=_0x3e4cb1[_0xba4f('0x31')][_0xba4f('0x33')]?_0x3e4cb1[_0xba4f('0x31')]:_0x29c79b[_0xba4f('0x30')];if(_0x444df8[_0xba4f('0x2e')][_0xba4f('0x34')]){_0x3e4cb1['include']=[{'all':!![]}];}_0x3e4cb1=_[_0xba4f('0x35')]({},_0x3e4cb1,_0x444df8[_0xba4f('0x36')]);return db[_0xba4f('0x2c')][_0xba4f('0x37')](_0x3e4cb1)[_0xba4f('0x24')](handleEntityNotFound(_0xbe946e,null))[_0xba4f('0x24')](respondWithResult(_0xbe946e,null))['catch'](handleError(_0xbe946e,null));};exports[_0xba4f('0x25')]=function(_0x291410,_0x3cce5b){return db[_0xba4f('0x2c')][_0xba4f('0x37')]({'where':{'id':_0x291410['params']['id']}})[_0xba4f('0x24')](handleEntityNotFound(_0x3cce5b,null))[_0xba4f('0x24')](removeEntity(_0x3cce5b,null))['catch'](handleError(_0x3cce5b,null));};function widgetAttributes(_0x22de55){try{switch(_0x22de55['type']){case _0xba4f('0x38'):return[{'name':_0xba4f('0x39'),'value':_0x22de55['attrUrl']||(_0x22de55[_0xba4f('0x3a')]&&_0x22de55['attrs'][0x0]?_0x22de55[_0xba4f('0x3a')][0x0]['value']:undefined)||_0xba4f('0x3b')}];case _0xba4f('0x3c'):return[{'name':_0xba4f('0x3d'),'value':_0x22de55[_0xba4f('0x3d')]||(_0x22de55[_0xba4f('0x3a')]&&_0x22de55[_0xba4f('0x3a')][0x0]?_0x22de55['attrs'][0x0][_0xba4f('0x3e')]:undefined)||''}];case _0xba4f('0x3f'):return[{'name':_0xba4f('0x40'),'value':_0x22de55[_0xba4f('0x40')]||(_0x22de55['attrs']&&_0x22de55[_0xba4f('0x3a')][0x0]?_0x22de55['attrs'][0x0][_0xba4f('0x3e')]:undefined)||_0xba4f('0x41')},{'name':'attrTimezone','value':_0x22de55[_0xba4f('0x42')]||(_0x22de55['attrs']&&_0x22de55[_0xba4f('0x3a')][0x1]?_0x22de55[_0xba4f('0x3a')][0x1][_0xba4f('0x3e')]:undefined)||_0xba4f('0x43')},{'name':_0xba4f('0x44'),'value':_0x22de55['attrFontSize']||(_0x22de55[_0xba4f('0x3a')]&&_0x22de55[_0xba4f('0x3a')][0x2]?_0x22de55[_0xba4f('0x3a')][0x2][_0xba4f('0x3e')]:undefined)||0xc}];case'counter':return[{'name':_0xba4f('0x45'),'value':_0x22de55[_0xba4f('0x45')]||(_0x22de55['attrs']&&_0x22de55[_0xba4f('0x3a')][0x0]?_0x22de55[_0xba4f('0x3a')][0x0]['value']:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x22de55[_0xba4f('0x46')]||(_0x22de55[_0xba4f('0x3a')]&&_0x22de55[_0xba4f('0x3a')][0x1]?_0x22de55[_0xba4f('0x3a')][0x1][_0xba4f('0x3e')]:undefined)||[]},{'name':'attrFontSize','value':_0x22de55[_0xba4f('0x44')]||(_0x22de55['attrs']&&_0x22de55[_0xba4f('0x3a')][0x2]?_0x22de55[_0xba4f('0x3a')][0x2][_0xba4f('0x3e')]:undefined)||0x14}];case _0xba4f('0x47'):case _0xba4f('0x48'):return[{'name':_0xba4f('0x49'),'value':_0x22de55[_0xba4f('0x49')]||(_0x22de55['attrs']&&_0x22de55[_0xba4f('0x3a')][0x0]?_0x22de55[_0xba4f('0x3a')][0x0][_0xba4f('0x3e')]:undefined)||'total'},{'name':_0xba4f('0x4a'),'value':_0x22de55[_0xba4f('0x4a')]||(_0x22de55[_0xba4f('0x3a')]&&_0x22de55[_0xba4f('0x3a')][0x1]?_0x22de55[_0xba4f('0x3a')][0x1]['value']:undefined)||null},{'name':_0xba4f('0x4b'),'value':_0x22de55['attrSerie3']||(_0x22de55[_0xba4f('0x3a')]&&_0x22de55['attrs'][0x2]?_0x22de55[_0xba4f('0x3a')][0x2][_0xba4f('0x3e')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x22de55['attrVoiceQueues']||(_0x22de55['attrs']&&_0x22de55[_0xba4f('0x3a')][0x3]?_0x22de55[_0xba4f('0x3a')][0x3][_0xba4f('0x3e')]:undefined)||[]}];case _0xba4f('0x4c'):return[{'name':_0xba4f('0x4d'),'type':_0x22de55[_0xba4f('0x4e')]||(_0x22de55[_0xba4f('0x3a')]&&_0x22de55[_0xba4f('0x3a')][0x0]?_0x22de55['attrs'][0x0][_0xba4f('0x4f')]:undefined)||null,'value':_0x22de55[_0xba4f('0x4d')]||(_0x22de55[_0xba4f('0x3a')]&&_0x22de55[_0xba4f('0x3a')][0x0]?_0x22de55[_0xba4f('0x3a')][0x0][_0xba4f('0x3e')]:undefined)||null},{'name':_0xba4f('0x50'),'value':_0x22de55[_0xba4f('0x50')]||(_0x22de55['attrs']&&_0x22de55[_0xba4f('0x3a')][0x1]?_0x22de55[_0xba4f('0x3a')][0x1][_0xba4f('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x7f7181){logger['error'](_0xba4f('0x51'),JSON[_0xba4f('0x52')](_0x7f7181));return[];}}exports[_0xba4f('0x53')]=function(_0x1a2e38,_0x3fb9ba){if(_0x1a2e38[_0xba4f('0x54')]){_0x1a2e38[_0xba4f('0x54')][_0xba4f('0x3a')]=widgetAttributes(_0x1a2e38[_0xba4f('0x54')]);}return db[_0xba4f('0x2c')][_0xba4f('0x53')](_0x1a2e38[_0xba4f('0x54')],{})[_0xba4f('0x24')](respondWithResult(_0x3fb9ba,0xc9))[_0xba4f('0x55')](handleError(_0x3fb9ba,null));};exports[_0xba4f('0x23')]=function(_0x2a2e54,_0x3951b9){if(_0x2a2e54[_0xba4f('0x54')]['id']){delete _0x2a2e54['body']['id'];}_0x2a2e54[_0xba4f('0x54')][_0xba4f('0x3a')]=widgetAttributes(_0x2a2e54[_0xba4f('0x54')]);return db['DashboardItem'][_0xba4f('0x37')]({'where':{'id':_0x2a2e54[_0xba4f('0x2a')]['id']}})[_0xba4f('0x24')](handleEntityNotFound(_0x3951b9,null))['then'](saveUpdates(_0x2a2e54[_0xba4f('0x54')],null))[_0xba4f('0x24')](respondWithResult(_0x3951b9,null))[_0xba4f('0x55')](handleError(_0x3951b9,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index cc3379a..5cef3cd 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 _0x3b33=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x4480fe,_0x37a697){var _0x4c978a=function(_0x3bf1fd){while(--_0x3bf1fd){_0x4480fe['push'](_0x4480fe['shift']());}};_0x4c978a(++_0x37a697);}(_0x3b33,0xec));var _0x33b3=function(_0x48d67f,_0x172db2){_0x48d67f=_0x48d67f-0x0;var _0x2040df=_0x3b33[_0x48d67f];return _0x2040df;};'use strict';var EventEmitter=require(_0x33b3('0x0'));var DashboardItem=require(_0x33b3('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x33b3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x33b3('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3849b9){return function(_0x3e7aba,_0x4967da,_0x37d7c4){DashboardItemEvents[_0x33b3('0x4')](_0x3849b9+':'+_0x3e7aba['id'],_0x3e7aba);DashboardItemEvents[_0x33b3('0x4')](_0x3849b9,_0x3e7aba);_0x37d7c4(null);};}for(var e in events){if(events[_0x33b3('0x5')](e)){var event=events[e];DashboardItem[_0x33b3('0x6')](e,emitEvent(event));}}module[_0x33b3('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xade4=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x3e3e5a,_0x26f1a0){var _0x45a7d8=function(_0x350bd4){while(--_0x350bd4){_0x3e3e5a['push'](_0x3e3e5a['shift']());}};_0x45a7d8(++_0x26f1a0);}(_0xade4,0x159));var _0x4ade=function(_0x38899e,_0xa918a5){_0x38899e=_0x38899e-0x0;var _0x4c9362=_0xade4[_0x38899e];return _0x4c9362;};'use strict';var EventEmitter=require(_0x4ade('0x0'));var DashboardItem=require(_0x4ade('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x4ade('0x2')](0x0);var events={'afterCreate':_0x4ade('0x3'),'afterUpdate':'update','afterDestroy':_0x4ade('0x4')};function emitEvent(_0x4b6e76){return function(_0x4bcd01,_0x425327,_0x386e04){DashboardItemEvents[_0x4ade('0x5')](_0x4b6e76+':'+_0x4bcd01['id'],_0x4bcd01);DashboardItemEvents[_0x4ade('0x5')](_0x4b6e76,_0x4bcd01);_0x386e04(null);};}for(var e in events){if(events[_0x4ade('0x6')](e)){var event=events[e];DashboardItem[_0x4ade('0x7')](e,emitEvent(event));}}module[_0x4ade('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 654204c..e64315f 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 _0x9248=['request-promise','../../config/environment','./dashboardItem.attributes','exports','define','dashboard_items','lodash','api','moment','bluebird'];(function(_0x4b418f,_0x3b6a96){var _0x2ed208=function(_0x5bb29b){while(--_0x5bb29b){_0x4b418f['push'](_0x4b418f['shift']());}};_0x2ed208(++_0x3b6a96);}(_0x9248,0x114));var _0x8924=function(_0x5761ed,_0x54472d){_0x5761ed=_0x5761ed-0x0;var _0x1c94c8=_0x9248[_0x5761ed];return _0x1c94c8;};'use strict';var _=require(_0x8924('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8924('0x1'));var moment=require(_0x8924('0x2'));var BPromise=require(_0x8924('0x3'));var rp=require(_0x8924('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8924('0x5'));var attributes=require(_0x8924('0x6'));module[_0x8924('0x7')]=function(_0x13ca27,_0x2596f3){return _0x13ca27[_0x8924('0x8')]('DashboardItem',attributes,{'tableName':_0x8924('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2ac=['bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','lodash','../../config/logger'];(function(_0x442955,_0x410333){var _0x14f4b3=function(_0x3f0bc3){while(--_0x3f0bc3){_0x442955['push'](_0x442955['shift']());}};_0x14f4b3(++_0x410333);}(_0xb2ac,0x11e));var _0xcb2a=function(_0x3a0ba5,_0x3d4793){_0x3a0ba5=_0x3a0ba5-0x0;var _0x253dce=_0xb2ac[_0x3a0ba5];return _0x253dce;};'use strict';var _=require(_0xcb2a('0x0'));var util=require('util');var logger=require(_0xcb2a('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcb2a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb2a('0x3'));var rimraf=require(_0xcb2a('0x4'));var config=require(_0xcb2a('0x5'));var attributes=require(_0xcb2a('0x6'));module['exports']=function(_0x43b3a6,_0x1c301a){return _0x43b3a6[_0xcb2a('0x7')](_0xcb2a('0x8'),attributes,{'tableName':'dashboard_items','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 be71d44..dc8341e 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 _0x50ca=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x310010,_0x567eb1){var _0x49c5c4=function(_0x226c6f){while(--_0x226c6f){_0x310010['push'](_0x310010['shift']());}};_0x49c5c4(++_0x567eb1);}(_0x50ca,0xf2));var _0xa50c=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x50ca[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0xa50c('0x0'));var moment=require(_0xa50c('0x1'));var BPromise=require(_0xa50c('0x2'));var rs=require(_0xa50c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa50c('0x4'))['db'];var utils=require(_0xa50c('0x5'));var logger=require(_0xa50c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa50c('0x7')][_0xa50c('0x8')]({'port':0x232a});config['redis']=_[_0xa50c('0x9')](config[_0xa50c('0xa')],{'host':_0xa50c('0xb'),'port':0x18eb});var socket=require(_0xa50c('0xc'))(new Redis(config['redis']));require(_0xa50c('0xd'))[_0xa50c('0xe')](socket);function respondWithRpcPromise(_0x295be0,_0x3a79c9,_0x143d42){return new BPromise(function(_0x53b01b,_0x4b4eab){return client['request'](_0x295be0,_0x143d42)[_0xa50c('0xf')](function(_0x4f20c2){logger[_0xa50c('0x10')](_0xa50c('0x11'),_0x3a79c9,_0xa50c('0x12'));logger[_0xa50c('0x13')](_0xa50c('0x14'),_0x3a79c9,_0xa50c('0x12'),JSON[_0xa50c('0x15')](_0x4f20c2));if(_0x4f20c2['error']){if(_0x4f20c2[_0xa50c('0x16')][_0xa50c('0x17')]===0x1f4){logger[_0xa50c('0x16')](_0xa50c('0x11'),_0x3a79c9,_0x4f20c2[_0xa50c('0x16')][_0xa50c('0x18')]);return _0x4b4eab(_0x4f20c2[_0xa50c('0x16')][_0xa50c('0x18')]);}logger[_0xa50c('0x16')]('DashboardItem,\x20%s,\x20%s',_0x3a79c9,_0x4f20c2[_0xa50c('0x16')][_0xa50c('0x18')]);return _0x53b01b(_0x4f20c2[_0xa50c('0x16')][_0xa50c('0x18')]);}else{logger[_0xa50c('0x10')](_0xa50c('0x11'),_0x3a79c9,_0xa50c('0x12'));_0x53b01b(_0x4f20c2[_0xa50c('0x19')][_0xa50c('0x18')]);}})[_0xa50c('0x1a')](function(_0x2ff63e){logger['error'](_0xa50c('0x11'),_0x3a79c9,_0x2ff63e);_0x4b4eab(_0x2ff63e);});});} \ No newline at end of file +var _0x7cef=['message','info','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7cef,0x154));var _0xf7ce=function(_0x593b0f,_0x1adadd){_0x593b0f=_0x593b0f-0x0;var _0x5c5aae=_0x7cef[_0x593b0f];return _0x5c5aae;};'use strict';var _=require(_0xf7ce('0x0'));var util=require(_0xf7ce('0x1'));var moment=require(_0xf7ce('0x2'));var BPromise=require(_0xf7ce('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf7ce('0x4'))['db'];var utils=require(_0xf7ce('0x5'));var logger=require(_0xf7ce('0x6'))(_0xf7ce('0x7'));var config=require('../../config/environment');var jayson=require(_0xf7ce('0x8'));var client=jayson[_0xf7ce('0x9')][_0xf7ce('0xa')]({'port':0x232a});config[_0xf7ce('0xb')]=_['defaults'](config[_0xf7ce('0xb')],{'host':_0xf7ce('0xc'),'port':0x18eb});var socket=require(_0xf7ce('0xd'))(new Redis(config[_0xf7ce('0xb')]));require('./dashboardItem.socket')[_0xf7ce('0xe')](socket);function respondWithRpcPromise(_0x4840c7,_0x2a6634,_0x3e27e4){return new BPromise(function(_0x8193ac,_0x3596b3){return client[_0xf7ce('0xf')](_0x4840c7,_0x3e27e4)[_0xf7ce('0x10')](function(_0x3422b5){logger['info'](_0xf7ce('0x11'),_0x2a6634,_0xf7ce('0x12'));logger[_0xf7ce('0x13')](_0xf7ce('0x14'),_0x2a6634,_0xf7ce('0x12'),JSON[_0xf7ce('0x15')](_0x3422b5));if(_0x3422b5[_0xf7ce('0x16')]){if(_0x3422b5[_0xf7ce('0x16')][_0xf7ce('0x17')]===0x1f4){logger[_0xf7ce('0x16')]('DashboardItem,\x20%s,\x20%s',_0x2a6634,_0x3422b5['error'][_0xf7ce('0x18')]);return _0x3596b3(_0x3422b5[_0xf7ce('0x16')][_0xf7ce('0x18')]);}logger[_0xf7ce('0x16')](_0xf7ce('0x11'),_0x2a6634,_0x3422b5[_0xf7ce('0x16')][_0xf7ce('0x18')]);return _0x8193ac(_0x3422b5[_0xf7ce('0x16')][_0xf7ce('0x18')]);}else{logger[_0xf7ce('0x19')](_0xf7ce('0x11'),_0x2a6634,_0xf7ce('0x12'));_0x8193ac(_0x3422b5['result']['message']);}})['catch'](function(_0x22a1aa){logger['error'](_0xf7ce('0x11'),_0x2a6634,_0x22a1aa);_0x3596b3(_0x22a1aa);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index f197518..679d4ab 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 _0x81f6=['length','dashboardItem:','save','remove','update','emit','removeListener','register'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x81f6,0x182));var _0x681f=function(_0x1d72ad,_0x3a33ec){_0x1d72ad=_0x1d72ad-0x0;var _0x34eb61=_0x81f6[_0x1d72ad];return _0x34eb61;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x681f('0x0'),_0x681f('0x1'),_0x681f('0x2')];function createListener(_0x5c86a2,_0x4e9b76){return function(_0x3a290f){_0x4e9b76[_0x681f('0x3')](_0x5c86a2,_0x3a290f);};}function removeListener(_0x29991d,_0x72c094){return function(){DashboardItemEvents[_0x681f('0x4')](_0x29991d,_0x72c094);};}exports[_0x681f('0x5')]=function(_0x258970){for(var _0xe598d2=0x0,_0xaeac6a=events[_0x681f('0x6')];_0xe598d2<_0xaeac6a;_0xe598d2++){var _0x4c7d2b=events[_0xe598d2];var _0x1c5b59=createListener(_0x681f('0x7')+_0x4c7d2b,_0x258970);DashboardItemEvents['on'](_0x4c7d2b,_0x1c5b59);}}; \ No newline at end of file +var _0x5f15=['emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x2368c1,_0x1e7cc6){var _0x1f1b07=function(_0x88b66){while(--_0x88b66){_0x2368c1['push'](_0x2368c1['shift']());}};_0x1f1b07(++_0x1e7cc6);}(_0x5f15,0xa5));var _0x55f1=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5f15[_0xfae23b];return _0x200640;};'use strict';var DashboardItemEvents=require(_0x55f1('0x0'));var events=[_0x55f1('0x1'),_0x55f1('0x2'),'update'];function createListener(_0x449bf0,_0x218a09){return function(_0x33133d){_0x218a09[_0x55f1('0x3')](_0x449bf0,_0x33133d);};}function removeListener(_0x3fe72a,_0x80eb17){return function(){DashboardItemEvents[_0x55f1('0x4')](_0x3fe72a,_0x80eb17);};}exports[_0x55f1('0x5')]=function(_0x29803d){for(var _0x117b40=0x0,_0x24ef1d=events[_0x55f1('0x6')];_0x117b40<_0x24ef1d;_0x117b40++){var _0x2d910e=events[_0x117b40];var _0x26ad3f=createListener(_0x55f1('0x7')+_0x2d910e,_0x29803d);DashboardItemEvents['on'](_0x2d910e,_0x26ad3f);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 1830dca..b3626b7 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 _0x5fab=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x419b6a,_0x265b43){var _0x229232=function(_0x514a3e){while(--_0x514a3e){_0x419b6a['push'](_0x419b6a['shift']());}};_0x229232(++_0x265b43);}(_0x5fab,0x177));var _0xb5fa=function(_0x487702,_0x49f5d4){_0x487702=_0x487702-0x0;var _0x5e7150=_0x5fab[_0x487702];return _0x5e7150;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var auth=require(_0xb5fa('0x5'));var interaction=require(_0xb5fa('0x6'));var config=require(_0xb5fa('0x7'));var controller=require(_0xb5fa('0x8'));router[_0xb5fa('0x9')](_0xb5fa('0xa'),auth[_0xb5fa('0xb')](),controller['show']);router['post']('/',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xc')]);router[_0xb5fa('0xd')]('/:id',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xe')]);router[_0xb5fa('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);module[_0xb5fa('0x11')]=router; \ No newline at end of file +var _0x814b=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','post','put'];(function(_0x2dee01,_0x47c04d){var _0x3d6408=function(_0xdc5e5f){while(--_0xdc5e5f){_0x2dee01['push'](_0x2dee01['shift']());}};_0x3d6408(++_0x47c04d);}(_0x814b,0x1a2));var _0xb814=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x814b[_0x25d386];return _0x857f4a;};'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 auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')](_0xb814('0xa'),auth[_0xb814('0xb')](),controller['show']);router[_0xb814('0xc')]('/',auth[_0xb814('0xb')](),controller['create']);router[_0xb814('0xd')](_0xb814('0xa'),auth[_0xb814('0xb')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')](_0xb814('0xa'),auth[_0xb814('0xb')](),controller[_0xb814('0x10')]);module[_0xb814('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 84e9613..66f1939 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 _0x3635=['sequelize','exports','ENUM','first','second','STRING'];(function(_0x153e7d,_0x10a35f){var _0x3c22dd=function(_0x4d33f6){while(--_0x4d33f6){_0x153e7d['push'](_0x153e7d['shift']());}};_0x3c22dd(++_0x10a35f);}(_0x3635,0x150));var _0x5363=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x3635[_0x33032e];return _0x13316b;};'use strict';var Sequelize=require(_0x5363('0x0'));module[_0x5363('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x5363('0x2')](_0x5363('0x3'),_0x5363('0x4'),'third'),'allowNull':![],'defaultValue':_0x5363('0x3')},'description':{'type':Sequelize[_0x5363('0x5')]}}; \ No newline at end of file +var _0xb931=['second','sequelize','exports','STRING','ENUM','first'];(function(_0x2aeac7,_0x47c8fa){var _0x52cc45=function(_0x40485b){while(--_0x40485b){_0x2aeac7['push'](_0x2aeac7['shift']());}};_0x52cc45(++_0x47c8fa);}(_0xb931,0xdf));var _0x1b93=function(_0x255706,_0x4e7e0e){_0x255706=_0x255706-0x0;var _0xd7c8f3=_0xb931[_0x255706];return _0xd7c8f3;};'use strict';var Sequelize=require(_0x1b93('0x0'));module[_0x1b93('0x1')]={'name':{'type':Sequelize[_0x1b93('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x1b93('0x3')](_0x1b93('0x4'),_0x1b93('0x5'),'third'),'allowNull':![],'defaultValue':_0x1b93('0x4')},'description':{'type':Sequelize[_0x1b93('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index a2e3b44..6c9a5da 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 _0x82af=['rows','params','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x82af,0x10f));var _0xf82a=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x82af[_0x4b2863];return _0x567d67;};'use strict';var pdf=require(_0xf82a('0x0'));var emlformat=require(_0xf82a('0x1'));var rimraf=require(_0xf82a('0x2'));var zipdir=require(_0xf82a('0x3'));var jsonpatch=require(_0xf82a('0x4'));var rp=require(_0xf82a('0x5'));var moment=require(_0xf82a('0x6'));var BPromise=require(_0xf82a('0x7'));var Mustache=require(_0xf82a('0x8'));var util=require('util');var path=require('path');var sox=require(_0xf82a('0x9'));var csv=require(_0xf82a('0xa'));var ejs=require(_0xf82a('0xb'));var fs=require('fs');var _=require(_0xf82a('0xc'));var squel=require(_0xf82a('0xd'));var crypto=require('crypto');var jsforce=require(_0xf82a('0xe'));var deskjs=require(_0xf82a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf82a('0x10'));var Papa=require('papaparse');var Redis=require(_0xf82a('0x11'));var authService=require(_0xf82a('0x12'));var qs=require(_0xf82a('0x13'));var as=require(_0xf82a('0x14'));var hardwareService=require(_0xf82a('0x15'));var logger=require(_0xf82a('0x16'))(_0xf82a('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf82a('0x18'));var db=require(_0xf82a('0x19'))['db'];function respondWithStatusCode(_0x2189e6,_0x4db30c){_0x4db30c=_0x4db30c||0xcc;return function(_0xd6dca8){if(_0xd6dca8){return _0x2189e6[_0xf82a('0x1a')](_0x4db30c);}return _0x2189e6[_0xf82a('0x1b')](_0x4db30c)[_0xf82a('0x1c')]();};}function respondWithResult(_0x23737c,_0x2ba73c){_0x2ba73c=_0x2ba73c||0xc8;return function(_0x149efd){if(_0x149efd){return _0x23737c['status'](_0x2ba73c)[_0xf82a('0x1d')](_0x149efd);}};}function respondWithFilteredResult(_0x2f93e9,_0x1b0b02){return function(_0x3ed9af){if(_0x3ed9af){var _0x21a811=_0x3ed9af[_0xf82a('0x1e')],_0x430831=_0x1b0b02['offset'],_0x57bbbe=_0x1b0b02[_0xf82a('0x1f')]+_0x1b0b02['limit'],_0xef2d74;if(_0x57bbbe>=_0x21a811){_0x57bbbe=_0x21a811;_0xef2d74=0xc8;}else{_0xef2d74=0xce;}_0x2f93e9['status'](_0xef2d74);return _0x2f93e9[_0xf82a('0x20')](_0xf82a('0x21'),_0x430831+'-'+_0x57bbbe+'/'+_0x21a811)[_0xf82a('0x1d')](_0x3ed9af);}return null;};}function patchUpdates(_0xcafb7c){return function(_0x206bc9){try{jsonpatch[_0xf82a('0x22')](_0x206bc9,_0xcafb7c,!![]);}catch(_0x480986){return BPromise[_0xf82a('0x23')](_0x480986);}return _0x206bc9[_0xf82a('0x24')]();};}function saveUpdates(_0x5aa0d1,_0x584b23){return function(_0x207056){if(_0x207056){return _0x207056[_0xf82a('0x25')](_0x5aa0d1)['then'](function(_0x5d4691){return _0x5d4691;});}return null;};}function removeEntity(_0x32da43,_0x2f2831){return function(_0x323073){if(_0x323073){return _0x323073[_0xf82a('0x26')]()[_0xf82a('0x27')](function(){var _0x42bd18=_0x323073[_0xf82a('0x28')]({'plain':!![]});var _0x5e999b=_0xf82a('0x29');return db[_0xf82a('0x2a')][_0xf82a('0x26')]({'where':{'type':_0x5e999b,'resourceId':_0x42bd18['id']}})[_0xf82a('0x27')](function(){return _0x323073;});})[_0xf82a('0x27')](function(){_0x32da43[_0xf82a('0x1b')](0xcc)[_0xf82a('0x1c')]();});}};}function handleEntityNotFound(_0x51e2c6,_0x5f2bf1){return function(_0x49532f){if(!_0x49532f){_0x51e2c6[_0xf82a('0x1a')](0x194);}return _0x49532f;};}function handleError(_0x80346e,_0x440fb5){_0x440fb5=_0x440fb5||0x1f4;return function(_0x29e09f){logger[_0xf82a('0x2b')](_0x29e09f[_0xf82a('0x2c')]);if(_0x29e09f[_0xf82a('0x2d')]){delete _0x29e09f[_0xf82a('0x2d')];}_0x80346e['status'](_0x440fb5)[_0xf82a('0x2e')](_0x29e09f);};}exports[_0xf82a('0x2f')]=function(_0x2e46c3,_0x16275d){var _0x5ab066={},_0x243b8c={},_0x4b2c1c={'count':0x0,'rows':[]};var _0x3b4a9d=_[_0xf82a('0x30')](db[_0xf82a('0x31')][_0xf82a('0x32')],function(_0x274350){return{'name':_0x274350[_0xf82a('0x33')],'type':_0x274350[_0xf82a('0x34')][_0xf82a('0x35')]};});_0x243b8c[_0xf82a('0x36')]=_[_0xf82a('0x30')](_0x3b4a9d,_0xf82a('0x2d'));_0x243b8c[_0xf82a('0x37')]=_[_0xf82a('0x38')](_0x2e46c3[_0xf82a('0x37')]);_0x243b8c['filters']=_[_0xf82a('0x39')](_0x243b8c[_0xf82a('0x36')],_0x243b8c['query']);_0x5ab066[_0xf82a('0x3a')]=_['intersection'](_0x243b8c['model'],qs[_0xf82a('0x3b')](_0x2e46c3[_0xf82a('0x37')][_0xf82a('0x3b')]));_0x5ab066['attributes']=_0x5ab066[_0xf82a('0x3a')]['length']?_0x5ab066[_0xf82a('0x3a')]:_0x243b8c[_0xf82a('0x36')];if(!_0x2e46c3[_0xf82a('0x37')][_0xf82a('0x3c')](_0xf82a('0x3d'))){_0x5ab066[_0xf82a('0x3e')]=qs[_0xf82a('0x3e')](_0x2e46c3['query'][_0xf82a('0x3e')]);_0x5ab066[_0xf82a('0x1f')]=qs[_0xf82a('0x1f')](_0x2e46c3[_0xf82a('0x37')][_0xf82a('0x1f')]);}_0x5ab066[_0xf82a('0x3f')]=qs[_0xf82a('0x40')](_0x2e46c3['query'][_0xf82a('0x40')]);_0x5ab066[_0xf82a('0x41')]=qs[_0xf82a('0x42')](_['pick'](_0x2e46c3[_0xf82a('0x37')],_0x243b8c[_0xf82a('0x42')]),_0x3b4a9d);if(_0x2e46c3['query'][_0xf82a('0x43')]){_0x5ab066[_0xf82a('0x41')]=_[_0xf82a('0x44')](_0x5ab066[_0xf82a('0x41')],{'$or':_['map'](_0x3b4a9d,function(_0x92d35){if(_0x92d35['type']!==_0xf82a('0x45')){var _0x10168c={};_0x10168c[_0x92d35[_0xf82a('0x2d')]]={'$like':'%'+_0x2e46c3[_0xf82a('0x37')][_0xf82a('0x43')]+'%'};return _0x10168c;}})});}_0x5ab066=_['merge']({},_0x5ab066,_0x2e46c3[_0xf82a('0x46')]);var _0x1ecd9b={'where':_0x5ab066[_0xf82a('0x41')]};return db['Disposition']['count'](_0x1ecd9b)[_0xf82a('0x27')](function(_0x305dcf){_0x4b2c1c[_0xf82a('0x1e')]=_0x305dcf;if(_0x2e46c3[_0xf82a('0x37')]['includeAll']){_0x5ab066[_0xf82a('0x47')]=[{'all':!![]}];}return db[_0xf82a('0x31')][_0xf82a('0x48')](_0x5ab066);})[_0xf82a('0x27')](function(_0x57eaed){_0x4b2c1c[_0xf82a('0x49')]=_0x57eaed;return _0x4b2c1c;})[_0xf82a('0x27')](respondWithFilteredResult(_0x16275d,_0x5ab066))['catch'](handleError(_0x16275d,null));};exports['show']=function(_0x48b095,_0x5ae6ea){var _0x2d284a={'raw':!![],'where':{'id':_0x48b095[_0xf82a('0x4a')]['id']}},_0x5eca0e={};_0x5eca0e[_0xf82a('0x36')]=_[_0xf82a('0x38')](db['Disposition']['rawAttributes']);_0x5eca0e[_0xf82a('0x37')]=_[_0xf82a('0x38')](_0x48b095['query']);_0x5eca0e[_0xf82a('0x42')]=_[_0xf82a('0x39')](_0x5eca0e[_0xf82a('0x36')],_0x5eca0e[_0xf82a('0x37')]);_0x2d284a[_0xf82a('0x3a')]=_[_0xf82a('0x39')](_0x5eca0e[_0xf82a('0x36')],qs[_0xf82a('0x3b')](_0x48b095[_0xf82a('0x37')][_0xf82a('0x3b')]));_0x2d284a[_0xf82a('0x3a')]=_0x2d284a[_0xf82a('0x3a')]['length']?_0x2d284a[_0xf82a('0x3a')]:_0x5eca0e[_0xf82a('0x36')];if(_0x48b095[_0xf82a('0x37')][_0xf82a('0x4b')]){_0x2d284a[_0xf82a('0x47')]=[{'all':!![]}];}_0x2d284a=_[_0xf82a('0x44')]({},_0x2d284a,_0x48b095[_0xf82a('0x46')]);return db[_0xf82a('0x31')][_0xf82a('0x4c')](_0x2d284a)[_0xf82a('0x27')](handleEntityNotFound(_0x5ae6ea,null))[_0xf82a('0x27')](respondWithResult(_0x5ae6ea,null))[_0xf82a('0x4d')](handleError(_0x5ae6ea,null));};exports[_0xf82a('0x4e')]=function(_0x512342,_0x61a364){return db[_0xf82a('0x31')][_0xf82a('0x4e')](_0x512342['body'],{})[_0xf82a('0x27')](function(_0x45fd88){var _0x5af6d4=_0x512342[_0xf82a('0x4f')]['get']({'plain':!![]});if(!_0x5af6d4)throw new Error(_0xf82a('0x50'));if(_0x5af6d4['role']==='user'){var _0x5efbef=_0x45fd88[_0xf82a('0x28')]({'plain':!![]});var _0x5088fc=_0xf82a('0x29');return db[_0xf82a('0x51')][_0xf82a('0x4c')]({'where':{'name':_0x5088fc,'userProfileId':_0x5af6d4[_0xf82a('0x52')]},'raw':!![]})[_0xf82a('0x27')](function(_0x5478bf){if(_0x5478bf&&_0x5478bf[_0xf82a('0x53')]===0x0){return db['UserProfileResource'][_0xf82a('0x4e')]({'name':_0x5efbef[_0xf82a('0x2d')],'resourceId':_0x5efbef['id'],'type':_0x5478bf['name'],'sectionId':_0x5478bf['id']},{})[_0xf82a('0x27')](function(){return _0x45fd88;});}else{return _0x45fd88;}})['catch'](function(_0x1c1433){logger['error'](_0xf82a('0x54'),_0x1c1433);throw _0x1c1433;});}return _0x45fd88;})[_0xf82a('0x27')](respondWithResult(_0x61a364,0xc9))[_0xf82a('0x4d')](handleError(_0x61a364,null));};exports['update']=function(_0x385bb7,_0x12b193){if(_0x385bb7[_0xf82a('0x55')]['id']){delete _0x385bb7[_0xf82a('0x55')]['id'];}return db[_0xf82a('0x31')][_0xf82a('0x4c')]({'where':{'id':_0x385bb7['params']['id']}})[_0xf82a('0x27')](handleEntityNotFound(_0x12b193,null))[_0xf82a('0x27')](saveUpdates(_0x385bb7[_0xf82a('0x55')],null))['then'](respondWithResult(_0x12b193,null))[_0xf82a('0x4d')](handleError(_0x12b193,null));};exports[_0xf82a('0x26')]=function(_0x2fad18,_0x3a2405){return db[_0xf82a('0x31')][_0xf82a('0x4c')]({'where':{'id':_0x2fad18[_0xf82a('0x4a')]['id']}})[_0xf82a('0x27')](handleEntityNotFound(_0x3a2405,null))[_0xf82a('0x27')](removeEntity(_0x3a2405,null))[_0xf82a('0x4d')](handleError(_0x3a2405,null));}; \ No newline at end of file +var _0x2cf9=['html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','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','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','get','Dispositions','destroy','stack','name','index','map','Disposition','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2cf9,0xaa));var _0x92cf=function(_0x18e696,_0x566133){_0x18e696=_0x18e696-0x0;var _0x1e4f52=_0x2cf9[_0x18e696];return _0x1e4f52;};'use strict';var pdf=require(_0x92cf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x92cf('0x1'));var zipdir=require(_0x92cf('0x2'));var jsonpatch=require(_0x92cf('0x3'));var rp=require(_0x92cf('0x4'));var moment=require(_0x92cf('0x5'));var BPromise=require(_0x92cf('0x6'));var Mustache=require(_0x92cf('0x7'));var util=require(_0x92cf('0x8'));var path=require(_0x92cf('0x9'));var sox=require(_0x92cf('0xa'));var csv=require('to-csv');var ejs=require(_0x92cf('0xb'));var fs=require('fs');var _=require(_0x92cf('0xc'));var squel=require(_0x92cf('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x92cf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x92cf('0xf'));var Papa=require(_0x92cf('0x10'));var Redis=require('ioredis');var authService=require(_0x92cf('0x11'));var qs=require(_0x92cf('0x12'));var as=require(_0x92cf('0x13'));var hardwareService=require(_0x92cf('0x14'));var logger=require(_0x92cf('0x15'))(_0x92cf('0x16'));var utils=require(_0x92cf('0x17'));var config=require(_0x92cf('0x18'));var licenseUtil=require(_0x92cf('0x19'));var db=require(_0x92cf('0x1a'))['db'];function respondWithStatusCode(_0x1030ab,_0x31f825){_0x31f825=_0x31f825||0xcc;return function(_0x1dc6fd){if(_0x1dc6fd){return _0x1030ab[_0x92cf('0x1b')](_0x31f825);}return _0x1030ab[_0x92cf('0x1c')](_0x31f825)[_0x92cf('0x1d')]();};}function respondWithResult(_0x4577f7,_0x5b725f){_0x5b725f=_0x5b725f||0xc8;return function(_0x1b1d4d){if(_0x1b1d4d){return _0x4577f7['status'](_0x5b725f)[_0x92cf('0x1e')](_0x1b1d4d);}};}function respondWithFilteredResult(_0x5c2d7d,_0x35add4){return function(_0x1cf0ee){if(_0x1cf0ee){var _0x99ec1c=_0x1cf0ee[_0x92cf('0x1f')],_0x3cc67a=_0x35add4[_0x92cf('0x20')],_0x56be7f=_0x35add4[_0x92cf('0x20')]+_0x35add4[_0x92cf('0x21')],_0x54b710;if(_0x56be7f>=_0x99ec1c){_0x56be7f=_0x99ec1c;_0x54b710=0xc8;}else{_0x54b710=0xce;}_0x5c2d7d[_0x92cf('0x1c')](_0x54b710);return _0x5c2d7d[_0x92cf('0x22')](_0x92cf('0x23'),_0x3cc67a+'-'+_0x56be7f+'/'+_0x99ec1c)[_0x92cf('0x1e')](_0x1cf0ee);}return null;};}function patchUpdates(_0x6858d6){return function(_0x426157){try{jsonpatch[_0x92cf('0x24')](_0x426157,_0x6858d6,!![]);}catch(_0x45e128){return BPromise['reject'](_0x45e128);}return _0x426157['save']();};}function saveUpdates(_0x52d51a,_0x5b4a7e){return function(_0x11c4a9){if(_0x11c4a9){return _0x11c4a9[_0x92cf('0x25')](_0x52d51a)[_0x92cf('0x26')](function(_0x2606d7){return _0x2606d7;});}return null;};}function removeEntity(_0x19dcc1,_0x47ceb0){return function(_0x37bd19){if(_0x37bd19){return _0x37bd19['destroy']()[_0x92cf('0x26')](function(){var _0x222c6d=_0x37bd19[_0x92cf('0x27')]({'plain':!![]});var _0x2097f5=_0x92cf('0x28');return db['UserProfileResource'][_0x92cf('0x29')]({'where':{'type':_0x2097f5,'resourceId':_0x222c6d['id']}})[_0x92cf('0x26')](function(){return _0x37bd19;});})[_0x92cf('0x26')](function(){_0x19dcc1[_0x92cf('0x1c')](0xcc)[_0x92cf('0x1d')]();});}};}function handleEntityNotFound(_0x22e842,_0x419646){return function(_0xf4817d){if(!_0xf4817d){_0x22e842['sendStatus'](0x194);}return _0xf4817d;};}function handleError(_0x518ab5,_0x42f990){_0x42f990=_0x42f990||0x1f4;return function(_0x16b3a0){logger['error'](_0x16b3a0[_0x92cf('0x2a')]);if(_0x16b3a0[_0x92cf('0x2b')]){delete _0x16b3a0[_0x92cf('0x2b')];}_0x518ab5[_0x92cf('0x1c')](_0x42f990)['send'](_0x16b3a0);};}exports[_0x92cf('0x2c')]=function(_0x41b657,_0x30b903){var _0x111e3f={},_0x5d3600={},_0x5b4ba6={'count':0x0,'rows':[]};var _0x1ad280=_[_0x92cf('0x2d')](db[_0x92cf('0x2e')][_0x92cf('0x2f')],function(_0x7875af){return{'name':_0x7875af[_0x92cf('0x30')],'type':_0x7875af[_0x92cf('0x31')][_0x92cf('0x32')]};});_0x5d3600[_0x92cf('0x33')]=_['map'](_0x1ad280,_0x92cf('0x2b'));_0x5d3600['query']=_['keys'](_0x41b657['query']);_0x5d3600[_0x92cf('0x34')]=_[_0x92cf('0x35')](_0x5d3600['model'],_0x5d3600[_0x92cf('0x36')]);_0x111e3f[_0x92cf('0x37')]=_[_0x92cf('0x35')](_0x5d3600[_0x92cf('0x33')],qs[_0x92cf('0x38')](_0x41b657[_0x92cf('0x36')][_0x92cf('0x38')]));_0x111e3f[_0x92cf('0x37')]=_0x111e3f[_0x92cf('0x37')][_0x92cf('0x39')]?_0x111e3f[_0x92cf('0x37')]:_0x5d3600['model'];if(!_0x41b657['query'][_0x92cf('0x3a')](_0x92cf('0x3b'))){_0x111e3f[_0x92cf('0x21')]=qs[_0x92cf('0x21')](_0x41b657[_0x92cf('0x36')][_0x92cf('0x21')]);_0x111e3f[_0x92cf('0x20')]=qs[_0x92cf('0x20')](_0x41b657[_0x92cf('0x36')][_0x92cf('0x20')]);}_0x111e3f['order']=qs['sort'](_0x41b657[_0x92cf('0x36')][_0x92cf('0x3c')]);_0x111e3f[_0x92cf('0x3d')]=qs[_0x92cf('0x34')](_[_0x92cf('0x3e')](_0x41b657[_0x92cf('0x36')],_0x5d3600[_0x92cf('0x34')]),_0x1ad280);if(_0x41b657[_0x92cf('0x36')][_0x92cf('0x3f')]){_0x111e3f['where']=_[_0x92cf('0x40')](_0x111e3f['where'],{'$or':_[_0x92cf('0x2d')](_0x1ad280,function(_0xea7a24){if(_0xea7a24[_0x92cf('0x31')]!==_0x92cf('0x41')){var _0x75aa00={};_0x75aa00[_0xea7a24[_0x92cf('0x2b')]]={'$like':'%'+_0x41b657['query'][_0x92cf('0x3f')]+'%'};return _0x75aa00;}})});}_0x111e3f=_[_0x92cf('0x40')]({},_0x111e3f,_0x41b657['options']);var _0x385a2e={'where':_0x111e3f['where']};return db[_0x92cf('0x2e')][_0x92cf('0x1f')](_0x385a2e)['then'](function(_0x94a55e){_0x5b4ba6[_0x92cf('0x1f')]=_0x94a55e;if(_0x41b657[_0x92cf('0x36')][_0x92cf('0x42')]){_0x111e3f[_0x92cf('0x43')]=[{'all':!![]}];}return db[_0x92cf('0x2e')][_0x92cf('0x44')](_0x111e3f);})[_0x92cf('0x26')](function(_0x3c2de4){_0x5b4ba6[_0x92cf('0x45')]=_0x3c2de4;return _0x5b4ba6;})[_0x92cf('0x26')](respondWithFilteredResult(_0x30b903,_0x111e3f))[_0x92cf('0x46')](handleError(_0x30b903,null));};exports[_0x92cf('0x47')]=function(_0x41878e,_0x31c375){var _0xc2069d={'raw':!![],'where':{'id':_0x41878e[_0x92cf('0x48')]['id']}},_0x2b1f77={};_0x2b1f77[_0x92cf('0x33')]=_[_0x92cf('0x49')](db[_0x92cf('0x2e')]['rawAttributes']);_0x2b1f77[_0x92cf('0x36')]=_[_0x92cf('0x49')](_0x41878e[_0x92cf('0x36')]);_0x2b1f77[_0x92cf('0x34')]=_[_0x92cf('0x35')](_0x2b1f77[_0x92cf('0x33')],_0x2b1f77[_0x92cf('0x36')]);_0xc2069d[_0x92cf('0x37')]=_[_0x92cf('0x35')](_0x2b1f77[_0x92cf('0x33')],qs[_0x92cf('0x38')](_0x41878e[_0x92cf('0x36')][_0x92cf('0x38')]));_0xc2069d['attributes']=_0xc2069d[_0x92cf('0x37')][_0x92cf('0x39')]?_0xc2069d[_0x92cf('0x37')]:_0x2b1f77['model'];if(_0x41878e[_0x92cf('0x36')][_0x92cf('0x42')]){_0xc2069d[_0x92cf('0x43')]=[{'all':!![]}];}_0xc2069d=_[_0x92cf('0x40')]({},_0xc2069d,_0x41878e[_0x92cf('0x4a')]);return db[_0x92cf('0x2e')][_0x92cf('0x4b')](_0xc2069d)[_0x92cf('0x26')](handleEntityNotFound(_0x31c375,null))['then'](respondWithResult(_0x31c375,null))[_0x92cf('0x46')](handleError(_0x31c375,null));};exports['create']=function(_0x4d68cb,_0xbb288d){return db['Disposition']['create'](_0x4d68cb[_0x92cf('0x4c')],{})[_0x92cf('0x26')](function(_0x146b45){var _0x3f90b4=_0x4d68cb[_0x92cf('0x4d')]['get']({'plain':!![]});if(!_0x3f90b4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f90b4[_0x92cf('0x4e')]===_0x92cf('0x4d')){var _0x14d809=_0x146b45[_0x92cf('0x27')]({'plain':!![]});var _0x2d1e3b=_0x92cf('0x28');return db[_0x92cf('0x4f')][_0x92cf('0x4b')]({'where':{'name':_0x2d1e3b,'userProfileId':_0x3f90b4[_0x92cf('0x50')]},'raw':!![]})['then'](function(_0x346215){if(_0x346215&&_0x346215[_0x92cf('0x51')]===0x0){return db[_0x92cf('0x52')][_0x92cf('0x53')]({'name':_0x14d809[_0x92cf('0x2b')],'resourceId':_0x14d809['id'],'type':_0x346215[_0x92cf('0x2b')],'sectionId':_0x346215['id']},{})[_0x92cf('0x26')](function(){return _0x146b45;});}else{return _0x146b45;}})[_0x92cf('0x46')](function(_0x389a0a){logger[_0x92cf('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x389a0a);throw _0x389a0a;});}return _0x146b45;})['then'](respondWithResult(_0xbb288d,0xc9))['catch'](handleError(_0xbb288d,null));};exports[_0x92cf('0x25')]=function(_0x58a4ba,_0x2b0d35){if(_0x58a4ba[_0x92cf('0x4c')]['id']){delete _0x58a4ba['body']['id'];}return db[_0x92cf('0x2e')][_0x92cf('0x4b')]({'where':{'id':_0x58a4ba[_0x92cf('0x48')]['id']}})[_0x92cf('0x26')](handleEntityNotFound(_0x2b0d35,null))[_0x92cf('0x26')](saveUpdates(_0x58a4ba[_0x92cf('0x4c')],null))[_0x92cf('0x26')](respondWithResult(_0x2b0d35,null))[_0x92cf('0x46')](handleError(_0x2b0d35,null));};exports[_0x92cf('0x29')]=function(_0x8abdda,_0x3fe38a){return db[_0x92cf('0x2e')]['find']({'where':{'id':_0x8abdda[_0x92cf('0x48')]['id']}})[_0x92cf('0x26')](handleEntityNotFound(_0x3fe38a,null))[_0x92cf('0x26')](removeEntity(_0x3fe38a,null))[_0x92cf('0x46')](handleError(_0x3fe38a,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index d1ce6a4..76a69f7 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 _0xeda8=['bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name_voice','name','ListId','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api','moment'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xeda8,0x104));var _0x8eda=function(_0x59e0b4,_0x2b5e27){_0x59e0b4=_0x59e0b4-0x0;var _0x2dc8a0=_0xeda8[_0x59e0b4];return _0x2dc8a0;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var logger=require('../../config/logger')(_0x8eda('0x2'));var moment=require(_0x8eda('0x3'));var BPromise=require(_0x8eda('0x4'));var rp=require(_0x8eda('0x5'));var fs=require('fs');var path=require(_0x8eda('0x6'));var rimraf=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var attributes=require(_0x8eda('0x9'));module[_0x8eda('0xa')]=function(_0x1f3556,_0x349361){return _0x1f3556[_0x8eda('0xb')]('Disposition',attributes,{'tableName':_0x8eda('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x8eda('0xd'),'fields':[_0x8eda('0xe'),_0x8eda('0xf')]},{'unique':!![],'name':'name_chat','fields':['name','ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x8eda('0xe'),_0x8eda('0x10')]},{'unique':!![],'name':_0x8eda('0x11'),'fields':['name',_0x8eda('0x12')]},{'unique':!![],'name':'name_fax','fields':[_0x8eda('0xe'),_0x8eda('0x13')]},{'unique':!![],'name':_0x8eda('0x14'),'fields':[_0x8eda('0xe'),_0x8eda('0x15')]},{'unique':!![],'name':_0x8eda('0x16'),'fields':[_0x8eda('0xe'),_0x8eda('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc99e=['exports','define','tools_dispositions','name_voice','ListId','name_chat','name_mail','name','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes'];(function(_0x329808,_0x343255){var _0x1bbad0=function(_0x458c5b){while(--_0x458c5b){_0x329808['push'](_0x329808['shift']());}};_0x1bbad0(++_0x343255);}(_0xc99e,0x6e));var _0xec99=function(_0x31ff61,_0x1f5f2e){_0x31ff61=_0x31ff61-0x0;var _0x36d1d8=_0xc99e[_0x31ff61];return _0x36d1d8;};'use strict';var _=require(_0xec99('0x0'));var util=require(_0xec99('0x1'));var logger=require(_0xec99('0x2'))(_0xec99('0x3'));var moment=require(_0xec99('0x4'));var BPromise=require(_0xec99('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec99('0x6'));var rimraf=require(_0xec99('0x7'));var config=require(_0xec99('0x8'));var attributes=require(_0xec99('0x9'));module[_0xec99('0xa')]=function(_0x39821d,_0x451dd4){return _0x39821d[_0xec99('0xb')]('Disposition',attributes,{'tableName':_0xec99('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xec99('0xd'),'fields':['name',_0xec99('0xe')]},{'unique':!![],'name':_0xec99('0xf'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0xec99('0x10'),'fields':[_0xec99('0x11'),_0xec99('0x12')]},{'unique':!![],'name':'name_sms','fields':[_0xec99('0x11'),_0xec99('0x13')]},{'unique':!![],'name':_0xec99('0x14'),'fields':[_0xec99('0x11'),_0xec99('0x15')]},{'unique':!![],'name':_0xec99('0x16'),'fields':['name',_0xec99('0x17')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xec99('0x11'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 60f1a16..cc7268b 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 _0xcc97=['debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Disposition,\x20%s,\x20%s'];(function(_0x2cd9e8,_0x3520ed){var _0x2f712f=function(_0x769f94){while(--_0x769f94){_0x2cd9e8['push'](_0x2cd9e8['shift']());}};_0x2f712f(++_0x3520ed);}(_0xcc97,0x171));var _0x7cc9=function(_0x41f268,_0x56144f){_0x41f268=_0x41f268-0x0;var _0x19e083=_0xcc97[_0x41f268];return _0x19e083;};'use strict';var _=require(_0x7cc9('0x0'));var util=require(_0x7cc9('0x1'));var moment=require('moment');var BPromise=require(_0x7cc9('0x2'));var rs=require(_0x7cc9('0x3'));var fs=require('fs');var Redis=require(_0x7cc9('0x4'));var db=require(_0x7cc9('0x5'))['db'];var utils=require(_0x7cc9('0x6'));var logger=require(_0x7cc9('0x7'))(_0x7cc9('0x8'));var config=require(_0x7cc9('0x9'));var jayson=require(_0x7cc9('0xa'));var client=jayson[_0x7cc9('0xb')][_0x7cc9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x46b37e,_0x36bf33,_0x57a118){return new BPromise(function(_0x1b45be,_0x347bba){return client['request'](_0x46b37e,_0x57a118)[_0x7cc9('0xd')](function(_0x3e9f37){logger['info'](_0x7cc9('0xe'),_0x36bf33,'request\x20sent');logger[_0x7cc9('0xf')](_0x7cc9('0x10'),_0x36bf33,'request\x20sent',JSON[_0x7cc9('0x11')](_0x3e9f37));if(_0x3e9f37[_0x7cc9('0x12')]){if(_0x3e9f37[_0x7cc9('0x12')][_0x7cc9('0x13')]===0x1f4){logger[_0x7cc9('0x12')](_0x7cc9('0xe'),_0x36bf33,_0x3e9f37[_0x7cc9('0x12')][_0x7cc9('0x14')]);return _0x347bba(_0x3e9f37[_0x7cc9('0x12')][_0x7cc9('0x14')]);}logger[_0x7cc9('0x12')](_0x7cc9('0xe'),_0x36bf33,_0x3e9f37[_0x7cc9('0x12')]['message']);return _0x1b45be(_0x3e9f37['error'][_0x7cc9('0x14')]);}else{logger[_0x7cc9('0x15')]('Disposition,\x20%s,\x20%s',_0x36bf33,_0x7cc9('0x16'));_0x1b45be(_0x3e9f37[_0x7cc9('0x17')][_0x7cc9('0x14')]);}})['catch'](function(_0x12602c){logger['error'](_0x7cc9('0xe'),_0x36bf33,_0x12602c);_0x347bba(_0x12602c);});});} \ No newline at end of file +var _0xc9bb=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Disposition,\x20%s,\x20%s','debug','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x5515e1,_0x45c360){var _0x3bd5c2=function(_0x5c0141){while(--_0x5c0141){_0x5515e1['push'](_0x5515e1['shift']());}};_0x3bd5c2(++_0x45c360);}(_0xc9bb,0x8c));var _0xbc9b=function(_0x441f45,_0x16130c){_0x441f45=_0x441f45-0x0;var _0x2bc267=_0xc9bb[_0x441f45];return _0x2bc267;};'use strict';var _=require(_0xbc9b('0x0'));var util=require(_0xbc9b('0x1'));var moment=require('moment');var BPromise=require(_0xbc9b('0x2'));var rs=require(_0xbc9b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc9b('0x4'))['db'];var utils=require(_0xbc9b('0x5'));var logger=require(_0xbc9b('0x6'))(_0xbc9b('0x7'));var config=require(_0xbc9b('0x8'));var jayson=require(_0xbc9b('0x9'));var client=jayson[_0xbc9b('0xa')][_0xbc9b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33ba5b,_0x259548,_0x22ef52){return new BPromise(function(_0x3b3028,_0x44656e){return client[_0xbc9b('0xc')](_0x33ba5b,_0x22ef52)[_0xbc9b('0xd')](function(_0x544793){logger[_0xbc9b('0xe')](_0xbc9b('0xf'),_0x259548,'request\x20sent');logger[_0xbc9b('0x10')](_0xbc9b('0x11'),_0x259548,_0xbc9b('0x12'),JSON['stringify'](_0x544793));if(_0x544793[_0xbc9b('0x13')]){if(_0x544793[_0xbc9b('0x13')][_0xbc9b('0x14')]===0x1f4){logger[_0xbc9b('0x13')](_0xbc9b('0xf'),_0x259548,_0x544793[_0xbc9b('0x13')]['message']);return _0x44656e(_0x544793['error']['message']);}logger[_0xbc9b('0x13')]('Disposition,\x20%s,\x20%s',_0x259548,_0x544793[_0xbc9b('0x13')][_0xbc9b('0x15')]);return _0x3b3028(_0x544793[_0xbc9b('0x13')]['message']);}else{logger['info']('Disposition,\x20%s,\x20%s',_0x259548,'request\x20sent');_0x3b3028(_0x544793[_0xbc9b('0x16')][_0xbc9b('0x15')]);}})[_0xbc9b('0x17')](function(_0x350c39){logger[_0xbc9b('0x13')]('Disposition,\x20%s,\x20%s',_0x259548,_0x350c39);_0x44656e(_0x350c39);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 2570d0b..057f9d6 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 _0xeb38=['get','isAuthenticated','index','/:id','show','post','create','put','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller'];(function(_0x5ae27d,_0x27dc74){var _0x5138c5=function(_0x332aa4){while(--_0x332aa4){_0x5ae27d['push'](_0x5ae27d['shift']());}};_0x5138c5(++_0x27dc74);}(_0xeb38,0x190));var _0x8eb3=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xeb38[_0x12f688];return _0x59c3de;};'use strict';var multer=require(_0x8eb3('0x0'));var util=require(_0x8eb3('0x1'));var path=require('path');var timeout=require(_0x8eb3('0x2'));var express=require('express');var router=express[_0x8eb3('0x3')]();var auth=require(_0x8eb3('0x4'));var interaction=require(_0x8eb3('0x5'));var config=require(_0x8eb3('0x6'));var controller=require(_0x8eb3('0x7'));router[_0x8eb3('0x8')]('/',auth[_0x8eb3('0x9')](),controller[_0x8eb3('0xa')]);router['get'](_0x8eb3('0xb'),auth[_0x8eb3('0x9')](),controller[_0x8eb3('0xc')]);router[_0x8eb3('0xd')]('/',auth['isAuthenticated'](),controller[_0x8eb3('0xe')]);router[_0x8eb3('0xf')](_0x8eb3('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x8eb3('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x8eb3('0x10')]=router; \ No newline at end of file +var _0x3c7d=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x1d78ab,_0x274068){var _0x5d0f02=function(_0x1eb378){while(--_0x1eb378){_0x1d78ab['push'](_0x1d78ab['shift']());}};_0x5d0f02(++_0x274068);}(_0x3c7d,0x1f2));var _0xd3c7=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x3c7d[_0x409353];return _0x4f4b59;};'use strict';var multer=require(_0xd3c7('0x0'));var util=require(_0xd3c7('0x1'));var path=require(_0xd3c7('0x2'));var timeout=require(_0xd3c7('0x3'));var express=require(_0xd3c7('0x4'));var router=express[_0xd3c7('0x5')]();var auth=require(_0xd3c7('0x6'));var interaction=require(_0xd3c7('0x7'));var config=require(_0xd3c7('0x8'));var controller=require('./disposition.controller');router[_0xd3c7('0x9')]('/',auth[_0xd3c7('0xa')](),controller[_0xd3c7('0xb')]);router['get'](_0xd3c7('0xc'),auth['isAuthenticated'](),controller[_0xd3c7('0xd')]);router[_0xd3c7('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd3c7('0xf')](_0xd3c7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd3c7('0x10')](_0xd3c7('0xc'),auth[_0xd3c7('0xa')](),controller[_0xd3c7('0x11')]);module[_0xd3c7('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 98f4c22..5a7a71c 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 _0x8de8=['sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','INTEGER','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition'];(function(_0x4ff7b8,_0x326ca1){var _0x1692a9=function(_0x2a1d61){while(--_0x2a1d61){_0x4ff7b8['push'](_0x4ff7b8['shift']());}};_0x1692a9(++_0x326ca1);}(_0x8de8,0xe6));var _0x88de=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8de8[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x88de('0x0'));module[_0x88de('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x88de('0x2')]},'ecm':{'type':Sequelize[_0x88de('0x3')]('yes','no'),'defaultValue':_0x88de('0x4')},'headerinfo':{'type':Sequelize[_0x88de('0x2')],'defaultValue':_0x88de('0x5')},'localstationid':{'type':Sequelize[_0x88de('0x2')],'unique':_0x88de('0x6')},'minrate':{'type':Sequelize['ENUM'](_0x88de('0x7'),_0x88de('0x8'),_0x88de('0x9'),_0x88de('0xa'),'12000','14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x88de('0x3')](_0x88de('0x7'),_0x88de('0x8'),_0x88de('0x9'),_0x88de('0xa'),_0x88de('0xb'),_0x88de('0xc')),'defaultValue':_0x88de('0xc')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x88de('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x88de('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x88de('0xe'),'IAX',_0x88de('0xf'),_0x88de('0x10')),'defaultValue':_0x88de('0xe')},'key':{'type':Sequelize[_0x88de('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x88de('0x11')],'defaultValue':function(){return _0x88de('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x88de('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x88de('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x88de('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x88de('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x88de('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x88de('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x88de('0x13')],'defaultValue':![],'comment':_0x88de('0x14'),'set':function(_0x1d965a){if(!_0x1d965a)this[_0x88de('0x15')]('mandatoryDispositionPauseId',null);this[_0x88de('0x15')](_0x88de('0x16'),_0x1d965a);}}}; \ No newline at end of file +var _0x01d8=['mandatoryDispositionPauseId','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','4800','7200','12000','9600','14400','v17,v27,v29','IAX','DADHI','KHOMP','SIP','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'];(function(_0x3e94c1,_0x5b87f8){var _0x25fc60=function(_0x11afce){while(--_0x11afce){_0x3e94c1['push'](_0x3e94c1['shift']());}};_0x25fc60(++_0x5b87f8);}(_0x01d8,0x1bb));var _0x801d=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x01d8[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x801d('0x0'));module[_0x801d('0x1')]={'name':{'type':Sequelize[_0x801d('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x801d('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x801d('0x3'),'no'),'defaultValue':_0x801d('0x3')},'headerinfo':{'type':Sequelize[_0x801d('0x2')],'defaultValue':_0x801d('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x801d('0x5')},'minrate':{'type':Sequelize[_0x801d('0x6')](_0x801d('0x7'),_0x801d('0x8'),_0x801d('0x9'),'9600',_0x801d('0xa'),'14400'),'defaultValue':_0x801d('0x8')},'maxrate':{'type':Sequelize[_0x801d('0x6')](_0x801d('0x7'),'4800','7200',_0x801d('0xb'),_0x801d('0xa'),_0x801d('0xc')),'defaultValue':_0x801d('0xc')},'modem':{'type':Sequelize[_0x801d('0x2')],'defaultValue':_0x801d('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x801d('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x801d('0x6')]('SIP',_0x801d('0xe'),_0x801d('0xf'),_0x801d('0x10')),'defaultValue':_0x801d('0x11')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x801d('0x12')],'defaultValue':function(){return _0x801d('0x13');}},'notificationSound':{'type':Sequelize[_0x801d('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x801d('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x801d('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x801d('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x801d('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x801d('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x801d('0x15')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x801d('0x15')],'allowNull':!![],'defaultValue':null,'comment':_0x801d('0x16')},'mandatoryDisposition':{'type':Sequelize[_0x801d('0x14')],'defaultValue':![],'comment':_0x801d('0x17'),'set':function(_0x364d95){if(!_0x364d95)this[_0x801d('0x18')](_0x801d('0x19'),null);this['setDataValue']('mandatoryDisposition',_0x364d95);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 25bdb73..3795a51 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 _0x3e74=['getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./faxAccount.socket','register','http','client','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','stack','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','filter','merge','where','VIRTUAL','show','keys','rawAttributes','includeAll','include','options','find','create','body','user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','getDispositions','findOne','Disposition','length','sort','pick','FaxAccountId','findAll','rows','removeDispositions','ids','getAnswers','nolimit','CannedAnswer','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','FaxApplication','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','app','system','description','Fax\x20Extension','push','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','t38timeout','sequelize','transaction','VoiceExtension','bulkCreate','updateAccountApplications','createdAt','TrunkId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','send','CmList','CmContact','Contacts','DESC','attachments','join','root','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','List','ListId','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove'];(function(_0x4708b1,_0x4cc840){var _0x59cac5=function(_0x3680cc){while(--_0x3680cc){_0x4708b1['push'](_0x4708b1['shift']());}};_0x59cac5(++_0x4cc840);}(_0x3e74,0x175));var _0x43e7=function(_0x41d21b,_0x1ce3c3){_0x41d21b=_0x41d21b-0x0;var _0x563ebc=_0x3e74[_0x41d21b];return _0x563ebc;};'use strict';var pdf=require(_0x43e7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x43e7('0x1'));var zipdir=require(_0x43e7('0x2'));var jsonpatch=require(_0x43e7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x43e7('0x4'));var Mustache=require('mustache');var util=require(_0x43e7('0x5'));var path=require(_0x43e7('0x6'));var sox=require(_0x43e7('0x7'));var csv=require(_0x43e7('0x8'));var ejs=require(_0x43e7('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x8'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];config[_0x43e7('0x15')]=_[_0x43e7('0x16')](config[_0x43e7('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x43e7('0x15')]));require(_0x43e7('0x17'))[_0x43e7('0x18')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x43e7('0x19')]({'port':0x232c});var client9002=jayson[_0x43e7('0x1a')][_0x43e7('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x328445,_0x4de324,_0x5c4eaa,_0xdf16c){return new BPromise(function(_0x264575,_0x273a32){var _0x5d346f=_0xdf16c||client;return _0x5d346f['request'](_0x328445,_0x5c4eaa)[_0x43e7('0x1b')](function(_0x1ca758){logger[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x4de324,_0x43e7('0x1e'));logger[_0x43e7('0x1f')](_0x43e7('0x20'),_0x4de324,_0x43e7('0x1e'),JSON[_0x43e7('0x21')](_0x1ca758));if(_0x1ca758[_0x43e7('0x22')]){if(_0x1ca758[_0x43e7('0x22')][_0x43e7('0x23')]===0x1f4){logger['error'](_0x43e7('0x1d'),_0x4de324,_0x1ca758[_0x43e7('0x22')]['message']);return _0x273a32(_0x1ca758[_0x43e7('0x22')][_0x43e7('0x24')]);}logger[_0x43e7('0x22')](_0x43e7('0x1d'),_0x4de324,_0x1ca758[_0x43e7('0x22')][_0x43e7('0x24')]);return _0x264575(_0x1ca758['error'][_0x43e7('0x24')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x4de324,_0x43e7('0x1e'));_0x264575(_0x1ca758[_0x43e7('0x25')]['message']);}})[_0x43e7('0x26')](function(_0x4ca5cf){logger[_0x43e7('0x22')]('FaxAccount,\x20%s,\x20%s',_0x4de324,_0x4ca5cf);_0x273a32(_0x4ca5cf);});});}function respondWithStatusCode(_0x1af208,_0x1b5f50){_0x1b5f50=_0x1b5f50||0xcc;return function(_0x20888b){if(_0x20888b){return _0x1af208[_0x43e7('0x27')](_0x1b5f50);}return _0x1af208['status'](_0x1b5f50)['end']();};}function respondWithResult(_0x805b54,_0x501551){_0x501551=_0x501551||0xc8;return function(_0x2dd5f){if(_0x2dd5f){return _0x805b54[_0x43e7('0x28')](_0x501551)[_0x43e7('0x29')](_0x2dd5f);}};}function respondWithFilteredResult(_0xb1fc63,_0x5087d7){return function(_0x33a1a5){if(_0x33a1a5){var _0x4690a6=_0x33a1a5[_0x43e7('0x2a')],_0x45b675=_0x5087d7[_0x43e7('0x2b')],_0x50f9f5=_0x5087d7[_0x43e7('0x2b')]+_0x5087d7[_0x43e7('0x2c')],_0x442c3b;if(_0x50f9f5>=_0x4690a6){_0x50f9f5=_0x4690a6;_0x442c3b=0xc8;}else{_0x442c3b=0xce;}_0xb1fc63[_0x43e7('0x28')](_0x442c3b);return _0xb1fc63[_0x43e7('0x2d')](_0x43e7('0x2e'),_0x45b675+'-'+_0x50f9f5+'/'+_0x4690a6)[_0x43e7('0x29')](_0x33a1a5);}return null;};}function patchUpdates(_0x208706){return function(_0x4bdb17){try{jsonpatch[_0x43e7('0x2f')](_0x4bdb17,_0x208706,!![]);}catch(_0x44f6b0){return BPromise[_0x43e7('0x30')](_0x44f6b0);}return _0x4bdb17[_0x43e7('0x31')]();};}function saveUpdates(_0x4251c8,_0x4c8650){return function(_0x1eba65){if(_0x1eba65){return _0x1eba65[_0x43e7('0x32')](_0x4251c8)[_0x43e7('0x1b')](function(_0x3f280d){return _0x3f280d;});}return null;};}function removeEntity(_0x4c61b9,_0x5a7342){return function(_0x5e203f){if(_0x5e203f){return _0x5e203f[_0x43e7('0x33')]()[_0x43e7('0x1b')](function(){var _0x117c07=_0x5e203f[_0x43e7('0x34')]({'plain':!![]});var _0x108313=_0x43e7('0x35');return db['UserProfileResource']['destroy']({'where':{'type':_0x108313,'resourceId':_0x117c07['id']}})['then'](function(){return _0x5e203f;});})['then'](function(){_0x4c61b9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cb753,_0x14d888){return function(_0x49cda6){if(!_0x49cda6){_0x5cb753[_0x43e7('0x27')](0x194);}return _0x49cda6;};}function handleError(_0x8e9f40,_0x31bc78){_0x31bc78=_0x31bc78||0x1f4;return function(_0x50a2d0){logger[_0x43e7('0x22')](_0x50a2d0[_0x43e7('0x36')]);if(_0x50a2d0[_0x43e7('0x37')]){delete _0x50a2d0['name'];}_0x8e9f40['status'](_0x31bc78)['send'](_0x50a2d0);};}exports[_0x43e7('0x38')]=function(_0xfe70e9,_0x199ff6){var _0x16cdba={'include':[{'model':db[_0x43e7('0x39')],'as':_0x43e7('0x3a')}]},_0x1b1440={},_0x1ed538={'count':0x0,'rows':[]};var _0x55c798=_[_0x43e7('0x3b')](db[_0x43e7('0x3c')]['rawAttributes'],function(_0x2d54c1){return{'name':_0x2d54c1['fieldName'],'type':_0x2d54c1[_0x43e7('0x3d')][_0x43e7('0x3e')]};});_0x1b1440[_0x43e7('0x3f')]=_[_0x43e7('0x3b')](_0x55c798,_0x43e7('0x37'));_0x1b1440[_0x43e7('0x40')]=_['keys'](_0xfe70e9['query']);_0x1b1440[_0x43e7('0x41')]=_[_0x43e7('0x42')](_0x1b1440[_0x43e7('0x3f')],_0x1b1440[_0x43e7('0x40')]);_0x16cdba[_0x43e7('0x43')]=_['intersection'](_0x1b1440[_0x43e7('0x3f')],qs[_0x43e7('0x44')](_0xfe70e9['query'][_0x43e7('0x44')]));_0x16cdba['attributes']=_0x16cdba[_0x43e7('0x43')]['length']?_0x16cdba[_0x43e7('0x43')]:_0x1b1440[_0x43e7('0x3f')];if(!_0xfe70e9[_0x43e7('0x40')][_0x43e7('0x45')]('nolimit')){_0x16cdba['limit']=qs[_0x43e7('0x2c')](_0xfe70e9[_0x43e7('0x40')][_0x43e7('0x2c')]);_0x16cdba[_0x43e7('0x2b')]=qs['offset'](_0xfe70e9['query']['offset']);}_0x16cdba[_0x43e7('0x46')]=qs['sort'](_0xfe70e9[_0x43e7('0x40')]['sort']);_0x16cdba['where']=qs[_0x43e7('0x41')](_['pick'](_0xfe70e9[_0x43e7('0x40')],_0x1b1440[_0x43e7('0x41')]),_0x55c798);if(_0xfe70e9[_0x43e7('0x40')][_0x43e7('0x47')]){_0x16cdba['where']=_[_0x43e7('0x48')](_0x16cdba[_0x43e7('0x49')],{'$or':_[_0x43e7('0x3b')](_0x55c798,function(_0x1fd277){if(_0x1fd277[_0x43e7('0x3d')]!==_0x43e7('0x4a')){var _0x51eef4={};_0x51eef4[_0x1fd277['name']]={'$like':'%'+_0xfe70e9[_0x43e7('0x40')][_0x43e7('0x47')]+'%'};return _0x51eef4;}})});}_0x16cdba=_[_0x43e7('0x48')]({},_0x16cdba,_0xfe70e9['options']);var _0x5c1c18={'where':_0x16cdba['where']};return db[_0x43e7('0x3c')][_0x43e7('0x2a')](_0x5c1c18)['then'](function(_0x351ca2){_0x1ed538[_0x43e7('0x2a')]=_0x351ca2;if(_0xfe70e9[_0x43e7('0x40')]['includeAll']){_0x16cdba['include']=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x16cdba);})[_0x43e7('0x1b')](function(_0xe955fc){_0x1ed538['rows']=_0xe955fc;return _0x1ed538;})[_0x43e7('0x1b')](respondWithFilteredResult(_0x199ff6,_0x16cdba))[_0x43e7('0x26')](handleError(_0x199ff6,null));};exports[_0x43e7('0x4b')]=function(_0x895f41,_0x4a0ce5){var _0x2718d5={'raw':![],'where':{'id':_0x895f41['params']['id']},'include':[{'model':db[_0x43e7('0x39')],'as':_0x43e7('0x3a')}]},_0x483f20={};_0x483f20[_0x43e7('0x3f')]=_[_0x43e7('0x4c')](db[_0x43e7('0x3c')][_0x43e7('0x4d')]);_0x483f20[_0x43e7('0x40')]=_[_0x43e7('0x4c')](_0x895f41[_0x43e7('0x40')]);_0x483f20[_0x43e7('0x41')]=_['intersection'](_0x483f20[_0x43e7('0x3f')],_0x483f20[_0x43e7('0x40')]);_0x2718d5['attributes']=_[_0x43e7('0x42')](_0x483f20['model'],qs[_0x43e7('0x44')](_0x895f41[_0x43e7('0x40')][_0x43e7('0x44')]));_0x2718d5[_0x43e7('0x43')]=_0x2718d5[_0x43e7('0x43')]['length']?_0x2718d5['attributes']:_0x483f20[_0x43e7('0x3f')];if(_0x895f41[_0x43e7('0x40')][_0x43e7('0x4e')]){_0x2718d5[_0x43e7('0x4f')]=[{'all':!![]}];}_0x2718d5=_[_0x43e7('0x48')]({},_0x2718d5,_0x895f41[_0x43e7('0x50')]);return db[_0x43e7('0x3c')][_0x43e7('0x51')](_0x2718d5)[_0x43e7('0x1b')](handleEntityNotFound(_0x4a0ce5,null))[_0x43e7('0x1b')](respondWithResult(_0x4a0ce5,null))[_0x43e7('0x26')](handleError(_0x4a0ce5,null));};exports['create']=function(_0x1ec35a,_0x2da2f3){return db['FaxAccount'][_0x43e7('0x52')](_0x1ec35a[_0x43e7('0x53')],{})[_0x43e7('0x1b')](function(_0x558d54){var _0x5d63c6=_0x1ec35a[_0x43e7('0x54')][_0x43e7('0x34')]({'plain':!![]});if(!_0x5d63c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d63c6[_0x43e7('0x55')]==='user'){var _0x49a6ce=_0x558d54[_0x43e7('0x34')]({'plain':!![]});var _0x4b6b7f=_0x43e7('0x35');return db[_0x43e7('0x56')][_0x43e7('0x51')]({'where':{'name':_0x4b6b7f,'userProfileId':_0x5d63c6['userProfileId']},'raw':!![]})[_0x43e7('0x1b')](function(_0xdb9fbe){if(_0xdb9fbe&&_0xdb9fbe['autoAssociation']===0x0){return db[_0x43e7('0x57')][_0x43e7('0x52')]({'name':_0x49a6ce[_0x43e7('0x37')],'resourceId':_0x49a6ce['id'],'type':_0xdb9fbe['name'],'sectionId':_0xdb9fbe['id']},{})['then'](function(){return _0x558d54;});}else{return _0x558d54;}})['catch'](function(_0x2ada55){logger[_0x43e7('0x22')](_0x43e7('0x58'),_0x2ada55);throw _0x2ada55;});}return _0x558d54;})[_0x43e7('0x1b')](respondWithResult(_0x2da2f3,0xc9))['catch'](handleError(_0x2da2f3,null));};exports['update']=function(_0x1b27da,_0x8b50bb){if(_0x1b27da[_0x43e7('0x53')]['id']){delete _0x1b27da[_0x43e7('0x53')]['id'];}return db['FaxAccount'][_0x43e7('0x51')]({'where':{'id':_0x1b27da[_0x43e7('0x59')]['id']},'include':[{'model':db[_0x43e7('0x39')],'as':_0x43e7('0x3a')}]})[_0x43e7('0x1b')](handleEntityNotFound(_0x8b50bb,null))[_0x43e7('0x1b')](saveUpdates(_0x1b27da[_0x43e7('0x53')],null))[_0x43e7('0x1b')](respondWithResult(_0x8b50bb,null))[_0x43e7('0x26')](handleError(_0x8b50bb,null));};exports[_0x43e7('0x33')]=function(_0x252f00,_0x57fdfe){return db['FaxAccount'][_0x43e7('0x51')]({'where':{'id':_0x252f00['params']['id']}})['then'](handleEntityNotFound(_0x57fdfe,null))['then'](removeEntity(_0x57fdfe,null))[_0x43e7('0x26')](handleError(_0x57fdfe,null));};exports[_0x43e7('0x5a')]=function(_0x5d7b37,_0xfe5a8d){return db[_0x43e7('0x3c')][_0x43e7('0x5a')]()['then'](respondWithResult(_0xfe5a8d,null))[_0x43e7('0x26')](handleError(_0xfe5a8d,null));};exports[_0x43e7('0x5b')]=function(_0x289f86,_0xc9723,_0x2f43d7){if(_0x289f86[_0x43e7('0x53')]['id']){delete _0x289f86[_0x43e7('0x53')]['id'];}return db['FaxAccount'][_0x43e7('0x51')]({'where':{'id':_0x289f86[_0x43e7('0x59')]['id']}})[_0x43e7('0x1b')](handleEntityNotFound(_0xc9723,null))['then'](function(_0x56b06d){if(_0x56b06d){_0x289f86[_0x43e7('0x53')]['FaxAccountId']=_0x56b06d['id'];return db['Disposition'][_0x43e7('0x52')](_0x289f86[_0x43e7('0x53')]);}})['then'](respondWithResult(_0xc9723,null))[_0x43e7('0x26')](handleError(_0xc9723,null));};exports[_0x43e7('0x5c')]=function(_0x1e2fed,_0x3401ec,_0x16499c){var _0x13ef5c={'raw':![],'where':{}};var _0x398a78={};var _0x4ce33c={'count':0x0,'rows':[]};return db[_0x43e7('0x3c')][_0x43e7('0x5d')]({'where':{'id':_0x1e2fed['params']['id']}})[_0x43e7('0x1b')](handleEntityNotFound(_0x3401ec,null))['then'](function(_0x26ee52){if(_0x26ee52){_0x398a78[_0x43e7('0x3f')]=_[_0x43e7('0x4c')](db[_0x43e7('0x5e')]['rawAttributes']);_0x398a78[_0x43e7('0x40')]=_[_0x43e7('0x4c')](_0x1e2fed[_0x43e7('0x40')]);_0x398a78['filters']=_[_0x43e7('0x42')](_0x398a78[_0x43e7('0x3f')],_0x398a78[_0x43e7('0x40')]);_0x13ef5c[_0x43e7('0x43')]=_[_0x43e7('0x42')](_0x398a78['model'],qs[_0x43e7('0x44')](_0x1e2fed[_0x43e7('0x40')][_0x43e7('0x44')]));_0x13ef5c[_0x43e7('0x43')]=_0x13ef5c[_0x43e7('0x43')][_0x43e7('0x5f')]?_0x13ef5c[_0x43e7('0x43')]:_0x398a78['model'];if(!_0x1e2fed['query'][_0x43e7('0x45')]('nolimit')){_0x13ef5c['limit']=qs['limit'](_0x1e2fed[_0x43e7('0x40')][_0x43e7('0x2c')]);_0x13ef5c[_0x43e7('0x2b')]=qs[_0x43e7('0x2b')](_0x1e2fed[_0x43e7('0x40')][_0x43e7('0x2b')]);}_0x13ef5c['order']=qs[_0x43e7('0x60')](_0x1e2fed[_0x43e7('0x40')][_0x43e7('0x60')]);_0x13ef5c['where']=qs[_0x43e7('0x41')](_[_0x43e7('0x61')](_0x1e2fed[_0x43e7('0x40')],_0x398a78[_0x43e7('0x41')]));_0x13ef5c[_0x43e7('0x49')][_0x43e7('0x62')]=_0x26ee52['id'];if(_0x1e2fed[_0x43e7('0x40')][_0x43e7('0x47')]){_0x13ef5c['where']=_['merge'](_0x13ef5c['where'],{'$or':_[_0x43e7('0x3b')](_0x13ef5c[_0x43e7('0x43')],function(_0x5355ff){var _0x3fe23f={};_0x3fe23f[_0x5355ff]={'$like':'%'+_0x1e2fed[_0x43e7('0x40')][_0x43e7('0x47')]+'%'};return _0x3fe23f;})});}_0x13ef5c=_[_0x43e7('0x48')]({},_0x13ef5c,_0x1e2fed['options']);return db['Disposition']['count']({'where':_0x13ef5c[_0x43e7('0x49')]})[_0x43e7('0x1b')](function(_0x508566){_0x4ce33c['count']=_0x508566;if(_0x1e2fed[_0x43e7('0x40')][_0x43e7('0x4e')]){_0x13ef5c[_0x43e7('0x4f')]=[{'all':!![]}];}return db['Disposition'][_0x43e7('0x63')](_0x13ef5c);})[_0x43e7('0x1b')](function(_0x401654){_0x4ce33c[_0x43e7('0x64')]=_0x401654;return _0x4ce33c;});}})['then'](respondWithFilteredResult(_0x3401ec,_0x13ef5c))[_0x43e7('0x26')](handleError(_0x3401ec,null));};exports['removeDispositions']=function(_0xa66309,_0x3ab790,_0x24a168){return db[_0x43e7('0x3c')][_0x43e7('0x51')]({'where':{'id':_0xa66309[_0x43e7('0x59')]['id']}})[_0x43e7('0x1b')](handleEntityNotFound(_0x3ab790,null))['then'](function(_0x109c86){if(_0x109c86){return _0x109c86[_0x43e7('0x65')](_0xa66309[_0x43e7('0x40')][_0x43e7('0x66')]);}})['then'](respondWithStatusCode(_0x3ab790,null))['catch'](handleError(_0x3ab790,null));};exports['addAnswer']=function(_0x1262f,_0x5f5901,_0x240f0d){if(_0x1262f[_0x43e7('0x53')]['id']){delete _0x1262f[_0x43e7('0x53')]['id'];}return db[_0x43e7('0x3c')][_0x43e7('0x51')]({'where':{'id':_0x1262f[_0x43e7('0x59')]['id']}})[_0x43e7('0x1b')](handleEntityNotFound(_0x5f5901,null))[_0x43e7('0x1b')](function(_0x363af5){if(_0x363af5){_0x1262f[_0x43e7('0x53')][_0x43e7('0x62')]=_0x363af5['id'];return db['CannedAnswer'][_0x43e7('0x52')](_0x1262f[_0x43e7('0x53')]);}})[_0x43e7('0x1b')](respondWithResult(_0x5f5901,null))[_0x43e7('0x26')](handleError(_0x5f5901,null));};exports[_0x43e7('0x67')]=function(_0x4ea4a9,_0x5e04ec,_0x162a27){var _0x3e3c82={'raw':![],'where':{}};var _0x5c7f0a={};var _0x100c4d={'count':0x0,'rows':[]};return db[_0x43e7('0x3c')]['findOne']({'where':{'id':_0x4ea4a9['params']['id']}})[_0x43e7('0x1b')](handleEntityNotFound(_0x5e04ec,null))[_0x43e7('0x1b')](function(_0x22947e){if(_0x22947e){_0x5c7f0a[_0x43e7('0x3f')]=_[_0x43e7('0x4c')](db['CannedAnswer']['rawAttributes']);_0x5c7f0a[_0x43e7('0x40')]=_[_0x43e7('0x4c')](_0x4ea4a9[_0x43e7('0x40')]);_0x5c7f0a[_0x43e7('0x41')]=_['intersection'](_0x5c7f0a[_0x43e7('0x3f')],_0x5c7f0a[_0x43e7('0x40')]);_0x3e3c82[_0x43e7('0x43')]=_[_0x43e7('0x42')](_0x5c7f0a['model'],qs[_0x43e7('0x44')](_0x4ea4a9[_0x43e7('0x40')][_0x43e7('0x44')]));_0x3e3c82[_0x43e7('0x43')]=_0x3e3c82[_0x43e7('0x43')]['length']?_0x3e3c82[_0x43e7('0x43')]:_0x5c7f0a[_0x43e7('0x3f')];if(!_0x4ea4a9['query'][_0x43e7('0x45')](_0x43e7('0x68'))){_0x3e3c82[_0x43e7('0x2c')]=qs[_0x43e7('0x2c')](_0x4ea4a9['query'][_0x43e7('0x2c')]);_0x3e3c82['offset']=qs[_0x43e7('0x2b')](_0x4ea4a9[_0x43e7('0x40')][_0x43e7('0x2b')]);}_0x3e3c82[_0x43e7('0x46')]=qs[_0x43e7('0x60')](_0x4ea4a9[_0x43e7('0x40')][_0x43e7('0x60')]);_0x3e3c82[_0x43e7('0x49')]=qs[_0x43e7('0x41')](_['pick'](_0x4ea4a9[_0x43e7('0x40')],_0x5c7f0a[_0x43e7('0x41')]));_0x3e3c82[_0x43e7('0x49')][_0x43e7('0x62')]=_0x22947e['id'];if(_0x4ea4a9['query']['filter']){_0x3e3c82[_0x43e7('0x49')]=_[_0x43e7('0x48')](_0x3e3c82[_0x43e7('0x49')],{'$or':_['map'](_0x3e3c82[_0x43e7('0x43')],function(_0x5202c5){var _0x48783a={};_0x48783a[_0x5202c5]={'$like':'%'+_0x4ea4a9['query'][_0x43e7('0x47')]+'%'};return _0x48783a;})});}_0x3e3c82=_['merge']({},_0x3e3c82,_0x4ea4a9[_0x43e7('0x50')]);return db[_0x43e7('0x69')][_0x43e7('0x2a')]({'where':_0x3e3c82[_0x43e7('0x49')]})[_0x43e7('0x1b')](function(_0x482adc){_0x100c4d['count']=_0x482adc;if(_0x4ea4a9[_0x43e7('0x40')][_0x43e7('0x4e')]){_0x3e3c82['include']=[{'all':!![]}];}return db[_0x43e7('0x69')][_0x43e7('0x63')](_0x3e3c82);})[_0x43e7('0x1b')](function(_0x3310ef){_0x100c4d[_0x43e7('0x64')]=_0x3310ef;return _0x100c4d;});}})[_0x43e7('0x1b')](respondWithFilteredResult(_0x5e04ec,_0x3e3c82))[_0x43e7('0x26')](handleError(_0x5e04ec,null));};exports[_0x43e7('0x6a')]=function(_0x39ce5e,_0x284617,_0x610819){return db[_0x43e7('0x3c')][_0x43e7('0x51')]({'where':{'id':_0x39ce5e[_0x43e7('0x59')]['id']}})[_0x43e7('0x1b')](handleEntityNotFound(_0x284617,null))[_0x43e7('0x1b')](function(_0x3286b1){if(_0x3286b1){return _0x3286b1[_0x43e7('0x6a')](_0x39ce5e[_0x43e7('0x40')][_0x43e7('0x66')]);}})[_0x43e7('0x1b')](respondWithStatusCode(_0x284617,null))[_0x43e7('0x26')](handleError(_0x284617,null));};exports['addInteraction']=function(_0xefc922,_0x3c8b27,_0x3a81fc){return db[_0x43e7('0x6b')]['find']({'where':{'id':_0xefc922[_0x43e7('0x59')]['id']}})['then'](handleEntityNotFound(_0x3c8b27,null))[_0x43e7('0x1b')](function(_0x42413e){if(_0x42413e){return _0x42413e[_0x43e7('0x6c')](_0xefc922[_0x43e7('0x53')][_0x43e7('0x66')],_[_0x43e7('0x6d')](_0xefc922['body'],[_0x43e7('0x66'),'id'])||{});}})[_0x43e7('0x1b')](respondWithResult(_0x3c8b27,null))[_0x43e7('0x26')](handleError(_0x3c8b27,null));};exports[_0x43e7('0x6e')]=function(_0x16adad,_0x5a40c2,_0x59a3f8){var _0xcccf84={'raw':![],'where':{}};var _0x564639={};var _0x195e6f={'count':0x0,'rows':[]};return db[_0x43e7('0x3c')][_0x43e7('0x5d')]({'where':{'id':_0x16adad[_0x43e7('0x59')]['id']}})['then'](handleEntityNotFound(_0x5a40c2,null))['then'](function(_0x52ddb7){if(_0x52ddb7){_0x564639[_0x43e7('0x3f')]=_['keys'](db['FaxInteraction']['rawAttributes']);_0x564639[_0x43e7('0x40')]=_[_0x43e7('0x4c')](_0x16adad['query']);_0x564639[_0x43e7('0x41')]=_['intersection'](_0x564639[_0x43e7('0x3f')],_0x564639[_0x43e7('0x40')]);_0xcccf84[_0x43e7('0x43')]=_[_0x43e7('0x42')](_0x564639[_0x43e7('0x3f')],qs['fields'](_0x16adad[_0x43e7('0x40')][_0x43e7('0x44')]));_0xcccf84[_0x43e7('0x43')]=_0xcccf84['attributes']['length']?_0xcccf84[_0x43e7('0x43')]:_0x564639[_0x43e7('0x3f')];if(!_0x16adad[_0x43e7('0x40')][_0x43e7('0x45')]('nolimit')){_0xcccf84[_0x43e7('0x2c')]=qs[_0x43e7('0x2c')](_0x16adad[_0x43e7('0x40')]['limit']);_0xcccf84[_0x43e7('0x2b')]=qs[_0x43e7('0x2b')](_0x16adad[_0x43e7('0x40')][_0x43e7('0x2b')]);}_0xcccf84['order']=qs[_0x43e7('0x60')](_0x16adad['query'][_0x43e7('0x60')]);_0xcccf84[_0x43e7('0x49')]=qs['filters'](_['pick'](_0x16adad[_0x43e7('0x40')],_0x564639[_0x43e7('0x41')]));_0xcccf84[_0x43e7('0x49')][_0x43e7('0x62')]=_0x52ddb7['id'];if(_0x16adad[_0x43e7('0x40')][_0x43e7('0x47')]){_0xcccf84[_0x43e7('0x49')]=_[_0x43e7('0x48')](_0xcccf84[_0x43e7('0x49')],{'$or':_[_0x43e7('0x3b')](_0xcccf84[_0x43e7('0x43')],function(_0x4a3075){var _0x7a46b3={};_0x7a46b3[_0x4a3075]={'$like':'%'+_0x16adad['query'][_0x43e7('0x47')]+'%'};return _0x7a46b3;})});}_0xcccf84=_[_0x43e7('0x48')]({},_0xcccf84,_0x16adad[_0x43e7('0x50')]);return db['FaxInteraction'][_0x43e7('0x2a')]({'where':_0xcccf84[_0x43e7('0x49')]})[_0x43e7('0x1b')](function(_0x352405){_0x195e6f['count']=_0x352405;if(_0x16adad[_0x43e7('0x40')][_0x43e7('0x4e')]){_0xcccf84['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x43e7('0x6f')],'as':_0x43e7('0x70'),'attributes':[_0x43e7('0x37'),_0x43e7('0x71'),_0x43e7('0x72')],'required':![]},{'model':db[_0x43e7('0x73')],'as':_0x43e7('0x74'),'attributes':['id',_0x43e7('0x37'),'color'],'where':_0x16adad[_0x43e7('0x40')][_0x43e7('0x75')]?{'id':_0x16adad[_0x43e7('0x40')][_0x43e7('0x75')]}:undefined,'required':_0x16adad['query']['tag']?!![]:![]}];}return db[_0x43e7('0x6b')][_0x43e7('0x63')](_0xcccf84);})[_0x43e7('0x1b')](function(_0x2e9903){_0x195e6f['rows']=_0x2e9903;return _0x195e6f;});}})[_0x43e7('0x1b')](respondWithFilteredResult(_0x5a40c2,_0xcccf84))[_0x43e7('0x26')](handleError(_0x5a40c2,null));};exports[_0x43e7('0x76')]=function(_0x3e0115,_0x45d70a,_0x44788f){return db['FaxAccount'][_0x43e7('0x5d')]({'where':{'id':_0x3e0115['params']['id']}})['then'](handleEntityNotFound(_0x45d70a,null))[_0x43e7('0x1b')](function(_0x2dcabe){if(_0x2dcabe){return db['sequelize']['transaction'](function(_0x3a8cd1){return db[_0x43e7('0x77')]['destroy']({'where':{'FaxAccountId':_0x3e0115[_0x43e7('0x59')]['id']},'transaction':_0x3a8cd1})[_0x43e7('0x1b')](function(_0x302138){var _0x2230b9=_['map'](_0x3e0115['body'],function(_0x2a084b){_0x2a084b[_0x43e7('0x62')]=_0x3e0115[_0x43e7('0x59')]['id'];return _0x2a084b;});return db['FaxApplication']['bulkCreate'](_0x2230b9,{'transaction':_0x3a8cd1});});})[_0x43e7('0x1b')](function(){return db[_0x43e7('0x77')][_0x43e7('0x78')]({'where':{'FaxAccountId':_0x3e0115[_0x43e7('0x59')]['id']},'order':_0x43e7('0x79')});});}})[_0x43e7('0x1b')](respondWithResult(_0x45d70a,null))[_0x43e7('0x26')](handleError(_0x45d70a,null));};exports[_0x43e7('0x7a')]=function(_0x5caba2,_0x537186,_0x5c3f65){var _0x2c6080={};var _0x50c319={};var _0xd01836;var _0x1e132c;return db[_0x43e7('0x3c')][_0x43e7('0x5d')]({'where':{'id':_0x5caba2[_0x43e7('0x59')]['id']}})['then'](handleEntityNotFound(_0x537186,null))[_0x43e7('0x1b')](function(_0x16622b){if(_0x16622b){_0xd01836=_0x16622b;_0x50c319[_0x43e7('0x3f')]=_[_0x43e7('0x4c')](db['FaxApplication'][_0x43e7('0x4d')]);_0x50c319[_0x43e7('0x40')]=_[_0x43e7('0x4c')](_0x5caba2[_0x43e7('0x40')]);_0x50c319[_0x43e7('0x41')]=_[_0x43e7('0x42')](_0x50c319[_0x43e7('0x3f')],_0x50c319['query']);_0x2c6080[_0x43e7('0x43')]=_[_0x43e7('0x42')](_0x50c319[_0x43e7('0x3f')],qs[_0x43e7('0x44')](_0x5caba2[_0x43e7('0x40')]['fields']));_0x2c6080[_0x43e7('0x43')]=_0x2c6080[_0x43e7('0x43')]['length']?_0x2c6080[_0x43e7('0x43')]:_0x50c319[_0x43e7('0x3f')];_0x2c6080['order']=qs[_0x43e7('0x60')](_0x5caba2[_0x43e7('0x40')][_0x43e7('0x60')]);_0x2c6080[_0x43e7('0x49')]=qs[_0x43e7('0x41')](_['pick'](_0x5caba2[_0x43e7('0x40')],_0x50c319[_0x43e7('0x41')]));if(_0x5caba2[_0x43e7('0x40')]['filter']){_0x2c6080[_0x43e7('0x49')]=_[_0x43e7('0x48')](_0x2c6080['where'],{'$or':_[_0x43e7('0x3b')](_0x2c6080[_0x43e7('0x43')],function(_0x3ea226){var _0x2dc13d={};_0x2dc13d[_0x3ea226]={'$like':'%'+_0x5caba2[_0x43e7('0x40')][_0x43e7('0x47')]+'%'};return _0x2dc13d;})});}_0x2c6080=_['merge']({},_0x2c6080,_0x5caba2[_0x43e7('0x50')]);return _0xd01836[_0x43e7('0x7a')](_0x2c6080);}})[_0x43e7('0x1b')](function(_0x4a4031){if(_0x4a4031){_0x1e132c=_0x4a4031[_0x43e7('0x5f')];if(!_0x5caba2[_0x43e7('0x40')][_0x43e7('0x45')](_0x43e7('0x68'))){_0x2c6080[_0x43e7('0x2c')]=qs[_0x43e7('0x2c')](_0x5caba2[_0x43e7('0x40')][_0x43e7('0x2c')]);_0x2c6080[_0x43e7('0x2b')]=qs['offset'](_0x5caba2[_0x43e7('0x40')][_0x43e7('0x2b')]);}return _0xd01836[_0x43e7('0x7a')](_0x2c6080);}})[_0x43e7('0x1b')](function(_0x33175f){if(_0x33175f){return _0x33175f?{'count':_0x1e132c,'rows':_0x33175f}:null;}})[_0x43e7('0x1b')](respondWithResult(_0x537186,null))[_0x43e7('0x26')](handleError(_0x537186,null));};function Extension(_0x3e8631,_0x51e17c,_0x36fe83,_0x6246c4){this[_0x43e7('0x7b')]=_0x43e7('0x7c');this[_0x43e7('0x7d')]=_0x3e8631['localstationid'];this[_0x43e7('0x7e')]=_0x6246c4;this[_0x43e7('0x3d')]=_0x43e7('0x7f');this[_0x43e7('0x80')]=_0x43e7('0x81');this['FaxAccountId']=_0x3e8631['id'];this[_0x43e7('0x79')]=_0x51e17c;this['appdata']=_0x36fe83;}function createExtensionsReciveFax(_0x2c9718){var _0x339826=0x1;var _0x1bc887=[];_0x1bc887[_0x43e7('0x82')](new Extension(_0x2c9718,_0x339826,'','Answer'));_0x339826+=0x1;_0x1bc887[_0x43e7('0x82')](new Extension(_0x2c9718,_0x339826,_0x43e7('0x83'),_0x43e7('0x84')));_0x339826+=0x1;for(var _0x31a0d9 in _0x2c9718){if(_0x2c9718[_0x43e7('0x45')](_0x31a0d9)&&(_0x31a0d9===_0x43e7('0x85')||_0x31a0d9===_0x43e7('0x86')||_0x31a0d9===_0x43e7('0x87')||_0x31a0d9===_0x43e7('0x88')||_0x31a0d9===_0x43e7('0x89')||_0x31a0d9===_0x43e7('0x8a')||_0x31a0d9==='minrate'||_0x31a0d9==='modem'||_0x31a0d9===_0x43e7('0x8b'))){_0x1bc887['push'](new Extension(_0x2c9718,_0x339826,'FAXOPT('+_0x31a0d9+')='+_0x2c9718[_0x31a0d9],_0x43e7('0x84')));_0x339826+=0x1;}}_0x1bc887[_0x43e7('0x82')](new Extension(_0x2c9718,_0x339826,'6','Wait'));_0x339826+=0x1;_0x1bc887[_0x43e7('0x82')](new Extension(_0x2c9718,_0x339826,'/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'));_0x339826=0x0;return _0x1bc887;}exports['addAccountApplications']=function(_0x3c496e,_0x131b14,_0x1be87f){var _0xd6ebb0;return db[_0x43e7('0x8c')][_0x43e7('0x8d')](function(_0xa2745a){return db[_0x43e7('0x3c')][_0x43e7('0x52')](_0x3c496e[_0x43e7('0x53')],{'transaction':_0xa2745a})[_0x43e7('0x1b')](function(_0x2a1218){_0xd6ebb0=_0x2a1218[_0x43e7('0x34')]({'plain':!![]});return db[_0x43e7('0x8e')][_0x43e7('0x8f')](createExtensionsReciveFax(_0xd6ebb0),{'transaction':_0xa2745a});});})[_0x43e7('0x1b')](function(){return _0xd6ebb0;})[_0x43e7('0x1b')](respondWithResult(_0x131b14,null))[_0x43e7('0x26')](handleError(_0x131b14,null));};exports[_0x43e7('0x90')]=function(_0x3dc065,_0x58c75c,_0x282796){var _0x8e6f7f;return db['sequelize'][_0x43e7('0x8d')](function(_0x125cce){return db[_0x43e7('0x3c')][_0x43e7('0x32')](_0x3dc065['body'],{'where':{'id':_0x3dc065[_0x43e7('0x53')]['id']},'transaction':_0x125cce})[_0x43e7('0x1b')](function(_0x5b7225){return db[_0x43e7('0x8e')][_0x43e7('0x33')]({'where':{'FaxAccountId':_0x3dc065[_0x43e7('0x53')]['id']},'transaction':_0x125cce})['then'](function(_0x22b824){return db[_0x43e7('0x8e')][_0x43e7('0x8f')](createExtensionsReciveFax(_[_0x43e7('0x6d')](_0x3dc065[_0x43e7('0x53')],['tech',_0x43e7('0x3e'),_0x43e7('0x91'),'updatedAt',_0x43e7('0x92'),'ListId'])),{'transaction':_0x125cce});});});})['then'](function(){return db['FaxAccount']['findById'](_0x3dc065[_0x43e7('0x53')]['id']);})[_0x43e7('0x1b')](respondWithResult(_0x58c75c,null))[_0x43e7('0x26')](handleError(_0x58c75c,null));};exports[_0x43e7('0x93')]=function(_0x5d3bc0,_0x592834,_0x267b26){var _0x5efb33={'raw':!![],'where':{}};var _0x1aaf4d={};var _0x50e4c0={'count':0x0,'rows':[]};return db[_0x43e7('0x3c')]['findOne']({'where':{'id':_0x5d3bc0['params']['id']}})['then'](handleEntityNotFound(_0x592834,null))['then'](function(_0xc9bc7e){if(_0xc9bc7e){_0x1aaf4d[_0x43e7('0x3f')]=_[_0x43e7('0x4c')](db['FaxMessage'][_0x43e7('0x4d')]);_0x1aaf4d[_0x43e7('0x40')]=_[_0x43e7('0x4c')](_0x5d3bc0['query']);_0x1aaf4d[_0x43e7('0x41')]=_[_0x43e7('0x42')](_0x1aaf4d[_0x43e7('0x3f')],_0x1aaf4d[_0x43e7('0x40')]);_0x5efb33['attributes']=_[_0x43e7('0x42')](_0x1aaf4d['model'],qs[_0x43e7('0x44')](_0x5d3bc0[_0x43e7('0x40')][_0x43e7('0x44')]));_0x5efb33[_0x43e7('0x43')]=_0x5efb33[_0x43e7('0x43')][_0x43e7('0x5f')]?_0x5efb33[_0x43e7('0x43')]:_0x1aaf4d['model'];if(!_0x5d3bc0[_0x43e7('0x40')][_0x43e7('0x45')]('nolimit')){_0x5efb33[_0x43e7('0x2c')]=qs[_0x43e7('0x2c')](_0x5d3bc0[_0x43e7('0x40')][_0x43e7('0x2c')]);_0x5efb33[_0x43e7('0x2b')]=qs['offset'](_0x5d3bc0[_0x43e7('0x40')]['offset']);}_0x5efb33[_0x43e7('0x46')]=qs['sort'](_0x5d3bc0[_0x43e7('0x40')][_0x43e7('0x60')]);_0x5efb33[_0x43e7('0x49')]=qs[_0x43e7('0x41')](_[_0x43e7('0x61')](_0x5d3bc0['query'],_0x1aaf4d[_0x43e7('0x41')]));_0x5efb33['where'][_0x43e7('0x62')]=_0xc9bc7e['id'];if(_0x5d3bc0[_0x43e7('0x40')][_0x43e7('0x47')]){_0x5efb33['where']=_[_0x43e7('0x48')](_0x5efb33[_0x43e7('0x49')],{'$or':_[_0x43e7('0x3b')](_0x5efb33[_0x43e7('0x43')],function(_0x379067){var _0x586626={};_0x586626[_0x379067]={'$like':'%'+_0x5d3bc0[_0x43e7('0x40')]['filter']+'%'};return _0x586626;})});}if(_0x5d3bc0[_0x43e7('0x40')][_0x43e7('0x94')]){var _0x495c73=_0x5d3bc0[_0x43e7('0x40')][_0x43e7('0x94')][_0x43e7('0x95')](',');var _0x233031={};_0x233031[_0x495c73[0x0]]={'$gte':moment(_0x495c73[0x1])['format'](_0x43e7('0x96'))};_0x5efb33['where']=_[_0x43e7('0x48')](_0x5efb33[_0x43e7('0x49')],_0x233031);}_0x5efb33=_[_0x43e7('0x48')]({},_0x5efb33,_0x5d3bc0[_0x43e7('0x50')]);return db[_0x43e7('0x97')][_0x43e7('0x2a')]({'where':_0x5efb33[_0x43e7('0x49')]})[_0x43e7('0x1b')](function(_0x2bb14d){_0x50e4c0['count']=_0x2bb14d;if(_0x5d3bc0[_0x43e7('0x40')]['includeAll']){_0x5efb33[_0x43e7('0x4f')]=[{'all':!![]}];}return db[_0x43e7('0x97')]['findAll'](_0x5efb33);})[_0x43e7('0x1b')](function(_0x381e47){_0x50e4c0['rows']=_0x381e47;return _0x50e4c0;});}})[_0x43e7('0x1b')](respondWithFilteredResult(_0x592834,_0x5efb33))[_0x43e7('0x26')](handleError(_0x592834,null));};exports[_0x43e7('0x98')]=function(_0x44b063,_0x24fed8,_0x44cda4){var _0xf13c6c,_0xeb47bb={},_0x4b4538;if(_0x44b063[_0x43e7('0x53')]['to']){_0x4b4538=_0x44b063[_0x43e7('0x53')]['to'][0x0];}return db[_0x43e7('0x3c')]['find']({'where':{'id':_0x44b063[_0x43e7('0x59')]['id']},'include':[{'model':db[_0x43e7('0x99')],'as':'List','include':[{'model':db[_0x43e7('0x9a')],'as':_0x43e7('0x9b'),'where':{'fax':_0x4b4538},'limit':0x1,'order':[['updatedAt',_0x43e7('0x9c')]]}]}]})[_0x43e7('0x1b')](handleEntityNotFound(_0x24fed8,null))[_0x43e7('0x1b')](function(_0x59452e){_0xf13c6c=_0x59452e;if(_0x44b063[_0x43e7('0x53')][_0x43e7('0x9d')]&&_0x44b063['body'][_0x43e7('0x9d')][_0x43e7('0x5f')]){for(var _0x34a60b=0x0;_0x34a60b<_0x44b063[_0x43e7('0x53')]['attachments']['length'];_0x34a60b+=0x1){_0x44b063[_0x43e7('0x53')][_0x43e7('0x9d')][_0x34a60b]={'filename':_0x44b063[_0x43e7('0x53')][_0x43e7('0x9d')][_0x34a60b]['name'],'id':_0x44b063[_0x43e7('0x53')][_0x43e7('0x9d')][_0x34a60b]['id'],'path':path[_0x43e7('0x9e')](config[_0x43e7('0x9f')],'server/files/attachments',_0x44b063[_0x43e7('0x53')][_0x43e7('0x9d')][_0x34a60b][_0x43e7('0xa0')])};}}return respondWithRpcPromise(_0x43e7('0xa1'),_0x43e7('0xa1'),{'FaxAccountId':_['isNil'](_0x44b063['params']['id'])?undefined:_0x44b063['params']['id'],'path':_[_0x43e7('0xa2')](_0x44b063[_0x43e7('0x53')][_0x43e7('0x9d')][0x0]['path'])?undefined:_0x44b063[_0x43e7('0x53')]['attachments'][0x0][_0x43e7('0x6')],'fax':_[_0x43e7('0xa2')](_0x44b063[_0x43e7('0x53')]['to'][0x0])?undefined:_0x44b063[_0x43e7('0x53')]['to'][0x0]},client9002);})[_0x43e7('0x1b')](function(){if(_0xf13c6c){if(_[_0x43e7('0xa2')](_0x44b063['body'][_0x43e7('0xa3')])){_0x44b063[_0x43e7('0x53')][_0x43e7('0xa3')]=util[_0x43e7('0xa4')](_0x43e7('0xa5'),_0xf13c6c[_0x43e7('0x37')],_0xf13c6c[_0x43e7('0xa6')]);}if(_0xf13c6c[_0x43e7('0xa7')]){if(_0xf13c6c[_0x43e7('0xa7')][_0x43e7('0x9b')][_0x43e7('0x5f')]){return _0xf13c6c[_0x43e7('0xa7')][_0x43e7('0x9b')][0x0];}else{return db['CmContact'][_0x43e7('0x52')](_[_0x43e7('0x16')](_0x44b063['body'],{'firstName':_0x44b063[_0x43e7('0x53')]['to'][0x0],'phone':_0x44b063[_0x43e7('0x53')]['to'][0x0],'fax':_0x44b063['body']['to'][0x0],'ListId':_0xf13c6c[_0x43e7('0xa8')]}));}}else{throw new Error(_0x43e7('0xa9'));}}else{throw new Error(_0x43e7('0xaa'));}})['then'](function(_0x4bfe35){if(_0x4bfe35){return db[_0x43e7('0x6b')][_0x43e7('0x51')]({'where':{'ContactId':_0x4bfe35['id'],'closed':![],'FaxAccountId':_0xf13c6c['id']}})[_0x43e7('0x1b')](function(_0x765825){if(_0x765825){return[_0x765825,![]];}return db[_0x43e7('0x6b')][_0x43e7('0x52')]({'UserId':_0x44b063[_0x43e7('0x54')]['id'],'ContactId':_0x4bfe35['id'],'FaxAccountId':_0xf13c6c['id'],'fax':_0x44b063[_0x43e7('0x53')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x43e7('0x48')](_0x44b063[_0x43e7('0x53')],{'read':![],'body':_0x44b063[_0x43e7('0x53')][_0x43e7('0x9d')][0x0][_0x43e7('0xab')],'FaxAccountId':_0xf13c6c['id'],'UserId':_0x44b063[_0x43e7('0x54')]['id'],'ContactId':_0x4bfe35['id'],'AttachmentId':_0x44b063[_0x43e7('0x53')][_0x43e7('0x9d')][0x0]['id']})]},{'include':[{'model':db[_0x43e7('0x97')],'as':_0x43e7('0xac')}]})[_0x43e7('0x1b')](function(_0x218743){return[_0x218743,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x43e7('0xad')](function(_0x338033,_0x26359b){if(_0x26359b){return _0x338033;}return db[_0x43e7('0x97')][_0x43e7('0x52')]({'direction':_0x43e7('0xae'),'read':![],'body':_0x44b063['body'][_0x43e7('0x9d')][0x0]['filename'],'FaxAccountId':_0xf13c6c['id'],'FaxInteractionId':_0x338033['id'],'UserId':_0x44b063[_0x43e7('0x54')]['id'],'ContactId':_0x338033[_0x43e7('0xaf')],'AttachmentId':_0x44b063[_0x43e7('0x53')]['attachments'][0x0]['id']})[_0x43e7('0x1b')](function(_0x317234){_0x338033['dataValues'][_0x43e7('0xac')]=[];_0x338033['dataValues'][_0x43e7('0xac')][_0x43e7('0x82')](_0x317234[_0x43e7('0xb0')]);return _0x338033;});})[_0x43e7('0x1b')](function(_0x4a9d8a){respondWithRpcPromise(_0x43e7('0xb1'),_0x43e7('0xb1'),{'FaxAccountId':_[_0x43e7('0xa2')](_0x44b063['params']['id'])?undefined:_0x44b063[_0x43e7('0x59')]['id'],'path':_[_0x43e7('0xa2')](_0x44b063[_0x43e7('0x53')][_0x43e7('0x9d')][0x0][_0x43e7('0x6')])?undefined:_0x44b063[_0x43e7('0x53')]['attachments'][0x0][_0x43e7('0x6')],'fax':_['isNil'](_0x44b063[_0x43e7('0x53')]['to'][0x0])?undefined:_0x44b063[_0x43e7('0x53')]['to'][0x0],'AttachmentId':_0x44b063['body'][_0x43e7('0x9d')][0x0]['id']},client9002)[_0x43e7('0x1b')](function(_0x4fe82d){logger[_0x43e7('0x1c')](_0x43e7('0xb2'),_0x4fe82d);})[_0x43e7('0x26')](function(_0x426cdc){logger['info']('SendFaxRpc,\x20%s',_0x426cdc);});return _0x4a9d8a;})[_0x43e7('0x1b')](respondWithResult(_0x24fed8,null))[_0x43e7('0x26')](handleError(_0x24fed8,null));};exports[_0x43e7('0xb3')]=function(_0x29acba,_0xa64f2b,_0x44e9f2){return db[_0x43e7('0x3c')][_0x43e7('0x51')]({'where':{'id':_0x29acba['params']['id']}})[_0x43e7('0x1b')](handleEntityNotFound(_0xa64f2b,null))[_0x43e7('0x1b')](function(_0x593092){if(_0x593092){return _0x593092[_0x43e7('0xb3')](_0x29acba[_0x43e7('0x53')][_0x43e7('0x66')],_[_0x43e7('0x6d')](_0x29acba[_0x43e7('0x53')],[_0x43e7('0x66'),'id'])||{})[_0x43e7('0xad')](function(_0x534675){for(var _0xaa97b5=0x0;_0xaa97b5<_0x29acba['body'][_0x43e7('0x66')][_0x43e7('0x5f')];_0xaa97b5+=0x1){socket['emit'](_0x43e7('0xb4'),{'UserId':_0x29acba['body'][_0x43e7('0x66')][_0xaa97b5],'FaxAccountId':_0x29acba[_0x43e7('0x59')]['id']});}return _0x534675;});}})[_0x43e7('0x1b')](respondWithResult(_0xa64f2b,null))['catch'](handleError(_0xa64f2b,null));};exports['removeAgents']=function(_0x16a429,_0xcfecd2,_0x4cd879){return db[_0x43e7('0x3c')][_0x43e7('0x51')]({'where':{'id':_0x16a429[_0x43e7('0x59')]['id']}})['then'](handleEntityNotFound(_0xcfecd2,null))[_0x43e7('0x1b')](function(_0x2e6031){if(_0x2e6031){return _0x2e6031[_0x43e7('0xb5')](_0x16a429['query'][_0x43e7('0x66')])[_0x43e7('0x1b')](function(){if(_[_0x43e7('0xb6')](_0x16a429[_0x43e7('0x40')][_0x43e7('0x66')])){for(var _0x3f2ef1=0x0;_0x3f2ef1<_0x16a429['query'][_0x43e7('0x66')][_0x43e7('0x5f')];_0x3f2ef1+=0x1){socket[_0x43e7('0xb7')](_0x43e7('0xb8'),{'UserId':Number(_0x16a429[_0x43e7('0x40')][_0x43e7('0x66')][_0x3f2ef1]),'FaxAccountId':Number(_0x16a429[_0x43e7('0x59')]['id'])});}}else{socket[_0x43e7('0xb7')](_0x43e7('0xb8'),{'UserId':Number(_0x16a429[_0x43e7('0x40')][_0x43e7('0x66')]),'FaxAccountId':Number(_0x16a429[_0x43e7('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0xcfecd2,null))['catch'](handleError(_0xcfecd2,null));};exports['getAgents']=function(_0x56598f,_0x280668,_0x20eef6){var _0x4627b8={};var _0x36ca29={};var _0x70377d;var _0x35bfce;return db['FaxAccount']['findOne']({'where':{'id':_0x56598f[_0x43e7('0x59')]['id']}})[_0x43e7('0x1b')](handleEntityNotFound(_0x280668,null))['then'](function(_0x52f5d1){if(_0x52f5d1){_0x70377d=_0x52f5d1;_0x36ca29[_0x43e7('0x3f')]=_[_0x43e7('0x4c')](db['User'][_0x43e7('0x4d')]);_0x36ca29['query']=_['keys'](_0x56598f[_0x43e7('0x40')]);_0x36ca29[_0x43e7('0x41')]=_['intersection'](_0x36ca29['model'],_0x36ca29[_0x43e7('0x40')]);_0x4627b8[_0x43e7('0x43')]=_[_0x43e7('0x42')](_0x36ca29[_0x43e7('0x3f')],qs['fields'](_0x56598f[_0x43e7('0x40')][_0x43e7('0x44')]));_0x4627b8['attributes']=_0x4627b8['attributes']['length']?_0x4627b8['attributes']:_0x36ca29[_0x43e7('0x3f')];_0x4627b8[_0x43e7('0x46')]=qs['sort'](_0x56598f['query'][_0x43e7('0x60')]);_0x4627b8[_0x43e7('0x49')]=qs[_0x43e7('0x41')](_[_0x43e7('0x61')](_0x56598f[_0x43e7('0x40')],_0x36ca29['filters']));if(_0x56598f[_0x43e7('0x40')][_0x43e7('0x47')]){_0x4627b8[_0x43e7('0x49')]=_[_0x43e7('0x48')](_0x4627b8[_0x43e7('0x49')],{'$or':_['map'](_0x4627b8[_0x43e7('0x43')],function(_0x138039){var _0x804b29={};_0x804b29[_0x138039]={'$like':'%'+_0x56598f[_0x43e7('0x40')]['filter']+'%'};return _0x804b29;})});}_0x4627b8=_[_0x43e7('0x48')]({},_0x4627b8,_0x56598f[_0x43e7('0x50')]);return _0x70377d[_0x43e7('0xb9')](_0x4627b8);}})[_0x43e7('0x1b')](function(_0x266925){if(_0x266925){_0x35bfce=_0x266925[_0x43e7('0x5f')];if(!_0x56598f['query'][_0x43e7('0x45')](_0x43e7('0x68'))){_0x4627b8[_0x43e7('0x2c')]=qs[_0x43e7('0x2c')](_0x56598f['query'][_0x43e7('0x2c')]);_0x4627b8['offset']=qs[_0x43e7('0x2b')](_0x56598f['query'][_0x43e7('0x2b')]);}return _0x70377d['getAgents'](_0x4627b8);}})[_0x43e7('0x1b')](function(_0x53c8bf){if(_0x53c8bf){return _0x53c8bf?{'count':_0x35bfce,'rows':_0x53c8bf}:null;}})[_0x43e7('0x1b')](respondWithResult(_0x280668,null))[_0x43e7('0x26')](handleError(_0x280668,null));}; \ No newline at end of file +var _0x4f17=['info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','end','json','count','offset','limit','Content-Range','save','then','destroy','get','FaxAccounts','sendStatus','stack','name','send','index','Pause','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','options','FaxAccount','include','findAll','rows','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','mandatoryDispositionPause','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','order','sort','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','app','description','priority','appdata','push','Answer','Set','ecm','gateway','faxdetect','headerinfo','minrate','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','createdAt','updatedAt','findById','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','DESC','attachments','server/files/attachments','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','Messages','out','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','getAgents','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','http','client','request'];(function(_0x262bdb,_0x2b87ae){var _0x11510b=function(_0x47e16f){while(--_0x47e16f){_0x262bdb['push'](_0x262bdb['shift']());}};_0x11510b(++_0x2b87ae);}(_0x4f17,0x9e));var _0x74f1=function(_0xbebf50,_0x44ec09){_0xbebf50=_0xbebf50-0x0;var _0xce1496=_0x4f17[_0xbebf50];return _0xce1496;};'use strict';var pdf=require(_0x74f1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x74f1('0x1'));var zipdir=require(_0x74f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74f1('0x3'));var moment=require(_0x74f1('0x4'));var BPromise=require(_0x74f1('0x5'));var Mustache=require(_0x74f1('0x6'));var util=require(_0x74f1('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x74f1('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x74f1('0x9'));var squel=require('squel');var crypto=require(_0x74f1('0xa'));var jsforce=require(_0x74f1('0xb'));var deskjs=require(_0x74f1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x74f1('0xd'));var Papa=require('papaparse');var Redis=require(_0x74f1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x74f1('0xf'));var as=require(_0x74f1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x74f1('0x11'));var utils=require(_0x74f1('0x12'));var config=require(_0x74f1('0x13'));var licenseUtil=require(_0x74f1('0x14'));var db=require(_0x74f1('0x15'))['db'];config[_0x74f1('0x16')]=_[_0x74f1('0x17')](config[_0x74f1('0x16')],{'host':_0x74f1('0x18'),'port':0x18eb});var socket=require(_0x74f1('0x19'))(new Redis(config['redis']));require(_0x74f1('0x1a'))['register'](socket);var jayson=require(_0x74f1('0x1b'));var client=jayson['client'][_0x74f1('0x1c')]({'port':0x232c});var client9002=jayson[_0x74f1('0x1d')][_0x74f1('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1016a7,_0x33b851,_0x51faf1,_0x2310b0){return new BPromise(function(_0x10a0b1,_0x598573){var _0x387937=_0x2310b0||client;return _0x387937[_0x74f1('0x1e')](_0x1016a7,_0x51faf1)['then'](function(_0x1cc44b){logger[_0x74f1('0x1f')](_0x74f1('0x20'),_0x33b851,_0x74f1('0x21'));logger[_0x74f1('0x22')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x33b851,_0x74f1('0x21'),JSON[_0x74f1('0x23')](_0x1cc44b));if(_0x1cc44b[_0x74f1('0x24')]){if(_0x1cc44b[_0x74f1('0x24')][_0x74f1('0x25')]===0x1f4){logger[_0x74f1('0x24')]('FaxAccount,\x20%s,\x20%s',_0x33b851,_0x1cc44b['error']['message']);return _0x598573(_0x1cc44b[_0x74f1('0x24')][_0x74f1('0x26')]);}logger[_0x74f1('0x24')](_0x74f1('0x20'),_0x33b851,_0x1cc44b[_0x74f1('0x24')][_0x74f1('0x26')]);return _0x10a0b1(_0x1cc44b[_0x74f1('0x24')][_0x74f1('0x26')]);}else{logger[_0x74f1('0x1f')](_0x74f1('0x20'),_0x33b851,_0x74f1('0x21'));_0x10a0b1(_0x1cc44b['result']['message']);}})[_0x74f1('0x27')](function(_0x24e730){logger[_0x74f1('0x24')](_0x74f1('0x20'),_0x33b851,_0x24e730);_0x598573(_0x24e730);});});}function respondWithStatusCode(_0x458194,_0xddbb89){_0xddbb89=_0xddbb89||0xcc;return function(_0xd079b5){if(_0xd079b5){return _0x458194['sendStatus'](_0xddbb89);}return _0x458194[_0x74f1('0x28')](_0xddbb89)[_0x74f1('0x29')]();};}function respondWithResult(_0x59a7ac,_0x1736e3){_0x1736e3=_0x1736e3||0xc8;return function(_0x58d6d8){if(_0x58d6d8){return _0x59a7ac['status'](_0x1736e3)[_0x74f1('0x2a')](_0x58d6d8);}};}function respondWithFilteredResult(_0x37894a,_0x365a2f){return function(_0x27c47e){if(_0x27c47e){var _0x115abf=_0x27c47e[_0x74f1('0x2b')],_0x176340=_0x365a2f[_0x74f1('0x2c')],_0x19390c=_0x365a2f[_0x74f1('0x2c')]+_0x365a2f[_0x74f1('0x2d')],_0x237fcf;if(_0x19390c>=_0x115abf){_0x19390c=_0x115abf;_0x237fcf=0xc8;}else{_0x237fcf=0xce;}_0x37894a[_0x74f1('0x28')](_0x237fcf);return _0x37894a['set'](_0x74f1('0x2e'),_0x176340+'-'+_0x19390c+'/'+_0x115abf)[_0x74f1('0x2a')](_0x27c47e);}return null;};}function patchUpdates(_0x467c02){return function(_0xa191b1){try{jsonpatch['apply'](_0xa191b1,_0x467c02,!![]);}catch(_0x181201){return BPromise['reject'](_0x181201);}return _0xa191b1[_0x74f1('0x2f')]();};}function saveUpdates(_0x32d691,_0x26feaa){return function(_0x106a4c){if(_0x106a4c){return _0x106a4c['update'](_0x32d691)[_0x74f1('0x30')](function(_0x57fe1e){return _0x57fe1e;});}return null;};}function removeEntity(_0x28ac8a,_0x7cdfb7){return function(_0x1a34fd){if(_0x1a34fd){return _0x1a34fd[_0x74f1('0x31')]()[_0x74f1('0x30')](function(){var _0x366472=_0x1a34fd[_0x74f1('0x32')]({'plain':!![]});var _0x3dbb34=_0x74f1('0x33');return db['UserProfileResource'][_0x74f1('0x31')]({'where':{'type':_0x3dbb34,'resourceId':_0x366472['id']}})[_0x74f1('0x30')](function(){return _0x1a34fd;});})['then'](function(){_0x28ac8a[_0x74f1('0x28')](0xcc)[_0x74f1('0x29')]();});}};}function handleEntityNotFound(_0x221c75,_0x2eaad6){return function(_0x4203e4){if(!_0x4203e4){_0x221c75[_0x74f1('0x34')](0x194);}return _0x4203e4;};}function handleError(_0x5410e5,_0x45497f){_0x45497f=_0x45497f||0x1f4;return function(_0x10117b){logger[_0x74f1('0x24')](_0x10117b[_0x74f1('0x35')]);if(_0x10117b[_0x74f1('0x36')]){delete _0x10117b[_0x74f1('0x36')];}_0x5410e5[_0x74f1('0x28')](_0x45497f)[_0x74f1('0x37')](_0x10117b);};}exports[_0x74f1('0x38')]=function(_0x22512c,_0x547de5){var _0x3e9698={'include':[{'model':db[_0x74f1('0x39')],'as':'mandatoryDispositionPause'}]},_0x4c3fbf={},_0x353266={'count':0x0,'rows':[]};var _0xa9b443=_[_0x74f1('0x3a')](db['FaxAccount'][_0x74f1('0x3b')],function(_0x64706e){return{'name':_0x64706e['fieldName'],'type':_0x64706e[_0x74f1('0x3c')][_0x74f1('0x3d')]};});_0x4c3fbf[_0x74f1('0x3e')]=_[_0x74f1('0x3a')](_0xa9b443,_0x74f1('0x36'));_0x4c3fbf[_0x74f1('0x3f')]=_['keys'](_0x22512c['query']);_0x4c3fbf[_0x74f1('0x40')]=_[_0x74f1('0x41')](_0x4c3fbf[_0x74f1('0x3e')],_0x4c3fbf[_0x74f1('0x3f')]);_0x3e9698[_0x74f1('0x42')]=_[_0x74f1('0x41')](_0x4c3fbf[_0x74f1('0x3e')],qs[_0x74f1('0x43')](_0x22512c[_0x74f1('0x3f')][_0x74f1('0x43')]));_0x3e9698['attributes']=_0x3e9698['attributes'][_0x74f1('0x44')]?_0x3e9698['attributes']:_0x4c3fbf[_0x74f1('0x3e')];if(!_0x22512c[_0x74f1('0x3f')][_0x74f1('0x45')]('nolimit')){_0x3e9698[_0x74f1('0x2d')]=qs[_0x74f1('0x2d')](_0x22512c[_0x74f1('0x3f')][_0x74f1('0x2d')]);_0x3e9698[_0x74f1('0x2c')]=qs[_0x74f1('0x2c')](_0x22512c[_0x74f1('0x3f')][_0x74f1('0x2c')]);}_0x3e9698['order']=qs['sort'](_0x22512c[_0x74f1('0x3f')]['sort']);_0x3e9698[_0x74f1('0x46')]=qs[_0x74f1('0x40')](_[_0x74f1('0x47')](_0x22512c[_0x74f1('0x3f')],_0x4c3fbf[_0x74f1('0x40')]),_0xa9b443);if(_0x22512c[_0x74f1('0x3f')][_0x74f1('0x48')]){_0x3e9698['where']=_[_0x74f1('0x49')](_0x3e9698[_0x74f1('0x46')],{'$or':_[_0x74f1('0x3a')](_0xa9b443,function(_0x11f576){if(_0x11f576[_0x74f1('0x3c')]!=='VIRTUAL'){var _0x46ba90={};_0x46ba90[_0x11f576[_0x74f1('0x36')]]={'$like':'%'+_0x22512c[_0x74f1('0x3f')][_0x74f1('0x48')]+'%'};return _0x46ba90;}})});}_0x3e9698=_[_0x74f1('0x49')]({},_0x3e9698,_0x22512c[_0x74f1('0x4a')]);var _0x400090={'where':_0x3e9698[_0x74f1('0x46')]};return db[_0x74f1('0x4b')]['count'](_0x400090)[_0x74f1('0x30')](function(_0x7638c0){_0x353266[_0x74f1('0x2b')]=_0x7638c0;if(_0x22512c['query']['includeAll']){_0x3e9698[_0x74f1('0x4c')]=[{'all':!![]}];}return db[_0x74f1('0x4b')][_0x74f1('0x4d')](_0x3e9698);})[_0x74f1('0x30')](function(_0x3f1a61){_0x353266[_0x74f1('0x4e')]=_0x3f1a61;return _0x353266;})[_0x74f1('0x30')](respondWithFilteredResult(_0x547de5,_0x3e9698))[_0x74f1('0x27')](handleError(_0x547de5,null));};exports['show']=function(_0x17ce42,_0x2c8906){var _0xe025a4={'raw':![],'where':{'id':_0x17ce42[_0x74f1('0x4f')]['id']},'include':[{'model':db[_0x74f1('0x39')],'as':'mandatoryDispositionPause'}]},_0x23bf0d={};_0x23bf0d[_0x74f1('0x3e')]=_[_0x74f1('0x50')](db['FaxAccount'][_0x74f1('0x3b')]);_0x23bf0d[_0x74f1('0x3f')]=_[_0x74f1('0x50')](_0x17ce42[_0x74f1('0x3f')]);_0x23bf0d[_0x74f1('0x40')]=_[_0x74f1('0x41')](_0x23bf0d[_0x74f1('0x3e')],_0x23bf0d[_0x74f1('0x3f')]);_0xe025a4[_0x74f1('0x42')]=_[_0x74f1('0x41')](_0x23bf0d[_0x74f1('0x3e')],qs[_0x74f1('0x43')](_0x17ce42[_0x74f1('0x3f')][_0x74f1('0x43')]));_0xe025a4[_0x74f1('0x42')]=_0xe025a4[_0x74f1('0x42')][_0x74f1('0x44')]?_0xe025a4[_0x74f1('0x42')]:_0x23bf0d[_0x74f1('0x3e')];if(_0x17ce42[_0x74f1('0x3f')][_0x74f1('0x51')]){_0xe025a4[_0x74f1('0x4c')]=[{'all':!![]}];}_0xe025a4=_[_0x74f1('0x49')]({},_0xe025a4,_0x17ce42[_0x74f1('0x4a')]);return db[_0x74f1('0x4b')][_0x74f1('0x52')](_0xe025a4)[_0x74f1('0x30')](handleEntityNotFound(_0x2c8906,null))[_0x74f1('0x30')](respondWithResult(_0x2c8906,null))['catch'](handleError(_0x2c8906,null));};exports[_0x74f1('0x53')]=function(_0x421db8,_0x396ec6){return db[_0x74f1('0x4b')][_0x74f1('0x53')](_0x421db8[_0x74f1('0x54')],{})['then'](function(_0x3bb90d){var _0x132223=_0x421db8[_0x74f1('0x55')][_0x74f1('0x32')]({'plain':!![]});if(!_0x132223)throw new Error(_0x74f1('0x56'));if(_0x132223[_0x74f1('0x57')]===_0x74f1('0x55')){var _0x56963d=_0x3bb90d[_0x74f1('0x32')]({'plain':!![]});var _0x329e4c='FaxAccounts';return db[_0x74f1('0x58')][_0x74f1('0x52')]({'where':{'name':_0x329e4c,'userProfileId':_0x132223['userProfileId']},'raw':!![]})[_0x74f1('0x30')](function(_0x3e7a74){if(_0x3e7a74&&_0x3e7a74[_0x74f1('0x59')]===0x0){return db[_0x74f1('0x5a')][_0x74f1('0x53')]({'name':_0x56963d['name'],'resourceId':_0x56963d['id'],'type':_0x3e7a74[_0x74f1('0x36')],'sectionId':_0x3e7a74['id']},{})['then'](function(){return _0x3bb90d;});}else{return _0x3bb90d;}})[_0x74f1('0x27')](function(_0x181381){logger[_0x74f1('0x24')](_0x74f1('0x5b'),_0x181381);throw _0x181381;});}return _0x3bb90d;})[_0x74f1('0x30')](respondWithResult(_0x396ec6,0xc9))[_0x74f1('0x27')](handleError(_0x396ec6,null));};exports[_0x74f1('0x5c')]=function(_0x338bd6,_0xb74a0b){if(_0x338bd6[_0x74f1('0x54')]['id']){delete _0x338bd6[_0x74f1('0x54')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x338bd6[_0x74f1('0x4f')]['id']},'include':[{'model':db[_0x74f1('0x39')],'as':_0x74f1('0x5d')}]})[_0x74f1('0x30')](handleEntityNotFound(_0xb74a0b,null))[_0x74f1('0x30')](saveUpdates(_0x338bd6['body'],null))[_0x74f1('0x30')](respondWithResult(_0xb74a0b,null))[_0x74f1('0x27')](handleError(_0xb74a0b,null));};exports['destroy']=function(_0x2044a7,_0x1c717e){return db[_0x74f1('0x4b')][_0x74f1('0x52')]({'where':{'id':_0x2044a7[_0x74f1('0x4f')]['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x1c717e,null))[_0x74f1('0x30')](removeEntity(_0x1c717e,null))['catch'](handleError(_0x1c717e,null));};exports['describe']=function(_0x32dfa3,_0x4e69f5){return db[_0x74f1('0x4b')][_0x74f1('0x5e')]()[_0x74f1('0x30')](respondWithResult(_0x4e69f5,null))['catch'](handleError(_0x4e69f5,null));};exports[_0x74f1('0x5f')]=function(_0x59c362,_0x4aa2a4,_0x8c3bbb){if(_0x59c362['body']['id']){delete _0x59c362[_0x74f1('0x54')]['id'];}return db[_0x74f1('0x4b')][_0x74f1('0x52')]({'where':{'id':_0x59c362[_0x74f1('0x4f')]['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x4aa2a4,null))[_0x74f1('0x30')](function(_0x379d39){if(_0x379d39){_0x59c362[_0x74f1('0x54')][_0x74f1('0x60')]=_0x379d39['id'];return db[_0x74f1('0x61')][_0x74f1('0x53')](_0x59c362[_0x74f1('0x54')]);}})[_0x74f1('0x30')](respondWithResult(_0x4aa2a4,null))[_0x74f1('0x27')](handleError(_0x4aa2a4,null));};exports[_0x74f1('0x62')]=function(_0x55c50b,_0x42a407,_0x1fd601){var _0x1b0bce={'raw':![],'where':{}};var _0x4aa70f={};var _0x1eca4c={'count':0x0,'rows':[]};return db['FaxAccount'][_0x74f1('0x63')]({'where':{'id':_0x55c50b[_0x74f1('0x4f')]['id']}})['then'](handleEntityNotFound(_0x42a407,null))['then'](function(_0x2c8ab4){if(_0x2c8ab4){_0x4aa70f['model']=_[_0x74f1('0x50')](db[_0x74f1('0x61')][_0x74f1('0x3b')]);_0x4aa70f['query']=_[_0x74f1('0x50')](_0x55c50b[_0x74f1('0x3f')]);_0x4aa70f['filters']=_[_0x74f1('0x41')](_0x4aa70f[_0x74f1('0x3e')],_0x4aa70f[_0x74f1('0x3f')]);_0x1b0bce[_0x74f1('0x42')]=_['intersection'](_0x4aa70f[_0x74f1('0x3e')],qs[_0x74f1('0x43')](_0x55c50b[_0x74f1('0x3f')][_0x74f1('0x43')]));_0x1b0bce[_0x74f1('0x42')]=_0x1b0bce[_0x74f1('0x42')]['length']?_0x1b0bce[_0x74f1('0x42')]:_0x4aa70f[_0x74f1('0x3e')];if(!_0x55c50b[_0x74f1('0x3f')]['hasOwnProperty'](_0x74f1('0x64'))){_0x1b0bce[_0x74f1('0x2d')]=qs[_0x74f1('0x2d')](_0x55c50b[_0x74f1('0x3f')][_0x74f1('0x2d')]);_0x1b0bce[_0x74f1('0x2c')]=qs['offset'](_0x55c50b[_0x74f1('0x3f')]['offset']);}_0x1b0bce[_0x74f1('0x65')]=qs['sort'](_0x55c50b['query'][_0x74f1('0x66')]);_0x1b0bce[_0x74f1('0x46')]=qs[_0x74f1('0x40')](_[_0x74f1('0x47')](_0x55c50b[_0x74f1('0x3f')],_0x4aa70f[_0x74f1('0x40')]));_0x1b0bce[_0x74f1('0x46')][_0x74f1('0x60')]=_0x2c8ab4['id'];if(_0x55c50b[_0x74f1('0x3f')][_0x74f1('0x48')]){_0x1b0bce[_0x74f1('0x46')]=_['merge'](_0x1b0bce[_0x74f1('0x46')],{'$or':_[_0x74f1('0x3a')](_0x1b0bce[_0x74f1('0x42')],function(_0x44973e){var _0x1551a2={};_0x1551a2[_0x44973e]={'$like':'%'+_0x55c50b[_0x74f1('0x3f')][_0x74f1('0x48')]+'%'};return _0x1551a2;})});}_0x1b0bce=_['merge']({},_0x1b0bce,_0x55c50b['options']);return db[_0x74f1('0x61')][_0x74f1('0x2b')]({'where':_0x1b0bce['where']})['then'](function(_0xef9b1b){_0x1eca4c['count']=_0xef9b1b;if(_0x55c50b[_0x74f1('0x3f')][_0x74f1('0x51')]){_0x1b0bce[_0x74f1('0x4c')]=[{'all':!![]}];}return db[_0x74f1('0x61')][_0x74f1('0x4d')](_0x1b0bce);})['then'](function(_0x5345f5){_0x1eca4c['rows']=_0x5345f5;return _0x1eca4c;});}})[_0x74f1('0x30')](respondWithFilteredResult(_0x42a407,_0x1b0bce))[_0x74f1('0x27')](handleError(_0x42a407,null));};exports['removeDispositions']=function(_0x242518,_0x402613,_0x28b9bf){return db['FaxAccount'][_0x74f1('0x52')]({'where':{'id':_0x242518[_0x74f1('0x4f')]['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x402613,null))[_0x74f1('0x30')](function(_0x30b1ad){if(_0x30b1ad){return _0x30b1ad[_0x74f1('0x67')](_0x242518[_0x74f1('0x3f')][_0x74f1('0x68')]);}})['then'](respondWithStatusCode(_0x402613,null))[_0x74f1('0x27')](handleError(_0x402613,null));};exports[_0x74f1('0x69')]=function(_0xaf1d74,_0x4296c9,_0x284271){if(_0xaf1d74[_0x74f1('0x54')]['id']){delete _0xaf1d74[_0x74f1('0x54')]['id'];}return db[_0x74f1('0x4b')][_0x74f1('0x52')]({'where':{'id':_0xaf1d74[_0x74f1('0x4f')]['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x4296c9,null))['then'](function(_0x29024d){if(_0x29024d){_0xaf1d74[_0x74f1('0x54')][_0x74f1('0x60')]=_0x29024d['id'];return db[_0x74f1('0x6a')]['create'](_0xaf1d74['body']);}})['then'](respondWithResult(_0x4296c9,null))[_0x74f1('0x27')](handleError(_0x4296c9,null));};exports[_0x74f1('0x6b')]=function(_0x2aa5ba,_0x474a56,_0x2054d6){var _0x2bf4fa={'raw':![],'where':{}};var _0x330a7e={};var _0xeb4a70={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x2aa5ba[_0x74f1('0x4f')]['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x474a56,null))['then'](function(_0x43fa0d){if(_0x43fa0d){_0x330a7e[_0x74f1('0x3e')]=_[_0x74f1('0x50')](db[_0x74f1('0x6a')][_0x74f1('0x3b')]);_0x330a7e[_0x74f1('0x3f')]=_['keys'](_0x2aa5ba[_0x74f1('0x3f')]);_0x330a7e[_0x74f1('0x40')]=_[_0x74f1('0x41')](_0x330a7e[_0x74f1('0x3e')],_0x330a7e['query']);_0x2bf4fa['attributes']=_[_0x74f1('0x41')](_0x330a7e[_0x74f1('0x3e')],qs['fields'](_0x2aa5ba['query'][_0x74f1('0x43')]));_0x2bf4fa[_0x74f1('0x42')]=_0x2bf4fa[_0x74f1('0x42')][_0x74f1('0x44')]?_0x2bf4fa[_0x74f1('0x42')]:_0x330a7e[_0x74f1('0x3e')];if(!_0x2aa5ba['query']['hasOwnProperty'](_0x74f1('0x64'))){_0x2bf4fa['limit']=qs['limit'](_0x2aa5ba[_0x74f1('0x3f')]['limit']);_0x2bf4fa[_0x74f1('0x2c')]=qs[_0x74f1('0x2c')](_0x2aa5ba[_0x74f1('0x3f')][_0x74f1('0x2c')]);}_0x2bf4fa[_0x74f1('0x65')]=qs[_0x74f1('0x66')](_0x2aa5ba[_0x74f1('0x3f')][_0x74f1('0x66')]);_0x2bf4fa[_0x74f1('0x46')]=qs[_0x74f1('0x40')](_[_0x74f1('0x47')](_0x2aa5ba[_0x74f1('0x3f')],_0x330a7e[_0x74f1('0x40')]));_0x2bf4fa[_0x74f1('0x46')][_0x74f1('0x60')]=_0x43fa0d['id'];if(_0x2aa5ba['query'][_0x74f1('0x48')]){_0x2bf4fa['where']=_[_0x74f1('0x49')](_0x2bf4fa[_0x74f1('0x46')],{'$or':_[_0x74f1('0x3a')](_0x2bf4fa[_0x74f1('0x42')],function(_0x3e620e){var _0x4f23cf={};_0x4f23cf[_0x3e620e]={'$like':'%'+_0x2aa5ba[_0x74f1('0x3f')][_0x74f1('0x48')]+'%'};return _0x4f23cf;})});}_0x2bf4fa=_[_0x74f1('0x49')]({},_0x2bf4fa,_0x2aa5ba['options']);return db[_0x74f1('0x6a')]['count']({'where':_0x2bf4fa[_0x74f1('0x46')]})['then'](function(_0x1e3255){_0xeb4a70[_0x74f1('0x2b')]=_0x1e3255;if(_0x2aa5ba[_0x74f1('0x3f')][_0x74f1('0x51')]){_0x2bf4fa[_0x74f1('0x4c')]=[{'all':!![]}];}return db[_0x74f1('0x6a')][_0x74f1('0x4d')](_0x2bf4fa);})[_0x74f1('0x30')](function(_0x548678){_0xeb4a70[_0x74f1('0x4e')]=_0x548678;return _0xeb4a70;});}})[_0x74f1('0x30')](respondWithFilteredResult(_0x474a56,_0x2bf4fa))['catch'](handleError(_0x474a56,null));};exports['removeAnswers']=function(_0x3b0f51,_0xcac1ed,_0x14825b){return db[_0x74f1('0x4b')][_0x74f1('0x52')]({'where':{'id':_0x3b0f51['params']['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0xcac1ed,null))[_0x74f1('0x30')](function(_0x559b5b){if(_0x559b5b){return _0x559b5b[_0x74f1('0x6c')](_0x3b0f51[_0x74f1('0x3f')][_0x74f1('0x68')]);}})[_0x74f1('0x30')](respondWithStatusCode(_0xcac1ed,null))[_0x74f1('0x27')](handleError(_0xcac1ed,null));};exports[_0x74f1('0x6d')]=function(_0x3f6e9f,_0x33fdeb,_0x4c21a4){return db[_0x74f1('0x6e')][_0x74f1('0x52')]({'where':{'id':_0x3f6e9f['params']['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x33fdeb,null))[_0x74f1('0x30')](function(_0x10b511){if(_0x10b511){return _0x10b511[_0x74f1('0x6d')](_0x3f6e9f[_0x74f1('0x54')][_0x74f1('0x68')],_[_0x74f1('0x6f')](_0x3f6e9f['body'],[_0x74f1('0x68'),'id'])||{});}})['then'](respondWithResult(_0x33fdeb,null))[_0x74f1('0x27')](handleError(_0x33fdeb,null));};exports[_0x74f1('0x70')]=function(_0x593920,_0x31fbe6,_0x398b7f){var _0x2b457a={'raw':![],'where':{}};var _0x22bc21={};var _0x386627={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x593920[_0x74f1('0x4f')]['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x31fbe6,null))['then'](function(_0x51027f){if(_0x51027f){_0x22bc21[_0x74f1('0x3e')]=_[_0x74f1('0x50')](db[_0x74f1('0x6e')]['rawAttributes']);_0x22bc21[_0x74f1('0x3f')]=_[_0x74f1('0x50')](_0x593920[_0x74f1('0x3f')]);_0x22bc21['filters']=_['intersection'](_0x22bc21[_0x74f1('0x3e')],_0x22bc21[_0x74f1('0x3f')]);_0x2b457a[_0x74f1('0x42')]=_[_0x74f1('0x41')](_0x22bc21['model'],qs[_0x74f1('0x43')](_0x593920[_0x74f1('0x3f')]['fields']));_0x2b457a[_0x74f1('0x42')]=_0x2b457a[_0x74f1('0x42')]['length']?_0x2b457a[_0x74f1('0x42')]:_0x22bc21[_0x74f1('0x3e')];if(!_0x593920['query']['hasOwnProperty'](_0x74f1('0x64'))){_0x2b457a[_0x74f1('0x2d')]=qs[_0x74f1('0x2d')](_0x593920['query'][_0x74f1('0x2d')]);_0x2b457a[_0x74f1('0x2c')]=qs['offset'](_0x593920[_0x74f1('0x3f')][_0x74f1('0x2c')]);}_0x2b457a[_0x74f1('0x65')]=qs[_0x74f1('0x66')](_0x593920[_0x74f1('0x3f')][_0x74f1('0x66')]);_0x2b457a[_0x74f1('0x46')]=qs['filters'](_[_0x74f1('0x47')](_0x593920[_0x74f1('0x3f')],_0x22bc21['filters']));_0x2b457a[_0x74f1('0x46')]['FaxAccountId']=_0x51027f['id'];if(_0x593920[_0x74f1('0x3f')]['filter']){_0x2b457a[_0x74f1('0x46')]=_['merge'](_0x2b457a[_0x74f1('0x46')],{'$or':_[_0x74f1('0x3a')](_0x2b457a[_0x74f1('0x42')],function(_0x4d8dc7){var _0x1d59f1={};_0x1d59f1[_0x4d8dc7]={'$like':'%'+_0x593920['query'][_0x74f1('0x48')]+'%'};return _0x1d59f1;})});}_0x2b457a=_[_0x74f1('0x49')]({},_0x2b457a,_0x593920[_0x74f1('0x4a')]);return db[_0x74f1('0x6e')]['count']({'where':_0x2b457a[_0x74f1('0x46')]})[_0x74f1('0x30')](function(_0x3d22d3){_0x386627[_0x74f1('0x2b')]=_0x3d22d3;if(_0x593920[_0x74f1('0x3f')][_0x74f1('0x51')]){_0x2b457a['include']=[{'model':db[_0x74f1('0x71')],'as':_0x74f1('0x72'),'required':![]},{'model':db[_0x74f1('0x73')],'as':_0x74f1('0x74'),'attributes':[_0x74f1('0x36'),_0x74f1('0x75'),'internal'],'required':![]},{'model':db[_0x74f1('0x76')],'as':_0x74f1('0x77'),'attributes':['id',_0x74f1('0x36'),_0x74f1('0x78')],'where':_0x593920[_0x74f1('0x3f')][_0x74f1('0x79')]?{'id':_0x593920[_0x74f1('0x3f')][_0x74f1('0x79')]}:undefined,'required':_0x593920['query']['tag']?!![]:![]}];}return db[_0x74f1('0x6e')][_0x74f1('0x4d')](_0x2b457a);})[_0x74f1('0x30')](function(_0x34bd1b){_0x386627['rows']=_0x34bd1b;return _0x386627;});}})[_0x74f1('0x30')](respondWithFilteredResult(_0x31fbe6,_0x2b457a))['catch'](handleError(_0x31fbe6,null));};exports[_0x74f1('0x7a')]=function(_0x58ac62,_0x3fc35c,_0x579a2a){return db['FaxAccount'][_0x74f1('0x63')]({'where':{'id':_0x58ac62['params']['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x3fc35c,null))[_0x74f1('0x30')](function(_0x46267a){if(_0x46267a){return db[_0x74f1('0x7b')][_0x74f1('0x7c')](function(_0x4007ba){return db['FaxApplication'][_0x74f1('0x31')]({'where':{'FaxAccountId':_0x58ac62[_0x74f1('0x4f')]['id']},'transaction':_0x4007ba})[_0x74f1('0x30')](function(_0x54b7a6){var _0x38a1dc=_[_0x74f1('0x3a')](_0x58ac62[_0x74f1('0x54')],function(_0x1077bd){_0x1077bd[_0x74f1('0x60')]=_0x58ac62['params']['id'];return _0x1077bd;});return db[_0x74f1('0x7d')][_0x74f1('0x7e')](_0x38a1dc,{'transaction':_0x4007ba});});})[_0x74f1('0x30')](function(){return db[_0x74f1('0x7d')][_0x74f1('0x7f')]({'where':{'FaxAccountId':_0x58ac62[_0x74f1('0x4f')]['id']},'order':'priority'});});}})[_0x74f1('0x30')](respondWithResult(_0x3fc35c,null))[_0x74f1('0x27')](handleError(_0x3fc35c,null));};exports['getApplications']=function(_0x541a60,_0x5be9d6,_0x3a86ee){var _0x2faf5c={};var _0x2a1e60={};var _0x3f3001;var _0x238a7f;return db['FaxAccount'][_0x74f1('0x63')]({'where':{'id':_0x541a60[_0x74f1('0x4f')]['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x5be9d6,null))['then'](function(_0x4b1a21){if(_0x4b1a21){_0x3f3001=_0x4b1a21;_0x2a1e60['model']=_[_0x74f1('0x50')](db[_0x74f1('0x7d')][_0x74f1('0x3b')]);_0x2a1e60['query']=_[_0x74f1('0x50')](_0x541a60[_0x74f1('0x3f')]);_0x2a1e60[_0x74f1('0x40')]=_['intersection'](_0x2a1e60['model'],_0x2a1e60[_0x74f1('0x3f')]);_0x2faf5c['attributes']=_[_0x74f1('0x41')](_0x2a1e60[_0x74f1('0x3e')],qs[_0x74f1('0x43')](_0x541a60[_0x74f1('0x3f')][_0x74f1('0x43')]));_0x2faf5c[_0x74f1('0x42')]=_0x2faf5c[_0x74f1('0x42')][_0x74f1('0x44')]?_0x2faf5c[_0x74f1('0x42')]:_0x2a1e60[_0x74f1('0x3e')];_0x2faf5c[_0x74f1('0x65')]=qs[_0x74f1('0x66')](_0x541a60[_0x74f1('0x3f')][_0x74f1('0x66')]);_0x2faf5c[_0x74f1('0x46')]=qs[_0x74f1('0x40')](_['pick'](_0x541a60[_0x74f1('0x3f')],_0x2a1e60[_0x74f1('0x40')]));if(_0x541a60[_0x74f1('0x3f')][_0x74f1('0x48')]){_0x2faf5c[_0x74f1('0x46')]=_[_0x74f1('0x49')](_0x2faf5c['where'],{'$or':_[_0x74f1('0x3a')](_0x2faf5c[_0x74f1('0x42')],function(_0x448952){var _0x3c3c59={};_0x3c3c59[_0x448952]={'$like':'%'+_0x541a60[_0x74f1('0x3f')][_0x74f1('0x48')]+'%'};return _0x3c3c59;})});}_0x2faf5c=_[_0x74f1('0x49')]({},_0x2faf5c,_0x541a60['options']);return _0x3f3001[_0x74f1('0x80')](_0x2faf5c);}})['then'](function(_0x274868){if(_0x274868){_0x238a7f=_0x274868[_0x74f1('0x44')];if(!_0x541a60[_0x74f1('0x3f')][_0x74f1('0x45')]('nolimit')){_0x2faf5c['limit']=qs['limit'](_0x541a60[_0x74f1('0x3f')][_0x74f1('0x2d')]);_0x2faf5c[_0x74f1('0x2c')]=qs[_0x74f1('0x2c')](_0x541a60[_0x74f1('0x3f')][_0x74f1('0x2c')]);}return _0x3f3001[_0x74f1('0x80')](_0x2faf5c);}})[_0x74f1('0x30')](function(_0x78f858){if(_0x78f858){return _0x78f858?{'count':_0x238a7f,'rows':_0x78f858}:null;}})[_0x74f1('0x30')](respondWithResult(_0x5be9d6,null))['catch'](handleError(_0x5be9d6,null));};function Extension(_0xf090bd,_0x26ee12,_0x44fb0a,_0x517aaa){this[_0x74f1('0x81')]=_0x74f1('0x82');this[_0x74f1('0x83')]=_0xf090bd[_0x74f1('0x84')];this[_0x74f1('0x85')]=_0x517aaa;this['type']='system';this[_0x74f1('0x86')]='Fax\x20Extension';this[_0x74f1('0x60')]=_0xf090bd['id'];this[_0x74f1('0x87')]=_0x26ee12;this[_0x74f1('0x88')]=_0x44fb0a;}function createExtensionsReciveFax(_0x294981){var _0x37b102=0x1;var _0x33e302=[];_0x33e302[_0x74f1('0x89')](new Extension(_0x294981,_0x37b102,'',_0x74f1('0x8a')));_0x37b102+=0x1;_0x33e302['push'](new Extension(_0x294981,_0x37b102,'CDR(type)=inbound-fax',_0x74f1('0x8b')));_0x37b102+=0x1;for(var _0x40ce83 in _0x294981){if(_0x294981[_0x74f1('0x45')](_0x40ce83)&&(_0x40ce83===_0x74f1('0x8c')||_0x40ce83===_0x74f1('0x84')||_0x40ce83===_0x74f1('0x8d')||_0x40ce83===_0x74f1('0x8e')||_0x40ce83===_0x74f1('0x8f')||_0x40ce83==='maxrate'||_0x40ce83===_0x74f1('0x90')||_0x40ce83==='modem'||_0x40ce83===_0x74f1('0x91'))){_0x33e302[_0x74f1('0x89')](new Extension(_0x294981,_0x37b102,_0x74f1('0x92')+_0x40ce83+')='+_0x294981[_0x40ce83],_0x74f1('0x8b')));_0x37b102+=0x1;}}_0x33e302[_0x74f1('0x89')](new Extension(_0x294981,_0x37b102,'6',_0x74f1('0x93')));_0x37b102+=0x1;_0x33e302[_0x74f1('0x89')](new Extension(_0x294981,_0x37b102,'/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',_0x74f1('0x94')));_0x37b102=0x0;return _0x33e302;}exports[_0x74f1('0x95')]=function(_0x36051,_0x4504a8,_0x18a2d3){var _0x1aba2e;return db['sequelize'][_0x74f1('0x7c')](function(_0x505751){return db[_0x74f1('0x4b')][_0x74f1('0x53')](_0x36051[_0x74f1('0x54')],{'transaction':_0x505751})[_0x74f1('0x30')](function(_0x3d282a){_0x1aba2e=_0x3d282a['get']({'plain':!![]});return db[_0x74f1('0x96')][_0x74f1('0x7e')](createExtensionsReciveFax(_0x1aba2e),{'transaction':_0x505751});});})['then'](function(){return _0x1aba2e;})['then'](respondWithResult(_0x4504a8,null))['catch'](handleError(_0x4504a8,null));};exports[_0x74f1('0x97')]=function(_0x223050,_0x491583,_0x9038e3){var _0x3f68da;return db['sequelize'][_0x74f1('0x7c')](function(_0x2cd6e7){return db['FaxAccount'][_0x74f1('0x5c')](_0x223050[_0x74f1('0x54')],{'where':{'id':_0x223050[_0x74f1('0x54')]['id']},'transaction':_0x2cd6e7})[_0x74f1('0x30')](function(_0x3b8d83){return db[_0x74f1('0x96')]['destroy']({'where':{'FaxAccountId':_0x223050[_0x74f1('0x54')]['id']},'transaction':_0x2cd6e7})[_0x74f1('0x30')](function(_0x4b21f9){return db['VoiceExtension'][_0x74f1('0x7e')](createExtensionsReciveFax(_[_0x74f1('0x6f')](_0x223050[_0x74f1('0x54')],['tech',_0x74f1('0x3d'),_0x74f1('0x98'),_0x74f1('0x99'),'TrunkId','ListId'])),{'transaction':_0x2cd6e7});});});})[_0x74f1('0x30')](function(){return db[_0x74f1('0x4b')][_0x74f1('0x9a')](_0x223050[_0x74f1('0x54')]['id']);})[_0x74f1('0x30')](respondWithResult(_0x491583,null))[_0x74f1('0x27')](handleError(_0x491583,null));};exports[_0x74f1('0x9b')]=function(_0x561e06,_0xad4224,_0x6d286){var _0x5586c9={'raw':!![],'where':{}};var _0xcfdeec={};var _0x4369f6={'count':0x0,'rows':[]};return db[_0x74f1('0x4b')][_0x74f1('0x63')]({'where':{'id':_0x561e06['params']['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0xad4224,null))[_0x74f1('0x30')](function(_0x500a1b){if(_0x500a1b){_0xcfdeec[_0x74f1('0x3e')]=_[_0x74f1('0x50')](db['FaxMessage'][_0x74f1('0x3b')]);_0xcfdeec[_0x74f1('0x3f')]=_[_0x74f1('0x50')](_0x561e06[_0x74f1('0x3f')]);_0xcfdeec[_0x74f1('0x40')]=_[_0x74f1('0x41')](_0xcfdeec[_0x74f1('0x3e')],_0xcfdeec[_0x74f1('0x3f')]);_0x5586c9[_0x74f1('0x42')]=_[_0x74f1('0x41')](_0xcfdeec[_0x74f1('0x3e')],qs['fields'](_0x561e06[_0x74f1('0x3f')][_0x74f1('0x43')]));_0x5586c9[_0x74f1('0x42')]=_0x5586c9[_0x74f1('0x42')][_0x74f1('0x44')]?_0x5586c9['attributes']:_0xcfdeec[_0x74f1('0x3e')];if(!_0x561e06[_0x74f1('0x3f')][_0x74f1('0x45')](_0x74f1('0x64'))){_0x5586c9['limit']=qs[_0x74f1('0x2d')](_0x561e06[_0x74f1('0x3f')]['limit']);_0x5586c9[_0x74f1('0x2c')]=qs['offset'](_0x561e06['query'][_0x74f1('0x2c')]);}_0x5586c9[_0x74f1('0x65')]=qs[_0x74f1('0x66')](_0x561e06[_0x74f1('0x3f')][_0x74f1('0x66')]);_0x5586c9[_0x74f1('0x46')]=qs[_0x74f1('0x40')](_[_0x74f1('0x47')](_0x561e06[_0x74f1('0x3f')],_0xcfdeec[_0x74f1('0x40')]));_0x5586c9[_0x74f1('0x46')][_0x74f1('0x60')]=_0x500a1b['id'];if(_0x561e06[_0x74f1('0x3f')][_0x74f1('0x48')]){_0x5586c9[_0x74f1('0x46')]=_[_0x74f1('0x49')](_0x5586c9[_0x74f1('0x46')],{'$or':_['map'](_0x5586c9['attributes'],function(_0x31ebb3){var _0x114d99={};_0x114d99[_0x31ebb3]={'$like':'%'+_0x561e06['query'][_0x74f1('0x48')]+'%'};return _0x114d99;})});}if(_0x561e06['query'][_0x74f1('0x9c')]){var _0x51b224=_0x561e06[_0x74f1('0x3f')][_0x74f1('0x9c')]['split'](',');var _0x31a65a={};_0x31a65a[_0x51b224[0x0]]={'$gte':moment(_0x51b224[0x1])[_0x74f1('0x9d')](_0x74f1('0x9e'))};_0x5586c9[_0x74f1('0x46')]=_[_0x74f1('0x49')](_0x5586c9['where'],_0x31a65a);}_0x5586c9=_[_0x74f1('0x49')]({},_0x5586c9,_0x561e06[_0x74f1('0x4a')]);return db[_0x74f1('0x9f')][_0x74f1('0x2b')]({'where':_0x5586c9[_0x74f1('0x46')]})[_0x74f1('0x30')](function(_0x50f2f2){_0x4369f6[_0x74f1('0x2b')]=_0x50f2f2;if(_0x561e06[_0x74f1('0x3f')]['includeAll']){_0x5586c9[_0x74f1('0x4c')]=[{'all':!![]}];}return db[_0x74f1('0x9f')]['findAll'](_0x5586c9);})[_0x74f1('0x30')](function(_0x4ef47c){_0x4369f6[_0x74f1('0x4e')]=_0x4ef47c;return _0x4369f6;});}})['then'](respondWithFilteredResult(_0xad4224,_0x5586c9))[_0x74f1('0x27')](handleError(_0xad4224,null));};exports[_0x74f1('0x37')]=function(_0x3b73da,_0x282cbe,_0x5b7c63){var _0x1be630,_0x307c50={},_0x5dd376;if(_0x3b73da['body']['to']){_0x5dd376=_0x3b73da[_0x74f1('0x54')]['to'][0x0];}return db[_0x74f1('0x4b')]['find']({'where':{'id':_0x3b73da[_0x74f1('0x4f')]['id']},'include':[{'model':db[_0x74f1('0xa0')],'as':_0x74f1('0xa1'),'include':[{'model':db[_0x74f1('0x71')],'as':_0x74f1('0xa2'),'where':{'fax':_0x5dd376},'limit':0x1,'order':[[_0x74f1('0x99'),_0x74f1('0xa3')]]}]}]})[_0x74f1('0x30')](handleEntityNotFound(_0x282cbe,null))[_0x74f1('0x30')](function(_0x256087){_0x1be630=_0x256087;if(_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa4')]&&_0x3b73da[_0x74f1('0x54')]['attachments'][_0x74f1('0x44')]){for(var _0x12c936=0x0;_0x12c936<_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa4')]['length'];_0x12c936+=0x1){_0x3b73da[_0x74f1('0x54')]['attachments'][_0x12c936]={'filename':_0x3b73da[_0x74f1('0x54')]['attachments'][_0x12c936]['name'],'id':_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa4')][_0x12c936]['id'],'path':path['join'](config['root'],_0x74f1('0xa5'),_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa4')][_0x12c936]['basename'])};}}return respondWithRpcPromise(_0x74f1('0xa6'),_0x74f1('0xa6'),{'FaxAccountId':_[_0x74f1('0xa7')](_0x3b73da['params']['id'])?undefined:_0x3b73da[_0x74f1('0x4f')]['id'],'path':_[_0x74f1('0xa7')](_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa4')][0x0][_0x74f1('0xa8')])?undefined:_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa4')][0x0][_0x74f1('0xa8')],'fax':_[_0x74f1('0xa7')](_0x3b73da[_0x74f1('0x54')]['to'][0x0])?undefined:_0x3b73da[_0x74f1('0x54')]['to'][0x0]},client9002);})['then'](function(){if(_0x1be630){if(_['isNil'](_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa9')])){_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa9')]=util[_0x74f1('0x9d')](_0x74f1('0xaa'),_0x1be630['name'],_0x1be630[_0x74f1('0xab')]);}if(_0x1be630[_0x74f1('0xa1')]){if(_0x1be630[_0x74f1('0xa1')][_0x74f1('0xa2')]['length']){return _0x1be630[_0x74f1('0xa1')][_0x74f1('0xa2')][0x0];}else{return db[_0x74f1('0x71')][_0x74f1('0x53')](_[_0x74f1('0x17')](_0x3b73da['body'],{'firstName':_0x3b73da[_0x74f1('0x54')]['to'][0x0],'phone':_0x3b73da[_0x74f1('0x54')]['to'][0x0],'fax':_0x3b73da[_0x74f1('0x54')]['to'][0x0],'ListId':_0x1be630[_0x74f1('0xac')]}));}}else{throw new Error(_0x74f1('0xad'));}}else{throw new Error(_0x74f1('0xae'));}})['then'](function(_0x2c6866){if(_0x2c6866){return db[_0x74f1('0x6e')][_0x74f1('0x52')]({'where':{'ContactId':_0x2c6866['id'],'closed':![],'FaxAccountId':_0x1be630['id']}})[_0x74f1('0x30')](function(_0x2da74c){if(_0x2da74c){return[_0x2da74c,![]];}return db[_0x74f1('0x6e')]['create']({'UserId':_0x3b73da['user']['id'],'ContactId':_0x2c6866['id'],'FaxAccountId':_0x1be630['id'],'fax':_0x3b73da['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x74f1('0x49')](_0x3b73da[_0x74f1('0x54')],{'read':![],'body':_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa4')][0x0]['filename'],'FaxAccountId':_0x1be630['id'],'UserId':_0x3b73da[_0x74f1('0x55')]['id'],'ContactId':_0x2c6866['id'],'AttachmentId':_0x3b73da['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x74f1('0x9f')],'as':_0x74f1('0xaf')}]})[_0x74f1('0x30')](function(_0xa89d74){return[_0xa89d74,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x4ceca9,_0x3672ee){if(_0x3672ee){return _0x4ceca9;}return db['FaxMessage'][_0x74f1('0x53')]({'direction':_0x74f1('0xb0'),'read':![],'body':_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa4')][0x0][_0x74f1('0xb1')],'FaxAccountId':_0x1be630['id'],'FaxInteractionId':_0x4ceca9['id'],'UserId':_0x3b73da[_0x74f1('0x55')]['id'],'ContactId':_0x4ceca9[_0x74f1('0xb2')],'AttachmentId':_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa4')][0x0]['id']})[_0x74f1('0x30')](function(_0x4f583e){_0x4ceca9[_0x74f1('0xb3')]['Messages']=[];_0x4ceca9[_0x74f1('0xb3')][_0x74f1('0xaf')][_0x74f1('0x89')](_0x4f583e[_0x74f1('0xb3')]);return _0x4ceca9;});})[_0x74f1('0x30')](function(_0xdf147b){respondWithRpcPromise(_0x74f1('0xb4'),_0x74f1('0xb4'),{'FaxAccountId':_['isNil'](_0x3b73da[_0x74f1('0x4f')]['id'])?undefined:_0x3b73da[_0x74f1('0x4f')]['id'],'path':_[_0x74f1('0xa7')](_0x3b73da[_0x74f1('0x54')]['attachments'][0x0][_0x74f1('0xa8')])?undefined:_0x3b73da[_0x74f1('0x54')][_0x74f1('0xa4')][0x0]['path'],'fax':_[_0x74f1('0xa7')](_0x3b73da['body']['to'][0x0])?undefined:_0x3b73da['body']['to'][0x0],'AttachmentId':_0x3b73da[_0x74f1('0x54')]['attachments'][0x0]['id']},client9002)[_0x74f1('0x30')](function(_0x373ce3){logger[_0x74f1('0x1f')]('SendFaxRpc,\x20%s',_0x373ce3);})[_0x74f1('0x27')](function(_0x2db35f){logger[_0x74f1('0x1f')](_0x74f1('0xb5'),_0x2db35f);});return _0xdf147b;})[_0x74f1('0x30')](respondWithResult(_0x282cbe,null))['catch'](handleError(_0x282cbe,null));};exports[_0x74f1('0xb6')]=function(_0x50f270,_0x46e479,_0x50a2f0){return db[_0x74f1('0x4b')]['find']({'where':{'id':_0x50f270['params']['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x46e479,null))[_0x74f1('0x30')](function(_0x47b465){if(_0x47b465){return _0x47b465[_0x74f1('0xb6')](_0x50f270[_0x74f1('0x54')][_0x74f1('0x68')],_[_0x74f1('0x6f')](_0x50f270[_0x74f1('0x54')],[_0x74f1('0x68'),'id'])||{})[_0x74f1('0xb7')](function(_0x28ad4b){for(var _0x5c05d1=0x0;_0x5c05d1<_0x50f270[_0x74f1('0x54')]['ids']['length'];_0x5c05d1+=0x1){socket[_0x74f1('0xb8')](_0x74f1('0xb9'),{'UserId':_0x50f270[_0x74f1('0x54')][_0x74f1('0x68')][_0x5c05d1],'FaxAccountId':_0x50f270[_0x74f1('0x4f')]['id']});}return _0x28ad4b;});}})[_0x74f1('0x30')](respondWithResult(_0x46e479,null))[_0x74f1('0x27')](handleError(_0x46e479,null));};exports[_0x74f1('0xba')]=function(_0xa43b58,_0x2c442b,_0x2231a2){return db['FaxAccount'][_0x74f1('0x52')]({'where':{'id':_0xa43b58[_0x74f1('0x4f')]['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x2c442b,null))['then'](function(_0x5cbcf3){if(_0x5cbcf3){return _0x5cbcf3[_0x74f1('0xba')](_0xa43b58[_0x74f1('0x3f')]['ids'])[_0x74f1('0x30')](function(){if(_[_0x74f1('0xbb')](_0xa43b58[_0x74f1('0x3f')]['ids'])){for(var _0x746970=0x0;_0x746970<_0xa43b58[_0x74f1('0x3f')]['ids']['length'];_0x746970+=0x1){socket[_0x74f1('0xb8')]('userFaxAccount:remove',{'UserId':Number(_0xa43b58[_0x74f1('0x3f')][_0x74f1('0x68')][_0x746970]),'FaxAccountId':Number(_0xa43b58[_0x74f1('0x4f')]['id'])});}}else{socket[_0x74f1('0xb8')]('userFaxAccount:remove',{'UserId':Number(_0xa43b58['query']['ids']),'FaxAccountId':Number(_0xa43b58[_0x74f1('0x4f')]['id'])});}});}})[_0x74f1('0x30')](respondWithStatusCode(_0x2c442b,null))[_0x74f1('0x27')](handleError(_0x2c442b,null));};exports[_0x74f1('0xbc')]=function(_0x519ca0,_0x38491c,_0x4238e9){var _0x20bb3e={};var _0x4c410c={};var _0x194543;var _0xefcf65;return db[_0x74f1('0x4b')][_0x74f1('0x63')]({'where':{'id':_0x519ca0[_0x74f1('0x4f')]['id']}})[_0x74f1('0x30')](handleEntityNotFound(_0x38491c,null))[_0x74f1('0x30')](function(_0x52aff6){if(_0x52aff6){_0x194543=_0x52aff6;_0x4c410c[_0x74f1('0x3e')]=_['keys'](db[_0x74f1('0x73')]['rawAttributes']);_0x4c410c[_0x74f1('0x3f')]=_[_0x74f1('0x50')](_0x519ca0[_0x74f1('0x3f')]);_0x4c410c['filters']=_[_0x74f1('0x41')](_0x4c410c['model'],_0x4c410c[_0x74f1('0x3f')]);_0x20bb3e[_0x74f1('0x42')]=_[_0x74f1('0x41')](_0x4c410c[_0x74f1('0x3e')],qs['fields'](_0x519ca0['query'][_0x74f1('0x43')]));_0x20bb3e['attributes']=_0x20bb3e[_0x74f1('0x42')]['length']?_0x20bb3e[_0x74f1('0x42')]:_0x4c410c[_0x74f1('0x3e')];_0x20bb3e['order']=qs[_0x74f1('0x66')](_0x519ca0[_0x74f1('0x3f')][_0x74f1('0x66')]);_0x20bb3e[_0x74f1('0x46')]=qs[_0x74f1('0x40')](_[_0x74f1('0x47')](_0x519ca0[_0x74f1('0x3f')],_0x4c410c['filters']));if(_0x519ca0[_0x74f1('0x3f')][_0x74f1('0x48')]){_0x20bb3e[_0x74f1('0x46')]=_['merge'](_0x20bb3e[_0x74f1('0x46')],{'$or':_[_0x74f1('0x3a')](_0x20bb3e[_0x74f1('0x42')],function(_0x27c0ac){var _0x1da59c={};_0x1da59c[_0x27c0ac]={'$like':'%'+_0x519ca0[_0x74f1('0x3f')][_0x74f1('0x48')]+'%'};return _0x1da59c;})});}_0x20bb3e=_['merge']({},_0x20bb3e,_0x519ca0['options']);return _0x194543['getAgents'](_0x20bb3e);}})['then'](function(_0x4c6e9a){if(_0x4c6e9a){_0xefcf65=_0x4c6e9a['length'];if(!_0x519ca0[_0x74f1('0x3f')][_0x74f1('0x45')](_0x74f1('0x64'))){_0x20bb3e[_0x74f1('0x2d')]=qs[_0x74f1('0x2d')](_0x519ca0['query']['limit']);_0x20bb3e[_0x74f1('0x2c')]=qs['offset'](_0x519ca0[_0x74f1('0x3f')][_0x74f1('0x2c')]);}return _0x194543[_0x74f1('0xbc')](_0x20bb3e);}})[_0x74f1('0x30')](function(_0x5f1f9e){if(_0x5f1f9e){return _0x5f1f9e?{'count':_0xefcf65,'rows':_0x5f1f9e}:null;}})[_0x74f1('0x30')](respondWithResult(_0x38491c,null))[_0x74f1('0x27')](handleError(_0x38491c,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index bac7132..0c7cb1b 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 _0x38e8=['hasOwnProperty','exports','events','FaxAccount','setMaxListeners','save','remove','emit'];(function(_0x1270c0,_0x4f3d67){var _0x2cabfd=function(_0x301b14){while(--_0x301b14){_0x1270c0['push'](_0x1270c0['shift']());}};_0x2cabfd(++_0x4f3d67);}(_0x38e8,0x17a));var _0x838e=function(_0x5a351c,_0x43f5a6){_0x5a351c=_0x5a351c-0x0;var _0x129558=_0x38e8[_0x5a351c];return _0x129558;};'use strict';var EventEmitter=require(_0x838e('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x838e('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x838e('0x2')](0x0);var events={'afterCreate':_0x838e('0x3'),'afterUpdate':'update','afterDestroy':_0x838e('0x4')};function emitEvent(_0x9cb285){return function(_0x3c9c81,_0x29f4ad,_0x17860b){FaxAccountEvents[_0x838e('0x5')](_0x9cb285+':'+_0x3c9c81['id'],_0x3c9c81);FaxAccountEvents['emit'](_0x9cb285,_0x3c9c81);_0x17860b(null);};}for(var e in events){if(events[_0x838e('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x838e('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x683e=['events','FaxAccount','setMaxListeners','save','update','remove','emit','exports'];(function(_0x1aa6a9,_0x8ca9a9){var _0x4181f7=function(_0x457968){while(--_0x457968){_0x1aa6a9['push'](_0x1aa6a9['shift']());}};_0x4181f7(++_0x8ca9a9);}(_0x683e,0x190));var _0xe683=function(_0x47ba2f,_0x3ea976){_0x47ba2f=_0x47ba2f-0x0;var _0xc5c358=_0x683e[_0x47ba2f];return _0xc5c358;};'use strict';var EventEmitter=require(_0xe683('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xe683('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xe683('0x2')](0x0);var events={'afterCreate':_0xe683('0x3'),'afterUpdate':_0xe683('0x4'),'afterDestroy':_0xe683('0x5')};function emitEvent(_0x26ac38){return function(_0x4faf07,_0x2f59ea,_0x5a0c25){FaxAccountEvents[_0xe683('0x6')](_0x26ac38+':'+_0x4faf07['id'],_0x4faf07);FaxAccountEvents[_0xe683('0x6')](_0x26ac38,_0x4faf07);_0x5a0c25(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xe683('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index dc9df1b..588017f 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 _0xe7ed=['../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe7ed,0xba));var _0xde7e=function(_0x2ff9fc,_0x39c682){_0x2ff9fc=_0x2ff9fc-0x0;var _0x14919d=_0xe7ed[_0x2ff9fc];return _0x14919d;};'use strict';var _=require(_0xde7e('0x0'));var util=require('util');var logger=require(_0xde7e('0x1'))('api');var moment=require(_0xde7e('0x2'));var BPromise=require(_0xde7e('0x3'));var rp=require(_0xde7e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde7e('0x5'));var config=require(_0xde7e('0x6'));var attributes=require(_0xde7e('0x7'));module[_0xde7e('0x8')]=function(_0x46c46c,_0x5b07fe){return _0x46c46c[_0xde7e('0x9')](_0xde7e('0xa'),attributes,{'tableName':_0xde7e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81bf=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts'];(function(_0x4aa6a7,_0x3cd8a9){var _0x586167=function(_0x5e1452){while(--_0x5e1452){_0x4aa6a7['push'](_0x4aa6a7['shift']());}};_0x586167(++_0x3cd8a9);}(_0x81bf,0x12c));var _0xf81b=function(_0x53b8c0,_0x20d60e){_0x53b8c0=_0x53b8c0-0x0;var _0x57cd=_0x81bf[_0x53b8c0];return _0x57cd;};'use strict';var _=require(_0xf81b('0x0'));var util=require(_0xf81b('0x1'));var logger=require(_0xf81b('0x2'))(_0xf81b('0x3'));var moment=require('moment');var BPromise=require(_0xf81b('0x4'));var rp=require(_0xf81b('0x5'));var fs=require('fs');var path=require(_0xf81b('0x6'));var rimraf=require('rimraf');var config=require(_0xf81b('0x7'));var attributes=require(_0xf81b('0x8'));module[_0xf81b('0x9')]=function(_0x7b0d17,_0x3f3b4e){return _0x7b0d17[_0xf81b('0xa')]('FaxAccount',attributes,{'tableName':_0xf81b('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 12c2c88..6101fc2 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 _0x8e85=['attributes','include','map','debug','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','List','Contacts','FaxApplication','Applications','get','list','applications','priority','asc','length','contact','FaxInteraction','create','Contact\x20not\x20found','spread','autoclose','push','close','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','redis','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetFaxAccount','findAll','options','raw','where'];(function(_0xe9ed38,_0x540b64){var _0x2b9e06=function(_0x4e0dc4){while(--_0x4e0dc4){_0xe9ed38['push'](_0xe9ed38['shift']());}};_0x2b9e06(++_0x540b64);}(_0x8e85,0x1e6));var _0x58e8=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x8e85[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x58e8('0x0'));var BPromise=require(_0x58e8('0x1'));var rs=require(_0x58e8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58e8('0x3'))['db'];var utils=require(_0x58e8('0x4'));var logger=require(_0x58e8('0x5'))(_0x58e8('0x6'));var config=require('../../config/environment');var jayson=require(_0x58e8('0x7'));var client=jayson[_0x58e8('0x8')][_0x58e8('0x9')]({'port':0x232c});config['redis']=_[_0x58e8('0xa')](config['redis'],{'host':_0x58e8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x58e8('0xc')]));require(_0x58e8('0xd'))[_0x58e8('0xe')](socket);function respondWithRpcPromise(_0x3a2a62,_0x1f2dd3,_0x544672){return new BPromise(function(_0x56d01a,_0x1dff50){return client[_0x58e8('0xf')](_0x3a2a62,_0x544672)[_0x58e8('0x10')](function(_0x5ca41f){logger[_0x58e8('0x11')](_0x58e8('0x12'),_0x1f2dd3,_0x58e8('0x13'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1f2dd3,'request\x20sent',JSON[_0x58e8('0x14')](_0x5ca41f));if(_0x5ca41f[_0x58e8('0x15')]){if(_0x5ca41f['error']['code']===0x1f4){logger[_0x58e8('0x15')]('FaxAccount,\x20%s,\x20%s',_0x1f2dd3,_0x5ca41f[_0x58e8('0x15')][_0x58e8('0x16')]);return _0x1dff50(_0x5ca41f[_0x58e8('0x15')]['message']);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x1f2dd3,_0x5ca41f[_0x58e8('0x15')][_0x58e8('0x16')]);return _0x56d01a(_0x5ca41f['error'][_0x58e8('0x16')]);}else{logger['info'](_0x58e8('0x12'),_0x1f2dd3,_0x58e8('0x13'));_0x56d01a(_0x5ca41f[_0x58e8('0x17')][_0x58e8('0x16')]);}})[_0x58e8('0x18')](function(_0x3bfb91){logger[_0x58e8('0x15')](_0x58e8('0x12'),_0x1f2dd3,_0x3bfb91);_0x1dff50(_0x3bfb91);});});}exports[_0x58e8('0x19')]=function(_0x4f841d){var _0x299c8a=this;return new Promise(function(_0x749fca,_0x142355){return db['FaxAccount'][_0x58e8('0x1a')]({'raw':_0x4f841d[_0x58e8('0x1b')]?_0x4f841d['options'][_0x58e8('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f841d[_0x58e8('0x1b')]?_0x4f841d[_0x58e8('0x1b')][_0x58e8('0x1d')]||null:null,'attributes':_0x4f841d[_0x58e8('0x1b')]?_0x4f841d[_0x58e8('0x1b')][_0x58e8('0x1e')]||null:null,'limit':_0x4f841d[_0x58e8('0x1b')]?_0x4f841d['options']['limit']||null:null,'include':_0x4f841d[_0x58e8('0x1b')]?_0x4f841d['options'][_0x58e8('0x1f')]?_[_0x58e8('0x20')](_0x4f841d[_0x58e8('0x1b')][_0x58e8('0x1f')],function(_0x370ccb){return{'model':db[_0x370ccb['model']],'as':_0x370ccb['as'],'attributes':_0x370ccb[_0x58e8('0x1e')],'include':_0x370ccb['include']?_[_0x58e8('0x20')](_0x370ccb[_0x58e8('0x1f')],function(_0x340edd){return{'model':db[_0x340edd['model']],'as':_0x340edd['as'],'attributes':_0x340edd[_0x58e8('0x1e')],'include':_0x340edd[_0x58e8('0x1f')]?_[_0x58e8('0x20')](_0x340edd[_0x58e8('0x1f')],function(_0x18e9e0){return{'model':db[_0x18e9e0['model']],'as':_0x18e9e0['as'],'attributes':_0x18e9e0[_0x58e8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x58e8('0x10')](function(_0x319712){logger[_0x58e8('0x11')](_0x58e8('0x19'),_0x4f841d);logger[_0x58e8('0x21')](_0x58e8('0x19'),_0x4f841d,JSON[_0x58e8('0x14')](_0x319712));_0x749fca(_0x319712);})['catch'](function(_0x40f4d1){logger[_0x58e8('0x15')]('GetFaxAccount',_0x40f4d1[_0x58e8('0x16')],_0x4f841d);_0x142355(_0x299c8a[_0x58e8('0x15')](0x1f4,_0x40f4d1[_0x58e8('0x16')]));});});};exports[_0x58e8('0x22')]=function(_0xed17a0,_0x57d7a1,_0x58df4d){var _0xbef455=this;return new Promise(function(_0x6cd58f,_0x246850){var _0x56a443={'body':_0xed17a0[_0x58e8('0x23')],'channel':_0x58e8('0x24')};var _0x53753a=[];var _0x5451c8=[];var _0x440b3e={};return db[_0x58e8('0x25')][_0x58e8('0x26')]()[_0x58e8('0x10')](function(_0xeb14f8){if(!_0xeb14f8){throw new db[(_0x58e8('0x27'))][(_0x58e8('0x28'))]('no\x20available\x20attributes');}_0x53753a=_[_0x58e8('0x29')](_[_0x58e8('0x2a')](_0xeb14f8),[_0x58e8('0x2b'),'updatedAt']);_0x5451c8=_['difference'](_[_0x58e8('0x2a')](_0xeb14f8),[_0x58e8('0x2b'),_0x58e8('0x2c'),_0x58e8('0x2d'),_0x58e8('0x2e')]);if(_0xed17a0[_0x58e8('0x23')]['id']){delete _0xed17a0[_0x58e8('0x23')]['id'];}if(_['isNil'](_0xed17a0[_0x58e8('0x23')][_0x58e8('0x2f')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0x58e8('0x30')](_0xed17a0[_0x58e8('0x23')][_0x58e8('0x23')])||_0xed17a0[_0x58e8('0x23')][_0x58e8('0x23')]===''){throw new db[(_0x58e8('0x27'))][(_0x58e8('0x28'))](_0x58e8('0x31'));}if(_[_0x58e8('0x30')](_0xed17a0['body'][_0x58e8('0x32')])){throw new db[(_0x58e8('0x27'))][(_0x58e8('0x28'))](_0x58e8('0x33')+_0x5451c8);}if(!_['includes'](_0x5451c8,_0xed17a0[_0x58e8('0x23')]['mapKey'])){throw new db[(_0x58e8('0x27'))][(_0x58e8('0x28'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5451c8);}_0x440b3e[_0xed17a0[_0x58e8('0x23')]['mapKey']]=_0xed17a0[_0x58e8('0x23')]['from'];})[_0x58e8('0x10')](function(){return db[_0x58e8('0x34')][_0x58e8('0x35')]({'where':{'id':_0xed17a0[_0x58e8('0x36')]['id']},'include':[{'model':db['CmList'],'as':_0x58e8('0x37'),'include':[{'model':db['CmContact'],'as':_0x58e8('0x38'),'where':_0x440b3e,'limit':0x1,'order':[[_0x58e8('0x2c'),'DESC']]}]},{'model':db[_0x58e8('0x39')],'as':_0x58e8('0x3a')}]});})[_0x58e8('0x10')](function(_0x259240){if(_0x259240&&_0x259240[_0x58e8('0x37')]){var _0x1001d3=_0x259240[_0x58e8('0x3b')]({'plain':!![]});_0x56a443[_0x58e8('0x36')]=_0x1001d3;_0x56a443['applications']=_0x1001d3[_0x58e8('0x3a')];_0x56a443[_0x58e8('0x3c')]=_0x1001d3[_0x58e8('0x37')];_0x56a443[_0x58e8('0x3d')]=_['orderBy'](_0x56a443[_0x58e8('0x3d')],[_0x58e8('0x3e')],[_0x58e8('0x3f')]);if(_0x56a443[_0x58e8('0x36')]['Applications']){delete _0x56a443[_0x58e8('0x36')][_0x58e8('0x3a')];}if(_0x56a443[_0x58e8('0x36')][_0x58e8('0x37')]&&_0x56a443[_0x58e8('0x36')]['List'][_0x58e8('0x38')][_0x58e8('0x40')]){return _0x56a443[_0x58e8('0x36')][_0x58e8('0x37')]['Contacts'][0x0];}var _0x259496=_[_0x58e8('0xa')](_0xed17a0[_0x58e8('0x23')],{'firstName':_0xed17a0[_0x58e8('0x23')]['from'],'ListId':_0x1001d3['ListId']});_0x259496[_0xed17a0[_0x58e8('0x23')]['mapKey']]=_0xed17a0['body'][_0x58e8('0x2f')];return db[_0x58e8('0x25')]['create'](_0x259496,{'fields':_0x53753a,'raw':!![]});}})[_0x58e8('0x10')](function(_0x202d6e){_0x56a443[_0x58e8('0x41')]=_0x202d6e;if(_0x202d6e){var _0x51c20b={'ContactId':_0x202d6e['id'],'FaxAccountId':_0xed17a0[_0x58e8('0x36')]['id'],'fax':_0x202d6e[_0x58e8('0x24')]};return db[_0x58e8('0x42')][_0x58e8('0x35')]({'where':{'ContactId':_0x202d6e['id'],'closed':![],'FaxAccountId':_0xed17a0['account']['id']}})[_0x58e8('0x10')](function(_0x1866a3){if(_0x1866a3){return[_0x1866a3,![]];}return db['FaxInteraction'][_0x58e8('0x43')](_0x51c20b)[_0x58e8('0x10')](function(_0x20d06e){return[_0x20d06e,!![]];});});}else{throw new Error(_0x58e8('0x44'));}})[_0x58e8('0x45')](function(_0x2eef80,_0x3acd5d){var _0x2075e0=_0x2eef80['get']({'plain':!![]});if(_0x3acd5d){if(_0x56a443[_0x58e8('0x36')][_0x58e8('0x46')]){_0x56a443['applications'][_0x58e8('0x47')]({'id':0x0,'priority':_0x56a443['applications'][_0x58e8('0x40')]+0x1,'app':_0x58e8('0x48'),'appdata':'unmanaged','interval':_0x58e8('0x49')});}_0x2075e0['created']=!![];}else{_0x2075e0[_0x58e8('0x4a')]=![];}_0x56a443[_0x58e8('0x4b')]=_0x2075e0;return db[_0x58e8('0x4c')][_0x58e8('0x43')]({'body':_0xed17a0[_0x58e8('0x23')][_0x58e8('0x23')],'FaxAccountId':_0xed17a0[_0x58e8('0x36')]['id'],'FaxInteractionId':_0x2eef80['id'],'direction':'in','ContactId':_0x2eef80[_0x58e8('0x4d')],'AttachmentId':_0xed17a0['body'][_0x58e8('0x4e')]});})[_0x58e8('0x10')](function(_0x199377){_0x56a443[_0x58e8('0x16')]=_0x199377;if(_0x56a443[_0x58e8('0x4b')][_0x58e8('0x4f')]){return db['User']['find']({'attributes':['id',_0x58e8('0x50')],'where':{'id':_0x56a443[_0x58e8('0x4b')][_0x58e8('0x4f')]}})[_0x58e8('0x10')](function(_0x4ae6a9){if(_0x4ae6a9){_0x56a443[_0x58e8('0x3d')][_0x58e8('0x51')]({'id':0x0,'priority':0x0,'app':_0x58e8('0x52'),'appdata':_0x4ae6a9[_0x58e8('0x50')]+','+(_0x56a443['account'][_0x58e8('0x53')]||0xa),'interval':_0x58e8('0x49')});}return respondWithRpcPromise(_0x58e8('0x54'),_0x58e8('0x55'),_0x56a443);});}return respondWithRpcPromise(_0x58e8('0x54'),'startRouting',_0x56a443);})['then'](function(_0x73e64b){_0x6cd58f(_0x73e64b);})['catch'](function(_0x4179c4){_0x246850(_0xbef455[_0x58e8('0x15')](0x1f4,_0x4179c4['message']));});});}; \ No newline at end of file +var _0xe10c=['stringify','error','code','message','info','result','FaxAccount','options','raw','where','limit','include','map','model','attributes','debug','GetFaxAccount','body','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','list','applications','orderBy','priority','create','FaxInteraction','length','unmanaged','*,*,*,*','created','ContactId','AttachmentId','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','./faxAccount.socket','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x24c506,_0x19448b){var _0x4fc12a=function(_0x22b3f8){while(--_0x22b3f8){_0x24c506['push'](_0x24c506['shift']());}};_0x4fc12a(++_0x19448b);}(_0xe10c,0x1f0));var _0xce10=function(_0x25a202,_0x4fa782){_0x25a202=_0x25a202-0x0;var _0x197bfd=_0xe10c[_0x25a202];return _0x197bfd;};'use strict';var _=require(_0xce10('0x0'));var util=require(_0xce10('0x1'));var moment=require('moment');var BPromise=require(_0xce10('0x2'));var rs=require(_0xce10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce10('0x4'))['db'];var utils=require(_0xce10('0x5'));var logger=require(_0xce10('0x6'))(_0xce10('0x7'));var config=require(_0xce10('0x8'));var jayson=require(_0xce10('0x9'));var client=jayson[_0xce10('0xa')][_0xce10('0xb')]({'port':0x232c});config['redis']=_[_0xce10('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xce10('0xd'))(new Redis(config['redis']));require(_0xce10('0xe'))[_0xce10('0xf')](socket);function respondWithRpcPromise(_0x32b511,_0x5d144d,_0x25ea54){return new BPromise(function(_0x19a9e4,_0x124396){return client[_0xce10('0x10')](_0x32b511,_0x25ea54)[_0xce10('0x11')](function(_0x1c83fa){logger['info'](_0xce10('0x12'),_0x5d144d,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5d144d,_0xce10('0x13'),JSON[_0xce10('0x14')](_0x1c83fa));if(_0x1c83fa[_0xce10('0x15')]){if(_0x1c83fa[_0xce10('0x15')][_0xce10('0x16')]===0x1f4){logger[_0xce10('0x15')](_0xce10('0x12'),_0x5d144d,_0x1c83fa['error']['message']);return _0x124396(_0x1c83fa[_0xce10('0x15')]['message']);}logger[_0xce10('0x15')]('FaxAccount,\x20%s,\x20%s',_0x5d144d,_0x1c83fa[_0xce10('0x15')][_0xce10('0x17')]);return _0x19a9e4(_0x1c83fa[_0xce10('0x15')][_0xce10('0x17')]);}else{logger[_0xce10('0x18')](_0xce10('0x12'),_0x5d144d,_0xce10('0x13'));_0x19a9e4(_0x1c83fa[_0xce10('0x19')]['message']);}})['catch'](function(_0x35e325){logger['error'](_0xce10('0x12'),_0x5d144d,_0x35e325);_0x124396(_0x35e325);});});}exports['GetFaxAccount']=function(_0x19318b){var _0x241df3=this;return new Promise(function(_0x4d4f8b,_0x2beb4a){return db[_0xce10('0x1a')]['findAll']({'raw':_0x19318b[_0xce10('0x1b')]?_0x19318b[_0xce10('0x1b')][_0xce10('0x1c')]===undefined?!![]:![]:!![],'where':_0x19318b['options']?_0x19318b[_0xce10('0x1b')][_0xce10('0x1d')]||null:null,'attributes':_0x19318b['options']?_0x19318b[_0xce10('0x1b')]['attributes']||null:null,'limit':_0x19318b[_0xce10('0x1b')]?_0x19318b[_0xce10('0x1b')][_0xce10('0x1e')]||null:null,'include':_0x19318b[_0xce10('0x1b')]?_0x19318b[_0xce10('0x1b')][_0xce10('0x1f')]?_[_0xce10('0x20')](_0x19318b['options'][_0xce10('0x1f')],function(_0x27d519){return{'model':db[_0x27d519[_0xce10('0x21')]],'as':_0x27d519['as'],'attributes':_0x27d519[_0xce10('0x22')],'include':_0x27d519[_0xce10('0x1f')]?_['map'](_0x27d519[_0xce10('0x1f')],function(_0x6736d8){return{'model':db[_0x6736d8[_0xce10('0x21')]],'as':_0x6736d8['as'],'attributes':_0x6736d8[_0xce10('0x22')],'include':_0x6736d8['include']?_['map'](_0x6736d8[_0xce10('0x1f')],function(_0xcae893){return{'model':db[_0xcae893['model']],'as':_0xcae893['as'],'attributes':_0xcae893[_0xce10('0x22')]};}):[]};}):[]};}):[]:[]})[_0xce10('0x11')](function(_0x3e6117){logger['info']('GetFaxAccount',_0x19318b);logger[_0xce10('0x23')](_0xce10('0x24'),_0x19318b,JSON[_0xce10('0x14')](_0x3e6117));_0x4d4f8b(_0x3e6117);})['catch'](function(_0x202fff){logger[_0xce10('0x15')](_0xce10('0x24'),_0x202fff['message'],_0x19318b);_0x2beb4a(_0x241df3['error'](0x1f4,_0x202fff[_0xce10('0x17')]));});});};exports['NotifyFaxAccount']=function(_0x250c4f,_0x26a8c2,_0x54bd93){var _0x3db822=this;return new Promise(function(_0x318d23,_0x4b3db3){var _0x54df19={'body':_0x250c4f[_0xce10('0x25')],'channel':_0xce10('0x26')};var _0x1595b1=[];var _0x2b7dfd=[];var _0x557e5a={};return db[_0xce10('0x27')][_0xce10('0x28')]()[_0xce10('0x11')](function(_0x31d300){if(!_0x31d300){throw new db[(_0xce10('0x29'))]['ValidationError'](_0xce10('0x2a'));}_0x1595b1=_[_0xce10('0x2b')](_[_0xce10('0x2c')](_0x31d300),[_0xce10('0x2d'),_0xce10('0x2e')]);_0x2b7dfd=_['difference'](_[_0xce10('0x2c')](_0x31d300),[_0xce10('0x2d'),'updatedAt','CompanyId',_0xce10('0x2f')]);if(_0x250c4f[_0xce10('0x25')]['id']){delete _0x250c4f['body']['id'];}if(_[_0xce10('0x30')](_0x250c4f['body'][_0xce10('0x31')])){throw new db[(_0xce10('0x29'))][(_0xce10('0x32'))](_0xce10('0x33'));}if(_['isNil'](_0x250c4f[_0xce10('0x25')][_0xce10('0x25')])||_0x250c4f[_0xce10('0x25')][_0xce10('0x25')]===''){throw new db[(_0xce10('0x29'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xce10('0x30')](_0x250c4f[_0xce10('0x25')][_0xce10('0x34')])){throw new db[(_0xce10('0x29'))][(_0xce10('0x32'))](_0xce10('0x35')+_0x2b7dfd);}if(!_[_0xce10('0x36')](_0x2b7dfd,_0x250c4f[_0xce10('0x25')]['mapKey'])){throw new db[(_0xce10('0x29'))][(_0xce10('0x32'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2b7dfd);}_0x557e5a[_0x250c4f[_0xce10('0x25')]['mapKey']]=_0x250c4f[_0xce10('0x25')][_0xce10('0x31')];})[_0xce10('0x11')](function(){return db[_0xce10('0x1a')][_0xce10('0x37')]({'where':{'id':_0x250c4f[_0xce10('0x38')]['id']},'include':[{'model':db[_0xce10('0x39')],'as':_0xce10('0x3a'),'include':[{'model':db[_0xce10('0x27')],'as':_0xce10('0x3b'),'where':_0x557e5a,'limit':0x1,'order':[[_0xce10('0x2e'),_0xce10('0x3c')]]}]},{'model':db[_0xce10('0x3d')],'as':_0xce10('0x3e')}]});})['then'](function(_0x20a753){if(_0x20a753&&_0x20a753[_0xce10('0x3a')]){var _0x56378d=_0x20a753[_0xce10('0x3f')]({'plain':!![]});_0x54df19['account']=_0x56378d;_0x54df19['applications']=_0x56378d[_0xce10('0x3e')];_0x54df19[_0xce10('0x40')]=_0x56378d[_0xce10('0x3a')];_0x54df19[_0xce10('0x41')]=_[_0xce10('0x42')](_0x54df19[_0xce10('0x41')],[_0xce10('0x43')],['asc']);if(_0x54df19['account'][_0xce10('0x3e')]){delete _0x54df19[_0xce10('0x38')][_0xce10('0x3e')];}if(_0x54df19[_0xce10('0x38')]['List']&&_0x54df19[_0xce10('0x38')][_0xce10('0x3a')]['Contacts']['length']){return _0x54df19[_0xce10('0x38')][_0xce10('0x3a')][_0xce10('0x3b')][0x0];}var _0x5ba50d=_[_0xce10('0xc')](_0x250c4f[_0xce10('0x25')],{'firstName':_0x250c4f[_0xce10('0x25')][_0xce10('0x31')],'ListId':_0x56378d[_0xce10('0x2f')]});_0x5ba50d[_0x250c4f[_0xce10('0x25')]['mapKey']]=_0x250c4f[_0xce10('0x25')][_0xce10('0x31')];return db[_0xce10('0x27')][_0xce10('0x44')](_0x5ba50d,{'fields':_0x1595b1,'raw':!![]});}})[_0xce10('0x11')](function(_0x3676d0){_0x54df19['contact']=_0x3676d0;if(_0x3676d0){var _0x39df19={'ContactId':_0x3676d0['id'],'FaxAccountId':_0x250c4f[_0xce10('0x38')]['id'],'fax':_0x3676d0[_0xce10('0x26')]};return db['FaxInteraction'][_0xce10('0x37')]({'where':{'ContactId':_0x3676d0['id'],'closed':![],'FaxAccountId':_0x250c4f['account']['id']}})['then'](function(_0x3515ec){if(_0x3515ec){return[_0x3515ec,![]];}return db[_0xce10('0x45')][_0xce10('0x44')](_0x39df19)[_0xce10('0x11')](function(_0x261e12){return[_0x261e12,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x174a78,_0x27bc92){var _0xdc712a=_0x174a78[_0xce10('0x3f')]({'plain':!![]});if(_0x27bc92){if(_0x54df19[_0xce10('0x38')]['autoclose']){_0x54df19['applications']['push']({'id':0x0,'priority':_0x54df19['applications'][_0xce10('0x46')]+0x1,'app':'close','appdata':_0xce10('0x47'),'interval':_0xce10('0x48')});}_0xdc712a[_0xce10('0x49')]=!![];}else{_0xdc712a['created']=![];}_0x54df19['interaction']=_0xdc712a;return db['FaxMessage']['create']({'body':_0x250c4f[_0xce10('0x25')][_0xce10('0x25')],'FaxAccountId':_0x250c4f['account']['id'],'FaxInteractionId':_0x174a78['id'],'direction':'in','ContactId':_0x174a78[_0xce10('0x4a')],'AttachmentId':_0x250c4f[_0xce10('0x25')][_0xce10('0x4b')]});})[_0xce10('0x11')](function(_0x8987e8){_0x54df19[_0xce10('0x17')]=_0x8987e8;if(_0x54df19[_0xce10('0x4c')][_0xce10('0x4d')]){return db[_0xce10('0x4e')][_0xce10('0x37')]({'attributes':['id',_0xce10('0x4f')],'where':{'id':_0x54df19[_0xce10('0x4c')][_0xce10('0x4d')]}})[_0xce10('0x11')](function(_0x42e83a){if(_0x42e83a){_0x54df19[_0xce10('0x41')][_0xce10('0x50')]({'id':0x0,'priority':0x0,'app':_0xce10('0x51'),'appdata':_0x42e83a[_0xce10('0x4f')]+','+(_0x54df19[_0xce10('0x38')][_0xce10('0x52')]||0xa),'interval':_0xce10('0x48')});}return respondWithRpcPromise(_0xce10('0x53'),_0xce10('0x54'),_0x54df19);});}return respondWithRpcPromise('Start','startRouting',_0x54df19);})['then'](function(_0x58b3f7){_0x318d23(_0x58b3f7);})[_0xce10('0x55')](function(_0xc32802){_0x4b3db3(_0x3db822[_0xce10('0x15')](0x1f4,_0xc32802[_0xce10('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 4892bb4..c354b94 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 _0x524e=['remove','update','emit','removeListener','register','length','faxAccount:'];(function(_0x147b59,_0x2dda06){var _0x2a64d4=function(_0x576659){while(--_0x576659){_0x147b59['push'](_0x147b59['shift']());}};_0x2a64d4(++_0x2dda06);}(_0x524e,0x15e));var _0xe524=function(_0x1f462c,_0x3d7c12){_0x1f462c=_0x1f462c-0x0;var _0x4d5c4f=_0x524e[_0x1f462c];return _0x4d5c4f;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save',_0xe524('0x0'),_0xe524('0x1')];function createListener(_0xc5f6b5,_0x29e619){return function(_0x699159){_0x29e619[_0xe524('0x2')](_0xc5f6b5,_0x699159);};}function removeListener(_0xabd694,_0x32c90b){return function(){FaxAccountEvents[_0xe524('0x3')](_0xabd694,_0x32c90b);};}exports[_0xe524('0x4')]=function(_0x4f75d6){for(var _0xaaeaa9=0x0,_0x41e1a3=events[_0xe524('0x5')];_0xaaeaa9<_0x41e1a3;_0xaaeaa9++){var _0x533c14=events[_0xaaeaa9];var _0x384935=createListener(_0xe524('0x6')+_0x533c14,_0x4f75d6);FaxAccountEvents['on'](_0x533c14,_0x384935);}}; \ No newline at end of file +var _0x9f0e=['save','remove','update','emit','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x289113,_0x34b31f){var _0x190bc2=function(_0x232a0e){while(--_0x232a0e){_0x289113['push'](_0x289113['shift']());}};_0x190bc2(++_0x34b31f);}(_0x9f0e,0x116));var _0xe9f0=function(_0x2fe571,_0x1a565e){_0x2fe571=_0x2fe571-0x0;var _0x134f66=_0x9f0e[_0x2fe571];return _0x134f66;};'use strict';var FaxAccountEvents=require(_0xe9f0('0x0'));var events=[_0xe9f0('0x1'),_0xe9f0('0x2'),_0xe9f0('0x3')];function createListener(_0x146ad8,_0x4a1a30){return function(_0x5856dc){_0x4a1a30[_0xe9f0('0x4')](_0x146ad8,_0x5856dc);};}function removeListener(_0x150a03,_0x3c589d){return function(){FaxAccountEvents[_0xe9f0('0x5')](_0x150a03,_0x3c589d);};}exports[_0xe9f0('0x6')]=function(_0x50313d){for(var _0x5b87c1=0x0,_0x3a17b3=events[_0xe9f0('0x7')];_0x5b87c1<_0x3a17b3;_0x5b87c1++){var _0xe64a79=events[_0x5b87c1];var _0x4be6a6=createListener(_0xe9f0('0x8')+_0xe64a79,_0x50313d);FaxAccountEvents['on'](_0xe64a79,_0x4be6a6);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 30597d6..55873a0 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 _0x2a4e=['delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','getAgents','post','addDisposition','addInteraction','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','send','/:id/users','addAgents','put','/:id','update'];(function(_0x2f83bb,_0x417034){var _0x3d0786=function(_0x3ca11a){while(--_0x3ca11a){_0x2f83bb['push'](_0x2f83bb['shift']());}};_0x3d0786(++_0x417034);}(_0x2a4e,0xb2));var _0xe2a4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2a4e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xe2a4('0x0'));var util=require(_0xe2a4('0x1'));var path=require(_0xe2a4('0x2'));var timeout=require(_0xe2a4('0x3'));var express=require(_0xe2a4('0x4'));var router=express[_0xe2a4('0x5')]();var auth=require(_0xe2a4('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe2a4('0x7'));router[_0xe2a4('0x8')]('/',auth[_0xe2a4('0x9')](),controller[_0xe2a4('0xa')]);router[_0xe2a4('0x8')](_0xe2a4('0xb'),auth[_0xe2a4('0x9')](),controller[_0xe2a4('0xc')]);router[_0xe2a4('0x8')]('/:id',auth[_0xe2a4('0x9')](),controller[_0xe2a4('0xd')]);router['get'](_0xe2a4('0xe'),auth[_0xe2a4('0x9')](),controller[_0xe2a4('0xf')]);router[_0xe2a4('0x8')](_0xe2a4('0x10'),auth[_0xe2a4('0x9')](),controller[_0xe2a4('0x11')]);router[_0xe2a4('0x8')](_0xe2a4('0x12'),auth[_0xe2a4('0x9')](),controller[_0xe2a4('0x13')]);router['get'](_0xe2a4('0x14'),auth['isAuthenticated'](),controller['getApplications']);router[_0xe2a4('0x8')](_0xe2a4('0x15'),auth[_0xe2a4('0x9')](),controller[_0xe2a4('0x16')]);router[_0xe2a4('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0xe2a4('0x17')]);router[_0xe2a4('0x18')]('/',auth[_0xe2a4('0x9')](),controller['create']);router[_0xe2a4('0x18')]('/:id/dispositions',auth[_0xe2a4('0x9')](),controller[_0xe2a4('0x19')]);router[_0xe2a4('0x18')](_0xe2a4('0x10'),auth['isAuthenticated'](),controller['addAnswer']);router[_0xe2a4('0x18')](_0xe2a4('0x12'),auth[_0xe2a4('0x9')](),controller[_0xe2a4('0x1a')]);router[_0xe2a4('0x18')](_0xe2a4('0x14'),auth['isAuthenticated'](),controller[_0xe2a4('0x1b')]);router[_0xe2a4('0x18')](_0xe2a4('0x1c'),auth[_0xe2a4('0x9')](),controller[_0xe2a4('0x1d')]);router[_0xe2a4('0x18')]('/updateaccountapplications',auth[_0xe2a4('0x9')](),controller[_0xe2a4('0x1e')]);router[_0xe2a4('0x18')]('/:id/send',auth[_0xe2a4('0x9')](),controller[_0xe2a4('0x1f')]);router['post'](_0xe2a4('0x20'),auth[_0xe2a4('0x9')](),controller[_0xe2a4('0x21')]);router[_0xe2a4('0x22')](_0xe2a4('0x23'),auth[_0xe2a4('0x9')](),controller[_0xe2a4('0x24')]);router[_0xe2a4('0x25')]('/:id',auth[_0xe2a4('0x9')](),controller[_0xe2a4('0x26')]);router[_0xe2a4('0x25')](_0xe2a4('0xe'),auth[_0xe2a4('0x9')](),controller[_0xe2a4('0x27')]);router[_0xe2a4('0x25')](_0xe2a4('0x10'),auth['isAuthenticated'](),controller[_0xe2a4('0x28')]);router[_0xe2a4('0x25')](_0xe2a4('0x20'),auth[_0xe2a4('0x9')](),controller[_0xe2a4('0x29')]);module[_0xe2a4('0x2a')]=router; \ No newline at end of file +var _0xede6=['send','addAgents','put','update','delete','removeDispositions','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','isAuthenticated','index','get','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','post','create','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','updateAccountApplications','/:id/send'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xede6,0x11e));var _0x6ede=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xede6[_0x3c4737];return _0x2bb926;};'use strict';var multer=require(_0x6ede('0x0'));var util=require(_0x6ede('0x1'));var path=require(_0x6ede('0x2'));var timeout=require('connect-timeout');var express=require(_0x6ede('0x3'));var router=express[_0x6ede('0x4')]();var auth=require(_0x6ede('0x5'));var interaction=require(_0x6ede('0x6'));var config=require('../../config/environment');var controller=require(_0x6ede('0x7'));router['get']('/',auth[_0x6ede('0x8')](),controller[_0x6ede('0x9')]);router[_0x6ede('0xa')]('/describe',auth[_0x6ede('0x8')](),controller[_0x6ede('0xb')]);router[_0x6ede('0xa')](_0x6ede('0xc'),auth['isAuthenticated'](),controller[_0x6ede('0xd')]);router['get'](_0x6ede('0xe'),auth[_0x6ede('0x8')](),controller[_0x6ede('0xf')]);router[_0x6ede('0xa')](_0x6ede('0x10'),auth['isAuthenticated'](),controller[_0x6ede('0x11')]);router[_0x6ede('0xa')](_0x6ede('0x12'),auth[_0x6ede('0x8')](),controller[_0x6ede('0x13')]);router[_0x6ede('0xa')](_0x6ede('0x14'),auth[_0x6ede('0x8')](),controller[_0x6ede('0x15')]);router[_0x6ede('0xa')](_0x6ede('0x16'),auth[_0x6ede('0x8')](),controller[_0x6ede('0x17')]);router[_0x6ede('0xa')](_0x6ede('0x18'),auth[_0x6ede('0x8')](),controller['getAgents']);router[_0x6ede('0x19')]('/',auth[_0x6ede('0x8')](),controller[_0x6ede('0x1a')]);router[_0x6ede('0x19')](_0x6ede('0xe'),auth['isAuthenticated'](),controller[_0x6ede('0x1b')]);router[_0x6ede('0x19')]('/:id/canned_answers',auth[_0x6ede('0x8')](),controller[_0x6ede('0x1c')]);router[_0x6ede('0x19')]('/:id/interactions',auth[_0x6ede('0x8')](),controller[_0x6ede('0x1d')]);router[_0x6ede('0x19')](_0x6ede('0x14'),auth[_0x6ede('0x8')](),controller[_0x6ede('0x1e')]);router[_0x6ede('0x19')](_0x6ede('0x1f'),auth['isAuthenticated'](),controller['addAccountApplications']);router[_0x6ede('0x19')]('/updateaccountapplications',auth['isAuthenticated'](),controller[_0x6ede('0x20')]);router['post'](_0x6ede('0x21'),auth[_0x6ede('0x8')](),controller[_0x6ede('0x22')]);router[_0x6ede('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x6ede('0x23')]);router[_0x6ede('0x24')](_0x6ede('0xc'),auth[_0x6ede('0x8')](),controller[_0x6ede('0x25')]);router[_0x6ede('0x26')](_0x6ede('0xc'),auth[_0x6ede('0x8')](),controller['destroy']);router[_0x6ede('0x26')](_0x6ede('0xe'),auth[_0x6ede('0x8')](),controller[_0x6ede('0x27')]);router[_0x6ede('0x26')](_0x6ede('0x10'),auth[_0x6ede('0x8')](),controller['removeAnswers']);router['delete'](_0x6ede('0x18'),auth[_0x6ede('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 463b44f..466a145 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 _0x6337=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x6337,0x18a));var _0x7633=function(_0x5b0ea3,_0x9ff218){_0x5b0ea3=_0x5b0ea3-0x0;var _0x1ae2ac=_0x6337[_0x5b0ea3];return _0x1ae2ac;};'use strict';var Sequelize=require('sequelize');module[_0x7633('0x0')]={'priority':{'type':Sequelize[_0x7633('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7633('0x2')],'allowNull':![],'defaultValue':_0x7633('0x3')},'appdata':{'type':Sequelize[_0x7633('0x4')]()},'description':{'type':Sequelize[_0x7633('0x2')]},'interval':{'type':Sequelize[_0x7633('0x2')],'defaultValue':_0x7633('0x5')}}; \ No newline at end of file +var _0x8c8c=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x587445,_0x37dfb6){var _0x27fb18=function(_0x1bceac){while(--_0x1bceac){_0x587445['push'](_0x587445['shift']());}};_0x27fb18(++_0x37dfb6);}(_0x8c8c,0x185));var _0xc8c8=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x8c8c[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xc8c8('0x0'));module[_0xc8c8('0x1')]={'priority':{'type':Sequelize[_0xc8c8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc8c8('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xc8c8('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xc8c8('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 21fe5f6..3b94c74 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 _0xad42=['lodash','squel','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','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','FaxApplication','includeAll','include','findAll','rows','catch','params','keys','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs'];(function(_0x2611f5,_0x5501fd){var _0x423e69=function(_0x565cf3){while(--_0x565cf3){_0x2611f5['push'](_0x2611f5['shift']());}};_0x423e69(++_0x5501fd);}(_0xad42,0x171));var _0x2ad4=function(_0x1a8abc,_0x4d6e9e){_0x1a8abc=_0x1a8abc-0x0;var _0x11c319=_0xad42[_0x1a8abc];return _0x11c319;};'use strict';var pdf=require(_0x2ad4('0x0'));var emlformat=require(_0x2ad4('0x1'));var rimraf=require(_0x2ad4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ad4('0x3'));var rp=require(_0x2ad4('0x4'));var moment=require(_0x2ad4('0x5'));var BPromise=require(_0x2ad4('0x6'));var Mustache=require('mustache');var util=require(_0x2ad4('0x7'));var path=require(_0x2ad4('0x8'));var sox=require('sox');var csv=require(_0x2ad4('0x9'));var ejs=require(_0x2ad4('0xa'));var fs=require('fs');var _=require(_0x2ad4('0xb'));var squel=require(_0x2ad4('0xc'));var crypto=require('crypto');var jsforce=require(_0x2ad4('0xd'));var deskjs=require(_0x2ad4('0xe'));var toCsv=require(_0x2ad4('0x9'));var querystring=require('querystring');var Papa=require(_0x2ad4('0xf'));var Redis=require(_0x2ad4('0x10'));var authService=require(_0x2ad4('0x11'));var qs=require(_0x2ad4('0x12'));var as=require(_0x2ad4('0x13'));var hardwareService=require(_0x2ad4('0x14'));var logger=require(_0x2ad4('0x15'))(_0x2ad4('0x16'));var utils=require(_0x2ad4('0x17'));var config=require(_0x2ad4('0x18'));var licenseUtil=require(_0x2ad4('0x19'));var db=require(_0x2ad4('0x1a'))['db'];function respondWithStatusCode(_0x244679,_0x3444e2){_0x3444e2=_0x3444e2||0xcc;return function(_0x3eeaa8){if(_0x3eeaa8){return _0x244679[_0x2ad4('0x1b')](_0x3444e2);}return _0x244679[_0x2ad4('0x1c')](_0x3444e2)[_0x2ad4('0x1d')]();};}function respondWithResult(_0x3b1d1f,_0x2556b9){_0x2556b9=_0x2556b9||0xc8;return function(_0x4b8fd8){if(_0x4b8fd8){return _0x3b1d1f['status'](_0x2556b9)[_0x2ad4('0x1e')](_0x4b8fd8);}};}function respondWithFilteredResult(_0x42a982,_0x49aac8){return function(_0x710102){if(_0x710102){var _0x4f3ee7=_0x710102[_0x2ad4('0x1f')],_0x1080b0=_0x49aac8[_0x2ad4('0x20')],_0x560fe3=_0x49aac8['offset']+_0x49aac8[_0x2ad4('0x21')],_0x61f701;if(_0x560fe3>=_0x4f3ee7){_0x560fe3=_0x4f3ee7;_0x61f701=0xc8;}else{_0x61f701=0xce;}_0x42a982[_0x2ad4('0x1c')](_0x61f701);return _0x42a982[_0x2ad4('0x22')](_0x2ad4('0x23'),_0x1080b0+'-'+_0x560fe3+'/'+_0x4f3ee7)[_0x2ad4('0x1e')](_0x710102);}return null;};}function patchUpdates(_0x1b218f){return function(_0x547fd8){try{jsonpatch['apply'](_0x547fd8,_0x1b218f,!![]);}catch(_0x4140b5){return BPromise[_0x2ad4('0x24')](_0x4140b5);}return _0x547fd8[_0x2ad4('0x25')]();};}function saveUpdates(_0x5d0bb2,_0x6f553b){return function(_0x39816c){if(_0x39816c){return _0x39816c[_0x2ad4('0x26')](_0x5d0bb2)[_0x2ad4('0x27')](function(_0x3b2ae5){return _0x3b2ae5;});}return null;};}function removeEntity(_0x28d588,_0x3c97cb){return function(_0x42cf55){if(_0x42cf55){return _0x42cf55[_0x2ad4('0x28')]()['then'](function(){_0x28d588[_0x2ad4('0x1c')](0xcc)[_0x2ad4('0x1d')]();});}};}function handleEntityNotFound(_0x4054ad,_0x71cea4){return function(_0x5c9247){if(!_0x5c9247){_0x4054ad[_0x2ad4('0x1b')](0x194);}return _0x5c9247;};}function handleError(_0x41e6a2,_0x4cbdc9){_0x4cbdc9=_0x4cbdc9||0x1f4;return function(_0x2c3f98){logger[_0x2ad4('0x29')](_0x2c3f98[_0x2ad4('0x2a')]);if(_0x2c3f98[_0x2ad4('0x2b')]){delete _0x2c3f98[_0x2ad4('0x2b')];}_0x41e6a2[_0x2ad4('0x1c')](_0x4cbdc9)[_0x2ad4('0x2c')](_0x2c3f98);};}exports['index']=function(_0xe013eb,_0x2ff9d3){var _0x2555b4={},_0x32bd0f={},_0x287a6c={'count':0x0,'rows':[]};var _0x5547c2=_[_0x2ad4('0x2d')](db['FaxApplication']['rawAttributes'],function(_0xbc2a2d){return{'name':_0xbc2a2d['fieldName'],'type':_0xbc2a2d[_0x2ad4('0x2e')][_0x2ad4('0x2f')]};});_0x32bd0f[_0x2ad4('0x30')]=_[_0x2ad4('0x2d')](_0x5547c2,_0x2ad4('0x2b'));_0x32bd0f[_0x2ad4('0x31')]=_['keys'](_0xe013eb[_0x2ad4('0x31')]);_0x32bd0f['filters']=_[_0x2ad4('0x32')](_0x32bd0f[_0x2ad4('0x30')],_0x32bd0f['query']);_0x2555b4[_0x2ad4('0x33')]=_['intersection'](_0x32bd0f[_0x2ad4('0x30')],qs['fields'](_0xe013eb[_0x2ad4('0x31')][_0x2ad4('0x34')]));_0x2555b4[_0x2ad4('0x33')]=_0x2555b4[_0x2ad4('0x33')][_0x2ad4('0x35')]?_0x2555b4[_0x2ad4('0x33')]:_0x32bd0f['model'];if(!_0xe013eb[_0x2ad4('0x31')][_0x2ad4('0x36')](_0x2ad4('0x37'))){_0x2555b4[_0x2ad4('0x21')]=qs[_0x2ad4('0x21')](_0xe013eb[_0x2ad4('0x31')][_0x2ad4('0x21')]);_0x2555b4[_0x2ad4('0x20')]=qs[_0x2ad4('0x20')](_0xe013eb[_0x2ad4('0x31')][_0x2ad4('0x20')]);}_0x2555b4[_0x2ad4('0x38')]=qs[_0x2ad4('0x39')](_0xe013eb['query'][_0x2ad4('0x39')]);_0x2555b4[_0x2ad4('0x3a')]=qs[_0x2ad4('0x3b')](_[_0x2ad4('0x3c')](_0xe013eb[_0x2ad4('0x31')],_0x32bd0f['filters']),_0x5547c2);if(_0xe013eb[_0x2ad4('0x31')][_0x2ad4('0x3d')]){_0x2555b4[_0x2ad4('0x3a')]=_[_0x2ad4('0x3e')](_0x2555b4['where'],{'$or':_['map'](_0x5547c2,function(_0x5c438b){if(_0x5c438b[_0x2ad4('0x2e')]!==_0x2ad4('0x3f')){var _0x5b634a={};_0x5b634a[_0x5c438b[_0x2ad4('0x2b')]]={'$like':'%'+_0xe013eb[_0x2ad4('0x31')][_0x2ad4('0x3d')]+'%'};return _0x5b634a;}})});}_0x2555b4=_[_0x2ad4('0x3e')]({},_0x2555b4,_0xe013eb[_0x2ad4('0x40')]);var _0x26f33a={'where':_0x2555b4[_0x2ad4('0x3a')]};return db[_0x2ad4('0x41')]['count'](_0x26f33a)[_0x2ad4('0x27')](function(_0x3a460f){_0x287a6c['count']=_0x3a460f;if(_0xe013eb[_0x2ad4('0x31')][_0x2ad4('0x42')]){_0x2555b4[_0x2ad4('0x43')]=[{'all':!![]}];}return db['FaxApplication'][_0x2ad4('0x44')](_0x2555b4);})['then'](function(_0x47c9ae){_0x287a6c[_0x2ad4('0x45')]=_0x47c9ae;return _0x287a6c;})[_0x2ad4('0x27')](respondWithFilteredResult(_0x2ff9d3,_0x2555b4))[_0x2ad4('0x46')](handleError(_0x2ff9d3,null));};exports['show']=function(_0x20dd52,_0x517f48){var _0x4e3c41={'raw':!![],'where':{'id':_0x20dd52[_0x2ad4('0x47')]['id']}},_0x592257={};_0x592257[_0x2ad4('0x30')]=_[_0x2ad4('0x48')](db['FaxApplication']['rawAttributes']);_0x592257['query']=_[_0x2ad4('0x48')](_0x20dd52['query']);_0x592257['filters']=_['intersection'](_0x592257['model'],_0x592257['query']);_0x4e3c41[_0x2ad4('0x33')]=_[_0x2ad4('0x32')](_0x592257[_0x2ad4('0x30')],qs['fields'](_0x20dd52['query'][_0x2ad4('0x34')]));_0x4e3c41['attributes']=_0x4e3c41[_0x2ad4('0x33')][_0x2ad4('0x35')]?_0x4e3c41[_0x2ad4('0x33')]:_0x592257[_0x2ad4('0x30')];if(_0x20dd52[_0x2ad4('0x31')][_0x2ad4('0x42')]){_0x4e3c41[_0x2ad4('0x43')]=[{'all':!![]}];}_0x4e3c41=_[_0x2ad4('0x3e')]({},_0x4e3c41,_0x20dd52[_0x2ad4('0x40')]);return db['FaxApplication']['find'](_0x4e3c41)['then'](handleEntityNotFound(_0x517f48,null))[_0x2ad4('0x27')](respondWithResult(_0x517f48,null))[_0x2ad4('0x46')](handleError(_0x517f48,null));};exports['create']=function(_0x309d74,_0x1592c6){return db[_0x2ad4('0x41')][_0x2ad4('0x49')](_0x309d74[_0x2ad4('0x4a')],{})[_0x2ad4('0x27')](respondWithResult(_0x1592c6,0xc9))[_0x2ad4('0x46')](handleError(_0x1592c6,null));};exports['update']=function(_0x2f2fe4,_0x4b614b){if(_0x2f2fe4[_0x2ad4('0x4a')]['id']){delete _0x2f2fe4['body']['id'];}return db['FaxApplication'][_0x2ad4('0x4b')]({'where':{'id':_0x2f2fe4[_0x2ad4('0x47')]['id']}})[_0x2ad4('0x27')](handleEntityNotFound(_0x4b614b,null))[_0x2ad4('0x27')](saveUpdates(_0x2f2fe4[_0x2ad4('0x4a')],null))[_0x2ad4('0x27')](respondWithResult(_0x4b614b,null))[_0x2ad4('0x46')](handleError(_0x4b614b,null));};exports[_0x2ad4('0x28')]=function(_0x2566b3,_0x4152f2){return db[_0x2ad4('0x41')][_0x2ad4('0x4b')]({'where':{'id':_0x2566b3[_0x2ad4('0x47')]['id']}})[_0x2ad4('0x27')](handleEntityNotFound(_0x4152f2,null))[_0x2ad4('0x27')](removeEntity(_0x4152f2,null))['catch'](handleError(_0x4152f2,null));}; \ No newline at end of file +var _0xbb71=['params','FaxApplication','includeAll','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show'];(function(_0x2d1ebd,_0x23d96c){var _0x29dff2=function(_0x2fbf0d){while(--_0x2fbf0d){_0x2d1ebd['push'](_0x2d1ebd['shift']());}};_0x29dff2(++_0x23d96c);}(_0xbb71,0xed));var _0x1bb7=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xbb71[_0x17b6e3];return _0x3906f3;};'use strict';var pdf=require(_0x1bb7('0x0'));var emlformat=require(_0x1bb7('0x1'));var rimraf=require(_0x1bb7('0x2'));var zipdir=require(_0x1bb7('0x3'));var jsonpatch=require(_0x1bb7('0x4'));var rp=require(_0x1bb7('0x5'));var moment=require('moment');var BPromise=require(_0x1bb7('0x6'));var Mustache=require(_0x1bb7('0x7'));var util=require(_0x1bb7('0x8'));var path=require(_0x1bb7('0x9'));var sox=require('sox');var csv=require(_0x1bb7('0xa'));var ejs=require(_0x1bb7('0xb'));var fs=require('fs');var _=require(_0x1bb7('0xc'));var squel=require(_0x1bb7('0xd'));var crypto=require('crypto');var jsforce=require(_0x1bb7('0xe'));var deskjs=require(_0x1bb7('0xf'));var toCsv=require(_0x1bb7('0xa'));var querystring=require(_0x1bb7('0x10'));var Papa=require(_0x1bb7('0x11'));var Redis=require(_0x1bb7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1bb7('0x13'));var as=require(_0x1bb7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1bb7('0x15'))(_0x1bb7('0x16'));var utils=require(_0x1bb7('0x17'));var config=require(_0x1bb7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1bb7('0x19'))['db'];function respondWithStatusCode(_0x100070,_0x589157){_0x589157=_0x589157||0xcc;return function(_0x4a3cbc){if(_0x4a3cbc){return _0x100070['sendStatus'](_0x589157);}return _0x100070[_0x1bb7('0x1a')](_0x589157)['end']();};}function respondWithResult(_0x2925b2,_0x3c803a){_0x3c803a=_0x3c803a||0xc8;return function(_0x39fcf4){if(_0x39fcf4){return _0x2925b2[_0x1bb7('0x1a')](_0x3c803a)[_0x1bb7('0x1b')](_0x39fcf4);}};}function respondWithFilteredResult(_0x557fdc,_0xcf7d9a){return function(_0x24cf7c){if(_0x24cf7c){var _0x3d63a6=_0x24cf7c['count'],_0x2e1bef=_0xcf7d9a[_0x1bb7('0x1c')],_0x43a2d1=_0xcf7d9a[_0x1bb7('0x1c')]+_0xcf7d9a[_0x1bb7('0x1d')],_0x56356b;if(_0x43a2d1>=_0x3d63a6){_0x43a2d1=_0x3d63a6;_0x56356b=0xc8;}else{_0x56356b=0xce;}_0x557fdc[_0x1bb7('0x1a')](_0x56356b);return _0x557fdc[_0x1bb7('0x1e')](_0x1bb7('0x1f'),_0x2e1bef+'-'+_0x43a2d1+'/'+_0x3d63a6)[_0x1bb7('0x1b')](_0x24cf7c);}return null;};}function patchUpdates(_0x4ba2f1){return function(_0xf6a4f6){try{jsonpatch[_0x1bb7('0x20')](_0xf6a4f6,_0x4ba2f1,!![]);}catch(_0x401d09){return BPromise[_0x1bb7('0x21')](_0x401d09);}return _0xf6a4f6[_0x1bb7('0x22')]();};}function saveUpdates(_0x191fb2,_0x23c00a){return function(_0x170ca5){if(_0x170ca5){return _0x170ca5[_0x1bb7('0x23')](_0x191fb2)['then'](function(_0x21bd39){return _0x21bd39;});}return null;};}function removeEntity(_0x543b72,_0x3a362d){return function(_0x52e4b1){if(_0x52e4b1){return _0x52e4b1[_0x1bb7('0x24')]()[_0x1bb7('0x25')](function(){_0x543b72[_0x1bb7('0x1a')](0xcc)[_0x1bb7('0x26')]();});}};}function handleEntityNotFound(_0xca1c40,_0x5dd0d3){return function(_0x2df75b){if(!_0x2df75b){_0xca1c40[_0x1bb7('0x27')](0x194);}return _0x2df75b;};}function handleError(_0x3bc5d8,_0x588eea){_0x588eea=_0x588eea||0x1f4;return function(_0x47d890){logger[_0x1bb7('0x28')](_0x47d890[_0x1bb7('0x29')]);if(_0x47d890['name']){delete _0x47d890[_0x1bb7('0x2a')];}_0x3bc5d8[_0x1bb7('0x1a')](_0x588eea)['send'](_0x47d890);};}exports['index']=function(_0x28db03,_0x27df79){var _0x1f3d6e={},_0x1224b8={},_0xf53772={'count':0x0,'rows':[]};var _0x41f6ae=_['map'](db['FaxApplication'][_0x1bb7('0x2b')],function(_0x583eae){return{'name':_0x583eae['fieldName'],'type':_0x583eae[_0x1bb7('0x2c')][_0x1bb7('0x2d')]};});_0x1224b8[_0x1bb7('0x2e')]=_[_0x1bb7('0x2f')](_0x41f6ae,_0x1bb7('0x2a'));_0x1224b8[_0x1bb7('0x30')]=_[_0x1bb7('0x31')](_0x28db03[_0x1bb7('0x30')]);_0x1224b8[_0x1bb7('0x32')]=_[_0x1bb7('0x33')](_0x1224b8[_0x1bb7('0x2e')],_0x1224b8[_0x1bb7('0x30')]);_0x1f3d6e['attributes']=_[_0x1bb7('0x33')](_0x1224b8[_0x1bb7('0x2e')],qs[_0x1bb7('0x34')](_0x28db03['query']['fields']));_0x1f3d6e[_0x1bb7('0x35')]=_0x1f3d6e[_0x1bb7('0x35')][_0x1bb7('0x36')]?_0x1f3d6e[_0x1bb7('0x35')]:_0x1224b8['model'];if(!_0x28db03[_0x1bb7('0x30')][_0x1bb7('0x37')](_0x1bb7('0x38'))){_0x1f3d6e['limit']=qs[_0x1bb7('0x1d')](_0x28db03[_0x1bb7('0x30')][_0x1bb7('0x1d')]);_0x1f3d6e[_0x1bb7('0x1c')]=qs[_0x1bb7('0x1c')](_0x28db03[_0x1bb7('0x30')][_0x1bb7('0x1c')]);}_0x1f3d6e[_0x1bb7('0x39')]=qs[_0x1bb7('0x3a')](_0x28db03[_0x1bb7('0x30')][_0x1bb7('0x3a')]);_0x1f3d6e[_0x1bb7('0x3b')]=qs[_0x1bb7('0x32')](_[_0x1bb7('0x3c')](_0x28db03['query'],_0x1224b8[_0x1bb7('0x32')]),_0x41f6ae);if(_0x28db03[_0x1bb7('0x30')][_0x1bb7('0x3d')]){_0x1f3d6e['where']=_[_0x1bb7('0x3e')](_0x1f3d6e['where'],{'$or':_['map'](_0x41f6ae,function(_0x20ac18){if(_0x20ac18[_0x1bb7('0x2c')]!==_0x1bb7('0x3f')){var _0x256161={};_0x256161[_0x20ac18[_0x1bb7('0x2a')]]={'$like':'%'+_0x28db03[_0x1bb7('0x30')]['filter']+'%'};return _0x256161;}})});}_0x1f3d6e=_[_0x1bb7('0x3e')]({},_0x1f3d6e,_0x28db03[_0x1bb7('0x40')]);var _0x5b934c={'where':_0x1f3d6e[_0x1bb7('0x3b')]};return db['FaxApplication'][_0x1bb7('0x41')](_0x5b934c)[_0x1bb7('0x25')](function(_0x3e036f){_0xf53772[_0x1bb7('0x41')]=_0x3e036f;if(_0x28db03[_0x1bb7('0x30')]['includeAll']){_0x1f3d6e[_0x1bb7('0x42')]=[{'all':!![]}];}return db['FaxApplication'][_0x1bb7('0x43')](_0x1f3d6e);})['then'](function(_0x1249c0){_0xf53772[_0x1bb7('0x44')]=_0x1249c0;return _0xf53772;})[_0x1bb7('0x25')](respondWithFilteredResult(_0x27df79,_0x1f3d6e))[_0x1bb7('0x45')](handleError(_0x27df79,null));};exports[_0x1bb7('0x46')]=function(_0x51f984,_0x90d605){var _0x358427={'raw':!![],'where':{'id':_0x51f984[_0x1bb7('0x47')]['id']}},_0x4092b2={};_0x4092b2[_0x1bb7('0x2e')]=_['keys'](db[_0x1bb7('0x48')][_0x1bb7('0x2b')]);_0x4092b2[_0x1bb7('0x30')]=_[_0x1bb7('0x31')](_0x51f984['query']);_0x4092b2[_0x1bb7('0x32')]=_[_0x1bb7('0x33')](_0x4092b2[_0x1bb7('0x2e')],_0x4092b2[_0x1bb7('0x30')]);_0x358427[_0x1bb7('0x35')]=_['intersection'](_0x4092b2[_0x1bb7('0x2e')],qs[_0x1bb7('0x34')](_0x51f984[_0x1bb7('0x30')]['fields']));_0x358427[_0x1bb7('0x35')]=_0x358427[_0x1bb7('0x35')][_0x1bb7('0x36')]?_0x358427['attributes']:_0x4092b2[_0x1bb7('0x2e')];if(_0x51f984[_0x1bb7('0x30')][_0x1bb7('0x49')]){_0x358427[_0x1bb7('0x42')]=[{'all':!![]}];}_0x358427=_[_0x1bb7('0x3e')]({},_0x358427,_0x51f984[_0x1bb7('0x40')]);return db[_0x1bb7('0x48')][_0x1bb7('0x4a')](_0x358427)[_0x1bb7('0x25')](handleEntityNotFound(_0x90d605,null))[_0x1bb7('0x25')](respondWithResult(_0x90d605,null))[_0x1bb7('0x45')](handleError(_0x90d605,null));};exports[_0x1bb7('0x4b')]=function(_0x5f1d60,_0x37a88f){return db[_0x1bb7('0x48')]['create'](_0x5f1d60['body'],{})[_0x1bb7('0x25')](respondWithResult(_0x37a88f,0xc9))[_0x1bb7('0x45')](handleError(_0x37a88f,null));};exports[_0x1bb7('0x23')]=function(_0x3f776d,_0x3b39b9){if(_0x3f776d[_0x1bb7('0x4c')]['id']){delete _0x3f776d[_0x1bb7('0x4c')]['id'];}return db[_0x1bb7('0x48')]['find']({'where':{'id':_0x3f776d[_0x1bb7('0x47')]['id']}})[_0x1bb7('0x25')](handleEntityNotFound(_0x3b39b9,null))[_0x1bb7('0x25')](saveUpdates(_0x3f776d[_0x1bb7('0x4c')],null))[_0x1bb7('0x25')](respondWithResult(_0x3b39b9,null))[_0x1bb7('0x45')](handleError(_0x3b39b9,null));};exports[_0x1bb7('0x24')]=function(_0x459e4f,_0x367c86){return db[_0x1bb7('0x48')]['find']({'where':{'id':_0x459e4f[_0x1bb7('0x47')]['id']}})[_0x1bb7('0x25')](handleEntityNotFound(_0x367c86,null))[_0x1bb7('0x25')](removeEntity(_0x367c86,null))[_0x1bb7('0x45')](handleError(_0x367c86,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 72e5720..928b818 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 _0x139f=['bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x14ce35,_0x1a8550){var _0x5a79ea=function(_0x223731){while(--_0x223731){_0x14ce35['push'](_0x14ce35['shift']());}};_0x5a79ea(++_0x1a8550);}(_0x139f,0x118));var _0xf139=function(_0x16ecfb,_0x3d30dc){_0x16ecfb=_0x16ecfb-0x0;var _0x550910=_0x139f[_0x16ecfb];return _0x550910;};'use strict';var _=require(_0xf139('0x0'));var util=require(_0xf139('0x1'));var logger=require(_0xf139('0x2'))(_0xf139('0x3'));var moment=require(_0xf139('0x4'));var BPromise=require(_0xf139('0x5'));var rp=require(_0xf139('0x6'));var fs=require('fs');var path=require(_0xf139('0x7'));var rimraf=require(_0xf139('0x8'));var config=require(_0xf139('0x9'));var attributes=require(_0xf139('0xa'));module['exports']=function(_0x3ba85d,_0x19d7c1){return _0x3ba85d['define'](_0xf139('0xb'),attributes,{'tableName':_0xf139('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf139('0xd'),'collate':_0xf139('0xe')});}; \ No newline at end of file +var _0xe295=['api','moment','path','rimraf','../../config/environment','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x3cc05d,_0x4b8f88){var _0x28b736=function(_0x369b0e){while(--_0x369b0e){_0x3cc05d['push'](_0x3cc05d['shift']());}};_0x28b736(++_0x4b8f88);}(_0xe295,0x16a));var _0x5e29=function(_0x529a0f,_0x328763){_0x529a0f=_0x529a0f-0x0;var _0x187a88=_0xe295[_0x529a0f];return _0x187a88;};'use strict';var _=require('lodash');var util=require(_0x5e29('0x0'));var logger=require('../../config/logger')(_0x5e29('0x1'));var moment=require(_0x5e29('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e29('0x3'));var rimraf=require(_0x5e29('0x4'));var config=require(_0x5e29('0x5'));var attributes=require('./faxApplication.attributes');module[_0x5e29('0x6')]=function(_0xf6b575,_0x37e832){return _0xf6b575[_0x5e29('0x7')]('FaxApplication',attributes,{'tableName':_0x5e29('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5e29('0x9'),'collate':_0x5e29('0xa')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index d2a43a9..f9d8763 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 _0x1808=['options','raw','limit','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','error','message','result','UpdateFaxApplication','FaxApplication','body'];(function(_0x2e2863,_0xcc807e){var _0x3e577c=function(_0x8282d8){while(--_0x8282d8){_0x2e2863['push'](_0x2e2863['shift']());}};_0x3e577c(++_0xcc807e);}(_0x1808,0x96));var _0x8180=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x1808[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x8180('0x0'));var util=require(_0x8180('0x1'));var moment=require(_0x8180('0x2'));var BPromise=require('bluebird');var rs=require(_0x8180('0x3'));var fs=require('fs');var Redis=require(_0x8180('0x4'));var db=require(_0x8180('0x5'))['db'];var utils=require(_0x8180('0x6'));var logger=require(_0x8180('0x7'))(_0x8180('0x8'));var config=require(_0x8180('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8180('0xa')][_0x8180('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2eff5a,_0x1ffc14,_0x505635){return new BPromise(function(_0x4480fe,_0x520ab2){return client[_0x8180('0xc')](_0x2eff5a,_0x505635)[_0x8180('0xd')](function(_0x46a473){logger[_0x8180('0xe')](_0x8180('0xf'),_0x1ffc14,_0x8180('0x10'));logger[_0x8180('0x11')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x1ffc14,_0x8180('0x10'),JSON['stringify'](_0x46a473));if(_0x46a473['error']){if(_0x46a473[_0x8180('0x12')]['code']===0x1f4){logger[_0x8180('0x12')](_0x8180('0xf'),_0x1ffc14,_0x46a473['error'][_0x8180('0x13')]);return _0x520ab2(_0x46a473['error'][_0x8180('0x13')]);}logger[_0x8180('0x12')]('FaxApplication,\x20%s,\x20%s',_0x1ffc14,_0x46a473[_0x8180('0x12')][_0x8180('0x13')]);return _0x4480fe(_0x46a473[_0x8180('0x12')][_0x8180('0x13')]);}else{logger['info'](_0x8180('0xf'),_0x1ffc14,_0x8180('0x10'));_0x4480fe(_0x46a473[_0x8180('0x14')][_0x8180('0x13')]);}})['catch'](function(_0x1c5fed){logger[_0x8180('0x12')](_0x8180('0xf'),_0x1ffc14,_0x1c5fed);_0x520ab2(_0x1c5fed);});});}exports[_0x8180('0x15')]=function(_0x3c5789){var _0x3202bf=this;return new Promise(function(_0xb87a8c,_0x529256){return db[_0x8180('0x16')]['update'](_0x3c5789[_0x8180('0x17')],{'raw':_0x3c5789['options']?_0x3c5789[_0x8180('0x18')][_0x8180('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c5789[_0x8180('0x18')]?_0x3c5789[_0x8180('0x18')]['where']||null:null,'attributes':_0x3c5789[_0x8180('0x18')]?_0x3c5789[_0x8180('0x18')]['attributes']||null:null,'limit':_0x3c5789['options']?_0x3c5789[_0x8180('0x18')][_0x8180('0x1a')]||null:null})['then'](function(_0x5544a9){logger[_0x8180('0xe')]('UpdateFaxApplication',_0x3c5789);logger[_0x8180('0x11')](_0x8180('0x15'),_0x3c5789,JSON[_0x8180('0x1b')](_0x5544a9));_0xb87a8c(_0x5544a9);})[_0x8180('0x1c')](function(_0x36f112){logger[_0x8180('0x12')](_0x8180('0x15'),_0x36f112[_0x8180('0x13')],_0x3c5789);_0x529256(_0x3202bf[_0x8180('0x12')](0x1f4,_0x36f112[_0x8180('0x13')]));});});}; \ No newline at end of file +var _0xb43e=['FaxApplication','update','body','options','where','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3a18f3,_0xa6b079){var _0x431120=function(_0x3ce96e){while(--_0x3ce96e){_0x3a18f3['push'](_0x3a18f3['shift']());}};_0x431120(++_0xa6b079);}(_0xb43e,0x1e6));var _0xeb43=function(_0xaa8e37,_0x154c84){_0xaa8e37=_0xaa8e37-0x0;var _0x5dbf02=_0xb43e[_0xaa8e37];return _0x5dbf02;};'use strict';var _=require(_0xeb43('0x0'));var util=require(_0xeb43('0x1'));var moment=require(_0xeb43('0x2'));var BPromise=require(_0xeb43('0x3'));var rs=require(_0xeb43('0x4'));var fs=require('fs');var Redis=require(_0xeb43('0x5'));var db=require(_0xeb43('0x6'))['db'];var utils=require(_0xeb43('0x7'));var logger=require(_0xeb43('0x8'))(_0xeb43('0x9'));var config=require(_0xeb43('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xeb43('0xb')][_0xeb43('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x535616,_0x54eaf0,_0x614c4f){return new BPromise(function(_0x1d4fb8,_0x2a3cd5){return client[_0xeb43('0xd')](_0x535616,_0x614c4f)[_0xeb43('0xe')](function(_0x257c42){logger[_0xeb43('0xf')](_0xeb43('0x10'),_0x54eaf0,_0xeb43('0x11'));logger[_0xeb43('0x12')](_0xeb43('0x13'),_0x54eaf0,_0xeb43('0x11'),JSON[_0xeb43('0x14')](_0x257c42));if(_0x257c42[_0xeb43('0x15')]){if(_0x257c42[_0xeb43('0x15')][_0xeb43('0x16')]===0x1f4){logger[_0xeb43('0x15')]('FaxApplication,\x20%s,\x20%s',_0x54eaf0,_0x257c42['error'][_0xeb43('0x17')]);return _0x2a3cd5(_0x257c42[_0xeb43('0x15')][_0xeb43('0x17')]);}logger[_0xeb43('0x15')]('FaxApplication,\x20%s,\x20%s',_0x54eaf0,_0x257c42[_0xeb43('0x15')][_0xeb43('0x17')]);return _0x1d4fb8(_0x257c42['error'][_0xeb43('0x17')]);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x54eaf0,_0xeb43('0x11'));_0x1d4fb8(_0x257c42[_0xeb43('0x18')][_0xeb43('0x17')]);}})[_0xeb43('0x19')](function(_0x46b3a6){logger[_0xeb43('0x15')](_0xeb43('0x10'),_0x54eaf0,_0x46b3a6);_0x2a3cd5(_0x46b3a6);});});}exports['UpdateFaxApplication']=function(_0x461d52){var _0x274af4=this;return new Promise(function(_0x593b79,_0x3266d3){return db[_0xeb43('0x1a')][_0xeb43('0x1b')](_0x461d52[_0xeb43('0x1c')],{'raw':_0x461d52[_0xeb43('0x1d')]?_0x461d52['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x461d52['options']?_0x461d52[_0xeb43('0x1d')][_0xeb43('0x1e')]||null:null,'attributes':_0x461d52[_0xeb43('0x1d')]?_0x461d52[_0xeb43('0x1d')]['attributes']||null:null,'limit':_0x461d52[_0xeb43('0x1d')]?_0x461d52[_0xeb43('0x1d')]['limit']||null:null})['then'](function(_0x25b57a){logger[_0xeb43('0xf')](_0xeb43('0x1f'),_0x461d52);logger[_0xeb43('0x12')](_0xeb43('0x1f'),_0x461d52,JSON[_0xeb43('0x14')](_0x25b57a));_0x593b79(_0x25b57a);})[_0xeb43('0x19')](function(_0xdfd1a3){logger[_0xeb43('0x15')](_0xeb43('0x1f'),_0xdfd1a3['message'],_0x461d52);_0x3266d3(_0x274af4[_0xeb43('0x15')](0x1f4,_0xdfd1a3['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index d681cfa..770583b 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 _0x46ed=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports'];(function(_0x57ac45,_0x4b408e){var _0x72340c=function(_0x17c0d6){while(--_0x17c0d6){_0x57ac45['push'](_0x57ac45['shift']());}};_0x72340c(++_0x4b408e);}(_0x46ed,0x168));var _0xd46e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x46ed[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd46e('0x5'));var config=require(_0xd46e('0x6'));var controller=require('./faxApplication.controller');router[_0xd46e('0x7')]('/',auth[_0xd46e('0x8')](),controller[_0xd46e('0x9')]);router[_0xd46e('0x7')](_0xd46e('0xa'),auth[_0xd46e('0x8')](),controller[_0xd46e('0xb')]);router[_0xd46e('0xc')]('/',auth[_0xd46e('0x8')](),controller[_0xd46e('0xd')]);router[_0xd46e('0xe')]('/:id',auth[_0xd46e('0x8')](),controller[_0xd46e('0xf')]);router['delete'](_0xd46e('0xa'),auth[_0xd46e('0x8')](),controller[_0xd46e('0x10')]);module[_0xd46e('0x11')]=router; \ No newline at end of file +var _0x1883=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','create','update','delete','exports'];(function(_0x1ab6cc,_0x3217f0){var _0x5bebe4=function(_0x4a67be){while(--_0x4a67be){_0x1ab6cc['push'](_0x1ab6cc['shift']());}};_0x5bebe4(++_0x3217f0);}(_0x1883,0xab));var _0x3188=function(_0x1ccddc,_0x42a829){_0x1ccddc=_0x1ccddc-0x0;var _0x490d5f=_0x1883[_0x1ccddc];return _0x490d5f;};'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 auth=require(_0x3188('0x6'));var interaction=require(_0x3188('0x7'));var config=require(_0x3188('0x8'));var controller=require(_0x3188('0x9'));router[_0x3188('0xa')]('/',auth[_0x3188('0xb')](),controller[_0x3188('0xc')]);router[_0x3188('0xa')](_0x3188('0xd'),auth[_0x3188('0xb')](),controller[_0x3188('0xe')]);router['post']('/',auth[_0x3188('0xb')](),controller[_0x3188('0xf')]);router['put'](_0x3188('0xd'),auth['isAuthenticated'](),controller[_0x3188('0x10')]);router[_0x3188('0x11')](_0x3188('0xd'),auth[_0x3188('0xb')](),controller['destroy']);module[_0x3188('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 898bcb8..5b77739 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 _0xd847=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x406e46,_0x5799cb){var _0x4a3742=function(_0x1fa435){while(--_0x1fa435){_0x406e46['push'](_0x406e46['shift']());}};_0x4a3742(++_0x5799cb);}(_0xd847,0x18a));var _0x7d84=function(_0x4ba534,_0x392b4c){_0x4ba534=_0x4ba534-0x0;var _0x46f888=_0xd847[_0x4ba534];return _0x46f888;};'use strict';var Sequelize=require(_0x7d84('0x0'));module[_0x7d84('0x1')]={'closed':{'type':Sequelize[_0x7d84('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7d84('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7d84('0x4')]},'note':{'type':Sequelize[_0x7d84('0x4')]},'read1stAt':{'type':Sequelize[_0x7d84('0x3')]},'fax':{'type':Sequelize[_0x7d84('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7d84('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7d84('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7d84('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x03db=['exports','BOOLEAN','DATE','STRING','out','ENUM','sequelize'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x03db,0x156));var _0xb03d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x03db[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xb03d('0x0'));module[_0xb03d('0x1')]={'closed':{'type':Sequelize[_0xb03d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb03d('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xb03d('0x4')]},'thirdDisposition':{'type':Sequelize[_0xb03d('0x4')]},'note':{'type':Sequelize[_0xb03d('0x4')]},'read1stAt':{'type':Sequelize[_0xb03d('0x3')]},'fax':{'type':Sequelize[_0xb03d('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb03d('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb03d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb03d('0x6')]('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 cd292dd..8756b54 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 _0x6cc5=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','rawAttributes','includeAll','include','options','create','params','describe','addMessage','FaxMessage','ids','omit','getMessages','filter','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','download','root','files','join','server','attachments','Attachment','get','mkdirSync','Messages','basename','existsSync','createReadStream','pipe','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','error','name','send','map','fullname','TagIds','Tags','forEach','push','catch','FaxInteraction','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','parseSearch','search','conditions','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','split','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?','find','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','body','buildExpression','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','getFaxAccounts','agent','sequelize','toString','merge','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','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname'];(function(_0x11fb47,_0x50fbf8){var _0xa0d270=function(_0x2d6c3e){while(--_0x2d6c3e){_0x11fb47['push'](_0x11fb47['shift']());}};_0xa0d270(++_0x50fbf8);}(_0x6cc5,0x1df));var _0x56cc=function(_0x58db38,_0x56bac9){_0x58db38=_0x58db38-0x0;var _0xe7aea1=_0x6cc5[_0x58db38];return _0xe7aea1;};'use strict';var pdf=require(_0x56cc('0x0'));var emlformat=require(_0x56cc('0x1'));var rimraf=require(_0x56cc('0x2'));var zipdir=require(_0x56cc('0x3'));var jsonpatch=require(_0x56cc('0x4'));var rp=require(_0x56cc('0x5'));var moment=require(_0x56cc('0x6'));var BPromise=require(_0x56cc('0x7'));var Mustache=require(_0x56cc('0x8'));var util=require('util');var path=require(_0x56cc('0x9'));var sox=require(_0x56cc('0xa'));var csv=require(_0x56cc('0xb'));var ejs=require(_0x56cc('0xc'));var fs=require('fs');var _=require(_0x56cc('0xd'));var squel=require(_0x56cc('0xe'));var crypto=require(_0x56cc('0xf'));var jsforce=require(_0x56cc('0x10'));var deskjs=require(_0x56cc('0x11'));var toCsv=require(_0x56cc('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x56cc('0x12'));var authService=require(_0x56cc('0x13'));var qs=require(_0x56cc('0x14'));var as=require(_0x56cc('0x15'));var hardwareService=require(_0x56cc('0x16'));var logger=require(_0x56cc('0x17'))(_0x56cc('0x18'));var utils=require(_0x56cc('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x56cc('0x1a'));var db=require(_0x56cc('0x1b'))['db'];config[_0x56cc('0x1c')]=_[_0x56cc('0x1d')](config[_0x56cc('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x56cc('0x1e'))(new Redis(config[_0x56cc('0x1c')]));require(_0x56cc('0x1f'))[_0x56cc('0x20')](socket);function respondWithStatusCode(_0x13c2ac,_0x569198){_0x569198=_0x569198||0xcc;return function(_0x18011f){if(_0x18011f){return _0x13c2ac[_0x56cc('0x21')](_0x569198);}return _0x13c2ac[_0x56cc('0x22')](_0x569198)[_0x56cc('0x23')]();};}function respondWithResult(_0x1ef929,_0x37fe62){_0x37fe62=_0x37fe62||0xc8;return function(_0x53b319){if(_0x53b319){return _0x1ef929[_0x56cc('0x22')](_0x37fe62)[_0x56cc('0x24')](_0x53b319);}};}function respondWithFilteredResult(_0x5d6fba,_0x4e43e5){return function(_0x3c7a6c){if(_0x3c7a6c){var _0x4909f4=_0x3c7a6c[_0x56cc('0x25')],_0x3b5998=_0x4e43e5[_0x56cc('0x26')],_0x1881ed=_0x4e43e5[_0x56cc('0x26')]+_0x4e43e5['limit'],_0x3c857e;if(_0x1881ed>=_0x4909f4){_0x1881ed=_0x4909f4;_0x3c857e=0xc8;}else{_0x3c857e=0xce;}_0x5d6fba[_0x56cc('0x22')](_0x3c857e);return _0x5d6fba[_0x56cc('0x27')]('Content-Range',_0x3b5998+'-'+_0x1881ed+'/'+_0x4909f4)['json'](_0x3c7a6c);}return null;};}function patchUpdates(_0x14c021){return function(_0x53a083){try{jsonpatch[_0x56cc('0x28')](_0x53a083,_0x14c021,!![]);}catch(_0x309706){return BPromise[_0x56cc('0x29')](_0x309706);}return _0x53a083[_0x56cc('0x2a')]();};}function saveUpdates(_0x39ac39,_0x55c907){return function(_0x2bf745){if(_0x2bf745){return _0x2bf745[_0x56cc('0x2b')](_0x39ac39)[_0x56cc('0x2c')](function(_0x5b72b9){return _0x5b72b9;});}return null;};}function removeEntity(_0x4c23fc,_0x3f3dcb){return function(_0x35d446){if(_0x35d446){return _0x35d446[_0x56cc('0x2d')]()[_0x56cc('0x2c')](function(){_0x4c23fc[_0x56cc('0x22')](0xcc)[_0x56cc('0x23')]();});}};}function handleEntityNotFound(_0x449cd2,_0x3bad5f){return function(_0x524537){if(!_0x524537){_0x449cd2[_0x56cc('0x21')](0x194);}return _0x524537;};}function handleError(_0x2da16c,_0x135a90){_0x135a90=_0x135a90||0x1f4;return function(_0x265c28){logger[_0x56cc('0x2e')](_0x265c28['stack']);if(_0x265c28[_0x56cc('0x2f')]){delete _0x265c28['name'];}_0x2da16c[_0x56cc('0x22')](_0x135a90)[_0x56cc('0x30')](_0x265c28);};}function getInteractionUsers(_0x5c160e,_0x36ae94){return new BPromise(function(_0xb92b1b,_0x314334){try{if(_0x36ae94[_0x5c160e['id']]){_0x5c160e['Users']=_[_0x56cc('0x31')](_0x36ae94[_0x5c160e['id']],function(_0x3376eb){return{'id':_0x3376eb['id'],'fullname':_0x3376eb[_0x56cc('0x32')]};});}}catch(_0x19c6da){_0x314334(_0x19c6da);}_0xb92b1b(_0x5c160e);});}function getInteractionTags(_0x34069c,_0x5bd766){return new BPromise(function(_0x315c49,_0x2853b5){try{if(_0x34069c[_0x56cc('0x33')]){_0x34069c[_0x56cc('0x34')]=[];_0x34069c[_0x56cc('0x33')]['split'](',')[_0x56cc('0x35')](function(_0x41b951){_0x34069c[_0x56cc('0x34')][_0x56cc('0x36')](_0x5bd766[_0x41b951]);});}delete _0x34069c[_0x56cc('0x33')];}catch(_0x517c3d){_0x2853b5(_0x517c3d);}_0x315c49(_0x34069c);});}function updateFaxInteraction(_0x4b2ff4,_0xd747d0,_0x3ced5f){return new BPromise(function(_0x5bbf30,_0x1f936a){return getInteractionUsers(_0x4b2ff4,_0x3ced5f)[_0x56cc('0x2c')](function(_0x42ab8b){return getInteractionTags(_0x42ab8b,_0xd747d0);})[_0x56cc('0x2c')](function(_0x4aff70){_0x5bbf30(_0x4aff70);})[_0x56cc('0x37')](function(_0x10b436){_0x1f936a(_0x10b436);});});}exports['index']=function(_0x2ba7a3,_0x18535e){var _0x517e2e={},_0x1af900={},_0x559dfb={'count':0x0,'rows':[]};var _0x2456fb=_[_0x56cc('0x31')](db[_0x56cc('0x38')]['rawAttributes'],function(_0xb0dda9){return{'name':_0xb0dda9[_0x56cc('0x39')],'type':_0xb0dda9['type'][_0x56cc('0x3a')]};});_0x1af900['model']=_[_0x56cc('0x31')](_0x2456fb,_0x56cc('0x2f'));_0x1af900[_0x56cc('0x3b')]=_[_0x56cc('0x3c')](_0x2ba7a3[_0x56cc('0x3b')]);_0x1af900[_0x56cc('0x3d')]=_[_0x56cc('0x3e')](_0x1af900[_0x56cc('0x3f')],_0x1af900[_0x56cc('0x3b')]);_0x517e2e[_0x56cc('0x40')]=_['intersection'](_0x1af900[_0x56cc('0x3f')],qs[_0x56cc('0x41')](_0x2ba7a3[_0x56cc('0x3b')][_0x56cc('0x41')]));_0x517e2e[_0x56cc('0x40')]=_0x517e2e[_0x56cc('0x40')][_0x56cc('0x42')]?_0x517e2e[_0x56cc('0x40')]:_0x1af900[_0x56cc('0x3f')];if(!_0x2ba7a3[_0x56cc('0x3b')][_0x56cc('0x43')](_0x56cc('0x44'))){_0x517e2e['limit']=qs[_0x56cc('0x45')](_0x2ba7a3['query'][_0x56cc('0x45')]);_0x517e2e[_0x56cc('0x26')]=qs[_0x56cc('0x26')](_0x2ba7a3[_0x56cc('0x3b')][_0x56cc('0x26')]);}_0x517e2e[_0x56cc('0x46')]=qs[_0x56cc('0x47')](_0x2ba7a3[_0x56cc('0x3b')][_0x56cc('0x47')]);_0x517e2e[_0x56cc('0x48')]=qs['filters'](_[_0x56cc('0x49')](_0x2ba7a3[_0x56cc('0x3b')],_0x1af900['filters']),_0x2456fb);var _0x541ea4=[];var _0xada17b=squel[_0x56cc('0x4a')]()[_0x56cc('0x4b')]('id')[_0x56cc('0x4b')]('name')[_0x56cc('0x4b')](_0x56cc('0x4c'))[_0x56cc('0x4d')](_0x56cc('0x4e'));var _0xaacb53=squel[_0x56cc('0x4a')]()[_0x56cc('0x4b')](_0x56cc('0x4f'))['field'](_0x56cc('0x50'))[_0x56cc('0x4b')](_0x56cc('0x51'))[_0x56cc('0x4d')](_0x56cc('0x52'),'ui')[_0x56cc('0x53')](_0x56cc('0x54'),'u',_0x56cc('0x55'));var _0x42ff18=squel['select']()[_0x56cc('0x4d')](_0x56cc('0x56'),'i')[_0x56cc('0x53')]('cm_contacts','c',_0x56cc('0x57'))[_0x56cc('0x53')]('users','o',_0x56cc('0x58'))[_0x56cc('0x53')]('fax_accounts','a','a.id\x20=\x20i.FaxAccountId')[_0x56cc('0x53')]('fax_messages','me',_0x56cc('0x59'))[_0x56cc('0x53')]('fax_interaction_has_tags','it',_0x56cc('0x5a'))[_0x56cc('0x53')](_0x56cc('0x4e'),'t','t.id\x20=\x20it.TagId');var _0x1cb300=squel['expr']();var _0x107af8=[];var _0xa515f7=squel['expr']();var _0x439db3;if(_0x2ba7a3[_0x56cc('0x3b')]['search']){_0x439db3=as[_0x56cc('0x5b')](_0x2ba7a3[_0x56cc('0x3b')][_0x56cc('0x5c')]);var _0x20ac25=_0x439db3['sqlOperator'];for(var _0x12c72e=0x0;_0x12c72e<_0x439db3[_0x56cc('0x5d')][_0x56cc('0x42')];_0x12c72e++){var _0x52ada3=_0x439db3[_0x56cc('0x5d')][_0x12c72e];var _0x23cba8='i';var _0x144db8=_['find'](_0x2456fb,[_0x56cc('0x2f'),_0x52ada3[_0x56cc('0x4b')]]);if(!_0x144db8){switch(_0x52ada3['field']){case _0x56cc('0x5e'):if(_0x52ada3['value']==0x1){_0x42ff18[_0x56cc('0x5f')]('`'+_0x52ada3[_0x56cc('0x4b')]+'`\x20=\x200');}else{_0x42ff18[_0x56cc('0x5f')]('`'+_0x52ada3[_0x56cc('0x4b')]+_0x56cc('0x60'));}break;case _0x56cc('0x61'):if(_0x52ada3[_0x56cc('0x62')]===_0x56cc('0x63')){if(_0x52ada3[_0x56cc('0x64')][_0x56cc('0x65')]('\x20')['length']>0x1){_0x1cb300[_0x20ac25](_0x56cc('0x66'),qs[_0x56cc('0x67')](_0x52ada3[_0x56cc('0x64')]),null);}else{var _0x33f292='%'+_0x52ada3[_0x56cc('0x64')]+'%';_0x1cb300[_0x20ac25](_0x56cc('0x68'),_0x33f292,_0x33f292,_0x33f292);}}else{_0x144db8=_[_0x56cc('0x69')](_0x2456fb,[_0x56cc('0x2f'),_0x56cc('0x6a')]);_0x52ada3[_0x56cc('0x4b')]='ContactId';_0x36a6f8=as['buildExpression'](_0x23cba8,_0x144db8['type'],_0x52ada3);_0x1cb300[_0x20ac25](_0x36a6f8[_0x56cc('0x6b')],_0x36a6f8[_0x56cc('0x64')][_0x56cc('0x6c')],_0x36a6f8[_0x56cc('0x64')][_0x56cc('0x23')]);}break;case _0x56cc('0x6d'):var _0x1048f4=_0x52ada3[_0x56cc('0x64')]['split'](',')['map'](function(_0x50b783){return Number(_0x50b783);});_0x1048f4[_0x56cc('0x35')](function(_0x352acf){_0xa515f7['or'](_0x56cc('0x6e'),'%,'+_0x352acf+',%');});_0x107af8=_[_0x56cc('0x6f')](_0x107af8,_0x1048f4);break;case _0x56cc('0x70'):if(_0x52ada3[_0x56cc('0x62')]===_0x56cc('0x63')){_0x1cb300[_0x20ac25](_0x56cc('0x71'),'%'+_0x52ada3['value']+'%',null);}else{_0x144db8=_[_0x56cc('0x69')](_0x2456fb,[_0x56cc('0x2f'),_0x56cc('0x72')]);_0x52ada3[_0x56cc('0x4b')]='UserId';_0x36a6f8=as['buildExpression'](_0x23cba8,_0x144db8[_0x56cc('0x73')],_0x52ada3);_0x1cb300[_0x20ac25](_0x36a6f8[_0x56cc('0x6b')],_0x36a6f8['value']['start'],_0x36a6f8[_0x56cc('0x64')][_0x56cc('0x23')]);}break;case _0x56cc('0x74'):_0x36a6f8=as[_0x56cc('0x75')]('me',null,_0x52ada3);_0x1cb300[_0x20ac25](_0x36a6f8['text'],_0x36a6f8[_0x56cc('0x64')][_0x56cc('0x6c')],_0x36a6f8[_0x56cc('0x64')][_0x56cc('0x23')]);break;}}else{var _0x36a6f8=as[_0x56cc('0x75')](_0x23cba8,_0x144db8[_0x56cc('0x73')],_0x52ada3);_0x1cb300[_0x20ac25](_0x36a6f8['text'],_0x36a6f8[_0x56cc('0x64')][_0x56cc('0x6c')],_0x36a6f8[_0x56cc('0x64')][_0x56cc('0x23')]);}}}else{var _0x4e6f20=_(_0x2ba7a3[_0x56cc('0x3b')])[_0x56cc('0x3c')]()['map'](function(_0x27332b){return _[_0x56cc('0x76')](_0x2456fb,['name',_0x27332b])?_0x27332b:undefined;})['compact']()[_0x56cc('0x64')]();if(!_[_0x56cc('0x77')](_0x4e6f20)){_0x4e6f20[_0x56cc('0x35')](function(_0x3de94e){if(_0x3de94e===_0x56cc('0x78')){_0x42ff18[_0x56cc('0x48')](_0x56cc('0x79'),[][_0x56cc('0x7a')](_0x2ba7a3[_0x56cc('0x3b')][_0x3de94e]));}else if(_0x3de94e===_0x56cc('0x7b')){var _0x2953a2=JSON[_0x56cc('0x7c')](_0x2ba7a3['query'][_0x3de94e])[_0x56cc('0x7d')];var _0x510424=JSON[_0x56cc('0x7c')](_0x2ba7a3[_0x56cc('0x3b')][_0x3de94e])[_0x56cc('0x7e')];_0x42ff18['where'](_0x56cc('0x7f'),_0x2953a2,_0x510424);}else{if(_0x2ba7a3[_0x56cc('0x3b')][_0x3de94e]==='null'){_0x42ff18[_0x56cc('0x48')]('i.'+_0x3de94e+'\x20IS\x20NULL');}else{_0x42ff18[_0x56cc('0x48')]('i.'+_0x3de94e+_0x56cc('0x80'),_0x2ba7a3[_0x56cc('0x3b')][_0x3de94e]);}}});}if(_0x2ba7a3[_0x56cc('0x3b')][_0x56cc('0x81')]){if(_0x2ba7a3['query'][_0x56cc('0x81')]==0x1){_0x42ff18[_0x56cc('0x5f')](_0x56cc('0x82'));}else{_0x42ff18[_0x56cc('0x5f')](_0x56cc('0x83'));}}if(_0x2ba7a3[_0x56cc('0x3b')][_0x56cc('0x84')]){_0x107af8=_[_0x56cc('0x85')](_0x2ba7a3[_0x56cc('0x3b')][_0x56cc('0x84')])?_0x2ba7a3[_0x56cc('0x3b')][_0x56cc('0x84')]:new Array(_0x2ba7a3[_0x56cc('0x3b')][_0x56cc('0x84')]);_0x107af8[_0x56cc('0x35')](function(_0x312ceb){_0xa515f7['or'](_0x56cc('0x6e'),'%,'+_0x312ceb+',%');});}if(_0x2ba7a3[_0x56cc('0x3b')]['filter']){var _0x3b89f2=_0x2ba7a3['query']['filter']['replace']('\x5c','\x5c\x5c')[_0x56cc('0x86')](/'/g,'\x27\x27');if(qs[_0x56cc('0x87')](_0x3b89f2)){_0x1cb300['or'](_0x56cc('0x88'),_0x3b89f2+'%')['or'](_0x56cc('0x89'),_0x3b89f2+'%');}_0x1cb300['or'](_0x56cc('0x8a'),_0x3b89f2+'%');}}_0x42ff18['where'](_0x1cb300);_0x42ff18[_0x56cc('0x8b')]('i.id');var _0x363921={'type':db['Sequelize'][_0x56cc('0x8c')][_0x56cc('0x8d')],'raw':!![]};var _0x2828e2=_0x42ff18['clone']();_0x2828e2[_0x56cc('0x4b')](_0x56cc('0x8e'));_0x2828e2['field'](_0x56cc('0x8f'),_0x56cc('0x5e'));if(_0x517e2e[_0x56cc('0x46')]){_0x517e2e[_0x56cc('0x46')][_0x56cc('0x35')](function(_0xd87f3b){var _0x55ccb3=_0xd87f3b[0x0]===_0x56cc('0x90')?_0xd87f3b[0x0]:'i.'+_0xd87f3b[0x0];_0x42ff18[_0x56cc('0x46')](_0x55ccb3,_0xd87f3b[0x1]===_0x56cc('0x91')?![]:!![]);});}if(!_['isEmpty'](_0x107af8)){_0x42ff18[_0x56cc('0x5f')](_0xa515f7);_0x2828e2['where'](_0x56cc('0x92'),_0x107af8);}BPromise[_0x56cc('0x93')]()[_0x56cc('0x2c')](function(){if(!_0x439db3){if(_0x2ba7a3[_0x56cc('0x3b')][_0x56cc('0x78')])return;_0x2828e2[_0x56cc('0x48')](_0x56cc('0x94'));_0x42ff18[_0x56cc('0x48')](_0x56cc('0x94'));return;}if(_0x2ba7a3['user']['role']!=='agent')return;return _0x2ba7a3['user'][_0x56cc('0x95')]({'attributes':['id'],'raw':!![]})[_0x56cc('0x2c')](function(_0x5ac283){if(_[_0x56cc('0x77')](_0x5ac283)){_0x2828e2[_0x56cc('0x48')]('i.FaxAccountId\x20IS\x20NULL');_0x42ff18[_0x56cc('0x48')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x2828e2[_0x56cc('0x48')](_0x56cc('0x79'),_[_0x56cc('0x31')](_0x5ac283,'id'));_0x42ff18['where']('i.FaxAccountId\x20IN\x20?',_[_0x56cc('0x31')](_0x5ac283,'id'));}});})[_0x56cc('0x2c')](function(){if(_0x2ba7a3['user']['role']===_0x56cc('0x96')&&!_0x439db3&&!_0x2ba7a3[_0x56cc('0x3b')][_0x56cc('0x78')])return[];return db[_0x56cc('0x97')][_0x56cc('0x3b')](_0x2828e2[_0x56cc('0x98')](),_0x363921);})[_0x56cc('0x2c')](function(_0x5bb237){_0x559dfb[_0x56cc('0x25')]=_0x5bb237[_0x56cc('0x42')];if(_0x559dfb['count']===0x0)return[];return db['sequelize'][_0x56cc('0x3b')](_0xada17b[_0x56cc('0x98')](),_0x363921)[_0x56cc('0x2c')](function(_0x3094d4){_0x541ea4=_['keyBy'](_0x3094d4,'id');_0x363921=_[_0x56cc('0x99')](_0x363921,{'model':db[_0x56cc('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2ba7a3[_0x56cc('0x3b')][_0x56cc('0x41')]){_0x517e2e[_0x56cc('0x40')][_0x56cc('0x35')](function(_0x44e94f){_0x42ff18[_0x56cc('0x4b')]('i.'+_0x44e94f);});}else{_0x42ff18['field'](_0x56cc('0x8f'),_0x56cc('0x5e'));_0x42ff18[_0x56cc('0x4b')]('a.key',_0x56cc('0x9a'));_0x42ff18[_0x56cc('0x4b')](_0x56cc('0x9b'),_0x56cc('0x9c'));_0x42ff18[_0x56cc('0x4b')](_0x56cc('0x9d'),_0x56cc('0x90'));_0x42ff18[_0x56cc('0x4b')]('i.*');_0x42ff18['field'](_0x56cc('0x9e'),_0x56cc('0x9f'));_0x42ff18[_0x56cc('0x4b')](_0x56cc('0xa0'),'Contact.lastName');_0x42ff18[_0x56cc('0x4b')](_0x56cc('0xa1'),_0x56cc('0xa2'));_0x42ff18[_0x56cc('0x4b')](_0x56cc('0xa3'),_0x56cc('0xa4'));_0x42ff18[_0x56cc('0x4b')](_0x56cc('0xa5'),_0x56cc('0xa6'));_0x42ff18[_0x56cc('0x4b')]('c.fax','Contact.fax');_0x42ff18[_0x56cc('0x4b')](_0x56cc('0xa7'),_0x56cc('0xa8'));_0x42ff18['field'](_0x56cc('0xa9'),_0x56cc('0xaa'));_0x42ff18[_0x56cc('0x4b')](_0x56cc('0xab'),'TagIds');}if(_0x517e2e[_0x56cc('0x45')])_0x42ff18['limit'](_0x517e2e[_0x56cc('0x45')]);if(_0x517e2e['offset'])_0x42ff18['offset'](_0x517e2e[_0x56cc('0x26')]);return db['sequelize'][_0x56cc('0x3b')](_0x42ff18[_0x56cc('0x98')](),_0x363921);})[_0x56cc('0x2c')](function(_0x189556){_0xaacb53['where'](_0x56cc('0xac'),_['map'](_0x189556,'id'));return db[_0x56cc('0x97')][_0x56cc('0x3b')](_0xaacb53[_0x56cc('0x98')](),_0x363921)[_0x56cc('0x2c')](function(_0x552848){var _0x3b8dd4=_[_0x56cc('0xad')](_0x552848,_0x56cc('0xae'));var _0x36be39=[];_0x189556[_0x56cc('0x35')](function(_0x59882d){_0x36be39['push'](updateFaxInteraction(_0x59882d,_0x541ea4,_0x3b8dd4));});return BPromise[_0x56cc('0xaf')](_0x36be39);});});})[_0x56cc('0x2c')](function(_0x58d96a){_0x559dfb[_0x56cc('0xb0')]=_0x58d96a;return _0x559dfb;})['then'](respondWithFilteredResult(_0x18535e,_0x517e2e))[_0x56cc('0x37')](handleError(_0x18535e,null));};exports[_0x56cc('0xb1')]=function(_0x95c990,_0x32eb00){var _0x22aaca={'raw':![],'where':{'id':_0x95c990['params']['id']}},_0x1f3de8={};_0x1f3de8[_0x56cc('0x3f')]=_[_0x56cc('0x3c')](db[_0x56cc('0x38')][_0x56cc('0xb2')]);_0x1f3de8['query']=_[_0x56cc('0x3c')](_0x95c990['query']);_0x1f3de8[_0x56cc('0x3d')]=_[_0x56cc('0x3e')](_0x1f3de8[_0x56cc('0x3f')],_0x1f3de8[_0x56cc('0x3b')]);_0x22aaca[_0x56cc('0x40')]=_[_0x56cc('0x3e')](_0x1f3de8['model'],qs[_0x56cc('0x41')](_0x95c990['query'][_0x56cc('0x41')]));_0x22aaca['attributes']=_0x22aaca[_0x56cc('0x40')][_0x56cc('0x42')]?_0x22aaca[_0x56cc('0x40')]:_0x1f3de8['model'];if(_0x95c990[_0x56cc('0x3b')][_0x56cc('0xb3')]){_0x22aaca[_0x56cc('0xb4')]=[{'all':!![]}];}_0x22aaca=_['merge']({},_0x22aaca,_0x95c990[_0x56cc('0xb5')]);return db[_0x56cc('0x38')]['find'](_0x22aaca)[_0x56cc('0x2c')](handleEntityNotFound(_0x32eb00,null))['then'](respondWithResult(_0x32eb00,null))[_0x56cc('0x37')](handleError(_0x32eb00,null));};exports['create']=function(_0x4f3a88,_0xd354a7){return db['FaxInteraction'][_0x56cc('0xb6')](_0x4f3a88[_0x56cc('0x74')],{})[_0x56cc('0x2c')](respondWithResult(_0xd354a7,0xc9))[_0x56cc('0x37')](handleError(_0xd354a7,null));};exports[_0x56cc('0x2b')]=function(_0x30a1e9,_0x39fbec){if(_0x30a1e9[_0x56cc('0x74')]['id']){delete _0x30a1e9['body']['id'];}return db[_0x56cc('0x38')][_0x56cc('0x69')]({'where':{'id':_0x30a1e9[_0x56cc('0xb7')]['id']}})['then'](handleEntityNotFound(_0x39fbec,null))['then'](saveUpdates(_0x30a1e9[_0x56cc('0x74')],null))['then'](respondWithResult(_0x39fbec,null))[_0x56cc('0x37')](handleError(_0x39fbec,null));};exports[_0x56cc('0x2d')]=function(_0x4387ca,_0x203e5e){return db[_0x56cc('0x38')]['find']({'where':{'id':_0x4387ca[_0x56cc('0xb7')]['id']}})[_0x56cc('0x2c')](handleEntityNotFound(_0x203e5e,null))[_0x56cc('0x2c')](removeEntity(_0x203e5e,null))['catch'](handleError(_0x203e5e,null));};exports[_0x56cc('0xb8')]=function(_0x4d7547,_0x254581){return db[_0x56cc('0x38')]['describe']()[_0x56cc('0x2c')](respondWithResult(_0x254581,null))[_0x56cc('0x37')](handleError(_0x254581,null));};exports[_0x56cc('0xb9')]=function(_0x410728,_0x2da7f5,_0x516b09){return db[_0x56cc('0xba')][_0x56cc('0x69')]({'where':{'id':_0x410728[_0x56cc('0xb7')]['id']}})['then'](handleEntityNotFound(_0x2da7f5,null))[_0x56cc('0x2c')](function(_0x1c25cf){if(_0x1c25cf){return _0x1c25cf[_0x56cc('0xb9')](_0x410728[_0x56cc('0x74')][_0x56cc('0xbb')],_[_0x56cc('0xbc')](_0x410728[_0x56cc('0x74')],[_0x56cc('0xbb'),'id'])||{});}})['then'](respondWithResult(_0x2da7f5,null))[_0x56cc('0x37')](handleError(_0x2da7f5,null));};exports[_0x56cc('0xbd')]=function(_0x338730,_0x473abb,_0x43f354){var _0x57f572={'raw':![],'where':{}};var _0x331256={};var _0x49b6f5={'count':0x0,'rows':[]};return db[_0x56cc('0x38')]['findOne']({'where':{'id':_0x338730[_0x56cc('0xb7')]['id']}})[_0x56cc('0x2c')](handleEntityNotFound(_0x473abb,null))['then'](function(_0x127f4e){if(_0x127f4e){_0x331256[_0x56cc('0x3f')]=_[_0x56cc('0x3c')](db[_0x56cc('0xba')]['rawAttributes']);_0x331256['query']=_['keys'](_0x338730['query']);_0x331256[_0x56cc('0x3d')]=_[_0x56cc('0x3e')](_0x331256[_0x56cc('0x3f')],_0x331256['query']);_0x57f572[_0x56cc('0x40')]=_['intersection'](_0x331256['model'],qs[_0x56cc('0x41')](_0x338730[_0x56cc('0x3b')][_0x56cc('0x41')]));_0x57f572['attributes']=_0x57f572[_0x56cc('0x40')]['length']?_0x57f572[_0x56cc('0x40')]:_0x331256[_0x56cc('0x3f')];if(!_0x338730[_0x56cc('0x3b')]['hasOwnProperty'](_0x56cc('0x44'))){_0x57f572[_0x56cc('0x45')]=qs['limit'](_0x338730['query']['limit']);_0x57f572[_0x56cc('0x26')]=qs[_0x56cc('0x26')](_0x338730['query'][_0x56cc('0x26')]);}_0x57f572[_0x56cc('0x46')]=qs[_0x56cc('0x47')](_0x338730[_0x56cc('0x3b')]['sort']);_0x57f572[_0x56cc('0x48')]=qs[_0x56cc('0x3d')](_[_0x56cc('0x49')](_0x338730[_0x56cc('0x3b')],_0x331256[_0x56cc('0x3d')]));_0x57f572[_0x56cc('0x48')][_0x56cc('0xae')]=_0x127f4e['id'];if(_0x338730[_0x56cc('0x3b')][_0x56cc('0xbe')]){_0x57f572[_0x56cc('0x48')]=_[_0x56cc('0x99')](_0x57f572[_0x56cc('0x48')],{'$or':_[_0x56cc('0x31')](_0x57f572[_0x56cc('0x40')],function(_0x32f745){var _0x53a645={};_0x53a645[_0x32f745]={'$like':'%'+_0x338730[_0x56cc('0x3b')][_0x56cc('0xbe')]+'%'};return _0x53a645;})});}if(_0x338730['query'][_0x56cc('0x7d')]){var _0x312f4e=_0x338730['query'][_0x56cc('0x7d')][_0x56cc('0x65')](',');var _0x254940={};_0x254940[_0x312f4e[0x0]]={'$gte':moment(_0x312f4e[0x1])[_0x56cc('0xbf')](_0x56cc('0xc0'))};_0x57f572[_0x56cc('0x48')]=_[_0x56cc('0x99')](_0x57f572['where'],_0x254940);}_0x57f572=_[_0x56cc('0x99')]({},_0x57f572,_0x338730[_0x56cc('0xb5')]);return db[_0x56cc('0xba')][_0x56cc('0x25')]({'where':_0x57f572[_0x56cc('0x48')]})['then'](function(_0xd39670){_0x49b6f5['count']=_0xd39670;if(_0x338730[_0x56cc('0x3b')][_0x56cc('0xb3')]){_0x57f572[_0x56cc('0xb4')]=[{'all':!![]}];}return db[_0x56cc('0xba')][_0x56cc('0xc1')](_0x57f572);})[_0x56cc('0x2c')](function(_0x44c399){_0x49b6f5[_0x56cc('0xb0')]=_0x44c399;return _0x49b6f5;});}})['then'](respondWithFilteredResult(_0x473abb,_0x57f572))[_0x56cc('0x37')](handleError(_0x473abb,null));};exports[_0x56cc('0xc2')]=function(_0x52c67f,_0x2e1908,_0x387325){return db[_0x56cc('0x38')][_0x56cc('0x69')]({'where':{'id':_0x52c67f[_0x56cc('0xb7')]['id']}})['then'](handleEntityNotFound(_0x2e1908,null))['then'](function(_0x33e0a3){if(_0x33e0a3){return _0x33e0a3[_0x56cc('0xc3')](_0x52c67f['body'][_0x56cc('0xbb')],_['omit'](_0x52c67f[_0x56cc('0x74')],[_0x56cc('0xbb'),'id'])||{})[_0x56cc('0xc4')](function(){return db[_0x56cc('0x6d')][_0x56cc('0xc1')]({'attributes':['id',_0x56cc('0x2f'),_0x56cc('0x4c')],'where':{'id':_0x52c67f['body'][_0x56cc('0xbb')]}});})['then'](function(_0x4e7428){socket[_0x56cc('0xc5')](_0x56cc('0xc6'),{'id':Number(_0x52c67f[_0x56cc('0xb7')]['id']),'tags':_0x4e7428||[]});return{'id':Number(_0x52c67f[_0x56cc('0xb7')]['id']),'tags':_0x4e7428||[]};});}})['then'](respondWithResult(_0x2e1908,null))[_0x56cc('0x37')](handleError(_0x2e1908,null));};exports[_0x56cc('0xc7')]=function(_0x14e393,_0x37afba,_0x47e1ad){return db['FaxInteraction'][_0x56cc('0x69')]({'where':{'id':_0x14e393['params']['id']}})[_0x56cc('0x2c')](handleEntityNotFound(_0x37afba,null))[_0x56cc('0x2c')](function(_0x395f93){if(_0x395f93){return _0x395f93[_0x56cc('0xc7')](_0x14e393[_0x56cc('0x3b')][_0x56cc('0xbb')]);}})[_0x56cc('0x2c')](respondWithStatusCode(_0x37afba,null))[_0x56cc('0x37')](handleError(_0x37afba,null));};exports[_0x56cc('0xc8')]=function(_0x190264,_0x3001cc){var _0x1ce371=moment()['unix']()['toString']();var _0xaf6b1f=path['join'](config[_0x56cc('0xc9')],'server',_0x56cc('0xca'),'tmp');var _0x551297=path[_0x56cc('0xcb')](config['root'],_0x56cc('0xcc'),'files',_0x56cc('0xcd'));var _0x5dc6e8=path['join'](_0xaf6b1f,_0x1ce371);var _0x4a42ad=util[_0x56cc('0xbf')]('transcript-%d-%s.zip',_0x190264[_0x56cc('0xb7')]['id'],_0x1ce371);var _0x5dc03c=path[_0x56cc('0xcb')](_0xaf6b1f,_0x4a42ad);var _0x4dad2f=[];_0x4dad2f['push']({'model':db[_0x56cc('0xce')],'as':_0x56cc('0xce'),'raw':!![]});var _0x42b62=[{'model':db[_0x56cc('0xba')],'as':'Messages','attributes':['id','body',_0x56cc('0x7b')],'include':_0x4dad2f}];return db[_0x56cc('0x38')][_0x56cc('0x69')]({'where':{'id':_0x190264[_0x56cc('0xb7')]['id']},'include':_0x42b62})['then'](handleEntityNotFound(_0x3001cc,null))[_0x56cc('0x2c')](function(_0x111844){if(_0x111844&&_0x111844['Messages']){var _0xc932dd=_0x111844[_0x56cc('0xcf')]({'plain':!![]});fs[_0x56cc('0xd0')](_0x5dc6e8);for(var _0x318a52=0x0;_0x318a52<_0xc932dd['Messages'][_0x56cc('0x42')];_0x318a52++){var _0x5ac59f=_0xc932dd[_0x56cc('0xd1')][_0x318a52][_0x56cc('0xce')];if(_0x5ac59f){var _0xe20c24=path[_0x56cc('0xcb')](_0x551297,_0x5ac59f[_0x56cc('0xd2')]);if(fs[_0x56cc('0xd3')](_0xe20c24)){fs[_0x56cc('0xd4')](_0xe20c24)[_0x56cc('0xd5')](fs['createWriteStream'](path[_0x56cc('0xcb')](_0x5dc6e8,_0x5ac59f[_0x56cc('0xd2')])));}}}return BPromise['resolve']()[_0x56cc('0x2c')](function(){return new BPromise(function(_0x4af7d3,_0x3947c7){zipdir(_0x5dc6e8,{'saveTo':_0x5dc03c},function(_0x230fc7,_0x152789){if(_0x230fc7)return _0x3947c7(_0x230fc7);return _0x4af7d3(_0x152789);});})[_0x56cc('0x2c')](function(){return new BPromise(function(_0x549811,_0x432266){rimraf(_0x5dc6e8,function(_0x3af498){if(_0x3af498)_0x432266(_0x3af498);return _0x549811();});});})['then'](function(){return _0x3001cc[_0x56cc('0xc8')](_0x5dc03c,_0x4a42ad,function(_0x42559f){if(_0x42559f){console['log'](_0x56cc('0xd6'),_0x42559f);}else{fs[_0x56cc('0xd7')](_0x5dc03c);}});});});}else{return _0x3001cc[_0x56cc('0x21')](0xc8);}})[_0x56cc('0x37')](handleError(_0x3001cc,null));}; \ No newline at end of file +var _0xf713=['rawAttributes','includeAll','include','options','create','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','sort','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','transcript-%d-%s.zip','Attachment','Messages','basename','createReadStream','pipe','createWriteStream','err','unlinkSync','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','FaxInteraction','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','filters','pick','select','field','from','tools_tags','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','left_join','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','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','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)','getFullTextValue','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','keys','compact','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','merge','a.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','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','show','params'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xf713,0x1cc));var _0x3f71=function(_0x4c2dfc,_0x4814c0){_0x4c2dfc=_0x4c2dfc-0x0;var _0xfd728d=_0xf713[_0x4c2dfc];return _0xfd728d;};'use strict';var pdf=require(_0x3f71('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3f71('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f71('0x2'));var moment=require(_0x3f71('0x3'));var BPromise=require(_0x3f71('0x4'));var Mustache=require(_0x3f71('0x5'));var util=require('util');var path=require(_0x3f71('0x6'));var sox=require(_0x3f71('0x7'));var csv=require(_0x3f71('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3f71('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3f71('0xa'));var deskjs=require(_0x3f71('0xb'));var toCsv=require(_0x3f71('0x8'));var querystring=require(_0x3f71('0xc'));var Papa=require('papaparse');var Redis=require(_0x3f71('0xd'));var authService=require(_0x3f71('0xe'));var qs=require(_0x3f71('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f71('0x10'));var logger=require(_0x3f71('0x11'))(_0x3f71('0x12'));var utils=require(_0x3f71('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3f71('0x14'));var db=require(_0x3f71('0x15'))['db'];config[_0x3f71('0x16')]=_['defaults'](config[_0x3f71('0x16')],{'host':_0x3f71('0x17'),'port':0x18eb});var socket=require(_0x3f71('0x18'))(new Redis(config[_0x3f71('0x16')]));require(_0x3f71('0x19'))['register'](socket);function respondWithStatusCode(_0x42752d,_0x2b23fd){_0x2b23fd=_0x2b23fd||0xcc;return function(_0x1406a4){if(_0x1406a4){return _0x42752d[_0x3f71('0x1a')](_0x2b23fd);}return _0x42752d[_0x3f71('0x1b')](_0x2b23fd)[_0x3f71('0x1c')]();};}function respondWithResult(_0xf79d70,_0x10025f){_0x10025f=_0x10025f||0xc8;return function(_0x44f460){if(_0x44f460){return _0xf79d70[_0x3f71('0x1b')](_0x10025f)[_0x3f71('0x1d')](_0x44f460);}};}function respondWithFilteredResult(_0x3b0fdc,_0x535d8d){return function(_0x1756ff){if(_0x1756ff){var _0x44679d=_0x1756ff[_0x3f71('0x1e')],_0x5081c1=_0x535d8d[_0x3f71('0x1f')],_0x4ceedf=_0x535d8d[_0x3f71('0x1f')]+_0x535d8d[_0x3f71('0x20')],_0x5946e7;if(_0x4ceedf>=_0x44679d){_0x4ceedf=_0x44679d;_0x5946e7=0xc8;}else{_0x5946e7=0xce;}_0x3b0fdc[_0x3f71('0x1b')](_0x5946e7);return _0x3b0fdc[_0x3f71('0x21')]('Content-Range',_0x5081c1+'-'+_0x4ceedf+'/'+_0x44679d)['json'](_0x1756ff);}return null;};}function patchUpdates(_0x5452d7){return function(_0x27f258){try{jsonpatch[_0x3f71('0x22')](_0x27f258,_0x5452d7,!![]);}catch(_0x38f828){return BPromise[_0x3f71('0x23')](_0x38f828);}return _0x27f258[_0x3f71('0x24')]();};}function saveUpdates(_0x7686fd,_0x40d7fe){return function(_0x5ab7b3){if(_0x5ab7b3){return _0x5ab7b3[_0x3f71('0x25')](_0x7686fd)[_0x3f71('0x26')](function(_0x55a109){return _0x55a109;});}return null;};}function removeEntity(_0x38f1d8,_0xfd92f9){return function(_0x31dbad){if(_0x31dbad){return _0x31dbad[_0x3f71('0x27')]()[_0x3f71('0x26')](function(){_0x38f1d8[_0x3f71('0x1b')](0xcc)[_0x3f71('0x1c')]();});}};}function handleEntityNotFound(_0x49a574,_0x1f85b8){return function(_0x5b8860){if(!_0x5b8860){_0x49a574[_0x3f71('0x1a')](0x194);}return _0x5b8860;};}function handleError(_0x2a14b7,_0x401228){_0x401228=_0x401228||0x1f4;return function(_0x54f67d){logger[_0x3f71('0x28')](_0x54f67d['stack']);if(_0x54f67d[_0x3f71('0x29')]){delete _0x54f67d['name'];}_0x2a14b7[_0x3f71('0x1b')](_0x401228)[_0x3f71('0x2a')](_0x54f67d);};}function getInteractionUsers(_0x263139,_0xe2d043){return new BPromise(function(_0x34256c,_0x3328a8){try{if(_0xe2d043[_0x263139['id']]){_0x263139[_0x3f71('0x2b')]=_[_0x3f71('0x2c')](_0xe2d043[_0x263139['id']],function(_0x138caa){return{'id':_0x138caa['id'],'fullname':_0x138caa[_0x3f71('0x2d')]};});}}catch(_0x495807){_0x3328a8(_0x495807);}_0x34256c(_0x263139);});}function getInteractionTags(_0x2f3511,_0x4e9be2){return new BPromise(function(_0x49b291,_0x53c17e){try{if(_0x2f3511[_0x3f71('0x2e')]){_0x2f3511[_0x3f71('0x2f')]=[];_0x2f3511[_0x3f71('0x2e')][_0x3f71('0x30')](',')[_0x3f71('0x31')](function(_0x38cf2a){_0x2f3511[_0x3f71('0x2f')]['push'](_0x4e9be2[_0x38cf2a]);});}delete _0x2f3511[_0x3f71('0x2e')];}catch(_0x143d45){_0x53c17e(_0x143d45);}_0x49b291(_0x2f3511);});}function updateFaxInteraction(_0x52cae7,_0x1d3461,_0x44107c){return new BPromise(function(_0x19aa39,_0x46bd7){return getInteractionUsers(_0x52cae7,_0x44107c)[_0x3f71('0x26')](function(_0x13fb6a){return getInteractionTags(_0x13fb6a,_0x1d3461);})[_0x3f71('0x26')](function(_0x4a97dc){_0x19aa39(_0x4a97dc);})[_0x3f71('0x32')](function(_0x1cd2b4){_0x46bd7(_0x1cd2b4);});});}exports['index']=function(_0x468ef4,_0x133568){var _0x68cadb={},_0x2609c5={},_0x524e8a={'count':0x0,'rows':[]};var _0x37a4ff=_[_0x3f71('0x2c')](db[_0x3f71('0x33')]['rawAttributes'],function(_0x1af39d){return{'name':_0x1af39d['fieldName'],'type':_0x1af39d[_0x3f71('0x34')][_0x3f71('0x35')]};});_0x2609c5[_0x3f71('0x36')]=_[_0x3f71('0x2c')](_0x37a4ff,'name');_0x2609c5[_0x3f71('0x37')]=_['keys'](_0x468ef4[_0x3f71('0x37')]);_0x2609c5['filters']=_['intersection'](_0x2609c5['model'],_0x2609c5[_0x3f71('0x37')]);_0x68cadb[_0x3f71('0x38')]=_[_0x3f71('0x39')](_0x2609c5[_0x3f71('0x36')],qs[_0x3f71('0x3a')](_0x468ef4[_0x3f71('0x37')][_0x3f71('0x3a')]));_0x68cadb[_0x3f71('0x38')]=_0x68cadb[_0x3f71('0x38')][_0x3f71('0x3b')]?_0x68cadb[_0x3f71('0x38')]:_0x2609c5[_0x3f71('0x36')];if(!_0x468ef4[_0x3f71('0x37')][_0x3f71('0x3c')](_0x3f71('0x3d'))){_0x68cadb['limit']=qs[_0x3f71('0x20')](_0x468ef4[_0x3f71('0x37')][_0x3f71('0x20')]);_0x68cadb[_0x3f71('0x1f')]=qs[_0x3f71('0x1f')](_0x468ef4['query']['offset']);}_0x68cadb[_0x3f71('0x3e')]=qs['sort'](_0x468ef4[_0x3f71('0x37')]['sort']);_0x68cadb['where']=qs[_0x3f71('0x3f')](_[_0x3f71('0x40')](_0x468ef4['query'],_0x2609c5['filters']),_0x37a4ff);var _0x1da294=[];var _0x4239fa=squel[_0x3f71('0x41')]()[_0x3f71('0x42')]('id')[_0x3f71('0x42')](_0x3f71('0x29'))[_0x3f71('0x42')]('color')[_0x3f71('0x43')](_0x3f71('0x44'));var _0x4fad6b=squel[_0x3f71('0x41')]()[_0x3f71('0x42')]('u.id')[_0x3f71('0x42')](_0x3f71('0x45'))['field'](_0x3f71('0x46'))[_0x3f71('0x43')](_0x3f71('0x47'),'ui')['left_join'](_0x3f71('0x48'),'u',_0x3f71('0x49'));var _0x3a9abd=squel[_0x3f71('0x41')]()[_0x3f71('0x43')](_0x3f71('0x4a'),'i')['left_join'](_0x3f71('0x4b'),'c',_0x3f71('0x4c'))['left_join'](_0x3f71('0x48'),'o',_0x3f71('0x4d'))[_0x3f71('0x4e')](_0x3f71('0x4f'),'a',_0x3f71('0x50'))[_0x3f71('0x4e')](_0x3f71('0x51'),'me',_0x3f71('0x52'))[_0x3f71('0x4e')](_0x3f71('0x53'),'it',_0x3f71('0x54'))[_0x3f71('0x4e')](_0x3f71('0x44'),'t',_0x3f71('0x55'));var _0x4a0174=squel[_0x3f71('0x56')]();var _0x2209f2=[];var _0x493922=squel['expr']();var _0x4de467;if(_0x468ef4['query'][_0x3f71('0x57')]){_0x4de467=as['parseSearch'](_0x468ef4[_0x3f71('0x37')][_0x3f71('0x57')]);var _0xb397f7=_0x4de467[_0x3f71('0x58')];for(var _0x4b4569=0x0;_0x4b4569<_0x4de467['conditions']['length'];_0x4b4569++){var _0x10d5c9=_0x4de467[_0x3f71('0x59')][_0x4b4569];var _0xe8c7d3='i';var _0x3ff211=_[_0x3f71('0x5a')](_0x37a4ff,[_0x3f71('0x29'),_0x10d5c9[_0x3f71('0x42')]]);if(!_0x3ff211){switch(_0x10d5c9[_0x3f71('0x42')]){case _0x3f71('0x5b'):if(_0x10d5c9[_0x3f71('0x5c')]==0x1){_0x3a9abd['having']('`'+_0x10d5c9[_0x3f71('0x42')]+_0x3f71('0x5d'));}else{_0x3a9abd[_0x3f71('0x5e')]('`'+_0x10d5c9['field']+_0x3f71('0x5f'));}break;case _0x3f71('0x60'):if(_0x10d5c9[_0x3f71('0x61')]===_0x3f71('0x62')){if(_0x10d5c9[_0x3f71('0x5c')][_0x3f71('0x30')]('\x20')[_0x3f71('0x3b')]>0x1){_0x4a0174[_0xb397f7](_0x3f71('0x63'),qs[_0x3f71('0x64')](_0x10d5c9[_0x3f71('0x5c')]),null);}else{var _0x2b58d2='%'+_0x10d5c9[_0x3f71('0x5c')]+'%';_0x4a0174[_0xb397f7]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2b58d2,_0x2b58d2,_0x2b58d2);}}else{_0x3ff211=_[_0x3f71('0x5a')](_0x37a4ff,[_0x3f71('0x29'),_0x3f71('0x65')]);_0x10d5c9[_0x3f71('0x42')]=_0x3f71('0x65');_0x16ba42=as['buildExpression'](_0xe8c7d3,_0x3ff211[_0x3f71('0x34')],_0x10d5c9);_0x4a0174[_0xb397f7](_0x16ba42[_0x3f71('0x66')],_0x16ba42[_0x3f71('0x5c')][_0x3f71('0x67')],_0x16ba42['value'][_0x3f71('0x1c')]);}break;case _0x3f71('0x68'):var _0x1d2406=_0x10d5c9[_0x3f71('0x5c')][_0x3f71('0x30')](',')['map'](function(_0x34c094){return Number(_0x34c094);});_0x1d2406[_0x3f71('0x31')](function(_0x16daec){_0x493922['or'](_0x3f71('0x69'),'%,'+_0x16daec+',%');});_0x2209f2=_['union'](_0x2209f2,_0x1d2406);break;case'User':if(_0x10d5c9[_0x3f71('0x61')]==='$substring'){_0x4a0174[_0xb397f7](_0x3f71('0x6a'),'%'+_0x10d5c9[_0x3f71('0x5c')]+'%',null);}else{_0x3ff211=_[_0x3f71('0x5a')](_0x37a4ff,['name',_0x3f71('0x6b')]);_0x10d5c9[_0x3f71('0x42')]=_0x3f71('0x6b');_0x16ba42=as[_0x3f71('0x6c')](_0xe8c7d3,_0x3ff211['type'],_0x10d5c9);_0x4a0174[_0xb397f7](_0x16ba42[_0x3f71('0x66')],_0x16ba42[_0x3f71('0x5c')][_0x3f71('0x67')],_0x16ba42[_0x3f71('0x5c')]['end']);}break;case _0x3f71('0x6d'):_0x16ba42=as['buildExpression']('me',null,_0x10d5c9);_0x4a0174[_0xb397f7](_0x16ba42['text'],_0x16ba42['value']['start'],_0x16ba42[_0x3f71('0x5c')][_0x3f71('0x1c')]);break;}}else{var _0x16ba42=as[_0x3f71('0x6c')](_0xe8c7d3,_0x3ff211['type'],_0x10d5c9);_0x4a0174[_0xb397f7](_0x16ba42[_0x3f71('0x66')],_0x16ba42['value'][_0x3f71('0x67')],_0x16ba42['value'][_0x3f71('0x1c')]);}}}else{var _0x176bd8=_(_0x468ef4[_0x3f71('0x37')])[_0x3f71('0x6e')]()['map'](function(_0x4419e4){return _['some'](_0x37a4ff,[_0x3f71('0x29'),_0x4419e4])?_0x4419e4:undefined;})[_0x3f71('0x6f')]()[_0x3f71('0x5c')]();if(!_[_0x3f71('0x70')](_0x176bd8)){_0x176bd8[_0x3f71('0x31')](function(_0xb106c5){if(_0xb106c5===_0x3f71('0x71')){_0x3a9abd[_0x3f71('0x72')](_0x3f71('0x73'),[][_0x3f71('0x74')](_0x468ef4[_0x3f71('0x37')][_0xb106c5]));}else if(_0xb106c5===_0x3f71('0x75')){var _0x2d9386=JSON['parse'](_0x468ef4[_0x3f71('0x37')][_0xb106c5])[_0x3f71('0x76')];var _0x3c0a64=JSON[_0x3f71('0x77')](_0x468ef4[_0x3f71('0x37')][_0xb106c5])['$lte'];_0x3a9abd[_0x3f71('0x72')](_0x3f71('0x78'),_0x2d9386,_0x3c0a64);}else{if(_0x468ef4[_0x3f71('0x37')][_0xb106c5]==='null'){_0x3a9abd[_0x3f71('0x72')]('i.'+_0xb106c5+_0x3f71('0x79'));}else{_0x3a9abd[_0x3f71('0x72')]('i.'+_0xb106c5+'\x20=\x20?',_0x468ef4[_0x3f71('0x37')][_0xb106c5]);}}});}if(_0x468ef4['query'][_0x3f71('0x7a')]){if(_0x468ef4[_0x3f71('0x37')]['read']==0x1){_0x3a9abd[_0x3f71('0x5e')](_0x3f71('0x7b'));}else{_0x3a9abd[_0x3f71('0x5e')](_0x3f71('0x7c'));}}if(_0x468ef4[_0x3f71('0x37')][_0x3f71('0x7d')]){_0x2209f2=_[_0x3f71('0x7e')](_0x468ef4[_0x3f71('0x37')][_0x3f71('0x7d')])?_0x468ef4[_0x3f71('0x37')]['tag']:new Array(_0x468ef4['query'][_0x3f71('0x7d')]);_0x2209f2['forEach'](function(_0x25bfeb){_0x493922['or'](_0x3f71('0x69'),'%,'+_0x25bfeb+',%');});}if(_0x468ef4[_0x3f71('0x37')]['filter']){var _0x2463b6=_0x468ef4['query'][_0x3f71('0x7f')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2463b6)){_0x4a0174['or'](_0x3f71('0x80'),_0x2463b6+'%')['or'](_0x3f71('0x81'),_0x2463b6+'%');}_0x4a0174['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2463b6+'%');}}_0x3a9abd[_0x3f71('0x72')](_0x4a0174);_0x3a9abd[_0x3f71('0x82')](_0x3f71('0x83'));var _0x530064={'type':db[_0x3f71('0x84')][_0x3f71('0x85')][_0x3f71('0x86')],'raw':!![]};var _0x433925=_0x3a9abd[_0x3f71('0x87')]();_0x433925['field'](_0x3f71('0x83'));_0x433925[_0x3f71('0x42')](_0x3f71('0x88'),_0x3f71('0x5b'));if(_0x68cadb[_0x3f71('0x3e')]){_0x68cadb[_0x3f71('0x3e')][_0x3f71('0x31')](function(_0x55d519){var _0x529166=_0x55d519[0x0]===_0x3f71('0x89')?_0x55d519[0x0]:'i.'+_0x55d519[0x0];_0x3a9abd[_0x3f71('0x3e')](_0x529166,_0x55d519[0x1]===_0x3f71('0x8a')?![]:!![]);});}if(!_[_0x3f71('0x70')](_0x2209f2)){_0x3a9abd[_0x3f71('0x5e')](_0x493922);_0x433925['where'](_0x3f71('0x8b'),_0x2209f2);}BPromise[_0x3f71('0x8c')]()[_0x3f71('0x26')](function(){if(!_0x4de467){if(_0x468ef4[_0x3f71('0x37')][_0x3f71('0x71')])return;_0x433925['where'](_0x3f71('0x8d'));_0x3a9abd[_0x3f71('0x72')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x468ef4[_0x3f71('0x8e')][_0x3f71('0x8f')]!==_0x3f71('0x90'))return;return _0x468ef4[_0x3f71('0x8e')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x3f71('0x26')](function(_0x284360){if(_[_0x3f71('0x70')](_0x284360)){_0x433925['where']('i.FaxAccountId\x20IS\x20NULL');_0x3a9abd[_0x3f71('0x72')](_0x3f71('0x91'));}else{_0x433925[_0x3f71('0x72')]('i.FaxAccountId\x20IN\x20?',_[_0x3f71('0x2c')](_0x284360,'id'));_0x3a9abd[_0x3f71('0x72')]('i.FaxAccountId\x20IN\x20?',_[_0x3f71('0x2c')](_0x284360,'id'));}});})[_0x3f71('0x26')](function(){if(_0x468ef4[_0x3f71('0x8e')]['role']==='agent'&&!_0x4de467&&!_0x468ef4[_0x3f71('0x37')][_0x3f71('0x71')])return[];return db[_0x3f71('0x92')]['query'](_0x433925[_0x3f71('0x93')](),_0x530064);})[_0x3f71('0x26')](function(_0x212d6c){_0x524e8a[_0x3f71('0x1e')]=_0x212d6c[_0x3f71('0x3b')];if(_0x524e8a[_0x3f71('0x1e')]===0x0)return[];return db[_0x3f71('0x92')][_0x3f71('0x37')](_0x4239fa[_0x3f71('0x93')](),_0x530064)[_0x3f71('0x26')](function(_0x27aa25){_0x1da294=_['keyBy'](_0x27aa25,'id');_0x530064=_[_0x3f71('0x94')](_0x530064,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x468ef4[_0x3f71('0x37')][_0x3f71('0x3a')]){_0x68cadb[_0x3f71('0x38')][_0x3f71('0x31')](function(_0x24fea8){_0x3a9abd['field']('i.'+_0x24fea8);});}else{_0x3a9abd[_0x3f71('0x42')](_0x3f71('0x88'),'unreadMessages');_0x3a9abd[_0x3f71('0x42')](_0x3f71('0x95'),'Account.key');_0x3a9abd['field'](_0x3f71('0x96'),'Account.mandatoryDisposition');_0x3a9abd[_0x3f71('0x42')](_0x3f71('0x97'),_0x3f71('0x89'));_0x3a9abd[_0x3f71('0x42')](_0x3f71('0x98'));_0x3a9abd[_0x3f71('0x42')](_0x3f71('0x99'),'Contact.firstName');_0x3a9abd['field'](_0x3f71('0x9a'),_0x3f71('0x9b'));_0x3a9abd[_0x3f71('0x42')](_0x3f71('0x9c'),_0x3f71('0x9d'));_0x3a9abd[_0x3f71('0x42')]('c.phone',_0x3f71('0x9e'));_0x3a9abd['field'](_0x3f71('0x9f'),_0x3f71('0xa0'));_0x3a9abd['field'](_0x3f71('0xa1'),_0x3f71('0xa2'));_0x3a9abd['field']('o.fullname',_0x3f71('0xa3'));_0x3a9abd['field'](_0x3f71('0xa4'),_0x3f71('0xa5'));_0x3a9abd[_0x3f71('0x42')](_0x3f71('0xa6'),_0x3f71('0x2e'));}if(_0x68cadb[_0x3f71('0x20')])_0x3a9abd[_0x3f71('0x20')](_0x68cadb[_0x3f71('0x20')]);if(_0x68cadb[_0x3f71('0x1f')])_0x3a9abd[_0x3f71('0x1f')](_0x68cadb[_0x3f71('0x1f')]);return db[_0x3f71('0x92')][_0x3f71('0x37')](_0x3a9abd[_0x3f71('0x93')](),_0x530064);})['then'](function(_0x2cd500){_0x4fad6b['where'](_0x3f71('0xa7'),_['map'](_0x2cd500,'id'));return db['sequelize'][_0x3f71('0x37')](_0x4fad6b['toString'](),_0x530064)[_0x3f71('0x26')](function(_0x576b48){var _0x22b71=_[_0x3f71('0xa8')](_0x576b48,_0x3f71('0xa9'));var _0x4ddeca=[];_0x2cd500[_0x3f71('0x31')](function(_0x3d3702){_0x4ddeca['push'](updateFaxInteraction(_0x3d3702,_0x1da294,_0x22b71));});return BPromise[_0x3f71('0xaa')](_0x4ddeca);});});})[_0x3f71('0x26')](function(_0x5ad428){_0x524e8a['rows']=_0x5ad428;return _0x524e8a;})['then'](respondWithFilteredResult(_0x133568,_0x68cadb))[_0x3f71('0x32')](handleError(_0x133568,null));};exports[_0x3f71('0xab')]=function(_0x53930e,_0x544430){var _0x23528b={'raw':![],'where':{'id':_0x53930e[_0x3f71('0xac')]['id']}},_0x3497fb={};_0x3497fb[_0x3f71('0x36')]=_[_0x3f71('0x6e')](db[_0x3f71('0x33')][_0x3f71('0xad')]);_0x3497fb[_0x3f71('0x37')]=_[_0x3f71('0x6e')](_0x53930e[_0x3f71('0x37')]);_0x3497fb[_0x3f71('0x3f')]=_[_0x3f71('0x39')](_0x3497fb[_0x3f71('0x36')],_0x3497fb[_0x3f71('0x37')]);_0x23528b[_0x3f71('0x38')]=_[_0x3f71('0x39')](_0x3497fb[_0x3f71('0x36')],qs[_0x3f71('0x3a')](_0x53930e[_0x3f71('0x37')][_0x3f71('0x3a')]));_0x23528b[_0x3f71('0x38')]=_0x23528b[_0x3f71('0x38')][_0x3f71('0x3b')]?_0x23528b[_0x3f71('0x38')]:_0x3497fb[_0x3f71('0x36')];if(_0x53930e[_0x3f71('0x37')][_0x3f71('0xae')]){_0x23528b[_0x3f71('0xaf')]=[{'all':!![]}];}_0x23528b=_[_0x3f71('0x94')]({},_0x23528b,_0x53930e[_0x3f71('0xb0')]);return db[_0x3f71('0x33')][_0x3f71('0x5a')](_0x23528b)[_0x3f71('0x26')](handleEntityNotFound(_0x544430,null))[_0x3f71('0x26')](respondWithResult(_0x544430,null))[_0x3f71('0x32')](handleError(_0x544430,null));};exports[_0x3f71('0xb1')]=function(_0x30e51d,_0x1e957d){return db['FaxInteraction'][_0x3f71('0xb1')](_0x30e51d[_0x3f71('0x6d')],{})[_0x3f71('0x26')](respondWithResult(_0x1e957d,0xc9))['catch'](handleError(_0x1e957d,null));};exports[_0x3f71('0x25')]=function(_0x175c11,_0x2850ca){if(_0x175c11[_0x3f71('0x6d')]['id']){delete _0x175c11[_0x3f71('0x6d')]['id'];}return db[_0x3f71('0x33')][_0x3f71('0x5a')]({'where':{'id':_0x175c11['params']['id']}})[_0x3f71('0x26')](handleEntityNotFound(_0x2850ca,null))[_0x3f71('0x26')](saveUpdates(_0x175c11[_0x3f71('0x6d')],null))[_0x3f71('0x26')](respondWithResult(_0x2850ca,null))[_0x3f71('0x32')](handleError(_0x2850ca,null));};exports[_0x3f71('0x27')]=function(_0x25ee0b,_0x153f8e){return db[_0x3f71('0x33')][_0x3f71('0x5a')]({'where':{'id':_0x25ee0b[_0x3f71('0xac')]['id']}})['then'](handleEntityNotFound(_0x153f8e,null))[_0x3f71('0x26')](removeEntity(_0x153f8e,null))[_0x3f71('0x32')](handleError(_0x153f8e,null));};exports[_0x3f71('0xb2')]=function(_0xeb4ca6,_0x303e9f){return db[_0x3f71('0x33')][_0x3f71('0xb2')]()[_0x3f71('0x26')](respondWithResult(_0x303e9f,null))[_0x3f71('0x32')](handleError(_0x303e9f,null));};exports[_0x3f71('0xb3')]=function(_0x4225a8,_0x102286,_0x514df5){return db['FaxMessage'][_0x3f71('0x5a')]({'where':{'id':_0x4225a8[_0x3f71('0xac')]['id']}})[_0x3f71('0x26')](handleEntityNotFound(_0x102286,null))[_0x3f71('0x26')](function(_0x17a46d){if(_0x17a46d){return _0x17a46d[_0x3f71('0xb3')](_0x4225a8[_0x3f71('0x6d')][_0x3f71('0xb4')],_[_0x3f71('0xb5')](_0x4225a8[_0x3f71('0x6d')],[_0x3f71('0xb4'),'id'])||{});}})[_0x3f71('0x26')](respondWithResult(_0x102286,null))[_0x3f71('0x32')](handleError(_0x102286,null));};exports[_0x3f71('0xb6')]=function(_0x5cc0e7,_0x1f636b,_0x1fc734){var _0x1d9221={'raw':![],'where':{}};var _0x54622e={};var _0x2d8c69={'count':0x0,'rows':[]};return db[_0x3f71('0x33')][_0x3f71('0xb7')]({'where':{'id':_0x5cc0e7['params']['id']}})[_0x3f71('0x26')](handleEntityNotFound(_0x1f636b,null))[_0x3f71('0x26')](function(_0x3cee54){if(_0x3cee54){_0x54622e['model']=_[_0x3f71('0x6e')](db[_0x3f71('0xb8')][_0x3f71('0xad')]);_0x54622e[_0x3f71('0x37')]=_[_0x3f71('0x6e')](_0x5cc0e7[_0x3f71('0x37')]);_0x54622e[_0x3f71('0x3f')]=_['intersection'](_0x54622e[_0x3f71('0x36')],_0x54622e[_0x3f71('0x37')]);_0x1d9221[_0x3f71('0x38')]=_[_0x3f71('0x39')](_0x54622e['model'],qs[_0x3f71('0x3a')](_0x5cc0e7['query'][_0x3f71('0x3a')]));_0x1d9221[_0x3f71('0x38')]=_0x1d9221[_0x3f71('0x38')][_0x3f71('0x3b')]?_0x1d9221[_0x3f71('0x38')]:_0x54622e[_0x3f71('0x36')];if(!_0x5cc0e7[_0x3f71('0x37')][_0x3f71('0x3c')](_0x3f71('0x3d'))){_0x1d9221[_0x3f71('0x20')]=qs[_0x3f71('0x20')](_0x5cc0e7['query']['limit']);_0x1d9221[_0x3f71('0x1f')]=qs[_0x3f71('0x1f')](_0x5cc0e7[_0x3f71('0x37')][_0x3f71('0x1f')]);}_0x1d9221[_0x3f71('0x3e')]=qs[_0x3f71('0xb9')](_0x5cc0e7[_0x3f71('0x37')][_0x3f71('0xb9')]);_0x1d9221[_0x3f71('0x72')]=qs[_0x3f71('0x3f')](_[_0x3f71('0x40')](_0x5cc0e7[_0x3f71('0x37')],_0x54622e[_0x3f71('0x3f')]));_0x1d9221[_0x3f71('0x72')][_0x3f71('0xa9')]=_0x3cee54['id'];if(_0x5cc0e7[_0x3f71('0x37')][_0x3f71('0x7f')]){_0x1d9221[_0x3f71('0x72')]=_[_0x3f71('0x94')](_0x1d9221[_0x3f71('0x72')],{'$or':_[_0x3f71('0x2c')](_0x1d9221[_0x3f71('0x38')],function(_0x266945){var _0x1e266b={};_0x1e266b[_0x266945]={'$like':'%'+_0x5cc0e7[_0x3f71('0x37')][_0x3f71('0x7f')]+'%'};return _0x1e266b;})});}if(_0x5cc0e7[_0x3f71('0x37')][_0x3f71('0x76')]){var _0x10e8d3=_0x5cc0e7[_0x3f71('0x37')][_0x3f71('0x76')][_0x3f71('0x30')](',');var _0x22fa7c={};_0x22fa7c[_0x10e8d3[0x0]]={'$gte':moment(_0x10e8d3[0x1])[_0x3f71('0xba')](_0x3f71('0xbb'))};_0x1d9221[_0x3f71('0x72')]=_[_0x3f71('0x94')](_0x1d9221[_0x3f71('0x72')],_0x22fa7c);}_0x1d9221=_[_0x3f71('0x94')]({},_0x1d9221,_0x5cc0e7[_0x3f71('0xb0')]);return db[_0x3f71('0xb8')][_0x3f71('0x1e')]({'where':_0x1d9221[_0x3f71('0x72')]})[_0x3f71('0x26')](function(_0x3f6528){_0x2d8c69[_0x3f71('0x1e')]=_0x3f6528;if(_0x5cc0e7['query'][_0x3f71('0xae')]){_0x1d9221[_0x3f71('0xaf')]=[{'all':!![]}];}return db['FaxMessage'][_0x3f71('0xbc')](_0x1d9221);})[_0x3f71('0x26')](function(_0x576d55){_0x2d8c69[_0x3f71('0xbd')]=_0x576d55;return _0x2d8c69;});}})[_0x3f71('0x26')](respondWithFilteredResult(_0x1f636b,_0x1d9221))[_0x3f71('0x32')](handleError(_0x1f636b,null));};exports[_0x3f71('0xbe')]=function(_0xcab1fd,_0x5e504b,_0x343485){return db[_0x3f71('0x33')][_0x3f71('0x5a')]({'where':{'id':_0xcab1fd['params']['id']}})['then'](handleEntityNotFound(_0x5e504b,null))[_0x3f71('0x26')](function(_0x217c64){if(_0x217c64){return _0x217c64[_0x3f71('0xbf')](_0xcab1fd[_0x3f71('0x6d')]['ids'],_['omit'](_0xcab1fd[_0x3f71('0x6d')],[_0x3f71('0xb4'),'id'])||{})['spread'](function(){return db['Tag'][_0x3f71('0xbc')]({'attributes':['id','name',_0x3f71('0xc0')],'where':{'id':_0xcab1fd[_0x3f71('0x6d')][_0x3f71('0xb4')]}});})['then'](function(_0x13ceec){socket[_0x3f71('0xc1')](_0x3f71('0xc2'),{'id':Number(_0xcab1fd[_0x3f71('0xac')]['id']),'tags':_0x13ceec||[]});return{'id':Number(_0xcab1fd[_0x3f71('0xac')]['id']),'tags':_0x13ceec||[]};});}})[_0x3f71('0x26')](respondWithResult(_0x5e504b,null))[_0x3f71('0x32')](handleError(_0x5e504b,null));};exports[_0x3f71('0xc3')]=function(_0xcfab5a,_0x478a3d,_0x2b2b43){return db['FaxInteraction'][_0x3f71('0x5a')]({'where':{'id':_0xcfab5a[_0x3f71('0xac')]['id']}})['then'](handleEntityNotFound(_0x478a3d,null))[_0x3f71('0x26')](function(_0x43b755){if(_0x43b755){return _0x43b755['removeTags'](_0xcfab5a['query']['ids']);}})[_0x3f71('0x26')](respondWithStatusCode(_0x478a3d,null))[_0x3f71('0x32')](handleError(_0x478a3d,null));};exports[_0x3f71('0xc4')]=function(_0x3748d2,_0x2dd9a6){var _0x46b194=moment()[_0x3f71('0xc5')]()[_0x3f71('0x93')]();var _0x45f5fe=path[_0x3f71('0xc6')](config[_0x3f71('0xc7')],_0x3f71('0xc8'),_0x3f71('0xc9'),'tmp');var _0x41720c=path[_0x3f71('0xc6')](config['root'],_0x3f71('0xc8'),_0x3f71('0xc9'),'attachments');var _0x596dbf=path[_0x3f71('0xc6')](_0x45f5fe,_0x46b194);var _0x43d860=util['format'](_0x3f71('0xca'),_0x3748d2[_0x3f71('0xac')]['id'],_0x46b194);var _0x5bd95a=path['join'](_0x45f5fe,_0x43d860);var _0x1ff9e2=[];_0x1ff9e2['push']({'model':db[_0x3f71('0xcb')],'as':_0x3f71('0xcb'),'raw':!![]});var _0x59fbd3=[{'model':db['FaxMessage'],'as':_0x3f71('0xcc'),'attributes':['id',_0x3f71('0x6d'),'createdAt'],'include':_0x1ff9e2}];return db['FaxInteraction']['find']({'where':{'id':_0x3748d2[_0x3f71('0xac')]['id']},'include':_0x59fbd3})[_0x3f71('0x26')](handleEntityNotFound(_0x2dd9a6,null))[_0x3f71('0x26')](function(_0x256b42){if(_0x256b42&&_0x256b42['Messages']){var _0x4f3cae=_0x256b42['get']({'plain':!![]});fs['mkdirSync'](_0x596dbf);for(var _0x55f7ea=0x0;_0x55f7ea<_0x4f3cae[_0x3f71('0xcc')][_0x3f71('0x3b')];_0x55f7ea++){var _0x10ffa0=_0x4f3cae[_0x3f71('0xcc')][_0x55f7ea][_0x3f71('0xcb')];if(_0x10ffa0){var _0x51ba05=path[_0x3f71('0xc6')](_0x41720c,_0x10ffa0[_0x3f71('0xcd')]);if(fs['existsSync'](_0x51ba05)){fs[_0x3f71('0xce')](_0x51ba05)[_0x3f71('0xcf')](fs[_0x3f71('0xd0')](path[_0x3f71('0xc6')](_0x596dbf,_0x10ffa0['basename'])));}}}return BPromise[_0x3f71('0x8c')]()[_0x3f71('0x26')](function(){return new BPromise(function(_0x3c60cf,_0x5eda87){zipdir(_0x596dbf,{'saveTo':_0x5bd95a},function(_0x1d10ff,_0x2a4b07){if(_0x1d10ff)return _0x5eda87(_0x1d10ff);return _0x3c60cf(_0x2a4b07);});})[_0x3f71('0x26')](function(){return new BPromise(function(_0x2bca8a,_0x2096cb){rimraf(_0x596dbf,function(_0x4c2723){if(_0x4c2723)_0x2096cb(_0x4c2723);return _0x2bca8a();});});})[_0x3f71('0x26')](function(){return _0x2dd9a6[_0x3f71('0xc4')](_0x5bd95a,_0x43d860,function(_0x3e800d){if(_0x3e800d){console['log'](_0x3f71('0xd1'),_0x3e800d);}else{fs[_0x3f71('0xd2')](_0x5bd95a);}});});});}else{return _0x2dd9a6[_0x3f71('0x1a')](0xc8);}})['catch'](handleError(_0x2dd9a6,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index b82f3f9..d32af65 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 _0xadb5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x279755,_0x45b5c2){var _0x1e2295=function(_0x4129c8){while(--_0x4129c8){_0x279755['push'](_0x279755['shift']());}};_0x1e2295(++_0x45b5c2);}(_0xadb5,0xad));var _0x5adb=function(_0x4a4460,_0x415bbb){_0x4a4460=_0x4a4460-0x0;var _0x42f472=_0xadb5[_0x4a4460];return _0x42f472;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x5adb('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5adb('0x3'),'afterDestroy':_0x5adb('0x4')};function emitEvent(_0x2e3ef4){return function(_0x4cb1d1,_0x35a5d3,_0x168d89){_0x4cb1d1[_0x5adb('0x5')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x6')](function(_0xdf3776){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0x8'),_0xdf3776[_0x5adb('0x9')](function(_0x41261c){return{'id':_0x41261c['id']};}));return FaxMessage[_0x5adb('0xa')]({'where':{'FaxInteractionId':_0x4cb1d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5adb('0x6')](function(_0x336bad){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0xb'),_0x336bad['length']);FaxInteractionEvents['emit'](_0x2e3ef4+':'+_0x4cb1d1['id'],_0x4cb1d1);FaxInteractionEvents[_0x5adb('0xc')](_0x2e3ef4,_0x4cb1d1);_0x168d89(null);})[_0x5adb('0xd')](_0x168d89(null));};}for(var e in events){if(events[_0x5adb('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x5adb('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0x814b=['then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove'];(function(_0x2c06e9,_0x327205){var _0x1e8dd1=function(_0x4e72bb){while(--_0x4e72bb){_0x2c06e9['push'](_0x2c06e9['shift']());}};_0x1e8dd1(++_0x327205);}(_0x814b,0x1a2));var _0xb814=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0x814b[_0x120376];return _0x28c529;};'use strict';var EventEmitter=require(_0xb814('0x0'));var FaxInteraction=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var FaxMessage=require(_0xb814('0x1'))['db'][_0xb814('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb814('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb814('0x5'),'afterDestroy':_0xb814('0x6')};function emitEvent(_0x258866){return function(_0x4237bc,_0x44931c,_0x322a70){_0x4237bc['getUsers']({'attributes':['id'],'raw':!![]})[_0xb814('0x7')](function(_0x2e6272){_0x4237bc['setDataValue'](_0xb814('0x8'),_0x2e6272[_0xb814('0x9')](function(_0x186d5a){return{'id':_0x186d5a['id']};}));return FaxMessage[_0xb814('0xa')]({'where':{'FaxInteractionId':_0x4237bc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb814('0x7')](function(_0x21d4a5){_0x4237bc[_0xb814('0xb')](_0xb814('0xc'),_0x21d4a5[_0xb814('0xd')]);FaxInteractionEvents[_0xb814('0xe')](_0x258866+':'+_0x4237bc['id'],_0x4237bc);FaxInteractionEvents[_0xb814('0xe')](_0x258866,_0x4237bc);_0x322a70(null);})['catch'](_0x322a70(null));};}for(var e in events){if(events[_0xb814('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xb814('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index eb55ba7..dbb4b90 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 _0x231b=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./faxInteraction.attributes','exports','define','fax_interactions','changed','closed','closedAt'];(function(_0x53194b,_0x49ab78){var _0x27bf20=function(_0x44b511){while(--_0x44b511){_0x53194b['push'](_0x53194b['shift']());}};_0x27bf20(++_0x49ab78);}(_0x231b,0x142));var _0xb231=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x231b[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xb231('0x0'));var util=require(_0xb231('0x1'));var logger=require(_0xb231('0x2'))(_0xb231('0x3'));var moment=require(_0xb231('0x4'));var BPromise=require('bluebird');var rp=require(_0xb231('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb231('0x6'));var config=require('../../config/environment');var attributes=require(_0xb231('0x7'));module[_0xb231('0x8')]=function(_0x3639b8,_0x67616d){return _0x3639b8[_0xb231('0x9')]('FaxInteraction',attributes,{'tableName':_0xb231('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x49778d,_0x3ac4ce,_0x1f41b1){if(_0x49778d[_0xb231('0xb')](_0xb231('0xc'))){_0x49778d[_0xb231('0xd')]=moment()[_0xb231('0xe')](_0xb231('0xf'));}_0x1f41b1(null,_0x49778d);}}});}; \ No newline at end of file +var _0xf528=['closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','FaxInteraction','fax_interactions','closed'];(function(_0x2e4811,_0x5bcd0b){var _0x40ea60=function(_0x2134fb){while(--_0x2134fb){_0x2e4811['push'](_0x2e4811['shift']());}};_0x40ea60(++_0x5bcd0b);}(_0xf528,0xe2));var _0x8f52=function(_0x446c11,_0x825160){_0x446c11=_0x446c11-0x0;var _0x30e5c7=_0xf528[_0x446c11];return _0x30e5c7;};'use strict';var _=require(_0x8f52('0x0'));var util=require('util');var logger=require(_0x8f52('0x1'))(_0x8f52('0x2'));var moment=require(_0x8f52('0x3'));var BPromise=require(_0x8f52('0x4'));var rp=require(_0x8f52('0x5'));var fs=require('fs');var path=require(_0x8f52('0x6'));var rimraf=require('rimraf');var config=require(_0x8f52('0x7'));var attributes=require(_0x8f52('0x8'));module['exports']=function(_0x13ab13,_0x2d9577){return _0x13ab13['define'](_0x8f52('0x9'),attributes,{'tableName':_0x8f52('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x26d7c0,_0x47ff3d,_0x50845c){if(_0x26d7c0['changed'](_0x8f52('0xb'))){_0x26d7c0[_0x8f52('0xc')]=moment()['format'](_0x8f52('0xd'));}_0x50845c(null,_0x26d7c0);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index df44923..f5da8fe 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 _0x7580=['../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','raw','options','attributes','stringify','find','where','addTags','ids','omit','spread','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7580,0x16b));var _0x0758=function(_0x4da28d,_0x46db3c){_0x4da28d=_0x4da28d-0x0;var _0x154348=_0x7580[_0x4da28d];return _0x154348;};'use strict';var _=require('lodash');var util=require(_0x0758('0x0'));var moment=require(_0x0758('0x1'));var BPromise=require('bluebird');var rs=require(_0x0758('0x2'));var fs=require('fs');var Redis=require(_0x0758('0x3'));var db=require(_0x0758('0x4'))['db'];var utils=require(_0x0758('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0758('0x6'));var jayson=require(_0x0758('0x7'));var client=jayson[_0x0758('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x0758('0x9')],{'host':_0x0758('0xa'),'port':0x18eb});var socket=require(_0x0758('0xb'))(new Redis(config[_0x0758('0x9')]));require(_0x0758('0xc'))[_0x0758('0xd')](socket);function respondWithRpcPromise(_0x142773,_0x70d6da,_0x65a319){return new BPromise(function(_0x1bdebe,_0x15cd62){return client[_0x0758('0xe')](_0x142773,_0x65a319)[_0x0758('0xf')](function(_0x1b556f){logger[_0x0758('0x10')](_0x0758('0x11'),_0x70d6da,_0x0758('0x12'));logger[_0x0758('0x13')](_0x0758('0x14'),_0x70d6da,_0x0758('0x12'),JSON['stringify'](_0x1b556f));if(_0x1b556f[_0x0758('0x15')]){if(_0x1b556f[_0x0758('0x15')][_0x0758('0x16')]===0x1f4){logger[_0x0758('0x15')](_0x0758('0x11'),_0x70d6da,_0x1b556f[_0x0758('0x15')][_0x0758('0x17')]);return _0x15cd62(_0x1b556f[_0x0758('0x15')][_0x0758('0x17')]);}logger[_0x0758('0x15')](_0x0758('0x11'),_0x70d6da,_0x1b556f[_0x0758('0x15')][_0x0758('0x17')]);return _0x1bdebe(_0x1b556f[_0x0758('0x15')]['message']);}else{logger[_0x0758('0x10')](_0x0758('0x11'),_0x70d6da,_0x0758('0x12'));_0x1bdebe(_0x1b556f[_0x0758('0x18')][_0x0758('0x17')]);}})[_0x0758('0x19')](function(_0x4f422b){logger[_0x0758('0x15')](_0x0758('0x11'),_0x70d6da,_0x4f422b);_0x15cd62(_0x4f422b);});});}exports[_0x0758('0x1a')]=function(_0x248853){var _0x3baad9=this;return new Promise(function(_0x6c6055,_0x84fadd){return db[_0x0758('0x1b')][_0x0758('0x1c')](_0x248853[_0x0758('0x1d')],{'raw':_0x248853['options']?_0x248853['options'][_0x0758('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x248853[_0x0758('0x1f')]?_0x248853[_0x0758('0x1f')]['where']||null:null,'attributes':_0x248853[_0x0758('0x1f')]?_0x248853[_0x0758('0x1f')][_0x0758('0x20')]||null:null,'limit':_0x248853[_0x0758('0x1f')]?_0x248853[_0x0758('0x1f')]['limit']||null:null})[_0x0758('0xf')](function(_0x366dbf){logger['info'](_0x0758('0x1a'),_0x248853);logger['debug'](_0x0758('0x1a'),_0x248853,JSON[_0x0758('0x21')](_0x366dbf));_0x6c6055(_0x366dbf);})[_0x0758('0x19')](function(_0x1cbf34){logger['error'](_0x0758('0x1a'),_0x1cbf34[_0x0758('0x17')],_0x248853);_0x84fadd(_0x3baad9[_0x0758('0x15')](0x1f4,_0x1cbf34[_0x0758('0x17')]));});});};exports['AddTagsToFaxInteraction']=function(_0x83f410){return new Promise(function(_0x5e5555,_0x5de1ba){return db[_0x0758('0x1b')][_0x0758('0x22')]({'where':_0x83f410['options']?_0x83f410[_0x0758('0x1f')][_0x0758('0x23')]||null:null})[_0x0758('0xf')](function(_0x294f83){if(_0x294f83){return _0x294f83[_0x0758('0x24')](_0x83f410[_0x0758('0x1d')][_0x0758('0x25')],_[_0x0758('0x26')](_0x83f410[_0x0758('0x1d')],[_0x0758('0x25'),'id'])||{});}})[_0x0758('0x27')](function(_0x11e716){logger[_0x0758('0x10')]('AddTags',_0x83f410);logger[_0x0758('0x13')](_0x0758('0x28'),_0x83f410,JSON['stringify'](_0x11e716));_0x5e5555(_0x11e716);})[_0x0758('0x19')](function(_0x236145){logger[_0x0758('0x15')](_0x0758('0x28'),_0x236145['message'],_0x83f410);_0x5de1ba(_this[_0x0758('0x15')](0x1f4,_0x236145[_0x0758('0x17')]));});});}; \ No newline at end of file +var _0xa02e=['body','options','raw','where','limit','find','addTags','omit','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxInteraction','FaxInteraction','update'];(function(_0x21c7e4,_0x2d61be){var _0x310cd2=function(_0x27820b){while(--_0x27820b){_0x21c7e4['push'](_0x21c7e4['shift']());}};_0x310cd2(++_0x2d61be);}(_0xa02e,0x101));var _0xea02=function(_0x18793d,_0x2fb87a){_0x18793d=_0x18793d-0x0;var _0x82106c=_0xa02e[_0x18793d];return _0x82106c;};'use strict';var _=require('lodash');var util=require(_0xea02('0x0'));var moment=require(_0xea02('0x1'));var BPromise=require(_0xea02('0x2'));var rs=require(_0xea02('0x3'));var fs=require('fs');var Redis=require(_0xea02('0x4'));var db=require(_0xea02('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xea02('0x6'))('rpc');var config=require(_0xea02('0x7'));var jayson=require(_0xea02('0x8'));var client=jayson[_0xea02('0x9')][_0xea02('0xa')]({'port':0x232a});config[_0xea02('0xb')]=_['defaults'](config[_0xea02('0xb')],{'host':_0xea02('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xea02('0xb')]));require(_0xea02('0xd'))[_0xea02('0xe')](socket);function respondWithRpcPromise(_0x3d2691,_0x49355b,_0x18fd78){return new BPromise(function(_0x5e15bd,_0x304776){return client[_0xea02('0xf')](_0x3d2691,_0x18fd78)[_0xea02('0x10')](function(_0x3b981f){logger[_0xea02('0x11')](_0xea02('0x12'),_0x49355b,_0xea02('0x13'));logger[_0xea02('0x14')](_0xea02('0x15'),_0x49355b,_0xea02('0x13'),JSON[_0xea02('0x16')](_0x3b981f));if(_0x3b981f[_0xea02('0x17')]){if(_0x3b981f[_0xea02('0x17')]['code']===0x1f4){logger[_0xea02('0x17')](_0xea02('0x12'),_0x49355b,_0x3b981f[_0xea02('0x17')][_0xea02('0x18')]);return _0x304776(_0x3b981f[_0xea02('0x17')][_0xea02('0x18')]);}logger[_0xea02('0x17')](_0xea02('0x12'),_0x49355b,_0x3b981f['error'][_0xea02('0x18')]);return _0x5e15bd(_0x3b981f['error']['message']);}else{logger['info'](_0xea02('0x12'),_0x49355b,_0xea02('0x13'));_0x5e15bd(_0x3b981f[_0xea02('0x19')][_0xea02('0x18')]);}})[_0xea02('0x1a')](function(_0x1aa49b){logger['error'](_0xea02('0x12'),_0x49355b,_0x1aa49b);_0x304776(_0x1aa49b);});});}exports[_0xea02('0x1b')]=function(_0x323776){var _0x4a560d=this;return new Promise(function(_0x54a02a,_0x567406){return db[_0xea02('0x1c')][_0xea02('0x1d')](_0x323776[_0xea02('0x1e')],{'raw':_0x323776[_0xea02('0x1f')]?_0x323776[_0xea02('0x1f')][_0xea02('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x323776[_0xea02('0x1f')]?_0x323776[_0xea02('0x1f')][_0xea02('0x21')]||null:null,'attributes':_0x323776[_0xea02('0x1f')]?_0x323776[_0xea02('0x1f')]['attributes']||null:null,'limit':_0x323776[_0xea02('0x1f')]?_0x323776['options'][_0xea02('0x22')]||null:null})[_0xea02('0x10')](function(_0x37980d){logger[_0xea02('0x11')](_0xea02('0x1b'),_0x323776);logger['debug'](_0xea02('0x1b'),_0x323776,JSON[_0xea02('0x16')](_0x37980d));_0x54a02a(_0x37980d);})['catch'](function(_0x34c112){logger['error'](_0xea02('0x1b'),_0x34c112[_0xea02('0x18')],_0x323776);_0x567406(_0x4a560d[_0xea02('0x17')](0x1f4,_0x34c112[_0xea02('0x18')]));});});};exports['AddTagsToFaxInteraction']=function(_0x13efde){return new Promise(function(_0x509586,_0x59b695){return db[_0xea02('0x1c')][_0xea02('0x23')]({'where':_0x13efde[_0xea02('0x1f')]?_0x13efde[_0xea02('0x1f')][_0xea02('0x21')]||null:null})[_0xea02('0x10')](function(_0x21878e){if(_0x21878e){return _0x21878e[_0xea02('0x24')](_0x13efde[_0xea02('0x1e')]['ids'],_[_0xea02('0x25')](_0x13efde['body'],[_0xea02('0x26'),'id'])||{});}})[_0xea02('0x27')](function(_0x23d68e){logger[_0xea02('0x11')](_0xea02('0x28'),_0x13efde);logger[_0xea02('0x14')](_0xea02('0x28'),_0x13efde,JSON['stringify'](_0x23d68e));_0x509586(_0x23d68e);})['catch'](function(_0x3edd5e){logger['error'](_0xea02('0x28'),_0x3edd5e['message'],_0x13efde);_0x59b695(_this[_0xea02('0x17')](0x1f4,_0x3edd5e[_0xea02('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 8816176..e68769b 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 _0x64fd=['removeListener','length','faxInteraction:','./faxInteraction.events','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x64fd,0x81));var _0xd64f=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x64fd[_0x122096];return _0x3d1966;};'use strict';var FaxInteractionEvents=require(_0xd64f('0x0'));var events=[_0xd64f('0x1'),'remove',_0xd64f('0x2')];function createListener(_0xd53571,_0x4e95fc){return function(_0x572244){_0x4e95fc[_0xd64f('0x3')](_0xd53571,_0x572244);};}function removeListener(_0x5e9b32,_0x26e6b3){return function(){FaxInteractionEvents[_0xd64f('0x4')](_0x5e9b32,_0x26e6b3);};}exports['register']=function(_0x26fba1){for(var _0x3fbaed=0x0,_0x188ef6=events[_0xd64f('0x5')];_0x3fbaed<_0x188ef6;_0x3fbaed++){var _0x14a83f=events[_0x3fbaed];var _0x22f6ae=createListener(_0xd64f('0x6')+_0x14a83f,_0x26fba1);FaxInteractionEvents['on'](_0x14a83f,_0x22f6ae);}}; \ No newline at end of file +var _0xe0a2=['faxInteraction:','./faxInteraction.events','save','update','removeListener','register'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xe0a2,0xdf));var _0x2e0a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe0a2[_0x20a584];return _0x4b41a8;};'use strict';var FaxInteractionEvents=require(_0x2e0a('0x0'));var events=[_0x2e0a('0x1'),'remove',_0x2e0a('0x2')];function createListener(_0x2a80a3,_0x3570da){return function(_0x295aff){_0x3570da['emit'](_0x2a80a3,_0x295aff);};}function removeListener(_0x1b84ce,_0x11ac4d){return function(){FaxInteractionEvents[_0x2e0a('0x3')](_0x1b84ce,_0x11ac4d);};}exports[_0x2e0a('0x4')]=function(_0x5e6349){for(var _0x5e5cd6=0x0,_0x1bf17f=events['length'];_0x5e5cd6<_0x1bf17f;_0x5e5cd6++){var _0x138a92=events[_0x5e5cd6];var _0x4dc385=createListener(_0x2e0a('0x5')+_0x138a92,_0x5e6349);FaxInteractionEvents['on'](_0x138a92,_0x4dc385);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 40cd18c..46d5fde 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 _0xb7e7=['/:id/messages','/:id/download','download','post','create','addMessage','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','tracked','fax','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','express','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','/describe','isAuthenticated','/:id','show'];(function(_0x3307b7,_0x312754){var _0x5b8bf8=function(_0xf4c798){while(--_0xf4c798){_0x3307b7['push'](_0x3307b7['shift']());}};_0x5b8bf8(++_0x312754);}(_0xb7e7,0x121));var _0x7b7e=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xb7e7[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x6')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['getMessages']);router[_0x7b7e('0x6')](_0x7b7e('0xc'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0xe')](_0x7b7e('0xb'),auth['isAuthenticated'](),controller[_0x7b7e('0x10')]);router[_0x7b7e('0xe')]('/:id/tags',auth[_0x7b7e('0x8')](),interaction['tracked']('fax',_0x7b7e('0x11')),controller[_0x7b7e('0x12')]);router[_0x7b7e('0x13')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),interaction['tracked']('fax',_0x7b7e('0x14')),controller[_0x7b7e('0x15')]);router[_0x7b7e('0x16')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),interaction[_0x7b7e('0x17')](_0x7b7e('0x18'),_0x7b7e('0x19')),controller[_0x7b7e('0x1a')]);router[_0x7b7e('0x16')](_0x7b7e('0x1b'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x1c')]);module[_0x7b7e('0x1d')]=router; \ No newline at end of file +var _0xb4e6=['show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','addTags','/:id','faxinteraction:update','update','faxinteraction:destroy','destroy','delete','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x30b71b,_0x40ea0f){var _0x4f0a88=function(_0x30baba){while(--_0x30baba){_0x30b71b['push'](_0x30b71b['shift']());}};_0x4f0a88(++_0x40ea0f);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xb4e6[_0x397cfb];return _0x15fed9;};'use strict';var multer=require(_0x6b4e('0x0'));var util=require('util');var path=require(_0x6b4e('0x1'));var timeout=require(_0x6b4e('0x2'));var express=require(_0x6b4e('0x3'));var router=express[_0x6b4e('0x4')]();var auth=require(_0x6b4e('0x5'));var interaction=require(_0x6b4e('0x6'));var config=require(_0x6b4e('0x7'));var controller=require('./faxInteraction.controller');router[_0x6b4e('0x8')]('/',auth[_0x6b4e('0x9')](),controller[_0x6b4e('0xa')]);router['get'](_0x6b4e('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x6b4e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0x8')](_0x6b4e('0xd'),auth[_0x6b4e('0x9')](),controller[_0x6b4e('0xe')]);router[_0x6b4e('0x8')](_0x6b4e('0xf'),auth['isAuthenticated'](),controller[_0x6b4e('0x10')]);router[_0x6b4e('0x11')]('/',auth['isAuthenticated'](),controller[_0x6b4e('0x12')]);router[_0x6b4e('0x11')](_0x6b4e('0xd'),auth[_0x6b4e('0x9')](),controller[_0x6b4e('0x13')]);router[_0x6b4e('0x11')](_0x6b4e('0x14'),auth['isAuthenticated'](),interaction[_0x6b4e('0x15')](_0x6b4e('0x16'),'faxinteraction:addtags'),controller[_0x6b4e('0x17')]);router['put'](_0x6b4e('0x18'),auth[_0x6b4e('0x9')](),interaction[_0x6b4e('0x15')](_0x6b4e('0x16'),_0x6b4e('0x19')),controller[_0x6b4e('0x1a')]);router['delete']('/:id',auth[_0x6b4e('0x9')](),interaction[_0x6b4e('0x15')](_0x6b4e('0x16'),_0x6b4e('0x1b')),controller[_0x6b4e('0x1c')]);router[_0x6b4e('0x1d')](_0x6b4e('0x14'),auth[_0x6b4e('0x9')](),controller[_0x6b4e('0x1e')]);module[_0x6b4e('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 867ccfb..c1e6118 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 _0x9978=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x1ed58b,_0x127db7){var _0x316cf9=function(_0x2bfc76){while(--_0x2bfc76){_0x1ed58b['push'](_0x1ed58b['shift']());}};_0x316cf9(++_0x127db7);}(_0x9978,0x1d2));var _0x8997=function(_0x36c230,_0x1c7cfd){_0x36c230=_0x36c230-0x0;var _0x321e0e=_0x9978[_0x36c230];return _0x321e0e;};'use strict';var Sequelize=require(_0x8997('0x0'));module[_0x8997('0x1')]={'body':{'type':Sequelize[_0x8997('0x2')](_0x8997('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8997('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8997('0x5')]('in',_0x8997('0x6')),'defaultValue':_0x8997('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x8997('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x8997('0x7')]}}; \ No newline at end of file +var _0x19c8=['BOOLEAN','ENUM','out','DATE','sequelize','TEXT'];(function(_0x20ae13,_0x2a0c8e){var _0x533fd5=function(_0x3bb746){while(--_0x3bb746){_0x20ae13['push'](_0x20ae13['shift']());}};_0x533fd5(++_0x2a0c8e);}(_0x19c8,0x94));var _0x819c=function(_0x44b9a9,_0x3323b2){_0x44b9a9=_0x44b9a9-0x0;var _0x103da4=_0x19c8[_0x44b9a9];return _0x103da4;};'use strict';var Sequelize=require(_0x819c('0x0'));module['exports']={'body':{'type':Sequelize[_0x819c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x819c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x819c('0x3')]('in',_0x819c('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x819c('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x819c('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 019cf4f..7a15a04 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 _0x1c7c=['update','destroy','stack','name','send','index','map','FaxMessage','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','../../config/logger','fax-interactions','accept','fax','body','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','agent','rejectMessage','SIP/%s','rejectmessage','create','CmContact','findOne','ContactId','Attachment','AttachmentId','SendFax','FaxAccountId','basename','download','join','root','server','files','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','FaxMessage,\x20%s,\x20%s','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save'];(function(_0x488ca1,_0xf6858e){var _0x4dd0a4=function(_0x40fb65){while(--_0x40fb65){_0x488ca1['push'](_0x488ca1['shift']());}};_0x4dd0a4(++_0xf6858e);}(_0x1c7c,0x164));var _0xc1c7=function(_0x421313,_0x1ca133){_0x421313=_0x421313-0x0;var _0x2ea4aa=_0x1c7c[_0x421313];return _0x2ea4aa;};'use strict';var pdf=require(_0xc1c7('0x0'));var emlformat=require(_0xc1c7('0x1'));var rimraf=require(_0xc1c7('0x2'));var zipdir=require(_0xc1c7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1c7('0x4'));var moment=require('moment');var BPromise=require(_0xc1c7('0x5'));var Mustache=require(_0xc1c7('0x6'));var util=require(_0xc1c7('0x7'));var path=require(_0xc1c7('0x8'));var sox=require(_0xc1c7('0x9'));var csv=require(_0xc1c7('0xa'));var ejs=require(_0xc1c7('0xb'));var fs=require('fs');var _=require(_0xc1c7('0xc'));var squel=require(_0xc1c7('0xd'));var crypto=require(_0xc1c7('0xe'));var jsforce=require(_0xc1c7('0xf'));var deskjs=require(_0xc1c7('0x10'));var toCsv=require(_0xc1c7('0xa'));var querystring=require(_0xc1c7('0x11'));var Papa=require(_0xc1c7('0x12'));var Redis=require(_0xc1c7('0x13'));var authService=require(_0xc1c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c7('0x15'));var hardwareService=require(_0xc1c7('0x16'));var logger=require('../../config/logger')(_0xc1c7('0x17'));var utils=require(_0xc1c7('0x18'));var config=require(_0xc1c7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1c7('0x1a'))['db'];config[_0xc1c7('0x1b')]=_[_0xc1c7('0x1c')](config[_0xc1c7('0x1b')],{'host':_0xc1c7('0x1d'),'port':0x18eb});var socket=require(_0xc1c7('0x1e'))(new Redis(config[_0xc1c7('0x1b')]));require(_0xc1c7('0x1f'))[_0xc1c7('0x20')](socket);var jayson=require(_0xc1c7('0x21'));var client=jayson[_0xc1c7('0x22')][_0xc1c7('0x23')]({'port':0x232c});var client9002=jayson['client'][_0xc1c7('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x335600,_0x21911c,_0x555b59,_0x94678a){return new BPromise(function(_0x3939c1,_0x1446f3){var _0x39ac54=_0x94678a||client;return _0x39ac54[_0xc1c7('0x24')](_0x335600,_0x555b59)[_0xc1c7('0x25')](function(_0x21758a){logger[_0xc1c7('0x26')]('FaxMessage,\x20%s,\x20%s',_0x21911c,_0xc1c7('0x27'));logger[_0xc1c7('0x28')](_0xc1c7('0x29'),_0x21911c,_0xc1c7('0x27'),JSON['stringify'](_0x21758a));if(_0x21758a[_0xc1c7('0x2a')]){if(_0x21758a['error'][_0xc1c7('0x2b')]===0x1f4){logger[_0xc1c7('0x2a')]('FaxMessage,\x20%s,\x20%s',_0x21911c,_0x21758a['error'][_0xc1c7('0x2c')]);return _0x1446f3(_0x21758a[_0xc1c7('0x2a')][_0xc1c7('0x2c')]);}logger['error'](_0xc1c7('0x2d'),_0x21911c,_0x21758a[_0xc1c7('0x2a')][_0xc1c7('0x2c')]);return _0x3939c1(_0x21758a[_0xc1c7('0x2a')][_0xc1c7('0x2c')]);}else{logger[_0xc1c7('0x26')](_0xc1c7('0x2d'),_0x21911c,_0xc1c7('0x27'));_0x3939c1(_0x21758a[_0xc1c7('0x2e')][_0xc1c7('0x2c')]);}})[_0xc1c7('0x2f')](function(_0x363fbc){logger[_0xc1c7('0x2a')](_0xc1c7('0x2d'),_0x21911c,_0x363fbc);_0x1446f3(_0x363fbc);});});}function respondWithStatusCode(_0xf1c405,_0x21563a){_0x21563a=_0x21563a||0xcc;return function(_0x5edb34){if(_0x5edb34){return _0xf1c405[_0xc1c7('0x30')](_0x21563a);}return _0xf1c405[_0xc1c7('0x31')](_0x21563a)['end']();};}function respondWithResult(_0x52a1d5,_0x352f24){_0x352f24=_0x352f24||0xc8;return function(_0x539931){if(_0x539931){return _0x52a1d5['status'](_0x352f24)[_0xc1c7('0x32')](_0x539931);}};}function respondWithFilteredResult(_0x1b873c,_0x46d045){return function(_0x243450){if(_0x243450){var _0x461360=_0x243450[_0xc1c7('0x33')],_0x4adb81=_0x46d045[_0xc1c7('0x34')],_0x574e1c=_0x46d045[_0xc1c7('0x34')]+_0x46d045[_0xc1c7('0x35')],_0x1b6f97;if(_0x574e1c>=_0x461360){_0x574e1c=_0x461360;_0x1b6f97=0xc8;}else{_0x1b6f97=0xce;}_0x1b873c['status'](_0x1b6f97);return _0x1b873c['set'](_0xc1c7('0x36'),_0x4adb81+'-'+_0x574e1c+'/'+_0x461360)[_0xc1c7('0x32')](_0x243450);}return null;};}function patchUpdates(_0x59170b){return function(_0x41b154){try{jsonpatch[_0xc1c7('0x37')](_0x41b154,_0x59170b,!![]);}catch(_0x39b68c){return BPromise[_0xc1c7('0x38')](_0x39b68c);}return _0x41b154[_0xc1c7('0x39')]();};}function saveUpdates(_0x2d69d3,_0x37533c){return function(_0x598239){if(_0x598239){return _0x598239[_0xc1c7('0x3a')](_0x2d69d3)[_0xc1c7('0x25')](function(_0x21ff91){return _0x21ff91;});}return null;};}function removeEntity(_0x3676ce,_0x712f40){return function(_0x1b713f){if(_0x1b713f){return _0x1b713f[_0xc1c7('0x3b')]()[_0xc1c7('0x25')](function(){_0x3676ce[_0xc1c7('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ba7c1,_0xc58e74){return function(_0x3bd89a){if(!_0x3bd89a){_0x5ba7c1[_0xc1c7('0x30')](0x194);}return _0x3bd89a;};}function handleError(_0x37220f,_0x2a8665){_0x2a8665=_0x2a8665||0x1f4;return function(_0x26f498){logger[_0xc1c7('0x2a')](_0x26f498[_0xc1c7('0x3c')]);if(_0x26f498[_0xc1c7('0x3d')]){delete _0x26f498[_0xc1c7('0x3d')];}_0x37220f[_0xc1c7('0x31')](_0x2a8665)[_0xc1c7('0x3e')](_0x26f498);};}exports[_0xc1c7('0x3f')]=function(_0x3c57d3,_0x43c8c1){var _0x11ce7f={},_0x41a847={},_0x3e4282={'count':0x0,'rows':[]};var _0x2f9e9a=_[_0xc1c7('0x40')](db[_0xc1c7('0x41')]['rawAttributes'],function(_0x568809){return{'name':_0x568809['fieldName'],'type':_0x568809[_0xc1c7('0x42')]['key']};});_0x41a847['model']=_[_0xc1c7('0x40')](_0x2f9e9a,_0xc1c7('0x3d'));_0x41a847[_0xc1c7('0x43')]=_[_0xc1c7('0x44')](_0x3c57d3['query']);_0x41a847[_0xc1c7('0x45')]=_[_0xc1c7('0x46')](_0x41a847[_0xc1c7('0x47')],_0x41a847[_0xc1c7('0x43')]);_0x11ce7f[_0xc1c7('0x48')]=_[_0xc1c7('0x46')](_0x41a847[_0xc1c7('0x47')],qs[_0xc1c7('0x49')](_0x3c57d3[_0xc1c7('0x43')][_0xc1c7('0x49')]));_0x11ce7f[_0xc1c7('0x48')]=_0x11ce7f[_0xc1c7('0x48')][_0xc1c7('0x4a')]?_0x11ce7f['attributes']:_0x41a847[_0xc1c7('0x47')];if(!_0x3c57d3[_0xc1c7('0x43')]['hasOwnProperty'](_0xc1c7('0x4b'))){_0x11ce7f[_0xc1c7('0x35')]=qs[_0xc1c7('0x35')](_0x3c57d3[_0xc1c7('0x43')][_0xc1c7('0x35')]);_0x11ce7f[_0xc1c7('0x34')]=qs[_0xc1c7('0x34')](_0x3c57d3[_0xc1c7('0x43')][_0xc1c7('0x34')]);}_0x11ce7f[_0xc1c7('0x4c')]=qs['sort'](_0x3c57d3[_0xc1c7('0x43')][_0xc1c7('0x4d')]);_0x11ce7f['where']=qs['filters'](_[_0xc1c7('0x4e')](_0x3c57d3[_0xc1c7('0x43')],_0x41a847[_0xc1c7('0x45')]),_0x2f9e9a);if(_0x3c57d3[_0xc1c7('0x43')][_0xc1c7('0x4f')]){_0x11ce7f['where']=_[_0xc1c7('0x50')](_0x11ce7f[_0xc1c7('0x51')],{'$or':_['map'](_0x2f9e9a,function(_0x4fccbf){if(_0x4fccbf['type']!==_0xc1c7('0x52')){var _0x1a9247={};_0x1a9247[_0x4fccbf[_0xc1c7('0x3d')]]={'$like':'%'+_0x3c57d3['query'][_0xc1c7('0x4f')]+'%'};return _0x1a9247;}})});}_0x11ce7f=_[_0xc1c7('0x50')]({},_0x11ce7f,_0x3c57d3['options']);var _0x1b869d={'where':_0x11ce7f[_0xc1c7('0x51')]};return db[_0xc1c7('0x41')][_0xc1c7('0x33')](_0x1b869d)[_0xc1c7('0x25')](function(_0x45bf42){_0x3e4282[_0xc1c7('0x33')]=_0x45bf42;if(_0x3c57d3[_0xc1c7('0x43')][_0xc1c7('0x53')]){_0x11ce7f[_0xc1c7('0x54')]=[{'all':!![]}];}return db[_0xc1c7('0x41')][_0xc1c7('0x55')](_0x11ce7f);})[_0xc1c7('0x25')](function(_0x2ede54){_0x3e4282[_0xc1c7('0x56')]=_0x2ede54;return _0x3e4282;})[_0xc1c7('0x25')](respondWithFilteredResult(_0x43c8c1,_0x11ce7f))[_0xc1c7('0x2f')](handleError(_0x43c8c1,null));};exports[_0xc1c7('0x57')]=function(_0x5da115,_0x42926d){var _0x5b0317={'raw':!![],'where':{'id':_0x5da115[_0xc1c7('0x58')]['id']}},_0x14493b={};_0x14493b[_0xc1c7('0x47')]=_['keys'](db[_0xc1c7('0x41')][_0xc1c7('0x59')]);_0x14493b['query']=_['keys'](_0x5da115['query']);_0x14493b[_0xc1c7('0x45')]=_[_0xc1c7('0x46')](_0x14493b['model'],_0x14493b[_0xc1c7('0x43')]);_0x5b0317[_0xc1c7('0x48')]=_[_0xc1c7('0x46')](_0x14493b[_0xc1c7('0x47')],qs[_0xc1c7('0x49')](_0x5da115[_0xc1c7('0x43')]['fields']));_0x5b0317[_0xc1c7('0x48')]=_0x5b0317['attributes'][_0xc1c7('0x4a')]?_0x5b0317[_0xc1c7('0x48')]:_0x14493b[_0xc1c7('0x47')];if(_0x5da115['query'][_0xc1c7('0x53')]){_0x5b0317[_0xc1c7('0x54')]=[{'all':!![]}];}_0x5b0317=_[_0xc1c7('0x50')]({},_0x5b0317,_0x5da115[_0xc1c7('0x5a')]);return db[_0xc1c7('0x41')][_0xc1c7('0x5b')](_0x5b0317)[_0xc1c7('0x25')](handleEntityNotFound(_0x42926d,null))[_0xc1c7('0x25')](respondWithResult(_0x42926d,null))['catch'](handleError(_0x42926d,null));};exports[_0xc1c7('0x3a')]=function(_0x2a8664,_0x2448e8){if(_0x2a8664['body']['id']){delete _0x2a8664['body']['id'];}return db[_0xc1c7('0x41')][_0xc1c7('0x5b')]({'where':{'id':_0x2a8664[_0xc1c7('0x58')]['id']}})['then'](handleEntityNotFound(_0x2448e8,null))[_0xc1c7('0x25')](saveUpdates(_0x2a8664['body'],null))[_0xc1c7('0x25')](respondWithResult(_0x2448e8,null))[_0xc1c7('0x2f')](handleError(_0x2448e8,null));};exports[_0xc1c7('0x3b')]=function(_0x43dad8,_0x345a46){return db[_0xc1c7('0x41')][_0xc1c7('0x5b')]({'where':{'id':_0x43dad8['params']['id']}})[_0xc1c7('0x25')](handleEntityNotFound(_0x345a46,null))[_0xc1c7('0x25')](removeEntity(_0x345a46,null))[_0xc1c7('0x2f')](handleError(_0x345a46,null));};exports['describe']=function(_0x24fa71,_0x4a450a){return db[_0xc1c7('0x41')]['describe']()[_0xc1c7('0x25')](respondWithResult(_0x4a450a,null))[_0xc1c7('0x2f')](handleError(_0x4a450a,null));};var interaction_log=require(_0xc1c7('0x5c'))(_0xc1c7('0x5d'));exports[_0xc1c7('0x5e')]=function(_0x54e2c4,_0x5405ad,_0x5cc303){var _0xbce766={'agent':{},'channel':_0xc1c7('0x5f')};if(_0x54e2c4[_0xc1c7('0x60')]['id']){delete _0x54e2c4[_0xc1c7('0x60')]['id'];}_0x54e2c4[_0xc1c7('0x60')][_0xc1c7('0x61')]=!![];_0x54e2c4['body'][_0xc1c7('0x62')]=moment()[_0xc1c7('0x63')](_0xc1c7('0x64'));_0x54e2c4[_0xc1c7('0x60')]['UserId']=_0x54e2c4[_0xc1c7('0x60')][_0xc1c7('0x65')]||_0x54e2c4[_0xc1c7('0x66')]['id'];_0xbce766['agent']['id']=_0x54e2c4[_0xc1c7('0x60')][_0xc1c7('0x65')];return db[_0xc1c7('0x41')][_0xc1c7('0x5b')]({'where':{'id':_0x54e2c4['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xc1c7('0x67')}]})[_0xc1c7('0x25')](handleEntityNotFound(_0x5405ad,null))['then'](saveUpdates(_0x54e2c4[_0xc1c7('0x60')],null))[_0xc1c7('0x25')](function(_0x4b27f5){if(_0x4b27f5){_0xbce766[_0xc1c7('0x2c')]=_0x4b27f5[_0xc1c7('0x68')]({'plain':!![]});return db['FaxInteraction'][_0xc1c7('0x5b')]({'where':{'id':_0x4b27f5[_0xc1c7('0x69')]}});}return null;})[_0xc1c7('0x25')](handleEntityNotFound(_0x5405ad,null))[_0xc1c7('0x25')](function(_0x1087b2){if(_0x1087b2){return _0x1087b2[_0xc1c7('0x3a')]({'UserId':_0x54e2c4[_0xc1c7('0x60')][_0xc1c7('0x65')],'read1stAt':_[_0xc1c7('0x6a')](_0x1087b2[_0xc1c7('0x6b')])?moment()[_0xc1c7('0x63')](_0xc1c7('0x64')):undefined});}return null;})[_0xc1c7('0x25')](function(_0x3c9ffe){if(_0x3c9ffe){_0xbce766[_0xc1c7('0x6c')]=_0x3c9ffe[_0xc1c7('0x68')]({'plain':!![]});interaction_log[_0xc1c7('0x26')](_0xc1c7('0x6d'),_0x54e2c4[_0xc1c7('0x66')]['id'],_0x54e2c4[_0xc1c7('0x66')][_0xc1c7('0x3d')],_0x54e2c4[_0xc1c7('0x66')][_0xc1c7('0x6e')],_0xbce766[_0xc1c7('0x6c')]['id'],_0x54e2c4[_0xc1c7('0x60')]?JSON[_0xc1c7('0x6f')](_0x54e2c4[_0xc1c7('0x60')]):_0xc1c7('0x70'));return respondWithRpcPromise('AcceptMessage',_0xc1c7('0x71'),_0xbce766);}return null;})[_0xc1c7('0x25')](function(_0x29067a){if(_0x29067a){if(_0x54e2c4[_0xc1c7('0x60')][_0xc1c7('0x72')]){_0xbce766[_0xc1c7('0x2c')][_0xc1c7('0x73')]=util[_0xc1c7('0x63')]('SIP/%s',_0x54e2c4[_0xc1c7('0x66')][_0xc1c7('0x3d')]);_0xbce766[_0xc1c7('0x2c')][_0xc1c7('0x74')]=_0xbce766[_0xc1c7('0x74')];_0xbce766[_0xc1c7('0x2c')][_0xc1c7('0x75')]=_0xc1c7('0x5e');return respondWithRpcPromise('EventManager',_0xc1c7('0x76'),{'event':_0xc1c7('0x77'),'message':_0xbce766[_0xc1c7('0x2c')]},client9002)[_0xc1c7('0x25')](function(){return _0xbce766;});}return _0xbce766;}return null;})[_0xc1c7('0x25')](respondWithResult(_0x5405ad,null))[_0xc1c7('0x2f')](handleError(_0x5405ad,null));};var interaction_log=require(_0xc1c7('0x5c'))(_0xc1c7('0x5d'));exports[_0xc1c7('0x38')]=function(_0x125270,_0x2ed5de,_0x42247c){var _0x4a3703={'agent':{},'channel':'fax'};if(_0x125270[_0xc1c7('0x60')]['id']){delete _0x125270[_0xc1c7('0x60')]['id'];}_0x125270[_0xc1c7('0x60')][_0xc1c7('0x65')]=_0x125270[_0xc1c7('0x60')][_0xc1c7('0x65')]||_0x125270[_0xc1c7('0x66')]['id'];_0x4a3703[_0xc1c7('0x78')]['id']=_0x125270[_0xc1c7('0x60')][_0xc1c7('0x65')];return db[_0xc1c7('0x41')][_0xc1c7('0x5b')]({'where':{'id':_0x125270[_0xc1c7('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2ed5de,null))[_0xc1c7('0x25')](function(_0x264610){if(_0x264610){_0x4a3703[_0xc1c7('0x2c')]=_0x264610['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x264610[_0xc1c7('0x69')]}});}return null;})[_0xc1c7('0x25')](handleEntityNotFound(_0x2ed5de,null))['then'](function(_0x1f2940){if(_0x1f2940){_0x4a3703[_0xc1c7('0x6c')]=_0x1f2940['get']({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x125270[_0xc1c7('0x66')]['id'],_0x125270['user'][_0xc1c7('0x3d')],_0x125270[_0xc1c7('0x66')][_0xc1c7('0x6e')],_0x4a3703['interaction']['id'],_0x125270[_0xc1c7('0x60')]?JSON['stringify'](_0x125270[_0xc1c7('0x60')]):_0xc1c7('0x70'));return respondWithRpcPromise('RejectMessage',_0xc1c7('0x79'),_0x4a3703);}return null;})[_0xc1c7('0x25')](function(_0x1510cc){if(_0x1510cc){_0x1510cc[_0xc1c7('0x2c')][_0xc1c7('0x73')]=util[_0xc1c7('0x63')](_0xc1c7('0x7a'),_0x125270[_0xc1c7('0x66')][_0xc1c7('0x3d')]);_0x1510cc[_0xc1c7('0x2c')]['channel']=_0x4a3703[_0xc1c7('0x74')];_0x1510cc[_0xc1c7('0x2c')][_0xc1c7('0x75')]=_0xc1c7('0x38');respondWithRpcPromise('EventManager',_0xc1c7('0x76'),{'event':_0xc1c7('0x7b'),'message':_0x1510cc['message']},client9002);return _0x4a3703;}return null;})['then'](respondWithResult(_0x2ed5de,null))[_0xc1c7('0x2f')](handleError(_0x2ed5de,null));};exports[_0xc1c7('0x7c')]=function(_0x313c54,_0x62abc3){var _0x157d40;return db[_0xc1c7('0x41')]['create'](_0x313c54[_0xc1c7('0x60')],{})[_0xc1c7('0x25')](function(_0x5698e9){_0x157d40=_0x5698e9;return db[_0xc1c7('0x7d')][_0xc1c7('0x7e')]({'where':{'id':_0x157d40[_0xc1c7('0x7f')]}});})[_0xc1c7('0x25')](function(_0x2b055c){if(_[_0xc1c7('0x6a')](_0x2b055c)){return;}else{_0x157d40[_0xc1c7('0x5f')]=_0x2b055c[_0xc1c7('0x5f')];return db[_0xc1c7('0x80')][_0xc1c7('0x7e')]({'where':{'id':_0x157d40[_0xc1c7('0x81')]}});}})[_0xc1c7('0x25')](function(_0x33fd7b){return respondWithRpcPromise(_0xc1c7('0x82'),'SendFax',{'FaxAccountId':_[_0xc1c7('0x6a')](_0x313c54[_0xc1c7('0x60')])?undefined:_0x313c54[_0xc1c7('0x60')][_0xc1c7('0x83')],'path':_[_0xc1c7('0x6a')](_0x33fd7b)?undefined:util[_0xc1c7('0x63')]('/var/opt/motion2/server/files/attachments/%s',_0x33fd7b[_0xc1c7('0x84')]),'fax':_[_0xc1c7('0x6a')](_0x157d40['fax'])?undefined:_0x157d40['fax'],'AttachmentId':_0x157d40[_0xc1c7('0x81')]},client9002);})[_0xc1c7('0x25')](respondWithResult(_0x62abc3,0xc9))[_0xc1c7('0x2f')](handleError(_0x62abc3,null));};exports[_0xc1c7('0x85')]=function(_0x259ce1,_0xef5b18){var _0x5258c4=path[_0xc1c7('0x86')](config[_0xc1c7('0x87')],_0xc1c7('0x88'),_0xc1c7('0x89'),'attachments');return db[_0xc1c7('0x41')]['find']({'where':{'id':_0x259ce1[_0xc1c7('0x58')]['id']},'include':[{'model':db['Attachment'],'as':_0xc1c7('0x80')}]})[_0xc1c7('0x25')](handleEntityNotFound(_0xef5b18,null))['then'](function(_0x22f9cf){if(_0x22f9cf){return _0xef5b18[_0xc1c7('0x85')](path[_0xc1c7('0x86')](_0x5258c4,_0x22f9cf[_0xc1c7('0x80')][_0xc1c7('0x84')]));}})[_0xc1c7('0x2f')](handleError(_0xef5b18,null));}; \ No newline at end of file +var _0xeb3b=['SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','join','files','attachments','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','FaxMessage,\x20%s,\x20%s','result','catch','status','end','offset','set','Content-Range','json','apply','reject','save','destroy','sendStatus','stack','name','send','index','FaxMessage','rawAttributes','fieldName','type','key','map','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','keys','length','body','find','params','describe','fax-interactions','accept','read','format','UserId','user','agent','CmContact','Contact','get','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','fax','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','create','Attachment','findOne'];(function(_0x1617fe,_0x2faa0e){var _0x632abf=function(_0x4140dd){while(--_0x4140dd){_0x1617fe['push'](_0x1617fe['shift']());}};_0x632abf(++_0x2faa0e);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x1bf809,_0x536f55){_0x1bf809=_0x1bf809-0x0;var _0x1caa4e=_0xeb3b[_0x1bf809];return _0x1caa4e;};'use strict';var pdf=require(_0xbeb3('0x0'));var emlformat=require(_0xbeb3('0x1'));var rimraf=require(_0xbeb3('0x2'));var zipdir=require(_0xbeb3('0x3'));var jsonpatch=require(_0xbeb3('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbeb3('0x5'));var Mustache=require('mustache');var util=require(_0xbeb3('0x6'));var path=require('path');var sox=require(_0xbeb3('0x7'));var csv=require(_0xbeb3('0x8'));var ejs=require(_0xbeb3('0x9'));var fs=require('fs');var _=require(_0xbeb3('0xa'));var squel=require(_0xbeb3('0xb'));var crypto=require(_0xbeb3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbeb3('0xd'));var toCsv=require(_0xbeb3('0x8'));var querystring=require(_0xbeb3('0xe'));var Papa=require(_0xbeb3('0xf'));var Redis=require(_0xbeb3('0x10'));var authService=require(_0xbeb3('0x11'));var qs=require(_0xbeb3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbeb3('0x13'));var logger=require(_0xbeb3('0x14'))('api');var utils=require(_0xbeb3('0x15'));var config=require(_0xbeb3('0x16'));var licenseUtil=require(_0xbeb3('0x17'));var db=require(_0xbeb3('0x18'))['db'];config[_0xbeb3('0x19')]=_[_0xbeb3('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbeb3('0x1b'))(new Redis(config[_0xbeb3('0x19')]));require('./faxMessage.socket')['register'](socket);var jayson=require(_0xbeb3('0x1c'));var client=jayson[_0xbeb3('0x1d')][_0xbeb3('0x1e')]({'port':0x232c});var client9002=jayson[_0xbeb3('0x1d')][_0xbeb3('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x535836,_0x1aeaee,_0x5970a1,_0x80ef55){return new BPromise(function(_0x4e7d99,_0x4bc8da){var _0x4f8481=_0x80ef55||client;return _0x4f8481[_0xbeb3('0x1f')](_0x535836,_0x5970a1)[_0xbeb3('0x20')](function(_0x32275b){logger[_0xbeb3('0x21')]('FaxMessage,\x20%s,\x20%s',_0x1aeaee,_0xbeb3('0x22'));logger[_0xbeb3('0x23')](_0xbeb3('0x24'),_0x1aeaee,'request\x20sent',JSON['stringify'](_0x32275b));if(_0x32275b[_0xbeb3('0x25')]){if(_0x32275b['error'][_0xbeb3('0x26')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1aeaee,_0x32275b[_0xbeb3('0x25')][_0xbeb3('0x27')]);return _0x4bc8da(_0x32275b[_0xbeb3('0x25')]['message']);}logger[_0xbeb3('0x25')](_0xbeb3('0x28'),_0x1aeaee,_0x32275b['error'][_0xbeb3('0x27')]);return _0x4e7d99(_0x32275b[_0xbeb3('0x25')]['message']);}else{logger[_0xbeb3('0x21')](_0xbeb3('0x28'),_0x1aeaee,_0xbeb3('0x22'));_0x4e7d99(_0x32275b[_0xbeb3('0x29')][_0xbeb3('0x27')]);}})[_0xbeb3('0x2a')](function(_0x84921a){logger[_0xbeb3('0x25')](_0xbeb3('0x28'),_0x1aeaee,_0x84921a);_0x4bc8da(_0x84921a);});});}function respondWithStatusCode(_0x59f27c,_0x4e695e){_0x4e695e=_0x4e695e||0xcc;return function(_0x1f36b9){if(_0x1f36b9){return _0x59f27c['sendStatus'](_0x4e695e);}return _0x59f27c[_0xbeb3('0x2b')](_0x4e695e)[_0xbeb3('0x2c')]();};}function respondWithResult(_0x138adf,_0x400f65){_0x400f65=_0x400f65||0xc8;return function(_0x4fa3c7){if(_0x4fa3c7){return _0x138adf[_0xbeb3('0x2b')](_0x400f65)['json'](_0x4fa3c7);}};}function respondWithFilteredResult(_0x26cd8f,_0xab301c){return function(_0x5bd93d){if(_0x5bd93d){var _0x483198=_0x5bd93d['count'],_0x9b8f13=_0xab301c['offset'],_0x585c6f=_0xab301c[_0xbeb3('0x2d')]+_0xab301c['limit'],_0x51f7ef;if(_0x585c6f>=_0x483198){_0x585c6f=_0x483198;_0x51f7ef=0xc8;}else{_0x51f7ef=0xce;}_0x26cd8f[_0xbeb3('0x2b')](_0x51f7ef);return _0x26cd8f[_0xbeb3('0x2e')](_0xbeb3('0x2f'),_0x9b8f13+'-'+_0x585c6f+'/'+_0x483198)[_0xbeb3('0x30')](_0x5bd93d);}return null;};}function patchUpdates(_0x29e9c2){return function(_0x12f7d4){try{jsonpatch[_0xbeb3('0x31')](_0x12f7d4,_0x29e9c2,!![]);}catch(_0x30fcd4){return BPromise[_0xbeb3('0x32')](_0x30fcd4);}return _0x12f7d4[_0xbeb3('0x33')]();};}function saveUpdates(_0x4ead3b,_0xb829fd){return function(_0x281a7f){if(_0x281a7f){return _0x281a7f['update'](_0x4ead3b)[_0xbeb3('0x20')](function(_0x22c0c0){return _0x22c0c0;});}return null;};}function removeEntity(_0x2bcb46,_0x1230de){return function(_0x4c8682){if(_0x4c8682){return _0x4c8682[_0xbeb3('0x34')]()[_0xbeb3('0x20')](function(){_0x2bcb46[_0xbeb3('0x2b')](0xcc)[_0xbeb3('0x2c')]();});}};}function handleEntityNotFound(_0x212b1d,_0x3f8e35){return function(_0x2e9ade){if(!_0x2e9ade){_0x212b1d[_0xbeb3('0x35')](0x194);}return _0x2e9ade;};}function handleError(_0x3c81e0,_0x4d0cf3){_0x4d0cf3=_0x4d0cf3||0x1f4;return function(_0x106629){logger['error'](_0x106629[_0xbeb3('0x36')]);if(_0x106629[_0xbeb3('0x37')]){delete _0x106629[_0xbeb3('0x37')];}_0x3c81e0[_0xbeb3('0x2b')](_0x4d0cf3)[_0xbeb3('0x38')](_0x106629);};}exports[_0xbeb3('0x39')]=function(_0x75a01,_0x318450){var _0x52a632={},_0x9d078e={},_0x483238={'count':0x0,'rows':[]};var _0x59e6df=_['map'](db[_0xbeb3('0x3a')][_0xbeb3('0x3b')],function(_0x397b68){return{'name':_0x397b68[_0xbeb3('0x3c')],'type':_0x397b68[_0xbeb3('0x3d')][_0xbeb3('0x3e')]};});_0x9d078e['model']=_[_0xbeb3('0x3f')](_0x59e6df,_0xbeb3('0x37'));_0x9d078e[_0xbeb3('0x40')]=_['keys'](_0x75a01['query']);_0x9d078e['filters']=_[_0xbeb3('0x41')](_0x9d078e[_0xbeb3('0x42')],_0x9d078e[_0xbeb3('0x40')]);_0x52a632['attributes']=_[_0xbeb3('0x41')](_0x9d078e['model'],qs[_0xbeb3('0x43')](_0x75a01[_0xbeb3('0x40')][_0xbeb3('0x43')]));_0x52a632[_0xbeb3('0x44')]=_0x52a632['attributes']['length']?_0x52a632[_0xbeb3('0x44')]:_0x9d078e[_0xbeb3('0x42')];if(!_0x75a01[_0xbeb3('0x40')][_0xbeb3('0x45')](_0xbeb3('0x46'))){_0x52a632[_0xbeb3('0x47')]=qs[_0xbeb3('0x47')](_0x75a01[_0xbeb3('0x40')]['limit']);_0x52a632[_0xbeb3('0x2d')]=qs[_0xbeb3('0x2d')](_0x75a01[_0xbeb3('0x40')][_0xbeb3('0x2d')]);}_0x52a632[_0xbeb3('0x48')]=qs[_0xbeb3('0x49')](_0x75a01[_0xbeb3('0x40')]['sort']);_0x52a632[_0xbeb3('0x4a')]=qs[_0xbeb3('0x4b')](_[_0xbeb3('0x4c')](_0x75a01[_0xbeb3('0x40')],_0x9d078e[_0xbeb3('0x4b')]),_0x59e6df);if(_0x75a01[_0xbeb3('0x40')][_0xbeb3('0x4d')]){_0x52a632[_0xbeb3('0x4a')]=_[_0xbeb3('0x4e')](_0x52a632[_0xbeb3('0x4a')],{'$or':_[_0xbeb3('0x3f')](_0x59e6df,function(_0x445e5e){if(_0x445e5e[_0xbeb3('0x3d')]!=='VIRTUAL'){var _0xee04b0={};_0xee04b0[_0x445e5e[_0xbeb3('0x37')]]={'$like':'%'+_0x75a01[_0xbeb3('0x40')]['filter']+'%'};return _0xee04b0;}})});}_0x52a632=_['merge']({},_0x52a632,_0x75a01[_0xbeb3('0x4f')]);var _0x472adf={'where':_0x52a632[_0xbeb3('0x4a')]};return db[_0xbeb3('0x3a')]['count'](_0x472adf)[_0xbeb3('0x20')](function(_0x517ee9){_0x483238['count']=_0x517ee9;if(_0x75a01[_0xbeb3('0x40')][_0xbeb3('0x50')]){_0x52a632[_0xbeb3('0x51')]=[{'all':!![]}];}return db[_0xbeb3('0x3a')]['findAll'](_0x52a632);})[_0xbeb3('0x20')](function(_0x1fe264){_0x483238[_0xbeb3('0x52')]=_0x1fe264;return _0x483238;})['then'](respondWithFilteredResult(_0x318450,_0x52a632))[_0xbeb3('0x2a')](handleError(_0x318450,null));};exports['show']=function(_0x502955,_0x26d128){var _0xf8e19d={'raw':!![],'where':{'id':_0x502955['params']['id']}},_0x15dd16={};_0x15dd16[_0xbeb3('0x42')]=_[_0xbeb3('0x53')](db[_0xbeb3('0x3a')]['rawAttributes']);_0x15dd16[_0xbeb3('0x40')]=_['keys'](_0x502955[_0xbeb3('0x40')]);_0x15dd16['filters']=_[_0xbeb3('0x41')](_0x15dd16[_0xbeb3('0x42')],_0x15dd16[_0xbeb3('0x40')]);_0xf8e19d[_0xbeb3('0x44')]=_[_0xbeb3('0x41')](_0x15dd16[_0xbeb3('0x42')],qs[_0xbeb3('0x43')](_0x502955[_0xbeb3('0x40')]['fields']));_0xf8e19d[_0xbeb3('0x44')]=_0xf8e19d[_0xbeb3('0x44')][_0xbeb3('0x54')]?_0xf8e19d[_0xbeb3('0x44')]:_0x15dd16['model'];if(_0x502955[_0xbeb3('0x40')][_0xbeb3('0x50')]){_0xf8e19d[_0xbeb3('0x51')]=[{'all':!![]}];}_0xf8e19d=_[_0xbeb3('0x4e')]({},_0xf8e19d,_0x502955['options']);return db[_0xbeb3('0x3a')]['find'](_0xf8e19d)[_0xbeb3('0x20')](handleEntityNotFound(_0x26d128,null))[_0xbeb3('0x20')](respondWithResult(_0x26d128,null))[_0xbeb3('0x2a')](handleError(_0x26d128,null));};exports['update']=function(_0x43379e,_0x3e33fe){if(_0x43379e[_0xbeb3('0x55')]['id']){delete _0x43379e[_0xbeb3('0x55')]['id'];}return db[_0xbeb3('0x3a')][_0xbeb3('0x56')]({'where':{'id':_0x43379e[_0xbeb3('0x57')]['id']}})[_0xbeb3('0x20')](handleEntityNotFound(_0x3e33fe,null))[_0xbeb3('0x20')](saveUpdates(_0x43379e[_0xbeb3('0x55')],null))['then'](respondWithResult(_0x3e33fe,null))[_0xbeb3('0x2a')](handleError(_0x3e33fe,null));};exports[_0xbeb3('0x34')]=function(_0x241481,_0x8660b4){return db[_0xbeb3('0x3a')]['find']({'where':{'id':_0x241481['params']['id']}})[_0xbeb3('0x20')](handleEntityNotFound(_0x8660b4,null))[_0xbeb3('0x20')](removeEntity(_0x8660b4,null))['catch'](handleError(_0x8660b4,null));};exports[_0xbeb3('0x58')]=function(_0x405354,_0x2b642d){return db[_0xbeb3('0x3a')][_0xbeb3('0x58')]()[_0xbeb3('0x20')](respondWithResult(_0x2b642d,null))[_0xbeb3('0x2a')](handleError(_0x2b642d,null));};var interaction_log=require('../../config/logger')(_0xbeb3('0x59'));exports[_0xbeb3('0x5a')]=function(_0xad440e,_0x47980d,_0x3863b4){var _0x39a983={'agent':{},'channel':'fax'};if(_0xad440e[_0xbeb3('0x55')]['id']){delete _0xad440e[_0xbeb3('0x55')]['id'];}_0xad440e[_0xbeb3('0x55')][_0xbeb3('0x5b')]=!![];_0xad440e['body']['readAt']=moment()[_0xbeb3('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0xad440e[_0xbeb3('0x55')]['UserId']=_0xad440e[_0xbeb3('0x55')][_0xbeb3('0x5d')]||_0xad440e[_0xbeb3('0x5e')]['id'];_0x39a983[_0xbeb3('0x5f')]['id']=_0xad440e[_0xbeb3('0x55')][_0xbeb3('0x5d')];return db[_0xbeb3('0x3a')][_0xbeb3('0x56')]({'where':{'id':_0xad440e[_0xbeb3('0x57')]['id'],'UserId':null},'include':[{'model':db[_0xbeb3('0x60')],'as':_0xbeb3('0x61')}]})[_0xbeb3('0x20')](handleEntityNotFound(_0x47980d,null))[_0xbeb3('0x20')](saveUpdates(_0xad440e[_0xbeb3('0x55')],null))[_0xbeb3('0x20')](function(_0x33d51d){if(_0x33d51d){_0x39a983[_0xbeb3('0x27')]=_0x33d51d[_0xbeb3('0x62')]({'plain':!![]});return db['FaxInteraction'][_0xbeb3('0x56')]({'where':{'id':_0x33d51d[_0xbeb3('0x63')]}});}return null;})[_0xbeb3('0x20')](handleEntityNotFound(_0x47980d,null))[_0xbeb3('0x20')](function(_0x1dfb62){if(_0x1dfb62){return _0x1dfb62['update']({'UserId':_0xad440e[_0xbeb3('0x55')]['UserId'],'read1stAt':_[_0xbeb3('0x64')](_0x1dfb62[_0xbeb3('0x65')])?moment()[_0xbeb3('0x5c')](_0xbeb3('0x66')):undefined});}return null;})[_0xbeb3('0x20')](function(_0x394524){if(_0x394524){_0x39a983[_0xbeb3('0x67')]=_0x394524[_0xbeb3('0x62')]({'plain':!![]});interaction_log[_0xbeb3('0x21')](_0xbeb3('0x68'),_0xad440e[_0xbeb3('0x5e')]['id'],_0xad440e[_0xbeb3('0x5e')][_0xbeb3('0x37')],_0xad440e[_0xbeb3('0x5e')][_0xbeb3('0x69')],_0x39a983[_0xbeb3('0x67')]['id'],_0xad440e[_0xbeb3('0x55')]?JSON[_0xbeb3('0x6a')](_0xad440e[_0xbeb3('0x55')]):_0xbeb3('0x6b'));return respondWithRpcPromise(_0xbeb3('0x6c'),_0xbeb3('0x6d'),_0x39a983);}return null;})[_0xbeb3('0x20')](function(_0x1ee0f0){if(_0x1ee0f0){if(_0xad440e[_0xbeb3('0x55')][_0xbeb3('0x6e')]){_0x39a983[_0xbeb3('0x27')][_0xbeb3('0x6f')]=util[_0xbeb3('0x5c')](_0xbeb3('0x70'),_0xad440e[_0xbeb3('0x5e')][_0xbeb3('0x37')]);_0x39a983[_0xbeb3('0x27')][_0xbeb3('0x71')]=_0x39a983[_0xbeb3('0x71')];_0x39a983[_0xbeb3('0x27')]['event']=_0xbeb3('0x5a');return respondWithRpcPromise(_0xbeb3('0x72'),'EventManager',{'event':_0xbeb3('0x73'),'message':_0x39a983[_0xbeb3('0x27')]},client9002)[_0xbeb3('0x20')](function(){return _0x39a983;});}return _0x39a983;}return null;})['then'](respondWithResult(_0x47980d,null))['catch'](handleError(_0x47980d,null));};var interaction_log=require(_0xbeb3('0x14'))(_0xbeb3('0x59'));exports[_0xbeb3('0x32')]=function(_0xebc0bc,_0x39ba67,_0x5c9fb4){var _0x27e497={'agent':{},'channel':_0xbeb3('0x74')};if(_0xebc0bc[_0xbeb3('0x55')]['id']){delete _0xebc0bc[_0xbeb3('0x55')]['id'];}_0xebc0bc[_0xbeb3('0x55')]['UserId']=_0xebc0bc[_0xbeb3('0x55')]['UserId']||_0xebc0bc['user']['id'];_0x27e497[_0xbeb3('0x5f')]['id']=_0xebc0bc['body'][_0xbeb3('0x5d')];return db[_0xbeb3('0x3a')][_0xbeb3('0x56')]({'where':{'id':_0xebc0bc[_0xbeb3('0x57')]['id'],'UserId':null}})[_0xbeb3('0x20')](handleEntityNotFound(_0x39ba67,null))[_0xbeb3('0x20')](function(_0x942394){if(_0x942394){_0x27e497['message']=_0x942394[_0xbeb3('0x62')]({'plain':!![]});return db[_0xbeb3('0x75')][_0xbeb3('0x56')]({'where':{'id':_0x942394['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x39ba67,null))[_0xbeb3('0x20')](function(_0x48da15){if(_0x48da15){_0x27e497['interaction']=_0x48da15['get']({'plain':!![]});interaction_log[_0xbeb3('0x21')](_0xbeb3('0x76'),_0xebc0bc[_0xbeb3('0x5e')]['id'],_0xebc0bc[_0xbeb3('0x5e')]['name'],_0xebc0bc['user'][_0xbeb3('0x69')],_0x27e497[_0xbeb3('0x67')]['id'],_0xebc0bc[_0xbeb3('0x55')]?JSON['stringify'](_0xebc0bc['body']):_0xbeb3('0x6b'));return respondWithRpcPromise(_0xbeb3('0x77'),_0xbeb3('0x78'),_0x27e497);}return null;})[_0xbeb3('0x20')](function(_0x2e4cff){if(_0x2e4cff){_0x2e4cff[_0xbeb3('0x27')][_0xbeb3('0x6f')]=util['format']('SIP/%s',_0xebc0bc[_0xbeb3('0x5e')][_0xbeb3('0x37')]);_0x2e4cff['message']['channel']=_0x27e497[_0xbeb3('0x71')];_0x2e4cff['message'][_0xbeb3('0x79')]=_0xbeb3('0x32');respondWithRpcPromise(_0xbeb3('0x72'),_0xbeb3('0x72'),{'event':_0xbeb3('0x7a'),'message':_0x2e4cff[_0xbeb3('0x27')]},client9002);return _0x27e497;}return null;})[_0xbeb3('0x20')](respondWithResult(_0x39ba67,null))[_0xbeb3('0x2a')](handleError(_0x39ba67,null));};exports[_0xbeb3('0x7b')]=function(_0xaf84a8,_0x154c80){var _0x1f7afa;return db[_0xbeb3('0x3a')][_0xbeb3('0x7b')](_0xaf84a8[_0xbeb3('0x55')],{})[_0xbeb3('0x20')](function(_0x29fd6c){_0x1f7afa=_0x29fd6c;return db[_0xbeb3('0x60')]['findOne']({'where':{'id':_0x1f7afa['ContactId']}});})[_0xbeb3('0x20')](function(_0x157ced){if(_['isNil'](_0x157ced)){return;}else{_0x1f7afa[_0xbeb3('0x74')]=_0x157ced['fax'];return db[_0xbeb3('0x7c')][_0xbeb3('0x7d')]({'where':{'id':_0x1f7afa['AttachmentId']}});}})[_0xbeb3('0x20')](function(_0x2d03be){return respondWithRpcPromise(_0xbeb3('0x7e'),_0xbeb3('0x7e'),{'FaxAccountId':_[_0xbeb3('0x64')](_0xaf84a8[_0xbeb3('0x55')])?undefined:_0xaf84a8[_0xbeb3('0x55')][_0xbeb3('0x7f')],'path':_[_0xbeb3('0x64')](_0x2d03be)?undefined:util[_0xbeb3('0x5c')](_0xbeb3('0x80'),_0x2d03be[_0xbeb3('0x81')]),'fax':_['isNil'](_0x1f7afa[_0xbeb3('0x74')])?undefined:_0x1f7afa[_0xbeb3('0x74')],'AttachmentId':_0x1f7afa[_0xbeb3('0x82')]},client9002);})[_0xbeb3('0x20')](respondWithResult(_0x154c80,0xc9))[_0xbeb3('0x2a')](handleError(_0x154c80,null));};exports['download']=function(_0x129029,_0x157fed){var _0x4a396a=path[_0xbeb3('0x83')](config['root'],'server',_0xbeb3('0x84'),_0xbeb3('0x85'));return db[_0xbeb3('0x3a')]['find']({'where':{'id':_0x129029[_0xbeb3('0x57')]['id']},'include':[{'model':db[_0xbeb3('0x7c')],'as':_0xbeb3('0x7c')}]})['then'](handleEntityNotFound(_0x157fed,null))[_0xbeb3('0x20')](function(_0x2ab119){if(_0x2ab119){return _0x157fed[_0xbeb3('0x86')](path['join'](_0x4a396a,_0x2ab119[_0xbeb3('0x7c')][_0xbeb3('0x81')]));}})[_0xbeb3('0x2a')](handleError(_0x157fed,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 7156414..a0548c5 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 _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update','remove'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x34e8,0x12c));var _0x834e=function(_0x83c7e7,_0x393019){_0x83c7e7=_0x83c7e7-0x0;var _0x501ac3=_0x34e8[_0x83c7e7];return _0x501ac3;};'use strict';var EventEmitter=require(_0x834e('0x0'));var FaxMessage=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){FaxMessageEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);FaxMessageEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','FaxMessage','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x35634f,_0x3d15d9){_0x35634f=_0x35634f-0x0;var _0x5a4a07=_0x3e74[_0x35634f];return _0x5a4a07;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x43e7('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){FaxMessageEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);FaxMessageEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 084f6f4..b9b8d29 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 _0x9b74=['FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','out','UserId','findOne'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x9b74,0xdf));var _0x49b7=function(_0x2a0dd8,_0x28c157){_0x2a0dd8=_0x2a0dd8-0x0;var _0x930eee=_0x9b74[_0x2a0dd8];return _0x930eee;};'use strict';var _=require(_0x49b7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x49b7('0x1'));var moment=require(_0x49b7('0x2'));var BPromise=require(_0x49b7('0x3'));var rp=require(_0x49b7('0x4'));var fs=require('fs');var path=require(_0x49b7('0x5'));var rimraf=require(_0x49b7('0x6'));var config=require('../../config/environment');var attributes=require(_0x49b7('0x7'));module[_0x49b7('0x8')]=function(_0x5551f6,_0x1256d4){return _0x5551f6[_0x49b7('0x9')]('FaxMessage',attributes,{'tableName':_0x49b7('0xa'),'paranoid':![],'indexes':[{'name':_0x49b7('0xb'),'fields':[_0x49b7('0xc')],'type':_0x49b7('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ec980,_0xe63640,_0x5e617a){var _0x482c3d=_0x5551f6[_0x49b7('0xe')];var _0x55fcb4=_0x5ec980['get']({'plain':!![]});if(_0x55fcb4[_0x49b7('0xf')]['toLowerCase']()==='in'||_0x55fcb4[_0x49b7('0xf')][_0x49b7('0x10')]()===_0x49b7('0x11')&&!_0x55fcb4['secret']&&!_['isNil'](_0x55fcb4[_0x49b7('0x12')])){_0x482c3d['FaxInteraction'][_0x49b7('0x13')]({'where':{'id':_0x55fcb4[_0x49b7('0x14')]}})[_0x49b7('0x15')](function(_0x360503){if(_0x360503){_0x360503[_0x49b7('0x16')]({'lastMsgAt':_0x55fcb4[_0x49b7('0x17')],'lastMsgDirection':_0x55fcb4[_0x49b7('0xf')][_0x49b7('0x10')]()});}})[_0x49b7('0x18')](function(_0x54725b){console[_0x49b7('0x19')](_0x54725b);});}_0x5e617a();}},'charset':_0x49b7('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x71ed=['UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x71ed,0x132));var _0xd71e=function(_0x118dfd,_0x31cb8f){_0x118dfd=_0x118dfd-0x0;var _0x473376=_0x71ed[_0x118dfd];return _0x473376;};'use strict';var _=require('lodash');var util=require(_0xd71e('0x0'));var logger=require(_0xd71e('0x1'))(_0xd71e('0x2'));var moment=require(_0xd71e('0x3'));var BPromise=require(_0xd71e('0x4'));var rp=require(_0xd71e('0x5'));var fs=require('fs');var path=require(_0xd71e('0x6'));var rimraf=require(_0xd71e('0x7'));var config=require(_0xd71e('0x8'));var attributes=require(_0xd71e('0x9'));module[_0xd71e('0xa')]=function(_0x294a03,_0x4eec0a){return _0x294a03[_0xd71e('0xb')](_0xd71e('0xc'),attributes,{'tableName':_0xd71e('0xd'),'paranoid':![],'indexes':[{'name':_0xd71e('0xe'),'fields':[_0xd71e('0xf')],'type':_0xd71e('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x80da52,_0x3ddef8,_0x2b2a19){var _0xffb58f=_0x294a03[_0xd71e('0x11')];var _0x4fc05a=_0x80da52[_0xd71e('0x12')]({'plain':!![]});if(_0x4fc05a[_0xd71e('0x13')][_0xd71e('0x14')]()==='in'||_0x4fc05a['direction'][_0xd71e('0x14')]()===_0xd71e('0x15')&&!_0x4fc05a[_0xd71e('0x16')]&&!_[_0xd71e('0x17')](_0x4fc05a[_0xd71e('0x18')])){_0xffb58f[_0xd71e('0x19')][_0xd71e('0x1a')]({'where':{'id':_0x4fc05a[_0xd71e('0x1b')]}})['then'](function(_0x3aab3f){if(_0x3aab3f){_0x3aab3f[_0xd71e('0x1c')]({'lastMsgAt':_0x4fc05a[_0xd71e('0x1d')],'lastMsgDirection':_0x4fc05a[_0xd71e('0x13')][_0xd71e('0x14')]()});}})[_0xd71e('0x1e')](function(_0xecc947){console[_0xd71e('0x1f')](_0xecc947);});}_0x2b2a19();}},'charset':'utf8mb4','collate':_0xd71e('0x20')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 02a3e56..75cee50 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 _0x78d6=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxMessage,\x20%s,\x20%s','message','create','options','raw','CreateFaxMessage','catch','update','body','attributes','limit','UpdateFaxMessage','lodash','util'];(function(_0x31eaf5,_0x3206a4){var _0x4a1ddf=function(_0x4de0fc){while(--_0x4de0fc){_0x31eaf5['push'](_0x31eaf5['shift']());}};_0x4a1ddf(++_0x3206a4);}(_0x78d6,0x108));var _0x678d=function(_0x8b7309,_0x17dead){_0x8b7309=_0x8b7309-0x0;var _0x165e56=_0x78d6[_0x8b7309];return _0x165e56;};'use strict';var _=require(_0x678d('0x0'));var util=require(_0x678d('0x1'));var moment=require(_0x678d('0x2'));var BPromise=require(_0x678d('0x3'));var rs=require(_0x678d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x678d('0x5'))['db'];var utils=require(_0x678d('0x6'));var logger=require('../../config/logger')(_0x678d('0x7'));var config=require(_0x678d('0x8'));var jayson=require(_0x678d('0x9'));var client=jayson[_0x678d('0xa')][_0x678d('0xb')]({'port':0x232a});config[_0x678d('0xc')]=_[_0x678d('0xd')](config['redis'],{'host':_0x678d('0xe'),'port':0x18eb});var socket=require(_0x678d('0xf'))(new Redis(config[_0x678d('0xc')]));require(_0x678d('0x10'))[_0x678d('0x11')](socket);function respondWithRpcPromise(_0x3c2a0f,_0x37d162,_0x472783){return new BPromise(function(_0x4815a3,_0x56df90){return client[_0x678d('0x12')](_0x3c2a0f,_0x472783)[_0x678d('0x13')](function(_0x56ecd6){logger[_0x678d('0x14')]('FaxMessage,\x20%s,\x20%s',_0x37d162,'request\x20sent');logger[_0x678d('0x15')](_0x678d('0x16'),_0x37d162,_0x678d('0x17'),JSON[_0x678d('0x18')](_0x56ecd6));if(_0x56ecd6[_0x678d('0x19')]){if(_0x56ecd6[_0x678d('0x19')]['code']===0x1f4){logger['error'](_0x678d('0x1a'),_0x37d162,_0x56ecd6[_0x678d('0x19')]['message']);return _0x56df90(_0x56ecd6[_0x678d('0x19')][_0x678d('0x1b')]);}logger[_0x678d('0x19')](_0x678d('0x1a'),_0x37d162,_0x56ecd6['error'][_0x678d('0x1b')]);return _0x4815a3(_0x56ecd6[_0x678d('0x19')][_0x678d('0x1b')]);}else{logger[_0x678d('0x14')](_0x678d('0x1a'),_0x37d162,'request\x20sent');_0x4815a3(_0x56ecd6['result'][_0x678d('0x1b')]);}})['catch'](function(_0x3e97ca){logger['error'](_0x678d('0x1a'),_0x37d162,_0x3e97ca);_0x56df90(_0x3e97ca);});});}exports['CreateFaxMessage']=function(_0x1c2563){var _0x19b5cf=this;return new Promise(function(_0x4c9b08,_0x51f444){return db['FaxMessage'][_0x678d('0x1c')](_0x1c2563['body'],{'raw':_0x1c2563[_0x678d('0x1d')]?_0x1c2563[_0x678d('0x1d')][_0x678d('0x1e')]===undefined?!![]:![]:!![]})[_0x678d('0x13')](function(_0x146d87){logger[_0x678d('0x14')](_0x678d('0x1f'),_0x1c2563);logger['debug'](_0x678d('0x1f'),_0x1c2563,JSON[_0x678d('0x18')](_0x146d87));_0x4c9b08(_0x146d87);})[_0x678d('0x20')](function(_0x3d0ef5){logger[_0x678d('0x19')](_0x678d('0x1f'),_0x3d0ef5[_0x678d('0x1b')],_0x1c2563);_0x51f444(_0x19b5cf['error'](0x1f4,_0x3d0ef5[_0x678d('0x1b')]));});});};exports['UpdateFaxMessage']=function(_0xfd6d6b){var _0x156c69=this;return new Promise(function(_0x25931d,_0x4470ff){return db['FaxMessage'][_0x678d('0x21')](_0xfd6d6b[_0x678d('0x22')],{'raw':_0xfd6d6b[_0x678d('0x1d')]?_0xfd6d6b[_0x678d('0x1d')][_0x678d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfd6d6b[_0x678d('0x1d')]?_0xfd6d6b['options']['where']||null:null,'attributes':_0xfd6d6b[_0x678d('0x1d')]?_0xfd6d6b['options'][_0x678d('0x23')]||null:null,'limit':_0xfd6d6b[_0x678d('0x1d')]?_0xfd6d6b['options'][_0x678d('0x24')]||null:null})['then'](function(_0x12180c){logger['info'](_0x678d('0x25'),_0xfd6d6b);logger[_0x678d('0x15')]('UpdateFaxMessage',_0xfd6d6b,JSON[_0x678d('0x18')](_0x12180c));_0x25931d(_0x12180c);})[_0x678d('0x20')](function(_0x34fa36){logger[_0x678d('0x19')](_0x678d('0x25'),_0x34fa36['message'],_0xfd6d6b);_0x4470ff(_0x156c69['error'](0x1f4,_0x34fa36[_0x678d('0x1b')]));});});}; \ No newline at end of file +var _0x51f3=['error','code','message','info','CreateFaxMessage','FaxMessage','create','body','options','raw','update','where','attributes','limit','UpdateFaxMessage','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x228c43,_0x1a81d3){var _0x53e5b7=function(_0x246c8c){while(--_0x246c8c){_0x228c43['push'](_0x228c43['shift']());}};_0x53e5b7(++_0x1a81d3);}(_0x51f3,0x121));var _0x351f=function(_0x1d91b7,_0x6115d7){_0x1d91b7=_0x1d91b7-0x0;var _0x2b9c36=_0x51f3[_0x1d91b7];return _0x2b9c36;};'use strict';var _=require(_0x351f('0x0'));var util=require(_0x351f('0x1'));var moment=require(_0x351f('0x2'));var BPromise=require(_0x351f('0x3'));var rs=require(_0x351f('0x4'));var fs=require('fs');var Redis=require(_0x351f('0x5'));var db=require(_0x351f('0x6'))['db'];var utils=require(_0x351f('0x7'));var logger=require('../../config/logger')(_0x351f('0x8'));var config=require('../../config/environment');var jayson=require(_0x351f('0x9'));var client=jayson[_0x351f('0xa')][_0x351f('0xb')]({'port':0x232a});config[_0x351f('0xc')]=_['defaults'](config[_0x351f('0xc')],{'host':_0x351f('0xd'),'port':0x18eb});var socket=require(_0x351f('0xe'))(new Redis(config[_0x351f('0xc')]));require('./faxMessage.socket')[_0x351f('0xf')](socket);function respondWithRpcPromise(_0x34f2c1,_0x42c8b8,_0x4a6ed0){return new BPromise(function(_0x29e9e0,_0x51a492){return client[_0x351f('0x10')](_0x34f2c1,_0x4a6ed0)[_0x351f('0x11')](function(_0x1fd5f0){logger['info'](_0x351f('0x12'),_0x42c8b8,_0x351f('0x13'));logger[_0x351f('0x14')](_0x351f('0x15'),_0x42c8b8,_0x351f('0x13'),JSON[_0x351f('0x16')](_0x1fd5f0));if(_0x1fd5f0[_0x351f('0x17')]){if(_0x1fd5f0[_0x351f('0x17')][_0x351f('0x18')]===0x1f4){logger[_0x351f('0x17')](_0x351f('0x12'),_0x42c8b8,_0x1fd5f0[_0x351f('0x17')][_0x351f('0x19')]);return _0x51a492(_0x1fd5f0['error']['message']);}logger[_0x351f('0x17')](_0x351f('0x12'),_0x42c8b8,_0x1fd5f0[_0x351f('0x17')][_0x351f('0x19')]);return _0x29e9e0(_0x1fd5f0[_0x351f('0x17')][_0x351f('0x19')]);}else{logger[_0x351f('0x1a')](_0x351f('0x12'),_0x42c8b8,_0x351f('0x13'));_0x29e9e0(_0x1fd5f0['result'][_0x351f('0x19')]);}})['catch'](function(_0x19c08b){logger['error'](_0x351f('0x12'),_0x42c8b8,_0x19c08b);_0x51a492(_0x19c08b);});});}exports[_0x351f('0x1b')]=function(_0x3b8fcf){var _0x351cfd=this;return new Promise(function(_0x5f1fe1,_0x374c4f){return db[_0x351f('0x1c')][_0x351f('0x1d')](_0x3b8fcf[_0x351f('0x1e')],{'raw':_0x3b8fcf[_0x351f('0x1f')]?_0x3b8fcf[_0x351f('0x1f')][_0x351f('0x20')]===undefined?!![]:![]:!![]})[_0x351f('0x11')](function(_0x5e4250){logger['info'](_0x351f('0x1b'),_0x3b8fcf);logger[_0x351f('0x14')](_0x351f('0x1b'),_0x3b8fcf,JSON[_0x351f('0x16')](_0x5e4250));_0x5f1fe1(_0x5e4250);})['catch'](function(_0x2bf705){logger[_0x351f('0x17')](_0x351f('0x1b'),_0x2bf705[_0x351f('0x19')],_0x3b8fcf);_0x374c4f(_0x351cfd[_0x351f('0x17')](0x1f4,_0x2bf705['message']));});});};exports['UpdateFaxMessage']=function(_0x355da7){var _0x441e2e=this;return new Promise(function(_0x4fcf3e,_0x2beaad){return db['FaxMessage'][_0x351f('0x21')](_0x355da7[_0x351f('0x1e')],{'raw':_0x355da7[_0x351f('0x1f')]?_0x355da7[_0x351f('0x1f')][_0x351f('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x355da7[_0x351f('0x1f')]?_0x355da7[_0x351f('0x1f')][_0x351f('0x22')]||null:null,'attributes':_0x355da7[_0x351f('0x1f')]?_0x355da7[_0x351f('0x1f')][_0x351f('0x23')]||null:null,'limit':_0x355da7[_0x351f('0x1f')]?_0x355da7[_0x351f('0x1f')][_0x351f('0x24')]||null:null})['then'](function(_0x679b0d){logger[_0x351f('0x1a')](_0x351f('0x25'),_0x355da7);logger[_0x351f('0x14')](_0x351f('0x25'),_0x355da7,JSON[_0x351f('0x16')](_0x679b0d));_0x4fcf3e(_0x679b0d);})[_0x351f('0x26')](function(_0x7e1a6){logger[_0x351f('0x17')](_0x351f('0x25'),_0x7e1a6['message'],_0x355da7);_0x2beaad(_0x441e2e[_0x351f('0x17')](0x1f4,_0x7e1a6[_0x351f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 29e94ac..c3cda3e 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 _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x5ce8b9,_0x5cded8){var _0xe34be0=function(_0xe3d4e5){while(--_0xe3d4e5){_0x5ce8b9['push'](_0x5ce8b9['shift']());}};_0xe34be0(++_0x5cded8);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 79c5bd2..03c01e6 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 _0xde6c=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/download','post','tracked','fax','faxmessage:create','put','update','accept','delete'];(function(_0x549bf0,_0x545544){var _0x583eca=function(_0x2f5ebc){while(--_0x2f5ebc){_0x549bf0['push'](_0x549bf0['shift']());}};_0x583eca(++_0x545544);}(_0xde6c,0xa4));var _0xcde6=function(_0x12b756,_0x43f6f3){_0x12b756=_0x12b756-0x0;var _0x40cc2e=_0xde6c[_0x12b756];return _0x40cc2e;};'use strict';var multer=require(_0xcde6('0x0'));var util=require(_0xcde6('0x1'));var path=require(_0xcde6('0x2'));var timeout=require(_0xcde6('0x3'));var express=require('express');var router=express[_0xcde6('0x4')]();var auth=require(_0xcde6('0x5'));var interaction=require(_0xcde6('0x6'));var config=require(_0xcde6('0x7'));var controller=require(_0xcde6('0x8'));router[_0xcde6('0x9')]('/',auth['isAuthenticated'](),controller[_0xcde6('0xa')]);router[_0xcde6('0x9')](_0xcde6('0xb'),auth['isAuthenticated'](),controller[_0xcde6('0xc')]);router[_0xcde6('0x9')](_0xcde6('0xd'),auth[_0xcde6('0xe')](),controller[_0xcde6('0xf')]);router[_0xcde6('0x9')](_0xcde6('0x10'),auth[_0xcde6('0xe')](),controller['download']);router[_0xcde6('0x11')]('/',auth[_0xcde6('0xe')](),interaction[_0xcde6('0x12')](_0xcde6('0x13'),_0xcde6('0x14')),controller['create']);router[_0xcde6('0x15')](_0xcde6('0xd'),auth[_0xcde6('0xe')](),controller[_0xcde6('0x16')]);router[_0xcde6('0x15')]('/:id/accept',auth[_0xcde6('0xe')](),controller[_0xcde6('0x17')]);router[_0xcde6('0x15')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0xcde6('0x18')](_0xcde6('0xd'),auth[_0xcde6('0xe')](),controller[_0xcde6('0x19')]);module[_0xcde6('0x1a')]=router; \ No newline at end of file +var _0x87b1=['isAuthenticated','index','/describe','/:id','get','/:id/download','post','tracked','faxmessage:create','create','put','update','accept','reject','delete','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x87b1,0x160));var _0x187b=function(_0xa7783d,_0x425286){_0xa7783d=_0xa7783d-0x0;var _0x5df8fd=_0x87b1[_0xa7783d];return _0x5df8fd;};'use strict';var multer=require(_0x187b('0x0'));var util=require('util');var path=require(_0x187b('0x1'));var timeout=require(_0x187b('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x187b('0x3'));var config=require(_0x187b('0x4'));var controller=require('./faxMessage.controller');router['get']('/',auth[_0x187b('0x5')](),controller[_0x187b('0x6')]);router['get'](_0x187b('0x7'),auth[_0x187b('0x5')](),controller['describe']);router['get'](_0x187b('0x8'),auth[_0x187b('0x5')](),controller['show']);router[_0x187b('0x9')](_0x187b('0xa'),auth[_0x187b('0x5')](),controller['download']);router[_0x187b('0xb')]('/',auth[_0x187b('0x5')](),interaction[_0x187b('0xc')]('fax',_0x187b('0xd')),controller[_0x187b('0xe')]);router[_0x187b('0xf')](_0x187b('0x8'),auth[_0x187b('0x5')](),controller[_0x187b('0x10')]);router[_0x187b('0xf')]('/:id/accept',auth[_0x187b('0x5')](),controller[_0x187b('0x11')]);router['put']('/:id/reject',auth[_0x187b('0x5')](),controller[_0x187b('0x12')]);router[_0x187b('0x13')]('/:id',auth[_0x187b('0x5')](),controller['destroy']);module[_0x187b('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index dcd84e4..fe5ae80 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 _0xf756=['name','STRING','ENUM','rrmemory','roundrobin','INTEGER','sequelize','exports'];(function(_0x258a7c,_0x55f3c8){var _0x573070=function(_0x5881b8){while(--_0x5881b8){_0x258a7c['push'](_0x258a7c['shift']());}};_0x573070(++_0x55f3c8);}(_0xf756,0x1ae));var _0x6f75=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xf756[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x6f75('0x0'));module[_0x6f75('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6f75('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6f75('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6f75('0x4')](_0x6f75('0x5'),'beepall',_0x6f75('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x6f75('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7cca=['exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x4adffe,_0x16819c){var _0x130746=function(_0x5ceba3){while(--_0x5ceba3){_0x4adffe['push'](_0x4adffe['shift']());}};_0x130746(++_0x16819c);}(_0x7cca,0xff));var _0xa7cc=function(_0x36a3b9,_0x299b8e){_0x36a3b9=_0x36a3b9-0x0;var _0x49b6a9=_0x7cca[_0x36a3b9];return _0x49b6a9;};'use strict';var Sequelize=require(_0xa7cc('0x0'));module[_0xa7cc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa7cc('0x2')]},'timeout':{'type':Sequelize[_0xa7cc('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa7cc('0x4')](_0xa7cc('0x5'),_0xa7cc('0x6'),_0xa7cc('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa7cc('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 cdee10c..e3a1a1b 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 _0x3552=['include','findAll','rows','show','params','includeAll','options','find','create','body','user','role','FaxQueues','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserFaxQueue','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','findOne','Team','getTeams','addTeams','ids','User','voicePause','interface','flatMap','Agents','sequelize','transaction','forEach','emit','userFaxQueue:save','removeTeams','select','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','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','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','FaxQueue','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x5920f6,_0x2d3bea){var _0x2782ad=function(_0x6513d3){while(--_0x6513d3){_0x5920f6['push'](_0x5920f6['shift']());}};_0x2782ad(++_0x2d3bea);}(_0x3552,0xd7));var _0x2355=function(_0x419e5c,_0x5f58ae){_0x419e5c=_0x419e5c-0x0;var _0x16136d=_0x3552[_0x419e5c];return _0x16136d;};'use strict';var pdf=require(_0x2355('0x0'));var emlformat=require(_0x2355('0x1'));var rimraf=require(_0x2355('0x2'));var zipdir=require(_0x2355('0x3'));var jsonpatch=require(_0x2355('0x4'));var rp=require(_0x2355('0x5'));var moment=require(_0x2355('0x6'));var BPromise=require(_0x2355('0x7'));var Mustache=require(_0x2355('0x8'));var util=require(_0x2355('0x9'));var path=require(_0x2355('0xa'));var sox=require('sox');var csv=require(_0x2355('0xb'));var ejs=require(_0x2355('0xc'));var fs=require('fs');var _=require(_0x2355('0xd'));var squel=require(_0x2355('0xe'));var crypto=require(_0x2355('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2355('0x10'));var toCsv=require(_0x2355('0xb'));var querystring=require(_0x2355('0x11'));var Papa=require(_0x2355('0x12'));var Redis=require(_0x2355('0x13'));var authService=require(_0x2355('0x14'));var qs=require(_0x2355('0x15'));var as=require(_0x2355('0x16'));var hardwareService=require(_0x2355('0x17'));var logger=require(_0x2355('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x2355('0x19'));var licenseUtil=require(_0x2355('0x1a'));var db=require(_0x2355('0x1b'))['db'];config[_0x2355('0x1c')]=_[_0x2355('0x1d')](config[_0x2355('0x1c')],{'host':_0x2355('0x1e'),'port':0x18eb});var socket=require(_0x2355('0x1f'))(new Redis(config[_0x2355('0x1c')]));require(_0x2355('0x20'))[_0x2355('0x21')](socket);function respondWithStatusCode(_0x4ae627,_0xb43be2){_0xb43be2=_0xb43be2||0xcc;return function(_0x5e6f2e){if(_0x5e6f2e){return _0x4ae627['sendStatus'](_0xb43be2);}return _0x4ae627[_0x2355('0x22')](_0xb43be2)[_0x2355('0x23')]();};}function respondWithResult(_0x47da40,_0x4614df){_0x4614df=_0x4614df||0xc8;return function(_0x4591d9){if(_0x4591d9){return _0x47da40['status'](_0x4614df)[_0x2355('0x24')](_0x4591d9);}};}function respondWithFilteredResult(_0x57abe2,_0x53dc7d){return function(_0x17d2be){if(_0x17d2be){var _0x542f1e=_0x17d2be[_0x2355('0x25')],_0x11b230=_0x53dc7d[_0x2355('0x26')],_0x14b533=_0x53dc7d[_0x2355('0x26')]+_0x53dc7d[_0x2355('0x27')],_0x2840fb;if(_0x14b533>=_0x542f1e){_0x14b533=_0x542f1e;_0x2840fb=0xc8;}else{_0x2840fb=0xce;}_0x57abe2[_0x2355('0x22')](_0x2840fb);return _0x57abe2['set'](_0x2355('0x28'),_0x11b230+'-'+_0x14b533+'/'+_0x542f1e)[_0x2355('0x24')](_0x17d2be);}return null;};}function patchUpdates(_0x33aac4){return function(_0x26dc02){try{jsonpatch[_0x2355('0x29')](_0x26dc02,_0x33aac4,!![]);}catch(_0x7bb55d){return BPromise[_0x2355('0x2a')](_0x7bb55d);}return _0x26dc02['save']();};}function saveUpdates(_0x19352b,_0x1b26cf){return function(_0x418cf4){if(_0x418cf4){return _0x418cf4[_0x2355('0x2b')](_0x19352b)[_0x2355('0x2c')](function(_0xc27726){return _0xc27726;});}return null;};}function removeEntity(_0x4b8673,_0x50baa9){return function(_0x22cdef){if(_0x22cdef){return _0x22cdef[_0x2355('0x2d')]()[_0x2355('0x2c')](function(){var _0x565a73=_0x22cdef[_0x2355('0x2e')]({'plain':!![]});var _0x25942='FaxQueues';return db[_0x2355('0x2f')][_0x2355('0x2d')]({'where':{'type':_0x25942,'resourceId':_0x565a73['id']}})[_0x2355('0x2c')](function(){return _0x22cdef;});})[_0x2355('0x2c')](function(){_0x4b8673[_0x2355('0x22')](0xcc)[_0x2355('0x23')]();});}};}function handleEntityNotFound(_0x1aa22e,_0x2a9cd5){return function(_0x513c69){if(!_0x513c69){_0x1aa22e[_0x2355('0x30')](0x194);}return _0x513c69;};}function handleError(_0xf2eafd,_0x36503e){_0x36503e=_0x36503e||0x1f4;return function(_0x41d275){logger[_0x2355('0x31')](_0x41d275[_0x2355('0x32')]);if(_0x41d275[_0x2355('0x33')]){delete _0x41d275['name'];}_0xf2eafd[_0x2355('0x22')](_0x36503e)[_0x2355('0x34')](_0x41d275);};}exports[_0x2355('0x35')]=function(_0x383c7e,_0x163351){var _0x15a549={},_0x50eae7={},_0x1aaa5={'count':0x0,'rows':[]};var _0xcc240c=_['map'](db[_0x2355('0x36')][_0x2355('0x37')],function(_0x4ce87f){return{'name':_0x4ce87f[_0x2355('0x38')],'type':_0x4ce87f[_0x2355('0x39')][_0x2355('0x3a')]};});_0x50eae7['model']=_[_0x2355('0x3b')](_0xcc240c,'name');_0x50eae7[_0x2355('0x3c')]=_[_0x2355('0x3d')](_0x383c7e[_0x2355('0x3c')]);_0x50eae7[_0x2355('0x3e')]=_[_0x2355('0x3f')](_0x50eae7['model'],_0x50eae7[_0x2355('0x3c')]);_0x15a549[_0x2355('0x40')]=_[_0x2355('0x3f')](_0x50eae7[_0x2355('0x41')],qs[_0x2355('0x42')](_0x383c7e[_0x2355('0x3c')]['fields']));_0x15a549[_0x2355('0x40')]=_0x15a549[_0x2355('0x40')][_0x2355('0x43')]?_0x15a549[_0x2355('0x40')]:_0x50eae7[_0x2355('0x41')];if(!_0x383c7e['query'][_0x2355('0x44')](_0x2355('0x45'))){_0x15a549[_0x2355('0x27')]=qs[_0x2355('0x27')](_0x383c7e[_0x2355('0x3c')][_0x2355('0x27')]);_0x15a549['offset']=qs[_0x2355('0x26')](_0x383c7e[_0x2355('0x3c')][_0x2355('0x26')]);}_0x15a549[_0x2355('0x46')]=qs[_0x2355('0x47')](_0x383c7e[_0x2355('0x3c')][_0x2355('0x47')]);_0x15a549[_0x2355('0x48')]=qs[_0x2355('0x3e')](_[_0x2355('0x49')](_0x383c7e['query'],_0x50eae7[_0x2355('0x3e')]),_0xcc240c);if(_0x383c7e[_0x2355('0x3c')][_0x2355('0x4a')]){_0x15a549['where']=_[_0x2355('0x4b')](_0x15a549[_0x2355('0x48')],{'$or':_['map'](_0xcc240c,function(_0x428170){if(_0x428170[_0x2355('0x39')]!==_0x2355('0x4c')){var _0x5b8f94={};_0x5b8f94[_0x428170['name']]={'$like':'%'+_0x383c7e['query'][_0x2355('0x4a')]+'%'};return _0x5b8f94;}})});}_0x15a549=_['merge']({},_0x15a549,_0x383c7e['options']);var _0x4f502e={'where':_0x15a549[_0x2355('0x48')]};return db['FaxQueue'][_0x2355('0x25')](_0x4f502e)['then'](function(_0x46fda8){_0x1aaa5[_0x2355('0x25')]=_0x46fda8;if(_0x383c7e[_0x2355('0x3c')]['includeAll']){_0x15a549[_0x2355('0x4d')]=[{'all':!![]}];}return db[_0x2355('0x36')][_0x2355('0x4e')](_0x15a549);})[_0x2355('0x2c')](function(_0x409adc){_0x1aaa5[_0x2355('0x4f')]=_0x409adc;return _0x1aaa5;})['then'](respondWithFilteredResult(_0x163351,_0x15a549))['catch'](handleError(_0x163351,null));};exports[_0x2355('0x50')]=function(_0x5326e6,_0x5be0b8){var _0x57d9e0={'raw':!![],'where':{'id':_0x5326e6[_0x2355('0x51')]['id']}},_0x2750e1={};_0x2750e1[_0x2355('0x41')]=_[_0x2355('0x3d')](db[_0x2355('0x36')]['rawAttributes']);_0x2750e1['query']=_['keys'](_0x5326e6[_0x2355('0x3c')]);_0x2750e1[_0x2355('0x3e')]=_[_0x2355('0x3f')](_0x2750e1[_0x2355('0x41')],_0x2750e1[_0x2355('0x3c')]);_0x57d9e0[_0x2355('0x40')]=_[_0x2355('0x3f')](_0x2750e1['model'],qs[_0x2355('0x42')](_0x5326e6[_0x2355('0x3c')][_0x2355('0x42')]));_0x57d9e0['attributes']=_0x57d9e0[_0x2355('0x40')][_0x2355('0x43')]?_0x57d9e0[_0x2355('0x40')]:_0x2750e1['model'];if(_0x5326e6['query'][_0x2355('0x52')]){_0x57d9e0[_0x2355('0x4d')]=[{'all':!![]}];}_0x57d9e0=_['merge']({},_0x57d9e0,_0x5326e6[_0x2355('0x53')]);return db[_0x2355('0x36')][_0x2355('0x54')](_0x57d9e0)['then'](handleEntityNotFound(_0x5be0b8,null))[_0x2355('0x2c')](respondWithResult(_0x5be0b8,null))['catch'](handleError(_0x5be0b8,null));};exports['create']=function(_0x54e073,_0x5b7b9f){return db[_0x2355('0x36')][_0x2355('0x55')](_0x54e073[_0x2355('0x56')],{})[_0x2355('0x2c')](function(_0xc68e5f){var _0xe489cb=_0x54e073[_0x2355('0x57')][_0x2355('0x2e')]({'plain':!![]});if(!_0xe489cb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe489cb[_0x2355('0x58')]===_0x2355('0x57')){var _0x346446=_0xc68e5f[_0x2355('0x2e')]({'plain':!![]});var _0x3a77a9=_0x2355('0x59');return db[_0x2355('0x5a')][_0x2355('0x54')]({'where':{'name':_0x3a77a9,'userProfileId':_0xe489cb['userProfileId']},'raw':!![]})[_0x2355('0x2c')](function(_0x2b1895){if(_0x2b1895&&_0x2b1895[_0x2355('0x5b')]===0x0){return db[_0x2355('0x2f')]['create']({'name':_0x346446['name'],'resourceId':_0x346446['id'],'type':_0x2b1895[_0x2355('0x33')],'sectionId':_0x2b1895['id']},{})[_0x2355('0x2c')](function(){return _0xc68e5f;});}else{return _0xc68e5f;}})[_0x2355('0x5c')](function(_0x41bc26){logger[_0x2355('0x31')](_0x2355('0x5d'),_0x41bc26);throw _0x41bc26;});}return _0xc68e5f;})[_0x2355('0x2c')](respondWithResult(_0x5b7b9f,0xc9))[_0x2355('0x5c')](handleError(_0x5b7b9f,null));};exports[_0x2355('0x2b')]=function(_0x3f7f72,_0xc3d271){if(_0x3f7f72[_0x2355('0x56')]['id']){delete _0x3f7f72[_0x2355('0x56')]['id'];}return db[_0x2355('0x36')][_0x2355('0x54')]({'where':{'id':_0x3f7f72[_0x2355('0x51')]['id']}})[_0x2355('0x2c')](handleEntityNotFound(_0xc3d271,null))[_0x2355('0x2c')](saveUpdates(_0x3f7f72[_0x2355('0x56')],null))['then'](respondWithResult(_0xc3d271,null))[_0x2355('0x5c')](handleError(_0xc3d271,null));};exports[_0x2355('0x2d')]=function(_0x4a77ab,_0xb7efb9){return db['FaxQueue'][_0x2355('0x54')]({'where':{'id':_0x4a77ab['params']['id']}})['then'](handleEntityNotFound(_0xb7efb9,null))[_0x2355('0x2c')](removeEntity(_0xb7efb9,null))[_0x2355('0x5c')](handleError(_0xb7efb9,null));};exports[_0x2355('0x5e')]=function(_0xae77be,_0x3f3bab){return db['FaxQueue'][_0x2355('0x5e')]()['then'](respondWithResult(_0x3f3bab,null))[_0x2355('0x5c')](handleError(_0x3f3bab,null));};exports[_0x2355('0x5f')]=function(_0x534a86,_0x1045e9,_0x14a55d){var _0x2159a4={'raw':!![],'where':{}},_0x56ba65={},_0x2f2348;return db[_0x2355('0x36')]['findOne']({'where':{'id':_0x534a86[_0x2355('0x51')]['id']}})['then'](handleEntityNotFound(_0x1045e9,null))[_0x2355('0x2c')](function(_0x439108){if(_0x439108){_0x2f2348=_0x439108['get']({'plain':!![]});_0x56ba65[_0x2355('0x41')]=_['keys'](db[_0x2355('0x60')][_0x2355('0x37')]);_0x56ba65[_0x2355('0x3c')]=_['keys'](_0x534a86['query']);_0x56ba65[_0x2355('0x3e')]=_[_0x2355('0x3f')](_0x56ba65[_0x2355('0x41')],_0x56ba65[_0x2355('0x3c')]);_0x2159a4[_0x2355('0x40')]=_[_0x2355('0x3f')](_0x56ba65[_0x2355('0x41')],qs[_0x2355('0x42')](_0x534a86[_0x2355('0x3c')][_0x2355('0x42')]));_0x2159a4[_0x2355('0x40')]=_0x2159a4[_0x2355('0x40')][_0x2355('0x43')]?_0x2159a4[_0x2355('0x40')]:_0x56ba65['model'];if(!_0x534a86[_0x2355('0x3c')][_0x2355('0x44')](_0x2355('0x45'))){_0x2159a4['limit']=qs[_0x2355('0x27')](_0x534a86[_0x2355('0x3c')]['limit']);_0x2159a4[_0x2355('0x26')]=qs[_0x2355('0x26')](_0x534a86[_0x2355('0x3c')][_0x2355('0x26')]);}_0x2159a4[_0x2355('0x46')]=qs[_0x2355('0x47')](_0x534a86[_0x2355('0x3c')][_0x2355('0x47')]);_0x2159a4[_0x2355('0x48')]=qs[_0x2355('0x3e')](_[_0x2355('0x49')](_0x534a86[_0x2355('0x3c')],_0x56ba65[_0x2355('0x3e')]));_0x2159a4[_0x2355('0x48')]['FaxQueueId']=_0x439108['id'];if(_0x534a86[_0x2355('0x3c')][_0x2355('0x4a')]){_0x2159a4[_0x2355('0x48')]=_['merge'](_0x2159a4['where'],{'$or':_[_0x2355('0x3b')](_0x2159a4[_0x2355('0x40')],function(_0x3b44e0){var _0x532921={};_0x532921[_0x3b44e0]={'$like':'%'+_0x534a86[_0x2355('0x3c')][_0x2355('0x4a')]+'%'};return _0x532921;})});}_0x2159a4=_[_0x2355('0x4b')]({},_0x2159a4,_0x534a86[_0x2355('0x53')]);return db[_0x2355('0x60')][_0x2355('0x4e')](_0x2159a4);}})[_0x2355('0x2c')](function(_0x3fd7df){if(_0x3fd7df){return db['User'][_0x2355('0x61')]({'where':{'id':_['map'](_0x3fd7df,_0x2355('0x62')),'role':_0x2355('0x63')},'attributes':['id',_0x2355('0x33'),_0x2355('0x64'),_0x2355('0x65'),_0x2355('0x66')]});}})[_0x2355('0x2c')](function(_0x171624){if(_0x171624){return{'count':_0x171624[_0x2355('0x25')],'rows':_[_0x2355('0x3b')](_0x171624['rows'],function(_0x430ad7){return{'membername':_0x430ad7[_0x2355('0x33')],'UserId':_0x430ad7['id'],'queue_name':_0x2f2348['name'],'FaxQueueId':_0x2f2348['id'],'interface':util[_0x2355('0x67')](_0x2355('0x68'),'SIP',_0x430ad7['name']),'penalty':0x0,'paused':_0x430ad7[_0x2355('0x64')],'createdAt':_0x430ad7[_0x2355('0x66')],'updatedAt':_0x430ad7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x2355('0x2c')](respondWithFilteredResult(_0x1045e9,_0x2159a4))['catch'](handleError(_0x1045e9,null));};exports['getTeams']=function(_0x189161,_0x3a2ab1,_0x8592b3){var _0x2744cc={};var _0x518662={};var _0x2562e6;var _0xe0a251;return db[_0x2355('0x36')][_0x2355('0x69')]({'where':{'id':_0x189161['params']['id']}})['then'](handleEntityNotFound(_0x3a2ab1,null))[_0x2355('0x2c')](function(_0x31fa8e){if(_0x31fa8e){_0x2562e6=_0x31fa8e;_0x518662[_0x2355('0x41')]=_[_0x2355('0x3d')](db[_0x2355('0x6a')][_0x2355('0x37')]);_0x518662[_0x2355('0x3c')]=_[_0x2355('0x3d')](_0x189161[_0x2355('0x3c')]);_0x518662['filters']=_['intersection'](_0x518662['model'],_0x518662[_0x2355('0x3c')]);_0x2744cc[_0x2355('0x40')]=_[_0x2355('0x3f')](_0x518662[_0x2355('0x41')],qs[_0x2355('0x42')](_0x189161[_0x2355('0x3c')][_0x2355('0x42')]));_0x2744cc[_0x2355('0x40')]=_0x2744cc['attributes'][_0x2355('0x43')]?_0x2744cc['attributes']:_0x518662[_0x2355('0x41')];_0x2744cc[_0x2355('0x46')]=qs[_0x2355('0x47')](_0x189161[_0x2355('0x3c')][_0x2355('0x47')]);_0x2744cc['where']=qs[_0x2355('0x3e')](_[_0x2355('0x49')](_0x189161[_0x2355('0x3c')],_0x518662[_0x2355('0x3e')]));if(_0x189161[_0x2355('0x3c')][_0x2355('0x4a')]){_0x2744cc['where']=_['merge'](_0x2744cc['where'],{'$or':_['map'](_0x2744cc['attributes'],function(_0x28830e){var _0xa36cac={};_0xa36cac[_0x28830e]={'$like':'%'+_0x189161['query'][_0x2355('0x4a')]+'%'};return _0xa36cac;})});}_0x2744cc=_[_0x2355('0x4b')]({},_0x2744cc,_0x189161[_0x2355('0x53')]);return _0x2562e6['getTeams'](_0x2744cc);}})[_0x2355('0x2c')](function(_0x4cbbcc){if(_0x4cbbcc){_0xe0a251=_0x4cbbcc[_0x2355('0x43')];if(!_0x189161[_0x2355('0x3c')]['hasOwnProperty'](_0x2355('0x45'))){_0x2744cc[_0x2355('0x27')]=qs[_0x2355('0x27')](_0x189161[_0x2355('0x3c')][_0x2355('0x27')]);_0x2744cc[_0x2355('0x26')]=qs[_0x2355('0x26')](_0x189161['query']['offset']);}return _0x2562e6[_0x2355('0x6b')](_0x2744cc);}})[_0x2355('0x2c')](function(_0x55b4da){if(_0x55b4da){return _0x55b4da?{'count':_0xe0a251,'rows':_0x55b4da}:null;}})[_0x2355('0x2c')](respondWithResult(_0x3a2ab1,null))[_0x2355('0x5c')](handleError(_0x3a2ab1,null));};exports[_0x2355('0x6c')]=function(_0x152ee9,_0x4bf85c,_0x3545bd){var _0x58d042=_0x152ee9[_0x2355('0x56')][_0x2355('0x6d')];return db[_0x2355('0x6a')][_0x2355('0x4e')]({'where':{'id':_0x58d042},'attributes':['id'],'include':[{'model':db[_0x2355('0x6e')],'as':'Agents','attributes':['id',_0x2355('0x33'),'online',_0x2355('0x6f'),_0x2355('0x70')],'raw':!![]}]})[_0x2355('0x2c')](function(_0x57d881){if(_0x57d881){var _0x3b8526=_[_0x2355('0x71')](_0x57d881,function(_0x27795c){var _0x41573c=_0x27795c[_0x2355('0x2e')]({'plain':!![]});return _0x41573c[_0x2355('0x72')];});return db[_0x2355('0x36')][_0x2355('0x54')]({'where':{'id':_0x152ee9['params']['id']}})[_0x2355('0x2c')](function(_0x3199f3){return db[_0x2355('0x73')][_0x2355('0x74')](function(_0x2c0454){return _0x3199f3[_0x2355('0x6c')](_0x58d042,{'transaction':_0x2c0454})[_0x2355('0x2c')](function(){return BPromise['each'](_0x3b8526,function(_0x80305d){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x80305d['id'],'FaxQueueId':_0x152ee9[_0x2355('0x51')]['id']},'transaction':_0x2c0454});});})['then'](function(){_0x3b8526[_0x2355('0x75')](function(_0x5b9286){socket[_0x2355('0x76')](_0x2355('0x77'),{'UserId':_0x5b9286['id'],'FaxQueueId':_0x3199f3['id']});});});});});}})['then'](respondWithStatusCode(_0x4bf85c,null))[_0x2355('0x5c')](handleError(_0x4bf85c,null));};exports[_0x2355('0x78')]=function(_0x2f81c5,_0x3981ac,_0x2a8666){return db[_0x2355('0x6a')]['findAll']({'where':{'id':_0x2f81c5['query'][_0x2355('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x2355('0x6e')],'as':_0x2355('0x72'),'attributes':['id'],'raw':!![]}]})[_0x2355('0x2c')](handleEntityNotFound(_0x3981ac,null))[_0x2355('0x2c')](function(_0xd67c7){var _0x1280a2=_[_0x2355('0x3b')](_0xd67c7,'id');var _0x101e45=[];var _0x467dc9=[];var _0x1d3a95=squel[_0x2355('0x79')]();_0x1d3a95['field']('tq.TeamId')[_0x2355('0x7a')](_0x2355('0x7b'),'tq')[_0x2355('0x7c')](_0x2355('0x7d'),'ut',_0x2355('0x7e'))[_0x2355('0x48')](_0x2355('0x7f'),_0x2f81c5[_0x2355('0x51')]['id']);for(var _0x4ea4e2=0x0;_0x4ea4e2<_0xd67c7['length'];_0x4ea4e2+=0x1){let _0x42b5a4=_0xd67c7[_0x4ea4e2];for(var _0x5bc207=0x0;_0x5bc207<_0x42b5a4['Agents'][_0x2355('0x43')];_0x5bc207+=0x1){let _0x4fb4e9=_0x42b5a4[_0x2355('0x72')][_0x5bc207];var _0x311d52=_0x1d3a95[_0x2355('0x80')]();_0x311d52[_0x2355('0x48')](_0x2355('0x81'),_0x4fb4e9['id']);_0x467dc9[_0x2355('0x82')](db[_0x2355('0x73')][_0x2355('0x3c')](_0x311d52['toString'](),{'type':db[_0x2355('0x73')][_0x2355('0x83')]['SELECT']})[_0x2355('0x2c')](function(_0x37391c){if(_0x37391c[_0x2355('0x43')]===0x1){return _0x4fb4e9['id'];}else{var _0xee465f=_[_0x2355('0x84')](_[_0x2355('0x3b')](_0x37391c,_0x2355('0x85')),function(_0x2b133d){return _['includes'](_0x1280a2,_0x2b133d);});if(_0xee465f){return _0x4fb4e9['id'];}}}));}}return BPromise[_0x2355('0x86')](_0x467dc9)[_0x2355('0x2c')](function(_0x15294b){_0x101e45=_(_0x101e45)[_0x2355('0x87')](_0x15294b)[_0x2355('0x88')]()[_0x2355('0x89')]();return db[_0x2355('0x36')][_0x2355('0x54')]({'where':{'id':_0x2f81c5[_0x2355('0x51')]['id']}})[_0x2355('0x2c')](function(_0x22aaf4){return db[_0x2355('0x73')][_0x2355('0x74')](function(_0x2e35b9){return _0x22aaf4[_0x2355('0x78')](_0x2f81c5['query']['ids'],{'transaction':_0x2e35b9})[_0x2355('0x2c')](function(){if(!_[_0x2355('0x8a')](_0x101e45)){return _0x22aaf4[_0x2355('0x8b')](_0x101e45,{'transaction':_0x2e35b9});}})[_0x2355('0x2c')](function(){_0x101e45[_0x2355('0x75')](function(_0xbfe1c5){socket['emit']('userFaxQueue:remove',{'UserId':_0xbfe1c5,'FaxQueueId':_0x22aaf4['id']});});});});});});})[_0x2355('0x2c')](respondWithStatusCode(_0x3981ac,null))[_0x2355('0x5c')](handleError(_0x3981ac,null));};exports['addAgents']=function(_0x4e7649,_0x56df0e,_0x303c04){return db[_0x2355('0x36')]['find']({'where':{'id':_0x4e7649[_0x2355('0x51')]['id']}})['then'](handleEntityNotFound(_0x56df0e,null))[_0x2355('0x2c')](function(_0x554a62){if(_0x554a62){return _0x554a62[_0x2355('0x8c')](_0x4e7649[_0x2355('0x56')][_0x2355('0x6d')],_[_0x2355('0x8d')](_0x4e7649['body'],['ids','id'])||{})[_0x2355('0x8e')](function(_0x241060){for(var _0xea1070=0x0;_0xea1070<_0x4e7649[_0x2355('0x56')]['ids'][_0x2355('0x43')];_0xea1070+=0x1){socket[_0x2355('0x76')]('userFaxQueue:save',{'UserId':_0x4e7649['body'][_0x2355('0x6d')][_0xea1070],'FaxQueueId':_0x4e7649[_0x2355('0x51')]['id']});}return _0x241060;});}})['then'](respondWithResult(_0x56df0e,null))[_0x2355('0x5c')](handleError(_0x56df0e,null));};exports[_0x2355('0x8b')]=function(_0x1d30f9,_0xc2e612,_0x16e65e){return db['FaxQueue'][_0x2355('0x54')]({'where':{'id':_0x1d30f9['params']['id']}})[_0x2355('0x2c')](handleEntityNotFound(_0xc2e612,null))[_0x2355('0x2c')](function(_0x547851){if(_0x547851){return _0x547851[_0x2355('0x8b')](_0x1d30f9[_0x2355('0x3c')][_0x2355('0x6d')])[_0x2355('0x2c')](function(){if(_[_0x2355('0x8f')](_0x1d30f9[_0x2355('0x3c')][_0x2355('0x6d')])){for(var _0x1bbf0b=0x0;_0x1bbf0b<_0x1d30f9[_0x2355('0x3c')]['ids'][_0x2355('0x43')];_0x1bbf0b+=0x1){socket[_0x2355('0x76')](_0x2355('0x90'),{'UserId':Number(_0x1d30f9['query'][_0x2355('0x6d')][_0x1bbf0b]),'FaxQueueId':Number(_0x1d30f9[_0x2355('0x51')]['id'])});}}else{socket[_0x2355('0x76')](_0x2355('0x90'),{'UserId':Number(_0x1d30f9[_0x2355('0x3c')][_0x2355('0x6d')]),'FaxQueueId':Number(_0x1d30f9['params']['id'])});}});}})['then'](respondWithStatusCode(_0xc2e612,null))[_0x2355('0x5c')](handleError(_0xc2e612,null));};exports[_0x2355('0x91')]=function(_0x3d6731,_0x26ee0b,_0x422dd9){var _0x4e1d75={};var _0x379b1d={};var _0x354d82;var _0xe7d8e6;return db[_0x2355('0x36')][_0x2355('0x69')]({'where':{'id':_0x3d6731[_0x2355('0x51')]['id']}})[_0x2355('0x2c')](handleEntityNotFound(_0x26ee0b,null))[_0x2355('0x2c')](function(_0x2c772a){if(_0x2c772a){_0x354d82=_0x2c772a;_0x379b1d['model']=_[_0x2355('0x3d')](db[_0x2355('0x6e')][_0x2355('0x37')]);_0x379b1d[_0x2355('0x3c')]=_['keys'](_0x3d6731[_0x2355('0x3c')]);_0x379b1d[_0x2355('0x3e')]=_[_0x2355('0x3f')](_0x379b1d['model'],_0x379b1d['query']);_0x4e1d75[_0x2355('0x40')]=_['intersection'](_0x379b1d['model'],qs[_0x2355('0x42')](_0x3d6731[_0x2355('0x3c')]['fields']));_0x4e1d75[_0x2355('0x40')]=_0x4e1d75[_0x2355('0x40')]['length']?_0x4e1d75[_0x2355('0x40')]:_0x379b1d[_0x2355('0x41')];_0x4e1d75[_0x2355('0x46')]=qs[_0x2355('0x47')](_0x3d6731[_0x2355('0x3c')][_0x2355('0x47')]);_0x4e1d75[_0x2355('0x48')]=qs[_0x2355('0x3e')](_['pick'](_0x3d6731['query'],_0x379b1d[_0x2355('0x3e')]));if(_0x3d6731['query']['filter']){_0x4e1d75[_0x2355('0x48')]=_[_0x2355('0x4b')](_0x4e1d75[_0x2355('0x48')],{'$or':_[_0x2355('0x3b')](_0x4e1d75[_0x2355('0x40')],function(_0x549b93){var _0x27a31c={};_0x27a31c[_0x549b93]={'$like':'%'+_0x3d6731[_0x2355('0x3c')][_0x2355('0x4a')]+'%'};return _0x27a31c;})});}_0x4e1d75=_[_0x2355('0x4b')]({},_0x4e1d75,_0x3d6731[_0x2355('0x53')]);return _0x354d82['getAgents'](_0x4e1d75);}})[_0x2355('0x2c')](function(_0x4578dd){if(_0x4578dd){_0xe7d8e6=_0x4578dd[_0x2355('0x43')];if(!_0x3d6731[_0x2355('0x3c')][_0x2355('0x44')](_0x2355('0x45'))){_0x4e1d75[_0x2355('0x27')]=qs[_0x2355('0x27')](_0x3d6731[_0x2355('0x3c')][_0x2355('0x27')]);_0x4e1d75['offset']=qs[_0x2355('0x26')](_0x3d6731[_0x2355('0x3c')]['offset']);}return _0x354d82[_0x2355('0x91')](_0x4e1d75);}})[_0x2355('0x2c')](function(_0x1bfadb){if(_0x1bfadb){return _0x1bfadb?{'count':_0xe7d8e6,'rows':_0x1bfadb}:null;}})[_0x2355('0x2c')](respondWithResult(_0x26ee0b,null))[_0x2355('0x5c')](handleError(_0x26ee0b,null));}; \ No newline at end of file +var _0xd41f=['apply','reject','save','update','then','destroy','FaxQueues','stack','name','index','FaxQueue','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','nolimit','FaxQueueId','findAndCountAll','UserId','faxPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','union','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','api','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','register','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x1ebea6,_0x3db7a9){var _0xeb2f99=function(_0x166a56){while(--_0x166a56){_0x1ebea6['push'](_0x1ebea6['shift']());}};_0xeb2f99(++_0x3db7a9);}(_0xd41f,0xf1));var _0xfd41=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd41f[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfd41('0x0'));var rimraf=require(_0xfd41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd41('0x2'));var rp=require(_0xfd41('0x3'));var moment=require(_0xfd41('0x4'));var BPromise=require(_0xfd41('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xfd41('0x6'));var csv=require('to-csv');var ejs=require(_0xfd41('0x7'));var fs=require('fs');var _=require(_0xfd41('0x8'));var squel=require(_0xfd41('0x9'));var crypto=require(_0xfd41('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfd41('0xb'));var toCsv=require(_0xfd41('0xc'));var querystring=require(_0xfd41('0xd'));var Papa=require('papaparse');var Redis=require(_0xfd41('0xe'));var authService=require(_0xfd41('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfd41('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfd41('0x11'));var db=require(_0xfd41('0x12'))['db'];config['redis']=_[_0xfd41('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfd41('0x14'))(new Redis(config[_0xfd41('0x15')]));require('./faxQueue.socket')[_0xfd41('0x16')](socket);function respondWithStatusCode(_0x1b8dec,_0x9cfbe7){_0x9cfbe7=_0x9cfbe7||0xcc;return function(_0x37c0cd){if(_0x37c0cd){return _0x1b8dec[_0xfd41('0x17')](_0x9cfbe7);}return _0x1b8dec[_0xfd41('0x18')](_0x9cfbe7)[_0xfd41('0x19')]();};}function respondWithResult(_0x4034bf,_0x17a904){_0x17a904=_0x17a904||0xc8;return function(_0x18a783){if(_0x18a783){return _0x4034bf['status'](_0x17a904)[_0xfd41('0x1a')](_0x18a783);}};}function respondWithFilteredResult(_0x3b83a,_0x587316){return function(_0x471da4){if(_0x471da4){var _0x27c002=_0x471da4[_0xfd41('0x1b')],_0x1befad=_0x587316[_0xfd41('0x1c')],_0x47f413=_0x587316[_0xfd41('0x1c')]+_0x587316[_0xfd41('0x1d')],_0x37b630;if(_0x47f413>=_0x27c002){_0x47f413=_0x27c002;_0x37b630=0xc8;}else{_0x37b630=0xce;}_0x3b83a[_0xfd41('0x18')](_0x37b630);return _0x3b83a[_0xfd41('0x1e')]('Content-Range',_0x1befad+'-'+_0x47f413+'/'+_0x27c002)[_0xfd41('0x1a')](_0x471da4);}return null;};}function patchUpdates(_0x51cb26){return function(_0x1683ca){try{jsonpatch[_0xfd41('0x1f')](_0x1683ca,_0x51cb26,!![]);}catch(_0x5e7ee9){return BPromise[_0xfd41('0x20')](_0x5e7ee9);}return _0x1683ca[_0xfd41('0x21')]();};}function saveUpdates(_0x18cd33,_0x595728){return function(_0x1fae45){if(_0x1fae45){return _0x1fae45[_0xfd41('0x22')](_0x18cd33)[_0xfd41('0x23')](function(_0x10330b){return _0x10330b;});}return null;};}function removeEntity(_0x34c078,_0x4739c0){return function(_0x2ea394){if(_0x2ea394){return _0x2ea394[_0xfd41('0x24')]()[_0xfd41('0x23')](function(){var _0x35fa3e=_0x2ea394['get']({'plain':!![]});var _0x4d3df3=_0xfd41('0x25');return db['UserProfileResource'][_0xfd41('0x24')]({'where':{'type':_0x4d3df3,'resourceId':_0x35fa3e['id']}})[_0xfd41('0x23')](function(){return _0x2ea394;});})['then'](function(){_0x34c078['status'](0xcc)[_0xfd41('0x19')]();});}};}function handleEntityNotFound(_0x1a1957,_0x4788e7){return function(_0x4dfaaf){if(!_0x4dfaaf){_0x1a1957[_0xfd41('0x17')](0x194);}return _0x4dfaaf;};}function handleError(_0x59c5e3,_0x4d2186){_0x4d2186=_0x4d2186||0x1f4;return function(_0x35ba3c){logger['error'](_0x35ba3c[_0xfd41('0x26')]);if(_0x35ba3c['name']){delete _0x35ba3c[_0xfd41('0x27')];}_0x59c5e3[_0xfd41('0x18')](_0x4d2186)['send'](_0x35ba3c);};}exports[_0xfd41('0x28')]=function(_0xd5c06c,_0x3c338b){var _0x9c78e5={},_0x5a5226={},_0xc8054c={'count':0x0,'rows':[]};var _0x3be7d6=_['map'](db[_0xfd41('0x29')][_0xfd41('0x2a')],function(_0x39f760){return{'name':_0x39f760[_0xfd41('0x2b')],'type':_0x39f760[_0xfd41('0x2c')]['key']};});_0x5a5226[_0xfd41('0x2d')]=_[_0xfd41('0x2e')](_0x3be7d6,'name');_0x5a5226[_0xfd41('0x2f')]=_['keys'](_0xd5c06c[_0xfd41('0x2f')]);_0x5a5226[_0xfd41('0x30')]=_[_0xfd41('0x31')](_0x5a5226['model'],_0x5a5226[_0xfd41('0x2f')]);_0x9c78e5[_0xfd41('0x32')]=_[_0xfd41('0x31')](_0x5a5226[_0xfd41('0x2d')],qs[_0xfd41('0x33')](_0xd5c06c[_0xfd41('0x2f')]['fields']));_0x9c78e5[_0xfd41('0x32')]=_0x9c78e5[_0xfd41('0x32')][_0xfd41('0x34')]?_0x9c78e5[_0xfd41('0x32')]:_0x5a5226[_0xfd41('0x2d')];if(!_0xd5c06c[_0xfd41('0x2f')][_0xfd41('0x35')]('nolimit')){_0x9c78e5['limit']=qs['limit'](_0xd5c06c[_0xfd41('0x2f')][_0xfd41('0x1d')]);_0x9c78e5['offset']=qs[_0xfd41('0x1c')](_0xd5c06c[_0xfd41('0x2f')][_0xfd41('0x1c')]);}_0x9c78e5[_0xfd41('0x36')]=qs[_0xfd41('0x37')](_0xd5c06c[_0xfd41('0x2f')][_0xfd41('0x37')]);_0x9c78e5[_0xfd41('0x38')]=qs['filters'](_[_0xfd41('0x39')](_0xd5c06c[_0xfd41('0x2f')],_0x5a5226[_0xfd41('0x30')]),_0x3be7d6);if(_0xd5c06c[_0xfd41('0x2f')][_0xfd41('0x3a')]){_0x9c78e5[_0xfd41('0x38')]=_[_0xfd41('0x3b')](_0x9c78e5['where'],{'$or':_[_0xfd41('0x2e')](_0x3be7d6,function(_0x25926d){if(_0x25926d[_0xfd41('0x2c')]!==_0xfd41('0x3c')){var _0x2f25e7={};_0x2f25e7[_0x25926d[_0xfd41('0x27')]]={'$like':'%'+_0xd5c06c[_0xfd41('0x2f')][_0xfd41('0x3a')]+'%'};return _0x2f25e7;}})});}_0x9c78e5=_[_0xfd41('0x3b')]({},_0x9c78e5,_0xd5c06c[_0xfd41('0x3d')]);var _0x1fe5c4={'where':_0x9c78e5[_0xfd41('0x38')]};return db['FaxQueue'][_0xfd41('0x1b')](_0x1fe5c4)['then'](function(_0x14dbba){_0xc8054c[_0xfd41('0x1b')]=_0x14dbba;if(_0xd5c06c[_0xfd41('0x2f')]['includeAll']){_0x9c78e5[_0xfd41('0x3e')]=[{'all':!![]}];}return db[_0xfd41('0x29')][_0xfd41('0x3f')](_0x9c78e5);})['then'](function(_0x501219){_0xc8054c[_0xfd41('0x40')]=_0x501219;return _0xc8054c;})[_0xfd41('0x23')](respondWithFilteredResult(_0x3c338b,_0x9c78e5))['catch'](handleError(_0x3c338b,null));};exports[_0xfd41('0x41')]=function(_0x1f6a2a,_0x15ef38){var _0x3ed971={'raw':!![],'where':{'id':_0x1f6a2a[_0xfd41('0x42')]['id']}},_0x255df5={};_0x255df5[_0xfd41('0x2d')]=_[_0xfd41('0x43')](db[_0xfd41('0x29')][_0xfd41('0x2a')]);_0x255df5[_0xfd41('0x2f')]=_['keys'](_0x1f6a2a[_0xfd41('0x2f')]);_0x255df5[_0xfd41('0x30')]=_[_0xfd41('0x31')](_0x255df5[_0xfd41('0x2d')],_0x255df5[_0xfd41('0x2f')]);_0x3ed971[_0xfd41('0x32')]=_[_0xfd41('0x31')](_0x255df5['model'],qs[_0xfd41('0x33')](_0x1f6a2a[_0xfd41('0x2f')][_0xfd41('0x33')]));_0x3ed971[_0xfd41('0x32')]=_0x3ed971[_0xfd41('0x32')][_0xfd41('0x34')]?_0x3ed971['attributes']:_0x255df5[_0xfd41('0x2d')];if(_0x1f6a2a[_0xfd41('0x2f')][_0xfd41('0x44')]){_0x3ed971['include']=[{'all':!![]}];}_0x3ed971=_[_0xfd41('0x3b')]({},_0x3ed971,_0x1f6a2a[_0xfd41('0x3d')]);return db['FaxQueue'][_0xfd41('0x45')](_0x3ed971)['then'](handleEntityNotFound(_0x15ef38,null))[_0xfd41('0x23')](respondWithResult(_0x15ef38,null))['catch'](handleError(_0x15ef38,null));};exports[_0xfd41('0x46')]=function(_0x15e8fa,_0x2570ed){return db['FaxQueue'][_0xfd41('0x46')](_0x15e8fa[_0xfd41('0x47')],{})[_0xfd41('0x23')](function(_0x4c40da){var _0x228c74=_0x15e8fa[_0xfd41('0x48')][_0xfd41('0x49')]({'plain':!![]});if(!_0x228c74)throw new Error(_0xfd41('0x4a'));if(_0x228c74[_0xfd41('0x4b')]==='user'){var _0xb34b35=_0x4c40da[_0xfd41('0x49')]({'plain':!![]});var _0xaba10e=_0xfd41('0x25');return db['UserProfileSection']['find']({'where':{'name':_0xaba10e,'userProfileId':_0x228c74['userProfileId']},'raw':!![]})[_0xfd41('0x23')](function(_0x3008ae){if(_0x3008ae&&_0x3008ae[_0xfd41('0x4c')]===0x0){return db[_0xfd41('0x4d')][_0xfd41('0x46')]({'name':_0xb34b35[_0xfd41('0x27')],'resourceId':_0xb34b35['id'],'type':_0x3008ae[_0xfd41('0x27')],'sectionId':_0x3008ae['id']},{})[_0xfd41('0x23')](function(){return _0x4c40da;});}else{return _0x4c40da;}})[_0xfd41('0x4e')](function(_0x5baf8a){logger[_0xfd41('0x4f')](_0xfd41('0x50'),_0x5baf8a);throw _0x5baf8a;});}return _0x4c40da;})[_0xfd41('0x23')](respondWithResult(_0x2570ed,0xc9))['catch'](handleError(_0x2570ed,null));};exports['update']=function(_0x585550,_0x3c6b01){if(_0x585550[_0xfd41('0x47')]['id']){delete _0x585550[_0xfd41('0x47')]['id'];}return db['FaxQueue'][_0xfd41('0x45')]({'where':{'id':_0x585550[_0xfd41('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c6b01,null))[_0xfd41('0x23')](saveUpdates(_0x585550[_0xfd41('0x47')],null))[_0xfd41('0x23')](respondWithResult(_0x3c6b01,null))[_0xfd41('0x4e')](handleError(_0x3c6b01,null));};exports['destroy']=function(_0x11750c,_0x1ab7b5){return db['FaxQueue'][_0xfd41('0x45')]({'where':{'id':_0x11750c[_0xfd41('0x42')]['id']}})[_0xfd41('0x23')](handleEntityNotFound(_0x1ab7b5,null))[_0xfd41('0x23')](removeEntity(_0x1ab7b5,null))[_0xfd41('0x4e')](handleError(_0x1ab7b5,null));};exports[_0xfd41('0x51')]=function(_0x174fd5,_0xf27323){return db['FaxQueue'][_0xfd41('0x51')]()['then'](respondWithResult(_0xf27323,null))['catch'](handleError(_0xf27323,null));};exports[_0xfd41('0x52')]=function(_0x5439ff,_0x3727dc,_0x3aafbd){var _0x3c03b2={'raw':!![],'where':{}},_0x4f1c35={},_0x39bb59;return db[_0xfd41('0x29')][_0xfd41('0x53')]({'where':{'id':_0x5439ff[_0xfd41('0x42')]['id']}})[_0xfd41('0x23')](handleEntityNotFound(_0x3727dc,null))['then'](function(_0x3ddb80){if(_0x3ddb80){_0x39bb59=_0x3ddb80['get']({'plain':!![]});_0x4f1c35['model']=_[_0xfd41('0x43')](db[_0xfd41('0x54')][_0xfd41('0x2a')]);_0x4f1c35[_0xfd41('0x2f')]=_[_0xfd41('0x43')](_0x5439ff['query']);_0x4f1c35[_0xfd41('0x30')]=_[_0xfd41('0x31')](_0x4f1c35[_0xfd41('0x2d')],_0x4f1c35[_0xfd41('0x2f')]);_0x3c03b2['attributes']=_[_0xfd41('0x31')](_0x4f1c35[_0xfd41('0x2d')],qs[_0xfd41('0x33')](_0x5439ff[_0xfd41('0x2f')][_0xfd41('0x33')]));_0x3c03b2['attributes']=_0x3c03b2['attributes'][_0xfd41('0x34')]?_0x3c03b2[_0xfd41('0x32')]:_0x4f1c35[_0xfd41('0x2d')];if(!_0x5439ff[_0xfd41('0x2f')][_0xfd41('0x35')](_0xfd41('0x55'))){_0x3c03b2[_0xfd41('0x1d')]=qs[_0xfd41('0x1d')](_0x5439ff[_0xfd41('0x2f')][_0xfd41('0x1d')]);_0x3c03b2[_0xfd41('0x1c')]=qs['offset'](_0x5439ff[_0xfd41('0x2f')][_0xfd41('0x1c')]);}_0x3c03b2['order']=qs[_0xfd41('0x37')](_0x5439ff[_0xfd41('0x2f')]['sort']);_0x3c03b2[_0xfd41('0x38')]=qs[_0xfd41('0x30')](_[_0xfd41('0x39')](_0x5439ff[_0xfd41('0x2f')],_0x4f1c35['filters']));_0x3c03b2[_0xfd41('0x38')][_0xfd41('0x56')]=_0x3ddb80['id'];if(_0x5439ff[_0xfd41('0x2f')][_0xfd41('0x3a')]){_0x3c03b2[_0xfd41('0x38')]=_[_0xfd41('0x3b')](_0x3c03b2['where'],{'$or':_['map'](_0x3c03b2[_0xfd41('0x32')],function(_0x340f1c){var _0x4e25c0={};_0x4e25c0[_0x340f1c]={'$like':'%'+_0x5439ff['query'][_0xfd41('0x3a')]+'%'};return _0x4e25c0;})});}_0x3c03b2=_['merge']({},_0x3c03b2,_0x5439ff['options']);return db[_0xfd41('0x54')][_0xfd41('0x3f')](_0x3c03b2);}})[_0xfd41('0x23')](function(_0x1ab51d){if(_0x1ab51d){return db['User'][_0xfd41('0x57')]({'where':{'id':_[_0xfd41('0x2e')](_0x1ab51d,_0xfd41('0x58')),'role':'agent'},'attributes':['id','name',_0xfd41('0x59'),_0xfd41('0x5a'),_0xfd41('0x5b')]});}})['then'](function(_0x55cdf2){if(_0x55cdf2){return{'count':_0x55cdf2[_0xfd41('0x1b')],'rows':_[_0xfd41('0x2e')](_0x55cdf2[_0xfd41('0x40')],function(_0x46d97c){return{'membername':_0x46d97c[_0xfd41('0x27')],'UserId':_0x46d97c['id'],'queue_name':_0x39bb59[_0xfd41('0x27')],'FaxQueueId':_0x39bb59['id'],'interface':util[_0xfd41('0x5c')](_0xfd41('0x5d'),_0xfd41('0x5e'),_0x46d97c[_0xfd41('0x27')]),'penalty':0x0,'paused':_0x46d97c[_0xfd41('0x59')],'createdAt':_0x46d97c[_0xfd41('0x5b')],'updatedAt':_0x46d97c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xfd41('0x23')](respondWithFilteredResult(_0x3727dc,_0x3c03b2))['catch'](handleError(_0x3727dc,null));};exports['getTeams']=function(_0x1b262d,_0x28a84a,_0x3c1a9b){var _0x4e95f1={};var _0x1cc0a9={};var _0x1118b6;var _0x50b7f5;return db[_0xfd41('0x29')][_0xfd41('0x53')]({'where':{'id':_0x1b262d[_0xfd41('0x42')]['id']}})[_0xfd41('0x23')](handleEntityNotFound(_0x28a84a,null))[_0xfd41('0x23')](function(_0x3be58f){if(_0x3be58f){_0x1118b6=_0x3be58f;_0x1cc0a9[_0xfd41('0x2d')]=_[_0xfd41('0x43')](db[_0xfd41('0x5f')][_0xfd41('0x2a')]);_0x1cc0a9[_0xfd41('0x2f')]=_[_0xfd41('0x43')](_0x1b262d[_0xfd41('0x2f')]);_0x1cc0a9[_0xfd41('0x30')]=_[_0xfd41('0x31')](_0x1cc0a9[_0xfd41('0x2d')],_0x1cc0a9[_0xfd41('0x2f')]);_0x4e95f1['attributes']=_[_0xfd41('0x31')](_0x1cc0a9['model'],qs[_0xfd41('0x33')](_0x1b262d[_0xfd41('0x2f')][_0xfd41('0x33')]));_0x4e95f1[_0xfd41('0x32')]=_0x4e95f1[_0xfd41('0x32')][_0xfd41('0x34')]?_0x4e95f1[_0xfd41('0x32')]:_0x1cc0a9['model'];_0x4e95f1[_0xfd41('0x36')]=qs[_0xfd41('0x37')](_0x1b262d[_0xfd41('0x2f')][_0xfd41('0x37')]);_0x4e95f1['where']=qs[_0xfd41('0x30')](_[_0xfd41('0x39')](_0x1b262d[_0xfd41('0x2f')],_0x1cc0a9[_0xfd41('0x30')]));if(_0x1b262d[_0xfd41('0x2f')][_0xfd41('0x3a')]){_0x4e95f1[_0xfd41('0x38')]=_[_0xfd41('0x3b')](_0x4e95f1['where'],{'$or':_[_0xfd41('0x2e')](_0x4e95f1[_0xfd41('0x32')],function(_0x202bb4){var _0x54cf83={};_0x54cf83[_0x202bb4]={'$like':'%'+_0x1b262d['query']['filter']+'%'};return _0x54cf83;})});}_0x4e95f1=_[_0xfd41('0x3b')]({},_0x4e95f1,_0x1b262d[_0xfd41('0x3d')]);return _0x1118b6[_0xfd41('0x60')](_0x4e95f1);}})[_0xfd41('0x23')](function(_0x5ce063){if(_0x5ce063){_0x50b7f5=_0x5ce063['length'];if(!_0x1b262d[_0xfd41('0x2f')][_0xfd41('0x35')](_0xfd41('0x55'))){_0x4e95f1[_0xfd41('0x1d')]=qs[_0xfd41('0x1d')](_0x1b262d[_0xfd41('0x2f')][_0xfd41('0x1d')]);_0x4e95f1[_0xfd41('0x1c')]=qs[_0xfd41('0x1c')](_0x1b262d[_0xfd41('0x2f')]['offset']);}return _0x1118b6['getTeams'](_0x4e95f1);}})['then'](function(_0xdf1565){if(_0xdf1565){return _0xdf1565?{'count':_0x50b7f5,'rows':_0xdf1565}:null;}})[_0xfd41('0x23')](respondWithResult(_0x28a84a,null))[_0xfd41('0x4e')](handleError(_0x28a84a,null));};exports[_0xfd41('0x61')]=function(_0x4c4c70,_0x255b2e,_0x380866){var _0x147393=_0x4c4c70['body'][_0xfd41('0x62')];return db[_0xfd41('0x5f')][_0xfd41('0x3f')]({'where':{'id':_0x147393},'attributes':['id'],'include':[{'model':db[_0xfd41('0x63')],'as':_0xfd41('0x64'),'attributes':['id',_0xfd41('0x27'),_0xfd41('0x65'),_0xfd41('0x66'),_0xfd41('0x67')],'raw':!![]}]})['then'](function(_0x2151a1){if(_0x2151a1){var _0xf462a3=_[_0xfd41('0x68')](_0x2151a1,function(_0x24551a){var _0x50ed73=_0x24551a[_0xfd41('0x49')]({'plain':!![]});return _0x50ed73[_0xfd41('0x64')];});return db[_0xfd41('0x29')][_0xfd41('0x45')]({'where':{'id':_0x4c4c70[_0xfd41('0x42')]['id']}})[_0xfd41('0x23')](function(_0x388257){return db[_0xfd41('0x69')][_0xfd41('0x6a')](function(_0x3da116){return _0x388257[_0xfd41('0x61')](_0x147393,{'transaction':_0x3da116})[_0xfd41('0x23')](function(){return BPromise[_0xfd41('0x6b')](_0xf462a3,function(_0x116e0c){return db[_0xfd41('0x54')][_0xfd41('0x6c')]({'where':{'UserId':_0x116e0c['id'],'FaxQueueId':_0x4c4c70[_0xfd41('0x42')]['id']},'transaction':_0x3da116});});})[_0xfd41('0x23')](function(){_0xf462a3['forEach'](function(_0x279fe7){socket[_0xfd41('0x6d')]('userFaxQueue:save',{'UserId':_0x279fe7['id'],'FaxQueueId':_0x388257['id']});});});});});}})[_0xfd41('0x23')](respondWithStatusCode(_0x255b2e,null))[_0xfd41('0x4e')](handleError(_0x255b2e,null));};exports[_0xfd41('0x6e')]=function(_0x1f5fb1,_0x3d65bc,_0x1c5fd6){return db[_0xfd41('0x5f')]['findAll']({'where':{'id':_0x1f5fb1[_0xfd41('0x2f')][_0xfd41('0x62')]},'attributes':['id'],'include':[{'model':db[_0xfd41('0x63')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3d65bc,null))[_0xfd41('0x23')](function(_0x2c0bf1){var _0x2e54d4=_[_0xfd41('0x2e')](_0x2c0bf1,'id');var _0x5e3fe8=[];var _0x15a2e3=[];var _0x5856f7=squel[_0xfd41('0x6f')]();_0x5856f7[_0xfd41('0x70')](_0xfd41('0x71'))[_0xfd41('0x72')](_0xfd41('0x73'),'tq')[_0xfd41('0x74')](_0xfd41('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('FaxQueueId\x20=\x20?',_0x1f5fb1[_0xfd41('0x42')]['id']);for(var _0x236729=0x0;_0x236729<_0x2c0bf1['length'];_0x236729+=0x1){let _0x2ee3f2=_0x2c0bf1[_0x236729];for(var _0x1618b4=0x0;_0x1618b4<_0x2ee3f2[_0xfd41('0x64')][_0xfd41('0x34')];_0x1618b4+=0x1){let _0x3598bc=_0x2ee3f2[_0xfd41('0x64')][_0x1618b4];var _0x14891b=_0x5856f7[_0xfd41('0x76')]();_0x14891b[_0xfd41('0x38')](_0xfd41('0x77'),_0x3598bc['id']);_0x15a2e3[_0xfd41('0x78')](db['sequelize'][_0xfd41('0x2f')](_0x14891b['toString'](),{'type':db[_0xfd41('0x69')][_0xfd41('0x79')][_0xfd41('0x7a')]})[_0xfd41('0x23')](function(_0x17a223){if(_0x17a223['length']===0x1){return _0x3598bc['id'];}else{var _0x2b8f17=_[_0xfd41('0x7b')](_[_0xfd41('0x2e')](_0x17a223,_0xfd41('0x7c')),function(_0x2f0dc7){return _[_0xfd41('0x7d')](_0x2e54d4,_0x2f0dc7);});if(_0x2b8f17){return _0x3598bc['id'];}}}));}}return BPromise['all'](_0x15a2e3)[_0xfd41('0x23')](function(_0x51bf07){_0x5e3fe8=_(_0x5e3fe8)[_0xfd41('0x7e')](_0x51bf07)['compact']()['value']();return db[_0xfd41('0x29')]['find']({'where':{'id':_0x1f5fb1[_0xfd41('0x42')]['id']}})['then'](function(_0x4ff95f){return db['sequelize'][_0xfd41('0x6a')](function(_0x5a2d01){return _0x4ff95f['removeTeams'](_0x1f5fb1[_0xfd41('0x2f')][_0xfd41('0x62')],{'transaction':_0x5a2d01})[_0xfd41('0x23')](function(){if(!_[_0xfd41('0x7f')](_0x5e3fe8)){return _0x4ff95f[_0xfd41('0x80')](_0x5e3fe8,{'transaction':_0x5a2d01});}})[_0xfd41('0x23')](function(){_0x5e3fe8[_0xfd41('0x81')](function(_0xd66274){socket[_0xfd41('0x6d')](_0xfd41('0x82'),{'UserId':_0xd66274,'FaxQueueId':_0x4ff95f['id']});});});});});});})[_0xfd41('0x23')](respondWithStatusCode(_0x3d65bc,null))[_0xfd41('0x4e')](handleError(_0x3d65bc,null));};exports[_0xfd41('0x83')]=function(_0x20e61d,_0x2c9824,_0x2854e9){return db['FaxQueue']['find']({'where':{'id':_0x20e61d[_0xfd41('0x42')]['id']}})[_0xfd41('0x23')](handleEntityNotFound(_0x2c9824,null))[_0xfd41('0x23')](function(_0x4369a5){if(_0x4369a5){return _0x4369a5[_0xfd41('0x83')](_0x20e61d[_0xfd41('0x47')]['ids'],_[_0xfd41('0x84')](_0x20e61d['body'],[_0xfd41('0x62'),'id'])||{})[_0xfd41('0x85')](function(_0x34a037){for(var _0x1deb74=0x0;_0x1deb74<_0x20e61d[_0xfd41('0x47')]['ids']['length'];_0x1deb74+=0x1){socket[_0xfd41('0x6d')]('userFaxQueue:save',{'UserId':_0x20e61d['body']['ids'][_0x1deb74],'FaxQueueId':_0x20e61d[_0xfd41('0x42')]['id']});}return _0x34a037;});}})[_0xfd41('0x23')](respondWithResult(_0x2c9824,null))['catch'](handleError(_0x2c9824,null));};exports[_0xfd41('0x80')]=function(_0x326adf,_0x4c411b,_0x276f47){return db[_0xfd41('0x29')][_0xfd41('0x45')]({'where':{'id':_0x326adf[_0xfd41('0x42')]['id']}})[_0xfd41('0x23')](handleEntityNotFound(_0x4c411b,null))['then'](function(_0x56f221){if(_0x56f221){return _0x56f221[_0xfd41('0x80')](_0x326adf[_0xfd41('0x2f')][_0xfd41('0x62')])[_0xfd41('0x23')](function(){if(_[_0xfd41('0x86')](_0x326adf[_0xfd41('0x2f')][_0xfd41('0x62')])){for(var _0x71a3b3=0x0;_0x71a3b3<_0x326adf['query'][_0xfd41('0x62')]['length'];_0x71a3b3+=0x1){socket[_0xfd41('0x6d')](_0xfd41('0x82'),{'UserId':Number(_0x326adf[_0xfd41('0x2f')][_0xfd41('0x62')][_0x71a3b3]),'FaxQueueId':Number(_0x326adf['params']['id'])});}}else{socket[_0xfd41('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x326adf[_0xfd41('0x2f')][_0xfd41('0x62')]),'FaxQueueId':Number(_0x326adf[_0xfd41('0x42')]['id'])});}});}})[_0xfd41('0x23')](respondWithStatusCode(_0x4c411b,null))[_0xfd41('0x4e')](handleError(_0x4c411b,null));};exports[_0xfd41('0x87')]=function(_0x37ade2,_0x2ed6ce,_0xb3a9a){var _0x20c25f={};var _0x347ded={};var _0x422a4b;var _0x470790;return db[_0xfd41('0x29')][_0xfd41('0x53')]({'where':{'id':_0x37ade2[_0xfd41('0x42')]['id']}})[_0xfd41('0x23')](handleEntityNotFound(_0x2ed6ce,null))[_0xfd41('0x23')](function(_0x17a574){if(_0x17a574){_0x422a4b=_0x17a574;_0x347ded[_0xfd41('0x2d')]=_[_0xfd41('0x43')](db['User']['rawAttributes']);_0x347ded[_0xfd41('0x2f')]=_[_0xfd41('0x43')](_0x37ade2[_0xfd41('0x2f')]);_0x347ded['filters']=_[_0xfd41('0x31')](_0x347ded['model'],_0x347ded[_0xfd41('0x2f')]);_0x20c25f[_0xfd41('0x32')]=_['intersection'](_0x347ded['model'],qs[_0xfd41('0x33')](_0x37ade2['query'][_0xfd41('0x33')]));_0x20c25f['attributes']=_0x20c25f['attributes'][_0xfd41('0x34')]?_0x20c25f[_0xfd41('0x32')]:_0x347ded[_0xfd41('0x2d')];_0x20c25f[_0xfd41('0x36')]=qs[_0xfd41('0x37')](_0x37ade2[_0xfd41('0x2f')]['sort']);_0x20c25f[_0xfd41('0x38')]=qs[_0xfd41('0x30')](_[_0xfd41('0x39')](_0x37ade2[_0xfd41('0x2f')],_0x347ded[_0xfd41('0x30')]));if(_0x37ade2['query'][_0xfd41('0x3a')]){_0x20c25f[_0xfd41('0x38')]=_['merge'](_0x20c25f[_0xfd41('0x38')],{'$or':_[_0xfd41('0x2e')](_0x20c25f['attributes'],function(_0x547dea){var _0x2c489c={};_0x2c489c[_0x547dea]={'$like':'%'+_0x37ade2[_0xfd41('0x2f')][_0xfd41('0x3a')]+'%'};return _0x2c489c;})});}_0x20c25f=_[_0xfd41('0x3b')]({},_0x20c25f,_0x37ade2['options']);return _0x422a4b[_0xfd41('0x87')](_0x20c25f);}})[_0xfd41('0x23')](function(_0x4cd75c){if(_0x4cd75c){_0x470790=_0x4cd75c[_0xfd41('0x34')];if(!_0x37ade2[_0xfd41('0x2f')][_0xfd41('0x35')](_0xfd41('0x55'))){_0x20c25f[_0xfd41('0x1d')]=qs[_0xfd41('0x1d')](_0x37ade2[_0xfd41('0x2f')]['limit']);_0x20c25f[_0xfd41('0x1c')]=qs[_0xfd41('0x1c')](_0x37ade2[_0xfd41('0x2f')][_0xfd41('0x1c')]);}return _0x422a4b[_0xfd41('0x87')](_0x20c25f);}})['then'](function(_0x47e5bd){if(_0x47e5bd){return _0x47e5bd?{'count':_0x470790,'rows':_0x47e5bd}:null;}})[_0xfd41('0x23')](respondWithResult(_0x2ed6ce,null))[_0xfd41('0x4e')](handleError(_0x2ed6ce,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 9fbf05f..90ea84d 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 _0x0544=['events','FaxQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x438278,_0x1841ad){var _0xac4bdf=function(_0x6ca53e){while(--_0x6ca53e){_0x438278['push'](_0x438278['shift']());}};_0xac4bdf(++_0x1841ad);}(_0x0544,0xb4));var _0x4054=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x0544[_0x81dcac];return _0xc7803b;};'use strict';var EventEmitter=require(_0x4054('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x4054('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x4054('0x2')](0x0);var events={'afterCreate':_0x4054('0x3'),'afterUpdate':'update','afterDestroy':_0x4054('0x4')};function emitEvent(_0x45eca7){return function(_0x31c010,_0x861006,_0x3b5280){FaxQueueEvents['emit'](_0x45eca7+':'+_0x31c010['id'],_0x31c010);FaxQueueEvents[_0x4054('0x5')](_0x45eca7,_0x31c010);_0x3b5280(null);};}for(var e in events){if(events[_0x4054('0x6')](e)){var event=events[e];FaxQueue[_0x4054('0x7')](e,emitEvent(event));}}module[_0x4054('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xa3e0=['events','FaxQueue','setMaxListeners','save','remove','hasOwnProperty','hook'];(function(_0x3cc574,_0xa5de98){var _0x2d29f9=function(_0x17813b){while(--_0x17813b){_0x3cc574['push'](_0x3cc574['shift']());}};_0x2d29f9(++_0xa5de98);}(_0xa3e0,0x11f));var _0x0a3e=function(_0x397069,_0x4173b6){_0x397069=_0x397069-0x0;var _0x1ce7fc=_0xa3e0[_0x397069];return _0x1ce7fc;};'use strict';var EventEmitter=require(_0x0a3e('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x0a3e('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x0a3e('0x2')](0x0);var events={'afterCreate':_0x0a3e('0x3'),'afterUpdate':'update','afterDestroy':_0x0a3e('0x4')};function emitEvent(_0x5706c5){return function(_0x2a2589,_0x357a35,_0x42d0a2){FaxQueueEvents['emit'](_0x5706c5+':'+_0x2a2589['id'],_0x2a2589);FaxQueueEvents['emit'](_0x5706c5,_0x2a2589);_0x42d0a2(null);};}for(var e in events){if(events[_0x0a3e('0x5')](e)){var event=events[e];FaxQueue[_0x0a3e('0x6')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 3e1dfa3..1caef2c 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 _0x9248=['../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x56e32e,_0x9eb2f6){var _0x2a757b=function(_0x50b7bc){while(--_0x50b7bc){_0x56e32e['push'](_0x56e32e['shift']());}};_0x2a757b(++_0x9eb2f6);}(_0x9248,0x199));var _0x8924=function(_0x376534,_0x52f3e4){_0x376534=_0x376534-0x0;var _0x1627d6=_0x9248[_0x376534];return _0x1627d6;};'use strict';var _=require('lodash');var util=require(_0x8924('0x0'));var logger=require(_0x8924('0x1'))(_0x8924('0x2'));var moment=require(_0x8924('0x3'));var BPromise=require('bluebird');var rp=require(_0x8924('0x4'));var fs=require('fs');var path=require(_0x8924('0x5'));var rimraf=require(_0x8924('0x6'));var config=require(_0x8924('0x7'));var attributes=require(_0x8924('0x8'));module[_0x8924('0x9')]=function(_0x19cd6a,_0x27a5cc){return _0x19cd6a[_0x8924('0xa')](_0x8924('0xb'),attributes,{'tableName':_0x8924('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57ae=['./faxQueue.attributes','exports','define','fax_queues','lodash','util','bluebird','path','rimraf','../../config/environment'];(function(_0x15e6fe,_0x1a5c39){var _0x34894d=function(_0x32eec2){while(--_0x32eec2){_0x15e6fe['push'](_0x15e6fe['shift']());}};_0x34894d(++_0x1a5c39);}(_0x57ae,0x1ee));var _0xe57a=function(_0xeaf0e,_0x568209){_0xeaf0e=_0xeaf0e-0x0;var _0x1b73e5=_0x57ae[_0xeaf0e];return _0x1b73e5;};'use strict';var _=require(_0xe57a('0x0'));var util=require(_0xe57a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe57a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe57a('0x3'));var rimraf=require(_0xe57a('0x4'));var config=require(_0xe57a('0x5'));var attributes=require(_0xe57a('0x6'));module[_0xe57a('0x7')]=function(_0x128a45,_0x170953){return _0x128a45[_0xe57a('0x8')]('FaxQueue',attributes,{'tableName':_0xe57a('0x9'),'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 ba9087a..2edecbd 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 _0x3b4d=['map','model','then','ShowFaxQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','socket.io-emitter','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include'];(function(_0x3e5742,_0x361568){var _0x2ff4d4=function(_0x3bedc9){while(--_0x3bedc9){_0x3e5742['push'](_0x3e5742['shift']());}};_0x2ff4d4(++_0x361568);}(_0x3b4d,0xc7));var _0xd3b4=function(_0x139c57,_0xa22f9e){_0x139c57=_0x139c57-0x0;var _0x262126=_0x3b4d[_0x139c57];return _0x262126;};'use strict';var _=require(_0xd3b4('0x0'));var util=require(_0xd3b4('0x1'));var moment=require(_0xd3b4('0x2'));var BPromise=require(_0xd3b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3b4('0x4'));var db=require(_0xd3b4('0x5'))['db'];var utils=require(_0xd3b4('0x6'));var logger=require('../../config/logger')(_0xd3b4('0x7'));var config=require('../../config/environment');var jayson=require(_0xd3b4('0x8'));var client=jayson[_0xd3b4('0x9')]['http']({'port':0x232a});config[_0xd3b4('0xa')]=_['defaults'](config[_0xd3b4('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xd3b4('0xb'))(new Redis(config[_0xd3b4('0xa')]));require(_0xd3b4('0xc'))[_0xd3b4('0xd')](socket);function respondWithRpcPromise(_0x545acc,_0x2d2a0a,_0x37ff0d){return new BPromise(function(_0x341f47,_0xd22252){return client[_0xd3b4('0xe')](_0x545acc,_0x37ff0d)['then'](function(_0xd21f62){logger[_0xd3b4('0xf')](_0xd3b4('0x10'),_0x2d2a0a,'request\x20sent');logger[_0xd3b4('0x11')](_0xd3b4('0x12'),_0x2d2a0a,_0xd3b4('0x13'),JSON[_0xd3b4('0x14')](_0xd21f62));if(_0xd21f62[_0xd3b4('0x15')]){if(_0xd21f62[_0xd3b4('0x15')][_0xd3b4('0x16')]===0x1f4){logger[_0xd3b4('0x15')]('FaxQueue,\x20%s,\x20%s',_0x2d2a0a,_0xd21f62[_0xd3b4('0x15')][_0xd3b4('0x17')]);return _0xd22252(_0xd21f62[_0xd3b4('0x15')][_0xd3b4('0x17')]);}logger[_0xd3b4('0x15')](_0xd3b4('0x10'),_0x2d2a0a,_0xd21f62['error'][_0xd3b4('0x17')]);return _0x341f47(_0xd21f62[_0xd3b4('0x15')]['message']);}else{logger[_0xd3b4('0xf')](_0xd3b4('0x10'),_0x2d2a0a,'request\x20sent');_0x341f47(_0xd21f62[_0xd3b4('0x18')]['message']);}})[_0xd3b4('0x19')](function(_0x358366){logger[_0xd3b4('0x15')](_0xd3b4('0x10'),_0x2d2a0a,_0x358366);_0xd22252(_0x358366);});});}exports[_0xd3b4('0x1a')]=function(_0x2e6b8d){var _0x2823fa=this;return new Promise(function(_0x51315b,_0x15a704){return db[_0xd3b4('0x1b')][_0xd3b4('0x1c')]({'raw':_0x2e6b8d['options']?_0x2e6b8d[_0xd3b4('0x1d')][_0xd3b4('0x1e')]===undefined?!![]:![]:!![],'where':_0x2e6b8d[_0xd3b4('0x1d')]?_0x2e6b8d['options'][_0xd3b4('0x1f')]||null:null,'attributes':_0x2e6b8d[_0xd3b4('0x1d')]?_0x2e6b8d[_0xd3b4('0x1d')][_0xd3b4('0x20')]||null:null,'limit':_0x2e6b8d['options']?_0x2e6b8d[_0xd3b4('0x1d')][_0xd3b4('0x21')]||null:null,'include':_0x2e6b8d['options']?_0x2e6b8d[_0xd3b4('0x1d')][_0xd3b4('0x22')]?_[_0xd3b4('0x23')](_0x2e6b8d[_0xd3b4('0x1d')][_0xd3b4('0x22')],function(_0x3d45e9){return{'model':db[_0x3d45e9[_0xd3b4('0x24')]],'as':_0x3d45e9['as'],'attributes':_0x3d45e9[_0xd3b4('0x20')],'include':_0x3d45e9[_0xd3b4('0x22')]?_['map'](_0x3d45e9['include'],function(_0x3fe1ad){return{'model':db[_0x3fe1ad['model']],'as':_0x3fe1ad['as'],'attributes':_0x3fe1ad[_0xd3b4('0x20')],'include':_0x3fe1ad[_0xd3b4('0x22')]?_[_0xd3b4('0x23')](_0x3fe1ad[_0xd3b4('0x22')],function(_0x38435e){return{'model':db[_0x38435e[_0xd3b4('0x24')]],'as':_0x38435e['as'],'attributes':_0x38435e[_0xd3b4('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd3b4('0x25')](function(_0x4bd850){logger[_0xd3b4('0xf')](_0xd3b4('0x1a'),_0x2e6b8d);logger[_0xd3b4('0x11')](_0xd3b4('0x1a'),_0x2e6b8d,JSON[_0xd3b4('0x14')](_0x4bd850));_0x51315b(_0x4bd850);})[_0xd3b4('0x19')](function(_0xbd199c){logger['error'](_0xd3b4('0x1a'),_0xbd199c[_0xd3b4('0x17')],_0x2e6b8d);_0x15a704(_0x2823fa[_0xd3b4('0x15')](0x1f4,_0xbd199c['message']));});});};exports[_0xd3b4('0x26')]=function(_0x5bca0f){var _0x17a9a6=this;return new Promise(function(_0x5c9093,_0xa79d3f){return db['FaxQueue']['find']({'raw':_0x5bca0f[_0xd3b4('0x1d')]?_0x5bca0f[_0xd3b4('0x1d')][_0xd3b4('0x1e')]===undefined?!![]:![]:!![],'where':_0x5bca0f[_0xd3b4('0x1d')]?_0x5bca0f[_0xd3b4('0x1d')]['where']||null:null,'attributes':_0x5bca0f[_0xd3b4('0x1d')]?_0x5bca0f['options']['attributes']||null:null,'include':_0x5bca0f[_0xd3b4('0x1d')]?_0x5bca0f[_0xd3b4('0x1d')][_0xd3b4('0x22')]?_['map'](_0x5bca0f[_0xd3b4('0x1d')][_0xd3b4('0x22')],function(_0x95ad7b){return{'model':db[_0x95ad7b[_0xd3b4('0x24')]],'as':_0x95ad7b['as'],'attributes':_0x95ad7b[_0xd3b4('0x20')],'include':_0x95ad7b[_0xd3b4('0x22')]?_[_0xd3b4('0x23')](_0x95ad7b[_0xd3b4('0x22')],function(_0x56b40b){return{'model':db[_0x56b40b['model']],'as':_0x56b40b['as'],'attributes':_0x56b40b[_0xd3b4('0x20')],'include':_0x56b40b[_0xd3b4('0x22')]?_[_0xd3b4('0x23')](_0x56b40b[_0xd3b4('0x22')],function(_0x58ca35){return{'model':db[_0x58ca35['model']],'as':_0x58ca35['as'],'attributes':_0x58ca35['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f5ab0){logger[_0xd3b4('0xf')](_0xd3b4('0x26'),_0x5bca0f);logger[_0xd3b4('0x11')](_0xd3b4('0x26'),_0x5bca0f,JSON[_0xd3b4('0x14')](_0x2f5ab0));_0x5c9093(_0x2f5ab0);})[_0xd3b4('0x19')](function(_0x440604){logger[_0xd3b4('0x15')](_0xd3b4('0x26'),_0x440604[_0xd3b4('0x17')],_0x5bca0f);_0xa79d3f(_0x17a9a6['error'](0x1f4,_0x440604[_0xd3b4('0x17')]));});});}; \ No newline at end of file +var _0x0f6f=['raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','localhost','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','limit','map','include','model','attributes','ShowFaxQueue','find'];(function(_0x3dd8dd,_0x369f8e){var _0x33e300=function(_0xf1a7db){while(--_0xf1a7db){_0x3dd8dd['push'](_0x3dd8dd['shift']());}};_0x33e300(++_0x369f8e);}(_0x0f6f,0x141));var _0xf0f6=function(_0x38223f,_0x3a0dfc){_0x38223f=_0x38223f-0x0;var _0x3e3fab=_0x0f6f[_0x38223f];return _0x3e3fab;};'use strict';var _=require(_0xf0f6('0x0'));var util=require(_0xf0f6('0x1'));var moment=require(_0xf0f6('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0f6('0x3'));var fs=require('fs');var Redis=require(_0xf0f6('0x4'));var db=require(_0xf0f6('0x5'))['db'];var utils=require(_0xf0f6('0x6'));var logger=require(_0xf0f6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf0f6('0x8')][_0xf0f6('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf0f6('0xa')],{'host':_0xf0f6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf0f6('0xc'))[_0xf0f6('0xd')](socket);function respondWithRpcPromise(_0x48def,_0x9b39db,_0x18dfcb){return new BPromise(function(_0x23d258,_0xc4da40){return client[_0xf0f6('0xe')](_0x48def,_0x18dfcb)[_0xf0f6('0xf')](function(_0x211a73){logger[_0xf0f6('0x10')](_0xf0f6('0x11'),_0x9b39db,'request\x20sent');logger[_0xf0f6('0x12')](_0xf0f6('0x13'),_0x9b39db,_0xf0f6('0x14'),JSON[_0xf0f6('0x15')](_0x211a73));if(_0x211a73[_0xf0f6('0x16')]){if(_0x211a73['error'][_0xf0f6('0x17')]===0x1f4){logger[_0xf0f6('0x16')]('FaxQueue,\x20%s,\x20%s',_0x9b39db,_0x211a73[_0xf0f6('0x16')]['message']);return _0xc4da40(_0x211a73[_0xf0f6('0x16')][_0xf0f6('0x18')]);}logger[_0xf0f6('0x16')](_0xf0f6('0x11'),_0x9b39db,_0x211a73[_0xf0f6('0x16')]['message']);return _0x23d258(_0x211a73[_0xf0f6('0x16')][_0xf0f6('0x18')]);}else{logger[_0xf0f6('0x10')]('FaxQueue,\x20%s,\x20%s',_0x9b39db,_0xf0f6('0x14'));_0x23d258(_0x211a73[_0xf0f6('0x19')][_0xf0f6('0x18')]);}})[_0xf0f6('0x1a')](function(_0x1b9e90){logger[_0xf0f6('0x16')](_0xf0f6('0x11'),_0x9b39db,_0x1b9e90);_0xc4da40(_0x1b9e90);});});}exports[_0xf0f6('0x1b')]=function(_0x5865df){var _0x172705=this;return new Promise(function(_0x14888c,_0x16ae49){return db[_0xf0f6('0x1c')][_0xf0f6('0x1d')]({'raw':_0x5865df[_0xf0f6('0x1e')]?_0x5865df['options']['raw']===undefined?!![]:![]:!![],'where':_0x5865df[_0xf0f6('0x1e')]?_0x5865df[_0xf0f6('0x1e')][_0xf0f6('0x1f')]||null:null,'attributes':_0x5865df['options']?_0x5865df[_0xf0f6('0x1e')]['attributes']||null:null,'limit':_0x5865df[_0xf0f6('0x1e')]?_0x5865df[_0xf0f6('0x1e')][_0xf0f6('0x20')]||null:null,'include':_0x5865df[_0xf0f6('0x1e')]?_0x5865df['options']['include']?_[_0xf0f6('0x21')](_0x5865df['options'][_0xf0f6('0x22')],function(_0x24020a){return{'model':db[_0x24020a[_0xf0f6('0x23')]],'as':_0x24020a['as'],'attributes':_0x24020a[_0xf0f6('0x24')],'include':_0x24020a[_0xf0f6('0x22')]?_[_0xf0f6('0x21')](_0x24020a[_0xf0f6('0x22')],function(_0x3d4709){return{'model':db[_0x3d4709['model']],'as':_0x3d4709['as'],'attributes':_0x3d4709[_0xf0f6('0x24')],'include':_0x3d4709[_0xf0f6('0x22')]?_['map'](_0x3d4709[_0xf0f6('0x22')],function(_0x11ff9a){return{'model':db[_0x11ff9a[_0xf0f6('0x23')]],'as':_0x11ff9a['as'],'attributes':_0x11ff9a[_0xf0f6('0x24')]};}):[]};}):[]};}):[]:[]})[_0xf0f6('0xf')](function(_0x1b5ed0){logger['info'](_0xf0f6('0x1b'),_0x5865df);logger[_0xf0f6('0x12')]('GetFaxQueue',_0x5865df,JSON[_0xf0f6('0x15')](_0x1b5ed0));_0x14888c(_0x1b5ed0);})['catch'](function(_0x246e94){logger[_0xf0f6('0x16')](_0xf0f6('0x1b'),_0x246e94[_0xf0f6('0x18')],_0x5865df);_0x16ae49(_0x172705[_0xf0f6('0x16')](0x1f4,_0x246e94['message']));});});};exports[_0xf0f6('0x25')]=function(_0x524fbd){var _0x198318=this;return new Promise(function(_0xa3c5df,_0x2f9e37){return db[_0xf0f6('0x1c')][_0xf0f6('0x26')]({'raw':_0x524fbd[_0xf0f6('0x1e')]?_0x524fbd[_0xf0f6('0x1e')][_0xf0f6('0x27')]===undefined?!![]:![]:!![],'where':_0x524fbd[_0xf0f6('0x1e')]?_0x524fbd[_0xf0f6('0x1e')][_0xf0f6('0x1f')]||null:null,'attributes':_0x524fbd['options']?_0x524fbd[_0xf0f6('0x1e')]['attributes']||null:null,'include':_0x524fbd['options']?_0x524fbd[_0xf0f6('0x1e')][_0xf0f6('0x22')]?_[_0xf0f6('0x21')](_0x524fbd[_0xf0f6('0x1e')][_0xf0f6('0x22')],function(_0x1ae36d){return{'model':db[_0x1ae36d[_0xf0f6('0x23')]],'as':_0x1ae36d['as'],'attributes':_0x1ae36d[_0xf0f6('0x24')],'include':_0x1ae36d[_0xf0f6('0x22')]?_[_0xf0f6('0x21')](_0x1ae36d[_0xf0f6('0x22')],function(_0x112955){return{'model':db[_0x112955['model']],'as':_0x112955['as'],'attributes':_0x112955[_0xf0f6('0x24')],'include':_0x112955[_0xf0f6('0x22')]?_[_0xf0f6('0x21')](_0x112955['include'],function(_0x3e49ce){return{'model':db[_0x3e49ce[_0xf0f6('0x23')]],'as':_0x3e49ce['as'],'attributes':_0x3e49ce[_0xf0f6('0x24')]};}):[]};}):[]};}):[]:[]})[_0xf0f6('0xf')](function(_0xe06266){logger[_0xf0f6('0x10')](_0xf0f6('0x25'),_0x524fbd);logger['debug'](_0xf0f6('0x25'),_0x524fbd,JSON[_0xf0f6('0x15')](_0xe06266));_0xa3c5df(_0xe06266);})[_0xf0f6('0x1a')](function(_0xc80d1c){logger[_0xf0f6('0x16')]('ShowFaxQueue',_0xc80d1c['message'],_0x524fbd);_0x2f9e37(_0x198318[_0xf0f6('0x16')](0x1f4,_0xc80d1c['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 7e97880..cf4cb09 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 _0x55f4=['register','faxQueue:','remove','update','emit','removeListener'];(function(_0x10cfcd,_0x517165){var _0x3f0493=function(_0x1f8b53){while(--_0x1f8b53){_0x10cfcd['push'](_0x10cfcd['shift']());}};_0x3f0493(++_0x517165);}(_0x55f4,0x80));var _0x455f=function(_0x3cc626,_0x191ab9){_0x3cc626=_0x3cc626-0x0;var _0x803646=_0x55f4[_0x3cc626];return _0x803646;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0x455f('0x0'),_0x455f('0x1')];function createListener(_0x41125b,_0x2a150b){return function(_0x342976){_0x2a150b[_0x455f('0x2')](_0x41125b,_0x342976);};}function removeListener(_0x1ea4b1,_0x2cb390){return function(){FaxQueueEvents[_0x455f('0x3')](_0x1ea4b1,_0x2cb390);};}exports[_0x455f('0x4')]=function(_0xae4263){for(var _0x21a5c5=0x0,_0x294e40=events['length'];_0x21a5c5<_0x294e40;_0x21a5c5++){var _0x51b79b=events[_0x21a5c5];var _0x4ccd25=createListener(_0x455f('0x5')+_0x51b79b,_0xae4263);FaxQueueEvents['on'](_0x51b79b,_0x4ccd25);}}; \ No newline at end of file +var _0xa0db=['length','./faxQueue.events','update','emit'];(function(_0x148187,_0x2c8d81){var _0x2863ce=function(_0x292695){while(--_0x292695){_0x148187['push'](_0x148187['shift']());}};_0x2863ce(++_0x2c8d81);}(_0xa0db,0xa9));var _0xba0d=function(_0x5c7128,_0x5ef9da){_0x5c7128=_0x5c7128-0x0;var _0x1ffd85=_0xa0db[_0x5c7128];return _0x1ffd85;};'use strict';var FaxQueueEvents=require(_0xba0d('0x0'));var events=['save','remove',_0xba0d('0x1')];function createListener(_0x506f5a,_0x19d2dc){return function(_0x5874ce){_0x19d2dc[_0xba0d('0x2')](_0x506f5a,_0x5874ce);};}function removeListener(_0x4d28f4,_0x578b78){return function(){FaxQueueEvents['removeListener'](_0x4d28f4,_0x578b78);};}exports['register']=function(_0x2d99fd){for(var _0x1bb276=0x0,_0x134d9b=events[_0xba0d('0x3')];_0x1bb276<_0x134d9b;_0x1bb276++){var _0x59f252=events[_0x1bb276];var _0x16980c=createListener('faxQueue:'+_0x59f252,_0x2d99fd);FaxQueueEvents['on'](_0x59f252,_0x16980c);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 8ba0751..6e3c3b7 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 _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0xb10b,0x12a));var _0xbb10=function(_0x11af6c,_0xf0fc16){_0x11af6c=_0x11af6c-0x0;var _0x2b043f=_0xb10b[_0x11af6c];return _0x2b043f;};'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 auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xb10b,0x12a));var _0xbb10=function(_0x17ba7d,_0x3d1ace){_0x17ba7d=_0x17ba7d-0x0;var _0x8fd171=_0xb10b[_0x17ba7d];return _0x8fd171;};'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 auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index e893588..0f788a3 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 _0x445d=['STRING','DATE','moment','exports'];(function(_0x414970,_0x3d702b){var _0x192b6f=function(_0x39d8b3){while(--_0x39d8b3){_0x414970['push'](_0x414970['shift']());}};_0x192b6f(++_0x3d702b);}(_0x445d,0x12a));var _0xd445=function(_0x377b8b,_0x18688e){_0x377b8b=_0x377b8b-0x0;var _0x438ecb=_0x445d[_0x377b8b];return _0x438ecb;};'use strict';var moment=require(_0xd445('0x0'));var Sequelize=require('sequelize');module[_0xd445('0x1')]={'uniqueid':{'type':Sequelize[_0xd445('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xd445('0x3')]},'leaveAt':{'type':Sequelize[_0xd445('0x3')]},'acceptAt':{'type':Sequelize[_0xd445('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xd445('0x2')]}}; \ No newline at end of file +var _0x6310=['DATE','moment','sequelize','exports','STRING'];(function(_0x198f24,_0x5ca474){var _0x591e77=function(_0x25886b){while(--_0x25886b){_0x198f24['push'](_0x198f24['shift']());}};_0x591e77(++_0x5ca474);}(_0x6310,0x7e));var _0x0631=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x6310[_0x47aa64];return _0x549c7a;};'use strict';var moment=require(_0x0631('0x0'));var Sequelize=require(_0x0631('0x1'));module[_0x0631('0x2')]={'uniqueid':{'type':Sequelize[_0x0631('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x0631('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0631('0x4')]},'acceptAt':{'type':Sequelize[_0x0631('0x4')]},'exitAt':{'type':Sequelize[_0x0631('0x4')]},'reason':{'type':Sequelize[_0x0631('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index cddd270..673452e 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 _0x2f0b=['map','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','filter','type','merge','options','rows','catch','show','params','keys','rawAttributes','include','create','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','limit','status','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','FaxQueueReport','fieldName','key'];(function(_0x11879c,_0x804353){var _0x4964c3=function(_0x2e8e43){while(--_0x2e8e43){_0x11879c['push'](_0x11879c['shift']());}};_0x4964c3(++_0x804353);}(_0x2f0b,0x161));var _0xb2f0=function(_0x1ec301,_0x208a13){_0x1ec301=_0x1ec301-0x0;var _0x558cf7=_0x2f0b[_0x1ec301];return _0x558cf7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb2f0('0x0'));var rimraf=require(_0xb2f0('0x1'));var zipdir=require(_0xb2f0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb2f0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb2f0('0x4'));var util=require(_0xb2f0('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb2f0('0x6'));var squel=require('squel');var crypto=require(_0xb2f0('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xb2f0('0x8'));var toCsv=require('to-csv');var querystring=require(_0xb2f0('0x9'));var Papa=require('papaparse');var Redis=require(_0xb2f0('0xa'));var authService=require(_0xb2f0('0xb'));var qs=require(_0xb2f0('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb2f0('0xd'));var utils=require('../../config/utils');var config=require(_0xb2f0('0xe'));var licenseUtil=require(_0xb2f0('0xf'));var db=require(_0xb2f0('0x10'))['db'];function respondWithStatusCode(_0x1a0238,_0x2cd6ff){_0x2cd6ff=_0x2cd6ff||0xcc;return function(_0x16c242){if(_0x16c242){return _0x1a0238[_0xb2f0('0x11')](_0x2cd6ff);}return _0x1a0238['status'](_0x2cd6ff)[_0xb2f0('0x12')]();};}function respondWithResult(_0x29ed56,_0x5d95d6){_0x5d95d6=_0x5d95d6||0xc8;return function(_0x56d856){if(_0x56d856){return _0x29ed56['status'](_0x5d95d6)[_0xb2f0('0x13')](_0x56d856);}};}function respondWithFilteredResult(_0x47ddc5,_0x4f4ddc){return function(_0x144c28){if(_0x144c28){var _0xbf5e48=_0x144c28[_0xb2f0('0x14')],_0x4b30f1=_0x4f4ddc['offset'],_0x2a0d5c=_0x4f4ddc['offset']+_0x4f4ddc[_0xb2f0('0x15')],_0x2c0a5d;if(_0x2a0d5c>=_0xbf5e48){_0x2a0d5c=_0xbf5e48;_0x2c0a5d=0xc8;}else{_0x2c0a5d=0xce;}_0x47ddc5[_0xb2f0('0x16')](_0x2c0a5d);return _0x47ddc5['set'](_0xb2f0('0x17'),_0x4b30f1+'-'+_0x2a0d5c+'/'+_0xbf5e48)['json'](_0x144c28);}return null;};}function patchUpdates(_0x3a943a){return function(_0x1ab7c9){try{jsonpatch[_0xb2f0('0x18')](_0x1ab7c9,_0x3a943a,!![]);}catch(_0x50d01d){return BPromise[_0xb2f0('0x19')](_0x50d01d);}return _0x1ab7c9[_0xb2f0('0x1a')]();};}function saveUpdates(_0x19bc8b,_0x22a1ae){return function(_0x34c587){if(_0x34c587){return _0x34c587['update'](_0x19bc8b)[_0xb2f0('0x1b')](function(_0x1d8dcc){return _0x1d8dcc;});}return null;};}function removeEntity(_0x5e88db,_0x421ac5){return function(_0x2197f7){if(_0x2197f7){return _0x2197f7[_0xb2f0('0x1c')]()['then'](function(){_0x5e88db['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x556a9a,_0x489c5c){return function(_0x1173bd){if(!_0x1173bd){_0x556a9a[_0xb2f0('0x11')](0x194);}return _0x1173bd;};}function handleError(_0x1efc3c,_0x3fc93f){_0x3fc93f=_0x3fc93f||0x1f4;return function(_0x290a93){logger[_0xb2f0('0x1d')](_0x290a93[_0xb2f0('0x1e')]);if(_0x290a93[_0xb2f0('0x1f')]){delete _0x290a93[_0xb2f0('0x1f')];}_0x1efc3c[_0xb2f0('0x16')](_0x3fc93f)[_0xb2f0('0x20')](_0x290a93);};}exports[_0xb2f0('0x21')]=function(_0x5c7f32,_0x3b3bd5){var _0x2fdaf8={},_0x331b07={},_0xc653eb={'count':0x0,'rows':[]};var _0x106e14=_['map'](db[_0xb2f0('0x22')]['rawAttributes'],function(_0x245d53){return{'name':_0x245d53[_0xb2f0('0x23')],'type':_0x245d53['type'][_0xb2f0('0x24')]};});_0x331b07['model']=_[_0xb2f0('0x25')](_0x106e14,_0xb2f0('0x1f'));_0x331b07['query']=_['keys'](_0x5c7f32[_0xb2f0('0x26')]);_0x331b07['filters']=_['intersection'](_0x331b07['model'],_0x331b07['query']);_0x2fdaf8[_0xb2f0('0x27')]=_[_0xb2f0('0x28')](_0x331b07[_0xb2f0('0x29')],qs['fields'](_0x5c7f32['query'][_0xb2f0('0x2a')]));_0x2fdaf8[_0xb2f0('0x27')]=_0x2fdaf8[_0xb2f0('0x27')][_0xb2f0('0x2b')]?_0x2fdaf8[_0xb2f0('0x27')]:_0x331b07[_0xb2f0('0x29')];if(!_0x5c7f32[_0xb2f0('0x26')][_0xb2f0('0x2c')](_0xb2f0('0x2d'))){_0x2fdaf8[_0xb2f0('0x15')]=qs[_0xb2f0('0x15')](_0x5c7f32[_0xb2f0('0x26')][_0xb2f0('0x15')]);_0x2fdaf8[_0xb2f0('0x2e')]=qs[_0xb2f0('0x2e')](_0x5c7f32[_0xb2f0('0x26')]['offset']);}_0x2fdaf8[_0xb2f0('0x2f')]=qs['sort'](_0x5c7f32[_0xb2f0('0x26')][_0xb2f0('0x30')]);_0x2fdaf8[_0xb2f0('0x31')]=qs['filters'](_['pick'](_0x5c7f32[_0xb2f0('0x26')],_0x331b07[_0xb2f0('0x32')]),_0x106e14);if(_0x5c7f32[_0xb2f0('0x26')][_0xb2f0('0x33')]){_0x2fdaf8[_0xb2f0('0x31')]=_['merge'](_0x2fdaf8['where'],{'$or':_[_0xb2f0('0x25')](_0x106e14,function(_0x2ab938){if(_0x2ab938[_0xb2f0('0x34')]!=='VIRTUAL'){var _0x1fb603={};_0x1fb603[_0x2ab938[_0xb2f0('0x1f')]]={'$like':'%'+_0x5c7f32[_0xb2f0('0x26')]['filter']+'%'};return _0x1fb603;}})});}_0x2fdaf8=_[_0xb2f0('0x35')]({},_0x2fdaf8,_0x5c7f32[_0xb2f0('0x36')]);var _0x33d152={'where':_0x2fdaf8[_0xb2f0('0x31')]};return db[_0xb2f0('0x22')][_0xb2f0('0x14')](_0x33d152)[_0xb2f0('0x1b')](function(_0x48080c){_0xc653eb[_0xb2f0('0x14')]=_0x48080c;if(_0x5c7f32[_0xb2f0('0x26')]['includeAll']){_0x2fdaf8['include']=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x2fdaf8);})[_0xb2f0('0x1b')](function(_0x16962e){_0xc653eb[_0xb2f0('0x37')]=_0x16962e;return _0xc653eb;})[_0xb2f0('0x1b')](respondWithFilteredResult(_0x3b3bd5,_0x2fdaf8))[_0xb2f0('0x38')](handleError(_0x3b3bd5,null));};exports[_0xb2f0('0x39')]=function(_0x1ba6b8,_0x4e755a){var _0x2e9962={'raw':!![],'where':{'id':_0x1ba6b8[_0xb2f0('0x3a')]['id']}},_0x589c97={};_0x589c97['model']=_[_0xb2f0('0x3b')](db[_0xb2f0('0x22')][_0xb2f0('0x3c')]);_0x589c97[_0xb2f0('0x26')]=_[_0xb2f0('0x3b')](_0x1ba6b8[_0xb2f0('0x26')]);_0x589c97[_0xb2f0('0x32')]=_[_0xb2f0('0x28')](_0x589c97[_0xb2f0('0x29')],_0x589c97['query']);_0x2e9962[_0xb2f0('0x27')]=_[_0xb2f0('0x28')](_0x589c97[_0xb2f0('0x29')],qs[_0xb2f0('0x2a')](_0x1ba6b8['query'][_0xb2f0('0x2a')]));_0x2e9962['attributes']=_0x2e9962[_0xb2f0('0x27')][_0xb2f0('0x2b')]?_0x2e9962[_0xb2f0('0x27')]:_0x589c97[_0xb2f0('0x29')];if(_0x1ba6b8[_0xb2f0('0x26')]['includeAll']){_0x2e9962[_0xb2f0('0x3d')]=[{'all':!![]}];}_0x2e9962=_['merge']({},_0x2e9962,_0x1ba6b8[_0xb2f0('0x36')]);return db[_0xb2f0('0x22')]['find'](_0x2e9962)[_0xb2f0('0x1b')](handleEntityNotFound(_0x4e755a,null))[_0xb2f0('0x1b')](respondWithResult(_0x4e755a,null))[_0xb2f0('0x38')](handleError(_0x4e755a,null));};exports['create']=function(_0x498ee2,_0x2ebe99){return db['FaxQueueReport'][_0xb2f0('0x3e')](_0x498ee2[_0xb2f0('0x3f')],{})[_0xb2f0('0x1b')](respondWithResult(_0x2ebe99,0xc9))[_0xb2f0('0x38')](handleError(_0x2ebe99,null));};exports['update']=function(_0x2e1669,_0x42dc5a){if(_0x2e1669[_0xb2f0('0x3f')]['id']){delete _0x2e1669[_0xb2f0('0x3f')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x2e1669[_0xb2f0('0x3a')]['id']}})[_0xb2f0('0x1b')](handleEntityNotFound(_0x42dc5a,null))[_0xb2f0('0x1b')](saveUpdates(_0x2e1669[_0xb2f0('0x3f')],null))[_0xb2f0('0x1b')](respondWithResult(_0x42dc5a,null))['catch'](handleError(_0x42dc5a,null));};exports['destroy']=function(_0x2185c6,_0x3594f9){return db[_0xb2f0('0x22')]['find']({'where':{'id':_0x2185c6[_0xb2f0('0x3a')]['id']}})[_0xb2f0('0x1b')](handleEntityNotFound(_0x3594f9,null))[_0xb2f0('0x1b')](removeEntity(_0x3594f9,null))[_0xb2f0('0x38')](handleError(_0x3594f9,null));};exports[_0xb2f0('0x40')]=function(_0xe8b3e4,_0xf10567){return db[_0xb2f0('0x22')][_0xb2f0('0x40')]()[_0xb2f0('0x1b')](respondWithResult(_0xf10567,null))[_0xb2f0('0x38')](handleError(_0xf10567,null));}; \ No newline at end of file +var _0x4998=['params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','then','error','stack','name','send','map','FaxQueueReport','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','update'];(function(_0x394be6,_0x4da593){var _0x431e55=function(_0x4bab2c){while(--_0x4bab2c){_0x394be6['push'](_0x394be6['shift']());}};_0x431e55(++_0x4da593);}(_0x4998,0x11f));var _0x8499=function(_0x2ff762,_0x342c0b){_0x2ff762=_0x2ff762-0x0;var _0x158b02=_0x4998[_0x2ff762];return _0x158b02;};'use strict';var pdf=require(_0x8499('0x0'));var emlformat=require(_0x8499('0x1'));var rimraf=require(_0x8499('0x2'));var zipdir=require(_0x8499('0x3'));var jsonpatch=require(_0x8499('0x4'));var rp=require(_0x8499('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8499('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8499('0x7'));var csv=require('to-csv');var ejs=require(_0x8499('0x8'));var fs=require('fs');var _=require(_0x8499('0x9'));var squel=require(_0x8499('0xa'));var crypto=require(_0x8499('0xb'));var jsforce=require(_0x8499('0xc'));var deskjs=require(_0x8499('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8499('0xe'));var Papa=require(_0x8499('0xf'));var Redis=require(_0x8499('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8499('0x11'));var hardwareService=require(_0x8499('0x12'));var logger=require(_0x8499('0x13'))(_0x8499('0x14'));var utils=require('../../config/utils');var config=require(_0x8499('0x15'));var licenseUtil=require(_0x8499('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3230f0,_0x176372){_0x176372=_0x176372||0xcc;return function(_0xf63191){if(_0xf63191){return _0x3230f0[_0x8499('0x17')](_0x176372);}return _0x3230f0[_0x8499('0x18')](_0x176372)[_0x8499('0x19')]();};}function respondWithResult(_0x3a7cf5,_0x11a7e4){_0x11a7e4=_0x11a7e4||0xc8;return function(_0x53e2c4){if(_0x53e2c4){return _0x3a7cf5[_0x8499('0x18')](_0x11a7e4)['json'](_0x53e2c4);}};}function respondWithFilteredResult(_0x1db399,_0x5d86c5){return function(_0x4779f6){if(_0x4779f6){var _0x1d9a99=_0x4779f6['count'],_0x5df603=_0x5d86c5[_0x8499('0x1a')],_0x39d4b1=_0x5d86c5[_0x8499('0x1a')]+_0x5d86c5[_0x8499('0x1b')],_0x16c9b7;if(_0x39d4b1>=_0x1d9a99){_0x39d4b1=_0x1d9a99;_0x16c9b7=0xc8;}else{_0x16c9b7=0xce;}_0x1db399[_0x8499('0x18')](_0x16c9b7);return _0x1db399[_0x8499('0x1c')](_0x8499('0x1d'),_0x5df603+'-'+_0x39d4b1+'/'+_0x1d9a99)['json'](_0x4779f6);}return null;};}function patchUpdates(_0x7b2866){return function(_0x2cbd8a){try{jsonpatch[_0x8499('0x1e')](_0x2cbd8a,_0x7b2866,!![]);}catch(_0x47709d){return BPromise[_0x8499('0x1f')](_0x47709d);}return _0x2cbd8a['save']();};}function saveUpdates(_0x198d5b,_0x1d850f){return function(_0x3d3630){if(_0x3d3630){return _0x3d3630['update'](_0x198d5b)[_0x8499('0x20')](function(_0x45aaa0){return _0x45aaa0;});}return null;};}function removeEntity(_0x1eab44,_0x419173){return function(_0x1ad72d){if(_0x1ad72d){return _0x1ad72d['destroy']()[_0x8499('0x20')](function(){_0x1eab44[_0x8499('0x18')](0xcc)[_0x8499('0x19')]();});}};}function handleEntityNotFound(_0x26e629,_0x35bc2a){return function(_0x499bb4){if(!_0x499bb4){_0x26e629['sendStatus'](0x194);}return _0x499bb4;};}function handleError(_0x408acf,_0x2225ae){_0x2225ae=_0x2225ae||0x1f4;return function(_0x84330d){logger[_0x8499('0x21')](_0x84330d[_0x8499('0x22')]);if(_0x84330d['name']){delete _0x84330d[_0x8499('0x23')];}_0x408acf[_0x8499('0x18')](_0x2225ae)[_0x8499('0x24')](_0x84330d);};}exports['index']=function(_0x5190fc,_0x16fbe6){var _0x444fdf={},_0x4afeee={},_0x42a31c={'count':0x0,'rows':[]};var _0x53b350=_[_0x8499('0x25')](db[_0x8499('0x26')]['rawAttributes'],function(_0x31bf56){return{'name':_0x31bf56[_0x8499('0x27')],'type':_0x31bf56['type'][_0x8499('0x28')]};});_0x4afeee['model']=_[_0x8499('0x25')](_0x53b350,_0x8499('0x23'));_0x4afeee[_0x8499('0x29')]=_[_0x8499('0x2a')](_0x5190fc[_0x8499('0x29')]);_0x4afeee[_0x8499('0x2b')]=_[_0x8499('0x2c')](_0x4afeee[_0x8499('0x2d')],_0x4afeee[_0x8499('0x29')]);_0x444fdf['attributes']=_[_0x8499('0x2c')](_0x4afeee[_0x8499('0x2d')],qs[_0x8499('0x2e')](_0x5190fc[_0x8499('0x29')]['fields']));_0x444fdf[_0x8499('0x2f')]=_0x444fdf['attributes'][_0x8499('0x30')]?_0x444fdf[_0x8499('0x2f')]:_0x4afeee[_0x8499('0x2d')];if(!_0x5190fc[_0x8499('0x29')][_0x8499('0x31')](_0x8499('0x32'))){_0x444fdf[_0x8499('0x1b')]=qs[_0x8499('0x1b')](_0x5190fc['query'][_0x8499('0x1b')]);_0x444fdf[_0x8499('0x1a')]=qs[_0x8499('0x1a')](_0x5190fc[_0x8499('0x29')]['offset']);}_0x444fdf[_0x8499('0x33')]=qs['sort'](_0x5190fc[_0x8499('0x29')][_0x8499('0x34')]);_0x444fdf['where']=qs['filters'](_['pick'](_0x5190fc[_0x8499('0x29')],_0x4afeee[_0x8499('0x2b')]),_0x53b350);if(_0x5190fc[_0x8499('0x29')][_0x8499('0x35')]){_0x444fdf[_0x8499('0x36')]=_['merge'](_0x444fdf['where'],{'$or':_[_0x8499('0x25')](_0x53b350,function(_0x190fcc){if(_0x190fcc['type']!=='VIRTUAL'){var _0x2145e7={};_0x2145e7[_0x190fcc[_0x8499('0x23')]]={'$like':'%'+_0x5190fc[_0x8499('0x29')][_0x8499('0x35')]+'%'};return _0x2145e7;}})});}_0x444fdf=_[_0x8499('0x37')]({},_0x444fdf,_0x5190fc[_0x8499('0x38')]);var _0x39a8ef={'where':_0x444fdf[_0x8499('0x36')]};return db[_0x8499('0x26')][_0x8499('0x39')](_0x39a8ef)[_0x8499('0x20')](function(_0x5f26af){_0x42a31c[_0x8499('0x39')]=_0x5f26af;if(_0x5190fc[_0x8499('0x29')][_0x8499('0x3a')]){_0x444fdf[_0x8499('0x3b')]=[{'all':!![]}];}return db[_0x8499('0x26')][_0x8499('0x3c')](_0x444fdf);})[_0x8499('0x20')](function(_0x63af21){_0x42a31c[_0x8499('0x3d')]=_0x63af21;return _0x42a31c;})[_0x8499('0x20')](respondWithFilteredResult(_0x16fbe6,_0x444fdf))[_0x8499('0x3e')](handleError(_0x16fbe6,null));};exports[_0x8499('0x3f')]=function(_0x33205b,_0x176321){var _0xada25b={'raw':!![],'where':{'id':_0x33205b['params']['id']}},_0x403d10={};_0x403d10[_0x8499('0x2d')]=_[_0x8499('0x2a')](db[_0x8499('0x26')]['rawAttributes']);_0x403d10[_0x8499('0x29')]=_['keys'](_0x33205b[_0x8499('0x29')]);_0x403d10[_0x8499('0x2b')]=_[_0x8499('0x2c')](_0x403d10[_0x8499('0x2d')],_0x403d10[_0x8499('0x29')]);_0xada25b[_0x8499('0x2f')]=_[_0x8499('0x2c')](_0x403d10[_0x8499('0x2d')],qs[_0x8499('0x2e')](_0x33205b['query'][_0x8499('0x2e')]));_0xada25b[_0x8499('0x2f')]=_0xada25b[_0x8499('0x2f')][_0x8499('0x30')]?_0xada25b[_0x8499('0x2f')]:_0x403d10[_0x8499('0x2d')];if(_0x33205b[_0x8499('0x29')][_0x8499('0x3a')]){_0xada25b[_0x8499('0x3b')]=[{'all':!![]}];}_0xada25b=_[_0x8499('0x37')]({},_0xada25b,_0x33205b[_0x8499('0x38')]);return db[_0x8499('0x26')][_0x8499('0x40')](_0xada25b)['then'](handleEntityNotFound(_0x176321,null))[_0x8499('0x20')](respondWithResult(_0x176321,null))[_0x8499('0x3e')](handleError(_0x176321,null));};exports[_0x8499('0x41')]=function(_0x56e11e,_0x25a239){return db[_0x8499('0x26')][_0x8499('0x41')](_0x56e11e[_0x8499('0x42')],{})[_0x8499('0x20')](respondWithResult(_0x25a239,0xc9))['catch'](handleError(_0x25a239,null));};exports[_0x8499('0x43')]=function(_0x39b666,_0x1755ae){if(_0x39b666[_0x8499('0x42')]['id']){delete _0x39b666[_0x8499('0x42')]['id'];}return db['FaxQueueReport'][_0x8499('0x40')]({'where':{'id':_0x39b666[_0x8499('0x44')]['id']}})[_0x8499('0x20')](handleEntityNotFound(_0x1755ae,null))[_0x8499('0x20')](saveUpdates(_0x39b666['body'],null))[_0x8499('0x20')](respondWithResult(_0x1755ae,null))['catch'](handleError(_0x1755ae,null));};exports[_0x8499('0x45')]=function(_0x364895,_0x42998d){return db[_0x8499('0x26')][_0x8499('0x40')]({'where':{'id':_0x364895[_0x8499('0x44')]['id']}})['then'](handleEntityNotFound(_0x42998d,null))['then'](removeEntity(_0x42998d,null))[_0x8499('0x3e')](handleError(_0x42998d,null));};exports['describe']=function(_0xe20c5b,_0x2db3ee){return db['FaxQueueReport'][_0x8499('0x46')]()[_0x8499('0x20')](respondWithResult(_0x2db3ee,null))[_0x8499('0x3e')](handleError(_0x2db3ee,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 8c88775..d768e48 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 _0x8c77=['path','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x29ffa2,_0x3bdcf2){var _0x20a119=function(_0x2478d4){while(--_0x2478d4){_0x29ffa2['push'](_0x29ffa2['shift']());}};_0x20a119(++_0x3bdcf2);}(_0x8c77,0x10b));var _0x78c7=function(_0x36f94c,_0x137558){_0x36f94c=_0x36f94c-0x0;var _0x1f4c5d=_0x8c77[_0x36f94c];return _0x1f4c5d;};'use strict';var _=require(_0x78c7('0x0'));var util=require(_0x78c7('0x1'));var logger=require(_0x78c7('0x2'))(_0x78c7('0x3'));var moment=require(_0x78c7('0x4'));var BPromise=require('bluebird');var rp=require(_0x78c7('0x5'));var fs=require('fs');var path=require(_0x78c7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x78c7('0x7'));module[_0x78c7('0x8')]=function(_0x15082e,_0x3d5838){return _0x15082e[_0x78c7('0x9')](_0x78c7('0xa'),attributes,{'tableName':_0x78c7('0xb'),'paranoid':![],'indexes':[{'name':_0x78c7('0xc'),'fields':[_0x78c7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe0db=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger','moment','bluebird'];(function(_0x19248a,_0x336725){var _0x562211=function(_0x33b91b){while(--_0x33b91b){_0x19248a['push'](_0x19248a['shift']());}};_0x562211(++_0x336725);}(_0xe0db,0x188));var _0xbe0d=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xe0db[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0xbe0d('0x0'));var util=require('util');var logger=require(_0xbe0d('0x1'))('api');var moment=require(_0xbe0d('0x2'));var BPromise=require(_0xbe0d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe0d('0x4'));var rimraf=require(_0xbe0d('0x5'));var config=require(_0xbe0d('0x6'));var attributes=require(_0xbe0d('0x7'));module[_0xbe0d('0x8')]=function(_0x12e310,_0x230ab1){return _0x12e310[_0xbe0d('0x9')](_0xbe0d('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xbe0d('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 371edb4..9a0f37a 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 _0x579c=['jayson/promise','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FaxQueueReport','create','options','CreateFaxQueueReport','UpdateFaxQueueReport','update','body','raw','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x38c136,_0x5f0228){var _0x555243=function(_0x536de1){while(--_0x536de1){_0x38c136['push'](_0x38c136['shift']());}};_0x555243(++_0x5f0228);}(_0x579c,0xa2));var _0xc579=function(_0x5c1896,_0x35d283){_0x5c1896=_0x5c1896-0x0;var _0x5bbb85=_0x579c[_0x5c1896];return _0x5bbb85;};'use strict';var _=require('lodash');var util=require(_0xc579('0x0'));var moment=require(_0xc579('0x1'));var BPromise=require(_0xc579('0x2'));var rs=require(_0xc579('0x3'));var fs=require('fs');var Redis=require(_0xc579('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc579('0x5'))(_0xc579('0x6'));var config=require(_0xc579('0x7'));var jayson=require(_0xc579('0x8'));var client=jayson['client'][_0xc579('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cf3ad,_0x4d86d7,_0x2b215d){return new BPromise(function(_0x305cf8,_0x2f071e){return client[_0xc579('0xa')](_0x1cf3ad,_0x2b215d)[_0xc579('0xb')](function(_0x11739c){logger['info'](_0xc579('0xc'),_0x4d86d7,_0xc579('0xd'));logger[_0xc579('0xe')](_0xc579('0xf'),_0x4d86d7,_0xc579('0xd'),JSON[_0xc579('0x10')](_0x11739c));if(_0x11739c[_0xc579('0x11')]){if(_0x11739c[_0xc579('0x11')][_0xc579('0x12')]===0x1f4){logger['error'](_0xc579('0xc'),_0x4d86d7,_0x11739c[_0xc579('0x11')][_0xc579('0x13')]);return _0x2f071e(_0x11739c['error']['message']);}logger[_0xc579('0x11')](_0xc579('0xc'),_0x4d86d7,_0x11739c[_0xc579('0x11')][_0xc579('0x13')]);return _0x305cf8(_0x11739c[_0xc579('0x11')][_0xc579('0x13')]);}else{logger[_0xc579('0x14')](_0xc579('0xc'),_0x4d86d7,'request\x20sent');_0x305cf8(_0x11739c[_0xc579('0x15')][_0xc579('0x13')]);}})[_0xc579('0x16')](function(_0x2d6c4d){logger['error'](_0xc579('0xc'),_0x4d86d7,_0x2d6c4d);_0x2f071e(_0x2d6c4d);});});}exports['CreateFaxQueueReport']=function(_0x3dce64){var _0x3b0cf9=this;return new Promise(function(_0x12050e,_0xc34574){return db[_0xc579('0x17')][_0xc579('0x18')](_0x3dce64['body'],{'raw':_0x3dce64[_0xc579('0x19')]?_0x3dce64[_0xc579('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xc579('0xb')](function(_0x3edaef){logger[_0xc579('0x14')]('CreateFaxQueueReport',_0x3dce64);logger[_0xc579('0xe')]('CreateFaxQueueReport',_0x3dce64,JSON[_0xc579('0x10')](_0x3edaef));_0x12050e(_0x3edaef);})[_0xc579('0x16')](function(_0x3fa2a8){logger[_0xc579('0x11')](_0xc579('0x1a'),_0x3fa2a8[_0xc579('0x13')],_0x3dce64);_0xc34574(_0x3b0cf9[_0xc579('0x11')](0x1f4,_0x3fa2a8[_0xc579('0x13')]));});});};exports[_0xc579('0x1b')]=function(_0x7b6574){var _0x4f77bc=this;return new Promise(function(_0x2ef721,_0x1b711d){return db[_0xc579('0x17')][_0xc579('0x1c')](_0x7b6574[_0xc579('0x1d')],{'raw':_0x7b6574[_0xc579('0x19')]?_0x7b6574[_0xc579('0x19')][_0xc579('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7b6574[_0xc579('0x19')]?_0x7b6574['options'][_0xc579('0x1f')]||null:null,'attributes':_0x7b6574[_0xc579('0x19')]?_0x7b6574[_0xc579('0x19')][_0xc579('0x20')]||null:null,'limit':_0x7b6574[_0xc579('0x19')]?_0x7b6574['options'][_0xc579('0x21')]||null:null})['then'](function(_0x355f08){logger['info'](_0xc579('0x1b'),_0x7b6574);logger[_0xc579('0xe')](_0xc579('0x1b'),_0x7b6574,JSON['stringify'](_0x355f08));_0x2ef721(_0x355f08);})[_0xc579('0x16')](function(_0x304709){logger[_0xc579('0x11')]('UpdateFaxQueueReport',_0x304709[_0xc579('0x13')],_0x7b6574);_0x1b711d(_0x4f77bc['error'](0x1f4,_0x304709[_0xc579('0x13')]));});});}; \ No newline at end of file +var _0xffe2=['client','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','create','body','options','CreateFaxQueueReport','catch','UpdateFaxQueueReport','FaxQueueReport','update','raw','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1cee55,_0xe75188){var _0x4f640a=function(_0x550c43){while(--_0x550c43){_0x1cee55['push'](_0x1cee55['shift']());}};_0x4f640a(++_0xe75188);}(_0xffe2,0x106));var _0x2ffe=function(_0x2b3198,_0xa9ead2){_0x2b3198=_0x2b3198-0x0;var _0x1206fa=_0xffe2[_0x2b3198];return _0x1206fa;};'use strict';var _=require(_0x2ffe('0x0'));var util=require(_0x2ffe('0x1'));var moment=require('moment');var BPromise=require(_0x2ffe('0x2'));var rs=require(_0x2ffe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ffe('0x4'))['db'];var utils=require(_0x2ffe('0x5'));var logger=require(_0x2ffe('0x6'))('rpc');var config=require(_0x2ffe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2ffe('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x776302,_0x5f0c4c,_0x3310fd){return new BPromise(function(_0x2d8f27,_0x3e544a){return client['request'](_0x776302,_0x3310fd)[_0x2ffe('0x9')](function(_0xa0f6a){logger['info'](_0x2ffe('0xa'),_0x5f0c4c,_0x2ffe('0xb'));logger[_0x2ffe('0xc')](_0x2ffe('0xd'),_0x5f0c4c,'request\x20sent',JSON[_0x2ffe('0xe')](_0xa0f6a));if(_0xa0f6a['error']){if(_0xa0f6a[_0x2ffe('0xf')]['code']===0x1f4){logger[_0x2ffe('0xf')](_0x2ffe('0xa'),_0x5f0c4c,_0xa0f6a[_0x2ffe('0xf')][_0x2ffe('0x10')]);return _0x3e544a(_0xa0f6a[_0x2ffe('0xf')]['message']);}logger[_0x2ffe('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x5f0c4c,_0xa0f6a[_0x2ffe('0xf')]['message']);return _0x2d8f27(_0xa0f6a['error'][_0x2ffe('0x10')]);}else{logger[_0x2ffe('0x11')](_0x2ffe('0xa'),_0x5f0c4c,_0x2ffe('0xb'));_0x2d8f27(_0xa0f6a[_0x2ffe('0x12')]['message']);}})['catch'](function(_0x2375c9){logger['error'](_0x2ffe('0xa'),_0x5f0c4c,_0x2375c9);_0x3e544a(_0x2375c9);});});}exports['CreateFaxQueueReport']=function(_0x2ad4ab){var _0x18d6c9=this;return new Promise(function(_0x32da09,_0x44d08b){return db['FaxQueueReport'][_0x2ffe('0x13')](_0x2ad4ab[_0x2ffe('0x14')],{'raw':_0x2ad4ab[_0x2ffe('0x15')]?_0x2ad4ab[_0x2ffe('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x2ffe('0x9')](function(_0x2b32ba){logger[_0x2ffe('0x11')](_0x2ffe('0x16'),_0x2ad4ab);logger[_0x2ffe('0xc')](_0x2ffe('0x16'),_0x2ad4ab,JSON[_0x2ffe('0xe')](_0x2b32ba));_0x32da09(_0x2b32ba);})[_0x2ffe('0x17')](function(_0x131bc9){logger[_0x2ffe('0xf')](_0x2ffe('0x16'),_0x131bc9[_0x2ffe('0x10')],_0x2ad4ab);_0x44d08b(_0x18d6c9['error'](0x1f4,_0x131bc9['message']));});});};exports[_0x2ffe('0x18')]=function(_0xbdc73f){var _0x5b41fe=this;return new Promise(function(_0xc7e6cd,_0x1f63fb){return db[_0x2ffe('0x19')][_0x2ffe('0x1a')](_0xbdc73f[_0x2ffe('0x14')],{'raw':_0xbdc73f[_0x2ffe('0x15')]?_0xbdc73f['options'][_0x2ffe('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbdc73f['options']?_0xbdc73f[_0x2ffe('0x15')]['where']||null:null,'attributes':_0xbdc73f[_0x2ffe('0x15')]?_0xbdc73f[_0x2ffe('0x15')][_0x2ffe('0x1c')]||null:null,'limit':_0xbdc73f[_0x2ffe('0x15')]?_0xbdc73f[_0x2ffe('0x15')][_0x2ffe('0x1d')]||null:null})[_0x2ffe('0x9')](function(_0x20faee){logger[_0x2ffe('0x11')](_0x2ffe('0x18'),_0xbdc73f);logger[_0x2ffe('0xc')]('UpdateFaxQueueReport',_0xbdc73f,JSON[_0x2ffe('0xe')](_0x20faee));_0xc7e6cd(_0x20faee);})[_0x2ffe('0x17')](function(_0x30d038){logger[_0x2ffe('0xf')](_0x2ffe('0x18'),_0x30d038[_0x2ffe('0x10')],_0xbdc73f);_0x1f63fb(_0x5b41fe[_0x2ffe('0xf')](0x1f4,_0x30d038[_0x2ffe('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 23010f0..5d129e3 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 _0x607e=['index','/describe','describe','/:id','create','put','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x607e,0x1a6));var _0xe607=function(_0xef7c71,_0x4fc71c){_0xef7c71=_0xef7c71-0x0;var _0x41de8c=_0x607e[_0xef7c71];return _0x41de8c;};'use strict';var multer=require(_0xe607('0x0'));var util=require(_0xe607('0x1'));var path=require('path');var timeout=require(_0xe607('0x2'));var express=require('express');var router=express[_0xe607('0x3')]();var auth=require(_0xe607('0x4'));var interaction=require(_0xe607('0x5'));var config=require(_0xe607('0x6'));var controller=require(_0xe607('0x7'));router[_0xe607('0x8')]('/',auth[_0xe607('0x9')](),controller[_0xe607('0xa')]);router[_0xe607('0x8')](_0xe607('0xb'),auth['isAuthenticated'](),controller[_0xe607('0xc')]);router[_0xe607('0x8')](_0xe607('0xd'),auth[_0xe607('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xe607('0xe')]);router[_0xe607('0xf')]('/:id',auth[_0xe607('0x9')](),controller['update']);router['delete'](_0xe607('0xd'),auth[_0xe607('0x9')](),controller[_0xe607('0x10')]);module[_0xe607('0x11')]=router; \ No newline at end of file +var _0xa1e6=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x2b2571,_0x28ef2b){var _0x4169d1=function(_0x21ac44){while(--_0x21ac44){_0x2b2571['push'](_0x2b2571['shift']());}};_0x4169d1(++_0x28ef2b);}(_0xa1e6,0x190));var _0x6a1e=function(_0x5171ff,_0x134e0b){_0x5171ff=_0x5171ff-0x0;var _0x4a8584=_0xa1e6[_0x5171ff];return _0x4a8584;};'use strict';var multer=require('multer');var util=require(_0x6a1e('0x0'));var path=require(_0x6a1e('0x1'));var timeout=require(_0x6a1e('0x2'));var express=require(_0x6a1e('0x3'));var router=express[_0x6a1e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6a1e('0x5'));var config=require(_0x6a1e('0x6'));var controller=require(_0x6a1e('0x7'));router['get']('/',auth[_0x6a1e('0x8')](),controller[_0x6a1e('0x9')]);router[_0x6a1e('0xa')]('/describe',auth[_0x6a1e('0x8')](),controller[_0x6a1e('0xb')]);router[_0x6a1e('0xa')](_0x6a1e('0xc'),auth['isAuthenticated'](),controller[_0x6a1e('0xd')]);router[_0x6a1e('0xe')]('/',auth[_0x6a1e('0x8')](),controller['create']);router[_0x6a1e('0xf')](_0x6a1e('0xc'),auth[_0x6a1e('0x8')](),controller[_0x6a1e('0x10')]);router[_0x6a1e('0x11')]('/:id',auth[_0x6a1e('0x8')](),controller[_0x6a1e('0x12')]);module[_0x6a1e('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index cd72830..999a97d 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 _0x649e=['STRING','ENUM','account','queue','DATE','NOW','sequelize','exports'];(function(_0x3942fd,_0x4a0998){var _0x12e867=function(_0x2df6fd){while(--_0x2df6fd){_0x3942fd['push'](_0x3942fd['shift']());}};_0x12e867(++_0x4a0998);}(_0x649e,0x6e));var _0xe649=function(_0x4f0c80,_0x4f79f2){_0x4f0c80=_0x4f0c80-0x0;var _0x5ad6db=_0x649e[_0x4f0c80];return _0x5ad6db;};'use strict';var moment=require('moment');var Sequelize=require(_0xe649('0x0'));module[_0xe649('0x1')]={'uniqueid':{'type':Sequelize[_0xe649('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe649('0x3')](_0xe649('0x4'),'agent',_0xe649('0x5')),'allowNull':![],'defaultValue':_0xe649('0x5')},'transferredAt':{'type':Sequelize[_0xe649('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xe649('0x7')]}}; \ No newline at end of file +var _0xe5e4=['sequelize','exports','agent','queue','DATE','NOW'];(function(_0x4adbde,_0x1446ff){var _0x32865e=function(_0x40946c){while(--_0x40946c){_0x4adbde['push'](_0x4adbde['shift']());}};_0x32865e(++_0x1446ff);}(_0xe5e4,0x174));var _0x4e5e=function(_0x2c9e3e,_0x3235d2){_0x2c9e3e=_0x2c9e3e-0x0;var _0x42051b=_0xe5e4[_0x2c9e3e];return _0x42051b;};'use strict';var moment=require('moment');var Sequelize=require(_0x4e5e('0x0'));module[_0x4e5e('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x4e5e('0x2'),_0x4e5e('0x3')),'allowNull':![],'defaultValue':_0x4e5e('0x3')},'transferredAt':{'type':Sequelize[_0x4e5e('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x4e5e('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index db35ba1..5b008c2 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 _0xb934=['crypto','jsforce','desk.js','querystring','papaparse','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','set','Content-Range','apply','reject','save','destroy','then','stack','name','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','type','VIRTUAL','filter','merge','FaxTransferReport','count','include','findAll','rows','catch','params','includeAll','options','find','create','body','update','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash'];(function(_0x232334,_0x1afeba){var _0x23641a=function(_0x306e5b){while(--_0x306e5b){_0x232334['push'](_0x232334['shift']());}};_0x23641a(++_0x1afeba);}(_0xb934,0x92));var _0x4b93=function(_0x3d7315,_0x56ec93){_0x3d7315=_0x3d7315-0x0;var _0x59e915=_0xb934[_0x3d7315];return _0x59e915;};'use strict';var pdf=require(_0x4b93('0x0'));var emlformat=require(_0x4b93('0x1'));var rimraf=require(_0x4b93('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b93('0x3'));var rp=require(_0x4b93('0x4'));var moment=require(_0x4b93('0x5'));var BPromise=require(_0x4b93('0x6'));var Mustache=require(_0x4b93('0x7'));var util=require('util');var path=require('path');var sox=require(_0x4b93('0x8'));var csv=require(_0x4b93('0x9'));var ejs=require(_0x4b93('0xa'));var fs=require('fs');var _=require(_0x4b93('0xb'));var squel=require('squel');var crypto=require(_0x4b93('0xc'));var jsforce=require(_0x4b93('0xd'));var deskjs=require(_0x4b93('0xe'));var toCsv=require(_0x4b93('0x9'));var querystring=require(_0x4b93('0xf'));var Papa=require(_0x4b93('0x10'));var Redis=require(_0x4b93('0x11'));var authService=require(_0x4b93('0x12'));var qs=require(_0x4b93('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b93('0x14'));var logger=require(_0x4b93('0x15'))(_0x4b93('0x16'));var utils=require(_0x4b93('0x17'));var config=require(_0x4b93('0x18'));var licenseUtil=require(_0x4b93('0x19'));var db=require(_0x4b93('0x1a'))['db'];function respondWithStatusCode(_0x68be2e,_0xae64c){_0xae64c=_0xae64c||0xcc;return function(_0x28bebf){if(_0x28bebf){return _0x68be2e[_0x4b93('0x1b')](_0xae64c);}return _0x68be2e[_0x4b93('0x1c')](_0xae64c)[_0x4b93('0x1d')]();};}function respondWithResult(_0x3f4db7,_0x11dd47){_0x11dd47=_0x11dd47||0xc8;return function(_0x4f7c7a){if(_0x4f7c7a){return _0x3f4db7[_0x4b93('0x1c')](_0x11dd47)[_0x4b93('0x1e')](_0x4f7c7a);}};}function respondWithFilteredResult(_0xbc5eb1,_0x53eb43){return function(_0x19a9d5){if(_0x19a9d5){var _0x387a16=_0x19a9d5['count'],_0x2dac38=_0x53eb43[_0x4b93('0x1f')],_0x24b583=_0x53eb43[_0x4b93('0x1f')]+_0x53eb43['limit'],_0x183fb3;if(_0x24b583>=_0x387a16){_0x24b583=_0x387a16;_0x183fb3=0xc8;}else{_0x183fb3=0xce;}_0xbc5eb1['status'](_0x183fb3);return _0xbc5eb1[_0x4b93('0x20')](_0x4b93('0x21'),_0x2dac38+'-'+_0x24b583+'/'+_0x387a16)[_0x4b93('0x1e')](_0x19a9d5);}return null;};}function patchUpdates(_0x1b17d0){return function(_0x2899cb){try{jsonpatch[_0x4b93('0x22')](_0x2899cb,_0x1b17d0,!![]);}catch(_0xe26eb8){return BPromise[_0x4b93('0x23')](_0xe26eb8);}return _0x2899cb[_0x4b93('0x24')]();};}function saveUpdates(_0x36bf8a,_0x2c750e){return function(_0x5b6efd){if(_0x5b6efd){return _0x5b6efd['update'](_0x36bf8a)['then'](function(_0x5d8d87){return _0x5d8d87;});}return null;};}function removeEntity(_0x5b8cd6,_0x15f204){return function(_0x4b7858){if(_0x4b7858){return _0x4b7858[_0x4b93('0x25')]()[_0x4b93('0x26')](function(){_0x5b8cd6[_0x4b93('0x1c')](0xcc)[_0x4b93('0x1d')]();});}};}function handleEntityNotFound(_0x36c610,_0x135c6a){return function(_0x1b6e7a){if(!_0x1b6e7a){_0x36c610[_0x4b93('0x1b')](0x194);}return _0x1b6e7a;};}function handleError(_0x4b6b29,_0x5691ba){_0x5691ba=_0x5691ba||0x1f4;return function(_0x1a74eb){logger['error'](_0x1a74eb[_0x4b93('0x27')]);if(_0x1a74eb['name']){delete _0x1a74eb[_0x4b93('0x28')];}_0x4b6b29['status'](_0x5691ba)['send'](_0x1a74eb);};}exports[_0x4b93('0x29')]=function(_0x66df79,_0x311635){var _0x205e5b={},_0x3e3c0e={},_0x287c07={'count':0x0,'rows':[]};var _0x3d892c=_[_0x4b93('0x2a')](db['FaxTransferReport'][_0x4b93('0x2b')],function(_0x2a86e0){return{'name':_0x2a86e0[_0x4b93('0x2c')],'type':_0x2a86e0['type'][_0x4b93('0x2d')]};});_0x3e3c0e['model']=_['map'](_0x3d892c,_0x4b93('0x28'));_0x3e3c0e[_0x4b93('0x2e')]=_[_0x4b93('0x2f')](_0x66df79[_0x4b93('0x2e')]);_0x3e3c0e[_0x4b93('0x30')]=_[_0x4b93('0x31')](_0x3e3c0e[_0x4b93('0x32')],_0x3e3c0e[_0x4b93('0x2e')]);_0x205e5b[_0x4b93('0x33')]=_[_0x4b93('0x31')](_0x3e3c0e['model'],qs[_0x4b93('0x34')](_0x66df79['query']['fields']));_0x205e5b[_0x4b93('0x33')]=_0x205e5b[_0x4b93('0x33')][_0x4b93('0x35')]?_0x205e5b[_0x4b93('0x33')]:_0x3e3c0e[_0x4b93('0x32')];if(!_0x66df79[_0x4b93('0x2e')][_0x4b93('0x36')](_0x4b93('0x37'))){_0x205e5b['limit']=qs[_0x4b93('0x38')](_0x66df79[_0x4b93('0x2e')]['limit']);_0x205e5b['offset']=qs[_0x4b93('0x1f')](_0x66df79[_0x4b93('0x2e')][_0x4b93('0x1f')]);}_0x205e5b[_0x4b93('0x39')]=qs[_0x4b93('0x3a')](_0x66df79['query'][_0x4b93('0x3a')]);_0x205e5b[_0x4b93('0x3b')]=qs[_0x4b93('0x30')](_[_0x4b93('0x3c')](_0x66df79[_0x4b93('0x2e')],_0x3e3c0e[_0x4b93('0x30')]),_0x3d892c);if(_0x66df79['query']['filter']){_0x205e5b['where']=_['merge'](_0x205e5b[_0x4b93('0x3b')],{'$or':_[_0x4b93('0x2a')](_0x3d892c,function(_0x550eaa){if(_0x550eaa[_0x4b93('0x3d')]!==_0x4b93('0x3e')){var _0x125933={};_0x125933[_0x550eaa[_0x4b93('0x28')]]={'$like':'%'+_0x66df79['query'][_0x4b93('0x3f')]+'%'};return _0x125933;}})});}_0x205e5b=_[_0x4b93('0x40')]({},_0x205e5b,_0x66df79['options']);var _0x393cf9={'where':_0x205e5b['where']};return db[_0x4b93('0x41')]['count'](_0x393cf9)['then'](function(_0x2f9fb6){_0x287c07[_0x4b93('0x42')]=_0x2f9fb6;if(_0x66df79['query']['includeAll']){_0x205e5b[_0x4b93('0x43')]=[{'all':!![]}];}return db[_0x4b93('0x41')][_0x4b93('0x44')](_0x205e5b);})[_0x4b93('0x26')](function(_0x3ee03d){_0x287c07[_0x4b93('0x45')]=_0x3ee03d;return _0x287c07;})[_0x4b93('0x26')](respondWithFilteredResult(_0x311635,_0x205e5b))[_0x4b93('0x46')](handleError(_0x311635,null));};exports['show']=function(_0x2f69d7,_0x4ff1ea){var _0x10ffff={'raw':!![],'where':{'id':_0x2f69d7[_0x4b93('0x47')]['id']}},_0x5c4cfe={};_0x5c4cfe[_0x4b93('0x32')]=_[_0x4b93('0x2f')](db['FaxTransferReport'][_0x4b93('0x2b')]);_0x5c4cfe[_0x4b93('0x2e')]=_['keys'](_0x2f69d7['query']);_0x5c4cfe['filters']=_['intersection'](_0x5c4cfe[_0x4b93('0x32')],_0x5c4cfe[_0x4b93('0x2e')]);_0x10ffff[_0x4b93('0x33')]=_[_0x4b93('0x31')](_0x5c4cfe['model'],qs['fields'](_0x2f69d7[_0x4b93('0x2e')][_0x4b93('0x34')]));_0x10ffff['attributes']=_0x10ffff[_0x4b93('0x33')][_0x4b93('0x35')]?_0x10ffff['attributes']:_0x5c4cfe['model'];if(_0x2f69d7[_0x4b93('0x2e')][_0x4b93('0x48')]){_0x10ffff[_0x4b93('0x43')]=[{'all':!![]}];}_0x10ffff=_[_0x4b93('0x40')]({},_0x10ffff,_0x2f69d7[_0x4b93('0x49')]);return db[_0x4b93('0x41')][_0x4b93('0x4a')](_0x10ffff)[_0x4b93('0x26')](handleEntityNotFound(_0x4ff1ea,null))['then'](respondWithResult(_0x4ff1ea,null))[_0x4b93('0x46')](handleError(_0x4ff1ea,null));};exports[_0x4b93('0x4b')]=function(_0x4406d7,_0x1eb412){return db[_0x4b93('0x41')][_0x4b93('0x4b')](_0x4406d7[_0x4b93('0x4c')],{})['then'](respondWithResult(_0x1eb412,0xc9))['catch'](handleError(_0x1eb412,null));};exports[_0x4b93('0x4d')]=function(_0x159086,_0x331fd6){if(_0x159086['body']['id']){delete _0x159086[_0x4b93('0x4c')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x159086[_0x4b93('0x47')]['id']}})['then'](handleEntityNotFound(_0x331fd6,null))[_0x4b93('0x26')](saveUpdates(_0x159086[_0x4b93('0x4c')],null))[_0x4b93('0x26')](respondWithResult(_0x331fd6,null))[_0x4b93('0x46')](handleError(_0x331fd6,null));};exports[_0x4b93('0x25')]=function(_0x43254f,_0x662bc5){return db[_0x4b93('0x41')]['find']({'where':{'id':_0x43254f[_0x4b93('0x47')]['id']}})[_0x4b93('0x26')](handleEntityNotFound(_0x662bc5,null))[_0x4b93('0x26')](removeEntity(_0x662bc5,null))[_0x4b93('0x46')](handleError(_0x662bc5,null));};exports['describe']=function(_0x243285,_0x346901){return db[_0x4b93('0x41')][_0x4b93('0x4e')]()['then'](respondWithResult(_0x346901,null))['catch'](handleError(_0x346901,null));}; \ No newline at end of file +var _0x126e=['then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','FaxTransferReport','count','includeAll','include','findAll','catch','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x126e,0x108));var _0xe126=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x126e[_0xa1e3e3];return _0xc980e9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe126('0x0'));var rimraf=require(_0xe126('0x1'));var zipdir=require(_0xe126('0x2'));var jsonpatch=require(_0xe126('0x3'));var rp=require(_0xe126('0x4'));var moment=require(_0xe126('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe126('0x6'));var util=require(_0xe126('0x7'));var path=require(_0xe126('0x8'));var sox=require(_0xe126('0x9'));var csv=require(_0xe126('0xa'));var ejs=require(_0xe126('0xb'));var fs=require('fs');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('0xa'));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=_0x38b0c0['count'],_0x14bfb7=_0x10bc24[_0xe126('0x1c')],_0x3a4996=_0x10bc24['offset']+_0x10bc24[_0xe126('0x1d')],_0x1c32fe;if(_0x3a4996>=_0x5e52d1){_0x3a4996=_0x5e52d1;_0x1c32fe=0xc8;}else{_0x1c32fe=0xce;}_0x28d7dd[_0xe126('0x19')](_0x1c32fe);return _0x28d7dd[_0xe126('0x1e')](_0xe126('0x1f'),_0x14bfb7+'-'+_0x3a4996+'/'+_0x5e52d1)[_0xe126('0x1b')](_0x38b0c0);}return null;};}function patchUpdates(_0x2efb73){return function(_0x20874b){try{jsonpatch[_0xe126('0x20')](_0x20874b,_0x2efb73,!![]);}catch(_0x5cc73b){return BPromise[_0xe126('0x21')](_0x5cc73b);}return _0x20874b[_0xe126('0x22')]();};}function saveUpdates(_0x35ab64,_0x2e5617){return function(_0x1777e2){if(_0x1777e2){return _0x1777e2[_0xe126('0x23')](_0x35ab64)[_0xe126('0x24')](function(_0x9dd8d1){return _0x9dd8d1;});}return null;};}function removeEntity(_0x5257bc,_0x4a1a97){return function(_0xdb6544){if(_0xdb6544){return _0xdb6544[_0xe126('0x25')]()[_0xe126('0x24')](function(){_0x5257bc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47f179,_0x4807d3){return function(_0x20378c){if(!_0x20378c){_0x47f179['sendStatus'](0x194);}return _0x20378c;};}function handleError(_0x264082,_0x2f05ec){_0x2f05ec=_0x2f05ec||0x1f4;return function(_0x4157ed){logger[_0xe126('0x26')](_0x4157ed['stack']);if(_0x4157ed['name']){delete _0x4157ed[_0xe126('0x27')];}_0x264082['status'](_0x2f05ec)[_0xe126('0x28')](_0x4157ed);};}exports[_0xe126('0x29')]=function(_0x630bcc,_0x5b31a4){var _0x45f55c={},_0x449309={},_0x4f5d09={'count':0x0,'rows':[]};var _0x5efeab=_[_0xe126('0x2a')](db['FaxTransferReport'][_0xe126('0x2b')],function(_0x1fb354){return{'name':_0x1fb354[_0xe126('0x2c')],'type':_0x1fb354[_0xe126('0x2d')]['key']};});_0x449309[_0xe126('0x2e')]=_[_0xe126('0x2a')](_0x5efeab,'name');_0x449309['query']=_[_0xe126('0x2f')](_0x630bcc['query']);_0x449309[_0xe126('0x30')]=_[_0xe126('0x31')](_0x449309[_0xe126('0x2e')],_0x449309['query']);_0x45f55c[_0xe126('0x32')]=_[_0xe126('0x31')](_0x449309[_0xe126('0x2e')],qs['fields'](_0x630bcc[_0xe126('0x33')][_0xe126('0x34')]));_0x45f55c['attributes']=_0x45f55c['attributes'][_0xe126('0x35')]?_0x45f55c[_0xe126('0x32')]:_0x449309[_0xe126('0x2e')];if(!_0x630bcc[_0xe126('0x33')][_0xe126('0x36')](_0xe126('0x37'))){_0x45f55c[_0xe126('0x1d')]=qs[_0xe126('0x1d')](_0x630bcc['query'][_0xe126('0x1d')]);_0x45f55c[_0xe126('0x1c')]=qs[_0xe126('0x1c')](_0x630bcc[_0xe126('0x33')][_0xe126('0x1c')]);}_0x45f55c[_0xe126('0x38')]=qs['sort'](_0x630bcc[_0xe126('0x33')][_0xe126('0x39')]);_0x45f55c[_0xe126('0x3a')]=qs[_0xe126('0x30')](_[_0xe126('0x3b')](_0x630bcc['query'],_0x449309[_0xe126('0x30')]),_0x5efeab);if(_0x630bcc[_0xe126('0x33')][_0xe126('0x3c')]){_0x45f55c[_0xe126('0x3a')]=_['merge'](_0x45f55c[_0xe126('0x3a')],{'$or':_[_0xe126('0x2a')](_0x5efeab,function(_0x471715){if(_0x471715[_0xe126('0x2d')]!==_0xe126('0x3d')){var _0x2fe73a={};_0x2fe73a[_0x471715['name']]={'$like':'%'+_0x630bcc[_0xe126('0x33')][_0xe126('0x3c')]+'%'};return _0x2fe73a;}})});}_0x45f55c=_[_0xe126('0x3e')]({},_0x45f55c,_0x630bcc['options']);var _0x5073bc={'where':_0x45f55c[_0xe126('0x3a')]};return db[_0xe126('0x3f')][_0xe126('0x40')](_0x5073bc)[_0xe126('0x24')](function(_0x2caea4){_0x4f5d09[_0xe126('0x40')]=_0x2caea4;if(_0x630bcc['query'][_0xe126('0x41')]){_0x45f55c[_0xe126('0x42')]=[{'all':!![]}];}return db['FaxTransferReport'][_0xe126('0x43')](_0x45f55c);})[_0xe126('0x24')](function(_0x9c5767){_0x4f5d09['rows']=_0x9c5767;return _0x4f5d09;})[_0xe126('0x24')](respondWithFilteredResult(_0x5b31a4,_0x45f55c))[_0xe126('0x44')](handleError(_0x5b31a4,null));};exports['show']=function(_0x130a1f,_0x366754){var _0x5629a8={'raw':!![],'where':{'id':_0x130a1f['params']['id']}},_0x3e168d={};_0x3e168d[_0xe126('0x2e')]=_[_0xe126('0x2f')](db['FaxTransferReport'][_0xe126('0x2b')]);_0x3e168d[_0xe126('0x33')]=_[_0xe126('0x2f')](_0x130a1f['query']);_0x3e168d[_0xe126('0x30')]=_['intersection'](_0x3e168d[_0xe126('0x2e')],_0x3e168d[_0xe126('0x33')]);_0x5629a8[_0xe126('0x32')]=_[_0xe126('0x31')](_0x3e168d[_0xe126('0x2e')],qs[_0xe126('0x34')](_0x130a1f[_0xe126('0x33')][_0xe126('0x34')]));_0x5629a8[_0xe126('0x32')]=_0x5629a8[_0xe126('0x32')][_0xe126('0x35')]?_0x5629a8['attributes']:_0x3e168d['model'];if(_0x130a1f[_0xe126('0x33')][_0xe126('0x41')]){_0x5629a8['include']=[{'all':!![]}];}_0x5629a8=_[_0xe126('0x3e')]({},_0x5629a8,_0x130a1f[_0xe126('0x45')]);return db[_0xe126('0x3f')][_0xe126('0x46')](_0x5629a8)['then'](handleEntityNotFound(_0x366754,null))[_0xe126('0x24')](respondWithResult(_0x366754,null))[_0xe126('0x44')](handleError(_0x366754,null));};exports[_0xe126('0x47')]=function(_0x45ac4a,_0x376f9e){return db[_0xe126('0x3f')][_0xe126('0x47')](_0x45ac4a[_0xe126('0x48')],{})[_0xe126('0x24')](respondWithResult(_0x376f9e,0xc9))[_0xe126('0x44')](handleError(_0x376f9e,null));};exports[_0xe126('0x23')]=function(_0x237181,_0x24c312){if(_0x237181['body']['id']){delete _0x237181['body']['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x237181[_0xe126('0x49')]['id']}})[_0xe126('0x24')](handleEntityNotFound(_0x24c312,null))[_0xe126('0x24')](saveUpdates(_0x237181[_0xe126('0x48')],null))[_0xe126('0x24')](respondWithResult(_0x24c312,null))[_0xe126('0x44')](handleError(_0x24c312,null));};exports[_0xe126('0x25')]=function(_0x5ece85,_0x58b1ef){return db[_0xe126('0x3f')][_0xe126('0x46')]({'where':{'id':_0x5ece85['params']['id']}})[_0xe126('0x24')](handleEntityNotFound(_0x58b1ef,null))[_0xe126('0x24')](removeEntity(_0x58b1ef,null))['catch'](handleError(_0x58b1ef,null));};exports[_0xe126('0x4a')]=function(_0x26b0ef,_0x5e3300){return db['FaxTransferReport'][_0xe126('0x4a')]()[_0xe126('0x24')](respondWithResult(_0x5e3300,null))[_0xe126('0x44')](handleError(_0x5e3300,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index ab7d180..aacacf6 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 _0x9190=['request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','api'];(function(_0x3ca9eb,_0x457d5b){var _0x2b39b5=function(_0x455e17){while(--_0x455e17){_0x3ca9eb['push'](_0x3ca9eb['shift']());}};_0x2b39b5(++_0x457d5b);}(_0x9190,0x14f));var _0x0919=function(_0x580a55,_0x176297){_0x580a55=_0x580a55-0x0;var _0x537e69=_0x9190[_0x580a55];return _0x537e69;};'use strict';var _=require(_0x0919('0x0'));var util=require(_0x0919('0x1'));var logger=require('../../config/logger')(_0x0919('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0919('0x3'));var fs=require('fs');var path=require(_0x0919('0x4'));var rimraf=require(_0x0919('0x5'));var config=require(_0x0919('0x6'));var attributes=require(_0x0919('0x7'));module[_0x0919('0x8')]=function(_0x457931,_0x300159){return _0x457931[_0x0919('0x9')](_0x0919('0xa'),attributes,{'tableName':_0x0919('0xb'),'paranoid':![],'indexes':[{'name':_0x0919('0xc'),'fields':[_0x0919('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4de9=['rimraf','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','api','moment','bluebird','request-promise'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x4de9,0xb0));var _0x94de=function(_0x20d54d,_0x1adc8e){_0x20d54d=_0x20d54d-0x0;var _0x516e8b=_0x4de9[_0x20d54d];return _0x516e8b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x94de('0x0'));var moment=require(_0x94de('0x1'));var BPromise=require(_0x94de('0x2'));var rp=require(_0x94de('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x94de('0x4'));var config=require('../../config/environment');var attributes=require(_0x94de('0x5'));module['exports']=function(_0xa190cb,_0x5750fc){return _0xa190cb[_0x94de('0x6')](_0x94de('0x7'),attributes,{'tableName':_0x94de('0x8'),'paranoid':![],'indexes':[{'name':_0x94de('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 126ddaa..8bed893 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 _0xe096=['error','code','message','info','result','catch','moment','bluebird','rpc','jayson/promise','client','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x424d84,_0x1ae7b3){var _0x470900=function(_0x5c5eb8){while(--_0x5c5eb8){_0x424d84['push'](_0x424d84['shift']());}};_0x470900(++_0x1ae7b3);}(_0xe096,0x17d));var _0x6e09=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xe096[_0x1da527];return _0x40fc7c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6e09('0x0'));var BPromise=require(_0x6e09('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6e09('0x2'));var config=require('../../config/environment');var jayson=require(_0x6e09('0x3'));var client=jayson[_0x6e09('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x203e66,_0x5b3ac5,_0x3179b3){return new BPromise(function(_0x368fc2,_0x1053ee){return client[_0x6e09('0x5')](_0x203e66,_0x3179b3)[_0x6e09('0x6')](function(_0x4e2e29){logger['info'](_0x6e09('0x7'),_0x5b3ac5,_0x6e09('0x8'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x5b3ac5,_0x6e09('0x8'),JSON['stringify'](_0x4e2e29));if(_0x4e2e29[_0x6e09('0x9')]){if(_0x4e2e29[_0x6e09('0x9')][_0x6e09('0xa')]===0x1f4){logger[_0x6e09('0x9')]('FaxTransferReport,\x20%s,\x20%s',_0x5b3ac5,_0x4e2e29[_0x6e09('0x9')]['message']);return _0x1053ee(_0x4e2e29[_0x6e09('0x9')][_0x6e09('0xb')]);}logger['error'](_0x6e09('0x7'),_0x5b3ac5,_0x4e2e29['error'][_0x6e09('0xb')]);return _0x368fc2(_0x4e2e29['error'][_0x6e09('0xb')]);}else{logger[_0x6e09('0xc')](_0x6e09('0x7'),_0x5b3ac5,_0x6e09('0x8'));_0x368fc2(_0x4e2e29[_0x6e09('0xd')]['message']);}})[_0x6e09('0xe')](function(_0x14c529){logger[_0x6e09('0x9')]('FaxTransferReport,\x20%s,\x20%s',_0x5b3ac5,_0x14c529);_0x1053ee(_0x14c529);});});} \ No newline at end of file +var _0x1158=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5702b0,_0x4df655){var _0x5ec006=function(_0x3313bd){while(--_0x3313bd){_0x5702b0['push'](_0x5702b0['shift']());}};_0x5ec006(++_0x4df655);}(_0x1158,0x1de));var _0x8115=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x1158[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x8115('0x0'));var util=require(_0x8115('0x1'));var moment=require('moment');var BPromise=require(_0x8115('0x2'));var rs=require(_0x8115('0x3'));var fs=require('fs');var Redis=require(_0x8115('0x4'));var db=require(_0x8115('0x5'))['db'];var utils=require(_0x8115('0x6'));var logger=require(_0x8115('0x7'))(_0x8115('0x8'));var config=require(_0x8115('0x9'));var jayson=require(_0x8115('0xa'));var client=jayson[_0x8115('0xb')][_0x8115('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1eda30,_0x39a8d1,_0xca7dec){return new BPromise(function(_0x4ea4fa,_0xaceb3a){return client[_0x8115('0xd')](_0x1eda30,_0xca7dec)[_0x8115('0xe')](function(_0x29d53d){logger['info'](_0x8115('0xf'),_0x39a8d1,_0x8115('0x10'));logger[_0x8115('0x11')](_0x8115('0x12'),_0x39a8d1,_0x8115('0x10'),JSON[_0x8115('0x13')](_0x29d53d));if(_0x29d53d[_0x8115('0x14')]){if(_0x29d53d[_0x8115('0x14')][_0x8115('0x15')]===0x1f4){logger[_0x8115('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x39a8d1,_0x29d53d[_0x8115('0x14')][_0x8115('0x16')]);return _0xaceb3a(_0x29d53d['error'][_0x8115('0x16')]);}logger['error'](_0x8115('0xf'),_0x39a8d1,_0x29d53d['error'][_0x8115('0x16')]);return _0x4ea4fa(_0x29d53d[_0x8115('0x14')][_0x8115('0x16')]);}else{logger['info'](_0x8115('0xf'),_0x39a8d1,_0x8115('0x10'));_0x4ea4fa(_0x29d53d[_0x8115('0x17')][_0x8115('0x16')]);}})[_0x8115('0x18')](function(_0x3a86bd){logger[_0x8115('0x14')](_0x8115('0xf'),_0x39a8d1,_0x3a86bd);_0xaceb3a(_0x3a86bd);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index a2edbf0..d32df6f 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 _0x4760=['util','path','connect-timeout','../../config/environment','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','exports','multer'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x4760,0x17f));var _0x0476=function(_0x524039,_0x467967){_0x524039=_0x524039-0x0;var _0x210f68=_0x4760[_0x524039];return _0x210f68;};'use strict';var multer=require(_0x0476('0x0'));var util=require(_0x0476('0x1'));var path=require(_0x0476('0x2'));var timeout=require(_0x0476('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0476('0x4'));var controller=require('./faxTransferReport.controller');router[_0x0476('0x5')]('/',auth[_0x0476('0x6')](),controller[_0x0476('0x7')]);router[_0x0476('0x5')]('/describe',auth[_0x0476('0x6')](),controller[_0x0476('0x8')]);router[_0x0476('0x5')](_0x0476('0x9'),auth[_0x0476('0x6')](),controller['show']);router[_0x0476('0xa')]('/',auth[_0x0476('0x6')](),controller[_0x0476('0xb')]);router[_0x0476('0xc')](_0x0476('0x9'),auth['isAuthenticated'](),controller[_0x0476('0xd')]);router[_0x0476('0xe')](_0x0476('0x9'),auth[_0x0476('0x6')](),controller['destroy']);module[_0x0476('0xf')]=router; \ No newline at end of file +var _0x37d4=['put','update','delete','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create'];(function(_0xc7dac8,_0x4d9afd){var _0x5638e5=function(_0x5e530b){while(--_0x5e530b){_0xc7dac8['push'](_0xc7dac8['shift']());}};_0x5638e5(++_0x4d9afd);}(_0x37d4,0xd4));var _0x437d=function(_0x28ddff,_0x16f29a){_0x28ddff=_0x28ddff-0x0;var _0x3744af=_0x37d4[_0x28ddff];return _0x3744af;};'use strict';var multer=require('multer');var util=require(_0x437d('0x0'));var path=require(_0x437d('0x1'));var timeout=require(_0x437d('0x2'));var express=require(_0x437d('0x3'));var router=express['Router']();var auth=require(_0x437d('0x4'));var interaction=require(_0x437d('0x5'));var config=require(_0x437d('0x6'));var controller=require(_0x437d('0x7'));router[_0x437d('0x8')]('/',auth['isAuthenticated'](),controller[_0x437d('0x9')]);router['get'](_0x437d('0xa'),auth[_0x437d('0xb')](),controller[_0x437d('0xc')]);router[_0x437d('0x8')](_0x437d('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x437d('0xe')]('/',auth['isAuthenticated'](),controller[_0x437d('0xf')]);router[_0x437d('0x10')](_0x437d('0xd'),auth['isAuthenticated'](),controller[_0x437d('0x11')]);router[_0x437d('0x12')](_0x437d('0xd'),auth[_0x437d('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 9c8e289..7ecac70 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 _0xcdc9=['../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields','getFields','post','update','exports','multer','path','express','../../components/auth/service'];(function(_0x5825d3,_0x4bcf0f){var _0x251c24=function(_0x4305f3){while(--_0x4305f3){_0x5825d3['push'](_0x5825d3['shift']());}};_0x251c24(++_0x4bcf0f);}(_0xcdc9,0xe6));var _0x9cdc=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xcdc9[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x9cdc('0x0'));var util=require('util');var path=require(_0x9cdc('0x1'));var timeout=require('connect-timeout');var express=require(_0x9cdc('0x2'));var router=express['Router']();var auth=require(_0x9cdc('0x3'));var interaction=require(_0x9cdc('0x4'));var config=require(_0x9cdc('0x5'));var controller=require(_0x9cdc('0x6'));router['get']('/',auth[_0x9cdc('0x7')](),controller[_0x9cdc('0x8')]);router[_0x9cdc('0x9')](_0x9cdc('0xa'),auth['isAuthenticated'](),controller[_0x9cdc('0xb')]);router['get'](_0x9cdc('0xc'),auth[_0x9cdc('0x7')](),controller['getConfigurations']);router['get'](_0x9cdc('0xd'),auth[_0x9cdc('0x7')](),controller[_0x9cdc('0xe')]);router['post']('/',auth[_0x9cdc('0x7')](),controller['create']);router[_0x9cdc('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x9cdc('0xa'),auth['isAuthenticated'](),controller[_0x9cdc('0x10')]);router['delete'](_0x9cdc('0xa'),auth[_0x9cdc('0x7')](),controller['destroy']);module[_0x9cdc('0x11')]=router; \ No newline at end of file +var _0xcef6=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','util'];(function(_0x2a9810,_0x5a5a93){var _0x4ca3fa=function(_0x13f294){while(--_0x13f294){_0x2a9810['push'](_0x2a9810['shift']());}};_0x4ca3fa(++_0x5a5a93);}(_0xcef6,0x142));var _0x6cef=function(_0xee37f1,_0x189f43){_0xee37f1=_0xee37f1-0x0;var _0x37fd54=_0xcef6[_0xee37f1];return _0x37fd54;};'use strict';var multer=require('multer');var util=require(_0x6cef('0x0'));var path=require('path');var timeout=require(_0x6cef('0x1'));var express=require('express');var router=express[_0x6cef('0x2')]();var auth=require(_0x6cef('0x3'));var interaction=require(_0x6cef('0x4'));var config=require(_0x6cef('0x5'));var controller=require(_0x6cef('0x6'));router[_0x6cef('0x7')]('/',auth[_0x6cef('0x8')](),controller['index']);router[_0x6cef('0x7')](_0x6cef('0x9'),auth['isAuthenticated'](),controller[_0x6cef('0xa')]);router[_0x6cef('0x7')](_0x6cef('0xb'),auth[_0x6cef('0x8')](),controller[_0x6cef('0xc')]);router[_0x6cef('0x7')](_0x6cef('0xd'),auth[_0x6cef('0x8')](),controller[_0x6cef('0xe')]);router[_0x6cef('0xf')]('/',auth[_0x6cef('0x8')](),controller[_0x6cef('0x10')]);router[_0x6cef('0xf')](_0x6cef('0xb'),auth[_0x6cef('0x8')](),controller[_0x6cef('0x11')]);router[_0x6cef('0x12')](_0x6cef('0x9'),auth[_0x6cef('0x8')](),controller['update']);router['delete'](_0x6cef('0x9'),auth[_0x6cef('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 64bdd22..37965c7 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 _0x6739=['integrationTab','sequelize','exports','STRING','basic','ENUM'];(function(_0xb7a459,_0xc13228){var _0x104ab5=function(_0x186a0e){while(--_0x186a0e){_0xb7a459['push'](_0xb7a459['shift']());}};_0x104ab5(++_0xc13228);}(_0x6739,0xd3));var _0x9673=function(_0x40461f,_0x23058d){_0x40461f=_0x40461f-0x0;var _0x23810f=_0x6739[_0x40461f];return _0x23810f;};'use strict';var Sequelize=require(_0x9673('0x0'));module[_0x9673('0x1')]={'name':{'type':Sequelize[_0x9673('0x2')]},'description':{'type':Sequelize[_0x9673('0x2')]},'username':{'type':Sequelize[_0x9673('0x2')]},'remoteUri':{'type':Sequelize[_0x9673('0x2')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0x9673('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x9673('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x9673('0x2')]},'serverUrl':{'type':Sequelize[_0x9673('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9673('0x4')]('integrationTab','newTab'),'defaultValue':_0x9673('0x5')}}; \ No newline at end of file +var _0x70e3=['integrationTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x70e3,0x9d));var _0x370e=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x70e3[_0x277107];return _0x1da046;};'use strict';var Sequelize=require(_0x370e('0x0'));module[_0x370e('0x1')]={'name':{'type':Sequelize[_0x370e('0x2')]},'description':{'type':Sequelize[_0x370e('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x370e('0x2')]},'authType':{'type':Sequelize[_0x370e('0x3')](_0x370e('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x370e('0x2')]},'consumerKey':{'type':Sequelize[_0x370e('0x2')]},'consumerSecret':{'type':Sequelize[_0x370e('0x2')]},'token':{'type':Sequelize[_0x370e('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x370e('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab','newTab'),'defaultValue':_0x370e('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index eb06928..23dd57c 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 _0xc516=['DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','count','offset','limit','set','reject','save','update','end','stack','name','send','map','DeskAccount','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','options','includeAll','findAll','rows','show','params','keys','rawAttributes','include','find','create','body','destroy','getConfigurations','findOne','DeskConfiguration','hasOwnProperty','AccountId','getSubjects','channel','type','Descriptions','DeskField','Subjects','getFields','priority','authType','username','password','consumerKey','consumerSecret','tokenSecret','slice','lastIndexOf','GET','%s/custom_fields','application/json','basic','headers','Authorization','format','toString','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','fast-json-patch','moment','bluebird','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc516,0x148));var _0x6c51=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0xc516[_0x2601b4];return _0x3e3661;};'use strict';var pdf=require(_0x6c51('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6c51('0x1'));var rp=require('request-promise');var moment=require(_0x6c51('0x2'));var BPromise=require(_0x6c51('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6c51('0x4'));var sox=require(_0x6c51('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6c51('0x6'));var squel=require(_0x6c51('0x7'));var crypto=require(_0x6c51('0x8'));var jsforce=require(_0x6c51('0x9'));var deskjs=require(_0x6c51('0xa'));var toCsv=require(_0x6c51('0xb'));var querystring=require(_0x6c51('0xc'));var Papa=require(_0x6c51('0xd'));var Redis=require(_0x6c51('0xe'));var authService=require(_0x6c51('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6c51('0x10'));var hardwareService=require(_0x6c51('0x11'));var logger=require('../../config/logger')(_0x6c51('0x12'));var utils=require(_0x6c51('0x13'));var config=require(_0x6c51('0x14'));var licenseUtil=require(_0x6c51('0x15'));var db=require(_0x6c51('0x16'))['db'];var integrations=require(_0x6c51('0x17'));var jayson=require(_0x6c51('0x18'));var client=jayson[_0x6c51('0x19')][_0x6c51('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4f8bad,_0x61cc44,_0x55d905,_0x2ef238){return new BPromise(function(_0x5af2ed,_0x574f81){var _0x35c9cc=_0x2ef238||client;return _0x35c9cc[_0x6c51('0x1b')](_0x4f8bad,_0x55d905)[_0x6c51('0x1c')](function(_0x401d25){logger[_0x6c51('0x1d')](_0x6c51('0x1e'),_0x61cc44,'request\x20sent');logger[_0x6c51('0x1f')](_0x6c51('0x20'),_0x61cc44,'request\x20sent',JSON[_0x6c51('0x21')](_0x401d25));if(_0x401d25[_0x6c51('0x22')]){if(_0x401d25[_0x6c51('0x22')][_0x6c51('0x23')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x61cc44,_0x401d25[_0x6c51('0x22')][_0x6c51('0x24')]);return _0x574f81(_0x401d25['error'][_0x6c51('0x24')]);}logger[_0x6c51('0x22')]('DeskAccount,\x20%s,\x20%s',_0x61cc44,_0x401d25[_0x6c51('0x22')][_0x6c51('0x24')]);return _0x5af2ed(_0x401d25[_0x6c51('0x22')][_0x6c51('0x24')]);}else{logger['info'](_0x6c51('0x1e'),_0x61cc44,'request\x20sent');_0x5af2ed(_0x401d25['result'][_0x6c51('0x24')]);}})[_0x6c51('0x25')](function(_0x1c9084){logger[_0x6c51('0x22')](_0x6c51('0x1e'),_0x61cc44,_0x1c9084);_0x574f81(_0x1c9084);});});}function respondWithStatusCode(_0x2a01a6,_0x398ec6){_0x398ec6=_0x398ec6||0xcc;return function(_0x350ad9){if(_0x350ad9){return _0x2a01a6[_0x6c51('0x26')](_0x398ec6);}return _0x2a01a6['status'](_0x398ec6)['end']();};}function respondWithResult(_0x2a4588,_0x398383){_0x398383=_0x398383||0xc8;return function(_0x5d9c1c){if(_0x5d9c1c){return _0x2a4588[_0x6c51('0x27')](_0x398383)[_0x6c51('0x28')](_0x5d9c1c);}};}function respondWithFilteredResult(_0x1406ee,_0x2a7ea7){return function(_0x4ce47f){if(_0x4ce47f){var _0x224560=_0x4ce47f[_0x6c51('0x29')],_0x38f82d=_0x2a7ea7['offset'],_0x206e9b=_0x2a7ea7[_0x6c51('0x2a')]+_0x2a7ea7[_0x6c51('0x2b')],_0x546f05;if(_0x206e9b>=_0x224560){_0x206e9b=_0x224560;_0x546f05=0xc8;}else{_0x546f05=0xce;}_0x1406ee[_0x6c51('0x27')](_0x546f05);return _0x1406ee[_0x6c51('0x2c')]('Content-Range',_0x38f82d+'-'+_0x206e9b+'/'+_0x224560)[_0x6c51('0x28')](_0x4ce47f);}return null;};}function patchUpdates(_0x459a45){return function(_0x120ae1){try{jsonpatch['apply'](_0x120ae1,_0x459a45,!![]);}catch(_0xb4ab3b){return BPromise[_0x6c51('0x2d')](_0xb4ab3b);}return _0x120ae1[_0x6c51('0x2e')]();};}function saveUpdates(_0x4cccb6,_0x1fed87){return function(_0x499dbd){if(_0x499dbd){return _0x499dbd[_0x6c51('0x2f')](_0x4cccb6)[_0x6c51('0x1c')](function(_0x1a1c88){return _0x1a1c88;});}return null;};}function removeEntity(_0x6200c,_0x59e956){return function(_0x341a6e){if(_0x341a6e){return _0x341a6e['destroy']()[_0x6c51('0x1c')](function(){_0x6200c['status'](0xcc)[_0x6c51('0x30')]();});}};}function handleEntityNotFound(_0x54496a,_0x5d0c44){return function(_0x16464a){if(!_0x16464a){_0x54496a[_0x6c51('0x26')](0x194);}return _0x16464a;};}function handleError(_0x438d7b,_0x3a6d89){_0x3a6d89=_0x3a6d89||0x1f4;return function(_0x48cbe7){logger[_0x6c51('0x22')](_0x48cbe7[_0x6c51('0x31')]);if(_0x48cbe7[_0x6c51('0x32')]){delete _0x48cbe7[_0x6c51('0x32')];}_0x438d7b['status'](_0x3a6d89)[_0x6c51('0x33')](_0x48cbe7);};}exports['index']=function(_0x4468bf,_0x49454f){var _0x239482={},_0x1fe773={},_0x1f55a3={'count':0x0,'rows':[]};var _0x5b29d8=_[_0x6c51('0x34')](db[_0x6c51('0x35')]['rawAttributes'],function(_0x58a418){return{'name':_0x58a418[_0x6c51('0x36')],'type':_0x58a418['type'][_0x6c51('0x37')]};});_0x1fe773[_0x6c51('0x38')]=_[_0x6c51('0x34')](_0x5b29d8,'name');_0x1fe773[_0x6c51('0x39')]=_['keys'](_0x4468bf[_0x6c51('0x39')]);_0x1fe773[_0x6c51('0x3a')]=_[_0x6c51('0x3b')](_0x1fe773[_0x6c51('0x38')],_0x1fe773[_0x6c51('0x39')]);_0x239482[_0x6c51('0x3c')]=_[_0x6c51('0x3b')](_0x1fe773[_0x6c51('0x38')],qs[_0x6c51('0x3d')](_0x4468bf['query'][_0x6c51('0x3d')]));_0x239482[_0x6c51('0x3c')]=_0x239482['attributes'][_0x6c51('0x3e')]?_0x239482[_0x6c51('0x3c')]:_0x1fe773[_0x6c51('0x38')];if(!_0x4468bf[_0x6c51('0x39')]['hasOwnProperty'](_0x6c51('0x3f'))){_0x239482[_0x6c51('0x2b')]=qs[_0x6c51('0x2b')](_0x4468bf[_0x6c51('0x39')][_0x6c51('0x2b')]);_0x239482[_0x6c51('0x2a')]=qs[_0x6c51('0x2a')](_0x4468bf['query'][_0x6c51('0x2a')]);}_0x239482[_0x6c51('0x40')]=qs[_0x6c51('0x41')](_0x4468bf[_0x6c51('0x39')][_0x6c51('0x41')]);_0x239482['where']=qs[_0x6c51('0x3a')](_[_0x6c51('0x42')](_0x4468bf['query'],_0x1fe773[_0x6c51('0x3a')]),_0x5b29d8);if(_0x4468bf[_0x6c51('0x39')][_0x6c51('0x43')]){_0x239482['where']=_[_0x6c51('0x44')](_0x239482[_0x6c51('0x45')],{'$or':_[_0x6c51('0x34')](_0x5b29d8,function(_0x40d4ea){if(_0x40d4ea['type']!=='VIRTUAL'){var _0x177fc5={};_0x177fc5[_0x40d4ea[_0x6c51('0x32')]]={'$like':'%'+_0x4468bf[_0x6c51('0x39')][_0x6c51('0x43')]+'%'};return _0x177fc5;}})});}_0x239482=_[_0x6c51('0x44')]({},_0x239482,_0x4468bf[_0x6c51('0x46')]);var _0x5f5128={'where':_0x239482['where']};return db[_0x6c51('0x35')]['count'](_0x5f5128)[_0x6c51('0x1c')](function(_0x58a540){_0x1f55a3[_0x6c51('0x29')]=_0x58a540;if(_0x4468bf[_0x6c51('0x39')][_0x6c51('0x47')]){_0x239482['include']=[{'all':!![]}];}return db['DeskAccount'][_0x6c51('0x48')](_0x239482);})['then'](function(_0x5b57d4){_0x1f55a3[_0x6c51('0x49')]=_0x5b57d4;return _0x1f55a3;})[_0x6c51('0x1c')](respondWithFilteredResult(_0x49454f,_0x239482))[_0x6c51('0x25')](handleError(_0x49454f,null));};exports[_0x6c51('0x4a')]=function(_0x648e28,_0x17647c){var _0x30141b={'raw':![],'where':{'id':_0x648e28[_0x6c51('0x4b')]['id']}},_0x8f765={};_0x8f765[_0x6c51('0x38')]=_[_0x6c51('0x4c')](db['DeskAccount'][_0x6c51('0x4d')]);_0x8f765[_0x6c51('0x39')]=_['keys'](_0x648e28[_0x6c51('0x39')]);_0x8f765[_0x6c51('0x3a')]=_['intersection'](_0x8f765['model'],_0x8f765[_0x6c51('0x39')]);_0x30141b[_0x6c51('0x3c')]=_[_0x6c51('0x3b')](_0x8f765[_0x6c51('0x38')],qs[_0x6c51('0x3d')](_0x648e28[_0x6c51('0x39')]['fields']));_0x30141b['attributes']=_0x30141b[_0x6c51('0x3c')]['length']?_0x30141b[_0x6c51('0x3c')]:_0x8f765[_0x6c51('0x38')];if(_0x648e28[_0x6c51('0x39')][_0x6c51('0x47')]){_0x30141b[_0x6c51('0x4e')]=[{'all':!![]}];}_0x30141b=_[_0x6c51('0x44')]({},_0x30141b,_0x648e28[_0x6c51('0x46')]);return db[_0x6c51('0x35')][_0x6c51('0x4f')](_0x30141b)[_0x6c51('0x1c')](handleEntityNotFound(_0x17647c,null))[_0x6c51('0x1c')](respondWithResult(_0x17647c,null))['catch'](handleError(_0x17647c,null));};exports[_0x6c51('0x50')]=function(_0x56537c,_0x596368){return db[_0x6c51('0x35')][_0x6c51('0x50')](_0x56537c[_0x6c51('0x51')],{})[_0x6c51('0x1c')](respondWithResult(_0x596368,0xc9))[_0x6c51('0x25')](handleError(_0x596368,null));};exports[_0x6c51('0x2f')]=function(_0x38b8e7,_0x2fb389){if(_0x38b8e7['body']['id']){delete _0x38b8e7[_0x6c51('0x51')]['id'];}return db[_0x6c51('0x35')][_0x6c51('0x4f')]({'where':{'id':_0x38b8e7['params']['id']}})['then'](handleEntityNotFound(_0x2fb389,null))[_0x6c51('0x1c')](saveUpdates(_0x38b8e7[_0x6c51('0x51')],null))[_0x6c51('0x1c')](respondWithResult(_0x2fb389,null))['catch'](handleError(_0x2fb389,null));};exports[_0x6c51('0x52')]=function(_0x302faf,_0x1a3d59){return db[_0x6c51('0x35')]['find']({'where':{'id':_0x302faf['params']['id']}})[_0x6c51('0x1c')](handleEntityNotFound(_0x1a3d59,null))[_0x6c51('0x1c')](removeEntity(_0x1a3d59,null))[_0x6c51('0x25')](handleError(_0x1a3d59,null));};exports[_0x6c51('0x53')]=function(_0x4ee3ba,_0x5c437d,_0x3d1a4b){var _0x35343a={};var _0x3d4e3e={};var _0x4be635;var _0x418d1d;return db[_0x6c51('0x35')][_0x6c51('0x54')]({'where':{'id':_0x4ee3ba[_0x6c51('0x4b')]['id']}})[_0x6c51('0x1c')](handleEntityNotFound(_0x5c437d,null))[_0x6c51('0x1c')](function(_0x1bf98b){if(_0x1bf98b){_0x4be635=_0x1bf98b;_0x3d4e3e[_0x6c51('0x38')]=_[_0x6c51('0x4c')](db[_0x6c51('0x55')][_0x6c51('0x4d')]);_0x3d4e3e[_0x6c51('0x39')]=_[_0x6c51('0x4c')](_0x4ee3ba[_0x6c51('0x39')]);_0x3d4e3e[_0x6c51('0x3a')]=_[_0x6c51('0x3b')](_0x3d4e3e[_0x6c51('0x38')],_0x3d4e3e[_0x6c51('0x39')]);_0x35343a['attributes']=_[_0x6c51('0x3b')](_0x3d4e3e['model'],qs[_0x6c51('0x3d')](_0x4ee3ba[_0x6c51('0x39')][_0x6c51('0x3d')]));_0x35343a[_0x6c51('0x3c')]=_0x35343a[_0x6c51('0x3c')][_0x6c51('0x3e')]?_0x35343a[_0x6c51('0x3c')]:_0x3d4e3e['model'];_0x35343a['order']=qs[_0x6c51('0x41')](_0x4ee3ba['query'][_0x6c51('0x41')]);_0x35343a['where']=qs[_0x6c51('0x3a')](_[_0x6c51('0x42')](_0x4ee3ba[_0x6c51('0x39')],_0x3d4e3e[_0x6c51('0x3a')]));if(_0x4ee3ba['query'][_0x6c51('0x43')]){_0x35343a[_0x6c51('0x45')]=_[_0x6c51('0x44')](_0x35343a[_0x6c51('0x45')],{'$or':_[_0x6c51('0x34')](_0x35343a[_0x6c51('0x3c')],function(_0xc69de5){var _0xe75f2c={};_0xe75f2c[_0xc69de5]={'$like':'%'+_0x4ee3ba['query']['filter']+'%'};return _0xe75f2c;})});}_0x35343a=_[_0x6c51('0x44')]({},_0x35343a,_0x4ee3ba[_0x6c51('0x46')]);return _0x4be635[_0x6c51('0x53')](_0x35343a);}})[_0x6c51('0x1c')](function(_0x3f4a1c){if(_0x3f4a1c){_0x418d1d=_0x3f4a1c[_0x6c51('0x3e')];if(!_0x4ee3ba[_0x6c51('0x39')][_0x6c51('0x56')](_0x6c51('0x3f'))){_0x35343a['limit']=qs[_0x6c51('0x2b')](_0x4ee3ba[_0x6c51('0x39')][_0x6c51('0x2b')]);_0x35343a['offset']=qs[_0x6c51('0x2a')](_0x4ee3ba['query'][_0x6c51('0x2a')]);}return _0x4be635[_0x6c51('0x53')](_0x35343a);}})['then'](function(_0x4ede4f){if(_0x4ede4f){return _0x4ede4f?{'count':_0x418d1d,'rows':_0x4ede4f}:null;}})[_0x6c51('0x1c')](respondWithResult(_0x5c437d,null))['catch'](handleError(_0x5c437d,null));};exports['addConfiguration']=function(_0x42768c,_0x1f8371,_0x4f6a11){if(_0x42768c[_0x6c51('0x51')]['id']){delete _0x42768c[_0x6c51('0x51')]['id'];}return db[_0x6c51('0x35')][_0x6c51('0x54')]({'where':{'id':_0x42768c['params']['id']}})[_0x6c51('0x1c')](handleEntityNotFound(_0x1f8371,null))[_0x6c51('0x1c')](function(_0x432006){if(_0x432006){_0x42768c[_0x6c51('0x51')][_0x6c51('0x57')]=_0x432006['id'];_0x42768c['body']['Subjects']=integrations[_0x6c51('0x58')](_0x42768c[_0x6c51('0x51')][_0x6c51('0x59')],_0x42768c[_0x6c51('0x51')][_0x6c51('0x5a')]);_0x42768c[_0x6c51('0x51')][_0x6c51('0x5b')]=integrations['getDescriptions'](_0x42768c[_0x6c51('0x51')][_0x6c51('0x59')],_0x42768c['body'][_0x6c51('0x5a')]);return db['DeskConfiguration'][_0x6c51('0x50')](_0x42768c[_0x6c51('0x51')],{'include':[{'model':db[_0x6c51('0x5c')],'as':_0x6c51('0x5d')},{'model':db[_0x6c51('0x5c')],'as':_0x6c51('0x5b')}]});}return null;})['then'](respondWithResult(_0x1f8371,null))[_0x6c51('0x25')](handleError(_0x1f8371,null));};exports[_0x6c51('0x5e')]=function(_0x20441a,_0x2d0820,_0xa87e06){var _0x22b29e=[{'name':'priority','label':_0x6c51('0x5f'),'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 _0x31ac2d='';return db[_0x6c51('0x35')]['findOne']({'where':{'id':_0x20441a[_0x6c51('0x4b')]['id']},'attributes':['id','remoteUri',_0x6c51('0x60'),_0x6c51('0x61'),_0x6c51('0x62'),_0x6c51('0x63'),_0x6c51('0x64'),'token',_0x6c51('0x65')]})[_0x6c51('0x1c')](handleEntityNotFound(_0x2d0820,null))['then'](function(_0xfa4d9d){if(_0xfa4d9d){_0x31ac2d=_0xfa4d9d['remoteUri'];var _0x25ff3f=_0x31ac2d[_0x6c51('0x66')](-0x1);if(_0x25ff3f==='/'){_0x31ac2d=_0x31ac2d['substring'](0x0,_0x31ac2d[_0x6c51('0x67')](_0x25ff3f));}var _0xc5fde={'method':_0x6c51('0x68'),'uri':util['format'](_0x6c51('0x69'),_0x31ac2d),'headers':{'Content-Type':'application/json','Accept':_0x6c51('0x6a')},'json':!![]};if(_0xfa4d9d[_0x6c51('0x60')]===_0x6c51('0x6b')){_0xc5fde[_0x6c51('0x6c')][_0x6c51('0x6d')]=util['format']('Basic\x20%s',new Buffer(util[_0x6c51('0x6e')]('%s:%s',_0xfa4d9d[_0x6c51('0x61')],_0xfa4d9d[_0x6c51('0x62')]))[_0x6c51('0x6f')]('base64'));}return rp(_0xc5fde)[_0x6c51('0x1c')](function(_0x7af8e1){return _0x22b29e['concat'](_['map'](_0x7af8e1[_0x6c51('0x70')][_0x6c51('0x71')],function(_0x5cde6a){return{'id':_0x5cde6a[_0x6c51('0x32')],'name':_0x5cde6a[_0x6c51('0x32')],'type':_0x5cde6a[_0x6c51('0x5a')],'active':_0x5cde6a[_0x6c51('0x72')],'label':_0x5cde6a[_0x6c51('0x73')],'custom':!![]};}));});}})[_0x6c51('0x1c')](function(_0x5e960d){return{'count':_0x5e960d[_0x6c51('0x3e')],'rows':_0x5e960d};})['then'](respondWithResult(_0x2d0820,null))['catch'](function(_0x31edb6){var _0x362d57=_0x20441a[_0x6c51('0x39')][_0x6c51('0x74')]?0x1f4:_0x31edb6[_0x6c51('0x75')]||0x1f4;logger[_0x6c51('0x22')](_0x6c51('0x76'),_0x6c51('0x5e'),_0x362d57,JSON[_0x6c51('0x21')](_0x31edb6));delete _0x31edb6[_0x6c51('0x32')];if(_0x362d57===0x191){_0x362d57=0x190;}_0x2d0820['status'](_0x362d57)[_0x6c51('0x33')](_0x20441a[_0x6c51('0x39')][_0x6c51('0x74')]?{'message':_0x6c51('0x77'),'statusCode':_0x31edb6[_0x6c51('0x75')]}:_0x31edb6);});}; \ No newline at end of file +var _0x5f62=['then','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','end','json','count','offset','status','Content-Range','apply','update','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','DeskAccount','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','format','basic','headers','Authorization','%s:%s','toString','base64','_embedded','entries','label','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','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','jayson/promise','client','request'];(function(_0x1956c9,_0x2ad6b4){var _0x499d4=function(_0x2fa03f){while(--_0x2fa03f){_0x1956c9['push'](_0x1956c9['shift']());}};_0x499d4(++_0x2ad6b4);}(_0x5f62,0x153));var _0x25f6=function(_0x4a73f2,_0x352409){_0x4a73f2=_0x4a73f2-0x0;var _0x4190ee=_0x5f62[_0x4a73f2];return _0x4190ee;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x25f6('0x0'));var rimraf=require(_0x25f6('0x1'));var zipdir=require(_0x25f6('0x2'));var jsonpatch=require(_0x25f6('0x3'));var rp=require(_0x25f6('0x4'));var moment=require(_0x25f6('0x5'));var BPromise=require(_0x25f6('0x6'));var Mustache=require(_0x25f6('0x7'));var util=require(_0x25f6('0x8'));var path=require(_0x25f6('0x9'));var sox=require('sox');var csv=require(_0x25f6('0xa'));var ejs=require(_0x25f6('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x25f6('0xc'));var crypto=require(_0x25f6('0xd'));var jsforce=require(_0x25f6('0xe'));var deskjs=require(_0x25f6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x25f6('0x10'));var Papa=require(_0x25f6('0x11'));var Redis=require(_0x25f6('0x12'));var authService=require(_0x25f6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x25f6('0x14'));var hardwareService=require(_0x25f6('0x15'));var logger=require(_0x25f6('0x16'))(_0x25f6('0x17'));var utils=require(_0x25f6('0x18'));var config=require(_0x25f6('0x19'));var licenseUtil=require(_0x25f6('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x25f6('0x1b'));var client=jayson[_0x25f6('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1efcc6,_0x2bbd0e,_0x5a2c19,_0x7206d8){return new BPromise(function(_0x31b161,_0x3cc080){var _0x3df266=_0x7206d8||client;return _0x3df266[_0x25f6('0x1d')](_0x1efcc6,_0x5a2c19)[_0x25f6('0x1e')](function(_0x608de3){logger['info'](_0x25f6('0x1f'),_0x2bbd0e,_0x25f6('0x20'));logger['debug'](_0x25f6('0x21'),_0x2bbd0e,_0x25f6('0x20'),JSON[_0x25f6('0x22')](_0x608de3));if(_0x608de3[_0x25f6('0x23')]){if(_0x608de3['error'][_0x25f6('0x24')]===0x1f4){logger[_0x25f6('0x23')]('DeskAccount,\x20%s,\x20%s',_0x2bbd0e,_0x608de3[_0x25f6('0x23')]['message']);return _0x3cc080(_0x608de3[_0x25f6('0x23')][_0x25f6('0x25')]);}logger[_0x25f6('0x23')](_0x25f6('0x1f'),_0x2bbd0e,_0x608de3[_0x25f6('0x23')][_0x25f6('0x25')]);return _0x31b161(_0x608de3[_0x25f6('0x23')]['message']);}else{logger[_0x25f6('0x26')]('DeskAccount,\x20%s,\x20%s',_0x2bbd0e,_0x25f6('0x20'));_0x31b161(_0x608de3[_0x25f6('0x27')][_0x25f6('0x25')]);}})['catch'](function(_0x4dbc29){logger['error']('DeskAccount,\x20%s,\x20%s',_0x2bbd0e,_0x4dbc29);_0x3cc080(_0x4dbc29);});});}function respondWithStatusCode(_0x3ba61e,_0x504d16){_0x504d16=_0x504d16||0xcc;return function(_0x431759){if(_0x431759){return _0x3ba61e['sendStatus'](_0x504d16);}return _0x3ba61e['status'](_0x504d16)[_0x25f6('0x28')]();};}function respondWithResult(_0x5252d5,_0x4fd57f){_0x4fd57f=_0x4fd57f||0xc8;return function(_0xe69277){if(_0xe69277){return _0x5252d5['status'](_0x4fd57f)[_0x25f6('0x29')](_0xe69277);}};}function respondWithFilteredResult(_0x28e042,_0x5166e9){return function(_0x4c8022){if(_0x4c8022){var _0x4bca99=_0x4c8022[_0x25f6('0x2a')],_0x28f010=_0x5166e9[_0x25f6('0x2b')],_0x101d81=_0x5166e9[_0x25f6('0x2b')]+_0x5166e9['limit'],_0x1f9e6e;if(_0x101d81>=_0x4bca99){_0x101d81=_0x4bca99;_0x1f9e6e=0xc8;}else{_0x1f9e6e=0xce;}_0x28e042[_0x25f6('0x2c')](_0x1f9e6e);return _0x28e042['set'](_0x25f6('0x2d'),_0x28f010+'-'+_0x101d81+'/'+_0x4bca99)[_0x25f6('0x29')](_0x4c8022);}return null;};}function patchUpdates(_0x5b778a){return function(_0x129b4c){try{jsonpatch[_0x25f6('0x2e')](_0x129b4c,_0x5b778a,!![]);}catch(_0x2e97ef){return BPromise['reject'](_0x2e97ef);}return _0x129b4c['save']();};}function saveUpdates(_0x3a3ec2,_0x3fdac3){return function(_0x18c5e5){if(_0x18c5e5){return _0x18c5e5[_0x25f6('0x2f')](_0x3a3ec2)[_0x25f6('0x1e')](function(_0x5bd6d7){return _0x5bd6d7;});}return null;};}function removeEntity(_0x275325,_0x4c46bf){return function(_0x4930a0){if(_0x4930a0){return _0x4930a0[_0x25f6('0x30')]()['then'](function(){_0x275325[_0x25f6('0x2c')](0xcc)[_0x25f6('0x28')]();});}};}function handleEntityNotFound(_0x5e1537,_0x265e34){return function(_0x4fbb08){if(!_0x4fbb08){_0x5e1537['sendStatus'](0x194);}return _0x4fbb08;};}function handleError(_0x6e607a,_0x3a38a1){_0x3a38a1=_0x3a38a1||0x1f4;return function(_0x50dd66){logger[_0x25f6('0x23')](_0x50dd66[_0x25f6('0x31')]);if(_0x50dd66[_0x25f6('0x32')]){delete _0x50dd66[_0x25f6('0x32')];}_0x6e607a['status'](_0x3a38a1)['send'](_0x50dd66);};}exports[_0x25f6('0x33')]=function(_0xc3f0e3,_0x27fae9){var _0x2f1371={},_0x61be97={},_0x1fa954={'count':0x0,'rows':[]};var _0x2eba9a=_[_0x25f6('0x34')](db['DeskAccount'][_0x25f6('0x35')],function(_0x3d0bb3){return{'name':_0x3d0bb3[_0x25f6('0x36')],'type':_0x3d0bb3[_0x25f6('0x37')][_0x25f6('0x38')]};});_0x61be97[_0x25f6('0x39')]=_[_0x25f6('0x34')](_0x2eba9a,_0x25f6('0x32'));_0x61be97[_0x25f6('0x3a')]=_[_0x25f6('0x3b')](_0xc3f0e3[_0x25f6('0x3a')]);_0x61be97[_0x25f6('0x3c')]=_['intersection'](_0x61be97['model'],_0x61be97[_0x25f6('0x3a')]);_0x2f1371[_0x25f6('0x3d')]=_['intersection'](_0x61be97[_0x25f6('0x39')],qs[_0x25f6('0x3e')](_0xc3f0e3[_0x25f6('0x3a')][_0x25f6('0x3e')]));_0x2f1371[_0x25f6('0x3d')]=_0x2f1371[_0x25f6('0x3d')][_0x25f6('0x3f')]?_0x2f1371['attributes']:_0x61be97[_0x25f6('0x39')];if(!_0xc3f0e3['query'][_0x25f6('0x40')](_0x25f6('0x41'))){_0x2f1371[_0x25f6('0x42')]=qs[_0x25f6('0x42')](_0xc3f0e3[_0x25f6('0x3a')][_0x25f6('0x42')]);_0x2f1371['offset']=qs[_0x25f6('0x2b')](_0xc3f0e3[_0x25f6('0x3a')][_0x25f6('0x2b')]);}_0x2f1371[_0x25f6('0x43')]=qs[_0x25f6('0x44')](_0xc3f0e3[_0x25f6('0x3a')][_0x25f6('0x44')]);_0x2f1371[_0x25f6('0x45')]=qs[_0x25f6('0x3c')](_[_0x25f6('0x46')](_0xc3f0e3[_0x25f6('0x3a')],_0x61be97[_0x25f6('0x3c')]),_0x2eba9a);if(_0xc3f0e3[_0x25f6('0x3a')][_0x25f6('0x47')]){_0x2f1371['where']=_['merge'](_0x2f1371[_0x25f6('0x45')],{'$or':_[_0x25f6('0x34')](_0x2eba9a,function(_0x3f4779){if(_0x3f4779[_0x25f6('0x37')]!=='VIRTUAL'){var _0x250888={};_0x250888[_0x3f4779[_0x25f6('0x32')]]={'$like':'%'+_0xc3f0e3[_0x25f6('0x3a')][_0x25f6('0x47')]+'%'};return _0x250888;}})});}_0x2f1371=_[_0x25f6('0x48')]({},_0x2f1371,_0xc3f0e3[_0x25f6('0x49')]);var _0x2bfad7={'where':_0x2f1371[_0x25f6('0x45')]};return db[_0x25f6('0x4a')][_0x25f6('0x2a')](_0x2bfad7)['then'](function(_0x3ec86b){_0x1fa954[_0x25f6('0x2a')]=_0x3ec86b;if(_0xc3f0e3[_0x25f6('0x3a')][_0x25f6('0x4b')]){_0x2f1371[_0x25f6('0x4c')]=[{'all':!![]}];}return db['DeskAccount'][_0x25f6('0x4d')](_0x2f1371);})[_0x25f6('0x1e')](function(_0x46cb02){_0x1fa954[_0x25f6('0x4e')]=_0x46cb02;return _0x1fa954;})[_0x25f6('0x1e')](respondWithFilteredResult(_0x27fae9,_0x2f1371))[_0x25f6('0x4f')](handleError(_0x27fae9,null));};exports[_0x25f6('0x50')]=function(_0x10f605,_0x5c1fe6){var _0x227ae5={'raw':![],'where':{'id':_0x10f605[_0x25f6('0x51')]['id']}},_0x802064={};_0x802064[_0x25f6('0x39')]=_[_0x25f6('0x3b')](db[_0x25f6('0x4a')][_0x25f6('0x35')]);_0x802064[_0x25f6('0x3a')]=_[_0x25f6('0x3b')](_0x10f605[_0x25f6('0x3a')]);_0x802064['filters']=_[_0x25f6('0x52')](_0x802064[_0x25f6('0x39')],_0x802064[_0x25f6('0x3a')]);_0x227ae5[_0x25f6('0x3d')]=_[_0x25f6('0x52')](_0x802064[_0x25f6('0x39')],qs[_0x25f6('0x3e')](_0x10f605[_0x25f6('0x3a')][_0x25f6('0x3e')]));_0x227ae5[_0x25f6('0x3d')]=_0x227ae5[_0x25f6('0x3d')][_0x25f6('0x3f')]?_0x227ae5['attributes']:_0x802064['model'];if(_0x10f605[_0x25f6('0x3a')][_0x25f6('0x4b')]){_0x227ae5[_0x25f6('0x4c')]=[{'all':!![]}];}_0x227ae5=_['merge']({},_0x227ae5,_0x10f605[_0x25f6('0x49')]);return db[_0x25f6('0x4a')][_0x25f6('0x53')](_0x227ae5)[_0x25f6('0x1e')](handleEntityNotFound(_0x5c1fe6,null))['then'](respondWithResult(_0x5c1fe6,null))['catch'](handleError(_0x5c1fe6,null));};exports['create']=function(_0x37237e,_0x4a492e){return db[_0x25f6('0x4a')][_0x25f6('0x54')](_0x37237e[_0x25f6('0x55')],{})[_0x25f6('0x1e')](respondWithResult(_0x4a492e,0xc9))[_0x25f6('0x4f')](handleError(_0x4a492e,null));};exports[_0x25f6('0x2f')]=function(_0x1b1333,_0x4b6979){if(_0x1b1333[_0x25f6('0x55')]['id']){delete _0x1b1333[_0x25f6('0x55')]['id'];}return db[_0x25f6('0x4a')][_0x25f6('0x53')]({'where':{'id':_0x1b1333[_0x25f6('0x51')]['id']}})[_0x25f6('0x1e')](handleEntityNotFound(_0x4b6979,null))[_0x25f6('0x1e')](saveUpdates(_0x1b1333[_0x25f6('0x55')],null))['then'](respondWithResult(_0x4b6979,null))['catch'](handleError(_0x4b6979,null));};exports['destroy']=function(_0xaaa65,_0x3faa31){return db[_0x25f6('0x4a')]['find']({'where':{'id':_0xaaa65[_0x25f6('0x51')]['id']}})[_0x25f6('0x1e')](handleEntityNotFound(_0x3faa31,null))[_0x25f6('0x1e')](removeEntity(_0x3faa31,null))[_0x25f6('0x4f')](handleError(_0x3faa31,null));};exports[_0x25f6('0x56')]=function(_0x529708,_0x353f69,_0x27f89c){var _0x3c1934={};var _0x342646={};var _0x3c46b3;var _0x32680f;return db[_0x25f6('0x4a')][_0x25f6('0x57')]({'where':{'id':_0x529708[_0x25f6('0x51')]['id']}})[_0x25f6('0x1e')](handleEntityNotFound(_0x353f69,null))[_0x25f6('0x1e')](function(_0x42c78a){if(_0x42c78a){_0x3c46b3=_0x42c78a;_0x342646[_0x25f6('0x39')]=_[_0x25f6('0x3b')](db[_0x25f6('0x58')]['rawAttributes']);_0x342646['query']=_[_0x25f6('0x3b')](_0x529708[_0x25f6('0x3a')]);_0x342646[_0x25f6('0x3c')]=_[_0x25f6('0x52')](_0x342646['model'],_0x342646['query']);_0x3c1934[_0x25f6('0x3d')]=_['intersection'](_0x342646[_0x25f6('0x39')],qs[_0x25f6('0x3e')](_0x529708[_0x25f6('0x3a')]['fields']));_0x3c1934[_0x25f6('0x3d')]=_0x3c1934[_0x25f6('0x3d')][_0x25f6('0x3f')]?_0x3c1934[_0x25f6('0x3d')]:_0x342646[_0x25f6('0x39')];_0x3c1934[_0x25f6('0x43')]=qs['sort'](_0x529708[_0x25f6('0x3a')][_0x25f6('0x44')]);_0x3c1934[_0x25f6('0x45')]=qs[_0x25f6('0x3c')](_[_0x25f6('0x46')](_0x529708[_0x25f6('0x3a')],_0x342646[_0x25f6('0x3c')]));if(_0x529708['query'][_0x25f6('0x47')]){_0x3c1934['where']=_[_0x25f6('0x48')](_0x3c1934[_0x25f6('0x45')],{'$or':_['map'](_0x3c1934[_0x25f6('0x3d')],function(_0x390ee3){var _0x34d1ab={};_0x34d1ab[_0x390ee3]={'$like':'%'+_0x529708[_0x25f6('0x3a')][_0x25f6('0x47')]+'%'};return _0x34d1ab;})});}_0x3c1934=_['merge']({},_0x3c1934,_0x529708[_0x25f6('0x49')]);return _0x3c46b3[_0x25f6('0x56')](_0x3c1934);}})[_0x25f6('0x1e')](function(_0x3c3d58){if(_0x3c3d58){_0x32680f=_0x3c3d58[_0x25f6('0x3f')];if(!_0x529708[_0x25f6('0x3a')][_0x25f6('0x40')](_0x25f6('0x41'))){_0x3c1934[_0x25f6('0x42')]=qs[_0x25f6('0x42')](_0x529708[_0x25f6('0x3a')][_0x25f6('0x42')]);_0x3c1934[_0x25f6('0x2b')]=qs['offset'](_0x529708[_0x25f6('0x3a')][_0x25f6('0x2b')]);}return _0x3c46b3[_0x25f6('0x56')](_0x3c1934);}})[_0x25f6('0x1e')](function(_0xe55e1d){if(_0xe55e1d){return _0xe55e1d?{'count':_0x32680f,'rows':_0xe55e1d}:null;}})[_0x25f6('0x1e')](respondWithResult(_0x353f69,null))[_0x25f6('0x4f')](handleError(_0x353f69,null));};exports[_0x25f6('0x59')]=function(_0x4b22bc,_0x3a666e,_0x4c9676){if(_0x4b22bc['body']['id']){delete _0x4b22bc['body']['id'];}return db[_0x25f6('0x4a')][_0x25f6('0x57')]({'where':{'id':_0x4b22bc[_0x25f6('0x51')]['id']}})['then'](handleEntityNotFound(_0x3a666e,null))[_0x25f6('0x1e')](function(_0x3c19b7){if(_0x3c19b7){_0x4b22bc[_0x25f6('0x55')][_0x25f6('0x5a')]=_0x3c19b7['id'];_0x4b22bc[_0x25f6('0x55')][_0x25f6('0x5b')]=integrations[_0x25f6('0x5c')](_0x4b22bc[_0x25f6('0x55')][_0x25f6('0x5d')],_0x4b22bc[_0x25f6('0x55')][_0x25f6('0x37')]);_0x4b22bc[_0x25f6('0x55')][_0x25f6('0x5e')]=integrations['getDescriptions'](_0x4b22bc[_0x25f6('0x55')][_0x25f6('0x5d')],_0x4b22bc[_0x25f6('0x55')][_0x25f6('0x37')]);return db['DeskConfiguration']['create'](_0x4b22bc[_0x25f6('0x55')],{'include':[{'model':db[_0x25f6('0x5f')],'as':_0x25f6('0x5b')},{'model':db[_0x25f6('0x5f')],'as':'Descriptions'}]});}return null;})[_0x25f6('0x1e')](respondWithResult(_0x3a666e,null))[_0x25f6('0x4f')](handleError(_0x3a666e,null));};exports[_0x25f6('0x60')]=function(_0x50e7d0,_0x3caecd,_0x5cafd3){var _0x16c792=[{'name':_0x25f6('0x61'),'label':_0x25f6('0x61'),'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 _0x3d3837='';return db[_0x25f6('0x4a')][_0x25f6('0x57')]({'where':{'id':_0x50e7d0[_0x25f6('0x51')]['id']},'attributes':['id',_0x25f6('0x62'),_0x25f6('0x63'),_0x25f6('0x64'),_0x25f6('0x65'),_0x25f6('0x66'),_0x25f6('0x67'),_0x25f6('0x68'),_0x25f6('0x69')]})[_0x25f6('0x1e')](handleEntityNotFound(_0x3caecd,null))[_0x25f6('0x1e')](function(_0x2437be){if(_0x2437be){_0x3d3837=_0x2437be[_0x25f6('0x62')];var _0x580027=_0x3d3837['slice'](-0x1);if(_0x580027==='/'){_0x3d3837=_0x3d3837[_0x25f6('0x6a')](0x0,_0x3d3837[_0x25f6('0x6b')](_0x580027));}var _0xd52b49={'method':_0x25f6('0x6c'),'uri':util[_0x25f6('0x6d')]('%s/custom_fields',_0x3d3837),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x2437be[_0x25f6('0x63')]===_0x25f6('0x6e')){_0xd52b49[_0x25f6('0x6f')][_0x25f6('0x70')]=util[_0x25f6('0x6d')]('Basic\x20%s',new Buffer(util[_0x25f6('0x6d')](_0x25f6('0x71'),_0x2437be[_0x25f6('0x64')],_0x2437be[_0x25f6('0x65')]))[_0x25f6('0x72')](_0x25f6('0x73')));}return rp(_0xd52b49)[_0x25f6('0x1e')](function(_0x1b1bb5){return _0x16c792['concat'](_[_0x25f6('0x34')](_0x1b1bb5[_0x25f6('0x74')][_0x25f6('0x75')],function(_0x335118){return{'id':_0x335118[_0x25f6('0x32')],'name':_0x335118['name'],'type':_0x335118['type'],'active':_0x335118['active'],'label':_0x335118[_0x25f6('0x76')],'custom':!![]};}));});}})[_0x25f6('0x1e')](function(_0x37c169){return{'count':_0x37c169[_0x25f6('0x3f')],'rows':_0x37c169};})[_0x25f6('0x1e')](respondWithResult(_0x3caecd,null))[_0x25f6('0x4f')](function(_0x2f7e8e){var _0x53c63a=_0x50e7d0[_0x25f6('0x3a')][_0x25f6('0x77')]?0x1f4:_0x2f7e8e['statusCode']||0x1f4;logger[_0x25f6('0x23')](_0x25f6('0x78'),_0x25f6('0x60'),_0x53c63a,JSON[_0x25f6('0x22')](_0x2f7e8e));delete _0x2f7e8e[_0x25f6('0x32')];if(_0x53c63a===0x191){_0x53c63a=0x190;}_0x3caecd['status'](_0x53c63a)['send'](_0x50e7d0['query']['test']?{'message':_0x25f6('0x79'),'statusCode':_0x2f7e8e[_0x25f6('0x7a')]}:_0x2f7e8e);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index fc7f13d..45aad64 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 _0x2e7b=['moment','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','int_desk_accounts','util','../../config/logger','api'];(function(_0x32f9ca,_0x2fa8bc){var _0x52e083=function(_0x4fd86a){while(--_0x4fd86a){_0x32f9ca['push'](_0x32f9ca['shift']());}};_0x52e083(++_0x2fa8bc);}(_0x2e7b,0x15d));var _0xb2e7=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2e7b[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xb2e7('0x0'));var logger=require(_0xb2e7('0x1'))(_0xb2e7('0x2'));var moment=require(_0xb2e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2e7('0x4'));var rimraf=require(_0xb2e7('0x5'));var config=require('../../config/environment');var attributes=require(_0xb2e7('0x6'));var integrations=require(_0xb2e7('0x7'));module[_0xb2e7('0x8')]=function(_0x44c9e1,_0x4113d1){return _0x44c9e1[_0xb2e7('0x9')]('DeskAccount',attributes,{'tableName':_0xb2e7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec5c=['define','DeskAccount','api','moment','bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','exports'];(function(_0x3523d4,_0x7bebaa){var _0x5a92d1=function(_0x59b939){while(--_0x59b939){_0x3523d4['push'](_0x3523d4['shift']());}};_0x5a92d1(++_0x7bebaa);}(_0xec5c,0x1d8));var _0xcec5=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0xec5c[_0x54defc];return _0x1955d3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xcec5('0x0'));var moment=require(_0xcec5('0x1'));var BPromise=require(_0xcec5('0x2'));var rp=require(_0xcec5('0x3'));var fs=require('fs');var path=require(_0xcec5('0x4'));var rimraf=require(_0xcec5('0x5'));var config=require('../../config/environment');var attributes=require(_0xcec5('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xcec5('0x7')]=function(_0x47718e,_0x1f27fa){return _0x47718e[_0xcec5('0x8')](_0xcec5('0x9'),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 0979270..2a7a3cd 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 _0x4492=['code','DeskAccount,\x20%s,\x20%s','message','GetDeskAccount','findAll','options','where','attributes','map','include','model','catch','ShowDeskAccount','DeskAccount','find','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x55b0de,_0xbfff48){var _0x3ee40b=function(_0x3cb588){while(--_0x3cb588){_0x55b0de['push'](_0x55b0de['shift']());}};_0x3ee40b(++_0xbfff48);}(_0x4492,0x110));var _0x2449=function(_0x5ade35,_0x35cec6){_0x5ade35=_0x5ade35-0x0;var _0x21d317=_0x4492[_0x5ade35];return _0x21d317;};'use strict';var _=require(_0x2449('0x0'));var util=require('util');var moment=require(_0x2449('0x1'));var BPromise=require(_0x2449('0x2'));var rs=require(_0x2449('0x3'));var fs=require('fs');var Redis=require(_0x2449('0x4'));var db=require(_0x2449('0x5'))['db'];var utils=require(_0x2449('0x6'));var logger=require('../../config/logger')(_0x2449('0x7'));var config=require(_0x2449('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2449('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b4742,_0x85a990,_0x2725fc){return new BPromise(function(_0xa20c5d,_0x1a4a69){return client['request'](_0x1b4742,_0x2725fc)[_0x2449('0xa')](function(_0x5afecf){logger[_0x2449('0xb')]('DeskAccount,\x20%s,\x20%s',_0x85a990,_0x2449('0xc'));logger[_0x2449('0xd')](_0x2449('0xe'),_0x85a990,_0x2449('0xc'),JSON['stringify'](_0x5afecf));if(_0x5afecf[_0x2449('0xf')]){if(_0x5afecf['error'][_0x2449('0x10')]===0x1f4){logger[_0x2449('0xf')](_0x2449('0x11'),_0x85a990,_0x5afecf[_0x2449('0xf')][_0x2449('0x12')]);return _0x1a4a69(_0x5afecf[_0x2449('0xf')][_0x2449('0x12')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x85a990,_0x5afecf[_0x2449('0xf')][_0x2449('0x12')]);return _0xa20c5d(_0x5afecf[_0x2449('0xf')][_0x2449('0x12')]);}else{logger['info'](_0x2449('0x11'),_0x85a990,_0x2449('0xc'));_0xa20c5d(_0x5afecf['result'][_0x2449('0x12')]);}})['catch'](function(_0x542ce){logger[_0x2449('0xf')](_0x2449('0x11'),_0x85a990,_0x542ce);_0x1a4a69(_0x542ce);});});}exports[_0x2449('0x13')]=function(_0x12f256){var _0x216260=this;return new Promise(function(_0x1b02fe,_0x2f3b09){return db['DeskAccount'][_0x2449('0x14')]({'raw':_0x12f256['options']?_0x12f256[_0x2449('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x12f256[_0x2449('0x15')]?_0x12f256['options'][_0x2449('0x16')]||null:null,'attributes':_0x12f256[_0x2449('0x15')]?_0x12f256[_0x2449('0x15')][_0x2449('0x17')]||null:null,'limit':_0x12f256[_0x2449('0x15')]?_0x12f256[_0x2449('0x15')]['limit']||null:null,'include':_0x12f256[_0x2449('0x15')]?_0x12f256[_0x2449('0x15')]['include']?_[_0x2449('0x18')](_0x12f256['options'][_0x2449('0x19')],function(_0xa43ccb){return{'model':db[_0xa43ccb[_0x2449('0x1a')]],'as':_0xa43ccb['as'],'attributes':_0xa43ccb[_0x2449('0x17')],'include':_0xa43ccb[_0x2449('0x19')]?_[_0x2449('0x18')](_0xa43ccb[_0x2449('0x19')],function(_0x50a1b5){return{'model':db[_0x50a1b5[_0x2449('0x1a')]],'as':_0x50a1b5['as'],'attributes':_0x50a1b5[_0x2449('0x17')],'include':_0x50a1b5['include']?_[_0x2449('0x18')](_0x50a1b5[_0x2449('0x19')],function(_0x4b5633){return{'model':db[_0x4b5633[_0x2449('0x1a')]],'as':_0x4b5633['as'],'attributes':_0x4b5633[_0x2449('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2449('0xa')](function(_0x3a2295){logger[_0x2449('0xb')](_0x2449('0x13'),_0x12f256);logger['debug'](_0x2449('0x13'),_0x12f256,JSON['stringify'](_0x3a2295));_0x1b02fe(_0x3a2295);})[_0x2449('0x1b')](function(_0x4c227b){logger['error'](_0x2449('0x13'),_0x4c227b[_0x2449('0x12')],_0x12f256);_0x2f3b09(_0x216260[_0x2449('0xf')](0x1f4,_0x4c227b['message']));});});};exports[_0x2449('0x1c')]=function(_0x50cb5b){var _0x3e4be0=this;return new Promise(function(_0x2d0095,_0x4772d7){return db[_0x2449('0x1d')][_0x2449('0x1e')]({'raw':_0x50cb5b[_0x2449('0x15')]?_0x50cb5b[_0x2449('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x50cb5b[_0x2449('0x15')]?_0x50cb5b[_0x2449('0x15')][_0x2449('0x16')]||null:null,'attributes':_0x50cb5b['options']?_0x50cb5b[_0x2449('0x15')][_0x2449('0x17')]||null:null,'include':_0x50cb5b[_0x2449('0x15')]?_0x50cb5b[_0x2449('0x15')][_0x2449('0x19')]?_['map'](_0x50cb5b[_0x2449('0x15')]['include'],function(_0x2ee23b){return{'model':db[_0x2ee23b[_0x2449('0x1a')]],'as':_0x2ee23b['as'],'attributes':_0x2ee23b['attributes'],'include':_0x2ee23b['include']?_['map'](_0x2ee23b[_0x2449('0x19')],function(_0x1d33ff){return{'model':db[_0x1d33ff['model']],'as':_0x1d33ff['as'],'attributes':_0x1d33ff[_0x2449('0x17')],'include':_0x1d33ff[_0x2449('0x19')]?_[_0x2449('0x18')](_0x1d33ff[_0x2449('0x19')],function(_0x516074){return{'model':db[_0x516074[_0x2449('0x1a')]],'as':_0x516074['as'],'attributes':_0x516074[_0x2449('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2449('0xa')](function(_0x3fc85d){logger[_0x2449('0xb')](_0x2449('0x1c'),_0x50cb5b);logger[_0x2449('0xd')](_0x2449('0x1c'),_0x50cb5b,JSON[_0x2449('0x1f')](_0x3fc85d));_0x2d0095(_0x3fc85d);})[_0x2449('0x1b')](function(_0x3c485e){logger[_0x2449('0xf')](_0x2449('0x1c'),_0x3c485e[_0x2449('0x12')],_0x50cb5b);_0x4772d7(_0x3e4be0[_0x2449('0xf')](0x1f4,_0x3c485e['message']));});});}; \ No newline at end of file +var _0x7b01=['attributes','include','map','model','catch','find','ShowDeskAccount','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','where'];(function(_0xf2a241,_0x4ee120){var _0xb8bfa8=function(_0x441e7d){while(--_0x441e7d){_0xf2a241['push'](_0xf2a241['shift']());}};_0xb8bfa8(++_0x4ee120);}(_0x7b01,0x19f));var _0x17b0=function(_0x1725c9,_0x463508){_0x1725c9=_0x1725c9-0x0;var _0xfeca9b=_0x7b01[_0x1725c9];return _0xfeca9b;};'use strict';var _=require('lodash');var util=require(_0x17b0('0x0'));var moment=require('moment');var BPromise=require(_0x17b0('0x1'));var rs=require(_0x17b0('0x2'));var fs=require('fs');var Redis=require(_0x17b0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x17b0('0x4'));var logger=require(_0x17b0('0x5'))('rpc');var config=require(_0x17b0('0x6'));var jayson=require(_0x17b0('0x7'));var client=jayson[_0x17b0('0x8')][_0x17b0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc1cdb3,_0x39d0bf,_0x128d2b){return new BPromise(function(_0x4b00a0,_0x191ecd){return client[_0x17b0('0xa')](_0xc1cdb3,_0x128d2b)[_0x17b0('0xb')](function(_0xaff55d){logger[_0x17b0('0xc')](_0x17b0('0xd'),_0x39d0bf,_0x17b0('0xe'));logger[_0x17b0('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x39d0bf,_0x17b0('0xe'),JSON[_0x17b0('0x10')](_0xaff55d));if(_0xaff55d[_0x17b0('0x11')]){if(_0xaff55d[_0x17b0('0x11')][_0x17b0('0x12')]===0x1f4){logger['error'](_0x17b0('0xd'),_0x39d0bf,_0xaff55d['error'][_0x17b0('0x13')]);return _0x191ecd(_0xaff55d[_0x17b0('0x11')]['message']);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x39d0bf,_0xaff55d[_0x17b0('0x11')][_0x17b0('0x13')]);return _0x4b00a0(_0xaff55d[_0x17b0('0x11')][_0x17b0('0x13')]);}else{logger[_0x17b0('0xc')](_0x17b0('0xd'),_0x39d0bf,_0x17b0('0xe'));_0x4b00a0(_0xaff55d[_0x17b0('0x14')][_0x17b0('0x13')]);}})['catch'](function(_0x187afa){logger[_0x17b0('0x11')](_0x17b0('0xd'),_0x39d0bf,_0x187afa);_0x191ecd(_0x187afa);});});}exports[_0x17b0('0x15')]=function(_0x1c1864){var _0x45566f=this;return new Promise(function(_0x44bedf,_0x370d46){return db[_0x17b0('0x16')][_0x17b0('0x17')]({'raw':_0x1c1864[_0x17b0('0x18')]?_0x1c1864['options'][_0x17b0('0x19')]===undefined?!![]:![]:!![],'where':_0x1c1864[_0x17b0('0x18')]?_0x1c1864[_0x17b0('0x18')][_0x17b0('0x1a')]||null:null,'attributes':_0x1c1864[_0x17b0('0x18')]?_0x1c1864[_0x17b0('0x18')][_0x17b0('0x1b')]||null:null,'limit':_0x1c1864[_0x17b0('0x18')]?_0x1c1864[_0x17b0('0x18')]['limit']||null:null,'include':_0x1c1864['options']?_0x1c1864[_0x17b0('0x18')][_0x17b0('0x1c')]?_[_0x17b0('0x1d')](_0x1c1864[_0x17b0('0x18')][_0x17b0('0x1c')],function(_0x48c0af){return{'model':db[_0x48c0af['model']],'as':_0x48c0af['as'],'attributes':_0x48c0af[_0x17b0('0x1b')],'include':_0x48c0af['include']?_[_0x17b0('0x1d')](_0x48c0af[_0x17b0('0x1c')],function(_0x2fcafe){return{'model':db[_0x2fcafe[_0x17b0('0x1e')]],'as':_0x2fcafe['as'],'attributes':_0x2fcafe['attributes'],'include':_0x2fcafe['include']?_[_0x17b0('0x1d')](_0x2fcafe['include'],function(_0x23e7d8){return{'model':db[_0x23e7d8[_0x17b0('0x1e')]],'as':_0x23e7d8['as'],'attributes':_0x23e7d8[_0x17b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x17b0('0xb')](function(_0x3dc0d3){logger[_0x17b0('0xc')](_0x17b0('0x15'),_0x1c1864);logger[_0x17b0('0xf')]('GetDeskAccount',_0x1c1864,JSON[_0x17b0('0x10')](_0x3dc0d3));_0x44bedf(_0x3dc0d3);})[_0x17b0('0x1f')](function(_0x522dfd){logger[_0x17b0('0x11')](_0x17b0('0x15'),_0x522dfd[_0x17b0('0x13')],_0x1c1864);_0x370d46(_0x45566f[_0x17b0('0x11')](0x1f4,_0x522dfd[_0x17b0('0x13')]));});});};exports['ShowDeskAccount']=function(_0x2bc5fc){var _0x4a9ebd=this;return new Promise(function(_0x363dfc,_0x5adbda){return db[_0x17b0('0x16')][_0x17b0('0x20')]({'raw':_0x2bc5fc[_0x17b0('0x18')]?_0x2bc5fc[_0x17b0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2bc5fc[_0x17b0('0x18')]?_0x2bc5fc[_0x17b0('0x18')][_0x17b0('0x1a')]||null:null,'attributes':_0x2bc5fc[_0x17b0('0x18')]?_0x2bc5fc[_0x17b0('0x18')][_0x17b0('0x1b')]||null:null,'include':_0x2bc5fc[_0x17b0('0x18')]?_0x2bc5fc[_0x17b0('0x18')][_0x17b0('0x1c')]?_[_0x17b0('0x1d')](_0x2bc5fc['options'][_0x17b0('0x1c')],function(_0x48bb9c){return{'model':db[_0x48bb9c['model']],'as':_0x48bb9c['as'],'attributes':_0x48bb9c[_0x17b0('0x1b')],'include':_0x48bb9c[_0x17b0('0x1c')]?_[_0x17b0('0x1d')](_0x48bb9c[_0x17b0('0x1c')],function(_0x1aaf74){return{'model':db[_0x1aaf74[_0x17b0('0x1e')]],'as':_0x1aaf74['as'],'attributes':_0x1aaf74[_0x17b0('0x1b')],'include':_0x1aaf74[_0x17b0('0x1c')]?_[_0x17b0('0x1d')](_0x1aaf74[_0x17b0('0x1c')],function(_0x24949b){return{'model':db[_0x24949b[_0x17b0('0x1e')]],'as':_0x24949b['as'],'attributes':_0x24949b[_0x17b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x17b0('0xb')](function(_0x3bf957){logger[_0x17b0('0xc')](_0x17b0('0x21'),_0x2bc5fc);logger[_0x17b0('0xf')](_0x17b0('0x21'),_0x2bc5fc,JSON[_0x17b0('0x10')](_0x3bf957));_0x363dfc(_0x3bf957);})[_0x17b0('0x1f')](function(_0x792090){logger[_0x17b0('0x11')](_0x17b0('0x21'),_0x792090[_0x17b0('0x13')],_0x2bc5fc);_0x5adbda(_0x4a9ebd[_0x17b0('0x11')](0x1f4,_0x792090[_0x17b0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 37f7e3d..5d05289 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 _0x8ed7=['/:id/descriptions','getTags','post','create','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x8ed7,0x8b));var _0x78ed=function(_0x28085b,_0x2f6171){_0x28085b=_0x28085b-0x0;var _0x4f1700=_0x8ed7[_0x28085b];return _0x4f1700;};'use strict';var multer=require('multer');var util=require(_0x78ed('0x0'));var path=require(_0x78ed('0x1'));var timeout=require(_0x78ed('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x78ed('0x3'));var interaction=require(_0x78ed('0x4'));var config=require(_0x78ed('0x5'));var controller=require(_0x78ed('0x6'));router[_0x78ed('0x7')]('/',auth[_0x78ed('0x8')](),controller[_0x78ed('0x9')]);router[_0x78ed('0x7')](_0x78ed('0xa'),auth['isAuthenticated'](),controller[_0x78ed('0xb')]);router['get'](_0x78ed('0xc'),auth['isAuthenticated'](),controller[_0x78ed('0xd')]);router['get']('/:id/subjects',auth[_0x78ed('0x8')](),controller[_0x78ed('0xe')]);router['get'](_0x78ed('0xf'),auth[_0x78ed('0x8')](),controller['getDescriptions']);router[_0x78ed('0x7')]('/:id/tags',auth[_0x78ed('0x8')](),controller[_0x78ed('0x10')]);router[_0x78ed('0x11')]('/',auth[_0x78ed('0x8')](),controller[_0x78ed('0x12')]);router[_0x78ed('0x11')]('/:id/tags',auth[_0x78ed('0x8')](),controller['setTags']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x78ed('0x13')](_0x78ed('0xa'),auth[_0x78ed('0x8')](),controller[_0x78ed('0x14')]);module[_0x78ed('0x15')]=router; \ No newline at end of file +var _0x5f6f=['isAuthenticated','index','show','/:id/fields','getFields','getSubjects','getDescriptions','/:id/tags','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x5904b5,_0x14121f){var _0x1c51f4=function(_0x36d71e){while(--_0x36d71e){_0x5904b5['push'](_0x5904b5['shift']());}};_0x1c51f4(++_0x14121f);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x8c6164,_0x1dc7db){_0x8c6164=_0x8c6164-0x0;var _0x1ca172=_0x5f6f[_0x8c6164];return _0x1ca172;};'use strict';var multer=require(_0xf5f6('0x0'));var util=require(_0xf5f6('0x1'));var path=require(_0xf5f6('0x2'));var timeout=require(_0xf5f6('0x3'));var express=require(_0xf5f6('0x4'));var router=express['Router']();var auth=require(_0xf5f6('0x5'));var interaction=require(_0xf5f6('0x6'));var config=require(_0xf5f6('0x7'));var controller=require('./intDeskConfiguration.controller');router[_0xf5f6('0x8')]('/',auth[_0xf5f6('0x9')](),controller[_0xf5f6('0xa')]);router[_0xf5f6('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf5f6('0xb')]);router[_0xf5f6('0x8')](_0xf5f6('0xc'),auth[_0xf5f6('0x9')](),controller[_0xf5f6('0xd')]);router[_0xf5f6('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xf5f6('0xe')]);router[_0xf5f6('0x8')]('/:id/descriptions',auth[_0xf5f6('0x9')](),controller[_0xf5f6('0xf')]);router[_0xf5f6('0x8')](_0xf5f6('0x10'),auth[_0xf5f6('0x9')](),controller['getTags']);router[_0xf5f6('0x11')]('/',auth['isAuthenticated'](),controller[_0xf5f6('0x12')]);router[_0xf5f6('0x11')](_0xf5f6('0x10'),auth[_0xf5f6('0x9')](),controller['setTags']);router[_0xf5f6('0x13')](_0xf5f6('0x14'),auth[_0xf5f6('0x9')](),controller[_0xf5f6('0x15')]);router['delete'](_0xf5f6('0x14'),auth[_0xf5f6('0x9')](),controller[_0xf5f6('0x16')]);module[_0xf5f6('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 0f37bce..51ec97e 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 _0x2b10=['sequelize','exports','STRING'];(function(_0x30aa48,_0x5cf0c9){var _0x35fc1f=function(_0x13e53e){while(--_0x13e53e){_0x30aa48['push'](_0x30aa48['shift']());}};_0x35fc1f(++_0x5cf0c9);}(_0x2b10,0x1d4));var _0x02b1=function(_0xdddc1e,_0x19bf16){_0xdddc1e=_0xdddc1e-0x0;var _0x2c34c1=_0x2b10[_0xdddc1e];return _0x2c34c1;};'use strict';var Sequelize=require(_0x02b1('0x0'));module[_0x02b1('0x1')]={'name':{'type':Sequelize[_0x02b1('0x2')]},'description':{'type':Sequelize[_0x02b1('0x2')]}}; \ No newline at end of file +var _0x423b=['sequelize','exports','STRING'];(function(_0x26b125,_0x40838d){var _0x53ea65=function(_0x54f5bb){while(--_0x54f5bb){_0x26b125['push'](_0x26b125['shift']());}};_0x53ea65(++_0x40838d);}(_0x423b,0x14a));var _0xb423=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x423b[_0x4ae829];return _0x256b31;};'use strict';var Sequelize=require(_0xb423('0x0'));module[_0xb423('0x1')]={'name':{'type':Sequelize[_0xb423('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index ceaf137..ddfd008 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 _0x08f5=['find','params','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','fast-json-patch','request-promise','mustache','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','stack','name','send','index','map','DeskConfiguration','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','keys','rawAttributes','create','body'];(function(_0x25f755,_0xe766f6){var _0x11a6fe=function(_0x447184){while(--_0x447184){_0x25f755['push'](_0x25f755['shift']());}};_0x11a6fe(++_0xe766f6);}(_0x08f5,0x172));var _0x508f=function(_0x3452eb,_0x44035e){_0x3452eb=_0x3452eb-0x0;var _0x4244fd=_0x08f5[_0x3452eb];return _0x4244fd;};'use strict';var pdf=require(_0x508f('0x0'));var emlformat=require(_0x508f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x508f('0x2'));var rp=require(_0x508f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x508f('0x4'));var util=require('util');var path=require(_0x508f('0x5'));var sox=require(_0x508f('0x6'));var csv=require('to-csv');var ejs=require(_0x508f('0x7'));var fs=require('fs');var _=require(_0x508f('0x8'));var squel=require(_0x508f('0x9'));var crypto=require(_0x508f('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x508f('0xb'));var querystring=require(_0x508f('0xc'));var Papa=require('papaparse');var Redis=require(_0x508f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x508f('0xe'));var as=require(_0x508f('0xf'));var hardwareService=require(_0x508f('0x10'));var logger=require(_0x508f('0x11'))(_0x508f('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x508f('0x13'));var db=require(_0x508f('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x508f('0x15')][_0x508f('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x37bf59,_0x5b8796,_0x4b2d5b,_0x1b819f){return new BPromise(function(_0x32e2bb,_0xf01042){var _0x555da8=_0x1b819f||client;return _0x555da8[_0x508f('0x17')](_0x37bf59,_0x4b2d5b)[_0x508f('0x18')](function(_0x5e34ef){logger[_0x508f('0x19')](_0x508f('0x1a'),_0x5b8796,_0x508f('0x1b'));logger[_0x508f('0x1c')](_0x508f('0x1d'),_0x5b8796,_0x508f('0x1b'),JSON[_0x508f('0x1e')](_0x5e34ef));if(_0x5e34ef['error']){if(_0x5e34ef[_0x508f('0x1f')][_0x508f('0x20')]===0x1f4){logger[_0x508f('0x1f')]('DeskConfiguration,\x20%s,\x20%s',_0x5b8796,_0x5e34ef['error'][_0x508f('0x21')]);return _0xf01042(_0x5e34ef[_0x508f('0x1f')][_0x508f('0x21')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x5b8796,_0x5e34ef[_0x508f('0x1f')][_0x508f('0x21')]);return _0x32e2bb(_0x5e34ef[_0x508f('0x1f')]['message']);}else{logger[_0x508f('0x19')](_0x508f('0x1a'),_0x5b8796,_0x508f('0x1b'));_0x32e2bb(_0x5e34ef[_0x508f('0x22')]['message']);}})[_0x508f('0x23')](function(_0xa0b1f6){logger[_0x508f('0x1f')](_0x508f('0x1a'),_0x5b8796,_0xa0b1f6);_0xf01042(_0xa0b1f6);});});}function respondWithStatusCode(_0x3cc67b,_0x27b655){_0x27b655=_0x27b655||0xcc;return function(_0xa244ef){if(_0xa244ef){return _0x3cc67b[_0x508f('0x24')](_0x27b655);}return _0x3cc67b[_0x508f('0x25')](_0x27b655)[_0x508f('0x26')]();};}function respondWithResult(_0xc5afff,_0x48939f){_0x48939f=_0x48939f||0xc8;return function(_0x50c4fe){if(_0x50c4fe){return _0xc5afff[_0x508f('0x25')](_0x48939f)[_0x508f('0x27')](_0x50c4fe);}};}function respondWithFilteredResult(_0x469747,_0x28c1c8){return function(_0x2c2f74){if(_0x2c2f74){var _0x49351e=_0x2c2f74[_0x508f('0x28')],_0x117cf6=_0x28c1c8['offset'],_0x230479=_0x28c1c8[_0x508f('0x29')]+_0x28c1c8[_0x508f('0x2a')],_0x3df705;if(_0x230479>=_0x49351e){_0x230479=_0x49351e;_0x3df705=0xc8;}else{_0x3df705=0xce;}_0x469747[_0x508f('0x25')](_0x3df705);return _0x469747['set'](_0x508f('0x2b'),_0x117cf6+'-'+_0x230479+'/'+_0x49351e)[_0x508f('0x27')](_0x2c2f74);}return null;};}function patchUpdates(_0xa611eb){return function(_0x2e356f){try{jsonpatch[_0x508f('0x2c')](_0x2e356f,_0xa611eb,!![]);}catch(_0x5df3a3){return BPromise[_0x508f('0x2d')](_0x5df3a3);}return _0x2e356f[_0x508f('0x2e')]();};}function saveUpdates(_0x8b0b72,_0x1fc611){return function(_0xf41566){if(_0xf41566){return _0xf41566[_0x508f('0x2f')](_0x8b0b72)[_0x508f('0x18')](function(_0x1b95a7){return _0x1b95a7;});}return null;};}function removeEntity(_0x3fd032,_0x4abae4){return function(_0x53ba4b){if(_0x53ba4b){return _0x53ba4b['destroy']()[_0x508f('0x18')](function(){_0x3fd032[_0x508f('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0xefea93,_0x1d6db8){return function(_0x12ada5){if(!_0x12ada5){_0xefea93[_0x508f('0x24')](0x194);}return _0x12ada5;};}function handleError(_0x1bb397,_0x55c467){_0x55c467=_0x55c467||0x1f4;return function(_0x1290c8){logger[_0x508f('0x1f')](_0x1290c8[_0x508f('0x30')]);if(_0x1290c8['name']){delete _0x1290c8[_0x508f('0x31')];}_0x1bb397[_0x508f('0x25')](_0x55c467)[_0x508f('0x32')](_0x1290c8);};}exports[_0x508f('0x33')]=function(_0x177446,_0xc69b6b){var _0xcc716a={},_0x4fe064={},_0x1b0f52={'count':0x0,'rows':[]};var _0x326c56=_[_0x508f('0x34')](db[_0x508f('0x35')]['rawAttributes'],function(_0x5dca4b){return{'name':_0x5dca4b['fieldName'],'type':_0x5dca4b[_0x508f('0x36')][_0x508f('0x37')]};});_0x4fe064[_0x508f('0x38')]=_['map'](_0x326c56,'name');_0x4fe064[_0x508f('0x39')]=_['keys'](_0x177446[_0x508f('0x39')]);_0x4fe064[_0x508f('0x3a')]=_[_0x508f('0x3b')](_0x4fe064['model'],_0x4fe064[_0x508f('0x39')]);_0xcc716a[_0x508f('0x3c')]=_[_0x508f('0x3b')](_0x4fe064['model'],qs['fields'](_0x177446[_0x508f('0x39')][_0x508f('0x3d')]));_0xcc716a[_0x508f('0x3c')]=_0xcc716a['attributes'][_0x508f('0x3e')]?_0xcc716a[_0x508f('0x3c')]:_0x4fe064[_0x508f('0x38')];if(!_0x177446[_0x508f('0x39')][_0x508f('0x3f')](_0x508f('0x40'))){_0xcc716a['limit']=qs['limit'](_0x177446[_0x508f('0x39')][_0x508f('0x2a')]);_0xcc716a[_0x508f('0x29')]=qs[_0x508f('0x29')](_0x177446[_0x508f('0x39')][_0x508f('0x29')]);}_0xcc716a[_0x508f('0x41')]=qs[_0x508f('0x42')](_0x177446[_0x508f('0x39')]['sort']);_0xcc716a['where']=qs[_0x508f('0x3a')](_[_0x508f('0x43')](_0x177446[_0x508f('0x39')],_0x4fe064[_0x508f('0x3a')]),_0x326c56);if(_0x177446['query'][_0x508f('0x44')]){_0xcc716a[_0x508f('0x45')]=_[_0x508f('0x46')](_0xcc716a['where'],{'$or':_[_0x508f('0x34')](_0x326c56,function(_0x14263f){if(_0x14263f['type']!==_0x508f('0x47')){var _0x37178e={};_0x37178e[_0x14263f[_0x508f('0x31')]]={'$like':'%'+_0x177446[_0x508f('0x39')][_0x508f('0x44')]+'%'};return _0x37178e;}})});}_0xcc716a=_['merge']({},_0xcc716a,_0x177446[_0x508f('0x48')]);var _0x465594={'where':_0xcc716a['where']};return db[_0x508f('0x35')][_0x508f('0x28')](_0x465594)[_0x508f('0x18')](function(_0x4b0d7a){_0x1b0f52[_0x508f('0x28')]=_0x4b0d7a;if(_0x177446[_0x508f('0x39')][_0x508f('0x49')]){_0xcc716a[_0x508f('0x4a')]=[{'all':!![]}];}return db[_0x508f('0x35')][_0x508f('0x4b')](_0xcc716a);})[_0x508f('0x18')](function(_0x293240){_0x1b0f52['rows']=_0x293240;return _0x1b0f52;})[_0x508f('0x18')](respondWithFilteredResult(_0xc69b6b,_0xcc716a))['catch'](handleError(_0xc69b6b,null));};exports['show']=function(_0x39478a,_0x44ec34){var _0x3a35eb={'raw':![],'where':{'id':_0x39478a['params']['id']}},_0x2eb275={};_0x2eb275[_0x508f('0x38')]=_[_0x508f('0x4c')](db[_0x508f('0x35')][_0x508f('0x4d')]);_0x2eb275[_0x508f('0x39')]=_[_0x508f('0x4c')](_0x39478a['query']);_0x2eb275[_0x508f('0x3a')]=_[_0x508f('0x3b')](_0x2eb275['model'],_0x2eb275[_0x508f('0x39')]);_0x3a35eb[_0x508f('0x3c')]=_['intersection'](_0x2eb275[_0x508f('0x38')],qs['fields'](_0x39478a[_0x508f('0x39')]['fields']));_0x3a35eb[_0x508f('0x3c')]=_0x3a35eb[_0x508f('0x3c')]['length']?_0x3a35eb[_0x508f('0x3c')]:_0x2eb275['model'];if(_0x39478a['query'][_0x508f('0x49')]){_0x3a35eb[_0x508f('0x4a')]=[{'all':!![]}];}_0x3a35eb=_[_0x508f('0x46')]({},_0x3a35eb,_0x39478a[_0x508f('0x48')]);return db[_0x508f('0x35')]['find'](_0x3a35eb)['then'](handleEntityNotFound(_0x44ec34,null))[_0x508f('0x18')](respondWithResult(_0x44ec34,null))[_0x508f('0x23')](handleError(_0x44ec34,null));};exports[_0x508f('0x4e')]=function(_0x5c28fc,_0x458db5){return db[_0x508f('0x35')][_0x508f('0x4e')](_0x5c28fc['body'],{})[_0x508f('0x18')](respondWithResult(_0x458db5,0xc9))[_0x508f('0x23')](handleError(_0x458db5,null));};exports[_0x508f('0x2f')]=function(_0x35755a,_0xe5ac51){if(_0x35755a[_0x508f('0x4f')]['id']){delete _0x35755a[_0x508f('0x4f')]['id'];}return db['DeskConfiguration'][_0x508f('0x50')]({'where':{'id':_0x35755a[_0x508f('0x51')]['id']}})[_0x508f('0x18')](handleEntityNotFound(_0xe5ac51,null))[_0x508f('0x18')](saveUpdates(_0x35755a[_0x508f('0x4f')],null))['then'](respondWithResult(_0xe5ac51,null))[_0x508f('0x23')](handleError(_0xe5ac51,null));};exports['destroy']=function(_0x220e0b,_0x5126c3){return db[_0x508f('0x35')][_0x508f('0x50')]({'where':{'id':_0x220e0b[_0x508f('0x51')]['id']}})['then'](handleEntityNotFound(_0x5126c3,null))[_0x508f('0x18')](removeEntity(_0x5126c3,null))[_0x508f('0x23')](handleError(_0x5126c3,null));};exports[_0x508f('0x52')]=function(_0x38296c,_0x24012b,_0x1e1a8a){var _0x278ea3={};var _0x234299={};var _0x25a093;var _0x169e75;return db[_0x508f('0x35')][_0x508f('0x53')]({'where':{'id':_0x38296c[_0x508f('0x51')]['id']}})[_0x508f('0x18')](handleEntityNotFound(_0x24012b,null))[_0x508f('0x18')](function(_0x24e13a){if(_0x24e13a){_0x25a093=_0x24e13a;_0x234299[_0x508f('0x38')]=_['keys'](db[_0x508f('0x54')][_0x508f('0x4d')]);_0x234299[_0x508f('0x39')]=_[_0x508f('0x4c')](_0x38296c['query']);_0x234299[_0x508f('0x3a')]=_['intersection'](_0x234299[_0x508f('0x38')],_0x234299[_0x508f('0x39')]);_0x278ea3['attributes']=_[_0x508f('0x3b')](_0x234299[_0x508f('0x38')],qs[_0x508f('0x3d')](_0x38296c[_0x508f('0x39')]['fields']));_0x278ea3[_0x508f('0x3c')]=_0x278ea3[_0x508f('0x3c')][_0x508f('0x3e')]?_0x278ea3[_0x508f('0x3c')]:_0x234299[_0x508f('0x38')];_0x278ea3[_0x508f('0x41')]=qs[_0x508f('0x42')](_0x38296c['query']['sort']);_0x278ea3['where']=qs['filters'](_[_0x508f('0x43')](_0x38296c[_0x508f('0x39')],_0x234299['filters']));if(_0x38296c[_0x508f('0x39')][_0x508f('0x44')]){_0x278ea3[_0x508f('0x45')]=_[_0x508f('0x46')](_0x278ea3['where'],{'$or':_[_0x508f('0x34')](_0x278ea3[_0x508f('0x3c')],function(_0x14a923){var _0x4310c2={};_0x4310c2[_0x14a923]={'$like':'%'+_0x38296c[_0x508f('0x39')][_0x508f('0x44')]+'%'};return _0x4310c2;})});}_0x278ea3=_[_0x508f('0x46')]({},_0x278ea3,_0x38296c['options']);return _0x25a093[_0x508f('0x52')](_0x278ea3);}})[_0x508f('0x18')](function(_0x980956){if(_0x980956){_0x169e75=_0x980956[_0x508f('0x3e')];if(!_0x38296c[_0x508f('0x39')][_0x508f('0x3f')](_0x508f('0x40'))){_0x278ea3[_0x508f('0x2a')]=qs[_0x508f('0x2a')](_0x38296c[_0x508f('0x39')][_0x508f('0x2a')]);_0x278ea3['offset']=qs[_0x508f('0x29')](_0x38296c[_0x508f('0x39')]['offset']);}return _0x25a093['getFields'](_0x278ea3);}})[_0x508f('0x18')](function(_0x13da7e){if(_0x13da7e){return _0x13da7e?{'count':_0x169e75,'rows':_0x13da7e}:null;}})['then'](respondWithResult(_0x24012b,null))[_0x508f('0x23')](handleError(_0x24012b,null));};exports[_0x508f('0x55')]=function(_0x3529b2,_0x46dd6c,_0x490cc0){var _0x4e5b19={};var _0x1dee71={};var _0x51b8c8;var _0x22c801;return db['DeskConfiguration']['findOne']({'where':{'id':_0x3529b2[_0x508f('0x51')]['id']}})[_0x508f('0x18')](handleEntityNotFound(_0x46dd6c,null))['then'](function(_0x17bfcf){if(_0x17bfcf){_0x51b8c8=_0x17bfcf;_0x1dee71[_0x508f('0x38')]=_[_0x508f('0x4c')](db[_0x508f('0x54')][_0x508f('0x4d')]);_0x1dee71[_0x508f('0x39')]=_[_0x508f('0x4c')](_0x3529b2[_0x508f('0x39')]);_0x1dee71[_0x508f('0x3a')]=_[_0x508f('0x3b')](_0x1dee71[_0x508f('0x38')],_0x1dee71['query']);_0x4e5b19[_0x508f('0x3c')]=_[_0x508f('0x3b')](_0x1dee71[_0x508f('0x38')],qs[_0x508f('0x3d')](_0x3529b2[_0x508f('0x39')][_0x508f('0x3d')]));_0x4e5b19[_0x508f('0x3c')]=_0x4e5b19[_0x508f('0x3c')][_0x508f('0x3e')]?_0x4e5b19[_0x508f('0x3c')]:_0x1dee71[_0x508f('0x38')];_0x4e5b19[_0x508f('0x41')]=qs[_0x508f('0x42')](_0x3529b2[_0x508f('0x39')][_0x508f('0x42')]);_0x4e5b19['where']=qs[_0x508f('0x3a')](_['pick'](_0x3529b2[_0x508f('0x39')],_0x1dee71['filters']));if(_0x3529b2[_0x508f('0x39')]['filter']){_0x4e5b19[_0x508f('0x45')]=_[_0x508f('0x46')](_0x4e5b19[_0x508f('0x45')],{'$or':_[_0x508f('0x34')](_0x4e5b19[_0x508f('0x3c')],function(_0x2ff54e){var _0x4a6fd4={};_0x4a6fd4[_0x2ff54e]={'$like':'%'+_0x3529b2['query'][_0x508f('0x44')]+'%'};return _0x4a6fd4;})});}_0x4e5b19=_[_0x508f('0x46')]({},_0x4e5b19,_0x3529b2['options']);return _0x51b8c8['getSubjects'](_0x4e5b19);}})[_0x508f('0x18')](function(_0x1678c7){if(_0x1678c7){_0x22c801=_0x1678c7[_0x508f('0x3e')];if(!_0x3529b2[_0x508f('0x39')][_0x508f('0x3f')]('nolimit')){_0x4e5b19[_0x508f('0x2a')]=qs[_0x508f('0x2a')](_0x3529b2['query'][_0x508f('0x2a')]);_0x4e5b19['offset']=qs['offset'](_0x3529b2[_0x508f('0x39')][_0x508f('0x29')]);}return _0x51b8c8[_0x508f('0x55')](_0x4e5b19);}})['then'](function(_0x16a5e3){if(_0x16a5e3){return _0x16a5e3?{'count':_0x22c801,'rows':_0x16a5e3}:null;}})[_0x508f('0x18')](respondWithResult(_0x46dd6c,null))[_0x508f('0x23')](handleError(_0x46dd6c,null));};exports['getDescriptions']=function(_0x35ce8c,_0x5195e0,_0xa09557){var _0x5f3506={};var _0x592bbc={};var _0x4d05b5;var _0x541909;return db[_0x508f('0x35')]['findOne']({'where':{'id':_0x35ce8c[_0x508f('0x51')]['id']}})[_0x508f('0x18')](handleEntityNotFound(_0x5195e0,null))['then'](function(_0x57fa9d){if(_0x57fa9d){_0x4d05b5=_0x57fa9d;_0x592bbc[_0x508f('0x38')]=_[_0x508f('0x4c')](db['DeskField']['rawAttributes']);_0x592bbc[_0x508f('0x39')]=_[_0x508f('0x4c')](_0x35ce8c['query']);_0x592bbc[_0x508f('0x3a')]=_[_0x508f('0x3b')](_0x592bbc['model'],_0x592bbc['query']);_0x5f3506[_0x508f('0x3c')]=_[_0x508f('0x3b')](_0x592bbc[_0x508f('0x38')],qs[_0x508f('0x3d')](_0x35ce8c['query'][_0x508f('0x3d')]));_0x5f3506['attributes']=_0x5f3506['attributes'][_0x508f('0x3e')]?_0x5f3506[_0x508f('0x3c')]:_0x592bbc['model'];_0x5f3506[_0x508f('0x41')]=qs[_0x508f('0x42')](_0x35ce8c[_0x508f('0x39')]['sort']);_0x5f3506['where']=qs['filters'](_[_0x508f('0x43')](_0x35ce8c[_0x508f('0x39')],_0x592bbc['filters']));if(_0x35ce8c[_0x508f('0x39')][_0x508f('0x44')]){_0x5f3506['where']=_[_0x508f('0x46')](_0x5f3506[_0x508f('0x45')],{'$or':_[_0x508f('0x34')](_0x5f3506[_0x508f('0x3c')],function(_0x3062d0){var _0x31fbb3={};_0x31fbb3[_0x3062d0]={'$like':'%'+_0x35ce8c[_0x508f('0x39')][_0x508f('0x44')]+'%'};return _0x31fbb3;})});}_0x5f3506=_['merge']({},_0x5f3506,_0x35ce8c[_0x508f('0x48')]);return _0x4d05b5[_0x508f('0x56')](_0x5f3506);}})[_0x508f('0x18')](function(_0x4aa77c){if(_0x4aa77c){_0x541909=_0x4aa77c[_0x508f('0x3e')];if(!_0x35ce8c[_0x508f('0x39')][_0x508f('0x3f')](_0x508f('0x40'))){_0x5f3506['limit']=qs[_0x508f('0x2a')](_0x35ce8c[_0x508f('0x39')]['limit']);_0x5f3506[_0x508f('0x29')]=qs[_0x508f('0x29')](_0x35ce8c[_0x508f('0x39')][_0x508f('0x29')]);}return _0x4d05b5[_0x508f('0x56')](_0x5f3506);}})[_0x508f('0x18')](function(_0x10c116){if(_0x10c116){return _0x10c116?{'count':_0x541909,'rows':_0x10c116}:null;}})[_0x508f('0x18')](respondWithResult(_0x5195e0,null))[_0x508f('0x23')](handleError(_0x5195e0,null));};exports[_0x508f('0x57')]=function(_0x481c0b,_0x19935c,_0x4da5fd){var _0x5a92dc={};var _0x15d7be={};var _0x2451f5;var _0x455633;return db['DeskConfiguration'][_0x508f('0x53')]({'where':{'id':_0x481c0b['params']['id']}})[_0x508f('0x18')](handleEntityNotFound(_0x19935c,null))[_0x508f('0x18')](function(_0x1a6153){if(_0x1a6153){_0x2451f5=_0x1a6153;_0x15d7be[_0x508f('0x38')]=_['keys'](db[_0x508f('0x58')]['rawAttributes']);_0x15d7be[_0x508f('0x39')]=_[_0x508f('0x4c')](_0x481c0b[_0x508f('0x39')]);_0x15d7be[_0x508f('0x3a')]=_[_0x508f('0x3b')](_0x15d7be[_0x508f('0x38')],_0x15d7be[_0x508f('0x39')]);_0x5a92dc[_0x508f('0x3c')]=_[_0x508f('0x3b')](_0x15d7be[_0x508f('0x38')],qs[_0x508f('0x3d')](_0x481c0b[_0x508f('0x39')][_0x508f('0x3d')]));_0x5a92dc[_0x508f('0x3c')]=_0x5a92dc['attributes'][_0x508f('0x3e')]?_0x5a92dc['attributes']:_0x15d7be[_0x508f('0x38')];_0x5a92dc['order']=qs[_0x508f('0x42')](_0x481c0b[_0x508f('0x39')][_0x508f('0x42')]);_0x5a92dc[_0x508f('0x45')]=qs['filters'](_[_0x508f('0x43')](_0x481c0b[_0x508f('0x39')],_0x15d7be[_0x508f('0x3a')]));if(_0x481c0b[_0x508f('0x39')][_0x508f('0x44')]){_0x5a92dc[_0x508f('0x45')]=_[_0x508f('0x46')](_0x5a92dc[_0x508f('0x45')],{'$or':_[_0x508f('0x34')](_0x5a92dc[_0x508f('0x3c')],function(_0x1ad2b7){var _0x3d3130={};_0x3d3130[_0x1ad2b7]={'$like':'%'+_0x481c0b[_0x508f('0x39')][_0x508f('0x44')]+'%'};return _0x3d3130;})});}_0x5a92dc=_[_0x508f('0x46')]({},_0x5a92dc,_0x481c0b[_0x508f('0x48')]);return _0x2451f5[_0x508f('0x57')](_0x5a92dc);}})['then'](function(_0x322766){if(_0x322766){_0x455633=_0x322766['length'];if(!_0x481c0b[_0x508f('0x39')][_0x508f('0x3f')](_0x508f('0x40'))){_0x5a92dc[_0x508f('0x2a')]=qs['limit'](_0x481c0b[_0x508f('0x39')][_0x508f('0x2a')]);_0x5a92dc[_0x508f('0x29')]=qs[_0x508f('0x29')](_0x481c0b['query'][_0x508f('0x29')]);}return _0x2451f5['getTags'](_0x5a92dc);}})[_0x508f('0x18')](function(_0x3bbad6){if(_0x3bbad6){return _0x3bbad6?{'count':_0x455633,'rows':_0x3bbad6}:null;}})[_0x508f('0x18')](respondWithResult(_0x19935c,null))['catch'](handleError(_0x19935c,null));};exports[_0x508f('0x59')]=function(_0x3abe0a,_0x5886cd,_0x33c2e0){if(_0x3abe0a[_0x508f('0x4f')]['id']){delete _0x3abe0a['body']['id'];}return db[_0x508f('0x35')][_0x508f('0x53')]({'where':{'id':_0x3abe0a[_0x508f('0x51')]['id']}})['then'](handleEntityNotFound(_0x5886cd,null))['then'](function(_0x28326c){if(_0x28326c){return _0x28326c[_0x508f('0x59')](_0x3abe0a[_0x508f('0x4f')]['ids']||[]);}return null;})[_0x508f('0x18')](respondWithResult(_0x5886cd,null))['catch'](handleError(_0x5886cd,null));}; \ No newline at end of file +var _0x647c=['../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','json','count','offset','set','reject','save','update','then','end','sendStatus','stack','name','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','map','VIRTUAL','options','DeskConfiguration','rows','show','params','includeAll','include','find','create','body','destroy','getFields','findOne','length','getSubjects','getDescriptions','DeskField','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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'];(function(_0x2ca93f,_0x368b5a){var _0x584c06=function(_0x247453){while(--_0x247453){_0x2ca93f['push'](_0x2ca93f['shift']());}};_0x584c06(++_0x368b5a);}(_0x647c,0x10c));var _0xc647=function(_0x4dc8c6,_0x3fba52){_0x4dc8c6=_0x4dc8c6-0x0;var _0x69ce1d=_0x647c[_0x4dc8c6];return _0x69ce1d;};'use strict';var pdf=require(_0xc647('0x0'));var emlformat=require(_0xc647('0x1'));var rimraf=require(_0xc647('0x2'));var zipdir=require(_0xc647('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc647('0x4'));var moment=require(_0xc647('0x5'));var BPromise=require(_0xc647('0x6'));var Mustache=require(_0xc647('0x7'));var util=require(_0xc647('0x8'));var path=require(_0xc647('0x9'));var sox=require(_0xc647('0xa'));var csv=require(_0xc647('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc647('0xc'));var squel=require(_0xc647('0xd'));var crypto=require(_0xc647('0xe'));var jsforce=require(_0xc647('0xf'));var deskjs=require(_0xc647('0x10'));var toCsv=require(_0xc647('0xb'));var querystring=require('querystring');var Papa=require(_0xc647('0x11'));var Redis=require(_0xc647('0x12'));var authService=require(_0xc647('0x13'));var qs=require(_0xc647('0x14'));var as=require(_0xc647('0x15'));var hardwareService=require(_0xc647('0x16'));var logger=require(_0xc647('0x17'))(_0xc647('0x18'));var utils=require(_0xc647('0x19'));var config=require(_0xc647('0x1a'));var licenseUtil=require(_0xc647('0x1b'));var db=require(_0xc647('0x1c'))['db'];var jayson=require(_0xc647('0x1d'));var client=jayson[_0xc647('0x1e')][_0xc647('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4b7dec,_0x4ea7fd,_0x10d1f6,_0x4e355a){return new BPromise(function(_0x57466f,_0x19ef51){var _0x495967=_0x4e355a||client;return _0x495967[_0xc647('0x20')](_0x4b7dec,_0x10d1f6)['then'](function(_0x392ec8){logger['info'](_0xc647('0x21'),_0x4ea7fd,_0xc647('0x22'));logger[_0xc647('0x23')](_0xc647('0x24'),_0x4ea7fd,'request\x20sent',JSON[_0xc647('0x25')](_0x392ec8));if(_0x392ec8[_0xc647('0x26')]){if(_0x392ec8[_0xc647('0x26')]['code']===0x1f4){logger['error'](_0xc647('0x21'),_0x4ea7fd,_0x392ec8[_0xc647('0x26')][_0xc647('0x27')]);return _0x19ef51(_0x392ec8[_0xc647('0x26')]['message']);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x4ea7fd,_0x392ec8[_0xc647('0x26')][_0xc647('0x27')]);return _0x57466f(_0x392ec8[_0xc647('0x26')][_0xc647('0x27')]);}else{logger['info'](_0xc647('0x21'),_0x4ea7fd,_0xc647('0x22'));_0x57466f(_0x392ec8['result']['message']);}})[_0xc647('0x28')](function(_0x4286bf){logger['error'](_0xc647('0x21'),_0x4ea7fd,_0x4286bf);_0x19ef51(_0x4286bf);});});}function respondWithStatusCode(_0x1066f5,_0x256597){_0x256597=_0x256597||0xcc;return function(_0x1704c4){if(_0x1704c4){return _0x1066f5['sendStatus'](_0x256597);}return _0x1066f5['status'](_0x256597)['end']();};}function respondWithResult(_0xc29576,_0x27123f){_0x27123f=_0x27123f||0xc8;return function(_0x5cce34){if(_0x5cce34){return _0xc29576[_0xc647('0x29')](_0x27123f)[_0xc647('0x2a')](_0x5cce34);}};}function respondWithFilteredResult(_0x452ae6,_0x5060e9){return function(_0x455d6a){if(_0x455d6a){var _0x4a6d8f=_0x455d6a[_0xc647('0x2b')],_0x2abd8b=_0x5060e9['offset'],_0xeadf94=_0x5060e9[_0xc647('0x2c')]+_0x5060e9['limit'],_0x289251;if(_0xeadf94>=_0x4a6d8f){_0xeadf94=_0x4a6d8f;_0x289251=0xc8;}else{_0x289251=0xce;}_0x452ae6[_0xc647('0x29')](_0x289251);return _0x452ae6[_0xc647('0x2d')]('Content-Range',_0x2abd8b+'-'+_0xeadf94+'/'+_0x4a6d8f)['json'](_0x455d6a);}return null;};}function patchUpdates(_0x2a62e4){return function(_0x582a53){try{jsonpatch['apply'](_0x582a53,_0x2a62e4,!![]);}catch(_0x1237c4){return BPromise[_0xc647('0x2e')](_0x1237c4);}return _0x582a53[_0xc647('0x2f')]();};}function saveUpdates(_0x1ed13a,_0x2d7656){return function(_0x56ccf0){if(_0x56ccf0){return _0x56ccf0[_0xc647('0x30')](_0x1ed13a)[_0xc647('0x31')](function(_0x1a06fd){return _0x1a06fd;});}return null;};}function removeEntity(_0x2dd332,_0x4b8897){return function(_0x5bb573){if(_0x5bb573){return _0x5bb573['destroy']()[_0xc647('0x31')](function(){_0x2dd332['status'](0xcc)[_0xc647('0x32')]();});}};}function handleEntityNotFound(_0x5f4e27,_0x55df04){return function(_0x1c6be4){if(!_0x1c6be4){_0x5f4e27[_0xc647('0x33')](0x194);}return _0x1c6be4;};}function handleError(_0x22b72a,_0x1fb2a3){_0x1fb2a3=_0x1fb2a3||0x1f4;return function(_0x472c5e){logger[_0xc647('0x26')](_0x472c5e[_0xc647('0x34')]);if(_0x472c5e['name']){delete _0x472c5e[_0xc647('0x35')];}_0x22b72a[_0xc647('0x29')](_0x1fb2a3)['send'](_0x472c5e);};}exports[_0xc647('0x36')]=function(_0x5ef0ed,_0x22cdfa){var _0x4b38a9={},_0x1b3678={},_0x53bb91={'count':0x0,'rows':[]};var _0x224685=_['map'](db['DeskConfiguration'][_0xc647('0x37')],function(_0x42683d){return{'name':_0x42683d[_0xc647('0x38')],'type':_0x42683d[_0xc647('0x39')][_0xc647('0x3a')]};});_0x1b3678[_0xc647('0x3b')]=_['map'](_0x224685,_0xc647('0x35'));_0x1b3678[_0xc647('0x3c')]=_[_0xc647('0x3d')](_0x5ef0ed['query']);_0x1b3678[_0xc647('0x3e')]=_[_0xc647('0x3f')](_0x1b3678[_0xc647('0x3b')],_0x1b3678['query']);_0x4b38a9[_0xc647('0x40')]=_[_0xc647('0x3f')](_0x1b3678[_0xc647('0x3b')],qs['fields'](_0x5ef0ed[_0xc647('0x3c')][_0xc647('0x41')]));_0x4b38a9[_0xc647('0x40')]=_0x4b38a9['attributes']['length']?_0x4b38a9[_0xc647('0x40')]:_0x1b3678[_0xc647('0x3b')];if(!_0x5ef0ed['query'][_0xc647('0x42')](_0xc647('0x43'))){_0x4b38a9[_0xc647('0x44')]=qs[_0xc647('0x44')](_0x5ef0ed[_0xc647('0x3c')][_0xc647('0x44')]);_0x4b38a9['offset']=qs[_0xc647('0x2c')](_0x5ef0ed[_0xc647('0x3c')]['offset']);}_0x4b38a9[_0xc647('0x45')]=qs[_0xc647('0x46')](_0x5ef0ed['query'][_0xc647('0x46')]);_0x4b38a9['where']=qs[_0xc647('0x3e')](_[_0xc647('0x47')](_0x5ef0ed[_0xc647('0x3c')],_0x1b3678['filters']),_0x224685);if(_0x5ef0ed[_0xc647('0x3c')][_0xc647('0x48')]){_0x4b38a9['where']=_[_0xc647('0x49')](_0x4b38a9[_0xc647('0x4a')],{'$or':_[_0xc647('0x4b')](_0x224685,function(_0x449956){if(_0x449956[_0xc647('0x39')]!==_0xc647('0x4c')){var _0x165c7c={};_0x165c7c[_0x449956[_0xc647('0x35')]]={'$like':'%'+_0x5ef0ed[_0xc647('0x3c')][_0xc647('0x48')]+'%'};return _0x165c7c;}})});}_0x4b38a9=_[_0xc647('0x49')]({},_0x4b38a9,_0x5ef0ed[_0xc647('0x4d')]);var _0x4e1c32={'where':_0x4b38a9[_0xc647('0x4a')]};return db[_0xc647('0x4e')][_0xc647('0x2b')](_0x4e1c32)[_0xc647('0x31')](function(_0x36e875){_0x53bb91['count']=_0x36e875;if(_0x5ef0ed[_0xc647('0x3c')]['includeAll']){_0x4b38a9['include']=[{'all':!![]}];}return db[_0xc647('0x4e')]['findAll'](_0x4b38a9);})[_0xc647('0x31')](function(_0x442b04){_0x53bb91[_0xc647('0x4f')]=_0x442b04;return _0x53bb91;})['then'](respondWithFilteredResult(_0x22cdfa,_0x4b38a9))[_0xc647('0x28')](handleError(_0x22cdfa,null));};exports[_0xc647('0x50')]=function(_0x374d5a,_0x4aa27e){var _0x19be49={'raw':![],'where':{'id':_0x374d5a[_0xc647('0x51')]['id']}},_0x4df6c4={};_0x4df6c4[_0xc647('0x3b')]=_[_0xc647('0x3d')](db[_0xc647('0x4e')][_0xc647('0x37')]);_0x4df6c4[_0xc647('0x3c')]=_['keys'](_0x374d5a['query']);_0x4df6c4[_0xc647('0x3e')]=_[_0xc647('0x3f')](_0x4df6c4[_0xc647('0x3b')],_0x4df6c4['query']);_0x19be49[_0xc647('0x40')]=_[_0xc647('0x3f')](_0x4df6c4[_0xc647('0x3b')],qs[_0xc647('0x41')](_0x374d5a[_0xc647('0x3c')][_0xc647('0x41')]));_0x19be49[_0xc647('0x40')]=_0x19be49[_0xc647('0x40')]['length']?_0x19be49[_0xc647('0x40')]:_0x4df6c4[_0xc647('0x3b')];if(_0x374d5a['query'][_0xc647('0x52')]){_0x19be49[_0xc647('0x53')]=[{'all':!![]}];}_0x19be49=_['merge']({},_0x19be49,_0x374d5a[_0xc647('0x4d')]);return db['DeskConfiguration'][_0xc647('0x54')](_0x19be49)[_0xc647('0x31')](handleEntityNotFound(_0x4aa27e,null))[_0xc647('0x31')](respondWithResult(_0x4aa27e,null))[_0xc647('0x28')](handleError(_0x4aa27e,null));};exports[_0xc647('0x55')]=function(_0x200fcc,_0x329680){return db[_0xc647('0x4e')][_0xc647('0x55')](_0x200fcc[_0xc647('0x56')],{})[_0xc647('0x31')](respondWithResult(_0x329680,0xc9))['catch'](handleError(_0x329680,null));};exports[_0xc647('0x30')]=function(_0x5ca612,_0x4bb02b){if(_0x5ca612[_0xc647('0x56')]['id']){delete _0x5ca612['body']['id'];}return db[_0xc647('0x4e')][_0xc647('0x54')]({'where':{'id':_0x5ca612['params']['id']}})[_0xc647('0x31')](handleEntityNotFound(_0x4bb02b,null))['then'](saveUpdates(_0x5ca612[_0xc647('0x56')],null))[_0xc647('0x31')](respondWithResult(_0x4bb02b,null))[_0xc647('0x28')](handleError(_0x4bb02b,null));};exports[_0xc647('0x57')]=function(_0x2e02aa,_0xd237d){return db[_0xc647('0x4e')][_0xc647('0x54')]({'where':{'id':_0x2e02aa[_0xc647('0x51')]['id']}})['then'](handleEntityNotFound(_0xd237d,null))[_0xc647('0x31')](removeEntity(_0xd237d,null))[_0xc647('0x28')](handleError(_0xd237d,null));};exports[_0xc647('0x58')]=function(_0x34cb5c,_0x341fa4,_0x4654bc){var _0x56dcfa={};var _0x14e6da={};var _0x1fde82;var _0x5813b9;return db[_0xc647('0x4e')][_0xc647('0x59')]({'where':{'id':_0x34cb5c[_0xc647('0x51')]['id']}})[_0xc647('0x31')](handleEntityNotFound(_0x341fa4,null))['then'](function(_0x55f56b){if(_0x55f56b){_0x1fde82=_0x55f56b;_0x14e6da[_0xc647('0x3b')]=_[_0xc647('0x3d')](db['DeskField'][_0xc647('0x37')]);_0x14e6da[_0xc647('0x3c')]=_['keys'](_0x34cb5c[_0xc647('0x3c')]);_0x14e6da['filters']=_[_0xc647('0x3f')](_0x14e6da['model'],_0x14e6da[_0xc647('0x3c')]);_0x56dcfa[_0xc647('0x40')]=_[_0xc647('0x3f')](_0x14e6da[_0xc647('0x3b')],qs[_0xc647('0x41')](_0x34cb5c['query'][_0xc647('0x41')]));_0x56dcfa['attributes']=_0x56dcfa[_0xc647('0x40')]['length']?_0x56dcfa[_0xc647('0x40')]:_0x14e6da['model'];_0x56dcfa['order']=qs[_0xc647('0x46')](_0x34cb5c[_0xc647('0x3c')][_0xc647('0x46')]);_0x56dcfa[_0xc647('0x4a')]=qs[_0xc647('0x3e')](_[_0xc647('0x47')](_0x34cb5c[_0xc647('0x3c')],_0x14e6da['filters']));if(_0x34cb5c[_0xc647('0x3c')][_0xc647('0x48')]){_0x56dcfa[_0xc647('0x4a')]=_[_0xc647('0x49')](_0x56dcfa[_0xc647('0x4a')],{'$or':_[_0xc647('0x4b')](_0x56dcfa[_0xc647('0x40')],function(_0x4df79a){var _0x5d421e={};_0x5d421e[_0x4df79a]={'$like':'%'+_0x34cb5c[_0xc647('0x3c')][_0xc647('0x48')]+'%'};return _0x5d421e;})});}_0x56dcfa=_[_0xc647('0x49')]({},_0x56dcfa,_0x34cb5c[_0xc647('0x4d')]);return _0x1fde82[_0xc647('0x58')](_0x56dcfa);}})['then'](function(_0x22daa0){if(_0x22daa0){_0x5813b9=_0x22daa0[_0xc647('0x5a')];if(!_0x34cb5c[_0xc647('0x3c')][_0xc647('0x42')]('nolimit')){_0x56dcfa[_0xc647('0x44')]=qs[_0xc647('0x44')](_0x34cb5c[_0xc647('0x3c')][_0xc647('0x44')]);_0x56dcfa[_0xc647('0x2c')]=qs['offset'](_0x34cb5c[_0xc647('0x3c')]['offset']);}return _0x1fde82[_0xc647('0x58')](_0x56dcfa);}})[_0xc647('0x31')](function(_0x21f26e){if(_0x21f26e){return _0x21f26e?{'count':_0x5813b9,'rows':_0x21f26e}:null;}})[_0xc647('0x31')](respondWithResult(_0x341fa4,null))[_0xc647('0x28')](handleError(_0x341fa4,null));};exports['getSubjects']=function(_0x4b03bc,_0x22ae82,_0x38c72d){var _0x1b88ea={};var _0x1de4e4={};var _0x494ae1;var _0x1fb40d;return db['DeskConfiguration'][_0xc647('0x59')]({'where':{'id':_0x4b03bc['params']['id']}})['then'](handleEntityNotFound(_0x22ae82,null))[_0xc647('0x31')](function(_0x4ad1a1){if(_0x4ad1a1){_0x494ae1=_0x4ad1a1;_0x1de4e4[_0xc647('0x3b')]=_[_0xc647('0x3d')](db['DeskField'][_0xc647('0x37')]);_0x1de4e4[_0xc647('0x3c')]=_[_0xc647('0x3d')](_0x4b03bc[_0xc647('0x3c')]);_0x1de4e4[_0xc647('0x3e')]=_[_0xc647('0x3f')](_0x1de4e4[_0xc647('0x3b')],_0x1de4e4[_0xc647('0x3c')]);_0x1b88ea[_0xc647('0x40')]=_[_0xc647('0x3f')](_0x1de4e4[_0xc647('0x3b')],qs['fields'](_0x4b03bc[_0xc647('0x3c')][_0xc647('0x41')]));_0x1b88ea[_0xc647('0x40')]=_0x1b88ea['attributes'][_0xc647('0x5a')]?_0x1b88ea[_0xc647('0x40')]:_0x1de4e4['model'];_0x1b88ea[_0xc647('0x45')]=qs[_0xc647('0x46')](_0x4b03bc[_0xc647('0x3c')][_0xc647('0x46')]);_0x1b88ea['where']=qs[_0xc647('0x3e')](_[_0xc647('0x47')](_0x4b03bc[_0xc647('0x3c')],_0x1de4e4[_0xc647('0x3e')]));if(_0x4b03bc['query'][_0xc647('0x48')]){_0x1b88ea[_0xc647('0x4a')]=_[_0xc647('0x49')](_0x1b88ea['where'],{'$or':_[_0xc647('0x4b')](_0x1b88ea['attributes'],function(_0x39a60a){var _0x8c0d26={};_0x8c0d26[_0x39a60a]={'$like':'%'+_0x4b03bc[_0xc647('0x3c')]['filter']+'%'};return _0x8c0d26;})});}_0x1b88ea=_['merge']({},_0x1b88ea,_0x4b03bc[_0xc647('0x4d')]);return _0x494ae1['getSubjects'](_0x1b88ea);}})[_0xc647('0x31')](function(_0x13b4dc){if(_0x13b4dc){_0x1fb40d=_0x13b4dc[_0xc647('0x5a')];if(!_0x4b03bc['query']['hasOwnProperty'](_0xc647('0x43'))){_0x1b88ea[_0xc647('0x44')]=qs[_0xc647('0x44')](_0x4b03bc['query'][_0xc647('0x44')]);_0x1b88ea[_0xc647('0x2c')]=qs['offset'](_0x4b03bc[_0xc647('0x3c')][_0xc647('0x2c')]);}return _0x494ae1[_0xc647('0x5b')](_0x1b88ea);}})[_0xc647('0x31')](function(_0x870733){if(_0x870733){return _0x870733?{'count':_0x1fb40d,'rows':_0x870733}:null;}})[_0xc647('0x31')](respondWithResult(_0x22ae82,null))[_0xc647('0x28')](handleError(_0x22ae82,null));};exports[_0xc647('0x5c')]=function(_0x5a02ed,_0x39992a,_0x3c9404){var _0x318cbe={};var _0x57d796={};var _0x29e351;var _0x235932;return db['DeskConfiguration']['findOne']({'where':{'id':_0x5a02ed[_0xc647('0x51')]['id']}})[_0xc647('0x31')](handleEntityNotFound(_0x39992a,null))[_0xc647('0x31')](function(_0x4ed29d){if(_0x4ed29d){_0x29e351=_0x4ed29d;_0x57d796[_0xc647('0x3b')]=_[_0xc647('0x3d')](db[_0xc647('0x5d')][_0xc647('0x37')]);_0x57d796[_0xc647('0x3c')]=_['keys'](_0x5a02ed[_0xc647('0x3c')]);_0x57d796['filters']=_[_0xc647('0x3f')](_0x57d796[_0xc647('0x3b')],_0x57d796[_0xc647('0x3c')]);_0x318cbe[_0xc647('0x40')]=_['intersection'](_0x57d796[_0xc647('0x3b')],qs[_0xc647('0x41')](_0x5a02ed[_0xc647('0x3c')]['fields']));_0x318cbe[_0xc647('0x40')]=_0x318cbe[_0xc647('0x40')][_0xc647('0x5a')]?_0x318cbe[_0xc647('0x40')]:_0x57d796[_0xc647('0x3b')];_0x318cbe['order']=qs['sort'](_0x5a02ed[_0xc647('0x3c')][_0xc647('0x46')]);_0x318cbe[_0xc647('0x4a')]=qs['filters'](_[_0xc647('0x47')](_0x5a02ed[_0xc647('0x3c')],_0x57d796[_0xc647('0x3e')]));if(_0x5a02ed[_0xc647('0x3c')]['filter']){_0x318cbe[_0xc647('0x4a')]=_[_0xc647('0x49')](_0x318cbe['where'],{'$or':_[_0xc647('0x4b')](_0x318cbe[_0xc647('0x40')],function(_0x3a9531){var _0x114bec={};_0x114bec[_0x3a9531]={'$like':'%'+_0x5a02ed[_0xc647('0x3c')]['filter']+'%'};return _0x114bec;})});}_0x318cbe=_[_0xc647('0x49')]({},_0x318cbe,_0x5a02ed['options']);return _0x29e351[_0xc647('0x5c')](_0x318cbe);}})[_0xc647('0x31')](function(_0x3304e3){if(_0x3304e3){_0x235932=_0x3304e3[_0xc647('0x5a')];if(!_0x5a02ed[_0xc647('0x3c')][_0xc647('0x42')](_0xc647('0x43'))){_0x318cbe[_0xc647('0x44')]=qs['limit'](_0x5a02ed[_0xc647('0x3c')]['limit']);_0x318cbe[_0xc647('0x2c')]=qs[_0xc647('0x2c')](_0x5a02ed['query']['offset']);}return _0x29e351[_0xc647('0x5c')](_0x318cbe);}})[_0xc647('0x31')](function(_0x4468a2){if(_0x4468a2){return _0x4468a2?{'count':_0x235932,'rows':_0x4468a2}:null;}})[_0xc647('0x31')](respondWithResult(_0x39992a,null))[_0xc647('0x28')](handleError(_0x39992a,null));};exports[_0xc647('0x5e')]=function(_0x4ddb8e,_0x43fa5,_0x38c8f6){var _0x21aceb={};var _0x19a1a4={};var _0x5c8f95;var _0x1032b3;return db[_0xc647('0x4e')]['findOne']({'where':{'id':_0x4ddb8e[_0xc647('0x51')]['id']}})['then'](handleEntityNotFound(_0x43fa5,null))['then'](function(_0x44bdda){if(_0x44bdda){_0x5c8f95=_0x44bdda;_0x19a1a4['model']=_[_0xc647('0x3d')](db[_0xc647('0x5f')][_0xc647('0x37')]);_0x19a1a4[_0xc647('0x3c')]=_[_0xc647('0x3d')](_0x4ddb8e[_0xc647('0x3c')]);_0x19a1a4[_0xc647('0x3e')]=_[_0xc647('0x3f')](_0x19a1a4[_0xc647('0x3b')],_0x19a1a4[_0xc647('0x3c')]);_0x21aceb['attributes']=_[_0xc647('0x3f')](_0x19a1a4[_0xc647('0x3b')],qs[_0xc647('0x41')](_0x4ddb8e[_0xc647('0x3c')][_0xc647('0x41')]));_0x21aceb[_0xc647('0x40')]=_0x21aceb['attributes'][_0xc647('0x5a')]?_0x21aceb['attributes']:_0x19a1a4['model'];_0x21aceb[_0xc647('0x45')]=qs['sort'](_0x4ddb8e['query'][_0xc647('0x46')]);_0x21aceb[_0xc647('0x4a')]=qs[_0xc647('0x3e')](_[_0xc647('0x47')](_0x4ddb8e[_0xc647('0x3c')],_0x19a1a4[_0xc647('0x3e')]));if(_0x4ddb8e[_0xc647('0x3c')][_0xc647('0x48')]){_0x21aceb[_0xc647('0x4a')]=_[_0xc647('0x49')](_0x21aceb[_0xc647('0x4a')],{'$or':_[_0xc647('0x4b')](_0x21aceb['attributes'],function(_0x5a4bb8){var _0xc731ce={};_0xc731ce[_0x5a4bb8]={'$like':'%'+_0x4ddb8e['query'][_0xc647('0x48')]+'%'};return _0xc731ce;})});}_0x21aceb=_[_0xc647('0x49')]({},_0x21aceb,_0x4ddb8e[_0xc647('0x4d')]);return _0x5c8f95[_0xc647('0x5e')](_0x21aceb);}})[_0xc647('0x31')](function(_0x5b198c){if(_0x5b198c){_0x1032b3=_0x5b198c['length'];if(!_0x4ddb8e['query'][_0xc647('0x42')](_0xc647('0x43'))){_0x21aceb[_0xc647('0x44')]=qs['limit'](_0x4ddb8e[_0xc647('0x3c')][_0xc647('0x44')]);_0x21aceb['offset']=qs[_0xc647('0x2c')](_0x4ddb8e[_0xc647('0x3c')][_0xc647('0x2c')]);}return _0x5c8f95['getTags'](_0x21aceb);}})[_0xc647('0x31')](function(_0x5820ce){if(_0x5820ce){return _0x5820ce?{'count':_0x1032b3,'rows':_0x5820ce}:null;}})[_0xc647('0x31')](respondWithResult(_0x43fa5,null))[_0xc647('0x28')](handleError(_0x43fa5,null));};exports[_0xc647('0x60')]=function(_0x2b803f,_0x378a53,_0x35adf){if(_0x2b803f[_0xc647('0x56')]['id']){delete _0x2b803f[_0xc647('0x56')]['id'];}return db[_0xc647('0x4e')]['findOne']({'where':{'id':_0x2b803f[_0xc647('0x51')]['id']}})[_0xc647('0x31')](handleEntityNotFound(_0x378a53,null))[_0xc647('0x31')](function(_0x652072){if(_0x652072){return _0x652072['setTags'](_0x2b803f[_0xc647('0x56')][_0xc647('0x61')]||[]);}return null;})[_0xc647('0x31')](respondWithResult(_0x378a53,null))[_0xc647('0x28')](handleError(_0x378a53,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index fef07d0..fede8e3 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 _0x6c74=['../../config/environment','exports','define','int_desk_configurations','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x5b19d7,_0x26d57e){var _0xd8ac43=function(_0x53581b){while(--_0x53581b){_0x5b19d7['push'](_0x5b19d7['shift']());}};_0xd8ac43(++_0x26d57e);}(_0x6c74,0x9e));var _0x46c7=function(_0x49fbda,_0x420bc5){_0x49fbda=_0x49fbda-0x0;var _0x6f1a35=_0x6c74[_0x49fbda];return _0x6f1a35;};'use strict';var _=require('lodash');var util=require(_0x46c7('0x0'));var logger=require(_0x46c7('0x1'))('api');var moment=require(_0x46c7('0x2'));var BPromise=require(_0x46c7('0x3'));var rp=require(_0x46c7('0x4'));var fs=require('fs');var path=require(_0x46c7('0x5'));var rimraf=require(_0x46c7('0x6'));var config=require(_0x46c7('0x7'));var attributes=require('./intDeskConfiguration.attributes');module[_0x46c7('0x8')]=function(_0x1655f0,_0x4aee1a){return _0x1655f0[_0x46c7('0x9')]('DeskConfiguration',attributes,{'tableName':_0x46c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa110=['request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','int_desk_configurations','api','moment','bluebird'];(function(_0x38d403,_0x4a23aa){var _0x21264c=function(_0x4b41b1){while(--_0x4b41b1){_0x38d403['push'](_0x38d403['shift']());}};_0x21264c(++_0x4a23aa);}(_0xa110,0x1da));var _0x0a11=function(_0x1b0a2d,_0x3d9a2d){_0x1b0a2d=_0x1b0a2d-0x0;var _0x351af1=_0xa110[_0x1b0a2d];return _0x351af1;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0a11('0x0'));var moment=require(_0x0a11('0x1'));var BPromise=require(_0x0a11('0x2'));var rp=require(_0x0a11('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a11('0x4'));var config=require(_0x0a11('0x5'));var attributes=require(_0x0a11('0x6'));module['exports']=function(_0x4670d1,_0x4ab488){return _0x4670d1[_0x0a11('0x7')]('DeskConfiguration',attributes,{'tableName':_0x0a11('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 f224afc..37ef7a1 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 _0x19ea=['result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x2bdb4d,_0x21cd4d){var _0x26f153=function(_0xfcaf5){while(--_0xfcaf5){_0x2bdb4d['push'](_0x2bdb4d['shift']());}};_0x26f153(++_0x21cd4d);}(_0x19ea,0xfe));var _0xa19e=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x19ea[_0x424a9a];return _0xa7831c;};'use strict';var _=require(_0xa19e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa19e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa19e('0x2'));var db=require(_0xa19e('0x3'))['db'];var utils=require(_0xa19e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa19e('0x5'));var jayson=require(_0xa19e('0x6'));var client=jayson[_0xa19e('0x7')][_0xa19e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1087e7,_0x30fd4a,_0x336e23){return new BPromise(function(_0x1867cb,_0x44e468){return client[_0xa19e('0x9')](_0x1087e7,_0x336e23)[_0xa19e('0xa')](function(_0x59b907){logger[_0xa19e('0xb')](_0xa19e('0xc'),_0x30fd4a,_0xa19e('0xd'));logger[_0xa19e('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x30fd4a,_0xa19e('0xd'),JSON[_0xa19e('0xf')](_0x59b907));if(_0x59b907[_0xa19e('0x10')]){if(_0x59b907['error'][_0xa19e('0x11')]===0x1f4){logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);return _0x44e468(_0x59b907['error'][_0xa19e('0x12')]);}logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);return _0x1867cb(_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);}else{logger[_0xa19e('0xb')](_0xa19e('0xc'),_0x30fd4a,_0xa19e('0xd'));_0x1867cb(_0x59b907[_0xa19e('0x13')]['message']);}})[_0xa19e('0x14')](function(_0x34066a){logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x34066a);_0x44e468(_0x34066a);});});} \ No newline at end of file +var _0xed8a=['debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','DeskConfiguration,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','request\x20sent'];(function(_0x2c65ab,_0x46f459){var _0x1902f9=function(_0x350e53){while(--_0x350e53){_0x2c65ab['push'](_0x2c65ab['shift']());}};_0x1902f9(++_0x46f459);}(_0xed8a,0xc5));var _0xaed8=function(_0x3ded0b,_0x32a047){_0x3ded0b=_0x3ded0b-0x0;var _0xaeba5=_0xed8a[_0x3ded0b];return _0xaeba5;};'use strict';var _=require(_0xaed8('0x0'));var util=require(_0xaed8('0x1'));var moment=require(_0xaed8('0x2'));var BPromise=require(_0xaed8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaed8('0x4'));var db=require(_0xaed8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaed8('0x6'))(_0xaed8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaed8('0x8')][_0xaed8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3db036,_0x2f6ab8,_0x291304){return new BPromise(function(_0x42bc11,_0x24ba07){return client['request'](_0x3db036,_0x291304)[_0xaed8('0xa')](function(_0x9c677){logger[_0xaed8('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x2f6ab8,_0xaed8('0xc'));logger[_0xaed8('0xd')](_0xaed8('0xe'),_0x2f6ab8,_0xaed8('0xc'),JSON[_0xaed8('0xf')](_0x9c677));if(_0x9c677['error']){if(_0x9c677['error'][_0xaed8('0x10')]===0x1f4){logger['error'](_0xaed8('0x11'),_0x2f6ab8,_0x9c677[_0xaed8('0x12')][_0xaed8('0x13')]);return _0x24ba07(_0x9c677[_0xaed8('0x12')]['message']);}logger[_0xaed8('0x12')](_0xaed8('0x11'),_0x2f6ab8,_0x9c677[_0xaed8('0x12')][_0xaed8('0x13')]);return _0x42bc11(_0x9c677[_0xaed8('0x12')][_0xaed8('0x13')]);}else{logger['info'](_0xaed8('0x11'),_0x2f6ab8,'request\x20sent');_0x42bc11(_0x9c677[_0xaed8('0x14')][_0xaed8('0x13')]);}})['catch'](function(_0x1827a9){logger[_0xaed8('0x12')](_0xaed8('0x11'),_0x2f6ab8,_0x1827a9);_0x24ba07(_0x1827a9);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 8e1a249..487275b 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 _0x0366=['../../components/interaction/service','./intDeskField.controller','get','index','/:id','isAuthenticated','show','put','update','delete','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x852e1b,_0x2d445e){var _0x5b85d3=function(_0x45695f){while(--_0x45695f){_0x852e1b['push'](_0x852e1b['shift']());}};_0x5b85d3(++_0x2d445e);}(_0x0366,0x7b));var _0x6036=function(_0x59f491,_0x2226b7){_0x59f491=_0x59f491-0x0;var _0x42f9ae=_0x0366[_0x59f491];return _0x42f9ae;};'use strict';var multer=require('multer');var util=require(_0x6036('0x0'));var path=require(_0x6036('0x1'));var timeout=require(_0x6036('0x2'));var express=require(_0x6036('0x3'));var router=express['Router']();var auth=require(_0x6036('0x4'));var interaction=require(_0x6036('0x5'));var config=require('../../config/environment');var controller=require(_0x6036('0x6'));router[_0x6036('0x7')]('/',auth['isAuthenticated'](),controller[_0x6036('0x8')]);router[_0x6036('0x7')](_0x6036('0x9'),auth[_0x6036('0xa')](),controller[_0x6036('0xb')]);router['post']('/',auth[_0x6036('0xa')](),controller['create']);router[_0x6036('0xc')](_0x6036('0x9'),auth[_0x6036('0xa')](),controller[_0x6036('0xd')]);router[_0x6036('0xe')]('/:id',auth[_0x6036('0xa')](),controller['destroy']);module[_0x6036('0xf')]=router; \ No newline at end of file +var _0x3775=['../../config/environment','./intDeskField.controller','isAuthenticated','get','/:id','show','post','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4450b1,_0x214ace){var _0x399b0b=function(_0x2197df){while(--_0x2197df){_0x4450b1['push'](_0x4450b1['shift']());}};_0x399b0b(++_0x214ace);}(_0x3775,0xa5));var _0x5377=function(_0x1fd9c6,_0x4ea9b5){_0x1fd9c6=_0x1fd9c6-0x0;var _0x290e5b=_0x3775[_0x1fd9c6];return _0x290e5b;};'use strict';var multer=require(_0x5377('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5377('0x1'));var express=require(_0x5377('0x2'));var router=express[_0x5377('0x3')]();var auth=require(_0x5377('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5377('0x5'));var controller=require(_0x5377('0x6'));router['get']('/',auth[_0x5377('0x7')](),controller['index']);router[_0x5377('0x8')](_0x5377('0x9'),auth[_0x5377('0x7')](),controller[_0x5377('0xa')]);router[_0x5377('0xb')]('/',auth[_0x5377('0x7')](),controller[_0x5377('0xc')]);router['put']('/:id',auth[_0x5377('0x7')](),controller[_0x5377('0xd')]);router[_0x5377('0xe')](_0x5377('0x9'),auth[_0x5377('0x7')](),controller[_0x5377('0xf')]);module[_0x5377('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 054ae6e..f5830f3 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 _0xb8ad=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x29564d,_0x512be8){var _0x1d9eb7=function(_0x440b8e){while(--_0x440b8e){_0x29564d['push'](_0x29564d['shift']());}};_0x1d9eb7(++_0x512be8);}(_0xb8ad,0x7c));var _0xdb8a=function(_0x234a49,_0x1a8404){_0x234a49=_0x234a49-0x0;var _0xe4cd49=_0xb8ad[_0x234a49];return _0xe4cd49;};'use strict';var Sequelize=require(_0xdb8a('0x0'));module[_0xdb8a('0x1')]={'type':{'type':Sequelize[_0xdb8a('0x2')](_0xdb8a('0x3'),_0xdb8a('0x4'),_0xdb8a('0x5'),_0xdb8a('0x6')),'defaultValue':_0xdb8a('0x3')},'content':{'type':Sequelize[_0xdb8a('0x7')]},'key':{'type':Sequelize[_0xdb8a('0x7')]},'keyType':{'type':Sequelize[_0xdb8a('0x2')](_0xdb8a('0x3'),'variable',_0xdb8a('0x5'))},'keyContent':{'type':Sequelize[_0xdb8a('0x7')]},'idField':{'type':Sequelize[_0xdb8a('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xdb8a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdb8a('0x7')]}}; \ No newline at end of file +var _0xf73c=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf73c,0x1bc));var _0xcf73=function(_0x37e037,_0x493e2b){_0x37e037=_0x37e037-0x0;var _0xbbfb95=_0xf73c[_0x37e037];return _0xbbfb95;};'use strict';var Sequelize=require(_0xcf73('0x0'));module[_0xcf73('0x1')]={'type':{'type':Sequelize[_0xcf73('0x2')](_0xcf73('0x3'),'variable',_0xcf73('0x4'),_0xcf73('0x5')),'defaultValue':_0xcf73('0x3')},'content':{'type':Sequelize[_0xcf73('0x6')]},'key':{'type':Sequelize[_0xcf73('0x6')]},'keyType':{'type':Sequelize[_0xcf73('0x2')](_0xcf73('0x3'),_0xcf73('0x7'),_0xcf73('0x4'))},'keyContent':{'type':Sequelize[_0xcf73('0x6')]},'idField':{'type':Sequelize[_0xcf73('0x6')]},'nameField':{'type':Sequelize[_0xcf73('0x6')]},'customField':{'type':Sequelize[_0xcf73('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcf73('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index da59058..877667e 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 _0x8c46=['save','update','then','destroy','end','error','name','send','index','map','DeskField','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','filter','options','findAll','catch','show','params','includeAll','include','create','body','find','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','apply','reject'];(function(_0x541200,_0x447adf){var _0x209770=function(_0x26a313){while(--_0x26a313){_0x541200['push'](_0x541200['shift']());}};_0x209770(++_0x447adf);}(_0x8c46,0x186));var _0x68c4=function(_0x197d34,_0x480c26){_0x197d34=_0x197d34-0x0;var _0x46129e=_0x8c46[_0x197d34];return _0x46129e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x68c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x68c4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x68c4('0x2'));var moment=require('moment');var BPromise=require(_0x68c4('0x3'));var Mustache=require(_0x68c4('0x4'));var util=require('util');var path=require(_0x68c4('0x5'));var sox=require(_0x68c4('0x6'));var csv=require(_0x68c4('0x7'));var ejs=require(_0x68c4('0x8'));var fs=require('fs');var _=require(_0x68c4('0x9'));var squel=require(_0x68c4('0xa'));var crypto=require('crypto');var jsforce=require(_0x68c4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x68c4('0xc'));var Papa=require(_0x68c4('0xd'));var Redis=require(_0x68c4('0xe'));var authService=require(_0x68c4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x68c4('0x10'));var hardwareService=require(_0x68c4('0x11'));var logger=require(_0x68c4('0x12'))(_0x68c4('0x13'));var utils=require('../../config/utils');var config=require(_0x68c4('0x14'));var licenseUtil=require(_0x68c4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x173d98,_0x3dbbc0){_0x3dbbc0=_0x3dbbc0||0xcc;return function(_0x27cab8){if(_0x27cab8){return _0x173d98[_0x68c4('0x16')](_0x3dbbc0);}return _0x173d98['status'](_0x3dbbc0)['end']();};}function respondWithResult(_0x26d1b8,_0x191d4e){_0x191d4e=_0x191d4e||0xc8;return function(_0x1cacb2){if(_0x1cacb2){return _0x26d1b8[_0x68c4('0x17')](_0x191d4e)[_0x68c4('0x18')](_0x1cacb2);}};}function respondWithFilteredResult(_0x582d3a,_0x1f059a){return function(_0x387177){if(_0x387177){var _0x1dd22f=_0x387177[_0x68c4('0x19')],_0x2c92cf=_0x1f059a['offset'],_0x214e62=_0x1f059a[_0x68c4('0x1a')]+_0x1f059a[_0x68c4('0x1b')],_0x5c6c4d;if(_0x214e62>=_0x1dd22f){_0x214e62=_0x1dd22f;_0x5c6c4d=0xc8;}else{_0x5c6c4d=0xce;}_0x582d3a[_0x68c4('0x17')](_0x5c6c4d);return _0x582d3a['set']('Content-Range',_0x2c92cf+'-'+_0x214e62+'/'+_0x1dd22f)['json'](_0x387177);}return null;};}function patchUpdates(_0x2bbd23){return function(_0x34a025){try{jsonpatch[_0x68c4('0x1c')](_0x34a025,_0x2bbd23,!![]);}catch(_0x393c5c){return BPromise[_0x68c4('0x1d')](_0x393c5c);}return _0x34a025[_0x68c4('0x1e')]();};}function saveUpdates(_0x3ba99b,_0x35b77a){return function(_0x54836e){if(_0x54836e){return _0x54836e[_0x68c4('0x1f')](_0x3ba99b)[_0x68c4('0x20')](function(_0x1ccf11){return _0x1ccf11;});}return null;};}function removeEntity(_0x170a22,_0x5155f5){return function(_0x89a738){if(_0x89a738){return _0x89a738[_0x68c4('0x21')]()[_0x68c4('0x20')](function(){_0x170a22[_0x68c4('0x17')](0xcc)[_0x68c4('0x22')]();});}};}function handleEntityNotFound(_0x53fe5b,_0x34347f){return function(_0x565d5d){if(!_0x565d5d){_0x53fe5b[_0x68c4('0x16')](0x194);}return _0x565d5d;};}function handleError(_0x45a1b4,_0xfd590e){_0xfd590e=_0xfd590e||0x1f4;return function(_0x36d2a6){logger[_0x68c4('0x23')](_0x36d2a6['stack']);if(_0x36d2a6[_0x68c4('0x24')]){delete _0x36d2a6['name'];}_0x45a1b4[_0x68c4('0x17')](_0xfd590e)[_0x68c4('0x25')](_0x36d2a6);};}exports[_0x68c4('0x26')]=function(_0x2f2781,_0x3542af){var _0x3cb9f3={},_0x4cca5b={},_0x194dc6={'count':0x0,'rows':[]};var _0x3249f7=_[_0x68c4('0x27')](db[_0x68c4('0x28')][_0x68c4('0x29')],function(_0x4c56d2){return{'name':_0x4c56d2[_0x68c4('0x2a')],'type':_0x4c56d2['type'][_0x68c4('0x2b')]};});_0x4cca5b[_0x68c4('0x2c')]=_[_0x68c4('0x27')](_0x3249f7,'name');_0x4cca5b['query']=_[_0x68c4('0x2d')](_0x2f2781[_0x68c4('0x2e')]);_0x4cca5b['filters']=_[_0x68c4('0x2f')](_0x4cca5b[_0x68c4('0x2c')],_0x4cca5b[_0x68c4('0x2e')]);_0x3cb9f3[_0x68c4('0x30')]=_['intersection'](_0x4cca5b[_0x68c4('0x2c')],qs[_0x68c4('0x31')](_0x2f2781[_0x68c4('0x2e')][_0x68c4('0x31')]));_0x3cb9f3[_0x68c4('0x30')]=_0x3cb9f3[_0x68c4('0x30')][_0x68c4('0x32')]?_0x3cb9f3[_0x68c4('0x30')]:_0x4cca5b['model'];if(!_0x2f2781[_0x68c4('0x2e')][_0x68c4('0x33')](_0x68c4('0x34'))){_0x3cb9f3[_0x68c4('0x1b')]=qs['limit'](_0x2f2781['query'][_0x68c4('0x1b')]);_0x3cb9f3[_0x68c4('0x1a')]=qs[_0x68c4('0x1a')](_0x2f2781[_0x68c4('0x2e')][_0x68c4('0x1a')]);}_0x3cb9f3[_0x68c4('0x35')]=qs[_0x68c4('0x36')](_0x2f2781[_0x68c4('0x2e')][_0x68c4('0x36')]);_0x3cb9f3[_0x68c4('0x37')]=qs[_0x68c4('0x38')](_['pick'](_0x2f2781[_0x68c4('0x2e')],_0x4cca5b[_0x68c4('0x38')]),_0x3249f7);if(_0x2f2781[_0x68c4('0x2e')]['filter']){_0x3cb9f3[_0x68c4('0x37')]=_[_0x68c4('0x39')](_0x3cb9f3[_0x68c4('0x37')],{'$or':_[_0x68c4('0x27')](_0x3249f7,function(_0x27e118){if(_0x27e118[_0x68c4('0x3a')]!=='VIRTUAL'){var _0x56edaa={};_0x56edaa[_0x27e118[_0x68c4('0x24')]]={'$like':'%'+_0x2f2781['query'][_0x68c4('0x3b')]+'%'};return _0x56edaa;}})});}_0x3cb9f3=_[_0x68c4('0x39')]({},_0x3cb9f3,_0x2f2781[_0x68c4('0x3c')]);var _0x1ce615={'where':_0x3cb9f3['where']};return db[_0x68c4('0x28')]['count'](_0x1ce615)[_0x68c4('0x20')](function(_0x47b340){_0x194dc6[_0x68c4('0x19')]=_0x47b340;if(_0x2f2781[_0x68c4('0x2e')]['includeAll']){_0x3cb9f3['include']=[{'all':!![]}];}return db[_0x68c4('0x28')][_0x68c4('0x3d')](_0x3cb9f3);})[_0x68c4('0x20')](function(_0x47ac5f){_0x194dc6['rows']=_0x47ac5f;return _0x194dc6;})[_0x68c4('0x20')](respondWithFilteredResult(_0x3542af,_0x3cb9f3))[_0x68c4('0x3e')](handleError(_0x3542af,null));};exports[_0x68c4('0x3f')]=function(_0x4fbd85,_0x16ba8e){var _0x447cf4={'raw':!![],'where':{'id':_0x4fbd85[_0x68c4('0x40')]['id']}},_0x28d659={};_0x28d659[_0x68c4('0x2c')]=_['keys'](db[_0x68c4('0x28')][_0x68c4('0x29')]);_0x28d659['query']=_[_0x68c4('0x2d')](_0x4fbd85['query']);_0x28d659['filters']=_[_0x68c4('0x2f')](_0x28d659[_0x68c4('0x2c')],_0x28d659[_0x68c4('0x2e')]);_0x447cf4[_0x68c4('0x30')]=_[_0x68c4('0x2f')](_0x28d659['model'],qs[_0x68c4('0x31')](_0x4fbd85[_0x68c4('0x2e')][_0x68c4('0x31')]));_0x447cf4['attributes']=_0x447cf4[_0x68c4('0x30')][_0x68c4('0x32')]?_0x447cf4['attributes']:_0x28d659[_0x68c4('0x2c')];if(_0x4fbd85[_0x68c4('0x2e')][_0x68c4('0x41')]){_0x447cf4[_0x68c4('0x42')]=[{'all':!![]}];}_0x447cf4=_[_0x68c4('0x39')]({},_0x447cf4,_0x4fbd85[_0x68c4('0x3c')]);return db[_0x68c4('0x28')]['find'](_0x447cf4)['then'](handleEntityNotFound(_0x16ba8e,null))[_0x68c4('0x20')](respondWithResult(_0x16ba8e,null))[_0x68c4('0x3e')](handleError(_0x16ba8e,null));};exports[_0x68c4('0x43')]=function(_0x3fc978,_0x1e7bb1){return db[_0x68c4('0x28')][_0x68c4('0x43')](_0x3fc978[_0x68c4('0x44')],{})[_0x68c4('0x20')](respondWithResult(_0x1e7bb1,0xc9))['catch'](handleError(_0x1e7bb1,null));};exports[_0x68c4('0x1f')]=function(_0x540b13,_0x2ea6d5){if(_0x540b13[_0x68c4('0x44')]['id']){delete _0x540b13[_0x68c4('0x44')]['id'];}return db[_0x68c4('0x28')][_0x68c4('0x45')]({'where':{'id':_0x540b13['params']['id']}})[_0x68c4('0x20')](handleEntityNotFound(_0x2ea6d5,null))[_0x68c4('0x20')](saveUpdates(_0x540b13[_0x68c4('0x44')],null))[_0x68c4('0x20')](respondWithResult(_0x2ea6d5,null))[_0x68c4('0x3e')](handleError(_0x2ea6d5,null));};exports[_0x68c4('0x21')]=function(_0x22cbd4,_0x49dad){return db['DeskField']['find']({'where':{'id':_0x22cbd4[_0x68c4('0x40')]['id']}})[_0x68c4('0x20')](handleEntityNotFound(_0x49dad,null))[_0x68c4('0x20')](removeEntity(_0x49dad,null))[_0x68c4('0x3e')](handleError(_0x49dad,null));}; \ No newline at end of file +var _0x20b5=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','set','Content-Range','reject','save','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','include','DeskField','rows','options','find','catch','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x12aa98,_0x39916d){var _0x42935f=function(_0x37d922){while(--_0x37d922){_0x12aa98['push'](_0x12aa98['shift']());}};_0x42935f(++_0x39916d);}(_0x20b5,0x1aa));var _0x520b=function(_0x50829b,_0x57e56a){_0x50829b=_0x50829b-0x0;var _0x2ef4db=_0x20b5[_0x50829b];return _0x2ef4db;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x520b('0x0'));var rimraf=require(_0x520b('0x1'));var zipdir=require(_0x520b('0x2'));var jsonpatch=require(_0x520b('0x3'));var rp=require('request-promise');var moment=require(_0x520b('0x4'));var BPromise=require(_0x520b('0x5'));var Mustache=require(_0x520b('0x6'));var util=require(_0x520b('0x7'));var path=require(_0x520b('0x8'));var sox=require(_0x520b('0x9'));var csv=require(_0x520b('0xa'));var ejs=require(_0x520b('0xb'));var fs=require('fs');var _=require(_0x520b('0xc'));var squel=require(_0x520b('0xd'));var crypto=require(_0x520b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x520b('0xf'));var toCsv=require(_0x520b('0xa'));var querystring=require(_0x520b('0x10'));var Papa=require(_0x520b('0x11'));var Redis=require('ioredis');var authService=require(_0x520b('0x12'));var qs=require(_0x520b('0x13'));var as=require(_0x520b('0x14'));var hardwareService=require(_0x520b('0x15'));var logger=require(_0x520b('0x16'))(_0x520b('0x17'));var utils=require(_0x520b('0x18'));var config=require(_0x520b('0x19'));var licenseUtil=require(_0x520b('0x1a'));var db=require(_0x520b('0x1b'))['db'];function respondWithStatusCode(_0x3d7236,_0x56c78b){_0x56c78b=_0x56c78b||0xcc;return function(_0x41119c){if(_0x41119c){return _0x3d7236['sendStatus'](_0x56c78b);}return _0x3d7236[_0x520b('0x1c')](_0x56c78b)[_0x520b('0x1d')]();};}function respondWithResult(_0x4b9671,_0x79fdb){_0x79fdb=_0x79fdb||0xc8;return function(_0x228431){if(_0x228431){return _0x4b9671[_0x520b('0x1c')](_0x79fdb)['json'](_0x228431);}};}function respondWithFilteredResult(_0x436130,_0x370eeb){return function(_0x33edbf){if(_0x33edbf){var _0x162213=_0x33edbf[_0x520b('0x1e')],_0x1288db=_0x370eeb[_0x520b('0x1f')],_0x19db0f=_0x370eeb[_0x520b('0x1f')]+_0x370eeb['limit'],_0x52a233;if(_0x19db0f>=_0x162213){_0x19db0f=_0x162213;_0x52a233=0xc8;}else{_0x52a233=0xce;}_0x436130[_0x520b('0x1c')](_0x52a233);return _0x436130[_0x520b('0x20')](_0x520b('0x21'),_0x1288db+'-'+_0x19db0f+'/'+_0x162213)['json'](_0x33edbf);}return null;};}function patchUpdates(_0x3d3e79){return function(_0x2a8d52){try{jsonpatch['apply'](_0x2a8d52,_0x3d3e79,!![]);}catch(_0x132624){return BPromise[_0x520b('0x22')](_0x132624);}return _0x2a8d52[_0x520b('0x23')]();};}function saveUpdates(_0x1bcb21,_0x2c5275){return function(_0x177be0){if(_0x177be0){return _0x177be0['update'](_0x1bcb21)['then'](function(_0x3febcd){return _0x3febcd;});}return null;};}function removeEntity(_0x1aea3f,_0x347e7d){return function(_0x39352f){if(_0x39352f){return _0x39352f[_0x520b('0x24')]()[_0x520b('0x25')](function(){_0x1aea3f[_0x520b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x446e10,_0x525e1b){return function(_0x3e61bb){if(!_0x3e61bb){_0x446e10[_0x520b('0x26')](0x194);}return _0x3e61bb;};}function handleError(_0x1eac3c,_0x5bf7ac){_0x5bf7ac=_0x5bf7ac||0x1f4;return function(_0x42d577){logger[_0x520b('0x27')](_0x42d577[_0x520b('0x28')]);if(_0x42d577[_0x520b('0x29')]){delete _0x42d577['name'];}_0x1eac3c[_0x520b('0x1c')](_0x5bf7ac)[_0x520b('0x2a')](_0x42d577);};}exports[_0x520b('0x2b')]=function(_0x21ef3d,_0x52ec57){var _0x4523a1={},_0x20fa50={},_0x240ffb={'count':0x0,'rows':[]};var _0x1e2a30=_[_0x520b('0x2c')](db['DeskField'][_0x520b('0x2d')],function(_0x2d5b74){return{'name':_0x2d5b74[_0x520b('0x2e')],'type':_0x2d5b74[_0x520b('0x2f')][_0x520b('0x30')]};});_0x20fa50['model']=_['map'](_0x1e2a30,'name');_0x20fa50[_0x520b('0x31')]=_[_0x520b('0x32')](_0x21ef3d[_0x520b('0x31')]);_0x20fa50[_0x520b('0x33')]=_[_0x520b('0x34')](_0x20fa50[_0x520b('0x35')],_0x20fa50[_0x520b('0x31')]);_0x4523a1['attributes']=_[_0x520b('0x34')](_0x20fa50[_0x520b('0x35')],qs[_0x520b('0x36')](_0x21ef3d[_0x520b('0x31')][_0x520b('0x36')]));_0x4523a1[_0x520b('0x37')]=_0x4523a1[_0x520b('0x37')][_0x520b('0x38')]?_0x4523a1[_0x520b('0x37')]:_0x20fa50[_0x520b('0x35')];if(!_0x21ef3d[_0x520b('0x31')][_0x520b('0x39')](_0x520b('0x3a'))){_0x4523a1['limit']=qs['limit'](_0x21ef3d['query']['limit']);_0x4523a1[_0x520b('0x1f')]=qs[_0x520b('0x1f')](_0x21ef3d['query'][_0x520b('0x1f')]);}_0x4523a1['order']=qs[_0x520b('0x3b')](_0x21ef3d[_0x520b('0x31')][_0x520b('0x3b')]);_0x4523a1[_0x520b('0x3c')]=qs['filters'](_['pick'](_0x21ef3d['query'],_0x20fa50[_0x520b('0x33')]),_0x1e2a30);if(_0x21ef3d[_0x520b('0x31')]['filter']){_0x4523a1[_0x520b('0x3c')]=_[_0x520b('0x3d')](_0x4523a1[_0x520b('0x3c')],{'$or':_[_0x520b('0x2c')](_0x1e2a30,function(_0x573edf){if(_0x573edf[_0x520b('0x2f')]!==_0x520b('0x3e')){var _0x2fed1c={};_0x2fed1c[_0x573edf[_0x520b('0x29')]]={'$like':'%'+_0x21ef3d[_0x520b('0x31')][_0x520b('0x3f')]+'%'};return _0x2fed1c;}})});}_0x4523a1=_['merge']({},_0x4523a1,_0x21ef3d['options']);var _0x303215={'where':_0x4523a1[_0x520b('0x3c')]};return db['DeskField']['count'](_0x303215)[_0x520b('0x25')](function(_0x52ee79){_0x240ffb[_0x520b('0x1e')]=_0x52ee79;if(_0x21ef3d[_0x520b('0x31')][_0x520b('0x40')]){_0x4523a1[_0x520b('0x41')]=[{'all':!![]}];}return db[_0x520b('0x42')]['findAll'](_0x4523a1);})['then'](function(_0x101695){_0x240ffb[_0x520b('0x43')]=_0x101695;return _0x240ffb;})[_0x520b('0x25')](respondWithFilteredResult(_0x52ec57,_0x4523a1))['catch'](handleError(_0x52ec57,null));};exports['show']=function(_0x533a37,_0x3488e1){var _0x31e325={'raw':!![],'where':{'id':_0x533a37['params']['id']}},_0x413967={};_0x413967[_0x520b('0x35')]=_['keys'](db[_0x520b('0x42')][_0x520b('0x2d')]);_0x413967[_0x520b('0x31')]=_[_0x520b('0x32')](_0x533a37[_0x520b('0x31')]);_0x413967[_0x520b('0x33')]=_['intersection'](_0x413967[_0x520b('0x35')],_0x413967[_0x520b('0x31')]);_0x31e325[_0x520b('0x37')]=_['intersection'](_0x413967[_0x520b('0x35')],qs[_0x520b('0x36')](_0x533a37[_0x520b('0x31')][_0x520b('0x36')]));_0x31e325['attributes']=_0x31e325[_0x520b('0x37')][_0x520b('0x38')]?_0x31e325['attributes']:_0x413967[_0x520b('0x35')];if(_0x533a37[_0x520b('0x31')][_0x520b('0x40')]){_0x31e325[_0x520b('0x41')]=[{'all':!![]}];}_0x31e325=_[_0x520b('0x3d')]({},_0x31e325,_0x533a37[_0x520b('0x44')]);return db[_0x520b('0x42')][_0x520b('0x45')](_0x31e325)[_0x520b('0x25')](handleEntityNotFound(_0x3488e1,null))[_0x520b('0x25')](respondWithResult(_0x3488e1,null))[_0x520b('0x46')](handleError(_0x3488e1,null));};exports['create']=function(_0x2efabf,_0x256acf){return db['DeskField'][_0x520b('0x47')](_0x2efabf[_0x520b('0x48')],{})[_0x520b('0x25')](respondWithResult(_0x256acf,0xc9))['catch'](handleError(_0x256acf,null));};exports[_0x520b('0x49')]=function(_0x4dd846,_0x3d7fd3){if(_0x4dd846['body']['id']){delete _0x4dd846[_0x520b('0x48')]['id'];}return db['DeskField']['find']({'where':{'id':_0x4dd846[_0x520b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3d7fd3,null))[_0x520b('0x25')](saveUpdates(_0x4dd846[_0x520b('0x48')],null))[_0x520b('0x25')](respondWithResult(_0x3d7fd3,null))['catch'](handleError(_0x3d7fd3,null));};exports[_0x520b('0x24')]=function(_0x5b72f7,_0x55c1b9){return db['DeskField'][_0x520b('0x45')]({'where':{'id':_0x5b72f7[_0x520b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x55c1b9,null))[_0x520b('0x25')](removeEntity(_0x55c1b9,null))[_0x520b('0x46')](handleError(_0x55c1b9,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 2c2cc5f..4f724cd 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 _0x92eb=['./intDeskField.attributes','exports','define','desk_unique_index','lodash','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4257a6,_0x402e2e){var _0x10eaac=function(_0x1e885f){while(--_0x1e885f){_0x4257a6['push'](_0x4257a6['shift']());}};_0x10eaac(++_0x402e2e);}(_0x92eb,0x9e));var _0xb92e=function(_0x3ca38e,_0x357291){_0x3ca38e=_0x3ca38e-0x0;var _0x266f9e=_0x92eb[_0x3ca38e];return _0x266f9e;};'use strict';var _=require(_0xb92e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb92e('0x1'));var moment=require(_0xb92e('0x2'));var BPromise=require(_0xb92e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb92e('0x4'));var rimraf=require(_0xb92e('0x5'));var config=require(_0xb92e('0x6'));var attributes=require(_0xb92e('0x7'));module[_0xb92e('0x8')]=function(_0xbc066a,_0x1153b2){return _0xbc066a[_0xb92e('0x9')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xb92e('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x731d=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','FieldId','util'];(function(_0x4191bc,_0x3096c5){var _0x1ffd4e=function(_0x36faed){while(--_0x36faed){_0x4191bc['push'](_0x4191bc['shift']());}};_0x1ffd4e(++_0x3096c5);}(_0x731d,0x151));var _0xd731=function(_0x42ee16,_0x3b54b6){_0x42ee16=_0x42ee16-0x0;var _0x5c0fd3=_0x731d[_0x42ee16];return _0x5c0fd3;};'use strict';var _=require('lodash');var util=require(_0xd731('0x0'));var logger=require(_0xd731('0x1'))(_0xd731('0x2'));var moment=require(_0xd731('0x3'));var BPromise=require(_0xd731('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd731('0x5'));var config=require(_0xd731('0x6'));var attributes=require(_0xd731('0x7'));module[_0xd731('0x8')]=function(_0x271d02,_0x40ea6a){return _0x271d02[_0xd731('0x9')](_0xd731('0xa'),attributes,{'tableName':_0xd731('0xb'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField',_0xd731('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 9eb7729..6bcf466 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 _0x9fa5=['request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','http','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x9fa5,0x64));var _0x59fa=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x9fa5[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x59fa('0x0'));var util=require(_0x59fa('0x1'));var moment=require(_0x59fa('0x2'));var BPromise=require(_0x59fa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x59fa('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x59fa('0x5'))(_0x59fa('0x6'));var config=require(_0x59fa('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x59fa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41bb2d,_0x2fb51e,_0x5d174c){return new BPromise(function(_0x3404e7,_0xdf522e){return client['request'](_0x41bb2d,_0x5d174c)[_0x59fa('0x9')](function(_0x1e67e5){logger[_0x59fa('0xa')](_0x59fa('0xb'),_0x2fb51e,'request\x20sent');logger[_0x59fa('0xc')](_0x59fa('0xd'),_0x2fb51e,_0x59fa('0xe'),JSON[_0x59fa('0xf')](_0x1e67e5));if(_0x1e67e5['error']){if(_0x1e67e5['error'][_0x59fa('0x10')]===0x1f4){logger[_0x59fa('0x11')](_0x59fa('0xb'),_0x2fb51e,_0x1e67e5[_0x59fa('0x11')][_0x59fa('0x12')]);return _0xdf522e(_0x1e67e5[_0x59fa('0x11')][_0x59fa('0x12')]);}logger[_0x59fa('0x11')](_0x59fa('0xb'),_0x2fb51e,_0x1e67e5[_0x59fa('0x11')][_0x59fa('0x12')]);return _0x3404e7(_0x1e67e5[_0x59fa('0x11')][_0x59fa('0x12')]);}else{logger[_0x59fa('0xa')]('DeskField,\x20%s,\x20%s',_0x2fb51e,_0x59fa('0xe'));_0x3404e7(_0x1e67e5['result'][_0x59fa('0x12')]);}})['catch'](function(_0x4dac06){logger[_0x59fa('0x11')](_0x59fa('0xb'),_0x2fb51e,_0x4dac06);_0xdf522e(_0x4dac06);});});} \ No newline at end of file +var _0xa1d4=['request','then','info','request\x20sent','debug','error','code','DeskField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x3b5bca,_0x326805){var _0x39833=function(_0x16f56f){while(--_0x16f56f){_0x3b5bca['push'](_0x3b5bca['shift']());}};_0x39833(++_0x326805);}(_0xa1d4,0xba));var _0x4a1d=function(_0x4826d9,_0x100d50){_0x4826d9=_0x4826d9-0x0;var _0x485dde=_0xa1d4[_0x4826d9];return _0x485dde;};'use strict';var _=require(_0x4a1d('0x0'));var util=require(_0x4a1d('0x1'));var moment=require(_0x4a1d('0x2'));var BPromise=require(_0x4a1d('0x3'));var rs=require(_0x4a1d('0x4'));var fs=require('fs');var Redis=require(_0x4a1d('0x5'));var db=require(_0x4a1d('0x6'))['db'];var utils=require(_0x4a1d('0x7'));var logger=require(_0x4a1d('0x8'))(_0x4a1d('0x9'));var config=require('../../config/environment');var jayson=require(_0x4a1d('0xa'));var client=jayson[_0x4a1d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ddd0e,_0x1092ba,_0x5b3ab1){return new BPromise(function(_0x3e89c7,_0x53b905){return client[_0x4a1d('0xc')](_0x2ddd0e,_0x5b3ab1)[_0x4a1d('0xd')](function(_0x6410b4){logger[_0x4a1d('0xe')]('DeskField,\x20%s,\x20%s',_0x1092ba,_0x4a1d('0xf'));logger[_0x4a1d('0x10')]('DeskField,\x20%s,\x20%s,\x20%s',_0x1092ba,_0x4a1d('0xf'),JSON['stringify'](_0x6410b4));if(_0x6410b4[_0x4a1d('0x11')]){if(_0x6410b4['error'][_0x4a1d('0x12')]===0x1f4){logger[_0x4a1d('0x11')](_0x4a1d('0x13'),_0x1092ba,_0x6410b4[_0x4a1d('0x11')][_0x4a1d('0x14')]);return _0x53b905(_0x6410b4[_0x4a1d('0x11')][_0x4a1d('0x14')]);}logger[_0x4a1d('0x11')](_0x4a1d('0x13'),_0x1092ba,_0x6410b4['error']['message']);return _0x3e89c7(_0x6410b4[_0x4a1d('0x11')][_0x4a1d('0x14')]);}else{logger[_0x4a1d('0xe')](_0x4a1d('0x13'),_0x1092ba,'request\x20sent');_0x3e89c7(_0x6410b4[_0x4a1d('0x15')][_0x4a1d('0x14')]);}})['catch'](function(_0x331e9d){logger[_0x4a1d('0x11')](_0x4a1d('0x13'),_0x1092ba,_0x331e9d);_0x53b905(_0x331e9d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index ec5b49e..743b9e6 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 _0x5f2f=['/:id','/:id/configurations','/:id/fields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x10e1da,_0x86efc5){var _0x4679d9=function(_0x3005d5){while(--_0x3005d5){_0x10e1da['push'](_0x10e1da['shift']());}};_0x4679d9(++_0x86efc5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4e20a1,_0x3f1959){_0x4e20a1=_0x4e20a1-0x0;var _0x312bdc=_0x5f2f[_0x4e20a1];return _0x312bdc;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Account.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['getConfigurations']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getFields']);router[_0xf5f2('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf5f2('0xe')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x11')]);router[_0xf5f2('0x12')]('/:id',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x13')]);module[_0xf5f2('0x14')]=router; \ No newline at end of file +var _0xb10b=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated'];(function(_0x2201d5,_0x22c864){var _0x37e8d2=function(_0x11cad){while(--_0x11cad){_0x2201d5['push'](_0x2201d5['shift']());}};_0x37e8d2(++_0x22c864);}(_0xb10b,0x12a));var _0xbb10=function(_0x5ea2b1,_0x50f848){_0x5ea2b1=_0x5ea2b1-0x0;var _0x1773c0=_0xb10b[_0x5ea2b1];return _0x1773c0;};'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 auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getFields']);router['post']('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router[_0xbb10('0x10')]('/:id/configurations',auth[_0xbb10('0x9')](),controller['addConfiguration']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index ef32d59..64c1251 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 _0x20cf=['exports','STRING'];(function(_0x5a1d58,_0x42ab8d){var _0x5911a9=function(_0x3769a4){while(--_0x3769a4){_0x5a1d58['push'](_0x5a1d58['shift']());}};_0x5911a9(++_0x42ab8d);}(_0x20cf,0x186));var _0xf20c=function(_0x5cc3b6,_0x249e4f){_0x5cc3b6=_0x5cc3b6-0x0;var _0x3ea2e0=_0x20cf[_0x5cc3b6];return _0x3ea2e0;};'use strict';var Sequelize=require('sequelize');module[_0xf20c('0x0')]={'name':{'type':Sequelize[_0xf20c('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xf20c('0x1')]},'remoteUri':{'type':Sequelize[_0xf20c('0x1')]},'tenantId':{'type':Sequelize[_0xf20c('0x1')]},'clientId':{'type':Sequelize[_0xf20c('0x1')]},'clientSecret':{'type':Sequelize[_0xf20c('0x1')]},'serverUrl':{'type':Sequelize[_0xf20c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf20c('0x1')]}}; \ No newline at end of file +var _0xebb7=['exports','STRING','sequelize'];(function(_0x39e743,_0x37c791){var _0x30c6d8=function(_0x3392bf){while(--_0x3392bf){_0x39e743['push'](_0x39e743['shift']());}};_0x30c6d8(++_0x37c791);}(_0xebb7,0x1ee));var _0x7ebb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xebb7[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x7ebb('0x0'));module[_0x7ebb('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7ebb('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7ebb('0x2')]},'tenantId':{'type':Sequelize[_0x7ebb('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x7ebb('0x2')]},'serverUrl':{'type':Sequelize[_0x7ebb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7ebb('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 3bb53d0..71f4baf 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 _0xc1c6=['EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','isNil','BooleanAttributeMetadata','all','BigIntAttributeMetadata','IntegerAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','push','test','stack','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','offset','set','apply','save','update','destroy','name','Dynamics365Account','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','merge','VIRTUAL','filter','options','count','include','findAll','rows','show','params','includeAll','find','create','body','getConfigurations','findOne','Dynamics365Configuration','order','nolimit','addConfiguration','AccountId','getSubjects','channel','type','getDescriptions','Dynamics365Field','Subjects','getFields','ticketType','incident','Incident','PhoneCall','title','description','ownerid','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','/oauth2/token','clientId','password','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x59a78a,_0x71e34b){_0x59a78a=_0x59a78a-0x0;var _0x271141=_0xc1c6[_0x59a78a];return _0x271141;};'use strict';var pdf=require(_0x6c1c('0x0'));var emlformat=require(_0x6c1c('0x1'));var rimraf=require(_0x6c1c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c1c('0x3'));var rp=require('request-promise');var moment=require(_0x6c1c('0x4'));var BPromise=require(_0x6c1c('0x5'));var Mustache=require(_0x6c1c('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6c1c('0x7'));var csv=require('to-csv');var ejs=require(_0x6c1c('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];var integrations=require(_0x6c1c('0x17'));var jayson=require(_0x6c1c('0x18'));var client=jayson['client'][_0x6c1c('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5e64b7,_0x357370,_0x15a1fc,_0x2d279e){return new BPromise(function(_0x154107,_0x350e6f){var _0x3f532c=_0x2d279e||client;return _0x3f532c[_0x6c1c('0x1a')](_0x5e64b7,_0x15a1fc)[_0x6c1c('0x1b')](function(_0x448f35){logger['info'](_0x6c1c('0x1c'),_0x357370,_0x6c1c('0x1d'));logger['debug'](_0x6c1c('0x1e'),_0x357370,_0x6c1c('0x1d'),JSON['stringify'](_0x448f35));if(_0x448f35[_0x6c1c('0x1f')]){if(_0x448f35['error'][_0x6c1c('0x20')]===0x1f4){logger[_0x6c1c('0x1f')]('Dynamics365Account,\x20%s,\x20%s',_0x357370,_0x448f35[_0x6c1c('0x1f')]['message']);return _0x350e6f(_0x448f35[_0x6c1c('0x1f')][_0x6c1c('0x21')]);}logger[_0x6c1c('0x1f')](_0x6c1c('0x1c'),_0x357370,_0x448f35[_0x6c1c('0x1f')][_0x6c1c('0x21')]);return _0x154107(_0x448f35[_0x6c1c('0x1f')][_0x6c1c('0x21')]);}else{logger[_0x6c1c('0x22')](_0x6c1c('0x1c'),_0x357370,_0x6c1c('0x1d'));_0x154107(_0x448f35[_0x6c1c('0x23')][_0x6c1c('0x21')]);}})[_0x6c1c('0x24')](function(_0x31fed2){logger[_0x6c1c('0x1f')](_0x6c1c('0x1c'),_0x357370,_0x31fed2);_0x350e6f(_0x31fed2);});});}function respondWithStatusCode(_0x12c638,_0x3a3f13){_0x3a3f13=_0x3a3f13||0xcc;return function(_0x1dba08){if(_0x1dba08){return _0x12c638[_0x6c1c('0x25')](_0x3a3f13);}return _0x12c638[_0x6c1c('0x26')](_0x3a3f13)[_0x6c1c('0x27')]();};}function respondWithResult(_0x7ff10d,_0x18452d){_0x18452d=_0x18452d||0xc8;return function(_0x80bc05){if(_0x80bc05){return _0x7ff10d[_0x6c1c('0x26')](_0x18452d)[_0x6c1c('0x28')](_0x80bc05);}};}function respondWithFilteredResult(_0x2feaf4,_0x5f4568){return function(_0x2595c3){if(_0x2595c3){var _0x4d73aa=_0x2595c3['count'],_0x10e9f7=_0x5f4568[_0x6c1c('0x29')],_0x4c23f8=_0x5f4568[_0x6c1c('0x29')]+_0x5f4568['limit'],_0xcd3179;if(_0x4c23f8>=_0x4d73aa){_0x4c23f8=_0x4d73aa;_0xcd3179=0xc8;}else{_0xcd3179=0xce;}_0x2feaf4[_0x6c1c('0x26')](_0xcd3179);return _0x2feaf4[_0x6c1c('0x2a')]('Content-Range',_0x10e9f7+'-'+_0x4c23f8+'/'+_0x4d73aa)[_0x6c1c('0x28')](_0x2595c3);}return null;};}function patchUpdates(_0x19a8f1){return function(_0xdcef7){try{jsonpatch[_0x6c1c('0x2b')](_0xdcef7,_0x19a8f1,!![]);}catch(_0x4fc279){return BPromise['reject'](_0x4fc279);}return _0xdcef7[_0x6c1c('0x2c')]();};}function saveUpdates(_0x45128c,_0x21acef){return function(_0x30cec5){if(_0x30cec5){return _0x30cec5[_0x6c1c('0x2d')](_0x45128c)[_0x6c1c('0x1b')](function(_0x4efa48){return _0x4efa48;});}return null;};}function removeEntity(_0x348757,_0x2d6ceb){return function(_0x509daa){if(_0x509daa){return _0x509daa[_0x6c1c('0x2e')]()[_0x6c1c('0x1b')](function(){_0x348757[_0x6c1c('0x26')](0xcc)[_0x6c1c('0x27')]();});}};}function handleEntityNotFound(_0x4f1848,_0x322cff){return function(_0x347aff){if(!_0x347aff){_0x4f1848[_0x6c1c('0x25')](0x194);}return _0x347aff;};}function handleError(_0x5adddc,_0x1356d4){_0x1356d4=_0x1356d4||0x1f4;return function(_0x4e5767){logger[_0x6c1c('0x1f')](_0x4e5767['stack']);if(_0x4e5767[_0x6c1c('0x2f')]){delete _0x4e5767[_0x6c1c('0x2f')];}_0x5adddc[_0x6c1c('0x26')](_0x1356d4)['send'](_0x4e5767);};}exports['index']=function(_0xa4521c,_0x3264e6){var _0x3ab64d={},_0x5c82f9={},_0x1a9132={'count':0x0,'rows':[]};var _0x4c1591=_['map'](db[_0x6c1c('0x30')][_0x6c1c('0x31')],function(_0x30d0fe){return{'name':_0x30d0fe[_0x6c1c('0x32')],'type':_0x30d0fe['type'][_0x6c1c('0x33')]};});_0x5c82f9[_0x6c1c('0x34')]=_[_0x6c1c('0x35')](_0x4c1591,_0x6c1c('0x2f'));_0x5c82f9[_0x6c1c('0x36')]=_[_0x6c1c('0x37')](_0xa4521c[_0x6c1c('0x36')]);_0x5c82f9[_0x6c1c('0x38')]=_[_0x6c1c('0x39')](_0x5c82f9[_0x6c1c('0x34')],_0x5c82f9['query']);_0x3ab64d[_0x6c1c('0x3a')]=_[_0x6c1c('0x39')](_0x5c82f9[_0x6c1c('0x34')],qs[_0x6c1c('0x3b')](_0xa4521c[_0x6c1c('0x36')]['fields']));_0x3ab64d['attributes']=_0x3ab64d['attributes'][_0x6c1c('0x3c')]?_0x3ab64d['attributes']:_0x5c82f9['model'];if(!_0xa4521c[_0x6c1c('0x36')][_0x6c1c('0x3d')]('nolimit')){_0x3ab64d[_0x6c1c('0x3e')]=qs[_0x6c1c('0x3e')](_0xa4521c[_0x6c1c('0x36')]['limit']);_0x3ab64d[_0x6c1c('0x29')]=qs[_0x6c1c('0x29')](_0xa4521c['query'][_0x6c1c('0x29')]);}_0x3ab64d['order']=qs[_0x6c1c('0x3f')](_0xa4521c[_0x6c1c('0x36')][_0x6c1c('0x3f')]);_0x3ab64d[_0x6c1c('0x40')]=qs[_0x6c1c('0x38')](_['pick'](_0xa4521c[_0x6c1c('0x36')],_0x5c82f9[_0x6c1c('0x38')]),_0x4c1591);if(_0xa4521c[_0x6c1c('0x36')]['filter']){_0x3ab64d[_0x6c1c('0x40')]=_[_0x6c1c('0x41')](_0x3ab64d[_0x6c1c('0x40')],{'$or':_[_0x6c1c('0x35')](_0x4c1591,function(_0x2437a0){if(_0x2437a0['type']!==_0x6c1c('0x42')){var _0x4bd6e5={};_0x4bd6e5[_0x2437a0['name']]={'$like':'%'+_0xa4521c['query'][_0x6c1c('0x43')]+'%'};return _0x4bd6e5;}})});}_0x3ab64d=_[_0x6c1c('0x41')]({},_0x3ab64d,_0xa4521c[_0x6c1c('0x44')]);var _0xa0127e={'where':_0x3ab64d[_0x6c1c('0x40')]};return db[_0x6c1c('0x30')][_0x6c1c('0x45')](_0xa0127e)[_0x6c1c('0x1b')](function(_0x5ed2d7){_0x1a9132[_0x6c1c('0x45')]=_0x5ed2d7;if(_0xa4521c[_0x6c1c('0x36')]['includeAll']){_0x3ab64d[_0x6c1c('0x46')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x6c1c('0x47')](_0x3ab64d);})[_0x6c1c('0x1b')](function(_0x221e0d){_0x1a9132[_0x6c1c('0x48')]=_0x221e0d;return _0x1a9132;})[_0x6c1c('0x1b')](respondWithFilteredResult(_0x3264e6,_0x3ab64d))['catch'](handleError(_0x3264e6,null));};exports[_0x6c1c('0x49')]=function(_0x58d075,_0x2a59bc){var _0x23c429={'raw':![],'where':{'id':_0x58d075[_0x6c1c('0x4a')]['id']}},_0x2f6ce0={};_0x2f6ce0[_0x6c1c('0x34')]=_[_0x6c1c('0x37')](db['Dynamics365Account'][_0x6c1c('0x31')]);_0x2f6ce0[_0x6c1c('0x36')]=_['keys'](_0x58d075[_0x6c1c('0x36')]);_0x2f6ce0[_0x6c1c('0x38')]=_[_0x6c1c('0x39')](_0x2f6ce0[_0x6c1c('0x34')],_0x2f6ce0['query']);_0x23c429[_0x6c1c('0x3a')]=_[_0x6c1c('0x39')](_0x2f6ce0[_0x6c1c('0x34')],qs['fields'](_0x58d075['query']['fields']));_0x23c429['attributes']=_0x23c429['attributes'][_0x6c1c('0x3c')]?_0x23c429[_0x6c1c('0x3a')]:_0x2f6ce0['model'];if(_0x58d075[_0x6c1c('0x36')][_0x6c1c('0x4b')]){_0x23c429[_0x6c1c('0x46')]=[{'all':!![]}];}_0x23c429=_['merge']({},_0x23c429,_0x58d075['options']);return db[_0x6c1c('0x30')][_0x6c1c('0x4c')](_0x23c429)['then'](handleEntityNotFound(_0x2a59bc,null))[_0x6c1c('0x1b')](respondWithResult(_0x2a59bc,null))[_0x6c1c('0x24')](handleError(_0x2a59bc,null));};exports[_0x6c1c('0x4d')]=function(_0x4783f9,_0x1f4e95){return db[_0x6c1c('0x30')]['create'](_0x4783f9[_0x6c1c('0x4e')],{})[_0x6c1c('0x1b')](respondWithResult(_0x1f4e95,0xc9))['catch'](handleError(_0x1f4e95,null));};exports['update']=function(_0x69f90b,_0x1c6432){if(_0x69f90b[_0x6c1c('0x4e')]['id']){delete _0x69f90b['body']['id'];}return db[_0x6c1c('0x30')][_0x6c1c('0x4c')]({'where':{'id':_0x69f90b[_0x6c1c('0x4a')]['id']}})[_0x6c1c('0x1b')](handleEntityNotFound(_0x1c6432,null))['then'](saveUpdates(_0x69f90b['body'],null))[_0x6c1c('0x1b')](respondWithResult(_0x1c6432,null))[_0x6c1c('0x24')](handleError(_0x1c6432,null));};exports[_0x6c1c('0x2e')]=function(_0x50e3f8,_0x516f1e){return db[_0x6c1c('0x30')][_0x6c1c('0x4c')]({'where':{'id':_0x50e3f8['params']['id']}})[_0x6c1c('0x1b')](handleEntityNotFound(_0x516f1e,null))[_0x6c1c('0x1b')](removeEntity(_0x516f1e,null))[_0x6c1c('0x24')](handleError(_0x516f1e,null));};exports[_0x6c1c('0x4f')]=function(_0x261fb1,_0x24c993,_0x4f027a){var _0x398bca={};var _0x5a2692={};var _0x103fe1;var _0x1930ea;return db[_0x6c1c('0x30')][_0x6c1c('0x50')]({'where':{'id':_0x261fb1['params']['id']}})['then'](handleEntityNotFound(_0x24c993,null))[_0x6c1c('0x1b')](function(_0x3255e1){if(_0x3255e1){_0x103fe1=_0x3255e1;_0x5a2692[_0x6c1c('0x34')]=_['keys'](db[_0x6c1c('0x51')][_0x6c1c('0x31')]);_0x5a2692[_0x6c1c('0x36')]=_[_0x6c1c('0x37')](_0x261fb1[_0x6c1c('0x36')]);_0x5a2692[_0x6c1c('0x38')]=_[_0x6c1c('0x39')](_0x5a2692['model'],_0x5a2692[_0x6c1c('0x36')]);_0x398bca['attributes']=_[_0x6c1c('0x39')](_0x5a2692[_0x6c1c('0x34')],qs[_0x6c1c('0x3b')](_0x261fb1[_0x6c1c('0x36')]['fields']));_0x398bca[_0x6c1c('0x3a')]=_0x398bca[_0x6c1c('0x3a')][_0x6c1c('0x3c')]?_0x398bca[_0x6c1c('0x3a')]:_0x5a2692[_0x6c1c('0x34')];_0x398bca[_0x6c1c('0x52')]=qs[_0x6c1c('0x3f')](_0x261fb1[_0x6c1c('0x36')][_0x6c1c('0x3f')]);_0x398bca[_0x6c1c('0x40')]=qs[_0x6c1c('0x38')](_['pick'](_0x261fb1[_0x6c1c('0x36')],_0x5a2692[_0x6c1c('0x38')]));if(_0x261fb1[_0x6c1c('0x36')][_0x6c1c('0x43')]){_0x398bca[_0x6c1c('0x40')]=_['merge'](_0x398bca[_0x6c1c('0x40')],{'$or':_[_0x6c1c('0x35')](_0x398bca['attributes'],function(_0x188dfd){var _0x14054d={};_0x14054d[_0x188dfd]={'$like':'%'+_0x261fb1[_0x6c1c('0x36')]['filter']+'%'};return _0x14054d;})});}_0x398bca=_[_0x6c1c('0x41')]({},_0x398bca,_0x261fb1[_0x6c1c('0x44')]);return _0x103fe1[_0x6c1c('0x4f')](_0x398bca);}})[_0x6c1c('0x1b')](function(_0x2fe38a){if(_0x2fe38a){_0x1930ea=_0x2fe38a[_0x6c1c('0x3c')];if(!_0x261fb1['query']['hasOwnProperty'](_0x6c1c('0x53'))){_0x398bca[_0x6c1c('0x3e')]=qs['limit'](_0x261fb1['query']['limit']);_0x398bca[_0x6c1c('0x29')]=qs[_0x6c1c('0x29')](_0x261fb1[_0x6c1c('0x36')][_0x6c1c('0x29')]);}return _0x103fe1['getConfigurations'](_0x398bca);}})[_0x6c1c('0x1b')](function(_0x57848e){if(_0x57848e){return _0x57848e?{'count':_0x1930ea,'rows':_0x57848e}:null;}})['then'](respondWithResult(_0x24c993,null))['catch'](handleError(_0x24c993,null));};exports[_0x6c1c('0x54')]=function(_0x1e20a9,_0x2f98a4,_0x42ae1b){if(_0x1e20a9[_0x6c1c('0x4e')]['id']){delete _0x1e20a9[_0x6c1c('0x4e')]['id'];}return db['Dynamics365Account'][_0x6c1c('0x50')]({'where':{'id':_0x1e20a9[_0x6c1c('0x4a')]['id']}})[_0x6c1c('0x1b')](handleEntityNotFound(_0x2f98a4,null))['then'](function(_0x585a42){if(_0x585a42){_0x1e20a9['body'][_0x6c1c('0x55')]=_0x585a42['id'];_0x1e20a9[_0x6c1c('0x4e')]['Subjects']=integrations[_0x6c1c('0x56')](_0x1e20a9['body'][_0x6c1c('0x57')],_0x1e20a9[_0x6c1c('0x4e')][_0x6c1c('0x58')]);_0x1e20a9[_0x6c1c('0x4e')]['Descriptions']=integrations[_0x6c1c('0x59')](_0x1e20a9[_0x6c1c('0x4e')]['channel'],_0x1e20a9['body'][_0x6c1c('0x58')]);return db[_0x6c1c('0x51')][_0x6c1c('0x4d')](_0x1e20a9['body'],{'include':[{'model':db[_0x6c1c('0x5a')],'as':_0x6c1c('0x5b')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2f98a4,null))['catch'](handleError(_0x2f98a4,null));};exports[_0x6c1c('0x5c')]=function(_0x56d05a,_0xea59ea,_0x384d83){var _0xc19e0d=_0x56d05a['query'][_0x6c1c('0x5d')];var _0x21a0b5=_0xc19e0d===_0x6c1c('0x5e')?_0x6c1c('0x5f'):_0x6c1c('0x60');var _0x4b24d7='';var _0x172bd4='';var _0x55c929='';var _0x3e61cb='';var _0x11c901='';var _0x3d0b51='';var _0x458316='';var _0x31eac6='';var _0x302948=[_0x6c1c('0x61'),_0x6c1c('0x62'),'customerid',_0x6c1c('0x63'),'caseorigincode','subject',_0x6c1c('0x64'),_0x6c1c('0x65'),_0x6c1c('0x66'),_0x6c1c('0x67')];var _0x5e5800=[_0x6c1c('0x68'),'accountidyominame',_0x6c1c('0x69'),'billedserviceunits',_0x6c1c('0x6a'),_0x6c1c('0x6b'),_0x6c1c('0x6c'),'contractidname',_0x6c1c('0x6d'),_0x6c1c('0x6e'),_0x6c1c('0x6f'),'createdbyyominame',_0x6c1c('0x70'),_0x6c1c('0x71'),_0x6c1c('0x72'),_0x6c1c('0x73'),'customeridtype',_0x6c1c('0x74'),_0x6c1c('0x75'),_0x6c1c('0x76'),_0x6c1c('0x77'),_0x6c1c('0x78'),'escalatedon',_0x6c1c('0x79'),_0x6c1c('0x7a'),_0x6c1c('0x7b'),_0x6c1c('0x7c'),'influencescore',_0x6c1c('0x7d'),_0x6c1c('0x7e'),_0x6c1c('0x7f'),'modifiedbyexternalpartyname',_0x6c1c('0x80'),_0x6c1c('0x81'),'modifiedbyyominame',_0x6c1c('0x82'),'modifiedonbehalfbyname',_0x6c1c('0x83'),_0x6c1c('0x84'),_0x6c1c('0x85'),_0x6c1c('0x86'),'onholdtime',_0x6c1c('0x87'),_0x6c1c('0x88'),_0x6c1c('0x89'),'owneridyominame',_0x6c1c('0x8a'),_0x6c1c('0x8b'),_0x6c1c('0x8c'),_0x6c1c('0x8d'),'productidname',_0x6c1c('0x8e'),_0x6c1c('0x8f'),_0x6c1c('0x90'),'responseby',_0x6c1c('0x91'),'responsiblecontactidyominame',_0x6c1c('0x92'),_0x6c1c('0x93'),_0x6c1c('0x94'),_0x6c1c('0x95'),_0x6c1c('0x96'),_0x6c1c('0x97'),_0x6c1c('0x98'),_0x6c1c('0x99'),'timezoneruleversionnumber',_0x6c1c('0x9a'),'traversedpath',_0x6c1c('0x9b'),_0x6c1c('0x9c')];var _0x11220a=_0x302948[_0x6c1c('0x9d')](_0x5e5800);return db['Dynamics365Account'][_0x6c1c('0x50')]({'where':{'id':_0x56d05a[_0x6c1c('0x4a')]['id']},'attributes':['id',_0x6c1c('0x9e'),'password',_0x6c1c('0x9f'),_0x6c1c('0xa0'),'clientId','clientSecret']})[_0x6c1c('0x1b')](handleEntityNotFound(_0xea59ea,null))[_0x6c1c('0x1b')](function(_0x8e8ee2){if(_0x8e8ee2){_0x31eac6=_0x8e8ee2[_0x6c1c('0x9f')];var _0x305cc2=_0x31eac6[_0x6c1c('0xa1')](-0x1);if(_0x305cc2==='/'){_0x31eac6=_0x31eac6[_0x6c1c('0xa2')](0x0,_0x31eac6[_0x6c1c('0xa3')](_0x305cc2));}_0x458316=util[_0x6c1c('0xa4')](_0x6c1c('0xa5'),_0x31eac6);var _0x436c3f={'method':_0x6c1c('0xa6'),'uri':'https://login.microsoftonline.com/'+_0x8e8ee2[_0x6c1c('0xa0')]+_0x6c1c('0xa7'),'form':{'client_id':_0x8e8ee2[_0x6c1c('0xa8')],'resource':_0x31eac6,'username':_0x8e8ee2[_0x6c1c('0x9e')],'password':_0x8e8ee2[_0x6c1c('0xa9')],'grant_type':_0x6c1c('0xa9'),'client_secret':_0x8e8ee2[_0x6c1c('0xaa')]},'json':!![]};return rp(_0x436c3f);}})['then'](function(_0xe922ce){_0x3d0b51=_0xe922ce['access_token'];var _0x4df859={'method':_0x6c1c('0xab'),'uri':encodeURI(_0x458316+_0x6c1c('0xac')+_0x21a0b5+'\x27'),'headers':{'Authorization':_0x6c1c('0xad')+_0x3d0b51,'If-None-Match':null,'OData-Version':_0x6c1c('0xae')},'json':!![]};return rp(_0x4df859);})[_0x6c1c('0x1b')](function(_0x21b63d){var _0x25198a=_0x21b63d[_0x6c1c('0xaf')][0x0];var _0x3543c8=_0x25198a[_0x6c1c('0xb0')];var _0x4eac13={'method':_0x6c1c('0xab'),'uri':_0x458316+_0x6c1c('0xb1')+_0x3543c8+_0x6c1c('0xb2'),'headers':{'Authorization':_0x6c1c('0xad')+_0x3d0b51,'If-None-Match':null,'OData-Version':_0x6c1c('0xae')},'json':!![]};return rp(_0x4eac13);})[_0x6c1c('0x1b')](function(_0x24ffc3){_0x4b24d7=_0x24ffc3;_0x172bd4=_0x4b24d7[_0x6c1c('0xb3')];_0x172bd4=_['remove'](_0x172bd4,function(_0x463e76){return!_0x11220a[_0x6c1c('0xb4')](_0x463e76[_0x6c1c('0xb5')]);});var _0x700aee=[];var _0x385629=[];_0x172bd4[_0x6c1c('0xb6')](function(_0x152fef){if(_0x152fef[_0x6c1c('0xb7')]){var _0xc5a79b=_0x152fef[_0x6c1c('0xb7')][_0x6c1c('0xa2')](_0x152fef[_0x6c1c('0xb7')][_0x6c1c('0xa3')]('.')+0x1);if(_0xc5a79b===_0x6c1c('0xb8')){_0x700aee['push'](getSelectList(_0x458316,_0xc19e0d,_0x385629,_0x4b24d7['MetadataId'],_0x152fef[_0x6c1c('0xb0')],_0x3d0b51));}}});return Promise['all'](_0x700aee);})[_0x6c1c('0x1b')](function(_0x20a29f){_0x55c929=_0x20a29f[0x0];var _0x70b6c2=[];var _0x1f685d=[];_0x172bd4[_0x6c1c('0xb6')](function(_0x500947){if(!_[_0x6c1c('0xb9')](_0x500947[_0x6c1c('0xb7')])){var _0xf268c8=_0x500947[_0x6c1c('0xb7')]['substring'](_0x500947['@odata.type'][_0x6c1c('0xa3')]('.')+0x1);if(_0xf268c8===_0x6c1c('0xba')){_0x70b6c2['push'](getBooleanList(_0x458316,_0xc19e0d,_0x1f685d,_0x4b24d7['MetadataId'],_0x500947[_0x6c1c('0xb0')],_0x3d0b51));}}});return Promise[_0x6c1c('0xbb')](_0x70b6c2);})[_0x6c1c('0x1b')](function(_0x54ac3e){_0x3e61cb=_0x54ac3e[0x0];var _0x3f32da=[];var _0x192537=[];_0x172bd4[_0x6c1c('0xb6')](function(_0x52ef5f){if(_0x52ef5f[_0x6c1c('0xb7')]){var _0x1ac1c1=_0x52ef5f[_0x6c1c('0xb7')][_0x6c1c('0xa2')](_0x52ef5f[_0x6c1c('0xb7')][_0x6c1c('0xa3')]('.')+0x1);if(_0x1ac1c1==='StringAttributeMetadata'||_0x1ac1c1==='DoubleAttributeMetadata'||_0x1ac1c1===_0x6c1c('0xbc')||_0x1ac1c1===_0x6c1c('0xbd')||_0x1ac1c1==='MemoAttributeMetadata'||_0x1ac1c1==='DateTimeAttributeMetadata'||_0x1ac1c1===_0x6c1c('0xbe')||_0x1ac1c1===_0x6c1c('0xbf')||_0x1ac1c1===_0x6c1c('0xc0')||_0x1ac1c1===_0x6c1c('0xc1')){_0x3f32da[_0x6c1c('0xc2')](getInputList(_0x458316,_0xc19e0d,_0x1ac1c1,_0x192537,_0x4b24d7[_0x6c1c('0xb0')],_0x52ef5f[_0x6c1c('0xb0')],_0x3d0b51));}}});return Promise['all'](_0x3f32da);})['then'](function(_0x40717c){_0x11c901=_0x40717c[0x0];var _0x1eb5f3=_0x55c929[_0x6c1c('0x9d')](_0x3e61cb)[_0x6c1c('0x9d')](_0x11c901);var _0x2b8a44={'count':_0x1eb5f3[_0x6c1c('0x3c')],'rows':_0x1eb5f3};return _0x2b8a44;})[_0x6c1c('0x1b')](respondWithResult(_0xea59ea,null))[_0x6c1c('0x24')](function(_0x52fc4a){var _0x7f8173=_0x56d05a[_0x6c1c('0x36')][_0x6c1c('0xc3')]?0x1f4:_0x52fc4a['statusCode']||0x1f4;logger['error'](_0x52fc4a[_0x6c1c('0xc4')]);delete _0x52fc4a[_0x6c1c('0x2f')];if(_0x7f8173===0x191){_0x7f8173=0x190;}_0xea59ea[_0x6c1c('0x26')](_0x7f8173)[_0x6c1c('0xc5')](_0x56d05a[_0x6c1c('0x36')][_0x6c1c('0xc3')]?{'message':_0x6c1c('0xc6'),'statusCode':_0x52fc4a['statusCode']}:_0x52fc4a);});};function getSelectList(_0x4a09c6,_0x3565eb,_0x63aae0,_0x31b17d,_0x2af438,_0x2679b2){var _0x1b75ed={'method':_0x6c1c('0xab'),'uri':_0x4a09c6+_0x6c1c('0xb1')+_0x31b17d+_0x6c1c('0xc7')+_0x2af438+_0x6c1c('0xc8')+_0x6c1c('0xc9'),'headers':{'Authorization':_0x6c1c('0xad')+_0x2679b2,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1b75ed)[_0x6c1c('0x1b')](function(_0x4ed8db){var _0x5a2d91=[];var _0x39e399=_0x4ed8db[_0x6c1c('0xca')]['Options'];_0x39e399[_0x6c1c('0xb6')](function(_0x322e9b){_0x5a2d91['push']({'name':_0x322e9b[_0x6c1c('0xcb')][_0x6c1c('0xcc')][_0x6c1c('0xcb')],'value':String(_0x322e9b[_0x6c1c('0xcd')])});});var _0x5a9adc={'id':_0x3565eb+'_'+_0x4ed8db[_0x6c1c('0xb5')],'name':_0x4ed8db['DisplayName'][_0x6c1c('0xcc')][_0x6c1c('0xcb')],'custom':![],'options':_0x5a2d91};_0x63aae0[_0x6c1c('0xc2')](_0x5a9adc);return _0x63aae0;});}function getBooleanList(_0x3067e4,_0x33c681,_0x4d9aa8,_0x1b9912,_0x20f9c5,_0x5f57e8){var _0x38770f={'method':_0x6c1c('0xab'),'uri':_0x3067e4+_0x6c1c('0xb1')+_0x1b9912+_0x6c1c('0xc7')+_0x20f9c5+_0x6c1c('0xce'),'headers':{'Authorization':_0x6c1c('0xad')+_0x5f57e8,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x38770f)[_0x6c1c('0x1b')](function(_0x13197a){var _0x564166=[];_0x564166[_0x6c1c('0xc2')]({'name':_0x13197a[_0x6c1c('0xca')]['TrueOption'][_0x6c1c('0xcb')][_0x6c1c('0xcc')][_0x6c1c('0xcb')],'value':_0x6c1c('0xcf')},{'name':_0x13197a[_0x6c1c('0xca')][_0x6c1c('0xd0')][_0x6c1c('0xcb')]['UserLocalizedLabel'][_0x6c1c('0xcb')],'value':'false'});var _0x55225e={'id':_0x33c681+'_'+_0x13197a[_0x6c1c('0xb5')],'name':_0x13197a[_0x6c1c('0xd1')][_0x6c1c('0xcc')][_0x6c1c('0xcb')],'custom':![],'options':_0x564166};_0x4d9aa8[_0x6c1c('0xc2')](_0x55225e);return _0x4d9aa8;});}function getInputList(_0x456fa6,_0x2bc6f6,_0x5ee5fb,_0x3bdec8,_0x375e61,_0x43fdce,_0x3d7250){var _0x23bda7={'method':_0x6c1c('0xab'),'uri':_0x456fa6+_0x6c1c('0xb1')+_0x375e61+')/Attributes('+_0x43fdce+_0x6c1c('0xd2')+_0x5ee5fb+_0x6c1c('0xd3'),'headers':{'Authorization':_0x6c1c('0xad')+_0x3d7250,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x23bda7)[_0x6c1c('0x1b')](function(_0x5487c4){var _0x4dcd9d={'id':_0x2bc6f6+'_'+_0x5487c4['LogicalName'],'name':_0x5487c4[_0x6c1c('0xd1')]['UserLocalizedLabel']?_0x5487c4[_0x6c1c('0xd1')]['UserLocalizedLabel'][_0x6c1c('0xcb')]:_0x5487c4[_0x6c1c('0xb5')],'custom':![],'options':[]};_0x3bdec8['push'](_0x4dcd9d);return _0x3bdec8;});} \ No newline at end of file +var _0x2a07=['description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','entitlementidname','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','utcconversiontimezonecode','versionnumber','concat','password','tenantId','remoteUri','slice','lastIndexOf','format','POST','/oauth2/token','clientId','username','clientSecret','access_token','GET','4.0','value','MetadataId','EntityDefinitions(','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','substring','BooleanAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Options','UserLocalizedLabel','Label','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','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','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','fields','options','create','body','findOne','Dynamics365Configuration','pick','nolimit','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Dynamics365Field','Descriptions','getFields','ticketType','Incident','title'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2a07,0x74));var _0x72a0=function(_0x4c403d,_0x5ef49f){_0x4c403d=_0x4c403d-0x0;var _0x5a0c35=_0x2a07[_0x4c403d];return _0x5a0c35;};'use strict';var pdf=require(_0x72a0('0x0'));var emlformat=require(_0x72a0('0x1'));var rimraf=require(_0x72a0('0x2'));var zipdir=require(_0x72a0('0x3'));var jsonpatch=require(_0x72a0('0x4'));var rp=require('request-promise');var moment=require(_0x72a0('0x5'));var BPromise=require(_0x72a0('0x6'));var Mustache=require(_0x72a0('0x7'));var util=require(_0x72a0('0x8'));var path=require(_0x72a0('0x9'));var sox=require(_0x72a0('0xa'));var csv=require(_0x72a0('0xb'));var ejs=require(_0x72a0('0xc'));var fs=require('fs');var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xb'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];var integrations=require(_0x72a0('0x1c'));var jayson=require(_0x72a0('0x1d'));var client=jayson[_0x72a0('0x1e')][_0x72a0('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x324cbd,_0xe73b5e,_0x5e0b5f,_0x4930c5){return new BPromise(function(_0xe103dc,_0x3cd89f){var _0x19eaf9=_0x4930c5||client;return _0x19eaf9[_0x72a0('0x20')](_0x324cbd,_0x5e0b5f)[_0x72a0('0x21')](function(_0x3f3d62){logger['info'](_0x72a0('0x22'),_0xe73b5e,_0x72a0('0x23'));logger[_0x72a0('0x24')](_0x72a0('0x25'),_0xe73b5e,_0x72a0('0x23'),JSON['stringify'](_0x3f3d62));if(_0x3f3d62[_0x72a0('0x26')]){if(_0x3f3d62[_0x72a0('0x26')][_0x72a0('0x27')]===0x1f4){logger['error'](_0x72a0('0x22'),_0xe73b5e,_0x3f3d62[_0x72a0('0x26')][_0x72a0('0x28')]);return _0x3cd89f(_0x3f3d62[_0x72a0('0x26')]['message']);}logger[_0x72a0('0x26')]('Dynamics365Account,\x20%s,\x20%s',_0xe73b5e,_0x3f3d62[_0x72a0('0x26')][_0x72a0('0x28')]);return _0xe103dc(_0x3f3d62[_0x72a0('0x26')]['message']);}else{logger[_0x72a0('0x29')](_0x72a0('0x22'),_0xe73b5e,_0x72a0('0x23'));_0xe103dc(_0x3f3d62[_0x72a0('0x2a')]['message']);}})[_0x72a0('0x2b')](function(_0x390464){logger[_0x72a0('0x26')](_0x72a0('0x22'),_0xe73b5e,_0x390464);_0x3cd89f(_0x390464);});});}function respondWithStatusCode(_0x3022b0,_0x174b1b){_0x174b1b=_0x174b1b||0xcc;return function(_0x5c4daf){if(_0x5c4daf){return _0x3022b0['sendStatus'](_0x174b1b);}return _0x3022b0[_0x72a0('0x2c')](_0x174b1b)[_0x72a0('0x2d')]();};}function respondWithResult(_0x123df4,_0x1504ed){_0x1504ed=_0x1504ed||0xc8;return function(_0xf5cb49){if(_0xf5cb49){return _0x123df4[_0x72a0('0x2c')](_0x1504ed)[_0x72a0('0x2e')](_0xf5cb49);}};}function respondWithFilteredResult(_0x15922a,_0xee99e2){return function(_0x12dcc9){if(_0x12dcc9){var _0x4f9718=_0x12dcc9[_0x72a0('0x2f')],_0x304b92=_0xee99e2[_0x72a0('0x30')],_0x553641=_0xee99e2[_0x72a0('0x30')]+_0xee99e2[_0x72a0('0x31')],_0xc22d18;if(_0x553641>=_0x4f9718){_0x553641=_0x4f9718;_0xc22d18=0xc8;}else{_0xc22d18=0xce;}_0x15922a[_0x72a0('0x2c')](_0xc22d18);return _0x15922a[_0x72a0('0x32')](_0x72a0('0x33'),_0x304b92+'-'+_0x553641+'/'+_0x4f9718)['json'](_0x12dcc9);}return null;};}function patchUpdates(_0x41efc1){return function(_0x17e955){try{jsonpatch[_0x72a0('0x34')](_0x17e955,_0x41efc1,!![]);}catch(_0xfbe9b3){return BPromise[_0x72a0('0x35')](_0xfbe9b3);}return _0x17e955[_0x72a0('0x36')]();};}function saveUpdates(_0x3a5e54,_0x592401){return function(_0x30878e){if(_0x30878e){return _0x30878e[_0x72a0('0x37')](_0x3a5e54)[_0x72a0('0x21')](function(_0x197591){return _0x197591;});}return null;};}function removeEntity(_0x89d598,_0x469c07){return function(_0x7c5d43){if(_0x7c5d43){return _0x7c5d43[_0x72a0('0x38')]()['then'](function(){_0x89d598[_0x72a0('0x2c')](0xcc)[_0x72a0('0x2d')]();});}};}function handleEntityNotFound(_0x2959af,_0x560ec3){return function(_0x2ae61c){if(!_0x2ae61c){_0x2959af['sendStatus'](0x194);}return _0x2ae61c;};}function handleError(_0x4b2b44,_0x277d8f){_0x277d8f=_0x277d8f||0x1f4;return function(_0x1d02c4){logger[_0x72a0('0x26')](_0x1d02c4[_0x72a0('0x39')]);if(_0x1d02c4[_0x72a0('0x3a')]){delete _0x1d02c4[_0x72a0('0x3a')];}_0x4b2b44[_0x72a0('0x2c')](_0x277d8f)[_0x72a0('0x3b')](_0x1d02c4);};}exports[_0x72a0('0x3c')]=function(_0x2ee3f8,_0x3ff191){var _0x5b6326={},_0x265d96={},_0x5eb8f1={'count':0x0,'rows':[]};var _0x1d0fa8=_[_0x72a0('0x3d')](db[_0x72a0('0x3e')][_0x72a0('0x3f')],function(_0xbb1f4){return{'name':_0xbb1f4[_0x72a0('0x40')],'type':_0xbb1f4[_0x72a0('0x41')][_0x72a0('0x42')]};});_0x265d96[_0x72a0('0x43')]=_['map'](_0x1d0fa8,'name');_0x265d96[_0x72a0('0x44')]=_[_0x72a0('0x45')](_0x2ee3f8[_0x72a0('0x44')]);_0x265d96[_0x72a0('0x46')]=_[_0x72a0('0x47')](_0x265d96['model'],_0x265d96[_0x72a0('0x44')]);_0x5b6326[_0x72a0('0x48')]=_['intersection'](_0x265d96[_0x72a0('0x43')],qs['fields'](_0x2ee3f8['query']['fields']));_0x5b6326[_0x72a0('0x48')]=_0x5b6326['attributes'][_0x72a0('0x49')]?_0x5b6326[_0x72a0('0x48')]:_0x265d96[_0x72a0('0x43')];if(!_0x2ee3f8[_0x72a0('0x44')]['hasOwnProperty']('nolimit')){_0x5b6326['limit']=qs['limit'](_0x2ee3f8[_0x72a0('0x44')][_0x72a0('0x31')]);_0x5b6326['offset']=qs[_0x72a0('0x30')](_0x2ee3f8[_0x72a0('0x44')]['offset']);}_0x5b6326[_0x72a0('0x4a')]=qs[_0x72a0('0x4b')](_0x2ee3f8[_0x72a0('0x44')][_0x72a0('0x4b')]);_0x5b6326[_0x72a0('0x4c')]=qs[_0x72a0('0x46')](_['pick'](_0x2ee3f8[_0x72a0('0x44')],_0x265d96['filters']),_0x1d0fa8);if(_0x2ee3f8[_0x72a0('0x44')]['filter']){_0x5b6326[_0x72a0('0x4c')]=_[_0x72a0('0x4d')](_0x5b6326['where'],{'$or':_[_0x72a0('0x3d')](_0x1d0fa8,function(_0x506d65){if(_0x506d65[_0x72a0('0x41')]!==_0x72a0('0x4e')){var _0x13254c={};_0x13254c[_0x506d65['name']]={'$like':'%'+_0x2ee3f8[_0x72a0('0x44')][_0x72a0('0x4f')]+'%'};return _0x13254c;}})});}_0x5b6326=_[_0x72a0('0x4d')]({},_0x5b6326,_0x2ee3f8['options']);var _0x5f1fcc={'where':_0x5b6326[_0x72a0('0x4c')]};return db['Dynamics365Account'][_0x72a0('0x2f')](_0x5f1fcc)[_0x72a0('0x21')](function(_0x1d2e44){_0x5eb8f1[_0x72a0('0x2f')]=_0x1d2e44;if(_0x2ee3f8[_0x72a0('0x44')][_0x72a0('0x50')]){_0x5b6326[_0x72a0('0x51')]=[{'all':!![]}];}return db[_0x72a0('0x3e')][_0x72a0('0x52')](_0x5b6326);})['then'](function(_0x4fae3d){_0x5eb8f1[_0x72a0('0x53')]=_0x4fae3d;return _0x5eb8f1;})[_0x72a0('0x21')](respondWithFilteredResult(_0x3ff191,_0x5b6326))[_0x72a0('0x2b')](handleError(_0x3ff191,null));};exports[_0x72a0('0x54')]=function(_0x304400,_0x2de809){var _0x4a72fd={'raw':![],'where':{'id':_0x304400[_0x72a0('0x55')]['id']}},_0x4f9091={};_0x4f9091[_0x72a0('0x43')]=_[_0x72a0('0x45')](db[_0x72a0('0x3e')][_0x72a0('0x3f')]);_0x4f9091[_0x72a0('0x44')]=_[_0x72a0('0x45')](_0x304400[_0x72a0('0x44')]);_0x4f9091[_0x72a0('0x46')]=_[_0x72a0('0x47')](_0x4f9091['model'],_0x4f9091[_0x72a0('0x44')]);_0x4a72fd[_0x72a0('0x48')]=_[_0x72a0('0x47')](_0x4f9091[_0x72a0('0x43')],qs[_0x72a0('0x56')](_0x304400['query'][_0x72a0('0x56')]));_0x4a72fd['attributes']=_0x4a72fd['attributes'][_0x72a0('0x49')]?_0x4a72fd[_0x72a0('0x48')]:_0x4f9091[_0x72a0('0x43')];if(_0x304400[_0x72a0('0x44')][_0x72a0('0x50')]){_0x4a72fd['include']=[{'all':!![]}];}_0x4a72fd=_[_0x72a0('0x4d')]({},_0x4a72fd,_0x304400[_0x72a0('0x57')]);return db['Dynamics365Account']['find'](_0x4a72fd)[_0x72a0('0x21')](handleEntityNotFound(_0x2de809,null))[_0x72a0('0x21')](respondWithResult(_0x2de809,null))[_0x72a0('0x2b')](handleError(_0x2de809,null));};exports[_0x72a0('0x58')]=function(_0x18b4b3,_0x3813ca){return db[_0x72a0('0x3e')][_0x72a0('0x58')](_0x18b4b3['body'],{})[_0x72a0('0x21')](respondWithResult(_0x3813ca,0xc9))['catch'](handleError(_0x3813ca,null));};exports['update']=function(_0x591dbc,_0x1f30e0){if(_0x591dbc[_0x72a0('0x59')]['id']){delete _0x591dbc['body']['id'];}return db[_0x72a0('0x3e')]['find']({'where':{'id':_0x591dbc[_0x72a0('0x55')]['id']}})['then'](handleEntityNotFound(_0x1f30e0,null))['then'](saveUpdates(_0x591dbc[_0x72a0('0x59')],null))[_0x72a0('0x21')](respondWithResult(_0x1f30e0,null))['catch'](handleError(_0x1f30e0,null));};exports[_0x72a0('0x38')]=function(_0x4bb670,_0x106ec1){return db['Dynamics365Account']['find']({'where':{'id':_0x4bb670[_0x72a0('0x55')]['id']}})[_0x72a0('0x21')](handleEntityNotFound(_0x106ec1,null))[_0x72a0('0x21')](removeEntity(_0x106ec1,null))['catch'](handleError(_0x106ec1,null));};exports['getConfigurations']=function(_0xe49c8e,_0x48f178,_0x44b171){var _0x36d604={};var _0x1cea02={};var _0x4b03ab;var _0x11a750;return db[_0x72a0('0x3e')][_0x72a0('0x5a')]({'where':{'id':_0xe49c8e[_0x72a0('0x55')]['id']}})[_0x72a0('0x21')](handleEntityNotFound(_0x48f178,null))[_0x72a0('0x21')](function(_0x32a0bb){if(_0x32a0bb){_0x4b03ab=_0x32a0bb;_0x1cea02[_0x72a0('0x43')]=_['keys'](db[_0x72a0('0x5b')]['rawAttributes']);_0x1cea02['query']=_['keys'](_0xe49c8e['query']);_0x1cea02[_0x72a0('0x46')]=_[_0x72a0('0x47')](_0x1cea02[_0x72a0('0x43')],_0x1cea02['query']);_0x36d604[_0x72a0('0x48')]=_['intersection'](_0x1cea02[_0x72a0('0x43')],qs[_0x72a0('0x56')](_0xe49c8e['query'][_0x72a0('0x56')]));_0x36d604[_0x72a0('0x48')]=_0x36d604[_0x72a0('0x48')][_0x72a0('0x49')]?_0x36d604['attributes']:_0x1cea02[_0x72a0('0x43')];_0x36d604['order']=qs[_0x72a0('0x4b')](_0xe49c8e[_0x72a0('0x44')][_0x72a0('0x4b')]);_0x36d604['where']=qs[_0x72a0('0x46')](_[_0x72a0('0x5c')](_0xe49c8e[_0x72a0('0x44')],_0x1cea02[_0x72a0('0x46')]));if(_0xe49c8e[_0x72a0('0x44')]['filter']){_0x36d604['where']=_[_0x72a0('0x4d')](_0x36d604['where'],{'$or':_[_0x72a0('0x3d')](_0x36d604['attributes'],function(_0x3c7fa6){var _0xd9ae1a={};_0xd9ae1a[_0x3c7fa6]={'$like':'%'+_0xe49c8e['query'][_0x72a0('0x4f')]+'%'};return _0xd9ae1a;})});}_0x36d604=_[_0x72a0('0x4d')]({},_0x36d604,_0xe49c8e[_0x72a0('0x57')]);return _0x4b03ab['getConfigurations'](_0x36d604);}})[_0x72a0('0x21')](function(_0x48649e){if(_0x48649e){_0x11a750=_0x48649e[_0x72a0('0x49')];if(!_0xe49c8e[_0x72a0('0x44')]['hasOwnProperty'](_0x72a0('0x5d'))){_0x36d604['limit']=qs['limit'](_0xe49c8e['query'][_0x72a0('0x31')]);_0x36d604['offset']=qs[_0x72a0('0x30')](_0xe49c8e['query'][_0x72a0('0x30')]);}return _0x4b03ab[_0x72a0('0x5e')](_0x36d604);}})[_0x72a0('0x21')](function(_0x5b81d7){if(_0x5b81d7){return _0x5b81d7?{'count':_0x11a750,'rows':_0x5b81d7}:null;}})[_0x72a0('0x21')](respondWithResult(_0x48f178,null))[_0x72a0('0x2b')](handleError(_0x48f178,null));};exports[_0x72a0('0x5f')]=function(_0x28551a,_0x2c46dc,_0x58ef97){if(_0x28551a[_0x72a0('0x59')]['id']){delete _0x28551a[_0x72a0('0x59')]['id'];}return db[_0x72a0('0x3e')][_0x72a0('0x5a')]({'where':{'id':_0x28551a['params']['id']}})[_0x72a0('0x21')](handleEntityNotFound(_0x2c46dc,null))[_0x72a0('0x21')](function(_0x4ebce5){if(_0x4ebce5){_0x28551a[_0x72a0('0x59')]['AccountId']=_0x4ebce5['id'];_0x28551a[_0x72a0('0x59')][_0x72a0('0x60')]=integrations[_0x72a0('0x61')](_0x28551a[_0x72a0('0x59')][_0x72a0('0x62')],_0x28551a[_0x72a0('0x59')][_0x72a0('0x41')]);_0x28551a['body']['Descriptions']=integrations['getDescriptions'](_0x28551a[_0x72a0('0x59')][_0x72a0('0x62')],_0x28551a[_0x72a0('0x59')][_0x72a0('0x41')]);return db[_0x72a0('0x5b')][_0x72a0('0x58')](_0x28551a['body'],{'include':[{'model':db[_0x72a0('0x63')],'as':_0x72a0('0x60')},{'model':db[_0x72a0('0x63')],'as':_0x72a0('0x64')}]});}return null;})[_0x72a0('0x21')](respondWithResult(_0x2c46dc,null))[_0x72a0('0x2b')](handleError(_0x2c46dc,null));};exports[_0x72a0('0x65')]=function(_0x5d5dd8,_0x1e36b0,_0x9fc964){var _0x130c90=_0x5d5dd8[_0x72a0('0x44')][_0x72a0('0x66')];var _0x26e270=_0x130c90==='incident'?_0x72a0('0x67'):'PhoneCall';var _0x35fc2c='';var _0x1a51bb='';var _0x134c7d='';var _0x3d5edb='';var _0xed6c1b='';var _0x546646='';var _0x361f8f='';var _0x46a306='';var _0x4e52e4=[_0x72a0('0x68'),_0x72a0('0x69'),_0x72a0('0x6a'),_0x72a0('0x6b'),'caseorigincode',_0x72a0('0x6c'),_0x72a0('0x6d'),_0x72a0('0x6e'),_0x72a0('0x6f'),_0x72a0('0x70')];var _0xfef0b1=[_0x72a0('0x71'),_0x72a0('0x72'),_0x72a0('0x73'),_0x72a0('0x74'),_0x72a0('0x75'),_0x72a0('0x76'),'contractdetailidname',_0x72a0('0x77'),_0x72a0('0x78'),_0x72a0('0x79'),_0x72a0('0x7a'),_0x72a0('0x7b'),_0x72a0('0x7c'),_0x72a0('0x7d'),_0x72a0('0x7e'),'customeridname',_0x72a0('0x7f'),'customeridyominame','emailaddress',_0x72a0('0x80'),'entityimage_timestamp','entityimage_url',_0x72a0('0x81'),'exchangerate',_0x72a0('0x82'),_0x72a0('0x83'),_0x72a0('0x84'),'influencescore',_0x72a0('0x85'),_0x72a0('0x86'),_0x72a0('0x87'),_0x72a0('0x88'),_0x72a0('0x89'),'modifiedbyname',_0x72a0('0x8a'),_0x72a0('0x8b'),_0x72a0('0x8c'),'modifiedonbehalfbyyominame',_0x72a0('0x8d'),_0x72a0('0x8e'),_0x72a0('0x8f'),'onholdtime',_0x72a0('0x90'),_0x72a0('0x91'),_0x72a0('0x92'),_0x72a0('0x93'),_0x72a0('0x94'),_0x72a0('0x95'),_0x72a0('0x96'),_0x72a0('0x97'),_0x72a0('0x98'),'productserialnumber',_0x72a0('0x99'),_0x72a0('0x9a'),_0x72a0('0x9b'),_0x72a0('0x9c'),_0x72a0('0x9d'),'sentimentvalue',_0x72a0('0x9e'),_0x72a0('0x9f'),_0x72a0('0xa0'),_0x72a0('0xa1'),'statuscode',_0x72a0('0xa2'),_0x72a0('0xa3'),_0x72a0('0xa4'),'transactioncurrencyidname','traversedpath',_0x72a0('0xa5'),_0x72a0('0xa6')];var _0x17776e=_0x4e52e4[_0x72a0('0xa7')](_0xfef0b1);return db[_0x72a0('0x3e')]['findOne']({'where':{'id':_0x5d5dd8['params']['id']},'attributes':['id','username',_0x72a0('0xa8'),'remoteUri',_0x72a0('0xa9'),'clientId','clientSecret']})['then'](handleEntityNotFound(_0x1e36b0,null))['then'](function(_0x33c9dd){if(_0x33c9dd){_0x46a306=_0x33c9dd[_0x72a0('0xaa')];var _0x153802=_0x46a306[_0x72a0('0xab')](-0x1);if(_0x153802==='/'){_0x46a306=_0x46a306['substring'](0x0,_0x46a306[_0x72a0('0xac')](_0x153802));}_0x361f8f=util[_0x72a0('0xad')]('%s/api/data/v9.0/',_0x46a306);var _0xda549d={'method':_0x72a0('0xae'),'uri':'https://login.microsoftonline.com/'+_0x33c9dd[_0x72a0('0xa9')]+_0x72a0('0xaf'),'form':{'client_id':_0x33c9dd[_0x72a0('0xb0')],'resource':_0x46a306,'username':_0x33c9dd[_0x72a0('0xb1')],'password':_0x33c9dd['password'],'grant_type':'password','client_secret':_0x33c9dd[_0x72a0('0xb2')]},'json':!![]};return rp(_0xda549d);}})[_0x72a0('0x21')](function(_0x358f96){_0x546646=_0x358f96[_0x72a0('0xb3')];var _0x2ac5b0={'method':_0x72a0('0xb4'),'uri':encodeURI(_0x361f8f+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x26e270+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x546646,'If-None-Match':null,'OData-Version':_0x72a0('0xb5')},'json':!![]};return rp(_0x2ac5b0);})[_0x72a0('0x21')](function(_0x57550f){var _0x40f2e2=_0x57550f[_0x72a0('0xb6')][0x0];var _0xec7717=_0x40f2e2[_0x72a0('0xb7')];var _0x328c84={'method':_0x72a0('0xb4'),'uri':_0x361f8f+_0x72a0('0xb8')+_0xec7717+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x72a0('0xb9')+_0x546646,'If-None-Match':null,'OData-Version':_0x72a0('0xb5')},'json':!![]};return rp(_0x328c84);})[_0x72a0('0x21')](function(_0x5a0aa3){_0x35fc2c=_0x5a0aa3;_0x1a51bb=_0x35fc2c[_0x72a0('0xba')];_0x1a51bb=_[_0x72a0('0xbb')](_0x1a51bb,function(_0x346e03){return!_0x17776e[_0x72a0('0xbc')](_0x346e03[_0x72a0('0xbd')]);});var _0x49374f=[];var _0xc16765=[];_0x1a51bb[_0x72a0('0xbe')](function(_0x1f6d7d){if(_0x1f6d7d[_0x72a0('0xbf')]){var _0xfe62a1=_0x1f6d7d[_0x72a0('0xbf')]['substring'](_0x1f6d7d[_0x72a0('0xbf')][_0x72a0('0xac')]('.')+0x1);if(_0xfe62a1===_0x72a0('0xc0')){_0x49374f[_0x72a0('0xc1')](getSelectList(_0x361f8f,_0x130c90,_0xc16765,_0x35fc2c[_0x72a0('0xb7')],_0x1f6d7d[_0x72a0('0xb7')],_0x546646));}}});return Promise[_0x72a0('0xc2')](_0x49374f);})[_0x72a0('0x21')](function(_0x2c99f9){_0x134c7d=_0x2c99f9[0x0];var _0x49b0e8=[];var _0x2a2eaa=[];_0x1a51bb['forEach'](function(_0x1dcbcc){if(!_[_0x72a0('0xc3')](_0x1dcbcc[_0x72a0('0xbf')])){var _0x276cca=_0x1dcbcc[_0x72a0('0xbf')][_0x72a0('0xc4')](_0x1dcbcc['@odata.type']['lastIndexOf']('.')+0x1);if(_0x276cca===_0x72a0('0xc5')){_0x49b0e8[_0x72a0('0xc1')](getBooleanList(_0x361f8f,_0x130c90,_0x2a2eaa,_0x35fc2c[_0x72a0('0xb7')],_0x1dcbcc[_0x72a0('0xb7')],_0x546646));}}});return Promise[_0x72a0('0xc2')](_0x49b0e8);})[_0x72a0('0x21')](function(_0x3a8386){_0x3d5edb=_0x3a8386[0x0];var _0x1e7d8b=[];var _0xbad206=[];_0x1a51bb[_0x72a0('0xbe')](function(_0x227901){if(_0x227901[_0x72a0('0xbf')]){var _0x1fb03c=_0x227901[_0x72a0('0xbf')][_0x72a0('0xc4')](_0x227901['@odata.type'][_0x72a0('0xac')]('.')+0x1);if(_0x1fb03c==='StringAttributeMetadata'||_0x1fb03c===_0x72a0('0xc6')||_0x1fb03c==='BigIntAttributeMetadata'||_0x1fb03c===_0x72a0('0xc7')||_0x1fb03c==='MemoAttributeMetadata'||_0x1fb03c===_0x72a0('0xc8')||_0x1fb03c===_0x72a0('0xc9')||_0x1fb03c===_0x72a0('0xca')||_0x1fb03c===_0x72a0('0xcb')||_0x1fb03c===_0x72a0('0xcc')){_0x1e7d8b[_0x72a0('0xc1')](getInputList(_0x361f8f,_0x130c90,_0x1fb03c,_0xbad206,_0x35fc2c['MetadataId'],_0x227901[_0x72a0('0xb7')],_0x546646));}}});return Promise['all'](_0x1e7d8b);})[_0x72a0('0x21')](function(_0xf9e86a){_0xed6c1b=_0xf9e86a[0x0];var _0x10c1e2=_0x134c7d[_0x72a0('0xa7')](_0x3d5edb)[_0x72a0('0xa7')](_0xed6c1b);var _0x2ded38={'count':_0x10c1e2['length'],'rows':_0x10c1e2};return _0x2ded38;})[_0x72a0('0x21')](respondWithResult(_0x1e36b0,null))[_0x72a0('0x2b')](function(_0x431223){var _0x2130db=_0x5d5dd8[_0x72a0('0x44')][_0x72a0('0xcd')]?0x1f4:_0x431223[_0x72a0('0xce')]||0x1f4;logger[_0x72a0('0x26')](_0x431223[_0x72a0('0x39')]);delete _0x431223['name'];if(_0x2130db===0x191){_0x2130db=0x190;}_0x1e36b0[_0x72a0('0x2c')](_0x2130db)[_0x72a0('0x3b')](_0x5d5dd8[_0x72a0('0x44')][_0x72a0('0xcd')]?{'message':_0x72a0('0xcf'),'statusCode':_0x431223[_0x72a0('0xce')]}:_0x431223);});};function getSelectList(_0xd630ef,_0x67aef2,_0x4be4ed,_0x5d1e58,_0x485f13,_0x48f253){var _0x528f71={'method':'GET','uri':_0xd630ef+_0x72a0('0xb8')+_0x5d1e58+')/Attributes('+_0x485f13+_0x72a0('0xd0')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x72a0('0xb9')+_0x48f253,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x528f71)[_0x72a0('0x21')](function(_0x22fea4){var _0x501e72=[];var _0x19c6c3=_0x22fea4['OptionSet'][_0x72a0('0xd1')];_0x19c6c3[_0x72a0('0xbe')](function(_0x5ed10f){_0x501e72[_0x72a0('0xc1')]({'name':_0x5ed10f['Label'][_0x72a0('0xd2')][_0x72a0('0xd3')],'value':String(_0x5ed10f[_0x72a0('0xd4')])});});var _0x3b0c66={'id':_0x67aef2+'_'+_0x22fea4['LogicalName'],'name':_0x22fea4[_0x72a0('0xd5')]['UserLocalizedLabel'][_0x72a0('0xd3')],'custom':![],'options':_0x501e72};_0x4be4ed[_0x72a0('0xc1')](_0x3b0c66);return _0x4be4ed;});}function getBooleanList(_0x3ec3dd,_0x4389a6,_0x47012a,_0x2e7e17,_0x495e78,_0x38fb73){var _0x308f02={'method':'GET','uri':_0x3ec3dd+_0x72a0('0xb8')+_0x2e7e17+_0x72a0('0xd6')+_0x495e78+_0x72a0('0xd7'),'headers':{'Authorization':_0x72a0('0xb9')+_0x38fb73,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x308f02)[_0x72a0('0x21')](function(_0x23d348){var _0x1a78c2=[];_0x1a78c2[_0x72a0('0xc1')]({'name':_0x23d348[_0x72a0('0xd8')][_0x72a0('0xd9')]['Label'][_0x72a0('0xd2')][_0x72a0('0xd3')],'value':_0x72a0('0xda')},{'name':_0x23d348[_0x72a0('0xd8')][_0x72a0('0xdb')]['Label'][_0x72a0('0xd2')][_0x72a0('0xd3')],'value':'false'});var _0x19013b={'id':_0x4389a6+'_'+_0x23d348[_0x72a0('0xbd')],'name':_0x23d348[_0x72a0('0xd5')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x1a78c2};_0x47012a[_0x72a0('0xc1')](_0x19013b);return _0x47012a;});}function getInputList(_0x4592d1,_0x2c6a75,_0x5877f9,_0x4cd5b3,_0x1beace,_0x49b82a,_0x42b58d){var _0x1c0d20={'method':_0x72a0('0xb4'),'uri':_0x4592d1+_0x72a0('0xb8')+_0x1beace+_0x72a0('0xd6')+_0x49b82a+_0x72a0('0xdc')+_0x5877f9+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x72a0('0xb9')+_0x42b58d,'If-None-Match':null,'OData-Version':_0x72a0('0xb5')},'json':!![]};return rp(_0x1c0d20)[_0x72a0('0x21')](function(_0x4533a2){var _0x343c6a={'id':_0x2c6a75+'_'+_0x4533a2[_0x72a0('0xbd')],'name':_0x4533a2[_0x72a0('0xd5')][_0x72a0('0xd2')]?_0x4533a2[_0x72a0('0xd5')]['UserLocalizedLabel'][_0x72a0('0xd3')]:_0x4533a2[_0x72a0('0xbd')],'custom':![],'options':[]};_0x4cd5b3[_0x72a0('0xc1')](_0x343c6a);return _0x4cd5b3;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index b8c8d49..6c08da6 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 _0x0bee=['api','moment','bluebird','path','rimraf','../../config/environment','define','Dynamics365Account','int_dynamics365_accounts','lodash','util','../../config/logger'];(function(_0xdb0316,_0x1699ee){var _0xe43c0d=function(_0x104299){while(--_0x104299){_0xdb0316['push'](_0xdb0316['shift']());}};_0xe43c0d(++_0x1699ee);}(_0x0bee,0x159));var _0xe0be=function(_0x4daf4e,_0x2b813c){_0x4daf4e=_0x4daf4e-0x0;var _0x198d7a=_0x0bee[_0x4daf4e];return _0x198d7a;};'use strict';var _=require(_0xe0be('0x0'));var util=require(_0xe0be('0x1'));var logger=require(_0xe0be('0x2'))(_0xe0be('0x3'));var moment=require(_0xe0be('0x4'));var BPromise=require(_0xe0be('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe0be('0x6'));var rimraf=require(_0xe0be('0x7'));var config=require(_0xe0be('0x8'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5e5e0b,_0x4ba9a1){return _0x5e5e0b[_0xe0be('0x9')](_0xe0be('0xa'),attributes,{'tableName':_0xe0be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bbb=['Dynamics365Account','int_dynamics365_accounts','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports'];(function(_0x3fad45,_0x1a3c5a){var _0x17eb8c=function(_0x5f543b){while(--_0x5f543b){_0x3fad45['push'](_0x3fad45['shift']());}};_0x17eb8c(++_0x1a3c5a);}(_0x4bbb,0x106));var _0xb4bb=function(_0x2e7dcb,_0x41d6e1){_0x2e7dcb=_0x2e7dcb-0x0;var _0x3b4771=_0x4bbb[_0x2e7dcb];return _0x3b4771;};'use strict';var _=require(_0xb4bb('0x0'));var util=require(_0xb4bb('0x1'));var logger=require('../../config/logger')(_0xb4bb('0x2'));var moment=require(_0xb4bb('0x3'));var BPromise=require(_0xb4bb('0x4'));var rp=require(_0xb4bb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb4bb('0x6'));var config=require(_0xb4bb('0x7'));var attributes=require(_0xb4bb('0x8'));var integrations=require(_0xb4bb('0x9'));module[_0xb4bb('0xa')]=function(_0x17f398,_0xf89d7e){return _0x17f398['define'](_0xb4bb('0xb'),attributes,{'tableName':_0xb4bb('0xc'),'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 0b85ed8..0abf9f3 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 _0x77f7=['attributes','model','find','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','include','map'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x77f7,0xbd));var _0x777f=function(_0x444b60,_0x2d4ea9){_0x444b60=_0x444b60-0x0;var _0x27372e=_0x77f7[_0x444b60];return _0x27372e;};'use strict';var _=require(_0x777f('0x0'));var util=require(_0x777f('0x1'));var moment=require(_0x777f('0x2'));var BPromise=require(_0x777f('0x3'));var rs=require(_0x777f('0x4'));var fs=require('fs');var Redis=require(_0x777f('0x5'));var db=require(_0x777f('0x6'))['db'];var utils=require(_0x777f('0x7'));var logger=require(_0x777f('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x777f('0x9'));var client=jayson[_0x777f('0xa')][_0x777f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16642d,_0xda8cb2,_0x5bf11d){return new BPromise(function(_0x12bff6,_0x27e9ee){return client[_0x777f('0xc')](_0x16642d,_0x5bf11d)[_0x777f('0xd')](function(_0x4edde5){logger[_0x777f('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0xda8cb2,_0x777f('0xf'));logger[_0x777f('0x10')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0xda8cb2,_0x777f('0xf'),JSON[_0x777f('0x11')](_0x4edde5));if(_0x4edde5[_0x777f('0x12')]){if(_0x4edde5['error'][_0x777f('0x13')]===0x1f4){logger[_0x777f('0x12')](_0x777f('0x14'),_0xda8cb2,_0x4edde5[_0x777f('0x12')][_0x777f('0x15')]);return _0x27e9ee(_0x4edde5[_0x777f('0x12')]['message']);}logger[_0x777f('0x12')](_0x777f('0x14'),_0xda8cb2,_0x4edde5['error'][_0x777f('0x15')]);return _0x12bff6(_0x4edde5[_0x777f('0x12')][_0x777f('0x15')]);}else{logger[_0x777f('0xe')](_0x777f('0x14'),_0xda8cb2,_0x777f('0xf'));_0x12bff6(_0x4edde5[_0x777f('0x16')]['message']);}})[_0x777f('0x17')](function(_0x3f6143){logger[_0x777f('0x12')](_0x777f('0x14'),_0xda8cb2,_0x3f6143);_0x27e9ee(_0x3f6143);});});}exports[_0x777f('0x18')]=function(_0x3aeb58){var _0x4038e2=this;return new Promise(function(_0x4e1153,_0x481c4c){return db[_0x777f('0x19')][_0x777f('0x1a')]({'raw':_0x3aeb58[_0x777f('0x1b')]?_0x3aeb58[_0x777f('0x1b')][_0x777f('0x1c')]===undefined?!![]:![]:!![],'where':_0x3aeb58[_0x777f('0x1b')]?_0x3aeb58[_0x777f('0x1b')][_0x777f('0x1d')]||null:null,'attributes':_0x3aeb58['options']?_0x3aeb58[_0x777f('0x1b')]['attributes']||null:null,'limit':_0x3aeb58[_0x777f('0x1b')]?_0x3aeb58[_0x777f('0x1b')][_0x777f('0x1e')]||null:null,'include':_0x3aeb58[_0x777f('0x1b')]?_0x3aeb58[_0x777f('0x1b')][_0x777f('0x1f')]?_[_0x777f('0x20')](_0x3aeb58['options'][_0x777f('0x1f')],function(_0x17f1ed){return{'model':db[_0x17f1ed['model']],'as':_0x17f1ed['as'],'attributes':_0x17f1ed[_0x777f('0x21')],'include':_0x17f1ed['include']?_[_0x777f('0x20')](_0x17f1ed[_0x777f('0x1f')],function(_0x109a8e){return{'model':db[_0x109a8e[_0x777f('0x22')]],'as':_0x109a8e['as'],'attributes':_0x109a8e[_0x777f('0x21')],'include':_0x109a8e[_0x777f('0x1f')]?_[_0x777f('0x20')](_0x109a8e[_0x777f('0x1f')],function(_0x104b86){return{'model':db[_0x104b86['model']],'as':_0x104b86['as'],'attributes':_0x104b86['attributes']};}):[]};}):[]};}):[]:[]})[_0x777f('0xd')](function(_0x37655d){logger[_0x777f('0xe')](_0x777f('0x18'),_0x3aeb58);logger[_0x777f('0x10')](_0x777f('0x18'),_0x3aeb58,JSON[_0x777f('0x11')](_0x37655d));_0x4e1153(_0x37655d);})['catch'](function(_0x2ebed8){logger[_0x777f('0x12')]('GetDynamics365Account',_0x2ebed8[_0x777f('0x15')],_0x3aeb58);_0x481c4c(_0x4038e2[_0x777f('0x12')](0x1f4,_0x2ebed8['message']));});});};exports['ShowDynamics365Account']=function(_0x263fa2){var _0x10e02e=this;return new Promise(function(_0x164792,_0x4365c0){return db[_0x777f('0x19')][_0x777f('0x23')]({'raw':_0x263fa2[_0x777f('0x1b')]?_0x263fa2[_0x777f('0x1b')][_0x777f('0x1c')]===undefined?!![]:![]:!![],'where':_0x263fa2[_0x777f('0x1b')]?_0x263fa2['options'][_0x777f('0x1d')]||null:null,'attributes':_0x263fa2[_0x777f('0x1b')]?_0x263fa2[_0x777f('0x1b')][_0x777f('0x21')]||null:null,'include':_0x263fa2[_0x777f('0x1b')]?_0x263fa2[_0x777f('0x1b')]['include']?_[_0x777f('0x20')](_0x263fa2[_0x777f('0x1b')]['include'],function(_0x259983){return{'model':db[_0x259983['model']],'as':_0x259983['as'],'attributes':_0x259983['attributes'],'include':_0x259983[_0x777f('0x1f')]?_[_0x777f('0x20')](_0x259983[_0x777f('0x1f')],function(_0x41252b){return{'model':db[_0x41252b[_0x777f('0x22')]],'as':_0x41252b['as'],'attributes':_0x41252b[_0x777f('0x21')],'include':_0x41252b[_0x777f('0x1f')]?_[_0x777f('0x20')](_0x41252b['include'],function(_0x50f4c4){return{'model':db[_0x50f4c4[_0x777f('0x22')]],'as':_0x50f4c4['as'],'attributes':_0x50f4c4[_0x777f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x777f('0xd')](function(_0x23d1e5){logger[_0x777f('0xe')](_0x777f('0x24'),_0x263fa2);logger[_0x777f('0x10')](_0x777f('0x24'),_0x263fa2,JSON['stringify'](_0x23d1e5));_0x164792(_0x23d1e5);})[_0x777f('0x17')](function(_0x2f7007){logger[_0x777f('0x12')](_0x777f('0x24'),_0x2f7007[_0x777f('0x15')],_0x263fa2);_0x4365c0(_0x10e02e[_0x777f('0x12')](0x1f4,_0x2f7007[_0x777f('0x15')]));});});}; \ No newline at end of file +var _0x94ba=['client','http','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x3c6971,_0x2580ee){var _0x18622d=function(_0x5454ab){while(--_0x5454ab){_0x3c6971['push'](_0x3c6971['shift']());}};_0x18622d(++_0x2580ee);}(_0x94ba,0xbe));var _0xa94b=function(_0x29ccfc,_0x311422){_0x29ccfc=_0x29ccfc-0x0;var _0x4f919b=_0x94ba[_0x29ccfc];return _0x4f919b;};'use strict';var _=require(_0xa94b('0x0'));var util=require(_0xa94b('0x1'));var moment=require(_0xa94b('0x2'));var BPromise=require(_0xa94b('0x3'));var rs=require(_0xa94b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa94b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa94b('0x6'))(_0xa94b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa94b('0x8')][_0xa94b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x363129,_0x262c09,_0x54c158){return new BPromise(function(_0x41aca1,_0x2165ae){return client['request'](_0x363129,_0x54c158)['then'](function(_0x1aaa45){logger[_0xa94b('0xa')](_0xa94b('0xb'),_0x262c09,'request\x20sent');logger[_0xa94b('0xc')](_0xa94b('0xd'),_0x262c09,_0xa94b('0xe'),JSON[_0xa94b('0xf')](_0x1aaa45));if(_0x1aaa45[_0xa94b('0x10')]){if(_0x1aaa45[_0xa94b('0x10')]['code']===0x1f4){logger[_0xa94b('0x10')](_0xa94b('0xb'),_0x262c09,_0x1aaa45[_0xa94b('0x10')][_0xa94b('0x11')]);return _0x2165ae(_0x1aaa45[_0xa94b('0x10')][_0xa94b('0x11')]);}logger[_0xa94b('0x10')](_0xa94b('0xb'),_0x262c09,_0x1aaa45['error'][_0xa94b('0x11')]);return _0x41aca1(_0x1aaa45[_0xa94b('0x10')]['message']);}else{logger[_0xa94b('0xa')]('Dynamics365Account,\x20%s,\x20%s',_0x262c09,'request\x20sent');_0x41aca1(_0x1aaa45['result'][_0xa94b('0x11')]);}})[_0xa94b('0x12')](function(_0x401e69){logger[_0xa94b('0x10')](_0xa94b('0xb'),_0x262c09,_0x401e69);_0x2165ae(_0x401e69);});});}exports[_0xa94b('0x13')]=function(_0x37a08d){var _0x1b0e14=this;return new Promise(function(_0x34049f,_0x32406e){return db[_0xa94b('0x14')][_0xa94b('0x15')]({'raw':_0x37a08d[_0xa94b('0x16')]?_0x37a08d[_0xa94b('0x16')][_0xa94b('0x17')]===undefined?!![]:![]:!![],'where':_0x37a08d[_0xa94b('0x16')]?_0x37a08d[_0xa94b('0x16')][_0xa94b('0x18')]||null:null,'attributes':_0x37a08d[_0xa94b('0x16')]?_0x37a08d[_0xa94b('0x16')][_0xa94b('0x19')]||null:null,'limit':_0x37a08d['options']?_0x37a08d[_0xa94b('0x16')][_0xa94b('0x1a')]||null:null,'include':_0x37a08d[_0xa94b('0x16')]?_0x37a08d[_0xa94b('0x16')][_0xa94b('0x1b')]?_[_0xa94b('0x1c')](_0x37a08d[_0xa94b('0x16')]['include'],function(_0x426ded){return{'model':db[_0x426ded[_0xa94b('0x1d')]],'as':_0x426ded['as'],'attributes':_0x426ded[_0xa94b('0x19')],'include':_0x426ded[_0xa94b('0x1b')]?_[_0xa94b('0x1c')](_0x426ded[_0xa94b('0x1b')],function(_0x6aa3e1){return{'model':db[_0x6aa3e1[_0xa94b('0x1d')]],'as':_0x6aa3e1['as'],'attributes':_0x6aa3e1[_0xa94b('0x19')],'include':_0x6aa3e1['include']?_['map'](_0x6aa3e1[_0xa94b('0x1b')],function(_0x88d43f){return{'model':db[_0x88d43f[_0xa94b('0x1d')]],'as':_0x88d43f['as'],'attributes':_0x88d43f[_0xa94b('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa94b('0x1e')](function(_0x439d96){logger[_0xa94b('0xa')]('GetDynamics365Account',_0x37a08d);logger['debug'](_0xa94b('0x13'),_0x37a08d,JSON['stringify'](_0x439d96));_0x34049f(_0x439d96);})[_0xa94b('0x12')](function(_0x475566){logger[_0xa94b('0x10')](_0xa94b('0x13'),_0x475566[_0xa94b('0x11')],_0x37a08d);_0x32406e(_0x1b0e14['error'](0x1f4,_0x475566[_0xa94b('0x11')]));});});};exports[_0xa94b('0x1f')]=function(_0x5783cf){var _0x38c9e2=this;return new Promise(function(_0x548b86,_0x173027){return db[_0xa94b('0x14')][_0xa94b('0x20')]({'raw':_0x5783cf[_0xa94b('0x16')]?_0x5783cf[_0xa94b('0x16')][_0xa94b('0x17')]===undefined?!![]:![]:!![],'where':_0x5783cf[_0xa94b('0x16')]?_0x5783cf[_0xa94b('0x16')][_0xa94b('0x18')]||null:null,'attributes':_0x5783cf[_0xa94b('0x16')]?_0x5783cf[_0xa94b('0x16')]['attributes']||null:null,'include':_0x5783cf[_0xa94b('0x16')]?_0x5783cf[_0xa94b('0x16')][_0xa94b('0x1b')]?_[_0xa94b('0x1c')](_0x5783cf[_0xa94b('0x16')][_0xa94b('0x1b')],function(_0xa6f4ca){return{'model':db[_0xa6f4ca[_0xa94b('0x1d')]],'as':_0xa6f4ca['as'],'attributes':_0xa6f4ca[_0xa94b('0x19')],'include':_0xa6f4ca[_0xa94b('0x1b')]?_[_0xa94b('0x1c')](_0xa6f4ca[_0xa94b('0x1b')],function(_0x324b1e){return{'model':db[_0x324b1e[_0xa94b('0x1d')]],'as':_0x324b1e['as'],'attributes':_0x324b1e[_0xa94b('0x19')],'include':_0x324b1e[_0xa94b('0x1b')]?_[_0xa94b('0x1c')](_0x324b1e['include'],function(_0x487d13){return{'model':db[_0x487d13[_0xa94b('0x1d')]],'as':_0x487d13['as'],'attributes':_0x487d13[_0xa94b('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa94b('0x1e')](function(_0x557214){logger[_0xa94b('0xa')](_0xa94b('0x1f'),_0x5783cf);logger['debug'](_0xa94b('0x1f'),_0x5783cf,JSON[_0xa94b('0xf')](_0x557214));_0x548b86(_0x557214);})['catch'](function(_0x6ce53b){logger[_0xa94b('0x10')](_0xa94b('0x1f'),_0x6ce53b[_0xa94b('0x11')],_0x5783cf);_0x173027(_0x38c9e2[_0xa94b('0x10')](0x1f4,_0x6ce53b[_0xa94b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 5c2ac64..6250a81 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 _0x0c89=['post','create','put','update','delete','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','isAuthenticated','get','/:id','show','/:id/fields','/:id/subjects','getDescriptions'];(function(_0x5715c7,_0x191c23){var _0x39d963=function(_0x2b5a4b){while(--_0x2b5a4b){_0x5715c7['push'](_0x5715c7['shift']());}};_0x39d963(++_0x191c23);}(_0x0c89,0x65));var _0x90c8=function(_0x5113ce,_0x659ccc){_0x5113ce=_0x5113ce-0x0;var _0x5897ca=_0x0c89[_0x5113ce];return _0x5897ca;};'use strict';var multer=require('multer');var util=require(_0x90c8('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x90c8('0x1'));var router=express[_0x90c8('0x2')]();var auth=require(_0x90c8('0x3'));var interaction=require(_0x90c8('0x4'));var config=require('../../config/environment');var controller=require(_0x90c8('0x5'));router['get']('/',auth[_0x90c8('0x6')](),controller['index']);router[_0x90c8('0x7')](_0x90c8('0x8'),auth[_0x90c8('0x6')](),controller[_0x90c8('0x9')]);router[_0x90c8('0x7')](_0x90c8('0xa'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0x90c8('0xb'),auth['isAuthenticated'](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x90c8('0x6')](),controller[_0x90c8('0xc')]);router[_0x90c8('0xd')]('/',auth[_0x90c8('0x6')](),controller[_0x90c8('0xe')]);router[_0x90c8('0xf')](_0x90c8('0x8'),auth['isAuthenticated'](),controller[_0x90c8('0x10')]);router[_0x90c8('0x11')]('/:id',auth[_0x90c8('0x6')](),controller['destroy']);module[_0x90c8('0x12')]=router; \ No newline at end of file +var _0x80dc=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','/:id','show','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','delete'];(function(_0x1968e6,_0x160d99){var _0x5a4621=function(_0x35a361){while(--_0x35a361){_0x1968e6['push'](_0x1968e6['shift']());}};_0x5a4621(++_0x160d99);}(_0x80dc,0x79));var _0xc80d=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x80dc[_0x173441];return _0x2423a8;};'use strict';var multer=require(_0xc80d('0x0'));var util=require(_0xc80d('0x1'));var path=require(_0xc80d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc80d('0x3')]();var auth=require(_0xc80d('0x4'));var interaction=require(_0xc80d('0x5'));var config=require(_0xc80d('0x6'));var controller=require(_0xc80d('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc80d('0x8')](_0xc80d('0x9'),auth['isAuthenticated'](),controller[_0xc80d('0xa')]);router[_0xc80d('0x8')]('/:id/fields',auth[_0xc80d('0xb')](),controller['getFields']);router[_0xc80d('0x8')](_0xc80d('0xc'),auth['isAuthenticated'](),controller[_0xc80d('0xd')]);router[_0xc80d('0x8')](_0xc80d('0xe'),auth['isAuthenticated'](),controller[_0xc80d('0xf')]);router[_0xc80d('0x10')]('/',auth['isAuthenticated'](),controller[_0xc80d('0x11')]);router['put'](_0xc80d('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xc80d('0x12')](_0xc80d('0x9'),auth[_0xc80d('0xb')](),controller['destroy']);module[_0xc80d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 210cf56..88a2de3 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 _0x0e68=['incident','sequelize','exports','STRING','ENUM','phonecall'];(function(_0x769dd2,_0x51c569){var _0x103980=function(_0x2efdff){while(--_0x2efdff){_0x769dd2['push'](_0x769dd2['shift']());}};_0x103980(++_0x51c569);}(_0x0e68,0x187));var _0x80e6=function(_0x7752f6,_0x161622){_0x7752f6=_0x7752f6-0x0;var _0x53883c=_0x0e68[_0x7752f6];return _0x53883c;};'use strict';var Sequelize=require(_0x80e6('0x0'));module[_0x80e6('0x1')]={'name':{'type':Sequelize[_0x80e6('0x2')]},'description':{'type':Sequelize[_0x80e6('0x2')]},'ticketType':{'type':Sequelize[_0x80e6('0x3')]('incident',_0x80e6('0x4')),'defaultValue':_0x80e6('0x5')}}; \ No newline at end of file +var _0x79a4=['incident','phonecall','sequelize','exports','STRING'];(function(_0x1f4de7,_0x564f4e){var _0x3eca15=function(_0x10bb54){while(--_0x10bb54){_0x1f4de7['push'](_0x1f4de7['shift']());}};_0x3eca15(++_0x564f4e);}(_0x79a4,0xd4));var _0x479a=function(_0x4ac335,_0x23f63f){_0x4ac335=_0x4ac335-0x0;var _0x132044=_0x79a4[_0x4ac335];return _0x132044;};'use strict';var Sequelize=require(_0x479a('0x0'));module[_0x479a('0x1')]={'name':{'type':Sequelize[_0x479a('0x2')]},'description':{'type':Sequelize[_0x479a('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x479a('0x3'),_0x479a('0x4')),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index cd00b4e..3fb91a0 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 _0x0e01=['reject','save','update','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','length','find','create','body','destroy','findOne','hasOwnProperty','getFields','getSubjects','Dynamics365Field','getDescriptions','html-pdf','zip-dir','fast-json-patch','request-promise','mustache','sox','ejs','lodash','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','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0x346064,_0x25d321){var _0x20c40d=function(_0x13560d){while(--_0x13560d){_0x346064['push'](_0x346064['shift']());}};_0x20c40d(++_0x25d321);}(_0x0e01,0x87));var _0x10e0=function(_0xfac4c1,_0x7b2796){_0xfac4c1=_0xfac4c1-0x0;var _0x317321=_0x0e01[_0xfac4c1];return _0x317321;};'use strict';var pdf=require(_0x10e0('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x10e0('0x1'));var jsonpatch=require(_0x10e0('0x2'));var rp=require(_0x10e0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x10e0('0x4'));var util=require('util');var path=require('path');var sox=require(_0x10e0('0x5'));var csv=require('to-csv');var ejs=require(_0x10e0('0x6'));var fs=require('fs');var _=require(_0x10e0('0x7'));var squel=require('squel');var crypto=require(_0x10e0('0x8'));var jsforce=require(_0x10e0('0x9'));var deskjs=require(_0x10e0('0xa'));var toCsv=require('to-csv');var querystring=require(_0x10e0('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x10e0('0xc'));var qs=require(_0x10e0('0xd'));var as=require(_0x10e0('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x10e0('0xf'))(_0x10e0('0x10'));var utils=require(_0x10e0('0x11'));var config=require(_0x10e0('0x12'));var licenseUtil=require(_0x10e0('0x13'));var db=require(_0x10e0('0x14'))['db'];var jayson=require(_0x10e0('0x15'));var client=jayson[_0x10e0('0x16')][_0x10e0('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x2cd664,_0x423bc4,_0x96dd26,_0x4a9fd2){return new BPromise(function(_0x358918,_0x21c5cb){var _0x12a4ad=_0x4a9fd2||client;return _0x12a4ad[_0x10e0('0x18')](_0x2cd664,_0x96dd26)[_0x10e0('0x19')](function(_0x566cf3){logger[_0x10e0('0x1a')](_0x10e0('0x1b'),_0x423bc4,'request\x20sent');logger[_0x10e0('0x1c')](_0x10e0('0x1d'),_0x423bc4,_0x10e0('0x1e'),JSON[_0x10e0('0x1f')](_0x566cf3));if(_0x566cf3[_0x10e0('0x20')]){if(_0x566cf3[_0x10e0('0x20')][_0x10e0('0x21')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x423bc4,_0x566cf3[_0x10e0('0x20')]['message']);return _0x21c5cb(_0x566cf3[_0x10e0('0x20')][_0x10e0('0x22')]);}logger[_0x10e0('0x20')](_0x10e0('0x1b'),_0x423bc4,_0x566cf3[_0x10e0('0x20')][_0x10e0('0x22')]);return _0x358918(_0x566cf3[_0x10e0('0x20')][_0x10e0('0x22')]);}else{logger[_0x10e0('0x1a')]('Dynamics365Configuration,\x20%s,\x20%s',_0x423bc4,_0x10e0('0x1e'));_0x358918(_0x566cf3['result'][_0x10e0('0x22')]);}})[_0x10e0('0x23')](function(_0x422cb6){logger['error'](_0x10e0('0x1b'),_0x423bc4,_0x422cb6);_0x21c5cb(_0x422cb6);});});}function respondWithStatusCode(_0x2f0391,_0x1f01e0){_0x1f01e0=_0x1f01e0||0xcc;return function(_0x18dc10){if(_0x18dc10){return _0x2f0391[_0x10e0('0x24')](_0x1f01e0);}return _0x2f0391[_0x10e0('0x25')](_0x1f01e0)['end']();};}function respondWithResult(_0x58e79e,_0x369b33){_0x369b33=_0x369b33||0xc8;return function(_0x4cfd42){if(_0x4cfd42){return _0x58e79e[_0x10e0('0x25')](_0x369b33)[_0x10e0('0x26')](_0x4cfd42);}};}function respondWithFilteredResult(_0x55520b,_0x1ec14d){return function(_0x161a7b){if(_0x161a7b){var _0x3e70d9=_0x161a7b[_0x10e0('0x27')],_0x497880=_0x1ec14d['offset'],_0xfc8335=_0x1ec14d[_0x10e0('0x28')]+_0x1ec14d[_0x10e0('0x29')],_0x20fb05;if(_0xfc8335>=_0x3e70d9){_0xfc8335=_0x3e70d9;_0x20fb05=0xc8;}else{_0x20fb05=0xce;}_0x55520b[_0x10e0('0x25')](_0x20fb05);return _0x55520b[_0x10e0('0x2a')](_0x10e0('0x2b'),_0x497880+'-'+_0xfc8335+'/'+_0x3e70d9)[_0x10e0('0x26')](_0x161a7b);}return null;};}function patchUpdates(_0x171d4f){return function(_0x2cb2dc){try{jsonpatch[_0x10e0('0x2c')](_0x2cb2dc,_0x171d4f,!![]);}catch(_0x2822ea){return BPromise[_0x10e0('0x2d')](_0x2822ea);}return _0x2cb2dc[_0x10e0('0x2e')]();};}function saveUpdates(_0xcc13d5,_0x59c6e2){return function(_0x232111){if(_0x232111){return _0x232111[_0x10e0('0x2f')](_0xcc13d5)[_0x10e0('0x19')](function(_0x41ee7c){return _0x41ee7c;});}return null;};}function removeEntity(_0x56bfdd,_0x22dc73){return function(_0x1ab289){if(_0x1ab289){return _0x1ab289['destroy']()[_0x10e0('0x19')](function(){_0x56bfdd[_0x10e0('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fbf5f,_0x525fcd){return function(_0xb69e11){if(!_0xb69e11){_0x3fbf5f[_0x10e0('0x24')](0x194);}return _0xb69e11;};}function handleError(_0x547090,_0x590535){_0x590535=_0x590535||0x1f4;return function(_0x5878a3){logger[_0x10e0('0x20')](_0x5878a3[_0x10e0('0x30')]);if(_0x5878a3[_0x10e0('0x31')]){delete _0x5878a3['name'];}_0x547090[_0x10e0('0x25')](_0x590535)[_0x10e0('0x32')](_0x5878a3);};}exports[_0x10e0('0x33')]=function(_0x215151,_0x573d85){var _0x542383={},_0x447567={},_0x329b16={'count':0x0,'rows':[]};var _0x53d24d=_[_0x10e0('0x34')](db[_0x10e0('0x35')][_0x10e0('0x36')],function(_0x25bdcc){return{'name':_0x25bdcc[_0x10e0('0x37')],'type':_0x25bdcc['type'][_0x10e0('0x38')]};});_0x447567[_0x10e0('0x39')]=_[_0x10e0('0x34')](_0x53d24d,'name');_0x447567[_0x10e0('0x3a')]=_[_0x10e0('0x3b')](_0x215151[_0x10e0('0x3a')]);_0x447567[_0x10e0('0x3c')]=_[_0x10e0('0x3d')](_0x447567[_0x10e0('0x39')],_0x447567[_0x10e0('0x3a')]);_0x542383[_0x10e0('0x3e')]=_[_0x10e0('0x3d')](_0x447567['model'],qs[_0x10e0('0x3f')](_0x215151[_0x10e0('0x3a')][_0x10e0('0x3f')]));_0x542383[_0x10e0('0x3e')]=_0x542383[_0x10e0('0x3e')]['length']?_0x542383['attributes']:_0x447567[_0x10e0('0x39')];if(!_0x215151['query']['hasOwnProperty'](_0x10e0('0x40'))){_0x542383[_0x10e0('0x29')]=qs['limit'](_0x215151[_0x10e0('0x3a')]['limit']);_0x542383[_0x10e0('0x28')]=qs[_0x10e0('0x28')](_0x215151[_0x10e0('0x3a')][_0x10e0('0x28')]);}_0x542383[_0x10e0('0x41')]=qs[_0x10e0('0x42')](_0x215151[_0x10e0('0x3a')][_0x10e0('0x42')]);_0x542383[_0x10e0('0x43')]=qs[_0x10e0('0x3c')](_[_0x10e0('0x44')](_0x215151[_0x10e0('0x3a')],_0x447567['filters']),_0x53d24d);if(_0x215151[_0x10e0('0x3a')][_0x10e0('0x45')]){_0x542383[_0x10e0('0x43')]=_['merge'](_0x542383[_0x10e0('0x43')],{'$or':_[_0x10e0('0x34')](_0x53d24d,function(_0x4e228a){if(_0x4e228a['type']!==_0x10e0('0x46')){var _0x13d56d={};_0x13d56d[_0x4e228a[_0x10e0('0x31')]]={'$like':'%'+_0x215151[_0x10e0('0x3a')][_0x10e0('0x45')]+'%'};return _0x13d56d;}})});}_0x542383=_[_0x10e0('0x47')]({},_0x542383,_0x215151[_0x10e0('0x48')]);var _0x3ab269={'where':_0x542383[_0x10e0('0x43')]};return db[_0x10e0('0x35')]['count'](_0x3ab269)[_0x10e0('0x19')](function(_0x32174d){_0x329b16[_0x10e0('0x27')]=_0x32174d;if(_0x215151['query'][_0x10e0('0x49')]){_0x542383[_0x10e0('0x4a')]=[{'all':!![]}];}return db[_0x10e0('0x35')][_0x10e0('0x4b')](_0x542383);})[_0x10e0('0x19')](function(_0x1052f3){_0x329b16[_0x10e0('0x4c')]=_0x1052f3;return _0x329b16;})[_0x10e0('0x19')](respondWithFilteredResult(_0x573d85,_0x542383))[_0x10e0('0x23')](handleError(_0x573d85,null));};exports[_0x10e0('0x4d')]=function(_0x16b8da,_0x406c45){var _0x2a8573={'raw':![],'where':{'id':_0x16b8da[_0x10e0('0x4e')]['id']}},_0x2d89e7={};_0x2d89e7[_0x10e0('0x39')]=_[_0x10e0('0x3b')](db[_0x10e0('0x35')]['rawAttributes']);_0x2d89e7[_0x10e0('0x3a')]=_[_0x10e0('0x3b')](_0x16b8da['query']);_0x2d89e7[_0x10e0('0x3c')]=_[_0x10e0('0x3d')](_0x2d89e7[_0x10e0('0x39')],_0x2d89e7['query']);_0x2a8573[_0x10e0('0x3e')]=_[_0x10e0('0x3d')](_0x2d89e7[_0x10e0('0x39')],qs[_0x10e0('0x3f')](_0x16b8da[_0x10e0('0x3a')][_0x10e0('0x3f')]));_0x2a8573[_0x10e0('0x3e')]=_0x2a8573['attributes'][_0x10e0('0x4f')]?_0x2a8573[_0x10e0('0x3e')]:_0x2d89e7[_0x10e0('0x39')];if(_0x16b8da[_0x10e0('0x3a')][_0x10e0('0x49')]){_0x2a8573[_0x10e0('0x4a')]=[{'all':!![]}];}_0x2a8573=_[_0x10e0('0x47')]({},_0x2a8573,_0x16b8da[_0x10e0('0x48')]);return db['Dynamics365Configuration'][_0x10e0('0x50')](_0x2a8573)[_0x10e0('0x19')](handleEntityNotFound(_0x406c45,null))[_0x10e0('0x19')](respondWithResult(_0x406c45,null))[_0x10e0('0x23')](handleError(_0x406c45,null));};exports[_0x10e0('0x51')]=function(_0x15e101,_0x248a98){return db['Dynamics365Configuration'][_0x10e0('0x51')](_0x15e101['body'],{})[_0x10e0('0x19')](respondWithResult(_0x248a98,0xc9))['catch'](handleError(_0x248a98,null));};exports['update']=function(_0x1000c3,_0x7fa0f){if(_0x1000c3[_0x10e0('0x52')]['id']){delete _0x1000c3[_0x10e0('0x52')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x1000c3['params']['id']}})['then'](handleEntityNotFound(_0x7fa0f,null))[_0x10e0('0x19')](saveUpdates(_0x1000c3['body'],null))['then'](respondWithResult(_0x7fa0f,null))['catch'](handleError(_0x7fa0f,null));};exports[_0x10e0('0x53')]=function(_0x27791f,_0x15f05d){return db[_0x10e0('0x35')][_0x10e0('0x50')]({'where':{'id':_0x27791f[_0x10e0('0x4e')]['id']}})[_0x10e0('0x19')](handleEntityNotFound(_0x15f05d,null))['then'](removeEntity(_0x15f05d,null))[_0x10e0('0x23')](handleError(_0x15f05d,null));};exports['getFields']=function(_0x329de3,_0x3cf0ed,_0x10bf1d){var _0x52d72b={};var _0x59ee88={};var _0x17c95e;var _0x4a988e;return db[_0x10e0('0x35')][_0x10e0('0x54')]({'where':{'id':_0x329de3[_0x10e0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3cf0ed,null))[_0x10e0('0x19')](function(_0x3efb64){if(_0x3efb64){_0x17c95e=_0x3efb64;_0x59ee88[_0x10e0('0x39')]=_['keys'](db['Dynamics365Field'][_0x10e0('0x36')]);_0x59ee88[_0x10e0('0x3a')]=_[_0x10e0('0x3b')](_0x329de3[_0x10e0('0x3a')]);_0x59ee88[_0x10e0('0x3c')]=_[_0x10e0('0x3d')](_0x59ee88['model'],_0x59ee88['query']);_0x52d72b['attributes']=_[_0x10e0('0x3d')](_0x59ee88[_0x10e0('0x39')],qs['fields'](_0x329de3[_0x10e0('0x3a')][_0x10e0('0x3f')]));_0x52d72b[_0x10e0('0x3e')]=_0x52d72b[_0x10e0('0x3e')][_0x10e0('0x4f')]?_0x52d72b[_0x10e0('0x3e')]:_0x59ee88[_0x10e0('0x39')];_0x52d72b[_0x10e0('0x41')]=qs[_0x10e0('0x42')](_0x329de3[_0x10e0('0x3a')]['sort']);_0x52d72b[_0x10e0('0x43')]=qs['filters'](_[_0x10e0('0x44')](_0x329de3[_0x10e0('0x3a')],_0x59ee88[_0x10e0('0x3c')]));if(_0x329de3['query']['filter']){_0x52d72b[_0x10e0('0x43')]=_[_0x10e0('0x47')](_0x52d72b['where'],{'$or':_['map'](_0x52d72b[_0x10e0('0x3e')],function(_0x24ce20){var _0x5c8e4d={};_0x5c8e4d[_0x24ce20]={'$like':'%'+_0x329de3[_0x10e0('0x3a')]['filter']+'%'};return _0x5c8e4d;})});}_0x52d72b=_[_0x10e0('0x47')]({},_0x52d72b,_0x329de3[_0x10e0('0x48')]);return _0x17c95e['getFields'](_0x52d72b);}})['then'](function(_0x3dffce){if(_0x3dffce){_0x4a988e=_0x3dffce[_0x10e0('0x4f')];if(!_0x329de3[_0x10e0('0x3a')][_0x10e0('0x55')](_0x10e0('0x40'))){_0x52d72b['limit']=qs[_0x10e0('0x29')](_0x329de3['query'][_0x10e0('0x29')]);_0x52d72b[_0x10e0('0x28')]=qs[_0x10e0('0x28')](_0x329de3[_0x10e0('0x3a')][_0x10e0('0x28')]);}return _0x17c95e[_0x10e0('0x56')](_0x52d72b);}})[_0x10e0('0x19')](function(_0x1b58f2){if(_0x1b58f2){return _0x1b58f2?{'count':_0x4a988e,'rows':_0x1b58f2}:null;}})[_0x10e0('0x19')](respondWithResult(_0x3cf0ed,null))[_0x10e0('0x23')](handleError(_0x3cf0ed,null));};exports[_0x10e0('0x57')]=function(_0x239278,_0x5aa72e,_0x5e0acd){var _0x379b5e={};var _0x655ecc={};var _0x5f5db2;var _0x5b644a;return db[_0x10e0('0x35')]['findOne']({'where':{'id':_0x239278[_0x10e0('0x4e')]['id']}})[_0x10e0('0x19')](handleEntityNotFound(_0x5aa72e,null))['then'](function(_0x536eae){if(_0x536eae){_0x5f5db2=_0x536eae;_0x655ecc[_0x10e0('0x39')]=_['keys'](db[_0x10e0('0x58')]['rawAttributes']);_0x655ecc[_0x10e0('0x3a')]=_['keys'](_0x239278[_0x10e0('0x3a')]);_0x655ecc[_0x10e0('0x3c')]=_[_0x10e0('0x3d')](_0x655ecc[_0x10e0('0x39')],_0x655ecc[_0x10e0('0x3a')]);_0x379b5e[_0x10e0('0x3e')]=_[_0x10e0('0x3d')](_0x655ecc[_0x10e0('0x39')],qs['fields'](_0x239278[_0x10e0('0x3a')][_0x10e0('0x3f')]));_0x379b5e[_0x10e0('0x3e')]=_0x379b5e[_0x10e0('0x3e')][_0x10e0('0x4f')]?_0x379b5e[_0x10e0('0x3e')]:_0x655ecc[_0x10e0('0x39')];_0x379b5e['order']=qs[_0x10e0('0x42')](_0x239278[_0x10e0('0x3a')][_0x10e0('0x42')]);_0x379b5e[_0x10e0('0x43')]=qs[_0x10e0('0x3c')](_[_0x10e0('0x44')](_0x239278[_0x10e0('0x3a')],_0x655ecc[_0x10e0('0x3c')]));if(_0x239278[_0x10e0('0x3a')][_0x10e0('0x45')]){_0x379b5e['where']=_[_0x10e0('0x47')](_0x379b5e[_0x10e0('0x43')],{'$or':_[_0x10e0('0x34')](_0x379b5e[_0x10e0('0x3e')],function(_0x2bc960){var _0x2b1118={};_0x2b1118[_0x2bc960]={'$like':'%'+_0x239278[_0x10e0('0x3a')][_0x10e0('0x45')]+'%'};return _0x2b1118;})});}_0x379b5e=_[_0x10e0('0x47')]({},_0x379b5e,_0x239278[_0x10e0('0x48')]);return _0x5f5db2[_0x10e0('0x57')](_0x379b5e);}})[_0x10e0('0x19')](function(_0x377e0e){if(_0x377e0e){_0x5b644a=_0x377e0e['length'];if(!_0x239278[_0x10e0('0x3a')][_0x10e0('0x55')](_0x10e0('0x40'))){_0x379b5e[_0x10e0('0x29')]=qs[_0x10e0('0x29')](_0x239278[_0x10e0('0x3a')][_0x10e0('0x29')]);_0x379b5e[_0x10e0('0x28')]=qs[_0x10e0('0x28')](_0x239278[_0x10e0('0x3a')]['offset']);}return _0x5f5db2[_0x10e0('0x57')](_0x379b5e);}})[_0x10e0('0x19')](function(_0x3a5b3f){if(_0x3a5b3f){return _0x3a5b3f?{'count':_0x5b644a,'rows':_0x3a5b3f}:null;}})[_0x10e0('0x19')](respondWithResult(_0x5aa72e,null))['catch'](handleError(_0x5aa72e,null));};exports[_0x10e0('0x59')]=function(_0x1d7573,_0x74df4e,_0x17e593){var _0x2598d9={};var _0x35bd5e={};var _0x17e0d3;var _0x540fc3;return db[_0x10e0('0x35')]['findOne']({'where':{'id':_0x1d7573[_0x10e0('0x4e')]['id']}})[_0x10e0('0x19')](handleEntityNotFound(_0x74df4e,null))[_0x10e0('0x19')](function(_0x33e226){if(_0x33e226){_0x17e0d3=_0x33e226;_0x35bd5e[_0x10e0('0x39')]=_[_0x10e0('0x3b')](db[_0x10e0('0x58')][_0x10e0('0x36')]);_0x35bd5e[_0x10e0('0x3a')]=_[_0x10e0('0x3b')](_0x1d7573[_0x10e0('0x3a')]);_0x35bd5e[_0x10e0('0x3c')]=_['intersection'](_0x35bd5e[_0x10e0('0x39')],_0x35bd5e[_0x10e0('0x3a')]);_0x2598d9['attributes']=_[_0x10e0('0x3d')](_0x35bd5e[_0x10e0('0x39')],qs[_0x10e0('0x3f')](_0x1d7573[_0x10e0('0x3a')][_0x10e0('0x3f')]));_0x2598d9[_0x10e0('0x3e')]=_0x2598d9[_0x10e0('0x3e')]['length']?_0x2598d9[_0x10e0('0x3e')]:_0x35bd5e[_0x10e0('0x39')];_0x2598d9['order']=qs[_0x10e0('0x42')](_0x1d7573[_0x10e0('0x3a')]['sort']);_0x2598d9[_0x10e0('0x43')]=qs[_0x10e0('0x3c')](_[_0x10e0('0x44')](_0x1d7573[_0x10e0('0x3a')],_0x35bd5e[_0x10e0('0x3c')]));if(_0x1d7573[_0x10e0('0x3a')][_0x10e0('0x45')]){_0x2598d9[_0x10e0('0x43')]=_['merge'](_0x2598d9[_0x10e0('0x43')],{'$or':_[_0x10e0('0x34')](_0x2598d9[_0x10e0('0x3e')],function(_0x440d73){var _0x231d64={};_0x231d64[_0x440d73]={'$like':'%'+_0x1d7573[_0x10e0('0x3a')][_0x10e0('0x45')]+'%'};return _0x231d64;})});}_0x2598d9=_['merge']({},_0x2598d9,_0x1d7573[_0x10e0('0x48')]);return _0x17e0d3[_0x10e0('0x59')](_0x2598d9);}})['then'](function(_0xadb3f8){if(_0xadb3f8){_0x540fc3=_0xadb3f8[_0x10e0('0x4f')];if(!_0x1d7573[_0x10e0('0x3a')]['hasOwnProperty'](_0x10e0('0x40'))){_0x2598d9[_0x10e0('0x29')]=qs[_0x10e0('0x29')](_0x1d7573[_0x10e0('0x3a')]['limit']);_0x2598d9[_0x10e0('0x28')]=qs[_0x10e0('0x28')](_0x1d7573[_0x10e0('0x3a')]['offset']);}return _0x17e0d3[_0x10e0('0x59')](_0x2598d9);}})[_0x10e0('0x19')](function(_0x468b86){if(_0x468b86){return _0x468b86?{'count':_0x540fc3,'rows':_0x468b86}:null;}})[_0x10e0('0x19')](respondWithResult(_0x74df4e,null))[_0x10e0('0x23')](handleError(_0x74df4e,null));}; \ No newline at end of file +var _0x8d21=['sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','create','body','find','destroy','getFields','findOne','Dynamics365Field','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','jayson/promise','client','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','apply','stack','name','send','map','Dynamics365Configuration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order'];(function(_0x474492,_0x254e12){var _0x44480b=function(_0x107839){while(--_0x107839){_0x474492['push'](_0x474492['shift']());}};_0x44480b(++_0x254e12);}(_0x8d21,0x16c));var _0x18d2=function(_0x46e2d1,_0x1ac94e){_0x46e2d1=_0x46e2d1-0x0;var _0x1e9b91=_0x8d21[_0x46e2d1];return _0x1e9b91;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x18d2('0x0'));var rimraf=require(_0x18d2('0x1'));var zipdir=require(_0x18d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x18d2('0x3'));var moment=require(_0x18d2('0x4'));var BPromise=require(_0x18d2('0x5'));var Mustache=require(_0x18d2('0x6'));var util=require(_0x18d2('0x7'));var path=require(_0x18d2('0x8'));var sox=require('sox');var csv=require(_0x18d2('0x9'));var ejs=require(_0x18d2('0xa'));var fs=require('fs');var _=require(_0x18d2('0xb'));var squel=require(_0x18d2('0xc'));var crypto=require(_0x18d2('0xd'));var jsforce=require(_0x18d2('0xe'));var deskjs=require(_0x18d2('0xf'));var toCsv=require(_0x18d2('0x9'));var querystring=require('querystring');var Papa=require(_0x18d2('0x10'));var Redis=require(_0x18d2('0x11'));var authService=require(_0x18d2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x18d2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x18d2('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x18d2('0x15'));var db=require(_0x18d2('0x16'))['db'];var jayson=require(_0x18d2('0x17'));var client=jayson[_0x18d2('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x182082,_0x18fe89,_0x50eea1,_0x49a94a){return new BPromise(function(_0x4ac885,_0x154f7a){var _0x21c8ab=_0x49a94a||client;return _0x21c8ab['request'](_0x182082,_0x50eea1)[_0x18d2('0x19')](function(_0xcf2e4f){logger[_0x18d2('0x1a')](_0x18d2('0x1b'),_0x18fe89,_0x18d2('0x1c'));logger[_0x18d2('0x1d')](_0x18d2('0x1e'),_0x18fe89,_0x18d2('0x1c'),JSON[_0x18d2('0x1f')](_0xcf2e4f));if(_0xcf2e4f['error']){if(_0xcf2e4f[_0x18d2('0x20')][_0x18d2('0x21')]===0x1f4){logger[_0x18d2('0x20')](_0x18d2('0x1b'),_0x18fe89,_0xcf2e4f[_0x18d2('0x20')][_0x18d2('0x22')]);return _0x154f7a(_0xcf2e4f[_0x18d2('0x20')][_0x18d2('0x22')]);}logger[_0x18d2('0x20')](_0x18d2('0x1b'),_0x18fe89,_0xcf2e4f[_0x18d2('0x20')][_0x18d2('0x22')]);return _0x4ac885(_0xcf2e4f[_0x18d2('0x20')][_0x18d2('0x22')]);}else{logger[_0x18d2('0x1a')](_0x18d2('0x1b'),_0x18fe89,'request\x20sent');_0x4ac885(_0xcf2e4f['result']['message']);}})[_0x18d2('0x23')](function(_0x976f92){logger[_0x18d2('0x20')](_0x18d2('0x1b'),_0x18fe89,_0x976f92);_0x154f7a(_0x976f92);});});}function respondWithStatusCode(_0x4a4ed3,_0x560204){_0x560204=_0x560204||0xcc;return function(_0x478059){if(_0x478059){return _0x4a4ed3[_0x18d2('0x24')](_0x560204);}return _0x4a4ed3[_0x18d2('0x25')](_0x560204)[_0x18d2('0x26')]();};}function respondWithResult(_0x3e5dea,_0xf9aa9a){_0xf9aa9a=_0xf9aa9a||0xc8;return function(_0x395121){if(_0x395121){return _0x3e5dea[_0x18d2('0x25')](_0xf9aa9a)[_0x18d2('0x27')](_0x395121);}};}function respondWithFilteredResult(_0x1fdce3,_0xa04925){return function(_0x184d53){if(_0x184d53){var _0x387eba=_0x184d53['count'],_0xb75bb=_0xa04925['offset'],_0x417375=_0xa04925[_0x18d2('0x28')]+_0xa04925['limit'],_0xc0fd73;if(_0x417375>=_0x387eba){_0x417375=_0x387eba;_0xc0fd73=0xc8;}else{_0xc0fd73=0xce;}_0x1fdce3[_0x18d2('0x25')](_0xc0fd73);return _0x1fdce3['set']('Content-Range',_0xb75bb+'-'+_0x417375+'/'+_0x387eba)[_0x18d2('0x27')](_0x184d53);}return null;};}function patchUpdates(_0x20abf9){return function(_0x5bfe9e){try{jsonpatch[_0x18d2('0x29')](_0x5bfe9e,_0x20abf9,!![]);}catch(_0x21e21d){return BPromise['reject'](_0x21e21d);}return _0x5bfe9e['save']();};}function saveUpdates(_0x5e6ed2,_0x128fc7){return function(_0x5496fe){if(_0x5496fe){return _0x5496fe['update'](_0x5e6ed2)[_0x18d2('0x19')](function(_0x5407e1){return _0x5407e1;});}return null;};}function removeEntity(_0x437638,_0xdf404a){return function(_0x2bda13){if(_0x2bda13){return _0x2bda13['destroy']()['then'](function(){_0x437638['status'](0xcc)[_0x18d2('0x26')]();});}};}function handleEntityNotFound(_0x8cb022,_0x544298){return function(_0x159b1e){if(!_0x159b1e){_0x8cb022[_0x18d2('0x24')](0x194);}return _0x159b1e;};}function handleError(_0x236da9,_0x15f3e8){_0x15f3e8=_0x15f3e8||0x1f4;return function(_0x1c9e7e){logger[_0x18d2('0x20')](_0x1c9e7e[_0x18d2('0x2a')]);if(_0x1c9e7e[_0x18d2('0x2b')]){delete _0x1c9e7e[_0x18d2('0x2b')];}_0x236da9[_0x18d2('0x25')](_0x15f3e8)[_0x18d2('0x2c')](_0x1c9e7e);};}exports['index']=function(_0xcf545d,_0x5cfa0c){var _0x5bc6f2={},_0x4c57a1={},_0x2517f6={'count':0x0,'rows':[]};var _0x24fd30=_[_0x18d2('0x2d')](db[_0x18d2('0x2e')][_0x18d2('0x2f')],function(_0x5d36c4){return{'name':_0x5d36c4['fieldName'],'type':_0x5d36c4[_0x18d2('0x30')][_0x18d2('0x31')]};});_0x4c57a1[_0x18d2('0x32')]=_['map'](_0x24fd30,'name');_0x4c57a1[_0x18d2('0x33')]=_[_0x18d2('0x34')](_0xcf545d[_0x18d2('0x33')]);_0x4c57a1[_0x18d2('0x35')]=_[_0x18d2('0x36')](_0x4c57a1[_0x18d2('0x32')],_0x4c57a1[_0x18d2('0x33')]);_0x5bc6f2['attributes']=_[_0x18d2('0x36')](_0x4c57a1[_0x18d2('0x32')],qs[_0x18d2('0x37')](_0xcf545d['query'][_0x18d2('0x37')]));_0x5bc6f2[_0x18d2('0x38')]=_0x5bc6f2[_0x18d2('0x38')][_0x18d2('0x39')]?_0x5bc6f2[_0x18d2('0x38')]:_0x4c57a1[_0x18d2('0x32')];if(!_0xcf545d['query']['hasOwnProperty'](_0x18d2('0x3a'))){_0x5bc6f2['limit']=qs[_0x18d2('0x3b')](_0xcf545d[_0x18d2('0x33')][_0x18d2('0x3b')]);_0x5bc6f2[_0x18d2('0x28')]=qs[_0x18d2('0x28')](_0xcf545d['query'][_0x18d2('0x28')]);}_0x5bc6f2[_0x18d2('0x3c')]=qs[_0x18d2('0x3d')](_0xcf545d[_0x18d2('0x33')][_0x18d2('0x3d')]);_0x5bc6f2[_0x18d2('0x3e')]=qs['filters'](_[_0x18d2('0x3f')](_0xcf545d[_0x18d2('0x33')],_0x4c57a1[_0x18d2('0x35')]),_0x24fd30);if(_0xcf545d['query'][_0x18d2('0x40')]){_0x5bc6f2[_0x18d2('0x3e')]=_[_0x18d2('0x41')](_0x5bc6f2[_0x18d2('0x3e')],{'$or':_['map'](_0x24fd30,function(_0x40739a){if(_0x40739a['type']!==_0x18d2('0x42')){var _0x322def={};_0x322def[_0x40739a['name']]={'$like':'%'+_0xcf545d[_0x18d2('0x33')]['filter']+'%'};return _0x322def;}})});}_0x5bc6f2=_['merge']({},_0x5bc6f2,_0xcf545d[_0x18d2('0x43')]);var _0x4d60a6={'where':_0x5bc6f2[_0x18d2('0x3e')]};return db[_0x18d2('0x2e')][_0x18d2('0x44')](_0x4d60a6)[_0x18d2('0x19')](function(_0x4eba10){_0x2517f6['count']=_0x4eba10;if(_0xcf545d[_0x18d2('0x33')][_0x18d2('0x45')]){_0x5bc6f2[_0x18d2('0x46')]=[{'all':!![]}];}return db[_0x18d2('0x2e')][_0x18d2('0x47')](_0x5bc6f2);})[_0x18d2('0x19')](function(_0xfa371e){_0x2517f6[_0x18d2('0x48')]=_0xfa371e;return _0x2517f6;})[_0x18d2('0x19')](respondWithFilteredResult(_0x5cfa0c,_0x5bc6f2))[_0x18d2('0x23')](handleError(_0x5cfa0c,null));};exports[_0x18d2('0x49')]=function(_0xeda433,_0x105892){var _0x459984={'raw':![],'where':{'id':_0xeda433[_0x18d2('0x4a')]['id']}},_0x1c8d19={};_0x1c8d19[_0x18d2('0x32')]=_['keys'](db[_0x18d2('0x2e')]['rawAttributes']);_0x1c8d19[_0x18d2('0x33')]=_[_0x18d2('0x34')](_0xeda433[_0x18d2('0x33')]);_0x1c8d19[_0x18d2('0x35')]=_['intersection'](_0x1c8d19[_0x18d2('0x32')],_0x1c8d19['query']);_0x459984[_0x18d2('0x38')]=_[_0x18d2('0x36')](_0x1c8d19[_0x18d2('0x32')],qs[_0x18d2('0x37')](_0xeda433[_0x18d2('0x33')]['fields']));_0x459984[_0x18d2('0x38')]=_0x459984[_0x18d2('0x38')]['length']?_0x459984[_0x18d2('0x38')]:_0x1c8d19[_0x18d2('0x32')];if(_0xeda433[_0x18d2('0x33')][_0x18d2('0x45')]){_0x459984['include']=[{'all':!![]}];}_0x459984=_[_0x18d2('0x41')]({},_0x459984,_0xeda433[_0x18d2('0x43')]);return db[_0x18d2('0x2e')]['find'](_0x459984)['then'](handleEntityNotFound(_0x105892,null))[_0x18d2('0x19')](respondWithResult(_0x105892,null))[_0x18d2('0x23')](handleError(_0x105892,null));};exports[_0x18d2('0x4b')]=function(_0x25834d,_0x2b249b){return db[_0x18d2('0x2e')][_0x18d2('0x4b')](_0x25834d[_0x18d2('0x4c')],{})[_0x18d2('0x19')](respondWithResult(_0x2b249b,0xc9))['catch'](handleError(_0x2b249b,null));};exports['update']=function(_0x59bc60,_0x2d82ba){if(_0x59bc60[_0x18d2('0x4c')]['id']){delete _0x59bc60[_0x18d2('0x4c')]['id'];}return db['Dynamics365Configuration'][_0x18d2('0x4d')]({'where':{'id':_0x59bc60[_0x18d2('0x4a')]['id']}})[_0x18d2('0x19')](handleEntityNotFound(_0x2d82ba,null))['then'](saveUpdates(_0x59bc60[_0x18d2('0x4c')],null))[_0x18d2('0x19')](respondWithResult(_0x2d82ba,null))[_0x18d2('0x23')](handleError(_0x2d82ba,null));};exports[_0x18d2('0x4e')]=function(_0x47e761,_0x409186){return db[_0x18d2('0x2e')][_0x18d2('0x4d')]({'where':{'id':_0x47e761['params']['id']}})['then'](handleEntityNotFound(_0x409186,null))[_0x18d2('0x19')](removeEntity(_0x409186,null))[_0x18d2('0x23')](handleError(_0x409186,null));};exports[_0x18d2('0x4f')]=function(_0x44afd,_0xd65d4d,_0x447980){var _0x2dbc0c={};var _0x3405de={};var _0x14df6e;var _0x50d576;return db['Dynamics365Configuration'][_0x18d2('0x50')]({'where':{'id':_0x44afd[_0x18d2('0x4a')]['id']}})[_0x18d2('0x19')](handleEntityNotFound(_0xd65d4d,null))[_0x18d2('0x19')](function(_0x1139fe){if(_0x1139fe){_0x14df6e=_0x1139fe;_0x3405de['model']=_[_0x18d2('0x34')](db[_0x18d2('0x51')]['rawAttributes']);_0x3405de['query']=_[_0x18d2('0x34')](_0x44afd[_0x18d2('0x33')]);_0x3405de[_0x18d2('0x35')]=_[_0x18d2('0x36')](_0x3405de[_0x18d2('0x32')],_0x3405de[_0x18d2('0x33')]);_0x2dbc0c['attributes']=_[_0x18d2('0x36')](_0x3405de[_0x18d2('0x32')],qs['fields'](_0x44afd[_0x18d2('0x33')]['fields']));_0x2dbc0c['attributes']=_0x2dbc0c[_0x18d2('0x38')][_0x18d2('0x39')]?_0x2dbc0c['attributes']:_0x3405de['model'];_0x2dbc0c[_0x18d2('0x3c')]=qs[_0x18d2('0x3d')](_0x44afd[_0x18d2('0x33')][_0x18d2('0x3d')]);_0x2dbc0c[_0x18d2('0x3e')]=qs['filters'](_[_0x18d2('0x3f')](_0x44afd[_0x18d2('0x33')],_0x3405de[_0x18d2('0x35')]));if(_0x44afd[_0x18d2('0x33')]['filter']){_0x2dbc0c[_0x18d2('0x3e')]=_[_0x18d2('0x41')](_0x2dbc0c[_0x18d2('0x3e')],{'$or':_['map'](_0x2dbc0c[_0x18d2('0x38')],function(_0xeb1e92){var _0x2b3b07={};_0x2b3b07[_0xeb1e92]={'$like':'%'+_0x44afd[_0x18d2('0x33')][_0x18d2('0x40')]+'%'};return _0x2b3b07;})});}_0x2dbc0c=_['merge']({},_0x2dbc0c,_0x44afd[_0x18d2('0x43')]);return _0x14df6e[_0x18d2('0x4f')](_0x2dbc0c);}})[_0x18d2('0x19')](function(_0x28a5b4){if(_0x28a5b4){_0x50d576=_0x28a5b4[_0x18d2('0x39')];if(!_0x44afd['query'][_0x18d2('0x52')](_0x18d2('0x3a'))){_0x2dbc0c[_0x18d2('0x3b')]=qs[_0x18d2('0x3b')](_0x44afd[_0x18d2('0x33')]['limit']);_0x2dbc0c[_0x18d2('0x28')]=qs['offset'](_0x44afd['query']['offset']);}return _0x14df6e[_0x18d2('0x4f')](_0x2dbc0c);}})['then'](function(_0x544774){if(_0x544774){return _0x544774?{'count':_0x50d576,'rows':_0x544774}:null;}})['then'](respondWithResult(_0xd65d4d,null))[_0x18d2('0x23')](handleError(_0xd65d4d,null));};exports[_0x18d2('0x53')]=function(_0x5c275e,_0x4edf1e,_0x562bd0){var _0x1b1b7c={};var _0x5734e9={};var _0x3a638c;var _0x985e17;return db[_0x18d2('0x2e')][_0x18d2('0x50')]({'where':{'id':_0x5c275e[_0x18d2('0x4a')]['id']}})[_0x18d2('0x19')](handleEntityNotFound(_0x4edf1e,null))[_0x18d2('0x19')](function(_0x71e5cb){if(_0x71e5cb){_0x3a638c=_0x71e5cb;_0x5734e9['model']=_[_0x18d2('0x34')](db['Dynamics365Field'][_0x18d2('0x2f')]);_0x5734e9[_0x18d2('0x33')]=_[_0x18d2('0x34')](_0x5c275e[_0x18d2('0x33')]);_0x5734e9[_0x18d2('0x35')]=_[_0x18d2('0x36')](_0x5734e9[_0x18d2('0x32')],_0x5734e9[_0x18d2('0x33')]);_0x1b1b7c[_0x18d2('0x38')]=_[_0x18d2('0x36')](_0x5734e9['model'],qs[_0x18d2('0x37')](_0x5c275e[_0x18d2('0x33')][_0x18d2('0x37')]));_0x1b1b7c[_0x18d2('0x38')]=_0x1b1b7c[_0x18d2('0x38')]['length']?_0x1b1b7c[_0x18d2('0x38')]:_0x5734e9['model'];_0x1b1b7c[_0x18d2('0x3c')]=qs[_0x18d2('0x3d')](_0x5c275e['query']['sort']);_0x1b1b7c['where']=qs[_0x18d2('0x35')](_[_0x18d2('0x3f')](_0x5c275e['query'],_0x5734e9[_0x18d2('0x35')]));if(_0x5c275e[_0x18d2('0x33')][_0x18d2('0x40')]){_0x1b1b7c[_0x18d2('0x3e')]=_[_0x18d2('0x41')](_0x1b1b7c[_0x18d2('0x3e')],{'$or':_[_0x18d2('0x2d')](_0x1b1b7c[_0x18d2('0x38')],function(_0x50be6c){var _0x23af9c={};_0x23af9c[_0x50be6c]={'$like':'%'+_0x5c275e[_0x18d2('0x33')]['filter']+'%'};return _0x23af9c;})});}_0x1b1b7c=_[_0x18d2('0x41')]({},_0x1b1b7c,_0x5c275e[_0x18d2('0x43')]);return _0x3a638c['getSubjects'](_0x1b1b7c);}})['then'](function(_0x41ba8c){if(_0x41ba8c){_0x985e17=_0x41ba8c[_0x18d2('0x39')];if(!_0x5c275e['query']['hasOwnProperty'](_0x18d2('0x3a'))){_0x1b1b7c[_0x18d2('0x3b')]=qs['limit'](_0x5c275e[_0x18d2('0x33')][_0x18d2('0x3b')]);_0x1b1b7c[_0x18d2('0x28')]=qs[_0x18d2('0x28')](_0x5c275e[_0x18d2('0x33')][_0x18d2('0x28')]);}return _0x3a638c[_0x18d2('0x53')](_0x1b1b7c);}})['then'](function(_0x13a8d5){if(_0x13a8d5){return _0x13a8d5?{'count':_0x985e17,'rows':_0x13a8d5}:null;}})[_0x18d2('0x19')](respondWithResult(_0x4edf1e,null))[_0x18d2('0x23')](handleError(_0x4edf1e,null));};exports[_0x18d2('0x54')]=function(_0x5ab63d,_0x103532,_0x2831b9){var _0xf217d4={};var _0x4110a2={};var _0x201629;var _0x4fa92a;return db[_0x18d2('0x2e')][_0x18d2('0x50')]({'where':{'id':_0x5ab63d[_0x18d2('0x4a')]['id']}})[_0x18d2('0x19')](handleEntityNotFound(_0x103532,null))[_0x18d2('0x19')](function(_0x464a3a){if(_0x464a3a){_0x201629=_0x464a3a;_0x4110a2[_0x18d2('0x32')]=_['keys'](db[_0x18d2('0x51')][_0x18d2('0x2f')]);_0x4110a2['query']=_['keys'](_0x5ab63d[_0x18d2('0x33')]);_0x4110a2[_0x18d2('0x35')]=_[_0x18d2('0x36')](_0x4110a2[_0x18d2('0x32')],_0x4110a2[_0x18d2('0x33')]);_0xf217d4[_0x18d2('0x38')]=_[_0x18d2('0x36')](_0x4110a2[_0x18d2('0x32')],qs[_0x18d2('0x37')](_0x5ab63d[_0x18d2('0x33')]['fields']));_0xf217d4['attributes']=_0xf217d4[_0x18d2('0x38')]['length']?_0xf217d4['attributes']:_0x4110a2[_0x18d2('0x32')];_0xf217d4['order']=qs['sort'](_0x5ab63d[_0x18d2('0x33')]['sort']);_0xf217d4[_0x18d2('0x3e')]=qs['filters'](_[_0x18d2('0x3f')](_0x5ab63d[_0x18d2('0x33')],_0x4110a2['filters']));if(_0x5ab63d[_0x18d2('0x33')][_0x18d2('0x40')]){_0xf217d4[_0x18d2('0x3e')]=_[_0x18d2('0x41')](_0xf217d4[_0x18d2('0x3e')],{'$or':_[_0x18d2('0x2d')](_0xf217d4[_0x18d2('0x38')],function(_0x46ad05){var _0x387c41={};_0x387c41[_0x46ad05]={'$like':'%'+_0x5ab63d['query'][_0x18d2('0x40')]+'%'};return _0x387c41;})});}_0xf217d4=_[_0x18d2('0x41')]({},_0xf217d4,_0x5ab63d[_0x18d2('0x43')]);return _0x201629[_0x18d2('0x54')](_0xf217d4);}})[_0x18d2('0x19')](function(_0x1bfbce){if(_0x1bfbce){_0x4fa92a=_0x1bfbce[_0x18d2('0x39')];if(!_0x5ab63d[_0x18d2('0x33')][_0x18d2('0x52')](_0x18d2('0x3a'))){_0xf217d4['limit']=qs['limit'](_0x5ab63d[_0x18d2('0x33')][_0x18d2('0x3b')]);_0xf217d4[_0x18d2('0x28')]=qs['offset'](_0x5ab63d[_0x18d2('0x33')][_0x18d2('0x28')]);}return _0x201629['getDescriptions'](_0xf217d4);}})[_0x18d2('0x19')](function(_0x14cffb){if(_0x14cffb){return _0x14cffb?{'count':_0x4fa92a,'rows':_0x14cffb}:null;}})[_0x18d2('0x19')](respondWithResult(_0x103532,null))[_0x18d2('0x23')](handleError(_0x103532,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 108904f..44d71c9 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 _0x138b=['Dynamics365Configuration','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0xa79afb,_0x4fc78f){var _0x33ccb8=function(_0x2b3751){while(--_0x2b3751){_0xa79afb['push'](_0xa79afb['shift']());}};_0x33ccb8(++_0x4fc78f);}(_0x138b,0x156));var _0xb138=function(_0x52d5cc,_0x39098b){_0x52d5cc=_0x52d5cc-0x0;var _0x218387=_0x138b[_0x52d5cc];return _0x218387;};'use strict';var _=require('lodash');var util=require(_0xb138('0x0'));var logger=require(_0xb138('0x1'))(_0xb138('0x2'));var moment=require(_0xb138('0x3'));var BPromise=require(_0xb138('0x4'));var rp=require(_0xb138('0x5'));var fs=require('fs');var path=require(_0xb138('0x6'));var rimraf=require(_0xb138('0x7'));var config=require('../../config/environment');var attributes=require('./intDynamics365Configuration.attributes');module[_0xb138('0x8')]=function(_0x943669,_0x1f0775){return _0x943669[_0xb138('0x9')](_0xb138('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6b0=['util','../../config/logger','api','moment','bluebird','request-promise','exports','define','Dynamics365Configuration','lodash'];(function(_0xdb4ffe,_0x5f0de7){var _0xb3119a=function(_0x383b6a){while(--_0x383b6a){_0xdb4ffe['push'](_0xdb4ffe['shift']());}};_0xb3119a(++_0x5f0de7);}(_0xa6b0,0xb3));var _0x0a6b=function(_0x32239e,_0x1c153e){_0x32239e=_0x32239e-0x0;var _0x4ac4bb=_0xa6b0[_0x32239e];return _0x4ac4bb;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var logger=require(_0x0a6b('0x2'))(_0x0a6b('0x3'));var moment=require(_0x0a6b('0x4'));var BPromise=require(_0x0a6b('0x5'));var rp=require(_0x0a6b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDynamics365Configuration.attributes');module[_0x0a6b('0x7')]=function(_0x3f47c9,_0x547158){return _0x3f47c9[_0x0a6b('0x8')](_0x0a6b('0x9'),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 bfb0b4d..ccc3d90 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 _0xb4d3=['client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x470068,_0x866eea){var _0x3790c9=function(_0x535aa6){while(--_0x535aa6){_0x470068['push'](_0x470068['shift']());}};_0x3790c9(++_0x866eea);}(_0xb4d3,0x1d9));var _0x3b4d=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xb4d3[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x3b4d('0x0'));var util=require(_0x3b4d('0x1'));var moment=require(_0x3b4d('0x2'));var BPromise=require(_0x3b4d('0x3'));var rs=require(_0x3b4d('0x4'));var fs=require('fs');var Redis=require(_0x3b4d('0x5'));var db=require(_0x3b4d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b4d('0x7'))(_0x3b4d('0x8'));var config=require(_0x3b4d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3b4d('0xa')][_0x3b4d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x562450,_0x10cfac,_0x3afee2){return new BPromise(function(_0x13a08c,_0xbbb68e){return client['request'](_0x562450,_0x3afee2)[_0x3b4d('0xc')](function(_0x2c4321){logger[_0x3b4d('0xd')](_0x3b4d('0xe'),_0x10cfac,_0x3b4d('0xf'));logger['debug'](_0x3b4d('0x10'),_0x10cfac,_0x3b4d('0xf'),JSON[_0x3b4d('0x11')](_0x2c4321));if(_0x2c4321[_0x3b4d('0x12')]){if(_0x2c4321[_0x3b4d('0x12')]['code']===0x1f4){logger[_0x3b4d('0x12')](_0x3b4d('0xe'),_0x10cfac,_0x2c4321['error'][_0x3b4d('0x13')]);return _0xbbb68e(_0x2c4321[_0x3b4d('0x12')][_0x3b4d('0x13')]);}logger[_0x3b4d('0x12')](_0x3b4d('0xe'),_0x10cfac,_0x2c4321['error'][_0x3b4d('0x13')]);return _0x13a08c(_0x2c4321[_0x3b4d('0x12')][_0x3b4d('0x13')]);}else{logger[_0x3b4d('0xd')](_0x3b4d('0xe'),_0x10cfac,_0x3b4d('0xf'));_0x13a08c(_0x2c4321[_0x3b4d('0x14')][_0x3b4d('0x13')]);}})['catch'](function(_0x3faaaa){logger['error'](_0x3b4d('0xe'),_0x10cfac,_0x3faaaa);_0xbbb68e(_0x3faaaa);});});} \ No newline at end of file +var _0x201b=['client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x5ec634,_0xa835b9){var _0x5b94a9=function(_0x3a720e){while(--_0x3a720e){_0x5ec634['push'](_0x5ec634['shift']());}};_0x5b94a9(++_0xa835b9);}(_0x201b,0xf5));var _0xb201=function(_0x5b5ff0,_0x449d4c){_0x5b5ff0=_0x5b5ff0-0x0;var _0x3a80f6=_0x201b[_0x5b5ff0];return _0x3a80f6;};'use strict';var _=require('lodash');var util=require(_0xb201('0x0'));var moment=require(_0xb201('0x1'));var BPromise=require(_0xb201('0x2'));var rs=require(_0xb201('0x3'));var fs=require('fs');var Redis=require(_0xb201('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb201('0x5'))(_0xb201('0x6'));var config=require(_0xb201('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb201('0x8')][_0xb201('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33ae57,_0x426e5e,_0x552943){return new BPromise(function(_0x4bb787,_0x58a67f){return client[_0xb201('0xa')](_0x33ae57,_0x552943)[_0xb201('0xb')](function(_0x5c1f2f){logger['info'](_0xb201('0xc'),_0x426e5e,_0xb201('0xd'));logger[_0xb201('0xe')](_0xb201('0xf'),_0x426e5e,_0xb201('0xd'),JSON[_0xb201('0x10')](_0x5c1f2f));if(_0x5c1f2f['error']){if(_0x5c1f2f[_0xb201('0x11')][_0xb201('0x12')]===0x1f4){logger[_0xb201('0x11')](_0xb201('0xc'),_0x426e5e,_0x5c1f2f[_0xb201('0x11')][_0xb201('0x13')]);return _0x58a67f(_0x5c1f2f[_0xb201('0x11')][_0xb201('0x13')]);}logger[_0xb201('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x426e5e,_0x5c1f2f['error'][_0xb201('0x13')]);return _0x4bb787(_0x5c1f2f[_0xb201('0x11')][_0xb201('0x13')]);}else{logger[_0xb201('0x14')](_0xb201('0xc'),_0x426e5e,_0xb201('0xd'));_0x4bb787(_0x5c1f2f[_0xb201('0x15')][_0xb201('0x13')]);}})[_0xb201('0x16')](function(_0xd4ea12){logger[_0xb201('0x11')](_0xb201('0xc'),_0x426e5e,_0xd4ea12);_0x58a67f(_0xd4ea12);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 67eea66..3be054b 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 _0xeffd=['../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4e7844,_0x30ce77){var _0x336119=function(_0x508b1c){while(--_0x508b1c){_0x4e7844['push'](_0x4e7844['shift']());}};_0x336119(++_0x30ce77);}(_0xeffd,0x6b));var _0xdeff=function(_0x3d1d3d,_0x19ff27){_0x3d1d3d=_0x3d1d3d-0x0;var _0x3332fb=_0xeffd[_0x3d1d3d];return _0x3332fb;};'use strict';var multer=require(_0xdeff('0x0'));var util=require('util');var path=require(_0xdeff('0x1'));var timeout=require(_0xdeff('0x2'));var express=require(_0xdeff('0x3'));var router=express[_0xdeff('0x4')]();var auth=require(_0xdeff('0x5'));var interaction=require(_0xdeff('0x6'));var config=require(_0xdeff('0x7'));var controller=require(_0xdeff('0x8'));router[_0xdeff('0x9')]('/',auth[_0xdeff('0xa')](),controller[_0xdeff('0xb')]);router[_0xdeff('0x9')](_0xdeff('0xc'),auth[_0xdeff('0xa')](),controller[_0xdeff('0xd')]);router[_0xdeff('0xe')]('/',auth[_0xdeff('0xa')](),controller['create']);router[_0xdeff('0xf')](_0xdeff('0xc'),auth[_0xdeff('0xa')](),controller['update']);router[_0xdeff('0x10')](_0xdeff('0xc'),auth[_0xdeff('0xa')](),controller[_0xdeff('0x11')]);module[_0xdeff('0x12')]=router; \ No newline at end of file +var _0x0a9a=['get','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index'];(function(_0x57d7b7,_0x166638){var _0xbe368f=function(_0x1842fa){while(--_0x1842fa){_0x57d7b7['push'](_0x57d7b7['shift']());}};_0xbe368f(++_0x166638);}(_0x0a9a,0x183));var _0xa0a9=function(_0x1b5fc3,_0x1dbfa1){_0x1b5fc3=_0x1b5fc3-0x0;var _0x13ab8f=_0x0a9a[_0x1b5fc3];return _0x13ab8f;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var auth=require(_0xa0a9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa0a9('0x5'));var controller=require(_0xa0a9('0x6'));router['get']('/',auth[_0xa0a9('0x7')](),controller[_0xa0a9('0x8')]);router[_0xa0a9('0x9')](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xb')]);router['post']('/',auth[_0xa0a9('0x7')](),controller[_0xa0a9('0xc')]);router[_0xa0a9('0xd')](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xe')]);router[_0xa0a9('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa0a9('0x10')]);module[_0xa0a9('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index d8c2350..5aacd8f 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 _0x402f=['ENUM','customVariable','keyValue','string','STRING','variable','sequelize'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x402f,0x6f));var _0xf402=function(_0x2b8160,_0x28eba3){_0x2b8160=_0x2b8160-0x0;var _0x23b16c=_0x402f[_0x2b8160];return _0x23b16c;};'use strict';var Sequelize=require(_0xf402('0x0'));module['exports']={'type':{'type':Sequelize[_0xf402('0x1')]('string','variable',_0xf402('0x2'),_0xf402('0x3')),'defaultValue':_0xf402('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf402('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xf402('0x4'),_0xf402('0x6'),_0xf402('0x2'))},'keyContent':{'type':Sequelize[_0xf402('0x5')]},'idField':{'type':Sequelize[_0xf402('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf402('0x5')]}}; \ No newline at end of file +var _0x5961=['string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0x5961,0x6f));var _0x1596=function(_0x532112,_0x37d94b){_0x532112=_0x532112-0x0;var _0x23e5fb=_0x5961[_0x532112];return _0x23e5fb;};'use strict';var Sequelize=require(_0x1596('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x1596('0x1'),_0x1596('0x2'),'customVariable',_0x1596('0x3')),'defaultValue':_0x1596('0x1')},'content':{'type':Sequelize[_0x1596('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x1596('0x2'),_0x1596('0x5'))},'keyContent':{'type':Sequelize[_0x1596('0x4')]},'idField':{'type':Sequelize[_0x1596('0x4')]},'nameField':{'type':Sequelize[_0x1596('0x4')]},'customField':{'type':Sequelize[_0x1596('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1596('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 5b3d62d..85aa229 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 _0xf58e=['desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','keys','query','filters','model','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','includeAll','Dynamics365Field','rows','catch','show','params','intersection','length','create','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x1ed291,_0x293be6){var _0x310952=function(_0x190da4){while(--_0x190da4){_0x1ed291['push'](_0x1ed291['shift']());}};_0x310952(++_0x293be6);}(_0xf58e,0xc1));var _0xef58=function(_0x1d53e1,_0x272439){_0x1d53e1=_0x1d53e1-0x0;var _0x39c850=_0xf58e[_0x1d53e1];return _0x39c850;};'use strict';var pdf=require(_0xef58('0x0'));var emlformat=require(_0xef58('0x1'));var rimraf=require(_0xef58('0x2'));var zipdir=require(_0xef58('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef58('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xef58('0x5'));var util=require(_0xef58('0x6'));var path=require(_0xef58('0x7'));var sox=require('sox');var csv=require(_0xef58('0x8'));var ejs=require(_0xef58('0x9'));var fs=require('fs');var _=require(_0xef58('0xa'));var squel=require(_0xef58('0xb'));var crypto=require(_0xef58('0xc'));var jsforce=require(_0xef58('0xd'));var deskjs=require(_0xef58('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef58('0xf'));var Redis=require('ioredis');var authService=require(_0xef58('0x10'));var qs=require(_0xef58('0x11'));var as=require(_0xef58('0x12'));var hardwareService=require(_0xef58('0x13'));var logger=require(_0xef58('0x14'))('api');var utils=require(_0xef58('0x15'));var config=require(_0xef58('0x16'));var licenseUtil=require(_0xef58('0x17'));var db=require(_0xef58('0x18'))['db'];function respondWithStatusCode(_0x340aa3,_0x1596f9){_0x1596f9=_0x1596f9||0xcc;return function(_0x2dddff){if(_0x2dddff){return _0x340aa3[_0xef58('0x19')](_0x1596f9);}return _0x340aa3['status'](_0x1596f9)[_0xef58('0x1a')]();};}function respondWithResult(_0x20599e,_0x13c5ee){_0x13c5ee=_0x13c5ee||0xc8;return function(_0x46233d){if(_0x46233d){return _0x20599e[_0xef58('0x1b')](_0x13c5ee)['json'](_0x46233d);}};}function respondWithFilteredResult(_0x5ad1ea,_0x14eec1){return function(_0x59202d){if(_0x59202d){var _0x1fa3bd=_0x59202d[_0xef58('0x1c')],_0x2d6fe4=_0x14eec1[_0xef58('0x1d')],_0x2e155a=_0x14eec1[_0xef58('0x1d')]+_0x14eec1['limit'],_0x232ebc;if(_0x2e155a>=_0x1fa3bd){_0x2e155a=_0x1fa3bd;_0x232ebc=0xc8;}else{_0x232ebc=0xce;}_0x5ad1ea['status'](_0x232ebc);return _0x5ad1ea['set'](_0xef58('0x1e'),_0x2d6fe4+'-'+_0x2e155a+'/'+_0x1fa3bd)['json'](_0x59202d);}return null;};}function patchUpdates(_0xaecd49){return function(_0x43d405){try{jsonpatch[_0xef58('0x1f')](_0x43d405,_0xaecd49,!![]);}catch(_0x1cbea2){return BPromise[_0xef58('0x20')](_0x1cbea2);}return _0x43d405['save']();};}function saveUpdates(_0x3f6ae7,_0x457aa1){return function(_0xa0dcad){if(_0xa0dcad){return _0xa0dcad[_0xef58('0x21')](_0x3f6ae7)[_0xef58('0x22')](function(_0x47e6d6){return _0x47e6d6;});}return null;};}function removeEntity(_0xabf4c1,_0x4cf4ba){return function(_0x5512c9){if(_0x5512c9){return _0x5512c9[_0xef58('0x23')]()[_0xef58('0x22')](function(){_0xabf4c1[_0xef58('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48211d,_0x101cd3){return function(_0x520f88){if(!_0x520f88){_0x48211d['sendStatus'](0x194);}return _0x520f88;};}function handleError(_0x1cfc48,_0x32ab3c){_0x32ab3c=_0x32ab3c||0x1f4;return function(_0x3ec9d){logger[_0xef58('0x24')](_0x3ec9d[_0xef58('0x25')]);if(_0x3ec9d['name']){delete _0x3ec9d[_0xef58('0x26')];}_0x1cfc48[_0xef58('0x1b')](_0x32ab3c)[_0xef58('0x27')](_0x3ec9d);};}exports[_0xef58('0x28')]=function(_0x1e1c4e,_0x3f640c){var _0x421b4e={},_0x257965={},_0x282182={'count':0x0,'rows':[]};var _0x53c5e7=_[_0xef58('0x29')](db['Dynamics365Field'][_0xef58('0x2a')],function(_0x2748b5){return{'name':_0x2748b5['fieldName'],'type':_0x2748b5['type']['key']};});_0x257965['model']=_['map'](_0x53c5e7,'name');_0x257965['query']=_[_0xef58('0x2b')](_0x1e1c4e[_0xef58('0x2c')]);_0x257965[_0xef58('0x2d')]=_['intersection'](_0x257965[_0xef58('0x2e')],_0x257965[_0xef58('0x2c')]);_0x421b4e[_0xef58('0x2f')]=_['intersection'](_0x257965[_0xef58('0x2e')],qs[_0xef58('0x30')](_0x1e1c4e['query'][_0xef58('0x30')]));_0x421b4e[_0xef58('0x2f')]=_0x421b4e['attributes']['length']?_0x421b4e[_0xef58('0x2f')]:_0x257965[_0xef58('0x2e')];if(!_0x1e1c4e['query'][_0xef58('0x31')]('nolimit')){_0x421b4e[_0xef58('0x32')]=qs[_0xef58('0x32')](_0x1e1c4e['query']['limit']);_0x421b4e[_0xef58('0x1d')]=qs['offset'](_0x1e1c4e['query'][_0xef58('0x1d')]);}_0x421b4e[_0xef58('0x33')]=qs[_0xef58('0x34')](_0x1e1c4e[_0xef58('0x2c')][_0xef58('0x34')]);_0x421b4e[_0xef58('0x35')]=qs[_0xef58('0x2d')](_[_0xef58('0x36')](_0x1e1c4e['query'],_0x257965[_0xef58('0x2d')]),_0x53c5e7);if(_0x1e1c4e[_0xef58('0x2c')][_0xef58('0x37')]){_0x421b4e[_0xef58('0x35')]=_[_0xef58('0x38')](_0x421b4e[_0xef58('0x35')],{'$or':_[_0xef58('0x29')](_0x53c5e7,function(_0x1e88ce){if(_0x1e88ce[_0xef58('0x39')]!=='VIRTUAL'){var _0x3258f6={};_0x3258f6[_0x1e88ce[_0xef58('0x26')]]={'$like':'%'+_0x1e1c4e[_0xef58('0x2c')][_0xef58('0x37')]+'%'};return _0x3258f6;}})});}_0x421b4e=_[_0xef58('0x38')]({},_0x421b4e,_0x1e1c4e['options']);var _0x2ff4ba={'where':_0x421b4e[_0xef58('0x35')]};return db['Dynamics365Field'][_0xef58('0x1c')](_0x2ff4ba)['then'](function(_0x1b2fb2){_0x282182[_0xef58('0x1c')]=_0x1b2fb2;if(_0x1e1c4e[_0xef58('0x2c')][_0xef58('0x3a')]){_0x421b4e['include']=[{'all':!![]}];}return db[_0xef58('0x3b')]['findAll'](_0x421b4e);})[_0xef58('0x22')](function(_0x157d55){_0x282182[_0xef58('0x3c')]=_0x157d55;return _0x282182;})['then'](respondWithFilteredResult(_0x3f640c,_0x421b4e))[_0xef58('0x3d')](handleError(_0x3f640c,null));};exports[_0xef58('0x3e')]=function(_0x1d9a79,_0x5c4597){var _0x165e06={'raw':!![],'where':{'id':_0x1d9a79[_0xef58('0x3f')]['id']}},_0x49c37d={};_0x49c37d[_0xef58('0x2e')]=_[_0xef58('0x2b')](db[_0xef58('0x3b')]['rawAttributes']);_0x49c37d['query']=_[_0xef58('0x2b')](_0x1d9a79[_0xef58('0x2c')]);_0x49c37d[_0xef58('0x2d')]=_['intersection'](_0x49c37d[_0xef58('0x2e')],_0x49c37d['query']);_0x165e06['attributes']=_[_0xef58('0x40')](_0x49c37d[_0xef58('0x2e')],qs[_0xef58('0x30')](_0x1d9a79[_0xef58('0x2c')][_0xef58('0x30')]));_0x165e06[_0xef58('0x2f')]=_0x165e06['attributes'][_0xef58('0x41')]?_0x165e06['attributes']:_0x49c37d['model'];if(_0x1d9a79['query'][_0xef58('0x3a')]){_0x165e06['include']=[{'all':!![]}];}_0x165e06=_[_0xef58('0x38')]({},_0x165e06,_0x1d9a79['options']);return db[_0xef58('0x3b')]['find'](_0x165e06)[_0xef58('0x22')](handleEntityNotFound(_0x5c4597,null))['then'](respondWithResult(_0x5c4597,null))[_0xef58('0x3d')](handleError(_0x5c4597,null));};exports[_0xef58('0x42')]=function(_0x3bbb54,_0x316680){return db[_0xef58('0x3b')]['create'](_0x3bbb54[_0xef58('0x43')],{})[_0xef58('0x22')](respondWithResult(_0x316680,0xc9))[_0xef58('0x3d')](handleError(_0x316680,null));};exports[_0xef58('0x21')]=function(_0x1d2cf2,_0x1637b5){if(_0x1d2cf2[_0xef58('0x43')]['id']){delete _0x1d2cf2[_0xef58('0x43')]['id'];}return db[_0xef58('0x3b')][_0xef58('0x44')]({'where':{'id':_0x1d2cf2[_0xef58('0x3f')]['id']}})[_0xef58('0x22')](handleEntityNotFound(_0x1637b5,null))[_0xef58('0x22')](saveUpdates(_0x1d2cf2[_0xef58('0x43')],null))[_0xef58('0x22')](respondWithResult(_0x1637b5,null))[_0xef58('0x3d')](handleError(_0x1637b5,null));};exports['destroy']=function(_0x709777,_0x3ca67c){return db[_0xef58('0x3b')][_0xef58('0x44')]({'where':{'id':_0x709777[_0xef58('0x3f')]['id']}})[_0xef58('0x22')](handleEntityNotFound(_0x3ca67c,null))[_0xef58('0x22')](removeEntity(_0x3ca67c,null))[_0xef58('0x3d')](handleError(_0x3ca67c,null));}; \ No newline at end of file +var _0xf150=['count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','Dynamics365Field','includeAll','rows','catch','show','params','keys','rawAttributes','include','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x5174f6,_0x378808){var _0x2acf8e=function(_0x292da6){while(--_0x292da6){_0x5174f6['push'](_0x5174f6['shift']());}};_0x2acf8e(++_0x378808);}(_0xf150,0x196));var _0x0f15=function(_0x2f1cf8,_0x3fff4f){_0x2f1cf8=_0x2f1cf8-0x0;var _0x5455d6=_0xf150[_0x2f1cf8];return _0x5455d6;};'use strict';var pdf=require(_0x0f15('0x0'));var emlformat=require(_0x0f15('0x1'));var rimraf=require(_0x0f15('0x2'));var zipdir=require(_0x0f15('0x3'));var jsonpatch=require(_0x0f15('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0f15('0x5'));var Mustache=require(_0x0f15('0x6'));var util=require(_0x0f15('0x7'));var path=require(_0x0f15('0x8'));var sox=require('sox');var csv=require(_0x0f15('0x9'));var ejs=require(_0x0f15('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0f15('0xb'));var crypto=require('crypto');var jsforce=require(_0x0f15('0xc'));var deskjs=require(_0x0f15('0xd'));var toCsv=require(_0x0f15('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0f15('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f15('0xf'));var logger=require(_0x0f15('0x10'))(_0x0f15('0x11'));var utils=require(_0x0f15('0x12'));var config=require(_0x0f15('0x13'));var licenseUtil=require(_0x0f15('0x14'));var db=require(_0x0f15('0x15'))['db'];function respondWithStatusCode(_0x3ae76e,_0x227852){_0x227852=_0x227852||0xcc;return function(_0x1b31c1){if(_0x1b31c1){return _0x3ae76e[_0x0f15('0x16')](_0x227852);}return _0x3ae76e[_0x0f15('0x17')](_0x227852)[_0x0f15('0x18')]();};}function respondWithResult(_0x476769,_0x110269){_0x110269=_0x110269||0xc8;return function(_0x552fae){if(_0x552fae){return _0x476769[_0x0f15('0x17')](_0x110269)[_0x0f15('0x19')](_0x552fae);}};}function respondWithFilteredResult(_0x15e185,_0x5e71dc){return function(_0x11f200){if(_0x11f200){var _0x15b66b=_0x11f200[_0x0f15('0x1a')],_0x4ada0b=_0x5e71dc['offset'],_0x3746ee=_0x5e71dc[_0x0f15('0x1b')]+_0x5e71dc[_0x0f15('0x1c')],_0x308757;if(_0x3746ee>=_0x15b66b){_0x3746ee=_0x15b66b;_0x308757=0xc8;}else{_0x308757=0xce;}_0x15e185['status'](_0x308757);return _0x15e185[_0x0f15('0x1d')](_0x0f15('0x1e'),_0x4ada0b+'-'+_0x3746ee+'/'+_0x15b66b)[_0x0f15('0x19')](_0x11f200);}return null;};}function patchUpdates(_0x508820){return function(_0x2aeaeb){try{jsonpatch[_0x0f15('0x1f')](_0x2aeaeb,_0x508820,!![]);}catch(_0x667a6b){return BPromise[_0x0f15('0x20')](_0x667a6b);}return _0x2aeaeb[_0x0f15('0x21')]();};}function saveUpdates(_0x1a9ce6,_0x3b6df7){return function(_0x44ac86){if(_0x44ac86){return _0x44ac86[_0x0f15('0x22')](_0x1a9ce6)[_0x0f15('0x23')](function(_0x9ce5b3){return _0x9ce5b3;});}return null;};}function removeEntity(_0x23bd29,_0x4b0676){return function(_0xc9f79a){if(_0xc9f79a){return _0xc9f79a[_0x0f15('0x24')]()['then'](function(){_0x23bd29['status'](0xcc)[_0x0f15('0x18')]();});}};}function handleEntityNotFound(_0x5e4784,_0x150e62){return function(_0x213d72){if(!_0x213d72){_0x5e4784[_0x0f15('0x16')](0x194);}return _0x213d72;};}function handleError(_0x2e7fd1,_0x5c6945){_0x5c6945=_0x5c6945||0x1f4;return function(_0x528668){logger[_0x0f15('0x25')](_0x528668[_0x0f15('0x26')]);if(_0x528668[_0x0f15('0x27')]){delete _0x528668[_0x0f15('0x27')];}_0x2e7fd1[_0x0f15('0x17')](_0x5c6945)[_0x0f15('0x28')](_0x528668);};}exports[_0x0f15('0x29')]=function(_0x5c1c97,_0x5e5cec){var _0x35062b={},_0x308329={},_0x124fb6={'count':0x0,'rows':[]};var _0x573e25=_[_0x0f15('0x2a')](db['Dynamics365Field']['rawAttributes'],function(_0x24d0d5){return{'name':_0x24d0d5[_0x0f15('0x2b')],'type':_0x24d0d5[_0x0f15('0x2c')][_0x0f15('0x2d')]};});_0x308329[_0x0f15('0x2e')]=_['map'](_0x573e25,'name');_0x308329[_0x0f15('0x2f')]=_['keys'](_0x5c1c97['query']);_0x308329[_0x0f15('0x30')]=_[_0x0f15('0x31')](_0x308329['model'],_0x308329[_0x0f15('0x2f')]);_0x35062b['attributes']=_[_0x0f15('0x31')](_0x308329[_0x0f15('0x2e')],qs[_0x0f15('0x32')](_0x5c1c97['query'][_0x0f15('0x32')]));_0x35062b['attributes']=_0x35062b[_0x0f15('0x33')][_0x0f15('0x34')]?_0x35062b[_0x0f15('0x33')]:_0x308329[_0x0f15('0x2e')];if(!_0x5c1c97[_0x0f15('0x2f')][_0x0f15('0x35')](_0x0f15('0x36'))){_0x35062b[_0x0f15('0x1c')]=qs[_0x0f15('0x1c')](_0x5c1c97['query'][_0x0f15('0x1c')]);_0x35062b[_0x0f15('0x1b')]=qs[_0x0f15('0x1b')](_0x5c1c97[_0x0f15('0x2f')][_0x0f15('0x1b')]);}_0x35062b['order']=qs['sort'](_0x5c1c97[_0x0f15('0x2f')]['sort']);_0x35062b[_0x0f15('0x37')]=qs['filters'](_[_0x0f15('0x38')](_0x5c1c97[_0x0f15('0x2f')],_0x308329['filters']),_0x573e25);if(_0x5c1c97[_0x0f15('0x2f')][_0x0f15('0x39')]){_0x35062b['where']=_[_0x0f15('0x3a')](_0x35062b[_0x0f15('0x37')],{'$or':_['map'](_0x573e25,function(_0x54a687){if(_0x54a687['type']!==_0x0f15('0x3b')){var _0x397e1d={};_0x397e1d[_0x54a687[_0x0f15('0x27')]]={'$like':'%'+_0x5c1c97[_0x0f15('0x2f')][_0x0f15('0x39')]+'%'};return _0x397e1d;}})});}_0x35062b=_[_0x0f15('0x3a')]({},_0x35062b,_0x5c1c97[_0x0f15('0x3c')]);var _0x3d3bb4={'where':_0x35062b[_0x0f15('0x37')]};return db[_0x0f15('0x3d')]['count'](_0x3d3bb4)[_0x0f15('0x23')](function(_0x4dea56){_0x124fb6[_0x0f15('0x1a')]=_0x4dea56;if(_0x5c1c97[_0x0f15('0x2f')][_0x0f15('0x3e')]){_0x35062b['include']=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x35062b);})[_0x0f15('0x23')](function(_0x5c351c){_0x124fb6[_0x0f15('0x3f')]=_0x5c351c;return _0x124fb6;})[_0x0f15('0x23')](respondWithFilteredResult(_0x5e5cec,_0x35062b))[_0x0f15('0x40')](handleError(_0x5e5cec,null));};exports[_0x0f15('0x41')]=function(_0xc81d34,_0x370a08){var _0x515c76={'raw':!![],'where':{'id':_0xc81d34[_0x0f15('0x42')]['id']}},_0x19ccd2={};_0x19ccd2[_0x0f15('0x2e')]=_[_0x0f15('0x43')](db['Dynamics365Field'][_0x0f15('0x44')]);_0x19ccd2[_0x0f15('0x2f')]=_['keys'](_0xc81d34['query']);_0x19ccd2[_0x0f15('0x30')]=_[_0x0f15('0x31')](_0x19ccd2[_0x0f15('0x2e')],_0x19ccd2[_0x0f15('0x2f')]);_0x515c76[_0x0f15('0x33')]=_[_0x0f15('0x31')](_0x19ccd2[_0x0f15('0x2e')],qs[_0x0f15('0x32')](_0xc81d34['query'][_0x0f15('0x32')]));_0x515c76[_0x0f15('0x33')]=_0x515c76[_0x0f15('0x33')][_0x0f15('0x34')]?_0x515c76['attributes']:_0x19ccd2[_0x0f15('0x2e')];if(_0xc81d34[_0x0f15('0x2f')][_0x0f15('0x3e')]){_0x515c76[_0x0f15('0x45')]=[{'all':!![]}];}_0x515c76=_[_0x0f15('0x3a')]({},_0x515c76,_0xc81d34[_0x0f15('0x3c')]);return db[_0x0f15('0x3d')]['find'](_0x515c76)[_0x0f15('0x23')](handleEntityNotFound(_0x370a08,null))[_0x0f15('0x23')](respondWithResult(_0x370a08,null))[_0x0f15('0x40')](handleError(_0x370a08,null));};exports[_0x0f15('0x46')]=function(_0x156ddd,_0xc5a111){return db[_0x0f15('0x3d')][_0x0f15('0x46')](_0x156ddd[_0x0f15('0x47')],{})[_0x0f15('0x23')](respondWithResult(_0xc5a111,0xc9))['catch'](handleError(_0xc5a111,null));};exports[_0x0f15('0x22')]=function(_0xec5e2a,_0x403e22){if(_0xec5e2a[_0x0f15('0x47')]['id']){delete _0xec5e2a['body']['id'];}return db[_0x0f15('0x3d')]['find']({'where':{'id':_0xec5e2a[_0x0f15('0x42')]['id']}})['then'](handleEntityNotFound(_0x403e22,null))[_0x0f15('0x23')](saveUpdates(_0xec5e2a[_0x0f15('0x47')],null))['then'](respondWithResult(_0x403e22,null))[_0x0f15('0x40')](handleError(_0x403e22,null));};exports[_0x0f15('0x24')]=function(_0x5ef149,_0x5d888a){return db['Dynamics365Field']['find']({'where':{'id':_0x5ef149['params']['id']}})[_0x0f15('0x23')](handleEntityNotFound(_0x5d888a,null))['then'](removeEntity(_0x5d888a,null))[_0x0f15('0x40')](handleError(_0x5d888a,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 4126a0f..916c4ed 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 _0x6643=['../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','lodash','util','api','rimraf'];(function(_0x28b0a4,_0x2ea758){var _0x105ce6=function(_0x6df20f){while(--_0x6df20f){_0x28b0a4['push'](_0x28b0a4['shift']());}};_0x105ce6(++_0x2ea758);}(_0x6643,0x128));var _0x3664=function(_0x2bb6f0,_0xaa3984){_0x2bb6f0=_0x2bb6f0-0x0;var _0x3bc5f5=_0x6643[_0x2bb6f0];return _0x3bc5f5;};'use strict';var _=require(_0x3664('0x0'));var util=require(_0x3664('0x1'));var logger=require('../../config/logger')(_0x3664('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3664('0x3'));var config=require(_0x3664('0x4'));var attributes=require(_0x3664('0x5'));module[_0x3664('0x6')]=function(_0x335476,_0x3a3d6a){return _0x335476[_0x3664('0x7')](_0x3664('0x8'),attributes,{'tableName':_0x3664('0x9'),'paranoid':![],'indexes':[{'name':_0x3664('0xa'),'fields':[_0x3664('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4719=['exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes'];(function(_0x38935d,_0x17154a){var _0x23aa83=function(_0x389b0e){while(--_0x389b0e){_0x38935d['push'](_0x38935d['shift']());}};_0x23aa83(++_0x17154a);}(_0x4719,0x19f));var _0x9471=function(_0x2d7df3,_0x2f8c6f){_0x2d7df3=_0x2d7df3-0x0;var _0x1a9847=_0x4719[_0x2d7df3];return _0x1a9847;};'use strict';var _=require(_0x9471('0x0'));var util=require(_0x9471('0x1'));var logger=require(_0x9471('0x2'))(_0x9471('0x3'));var moment=require(_0x9471('0x4'));var BPromise=require('bluebird');var rp=require(_0x9471('0x5'));var fs=require('fs');var path=require(_0x9471('0x6'));var rimraf=require(_0x9471('0x7'));var config=require(_0x9471('0x8'));var attributes=require(_0x9471('0x9'));module[_0x9471('0xa')]=function(_0x3a7944,_0x31e22a){return _0x3a7944[_0x9471('0xb')](_0x9471('0xc'),attributes,{'tableName':_0x9471('0xd'),'paranoid':![],'indexes':[{'name':_0x9471('0xe'),'fields':[_0x9471('0xf'),_0x9471('0x10')],'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 51caf00..53aa57a 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 _0xfcbe=['http','request','then','info','Dynamics365Field,\x20%s,\x20%s','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfcbe,0x1b1));var _0xefcb=function(_0x3df1d4,_0x4d1662){_0x3df1d4=_0x3df1d4-0x0;var _0x2b7b77=_0xfcbe[_0x3df1d4];return _0x2b7b77;};'use strict';var _=require('lodash');var util=require(_0xefcb('0x0'));var moment=require(_0xefcb('0x1'));var BPromise=require(_0xefcb('0x2'));var rs=require(_0xefcb('0x3'));var fs=require('fs');var Redis=require(_0xefcb('0x4'));var db=require(_0xefcb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xefcb('0x6'))(_0xefcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xefcb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e15ab,_0x4bacb4,_0x4697fe){return new BPromise(function(_0x55cad2,_0x100aa1){return client[_0xefcb('0x9')](_0x4e15ab,_0x4697fe)[_0xefcb('0xa')](function(_0x5dc9cd){logger[_0xefcb('0xb')](_0xefcb('0xc'),_0x4bacb4,'request\x20sent');logger['debug'](_0xefcb('0xd'),_0x4bacb4,_0xefcb('0xe'),JSON[_0xefcb('0xf')](_0x5dc9cd));if(_0x5dc9cd[_0xefcb('0x10')]){if(_0x5dc9cd[_0xefcb('0x10')][_0xefcb('0x11')]===0x1f4){logger['error'](_0xefcb('0xc'),_0x4bacb4,_0x5dc9cd[_0xefcb('0x10')][_0xefcb('0x12')]);return _0x100aa1(_0x5dc9cd[_0xefcb('0x10')][_0xefcb('0x12')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x4bacb4,_0x5dc9cd[_0xefcb('0x10')][_0xefcb('0x12')]);return _0x55cad2(_0x5dc9cd['error'][_0xefcb('0x12')]);}else{logger['info'](_0xefcb('0xc'),_0x4bacb4,'request\x20sent');_0x55cad2(_0x5dc9cd[_0xefcb('0x13')][_0xefcb('0x12')]);}})[_0xefcb('0x14')](function(_0x187f0f){logger[_0xefcb('0x10')](_0xefcb('0xc'),_0x4bacb4,_0x187f0f);_0x100aa1(_0x187f0f);});});} \ No newline at end of file +var _0x16ce=['request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x16ce,0xfb));var _0xe16c=function(_0x4327a8,_0x24c5e1){_0x4327a8=_0x4327a8-0x0;var _0x4dd91e=_0x16ce[_0x4327a8];return _0x4dd91e;};'use strict';var _=require('lodash');var util=require(_0xe16c('0x0'));var moment=require(_0xe16c('0x1'));var BPromise=require(_0xe16c('0x2'));var rs=require(_0xe16c('0x3'));var fs=require('fs');var Redis=require(_0xe16c('0x4'));var db=require(_0xe16c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe16c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe16c('0x7')][_0xe16c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b149c,_0x1cf3f9,_0x1d8b72){return new BPromise(function(_0x14d6d4,_0x37f822){return client[_0xe16c('0x9')](_0x3b149c,_0x1d8b72)['then'](function(_0x30feb4){logger[_0xe16c('0xa')](_0xe16c('0xb'),_0x1cf3f9,_0xe16c('0xc'));logger[_0xe16c('0xd')](_0xe16c('0xe'),_0x1cf3f9,_0xe16c('0xc'),JSON[_0xe16c('0xf')](_0x30feb4));if(_0x30feb4[_0xe16c('0x10')]){if(_0x30feb4[_0xe16c('0x10')][_0xe16c('0x11')]===0x1f4){logger['error'](_0xe16c('0xb'),_0x1cf3f9,_0x30feb4[_0xe16c('0x10')][_0xe16c('0x12')]);return _0x37f822(_0x30feb4[_0xe16c('0x10')]['message']);}logger['error'](_0xe16c('0xb'),_0x1cf3f9,_0x30feb4[_0xe16c('0x10')][_0xe16c('0x12')]);return _0x14d6d4(_0x30feb4[_0xe16c('0x10')]['message']);}else{logger[_0xe16c('0xa')]('Dynamics365Field,\x20%s,\x20%s',_0x1cf3f9,_0xe16c('0xc'));_0x14d6d4(_0x30feb4[_0xe16c('0x13')][_0xe16c('0x12')]);}})['catch'](function(_0x72f37f){logger[_0xe16c('0x10')](_0xe16c('0xb'),_0x1cf3f9,_0x72f37f);_0x37f822(_0x72f37f);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 22c20f1..6b7e49b 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 _0xce7f=['get','isAuthenticated','index','/:id','getFields','post','/:id/configurations','addConfiguration','update','destroy','exports','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller'];(function(_0x3e593b,_0x32bd25){var _0x3f1985=function(_0x178b4a){while(--_0x178b4a){_0x3e593b['push'](_0x3e593b['shift']());}};_0x3f1985(++_0x32bd25);}(_0xce7f,0x192));var _0xfce7=function(_0x2f8805,_0x2f1d21){_0x2f8805=_0x2f8805-0x0;var _0xa16375=_0xce7f[_0x2f8805];return _0xa16375;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfce7('0x0'));var timeout=require('connect-timeout');var express=require(_0xfce7('0x1'));var router=express['Router']();var auth=require(_0xfce7('0x2'));var interaction=require(_0xfce7('0x3'));var config=require(_0xfce7('0x4'));var controller=require(_0xfce7('0x5'));router[_0xfce7('0x6')]('/',auth[_0xfce7('0x7')](),controller[_0xfce7('0x8')]);router[_0xfce7('0x6')](_0xfce7('0x9'),auth[_0xfce7('0x7')](),controller['show']);router['get']('/:id/configurations',auth[_0xfce7('0x7')](),controller['getConfigurations']);router[_0xfce7('0x6')]('/:id/fields',auth[_0xfce7('0x7')](),controller[_0xfce7('0xa')]);router[_0xfce7('0xb')]('/',auth[_0xfce7('0x7')](),controller['create']);router[_0xfce7('0xb')](_0xfce7('0xc'),auth[_0xfce7('0x7')](),controller[_0xfce7('0xd')]);router['put'](_0xfce7('0x9'),auth[_0xfce7('0x7')](),controller[_0xfce7('0xe')]);router['delete'](_0xfce7('0x9'),auth[_0xfce7('0x7')](),controller[_0xfce7('0xf')]);module[_0xfce7('0x10')]=router; \ No newline at end of file +var _0x089c=['Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','/:id','isAuthenticated','get','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x38cd3b,_0x5bd3d3){var _0x47ba81=function(_0x1ff191){while(--_0x1ff191){_0x38cd3b['push'](_0x38cd3b['shift']());}};_0x47ba81(++_0x5bd3d3);}(_0x089c,0x137));var _0xc089=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x089c[_0x119d5a];return _0x15bff4;};'use strict';var multer=require(_0xc089('0x0'));var util=require(_0xc089('0x1'));var path=require('path');var timeout=require(_0xc089('0x2'));var express=require(_0xc089('0x3'));var router=express[_0xc089('0x4')]();var auth=require(_0xc089('0x5'));var interaction=require(_0xc089('0x6'));var config=require('../../config/environment');var controller=require(_0xc089('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc089('0x8'),auth[_0xc089('0x9')](),controller['show']);router[_0xc089('0xa')](_0xc089('0xb'),auth['isAuthenticated'](),controller[_0xc089('0xc')]);router[_0xc089('0xa')](_0xc089('0xd'),auth[_0xc089('0x9')](),controller['getFields']);router[_0xc089('0xe')]('/',auth[_0xc089('0x9')](),controller[_0xc089('0xf')]);router[_0xc089('0xe')]('/:id/configurations',auth[_0xc089('0x9')](),controller[_0xc089('0x10')]);router[_0xc089('0x11')](_0xc089('0x8'),auth['isAuthenticated'](),controller[_0xc089('0x12')]);router[_0xc089('0x13')](_0xc089('0x8'),auth[_0xc089('0x9')](),controller[_0xc089('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index cbec981..a5140dc 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 _0xa2d7=['remoteUri','STRING'];(function(_0x265e5b,_0x311756){var _0x1996a1=function(_0x159448){while(--_0x159448){_0x265e5b['push'](_0x265e5b['shift']());}};_0x1996a1(++_0x311756);}(_0xa2d7,0xfd));var _0x7a2d=function(_0x2a0489,_0x5e0e20){_0x2a0489=_0x2a0489-0x0;var _0x37bc09=_0xa2d7[_0x2a0489];return _0x37bc09;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7a2d('0x0')]},'description':{'type':Sequelize[_0x7a2d('0x0')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x7a2d('0x0')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x7a2d('0x1')},'serverUrl':{'type':Sequelize[_0x7a2d('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x42b3=['sequelize','STRING','username','remoteUri'];(function(_0x5e9689,_0x48e034){var _0x2fac94=function(_0x1e8f97){while(--_0x1e8f97){_0x5e9689['push'](_0x5e9689['shift']());}};_0x2fac94(++_0x48e034);}(_0x42b3,0xf0));var _0x342b=function(_0x2fefdc,_0x8160c9){_0x2fefdc=_0x2fefdc-0x0;var _0xf3823a=_0x42b3[_0x2fefdc];return _0xf3823a;};'use strict';var Sequelize=require(_0x342b('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x342b('0x1')],'unique':_0x342b('0x2')},'apiKey':{'type':Sequelize[_0x342b('0x1')]},'remoteUri':{'type':Sequelize[_0x342b('0x1')],'unique':_0x342b('0x3')},'serverUrl':{'type':Sequelize[_0x342b('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 40985f8..6295b53 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 _0x7b45=['index','map','FreshdeskAccount','rawAttributes','fieldName','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','limit','order','sort','filters','filter','where','merge','type','options','count','includeAll','include','findAll','rows','params','find','create','body','pick','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','slice','substring','lastIndexOf','GET','format','api/v2/ticket_fields','apiKey','toString','requester','agent','description','priority','group','source','ticket_type','company','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','code','error','message','FreshdeskAccount,\x20%s,\x20%s','result','catch','sendStatus','status','offset','Content-Range','json','apply','save','update','destroy','end','stack','name'];(function(_0x2ab3d9,_0x50e716){var _0x210a54=function(_0x24c479){while(--_0x24c479){_0x2ab3d9['push'](_0x2ab3d9['shift']());}};_0x210a54(++_0x50e716);}(_0x7b45,0x143));var _0x57b4=function(_0xfcac94,_0x4f2f94){_0xfcac94=_0xfcac94-0x0;var _0xc039c0=_0x7b45[_0xfcac94];return _0xc039c0;};'use strict';var pdf=require(_0x57b4('0x0'));var emlformat=require(_0x57b4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x57b4('0x2'));var jsonpatch=require(_0x57b4('0x3'));var rp=require(_0x57b4('0x4'));var moment=require('moment');var BPromise=require(_0x57b4('0x5'));var Mustache=require(_0x57b4('0x6'));var util=require(_0x57b4('0x7'));var path=require(_0x57b4('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x57b4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x57b4('0xa'));var crypto=require(_0x57b4('0xb'));var jsforce=require(_0x57b4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x57b4('0xd'));var Papa=require(_0x57b4('0xe'));var Redis=require(_0x57b4('0xf'));var authService=require(_0x57b4('0x10'));var qs=require(_0x57b4('0x11'));var as=require(_0x57b4('0x12'));var hardwareService=require(_0x57b4('0x13'));var logger=require(_0x57b4('0x14'))(_0x57b4('0x15'));var utils=require(_0x57b4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x57b4('0x17'));var db=require(_0x57b4('0x18'))['db'];var integrations=require(_0x57b4('0x19'));var jayson=require(_0x57b4('0x1a'));var client=jayson[_0x57b4('0x1b')][_0x57b4('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x49717b,_0x2fc67e,_0x4d3b49,_0x5659d8){return new BPromise(function(_0x13e228,_0x1e0053){var _0x837400=_0x5659d8||client;return _0x837400[_0x57b4('0x1d')](_0x49717b,_0x4d3b49)[_0x57b4('0x1e')](function(_0x5650ed){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x2fc67e,_0x57b4('0x1f'));logger[_0x57b4('0x20')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2fc67e,_0x57b4('0x1f'),JSON[_0x57b4('0x21')](_0x5650ed));if(_0x5650ed['error']){if(_0x5650ed['error'][_0x57b4('0x22')]===0x1f4){logger[_0x57b4('0x23')]('FreshdeskAccount,\x20%s,\x20%s',_0x2fc67e,_0x5650ed[_0x57b4('0x23')][_0x57b4('0x24')]);return _0x1e0053(_0x5650ed[_0x57b4('0x23')][_0x57b4('0x24')]);}logger[_0x57b4('0x23')]('FreshdeskAccount,\x20%s,\x20%s',_0x2fc67e,_0x5650ed[_0x57b4('0x23')][_0x57b4('0x24')]);return _0x13e228(_0x5650ed['error']['message']);}else{logger['info'](_0x57b4('0x25'),_0x2fc67e,_0x57b4('0x1f'));_0x13e228(_0x5650ed[_0x57b4('0x26')]['message']);}})[_0x57b4('0x27')](function(_0x3d39f0){logger['error'](_0x57b4('0x25'),_0x2fc67e,_0x3d39f0);_0x1e0053(_0x3d39f0);});});}function respondWithStatusCode(_0x8edb19,_0x30a28a){_0x30a28a=_0x30a28a||0xcc;return function(_0x41f089){if(_0x41f089){return _0x8edb19[_0x57b4('0x28')](_0x30a28a);}return _0x8edb19[_0x57b4('0x29')](_0x30a28a)['end']();};}function respondWithResult(_0x4e3259,_0x454f78){_0x454f78=_0x454f78||0xc8;return function(_0x5af618){if(_0x5af618){return _0x4e3259[_0x57b4('0x29')](_0x454f78)['json'](_0x5af618);}};}function respondWithFilteredResult(_0x129f2e,_0x570e1f){return function(_0x52bfd5){if(_0x52bfd5){var _0x245449=_0x52bfd5['count'],_0x19e71b=_0x570e1f[_0x57b4('0x2a')],_0x5a940e=_0x570e1f[_0x57b4('0x2a')]+_0x570e1f['limit'],_0x5e7941;if(_0x5a940e>=_0x245449){_0x5a940e=_0x245449;_0x5e7941=0xc8;}else{_0x5e7941=0xce;}_0x129f2e[_0x57b4('0x29')](_0x5e7941);return _0x129f2e['set'](_0x57b4('0x2b'),_0x19e71b+'-'+_0x5a940e+'/'+_0x245449)[_0x57b4('0x2c')](_0x52bfd5);}return null;};}function patchUpdates(_0x102126){return function(_0x3da50c){try{jsonpatch[_0x57b4('0x2d')](_0x3da50c,_0x102126,!![]);}catch(_0x4d6ab6){return BPromise['reject'](_0x4d6ab6);}return _0x3da50c[_0x57b4('0x2e')]();};}function saveUpdates(_0x2b8bbc,_0x32cc3e){return function(_0x399453){if(_0x399453){return _0x399453[_0x57b4('0x2f')](_0x2b8bbc)[_0x57b4('0x1e')](function(_0x576567){return _0x576567;});}return null;};}function removeEntity(_0x9cdad0,_0x470853){return function(_0x4d80ce){if(_0x4d80ce){return _0x4d80ce[_0x57b4('0x30')]()[_0x57b4('0x1e')](function(){_0x9cdad0['status'](0xcc)[_0x57b4('0x31')]();});}};}function handleEntityNotFound(_0x56678c,_0x3a1827){return function(_0x344cdb){if(!_0x344cdb){_0x56678c['sendStatus'](0x194);}return _0x344cdb;};}function handleError(_0x46b474,_0x993241){_0x993241=_0x993241||0x1f4;return function(_0x2e4185){logger[_0x57b4('0x23')](_0x2e4185[_0x57b4('0x32')]);if(_0x2e4185['name']){delete _0x2e4185[_0x57b4('0x33')];}_0x46b474[_0x57b4('0x29')](_0x993241)['send'](_0x2e4185);};}exports[_0x57b4('0x34')]=function(_0x3f5342,_0x4dd1a3){var _0xda9fa3={},_0x2ea339={},_0x3f93cd={'count':0x0,'rows':[]};var _0x21b525=_[_0x57b4('0x35')](db[_0x57b4('0x36')][_0x57b4('0x37')],function(_0x213620){return{'name':_0x213620[_0x57b4('0x38')],'type':_0x213620['type'][_0x57b4('0x39')]};});_0x2ea339['model']=_[_0x57b4('0x35')](_0x21b525,_0x57b4('0x33'));_0x2ea339[_0x57b4('0x3a')]=_[_0x57b4('0x3b')](_0x3f5342[_0x57b4('0x3a')]);_0x2ea339['filters']=_[_0x57b4('0x3c')](_0x2ea339['model'],_0x2ea339[_0x57b4('0x3a')]);_0xda9fa3[_0x57b4('0x3d')]=_[_0x57b4('0x3c')](_0x2ea339[_0x57b4('0x3e')],qs[_0x57b4('0x3f')](_0x3f5342[_0x57b4('0x3a')][_0x57b4('0x3f')]));_0xda9fa3['attributes']=_0xda9fa3[_0x57b4('0x3d')][_0x57b4('0x40')]?_0xda9fa3[_0x57b4('0x3d')]:_0x2ea339['model'];if(!_0x3f5342[_0x57b4('0x3a')][_0x57b4('0x41')]('nolimit')){_0xda9fa3[_0x57b4('0x42')]=qs[_0x57b4('0x42')](_0x3f5342['query'][_0x57b4('0x42')]);_0xda9fa3['offset']=qs[_0x57b4('0x2a')](_0x3f5342[_0x57b4('0x3a')][_0x57b4('0x2a')]);}_0xda9fa3[_0x57b4('0x43')]=qs[_0x57b4('0x44')](_0x3f5342['query'][_0x57b4('0x44')]);_0xda9fa3['where']=qs[_0x57b4('0x45')](_['pick'](_0x3f5342[_0x57b4('0x3a')],_0x2ea339[_0x57b4('0x45')]),_0x21b525);if(_0x3f5342[_0x57b4('0x3a')][_0x57b4('0x46')]){_0xda9fa3[_0x57b4('0x47')]=_[_0x57b4('0x48')](_0xda9fa3[_0x57b4('0x47')],{'$or':_['map'](_0x21b525,function(_0x3720a2){if(_0x3720a2[_0x57b4('0x49')]!=='VIRTUAL'){var _0x14f0f6={};_0x14f0f6[_0x3720a2[_0x57b4('0x33')]]={'$like':'%'+_0x3f5342[_0x57b4('0x3a')][_0x57b4('0x46')]+'%'};return _0x14f0f6;}})});}_0xda9fa3=_[_0x57b4('0x48')]({},_0xda9fa3,_0x3f5342[_0x57b4('0x4a')]);var _0x4e0e67={'where':_0xda9fa3[_0x57b4('0x47')]};return db[_0x57b4('0x36')]['count'](_0x4e0e67)[_0x57b4('0x1e')](function(_0x3907b1){_0x3f93cd[_0x57b4('0x4b')]=_0x3907b1;if(_0x3f5342[_0x57b4('0x3a')][_0x57b4('0x4c')]){_0xda9fa3[_0x57b4('0x4d')]=[{'all':!![]}];}return db[_0x57b4('0x36')][_0x57b4('0x4e')](_0xda9fa3);})[_0x57b4('0x1e')](function(_0x2d1bb4){_0x3f93cd[_0x57b4('0x4f')]=_0x2d1bb4;return _0x3f93cd;})['then'](respondWithFilteredResult(_0x4dd1a3,_0xda9fa3))[_0x57b4('0x27')](handleError(_0x4dd1a3,null));};exports['show']=function(_0x382445,_0x46b2c2){var _0x595b73={'raw':![],'where':{'id':_0x382445[_0x57b4('0x50')]['id']}},_0x579b4c={};_0x579b4c['model']=_[_0x57b4('0x3b')](db[_0x57b4('0x36')][_0x57b4('0x37')]);_0x579b4c[_0x57b4('0x3a')]=_[_0x57b4('0x3b')](_0x382445[_0x57b4('0x3a')]);_0x579b4c[_0x57b4('0x45')]=_[_0x57b4('0x3c')](_0x579b4c[_0x57b4('0x3e')],_0x579b4c[_0x57b4('0x3a')]);_0x595b73['attributes']=_['intersection'](_0x579b4c[_0x57b4('0x3e')],qs[_0x57b4('0x3f')](_0x382445[_0x57b4('0x3a')][_0x57b4('0x3f')]));_0x595b73[_0x57b4('0x3d')]=_0x595b73[_0x57b4('0x3d')][_0x57b4('0x40')]?_0x595b73[_0x57b4('0x3d')]:_0x579b4c[_0x57b4('0x3e')];if(_0x382445[_0x57b4('0x3a')]['includeAll']){_0x595b73[_0x57b4('0x4d')]=[{'all':!![]}];}_0x595b73=_[_0x57b4('0x48')]({},_0x595b73,_0x382445[_0x57b4('0x4a')]);return db[_0x57b4('0x36')][_0x57b4('0x51')](_0x595b73)[_0x57b4('0x1e')](handleEntityNotFound(_0x46b2c2,null))[_0x57b4('0x1e')](respondWithResult(_0x46b2c2,null))[_0x57b4('0x27')](handleError(_0x46b2c2,null));};exports[_0x57b4('0x52')]=function(_0x3222fc,_0x38826c){return db['FreshdeskAccount']['create'](_0x3222fc[_0x57b4('0x53')],{})['then'](respondWithResult(_0x38826c,0xc9))['catch'](handleError(_0x38826c,null));};exports[_0x57b4('0x2f')]=function(_0x3b2f27,_0x1450c1){if(_0x3b2f27[_0x57b4('0x53')]['id']){delete _0x3b2f27['body']['id'];}return db[_0x57b4('0x36')][_0x57b4('0x51')]({'where':{'id':_0x3b2f27[_0x57b4('0x50')]['id']}})[_0x57b4('0x1e')](handleEntityNotFound(_0x1450c1,null))['then'](saveUpdates(_0x3b2f27[_0x57b4('0x53')],null))['then'](respondWithResult(_0x1450c1,null))[_0x57b4('0x27')](handleError(_0x1450c1,null));};exports[_0x57b4('0x30')]=function(_0x55ba0c,_0x1619f0){return db[_0x57b4('0x36')][_0x57b4('0x51')]({'where':{'id':_0x55ba0c[_0x57b4('0x50')]['id']}})[_0x57b4('0x1e')](handleEntityNotFound(_0x1619f0,null))[_0x57b4('0x1e')](removeEntity(_0x1619f0,null))[_0x57b4('0x27')](handleError(_0x1619f0,null));};exports['getConfigurations']=function(_0x417bfe,_0xc28d98,_0xdb26f2){var _0x254cad={};var _0x14d256={};var _0x34ebfa;var _0x492aef;return db[_0x57b4('0x36')]['findOne']({'where':{'id':_0x417bfe['params']['id']}})[_0x57b4('0x1e')](handleEntityNotFound(_0xc28d98,null))[_0x57b4('0x1e')](function(_0x4fb668){if(_0x4fb668){_0x34ebfa=_0x4fb668;_0x14d256[_0x57b4('0x3e')]=_[_0x57b4('0x3b')](db['FreshdeskConfiguration'][_0x57b4('0x37')]);_0x14d256[_0x57b4('0x3a')]=_[_0x57b4('0x3b')](_0x417bfe[_0x57b4('0x3a')]);_0x14d256[_0x57b4('0x45')]=_['intersection'](_0x14d256[_0x57b4('0x3e')],_0x14d256[_0x57b4('0x3a')]);_0x254cad[_0x57b4('0x3d')]=_[_0x57b4('0x3c')](_0x14d256[_0x57b4('0x3e')],qs[_0x57b4('0x3f')](_0x417bfe[_0x57b4('0x3a')][_0x57b4('0x3f')]));_0x254cad[_0x57b4('0x3d')]=_0x254cad[_0x57b4('0x3d')][_0x57b4('0x40')]?_0x254cad[_0x57b4('0x3d')]:_0x14d256[_0x57b4('0x3e')];_0x254cad['order']=qs[_0x57b4('0x44')](_0x417bfe[_0x57b4('0x3a')][_0x57b4('0x44')]);_0x254cad[_0x57b4('0x47')]=qs['filters'](_[_0x57b4('0x54')](_0x417bfe['query'],_0x14d256[_0x57b4('0x45')]));if(_0x417bfe['query'][_0x57b4('0x46')]){_0x254cad['where']=_[_0x57b4('0x48')](_0x254cad[_0x57b4('0x47')],{'$or':_[_0x57b4('0x35')](_0x254cad[_0x57b4('0x3d')],function(_0x290733){var _0x31a1e3={};_0x31a1e3[_0x290733]={'$like':'%'+_0x417bfe[_0x57b4('0x3a')][_0x57b4('0x46')]+'%'};return _0x31a1e3;})});}_0x254cad=_[_0x57b4('0x48')]({},_0x254cad,_0x417bfe[_0x57b4('0x4a')]);return _0x34ebfa[_0x57b4('0x55')](_0x254cad);}})[_0x57b4('0x1e')](function(_0x148203){if(_0x148203){_0x492aef=_0x148203['length'];if(!_0x417bfe[_0x57b4('0x3a')][_0x57b4('0x41')](_0x57b4('0x56'))){_0x254cad[_0x57b4('0x42')]=qs[_0x57b4('0x42')](_0x417bfe[_0x57b4('0x3a')][_0x57b4('0x42')]);_0x254cad[_0x57b4('0x2a')]=qs[_0x57b4('0x2a')](_0x417bfe[_0x57b4('0x3a')][_0x57b4('0x2a')]);}return _0x34ebfa[_0x57b4('0x55')](_0x254cad);}})[_0x57b4('0x1e')](function(_0x3eccc6){if(_0x3eccc6){return _0x3eccc6?{'count':_0x492aef,'rows':_0x3eccc6}:null;}})[_0x57b4('0x1e')](respondWithResult(_0xc28d98,null))[_0x57b4('0x27')](handleError(_0xc28d98,null));};exports[_0x57b4('0x57')]=function(_0x38378c,_0x6a9dab,_0x226a0c){if(_0x38378c[_0x57b4('0x53')]['id']){delete _0x38378c[_0x57b4('0x53')]['id'];}return db[_0x57b4('0x36')]['findOne']({'where':{'id':_0x38378c[_0x57b4('0x50')]['id']}})['then'](handleEntityNotFound(_0x6a9dab,null))[_0x57b4('0x1e')](function(_0x51c905){if(_0x51c905){_0x38378c['body'][_0x57b4('0x58')]=_0x51c905['id'];_0x38378c[_0x57b4('0x53')][_0x57b4('0x59')]=integrations[_0x57b4('0x5a')](_0x38378c[_0x57b4('0x53')][_0x57b4('0x5b')],_0x38378c[_0x57b4('0x53')][_0x57b4('0x49')]);_0x38378c[_0x57b4('0x53')][_0x57b4('0x5c')]=integrations[_0x57b4('0x5d')](_0x38378c[_0x57b4('0x53')][_0x57b4('0x5b')],_0x38378c['body'][_0x57b4('0x49')]);return db[_0x57b4('0x5e')][_0x57b4('0x52')](_0x38378c[_0x57b4('0x53')],{'include':[{'model':db[_0x57b4('0x5f')],'as':_0x57b4('0x59')},{'model':db[_0x57b4('0x5f')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x6a9dab,null))[_0x57b4('0x27')](handleError(_0x6a9dab,null));};exports[_0x57b4('0x60')]=function(_0x4d6f7f,_0x527ff3,_0x276138){var _0x99ccda='';return db[_0x57b4('0x36')]['findOne']({'where':{'id':_0x4d6f7f[_0x57b4('0x50')]['id']},'attributes':['id','remoteUri','apiKey']})[_0x57b4('0x1e')](handleEntityNotFound(_0x527ff3,null))['then'](function(_0x26c309){if(_0x26c309){_0x99ccda=_0x26c309['remoteUri'];var _0x4843fb=_0x99ccda[_0x57b4('0x61')](-0x1);if(_0x4843fb==='/'){_0x99ccda=_0x99ccda[_0x57b4('0x62')](0x0,_0x99ccda[_0x57b4('0x63')](_0x4843fb));}return rp({'method':_0x57b4('0x64'),'uri':util[_0x57b4('0x65')]('%s/%s',_0x99ccda,_0x57b4('0x66')),'headers':{'Authorization':util[_0x57b4('0x65')]('Basic\x20%s',new Buffer(util[_0x57b4('0x65')]('%s:X',_0x26c309[_0x57b4('0x67')]))[_0x57b4('0x68')]('base64'))},'json':!![]});}})[_0x57b4('0x1e')](function(_0x39aed3){if(_0x39aed3){var _0x280369=[_0x57b4('0x69'),'subject',_0x57b4('0x6a'),_0x57b4('0x6b'),_0x57b4('0x29'),_0x57b4('0x6c'),_0x57b4('0x6d'),_0x57b4('0x6e'),_0x57b4('0x6f'),_0x57b4('0x6d'),_0x57b4('0x70')];_['remove'](_0x39aed3,function(_0x426ceb){return _0x280369[_0x57b4('0x71')](_0x426ceb[_0x57b4('0x33')])||!_0x426ceb[_0x57b4('0x72')]&&_0x426ceb[_0x57b4('0x49')]!==_0x57b4('0x73')&&_0x426ceb[_0x57b4('0x49')]!==_0x57b4('0x74');});return{'count':_0x39aed3[_0x57b4('0x40')],'rows':_[_0x57b4('0x35')](_0x39aed3,function(_0x1b62f7){return{'id':_0x1b62f7[_0x57b4('0x33')],'name':_0x1b62f7[_0x57b4('0x75')],'custom':!_0x1b62f7['default'],'options':_0x1b62f7[_0x57b4('0x76')]?_[_0x57b4('0x35')](_0x1b62f7[_0x57b4('0x76')],function(_0x232ff9){return{'name':_[_0x57b4('0x77')](_0x232ff9),'value':_0x232ff9};}):[]};})};}})[_0x57b4('0x1e')](respondWithResult(_0x527ff3,null))[_0x57b4('0x27')](function(_0x26b883){var _0x1bf7f1=_0x4d6f7f[_0x57b4('0x3a')][_0x57b4('0x78')]?0x1f4:_0x26b883[_0x57b4('0x79')]||0x1f4;logger[_0x57b4('0x23')](_0x57b4('0x7a'),_0x57b4('0x60'),_0x1bf7f1,JSON[_0x57b4('0x21')](_0x26b883));delete _0x26b883['name'];if(_0x1bf7f1===0x191){_0x1bf7f1=0x190;}_0x527ff3[_0x57b4('0x29')](_0x1bf7f1)[_0x57b4('0x7b')](_0x4d6f7f['query'][_0x57b4('0x78')]?{'message':_0x57b4('0x7c'),'statusCode':_0x26b883[_0x57b4('0x79')]}:_0x26b883);});}; \ No newline at end of file +var _0x7a62=['create','body','params','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','findOne','remoteUri','apiKey','slice','lastIndexOf','%s/%s','Basic\x20%s','format','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','company','remove','default','custom_text','custom_dropdown','label','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','find'];(function(_0x40ad50,_0x2f5891){var _0x2ede7d=function(_0x4352a3){while(--_0x4352a3){_0x40ad50['push'](_0x40ad50['shift']());}};_0x2ede7d(++_0x2f5891);}(_0x7a62,0x12f));var _0x27a6=function(_0x5a3b8f,_0x4dda35){_0x5a3b8f=_0x5a3b8f-0x0;var _0x28e198=_0x7a62[_0x5a3b8f];return _0x28e198;};'use strict';var pdf=require(_0x27a6('0x0'));var emlformat=require(_0x27a6('0x1'));var rimraf=require(_0x27a6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x27a6('0x3'));var BPromise=require(_0x27a6('0x4'));var Mustache=require(_0x27a6('0x5'));var util=require(_0x27a6('0x6'));var path=require(_0x27a6('0x7'));var sox=require(_0x27a6('0x8'));var csv=require(_0x27a6('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x27a6('0xa'));var squel=require(_0x27a6('0xb'));var crypto=require(_0x27a6('0xc'));var jsforce=require(_0x27a6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x27a6('0x9'));var querystring=require(_0x27a6('0xe'));var Papa=require(_0x27a6('0xf'));var Redis=require(_0x27a6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x27a6('0x11'));var as=require(_0x27a6('0x12'));var hardwareService=require(_0x27a6('0x13'));var logger=require(_0x27a6('0x14'))('api');var utils=require(_0x27a6('0x15'));var config=require(_0x27a6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x27a6('0x17'))['db'];var integrations=require(_0x27a6('0x18'));var jayson=require(_0x27a6('0x19'));var client=jayson[_0x27a6('0x1a')][_0x27a6('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3a3a8d,_0x3dc4b3,_0x2fac3a,_0x2b4fed){return new BPromise(function(_0x58bc6a,_0x3a5ba1){var _0x383082=_0x2b4fed||client;return _0x383082[_0x27a6('0x1c')](_0x3a3a8d,_0x2fac3a)[_0x27a6('0x1d')](function(_0x1986c0){logger[_0x27a6('0x1e')](_0x27a6('0x1f'),_0x3dc4b3,_0x27a6('0x20'));logger['debug'](_0x27a6('0x21'),_0x3dc4b3,'request\x20sent',JSON[_0x27a6('0x22')](_0x1986c0));if(_0x1986c0[_0x27a6('0x23')]){if(_0x1986c0[_0x27a6('0x23')]['code']===0x1f4){logger[_0x27a6('0x23')](_0x27a6('0x1f'),_0x3dc4b3,_0x1986c0['error'][_0x27a6('0x24')]);return _0x3a5ba1(_0x1986c0['error']['message']);}logger[_0x27a6('0x23')]('FreshdeskAccount,\x20%s,\x20%s',_0x3dc4b3,_0x1986c0['error'][_0x27a6('0x24')]);return _0x58bc6a(_0x1986c0[_0x27a6('0x23')][_0x27a6('0x24')]);}else{logger[_0x27a6('0x1e')](_0x27a6('0x1f'),_0x3dc4b3,'request\x20sent');_0x58bc6a(_0x1986c0['result'][_0x27a6('0x24')]);}})[_0x27a6('0x25')](function(_0x272a1a){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x3dc4b3,_0x272a1a);_0x3a5ba1(_0x272a1a);});});}function respondWithStatusCode(_0xd3b403,_0x363994){_0x363994=_0x363994||0xcc;return function(_0x1cc98a){if(_0x1cc98a){return _0xd3b403[_0x27a6('0x26')](_0x363994);}return _0xd3b403[_0x27a6('0x27')](_0x363994)[_0x27a6('0x28')]();};}function respondWithResult(_0x5f25f4,_0x932feb){_0x932feb=_0x932feb||0xc8;return function(_0x28fd9d){if(_0x28fd9d){return _0x5f25f4[_0x27a6('0x27')](_0x932feb)[_0x27a6('0x29')](_0x28fd9d);}};}function respondWithFilteredResult(_0x36de42,_0x4db7ba){return function(_0x19fa22){if(_0x19fa22){var _0x58786d=_0x19fa22['count'],_0x4ce49f=_0x4db7ba[_0x27a6('0x2a')],_0x2c5e1f=_0x4db7ba[_0x27a6('0x2a')]+_0x4db7ba[_0x27a6('0x2b')],_0x4eef68;if(_0x2c5e1f>=_0x58786d){_0x2c5e1f=_0x58786d;_0x4eef68=0xc8;}else{_0x4eef68=0xce;}_0x36de42[_0x27a6('0x27')](_0x4eef68);return _0x36de42[_0x27a6('0x2c')](_0x27a6('0x2d'),_0x4ce49f+'-'+_0x2c5e1f+'/'+_0x58786d)[_0x27a6('0x29')](_0x19fa22);}return null;};}function patchUpdates(_0x4c8a09){return function(_0x39fcaf){try{jsonpatch[_0x27a6('0x2e')](_0x39fcaf,_0x4c8a09,!![]);}catch(_0x2fd4d6){return BPromise[_0x27a6('0x2f')](_0x2fd4d6);}return _0x39fcaf[_0x27a6('0x30')]();};}function saveUpdates(_0xc8b1a,_0x27321b){return function(_0x47689a){if(_0x47689a){return _0x47689a[_0x27a6('0x31')](_0xc8b1a)[_0x27a6('0x1d')](function(_0x2618c0){return _0x2618c0;});}return null;};}function removeEntity(_0x39d2d2,_0x3c4d85){return function(_0x5298d0){if(_0x5298d0){return _0x5298d0[_0x27a6('0x32')]()[_0x27a6('0x1d')](function(){_0x39d2d2['status'](0xcc)[_0x27a6('0x28')]();});}};}function handleEntityNotFound(_0x93661b,_0x2e4639){return function(_0xbdc149){if(!_0xbdc149){_0x93661b[_0x27a6('0x26')](0x194);}return _0xbdc149;};}function handleError(_0x5aa5de,_0x45593a){_0x45593a=_0x45593a||0x1f4;return function(_0x30d5bf){logger[_0x27a6('0x23')](_0x30d5bf[_0x27a6('0x33')]);if(_0x30d5bf[_0x27a6('0x34')]){delete _0x30d5bf[_0x27a6('0x34')];}_0x5aa5de[_0x27a6('0x27')](_0x45593a)[_0x27a6('0x35')](_0x30d5bf);};}exports['index']=function(_0x34a8f2,_0x5dd4d3){var _0x40a5f0={},_0xd121a7={},_0x376fb1={'count':0x0,'rows':[]};var _0x5bbfc3=_[_0x27a6('0x36')](db[_0x27a6('0x37')][_0x27a6('0x38')],function(_0x332664){return{'name':_0x332664[_0x27a6('0x39')],'type':_0x332664[_0x27a6('0x3a')][_0x27a6('0x3b')]};});_0xd121a7[_0x27a6('0x3c')]=_[_0x27a6('0x36')](_0x5bbfc3,_0x27a6('0x34'));_0xd121a7[_0x27a6('0x3d')]=_[_0x27a6('0x3e')](_0x34a8f2[_0x27a6('0x3d')]);_0xd121a7[_0x27a6('0x3f')]=_[_0x27a6('0x40')](_0xd121a7[_0x27a6('0x3c')],_0xd121a7[_0x27a6('0x3d')]);_0x40a5f0[_0x27a6('0x41')]=_[_0x27a6('0x40')](_0xd121a7[_0x27a6('0x3c')],qs[_0x27a6('0x42')](_0x34a8f2['query'][_0x27a6('0x42')]));_0x40a5f0[_0x27a6('0x41')]=_0x40a5f0[_0x27a6('0x41')][_0x27a6('0x43')]?_0x40a5f0[_0x27a6('0x41')]:_0xd121a7['model'];if(!_0x34a8f2[_0x27a6('0x3d')]['hasOwnProperty'](_0x27a6('0x44'))){_0x40a5f0[_0x27a6('0x2b')]=qs[_0x27a6('0x2b')](_0x34a8f2['query'][_0x27a6('0x2b')]);_0x40a5f0['offset']=qs[_0x27a6('0x2a')](_0x34a8f2['query']['offset']);}_0x40a5f0[_0x27a6('0x45')]=qs[_0x27a6('0x46')](_0x34a8f2[_0x27a6('0x3d')][_0x27a6('0x46')]);_0x40a5f0[_0x27a6('0x47')]=qs[_0x27a6('0x3f')](_[_0x27a6('0x48')](_0x34a8f2['query'],_0xd121a7[_0x27a6('0x3f')]),_0x5bbfc3);if(_0x34a8f2[_0x27a6('0x3d')][_0x27a6('0x49')]){_0x40a5f0['where']=_['merge'](_0x40a5f0[_0x27a6('0x47')],{'$or':_['map'](_0x5bbfc3,function(_0x9a25be){if(_0x9a25be[_0x27a6('0x3a')]!==_0x27a6('0x4a')){var _0x2ae958={};_0x2ae958[_0x9a25be[_0x27a6('0x34')]]={'$like':'%'+_0x34a8f2[_0x27a6('0x3d')]['filter']+'%'};return _0x2ae958;}})});}_0x40a5f0=_[_0x27a6('0x4b')]({},_0x40a5f0,_0x34a8f2[_0x27a6('0x4c')]);var _0x361ab7={'where':_0x40a5f0[_0x27a6('0x47')]};return db[_0x27a6('0x37')][_0x27a6('0x4d')](_0x361ab7)['then'](function(_0x283186){_0x376fb1[_0x27a6('0x4d')]=_0x283186;if(_0x34a8f2['query'][_0x27a6('0x4e')]){_0x40a5f0[_0x27a6('0x4f')]=[{'all':!![]}];}return db[_0x27a6('0x37')][_0x27a6('0x50')](_0x40a5f0);})[_0x27a6('0x1d')](function(_0x2c285e){_0x376fb1[_0x27a6('0x51')]=_0x2c285e;return _0x376fb1;})['then'](respondWithFilteredResult(_0x5dd4d3,_0x40a5f0))[_0x27a6('0x25')](handleError(_0x5dd4d3,null));};exports[_0x27a6('0x52')]=function(_0x3d57fb,_0xa15988){var _0x1b6396={'raw':![],'where':{'id':_0x3d57fb['params']['id']}},_0x30c77e={};_0x30c77e['model']=_['keys'](db[_0x27a6('0x37')]['rawAttributes']);_0x30c77e[_0x27a6('0x3d')]=_['keys'](_0x3d57fb['query']);_0x30c77e[_0x27a6('0x3f')]=_[_0x27a6('0x40')](_0x30c77e[_0x27a6('0x3c')],_0x30c77e[_0x27a6('0x3d')]);_0x1b6396[_0x27a6('0x41')]=_['intersection'](_0x30c77e[_0x27a6('0x3c')],qs['fields'](_0x3d57fb[_0x27a6('0x3d')][_0x27a6('0x42')]));_0x1b6396['attributes']=_0x1b6396[_0x27a6('0x41')][_0x27a6('0x43')]?_0x1b6396['attributes']:_0x30c77e['model'];if(_0x3d57fb[_0x27a6('0x3d')]['includeAll']){_0x1b6396[_0x27a6('0x4f')]=[{'all':!![]}];}_0x1b6396=_['merge']({},_0x1b6396,_0x3d57fb['options']);return db[_0x27a6('0x37')][_0x27a6('0x53')](_0x1b6396)[_0x27a6('0x1d')](handleEntityNotFound(_0xa15988,null))[_0x27a6('0x1d')](respondWithResult(_0xa15988,null))[_0x27a6('0x25')](handleError(_0xa15988,null));};exports[_0x27a6('0x54')]=function(_0x2ebda9,_0x2c8f0a){return db[_0x27a6('0x37')][_0x27a6('0x54')](_0x2ebda9['body'],{})[_0x27a6('0x1d')](respondWithResult(_0x2c8f0a,0xc9))[_0x27a6('0x25')](handleError(_0x2c8f0a,null));};exports[_0x27a6('0x31')]=function(_0x3ac728,_0x27f10b){if(_0x3ac728[_0x27a6('0x55')]['id']){delete _0x3ac728[_0x27a6('0x55')]['id'];}return db[_0x27a6('0x37')][_0x27a6('0x53')]({'where':{'id':_0x3ac728[_0x27a6('0x56')]['id']}})[_0x27a6('0x1d')](handleEntityNotFound(_0x27f10b,null))[_0x27a6('0x1d')](saveUpdates(_0x3ac728['body'],null))['then'](respondWithResult(_0x27f10b,null))[_0x27a6('0x25')](handleError(_0x27f10b,null));};exports['destroy']=function(_0x5c7195,_0x33d173){return db[_0x27a6('0x37')][_0x27a6('0x53')]({'where':{'id':_0x5c7195[_0x27a6('0x56')]['id']}})[_0x27a6('0x1d')](handleEntityNotFound(_0x33d173,null))['then'](removeEntity(_0x33d173,null))[_0x27a6('0x25')](handleError(_0x33d173,null));};exports['getConfigurations']=function(_0x54af7b,_0x4611ce,_0x43d867){var _0x19aeea={};var _0x5e5ed0={};var _0x44f38f;var _0x469b6f;return db[_0x27a6('0x37')]['findOne']({'where':{'id':_0x54af7b['params']['id']}})['then'](handleEntityNotFound(_0x4611ce,null))[_0x27a6('0x1d')](function(_0x564bd5){if(_0x564bd5){_0x44f38f=_0x564bd5;_0x5e5ed0['model']=_[_0x27a6('0x3e')](db['FreshdeskConfiguration'][_0x27a6('0x38')]);_0x5e5ed0[_0x27a6('0x3d')]=_['keys'](_0x54af7b[_0x27a6('0x3d')]);_0x5e5ed0[_0x27a6('0x3f')]=_[_0x27a6('0x40')](_0x5e5ed0[_0x27a6('0x3c')],_0x5e5ed0['query']);_0x19aeea[_0x27a6('0x41')]=_[_0x27a6('0x40')](_0x5e5ed0[_0x27a6('0x3c')],qs['fields'](_0x54af7b[_0x27a6('0x3d')]['fields']));_0x19aeea[_0x27a6('0x41')]=_0x19aeea[_0x27a6('0x41')][_0x27a6('0x43')]?_0x19aeea[_0x27a6('0x41')]:_0x5e5ed0[_0x27a6('0x3c')];_0x19aeea[_0x27a6('0x45')]=qs['sort'](_0x54af7b[_0x27a6('0x3d')][_0x27a6('0x46')]);_0x19aeea['where']=qs[_0x27a6('0x3f')](_[_0x27a6('0x48')](_0x54af7b[_0x27a6('0x3d')],_0x5e5ed0['filters']));if(_0x54af7b[_0x27a6('0x3d')][_0x27a6('0x49')]){_0x19aeea[_0x27a6('0x47')]=_[_0x27a6('0x4b')](_0x19aeea[_0x27a6('0x47')],{'$or':_[_0x27a6('0x36')](_0x19aeea[_0x27a6('0x41')],function(_0xbdf342){var _0xfffc19={};_0xfffc19[_0xbdf342]={'$like':'%'+_0x54af7b[_0x27a6('0x3d')][_0x27a6('0x49')]+'%'};return _0xfffc19;})});}_0x19aeea=_[_0x27a6('0x4b')]({},_0x19aeea,_0x54af7b['options']);return _0x44f38f[_0x27a6('0x57')](_0x19aeea);}})[_0x27a6('0x1d')](function(_0x1930d7){if(_0x1930d7){_0x469b6f=_0x1930d7[_0x27a6('0x43')];if(!_0x54af7b['query'][_0x27a6('0x58')](_0x27a6('0x44'))){_0x19aeea[_0x27a6('0x2b')]=qs['limit'](_0x54af7b[_0x27a6('0x3d')][_0x27a6('0x2b')]);_0x19aeea[_0x27a6('0x2a')]=qs[_0x27a6('0x2a')](_0x54af7b[_0x27a6('0x3d')][_0x27a6('0x2a')]);}return _0x44f38f[_0x27a6('0x57')](_0x19aeea);}})['then'](function(_0x150143){if(_0x150143){return _0x150143?{'count':_0x469b6f,'rows':_0x150143}:null;}})[_0x27a6('0x1d')](respondWithResult(_0x4611ce,null))[_0x27a6('0x25')](handleError(_0x4611ce,null));};exports[_0x27a6('0x59')]=function(_0xd5cbf3,_0x4e4818,_0x4538a7){if(_0xd5cbf3[_0x27a6('0x55')]['id']){delete _0xd5cbf3[_0x27a6('0x55')]['id'];}return db[_0x27a6('0x37')]['findOne']({'where':{'id':_0xd5cbf3[_0x27a6('0x56')]['id']}})['then'](handleEntityNotFound(_0x4e4818,null))[_0x27a6('0x1d')](function(_0x493f44){if(_0x493f44){_0xd5cbf3[_0x27a6('0x55')][_0x27a6('0x5a')]=_0x493f44['id'];_0xd5cbf3[_0x27a6('0x55')][_0x27a6('0x5b')]=integrations[_0x27a6('0x5c')](_0xd5cbf3[_0x27a6('0x55')][_0x27a6('0x5d')],_0xd5cbf3[_0x27a6('0x55')][_0x27a6('0x3a')]);_0xd5cbf3['body'][_0x27a6('0x5e')]=integrations[_0x27a6('0x5f')](_0xd5cbf3[_0x27a6('0x55')]['channel'],_0xd5cbf3[_0x27a6('0x55')][_0x27a6('0x3a')]);return db[_0x27a6('0x60')]['create'](_0xd5cbf3[_0x27a6('0x55')],{'include':[{'model':db['FreshdeskField'],'as':_0x27a6('0x5b')},{'model':db[_0x27a6('0x61')],'as':_0x27a6('0x5e')}]});}return null;})[_0x27a6('0x1d')](respondWithResult(_0x4e4818,null))[_0x27a6('0x25')](handleError(_0x4e4818,null));};exports[_0x27a6('0x62')]=function(_0x244540,_0x1204f5,_0x2c0b35){var _0x404cb9='';return db['FreshdeskAccount'][_0x27a6('0x63')]({'where':{'id':_0x244540[_0x27a6('0x56')]['id']},'attributes':['id',_0x27a6('0x64'),_0x27a6('0x65')]})[_0x27a6('0x1d')](handleEntityNotFound(_0x1204f5,null))[_0x27a6('0x1d')](function(_0x2a5b72){if(_0x2a5b72){_0x404cb9=_0x2a5b72[_0x27a6('0x64')];var _0x4a8222=_0x404cb9[_0x27a6('0x66')](-0x1);if(_0x4a8222==='/'){_0x404cb9=_0x404cb9['substring'](0x0,_0x404cb9[_0x27a6('0x67')](_0x4a8222));}return rp({'method':'GET','uri':util['format'](_0x27a6('0x68'),_0x404cb9,'api/v2/ticket_fields'),'headers':{'Authorization':util['format'](_0x27a6('0x69'),new Buffer(util[_0x27a6('0x6a')](_0x27a6('0x6b'),_0x2a5b72[_0x27a6('0x65')]))[_0x27a6('0x6c')](_0x27a6('0x6d')))},'json':!![]});}})[_0x27a6('0x1d')](function(_0x34b624){if(_0x34b624){var _0x49aabf=[_0x27a6('0x6e'),_0x27a6('0x6f'),_0x27a6('0x70'),_0x27a6('0x71'),_0x27a6('0x27'),_0x27a6('0x72'),_0x27a6('0x73'),_0x27a6('0x74'),_0x27a6('0x75'),_0x27a6('0x73'),_0x27a6('0x76')];_[_0x27a6('0x77')](_0x34b624,function(_0x11f624){return _0x49aabf['includes'](_0x11f624[_0x27a6('0x34')])||!_0x11f624[_0x27a6('0x78')]&&_0x11f624[_0x27a6('0x3a')]!==_0x27a6('0x79')&&_0x11f624['type']!==_0x27a6('0x7a');});return{'count':_0x34b624['length'],'rows':_[_0x27a6('0x36')](_0x34b624,function(_0x4b40ee){return{'id':_0x4b40ee[_0x27a6('0x34')],'name':_0x4b40ee[_0x27a6('0x7b')],'custom':!_0x4b40ee['default'],'options':_0x4b40ee[_0x27a6('0x7c')]?_[_0x27a6('0x36')](_0x4b40ee[_0x27a6('0x7c')],function(_0x343045){return{'name':_['capitalize'](_0x343045),'value':_0x343045};}):[]};})};}})[_0x27a6('0x1d')](respondWithResult(_0x1204f5,null))[_0x27a6('0x25')](function(_0x1f86fe){var _0x33933a=_0x244540[_0x27a6('0x3d')]['test']?0x1f4:_0x1f86fe[_0x27a6('0x7d')]||0x1f4;logger[_0x27a6('0x23')](_0x27a6('0x7e'),_0x27a6('0x62'),_0x33933a,JSON[_0x27a6('0x22')](_0x1f86fe));delete _0x1f86fe['name'];if(_0x33933a===0x191){_0x33933a=0x190;}_0x1204f5[_0x27a6('0x27')](_0x33933a)[_0x27a6('0x35')](_0x244540['query'][_0x27a6('0x7f')]?{'message':_0x27a6('0x80'),'statusCode':_0x1f86fe['statusCode']}:_0x1f86fe);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index c02ae44..c20bf6f 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 _0xfd09=['../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x5cba0e,_0x4fb1a6){var _0x5e1e19=function(_0x76779c){while(--_0x76779c){_0x5cba0e['push'](_0x5cba0e['shift']());}};_0x5e1e19(++_0x4fb1a6);}(_0xfd09,0x1a8));var _0x9fd0=function(_0xc14e9b,_0x5c3047){_0xc14e9b=_0xc14e9b-0x0;var _0x48f298=_0xfd09[_0xc14e9b];return _0x48f298;};'use strict';var _=require(_0x9fd0('0x0'));var util=require(_0x9fd0('0x1'));var logger=require(_0x9fd0('0x2'))('api');var moment=require(_0x9fd0('0x3'));var BPromise=require(_0x9fd0('0x4'));var rp=require(_0x9fd0('0x5'));var fs=require('fs');var path=require(_0x9fd0('0x6'));var rimraf=require(_0x9fd0('0x7'));var config=require(_0x9fd0('0x8'));var attributes=require(_0x9fd0('0x9'));var integrations=require(_0x9fd0('0xa'));module[_0x9fd0('0xb')]=function(_0x14d6b7,_0x3fb521){return _0x14d6b7['define'](_0x9fd0('0xc'),attributes,{'tableName':_0x9fd0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfec7=['int_freshdesk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define'];(function(_0x374f00,_0x56045c){var _0x58abd6=function(_0x1a929b){while(--_0x1a929b){_0x374f00['push'](_0x374f00['shift']());}};_0x58abd6(++_0x56045c);}(_0xfec7,0x11f));var _0x7fec=function(_0x4ecc0f,_0x13afbf){_0x4ecc0f=_0x4ecc0f-0x0;var _0x2bc271=_0xfec7[_0x4ecc0f];return _0x2bc271;};'use strict';var _=require(_0x7fec('0x0'));var util=require('util');var logger=require(_0x7fec('0x1'))(_0x7fec('0x2'));var moment=require(_0x7fec('0x3'));var BPromise=require(_0x7fec('0x4'));var rp=require(_0x7fec('0x5'));var fs=require('fs');var path=require(_0x7fec('0x6'));var rimraf=require(_0x7fec('0x7'));var config=require(_0x7fec('0x8'));var attributes=require(_0x7fec('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x7fec('0xa')]=function(_0x216ec6,_0x1899ff){return _0x216ec6[_0x7fec('0xb')]('FreshdeskAccount',attributes,{'tableName':_0x7fec('0xc'),'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 97fc7ca..2128673 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 _0x597b=['jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','where','attributes','limit','map','model','include','stringify','ShowFreshdeskAccount','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x10b327,_0xf5d3cd){var _0x35e25e=function(_0x488d79){while(--_0x488d79){_0x10b327['push'](_0x10b327['shift']());}};_0x35e25e(++_0xf5d3cd);}(_0x597b,0x15e));var _0xb597=function(_0x152a1d,_0x13fd35){_0x152a1d=_0x152a1d-0x0;var _0x14ca9c=_0x597b[_0x152a1d];return _0x14ca9c;};'use strict';var _=require(_0xb597('0x0'));var util=require(_0xb597('0x1'));var moment=require(_0xb597('0x2'));var BPromise=require(_0xb597('0x3'));var rs=require(_0xb597('0x4'));var fs=require('fs');var Redis=require(_0xb597('0x5'));var db=require(_0xb597('0x6'))['db'];var utils=require(_0xb597('0x7'));var logger=require(_0xb597('0x8'))('rpc');var config=require(_0xb597('0x9'));var jayson=require(_0xb597('0xa'));var client=jayson[_0xb597('0xb')][_0xb597('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x183e89,_0x5ef2e2,_0x5c5723){return new BPromise(function(_0x5abdfc,_0x2474a6){return client[_0xb597('0xd')](_0x183e89,_0x5c5723)['then'](function(_0x186838){logger[_0xb597('0xe')](_0xb597('0xf'),_0x5ef2e2,_0xb597('0x10'));logger[_0xb597('0x11')](_0xb597('0x12'),_0x5ef2e2,_0xb597('0x10'),JSON['stringify'](_0x186838));if(_0x186838['error']){if(_0x186838['error']['code']===0x1f4){logger[_0xb597('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x5ef2e2,_0x186838[_0xb597('0x13')]['message']);return _0x2474a6(_0x186838[_0xb597('0x13')][_0xb597('0x14')]);}logger[_0xb597('0x13')](_0xb597('0xf'),_0x5ef2e2,_0x186838[_0xb597('0x13')][_0xb597('0x14')]);return _0x5abdfc(_0x186838[_0xb597('0x13')]['message']);}else{logger[_0xb597('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x5ef2e2,_0xb597('0x10'));_0x5abdfc(_0x186838[_0xb597('0x15')]['message']);}})[_0xb597('0x16')](function(_0x4956ee){logger['error'](_0xb597('0xf'),_0x5ef2e2,_0x4956ee);_0x2474a6(_0x4956ee);});});}exports[_0xb597('0x17')]=function(_0x40985f){var _0x2cd43c=this;return new Promise(function(_0x5e9f56,_0x191fd5){return db[_0xb597('0x18')]['findAll']({'raw':_0x40985f['options']?_0x40985f['options']['raw']===undefined?!![]:![]:!![],'where':_0x40985f['options']?_0x40985f[_0xb597('0x19')][_0xb597('0x1a')]||null:null,'attributes':_0x40985f[_0xb597('0x19')]?_0x40985f[_0xb597('0x19')][_0xb597('0x1b')]||null:null,'limit':_0x40985f[_0xb597('0x19')]?_0x40985f[_0xb597('0x19')][_0xb597('0x1c')]||null:null,'include':_0x40985f[_0xb597('0x19')]?_0x40985f[_0xb597('0x19')]['include']?_[_0xb597('0x1d')](_0x40985f[_0xb597('0x19')]['include'],function(_0x131332){return{'model':db[_0x131332[_0xb597('0x1e')]],'as':_0x131332['as'],'attributes':_0x131332['attributes'],'include':_0x131332[_0xb597('0x1f')]?_[_0xb597('0x1d')](_0x131332[_0xb597('0x1f')],function(_0x41bca8){return{'model':db[_0x41bca8['model']],'as':_0x41bca8['as'],'attributes':_0x41bca8[_0xb597('0x1b')],'include':_0x41bca8[_0xb597('0x1f')]?_[_0xb597('0x1d')](_0x41bca8[_0xb597('0x1f')],function(_0x2209be){return{'model':db[_0x2209be[_0xb597('0x1e')]],'as':_0x2209be['as'],'attributes':_0x2209be['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d9dae){logger[_0xb597('0xe')](_0xb597('0x17'),_0x40985f);logger[_0xb597('0x11')](_0xb597('0x17'),_0x40985f,JSON[_0xb597('0x20')](_0x4d9dae));_0x5e9f56(_0x4d9dae);})[_0xb597('0x16')](function(_0x43072d){logger['error'](_0xb597('0x17'),_0x43072d[_0xb597('0x14')],_0x40985f);_0x191fd5(_0x2cd43c[_0xb597('0x13')](0x1f4,_0x43072d[_0xb597('0x14')]));});});};exports[_0xb597('0x21')]=function(_0x3ebb9a){var _0x19a83a=this;return new Promise(function(_0x176967,_0xa26643){return db['FreshdeskAccount'][_0xb597('0x22')]({'raw':_0x3ebb9a['options']?_0x3ebb9a[_0xb597('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3ebb9a[_0xb597('0x19')]?_0x3ebb9a[_0xb597('0x19')][_0xb597('0x1a')]||null:null,'attributes':_0x3ebb9a[_0xb597('0x19')]?_0x3ebb9a[_0xb597('0x19')][_0xb597('0x1b')]||null:null,'include':_0x3ebb9a[_0xb597('0x19')]?_0x3ebb9a[_0xb597('0x19')][_0xb597('0x1f')]?_[_0xb597('0x1d')](_0x3ebb9a[_0xb597('0x19')][_0xb597('0x1f')],function(_0x1b3e05){return{'model':db[_0x1b3e05['model']],'as':_0x1b3e05['as'],'attributes':_0x1b3e05['attributes'],'include':_0x1b3e05[_0xb597('0x1f')]?_['map'](_0x1b3e05[_0xb597('0x1f')],function(_0x182548){return{'model':db[_0x182548['model']],'as':_0x182548['as'],'attributes':_0x182548[_0xb597('0x1b')],'include':_0x182548['include']?_[_0xb597('0x1d')](_0x182548[_0xb597('0x1f')],function(_0x34ffd4){return{'model':db[_0x34ffd4['model']],'as':_0x34ffd4['as'],'attributes':_0x34ffd4[_0xb597('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb597('0x23')](function(_0x4e2e0a){logger[_0xb597('0xe')]('ShowFreshdeskAccount',_0x3ebb9a);logger[_0xb597('0x11')](_0xb597('0x21'),_0x3ebb9a,JSON[_0xb597('0x20')](_0x4e2e0a));_0x176967(_0x4e2e0a);})[_0xb597('0x16')](function(_0x30916a){logger['error']('ShowFreshdeskAccount',_0x30916a[_0xb597('0x14')],_0x3ebb9a);_0xa26643(_0x19a83a['error'](0x1f4,_0x30916a[_0xb597('0x14')]));});});}; \ No newline at end of file +var _0xaa79=['FreshdeskAccount','options','raw','where','limit','include','model','attributes','map','ShowFreshdeskAccount','find','lodash','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshdeskAccount'];(function(_0x21481c,_0x1b51ba){var _0x5dd77a=function(_0x4ee13c){while(--_0x4ee13c){_0x21481c['push'](_0x21481c['shift']());}};_0x5dd77a(++_0x1b51ba);}(_0xaa79,0xf2));var _0x9aa7=function(_0xc71df4,_0x4e1435){_0xc71df4=_0xc71df4-0x0;var _0x203e52=_0xaa79[_0xc71df4];return _0x203e52;};'use strict';var _=require(_0x9aa7('0x0'));var util=require('util');var moment=require(_0x9aa7('0x1'));var BPromise=require(_0x9aa7('0x2'));var rs=require(_0x9aa7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9aa7('0x4'));var logger=require('../../config/logger')(_0x9aa7('0x5'));var config=require('../../config/environment');var jayson=require(_0x9aa7('0x6'));var client=jayson['client'][_0x9aa7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3acf9b,_0x38abda,_0x7b6cb){return new BPromise(function(_0x1e2ff6,_0x41308d){return client[_0x9aa7('0x8')](_0x3acf9b,_0x7b6cb)[_0x9aa7('0x9')](function(_0x3d3657){logger[_0x9aa7('0xa')](_0x9aa7('0xb'),_0x38abda,_0x9aa7('0xc'));logger[_0x9aa7('0xd')](_0x9aa7('0xe'),_0x38abda,_0x9aa7('0xc'),JSON[_0x9aa7('0xf')](_0x3d3657));if(_0x3d3657[_0x9aa7('0x10')]){if(_0x3d3657[_0x9aa7('0x10')][_0x9aa7('0x11')]===0x1f4){logger[_0x9aa7('0x10')](_0x9aa7('0xb'),_0x38abda,_0x3d3657['error'][_0x9aa7('0x12')]);return _0x41308d(_0x3d3657[_0x9aa7('0x10')][_0x9aa7('0x12')]);}logger[_0x9aa7('0x10')](_0x9aa7('0xb'),_0x38abda,_0x3d3657[_0x9aa7('0x10')][_0x9aa7('0x12')]);return _0x1e2ff6(_0x3d3657[_0x9aa7('0x10')][_0x9aa7('0x12')]);}else{logger[_0x9aa7('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x38abda,_0x9aa7('0xc'));_0x1e2ff6(_0x3d3657[_0x9aa7('0x13')][_0x9aa7('0x12')]);}})[_0x9aa7('0x14')](function(_0x590da7){logger[_0x9aa7('0x10')](_0x9aa7('0xb'),_0x38abda,_0x590da7);_0x41308d(_0x590da7);});});}exports[_0x9aa7('0x15')]=function(_0x2fc7bf){var _0x4420ed=this;return new Promise(function(_0x350c6a,_0x26a9a2){return db[_0x9aa7('0x16')]['findAll']({'raw':_0x2fc7bf[_0x9aa7('0x17')]?_0x2fc7bf[_0x9aa7('0x17')][_0x9aa7('0x18')]===undefined?!![]:![]:!![],'where':_0x2fc7bf['options']?_0x2fc7bf[_0x9aa7('0x17')][_0x9aa7('0x19')]||null:null,'attributes':_0x2fc7bf[_0x9aa7('0x17')]?_0x2fc7bf[_0x9aa7('0x17')]['attributes']||null:null,'limit':_0x2fc7bf[_0x9aa7('0x17')]?_0x2fc7bf[_0x9aa7('0x17')][_0x9aa7('0x1a')]||null:null,'include':_0x2fc7bf['options']?_0x2fc7bf[_0x9aa7('0x17')][_0x9aa7('0x1b')]?_['map'](_0x2fc7bf[_0x9aa7('0x17')][_0x9aa7('0x1b')],function(_0x5e1788){return{'model':db[_0x5e1788[_0x9aa7('0x1c')]],'as':_0x5e1788['as'],'attributes':_0x5e1788['attributes'],'include':_0x5e1788[_0x9aa7('0x1b')]?_['map'](_0x5e1788[_0x9aa7('0x1b')],function(_0x516409){return{'model':db[_0x516409[_0x9aa7('0x1c')]],'as':_0x516409['as'],'attributes':_0x516409[_0x9aa7('0x1d')],'include':_0x516409['include']?_[_0x9aa7('0x1e')](_0x516409[_0x9aa7('0x1b')],function(_0x3a18c9){return{'model':db[_0x3a18c9['model']],'as':_0x3a18c9['as'],'attributes':_0x3a18c9[_0x9aa7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9aa7('0x9')](function(_0x1f8c38){logger['info'](_0x9aa7('0x15'),_0x2fc7bf);logger[_0x9aa7('0xd')]('GetFreshdeskAccount',_0x2fc7bf,JSON[_0x9aa7('0xf')](_0x1f8c38));_0x350c6a(_0x1f8c38);})[_0x9aa7('0x14')](function(_0xd6290e){logger['error'](_0x9aa7('0x15'),_0xd6290e[_0x9aa7('0x12')],_0x2fc7bf);_0x26a9a2(_0x4420ed[_0x9aa7('0x10')](0x1f4,_0xd6290e['message']));});});};exports[_0x9aa7('0x1f')]=function(_0x424da9){var _0x438154=this;return new Promise(function(_0x178177,_0x4d8a8e){return db[_0x9aa7('0x16')][_0x9aa7('0x20')]({'raw':_0x424da9['options']?_0x424da9[_0x9aa7('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x424da9[_0x9aa7('0x17')]?_0x424da9['options']['where']||null:null,'attributes':_0x424da9[_0x9aa7('0x17')]?_0x424da9[_0x9aa7('0x17')][_0x9aa7('0x1d')]||null:null,'include':_0x424da9[_0x9aa7('0x17')]?_0x424da9[_0x9aa7('0x17')]['include']?_[_0x9aa7('0x1e')](_0x424da9[_0x9aa7('0x17')][_0x9aa7('0x1b')],function(_0x4fbc08){return{'model':db[_0x4fbc08[_0x9aa7('0x1c')]],'as':_0x4fbc08['as'],'attributes':_0x4fbc08[_0x9aa7('0x1d')],'include':_0x4fbc08[_0x9aa7('0x1b')]?_['map'](_0x4fbc08[_0x9aa7('0x1b')],function(_0x1b06e2){return{'model':db[_0x1b06e2[_0x9aa7('0x1c')]],'as':_0x1b06e2['as'],'attributes':_0x1b06e2['attributes'],'include':_0x1b06e2['include']?_[_0x9aa7('0x1e')](_0x1b06e2['include'],function(_0x5403e5){return{'model':db[_0x5403e5[_0x9aa7('0x1c')]],'as':_0x5403e5['as'],'attributes':_0x5403e5[_0x9aa7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9aa7('0x9')](function(_0x230d76){logger['info'](_0x9aa7('0x1f'),_0x424da9);logger[_0x9aa7('0xd')](_0x9aa7('0x1f'),_0x424da9,JSON[_0x9aa7('0xf')](_0x230d76));_0x178177(_0x230d76);})[_0x9aa7('0x14')](function(_0x4ad6f0){logger[_0x9aa7('0x10')](_0x9aa7('0x1f'),_0x4ad6f0[_0x9aa7('0x12')],_0x424da9);_0x4d8a8e(_0x438154['error'](0x1f4,_0x4ad6f0[_0x9aa7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index d652f44..2aa9ed3 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 _0x10c1=['setTags','delete','/:id','destroy','exports','multer','path','express','Router','../../components/auth/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getTags','post','/:id/tags'];(function(_0x249cda,_0x18af9f){var _0x1dcf43=function(_0x318b32){while(--_0x318b32){_0x249cda['push'](_0x249cda['shift']());}};_0x1dcf43(++_0x18af9f);}(_0x10c1,0x89));var _0x110c=function(_0x3bf63f,_0x44eeb1){_0x3bf63f=_0x3bf63f-0x0;var _0x30ae46=_0x10c1[_0x3bf63f];return _0x30ae46;};'use strict';var multer=require(_0x110c('0x0'));var util=require('util');var path=require(_0x110c('0x1'));var timeout=require('connect-timeout');var express=require(_0x110c('0x2'));var router=express[_0x110c('0x3')]();var auth=require(_0x110c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x110c('0x5'));router[_0x110c('0x6')]('/',auth[_0x110c('0x7')](),controller[_0x110c('0x8')]);router[_0x110c('0x6')]('/:id',auth[_0x110c('0x7')](),controller['show']);router[_0x110c('0x6')](_0x110c('0x9'),auth[_0x110c('0x7')](),controller[_0x110c('0xa')]);router['get'](_0x110c('0xb'),auth['isAuthenticated'](),controller[_0x110c('0xc')]);router['get'](_0x110c('0xd'),auth[_0x110c('0x7')](),controller['getDescriptions']);router[_0x110c('0x6')]('/:id/tags',auth[_0x110c('0x7')](),controller[_0x110c('0xe')]);router[_0x110c('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x110c('0xf')](_0x110c('0x10'),auth[_0x110c('0x7')](),controller[_0x110c('0x11')]);router['put']('/:id',auth[_0x110c('0x7')](),controller['update']);router[_0x110c('0x12')](_0x110c('0x13'),auth[_0x110c('0x7')](),controller[_0x110c('0x14')]);module[_0x110c('0x15')]=router; \ No newline at end of file +var _0x71b0=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','/:id','show','isAuthenticated','/:id/subjects'];(function(_0x2c1f11,_0x23338e){var _0x1d81d1=function(_0x2ff9f1){while(--_0x2ff9f1){_0x2c1f11['push'](_0x2c1f11['shift']());}};_0x1d81d1(++_0x23338e);}(_0x71b0,0x19c));var _0x071b=function(_0x234472,_0x1e08bd){_0x234472=_0x234472-0x0;var _0x4144aa=_0x71b0[_0x234472];return _0x4144aa;};'use strict';var multer=require(_0x071b('0x0'));var util=require(_0x071b('0x1'));var path=require(_0x071b('0x2'));var timeout=require(_0x071b('0x3'));var express=require(_0x071b('0x4'));var router=express[_0x071b('0x5')]();var auth=require(_0x071b('0x6'));var interaction=require(_0x071b('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x071b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x071b('0x8')](_0x071b('0x9'),auth['isAuthenticated'](),controller[_0x071b('0xa')]);router[_0x071b('0x8')]('/:id/fields',auth[_0x071b('0xb')](),controller['getFields']);router[_0x071b('0x8')](_0x071b('0xc'),auth[_0x071b('0xb')](),controller[_0x071b('0xd')]);router[_0x071b('0x8')](_0x071b('0xe'),auth[_0x071b('0xb')](),controller[_0x071b('0xf')]);router[_0x071b('0x8')]('/:id/tags',auth[_0x071b('0xb')](),controller[_0x071b('0x10')]);router[_0x071b('0x11')]('/',auth['isAuthenticated'](),controller[_0x071b('0x12')]);router[_0x071b('0x11')](_0x071b('0x13'),auth[_0x071b('0xb')](),controller['setTags']);router[_0x071b('0x14')](_0x071b('0x9'),auth['isAuthenticated'](),controller[_0x071b('0x15')]);router[_0x071b('0x16')](_0x071b('0x9'),auth['isAuthenticated'](),controller[_0x071b('0x17')]);module[_0x071b('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 418d900..2d6bf3e 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 _0x9e5e=['exports','STRING','sequelize'];(function(_0x56a616,_0x5a3c7c){var _0xe94844=function(_0x1d3816){while(--_0x1d3816){_0x56a616['push'](_0x56a616['shift']());}};_0xe94844(++_0x5a3c7c);}(_0x9e5e,0x10d));var _0xe9e5=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x9e5e[_0xfa634c];return _0x73e478;};'use strict';var Sequelize=require(_0xe9e5('0x0'));module[_0xe9e5('0x1')]={'name':{'type':Sequelize[_0xe9e5('0x2')]},'description':{'type':Sequelize[_0xe9e5('0x2')]}}; \ No newline at end of file +var _0x6d14=['exports','sequelize'];(function(_0x293a20,_0x2537e3){var _0x3c84f9=function(_0x2e52e4){while(--_0x2e52e4){_0x293a20['push'](_0x293a20['shift']());}};_0x3c84f9(++_0x2537e3);}(_0x6d14,0x83));var _0x46d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d14[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x46d1('0x0'));module[_0x46d1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 3dd47a7..f38f6d3 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 _0x8693=['intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','findOne','hasOwnProperty','getSubjects','FreshdeskField','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','request','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x5e2489,_0x2fd8be){var _0xa87596=function(_0x3b348d){while(--_0x3b348d){_0x5e2489['push'](_0x5e2489['shift']());}};_0xa87596(++_0x2fd8be);}(_0x8693,0x1a7));var _0x3869=function(_0x529487,_0x3b67aa){_0x529487=_0x529487-0x0;var _0x754a97=_0x8693[_0x529487];return _0x754a97;};'use strict';var pdf=require(_0x3869('0x0'));var emlformat=require(_0x3869('0x1'));var rimraf=require(_0x3869('0x2'));var zipdir=require(_0x3869('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3869('0x4'));var moment=require(_0x3869('0x5'));var BPromise=require(_0x3869('0x6'));var Mustache=require(_0x3869('0x7'));var util=require(_0x3869('0x8'));var path=require(_0x3869('0x9'));var sox=require(_0x3869('0xa'));var csv=require(_0x3869('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3869('0xc'));var crypto=require('crypto');var jsforce=require(_0x3869('0xd'));var deskjs=require(_0x3869('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3869('0xf'));var Papa=require(_0x3869('0x10'));var Redis=require(_0x3869('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3869('0x12'));var as=require(_0x3869('0x13'));var hardwareService=require(_0x3869('0x14'));var logger=require(_0x3869('0x15'))(_0x3869('0x16'));var utils=require(_0x3869('0x17'));var config=require(_0x3869('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3869('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x3869('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4c8011,_0xb06b1c,_0x6fbc4b,_0x5415c6){return new BPromise(function(_0x1ab9f6,_0xfe593a){var _0x138b4a=_0x5415c6||client;return _0x138b4a[_0x3869('0x1b')](_0x4c8011,_0x6fbc4b)['then'](function(_0x15d08a){logger['info'](_0x3869('0x1c'),_0xb06b1c,_0x3869('0x1d'));logger[_0x3869('0x1e')](_0x3869('0x1f'),_0xb06b1c,_0x3869('0x1d'),JSON[_0x3869('0x20')](_0x15d08a));if(_0x15d08a[_0x3869('0x21')]){if(_0x15d08a[_0x3869('0x21')]['code']===0x1f4){logger[_0x3869('0x21')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xb06b1c,_0x15d08a[_0x3869('0x21')][_0x3869('0x22')]);return _0xfe593a(_0x15d08a[_0x3869('0x21')][_0x3869('0x22')]);}logger['error'](_0x3869('0x1c'),_0xb06b1c,_0x15d08a['error']['message']);return _0x1ab9f6(_0x15d08a[_0x3869('0x21')][_0x3869('0x22')]);}else{logger[_0x3869('0x23')](_0x3869('0x1c'),_0xb06b1c,'request\x20sent');_0x1ab9f6(_0x15d08a[_0x3869('0x24')][_0x3869('0x22')]);}})[_0x3869('0x25')](function(_0x69c267){logger[_0x3869('0x21')](_0x3869('0x1c'),_0xb06b1c,_0x69c267);_0xfe593a(_0x69c267);});});}function respondWithStatusCode(_0x39025f,_0x5521ea){_0x5521ea=_0x5521ea||0xcc;return function(_0xaa207e){if(_0xaa207e){return _0x39025f[_0x3869('0x26')](_0x5521ea);}return _0x39025f[_0x3869('0x27')](_0x5521ea)[_0x3869('0x28')]();};}function respondWithResult(_0x48b460,_0x2a6342){_0x2a6342=_0x2a6342||0xc8;return function(_0x1a9a4f){if(_0x1a9a4f){return _0x48b460[_0x3869('0x27')](_0x2a6342)['json'](_0x1a9a4f);}};}function respondWithFilteredResult(_0x410aae,_0x27200b){return function(_0x7481fe){if(_0x7481fe){var _0x24b8b4=_0x7481fe[_0x3869('0x29')],_0x210ae7=_0x27200b[_0x3869('0x2a')],_0x45a106=_0x27200b['offset']+_0x27200b[_0x3869('0x2b')],_0x5c4a89;if(_0x45a106>=_0x24b8b4){_0x45a106=_0x24b8b4;_0x5c4a89=0xc8;}else{_0x5c4a89=0xce;}_0x410aae[_0x3869('0x27')](_0x5c4a89);return _0x410aae[_0x3869('0x2c')](_0x3869('0x2d'),_0x210ae7+'-'+_0x45a106+'/'+_0x24b8b4)[_0x3869('0x2e')](_0x7481fe);}return null;};}function patchUpdates(_0x18ad31){return function(_0x5af609){try{jsonpatch[_0x3869('0x2f')](_0x5af609,_0x18ad31,!![]);}catch(_0x1490be){return BPromise[_0x3869('0x30')](_0x1490be);}return _0x5af609[_0x3869('0x31')]();};}function saveUpdates(_0x134445,_0x5806a9){return function(_0x4ad96d){if(_0x4ad96d){return _0x4ad96d[_0x3869('0x32')](_0x134445)[_0x3869('0x33')](function(_0x4a656b){return _0x4a656b;});}return null;};}function removeEntity(_0x1b478c,_0x4c01b4){return function(_0x2c536e){if(_0x2c536e){return _0x2c536e[_0x3869('0x34')]()['then'](function(){_0x1b478c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x594118,_0x4adf8f){return function(_0x5c3523){if(!_0x5c3523){_0x594118[_0x3869('0x26')](0x194);}return _0x5c3523;};}function handleError(_0x4deda0,_0x508b6c){_0x508b6c=_0x508b6c||0x1f4;return function(_0x21d1aa){logger['error'](_0x21d1aa[_0x3869('0x35')]);if(_0x21d1aa[_0x3869('0x36')]){delete _0x21d1aa[_0x3869('0x36')];}_0x4deda0['status'](_0x508b6c)[_0x3869('0x37')](_0x21d1aa);};}exports[_0x3869('0x38')]=function(_0x3618db,_0x54e27c){var _0x3fa200={},_0x2fb586={},_0x1b6231={'count':0x0,'rows':[]};var _0x525c19=_[_0x3869('0x39')](db[_0x3869('0x3a')][_0x3869('0x3b')],function(_0x420368){return{'name':_0x420368[_0x3869('0x3c')],'type':_0x420368[_0x3869('0x3d')][_0x3869('0x3e')]};});_0x2fb586[_0x3869('0x3f')]=_['map'](_0x525c19,_0x3869('0x36'));_0x2fb586[_0x3869('0x40')]=_[_0x3869('0x41')](_0x3618db[_0x3869('0x40')]);_0x2fb586[_0x3869('0x42')]=_[_0x3869('0x43')](_0x2fb586[_0x3869('0x3f')],_0x2fb586[_0x3869('0x40')]);_0x3fa200[_0x3869('0x44')]=_[_0x3869('0x43')](_0x2fb586[_0x3869('0x3f')],qs[_0x3869('0x45')](_0x3618db[_0x3869('0x40')][_0x3869('0x45')]));_0x3fa200[_0x3869('0x44')]=_0x3fa200[_0x3869('0x44')][_0x3869('0x46')]?_0x3fa200[_0x3869('0x44')]:_0x2fb586['model'];if(!_0x3618db[_0x3869('0x40')]['hasOwnProperty'](_0x3869('0x47'))){_0x3fa200['limit']=qs['limit'](_0x3618db[_0x3869('0x40')][_0x3869('0x2b')]);_0x3fa200[_0x3869('0x2a')]=qs[_0x3869('0x2a')](_0x3618db[_0x3869('0x40')][_0x3869('0x2a')]);}_0x3fa200[_0x3869('0x48')]=qs[_0x3869('0x49')](_0x3618db[_0x3869('0x40')]['sort']);_0x3fa200[_0x3869('0x4a')]=qs[_0x3869('0x42')](_[_0x3869('0x4b')](_0x3618db[_0x3869('0x40')],_0x2fb586[_0x3869('0x42')]),_0x525c19);if(_0x3618db[_0x3869('0x40')][_0x3869('0x4c')]){_0x3fa200[_0x3869('0x4a')]=_[_0x3869('0x4d')](_0x3fa200['where'],{'$or':_['map'](_0x525c19,function(_0x3b430c){if(_0x3b430c[_0x3869('0x3d')]!==_0x3869('0x4e')){var _0x244eb6={};_0x244eb6[_0x3b430c[_0x3869('0x36')]]={'$like':'%'+_0x3618db[_0x3869('0x40')][_0x3869('0x4c')]+'%'};return _0x244eb6;}})});}_0x3fa200=_[_0x3869('0x4d')]({},_0x3fa200,_0x3618db[_0x3869('0x4f')]);var _0x1ed0ec={'where':_0x3fa200[_0x3869('0x4a')]};return db['FreshdeskConfiguration']['count'](_0x1ed0ec)[_0x3869('0x33')](function(_0x43030c){_0x1b6231['count']=_0x43030c;if(_0x3618db[_0x3869('0x40')][_0x3869('0x50')]){_0x3fa200[_0x3869('0x51')]=[{'all':!![]}];}return db[_0x3869('0x3a')][_0x3869('0x52')](_0x3fa200);})[_0x3869('0x33')](function(_0x2edfe3){_0x1b6231[_0x3869('0x53')]=_0x2edfe3;return _0x1b6231;})[_0x3869('0x33')](respondWithFilteredResult(_0x54e27c,_0x3fa200))['catch'](handleError(_0x54e27c,null));};exports[_0x3869('0x54')]=function(_0x1db2cd,_0x2f0147){var _0x117768={'raw':![],'where':{'id':_0x1db2cd[_0x3869('0x55')]['id']}},_0x6eff9b={};_0x6eff9b[_0x3869('0x3f')]=_[_0x3869('0x41')](db[_0x3869('0x3a')][_0x3869('0x3b')]);_0x6eff9b[_0x3869('0x40')]=_[_0x3869('0x41')](_0x1db2cd[_0x3869('0x40')]);_0x6eff9b[_0x3869('0x42')]=_[_0x3869('0x43')](_0x6eff9b[_0x3869('0x3f')],_0x6eff9b['query']);_0x117768[_0x3869('0x44')]=_[_0x3869('0x43')](_0x6eff9b[_0x3869('0x3f')],qs['fields'](_0x1db2cd[_0x3869('0x40')][_0x3869('0x45')]));_0x117768[_0x3869('0x44')]=_0x117768[_0x3869('0x44')][_0x3869('0x46')]?_0x117768[_0x3869('0x44')]:_0x6eff9b[_0x3869('0x3f')];if(_0x1db2cd[_0x3869('0x40')][_0x3869('0x50')]){_0x117768[_0x3869('0x51')]=[{'all':!![]}];}_0x117768=_['merge']({},_0x117768,_0x1db2cd[_0x3869('0x4f')]);return db[_0x3869('0x3a')][_0x3869('0x56')](_0x117768)[_0x3869('0x33')](handleEntityNotFound(_0x2f0147,null))['then'](respondWithResult(_0x2f0147,null))[_0x3869('0x25')](handleError(_0x2f0147,null));};exports[_0x3869('0x57')]=function(_0x5e662b,_0x3b7d2d){return db[_0x3869('0x3a')][_0x3869('0x57')](_0x5e662b[_0x3869('0x58')],{})[_0x3869('0x33')](respondWithResult(_0x3b7d2d,0xc9))[_0x3869('0x25')](handleError(_0x3b7d2d,null));};exports[_0x3869('0x32')]=function(_0x24bd4d,_0x513d5d){if(_0x24bd4d['body']['id']){delete _0x24bd4d[_0x3869('0x58')]['id'];}return db[_0x3869('0x3a')][_0x3869('0x56')]({'where':{'id':_0x24bd4d[_0x3869('0x55')]['id']}})['then'](handleEntityNotFound(_0x513d5d,null))[_0x3869('0x33')](saveUpdates(_0x24bd4d[_0x3869('0x58')],null))[_0x3869('0x33')](respondWithResult(_0x513d5d,null))['catch'](handleError(_0x513d5d,null));};exports['destroy']=function(_0x256e78,_0x1b58e7){return db[_0x3869('0x3a')][_0x3869('0x56')]({'where':{'id':_0x256e78[_0x3869('0x55')]['id']}})['then'](handleEntityNotFound(_0x1b58e7,null))['then'](removeEntity(_0x1b58e7,null))[_0x3869('0x25')](handleError(_0x1b58e7,null));};exports['getFields']=function(_0x3c0433,_0x44ae7d,_0x438b96){var _0x4a951c={};var _0x574532={};var _0x1e23a8;var _0x5cd961;return db[_0x3869('0x3a')][_0x3869('0x59')]({'where':{'id':_0x3c0433[_0x3869('0x55')]['id']}})['then'](handleEntityNotFound(_0x44ae7d,null))['then'](function(_0x2e8e79){if(_0x2e8e79){_0x1e23a8=_0x2e8e79;_0x574532[_0x3869('0x3f')]=_['keys'](db['FreshdeskField'][_0x3869('0x3b')]);_0x574532[_0x3869('0x40')]=_['keys'](_0x3c0433[_0x3869('0x40')]);_0x574532[_0x3869('0x42')]=_[_0x3869('0x43')](_0x574532[_0x3869('0x3f')],_0x574532[_0x3869('0x40')]);_0x4a951c[_0x3869('0x44')]=_['intersection'](_0x574532[_0x3869('0x3f')],qs['fields'](_0x3c0433['query'][_0x3869('0x45')]));_0x4a951c[_0x3869('0x44')]=_0x4a951c[_0x3869('0x44')][_0x3869('0x46')]?_0x4a951c[_0x3869('0x44')]:_0x574532[_0x3869('0x3f')];_0x4a951c['order']=qs[_0x3869('0x49')](_0x3c0433[_0x3869('0x40')]['sort']);_0x4a951c['where']=qs[_0x3869('0x42')](_['pick'](_0x3c0433[_0x3869('0x40')],_0x574532[_0x3869('0x42')]));if(_0x3c0433[_0x3869('0x40')][_0x3869('0x4c')]){_0x4a951c[_0x3869('0x4a')]=_[_0x3869('0x4d')](_0x4a951c[_0x3869('0x4a')],{'$or':_[_0x3869('0x39')](_0x4a951c['attributes'],function(_0x5e2ce7){var _0xaf43f={};_0xaf43f[_0x5e2ce7]={'$like':'%'+_0x3c0433[_0x3869('0x40')]['filter']+'%'};return _0xaf43f;})});}_0x4a951c=_[_0x3869('0x4d')]({},_0x4a951c,_0x3c0433[_0x3869('0x4f')]);return _0x1e23a8['getFields'](_0x4a951c);}})[_0x3869('0x33')](function(_0xa12209){if(_0xa12209){_0x5cd961=_0xa12209[_0x3869('0x46')];if(!_0x3c0433[_0x3869('0x40')][_0x3869('0x5a')](_0x3869('0x47'))){_0x4a951c[_0x3869('0x2b')]=qs[_0x3869('0x2b')](_0x3c0433[_0x3869('0x40')]['limit']);_0x4a951c[_0x3869('0x2a')]=qs['offset'](_0x3c0433[_0x3869('0x40')][_0x3869('0x2a')]);}return _0x1e23a8['getFields'](_0x4a951c);}})['then'](function(_0xef7855){if(_0xef7855){return _0xef7855?{'count':_0x5cd961,'rows':_0xef7855}:null;}})[_0x3869('0x33')](respondWithResult(_0x44ae7d,null))[_0x3869('0x25')](handleError(_0x44ae7d,null));};exports['getSubjects']=function(_0x29bff3,_0x39a035,_0x8d6e31){var _0x14e19e={};var _0x342d23={};var _0x47b835;var _0x425b1a;return db[_0x3869('0x3a')][_0x3869('0x59')]({'where':{'id':_0x29bff3[_0x3869('0x55')]['id']}})[_0x3869('0x33')](handleEntityNotFound(_0x39a035,null))[_0x3869('0x33')](function(_0x56aa3a){if(_0x56aa3a){_0x47b835=_0x56aa3a;_0x342d23[_0x3869('0x3f')]=_[_0x3869('0x41')](db['FreshdeskField'][_0x3869('0x3b')]);_0x342d23[_0x3869('0x40')]=_[_0x3869('0x41')](_0x29bff3['query']);_0x342d23[_0x3869('0x42')]=_[_0x3869('0x43')](_0x342d23[_0x3869('0x3f')],_0x342d23[_0x3869('0x40')]);_0x14e19e[_0x3869('0x44')]=_['intersection'](_0x342d23[_0x3869('0x3f')],qs['fields'](_0x29bff3[_0x3869('0x40')][_0x3869('0x45')]));_0x14e19e[_0x3869('0x44')]=_0x14e19e[_0x3869('0x44')]['length']?_0x14e19e[_0x3869('0x44')]:_0x342d23['model'];_0x14e19e['order']=qs[_0x3869('0x49')](_0x29bff3[_0x3869('0x40')][_0x3869('0x49')]);_0x14e19e[_0x3869('0x4a')]=qs[_0x3869('0x42')](_[_0x3869('0x4b')](_0x29bff3[_0x3869('0x40')],_0x342d23[_0x3869('0x42')]));if(_0x29bff3[_0x3869('0x40')][_0x3869('0x4c')]){_0x14e19e[_0x3869('0x4a')]=_['merge'](_0x14e19e[_0x3869('0x4a')],{'$or':_[_0x3869('0x39')](_0x14e19e[_0x3869('0x44')],function(_0x8bca7f){var _0x75d026={};_0x75d026[_0x8bca7f]={'$like':'%'+_0x29bff3[_0x3869('0x40')][_0x3869('0x4c')]+'%'};return _0x75d026;})});}_0x14e19e=_['merge']({},_0x14e19e,_0x29bff3[_0x3869('0x4f')]);return _0x47b835['getSubjects'](_0x14e19e);}})[_0x3869('0x33')](function(_0x5abc4b){if(_0x5abc4b){_0x425b1a=_0x5abc4b[_0x3869('0x46')];if(!_0x29bff3[_0x3869('0x40')][_0x3869('0x5a')](_0x3869('0x47'))){_0x14e19e[_0x3869('0x2b')]=qs[_0x3869('0x2b')](_0x29bff3[_0x3869('0x40')][_0x3869('0x2b')]);_0x14e19e['offset']=qs[_0x3869('0x2a')](_0x29bff3[_0x3869('0x40')]['offset']);}return _0x47b835[_0x3869('0x5b')](_0x14e19e);}})[_0x3869('0x33')](function(_0x34c516){if(_0x34c516){return _0x34c516?{'count':_0x425b1a,'rows':_0x34c516}:null;}})[_0x3869('0x33')](respondWithResult(_0x39a035,null))['catch'](handleError(_0x39a035,null));};exports['getDescriptions']=function(_0x57c6b6,_0x133759,_0x239709){var _0x32cba2={};var _0x3a3f6a={};var _0x4bbe81;var _0x300bb2;return db[_0x3869('0x3a')][_0x3869('0x59')]({'where':{'id':_0x57c6b6['params']['id']}})[_0x3869('0x33')](handleEntityNotFound(_0x133759,null))[_0x3869('0x33')](function(_0x220604){if(_0x220604){_0x4bbe81=_0x220604;_0x3a3f6a[_0x3869('0x3f')]=_['keys'](db[_0x3869('0x5c')][_0x3869('0x3b')]);_0x3a3f6a[_0x3869('0x40')]=_[_0x3869('0x41')](_0x57c6b6['query']);_0x3a3f6a[_0x3869('0x42')]=_[_0x3869('0x43')](_0x3a3f6a['model'],_0x3a3f6a['query']);_0x32cba2[_0x3869('0x44')]=_['intersection'](_0x3a3f6a[_0x3869('0x3f')],qs[_0x3869('0x45')](_0x57c6b6['query'][_0x3869('0x45')]));_0x32cba2[_0x3869('0x44')]=_0x32cba2[_0x3869('0x44')][_0x3869('0x46')]?_0x32cba2[_0x3869('0x44')]:_0x3a3f6a[_0x3869('0x3f')];_0x32cba2['order']=qs[_0x3869('0x49')](_0x57c6b6[_0x3869('0x40')][_0x3869('0x49')]);_0x32cba2['where']=qs['filters'](_[_0x3869('0x4b')](_0x57c6b6[_0x3869('0x40')],_0x3a3f6a[_0x3869('0x42')]));if(_0x57c6b6[_0x3869('0x40')][_0x3869('0x4c')]){_0x32cba2['where']=_['merge'](_0x32cba2[_0x3869('0x4a')],{'$or':_[_0x3869('0x39')](_0x32cba2[_0x3869('0x44')],function(_0x47152b){var _0x1c68fa={};_0x1c68fa[_0x47152b]={'$like':'%'+_0x57c6b6[_0x3869('0x40')][_0x3869('0x4c')]+'%'};return _0x1c68fa;})});}_0x32cba2=_[_0x3869('0x4d')]({},_0x32cba2,_0x57c6b6[_0x3869('0x4f')]);return _0x4bbe81[_0x3869('0x5d')](_0x32cba2);}})[_0x3869('0x33')](function(_0x2578e2){if(_0x2578e2){_0x300bb2=_0x2578e2[_0x3869('0x46')];if(!_0x57c6b6[_0x3869('0x40')][_0x3869('0x5a')](_0x3869('0x47'))){_0x32cba2[_0x3869('0x2b')]=qs[_0x3869('0x2b')](_0x57c6b6['query'][_0x3869('0x2b')]);_0x32cba2[_0x3869('0x2a')]=qs[_0x3869('0x2a')](_0x57c6b6[_0x3869('0x40')][_0x3869('0x2a')]);}return _0x4bbe81[_0x3869('0x5d')](_0x32cba2);}})[_0x3869('0x33')](function(_0x23b044){if(_0x23b044){return _0x23b044?{'count':_0x300bb2,'rows':_0x23b044}:null;}})['then'](respondWithResult(_0x133759,null))['catch'](handleError(_0x133759,null));};exports['getTags']=function(_0x1af62d,_0x5ca564,_0x4b4f63){var _0x2bf374={};var _0x12c403={};var _0x3e83e2;var _0x28384e;return db['FreshdeskConfiguration'][_0x3869('0x59')]({'where':{'id':_0x1af62d[_0x3869('0x55')]['id']}})[_0x3869('0x33')](handleEntityNotFound(_0x5ca564,null))[_0x3869('0x33')](function(_0x3518f3){if(_0x3518f3){_0x3e83e2=_0x3518f3;_0x12c403[_0x3869('0x3f')]=_['keys'](db[_0x3869('0x5e')]['rawAttributes']);_0x12c403[_0x3869('0x40')]=_[_0x3869('0x41')](_0x1af62d[_0x3869('0x40')]);_0x12c403[_0x3869('0x42')]=_['intersection'](_0x12c403[_0x3869('0x3f')],_0x12c403[_0x3869('0x40')]);_0x2bf374[_0x3869('0x44')]=_[_0x3869('0x43')](_0x12c403[_0x3869('0x3f')],qs[_0x3869('0x45')](_0x1af62d[_0x3869('0x40')][_0x3869('0x45')]));_0x2bf374['attributes']=_0x2bf374[_0x3869('0x44')][_0x3869('0x46')]?_0x2bf374[_0x3869('0x44')]:_0x12c403[_0x3869('0x3f')];_0x2bf374['order']=qs[_0x3869('0x49')](_0x1af62d[_0x3869('0x40')][_0x3869('0x49')]);_0x2bf374[_0x3869('0x4a')]=qs[_0x3869('0x42')](_['pick'](_0x1af62d[_0x3869('0x40')],_0x12c403[_0x3869('0x42')]));if(_0x1af62d[_0x3869('0x40')]['filter']){_0x2bf374[_0x3869('0x4a')]=_['merge'](_0x2bf374[_0x3869('0x4a')],{'$or':_[_0x3869('0x39')](_0x2bf374[_0x3869('0x44')],function(_0x139a54){var _0x2b1f8b={};_0x2b1f8b[_0x139a54]={'$like':'%'+_0x1af62d[_0x3869('0x40')][_0x3869('0x4c')]+'%'};return _0x2b1f8b;})});}_0x2bf374=_[_0x3869('0x4d')]({},_0x2bf374,_0x1af62d['options']);return _0x3e83e2[_0x3869('0x5f')](_0x2bf374);}})[_0x3869('0x33')](function(_0x43be5e){if(_0x43be5e){_0x28384e=_0x43be5e[_0x3869('0x46')];if(!_0x1af62d[_0x3869('0x40')][_0x3869('0x5a')](_0x3869('0x47'))){_0x2bf374['limit']=qs['limit'](_0x1af62d['query'][_0x3869('0x2b')]);_0x2bf374['offset']=qs[_0x3869('0x2a')](_0x1af62d['query'][_0x3869('0x2a')]);}return _0x3e83e2[_0x3869('0x5f')](_0x2bf374);}})[_0x3869('0x33')](function(_0x43a0a7){if(_0x43a0a7){return _0x43a0a7?{'count':_0x28384e,'rows':_0x43a0a7}:null;}})['then'](respondWithResult(_0x5ca564,null))[_0x3869('0x25')](handleError(_0x5ca564,null));};exports[_0x3869('0x60')]=function(_0x5bd74b,_0x60ab7c,_0x39c5c8){if(_0x5bd74b[_0x3869('0x58')]['id']){delete _0x5bd74b[_0x3869('0x58')]['id'];}return db[_0x3869('0x3a')][_0x3869('0x59')]({'where':{'id':_0x5bd74b['params']['id']}})[_0x3869('0x33')](handleEntityNotFound(_0x60ab7c,null))[_0x3869('0x33')](function(_0x4c5069){if(_0x4c5069){return _0x4c5069['setTags'](_0x5bd74b[_0x3869('0x58')][_0x3869('0x61')]||[]);}return null;})[_0x3869('0x33')](respondWithResult(_0x60ab7c,null))['catch'](handleError(_0x60ab7c,null));}; \ No newline at end of file +var _0x04d3=['name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','where','filter','merge','type','VIRTUAL','include','catch','params','find','body','findOne','FreshdeskField','sort','pick','options','getFields','getSubjects','order','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','then'];(function(_0x2ac048,_0x1a5057){var _0x1a8e4f=function(_0x555126){while(--_0x555126){_0x2ac048['push'](_0x2ac048['shift']());}};_0x1a8e4f(++_0x1a5057);}(_0x04d3,0x1d0));var _0x304d=function(_0x151702,_0x3751b9){_0x151702=_0x151702-0x0;var _0x16eca4=_0x04d3[_0x151702];return _0x16eca4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x304d('0x0'));var rimraf=require(_0x304d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x304d('0x2'));var rp=require(_0x304d('0x3'));var moment=require('moment');var BPromise=require(_0x304d('0x4'));var Mustache=require(_0x304d('0x5'));var util=require(_0x304d('0x6'));var path=require(_0x304d('0x7'));var sox=require(_0x304d('0x8'));var csv=require('to-csv');var ejs=require(_0x304d('0x9'));var fs=require('fs');var _=require(_0x304d('0xa'));var squel=require('squel');var crypto=require(_0x304d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x304d('0xc'));var toCsv=require(_0x304d('0xd'));var querystring=require('querystring');var Papa=require(_0x304d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x304d('0xf'));var hardwareService=require(_0x304d('0x10'));var logger=require(_0x304d('0x11'))('api');var utils=require(_0x304d('0x12'));var config=require(_0x304d('0x13'));var licenseUtil=require(_0x304d('0x14'));var db=require(_0x304d('0x15'))['db'];var jayson=require(_0x304d('0x16'));var client=jayson[_0x304d('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1278ea,_0xdf84e6,_0x1cc16c,_0x589fa5){return new BPromise(function(_0x1168d1,_0x13d91d){var _0x2e5c36=_0x589fa5||client;return _0x2e5c36[_0x304d('0x18')](_0x1278ea,_0x1cc16c)['then'](function(_0x2e61c6){logger['info'](_0x304d('0x19'),_0xdf84e6,_0x304d('0x1a'));logger[_0x304d('0x1b')](_0x304d('0x1c'),_0xdf84e6,_0x304d('0x1a'),JSON['stringify'](_0x2e61c6));if(_0x2e61c6[_0x304d('0x1d')]){if(_0x2e61c6[_0x304d('0x1d')][_0x304d('0x1e')]===0x1f4){logger[_0x304d('0x1d')](_0x304d('0x19'),_0xdf84e6,_0x2e61c6['error']['message']);return _0x13d91d(_0x2e61c6['error'][_0x304d('0x1f')]);}logger[_0x304d('0x1d')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xdf84e6,_0x2e61c6[_0x304d('0x1d')]['message']);return _0x1168d1(_0x2e61c6[_0x304d('0x1d')][_0x304d('0x1f')]);}else{logger['info'](_0x304d('0x19'),_0xdf84e6,_0x304d('0x1a'));_0x1168d1(_0x2e61c6[_0x304d('0x20')][_0x304d('0x1f')]);}})['catch'](function(_0x5dab83){logger[_0x304d('0x1d')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xdf84e6,_0x5dab83);_0x13d91d(_0x5dab83);});});}function respondWithStatusCode(_0x29d939,_0x40b495){_0x40b495=_0x40b495||0xcc;return function(_0x179b6b){if(_0x179b6b){return _0x29d939[_0x304d('0x21')](_0x40b495);}return _0x29d939[_0x304d('0x22')](_0x40b495)[_0x304d('0x23')]();};}function respondWithResult(_0x1a173e,_0x41425a){_0x41425a=_0x41425a||0xc8;return function(_0x4ffec9){if(_0x4ffec9){return _0x1a173e[_0x304d('0x22')](_0x41425a)[_0x304d('0x24')](_0x4ffec9);}};}function respondWithFilteredResult(_0x4269b8,_0x285d8e){return function(_0xc0c793){if(_0xc0c793){var _0x1a4a71=_0xc0c793[_0x304d('0x25')],_0x31ac6f=_0x285d8e['offset'],_0x481cf4=_0x285d8e[_0x304d('0x26')]+_0x285d8e[_0x304d('0x27')],_0x3b7d60;if(_0x481cf4>=_0x1a4a71){_0x481cf4=_0x1a4a71;_0x3b7d60=0xc8;}else{_0x3b7d60=0xce;}_0x4269b8[_0x304d('0x22')](_0x3b7d60);return _0x4269b8['set'](_0x304d('0x28'),_0x31ac6f+'-'+_0x481cf4+'/'+_0x1a4a71)['json'](_0xc0c793);}return null;};}function patchUpdates(_0xafa8ad){return function(_0x95258b){try{jsonpatch[_0x304d('0x29')](_0x95258b,_0xafa8ad,!![]);}catch(_0x394324){return BPromise[_0x304d('0x2a')](_0x394324);}return _0x95258b['save']();};}function saveUpdates(_0x177814,_0x253c13){return function(_0x3e0bf2){if(_0x3e0bf2){return _0x3e0bf2[_0x304d('0x2b')](_0x177814)['then'](function(_0x575987){return _0x575987;});}return null;};}function removeEntity(_0x364288,_0x1f6a58){return function(_0x2c966a){if(_0x2c966a){return _0x2c966a[_0x304d('0x2c')]()[_0x304d('0x2d')](function(){_0x364288['status'](0xcc)[_0x304d('0x23')]();});}};}function handleEntityNotFound(_0x3fbdb8,_0xae30ca){return function(_0x591e68){if(!_0x591e68){_0x3fbdb8[_0x304d('0x21')](0x194);}return _0x591e68;};}function handleError(_0xcd0b84,_0x2c0037){_0x2c0037=_0x2c0037||0x1f4;return function(_0x1bec4e){logger[_0x304d('0x1d')](_0x1bec4e['stack']);if(_0x1bec4e[_0x304d('0x2e')]){delete _0x1bec4e[_0x304d('0x2e')];}_0xcd0b84[_0x304d('0x22')](_0x2c0037)[_0x304d('0x2f')](_0x1bec4e);};}exports[_0x304d('0x30')]=function(_0x514421,_0x355030){var _0x252634={},_0x59bc27={},_0x4dfaf6={'count':0x0,'rows':[]};var _0x25ef9e=_[_0x304d('0x31')](db[_0x304d('0x32')][_0x304d('0x33')],function(_0x35748f){return{'name':_0x35748f[_0x304d('0x34')],'type':_0x35748f['type']['key']};});_0x59bc27[_0x304d('0x35')]=_[_0x304d('0x31')](_0x25ef9e,'name');_0x59bc27['query']=_[_0x304d('0x36')](_0x514421['query']);_0x59bc27[_0x304d('0x37')]=_[_0x304d('0x38')](_0x59bc27[_0x304d('0x35')],_0x59bc27[_0x304d('0x39')]);_0x252634['attributes']=_[_0x304d('0x38')](_0x59bc27[_0x304d('0x35')],qs[_0x304d('0x3a')](_0x514421['query'][_0x304d('0x3a')]));_0x252634[_0x304d('0x3b')]=_0x252634['attributes'][_0x304d('0x3c')]?_0x252634[_0x304d('0x3b')]:_0x59bc27[_0x304d('0x35')];if(!_0x514421[_0x304d('0x39')][_0x304d('0x3d')](_0x304d('0x3e'))){_0x252634[_0x304d('0x27')]=qs['limit'](_0x514421[_0x304d('0x39')][_0x304d('0x27')]);_0x252634[_0x304d('0x26')]=qs[_0x304d('0x26')](_0x514421[_0x304d('0x39')][_0x304d('0x26')]);}_0x252634['order']=qs['sort'](_0x514421['query']['sort']);_0x252634[_0x304d('0x3f')]=qs[_0x304d('0x37')](_['pick'](_0x514421[_0x304d('0x39')],_0x59bc27['filters']),_0x25ef9e);if(_0x514421['query'][_0x304d('0x40')]){_0x252634[_0x304d('0x3f')]=_[_0x304d('0x41')](_0x252634[_0x304d('0x3f')],{'$or':_['map'](_0x25ef9e,function(_0x4bdd3c){if(_0x4bdd3c[_0x304d('0x42')]!==_0x304d('0x43')){var _0x562ad4={};_0x562ad4[_0x4bdd3c['name']]={'$like':'%'+_0x514421[_0x304d('0x39')][_0x304d('0x40')]+'%'};return _0x562ad4;}})});}_0x252634=_[_0x304d('0x41')]({},_0x252634,_0x514421['options']);var _0x5b5663={'where':_0x252634[_0x304d('0x3f')]};return db[_0x304d('0x32')][_0x304d('0x25')](_0x5b5663)[_0x304d('0x2d')](function(_0x597e8c){_0x4dfaf6['count']=_0x597e8c;if(_0x514421[_0x304d('0x39')]['includeAll']){_0x252634[_0x304d('0x44')]=[{'all':!![]}];}return db[_0x304d('0x32')]['findAll'](_0x252634);})[_0x304d('0x2d')](function(_0x2c4cfe){_0x4dfaf6['rows']=_0x2c4cfe;return _0x4dfaf6;})['then'](respondWithFilteredResult(_0x355030,_0x252634))[_0x304d('0x45')](handleError(_0x355030,null));};exports['show']=function(_0x419264,_0x2122c4){var _0x2b8507={'raw':![],'where':{'id':_0x419264[_0x304d('0x46')]['id']}},_0x325cbe={};_0x325cbe[_0x304d('0x35')]=_[_0x304d('0x36')](db[_0x304d('0x32')][_0x304d('0x33')]);_0x325cbe['query']=_[_0x304d('0x36')](_0x419264[_0x304d('0x39')]);_0x325cbe[_0x304d('0x37')]=_['intersection'](_0x325cbe['model'],_0x325cbe[_0x304d('0x39')]);_0x2b8507[_0x304d('0x3b')]=_[_0x304d('0x38')](_0x325cbe[_0x304d('0x35')],qs[_0x304d('0x3a')](_0x419264[_0x304d('0x39')][_0x304d('0x3a')]));_0x2b8507[_0x304d('0x3b')]=_0x2b8507['attributes']['length']?_0x2b8507[_0x304d('0x3b')]:_0x325cbe['model'];if(_0x419264[_0x304d('0x39')]['includeAll']){_0x2b8507[_0x304d('0x44')]=[{'all':!![]}];}_0x2b8507=_[_0x304d('0x41')]({},_0x2b8507,_0x419264['options']);return db[_0x304d('0x32')][_0x304d('0x47')](_0x2b8507)[_0x304d('0x2d')](handleEntityNotFound(_0x2122c4,null))[_0x304d('0x2d')](respondWithResult(_0x2122c4,null))['catch'](handleError(_0x2122c4,null));};exports['create']=function(_0x1357e3,_0x310303){return db[_0x304d('0x32')]['create'](_0x1357e3[_0x304d('0x48')],{})[_0x304d('0x2d')](respondWithResult(_0x310303,0xc9))[_0x304d('0x45')](handleError(_0x310303,null));};exports[_0x304d('0x2b')]=function(_0x73d8ce,_0x30246b){if(_0x73d8ce[_0x304d('0x48')]['id']){delete _0x73d8ce[_0x304d('0x48')]['id'];}return db['FreshdeskConfiguration'][_0x304d('0x47')]({'where':{'id':_0x73d8ce[_0x304d('0x46')]['id']}})[_0x304d('0x2d')](handleEntityNotFound(_0x30246b,null))[_0x304d('0x2d')](saveUpdates(_0x73d8ce[_0x304d('0x48')],null))[_0x304d('0x2d')](respondWithResult(_0x30246b,null))[_0x304d('0x45')](handleError(_0x30246b,null));};exports[_0x304d('0x2c')]=function(_0x1a0fd4,_0x4c4816){return db[_0x304d('0x32')][_0x304d('0x47')]({'where':{'id':_0x1a0fd4[_0x304d('0x46')]['id']}})[_0x304d('0x2d')](handleEntityNotFound(_0x4c4816,null))[_0x304d('0x2d')](removeEntity(_0x4c4816,null))[_0x304d('0x45')](handleError(_0x4c4816,null));};exports['getFields']=function(_0x3194e9,_0xbd44d6,_0x202c8b){var _0x1d7442={};var _0x9a2ada={};var _0x48a13b;var _0x44a166;return db[_0x304d('0x32')][_0x304d('0x49')]({'where':{'id':_0x3194e9['params']['id']}})['then'](handleEntityNotFound(_0xbd44d6,null))[_0x304d('0x2d')](function(_0x5cc738){if(_0x5cc738){_0x48a13b=_0x5cc738;_0x9a2ada['model']=_[_0x304d('0x36')](db[_0x304d('0x4a')]['rawAttributes']);_0x9a2ada[_0x304d('0x39')]=_[_0x304d('0x36')](_0x3194e9[_0x304d('0x39')]);_0x9a2ada[_0x304d('0x37')]=_['intersection'](_0x9a2ada[_0x304d('0x35')],_0x9a2ada[_0x304d('0x39')]);_0x1d7442[_0x304d('0x3b')]=_['intersection'](_0x9a2ada[_0x304d('0x35')],qs[_0x304d('0x3a')](_0x3194e9[_0x304d('0x39')]['fields']));_0x1d7442['attributes']=_0x1d7442['attributes']['length']?_0x1d7442['attributes']:_0x9a2ada[_0x304d('0x35')];_0x1d7442['order']=qs[_0x304d('0x4b')](_0x3194e9[_0x304d('0x39')][_0x304d('0x4b')]);_0x1d7442['where']=qs[_0x304d('0x37')](_[_0x304d('0x4c')](_0x3194e9[_0x304d('0x39')],_0x9a2ada[_0x304d('0x37')]));if(_0x3194e9['query'][_0x304d('0x40')]){_0x1d7442[_0x304d('0x3f')]=_['merge'](_0x1d7442[_0x304d('0x3f')],{'$or':_['map'](_0x1d7442[_0x304d('0x3b')],function(_0xc9cf){var _0x2acb23={};_0x2acb23[_0xc9cf]={'$like':'%'+_0x3194e9['query']['filter']+'%'};return _0x2acb23;})});}_0x1d7442=_[_0x304d('0x41')]({},_0x1d7442,_0x3194e9[_0x304d('0x4d')]);return _0x48a13b['getFields'](_0x1d7442);}})[_0x304d('0x2d')](function(_0x578fbd){if(_0x578fbd){_0x44a166=_0x578fbd['length'];if(!_0x3194e9[_0x304d('0x39')][_0x304d('0x3d')](_0x304d('0x3e'))){_0x1d7442[_0x304d('0x27')]=qs[_0x304d('0x27')](_0x3194e9[_0x304d('0x39')][_0x304d('0x27')]);_0x1d7442[_0x304d('0x26')]=qs[_0x304d('0x26')](_0x3194e9[_0x304d('0x39')]['offset']);}return _0x48a13b[_0x304d('0x4e')](_0x1d7442);}})[_0x304d('0x2d')](function(_0x5cb101){if(_0x5cb101){return _0x5cb101?{'count':_0x44a166,'rows':_0x5cb101}:null;}})[_0x304d('0x2d')](respondWithResult(_0xbd44d6,null))['catch'](handleError(_0xbd44d6,null));};exports[_0x304d('0x4f')]=function(_0x2ebd38,_0x7c0c60,_0x53b6cc){var _0x346416={};var _0x46b9a0={};var _0x310743;var _0x4a3929;return db[_0x304d('0x32')][_0x304d('0x49')]({'where':{'id':_0x2ebd38[_0x304d('0x46')]['id']}})[_0x304d('0x2d')](handleEntityNotFound(_0x7c0c60,null))['then'](function(_0x2a810d){if(_0x2a810d){_0x310743=_0x2a810d;_0x46b9a0[_0x304d('0x35')]=_[_0x304d('0x36')](db[_0x304d('0x4a')]['rawAttributes']);_0x46b9a0[_0x304d('0x39')]=_[_0x304d('0x36')](_0x2ebd38['query']);_0x46b9a0[_0x304d('0x37')]=_[_0x304d('0x38')](_0x46b9a0[_0x304d('0x35')],_0x46b9a0[_0x304d('0x39')]);_0x346416[_0x304d('0x3b')]=_['intersection'](_0x46b9a0['model'],qs[_0x304d('0x3a')](_0x2ebd38[_0x304d('0x39')][_0x304d('0x3a')]));_0x346416['attributes']=_0x346416['attributes']['length']?_0x346416[_0x304d('0x3b')]:_0x46b9a0[_0x304d('0x35')];_0x346416[_0x304d('0x50')]=qs[_0x304d('0x4b')](_0x2ebd38[_0x304d('0x39')][_0x304d('0x4b')]);_0x346416[_0x304d('0x3f')]=qs['filters'](_['pick'](_0x2ebd38[_0x304d('0x39')],_0x46b9a0[_0x304d('0x37')]));if(_0x2ebd38[_0x304d('0x39')][_0x304d('0x40')]){_0x346416['where']=_[_0x304d('0x41')](_0x346416[_0x304d('0x3f')],{'$or':_[_0x304d('0x31')](_0x346416[_0x304d('0x3b')],function(_0x1d4b58){var _0x1a8582={};_0x1a8582[_0x1d4b58]={'$like':'%'+_0x2ebd38['query'][_0x304d('0x40')]+'%'};return _0x1a8582;})});}_0x346416=_[_0x304d('0x41')]({},_0x346416,_0x2ebd38['options']);return _0x310743[_0x304d('0x4f')](_0x346416);}})[_0x304d('0x2d')](function(_0xe585d6){if(_0xe585d6){_0x4a3929=_0xe585d6[_0x304d('0x3c')];if(!_0x2ebd38[_0x304d('0x39')][_0x304d('0x3d')](_0x304d('0x3e'))){_0x346416[_0x304d('0x27')]=qs[_0x304d('0x27')](_0x2ebd38[_0x304d('0x39')][_0x304d('0x27')]);_0x346416['offset']=qs[_0x304d('0x26')](_0x2ebd38['query'][_0x304d('0x26')]);}return _0x310743['getSubjects'](_0x346416);}})[_0x304d('0x2d')](function(_0x58c8bc){if(_0x58c8bc){return _0x58c8bc?{'count':_0x4a3929,'rows':_0x58c8bc}:null;}})['then'](respondWithResult(_0x7c0c60,null))[_0x304d('0x45')](handleError(_0x7c0c60,null));};exports[_0x304d('0x51')]=function(_0x3cabf9,_0x236974,_0x202578){var _0x2c139e={};var _0x1e606c={};var _0x1b2a36;var _0x5f3eca;return db[_0x304d('0x32')][_0x304d('0x49')]({'where':{'id':_0x3cabf9[_0x304d('0x46')]['id']}})[_0x304d('0x2d')](handleEntityNotFound(_0x236974,null))['then'](function(_0x2a5951){if(_0x2a5951){_0x1b2a36=_0x2a5951;_0x1e606c[_0x304d('0x35')]=_[_0x304d('0x36')](db[_0x304d('0x4a')][_0x304d('0x33')]);_0x1e606c[_0x304d('0x39')]=_[_0x304d('0x36')](_0x3cabf9[_0x304d('0x39')]);_0x1e606c[_0x304d('0x37')]=_[_0x304d('0x38')](_0x1e606c[_0x304d('0x35')],_0x1e606c[_0x304d('0x39')]);_0x2c139e[_0x304d('0x3b')]=_[_0x304d('0x38')](_0x1e606c['model'],qs['fields'](_0x3cabf9[_0x304d('0x39')][_0x304d('0x3a')]));_0x2c139e[_0x304d('0x3b')]=_0x2c139e[_0x304d('0x3b')]['length']?_0x2c139e['attributes']:_0x1e606c[_0x304d('0x35')];_0x2c139e[_0x304d('0x50')]=qs[_0x304d('0x4b')](_0x3cabf9[_0x304d('0x39')][_0x304d('0x4b')]);_0x2c139e['where']=qs[_0x304d('0x37')](_['pick'](_0x3cabf9[_0x304d('0x39')],_0x1e606c[_0x304d('0x37')]));if(_0x3cabf9[_0x304d('0x39')][_0x304d('0x40')]){_0x2c139e[_0x304d('0x3f')]=_[_0x304d('0x41')](_0x2c139e[_0x304d('0x3f')],{'$or':_[_0x304d('0x31')](_0x2c139e[_0x304d('0x3b')],function(_0x56f293){var _0x268aaa={};_0x268aaa[_0x56f293]={'$like':'%'+_0x3cabf9[_0x304d('0x39')][_0x304d('0x40')]+'%'};return _0x268aaa;})});}_0x2c139e=_[_0x304d('0x41')]({},_0x2c139e,_0x3cabf9[_0x304d('0x4d')]);return _0x1b2a36[_0x304d('0x51')](_0x2c139e);}})['then'](function(_0x120d3c){if(_0x120d3c){_0x5f3eca=_0x120d3c['length'];if(!_0x3cabf9['query'][_0x304d('0x3d')](_0x304d('0x3e'))){_0x2c139e['limit']=qs[_0x304d('0x27')](_0x3cabf9['query'][_0x304d('0x27')]);_0x2c139e[_0x304d('0x26')]=qs[_0x304d('0x26')](_0x3cabf9['query'][_0x304d('0x26')]);}return _0x1b2a36[_0x304d('0x51')](_0x2c139e);}})[_0x304d('0x2d')](function(_0x1b6794){if(_0x1b6794){return _0x1b6794?{'count':_0x5f3eca,'rows':_0x1b6794}:null;}})[_0x304d('0x2d')](respondWithResult(_0x236974,null))[_0x304d('0x45')](handleError(_0x236974,null));};exports[_0x304d('0x52')]=function(_0x34ffcb,_0x598c2b,_0xda9838){var _0x1ec157={};var _0xa84098={};var _0x753e3b;var _0x751198;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x34ffcb[_0x304d('0x46')]['id']}})[_0x304d('0x2d')](handleEntityNotFound(_0x598c2b,null))[_0x304d('0x2d')](function(_0x5ef910){if(_0x5ef910){_0x753e3b=_0x5ef910;_0xa84098['model']=_['keys'](db[_0x304d('0x53')]['rawAttributes']);_0xa84098[_0x304d('0x39')]=_[_0x304d('0x36')](_0x34ffcb[_0x304d('0x39')]);_0xa84098[_0x304d('0x37')]=_[_0x304d('0x38')](_0xa84098[_0x304d('0x35')],_0xa84098[_0x304d('0x39')]);_0x1ec157['attributes']=_[_0x304d('0x38')](_0xa84098[_0x304d('0x35')],qs['fields'](_0x34ffcb[_0x304d('0x39')][_0x304d('0x3a')]));_0x1ec157[_0x304d('0x3b')]=_0x1ec157[_0x304d('0x3b')][_0x304d('0x3c')]?_0x1ec157[_0x304d('0x3b')]:_0xa84098['model'];_0x1ec157[_0x304d('0x50')]=qs['sort'](_0x34ffcb['query'][_0x304d('0x4b')]);_0x1ec157['where']=qs[_0x304d('0x37')](_[_0x304d('0x4c')](_0x34ffcb[_0x304d('0x39')],_0xa84098[_0x304d('0x37')]));if(_0x34ffcb['query'][_0x304d('0x40')]){_0x1ec157['where']=_['merge'](_0x1ec157[_0x304d('0x3f')],{'$or':_[_0x304d('0x31')](_0x1ec157[_0x304d('0x3b')],function(_0x153e82){var _0x7bd11d={};_0x7bd11d[_0x153e82]={'$like':'%'+_0x34ffcb[_0x304d('0x39')][_0x304d('0x40')]+'%'};return _0x7bd11d;})});}_0x1ec157=_[_0x304d('0x41')]({},_0x1ec157,_0x34ffcb[_0x304d('0x4d')]);return _0x753e3b[_0x304d('0x52')](_0x1ec157);}})[_0x304d('0x2d')](function(_0x2578f){if(_0x2578f){_0x751198=_0x2578f[_0x304d('0x3c')];if(!_0x34ffcb[_0x304d('0x39')][_0x304d('0x3d')](_0x304d('0x3e'))){_0x1ec157['limit']=qs['limit'](_0x34ffcb[_0x304d('0x39')][_0x304d('0x27')]);_0x1ec157[_0x304d('0x26')]=qs[_0x304d('0x26')](_0x34ffcb['query']['offset']);}return _0x753e3b[_0x304d('0x52')](_0x1ec157);}})[_0x304d('0x2d')](function(_0x737176){if(_0x737176){return _0x737176?{'count':_0x751198,'rows':_0x737176}:null;}})[_0x304d('0x2d')](respondWithResult(_0x598c2b,null))['catch'](handleError(_0x598c2b,null));};exports[_0x304d('0x54')]=function(_0xe4b435,_0x1f583d,_0x3c38d5){if(_0xe4b435[_0x304d('0x48')]['id']){delete _0xe4b435[_0x304d('0x48')]['id'];}return db[_0x304d('0x32')]['findOne']({'where':{'id':_0xe4b435['params']['id']}})['then'](handleEntityNotFound(_0x1f583d,null))['then'](function(_0x3ba160){if(_0x3ba160){return _0x3ba160[_0x304d('0x54')](_0xe4b435[_0x304d('0x48')]['ids']||[]);}return null;})[_0x304d('0x2d')](respondWithResult(_0x1f583d,null))['catch'](handleError(_0x1f583d,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 79d9544..8130ffc 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 _0x7354=['lodash','util','../../config/logger','api','request-promise','path','../../config/environment','exports','define','FreshdeskConfiguration'];(function(_0x35d830,_0x5b27b2){var _0x594fc9=function(_0x2f8d51){while(--_0x2f8d51){_0x35d830['push'](_0x35d830['shift']());}};_0x594fc9(++_0x5b27b2);}(_0x7354,0x82));var _0x4735=function(_0x2c2a8e,_0x1dfe39){_0x2c2a8e=_0x2c2a8e-0x0;var _0x3b9e38=_0x7354[_0x2c2a8e];return _0x3b9e38;};'use strict';var _=require(_0x4735('0x0'));var util=require(_0x4735('0x1'));var logger=require(_0x4735('0x2'))(_0x4735('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4735('0x4'));var fs=require('fs');var path=require(_0x4735('0x5'));var rimraf=require('rimraf');var config=require(_0x4735('0x6'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x4735('0x7')]=function(_0x45eca9,_0x3f7a31){return _0x45eca9[_0x4735('0x8')](_0x4735('0x9'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd69=['request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcd69,0xb0));var _0x9cd6=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xcd69[_0x9dfc10];return _0x4f938a;};'use strict';var _=require(_0x9cd6('0x0'));var util=require(_0x9cd6('0x1'));var logger=require(_0x9cd6('0x2'))(_0x9cd6('0x3'));var moment=require(_0x9cd6('0x4'));var BPromise=require(_0x9cd6('0x5'));var rp=require(_0x9cd6('0x6'));var fs=require('fs');var path=require(_0x9cd6('0x7'));var rimraf=require('rimraf');var config=require(_0x9cd6('0x8'));var attributes=require(_0x9cd6('0x9'));module[_0x9cd6('0xa')]=function(_0x2a58e5,_0x4dfd74){return _0x2a58e5[_0x9cd6('0xb')](_0x9cd6('0xc'),attributes,{'tableName':_0x9cd6('0xd'),'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 0944c36..58e3bbe 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 _0xe659=['FreshdeskConfiguration,\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','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1fe7aa,_0x20c7ab){var _0x5bc8b8=function(_0x157bf0){while(--_0x157bf0){_0x1fe7aa['push'](_0x1fe7aa['shift']());}};_0x5bc8b8(++_0x20c7ab);}(_0xe659,0x15f));var _0x9e65=function(_0x272a88,_0x57e586){_0x272a88=_0x272a88-0x0;var _0x5c71c4=_0xe659[_0x272a88];return _0x5c71c4;};'use strict';var _=require(_0x9e65('0x0'));var util=require(_0x9e65('0x1'));var moment=require(_0x9e65('0x2'));var BPromise=require(_0x9e65('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e65('0x4'));var db=require(_0x9e65('0x5'))['db'];var utils=require(_0x9e65('0x6'));var logger=require(_0x9e65('0x7'))(_0x9e65('0x8'));var config=require(_0x9e65('0x9'));var jayson=require(_0x9e65('0xa'));var client=jayson[_0x9e65('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x64acc6,_0x593b6e,_0x134e48){return new BPromise(function(_0x57acc1,_0x369f46){return client[_0x9e65('0xc')](_0x64acc6,_0x134e48)['then'](function(_0x30f867){logger[_0x9e65('0xd')](_0x9e65('0xe'),_0x593b6e,_0x9e65('0xf'));logger[_0x9e65('0x10')](_0x9e65('0x11'),_0x593b6e,_0x9e65('0xf'),JSON[_0x9e65('0x12')](_0x30f867));if(_0x30f867[_0x9e65('0x13')]){if(_0x30f867[_0x9e65('0x13')]['code']===0x1f4){logger[_0x9e65('0x13')](_0x9e65('0xe'),_0x593b6e,_0x30f867[_0x9e65('0x13')][_0x9e65('0x14')]);return _0x369f46(_0x30f867[_0x9e65('0x13')][_0x9e65('0x14')]);}logger['error'](_0x9e65('0xe'),_0x593b6e,_0x30f867[_0x9e65('0x13')]['message']);return _0x57acc1(_0x30f867[_0x9e65('0x13')][_0x9e65('0x14')]);}else{logger['info'](_0x9e65('0xe'),_0x593b6e,_0x9e65('0xf'));_0x57acc1(_0x30f867[_0x9e65('0x15')]['message']);}})[_0x9e65('0x16')](function(_0x3c3248){logger[_0x9e65('0x13')](_0x9e65('0xe'),_0x593b6e,_0x3c3248);_0x369f46(_0x3c3248);});});} \ No newline at end of file +var _0xc05b=['../../config/utils','../../config/logger','../../config/environment','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1aba0f,_0x242a5d){var _0xf6e33d=function(_0x508922){while(--_0x508922){_0x1aba0f['push'](_0x1aba0f['shift']());}};_0xf6e33d(++_0x242a5d);}(_0xc05b,0x1dc));var _0xbc05=function(_0x381379,_0x3f3b86){_0x381379=_0x381379-0x0;var _0x3e1063=_0xc05b[_0x381379];return _0x3e1063;};'use strict';var _=require(_0xbc05('0x0'));var util=require(_0xbc05('0x1'));var moment=require(_0xbc05('0x2'));var BPromise=require(_0xbc05('0x3'));var rs=require(_0xbc05('0x4'));var fs=require('fs');var Redis=require(_0xbc05('0x5'));var db=require(_0xbc05('0x6'))['db'];var utils=require(_0xbc05('0x7'));var logger=require(_0xbc05('0x8'))('rpc');var config=require(_0xbc05('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x971af5,_0x1ab25c,_0x2f2254){return new BPromise(function(_0x2a2cf0,_0x3e91f3){return client[_0xbc05('0xa')](_0x971af5,_0x2f2254)[_0xbc05('0xb')](function(_0x6c7d13){logger['info'](_0xbc05('0xc'),_0x1ab25c,_0xbc05('0xd'));logger[_0xbc05('0xe')](_0xbc05('0xf'),_0x1ab25c,_0xbc05('0xd'),JSON['stringify'](_0x6c7d13));if(_0x6c7d13[_0xbc05('0x10')]){if(_0x6c7d13['error']['code']===0x1f4){logger[_0xbc05('0x10')](_0xbc05('0xc'),_0x1ab25c,_0x6c7d13[_0xbc05('0x10')][_0xbc05('0x11')]);return _0x3e91f3(_0x6c7d13[_0xbc05('0x10')][_0xbc05('0x11')]);}logger['error'](_0xbc05('0xc'),_0x1ab25c,_0x6c7d13[_0xbc05('0x10')]['message']);return _0x2a2cf0(_0x6c7d13[_0xbc05('0x10')][_0xbc05('0x11')]);}else{logger[_0xbc05('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1ab25c,_0xbc05('0xd'));_0x2a2cf0(_0x6c7d13[_0xbc05('0x13')]['message']);}})[_0xbc05('0x14')](function(_0x33a163){logger[_0xbc05('0x10')](_0xbc05('0xc'),_0x1ab25c,_0x33a163);_0x3e91f3(_0x33a163);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 4ab0acc..b80d5cb 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 _0xedd9=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','delete','/:id','destroy','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xedd9,0xfc));var _0x9edd=function(_0x56ac0c,_0x5c83da){_0x56ac0c=_0x56ac0c-0x0;var _0x46eaa2=_0xedd9[_0x56ac0c];return _0x46eaa2;};'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 auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0xb')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router[_0x9edd('0xd')]('/:id',auth[_0x9edd('0x9')](),controller['update']);router[_0x9edd('0xe')](_0x9edd('0xf'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);module[_0x9edd('0x11')]=router; \ No newline at end of file +var _0x3e74=['connect-timeout','express','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','multer','path'];(function(_0x447127,_0xbe4ade){var _0x358a25=function(_0x44fead){while(--_0x44fead){_0x447127['push'](_0x447127['shift']());}};_0x358a25(++_0xbe4ade);}(_0x3e74,0x175));var _0x43e7=function(_0x54053f,_0x5645b9){_0x54053f=_0x54053f-0x0;var _0x466531=_0x3e74[_0x54053f];return _0x466531;};'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 auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['put'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0xd')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);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 caa22b7..f22ea80 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 _0x2383=['STRING','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x126dbf,_0x112065){var _0x15b31=function(_0x4467b8){while(--_0x4467b8){_0x126dbf['push'](_0x126dbf['shift']());}};_0x15b31(++_0x112065);}(_0x2383,0xb2));var _0x3238=function(_0x43bba9,_0x48e83d){_0x43bba9=_0x43bba9-0x0;var _0x4ded12=_0x2383[_0x43bba9];return _0x4ded12;};'use strict';var Sequelize=require(_0x3238('0x0'));module[_0x3238('0x1')]={'type':{'type':Sequelize['ENUM'](_0x3238('0x2'),_0x3238('0x3'),_0x3238('0x4'),_0x3238('0x5')),'defaultValue':_0x3238('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x3238('0x2'),_0x3238('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x3238('0x6')]},'idField':{'type':Sequelize[_0x3238('0x6')]},'nameField':{'type':Sequelize[_0x3238('0x6')]},'customField':{'type':Sequelize[_0x3238('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3238('0x6')]}}; \ No newline at end of file +var _0xfd8f=['exports','string','variable','customVariable','keyValue','STRING','sequelize'];(function(_0x3aee4b,_0x3ee55c){var _0x26a74e=function(_0x327b1a){while(--_0x327b1a){_0x3aee4b['push'](_0x3aee4b['shift']());}};_0x26a74e(++_0x3ee55c);}(_0xfd8f,0xae));var _0xffd8=function(_0x6f9850,_0x117115){_0x6f9850=_0x6f9850-0x0;var _0x4bd72a=_0xfd8f[_0x6f9850];return _0x4bd72a;};'use strict';var Sequelize=require(_0xffd8('0x0'));module[_0xffd8('0x1')]={'type':{'type':Sequelize['ENUM'](_0xffd8('0x2'),_0xffd8('0x3'),_0xffd8('0x4'),_0xffd8('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xffd8('0x6')]},'key':{'type':Sequelize[_0xffd8('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xffd8('0x2'),_0xffd8('0x3'),_0xffd8('0x4'))},'keyContent':{'type':Sequelize[_0xffd8('0x6')]},'idField':{'type':Sequelize[_0xffd8('0x6')]},'nameField':{'type':Sequelize[_0xffd8('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xffd8('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index f45f12e..21ab420 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 _0x6467=['../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','FreshdeskField','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','count','includeAll','findAll','show','params','rawAttributes','include','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6467,0x110));var _0x7646=function(_0x30272c,_0x5595dd){_0x30272c=_0x30272c-0x0;var _0x596a7c=_0x6467[_0x30272c];return _0x596a7c;};'use strict';var pdf=require(_0x7646('0x0'));var emlformat=require(_0x7646('0x1'));var rimraf=require(_0x7646('0x2'));var zipdir=require(_0x7646('0x3'));var jsonpatch=require(_0x7646('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7646('0x5'));var Mustache=require(_0x7646('0x6'));var util=require(_0x7646('0x7'));var path=require(_0x7646('0x8'));var sox=require(_0x7646('0x9'));var csv=require(_0x7646('0xa'));var ejs=require(_0x7646('0xb'));var fs=require('fs');var _=require(_0x7646('0xc'));var squel=require(_0x7646('0xd'));var crypto=require('crypto');var jsforce=require(_0x7646('0xe'));var deskjs=require(_0x7646('0xf'));var toCsv=require(_0x7646('0xa'));var querystring=require(_0x7646('0x10'));var Papa=require(_0x7646('0x11'));var Redis=require(_0x7646('0x12'));var authService=require(_0x7646('0x13'));var qs=require(_0x7646('0x14'));var as=require(_0x7646('0x15'));var hardwareService=require(_0x7646('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x7646('0x17'));var licenseUtil=require(_0x7646('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x526dd9,_0x5c536d){_0x5c536d=_0x5c536d||0xcc;return function(_0x525b68){if(_0x525b68){return _0x526dd9[_0x7646('0x19')](_0x5c536d);}return _0x526dd9[_0x7646('0x1a')](_0x5c536d)[_0x7646('0x1b')]();};}function respondWithResult(_0x9ebf70,_0x4e3e87){_0x4e3e87=_0x4e3e87||0xc8;return function(_0x59c22f){if(_0x59c22f){return _0x9ebf70[_0x7646('0x1a')](_0x4e3e87)[_0x7646('0x1c')](_0x59c22f);}};}function respondWithFilteredResult(_0x4a436f,_0x111319){return function(_0x1452f1){if(_0x1452f1){var _0x1f29b6=_0x1452f1['count'],_0x563685=_0x111319['offset'],_0x50e73e=_0x111319[_0x7646('0x1d')]+_0x111319[_0x7646('0x1e')],_0x4c0d1d;if(_0x50e73e>=_0x1f29b6){_0x50e73e=_0x1f29b6;_0x4c0d1d=0xc8;}else{_0x4c0d1d=0xce;}_0x4a436f[_0x7646('0x1a')](_0x4c0d1d);return _0x4a436f[_0x7646('0x1f')](_0x7646('0x20'),_0x563685+'-'+_0x50e73e+'/'+_0x1f29b6)[_0x7646('0x1c')](_0x1452f1);}return null;};}function patchUpdates(_0x2a5611){return function(_0x52a8d3){try{jsonpatch['apply'](_0x52a8d3,_0x2a5611,!![]);}catch(_0x259210){return BPromise[_0x7646('0x21')](_0x259210);}return _0x52a8d3[_0x7646('0x22')]();};}function saveUpdates(_0x1db9ab,_0x4bd0cc){return function(_0x217414){if(_0x217414){return _0x217414[_0x7646('0x23')](_0x1db9ab)[_0x7646('0x24')](function(_0x55c10f){return _0x55c10f;});}return null;};}function removeEntity(_0x414429,_0x2a9e82){return function(_0x1cfe3a){if(_0x1cfe3a){return _0x1cfe3a[_0x7646('0x25')]()[_0x7646('0x24')](function(){_0x414429['status'](0xcc)[_0x7646('0x1b')]();});}};}function handleEntityNotFound(_0x400d3e,_0x367762){return function(_0x1b10b3){if(!_0x1b10b3){_0x400d3e[_0x7646('0x19')](0x194);}return _0x1b10b3;};}function handleError(_0x27b17c,_0x50d7a9){_0x50d7a9=_0x50d7a9||0x1f4;return function(_0x146faf){logger[_0x7646('0x26')](_0x146faf['stack']);if(_0x146faf[_0x7646('0x27')]){delete _0x146faf[_0x7646('0x27')];}_0x27b17c[_0x7646('0x1a')](_0x50d7a9)[_0x7646('0x28')](_0x146faf);};}exports[_0x7646('0x29')]=function(_0xaf6eb5,_0x534c34){var _0x202cc3={},_0x2b482f={},_0x564e10={'count':0x0,'rows':[]};var _0x240bb0=_[_0x7646('0x2a')](db[_0x7646('0x2b')]['rawAttributes'],function(_0x3c6100){return{'name':_0x3c6100['fieldName'],'type':_0x3c6100[_0x7646('0x2c')][_0x7646('0x2d')]};});_0x2b482f[_0x7646('0x2e')]=_['map'](_0x240bb0,_0x7646('0x27'));_0x2b482f['query']=_[_0x7646('0x2f')](_0xaf6eb5[_0x7646('0x30')]);_0x2b482f['filters']=_['intersection'](_0x2b482f[_0x7646('0x2e')],_0x2b482f[_0x7646('0x30')]);_0x202cc3['attributes']=_[_0x7646('0x31')](_0x2b482f[_0x7646('0x2e')],qs[_0x7646('0x32')](_0xaf6eb5[_0x7646('0x30')]['fields']));_0x202cc3[_0x7646('0x33')]=_0x202cc3[_0x7646('0x33')][_0x7646('0x34')]?_0x202cc3[_0x7646('0x33')]:_0x2b482f[_0x7646('0x2e')];if(!_0xaf6eb5[_0x7646('0x30')][_0x7646('0x35')](_0x7646('0x36'))){_0x202cc3[_0x7646('0x1e')]=qs[_0x7646('0x1e')](_0xaf6eb5[_0x7646('0x30')][_0x7646('0x1e')]);_0x202cc3[_0x7646('0x1d')]=qs[_0x7646('0x1d')](_0xaf6eb5[_0x7646('0x30')][_0x7646('0x1d')]);}_0x202cc3[_0x7646('0x37')]=qs[_0x7646('0x38')](_0xaf6eb5[_0x7646('0x30')][_0x7646('0x38')]);_0x202cc3[_0x7646('0x39')]=qs['filters'](_[_0x7646('0x3a')](_0xaf6eb5[_0x7646('0x30')],_0x2b482f[_0x7646('0x3b')]),_0x240bb0);if(_0xaf6eb5[_0x7646('0x30')][_0x7646('0x3c')]){_0x202cc3['where']=_[_0x7646('0x3d')](_0x202cc3['where'],{'$or':_['map'](_0x240bb0,function(_0x5e4f4f){if(_0x5e4f4f[_0x7646('0x2c')]!=='VIRTUAL'){var _0x5eda65={};_0x5eda65[_0x5e4f4f[_0x7646('0x27')]]={'$like':'%'+_0xaf6eb5[_0x7646('0x30')][_0x7646('0x3c')]+'%'};return _0x5eda65;}})});}_0x202cc3=_[_0x7646('0x3d')]({},_0x202cc3,_0xaf6eb5[_0x7646('0x3e')]);var _0x5c4802={'where':_0x202cc3[_0x7646('0x39')]};return db[_0x7646('0x2b')][_0x7646('0x3f')](_0x5c4802)[_0x7646('0x24')](function(_0x2146cd){_0x564e10[_0x7646('0x3f')]=_0x2146cd;if(_0xaf6eb5[_0x7646('0x30')][_0x7646('0x40')]){_0x202cc3['include']=[{'all':!![]}];}return db[_0x7646('0x2b')][_0x7646('0x41')](_0x202cc3);})[_0x7646('0x24')](function(_0xeb4a0e){_0x564e10['rows']=_0xeb4a0e;return _0x564e10;})[_0x7646('0x24')](respondWithFilteredResult(_0x534c34,_0x202cc3))['catch'](handleError(_0x534c34,null));};exports[_0x7646('0x42')]=function(_0x1ea65e,_0x90a5b6){var _0x28f25a={'raw':!![],'where':{'id':_0x1ea65e[_0x7646('0x43')]['id']}},_0x246927={};_0x246927[_0x7646('0x2e')]=_[_0x7646('0x2f')](db[_0x7646('0x2b')][_0x7646('0x44')]);_0x246927[_0x7646('0x30')]=_[_0x7646('0x2f')](_0x1ea65e[_0x7646('0x30')]);_0x246927[_0x7646('0x3b')]=_['intersection'](_0x246927['model'],_0x246927['query']);_0x28f25a['attributes']=_[_0x7646('0x31')](_0x246927[_0x7646('0x2e')],qs['fields'](_0x1ea65e[_0x7646('0x30')][_0x7646('0x32')]));_0x28f25a[_0x7646('0x33')]=_0x28f25a[_0x7646('0x33')][_0x7646('0x34')]?_0x28f25a[_0x7646('0x33')]:_0x246927['model'];if(_0x1ea65e['query'][_0x7646('0x40')]){_0x28f25a[_0x7646('0x45')]=[{'all':!![]}];}_0x28f25a=_[_0x7646('0x3d')]({},_0x28f25a,_0x1ea65e[_0x7646('0x3e')]);return db[_0x7646('0x2b')][_0x7646('0x46')](_0x28f25a)[_0x7646('0x24')](handleEntityNotFound(_0x90a5b6,null))[_0x7646('0x24')](respondWithResult(_0x90a5b6,null))[_0x7646('0x47')](handleError(_0x90a5b6,null));};exports[_0x7646('0x48')]=function(_0x3acc66,_0x2ba2f0){return db[_0x7646('0x2b')]['create'](_0x3acc66['body'],{})['then'](respondWithResult(_0x2ba2f0,0xc9))[_0x7646('0x47')](handleError(_0x2ba2f0,null));};exports[_0x7646('0x23')]=function(_0xe7099b,_0x1d2ddc){if(_0xe7099b[_0x7646('0x49')]['id']){delete _0xe7099b['body']['id'];}return db[_0x7646('0x2b')]['find']({'where':{'id':_0xe7099b['params']['id']}})[_0x7646('0x24')](handleEntityNotFound(_0x1d2ddc,null))[_0x7646('0x24')](saveUpdates(_0xe7099b[_0x7646('0x49')],null))[_0x7646('0x24')](respondWithResult(_0x1d2ddc,null))[_0x7646('0x47')](handleError(_0x1d2ddc,null));};exports[_0x7646('0x25')]=function(_0x2a10eb,_0x352c37){return db[_0x7646('0x2b')][_0x7646('0x46')]({'where':{'id':_0x2a10eb[_0x7646('0x43')]['id']}})['then'](handleEntityNotFound(_0x352c37,null))[_0x7646('0x24')](removeEntity(_0x352c37,null))[_0x7646('0x47')](handleError(_0x352c37,null));}; \ No newline at end of file +var _0xea6c=['../../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','limit','set','Content-Range','reject','save','then','error','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','where','pick','filter','merge','type','VIRTUAL','options','count','include','catch','show','params','includeAll','find','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis'];(function(_0x5134c0,_0x211628){var _0x22548c=function(_0x2ef405){while(--_0x2ef405){_0x5134c0['push'](_0x5134c0['shift']());}};_0x22548c(++_0x211628);}(_0xea6c,0x164));var _0xcea6=function(_0x100ffb,_0x5a8adc){_0x100ffb=_0x100ffb-0x0;var _0x54e870=_0xea6c[_0x100ffb];return _0x54e870;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcea6('0x0'));var rimraf=require(_0xcea6('0x1'));var zipdir=require(_0xcea6('0x2'));var jsonpatch=require(_0xcea6('0x3'));var rp=require(_0xcea6('0x4'));var moment=require(_0xcea6('0x5'));var BPromise=require(_0xcea6('0x6'));var Mustache=require(_0xcea6('0x7'));var util=require(_0xcea6('0x8'));var path=require(_0xcea6('0x9'));var sox=require(_0xcea6('0xa'));var csv=require('to-csv');var ejs=require(_0xcea6('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcea6('0xc'));var crypto=require(_0xcea6('0xd'));var jsforce=require(_0xcea6('0xe'));var deskjs=require(_0xcea6('0xf'));var toCsv=require(_0xcea6('0x10'));var querystring=require('querystring');var Papa=require(_0xcea6('0x11'));var Redis=require(_0xcea6('0x12'));var authService=require(_0xcea6('0x13'));var qs=require(_0xcea6('0x14'));var as=require(_0xcea6('0x15'));var hardwareService=require(_0xcea6('0x16'));var logger=require(_0xcea6('0x17'))(_0xcea6('0x18'));var utils=require(_0xcea6('0x19'));var config=require(_0xcea6('0x1a'));var licenseUtil=require(_0xcea6('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ae704,_0x44b6d3){_0x44b6d3=_0x44b6d3||0xcc;return function(_0x4dd936){if(_0x4dd936){return _0x1ae704[_0xcea6('0x1c')](_0x44b6d3);}return _0x1ae704[_0xcea6('0x1d')](_0x44b6d3)[_0xcea6('0x1e')]();};}function respondWithResult(_0x2d4967,_0x109f9c){_0x109f9c=_0x109f9c||0xc8;return function(_0xdc17){if(_0xdc17){return _0x2d4967['status'](_0x109f9c)[_0xcea6('0x1f')](_0xdc17);}};}function respondWithFilteredResult(_0x1bea40,_0x61fa13){return function(_0x56d51e){if(_0x56d51e){var _0x209afd=_0x56d51e['count'],_0x5c0532=_0x61fa13[_0xcea6('0x20')],_0x4744dc=_0x61fa13[_0xcea6('0x20')]+_0x61fa13[_0xcea6('0x21')],_0x233b3d;if(_0x4744dc>=_0x209afd){_0x4744dc=_0x209afd;_0x233b3d=0xc8;}else{_0x233b3d=0xce;}_0x1bea40[_0xcea6('0x1d')](_0x233b3d);return _0x1bea40[_0xcea6('0x22')](_0xcea6('0x23'),_0x5c0532+'-'+_0x4744dc+'/'+_0x209afd)[_0xcea6('0x1f')](_0x56d51e);}return null;};}function patchUpdates(_0x22afbb){return function(_0x2c5060){try{jsonpatch['apply'](_0x2c5060,_0x22afbb,!![]);}catch(_0x1b520e){return BPromise[_0xcea6('0x24')](_0x1b520e);}return _0x2c5060[_0xcea6('0x25')]();};}function saveUpdates(_0x54524c,_0x30a78){return function(_0x17dd0d){if(_0x17dd0d){return _0x17dd0d['update'](_0x54524c)['then'](function(_0x5564a8){return _0x5564a8;});}return null;};}function removeEntity(_0x20f063,_0x522619){return function(_0x58a148){if(_0x58a148){return _0x58a148['destroy']()[_0xcea6('0x26')](function(){_0x20f063[_0xcea6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaf9cf9,_0x4c56c5){return function(_0x5cf628){if(!_0x5cf628){_0xaf9cf9['sendStatus'](0x194);}return _0x5cf628;};}function handleError(_0x7f98bb,_0x3eda5f){_0x3eda5f=_0x3eda5f||0x1f4;return function(_0xdf22da){logger[_0xcea6('0x27')](_0xdf22da['stack']);if(_0xdf22da[_0xcea6('0x28')]){delete _0xdf22da[_0xcea6('0x28')];}_0x7f98bb[_0xcea6('0x1d')](_0x3eda5f)[_0xcea6('0x29')](_0xdf22da);};}exports[_0xcea6('0x2a')]=function(_0x3f0f21,_0x57cb5){var _0x2c46ed={},_0x33ac52={},_0xd0efce={'count':0x0,'rows':[]};var _0x295c40=_[_0xcea6('0x2b')](db[_0xcea6('0x2c')][_0xcea6('0x2d')],function(_0x2e3f4d){return{'name':_0x2e3f4d[_0xcea6('0x2e')],'type':_0x2e3f4d['type'][_0xcea6('0x2f')]};});_0x33ac52[_0xcea6('0x30')]=_['map'](_0x295c40,_0xcea6('0x28'));_0x33ac52[_0xcea6('0x31')]=_[_0xcea6('0x32')](_0x3f0f21['query']);_0x33ac52[_0xcea6('0x33')]=_['intersection'](_0x33ac52[_0xcea6('0x30')],_0x33ac52[_0xcea6('0x31')]);_0x2c46ed[_0xcea6('0x34')]=_[_0xcea6('0x35')](_0x33ac52[_0xcea6('0x30')],qs[_0xcea6('0x36')](_0x3f0f21['query'][_0xcea6('0x36')]));_0x2c46ed[_0xcea6('0x34')]=_0x2c46ed[_0xcea6('0x34')][_0xcea6('0x37')]?_0x2c46ed['attributes']:_0x33ac52[_0xcea6('0x30')];if(!_0x3f0f21[_0xcea6('0x31')][_0xcea6('0x38')]('nolimit')){_0x2c46ed[_0xcea6('0x21')]=qs['limit'](_0x3f0f21[_0xcea6('0x31')][_0xcea6('0x21')]);_0x2c46ed['offset']=qs[_0xcea6('0x20')](_0x3f0f21['query'][_0xcea6('0x20')]);}_0x2c46ed['order']=qs['sort'](_0x3f0f21['query']['sort']);_0x2c46ed[_0xcea6('0x39')]=qs[_0xcea6('0x33')](_[_0xcea6('0x3a')](_0x3f0f21[_0xcea6('0x31')],_0x33ac52['filters']),_0x295c40);if(_0x3f0f21[_0xcea6('0x31')][_0xcea6('0x3b')]){_0x2c46ed[_0xcea6('0x39')]=_[_0xcea6('0x3c')](_0x2c46ed['where'],{'$or':_['map'](_0x295c40,function(_0x375ac4){if(_0x375ac4[_0xcea6('0x3d')]!==_0xcea6('0x3e')){var _0x40181d={};_0x40181d[_0x375ac4[_0xcea6('0x28')]]={'$like':'%'+_0x3f0f21[_0xcea6('0x31')][_0xcea6('0x3b')]+'%'};return _0x40181d;}})});}_0x2c46ed=_[_0xcea6('0x3c')]({},_0x2c46ed,_0x3f0f21[_0xcea6('0x3f')]);var _0xaa7a58={'where':_0x2c46ed['where']};return db['FreshdeskField'][_0xcea6('0x40')](_0xaa7a58)[_0xcea6('0x26')](function(_0x2ce2eb){_0xd0efce[_0xcea6('0x40')]=_0x2ce2eb;if(_0x3f0f21[_0xcea6('0x31')]['includeAll']){_0x2c46ed[_0xcea6('0x41')]=[{'all':!![]}];}return db[_0xcea6('0x2c')]['findAll'](_0x2c46ed);})[_0xcea6('0x26')](function(_0x22011e){_0xd0efce['rows']=_0x22011e;return _0xd0efce;})[_0xcea6('0x26')](respondWithFilteredResult(_0x57cb5,_0x2c46ed))[_0xcea6('0x42')](handleError(_0x57cb5,null));};exports[_0xcea6('0x43')]=function(_0x3c5320,_0x3cffd3){var _0x2df4a5={'raw':!![],'where':{'id':_0x3c5320[_0xcea6('0x44')]['id']}},_0x5db762={};_0x5db762[_0xcea6('0x30')]=_['keys'](db[_0xcea6('0x2c')][_0xcea6('0x2d')]);_0x5db762[_0xcea6('0x31')]=_[_0xcea6('0x32')](_0x3c5320[_0xcea6('0x31')]);_0x5db762[_0xcea6('0x33')]=_[_0xcea6('0x35')](_0x5db762['model'],_0x5db762[_0xcea6('0x31')]);_0x2df4a5['attributes']=_[_0xcea6('0x35')](_0x5db762['model'],qs[_0xcea6('0x36')](_0x3c5320[_0xcea6('0x31')][_0xcea6('0x36')]));_0x2df4a5['attributes']=_0x2df4a5[_0xcea6('0x34')]['length']?_0x2df4a5[_0xcea6('0x34')]:_0x5db762[_0xcea6('0x30')];if(_0x3c5320[_0xcea6('0x31')][_0xcea6('0x45')]){_0x2df4a5[_0xcea6('0x41')]=[{'all':!![]}];}_0x2df4a5=_[_0xcea6('0x3c')]({},_0x2df4a5,_0x3c5320[_0xcea6('0x3f')]);return db['FreshdeskField'][_0xcea6('0x46')](_0x2df4a5)['then'](handleEntityNotFound(_0x3cffd3,null))[_0xcea6('0x26')](respondWithResult(_0x3cffd3,null))[_0xcea6('0x42')](handleError(_0x3cffd3,null));};exports[_0xcea6('0x47')]=function(_0x1b1232,_0x22ef28){return db[_0xcea6('0x2c')][_0xcea6('0x47')](_0x1b1232[_0xcea6('0x48')],{})[_0xcea6('0x26')](respondWithResult(_0x22ef28,0xc9))[_0xcea6('0x42')](handleError(_0x22ef28,null));};exports[_0xcea6('0x49')]=function(_0x462555,_0xec3e59){if(_0x462555[_0xcea6('0x48')]['id']){delete _0x462555[_0xcea6('0x48')]['id'];}return db[_0xcea6('0x2c')]['find']({'where':{'id':_0x462555[_0xcea6('0x44')]['id']}})['then'](handleEntityNotFound(_0xec3e59,null))[_0xcea6('0x26')](saveUpdates(_0x462555[_0xcea6('0x48')],null))[_0xcea6('0x26')](respondWithResult(_0xec3e59,null))[_0xcea6('0x42')](handleError(_0xec3e59,null));};exports[_0xcea6('0x4a')]=function(_0x204e67,_0x4a3fc3){return db[_0xcea6('0x2c')][_0xcea6('0x46')]({'where':{'id':_0x204e67[_0xcea6('0x44')]['id']}})[_0xcea6('0x26')](handleEntityNotFound(_0x4a3fc3,null))[_0xcea6('0x26')](removeEntity(_0x4a3fc3,null))[_0xcea6('0x42')](handleError(_0x4a3fc3,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 9322dba..132fb2c 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 _0x347d=['exports','define','FreshdeskField','freshdesk_unique_index','util','../../config/logger','api','bluebird','rimraf','./intFreshdeskField.attributes'];(function(_0xaf075e,_0x42d933){var _0xa584c9=function(_0x4a897c){while(--_0x4a897c){_0xaf075e['push'](_0xaf075e['shift']());}};_0xa584c9(++_0x42d933);}(_0x347d,0xfe));var _0xd347=function(_0x11d676,_0x18f7b6){_0x11d676=_0x11d676-0x0;var _0x599f98=_0x347d[_0x11d676];return _0x599f98;};'use strict';var _=require('lodash');var util=require(_0xd347('0x0'));var logger=require(_0xd347('0x1'))(_0xd347('0x2'));var moment=require('moment');var BPromise=require(_0xd347('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd347('0x4'));var config=require('../../config/environment');var attributes=require(_0xd347('0x5'));module[_0xd347('0x6')]=function(_0xe6f3df,_0x2aaab1){return _0xe6f3df[_0xd347('0x7')](_0xd347('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xd347('0x9'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x674c=['FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x674c,0xc5));var _0xc674=function(_0xa88469,_0x23f949){_0xa88469=_0xa88469-0x0;var _0x4e72a0=_0x674c[_0xa88469];return _0x4e72a0;};'use strict';var _=require(_0xc674('0x0'));var util=require(_0xc674('0x1'));var logger=require(_0xc674('0x2'))(_0xc674('0x3'));var moment=require(_0xc674('0x4'));var BPromise=require(_0xc674('0x5'));var rp=require(_0xc674('0x6'));var fs=require('fs');var path=require(_0xc674('0x7'));var rimraf=require('rimraf');var config=require(_0xc674('0x8'));var attributes=require(_0xc674('0x9'));module[_0xc674('0xa')]=function(_0x225696,_0x3fbaf8){return _0x225696['define'](_0xc674('0xb'),attributes,{'tableName':_0xc674('0xc'),'paranoid':![],'indexes':[{'name':_0xc674('0xd'),'fields':[_0xc674('0xe'),_0xc674('0xf')],'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 68bccb2..a0c2159 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 _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x49345c,_0x697343){var _0x283bf7=function(_0x19d10e){while(--_0x19d10e){_0x49345c['push'](_0x49345c['shift']());}};_0x283bf7(++_0x697343);}(_0xb10b,0x12a));var _0xbb10=function(_0x2a6490,_0x1adf0f){_0x2a6490=_0x2a6490-0x0;var _0x1b31df=_0xb10b[_0x2a6490];return _0x1b31df;};'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);});});} \ No newline at end of file +var _0x7a54=['info','FreshdeskField,\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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x2568fd,_0xb9fbd5){_0x2568fd=_0x2568fd-0x0;var _0x22fff7=_0x7a54[_0x2568fd];return _0x22fff7;};'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')]('FreshdeskField,\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/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 71133ee..4e3536b 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 _0x3af4=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x31d0c1,_0x58ce88){var _0x549610=function(_0x2d4240){while(--_0x2d4240){_0x31d0c1['push'](_0x31d0c1['shift']());}};_0x549610(++_0x58ce88);}(_0x3af4,0x1b1));var _0x43af=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x3af4[_0x36c5b0];return _0xf19333;};'use strict';var multer=require('multer');var util=require(_0x43af('0x0'));var path=require(_0x43af('0x1'));var timeout=require('connect-timeout');var express=require(_0x43af('0x2'));var router=express['Router']();var auth=require(_0x43af('0x3'));var interaction=require(_0x43af('0x4'));var config=require(_0x43af('0x5'));var controller=require('./intFreshsalesAccount.controller');router[_0x43af('0x6')]('/',auth[_0x43af('0x7')](),controller['index']);router[_0x43af('0x6')](_0x43af('0x8'),auth[_0x43af('0x7')](),controller[_0x43af('0x9')]);router['get'](_0x43af('0xa'),auth['isAuthenticated'](),controller[_0x43af('0xb')]);router[_0x43af('0x6')](_0x43af('0xc'),auth[_0x43af('0x7')](),controller[_0x43af('0xd')]);router[_0x43af('0xe')]('/',auth[_0x43af('0x7')](),controller[_0x43af('0xf')]);router[_0x43af('0xe')](_0x43af('0xa'),auth[_0x43af('0x7')](),controller[_0x43af('0x10')]);router[_0x43af('0x11')](_0x43af('0x8'),auth[_0x43af('0x7')](),controller[_0x43af('0x12')]);router[_0x43af('0x13')](_0x43af('0x8'),auth[_0x43af('0x7')](),controller[_0x43af('0x14')]);module['exports']=router; \ No newline at end of file +var _0x6bc1=['post','create','addConfiguration','/:id','update','delete','destroy','multer','path','Router','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','get','show','/:id/fields','getFields'];(function(_0xe93e59,_0x4535d8){var _0x1cc428=function(_0x505a3f){while(--_0x505a3f){_0xe93e59['push'](_0xe93e59['shift']());}};_0x1cc428(++_0x4535d8);}(_0x6bc1,0x115));var _0x16bc=function(_0x261f14,_0x48bca8){_0x261f14=_0x261f14-0x0;var _0x358626=_0x6bc1[_0x261f14];return _0x358626;};'use strict';var multer=require(_0x16bc('0x0'));var util=require('util');var path=require(_0x16bc('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x16bc('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x16bc('0x3'));var config=require(_0x16bc('0x4'));var controller=require(_0x16bc('0x5'));router['get']('/',auth[_0x16bc('0x6')](),controller['index']);router[_0x16bc('0x7')]('/:id',auth[_0x16bc('0x6')](),controller[_0x16bc('0x8')]);router[_0x16bc('0x7')]('/:id/configurations',auth[_0x16bc('0x6')](),controller['getConfigurations']);router[_0x16bc('0x7')](_0x16bc('0x9'),auth['isAuthenticated'](),controller[_0x16bc('0xa')]);router[_0x16bc('0xb')]('/',auth[_0x16bc('0x6')](),controller[_0x16bc('0xc')]);router['post']('/:id/configurations',auth[_0x16bc('0x6')](),controller[_0x16bc('0xd')]);router['put'](_0x16bc('0xe'),auth[_0x16bc('0x6')](),controller[_0x16bc('0xf')]);router[_0x16bc('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x16bc('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index eabe0a4..b93d74e 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 _0xd202=['remoteUri','sequelize','exports','STRING'];(function(_0x215f91,_0x42721a){var _0x396370=function(_0x2fbfd2){while(--_0x2fbfd2){_0x215f91['push'](_0x215f91['shift']());}};_0x396370(++_0x42721a);}(_0xd202,0x65));var _0x2d20=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd202[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0x2d20('0x0'));module[_0x2d20('0x1')]={'name':{'type':Sequelize[_0x2d20('0x2')]},'description':{'type':Sequelize[_0x2d20('0x2')]},'username':{'type':Sequelize[_0x2d20('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x2d20('0x2')]},'remoteUri':{'type':Sequelize[_0x2d20('0x2')],'unique':_0x2d20('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x9219=['STRING'];(function(_0x1559a5,_0x41924e){var _0x17a783=function(_0x152c63){while(--_0x152c63){_0x1559a5['push'](_0x1559a5['shift']());}};_0x17a783(++_0x41924e);}(_0x9219,0x19e));var _0x9921=function(_0x12f6f4,_0x1a84ed){_0x12f6f4=_0x12f6f4-0x0;var _0xed3688=_0x9219[_0x12f6f4];return _0xed3688;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9921('0x0')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9921('0x0')],'unique':'remoteUri'},'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 fedfc28..1e48b14 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 _0x6c76=['filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','intersection','include','find','create','body','params','getConfigurations','findOne','FreshsalesConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','substring','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','end','status','count','offset','limit','set','Content-Range','json','save','update','then','destroy','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x5ebb15,_0x5807dd){var _0x2b3160=function(_0x531a15){while(--_0x531a15){_0x5ebb15['push'](_0x5ebb15['shift']());}};_0x2b3160(++_0x5807dd);}(_0x6c76,0x184));var _0x66c7=function(_0x317a3d,_0xa3d8ad){_0x317a3d=_0x317a3d-0x0;var _0x41e886=_0x6c76[_0x317a3d];return _0x41e886;};'use strict';var pdf=require(_0x66c7('0x0'));var emlformat=require(_0x66c7('0x1'));var rimraf=require(_0x66c7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x66c7('0x3'));var rp=require(_0x66c7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x66c7('0x5'));var util=require(_0x66c7('0x6'));var path=require('path');var sox=require(_0x66c7('0x7'));var csv=require(_0x66c7('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x66c7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x66c7('0xa'));var deskjs=require(_0x66c7('0xb'));var toCsv=require(_0x66c7('0x8'));var querystring=require('querystring');var Papa=require(_0x66c7('0xc'));var Redis=require(_0x66c7('0xd'));var authService=require(_0x66c7('0xe'));var qs=require(_0x66c7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66c7('0x10'));var logger=require(_0x66c7('0x11'))(_0x66c7('0x12'));var utils=require(_0x66c7('0x13'));var config=require(_0x66c7('0x14'));var licenseUtil=require(_0x66c7('0x15'));var db=require(_0x66c7('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x66c7('0x17'));var client=jayson[_0x66c7('0x18')][_0x66c7('0x19')]({'port':0x232a});function respondWithRpcPromise(_0xea3f56,_0x4f6c91,_0x1e91d1,_0x618bd7){return new BPromise(function(_0xf3b04,_0x6400fe){var _0x5d44e1=_0x618bd7||client;return _0x5d44e1[_0x66c7('0x1a')](_0xea3f56,_0x1e91d1)['then'](function(_0x208010){logger[_0x66c7('0x1b')](_0x66c7('0x1c'),_0x4f6c91,_0x66c7('0x1d'));logger[_0x66c7('0x1e')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4f6c91,'request\x20sent',JSON['stringify'](_0x208010));if(_0x208010['error']){if(_0x208010[_0x66c7('0x1f')][_0x66c7('0x20')]===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x4f6c91,_0x208010[_0x66c7('0x1f')][_0x66c7('0x21')]);return _0x6400fe(_0x208010[_0x66c7('0x1f')][_0x66c7('0x21')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x4f6c91,_0x208010[_0x66c7('0x1f')][_0x66c7('0x21')]);return _0xf3b04(_0x208010[_0x66c7('0x1f')][_0x66c7('0x21')]);}else{logger[_0x66c7('0x1b')](_0x66c7('0x1c'),_0x4f6c91,'request\x20sent');_0xf3b04(_0x208010[_0x66c7('0x22')][_0x66c7('0x21')]);}})['catch'](function(_0x7462f1){logger[_0x66c7('0x1f')](_0x66c7('0x1c'),_0x4f6c91,_0x7462f1);_0x6400fe(_0x7462f1);});});}function respondWithStatusCode(_0x1fc9d3,_0x5bfaf6){_0x5bfaf6=_0x5bfaf6||0xcc;return function(_0x2736df){if(_0x2736df){return _0x1fc9d3[_0x66c7('0x23')](_0x5bfaf6);}return _0x1fc9d3['status'](_0x5bfaf6)[_0x66c7('0x24')]();};}function respondWithResult(_0x11a6b9,_0x2bb86d){_0x2bb86d=_0x2bb86d||0xc8;return function(_0x2ef6a2){if(_0x2ef6a2){return _0x11a6b9[_0x66c7('0x25')](_0x2bb86d)['json'](_0x2ef6a2);}};}function respondWithFilteredResult(_0x5bc4e6,_0x4e514a){return function(_0x2dd131){if(_0x2dd131){var _0x542ff1=_0x2dd131[_0x66c7('0x26')],_0x5c5e42=_0x4e514a[_0x66c7('0x27')],_0x9afd50=_0x4e514a[_0x66c7('0x27')]+_0x4e514a[_0x66c7('0x28')],_0x3e979d;if(_0x9afd50>=_0x542ff1){_0x9afd50=_0x542ff1;_0x3e979d=0xc8;}else{_0x3e979d=0xce;}_0x5bc4e6['status'](_0x3e979d);return _0x5bc4e6[_0x66c7('0x29')](_0x66c7('0x2a'),_0x5c5e42+'-'+_0x9afd50+'/'+_0x542ff1)[_0x66c7('0x2b')](_0x2dd131);}return null;};}function patchUpdates(_0x33be23){return function(_0x2042ea){try{jsonpatch['apply'](_0x2042ea,_0x33be23,!![]);}catch(_0x263b48){return BPromise['reject'](_0x263b48);}return _0x2042ea[_0x66c7('0x2c')]();};}function saveUpdates(_0x543fbf,_0x296875){return function(_0x45619c){if(_0x45619c){return _0x45619c[_0x66c7('0x2d')](_0x543fbf)[_0x66c7('0x2e')](function(_0xb26028){return _0xb26028;});}return null;};}function removeEntity(_0x24e776,_0x559ab9){return function(_0x520bd2){if(_0x520bd2){return _0x520bd2[_0x66c7('0x2f')]()[_0x66c7('0x2e')](function(){_0x24e776[_0x66c7('0x25')](0xcc)[_0x66c7('0x24')]();});}};}function handleEntityNotFound(_0x344345,_0x131f24){return function(_0x44dcde){if(!_0x44dcde){_0x344345[_0x66c7('0x23')](0x194);}return _0x44dcde;};}function handleError(_0x15edc8,_0x301495){_0x301495=_0x301495||0x1f4;return function(_0x1fd460){logger[_0x66c7('0x1f')](_0x1fd460['stack']);if(_0x1fd460['name']){delete _0x1fd460[_0x66c7('0x30')];}_0x15edc8[_0x66c7('0x25')](_0x301495)[_0x66c7('0x31')](_0x1fd460);};}exports[_0x66c7('0x32')]=function(_0x45050c,_0x2bf7c2){var _0x21d0d3={},_0x5503c3={},_0x30b90f={'count':0x0,'rows':[]};var _0x33b7ff=_[_0x66c7('0x33')](db[_0x66c7('0x34')][_0x66c7('0x35')],function(_0x324696){return{'name':_0x324696[_0x66c7('0x36')],'type':_0x324696[_0x66c7('0x37')][_0x66c7('0x38')]};});_0x5503c3[_0x66c7('0x39')]=_[_0x66c7('0x33')](_0x33b7ff,'name');_0x5503c3['query']=_[_0x66c7('0x3a')](_0x45050c[_0x66c7('0x3b')]);_0x5503c3[_0x66c7('0x3c')]=_['intersection'](_0x5503c3['model'],_0x5503c3[_0x66c7('0x3b')]);_0x21d0d3[_0x66c7('0x3d')]=_['intersection'](_0x5503c3[_0x66c7('0x39')],qs[_0x66c7('0x3e')](_0x45050c[_0x66c7('0x3b')]['fields']));_0x21d0d3[_0x66c7('0x3d')]=_0x21d0d3[_0x66c7('0x3d')][_0x66c7('0x3f')]?_0x21d0d3[_0x66c7('0x3d')]:_0x5503c3[_0x66c7('0x39')];if(!_0x45050c[_0x66c7('0x3b')][_0x66c7('0x40')](_0x66c7('0x41'))){_0x21d0d3[_0x66c7('0x28')]=qs['limit'](_0x45050c[_0x66c7('0x3b')][_0x66c7('0x28')]);_0x21d0d3[_0x66c7('0x27')]=qs[_0x66c7('0x27')](_0x45050c[_0x66c7('0x3b')][_0x66c7('0x27')]);}_0x21d0d3[_0x66c7('0x42')]=qs[_0x66c7('0x43')](_0x45050c[_0x66c7('0x3b')][_0x66c7('0x43')]);_0x21d0d3['where']=qs['filters'](_['pick'](_0x45050c[_0x66c7('0x3b')],_0x5503c3[_0x66c7('0x3c')]),_0x33b7ff);if(_0x45050c['query']['filter']){_0x21d0d3[_0x66c7('0x44')]=_[_0x66c7('0x45')](_0x21d0d3[_0x66c7('0x44')],{'$or':_[_0x66c7('0x33')](_0x33b7ff,function(_0x2c5269){if(_0x2c5269['type']!==_0x66c7('0x46')){var _0x4b05d8={};_0x4b05d8[_0x2c5269['name']]={'$like':'%'+_0x45050c[_0x66c7('0x3b')][_0x66c7('0x47')]+'%'};return _0x4b05d8;}})});}_0x21d0d3=_[_0x66c7('0x45')]({},_0x21d0d3,_0x45050c[_0x66c7('0x48')]);var _0x519f10={'where':_0x21d0d3['where']};return db[_0x66c7('0x34')]['count'](_0x519f10)['then'](function(_0x1ec272){_0x30b90f[_0x66c7('0x26')]=_0x1ec272;if(_0x45050c[_0x66c7('0x3b')][_0x66c7('0x49')]){_0x21d0d3['include']=[{'all':!![]}];}return db[_0x66c7('0x34')][_0x66c7('0x4a')](_0x21d0d3);})[_0x66c7('0x2e')](function(_0x4f4590){_0x30b90f[_0x66c7('0x4b')]=_0x4f4590;return _0x30b90f;})[_0x66c7('0x2e')](respondWithFilteredResult(_0x2bf7c2,_0x21d0d3))[_0x66c7('0x4c')](handleError(_0x2bf7c2,null));};exports[_0x66c7('0x4d')]=function(_0x1b78a6,_0x3b4f34){var _0x2e3f06={'raw':![],'where':{'id':_0x1b78a6['params']['id']}},_0x465a3d={};_0x465a3d[_0x66c7('0x39')]=_[_0x66c7('0x3a')](db[_0x66c7('0x34')][_0x66c7('0x35')]);_0x465a3d[_0x66c7('0x3b')]=_[_0x66c7('0x3a')](_0x1b78a6[_0x66c7('0x3b')]);_0x465a3d[_0x66c7('0x3c')]=_[_0x66c7('0x4e')](_0x465a3d[_0x66c7('0x39')],_0x465a3d[_0x66c7('0x3b')]);_0x2e3f06[_0x66c7('0x3d')]=_[_0x66c7('0x4e')](_0x465a3d[_0x66c7('0x39')],qs['fields'](_0x1b78a6[_0x66c7('0x3b')][_0x66c7('0x3e')]));_0x2e3f06[_0x66c7('0x3d')]=_0x2e3f06[_0x66c7('0x3d')]['length']?_0x2e3f06[_0x66c7('0x3d')]:_0x465a3d[_0x66c7('0x39')];if(_0x1b78a6['query'][_0x66c7('0x49')]){_0x2e3f06[_0x66c7('0x4f')]=[{'all':!![]}];}_0x2e3f06=_[_0x66c7('0x45')]({},_0x2e3f06,_0x1b78a6[_0x66c7('0x48')]);return db[_0x66c7('0x34')][_0x66c7('0x50')](_0x2e3f06)[_0x66c7('0x2e')](handleEntityNotFound(_0x3b4f34,null))['then'](respondWithResult(_0x3b4f34,null))[_0x66c7('0x4c')](handleError(_0x3b4f34,null));};exports[_0x66c7('0x51')]=function(_0x4a619d,_0x127dfe){return db[_0x66c7('0x34')][_0x66c7('0x51')](_0x4a619d['body'],{})[_0x66c7('0x2e')](respondWithResult(_0x127dfe,0xc9))[_0x66c7('0x4c')](handleError(_0x127dfe,null));};exports[_0x66c7('0x2d')]=function(_0x187623,_0x35f5a0){if(_0x187623[_0x66c7('0x52')]['id']){delete _0x187623[_0x66c7('0x52')]['id'];}return db[_0x66c7('0x34')]['find']({'where':{'id':_0x187623[_0x66c7('0x53')]['id']}})[_0x66c7('0x2e')](handleEntityNotFound(_0x35f5a0,null))['then'](saveUpdates(_0x187623[_0x66c7('0x52')],null))[_0x66c7('0x2e')](respondWithResult(_0x35f5a0,null))[_0x66c7('0x4c')](handleError(_0x35f5a0,null));};exports['destroy']=function(_0x572b91,_0x1f2695){return db['FreshsalesAccount'][_0x66c7('0x50')]({'where':{'id':_0x572b91[_0x66c7('0x53')]['id']}})[_0x66c7('0x2e')](handleEntityNotFound(_0x1f2695,null))[_0x66c7('0x2e')](removeEntity(_0x1f2695,null))[_0x66c7('0x4c')](handleError(_0x1f2695,null));};exports[_0x66c7('0x54')]=function(_0x5b35cf,_0x58f938,_0x477e46){var _0x3c3c63={};var _0x5e6e32={};var _0x5a4908;var _0x157369;return db['FreshsalesAccount'][_0x66c7('0x55')]({'where':{'id':_0x5b35cf[_0x66c7('0x53')]['id']}})[_0x66c7('0x2e')](handleEntityNotFound(_0x58f938,null))[_0x66c7('0x2e')](function(_0x5c3717){if(_0x5c3717){_0x5a4908=_0x5c3717;_0x5e6e32[_0x66c7('0x39')]=_[_0x66c7('0x3a')](db[_0x66c7('0x56')][_0x66c7('0x35')]);_0x5e6e32[_0x66c7('0x3b')]=_[_0x66c7('0x3a')](_0x5b35cf['query']);_0x5e6e32[_0x66c7('0x3c')]=_[_0x66c7('0x4e')](_0x5e6e32[_0x66c7('0x39')],_0x5e6e32['query']);_0x3c3c63[_0x66c7('0x3d')]=_['intersection'](_0x5e6e32[_0x66c7('0x39')],qs[_0x66c7('0x3e')](_0x5b35cf[_0x66c7('0x3b')][_0x66c7('0x3e')]));_0x3c3c63[_0x66c7('0x3d')]=_0x3c3c63[_0x66c7('0x3d')]['length']?_0x3c3c63[_0x66c7('0x3d')]:_0x5e6e32[_0x66c7('0x39')];_0x3c3c63[_0x66c7('0x42')]=qs[_0x66c7('0x43')](_0x5b35cf[_0x66c7('0x3b')]['sort']);_0x3c3c63[_0x66c7('0x44')]=qs[_0x66c7('0x3c')](_[_0x66c7('0x57')](_0x5b35cf[_0x66c7('0x3b')],_0x5e6e32[_0x66c7('0x3c')]));if(_0x5b35cf[_0x66c7('0x3b')][_0x66c7('0x47')]){_0x3c3c63[_0x66c7('0x44')]=_[_0x66c7('0x45')](_0x3c3c63[_0x66c7('0x44')],{'$or':_[_0x66c7('0x33')](_0x3c3c63[_0x66c7('0x3d')],function(_0x50f72d){var _0x15fd0e={};_0x15fd0e[_0x50f72d]={'$like':'%'+_0x5b35cf[_0x66c7('0x3b')][_0x66c7('0x47')]+'%'};return _0x15fd0e;})});}_0x3c3c63=_[_0x66c7('0x45')]({},_0x3c3c63,_0x5b35cf[_0x66c7('0x48')]);return _0x5a4908[_0x66c7('0x54')](_0x3c3c63);}})[_0x66c7('0x2e')](function(_0x50be12){if(_0x50be12){_0x157369=_0x50be12[_0x66c7('0x3f')];if(!_0x5b35cf[_0x66c7('0x3b')][_0x66c7('0x40')](_0x66c7('0x41'))){_0x3c3c63[_0x66c7('0x28')]=qs[_0x66c7('0x28')](_0x5b35cf[_0x66c7('0x3b')][_0x66c7('0x28')]);_0x3c3c63[_0x66c7('0x27')]=qs[_0x66c7('0x27')](_0x5b35cf[_0x66c7('0x3b')][_0x66c7('0x27')]);}return _0x5a4908[_0x66c7('0x54')](_0x3c3c63);}})[_0x66c7('0x2e')](function(_0x2b25e7){if(_0x2b25e7){return _0x2b25e7?{'count':_0x157369,'rows':_0x2b25e7}:null;}})[_0x66c7('0x2e')](respondWithResult(_0x58f938,null))['catch'](handleError(_0x58f938,null));};exports[_0x66c7('0x58')]=function(_0x31bc19,_0x43a623,_0x153714){if(_0x31bc19[_0x66c7('0x52')]['id']){delete _0x31bc19[_0x66c7('0x52')]['id'];}return db[_0x66c7('0x34')][_0x66c7('0x55')]({'where':{'id':_0x31bc19[_0x66c7('0x53')]['id']}})[_0x66c7('0x2e')](handleEntityNotFound(_0x43a623,null))[_0x66c7('0x2e')](function(_0x326a6c){if(_0x326a6c){_0x31bc19[_0x66c7('0x52')][_0x66c7('0x59')]=_0x326a6c['id'];_0x31bc19[_0x66c7('0x52')][_0x66c7('0x5a')]=integrations[_0x66c7('0x5b')](_0x31bc19['body'][_0x66c7('0x5c')],_0x31bc19[_0x66c7('0x52')][_0x66c7('0x37')]);_0x31bc19[_0x66c7('0x52')][_0x66c7('0x5d')]=integrations[_0x66c7('0x5e')](_0x31bc19['body']['channel'],_0x31bc19[_0x66c7('0x52')]['type']);return db[_0x66c7('0x56')][_0x66c7('0x51')](_0x31bc19[_0x66c7('0x52')],{'include':[{'model':db[_0x66c7('0x5f')],'as':_0x66c7('0x5a')},{'model':db[_0x66c7('0x5f')],'as':_0x66c7('0x5d')}]});}return null;})[_0x66c7('0x2e')](respondWithResult(_0x43a623,null))[_0x66c7('0x4c')](handleError(_0x43a623,null));};exports[_0x66c7('0x60')]=function(_0x3b8a45,_0x11cc81,_0x552e67){var _0x25f193='';var _0x2b4f98='';return db[_0x66c7('0x34')][_0x66c7('0x55')]({'where':{'id':_0x3b8a45['params']['id']},'attributes':['id',_0x66c7('0x61'),_0x66c7('0x62'),'apiKey']})[_0x66c7('0x2e')](handleEntityNotFound(_0x11cc81,null))[_0x66c7('0x2e')](function(_0x3f25c0){if(_0x3f25c0){_0x2b4f98=_0x3f25c0[_0x66c7('0x61')];_0x25f193=_0x3f25c0[_0x66c7('0x62')];var _0x375c97=_0x3f25c0['remoteUri']['slice'](-0x1);if(_0x375c97==='/'){_0x25f193=_0x25f193[_0x66c7('0x63')](0x0,_0x25f193['lastIndexOf'](_0x375c97));}return rp({'method':'GET','uri':util[_0x66c7('0x64')](_0x66c7('0x65'),_0x25f193,_0x66c7('0x66')),'headers':{'Authorization':_0x66c7('0x67')+_0x3f25c0[_0x66c7('0x68')]},'json':!![]});}})[_0x66c7('0x2e')](function(_0x11de69){if(_0x11de69){var _0x41b4f0=_0x11de69['users'];var _0x3a216e=![];var _0x508e2c=null;for(_0x508e2c=0x0;_0x508e2c<_0x41b4f0[_0x66c7('0x3f')];_0x508e2c++){if(_0x41b4f0[_0x508e2c][_0x66c7('0x69')]===_0x2b4f98){_0x3a216e=!![];}}if(_0x3a216e){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x66c7('0x6a')});}}})[_0x66c7('0x2e')](respondWithResult(_0x11cc81,null))[_0x66c7('0x4c')](function(_0x44a672){var _0x46b54f=_0x3b8a45[_0x66c7('0x3b')][_0x66c7('0x6b')]?0x1f4:_0x44a672[_0x66c7('0x6c')]||0x1f4;logger[_0x66c7('0x1f')](_0x66c7('0x6d'),_0x66c7('0x60'),_0x46b54f,JSON[_0x66c7('0x6e')](_0x44a672));delete _0x44a672[_0x66c7('0x30')];if(_0x46b54f===0x191){_0x46b54f=0x190;}_0x11cc81[_0x66c7('0x25')](_0x46b54f)[_0x66c7('0x31')](_0x3b8a45[_0x66c7('0x3b')][_0x66c7('0x6b')]?{'message':_0x66c7('0x6f'),'statusCode':_0x44a672[_0x66c7('0x6c')]}:_0x44a672);});}; \ No newline at end of file +var _0x76dc=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','FreshsalesAccount','count','includeAll','include','findAll','rows','params','create','body','find','destroy','findOne','FreshsalesConfiguration','keys','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','FreshsalesField','Subjects','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','status','end','json','offset','limit','set','apply','reject','save','update','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes'];(function(_0x16662c,_0x53f319){var _0x541a02=function(_0x196ae9){while(--_0x196ae9){_0x16662c['push'](_0x16662c['shift']());}};_0x541a02(++_0x53f319);}(_0x76dc,0x1f2));var _0xc76d=function(_0x192d41,_0x5133ac){_0x192d41=_0x192d41-0x0;var _0x1232af=_0x76dc[_0x192d41];return _0x1232af;};'use strict';var pdf=require(_0xc76d('0x0'));var emlformat=require(_0xc76d('0x1'));var rimraf=require(_0xc76d('0x2'));var zipdir=require(_0xc76d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc76d('0x4'));var moment=require(_0xc76d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc76d('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc76d('0x7'));var csv=require(_0xc76d('0x8'));var ejs=require(_0xc76d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc76d('0xa'));var jsforce=require(_0xc76d('0xb'));var deskjs=require(_0xc76d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc76d('0xd'));var Redis=require(_0xc76d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc76d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc76d('0x10'));var logger=require(_0xc76d('0x11'))(_0xc76d('0x12'));var utils=require(_0xc76d('0x13'));var config=require(_0xc76d('0x14'));var licenseUtil=require(_0xc76d('0x15'));var db=require(_0xc76d('0x16'))['db'];var integrations=require(_0xc76d('0x17'));var jayson=require(_0xc76d('0x18'));var client=jayson[_0xc76d('0x19')][_0xc76d('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x24e88e,_0x1904ef,_0x3ed1bd,_0x5cda20){return new BPromise(function(_0x8696db,_0x2e9ec7){var _0x5bbed9=_0x5cda20||client;return _0x5bbed9[_0xc76d('0x1b')](_0x24e88e,_0x3ed1bd)[_0xc76d('0x1c')](function(_0x47a4ee){logger[_0xc76d('0x1d')]('FreshsalesAccount,\x20%s,\x20%s',_0x1904ef,_0xc76d('0x1e'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x1904ef,_0xc76d('0x1e'),JSON[_0xc76d('0x1f')](_0x47a4ee));if(_0x47a4ee[_0xc76d('0x20')]){if(_0x47a4ee[_0xc76d('0x20')][_0xc76d('0x21')]===0x1f4){logger['error'](_0xc76d('0x22'),_0x1904ef,_0x47a4ee[_0xc76d('0x20')][_0xc76d('0x23')]);return _0x2e9ec7(_0x47a4ee[_0xc76d('0x20')][_0xc76d('0x23')]);}logger['error'](_0xc76d('0x22'),_0x1904ef,_0x47a4ee[_0xc76d('0x20')]['message']);return _0x8696db(_0x47a4ee[_0xc76d('0x20')][_0xc76d('0x23')]);}else{logger[_0xc76d('0x1d')](_0xc76d('0x22'),_0x1904ef,_0xc76d('0x1e'));_0x8696db(_0x47a4ee[_0xc76d('0x24')][_0xc76d('0x23')]);}})[_0xc76d('0x25')](function(_0xbebde6){logger[_0xc76d('0x20')](_0xc76d('0x22'),_0x1904ef,_0xbebde6);_0x2e9ec7(_0xbebde6);});});}function respondWithStatusCode(_0x5de11f,_0x11b42f){_0x11b42f=_0x11b42f||0xcc;return function(_0x17b46f){if(_0x17b46f){return _0x5de11f['sendStatus'](_0x11b42f);}return _0x5de11f[_0xc76d('0x26')](_0x11b42f)[_0xc76d('0x27')]();};}function respondWithResult(_0x55ca79,_0x374b9e){_0x374b9e=_0x374b9e||0xc8;return function(_0x476aee){if(_0x476aee){return _0x55ca79[_0xc76d('0x26')](_0x374b9e)[_0xc76d('0x28')](_0x476aee);}};}function respondWithFilteredResult(_0xfc4aea,_0x1949c4){return function(_0x89ee5){if(_0x89ee5){var _0x59ebd1=_0x89ee5['count'],_0x59dabf=_0x1949c4[_0xc76d('0x29')],_0x285430=_0x1949c4[_0xc76d('0x29')]+_0x1949c4[_0xc76d('0x2a')],_0x287ae4;if(_0x285430>=_0x59ebd1){_0x285430=_0x59ebd1;_0x287ae4=0xc8;}else{_0x287ae4=0xce;}_0xfc4aea['status'](_0x287ae4);return _0xfc4aea[_0xc76d('0x2b')]('Content-Range',_0x59dabf+'-'+_0x285430+'/'+_0x59ebd1)[_0xc76d('0x28')](_0x89ee5);}return null;};}function patchUpdates(_0x18a7fa){return function(_0x4d896c){try{jsonpatch[_0xc76d('0x2c')](_0x4d896c,_0x18a7fa,!![]);}catch(_0x1c68f3){return BPromise[_0xc76d('0x2d')](_0x1c68f3);}return _0x4d896c[_0xc76d('0x2e')]();};}function saveUpdates(_0x4feeda,_0x283e16){return function(_0x4a7e4c){if(_0x4a7e4c){return _0x4a7e4c[_0xc76d('0x2f')](_0x4feeda)['then'](function(_0x30769f){return _0x30769f;});}return null;};}function removeEntity(_0x39127c,_0x5dc369){return function(_0x4b4dfc){if(_0x4b4dfc){return _0x4b4dfc['destroy']()['then'](function(){_0x39127c[_0xc76d('0x26')](0xcc)[_0xc76d('0x27')]();});}};}function handleEntityNotFound(_0x5c13f2,_0x28236c){return function(_0x1b2ed1){if(!_0x1b2ed1){_0x5c13f2['sendStatus'](0x194);}return _0x1b2ed1;};}function handleError(_0x18523e,_0x55e825){_0x55e825=_0x55e825||0x1f4;return function(_0x854920){logger['error'](_0x854920[_0xc76d('0x30')]);if(_0x854920[_0xc76d('0x31')]){delete _0x854920[_0xc76d('0x31')];}_0x18523e[_0xc76d('0x26')](_0x55e825)[_0xc76d('0x32')](_0x854920);};}exports['index']=function(_0xc2765c,_0x371306){var _0x32d04c={},_0x4ed918={},_0x2f69c1={'count':0x0,'rows':[]};var _0x10a6b1=_[_0xc76d('0x33')](db['FreshsalesAccount'][_0xc76d('0x34')],function(_0x567a2c){return{'name':_0x567a2c[_0xc76d('0x35')],'type':_0x567a2c[_0xc76d('0x36')][_0xc76d('0x37')]};});_0x4ed918[_0xc76d('0x38')]=_['map'](_0x10a6b1,'name');_0x4ed918[_0xc76d('0x39')]=_['keys'](_0xc2765c[_0xc76d('0x39')]);_0x4ed918[_0xc76d('0x3a')]=_[_0xc76d('0x3b')](_0x4ed918[_0xc76d('0x38')],_0x4ed918['query']);_0x32d04c['attributes']=_[_0xc76d('0x3b')](_0x4ed918[_0xc76d('0x38')],qs[_0xc76d('0x3c')](_0xc2765c[_0xc76d('0x39')][_0xc76d('0x3c')]));_0x32d04c['attributes']=_0x32d04c[_0xc76d('0x3d')][_0xc76d('0x3e')]?_0x32d04c[_0xc76d('0x3d')]:_0x4ed918[_0xc76d('0x38')];if(!_0xc2765c[_0xc76d('0x39')][_0xc76d('0x3f')](_0xc76d('0x40'))){_0x32d04c[_0xc76d('0x2a')]=qs[_0xc76d('0x2a')](_0xc2765c[_0xc76d('0x39')]['limit']);_0x32d04c['offset']=qs[_0xc76d('0x29')](_0xc2765c[_0xc76d('0x39')][_0xc76d('0x29')]);}_0x32d04c[_0xc76d('0x41')]=qs['sort'](_0xc2765c['query'][_0xc76d('0x42')]);_0x32d04c[_0xc76d('0x43')]=qs[_0xc76d('0x3a')](_[_0xc76d('0x44')](_0xc2765c[_0xc76d('0x39')],_0x4ed918[_0xc76d('0x3a')]),_0x10a6b1);if(_0xc2765c[_0xc76d('0x39')][_0xc76d('0x45')]){_0x32d04c['where']=_[_0xc76d('0x46')](_0x32d04c[_0xc76d('0x43')],{'$or':_[_0xc76d('0x33')](_0x10a6b1,function(_0x243af5){if(_0x243af5['type']!=='VIRTUAL'){var _0x4bf591={};_0x4bf591[_0x243af5['name']]={'$like':'%'+_0xc2765c['query']['filter']+'%'};return _0x4bf591;}})});}_0x32d04c=_['merge']({},_0x32d04c,_0xc2765c[_0xc76d('0x47')]);var _0x122a52={'where':_0x32d04c[_0xc76d('0x43')]};return db[_0xc76d('0x48')][_0xc76d('0x49')](_0x122a52)[_0xc76d('0x1c')](function(_0x7ba760){_0x2f69c1[_0xc76d('0x49')]=_0x7ba760;if(_0xc2765c['query'][_0xc76d('0x4a')]){_0x32d04c[_0xc76d('0x4b')]=[{'all':!![]}];}return db[_0xc76d('0x48')][_0xc76d('0x4c')](_0x32d04c);})[_0xc76d('0x1c')](function(_0x166be4){_0x2f69c1[_0xc76d('0x4d')]=_0x166be4;return _0x2f69c1;})[_0xc76d('0x1c')](respondWithFilteredResult(_0x371306,_0x32d04c))[_0xc76d('0x25')](handleError(_0x371306,null));};exports['show']=function(_0x5b41d3,_0x144d09){var _0x170f47={'raw':![],'where':{'id':_0x5b41d3[_0xc76d('0x4e')]['id']}},_0x2fa905={};_0x2fa905[_0xc76d('0x38')]=_['keys'](db[_0xc76d('0x48')][_0xc76d('0x34')]);_0x2fa905['query']=_['keys'](_0x5b41d3[_0xc76d('0x39')]);_0x2fa905[_0xc76d('0x3a')]=_['intersection'](_0x2fa905[_0xc76d('0x38')],_0x2fa905[_0xc76d('0x39')]);_0x170f47[_0xc76d('0x3d')]=_[_0xc76d('0x3b')](_0x2fa905[_0xc76d('0x38')],qs[_0xc76d('0x3c')](_0x5b41d3[_0xc76d('0x39')][_0xc76d('0x3c')]));_0x170f47[_0xc76d('0x3d')]=_0x170f47[_0xc76d('0x3d')]['length']?_0x170f47[_0xc76d('0x3d')]:_0x2fa905[_0xc76d('0x38')];if(_0x5b41d3[_0xc76d('0x39')]['includeAll']){_0x170f47[_0xc76d('0x4b')]=[{'all':!![]}];}_0x170f47=_[_0xc76d('0x46')]({},_0x170f47,_0x5b41d3['options']);return db[_0xc76d('0x48')]['find'](_0x170f47)[_0xc76d('0x1c')](handleEntityNotFound(_0x144d09,null))[_0xc76d('0x1c')](respondWithResult(_0x144d09,null))[_0xc76d('0x25')](handleError(_0x144d09,null));};exports[_0xc76d('0x4f')]=function(_0x14ef42,_0x4a1e17){return db['FreshsalesAccount']['create'](_0x14ef42[_0xc76d('0x50')],{})[_0xc76d('0x1c')](respondWithResult(_0x4a1e17,0xc9))[_0xc76d('0x25')](handleError(_0x4a1e17,null));};exports[_0xc76d('0x2f')]=function(_0x3465c4,_0x38bf54){if(_0x3465c4['body']['id']){delete _0x3465c4[_0xc76d('0x50')]['id'];}return db[_0xc76d('0x48')][_0xc76d('0x51')]({'where':{'id':_0x3465c4[_0xc76d('0x4e')]['id']}})[_0xc76d('0x1c')](handleEntityNotFound(_0x38bf54,null))['then'](saveUpdates(_0x3465c4[_0xc76d('0x50')],null))[_0xc76d('0x1c')](respondWithResult(_0x38bf54,null))[_0xc76d('0x25')](handleError(_0x38bf54,null));};exports[_0xc76d('0x52')]=function(_0x36b002,_0x2b289d){return db['FreshsalesAccount'][_0xc76d('0x51')]({'where':{'id':_0x36b002[_0xc76d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2b289d,null))['then'](removeEntity(_0x2b289d,null))[_0xc76d('0x25')](handleError(_0x2b289d,null));};exports['getConfigurations']=function(_0xcd5f35,_0x41e514,_0x12b287){var _0xfe2be1={};var _0x254128={};var _0x4746a5;var _0x106c85;return db[_0xc76d('0x48')][_0xc76d('0x53')]({'where':{'id':_0xcd5f35[_0xc76d('0x4e')]['id']}})[_0xc76d('0x1c')](handleEntityNotFound(_0x41e514,null))[_0xc76d('0x1c')](function(_0x2a9247){if(_0x2a9247){_0x4746a5=_0x2a9247;_0x254128[_0xc76d('0x38')]=_['keys'](db[_0xc76d('0x54')][_0xc76d('0x34')]);_0x254128[_0xc76d('0x39')]=_[_0xc76d('0x55')](_0xcd5f35[_0xc76d('0x39')]);_0x254128['filters']=_[_0xc76d('0x3b')](_0x254128[_0xc76d('0x38')],_0x254128['query']);_0xfe2be1['attributes']=_['intersection'](_0x254128[_0xc76d('0x38')],qs[_0xc76d('0x3c')](_0xcd5f35[_0xc76d('0x39')][_0xc76d('0x3c')]));_0xfe2be1[_0xc76d('0x3d')]=_0xfe2be1[_0xc76d('0x3d')][_0xc76d('0x3e')]?_0xfe2be1[_0xc76d('0x3d')]:_0x254128['model'];_0xfe2be1[_0xc76d('0x41')]=qs['sort'](_0xcd5f35['query'][_0xc76d('0x42')]);_0xfe2be1[_0xc76d('0x43')]=qs[_0xc76d('0x3a')](_['pick'](_0xcd5f35[_0xc76d('0x39')],_0x254128['filters']));if(_0xcd5f35['query']['filter']){_0xfe2be1[_0xc76d('0x43')]=_[_0xc76d('0x46')](_0xfe2be1['where'],{'$or':_[_0xc76d('0x33')](_0xfe2be1[_0xc76d('0x3d')],function(_0x20d7cf){var _0x3f07f9={};_0x3f07f9[_0x20d7cf]={'$like':'%'+_0xcd5f35[_0xc76d('0x39')][_0xc76d('0x45')]+'%'};return _0x3f07f9;})});}_0xfe2be1=_[_0xc76d('0x46')]({},_0xfe2be1,_0xcd5f35['options']);return _0x4746a5['getConfigurations'](_0xfe2be1);}})['then'](function(_0x2474a7){if(_0x2474a7){_0x106c85=_0x2474a7[_0xc76d('0x3e')];if(!_0xcd5f35[_0xc76d('0x39')][_0xc76d('0x3f')](_0xc76d('0x40'))){_0xfe2be1['limit']=qs[_0xc76d('0x2a')](_0xcd5f35[_0xc76d('0x39')][_0xc76d('0x2a')]);_0xfe2be1[_0xc76d('0x29')]=qs[_0xc76d('0x29')](_0xcd5f35[_0xc76d('0x39')][_0xc76d('0x29')]);}return _0x4746a5[_0xc76d('0x56')](_0xfe2be1);}})['then'](function(_0x4240cb){if(_0x4240cb){return _0x4240cb?{'count':_0x106c85,'rows':_0x4240cb}:null;}})['then'](respondWithResult(_0x41e514,null))[_0xc76d('0x25')](handleError(_0x41e514,null));};exports[_0xc76d('0x57')]=function(_0x35c60f,_0x55dd93,_0x58c3ce){if(_0x35c60f[_0xc76d('0x50')]['id']){delete _0x35c60f['body']['id'];}return db['FreshsalesAccount'][_0xc76d('0x53')]({'where':{'id':_0x35c60f[_0xc76d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x55dd93,null))[_0xc76d('0x1c')](function(_0x1062ea){if(_0x1062ea){_0x35c60f['body'][_0xc76d('0x58')]=_0x1062ea['id'];_0x35c60f[_0xc76d('0x50')]['Subjects']=integrations[_0xc76d('0x59')](_0x35c60f['body'][_0xc76d('0x5a')],_0x35c60f[_0xc76d('0x50')]['type']);_0x35c60f[_0xc76d('0x50')][_0xc76d('0x5b')]=integrations['getDescriptions'](_0x35c60f[_0xc76d('0x50')][_0xc76d('0x5a')],_0x35c60f[_0xc76d('0x50')]['type']);return db[_0xc76d('0x54')]['create'](_0x35c60f['body'],{'include':[{'model':db[_0xc76d('0x5c')],'as':_0xc76d('0x5d')},{'model':db['FreshsalesField'],'as':_0xc76d('0x5b')}]});}return null;})[_0xc76d('0x1c')](respondWithResult(_0x55dd93,null))[_0xc76d('0x25')](handleError(_0x55dd93,null));};exports[_0xc76d('0x5e')]=function(_0x1bcd83,_0x1d3582,_0x210617){var _0x263570='';var _0x26855a='';return db[_0xc76d('0x48')][_0xc76d('0x53')]({'where':{'id':_0x1bcd83[_0xc76d('0x4e')]['id']},'attributes':['id',_0xc76d('0x5f'),_0xc76d('0x60'),_0xc76d('0x61')]})[_0xc76d('0x1c')](handleEntityNotFound(_0x1d3582,null))[_0xc76d('0x1c')](function(_0xd16232){if(_0xd16232){_0x26855a=_0xd16232[_0xc76d('0x5f')];_0x263570=_0xd16232[_0xc76d('0x60')];var _0x5b9e24=_0xd16232[_0xc76d('0x60')][_0xc76d('0x62')](-0x1);if(_0x5b9e24==='/'){_0x263570=_0x263570[_0xc76d('0x63')](0x0,_0x263570[_0xc76d('0x64')](_0x5b9e24));}return rp({'method':_0xc76d('0x65'),'uri':util[_0xc76d('0x66')](_0xc76d('0x67'),_0x263570,_0xc76d('0x68')),'headers':{'Authorization':_0xc76d('0x69')+_0xd16232[_0xc76d('0x61')]},'json':!![]});}})[_0xc76d('0x1c')](function(_0x1b8550){if(_0x1b8550){var _0x290db1=_0x1b8550[_0xc76d('0x6a')];var _0x11e6fd=![];var _0x464a02=null;for(_0x464a02=0x0;_0x464a02<_0x290db1[_0xc76d('0x3e')];_0x464a02++){if(_0x290db1[_0x464a02][_0xc76d('0x6b')]===_0x26855a){_0x11e6fd=!![];}}if(_0x11e6fd){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xc76d('0x6c')});}}})[_0xc76d('0x1c')](respondWithResult(_0x1d3582,null))[_0xc76d('0x25')](function(_0x260874){var _0x508348=_0x1bcd83[_0xc76d('0x39')]['test']?0x1f4:_0x260874[_0xc76d('0x6d')]||0x1f4;logger[_0xc76d('0x20')]('getFields,\x20%s,\x20%s,\x20%s',_0xc76d('0x5e'),_0x508348,JSON[_0xc76d('0x1f')](_0x260874));delete _0x260874['name'];if(_0x508348===0x191){_0x508348=0x190;}_0x1d3582[_0xc76d('0x26')](_0x508348)[_0xc76d('0x32')](_0x1bcd83[_0xc76d('0x39')][_0xc76d('0x6e')]?{'message':_0xc76d('0x6f'),'statusCode':_0x260874[_0xc76d('0x6d')]}:_0x260874);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index c9b0184..594975a 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 _0x5c17=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','lodash','util'];(function(_0x519c88,_0xb84103){var _0x4668d7=function(_0x596c2c){while(--_0x596c2c){_0x519c88['push'](_0x519c88['shift']());}};_0x4668d7(++_0xb84103);}(_0x5c17,0x178));var _0x75c1=function(_0xe8aba7,_0x4f6499){_0xe8aba7=_0xe8aba7-0x0;var _0x1001dd=_0x5c17[_0xe8aba7];return _0x1001dd;};'use strict';var _=require(_0x75c1('0x0'));var util=require(_0x75c1('0x1'));var logger=require(_0x75c1('0x2'))(_0x75c1('0x3'));var moment=require('moment');var BPromise=require(_0x75c1('0x4'));var rp=require(_0x75c1('0x5'));var fs=require('fs');var path=require(_0x75c1('0x6'));var rimraf=require(_0x75c1('0x7'));var config=require(_0x75c1('0x8'));var attributes=require(_0x75c1('0x9'));var integrations=require(_0x75c1('0xa'));module[_0x75c1('0xb')]=function(_0x1b507c,_0x33db4f){return _0x1b507c['define'](_0x75c1('0xc'),attributes,{'tableName':_0x75c1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a08=['request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger'];(function(_0xda742b,_0x5d9462){var _0x198b88=function(_0x7eb56){while(--_0x7eb56){_0xda742b['push'](_0xda742b['shift']());}};_0x198b88(++_0x5d9462);}(_0x1a08,0x15d));var _0x81a0=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0x1a08[_0x19ac6e];return _0x1cdcf3;};'use strict';var _=require(_0x81a0('0x0'));var util=require(_0x81a0('0x1'));var logger=require(_0x81a0('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x81a0('0x3'));var fs=require('fs');var path=require(_0x81a0('0x4'));var rimraf=require(_0x81a0('0x5'));var config=require(_0x81a0('0x6'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x81a0('0x7'));module[_0x81a0('0x8')]=function(_0x59a62c,_0x1412d3){return _0x59a62c[_0x81a0('0x9')]('FreshsalesAccount',attributes,{'tableName':_0x81a0('0xa'),'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 f23f41b..f49ae7f 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 _0x2d07=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','attributes','limit','include','map','model','then','stringify','find','raw','where','ShowFreshsalesAccount','lodash'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x2d07,0x13a));var _0x72d0=function(_0x11bf1b,_0x50581b){_0x11bf1b=_0x11bf1b-0x0;var _0x387d1c=_0x2d07[_0x11bf1b];return _0x387d1c;};'use strict';var _=require(_0x72d0('0x0'));var util=require(_0x72d0('0x1'));var moment=require('moment');var BPromise=require(_0x72d0('0x2'));var rs=require(_0x72d0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d0('0x4'))['db'];var utils=require(_0x72d0('0x5'));var logger=require(_0x72d0('0x6'))(_0x72d0('0x7'));var config=require(_0x72d0('0x8'));var jayson=require(_0x72d0('0x9'));var client=jayson['client'][_0x72d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdad2db,_0x2a4100,_0x47a826){return new BPromise(function(_0x4f2c34,_0x6d0ff6){return client['request'](_0xdad2db,_0x47a826)['then'](function(_0x5db523){logger[_0x72d0('0xb')](_0x72d0('0xc'),_0x2a4100,_0x72d0('0xd'));logger[_0x72d0('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x2a4100,'request\x20sent',JSON['stringify'](_0x5db523));if(_0x5db523[_0x72d0('0xf')]){if(_0x5db523[_0x72d0('0xf')][_0x72d0('0x10')]===0x1f4){logger[_0x72d0('0xf')](_0x72d0('0xc'),_0x2a4100,_0x5db523['error'][_0x72d0('0x11')]);return _0x6d0ff6(_0x5db523[_0x72d0('0xf')][_0x72d0('0x11')]);}logger['error'](_0x72d0('0xc'),_0x2a4100,_0x5db523[_0x72d0('0xf')][_0x72d0('0x11')]);return _0x4f2c34(_0x5db523[_0x72d0('0xf')][_0x72d0('0x11')]);}else{logger[_0x72d0('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x2a4100,_0x72d0('0xd'));_0x4f2c34(_0x5db523[_0x72d0('0x12')][_0x72d0('0x11')]);}})[_0x72d0('0x13')](function(_0x2a761c){logger[_0x72d0('0xf')](_0x72d0('0xc'),_0x2a4100,_0x2a761c);_0x6d0ff6(_0x2a761c);});});}exports[_0x72d0('0x14')]=function(_0x2fe17f){var _0x4a9367=this;return new Promise(function(_0x440f9c,_0x357553){return db[_0x72d0('0x15')][_0x72d0('0x16')]({'raw':_0x2fe17f[_0x72d0('0x17')]?_0x2fe17f[_0x72d0('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2fe17f[_0x72d0('0x17')]?_0x2fe17f['options']['where']||null:null,'attributes':_0x2fe17f['options']?_0x2fe17f[_0x72d0('0x17')][_0x72d0('0x18')]||null:null,'limit':_0x2fe17f['options']?_0x2fe17f[_0x72d0('0x17')][_0x72d0('0x19')]||null:null,'include':_0x2fe17f['options']?_0x2fe17f[_0x72d0('0x17')][_0x72d0('0x1a')]?_['map'](_0x2fe17f[_0x72d0('0x17')][_0x72d0('0x1a')],function(_0x350184){return{'model':db[_0x350184['model']],'as':_0x350184['as'],'attributes':_0x350184[_0x72d0('0x18')],'include':_0x350184[_0x72d0('0x1a')]?_[_0x72d0('0x1b')](_0x350184[_0x72d0('0x1a')],function(_0x4bc137){return{'model':db[_0x4bc137[_0x72d0('0x1c')]],'as':_0x4bc137['as'],'attributes':_0x4bc137[_0x72d0('0x18')],'include':_0x4bc137[_0x72d0('0x1a')]?_[_0x72d0('0x1b')](_0x4bc137[_0x72d0('0x1a')],function(_0x7f45){return{'model':db[_0x7f45[_0x72d0('0x1c')]],'as':_0x7f45['as'],'attributes':_0x7f45['attributes']};}):[]};}):[]};}):[]:[]})[_0x72d0('0x1d')](function(_0x4d8340){logger[_0x72d0('0xb')](_0x72d0('0x14'),_0x2fe17f);logger[_0x72d0('0xe')](_0x72d0('0x14'),_0x2fe17f,JSON[_0x72d0('0x1e')](_0x4d8340));_0x440f9c(_0x4d8340);})['catch'](function(_0x12a92b){logger[_0x72d0('0xf')]('GetFreshsalesAccount',_0x12a92b[_0x72d0('0x11')],_0x2fe17f);_0x357553(_0x4a9367[_0x72d0('0xf')](0x1f4,_0x12a92b[_0x72d0('0x11')]));});});};exports['ShowFreshsalesAccount']=function(_0x3471e1){var _0x1d16fa=this;return new Promise(function(_0x4b5b0a,_0x13892a){return db['FreshsalesAccount'][_0x72d0('0x1f')]({'raw':_0x3471e1[_0x72d0('0x17')]?_0x3471e1[_0x72d0('0x17')][_0x72d0('0x20')]===undefined?!![]:![]:!![],'where':_0x3471e1[_0x72d0('0x17')]?_0x3471e1[_0x72d0('0x17')][_0x72d0('0x21')]||null:null,'attributes':_0x3471e1[_0x72d0('0x17')]?_0x3471e1[_0x72d0('0x17')][_0x72d0('0x18')]||null:null,'include':_0x3471e1[_0x72d0('0x17')]?_0x3471e1[_0x72d0('0x17')]['include']?_[_0x72d0('0x1b')](_0x3471e1[_0x72d0('0x17')][_0x72d0('0x1a')],function(_0x457712){return{'model':db[_0x457712[_0x72d0('0x1c')]],'as':_0x457712['as'],'attributes':_0x457712[_0x72d0('0x18')],'include':_0x457712[_0x72d0('0x1a')]?_[_0x72d0('0x1b')](_0x457712['include'],function(_0x353a09){return{'model':db[_0x353a09[_0x72d0('0x1c')]],'as':_0x353a09['as'],'attributes':_0x353a09['attributes'],'include':_0x353a09['include']?_[_0x72d0('0x1b')](_0x353a09[_0x72d0('0x1a')],function(_0xd11005){return{'model':db[_0xd11005[_0x72d0('0x1c')]],'as':_0xd11005['as'],'attributes':_0xd11005[_0x72d0('0x18')]};}):[]};}):[]};}):[]:[]})[_0x72d0('0x1d')](function(_0xb0d6fa){logger[_0x72d0('0xb')](_0x72d0('0x22'),_0x3471e1);logger[_0x72d0('0xe')](_0x72d0('0x22'),_0x3471e1,JSON[_0x72d0('0x1e')](_0xb0d6fa));_0x4b5b0a(_0xb0d6fa);})[_0x72d0('0x13')](function(_0xbb98c1){logger['error']('ShowFreshsalesAccount',_0xbb98c1[_0x72d0('0x11')],_0x3471e1);_0x13892a(_0x1d16fa[_0x72d0('0xf')](0x1f4,_0xbb98c1['message']));});});}; \ No newline at end of file +var _0x1b0e=['error','code','message','result','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','include','model','map','stringify','FreshsalesAccount','find','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3cff6a,_0x215a3e){var _0xbbcdd8=function(_0xe3b0a9){while(--_0xe3b0a9){_0x3cff6a['push'](_0x3cff6a['shift']());}};_0xbbcdd8(++_0x215a3e);}(_0x1b0e,0x132));var _0xe1b0=function(_0x5b03b2,_0x21aff3){_0x5b03b2=_0x5b03b2-0x0;var _0x4e88c8=_0x1b0e[_0x5b03b2];return _0x4e88c8;};'use strict';var _=require(_0xe1b0('0x0'));var util=require(_0xe1b0('0x1'));var moment=require(_0xe1b0('0x2'));var BPromise=require(_0xe1b0('0x3'));var rs=require(_0xe1b0('0x4'));var fs=require('fs');var Redis=require(_0xe1b0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe1b0('0x6'))(_0xe1b0('0x7'));var config=require('../../config/environment');var jayson=require(_0xe1b0('0x8'));var client=jayson[_0xe1b0('0x9')][_0xe1b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52e806,_0x36f5cd,_0x1eef2a){return new BPromise(function(_0x5aacc2,_0x123268){return client[_0xe1b0('0xb')](_0x52e806,_0x1eef2a)[_0xe1b0('0xc')](function(_0x400eee){logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));logger[_0xe1b0('0x10')](_0xe1b0('0x11'),_0x36f5cd,_0xe1b0('0xf'),JSON['stringify'](_0x400eee));if(_0x400eee[_0xe1b0('0x12')]){if(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x13')]===0x1f4){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x123268(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);}logger['error'](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x5aacc2(_0x400eee['error']['message']);}else{logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));_0x5aacc2(_0x400eee[_0xe1b0('0x15')][_0xe1b0('0x14')]);}})[_0xe1b0('0x16')](function(_0x5dfd78){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x5dfd78);_0x123268(_0x5dfd78);});});}exports[_0xe1b0('0x17')]=function(_0x2928b6){var _0x349f90=this;return new Promise(function(_0x5c195f,_0x5b300e){return db['FreshsalesAccount'][_0xe1b0('0x18')]({'raw':_0x2928b6['options']?_0x2928b6[_0xe1b0('0x19')][_0xe1b0('0x1a')]===undefined?!![]:![]:!![],'where':_0x2928b6[_0xe1b0('0x19')]?_0x2928b6['options'][_0xe1b0('0x1b')]||null:null,'attributes':_0x2928b6[_0xe1b0('0x19')]?_0x2928b6['options'][_0xe1b0('0x1c')]||null:null,'limit':_0x2928b6[_0xe1b0('0x19')]?_0x2928b6[_0xe1b0('0x19')]['limit']||null:null,'include':_0x2928b6[_0xe1b0('0x19')]?_0x2928b6['options']['include']?_['map'](_0x2928b6['options'][_0xe1b0('0x1d')],function(_0x4a387d){return{'model':db[_0x4a387d[_0xe1b0('0x1e')]],'as':_0x4a387d['as'],'attributes':_0x4a387d[_0xe1b0('0x1c')],'include':_0x4a387d[_0xe1b0('0x1d')]?_['map'](_0x4a387d[_0xe1b0('0x1d')],function(_0x3ef159){return{'model':db[_0x3ef159['model']],'as':_0x3ef159['as'],'attributes':_0x3ef159[_0xe1b0('0x1c')],'include':_0x3ef159[_0xe1b0('0x1d')]?_[_0xe1b0('0x1f')](_0x3ef159[_0xe1b0('0x1d')],function(_0x11e4b2){return{'model':db[_0x11e4b2['model']],'as':_0x11e4b2['as'],'attributes':_0x11e4b2[_0xe1b0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe1b0('0xc')](function(_0x1a30d0){logger[_0xe1b0('0xd')](_0xe1b0('0x17'),_0x2928b6);logger[_0xe1b0('0x10')](_0xe1b0('0x17'),_0x2928b6,JSON[_0xe1b0('0x20')](_0x1a30d0));_0x5c195f(_0x1a30d0);})['catch'](function(_0x2f7b35){logger[_0xe1b0('0x12')]('GetFreshsalesAccount',_0x2f7b35[_0xe1b0('0x14')],_0x2928b6);_0x5b300e(_0x349f90[_0xe1b0('0x12')](0x1f4,_0x2f7b35['message']));});});};exports['ShowFreshsalesAccount']=function(_0x5cc8e3){var _0x9c4710=this;return new Promise(function(_0x3f2f25,_0xae9a36){return db[_0xe1b0('0x21')][_0xe1b0('0x22')]({'raw':_0x5cc8e3[_0xe1b0('0x19')]?_0x5cc8e3['options']['raw']===undefined?!![]:![]:!![],'where':_0x5cc8e3[_0xe1b0('0x19')]?_0x5cc8e3[_0xe1b0('0x19')][_0xe1b0('0x1b')]||null:null,'attributes':_0x5cc8e3[_0xe1b0('0x19')]?_0x5cc8e3[_0xe1b0('0x19')][_0xe1b0('0x1c')]||null:null,'include':_0x5cc8e3[_0xe1b0('0x19')]?_0x5cc8e3[_0xe1b0('0x19')][_0xe1b0('0x1d')]?_[_0xe1b0('0x1f')](_0x5cc8e3['options']['include'],function(_0x58b897){return{'model':db[_0x58b897[_0xe1b0('0x1e')]],'as':_0x58b897['as'],'attributes':_0x58b897['attributes'],'include':_0x58b897[_0xe1b0('0x1d')]?_[_0xe1b0('0x1f')](_0x58b897[_0xe1b0('0x1d')],function(_0x3c414b){return{'model':db[_0x3c414b[_0xe1b0('0x1e')]],'as':_0x3c414b['as'],'attributes':_0x3c414b[_0xe1b0('0x1c')],'include':_0x3c414b[_0xe1b0('0x1d')]?_['map'](_0x3c414b['include'],function(_0x49df4d){return{'model':db[_0x49df4d[_0xe1b0('0x1e')]],'as':_0x49df4d['as'],'attributes':_0x49df4d['attributes']};}):[]};}):[]};}):[]:[]})[_0xe1b0('0xc')](function(_0x518202){logger['info']('ShowFreshsalesAccount',_0x5cc8e3);logger[_0xe1b0('0x10')](_0xe1b0('0x23'),_0x5cc8e3,JSON[_0xe1b0('0x20')](_0x518202));_0x3f2f25(_0x518202);})[_0xe1b0('0x16')](function(_0x15fd34){logger[_0xe1b0('0x12')]('ShowFreshsalesAccount',_0x15fd34['message'],_0x5cc8e3);_0xae9a36(_0x9c4710[_0xe1b0('0x12')](0x1f4,_0x15fd34[_0xe1b0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index c3fd00f..45f1959 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 _0xc958=['post','create','put','update','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields'];(function(_0x7a6aed,_0x335e68){var _0x9dbabf=function(_0x453c9c){while(--_0x453c9c){_0x7a6aed['push'](_0x7a6aed['shift']());}};_0x9dbabf(++_0x335e68);}(_0xc958,0x13a));var _0x8c95=function(_0xff6b41,_0x2d123e){_0xff6b41=_0xff6b41-0x0;var _0x26d2b7=_0xc958[_0xff6b41];return _0x26d2b7;};'use strict';var multer=require('multer');var util=require(_0x8c95('0x0'));var path=require(_0x8c95('0x1'));var timeout=require(_0x8c95('0x2'));var express=require('express');var router=express[_0x8c95('0x3')]();var auth=require(_0x8c95('0x4'));var interaction=require(_0x8c95('0x5'));var config=require('../../config/environment');var controller=require(_0x8c95('0x6'));router[_0x8c95('0x7')]('/',auth[_0x8c95('0x8')](),controller['index']);router['get'](_0x8c95('0x9'),auth['isAuthenticated'](),controller[_0x8c95('0xa')]);router[_0x8c95('0x7')](_0x8c95('0xb'),auth['isAuthenticated'](),controller[_0x8c95('0xc')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x8c95('0xd')]);router[_0x8c95('0x7')](_0x8c95('0xe'),auth['isAuthenticated'](),controller[_0x8c95('0xf')]);router[_0x8c95('0x10')]('/',auth[_0x8c95('0x8')](),controller[_0x8c95('0x11')]);router[_0x8c95('0x12')](_0x8c95('0x9'),auth[_0x8c95('0x8')](),controller[_0x8c95('0x13')]);router[_0x8c95('0x14')](_0x8c95('0x9'),auth[_0x8c95('0x8')](),controller['destroy']);module[_0x8c95('0x15')]=router; \ No newline at end of file +var _0xc5a0=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','delete'];(function(_0x159fb8,_0x1e934c){var _0x3ed863=function(_0x2fa9a5){while(--_0x2fa9a5){_0x159fb8['push'](_0x159fb8['shift']());}};_0x3ed863(++_0x1e934c);}(_0xc5a0,0xa2));var _0x0c5a=function(_0x4ce6c7,_0x1b1e0c){_0x4ce6c7=_0x4ce6c7-0x0;var _0x49fa8b=_0xc5a0[_0x4ce6c7];return _0x49fa8b;};'use strict';var multer=require(_0x0c5a('0x0'));var util=require(_0x0c5a('0x1'));var path=require(_0x0c5a('0x2'));var timeout=require(_0x0c5a('0x3'));var express=require(_0x0c5a('0x4'));var router=express[_0x0c5a('0x5')]();var auth=require(_0x0c5a('0x6'));var interaction=require(_0x0c5a('0x7'));var config=require(_0x0c5a('0x8'));var controller=require(_0x0c5a('0x9'));router['get']('/',auth[_0x0c5a('0xa')](),controller[_0x0c5a('0xb')]);router[_0x0c5a('0xc')](_0x0c5a('0xd'),auth[_0x0c5a('0xa')](),controller[_0x0c5a('0xe')]);router['get'](_0x0c5a('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x0c5a('0xc')](_0x0c5a('0x10'),auth[_0x0c5a('0xa')](),controller[_0x0c5a('0x11')]);router[_0x0c5a('0xc')]('/:id/fields',auth[_0x0c5a('0xa')](),controller['getFields']);router['post']('/',auth[_0x0c5a('0xa')](),controller[_0x0c5a('0x12')]);router[_0x0c5a('0x13')]('/:id',auth[_0x0c5a('0xa')](),controller[_0x0c5a('0x14')]);router[_0x0c5a('0x15')](_0x0c5a('0xd'),auth[_0x0c5a('0xa')](),controller[_0x0c5a('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 24a8d75..141b1ff 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 _0x8e52=['sequelize','STRING'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0x8e52,0x1ba));var _0x28e5=function(_0x4f0c2b,_0x2c9d14){_0x4f0c2b=_0x4f0c2b-0x0;var _0x526436=_0x8e52[_0x4f0c2b];return _0x526436;};'use strict';var Sequelize=require(_0x28e5('0x0'));module['exports']={'name':{'type':Sequelize[_0x28e5('0x1')]},'description':{'type':Sequelize[_0x28e5('0x1')]}}; \ No newline at end of file +var _0x6914=['STRING','sequelize','exports'];(function(_0x5c72de,_0x18496d){var _0x54d12c=function(_0x3dd31d){while(--_0x3dd31d){_0x5c72de['push'](_0x5c72de['shift']());}};_0x54d12c(++_0x18496d);}(_0x6914,0x19c));var _0x4691=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x6914[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0x4691('0x0'));module[_0x4691('0x1')]={'name':{'type':Sequelize[_0x4691('0x2')]},'description':{'type':Sequelize[_0x4691('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 4d18779..5410689 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 _0x53ec=['rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','order','sort','filters','pick','where','type','VIRTUAL','filter','FreshsalesConfiguration','count','includeAll','include','rows','catch','show','length','options','find','create','body','params','getSubjects','FreshsalesField','merge','hasOwnProperty','nolimit','getDescriptions','findOne','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','end','status','json','offset','limit','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','map'];(function(_0x4589e1,_0x5a6639){var _0x154a91=function(_0x1de896){while(--_0x1de896){_0x4589e1['push'](_0x4589e1['shift']());}};_0x154a91(++_0x5a6639);}(_0x53ec,0x192));var _0xc53e=function(_0x72c194,_0x1a953a){_0x72c194=_0x72c194-0x0;var _0x1f4f68=_0x53ec[_0x72c194];return _0x1f4f68;};'use strict';var pdf=require(_0xc53e('0x0'));var emlformat=require(_0xc53e('0x1'));var rimraf=require(_0xc53e('0x2'));var zipdir=require(_0xc53e('0x3'));var jsonpatch=require(_0xc53e('0x4'));var rp=require(_0xc53e('0x5'));var moment=require('moment');var BPromise=require(_0xc53e('0x6'));var Mustache=require('mustache');var util=require(_0xc53e('0x7'));var path=require(_0xc53e('0x8'));var sox=require('sox');var csv=require(_0xc53e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0x9'));var querystring=require(_0xc53e('0xe'));var Papa=require(_0xc53e('0xf'));var Redis=require(_0xc53e('0x10'));var authService=require(_0xc53e('0x11'));var qs=require(_0xc53e('0x12'));var as=require(_0xc53e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x15'));var db=require(_0xc53e('0x16'))['db'];var jayson=require(_0xc53e('0x17'));var client=jayson[_0xc53e('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e74c9,_0x1c06cd,_0x19a772,_0x7cd798){return new BPromise(function(_0x3d2e17,_0x358ef3){var _0x382e87=_0x7cd798||client;return _0x382e87[_0xc53e('0x19')](_0x4e74c9,_0x19a772)[_0xc53e('0x1a')](function(_0x455e4d){logger[_0xc53e('0x1b')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1c06cd,_0xc53e('0x1c'));logger[_0xc53e('0x1d')](_0xc53e('0x1e'),_0x1c06cd,_0xc53e('0x1c'),JSON[_0xc53e('0x1f')](_0x455e4d));if(_0x455e4d[_0xc53e('0x20')]){if(_0x455e4d[_0xc53e('0x20')][_0xc53e('0x21')]===0x1f4){logger[_0xc53e('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1c06cd,_0x455e4d['error'][_0xc53e('0x22')]);return _0x358ef3(_0x455e4d[_0xc53e('0x20')][_0xc53e('0x22')]);}logger[_0xc53e('0x20')](_0xc53e('0x23'),_0x1c06cd,_0x455e4d[_0xc53e('0x20')][_0xc53e('0x22')]);return _0x3d2e17(_0x455e4d[_0xc53e('0x20')][_0xc53e('0x22')]);}else{logger[_0xc53e('0x1b')](_0xc53e('0x23'),_0x1c06cd,_0xc53e('0x1c'));_0x3d2e17(_0x455e4d[_0xc53e('0x24')]['message']);}})['catch'](function(_0x531ede){logger[_0xc53e('0x20')](_0xc53e('0x23'),_0x1c06cd,_0x531ede);_0x358ef3(_0x531ede);});});}function respondWithStatusCode(_0x7591c1,_0x4015c8){_0x4015c8=_0x4015c8||0xcc;return function(_0x180811){if(_0x180811){return _0x7591c1['sendStatus'](_0x4015c8);}return _0x7591c1['status'](_0x4015c8)[_0xc53e('0x25')]();};}function respondWithResult(_0x496167,_0x1ae55e){_0x1ae55e=_0x1ae55e||0xc8;return function(_0x3a5ce8){if(_0x3a5ce8){return _0x496167[_0xc53e('0x26')](_0x1ae55e)[_0xc53e('0x27')](_0x3a5ce8);}};}function respondWithFilteredResult(_0x63c5dc,_0x4df8cf){return function(_0x398e7a){if(_0x398e7a){var _0x4b9f6a=_0x398e7a['count'],_0x4d9a68=_0x4df8cf[_0xc53e('0x28')],_0x5c65d3=_0x4df8cf['offset']+_0x4df8cf[_0xc53e('0x29')],_0x3c5056;if(_0x5c65d3>=_0x4b9f6a){_0x5c65d3=_0x4b9f6a;_0x3c5056=0xc8;}else{_0x3c5056=0xce;}_0x63c5dc['status'](_0x3c5056);return _0x63c5dc['set'](_0xc53e('0x2a'),_0x4d9a68+'-'+_0x5c65d3+'/'+_0x4b9f6a)[_0xc53e('0x27')](_0x398e7a);}return null;};}function patchUpdates(_0x42dec1){return function(_0x2fa20b){try{jsonpatch[_0xc53e('0x2b')](_0x2fa20b,_0x42dec1,!![]);}catch(_0xf97d78){return BPromise[_0xc53e('0x2c')](_0xf97d78);}return _0x2fa20b[_0xc53e('0x2d')]();};}function saveUpdates(_0x4ace0b,_0x437893){return function(_0x311835){if(_0x311835){return _0x311835[_0xc53e('0x2e')](_0x4ace0b)['then'](function(_0x4057f9){return _0x4057f9;});}return null;};}function removeEntity(_0x495756,_0x4572e){return function(_0x2467f4){if(_0x2467f4){return _0x2467f4['destroy']()['then'](function(){_0x495756[_0xc53e('0x26')](0xcc)[_0xc53e('0x25')]();});}};}function handleEntityNotFound(_0x3f4547,_0x30d037){return function(_0x1b95c2){if(!_0x1b95c2){_0x3f4547[_0xc53e('0x2f')](0x194);}return _0x1b95c2;};}function handleError(_0x40a8db,_0x168d25){_0x168d25=_0x168d25||0x1f4;return function(_0x4ffddc){logger[_0xc53e('0x20')](_0x4ffddc[_0xc53e('0x30')]);if(_0x4ffddc[_0xc53e('0x31')]){delete _0x4ffddc[_0xc53e('0x31')];}_0x40a8db[_0xc53e('0x26')](_0x168d25)[_0xc53e('0x32')](_0x4ffddc);};}exports[_0xc53e('0x33')]=function(_0x16942c,_0x215abe){var _0x595efb={},_0x3e395c={},_0x48d7d0={'count':0x0,'rows':[]};var _0x1059f3=_[_0xc53e('0x34')](db['FreshsalesConfiguration'][_0xc53e('0x35')],function(_0x154f8b){return{'name':_0x154f8b[_0xc53e('0x36')],'type':_0x154f8b['type'][_0xc53e('0x37')]};});_0x3e395c[_0xc53e('0x38')]=_[_0xc53e('0x34')](_0x1059f3,_0xc53e('0x31'));_0x3e395c[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x16942c[_0xc53e('0x39')]);_0x3e395c['filters']=_[_0xc53e('0x3b')](_0x3e395c[_0xc53e('0x38')],_0x3e395c[_0xc53e('0x39')]);_0x595efb['attributes']=_[_0xc53e('0x3b')](_0x3e395c['model'],qs[_0xc53e('0x3c')](_0x16942c[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x595efb[_0xc53e('0x3d')]=_0x595efb[_0xc53e('0x3d')]['length']?_0x595efb[_0xc53e('0x3d')]:_0x3e395c[_0xc53e('0x38')];if(!_0x16942c['query']['hasOwnProperty']('nolimit')){_0x595efb['limit']=qs[_0xc53e('0x29')](_0x16942c[_0xc53e('0x39')]['limit']);_0x595efb[_0xc53e('0x28')]=qs['offset'](_0x16942c['query']['offset']);}_0x595efb[_0xc53e('0x3e')]=qs['sort'](_0x16942c['query'][_0xc53e('0x3f')]);_0x595efb['where']=qs[_0xc53e('0x40')](_[_0xc53e('0x41')](_0x16942c['query'],_0x3e395c[_0xc53e('0x40')]),_0x1059f3);if(_0x16942c[_0xc53e('0x39')]['filter']){_0x595efb[_0xc53e('0x42')]=_['merge'](_0x595efb['where'],{'$or':_['map'](_0x1059f3,function(_0x4efee5){if(_0x4efee5[_0xc53e('0x43')]!==_0xc53e('0x44')){var _0x3b2834={};_0x3b2834[_0x4efee5['name']]={'$like':'%'+_0x16942c[_0xc53e('0x39')][_0xc53e('0x45')]+'%'};return _0x3b2834;}})});}_0x595efb=_['merge']({},_0x595efb,_0x16942c['options']);var _0x3ea11a={'where':_0x595efb[_0xc53e('0x42')]};return db[_0xc53e('0x46')]['count'](_0x3ea11a)[_0xc53e('0x1a')](function(_0x1fb82c){_0x48d7d0[_0xc53e('0x47')]=_0x1fb82c;if(_0x16942c[_0xc53e('0x39')][_0xc53e('0x48')]){_0x595efb[_0xc53e('0x49')]=[{'all':!![]}];}return db[_0xc53e('0x46')]['findAll'](_0x595efb);})[_0xc53e('0x1a')](function(_0x39c467){_0x48d7d0[_0xc53e('0x4a')]=_0x39c467;return _0x48d7d0;})['then'](respondWithFilteredResult(_0x215abe,_0x595efb))[_0xc53e('0x4b')](handleError(_0x215abe,null));};exports[_0xc53e('0x4c')]=function(_0x4458c8,_0x15e744){var _0xa7d256={'raw':![],'where':{'id':_0x4458c8['params']['id']}},_0x17cea5={};_0x17cea5[_0xc53e('0x38')]=_[_0xc53e('0x3a')](db[_0xc53e('0x46')]['rawAttributes']);_0x17cea5[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x4458c8[_0xc53e('0x39')]);_0x17cea5[_0xc53e('0x40')]=_[_0xc53e('0x3b')](_0x17cea5[_0xc53e('0x38')],_0x17cea5[_0xc53e('0x39')]);_0xa7d256[_0xc53e('0x3d')]=_[_0xc53e('0x3b')](_0x17cea5[_0xc53e('0x38')],qs['fields'](_0x4458c8[_0xc53e('0x39')][_0xc53e('0x3c')]));_0xa7d256[_0xc53e('0x3d')]=_0xa7d256[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0xa7d256['attributes']:_0x17cea5['model'];if(_0x4458c8[_0xc53e('0x39')]['includeAll']){_0xa7d256[_0xc53e('0x49')]=[{'all':!![]}];}_0xa7d256=_['merge']({},_0xa7d256,_0x4458c8[_0xc53e('0x4e')]);return db[_0xc53e('0x46')][_0xc53e('0x4f')](_0xa7d256)['then'](handleEntityNotFound(_0x15e744,null))[_0xc53e('0x1a')](respondWithResult(_0x15e744,null))[_0xc53e('0x4b')](handleError(_0x15e744,null));};exports[_0xc53e('0x50')]=function(_0x4843ce,_0x2f7df2){return db['FreshsalesConfiguration'][_0xc53e('0x50')](_0x4843ce[_0xc53e('0x51')],{})['then'](respondWithResult(_0x2f7df2,0xc9))[_0xc53e('0x4b')](handleError(_0x2f7df2,null));};exports[_0xc53e('0x2e')]=function(_0x5bba72,_0x44f7cc){if(_0x5bba72[_0xc53e('0x51')]['id']){delete _0x5bba72[_0xc53e('0x51')]['id'];}return db[_0xc53e('0x46')][_0xc53e('0x4f')]({'where':{'id':_0x5bba72[_0xc53e('0x52')]['id']}})[_0xc53e('0x1a')](handleEntityNotFound(_0x44f7cc,null))[_0xc53e('0x1a')](saveUpdates(_0x5bba72[_0xc53e('0x51')],null))[_0xc53e('0x1a')](respondWithResult(_0x44f7cc,null))[_0xc53e('0x4b')](handleError(_0x44f7cc,null));};exports['destroy']=function(_0x8364f6,_0x4a2543){return db[_0xc53e('0x46')]['find']({'where':{'id':_0x8364f6[_0xc53e('0x52')]['id']}})[_0xc53e('0x1a')](handleEntityNotFound(_0x4a2543,null))['then'](removeEntity(_0x4a2543,null))[_0xc53e('0x4b')](handleError(_0x4a2543,null));};exports[_0xc53e('0x53')]=function(_0x9c0112,_0x432a91,_0x53083b){var _0x41c46c={};var _0x335427={};var _0x4ae0d4;var _0x5ea1da;return db[_0xc53e('0x46')]['findOne']({'where':{'id':_0x9c0112['params']['id']}})['then'](handleEntityNotFound(_0x432a91,null))[_0xc53e('0x1a')](function(_0x5f5dad){if(_0x5f5dad){_0x4ae0d4=_0x5f5dad;_0x335427[_0xc53e('0x38')]=_['keys'](db[_0xc53e('0x54')][_0xc53e('0x35')]);_0x335427[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x9c0112[_0xc53e('0x39')]);_0x335427['filters']=_['intersection'](_0x335427[_0xc53e('0x38')],_0x335427[_0xc53e('0x39')]);_0x41c46c[_0xc53e('0x3d')]=_[_0xc53e('0x3b')](_0x335427[_0xc53e('0x38')],qs[_0xc53e('0x3c')](_0x9c0112[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x41c46c[_0xc53e('0x3d')]=_0x41c46c[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0x41c46c[_0xc53e('0x3d')]:_0x335427[_0xc53e('0x38')];_0x41c46c['order']=qs[_0xc53e('0x3f')](_0x9c0112['query'][_0xc53e('0x3f')]);_0x41c46c[_0xc53e('0x42')]=qs[_0xc53e('0x40')](_[_0xc53e('0x41')](_0x9c0112[_0xc53e('0x39')],_0x335427[_0xc53e('0x40')]));if(_0x9c0112[_0xc53e('0x39')][_0xc53e('0x45')]){_0x41c46c['where']=_['merge'](_0x41c46c['where'],{'$or':_[_0xc53e('0x34')](_0x41c46c[_0xc53e('0x3d')],function(_0x37ac78){var _0x25e4b6={};_0x25e4b6[_0x37ac78]={'$like':'%'+_0x9c0112[_0xc53e('0x39')][_0xc53e('0x45')]+'%'};return _0x25e4b6;})});}_0x41c46c=_[_0xc53e('0x55')]({},_0x41c46c,_0x9c0112['options']);return _0x4ae0d4['getSubjects'](_0x41c46c);}})['then'](function(_0x40c8ba){if(_0x40c8ba){_0x5ea1da=_0x40c8ba[_0xc53e('0x4d')];if(!_0x9c0112['query'][_0xc53e('0x56')](_0xc53e('0x57'))){_0x41c46c[_0xc53e('0x29')]=qs[_0xc53e('0x29')](_0x9c0112[_0xc53e('0x39')][_0xc53e('0x29')]);_0x41c46c['offset']=qs['offset'](_0x9c0112[_0xc53e('0x39')][_0xc53e('0x28')]);}return _0x4ae0d4[_0xc53e('0x53')](_0x41c46c);}})[_0xc53e('0x1a')](function(_0x29ee08){if(_0x29ee08){return _0x29ee08?{'count':_0x5ea1da,'rows':_0x29ee08}:null;}})[_0xc53e('0x1a')](respondWithResult(_0x432a91,null))['catch'](handleError(_0x432a91,null));};exports[_0xc53e('0x58')]=function(_0x15f6cb,_0x1c15a3,_0x3f3dc2){var _0x4d2609={};var _0xdd851e={};var _0xef9095;var _0x26e3ba;return db[_0xc53e('0x46')][_0xc53e('0x59')]({'where':{'id':_0x15f6cb[_0xc53e('0x52')]['id']}})['then'](handleEntityNotFound(_0x1c15a3,null))[_0xc53e('0x1a')](function(_0x134018){if(_0x134018){_0xef9095=_0x134018;_0xdd851e[_0xc53e('0x38')]=_[_0xc53e('0x3a')](db['FreshsalesField']['rawAttributes']);_0xdd851e[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x15f6cb[_0xc53e('0x39')]);_0xdd851e[_0xc53e('0x40')]=_['intersection'](_0xdd851e[_0xc53e('0x38')],_0xdd851e['query']);_0x4d2609[_0xc53e('0x3d')]=_['intersection'](_0xdd851e[_0xc53e('0x38')],qs['fields'](_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x4d2609['attributes']=_0x4d2609[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0x4d2609['attributes']:_0xdd851e['model'];_0x4d2609[_0xc53e('0x3e')]=qs[_0xc53e('0x3f')](_0x15f6cb['query']['sort']);_0x4d2609[_0xc53e('0x42')]=qs['filters'](_[_0xc53e('0x41')](_0x15f6cb['query'],_0xdd851e[_0xc53e('0x40')]));if(_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x45')]){_0x4d2609[_0xc53e('0x42')]=_[_0xc53e('0x55')](_0x4d2609[_0xc53e('0x42')],{'$or':_[_0xc53e('0x34')](_0x4d2609[_0xc53e('0x3d')],function(_0x258be8){var _0x2cd553={};_0x2cd553[_0x258be8]={'$like':'%'+_0x15f6cb['query'][_0xc53e('0x45')]+'%'};return _0x2cd553;})});}_0x4d2609=_['merge']({},_0x4d2609,_0x15f6cb[_0xc53e('0x4e')]);return _0xef9095[_0xc53e('0x58')](_0x4d2609);}})[_0xc53e('0x1a')](function(_0x2c027c){if(_0x2c027c){_0x26e3ba=_0x2c027c[_0xc53e('0x4d')];if(!_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x56')](_0xc53e('0x57'))){_0x4d2609[_0xc53e('0x29')]=qs[_0xc53e('0x29')](_0x15f6cb['query'][_0xc53e('0x29')]);_0x4d2609['offset']=qs[_0xc53e('0x28')](_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x28')]);}return _0xef9095['getDescriptions'](_0x4d2609);}})[_0xc53e('0x1a')](function(_0x340db2){if(_0x340db2){return _0x340db2?{'count':_0x26e3ba,'rows':_0x340db2}:null;}})[_0xc53e('0x1a')](respondWithResult(_0x1c15a3,null))[_0xc53e('0x4b')](handleError(_0x1c15a3,null));};exports[_0xc53e('0x5a')]=function(_0x508671,_0x2601ba,_0x48e337){var _0x56c66f={};var _0x42b53b={};var _0xe1a82c;var _0x25469e;return db['FreshsalesConfiguration'][_0xc53e('0x59')]({'where':{'id':_0x508671[_0xc53e('0x52')]['id']}})['then'](handleEntityNotFound(_0x2601ba,null))[_0xc53e('0x1a')](function(_0x4699b7){if(_0x4699b7){_0xe1a82c=_0x4699b7;_0x42b53b['model']=_['keys'](db[_0xc53e('0x54')]['rawAttributes']);_0x42b53b[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x508671[_0xc53e('0x39')]);_0x42b53b['filters']=_[_0xc53e('0x3b')](_0x42b53b[_0xc53e('0x38')],_0x42b53b[_0xc53e('0x39')]);_0x56c66f['attributes']=_[_0xc53e('0x3b')](_0x42b53b[_0xc53e('0x38')],qs[_0xc53e('0x3c')](_0x508671[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x56c66f['attributes']=_0x56c66f[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0x56c66f[_0xc53e('0x3d')]:_0x42b53b[_0xc53e('0x38')];_0x56c66f[_0xc53e('0x3e')]=qs[_0xc53e('0x3f')](_0x508671[_0xc53e('0x39')][_0xc53e('0x3f')]);_0x56c66f[_0xc53e('0x42')]=qs['filters'](_[_0xc53e('0x41')](_0x508671[_0xc53e('0x39')],_0x42b53b[_0xc53e('0x40')]));if(_0x508671[_0xc53e('0x39')][_0xc53e('0x45')]){_0x56c66f[_0xc53e('0x42')]=_[_0xc53e('0x55')](_0x56c66f[_0xc53e('0x42')],{'$or':_[_0xc53e('0x34')](_0x56c66f['attributes'],function(_0x3a54ef){var _0x190509={};_0x190509[_0x3a54ef]={'$like':'%'+_0x508671[_0xc53e('0x39')][_0xc53e('0x45')]+'%'};return _0x190509;})});}_0x56c66f=_['merge']({},_0x56c66f,_0x508671[_0xc53e('0x4e')]);return _0xe1a82c[_0xc53e('0x5a')](_0x56c66f);}})[_0xc53e('0x1a')](function(_0x92c9bc){if(_0x92c9bc){_0x25469e=_0x92c9bc['length'];if(!_0x508671[_0xc53e('0x39')][_0xc53e('0x56')](_0xc53e('0x57'))){_0x56c66f[_0xc53e('0x29')]=qs[_0xc53e('0x29')](_0x508671[_0xc53e('0x39')][_0xc53e('0x29')]);_0x56c66f['offset']=qs[_0xc53e('0x28')](_0x508671['query'][_0xc53e('0x28')]);}return _0xe1a82c[_0xc53e('0x5a')](_0x56c66f);}})[_0xc53e('0x1a')](function(_0x4c6ddc){if(_0x4c6ddc){return _0x4c6ddc?{'count':_0x25469e,'rows':_0x4c6ddc}:null;}})[_0xc53e('0x1a')](respondWithResult(_0x2601ba,null))[_0xc53e('0x4b')](handleError(_0x2601ba,null));}; \ No newline at end of file +var _0xf494=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','http','request','then','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','FreshsalesConfiguration,\x20%s,\x20%s','end','status','json','offset','limit','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','where','VIRTUAL','filter','options','FreshsalesConfiguration','count','includeAll','include','show','params','find','create','body','catch','getSubjects','nolimit','getDescriptions','findOne','FreshsalesField','getFields','html-pdf'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xf494,0x1c6));var _0x4f49=function(_0x1252cd,_0x2ecc01){_0x1252cd=_0x1252cd-0x0;var _0x5b770a=_0xf494[_0x1252cd];return _0x5b770a;};'use strict';var pdf=require(_0x4f49('0x0'));var emlformat=require(_0x4f49('0x1'));var rimraf=require(_0x4f49('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f49('0x3'));var rp=require(_0x4f49('0x4'));var moment=require(_0x4f49('0x5'));var BPromise=require(_0x4f49('0x6'));var Mustache=require(_0x4f49('0x7'));var util=require(_0x4f49('0x8'));var path=require(_0x4f49('0x9'));var sox=require(_0x4f49('0xa'));var csv=require(_0x4f49('0xb'));var ejs=require(_0x4f49('0xc'));var fs=require('fs');var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xb'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];var jayson=require(_0x4f49('0x19'));var client=jayson['client'][_0x4f49('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x111a8b,_0x1b9145,_0x2efe49,_0x1a0f1e){return new BPromise(function(_0x2f0131,_0xfdb477){var _0x5c373e=_0x1a0f1e||client;return _0x5c373e[_0x4f49('0x1b')](_0x111a8b,_0x2efe49)[_0x4f49('0x1c')](function(_0x415e83){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x1b9145,_0x4f49('0x1d'));logger[_0x4f49('0x1e')](_0x4f49('0x1f'),_0x1b9145,'request\x20sent',JSON[_0x4f49('0x20')](_0x415e83));if(_0x415e83[_0x4f49('0x21')]){if(_0x415e83[_0x4f49('0x21')]['code']===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x1b9145,_0x415e83['error'][_0x4f49('0x22')]);return _0xfdb477(_0x415e83[_0x4f49('0x21')][_0x4f49('0x22')]);}logger[_0x4f49('0x21')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1b9145,_0x415e83[_0x4f49('0x21')][_0x4f49('0x22')]);return _0x2f0131(_0x415e83[_0x4f49('0x21')][_0x4f49('0x22')]);}else{logger[_0x4f49('0x23')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1b9145,_0x4f49('0x1d'));_0x2f0131(_0x415e83[_0x4f49('0x24')][_0x4f49('0x22')]);}})['catch'](function(_0x40755e){logger[_0x4f49('0x21')](_0x4f49('0x25'),_0x1b9145,_0x40755e);_0xfdb477(_0x40755e);});});}function respondWithStatusCode(_0x43c458,_0x9d30aa){_0x9d30aa=_0x9d30aa||0xcc;return function(_0x36187b){if(_0x36187b){return _0x43c458['sendStatus'](_0x9d30aa);}return _0x43c458['status'](_0x9d30aa)[_0x4f49('0x26')]();};}function respondWithResult(_0x429de7,_0x4fedbb){_0x4fedbb=_0x4fedbb||0xc8;return function(_0x408552){if(_0x408552){return _0x429de7[_0x4f49('0x27')](_0x4fedbb)[_0x4f49('0x28')](_0x408552);}};}function respondWithFilteredResult(_0x525950,_0xc54070){return function(_0x2eed1c){if(_0x2eed1c){var _0x298785=_0x2eed1c['count'],_0x148153=_0xc54070['offset'],_0xfefbab=_0xc54070[_0x4f49('0x29')]+_0xc54070[_0x4f49('0x2a')],_0x122404;if(_0xfefbab>=_0x298785){_0xfefbab=_0x298785;_0x122404=0xc8;}else{_0x122404=0xce;}_0x525950[_0x4f49('0x27')](_0x122404);return _0x525950['set'](_0x4f49('0x2b'),_0x148153+'-'+_0xfefbab+'/'+_0x298785)[_0x4f49('0x28')](_0x2eed1c);}return null;};}function patchUpdates(_0x43d8e3){return function(_0x506b20){try{jsonpatch['apply'](_0x506b20,_0x43d8e3,!![]);}catch(_0x3e207f){return BPromise[_0x4f49('0x2c')](_0x3e207f);}return _0x506b20[_0x4f49('0x2d')]();};}function saveUpdates(_0x5e7076,_0x1eaac6){return function(_0x35aa33){if(_0x35aa33){return _0x35aa33[_0x4f49('0x2e')](_0x5e7076)[_0x4f49('0x1c')](function(_0x3e103b){return _0x3e103b;});}return null;};}function removeEntity(_0x37bfee,_0x32c066){return function(_0x45ae19){if(_0x45ae19){return _0x45ae19[_0x4f49('0x2f')]()[_0x4f49('0x1c')](function(){_0x37bfee[_0x4f49('0x27')](0xcc)[_0x4f49('0x26')]();});}};}function handleEntityNotFound(_0x29ff83,_0x6625cd){return function(_0x135d17){if(!_0x135d17){_0x29ff83[_0x4f49('0x30')](0x194);}return _0x135d17;};}function handleError(_0x376a7d,_0x14ca52){_0x14ca52=_0x14ca52||0x1f4;return function(_0x3e7a08){logger['error'](_0x3e7a08[_0x4f49('0x31')]);if(_0x3e7a08[_0x4f49('0x32')]){delete _0x3e7a08[_0x4f49('0x32')];}_0x376a7d[_0x4f49('0x27')](_0x14ca52)[_0x4f49('0x33')](_0x3e7a08);};}exports[_0x4f49('0x34')]=function(_0x2cbe4e,_0x3ad6a7){var _0x43f72f={},_0x338db8={},_0x44e6a0={'count':0x0,'rows':[]};var _0x343365=_[_0x4f49('0x35')](db['FreshsalesConfiguration'][_0x4f49('0x36')],function(_0x27b7a9){return{'name':_0x27b7a9[_0x4f49('0x37')],'type':_0x27b7a9[_0x4f49('0x38')][_0x4f49('0x39')]};});_0x338db8[_0x4f49('0x3a')]=_[_0x4f49('0x35')](_0x343365,_0x4f49('0x32'));_0x338db8[_0x4f49('0x3b')]=_[_0x4f49('0x3c')](_0x2cbe4e[_0x4f49('0x3b')]);_0x338db8[_0x4f49('0x3d')]=_[_0x4f49('0x3e')](_0x338db8[_0x4f49('0x3a')],_0x338db8['query']);_0x43f72f[_0x4f49('0x3f')]=_[_0x4f49('0x3e')](_0x338db8['model'],qs[_0x4f49('0x40')](_0x2cbe4e[_0x4f49('0x3b')]['fields']));_0x43f72f[_0x4f49('0x3f')]=_0x43f72f[_0x4f49('0x3f')][_0x4f49('0x41')]?_0x43f72f[_0x4f49('0x3f')]:_0x338db8[_0x4f49('0x3a')];if(!_0x2cbe4e[_0x4f49('0x3b')][_0x4f49('0x42')]('nolimit')){_0x43f72f['limit']=qs['limit'](_0x2cbe4e[_0x4f49('0x3b')][_0x4f49('0x2a')]);_0x43f72f[_0x4f49('0x29')]=qs[_0x4f49('0x29')](_0x2cbe4e[_0x4f49('0x3b')][_0x4f49('0x29')]);}_0x43f72f[_0x4f49('0x43')]=qs[_0x4f49('0x44')](_0x2cbe4e[_0x4f49('0x3b')]['sort']);_0x43f72f['where']=qs[_0x4f49('0x3d')](_[_0x4f49('0x45')](_0x2cbe4e[_0x4f49('0x3b')],_0x338db8['filters']),_0x343365);if(_0x2cbe4e[_0x4f49('0x3b')]['filter']){_0x43f72f['where']=_[_0x4f49('0x46')](_0x43f72f[_0x4f49('0x47')],{'$or':_[_0x4f49('0x35')](_0x343365,function(_0x497cb8){if(_0x497cb8[_0x4f49('0x38')]!==_0x4f49('0x48')){var _0x5e9f60={};_0x5e9f60[_0x497cb8[_0x4f49('0x32')]]={'$like':'%'+_0x2cbe4e['query'][_0x4f49('0x49')]+'%'};return _0x5e9f60;}})});}_0x43f72f=_[_0x4f49('0x46')]({},_0x43f72f,_0x2cbe4e[_0x4f49('0x4a')]);var _0x5e6632={'where':_0x43f72f[_0x4f49('0x47')]};return db[_0x4f49('0x4b')][_0x4f49('0x4c')](_0x5e6632)[_0x4f49('0x1c')](function(_0x29dfdb){_0x44e6a0[_0x4f49('0x4c')]=_0x29dfdb;if(_0x2cbe4e[_0x4f49('0x3b')][_0x4f49('0x4d')]){_0x43f72f[_0x4f49('0x4e')]=[{'all':!![]}];}return db[_0x4f49('0x4b')]['findAll'](_0x43f72f);})[_0x4f49('0x1c')](function(_0x44bf1d){_0x44e6a0['rows']=_0x44bf1d;return _0x44e6a0;})[_0x4f49('0x1c')](respondWithFilteredResult(_0x3ad6a7,_0x43f72f))['catch'](handleError(_0x3ad6a7,null));};exports[_0x4f49('0x4f')]=function(_0x41c580,_0x2d3dcd){var _0x300230={'raw':![],'where':{'id':_0x41c580[_0x4f49('0x50')]['id']}},_0x4a91ec={};_0x4a91ec[_0x4f49('0x3a')]=_[_0x4f49('0x3c')](db[_0x4f49('0x4b')][_0x4f49('0x36')]);_0x4a91ec[_0x4f49('0x3b')]=_[_0x4f49('0x3c')](_0x41c580[_0x4f49('0x3b')]);_0x4a91ec[_0x4f49('0x3d')]=_[_0x4f49('0x3e')](_0x4a91ec[_0x4f49('0x3a')],_0x4a91ec[_0x4f49('0x3b')]);_0x300230[_0x4f49('0x3f')]=_[_0x4f49('0x3e')](_0x4a91ec[_0x4f49('0x3a')],qs[_0x4f49('0x40')](_0x41c580['query']['fields']));_0x300230[_0x4f49('0x3f')]=_0x300230[_0x4f49('0x3f')][_0x4f49('0x41')]?_0x300230[_0x4f49('0x3f')]:_0x4a91ec[_0x4f49('0x3a')];if(_0x41c580[_0x4f49('0x3b')][_0x4f49('0x4d')]){_0x300230['include']=[{'all':!![]}];}_0x300230=_[_0x4f49('0x46')]({},_0x300230,_0x41c580['options']);return db[_0x4f49('0x4b')][_0x4f49('0x51')](_0x300230)[_0x4f49('0x1c')](handleEntityNotFound(_0x2d3dcd,null))[_0x4f49('0x1c')](respondWithResult(_0x2d3dcd,null))['catch'](handleError(_0x2d3dcd,null));};exports[_0x4f49('0x52')]=function(_0x5e75f5,_0x52d18c){return db[_0x4f49('0x4b')][_0x4f49('0x52')](_0x5e75f5[_0x4f49('0x53')],{})[_0x4f49('0x1c')](respondWithResult(_0x52d18c,0xc9))['catch'](handleError(_0x52d18c,null));};exports['update']=function(_0xd7f47b,_0x291a45){if(_0xd7f47b['body']['id']){delete _0xd7f47b[_0x4f49('0x53')]['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0xd7f47b[_0x4f49('0x50')]['id']}})['then'](handleEntityNotFound(_0x291a45,null))[_0x4f49('0x1c')](saveUpdates(_0xd7f47b['body'],null))[_0x4f49('0x1c')](respondWithResult(_0x291a45,null))[_0x4f49('0x54')](handleError(_0x291a45,null));};exports[_0x4f49('0x2f')]=function(_0x883408,_0x16a591){return db[_0x4f49('0x4b')][_0x4f49('0x51')]({'where':{'id':_0x883408[_0x4f49('0x50')]['id']}})['then'](handleEntityNotFound(_0x16a591,null))[_0x4f49('0x1c')](removeEntity(_0x16a591,null))['catch'](handleError(_0x16a591,null));};exports[_0x4f49('0x55')]=function(_0x1f640d,_0xc4fc6b,_0x467f12){var _0x1981e0={};var _0xb7538c={};var _0x553981;var _0x426c50;return db[_0x4f49('0x4b')]['findOne']({'where':{'id':_0x1f640d['params']['id']}})[_0x4f49('0x1c')](handleEntityNotFound(_0xc4fc6b,null))[_0x4f49('0x1c')](function(_0x2e0df5){if(_0x2e0df5){_0x553981=_0x2e0df5;_0xb7538c[_0x4f49('0x3a')]=_[_0x4f49('0x3c')](db['FreshsalesField'][_0x4f49('0x36')]);_0xb7538c['query']=_[_0x4f49('0x3c')](_0x1f640d[_0x4f49('0x3b')]);_0xb7538c[_0x4f49('0x3d')]=_['intersection'](_0xb7538c[_0x4f49('0x3a')],_0xb7538c[_0x4f49('0x3b')]);_0x1981e0[_0x4f49('0x3f')]=_[_0x4f49('0x3e')](_0xb7538c['model'],qs[_0x4f49('0x40')](_0x1f640d[_0x4f49('0x3b')]['fields']));_0x1981e0[_0x4f49('0x3f')]=_0x1981e0[_0x4f49('0x3f')][_0x4f49('0x41')]?_0x1981e0[_0x4f49('0x3f')]:_0xb7538c[_0x4f49('0x3a')];_0x1981e0[_0x4f49('0x43')]=qs[_0x4f49('0x44')](_0x1f640d[_0x4f49('0x3b')]['sort']);_0x1981e0[_0x4f49('0x47')]=qs[_0x4f49('0x3d')](_[_0x4f49('0x45')](_0x1f640d[_0x4f49('0x3b')],_0xb7538c[_0x4f49('0x3d')]));if(_0x1f640d[_0x4f49('0x3b')][_0x4f49('0x49')]){_0x1981e0['where']=_[_0x4f49('0x46')](_0x1981e0['where'],{'$or':_[_0x4f49('0x35')](_0x1981e0[_0x4f49('0x3f')],function(_0x4714c7){var _0xf29378={};_0xf29378[_0x4714c7]={'$like':'%'+_0x1f640d[_0x4f49('0x3b')][_0x4f49('0x49')]+'%'};return _0xf29378;})});}_0x1981e0=_[_0x4f49('0x46')]({},_0x1981e0,_0x1f640d[_0x4f49('0x4a')]);return _0x553981[_0x4f49('0x55')](_0x1981e0);}})[_0x4f49('0x1c')](function(_0x545552){if(_0x545552){_0x426c50=_0x545552[_0x4f49('0x41')];if(!_0x1f640d[_0x4f49('0x3b')][_0x4f49('0x42')](_0x4f49('0x56'))){_0x1981e0['limit']=qs['limit'](_0x1f640d[_0x4f49('0x3b')]['limit']);_0x1981e0[_0x4f49('0x29')]=qs[_0x4f49('0x29')](_0x1f640d[_0x4f49('0x3b')][_0x4f49('0x29')]);}return _0x553981[_0x4f49('0x55')](_0x1981e0);}})[_0x4f49('0x1c')](function(_0x179431){if(_0x179431){return _0x179431?{'count':_0x426c50,'rows':_0x179431}:null;}})[_0x4f49('0x1c')](respondWithResult(_0xc4fc6b,null))[_0x4f49('0x54')](handleError(_0xc4fc6b,null));};exports[_0x4f49('0x57')]=function(_0x71ea58,_0x1ba97e,_0x2b3484){var _0xd53de8={};var _0x234984={};var _0x412d84;var _0x30afed;return db[_0x4f49('0x4b')][_0x4f49('0x58')]({'where':{'id':_0x71ea58[_0x4f49('0x50')]['id']}})[_0x4f49('0x1c')](handleEntityNotFound(_0x1ba97e,null))[_0x4f49('0x1c')](function(_0xf6d04b){if(_0xf6d04b){_0x412d84=_0xf6d04b;_0x234984[_0x4f49('0x3a')]=_[_0x4f49('0x3c')](db['FreshsalesField'][_0x4f49('0x36')]);_0x234984['query']=_[_0x4f49('0x3c')](_0x71ea58[_0x4f49('0x3b')]);_0x234984[_0x4f49('0x3d')]=_[_0x4f49('0x3e')](_0x234984[_0x4f49('0x3a')],_0x234984[_0x4f49('0x3b')]);_0xd53de8[_0x4f49('0x3f')]=_[_0x4f49('0x3e')](_0x234984[_0x4f49('0x3a')],qs['fields'](_0x71ea58['query'][_0x4f49('0x40')]));_0xd53de8['attributes']=_0xd53de8[_0x4f49('0x3f')][_0x4f49('0x41')]?_0xd53de8[_0x4f49('0x3f')]:_0x234984[_0x4f49('0x3a')];_0xd53de8[_0x4f49('0x43')]=qs['sort'](_0x71ea58['query'][_0x4f49('0x44')]);_0xd53de8[_0x4f49('0x47')]=qs['filters'](_[_0x4f49('0x45')](_0x71ea58[_0x4f49('0x3b')],_0x234984['filters']));if(_0x71ea58[_0x4f49('0x3b')]['filter']){_0xd53de8[_0x4f49('0x47')]=_[_0x4f49('0x46')](_0xd53de8['where'],{'$or':_[_0x4f49('0x35')](_0xd53de8[_0x4f49('0x3f')],function(_0x944375){var _0x1ae1e3={};_0x1ae1e3[_0x944375]={'$like':'%'+_0x71ea58[_0x4f49('0x3b')][_0x4f49('0x49')]+'%'};return _0x1ae1e3;})});}_0xd53de8=_['merge']({},_0xd53de8,_0x71ea58[_0x4f49('0x4a')]);return _0x412d84['getDescriptions'](_0xd53de8);}})[_0x4f49('0x1c')](function(_0x574343){if(_0x574343){_0x30afed=_0x574343[_0x4f49('0x41')];if(!_0x71ea58['query'][_0x4f49('0x42')](_0x4f49('0x56'))){_0xd53de8[_0x4f49('0x2a')]=qs[_0x4f49('0x2a')](_0x71ea58['query'][_0x4f49('0x2a')]);_0xd53de8['offset']=qs[_0x4f49('0x29')](_0x71ea58['query'][_0x4f49('0x29')]);}return _0x412d84['getDescriptions'](_0xd53de8);}})['then'](function(_0x329a49){if(_0x329a49){return _0x329a49?{'count':_0x30afed,'rows':_0x329a49}:null;}})[_0x4f49('0x1c')](respondWithResult(_0x1ba97e,null))[_0x4f49('0x54')](handleError(_0x1ba97e,null));};exports['getFields']=function(_0x289810,_0x431c15,_0x5c33c9){var _0x5d52ae={};var _0x5c2acd={};var _0x3fb913;var _0x18d37f;return db[_0x4f49('0x4b')][_0x4f49('0x58')]({'where':{'id':_0x289810[_0x4f49('0x50')]['id']}})['then'](handleEntityNotFound(_0x431c15,null))[_0x4f49('0x1c')](function(_0x1b922e){if(_0x1b922e){_0x3fb913=_0x1b922e;_0x5c2acd[_0x4f49('0x3a')]=_['keys'](db[_0x4f49('0x59')][_0x4f49('0x36')]);_0x5c2acd[_0x4f49('0x3b')]=_[_0x4f49('0x3c')](_0x289810['query']);_0x5c2acd[_0x4f49('0x3d')]=_[_0x4f49('0x3e')](_0x5c2acd[_0x4f49('0x3a')],_0x5c2acd[_0x4f49('0x3b')]);_0x5d52ae[_0x4f49('0x3f')]=_['intersection'](_0x5c2acd[_0x4f49('0x3a')],qs[_0x4f49('0x40')](_0x289810['query'][_0x4f49('0x40')]));_0x5d52ae['attributes']=_0x5d52ae[_0x4f49('0x3f')]['length']?_0x5d52ae[_0x4f49('0x3f')]:_0x5c2acd[_0x4f49('0x3a')];_0x5d52ae[_0x4f49('0x43')]=qs[_0x4f49('0x44')](_0x289810[_0x4f49('0x3b')]['sort']);_0x5d52ae[_0x4f49('0x47')]=qs[_0x4f49('0x3d')](_[_0x4f49('0x45')](_0x289810[_0x4f49('0x3b')],_0x5c2acd['filters']));if(_0x289810[_0x4f49('0x3b')]['filter']){_0x5d52ae[_0x4f49('0x47')]=_['merge'](_0x5d52ae[_0x4f49('0x47')],{'$or':_[_0x4f49('0x35')](_0x5d52ae[_0x4f49('0x3f')],function(_0x34fca3){var _0x111e90={};_0x111e90[_0x34fca3]={'$like':'%'+_0x289810[_0x4f49('0x3b')][_0x4f49('0x49')]+'%'};return _0x111e90;})});}_0x5d52ae=_[_0x4f49('0x46')]({},_0x5d52ae,_0x289810[_0x4f49('0x4a')]);return _0x3fb913[_0x4f49('0x5a')](_0x5d52ae);}})['then'](function(_0x33098a){if(_0x33098a){_0x18d37f=_0x33098a[_0x4f49('0x41')];if(!_0x289810[_0x4f49('0x3b')][_0x4f49('0x42')](_0x4f49('0x56'))){_0x5d52ae[_0x4f49('0x2a')]=qs['limit'](_0x289810[_0x4f49('0x3b')][_0x4f49('0x2a')]);_0x5d52ae[_0x4f49('0x29')]=qs[_0x4f49('0x29')](_0x289810['query'][_0x4f49('0x29')]);}return _0x3fb913['getFields'](_0x5d52ae);}})[_0x4f49('0x1c')](function(_0x2be139){if(_0x2be139){return _0x2be139?{'count':_0x18d37f,'rows':_0x2be139}:null;}})[_0x4f49('0x1c')](respondWithResult(_0x431c15,null))[_0x4f49('0x54')](handleError(_0x431c15,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index aa6a393..16e7afc 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 _0xf3dc=['bluebird','request-promise','path','rimraf','../../config/environment','int_freshsales_configurations','lodash','util','../../config/logger','moment'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xf3dc,0x9c));var _0xcf3d=function(_0x1c73ee,_0x49a9c9){_0x1c73ee=_0x1c73ee-0x0;var _0x154f05=_0xf3dc[_0x1c73ee];return _0x154f05;};'use strict';var _=require(_0xcf3d('0x0'));var util=require(_0xcf3d('0x1'));var logger=require(_0xcf3d('0x2'))('api');var moment=require(_0xcf3d('0x3'));var BPromise=require(_0xcf3d('0x4'));var rp=require(_0xcf3d('0x5'));var fs=require('fs');var path=require(_0xcf3d('0x6'));var rimraf=require(_0xcf3d('0x7'));var config=require(_0xcf3d('0x8'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x55074b,_0x5b1441){return _0x55074b['define']('FreshsalesConfiguration',attributes,{'tableName':_0xcf3d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d15=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3d15,0x127));var _0x53d1=function(_0x1654e,_0x31262b){_0x1654e=_0x1654e-0x0;var _0x544920=_0x3d15[_0x1654e];return _0x544920;};'use strict';var _=require('lodash');var util=require(_0x53d1('0x0'));var logger=require(_0x53d1('0x1'))('api');var moment=require(_0x53d1('0x2'));var BPromise=require(_0x53d1('0x3'));var rp=require(_0x53d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53d1('0x5'));var config=require(_0x53d1('0x6'));var attributes=require(_0x53d1('0x7'));module['exports']=function(_0x3b3e81,_0x74eec6){return _0x3b3e81['define'](_0x53d1('0x8'),attributes,{'tableName':_0x53d1('0x9'),'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 c124f98..710383b 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 _0xbca8=['error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x17ea8a,_0x8038ac){var _0x2c2f48=function(_0x2dd21a){while(--_0x2dd21a){_0x17ea8a['push'](_0x17ea8a['shift']());}};_0x2c2f48(++_0x8038ac);}(_0xbca8,0xcc));var _0x8bca=function(_0x15ef2e,_0x2503e3){_0x15ef2e=_0x15ef2e-0x0;var _0xc80c8a=_0xbca8[_0x15ef2e];return _0xc80c8a;};'use strict';var _=require(_0x8bca('0x0'));var util=require(_0x8bca('0x1'));var moment=require(_0x8bca('0x2'));var BPromise=require(_0x8bca('0x3'));var rs=require(_0x8bca('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bca('0x5'))['db'];var utils=require(_0x8bca('0x6'));var logger=require(_0x8bca('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8bca('0x8'));var client=jayson[_0x8bca('0x9')][_0x8bca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x348ddd,_0x4b3267,_0x3fdccf){return new BPromise(function(_0x38e241,_0x278c99){return client[_0x8bca('0xb')](_0x348ddd,_0x3fdccf)[_0x8bca('0xc')](function(_0xe266ca){logger[_0x8bca('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4b3267,'request\x20sent');logger[_0x8bca('0xe')](_0x8bca('0xf'),_0x4b3267,'request\x20sent',JSON['stringify'](_0xe266ca));if(_0xe266ca[_0x8bca('0x10')]){if(_0xe266ca['error'][_0x8bca('0x11')]===0x1f4){logger[_0x8bca('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4b3267,_0xe266ca[_0x8bca('0x10')][_0x8bca('0x12')]);return _0x278c99(_0xe266ca[_0x8bca('0x10')][_0x8bca('0x12')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x4b3267,_0xe266ca[_0x8bca('0x10')]['message']);return _0x38e241(_0xe266ca[_0x8bca('0x10')][_0x8bca('0x12')]);}else{logger[_0x8bca('0xd')](_0x8bca('0x13'),_0x4b3267,_0x8bca('0x14'));_0x38e241(_0xe266ca[_0x8bca('0x15')]['message']);}})['catch'](function(_0x11037e){logger['error'](_0x8bca('0x13'),_0x4b3267,_0x11037e);_0x278c99(_0x11037e);});});} \ No newline at end of file +var _0x97c1=['../../config/logger','rpc','../../config/environment','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x47dff0,_0x19c0f1){var _0x4cbdcd=function(_0x498e5f){while(--_0x498e5f){_0x47dff0['push'](_0x47dff0['shift']());}};_0x4cbdcd(++_0x19c0f1);}(_0x97c1,0xdf));var _0x197c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x97c1[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var moment=require('moment');var BPromise=require(_0x197c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x197c('0x3'))['db'];var utils=require(_0x197c('0x4'));var logger=require(_0x197c('0x5'))(_0x197c('0x6'));var config=require(_0x197c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x197c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x437214,_0x60fab2,_0xfcee35){return new BPromise(function(_0x5cf5cb,_0x5d42c5){return client[_0x197c('0x9')](_0x437214,_0xfcee35)['then'](function(_0x339fab){logger[_0x197c('0xa')](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));logger['debug'](_0x197c('0xd'),_0x60fab2,_0x197c('0xc'),JSON[_0x197c('0xe')](_0x339fab));if(_0x339fab[_0x197c('0xf')]){if(_0x339fab[_0x197c('0xf')]['code']===0x1f4){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5d42c5(_0x339fab['error'][_0x197c('0x10')]);}logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5cf5cb(_0x339fab[_0x197c('0xf')]['message']);}else{logger['info'](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));_0x5cf5cb(_0x339fab[_0x197c('0x11')][_0x197c('0x10')]);}})[_0x197c('0x12')](function(_0x7e302f){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x7e302f);_0x5d42c5(_0x7e302f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index f49df4e..0a5620e 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 _0xe830=['../../config/environment','./intFreshsalesField.controller','index','/:id','isAuthenticated','show','post','create','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1b1f88,_0x3fe1cb){var _0x5045b9=function(_0x5c1367){while(--_0x5c1367){_0x1b1f88['push'](_0x1b1f88['shift']());}};_0x5045b9(++_0x3fe1cb);}(_0xe830,0xf9));var _0x0e83=function(_0x40979f,_0x5c92ec){_0x40979f=_0x40979f-0x0;var _0x234d48=_0xe830[_0x40979f];return _0x234d48;};'use strict';var multer=require(_0x0e83('0x0'));var util=require(_0x0e83('0x1'));var path=require('path');var timeout=require(_0x0e83('0x2'));var express=require(_0x0e83('0x3'));var router=express[_0x0e83('0x4')]();var auth=require(_0x0e83('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0e83('0x6'));var controller=require(_0x0e83('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x0e83('0x8')]);router['get'](_0x0e83('0x9'),auth[_0x0e83('0xa')](),controller[_0x0e83('0xb')]);router[_0x0e83('0xc')]('/',auth[_0x0e83('0xa')](),controller[_0x0e83('0xd')]);router['put'](_0x0e83('0x9'),auth[_0x0e83('0xa')](),controller['update']);router[_0x0e83('0xe')](_0x0e83('0x9'),auth[_0x0e83('0xa')](),controller[_0x0e83('0xf')]);module[_0x0e83('0x10')]=router; \ No newline at end of file +var _0x55e1=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x55e1,0x98));var _0x155e=function(_0x14e5cd,_0x3d95ef){_0x14e5cd=_0x14e5cd-0x0;var _0x5c1094=_0x55e1[_0x14e5cd];return _0x5c1094;};'use strict';var multer=require(_0x155e('0x0'));var util=require('util');var path=require(_0x155e('0x1'));var timeout=require(_0x155e('0x2'));var express=require(_0x155e('0x3'));var router=express[_0x155e('0x4')]();var auth=require(_0x155e('0x5'));var interaction=require(_0x155e('0x6'));var config=require(_0x155e('0x7'));var controller=require(_0x155e('0x8'));router[_0x155e('0x9')]('/',auth[_0x155e('0xa')](),controller['index']);router[_0x155e('0x9')](_0x155e('0xb'),auth[_0x155e('0xa')](),controller[_0x155e('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x155e('0xd')]);router[_0x155e('0xe')](_0x155e('0xb'),auth[_0x155e('0xa')](),controller[_0x155e('0xf')]);router[_0x155e('0x10')](_0x155e('0xb'),auth['isAuthenticated'](),controller[_0x155e('0x11')]);module[_0x155e('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 1d10b18..7c2785a 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 _0x2938=['sequelize','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x4b6683,_0x2e0349){var _0x2a2bcc=function(_0x1ac221){while(--_0x1ac221){_0x4b6683['push'](_0x4b6683['shift']());}};_0x2a2bcc(++_0x2e0349);}(_0x2938,0xb0));var _0x8293=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2938[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x8293('0x0'));module['exports']={'type':{'type':Sequelize[_0x8293('0x1')](_0x8293('0x2'),_0x8293('0x3'),_0x8293('0x4'),_0x8293('0x5')),'defaultValue':_0x8293('0x2')},'content':{'type':Sequelize[_0x8293('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8293('0x1')]('string',_0x8293('0x3'),_0x8293('0x4'))},'keyContent':{'type':Sequelize[_0x8293('0x6')]},'idField':{'type':Sequelize[_0x8293('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8293('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8293('0x6')]}}; \ No newline at end of file +var _0xf8bb=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xf8bb,0xd6));var _0xbf8b=function(_0x4c5da8,_0x59bffa){_0x4c5da8=_0x4c5da8-0x0;var _0x1a8cef=_0xf8bb[_0x4c5da8];return _0x1a8cef;};'use strict';var Sequelize=require(_0xbf8b('0x0'));module[_0xbf8b('0x1')]={'type':{'type':Sequelize['ENUM'](_0xbf8b('0x2'),_0xbf8b('0x3'),_0xbf8b('0x4'),_0xbf8b('0x5')),'defaultValue':_0xbf8b('0x2')},'content':{'type':Sequelize[_0xbf8b('0x6')]},'key':{'type':Sequelize[_0xbf8b('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xbf8b('0x3'),_0xbf8b('0x4'))},'keyContent':{'type':Sequelize[_0xbf8b('0x6')]},'idField':{'type':Sequelize[_0xbf8b('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xbf8b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbf8b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index f2a284b..7e24914 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 _0x1f93=['ejs','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','set','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','FreshsalesField','count','includeAll','findAll','rows','catch','show','length','include','options','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv'];(function(_0x59def1,_0x51fb9a){var _0x38aa12=function(_0x20dded){while(--_0x20dded){_0x59def1['push'](_0x59def1['shift']());}};_0x38aa12(++_0x51fb9a);}(_0x1f93,0x122));var _0x31f9=function(_0x2b2f95,_0x4a74ca){_0x2b2f95=_0x2b2f95-0x0;var _0x120598=_0x1f93[_0x2b2f95];return _0x120598;};'use strict';var pdf=require(_0x31f9('0x0'));var emlformat=require(_0x31f9('0x1'));var rimraf=require(_0x31f9('0x2'));var zipdir=require(_0x31f9('0x3'));var jsonpatch=require(_0x31f9('0x4'));var rp=require('request-promise');var moment=require(_0x31f9('0x5'));var BPromise=require(_0x31f9('0x6'));var Mustache=require('mustache');var util=require(_0x31f9('0x7'));var path=require(_0x31f9('0x8'));var sox=require('sox');var csv=require(_0x31f9('0x9'));var ejs=require(_0x31f9('0xa'));var fs=require('fs');var _=require(_0x31f9('0xb'));var squel=require('squel');var crypto=require(_0x31f9('0xc'));var jsforce=require(_0x31f9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x31f9('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x31f9('0xe'));var authService=require(_0x31f9('0xf'));var qs=require(_0x31f9('0x10'));var as=require(_0x31f9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x31f9('0x12'))(_0x31f9('0x13'));var utils=require(_0x31f9('0x14'));var config=require(_0x31f9('0x15'));var licenseUtil=require(_0x31f9('0x16'));var db=require(_0x31f9('0x17'))['db'];function respondWithStatusCode(_0x31bc38,_0x50b9b8){_0x50b9b8=_0x50b9b8||0xcc;return function(_0x2fded1){if(_0x2fded1){return _0x31bc38[_0x31f9('0x18')](_0x50b9b8);}return _0x31bc38[_0x31f9('0x19')](_0x50b9b8)['end']();};}function respondWithResult(_0x266622,_0x144a90){_0x144a90=_0x144a90||0xc8;return function(_0x316d25){if(_0x316d25){return _0x266622[_0x31f9('0x19')](_0x144a90)[_0x31f9('0x1a')](_0x316d25);}};}function respondWithFilteredResult(_0x751083,_0x27a5ec){return function(_0x279a6d){if(_0x279a6d){var _0x2b7741=_0x279a6d['count'],_0xb7d804=_0x27a5ec['offset'],_0x52b0e0=_0x27a5ec['offset']+_0x27a5ec[_0x31f9('0x1b')],_0x1cf01f;if(_0x52b0e0>=_0x2b7741){_0x52b0e0=_0x2b7741;_0x1cf01f=0xc8;}else{_0x1cf01f=0xce;}_0x751083[_0x31f9('0x19')](_0x1cf01f);return _0x751083[_0x31f9('0x1c')](_0x31f9('0x1d'),_0xb7d804+'-'+_0x52b0e0+'/'+_0x2b7741)[_0x31f9('0x1a')](_0x279a6d);}return null;};}function patchUpdates(_0x34a525){return function(_0xe77cfa){try{jsonpatch['apply'](_0xe77cfa,_0x34a525,!![]);}catch(_0x3a5a94){return BPromise[_0x31f9('0x1e')](_0x3a5a94);}return _0xe77cfa[_0x31f9('0x1f')]();};}function saveUpdates(_0x357a2a,_0x124a9b){return function(_0x2c9b81){if(_0x2c9b81){return _0x2c9b81[_0x31f9('0x20')](_0x357a2a)['then'](function(_0x48e976){return _0x48e976;});}return null;};}function removeEntity(_0x5a7fa7,_0x440526){return function(_0x1085c8){if(_0x1085c8){return _0x1085c8[_0x31f9('0x21')]()[_0x31f9('0x22')](function(){_0x5a7fa7[_0x31f9('0x19')](0xcc)[_0x31f9('0x23')]();});}};}function handleEntityNotFound(_0x47b706,_0x5b70e3){return function(_0x168d66){if(!_0x168d66){_0x47b706['sendStatus'](0x194);}return _0x168d66;};}function handleError(_0x226c3d,_0x70ab9){_0x70ab9=_0x70ab9||0x1f4;return function(_0x3b6bc0){logger[_0x31f9('0x24')](_0x3b6bc0[_0x31f9('0x25')]);if(_0x3b6bc0[_0x31f9('0x26')]){delete _0x3b6bc0[_0x31f9('0x26')];}_0x226c3d[_0x31f9('0x19')](_0x70ab9)[_0x31f9('0x27')](_0x3b6bc0);};}exports[_0x31f9('0x28')]=function(_0x4c84dc,_0x165d44){var _0x478b9a={},_0x4b554a={},_0x5351d4={'count':0x0,'rows':[]};var _0x1079f4=_[_0x31f9('0x29')](db['FreshsalesField'][_0x31f9('0x2a')],function(_0x13468a){return{'name':_0x13468a['fieldName'],'type':_0x13468a[_0x31f9('0x2b')][_0x31f9('0x2c')]};});_0x4b554a[_0x31f9('0x2d')]=_['map'](_0x1079f4,_0x31f9('0x26'));_0x4b554a[_0x31f9('0x2e')]=_[_0x31f9('0x2f')](_0x4c84dc['query']);_0x4b554a[_0x31f9('0x30')]=_['intersection'](_0x4b554a[_0x31f9('0x2d')],_0x4b554a[_0x31f9('0x2e')]);_0x478b9a[_0x31f9('0x31')]=_[_0x31f9('0x32')](_0x4b554a[_0x31f9('0x2d')],qs[_0x31f9('0x33')](_0x4c84dc[_0x31f9('0x2e')][_0x31f9('0x33')]));_0x478b9a[_0x31f9('0x31')]=_0x478b9a[_0x31f9('0x31')]['length']?_0x478b9a[_0x31f9('0x31')]:_0x4b554a[_0x31f9('0x2d')];if(!_0x4c84dc[_0x31f9('0x2e')][_0x31f9('0x34')](_0x31f9('0x35'))){_0x478b9a[_0x31f9('0x1b')]=qs[_0x31f9('0x1b')](_0x4c84dc[_0x31f9('0x2e')]['limit']);_0x478b9a[_0x31f9('0x36')]=qs['offset'](_0x4c84dc[_0x31f9('0x2e')][_0x31f9('0x36')]);}_0x478b9a[_0x31f9('0x37')]=qs['sort'](_0x4c84dc[_0x31f9('0x2e')][_0x31f9('0x38')]);_0x478b9a[_0x31f9('0x39')]=qs['filters'](_[_0x31f9('0x3a')](_0x4c84dc[_0x31f9('0x2e')],_0x4b554a[_0x31f9('0x30')]),_0x1079f4);if(_0x4c84dc[_0x31f9('0x2e')][_0x31f9('0x3b')]){_0x478b9a[_0x31f9('0x39')]=_[_0x31f9('0x3c')](_0x478b9a['where'],{'$or':_[_0x31f9('0x29')](_0x1079f4,function(_0x27b6f7){if(_0x27b6f7[_0x31f9('0x2b')]!=='VIRTUAL'){var _0x221f36={};_0x221f36[_0x27b6f7[_0x31f9('0x26')]]={'$like':'%'+_0x4c84dc['query'][_0x31f9('0x3b')]+'%'};return _0x221f36;}})});}_0x478b9a=_[_0x31f9('0x3c')]({},_0x478b9a,_0x4c84dc['options']);var _0x2376ab={'where':_0x478b9a[_0x31f9('0x39')]};return db[_0x31f9('0x3d')][_0x31f9('0x3e')](_0x2376ab)['then'](function(_0x27c288){_0x5351d4['count']=_0x27c288;if(_0x4c84dc[_0x31f9('0x2e')][_0x31f9('0x3f')]){_0x478b9a['include']=[{'all':!![]}];}return db[_0x31f9('0x3d')][_0x31f9('0x40')](_0x478b9a);})['then'](function(_0xb22ae1){_0x5351d4[_0x31f9('0x41')]=_0xb22ae1;return _0x5351d4;})['then'](respondWithFilteredResult(_0x165d44,_0x478b9a))[_0x31f9('0x42')](handleError(_0x165d44,null));};exports[_0x31f9('0x43')]=function(_0x2940fb,_0x58aa7d){var _0xaf166c={'raw':!![],'where':{'id':_0x2940fb['params']['id']}},_0xa8860={};_0xa8860['model']=_[_0x31f9('0x2f')](db['FreshsalesField']['rawAttributes']);_0xa8860['query']=_[_0x31f9('0x2f')](_0x2940fb[_0x31f9('0x2e')]);_0xa8860[_0x31f9('0x30')]=_[_0x31f9('0x32')](_0xa8860['model'],_0xa8860[_0x31f9('0x2e')]);_0xaf166c['attributes']=_[_0x31f9('0x32')](_0xa8860['model'],qs[_0x31f9('0x33')](_0x2940fb['query'][_0x31f9('0x33')]));_0xaf166c['attributes']=_0xaf166c[_0x31f9('0x31')][_0x31f9('0x44')]?_0xaf166c[_0x31f9('0x31')]:_0xa8860[_0x31f9('0x2d')];if(_0x2940fb[_0x31f9('0x2e')][_0x31f9('0x3f')]){_0xaf166c[_0x31f9('0x45')]=[{'all':!![]}];}_0xaf166c=_[_0x31f9('0x3c')]({},_0xaf166c,_0x2940fb[_0x31f9('0x46')]);return db[_0x31f9('0x3d')][_0x31f9('0x47')](_0xaf166c)[_0x31f9('0x22')](handleEntityNotFound(_0x58aa7d,null))['then'](respondWithResult(_0x58aa7d,null))[_0x31f9('0x42')](handleError(_0x58aa7d,null));};exports[_0x31f9('0x48')]=function(_0x28b61c,_0x549277){return db[_0x31f9('0x3d')]['create'](_0x28b61c['body'],{})[_0x31f9('0x22')](respondWithResult(_0x549277,0xc9))[_0x31f9('0x42')](handleError(_0x549277,null));};exports[_0x31f9('0x20')]=function(_0x18a013,_0x51d448){if(_0x18a013['body']['id']){delete _0x18a013[_0x31f9('0x49')]['id'];}return db[_0x31f9('0x3d')][_0x31f9('0x47')]({'where':{'id':_0x18a013[_0x31f9('0x4a')]['id']}})[_0x31f9('0x22')](handleEntityNotFound(_0x51d448,null))['then'](saveUpdates(_0x18a013[_0x31f9('0x49')],null))[_0x31f9('0x22')](respondWithResult(_0x51d448,null))[_0x31f9('0x42')](handleError(_0x51d448,null));};exports['destroy']=function(_0x418deb,_0x1092ee){return db[_0x31f9('0x3d')][_0x31f9('0x47')]({'where':{'id':_0x418deb[_0x31f9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1092ee,null))[_0x31f9('0x22')](removeEntity(_0x1092ee,null))['catch'](handleError(_0x1092ee,null));}; \ No newline at end of file +var _0xc1f6=['stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','then','catch','show','params','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','destroy'];(function(_0x485888,_0x44d477){var _0x3e5f47=function(_0x3ed74a){while(--_0x3ed74a){_0x485888['push'](_0x485888['shift']());}};_0x3e5f47(++_0x44d477);}(_0xc1f6,0xb9));var _0x6c1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc1f6[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x6c1f('0x0'));var emlformat=require(_0x6c1f('0x1'));var rimraf=require(_0x6c1f('0x2'));var zipdir=require(_0x6c1f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6c1f('0x4'));var BPromise=require(_0x6c1f('0x5'));var Mustache=require(_0x6c1f('0x6'));var util=require(_0x6c1f('0x7'));var path=require(_0x6c1f('0x8'));var sox=require(_0x6c1f('0x9'));var csv=require(_0x6c1f('0xa'));var ejs=require(_0x6c1f('0xb'));var fs=require('fs');var _=require(_0x6c1f('0xc'));var squel=require('squel');var crypto=require(_0x6c1f('0xd'));var jsforce=require(_0x6c1f('0xe'));var deskjs=require(_0x6c1f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6c1f('0x10'));var Papa=require('papaparse');var Redis=require(_0x6c1f('0x11'));var authService=require(_0x6c1f('0x12'));var qs=require(_0x6c1f('0x13'));var as=require(_0x6c1f('0x14'));var hardwareService=require(_0x6c1f('0x15'));var logger=require('../../config/logger')(_0x6c1f('0x16'));var utils=require(_0x6c1f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6c1f('0x18'));var db=require(_0x6c1f('0x19'))['db'];function respondWithStatusCode(_0xcaebd0,_0x1b4ccb){_0x1b4ccb=_0x1b4ccb||0xcc;return function(_0x16c80e){if(_0x16c80e){return _0xcaebd0[_0x6c1f('0x1a')](_0x1b4ccb);}return _0xcaebd0[_0x6c1f('0x1b')](_0x1b4ccb)['end']();};}function respondWithResult(_0x3ef74b,_0x4b1572){_0x4b1572=_0x4b1572||0xc8;return function(_0x446940){if(_0x446940){return _0x3ef74b[_0x6c1f('0x1b')](_0x4b1572)[_0x6c1f('0x1c')](_0x446940);}};}function respondWithFilteredResult(_0x2a2e0b,_0x1e7bd6){return function(_0x42e541){if(_0x42e541){var _0x4f0632=_0x42e541[_0x6c1f('0x1d')],_0x569bb5=_0x1e7bd6[_0x6c1f('0x1e')],_0x133836=_0x1e7bd6[_0x6c1f('0x1e')]+_0x1e7bd6[_0x6c1f('0x1f')],_0x315632;if(_0x133836>=_0x4f0632){_0x133836=_0x4f0632;_0x315632=0xc8;}else{_0x315632=0xce;}_0x2a2e0b['status'](_0x315632);return _0x2a2e0b[_0x6c1f('0x20')](_0x6c1f('0x21'),_0x569bb5+'-'+_0x133836+'/'+_0x4f0632)['json'](_0x42e541);}return null;};}function patchUpdates(_0x17b9bf){return function(_0x490a05){try{jsonpatch['apply'](_0x490a05,_0x17b9bf,!![]);}catch(_0x1e0a66){return BPromise[_0x6c1f('0x22')](_0x1e0a66);}return _0x490a05['save']();};}function saveUpdates(_0x2ee4d2,_0x8cd4ff){return function(_0x3b44e8){if(_0x3b44e8){return _0x3b44e8[_0x6c1f('0x23')](_0x2ee4d2)['then'](function(_0x409691){return _0x409691;});}return null;};}function removeEntity(_0x3ed5e1,_0x4d325a){return function(_0x223aa9){if(_0x223aa9){return _0x223aa9[_0x6c1f('0x24')]()['then'](function(){_0x3ed5e1[_0x6c1f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aabc8,_0x466f51){return function(_0x575f70){if(!_0x575f70){_0x4aabc8['sendStatus'](0x194);}return _0x575f70;};}function handleError(_0x748b70,_0x2d90dc){_0x2d90dc=_0x2d90dc||0x1f4;return function(_0xc485cc){logger['error'](_0xc485cc[_0x6c1f('0x25')]);if(_0xc485cc[_0x6c1f('0x26')]){delete _0xc485cc[_0x6c1f('0x26')];}_0x748b70[_0x6c1f('0x1b')](_0x2d90dc)[_0x6c1f('0x27')](_0xc485cc);};}exports[_0x6c1f('0x28')]=function(_0x107705,_0x4db9d4){var _0x2012ed={},_0x10e705={},_0x57a036={'count':0x0,'rows':[]};var _0x228273=_[_0x6c1f('0x29')](db[_0x6c1f('0x2a')][_0x6c1f('0x2b')],function(_0x56bc6e){return{'name':_0x56bc6e[_0x6c1f('0x2c')],'type':_0x56bc6e[_0x6c1f('0x2d')]['key']};});_0x10e705[_0x6c1f('0x2e')]=_[_0x6c1f('0x29')](_0x228273,'name');_0x10e705['query']=_[_0x6c1f('0x2f')](_0x107705[_0x6c1f('0x30')]);_0x10e705['filters']=_[_0x6c1f('0x31')](_0x10e705['model'],_0x10e705[_0x6c1f('0x30')]);_0x2012ed['attributes']=_['intersection'](_0x10e705[_0x6c1f('0x2e')],qs[_0x6c1f('0x32')](_0x107705['query'][_0x6c1f('0x32')]));_0x2012ed[_0x6c1f('0x33')]=_0x2012ed[_0x6c1f('0x33')][_0x6c1f('0x34')]?_0x2012ed[_0x6c1f('0x33')]:_0x10e705[_0x6c1f('0x2e')];if(!_0x107705[_0x6c1f('0x30')][_0x6c1f('0x35')](_0x6c1f('0x36'))){_0x2012ed[_0x6c1f('0x1f')]=qs[_0x6c1f('0x1f')](_0x107705['query'][_0x6c1f('0x1f')]);_0x2012ed[_0x6c1f('0x1e')]=qs[_0x6c1f('0x1e')](_0x107705[_0x6c1f('0x30')]['offset']);}_0x2012ed[_0x6c1f('0x37')]=qs[_0x6c1f('0x38')](_0x107705[_0x6c1f('0x30')][_0x6c1f('0x38')]);_0x2012ed[_0x6c1f('0x39')]=qs[_0x6c1f('0x3a')](_[_0x6c1f('0x3b')](_0x107705[_0x6c1f('0x30')],_0x10e705[_0x6c1f('0x3a')]),_0x228273);if(_0x107705['query'][_0x6c1f('0x3c')]){_0x2012ed[_0x6c1f('0x39')]=_[_0x6c1f('0x3d')](_0x2012ed['where'],{'$or':_[_0x6c1f('0x29')](_0x228273,function(_0xdc57f2){if(_0xdc57f2['type']!=='VIRTUAL'){var _0x56a238={};_0x56a238[_0xdc57f2[_0x6c1f('0x26')]]={'$like':'%'+_0x107705[_0x6c1f('0x30')]['filter']+'%'};return _0x56a238;}})});}_0x2012ed=_[_0x6c1f('0x3d')]({},_0x2012ed,_0x107705[_0x6c1f('0x3e')]);var _0x165dbf={'where':_0x2012ed[_0x6c1f('0x39')]};return db['FreshsalesField']['count'](_0x165dbf)['then'](function(_0x142dd7){_0x57a036[_0x6c1f('0x1d')]=_0x142dd7;if(_0x107705[_0x6c1f('0x30')][_0x6c1f('0x3f')]){_0x2012ed['include']=[{'all':!![]}];}return db[_0x6c1f('0x2a')][_0x6c1f('0x40')](_0x2012ed);})['then'](function(_0x1f17ed){_0x57a036[_0x6c1f('0x41')]=_0x1f17ed;return _0x57a036;})[_0x6c1f('0x42')](respondWithFilteredResult(_0x4db9d4,_0x2012ed))[_0x6c1f('0x43')](handleError(_0x4db9d4,null));};exports[_0x6c1f('0x44')]=function(_0x55e5e4,_0x4f2f1d){var _0x2284b3={'raw':!![],'where':{'id':_0x55e5e4[_0x6c1f('0x45')]['id']}},_0x34b7b6={};_0x34b7b6[_0x6c1f('0x2e')]=_['keys'](db[_0x6c1f('0x2a')][_0x6c1f('0x2b')]);_0x34b7b6[_0x6c1f('0x30')]=_[_0x6c1f('0x2f')](_0x55e5e4[_0x6c1f('0x30')]);_0x34b7b6['filters']=_[_0x6c1f('0x31')](_0x34b7b6[_0x6c1f('0x2e')],_0x34b7b6[_0x6c1f('0x30')]);_0x2284b3[_0x6c1f('0x33')]=_[_0x6c1f('0x31')](_0x34b7b6[_0x6c1f('0x2e')],qs[_0x6c1f('0x32')](_0x55e5e4[_0x6c1f('0x30')][_0x6c1f('0x32')]));_0x2284b3[_0x6c1f('0x33')]=_0x2284b3[_0x6c1f('0x33')][_0x6c1f('0x34')]?_0x2284b3[_0x6c1f('0x33')]:_0x34b7b6[_0x6c1f('0x2e')];if(_0x55e5e4[_0x6c1f('0x30')][_0x6c1f('0x3f')]){_0x2284b3[_0x6c1f('0x46')]=[{'all':!![]}];}_0x2284b3=_[_0x6c1f('0x3d')]({},_0x2284b3,_0x55e5e4[_0x6c1f('0x3e')]);return db[_0x6c1f('0x2a')][_0x6c1f('0x47')](_0x2284b3)[_0x6c1f('0x42')](handleEntityNotFound(_0x4f2f1d,null))[_0x6c1f('0x42')](respondWithResult(_0x4f2f1d,null))['catch'](handleError(_0x4f2f1d,null));};exports[_0x6c1f('0x48')]=function(_0x1ae324,_0x9d206c){return db['FreshsalesField'][_0x6c1f('0x48')](_0x1ae324[_0x6c1f('0x49')],{})[_0x6c1f('0x42')](respondWithResult(_0x9d206c,0xc9))[_0x6c1f('0x43')](handleError(_0x9d206c,null));};exports[_0x6c1f('0x23')]=function(_0x23882c,_0x2c161e){if(_0x23882c[_0x6c1f('0x49')]['id']){delete _0x23882c['body']['id'];}return db['FreshsalesField'][_0x6c1f('0x47')]({'where':{'id':_0x23882c[_0x6c1f('0x45')]['id']}})[_0x6c1f('0x42')](handleEntityNotFound(_0x2c161e,null))[_0x6c1f('0x42')](saveUpdates(_0x23882c['body'],null))['then'](respondWithResult(_0x2c161e,null))[_0x6c1f('0x43')](handleError(_0x2c161e,null));};exports['destroy']=function(_0x13a6e5,_0x245877){return db[_0x6c1f('0x2a')][_0x6c1f('0x47')]({'where':{'id':_0x13a6e5[_0x6c1f('0x45')]['id']}})[_0x6c1f('0x42')](handleEntityNotFound(_0x245877,null))[_0x6c1f('0x42')](removeEntity(_0x245877,null))[_0x6c1f('0x43')](handleError(_0x245877,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 7c0be28..0334639 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 _0xf4ae=['FieldId','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','idField'];(function(_0x5b5cac,_0x293d64){var _0x203d2b=function(_0x325d23){while(--_0x325d23){_0x5b5cac['push'](_0x5b5cac['shift']());}};_0x203d2b(++_0x293d64);}(_0xf4ae,0x69));var _0xef4a=function(_0x2e7f96,_0x2ffe43){_0x2e7f96=_0x2e7f96-0x0;var _0x315277=_0xf4ae[_0x2e7f96];return _0x315277;};'use strict';var _=require(_0xef4a('0x0'));var util=require('util');var logger=require(_0xef4a('0x1'))(_0xef4a('0x2'));var moment=require(_0xef4a('0x3'));var BPromise=require('bluebird');var rp=require(_0xef4a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef4a('0x5'));var config=require(_0xef4a('0x6'));var attributes=require(_0xef4a('0x7'));module['exports']=function(_0x50e532,_0x5cb368){return _0x50e532[_0xef4a('0x8')](_0xef4a('0x9'),attributes,{'tableName':_0xef4a('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xef4a('0xb'),_0xef4a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4fe5=['../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1284bb,_0x527c1b){var _0x360e82=function(_0x37a6b4){while(--_0x37a6b4){_0x1284bb['push'](_0x1284bb['shift']());}};_0x360e82(++_0x527c1b);}(_0x4fe5,0x1e8));var _0x54fe=function(_0x2171c3,_0x268912){_0x2171c3=_0x2171c3-0x0;var _0x4f3768=_0x4fe5[_0x2171c3];return _0x4f3768;};'use strict';var _=require(_0x54fe('0x0'));var util=require(_0x54fe('0x1'));var logger=require(_0x54fe('0x2'))(_0x54fe('0x3'));var moment=require(_0x54fe('0x4'));var BPromise=require(_0x54fe('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x54fe('0x6'));var attributes=require(_0x54fe('0x7'));module[_0x54fe('0x8')]=function(_0x20762e,_0x14699d){return _0x20762e['define'](_0x54fe('0x9'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x54fe('0xa'),'fields':[_0x54fe('0xb'),_0x54fe('0xc')],'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 7974d02..95e0d79 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 _0x0221=['util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x41de93,_0x18f6d4){var _0x1aa3e2=function(_0x52a546){while(--_0x52a546){_0x41de93['push'](_0x41de93['shift']());}};_0x1aa3e2(++_0x18f6d4);}(_0x0221,0xc5));var _0x1022=function(_0x4fa324,_0x2cba25){_0x4fa324=_0x4fa324-0x0;var _0x14fdaa=_0x0221[_0x4fa324];return _0x14fdaa;};'use strict';var _=require(_0x1022('0x0'));var util=require(_0x1022('0x1'));var moment=require(_0x1022('0x2'));var BPromise=require(_0x1022('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1022('0x4'));var db=require(_0x1022('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1022('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1022('0x7')][_0x1022('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x267458,_0x39f393,_0xb44f8f){return new BPromise(function(_0x50031a,_0x5f676d){return client[_0x1022('0x9')](_0x267458,_0xb44f8f)[_0x1022('0xa')](function(_0x20dab1){logger[_0x1022('0xb')](_0x1022('0xc'),_0x39f393,'request\x20sent');logger[_0x1022('0xd')](_0x1022('0xe'),_0x39f393,_0x1022('0xf'),JSON[_0x1022('0x10')](_0x20dab1));if(_0x20dab1[_0x1022('0x11')]){if(_0x20dab1[_0x1022('0x11')][_0x1022('0x12')]===0x1f4){logger['error'](_0x1022('0xc'),_0x39f393,_0x20dab1[_0x1022('0x11')]['message']);return _0x5f676d(_0x20dab1[_0x1022('0x11')][_0x1022('0x13')]);}logger[_0x1022('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x39f393,_0x20dab1[_0x1022('0x11')]['message']);return _0x50031a(_0x20dab1[_0x1022('0x11')][_0x1022('0x13')]);}else{logger[_0x1022('0xb')](_0x1022('0xc'),_0x39f393,_0x1022('0xf'));_0x50031a(_0x20dab1[_0x1022('0x14')][_0x1022('0x13')]);}})[_0x1022('0x15')](function(_0x58a047){logger['error'](_0x1022('0xc'),_0x39f393,_0x58a047);_0x5f676d(_0x58a047);});});} \ No newline at end of file +var _0x956b=['jayson/promise','http','request','then','info','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesField,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x463b9a,_0x2a9eba){var _0x5f5186=function(_0xb1f6cc){while(--_0xb1f6cc){_0x463b9a['push'](_0x463b9a['shift']());}};_0x5f5186(++_0x2a9eba);}(_0x956b,0x16e));var _0xb956=function(_0x196d97,_0x92282d){_0x196d97=_0x196d97-0x0;var _0x3110f3=_0x956b[_0x196d97];return _0x3110f3;};'use strict';var _=require(_0xb956('0x0'));var util=require(_0xb956('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb956('0x2'));var fs=require('fs');var Redis=require(_0xb956('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb956('0x4'));var logger=require(_0xb956('0x5'))(_0xb956('0x6'));var config=require(_0xb956('0x7'));var jayson=require(_0xb956('0x8'));var client=jayson['client'][_0xb956('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26eedd,_0x37f7b7,_0x335d9f){return new BPromise(function(_0x11e653,_0x240541){return client[_0xb956('0xa')](_0x26eedd,_0x335d9f)[_0xb956('0xb')](function(_0x590c37){logger[_0xb956('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x37f7b7,_0xb956('0xd'));logger[_0xb956('0xe')](_0xb956('0xf'),_0x37f7b7,_0xb956('0xd'),JSON[_0xb956('0x10')](_0x590c37));if(_0x590c37[_0xb956('0x11')]){if(_0x590c37['error']['code']===0x1f4){logger[_0xb956('0x11')](_0xb956('0x12'),_0x37f7b7,_0x590c37[_0xb956('0x11')][_0xb956('0x13')]);return _0x240541(_0x590c37[_0xb956('0x11')][_0xb956('0x13')]);}logger[_0xb956('0x11')](_0xb956('0x12'),_0x37f7b7,_0x590c37['error']['message']);return _0x11e653(_0x590c37['error'][_0xb956('0x13')]);}else{logger['info'](_0xb956('0x12'),_0x37f7b7,'request\x20sent');_0x11e653(_0x590c37[_0xb956('0x14')]['message']);}})[_0xb956('0x15')](function(_0xc09054){logger[_0xb956('0x11')](_0xb956('0x12'),_0x37f7b7,_0xc09054);_0x240541(_0xc09054);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 2e5d4f9..f163694 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 _0x1af0=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1af0,0xb1));var _0x01af=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x1af0[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require(_0x01af('0x0'));var util=require(_0x01af('0x1'));var path=require('path');var timeout=require(_0x01af('0x2'));var express=require(_0x01af('0x3'));var router=express['Router']();var auth=require(_0x01af('0x4'));var interaction=require(_0x01af('0x5'));var config=require(_0x01af('0x6'));var controller=require('./intSalesforceAccount.controller');router[_0x01af('0x7')]('/',auth[_0x01af('0x8')](),controller[_0x01af('0x9')]);router['get'](_0x01af('0xa'),auth['isAuthenticated'](),controller[_0x01af('0xb')]);router[_0x01af('0x7')](_0x01af('0xc'),auth[_0x01af('0x8')](),controller[_0x01af('0xd')]);router[_0x01af('0x7')](_0x01af('0xe'),auth[_0x01af('0x8')](),controller[_0x01af('0xf')]);router[_0x01af('0x10')]('/',auth[_0x01af('0x8')](),controller[_0x01af('0x11')]);router[_0x01af('0x10')](_0x01af('0xc'),auth[_0x01af('0x8')](),controller['addConfiguration']);router[_0x01af('0x12')](_0x01af('0xa'),auth[_0x01af('0x8')](),controller[_0x01af('0x13')]);router[_0x01af('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9db9=['/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x253843,_0x33c012){var _0xe2b5ef=function(_0x39c4cb){while(--_0x39c4cb){_0x253843['push'](_0x253843['shift']());}};_0xe2b5ef(++_0x33c012);}(_0x9db9,0xf2));var _0x99db=function(_0x36166f,_0x234c8c){_0x36166f=_0x36166f-0x0;var _0x3f40ee=_0x9db9[_0x36166f];return _0x3f40ee;};'use strict';var multer=require(_0x99db('0x0'));var util=require('util');var path=require(_0x99db('0x1'));var timeout=require(_0x99db('0x2'));var express=require(_0x99db('0x3'));var router=express[_0x99db('0x4')]();var auth=require(_0x99db('0x5'));var interaction=require(_0x99db('0x6'));var config=require(_0x99db('0x7'));var controller=require('./intSalesforceAccount.controller');router[_0x99db('0x8')]('/',auth[_0x99db('0x9')](),controller[_0x99db('0xa')]);router['get'](_0x99db('0xb'),auth['isAuthenticated'](),controller[_0x99db('0xc')]);router['get'](_0x99db('0xd'),auth[_0x99db('0x9')](),controller[_0x99db('0xe')]);router[_0x99db('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x99db('0xf')]);router[_0x99db('0x10')]('/',auth['isAuthenticated'](),controller[_0x99db('0x11')]);router[_0x99db('0x10')]('/:id/configurations',auth[_0x99db('0x9')](),controller[_0x99db('0x12')]);router[_0x99db('0x13')](_0x99db('0xb'),auth['isAuthenticated'](),controller[_0x99db('0x14')]);router['delete'](_0x99db('0xb'),auth[_0x99db('0x9')](),controller[_0x99db('0x15')]);module[_0x99db('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 8d88534..03c5b71 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 _0x07a0=['STRING','username','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x5309bf,_0x48c851){var _0x515b05=function(_0x2a8f31){while(--_0x2a8f31){_0x5309bf['push'](_0x5309bf['shift']());}};_0x515b05(++_0x48c851);}(_0x07a0,0xad));var _0x007a=function(_0x3ef7b4,_0x10f9a0){_0x3ef7b4=_0x3ef7b4-0x0;var _0x4c5b83=_0x07a0[_0x3ef7b4];return _0x4c5b83;};'use strict';var Sequelize=require(_0x007a('0x0'));module[_0x007a('0x1')]={'name':{'type':Sequelize[_0x007a('0x2')]},'description':{'type':Sequelize[_0x007a('0x2')]},'username':{'type':Sequelize[_0x007a('0x2')],'unique':_0x007a('0x3')},'remoteUri':{'type':Sequelize[_0x007a('0x2')]},'password':{'type':Sequelize[_0x007a('0x2')]},'clientId':{'type':Sequelize[_0x007a('0x2')]},'clientSecret':{'type':Sequelize[_0x007a('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x007a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x007a('0x4')](_0x007a('0x5'),_0x007a('0x6')),'defaultValue':_0x007a('0x5')}}; \ No newline at end of file +var _0x4955=['sequelize','exports','STRING','ENUM','integrationTab','newTab'];(function(_0x4b6420,_0x126201){var _0x37076f=function(_0x3ee471){while(--_0x3ee471){_0x4b6420['push'](_0x4b6420['shift']());}};_0x37076f(++_0x126201);}(_0x4955,0x120));var _0x5495=function(_0x3e81b2,_0x3acc94){_0x3e81b2=_0x3e81b2-0x0;var _0x168b6f=_0x4955[_0x3e81b2];return _0x168b6f;};'use strict';var Sequelize=require(_0x5495('0x0'));module[_0x5495('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5495('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0x5495('0x2')]},'password':{'type':Sequelize[_0x5495('0x2')]},'clientId':{'type':Sequelize[_0x5495('0x2')]},'clientSecret':{'type':Sequelize[_0x5495('0x2')]},'securityToken':{'type':Sequelize[_0x5495('0x2')]},'serverUrl':{'type':Sequelize[_0x5495('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5495('0x3')](_0x5495('0x4'),_0x5495('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 9fc1989..3c257f1 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 _0x5689=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','limit','set','Content-Range','reject','update','then','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','options','SalesforceAccount','count','includeAll','include','findAll','rows','show','find','create','body','params','findOne','SalesforceConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Task','remoteUri','clientSecret','securityToken','slice','Connection','clientId','concat','isNil','ticketType','sobject','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','phone','includes','label','custom','picklistValues','True','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format'];(function(_0x8ca366,_0x164532){var _0x28ff24=function(_0x4b75ba){while(--_0x4b75ba){_0x8ca366['push'](_0x8ca366['shift']());}};_0x28ff24(++_0x164532);}(_0x5689,0x100));var _0x9568=function(_0x436a4a,_0x6430c1){_0x436a4a=_0x436a4a-0x0;var _0x591a73=_0x5689[_0x436a4a];return _0x591a73;};'use strict';var pdf=require(_0x9568('0x0'));var emlformat=require(_0x9568('0x1'));var rimraf=require(_0x9568('0x2'));var zipdir=require(_0x9568('0x3'));var jsonpatch=require(_0x9568('0x4'));var rp=require(_0x9568('0x5'));var moment=require(_0x9568('0x6'));var BPromise=require(_0x9568('0x7'));var Mustache=require(_0x9568('0x8'));var util=require('util');var path=require(_0x9568('0x9'));var sox=require(_0x9568('0xa'));var csv=require('to-csv');var ejs=require(_0x9568('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9568('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9568('0xd'));var querystring=require(_0x9568('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9568('0xf'));var qs=require(_0x9568('0x10'));var as=require(_0x9568('0x11'));var hardwareService=require(_0x9568('0x12'));var logger=require('../../config/logger')(_0x9568('0x13'));var utils=require(_0x9568('0x14'));var config=require(_0x9568('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9568('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x9568('0x17'));var client=jayson[_0x9568('0x18')][_0x9568('0x19')]({'port':0x232a});function respondWithRpcPromise(_0xbd6134,_0xd7704e,_0x35a957,_0x3f2857){return new BPromise(function(_0x4cf381,_0x32b9a5){var _0x2a84af=_0x3f2857||client;return _0x2a84af[_0x9568('0x1a')](_0xbd6134,_0x35a957)['then'](function(_0x56dff6){logger[_0x9568('0x1b')](_0x9568('0x1c'),_0xd7704e,_0x9568('0x1d'));logger[_0x9568('0x1e')](_0x9568('0x1f'),_0xd7704e,_0x9568('0x1d'),JSON[_0x9568('0x20')](_0x56dff6));if(_0x56dff6[_0x9568('0x21')]){if(_0x56dff6['error'][_0x9568('0x22')]===0x1f4){logger[_0x9568('0x21')](_0x9568('0x1c'),_0xd7704e,_0x56dff6['error'][_0x9568('0x23')]);return _0x32b9a5(_0x56dff6[_0x9568('0x21')][_0x9568('0x23')]);}logger[_0x9568('0x21')](_0x9568('0x1c'),_0xd7704e,_0x56dff6['error'][_0x9568('0x23')]);return _0x4cf381(_0x56dff6[_0x9568('0x21')][_0x9568('0x23')]);}else{logger[_0x9568('0x1b')](_0x9568('0x1c'),_0xd7704e,_0x9568('0x1d'));_0x4cf381(_0x56dff6[_0x9568('0x24')][_0x9568('0x23')]);}})[_0x9568('0x25')](function(_0x2baecf){logger[_0x9568('0x21')](_0x9568('0x1c'),_0xd7704e,_0x2baecf);_0x32b9a5(_0x2baecf);});});}function respondWithStatusCode(_0x433be5,_0x791f58){_0x791f58=_0x791f58||0xcc;return function(_0x33b48b){if(_0x33b48b){return _0x433be5['sendStatus'](_0x791f58);}return _0x433be5[_0x9568('0x26')](_0x791f58)[_0x9568('0x27')]();};}function respondWithResult(_0x366311,_0x1b7e61){_0x1b7e61=_0x1b7e61||0xc8;return function(_0x2ad271){if(_0x2ad271){return _0x366311[_0x9568('0x26')](_0x1b7e61)['json'](_0x2ad271);}};}function respondWithFilteredResult(_0x1623fd,_0x1b27b3){return function(_0x3ac780){if(_0x3ac780){var _0x1d0866=_0x3ac780['count'],_0x520aab=_0x1b27b3[_0x9568('0x28')],_0x1994ba=_0x1b27b3[_0x9568('0x28')]+_0x1b27b3[_0x9568('0x29')],_0x1834b7;if(_0x1994ba>=_0x1d0866){_0x1994ba=_0x1d0866;_0x1834b7=0xc8;}else{_0x1834b7=0xce;}_0x1623fd[_0x9568('0x26')](_0x1834b7);return _0x1623fd[_0x9568('0x2a')](_0x9568('0x2b'),_0x520aab+'-'+_0x1994ba+'/'+_0x1d0866)['json'](_0x3ac780);}return null;};}function patchUpdates(_0x141ff8){return function(_0x3fb2d8){try{jsonpatch['apply'](_0x3fb2d8,_0x141ff8,!![]);}catch(_0x3a18b5){return BPromise[_0x9568('0x2c')](_0x3a18b5);}return _0x3fb2d8['save']();};}function saveUpdates(_0x4dcca4,_0x244bbd){return function(_0x28f5ec){if(_0x28f5ec){return _0x28f5ec[_0x9568('0x2d')](_0x4dcca4)['then'](function(_0x1af096){return _0x1af096;});}return null;};}function removeEntity(_0x5f5aa3,_0x5336a0){return function(_0x5a5a6f){if(_0x5a5a6f){return _0x5a5a6f['destroy']()[_0x9568('0x2e')](function(){_0x5f5aa3[_0x9568('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19f59d,_0x222332){return function(_0x2eece1){if(!_0x2eece1){_0x19f59d[_0x9568('0x2f')](0x194);}return _0x2eece1;};}function handleError(_0x37af7f,_0x27cc5e){_0x27cc5e=_0x27cc5e||0x1f4;return function(_0x191b83){logger[_0x9568('0x21')](_0x191b83[_0x9568('0x30')]);if(_0x191b83[_0x9568('0x31')]){delete _0x191b83['name'];}_0x37af7f['status'](_0x27cc5e)[_0x9568('0x32')](_0x191b83);};}exports[_0x9568('0x33')]=function(_0x3e782f,_0x5ae1f8){var _0x35af7b={},_0x40311a={},_0x40da0a={'count':0x0,'rows':[]};var _0x6e3d55=_['map'](db['SalesforceAccount'][_0x9568('0x34')],function(_0x4a6cb7){return{'name':_0x4a6cb7[_0x9568('0x35')],'type':_0x4a6cb7[_0x9568('0x36')][_0x9568('0x37')]};});_0x40311a[_0x9568('0x38')]=_['map'](_0x6e3d55,_0x9568('0x31'));_0x40311a[_0x9568('0x39')]=_[_0x9568('0x3a')](_0x3e782f[_0x9568('0x39')]);_0x40311a[_0x9568('0x3b')]=_[_0x9568('0x3c')](_0x40311a[_0x9568('0x38')],_0x40311a[_0x9568('0x39')]);_0x35af7b[_0x9568('0x3d')]=_[_0x9568('0x3c')](_0x40311a['model'],qs[_0x9568('0x3e')](_0x3e782f[_0x9568('0x39')][_0x9568('0x3e')]));_0x35af7b[_0x9568('0x3d')]=_0x35af7b['attributes'][_0x9568('0x3f')]?_0x35af7b[_0x9568('0x3d')]:_0x40311a[_0x9568('0x38')];if(!_0x3e782f['query'][_0x9568('0x40')](_0x9568('0x41'))){_0x35af7b['limit']=qs[_0x9568('0x29')](_0x3e782f[_0x9568('0x39')]['limit']);_0x35af7b[_0x9568('0x28')]=qs['offset'](_0x3e782f['query'][_0x9568('0x28')]);}_0x35af7b[_0x9568('0x42')]=qs[_0x9568('0x43')](_0x3e782f[_0x9568('0x39')]['sort']);_0x35af7b['where']=qs[_0x9568('0x3b')](_[_0x9568('0x44')](_0x3e782f[_0x9568('0x39')],_0x40311a['filters']),_0x6e3d55);if(_0x3e782f[_0x9568('0x39')][_0x9568('0x45')]){_0x35af7b[_0x9568('0x46')]=_[_0x9568('0x47')](_0x35af7b[_0x9568('0x46')],{'$or':_[_0x9568('0x48')](_0x6e3d55,function(_0x1cff0a){if(_0x1cff0a[_0x9568('0x36')]!=='VIRTUAL'){var _0x1a485b={};_0x1a485b[_0x1cff0a['name']]={'$like':'%'+_0x3e782f[_0x9568('0x39')][_0x9568('0x45')]+'%'};return _0x1a485b;}})});}_0x35af7b=_[_0x9568('0x47')]({},_0x35af7b,_0x3e782f[_0x9568('0x49')]);var _0x5655d7={'where':_0x35af7b[_0x9568('0x46')]};return db[_0x9568('0x4a')][_0x9568('0x4b')](_0x5655d7)[_0x9568('0x2e')](function(_0x499870){_0x40da0a[_0x9568('0x4b')]=_0x499870;if(_0x3e782f[_0x9568('0x39')][_0x9568('0x4c')]){_0x35af7b[_0x9568('0x4d')]=[{'all':!![]}];}return db[_0x9568('0x4a')][_0x9568('0x4e')](_0x35af7b);})['then'](function(_0x1a5ebc){_0x40da0a[_0x9568('0x4f')]=_0x1a5ebc;return _0x40da0a;})['then'](respondWithFilteredResult(_0x5ae1f8,_0x35af7b))['catch'](handleError(_0x5ae1f8,null));};exports[_0x9568('0x50')]=function(_0x5e0fc0,_0x2dad87){var _0xb58271={'raw':![],'where':{'id':_0x5e0fc0['params']['id']}},_0x5788bd={};_0x5788bd['model']=_[_0x9568('0x3a')](db[_0x9568('0x4a')][_0x9568('0x34')]);_0x5788bd[_0x9568('0x39')]=_[_0x9568('0x3a')](_0x5e0fc0[_0x9568('0x39')]);_0x5788bd[_0x9568('0x3b')]=_['intersection'](_0x5788bd[_0x9568('0x38')],_0x5788bd[_0x9568('0x39')]);_0xb58271[_0x9568('0x3d')]=_['intersection'](_0x5788bd[_0x9568('0x38')],qs[_0x9568('0x3e')](_0x5e0fc0[_0x9568('0x39')][_0x9568('0x3e')]));_0xb58271[_0x9568('0x3d')]=_0xb58271[_0x9568('0x3d')][_0x9568('0x3f')]?_0xb58271['attributes']:_0x5788bd['model'];if(_0x5e0fc0[_0x9568('0x39')][_0x9568('0x4c')]){_0xb58271[_0x9568('0x4d')]=[{'all':!![]}];}_0xb58271=_['merge']({},_0xb58271,_0x5e0fc0[_0x9568('0x49')]);return db[_0x9568('0x4a')][_0x9568('0x51')](_0xb58271)['then'](handleEntityNotFound(_0x2dad87,null))['then'](respondWithResult(_0x2dad87,null))['catch'](handleError(_0x2dad87,null));};exports[_0x9568('0x52')]=function(_0x4b0b30,_0xfe8f3c){return db[_0x9568('0x4a')][_0x9568('0x52')](_0x4b0b30[_0x9568('0x53')],{})['then'](respondWithResult(_0xfe8f3c,0xc9))[_0x9568('0x25')](handleError(_0xfe8f3c,null));};exports[_0x9568('0x2d')]=function(_0x57d4f4,_0x10f03d){if(_0x57d4f4[_0x9568('0x53')]['id']){delete _0x57d4f4[_0x9568('0x53')]['id'];}return db['SalesforceAccount'][_0x9568('0x51')]({'where':{'id':_0x57d4f4[_0x9568('0x54')]['id']}})[_0x9568('0x2e')](handleEntityNotFound(_0x10f03d,null))[_0x9568('0x2e')](saveUpdates(_0x57d4f4[_0x9568('0x53')],null))[_0x9568('0x2e')](respondWithResult(_0x10f03d,null))[_0x9568('0x25')](handleError(_0x10f03d,null));};exports['destroy']=function(_0x1fed3b,_0x1eb189){return db[_0x9568('0x4a')][_0x9568('0x51')]({'where':{'id':_0x1fed3b[_0x9568('0x54')]['id']}})[_0x9568('0x2e')](handleEntityNotFound(_0x1eb189,null))['then'](removeEntity(_0x1eb189,null))[_0x9568('0x25')](handleError(_0x1eb189,null));};exports['getConfigurations']=function(_0x3bfc2d,_0x530dd4,_0x1801aa){var _0x2a892b={};var _0xd1b4ba={};var _0x4a828f;var _0xdacb36;return db['SalesforceAccount'][_0x9568('0x55')]({'where':{'id':_0x3bfc2d['params']['id']}})['then'](handleEntityNotFound(_0x530dd4,null))['then'](function(_0x1cd183){if(_0x1cd183){_0x4a828f=_0x1cd183;_0xd1b4ba[_0x9568('0x38')]=_[_0x9568('0x3a')](db[_0x9568('0x56')]['rawAttributes']);_0xd1b4ba[_0x9568('0x39')]=_[_0x9568('0x3a')](_0x3bfc2d['query']);_0xd1b4ba[_0x9568('0x3b')]=_[_0x9568('0x3c')](_0xd1b4ba[_0x9568('0x38')],_0xd1b4ba['query']);_0x2a892b['attributes']=_['intersection'](_0xd1b4ba['model'],qs[_0x9568('0x3e')](_0x3bfc2d['query'][_0x9568('0x3e')]));_0x2a892b[_0x9568('0x3d')]=_0x2a892b['attributes']['length']?_0x2a892b[_0x9568('0x3d')]:_0xd1b4ba['model'];_0x2a892b[_0x9568('0x42')]=qs['sort'](_0x3bfc2d[_0x9568('0x39')][_0x9568('0x43')]);_0x2a892b[_0x9568('0x46')]=qs[_0x9568('0x3b')](_[_0x9568('0x44')](_0x3bfc2d[_0x9568('0x39')],_0xd1b4ba[_0x9568('0x3b')]));if(_0x3bfc2d[_0x9568('0x39')]['filter']){_0x2a892b[_0x9568('0x46')]=_[_0x9568('0x47')](_0x2a892b[_0x9568('0x46')],{'$or':_['map'](_0x2a892b['attributes'],function(_0x396314){var _0x26c515={};_0x26c515[_0x396314]={'$like':'%'+_0x3bfc2d[_0x9568('0x39')]['filter']+'%'};return _0x26c515;})});}_0x2a892b=_[_0x9568('0x47')]({},_0x2a892b,_0x3bfc2d[_0x9568('0x49')]);return _0x4a828f[_0x9568('0x57')](_0x2a892b);}})[_0x9568('0x2e')](function(_0x2bd9ab){if(_0x2bd9ab){_0xdacb36=_0x2bd9ab[_0x9568('0x3f')];if(!_0x3bfc2d[_0x9568('0x39')][_0x9568('0x40')]('nolimit')){_0x2a892b['limit']=qs['limit'](_0x3bfc2d[_0x9568('0x39')]['limit']);_0x2a892b['offset']=qs[_0x9568('0x28')](_0x3bfc2d[_0x9568('0x39')][_0x9568('0x28')]);}return _0x4a828f['getConfigurations'](_0x2a892b);}})[_0x9568('0x2e')](function(_0x4dfa9d){if(_0x4dfa9d){return _0x4dfa9d?{'count':_0xdacb36,'rows':_0x4dfa9d}:null;}})[_0x9568('0x2e')](respondWithResult(_0x530dd4,null))[_0x9568('0x25')](handleError(_0x530dd4,null));};exports[_0x9568('0x58')]=function(_0x1718d9,_0xfa5b54,_0x8f579e){if(_0x1718d9[_0x9568('0x53')]['id']){delete _0x1718d9['body']['id'];}return db[_0x9568('0x4a')][_0x9568('0x55')]({'where':{'id':_0x1718d9['params']['id']}})[_0x9568('0x2e')](handleEntityNotFound(_0xfa5b54,null))[_0x9568('0x2e')](function(_0x528f32){if(_0x528f32){_0x1718d9[_0x9568('0x53')][_0x9568('0x59')]=_0x528f32['id'];_0x1718d9[_0x9568('0x53')][_0x9568('0x5a')]=integrations[_0x9568('0x5b')](_0x1718d9[_0x9568('0x53')][_0x9568('0x5c')],_0x1718d9[_0x9568('0x53')][_0x9568('0x36')]);_0x1718d9['body'][_0x9568('0x5d')]=integrations[_0x9568('0x5e')](_0x1718d9[_0x9568('0x53')][_0x9568('0x5c')],_0x1718d9[_0x9568('0x53')][_0x9568('0x36')]);return db['SalesforceConfiguration']['create'](_0x1718d9[_0x9568('0x53')],{'include':[{'model':db['SalesforceField'],'as':_0x9568('0x5a')},{'model':db['SalesforceField'],'as':_0x9568('0x5d')}]});}return null;})[_0x9568('0x2e')](respondWithResult(_0xfa5b54,null))[_0x9568('0x25')](handleError(_0xfa5b54,null));};exports['getFields']=function(_0x3b9ec6,_0x1daad1,_0x4d32a3){var _0x20affb;var _0x270b09='';var _0x4965d9=_0x9568('0x5f');return db['SalesforceAccount'][_0x9568('0x55')]({'where':{'id':_0x3b9ec6[_0x9568('0x54')]['id']},'attributes':['id',_0x9568('0x60'),'clientId',_0x9568('0x61'),'username','password',_0x9568('0x62')]})[_0x9568('0x2e')](handleEntityNotFound(_0x1daad1,null))[_0x9568('0x2e')](function(_0x45849f){if(_0x45849f){_0x270b09=_0x45849f[_0x9568('0x60')];var _0x5d1c5e=_0x270b09[_0x9568('0x63')](-0x1);if(_0x5d1c5e==='/'){_0x270b09=_0x270b09['substring'](0x0,_0x270b09['lastIndexOf'](_0x5d1c5e));}_0x20affb=new jsforce[(_0x9568('0x64'))]({'oauth2':{'loginUrl':_0x270b09,'clientId':_0x45849f[_0x9568('0x65')],'clientSecret':_0x45849f[_0x9568('0x61')]}});return _0x20affb['login'](_0x45849f['username'],_0x45849f['password'][_0x9568('0x66')](_0x45849f[_0x9568('0x62')]));}})['then'](function(_0x4b11e2){if(_0x4b11e2){if(!_[_0x9568('0x67')](_0x3b9ec6[_0x9568('0x39')][_0x9568('0x68')])){_0x4965d9=_0x3b9ec6[_0x9568('0x39')][_0x9568('0x68')];}return _0x20affb[_0x9568('0x69')](_0x4965d9)['describe']();}})[_0x9568('0x2e')](function(_0x183388){var _0x442c94=['OwnerId',_0x9568('0x6a'),_0x9568('0x6b'),_0x9568('0x6c'),_0x9568('0x6d'),_0x9568('0x6e')];var _0x526ea6=[_0x9568('0x6f'),_0x9568('0x70'),_0x9568('0x71'),_0x9568('0x72'),_0x9568('0x73'),'textarea',_0x9568('0x74')];if(_0x183388){_['remove'](_0x183388[_0x9568('0x3e')],function(_0x454750){return _0x442c94[_0x9568('0x75')](_0x454750[_0x9568('0x31')])||!_0x526ea6[_0x9568('0x75')](_0x454750['type']);});return{'count':_0x183388[_0x9568('0x3e')][_0x9568('0x3f')],'rows':_[_0x9568('0x48')](_0x183388[_0x9568('0x3e')],function(_0x43ea53){return{'id':_0x43ea53['name'],'name':_0x43ea53[_0x9568('0x76')],'custom':_0x43ea53[_0x9568('0x77')],'options':_0x43ea53[_0x9568('0x78')][_0x9568('0x3f')]>0x0?_[_0x9568('0x48')](_0x43ea53[_0x9568('0x78')],function(_0x14e9f3){return{'name':_0x14e9f3[_0x9568('0x76')],'value':_0x14e9f3['value']};}):_0x43ea53[_0x9568('0x36')]==_0x9568('0x72')?[{'name':_0x9568('0x79'),'value':_0x9568('0x7a')},{'name':_0x9568('0x7b'),'value':'false'}]:[]};})};}})[_0x9568('0x2e')](respondWithResult(_0x1daad1,null))['catch'](function(_0xca6e1){var _0x16b6cc=_0x3b9ec6['query'][_0x9568('0x7c')]?0x1f4:_0xca6e1[_0x9568('0x7d')]||0x1f4;logger[_0x9568('0x21')](_0x9568('0x7e'),_0x9568('0x7f'),_0x16b6cc,JSON[_0x9568('0x20')](_0xca6e1));delete _0xca6e1[_0x9568('0x31')];if(_0x16b6cc===0x191){_0x16b6cc=0x190;}_0x1daad1[_0x9568('0x26')](_0x16b6cc)['send'](_0x3b9ec6[_0x9568('0x39')][_0x9568('0x7c')]?{'message':_0x9568('0x80'),'statusCode':_0xca6e1['statusCode']}:_0xca6e1);});}; \ No newline at end of file +var _0x758c=['send','index','fieldName','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','type','VIRTUAL','options','SalesforceAccount','count','includeAll','include','catch','params','rawAttributes','find','create','body','getConfigurations','SalesforceConfiguration','sort','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','username','securityToken','substring','lastIndexOf','Connection','password','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Subject','Description','int','picklist','boolean','email','phone','remove','includes','label','custom','picklistValues','value','True','true','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','debug','stringify','error','message','result','sendStatus','status','end','offset','limit','Content-Range','json','apply','save','update','stack','name'];(function(_0x4b0290,_0x188c34){var _0x4bd9f4=function(_0x357f3f){while(--_0x357f3f){_0x4b0290['push'](_0x4b0290['shift']());}};_0x4bd9f4(++_0x188c34);}(_0x758c,0xd2));var _0xc758=function(_0x37f84f,_0x1060d2){_0x37f84f=_0x37f84f-0x0;var _0xf436e9=_0x758c[_0x37f84f];return _0xf436e9;};'use strict';var pdf=require(_0xc758('0x0'));var emlformat=require(_0xc758('0x1'));var rimraf=require(_0xc758('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc758('0x3'));var moment=require('moment');var BPromise=require(_0xc758('0x4'));var Mustache=require('mustache');var util=require(_0xc758('0x5'));var path=require(_0xc758('0x6'));var sox=require(_0xc758('0x7'));var csv=require('to-csv');var ejs=require(_0xc758('0x8'));var fs=require('fs');var _=require(_0xc758('0x9'));var squel=require(_0xc758('0xa'));var crypto=require(_0xc758('0xb'));var jsforce=require(_0xc758('0xc'));var deskjs=require(_0xc758('0xd'));var toCsv=require(_0xc758('0xe'));var querystring=require(_0xc758('0xf'));var Papa=require(_0xc758('0x10'));var Redis=require('ioredis');var authService=require(_0xc758('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc758('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc758('0x13'));var utils=require(_0xc758('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc758('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc758('0x16'));var jayson=require(_0xc758('0x17'));var client=jayson[_0xc758('0x18')][_0xc758('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4ce115,_0x18acad,_0x2a0d02,_0x120f18){return new BPromise(function(_0x433a70,_0x24b29b){var _0x28870b=_0x120f18||client;return _0x28870b['request'](_0x4ce115,_0x2a0d02)[_0xc758('0x1a')](function(_0x410835){logger[_0xc758('0x1b')](_0xc758('0x1c'),_0x18acad,'request\x20sent');logger[_0xc758('0x1d')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x18acad,'request\x20sent',JSON[_0xc758('0x1e')](_0x410835));if(_0x410835[_0xc758('0x1f')]){if(_0x410835[_0xc758('0x1f')]['code']===0x1f4){logger['error'](_0xc758('0x1c'),_0x18acad,_0x410835[_0xc758('0x1f')][_0xc758('0x20')]);return _0x24b29b(_0x410835[_0xc758('0x1f')]['message']);}logger[_0xc758('0x1f')](_0xc758('0x1c'),_0x18acad,_0x410835[_0xc758('0x1f')][_0xc758('0x20')]);return _0x433a70(_0x410835['error'][_0xc758('0x20')]);}else{logger['info'](_0xc758('0x1c'),_0x18acad,'request\x20sent');_0x433a70(_0x410835[_0xc758('0x21')][_0xc758('0x20')]);}})['catch'](function(_0x28a755){logger[_0xc758('0x1f')](_0xc758('0x1c'),_0x18acad,_0x28a755);_0x24b29b(_0x28a755);});});}function respondWithStatusCode(_0x3f2c81,_0x27bb73){_0x27bb73=_0x27bb73||0xcc;return function(_0x47ac2e){if(_0x47ac2e){return _0x3f2c81[_0xc758('0x22')](_0x27bb73);}return _0x3f2c81[_0xc758('0x23')](_0x27bb73)[_0xc758('0x24')]();};}function respondWithResult(_0x197888,_0x314a8b){_0x314a8b=_0x314a8b||0xc8;return function(_0x393b40){if(_0x393b40){return _0x197888[_0xc758('0x23')](_0x314a8b)['json'](_0x393b40);}};}function respondWithFilteredResult(_0x4f2460,_0x28c5ed){return function(_0x1b2b97){if(_0x1b2b97){var _0x283b7e=_0x1b2b97['count'],_0x54d09b=_0x28c5ed[_0xc758('0x25')],_0x4b6d0a=_0x28c5ed['offset']+_0x28c5ed[_0xc758('0x26')],_0x2c8942;if(_0x4b6d0a>=_0x283b7e){_0x4b6d0a=_0x283b7e;_0x2c8942=0xc8;}else{_0x2c8942=0xce;}_0x4f2460['status'](_0x2c8942);return _0x4f2460['set'](_0xc758('0x27'),_0x54d09b+'-'+_0x4b6d0a+'/'+_0x283b7e)[_0xc758('0x28')](_0x1b2b97);}return null;};}function patchUpdates(_0x104d25){return function(_0x18c9b9){try{jsonpatch[_0xc758('0x29')](_0x18c9b9,_0x104d25,!![]);}catch(_0x4785cc){return BPromise['reject'](_0x4785cc);}return _0x18c9b9[_0xc758('0x2a')]();};}function saveUpdates(_0x5231c3,_0x4402c3){return function(_0x5c6b69){if(_0x5c6b69){return _0x5c6b69[_0xc758('0x2b')](_0x5231c3)['then'](function(_0x466355){return _0x466355;});}return null;};}function removeEntity(_0x411aba,_0x31f304){return function(_0xde52cd){if(_0xde52cd){return _0xde52cd['destroy']()[_0xc758('0x1a')](function(){_0x411aba[_0xc758('0x23')](0xcc)[_0xc758('0x24')]();});}};}function handleEntityNotFound(_0x2b0d4d,_0x51ef45){return function(_0x1a4195){if(!_0x1a4195){_0x2b0d4d[_0xc758('0x22')](0x194);}return _0x1a4195;};}function handleError(_0x3b113c,_0x442659){_0x442659=_0x442659||0x1f4;return function(_0x3fae24){logger[_0xc758('0x1f')](_0x3fae24[_0xc758('0x2c')]);if(_0x3fae24[_0xc758('0x2d')]){delete _0x3fae24['name'];}_0x3b113c['status'](_0x442659)[_0xc758('0x2e')](_0x3fae24);};}exports[_0xc758('0x2f')]=function(_0xf9c174,_0x42689d){var _0x3b64e6={},_0x509fa5={},_0x3fbfce={'count':0x0,'rows':[]};var _0xcc0cfc=_['map'](db['SalesforceAccount']['rawAttributes'],function(_0x361093){return{'name':_0x361093[_0xc758('0x30')],'type':_0x361093['type']['key']};});_0x509fa5[_0xc758('0x31')]=_[_0xc758('0x32')](_0xcc0cfc,_0xc758('0x2d'));_0x509fa5[_0xc758('0x33')]=_[_0xc758('0x34')](_0xf9c174[_0xc758('0x33')]);_0x509fa5['filters']=_[_0xc758('0x35')](_0x509fa5['model'],_0x509fa5[_0xc758('0x33')]);_0x3b64e6[_0xc758('0x36')]=_['intersection'](_0x509fa5['model'],qs[_0xc758('0x37')](_0xf9c174[_0xc758('0x33')][_0xc758('0x37')]));_0x3b64e6[_0xc758('0x36')]=_0x3b64e6['attributes'][_0xc758('0x38')]?_0x3b64e6[_0xc758('0x36')]:_0x509fa5['model'];if(!_0xf9c174[_0xc758('0x33')][_0xc758('0x39')](_0xc758('0x3a'))){_0x3b64e6[_0xc758('0x26')]=qs['limit'](_0xf9c174[_0xc758('0x33')]['limit']);_0x3b64e6['offset']=qs[_0xc758('0x25')](_0xf9c174[_0xc758('0x33')][_0xc758('0x25')]);}_0x3b64e6[_0xc758('0x3b')]=qs['sort'](_0xf9c174['query']['sort']);_0x3b64e6[_0xc758('0x3c')]=qs[_0xc758('0x3d')](_[_0xc758('0x3e')](_0xf9c174[_0xc758('0x33')],_0x509fa5[_0xc758('0x3d')]),_0xcc0cfc);if(_0xf9c174[_0xc758('0x33')][_0xc758('0x3f')]){_0x3b64e6[_0xc758('0x3c')]=_[_0xc758('0x40')](_0x3b64e6[_0xc758('0x3c')],{'$or':_[_0xc758('0x32')](_0xcc0cfc,function(_0x509121){if(_0x509121[_0xc758('0x41')]!==_0xc758('0x42')){var _0x16cc7f={};_0x16cc7f[_0x509121['name']]={'$like':'%'+_0xf9c174['query'][_0xc758('0x3f')]+'%'};return _0x16cc7f;}})});}_0x3b64e6=_[_0xc758('0x40')]({},_0x3b64e6,_0xf9c174[_0xc758('0x43')]);var _0x3c2534={'where':_0x3b64e6['where']};return db[_0xc758('0x44')][_0xc758('0x45')](_0x3c2534)[_0xc758('0x1a')](function(_0x407873){_0x3fbfce[_0xc758('0x45')]=_0x407873;if(_0xf9c174[_0xc758('0x33')][_0xc758('0x46')]){_0x3b64e6[_0xc758('0x47')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x3b64e6);})['then'](function(_0x337c88){_0x3fbfce['rows']=_0x337c88;return _0x3fbfce;})[_0xc758('0x1a')](respondWithFilteredResult(_0x42689d,_0x3b64e6))[_0xc758('0x48')](handleError(_0x42689d,null));};exports['show']=function(_0xe6c52b,_0x5c9952){var _0x1ee174={'raw':![],'where':{'id':_0xe6c52b[_0xc758('0x49')]['id']}},_0x149f29={};_0x149f29[_0xc758('0x31')]=_[_0xc758('0x34')](db[_0xc758('0x44')][_0xc758('0x4a')]);_0x149f29[_0xc758('0x33')]=_[_0xc758('0x34')](_0xe6c52b[_0xc758('0x33')]);_0x149f29['filters']=_[_0xc758('0x35')](_0x149f29[_0xc758('0x31')],_0x149f29[_0xc758('0x33')]);_0x1ee174[_0xc758('0x36')]=_[_0xc758('0x35')](_0x149f29['model'],qs[_0xc758('0x37')](_0xe6c52b[_0xc758('0x33')]['fields']));_0x1ee174[_0xc758('0x36')]=_0x1ee174['attributes'][_0xc758('0x38')]?_0x1ee174[_0xc758('0x36')]:_0x149f29[_0xc758('0x31')];if(_0xe6c52b['query'][_0xc758('0x46')]){_0x1ee174[_0xc758('0x47')]=[{'all':!![]}];}_0x1ee174=_[_0xc758('0x40')]({},_0x1ee174,_0xe6c52b['options']);return db[_0xc758('0x44')][_0xc758('0x4b')](_0x1ee174)[_0xc758('0x1a')](handleEntityNotFound(_0x5c9952,null))[_0xc758('0x1a')](respondWithResult(_0x5c9952,null))[_0xc758('0x48')](handleError(_0x5c9952,null));};exports[_0xc758('0x4c')]=function(_0x52ee79,_0x428fe7){return db['SalesforceAccount']['create'](_0x52ee79[_0xc758('0x4d')],{})['then'](respondWithResult(_0x428fe7,0xc9))[_0xc758('0x48')](handleError(_0x428fe7,null));};exports[_0xc758('0x2b')]=function(_0x308ae4,_0x147acb){if(_0x308ae4[_0xc758('0x4d')]['id']){delete _0x308ae4[_0xc758('0x4d')]['id'];}return db[_0xc758('0x44')][_0xc758('0x4b')]({'where':{'id':_0x308ae4[_0xc758('0x49')]['id']}})[_0xc758('0x1a')](handleEntityNotFound(_0x147acb,null))[_0xc758('0x1a')](saveUpdates(_0x308ae4[_0xc758('0x4d')],null))[_0xc758('0x1a')](respondWithResult(_0x147acb,null))[_0xc758('0x48')](handleError(_0x147acb,null));};exports['destroy']=function(_0x335391,_0x1c6710){return db['SalesforceAccount']['find']({'where':{'id':_0x335391[_0xc758('0x49')]['id']}})[_0xc758('0x1a')](handleEntityNotFound(_0x1c6710,null))['then'](removeEntity(_0x1c6710,null))[_0xc758('0x48')](handleError(_0x1c6710,null));};exports[_0xc758('0x4e')]=function(_0xb21d81,_0x534584,_0x15f77e){var _0x595a31={};var _0x20a3c5={};var _0x28febf;var _0x375165;return db[_0xc758('0x44')]['findOne']({'where':{'id':_0xb21d81[_0xc758('0x49')]['id']}})[_0xc758('0x1a')](handleEntityNotFound(_0x534584,null))[_0xc758('0x1a')](function(_0xc6e0fc){if(_0xc6e0fc){_0x28febf=_0xc6e0fc;_0x20a3c5[_0xc758('0x31')]=_['keys'](db[_0xc758('0x4f')]['rawAttributes']);_0x20a3c5['query']=_[_0xc758('0x34')](_0xb21d81[_0xc758('0x33')]);_0x20a3c5[_0xc758('0x3d')]=_['intersection'](_0x20a3c5[_0xc758('0x31')],_0x20a3c5[_0xc758('0x33')]);_0x595a31[_0xc758('0x36')]=_[_0xc758('0x35')](_0x20a3c5[_0xc758('0x31')],qs[_0xc758('0x37')](_0xb21d81[_0xc758('0x33')]['fields']));_0x595a31[_0xc758('0x36')]=_0x595a31[_0xc758('0x36')][_0xc758('0x38')]?_0x595a31[_0xc758('0x36')]:_0x20a3c5[_0xc758('0x31')];_0x595a31[_0xc758('0x3b')]=qs[_0xc758('0x50')](_0xb21d81[_0xc758('0x33')]['sort']);_0x595a31[_0xc758('0x3c')]=qs[_0xc758('0x3d')](_[_0xc758('0x3e')](_0xb21d81['query'],_0x20a3c5[_0xc758('0x3d')]));if(_0xb21d81[_0xc758('0x33')][_0xc758('0x3f')]){_0x595a31[_0xc758('0x3c')]=_[_0xc758('0x40')](_0x595a31[_0xc758('0x3c')],{'$or':_[_0xc758('0x32')](_0x595a31[_0xc758('0x36')],function(_0x49f06b){var _0x346fee={};_0x346fee[_0x49f06b]={'$like':'%'+_0xb21d81[_0xc758('0x33')]['filter']+'%'};return _0x346fee;})});}_0x595a31=_[_0xc758('0x40')]({},_0x595a31,_0xb21d81[_0xc758('0x43')]);return _0x28febf[_0xc758('0x4e')](_0x595a31);}})[_0xc758('0x1a')](function(_0x2f217b){if(_0x2f217b){_0x375165=_0x2f217b[_0xc758('0x38')];if(!_0xb21d81[_0xc758('0x33')][_0xc758('0x39')](_0xc758('0x3a'))){_0x595a31['limit']=qs['limit'](_0xb21d81['query'][_0xc758('0x26')]);_0x595a31[_0xc758('0x25')]=qs[_0xc758('0x25')](_0xb21d81['query']['offset']);}return _0x28febf[_0xc758('0x4e')](_0x595a31);}})[_0xc758('0x1a')](function(_0x2dfd00){if(_0x2dfd00){return _0x2dfd00?{'count':_0x375165,'rows':_0x2dfd00}:null;}})[_0xc758('0x1a')](respondWithResult(_0x534584,null))['catch'](handleError(_0x534584,null));};exports['addConfiguration']=function(_0x140d2c,_0x2797bb,_0x5ec8f0){if(_0x140d2c['body']['id']){delete _0x140d2c[_0xc758('0x4d')]['id'];}return db[_0xc758('0x44')][_0xc758('0x51')]({'where':{'id':_0x140d2c[_0xc758('0x49')]['id']}})['then'](handleEntityNotFound(_0x2797bb,null))[_0xc758('0x1a')](function(_0x588092){if(_0x588092){_0x140d2c['body'][_0xc758('0x52')]=_0x588092['id'];_0x140d2c['body'][_0xc758('0x53')]=integrations[_0xc758('0x54')](_0x140d2c['body'][_0xc758('0x55')],_0x140d2c[_0xc758('0x4d')][_0xc758('0x41')]);_0x140d2c[_0xc758('0x4d')]['Descriptions']=integrations[_0xc758('0x56')](_0x140d2c[_0xc758('0x4d')][_0xc758('0x55')],_0x140d2c[_0xc758('0x4d')][_0xc758('0x41')]);return db[_0xc758('0x4f')][_0xc758('0x4c')](_0x140d2c[_0xc758('0x4d')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0xc758('0x57')],'as':_0xc758('0x58')}]});}return null;})[_0xc758('0x1a')](respondWithResult(_0x2797bb,null))[_0xc758('0x48')](handleError(_0x2797bb,null));};exports[_0xc758('0x59')]=function(_0x30e35a,_0x396227,_0x4c18b6){var _0x4e6d48;var _0x5a3913='';var _0x14edf8=_0xc758('0x5a');return db[_0xc758('0x44')]['findOne']({'where':{'id':_0x30e35a[_0xc758('0x49')]['id']},'attributes':['id',_0xc758('0x5b'),_0xc758('0x5c'),_0xc758('0x5d'),_0xc758('0x5e'),'password',_0xc758('0x5f')]})[_0xc758('0x1a')](handleEntityNotFound(_0x396227,null))[_0xc758('0x1a')](function(_0x2b4c50){if(_0x2b4c50){_0x5a3913=_0x2b4c50['remoteUri'];var _0x55ae81=_0x5a3913['slice'](-0x1);if(_0x55ae81==='/'){_0x5a3913=_0x5a3913[_0xc758('0x60')](0x0,_0x5a3913[_0xc758('0x61')](_0x55ae81));}_0x4e6d48=new jsforce[(_0xc758('0x62'))]({'oauth2':{'loginUrl':_0x5a3913,'clientId':_0x2b4c50[_0xc758('0x5c')],'clientSecret':_0x2b4c50[_0xc758('0x5d')]}});return _0x4e6d48['login'](_0x2b4c50[_0xc758('0x5e')],_0x2b4c50[_0xc758('0x63')][_0xc758('0x64')](_0x2b4c50[_0xc758('0x5f')]));}})[_0xc758('0x1a')](function(_0x50ddcf){if(_0x50ddcf){if(!_[_0xc758('0x65')](_0x30e35a[_0xc758('0x33')][_0xc758('0x66')])){_0x14edf8=_0x30e35a[_0xc758('0x33')][_0xc758('0x66')];}return _0x4e6d48[_0xc758('0x67')](_0x14edf8)[_0xc758('0x68')]();}})[_0xc758('0x1a')](function(_0x143c6a){var _0x5b3639=[_0xc758('0x69'),_0xc758('0x6a'),_0xc758('0x6b'),'IsRecurrence',_0xc758('0x6c'),_0xc758('0x6d')];var _0x23b06d=['string',_0xc758('0x6e'),_0xc758('0x6f'),_0xc758('0x70'),_0xc758('0x71'),'textarea',_0xc758('0x72')];if(_0x143c6a){_[_0xc758('0x73')](_0x143c6a[_0xc758('0x37')],function(_0x300e41){return _0x5b3639['includes'](_0x300e41[_0xc758('0x2d')])||!_0x23b06d[_0xc758('0x74')](_0x300e41[_0xc758('0x41')]);});return{'count':_0x143c6a[_0xc758('0x37')][_0xc758('0x38')],'rows':_[_0xc758('0x32')](_0x143c6a[_0xc758('0x37')],function(_0x57eb2c){return{'id':_0x57eb2c[_0xc758('0x2d')],'name':_0x57eb2c[_0xc758('0x75')],'custom':_0x57eb2c[_0xc758('0x76')],'options':_0x57eb2c[_0xc758('0x77')]['length']>0x0?_[_0xc758('0x32')](_0x57eb2c[_0xc758('0x77')],function(_0xb808c7){return{'name':_0xb808c7[_0xc758('0x75')],'value':_0xb808c7[_0xc758('0x78')]};}):_0x57eb2c[_0xc758('0x41')]==_0xc758('0x70')?[{'name':_0xc758('0x79'),'value':_0xc758('0x7a')},{'name':'False','value':_0xc758('0x7b')}]:[]};})};}})['then'](respondWithResult(_0x396227,null))[_0xc758('0x48')](function(_0x56c526){var _0x5be658=_0x30e35a[_0xc758('0x33')]['test']?0x1f4:_0x56c526[_0xc758('0x7c')]||0x1f4;logger['error'](_0xc758('0x7d'),_0xc758('0x59'),_0x5be658,JSON['stringify'](_0x56c526));delete _0x56c526['name'];if(_0x5be658===0x191){_0x5be658=0x190;}_0x396227[_0xc758('0x23')](_0x5be658)[_0xc758('0x2e')](_0x30e35a[_0xc758('0x33')][_0xc758('0x7e')]?{'message':_0xc758('0x7f'),'statusCode':_0x56c526[_0xc758('0x7c')]}:_0x56c526);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 1d6bc5f..e77c1c0 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 _0x732f=['SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','define'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x732f,0x1d6));var _0xf732=function(_0x593752,_0xfc3827){_0x593752=_0x593752-0x0;var _0x4612be=_0x732f[_0x593752];return _0x4612be;};'use strict';var _=require(_0xf732('0x0'));var util=require(_0xf732('0x1'));var logger=require(_0xf732('0x2'))(_0xf732('0x3'));var moment=require('moment');var BPromise=require(_0xf732('0x4'));var rp=require(_0xf732('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf732('0x6'));var config=require(_0xf732('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xf732('0x8'));module['exports']=function(_0x1c3170,_0x40f8b0){return _0x1c3170[_0xf732('0x9')](_0xf732('0xa'),attributes,{'tableName':_0xf732('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55d2=['bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','int_salesforce_accounts','lodash','../../config/logger','api','moment'];(function(_0xed2e17,_0x53c0b5){var _0xd7f2a1=function(_0x24246b){while(--_0x24246b){_0xed2e17['push'](_0xed2e17['shift']());}};_0xd7f2a1(++_0x53c0b5);}(_0x55d2,0xd8));var _0x255d=function(_0x4a3864,_0x245ccc){_0x4a3864=_0x4a3864-0x0;var _0x45f2a3=_0x55d2[_0x4a3864];return _0x45f2a3;};'use strict';var _=require(_0x255d('0x0'));var util=require('util');var logger=require(_0x255d('0x1'))(_0x255d('0x2'));var moment=require(_0x255d('0x3'));var BPromise=require(_0x255d('0x4'));var rp=require(_0x255d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x255d('0x6'));var config=require(_0x255d('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x255d('0x8'));module[_0x255d('0x9')]=function(_0x24cbd4,_0x3fa18b){return _0x24cbd4['define']('SalesforceAccount',attributes,{'tableName':_0x255d('0xa'),'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 7eb5761..f56ddb6 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 _0xc788=['request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message','SalesforceAccount,\x20%s,\x20%s','result','catch','GetSalesforceAccount','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowSalesforceAccount','SalesforceAccount','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x1464a1,_0x151696){var _0x2da6dd=function(_0x222667){while(--_0x222667){_0x1464a1['push'](_0x1464a1['shift']());}};_0x2da6dd(++_0x151696);}(_0xc788,0xc4));var _0x8c78=function(_0x38622b,_0x3cfdf7){_0x38622b=_0x38622b-0x0;var _0x2c1a7a=_0xc788[_0x38622b];return _0x2c1a7a;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var moment=require(_0x8c78('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c78('0x3'));var db=require(_0x8c78('0x4'))['db'];var utils=require(_0x8c78('0x5'));var logger=require(_0x8c78('0x6'))(_0x8c78('0x7'));var config=require('../../config/environment');var jayson=require(_0x8c78('0x8'));var client=jayson[_0x8c78('0x9')][_0x8c78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ac27f,_0x205cc1,_0x4d54a5){return new BPromise(function(_0x247188,_0x299d9d){return client[_0x8c78('0xb')](_0x1ac27f,_0x4d54a5)[_0x8c78('0xc')](function(_0xdb0c17){logger[_0x8c78('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));logger['debug'](_0x8c78('0xf'),_0x205cc1,_0x8c78('0xe'),JSON['stringify'](_0xdb0c17));if(_0xdb0c17[_0x8c78('0x10')]){if(_0xdb0c17[_0x8c78('0x10')]['code']===0x1f4){logger[_0x8c78('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x205cc1,_0xdb0c17['error'][_0x8c78('0x11')]);return _0x299d9d(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);return _0x247188(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}else{logger[_0x8c78('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));_0x247188(_0xdb0c17[_0x8c78('0x13')]['message']);}})[_0x8c78('0x14')](function(_0x554464){logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0x554464);_0x299d9d(_0x554464);});});}exports[_0x8c78('0x15')]=function(_0x461eff){var _0x54eafa=this;return new Promise(function(_0x4f7bf9,_0x339d04){return db['SalesforceAccount']['findAll']({'raw':_0x461eff[_0x8c78('0x16')]?_0x461eff['options'][_0x8c78('0x17')]===undefined?!![]:![]:!![],'where':_0x461eff[_0x8c78('0x16')]?_0x461eff['options'][_0x8c78('0x18')]||null:null,'attributes':_0x461eff['options']?_0x461eff[_0x8c78('0x16')][_0x8c78('0x19')]||null:null,'limit':_0x461eff['options']?_0x461eff[_0x8c78('0x16')][_0x8c78('0x1a')]||null:null,'include':_0x461eff['options']?_0x461eff[_0x8c78('0x16')][_0x8c78('0x1b')]?_[_0x8c78('0x1c')](_0x461eff[_0x8c78('0x16')][_0x8c78('0x1b')],function(_0x20f483){return{'model':db[_0x20f483[_0x8c78('0x1d')]],'as':_0x20f483['as'],'attributes':_0x20f483[_0x8c78('0x19')],'include':_0x20f483[_0x8c78('0x1b')]?_['map'](_0x20f483[_0x8c78('0x1b')],function(_0x458763){return{'model':db[_0x458763[_0x8c78('0x1d')]],'as':_0x458763['as'],'attributes':_0x458763['attributes'],'include':_0x458763[_0x8c78('0x1b')]?_['map'](_0x458763[_0x8c78('0x1b')],function(_0x24f9a7){return{'model':db[_0x24f9a7[_0x8c78('0x1d')]],'as':_0x24f9a7['as'],'attributes':_0x24f9a7['attributes']};}):[]};}):[]};}):[]:[]})[_0x8c78('0xc')](function(_0x2568d5){logger['info'](_0x8c78('0x15'),_0x461eff);logger[_0x8c78('0x1e')](_0x8c78('0x15'),_0x461eff,JSON[_0x8c78('0x1f')](_0x2568d5));_0x4f7bf9(_0x2568d5);})[_0x8c78('0x14')](function(_0x2ab5cc){logger['error'](_0x8c78('0x15'),_0x2ab5cc['message'],_0x461eff);_0x339d04(_0x54eafa[_0x8c78('0x10')](0x1f4,_0x2ab5cc[_0x8c78('0x11')]));});});};exports[_0x8c78('0x20')]=function(_0x4e764f){var _0x1f1a0c=this;return new Promise(function(_0x3816d2,_0x4f0005){return db[_0x8c78('0x21')][_0x8c78('0x22')]({'raw':_0x4e764f[_0x8c78('0x16')]?_0x4e764f['options'][_0x8c78('0x17')]===undefined?!![]:![]:!![],'where':_0x4e764f[_0x8c78('0x16')]?_0x4e764f[_0x8c78('0x16')]['where']||null:null,'attributes':_0x4e764f[_0x8c78('0x16')]?_0x4e764f[_0x8c78('0x16')]['attributes']||null:null,'include':_0x4e764f[_0x8c78('0x16')]?_0x4e764f[_0x8c78('0x16')][_0x8c78('0x1b')]?_[_0x8c78('0x1c')](_0x4e764f[_0x8c78('0x16')][_0x8c78('0x1b')],function(_0x1218f4){return{'model':db[_0x1218f4[_0x8c78('0x1d')]],'as':_0x1218f4['as'],'attributes':_0x1218f4[_0x8c78('0x19')],'include':_0x1218f4[_0x8c78('0x1b')]?_['map'](_0x1218f4[_0x8c78('0x1b')],function(_0x45e673){return{'model':db[_0x45e673[_0x8c78('0x1d')]],'as':_0x45e673['as'],'attributes':_0x45e673[_0x8c78('0x19')],'include':_0x45e673[_0x8c78('0x1b')]?_['map'](_0x45e673[_0x8c78('0x1b')],function(_0xc4d0cf){return{'model':db[_0xc4d0cf[_0x8c78('0x1d')]],'as':_0xc4d0cf['as'],'attributes':_0xc4d0cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x8c78('0xc')](function(_0x25ea2f){logger['info'](_0x8c78('0x20'),_0x4e764f);logger['debug'](_0x8c78('0x20'),_0x4e764f,JSON[_0x8c78('0x1f')](_0x25ea2f));_0x3816d2(_0x25ea2f);})[_0x8c78('0x14')](function(_0x157b81){logger['error'](_0x8c78('0x20'),_0x157b81['message'],_0x4e764f);_0x4f0005(_0x1f1a0c[_0x8c78('0x10')](0x1f4,_0x157b81[_0x8c78('0x11')]));});});}; \ No newline at end of file +var _0xbdb7=['model','map','ShowSalesforceAccount','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','attributes','limit','include'];(function(_0x4279c4,_0x1783af){var _0xfe2d0c=function(_0x24fa0c){while(--_0x24fa0c){_0x4279c4['push'](_0x4279c4['shift']());}};_0xfe2d0c(++_0x1783af);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x169996,_0x4b59b5){_0x169996=_0x169996-0x0;var _0x28d7e6=_0xbdb7[_0x169996];return _0x28d7e6;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});}exports[_0x7bdb('0x15')]=function(_0x5723f4){var _0x2aff6a=this;return new Promise(function(_0x4ffd4b,_0x41f540){return db[_0x7bdb('0x16')]['findAll']({'raw':_0x5723f4[_0x7bdb('0x17')]?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x18')]===undefined?!![]:![]:!![],'where':_0x5723f4[_0x7bdb('0x17')]?_0x5723f4[_0x7bdb('0x17')]['where']||null:null,'attributes':_0x5723f4['options']?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x19')]||null:null,'limit':_0x5723f4['options']?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x1a')]||null:null,'include':_0x5723f4[_0x7bdb('0x17')]?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x1b')]?_['map'](_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x1b')],function(_0x40c447){return{'model':db[_0x40c447[_0x7bdb('0x1c')]],'as':_0x40c447['as'],'attributes':_0x40c447['attributes'],'include':_0x40c447['include']?_[_0x7bdb('0x1d')](_0x40c447['include'],function(_0x47abaf){return{'model':db[_0x47abaf['model']],'as':_0x47abaf['as'],'attributes':_0x47abaf[_0x7bdb('0x19')],'include':_0x47abaf['include']?_[_0x7bdb('0x1d')](_0x47abaf[_0x7bdb('0x1b')],function(_0x3ec129){return{'model':db[_0x3ec129[_0x7bdb('0x1c')]],'as':_0x3ec129['as'],'attributes':_0x3ec129[_0x7bdb('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10e818){logger[_0x7bdb('0xb')](_0x7bdb('0x15'),_0x5723f4);logger[_0x7bdb('0xe')](_0x7bdb('0x15'),_0x5723f4,JSON[_0x7bdb('0x10')](_0x10e818));_0x4ffd4b(_0x10e818);})[_0x7bdb('0x14')](function(_0xd2d7be){logger[_0x7bdb('0x11')](_0x7bdb('0x15'),_0xd2d7be[_0x7bdb('0x12')],_0x5723f4);_0x41f540(_0x2aff6a[_0x7bdb('0x11')](0x1f4,_0xd2d7be['message']));});});};exports[_0x7bdb('0x1e')]=function(_0x23fc3a){var _0x8f7672=this;return new Promise(function(_0x9f5c1,_0x29eac5){return db['SalesforceAccount'][_0x7bdb('0x1f')]({'raw':_0x23fc3a[_0x7bdb('0x17')]?_0x23fc3a[_0x7bdb('0x17')][_0x7bdb('0x18')]===undefined?!![]:![]:!![],'where':_0x23fc3a['options']?_0x23fc3a['options']['where']||null:null,'attributes':_0x23fc3a[_0x7bdb('0x17')]?_0x23fc3a['options'][_0x7bdb('0x19')]||null:null,'include':_0x23fc3a['options']?_0x23fc3a[_0x7bdb('0x17')][_0x7bdb('0x1b')]?_[_0x7bdb('0x1d')](_0x23fc3a['options'][_0x7bdb('0x1b')],function(_0x514713){return{'model':db[_0x514713['model']],'as':_0x514713['as'],'attributes':_0x514713[_0x7bdb('0x19')],'include':_0x514713['include']?_[_0x7bdb('0x1d')](_0x514713['include'],function(_0x5ee47d){return{'model':db[_0x5ee47d[_0x7bdb('0x1c')]],'as':_0x5ee47d['as'],'attributes':_0x5ee47d[_0x7bdb('0x19')],'include':_0x5ee47d[_0x7bdb('0x1b')]?_[_0x7bdb('0x1d')](_0x5ee47d[_0x7bdb('0x1b')],function(_0x2bb28a){return{'model':db[_0x2bb28a['model']],'as':_0x2bb28a['as'],'attributes':_0x2bb28a[_0x7bdb('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7bdb('0x20')](function(_0x329ecf){logger[_0x7bdb('0xb')](_0x7bdb('0x1e'),_0x23fc3a);logger[_0x7bdb('0xe')](_0x7bdb('0x1e'),_0x23fc3a,JSON[_0x7bdb('0x10')](_0x329ecf));_0x9f5c1(_0x329ecf);})[_0x7bdb('0x14')](function(_0x4e1c97){logger['error'](_0x7bdb('0x1e'),_0x4e1c97[_0x7bdb('0x12')],_0x23fc3a);_0x29eac5(_0x8f7672[_0x7bdb('0x11')](0x1f4,_0x4e1c97[_0x7bdb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 20bbb1a..9709169 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 _0xd0ee=['isAuthenticated','index','get','/:id','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','path','express','Router','../../components/interaction/service'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd0ee,0x13c));var _0xed0e=function(_0x43b05d,_0x38a9c1){_0x43b05d=_0x43b05d-0x0;var _0xc831fe=_0xd0ee[_0x43b05d];return _0xc831fe;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xed0e('0x0'));var timeout=require('connect-timeout');var express=require(_0xed0e('0x1'));var router=express[_0xed0e('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xed0e('0x3'));var config=require('../../config/environment');var controller=require('./intSalesforceConfiguration.controller');router['get']('/',auth[_0xed0e('0x4')](),controller[_0xed0e('0x5')]);router[_0xed0e('0x6')](_0xed0e('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xed0e('0x6')](_0xed0e('0x8'),auth[_0xed0e('0x4')](),controller['getFields']);router[_0xed0e('0x6')](_0xed0e('0x9'),auth[_0xed0e('0x4')](),controller[_0xed0e('0xa')]);router[_0xed0e('0x6')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xed0e('0xb')]('/:id',auth[_0xed0e('0x4')](),controller[_0xed0e('0xc')]);router[_0xed0e('0xd')](_0xed0e('0x7'),auth[_0xed0e('0x4')](),controller[_0xed0e('0xe')]);module[_0xed0e('0xf')]=router; \ No newline at end of file +var _0x0f6e=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSalesforceConfiguration.controller','isAuthenticated','get','/:id'];(function(_0x43c345,_0x4efb4d){var _0x138bfc=function(_0x248984){while(--_0x248984){_0x43c345['push'](_0x43c345['shift']());}};_0x138bfc(++_0x4efb4d);}(_0x0f6e,0xd1));var _0xe0f6=function(_0x1d246a,_0x49be62){_0x1d246a=_0x1d246a-0x0;var _0x4f233b=_0x0f6e[_0x1d246a];return _0x4f233b;};'use strict';var multer=require(_0xe0f6('0x0'));var util=require('util');var path=require(_0xe0f6('0x1'));var timeout=require(_0xe0f6('0x2'));var express=require(_0xe0f6('0x3'));var router=express[_0xe0f6('0x4')]();var auth=require(_0xe0f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe0f6('0x6'));var controller=require(_0xe0f6('0x7'));router['get']('/',auth[_0xe0f6('0x8')](),controller['index']);router[_0xe0f6('0x9')](_0xe0f6('0xa'),auth[_0xe0f6('0x8')](),controller[_0xe0f6('0xb')]);router['get'](_0xe0f6('0xc'),auth[_0xe0f6('0x8')](),controller[_0xe0f6('0xd')]);router[_0xe0f6('0x9')](_0xe0f6('0xe'),auth[_0xe0f6('0x8')](),controller[_0xe0f6('0xf')]);router[_0xe0f6('0x9')](_0xe0f6('0x10'),auth[_0xe0f6('0x8')](),controller['getDescriptions']);router[_0xe0f6('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0f6('0x12')]);router['put'](_0xe0f6('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe0f6('0x13')]('/:id',auth[_0xe0f6('0x8')](),controller[_0xe0f6('0x14')]);module[_0xe0f6('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index cd0162b..5077fdf 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 _0xd324=['nothing','lead','exports','STRING','Task','Case','ENUM','contact_lead','contact'];(function(_0x21b5e5,_0x269351){var _0x55748f=function(_0x5dc195){while(--_0x5dc195){_0x21b5e5['push'](_0x21b5e5['shift']());}};_0x55748f(++_0x269351);}(_0xd324,0x1c4));var _0x4d32=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0xd324[_0x1ed116];return _0x574066;};'use strict';var Sequelize=require('sequelize');module[_0x4d32('0x0')]={'name':{'type':Sequelize[_0x4d32('0x1')]},'description':{'type':Sequelize[_0x4d32('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x4d32('0x2'),_0x4d32('0x3')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x4d32('0x4')](_0x4d32('0x5'),_0x4d32('0x6'),'lead'),'defaultValue':_0x4d32('0x5')},'moduleCreate':{'type':Sequelize[_0x4d32('0x4')](_0x4d32('0x7'),_0x4d32('0x6'),_0x4d32('0x8')),'defaultValue':_0x4d32('0x8')}}; \ No newline at end of file +var _0xf192=['nothing','sequelize','exports','Task','Case','ENUM','contact_lead','contact','lead'];(function(_0x4e0843,_0x5224b5){var _0x40d38d=function(_0x4da742){while(--_0x4da742){_0x4e0843['push'](_0x4e0843['shift']());}};_0x40d38d(++_0x5224b5);}(_0xf192,0x1de));var _0x2f19=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xf192[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0x2f19('0x0'));module[_0x2f19('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x2f19('0x2'),_0x2f19('0x3')),'defaultValue':_0x2f19('0x2')},'moduleSearch':{'type':Sequelize[_0x2f19('0x4')](_0x2f19('0x5'),_0x2f19('0x6'),_0x2f19('0x7')),'defaultValue':_0x2f19('0x5')},'moduleCreate':{'type':Sequelize[_0x2f19('0x4')](_0x2f19('0x8'),_0x2f19('0x6'),_0x2f19('0x7')),'defaultValue':_0x2f19('0x7')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index bb7f71e..8491f8d 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 _0x13f0=['Content-Range','apply','save','update','destroy','sendStatus','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','type','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','length','includeAll','find','create','body','getFields','findOne','SalesforceField','sort','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','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','jayson/promise','client','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','result','catch','status','end','json','count','limit','set'];(function(_0x3e79e5,_0x2894b0){var _0x503dad=function(_0x328b87){while(--_0x328b87){_0x3e79e5['push'](_0x3e79e5['shift']());}};_0x503dad(++_0x2894b0);}(_0x13f0,0x90));var _0x013f=function(_0x2c8be2,_0x16dc35){_0x2c8be2=_0x2c8be2-0x0;var _0x4543fa=_0x13f0[_0x2c8be2];return _0x4543fa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x013f('0x0'));var rimraf=require(_0x013f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x013f('0x2'));var moment=require(_0x013f('0x3'));var BPromise=require(_0x013f('0x4'));var Mustache=require('mustache');var util=require(_0x013f('0x5'));var path=require(_0x013f('0x6'));var sox=require(_0x013f('0x7'));var csv=require(_0x013f('0x8'));var ejs=require(_0x013f('0x9'));var fs=require('fs');var _=require(_0x013f('0xa'));var squel=require(_0x013f('0xb'));var crypto=require(_0x013f('0xc'));var jsforce=require(_0x013f('0xd'));var deskjs=require(_0x013f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x013f('0xf'));var Papa=require(_0x013f('0x10'));var Redis=require(_0x013f('0x11'));var authService=require(_0x013f('0x12'));var qs=require(_0x013f('0x13'));var as=require(_0x013f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x013f('0x15'))(_0x013f('0x16'));var utils=require(_0x013f('0x17'));var config=require(_0x013f('0x18'));var licenseUtil=require(_0x013f('0x19'));var db=require(_0x013f('0x1a'))['db'];var jayson=require(_0x013f('0x1b'));var client=jayson[_0x013f('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20db09,_0x4115a4,_0x305148,_0x438b26){return new BPromise(function(_0x355354,_0x7a6541){var _0x56cbae=_0x438b26||client;return _0x56cbae[_0x013f('0x1d')](_0x20db09,_0x305148)[_0x013f('0x1e')](function(_0x257e4b){logger[_0x013f('0x1f')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4115a4,_0x013f('0x20'));logger[_0x013f('0x21')](_0x013f('0x22'),_0x4115a4,_0x013f('0x20'),JSON[_0x013f('0x23')](_0x257e4b));if(_0x257e4b[_0x013f('0x24')]){if(_0x257e4b[_0x013f('0x24')][_0x013f('0x25')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4115a4,_0x257e4b['error'][_0x013f('0x26')]);return _0x7a6541(_0x257e4b[_0x013f('0x24')][_0x013f('0x26')]);}logger[_0x013f('0x24')](_0x013f('0x27'),_0x4115a4,_0x257e4b[_0x013f('0x24')][_0x013f('0x26')]);return _0x355354(_0x257e4b[_0x013f('0x24')]['message']);}else{logger['info'](_0x013f('0x27'),_0x4115a4,_0x013f('0x20'));_0x355354(_0x257e4b[_0x013f('0x28')][_0x013f('0x26')]);}})[_0x013f('0x29')](function(_0x53bd17){logger['error'](_0x013f('0x27'),_0x4115a4,_0x53bd17);_0x7a6541(_0x53bd17);});});}function respondWithStatusCode(_0xeb9bba,_0x352aad){_0x352aad=_0x352aad||0xcc;return function(_0x56dd92){if(_0x56dd92){return _0xeb9bba['sendStatus'](_0x352aad);}return _0xeb9bba[_0x013f('0x2a')](_0x352aad)[_0x013f('0x2b')]();};}function respondWithResult(_0x5cb133,_0x46e2e5){_0x46e2e5=_0x46e2e5||0xc8;return function(_0x52fd54){if(_0x52fd54){return _0x5cb133[_0x013f('0x2a')](_0x46e2e5)[_0x013f('0x2c')](_0x52fd54);}};}function respondWithFilteredResult(_0x234e59,_0x4a8d71){return function(_0x4a0e59){if(_0x4a0e59){var _0x21d9ef=_0x4a0e59[_0x013f('0x2d')],_0x12c38e=_0x4a8d71['offset'],_0x870938=_0x4a8d71['offset']+_0x4a8d71[_0x013f('0x2e')],_0x316157;if(_0x870938>=_0x21d9ef){_0x870938=_0x21d9ef;_0x316157=0xc8;}else{_0x316157=0xce;}_0x234e59['status'](_0x316157);return _0x234e59[_0x013f('0x2f')](_0x013f('0x30'),_0x12c38e+'-'+_0x870938+'/'+_0x21d9ef)['json'](_0x4a0e59);}return null;};}function patchUpdates(_0x124b05){return function(_0x3df2bd){try{jsonpatch[_0x013f('0x31')](_0x3df2bd,_0x124b05,!![]);}catch(_0x1d1be9){return BPromise['reject'](_0x1d1be9);}return _0x3df2bd[_0x013f('0x32')]();};}function saveUpdates(_0x4adde0,_0x4b9fcc){return function(_0x3fb50c){if(_0x3fb50c){return _0x3fb50c[_0x013f('0x33')](_0x4adde0)['then'](function(_0x4159c9){return _0x4159c9;});}return null;};}function removeEntity(_0x120139,_0x45f752){return function(_0x2bc22b){if(_0x2bc22b){return _0x2bc22b[_0x013f('0x34')]()['then'](function(){_0x120139[_0x013f('0x2a')](0xcc)[_0x013f('0x2b')]();});}};}function handleEntityNotFound(_0x46d1e0,_0x1b99b7){return function(_0x544e92){if(!_0x544e92){_0x46d1e0[_0x013f('0x35')](0x194);}return _0x544e92;};}function handleError(_0x280dc3,_0x4d1372){_0x4d1372=_0x4d1372||0x1f4;return function(_0x8c3e41){logger['error'](_0x8c3e41[_0x013f('0x36')]);if(_0x8c3e41[_0x013f('0x37')]){delete _0x8c3e41[_0x013f('0x37')];}_0x280dc3[_0x013f('0x2a')](_0x4d1372)[_0x013f('0x38')](_0x8c3e41);};}exports[_0x013f('0x39')]=function(_0x9be279,_0x563706){var _0x31d381={},_0x14bd15={},_0x7bb304={'count':0x0,'rows':[]};var _0x3b75e1=_[_0x013f('0x3a')](db[_0x013f('0x3b')][_0x013f('0x3c')],function(_0x25319b){return{'name':_0x25319b['fieldName'],'type':_0x25319b[_0x013f('0x3d')][_0x013f('0x3e')]};});_0x14bd15['model']=_[_0x013f('0x3a')](_0x3b75e1,_0x013f('0x37'));_0x14bd15[_0x013f('0x3f')]=_[_0x013f('0x40')](_0x9be279['query']);_0x14bd15[_0x013f('0x41')]=_['intersection'](_0x14bd15[_0x013f('0x42')],_0x14bd15[_0x013f('0x3f')]);_0x31d381['attributes']=_[_0x013f('0x43')](_0x14bd15[_0x013f('0x42')],qs[_0x013f('0x44')](_0x9be279[_0x013f('0x3f')]['fields']));_0x31d381['attributes']=_0x31d381[_0x013f('0x45')]['length']?_0x31d381[_0x013f('0x45')]:_0x14bd15[_0x013f('0x42')];if(!_0x9be279[_0x013f('0x3f')][_0x013f('0x46')](_0x013f('0x47'))){_0x31d381[_0x013f('0x2e')]=qs[_0x013f('0x2e')](_0x9be279[_0x013f('0x3f')][_0x013f('0x2e')]);_0x31d381[_0x013f('0x48')]=qs[_0x013f('0x48')](_0x9be279[_0x013f('0x3f')][_0x013f('0x48')]);}_0x31d381[_0x013f('0x49')]=qs['sort'](_0x9be279[_0x013f('0x3f')]['sort']);_0x31d381[_0x013f('0x4a')]=qs['filters'](_[_0x013f('0x4b')](_0x9be279[_0x013f('0x3f')],_0x14bd15[_0x013f('0x41')]),_0x3b75e1);if(_0x9be279['query'][_0x013f('0x4c')]){_0x31d381['where']=_[_0x013f('0x4d')](_0x31d381['where'],{'$or':_[_0x013f('0x3a')](_0x3b75e1,function(_0x48b1ab){if(_0x48b1ab['type']!==_0x013f('0x4e')){var _0x196091={};_0x196091[_0x48b1ab[_0x013f('0x37')]]={'$like':'%'+_0x9be279['query'][_0x013f('0x4c')]+'%'};return _0x196091;}})});}_0x31d381=_[_0x013f('0x4d')]({},_0x31d381,_0x9be279[_0x013f('0x4f')]);var _0x132b38={'where':_0x31d381['where']};return db[_0x013f('0x3b')]['count'](_0x132b38)[_0x013f('0x1e')](function(_0x44cd98){_0x7bb304['count']=_0x44cd98;if(_0x9be279[_0x013f('0x3f')]['includeAll']){_0x31d381[_0x013f('0x50')]=[{'all':!![]}];}return db[_0x013f('0x3b')][_0x013f('0x51')](_0x31d381);})['then'](function(_0x32450e){_0x7bb304[_0x013f('0x52')]=_0x32450e;return _0x7bb304;})[_0x013f('0x1e')](respondWithFilteredResult(_0x563706,_0x31d381))[_0x013f('0x29')](handleError(_0x563706,null));};exports[_0x013f('0x53')]=function(_0xada61c,_0x171e74){var _0x281679={'raw':![],'where':{'id':_0xada61c[_0x013f('0x54')]['id']}},_0x1e7d17={};_0x1e7d17[_0x013f('0x42')]=_[_0x013f('0x40')](db[_0x013f('0x3b')][_0x013f('0x3c')]);_0x1e7d17[_0x013f('0x3f')]=_[_0x013f('0x40')](_0xada61c[_0x013f('0x3f')]);_0x1e7d17[_0x013f('0x41')]=_[_0x013f('0x43')](_0x1e7d17[_0x013f('0x42')],_0x1e7d17[_0x013f('0x3f')]);_0x281679[_0x013f('0x45')]=_[_0x013f('0x43')](_0x1e7d17['model'],qs[_0x013f('0x44')](_0xada61c[_0x013f('0x3f')][_0x013f('0x44')]));_0x281679[_0x013f('0x45')]=_0x281679[_0x013f('0x45')][_0x013f('0x55')]?_0x281679[_0x013f('0x45')]:_0x1e7d17[_0x013f('0x42')];if(_0xada61c['query'][_0x013f('0x56')]){_0x281679[_0x013f('0x50')]=[{'all':!![]}];}_0x281679=_[_0x013f('0x4d')]({},_0x281679,_0xada61c[_0x013f('0x4f')]);return db[_0x013f('0x3b')][_0x013f('0x57')](_0x281679)[_0x013f('0x1e')](handleEntityNotFound(_0x171e74,null))[_0x013f('0x1e')](respondWithResult(_0x171e74,null))[_0x013f('0x29')](handleError(_0x171e74,null));};exports['create']=function(_0x5bbef2,_0x829143){return db[_0x013f('0x3b')][_0x013f('0x58')](_0x5bbef2[_0x013f('0x59')],{})['then'](respondWithResult(_0x829143,0xc9))[_0x013f('0x29')](handleError(_0x829143,null));};exports[_0x013f('0x33')]=function(_0x16f044,_0x53d28c){if(_0x16f044['body']['id']){delete _0x16f044[_0x013f('0x59')]['id'];}return db[_0x013f('0x3b')][_0x013f('0x57')]({'where':{'id':_0x16f044['params']['id']}})[_0x013f('0x1e')](handleEntityNotFound(_0x53d28c,null))['then'](saveUpdates(_0x16f044[_0x013f('0x59')],null))[_0x013f('0x1e')](respondWithResult(_0x53d28c,null))[_0x013f('0x29')](handleError(_0x53d28c,null));};exports['destroy']=function(_0x37f895,_0x1d86aa){return db['SalesforceConfiguration'][_0x013f('0x57')]({'where':{'id':_0x37f895['params']['id']}})[_0x013f('0x1e')](handleEntityNotFound(_0x1d86aa,null))[_0x013f('0x1e')](removeEntity(_0x1d86aa,null))['catch'](handleError(_0x1d86aa,null));};exports[_0x013f('0x5a')]=function(_0x23fe4c,_0x8ff3e0,_0x43ca1d){var _0x42828e={};var _0x5f4c89={};var _0x47a0b3;var _0x58a6ef;return db[_0x013f('0x3b')][_0x013f('0x5b')]({'where':{'id':_0x23fe4c[_0x013f('0x54')]['id']}})[_0x013f('0x1e')](handleEntityNotFound(_0x8ff3e0,null))[_0x013f('0x1e')](function(_0x503f35){if(_0x503f35){_0x47a0b3=_0x503f35;_0x5f4c89[_0x013f('0x42')]=_[_0x013f('0x40')](db[_0x013f('0x5c')][_0x013f('0x3c')]);_0x5f4c89[_0x013f('0x3f')]=_[_0x013f('0x40')](_0x23fe4c[_0x013f('0x3f')]);_0x5f4c89['filters']=_['intersection'](_0x5f4c89[_0x013f('0x42')],_0x5f4c89['query']);_0x42828e[_0x013f('0x45')]=_[_0x013f('0x43')](_0x5f4c89[_0x013f('0x42')],qs[_0x013f('0x44')](_0x23fe4c[_0x013f('0x3f')][_0x013f('0x44')]));_0x42828e[_0x013f('0x45')]=_0x42828e[_0x013f('0x45')]['length']?_0x42828e[_0x013f('0x45')]:_0x5f4c89['model'];_0x42828e[_0x013f('0x49')]=qs['sort'](_0x23fe4c[_0x013f('0x3f')][_0x013f('0x5d')]);_0x42828e['where']=qs[_0x013f('0x41')](_['pick'](_0x23fe4c[_0x013f('0x3f')],_0x5f4c89[_0x013f('0x41')]));if(_0x23fe4c[_0x013f('0x3f')][_0x013f('0x4c')]){_0x42828e[_0x013f('0x4a')]=_[_0x013f('0x4d')](_0x42828e[_0x013f('0x4a')],{'$or':_[_0x013f('0x3a')](_0x42828e[_0x013f('0x45')],function(_0xb44785){var _0x3015ef={};_0x3015ef[_0xb44785]={'$like':'%'+_0x23fe4c[_0x013f('0x3f')]['filter']+'%'};return _0x3015ef;})});}_0x42828e=_[_0x013f('0x4d')]({},_0x42828e,_0x23fe4c[_0x013f('0x4f')]);return _0x47a0b3[_0x013f('0x5a')](_0x42828e);}})[_0x013f('0x1e')](function(_0xd16b4c){if(_0xd16b4c){_0x58a6ef=_0xd16b4c[_0x013f('0x55')];if(!_0x23fe4c['query'][_0x013f('0x46')](_0x013f('0x47'))){_0x42828e[_0x013f('0x2e')]=qs['limit'](_0x23fe4c['query'][_0x013f('0x2e')]);_0x42828e[_0x013f('0x48')]=qs[_0x013f('0x48')](_0x23fe4c[_0x013f('0x3f')][_0x013f('0x48')]);}return _0x47a0b3['getFields'](_0x42828e);}})[_0x013f('0x1e')](function(_0x1a7795){if(_0x1a7795){return _0x1a7795?{'count':_0x58a6ef,'rows':_0x1a7795}:null;}})[_0x013f('0x1e')](respondWithResult(_0x8ff3e0,null))['catch'](handleError(_0x8ff3e0,null));};exports[_0x013f('0x5e')]=function(_0xb51c18,_0x4ff333,_0x4c880b){var _0x166d18={};var _0x3e1a9c={};var _0x104df2;var _0x204693;return db['SalesforceConfiguration'][_0x013f('0x5b')]({'where':{'id':_0xb51c18[_0x013f('0x54')]['id']}})[_0x013f('0x1e')](handleEntityNotFound(_0x4ff333,null))[_0x013f('0x1e')](function(_0x7103e2){if(_0x7103e2){_0x104df2=_0x7103e2;_0x3e1a9c[_0x013f('0x42')]=_[_0x013f('0x40')](db[_0x013f('0x5c')]['rawAttributes']);_0x3e1a9c['query']=_[_0x013f('0x40')](_0xb51c18['query']);_0x3e1a9c['filters']=_[_0x013f('0x43')](_0x3e1a9c[_0x013f('0x42')],_0x3e1a9c[_0x013f('0x3f')]);_0x166d18[_0x013f('0x45')]=_['intersection'](_0x3e1a9c['model'],qs['fields'](_0xb51c18['query'][_0x013f('0x44')]));_0x166d18[_0x013f('0x45')]=_0x166d18[_0x013f('0x45')]['length']?_0x166d18['attributes']:_0x3e1a9c[_0x013f('0x42')];_0x166d18['order']=qs[_0x013f('0x5d')](_0xb51c18['query'][_0x013f('0x5d')]);_0x166d18['where']=qs[_0x013f('0x41')](_[_0x013f('0x4b')](_0xb51c18['query'],_0x3e1a9c[_0x013f('0x41')]));if(_0xb51c18[_0x013f('0x3f')][_0x013f('0x4c')]){_0x166d18[_0x013f('0x4a')]=_['merge'](_0x166d18[_0x013f('0x4a')],{'$or':_[_0x013f('0x3a')](_0x166d18[_0x013f('0x45')],function(_0x15e222){var _0x3479ce={};_0x3479ce[_0x15e222]={'$like':'%'+_0xb51c18[_0x013f('0x3f')][_0x013f('0x4c')]+'%'};return _0x3479ce;})});}_0x166d18=_[_0x013f('0x4d')]({},_0x166d18,_0xb51c18[_0x013f('0x4f')]);return _0x104df2[_0x013f('0x5e')](_0x166d18);}})[_0x013f('0x1e')](function(_0x567e4f){if(_0x567e4f){_0x204693=_0x567e4f[_0x013f('0x55')];if(!_0xb51c18[_0x013f('0x3f')][_0x013f('0x46')](_0x013f('0x47'))){_0x166d18[_0x013f('0x2e')]=qs['limit'](_0xb51c18[_0x013f('0x3f')]['limit']);_0x166d18[_0x013f('0x48')]=qs[_0x013f('0x48')](_0xb51c18['query'][_0x013f('0x48')]);}return _0x104df2[_0x013f('0x5e')](_0x166d18);}})[_0x013f('0x1e')](function(_0x448323){if(_0x448323){return _0x448323?{'count':_0x204693,'rows':_0x448323}:null;}})[_0x013f('0x1e')](respondWithResult(_0x4ff333,null))['catch'](handleError(_0x4ff333,null));};exports[_0x013f('0x5f')]=function(_0x2287f4,_0x41837d,_0x311338){var _0x52e80d={};var _0x43c6f8={};var _0x5265aa;var _0x318004;return db[_0x013f('0x3b')][_0x013f('0x5b')]({'where':{'id':_0x2287f4['params']['id']}})[_0x013f('0x1e')](handleEntityNotFound(_0x41837d,null))['then'](function(_0x39ac4f){if(_0x39ac4f){_0x5265aa=_0x39ac4f;_0x43c6f8[_0x013f('0x42')]=_['keys'](db[_0x013f('0x5c')][_0x013f('0x3c')]);_0x43c6f8[_0x013f('0x3f')]=_[_0x013f('0x40')](_0x2287f4['query']);_0x43c6f8[_0x013f('0x41')]=_[_0x013f('0x43')](_0x43c6f8[_0x013f('0x42')],_0x43c6f8[_0x013f('0x3f')]);_0x52e80d[_0x013f('0x45')]=_['intersection'](_0x43c6f8[_0x013f('0x42')],qs[_0x013f('0x44')](_0x2287f4[_0x013f('0x3f')][_0x013f('0x44')]));_0x52e80d[_0x013f('0x45')]=_0x52e80d[_0x013f('0x45')][_0x013f('0x55')]?_0x52e80d[_0x013f('0x45')]:_0x43c6f8['model'];_0x52e80d[_0x013f('0x49')]=qs[_0x013f('0x5d')](_0x2287f4[_0x013f('0x3f')][_0x013f('0x5d')]);_0x52e80d['where']=qs[_0x013f('0x41')](_[_0x013f('0x4b')](_0x2287f4[_0x013f('0x3f')],_0x43c6f8[_0x013f('0x41')]));if(_0x2287f4[_0x013f('0x3f')][_0x013f('0x4c')]){_0x52e80d[_0x013f('0x4a')]=_[_0x013f('0x4d')](_0x52e80d['where'],{'$or':_[_0x013f('0x3a')](_0x52e80d[_0x013f('0x45')],function(_0x2f048b){var _0x192d76={};_0x192d76[_0x2f048b]={'$like':'%'+_0x2287f4['query'][_0x013f('0x4c')]+'%'};return _0x192d76;})});}_0x52e80d=_['merge']({},_0x52e80d,_0x2287f4[_0x013f('0x4f')]);return _0x5265aa[_0x013f('0x5f')](_0x52e80d);}})['then'](function(_0x1462c7){if(_0x1462c7){_0x318004=_0x1462c7[_0x013f('0x55')];if(!_0x2287f4['query'][_0x013f('0x46')](_0x013f('0x47'))){_0x52e80d[_0x013f('0x2e')]=qs[_0x013f('0x2e')](_0x2287f4[_0x013f('0x3f')]['limit']);_0x52e80d[_0x013f('0x48')]=qs[_0x013f('0x48')](_0x2287f4[_0x013f('0x3f')][_0x013f('0x48')]);}return _0x5265aa[_0x013f('0x5f')](_0x52e80d);}})[_0x013f('0x1e')](function(_0x10c1d7){if(_0x10c1d7){return _0x10c1d7?{'count':_0x318004,'rows':_0x10c1d7}:null;}})['then'](respondWithResult(_0x41837d,null))[_0x013f('0x29')](handleError(_0x41837d,null));}; \ No newline at end of file +var _0x9d22=['SalesforceField','pick','nolimit','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','update','destroy','stack','send','index','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','options','SalesforceConfiguration','count','includeAll','include','rows','params','rawAttributes','merge','find','create','body','findOne'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9d22,0x1be));var _0x29d2=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x9d22[_0x39e283];return _0x7de89f;};'use strict';var pdf=require(_0x29d2('0x0'));var emlformat=require(_0x29d2('0x1'));var rimraf=require(_0x29d2('0x2'));var zipdir=require(_0x29d2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x29d2('0x4'));var BPromise=require(_0x29d2('0x5'));var Mustache=require(_0x29d2('0x6'));var util=require('util');var path=require(_0x29d2('0x7'));var sox=require(_0x29d2('0x8'));var csv=require(_0x29d2('0x9'));var ejs=require(_0x29d2('0xa'));var fs=require('fs');var _=require(_0x29d2('0xb'));var squel=require(_0x29d2('0xc'));var crypto=require('crypto');var jsforce=require(_0x29d2('0xd'));var deskjs=require(_0x29d2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x29d2('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x29d2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x29d2('0x11'));var hardwareService=require(_0x29d2('0x12'));var logger=require(_0x29d2('0x13'))('api');var utils=require(_0x29d2('0x14'));var config=require(_0x29d2('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x29d2('0x16')][_0x29d2('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x5ad1b6,_0x4f2083,_0x1a92d,_0x5be822){return new BPromise(function(_0x556600,_0x1914a9){var _0x4e4d56=_0x5be822||client;return _0x4e4d56[_0x29d2('0x18')](_0x5ad1b6,_0x1a92d)[_0x29d2('0x19')](function(_0xc6ce80){logger[_0x29d2('0x1a')](_0x29d2('0x1b'),_0x4f2083,'request\x20sent');logger[_0x29d2('0x1c')](_0x29d2('0x1d'),_0x4f2083,'request\x20sent',JSON[_0x29d2('0x1e')](_0xc6ce80));if(_0xc6ce80[_0x29d2('0x1f')]){if(_0xc6ce80['error'][_0x29d2('0x20')]===0x1f4){logger['error'](_0x29d2('0x1b'),_0x4f2083,_0xc6ce80[_0x29d2('0x1f')][_0x29d2('0x21')]);return _0x1914a9(_0xc6ce80['error']['message']);}logger[_0x29d2('0x1f')](_0x29d2('0x1b'),_0x4f2083,_0xc6ce80['error']['message']);return _0x556600(_0xc6ce80[_0x29d2('0x1f')][_0x29d2('0x21')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x4f2083,_0x29d2('0x22'));_0x556600(_0xc6ce80[_0x29d2('0x23')]['message']);}})[_0x29d2('0x24')](function(_0x1f2c17){logger[_0x29d2('0x1f')](_0x29d2('0x1b'),_0x4f2083,_0x1f2c17);_0x1914a9(_0x1f2c17);});});}function respondWithStatusCode(_0x23fbda,_0x5e64bc){_0x5e64bc=_0x5e64bc||0xcc;return function(_0x378242){if(_0x378242){return _0x23fbda[_0x29d2('0x25')](_0x5e64bc);}return _0x23fbda[_0x29d2('0x26')](_0x5e64bc)[_0x29d2('0x27')]();};}function respondWithResult(_0x3db1c6,_0x3d3573){_0x3d3573=_0x3d3573||0xc8;return function(_0x1af44d){if(_0x1af44d){return _0x3db1c6[_0x29d2('0x26')](_0x3d3573)[_0x29d2('0x28')](_0x1af44d);}};}function respondWithFilteredResult(_0x103f51,_0x1fbf47){return function(_0xbdeb9b){if(_0xbdeb9b){var _0x1916e2=_0xbdeb9b['count'],_0x4d7c7f=_0x1fbf47[_0x29d2('0x29')],_0x1648a4=_0x1fbf47[_0x29d2('0x29')]+_0x1fbf47[_0x29d2('0x2a')],_0x25fd3a;if(_0x1648a4>=_0x1916e2){_0x1648a4=_0x1916e2;_0x25fd3a=0xc8;}else{_0x25fd3a=0xce;}_0x103f51['status'](_0x25fd3a);return _0x103f51['set'](_0x29d2('0x2b'),_0x4d7c7f+'-'+_0x1648a4+'/'+_0x1916e2)[_0x29d2('0x28')](_0xbdeb9b);}return null;};}function patchUpdates(_0x40ff02){return function(_0x3b9614){try{jsonpatch['apply'](_0x3b9614,_0x40ff02,!![]);}catch(_0x58760a){return BPromise[_0x29d2('0x2c')](_0x58760a);}return _0x3b9614[_0x29d2('0x2d')]();};}function saveUpdates(_0x2de625,_0x2d858e){return function(_0x117a1e){if(_0x117a1e){return _0x117a1e[_0x29d2('0x2e')](_0x2de625)[_0x29d2('0x19')](function(_0x208fbb){return _0x208fbb;});}return null;};}function removeEntity(_0x228297,_0x5a6843){return function(_0x20fbf8){if(_0x20fbf8){return _0x20fbf8[_0x29d2('0x2f')]()[_0x29d2('0x19')](function(){_0x228297[_0x29d2('0x26')](0xcc)[_0x29d2('0x27')]();});}};}function handleEntityNotFound(_0x131ae5,_0x80458b){return function(_0x203154){if(!_0x203154){_0x131ae5['sendStatus'](0x194);}return _0x203154;};}function handleError(_0x2de72d,_0x445d0e){_0x445d0e=_0x445d0e||0x1f4;return function(_0x492aa5){logger[_0x29d2('0x1f')](_0x492aa5[_0x29d2('0x30')]);if(_0x492aa5['name']){delete _0x492aa5['name'];}_0x2de72d[_0x29d2('0x26')](_0x445d0e)[_0x29d2('0x31')](_0x492aa5);};}exports[_0x29d2('0x32')]=function(_0x34e02c,_0x1d556c){var _0x4fb4c8={},_0x25cf0a={},_0x2a712a={'count':0x0,'rows':[]};var _0x5d5f52=_['map'](db['SalesforceConfiguration']['rawAttributes'],function(_0x55e092){return{'name':_0x55e092[_0x29d2('0x33')],'type':_0x55e092[_0x29d2('0x34')]['key']};});_0x25cf0a[_0x29d2('0x35')]=_[_0x29d2('0x36')](_0x5d5f52,_0x29d2('0x37'));_0x25cf0a[_0x29d2('0x38')]=_[_0x29d2('0x39')](_0x34e02c[_0x29d2('0x38')]);_0x25cf0a[_0x29d2('0x3a')]=_[_0x29d2('0x3b')](_0x25cf0a[_0x29d2('0x35')],_0x25cf0a[_0x29d2('0x38')]);_0x4fb4c8[_0x29d2('0x3c')]=_['intersection'](_0x25cf0a[_0x29d2('0x35')],qs[_0x29d2('0x3d')](_0x34e02c[_0x29d2('0x38')][_0x29d2('0x3d')]));_0x4fb4c8['attributes']=_0x4fb4c8[_0x29d2('0x3c')][_0x29d2('0x3e')]?_0x4fb4c8[_0x29d2('0x3c')]:_0x25cf0a[_0x29d2('0x35')];if(!_0x34e02c[_0x29d2('0x38')][_0x29d2('0x3f')]('nolimit')){_0x4fb4c8[_0x29d2('0x2a')]=qs[_0x29d2('0x2a')](_0x34e02c[_0x29d2('0x38')][_0x29d2('0x2a')]);_0x4fb4c8[_0x29d2('0x29')]=qs[_0x29d2('0x29')](_0x34e02c[_0x29d2('0x38')][_0x29d2('0x29')]);}_0x4fb4c8[_0x29d2('0x40')]=qs[_0x29d2('0x41')](_0x34e02c['query'][_0x29d2('0x41')]);_0x4fb4c8[_0x29d2('0x42')]=qs[_0x29d2('0x3a')](_['pick'](_0x34e02c[_0x29d2('0x38')],_0x25cf0a[_0x29d2('0x3a')]),_0x5d5f52);if(_0x34e02c[_0x29d2('0x38')][_0x29d2('0x43')]){_0x4fb4c8['where']=_['merge'](_0x4fb4c8[_0x29d2('0x42')],{'$or':_[_0x29d2('0x36')](_0x5d5f52,function(_0x3bbba1){if(_0x3bbba1[_0x29d2('0x34')]!==_0x29d2('0x44')){var _0x2a33b8={};_0x2a33b8[_0x3bbba1[_0x29d2('0x37')]]={'$like':'%'+_0x34e02c[_0x29d2('0x38')]['filter']+'%'};return _0x2a33b8;}})});}_0x4fb4c8=_['merge']({},_0x4fb4c8,_0x34e02c[_0x29d2('0x45')]);var _0x5996ff={'where':_0x4fb4c8[_0x29d2('0x42')]};return db[_0x29d2('0x46')][_0x29d2('0x47')](_0x5996ff)[_0x29d2('0x19')](function(_0x1eceb9){_0x2a712a[_0x29d2('0x47')]=_0x1eceb9;if(_0x34e02c[_0x29d2('0x38')][_0x29d2('0x48')]){_0x4fb4c8[_0x29d2('0x49')]=[{'all':!![]}];}return db[_0x29d2('0x46')]['findAll'](_0x4fb4c8);})[_0x29d2('0x19')](function(_0x41dad0){_0x2a712a[_0x29d2('0x4a')]=_0x41dad0;return _0x2a712a;})[_0x29d2('0x19')](respondWithFilteredResult(_0x1d556c,_0x4fb4c8))[_0x29d2('0x24')](handleError(_0x1d556c,null));};exports['show']=function(_0x40022d,_0x5662fc){var _0x8da29a={'raw':![],'where':{'id':_0x40022d[_0x29d2('0x4b')]['id']}},_0x9f0206={};_0x9f0206[_0x29d2('0x35')]=_[_0x29d2('0x39')](db[_0x29d2('0x46')][_0x29d2('0x4c')]);_0x9f0206[_0x29d2('0x38')]=_['keys'](_0x40022d[_0x29d2('0x38')]);_0x9f0206[_0x29d2('0x3a')]=_[_0x29d2('0x3b')](_0x9f0206[_0x29d2('0x35')],_0x9f0206['query']);_0x8da29a['attributes']=_[_0x29d2('0x3b')](_0x9f0206[_0x29d2('0x35')],qs[_0x29d2('0x3d')](_0x40022d[_0x29d2('0x38')][_0x29d2('0x3d')]));_0x8da29a['attributes']=_0x8da29a[_0x29d2('0x3c')][_0x29d2('0x3e')]?_0x8da29a[_0x29d2('0x3c')]:_0x9f0206['model'];if(_0x40022d[_0x29d2('0x38')][_0x29d2('0x48')]){_0x8da29a['include']=[{'all':!![]}];}_0x8da29a=_[_0x29d2('0x4d')]({},_0x8da29a,_0x40022d[_0x29d2('0x45')]);return db['SalesforceConfiguration'][_0x29d2('0x4e')](_0x8da29a)[_0x29d2('0x19')](handleEntityNotFound(_0x5662fc,null))[_0x29d2('0x19')](respondWithResult(_0x5662fc,null))[_0x29d2('0x24')](handleError(_0x5662fc,null));};exports[_0x29d2('0x4f')]=function(_0x512dde,_0x9f961b){return db[_0x29d2('0x46')]['create'](_0x512dde[_0x29d2('0x50')],{})[_0x29d2('0x19')](respondWithResult(_0x9f961b,0xc9))['catch'](handleError(_0x9f961b,null));};exports['update']=function(_0xb97c83,_0x47d943){if(_0xb97c83[_0x29d2('0x50')]['id']){delete _0xb97c83['body']['id'];}return db[_0x29d2('0x46')][_0x29d2('0x4e')]({'where':{'id':_0xb97c83[_0x29d2('0x4b')]['id']}})[_0x29d2('0x19')](handleEntityNotFound(_0x47d943,null))[_0x29d2('0x19')](saveUpdates(_0xb97c83[_0x29d2('0x50')],null))[_0x29d2('0x19')](respondWithResult(_0x47d943,null))[_0x29d2('0x24')](handleError(_0x47d943,null));};exports[_0x29d2('0x2f')]=function(_0x4e4778,_0x4d39b1){return db[_0x29d2('0x46')]['find']({'where':{'id':_0x4e4778[_0x29d2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4d39b1,null))[_0x29d2('0x19')](removeEntity(_0x4d39b1,null))[_0x29d2('0x24')](handleError(_0x4d39b1,null));};exports['getFields']=function(_0x9e3eeb,_0x44dedc,_0x49431c){var _0x34b8c1={};var _0x3373a5={};var _0x5c0be1;var _0x1fcc10;return db[_0x29d2('0x46')][_0x29d2('0x51')]({'where':{'id':_0x9e3eeb['params']['id']}})['then'](handleEntityNotFound(_0x44dedc,null))[_0x29d2('0x19')](function(_0x82a636){if(_0x82a636){_0x5c0be1=_0x82a636;_0x3373a5[_0x29d2('0x35')]=_[_0x29d2('0x39')](db[_0x29d2('0x52')][_0x29d2('0x4c')]);_0x3373a5[_0x29d2('0x38')]=_[_0x29d2('0x39')](_0x9e3eeb[_0x29d2('0x38')]);_0x3373a5[_0x29d2('0x3a')]=_[_0x29d2('0x3b')](_0x3373a5[_0x29d2('0x35')],_0x3373a5[_0x29d2('0x38')]);_0x34b8c1[_0x29d2('0x3c')]=_[_0x29d2('0x3b')](_0x3373a5[_0x29d2('0x35')],qs['fields'](_0x9e3eeb[_0x29d2('0x38')][_0x29d2('0x3d')]));_0x34b8c1[_0x29d2('0x3c')]=_0x34b8c1[_0x29d2('0x3c')][_0x29d2('0x3e')]?_0x34b8c1[_0x29d2('0x3c')]:_0x3373a5['model'];_0x34b8c1[_0x29d2('0x40')]=qs['sort'](_0x9e3eeb[_0x29d2('0x38')]['sort']);_0x34b8c1['where']=qs['filters'](_[_0x29d2('0x53')](_0x9e3eeb[_0x29d2('0x38')],_0x3373a5[_0x29d2('0x3a')]));if(_0x9e3eeb[_0x29d2('0x38')][_0x29d2('0x43')]){_0x34b8c1[_0x29d2('0x42')]=_[_0x29d2('0x4d')](_0x34b8c1[_0x29d2('0x42')],{'$or':_[_0x29d2('0x36')](_0x34b8c1[_0x29d2('0x3c')],function(_0x512727){var _0x2c354e={};_0x2c354e[_0x512727]={'$like':'%'+_0x9e3eeb['query'][_0x29d2('0x43')]+'%'};return _0x2c354e;})});}_0x34b8c1=_[_0x29d2('0x4d')]({},_0x34b8c1,_0x9e3eeb[_0x29d2('0x45')]);return _0x5c0be1['getFields'](_0x34b8c1);}})[_0x29d2('0x19')](function(_0x2ad83b){if(_0x2ad83b){_0x1fcc10=_0x2ad83b['length'];if(!_0x9e3eeb[_0x29d2('0x38')][_0x29d2('0x3f')](_0x29d2('0x54'))){_0x34b8c1[_0x29d2('0x2a')]=qs['limit'](_0x9e3eeb[_0x29d2('0x38')][_0x29d2('0x2a')]);_0x34b8c1[_0x29d2('0x29')]=qs[_0x29d2('0x29')](_0x9e3eeb[_0x29d2('0x38')][_0x29d2('0x29')]);}return _0x5c0be1[_0x29d2('0x55')](_0x34b8c1);}})[_0x29d2('0x19')](function(_0xa2b42a){if(_0xa2b42a){return _0xa2b42a?{'count':_0x1fcc10,'rows':_0xa2b42a}:null;}})['then'](respondWithResult(_0x44dedc,null))['catch'](handleError(_0x44dedc,null));};exports[_0x29d2('0x56')]=function(_0x506dd5,_0x24cbad,_0x39cdc4){var _0x58bff6={};var _0x15a105={};var _0x50e8e2;var _0x3f3715;return db[_0x29d2('0x46')]['findOne']({'where':{'id':_0x506dd5[_0x29d2('0x4b')]['id']}})[_0x29d2('0x19')](handleEntityNotFound(_0x24cbad,null))[_0x29d2('0x19')](function(_0x188285){if(_0x188285){_0x50e8e2=_0x188285;_0x15a105[_0x29d2('0x35')]=_['keys'](db[_0x29d2('0x52')][_0x29d2('0x4c')]);_0x15a105['query']=_['keys'](_0x506dd5[_0x29d2('0x38')]);_0x15a105[_0x29d2('0x3a')]=_[_0x29d2('0x3b')](_0x15a105['model'],_0x15a105[_0x29d2('0x38')]);_0x58bff6[_0x29d2('0x3c')]=_[_0x29d2('0x3b')](_0x15a105[_0x29d2('0x35')],qs['fields'](_0x506dd5[_0x29d2('0x38')][_0x29d2('0x3d')]));_0x58bff6[_0x29d2('0x3c')]=_0x58bff6[_0x29d2('0x3c')][_0x29d2('0x3e')]?_0x58bff6[_0x29d2('0x3c')]:_0x15a105[_0x29d2('0x35')];_0x58bff6['order']=qs[_0x29d2('0x41')](_0x506dd5[_0x29d2('0x38')][_0x29d2('0x41')]);_0x58bff6[_0x29d2('0x42')]=qs[_0x29d2('0x3a')](_[_0x29d2('0x53')](_0x506dd5[_0x29d2('0x38')],_0x15a105[_0x29d2('0x3a')]));if(_0x506dd5[_0x29d2('0x38')][_0x29d2('0x43')]){_0x58bff6[_0x29d2('0x42')]=_[_0x29d2('0x4d')](_0x58bff6['where'],{'$or':_[_0x29d2('0x36')](_0x58bff6[_0x29d2('0x3c')],function(_0x3cdb44){var _0x33763c={};_0x33763c[_0x3cdb44]={'$like':'%'+_0x506dd5['query'][_0x29d2('0x43')]+'%'};return _0x33763c;})});}_0x58bff6=_[_0x29d2('0x4d')]({},_0x58bff6,_0x506dd5[_0x29d2('0x45')]);return _0x50e8e2[_0x29d2('0x56')](_0x58bff6);}})[_0x29d2('0x19')](function(_0x53b46d){if(_0x53b46d){_0x3f3715=_0x53b46d[_0x29d2('0x3e')];if(!_0x506dd5[_0x29d2('0x38')][_0x29d2('0x3f')](_0x29d2('0x54'))){_0x58bff6[_0x29d2('0x2a')]=qs[_0x29d2('0x2a')](_0x506dd5['query'][_0x29d2('0x2a')]);_0x58bff6['offset']=qs['offset'](_0x506dd5[_0x29d2('0x38')][_0x29d2('0x29')]);}return _0x50e8e2[_0x29d2('0x56')](_0x58bff6);}})[_0x29d2('0x19')](function(_0x4316f3){if(_0x4316f3){return _0x4316f3?{'count':_0x3f3715,'rows':_0x4316f3}:null;}})[_0x29d2('0x19')](respondWithResult(_0x24cbad,null))[_0x29d2('0x24')](handleError(_0x24cbad,null));};exports[_0x29d2('0x57')]=function(_0x18540d,_0x457095,_0x26c60e){var _0x47be1f={};var _0x26ad92={};var _0x31cdd8;var _0x2a08da;return db[_0x29d2('0x46')][_0x29d2('0x51')]({'where':{'id':_0x18540d[_0x29d2('0x4b')]['id']}})[_0x29d2('0x19')](handleEntityNotFound(_0x457095,null))[_0x29d2('0x19')](function(_0x4b977c){if(_0x4b977c){_0x31cdd8=_0x4b977c;_0x26ad92[_0x29d2('0x35')]=_[_0x29d2('0x39')](db[_0x29d2('0x52')][_0x29d2('0x4c')]);_0x26ad92[_0x29d2('0x38')]=_[_0x29d2('0x39')](_0x18540d[_0x29d2('0x38')]);_0x26ad92[_0x29d2('0x3a')]=_[_0x29d2('0x3b')](_0x26ad92[_0x29d2('0x35')],_0x26ad92[_0x29d2('0x38')]);_0x47be1f['attributes']=_[_0x29d2('0x3b')](_0x26ad92[_0x29d2('0x35')],qs[_0x29d2('0x3d')](_0x18540d[_0x29d2('0x38')]['fields']));_0x47be1f[_0x29d2('0x3c')]=_0x47be1f[_0x29d2('0x3c')]['length']?_0x47be1f[_0x29d2('0x3c')]:_0x26ad92['model'];_0x47be1f[_0x29d2('0x40')]=qs['sort'](_0x18540d[_0x29d2('0x38')][_0x29d2('0x41')]);_0x47be1f[_0x29d2('0x42')]=qs[_0x29d2('0x3a')](_[_0x29d2('0x53')](_0x18540d['query'],_0x26ad92[_0x29d2('0x3a')]));if(_0x18540d[_0x29d2('0x38')][_0x29d2('0x43')]){_0x47be1f['where']=_[_0x29d2('0x4d')](_0x47be1f[_0x29d2('0x42')],{'$or':_[_0x29d2('0x36')](_0x47be1f[_0x29d2('0x3c')],function(_0x4fcd89){var _0x545c81={};_0x545c81[_0x4fcd89]={'$like':'%'+_0x18540d[_0x29d2('0x38')][_0x29d2('0x43')]+'%'};return _0x545c81;})});}_0x47be1f=_[_0x29d2('0x4d')]({},_0x47be1f,_0x18540d[_0x29d2('0x45')]);return _0x31cdd8[_0x29d2('0x57')](_0x47be1f);}})['then'](function(_0x1d7933){if(_0x1d7933){_0x2a08da=_0x1d7933[_0x29d2('0x3e')];if(!_0x18540d[_0x29d2('0x38')][_0x29d2('0x3f')]('nolimit')){_0x47be1f[_0x29d2('0x2a')]=qs[_0x29d2('0x2a')](_0x18540d[_0x29d2('0x38')][_0x29d2('0x2a')]);_0x47be1f['offset']=qs[_0x29d2('0x29')](_0x18540d[_0x29d2('0x38')]['offset']);}return _0x31cdd8[_0x29d2('0x57')](_0x47be1f);}})[_0x29d2('0x19')](function(_0x8c0080){if(_0x8c0080){return _0x8c0080?{'count':_0x2a08da,'rows':_0x8c0080}:null;}})[_0x29d2('0x19')](respondWithResult(_0x457095,null))[_0x29d2('0x24')](handleError(_0x457095,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 8882a14..ed110f3 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 _0x3418=['../../config/environment','./intSalesforceConfiguration.attributes','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x3418,0x9e));var _0x8341=function(_0x45ff26,_0x1594ff){_0x45ff26=_0x45ff26-0x0;var _0xac6c10=_0x3418[_0x45ff26];return _0xac6c10;};'use strict';var _=require(_0x8341('0x0'));var util=require(_0x8341('0x1'));var logger=require(_0x8341('0x2'))('api');var moment=require(_0x8341('0x3'));var BPromise=require('bluebird');var rp=require(_0x8341('0x4'));var fs=require('fs');var path=require(_0x8341('0x5'));var rimraf=require(_0x8341('0x6'));var config=require(_0x8341('0x7'));var attributes=require(_0x8341('0x8'));module['exports']=function(_0x441b7b,_0x50d5a7){return _0x441b7b['define'](_0x8341('0x9'),attributes,{'tableName':_0x8341('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2754=['../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','int_salesforce_configurations','lodash','util'];(function(_0x1e5adb,_0x1b7a61){var _0x1af18d=function(_0x33a3cc){while(--_0x33a3cc){_0x1e5adb['push'](_0x1e5adb['shift']());}};_0x1af18d(++_0x1b7a61);}(_0x2754,0x148));var _0x4275=function(_0x30755e,_0x4d06f8){_0x30755e=_0x30755e-0x0;var _0x3ef4b1=_0x2754[_0x30755e];return _0x3ef4b1;};'use strict';var _=require(_0x4275('0x0'));var util=require(_0x4275('0x1'));var logger=require(_0x4275('0x2'))('api');var moment=require(_0x4275('0x3'));var BPromise=require(_0x4275('0x4'));var rp=require(_0x4275('0x5'));var fs=require('fs');var path=require(_0x4275('0x6'));var rimraf=require(_0x4275('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module[_0x4275('0x8')]=function(_0x415057,_0x5e5f14){return _0x415057[_0x4275('0x9')]('SalesforceConfiguration',attributes,{'tableName':_0x4275('0xa'),'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 a6849ef..589554c 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 _0xe64f=['../../config/environment','jayson/promise','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3ddb79,_0x145305){var _0x845f29=function(_0x327790){while(--_0x327790){_0x3ddb79['push'](_0x3ddb79['shift']());}};_0x845f29(++_0x145305);}(_0xe64f,0x1b8));var _0xfe64=function(_0x32630a,_0x2a469f){_0x32630a=_0x32630a-0x0;var _0x5cefec=_0xe64f[_0x32630a];return _0x5cefec;};'use strict';var _=require(_0xfe64('0x0'));var util=require(_0xfe64('0x1'));var moment=require(_0xfe64('0x2'));var BPromise=require(_0xfe64('0x3'));var rs=require(_0xfe64('0x4'));var fs=require('fs');var Redis=require(_0xfe64('0x5'));var db=require(_0xfe64('0x6'))['db'];var utils=require(_0xfe64('0x7'));var logger=require(_0xfe64('0x8'))(_0xfe64('0x9'));var config=require(_0xfe64('0xa'));var jayson=require(_0xfe64('0xb'));var client=jayson[_0xfe64('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0xab5f63,_0x37986c,_0x3177dc){return new BPromise(function(_0x352c3b,_0x57a715){return client[_0xfe64('0xd')](_0xab5f63,_0x3177dc)[_0xfe64('0xe')](function(_0x4741c6){logger[_0xfe64('0xf')](_0xfe64('0x10'),_0x37986c,_0xfe64('0x11'));logger[_0xfe64('0x12')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x37986c,_0xfe64('0x11'),JSON[_0xfe64('0x13')](_0x4741c6));if(_0x4741c6[_0xfe64('0x14')]){if(_0x4741c6[_0xfe64('0x14')][_0xfe64('0x15')]===0x1f4){logger[_0xfe64('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x37986c,_0x4741c6[_0xfe64('0x14')]['message']);return _0x57a715(_0x4741c6[_0xfe64('0x14')]['message']);}logger[_0xfe64('0x14')](_0xfe64('0x10'),_0x37986c,_0x4741c6[_0xfe64('0x14')][_0xfe64('0x16')]);return _0x352c3b(_0x4741c6[_0xfe64('0x14')][_0xfe64('0x16')]);}else{logger[_0xfe64('0xf')](_0xfe64('0x10'),_0x37986c,_0xfe64('0x11'));_0x352c3b(_0x4741c6[_0xfe64('0x17')][_0xfe64('0x16')]);}})[_0xfe64('0x18')](function(_0x1937ef){logger[_0xfe64('0x14')](_0xfe64('0x10'),_0x37986c,_0x1937ef);_0x57a715(_0x1937ef);});});} \ No newline at end of file +var _0x5ce7=['http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0x5ce7,0x110));var _0x75ce=function(_0x4e8022,_0x53229d){_0x4e8022=_0x4e8022-0x0;var _0xf5e73f=_0x5ce7[_0x4e8022];return _0xf5e73f;};'use strict';var _=require(_0x75ce('0x0'));var util=require(_0x75ce('0x1'));var moment=require(_0x75ce('0x2'));var BPromise=require(_0x75ce('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75ce('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x75ce('0x5'))(_0x75ce('0x6'));var config=require('../../config/environment');var jayson=require(_0x75ce('0x7'));var client=jayson['client'][_0x75ce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c0309,_0x5c4b51,_0x18fc6b){return new BPromise(function(_0x46a1be,_0x5c72a0){return client[_0x75ce('0x9')](_0x1c0309,_0x18fc6b)[_0x75ce('0xa')](function(_0x2c8618){logger[_0x75ce('0xb')](_0x75ce('0xc'),_0x5c4b51,_0x75ce('0xd'));logger['debug'](_0x75ce('0xe'),_0x5c4b51,'request\x20sent',JSON['stringify'](_0x2c8618));if(_0x2c8618[_0x75ce('0xf')]){if(_0x2c8618[_0x75ce('0xf')][_0x75ce('0x10')]===0x1f4){logger[_0x75ce('0xf')](_0x75ce('0xc'),_0x5c4b51,_0x2c8618['error'][_0x75ce('0x11')]);return _0x5c72a0(_0x2c8618[_0x75ce('0xf')][_0x75ce('0x11')]);}logger['error'](_0x75ce('0xc'),_0x5c4b51,_0x2c8618[_0x75ce('0xf')][_0x75ce('0x11')]);return _0x46a1be(_0x2c8618[_0x75ce('0xf')]['message']);}else{logger[_0x75ce('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5c4b51,_0x75ce('0xd'));_0x46a1be(_0x2c8618[_0x75ce('0x12')]['message']);}})[_0x75ce('0x13')](function(_0x414708){logger['error'](_0x75ce('0xc'),_0x5c4b51,_0x414708);_0x5c72a0(_0x414708);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 7204065..4284cb6 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 _0xe14b=['show','put','update','destroy','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x20e307,_0x58d17c){var _0x2f3b1a=function(_0x3774ab){while(--_0x3774ab){_0x20e307['push'](_0x20e307['shift']());}};_0x2f3b1a(++_0x58d17c);}(_0xe14b,0x93));var _0xbe14=function(_0x31a4e0,_0x5758bd){_0x31a4e0=_0x31a4e0-0x0;var _0xeff1bd=_0xe14b[_0x31a4e0];return _0xeff1bd;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe14('0x4'));var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router[_0xbe14('0x5')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x7')]);router[_0xbe14('0x5')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xbe14('0xa')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xb')]);router['delete']('/:id',auth[_0xbe14('0x6')](),controller[_0xbe14('0xc')]);module['exports']=router; \ No newline at end of file +var _0xcd59=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceField.controller'];(function(_0xd5f774,_0x1dd36e){var _0x49da10=function(_0x540221){while(--_0x540221){_0xd5f774['push'](_0xd5f774['shift']());}};_0x49da10(++_0x1dd36e);}(_0xcd59,0x14b));var _0x9cd5=function(_0xa1e2fd,_0x1c9305){_0xa1e2fd=_0xa1e2fd-0x0;var _0x218880=_0xcd59[_0xa1e2fd];return _0x218880;};'use strict';var multer=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var path=require(_0x9cd5('0x2'));var timeout=require(_0x9cd5('0x3'));var express=require(_0x9cd5('0x4'));var router=express[_0x9cd5('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9cd5('0x6'));var config=require(_0x9cd5('0x7'));var controller=require(_0x9cd5('0x8'));router[_0x9cd5('0x9')]('/',auth[_0x9cd5('0xa')](),controller[_0x9cd5('0xb')]);router[_0x9cd5('0x9')](_0x9cd5('0xc'),auth[_0x9cd5('0xa')](),controller[_0x9cd5('0xd')]);router['post']('/',auth[_0x9cd5('0xa')](),controller[_0x9cd5('0xe')]);router[_0x9cd5('0xf')](_0x9cd5('0xc'),auth[_0x9cd5('0xa')](),controller[_0x9cd5('0x10')]);router[_0x9cd5('0x11')](_0x9cd5('0xc'),auth['isAuthenticated'](),controller[_0x9cd5('0x12')]);module[_0x9cd5('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 404522a..53546e6 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 _0xc5eb=['string','variable','keyValue','STRING','customVariable','exports','ENUM'];(function(_0x152678,_0x11e0ac){var _0x311a9=function(_0x4f5291){while(--_0x4f5291){_0x152678['push'](_0x152678['shift']());}};_0x311a9(++_0x11e0ac);}(_0xc5eb,0xe5));var _0xbc5e=function(_0x3a2323,_0x15eeee){_0x3a2323=_0x3a2323-0x0;var _0x275c27=_0xc5eb[_0x3a2323];return _0x275c27;};'use strict';var Sequelize=require('sequelize');module[_0xbc5e('0x0')]={'type':{'type':Sequelize[_0xbc5e('0x1')](_0xbc5e('0x2'),_0xbc5e('0x3'),'customVariable',_0xbc5e('0x4')),'defaultValue':_0xbc5e('0x2')},'content':{'type':Sequelize[_0xbc5e('0x5')]},'key':{'type':Sequelize[_0xbc5e('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xbc5e('0x2'),_0xbc5e('0x3'),_0xbc5e('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xbc5e('0x5')]},'variableName':{'type':Sequelize[_0xbc5e('0x5')]}}; \ No newline at end of file +var _0x581d=['string','variable','keyValue','STRING','customVariable','sequelize','exports','ENUM'];(function(_0x17f344,_0xa09d21){var _0x38bd16=function(_0x533cfc){while(--_0x533cfc){_0x17f344['push'](_0x17f344['shift']());}};_0x38bd16(++_0xa09d21);}(_0x581d,0x18d));var _0xd581=function(_0x576b10,_0x4644d8){_0x576b10=_0x576b10-0x0;var _0x225613=_0x581d[_0x576b10];return _0x225613;};'use strict';var Sequelize=require(_0xd581('0x0'));module[_0xd581('0x1')]={'type':{'type':Sequelize[_0xd581('0x2')](_0xd581('0x3'),_0xd581('0x4'),'customVariable',_0xd581('0x5')),'defaultValue':_0xd581('0x3')},'content':{'type':Sequelize[_0xd581('0x6')]},'key':{'type':Sequelize[_0xd581('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xd581('0x4'),_0xd581('0x7'))},'keyContent':{'type':Sequelize[_0xd581('0x6')]},'idField':{'type':Sequelize[_0xd581('0x6')]},'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 5a156be..7f41cb8 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 _0x59a9=['model','map','query','keys','attributes','fields','length','hasOwnProperty','sort','pick','filters','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','intersection','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','error','stack','name','send','SalesforceField','rawAttributes','fieldName','type'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x59a9,0xed));var _0x959a=function(_0xfd0f45,_0x15a17c){_0xfd0f45=_0xfd0f45-0x0;var _0x477156=_0x59a9[_0xfd0f45];return _0x477156;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x959a('0x0'));var rimraf=require(_0x959a('0x1'));var zipdir=require(_0x959a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x959a('0x3'));var moment=require(_0x959a('0x4'));var BPromise=require(_0x959a('0x5'));var Mustache=require(_0x959a('0x6'));var util=require(_0x959a('0x7'));var path=require('path');var sox=require(_0x959a('0x8'));var csv=require(_0x959a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x959a('0xa'));var jsforce=require(_0x959a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x959a('0x9'));var querystring=require(_0x959a('0xc'));var Papa=require(_0x959a('0xd'));var Redis=require(_0x959a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x959a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x959a('0x10'));var logger=require('../../config/logger')(_0x959a('0x11'));var utils=require(_0x959a('0x12'));var config=require(_0x959a('0x13'));var licenseUtil=require(_0x959a('0x14'));var db=require(_0x959a('0x15'))['db'];function respondWithStatusCode(_0x252c2f,_0x278c52){_0x278c52=_0x278c52||0xcc;return function(_0x1d0846){if(_0x1d0846){return _0x252c2f[_0x959a('0x16')](_0x278c52);}return _0x252c2f[_0x959a('0x17')](_0x278c52)[_0x959a('0x18')]();};}function respondWithResult(_0x29d8c5,_0x136fdd){_0x136fdd=_0x136fdd||0xc8;return function(_0x2821f2){if(_0x2821f2){return _0x29d8c5[_0x959a('0x17')](_0x136fdd)[_0x959a('0x19')](_0x2821f2);}};}function respondWithFilteredResult(_0xc5caeb,_0x5b8f7b){return function(_0x1778ac){if(_0x1778ac){var _0x568103=_0x1778ac[_0x959a('0x1a')],_0x52e4f9=_0x5b8f7b[_0x959a('0x1b')],_0x856a65=_0x5b8f7b[_0x959a('0x1b')]+_0x5b8f7b[_0x959a('0x1c')],_0xdbddc6;if(_0x856a65>=_0x568103){_0x856a65=_0x568103;_0xdbddc6=0xc8;}else{_0xdbddc6=0xce;}_0xc5caeb[_0x959a('0x17')](_0xdbddc6);return _0xc5caeb[_0x959a('0x1d')]('Content-Range',_0x52e4f9+'-'+_0x856a65+'/'+_0x568103)[_0x959a('0x19')](_0x1778ac);}return null;};}function patchUpdates(_0x545b50){return function(_0x1ce9f2){try{jsonpatch[_0x959a('0x1e')](_0x1ce9f2,_0x545b50,!![]);}catch(_0x567b9d){return BPromise[_0x959a('0x1f')](_0x567b9d);}return _0x1ce9f2['save']();};}function saveUpdates(_0x31c6c2,_0xf011b1){return function(_0x2b9a22){if(_0x2b9a22){return _0x2b9a22[_0x959a('0x20')](_0x31c6c2)[_0x959a('0x21')](function(_0x19c1d8){return _0x19c1d8;});}return null;};}function removeEntity(_0x18d408,_0x1a3b06){return function(_0x1d977e){if(_0x1d977e){return _0x1d977e[_0x959a('0x22')]()[_0x959a('0x21')](function(){_0x18d408['status'](0xcc)[_0x959a('0x18')]();});}};}function handleEntityNotFound(_0x33eddf,_0x594cba){return function(_0x3e59c0){if(!_0x3e59c0){_0x33eddf['sendStatus'](0x194);}return _0x3e59c0;};}function handleError(_0x20a378,_0x27269d){_0x27269d=_0x27269d||0x1f4;return function(_0x270f82){logger[_0x959a('0x23')](_0x270f82[_0x959a('0x24')]);if(_0x270f82[_0x959a('0x25')]){delete _0x270f82[_0x959a('0x25')];}_0x20a378['status'](_0x27269d)[_0x959a('0x26')](_0x270f82);};}exports['index']=function(_0x4a4a7d,_0x1c1bc8){var _0x491a2c={},_0x303897={},_0x1a4970={'count':0x0,'rows':[]};var _0x22eed3=_['map'](db[_0x959a('0x27')][_0x959a('0x28')],function(_0x4de631){return{'name':_0x4de631[_0x959a('0x29')],'type':_0x4de631[_0x959a('0x2a')]['key']};});_0x303897[_0x959a('0x2b')]=_[_0x959a('0x2c')](_0x22eed3,_0x959a('0x25'));_0x303897[_0x959a('0x2d')]=_[_0x959a('0x2e')](_0x4a4a7d[_0x959a('0x2d')]);_0x303897['filters']=_['intersection'](_0x303897[_0x959a('0x2b')],_0x303897[_0x959a('0x2d')]);_0x491a2c[_0x959a('0x2f')]=_['intersection'](_0x303897[_0x959a('0x2b')],qs[_0x959a('0x30')](_0x4a4a7d[_0x959a('0x2d')][_0x959a('0x30')]));_0x491a2c['attributes']=_0x491a2c[_0x959a('0x2f')][_0x959a('0x31')]?_0x491a2c[_0x959a('0x2f')]:_0x303897[_0x959a('0x2b')];if(!_0x4a4a7d['query'][_0x959a('0x32')]('nolimit')){_0x491a2c['limit']=qs[_0x959a('0x1c')](_0x4a4a7d['query']['limit']);_0x491a2c['offset']=qs['offset'](_0x4a4a7d[_0x959a('0x2d')]['offset']);}_0x491a2c['order']=qs[_0x959a('0x33')](_0x4a4a7d[_0x959a('0x2d')][_0x959a('0x33')]);_0x491a2c['where']=qs['filters'](_[_0x959a('0x34')](_0x4a4a7d['query'],_0x303897[_0x959a('0x35')]),_0x22eed3);if(_0x4a4a7d['query'][_0x959a('0x36')]){_0x491a2c[_0x959a('0x37')]=_[_0x959a('0x38')](_0x491a2c[_0x959a('0x37')],{'$or':_[_0x959a('0x2c')](_0x22eed3,function(_0x1d3788){if(_0x1d3788[_0x959a('0x2a')]!==_0x959a('0x39')){var _0x41a8ae={};_0x41a8ae[_0x1d3788[_0x959a('0x25')]]={'$like':'%'+_0x4a4a7d['query'][_0x959a('0x36')]+'%'};return _0x41a8ae;}})});}_0x491a2c=_['merge']({},_0x491a2c,_0x4a4a7d[_0x959a('0x3a')]);var _0x275d4a={'where':_0x491a2c[_0x959a('0x37')]};return db[_0x959a('0x27')]['count'](_0x275d4a)['then'](function(_0x346609){_0x1a4970['count']=_0x346609;if(_0x4a4a7d[_0x959a('0x2d')]['includeAll']){_0x491a2c[_0x959a('0x3b')]=[{'all':!![]}];}return db[_0x959a('0x27')][_0x959a('0x3c')](_0x491a2c);})[_0x959a('0x21')](function(_0x50c61b){_0x1a4970[_0x959a('0x3d')]=_0x50c61b;return _0x1a4970;})[_0x959a('0x21')](respondWithFilteredResult(_0x1c1bc8,_0x491a2c))[_0x959a('0x3e')](handleError(_0x1c1bc8,null));};exports[_0x959a('0x3f')]=function(_0x3f8a48,_0x46c36b){var _0x984e81={'raw':!![],'where':{'id':_0x3f8a48[_0x959a('0x40')]['id']}},_0x1fd63c={};_0x1fd63c['model']=_['keys'](db[_0x959a('0x27')]['rawAttributes']);_0x1fd63c['query']=_[_0x959a('0x2e')](_0x3f8a48[_0x959a('0x2d')]);_0x1fd63c[_0x959a('0x35')]=_[_0x959a('0x41')](_0x1fd63c[_0x959a('0x2b')],_0x1fd63c[_0x959a('0x2d')]);_0x984e81[_0x959a('0x2f')]=_[_0x959a('0x41')](_0x1fd63c['model'],qs[_0x959a('0x30')](_0x3f8a48[_0x959a('0x2d')][_0x959a('0x30')]));_0x984e81[_0x959a('0x2f')]=_0x984e81[_0x959a('0x2f')]['length']?_0x984e81[_0x959a('0x2f')]:_0x1fd63c['model'];if(_0x3f8a48[_0x959a('0x2d')][_0x959a('0x42')]){_0x984e81[_0x959a('0x3b')]=[{'all':!![]}];}_0x984e81=_[_0x959a('0x38')]({},_0x984e81,_0x3f8a48[_0x959a('0x3a')]);return db['SalesforceField'][_0x959a('0x43')](_0x984e81)[_0x959a('0x21')](handleEntityNotFound(_0x46c36b,null))[_0x959a('0x21')](respondWithResult(_0x46c36b,null))[_0x959a('0x3e')](handleError(_0x46c36b,null));};exports[_0x959a('0x44')]=function(_0x11a70a,_0x182f72){return db['SalesforceField'][_0x959a('0x44')](_0x11a70a['body'],{})[_0x959a('0x21')](respondWithResult(_0x182f72,0xc9))[_0x959a('0x3e')](handleError(_0x182f72,null));};exports[_0x959a('0x20')]=function(_0x1cb709,_0x4f57a2){if(_0x1cb709[_0x959a('0x45')]['id']){delete _0x1cb709[_0x959a('0x45')]['id'];}return db['SalesforceField'][_0x959a('0x43')]({'where':{'id':_0x1cb709[_0x959a('0x40')]['id']}})['then'](handleEntityNotFound(_0x4f57a2,null))[_0x959a('0x21')](saveUpdates(_0x1cb709[_0x959a('0x45')],null))[_0x959a('0x21')](respondWithResult(_0x4f57a2,null))['catch'](handleError(_0x4f57a2,null));};exports['destroy']=function(_0x41a15d,_0x2e5043){return db[_0x959a('0x27')]['find']({'where':{'id':_0x41a15d[_0x959a('0x40')]['id']}})[_0x959a('0x21')](handleEntityNotFound(_0x2e5043,null))['then'](removeEntity(_0x2e5043,null))['catch'](handleError(_0x2e5043,null));}; \ No newline at end of file +var _0x5065=['end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','SalesforceField','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','status'];(function(_0x40a816,_0x1b5043){var _0xd3ce15=function(_0x38d825){while(--_0x38d825){_0x40a816['push'](_0x40a816['shift']());}};_0xd3ce15(++_0x1b5043);}(_0x5065,0x107));var _0x5506=function(_0x56bff3,_0x108f4f){_0x56bff3=_0x56bff3-0x0;var _0xec8d8b=_0x5065[_0x56bff3];return _0xec8d8b;};'use strict';var pdf=require(_0x5506('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5506('0x1'));var zipdir=require(_0x5506('0x2'));var jsonpatch=require(_0x5506('0x3'));var rp=require(_0x5506('0x4'));var moment=require(_0x5506('0x5'));var BPromise=require(_0x5506('0x6'));var Mustache=require(_0x5506('0x7'));var util=require('util');var path=require('path');var sox=require(_0x5506('0x8'));var csv=require(_0x5506('0x9'));var ejs=require(_0x5506('0xa'));var fs=require('fs');var _=require(_0x5506('0xb'));var squel=require(_0x5506('0xc'));var crypto=require('crypto');var jsforce=require(_0x5506('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5506('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5506('0xe'));var authService=require(_0x5506('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5506('0x10'));var logger=require(_0x5506('0x11'))(_0x5506('0x12'));var utils=require('../../config/utils');var config=require(_0x5506('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x303738,_0x4062bc){_0x4062bc=_0x4062bc||0xcc;return function(_0x2d7da8){if(_0x2d7da8){return _0x303738['sendStatus'](_0x4062bc);}return _0x303738[_0x5506('0x14')](_0x4062bc)[_0x5506('0x15')]();};}function respondWithResult(_0x2fed0b,_0x2f9581){_0x2f9581=_0x2f9581||0xc8;return function(_0x24ec2b){if(_0x24ec2b){return _0x2fed0b[_0x5506('0x14')](_0x2f9581)[_0x5506('0x16')](_0x24ec2b);}};}function respondWithFilteredResult(_0x1ba8df,_0x1438b0){return function(_0xb65d60){if(_0xb65d60){var _0x5f4508=_0xb65d60[_0x5506('0x17')],_0x9d3ac4=_0x1438b0[_0x5506('0x18')],_0x4eff02=_0x1438b0['offset']+_0x1438b0[_0x5506('0x19')],_0x11e20c;if(_0x4eff02>=_0x5f4508){_0x4eff02=_0x5f4508;_0x11e20c=0xc8;}else{_0x11e20c=0xce;}_0x1ba8df[_0x5506('0x14')](_0x11e20c);return _0x1ba8df[_0x5506('0x1a')](_0x5506('0x1b'),_0x9d3ac4+'-'+_0x4eff02+'/'+_0x5f4508)[_0x5506('0x16')](_0xb65d60);}return null;};}function patchUpdates(_0x48f2ff){return function(_0x3e44cd){try{jsonpatch[_0x5506('0x1c')](_0x3e44cd,_0x48f2ff,!![]);}catch(_0x21c307){return BPromise['reject'](_0x21c307);}return _0x3e44cd[_0x5506('0x1d')]();};}function saveUpdates(_0x589f0d,_0x58a726){return function(_0x5d3220){if(_0x5d3220){return _0x5d3220[_0x5506('0x1e')](_0x589f0d)[_0x5506('0x1f')](function(_0x4401e4){return _0x4401e4;});}return null;};}function removeEntity(_0x124c1c,_0x425715){return function(_0x4b2e6a){if(_0x4b2e6a){return _0x4b2e6a[_0x5506('0x20')]()['then'](function(){_0x124c1c[_0x5506('0x14')](0xcc)[_0x5506('0x15')]();});}};}function handleEntityNotFound(_0x3dd38d,_0x51a2b2){return function(_0x39e763){if(!_0x39e763){_0x3dd38d[_0x5506('0x21')](0x194);}return _0x39e763;};}function handleError(_0x4b564c,_0x4bb2f6){_0x4bb2f6=_0x4bb2f6||0x1f4;return function(_0x1db541){logger[_0x5506('0x22')](_0x1db541[_0x5506('0x23')]);if(_0x1db541['name']){delete _0x1db541[_0x5506('0x24')];}_0x4b564c['status'](_0x4bb2f6)[_0x5506('0x25')](_0x1db541);};}exports[_0x5506('0x26')]=function(_0x157415,_0x24679f){var _0x1ee9fa={},_0x13f118={},_0x26e5bb={'count':0x0,'rows':[]};var _0x5c3b43=_['map'](db[_0x5506('0x27')][_0x5506('0x28')],function(_0x51f6c4){return{'name':_0x51f6c4[_0x5506('0x29')],'type':_0x51f6c4['type'][_0x5506('0x2a')]};});_0x13f118[_0x5506('0x2b')]=_[_0x5506('0x2c')](_0x5c3b43,_0x5506('0x24'));_0x13f118[_0x5506('0x2d')]=_['keys'](_0x157415[_0x5506('0x2d')]);_0x13f118[_0x5506('0x2e')]=_[_0x5506('0x2f')](_0x13f118[_0x5506('0x2b')],_0x13f118[_0x5506('0x2d')]);_0x1ee9fa[_0x5506('0x30')]=_[_0x5506('0x2f')](_0x13f118[_0x5506('0x2b')],qs['fields'](_0x157415[_0x5506('0x2d')][_0x5506('0x31')]));_0x1ee9fa['attributes']=_0x1ee9fa[_0x5506('0x30')][_0x5506('0x32')]?_0x1ee9fa[_0x5506('0x30')]:_0x13f118['model'];if(!_0x157415[_0x5506('0x2d')][_0x5506('0x33')](_0x5506('0x34'))){_0x1ee9fa[_0x5506('0x19')]=qs[_0x5506('0x19')](_0x157415[_0x5506('0x2d')][_0x5506('0x19')]);_0x1ee9fa[_0x5506('0x18')]=qs['offset'](_0x157415[_0x5506('0x2d')]['offset']);}_0x1ee9fa['order']=qs[_0x5506('0x35')](_0x157415[_0x5506('0x2d')]['sort']);_0x1ee9fa[_0x5506('0x36')]=qs['filters'](_[_0x5506('0x37')](_0x157415[_0x5506('0x2d')],_0x13f118[_0x5506('0x2e')]),_0x5c3b43);if(_0x157415['query'][_0x5506('0x38')]){_0x1ee9fa[_0x5506('0x36')]=_[_0x5506('0x39')](_0x1ee9fa[_0x5506('0x36')],{'$or':_[_0x5506('0x2c')](_0x5c3b43,function(_0x5e0adc){if(_0x5e0adc[_0x5506('0x3a')]!==_0x5506('0x3b')){var _0x1cad48={};_0x1cad48[_0x5e0adc[_0x5506('0x24')]]={'$like':'%'+_0x157415[_0x5506('0x2d')][_0x5506('0x38')]+'%'};return _0x1cad48;}})});}_0x1ee9fa=_[_0x5506('0x39')]({},_0x1ee9fa,_0x157415[_0x5506('0x3c')]);var _0x4b9204={'where':_0x1ee9fa[_0x5506('0x36')]};return db[_0x5506('0x27')][_0x5506('0x17')](_0x4b9204)[_0x5506('0x1f')](function(_0x31c0a7){_0x26e5bb[_0x5506('0x17')]=_0x31c0a7;if(_0x157415['query'][_0x5506('0x3d')]){_0x1ee9fa[_0x5506('0x3e')]=[{'all':!![]}];}return db[_0x5506('0x27')][_0x5506('0x3f')](_0x1ee9fa);})[_0x5506('0x1f')](function(_0x2c5f3d){_0x26e5bb['rows']=_0x2c5f3d;return _0x26e5bb;})['then'](respondWithFilteredResult(_0x24679f,_0x1ee9fa))[_0x5506('0x40')](handleError(_0x24679f,null));};exports[_0x5506('0x41')]=function(_0x793084,_0x9b8b0c){var _0x54d5d0={'raw':!![],'where':{'id':_0x793084[_0x5506('0x42')]['id']}},_0x43e507={};_0x43e507[_0x5506('0x2b')]=_['keys'](db[_0x5506('0x27')][_0x5506('0x28')]);_0x43e507['query']=_[_0x5506('0x43')](_0x793084[_0x5506('0x2d')]);_0x43e507[_0x5506('0x2e')]=_[_0x5506('0x2f')](_0x43e507[_0x5506('0x2b')],_0x43e507[_0x5506('0x2d')]);_0x54d5d0[_0x5506('0x30')]=_['intersection'](_0x43e507['model'],qs[_0x5506('0x31')](_0x793084[_0x5506('0x2d')]['fields']));_0x54d5d0['attributes']=_0x54d5d0[_0x5506('0x30')][_0x5506('0x32')]?_0x54d5d0[_0x5506('0x30')]:_0x43e507[_0x5506('0x2b')];if(_0x793084['query'][_0x5506('0x3d')]){_0x54d5d0[_0x5506('0x3e')]=[{'all':!![]}];}_0x54d5d0=_[_0x5506('0x39')]({},_0x54d5d0,_0x793084[_0x5506('0x3c')]);return db[_0x5506('0x27')][_0x5506('0x44')](_0x54d5d0)[_0x5506('0x1f')](handleEntityNotFound(_0x9b8b0c,null))[_0x5506('0x1f')](respondWithResult(_0x9b8b0c,null))[_0x5506('0x40')](handleError(_0x9b8b0c,null));};exports[_0x5506('0x45')]=function(_0x548c57,_0x57d727){return db['SalesforceField']['create'](_0x548c57[_0x5506('0x46')],{})[_0x5506('0x1f')](respondWithResult(_0x57d727,0xc9))['catch'](handleError(_0x57d727,null));};exports['update']=function(_0x2f09dd,_0x4826c8){if(_0x2f09dd[_0x5506('0x46')]['id']){delete _0x2f09dd[_0x5506('0x46')]['id'];}return db[_0x5506('0x27')]['find']({'where':{'id':_0x2f09dd['params']['id']}})[_0x5506('0x1f')](handleEntityNotFound(_0x4826c8,null))['then'](saveUpdates(_0x2f09dd[_0x5506('0x46')],null))[_0x5506('0x1f')](respondWithResult(_0x4826c8,null))[_0x5506('0x40')](handleError(_0x4826c8,null));};exports[_0x5506('0x20')]=function(_0x36d4db,_0x29a2a2){return db[_0x5506('0x27')][_0x5506('0x44')]({'where':{'id':_0x36d4db[_0x5506('0x42')]['id']}})[_0x5506('0x1f')](handleEntityNotFound(_0x29a2a2,null))['then'](removeEntity(_0x29a2a2,null))[_0x5506('0x40')](handleError(_0x29a2a2,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 47a1d9f..1b6a57c 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 _0x0e85=['int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','api','moment','rimraf','./intSalesforceField.attributes','exports','SalesforceField'];(function(_0x333683,_0x2e51dc){var _0x570c76=function(_0x2b51a2){while(--_0x2b51a2){_0x333683['push'](_0x333683['shift']());}};_0x570c76(++_0x2e51dc);}(_0x0e85,0x7c));var _0x50e8=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x0e85[_0x344a3f];return _0x264712;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var logger=require('../../config/logger')(_0x50e8('0x2'));var moment=require(_0x50e8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x50e8('0x4'));var config=require('../../config/environment');var attributes=require(_0x50e8('0x5'));module[_0x50e8('0x6')]=function(_0xe3151e,_0xfde42){return _0xe3151e['define'](_0x50e8('0x7'),attributes,{'tableName':_0x50e8('0x8'),'paranoid':![],'indexes':[{'name':_0x50e8('0x9'),'fields':[_0x50e8('0xa'),_0x50e8('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4e40=['rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','lodash','util','api','moment','path'];(function(_0x570eb3,_0x53060b){var _0x4e6242=function(_0x29571f){while(--_0x29571f){_0x570eb3['push'](_0x570eb3['shift']());}};_0x4e6242(++_0x53060b);}(_0x4e40,0x1a8));var _0x04e4=function(_0x55b637,_0x425ec9){_0x55b637=_0x55b637-0x0;var _0x4b4828=_0x4e40[_0x55b637];return _0x4b4828;};'use strict';var _=require(_0x04e4('0x0'));var util=require(_0x04e4('0x1'));var logger=require('../../config/logger')(_0x04e4('0x2'));var moment=require(_0x04e4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x04e4('0x4'));var rimraf=require(_0x04e4('0x5'));var config=require(_0x04e4('0x6'));var attributes=require(_0x04e4('0x7'));module[_0x04e4('0x8')]=function(_0x5449cb,_0x548e85){return _0x5449cb[_0x04e4('0x9')](_0x04e4('0xa'),attributes,{'tableName':_0x04e4('0xb'),'paranoid':![],'indexes':[{'name':_0x04e4('0xc'),'fields':['idField','FieldId'],'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 c31182e..2f7e095 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 _0x750a=['error','code','SalesforceField,\x20%s,\x20%s','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify'];(function(_0x1c5e87,_0xb68d35){var _0x23329c=function(_0x4267f7){while(--_0x4267f7){_0x1c5e87['push'](_0x1c5e87['shift']());}};_0x23329c(++_0xb68d35);}(_0x750a,0x140));var _0xa750=function(_0x10862d,_0x5d1fbb){_0x10862d=_0x10862d-0x0;var _0x2390c5=_0x750a[_0x10862d];return _0x2390c5;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa750('0x1'));var fs=require('fs');var Redis=require(_0xa750('0x2'));var db=require(_0xa750('0x3'))['db'];var utils=require(_0xa750('0x4'));var logger=require(_0xa750('0x5'))(_0xa750('0x6'));var config=require(_0xa750('0x7'));var jayson=require(_0xa750('0x8'));var client=jayson[_0xa750('0x9')][_0xa750('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x197299,_0x1ae455,_0x3d7c43){return new BPromise(function(_0x47a4dd,_0x53f2cb){return client[_0xa750('0xb')](_0x197299,_0x3d7c43)['then'](function(_0x4458b1){logger[_0xa750('0xc')]('SalesforceField,\x20%s,\x20%s',_0x1ae455,_0xa750('0xd'));logger[_0xa750('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x1ae455,'request\x20sent',JSON[_0xa750('0xf')](_0x4458b1));if(_0x4458b1['error']){if(_0x4458b1[_0xa750('0x10')][_0xa750('0x11')]===0x1f4){logger['error'](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x53f2cb(_0x4458b1['error'][_0xa750('0x13')]);}logger[_0xa750('0x10')](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x47a4dd(_0x4458b1[_0xa750('0x10')]['message']);}else{logger[_0xa750('0xc')](_0xa750('0x12'),_0x1ae455,_0xa750('0xd'));_0x47a4dd(_0x4458b1['result'][_0xa750('0x13')]);}})[_0xa750('0x14')](function(_0x58639b){logger['error'](_0xa750('0x12'),_0x1ae455,_0x58639b);_0x53f2cb(_0x58639b);});});} \ No newline at end of file +var _0xb4e6=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x191b1a,_0x48e0e6){var _0x283089=function(_0x4f6574){while(--_0x4f6574){_0x191b1a['push'](_0x191b1a['shift']());}};_0x283089(++_0x48e0e6);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x54a2e4,_0x1ff92c){_0x54a2e4=_0x54a2e4-0x0;var _0x4742d0=_0xb4e6[_0x54a2e4];return _0x4742d0;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var moment=require(_0x6b4e('0x1'));var BPromise=require(_0x6b4e('0x2'));var rs=require(_0x6b4e('0x3'));var fs=require('fs');var Redis=require(_0x6b4e('0x4'));var db=require(_0x6b4e('0x5'))['db'];var utils=require(_0x6b4e('0x6'));var logger=require(_0x6b4e('0x7'))('rpc');var config=require(_0x6b4e('0x8'));var jayson=require(_0x6b4e('0x9'));var client=jayson[_0x6b4e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd3138f,_0x570346,_0x4f00be){return new BPromise(function(_0x2311d9,_0x48c870){return client['request'](_0xd3138f,_0x4f00be)[_0x6b4e('0xb')](function(_0x2bd576){logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));logger[_0x6b4e('0xf')](_0x6b4e('0x10'),_0x570346,'request\x20sent',JSON[_0x6b4e('0x11')](_0x2bd576));if(_0x2bd576[_0x6b4e('0x12')]){if(_0x2bd576['error'][_0x6b4e('0x13')]===0x1f4){logger[_0x6b4e('0x12')](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);return _0x48c870(_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);}logger['error'](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')]['message']);return _0x2311d9(_0x2bd576[_0x6b4e('0x12')]['message']);}else{logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));_0x2311d9(_0x2bd576[_0x6b4e('0x15')][_0x6b4e('0x14')]);}})[_0x6b4e('0x16')](function(_0x53a934){logger['error'](_0x6b4e('0xd'),_0x570346,_0x53a934);_0x48c870(_0x53a934);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index ff2a5ae..53c52d9 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 _0xefcf=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','index','isAuthenticated','show','get','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','/:id'];(function(_0x20620f,_0x37c815){var _0x593a2f=function(_0x25479a){while(--_0x25479a){_0x20620f['push'](_0x20620f['shift']());}};_0x593a2f(++_0x37c815);}(_0xefcf,0x184));var _0xfefc=function(_0x44508f,_0x3d2edc){_0x44508f=_0x44508f-0x0;var _0x3cc7b9=_0xefcf[_0x44508f];return _0x3cc7b9;};'use strict';var multer=require(_0xfefc('0x0'));var util=require(_0xfefc('0x1'));var path=require(_0xfefc('0x2'));var timeout=require(_0xfefc('0x3'));var express=require(_0xfefc('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfefc('0x5'));var config=require(_0xfefc('0x6'));var controller=require(_0xfefc('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xfefc('0x8')]);router['get']('/:id',auth[_0xfefc('0x9')](),controller[_0xfefc('0xa')]);router[_0xfefc('0xb')](_0xfefc('0xc'),auth[_0xfefc('0x9')](),controller[_0xfefc('0xd')]);router['get']('/:id/fields',auth[_0xfefc('0x9')](),controller[_0xfefc('0xe')]);router[_0xfefc('0xf')]('/',auth[_0xfefc('0x9')](),controller[_0xfefc('0x10')]);router[_0xfefc('0xf')](_0xfefc('0xc'),auth[_0xfefc('0x9')](),controller[_0xfefc('0x11')]);router[_0xfefc('0x12')](_0xfefc('0x13'),auth[_0xfefc('0x9')](),controller[_0xfefc('0x14')]);router[_0xfefc('0x15')]('/:id',auth[_0xfefc('0x9')](),controller[_0xfefc('0x16')]);module[_0xfefc('0x17')]=router; \ No newline at end of file +var _0x9823=['/:id/fields','getFields','create','/:id/configurations','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','/:id','show'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x9823,0xf8));var _0x3982=function(_0x20952d,_0x4eddd5){_0x20952d=_0x20952d-0x0;var _0x3b24d5=_0x9823[_0x20952d];return _0x3b24d5;};'use strict';var multer=require(_0x3982('0x0'));var util=require(_0x3982('0x1'));var path=require(_0x3982('0x2'));var timeout=require(_0x3982('0x3'));var express=require('express');var router=express[_0x3982('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3982('0x5'));var config=require(_0x3982('0x6'));var controller=require(_0x3982('0x7'));router[_0x3982('0x8')]('/',auth[_0x3982('0x9')](),controller['index']);router[_0x3982('0x8')](_0x3982('0xa'),auth['isAuthenticated'](),controller[_0x3982('0xb')]);router[_0x3982('0x8')]('/:id/configurations',auth[_0x3982('0x9')](),controller['getConfigurations']);router['get'](_0x3982('0xc'),auth['isAuthenticated'](),controller[_0x3982('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3982('0xe')]);router['post'](_0x3982('0xf'),auth[_0x3982('0x9')](),controller['addConfiguration']);router[_0x3982('0x10')]('/:id',auth[_0x3982('0x9')](),controller['update']);router[_0x3982('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3982('0x12')]);module[_0x3982('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 33e4066..b831308 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 _0x346c=['STRING','username','remoteUri','exports'];(function(_0x8ee843,_0x52d7c3){var _0x1915a3=function(_0x161fbb){while(--_0x161fbb){_0x8ee843['push'](_0x8ee843['shift']());}};_0x1915a3(++_0x52d7c3);}(_0x346c,0x1d3));var _0xc346=function(_0xf81b07,_0xfa7f2f){_0xf81b07=_0xf81b07-0x0;var _0x49389a=_0x346c[_0xf81b07];return _0x49389a;};'use strict';var Sequelize=require('sequelize');module[_0xc346('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc346('0x1')]},'username':{'type':Sequelize[_0xc346('0x1')],'unique':_0xc346('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc346('0x1')],'unique':_0xc346('0x3')},'serverUrl':{'type':Sequelize[_0xc346('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x94f7=['sequelize','exports','STRING','username','remoteUri'];(function(_0x7dbd65,_0x18da49){var _0x33d551=function(_0x7ce789){while(--_0x7ce789){_0x7dbd65['push'](_0x7dbd65['shift']());}};_0x33d551(++_0x18da49);}(_0x94f7,0x16d));var _0x794f=function(_0x424c3d,_0x477328){_0x424c3d=_0x424c3d-0x0;var _0x52f3a8=_0x94f7[_0x424c3d];return _0x52f3a8;};'use strict';var Sequelize=require(_0x794f('0x0'));module[_0x794f('0x1')]={'name':{'type':Sequelize[_0x794f('0x2')]},'description':{'type':Sequelize[_0x794f('0x2')]},'username':{'type':Sequelize[_0x794f('0x2')],'unique':_0x794f('0x3')},'password':{'type':Sequelize[_0x794f('0x2')]},'email':{'type':Sequelize[_0x794f('0x2')]},'remoteUri':{'type':Sequelize[_0x794f('0x2')],'unique':_0x794f('0x4')},'serverUrl':{'type':Sequelize[_0x794f('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 c14cdb4..b598063 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 _0x4831=['caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','close_notes','closed_by','parent_incident','sys_id','contact_type','problem_id','comments','sla_due','approval','comments_and_work_notes','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','username','log','assign','remove','includes','forEach','internalType','all','TCL:\x20_object','push','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','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','../../mysqldb','../../components/integrations/configuration','client','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','status','stack','name','send','index','map','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','ServicenowAccount','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','getConfigurations','findOne','ServicenowConfiguration','length','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','ServicenowField','made_sla','hold_reason','knowledge','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','approval_history','sys_updated_by','opened_by','user_input','sys_created_on','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','resolved_at'];(function(_0x4e17b5,_0x409f20){var _0x109223=function(_0x576512){while(--_0x576512){_0x4e17b5['push'](_0x4e17b5['shift']());}};_0x109223(++_0x409f20);}(_0x4831,0x103));var _0x1483=function(_0x15c351,_0x53237c){_0x15c351=_0x15c351-0x0;var _0x1b596a=_0x4831[_0x15c351];return _0x1b596a;};'use strict';var pdf=require(_0x1483('0x0'));var emlformat=require(_0x1483('0x1'));var rimraf=require(_0x1483('0x2'));var zipdir=require(_0x1483('0x3'));var jsonpatch=require(_0x1483('0x4'));var rp=require(_0x1483('0x5'));var moment=require(_0x1483('0x6'));var BPromise=require(_0x1483('0x7'));var Mustache=require(_0x1483('0x8'));var util=require(_0x1483('0x9'));var path=require(_0x1483('0xa'));var sox=require(_0x1483('0xb'));var csv=require('to-csv');var ejs=require(_0x1483('0xc'));var fs=require('fs');var _=require(_0x1483('0xd'));var squel=require(_0x1483('0xe'));var crypto=require(_0x1483('0xf'));var jsforce=require(_0x1483('0x10'));var deskjs=require(_0x1483('0x11'));var toCsv=require(_0x1483('0x12'));var querystring=require(_0x1483('0x13'));var Papa=require(_0x1483('0x14'));var Redis=require(_0x1483('0x15'));var authService=require(_0x1483('0x16'));var qs=require(_0x1483('0x17'));var as=require(_0x1483('0x18'));var hardwareService=require(_0x1483('0x19'));var logger=require(_0x1483('0x1a'))(_0x1483('0x1b'));var utils=require(_0x1483('0x1c'));var config=require(_0x1483('0x1d'));var licenseUtil=require(_0x1483('0x1e'));var db=require(_0x1483('0x1f'))['db'];var integrations=require(_0x1483('0x20'));var jayson=require('jayson/promise');var client=jayson[_0x1483('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ed6ec,_0x23fd6e,_0x300165,_0x390b88){return new BPromise(function(_0x21d7f1,_0x17a498){var _0x56f3c7=_0x390b88||client;return _0x56f3c7['request'](_0x2ed6ec,_0x300165)[_0x1483('0x22')](function(_0x238107){logger['info'](_0x1483('0x23'),_0x23fd6e,_0x1483('0x24'));logger[_0x1483('0x25')](_0x1483('0x26'),_0x23fd6e,'request\x20sent',JSON[_0x1483('0x27')](_0x238107));if(_0x238107[_0x1483('0x28')]){if(_0x238107[_0x1483('0x28')]['code']===0x1f4){logger[_0x1483('0x28')](_0x1483('0x23'),_0x23fd6e,_0x238107[_0x1483('0x28')][_0x1483('0x29')]);return _0x17a498(_0x238107['error'][_0x1483('0x29')]);}logger[_0x1483('0x28')]('ServicenowAccount,\x20%s,\x20%s',_0x23fd6e,_0x238107['error'][_0x1483('0x29')]);return _0x21d7f1(_0x238107[_0x1483('0x28')][_0x1483('0x29')]);}else{logger[_0x1483('0x2a')](_0x1483('0x23'),_0x23fd6e,_0x1483('0x24'));_0x21d7f1(_0x238107[_0x1483('0x2b')][_0x1483('0x29')]);}})['catch'](function(_0xd89b8a){logger[_0x1483('0x28')](_0x1483('0x23'),_0x23fd6e,_0xd89b8a);_0x17a498(_0xd89b8a);});});}function respondWithStatusCode(_0x207cb9,_0x2b15eb){_0x2b15eb=_0x2b15eb||0xcc;return function(_0x56f6c5){if(_0x56f6c5){return _0x207cb9[_0x1483('0x2c')](_0x2b15eb);}return _0x207cb9['status'](_0x2b15eb)[_0x1483('0x2d')]();};}function respondWithResult(_0x3e0e4d,_0xaed547){_0xaed547=_0xaed547||0xc8;return function(_0x3d783c){if(_0x3d783c){return _0x3e0e4d['status'](_0xaed547)[_0x1483('0x2e')](_0x3d783c);}};}function respondWithFilteredResult(_0xf3ec23,_0x4f9440){return function(_0x5ce5c8){if(_0x5ce5c8){var _0x296ed3=_0x5ce5c8[_0x1483('0x2f')],_0x3a5f4f=_0x4f9440[_0x1483('0x30')],_0x4ac894=_0x4f9440['offset']+_0x4f9440[_0x1483('0x31')],_0x326014;if(_0x4ac894>=_0x296ed3){_0x4ac894=_0x296ed3;_0x326014=0xc8;}else{_0x326014=0xce;}_0xf3ec23['status'](_0x326014);return _0xf3ec23[_0x1483('0x32')](_0x1483('0x33'),_0x3a5f4f+'-'+_0x4ac894+'/'+_0x296ed3)[_0x1483('0x2e')](_0x5ce5c8);}return null;};}function patchUpdates(_0x13bb25){return function(_0x2368e5){try{jsonpatch[_0x1483('0x34')](_0x2368e5,_0x13bb25,!![]);}catch(_0x35be08){return BPromise[_0x1483('0x35')](_0x35be08);}return _0x2368e5[_0x1483('0x36')]();};}function saveUpdates(_0x253e1c,_0x8dc8e5){return function(_0x54cf90){if(_0x54cf90){return _0x54cf90[_0x1483('0x37')](_0x253e1c)[_0x1483('0x22')](function(_0x19d742){return _0x19d742;});}return null;};}function removeEntity(_0xa8d4a8,_0x474542){return function(_0x334ac9){if(_0x334ac9){return _0x334ac9[_0x1483('0x38')]()[_0x1483('0x22')](function(){_0xa8d4a8[_0x1483('0x39')](0xcc)[_0x1483('0x2d')]();});}};}function handleEntityNotFound(_0x194c10,_0x299609){return function(_0x48fbd2){if(!_0x48fbd2){_0x194c10[_0x1483('0x2c')](0x194);}return _0x48fbd2;};}function handleError(_0x590a18,_0x803060){_0x803060=_0x803060||0x1f4;return function(_0x5f4233){logger['error'](_0x5f4233[_0x1483('0x3a')]);if(_0x5f4233[_0x1483('0x3b')]){delete _0x5f4233[_0x1483('0x3b')];}_0x590a18[_0x1483('0x39')](_0x803060)[_0x1483('0x3c')](_0x5f4233);};}exports[_0x1483('0x3d')]=function(_0x324279,_0x4767b8){var _0x1a08cb={},_0xaa24cc={},_0x2e86bb={'count':0x0,'rows':[]};var _0x410e41=_[_0x1483('0x3e')](db['ServicenowAccount'][_0x1483('0x3f')],function(_0x21e3d8){return{'name':_0x21e3d8[_0x1483('0x40')],'type':_0x21e3d8['type'][_0x1483('0x41')]};});_0xaa24cc['model']=_[_0x1483('0x3e')](_0x410e41,_0x1483('0x3b'));_0xaa24cc['query']=_['keys'](_0x324279[_0x1483('0x42')]);_0xaa24cc[_0x1483('0x43')]=_[_0x1483('0x44')](_0xaa24cc[_0x1483('0x45')],_0xaa24cc[_0x1483('0x42')]);_0x1a08cb['attributes']=_[_0x1483('0x44')](_0xaa24cc['model'],qs[_0x1483('0x46')](_0x324279[_0x1483('0x42')][_0x1483('0x46')]));_0x1a08cb['attributes']=_0x1a08cb['attributes']['length']?_0x1a08cb[_0x1483('0x47')]:_0xaa24cc[_0x1483('0x45')];if(!_0x324279[_0x1483('0x42')]['hasOwnProperty'](_0x1483('0x48'))){_0x1a08cb['limit']=qs[_0x1483('0x31')](_0x324279[_0x1483('0x42')][_0x1483('0x31')]);_0x1a08cb[_0x1483('0x30')]=qs[_0x1483('0x30')](_0x324279[_0x1483('0x42')]['offset']);}_0x1a08cb[_0x1483('0x49')]=qs[_0x1483('0x4a')](_0x324279[_0x1483('0x42')][_0x1483('0x4a')]);_0x1a08cb[_0x1483('0x4b')]=qs[_0x1483('0x43')](_[_0x1483('0x4c')](_0x324279[_0x1483('0x42')],_0xaa24cc[_0x1483('0x43')]),_0x410e41);if(_0x324279[_0x1483('0x42')]['filter']){_0x1a08cb['where']=_['merge'](_0x1a08cb['where'],{'$or':_['map'](_0x410e41,function(_0x23a746){if(_0x23a746['type']!==_0x1483('0x4d')){var _0x3ed975={};_0x3ed975[_0x23a746['name']]={'$like':'%'+_0x324279['query'][_0x1483('0x4e')]+'%'};return _0x3ed975;}})});}_0x1a08cb=_[_0x1483('0x4f')]({},_0x1a08cb,_0x324279[_0x1483('0x50')]);var _0x565d0b={'where':_0x1a08cb['where']};return db[_0x1483('0x51')]['count'](_0x565d0b)['then'](function(_0x294ae9){_0x2e86bb['count']=_0x294ae9;if(_0x324279['query'][_0x1483('0x52')]){_0x1a08cb[_0x1483('0x53')]=[{'all':!![]}];}return db[_0x1483('0x51')][_0x1483('0x54')](_0x1a08cb);})['then'](function(_0x180f28){_0x2e86bb[_0x1483('0x55')]=_0x180f28;return _0x2e86bb;})[_0x1483('0x22')](respondWithFilteredResult(_0x4767b8,_0x1a08cb))['catch'](handleError(_0x4767b8,null));};exports[_0x1483('0x56')]=function(_0x27444e,_0x1ad96b){var _0x4edada={'raw':![],'where':{'id':_0x27444e[_0x1483('0x57')]['id']}},_0x21d31a={};_0x21d31a[_0x1483('0x45')]=_[_0x1483('0x58')](db[_0x1483('0x51')]['rawAttributes']);_0x21d31a[_0x1483('0x42')]=_['keys'](_0x27444e[_0x1483('0x42')]);_0x21d31a[_0x1483('0x43')]=_[_0x1483('0x44')](_0x21d31a[_0x1483('0x45')],_0x21d31a[_0x1483('0x42')]);_0x4edada[_0x1483('0x47')]=_[_0x1483('0x44')](_0x21d31a[_0x1483('0x45')],qs['fields'](_0x27444e[_0x1483('0x42')][_0x1483('0x46')]));_0x4edada[_0x1483('0x47')]=_0x4edada[_0x1483('0x47')]['length']?_0x4edada['attributes']:_0x21d31a[_0x1483('0x45')];if(_0x27444e[_0x1483('0x42')][_0x1483('0x52')]){_0x4edada[_0x1483('0x53')]=[{'all':!![]}];}_0x4edada=_[_0x1483('0x4f')]({},_0x4edada,_0x27444e['options']);return db['ServicenowAccount'][_0x1483('0x59')](_0x4edada)[_0x1483('0x22')](handleEntityNotFound(_0x1ad96b,null))[_0x1483('0x22')](respondWithResult(_0x1ad96b,null))[_0x1483('0x5a')](handleError(_0x1ad96b,null));};exports[_0x1483('0x5b')]=function(_0x279ccd,_0x1a114f){return db[_0x1483('0x51')][_0x1483('0x5b')](_0x279ccd[_0x1483('0x5c')],{})['then'](respondWithResult(_0x1a114f,0xc9))[_0x1483('0x5a')](handleError(_0x1a114f,null));};exports['update']=function(_0xbc4517,_0x163e6a){if(_0xbc4517['body']['id']){delete _0xbc4517[_0x1483('0x5c')]['id'];}return db[_0x1483('0x51')][_0x1483('0x59')]({'where':{'id':_0xbc4517[_0x1483('0x57')]['id']}})[_0x1483('0x22')](handleEntityNotFound(_0x163e6a,null))[_0x1483('0x22')](saveUpdates(_0xbc4517[_0x1483('0x5c')],null))[_0x1483('0x22')](respondWithResult(_0x163e6a,null))[_0x1483('0x5a')](handleError(_0x163e6a,null));};exports[_0x1483('0x38')]=function(_0x38fe5d,_0x32b3cf){return db[_0x1483('0x51')][_0x1483('0x59')]({'where':{'id':_0x38fe5d[_0x1483('0x57')]['id']}})[_0x1483('0x22')](handleEntityNotFound(_0x32b3cf,null))[_0x1483('0x22')](removeEntity(_0x32b3cf,null))[_0x1483('0x5a')](handleError(_0x32b3cf,null));};exports[_0x1483('0x5d')]=function(_0x582bbd,_0x309b6b,_0x2df733){var _0x446d67={};var _0x4e5c66={};var _0x3ca53d;var _0x1c81c0;return db[_0x1483('0x51')][_0x1483('0x5e')]({'where':{'id':_0x582bbd[_0x1483('0x57')]['id']}})['then'](handleEntityNotFound(_0x309b6b,null))[_0x1483('0x22')](function(_0x320959){if(_0x320959){_0x3ca53d=_0x320959;_0x4e5c66['model']=_[_0x1483('0x58')](db[_0x1483('0x5f')][_0x1483('0x3f')]);_0x4e5c66['query']=_[_0x1483('0x58')](_0x582bbd['query']);_0x4e5c66['filters']=_[_0x1483('0x44')](_0x4e5c66[_0x1483('0x45')],_0x4e5c66[_0x1483('0x42')]);_0x446d67[_0x1483('0x47')]=_['intersection'](_0x4e5c66['model'],qs[_0x1483('0x46')](_0x582bbd['query'][_0x1483('0x46')]));_0x446d67[_0x1483('0x47')]=_0x446d67[_0x1483('0x47')]['length']?_0x446d67[_0x1483('0x47')]:_0x4e5c66['model'];_0x446d67[_0x1483('0x49')]=qs[_0x1483('0x4a')](_0x582bbd[_0x1483('0x42')][_0x1483('0x4a')]);_0x446d67[_0x1483('0x4b')]=qs[_0x1483('0x43')](_[_0x1483('0x4c')](_0x582bbd[_0x1483('0x42')],_0x4e5c66['filters']));if(_0x582bbd[_0x1483('0x42')]['filter']){_0x446d67[_0x1483('0x4b')]=_[_0x1483('0x4f')](_0x446d67[_0x1483('0x4b')],{'$or':_[_0x1483('0x3e')](_0x446d67['attributes'],function(_0x1c27b1){var _0x5c899c={};_0x5c899c[_0x1c27b1]={'$like':'%'+_0x582bbd['query']['filter']+'%'};return _0x5c899c;})});}_0x446d67=_[_0x1483('0x4f')]({},_0x446d67,_0x582bbd[_0x1483('0x50')]);return _0x3ca53d[_0x1483('0x5d')](_0x446d67);}})[_0x1483('0x22')](function(_0xbc9cc8){if(_0xbc9cc8){_0x1c81c0=_0xbc9cc8[_0x1483('0x60')];if(!_0x582bbd[_0x1483('0x42')][_0x1483('0x61')](_0x1483('0x48'))){_0x446d67[_0x1483('0x31')]=qs[_0x1483('0x31')](_0x582bbd[_0x1483('0x42')]['limit']);_0x446d67['offset']=qs[_0x1483('0x30')](_0x582bbd[_0x1483('0x42')][_0x1483('0x30')]);}return _0x3ca53d['getConfigurations'](_0x446d67);}})[_0x1483('0x22')](function(_0x3a1512){if(_0x3a1512){return _0x3a1512?{'count':_0x1c81c0,'rows':_0x3a1512}:null;}})[_0x1483('0x22')](respondWithResult(_0x309b6b,null))[_0x1483('0x5a')](handleError(_0x309b6b,null));};exports[_0x1483('0x62')]=function(_0x516617,_0x2bda38,_0x3ed362){if(_0x516617[_0x1483('0x5c')]['id']){delete _0x516617[_0x1483('0x5c')]['id'];}return db[_0x1483('0x51')][_0x1483('0x5e')]({'where':{'id':_0x516617[_0x1483('0x57')]['id']}})[_0x1483('0x22')](handleEntityNotFound(_0x2bda38,null))['then'](function(_0x46fb9d){if(_0x46fb9d){_0x516617[_0x1483('0x5c')][_0x1483('0x63')]=_0x46fb9d['id'];_0x516617['body'][_0x1483('0x64')]=integrations[_0x1483('0x65')](_0x516617[_0x1483('0x5c')]['channel'],_0x516617[_0x1483('0x5c')][_0x1483('0x66')]);_0x516617[_0x1483('0x5c')][_0x1483('0x67')]=integrations[_0x1483('0x68')](_0x516617['body'][_0x1483('0x69')],_0x516617[_0x1483('0x5c')][_0x1483('0x66')]);return db[_0x1483('0x5f')][_0x1483('0x5b')](_0x516617[_0x1483('0x5c')],{'include':[{'model':db['ServicenowField'],'as':_0x1483('0x64')},{'model':db[_0x1483('0x6a')],'as':_0x1483('0x67')}]});}return null;})[_0x1483('0x22')](respondWithResult(_0x2bda38,null))[_0x1483('0x5a')](handleError(_0x2bda38,null));};exports['getFields']=function(_0x31a141,_0x2c7902,_0x58e695){var _0x4eeab4=[_0x1483('0x6b'),_0x1483('0x6c'),_0x1483('0x6d'),'subcategory','close_code',_0x1483('0x6e'),_0x1483('0x6f'),_0x1483('0x70'),_0x1483('0x71')];var _0x156610=[_0x1483('0x72'),_0x1483('0x6b'),_0x1483('0x73'),_0x1483('0x74'),_0x1483('0x75'),'sys_updated_on','child_incidents',_0x1483('0x6c'),_0x1483('0x76'),'number','resolved_by',_0x1483('0x77'),_0x1483('0x78'),_0x1483('0x79'),_0x1483('0x7a'),'sys_domain','state',_0x1483('0x7b'),_0x1483('0x6d'),_0x1483('0x49'),_0x1483('0x7c'),_0x1483('0x7d'),_0x1483('0x7e'),'delivery_plan',_0x1483('0x7f'),_0x1483('0x80'),_0x1483('0x81'),_0x1483('0x82'),_0x1483('0x83'),_0x1483('0x84'),_0x1483('0x85'),_0x1483('0x86'),'expected_start',_0x1483('0x87'),_0x1483('0x88'),_0x1483('0x89'),'work_end','reopened_time',_0x1483('0x8a'),_0x1483('0x8b'),_0x1483('0x8c'),_0x1483('0x8d'),_0x1483('0x8e'),_0x1483('0x8f'),'close_code',_0x1483('0x90'),_0x1483('0x91'),_0x1483('0x92'),_0x1483('0x93'),_0x1483('0x94'),_0x1483('0x95'),_0x1483('0x96'),'calendar_duration',_0x1483('0x6e'),_0x1483('0x97'),_0x1483('0x98'),_0x1483('0x99'),'follow_up',_0x1483('0x9a'),_0x1483('0x9b'),_0x1483('0x9c'),'reopened_by','incident_state','urgency',_0x1483('0x9d'),'company','reassignment_count','activity_due','assigned_to',_0x1483('0x70'),_0x1483('0x9e'),_0x1483('0x9f'),_0x1483('0xa0'),_0x1483('0xa1'),'due_date','sys_mod_count',_0x1483('0xa2'),_0x1483('0xa3'),_0x1483('0xa4'),_0x1483('0xa5'),_0x1483('0xa6'),_0x1483('0xa7'),_0x1483('0x71')];var _0x39bed7='';var _0x397b5b='';var _0x59379b=[];var _0x2784f7='';var _0x5adc4c='';var _0x31fb07=[];var _0x239e36='';var _0x57b2e1='';var _0x18d0d5={};var _0x278a5b='';return db[_0x1483('0x51')]['findOne']({'where':{'id':_0x31a141[_0x1483('0x57')]['id']},'attributes':['id','username',_0x1483('0xa8'),_0x1483('0xa9'),_0x1483('0xaa'),_0x1483('0xab')]})[_0x1483('0x22')](handleEntityNotFound(_0x2c7902,null))[_0x1483('0x22')](function(_0x386b23){if(_0x386b23){_0x278a5b=_0x386b23[_0x1483('0xaa')];var _0x40f0d7=_0x278a5b[_0x1483('0xac')](-0x1);if(_0x40f0d7==='/'){_0x278a5b=_0x278a5b[_0x1483('0xad')](0x0,_0x278a5b[_0x1483('0xae')](_0x40f0d7));}_0x57b2e1=util[_0x1483('0xaf')](_0x1483('0xb0'),_0x278a5b);_0x239e36=util[_0x1483('0xaf')]('%s/api/now/table/',_0x278a5b);_0x18d0d5={'user':_0x386b23[_0x1483('0xb1')],'pass':_0x386b23[_0x1483('0xa8')]};var _0x480a43={'method':'GET','uri':_0x57b2e1+'incident?sysparm_display_value=all','auth':_0x18d0d5,'json':!![]};return rp(_0x480a43);}})['then'](function(_0x4cbbb7){if(_0x4cbbb7[_0x1483('0x2b')][_0x1483('0x60')]>0x0){_0x39bed7=_0x4cbbb7[_0x1483('0x2b')];}console[_0x1483('0xb2')]('incident\x20table\x20objects',_0x39bed7);_0x31fb07=[];_0x397b5b=Object[_0x1483('0xb3')]([],_0x39bed7);_[_0x1483('0xb4')](_0x397b5b,function(_0x329c5a){return!_0x4eeab4[_0x1483('0xb5')](_0x329c5a['name']);});_0x397b5b[_0x1483('0xb6')](function(_0x399e9d){var _0x33ae03=createFieldObject(_0x239e36,_0x18d0d5,_0x399e9d[_0x1483('0xb7')],_0x399e9d['name'],_0x399e9d['label'],![]);_0x31fb07['push'](_0x33ae03);});return Promise[_0x1483('0xb8')](_0x31fb07);})[_0x1483('0x22')](function(_0x370ad2){_0x59379b=_0x370ad2;_0x2784f7=Object[_0x1483('0xb3')]([],_0x39bed7);console[_0x1483('0xb2')](_0x1483('0xb9'),_0x39bed7);_[_0x1483('0xb4')](_0x2784f7,function(_0x38dc2a){return _0x156610['includes'](_0x38dc2a[_0x1483('0x3b')]);});console[_0x1483('0xb2')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x2784f7);_0x31fb07=[];_0x2784f7['forEach'](function(_0x58c4c4){var _0x444a9b=createFieldObject(_0x239e36,_0x18d0d5,_0x58c4c4['internalType'],_0x58c4c4[_0x1483('0x3b')],_0x58c4c4['label'],!![]);_0x31fb07[_0x1483('0xba')](_0x444a9b);});return Promise['all'](_0x31fb07);})[_0x1483('0x22')](function(_0xbbd31c){_0x5adc4c=_0xbbd31c;var _0xa79279=_0x59379b[_0x1483('0xbb')](_0x5adc4c);return{'count':_0xa79279[_0x1483('0x60')],'rows':_0xa79279};})[_0x1483('0x22')](respondWithResult(_0x2c7902,null))[_0x1483('0x5a')](function(_0x569e61){console[_0x1483('0xb2')](_0x1483('0xbc')+_0x569e61);var _0x3cf80f=_0x31a141['query'][_0x1483('0xbd')]?0x1f4:_0x569e61['statusCode']||0x1f4;logger[_0x1483('0x28')](_0x569e61[_0x1483('0x3a')]);delete _0x569e61[_0x1483('0x3b')];if(_0x3cf80f===0x191){_0x3cf80f=0x190;}_0x2c7902[_0x1483('0x39')](_0x3cf80f)[_0x1483('0x3c')](_0x31a141[_0x1483('0x42')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x569e61[_0x1483('0xbe')]}:_0x569e61);});};function createFieldObject(_0x1e7e51,_0x4ff944,_0x44f150,_0x463091,_0xe734eb,_0x5b345f){return new Promise(function(_0x41c00d,_0xdc0b9b){var _0x4e6cb7={'id':_0x463091,'name':_0xe734eb,'custom':_0x5b345f};if(_0x44f150===_0x1483('0xbf')){_0x4e6cb7['options']=[{'name':'True','value':_0x1483('0xc0')},{'name':_0x1483('0xc1'),'value':_0x1483('0xc2')}];_0x41c00d(_0x4e6cb7);}else{var _0x228e24={'method':_0x1483('0xc3'),'uri':_0x1e7e51+_0x1483('0xc4')+_0x463091,'auth':_0x4ff944,'json':!![]};return rp(_0x228e24)['then'](function(_0x1cc8bf){var _0x30f262=[];if(_0x1cc8bf['result']['length']>0x0){_0x1cc8bf['result']['forEach'](function(_0x54a70a){if(_0x54a70a[_0x1483('0xc5')]===_0x1483('0xc2')){var _0x30d45d={'name':_0x54a70a['label'],'value':_0x54a70a[_0x1483('0xc6')]};_0x30f262['push'](_0x30d45d);}});}_0x4e6cb7[_0x1483('0x50')]=_0x30f262;if(_0x4e6cb7[_0x1483('0x50')][_0x1483('0x60')]>0x0){_0x41c00d(_0x4e6cb7);}else{if(_0x5b345f==![]){_0x41c00d();}else{_0x41c00d(_0x4e6cb7);}}});}});} \ No newline at end of file +var _0x6a43=['sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','map','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowAccount','count','includeAll','include','findAll','rows','show','params','length','find','create','body','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','calendar_stc','closed_at','cmdb_ci','active','business_service','sys_domain_path','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','caller_id','approval_set','work_notes','short_description','delivery_task','business_stc','description','calendar_duration','sys_class_name','follow_up','parent_incident','sys_id','contact_type','incident_state','urgency','problem_id','activity_due','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','all','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','false','sys_choice?sysparm_query=name=incident^element=','value','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch'];(function(_0x3e03b5,_0x108dac){var _0x2f6e47=function(_0x1148d7){while(--_0x1148d7){_0x3e03b5['push'](_0x3e03b5['shift']());}};_0x2f6e47(++_0x108dac);}(_0x6a43,0x151));var _0x36a4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6a43[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x36a4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x36a4('0x1'));var zipdir=require(_0x36a4('0x2'));var jsonpatch=require(_0x36a4('0x3'));var rp=require('request-promise');var moment=require(_0x36a4('0x4'));var BPromise=require(_0x36a4('0x5'));var Mustache=require(_0x36a4('0x6'));var util=require(_0x36a4('0x7'));var path=require(_0x36a4('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x36a4('0x9'));var fs=require('fs');var _=require(_0x36a4('0xa'));var squel=require(_0x36a4('0xb'));var crypto=require(_0x36a4('0xc'));var jsforce=require(_0x36a4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x36a4('0xe'));var querystring=require(_0x36a4('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x36a4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x36a4('0x11'))(_0x36a4('0x12'));var utils=require(_0x36a4('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x36a4('0x14'));var db=require(_0x36a4('0x15'))['db'];var integrations=require(_0x36a4('0x16'));var jayson=require(_0x36a4('0x17'));var client=jayson['client'][_0x36a4('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5c7655,_0xbc1102,_0x1abe9a,_0x4b9d2f){return new BPromise(function(_0x5c9a18,_0x469532){var _0x5d672e=_0x4b9d2f||client;return _0x5d672e[_0x36a4('0x19')](_0x5c7655,_0x1abe9a)[_0x36a4('0x1a')](function(_0x217881){logger[_0x36a4('0x1b')](_0x36a4('0x1c'),_0xbc1102,'request\x20sent');logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0xbc1102,'request\x20sent',JSON[_0x36a4('0x1d')](_0x217881));if(_0x217881[_0x36a4('0x1e')]){if(_0x217881[_0x36a4('0x1e')][_0x36a4('0x1f')]===0x1f4){logger[_0x36a4('0x1e')](_0x36a4('0x1c'),_0xbc1102,_0x217881[_0x36a4('0x1e')][_0x36a4('0x20')]);return _0x469532(_0x217881[_0x36a4('0x1e')][_0x36a4('0x20')]);}logger[_0x36a4('0x1e')](_0x36a4('0x1c'),_0xbc1102,_0x217881[_0x36a4('0x1e')][_0x36a4('0x20')]);return _0x5c9a18(_0x217881[_0x36a4('0x1e')][_0x36a4('0x20')]);}else{logger['info'](_0x36a4('0x1c'),_0xbc1102,_0x36a4('0x21'));_0x5c9a18(_0x217881['result'][_0x36a4('0x20')]);}})[_0x36a4('0x22')](function(_0x26c979){logger[_0x36a4('0x1e')](_0x36a4('0x1c'),_0xbc1102,_0x26c979);_0x469532(_0x26c979);});});}function respondWithStatusCode(_0x1f571a,_0x143cb0){_0x143cb0=_0x143cb0||0xcc;return function(_0x57e534){if(_0x57e534){return _0x1f571a[_0x36a4('0x23')](_0x143cb0);}return _0x1f571a[_0x36a4('0x24')](_0x143cb0)['end']();};}function respondWithResult(_0x28f21f,_0x278152){_0x278152=_0x278152||0xc8;return function(_0x53e123){if(_0x53e123){return _0x28f21f['status'](_0x278152)[_0x36a4('0x25')](_0x53e123);}};}function respondWithFilteredResult(_0x3091c4,_0x3ff0e1){return function(_0x1a42d6){if(_0x1a42d6){var _0x3226e5=_0x1a42d6['count'],_0x3ccc1a=_0x3ff0e1['offset'],_0x44cb87=_0x3ff0e1[_0x36a4('0x26')]+_0x3ff0e1[_0x36a4('0x27')],_0x234b6a;if(_0x44cb87>=_0x3226e5){_0x44cb87=_0x3226e5;_0x234b6a=0xc8;}else{_0x234b6a=0xce;}_0x3091c4['status'](_0x234b6a);return _0x3091c4[_0x36a4('0x28')](_0x36a4('0x29'),_0x3ccc1a+'-'+_0x44cb87+'/'+_0x3226e5)[_0x36a4('0x25')](_0x1a42d6);}return null;};}function patchUpdates(_0x636b19){return function(_0x4ccd8a){try{jsonpatch[_0x36a4('0x2a')](_0x4ccd8a,_0x636b19,!![]);}catch(_0x141020){return BPromise['reject'](_0x141020);}return _0x4ccd8a[_0x36a4('0x2b')]();};}function saveUpdates(_0x2064be,_0x27b3bf){return function(_0x29830f){if(_0x29830f){return _0x29830f[_0x36a4('0x2c')](_0x2064be)['then'](function(_0x3a5311){return _0x3a5311;});}return null;};}function removeEntity(_0x481253,_0x5db3f2){return function(_0x273bc8){if(_0x273bc8){return _0x273bc8[_0x36a4('0x2d')]()['then'](function(){_0x481253[_0x36a4('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43f9ad,_0x3efb44){return function(_0x17cd96){if(!_0x17cd96){_0x43f9ad[_0x36a4('0x23')](0x194);}return _0x17cd96;};}function handleError(_0x3ab6d2,_0x2ab7f8){_0x2ab7f8=_0x2ab7f8||0x1f4;return function(_0x2ebcec){logger[_0x36a4('0x1e')](_0x2ebcec[_0x36a4('0x2e')]);if(_0x2ebcec[_0x36a4('0x2f')]){delete _0x2ebcec[_0x36a4('0x2f')];}_0x3ab6d2[_0x36a4('0x24')](_0x2ab7f8)[_0x36a4('0x30')](_0x2ebcec);};}exports['index']=function(_0x37988d,_0x45fe4b){var _0x3c8507={},_0x2666a8={},_0x3db7dc={'count':0x0,'rows':[]};var _0x320e11=_[_0x36a4('0x31')](db['ServicenowAccount'][_0x36a4('0x32')],function(_0x58d3a0){return{'name':_0x58d3a0[_0x36a4('0x33')],'type':_0x58d3a0[_0x36a4('0x34')]['key']};});_0x2666a8['model']=_[_0x36a4('0x31')](_0x320e11,'name');_0x2666a8['query']=_[_0x36a4('0x35')](_0x37988d[_0x36a4('0x36')]);_0x2666a8[_0x36a4('0x37')]=_[_0x36a4('0x38')](_0x2666a8[_0x36a4('0x39')],_0x2666a8['query']);_0x3c8507[_0x36a4('0x3a')]=_[_0x36a4('0x38')](_0x2666a8[_0x36a4('0x39')],qs[_0x36a4('0x3b')](_0x37988d[_0x36a4('0x36')][_0x36a4('0x3b')]));_0x3c8507[_0x36a4('0x3a')]=_0x3c8507[_0x36a4('0x3a')]['length']?_0x3c8507[_0x36a4('0x3a')]:_0x2666a8['model'];if(!_0x37988d[_0x36a4('0x36')][_0x36a4('0x3c')](_0x36a4('0x3d'))){_0x3c8507['limit']=qs[_0x36a4('0x27')](_0x37988d[_0x36a4('0x36')][_0x36a4('0x27')]);_0x3c8507['offset']=qs[_0x36a4('0x26')](_0x37988d[_0x36a4('0x36')][_0x36a4('0x26')]);}_0x3c8507[_0x36a4('0x3e')]=qs['sort'](_0x37988d[_0x36a4('0x36')][_0x36a4('0x3f')]);_0x3c8507[_0x36a4('0x40')]=qs['filters'](_[_0x36a4('0x41')](_0x37988d['query'],_0x2666a8[_0x36a4('0x37')]),_0x320e11);if(_0x37988d['query'][_0x36a4('0x42')]){_0x3c8507[_0x36a4('0x40')]=_[_0x36a4('0x43')](_0x3c8507[_0x36a4('0x40')],{'$or':_['map'](_0x320e11,function(_0x237145){if(_0x237145[_0x36a4('0x34')]!==_0x36a4('0x44')){var _0x2b4551={};_0x2b4551[_0x237145[_0x36a4('0x2f')]]={'$like':'%'+_0x37988d[_0x36a4('0x36')][_0x36a4('0x42')]+'%'};return _0x2b4551;}})});}_0x3c8507=_[_0x36a4('0x43')]({},_0x3c8507,_0x37988d[_0x36a4('0x45')]);var _0x22f33c={'where':_0x3c8507[_0x36a4('0x40')]};return db[_0x36a4('0x46')][_0x36a4('0x47')](_0x22f33c)[_0x36a4('0x1a')](function(_0x5a26f3){_0x3db7dc[_0x36a4('0x47')]=_0x5a26f3;if(_0x37988d[_0x36a4('0x36')][_0x36a4('0x48')]){_0x3c8507[_0x36a4('0x49')]=[{'all':!![]}];}return db[_0x36a4('0x46')][_0x36a4('0x4a')](_0x3c8507);})[_0x36a4('0x1a')](function(_0x15521a){_0x3db7dc[_0x36a4('0x4b')]=_0x15521a;return _0x3db7dc;})[_0x36a4('0x1a')](respondWithFilteredResult(_0x45fe4b,_0x3c8507))[_0x36a4('0x22')](handleError(_0x45fe4b,null));};exports[_0x36a4('0x4c')]=function(_0x2a5026,_0x2221c4){var _0xfa5d8a={'raw':![],'where':{'id':_0x2a5026[_0x36a4('0x4d')]['id']}},_0x2f9e23={};_0x2f9e23['model']=_[_0x36a4('0x35')](db[_0x36a4('0x46')][_0x36a4('0x32')]);_0x2f9e23[_0x36a4('0x36')]=_[_0x36a4('0x35')](_0x2a5026[_0x36a4('0x36')]);_0x2f9e23['filters']=_[_0x36a4('0x38')](_0x2f9e23[_0x36a4('0x39')],_0x2f9e23[_0x36a4('0x36')]);_0xfa5d8a[_0x36a4('0x3a')]=_[_0x36a4('0x38')](_0x2f9e23[_0x36a4('0x39')],qs['fields'](_0x2a5026['query'][_0x36a4('0x3b')]));_0xfa5d8a['attributes']=_0xfa5d8a[_0x36a4('0x3a')][_0x36a4('0x4e')]?_0xfa5d8a[_0x36a4('0x3a')]:_0x2f9e23[_0x36a4('0x39')];if(_0x2a5026[_0x36a4('0x36')]['includeAll']){_0xfa5d8a['include']=[{'all':!![]}];}_0xfa5d8a=_[_0x36a4('0x43')]({},_0xfa5d8a,_0x2a5026['options']);return db[_0x36a4('0x46')][_0x36a4('0x4f')](_0xfa5d8a)[_0x36a4('0x1a')](handleEntityNotFound(_0x2221c4,null))[_0x36a4('0x1a')](respondWithResult(_0x2221c4,null))[_0x36a4('0x22')](handleError(_0x2221c4,null));};exports[_0x36a4('0x50')]=function(_0x4f7502,_0x520f5d){return db[_0x36a4('0x46')][_0x36a4('0x50')](_0x4f7502['body'],{})[_0x36a4('0x1a')](respondWithResult(_0x520f5d,0xc9))['catch'](handleError(_0x520f5d,null));};exports[_0x36a4('0x2c')]=function(_0xa6723c,_0x50537c){if(_0xa6723c[_0x36a4('0x51')]['id']){delete _0xa6723c['body']['id'];}return db[_0x36a4('0x46')][_0x36a4('0x4f')]({'where':{'id':_0xa6723c[_0x36a4('0x4d')]['id']}})[_0x36a4('0x1a')](handleEntityNotFound(_0x50537c,null))[_0x36a4('0x1a')](saveUpdates(_0xa6723c['body'],null))[_0x36a4('0x1a')](respondWithResult(_0x50537c,null))[_0x36a4('0x22')](handleError(_0x50537c,null));};exports[_0x36a4('0x2d')]=function(_0x566948,_0x26ed17){return db[_0x36a4('0x46')][_0x36a4('0x4f')]({'where':{'id':_0x566948[_0x36a4('0x4d')]['id']}})[_0x36a4('0x1a')](handleEntityNotFound(_0x26ed17,null))[_0x36a4('0x1a')](removeEntity(_0x26ed17,null))[_0x36a4('0x22')](handleError(_0x26ed17,null));};exports['getConfigurations']=function(_0x24d994,_0x24551c,_0x3f3d10){var _0x1569f9={};var _0x34fd1a={};var _0x51f761;var _0x262094;return db['ServicenowAccount'][_0x36a4('0x52')]({'where':{'id':_0x24d994[_0x36a4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x24551c,null))[_0x36a4('0x1a')](function(_0x51928f){if(_0x51928f){_0x51f761=_0x51928f;_0x34fd1a[_0x36a4('0x39')]=_[_0x36a4('0x35')](db[_0x36a4('0x53')][_0x36a4('0x32')]);_0x34fd1a[_0x36a4('0x36')]=_[_0x36a4('0x35')](_0x24d994[_0x36a4('0x36')]);_0x34fd1a['filters']=_[_0x36a4('0x38')](_0x34fd1a['model'],_0x34fd1a[_0x36a4('0x36')]);_0x1569f9[_0x36a4('0x3a')]=_[_0x36a4('0x38')](_0x34fd1a[_0x36a4('0x39')],qs[_0x36a4('0x3b')](_0x24d994[_0x36a4('0x36')]['fields']));_0x1569f9[_0x36a4('0x3a')]=_0x1569f9[_0x36a4('0x3a')]['length']?_0x1569f9[_0x36a4('0x3a')]:_0x34fd1a[_0x36a4('0x39')];_0x1569f9['order']=qs[_0x36a4('0x3f')](_0x24d994[_0x36a4('0x36')][_0x36a4('0x3f')]);_0x1569f9[_0x36a4('0x40')]=qs[_0x36a4('0x37')](_['pick'](_0x24d994[_0x36a4('0x36')],_0x34fd1a[_0x36a4('0x37')]));if(_0x24d994['query']['filter']){_0x1569f9[_0x36a4('0x40')]=_[_0x36a4('0x43')](_0x1569f9[_0x36a4('0x40')],{'$or':_[_0x36a4('0x31')](_0x1569f9[_0x36a4('0x3a')],function(_0x42e241){var _0x2e8fb2={};_0x2e8fb2[_0x42e241]={'$like':'%'+_0x24d994['query']['filter']+'%'};return _0x2e8fb2;})});}_0x1569f9=_[_0x36a4('0x43')]({},_0x1569f9,_0x24d994[_0x36a4('0x45')]);return _0x51f761[_0x36a4('0x54')](_0x1569f9);}})[_0x36a4('0x1a')](function(_0x37b9f7){if(_0x37b9f7){_0x262094=_0x37b9f7[_0x36a4('0x4e')];if(!_0x24d994['query'][_0x36a4('0x3c')](_0x36a4('0x3d'))){_0x1569f9[_0x36a4('0x27')]=qs['limit'](_0x24d994[_0x36a4('0x36')][_0x36a4('0x27')]);_0x1569f9['offset']=qs[_0x36a4('0x26')](_0x24d994[_0x36a4('0x36')][_0x36a4('0x26')]);}return _0x51f761[_0x36a4('0x54')](_0x1569f9);}})[_0x36a4('0x1a')](function(_0x2638ca){if(_0x2638ca){return _0x2638ca?{'count':_0x262094,'rows':_0x2638ca}:null;}})['then'](respondWithResult(_0x24551c,null))[_0x36a4('0x22')](handleError(_0x24551c,null));};exports[_0x36a4('0x55')]=function(_0x208b56,_0x5c2ff5,_0x16b9f4){if(_0x208b56[_0x36a4('0x51')]['id']){delete _0x208b56['body']['id'];}return db[_0x36a4('0x46')][_0x36a4('0x52')]({'where':{'id':_0x208b56['params']['id']}})['then'](handleEntityNotFound(_0x5c2ff5,null))['then'](function(_0x2d6b60){if(_0x2d6b60){_0x208b56[_0x36a4('0x51')]['AccountId']=_0x2d6b60['id'];_0x208b56['body'][_0x36a4('0x56')]=integrations[_0x36a4('0x57')](_0x208b56['body'][_0x36a4('0x58')],_0x208b56['body'][_0x36a4('0x34')]);_0x208b56[_0x36a4('0x51')][_0x36a4('0x59')]=integrations['getDescriptions'](_0x208b56[_0x36a4('0x51')][_0x36a4('0x58')],_0x208b56[_0x36a4('0x51')][_0x36a4('0x34')]);return db['ServicenowConfiguration'][_0x36a4('0x50')](_0x208b56[_0x36a4('0x51')],{'include':[{'model':db[_0x36a4('0x5a')],'as':_0x36a4('0x56')},{'model':db[_0x36a4('0x5a')],'as':_0x36a4('0x59')}]});}return null;})['then'](respondWithResult(_0x5c2ff5,null))[_0x36a4('0x22')](handleError(_0x5c2ff5,null));};exports[_0x36a4('0x5b')]=function(_0x2cc25d,_0x22330f,_0x484b1a){var _0x27d79a=[_0x36a4('0x5c'),_0x36a4('0x5d'),_0x36a4('0x5e'),_0x36a4('0x5f'),_0x36a4('0x60'),_0x36a4('0x61'),'incident_state','severity',_0x36a4('0x62')];var _0x286fc0=[_0x36a4('0x63'),_0x36a4('0x5c'),_0x36a4('0x64'),_0x36a4('0x65'),_0x36a4('0x66'),_0x36a4('0x67'),_0x36a4('0x68'),_0x36a4('0x5d'),'approval_history','number',_0x36a4('0x69'),_0x36a4('0x6a'),_0x36a4('0x6b'),_0x36a4('0x6c'),'sys_created_on',_0x36a4('0x6d'),_0x36a4('0x6e'),'sys_created_by','knowledge',_0x36a4('0x3e'),_0x36a4('0x6f'),_0x36a4('0x70'),_0x36a4('0x71'),'delivery_plan','impact',_0x36a4('0x72'),'work_notes_list',_0x36a4('0x73'),'priority',_0x36a4('0x74'),'rfc',_0x36a4('0x75'),_0x36a4('0x76'),_0x36a4('0x77'),'business_duration',_0x36a4('0x78'),_0x36a4('0x79'),_0x36a4('0x7a'),'resolved_at',_0x36a4('0x7b'),_0x36a4('0x7c'),_0x36a4('0x5f'),_0x36a4('0x7d'),_0x36a4('0x7e'),_0x36a4('0x60'),'correlation_display',_0x36a4('0x7f'),'work_start','assignment_group',_0x36a4('0x80'),'additional_assignee_list',_0x36a4('0x81'),_0x36a4('0x82'),_0x36a4('0x61'),_0x36a4('0x83'),'close_notes','closed_by',_0x36a4('0x84'),_0x36a4('0x85'),_0x36a4('0x86'),_0x36a4('0x87'),'reopened_by',_0x36a4('0x88'),_0x36a4('0x89'),_0x36a4('0x8a'),'company','reassignment_count',_0x36a4('0x8b'),_0x36a4('0x8c'),_0x36a4('0x8d'),_0x36a4('0x8e'),_0x36a4('0x8f'),_0x36a4('0x90'),_0x36a4('0x91'),_0x36a4('0x92'),_0x36a4('0x93'),'reopen_count',_0x36a4('0x94'),'escalation',_0x36a4('0x95'),_0x36a4('0x96'),_0x36a4('0x97'),_0x36a4('0x62')];var _0x27df2c='';var _0x9a900d='';var _0x223d5f=[];var _0x5126d1='';var _0x4f6927='';var _0x2d162f=[];var _0x21b49e='';var _0x13d129='';var _0x1fca0c={};var _0x266f77='';return db['ServicenowAccount'][_0x36a4('0x52')]({'where':{'id':_0x2cc25d[_0x36a4('0x4d')]['id']},'attributes':['id',_0x36a4('0x98'),_0x36a4('0x99'),_0x36a4('0x9a'),_0x36a4('0x9b'),_0x36a4('0x9c')]})[_0x36a4('0x1a')](handleEntityNotFound(_0x22330f,null))[_0x36a4('0x1a')](function(_0x2f4abb){if(_0x2f4abb){_0x266f77=_0x2f4abb['remoteUri'];var _0x1bcd18=_0x266f77[_0x36a4('0x9d')](-0x1);if(_0x1bcd18==='/'){_0x266f77=_0x266f77['substring'](0x0,_0x266f77[_0x36a4('0x9e')](_0x1bcd18));}_0x13d129=util['format'](_0x36a4('0x9f'),_0x266f77);_0x21b49e=util[_0x36a4('0xa0')](_0x36a4('0xa1'),_0x266f77);_0x1fca0c={'user':_0x2f4abb['username'],'pass':_0x2f4abb[_0x36a4('0x99')]};var _0x200de3={'method':_0x36a4('0xa2'),'uri':_0x13d129+'incident?sysparm_display_value=all','auth':_0x1fca0c,'json':!![]};return rp(_0x200de3);}})[_0x36a4('0x1a')](function(_0x20b204){if(_0x20b204['result'][_0x36a4('0x4e')]>0x0){_0x27df2c=_0x20b204[_0x36a4('0xa3')];}console[_0x36a4('0xa4')](_0x36a4('0xa5'),_0x27df2c);_0x2d162f=[];_0x9a900d=Object[_0x36a4('0xa6')]([],_0x27df2c);_[_0x36a4('0xa7')](_0x9a900d,function(_0x39bfa5){return!_0x27d79a[_0x36a4('0xa8')](_0x39bfa5[_0x36a4('0x2f')]);});_0x9a900d[_0x36a4('0xa9')](function(_0xb3dec4){var _0x31245b=createFieldObject(_0x21b49e,_0x1fca0c,_0xb3dec4[_0x36a4('0xaa')],_0xb3dec4['name'],_0xb3dec4['label'],![]);_0x2d162f[_0x36a4('0xab')](_0x31245b);});return Promise['all'](_0x2d162f);})[_0x36a4('0x1a')](function(_0x253067){_0x223d5f=_0x253067;_0x5126d1=Object[_0x36a4('0xa6')]([],_0x27df2c);console[_0x36a4('0xa4')](_0x36a4('0xac'),_0x27df2c);_[_0x36a4('0xa7')](_0x5126d1,function(_0x413cf7){return _0x286fc0[_0x36a4('0xa8')](_0x413cf7[_0x36a4('0x2f')]);});console[_0x36a4('0xa4')](_0x36a4('0xad'),_0x5126d1);_0x2d162f=[];_0x5126d1[_0x36a4('0xa9')](function(_0x5a00ed){var _0x329031=createFieldObject(_0x21b49e,_0x1fca0c,_0x5a00ed[_0x36a4('0xaa')],_0x5a00ed[_0x36a4('0x2f')],_0x5a00ed[_0x36a4('0xae')],!![]);_0x2d162f[_0x36a4('0xab')](_0x329031);});return Promise[_0x36a4('0xaf')](_0x2d162f);})['then'](function(_0x9e539e){_0x4f6927=_0x9e539e;var _0x3c24b4=_0x223d5f[_0x36a4('0xb0')](_0x4f6927);return{'count':_0x3c24b4['length'],'rows':_0x3c24b4};})['then'](respondWithResult(_0x22330f,null))['catch'](function(_0x50342b){console[_0x36a4('0xa4')](_0x36a4('0xb1')+_0x50342b);var _0x1ab59e=_0x2cc25d['query'][_0x36a4('0xb2')]?0x1f4:_0x50342b[_0x36a4('0xb3')]||0x1f4;logger[_0x36a4('0x1e')](_0x50342b['stack']);delete _0x50342b['name'];if(_0x1ab59e===0x191){_0x1ab59e=0x190;}_0x22330f[_0x36a4('0x24')](_0x1ab59e)[_0x36a4('0x30')](_0x2cc25d[_0x36a4('0x36')][_0x36a4('0xb2')]?{'message':_0x36a4('0xb4'),'statusCode':_0x50342b[_0x36a4('0xb3')]}:_0x50342b);});};function createFieldObject(_0x44d7b1,_0x2836b2,_0x2cea80,_0x198492,_0x18ccb4,_0x2f6530){return new Promise(function(_0x2581e7,_0x194fc7){var _0x29b9c5={'id':_0x198492,'name':_0x18ccb4,'custom':_0x2f6530};if(_0x2cea80===_0x36a4('0xb5')){_0x29b9c5[_0x36a4('0x45')]=[{'name':_0x36a4('0xb6'),'value':'true'},{'name':'False','value':_0x36a4('0xb7')}];_0x2581e7(_0x29b9c5);}else{var _0x184d38={'method':_0x36a4('0xa2'),'uri':_0x44d7b1+_0x36a4('0xb8')+_0x198492,'auth':_0x2836b2,'json':!![]};return rp(_0x184d38)[_0x36a4('0x1a')](function(_0x42ef80){var _0x4d3aa4=[];if(_0x42ef80[_0x36a4('0xa3')]['length']>0x0){_0x42ef80[_0x36a4('0xa3')][_0x36a4('0xa9')](function(_0x554edf){if(_0x554edf['inactive']===_0x36a4('0xb7')){var _0x34a4af={'name':_0x554edf[_0x36a4('0xae')],'value':_0x554edf[_0x36a4('0xb9')]};_0x4d3aa4[_0x36a4('0xab')](_0x34a4af);}});}_0x29b9c5['options']=_0x4d3aa4;if(_0x29b9c5[_0x36a4('0x45')][_0x36a4('0x4e')]>0x0){_0x2581e7(_0x29b9c5);}else{if(_0x2f6530==![]){_0x2581e7();}else{_0x2581e7(_0x29b9c5);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 65ff2d4..7979b24 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 _0x5fd1=['lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_servicenow_accounts'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x5fd1,0x155));var _0x15fd=function(_0x244ca4,_0x944fc){_0x244ca4=_0x244ca4-0x0;var _0x59f2fb=_0x5fd1[_0x244ca4];return _0x59f2fb;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var logger=require(_0x15fd('0x1'))(_0x15fd('0x2'));var moment=require(_0x15fd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x15fd('0x4'));var rimraf=require(_0x15fd('0x5'));var config=require(_0x15fd('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x15fd('0x7'));module[_0x15fd('0x8')]=function(_0x18450c,_0x2e88bf){return _0x18450c[_0x15fd('0x9')]('ServicenowAccount',attributes,{'tableName':_0x15fd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd59=['bluebird','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment'];(function(_0x5d31f3,_0x4239b0){var _0x1cc88c=function(_0x1be8fc){while(--_0x1be8fc){_0x5d31f3['push'](_0x5d31f3['shift']());}};_0x1cc88c(++_0x4239b0);}(_0xcd59,0x14b));var _0x9cd5=function(_0x4a3f51,_0x3d9868){_0x4a3f51=_0x4a3f51-0x0;var _0x4d48d6=_0xcd59[_0x4a3f51];return _0x4d48d6;};'use strict';var _=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var logger=require(_0x9cd5('0x2'))(_0x9cd5('0x3'));var moment=require(_0x9cd5('0x4'));var BPromise=require(_0x9cd5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9cd5('0x6'));var rimraf=require(_0x9cd5('0x7'));var config=require(_0x9cd5('0x8'));var attributes=require(_0x9cd5('0x9'));var integrations=require(_0x9cd5('0xa'));module[_0x9cd5('0xb')]=function(_0x46277c,_0x2cd19a){return _0x46277c[_0x9cd5('0xc')](_0x9cd5('0xd'),attributes,{'tableName':'int_servicenow_accounts','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 318af38..ccd0751 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 _0xc842=['options','where','attributes','include','map','model','then','ShowServicenowAccount','ServicenowAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','request','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetServicenowAccount'];(function(_0x1b4460,_0x3a3b3a){var _0x22b997=function(_0x3825ec){while(--_0x3825ec){_0x1b4460['push'](_0x1b4460['shift']());}};_0x22b997(++_0x3a3b3a);}(_0xc842,0x6a));var _0x2c84=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0xc842[_0x25d386];return _0x857f4a;};'use strict';var _=require(_0x2c84('0x0'));var util=require(_0x2c84('0x1'));var moment=require(_0x2c84('0x2'));var BPromise=require(_0x2c84('0x3'));var rs=require(_0x2c84('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c84('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2c84('0x6'));var jayson=require(_0x2c84('0x7'));var client=jayson[_0x2c84('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f5b1c,_0xeb004a,_0x149915){return new BPromise(function(_0x264b07,_0x220ddd){return client[_0x2c84('0x9')](_0x1f5b1c,_0x149915)['then'](function(_0x1d0776){logger['info'](_0x2c84('0xa'),_0xeb004a,_0x2c84('0xb'));logger[_0x2c84('0xc')](_0x2c84('0xd'),_0xeb004a,'request\x20sent',JSON[_0x2c84('0xe')](_0x1d0776));if(_0x1d0776['error']){if(_0x1d0776[_0x2c84('0xf')][_0x2c84('0x10')]===0x1f4){logger[_0x2c84('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0xeb004a,_0x1d0776[_0x2c84('0xf')][_0x2c84('0x11')]);return _0x220ddd(_0x1d0776['error'][_0x2c84('0x11')]);}logger[_0x2c84('0xf')](_0x2c84('0xa'),_0xeb004a,_0x1d0776[_0x2c84('0xf')][_0x2c84('0x11')]);return _0x264b07(_0x1d0776[_0x2c84('0xf')]['message']);}else{logger[_0x2c84('0x12')](_0x2c84('0xa'),_0xeb004a,_0x2c84('0xb'));_0x264b07(_0x1d0776[_0x2c84('0x13')][_0x2c84('0x11')]);}})[_0x2c84('0x14')](function(_0x2ca385){logger[_0x2c84('0xf')](_0x2c84('0xa'),_0xeb004a,_0x2ca385);_0x220ddd(_0x2ca385);});});}exports[_0x2c84('0x15')]=function(_0x1b9233){var _0x47b40b=this;return new Promise(function(_0x5a9268,_0x3d3c29){return db['ServicenowAccount']['findAll']({'raw':_0x1b9233[_0x2c84('0x16')]?_0x1b9233[_0x2c84('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1b9233[_0x2c84('0x16')]?_0x1b9233[_0x2c84('0x16')][_0x2c84('0x17')]||null:null,'attributes':_0x1b9233[_0x2c84('0x16')]?_0x1b9233[_0x2c84('0x16')][_0x2c84('0x18')]||null:null,'limit':_0x1b9233[_0x2c84('0x16')]?_0x1b9233[_0x2c84('0x16')]['limit']||null:null,'include':_0x1b9233[_0x2c84('0x16')]?_0x1b9233[_0x2c84('0x16')][_0x2c84('0x19')]?_[_0x2c84('0x1a')](_0x1b9233[_0x2c84('0x16')][_0x2c84('0x19')],function(_0x594828){return{'model':db[_0x594828[_0x2c84('0x1b')]],'as':_0x594828['as'],'attributes':_0x594828['attributes'],'include':_0x594828[_0x2c84('0x19')]?_[_0x2c84('0x1a')](_0x594828['include'],function(_0x352d59){return{'model':db[_0x352d59[_0x2c84('0x1b')]],'as':_0x352d59['as'],'attributes':_0x352d59['attributes'],'include':_0x352d59[_0x2c84('0x19')]?_['map'](_0x352d59[_0x2c84('0x19')],function(_0x1f6cfc){return{'model':db[_0x1f6cfc[_0x2c84('0x1b')]],'as':_0x1f6cfc['as'],'attributes':_0x1f6cfc[_0x2c84('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2c84('0x1c')](function(_0x15e4e3){logger[_0x2c84('0x12')](_0x2c84('0x15'),_0x1b9233);logger[_0x2c84('0xc')](_0x2c84('0x15'),_0x1b9233,JSON[_0x2c84('0xe')](_0x15e4e3));_0x5a9268(_0x15e4e3);})[_0x2c84('0x14')](function(_0x21b823){logger[_0x2c84('0xf')](_0x2c84('0x15'),_0x21b823[_0x2c84('0x11')],_0x1b9233);_0x3d3c29(_0x47b40b[_0x2c84('0xf')](0x1f4,_0x21b823[_0x2c84('0x11')]));});});};exports[_0x2c84('0x1d')]=function(_0x5cc1e6){var _0x4ad2cc=this;return new Promise(function(_0x18ba9e,_0xf987fb){return db[_0x2c84('0x1e')][_0x2c84('0x1f')]({'raw':_0x5cc1e6[_0x2c84('0x16')]?_0x5cc1e6[_0x2c84('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5cc1e6[_0x2c84('0x16')]?_0x5cc1e6[_0x2c84('0x16')][_0x2c84('0x17')]||null:null,'attributes':_0x5cc1e6[_0x2c84('0x16')]?_0x5cc1e6[_0x2c84('0x16')][_0x2c84('0x18')]||null:null,'include':_0x5cc1e6[_0x2c84('0x16')]?_0x5cc1e6[_0x2c84('0x16')]['include']?_[_0x2c84('0x1a')](_0x5cc1e6[_0x2c84('0x16')][_0x2c84('0x19')],function(_0x392c68){return{'model':db[_0x392c68[_0x2c84('0x1b')]],'as':_0x392c68['as'],'attributes':_0x392c68['attributes'],'include':_0x392c68[_0x2c84('0x19')]?_[_0x2c84('0x1a')](_0x392c68[_0x2c84('0x19')],function(_0xb3b5a9){return{'model':db[_0xb3b5a9[_0x2c84('0x1b')]],'as':_0xb3b5a9['as'],'attributes':_0xb3b5a9[_0x2c84('0x18')],'include':_0xb3b5a9[_0x2c84('0x19')]?_['map'](_0xb3b5a9[_0x2c84('0x19')],function(_0xcdc179){return{'model':db[_0xcdc179[_0x2c84('0x1b')]],'as':_0xcdc179['as'],'attributes':_0xcdc179['attributes']};}):[]};}):[]};}):[]:[]})[_0x2c84('0x1c')](function(_0x3eecb4){logger[_0x2c84('0x12')](_0x2c84('0x1d'),_0x5cc1e6);logger['debug']('ShowServicenowAccount',_0x5cc1e6,JSON['stringify'](_0x3eecb4));_0x18ba9e(_0x3eecb4);})[_0x2c84('0x14')](function(_0xb51f99){logger['error'](_0x2c84('0x1d'),_0xb51f99['message'],_0x5cc1e6);_0xf987fb(_0x4ad2cc[_0x2c84('0xf')](0x1f4,_0xb51f99['message']));});});}; \ No newline at end of file +var _0xa9c7=['result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','limit','include','map','model','ShowServicenowAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x54db30,_0x45f417){var _0x5535e6=function(_0xc5f978){while(--_0xc5f978){_0x54db30['push'](_0x54db30['shift']());}};_0x5535e6(++_0x45f417);}(_0xa9c7,0x1b3));var _0x7a9c=function(_0x5ef55a,_0x2a03b1){_0x5ef55a=_0x5ef55a-0x0;var _0x20ae40=_0xa9c7[_0x5ef55a];return _0x20ae40;};'use strict';var _=require(_0x7a9c('0x0'));var util=require(_0x7a9c('0x1'));var moment=require(_0x7a9c('0x2'));var BPromise=require(_0x7a9c('0x3'));var rs=require(_0x7a9c('0x4'));var fs=require('fs');var Redis=require(_0x7a9c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a9c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7a9c('0x7'));var jayson=require(_0x7a9c('0x8'));var client=jayson['client'][_0x7a9c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d6d72,_0x261e0e,_0x4d7c30){return new BPromise(function(_0x28c1f0,_0x4d69c7){return client['request'](_0x4d6d72,_0x4d7c30)[_0x7a9c('0xa')](function(_0x559094){logger[_0x7a9c('0xb')](_0x7a9c('0xc'),_0x261e0e,_0x7a9c('0xd'));logger[_0x7a9c('0xe')](_0x7a9c('0xf'),_0x261e0e,_0x7a9c('0xd'),JSON[_0x7a9c('0x10')](_0x559094));if(_0x559094[_0x7a9c('0x11')]){if(_0x559094[_0x7a9c('0x11')][_0x7a9c('0x12')]===0x1f4){logger[_0x7a9c('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x261e0e,_0x559094['error']['message']);return _0x4d69c7(_0x559094[_0x7a9c('0x11')][_0x7a9c('0x13')]);}logger[_0x7a9c('0x11')](_0x7a9c('0xc'),_0x261e0e,_0x559094[_0x7a9c('0x11')][_0x7a9c('0x13')]);return _0x28c1f0(_0x559094[_0x7a9c('0x11')][_0x7a9c('0x13')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x261e0e,_0x7a9c('0xd'));_0x28c1f0(_0x559094[_0x7a9c('0x14')][_0x7a9c('0x13')]);}})[_0x7a9c('0x15')](function(_0x2623a7){logger[_0x7a9c('0x11')](_0x7a9c('0xc'),_0x261e0e,_0x2623a7);_0x4d69c7(_0x2623a7);});});}exports[_0x7a9c('0x16')]=function(_0x3f0330){var _0x484c58=this;return new Promise(function(_0x54a1b0,_0x4efeb3){return db[_0x7a9c('0x17')][_0x7a9c('0x18')]({'raw':_0x3f0330[_0x7a9c('0x19')]?_0x3f0330[_0x7a9c('0x19')][_0x7a9c('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f0330[_0x7a9c('0x19')]?_0x3f0330[_0x7a9c('0x19')]['where']||null:null,'attributes':_0x3f0330[_0x7a9c('0x19')]?_0x3f0330[_0x7a9c('0x19')][_0x7a9c('0x1b')]||null:null,'limit':_0x3f0330[_0x7a9c('0x19')]?_0x3f0330[_0x7a9c('0x19')][_0x7a9c('0x1c')]||null:null,'include':_0x3f0330[_0x7a9c('0x19')]?_0x3f0330[_0x7a9c('0x19')][_0x7a9c('0x1d')]?_[_0x7a9c('0x1e')](_0x3f0330['options'][_0x7a9c('0x1d')],function(_0x23ae66){return{'model':db[_0x23ae66['model']],'as':_0x23ae66['as'],'attributes':_0x23ae66[_0x7a9c('0x1b')],'include':_0x23ae66[_0x7a9c('0x1d')]?_[_0x7a9c('0x1e')](_0x23ae66['include'],function(_0x304d90){return{'model':db[_0x304d90[_0x7a9c('0x1f')]],'as':_0x304d90['as'],'attributes':_0x304d90['attributes'],'include':_0x304d90['include']?_[_0x7a9c('0x1e')](_0x304d90[_0x7a9c('0x1d')],function(_0x59b49c){return{'model':db[_0x59b49c[_0x7a9c('0x1f')]],'as':_0x59b49c['as'],'attributes':_0x59b49c['attributes']};}):[]};}):[]};}):[]:[]})[_0x7a9c('0xa')](function(_0xad5567){logger[_0x7a9c('0xb')](_0x7a9c('0x16'),_0x3f0330);logger[_0x7a9c('0xe')](_0x7a9c('0x16'),_0x3f0330,JSON[_0x7a9c('0x10')](_0xad5567));_0x54a1b0(_0xad5567);})[_0x7a9c('0x15')](function(_0x9fe1d5){logger[_0x7a9c('0x11')](_0x7a9c('0x16'),_0x9fe1d5[_0x7a9c('0x13')],_0x3f0330);_0x4efeb3(_0x484c58['error'](0x1f4,_0x9fe1d5[_0x7a9c('0x13')]));});});};exports[_0x7a9c('0x20')]=function(_0x546f90){var _0x4af3c0=this;return new Promise(function(_0x13aec7,_0x3e5f8f){return db['ServicenowAccount'][_0x7a9c('0x21')]({'raw':_0x546f90['options']?_0x546f90[_0x7a9c('0x19')][_0x7a9c('0x1a')]===undefined?!![]:![]:!![],'where':_0x546f90[_0x7a9c('0x19')]?_0x546f90['options'][_0x7a9c('0x22')]||null:null,'attributes':_0x546f90[_0x7a9c('0x19')]?_0x546f90[_0x7a9c('0x19')][_0x7a9c('0x1b')]||null:null,'include':_0x546f90['options']?_0x546f90[_0x7a9c('0x19')][_0x7a9c('0x1d')]?_[_0x7a9c('0x1e')](_0x546f90['options'][_0x7a9c('0x1d')],function(_0x5444f1){return{'model':db[_0x5444f1[_0x7a9c('0x1f')]],'as':_0x5444f1['as'],'attributes':_0x5444f1[_0x7a9c('0x1b')],'include':_0x5444f1[_0x7a9c('0x1d')]?_['map'](_0x5444f1[_0x7a9c('0x1d')],function(_0x4f9b26){return{'model':db[_0x4f9b26['model']],'as':_0x4f9b26['as'],'attributes':_0x4f9b26[_0x7a9c('0x1b')],'include':_0x4f9b26['include']?_[_0x7a9c('0x1e')](_0x4f9b26[_0x7a9c('0x1d')],function(_0x42218d){return{'model':db[_0x42218d[_0x7a9c('0x1f')]],'as':_0x42218d['as'],'attributes':_0x42218d[_0x7a9c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7a9c('0xa')](function(_0x3a3547){logger[_0x7a9c('0xb')]('ShowServicenowAccount',_0x546f90);logger[_0x7a9c('0xe')](_0x7a9c('0x20'),_0x546f90,JSON[_0x7a9c('0x10')](_0x3a3547));_0x13aec7(_0x3a3547);})['catch'](function(_0x1b2d70){logger['error'](_0x7a9c('0x20'),_0x1b2d70[_0x7a9c('0x13')],_0x546f90);_0x3e5f8f(_0x4af3c0[_0x7a9c('0x11')](0x1f4,_0x1b2d70['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index a0389e4..9578bb6 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 _0xd304=['exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','create','put','/:id','destroy'];(function(_0x46919a,_0x3c9bdd){var _0x4e9db6=function(_0x566a59){while(--_0x566a59){_0x46919a['push'](_0x46919a['shift']());}};_0x4e9db6(++_0x3c9bdd);}(_0xd304,0x1cd));var _0x4d30=function(_0x236b82,_0x2a59ca){_0x236b82=_0x236b82-0x0;var _0x1f16d7=_0xd304[_0x236b82];return _0x1f16d7;};'use strict';var multer=require('multer');var util=require(_0x4d30('0x0'));var path=require(_0x4d30('0x1'));var timeout=require(_0x4d30('0x2'));var express=require(_0x4d30('0x3'));var router=express[_0x4d30('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4d30('0x5'));var config=require(_0x4d30('0x6'));var controller=require(_0x4d30('0x7'));router[_0x4d30('0x8')]('/',auth[_0x4d30('0x9')](),controller['index']);router[_0x4d30('0x8')]('/:id',auth[_0x4d30('0x9')](),controller['show']);router[_0x4d30('0x8')](_0x4d30('0xa'),auth[_0x4d30('0x9')](),controller[_0x4d30('0xb')]);router[_0x4d30('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x4d30('0xc'),auth[_0x4d30('0x9')](),controller[_0x4d30('0xd')]);router[_0x4d30('0xe')]('/',auth['isAuthenticated'](),controller[_0x4d30('0xf')]);router[_0x4d30('0x10')]('/:id',auth[_0x4d30('0x9')](),controller['update']);router['delete'](_0x4d30('0x11'),auth[_0x4d30('0x9')](),controller[_0x4d30('0x12')]);module[_0x4d30('0x13')]=router; \ No newline at end of file +var _0x6253=['isAuthenticated','index','show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get'];(function(_0x3e0aa6,_0x1a542b){var _0x2443cb=function(_0x3578ec){while(--_0x3578ec){_0x3e0aa6['push'](_0x3e0aa6['shift']());}};_0x2443cb(++_0x1a542b);}(_0x6253,0x19a));var _0x3625=function(_0xcb0730,_0x2338c5){_0xcb0730=_0xcb0730-0x0;var _0x2e61df=_0x6253[_0xcb0730];return _0x2e61df;};'use strict';var multer=require(_0x3625('0x0'));var util=require('util');var path=require(_0x3625('0x1'));var timeout=require(_0x3625('0x2'));var express=require(_0x3625('0x3'));var router=express[_0x3625('0x4')]();var auth=require(_0x3625('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3625('0x6'));var controller=require('./intServicenowConfiguration.controller');router[_0x3625('0x7')]('/',auth[_0x3625('0x8')](),controller[_0x3625('0x9')]);router[_0x3625('0x7')]('/:id',auth[_0x3625('0x8')](),controller[_0x3625('0xa')]);router['get'](_0x3625('0xb'),auth[_0x3625('0x8')](),controller[_0x3625('0xc')]);router[_0x3625('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x3625('0xd')]);router[_0x3625('0x7')](_0x3625('0xe'),auth[_0x3625('0x8')](),controller['getDescriptions']);router[_0x3625('0xf')]('/',auth[_0x3625('0x8')](),controller[_0x3625('0x10')]);router[_0x3625('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3625('0x12')]);router[_0x3625('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x3625('0x14')]);module[_0x3625('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 907e34c..42f0877 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 _0x86c1=['STRING','exports'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x86c1,0x67));var _0x186c=function(_0xad6912,_0x38585c){_0xad6912=_0xad6912-0x0;var _0x2e64f4=_0x86c1[_0xad6912];return _0x2e64f4;};'use strict';var Sequelize=require('sequelize');module[_0x186c('0x0')]={'name':{'type':Sequelize[_0x186c('0x1')]},'description':{'type':Sequelize[_0x186c('0x1')]}}; \ No newline at end of file +var _0xda2e=['sequelize','exports','STRING'];(function(_0x1f24f8,_0x1235fb){var _0x2554d8=function(_0x20e826){while(--_0x20e826){_0x1f24f8['push'](_0x1f24f8['shift']());}};_0x2554d8(++_0x1235fb);}(_0xda2e,0xae));var _0xeda2=function(_0x373daf,_0x18b9a8){_0x373daf=_0x373daf-0x0;var _0x1fa416=_0xda2e[_0x373daf];return _0x1fa416;};'use strict';var Sequelize=require(_0xeda2('0x0'));module[_0xeda2('0x1')]={'name':{'type':Sequelize[_0xeda2('0x2')]},'description':{'type':Sequelize[_0xeda2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 73dbaf9..fe90ecc 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 _0xbb76=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','end','json','offset','set','apply','reject','save','update','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','ServicenowConfiguration','count','include','findAll','rows','show','params','keys','find','create','body','getFields','findOne','ServicenowField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x265773,_0x5d1b6e){var _0x4ed75d=function(_0x3b7ce7){while(--_0x3b7ce7){_0x265773['push'](_0x265773['shift']());}};_0x4ed75d(++_0x5d1b6e);}(_0xbb76,0x100));var _0x6bb7=function(_0x58de4a,_0x564dbc){_0x58de4a=_0x58de4a-0x0;var _0x178820=_0xbb76[_0x58de4a];return _0x178820;};'use strict';var pdf=require(_0x6bb7('0x0'));var emlformat=require(_0x6bb7('0x1'));var rimraf=require(_0x6bb7('0x2'));var zipdir=require(_0x6bb7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6bb7('0x4'));var BPromise=require(_0x6bb7('0x5'));var Mustache=require(_0x6bb7('0x6'));var util=require(_0x6bb7('0x7'));var path=require('path');var sox=require(_0x6bb7('0x8'));var csv=require(_0x6bb7('0x9'));var ejs=require(_0x6bb7('0xa'));var fs=require('fs');var _=require(_0x6bb7('0xb'));var squel=require(_0x6bb7('0xc'));var crypto=require(_0x6bb7('0xd'));var jsforce=require(_0x6bb7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6bb7('0x9'));var querystring=require(_0x6bb7('0xf'));var Papa=require(_0x6bb7('0x10'));var Redis=require(_0x6bb7('0x11'));var authService=require(_0x6bb7('0x12'));var qs=require(_0x6bb7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6bb7('0x14'));var logger=require(_0x6bb7('0x15'))(_0x6bb7('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6bb7('0x17'));var db=require(_0x6bb7('0x18'))['db'];var jayson=require(_0x6bb7('0x19'));var client=jayson[_0x6bb7('0x1a')][_0x6bb7('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x288eb0,_0x463a9f,_0x3925e5,_0x482d5f){return new BPromise(function(_0x47015a,_0x2891b3){var _0x12d3b5=_0x482d5f||client;return _0x12d3b5[_0x6bb7('0x1c')](_0x288eb0,_0x3925e5)[_0x6bb7('0x1d')](function(_0x40b67d){logger['info'](_0x6bb7('0x1e'),_0x463a9f,_0x6bb7('0x1f'));logger[_0x6bb7('0x20')](_0x6bb7('0x21'),_0x463a9f,_0x6bb7('0x1f'),JSON['stringify'](_0x40b67d));if(_0x40b67d['error']){if(_0x40b67d[_0x6bb7('0x22')][_0x6bb7('0x23')]===0x1f4){logger['error'](_0x6bb7('0x1e'),_0x463a9f,_0x40b67d[_0x6bb7('0x22')][_0x6bb7('0x24')]);return _0x2891b3(_0x40b67d[_0x6bb7('0x22')][_0x6bb7('0x24')]);}logger[_0x6bb7('0x22')](_0x6bb7('0x1e'),_0x463a9f,_0x40b67d[_0x6bb7('0x22')][_0x6bb7('0x24')]);return _0x47015a(_0x40b67d['error'][_0x6bb7('0x24')]);}else{logger[_0x6bb7('0x25')]('ServicenowConfiguration,\x20%s,\x20%s',_0x463a9f,_0x6bb7('0x1f'));_0x47015a(_0x40b67d[_0x6bb7('0x26')][_0x6bb7('0x24')]);}})[_0x6bb7('0x27')](function(_0x5389d8){logger[_0x6bb7('0x22')](_0x6bb7('0x1e'),_0x463a9f,_0x5389d8);_0x2891b3(_0x5389d8);});});}function respondWithStatusCode(_0x2ec2de,_0xcc4db3){_0xcc4db3=_0xcc4db3||0xcc;return function(_0x241365){if(_0x241365){return _0x2ec2de['sendStatus'](_0xcc4db3);}return _0x2ec2de[_0x6bb7('0x28')](_0xcc4db3)[_0x6bb7('0x29')]();};}function respondWithResult(_0x3a9429,_0x4ec176){_0x4ec176=_0x4ec176||0xc8;return function(_0xc221ef){if(_0xc221ef){return _0x3a9429[_0x6bb7('0x28')](_0x4ec176)[_0x6bb7('0x2a')](_0xc221ef);}};}function respondWithFilteredResult(_0x4ec143,_0xa2f6fa){return function(_0x1a46d6){if(_0x1a46d6){var _0x4ce4c1=_0x1a46d6['count'],_0x318b57=_0xa2f6fa[_0x6bb7('0x2b')],_0x11d6a3=_0xa2f6fa['offset']+_0xa2f6fa['limit'],_0x14fc5f;if(_0x11d6a3>=_0x4ce4c1){_0x11d6a3=_0x4ce4c1;_0x14fc5f=0xc8;}else{_0x14fc5f=0xce;}_0x4ec143['status'](_0x14fc5f);return _0x4ec143[_0x6bb7('0x2c')]('Content-Range',_0x318b57+'-'+_0x11d6a3+'/'+_0x4ce4c1)['json'](_0x1a46d6);}return null;};}function patchUpdates(_0x49c24e){return function(_0x43bbae){try{jsonpatch[_0x6bb7('0x2d')](_0x43bbae,_0x49c24e,!![]);}catch(_0x3acd42){return BPromise[_0x6bb7('0x2e')](_0x3acd42);}return _0x43bbae[_0x6bb7('0x2f')]();};}function saveUpdates(_0x3e7753,_0x5b3dc2){return function(_0x29ba32){if(_0x29ba32){return _0x29ba32[_0x6bb7('0x30')](_0x3e7753)[_0x6bb7('0x1d')](function(_0x564aa3){return _0x564aa3;});}return null;};}function removeEntity(_0x1cd037,_0x3a70e7){return function(_0x5ba89d){if(_0x5ba89d){return _0x5ba89d[_0x6bb7('0x31')]()[_0x6bb7('0x1d')](function(){_0x1cd037[_0x6bb7('0x28')](0xcc)[_0x6bb7('0x29')]();});}};}function handleEntityNotFound(_0x26d449,_0x48c125){return function(_0x573083){if(!_0x573083){_0x26d449['sendStatus'](0x194);}return _0x573083;};}function handleError(_0x432414,_0x408cd1){_0x408cd1=_0x408cd1||0x1f4;return function(_0x54d693){logger[_0x6bb7('0x22')](_0x54d693[_0x6bb7('0x32')]);if(_0x54d693[_0x6bb7('0x33')]){delete _0x54d693[_0x6bb7('0x33')];}_0x432414[_0x6bb7('0x28')](_0x408cd1)['send'](_0x54d693);};}exports[_0x6bb7('0x34')]=function(_0x484d90,_0x19bf78){var _0x1bdd2f={},_0x3f50a3={},_0x2c6d54={'count':0x0,'rows':[]};var _0x5e329a=_[_0x6bb7('0x35')](db['ServicenowConfiguration'][_0x6bb7('0x36')],function(_0x14348f){return{'name':_0x14348f[_0x6bb7('0x37')],'type':_0x14348f[_0x6bb7('0x38')][_0x6bb7('0x39')]};});_0x3f50a3[_0x6bb7('0x3a')]=_[_0x6bb7('0x35')](_0x5e329a,_0x6bb7('0x33'));_0x3f50a3[_0x6bb7('0x3b')]=_['keys'](_0x484d90['query']);_0x3f50a3[_0x6bb7('0x3c')]=_['intersection'](_0x3f50a3[_0x6bb7('0x3a')],_0x3f50a3[_0x6bb7('0x3b')]);_0x1bdd2f[_0x6bb7('0x3d')]=_[_0x6bb7('0x3e')](_0x3f50a3[_0x6bb7('0x3a')],qs[_0x6bb7('0x3f')](_0x484d90['query'][_0x6bb7('0x3f')]));_0x1bdd2f[_0x6bb7('0x3d')]=_0x1bdd2f[_0x6bb7('0x3d')][_0x6bb7('0x40')]?_0x1bdd2f['attributes']:_0x3f50a3['model'];if(!_0x484d90['query'][_0x6bb7('0x41')](_0x6bb7('0x42'))){_0x1bdd2f[_0x6bb7('0x43')]=qs[_0x6bb7('0x43')](_0x484d90[_0x6bb7('0x3b')][_0x6bb7('0x43')]);_0x1bdd2f[_0x6bb7('0x2b')]=qs['offset'](_0x484d90[_0x6bb7('0x3b')][_0x6bb7('0x2b')]);}_0x1bdd2f[_0x6bb7('0x44')]=qs[_0x6bb7('0x45')](_0x484d90[_0x6bb7('0x3b')][_0x6bb7('0x45')]);_0x1bdd2f['where']=qs[_0x6bb7('0x3c')](_[_0x6bb7('0x46')](_0x484d90[_0x6bb7('0x3b')],_0x3f50a3[_0x6bb7('0x3c')]),_0x5e329a);if(_0x484d90[_0x6bb7('0x3b')][_0x6bb7('0x47')]){_0x1bdd2f[_0x6bb7('0x48')]=_[_0x6bb7('0x49')](_0x1bdd2f['where'],{'$or':_['map'](_0x5e329a,function(_0x19ff1d){if(_0x19ff1d['type']!=='VIRTUAL'){var _0x5d3ff9={};_0x5d3ff9[_0x19ff1d['name']]={'$like':'%'+_0x484d90['query'][_0x6bb7('0x47')]+'%'};return _0x5d3ff9;}})});}_0x1bdd2f=_[_0x6bb7('0x49')]({},_0x1bdd2f,_0x484d90[_0x6bb7('0x4a')]);var _0x183605={'where':_0x1bdd2f[_0x6bb7('0x48')]};return db[_0x6bb7('0x4b')]['count'](_0x183605)['then'](function(_0x22ed48){_0x2c6d54[_0x6bb7('0x4c')]=_0x22ed48;if(_0x484d90[_0x6bb7('0x3b')]['includeAll']){_0x1bdd2f[_0x6bb7('0x4d')]=[{'all':!![]}];}return db[_0x6bb7('0x4b')][_0x6bb7('0x4e')](_0x1bdd2f);})[_0x6bb7('0x1d')](function(_0x4708bc){_0x2c6d54[_0x6bb7('0x4f')]=_0x4708bc;return _0x2c6d54;})[_0x6bb7('0x1d')](respondWithFilteredResult(_0x19bf78,_0x1bdd2f))[_0x6bb7('0x27')](handleError(_0x19bf78,null));};exports[_0x6bb7('0x50')]=function(_0x3e6808,_0x3e1805){var _0x5423b7={'raw':![],'where':{'id':_0x3e6808[_0x6bb7('0x51')]['id']}},_0x4cbbd5={};_0x4cbbd5[_0x6bb7('0x3a')]=_[_0x6bb7('0x52')](db['ServicenowConfiguration'][_0x6bb7('0x36')]);_0x4cbbd5['query']=_[_0x6bb7('0x52')](_0x3e6808[_0x6bb7('0x3b')]);_0x4cbbd5[_0x6bb7('0x3c')]=_[_0x6bb7('0x3e')](_0x4cbbd5[_0x6bb7('0x3a')],_0x4cbbd5[_0x6bb7('0x3b')]);_0x5423b7[_0x6bb7('0x3d')]=_[_0x6bb7('0x3e')](_0x4cbbd5[_0x6bb7('0x3a')],qs[_0x6bb7('0x3f')](_0x3e6808[_0x6bb7('0x3b')][_0x6bb7('0x3f')]));_0x5423b7[_0x6bb7('0x3d')]=_0x5423b7['attributes'][_0x6bb7('0x40')]?_0x5423b7[_0x6bb7('0x3d')]:_0x4cbbd5['model'];if(_0x3e6808['query']['includeAll']){_0x5423b7[_0x6bb7('0x4d')]=[{'all':!![]}];}_0x5423b7=_['merge']({},_0x5423b7,_0x3e6808[_0x6bb7('0x4a')]);return db['ServicenowConfiguration'][_0x6bb7('0x53')](_0x5423b7)[_0x6bb7('0x1d')](handleEntityNotFound(_0x3e1805,null))[_0x6bb7('0x1d')](respondWithResult(_0x3e1805,null))['catch'](handleError(_0x3e1805,null));};exports[_0x6bb7('0x54')]=function(_0x58ee7c,_0x56b16d){return db[_0x6bb7('0x4b')][_0x6bb7('0x54')](_0x58ee7c[_0x6bb7('0x55')],{})[_0x6bb7('0x1d')](respondWithResult(_0x56b16d,0xc9))[_0x6bb7('0x27')](handleError(_0x56b16d,null));};exports[_0x6bb7('0x30')]=function(_0x39ee4c,_0x55e9b8){if(_0x39ee4c[_0x6bb7('0x55')]['id']){delete _0x39ee4c[_0x6bb7('0x55')]['id'];}return db[_0x6bb7('0x4b')][_0x6bb7('0x53')]({'where':{'id':_0x39ee4c[_0x6bb7('0x51')]['id']}})[_0x6bb7('0x1d')](handleEntityNotFound(_0x55e9b8,null))['then'](saveUpdates(_0x39ee4c[_0x6bb7('0x55')],null))[_0x6bb7('0x1d')](respondWithResult(_0x55e9b8,null))[_0x6bb7('0x27')](handleError(_0x55e9b8,null));};exports[_0x6bb7('0x31')]=function(_0x1e0ec4,_0x1a8fd5){return db['ServicenowConfiguration'][_0x6bb7('0x53')]({'where':{'id':_0x1e0ec4[_0x6bb7('0x51')]['id']}})[_0x6bb7('0x1d')](handleEntityNotFound(_0x1a8fd5,null))['then'](removeEntity(_0x1a8fd5,null))['catch'](handleError(_0x1a8fd5,null));};exports[_0x6bb7('0x56')]=function(_0x594fb5,_0x50cba1,_0x450227){var _0x3a94f2={};var _0x495d3b={};var _0x246237;var _0x78ad43;return db['ServicenowConfiguration'][_0x6bb7('0x57')]({'where':{'id':_0x594fb5[_0x6bb7('0x51')]['id']}})[_0x6bb7('0x1d')](handleEntityNotFound(_0x50cba1,null))[_0x6bb7('0x1d')](function(_0x410bee){if(_0x410bee){_0x246237=_0x410bee;_0x495d3b[_0x6bb7('0x3a')]=_[_0x6bb7('0x52')](db[_0x6bb7('0x58')][_0x6bb7('0x36')]);_0x495d3b[_0x6bb7('0x3b')]=_['keys'](_0x594fb5[_0x6bb7('0x3b')]);_0x495d3b[_0x6bb7('0x3c')]=_['intersection'](_0x495d3b[_0x6bb7('0x3a')],_0x495d3b[_0x6bb7('0x3b')]);_0x3a94f2[_0x6bb7('0x3d')]=_[_0x6bb7('0x3e')](_0x495d3b[_0x6bb7('0x3a')],qs[_0x6bb7('0x3f')](_0x594fb5[_0x6bb7('0x3b')][_0x6bb7('0x3f')]));_0x3a94f2[_0x6bb7('0x3d')]=_0x3a94f2['attributes'][_0x6bb7('0x40')]?_0x3a94f2['attributes']:_0x495d3b['model'];_0x3a94f2['order']=qs[_0x6bb7('0x45')](_0x594fb5[_0x6bb7('0x3b')][_0x6bb7('0x45')]);_0x3a94f2[_0x6bb7('0x48')]=qs[_0x6bb7('0x3c')](_[_0x6bb7('0x46')](_0x594fb5[_0x6bb7('0x3b')],_0x495d3b[_0x6bb7('0x3c')]));if(_0x594fb5['query'][_0x6bb7('0x47')]){_0x3a94f2[_0x6bb7('0x48')]=_[_0x6bb7('0x49')](_0x3a94f2[_0x6bb7('0x48')],{'$or':_[_0x6bb7('0x35')](_0x3a94f2[_0x6bb7('0x3d')],function(_0x36ce33){var _0x3458f6={};_0x3458f6[_0x36ce33]={'$like':'%'+_0x594fb5['query'][_0x6bb7('0x47')]+'%'};return _0x3458f6;})});}_0x3a94f2=_[_0x6bb7('0x49')]({},_0x3a94f2,_0x594fb5[_0x6bb7('0x4a')]);return _0x246237[_0x6bb7('0x56')](_0x3a94f2);}})['then'](function(_0x46bfaf){if(_0x46bfaf){_0x78ad43=_0x46bfaf[_0x6bb7('0x40')];if(!_0x594fb5[_0x6bb7('0x3b')][_0x6bb7('0x41')](_0x6bb7('0x42'))){_0x3a94f2[_0x6bb7('0x43')]=qs['limit'](_0x594fb5['query'][_0x6bb7('0x43')]);_0x3a94f2[_0x6bb7('0x2b')]=qs[_0x6bb7('0x2b')](_0x594fb5['query']['offset']);}return _0x246237[_0x6bb7('0x56')](_0x3a94f2);}})['then'](function(_0x57d855){if(_0x57d855){return _0x57d855?{'count':_0x78ad43,'rows':_0x57d855}:null;}})['then'](respondWithResult(_0x50cba1,null))[_0x6bb7('0x27')](handleError(_0x50cba1,null));};exports[_0x6bb7('0x59')]=function(_0x460f13,_0x312f83,_0x2ff28d){var _0x1968f6={};var _0x3e650b={};var _0x185505;var _0x27ff49;return db['ServicenowConfiguration'][_0x6bb7('0x57')]({'where':{'id':_0x460f13[_0x6bb7('0x51')]['id']}})['then'](handleEntityNotFound(_0x312f83,null))[_0x6bb7('0x1d')](function(_0x55296b){if(_0x55296b){_0x185505=_0x55296b;_0x3e650b['model']=_[_0x6bb7('0x52')](db[_0x6bb7('0x58')]['rawAttributes']);_0x3e650b[_0x6bb7('0x3b')]=_['keys'](_0x460f13[_0x6bb7('0x3b')]);_0x3e650b[_0x6bb7('0x3c')]=_[_0x6bb7('0x3e')](_0x3e650b[_0x6bb7('0x3a')],_0x3e650b[_0x6bb7('0x3b')]);_0x1968f6['attributes']=_[_0x6bb7('0x3e')](_0x3e650b[_0x6bb7('0x3a')],qs[_0x6bb7('0x3f')](_0x460f13[_0x6bb7('0x3b')]['fields']));_0x1968f6['attributes']=_0x1968f6[_0x6bb7('0x3d')]['length']?_0x1968f6['attributes']:_0x3e650b[_0x6bb7('0x3a')];_0x1968f6[_0x6bb7('0x44')]=qs[_0x6bb7('0x45')](_0x460f13['query'][_0x6bb7('0x45')]);_0x1968f6[_0x6bb7('0x48')]=qs[_0x6bb7('0x3c')](_[_0x6bb7('0x46')](_0x460f13['query'],_0x3e650b[_0x6bb7('0x3c')]));if(_0x460f13[_0x6bb7('0x3b')][_0x6bb7('0x47')]){_0x1968f6[_0x6bb7('0x48')]=_[_0x6bb7('0x49')](_0x1968f6['where'],{'$or':_[_0x6bb7('0x35')](_0x1968f6['attributes'],function(_0x56b3a5){var _0x237ae3={};_0x237ae3[_0x56b3a5]={'$like':'%'+_0x460f13['query'][_0x6bb7('0x47')]+'%'};return _0x237ae3;})});}_0x1968f6=_[_0x6bb7('0x49')]({},_0x1968f6,_0x460f13[_0x6bb7('0x4a')]);return _0x185505['getSubjects'](_0x1968f6);}})[_0x6bb7('0x1d')](function(_0xd7365e){if(_0xd7365e){_0x27ff49=_0xd7365e[_0x6bb7('0x40')];if(!_0x460f13[_0x6bb7('0x3b')][_0x6bb7('0x41')](_0x6bb7('0x42'))){_0x1968f6[_0x6bb7('0x43')]=qs[_0x6bb7('0x43')](_0x460f13[_0x6bb7('0x3b')][_0x6bb7('0x43')]);_0x1968f6['offset']=qs['offset'](_0x460f13[_0x6bb7('0x3b')][_0x6bb7('0x2b')]);}return _0x185505[_0x6bb7('0x59')](_0x1968f6);}})[_0x6bb7('0x1d')](function(_0x2fa350){if(_0x2fa350){return _0x2fa350?{'count':_0x27ff49,'rows':_0x2fa350}:null;}})[_0x6bb7('0x1d')](respondWithResult(_0x312f83,null))[_0x6bb7('0x27')](handleError(_0x312f83,null));};exports[_0x6bb7('0x5a')]=function(_0x45a976,_0x39f111,_0x5e7c53){var _0x190970={};var _0x5d8c46={};var _0x5af8ca;var _0x4b8ec8;return db[_0x6bb7('0x4b')]['findOne']({'where':{'id':_0x45a976[_0x6bb7('0x51')]['id']}})[_0x6bb7('0x1d')](handleEntityNotFound(_0x39f111,null))[_0x6bb7('0x1d')](function(_0x37f9bc){if(_0x37f9bc){_0x5af8ca=_0x37f9bc;_0x5d8c46[_0x6bb7('0x3a')]=_[_0x6bb7('0x52')](db[_0x6bb7('0x58')]['rawAttributes']);_0x5d8c46[_0x6bb7('0x3b')]=_[_0x6bb7('0x52')](_0x45a976[_0x6bb7('0x3b')]);_0x5d8c46['filters']=_[_0x6bb7('0x3e')](_0x5d8c46[_0x6bb7('0x3a')],_0x5d8c46[_0x6bb7('0x3b')]);_0x190970[_0x6bb7('0x3d')]=_[_0x6bb7('0x3e')](_0x5d8c46[_0x6bb7('0x3a')],qs[_0x6bb7('0x3f')](_0x45a976[_0x6bb7('0x3b')][_0x6bb7('0x3f')]));_0x190970[_0x6bb7('0x3d')]=_0x190970['attributes'][_0x6bb7('0x40')]?_0x190970[_0x6bb7('0x3d')]:_0x5d8c46[_0x6bb7('0x3a')];_0x190970['order']=qs[_0x6bb7('0x45')](_0x45a976[_0x6bb7('0x3b')][_0x6bb7('0x45')]);_0x190970['where']=qs['filters'](_[_0x6bb7('0x46')](_0x45a976[_0x6bb7('0x3b')],_0x5d8c46[_0x6bb7('0x3c')]));if(_0x45a976[_0x6bb7('0x3b')][_0x6bb7('0x47')]){_0x190970[_0x6bb7('0x48')]=_[_0x6bb7('0x49')](_0x190970['where'],{'$or':_['map'](_0x190970['attributes'],function(_0x9c0043){var _0x53293a={};_0x53293a[_0x9c0043]={'$like':'%'+_0x45a976[_0x6bb7('0x3b')][_0x6bb7('0x47')]+'%'};return _0x53293a;})});}_0x190970=_[_0x6bb7('0x49')]({},_0x190970,_0x45a976[_0x6bb7('0x4a')]);return _0x5af8ca[_0x6bb7('0x5a')](_0x190970);}})[_0x6bb7('0x1d')](function(_0x2053bf){if(_0x2053bf){_0x4b8ec8=_0x2053bf['length'];if(!_0x45a976[_0x6bb7('0x3b')][_0x6bb7('0x41')](_0x6bb7('0x42'))){_0x190970[_0x6bb7('0x43')]=qs['limit'](_0x45a976['query']['limit']);_0x190970[_0x6bb7('0x2b')]=qs[_0x6bb7('0x2b')](_0x45a976[_0x6bb7('0x3b')][_0x6bb7('0x2b')]);}return _0x5af8ca[_0x6bb7('0x5a')](_0x190970);}})[_0x6bb7('0x1d')](function(_0x30b809){if(_0x30b809){return _0x30b809?{'count':_0x4b8ec8,'rows':_0x30b809}:null;}})[_0x6bb7('0x1d')](respondWithResult(_0x39f111,null))[_0x6bb7('0x27')](handleError(_0x39f111,null));}; \ No newline at end of file +var _0xc6b5=['reject','save','update','then','destroy','end','stack','name','send','index','map','ServicenowConfiguration','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','show','params','rawAttributes','intersection','options','create','body','find','getFields','findOne','ServicenowField','nolimit','getSubjects','getDescriptions','html-pdf','fast-json-patch','request-promise','moment','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply'];(function(_0x5d1761,_0x5057c2){var _0x5dccb=function(_0x5a446d){while(--_0x5a446d){_0x5d1761['push'](_0x5d1761['shift']());}};_0x5dccb(++_0x5057c2);}(_0xc6b5,0x81));var _0x5c6b=function(_0x5a62f1,_0x50a384){_0x5a62f1=_0x5a62f1-0x0;var _0x42c93c=_0xc6b5[_0x5a62f1];return _0x42c93c;};'use strict';var pdf=require(_0x5c6b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5c6b('0x1'));var rp=require(_0x5c6b('0x2'));var moment=require(_0x5c6b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5c6b('0x4'));var sox=require(_0x5c6b('0x5'));var csv=require('to-csv');var ejs=require(_0x5c6b('0x6'));var fs=require('fs');var _=require(_0x5c6b('0x7'));var squel=require(_0x5c6b('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5c6b('0x9'));var toCsv=require(_0x5c6b('0xa'));var querystring=require(_0x5c6b('0xb'));var Papa=require(_0x5c6b('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5c6b('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c6b('0xe'))(_0x5c6b('0xf'));var utils=require(_0x5c6b('0x10'));var config=require(_0x5c6b('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x5c6b('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x6f0770,_0x46c9a6,_0x2bdac9,_0x787425){return new BPromise(function(_0x2d5482,_0x58d1a2){var _0x22d4f2=_0x787425||client;return _0x22d4f2[_0x5c6b('0x13')](_0x6f0770,_0x2bdac9)['then'](function(_0x1dca01){logger[_0x5c6b('0x14')](_0x5c6b('0x15'),_0x46c9a6,'request\x20sent');logger[_0x5c6b('0x16')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x46c9a6,'request\x20sent',JSON['stringify'](_0x1dca01));if(_0x1dca01['error']){if(_0x1dca01[_0x5c6b('0x17')][_0x5c6b('0x18')]===0x1f4){logger['error'](_0x5c6b('0x15'),_0x46c9a6,_0x1dca01['error'][_0x5c6b('0x19')]);return _0x58d1a2(_0x1dca01[_0x5c6b('0x17')][_0x5c6b('0x19')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x46c9a6,_0x1dca01[_0x5c6b('0x17')][_0x5c6b('0x19')]);return _0x2d5482(_0x1dca01[_0x5c6b('0x17')][_0x5c6b('0x19')]);}else{logger[_0x5c6b('0x14')](_0x5c6b('0x15'),_0x46c9a6,_0x5c6b('0x1a'));_0x2d5482(_0x1dca01[_0x5c6b('0x1b')]['message']);}})[_0x5c6b('0x1c')](function(_0x322ba1){logger[_0x5c6b('0x17')](_0x5c6b('0x15'),_0x46c9a6,_0x322ba1);_0x58d1a2(_0x322ba1);});});}function respondWithStatusCode(_0x2ac161,_0x1eef4a){_0x1eef4a=_0x1eef4a||0xcc;return function(_0x56ecc7){if(_0x56ecc7){return _0x2ac161[_0x5c6b('0x1d')](_0x1eef4a);}return _0x2ac161[_0x5c6b('0x1e')](_0x1eef4a)['end']();};}function respondWithResult(_0x599888,_0x31d18d){_0x31d18d=_0x31d18d||0xc8;return function(_0x2fcd1d){if(_0x2fcd1d){return _0x599888[_0x5c6b('0x1e')](_0x31d18d)[_0x5c6b('0x1f')](_0x2fcd1d);}};}function respondWithFilteredResult(_0x1e531e,_0x1ee152){return function(_0x43abe0){if(_0x43abe0){var _0x282803=_0x43abe0[_0x5c6b('0x20')],_0x215249=_0x1ee152[_0x5c6b('0x21')],_0x17a3ec=_0x1ee152[_0x5c6b('0x21')]+_0x1ee152[_0x5c6b('0x22')],_0x495b29;if(_0x17a3ec>=_0x282803){_0x17a3ec=_0x282803;_0x495b29=0xc8;}else{_0x495b29=0xce;}_0x1e531e[_0x5c6b('0x1e')](_0x495b29);return _0x1e531e['set'](_0x5c6b('0x23'),_0x215249+'-'+_0x17a3ec+'/'+_0x282803)[_0x5c6b('0x1f')](_0x43abe0);}return null;};}function patchUpdates(_0xb922fd){return function(_0x582b0d){try{jsonpatch[_0x5c6b('0x24')](_0x582b0d,_0xb922fd,!![]);}catch(_0x3de117){return BPromise[_0x5c6b('0x25')](_0x3de117);}return _0x582b0d[_0x5c6b('0x26')]();};}function saveUpdates(_0x1c35c9,_0x4fe0b6){return function(_0x30b22c){if(_0x30b22c){return _0x30b22c[_0x5c6b('0x27')](_0x1c35c9)[_0x5c6b('0x28')](function(_0xa3871a){return _0xa3871a;});}return null;};}function removeEntity(_0x184140,_0x3a906e){return function(_0x43eda8){if(_0x43eda8){return _0x43eda8[_0x5c6b('0x29')]()[_0x5c6b('0x28')](function(){_0x184140[_0x5c6b('0x1e')](0xcc)[_0x5c6b('0x2a')]();});}};}function handleEntityNotFound(_0x1aa9f3,_0x3e5afb){return function(_0x5575e0){if(!_0x5575e0){_0x1aa9f3['sendStatus'](0x194);}return _0x5575e0;};}function handleError(_0xd8245c,_0x152e27){_0x152e27=_0x152e27||0x1f4;return function(_0x199491){logger[_0x5c6b('0x17')](_0x199491[_0x5c6b('0x2b')]);if(_0x199491[_0x5c6b('0x2c')]){delete _0x199491[_0x5c6b('0x2c')];}_0xd8245c[_0x5c6b('0x1e')](_0x152e27)[_0x5c6b('0x2d')](_0x199491);};}exports[_0x5c6b('0x2e')]=function(_0x36c56d,_0x4c8289){var _0x50dc59={},_0x3bddf1={},_0x45cdfb={'count':0x0,'rows':[]};var _0x4b5fbf=_[_0x5c6b('0x2f')](db[_0x5c6b('0x30')]['rawAttributes'],function(_0x4d631b){return{'name':_0x4d631b[_0x5c6b('0x31')],'type':_0x4d631b[_0x5c6b('0x32')][_0x5c6b('0x33')]};});_0x3bddf1[_0x5c6b('0x34')]=_[_0x5c6b('0x2f')](_0x4b5fbf,_0x5c6b('0x2c'));_0x3bddf1['query']=_[_0x5c6b('0x35')](_0x36c56d[_0x5c6b('0x36')]);_0x3bddf1[_0x5c6b('0x37')]=_['intersection'](_0x3bddf1[_0x5c6b('0x34')],_0x3bddf1['query']);_0x50dc59[_0x5c6b('0x38')]=_['intersection'](_0x3bddf1[_0x5c6b('0x34')],qs['fields'](_0x36c56d[_0x5c6b('0x36')][_0x5c6b('0x39')]));_0x50dc59[_0x5c6b('0x38')]=_0x50dc59[_0x5c6b('0x38')][_0x5c6b('0x3a')]?_0x50dc59['attributes']:_0x3bddf1['model'];if(!_0x36c56d[_0x5c6b('0x36')][_0x5c6b('0x3b')]('nolimit')){_0x50dc59[_0x5c6b('0x22')]=qs['limit'](_0x36c56d['query'][_0x5c6b('0x22')]);_0x50dc59[_0x5c6b('0x21')]=qs[_0x5c6b('0x21')](_0x36c56d[_0x5c6b('0x36')][_0x5c6b('0x21')]);}_0x50dc59[_0x5c6b('0x3c')]=qs[_0x5c6b('0x3d')](_0x36c56d[_0x5c6b('0x36')]['sort']);_0x50dc59[_0x5c6b('0x3e')]=qs[_0x5c6b('0x37')](_[_0x5c6b('0x3f')](_0x36c56d[_0x5c6b('0x36')],_0x3bddf1[_0x5c6b('0x37')]),_0x4b5fbf);if(_0x36c56d[_0x5c6b('0x36')]['filter']){_0x50dc59[_0x5c6b('0x3e')]=_[_0x5c6b('0x40')](_0x50dc59[_0x5c6b('0x3e')],{'$or':_[_0x5c6b('0x2f')](_0x4b5fbf,function(_0x503339){if(_0x503339[_0x5c6b('0x32')]!==_0x5c6b('0x41')){var _0x4cc3cd={};_0x4cc3cd[_0x503339[_0x5c6b('0x2c')]]={'$like':'%'+_0x36c56d[_0x5c6b('0x36')][_0x5c6b('0x42')]+'%'};return _0x4cc3cd;}})});}_0x50dc59=_[_0x5c6b('0x40')]({},_0x50dc59,_0x36c56d['options']);var _0x2a3b3a={'where':_0x50dc59[_0x5c6b('0x3e')]};return db['ServicenowConfiguration'][_0x5c6b('0x20')](_0x2a3b3a)['then'](function(_0x30cd4f){_0x45cdfb[_0x5c6b('0x20')]=_0x30cd4f;if(_0x36c56d[_0x5c6b('0x36')][_0x5c6b('0x43')]){_0x50dc59[_0x5c6b('0x44')]=[{'all':!![]}];}return db[_0x5c6b('0x30')]['findAll'](_0x50dc59);})[_0x5c6b('0x28')](function(_0x6aaab7){_0x45cdfb['rows']=_0x6aaab7;return _0x45cdfb;})['then'](respondWithFilteredResult(_0x4c8289,_0x50dc59))[_0x5c6b('0x1c')](handleError(_0x4c8289,null));};exports[_0x5c6b('0x45')]=function(_0x3e51c6,_0x57279c){var _0xa58eca={'raw':![],'where':{'id':_0x3e51c6[_0x5c6b('0x46')]['id']}},_0x3a6753={};_0x3a6753[_0x5c6b('0x34')]=_[_0x5c6b('0x35')](db[_0x5c6b('0x30')][_0x5c6b('0x47')]);_0x3a6753[_0x5c6b('0x36')]=_[_0x5c6b('0x35')](_0x3e51c6[_0x5c6b('0x36')]);_0x3a6753[_0x5c6b('0x37')]=_['intersection'](_0x3a6753[_0x5c6b('0x34')],_0x3a6753['query']);_0xa58eca[_0x5c6b('0x38')]=_[_0x5c6b('0x48')](_0x3a6753[_0x5c6b('0x34')],qs[_0x5c6b('0x39')](_0x3e51c6[_0x5c6b('0x36')][_0x5c6b('0x39')]));_0xa58eca[_0x5c6b('0x38')]=_0xa58eca[_0x5c6b('0x38')]['length']?_0xa58eca[_0x5c6b('0x38')]:_0x3a6753[_0x5c6b('0x34')];if(_0x3e51c6['query'][_0x5c6b('0x43')]){_0xa58eca[_0x5c6b('0x44')]=[{'all':!![]}];}_0xa58eca=_[_0x5c6b('0x40')]({},_0xa58eca,_0x3e51c6[_0x5c6b('0x49')]);return db['ServicenowConfiguration']['find'](_0xa58eca)['then'](handleEntityNotFound(_0x57279c,null))[_0x5c6b('0x28')](respondWithResult(_0x57279c,null))[_0x5c6b('0x1c')](handleError(_0x57279c,null));};exports['create']=function(_0x1add24,_0x49c2ca){return db[_0x5c6b('0x30')][_0x5c6b('0x4a')](_0x1add24[_0x5c6b('0x4b')],{})['then'](respondWithResult(_0x49c2ca,0xc9))['catch'](handleError(_0x49c2ca,null));};exports['update']=function(_0x2c8cc7,_0x3785c1){if(_0x2c8cc7[_0x5c6b('0x4b')]['id']){delete _0x2c8cc7[_0x5c6b('0x4b')]['id'];}return db[_0x5c6b('0x30')][_0x5c6b('0x4c')]({'where':{'id':_0x2c8cc7[_0x5c6b('0x46')]['id']}})[_0x5c6b('0x28')](handleEntityNotFound(_0x3785c1,null))['then'](saveUpdates(_0x2c8cc7[_0x5c6b('0x4b')],null))[_0x5c6b('0x28')](respondWithResult(_0x3785c1,null))[_0x5c6b('0x1c')](handleError(_0x3785c1,null));};exports[_0x5c6b('0x29')]=function(_0xb496ac,_0x2a1a54){return db[_0x5c6b('0x30')][_0x5c6b('0x4c')]({'where':{'id':_0xb496ac[_0x5c6b('0x46')]['id']}})[_0x5c6b('0x28')](handleEntityNotFound(_0x2a1a54,null))[_0x5c6b('0x28')](removeEntity(_0x2a1a54,null))[_0x5c6b('0x1c')](handleError(_0x2a1a54,null));};exports[_0x5c6b('0x4d')]=function(_0x44cb0d,_0x156377,_0x45bff0){var _0x47f504={};var _0x15e6bb={};var _0x3d1272;var _0x3082fb;return db[_0x5c6b('0x30')][_0x5c6b('0x4e')]({'where':{'id':_0x44cb0d['params']['id']}})['then'](handleEntityNotFound(_0x156377,null))[_0x5c6b('0x28')](function(_0x6416de){if(_0x6416de){_0x3d1272=_0x6416de;_0x15e6bb[_0x5c6b('0x34')]=_[_0x5c6b('0x35')](db[_0x5c6b('0x4f')][_0x5c6b('0x47')]);_0x15e6bb[_0x5c6b('0x36')]=_[_0x5c6b('0x35')](_0x44cb0d[_0x5c6b('0x36')]);_0x15e6bb[_0x5c6b('0x37')]=_[_0x5c6b('0x48')](_0x15e6bb[_0x5c6b('0x34')],_0x15e6bb['query']);_0x47f504[_0x5c6b('0x38')]=_['intersection'](_0x15e6bb[_0x5c6b('0x34')],qs[_0x5c6b('0x39')](_0x44cb0d['query'][_0x5c6b('0x39')]));_0x47f504[_0x5c6b('0x38')]=_0x47f504[_0x5c6b('0x38')][_0x5c6b('0x3a')]?_0x47f504[_0x5c6b('0x38')]:_0x15e6bb[_0x5c6b('0x34')];_0x47f504['order']=qs[_0x5c6b('0x3d')](_0x44cb0d[_0x5c6b('0x36')][_0x5c6b('0x3d')]);_0x47f504[_0x5c6b('0x3e')]=qs['filters'](_[_0x5c6b('0x3f')](_0x44cb0d['query'],_0x15e6bb[_0x5c6b('0x37')]));if(_0x44cb0d[_0x5c6b('0x36')][_0x5c6b('0x42')]){_0x47f504[_0x5c6b('0x3e')]=_[_0x5c6b('0x40')](_0x47f504[_0x5c6b('0x3e')],{'$or':_[_0x5c6b('0x2f')](_0x47f504[_0x5c6b('0x38')],function(_0x514623){var _0x97ef16={};_0x97ef16[_0x514623]={'$like':'%'+_0x44cb0d[_0x5c6b('0x36')]['filter']+'%'};return _0x97ef16;})});}_0x47f504=_[_0x5c6b('0x40')]({},_0x47f504,_0x44cb0d[_0x5c6b('0x49')]);return _0x3d1272[_0x5c6b('0x4d')](_0x47f504);}})[_0x5c6b('0x28')](function(_0xa97eeb){if(_0xa97eeb){_0x3082fb=_0xa97eeb['length'];if(!_0x44cb0d[_0x5c6b('0x36')][_0x5c6b('0x3b')](_0x5c6b('0x50'))){_0x47f504[_0x5c6b('0x22')]=qs['limit'](_0x44cb0d['query']['limit']);_0x47f504[_0x5c6b('0x21')]=qs['offset'](_0x44cb0d[_0x5c6b('0x36')][_0x5c6b('0x21')]);}return _0x3d1272[_0x5c6b('0x4d')](_0x47f504);}})['then'](function(_0x526c17){if(_0x526c17){return _0x526c17?{'count':_0x3082fb,'rows':_0x526c17}:null;}})[_0x5c6b('0x28')](respondWithResult(_0x156377,null))[_0x5c6b('0x1c')](handleError(_0x156377,null));};exports[_0x5c6b('0x51')]=function(_0x3f9659,_0xb9afe3,_0x53216f){var _0x4c61c5={};var _0x267d6c={};var _0x18d271;var _0x5329e1;return db['ServicenowConfiguration'][_0x5c6b('0x4e')]({'where':{'id':_0x3f9659[_0x5c6b('0x46')]['id']}})[_0x5c6b('0x28')](handleEntityNotFound(_0xb9afe3,null))[_0x5c6b('0x28')](function(_0x2de5c3){if(_0x2de5c3){_0x18d271=_0x2de5c3;_0x267d6c['model']=_[_0x5c6b('0x35')](db[_0x5c6b('0x4f')]['rawAttributes']);_0x267d6c[_0x5c6b('0x36')]=_[_0x5c6b('0x35')](_0x3f9659['query']);_0x267d6c[_0x5c6b('0x37')]=_['intersection'](_0x267d6c['model'],_0x267d6c[_0x5c6b('0x36')]);_0x4c61c5[_0x5c6b('0x38')]=_[_0x5c6b('0x48')](_0x267d6c[_0x5c6b('0x34')],qs['fields'](_0x3f9659['query'][_0x5c6b('0x39')]));_0x4c61c5[_0x5c6b('0x38')]=_0x4c61c5[_0x5c6b('0x38')][_0x5c6b('0x3a')]?_0x4c61c5[_0x5c6b('0x38')]:_0x267d6c[_0x5c6b('0x34')];_0x4c61c5[_0x5c6b('0x3c')]=qs['sort'](_0x3f9659[_0x5c6b('0x36')]['sort']);_0x4c61c5[_0x5c6b('0x3e')]=qs[_0x5c6b('0x37')](_[_0x5c6b('0x3f')](_0x3f9659[_0x5c6b('0x36')],_0x267d6c[_0x5c6b('0x37')]));if(_0x3f9659[_0x5c6b('0x36')]['filter']){_0x4c61c5[_0x5c6b('0x3e')]=_['merge'](_0x4c61c5[_0x5c6b('0x3e')],{'$or':_[_0x5c6b('0x2f')](_0x4c61c5['attributes'],function(_0x4d2a5a){var _0x61523a={};_0x61523a[_0x4d2a5a]={'$like':'%'+_0x3f9659['query']['filter']+'%'};return _0x61523a;})});}_0x4c61c5=_[_0x5c6b('0x40')]({},_0x4c61c5,_0x3f9659[_0x5c6b('0x49')]);return _0x18d271[_0x5c6b('0x51')](_0x4c61c5);}})['then'](function(_0x44b82d){if(_0x44b82d){_0x5329e1=_0x44b82d[_0x5c6b('0x3a')];if(!_0x3f9659[_0x5c6b('0x36')][_0x5c6b('0x3b')]('nolimit')){_0x4c61c5[_0x5c6b('0x22')]=qs[_0x5c6b('0x22')](_0x3f9659[_0x5c6b('0x36')]['limit']);_0x4c61c5[_0x5c6b('0x21')]=qs[_0x5c6b('0x21')](_0x3f9659[_0x5c6b('0x36')][_0x5c6b('0x21')]);}return _0x18d271[_0x5c6b('0x51')](_0x4c61c5);}})[_0x5c6b('0x28')](function(_0x51f96f){if(_0x51f96f){return _0x51f96f?{'count':_0x5329e1,'rows':_0x51f96f}:null;}})[_0x5c6b('0x28')](respondWithResult(_0xb9afe3,null))[_0x5c6b('0x1c')](handleError(_0xb9afe3,null));};exports[_0x5c6b('0x52')]=function(_0x583d78,_0x3f06a2,_0x197ad7){var _0x4259e3={};var _0x4edb84={};var _0x4a0c8b;var _0x3b8835;return db[_0x5c6b('0x30')]['findOne']({'where':{'id':_0x583d78['params']['id']}})[_0x5c6b('0x28')](handleEntityNotFound(_0x3f06a2,null))[_0x5c6b('0x28')](function(_0x1bfe8f){if(_0x1bfe8f){_0x4a0c8b=_0x1bfe8f;_0x4edb84[_0x5c6b('0x34')]=_[_0x5c6b('0x35')](db['ServicenowField'][_0x5c6b('0x47')]);_0x4edb84[_0x5c6b('0x36')]=_[_0x5c6b('0x35')](_0x583d78['query']);_0x4edb84['filters']=_[_0x5c6b('0x48')](_0x4edb84[_0x5c6b('0x34')],_0x4edb84[_0x5c6b('0x36')]);_0x4259e3['attributes']=_[_0x5c6b('0x48')](_0x4edb84['model'],qs['fields'](_0x583d78[_0x5c6b('0x36')]['fields']));_0x4259e3[_0x5c6b('0x38')]=_0x4259e3['attributes']['length']?_0x4259e3[_0x5c6b('0x38')]:_0x4edb84['model'];_0x4259e3[_0x5c6b('0x3c')]=qs[_0x5c6b('0x3d')](_0x583d78[_0x5c6b('0x36')]['sort']);_0x4259e3['where']=qs[_0x5c6b('0x37')](_[_0x5c6b('0x3f')](_0x583d78[_0x5c6b('0x36')],_0x4edb84[_0x5c6b('0x37')]));if(_0x583d78[_0x5c6b('0x36')][_0x5c6b('0x42')]){_0x4259e3[_0x5c6b('0x3e')]=_[_0x5c6b('0x40')](_0x4259e3[_0x5c6b('0x3e')],{'$or':_[_0x5c6b('0x2f')](_0x4259e3[_0x5c6b('0x38')],function(_0xf6875a){var _0x2bfe07={};_0x2bfe07[_0xf6875a]={'$like':'%'+_0x583d78[_0x5c6b('0x36')]['filter']+'%'};return _0x2bfe07;})});}_0x4259e3=_[_0x5c6b('0x40')]({},_0x4259e3,_0x583d78[_0x5c6b('0x49')]);return _0x4a0c8b[_0x5c6b('0x52')](_0x4259e3);}})['then'](function(_0x3fe1db){if(_0x3fe1db){_0x3b8835=_0x3fe1db[_0x5c6b('0x3a')];if(!_0x583d78[_0x5c6b('0x36')][_0x5c6b('0x3b')](_0x5c6b('0x50'))){_0x4259e3[_0x5c6b('0x22')]=qs[_0x5c6b('0x22')](_0x583d78[_0x5c6b('0x36')][_0x5c6b('0x22')]);_0x4259e3[_0x5c6b('0x21')]=qs[_0x5c6b('0x21')](_0x583d78['query'][_0x5c6b('0x21')]);}return _0x4a0c8b[_0x5c6b('0x52')](_0x4259e3);}})['then'](function(_0x290894){if(_0x290894){return _0x290894?{'count':_0x3b8835,'rows':_0x290894}:null;}})[_0x5c6b('0x28')](respondWithResult(_0x3f06a2,null))[_0x5c6b('0x1c')](handleError(_0x3f06a2,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 706e4ea..7bc6d7a 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 _0x5910=['ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','./intServicenowConfiguration.attributes','exports'];(function(_0x1778a0,_0x2eedfc){var _0x3dcd47=function(_0x43dcbf){while(--_0x43dcbf){_0x1778a0['push'](_0x1778a0['shift']());}};_0x3dcd47(++_0x2eedfc);}(_0x5910,0x98));var _0x0591=function(_0x312e21,_0x400e9f){_0x312e21=_0x312e21-0x0;var _0x3dedaf=_0x5910[_0x312e21];return _0x3dedaf;};'use strict';var _=require(_0x0591('0x0'));var util=require(_0x0591('0x1'));var logger=require(_0x0591('0x2'))(_0x0591('0x3'));var moment=require('moment');var BPromise=require(_0x0591('0x4'));var rp=require(_0x0591('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0591('0x6'));module[_0x0591('0x7')]=function(_0x269ebe,_0x2629c3){return _0x269ebe['define'](_0x0591('0x8'),attributes,{'tableName':_0x0591('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd98=['rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash'];(function(_0x2892ad,_0x103e12){var _0x523df1=function(_0x133d11){while(--_0x133d11){_0x2892ad['push'](_0x2892ad['shift']());}};_0x523df1(++_0x103e12);}(_0xbd98,0x147));var _0x8bd9=function(_0x5bc4f6,_0x2f62dc){_0x5bc4f6=_0x5bc4f6-0x0;var _0x36a71b=_0xbd98[_0x5bc4f6];return _0x36a71b;};'use strict';var _=require(_0x8bd9('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('path');var rimraf=require(_0x8bd9('0x1'));var config=require(_0x8bd9('0x2'));var attributes=require(_0x8bd9('0x3'));module[_0x8bd9('0x4')]=function(_0x29e977,_0x114f1c){return _0x29e977[_0x8bd9('0x5')](_0x8bd9('0x6'),attributes,{'tableName':_0x8bd9('0x7'),'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 2397a19..16a2640 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 _0x385e=['then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x429c8b,_0xc495dc){var _0x1fd724=function(_0x3aa30b){while(--_0x3aa30b){_0x429c8b['push'](_0x429c8b['shift']());}};_0x1fd724(++_0xc495dc);}(_0x385e,0x90));var _0xe385=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x385e[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe385('0x0'));var fs=require('fs');var Redis=require(_0xe385('0x1'));var db=require(_0xe385('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xe385('0x3'))(_0xe385('0x4'));var config=require(_0xe385('0x5'));var jayson=require(_0xe385('0x6'));var client=jayson['client'][_0xe385('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x14c8c6,_0x3ef20d,_0x59f19a){return new BPromise(function(_0x2a5f3a,_0x275cca){return client['request'](_0x14c8c6,_0x59f19a)[_0xe385('0x8')](function(_0x2334ba){logger['info'](_0xe385('0x9'),_0x3ef20d,_0xe385('0xa'));logger[_0xe385('0xb')](_0xe385('0xc'),_0x3ef20d,_0xe385('0xa'),JSON['stringify'](_0x2334ba));if(_0x2334ba[_0xe385('0xd')]){if(_0x2334ba[_0xe385('0xd')][_0xe385('0xe')]===0x1f4){logger['error'](_0xe385('0x9'),_0x3ef20d,_0x2334ba[_0xe385('0xd')]['message']);return _0x275cca(_0x2334ba[_0xe385('0xd')][_0xe385('0xf')]);}logger[_0xe385('0xd')](_0xe385('0x9'),_0x3ef20d,_0x2334ba[_0xe385('0xd')][_0xe385('0xf')]);return _0x2a5f3a(_0x2334ba[_0xe385('0xd')][_0xe385('0xf')]);}else{logger[_0xe385('0x10')](_0xe385('0x9'),_0x3ef20d,_0xe385('0xa'));_0x2a5f3a(_0x2334ba[_0xe385('0x11')]['message']);}})[_0xe385('0x12')](function(_0x2f5faf){logger['error'](_0xe385('0x9'),_0x3ef20d,_0x2f5faf);_0x275cca(_0x2f5faf);});});} \ No newline at end of file +var _0x66bc=['ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xc5ca83,_0x54e387){var _0x337663=function(_0x311b08){while(--_0x311b08){_0xc5ca83['push'](_0xc5ca83['shift']());}};_0x337663(++_0x54e387);}(_0x66bc,0x197));var _0xc66b=function(_0x188a5c,_0xf97352){_0x188a5c=_0x188a5c-0x0;var _0x3c0901=_0x66bc[_0x188a5c];return _0x3c0901;};'use strict';var _=require(_0xc66b('0x0'));var util=require(_0xc66b('0x1'));var moment=require('moment');var BPromise=require(_0xc66b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc66b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc66b('0x4'))(_0xc66b('0x5'));var config=require(_0xc66b('0x6'));var jayson=require(_0xc66b('0x7'));var client=jayson[_0xc66b('0x8')][_0xc66b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b3f04,_0x481128,_0x6af1ba){return new BPromise(function(_0x19f4cf,_0x54b0a3){return client[_0xc66b('0xa')](_0x4b3f04,_0x6af1ba)[_0xc66b('0xb')](function(_0x1002f6){logger[_0xc66b('0xc')](_0xc66b('0xd'),_0x481128,'request\x20sent');logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x481128,_0xc66b('0xe'),JSON[_0xc66b('0xf')](_0x1002f6));if(_0x1002f6[_0xc66b('0x10')]){if(_0x1002f6['error']['code']===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x481128,_0x1002f6[_0xc66b('0x10')][_0xc66b('0x11')]);return _0x54b0a3(_0x1002f6[_0xc66b('0x10')]['message']);}logger[_0xc66b('0x10')](_0xc66b('0xd'),_0x481128,_0x1002f6[_0xc66b('0x10')][_0xc66b('0x11')]);return _0x19f4cf(_0x1002f6[_0xc66b('0x10')][_0xc66b('0x11')]);}else{logger[_0xc66b('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x481128,_0xc66b('0xe'));_0x19f4cf(_0x1002f6[_0xc66b('0x12')][_0xc66b('0x11')]);}})[_0xc66b('0x13')](function(_0xe8f1e5){logger[_0xc66b('0x10')](_0xc66b('0xd'),_0x481128,_0xe8f1e5);_0x54b0a3(_0xe8f1e5);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 7598c7d..bd138d0 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 _0xeb3c=['get','index','/:id','isAuthenticated','show','post','create','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./intServicenowField.controller'];(function(_0x156bc3,_0x134ba4){var _0x5d1427=function(_0x2a4797){while(--_0x2a4797){_0x156bc3['push'](_0x156bc3['shift']());}};_0x5d1427(++_0x134ba4);}(_0xeb3c,0xe9));var _0xceb3=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xeb3c[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0xceb3('0x0'));var util=require(_0xceb3('0x1'));var path=require(_0xceb3('0x2'));var timeout=require(_0xceb3('0x3'));var express=require('express');var router=express[_0xceb3('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xceb3('0x5'));var controller=require(_0xceb3('0x6'));router[_0xceb3('0x7')]('/',auth['isAuthenticated'](),controller[_0xceb3('0x8')]);router[_0xceb3('0x7')](_0xceb3('0x9'),auth[_0xceb3('0xa')](),controller[_0xceb3('0xb')]);router[_0xceb3('0xc')]('/',auth[_0xceb3('0xa')](),controller[_0xceb3('0xd')]);router['put'](_0xceb3('0x9'),auth[_0xceb3('0xa')](),controller['update']);router['delete'](_0xceb3('0x9'),auth['isAuthenticated'](),controller[_0xceb3('0xe')]);module[_0xceb3('0xf')]=router; \ No newline at end of file +var _0xb26d=['post','create','put','delete','destroy','exports','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x8922b1,_0x1eb4c5){var _0xfb4fb4=function(_0x255715){while(--_0x255715){_0x8922b1['push'](_0x8922b1['shift']());}};_0xfb4fb4(++_0x1eb4c5);}(_0xb26d,0x127));var _0xdb26=function(_0xd4603b,_0x2324d5){_0xd4603b=_0xd4603b-0x0;var _0xaafe2f=_0xb26d[_0xd4603b];return _0xaafe2f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdb26('0x0'));var timeout=require(_0xdb26('0x1'));var express=require(_0xdb26('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xdb26('0x3'));var config=require(_0xdb26('0x4'));var controller=require(_0xdb26('0x5'));router[_0xdb26('0x6')]('/',auth[_0xdb26('0x7')](),controller[_0xdb26('0x8')]);router['get'](_0xdb26('0x9'),auth[_0xdb26('0x7')](),controller[_0xdb26('0xa')]);router[_0xdb26('0xb')]('/',auth[_0xdb26('0x7')](),controller[_0xdb26('0xc')]);router[_0xdb26('0xd')]('/:id',auth[_0xdb26('0x7')](),controller['update']);router[_0xdb26('0xe')](_0xdb26('0x9'),auth[_0xdb26('0x7')](),controller[_0xdb26('0xf')]);module[_0xdb26('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 1b9c9f4..b30d157 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 _0x81f8=['variable','customVariable','keyValue','STRING','ENUM','sequelize','exports','string'];(function(_0x39f402,_0x519ee0){var _0x345919=function(_0x4c0f46){while(--_0x4c0f46){_0x39f402['push'](_0x39f402['shift']());}};_0x345919(++_0x519ee0);}(_0x81f8,0x17d));var _0x881f=function(_0x5177a0,_0x5474ee){_0x5177a0=_0x5177a0-0x0;var _0x59b9b3=_0x81f8[_0x5177a0];return _0x59b9b3;};'use strict';var Sequelize=require(_0x881f('0x0'));module[_0x881f('0x1')]={'type':{'type':Sequelize['ENUM'](_0x881f('0x2'),_0x881f('0x3'),_0x881f('0x4'),_0x881f('0x5')),'defaultValue':_0x881f('0x2')},'content':{'type':Sequelize[_0x881f('0x6')]},'key':{'type':Sequelize[_0x881f('0x6')]},'keyType':{'type':Sequelize[_0x881f('0x7')](_0x881f('0x2'),_0x881f('0x3'),_0x881f('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x881f('0x6')]},'nameField':{'type':Sequelize[_0x881f('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8323=['STRING','customVariable','BOOLEAN','sequelize','variable','keyValue','string'];(function(_0x333008,_0x534d06){var _0x4ba0d4=function(_0x3adb94){while(--_0x3adb94){_0x333008['push'](_0x333008['shift']());}};_0x4ba0d4(++_0x534d06);}(_0x8323,0x8f));var _0x3832=function(_0x20bd62,_0x256cee){_0x20bd62=_0x20bd62-0x0;var _0xe1d038=_0x8323[_0x20bd62];return _0xe1d038;};'use strict';var Sequelize=require(_0x3832('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x3832('0x1'),'customVariable',_0x3832('0x2')),'defaultValue':_0x3832('0x3')},'content':{'type':Sequelize[_0x3832('0x4')]},'key':{'type':Sequelize[_0x3832('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x3832('0x3'),_0x3832('0x1'),_0x3832('0x5'))},'keyContent':{'type':Sequelize[_0x3832('0x4')]},'idField':{'type':Sequelize[_0x3832('0x4')]},'nameField':{'type':Sequelize[_0x3832('0x4')]},'customField':{'type':Sequelize[_0x3832('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3832('0x4')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 585946e..841f54a 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 _0x29a1=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','set','Content-Range','apply','update','destroy','then','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','length','find','catch','create','body'];(function(_0x294f3d,_0x1b0f82){var _0x2c8f6c=function(_0x2303e6){while(--_0x2303e6){_0x294f3d['push'](_0x294f3d['shift']());}};_0x2c8f6c(++_0x1b0f82);}(_0x29a1,0x98));var _0x129a=function(_0x59a9e9,_0x376bce){_0x59a9e9=_0x59a9e9-0x0;var _0x3c0335=_0x29a1[_0x59a9e9];return _0x3c0335;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x129a('0x0'));var rimraf=require(_0x129a('0x1'));var zipdir=require(_0x129a('0x2'));var jsonpatch=require(_0x129a('0x3'));var rp=require(_0x129a('0x4'));var moment=require(_0x129a('0x5'));var BPromise=require(_0x129a('0x6'));var Mustache=require(_0x129a('0x7'));var util=require('util');var path=require(_0x129a('0x8'));var sox=require(_0x129a('0x9'));var csv=require(_0x129a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x129a('0xb'));var squel=require(_0x129a('0xc'));var crypto=require(_0x129a('0xd'));var jsforce=require(_0x129a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x129a('0xa'));var querystring=require(_0x129a('0xf'));var Papa=require(_0x129a('0x10'));var Redis=require(_0x129a('0x11'));var authService=require(_0x129a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x129a('0x13'));var hardwareService=require(_0x129a('0x14'));var logger=require(_0x129a('0x15'))(_0x129a('0x16'));var utils=require(_0x129a('0x17'));var config=require(_0x129a('0x18'));var licenseUtil=require(_0x129a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e24d1,_0x37db5d){_0x37db5d=_0x37db5d||0xcc;return function(_0x153696){if(_0x153696){return _0x5e24d1[_0x129a('0x1a')](_0x37db5d);}return _0x5e24d1[_0x129a('0x1b')](_0x37db5d)[_0x129a('0x1c')]();};}function respondWithResult(_0x199302,_0x318229){_0x318229=_0x318229||0xc8;return function(_0x271678){if(_0x271678){return _0x199302[_0x129a('0x1b')](_0x318229)[_0x129a('0x1d')](_0x271678);}};}function respondWithFilteredResult(_0x18212e,_0x51d79b){return function(_0x34edea){if(_0x34edea){var _0x2ae4bc=_0x34edea['count'],_0x4705df=_0x51d79b[_0x129a('0x1e')],_0x5a44b7=_0x51d79b[_0x129a('0x1e')]+_0x51d79b['limit'],_0x446751;if(_0x5a44b7>=_0x2ae4bc){_0x5a44b7=_0x2ae4bc;_0x446751=0xc8;}else{_0x446751=0xce;}_0x18212e[_0x129a('0x1b')](_0x446751);return _0x18212e[_0x129a('0x1f')](_0x129a('0x20'),_0x4705df+'-'+_0x5a44b7+'/'+_0x2ae4bc)[_0x129a('0x1d')](_0x34edea);}return null;};}function patchUpdates(_0x544998){return function(_0x5902a2){try{jsonpatch[_0x129a('0x21')](_0x5902a2,_0x544998,!![]);}catch(_0xef334c){return BPromise['reject'](_0xef334c);}return _0x5902a2['save']();};}function saveUpdates(_0x38fc5b,_0x1b22ae){return function(_0x4ccc32){if(_0x4ccc32){return _0x4ccc32[_0x129a('0x22')](_0x38fc5b)['then'](function(_0x57c717){return _0x57c717;});}return null;};}function removeEntity(_0x32a0d3,_0x281569){return function(_0xa0c332){if(_0xa0c332){return _0xa0c332[_0x129a('0x23')]()[_0x129a('0x24')](function(){_0x32a0d3[_0x129a('0x1b')](0xcc)[_0x129a('0x1c')]();});}};}function handleEntityNotFound(_0x314972,_0x33b96d){return function(_0x5e6c46){if(!_0x5e6c46){_0x314972[_0x129a('0x1a')](0x194);}return _0x5e6c46;};}function handleError(_0x28b830,_0x346339){_0x346339=_0x346339||0x1f4;return function(_0x2d58ff){logger['error'](_0x2d58ff[_0x129a('0x25')]);if(_0x2d58ff[_0x129a('0x26')]){delete _0x2d58ff[_0x129a('0x26')];}_0x28b830[_0x129a('0x1b')](_0x346339)[_0x129a('0x27')](_0x2d58ff);};}exports[_0x129a('0x28')]=function(_0x5a9fb3,_0x1ae797){var _0x67c0d1={},_0x100758={},_0x82e2a4={'count':0x0,'rows':[]};var _0x34291d=_[_0x129a('0x29')](db[_0x129a('0x2a')][_0x129a('0x2b')],function(_0x230f09){return{'name':_0x230f09[_0x129a('0x2c')],'type':_0x230f09[_0x129a('0x2d')][_0x129a('0x2e')]};});_0x100758[_0x129a('0x2f')]=_[_0x129a('0x29')](_0x34291d,_0x129a('0x26'));_0x100758[_0x129a('0x30')]=_[_0x129a('0x31')](_0x5a9fb3['query']);_0x100758['filters']=_['intersection'](_0x100758[_0x129a('0x2f')],_0x100758[_0x129a('0x30')]);_0x67c0d1[_0x129a('0x32')]=_[_0x129a('0x33')](_0x100758[_0x129a('0x2f')],qs[_0x129a('0x34')](_0x5a9fb3[_0x129a('0x30')]['fields']));_0x67c0d1[_0x129a('0x32')]=_0x67c0d1[_0x129a('0x32')]['length']?_0x67c0d1[_0x129a('0x32')]:_0x100758[_0x129a('0x2f')];if(!_0x5a9fb3[_0x129a('0x30')][_0x129a('0x35')](_0x129a('0x36'))){_0x67c0d1[_0x129a('0x37')]=qs[_0x129a('0x37')](_0x5a9fb3[_0x129a('0x30')][_0x129a('0x37')]);_0x67c0d1['offset']=qs[_0x129a('0x1e')](_0x5a9fb3[_0x129a('0x30')][_0x129a('0x1e')]);}_0x67c0d1[_0x129a('0x38')]=qs[_0x129a('0x39')](_0x5a9fb3[_0x129a('0x30')][_0x129a('0x39')]);_0x67c0d1[_0x129a('0x3a')]=qs[_0x129a('0x3b')](_[_0x129a('0x3c')](_0x5a9fb3[_0x129a('0x30')],_0x100758[_0x129a('0x3b')]),_0x34291d);if(_0x5a9fb3[_0x129a('0x30')][_0x129a('0x3d')]){_0x67c0d1[_0x129a('0x3a')]=_['merge'](_0x67c0d1['where'],{'$or':_[_0x129a('0x29')](_0x34291d,function(_0x5d2127){if(_0x5d2127[_0x129a('0x2d')]!==_0x129a('0x3e')){var _0x9bc194={};_0x9bc194[_0x5d2127[_0x129a('0x26')]]={'$like':'%'+_0x5a9fb3['query'][_0x129a('0x3d')]+'%'};return _0x9bc194;}})});}_0x67c0d1=_['merge']({},_0x67c0d1,_0x5a9fb3[_0x129a('0x3f')]);var _0x3e4319={'where':_0x67c0d1[_0x129a('0x3a')]};return db[_0x129a('0x2a')][_0x129a('0x40')](_0x3e4319)[_0x129a('0x24')](function(_0xddc56d){_0x82e2a4['count']=_0xddc56d;if(_0x5a9fb3[_0x129a('0x30')][_0x129a('0x41')]){_0x67c0d1[_0x129a('0x42')]=[{'all':!![]}];}return db[_0x129a('0x2a')][_0x129a('0x43')](_0x67c0d1);})['then'](function(_0x13d94a){_0x82e2a4[_0x129a('0x44')]=_0x13d94a;return _0x82e2a4;})[_0x129a('0x24')](respondWithFilteredResult(_0x1ae797,_0x67c0d1))['catch'](handleError(_0x1ae797,null));};exports[_0x129a('0x45')]=function(_0x48515b,_0x4255e0){var _0x50bf17={'raw':!![],'where':{'id':_0x48515b[_0x129a('0x46')]['id']}},_0x23325d={};_0x23325d[_0x129a('0x2f')]=_['keys'](db[_0x129a('0x2a')]['rawAttributes']);_0x23325d['query']=_[_0x129a('0x31')](_0x48515b['query']);_0x23325d[_0x129a('0x3b')]=_[_0x129a('0x33')](_0x23325d[_0x129a('0x2f')],_0x23325d['query']);_0x50bf17[_0x129a('0x32')]=_[_0x129a('0x33')](_0x23325d['model'],qs[_0x129a('0x34')](_0x48515b['query'][_0x129a('0x34')]));_0x50bf17['attributes']=_0x50bf17[_0x129a('0x32')][_0x129a('0x47')]?_0x50bf17[_0x129a('0x32')]:_0x23325d[_0x129a('0x2f')];if(_0x48515b[_0x129a('0x30')][_0x129a('0x41')]){_0x50bf17[_0x129a('0x42')]=[{'all':!![]}];}_0x50bf17=_['merge']({},_0x50bf17,_0x48515b[_0x129a('0x3f')]);return db[_0x129a('0x2a')][_0x129a('0x48')](_0x50bf17)[_0x129a('0x24')](handleEntityNotFound(_0x4255e0,null))[_0x129a('0x24')](respondWithResult(_0x4255e0,null))[_0x129a('0x49')](handleError(_0x4255e0,null));};exports[_0x129a('0x4a')]=function(_0x3e3523,_0x2a36bd){return db[_0x129a('0x2a')][_0x129a('0x4a')](_0x3e3523[_0x129a('0x4b')],{})[_0x129a('0x24')](respondWithResult(_0x2a36bd,0xc9))[_0x129a('0x49')](handleError(_0x2a36bd,null));};exports[_0x129a('0x22')]=function(_0x41e2e5,_0x2bf094){if(_0x41e2e5[_0x129a('0x4b')]['id']){delete _0x41e2e5[_0x129a('0x4b')]['id'];}return db['ServicenowField'][_0x129a('0x48')]({'where':{'id':_0x41e2e5[_0x129a('0x46')]['id']}})['then'](handleEntityNotFound(_0x2bf094,null))[_0x129a('0x24')](saveUpdates(_0x41e2e5['body'],null))['then'](respondWithResult(_0x2bf094,null))['catch'](handleError(_0x2bf094,null));};exports[_0x129a('0x23')]=function(_0x136e23,_0x21112d){return db[_0x129a('0x2a')][_0x129a('0x48')]({'where':{'id':_0x136e23[_0x129a('0x46')]['id']}})[_0x129a('0x24')](handleEntityNotFound(_0x21112d,null))[_0x129a('0x24')](removeEntity(_0x21112d,null))['catch'](handleError(_0x21112d,null));}; \ No newline at end of file +var _0x3746=['sort','where','pick','filters','filter','merge','type','options','includeAll','include','findAll','catch','show','params','keys','ServicenowField','create','body','find','html-pdf','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x9f7af3,_0xcbe532){var _0x64fafa=function(_0x1a3cfe){while(--_0x1a3cfe){_0x9f7af3['push'](_0x9f7af3['shift']());}};_0x64fafa(++_0xcbe532);}(_0x3746,0xa9));var _0x6374=function(_0x1dd5b0,_0x460076){_0x1dd5b0=_0x1dd5b0-0x0;var _0x31c2f8=_0x3746[_0x1dd5b0];return _0x31c2f8;};'use strict';var pdf=require(_0x6374('0x0'));var emlformat=require(_0x6374('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6374('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6374('0x3'));var moment=require(_0x6374('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6374('0x5'));var path=require(_0x6374('0x6'));var sox=require(_0x6374('0x7'));var csv=require(_0x6374('0x8'));var ejs=require(_0x6374('0x9'));var fs=require('fs');var _=require(_0x6374('0xa'));var squel=require(_0x6374('0xb'));var crypto=require(_0x6374('0xc'));var jsforce=require(_0x6374('0xd'));var deskjs=require(_0x6374('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6374('0xf'));var Papa=require('papaparse');var Redis=require(_0x6374('0x10'));var authService=require(_0x6374('0x11'));var qs=require(_0x6374('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6374('0x13'));var logger=require(_0x6374('0x14'))(_0x6374('0x15'));var utils=require('../../config/utils');var config=require(_0x6374('0x16'));var licenseUtil=require(_0x6374('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8c230,_0x2b88fa){_0x2b88fa=_0x2b88fa||0xcc;return function(_0xd2ca){if(_0xd2ca){return _0x8c230['sendStatus'](_0x2b88fa);}return _0x8c230[_0x6374('0x18')](_0x2b88fa)[_0x6374('0x19')]();};}function respondWithResult(_0x3916b5,_0x54b408){_0x54b408=_0x54b408||0xc8;return function(_0x202d55){if(_0x202d55){return _0x3916b5['status'](_0x54b408)['json'](_0x202d55);}};}function respondWithFilteredResult(_0x22c866,_0x4ffe00){return function(_0x17d71b){if(_0x17d71b){var _0x3a2b3a=_0x17d71b[_0x6374('0x1a')],_0x1fdaa6=_0x4ffe00[_0x6374('0x1b')],_0x1de4c2=_0x4ffe00[_0x6374('0x1b')]+_0x4ffe00[_0x6374('0x1c')],_0x287981;if(_0x1de4c2>=_0x3a2b3a){_0x1de4c2=_0x3a2b3a;_0x287981=0xc8;}else{_0x287981=0xce;}_0x22c866[_0x6374('0x18')](_0x287981);return _0x22c866[_0x6374('0x1d')](_0x6374('0x1e'),_0x1fdaa6+'-'+_0x1de4c2+'/'+_0x3a2b3a)[_0x6374('0x1f')](_0x17d71b);}return null;};}function patchUpdates(_0x7f4ea3){return function(_0x435ab6){try{jsonpatch[_0x6374('0x20')](_0x435ab6,_0x7f4ea3,!![]);}catch(_0x46fdc2){return BPromise[_0x6374('0x21')](_0x46fdc2);}return _0x435ab6[_0x6374('0x22')]();};}function saveUpdates(_0x101d49,_0x499fa1){return function(_0x4f6542){if(_0x4f6542){return _0x4f6542[_0x6374('0x23')](_0x101d49)['then'](function(_0x465c25){return _0x465c25;});}return null;};}function removeEntity(_0x43d559,_0x16bfd5){return function(_0x2741b4){if(_0x2741b4){return _0x2741b4['destroy']()[_0x6374('0x24')](function(){_0x43d559[_0x6374('0x18')](0xcc)[_0x6374('0x19')]();});}};}function handleEntityNotFound(_0x1148e5,_0x293cf2){return function(_0xd0a6b5){if(!_0xd0a6b5){_0x1148e5[_0x6374('0x25')](0x194);}return _0xd0a6b5;};}function handleError(_0x1a8808,_0x549da1){_0x549da1=_0x549da1||0x1f4;return function(_0x115729){logger[_0x6374('0x26')](_0x115729[_0x6374('0x27')]);if(_0x115729['name']){delete _0x115729[_0x6374('0x28')];}_0x1a8808['status'](_0x549da1)[_0x6374('0x29')](_0x115729);};}exports[_0x6374('0x2a')]=function(_0x8d5419,_0x1cb029){var _0x42bc95={},_0x3cf16d={},_0x3bf066={'count':0x0,'rows':[]};var _0xf032e3=_[_0x6374('0x2b')](db['ServicenowField'][_0x6374('0x2c')],function(_0x37b74a){return{'name':_0x37b74a[_0x6374('0x2d')],'type':_0x37b74a['type'][_0x6374('0x2e')]};});_0x3cf16d[_0x6374('0x2f')]=_['map'](_0xf032e3,_0x6374('0x28'));_0x3cf16d['query']=_['keys'](_0x8d5419['query']);_0x3cf16d['filters']=_['intersection'](_0x3cf16d[_0x6374('0x2f')],_0x3cf16d['query']);_0x42bc95['attributes']=_[_0x6374('0x30')](_0x3cf16d[_0x6374('0x2f')],qs[_0x6374('0x31')](_0x8d5419[_0x6374('0x32')]['fields']));_0x42bc95[_0x6374('0x33')]=_0x42bc95['attributes'][_0x6374('0x34')]?_0x42bc95[_0x6374('0x33')]:_0x3cf16d[_0x6374('0x2f')];if(!_0x8d5419[_0x6374('0x32')][_0x6374('0x35')](_0x6374('0x36'))){_0x42bc95[_0x6374('0x1c')]=qs[_0x6374('0x1c')](_0x8d5419[_0x6374('0x32')]['limit']);_0x42bc95[_0x6374('0x1b')]=qs[_0x6374('0x1b')](_0x8d5419['query'][_0x6374('0x1b')]);}_0x42bc95[_0x6374('0x37')]=qs[_0x6374('0x38')](_0x8d5419[_0x6374('0x32')][_0x6374('0x38')]);_0x42bc95[_0x6374('0x39')]=qs['filters'](_[_0x6374('0x3a')](_0x8d5419[_0x6374('0x32')],_0x3cf16d[_0x6374('0x3b')]),_0xf032e3);if(_0x8d5419[_0x6374('0x32')][_0x6374('0x3c')]){_0x42bc95[_0x6374('0x39')]=_[_0x6374('0x3d')](_0x42bc95['where'],{'$or':_[_0x6374('0x2b')](_0xf032e3,function(_0x366aaf){if(_0x366aaf[_0x6374('0x3e')]!=='VIRTUAL'){var _0x3a11f6={};_0x3a11f6[_0x366aaf[_0x6374('0x28')]]={'$like':'%'+_0x8d5419['query'][_0x6374('0x3c')]+'%'};return _0x3a11f6;}})});}_0x42bc95=_[_0x6374('0x3d')]({},_0x42bc95,_0x8d5419[_0x6374('0x3f')]);var _0x1de6aa={'where':_0x42bc95[_0x6374('0x39')]};return db['ServicenowField'][_0x6374('0x1a')](_0x1de6aa)[_0x6374('0x24')](function(_0x1cc134){_0x3bf066['count']=_0x1cc134;if(_0x8d5419[_0x6374('0x32')][_0x6374('0x40')]){_0x42bc95[_0x6374('0x41')]=[{'all':!![]}];}return db['ServicenowField'][_0x6374('0x42')](_0x42bc95);})['then'](function(_0x100d53){_0x3bf066['rows']=_0x100d53;return _0x3bf066;})['then'](respondWithFilteredResult(_0x1cb029,_0x42bc95))[_0x6374('0x43')](handleError(_0x1cb029,null));};exports[_0x6374('0x44')]=function(_0x5e1c80,_0x6c4f80){var _0xcd5411={'raw':!![],'where':{'id':_0x5e1c80[_0x6374('0x45')]['id']}},_0x4e530d={};_0x4e530d[_0x6374('0x2f')]=_[_0x6374('0x46')](db[_0x6374('0x47')][_0x6374('0x2c')]);_0x4e530d[_0x6374('0x32')]=_[_0x6374('0x46')](_0x5e1c80['query']);_0x4e530d['filters']=_['intersection'](_0x4e530d['model'],_0x4e530d['query']);_0xcd5411['attributes']=_[_0x6374('0x30')](_0x4e530d['model'],qs[_0x6374('0x31')](_0x5e1c80[_0x6374('0x32')]['fields']));_0xcd5411[_0x6374('0x33')]=_0xcd5411[_0x6374('0x33')][_0x6374('0x34')]?_0xcd5411[_0x6374('0x33')]:_0x4e530d[_0x6374('0x2f')];if(_0x5e1c80[_0x6374('0x32')]['includeAll']){_0xcd5411[_0x6374('0x41')]=[{'all':!![]}];}_0xcd5411=_[_0x6374('0x3d')]({},_0xcd5411,_0x5e1c80[_0x6374('0x3f')]);return db[_0x6374('0x47')]['find'](_0xcd5411)[_0x6374('0x24')](handleEntityNotFound(_0x6c4f80,null))['then'](respondWithResult(_0x6c4f80,null))[_0x6374('0x43')](handleError(_0x6c4f80,null));};exports['create']=function(_0x3877b0,_0x5cdb59){return db[_0x6374('0x47')][_0x6374('0x48')](_0x3877b0['body'],{})[_0x6374('0x24')](respondWithResult(_0x5cdb59,0xc9))[_0x6374('0x43')](handleError(_0x5cdb59,null));};exports[_0x6374('0x23')]=function(_0x2c052b,_0x2f94d0){if(_0x2c052b[_0x6374('0x49')]['id']){delete _0x2c052b[_0x6374('0x49')]['id'];}return db[_0x6374('0x47')][_0x6374('0x4a')]({'where':{'id':_0x2c052b[_0x6374('0x45')]['id']}})[_0x6374('0x24')](handleEntityNotFound(_0x2f94d0,null))[_0x6374('0x24')](saveUpdates(_0x2c052b[_0x6374('0x49')],null))[_0x6374('0x24')](respondWithResult(_0x2f94d0,null))['catch'](handleError(_0x2f94d0,null));};exports['destroy']=function(_0x55dcc2,_0x11c98b){return db[_0x6374('0x47')][_0x6374('0x4a')]({'where':{'id':_0x55dcc2[_0x6374('0x45')]['id']}})[_0x6374('0x24')](handleEntityNotFound(_0x11c98b,null))[_0x6374('0x24')](removeEntity(_0x11c98b,null))['catch'](handleError(_0x11c98b,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 4d0fbc7..072e205 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 _0xfb0b=['moment','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x2509d1,_0x116211){var _0xdae69a=function(_0x23ca6b){while(--_0x23ca6b){_0x2509d1['push'](_0x2509d1['shift']());}};_0xdae69a(++_0x116211);}(_0xfb0b,0x164));var _0xbfb0=function(_0x56c1e9,_0x4a1be8){_0x56c1e9=_0x56c1e9-0x0;var _0x88f65c=_0xfb0b[_0x56c1e9];return _0x88f65c;};'use strict';var _=require(_0xbfb0('0x0'));var util=require(_0xbfb0('0x1'));var logger=require(_0xbfb0('0x2'))(_0xbfb0('0x3'));var moment=require(_0xbfb0('0x4'));var BPromise=require('bluebird');var rp=require(_0xbfb0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfb0('0x6'));var config=require(_0xbfb0('0x7'));var attributes=require(_0xbfb0('0x8'));module[_0xbfb0('0x9')]=function(_0x51d69b,_0x4d7b1c){return _0x51d69b[_0xbfb0('0xa')]('ServicenowField',attributes,{'tableName':_0xbfb0('0xb'),'paranoid':![],'indexes':[{'name':_0xbfb0('0xc'),'fields':[_0xbfb0('0xd'),_0xbfb0('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x27f6=['ServicenowField','servicenow_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define'];(function(_0x21c283,_0x4f748a){var _0x25bc0d=function(_0x293b59){while(--_0x293b59){_0x21c283['push'](_0x21c283['shift']());}};_0x25bc0d(++_0x4f748a);}(_0x27f6,0x170));var _0x627f=function(_0x2020c1,_0x37b45a){_0x2020c1=_0x2020c1-0x0;var _0x139998=_0x27f6[_0x2020c1];return _0x139998;};'use strict';var _=require('lodash');var util=require(_0x627f('0x0'));var logger=require(_0x627f('0x1'))('api');var moment=require(_0x627f('0x2'));var BPromise=require(_0x627f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x627f('0x4'));var rimraf=require(_0x627f('0x5'));var config=require(_0x627f('0x6'));var attributes=require(_0x627f('0x7'));module[_0x627f('0x8')]=function(_0x180513,_0x250ddf){return _0x180513[_0x627f('0x9')](_0x627f('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x627f('0xb'),'fields':[_0x627f('0xc'),_0x627f('0xd')],'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 06329ea..27132ba 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 _0x184f=['error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x184f,0x180));var _0xf184=function(_0x220afa,_0xf5f6cc){_0x220afa=_0x220afa-0x0;var _0x1b79d1=_0x184f[_0x220afa];return _0x1b79d1;};'use strict';var _=require(_0xf184('0x0'));var util=require('util');var moment=require(_0xf184('0x1'));var BPromise=require(_0xf184('0x2'));var rs=require(_0xf184('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf184('0x4'))['db'];var utils=require(_0xf184('0x5'));var logger=require(_0xf184('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf184('0x7'));var client=jayson[_0xf184('0x8')][_0xf184('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x858d76,_0x3d6e14,_0x9900c2){return new BPromise(function(_0x4f395e,_0x788700){return client['request'](_0x858d76,_0x9900c2)[_0xf184('0xa')](function(_0x303333){logger[_0xf184('0xb')](_0xf184('0xc'),_0x3d6e14,_0xf184('0xd'));logger[_0xf184('0xe')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x3d6e14,_0xf184('0xd'),JSON['stringify'](_0x303333));if(_0x303333[_0xf184('0xf')]){if(_0x303333[_0xf184('0xf')][_0xf184('0x10')]===0x1f4){logger[_0xf184('0xf')](_0xf184('0xc'),_0x3d6e14,_0x303333[_0xf184('0xf')][_0xf184('0x11')]);return _0x788700(_0x303333[_0xf184('0xf')][_0xf184('0x11')]);}logger[_0xf184('0xf')]('ServicenowField,\x20%s,\x20%s',_0x3d6e14,_0x303333[_0xf184('0xf')][_0xf184('0x11')]);return _0x4f395e(_0x303333[_0xf184('0xf')][_0xf184('0x11')]);}else{logger[_0xf184('0xb')](_0xf184('0xc'),_0x3d6e14,_0xf184('0xd'));_0x4f395e(_0x303333['result']['message']);}})[_0xf184('0x12')](function(_0x887d1a){logger[_0xf184('0xf')](_0xf184('0xc'),_0x3d6e14,_0x887d1a);_0x788700(_0x887d1a);});});} \ No newline at end of file +var _0xa4cd=['info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','code','message','error','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x5a2299,_0x3e2922){var _0xedff0f=function(_0x1624cb){while(--_0x1624cb){_0x5a2299['push'](_0x5a2299['shift']());}};_0xedff0f(++_0x3e2922);}(_0xa4cd,0xb1));var _0xda4c=function(_0x261b6c,_0x564698){_0x261b6c=_0x261b6c-0x0;var _0x317163=_0xa4cd[_0x261b6c];return _0x317163;};'use strict';var _=require(_0xda4c('0x0'));var util=require(_0xda4c('0x1'));var moment=require('moment');var BPromise=require(_0xda4c('0x2'));var rs=require(_0xda4c('0x3'));var fs=require('fs');var Redis=require(_0xda4c('0x4'));var db=require(_0xda4c('0x5'))['db'];var utils=require(_0xda4c('0x6'));var logger=require(_0xda4c('0x7'))('rpc');var config=require(_0xda4c('0x8'));var jayson=require(_0xda4c('0x9'));var client=jayson[_0xda4c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x255139,_0x3129fc,_0x5296b9){return new BPromise(function(_0x1dfcc7,_0x5dc656){return client[_0xda4c('0xb')](_0x255139,_0x5296b9)['then'](function(_0x384db0){logger[_0xda4c('0xc')](_0xda4c('0xd'),_0x3129fc,_0xda4c('0xe'));logger[_0xda4c('0xf')](_0xda4c('0x10'),_0x3129fc,_0xda4c('0xe'),JSON[_0xda4c('0x11')](_0x384db0));if(_0x384db0['error']){if(_0x384db0['error'][_0xda4c('0x12')]===0x1f4){logger['error'](_0xda4c('0xd'),_0x3129fc,_0x384db0['error'][_0xda4c('0x13')]);return _0x5dc656(_0x384db0[_0xda4c('0x14')]['message']);}logger[_0xda4c('0x14')](_0xda4c('0xd'),_0x3129fc,_0x384db0['error'][_0xda4c('0x13')]);return _0x1dfcc7(_0x384db0[_0xda4c('0x14')][_0xda4c('0x13')]);}else{logger[_0xda4c('0xc')](_0xda4c('0xd'),_0x3129fc,_0xda4c('0xe'));_0x1dfcc7(_0x384db0['result'][_0xda4c('0x13')]);}})['catch'](function(_0x170a5f){logger['error'](_0xda4c('0xd'),_0x3129fc,_0x170a5f);_0x5dc656(_0x170a5f);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 83e0874..b66245f 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 _0xada2=['show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xada2,0xfd));var _0x2ada=function(_0x5a48f5,_0xc31538){_0x5a48f5=_0x5a48f5-0x0;var _0x1da2cb=_0xada2[_0x5a48f5];return _0x1da2cb;};'use strict';var multer=require(_0x2ada('0x0'));var util=require(_0x2ada('0x1'));var path=require(_0x2ada('0x2'));var timeout=require(_0x2ada('0x3'));var express=require('express');var router=express[_0x2ada('0x4')]();var auth=require(_0x2ada('0x5'));var interaction=require(_0x2ada('0x6'));var config=require('../../config/environment');var controller=require('./intSugarcrmAccount.controller');router[_0x2ada('0x7')]('/',auth[_0x2ada('0x8')](),controller[_0x2ada('0x9')]);router[_0x2ada('0x7')](_0x2ada('0xa'),auth[_0x2ada('0x8')](),controller[_0x2ada('0xb')]);router[_0x2ada('0x7')](_0x2ada('0xc'),auth[_0x2ada('0x8')](),controller['getConfigurations']);router['get'](_0x2ada('0xd'),auth[_0x2ada('0x8')](),controller[_0x2ada('0xe')]);router[_0x2ada('0xf')]('/',auth[_0x2ada('0x8')](),controller[_0x2ada('0x10')]);router['post'](_0x2ada('0xc'),auth[_0x2ada('0x8')](),controller[_0x2ada('0x11')]);router[_0x2ada('0x12')]('/:id',auth[_0x2ada('0x8')](),controller['update']);router[_0x2ada('0x13')](_0x2ada('0xa'),auth[_0x2ada('0x8')](),controller[_0x2ada('0x14')]);module[_0x2ada('0x15')]=router; \ No newline at end of file +var _0xea70=['get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./intSugarcrmAccount.controller'];(function(_0x509b9d,_0x234651){var _0x5a755f=function(_0xd20aa1){while(--_0xd20aa1){_0x509b9d['push'](_0x509b9d['shift']());}};_0x5a755f(++_0x234651);}(_0xea70,0x175));var _0x0ea7=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xea70[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x0ea7('0x0'));var util=require(_0x0ea7('0x1'));var path=require(_0x0ea7('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ea7('0x3'));var router=express['Router']();var auth=require(_0x0ea7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0ea7('0x5'));var controller=require(_0x0ea7('0x6'));router[_0x0ea7('0x7')]('/',auth[_0x0ea7('0x8')](),controller[_0x0ea7('0x9')]);router['get'](_0x0ea7('0xa'),auth[_0x0ea7('0x8')](),controller['show']);router[_0x0ea7('0x7')](_0x0ea7('0xb'),auth['isAuthenticated'](),controller[_0x0ea7('0xc')]);router[_0x0ea7('0x7')](_0x0ea7('0xd'),auth[_0x0ea7('0x8')](),controller['getFields']);router[_0x0ea7('0xe')]('/',auth[_0x0ea7('0x8')](),controller[_0x0ea7('0xf')]);router[_0x0ea7('0xe')](_0x0ea7('0xb'),auth['isAuthenticated'](),controller[_0x0ea7('0x10')]);router[_0x0ea7('0x11')](_0x0ea7('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0ea7('0xa'),auth[_0x0ea7('0x8')](),controller[_0x0ea7('0x12')]);module[_0x0ea7('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 2621bbb..fc960b9 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 _0x1466=['STRING','username','sequelize','exports'];(function(_0x4d3f3b,_0x2213ca){var _0x4176c5=function(_0x670167){while(--_0x670167){_0x4d3f3b['push'](_0x4d3f3b['shift']());}};_0x4176c5(++_0x2213ca);}(_0x1466,0x1de));var _0x6146=function(_0x400e76,_0x510b2d){_0x400e76=_0x400e76-0x0;var _0x19695d=_0x1466[_0x400e76];return _0x19695d;};'use strict';var Sequelize=require(_0x6146('0x0'));module[_0x6146('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6146('0x2')]},'username':{'type':Sequelize[_0x6146('0x2')],'unique':_0x6146('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6146('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x781e=['exports','STRING','remoteUri','sequelize'];(function(_0x1a07a0,_0x131f14){var _0x1cb92f=function(_0x45320e){while(--_0x45320e){_0x1a07a0['push'](_0x1a07a0['shift']());}};_0x1cb92f(++_0x131f14);}(_0x781e,0x183));var _0xe781=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x781e[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xe781('0x0'));module[_0xe781('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe781('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe781('0x2')],'unique':_0xe781('0x3')},'serverUrl':{'type':Sequelize[_0xe781('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 55af605..b77b84c 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 _0x61af=['sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','destroy','name','send','map','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','SugarcrmAccount','includeAll','include','findAll','rows','show','params','keys','find','create','body','SugarcrmConfiguration','getConfigurations','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_minutes','parent_id','parent_type','parent_name','direction','findOne','password','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','get_module_fields','values','module_fields','includes','label','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','client','http','request','then','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','SugarcrmAccount,\x20%s,\x20%s','message','info','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x61af,0x149));var _0xf61a=function(_0x327b49,_0xc232b8){_0x327b49=_0x327b49-0x0;var _0x4e7265=_0x61af[_0x327b49];return _0x4e7265;};'use strict';var pdf=require(_0xf61a('0x0'));var emlformat=require(_0xf61a('0x1'));var rimraf=require(_0xf61a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf61a('0x3'));var moment=require(_0xf61a('0x4'));var BPromise=require(_0xf61a('0x5'));var Mustache=require('mustache');var util=require(_0xf61a('0x6'));var path=require(_0xf61a('0x7'));var sox=require(_0xf61a('0x8'));var csv=require(_0xf61a('0x9'));var ejs=require(_0xf61a('0xa'));var fs=require('fs');var _=require(_0xf61a('0xb'));var squel=require('squel');var crypto=require(_0xf61a('0xc'));var jsforce=require(_0xf61a('0xd'));var deskjs=require(_0xf61a('0xe'));var toCsv=require(_0xf61a('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf61a('0xf'));var as=require(_0xf61a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf61a('0x11'))(_0xf61a('0x12'));var utils=require(_0xf61a('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf61a('0x14'))['db'];var integrations=require(_0xf61a('0x15'));var jayson=require('jayson/promise');var client=jayson[_0xf61a('0x16')][_0xf61a('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xcdd515,_0x535803,_0x3f89c2,_0x3cce13){return new BPromise(function(_0x4694e7,_0x2dd07b){var _0x2a0c77=_0x3cce13||client;return _0x2a0c77[_0xf61a('0x18')](_0xcdd515,_0x3f89c2)[_0xf61a('0x19')](function(_0x3445ca){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x535803,'request\x20sent');logger[_0xf61a('0x1a')](_0xf61a('0x1b'),_0x535803,'request\x20sent',JSON['stringify'](_0x3445ca));if(_0x3445ca['error']){if(_0x3445ca[_0xf61a('0x1c')]['code']===0x1f4){logger[_0xf61a('0x1c')](_0xf61a('0x1d'),_0x535803,_0x3445ca['error'][_0xf61a('0x1e')]);return _0x2dd07b(_0x3445ca[_0xf61a('0x1c')][_0xf61a('0x1e')]);}logger[_0xf61a('0x1c')](_0xf61a('0x1d'),_0x535803,_0x3445ca[_0xf61a('0x1c')][_0xf61a('0x1e')]);return _0x4694e7(_0x3445ca[_0xf61a('0x1c')]['message']);}else{logger[_0xf61a('0x1f')](_0xf61a('0x1d'),_0x535803,'request\x20sent');_0x4694e7(_0x3445ca[_0xf61a('0x20')]['message']);}})[_0xf61a('0x21')](function(_0x1dc53d){logger[_0xf61a('0x1c')]('SugarcrmAccount,\x20%s,\x20%s',_0x535803,_0x1dc53d);_0x2dd07b(_0x1dc53d);});});}function respondWithStatusCode(_0xe10f6,_0x37bc50){_0x37bc50=_0x37bc50||0xcc;return function(_0x1bd956){if(_0x1bd956){return _0xe10f6[_0xf61a('0x22')](_0x37bc50);}return _0xe10f6[_0xf61a('0x23')](_0x37bc50)[_0xf61a('0x24')]();};}function respondWithResult(_0x140d69,_0x7515d7){_0x7515d7=_0x7515d7||0xc8;return function(_0x4137ee){if(_0x4137ee){return _0x140d69['status'](_0x7515d7)[_0xf61a('0x25')](_0x4137ee);}};}function respondWithFilteredResult(_0x437586,_0x2d9bf2){return function(_0x5a2e12){if(_0x5a2e12){var _0x37ee6a=_0x5a2e12[_0xf61a('0x26')],_0x5cdc13=_0x2d9bf2[_0xf61a('0x27')],_0x29940a=_0x2d9bf2[_0xf61a('0x27')]+_0x2d9bf2[_0xf61a('0x28')],_0x4dc634;if(_0x29940a>=_0x37ee6a){_0x29940a=_0x37ee6a;_0x4dc634=0xc8;}else{_0x4dc634=0xce;}_0x437586['status'](_0x4dc634);return _0x437586['set'](_0xf61a('0x29'),_0x5cdc13+'-'+_0x29940a+'/'+_0x37ee6a)[_0xf61a('0x25')](_0x5a2e12);}return null;};}function patchUpdates(_0x203606){return function(_0x4c5eb7){try{jsonpatch[_0xf61a('0x2a')](_0x4c5eb7,_0x203606,!![]);}catch(_0x3b2188){return BPromise[_0xf61a('0x2b')](_0x3b2188);}return _0x4c5eb7['save']();};}function saveUpdates(_0xf37bcf,_0x5ef642){return function(_0xd94c30){if(_0xd94c30){return _0xd94c30['update'](_0xf37bcf)[_0xf61a('0x19')](function(_0x137392){return _0x137392;});}return null;};}function removeEntity(_0x3ed4b6,_0x5ac7aa){return function(_0x3d729d){if(_0x3d729d){return _0x3d729d[_0xf61a('0x2c')]()[_0xf61a('0x19')](function(){_0x3ed4b6[_0xf61a('0x23')](0xcc)[_0xf61a('0x24')]();});}};}function handleEntityNotFound(_0x3bfa9f,_0x1f4e18){return function(_0x19834e){if(!_0x19834e){_0x3bfa9f[_0xf61a('0x22')](0x194);}return _0x19834e;};}function handleError(_0xfefd98,_0x1f3a60){_0x1f3a60=_0x1f3a60||0x1f4;return function(_0x321d8c){logger[_0xf61a('0x1c')](_0x321d8c['stack']);if(_0x321d8c[_0xf61a('0x2d')]){delete _0x321d8c[_0xf61a('0x2d')];}_0xfefd98[_0xf61a('0x23')](_0x1f3a60)[_0xf61a('0x2e')](_0x321d8c);};}exports['index']=function(_0x30d0ca,_0x504a71){var _0x3ecba8={},_0x4f06c7={},_0x2a5757={'count':0x0,'rows':[]};var _0x399d95=_[_0xf61a('0x2f')](db['SugarcrmAccount'][_0xf61a('0x30')],function(_0x486dfc){return{'name':_0x486dfc['fieldName'],'type':_0x486dfc[_0xf61a('0x31')][_0xf61a('0x32')]};});_0x4f06c7[_0xf61a('0x33')]=_[_0xf61a('0x2f')](_0x399d95,_0xf61a('0x2d'));_0x4f06c7[_0xf61a('0x34')]=_['keys'](_0x30d0ca[_0xf61a('0x34')]);_0x4f06c7['filters']=_[_0xf61a('0x35')](_0x4f06c7['model'],_0x4f06c7[_0xf61a('0x34')]);_0x3ecba8[_0xf61a('0x36')]=_[_0xf61a('0x35')](_0x4f06c7['model'],qs[_0xf61a('0x37')](_0x30d0ca['query'][_0xf61a('0x37')]));_0x3ecba8[_0xf61a('0x36')]=_0x3ecba8[_0xf61a('0x36')][_0xf61a('0x38')]?_0x3ecba8['attributes']:_0x4f06c7[_0xf61a('0x33')];if(!_0x30d0ca[_0xf61a('0x34')][_0xf61a('0x39')](_0xf61a('0x3a'))){_0x3ecba8[_0xf61a('0x28')]=qs[_0xf61a('0x28')](_0x30d0ca[_0xf61a('0x34')]['limit']);_0x3ecba8['offset']=qs[_0xf61a('0x27')](_0x30d0ca['query'][_0xf61a('0x27')]);}_0x3ecba8[_0xf61a('0x3b')]=qs[_0xf61a('0x3c')](_0x30d0ca[_0xf61a('0x34')]['sort']);_0x3ecba8[_0xf61a('0x3d')]=qs[_0xf61a('0x3e')](_[_0xf61a('0x3f')](_0x30d0ca[_0xf61a('0x34')],_0x4f06c7[_0xf61a('0x3e')]),_0x399d95);if(_0x30d0ca[_0xf61a('0x34')]['filter']){_0x3ecba8[_0xf61a('0x3d')]=_[_0xf61a('0x40')](_0x3ecba8['where'],{'$or':_[_0xf61a('0x2f')](_0x399d95,function(_0x244afe){if(_0x244afe[_0xf61a('0x31')]!==_0xf61a('0x41')){var _0x16e4e9={};_0x16e4e9[_0x244afe['name']]={'$like':'%'+_0x30d0ca[_0xf61a('0x34')][_0xf61a('0x42')]+'%'};return _0x16e4e9;}})});}_0x3ecba8=_['merge']({},_0x3ecba8,_0x30d0ca[_0xf61a('0x43')]);var _0x935183={'where':_0x3ecba8['where']};return db[_0xf61a('0x44')][_0xf61a('0x26')](_0x935183)['then'](function(_0x1e5fef){_0x2a5757[_0xf61a('0x26')]=_0x1e5fef;if(_0x30d0ca[_0xf61a('0x34')][_0xf61a('0x45')]){_0x3ecba8[_0xf61a('0x46')]=[{'all':!![]}];}return db[_0xf61a('0x44')][_0xf61a('0x47')](_0x3ecba8);})[_0xf61a('0x19')](function(_0x36487c){_0x2a5757[_0xf61a('0x48')]=_0x36487c;return _0x2a5757;})[_0xf61a('0x19')](respondWithFilteredResult(_0x504a71,_0x3ecba8))['catch'](handleError(_0x504a71,null));};exports[_0xf61a('0x49')]=function(_0x1fca3b,_0x35af2e){var _0x690f1e={'raw':![],'where':{'id':_0x1fca3b[_0xf61a('0x4a')]['id']}},_0x27ae17={};_0x27ae17[_0xf61a('0x33')]=_[_0xf61a('0x4b')](db[_0xf61a('0x44')]['rawAttributes']);_0x27ae17[_0xf61a('0x34')]=_['keys'](_0x1fca3b[_0xf61a('0x34')]);_0x27ae17[_0xf61a('0x3e')]=_[_0xf61a('0x35')](_0x27ae17['model'],_0x27ae17[_0xf61a('0x34')]);_0x690f1e[_0xf61a('0x36')]=_['intersection'](_0x27ae17[_0xf61a('0x33')],qs[_0xf61a('0x37')](_0x1fca3b['query'][_0xf61a('0x37')]));_0x690f1e[_0xf61a('0x36')]=_0x690f1e['attributes']['length']?_0x690f1e[_0xf61a('0x36')]:_0x27ae17['model'];if(_0x1fca3b[_0xf61a('0x34')][_0xf61a('0x45')]){_0x690f1e[_0xf61a('0x46')]=[{'all':!![]}];}_0x690f1e=_['merge']({},_0x690f1e,_0x1fca3b[_0xf61a('0x43')]);return db[_0xf61a('0x44')][_0xf61a('0x4c')](_0x690f1e)['then'](handleEntityNotFound(_0x35af2e,null))[_0xf61a('0x19')](respondWithResult(_0x35af2e,null))[_0xf61a('0x21')](handleError(_0x35af2e,null));};exports['create']=function(_0x348861,_0x2307c4){return db[_0xf61a('0x44')][_0xf61a('0x4d')](_0x348861[_0xf61a('0x4e')],{})[_0xf61a('0x19')](respondWithResult(_0x2307c4,0xc9))[_0xf61a('0x21')](handleError(_0x2307c4,null));};exports['update']=function(_0x27e6c7,_0x3aa24d){if(_0x27e6c7[_0xf61a('0x4e')]['id']){delete _0x27e6c7[_0xf61a('0x4e')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x27e6c7[_0xf61a('0x4a')]['id']}})[_0xf61a('0x19')](handleEntityNotFound(_0x3aa24d,null))[_0xf61a('0x19')](saveUpdates(_0x27e6c7[_0xf61a('0x4e')],null))[_0xf61a('0x19')](respondWithResult(_0x3aa24d,null))[_0xf61a('0x21')](handleError(_0x3aa24d,null));};exports[_0xf61a('0x2c')]=function(_0x56020b,_0x6a81b3){return db[_0xf61a('0x44')][_0xf61a('0x4c')]({'where':{'id':_0x56020b[_0xf61a('0x4a')]['id']}})[_0xf61a('0x19')](handleEntityNotFound(_0x6a81b3,null))[_0xf61a('0x19')](removeEntity(_0x6a81b3,null))[_0xf61a('0x21')](handleError(_0x6a81b3,null));};exports['getConfigurations']=function(_0x3cc2fc,_0x503021,_0xe052de){var _0x3f7d8f={};var _0x4c4380={};var _0x5e6212;var _0x23015e;return db[_0xf61a('0x44')]['findOne']({'where':{'id':_0x3cc2fc['params']['id']}})[_0xf61a('0x19')](handleEntityNotFound(_0x503021,null))['then'](function(_0x78c7cc){if(_0x78c7cc){_0x5e6212=_0x78c7cc;_0x4c4380[_0xf61a('0x33')]=_[_0xf61a('0x4b')](db[_0xf61a('0x4f')][_0xf61a('0x30')]);_0x4c4380[_0xf61a('0x34')]=_[_0xf61a('0x4b')](_0x3cc2fc[_0xf61a('0x34')]);_0x4c4380[_0xf61a('0x3e')]=_['intersection'](_0x4c4380[_0xf61a('0x33')],_0x4c4380[_0xf61a('0x34')]);_0x3f7d8f[_0xf61a('0x36')]=_[_0xf61a('0x35')](_0x4c4380[_0xf61a('0x33')],qs[_0xf61a('0x37')](_0x3cc2fc[_0xf61a('0x34')][_0xf61a('0x37')]));_0x3f7d8f[_0xf61a('0x36')]=_0x3f7d8f[_0xf61a('0x36')][_0xf61a('0x38')]?_0x3f7d8f[_0xf61a('0x36')]:_0x4c4380[_0xf61a('0x33')];_0x3f7d8f[_0xf61a('0x3b')]=qs[_0xf61a('0x3c')](_0x3cc2fc[_0xf61a('0x34')][_0xf61a('0x3c')]);_0x3f7d8f['where']=qs['filters'](_[_0xf61a('0x3f')](_0x3cc2fc[_0xf61a('0x34')],_0x4c4380[_0xf61a('0x3e')]));if(_0x3cc2fc[_0xf61a('0x34')][_0xf61a('0x42')]){_0x3f7d8f[_0xf61a('0x3d')]=_[_0xf61a('0x40')](_0x3f7d8f[_0xf61a('0x3d')],{'$or':_[_0xf61a('0x2f')](_0x3f7d8f[_0xf61a('0x36')],function(_0x98ee24){var _0x39b530={};_0x39b530[_0x98ee24]={'$like':'%'+_0x3cc2fc[_0xf61a('0x34')][_0xf61a('0x42')]+'%'};return _0x39b530;})});}_0x3f7d8f=_[_0xf61a('0x40')]({},_0x3f7d8f,_0x3cc2fc[_0xf61a('0x43')]);return _0x5e6212[_0xf61a('0x50')](_0x3f7d8f);}})[_0xf61a('0x19')](function(_0x16f522){if(_0x16f522){_0x23015e=_0x16f522[_0xf61a('0x38')];if(!_0x3cc2fc['query'][_0xf61a('0x39')](_0xf61a('0x3a'))){_0x3f7d8f['limit']=qs['limit'](_0x3cc2fc['query'][_0xf61a('0x28')]);_0x3f7d8f[_0xf61a('0x27')]=qs[_0xf61a('0x27')](_0x3cc2fc[_0xf61a('0x34')][_0xf61a('0x27')]);}return _0x5e6212['getConfigurations'](_0x3f7d8f);}})[_0xf61a('0x19')](function(_0x52a1a0){if(_0x52a1a0){return _0x52a1a0?{'count':_0x23015e,'rows':_0x52a1a0}:null;}})[_0xf61a('0x19')](respondWithResult(_0x503021,null))[_0xf61a('0x21')](handleError(_0x503021,null));};exports['addConfiguration']=function(_0x18601f,_0x3fc53c,_0x45b3dd){if(_0x18601f['body']['id']){delete _0x18601f['body']['id'];}return db[_0xf61a('0x44')]['findOne']({'where':{'id':_0x18601f[_0xf61a('0x4a')]['id']}})[_0xf61a('0x19')](handleEntityNotFound(_0x3fc53c,null))['then'](function(_0x1f8db8){if(_0x1f8db8){_0x18601f['body']['AccountId']=_0x1f8db8['id'];_0x18601f['body'][_0xf61a('0x51')]=integrations[_0xf61a('0x52')](_0x18601f[_0xf61a('0x4e')][_0xf61a('0x53')],_0x18601f[_0xf61a('0x4e')][_0xf61a('0x31')]);_0x18601f[_0xf61a('0x4e')][_0xf61a('0x54')]=integrations[_0xf61a('0x55')](_0x18601f[_0xf61a('0x4e')][_0xf61a('0x53')],_0x18601f[_0xf61a('0x4e')]['type']);return db['SugarcrmConfiguration'][_0xf61a('0x4d')](_0x18601f['body'],{'include':[{'model':db[_0xf61a('0x56')],'as':_0xf61a('0x51')},{'model':db[_0xf61a('0x56')],'as':'Descriptions'}]});}return null;})[_0xf61a('0x19')](respondWithResult(_0x3fc53c,null))[_0xf61a('0x21')](handleError(_0x3fc53c,null));};exports[_0xf61a('0x57')]=function(_0x135b80,_0xc20a19,_0x35e41a){var _0x2904ed='';var _0x23845a=['id',_0xf61a('0x2d'),_0xf61a('0x58'),_0xf61a('0x59'),'description',_0xf61a('0x5a'),'duration_hours',_0xf61a('0x5b'),_0xf61a('0x5c'),_0xf61a('0x5d'),_0xf61a('0x5e'),_0xf61a('0x5f')];return db[_0xf61a('0x44')][_0xf61a('0x60')]({'where':{'id':_0x135b80[_0xf61a('0x4a')]['id']},'attributes':['id','username',_0xf61a('0x61'),_0xf61a('0x62')]})['then'](handleEntityNotFound(_0xc20a19,null))[_0xf61a('0x19')](function(_0x431880){if(_0x431880){_0x2904ed=_0x431880[_0xf61a('0x62')];var _0xfed846=_0x2904ed[_0xf61a('0x63')](-0x1);if(_0xfed846==='/'){_0x2904ed=_0x2904ed[_0xf61a('0x64')](0x0,_0x2904ed[_0xf61a('0x65')](_0xfed846));}return rp({'method':_0xf61a('0x66'),'uri':util[_0xf61a('0x67')]('%s%s',_0x2904ed,_0xf61a('0x68')),'json':!![],'form':{'method':'login','input_type':_0xf61a('0x69'),'response_type':'JSON','rest_data':JSON[_0xf61a('0x6a')]({'user_auth':{'user_name':_0x431880[_0xf61a('0x6b')],'password':_0x431880['password'],'encryption':_0xf61a('0x6c')},'application':_0xf61a('0x6d')})}});}})[_0xf61a('0x19')](function(_0x4713b8){if(_0x4713b8&&_0x4713b8['name']!=='Invalid\x20Login'&&_0x4713b8['name']!==_0xf61a('0x6e')){return rp({'method':_0xf61a('0x66'),'uri':util[_0xf61a('0x67')]('%s%s',_0x2904ed,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xf61a('0x6f'),'input_type':'JSON','response_type':_0xf61a('0x69'),'rest_data':JSON['stringify']({'session':_0x4713b8['id'],'module_name':'Calls'})}})['then'](function(_0x46063c){if(_0x46063c){var _0x45401a=_[_0xf61a('0x70')](_0x46063c[_0xf61a('0x71')]);_['remove'](_0x45401a,function(_0x9041d4){return _0x23845a[_0xf61a('0x72')](_0x9041d4[_0xf61a('0x2d')]);});return{'count':_0x45401a[_0xf61a('0x38')],'rows':_['map'](_0x45401a,function(_0xa7713e){return{'id':_0xa7713e[_0xf61a('0x2d')],'name':_0xa7713e[_0xf61a('0x73')],'custom':_[_0xf61a('0x74')](_0xa7713e[_0xf61a('0x2d')],'_c')?!![]:![],'options':_0xa7713e['options']?_[_0xf61a('0x2f')](_[_0xf61a('0x70')](_0xa7713e[_0xf61a('0x43')]),function(_0xd9756e){return{'name':_0xd9756e['value'],'value':_0xd9756e[_0xf61a('0x2d')]};}):[]};})};}})[_0xf61a('0x19')](respondWithResult(_0xc20a19,null))[_0xf61a('0x21')](function(_0x115103){var _0xe9fefe=_0x135b80[_0xf61a('0x34')][_0xf61a('0x75')]?0x1f4:_0x115103[_0xf61a('0x76')]||0x1f4;logger['error'](_0xf61a('0x77'),_0xf61a('0x57'),_0xe9fefe,JSON['stringify'](_0x115103));delete _0x115103[_0xf61a('0x2d')];if(_0xe9fefe===0x191){_0xe9fefe=0x190;}_0xc20a19[_0xf61a('0x23')](_0xe9fefe)[_0xf61a('0x2e')](_0x135b80['query'][_0xf61a('0x75')]?{'message':_0xf61a('0x78'),'statusCode':_0x115103[_0xf61a('0x76')]}:_0x115103);});}else{var _0x1b32b1=0x1f4;_0xc20a19['status'](_0x1b32b1)[_0xf61a('0x2e')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xf12e=['value','statusCode','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','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','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','rows','catch','params','keys','includeAll','options','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','description','date_start','duration_hours','duration_minutes','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','get_module_fields','Calls','module_fields','remove','includes','endsWith','values'];(function(_0x379d27,_0x15ae43){var _0x5adf39=function(_0x11df29){while(--_0x11df29){_0x379d27['push'](_0x379d27['shift']());}};_0x5adf39(++_0x15ae43);}(_0xf12e,0x8b));var _0xef12=function(_0x9d39e9,_0x3aebc9){_0x9d39e9=_0x9d39e9-0x0;var _0x4ac75b=_0xf12e[_0x9d39e9];return _0x4ac75b;};'use strict';var pdf=require(_0xef12('0x0'));var emlformat=require(_0xef12('0x1'));var rimraf=require(_0xef12('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xef12('0x3'));var rp=require(_0xef12('0x4'));var moment=require(_0xef12('0x5'));var BPromise=require(_0xef12('0x6'));var Mustache=require(_0xef12('0x7'));var util=require(_0xef12('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xef12('0x9'));var ejs=require(_0xef12('0xa'));var fs=require('fs');var _=require(_0xef12('0xb'));var squel=require(_0xef12('0xc'));var crypto=require(_0xef12('0xd'));var jsforce=require(_0xef12('0xe'));var deskjs=require(_0xef12('0xf'));var toCsv=require(_0xef12('0x9'));var querystring=require(_0xef12('0x10'));var Papa=require(_0xef12('0x11'));var Redis=require(_0xef12('0x12'));var authService=require(_0xef12('0x13'));var qs=require(_0xef12('0x14'));var as=require(_0xef12('0x15'));var hardwareService=require(_0xef12('0x16'));var logger=require(_0xef12('0x17'))(_0xef12('0x18'));var utils=require(_0xef12('0x19'));var config=require(_0xef12('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xef12('0x1b'));var jayson=require(_0xef12('0x1c'));var client=jayson[_0xef12('0x1d')][_0xef12('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x55eccc,_0x295bb3,_0x1ced9f,_0x47ebb9){return new BPromise(function(_0x32557e,_0x55e97a){var _0x13cfd5=_0x47ebb9||client;return _0x13cfd5[_0xef12('0x1f')](_0x55eccc,_0x1ced9f)[_0xef12('0x20')](function(_0x2bfd06){logger[_0xef12('0x21')](_0xef12('0x22'),_0x295bb3,_0xef12('0x23'));logger[_0xef12('0x24')](_0xef12('0x25'),_0x295bb3,'request\x20sent',JSON['stringify'](_0x2bfd06));if(_0x2bfd06['error']){if(_0x2bfd06[_0xef12('0x26')][_0xef12('0x27')]===0x1f4){logger[_0xef12('0x26')](_0xef12('0x22'),_0x295bb3,_0x2bfd06[_0xef12('0x26')]['message']);return _0x55e97a(_0x2bfd06[_0xef12('0x26')][_0xef12('0x28')]);}logger[_0xef12('0x26')](_0xef12('0x22'),_0x295bb3,_0x2bfd06[_0xef12('0x26')][_0xef12('0x28')]);return _0x32557e(_0x2bfd06['error'][_0xef12('0x28')]);}else{logger[_0xef12('0x21')](_0xef12('0x22'),_0x295bb3,'request\x20sent');_0x32557e(_0x2bfd06[_0xef12('0x29')][_0xef12('0x28')]);}})['catch'](function(_0x5f0169){logger['error'](_0xef12('0x22'),_0x295bb3,_0x5f0169);_0x55e97a(_0x5f0169);});});}function respondWithStatusCode(_0x3c66ad,_0x201fd9){_0x201fd9=_0x201fd9||0xcc;return function(_0x225475){if(_0x225475){return _0x3c66ad[_0xef12('0x2a')](_0x201fd9);}return _0x3c66ad[_0xef12('0x2b')](_0x201fd9)[_0xef12('0x2c')]();};}function respondWithResult(_0x301f8e,_0x17ca80){_0x17ca80=_0x17ca80||0xc8;return function(_0x3a5726){if(_0x3a5726){return _0x301f8e[_0xef12('0x2b')](_0x17ca80)['json'](_0x3a5726);}};}function respondWithFilteredResult(_0x470811,_0x4ca22e){return function(_0x4f6201){if(_0x4f6201){var _0x5701e6=_0x4f6201[_0xef12('0x2d')],_0x13665c=_0x4ca22e[_0xef12('0x2e')],_0x2aac86=_0x4ca22e[_0xef12('0x2e')]+_0x4ca22e[_0xef12('0x2f')],_0x1ab30f;if(_0x2aac86>=_0x5701e6){_0x2aac86=_0x5701e6;_0x1ab30f=0xc8;}else{_0x1ab30f=0xce;}_0x470811['status'](_0x1ab30f);return _0x470811[_0xef12('0x30')](_0xef12('0x31'),_0x13665c+'-'+_0x2aac86+'/'+_0x5701e6)[_0xef12('0x32')](_0x4f6201);}return null;};}function patchUpdates(_0x589489){return function(_0x5cc94c){try{jsonpatch[_0xef12('0x33')](_0x5cc94c,_0x589489,!![]);}catch(_0x3085f0){return BPromise[_0xef12('0x34')](_0x3085f0);}return _0x5cc94c['save']();};}function saveUpdates(_0x104c0b,_0x3065e4){return function(_0x153954){if(_0x153954){return _0x153954[_0xef12('0x35')](_0x104c0b)['then'](function(_0x19de93){return _0x19de93;});}return null;};}function removeEntity(_0x33eef5,_0x435fcb){return function(_0x5e716d){if(_0x5e716d){return _0x5e716d[_0xef12('0x36')]()[_0xef12('0x20')](function(){_0x33eef5[_0xef12('0x2b')](0xcc)[_0xef12('0x2c')]();});}};}function handleEntityNotFound(_0x1f2246,_0x49402c){return function(_0x1081b4){if(!_0x1081b4){_0x1f2246[_0xef12('0x2a')](0x194);}return _0x1081b4;};}function handleError(_0x2c2093,_0x351f2b){_0x351f2b=_0x351f2b||0x1f4;return function(_0x262099){logger[_0xef12('0x26')](_0x262099[_0xef12('0x37')]);if(_0x262099['name']){delete _0x262099[_0xef12('0x38')];}_0x2c2093[_0xef12('0x2b')](_0x351f2b)[_0xef12('0x39')](_0x262099);};}exports[_0xef12('0x3a')]=function(_0x43b501,_0x2a82ab){var _0x2f02f1={},_0x44f32f={},_0x1a1408={'count':0x0,'rows':[]};var _0x576bd0=_[_0xef12('0x3b')](db[_0xef12('0x3c')][_0xef12('0x3d')],function(_0x3523d4){return{'name':_0x3523d4[_0xef12('0x3e')],'type':_0x3523d4[_0xef12('0x3f')]['key']};});_0x44f32f['model']=_[_0xef12('0x3b')](_0x576bd0,_0xef12('0x38'));_0x44f32f[_0xef12('0x40')]=_['keys'](_0x43b501[_0xef12('0x40')]);_0x44f32f[_0xef12('0x41')]=_[_0xef12('0x42')](_0x44f32f[_0xef12('0x43')],_0x44f32f[_0xef12('0x40')]);_0x2f02f1[_0xef12('0x44')]=_[_0xef12('0x42')](_0x44f32f['model'],qs[_0xef12('0x45')](_0x43b501[_0xef12('0x40')][_0xef12('0x45')]));_0x2f02f1[_0xef12('0x44')]=_0x2f02f1['attributes'][_0xef12('0x46')]?_0x2f02f1[_0xef12('0x44')]:_0x44f32f[_0xef12('0x43')];if(!_0x43b501[_0xef12('0x40')]['hasOwnProperty'](_0xef12('0x47'))){_0x2f02f1[_0xef12('0x2f')]=qs[_0xef12('0x2f')](_0x43b501[_0xef12('0x40')][_0xef12('0x2f')]);_0x2f02f1[_0xef12('0x2e')]=qs['offset'](_0x43b501[_0xef12('0x40')][_0xef12('0x2e')]);}_0x2f02f1[_0xef12('0x48')]=qs[_0xef12('0x49')](_0x43b501[_0xef12('0x40')][_0xef12('0x49')]);_0x2f02f1['where']=qs['filters'](_[_0xef12('0x4a')](_0x43b501[_0xef12('0x40')],_0x44f32f[_0xef12('0x41')]),_0x576bd0);if(_0x43b501['query'][_0xef12('0x4b')]){_0x2f02f1[_0xef12('0x4c')]=_[_0xef12('0x4d')](_0x2f02f1[_0xef12('0x4c')],{'$or':_[_0xef12('0x3b')](_0x576bd0,function(_0x3da43c){if(_0x3da43c[_0xef12('0x3f')]!==_0xef12('0x4e')){var _0x34d0cc={};_0x34d0cc[_0x3da43c['name']]={'$like':'%'+_0x43b501[_0xef12('0x40')]['filter']+'%'};return _0x34d0cc;}})});}_0x2f02f1=_[_0xef12('0x4d')]({},_0x2f02f1,_0x43b501['options']);var _0x14cf83={'where':_0x2f02f1[_0xef12('0x4c')]};return db[_0xef12('0x3c')][_0xef12('0x2d')](_0x14cf83)[_0xef12('0x20')](function(_0x35af1b){_0x1a1408[_0xef12('0x2d')]=_0x35af1b;if(_0x43b501['query']['includeAll']){_0x2f02f1[_0xef12('0x4f')]=[{'all':!![]}];}return db[_0xef12('0x3c')]['findAll'](_0x2f02f1);})[_0xef12('0x20')](function(_0x1a314d){_0x1a1408[_0xef12('0x50')]=_0x1a314d;return _0x1a1408;})[_0xef12('0x20')](respondWithFilteredResult(_0x2a82ab,_0x2f02f1))[_0xef12('0x51')](handleError(_0x2a82ab,null));};exports['show']=function(_0x36714f,_0xeb5698){var _0x2a1c38={'raw':![],'where':{'id':_0x36714f[_0xef12('0x52')]['id']}},_0x3e9859={};_0x3e9859[_0xef12('0x43')]=_[_0xef12('0x53')](db['SugarcrmAccount']['rawAttributes']);_0x3e9859[_0xef12('0x40')]=_[_0xef12('0x53')](_0x36714f[_0xef12('0x40')]);_0x3e9859[_0xef12('0x41')]=_[_0xef12('0x42')](_0x3e9859['model'],_0x3e9859[_0xef12('0x40')]);_0x2a1c38[_0xef12('0x44')]=_[_0xef12('0x42')](_0x3e9859[_0xef12('0x43')],qs[_0xef12('0x45')](_0x36714f[_0xef12('0x40')][_0xef12('0x45')]));_0x2a1c38[_0xef12('0x44')]=_0x2a1c38[_0xef12('0x44')][_0xef12('0x46')]?_0x2a1c38[_0xef12('0x44')]:_0x3e9859[_0xef12('0x43')];if(_0x36714f['query'][_0xef12('0x54')]){_0x2a1c38[_0xef12('0x4f')]=[{'all':!![]}];}_0x2a1c38=_[_0xef12('0x4d')]({},_0x2a1c38,_0x36714f[_0xef12('0x55')]);return db[_0xef12('0x3c')][_0xef12('0x56')](_0x2a1c38)[_0xef12('0x20')](handleEntityNotFound(_0xeb5698,null))[_0xef12('0x20')](respondWithResult(_0xeb5698,null))[_0xef12('0x51')](handleError(_0xeb5698,null));};exports[_0xef12('0x57')]=function(_0x5e6b6d,_0x3418b8){return db[_0xef12('0x3c')][_0xef12('0x57')](_0x5e6b6d[_0xef12('0x58')],{})[_0xef12('0x20')](respondWithResult(_0x3418b8,0xc9))[_0xef12('0x51')](handleError(_0x3418b8,null));};exports[_0xef12('0x35')]=function(_0x139581,_0x553e3f){if(_0x139581[_0xef12('0x58')]['id']){delete _0x139581['body']['id'];}return db[_0xef12('0x3c')][_0xef12('0x56')]({'where':{'id':_0x139581[_0xef12('0x52')]['id']}})['then'](handleEntityNotFound(_0x553e3f,null))[_0xef12('0x20')](saveUpdates(_0x139581[_0xef12('0x58')],null))[_0xef12('0x20')](respondWithResult(_0x553e3f,null))[_0xef12('0x51')](handleError(_0x553e3f,null));};exports[_0xef12('0x36')]=function(_0xdffc72,_0x17d633){return db['SugarcrmAccount'][_0xef12('0x56')]({'where':{'id':_0xdffc72['params']['id']}})[_0xef12('0x20')](handleEntityNotFound(_0x17d633,null))['then'](removeEntity(_0x17d633,null))[_0xef12('0x51')](handleError(_0x17d633,null));};exports[_0xef12('0x59')]=function(_0x5ddf24,_0x542da3,_0x4ec852){var _0x58a48b={};var _0x26b1fa={};var _0x56eea5;var _0x412166;return db['SugarcrmAccount'][_0xef12('0x5a')]({'where':{'id':_0x5ddf24[_0xef12('0x52')]['id']}})[_0xef12('0x20')](handleEntityNotFound(_0x542da3,null))[_0xef12('0x20')](function(_0x5d57a5){if(_0x5d57a5){_0x56eea5=_0x5d57a5;_0x26b1fa[_0xef12('0x43')]=_['keys'](db[_0xef12('0x5b')]['rawAttributes']);_0x26b1fa[_0xef12('0x40')]=_[_0xef12('0x53')](_0x5ddf24[_0xef12('0x40')]);_0x26b1fa[_0xef12('0x41')]=_['intersection'](_0x26b1fa[_0xef12('0x43')],_0x26b1fa[_0xef12('0x40')]);_0x58a48b['attributes']=_[_0xef12('0x42')](_0x26b1fa[_0xef12('0x43')],qs[_0xef12('0x45')](_0x5ddf24['query'][_0xef12('0x45')]));_0x58a48b[_0xef12('0x44')]=_0x58a48b[_0xef12('0x44')][_0xef12('0x46')]?_0x58a48b[_0xef12('0x44')]:_0x26b1fa[_0xef12('0x43')];_0x58a48b['order']=qs[_0xef12('0x49')](_0x5ddf24['query'][_0xef12('0x49')]);_0x58a48b[_0xef12('0x4c')]=qs[_0xef12('0x41')](_[_0xef12('0x4a')](_0x5ddf24['query'],_0x26b1fa[_0xef12('0x41')]));if(_0x5ddf24['query'][_0xef12('0x4b')]){_0x58a48b['where']=_[_0xef12('0x4d')](_0x58a48b['where'],{'$or':_[_0xef12('0x3b')](_0x58a48b[_0xef12('0x44')],function(_0x3ab3ff){var _0x3330a2={};_0x3330a2[_0x3ab3ff]={'$like':'%'+_0x5ddf24['query']['filter']+'%'};return _0x3330a2;})});}_0x58a48b=_['merge']({},_0x58a48b,_0x5ddf24[_0xef12('0x55')]);return _0x56eea5[_0xef12('0x59')](_0x58a48b);}})[_0xef12('0x20')](function(_0x450851){if(_0x450851){_0x412166=_0x450851['length'];if(!_0x5ddf24['query'][_0xef12('0x5c')](_0xef12('0x47'))){_0x58a48b[_0xef12('0x2f')]=qs['limit'](_0x5ddf24[_0xef12('0x40')][_0xef12('0x2f')]);_0x58a48b[_0xef12('0x2e')]=qs['offset'](_0x5ddf24[_0xef12('0x40')]['offset']);}return _0x56eea5['getConfigurations'](_0x58a48b);}})[_0xef12('0x20')](function(_0x32d3a1){if(_0x32d3a1){return _0x32d3a1?{'count':_0x412166,'rows':_0x32d3a1}:null;}})[_0xef12('0x20')](respondWithResult(_0x542da3,null))[_0xef12('0x51')](handleError(_0x542da3,null));};exports[_0xef12('0x5d')]=function(_0x19bf36,_0x4b4c7f,_0x38b5a3){if(_0x19bf36[_0xef12('0x58')]['id']){delete _0x19bf36[_0xef12('0x58')]['id'];}return db[_0xef12('0x3c')][_0xef12('0x5a')]({'where':{'id':_0x19bf36['params']['id']}})['then'](handleEntityNotFound(_0x4b4c7f,null))[_0xef12('0x20')](function(_0x596d96){if(_0x596d96){_0x19bf36[_0xef12('0x58')][_0xef12('0x5e')]=_0x596d96['id'];_0x19bf36[_0xef12('0x58')][_0xef12('0x5f')]=integrations[_0xef12('0x60')](_0x19bf36[_0xef12('0x58')][_0xef12('0x61')],_0x19bf36[_0xef12('0x58')][_0xef12('0x3f')]);_0x19bf36[_0xef12('0x58')][_0xef12('0x62')]=integrations[_0xef12('0x63')](_0x19bf36[_0xef12('0x58')]['channel'],_0x19bf36['body']['type']);return db[_0xef12('0x5b')][_0xef12('0x57')](_0x19bf36[_0xef12('0x58')],{'include':[{'model':db[_0xef12('0x64')],'as':_0xef12('0x5f')},{'model':db[_0xef12('0x64')],'as':_0xef12('0x62')}]});}return null;})[_0xef12('0x20')](respondWithResult(_0x4b4c7f,null))[_0xef12('0x51')](handleError(_0x4b4c7f,null));};exports[_0xef12('0x65')]=function(_0x11cad6,_0x581ff6,_0x57a5bc){var _0x39ae98='';var _0x26b529=['id','name','assigned_user_id','created_by',_0xef12('0x66'),_0xef12('0x67'),_0xef12('0x68'),_0xef12('0x69'),'parent_id','parent_type',_0xef12('0x6a'),_0xef12('0x6b')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x11cad6[_0xef12('0x52')]['id']},'attributes':['id',_0xef12('0x6c'),_0xef12('0x6d'),_0xef12('0x6e')]})[_0xef12('0x20')](handleEntityNotFound(_0x581ff6,null))[_0xef12('0x20')](function(_0x5ab3af){if(_0x5ab3af){_0x39ae98=_0x5ab3af[_0xef12('0x6e')];var _0x4d11d3=_0x39ae98[_0xef12('0x6f')](-0x1);if(_0x4d11d3==='/'){_0x39ae98=_0x39ae98[_0xef12('0x70')](0x0,_0x39ae98[_0xef12('0x71')](_0x4d11d3));}return rp({'method':_0xef12('0x72'),'uri':util['format'](_0xef12('0x73'),_0x39ae98,_0xef12('0x74')),'json':!![],'form':{'method':_0xef12('0x75'),'input_type':_0xef12('0x76'),'response_type':_0xef12('0x76'),'rest_data':JSON[_0xef12('0x77')]({'user_auth':{'user_name':_0x5ab3af[_0xef12('0x6c')],'password':_0x5ab3af[_0xef12('0x6d')],'encryption':'PLAIN'},'application':_0xef12('0x78')})}});}})[_0xef12('0x20')](function(_0x5196c6){if(_0x5196c6&&_0x5196c6[_0xef12('0x38')]!==_0xef12('0x79')&&_0x5196c6['name']!==_0xef12('0x7a')){return rp({'method':'POST','uri':util[_0xef12('0x7b')]('%s%s',_0x39ae98,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xef12('0x7c'),'input_type':_0xef12('0x76'),'response_type':_0xef12('0x76'),'rest_data':JSON[_0xef12('0x77')]({'session':_0x5196c6['id'],'module_name':_0xef12('0x7d')})}})[_0xef12('0x20')](function(_0x1f1506){if(_0x1f1506){var _0x4614a8=_['values'](_0x1f1506[_0xef12('0x7e')]);_[_0xef12('0x7f')](_0x4614a8,function(_0x305a8d){return _0x26b529[_0xef12('0x80')](_0x305a8d[_0xef12('0x38')]);});return{'count':_0x4614a8[_0xef12('0x46')],'rows':_[_0xef12('0x3b')](_0x4614a8,function(_0x590013){return{'id':_0x590013['name'],'name':_0x590013['label'],'custom':_[_0xef12('0x81')](_0x590013[_0xef12('0x38')],'_c')?!![]:![],'options':_0x590013['options']?_[_0xef12('0x3b')](_[_0xef12('0x82')](_0x590013[_0xef12('0x55')]),function(_0x1709a5){return{'name':_0x1709a5[_0xef12('0x83')],'value':_0x1709a5[_0xef12('0x38')]};}):[]};})};}})['then'](respondWithResult(_0x581ff6,null))[_0xef12('0x51')](function(_0x361a90){var _0x178067=_0x11cad6['query']['test']?0x1f4:_0x361a90[_0xef12('0x84')]||0x1f4;logger[_0xef12('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0xef12('0x65'),_0x178067,JSON['stringify'](_0x361a90));delete _0x361a90['name'];if(_0x178067===0x191){_0x178067=0x190;}_0x581ff6[_0xef12('0x2b')](_0x178067)[_0xef12('0x39')](_0x11cad6[_0xef12('0x40')][_0xef12('0x85')]?{'message':_0xef12('0x86'),'statusCode':_0x361a90[_0xef12('0x84')]}:_0x361a90);});}else{var _0x29b9ca=0x1f4;_0x581ff6['status'](_0x29b9ca)[_0xef12('0x39')]({'message':_0xef12('0x86'),'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 fb855cd..782bd96 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 _0xbed0=['rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','int_sugarcrm_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x51cf64,_0x303dab){var _0x2c982b=function(_0x471301){while(--_0x471301){_0x51cf64['push'](_0x51cf64['shift']());}};_0x2c982b(++_0x303dab);}(_0xbed0,0x1bc));var _0x0bed=function(_0x2ef411,_0x431556){_0x2ef411=_0x2ef411-0x0;var _0x1a9f83=_0xbed0[_0x2ef411];return _0x1a9f83;};'use strict';var _=require(_0x0bed('0x0'));var util=require(_0x0bed('0x1'));var logger=require(_0x0bed('0x2'))('api');var moment=require(_0x0bed('0x3'));var BPromise=require(_0x0bed('0x4'));var rp=require(_0x0bed('0x5'));var fs=require('fs');var path=require(_0x0bed('0x6'));var rimraf=require(_0x0bed('0x7'));var config=require('../../config/environment');var attributes=require(_0x0bed('0x8'));var integrations=require(_0x0bed('0x9'));module['exports']=function(_0x3a731b,_0x4b2294){return _0x3a731b['define']('SugarcrmAccount',attributes,{'tableName':_0x0bed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5246=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x333b8c,_0x8c792d){var _0x3af725=function(_0x3ca04f){while(--_0x3ca04f){_0x333b8c['push'](_0x333b8c['shift']());}};_0x3af725(++_0x8c792d);}(_0x5246,0x1e7));var _0x6524=function(_0x3e42d3,_0x50c274){_0x3e42d3=_0x3e42d3-0x0;var _0x39a80d=_0x5246[_0x3e42d3];return _0x39a80d;};'use strict';var _=require('lodash');var util=require(_0x6524('0x0'));var logger=require(_0x6524('0x1'))('api');var moment=require(_0x6524('0x2'));var BPromise=require(_0x6524('0x3'));var rp=require(_0x6524('0x4'));var fs=require('fs');var path=require(_0x6524('0x5'));var rimraf=require(_0x6524('0x6'));var config=require('../../config/environment');var attributes=require(_0x6524('0x7'));var integrations=require(_0x6524('0x8'));module[_0x6524('0x9')]=function(_0x428d6b,_0x3a6324){return _0x428d6b[_0x6524('0xa')](_0x6524('0xb'),attributes,{'tableName':_0x6524('0xc'),'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 c702edb..77f39c6 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 _0x484c=['map','model','include','debug','catch','ShowSugarcrmAccount','find','raw','then','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x484c,0x6c));var _0xc484=function(_0x1ee6c2,_0x14e09f){_0x1ee6c2=_0x1ee6c2-0x0;var _0x435323=_0x484c[_0x1ee6c2];return _0x435323;};'use strict';var _=require(_0xc484('0x0'));var util=require('util');var moment=require(_0xc484('0x1'));var BPromise=require(_0xc484('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc484('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc484('0x4'));var logger=require(_0xc484('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc484('0x6'));var client=jayson[_0xc484('0x7')][_0xc484('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2bdfa7,_0x4225f4,_0x315ee){return new BPromise(function(_0x35f3c9,_0x1bc82c){return client[_0xc484('0x9')](_0x2bdfa7,_0x315ee)['then'](function(_0x310fd8){logger[_0xc484('0xa')](_0xc484('0xb'),_0x4225f4,_0xc484('0xc'));logger['debug'](_0xc484('0xd'),_0x4225f4,'request\x20sent',JSON[_0xc484('0xe')](_0x310fd8));if(_0x310fd8[_0xc484('0xf')]){if(_0x310fd8[_0xc484('0xf')][_0xc484('0x10')]===0x1f4){logger[_0xc484('0xf')](_0xc484('0xb'),_0x4225f4,_0x310fd8['error'][_0xc484('0x11')]);return _0x1bc82c(_0x310fd8[_0xc484('0xf')][_0xc484('0x11')]);}logger[_0xc484('0xf')](_0xc484('0xb'),_0x4225f4,_0x310fd8[_0xc484('0xf')][_0xc484('0x11')]);return _0x35f3c9(_0x310fd8[_0xc484('0xf')][_0xc484('0x11')]);}else{logger[_0xc484('0xa')](_0xc484('0xb'),_0x4225f4,'request\x20sent');_0x35f3c9(_0x310fd8['result'][_0xc484('0x11')]);}})['catch'](function(_0xd1a3aa){logger[_0xc484('0xf')](_0xc484('0xb'),_0x4225f4,_0xd1a3aa);_0x1bc82c(_0xd1a3aa);});});}exports[_0xc484('0x12')]=function(_0x3ba6a7){var _0x422d66=this;return new Promise(function(_0x183324,_0x3a913a){return db[_0xc484('0x13')][_0xc484('0x14')]({'raw':_0x3ba6a7[_0xc484('0x15')]?_0x3ba6a7[_0xc484('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3ba6a7['options']?_0x3ba6a7['options'][_0xc484('0x16')]||null:null,'attributes':_0x3ba6a7['options']?_0x3ba6a7[_0xc484('0x15')][_0xc484('0x17')]||null:null,'limit':_0x3ba6a7[_0xc484('0x15')]?_0x3ba6a7[_0xc484('0x15')]['limit']||null:null,'include':_0x3ba6a7[_0xc484('0x15')]?_0x3ba6a7[_0xc484('0x15')]['include']?_[_0xc484('0x18')](_0x3ba6a7[_0xc484('0x15')]['include'],function(_0x492132){return{'model':db[_0x492132[_0xc484('0x19')]],'as':_0x492132['as'],'attributes':_0x492132[_0xc484('0x17')],'include':_0x492132[_0xc484('0x1a')]?_[_0xc484('0x18')](_0x492132['include'],function(_0x5c5f5d){return{'model':db[_0x5c5f5d['model']],'as':_0x5c5f5d['as'],'attributes':_0x5c5f5d[_0xc484('0x17')],'include':_0x5c5f5d[_0xc484('0x1a')]?_[_0xc484('0x18')](_0x5c5f5d[_0xc484('0x1a')],function(_0x504e0a){return{'model':db[_0x504e0a['model']],'as':_0x504e0a['as'],'attributes':_0x504e0a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c162b){logger[_0xc484('0xa')](_0xc484('0x12'),_0x3ba6a7);logger[_0xc484('0x1b')](_0xc484('0x12'),_0x3ba6a7,JSON[_0xc484('0xe')](_0x5c162b));_0x183324(_0x5c162b);})[_0xc484('0x1c')](function(_0x3acce2){logger[_0xc484('0xf')](_0xc484('0x12'),_0x3acce2['message'],_0x3ba6a7);_0x3a913a(_0x422d66[_0xc484('0xf')](0x1f4,_0x3acce2[_0xc484('0x11')]));});});};exports[_0xc484('0x1d')]=function(_0x5b28bd){var _0x1b7475=this;return new Promise(function(_0x5d456e,_0x9d4f5e){return db['SugarcrmAccount'][_0xc484('0x1e')]({'raw':_0x5b28bd[_0xc484('0x15')]?_0x5b28bd[_0xc484('0x15')][_0xc484('0x1f')]===undefined?!![]:![]:!![],'where':_0x5b28bd[_0xc484('0x15')]?_0x5b28bd[_0xc484('0x15')][_0xc484('0x16')]||null:null,'attributes':_0x5b28bd[_0xc484('0x15')]?_0x5b28bd[_0xc484('0x15')][_0xc484('0x17')]||null:null,'include':_0x5b28bd[_0xc484('0x15')]?_0x5b28bd[_0xc484('0x15')][_0xc484('0x1a')]?_[_0xc484('0x18')](_0x5b28bd[_0xc484('0x15')][_0xc484('0x1a')],function(_0x29ad2f){return{'model':db[_0x29ad2f['model']],'as':_0x29ad2f['as'],'attributes':_0x29ad2f[_0xc484('0x17')],'include':_0x29ad2f[_0xc484('0x1a')]?_[_0xc484('0x18')](_0x29ad2f[_0xc484('0x1a')],function(_0x39465e){return{'model':db[_0x39465e[_0xc484('0x19')]],'as':_0x39465e['as'],'attributes':_0x39465e[_0xc484('0x17')],'include':_0x39465e[_0xc484('0x1a')]?_[_0xc484('0x18')](_0x39465e[_0xc484('0x1a')],function(_0x5f0c76){return{'model':db[_0x5f0c76[_0xc484('0x19')]],'as':_0x5f0c76['as'],'attributes':_0x5f0c76[_0xc484('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc484('0x20')](function(_0x3da585){logger[_0xc484('0xa')]('ShowSugarcrmAccount',_0x5b28bd);logger['debug'](_0xc484('0x1d'),_0x5b28bd,JSON[_0xc484('0xe')](_0x3da585));_0x5d456e(_0x3da585);})['catch'](function(_0x2452c9){logger[_0xc484('0xf')]('ShowSugarcrmAccount',_0x2452c9[_0xc484('0x11')],_0x5b28bd);_0x9d4f5e(_0x1b7475[_0xc484('0xf')](0x1f4,_0x2452c9[_0xc484('0x11')]));});});}; \ No newline at end of file +var _0x35ab=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include','map','attributes','model','info','debug','ShowSugarcrmAccount','find','then'];(function(_0x26b35d,_0x5036ab){var _0x549d4d=function(_0x467d2e){while(--_0x467d2e){_0x26b35d['push'](_0x26b35d['shift']());}};_0x549d4d(++_0x5036ab);}(_0x35ab,0x168));var _0xb35a=function(_0x44c583,_0xdc4d48){_0x44c583=_0x44c583-0x0;var _0x396a41=_0x35ab[_0x44c583];return _0x396a41;};'use strict';var _=require('lodash');var util=require(_0xb35a('0x0'));var moment=require('moment');var BPromise=require(_0xb35a('0x1'));var rs=require(_0xb35a('0x2'));var fs=require('fs');var Redis=require(_0xb35a('0x3'));var db=require(_0xb35a('0x4'))['db'];var utils=require(_0xb35a('0x5'));var logger=require(_0xb35a('0x6'))(_0xb35a('0x7'));var config=require('../../config/environment');var jayson=require(_0xb35a('0x8'));var client=jayson[_0xb35a('0x9')][_0xb35a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58441d,_0x18970b,_0x5fb009){return new BPromise(function(_0x57f55a,_0x1547f3){return client[_0xb35a('0xb')](_0x58441d,_0x5fb009)['then'](function(_0x277903){logger['info'](_0xb35a('0xc'),_0x18970b,'request\x20sent');logger['debug'](_0xb35a('0xd'),_0x18970b,'request\x20sent',JSON[_0xb35a('0xe')](_0x277903));if(_0x277903['error']){if(_0x277903[_0xb35a('0xf')]['code']===0x1f4){logger[_0xb35a('0xf')](_0xb35a('0xc'),_0x18970b,_0x277903[_0xb35a('0xf')][_0xb35a('0x10')]);return _0x1547f3(_0x277903['error'][_0xb35a('0x10')]);}logger[_0xb35a('0xf')](_0xb35a('0xc'),_0x18970b,_0x277903[_0xb35a('0xf')][_0xb35a('0x10')]);return _0x57f55a(_0x277903[_0xb35a('0xf')]['message']);}else{logger['info'](_0xb35a('0xc'),_0x18970b,_0xb35a('0x11'));_0x57f55a(_0x277903[_0xb35a('0x12')][_0xb35a('0x10')]);}})[_0xb35a('0x13')](function(_0x3dafcb){logger[_0xb35a('0xf')](_0xb35a('0xc'),_0x18970b,_0x3dafcb);_0x1547f3(_0x3dafcb);});});}exports[_0xb35a('0x14')]=function(_0x32a2b0){var _0x45b6ba=this;return new Promise(function(_0x51c1fd,_0x2b0ec8){return db[_0xb35a('0x15')][_0xb35a('0x16')]({'raw':_0x32a2b0[_0xb35a('0x17')]?_0x32a2b0[_0xb35a('0x17')][_0xb35a('0x18')]===undefined?!![]:![]:!![],'where':_0x32a2b0[_0xb35a('0x17')]?_0x32a2b0[_0xb35a('0x17')][_0xb35a('0x19')]||null:null,'attributes':_0x32a2b0[_0xb35a('0x17')]?_0x32a2b0['options']['attributes']||null:null,'limit':_0x32a2b0[_0xb35a('0x17')]?_0x32a2b0[_0xb35a('0x17')][_0xb35a('0x1a')]||null:null,'include':_0x32a2b0['options']?_0x32a2b0[_0xb35a('0x17')][_0xb35a('0x1b')]?_[_0xb35a('0x1c')](_0x32a2b0['options'][_0xb35a('0x1b')],function(_0x583432){return{'model':db[_0x583432['model']],'as':_0x583432['as'],'attributes':_0x583432[_0xb35a('0x1d')],'include':_0x583432[_0xb35a('0x1b')]?_[_0xb35a('0x1c')](_0x583432['include'],function(_0x4b1223){return{'model':db[_0x4b1223[_0xb35a('0x1e')]],'as':_0x4b1223['as'],'attributes':_0x4b1223['attributes'],'include':_0x4b1223[_0xb35a('0x1b')]?_[_0xb35a('0x1c')](_0x4b1223[_0xb35a('0x1b')],function(_0x46775d){return{'model':db[_0x46775d[_0xb35a('0x1e')]],'as':_0x46775d['as'],'attributes':_0x46775d[_0xb35a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34b87b){logger[_0xb35a('0x1f')](_0xb35a('0x14'),_0x32a2b0);logger[_0xb35a('0x20')]('GetSugarcrmAccount',_0x32a2b0,JSON[_0xb35a('0xe')](_0x34b87b));_0x51c1fd(_0x34b87b);})[_0xb35a('0x13')](function(_0x55583b){logger[_0xb35a('0xf')](_0xb35a('0x14'),_0x55583b[_0xb35a('0x10')],_0x32a2b0);_0x2b0ec8(_0x45b6ba['error'](0x1f4,_0x55583b['message']));});});};exports[_0xb35a('0x21')]=function(_0x4f9813){var _0x29af43=this;return new Promise(function(_0x1cf817,_0x3bf20c){return db[_0xb35a('0x15')][_0xb35a('0x22')]({'raw':_0x4f9813[_0xb35a('0x17')]?_0x4f9813['options'][_0xb35a('0x18')]===undefined?!![]:![]:!![],'where':_0x4f9813[_0xb35a('0x17')]?_0x4f9813[_0xb35a('0x17')][_0xb35a('0x19')]||null:null,'attributes':_0x4f9813[_0xb35a('0x17')]?_0x4f9813[_0xb35a('0x17')][_0xb35a('0x1d')]||null:null,'include':_0x4f9813[_0xb35a('0x17')]?_0x4f9813['options'][_0xb35a('0x1b')]?_['map'](_0x4f9813[_0xb35a('0x17')]['include'],function(_0x11f417){return{'model':db[_0x11f417[_0xb35a('0x1e')]],'as':_0x11f417['as'],'attributes':_0x11f417[_0xb35a('0x1d')],'include':_0x11f417['include']?_['map'](_0x11f417[_0xb35a('0x1b')],function(_0x7053fb){return{'model':db[_0x7053fb[_0xb35a('0x1e')]],'as':_0x7053fb['as'],'attributes':_0x7053fb[_0xb35a('0x1d')],'include':_0x7053fb[_0xb35a('0x1b')]?_['map'](_0x7053fb[_0xb35a('0x1b')],function(_0x182640){return{'model':db[_0x182640[_0xb35a('0x1e')]],'as':_0x182640['as'],'attributes':_0x182640[_0xb35a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb35a('0x23')](function(_0x72eb6b){logger['info'](_0xb35a('0x21'),_0x4f9813);logger[_0xb35a('0x20')](_0xb35a('0x21'),_0x4f9813,JSON[_0xb35a('0xe')](_0x72eb6b));_0x1cf817(_0x72eb6b);})[_0xb35a('0x13')](function(_0x4cbbe9){logger[_0xb35a('0xf')](_0xb35a('0x21'),_0x4cbbe9['message'],_0x4f9813);_0x3bf20c(_0x29af43['error'](0x1f4,_0x4cbbe9[_0xb35a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 13b9d34..76c055d 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 _0x4c06=['util','path','connect-timeout','Router','../../components/auth/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4c06,0xd7));var _0x64c0=function(_0x4503df,_0xfec122){_0x4503df=_0x4503df-0x0;var _0x3f1b2b=_0x4c06[_0x4503df];return _0x3f1b2b;};'use strict';var multer=require(_0x64c0('0x0'));var util=require(_0x64c0('0x1'));var path=require(_0x64c0('0x2'));var timeout=require(_0x64c0('0x3'));var express=require('express');var router=express[_0x64c0('0x4')]();var auth=require(_0x64c0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x64c0('0x6'));router[_0x64c0('0x7')]('/',auth[_0x64c0('0x8')](),controller[_0x64c0('0x9')]);router[_0x64c0('0x7')](_0x64c0('0xa'),auth[_0x64c0('0x8')](),controller[_0x64c0('0xb')]);router[_0x64c0('0x7')](_0x64c0('0xc'),auth[_0x64c0('0x8')](),controller['getFields']);router[_0x64c0('0x7')](_0x64c0('0xd'),auth[_0x64c0('0x8')](),controller[_0x64c0('0xe')]);router[_0x64c0('0x7')](_0x64c0('0xf'),auth[_0x64c0('0x8')](),controller[_0x64c0('0x10')]);router[_0x64c0('0x11')]('/',auth[_0x64c0('0x8')](),controller[_0x64c0('0x12')]);router[_0x64c0('0x13')](_0x64c0('0xa'),auth['isAuthenticated'](),controller[_0x64c0('0x14')]);router[_0x64c0('0x15')](_0x64c0('0xa'),auth[_0x64c0('0x8')](),controller[_0x64c0('0x16')]);module[_0x64c0('0x17')]=router; \ No newline at end of file +var _0xda6b=['./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x33e4f7,_0x3c8f5d){var _0x379b29=function(_0x575f4e){while(--_0x575f4e){_0x33e4f7['push'](_0x33e4f7['shift']());}};_0x379b29(++_0x3c8f5d);}(_0xda6b,0x19c));var _0xbda6=function(_0x2527dc,_0x46e645){_0x2527dc=_0x2527dc-0x0;var _0x11eb55=_0xda6b[_0x2527dc];return _0x11eb55;};'use strict';var multer=require(_0xbda6('0x0'));var util=require('util');var path=require(_0xbda6('0x1'));var timeout=require(_0xbda6('0x2'));var express=require(_0xbda6('0x3'));var router=express[_0xbda6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbda6('0x5'));var config=require('../../config/environment');var controller=require(_0xbda6('0x6'));router[_0xbda6('0x7')]('/',auth[_0xbda6('0x8')](),controller[_0xbda6('0x9')]);router['get'](_0xbda6('0xa'),auth[_0xbda6('0x8')](),controller[_0xbda6('0xb')]);router[_0xbda6('0x7')](_0xbda6('0xc'),auth[_0xbda6('0x8')](),controller[_0xbda6('0xd')]);router[_0xbda6('0x7')]('/:id/subjects',auth[_0xbda6('0x8')](),controller[_0xbda6('0xe')]);router[_0xbda6('0x7')](_0xbda6('0xf'),auth[_0xbda6('0x8')](),controller[_0xbda6('0x10')]);router[_0xbda6('0x11')]('/',auth[_0xbda6('0x8')](),controller[_0xbda6('0x12')]);router[_0xbda6('0x13')](_0xbda6('0xa'),auth[_0xbda6('0x8')](),controller['update']);router['delete'](_0xbda6('0xa'),auth['isAuthenticated'](),controller[_0xbda6('0x14')]);module[_0xbda6('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 501dca1..be3831d 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 _0x4121=['exports','STRING','sequelize'];(function(_0x761607,_0x3484bd){var _0x55da15=function(_0x21dba1){while(--_0x21dba1){_0x761607['push'](_0x761607['shift']());}};_0x55da15(++_0x3484bd);}(_0x4121,0x119));var _0x1412=function(_0x225fc7,_0x5666d3){_0x225fc7=_0x225fc7-0x0;var _0x87e784=_0x4121[_0x225fc7];return _0x87e784;};'use strict';var Sequelize=require(_0x1412('0x0'));module[_0x1412('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1412('0x2')]}}; \ No newline at end of file +var _0xc1bc=['exports','STRING'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0xc1bc,0x11e));var _0xcc1b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc1bc[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xcc1b('0x0')]={'name':{'type':Sequelize[_0xcc1b('0x1')]},'description':{'type':Sequelize[_0xcc1b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 7659990..2cb9671 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 _0x770f=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','includeAll','include','findAll','rows','catch','show','create','body','find','params','getFields','findOne','length','order','options','getSubjects','SugarcrmField','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x770f,0xab));var _0xf770=function(_0x2fff83,_0x29d5fe){_0x2fff83=_0x2fff83-0x0;var _0xa2a722=_0x770f[_0x2fff83];return _0xa2a722;};'use strict';var pdf=require(_0xf770('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf770('0x1'));var zipdir=require(_0xf770('0x2'));var jsonpatch=require(_0xf770('0x3'));var rp=require(_0xf770('0x4'));var moment=require('moment');var BPromise=require(_0xf770('0x5'));var Mustache=require('mustache');var util=require(_0xf770('0x6'));var path=require(_0xf770('0x7'));var sox=require(_0xf770('0x8'));var csv=require(_0xf770('0x9'));var ejs=require(_0xf770('0xa'));var fs=require('fs');var _=require(_0xf770('0xb'));var squel=require(_0xf770('0xc'));var crypto=require('crypto');var jsforce=require(_0xf770('0xd'));var deskjs=require(_0xf770('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf770('0xf'));var Papa=require(_0xf770('0x10'));var Redis=require(_0xf770('0x11'));var authService=require(_0xf770('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf770('0x13'));var hardwareService=require(_0xf770('0x14'));var logger=require(_0xf770('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xf770('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf770('0x17'))['db'];var jayson=require(_0xf770('0x18'));var client=jayson[_0xf770('0x19')][_0xf770('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5db377,_0x56db57,_0x47b0a2,_0x5debb6){return new BPromise(function(_0x401d2c,_0x4d8d04){var _0x418d2c=_0x5debb6||client;return _0x418d2c[_0xf770('0x1b')](_0x5db377,_0x47b0a2)[_0xf770('0x1c')](function(_0xd7d336){logger[_0xf770('0x1d')](_0xf770('0x1e'),_0x56db57,_0xf770('0x1f'));logger['debug'](_0xf770('0x20'),_0x56db57,_0xf770('0x1f'),JSON[_0xf770('0x21')](_0xd7d336));if(_0xd7d336[_0xf770('0x22')]){if(_0xd7d336['error'][_0xf770('0x23')]===0x1f4){logger[_0xf770('0x22')](_0xf770('0x1e'),_0x56db57,_0xd7d336[_0xf770('0x22')][_0xf770('0x24')]);return _0x4d8d04(_0xd7d336['error']['message']);}logger[_0xf770('0x22')](_0xf770('0x1e'),_0x56db57,_0xd7d336[_0xf770('0x22')][_0xf770('0x24')]);return _0x401d2c(_0xd7d336[_0xf770('0x22')][_0xf770('0x24')]);}else{logger['info'](_0xf770('0x1e'),_0x56db57,_0xf770('0x1f'));_0x401d2c(_0xd7d336[_0xf770('0x25')]['message']);}})['catch'](function(_0x2ccf08){logger[_0xf770('0x22')](_0xf770('0x1e'),_0x56db57,_0x2ccf08);_0x4d8d04(_0x2ccf08);});});}function respondWithStatusCode(_0x599d2d,_0x143b80){_0x143b80=_0x143b80||0xcc;return function(_0x336d9f){if(_0x336d9f){return _0x599d2d[_0xf770('0x26')](_0x143b80);}return _0x599d2d[_0xf770('0x27')](_0x143b80)[_0xf770('0x28')]();};}function respondWithResult(_0x5625ca,_0x4924ff){_0x4924ff=_0x4924ff||0xc8;return function(_0x1e6e01){if(_0x1e6e01){return _0x5625ca['status'](_0x4924ff)[_0xf770('0x29')](_0x1e6e01);}};}function respondWithFilteredResult(_0x1e7c5a,_0x25f2cc){return function(_0x2919b4){if(_0x2919b4){var _0x309316=_0x2919b4[_0xf770('0x2a')],_0x9356d1=_0x25f2cc[_0xf770('0x2b')],_0x30a9b0=_0x25f2cc['offset']+_0x25f2cc[_0xf770('0x2c')],_0x231e0c;if(_0x30a9b0>=_0x309316){_0x30a9b0=_0x309316;_0x231e0c=0xc8;}else{_0x231e0c=0xce;}_0x1e7c5a[_0xf770('0x27')](_0x231e0c);return _0x1e7c5a[_0xf770('0x2d')]('Content-Range',_0x9356d1+'-'+_0x30a9b0+'/'+_0x309316)[_0xf770('0x29')](_0x2919b4);}return null;};}function patchUpdates(_0x31dde9){return function(_0x55386c){try{jsonpatch[_0xf770('0x2e')](_0x55386c,_0x31dde9,!![]);}catch(_0x490716){return BPromise[_0xf770('0x2f')](_0x490716);}return _0x55386c[_0xf770('0x30')]();};}function saveUpdates(_0x2d7024,_0x19dce7){return function(_0x32557a){if(_0x32557a){return _0x32557a[_0xf770('0x31')](_0x2d7024)[_0xf770('0x1c')](function(_0x570591){return _0x570591;});}return null;};}function removeEntity(_0x17f9c5,_0xeaf95){return function(_0x41d992){if(_0x41d992){return _0x41d992[_0xf770('0x32')]()[_0xf770('0x1c')](function(){_0x17f9c5[_0xf770('0x27')](0xcc)[_0xf770('0x28')]();});}};}function handleEntityNotFound(_0x54659e,_0xa12a7a){return function(_0x41acd9){if(!_0x41acd9){_0x54659e['sendStatus'](0x194);}return _0x41acd9;};}function handleError(_0x20a4e5,_0x56bd78){_0x56bd78=_0x56bd78||0x1f4;return function(_0xf800fc){logger['error'](_0xf800fc[_0xf770('0x33')]);if(_0xf800fc[_0xf770('0x34')]){delete _0xf800fc['name'];}_0x20a4e5[_0xf770('0x27')](_0x56bd78)[_0xf770('0x35')](_0xf800fc);};}exports[_0xf770('0x36')]=function(_0x571f36,_0x1de83f){var _0x180a27={},_0x132c6c={},_0x1183b8={'count':0x0,'rows':[]};var _0x32ad4e=_[_0xf770('0x37')](db[_0xf770('0x38')][_0xf770('0x39')],function(_0x2ca022){return{'name':_0x2ca022[_0xf770('0x3a')],'type':_0x2ca022[_0xf770('0x3b')][_0xf770('0x3c')]};});_0x132c6c[_0xf770('0x3d')]=_[_0xf770('0x37')](_0x32ad4e,'name');_0x132c6c['query']=_[_0xf770('0x3e')](_0x571f36[_0xf770('0x3f')]);_0x132c6c['filters']=_[_0xf770('0x40')](_0x132c6c[_0xf770('0x3d')],_0x132c6c[_0xf770('0x3f')]);_0x180a27[_0xf770('0x41')]=_['intersection'](_0x132c6c[_0xf770('0x3d')],qs[_0xf770('0x42')](_0x571f36['query'][_0xf770('0x42')]));_0x180a27[_0xf770('0x41')]=_0x180a27[_0xf770('0x41')]['length']?_0x180a27[_0xf770('0x41')]:_0x132c6c['model'];if(!_0x571f36[_0xf770('0x3f')][_0xf770('0x43')](_0xf770('0x44'))){_0x180a27[_0xf770('0x2c')]=qs[_0xf770('0x2c')](_0x571f36[_0xf770('0x3f')]['limit']);_0x180a27[_0xf770('0x2b')]=qs[_0xf770('0x2b')](_0x571f36[_0xf770('0x3f')][_0xf770('0x2b')]);}_0x180a27['order']=qs[_0xf770('0x45')](_0x571f36[_0xf770('0x3f')]['sort']);_0x180a27['where']=qs[_0xf770('0x46')](_[_0xf770('0x47')](_0x571f36[_0xf770('0x3f')],_0x132c6c['filters']),_0x32ad4e);if(_0x571f36[_0xf770('0x3f')][_0xf770('0x48')]){_0x180a27['where']=_[_0xf770('0x49')](_0x180a27[_0xf770('0x4a')],{'$or':_[_0xf770('0x37')](_0x32ad4e,function(_0x4cb5b9){if(_0x4cb5b9['type']!=='VIRTUAL'){var _0x125c6f={};_0x125c6f[_0x4cb5b9[_0xf770('0x34')]]={'$like':'%'+_0x571f36[_0xf770('0x3f')]['filter']+'%'};return _0x125c6f;}})});}_0x180a27=_[_0xf770('0x49')]({},_0x180a27,_0x571f36['options']);var _0xc6de3f={'where':_0x180a27[_0xf770('0x4a')]};return db['SugarcrmConfiguration'][_0xf770('0x2a')](_0xc6de3f)['then'](function(_0x2f528c){_0x1183b8[_0xf770('0x2a')]=_0x2f528c;if(_0x571f36['query'][_0xf770('0x4b')]){_0x180a27[_0xf770('0x4c')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0xf770('0x4d')](_0x180a27);})[_0xf770('0x1c')](function(_0x536ec6){_0x1183b8[_0xf770('0x4e')]=_0x536ec6;return _0x1183b8;})[_0xf770('0x1c')](respondWithFilteredResult(_0x1de83f,_0x180a27))[_0xf770('0x4f')](handleError(_0x1de83f,null));};exports[_0xf770('0x50')]=function(_0x2bda2a,_0x4e4160){var _0xd1bc0d={'raw':![],'where':{'id':_0x2bda2a['params']['id']}},_0x14a362={};_0x14a362[_0xf770('0x3d')]=_['keys'](db[_0xf770('0x38')][_0xf770('0x39')]);_0x14a362[_0xf770('0x3f')]=_[_0xf770('0x3e')](_0x2bda2a['query']);_0x14a362[_0xf770('0x46')]=_[_0xf770('0x40')](_0x14a362[_0xf770('0x3d')],_0x14a362[_0xf770('0x3f')]);_0xd1bc0d['attributes']=_[_0xf770('0x40')](_0x14a362['model'],qs[_0xf770('0x42')](_0x2bda2a[_0xf770('0x3f')][_0xf770('0x42')]));_0xd1bc0d[_0xf770('0x41')]=_0xd1bc0d[_0xf770('0x41')]['length']?_0xd1bc0d[_0xf770('0x41')]:_0x14a362[_0xf770('0x3d')];if(_0x2bda2a['query'][_0xf770('0x4b')]){_0xd1bc0d[_0xf770('0x4c')]=[{'all':!![]}];}_0xd1bc0d=_[_0xf770('0x49')]({},_0xd1bc0d,_0x2bda2a['options']);return db[_0xf770('0x38')]['find'](_0xd1bc0d)[_0xf770('0x1c')](handleEntityNotFound(_0x4e4160,null))['then'](respondWithResult(_0x4e4160,null))[_0xf770('0x4f')](handleError(_0x4e4160,null));};exports[_0xf770('0x51')]=function(_0x38b76c,_0xf62ac4){return db[_0xf770('0x38')]['create'](_0x38b76c[_0xf770('0x52')],{})[_0xf770('0x1c')](respondWithResult(_0xf62ac4,0xc9))[_0xf770('0x4f')](handleError(_0xf62ac4,null));};exports[_0xf770('0x31')]=function(_0x335c6f,_0x3e93f8){if(_0x335c6f['body']['id']){delete _0x335c6f[_0xf770('0x52')]['id'];}return db[_0xf770('0x38')][_0xf770('0x53')]({'where':{'id':_0x335c6f[_0xf770('0x54')]['id']}})['then'](handleEntityNotFound(_0x3e93f8,null))[_0xf770('0x1c')](saveUpdates(_0x335c6f['body'],null))[_0xf770('0x1c')](respondWithResult(_0x3e93f8,null))['catch'](handleError(_0x3e93f8,null));};exports[_0xf770('0x32')]=function(_0x15fbb0,_0x1d1555){return db[_0xf770('0x38')]['find']({'where':{'id':_0x15fbb0[_0xf770('0x54')]['id']}})[_0xf770('0x1c')](handleEntityNotFound(_0x1d1555,null))[_0xf770('0x1c')](removeEntity(_0x1d1555,null))[_0xf770('0x4f')](handleError(_0x1d1555,null));};exports[_0xf770('0x55')]=function(_0x46caac,_0x2390f4,_0x629c6a){var _0x4ce189={};var _0x21bcdc={};var _0x5ebd95;var _0x297131;return db['SugarcrmConfiguration'][_0xf770('0x56')]({'where':{'id':_0x46caac['params']['id']}})[_0xf770('0x1c')](handleEntityNotFound(_0x2390f4,null))[_0xf770('0x1c')](function(_0x55f0e3){if(_0x55f0e3){_0x5ebd95=_0x55f0e3;_0x21bcdc[_0xf770('0x3d')]=_[_0xf770('0x3e')](db['SugarcrmField'][_0xf770('0x39')]);_0x21bcdc['query']=_['keys'](_0x46caac[_0xf770('0x3f')]);_0x21bcdc[_0xf770('0x46')]=_[_0xf770('0x40')](_0x21bcdc[_0xf770('0x3d')],_0x21bcdc[_0xf770('0x3f')]);_0x4ce189[_0xf770('0x41')]=_[_0xf770('0x40')](_0x21bcdc['model'],qs[_0xf770('0x42')](_0x46caac[_0xf770('0x3f')]['fields']));_0x4ce189[_0xf770('0x41')]=_0x4ce189[_0xf770('0x41')][_0xf770('0x57')]?_0x4ce189['attributes']:_0x21bcdc[_0xf770('0x3d')];_0x4ce189[_0xf770('0x58')]=qs[_0xf770('0x45')](_0x46caac[_0xf770('0x3f')][_0xf770('0x45')]);_0x4ce189[_0xf770('0x4a')]=qs[_0xf770('0x46')](_[_0xf770('0x47')](_0x46caac['query'],_0x21bcdc[_0xf770('0x46')]));if(_0x46caac[_0xf770('0x3f')]['filter']){_0x4ce189[_0xf770('0x4a')]=_[_0xf770('0x49')](_0x4ce189['where'],{'$or':_[_0xf770('0x37')](_0x4ce189[_0xf770('0x41')],function(_0x471d31){var _0x236ac5={};_0x236ac5[_0x471d31]={'$like':'%'+_0x46caac[_0xf770('0x3f')][_0xf770('0x48')]+'%'};return _0x236ac5;})});}_0x4ce189=_[_0xf770('0x49')]({},_0x4ce189,_0x46caac[_0xf770('0x59')]);return _0x5ebd95[_0xf770('0x55')](_0x4ce189);}})[_0xf770('0x1c')](function(_0x3a48f6){if(_0x3a48f6){_0x297131=_0x3a48f6[_0xf770('0x57')];if(!_0x46caac['query'][_0xf770('0x43')]('nolimit')){_0x4ce189[_0xf770('0x2c')]=qs[_0xf770('0x2c')](_0x46caac[_0xf770('0x3f')][_0xf770('0x2c')]);_0x4ce189[_0xf770('0x2b')]=qs[_0xf770('0x2b')](_0x46caac[_0xf770('0x3f')][_0xf770('0x2b')]);}return _0x5ebd95[_0xf770('0x55')](_0x4ce189);}})['then'](function(_0x2094b1){if(_0x2094b1){return _0x2094b1?{'count':_0x297131,'rows':_0x2094b1}:null;}})[_0xf770('0x1c')](respondWithResult(_0x2390f4,null))[_0xf770('0x4f')](handleError(_0x2390f4,null));};exports[_0xf770('0x5a')]=function(_0x3c7bc9,_0x31232a,_0x5bef00){var _0x2af71d={};var _0x5e442e={};var _0x40aae8;var _0x28c030;return db[_0xf770('0x38')][_0xf770('0x56')]({'where':{'id':_0x3c7bc9['params']['id']}})[_0xf770('0x1c')](handleEntityNotFound(_0x31232a,null))[_0xf770('0x1c')](function(_0x5710b5){if(_0x5710b5){_0x40aae8=_0x5710b5;_0x5e442e['model']=_[_0xf770('0x3e')](db[_0xf770('0x5b')][_0xf770('0x39')]);_0x5e442e[_0xf770('0x3f')]=_[_0xf770('0x3e')](_0x3c7bc9[_0xf770('0x3f')]);_0x5e442e[_0xf770('0x46')]=_[_0xf770('0x40')](_0x5e442e['model'],_0x5e442e[_0xf770('0x3f')]);_0x2af71d[_0xf770('0x41')]=_[_0xf770('0x40')](_0x5e442e[_0xf770('0x3d')],qs[_0xf770('0x42')](_0x3c7bc9[_0xf770('0x3f')][_0xf770('0x42')]));_0x2af71d[_0xf770('0x41')]=_0x2af71d[_0xf770('0x41')][_0xf770('0x57')]?_0x2af71d[_0xf770('0x41')]:_0x5e442e[_0xf770('0x3d')];_0x2af71d[_0xf770('0x58')]=qs[_0xf770('0x45')](_0x3c7bc9[_0xf770('0x3f')][_0xf770('0x45')]);_0x2af71d[_0xf770('0x4a')]=qs[_0xf770('0x46')](_[_0xf770('0x47')](_0x3c7bc9[_0xf770('0x3f')],_0x5e442e[_0xf770('0x46')]));if(_0x3c7bc9[_0xf770('0x3f')][_0xf770('0x48')]){_0x2af71d[_0xf770('0x4a')]=_[_0xf770('0x49')](_0x2af71d[_0xf770('0x4a')],{'$or':_[_0xf770('0x37')](_0x2af71d[_0xf770('0x41')],function(_0x3efad9){var _0x5dce80={};_0x5dce80[_0x3efad9]={'$like':'%'+_0x3c7bc9[_0xf770('0x3f')][_0xf770('0x48')]+'%'};return _0x5dce80;})});}_0x2af71d=_[_0xf770('0x49')]({},_0x2af71d,_0x3c7bc9[_0xf770('0x59')]);return _0x40aae8[_0xf770('0x5a')](_0x2af71d);}})[_0xf770('0x1c')](function(_0x13297d){if(_0x13297d){_0x28c030=_0x13297d[_0xf770('0x57')];if(!_0x3c7bc9[_0xf770('0x3f')][_0xf770('0x43')](_0xf770('0x44'))){_0x2af71d['limit']=qs[_0xf770('0x2c')](_0x3c7bc9[_0xf770('0x3f')][_0xf770('0x2c')]);_0x2af71d[_0xf770('0x2b')]=qs[_0xf770('0x2b')](_0x3c7bc9[_0xf770('0x3f')][_0xf770('0x2b')]);}return _0x40aae8[_0xf770('0x5a')](_0x2af71d);}})[_0xf770('0x1c')](function(_0x31bac1){if(_0x31bac1){return _0x31bac1?{'count':_0x28c030,'rows':_0x31bac1}:null;}})[_0xf770('0x1c')](respondWithResult(_0x31232a,null))[_0xf770('0x4f')](handleError(_0x31232a,null));};exports[_0xf770('0x5c')]=function(_0x65664b,_0x1f71e9,_0x3c5d1a){var _0x82e17d={};var _0x30e4f9={};var _0x436fa9;var _0x33846b;return db[_0xf770('0x38')][_0xf770('0x56')]({'where':{'id':_0x65664b['params']['id']}})['then'](handleEntityNotFound(_0x1f71e9,null))['then'](function(_0x2b4169){if(_0x2b4169){_0x436fa9=_0x2b4169;_0x30e4f9['model']=_['keys'](db['SugarcrmField'][_0xf770('0x39')]);_0x30e4f9[_0xf770('0x3f')]=_[_0xf770('0x3e')](_0x65664b['query']);_0x30e4f9[_0xf770('0x46')]=_[_0xf770('0x40')](_0x30e4f9['model'],_0x30e4f9[_0xf770('0x3f')]);_0x82e17d['attributes']=_[_0xf770('0x40')](_0x30e4f9['model'],qs['fields'](_0x65664b[_0xf770('0x3f')]['fields']));_0x82e17d[_0xf770('0x41')]=_0x82e17d[_0xf770('0x41')][_0xf770('0x57')]?_0x82e17d[_0xf770('0x41')]:_0x30e4f9[_0xf770('0x3d')];_0x82e17d[_0xf770('0x58')]=qs[_0xf770('0x45')](_0x65664b[_0xf770('0x3f')][_0xf770('0x45')]);_0x82e17d[_0xf770('0x4a')]=qs[_0xf770('0x46')](_[_0xf770('0x47')](_0x65664b[_0xf770('0x3f')],_0x30e4f9[_0xf770('0x46')]));if(_0x65664b[_0xf770('0x3f')][_0xf770('0x48')]){_0x82e17d['where']=_['merge'](_0x82e17d[_0xf770('0x4a')],{'$or':_[_0xf770('0x37')](_0x82e17d[_0xf770('0x41')],function(_0x4d24f8){var _0x1fa555={};_0x1fa555[_0x4d24f8]={'$like':'%'+_0x65664b[_0xf770('0x3f')][_0xf770('0x48')]+'%'};return _0x1fa555;})});}_0x82e17d=_[_0xf770('0x49')]({},_0x82e17d,_0x65664b[_0xf770('0x59')]);return _0x436fa9['getDescriptions'](_0x82e17d);}})[_0xf770('0x1c')](function(_0x23884c){if(_0x23884c){_0x33846b=_0x23884c[_0xf770('0x57')];if(!_0x65664b[_0xf770('0x3f')]['hasOwnProperty'](_0xf770('0x44'))){_0x82e17d[_0xf770('0x2c')]=qs[_0xf770('0x2c')](_0x65664b[_0xf770('0x3f')][_0xf770('0x2c')]);_0x82e17d[_0xf770('0x2b')]=qs[_0xf770('0x2b')](_0x65664b[_0xf770('0x3f')][_0xf770('0x2b')]);}return _0x436fa9[_0xf770('0x5c')](_0x82e17d);}})[_0xf770('0x1c')](function(_0x5588bf){if(_0x5588bf){return _0x5588bf?{'count':_0x33846b,'rows':_0x5588bf}:null;}})[_0xf770('0x1c')](respondWithResult(_0x1f71e9,null))['catch'](handleError(_0x1f71e9,null));}; \ No newline at end of file +var _0x751a=['../../config/environment','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','SugarcrmConfiguration','rawAttributes','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create','body','getFields','SugarcrmField','order','pick','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x216008,_0x2d1023){var _0x4d384f=function(_0x3fd7e2){while(--_0x3fd7e2){_0x216008['push'](_0x216008['shift']());}};_0x4d384f(++_0x2d1023);}(_0x751a,0x9e));var _0xa751=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0x751a[_0x506d83];return _0x335e8b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa751('0x0'));var rimraf=require(_0xa751('0x1'));var zipdir=require(_0xa751('0x2'));var jsonpatch=require(_0xa751('0x3'));var rp=require(_0xa751('0x4'));var moment=require(_0xa751('0x5'));var BPromise=require(_0xa751('0x6'));var Mustache=require(_0xa751('0x7'));var util=require(_0xa751('0x8'));var path=require(_0xa751('0x9'));var sox=require(_0xa751('0xa'));var csv=require(_0xa751('0xb'));var ejs=require(_0xa751('0xc'));var fs=require('fs');var _=require(_0xa751('0xd'));var squel=require(_0xa751('0xe'));var crypto=require(_0xa751('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xa751('0x10'));var toCsv=require(_0xa751('0xb'));var querystring=require(_0xa751('0x11'));var Papa=require(_0xa751('0x12'));var Redis=require(_0xa751('0x13'));var authService=require(_0xa751('0x14'));var qs=require(_0xa751('0x15'));var as=require(_0xa751('0x16'));var hardwareService=require(_0xa751('0x17'));var logger=require(_0xa751('0x18'))('api');var utils=require(_0xa751('0x19'));var config=require(_0xa751('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xa751('0x1b')][_0xa751('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x8a9a5d,_0x2ee81c,_0xead4b8,_0x34e33f){return new BPromise(function(_0x7d708c,_0x1c03bb){var _0x316550=_0x34e33f||client;return _0x316550[_0xa751('0x1d')](_0x8a9a5d,_0xead4b8)[_0xa751('0x1e')](function(_0x5c48d2){logger[_0xa751('0x1f')](_0xa751('0x20'),_0x2ee81c,_0xa751('0x21'));logger[_0xa751('0x22')](_0xa751('0x23'),_0x2ee81c,_0xa751('0x21'),JSON['stringify'](_0x5c48d2));if(_0x5c48d2[_0xa751('0x24')]){if(_0x5c48d2['error'][_0xa751('0x25')]===0x1f4){logger['error'](_0xa751('0x20'),_0x2ee81c,_0x5c48d2[_0xa751('0x24')]['message']);return _0x1c03bb(_0x5c48d2[_0xa751('0x24')]['message']);}logger[_0xa751('0x24')](_0xa751('0x20'),_0x2ee81c,_0x5c48d2['error']['message']);return _0x7d708c(_0x5c48d2[_0xa751('0x24')]['message']);}else{logger[_0xa751('0x1f')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2ee81c,'request\x20sent');_0x7d708c(_0x5c48d2['result']['message']);}})[_0xa751('0x26')](function(_0x3a83f0){logger['error'](_0xa751('0x20'),_0x2ee81c,_0x3a83f0);_0x1c03bb(_0x3a83f0);});});}function respondWithStatusCode(_0x44bd62,_0x24ac0b){_0x24ac0b=_0x24ac0b||0xcc;return function(_0x4ad61f){if(_0x4ad61f){return _0x44bd62[_0xa751('0x27')](_0x24ac0b);}return _0x44bd62[_0xa751('0x28')](_0x24ac0b)[_0xa751('0x29')]();};}function respondWithResult(_0x15a214,_0x4ead8e){_0x4ead8e=_0x4ead8e||0xc8;return function(_0x5eab1e){if(_0x5eab1e){return _0x15a214[_0xa751('0x28')](_0x4ead8e)[_0xa751('0x2a')](_0x5eab1e);}};}function respondWithFilteredResult(_0x1a6f9c,_0x219ae5){return function(_0x490a74){if(_0x490a74){var _0x40529a=_0x490a74[_0xa751('0x2b')],_0x356616=_0x219ae5[_0xa751('0x2c')],_0x499212=_0x219ae5[_0xa751('0x2c')]+_0x219ae5[_0xa751('0x2d')],_0x2947aa;if(_0x499212>=_0x40529a){_0x499212=_0x40529a;_0x2947aa=0xc8;}else{_0x2947aa=0xce;}_0x1a6f9c[_0xa751('0x28')](_0x2947aa);return _0x1a6f9c[_0xa751('0x2e')](_0xa751('0x2f'),_0x356616+'-'+_0x499212+'/'+_0x40529a)['json'](_0x490a74);}return null;};}function patchUpdates(_0x539e97){return function(_0x28d901){try{jsonpatch[_0xa751('0x30')](_0x28d901,_0x539e97,!![]);}catch(_0x102393){return BPromise[_0xa751('0x31')](_0x102393);}return _0x28d901['save']();};}function saveUpdates(_0x53b252,_0x27cfa7){return function(_0x47152a){if(_0x47152a){return _0x47152a[_0xa751('0x32')](_0x53b252)[_0xa751('0x1e')](function(_0x34c81e){return _0x34c81e;});}return null;};}function removeEntity(_0x5912ec,_0x602429){return function(_0x598aed){if(_0x598aed){return _0x598aed[_0xa751('0x33')]()[_0xa751('0x1e')](function(){_0x5912ec[_0xa751('0x28')](0xcc)[_0xa751('0x29')]();});}};}function handleEntityNotFound(_0xe65ec4,_0x4b31b1){return function(_0x3a16f9){if(!_0x3a16f9){_0xe65ec4['sendStatus'](0x194);}return _0x3a16f9;};}function handleError(_0x311ba4,_0x5715d5){_0x5715d5=_0x5715d5||0x1f4;return function(_0x1123f0){logger['error'](_0x1123f0[_0xa751('0x34')]);if(_0x1123f0['name']){delete _0x1123f0[_0xa751('0x35')];}_0x311ba4[_0xa751('0x28')](_0x5715d5)[_0xa751('0x36')](_0x1123f0);};}exports[_0xa751('0x37')]=function(_0x454134,_0x1ce273){var _0x564b5b={},_0x45e875={},_0x14d531={'count':0x0,'rows':[]};var _0x38414d=_['map'](db[_0xa751('0x38')][_0xa751('0x39')],function(_0x2ba9ef){return{'name':_0x2ba9ef['fieldName'],'type':_0x2ba9ef[_0xa751('0x3a')]['key']};});_0x45e875[_0xa751('0x3b')]=_[_0xa751('0x3c')](_0x38414d,_0xa751('0x35'));_0x45e875[_0xa751('0x3d')]=_[_0xa751('0x3e')](_0x454134[_0xa751('0x3d')]);_0x45e875['filters']=_[_0xa751('0x3f')](_0x45e875[_0xa751('0x3b')],_0x45e875[_0xa751('0x3d')]);_0x564b5b[_0xa751('0x40')]=_['intersection'](_0x45e875[_0xa751('0x3b')],qs[_0xa751('0x41')](_0x454134[_0xa751('0x3d')]['fields']));_0x564b5b[_0xa751('0x40')]=_0x564b5b[_0xa751('0x40')][_0xa751('0x42')]?_0x564b5b[_0xa751('0x40')]:_0x45e875[_0xa751('0x3b')];if(!_0x454134[_0xa751('0x3d')][_0xa751('0x43')](_0xa751('0x44'))){_0x564b5b[_0xa751('0x2d')]=qs['limit'](_0x454134[_0xa751('0x3d')][_0xa751('0x2d')]);_0x564b5b[_0xa751('0x2c')]=qs[_0xa751('0x2c')](_0x454134[_0xa751('0x3d')][_0xa751('0x2c')]);}_0x564b5b['order']=qs[_0xa751('0x45')](_0x454134[_0xa751('0x3d')][_0xa751('0x45')]);_0x564b5b['where']=qs[_0xa751('0x46')](_['pick'](_0x454134['query'],_0x45e875[_0xa751('0x46')]),_0x38414d);if(_0x454134[_0xa751('0x3d')][_0xa751('0x47')]){_0x564b5b[_0xa751('0x48')]=_[_0xa751('0x49')](_0x564b5b[_0xa751('0x48')],{'$or':_[_0xa751('0x3c')](_0x38414d,function(_0x3dec0f){if(_0x3dec0f[_0xa751('0x3a')]!==_0xa751('0x4a')){var _0x1054eb={};_0x1054eb[_0x3dec0f[_0xa751('0x35')]]={'$like':'%'+_0x454134['query'][_0xa751('0x47')]+'%'};return _0x1054eb;}})});}_0x564b5b=_[_0xa751('0x49')]({},_0x564b5b,_0x454134[_0xa751('0x4b')]);var _0x11ea6d={'where':_0x564b5b[_0xa751('0x48')]};return db[_0xa751('0x38')]['count'](_0x11ea6d)[_0xa751('0x1e')](function(_0x3bdced){_0x14d531[_0xa751('0x2b')]=_0x3bdced;if(_0x454134[_0xa751('0x3d')]['includeAll']){_0x564b5b[_0xa751('0x4c')]=[{'all':!![]}];}return db[_0xa751('0x38')][_0xa751('0x4d')](_0x564b5b);})[_0xa751('0x1e')](function(_0x3dc88d){_0x14d531[_0xa751('0x4e')]=_0x3dc88d;return _0x14d531;})[_0xa751('0x1e')](respondWithFilteredResult(_0x1ce273,_0x564b5b))[_0xa751('0x26')](handleError(_0x1ce273,null));};exports[_0xa751('0x4f')]=function(_0x3fbdaf,_0x307b34){var _0x4b15f5={'raw':![],'where':{'id':_0x3fbdaf[_0xa751('0x50')]['id']}},_0x18ff80={};_0x18ff80[_0xa751('0x3b')]=_[_0xa751('0x3e')](db[_0xa751('0x38')][_0xa751('0x39')]);_0x18ff80[_0xa751('0x3d')]=_[_0xa751('0x3e')](_0x3fbdaf[_0xa751('0x3d')]);_0x18ff80['filters']=_[_0xa751('0x3f')](_0x18ff80[_0xa751('0x3b')],_0x18ff80['query']);_0x4b15f5[_0xa751('0x40')]=_[_0xa751('0x3f')](_0x18ff80['model'],qs[_0xa751('0x41')](_0x3fbdaf['query'][_0xa751('0x41')]));_0x4b15f5[_0xa751('0x40')]=_0x4b15f5['attributes'][_0xa751('0x42')]?_0x4b15f5['attributes']:_0x18ff80[_0xa751('0x3b')];if(_0x3fbdaf[_0xa751('0x3d')][_0xa751('0x51')]){_0x4b15f5['include']=[{'all':!![]}];}_0x4b15f5=_[_0xa751('0x49')]({},_0x4b15f5,_0x3fbdaf['options']);return db['SugarcrmConfiguration'][_0xa751('0x52')](_0x4b15f5)['then'](handleEntityNotFound(_0x307b34,null))[_0xa751('0x1e')](respondWithResult(_0x307b34,null))[_0xa751('0x26')](handleError(_0x307b34,null));};exports[_0xa751('0x53')]=function(_0x28e01f,_0x1b7428){return db['SugarcrmConfiguration'][_0xa751('0x53')](_0x28e01f['body'],{})['then'](respondWithResult(_0x1b7428,0xc9))[_0xa751('0x26')](handleError(_0x1b7428,null));};exports['update']=function(_0x18279a,_0x319f6a){if(_0x18279a['body']['id']){delete _0x18279a[_0xa751('0x54')]['id'];}return db[_0xa751('0x38')][_0xa751('0x52')]({'where':{'id':_0x18279a[_0xa751('0x50')]['id']}})[_0xa751('0x1e')](handleEntityNotFound(_0x319f6a,null))[_0xa751('0x1e')](saveUpdates(_0x18279a[_0xa751('0x54')],null))[_0xa751('0x1e')](respondWithResult(_0x319f6a,null))[_0xa751('0x26')](handleError(_0x319f6a,null));};exports[_0xa751('0x33')]=function(_0x3de20d,_0x2bda29){return db['SugarcrmConfiguration'][_0xa751('0x52')]({'where':{'id':_0x3de20d[_0xa751('0x50')]['id']}})[_0xa751('0x1e')](handleEntityNotFound(_0x2bda29,null))[_0xa751('0x1e')](removeEntity(_0x2bda29,null))[_0xa751('0x26')](handleError(_0x2bda29,null));};exports[_0xa751('0x55')]=function(_0x455294,_0x3ea84a,_0x5ae5d5){var _0xf315c4={};var _0x15505b={};var _0x479b24;var _0x1accca;return db[_0xa751('0x38')]['findOne']({'where':{'id':_0x455294[_0xa751('0x50')]['id']}})['then'](handleEntityNotFound(_0x3ea84a,null))[_0xa751('0x1e')](function(_0xf184f9){if(_0xf184f9){_0x479b24=_0xf184f9;_0x15505b['model']=_[_0xa751('0x3e')](db[_0xa751('0x56')][_0xa751('0x39')]);_0x15505b[_0xa751('0x3d')]=_[_0xa751('0x3e')](_0x455294[_0xa751('0x3d')]);_0x15505b[_0xa751('0x46')]=_[_0xa751('0x3f')](_0x15505b['model'],_0x15505b[_0xa751('0x3d')]);_0xf315c4[_0xa751('0x40')]=_[_0xa751('0x3f')](_0x15505b[_0xa751('0x3b')],qs[_0xa751('0x41')](_0x455294[_0xa751('0x3d')][_0xa751('0x41')]));_0xf315c4['attributes']=_0xf315c4['attributes'][_0xa751('0x42')]?_0xf315c4[_0xa751('0x40')]:_0x15505b[_0xa751('0x3b')];_0xf315c4[_0xa751('0x57')]=qs[_0xa751('0x45')](_0x455294[_0xa751('0x3d')][_0xa751('0x45')]);_0xf315c4['where']=qs[_0xa751('0x46')](_[_0xa751('0x58')](_0x455294[_0xa751('0x3d')],_0x15505b[_0xa751('0x46')]));if(_0x455294[_0xa751('0x3d')]['filter']){_0xf315c4[_0xa751('0x48')]=_[_0xa751('0x49')](_0xf315c4[_0xa751('0x48')],{'$or':_['map'](_0xf315c4[_0xa751('0x40')],function(_0x5e0431){var _0x3bd72b={};_0x3bd72b[_0x5e0431]={'$like':'%'+_0x455294[_0xa751('0x3d')][_0xa751('0x47')]+'%'};return _0x3bd72b;})});}_0xf315c4=_[_0xa751('0x49')]({},_0xf315c4,_0x455294[_0xa751('0x4b')]);return _0x479b24['getFields'](_0xf315c4);}})[_0xa751('0x1e')](function(_0x3cd666){if(_0x3cd666){_0x1accca=_0x3cd666[_0xa751('0x42')];if(!_0x455294['query'][_0xa751('0x43')](_0xa751('0x44'))){_0xf315c4[_0xa751('0x2d')]=qs[_0xa751('0x2d')](_0x455294[_0xa751('0x3d')]['limit']);_0xf315c4[_0xa751('0x2c')]=qs[_0xa751('0x2c')](_0x455294[_0xa751('0x3d')][_0xa751('0x2c')]);}return _0x479b24[_0xa751('0x55')](_0xf315c4);}})['then'](function(_0x45bc18){if(_0x45bc18){return _0x45bc18?{'count':_0x1accca,'rows':_0x45bc18}:null;}})[_0xa751('0x1e')](respondWithResult(_0x3ea84a,null))['catch'](handleError(_0x3ea84a,null));};exports[_0xa751('0x59')]=function(_0xc66f78,_0x56b5a6,_0x1d83e0){var _0x2e6d65={};var _0x5b2c25={};var _0x5c8bd9;var _0x541f9e;return db['SugarcrmConfiguration'][_0xa751('0x5a')]({'where':{'id':_0xc66f78[_0xa751('0x50')]['id']}})[_0xa751('0x1e')](handleEntityNotFound(_0x56b5a6,null))[_0xa751('0x1e')](function(_0x5ccddc){if(_0x5ccddc){_0x5c8bd9=_0x5ccddc;_0x5b2c25[_0xa751('0x3b')]=_[_0xa751('0x3e')](db[_0xa751('0x56')]['rawAttributes']);_0x5b2c25[_0xa751('0x3d')]=_[_0xa751('0x3e')](_0xc66f78[_0xa751('0x3d')]);_0x5b2c25[_0xa751('0x46')]=_[_0xa751('0x3f')](_0x5b2c25[_0xa751('0x3b')],_0x5b2c25['query']);_0x2e6d65[_0xa751('0x40')]=_[_0xa751('0x3f')](_0x5b2c25['model'],qs[_0xa751('0x41')](_0xc66f78[_0xa751('0x3d')][_0xa751('0x41')]));_0x2e6d65[_0xa751('0x40')]=_0x2e6d65['attributes'][_0xa751('0x42')]?_0x2e6d65[_0xa751('0x40')]:_0x5b2c25['model'];_0x2e6d65[_0xa751('0x57')]=qs[_0xa751('0x45')](_0xc66f78['query'][_0xa751('0x45')]);_0x2e6d65[_0xa751('0x48')]=qs[_0xa751('0x46')](_[_0xa751('0x58')](_0xc66f78[_0xa751('0x3d')],_0x5b2c25[_0xa751('0x46')]));if(_0xc66f78[_0xa751('0x3d')][_0xa751('0x47')]){_0x2e6d65['where']=_[_0xa751('0x49')](_0x2e6d65['where'],{'$or':_[_0xa751('0x3c')](_0x2e6d65[_0xa751('0x40')],function(_0x4440c6){var _0x411cad={};_0x411cad[_0x4440c6]={'$like':'%'+_0xc66f78['query'][_0xa751('0x47')]+'%'};return _0x411cad;})});}_0x2e6d65=_[_0xa751('0x49')]({},_0x2e6d65,_0xc66f78[_0xa751('0x4b')]);return _0x5c8bd9['getSubjects'](_0x2e6d65);}})[_0xa751('0x1e')](function(_0x7c801f){if(_0x7c801f){_0x541f9e=_0x7c801f[_0xa751('0x42')];if(!_0xc66f78[_0xa751('0x3d')][_0xa751('0x43')](_0xa751('0x44'))){_0x2e6d65[_0xa751('0x2d')]=qs[_0xa751('0x2d')](_0xc66f78[_0xa751('0x3d')][_0xa751('0x2d')]);_0x2e6d65[_0xa751('0x2c')]=qs[_0xa751('0x2c')](_0xc66f78['query']['offset']);}return _0x5c8bd9[_0xa751('0x59')](_0x2e6d65);}})['then'](function(_0x49d87d){if(_0x49d87d){return _0x49d87d?{'count':_0x541f9e,'rows':_0x49d87d}:null;}})[_0xa751('0x1e')](respondWithResult(_0x56b5a6,null))['catch'](handleError(_0x56b5a6,null));};exports[_0xa751('0x5b')]=function(_0x2bf1d5,_0x5c88d2,_0x21a7f9){var _0x6575eb={};var _0x22439d={};var _0x514305;var _0x49d8d2;return db['SugarcrmConfiguration'][_0xa751('0x5a')]({'where':{'id':_0x2bf1d5[_0xa751('0x50')]['id']}})['then'](handleEntityNotFound(_0x5c88d2,null))[_0xa751('0x1e')](function(_0x18e0ca){if(_0x18e0ca){_0x514305=_0x18e0ca;_0x22439d[_0xa751('0x3b')]=_[_0xa751('0x3e')](db[_0xa751('0x56')][_0xa751('0x39')]);_0x22439d[_0xa751('0x3d')]=_[_0xa751('0x3e')](_0x2bf1d5[_0xa751('0x3d')]);_0x22439d[_0xa751('0x46')]=_[_0xa751('0x3f')](_0x22439d[_0xa751('0x3b')],_0x22439d[_0xa751('0x3d')]);_0x6575eb[_0xa751('0x40')]=_[_0xa751('0x3f')](_0x22439d[_0xa751('0x3b')],qs[_0xa751('0x41')](_0x2bf1d5['query'][_0xa751('0x41')]));_0x6575eb[_0xa751('0x40')]=_0x6575eb[_0xa751('0x40')][_0xa751('0x42')]?_0x6575eb[_0xa751('0x40')]:_0x22439d[_0xa751('0x3b')];_0x6575eb[_0xa751('0x57')]=qs[_0xa751('0x45')](_0x2bf1d5['query'][_0xa751('0x45')]);_0x6575eb[_0xa751('0x48')]=qs[_0xa751('0x46')](_[_0xa751('0x58')](_0x2bf1d5[_0xa751('0x3d')],_0x22439d['filters']));if(_0x2bf1d5[_0xa751('0x3d')][_0xa751('0x47')]){_0x6575eb[_0xa751('0x48')]=_[_0xa751('0x49')](_0x6575eb[_0xa751('0x48')],{'$or':_[_0xa751('0x3c')](_0x6575eb[_0xa751('0x40')],function(_0x4db807){var _0x152836={};_0x152836[_0x4db807]={'$like':'%'+_0x2bf1d5[_0xa751('0x3d')][_0xa751('0x47')]+'%'};return _0x152836;})});}_0x6575eb=_[_0xa751('0x49')]({},_0x6575eb,_0x2bf1d5[_0xa751('0x4b')]);return _0x514305[_0xa751('0x5b')](_0x6575eb);}})[_0xa751('0x1e')](function(_0x20f957){if(_0x20f957){_0x49d8d2=_0x20f957[_0xa751('0x42')];if(!_0x2bf1d5['query'][_0xa751('0x43')](_0xa751('0x44'))){_0x6575eb['limit']=qs['limit'](_0x2bf1d5[_0xa751('0x3d')][_0xa751('0x2d')]);_0x6575eb[_0xa751('0x2c')]=qs['offset'](_0x2bf1d5[_0xa751('0x3d')][_0xa751('0x2c')]);}return _0x514305[_0xa751('0x5b')](_0x6575eb);}})[_0xa751('0x1e')](function(_0x4b3bfa){if(_0x4b3bfa){return _0x4b3bfa?{'count':_0x49d8d2,'rows':_0x4b3bfa}:null;}})[_0xa751('0x1e')](respondWithResult(_0x5c88d2,null))[_0xa751('0x26')](handleError(_0x5c88d2,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index bcd2770..0675549 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 _0x74f0=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','api','moment','bluebird','request-promise','path'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x74f0,0x192));var _0x074f=function(_0x361422,_0xa27d1e){_0x361422=_0x361422-0x0;var _0x2daa43=_0x74f0[_0x361422];return _0x2daa43;};'use strict';var _=require('lodash');var util=require(_0x074f('0x0'));var logger=require('../../config/logger')(_0x074f('0x1'));var moment=require(_0x074f('0x2'));var BPromise=require(_0x074f('0x3'));var rp=require(_0x074f('0x4'));var fs=require('fs');var path=require(_0x074f('0x5'));var rimraf=require('rimraf');var config=require(_0x074f('0x6'));var attributes=require(_0x074f('0x7'));module[_0x074f('0x8')]=function(_0x22fbcb,_0x382f5c){return _0x22fbcb[_0x074f('0x9')](_0x074f('0xa'),attributes,{'tableName':_0x074f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8f7=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0x7a3247,_0x15cb12){var _0x1bfde5=function(_0x62bbef){while(--_0x62bbef){_0x7a3247['push'](_0x7a3247['shift']());}};_0x1bfde5(++_0x15cb12);}(_0xb8f7,0x134));var _0x7b8f=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xb8f7[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x7b8f('0x0'));var util=require(_0x7b8f('0x1'));var logger=require(_0x7b8f('0x2'))(_0x7b8f('0x3'));var moment=require(_0x7b8f('0x4'));var BPromise=require(_0x7b8f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b8f('0x6'));var rimraf=require('rimraf');var config=require(_0x7b8f('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x7b8f('0x8')]=function(_0x573ec3,_0x56a712){return _0x573ec3['define'](_0x7b8f('0x9'),attributes,{'tableName':_0x7b8f('0xa'),'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 ea94ff6..d817506 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 _0xcf19=['client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x51d8e1,_0x4d9f39){var _0x46a5ec=function(_0x1dc7b5){while(--_0x1dc7b5){_0x51d8e1['push'](_0x51d8e1['shift']());}};_0x46a5ec(++_0x4d9f39);}(_0xcf19,0x146));var _0x9cf1=function(_0x4becb8,_0x4ad3d3){_0x4becb8=_0x4becb8-0x0;var _0x5c8a37=_0xcf19[_0x4becb8];return _0x5c8a37;};'use strict';var _=require(_0x9cf1('0x0'));var util=require(_0x9cf1('0x1'));var moment=require(_0x9cf1('0x2'));var BPromise=require(_0x9cf1('0x3'));var rs=require(_0x9cf1('0x4'));var fs=require('fs');var Redis=require(_0x9cf1('0x5'));var db=require(_0x9cf1('0x6'))['db'];var utils=require(_0x9cf1('0x7'));var logger=require(_0x9cf1('0x8'))(_0x9cf1('0x9'));var config=require(_0x9cf1('0xa'));var jayson=require(_0x9cf1('0xb'));var client=jayson[_0x9cf1('0xc')][_0x9cf1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x78675f,_0x41bd1f,_0x1062bc){return new BPromise(function(_0x4985be,_0x49b8a0){return client[_0x9cf1('0xe')](_0x78675f,_0x1062bc)[_0x9cf1('0xf')](function(_0x1e3076){logger[_0x9cf1('0x10')](_0x9cf1('0x11'),_0x41bd1f,'request\x20sent');logger['debug'](_0x9cf1('0x12'),_0x41bd1f,_0x9cf1('0x13'),JSON[_0x9cf1('0x14')](_0x1e3076));if(_0x1e3076['error']){if(_0x1e3076[_0x9cf1('0x15')][_0x9cf1('0x16')]===0x1f4){logger[_0x9cf1('0x15')](_0x9cf1('0x11'),_0x41bd1f,_0x1e3076[_0x9cf1('0x15')][_0x9cf1('0x17')]);return _0x49b8a0(_0x1e3076[_0x9cf1('0x15')][_0x9cf1('0x17')]);}logger[_0x9cf1('0x15')](_0x9cf1('0x11'),_0x41bd1f,_0x1e3076[_0x9cf1('0x15')][_0x9cf1('0x17')]);return _0x4985be(_0x1e3076[_0x9cf1('0x15')]['message']);}else{logger[_0x9cf1('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x41bd1f,_0x9cf1('0x13'));_0x4985be(_0x1e3076[_0x9cf1('0x18')][_0x9cf1('0x17')]);}})[_0x9cf1('0x19')](function(_0xb0eaec){logger[_0x9cf1('0x15')](_0x9cf1('0x11'),_0x41bd1f,_0xb0eaec);_0x49b8a0(_0xb0eaec);});});} \ No newline at end of file +var _0x9430=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','SugarcrmConfiguration,\x20%s,\x20%s','catch'];(function(_0x1e6e49,_0x38416e){var _0x488a08=function(_0x460db5){while(--_0x460db5){_0x1e6e49['push'](_0x1e6e49['shift']());}};_0x488a08(++_0x38416e);}(_0x9430,0x165));var _0x0943=function(_0x56a845,_0x2ecb45){_0x56a845=_0x56a845-0x0;var _0x346e39=_0x9430[_0x56a845];return _0x346e39;};'use strict';var _=require(_0x0943('0x0'));var util=require(_0x0943('0x1'));var moment=require(_0x0943('0x2'));var BPromise=require(_0x0943('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0943('0x4'))['db'];var utils=require(_0x0943('0x5'));var logger=require(_0x0943('0x6'))(_0x0943('0x7'));var config=require('../../config/environment');var jayson=require(_0x0943('0x8'));var client=jayson[_0x0943('0x9')][_0x0943('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ec5aa,_0x458f90,_0x15c2b9){return new BPromise(function(_0x2ddf8b,_0x8aaed5){return client['request'](_0x2ec5aa,_0x15c2b9)[_0x0943('0xb')](function(_0x3dcd42){logger[_0x0943('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x458f90,_0x0943('0xd'));logger[_0x0943('0xe')](_0x0943('0xf'),_0x458f90,_0x0943('0xd'),JSON[_0x0943('0x10')](_0x3dcd42));if(_0x3dcd42[_0x0943('0x11')]){if(_0x3dcd42['error']['code']===0x1f4){logger[_0x0943('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x458f90,_0x3dcd42[_0x0943('0x11')][_0x0943('0x12')]);return _0x8aaed5(_0x3dcd42['error'][_0x0943('0x12')]);}logger[_0x0943('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x458f90,_0x3dcd42[_0x0943('0x11')][_0x0943('0x12')]);return _0x2ddf8b(_0x3dcd42[_0x0943('0x11')][_0x0943('0x12')]);}else{logger['info'](_0x0943('0x13'),_0x458f90,_0x0943('0xd'));_0x2ddf8b(_0x3dcd42['result'][_0x0943('0x12')]);}})[_0x0943('0x14')](function(_0x4c157a){logger[_0x0943('0x11')](_0x0943('0x13'),_0x458f90,_0x4c157a);_0x8aaed5(_0x4c157a);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 9d04f43..0ae1b71 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 _0xf5fb=['put','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','index','isAuthenticated','show','post','create'];(function(_0x47dd3d,_0x40d409){var _0x37fd7d=function(_0x56ca83){while(--_0x56ca83){_0x47dd3d['push'](_0x47dd3d['shift']());}};_0x37fd7d(++_0x40d409);}(_0xf5fb,0x15b));var _0xbf5f=function(_0x48d144,_0x46fe0c){_0x48d144=_0x48d144-0x0;var _0x1783d1=_0xf5fb[_0x48d144];return _0x1783d1;};'use strict';var multer=require(_0xbf5f('0x0'));var util=require(_0xbf5f('0x1'));var path=require('path');var timeout=require(_0xbf5f('0x2'));var express=require('express');var router=express[_0xbf5f('0x3')]();var auth=require(_0xbf5f('0x4'));var interaction=require(_0xbf5f('0x5'));var config=require(_0xbf5f('0x6'));var controller=require(_0xbf5f('0x7'));router[_0xbf5f('0x8')]('/',auth['isAuthenticated'](),controller[_0xbf5f('0x9')]);router[_0xbf5f('0x8')]('/:id',auth[_0xbf5f('0xa')](),controller[_0xbf5f('0xb')]);router[_0xbf5f('0xc')]('/',auth[_0xbf5f('0xa')](),controller[_0xbf5f('0xd')]);router[_0xbf5f('0xe')]('/:id',auth[_0xbf5f('0xa')](),controller['update']);router[_0xbf5f('0xf')](_0xbf5f('0x10'),auth['isAuthenticated'](),controller[_0xbf5f('0x11')]);module[_0xbf5f('0x12')]=router; \ No newline at end of file +var _0x6ad9=['get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller'];(function(_0x1faeea,_0x2932b6){var _0x430526=function(_0x311689){while(--_0x311689){_0x1faeea['push'](_0x1faeea['shift']());}};_0x430526(++_0x2932b6);}(_0x6ad9,0x64));var _0x96ad=function(_0x464d76,_0x1dab3c){_0x464d76=_0x464d76-0x0;var _0x178e25=_0x6ad9[_0x464d76];return _0x178e25;};'use strict';var multer=require(_0x96ad('0x0'));var util=require(_0x96ad('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x96ad('0x2'));var router=express[_0x96ad('0x3')]();var auth=require(_0x96ad('0x4'));var interaction=require(_0x96ad('0x5'));var config=require(_0x96ad('0x6'));var controller=require(_0x96ad('0x7'));router[_0x96ad('0x8')]('/',auth[_0x96ad('0x9')](),controller[_0x96ad('0xa')]);router[_0x96ad('0x8')](_0x96ad('0xb'),auth['isAuthenticated'](),controller[_0x96ad('0xc')]);router[_0x96ad('0xd')]('/',auth['isAuthenticated'](),controller[_0x96ad('0xe')]);router['put'](_0x96ad('0xb'),auth[_0x96ad('0x9')](),controller[_0x96ad('0xf')]);router[_0x96ad('0x10')](_0x96ad('0xb'),auth[_0x96ad('0x9')](),controller[_0x96ad('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 0e27c8b..3f039f9 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 _0x46fc=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x41f96e,_0x59bd28){var _0x5c2013=function(_0x8a6371){while(--_0x8a6371){_0x41f96e['push'](_0x41f96e['shift']());}};_0x5c2013(++_0x59bd28);}(_0x46fc,0x103));var _0xc46f=function(_0x3c97b9,_0x39c5b3){_0x3c97b9=_0x3c97b9-0x0;var _0x377e20=_0x46fc[_0x3c97b9];return _0x377e20;};'use strict';var Sequelize=require(_0xc46f('0x0'));module[_0xc46f('0x1')]={'type':{'type':Sequelize[_0xc46f('0x2')](_0xc46f('0x3'),_0xc46f('0x4'),_0xc46f('0x5'),_0xc46f('0x6')),'defaultValue':_0xc46f('0x3')},'content':{'type':Sequelize[_0xc46f('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xc46f('0x3'),_0xc46f('0x4'),_0xc46f('0x5'))},'keyContent':{'type':Sequelize[_0xc46f('0x7')]},'idField':{'type':Sequelize[_0xc46f('0x7')]},'nameField':{'type':Sequelize[_0xc46f('0x7')]},'customField':{'type':Sequelize[_0xc46f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc46f('0x7')]}}; \ No newline at end of file +var _0x8e94=['variable','STRING','sequelize','exports','string','customVariable'];(function(_0x3af956,_0x93bd81){var _0x173a82=function(_0x455b4a){while(--_0x455b4a){_0x3af956['push'](_0x3af956['shift']());}};_0x173a82(++_0x93bd81);}(_0x8e94,0xf8));var _0x48e9=function(_0x45518f,_0x475a6b){_0x45518f=_0x45518f-0x0;var _0x198175=_0x8e94[_0x45518f];return _0x198175;};'use strict';var Sequelize=require(_0x48e9('0x0'));module[_0x48e9('0x1')]={'type':{'type':Sequelize['ENUM'](_0x48e9('0x2'),'variable',_0x48e9('0x3'),'keyValue'),'defaultValue':_0x48e9('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x48e9('0x2'),_0x48e9('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x48e9('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x48e9('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x48e9('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 8ed72fa..413b7f2 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 _0x8ca9=['body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','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','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','save','update','then','sendStatus','error','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','model','keys','query','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create'];(function(_0x134b6e,_0x21b5ca){var _0x2229a9=function(_0x3fd3f5){while(--_0x3fd3f5){_0x134b6e['push'](_0x134b6e['shift']());}};_0x2229a9(++_0x21b5ca);}(_0x8ca9,0x9c));var _0x98ca=function(_0x5c3309,_0x19ae3f){_0x5c3309=_0x5c3309-0x0;var _0x200612=_0x8ca9[_0x5c3309];return _0x200612;};'use strict';var pdf=require(_0x98ca('0x0'));var emlformat=require(_0x98ca('0x1'));var rimraf=require(_0x98ca('0x2'));var zipdir=require(_0x98ca('0x3'));var jsonpatch=require(_0x98ca('0x4'));var rp=require(_0x98ca('0x5'));var moment=require(_0x98ca('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x98ca('0x7'));var path=require('path');var sox=require(_0x98ca('0x8'));var csv=require('to-csv');var ejs=require(_0x98ca('0x9'));var fs=require('fs');var _=require(_0x98ca('0xa'));var squel=require(_0x98ca('0xb'));var crypto=require(_0x98ca('0xc'));var jsforce=require(_0x98ca('0xd'));var deskjs=require(_0x98ca('0xe'));var toCsv=require(_0x98ca('0xf'));var querystring=require(_0x98ca('0x10'));var Papa=require(_0x98ca('0x11'));var Redis=require(_0x98ca('0x12'));var authService=require(_0x98ca('0x13'));var qs=require(_0x98ca('0x14'));var as=require(_0x98ca('0x15'));var hardwareService=require(_0x98ca('0x16'));var logger=require(_0x98ca('0x17'))(_0x98ca('0x18'));var utils=require(_0x98ca('0x19'));var config=require(_0x98ca('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x98ca('0x1b'))['db'];function respondWithStatusCode(_0x44b65b,_0xba3887){_0xba3887=_0xba3887||0xcc;return function(_0x472e13){if(_0x472e13){return _0x44b65b['sendStatus'](_0xba3887);}return _0x44b65b[_0x98ca('0x1c')](_0xba3887)[_0x98ca('0x1d')]();};}function respondWithResult(_0x9a230e,_0xa2bab4){_0xa2bab4=_0xa2bab4||0xc8;return function(_0x3df0ef){if(_0x3df0ef){return _0x9a230e[_0x98ca('0x1c')](_0xa2bab4)[_0x98ca('0x1e')](_0x3df0ef);}};}function respondWithFilteredResult(_0x4940ca,_0x330713){return function(_0x29df1b){if(_0x29df1b){var _0x29f46b=_0x29df1b[_0x98ca('0x1f')],_0x398171=_0x330713[_0x98ca('0x20')],_0x52e9c8=_0x330713[_0x98ca('0x20')]+_0x330713[_0x98ca('0x21')],_0x238c1a;if(_0x52e9c8>=_0x29f46b){_0x52e9c8=_0x29f46b;_0x238c1a=0xc8;}else{_0x238c1a=0xce;}_0x4940ca[_0x98ca('0x1c')](_0x238c1a);return _0x4940ca[_0x98ca('0x22')](_0x98ca('0x23'),_0x398171+'-'+_0x52e9c8+'/'+_0x29f46b)[_0x98ca('0x1e')](_0x29df1b);}return null;};}function patchUpdates(_0x110f9f){return function(_0x1b2c69){try{jsonpatch['apply'](_0x1b2c69,_0x110f9f,!![]);}catch(_0x626b37){return BPromise['reject'](_0x626b37);}return _0x1b2c69[_0x98ca('0x24')]();};}function saveUpdates(_0x2fe568,_0x50f8b4){return function(_0x5ca905){if(_0x5ca905){return _0x5ca905[_0x98ca('0x25')](_0x2fe568)[_0x98ca('0x26')](function(_0x130544){return _0x130544;});}return null;};}function removeEntity(_0x519927,_0x2f7742){return function(_0xc23332){if(_0xc23332){return _0xc23332['destroy']()[_0x98ca('0x26')](function(){_0x519927['status'](0xcc)[_0x98ca('0x1d')]();});}};}function handleEntityNotFound(_0x323cdb,_0x430d16){return function(_0x3ec01d){if(!_0x3ec01d){_0x323cdb[_0x98ca('0x27')](0x194);}return _0x3ec01d;};}function handleError(_0xe5091e,_0x2a59e3){_0x2a59e3=_0x2a59e3||0x1f4;return function(_0x50b1a2){logger[_0x98ca('0x28')](_0x50b1a2['stack']);if(_0x50b1a2[_0x98ca('0x29')]){delete _0x50b1a2[_0x98ca('0x29')];}_0xe5091e['status'](_0x2a59e3)[_0x98ca('0x2a')](_0x50b1a2);};}exports['index']=function(_0x214649,_0x4f48db){var _0x5bf77d={},_0x14bfb4={},_0x540f45={'count':0x0,'rows':[]};var _0x342a83=_[_0x98ca('0x2b')](db[_0x98ca('0x2c')][_0x98ca('0x2d')],function(_0x3b3e60){return{'name':_0x3b3e60[_0x98ca('0x2e')],'type':_0x3b3e60[_0x98ca('0x2f')][_0x98ca('0x30')]};});_0x14bfb4[_0x98ca('0x31')]=_['map'](_0x342a83,_0x98ca('0x29'));_0x14bfb4['query']=_[_0x98ca('0x32')](_0x214649[_0x98ca('0x33')]);_0x14bfb4['filters']=_['intersection'](_0x14bfb4[_0x98ca('0x31')],_0x14bfb4['query']);_0x5bf77d[_0x98ca('0x34')]=_['intersection'](_0x14bfb4[_0x98ca('0x31')],qs['fields'](_0x214649[_0x98ca('0x33')][_0x98ca('0x35')]));_0x5bf77d['attributes']=_0x5bf77d[_0x98ca('0x34')][_0x98ca('0x36')]?_0x5bf77d['attributes']:_0x14bfb4[_0x98ca('0x31')];if(!_0x214649[_0x98ca('0x33')]['hasOwnProperty'](_0x98ca('0x37'))){_0x5bf77d[_0x98ca('0x21')]=qs[_0x98ca('0x21')](_0x214649[_0x98ca('0x33')][_0x98ca('0x21')]);_0x5bf77d['offset']=qs[_0x98ca('0x20')](_0x214649[_0x98ca('0x33')]['offset']);}_0x5bf77d[_0x98ca('0x38')]=qs[_0x98ca('0x39')](_0x214649[_0x98ca('0x33')]['sort']);_0x5bf77d[_0x98ca('0x3a')]=qs[_0x98ca('0x3b')](_[_0x98ca('0x3c')](_0x214649['query'],_0x14bfb4[_0x98ca('0x3b')]),_0x342a83);if(_0x214649[_0x98ca('0x33')][_0x98ca('0x3d')]){_0x5bf77d['where']=_['merge'](_0x5bf77d[_0x98ca('0x3a')],{'$or':_[_0x98ca('0x2b')](_0x342a83,function(_0x3b13f9){if(_0x3b13f9['type']!==_0x98ca('0x3e')){var _0x364e37={};_0x364e37[_0x3b13f9[_0x98ca('0x29')]]={'$like':'%'+_0x214649['query'][_0x98ca('0x3d')]+'%'};return _0x364e37;}})});}_0x5bf77d=_[_0x98ca('0x3f')]({},_0x5bf77d,_0x214649[_0x98ca('0x40')]);var _0x450745={'where':_0x5bf77d[_0x98ca('0x3a')]};return db['SugarcrmField']['count'](_0x450745)['then'](function(_0x405691){_0x540f45[_0x98ca('0x1f')]=_0x405691;if(_0x214649[_0x98ca('0x33')][_0x98ca('0x41')]){_0x5bf77d[_0x98ca('0x42')]=[{'all':!![]}];}return db[_0x98ca('0x2c')][_0x98ca('0x43')](_0x5bf77d);})['then'](function(_0x4900ed){_0x540f45[_0x98ca('0x44')]=_0x4900ed;return _0x540f45;})[_0x98ca('0x26')](respondWithFilteredResult(_0x4f48db,_0x5bf77d))[_0x98ca('0x45')](handleError(_0x4f48db,null));};exports[_0x98ca('0x46')]=function(_0x17fdc7,_0x535fdc){var _0x55161f={'raw':!![],'where':{'id':_0x17fdc7[_0x98ca('0x47')]['id']}},_0x5c0d50={};_0x5c0d50[_0x98ca('0x31')]=_[_0x98ca('0x32')](db[_0x98ca('0x2c')]['rawAttributes']);_0x5c0d50['query']=_[_0x98ca('0x32')](_0x17fdc7[_0x98ca('0x33')]);_0x5c0d50[_0x98ca('0x3b')]=_[_0x98ca('0x48')](_0x5c0d50[_0x98ca('0x31')],_0x5c0d50[_0x98ca('0x33')]);_0x55161f[_0x98ca('0x34')]=_[_0x98ca('0x48')](_0x5c0d50[_0x98ca('0x31')],qs[_0x98ca('0x35')](_0x17fdc7[_0x98ca('0x33')]['fields']));_0x55161f[_0x98ca('0x34')]=_0x55161f[_0x98ca('0x34')][_0x98ca('0x36')]?_0x55161f[_0x98ca('0x34')]:_0x5c0d50[_0x98ca('0x31')];if(_0x17fdc7[_0x98ca('0x33')][_0x98ca('0x41')]){_0x55161f[_0x98ca('0x42')]=[{'all':!![]}];}_0x55161f=_[_0x98ca('0x3f')]({},_0x55161f,_0x17fdc7['options']);return db[_0x98ca('0x2c')][_0x98ca('0x49')](_0x55161f)['then'](handleEntityNotFound(_0x535fdc,null))[_0x98ca('0x26')](respondWithResult(_0x535fdc,null))['catch'](handleError(_0x535fdc,null));};exports[_0x98ca('0x4a')]=function(_0x39f4fd,_0x6a9045){return db[_0x98ca('0x2c')][_0x98ca('0x4a')](_0x39f4fd[_0x98ca('0x4b')],{})[_0x98ca('0x26')](respondWithResult(_0x6a9045,0xc9))[_0x98ca('0x45')](handleError(_0x6a9045,null));};exports[_0x98ca('0x25')]=function(_0x42a53d,_0x15971f){if(_0x42a53d[_0x98ca('0x4b')]['id']){delete _0x42a53d['body']['id'];}return db[_0x98ca('0x2c')][_0x98ca('0x49')]({'where':{'id':_0x42a53d[_0x98ca('0x47')]['id']}})[_0x98ca('0x26')](handleEntityNotFound(_0x15971f,null))['then'](saveUpdates(_0x42a53d[_0x98ca('0x4b')],null))[_0x98ca('0x26')](respondWithResult(_0x15971f,null))[_0x98ca('0x45')](handleError(_0x15971f,null));};exports[_0x98ca('0x4c')]=function(_0x2141ef,_0x254944){return db[_0x98ca('0x2c')]['find']({'where':{'id':_0x2141ef['params']['id']}})['then'](handleEntityNotFound(_0x254944,null))[_0x98ca('0x26')](removeEntity(_0x254944,null))[_0x98ca('0x45')](handleError(_0x254944,null));}; \ No newline at end of file +var _0xd8fb=['merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd8fb,0x99));var _0xbd8f=function(_0x5f2442,_0x39b833){_0x5f2442=_0x5f2442-0x0;var _0x2db768=_0xd8fb[_0x5f2442];return _0x2db768;};'use strict';var pdf=require(_0xbd8f('0x0'));var emlformat=require(_0xbd8f('0x1'));var rimraf=require(_0xbd8f('0x2'));var zipdir=require(_0xbd8f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbd8f('0x4'));var Mustache=require(_0xbd8f('0x5'));var util=require('util');var path=require(_0xbd8f('0x6'));var sox=require(_0xbd8f('0x7'));var csv=require('to-csv');var ejs=require(_0xbd8f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbd8f('0x9'));var crypto=require('crypto');var jsforce=require(_0xbd8f('0xa'));var deskjs=require(_0xbd8f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd8f('0xc'));var Redis=require(_0xbd8f('0xd'));var authService=require(_0xbd8f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbd8f('0xf'));var hardwareService=require(_0xbd8f('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xbd8f('0x11'));var config=require(_0xbd8f('0x12'));var licenseUtil=require(_0xbd8f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x230988,_0x159f09){_0x159f09=_0x159f09||0xcc;return function(_0x39be16){if(_0x39be16){return _0x230988[_0xbd8f('0x14')](_0x159f09);}return _0x230988[_0xbd8f('0x15')](_0x159f09)[_0xbd8f('0x16')]();};}function respondWithResult(_0x37d4d5,_0x29ffe8){_0x29ffe8=_0x29ffe8||0xc8;return function(_0x14606c){if(_0x14606c){return _0x37d4d5['status'](_0x29ffe8)[_0xbd8f('0x17')](_0x14606c);}};}function respondWithFilteredResult(_0x829fb2,_0xa57e91){return function(_0x10d72e){if(_0x10d72e){var _0x4da96f=_0x10d72e[_0xbd8f('0x18')],_0x174929=_0xa57e91[_0xbd8f('0x19')],_0x63db18=_0xa57e91['offset']+_0xa57e91[_0xbd8f('0x1a')],_0x5ebf8b;if(_0x63db18>=_0x4da96f){_0x63db18=_0x4da96f;_0x5ebf8b=0xc8;}else{_0x5ebf8b=0xce;}_0x829fb2[_0xbd8f('0x15')](_0x5ebf8b);return _0x829fb2['set']('Content-Range',_0x174929+'-'+_0x63db18+'/'+_0x4da96f)[_0xbd8f('0x17')](_0x10d72e);}return null;};}function patchUpdates(_0x5d2fdb){return function(_0x5705c5){try{jsonpatch[_0xbd8f('0x1b')](_0x5705c5,_0x5d2fdb,!![]);}catch(_0x4b5fac){return BPromise[_0xbd8f('0x1c')](_0x4b5fac);}return _0x5705c5[_0xbd8f('0x1d')]();};}function saveUpdates(_0xb47c8e,_0x897f25){return function(_0xdc11cc){if(_0xdc11cc){return _0xdc11cc[_0xbd8f('0x1e')](_0xb47c8e)[_0xbd8f('0x1f')](function(_0x90eff8){return _0x90eff8;});}return null;};}function removeEntity(_0x2fbe3b,_0x775acc){return function(_0xfe4048){if(_0xfe4048){return _0xfe4048[_0xbd8f('0x20')]()[_0xbd8f('0x1f')](function(){_0x2fbe3b[_0xbd8f('0x15')](0xcc)[_0xbd8f('0x16')]();});}};}function handleEntityNotFound(_0xd11ae,_0x395b1b){return function(_0x4ba8db){if(!_0x4ba8db){_0xd11ae[_0xbd8f('0x14')](0x194);}return _0x4ba8db;};}function handleError(_0x9fa3b1,_0x1f9fcc){_0x1f9fcc=_0x1f9fcc||0x1f4;return function(_0x2f3df7){logger[_0xbd8f('0x21')](_0x2f3df7[_0xbd8f('0x22')]);if(_0x2f3df7[_0xbd8f('0x23')]){delete _0x2f3df7[_0xbd8f('0x23')];}_0x9fa3b1['status'](_0x1f9fcc)[_0xbd8f('0x24')](_0x2f3df7);};}exports[_0xbd8f('0x25')]=function(_0x5a3a8c,_0x339df7){var _0x557daa={},_0x41b2a6={},_0x30d62e={'count':0x0,'rows':[]};var _0x991401=_[_0xbd8f('0x26')](db[_0xbd8f('0x27')][_0xbd8f('0x28')],function(_0x4c4431){return{'name':_0x4c4431[_0xbd8f('0x29')],'type':_0x4c4431[_0xbd8f('0x2a')][_0xbd8f('0x2b')]};});_0x41b2a6[_0xbd8f('0x2c')]=_[_0xbd8f('0x26')](_0x991401,_0xbd8f('0x23'));_0x41b2a6[_0xbd8f('0x2d')]=_['keys'](_0x5a3a8c[_0xbd8f('0x2d')]);_0x41b2a6[_0xbd8f('0x2e')]=_[_0xbd8f('0x2f')](_0x41b2a6[_0xbd8f('0x2c')],_0x41b2a6['query']);_0x557daa['attributes']=_[_0xbd8f('0x2f')](_0x41b2a6[_0xbd8f('0x2c')],qs[_0xbd8f('0x30')](_0x5a3a8c[_0xbd8f('0x2d')]['fields']));_0x557daa[_0xbd8f('0x31')]=_0x557daa[_0xbd8f('0x31')][_0xbd8f('0x32')]?_0x557daa[_0xbd8f('0x31')]:_0x41b2a6[_0xbd8f('0x2c')];if(!_0x5a3a8c['query'][_0xbd8f('0x33')](_0xbd8f('0x34'))){_0x557daa[_0xbd8f('0x1a')]=qs[_0xbd8f('0x1a')](_0x5a3a8c[_0xbd8f('0x2d')]['limit']);_0x557daa[_0xbd8f('0x19')]=qs['offset'](_0x5a3a8c[_0xbd8f('0x2d')][_0xbd8f('0x19')]);}_0x557daa[_0xbd8f('0x35')]=qs[_0xbd8f('0x36')](_0x5a3a8c[_0xbd8f('0x2d')][_0xbd8f('0x36')]);_0x557daa['where']=qs['filters'](_['pick'](_0x5a3a8c[_0xbd8f('0x2d')],_0x41b2a6[_0xbd8f('0x2e')]),_0x991401);if(_0x5a3a8c[_0xbd8f('0x2d')][_0xbd8f('0x37')]){_0x557daa[_0xbd8f('0x38')]=_[_0xbd8f('0x39')](_0x557daa[_0xbd8f('0x38')],{'$or':_[_0xbd8f('0x26')](_0x991401,function(_0x2d4882){if(_0x2d4882[_0xbd8f('0x2a')]!==_0xbd8f('0x3a')){var _0x339c70={};_0x339c70[_0x2d4882[_0xbd8f('0x23')]]={'$like':'%'+_0x5a3a8c[_0xbd8f('0x2d')][_0xbd8f('0x37')]+'%'};return _0x339c70;}})});}_0x557daa=_['merge']({},_0x557daa,_0x5a3a8c[_0xbd8f('0x3b')]);var _0x4181e0={'where':_0x557daa['where']};return db[_0xbd8f('0x27')][_0xbd8f('0x18')](_0x4181e0)[_0xbd8f('0x1f')](function(_0x582bcf){_0x30d62e[_0xbd8f('0x18')]=_0x582bcf;if(_0x5a3a8c['query'][_0xbd8f('0x3c')]){_0x557daa[_0xbd8f('0x3d')]=[{'all':!![]}];}return db[_0xbd8f('0x27')]['findAll'](_0x557daa);})[_0xbd8f('0x1f')](function(_0x72fe99){_0x30d62e[_0xbd8f('0x3e')]=_0x72fe99;return _0x30d62e;})['then'](respondWithFilteredResult(_0x339df7,_0x557daa))[_0xbd8f('0x3f')](handleError(_0x339df7,null));};exports[_0xbd8f('0x40')]=function(_0x2c1397,_0x351027){var _0x280d95={'raw':!![],'where':{'id':_0x2c1397[_0xbd8f('0x41')]['id']}},_0x1db8c7={};_0x1db8c7[_0xbd8f('0x2c')]=_[_0xbd8f('0x42')](db['SugarcrmField']['rawAttributes']);_0x1db8c7[_0xbd8f('0x2d')]=_[_0xbd8f('0x42')](_0x2c1397[_0xbd8f('0x2d')]);_0x1db8c7[_0xbd8f('0x2e')]=_['intersection'](_0x1db8c7[_0xbd8f('0x2c')],_0x1db8c7[_0xbd8f('0x2d')]);_0x280d95[_0xbd8f('0x31')]=_[_0xbd8f('0x2f')](_0x1db8c7[_0xbd8f('0x2c')],qs['fields'](_0x2c1397['query'][_0xbd8f('0x30')]));_0x280d95['attributes']=_0x280d95[_0xbd8f('0x31')][_0xbd8f('0x32')]?_0x280d95[_0xbd8f('0x31')]:_0x1db8c7[_0xbd8f('0x2c')];if(_0x2c1397[_0xbd8f('0x2d')][_0xbd8f('0x3c')]){_0x280d95[_0xbd8f('0x3d')]=[{'all':!![]}];}_0x280d95=_[_0xbd8f('0x39')]({},_0x280d95,_0x2c1397['options']);return db[_0xbd8f('0x27')][_0xbd8f('0x43')](_0x280d95)[_0xbd8f('0x1f')](handleEntityNotFound(_0x351027,null))[_0xbd8f('0x1f')](respondWithResult(_0x351027,null))[_0xbd8f('0x3f')](handleError(_0x351027,null));};exports[_0xbd8f('0x44')]=function(_0x272f70,_0x3918a5){return db['SugarcrmField'][_0xbd8f('0x44')](_0x272f70[_0xbd8f('0x45')],{})[_0xbd8f('0x1f')](respondWithResult(_0x3918a5,0xc9))[_0xbd8f('0x3f')](handleError(_0x3918a5,null));};exports[_0xbd8f('0x1e')]=function(_0x1e40f2,_0x42bada){if(_0x1e40f2[_0xbd8f('0x45')]['id']){delete _0x1e40f2[_0xbd8f('0x45')]['id'];}return db[_0xbd8f('0x27')][_0xbd8f('0x43')]({'where':{'id':_0x1e40f2[_0xbd8f('0x41')]['id']}})[_0xbd8f('0x1f')](handleEntityNotFound(_0x42bada,null))[_0xbd8f('0x1f')](saveUpdates(_0x1e40f2[_0xbd8f('0x45')],null))[_0xbd8f('0x1f')](respondWithResult(_0x42bada,null))[_0xbd8f('0x3f')](handleError(_0x42bada,null));};exports[_0xbd8f('0x20')]=function(_0x2668a4,_0x4d32c4){return db[_0xbd8f('0x27')][_0xbd8f('0x43')]({'where':{'id':_0x2668a4[_0xbd8f('0x41')]['id']}})[_0xbd8f('0x1f')](handleEntityNotFound(_0x4d32c4,null))['then'](removeEntity(_0x4d32c4,null))[_0xbd8f('0x3f')](handleError(_0x4d32c4,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 2f1b0f3..0a828d1 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 _0xae38=['SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define'];(function(_0x174930,_0x151b91){var _0x2236b9=function(_0x4eb7c4){while(--_0x4eb7c4){_0x174930['push'](_0x174930['shift']());}};_0x2236b9(++_0x151b91);}(_0xae38,0x122));var _0x8ae3=function(_0x54e342,_0x3adabf){_0x54e342=_0x54e342-0x0;var _0x11282d=_0xae38[_0x54e342];return _0x11282d;};'use strict';var _=require(_0x8ae3('0x0'));var util=require(_0x8ae3('0x1'));var logger=require('../../config/logger')(_0x8ae3('0x2'));var moment=require(_0x8ae3('0x3'));var BPromise=require(_0x8ae3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8ae3('0x5'));var config=require(_0x8ae3('0x6'));var attributes=require(_0x8ae3('0x7'));module[_0x8ae3('0x8')]=function(_0x13c797,_0x222a2e){return _0x13c797[_0x8ae3('0x9')](_0x8ae3('0xa'),attributes,{'tableName':_0x8ae3('0xb'),'paranoid':![],'indexes':[{'name':_0x8ae3('0xc'),'fields':[_0x8ae3('0xd'),_0x8ae3('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x980a=['SugarcrmField','int_sugarcrm_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define'];(function(_0x31991b,_0xaf75d2){var _0x307304=function(_0x2f36c5){while(--_0x2f36c5){_0x31991b['push'](_0x31991b['shift']());}};_0x307304(++_0xaf75d2);}(_0x980a,0x1ad));var _0xa980=function(_0x456f9b,_0xc27568){_0x456f9b=_0x456f9b-0x0;var _0x2a2efe=_0x980a[_0x456f9b];return _0x2a2efe;};'use strict';var _=require(_0xa980('0x0'));var util=require(_0xa980('0x1'));var logger=require(_0xa980('0x2'))(_0xa980('0x3'));var moment=require(_0xa980('0x4'));var BPromise=require(_0xa980('0x5'));var rp=require(_0xa980('0x6'));var fs=require('fs');var path=require(_0xa980('0x7'));var rimraf=require(_0xa980('0x8'));var config=require(_0xa980('0x9'));var attributes=require(_0xa980('0xa'));module[_0xa980('0xb')]=function(_0x191766,_0x11a3a2){return _0x191766[_0xa980('0xc')](_0xa980('0xd'),attributes,{'tableName':_0xa980('0xe'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xa980('0xf'),_0xa980('0x10')],'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 8be9f75..4cd8683 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 _0x5eb8=['info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4f7382,_0x552fbd){var _0x32ae8d=function(_0x47c3e6){while(--_0x47c3e6){_0x4f7382['push'](_0x4f7382['shift']());}};_0x32ae8d(++_0x552fbd);}(_0x5eb8,0xb0));var _0x85eb=function(_0x872b02,_0x4f4458){_0x872b02=_0x872b02-0x0;var _0x1a6b24=_0x5eb8[_0x872b02];return _0x1a6b24;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});} \ No newline at end of file +var _0x757a=['request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x60a84e,_0x250500){var _0x11828e=function(_0x3991f2){while(--_0x3991f2){_0x60a84e['push'](_0x60a84e['shift']());}};_0x11828e(++_0x250500);}(_0x757a,0xde));var _0xa757=function(_0x1d3a21,_0x3d7c59){_0x1d3a21=_0x1d3a21-0x0;var _0x25598f=_0x757a[_0x1d3a21];return _0x25598f;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index e0e3404..44d41a9 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 _0x08a3=['create','addConfiguration','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post'];(function(_0x13b70e,_0x4cdfba){var _0x993170=function(_0x1dad66){while(--_0x1dad66){_0x13b70e['push'](_0x13b70e['shift']());}};_0x993170(++_0x4cdfba);}(_0x08a3,0x1a9));var _0x308a=function(_0x27fc87,_0x198c79){_0x27fc87=_0x27fc87-0x0;var _0x58addc=_0x08a3[_0x27fc87];return _0x58addc;};'use strict';var multer=require('multer');var util=require(_0x308a('0x0'));var path=require(_0x308a('0x1'));var timeout=require(_0x308a('0x2'));var express=require(_0x308a('0x3'));var router=express[_0x308a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x308a('0x5'));var config=require('../../config/environment');var controller=require(_0x308a('0x6'));router[_0x308a('0x7')]('/',auth[_0x308a('0x8')](),controller[_0x308a('0x9')]);router['get'](_0x308a('0xa'),auth[_0x308a('0x8')](),controller[_0x308a('0xb')]);router['get'](_0x308a('0xc'),auth[_0x308a('0x8')](),controller['getConfigurations']);router[_0x308a('0x7')](_0x308a('0xd'),auth[_0x308a('0x8')](),controller[_0x308a('0xe')]);router[_0x308a('0xf')]('/',auth['isAuthenticated'](),controller[_0x308a('0x10')]);router[_0x308a('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x308a('0x11')]);router['put'](_0x308a('0xa'),auth[_0x308a('0x8')](),controller['update']);router[_0x308a('0x12')](_0x308a('0xa'),auth[_0x308a('0x8')](),controller[_0x308a('0x13')]);module[_0x308a('0x14')]=router; \ No newline at end of file +var _0x2624=['delete','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','getConfigurations','post','create','/:id/configurations','addConfiguration','put'];(function(_0xc1ca9,_0xba0789){var _0xeb22a1=function(_0x20656c){while(--_0x20656c){_0xc1ca9['push'](_0xc1ca9['shift']());}};_0xeb22a1(++_0xba0789);}(_0x2624,0x1a5));var _0x4262=function(_0x51660a,_0x30077a){_0x51660a=_0x51660a-0x0;var _0x51fab0=_0x2624[_0x51660a];return _0x51fab0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4262('0x0'));var timeout=require('connect-timeout');var express=require(_0x4262('0x1'));var router=express[_0x4262('0x2')]();var auth=require(_0x4262('0x3'));var interaction=require(_0x4262('0x4'));var config=require(_0x4262('0x5'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0x4262('0x6')](),controller['index']);router[_0x4262('0x7')](_0x4262('0x8'),auth['isAuthenticated'](),controller[_0x4262('0x9')]);router[_0x4262('0x7')]('/:id/configurations',auth[_0x4262('0x6')](),controller[_0x4262('0xa')]);router[_0x4262('0x7')]('/:id/fields',auth[_0x4262('0x6')](),controller['getFields']);router[_0x4262('0xb')]('/',auth[_0x4262('0x6')](),controller[_0x4262('0xc')]);router[_0x4262('0xb')](_0x4262('0xd'),auth[_0x4262('0x6')](),controller[_0x4262('0xe')]);router[_0x4262('0xf')]('/:id',auth[_0x4262('0x6')](),controller['update']);router[_0x4262('0x10')]('/:id',auth[_0x4262('0x6')](),controller[_0x4262('0x11')]);module[_0x4262('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 9322438..1c0c9d7 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 _0x3c03=['STRING','HelpDesk','sequelize'];(function(_0x269847,_0x540f3a){var _0x397d3d=function(_0x41b6c0){while(--_0x41b6c0){_0x269847['push'](_0x269847['shift']());}};_0x397d3d(++_0x540f3a);}(_0x3c03,0x16d));var _0x33c0=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x3c03[_0x5037ab];return _0x512adb;};'use strict';var Sequelize=require(_0x33c0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x33c0('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x33c0('0x1')],'allowNull':![],'defaultValue':_0x33c0('0x2')},'remoteUri':{'type':Sequelize[_0x33c0('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x33c0('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x6af6=['exports','STRING','HelpDesk'];(function(_0x4d475e,_0x1c2276){var _0x491576=function(_0x544dc9){while(--_0x544dc9){_0x4d475e['push'](_0x4d475e['shift']());}};_0x491576(++_0x1c2276);}(_0x6af6,0x1ce));var _0x66af=function(_0x1cc0ae,_0x194422){_0x1cc0ae=_0x1cc0ae-0x0;var _0x43393a=_0x6af6[_0x1cc0ae];return _0x43393a;};'use strict';var Sequelize=require('sequelize');module[_0x66af('0x0')]={'name':{'type':Sequelize[_0x66af('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x66af('0x1')]},'username':{'type':Sequelize[_0x66af('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x66af('0x1')],'allowNull':![],'defaultValue':_0x66af('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x66af('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x66af('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 0d22d0c..30c3771 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 _0xbe22=['log','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','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','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','length','create','body','find','destroy','getConfigurations','findOne','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','VtigerConfiguration','md5','getFields','username','description','moduleName','remoteUri','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','token','describe','sessionName','autogenerated','reference','remove','includes','editable','false','label','cf_','picklist','picklistValues','value'];(function(_0x391b0b,_0xa19909){var _0x12bcbb=function(_0x2bd9b6){while(--_0x2bd9b6){_0x391b0b['push'](_0x391b0b['shift']());}};_0x12bcbb(++_0xa19909);}(_0xbe22,0x86));var _0x2be2=function(_0x24c39f,_0x39e545){_0x24c39f=_0x24c39f-0x0;var _0x52e28d=_0xbe22[_0x24c39f];return _0x52e28d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2be2('0x0'));var rimraf=require(_0x2be2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2be2('0x2'));var moment=require(_0x2be2('0x3'));var BPromise=require(_0x2be2('0x4'));var Mustache=require(_0x2be2('0x5'));var util=require(_0x2be2('0x6'));var path=require('path');var sox=require(_0x2be2('0x7'));var csv=require(_0x2be2('0x8'));var ejs=require(_0x2be2('0x9'));var fs=require('fs');var _=require(_0x2be2('0xa'));var squel=require(_0x2be2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2be2('0x8'));var querystring=require(_0x2be2('0xc'));var Papa=require(_0x2be2('0xd'));var Redis=require(_0x2be2('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2be2('0xf'));var as=require(_0x2be2('0x10'));var hardwareService=require(_0x2be2('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x2be2('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x2be2('0x13'));var db=require(_0x2be2('0x14'))['db'];var integrations=require(_0x2be2('0x15'));var jayson=require('jayson/promise');var client=jayson[_0x2be2('0x16')][_0x2be2('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x39432d,_0x53ac46,_0xf6506a,_0x1f0c92){return new BPromise(function(_0x41098c,_0x339622){var _0xa7dff=_0x1f0c92||client;return _0xa7dff[_0x2be2('0x18')](_0x39432d,_0xf6506a)[_0x2be2('0x19')](function(_0x278321){logger[_0x2be2('0x1a')](_0x2be2('0x1b'),_0x53ac46,_0x2be2('0x1c'));logger[_0x2be2('0x1d')](_0x2be2('0x1e'),_0x53ac46,_0x2be2('0x1c'),JSON[_0x2be2('0x1f')](_0x278321));if(_0x278321[_0x2be2('0x20')]){if(_0x278321['error'][_0x2be2('0x21')]===0x1f4){logger['error'](_0x2be2('0x1b'),_0x53ac46,_0x278321[_0x2be2('0x20')][_0x2be2('0x22')]);return _0x339622(_0x278321[_0x2be2('0x20')][_0x2be2('0x22')]);}logger['error'](_0x2be2('0x1b'),_0x53ac46,_0x278321[_0x2be2('0x20')][_0x2be2('0x22')]);return _0x41098c(_0x278321[_0x2be2('0x20')][_0x2be2('0x22')]);}else{logger[_0x2be2('0x1a')](_0x2be2('0x1b'),_0x53ac46,_0x2be2('0x1c'));_0x41098c(_0x278321[_0x2be2('0x23')][_0x2be2('0x22')]);}})[_0x2be2('0x24')](function(_0x1ad650){logger['error'](_0x2be2('0x1b'),_0x53ac46,_0x1ad650);_0x339622(_0x1ad650);});});}function respondWithStatusCode(_0x542a53,_0x458c93){_0x458c93=_0x458c93||0xcc;return function(_0x40e908){if(_0x40e908){return _0x542a53[_0x2be2('0x25')](_0x458c93);}return _0x542a53[_0x2be2('0x26')](_0x458c93)[_0x2be2('0x27')]();};}function respondWithResult(_0x42edef,_0xe78ba4){_0xe78ba4=_0xe78ba4||0xc8;return function(_0xbc1fd8){if(_0xbc1fd8){return _0x42edef[_0x2be2('0x26')](_0xe78ba4)['json'](_0xbc1fd8);}};}function respondWithFilteredResult(_0x91aee4,_0x7fe763){return function(_0x44d42b){if(_0x44d42b){var _0x2a6200=_0x44d42b[_0x2be2('0x28')],_0x4ccec3=_0x7fe763[_0x2be2('0x29')],_0x565d47=_0x7fe763[_0x2be2('0x29')]+_0x7fe763[_0x2be2('0x2a')],_0x1d729e;if(_0x565d47>=_0x2a6200){_0x565d47=_0x2a6200;_0x1d729e=0xc8;}else{_0x1d729e=0xce;}_0x91aee4[_0x2be2('0x26')](_0x1d729e);return _0x91aee4[_0x2be2('0x2b')](_0x2be2('0x2c'),_0x4ccec3+'-'+_0x565d47+'/'+_0x2a6200)[_0x2be2('0x2d')](_0x44d42b);}return null;};}function patchUpdates(_0x5274ab){return function(_0x4a4665){try{jsonpatch[_0x2be2('0x2e')](_0x4a4665,_0x5274ab,!![]);}catch(_0xc32bb3){return BPromise['reject'](_0xc32bb3);}return _0x4a4665[_0x2be2('0x2f')]();};}function saveUpdates(_0x4b5145,_0x2ba652){return function(_0x2a9401){if(_0x2a9401){return _0x2a9401[_0x2be2('0x30')](_0x4b5145)[_0x2be2('0x19')](function(_0xa4f8c5){return _0xa4f8c5;});}return null;};}function removeEntity(_0x441ca5,_0x2ac654){return function(_0x16e05d){if(_0x16e05d){return _0x16e05d['destroy']()[_0x2be2('0x19')](function(){_0x441ca5[_0x2be2('0x26')](0xcc)[_0x2be2('0x27')]();});}};}function handleEntityNotFound(_0x5bc036,_0x128568){return function(_0x8b7230){if(!_0x8b7230){_0x5bc036[_0x2be2('0x25')](0x194);}return _0x8b7230;};}function handleError(_0x46512c,_0x298d70){_0x298d70=_0x298d70||0x1f4;return function(_0x13ab76){logger['error'](_0x13ab76[_0x2be2('0x31')]);if(_0x13ab76[_0x2be2('0x32')]){delete _0x13ab76['name'];}_0x46512c[_0x2be2('0x26')](_0x298d70)[_0x2be2('0x33')](_0x13ab76);};}exports['index']=function(_0x4ea9d8,_0x354e94){var _0x3c9025={},_0x488b9a={},_0x119821={'count':0x0,'rows':[]};var _0x275a56=_[_0x2be2('0x34')](db[_0x2be2('0x35')][_0x2be2('0x36')],function(_0x4e9d62){return{'name':_0x4e9d62[_0x2be2('0x37')],'type':_0x4e9d62[_0x2be2('0x38')][_0x2be2('0x39')]};});_0x488b9a['model']=_[_0x2be2('0x34')](_0x275a56,'name');_0x488b9a[_0x2be2('0x3a')]=_[_0x2be2('0x3b')](_0x4ea9d8[_0x2be2('0x3a')]);_0x488b9a[_0x2be2('0x3c')]=_[_0x2be2('0x3d')](_0x488b9a['model'],_0x488b9a[_0x2be2('0x3a')]);_0x3c9025[_0x2be2('0x3e')]=_[_0x2be2('0x3d')](_0x488b9a[_0x2be2('0x3f')],qs[_0x2be2('0x40')](_0x4ea9d8[_0x2be2('0x3a')]['fields']));_0x3c9025[_0x2be2('0x3e')]=_0x3c9025['attributes']['length']?_0x3c9025[_0x2be2('0x3e')]:_0x488b9a[_0x2be2('0x3f')];if(!_0x4ea9d8['query'][_0x2be2('0x41')](_0x2be2('0x42'))){_0x3c9025[_0x2be2('0x2a')]=qs[_0x2be2('0x2a')](_0x4ea9d8[_0x2be2('0x3a')][_0x2be2('0x2a')]);_0x3c9025[_0x2be2('0x29')]=qs['offset'](_0x4ea9d8[_0x2be2('0x3a')][_0x2be2('0x29')]);}_0x3c9025[_0x2be2('0x43')]=qs[_0x2be2('0x44')](_0x4ea9d8[_0x2be2('0x3a')][_0x2be2('0x44')]);_0x3c9025[_0x2be2('0x45')]=qs[_0x2be2('0x3c')](_[_0x2be2('0x46')](_0x4ea9d8[_0x2be2('0x3a')],_0x488b9a[_0x2be2('0x3c')]),_0x275a56);if(_0x4ea9d8[_0x2be2('0x3a')][_0x2be2('0x47')]){_0x3c9025[_0x2be2('0x45')]=_['merge'](_0x3c9025[_0x2be2('0x45')],{'$or':_[_0x2be2('0x34')](_0x275a56,function(_0x5f11dc){if(_0x5f11dc[_0x2be2('0x38')]!==_0x2be2('0x48')){var _0x57cb2c={};_0x57cb2c[_0x5f11dc[_0x2be2('0x32')]]={'$like':'%'+_0x4ea9d8[_0x2be2('0x3a')]['filter']+'%'};return _0x57cb2c;}})});}_0x3c9025=_[_0x2be2('0x49')]({},_0x3c9025,_0x4ea9d8[_0x2be2('0x4a')]);var _0x596b40={'where':_0x3c9025['where']};return db['VtigerAccount']['count'](_0x596b40)[_0x2be2('0x19')](function(_0x297c45){_0x119821['count']=_0x297c45;if(_0x4ea9d8[_0x2be2('0x3a')][_0x2be2('0x4b')]){_0x3c9025[_0x2be2('0x4c')]=[{'all':!![]}];}return db['VtigerAccount'][_0x2be2('0x4d')](_0x3c9025);})[_0x2be2('0x19')](function(_0x160191){_0x119821[_0x2be2('0x4e')]=_0x160191;return _0x119821;})[_0x2be2('0x19')](respondWithFilteredResult(_0x354e94,_0x3c9025))['catch'](handleError(_0x354e94,null));};exports[_0x2be2('0x4f')]=function(_0x5c7572,_0x29727a){var _0x5f392b={'raw':![],'where':{'id':_0x5c7572[_0x2be2('0x50')]['id']}},_0x4a310a={};_0x4a310a[_0x2be2('0x3f')]=_[_0x2be2('0x3b')](db[_0x2be2('0x35')][_0x2be2('0x36')]);_0x4a310a[_0x2be2('0x3a')]=_[_0x2be2('0x3b')](_0x5c7572[_0x2be2('0x3a')]);_0x4a310a['filters']=_[_0x2be2('0x3d')](_0x4a310a[_0x2be2('0x3f')],_0x4a310a[_0x2be2('0x3a')]);_0x5f392b[_0x2be2('0x3e')]=_[_0x2be2('0x3d')](_0x4a310a['model'],qs[_0x2be2('0x40')](_0x5c7572[_0x2be2('0x3a')][_0x2be2('0x40')]));_0x5f392b['attributes']=_0x5f392b[_0x2be2('0x3e')][_0x2be2('0x51')]?_0x5f392b['attributes']:_0x4a310a[_0x2be2('0x3f')];if(_0x5c7572['query'][_0x2be2('0x4b')]){_0x5f392b[_0x2be2('0x4c')]=[{'all':!![]}];}_0x5f392b=_[_0x2be2('0x49')]({},_0x5f392b,_0x5c7572[_0x2be2('0x4a')]);return db[_0x2be2('0x35')]['find'](_0x5f392b)[_0x2be2('0x19')](handleEntityNotFound(_0x29727a,null))[_0x2be2('0x19')](respondWithResult(_0x29727a,null))[_0x2be2('0x24')](handleError(_0x29727a,null));};exports[_0x2be2('0x52')]=function(_0x5ae79a,_0x558b21){return db[_0x2be2('0x35')]['create'](_0x5ae79a['body'],{})[_0x2be2('0x19')](respondWithResult(_0x558b21,0xc9))[_0x2be2('0x24')](handleError(_0x558b21,null));};exports[_0x2be2('0x30')]=function(_0xef2d37,_0x51cc68){if(_0xef2d37['body']['id']){delete _0xef2d37[_0x2be2('0x53')]['id'];}return db['VtigerAccount'][_0x2be2('0x54')]({'where':{'id':_0xef2d37[_0x2be2('0x50')]['id']}})['then'](handleEntityNotFound(_0x51cc68,null))[_0x2be2('0x19')](saveUpdates(_0xef2d37[_0x2be2('0x53')],null))[_0x2be2('0x19')](respondWithResult(_0x51cc68,null))[_0x2be2('0x24')](handleError(_0x51cc68,null));};exports[_0x2be2('0x55')]=function(_0x14c675,_0x495727){return db['VtigerAccount'][_0x2be2('0x54')]({'where':{'id':_0x14c675[_0x2be2('0x50')]['id']}})['then'](handleEntityNotFound(_0x495727,null))[_0x2be2('0x19')](removeEntity(_0x495727,null))[_0x2be2('0x24')](handleError(_0x495727,null));};exports[_0x2be2('0x56')]=function(_0x421c08,_0xa51a79,_0x552db1){var _0x39a492={};var _0x2de727={};var _0xcb940e;var _0xde3cf9;return db['VtigerAccount'][_0x2be2('0x57')]({'where':{'id':_0x421c08['params']['id']}})['then'](handleEntityNotFound(_0xa51a79,null))[_0x2be2('0x19')](function(_0x2ffae8){if(_0x2ffae8){_0xcb940e=_0x2ffae8;_0x2de727[_0x2be2('0x3f')]=_['keys'](db['VtigerConfiguration']['rawAttributes']);_0x2de727[_0x2be2('0x3a')]=_[_0x2be2('0x3b')](_0x421c08['query']);_0x2de727['filters']=_[_0x2be2('0x3d')](_0x2de727[_0x2be2('0x3f')],_0x2de727[_0x2be2('0x3a')]);_0x39a492[_0x2be2('0x3e')]=_['intersection'](_0x2de727[_0x2be2('0x3f')],qs[_0x2be2('0x40')](_0x421c08[_0x2be2('0x3a')][_0x2be2('0x40')]));_0x39a492[_0x2be2('0x3e')]=_0x39a492[_0x2be2('0x3e')][_0x2be2('0x51')]?_0x39a492['attributes']:_0x2de727[_0x2be2('0x3f')];_0x39a492[_0x2be2('0x43')]=qs[_0x2be2('0x44')](_0x421c08['query']['sort']);_0x39a492['where']=qs[_0x2be2('0x3c')](_[_0x2be2('0x46')](_0x421c08[_0x2be2('0x3a')],_0x2de727[_0x2be2('0x3c')]));if(_0x421c08[_0x2be2('0x3a')][_0x2be2('0x47')]){_0x39a492[_0x2be2('0x45')]=_[_0x2be2('0x49')](_0x39a492[_0x2be2('0x45')],{'$or':_[_0x2be2('0x34')](_0x39a492['attributes'],function(_0x394634){var _0xee2cf8={};_0xee2cf8[_0x394634]={'$like':'%'+_0x421c08[_0x2be2('0x3a')][_0x2be2('0x47')]+'%'};return _0xee2cf8;})});}_0x39a492=_[_0x2be2('0x49')]({},_0x39a492,_0x421c08[_0x2be2('0x4a')]);return _0xcb940e[_0x2be2('0x56')](_0x39a492);}})[_0x2be2('0x19')](function(_0x381f90){if(_0x381f90){_0xde3cf9=_0x381f90[_0x2be2('0x51')];if(!_0x421c08[_0x2be2('0x3a')][_0x2be2('0x41')](_0x2be2('0x42'))){_0x39a492['limit']=qs[_0x2be2('0x2a')](_0x421c08[_0x2be2('0x3a')][_0x2be2('0x2a')]);_0x39a492[_0x2be2('0x29')]=qs[_0x2be2('0x29')](_0x421c08[_0x2be2('0x3a')][_0x2be2('0x29')]);}return _0xcb940e[_0x2be2('0x56')](_0x39a492);}})[_0x2be2('0x19')](function(_0x347e66){if(_0x347e66){return _0x347e66?{'count':_0xde3cf9,'rows':_0x347e66}:null;}})[_0x2be2('0x19')](respondWithResult(_0xa51a79,null))[_0x2be2('0x24')](handleError(_0xa51a79,null));};exports[_0x2be2('0x58')]=function(_0x1ac046,_0x588359,_0x33f33c){if(_0x1ac046[_0x2be2('0x53')]['id']){delete _0x1ac046['body']['id'];}return db[_0x2be2('0x35')][_0x2be2('0x57')]({'where':{'id':_0x1ac046['params']['id']}})[_0x2be2('0x19')](handleEntityNotFound(_0x588359,null))[_0x2be2('0x19')](function(_0x4ed904){if(_0x4ed904){_0x1ac046[_0x2be2('0x53')][_0x2be2('0x59')]=_0x4ed904['id'];_0x1ac046[_0x2be2('0x53')]['Subjects']=integrations[_0x2be2('0x5a')](_0x1ac046[_0x2be2('0x53')][_0x2be2('0x5b')],_0x1ac046[_0x2be2('0x53')]['type']);_0x1ac046['body'][_0x2be2('0x5c')]=integrations[_0x2be2('0x5d')](_0x1ac046[_0x2be2('0x53')]['channel'],_0x1ac046[_0x2be2('0x53')][_0x2be2('0x38')]);return db[_0x2be2('0x5e')][_0x2be2('0x52')](_0x1ac046[_0x2be2('0x53')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0x2be2('0x19')](respondWithResult(_0x588359,null))[_0x2be2('0x24')](handleError(_0x588359,null));};var md5=require(_0x2be2('0x5f'));exports[_0x2be2('0x60')]=function(_0x30af8f,_0x387e0a,_0xc9e071){var _0x5898d0=null;var _0x380e6d=null;var _0x4ab282=null;var _0x25b2e9=null;var _0x219316='';return db[_0x2be2('0x35')][_0x2be2('0x57')]({'where':{'id':_0x30af8f[_0x2be2('0x50')]['id']},'attributes':['id',_0x2be2('0x32'),_0x2be2('0x61'),_0x2be2('0x62'),_0x2be2('0x63'),_0x2be2('0x64'),'serverUrl',_0x2be2('0x65')]})['then'](handleEntityNotFound(_0x387e0a,null))[_0x2be2('0x19')](function(_0x20a8ba){if(_0x20a8ba){_0x5898d0=_0x20a8ba['username'];_0x380e6d=_0x20a8ba[_0x2be2('0x65')];_0x4ab282=_0x20a8ba[_0x2be2('0x63')];_0x219316=_0x20a8ba[_0x2be2('0x64')];var _0x356fac=_0x219316[_0x2be2('0x66')](-0x1);if(_0x356fac==='/'){_0x219316=_0x219316[_0x2be2('0x67')](0x0,_0x219316[_0x2be2('0x68')](_0x356fac));}_0x25b2e9=util[_0x2be2('0x69')](_0x2be2('0x6a'),_0x219316);var _0x5b841d={'method':_0x2be2('0x6b'),'uri':_0x25b2e9,'qs':{'operation':_0x2be2('0x6c'),'username':_0x20a8ba[_0x2be2('0x61')]},'json':!![]};return rp(_0x5b841d);}})['then'](function(_0x13682f){if(_0x13682f[_0x2be2('0x6d')]){var _0x2cff3d={'method':_0x2be2('0x6e'),'uri':_0x25b2e9,'form':{'operation':_0x2be2('0x6f'),'username':_0x5898d0,'accessKey':md5(_0x13682f['result'][_0x2be2('0x70')]+_0x380e6d)},'json':!![]};return rp(_0x2cff3d);}})[_0x2be2('0x19')](function(_0x5e3c49){if(_0x5e3c49[_0x2be2('0x6d')]){var _0x4c0e3a={'method':'GET','uri':_0x25b2e9,'qs':{'operation':_0x2be2('0x71'),'username':_0x5898d0,'sessionName':_0x5e3c49['result'][_0x2be2('0x72')],'elementType':_0x4ab282},'json':!![]};return rp(_0x4c0e3a);}})[_0x2be2('0x19')](function(_0x2ef782){if(_0x2ef782[_0x2be2('0x6d')]){var _0x55e58a=[_0x2be2('0x73'),_0x2be2('0x74'),'owner'];_[_0x2be2('0x75')](_0x2ef782[_0x2be2('0x23')][_0x2be2('0x40')],function(_0x10a460){return _0x55e58a[_0x2be2('0x76')](_0x10a460[_0x2be2('0x38')][_0x2be2('0x32')]);});_[_0x2be2('0x75')](_0x2ef782[_0x2be2('0x23')][_0x2be2('0x40')],function(_0x1d7f5a){return _0x1d7f5a[_0x2be2('0x77')]===_0x2be2('0x78');});return{'count':_0x2ef782['result'][_0x2be2('0x40')]['length'],'rows':_[_0x2be2('0x34')](_0x2ef782[_0x2be2('0x23')][_0x2be2('0x40')],function(_0x1d8cd8){return{'id':_0x1d8cd8[_0x2be2('0x32')],'name':_0x1d8cd8[_0x2be2('0x79')],'custom':_['startsWith'](_0x1d8cd8[_0x2be2('0x32')],_0x2be2('0x7a'))?!![]:![],'options':_0x1d8cd8['type'][_0x2be2('0x32')]===_0x2be2('0x7b')&&_0x1d8cd8[_0x2be2('0x38')]['picklistValues'][_0x2be2('0x51')]>0x0?_[_0x2be2('0x34')](_0x1d8cd8[_0x2be2('0x38')][_0x2be2('0x7c')],function(_0x4a94c9){return{'name':_0x4a94c9[_0x2be2('0x79')],'value':_0x4a94c9[_0x2be2('0x7d')]};}):[]};})};}})[_0x2be2('0x19')](respondWithResult(_0x387e0a,null))[_0x2be2('0x24')](function(_0x1a944d){console[_0x2be2('0x7e')]('vTiger\x20error:\x20'+_0x1a944d);var _0x1c1f65=_0x30af8f[_0x2be2('0x3a')][_0x2be2('0x7f')]?0x1f4:_0x1a944d['statusCode']||0x1f4;logger['error'](_0x2be2('0x80'),'getFields',_0x1c1f65,JSON[_0x2be2('0x1f')](_0x1a944d));delete _0x1a944d[_0x2be2('0x32')];if(_0x1c1f65===0x191){_0x1c1f65=0x190;}_0x387e0a[_0x2be2('0x26')](_0x1c1f65)['send'](_0x30af8f[_0x2be2('0x3a')][_0x2be2('0x7f')]?{'message':'Wrong\x20credentials','statusCode':_0x1a944d[_0x2be2('0x81')]}:_0x1a944d);});}; \ No newline at end of file +var _0xc15e=['picklist','picklistValues','label','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VtigerAccount,\x20%s,\x20%s','result','catch','status','end','json','offset','limit','set','reject','save','update','destroy','name','index','map','VtigerAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','count','findAll','rows','show','params','rawAttributes','include','find','create','body','VtigerConfiguration','pick','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','token','success','describe','sessionName','autogenerated','reference','owner','remove','editable','startsWith'];(function(_0x2f91c4,_0x2041a4){var _0x92f521=function(_0x2a4161){while(--_0x2a4161){_0x2f91c4['push'](_0x2f91c4['shift']());}};_0x92f521(++_0x2041a4);}(_0xc15e,0x191));var _0xec15=function(_0x468c71,_0x4dc941){_0x468c71=_0x468c71-0x0;var _0x47aa5b=_0xc15e[_0x468c71];return _0x47aa5b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xec15('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xec15('0x1'));var moment=require(_0xec15('0x2'));var BPromise=require(_0xec15('0x3'));var Mustache=require(_0xec15('0x4'));var util=require(_0xec15('0x5'));var path=require(_0xec15('0x6'));var sox=require(_0xec15('0x7'));var csv=require(_0xec15('0x8'));var ejs=require(_0xec15('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xec15('0xa'));var crypto=require(_0xec15('0xb'));var jsforce=require(_0xec15('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xec15('0x8'));var querystring=require(_0xec15('0xd'));var Papa=require(_0xec15('0xe'));var Redis=require(_0xec15('0xf'));var authService=require(_0xec15('0x10'));var qs=require(_0xec15('0x11'));var as=require(_0xec15('0x12'));var hardwareService=require(_0xec15('0x13'));var logger=require(_0xec15('0x14'))(_0xec15('0x15'));var utils=require('../../config/utils');var config=require(_0xec15('0x16'));var licenseUtil=require(_0xec15('0x17'));var db=require(_0xec15('0x18'))['db'];var integrations=require(_0xec15('0x19'));var jayson=require(_0xec15('0x1a'));var client=jayson[_0xec15('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e999c,_0xe63c7e,_0x13e912,_0x4cfad8){return new BPromise(function(_0x435f27,_0x32a21c){var _0x23075b=_0x4cfad8||client;return _0x23075b[_0xec15('0x1c')](_0x1e999c,_0x13e912)[_0xec15('0x1d')](function(_0x22888c){logger[_0xec15('0x1e')]('VtigerAccount,\x20%s,\x20%s',_0xe63c7e,'request\x20sent');logger[_0xec15('0x1f')](_0xec15('0x20'),_0xe63c7e,_0xec15('0x21'),JSON[_0xec15('0x22')](_0x22888c));if(_0x22888c[_0xec15('0x23')]){if(_0x22888c[_0xec15('0x23')][_0xec15('0x24')]===0x1f4){logger[_0xec15('0x23')]('VtigerAccount,\x20%s,\x20%s',_0xe63c7e,_0x22888c['error'][_0xec15('0x25')]);return _0x32a21c(_0x22888c[_0xec15('0x23')][_0xec15('0x25')]);}logger[_0xec15('0x23')](_0xec15('0x26'),_0xe63c7e,_0x22888c[_0xec15('0x23')][_0xec15('0x25')]);return _0x435f27(_0x22888c[_0xec15('0x23')]['message']);}else{logger[_0xec15('0x1e')](_0xec15('0x26'),_0xe63c7e,_0xec15('0x21'));_0x435f27(_0x22888c[_0xec15('0x27')][_0xec15('0x25')]);}})[_0xec15('0x28')](function(_0x3ae310){logger[_0xec15('0x23')](_0xec15('0x26'),_0xe63c7e,_0x3ae310);_0x32a21c(_0x3ae310);});});}function respondWithStatusCode(_0x28fad5,_0x53df4c){_0x53df4c=_0x53df4c||0xcc;return function(_0x3f9131){if(_0x3f9131){return _0x28fad5['sendStatus'](_0x53df4c);}return _0x28fad5[_0xec15('0x29')](_0x53df4c)[_0xec15('0x2a')]();};}function respondWithResult(_0x35601b,_0xbccde7){_0xbccde7=_0xbccde7||0xc8;return function(_0x166490){if(_0x166490){return _0x35601b[_0xec15('0x29')](_0xbccde7)[_0xec15('0x2b')](_0x166490);}};}function respondWithFilteredResult(_0x2fb384,_0x1a4496){return function(_0x472dbd){if(_0x472dbd){var _0x1b4436=_0x472dbd['count'],_0xd676e1=_0x1a4496[_0xec15('0x2c')],_0x39ddcd=_0x1a4496[_0xec15('0x2c')]+_0x1a4496[_0xec15('0x2d')],_0x3f2e39;if(_0x39ddcd>=_0x1b4436){_0x39ddcd=_0x1b4436;_0x3f2e39=0xc8;}else{_0x3f2e39=0xce;}_0x2fb384[_0xec15('0x29')](_0x3f2e39);return _0x2fb384[_0xec15('0x2e')]('Content-Range',_0xd676e1+'-'+_0x39ddcd+'/'+_0x1b4436)['json'](_0x472dbd);}return null;};}function patchUpdates(_0x25cb92){return function(_0x132f70){try{jsonpatch['apply'](_0x132f70,_0x25cb92,!![]);}catch(_0x5a01d7){return BPromise[_0xec15('0x2f')](_0x5a01d7);}return _0x132f70[_0xec15('0x30')]();};}function saveUpdates(_0x10991c,_0x272abf){return function(_0x18a966){if(_0x18a966){return _0x18a966[_0xec15('0x31')](_0x10991c)[_0xec15('0x1d')](function(_0x5b0ceb){return _0x5b0ceb;});}return null;};}function removeEntity(_0x589c7a,_0x5ada64){return function(_0x245581){if(_0x245581){return _0x245581[_0xec15('0x32')]()[_0xec15('0x1d')](function(){_0x589c7a['status'](0xcc)[_0xec15('0x2a')]();});}};}function handleEntityNotFound(_0x2e9955,_0x55705a){return function(_0x3422a7){if(!_0x3422a7){_0x2e9955['sendStatus'](0x194);}return _0x3422a7;};}function handleError(_0x117b4e,_0x4fc057){_0x4fc057=_0x4fc057||0x1f4;return function(_0x3153a2){logger[_0xec15('0x23')](_0x3153a2['stack']);if(_0x3153a2[_0xec15('0x33')]){delete _0x3153a2['name'];}_0x117b4e[_0xec15('0x29')](_0x4fc057)['send'](_0x3153a2);};}exports[_0xec15('0x34')]=function(_0x14e698,_0x1c25a1){var _0x488707={},_0x507b3b={},_0x5dcbc2={'count':0x0,'rows':[]};var _0x3abbb6=_[_0xec15('0x35')](db[_0xec15('0x36')]['rawAttributes'],function(_0x237774){return{'name':_0x237774[_0xec15('0x37')],'type':_0x237774[_0xec15('0x38')][_0xec15('0x39')]};});_0x507b3b[_0xec15('0x3a')]=_['map'](_0x3abbb6,'name');_0x507b3b[_0xec15('0x3b')]=_[_0xec15('0x3c')](_0x14e698[_0xec15('0x3b')]);_0x507b3b[_0xec15('0x3d')]=_['intersection'](_0x507b3b[_0xec15('0x3a')],_0x507b3b[_0xec15('0x3b')]);_0x488707[_0xec15('0x3e')]=_[_0xec15('0x3f')](_0x507b3b[_0xec15('0x3a')],qs[_0xec15('0x40')](_0x14e698[_0xec15('0x3b')][_0xec15('0x40')]));_0x488707[_0xec15('0x3e')]=_0x488707['attributes'][_0xec15('0x41')]?_0x488707[_0xec15('0x3e')]:_0x507b3b[_0xec15('0x3a')];if(!_0x14e698[_0xec15('0x3b')][_0xec15('0x42')](_0xec15('0x43'))){_0x488707[_0xec15('0x2d')]=qs[_0xec15('0x2d')](_0x14e698[_0xec15('0x3b')]['limit']);_0x488707[_0xec15('0x2c')]=qs[_0xec15('0x2c')](_0x14e698[_0xec15('0x3b')]['offset']);}_0x488707[_0xec15('0x44')]=qs['sort'](_0x14e698['query'][_0xec15('0x45')]);_0x488707['where']=qs[_0xec15('0x3d')](_['pick'](_0x14e698[_0xec15('0x3b')],_0x507b3b[_0xec15('0x3d')]),_0x3abbb6);if(_0x14e698['query']['filter']){_0x488707[_0xec15('0x46')]=_['merge'](_0x488707[_0xec15('0x46')],{'$or':_[_0xec15('0x35')](_0x3abbb6,function(_0xa88e41){if(_0xa88e41['type']!==_0xec15('0x47')){var _0x640dc3={};_0x640dc3[_0xa88e41[_0xec15('0x33')]]={'$like':'%'+_0x14e698[_0xec15('0x3b')][_0xec15('0x48')]+'%'};return _0x640dc3;}})});}_0x488707=_[_0xec15('0x49')]({},_0x488707,_0x14e698[_0xec15('0x4a')]);var _0x5c419c={'where':_0x488707[_0xec15('0x46')]};return db['VtigerAccount'][_0xec15('0x4b')](_0x5c419c)[_0xec15('0x1d')](function(_0x9ec3ed){_0x5dcbc2[_0xec15('0x4b')]=_0x9ec3ed;if(_0x14e698[_0xec15('0x3b')]['includeAll']){_0x488707['include']=[{'all':!![]}];}return db['VtigerAccount'][_0xec15('0x4c')](_0x488707);})[_0xec15('0x1d')](function(_0x5cfb27){_0x5dcbc2[_0xec15('0x4d')]=_0x5cfb27;return _0x5dcbc2;})[_0xec15('0x1d')](respondWithFilteredResult(_0x1c25a1,_0x488707))[_0xec15('0x28')](handleError(_0x1c25a1,null));};exports[_0xec15('0x4e')]=function(_0x2c1edc,_0x4b5868){var _0x29c809={'raw':![],'where':{'id':_0x2c1edc[_0xec15('0x4f')]['id']}},_0x147435={};_0x147435['model']=_[_0xec15('0x3c')](db['VtigerAccount'][_0xec15('0x50')]);_0x147435[_0xec15('0x3b')]=_[_0xec15('0x3c')](_0x2c1edc['query']);_0x147435[_0xec15('0x3d')]=_[_0xec15('0x3f')](_0x147435[_0xec15('0x3a')],_0x147435[_0xec15('0x3b')]);_0x29c809[_0xec15('0x3e')]=_[_0xec15('0x3f')](_0x147435[_0xec15('0x3a')],qs['fields'](_0x2c1edc[_0xec15('0x3b')]['fields']));_0x29c809[_0xec15('0x3e')]=_0x29c809[_0xec15('0x3e')]['length']?_0x29c809['attributes']:_0x147435[_0xec15('0x3a')];if(_0x2c1edc['query']['includeAll']){_0x29c809[_0xec15('0x51')]=[{'all':!![]}];}_0x29c809=_['merge']({},_0x29c809,_0x2c1edc['options']);return db[_0xec15('0x36')][_0xec15('0x52')](_0x29c809)[_0xec15('0x1d')](handleEntityNotFound(_0x4b5868,null))['then'](respondWithResult(_0x4b5868,null))['catch'](handleError(_0x4b5868,null));};exports[_0xec15('0x53')]=function(_0x50e377,_0x47331c){return db[_0xec15('0x36')][_0xec15('0x53')](_0x50e377['body'],{})[_0xec15('0x1d')](respondWithResult(_0x47331c,0xc9))['catch'](handleError(_0x47331c,null));};exports['update']=function(_0xb3c8e4,_0x2138c8){if(_0xb3c8e4[_0xec15('0x54')]['id']){delete _0xb3c8e4[_0xec15('0x54')]['id'];}return db[_0xec15('0x36')]['find']({'where':{'id':_0xb3c8e4[_0xec15('0x4f')]['id']}})[_0xec15('0x1d')](handleEntityNotFound(_0x2138c8,null))[_0xec15('0x1d')](saveUpdates(_0xb3c8e4[_0xec15('0x54')],null))[_0xec15('0x1d')](respondWithResult(_0x2138c8,null))[_0xec15('0x28')](handleError(_0x2138c8,null));};exports[_0xec15('0x32')]=function(_0xa5179c,_0x508324){return db[_0xec15('0x36')][_0xec15('0x52')]({'where':{'id':_0xa5179c[_0xec15('0x4f')]['id']}})[_0xec15('0x1d')](handleEntityNotFound(_0x508324,null))['then'](removeEntity(_0x508324,null))[_0xec15('0x28')](handleError(_0x508324,null));};exports['getConfigurations']=function(_0x451cb7,_0x3cd286,_0x86c704){var _0xc9758e={};var _0x11907f={};var _0x2ddb4c;var _0x5b6f8;return db[_0xec15('0x36')]['findOne']({'where':{'id':_0x451cb7['params']['id']}})['then'](handleEntityNotFound(_0x3cd286,null))['then'](function(_0x1c9f57){if(_0x1c9f57){_0x2ddb4c=_0x1c9f57;_0x11907f[_0xec15('0x3a')]=_['keys'](db[_0xec15('0x55')][_0xec15('0x50')]);_0x11907f[_0xec15('0x3b')]=_[_0xec15('0x3c')](_0x451cb7[_0xec15('0x3b')]);_0x11907f['filters']=_[_0xec15('0x3f')](_0x11907f[_0xec15('0x3a')],_0x11907f['query']);_0xc9758e[_0xec15('0x3e')]=_[_0xec15('0x3f')](_0x11907f[_0xec15('0x3a')],qs[_0xec15('0x40')](_0x451cb7[_0xec15('0x3b')][_0xec15('0x40')]));_0xc9758e['attributes']=_0xc9758e[_0xec15('0x3e')][_0xec15('0x41')]?_0xc9758e[_0xec15('0x3e')]:_0x11907f[_0xec15('0x3a')];_0xc9758e[_0xec15('0x44')]=qs['sort'](_0x451cb7[_0xec15('0x3b')][_0xec15('0x45')]);_0xc9758e['where']=qs[_0xec15('0x3d')](_[_0xec15('0x56')](_0x451cb7[_0xec15('0x3b')],_0x11907f[_0xec15('0x3d')]));if(_0x451cb7[_0xec15('0x3b')]['filter']){_0xc9758e[_0xec15('0x46')]=_[_0xec15('0x49')](_0xc9758e[_0xec15('0x46')],{'$or':_['map'](_0xc9758e[_0xec15('0x3e')],function(_0x46c9e5){var _0x406a81={};_0x406a81[_0x46c9e5]={'$like':'%'+_0x451cb7[_0xec15('0x3b')][_0xec15('0x48')]+'%'};return _0x406a81;})});}_0xc9758e=_[_0xec15('0x49')]({},_0xc9758e,_0x451cb7[_0xec15('0x4a')]);return _0x2ddb4c[_0xec15('0x57')](_0xc9758e);}})['then'](function(_0x2592b6){if(_0x2592b6){_0x5b6f8=_0x2592b6[_0xec15('0x41')];if(!_0x451cb7[_0xec15('0x3b')][_0xec15('0x42')](_0xec15('0x43'))){_0xc9758e['limit']=qs[_0xec15('0x2d')](_0x451cb7[_0xec15('0x3b')][_0xec15('0x2d')]);_0xc9758e['offset']=qs['offset'](_0x451cb7['query'][_0xec15('0x2c')]);}return _0x2ddb4c['getConfigurations'](_0xc9758e);}})[_0xec15('0x1d')](function(_0x5368f3){if(_0x5368f3){return _0x5368f3?{'count':_0x5b6f8,'rows':_0x5368f3}:null;}})[_0xec15('0x1d')](respondWithResult(_0x3cd286,null))[_0xec15('0x28')](handleError(_0x3cd286,null));};exports[_0xec15('0x58')]=function(_0x5a880e,_0x13a918,_0x5be6d6){if(_0x5a880e['body']['id']){delete _0x5a880e[_0xec15('0x54')]['id'];}return db['VtigerAccount'][_0xec15('0x59')]({'where':{'id':_0x5a880e[_0xec15('0x4f')]['id']}})[_0xec15('0x1d')](handleEntityNotFound(_0x13a918,null))[_0xec15('0x1d')](function(_0x21b577){if(_0x21b577){_0x5a880e[_0xec15('0x54')]['AccountId']=_0x21b577['id'];_0x5a880e[_0xec15('0x54')][_0xec15('0x5a')]=integrations[_0xec15('0x5b')](_0x5a880e[_0xec15('0x54')][_0xec15('0x5c')],_0x5a880e[_0xec15('0x54')][_0xec15('0x38')]);_0x5a880e['body']['Descriptions']=integrations[_0xec15('0x5d')](_0x5a880e['body'][_0xec15('0x5c')],_0x5a880e[_0xec15('0x54')][_0xec15('0x38')]);return db['VtigerConfiguration'][_0xec15('0x53')](_0x5a880e[_0xec15('0x54')],{'include':[{'model':db[_0xec15('0x5e')],'as':'Subjects'},{'model':db[_0xec15('0x5e')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x13a918,null))[_0xec15('0x28')](handleError(_0x13a918,null));};var md5=require(_0xec15('0x5f'));exports[_0xec15('0x60')]=function(_0x4a2ba8,_0x7c48d0,_0xc7a3f9){var _0x923441=null;var _0x2d8c33=null;var _0x2c284f=null;var _0x3ce3a6=null;var _0x8dd40e='';return db[_0xec15('0x36')][_0xec15('0x59')]({'where':{'id':_0x4a2ba8[_0xec15('0x4f')]['id']},'attributes':['id',_0xec15('0x33'),_0xec15('0x61'),_0xec15('0x62'),_0xec15('0x63'),_0xec15('0x64'),_0xec15('0x65'),_0xec15('0x66')]})[_0xec15('0x1d')](handleEntityNotFound(_0x7c48d0,null))[_0xec15('0x1d')](function(_0xbf38dc){if(_0xbf38dc){_0x923441=_0xbf38dc[_0xec15('0x61')];_0x2d8c33=_0xbf38dc['accessKey'];_0x2c284f=_0xbf38dc[_0xec15('0x63')];_0x8dd40e=_0xbf38dc[_0xec15('0x64')];var _0x38a27c=_0x8dd40e[_0xec15('0x67')](-0x1);if(_0x38a27c==='/'){_0x8dd40e=_0x8dd40e[_0xec15('0x68')](0x0,_0x8dd40e[_0xec15('0x69')](_0x38a27c));}_0x3ce3a6=util[_0xec15('0x6a')](_0xec15('0x6b'),_0x8dd40e);var _0x36166e={'method':_0xec15('0x6c'),'uri':_0x3ce3a6,'qs':{'operation':'getchallenge','username':_0xbf38dc[_0xec15('0x61')]},'json':!![]};return rp(_0x36166e);}})['then'](function(_0x4f4ca9){if(_0x4f4ca9['success']){var _0x324c63={'method':'POST','uri':_0x3ce3a6,'form':{'operation':'login','username':_0x923441,'accessKey':md5(_0x4f4ca9[_0xec15('0x27')][_0xec15('0x6d')]+_0x2d8c33)},'json':!![]};return rp(_0x324c63);}})[_0xec15('0x1d')](function(_0x1c7776){if(_0x1c7776[_0xec15('0x6e')]){var _0x34040c={'method':_0xec15('0x6c'),'uri':_0x3ce3a6,'qs':{'operation':_0xec15('0x6f'),'username':_0x923441,'sessionName':_0x1c7776[_0xec15('0x27')][_0xec15('0x70')],'elementType':_0x2c284f},'json':!![]};return rp(_0x34040c);}})[_0xec15('0x1d')](function(_0x3e29a9){if(_0x3e29a9[_0xec15('0x6e')]){var _0x40c3a0=[_0xec15('0x71'),_0xec15('0x72'),_0xec15('0x73')];_['remove'](_0x3e29a9[_0xec15('0x27')]['fields'],function(_0x2ab00b){return _0x40c3a0['includes'](_0x2ab00b[_0xec15('0x38')][_0xec15('0x33')]);});_[_0xec15('0x74')](_0x3e29a9['result']['fields'],function(_0x1c59d2){return _0x1c59d2[_0xec15('0x75')]==='false';});return{'count':_0x3e29a9[_0xec15('0x27')][_0xec15('0x40')][_0xec15('0x41')],'rows':_[_0xec15('0x35')](_0x3e29a9[_0xec15('0x27')][_0xec15('0x40')],function(_0x16ab91){return{'id':_0x16ab91['name'],'name':_0x16ab91['label'],'custom':_[_0xec15('0x76')](_0x16ab91[_0xec15('0x33')],'cf_')?!![]:![],'options':_0x16ab91[_0xec15('0x38')]['name']===_0xec15('0x77')&&_0x16ab91['type'][_0xec15('0x78')][_0xec15('0x41')]>0x0?_[_0xec15('0x35')](_0x16ab91['type'][_0xec15('0x78')],function(_0x5e1f3a){return{'name':_0x5e1f3a[_0xec15('0x79')],'value':_0x5e1f3a[_0xec15('0x7a')]};}):[]};})};}})['then'](respondWithResult(_0x7c48d0,null))[_0xec15('0x28')](function(_0x583cc7){console[_0xec15('0x7b')](_0xec15('0x7c')+_0x583cc7);var _0x436eca=_0x4a2ba8[_0xec15('0x3b')][_0xec15('0x7d')]?0x1f4:_0x583cc7[_0xec15('0x7e')]||0x1f4;logger[_0xec15('0x23')](_0xec15('0x7f'),'getFields',_0x436eca,JSON[_0xec15('0x22')](_0x583cc7));delete _0x583cc7[_0xec15('0x33')];if(_0x436eca===0x191){_0x436eca=0x190;}_0x7c48d0[_0xec15('0x29')](_0x436eca)[_0xec15('0x80')](_0x4a2ba8['query']['test']?{'message':_0xec15('0x81'),'statusCode':_0x583cc7['statusCode']}:_0x583cc7);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 4df7659..ac402a3 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 _0xb34a=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','int_vtiger_accounts'];(function(_0x378891,_0x4e3e16){var _0xfbfda2=function(_0x3b7681){while(--_0x3b7681){_0x378891['push'](_0x378891['shift']());}};_0xfbfda2(++_0x4e3e16);}(_0xb34a,0x15c));var _0xab34=function(_0x16b4f1,_0x4ec215){_0x16b4f1=_0x16b4f1-0x0;var _0x9fc68e=_0xb34a[_0x16b4f1];return _0x9fc68e;};'use strict';var _=require('lodash');var util=require(_0xab34('0x0'));var logger=require(_0xab34('0x1'))(_0xab34('0x2'));var moment=require(_0xab34('0x3'));var BPromise=require(_0xab34('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab34('0x5'));var rimraf=require('rimraf');var config=require(_0xab34('0x6'));var attributes=require(_0xab34('0x7'));var integrations=require(_0xab34('0x8'));module[_0xab34('0x9')]=function(_0x298582,_0x478e70){return _0x298582[_0xab34('0xa')]('VtigerAccount',attributes,{'tableName':_0xab34('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6e4=['api','moment','path','rimraf','../../config/environment','./intVtigerAccount.attributes','exports','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger'];(function(_0x1a1a3b,_0xc8ce3c){var _0x57bd21=function(_0x15a067){while(--_0x15a067){_0x1a1a3b['push'](_0x1a1a3b['shift']());}};_0x57bd21(++_0xc8ce3c);}(_0xc6e4,0x8e));var _0x4c6e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc6e4[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4c6e('0x0'));var util=require('util');var logger=require(_0x4c6e('0x1'))(_0x4c6e('0x2'));var moment=require(_0x4c6e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c6e('0x4'));var rimraf=require(_0x4c6e('0x5'));var config=require(_0x4c6e('0x6'));var attributes=require(_0x4c6e('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x4c6e('0x8')]=function(_0x485188,_0x3ae16a){return _0x485188[_0x4c6e('0x9')](_0x4c6e('0xa'),attributes,{'tableName':_0x4c6e('0xb'),'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 3a8096b..a8a9964 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 _0xf6b8=['info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','VtigerAccount','findAll','options','raw','attributes','limit','include','map','model','then','GetVtigerAccount','ShowVtigerAccount','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x5af004,_0x4b15ff){var _0x4f2080=function(_0x3f423f){while(--_0x3f423f){_0x5af004['push'](_0x5af004['shift']());}};_0x4f2080(++_0x4b15ff);}(_0xf6b8,0x140));var _0x8f6b=function(_0x3968c9,_0x346c1b){_0x3968c9=_0x3968c9-0x0;var _0x790570=_0xf6b8[_0x3968c9];return _0x790570;};'use strict';var _=require(_0x8f6b('0x0'));var util=require(_0x8f6b('0x1'));var moment=require(_0x8f6b('0x2'));var BPromise=require(_0x8f6b('0x3'));var rs=require(_0x8f6b('0x4'));var fs=require('fs');var Redis=require(_0x8f6b('0x5'));var db=require(_0x8f6b('0x6'))['db'];var utils=require(_0x8f6b('0x7'));var logger=require(_0x8f6b('0x8'))('rpc');var config=require(_0x8f6b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8f6b('0xa')][_0x8f6b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc88740,_0xa9ef7f,_0x6a225f){return new BPromise(function(_0x56d635,_0x451a92){return client[_0x8f6b('0xc')](_0xc88740,_0x6a225f)['then'](function(_0x5d32ab){logger[_0x8f6b('0xd')](_0x8f6b('0xe'),_0xa9ef7f,'request\x20sent');logger[_0x8f6b('0xf')](_0x8f6b('0x10'),_0xa9ef7f,_0x8f6b('0x11'),JSON['stringify'](_0x5d32ab));if(_0x5d32ab[_0x8f6b('0x12')]){if(_0x5d32ab['error'][_0x8f6b('0x13')]===0x1f4){logger[_0x8f6b('0x12')]('VtigerAccount,\x20%s,\x20%s',_0xa9ef7f,_0x5d32ab[_0x8f6b('0x12')]['message']);return _0x451a92(_0x5d32ab[_0x8f6b('0x12')][_0x8f6b('0x14')]);}logger[_0x8f6b('0x12')](_0x8f6b('0xe'),_0xa9ef7f,_0x5d32ab['error'][_0x8f6b('0x14')]);return _0x56d635(_0x5d32ab['error'][_0x8f6b('0x14')]);}else{logger[_0x8f6b('0xd')](_0x8f6b('0xe'),_0xa9ef7f,_0x8f6b('0x11'));_0x56d635(_0x5d32ab[_0x8f6b('0x15')]['message']);}})[_0x8f6b('0x16')](function(_0x22a9a0){logger[_0x8f6b('0x12')](_0x8f6b('0xe'),_0xa9ef7f,_0x22a9a0);_0x451a92(_0x22a9a0);});});}exports['GetVtigerAccount']=function(_0x556299){var _0x17dc2d=this;return new Promise(function(_0x4ca28a,_0x482ae2){return db[_0x8f6b('0x17')][_0x8f6b('0x18')]({'raw':_0x556299[_0x8f6b('0x19')]?_0x556299[_0x8f6b('0x19')][_0x8f6b('0x1a')]===undefined?!![]:![]:!![],'where':_0x556299[_0x8f6b('0x19')]?_0x556299[_0x8f6b('0x19')]['where']||null:null,'attributes':_0x556299[_0x8f6b('0x19')]?_0x556299[_0x8f6b('0x19')][_0x8f6b('0x1b')]||null:null,'limit':_0x556299[_0x8f6b('0x19')]?_0x556299['options'][_0x8f6b('0x1c')]||null:null,'include':_0x556299[_0x8f6b('0x19')]?_0x556299[_0x8f6b('0x19')][_0x8f6b('0x1d')]?_[_0x8f6b('0x1e')](_0x556299[_0x8f6b('0x19')][_0x8f6b('0x1d')],function(_0x5d1351){return{'model':db[_0x5d1351['model']],'as':_0x5d1351['as'],'attributes':_0x5d1351['attributes'],'include':_0x5d1351[_0x8f6b('0x1d')]?_['map'](_0x5d1351[_0x8f6b('0x1d')],function(_0x26013b){return{'model':db[_0x26013b[_0x8f6b('0x1f')]],'as':_0x26013b['as'],'attributes':_0x26013b[_0x8f6b('0x1b')],'include':_0x26013b['include']?_['map'](_0x26013b[_0x8f6b('0x1d')],function(_0x3cd6eb){return{'model':db[_0x3cd6eb['model']],'as':_0x3cd6eb['as'],'attributes':_0x3cd6eb[_0x8f6b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8f6b('0x20')](function(_0x182ddd){logger[_0x8f6b('0xd')]('GetVtigerAccount',_0x556299);logger[_0x8f6b('0xf')]('GetVtigerAccount',_0x556299,JSON['stringify'](_0x182ddd));_0x4ca28a(_0x182ddd);})['catch'](function(_0x42092a){logger[_0x8f6b('0x12')](_0x8f6b('0x21'),_0x42092a[_0x8f6b('0x14')],_0x556299);_0x482ae2(_0x17dc2d[_0x8f6b('0x12')](0x1f4,_0x42092a[_0x8f6b('0x14')]));});});};exports[_0x8f6b('0x22')]=function(_0x58f2b0){var _0xb24b6e=this;return new Promise(function(_0x172b8a,_0x580bbe){return db[_0x8f6b('0x17')][_0x8f6b('0x23')]({'raw':_0x58f2b0[_0x8f6b('0x19')]?_0x58f2b0[_0x8f6b('0x19')][_0x8f6b('0x1a')]===undefined?!![]:![]:!![],'where':_0x58f2b0[_0x8f6b('0x19')]?_0x58f2b0[_0x8f6b('0x19')]['where']||null:null,'attributes':_0x58f2b0[_0x8f6b('0x19')]?_0x58f2b0[_0x8f6b('0x19')][_0x8f6b('0x1b')]||null:null,'include':_0x58f2b0['options']?_0x58f2b0['options'][_0x8f6b('0x1d')]?_[_0x8f6b('0x1e')](_0x58f2b0[_0x8f6b('0x19')][_0x8f6b('0x1d')],function(_0x436b68){return{'model':db[_0x436b68[_0x8f6b('0x1f')]],'as':_0x436b68['as'],'attributes':_0x436b68[_0x8f6b('0x1b')],'include':_0x436b68[_0x8f6b('0x1d')]?_[_0x8f6b('0x1e')](_0x436b68[_0x8f6b('0x1d')],function(_0x3c555b){return{'model':db[_0x3c555b[_0x8f6b('0x1f')]],'as':_0x3c555b['as'],'attributes':_0x3c555b[_0x8f6b('0x1b')],'include':_0x3c555b[_0x8f6b('0x1d')]?_['map'](_0x3c555b[_0x8f6b('0x1d')],function(_0x4d34d9){return{'model':db[_0x4d34d9[_0x8f6b('0x1f')]],'as':_0x4d34d9['as'],'attributes':_0x4d34d9[_0x8f6b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8f6b('0x20')](function(_0x3fd10e){logger[_0x8f6b('0xd')](_0x8f6b('0x22'),_0x58f2b0);logger[_0x8f6b('0xf')](_0x8f6b('0x22'),_0x58f2b0,JSON[_0x8f6b('0x24')](_0x3fd10e));_0x172b8a(_0x3fd10e);})[_0x8f6b('0x16')](function(_0x1caba8){logger[_0x8f6b('0x12')](_0x8f6b('0x22'),_0x1caba8[_0x8f6b('0x14')],_0x58f2b0);_0x580bbe(_0xb24b6e['error'](0x1f4,_0x1caba8[_0x8f6b('0x14')]));});});}; \ No newline at end of file +var _0xb2f7=['catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','findAll','options','raw','attributes','include','model','GetVtigerAccount','VtigerAccount','where','info','ShowVtigerAccount'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb2f7,0xa6));var _0x7b2f=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xb2f7[_0x12d033];return _0x3b4e80;};'use strict';var _=require('lodash');var util=require(_0x7b2f('0x0'));var moment=require(_0x7b2f('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b2f('0x2'));var fs=require('fs');var Redis=require(_0x7b2f('0x3'));var db=require(_0x7b2f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b2f('0x5'))('rpc');var config=require(_0x7b2f('0x6'));var jayson=require(_0x7b2f('0x7'));var client=jayson[_0x7b2f('0x8')][_0x7b2f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ebd4a,_0x287cf4,_0x18824e){return new BPromise(function(_0x58212a,_0x47caa0){return client[_0x7b2f('0xa')](_0x3ebd4a,_0x18824e)[_0x7b2f('0xb')](function(_0x5b41ff){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x287cf4,_0x7b2f('0xc'));logger[_0x7b2f('0xd')](_0x7b2f('0xe'),_0x287cf4,_0x7b2f('0xc'),JSON[_0x7b2f('0xf')](_0x5b41ff));if(_0x5b41ff[_0x7b2f('0x10')]){if(_0x5b41ff[_0x7b2f('0x10')][_0x7b2f('0x11')]===0x1f4){logger[_0x7b2f('0x10')](_0x7b2f('0x12'),_0x287cf4,_0x5b41ff[_0x7b2f('0x10')][_0x7b2f('0x13')]);return _0x47caa0(_0x5b41ff['error'][_0x7b2f('0x13')]);}logger[_0x7b2f('0x10')](_0x7b2f('0x12'),_0x287cf4,_0x5b41ff[_0x7b2f('0x10')][_0x7b2f('0x13')]);return _0x58212a(_0x5b41ff[_0x7b2f('0x10')][_0x7b2f('0x13')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x287cf4,_0x7b2f('0xc'));_0x58212a(_0x5b41ff[_0x7b2f('0x14')]['message']);}})['catch'](function(_0x2b98f8){logger[_0x7b2f('0x10')](_0x7b2f('0x12'),_0x287cf4,_0x2b98f8);_0x47caa0(_0x2b98f8);});});}exports['GetVtigerAccount']=function(_0x25e43d){var _0x2ff0b9=this;return new Promise(function(_0x4f381a,_0x11d948){return db['VtigerAccount'][_0x7b2f('0x15')]({'raw':_0x25e43d[_0x7b2f('0x16')]?_0x25e43d[_0x7b2f('0x16')][_0x7b2f('0x17')]===undefined?!![]:![]:!![],'where':_0x25e43d[_0x7b2f('0x16')]?_0x25e43d[_0x7b2f('0x16')]['where']||null:null,'attributes':_0x25e43d['options']?_0x25e43d[_0x7b2f('0x16')][_0x7b2f('0x18')]||null:null,'limit':_0x25e43d[_0x7b2f('0x16')]?_0x25e43d[_0x7b2f('0x16')]['limit']||null:null,'include':_0x25e43d[_0x7b2f('0x16')]?_0x25e43d[_0x7b2f('0x16')][_0x7b2f('0x19')]?_['map'](_0x25e43d[_0x7b2f('0x16')][_0x7b2f('0x19')],function(_0x38036d){return{'model':db[_0x38036d[_0x7b2f('0x1a')]],'as':_0x38036d['as'],'attributes':_0x38036d[_0x7b2f('0x18')],'include':_0x38036d[_0x7b2f('0x19')]?_['map'](_0x38036d[_0x7b2f('0x19')],function(_0x48b03b){return{'model':db[_0x48b03b[_0x7b2f('0x1a')]],'as':_0x48b03b['as'],'attributes':_0x48b03b[_0x7b2f('0x18')],'include':_0x48b03b[_0x7b2f('0x19')]?_['map'](_0x48b03b['include'],function(_0x2df735){return{'model':db[_0x2df735[_0x7b2f('0x1a')]],'as':_0x2df735['as'],'attributes':_0x2df735[_0x7b2f('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7b2f('0xb')](function(_0x33413e){logger['info'](_0x7b2f('0x1b'),_0x25e43d);logger['debug']('GetVtigerAccount',_0x25e43d,JSON[_0x7b2f('0xf')](_0x33413e));_0x4f381a(_0x33413e);})['catch'](function(_0x3d26ef){logger[_0x7b2f('0x10')](_0x7b2f('0x1b'),_0x3d26ef[_0x7b2f('0x13')],_0x25e43d);_0x11d948(_0x2ff0b9[_0x7b2f('0x10')](0x1f4,_0x3d26ef['message']));});});};exports['ShowVtigerAccount']=function(_0x31acc9){var _0x70a618=this;return new Promise(function(_0x528c89,_0x3afb01){return db[_0x7b2f('0x1c')]['find']({'raw':_0x31acc9[_0x7b2f('0x16')]?_0x31acc9[_0x7b2f('0x16')][_0x7b2f('0x17')]===undefined?!![]:![]:!![],'where':_0x31acc9[_0x7b2f('0x16')]?_0x31acc9[_0x7b2f('0x16')][_0x7b2f('0x1d')]||null:null,'attributes':_0x31acc9[_0x7b2f('0x16')]?_0x31acc9['options']['attributes']||null:null,'include':_0x31acc9['options']?_0x31acc9[_0x7b2f('0x16')][_0x7b2f('0x19')]?_['map'](_0x31acc9[_0x7b2f('0x16')][_0x7b2f('0x19')],function(_0x555843){return{'model':db[_0x555843[_0x7b2f('0x1a')]],'as':_0x555843['as'],'attributes':_0x555843[_0x7b2f('0x18')],'include':_0x555843[_0x7b2f('0x19')]?_['map'](_0x555843['include'],function(_0xdae049){return{'model':db[_0xdae049[_0x7b2f('0x1a')]],'as':_0xdae049['as'],'attributes':_0xdae049[_0x7b2f('0x18')],'include':_0xdae049['include']?_['map'](_0xdae049[_0x7b2f('0x19')],function(_0x735049){return{'model':db[_0x735049[_0x7b2f('0x1a')]],'as':_0x735049['as'],'attributes':_0x735049[_0x7b2f('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5382c0){logger[_0x7b2f('0x1e')]('ShowVtigerAccount',_0x31acc9);logger[_0x7b2f('0xd')](_0x7b2f('0x1f'),_0x31acc9,JSON[_0x7b2f('0xf')](_0x5382c0));_0x528c89(_0x5382c0);})[_0x7b2f('0x20')](function(_0x87c5fc){logger['error'](_0x7b2f('0x1f'),_0x87c5fc[_0x7b2f('0x13')],_0x31acc9);_0x3afb01(_0x70a618[_0x7b2f('0x10')](0x1f4,_0x87c5fc[_0x7b2f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 1522e71..46459b6 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 _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x4948a6,_0x404241){var _0xd9a65=function(_0x50a628){while(--_0x50a628){_0x4948a6['push'](_0x4948a6['shift']());}};_0xd9a65(++_0x404241);}(_0xb10b,0x12a));var _0xbb10=function(_0x206a3c,_0x2c2f57){_0x206a3c=_0x206a3c-0x0;var _0x3e0f8d=_0xb10b[_0x206a3c];return _0x3e0f8d;};'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 auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file +var _0xd8b0=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','show'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_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 auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index dde84d9..25e926b 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 _0xf690=['sequelize','STRING'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xf690,0x118));var _0x0f69=function(_0x460666,_0x24bfa0){_0x460666=_0x460666-0x0;var _0x555cbf=_0xf690[_0x460666];return _0x555cbf;};'use strict';var Sequelize=require(_0x0f69('0x0'));module['exports']={'name':{'type':Sequelize[_0x0f69('0x1')]},'description':{'type':Sequelize[_0x0f69('0x1')]}}; \ No newline at end of file +var _0x163a=['sequelize','exports','STRING'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0x163a,0xd2));var _0xa163=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0x163a[_0x1f99a0];return _0x1e0849;};'use strict';var Sequelize=require(_0xa163('0x0'));module[_0xa163('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa163('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index b189846..e7ea767 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 _0xcee7=['sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','order','where','pick','filter','type','VIRTUAL','merge','includeAll','include','rows','catch','params','options','find','create','body','getFields','findOne','VtigerField','sort','hasOwnProperty','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path'];(function(_0x4fc3fc,_0x221ad7){var _0x4c6214=function(_0x567dbc){while(--_0x567dbc){_0x4fc3fc['push'](_0x4fc3fc['shift']());}};_0x4c6214(++_0x221ad7);}(_0xcee7,0x160));var _0x7cee=function(_0x3894fa,_0x134157){_0x3894fa=_0x3894fa-0x0;var _0x3962b2=_0xcee7[_0x3894fa];return _0x3962b2;};'use strict';var pdf=require(_0x7cee('0x0'));var emlformat=require(_0x7cee('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7cee('0x2'));var moment=require(_0x7cee('0x3'));var BPromise=require(_0x7cee('0x4'));var Mustache=require(_0x7cee('0x5'));var util=require(_0x7cee('0x6'));var path=require(_0x7cee('0x7'));var sox=require(_0x7cee('0x8'));var csv=require(_0x7cee('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7cee('0xa'));var crypto=require(_0x7cee('0xb'));var jsforce=require(_0x7cee('0xc'));var deskjs=require(_0x7cee('0xd'));var toCsv=require(_0x7cee('0x9'));var querystring=require(_0x7cee('0xe'));var Papa=require('papaparse');var Redis=require(_0x7cee('0xf'));var authService=require(_0x7cee('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7cee('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cee('0x12'))(_0x7cee('0x13'));var utils=require(_0x7cee('0x14'));var config=require(_0x7cee('0x15'));var licenseUtil=require(_0x7cee('0x16'));var db=require(_0x7cee('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x7cee('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13311d,_0x4f7a22,_0x1373ea,_0x4720ff){return new BPromise(function(_0x21b119,_0x27e6e9){var _0x378e9b=_0x4720ff||client;return _0x378e9b[_0x7cee('0x19')](_0x13311d,_0x1373ea)['then'](function(_0xd20400){logger['info'](_0x7cee('0x1a'),_0x4f7a22,_0x7cee('0x1b'));logger[_0x7cee('0x1c')](_0x7cee('0x1d'),_0x4f7a22,_0x7cee('0x1b'),JSON['stringify'](_0xd20400));if(_0xd20400[_0x7cee('0x1e')]){if(_0xd20400[_0x7cee('0x1e')][_0x7cee('0x1f')]===0x1f4){logger['error'](_0x7cee('0x1a'),_0x4f7a22,_0xd20400['error'][_0x7cee('0x20')]);return _0x27e6e9(_0xd20400[_0x7cee('0x1e')][_0x7cee('0x20')]);}logger[_0x7cee('0x1e')](_0x7cee('0x1a'),_0x4f7a22,_0xd20400[_0x7cee('0x1e')][_0x7cee('0x20')]);return _0x21b119(_0xd20400[_0x7cee('0x1e')][_0x7cee('0x20')]);}else{logger['info'](_0x7cee('0x1a'),_0x4f7a22,_0x7cee('0x1b'));_0x21b119(_0xd20400[_0x7cee('0x21')][_0x7cee('0x20')]);}})['catch'](function(_0x270f18){logger['error'](_0x7cee('0x1a'),_0x4f7a22,_0x270f18);_0x27e6e9(_0x270f18);});});}function respondWithStatusCode(_0x298a3e,_0xf7d150){_0xf7d150=_0xf7d150||0xcc;return function(_0x53db09){if(_0x53db09){return _0x298a3e[_0x7cee('0x22')](_0xf7d150);}return _0x298a3e[_0x7cee('0x23')](_0xf7d150)['end']();};}function respondWithResult(_0x594296,_0x5244c1){_0x5244c1=_0x5244c1||0xc8;return function(_0x427eda){if(_0x427eda){return _0x594296[_0x7cee('0x23')](_0x5244c1)[_0x7cee('0x24')](_0x427eda);}};}function respondWithFilteredResult(_0x1e1228,_0x123785){return function(_0x168842){if(_0x168842){var _0x51efdb=_0x168842[_0x7cee('0x25')],_0x24098a=_0x123785[_0x7cee('0x26')],_0xd23745=_0x123785['offset']+_0x123785[_0x7cee('0x27')],_0x4f165e;if(_0xd23745>=_0x51efdb){_0xd23745=_0x51efdb;_0x4f165e=0xc8;}else{_0x4f165e=0xce;}_0x1e1228[_0x7cee('0x23')](_0x4f165e);return _0x1e1228[_0x7cee('0x28')](_0x7cee('0x29'),_0x24098a+'-'+_0xd23745+'/'+_0x51efdb)[_0x7cee('0x24')](_0x168842);}return null;};}function patchUpdates(_0x56051b){return function(_0x5b692a){try{jsonpatch[_0x7cee('0x2a')](_0x5b692a,_0x56051b,!![]);}catch(_0x396034){return BPromise[_0x7cee('0x2b')](_0x396034);}return _0x5b692a[_0x7cee('0x2c')]();};}function saveUpdates(_0x1755a7,_0x3d7271){return function(_0x26f05c){if(_0x26f05c){return _0x26f05c[_0x7cee('0x2d')](_0x1755a7)[_0x7cee('0x2e')](function(_0x13ace9){return _0x13ace9;});}return null;};}function removeEntity(_0x466c3d,_0x1d81bb){return function(_0x445c2e){if(_0x445c2e){return _0x445c2e[_0x7cee('0x2f')]()[_0x7cee('0x2e')](function(){_0x466c3d[_0x7cee('0x23')](0xcc)[_0x7cee('0x30')]();});}};}function handleEntityNotFound(_0x2f3fd1,_0x365a72){return function(_0x26cd7e){if(!_0x26cd7e){_0x2f3fd1[_0x7cee('0x22')](0x194);}return _0x26cd7e;};}function handleError(_0x4f1713,_0x4e0e47){_0x4e0e47=_0x4e0e47||0x1f4;return function(_0x344f51){logger[_0x7cee('0x1e')](_0x344f51[_0x7cee('0x31')]);if(_0x344f51['name']){delete _0x344f51[_0x7cee('0x32')];}_0x4f1713[_0x7cee('0x23')](_0x4e0e47)[_0x7cee('0x33')](_0x344f51);};}exports[_0x7cee('0x34')]=function(_0x8cbb3,_0xa36568){var _0x185869={},_0xd9fd74={},_0x4b3bc6={'count':0x0,'rows':[]};var _0x2629b1=_[_0x7cee('0x35')](db[_0x7cee('0x36')][_0x7cee('0x37')],function(_0x9d1ed1){return{'name':_0x9d1ed1[_0x7cee('0x38')],'type':_0x9d1ed1['type'][_0x7cee('0x39')]};});_0xd9fd74['model']=_[_0x7cee('0x35')](_0x2629b1,_0x7cee('0x32'));_0xd9fd74['query']=_[_0x7cee('0x3a')](_0x8cbb3[_0x7cee('0x3b')]);_0xd9fd74[_0x7cee('0x3c')]=_[_0x7cee('0x3d')](_0xd9fd74[_0x7cee('0x3e')],_0xd9fd74['query']);_0x185869[_0x7cee('0x3f')]=_[_0x7cee('0x3d')](_0xd9fd74[_0x7cee('0x3e')],qs[_0x7cee('0x40')](_0x8cbb3[_0x7cee('0x3b')][_0x7cee('0x40')]));_0x185869[_0x7cee('0x3f')]=_0x185869[_0x7cee('0x3f')][_0x7cee('0x41')]?_0x185869['attributes']:_0xd9fd74[_0x7cee('0x3e')];if(!_0x8cbb3['query']['hasOwnProperty']('nolimit')){_0x185869[_0x7cee('0x27')]=qs[_0x7cee('0x27')](_0x8cbb3[_0x7cee('0x3b')]['limit']);_0x185869[_0x7cee('0x26')]=qs[_0x7cee('0x26')](_0x8cbb3[_0x7cee('0x3b')][_0x7cee('0x26')]);}_0x185869[_0x7cee('0x42')]=qs['sort'](_0x8cbb3[_0x7cee('0x3b')]['sort']);_0x185869[_0x7cee('0x43')]=qs['filters'](_[_0x7cee('0x44')](_0x8cbb3['query'],_0xd9fd74['filters']),_0x2629b1);if(_0x8cbb3[_0x7cee('0x3b')][_0x7cee('0x45')]){_0x185869[_0x7cee('0x43')]=_['merge'](_0x185869['where'],{'$or':_[_0x7cee('0x35')](_0x2629b1,function(_0x22c274){if(_0x22c274[_0x7cee('0x46')]!==_0x7cee('0x47')){var _0x5bc736={};_0x5bc736[_0x22c274['name']]={'$like':'%'+_0x8cbb3[_0x7cee('0x3b')][_0x7cee('0x45')]+'%'};return _0x5bc736;}})});}_0x185869=_[_0x7cee('0x48')]({},_0x185869,_0x8cbb3['options']);var _0x592463={'where':_0x185869[_0x7cee('0x43')]};return db['VtigerConfiguration'][_0x7cee('0x25')](_0x592463)[_0x7cee('0x2e')](function(_0x4e24c5){_0x4b3bc6[_0x7cee('0x25')]=_0x4e24c5;if(_0x8cbb3[_0x7cee('0x3b')][_0x7cee('0x49')]){_0x185869[_0x7cee('0x4a')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x185869);})['then'](function(_0x1eb75f){_0x4b3bc6[_0x7cee('0x4b')]=_0x1eb75f;return _0x4b3bc6;})[_0x7cee('0x2e')](respondWithFilteredResult(_0xa36568,_0x185869))[_0x7cee('0x4c')](handleError(_0xa36568,null));};exports['show']=function(_0x4cbfca,_0x3dba89){var _0x544a61={'raw':![],'where':{'id':_0x4cbfca[_0x7cee('0x4d')]['id']}},_0x4e954b={};_0x4e954b[_0x7cee('0x3e')]=_[_0x7cee('0x3a')](db[_0x7cee('0x36')][_0x7cee('0x37')]);_0x4e954b['query']=_['keys'](_0x4cbfca[_0x7cee('0x3b')]);_0x4e954b[_0x7cee('0x3c')]=_[_0x7cee('0x3d')](_0x4e954b[_0x7cee('0x3e')],_0x4e954b[_0x7cee('0x3b')]);_0x544a61[_0x7cee('0x3f')]=_[_0x7cee('0x3d')](_0x4e954b[_0x7cee('0x3e')],qs[_0x7cee('0x40')](_0x4cbfca[_0x7cee('0x3b')][_0x7cee('0x40')]));_0x544a61[_0x7cee('0x3f')]=_0x544a61['attributes'][_0x7cee('0x41')]?_0x544a61['attributes']:_0x4e954b['model'];if(_0x4cbfca[_0x7cee('0x3b')][_0x7cee('0x49')]){_0x544a61[_0x7cee('0x4a')]=[{'all':!![]}];}_0x544a61=_['merge']({},_0x544a61,_0x4cbfca[_0x7cee('0x4e')]);return db[_0x7cee('0x36')][_0x7cee('0x4f')](_0x544a61)[_0x7cee('0x2e')](handleEntityNotFound(_0x3dba89,null))[_0x7cee('0x2e')](respondWithResult(_0x3dba89,null))['catch'](handleError(_0x3dba89,null));};exports[_0x7cee('0x50')]=function(_0x1adb96,_0x17aebc){return db[_0x7cee('0x36')]['create'](_0x1adb96[_0x7cee('0x51')],{})[_0x7cee('0x2e')](respondWithResult(_0x17aebc,0xc9))[_0x7cee('0x4c')](handleError(_0x17aebc,null));};exports['update']=function(_0x483bd7,_0x375904){if(_0x483bd7[_0x7cee('0x51')]['id']){delete _0x483bd7['body']['id'];}return db[_0x7cee('0x36')][_0x7cee('0x4f')]({'where':{'id':_0x483bd7[_0x7cee('0x4d')]['id']}})[_0x7cee('0x2e')](handleEntityNotFound(_0x375904,null))['then'](saveUpdates(_0x483bd7[_0x7cee('0x51')],null))['then'](respondWithResult(_0x375904,null))[_0x7cee('0x4c')](handleError(_0x375904,null));};exports['destroy']=function(_0x311d09,_0x361023){return db[_0x7cee('0x36')]['find']({'where':{'id':_0x311d09['params']['id']}})[_0x7cee('0x2e')](handleEntityNotFound(_0x361023,null))[_0x7cee('0x2e')](removeEntity(_0x361023,null))['catch'](handleError(_0x361023,null));};exports[_0x7cee('0x52')]=function(_0x4c5fd6,_0x1c4729,_0x559cd9){var _0x66e1bc={};var _0x57c23b={};var _0x30a172;var _0x176b4d;return db[_0x7cee('0x36')][_0x7cee('0x53')]({'where':{'id':_0x4c5fd6[_0x7cee('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1c4729,null))[_0x7cee('0x2e')](function(_0x1a9f15){if(_0x1a9f15){_0x30a172=_0x1a9f15;_0x57c23b[_0x7cee('0x3e')]=_['keys'](db[_0x7cee('0x54')][_0x7cee('0x37')]);_0x57c23b[_0x7cee('0x3b')]=_['keys'](_0x4c5fd6[_0x7cee('0x3b')]);_0x57c23b[_0x7cee('0x3c')]=_[_0x7cee('0x3d')](_0x57c23b['model'],_0x57c23b[_0x7cee('0x3b')]);_0x66e1bc[_0x7cee('0x3f')]=_['intersection'](_0x57c23b[_0x7cee('0x3e')],qs[_0x7cee('0x40')](_0x4c5fd6[_0x7cee('0x3b')][_0x7cee('0x40')]));_0x66e1bc[_0x7cee('0x3f')]=_0x66e1bc[_0x7cee('0x3f')]['length']?_0x66e1bc[_0x7cee('0x3f')]:_0x57c23b['model'];_0x66e1bc[_0x7cee('0x42')]=qs['sort'](_0x4c5fd6[_0x7cee('0x3b')][_0x7cee('0x55')]);_0x66e1bc[_0x7cee('0x43')]=qs[_0x7cee('0x3c')](_['pick'](_0x4c5fd6[_0x7cee('0x3b')],_0x57c23b['filters']));if(_0x4c5fd6[_0x7cee('0x3b')][_0x7cee('0x45')]){_0x66e1bc[_0x7cee('0x43')]=_[_0x7cee('0x48')](_0x66e1bc[_0x7cee('0x43')],{'$or':_[_0x7cee('0x35')](_0x66e1bc[_0x7cee('0x3f')],function(_0x2b91a8){var _0xba4c54={};_0xba4c54[_0x2b91a8]={'$like':'%'+_0x4c5fd6[_0x7cee('0x3b')][_0x7cee('0x45')]+'%'};return _0xba4c54;})});}_0x66e1bc=_[_0x7cee('0x48')]({},_0x66e1bc,_0x4c5fd6[_0x7cee('0x4e')]);return _0x30a172[_0x7cee('0x52')](_0x66e1bc);}})['then'](function(_0x264888){if(_0x264888){_0x176b4d=_0x264888['length'];if(!_0x4c5fd6[_0x7cee('0x3b')][_0x7cee('0x56')](_0x7cee('0x57'))){_0x66e1bc['limit']=qs[_0x7cee('0x27')](_0x4c5fd6[_0x7cee('0x3b')]['limit']);_0x66e1bc[_0x7cee('0x26')]=qs[_0x7cee('0x26')](_0x4c5fd6[_0x7cee('0x3b')][_0x7cee('0x26')]);}return _0x30a172[_0x7cee('0x52')](_0x66e1bc);}})[_0x7cee('0x2e')](function(_0x32abb7){if(_0x32abb7){return _0x32abb7?{'count':_0x176b4d,'rows':_0x32abb7}:null;}})[_0x7cee('0x2e')](respondWithResult(_0x1c4729,null))[_0x7cee('0x4c')](handleError(_0x1c4729,null));};exports[_0x7cee('0x58')]=function(_0x7cafb4,_0x41d785,_0x5a51d0){var _0x1b3177={};var _0x46529d={};var _0x18d5a5;var _0x52a44e;return db[_0x7cee('0x36')][_0x7cee('0x53')]({'where':{'id':_0x7cafb4[_0x7cee('0x4d')]['id']}})[_0x7cee('0x2e')](handleEntityNotFound(_0x41d785,null))[_0x7cee('0x2e')](function(_0x47ae65){if(_0x47ae65){_0x18d5a5=_0x47ae65;_0x46529d[_0x7cee('0x3e')]=_[_0x7cee('0x3a')](db[_0x7cee('0x54')][_0x7cee('0x37')]);_0x46529d[_0x7cee('0x3b')]=_[_0x7cee('0x3a')](_0x7cafb4['query']);_0x46529d[_0x7cee('0x3c')]=_[_0x7cee('0x3d')](_0x46529d['model'],_0x46529d[_0x7cee('0x3b')]);_0x1b3177['attributes']=_[_0x7cee('0x3d')](_0x46529d[_0x7cee('0x3e')],qs[_0x7cee('0x40')](_0x7cafb4[_0x7cee('0x3b')][_0x7cee('0x40')]));_0x1b3177[_0x7cee('0x3f')]=_0x1b3177[_0x7cee('0x3f')][_0x7cee('0x41')]?_0x1b3177[_0x7cee('0x3f')]:_0x46529d[_0x7cee('0x3e')];_0x1b3177[_0x7cee('0x42')]=qs[_0x7cee('0x55')](_0x7cafb4['query'][_0x7cee('0x55')]);_0x1b3177[_0x7cee('0x43')]=qs[_0x7cee('0x3c')](_[_0x7cee('0x44')](_0x7cafb4['query'],_0x46529d[_0x7cee('0x3c')]));if(_0x7cafb4['query'][_0x7cee('0x45')]){_0x1b3177[_0x7cee('0x43')]=_[_0x7cee('0x48')](_0x1b3177[_0x7cee('0x43')],{'$or':_['map'](_0x1b3177['attributes'],function(_0x3cf038){var _0x43d2bd={};_0x43d2bd[_0x3cf038]={'$like':'%'+_0x7cafb4['query'][_0x7cee('0x45')]+'%'};return _0x43d2bd;})});}_0x1b3177=_[_0x7cee('0x48')]({},_0x1b3177,_0x7cafb4[_0x7cee('0x4e')]);return _0x18d5a5[_0x7cee('0x58')](_0x1b3177);}})[_0x7cee('0x2e')](function(_0x588e39){if(_0x588e39){_0x52a44e=_0x588e39[_0x7cee('0x41')];if(!_0x7cafb4['query'][_0x7cee('0x56')]('nolimit')){_0x1b3177[_0x7cee('0x27')]=qs[_0x7cee('0x27')](_0x7cafb4[_0x7cee('0x3b')][_0x7cee('0x27')]);_0x1b3177[_0x7cee('0x26')]=qs[_0x7cee('0x26')](_0x7cafb4[_0x7cee('0x3b')][_0x7cee('0x26')]);}return _0x18d5a5['getSubjects'](_0x1b3177);}})[_0x7cee('0x2e')](function(_0x5e8b02){if(_0x5e8b02){return _0x5e8b02?{'count':_0x52a44e,'rows':_0x5e8b02}:null;}})[_0x7cee('0x2e')](respondWithResult(_0x41d785,null))[_0x7cee('0x4c')](handleError(_0x41d785,null));};exports[_0x7cee('0x59')]=function(_0x48d006,_0x512dc2,_0x4a5a8a){var _0x4bc2ba={};var _0x47e9df={};var _0x3fd75f;var _0x40df44;return db['VtigerConfiguration'][_0x7cee('0x53')]({'where':{'id':_0x48d006[_0x7cee('0x4d')]['id']}})['then'](handleEntityNotFound(_0x512dc2,null))[_0x7cee('0x2e')](function(_0x1c916f){if(_0x1c916f){_0x3fd75f=_0x1c916f;_0x47e9df[_0x7cee('0x3e')]=_[_0x7cee('0x3a')](db[_0x7cee('0x54')][_0x7cee('0x37')]);_0x47e9df[_0x7cee('0x3b')]=_[_0x7cee('0x3a')](_0x48d006[_0x7cee('0x3b')]);_0x47e9df[_0x7cee('0x3c')]=_[_0x7cee('0x3d')](_0x47e9df[_0x7cee('0x3e')],_0x47e9df['query']);_0x4bc2ba[_0x7cee('0x3f')]=_['intersection'](_0x47e9df[_0x7cee('0x3e')],qs[_0x7cee('0x40')](_0x48d006['query'][_0x7cee('0x40')]));_0x4bc2ba[_0x7cee('0x3f')]=_0x4bc2ba[_0x7cee('0x3f')][_0x7cee('0x41')]?_0x4bc2ba['attributes']:_0x47e9df[_0x7cee('0x3e')];_0x4bc2ba['order']=qs[_0x7cee('0x55')](_0x48d006[_0x7cee('0x3b')]['sort']);_0x4bc2ba[_0x7cee('0x43')]=qs['filters'](_['pick'](_0x48d006[_0x7cee('0x3b')],_0x47e9df[_0x7cee('0x3c')]));if(_0x48d006[_0x7cee('0x3b')][_0x7cee('0x45')]){_0x4bc2ba[_0x7cee('0x43')]=_['merge'](_0x4bc2ba[_0x7cee('0x43')],{'$or':_[_0x7cee('0x35')](_0x4bc2ba['attributes'],function(_0x440ed1){var _0x56db09={};_0x56db09[_0x440ed1]={'$like':'%'+_0x48d006['query'][_0x7cee('0x45')]+'%'};return _0x56db09;})});}_0x4bc2ba=_['merge']({},_0x4bc2ba,_0x48d006[_0x7cee('0x4e')]);return _0x3fd75f[_0x7cee('0x59')](_0x4bc2ba);}})[_0x7cee('0x2e')](function(_0xeeb621){if(_0xeeb621){_0x40df44=_0xeeb621[_0x7cee('0x41')];if(!_0x48d006[_0x7cee('0x3b')]['hasOwnProperty']('nolimit')){_0x4bc2ba[_0x7cee('0x27')]=qs['limit'](_0x48d006[_0x7cee('0x3b')][_0x7cee('0x27')]);_0x4bc2ba[_0x7cee('0x26')]=qs[_0x7cee('0x26')](_0x48d006[_0x7cee('0x3b')][_0x7cee('0x26')]);}return _0x3fd75f['getDescriptions'](_0x4bc2ba);}})[_0x7cee('0x2e')](function(_0x4dfc7a){if(_0x4dfc7a){return _0x4dfc7a?{'count':_0x40df44,'rows':_0x4dfc7a}:null;}})[_0x7cee('0x2e')](respondWithResult(_0x512dc2,null))[_0x7cee('0x4c')](handleError(_0x512dc2,null));}; \ No newline at end of file +var _0xf2a0=['filter','options','VtigerConfiguration','includeAll','include','findAll','rows','keys','create','body','find','params','findOne','VtigerField','sort','pick','getFields','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','status','json','count','offset','limit','set','Content-Range','apply','destroy','sendStatus','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','merge','VIRTUAL'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xf2a0,0xc4));var _0x0f2a=function(_0x4812c9,_0x154b76){_0x4812c9=_0x4812c9-0x0;var _0x4de61f=_0xf2a0[_0x4812c9];return _0x4de61f;};'use strict';var pdf=require(_0x0f2a('0x0'));var emlformat=require(_0x0f2a('0x1'));var rimraf=require(_0x0f2a('0x2'));var zipdir=require(_0x0f2a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f2a('0x4'));var moment=require(_0x0f2a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0f2a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0f2a('0x7'));var csv=require(_0x0f2a('0x8'));var ejs=require(_0x0f2a('0x9'));var fs=require('fs');var _=require(_0x0f2a('0xa'));var squel=require(_0x0f2a('0xb'));var crypto=require(_0x0f2a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0f2a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0f2a('0xe'));var Redis=require(_0x0f2a('0xf'));var authService=require(_0x0f2a('0x10'));var qs=require(_0x0f2a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f2a('0x12'));var logger=require(_0x0f2a('0x13'))('api');var utils=require(_0x0f2a('0x14'));var config=require(_0x0f2a('0x15'));var licenseUtil=require(_0x0f2a('0x16'));var db=require(_0x0f2a('0x17'))['db'];var jayson=require(_0x0f2a('0x18'));var client=jayson[_0x0f2a('0x19')][_0x0f2a('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2b7dec,_0x326339,_0x537f0c,_0x5e0f5f){return new BPromise(function(_0x3e936d,_0x4cef43){var _0x25be93=_0x5e0f5f||client;return _0x25be93[_0x0f2a('0x1b')](_0x2b7dec,_0x537f0c)[_0x0f2a('0x1c')](function(_0x4e980c){logger[_0x0f2a('0x1d')](_0x0f2a('0x1e'),_0x326339,'request\x20sent');logger[_0x0f2a('0x1f')](_0x0f2a('0x20'),_0x326339,_0x0f2a('0x21'),JSON[_0x0f2a('0x22')](_0x4e980c));if(_0x4e980c[_0x0f2a('0x23')]){if(_0x4e980c['error']['code']===0x1f4){logger[_0x0f2a('0x23')]('VtigerConfiguration,\x20%s,\x20%s',_0x326339,_0x4e980c[_0x0f2a('0x23')][_0x0f2a('0x24')]);return _0x4cef43(_0x4e980c[_0x0f2a('0x23')][_0x0f2a('0x24')]);}logger[_0x0f2a('0x23')](_0x0f2a('0x1e'),_0x326339,_0x4e980c[_0x0f2a('0x23')]['message']);return _0x3e936d(_0x4e980c[_0x0f2a('0x23')][_0x0f2a('0x24')]);}else{logger[_0x0f2a('0x1d')](_0x0f2a('0x1e'),_0x326339,_0x0f2a('0x21'));_0x3e936d(_0x4e980c['result'][_0x0f2a('0x24')]);}})[_0x0f2a('0x25')](function(_0x50e068){logger[_0x0f2a('0x23')]('VtigerConfiguration,\x20%s,\x20%s',_0x326339,_0x50e068);_0x4cef43(_0x50e068);});});}function respondWithStatusCode(_0x32acb6,_0x3a57fa){_0x3a57fa=_0x3a57fa||0xcc;return function(_0x5d57cf){if(_0x5d57cf){return _0x32acb6['sendStatus'](_0x3a57fa);}return _0x32acb6[_0x0f2a('0x26')](_0x3a57fa)['end']();};}function respondWithResult(_0x9b4b25,_0x1fe3bd){_0x1fe3bd=_0x1fe3bd||0xc8;return function(_0x3ed864){if(_0x3ed864){return _0x9b4b25[_0x0f2a('0x26')](_0x1fe3bd)[_0x0f2a('0x27')](_0x3ed864);}};}function respondWithFilteredResult(_0x4ed3cb,_0x497d62){return function(_0x32aead){if(_0x32aead){var _0x37ec4b=_0x32aead[_0x0f2a('0x28')],_0x498c96=_0x497d62[_0x0f2a('0x29')],_0x5c5a80=_0x497d62[_0x0f2a('0x29')]+_0x497d62[_0x0f2a('0x2a')],_0x30605e;if(_0x5c5a80>=_0x37ec4b){_0x5c5a80=_0x37ec4b;_0x30605e=0xc8;}else{_0x30605e=0xce;}_0x4ed3cb[_0x0f2a('0x26')](_0x30605e);return _0x4ed3cb[_0x0f2a('0x2b')](_0x0f2a('0x2c'),_0x498c96+'-'+_0x5c5a80+'/'+_0x37ec4b)['json'](_0x32aead);}return null;};}function patchUpdates(_0x1d299f){return function(_0xb307e7){try{jsonpatch[_0x0f2a('0x2d')](_0xb307e7,_0x1d299f,!![]);}catch(_0x49f05d){return BPromise['reject'](_0x49f05d);}return _0xb307e7['save']();};}function saveUpdates(_0x340427,_0x623a21){return function(_0x418d8c){if(_0x418d8c){return _0x418d8c['update'](_0x340427)[_0x0f2a('0x1c')](function(_0x8bf0a5){return _0x8bf0a5;});}return null;};}function removeEntity(_0x4636cb,_0x55d535){return function(_0x24e783){if(_0x24e783){return _0x24e783[_0x0f2a('0x2e')]()[_0x0f2a('0x1c')](function(){_0x4636cb[_0x0f2a('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa0127c,_0x162812){return function(_0x4ae586){if(!_0x4ae586){_0xa0127c[_0x0f2a('0x2f')](0x194);}return _0x4ae586;};}function handleError(_0x37f375,_0x3429c8){_0x3429c8=_0x3429c8||0x1f4;return function(_0x41af42){logger['error'](_0x41af42['stack']);if(_0x41af42['name']){delete _0x41af42[_0x0f2a('0x30')];}_0x37f375[_0x0f2a('0x26')](_0x3429c8)[_0x0f2a('0x31')](_0x41af42);};}exports[_0x0f2a('0x32')]=function(_0x4bcadd,_0x3849eb){var _0x41bb6c={},_0x6d42a9={},_0x29528e={'count':0x0,'rows':[]};var _0x33827e=_['map'](db['VtigerConfiguration'][_0x0f2a('0x33')],function(_0x2cd25d){return{'name':_0x2cd25d[_0x0f2a('0x34')],'type':_0x2cd25d[_0x0f2a('0x35')][_0x0f2a('0x36')]};});_0x6d42a9[_0x0f2a('0x37')]=_[_0x0f2a('0x38')](_0x33827e,_0x0f2a('0x30'));_0x6d42a9['query']=_['keys'](_0x4bcadd[_0x0f2a('0x39')]);_0x6d42a9[_0x0f2a('0x3a')]=_['intersection'](_0x6d42a9[_0x0f2a('0x37')],_0x6d42a9['query']);_0x41bb6c[_0x0f2a('0x3b')]=_[_0x0f2a('0x3c')](_0x6d42a9[_0x0f2a('0x37')],qs[_0x0f2a('0x3d')](_0x4bcadd[_0x0f2a('0x39')][_0x0f2a('0x3d')]));_0x41bb6c[_0x0f2a('0x3b')]=_0x41bb6c['attributes'][_0x0f2a('0x3e')]?_0x41bb6c[_0x0f2a('0x3b')]:_0x6d42a9[_0x0f2a('0x37')];if(!_0x4bcadd[_0x0f2a('0x39')][_0x0f2a('0x3f')]('nolimit')){_0x41bb6c[_0x0f2a('0x2a')]=qs['limit'](_0x4bcadd[_0x0f2a('0x39')][_0x0f2a('0x2a')]);_0x41bb6c[_0x0f2a('0x29')]=qs['offset'](_0x4bcadd[_0x0f2a('0x39')][_0x0f2a('0x29')]);}_0x41bb6c[_0x0f2a('0x40')]=qs['sort'](_0x4bcadd['query']['sort']);_0x41bb6c[_0x0f2a('0x41')]=qs[_0x0f2a('0x3a')](_['pick'](_0x4bcadd[_0x0f2a('0x39')],_0x6d42a9[_0x0f2a('0x3a')]),_0x33827e);if(_0x4bcadd['query']['filter']){_0x41bb6c[_0x0f2a('0x41')]=_[_0x0f2a('0x42')](_0x41bb6c[_0x0f2a('0x41')],{'$or':_[_0x0f2a('0x38')](_0x33827e,function(_0x8a1fcd){if(_0x8a1fcd['type']!==_0x0f2a('0x43')){var _0x1fe14e={};_0x1fe14e[_0x8a1fcd[_0x0f2a('0x30')]]={'$like':'%'+_0x4bcadd[_0x0f2a('0x39')][_0x0f2a('0x44')]+'%'};return _0x1fe14e;}})});}_0x41bb6c=_[_0x0f2a('0x42')]({},_0x41bb6c,_0x4bcadd[_0x0f2a('0x45')]);var _0x4314b8={'where':_0x41bb6c[_0x0f2a('0x41')]};return db[_0x0f2a('0x46')][_0x0f2a('0x28')](_0x4314b8)['then'](function(_0x4be069){_0x29528e[_0x0f2a('0x28')]=_0x4be069;if(_0x4bcadd[_0x0f2a('0x39')][_0x0f2a('0x47')]){_0x41bb6c[_0x0f2a('0x48')]=[{'all':!![]}];}return db[_0x0f2a('0x46')][_0x0f2a('0x49')](_0x41bb6c);})[_0x0f2a('0x1c')](function(_0x47f04c){_0x29528e[_0x0f2a('0x4a')]=_0x47f04c;return _0x29528e;})['then'](respondWithFilteredResult(_0x3849eb,_0x41bb6c))['catch'](handleError(_0x3849eb,null));};exports['show']=function(_0x399ae7,_0x3f926d){var _0x1f8e2d={'raw':![],'where':{'id':_0x399ae7['params']['id']}},_0x434796={};_0x434796[_0x0f2a('0x37')]=_['keys'](db[_0x0f2a('0x46')]['rawAttributes']);_0x434796[_0x0f2a('0x39')]=_[_0x0f2a('0x4b')](_0x399ae7['query']);_0x434796['filters']=_['intersection'](_0x434796[_0x0f2a('0x37')],_0x434796['query']);_0x1f8e2d[_0x0f2a('0x3b')]=_[_0x0f2a('0x3c')](_0x434796[_0x0f2a('0x37')],qs['fields'](_0x399ae7[_0x0f2a('0x39')][_0x0f2a('0x3d')]));_0x1f8e2d[_0x0f2a('0x3b')]=_0x1f8e2d[_0x0f2a('0x3b')]['length']?_0x1f8e2d[_0x0f2a('0x3b')]:_0x434796['model'];if(_0x399ae7[_0x0f2a('0x39')][_0x0f2a('0x47')]){_0x1f8e2d[_0x0f2a('0x48')]=[{'all':!![]}];}_0x1f8e2d=_[_0x0f2a('0x42')]({},_0x1f8e2d,_0x399ae7[_0x0f2a('0x45')]);return db[_0x0f2a('0x46')]['find'](_0x1f8e2d)[_0x0f2a('0x1c')](handleEntityNotFound(_0x3f926d,null))[_0x0f2a('0x1c')](respondWithResult(_0x3f926d,null))[_0x0f2a('0x25')](handleError(_0x3f926d,null));};exports[_0x0f2a('0x4c')]=function(_0x4b878c,_0x6f99b){return db[_0x0f2a('0x46')]['create'](_0x4b878c[_0x0f2a('0x4d')],{})[_0x0f2a('0x1c')](respondWithResult(_0x6f99b,0xc9))[_0x0f2a('0x25')](handleError(_0x6f99b,null));};exports['update']=function(_0x506b61,_0x4665d5){if(_0x506b61['body']['id']){delete _0x506b61[_0x0f2a('0x4d')]['id'];}return db[_0x0f2a('0x46')][_0x0f2a('0x4e')]({'where':{'id':_0x506b61[_0x0f2a('0x4f')]['id']}})[_0x0f2a('0x1c')](handleEntityNotFound(_0x4665d5,null))[_0x0f2a('0x1c')](saveUpdates(_0x506b61[_0x0f2a('0x4d')],null))[_0x0f2a('0x1c')](respondWithResult(_0x4665d5,null))[_0x0f2a('0x25')](handleError(_0x4665d5,null));};exports[_0x0f2a('0x2e')]=function(_0x3c43d8,_0x3a7201){return db['VtigerConfiguration'][_0x0f2a('0x4e')]({'where':{'id':_0x3c43d8[_0x0f2a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3a7201,null))['then'](removeEntity(_0x3a7201,null))[_0x0f2a('0x25')](handleError(_0x3a7201,null));};exports['getFields']=function(_0x1af6b9,_0x36a689,_0x4af834){var _0x1cd0b1={};var _0x159bba={};var _0x202029;var _0x231ee0;return db[_0x0f2a('0x46')][_0x0f2a('0x50')]({'where':{'id':_0x1af6b9[_0x0f2a('0x4f')]['id']}})[_0x0f2a('0x1c')](handleEntityNotFound(_0x36a689,null))[_0x0f2a('0x1c')](function(_0x8dd488){if(_0x8dd488){_0x202029=_0x8dd488;_0x159bba[_0x0f2a('0x37')]=_['keys'](db[_0x0f2a('0x51')][_0x0f2a('0x33')]);_0x159bba[_0x0f2a('0x39')]=_[_0x0f2a('0x4b')](_0x1af6b9[_0x0f2a('0x39')]);_0x159bba[_0x0f2a('0x3a')]=_[_0x0f2a('0x3c')](_0x159bba['model'],_0x159bba[_0x0f2a('0x39')]);_0x1cd0b1[_0x0f2a('0x3b')]=_['intersection'](_0x159bba[_0x0f2a('0x37')],qs[_0x0f2a('0x3d')](_0x1af6b9['query'][_0x0f2a('0x3d')]));_0x1cd0b1['attributes']=_0x1cd0b1[_0x0f2a('0x3b')][_0x0f2a('0x3e')]?_0x1cd0b1[_0x0f2a('0x3b')]:_0x159bba[_0x0f2a('0x37')];_0x1cd0b1[_0x0f2a('0x40')]=qs[_0x0f2a('0x52')](_0x1af6b9['query']['sort']);_0x1cd0b1[_0x0f2a('0x41')]=qs[_0x0f2a('0x3a')](_[_0x0f2a('0x53')](_0x1af6b9['query'],_0x159bba['filters']));if(_0x1af6b9[_0x0f2a('0x39')][_0x0f2a('0x44')]){_0x1cd0b1[_0x0f2a('0x41')]=_['merge'](_0x1cd0b1[_0x0f2a('0x41')],{'$or':_[_0x0f2a('0x38')](_0x1cd0b1['attributes'],function(_0x1452ec){var _0x37a1e1={};_0x37a1e1[_0x1452ec]={'$like':'%'+_0x1af6b9[_0x0f2a('0x39')][_0x0f2a('0x44')]+'%'};return _0x37a1e1;})});}_0x1cd0b1=_[_0x0f2a('0x42')]({},_0x1cd0b1,_0x1af6b9[_0x0f2a('0x45')]);return _0x202029[_0x0f2a('0x54')](_0x1cd0b1);}})[_0x0f2a('0x1c')](function(_0x2487fc){if(_0x2487fc){_0x231ee0=_0x2487fc[_0x0f2a('0x3e')];if(!_0x1af6b9[_0x0f2a('0x39')][_0x0f2a('0x3f')](_0x0f2a('0x55'))){_0x1cd0b1[_0x0f2a('0x2a')]=qs['limit'](_0x1af6b9['query'][_0x0f2a('0x2a')]);_0x1cd0b1[_0x0f2a('0x29')]=qs[_0x0f2a('0x29')](_0x1af6b9['query'][_0x0f2a('0x29')]);}return _0x202029[_0x0f2a('0x54')](_0x1cd0b1);}})['then'](function(_0x1ed43c){if(_0x1ed43c){return _0x1ed43c?{'count':_0x231ee0,'rows':_0x1ed43c}:null;}})[_0x0f2a('0x1c')](respondWithResult(_0x36a689,null))[_0x0f2a('0x25')](handleError(_0x36a689,null));};exports[_0x0f2a('0x56')]=function(_0x1d69df,_0x555abe,_0x17877a){var _0x3dd240={};var _0x1202ef={};var _0x422261;var _0x3df9a1;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x1d69df['params']['id']}})[_0x0f2a('0x1c')](handleEntityNotFound(_0x555abe,null))[_0x0f2a('0x1c')](function(_0x4589e1){if(_0x4589e1){_0x422261=_0x4589e1;_0x1202ef['model']=_[_0x0f2a('0x4b')](db[_0x0f2a('0x51')]['rawAttributes']);_0x1202ef[_0x0f2a('0x39')]=_[_0x0f2a('0x4b')](_0x1d69df[_0x0f2a('0x39')]);_0x1202ef[_0x0f2a('0x3a')]=_[_0x0f2a('0x3c')](_0x1202ef[_0x0f2a('0x37')],_0x1202ef[_0x0f2a('0x39')]);_0x3dd240[_0x0f2a('0x3b')]=_['intersection'](_0x1202ef[_0x0f2a('0x37')],qs[_0x0f2a('0x3d')](_0x1d69df[_0x0f2a('0x39')][_0x0f2a('0x3d')]));_0x3dd240['attributes']=_0x3dd240[_0x0f2a('0x3b')][_0x0f2a('0x3e')]?_0x3dd240['attributes']:_0x1202ef[_0x0f2a('0x37')];_0x3dd240[_0x0f2a('0x40')]=qs[_0x0f2a('0x52')](_0x1d69df['query'][_0x0f2a('0x52')]);_0x3dd240['where']=qs[_0x0f2a('0x3a')](_[_0x0f2a('0x53')](_0x1d69df[_0x0f2a('0x39')],_0x1202ef[_0x0f2a('0x3a')]));if(_0x1d69df[_0x0f2a('0x39')][_0x0f2a('0x44')]){_0x3dd240[_0x0f2a('0x41')]=_[_0x0f2a('0x42')](_0x3dd240[_0x0f2a('0x41')],{'$or':_[_0x0f2a('0x38')](_0x3dd240[_0x0f2a('0x3b')],function(_0x105524){var _0x97aa55={};_0x97aa55[_0x105524]={'$like':'%'+_0x1d69df[_0x0f2a('0x39')][_0x0f2a('0x44')]+'%'};return _0x97aa55;})});}_0x3dd240=_[_0x0f2a('0x42')]({},_0x3dd240,_0x1d69df[_0x0f2a('0x45')]);return _0x422261[_0x0f2a('0x56')](_0x3dd240);}})[_0x0f2a('0x1c')](function(_0x482791){if(_0x482791){_0x3df9a1=_0x482791[_0x0f2a('0x3e')];if(!_0x1d69df[_0x0f2a('0x39')]['hasOwnProperty'](_0x0f2a('0x55'))){_0x3dd240[_0x0f2a('0x2a')]=qs[_0x0f2a('0x2a')](_0x1d69df[_0x0f2a('0x39')][_0x0f2a('0x2a')]);_0x3dd240[_0x0f2a('0x29')]=qs[_0x0f2a('0x29')](_0x1d69df[_0x0f2a('0x39')][_0x0f2a('0x29')]);}return _0x422261['getSubjects'](_0x3dd240);}})[_0x0f2a('0x1c')](function(_0x539818){if(_0x539818){return _0x539818?{'count':_0x3df9a1,'rows':_0x539818}:null;}})[_0x0f2a('0x1c')](respondWithResult(_0x555abe,null))[_0x0f2a('0x25')](handleError(_0x555abe,null));};exports['getDescriptions']=function(_0x1d004c,_0x3bfb1f,_0x2327d2){var _0x58dcdc={};var _0x1c4c89={};var _0x232eab;var _0x191b74;return db['VtigerConfiguration'][_0x0f2a('0x50')]({'where':{'id':_0x1d004c[_0x0f2a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3bfb1f,null))['then'](function(_0x3c8476){if(_0x3c8476){_0x232eab=_0x3c8476;_0x1c4c89[_0x0f2a('0x37')]=_[_0x0f2a('0x4b')](db[_0x0f2a('0x51')]['rawAttributes']);_0x1c4c89[_0x0f2a('0x39')]=_[_0x0f2a('0x4b')](_0x1d004c[_0x0f2a('0x39')]);_0x1c4c89[_0x0f2a('0x3a')]=_['intersection'](_0x1c4c89[_0x0f2a('0x37')],_0x1c4c89['query']);_0x58dcdc[_0x0f2a('0x3b')]=_[_0x0f2a('0x3c')](_0x1c4c89[_0x0f2a('0x37')],qs[_0x0f2a('0x3d')](_0x1d004c[_0x0f2a('0x39')][_0x0f2a('0x3d')]));_0x58dcdc['attributes']=_0x58dcdc[_0x0f2a('0x3b')][_0x0f2a('0x3e')]?_0x58dcdc[_0x0f2a('0x3b')]:_0x1c4c89[_0x0f2a('0x37')];_0x58dcdc['order']=qs[_0x0f2a('0x52')](_0x1d004c[_0x0f2a('0x39')][_0x0f2a('0x52')]);_0x58dcdc[_0x0f2a('0x41')]=qs[_0x0f2a('0x3a')](_[_0x0f2a('0x53')](_0x1d004c[_0x0f2a('0x39')],_0x1c4c89[_0x0f2a('0x3a')]));if(_0x1d004c['query']['filter']){_0x58dcdc[_0x0f2a('0x41')]=_[_0x0f2a('0x42')](_0x58dcdc[_0x0f2a('0x41')],{'$or':_[_0x0f2a('0x38')](_0x58dcdc[_0x0f2a('0x3b')],function(_0x2eb570){var _0x519763={};_0x519763[_0x2eb570]={'$like':'%'+_0x1d004c['query']['filter']+'%'};return _0x519763;})});}_0x58dcdc=_[_0x0f2a('0x42')]({},_0x58dcdc,_0x1d004c['options']);return _0x232eab['getDescriptions'](_0x58dcdc);}})[_0x0f2a('0x1c')](function(_0x2a7b81){if(_0x2a7b81){_0x191b74=_0x2a7b81[_0x0f2a('0x3e')];if(!_0x1d004c[_0x0f2a('0x39')][_0x0f2a('0x3f')](_0x0f2a('0x55'))){_0x58dcdc['limit']=qs['limit'](_0x1d004c[_0x0f2a('0x39')][_0x0f2a('0x2a')]);_0x58dcdc[_0x0f2a('0x29')]=qs[_0x0f2a('0x29')](_0x1d004c['query'][_0x0f2a('0x29')]);}return _0x232eab[_0x0f2a('0x57')](_0x58dcdc);}})[_0x0f2a('0x1c')](function(_0x258b51){if(_0x258b51){return _0x258b51?{'count':_0x191b74,'rows':_0x258b51}:null;}})[_0x0f2a('0x1c')](respondWithResult(_0x3bfb1f,null))[_0x0f2a('0x25')](handleError(_0x3bfb1f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index d4911e9..08d82c8 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 _0x0f59=['VtigerConfiguration','int_vtiger_configurations','lodash','api','bluebird','request-promise','path','rimraf','./intVtigerConfiguration.attributes'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x0f59,0xe3));var _0x90f5=function(_0x20aadb,_0x5a607a){_0x20aadb=_0x20aadb-0x0;var _0x520018=_0x0f59[_0x20aadb];return _0x520018;};'use strict';var _=require(_0x90f5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x90f5('0x1'));var moment=require('moment');var BPromise=require(_0x90f5('0x2'));var rp=require(_0x90f5('0x3'));var fs=require('fs');var path=require(_0x90f5('0x4'));var rimraf=require(_0x90f5('0x5'));var config=require('../../config/environment');var attributes=require(_0x90f5('0x6'));module['exports']=function(_0x247efa,_0x3328e0){return _0x247efa['define'](_0x90f5('0x7'),attributes,{'tableName':_0x90f5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7f3=['int_vtiger_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe7f3,0x105));var _0x3e7f=function(_0x503c39,_0x7be54a){_0x503c39=_0x503c39-0x0;var _0x2b0de2=_0xe7f3[_0x503c39];return _0x2b0de2;};'use strict';var _=require('lodash');var util=require(_0x3e7f('0x0'));var logger=require(_0x3e7f('0x1'))(_0x3e7f('0x2'));var moment=require(_0x3e7f('0x3'));var BPromise=require(_0x3e7f('0x4'));var rp=require(_0x3e7f('0x5'));var fs=require('fs');var path=require(_0x3e7f('0x6'));var rimraf=require(_0x3e7f('0x7'));var config=require(_0x3e7f('0x8'));var attributes=require(_0x3e7f('0x9'));module[_0x3e7f('0xa')]=function(_0x3cee0b,_0x80edc){return _0x3cee0b[_0x3e7f('0xb')]('VtigerConfiguration',attributes,{'tableName':_0x3e7f('0xc'),'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 3c62909..9509c69 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 _0x11b0=['info','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x11b0,0x1d7));var _0x011b=function(_0x5cce5b,_0x3d1fdb){_0x5cce5b=_0x5cce5b-0x0;var _0x590855=_0x11b0[_0x5cce5b];return _0x590855;};'use strict';var _=require('lodash');var util=require(_0x011b('0x0'));var moment=require(_0x011b('0x1'));var BPromise=require(_0x011b('0x2'));var rs=require(_0x011b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x011b('0x4'))['db'];var utils=require(_0x011b('0x5'));var logger=require(_0x011b('0x6'))(_0x011b('0x7'));var config=require(_0x011b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x011b('0x9')][_0x011b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b5411,_0x2fdefc,_0x54035d){return new BPromise(function(_0x2add8c,_0x2933a6){return client[_0x011b('0xb')](_0x4b5411,_0x54035d)['then'](function(_0x4233c4){logger[_0x011b('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x2fdefc,'request\x20sent');logger[_0x011b('0xd')](_0x011b('0xe'),_0x2fdefc,'request\x20sent',JSON[_0x011b('0xf')](_0x4233c4));if(_0x4233c4[_0x011b('0x10')]){if(_0x4233c4[_0x011b('0x10')]['code']===0x1f4){logger['error'](_0x011b('0x11'),_0x2fdefc,_0x4233c4[_0x011b('0x10')]['message']);return _0x2933a6(_0x4233c4[_0x011b('0x10')][_0x011b('0x12')]);}logger[_0x011b('0x10')](_0x011b('0x11'),_0x2fdefc,_0x4233c4[_0x011b('0x10')][_0x011b('0x12')]);return _0x2add8c(_0x4233c4[_0x011b('0x10')][_0x011b('0x12')]);}else{logger[_0x011b('0xc')](_0x011b('0x11'),_0x2fdefc,'request\x20sent');_0x2add8c(_0x4233c4[_0x011b('0x13')][_0x011b('0x12')]);}})[_0x011b('0x14')](function(_0x1dece0){logger['error'](_0x011b('0x11'),_0x2fdefc,_0x1dece0);_0x2933a6(_0x1dece0);});});} \ No newline at end of file +var _0xe4de=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x5bdb53,_0x427d10){var _0x15250a=function(_0x5f19d0){while(--_0x5f19d0){_0x5bdb53['push'](_0x5bdb53['shift']());}};_0x15250a(++_0x427d10);}(_0xe4de,0xb3));var _0xee4d=function(_0x4b1137,_0x56a35a){_0x4b1137=_0x4b1137-0x0;var _0x3a1713=_0xe4de[_0x4b1137];return _0x3a1713;};'use strict';var _=require(_0xee4d('0x0'));var util=require(_0xee4d('0x1'));var moment=require(_0xee4d('0x2'));var BPromise=require(_0xee4d('0x3'));var rs=require(_0xee4d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee4d('0x5'))['db'];var utils=require(_0xee4d('0x6'));var logger=require(_0xee4d('0x7'))(_0xee4d('0x8'));var config=require(_0xee4d('0x9'));var jayson=require(_0xee4d('0xa'));var client=jayson[_0xee4d('0xb')][_0xee4d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x469f1a,_0x29133e,_0x278c42){return new BPromise(function(_0x1094e1,_0x4c74bc){return client[_0xee4d('0xd')](_0x469f1a,_0x278c42)[_0xee4d('0xe')](function(_0x4200b3){logger[_0xee4d('0xf')](_0xee4d('0x10'),_0x29133e,_0xee4d('0x11'));logger[_0xee4d('0x12')](_0xee4d('0x13'),_0x29133e,_0xee4d('0x11'),JSON[_0xee4d('0x14')](_0x4200b3));if(_0x4200b3[_0xee4d('0x15')]){if(_0x4200b3['error'][_0xee4d('0x16')]===0x1f4){logger[_0xee4d('0x15')](_0xee4d('0x10'),_0x29133e,_0x4200b3[_0xee4d('0x15')][_0xee4d('0x17')]);return _0x4c74bc(_0x4200b3[_0xee4d('0x15')][_0xee4d('0x17')]);}logger[_0xee4d('0x15')]('VtigerConfiguration,\x20%s,\x20%s',_0x29133e,_0x4200b3[_0xee4d('0x15')][_0xee4d('0x17')]);return _0x1094e1(_0x4200b3[_0xee4d('0x15')][_0xee4d('0x17')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x29133e,_0xee4d('0x11'));_0x1094e1(_0x4200b3[_0xee4d('0x18')]['message']);}})[_0xee4d('0x19')](function(_0x49b768){logger[_0xee4d('0x15')](_0xee4d('0x10'),_0x29133e,_0x49b768);_0x4c74bc(_0x49b768);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 1cfe125..28bf747 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 _0x7937=['./intVtigerField.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x26eb88,_0x5efcf1){var _0x5a1b15=function(_0x1871ce){while(--_0x1871ce){_0x26eb88['push'](_0x26eb88['shift']());}};_0x5a1b15(++_0x5efcf1);}(_0x7937,0x1e5));var _0x7793=function(_0xd13a88,_0x3c5269){_0xd13a88=_0xd13a88-0x0;var _0x1c993c=_0x7937[_0xd13a88];return _0x1c993c;};'use strict';var multer=require(_0x7793('0x0'));var util=require(_0x7793('0x1'));var path=require(_0x7793('0x2'));var timeout=require(_0x7793('0x3'));var express=require(_0x7793('0x4'));var router=express[_0x7793('0x5')]();var auth=require(_0x7793('0x6'));var interaction=require(_0x7793('0x7'));var config=require(_0x7793('0x8'));var controller=require(_0x7793('0x9'));router[_0x7793('0xa')]('/',auth[_0x7793('0xb')](),controller[_0x7793('0xc')]);router[_0x7793('0xa')](_0x7793('0xd'),auth[_0x7793('0xb')](),controller['show']);router[_0x7793('0xe')]('/',auth['isAuthenticated'](),controller[_0x7793('0xf')]);router[_0x7793('0x10')](_0x7793('0xd'),auth[_0x7793('0xb')](),controller[_0x7793('0x11')]);router['delete'](_0x7793('0xd'),auth['isAuthenticated'](),controller[_0x7793('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc144=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','update','delete','destroy','exports','multer','util'];(function(_0x3e7649,_0x514260){var _0x5afe90=function(_0x5d7765){while(--_0x5d7765){_0x3e7649['push'](_0x3e7649['shift']());}};_0x5afe90(++_0x514260);}(_0xc144,0x67));var _0x4c14=function(_0x58d7eb,_0x3b2190){_0x58d7eb=_0x58d7eb-0x0;var _0x5e5dfc=_0xc144[_0x58d7eb];return _0x5e5dfc;};'use strict';var multer=require(_0x4c14('0x0'));var util=require(_0x4c14('0x1'));var path=require(_0x4c14('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4c14('0x3')]();var auth=require(_0x4c14('0x4'));var interaction=require(_0x4c14('0x5'));var config=require(_0x4c14('0x6'));var controller=require(_0x4c14('0x7'));router[_0x4c14('0x8')]('/',auth[_0x4c14('0x9')](),controller['index']);router[_0x4c14('0x8')]('/:id',auth[_0x4c14('0x9')](),controller['show']);router['post']('/',auth[_0x4c14('0x9')](),controller['create']);router['put'](_0x4c14('0xa'),auth[_0x4c14('0x9')](),controller[_0x4c14('0xb')]);router[_0x4c14('0xc')](_0x4c14('0xa'),auth[_0x4c14('0x9')](),controller[_0x4c14('0xd')]);module[_0x4c14('0xe')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 589b74b..41f8df7 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 _0x6b45=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x6b45,0xb0));var _0x56b4=function(_0x5fd9a3,_0x4d6377){_0x5fd9a3=_0x5fd9a3-0x0;var _0x45fc16=_0x6b45[_0x5fd9a3];return _0x45fc16;};'use strict';var Sequelize=require(_0x56b4('0x0'));module[_0x56b4('0x1')]={'type':{'type':Sequelize[_0x56b4('0x2')](_0x56b4('0x3'),_0x56b4('0x4'),_0x56b4('0x5'),_0x56b4('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x56b4('0x7')]},'key':{'type':Sequelize[_0x56b4('0x7')]},'keyType':{'type':Sequelize[_0x56b4('0x2')](_0x56b4('0x3'),_0x56b4('0x4'),_0x56b4('0x5'))},'keyContent':{'type':Sequelize[_0x56b4('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x56b4('0x7')]},'customField':{'type':Sequelize[_0x56b4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x56b4('0x7')]}}; \ No newline at end of file +var _0xbc9d=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x1a4cb2,_0x32a85a){var _0x202c6b=function(_0x217305){while(--_0x217305){_0x1a4cb2['push'](_0x1a4cb2['shift']());}};_0x202c6b(++_0x32a85a);}(_0xbc9d,0xcc));var _0xdbc9=function(_0x57a464,_0xca6f3b){_0x57a464=_0x57a464-0x0;var _0x4514ef=_0xbc9d[_0x57a464];return _0x4514ef;};'use strict';var Sequelize=require(_0xdbc9('0x0'));module[_0xdbc9('0x1')]={'type':{'type':Sequelize[_0xdbc9('0x2')](_0xdbc9('0x3'),'variable',_0xdbc9('0x4'),_0xdbc9('0x5')),'defaultValue':_0xdbc9('0x3')},'content':{'type':Sequelize[_0xdbc9('0x6')]},'key':{'type':Sequelize[_0xdbc9('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xdbc9('0x3'),'variable',_0xdbc9('0x4'))},'keyContent':{'type':Sequelize[_0xdbc9('0x6')]},'idField':{'type':Sequelize[_0xdbc9('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xdbc9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdbc9('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 90c6c6a..73ba653 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 _0x1dcc=['../../config/environment','../../config/license/util','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x22d72b,_0x112e6d){var _0x35f65f=function(_0x23d67f){while(--_0x23d67f){_0x22d72b['push'](_0x22d72b['shift']());}};_0x35f65f(++_0x112e6d);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x473e1b,_0x3b7cb1){_0x473e1b=_0x473e1b-0x0;var _0xb93794=_0x1dcc[_0x473e1b];return _0xb93794;};'use strict';var pdf=require(_0xc1dc('0x0'));var emlformat=require(_0xc1dc('0x1'));var rimraf=require(_0xc1dc('0x2'));var zipdir=require(_0xc1dc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1dc('0x4'));var moment=require('moment');var BPromise=require(_0xc1dc('0x5'));var Mustache=require(_0xc1dc('0x6'));var util=require(_0xc1dc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xc1dc('0x8'));var ejs=require(_0xc1dc('0x9'));var fs=require('fs');var _=require(_0xc1dc('0xa'));var squel=require('squel');var crypto=require(_0xc1dc('0xb'));var jsforce=require(_0xc1dc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc1dc('0x8'));var querystring=require('querystring');var Papa=require(_0xc1dc('0xd'));var Redis=require('ioredis');var authService=require(_0xc1dc('0xe'));var qs=require(_0xc1dc('0xf'));var as=require(_0xc1dc('0x10'));var hardwareService=require(_0xc1dc('0x11'));var logger=require(_0xc1dc('0x12'))(_0xc1dc('0x13'));var utils=require(_0xc1dc('0x14'));var config=require(_0xc1dc('0x15'));var licenseUtil=require(_0xc1dc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226ba3,_0x2c5f41){_0x2c5f41=_0x2c5f41||0xcc;return function(_0xb7e667){if(_0xb7e667){return _0x226ba3['sendStatus'](_0x2c5f41);}return _0x226ba3[_0xc1dc('0x17')](_0x2c5f41)[_0xc1dc('0x18')]();};}function respondWithResult(_0x299520,_0xd51b1e){_0xd51b1e=_0xd51b1e||0xc8;return function(_0x145708){if(_0x145708){return _0x299520[_0xc1dc('0x17')](_0xd51b1e)[_0xc1dc('0x19')](_0x145708);}};}function respondWithFilteredResult(_0x21aed1,_0x265929){return function(_0x37b23a){if(_0x37b23a){var _0x1cbbfe=_0x37b23a[_0xc1dc('0x1a')],_0x5885b0=_0x265929[_0xc1dc('0x1b')],_0x16ec8b=_0x265929['offset']+_0x265929[_0xc1dc('0x1c')],_0x3533a9;if(_0x16ec8b>=_0x1cbbfe){_0x16ec8b=_0x1cbbfe;_0x3533a9=0xc8;}else{_0x3533a9=0xce;}_0x21aed1[_0xc1dc('0x17')](_0x3533a9);return _0x21aed1['set']('Content-Range',_0x5885b0+'-'+_0x16ec8b+'/'+_0x1cbbfe)[_0xc1dc('0x19')](_0x37b23a);}return null;};}function patchUpdates(_0x250e5c){return function(_0x197941){try{jsonpatch[_0xc1dc('0x1d')](_0x197941,_0x250e5c,!![]);}catch(_0x1707dc){return BPromise[_0xc1dc('0x1e')](_0x1707dc);}return _0x197941[_0xc1dc('0x1f')]();};}function saveUpdates(_0xd5a2e,_0x5762e5){return function(_0x52bf2d){if(_0x52bf2d){return _0x52bf2d['update'](_0xd5a2e)[_0xc1dc('0x20')](function(_0x2b7927){return _0x2b7927;});}return null;};}function removeEntity(_0x47af1e,_0x367965){return function(_0x19325f){if(_0x19325f){return _0x19325f[_0xc1dc('0x21')]()[_0xc1dc('0x20')](function(){_0x47af1e[_0xc1dc('0x17')](0xcc)[_0xc1dc('0x18')]();});}};}function handleEntityNotFound(_0x353bf3,_0x18ba56){return function(_0x3efff1){if(!_0x3efff1){_0x353bf3[_0xc1dc('0x22')](0x194);}return _0x3efff1;};}function handleError(_0x49aab6,_0x18ef1e){_0x18ef1e=_0x18ef1e||0x1f4;return function(_0xfeb0b1){logger[_0xc1dc('0x23')](_0xfeb0b1[_0xc1dc('0x24')]);if(_0xfeb0b1['name']){delete _0xfeb0b1[_0xc1dc('0x25')];}_0x49aab6[_0xc1dc('0x17')](_0x18ef1e)[_0xc1dc('0x26')](_0xfeb0b1);};}exports[_0xc1dc('0x27')]=function(_0x354e71,_0x152a50){var _0xd67136={},_0x411ee0={},_0x204b8a={'count':0x0,'rows':[]};var _0x5dbd36=_[_0xc1dc('0x28')](db[_0xc1dc('0x29')][_0xc1dc('0x2a')],function(_0x27e54d){return{'name':_0x27e54d[_0xc1dc('0x2b')],'type':_0x27e54d[_0xc1dc('0x2c')][_0xc1dc('0x2d')]};});_0x411ee0[_0xc1dc('0x2e')]=_[_0xc1dc('0x28')](_0x5dbd36,_0xc1dc('0x25'));_0x411ee0[_0xc1dc('0x2f')]=_['keys'](_0x354e71[_0xc1dc('0x2f')]);_0x411ee0[_0xc1dc('0x30')]=_[_0xc1dc('0x31')](_0x411ee0[_0xc1dc('0x2e')],_0x411ee0[_0xc1dc('0x2f')]);_0xd67136[_0xc1dc('0x32')]=_[_0xc1dc('0x31')](_0x411ee0[_0xc1dc('0x2e')],qs[_0xc1dc('0x33')](_0x354e71['query']['fields']));_0xd67136[_0xc1dc('0x32')]=_0xd67136[_0xc1dc('0x32')][_0xc1dc('0x34')]?_0xd67136[_0xc1dc('0x32')]:_0x411ee0[_0xc1dc('0x2e')];if(!_0x354e71[_0xc1dc('0x2f')]['hasOwnProperty'](_0xc1dc('0x35'))){_0xd67136[_0xc1dc('0x1c')]=qs['limit'](_0x354e71[_0xc1dc('0x2f')][_0xc1dc('0x1c')]);_0xd67136['offset']=qs[_0xc1dc('0x1b')](_0x354e71[_0xc1dc('0x2f')][_0xc1dc('0x1b')]);}_0xd67136['order']=qs[_0xc1dc('0x36')](_0x354e71[_0xc1dc('0x2f')][_0xc1dc('0x36')]);_0xd67136[_0xc1dc('0x37')]=qs[_0xc1dc('0x30')](_[_0xc1dc('0x38')](_0x354e71[_0xc1dc('0x2f')],_0x411ee0[_0xc1dc('0x30')]),_0x5dbd36);if(_0x354e71[_0xc1dc('0x2f')]['filter']){_0xd67136[_0xc1dc('0x37')]=_[_0xc1dc('0x39')](_0xd67136[_0xc1dc('0x37')],{'$or':_['map'](_0x5dbd36,function(_0x19bde9){if(_0x19bde9[_0xc1dc('0x2c')]!==_0xc1dc('0x3a')){var _0x1cbd9c={};_0x1cbd9c[_0x19bde9[_0xc1dc('0x25')]]={'$like':'%'+_0x354e71[_0xc1dc('0x2f')][_0xc1dc('0x3b')]+'%'};return _0x1cbd9c;}})});}_0xd67136=_[_0xc1dc('0x39')]({},_0xd67136,_0x354e71['options']);var _0x16356d={'where':_0xd67136[_0xc1dc('0x37')]};return db[_0xc1dc('0x29')][_0xc1dc('0x1a')](_0x16356d)[_0xc1dc('0x20')](function(_0x1fbdb8){_0x204b8a['count']=_0x1fbdb8;if(_0x354e71[_0xc1dc('0x2f')][_0xc1dc('0x3c')]){_0xd67136[_0xc1dc('0x3d')]=[{'all':!![]}];}return db[_0xc1dc('0x29')][_0xc1dc('0x3e')](_0xd67136);})['then'](function(_0x59af8a){_0x204b8a[_0xc1dc('0x3f')]=_0x59af8a;return _0x204b8a;})[_0xc1dc('0x20')](respondWithFilteredResult(_0x152a50,_0xd67136))[_0xc1dc('0x40')](handleError(_0x152a50,null));};exports[_0xc1dc('0x41')]=function(_0x2c3bd7,_0x2b4190){var _0x2e2f5c={'raw':!![],'where':{'id':_0x2c3bd7[_0xc1dc('0x42')]['id']}},_0x4f03c6={};_0x4f03c6[_0xc1dc('0x2e')]=_[_0xc1dc('0x43')](db['VtigerField'][_0xc1dc('0x2a')]);_0x4f03c6[_0xc1dc('0x2f')]=_[_0xc1dc('0x43')](_0x2c3bd7[_0xc1dc('0x2f')]);_0x4f03c6['filters']=_['intersection'](_0x4f03c6[_0xc1dc('0x2e')],_0x4f03c6[_0xc1dc('0x2f')]);_0x2e2f5c['attributes']=_[_0xc1dc('0x31')](_0x4f03c6[_0xc1dc('0x2e')],qs[_0xc1dc('0x33')](_0x2c3bd7[_0xc1dc('0x2f')][_0xc1dc('0x33')]));_0x2e2f5c[_0xc1dc('0x32')]=_0x2e2f5c[_0xc1dc('0x32')]['length']?_0x2e2f5c['attributes']:_0x4f03c6[_0xc1dc('0x2e')];if(_0x2c3bd7['query'][_0xc1dc('0x3c')]){_0x2e2f5c[_0xc1dc('0x3d')]=[{'all':!![]}];}_0x2e2f5c=_[_0xc1dc('0x39')]({},_0x2e2f5c,_0x2c3bd7[_0xc1dc('0x44')]);return db[_0xc1dc('0x29')][_0xc1dc('0x45')](_0x2e2f5c)[_0xc1dc('0x20')](handleEntityNotFound(_0x2b4190,null))[_0xc1dc('0x20')](respondWithResult(_0x2b4190,null))['catch'](handleError(_0x2b4190,null));};exports[_0xc1dc('0x46')]=function(_0x2dc9d6,_0x623e4b){return db[_0xc1dc('0x29')][_0xc1dc('0x46')](_0x2dc9d6[_0xc1dc('0x47')],{})[_0xc1dc('0x20')](respondWithResult(_0x623e4b,0xc9))[_0xc1dc('0x40')](handleError(_0x623e4b,null));};exports[_0xc1dc('0x48')]=function(_0x29417d,_0x49d10c){if(_0x29417d['body']['id']){delete _0x29417d['body']['id'];}return db[_0xc1dc('0x29')][_0xc1dc('0x45')]({'where':{'id':_0x29417d['params']['id']}})[_0xc1dc('0x20')](handleEntityNotFound(_0x49d10c,null))[_0xc1dc('0x20')](saveUpdates(_0x29417d['body'],null))[_0xc1dc('0x20')](respondWithResult(_0x49d10c,null))['catch'](handleError(_0x49d10c,null));};exports[_0xc1dc('0x21')]=function(_0x1d1706,_0x639ed){return db[_0xc1dc('0x29')][_0xc1dc('0x45')]({'where':{'id':_0x1d1706[_0xc1dc('0x42')]['id']}})[_0xc1dc('0x20')](handleEntityNotFound(_0x639ed,null))[_0xc1dc('0x20')](removeEntity(_0x639ed,null))['catch'](handleError(_0x639ed,null));}; \ No newline at end of file +var _0x41d0=['key','keys','intersection','query','attributes','model','fields','length','nolimit','sort','where','pick','filters','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','update','then','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type'];(function(_0xee2e7a,_0x58354d){var _0x319dd3=function(_0xa99240){while(--_0xa99240){_0xee2e7a['push'](_0xee2e7a['shift']());}};_0x319dd3(++_0x58354d);}(_0x41d0,0x1c6));var _0x041d=function(_0x4a77e4,_0x556f71){_0x4a77e4=_0x4a77e4-0x0;var _0x1c68d8=_0x41d0[_0x4a77e4];return _0x1c68d8;};'use strict';var pdf=require(_0x041d('0x0'));var emlformat=require(_0x041d('0x1'));var rimraf=require(_0x041d('0x2'));var zipdir=require(_0x041d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x041d('0x4'));var moment=require(_0x041d('0x5'));var BPromise=require(_0x041d('0x6'));var Mustache=require(_0x041d('0x7'));var util=require(_0x041d('0x8'));var path=require(_0x041d('0x9'));var sox=require(_0x041d('0xa'));var csv=require(_0x041d('0xb'));var ejs=require(_0x041d('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x041d('0xd'));var crypto=require('crypto');var jsforce=require(_0x041d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x041d('0xb'));var querystring=require(_0x041d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x041d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x041d('0x11'));var logger=require('../../config/logger')(_0x041d('0x12'));var utils=require(_0x041d('0x13'));var config=require(_0x041d('0x14'));var licenseUtil=require(_0x041d('0x15'));var db=require(_0x041d('0x16'))['db'];function respondWithStatusCode(_0x51b1d1,_0x34b0f9){_0x34b0f9=_0x34b0f9||0xcc;return function(_0x111e9b){if(_0x111e9b){return _0x51b1d1[_0x041d('0x17')](_0x34b0f9);}return _0x51b1d1['status'](_0x34b0f9)[_0x041d('0x18')]();};}function respondWithResult(_0x3205ea,_0x61dc3b){_0x61dc3b=_0x61dc3b||0xc8;return function(_0x1efe79){if(_0x1efe79){return _0x3205ea[_0x041d('0x19')](_0x61dc3b)[_0x041d('0x1a')](_0x1efe79);}};}function respondWithFilteredResult(_0x481221,_0xaadc6f){return function(_0x167cfe){if(_0x167cfe){var _0x362289=_0x167cfe['count'],_0x1f7ef6=_0xaadc6f['offset'],_0x287fde=_0xaadc6f[_0x041d('0x1b')]+_0xaadc6f[_0x041d('0x1c')],_0x1c581b;if(_0x287fde>=_0x362289){_0x287fde=_0x362289;_0x1c581b=0xc8;}else{_0x1c581b=0xce;}_0x481221['status'](_0x1c581b);return _0x481221[_0x041d('0x1d')]('Content-Range',_0x1f7ef6+'-'+_0x287fde+'/'+_0x362289)[_0x041d('0x1a')](_0x167cfe);}return null;};}function patchUpdates(_0x2d51dc){return function(_0x137878){try{jsonpatch['apply'](_0x137878,_0x2d51dc,!![]);}catch(_0x3505e7){return BPromise['reject'](_0x3505e7);}return _0x137878['save']();};}function saveUpdates(_0x22a8d9,_0x597c1d){return function(_0x211bb6){if(_0x211bb6){return _0x211bb6[_0x041d('0x1e')](_0x22a8d9)[_0x041d('0x1f')](function(_0x3c4417){return _0x3c4417;});}return null;};}function removeEntity(_0xb6ec9a,_0x6ee379){return function(_0x437841){if(_0x437841){return _0x437841[_0x041d('0x20')]()['then'](function(){_0xb6ec9a[_0x041d('0x19')](0xcc)[_0x041d('0x18')]();});}};}function handleEntityNotFound(_0x6058d7,_0x6c8547){return function(_0x7f80d6){if(!_0x7f80d6){_0x6058d7['sendStatus'](0x194);}return _0x7f80d6;};}function handleError(_0x3c8715,_0x31481d){_0x31481d=_0x31481d||0x1f4;return function(_0x3e04e3){logger[_0x041d('0x21')](_0x3e04e3[_0x041d('0x22')]);if(_0x3e04e3[_0x041d('0x23')]){delete _0x3e04e3[_0x041d('0x23')];}_0x3c8715[_0x041d('0x19')](_0x31481d)[_0x041d('0x24')](_0x3e04e3);};}exports[_0x041d('0x25')]=function(_0x366fe8,_0xaa3bc0){var _0x9d3655={},_0x2383ef={},_0x417411={'count':0x0,'rows':[]};var _0x3d89c6=_[_0x041d('0x26')](db[_0x041d('0x27')][_0x041d('0x28')],function(_0x18b06b){return{'name':_0x18b06b[_0x041d('0x29')],'type':_0x18b06b[_0x041d('0x2a')][_0x041d('0x2b')]};});_0x2383ef['model']=_[_0x041d('0x26')](_0x3d89c6,_0x041d('0x23'));_0x2383ef['query']=_[_0x041d('0x2c')](_0x366fe8['query']);_0x2383ef['filters']=_[_0x041d('0x2d')](_0x2383ef['model'],_0x2383ef[_0x041d('0x2e')]);_0x9d3655[_0x041d('0x2f')]=_['intersection'](_0x2383ef[_0x041d('0x30')],qs[_0x041d('0x31')](_0x366fe8[_0x041d('0x2e')][_0x041d('0x31')]));_0x9d3655['attributes']=_0x9d3655[_0x041d('0x2f')][_0x041d('0x32')]?_0x9d3655[_0x041d('0x2f')]:_0x2383ef[_0x041d('0x30')];if(!_0x366fe8[_0x041d('0x2e')]['hasOwnProperty'](_0x041d('0x33'))){_0x9d3655['limit']=qs[_0x041d('0x1c')](_0x366fe8[_0x041d('0x2e')]['limit']);_0x9d3655['offset']=qs[_0x041d('0x1b')](_0x366fe8[_0x041d('0x2e')][_0x041d('0x1b')]);}_0x9d3655['order']=qs[_0x041d('0x34')](_0x366fe8[_0x041d('0x2e')][_0x041d('0x34')]);_0x9d3655[_0x041d('0x35')]=qs['filters'](_[_0x041d('0x36')](_0x366fe8['query'],_0x2383ef[_0x041d('0x37')]),_0x3d89c6);if(_0x366fe8[_0x041d('0x2e')]['filter']){_0x9d3655[_0x041d('0x35')]=_['merge'](_0x9d3655[_0x041d('0x35')],{'$or':_[_0x041d('0x26')](_0x3d89c6,function(_0x4bf62e){if(_0x4bf62e[_0x041d('0x2a')]!==_0x041d('0x38')){var _0x4bdfcb={};_0x4bdfcb[_0x4bf62e[_0x041d('0x23')]]={'$like':'%'+_0x366fe8[_0x041d('0x2e')][_0x041d('0x39')]+'%'};return _0x4bdfcb;}})});}_0x9d3655=_[_0x041d('0x3a')]({},_0x9d3655,_0x366fe8[_0x041d('0x3b')]);var _0xf32448={'where':_0x9d3655[_0x041d('0x35')]};return db[_0x041d('0x27')][_0x041d('0x3c')](_0xf32448)[_0x041d('0x1f')](function(_0x3ba33a){_0x417411[_0x041d('0x3c')]=_0x3ba33a;if(_0x366fe8['query'][_0x041d('0x3d')]){_0x9d3655[_0x041d('0x3e')]=[{'all':!![]}];}return db[_0x041d('0x27')][_0x041d('0x3f')](_0x9d3655);})['then'](function(_0x2c1430){_0x417411[_0x041d('0x40')]=_0x2c1430;return _0x417411;})[_0x041d('0x1f')](respondWithFilteredResult(_0xaa3bc0,_0x9d3655))[_0x041d('0x41')](handleError(_0xaa3bc0,null));};exports[_0x041d('0x42')]=function(_0x10156e,_0x27745c){var _0x47004a={'raw':!![],'where':{'id':_0x10156e['params']['id']}},_0x979449={};_0x979449[_0x041d('0x30')]=_[_0x041d('0x2c')](db['VtigerField']['rawAttributes']);_0x979449['query']=_['keys'](_0x10156e['query']);_0x979449[_0x041d('0x37')]=_[_0x041d('0x2d')](_0x979449['model'],_0x979449['query']);_0x47004a[_0x041d('0x2f')]=_[_0x041d('0x2d')](_0x979449[_0x041d('0x30')],qs[_0x041d('0x31')](_0x10156e['query']['fields']));_0x47004a[_0x041d('0x2f')]=_0x47004a[_0x041d('0x2f')][_0x041d('0x32')]?_0x47004a[_0x041d('0x2f')]:_0x979449[_0x041d('0x30')];if(_0x10156e[_0x041d('0x2e')][_0x041d('0x3d')]){_0x47004a['include']=[{'all':!![]}];}_0x47004a=_[_0x041d('0x3a')]({},_0x47004a,_0x10156e[_0x041d('0x3b')]);return db[_0x041d('0x27')][_0x041d('0x43')](_0x47004a)[_0x041d('0x1f')](handleEntityNotFound(_0x27745c,null))['then'](respondWithResult(_0x27745c,null))['catch'](handleError(_0x27745c,null));};exports['create']=function(_0x4be216,_0x1b761b){return db[_0x041d('0x27')][_0x041d('0x44')](_0x4be216['body'],{})['then'](respondWithResult(_0x1b761b,0xc9))[_0x041d('0x41')](handleError(_0x1b761b,null));};exports[_0x041d('0x1e')]=function(_0x3e06e9,_0x59e60d){if(_0x3e06e9['body']['id']){delete _0x3e06e9[_0x041d('0x45')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x3e06e9['params']['id']}})[_0x041d('0x1f')](handleEntityNotFound(_0x59e60d,null))[_0x041d('0x1f')](saveUpdates(_0x3e06e9[_0x041d('0x45')],null))[_0x041d('0x1f')](respondWithResult(_0x59e60d,null))[_0x041d('0x41')](handleError(_0x59e60d,null));};exports['destroy']=function(_0x548073,_0x7dd672){return db[_0x041d('0x27')][_0x041d('0x43')]({'where':{'id':_0x548073[_0x041d('0x46')]['id']}})['then'](handleEntityNotFound(_0x7dd672,null))[_0x041d('0x1f')](removeEntity(_0x7dd672,null))[_0x041d('0x41')](handleError(_0x7dd672,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index ba91caf..84b0e62 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 _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0xe8e0d5,_0x6dc83a){var _0x22786e=function(_0x9dfbb1){while(--_0x9dfbb1){_0xe8e0d5['push'](_0xe8e0d5['shift']());}};_0x22786e(++_0x6dc83a);}(_0x7a54,0x106));var _0x47a5=function(_0x2cd703,_0x13e43b){_0x2cd703=_0x2cd703-0x0;var _0xeb3fe0=_0x7a54[_0x2cd703];return _0xeb3fe0;};'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':'vtiger_unique_index','fields':[_0x47a5('0xc'),'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 b28b8f5..7352189 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 _0x851a=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x400646,_0x2cd440){var _0x3126a5=function(_0x177540){while(--_0x177540){_0x400646['push'](_0x400646['shift']());}};_0x3126a5(++_0x2cd440);}(_0x851a,0x19b));var _0xa851=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x851a[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0xa851('0x0'));var util=require('util');var moment=require(_0xa851('0x1'));var BPromise=require(_0xa851('0x2'));var rs=require(_0xa851('0x3'));var fs=require('fs');var Redis=require(_0xa851('0x4'));var db=require(_0xa851('0x5'))['db'];var utils=require(_0xa851('0x6'));var logger=require(_0xa851('0x7'))(_0xa851('0x8'));var config=require('../../config/environment');var jayson=require(_0xa851('0x9'));var client=jayson['client'][_0xa851('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fc0e0,_0x2f1f42,_0x551e16){return new BPromise(function(_0x3e1e9d,_0xa2162e){return client[_0xa851('0xb')](_0x2fc0e0,_0x551e16)[_0xa851('0xc')](function(_0x51f1be){logger[_0xa851('0xd')](_0xa851('0xe'),_0x2f1f42,'request\x20sent');logger[_0xa851('0xf')](_0xa851('0x10'),_0x2f1f42,_0xa851('0x11'),JSON[_0xa851('0x12')](_0x51f1be));if(_0x51f1be[_0xa851('0x13')]){if(_0x51f1be[_0xa851('0x13')][_0xa851('0x14')]===0x1f4){logger[_0xa851('0x13')](_0xa851('0xe'),_0x2f1f42,_0x51f1be[_0xa851('0x13')][_0xa851('0x15')]);return _0xa2162e(_0x51f1be[_0xa851('0x13')][_0xa851('0x15')]);}logger[_0xa851('0x13')](_0xa851('0xe'),_0x2f1f42,_0x51f1be[_0xa851('0x13')][_0xa851('0x15')]);return _0x3e1e9d(_0x51f1be[_0xa851('0x13')]['message']);}else{logger[_0xa851('0xd')](_0xa851('0xe'),_0x2f1f42,_0xa851('0x11'));_0x3e1e9d(_0x51f1be[_0xa851('0x16')]['message']);}})[_0xa851('0x17')](function(_0x1f38da){logger[_0xa851('0x13')](_0xa851('0xe'),_0x2f1f42,_0x1f38da);_0xa2162e(_0x1f38da);});});} \ No newline at end of file +var _0x18c9=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','lodash','util','moment','bluebird'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x18c9,0x13c));var _0x918c=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x18c9[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x918c('0x0'));var util=require(_0x918c('0x1'));var moment=require(_0x918c('0x2'));var BPromise=require(_0x918c('0x3'));var rs=require(_0x918c('0x4'));var fs=require('fs');var Redis=require(_0x918c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x918c('0x6'));var logger=require(_0x918c('0x7'))('rpc');var config=require(_0x918c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x918c('0x9')][_0x918c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x467d0b,_0x2aa435,_0x2a8add){return new BPromise(function(_0x4ad426,_0x2845d2){return client['request'](_0x467d0b,_0x2a8add)['then'](function(_0xc0b338){logger[_0x918c('0xb')](_0x918c('0xc'),_0x2aa435,_0x918c('0xd'));logger[_0x918c('0xe')](_0x918c('0xf'),_0x2aa435,_0x918c('0xd'),JSON[_0x918c('0x10')](_0xc0b338));if(_0xc0b338['error']){if(_0xc0b338['error'][_0x918c('0x11')]===0x1f4){logger[_0x918c('0x12')](_0x918c('0xc'),_0x2aa435,_0xc0b338[_0x918c('0x12')][_0x918c('0x13')]);return _0x2845d2(_0xc0b338['error'][_0x918c('0x13')]);}logger[_0x918c('0x12')](_0x918c('0xc'),_0x2aa435,_0xc0b338[_0x918c('0x12')][_0x918c('0x13')]);return _0x4ad426(_0xc0b338[_0x918c('0x12')][_0x918c('0x13')]);}else{logger[_0x918c('0xb')](_0x918c('0xc'),_0x2aa435,'request\x20sent');_0x4ad426(_0xc0b338['result']['message']);}})['catch'](function(_0x4fa363){logger[_0x918c('0x12')]('VtigerField,\x20%s,\x20%s',_0x2aa435,_0x4fa363);_0x2845d2(_0x4fa363);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 3dfb5e9..cdabf45 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 _0xe20e=['post','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout','express','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create'];(function(_0x2ac7f6,_0x369b4b){var _0x41ba26=function(_0x26f695){while(--_0x26f695){_0x2ac7f6['push'](_0x2ac7f6['shift']());}};_0x41ba26(++_0x369b4b);}(_0xe20e,0x195));var _0xee20=function(_0x5e4c34,_0x387a28){_0x5e4c34=_0x5e4c34-0x0;var _0xfd8fb0=_0xe20e[_0x5e4c34];return _0xfd8fb0;};'use strict';var multer=require(_0xee20('0x0'));var util=require(_0xee20('0x1'));var path=require('path');var timeout=require(_0xee20('0x2'));var express=require(_0xee20('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xee20('0x4'));var config=require('../../config/environment');var controller=require(_0xee20('0x5'));router[_0xee20('0x6')]('/',auth[_0xee20('0x7')](),controller[_0xee20('0x8')]);router[_0xee20('0x6')](_0xee20('0x9'),auth[_0xee20('0x7')](),controller[_0xee20('0xa')]);router[_0xee20('0x6')](_0xee20('0xb'),auth[_0xee20('0x7')](),controller[_0xee20('0xc')]);router['get'](_0xee20('0xd'),auth[_0xee20('0x7')](),controller['getFields']);router['post']('/',auth[_0xee20('0x7')](),controller[_0xee20('0xe')]);router[_0xee20('0xf')](_0xee20('0xb'),auth['isAuthenticated'](),controller[_0xee20('0x10')]);router[_0xee20('0x11')](_0xee20('0x9'),auth[_0xee20('0x7')](),controller[_0xee20('0x12')]);router[_0xee20('0x13')](_0xee20('0x9'),auth['isAuthenticated'](),controller[_0xee20('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc224=['isAuthenticated','index','get','/:id','show','getFields','post','/:id/configurations','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller'];(function(_0x27ffa0,_0x3e6c4a){var _0x37c18b=function(_0x3accb1){while(--_0x3accb1){_0x27ffa0['push'](_0x27ffa0['shift']());}};_0x37c18b(++_0x3e6c4a);}(_0xc224,0x15c));var _0x4c22=function(_0x40e13a,_0x5672b6){_0x40e13a=_0x40e13a-0x0;var _0x4bd9ef=_0xc224[_0x40e13a];return _0x4bd9ef;};'use strict';var multer=require(_0x4c22('0x0'));var util=require(_0x4c22('0x1'));var path=require(_0x4c22('0x2'));var timeout=require(_0x4c22('0x3'));var express=require(_0x4c22('0x4'));var router=express[_0x4c22('0x5')]();var auth=require(_0x4c22('0x6'));var interaction=require(_0x4c22('0x7'));var config=require('../../config/environment');var controller=require(_0x4c22('0x8'));router['get']('/',auth[_0x4c22('0x9')](),controller[_0x4c22('0xa')]);router[_0x4c22('0xb')](_0x4c22('0xc'),auth[_0x4c22('0x9')](),controller[_0x4c22('0xd')]);router[_0x4c22('0xb')]('/:id/configurations',auth[_0x4c22('0x9')](),controller['getConfigurations']);router[_0x4c22('0xb')]('/:id/fields',auth[_0x4c22('0x9')](),controller[_0x4c22('0xe')]);router[_0x4c22('0xf')]('/',auth[_0x4c22('0x9')](),controller['create']);router[_0x4c22('0xf')](_0x4c22('0x10'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x4c22('0x11')](_0x4c22('0xc'),auth[_0x4c22('0x9')](),controller[_0x4c22('0x12')]);router[_0x4c22('0x13')](_0x4c22('0xc'),auth[_0x4c22('0x9')](),controller[_0x4c22('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index e4f022f..82c086b 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 _0x32c1=['token','password','integrationTab','STRING','username','ENUM'];(function(_0x2263d4,_0x18aee4){var _0x466313=function(_0x3d65e1){while(--_0x3d65e1){_0x2263d4['push'](_0x2263d4['shift']());}};_0x466313(++_0x18aee4);}(_0x32c1,0x1ad));var _0x132c=function(_0xa6b8ce,_0x1c5b62){_0xa6b8ce=_0xa6b8ce-0x0;var _0x4575df=_0x32c1[_0xa6b8ce];return _0x4575df;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x132c('0x0')]},'description':{'type':Sequelize[_0x132c('0x0')]},'username':{'type':Sequelize[_0x132c('0x0')],'unique':_0x132c('0x1')},'password':{'type':Sequelize[_0x132c('0x0')]},'token':{'type':Sequelize[_0x132c('0x0')]},'remoteUri':{'type':Sequelize[_0x132c('0x0')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x132c('0x2')]('password',_0x132c('0x3')),'defaultValue':_0x132c('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x132c('0x2')](_0x132c('0x5'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xc2f3=['integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM','password','token'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc2f3,0x124));var _0x3c2f=function(_0x1338a1,_0x1537bc){_0x1338a1=_0x1338a1-0x0;var _0x4d582c=_0xc2f3[_0x1338a1];return _0x4d582c;};'use strict';var Sequelize=require(_0x3c2f('0x0'));module[_0x3c2f('0x1')]={'name':{'type':Sequelize[_0x3c2f('0x2')]},'description':{'type':Sequelize[_0x3c2f('0x2')]},'username':{'type':Sequelize[_0x3c2f('0x2')],'unique':_0x3c2f('0x3')},'password':{'type':Sequelize[_0x3c2f('0x2')]},'token':{'type':Sequelize[_0x3c2f('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x3c2f('0x4')},'authType':{'type':Sequelize[_0x3c2f('0x5')](_0x3c2f('0x6'),_0x3c2f('0x7')),'defaultValue':_0x3c2f('0x6')},'serverUrl':{'type':Sequelize[_0x3c2f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3c2f('0x5')](_0x3c2f('0x8'),_0x3c2f('0x9')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index e3e7c94..4131a48 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 _0x584a=['ZendeskAccount','rawAttributes','fieldName','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','type','VIRTUAL','merge','includeAll','include','findAll','show','params','options','find','create','body','findOne','pick','getConfigurations','addConfiguration','AccountId','Subjects','getDescriptions','channel','ZendeskConfiguration','ZendeskField','Descriptions','username','token','authType','remoteUri','substring','lastIndexOf','format','%s/%s','ticket_fields','Basic\x20%s','%s:%s','password','toString','headers','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','squel','crypto','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','jayson/promise','client','http','request','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','sendStatus','status','json','count','offset','set','apply','reject','save','then','destroy','end','stack','send','map'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x584a,0x1c0));var _0xa584=function(_0x79cd47,_0x16102d){_0x79cd47=_0x79cd47-0x0;var _0x3b9484=_0x584a[_0x79cd47];return _0x3b9484;};'use strict';var pdf=require(_0xa584('0x0'));var emlformat=require(_0xa584('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa584('0x2'));var jsonpatch=require(_0xa584('0x3'));var rp=require(_0xa584('0x4'));var moment=require(_0xa584('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa584('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa584('0x7'));var ejs=require(_0xa584('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa584('0x9'));var crypto=require(_0xa584('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa584('0xb'));var Papa=require(_0xa584('0xc'));var Redis=require(_0xa584('0xd'));var authService=require(_0xa584('0xe'));var qs=require(_0xa584('0xf'));var as=require(_0xa584('0x10'));var hardwareService=require(_0xa584('0x11'));var logger=require(_0xa584('0x12'))(_0xa584('0x13'));var utils=require(_0xa584('0x14'));var config=require(_0xa584('0x15'));var licenseUtil=require(_0xa584('0x16'));var db=require(_0xa584('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xa584('0x18'));var client=jayson[_0xa584('0x19')][_0xa584('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x226536,_0x37cc7d,_0x4a7bb2,_0x15e73a){return new BPromise(function(_0x30a56e,_0x5d0c64){var _0x1a1306=_0x15e73a||client;return _0x1a1306[_0xa584('0x1b')](_0x226536,_0x4a7bb2)['then'](function(_0x36a630){logger['info'](_0xa584('0x1c'),_0x37cc7d,_0xa584('0x1d'));logger[_0xa584('0x1e')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x37cc7d,_0xa584('0x1d'),JSON[_0xa584('0x1f')](_0x36a630));if(_0x36a630[_0xa584('0x20')]){if(_0x36a630['error'][_0xa584('0x21')]===0x1f4){logger['error'](_0xa584('0x1c'),_0x37cc7d,_0x36a630[_0xa584('0x20')]['message']);return _0x5d0c64(_0x36a630[_0xa584('0x20')][_0xa584('0x22')]);}logger[_0xa584('0x20')](_0xa584('0x1c'),_0x37cc7d,_0x36a630[_0xa584('0x20')][_0xa584('0x22')]);return _0x30a56e(_0x36a630[_0xa584('0x20')][_0xa584('0x22')]);}else{logger[_0xa584('0x23')](_0xa584('0x1c'),_0x37cc7d,_0xa584('0x1d'));_0x30a56e(_0x36a630['result']['message']);}})[_0xa584('0x24')](function(_0x1a8d86){logger[_0xa584('0x20')](_0xa584('0x1c'),_0x37cc7d,_0x1a8d86);_0x5d0c64(_0x1a8d86);});});}function respondWithStatusCode(_0x25a228,_0x3c9e92){_0x3c9e92=_0x3c9e92||0xcc;return function(_0x33bf24){if(_0x33bf24){return _0x25a228[_0xa584('0x25')](_0x3c9e92);}return _0x25a228[_0xa584('0x26')](_0x3c9e92)['end']();};}function respondWithResult(_0x24a65f,_0x4ccc95){_0x4ccc95=_0x4ccc95||0xc8;return function(_0x42ee1a){if(_0x42ee1a){return _0x24a65f[_0xa584('0x26')](_0x4ccc95)[_0xa584('0x27')](_0x42ee1a);}};}function respondWithFilteredResult(_0x3d11cf,_0x570242){return function(_0x1d15c5){if(_0x1d15c5){var _0x53d14b=_0x1d15c5[_0xa584('0x28')],_0x329add=_0x570242['offset'],_0x3dd79f=_0x570242[_0xa584('0x29')]+_0x570242['limit'],_0x2db8d;if(_0x3dd79f>=_0x53d14b){_0x3dd79f=_0x53d14b;_0x2db8d=0xc8;}else{_0x2db8d=0xce;}_0x3d11cf['status'](_0x2db8d);return _0x3d11cf[_0xa584('0x2a')]('Content-Range',_0x329add+'-'+_0x3dd79f+'/'+_0x53d14b)[_0xa584('0x27')](_0x1d15c5);}return null;};}function patchUpdates(_0x35bb55){return function(_0x4dc9c9){try{jsonpatch[_0xa584('0x2b')](_0x4dc9c9,_0x35bb55,!![]);}catch(_0x8300d8){return BPromise[_0xa584('0x2c')](_0x8300d8);}return _0x4dc9c9[_0xa584('0x2d')]();};}function saveUpdates(_0x6d47ba,_0xf371f0){return function(_0x3ae0eb){if(_0x3ae0eb){return _0x3ae0eb['update'](_0x6d47ba)[_0xa584('0x2e')](function(_0x196162){return _0x196162;});}return null;};}function removeEntity(_0x45d55,_0x59a549){return function(_0x386ccf){if(_0x386ccf){return _0x386ccf[_0xa584('0x2f')]()[_0xa584('0x2e')](function(){_0x45d55[_0xa584('0x26')](0xcc)[_0xa584('0x30')]();});}};}function handleEntityNotFound(_0x292c57,_0x4225ac){return function(_0x142a57){if(!_0x142a57){_0x292c57['sendStatus'](0x194);}return _0x142a57;};}function handleError(_0x3aed54,_0x5775a8){_0x5775a8=_0x5775a8||0x1f4;return function(_0x2c8335){logger['error'](_0x2c8335[_0xa584('0x31')]);if(_0x2c8335['name']){delete _0x2c8335['name'];}_0x3aed54[_0xa584('0x26')](_0x5775a8)[_0xa584('0x32')](_0x2c8335);};}exports['index']=function(_0x1db431,_0x1b3863){var _0x26c517={},_0x47f3c9={},_0x56df8b={'count':0x0,'rows':[]};var _0x11966f=_[_0xa584('0x33')](db[_0xa584('0x34')][_0xa584('0x35')],function(_0x22c888){return{'name':_0x22c888[_0xa584('0x36')],'type':_0x22c888['type'][_0xa584('0x37')]};});_0x47f3c9[_0xa584('0x38')]=_[_0xa584('0x33')](_0x11966f,_0xa584('0x39'));_0x47f3c9['query']=_[_0xa584('0x3a')](_0x1db431[_0xa584('0x3b')]);_0x47f3c9[_0xa584('0x3c')]=_[_0xa584('0x3d')](_0x47f3c9[_0xa584('0x38')],_0x47f3c9[_0xa584('0x3b')]);_0x26c517[_0xa584('0x3e')]=_[_0xa584('0x3d')](_0x47f3c9[_0xa584('0x38')],qs[_0xa584('0x3f')](_0x1db431[_0xa584('0x3b')][_0xa584('0x3f')]));_0x26c517['attributes']=_0x26c517[_0xa584('0x3e')][_0xa584('0x40')]?_0x26c517[_0xa584('0x3e')]:_0x47f3c9['model'];if(!_0x1db431['query'][_0xa584('0x41')](_0xa584('0x42'))){_0x26c517[_0xa584('0x43')]=qs['limit'](_0x1db431[_0xa584('0x3b')][_0xa584('0x43')]);_0x26c517[_0xa584('0x29')]=qs['offset'](_0x1db431[_0xa584('0x3b')][_0xa584('0x29')]);}_0x26c517[_0xa584('0x44')]=qs[_0xa584('0x45')](_0x1db431[_0xa584('0x3b')][_0xa584('0x45')]);_0x26c517[_0xa584('0x46')]=qs['filters'](_['pick'](_0x1db431[_0xa584('0x3b')],_0x47f3c9[_0xa584('0x3c')]),_0x11966f);if(_0x1db431[_0xa584('0x3b')][_0xa584('0x47')]){_0x26c517[_0xa584('0x46')]=_['merge'](_0x26c517[_0xa584('0x46')],{'$or':_[_0xa584('0x33')](_0x11966f,function(_0x46693d){if(_0x46693d[_0xa584('0x48')]!==_0xa584('0x49')){var _0xe8bd40={};_0xe8bd40[_0x46693d[_0xa584('0x39')]]={'$like':'%'+_0x1db431[_0xa584('0x3b')]['filter']+'%'};return _0xe8bd40;}})});}_0x26c517=_[_0xa584('0x4a')]({},_0x26c517,_0x1db431['options']);var _0x1c29f9={'where':_0x26c517[_0xa584('0x46')]};return db['ZendeskAccount']['count'](_0x1c29f9)[_0xa584('0x2e')](function(_0x369020){_0x56df8b[_0xa584('0x28')]=_0x369020;if(_0x1db431[_0xa584('0x3b')][_0xa584('0x4b')]){_0x26c517[_0xa584('0x4c')]=[{'all':!![]}];}return db[_0xa584('0x34')][_0xa584('0x4d')](_0x26c517);})[_0xa584('0x2e')](function(_0x1daa8a){_0x56df8b['rows']=_0x1daa8a;return _0x56df8b;})[_0xa584('0x2e')](respondWithFilteredResult(_0x1b3863,_0x26c517))[_0xa584('0x24')](handleError(_0x1b3863,null));};exports[_0xa584('0x4e')]=function(_0x50116c,_0x384006){var _0x43ddfc={'raw':![],'where':{'id':_0x50116c[_0xa584('0x4f')]['id']}},_0x133570={};_0x133570[_0xa584('0x38')]=_[_0xa584('0x3a')](db[_0xa584('0x34')]['rawAttributes']);_0x133570[_0xa584('0x3b')]=_['keys'](_0x50116c['query']);_0x133570[_0xa584('0x3c')]=_[_0xa584('0x3d')](_0x133570['model'],_0x133570[_0xa584('0x3b')]);_0x43ddfc[_0xa584('0x3e')]=_[_0xa584('0x3d')](_0x133570[_0xa584('0x38')],qs[_0xa584('0x3f')](_0x50116c['query'][_0xa584('0x3f')]));_0x43ddfc['attributes']=_0x43ddfc['attributes']['length']?_0x43ddfc[_0xa584('0x3e')]:_0x133570[_0xa584('0x38')];if(_0x50116c[_0xa584('0x3b')][_0xa584('0x4b')]){_0x43ddfc[_0xa584('0x4c')]=[{'all':!![]}];}_0x43ddfc=_[_0xa584('0x4a')]({},_0x43ddfc,_0x50116c[_0xa584('0x50')]);return db[_0xa584('0x34')][_0xa584('0x51')](_0x43ddfc)['then'](handleEntityNotFound(_0x384006,null))[_0xa584('0x2e')](respondWithResult(_0x384006,null))[_0xa584('0x24')](handleError(_0x384006,null));};exports[_0xa584('0x52')]=function(_0x2f397b,_0x542460){return db['ZendeskAccount']['create'](_0x2f397b[_0xa584('0x53')],{})[_0xa584('0x2e')](respondWithResult(_0x542460,0xc9))['catch'](handleError(_0x542460,null));};exports['update']=function(_0x3f7ae3,_0x5b269d){if(_0x3f7ae3[_0xa584('0x53')]['id']){delete _0x3f7ae3[_0xa584('0x53')]['id'];}return db[_0xa584('0x34')][_0xa584('0x51')]({'where':{'id':_0x3f7ae3[_0xa584('0x4f')]['id']}})[_0xa584('0x2e')](handleEntityNotFound(_0x5b269d,null))[_0xa584('0x2e')](saveUpdates(_0x3f7ae3['body'],null))[_0xa584('0x2e')](respondWithResult(_0x5b269d,null))['catch'](handleError(_0x5b269d,null));};exports[_0xa584('0x2f')]=function(_0x2df195,_0x4719bb){return db['ZendeskAccount'][_0xa584('0x51')]({'where':{'id':_0x2df195[_0xa584('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4719bb,null))['then'](removeEntity(_0x4719bb,null))[_0xa584('0x24')](handleError(_0x4719bb,null));};exports['getConfigurations']=function(_0x1a78b4,_0x3279fa,_0x363ac3){var _0xb9c2fd={};var _0x68ce25={};var _0x36342b;var _0x669c9d;return db[_0xa584('0x34')][_0xa584('0x54')]({'where':{'id':_0x1a78b4[_0xa584('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3279fa,null))[_0xa584('0x2e')](function(_0x5e2dba){if(_0x5e2dba){_0x36342b=_0x5e2dba;_0x68ce25['model']=_[_0xa584('0x3a')](db['ZendeskConfiguration'][_0xa584('0x35')]);_0x68ce25[_0xa584('0x3b')]=_[_0xa584('0x3a')](_0x1a78b4[_0xa584('0x3b')]);_0x68ce25[_0xa584('0x3c')]=_[_0xa584('0x3d')](_0x68ce25[_0xa584('0x38')],_0x68ce25['query']);_0xb9c2fd[_0xa584('0x3e')]=_[_0xa584('0x3d')](_0x68ce25[_0xa584('0x38')],qs['fields'](_0x1a78b4[_0xa584('0x3b')]['fields']));_0xb9c2fd[_0xa584('0x3e')]=_0xb9c2fd[_0xa584('0x3e')][_0xa584('0x40')]?_0xb9c2fd['attributes']:_0x68ce25['model'];_0xb9c2fd[_0xa584('0x44')]=qs[_0xa584('0x45')](_0x1a78b4['query'][_0xa584('0x45')]);_0xb9c2fd[_0xa584('0x46')]=qs[_0xa584('0x3c')](_[_0xa584('0x55')](_0x1a78b4[_0xa584('0x3b')],_0x68ce25[_0xa584('0x3c')]));if(_0x1a78b4[_0xa584('0x3b')][_0xa584('0x47')]){_0xb9c2fd[_0xa584('0x46')]=_[_0xa584('0x4a')](_0xb9c2fd[_0xa584('0x46')],{'$or':_[_0xa584('0x33')](_0xb9c2fd[_0xa584('0x3e')],function(_0x1cc970){var _0x24d099={};_0x24d099[_0x1cc970]={'$like':'%'+_0x1a78b4[_0xa584('0x3b')]['filter']+'%'};return _0x24d099;})});}_0xb9c2fd=_[_0xa584('0x4a')]({},_0xb9c2fd,_0x1a78b4[_0xa584('0x50')]);return _0x36342b['getConfigurations'](_0xb9c2fd);}})['then'](function(_0x2e3542){if(_0x2e3542){_0x669c9d=_0x2e3542[_0xa584('0x40')];if(!_0x1a78b4['query']['hasOwnProperty'](_0xa584('0x42'))){_0xb9c2fd['limit']=qs[_0xa584('0x43')](_0x1a78b4[_0xa584('0x3b')][_0xa584('0x43')]);_0xb9c2fd['offset']=qs[_0xa584('0x29')](_0x1a78b4[_0xa584('0x3b')]['offset']);}return _0x36342b[_0xa584('0x56')](_0xb9c2fd);}})['then'](function(_0x4cc43a){if(_0x4cc43a){return _0x4cc43a?{'count':_0x669c9d,'rows':_0x4cc43a}:null;}})['then'](respondWithResult(_0x3279fa,null))[_0xa584('0x24')](handleError(_0x3279fa,null));};exports[_0xa584('0x57')]=function(_0x3c1b89,_0x3fd831,_0x1c76dc){if(_0x3c1b89[_0xa584('0x53')]['id']){delete _0x3c1b89[_0xa584('0x53')]['id'];}return db[_0xa584('0x34')][_0xa584('0x54')]({'where':{'id':_0x3c1b89[_0xa584('0x4f')]['id']}})[_0xa584('0x2e')](handleEntityNotFound(_0x3fd831,null))[_0xa584('0x2e')](function(_0x4572fe){if(_0x4572fe){_0x3c1b89[_0xa584('0x53')][_0xa584('0x58')]=_0x4572fe['id'];_0x3c1b89[_0xa584('0x53')][_0xa584('0x59')]=integrations['getSubjects'](_0x3c1b89[_0xa584('0x53')]['channel'],_0x3c1b89['body']['type']);_0x3c1b89[_0xa584('0x53')]['Descriptions']=integrations[_0xa584('0x5a')](_0x3c1b89[_0xa584('0x53')][_0xa584('0x5b')],_0x3c1b89[_0xa584('0x53')][_0xa584('0x48')]);return db[_0xa584('0x5c')][_0xa584('0x52')](_0x3c1b89['body'],{'include':[{'model':db[_0xa584('0x5d')],'as':_0xa584('0x59')},{'model':db[_0xa584('0x5d')],'as':_0xa584('0x5e')}]});}return null;})['then'](respondWithResult(_0x3fd831,null))[_0xa584('0x24')](handleError(_0x3fd831,null));};exports['getFields']=function(_0x4d102c,_0x4d5d81,_0x2aa73b){var _0x15ec66='';return db[_0xa584('0x34')][_0xa584('0x54')]({'where':{'id':_0x4d102c[_0xa584('0x4f')]['id']},'attributes':['id',_0xa584('0x5f'),'password',_0xa584('0x60'),_0xa584('0x61'),_0xa584('0x62')]})[_0xa584('0x2e')](handleEntityNotFound(_0x4d5d81,null))[_0xa584('0x2e')](function(_0x5bf966){if(_0x5bf966){_0x15ec66=_0x5bf966[_0xa584('0x62')];var _0x21850d=_0x15ec66['slice'](-0x1);if(_0x21850d==='/'){_0x15ec66=_0x15ec66[_0xa584('0x63')](0x0,_0x15ec66[_0xa584('0x64')](_0x21850d));}var _0x4e3dca={'method':'GET','uri':util[_0xa584('0x65')](_0xa584('0x66'),_0x15ec66,_0xa584('0x67')),'json':!![]};switch(_0x5bf966[_0xa584('0x61')]){case'password':_0x4e3dca['headers']={'Authorization':util[_0xa584('0x65')](_0xa584('0x68'),new Buffer(util['format'](_0xa584('0x69'),_0x5bf966[_0xa584('0x5f')],_0x5bf966[_0xa584('0x6a')]))[_0xa584('0x6b')]('base64'))};break;case _0xa584('0x60'):_0x4e3dca[_0xa584('0x6c')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xa584('0x65')]('%s/token:%s',_0x5bf966[_0xa584('0x5f')],_0x5bf966[_0xa584('0x60')]))[_0xa584('0x6b')](_0xa584('0x6d')))};break;default:throw new db[(_0xa584('0x6e'))][(_0xa584('0x6f'))](_0xa584('0x70'));}return rp(_0x4e3dca);}})[_0xa584('0x2e')](function(_0x25fcae){if(_0x25fcae){var _0x535424=['subject','description',_0xa584('0x71'),_0xa584('0x72')];_[_0xa584('0x73')](_0x25fcae['ticket_fields'],function(_0x246003){return _0x535424[_0xa584('0x74')](_0x246003[_0xa584('0x48')]);});return{'count':_0x25fcae[_0xa584('0x67')][_0xa584('0x40')],'rows':_[_0xa584('0x33')](_0x25fcae[_0xa584('0x67')],function(_0x7537ea){return{'id':_0x7537ea['id'],'name':_0x7537ea[_0xa584('0x75')]>0x7?_0x7537ea[_0xa584('0x76')]:_0x7537ea['type'],'custom':_0x7537ea['position']>0x7?!![]:![],'options':_0x7537ea[_0xa584('0x77')]?_0x7537ea[_0xa584('0x77')]:_0x7537ea['custom_field_options']?_0x7537ea[_0xa584('0x78')]:[]};})};}})[_0xa584('0x2e')](respondWithResult(_0x4d5d81,null))[_0xa584('0x24')](function(_0x48733a){var _0x4ccce8=_0x4d102c[_0xa584('0x3b')][_0xa584('0x79')]?0x1f4:_0x48733a['statusCode']||0x1f4;logger[_0xa584('0x20')](_0xa584('0x7a'),_0xa584('0x7b'),_0x4ccce8,JSON[_0xa584('0x1f')](_0x48733a));delete _0x48733a['name'];if(_0x4ccce8===0x191){_0x4ccce8=0x190;}_0x4d5d81[_0xa584('0x26')](_0x4ccce8)[_0xa584('0x32')](_0x4d102c[_0xa584('0x3b')]['test']?{'message':_0xa584('0x7c'),'statusCode':_0x48733a['statusCode']}:_0x48733a);});}; \ No newline at end of file +var _0x85ed=['../../mysqldb','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','Content-Range','update','then','stack','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','create','body','find','getConfigurations','ZendeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','ticket_fields','headers','format','Basic\x20%s','%s:%s','%s/token:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','position','title','custom_field_options','statusCode','send','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util'];(function(_0x23cd34,_0xe7e8f7){var _0x1e1e48=function(_0x820992){while(--_0x820992){_0x23cd34['push'](_0x23cd34['shift']());}};_0x1e1e48(++_0xe7e8f7);}(_0x85ed,0x66));var _0xd85e=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0x85ed[_0x2962d5];return _0x273406;};'use strict';var pdf=require(_0xd85e('0x0'));var emlformat=require(_0xd85e('0x1'));var rimraf=require(_0xd85e('0x2'));var zipdir=require(_0xd85e('0x3'));var jsonpatch=require(_0xd85e('0x4'));var rp=require(_0xd85e('0x5'));var moment=require(_0xd85e('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xd85e('0x7'));var util=require(_0xd85e('0x8'));var path=require(_0xd85e('0x9'));var sox=require(_0xd85e('0xa'));var csv=require('to-csv');var ejs=require(_0xd85e('0xb'));var fs=require('fs');var _=require(_0xd85e('0xc'));var squel=require('squel');var crypto=require(_0xd85e('0xd'));var jsforce=require(_0xd85e('0xe'));var deskjs=require(_0xd85e('0xf'));var toCsv=require(_0xd85e('0x10'));var querystring=require('querystring');var Papa=require(_0xd85e('0x11'));var Redis=require(_0xd85e('0x12'));var authService=require(_0xd85e('0x13'));var qs=require(_0xd85e('0x14'));var as=require(_0xd85e('0x15'));var hardwareService=require(_0xd85e('0x16'));var logger=require('../../config/logger')(_0xd85e('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd85e('0x18'));var db=require(_0xd85e('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xd85e('0x1a'));var client=jayson[_0xd85e('0x1b')][_0xd85e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4afee1,_0x2194cd,_0x33addd,_0xe0c8df){return new BPromise(function(_0x32a52c,_0x1765d5){var _0x541696=_0xe0c8df||client;return _0x541696[_0xd85e('0x1d')](_0x4afee1,_0x33addd)['then'](function(_0x3aa5f6){logger[_0xd85e('0x1e')](_0xd85e('0x1f'),_0x2194cd,'request\x20sent');logger[_0xd85e('0x20')](_0xd85e('0x21'),_0x2194cd,'request\x20sent',JSON[_0xd85e('0x22')](_0x3aa5f6));if(_0x3aa5f6[_0xd85e('0x23')]){if(_0x3aa5f6[_0xd85e('0x23')]['code']===0x1f4){logger[_0xd85e('0x23')](_0xd85e('0x1f'),_0x2194cd,_0x3aa5f6[_0xd85e('0x23')][_0xd85e('0x24')]);return _0x1765d5(_0x3aa5f6[_0xd85e('0x23')][_0xd85e('0x24')]);}logger[_0xd85e('0x23')](_0xd85e('0x1f'),_0x2194cd,_0x3aa5f6[_0xd85e('0x23')][_0xd85e('0x24')]);return _0x32a52c(_0x3aa5f6['error'][_0xd85e('0x24')]);}else{logger[_0xd85e('0x1e')](_0xd85e('0x1f'),_0x2194cd,_0xd85e('0x25'));_0x32a52c(_0x3aa5f6[_0xd85e('0x26')]['message']);}})[_0xd85e('0x27')](function(_0x16b133){logger[_0xd85e('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x2194cd,_0x16b133);_0x1765d5(_0x16b133);});});}function respondWithStatusCode(_0x45c727,_0x44168e){_0x44168e=_0x44168e||0xcc;return function(_0x250dce){if(_0x250dce){return _0x45c727[_0xd85e('0x28')](_0x44168e);}return _0x45c727[_0xd85e('0x29')](_0x44168e)[_0xd85e('0x2a')]();};}function respondWithResult(_0x5604ae,_0x176a58){_0x176a58=_0x176a58||0xc8;return function(_0x91b328){if(_0x91b328){return _0x5604ae[_0xd85e('0x29')](_0x176a58)[_0xd85e('0x2b')](_0x91b328);}};}function respondWithFilteredResult(_0xe89be1,_0x400ffd){return function(_0x338445){if(_0x338445){var _0x1d659e=_0x338445[_0xd85e('0x2c')],_0x540149=_0x400ffd[_0xd85e('0x2d')],_0x5e0914=_0x400ffd['offset']+_0x400ffd['limit'],_0x3357b8;if(_0x5e0914>=_0x1d659e){_0x5e0914=_0x1d659e;_0x3357b8=0xc8;}else{_0x3357b8=0xce;}_0xe89be1[_0xd85e('0x29')](_0x3357b8);return _0xe89be1['set'](_0xd85e('0x2e'),_0x540149+'-'+_0x5e0914+'/'+_0x1d659e)[_0xd85e('0x2b')](_0x338445);}return null;};}function patchUpdates(_0x3f760e){return function(_0xadc995){try{jsonpatch['apply'](_0xadc995,_0x3f760e,!![]);}catch(_0x5ec4e9){return BPromise['reject'](_0x5ec4e9);}return _0xadc995['save']();};}function saveUpdates(_0x5d4154,_0x385823){return function(_0xb0ea8d){if(_0xb0ea8d){return _0xb0ea8d[_0xd85e('0x2f')](_0x5d4154)['then'](function(_0x6a901d){return _0x6a901d;});}return null;};}function removeEntity(_0x2fa2ec,_0x3c79e5){return function(_0x232e8b){if(_0x232e8b){return _0x232e8b['destroy']()[_0xd85e('0x30')](function(){_0x2fa2ec[_0xd85e('0x29')](0xcc)[_0xd85e('0x2a')]();});}};}function handleEntityNotFound(_0x39a959,_0x933325){return function(_0x554f0d){if(!_0x554f0d){_0x39a959[_0xd85e('0x28')](0x194);}return _0x554f0d;};}function handleError(_0x4ea736,_0x4ff62b){_0x4ff62b=_0x4ff62b||0x1f4;return function(_0x1b13fc){logger[_0xd85e('0x23')](_0x1b13fc[_0xd85e('0x31')]);if(_0x1b13fc['name']){delete _0x1b13fc['name'];}_0x4ea736[_0xd85e('0x29')](_0x4ff62b)['send'](_0x1b13fc);};}exports[_0xd85e('0x32')]=function(_0x4addb4,_0x56145f){var _0x207a59={},_0x8430a1={},_0x4a7e0d={'count':0x0,'rows':[]};var _0x141d02=_[_0xd85e('0x33')](db[_0xd85e('0x34')][_0xd85e('0x35')],function(_0x3f8089){return{'name':_0x3f8089[_0xd85e('0x36')],'type':_0x3f8089[_0xd85e('0x37')][_0xd85e('0x38')]};});_0x8430a1[_0xd85e('0x39')]=_[_0xd85e('0x33')](_0x141d02,_0xd85e('0x3a'));_0x8430a1[_0xd85e('0x3b')]=_[_0xd85e('0x3c')](_0x4addb4[_0xd85e('0x3b')]);_0x8430a1['filters']=_[_0xd85e('0x3d')](_0x8430a1[_0xd85e('0x39')],_0x8430a1[_0xd85e('0x3b')]);_0x207a59[_0xd85e('0x3e')]=_[_0xd85e('0x3d')](_0x8430a1[_0xd85e('0x39')],qs[_0xd85e('0x3f')](_0x4addb4[_0xd85e('0x3b')][_0xd85e('0x3f')]));_0x207a59[_0xd85e('0x3e')]=_0x207a59[_0xd85e('0x3e')][_0xd85e('0x40')]?_0x207a59[_0xd85e('0x3e')]:_0x8430a1[_0xd85e('0x39')];if(!_0x4addb4['query'][_0xd85e('0x41')](_0xd85e('0x42'))){_0x207a59[_0xd85e('0x43')]=qs['limit'](_0x4addb4['query'][_0xd85e('0x43')]);_0x207a59[_0xd85e('0x2d')]=qs[_0xd85e('0x2d')](_0x4addb4['query'][_0xd85e('0x2d')]);}_0x207a59[_0xd85e('0x44')]=qs[_0xd85e('0x45')](_0x4addb4[_0xd85e('0x3b')][_0xd85e('0x45')]);_0x207a59[_0xd85e('0x46')]=qs[_0xd85e('0x47')](_[_0xd85e('0x48')](_0x4addb4[_0xd85e('0x3b')],_0x8430a1[_0xd85e('0x47')]),_0x141d02);if(_0x4addb4['query'][_0xd85e('0x49')]){_0x207a59['where']=_[_0xd85e('0x4a')](_0x207a59[_0xd85e('0x46')],{'$or':_[_0xd85e('0x33')](_0x141d02,function(_0x3afbb1){if(_0x3afbb1[_0xd85e('0x37')]!==_0xd85e('0x4b')){var _0x1dd55c={};_0x1dd55c[_0x3afbb1[_0xd85e('0x3a')]]={'$like':'%'+_0x4addb4[_0xd85e('0x3b')][_0xd85e('0x49')]+'%'};return _0x1dd55c;}})});}_0x207a59=_[_0xd85e('0x4a')]({},_0x207a59,_0x4addb4['options']);var _0x50d041={'where':_0x207a59[_0xd85e('0x46')]};return db[_0xd85e('0x34')][_0xd85e('0x2c')](_0x50d041)[_0xd85e('0x30')](function(_0x21f6fe){_0x4a7e0d['count']=_0x21f6fe;if(_0x4addb4['query'][_0xd85e('0x4c')]){_0x207a59[_0xd85e('0x4d')]=[{'all':!![]}];}return db[_0xd85e('0x34')][_0xd85e('0x4e')](_0x207a59);})[_0xd85e('0x30')](function(_0x46ecee){_0x4a7e0d[_0xd85e('0x4f')]=_0x46ecee;return _0x4a7e0d;})['then'](respondWithFilteredResult(_0x56145f,_0x207a59))[_0xd85e('0x27')](handleError(_0x56145f,null));};exports[_0xd85e('0x50')]=function(_0x17f3da,_0x1f85ca){var _0xe02a47={'raw':![],'where':{'id':_0x17f3da[_0xd85e('0x51')]['id']}},_0x9ea71f={};_0x9ea71f[_0xd85e('0x39')]=_[_0xd85e('0x3c')](db[_0xd85e('0x34')][_0xd85e('0x35')]);_0x9ea71f[_0xd85e('0x3b')]=_[_0xd85e('0x3c')](_0x17f3da[_0xd85e('0x3b')]);_0x9ea71f[_0xd85e('0x47')]=_[_0xd85e('0x3d')](_0x9ea71f['model'],_0x9ea71f[_0xd85e('0x3b')]);_0xe02a47[_0xd85e('0x3e')]=_[_0xd85e('0x3d')](_0x9ea71f[_0xd85e('0x39')],qs['fields'](_0x17f3da[_0xd85e('0x3b')][_0xd85e('0x3f')]));_0xe02a47[_0xd85e('0x3e')]=_0xe02a47['attributes'][_0xd85e('0x40')]?_0xe02a47[_0xd85e('0x3e')]:_0x9ea71f[_0xd85e('0x39')];if(_0x17f3da['query'][_0xd85e('0x4c')]){_0xe02a47[_0xd85e('0x4d')]=[{'all':!![]}];}_0xe02a47=_['merge']({},_0xe02a47,_0x17f3da[_0xd85e('0x52')]);return db[_0xd85e('0x34')]['find'](_0xe02a47)[_0xd85e('0x30')](handleEntityNotFound(_0x1f85ca,null))[_0xd85e('0x30')](respondWithResult(_0x1f85ca,null))[_0xd85e('0x27')](handleError(_0x1f85ca,null));};exports[_0xd85e('0x53')]=function(_0xa491d3,_0x275f00){return db[_0xd85e('0x34')]['create'](_0xa491d3[_0xd85e('0x54')],{})[_0xd85e('0x30')](respondWithResult(_0x275f00,0xc9))[_0xd85e('0x27')](handleError(_0x275f00,null));};exports[_0xd85e('0x2f')]=function(_0x1c94a6,_0x5a92c9){if(_0x1c94a6[_0xd85e('0x54')]['id']){delete _0x1c94a6['body']['id'];}return db[_0xd85e('0x34')]['find']({'where':{'id':_0x1c94a6['params']['id']}})[_0xd85e('0x30')](handleEntityNotFound(_0x5a92c9,null))[_0xd85e('0x30')](saveUpdates(_0x1c94a6[_0xd85e('0x54')],null))['then'](respondWithResult(_0x5a92c9,null))[_0xd85e('0x27')](handleError(_0x5a92c9,null));};exports['destroy']=function(_0x109b76,_0x5d8036){return db['ZendeskAccount'][_0xd85e('0x55')]({'where':{'id':_0x109b76[_0xd85e('0x51')]['id']}})[_0xd85e('0x30')](handleEntityNotFound(_0x5d8036,null))[_0xd85e('0x30')](removeEntity(_0x5d8036,null))[_0xd85e('0x27')](handleError(_0x5d8036,null));};exports[_0xd85e('0x56')]=function(_0x4b0b1,_0x1278a7,_0xf0180e){var _0x4be7d6={};var _0x4985b6={};var _0x2a8703;var _0x239ed0;return db[_0xd85e('0x34')]['findOne']({'where':{'id':_0x4b0b1[_0xd85e('0x51')]['id']}})[_0xd85e('0x30')](handleEntityNotFound(_0x1278a7,null))[_0xd85e('0x30')](function(_0x27a8a3){if(_0x27a8a3){_0x2a8703=_0x27a8a3;_0x4985b6['model']=_[_0xd85e('0x3c')](db[_0xd85e('0x57')][_0xd85e('0x35')]);_0x4985b6['query']=_['keys'](_0x4b0b1[_0xd85e('0x3b')]);_0x4985b6[_0xd85e('0x47')]=_[_0xd85e('0x3d')](_0x4985b6['model'],_0x4985b6[_0xd85e('0x3b')]);_0x4be7d6[_0xd85e('0x3e')]=_['intersection'](_0x4985b6[_0xd85e('0x39')],qs[_0xd85e('0x3f')](_0x4b0b1[_0xd85e('0x3b')][_0xd85e('0x3f')]));_0x4be7d6[_0xd85e('0x3e')]=_0x4be7d6[_0xd85e('0x3e')]['length']?_0x4be7d6['attributes']:_0x4985b6[_0xd85e('0x39')];_0x4be7d6['order']=qs[_0xd85e('0x45')](_0x4b0b1[_0xd85e('0x3b')][_0xd85e('0x45')]);_0x4be7d6[_0xd85e('0x46')]=qs[_0xd85e('0x47')](_['pick'](_0x4b0b1[_0xd85e('0x3b')],_0x4985b6['filters']));if(_0x4b0b1[_0xd85e('0x3b')][_0xd85e('0x49')]){_0x4be7d6['where']=_[_0xd85e('0x4a')](_0x4be7d6[_0xd85e('0x46')],{'$or':_['map'](_0x4be7d6[_0xd85e('0x3e')],function(_0x118420){var _0x3bf16b={};_0x3bf16b[_0x118420]={'$like':'%'+_0x4b0b1['query'][_0xd85e('0x49')]+'%'};return _0x3bf16b;})});}_0x4be7d6=_[_0xd85e('0x4a')]({},_0x4be7d6,_0x4b0b1[_0xd85e('0x52')]);return _0x2a8703[_0xd85e('0x56')](_0x4be7d6);}})[_0xd85e('0x30')](function(_0xe151c0){if(_0xe151c0){_0x239ed0=_0xe151c0[_0xd85e('0x40')];if(!_0x4b0b1['query'][_0xd85e('0x41')](_0xd85e('0x42'))){_0x4be7d6['limit']=qs['limit'](_0x4b0b1[_0xd85e('0x3b')][_0xd85e('0x43')]);_0x4be7d6['offset']=qs[_0xd85e('0x2d')](_0x4b0b1[_0xd85e('0x3b')][_0xd85e('0x2d')]);}return _0x2a8703[_0xd85e('0x56')](_0x4be7d6);}})[_0xd85e('0x30')](function(_0x496156){if(_0x496156){return _0x496156?{'count':_0x239ed0,'rows':_0x496156}:null;}})[_0xd85e('0x30')](respondWithResult(_0x1278a7,null))[_0xd85e('0x27')](handleError(_0x1278a7,null));};exports[_0xd85e('0x58')]=function(_0x261d6c,_0x1e808f,_0xe3bdfb){if(_0x261d6c[_0xd85e('0x54')]['id']){delete _0x261d6c[_0xd85e('0x54')]['id'];}return db[_0xd85e('0x34')][_0xd85e('0x59')]({'where':{'id':_0x261d6c[_0xd85e('0x51')]['id']}})[_0xd85e('0x30')](handleEntityNotFound(_0x1e808f,null))[_0xd85e('0x30')](function(_0x12035f){if(_0x12035f){_0x261d6c['body'][_0xd85e('0x5a')]=_0x12035f['id'];_0x261d6c['body'][_0xd85e('0x5b')]=integrations[_0xd85e('0x5c')](_0x261d6c[_0xd85e('0x54')][_0xd85e('0x5d')],_0x261d6c[_0xd85e('0x54')][_0xd85e('0x37')]);_0x261d6c[_0xd85e('0x54')]['Descriptions']=integrations[_0xd85e('0x5e')](_0x261d6c[_0xd85e('0x54')][_0xd85e('0x5d')],_0x261d6c[_0xd85e('0x54')][_0xd85e('0x37')]);return db[_0xd85e('0x57')][_0xd85e('0x53')](_0x261d6c[_0xd85e('0x54')],{'include':[{'model':db['ZendeskField'],'as':_0xd85e('0x5b')},{'model':db[_0xd85e('0x5f')],'as':_0xd85e('0x60')}]});}return null;})[_0xd85e('0x30')](respondWithResult(_0x1e808f,null))[_0xd85e('0x27')](handleError(_0x1e808f,null));};exports[_0xd85e('0x61')]=function(_0x305ece,_0x9c9554,_0x4e8e82){var _0x278128='';return db[_0xd85e('0x34')]['findOne']({'where':{'id':_0x305ece[_0xd85e('0x51')]['id']},'attributes':['id',_0xd85e('0x62'),_0xd85e('0x63'),_0xd85e('0x64'),_0xd85e('0x65'),_0xd85e('0x66')]})[_0xd85e('0x30')](handleEntityNotFound(_0x9c9554,null))[_0xd85e('0x30')](function(_0x27be09){if(_0x27be09){_0x278128=_0x27be09['remoteUri'];var _0x274727=_0x278128[_0xd85e('0x67')](-0x1);if(_0x274727==='/'){_0x278128=_0x278128[_0xd85e('0x68')](0x0,_0x278128[_0xd85e('0x69')](_0x274727));}var _0x4892f2={'method':_0xd85e('0x6a'),'uri':util['format'](_0xd85e('0x6b'),_0x278128,_0xd85e('0x6c')),'json':!![]};switch(_0x27be09['authType']){case _0xd85e('0x63'):_0x4892f2[_0xd85e('0x6d')]={'Authorization':util[_0xd85e('0x6e')](_0xd85e('0x6f'),new Buffer(util[_0xd85e('0x6e')](_0xd85e('0x70'),_0x27be09['username'],_0x27be09[_0xd85e('0x63')]))['toString']('base64'))};break;case _0xd85e('0x64'):_0x4892f2[_0xd85e('0x6d')]={'Authorization':util[_0xd85e('0x6e')](_0xd85e('0x6f'),new Buffer(util[_0xd85e('0x6e')](_0xd85e('0x71'),_0x27be09[_0xd85e('0x62')],_0x27be09[_0xd85e('0x64')]))[_0xd85e('0x72')](_0xd85e('0x73')))};break;default:throw new db[(_0xd85e('0x74'))][(_0xd85e('0x75'))](_0xd85e('0x76'));}return rp(_0x4892f2);}})[_0xd85e('0x30')](function(_0x303684){if(_0x303684){var _0x2a74a7=[_0xd85e('0x77'),_0xd85e('0x78'),'group',_0xd85e('0x79')];_['remove'](_0x303684[_0xd85e('0x6c')],function(_0x2ecacc){return _0x2a74a7['includes'](_0x2ecacc[_0xd85e('0x37')]);});return{'count':_0x303684[_0xd85e('0x6c')][_0xd85e('0x40')],'rows':_[_0xd85e('0x33')](_0x303684['ticket_fields'],function(_0xe93111){return{'id':_0xe93111['id'],'name':_0xe93111[_0xd85e('0x7a')]>0x7?_0xe93111[_0xd85e('0x7b')]:_0xe93111[_0xd85e('0x37')],'custom':_0xe93111[_0xd85e('0x7a')]>0x7?!![]:![],'options':_0xe93111['system_field_options']?_0xe93111['system_field_options']:_0xe93111[_0xd85e('0x7c')]?_0xe93111['custom_field_options']:[]};})};}})[_0xd85e('0x30')](respondWithResult(_0x9c9554,null))[_0xd85e('0x27')](function(_0x364c76){var _0x2e745b=_0x305ece[_0xd85e('0x3b')]['test']?0x1f4:_0x364c76[_0xd85e('0x7d')]||0x1f4;logger[_0xd85e('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xd85e('0x61'),_0x2e745b,JSON['stringify'](_0x364c76));delete _0x364c76[_0xd85e('0x3a')];if(_0x2e745b===0x191){_0x2e745b=0x190;}_0x9c9554['status'](_0x2e745b)[_0xd85e('0x7e')](_0x305ece[_0xd85e('0x3b')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x364c76[_0xd85e('0x7d')]}:_0x364c76);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 64e8ee1..e440ccf 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 _0xff3b=['./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0xff3b,0x10d));var _0xbff3=function(_0x37175a,_0x274837){_0x37175a=_0x37175a-0x0;var _0xc96a2f=_0xff3b[_0x37175a];return _0xc96a2f;};'use strict';var _=require(_0xbff3('0x0'));var util=require(_0xbff3('0x1'));var logger=require(_0xbff3('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbff3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbff3('0x4'));var rimraf=require(_0xbff3('0x5'));var config=require(_0xbff3('0x6'));var attributes=require(_0xbff3('0x7'));var integrations=require(_0xbff3('0x8'));module[_0xbff3('0x9')]=function(_0x552e3c,_0x416fc3){return _0x552e3c[_0xbff3('0xa')]('ZendeskAccount',attributes,{'tableName':_0xbff3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x945a=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','ZendeskAccount','lodash','util'];(function(_0x381797,_0x3ca9df){var _0x5787b8=function(_0x48cd62){while(--_0x48cd62){_0x381797['push'](_0x381797['shift']());}};_0x5787b8(++_0x3ca9df);}(_0x945a,0x111));var _0xa945=function(_0x4694d9,_0x4b935b){_0x4694d9=_0x4694d9-0x0;var _0x370f3f=_0x945a[_0x4694d9];return _0x370f3f;};'use strict';var _=require(_0xa945('0x0'));var util=require(_0xa945('0x1'));var logger=require(_0xa945('0x2'))(_0xa945('0x3'));var moment=require(_0xa945('0x4'));var BPromise=require(_0xa945('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa945('0x6'));var config=require(_0xa945('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xa945('0x8')]=function(_0x39f8f3,_0x245f65){return _0x39f8f3[_0xa945('0x9')](_0xa945('0xa'),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 7170a8a..3b385e3 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 _0xcb91=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','then','ShowZendeskAccount','find','where','moment','bluebird','randomstring','ioredis'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5f3de3,_0x40f0f5){_0x5f3de3=_0x5f3de3-0x0;var _0x287e0d=_0xcb91[_0x5f3de3];return _0x287e0d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')]({'raw':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x18')]===undefined?!![]:![]:!![],'where':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['where']||null:null,'attributes':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options'][_0x1cb9('0x19')]||null:null,'limit':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['limit']||null:null,'include':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x59ebea){return{'model':db[_0x59ebea['model']],'as':_0x59ebea['as'],'attributes':_0x59ebea[_0x1cb9('0x19')],'include':_0x59ebea['include']?_[_0x1cb9('0x1b')](_0x59ebea[_0x1cb9('0x1a')],function(_0x69b4c8){return{'model':db[_0x69b4c8[_0x1cb9('0x1c')]],'as':_0x69b4c8['as'],'attributes':_0x69b4c8[_0x1cb9('0x19')],'include':_0x69b4c8['include']?_[_0x1cb9('0x1b')](_0x69b4c8[_0x1cb9('0x1a')],function(_0x4c8d76){return{'model':db[_0x4c8d76[_0x1cb9('0x1c')]],'as':_0x4c8d76['as'],'attributes':_0x4c8d76[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x1804fd){logger[_0x1cb9('0xa')](_0x1cb9('0x14'),_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON[_0x1cb9('0xf')](_0x1804fd));_0x479d43(_0x1804fd);})[_0x1cb9('0x13')](function(_0x48888d){logger[_0x1cb9('0x10')]('GetZendeskAccount',_0x48888d[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340['error'](0x1f4,_0x48888d[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x1e')]=function(_0x3cd7f5){var _0x2038aa=this;return new Promise(function(_0x561d89,_0x1c701f){return db['ZendeskAccount'][_0x1cb9('0x1f')]({'raw':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5['options'][_0x1cb9('0x20')]||null:null,'attributes':_0x3cd7f5['options']?_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x19')]||null:null,'include':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['include']?_[_0x1cb9('0x1b')](_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x91a1db){return{'model':db[_0x91a1db[_0x1cb9('0x1c')]],'as':_0x91a1db['as'],'attributes':_0x91a1db[_0x1cb9('0x19')],'include':_0x91a1db[_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x91a1db[_0x1cb9('0x1a')],function(_0x1de287){return{'model':db[_0x1de287[_0x1cb9('0x1c')]],'as':_0x1de287['as'],'attributes':_0x1de287[_0x1cb9('0x19')],'include':_0x1de287[_0x1cb9('0x1a')]?_['map'](_0x1de287['include'],function(_0x299ff8){return{'model':db[_0x299ff8[_0x1cb9('0x1c')]],'as':_0x299ff8['as'],'attributes':_0x299ff8[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x385daa){logger[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x3cd7f5);logger[_0x1cb9('0xd')]('ShowZendeskAccount',_0x3cd7f5,JSON[_0x1cb9('0xf')](_0x385daa));_0x561d89(_0x385daa);})[_0x1cb9('0x13')](function(_0xefe136){logger['error'](_0x1cb9('0x1e'),_0xefe136['message'],_0x3cd7f5);_0x1c701f(_0x2038aa[_0x1cb9('0x10')](0x1f4,_0xefe136['message']));});});}; \ No newline at end of file +var _0x757a=['stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0xa73f70,_0x12add9){var _0x484278=function(_0x2cab68){while(--_0x2cab68){_0xa73f70['push'](_0xa73f70['shift']());}};_0x484278(++_0x12add9);}(_0x757a,0xde));var _0xa757=function(_0x4bc976,_0x5a42ac){_0x4bc976=_0x4bc976-0x0;var _0x441b95=_0x757a[_0x4bc976];return _0x441b95;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetZendeskAccount',_0x4d9f58);logger['debug']('GetZendeskAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetZendeskAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 112a785..fd34940 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 _0xfdc8=['exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','/:id/tags','getTags','post','put','delete','destroy'];(function(_0x40aeee,_0x22c3eb){var _0x2b6bc0=function(_0x18b466){while(--_0x18b466){_0x40aeee['push'](_0x40aeee['shift']());}};_0x2b6bc0(++_0x22c3eb);}(_0xfdc8,0x109));var _0x8fdc=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xfdc8[_0x474bc0];return _0x4b24cf;};'use strict';var multer=require(_0x8fdc('0x0'));var util=require('util');var path=require(_0x8fdc('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fdc('0x2'));var router=express[_0x8fdc('0x3')]();var auth=require(_0x8fdc('0x4'));var interaction=require(_0x8fdc('0x5'));var config=require(_0x8fdc('0x6'));var controller=require(_0x8fdc('0x7'));router[_0x8fdc('0x8')]('/',auth[_0x8fdc('0x9')](),controller['index']);router['get'](_0x8fdc('0xa'),auth['isAuthenticated'](),controller[_0x8fdc('0xb')]);router[_0x8fdc('0x8')](_0x8fdc('0xc'),auth[_0x8fdc('0x9')](),controller[_0x8fdc('0xd')]);router[_0x8fdc('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x8fdc('0xe')]);router[_0x8fdc('0x8')]('/:id/descriptions',auth[_0x8fdc('0x9')](),controller['getDescriptions']);router[_0x8fdc('0x8')](_0x8fdc('0xf'),auth[_0x8fdc('0x9')](),controller[_0x8fdc('0x10')]);router[_0x8fdc('0x11')]('/',auth[_0x8fdc('0x9')](),controller['create']);router['post'](_0x8fdc('0xf'),auth['isAuthenticated'](),controller['setTags']);router[_0x8fdc('0x12')](_0x8fdc('0xa'),auth[_0x8fdc('0x9')](),controller['update']);router[_0x8fdc('0x13')](_0x8fdc('0xa'),auth[_0x8fdc('0x9')](),controller[_0x8fdc('0x14')]);module[_0x8fdc('0x15')]=router; \ No newline at end of file +var _0x1848=['util','path','connect-timeout','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','index','get','show','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','put','/:id','destroy','exports','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1848,0x11d));var _0x8184=function(_0x35c39f,_0x1e6e48){_0x35c39f=_0x35c39f-0x0;var _0x2cb991=_0x1848[_0x35c39f];return _0x2cb991;};'use strict';var multer=require(_0x8184('0x0'));var util=require(_0x8184('0x1'));var path=require(_0x8184('0x2'));var timeout=require(_0x8184('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8184('0x4'));var config=require(_0x8184('0x5'));var controller=require(_0x8184('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x8184('0x7')]);router[_0x8184('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x8184('0x9')]);router['get']('/:id/fields',auth[_0x8184('0xa')](),controller[_0x8184('0xb')]);router['get'](_0x8184('0xc'),auth[_0x8184('0xa')](),controller[_0x8184('0xd')]);router['get'](_0x8184('0xe'),auth[_0x8184('0xa')](),controller['getDescriptions']);router[_0x8184('0x8')](_0x8184('0xf'),auth[_0x8184('0xa')](),controller[_0x8184('0x10')]);router[_0x8184('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8184('0x11')](_0x8184('0xf'),auth[_0x8184('0xa')](),controller['setTags']);router[_0x8184('0x12')](_0x8184('0x13'),auth[_0x8184('0xa')](),controller['update']);router['delete']('/:id',auth[_0x8184('0xa')](),controller[_0x8184('0x14')]);module[_0x8184('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 53eebd7..e41ab73 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 _0x988d=['STRING','sequelize'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x988d,0x87));var _0xd988=function(_0x431d0d,_0x1a4fce){_0x431d0d=_0x431d0d-0x0;var _0x1036ef=_0x988d[_0x431d0d];return _0x1036ef;};'use strict';var Sequelize=require(_0xd988('0x0'));module['exports']={'name':{'type':Sequelize[_0xd988('0x1')]},'description':{'type':Sequelize[_0xd988('0x1')]}}; \ No newline at end of file +var _0x11a8=['STRING','sequelize','exports'];(function(_0x457a5d,_0x13673f){var _0x10a79e=function(_0xd4184d){while(--_0xd4184d){_0x457a5d['push'](_0x457a5d['shift']());}};_0x10a79e(++_0x13673f);}(_0x11a8,0x13f));var _0x811a=function(_0x410321,_0x356317){_0x410321=_0x410321-0x0;var _0x3de168=_0x11a8[_0x410321];return _0x3de168;};'use strict';var Sequelize=require(_0x811a('0x0'));module[_0x811a('0x1')]={'name':{'type':Sequelize[_0x811a('0x2')]},'description':{'type':Sequelize[_0x811a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index e8ee982..5d021cf 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 _0xe615=['query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','rows','show','params','rawAttributes','create','body','update','find','getFields','findOne','ZendeskField','options','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','reject','save','then','destroy','name','index','ZendeskConfiguration','fieldName','key','map'];(function(_0x55aaf7,_0x5ca074){var _0x3cac4a=function(_0x3ed30b){while(--_0x3ed30b){_0x55aaf7['push'](_0x55aaf7['shift']());}};_0x3cac4a(++_0x5ca074);}(_0xe615,0x1e1));var _0x5e61=function(_0x4fa1b0,_0x3cafac){_0x4fa1b0=_0x4fa1b0-0x0;var _0x3c2e33=_0xe615[_0x4fa1b0];return _0x3c2e33;};'use strict';var pdf=require(_0x5e61('0x0'));var emlformat=require(_0x5e61('0x1'));var rimraf=require(_0x5e61('0x2'));var zipdir=require(_0x5e61('0x3'));var jsonpatch=require(_0x5e61('0x4'));var rp=require('request-promise');var moment=require(_0x5e61('0x5'));var BPromise=require(_0x5e61('0x6'));var Mustache=require('mustache');var util=require(_0x5e61('0x7'));var path=require(_0x5e61('0x8'));var sox=require(_0x5e61('0x9'));var csv=require('to-csv');var ejs=require(_0x5e61('0xa'));var fs=require('fs');var _=require(_0x5e61('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5e61('0xc'));var deskjs=require(_0x5e61('0xd'));var toCsv=require(_0x5e61('0xe'));var querystring=require('querystring');var Papa=require(_0x5e61('0xf'));var Redis=require('ioredis');var authService=require(_0x5e61('0x10'));var qs=require(_0x5e61('0x11'));var as=require(_0x5e61('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5e61('0x13'));var utils=require(_0x5e61('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5e61('0x15'));var db=require(_0x5e61('0x16'))['db'];var jayson=require(_0x5e61('0x17'));var client=jayson[_0x5e61('0x18')][_0x5e61('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x39852c,_0x52b09a,_0x333483,_0x44b002){return new BPromise(function(_0x3e2f9b,_0x25478f){var _0x1a6460=_0x44b002||client;return _0x1a6460['request'](_0x39852c,_0x333483)['then'](function(_0x3f254){logger['info'](_0x5e61('0x1a'),_0x52b09a,_0x5e61('0x1b'));logger[_0x5e61('0x1c')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x52b09a,_0x5e61('0x1b'),JSON[_0x5e61('0x1d')](_0x3f254));if(_0x3f254['error']){if(_0x3f254[_0x5e61('0x1e')][_0x5e61('0x1f')]===0x1f4){logger[_0x5e61('0x1e')](_0x5e61('0x1a'),_0x52b09a,_0x3f254['error'][_0x5e61('0x20')]);return _0x25478f(_0x3f254['error'][_0x5e61('0x20')]);}logger[_0x5e61('0x1e')](_0x5e61('0x1a'),_0x52b09a,_0x3f254[_0x5e61('0x1e')][_0x5e61('0x20')]);return _0x3e2f9b(_0x3f254[_0x5e61('0x1e')][_0x5e61('0x20')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x52b09a,_0x5e61('0x1b'));_0x3e2f9b(_0x3f254[_0x5e61('0x21')]['message']);}})[_0x5e61('0x22')](function(_0x5ace29){logger[_0x5e61('0x1e')](_0x5e61('0x1a'),_0x52b09a,_0x5ace29);_0x25478f(_0x5ace29);});});}function respondWithStatusCode(_0x399f51,_0x16e811){_0x16e811=_0x16e811||0xcc;return function(_0x2ccdba){if(_0x2ccdba){return _0x399f51[_0x5e61('0x23')](_0x16e811);}return _0x399f51[_0x5e61('0x24')](_0x16e811)[_0x5e61('0x25')]();};}function respondWithResult(_0x188551,_0x16d4be){_0x16d4be=_0x16d4be||0xc8;return function(_0x398609){if(_0x398609){return _0x188551[_0x5e61('0x24')](_0x16d4be)[_0x5e61('0x26')](_0x398609);}};}function respondWithFilteredResult(_0x44b851,_0x5f5a46){return function(_0x1821d7){if(_0x1821d7){var _0x48f9b1=_0x1821d7[_0x5e61('0x27')],_0x32f715=_0x5f5a46[_0x5e61('0x28')],_0x33d88c=_0x5f5a46[_0x5e61('0x28')]+_0x5f5a46[_0x5e61('0x29')],_0x1071d2;if(_0x33d88c>=_0x48f9b1){_0x33d88c=_0x48f9b1;_0x1071d2=0xc8;}else{_0x1071d2=0xce;}_0x44b851[_0x5e61('0x24')](_0x1071d2);return _0x44b851[_0x5e61('0x2a')]('Content-Range',_0x32f715+'-'+_0x33d88c+'/'+_0x48f9b1)[_0x5e61('0x26')](_0x1821d7);}return null;};}function patchUpdates(_0x215e88){return function(_0x37c1e4){try{jsonpatch['apply'](_0x37c1e4,_0x215e88,!![]);}catch(_0x307230){return BPromise[_0x5e61('0x2b')](_0x307230);}return _0x37c1e4[_0x5e61('0x2c')]();};}function saveUpdates(_0x101e6e,_0x3415a8){return function(_0x2ad41f){if(_0x2ad41f){return _0x2ad41f['update'](_0x101e6e)[_0x5e61('0x2d')](function(_0x29b55e){return _0x29b55e;});}return null;};}function removeEntity(_0x325dcc,_0x2faf1d){return function(_0x198217){if(_0x198217){return _0x198217[_0x5e61('0x2e')]()[_0x5e61('0x2d')](function(){_0x325dcc[_0x5e61('0x24')](0xcc)[_0x5e61('0x25')]();});}};}function handleEntityNotFound(_0x4343aa,_0x2d4299){return function(_0x30f6d7){if(!_0x30f6d7){_0x4343aa[_0x5e61('0x23')](0x194);}return _0x30f6d7;};}function handleError(_0x2839f7,_0x4663a3){_0x4663a3=_0x4663a3||0x1f4;return function(_0x303c7d){logger[_0x5e61('0x1e')](_0x303c7d['stack']);if(_0x303c7d['name']){delete _0x303c7d[_0x5e61('0x2f')];}_0x2839f7['status'](_0x4663a3)['send'](_0x303c7d);};}exports[_0x5e61('0x30')]=function(_0x1833e9,_0x19db27){var _0x5e3a90={},_0x5846d5={},_0x3b8bd5={'count':0x0,'rows':[]};var _0x40e4e4=_['map'](db[_0x5e61('0x31')]['rawAttributes'],function(_0x855ec0){return{'name':_0x855ec0[_0x5e61('0x32')],'type':_0x855ec0['type'][_0x5e61('0x33')]};});_0x5846d5['model']=_[_0x5e61('0x34')](_0x40e4e4,_0x5e61('0x2f'));_0x5846d5[_0x5e61('0x35')]=_[_0x5e61('0x36')](_0x1833e9[_0x5e61('0x35')]);_0x5846d5[_0x5e61('0x37')]=_[_0x5e61('0x38')](_0x5846d5[_0x5e61('0x39')],_0x5846d5[_0x5e61('0x35')]);_0x5e3a90[_0x5e61('0x3a')]=_[_0x5e61('0x38')](_0x5846d5['model'],qs[_0x5e61('0x3b')](_0x1833e9['query'][_0x5e61('0x3b')]));_0x5e3a90['attributes']=_0x5e3a90[_0x5e61('0x3a')][_0x5e61('0x3c')]?_0x5e3a90[_0x5e61('0x3a')]:_0x5846d5['model'];if(!_0x1833e9[_0x5e61('0x35')][_0x5e61('0x3d')](_0x5e61('0x3e'))){_0x5e3a90[_0x5e61('0x29')]=qs['limit'](_0x1833e9[_0x5e61('0x35')][_0x5e61('0x29')]);_0x5e3a90['offset']=qs[_0x5e61('0x28')](_0x1833e9[_0x5e61('0x35')][_0x5e61('0x28')]);}_0x5e3a90[_0x5e61('0x3f')]=qs[_0x5e61('0x40')](_0x1833e9[_0x5e61('0x35')][_0x5e61('0x40')]);_0x5e3a90['where']=qs[_0x5e61('0x37')](_[_0x5e61('0x41')](_0x1833e9[_0x5e61('0x35')],_0x5846d5[_0x5e61('0x37')]),_0x40e4e4);if(_0x1833e9[_0x5e61('0x35')]['filter']){_0x5e3a90[_0x5e61('0x42')]=_[_0x5e61('0x43')](_0x5e3a90[_0x5e61('0x42')],{'$or':_[_0x5e61('0x34')](_0x40e4e4,function(_0x4067f7){if(_0x4067f7['type']!==_0x5e61('0x44')){var _0xc564e7={};_0xc564e7[_0x4067f7[_0x5e61('0x2f')]]={'$like':'%'+_0x1833e9['query'][_0x5e61('0x45')]+'%'};return _0xc564e7;}})});}_0x5e3a90=_[_0x5e61('0x43')]({},_0x5e3a90,_0x1833e9['options']);var _0x1b3fc5={'where':_0x5e3a90[_0x5e61('0x42')]};return db['ZendeskConfiguration']['count'](_0x1b3fc5)['then'](function(_0x223807){_0x3b8bd5['count']=_0x223807;if(_0x1833e9[_0x5e61('0x35')][_0x5e61('0x46')]){_0x5e3a90[_0x5e61('0x47')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x5e3a90);})[_0x5e61('0x2d')](function(_0x2eadba){_0x3b8bd5[_0x5e61('0x48')]=_0x2eadba;return _0x3b8bd5;})[_0x5e61('0x2d')](respondWithFilteredResult(_0x19db27,_0x5e3a90))[_0x5e61('0x22')](handleError(_0x19db27,null));};exports[_0x5e61('0x49')]=function(_0x197aec,_0x22142a){var _0x3d077f={'raw':![],'where':{'id':_0x197aec[_0x5e61('0x4a')]['id']}},_0x18c927={};_0x18c927[_0x5e61('0x39')]=_[_0x5e61('0x36')](db[_0x5e61('0x31')][_0x5e61('0x4b')]);_0x18c927[_0x5e61('0x35')]=_[_0x5e61('0x36')](_0x197aec[_0x5e61('0x35')]);_0x18c927['filters']=_['intersection'](_0x18c927[_0x5e61('0x39')],_0x18c927['query']);_0x3d077f[_0x5e61('0x3a')]=_['intersection'](_0x18c927[_0x5e61('0x39')],qs['fields'](_0x197aec[_0x5e61('0x35')][_0x5e61('0x3b')]));_0x3d077f[_0x5e61('0x3a')]=_0x3d077f[_0x5e61('0x3a')]['length']?_0x3d077f[_0x5e61('0x3a')]:_0x18c927[_0x5e61('0x39')];if(_0x197aec[_0x5e61('0x35')][_0x5e61('0x46')]){_0x3d077f[_0x5e61('0x47')]=[{'all':!![]}];}_0x3d077f=_['merge']({},_0x3d077f,_0x197aec['options']);return db[_0x5e61('0x31')]['find'](_0x3d077f)[_0x5e61('0x2d')](handleEntityNotFound(_0x22142a,null))[_0x5e61('0x2d')](respondWithResult(_0x22142a,null))[_0x5e61('0x22')](handleError(_0x22142a,null));};exports[_0x5e61('0x4c')]=function(_0x3d98c2,_0x2e419d){return db[_0x5e61('0x31')][_0x5e61('0x4c')](_0x3d98c2[_0x5e61('0x4d')],{})[_0x5e61('0x2d')](respondWithResult(_0x2e419d,0xc9))[_0x5e61('0x22')](handleError(_0x2e419d,null));};exports[_0x5e61('0x4e')]=function(_0x3999d2,_0x4ecb8b){if(_0x3999d2[_0x5e61('0x4d')]['id']){delete _0x3999d2['body']['id'];}return db['ZendeskConfiguration'][_0x5e61('0x4f')]({'where':{'id':_0x3999d2[_0x5e61('0x4a')]['id']}})[_0x5e61('0x2d')](handleEntityNotFound(_0x4ecb8b,null))[_0x5e61('0x2d')](saveUpdates(_0x3999d2[_0x5e61('0x4d')],null))[_0x5e61('0x2d')](respondWithResult(_0x4ecb8b,null))['catch'](handleError(_0x4ecb8b,null));};exports[_0x5e61('0x2e')]=function(_0x1a7cf1,_0x100c2e){return db[_0x5e61('0x31')]['find']({'where':{'id':_0x1a7cf1[_0x5e61('0x4a')]['id']}})[_0x5e61('0x2d')](handleEntityNotFound(_0x100c2e,null))[_0x5e61('0x2d')](removeEntity(_0x100c2e,null))[_0x5e61('0x22')](handleError(_0x100c2e,null));};exports[_0x5e61('0x50')]=function(_0x426c7e,_0x22be09,_0x3665c3){var _0x53c4a4={};var _0x106a37={};var _0x291a44;var _0xff5d5d;return db['ZendeskConfiguration'][_0x5e61('0x51')]({'where':{'id':_0x426c7e[_0x5e61('0x4a')]['id']}})[_0x5e61('0x2d')](handleEntityNotFound(_0x22be09,null))[_0x5e61('0x2d')](function(_0x296369){if(_0x296369){_0x291a44=_0x296369;_0x106a37['model']=_[_0x5e61('0x36')](db[_0x5e61('0x52')][_0x5e61('0x4b')]);_0x106a37[_0x5e61('0x35')]=_[_0x5e61('0x36')](_0x426c7e[_0x5e61('0x35')]);_0x106a37[_0x5e61('0x37')]=_[_0x5e61('0x38')](_0x106a37[_0x5e61('0x39')],_0x106a37[_0x5e61('0x35')]);_0x53c4a4[_0x5e61('0x3a')]=_[_0x5e61('0x38')](_0x106a37[_0x5e61('0x39')],qs[_0x5e61('0x3b')](_0x426c7e[_0x5e61('0x35')][_0x5e61('0x3b')]));_0x53c4a4[_0x5e61('0x3a')]=_0x53c4a4[_0x5e61('0x3a')][_0x5e61('0x3c')]?_0x53c4a4[_0x5e61('0x3a')]:_0x106a37[_0x5e61('0x39')];_0x53c4a4['order']=qs[_0x5e61('0x40')](_0x426c7e[_0x5e61('0x35')]['sort']);_0x53c4a4[_0x5e61('0x42')]=qs[_0x5e61('0x37')](_[_0x5e61('0x41')](_0x426c7e[_0x5e61('0x35')],_0x106a37['filters']));if(_0x426c7e[_0x5e61('0x35')][_0x5e61('0x45')]){_0x53c4a4[_0x5e61('0x42')]=_[_0x5e61('0x43')](_0x53c4a4[_0x5e61('0x42')],{'$or':_[_0x5e61('0x34')](_0x53c4a4[_0x5e61('0x3a')],function(_0x4a84de){var _0x30bd92={};_0x30bd92[_0x4a84de]={'$like':'%'+_0x426c7e[_0x5e61('0x35')]['filter']+'%'};return _0x30bd92;})});}_0x53c4a4=_['merge']({},_0x53c4a4,_0x426c7e[_0x5e61('0x53')]);return _0x291a44['getFields'](_0x53c4a4);}})[_0x5e61('0x2d')](function(_0x42bb36){if(_0x42bb36){_0xff5d5d=_0x42bb36[_0x5e61('0x3c')];if(!_0x426c7e[_0x5e61('0x35')]['hasOwnProperty'](_0x5e61('0x3e'))){_0x53c4a4[_0x5e61('0x29')]=qs[_0x5e61('0x29')](_0x426c7e['query']['limit']);_0x53c4a4['offset']=qs[_0x5e61('0x28')](_0x426c7e[_0x5e61('0x35')][_0x5e61('0x28')]);}return _0x291a44[_0x5e61('0x50')](_0x53c4a4);}})[_0x5e61('0x2d')](function(_0x5c1ca0){if(_0x5c1ca0){return _0x5c1ca0?{'count':_0xff5d5d,'rows':_0x5c1ca0}:null;}})[_0x5e61('0x2d')](respondWithResult(_0x22be09,null))[_0x5e61('0x22')](handleError(_0x22be09,null));};exports[_0x5e61('0x54')]=function(_0x1b5b64,_0x3cd8c8,_0x374563){var _0x5ddd6d={};var _0xb98bc8={};var _0x5dd2f6;var _0x2e564a;return db[_0x5e61('0x31')][_0x5e61('0x51')]({'where':{'id':_0x1b5b64[_0x5e61('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3cd8c8,null))[_0x5e61('0x2d')](function(_0x222010){if(_0x222010){_0x5dd2f6=_0x222010;_0xb98bc8[_0x5e61('0x39')]=_[_0x5e61('0x36')](db[_0x5e61('0x52')][_0x5e61('0x4b')]);_0xb98bc8[_0x5e61('0x35')]=_['keys'](_0x1b5b64[_0x5e61('0x35')]);_0xb98bc8[_0x5e61('0x37')]=_[_0x5e61('0x38')](_0xb98bc8['model'],_0xb98bc8['query']);_0x5ddd6d[_0x5e61('0x3a')]=_[_0x5e61('0x38')](_0xb98bc8['model'],qs[_0x5e61('0x3b')](_0x1b5b64[_0x5e61('0x35')]['fields']));_0x5ddd6d['attributes']=_0x5ddd6d[_0x5e61('0x3a')][_0x5e61('0x3c')]?_0x5ddd6d['attributes']:_0xb98bc8[_0x5e61('0x39')];_0x5ddd6d[_0x5e61('0x3f')]=qs['sort'](_0x1b5b64[_0x5e61('0x35')][_0x5e61('0x40')]);_0x5ddd6d[_0x5e61('0x42')]=qs[_0x5e61('0x37')](_[_0x5e61('0x41')](_0x1b5b64[_0x5e61('0x35')],_0xb98bc8[_0x5e61('0x37')]));if(_0x1b5b64[_0x5e61('0x35')][_0x5e61('0x45')]){_0x5ddd6d[_0x5e61('0x42')]=_[_0x5e61('0x43')](_0x5ddd6d[_0x5e61('0x42')],{'$or':_[_0x5e61('0x34')](_0x5ddd6d[_0x5e61('0x3a')],function(_0x5f3a68){var _0x5c7526={};_0x5c7526[_0x5f3a68]={'$like':'%'+_0x1b5b64[_0x5e61('0x35')][_0x5e61('0x45')]+'%'};return _0x5c7526;})});}_0x5ddd6d=_[_0x5e61('0x43')]({},_0x5ddd6d,_0x1b5b64[_0x5e61('0x53')]);return _0x5dd2f6['getSubjects'](_0x5ddd6d);}})['then'](function(_0x2f0836){if(_0x2f0836){_0x2e564a=_0x2f0836[_0x5e61('0x3c')];if(!_0x1b5b64[_0x5e61('0x35')][_0x5e61('0x3d')](_0x5e61('0x3e'))){_0x5ddd6d[_0x5e61('0x29')]=qs[_0x5e61('0x29')](_0x1b5b64[_0x5e61('0x35')]['limit']);_0x5ddd6d[_0x5e61('0x28')]=qs[_0x5e61('0x28')](_0x1b5b64[_0x5e61('0x35')]['offset']);}return _0x5dd2f6[_0x5e61('0x54')](_0x5ddd6d);}})[_0x5e61('0x2d')](function(_0x4fb653){if(_0x4fb653){return _0x4fb653?{'count':_0x2e564a,'rows':_0x4fb653}:null;}})[_0x5e61('0x2d')](respondWithResult(_0x3cd8c8,null))['catch'](handleError(_0x3cd8c8,null));};exports[_0x5e61('0x55')]=function(_0x1c129b,_0xd500b,_0x3904d4){var _0x564797={};var _0x2c1a96={};var _0x5ea396;var _0x39054d;return db[_0x5e61('0x31')]['findOne']({'where':{'id':_0x1c129b[_0x5e61('0x4a')]['id']}})[_0x5e61('0x2d')](handleEntityNotFound(_0xd500b,null))[_0x5e61('0x2d')](function(_0x28fcf8){if(_0x28fcf8){_0x5ea396=_0x28fcf8;_0x2c1a96[_0x5e61('0x39')]=_[_0x5e61('0x36')](db[_0x5e61('0x52')][_0x5e61('0x4b')]);_0x2c1a96[_0x5e61('0x35')]=_[_0x5e61('0x36')](_0x1c129b[_0x5e61('0x35')]);_0x2c1a96[_0x5e61('0x37')]=_['intersection'](_0x2c1a96[_0x5e61('0x39')],_0x2c1a96[_0x5e61('0x35')]);_0x564797[_0x5e61('0x3a')]=_[_0x5e61('0x38')](_0x2c1a96[_0x5e61('0x39')],qs[_0x5e61('0x3b')](_0x1c129b[_0x5e61('0x35')][_0x5e61('0x3b')]));_0x564797[_0x5e61('0x3a')]=_0x564797['attributes'][_0x5e61('0x3c')]?_0x564797[_0x5e61('0x3a')]:_0x2c1a96[_0x5e61('0x39')];_0x564797[_0x5e61('0x3f')]=qs['sort'](_0x1c129b['query'][_0x5e61('0x40')]);_0x564797[_0x5e61('0x42')]=qs['filters'](_[_0x5e61('0x41')](_0x1c129b['query'],_0x2c1a96[_0x5e61('0x37')]));if(_0x1c129b[_0x5e61('0x35')][_0x5e61('0x45')]){_0x564797[_0x5e61('0x42')]=_[_0x5e61('0x43')](_0x564797['where'],{'$or':_[_0x5e61('0x34')](_0x564797[_0x5e61('0x3a')],function(_0xb03c63){var _0x44b6c6={};_0x44b6c6[_0xb03c63]={'$like':'%'+_0x1c129b[_0x5e61('0x35')][_0x5e61('0x45')]+'%'};return _0x44b6c6;})});}_0x564797=_['merge']({},_0x564797,_0x1c129b['options']);return _0x5ea396[_0x5e61('0x55')](_0x564797);}})[_0x5e61('0x2d')](function(_0x2f9994){if(_0x2f9994){_0x39054d=_0x2f9994['length'];if(!_0x1c129b['query'][_0x5e61('0x3d')](_0x5e61('0x3e'))){_0x564797[_0x5e61('0x29')]=qs[_0x5e61('0x29')](_0x1c129b[_0x5e61('0x35')][_0x5e61('0x29')]);_0x564797[_0x5e61('0x28')]=qs['offset'](_0x1c129b[_0x5e61('0x35')][_0x5e61('0x28')]);}return _0x5ea396[_0x5e61('0x55')](_0x564797);}})[_0x5e61('0x2d')](function(_0x51215d){if(_0x51215d){return _0x51215d?{'count':_0x39054d,'rows':_0x51215d}:null;}})['then'](respondWithResult(_0xd500b,null))[_0x5e61('0x22')](handleError(_0xd500b,null));};exports[_0x5e61('0x56')]=function(_0x4e2024,_0x3a4525,_0x198493){var _0x4a3795={};var _0x452e28={};var _0x45ad27;var _0x17f96f;return db[_0x5e61('0x31')][_0x5e61('0x51')]({'where':{'id':_0x4e2024['params']['id']}})[_0x5e61('0x2d')](handleEntityNotFound(_0x3a4525,null))[_0x5e61('0x2d')](function(_0x92b26b){if(_0x92b26b){_0x45ad27=_0x92b26b;_0x452e28[_0x5e61('0x39')]=_[_0x5e61('0x36')](db['Tag'][_0x5e61('0x4b')]);_0x452e28['query']=_[_0x5e61('0x36')](_0x4e2024[_0x5e61('0x35')]);_0x452e28[_0x5e61('0x37')]=_[_0x5e61('0x38')](_0x452e28[_0x5e61('0x39')],_0x452e28['query']);_0x4a3795[_0x5e61('0x3a')]=_[_0x5e61('0x38')](_0x452e28[_0x5e61('0x39')],qs[_0x5e61('0x3b')](_0x4e2024['query'][_0x5e61('0x3b')]));_0x4a3795[_0x5e61('0x3a')]=_0x4a3795[_0x5e61('0x3a')]['length']?_0x4a3795['attributes']:_0x452e28[_0x5e61('0x39')];_0x4a3795[_0x5e61('0x3f')]=qs[_0x5e61('0x40')](_0x4e2024['query'][_0x5e61('0x40')]);_0x4a3795['where']=qs[_0x5e61('0x37')](_[_0x5e61('0x41')](_0x4e2024[_0x5e61('0x35')],_0x452e28[_0x5e61('0x37')]));if(_0x4e2024[_0x5e61('0x35')][_0x5e61('0x45')]){_0x4a3795[_0x5e61('0x42')]=_['merge'](_0x4a3795['where'],{'$or':_[_0x5e61('0x34')](_0x4a3795[_0x5e61('0x3a')],function(_0xad25a0){var _0x4da21a={};_0x4da21a[_0xad25a0]={'$like':'%'+_0x4e2024['query'][_0x5e61('0x45')]+'%'};return _0x4da21a;})});}_0x4a3795=_[_0x5e61('0x43')]({},_0x4a3795,_0x4e2024[_0x5e61('0x53')]);return _0x45ad27['getTags'](_0x4a3795);}})['then'](function(_0x48d6d0){if(_0x48d6d0){_0x17f96f=_0x48d6d0[_0x5e61('0x3c')];if(!_0x4e2024[_0x5e61('0x35')][_0x5e61('0x3d')](_0x5e61('0x3e'))){_0x4a3795[_0x5e61('0x29')]=qs[_0x5e61('0x29')](_0x4e2024['query'][_0x5e61('0x29')]);_0x4a3795['offset']=qs[_0x5e61('0x28')](_0x4e2024[_0x5e61('0x35')][_0x5e61('0x28')]);}return _0x45ad27['getTags'](_0x4a3795);}})[_0x5e61('0x2d')](function(_0x42347d){if(_0x42347d){return _0x42347d?{'count':_0x17f96f,'rows':_0x42347d}:null;}})[_0x5e61('0x2d')](respondWithResult(_0x3a4525,null))[_0x5e61('0x22')](handleError(_0x3a4525,null));};exports[_0x5e61('0x57')]=function(_0x39afc1,_0x1c7c8d,_0x169bd1){if(_0x39afc1[_0x5e61('0x4d')]['id']){delete _0x39afc1[_0x5e61('0x4d')]['id'];}return db[_0x5e61('0x31')][_0x5e61('0x51')]({'where':{'id':_0x39afc1[_0x5e61('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1c7c8d,null))['then'](function(_0x1835a5){if(_0x1835a5){return _0x1835a5['setTags'](_0x39afc1['body'][_0x5e61('0x58')]||[]);}return null;})[_0x5e61('0x2d')](respondWithResult(_0x1c7c8d,null))[_0x5e61('0x22')](handleError(_0x1c7c8d,null));}; \ No newline at end of file +var _0xc2ee=['rawAttributes','key','map','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','merge','type','filter','options','count','includeAll','include','findAll','rows','show','params','find','create','body','destroy','getFields','ZendeskField','order','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','limit','set','Content-Range','apply','reject','save','update','end','sendStatus','stack','name','send','index','ZendeskConfiguration'];(function(_0x3773da,_0xa6fa81){var _0x1a607d=function(_0x382299){while(--_0x382299){_0x3773da['push'](_0x3773da['shift']());}};_0x1a607d(++_0xa6fa81);}(_0xc2ee,0xe2));var _0xec2e=function(_0x13013a,_0x2ff754){_0x13013a=_0x13013a-0x0;var _0x5ef930=_0xc2ee[_0x13013a];return _0x5ef930;};'use strict';var pdf=require(_0xec2e('0x0'));var emlformat=require(_0xec2e('0x1'));var rimraf=require(_0xec2e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xec2e('0x3'));var rp=require(_0xec2e('0x4'));var moment=require(_0xec2e('0x5'));var BPromise=require(_0xec2e('0x6'));var Mustache=require(_0xec2e('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xec2e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xec2e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xec2e('0xa'));var deskjs=require(_0xec2e('0xb'));var toCsv=require('to-csv');var querystring=require(_0xec2e('0xc'));var Papa=require(_0xec2e('0xd'));var Redis=require(_0xec2e('0xe'));var authService=require(_0xec2e('0xf'));var qs=require(_0xec2e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec2e('0x11'));var logger=require(_0xec2e('0x12'))('api');var utils=require(_0xec2e('0x13'));var config=require(_0xec2e('0x14'));var licenseUtil=require(_0xec2e('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0xec2e('0x16'));var client=jayson[_0xec2e('0x17')][_0xec2e('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x6b7468,_0x114b1e,_0x58fbef,_0x289cd9){return new BPromise(function(_0x39f6fa,_0x42ce1d){var _0x57a8cb=_0x289cd9||client;return _0x57a8cb['request'](_0x6b7468,_0x58fbef)[_0xec2e('0x19')](function(_0x37420d){logger[_0xec2e('0x1a')](_0xec2e('0x1b'),_0x114b1e,_0xec2e('0x1c'));logger['debug'](_0xec2e('0x1d'),_0x114b1e,_0xec2e('0x1c'),JSON[_0xec2e('0x1e')](_0x37420d));if(_0x37420d[_0xec2e('0x1f')]){if(_0x37420d['error'][_0xec2e('0x20')]===0x1f4){logger[_0xec2e('0x1f')](_0xec2e('0x1b'),_0x114b1e,_0x37420d[_0xec2e('0x1f')][_0xec2e('0x21')]);return _0x42ce1d(_0x37420d['error'][_0xec2e('0x21')]);}logger[_0xec2e('0x1f')](_0xec2e('0x1b'),_0x114b1e,_0x37420d[_0xec2e('0x1f')][_0xec2e('0x21')]);return _0x39f6fa(_0x37420d[_0xec2e('0x1f')][_0xec2e('0x21')]);}else{logger[_0xec2e('0x1a')](_0xec2e('0x1b'),_0x114b1e,_0xec2e('0x1c'));_0x39f6fa(_0x37420d[_0xec2e('0x22')][_0xec2e('0x21')]);}})[_0xec2e('0x23')](function(_0x2de73c){logger[_0xec2e('0x1f')](_0xec2e('0x1b'),_0x114b1e,_0x2de73c);_0x42ce1d(_0x2de73c);});});}function respondWithStatusCode(_0x4b669e,_0x3e578d){_0x3e578d=_0x3e578d||0xcc;return function(_0x366704){if(_0x366704){return _0x4b669e['sendStatus'](_0x3e578d);}return _0x4b669e[_0xec2e('0x24')](_0x3e578d)['end']();};}function respondWithResult(_0x4422e0,_0x899f19){_0x899f19=_0x899f19||0xc8;return function(_0x22f371){if(_0x22f371){return _0x4422e0[_0xec2e('0x24')](_0x899f19)[_0xec2e('0x25')](_0x22f371);}};}function respondWithFilteredResult(_0x32b677,_0x988521){return function(_0x45bd07){if(_0x45bd07){var _0x3b9ad7=_0x45bd07['count'],_0x37c4f5=_0x988521[_0xec2e('0x26')],_0x613615=_0x988521[_0xec2e('0x26')]+_0x988521[_0xec2e('0x27')],_0x1e2900;if(_0x613615>=_0x3b9ad7){_0x613615=_0x3b9ad7;_0x1e2900=0xc8;}else{_0x1e2900=0xce;}_0x32b677['status'](_0x1e2900);return _0x32b677[_0xec2e('0x28')](_0xec2e('0x29'),_0x37c4f5+'-'+_0x613615+'/'+_0x3b9ad7)[_0xec2e('0x25')](_0x45bd07);}return null;};}function patchUpdates(_0x3fd814){return function(_0x2a60f0){try{jsonpatch[_0xec2e('0x2a')](_0x2a60f0,_0x3fd814,!![]);}catch(_0x44079b){return BPromise[_0xec2e('0x2b')](_0x44079b);}return _0x2a60f0[_0xec2e('0x2c')]();};}function saveUpdates(_0x595d69,_0x29e690){return function(_0x33dcf6){if(_0x33dcf6){return _0x33dcf6[_0xec2e('0x2d')](_0x595d69)[_0xec2e('0x19')](function(_0x51c92e){return _0x51c92e;});}return null;};}function removeEntity(_0x4d2358,_0x22991a){return function(_0x1fa684){if(_0x1fa684){return _0x1fa684['destroy']()['then'](function(){_0x4d2358['status'](0xcc)[_0xec2e('0x2e')]();});}};}function handleEntityNotFound(_0x3ebdca,_0x4f50af){return function(_0x1a0146){if(!_0x1a0146){_0x3ebdca[_0xec2e('0x2f')](0x194);}return _0x1a0146;};}function handleError(_0x4767f3,_0xbe8458){_0xbe8458=_0xbe8458||0x1f4;return function(_0x4e0267){logger[_0xec2e('0x1f')](_0x4e0267[_0xec2e('0x30')]);if(_0x4e0267[_0xec2e('0x31')]){delete _0x4e0267[_0xec2e('0x31')];}_0x4767f3[_0xec2e('0x24')](_0xbe8458)[_0xec2e('0x32')](_0x4e0267);};}exports[_0xec2e('0x33')]=function(_0x5a4c43,_0xedd52e){var _0x1106e7={},_0xaca438={},_0x45d6b3={'count':0x0,'rows':[]};var _0x52447d=_['map'](db[_0xec2e('0x34')][_0xec2e('0x35')],function(_0x4197cc){return{'name':_0x4197cc['fieldName'],'type':_0x4197cc['type'][_0xec2e('0x36')]};});_0xaca438['model']=_[_0xec2e('0x37')](_0x52447d,_0xec2e('0x31'));_0xaca438[_0xec2e('0x38')]=_[_0xec2e('0x39')](_0x5a4c43['query']);_0xaca438[_0xec2e('0x3a')]=_[_0xec2e('0x3b')](_0xaca438['model'],_0xaca438[_0xec2e('0x38')]);_0x1106e7[_0xec2e('0x3c')]=_[_0xec2e('0x3b')](_0xaca438[_0xec2e('0x3d')],qs[_0xec2e('0x3e')](_0x5a4c43[_0xec2e('0x38')]['fields']));_0x1106e7[_0xec2e('0x3c')]=_0x1106e7[_0xec2e('0x3c')][_0xec2e('0x3f')]?_0x1106e7[_0xec2e('0x3c')]:_0xaca438['model'];if(!_0x5a4c43[_0xec2e('0x38')]['hasOwnProperty'](_0xec2e('0x40'))){_0x1106e7[_0xec2e('0x27')]=qs[_0xec2e('0x27')](_0x5a4c43[_0xec2e('0x38')][_0xec2e('0x27')]);_0x1106e7[_0xec2e('0x26')]=qs[_0xec2e('0x26')](_0x5a4c43[_0xec2e('0x38')][_0xec2e('0x26')]);}_0x1106e7['order']=qs[_0xec2e('0x41')](_0x5a4c43['query']['sort']);_0x1106e7[_0xec2e('0x42')]=qs[_0xec2e('0x3a')](_[_0xec2e('0x43')](_0x5a4c43[_0xec2e('0x38')],_0xaca438['filters']),_0x52447d);if(_0x5a4c43[_0xec2e('0x38')]['filter']){_0x1106e7['where']=_[_0xec2e('0x44')](_0x1106e7['where'],{'$or':_[_0xec2e('0x37')](_0x52447d,function(_0x5dceaa){if(_0x5dceaa[_0xec2e('0x45')]!=='VIRTUAL'){var _0x3bbdc0={};_0x3bbdc0[_0x5dceaa['name']]={'$like':'%'+_0x5a4c43[_0xec2e('0x38')][_0xec2e('0x46')]+'%'};return _0x3bbdc0;}})});}_0x1106e7=_[_0xec2e('0x44')]({},_0x1106e7,_0x5a4c43[_0xec2e('0x47')]);var _0x279277={'where':_0x1106e7[_0xec2e('0x42')]};return db[_0xec2e('0x34')][_0xec2e('0x48')](_0x279277)[_0xec2e('0x19')](function(_0x30d515){_0x45d6b3[_0xec2e('0x48')]=_0x30d515;if(_0x5a4c43[_0xec2e('0x38')][_0xec2e('0x49')]){_0x1106e7[_0xec2e('0x4a')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xec2e('0x4b')](_0x1106e7);})['then'](function(_0x139d5d){_0x45d6b3[_0xec2e('0x4c')]=_0x139d5d;return _0x45d6b3;})[_0xec2e('0x19')](respondWithFilteredResult(_0xedd52e,_0x1106e7))[_0xec2e('0x23')](handleError(_0xedd52e,null));};exports[_0xec2e('0x4d')]=function(_0x2fdd97,_0x33bd55){var _0xcf57c2={'raw':![],'where':{'id':_0x2fdd97[_0xec2e('0x4e')]['id']}},_0x2698be={};_0x2698be['model']=_['keys'](db[_0xec2e('0x34')][_0xec2e('0x35')]);_0x2698be[_0xec2e('0x38')]=_['keys'](_0x2fdd97[_0xec2e('0x38')]);_0x2698be[_0xec2e('0x3a')]=_[_0xec2e('0x3b')](_0x2698be[_0xec2e('0x3d')],_0x2698be[_0xec2e('0x38')]);_0xcf57c2[_0xec2e('0x3c')]=_[_0xec2e('0x3b')](_0x2698be[_0xec2e('0x3d')],qs[_0xec2e('0x3e')](_0x2fdd97[_0xec2e('0x38')][_0xec2e('0x3e')]));_0xcf57c2[_0xec2e('0x3c')]=_0xcf57c2[_0xec2e('0x3c')][_0xec2e('0x3f')]?_0xcf57c2[_0xec2e('0x3c')]:_0x2698be[_0xec2e('0x3d')];if(_0x2fdd97['query'][_0xec2e('0x49')]){_0xcf57c2[_0xec2e('0x4a')]=[{'all':!![]}];}_0xcf57c2=_[_0xec2e('0x44')]({},_0xcf57c2,_0x2fdd97[_0xec2e('0x47')]);return db[_0xec2e('0x34')][_0xec2e('0x4f')](_0xcf57c2)['then'](handleEntityNotFound(_0x33bd55,null))['then'](respondWithResult(_0x33bd55,null))[_0xec2e('0x23')](handleError(_0x33bd55,null));};exports[_0xec2e('0x50')]=function(_0x119478,_0x4c16dd){return db[_0xec2e('0x34')][_0xec2e('0x50')](_0x119478[_0xec2e('0x51')],{})[_0xec2e('0x19')](respondWithResult(_0x4c16dd,0xc9))[_0xec2e('0x23')](handleError(_0x4c16dd,null));};exports[_0xec2e('0x2d')]=function(_0xe8c3a2,_0x2c49a0){if(_0xe8c3a2['body']['id']){delete _0xe8c3a2[_0xec2e('0x51')]['id'];}return db[_0xec2e('0x34')][_0xec2e('0x4f')]({'where':{'id':_0xe8c3a2['params']['id']}})[_0xec2e('0x19')](handleEntityNotFound(_0x2c49a0,null))[_0xec2e('0x19')](saveUpdates(_0xe8c3a2[_0xec2e('0x51')],null))[_0xec2e('0x19')](respondWithResult(_0x2c49a0,null))['catch'](handleError(_0x2c49a0,null));};exports[_0xec2e('0x52')]=function(_0x678a86,_0x317747){return db['ZendeskConfiguration'][_0xec2e('0x4f')]({'where':{'id':_0x678a86['params']['id']}})[_0xec2e('0x19')](handleEntityNotFound(_0x317747,null))[_0xec2e('0x19')](removeEntity(_0x317747,null))[_0xec2e('0x23')](handleError(_0x317747,null));};exports[_0xec2e('0x53')]=function(_0x25746a,_0x2e34a0,_0x43c0c5){var _0x3cea59={};var _0x2a8171={};var _0x3e07cb;var _0x3ba03d;return db[_0xec2e('0x34')]['findOne']({'where':{'id':_0x25746a[_0xec2e('0x4e')]['id']}})[_0xec2e('0x19')](handleEntityNotFound(_0x2e34a0,null))['then'](function(_0x1c1bc5){if(_0x1c1bc5){_0x3e07cb=_0x1c1bc5;_0x2a8171[_0xec2e('0x3d')]=_[_0xec2e('0x39')](db[_0xec2e('0x54')][_0xec2e('0x35')]);_0x2a8171['query']=_[_0xec2e('0x39')](_0x25746a[_0xec2e('0x38')]);_0x2a8171[_0xec2e('0x3a')]=_[_0xec2e('0x3b')](_0x2a8171[_0xec2e('0x3d')],_0x2a8171['query']);_0x3cea59[_0xec2e('0x3c')]=_['intersection'](_0x2a8171['model'],qs['fields'](_0x25746a[_0xec2e('0x38')][_0xec2e('0x3e')]));_0x3cea59['attributes']=_0x3cea59[_0xec2e('0x3c')][_0xec2e('0x3f')]?_0x3cea59[_0xec2e('0x3c')]:_0x2a8171[_0xec2e('0x3d')];_0x3cea59[_0xec2e('0x55')]=qs[_0xec2e('0x41')](_0x25746a[_0xec2e('0x38')][_0xec2e('0x41')]);_0x3cea59[_0xec2e('0x42')]=qs[_0xec2e('0x3a')](_[_0xec2e('0x43')](_0x25746a[_0xec2e('0x38')],_0x2a8171['filters']));if(_0x25746a[_0xec2e('0x38')][_0xec2e('0x46')]){_0x3cea59['where']=_['merge'](_0x3cea59[_0xec2e('0x42')],{'$or':_['map'](_0x3cea59[_0xec2e('0x3c')],function(_0x4d10ac){var _0x3ca05d={};_0x3ca05d[_0x4d10ac]={'$like':'%'+_0x25746a[_0xec2e('0x38')][_0xec2e('0x46')]+'%'};return _0x3ca05d;})});}_0x3cea59=_[_0xec2e('0x44')]({},_0x3cea59,_0x25746a[_0xec2e('0x47')]);return _0x3e07cb[_0xec2e('0x53')](_0x3cea59);}})[_0xec2e('0x19')](function(_0x28d889){if(_0x28d889){_0x3ba03d=_0x28d889[_0xec2e('0x3f')];if(!_0x25746a['query'][_0xec2e('0x56')](_0xec2e('0x40'))){_0x3cea59[_0xec2e('0x27')]=qs['limit'](_0x25746a[_0xec2e('0x38')]['limit']);_0x3cea59['offset']=qs[_0xec2e('0x26')](_0x25746a[_0xec2e('0x38')]['offset']);}return _0x3e07cb[_0xec2e('0x53')](_0x3cea59);}})[_0xec2e('0x19')](function(_0x537503){if(_0x537503){return _0x537503?{'count':_0x3ba03d,'rows':_0x537503}:null;}})[_0xec2e('0x19')](respondWithResult(_0x2e34a0,null))['catch'](handleError(_0x2e34a0,null));};exports[_0xec2e('0x57')]=function(_0x22df0f,_0x3f5dad,_0x53bcd3){var _0x3ac060={};var _0x2e16d6={};var _0x3998f2;var _0x17f477;return db[_0xec2e('0x34')][_0xec2e('0x58')]({'where':{'id':_0x22df0f[_0xec2e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3f5dad,null))['then'](function(_0x704f8){if(_0x704f8){_0x3998f2=_0x704f8;_0x2e16d6[_0xec2e('0x3d')]=_[_0xec2e('0x39')](db[_0xec2e('0x54')][_0xec2e('0x35')]);_0x2e16d6[_0xec2e('0x38')]=_[_0xec2e('0x39')](_0x22df0f[_0xec2e('0x38')]);_0x2e16d6[_0xec2e('0x3a')]=_['intersection'](_0x2e16d6[_0xec2e('0x3d')],_0x2e16d6[_0xec2e('0x38')]);_0x3ac060[_0xec2e('0x3c')]=_[_0xec2e('0x3b')](_0x2e16d6[_0xec2e('0x3d')],qs[_0xec2e('0x3e')](_0x22df0f[_0xec2e('0x38')][_0xec2e('0x3e')]));_0x3ac060[_0xec2e('0x3c')]=_0x3ac060['attributes']['length']?_0x3ac060['attributes']:_0x2e16d6['model'];_0x3ac060['order']=qs[_0xec2e('0x41')](_0x22df0f['query'][_0xec2e('0x41')]);_0x3ac060['where']=qs[_0xec2e('0x3a')](_[_0xec2e('0x43')](_0x22df0f[_0xec2e('0x38')],_0x2e16d6[_0xec2e('0x3a')]));if(_0x22df0f[_0xec2e('0x38')][_0xec2e('0x46')]){_0x3ac060[_0xec2e('0x42')]=_['merge'](_0x3ac060[_0xec2e('0x42')],{'$or':_[_0xec2e('0x37')](_0x3ac060[_0xec2e('0x3c')],function(_0x29218f){var _0x5f2fe1={};_0x5f2fe1[_0x29218f]={'$like':'%'+_0x22df0f['query'][_0xec2e('0x46')]+'%'};return _0x5f2fe1;})});}_0x3ac060=_[_0xec2e('0x44')]({},_0x3ac060,_0x22df0f[_0xec2e('0x47')]);return _0x3998f2['getSubjects'](_0x3ac060);}})[_0xec2e('0x19')](function(_0x2b7f1d){if(_0x2b7f1d){_0x17f477=_0x2b7f1d['length'];if(!_0x22df0f[_0xec2e('0x38')][_0xec2e('0x56')](_0xec2e('0x40'))){_0x3ac060['limit']=qs[_0xec2e('0x27')](_0x22df0f[_0xec2e('0x38')][_0xec2e('0x27')]);_0x3ac060[_0xec2e('0x26')]=qs[_0xec2e('0x26')](_0x22df0f[_0xec2e('0x38')]['offset']);}return _0x3998f2['getSubjects'](_0x3ac060);}})['then'](function(_0x59c4f1){if(_0x59c4f1){return _0x59c4f1?{'count':_0x17f477,'rows':_0x59c4f1}:null;}})[_0xec2e('0x19')](respondWithResult(_0x3f5dad,null))['catch'](handleError(_0x3f5dad,null));};exports[_0xec2e('0x59')]=function(_0x494e7d,_0x4f41ec,_0x5edf07){var _0x2d1a8b={};var _0x440284={};var _0x1d8d78;var _0x17e160;return db['ZendeskConfiguration'][_0xec2e('0x58')]({'where':{'id':_0x494e7d[_0xec2e('0x4e')]['id']}})[_0xec2e('0x19')](handleEntityNotFound(_0x4f41ec,null))[_0xec2e('0x19')](function(_0x374731){if(_0x374731){_0x1d8d78=_0x374731;_0x440284[_0xec2e('0x3d')]=_[_0xec2e('0x39')](db[_0xec2e('0x54')][_0xec2e('0x35')]);_0x440284[_0xec2e('0x38')]=_[_0xec2e('0x39')](_0x494e7d['query']);_0x440284[_0xec2e('0x3a')]=_[_0xec2e('0x3b')](_0x440284[_0xec2e('0x3d')],_0x440284[_0xec2e('0x38')]);_0x2d1a8b['attributes']=_[_0xec2e('0x3b')](_0x440284[_0xec2e('0x3d')],qs['fields'](_0x494e7d[_0xec2e('0x38')][_0xec2e('0x3e')]));_0x2d1a8b[_0xec2e('0x3c')]=_0x2d1a8b['attributes'][_0xec2e('0x3f')]?_0x2d1a8b[_0xec2e('0x3c')]:_0x440284[_0xec2e('0x3d')];_0x2d1a8b['order']=qs[_0xec2e('0x41')](_0x494e7d[_0xec2e('0x38')][_0xec2e('0x41')]);_0x2d1a8b[_0xec2e('0x42')]=qs[_0xec2e('0x3a')](_['pick'](_0x494e7d[_0xec2e('0x38')],_0x440284[_0xec2e('0x3a')]));if(_0x494e7d[_0xec2e('0x38')][_0xec2e('0x46')]){_0x2d1a8b['where']=_[_0xec2e('0x44')](_0x2d1a8b[_0xec2e('0x42')],{'$or':_[_0xec2e('0x37')](_0x2d1a8b[_0xec2e('0x3c')],function(_0x3cc5c6){var _0x546fdb={};_0x546fdb[_0x3cc5c6]={'$like':'%'+_0x494e7d[_0xec2e('0x38')]['filter']+'%'};return _0x546fdb;})});}_0x2d1a8b=_[_0xec2e('0x44')]({},_0x2d1a8b,_0x494e7d['options']);return _0x1d8d78['getDescriptions'](_0x2d1a8b);}})['then'](function(_0x36278c){if(_0x36278c){_0x17e160=_0x36278c['length'];if(!_0x494e7d[_0xec2e('0x38')]['hasOwnProperty']('nolimit')){_0x2d1a8b[_0xec2e('0x27')]=qs[_0xec2e('0x27')](_0x494e7d[_0xec2e('0x38')][_0xec2e('0x27')]);_0x2d1a8b[_0xec2e('0x26')]=qs[_0xec2e('0x26')](_0x494e7d[_0xec2e('0x38')]['offset']);}return _0x1d8d78['getDescriptions'](_0x2d1a8b);}})[_0xec2e('0x19')](function(_0x17a8d1){if(_0x17a8d1){return _0x17a8d1?{'count':_0x17e160,'rows':_0x17a8d1}:null;}})[_0xec2e('0x19')](respondWithResult(_0x4f41ec,null))[_0xec2e('0x23')](handleError(_0x4f41ec,null));};exports[_0xec2e('0x5a')]=function(_0x266223,_0x240fba,_0x1ae391){var _0x1901a7={};var _0x57d490={};var _0x287bc2;var _0x5b7805;return db['ZendeskConfiguration'][_0xec2e('0x58')]({'where':{'id':_0x266223[_0xec2e('0x4e')]['id']}})[_0xec2e('0x19')](handleEntityNotFound(_0x240fba,null))['then'](function(_0x5c67c4){if(_0x5c67c4){_0x287bc2=_0x5c67c4;_0x57d490[_0xec2e('0x3d')]=_[_0xec2e('0x39')](db['Tag']['rawAttributes']);_0x57d490['query']=_[_0xec2e('0x39')](_0x266223[_0xec2e('0x38')]);_0x57d490[_0xec2e('0x3a')]=_[_0xec2e('0x3b')](_0x57d490[_0xec2e('0x3d')],_0x57d490[_0xec2e('0x38')]);_0x1901a7[_0xec2e('0x3c')]=_[_0xec2e('0x3b')](_0x57d490[_0xec2e('0x3d')],qs[_0xec2e('0x3e')](_0x266223['query'][_0xec2e('0x3e')]));_0x1901a7[_0xec2e('0x3c')]=_0x1901a7[_0xec2e('0x3c')][_0xec2e('0x3f')]?_0x1901a7[_0xec2e('0x3c')]:_0x57d490['model'];_0x1901a7['order']=qs[_0xec2e('0x41')](_0x266223[_0xec2e('0x38')]['sort']);_0x1901a7[_0xec2e('0x42')]=qs[_0xec2e('0x3a')](_['pick'](_0x266223[_0xec2e('0x38')],_0x57d490[_0xec2e('0x3a')]));if(_0x266223[_0xec2e('0x38')][_0xec2e('0x46')]){_0x1901a7[_0xec2e('0x42')]=_['merge'](_0x1901a7[_0xec2e('0x42')],{'$or':_[_0xec2e('0x37')](_0x1901a7[_0xec2e('0x3c')],function(_0x22bc39){var _0xb261f0={};_0xb261f0[_0x22bc39]={'$like':'%'+_0x266223[_0xec2e('0x38')][_0xec2e('0x46')]+'%'};return _0xb261f0;})});}_0x1901a7=_[_0xec2e('0x44')]({},_0x1901a7,_0x266223[_0xec2e('0x47')]);return _0x287bc2[_0xec2e('0x5a')](_0x1901a7);}})[_0xec2e('0x19')](function(_0x75fcab){if(_0x75fcab){_0x5b7805=_0x75fcab[_0xec2e('0x3f')];if(!_0x266223['query'][_0xec2e('0x56')](_0xec2e('0x40'))){_0x1901a7[_0xec2e('0x27')]=qs[_0xec2e('0x27')](_0x266223[_0xec2e('0x38')][_0xec2e('0x27')]);_0x1901a7['offset']=qs[_0xec2e('0x26')](_0x266223[_0xec2e('0x38')][_0xec2e('0x26')]);}return _0x287bc2[_0xec2e('0x5a')](_0x1901a7);}})['then'](function(_0x401843){if(_0x401843){return _0x401843?{'count':_0x5b7805,'rows':_0x401843}:null;}})[_0xec2e('0x19')](respondWithResult(_0x240fba,null))['catch'](handleError(_0x240fba,null));};exports[_0xec2e('0x5b')]=function(_0x1d9b3d,_0x536a48,_0x11adb2){if(_0x1d9b3d['body']['id']){delete _0x1d9b3d[_0xec2e('0x51')]['id'];}return db[_0xec2e('0x34')]['findOne']({'where':{'id':_0x1d9b3d[_0xec2e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x536a48,null))[_0xec2e('0x19')](function(_0x4d625d){if(_0x4d625d){return _0x4d625d[_0xec2e('0x5b')](_0x1d9b3d[_0xec2e('0x51')][_0xec2e('0x5c')]||[]);}return null;})[_0xec2e('0x19')](respondWithResult(_0x536a48,null))[_0xec2e('0x23')](handleError(_0x536a48,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index a841d9b..56e05c3 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 _0xc393=['exports','define','ZendeskConfiguration','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x154afb,_0x1fbda5){var _0x2cfb15=function(_0x230827){while(--_0x230827){_0x154afb['push'](_0x154afb['shift']());}};_0x2cfb15(++_0x1fbda5);}(_0xc393,0xab));var _0x3c39=function(_0xa9b632,_0xa63f62){_0xa9b632=_0xa9b632-0x0;var _0x199708=_0xc393[_0xa9b632];return _0x199708;};'use strict';var _=require(_0x3c39('0x0'));var util=require('util');var logger=require(_0x3c39('0x1'))('api');var moment=require(_0x3c39('0x2'));var BPromise=require(_0x3c39('0x3'));var rp=require(_0x3c39('0x4'));var fs=require('fs');var path=require(_0x3c39('0x5'));var rimraf=require(_0x3c39('0x6'));var config=require(_0x3c39('0x7'));var attributes=require(_0x3c39('0x8'));module[_0x3c39('0x9')]=function(_0x2d56a8,_0x4f12bc){return _0x2d56a8[_0x3c39('0xa')](_0x3c39('0xb'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebb1=['path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1d92f9,_0x5c5e2f){var _0x5136b9=function(_0x1a31b4){while(--_0x1a31b4){_0x1d92f9['push'](_0x1d92f9['shift']());}};_0x5136b9(++_0x5c5e2f);}(_0xebb1,0x165));var _0x1ebb=function(_0xf7af07,_0x2f6db1){_0xf7af07=_0xf7af07-0x0;var _0x92995b=_0xebb1[_0xf7af07];return _0x92995b;};'use strict';var _=require(_0x1ebb('0x0'));var util=require(_0x1ebb('0x1'));var logger=require(_0x1ebb('0x2'))(_0x1ebb('0x3'));var moment=require(_0x1ebb('0x4'));var BPromise=require(_0x1ebb('0x5'));var rp=require(_0x1ebb('0x6'));var fs=require('fs');var path=require(_0x1ebb('0x7'));var rimraf=require(_0x1ebb('0x8'));var config=require(_0x1ebb('0x9'));var attributes=require(_0x1ebb('0xa'));module[_0x1ebb('0xb')]=function(_0x4ca41f,_0x2e124c){return _0x4ca41f[_0x1ebb('0xc')]('ZendeskConfiguration',attributes,{'tableName':_0x1ebb('0xd'),'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 999abec..97f28f3 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 _0x36a5=['../../config/logger','rpc','jayson/promise','client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x1ec27b,_0xe67c8d){var _0x58ca4e=function(_0xa997e4){while(--_0xa997e4){_0x1ec27b['push'](_0x1ec27b['shift']());}};_0x58ca4e(++_0xe67c8d);}(_0x36a5,0xc3));var _0x536a=function(_0x45064c,_0x212032){_0x45064c=_0x45064c-0x0;var _0x447925=_0x36a5[_0x45064c];return _0x447925;};'use strict';var _=require(_0x536a('0x0'));var util=require(_0x536a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x536a('0x2'));var fs=require('fs');var Redis=require(_0x536a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x536a('0x4'));var logger=require(_0x536a('0x5'))(_0x536a('0x6'));var config=require('../../config/environment');var jayson=require(_0x536a('0x7'));var client=jayson[_0x536a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eccd6,_0x477634,_0x306360){return new BPromise(function(_0x24dd8e,_0x59c27a){return client[_0x536a('0x9')](_0x5eccd6,_0x306360)[_0x536a('0xa')](function(_0xa9e00c){logger[_0x536a('0xb')](_0x536a('0xc'),_0x477634,_0x536a('0xd'));logger['debug'](_0x536a('0xe'),_0x477634,_0x536a('0xd'),JSON['stringify'](_0xa9e00c));if(_0xa9e00c[_0x536a('0xf')]){if(_0xa9e00c[_0x536a('0xf')][_0x536a('0x10')]===0x1f4){logger[_0x536a('0xf')](_0x536a('0xc'),_0x477634,_0xa9e00c[_0x536a('0xf')][_0x536a('0x11')]);return _0x59c27a(_0xa9e00c[_0x536a('0xf')][_0x536a('0x11')]);}logger[_0x536a('0xf')](_0x536a('0xc'),_0x477634,_0xa9e00c[_0x536a('0xf')][_0x536a('0x11')]);return _0x24dd8e(_0xa9e00c['error']['message']);}else{logger[_0x536a('0xb')](_0x536a('0xc'),_0x477634,_0x536a('0xd'));_0x24dd8e(_0xa9e00c[_0x536a('0x12')][_0x536a('0x11')]);}})[_0x536a('0x13')](function(_0x5c5c64){logger['error'](_0x536a('0xc'),_0x477634,_0x5c5c64);_0x59c27a(_0x5c5c64);});});} \ No newline at end of file +var _0xb9d4=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x73eb6,_0x25c71c){var _0x49b851=function(_0x2bbf75){while(--_0x2bbf75){_0x73eb6['push'](_0x73eb6['shift']());}};_0x49b851(++_0x25c71c);}(_0xb9d4,0x19b));var _0x4b9d=function(_0x1e6548,_0x2e0c51){_0x1e6548=_0x1e6548-0x0;var _0x344535=_0xb9d4[_0x1e6548];return _0x344535;};'use strict';var _=require(_0x4b9d('0x0'));var util=require(_0x4b9d('0x1'));var moment=require(_0x4b9d('0x2'));var BPromise=require(_0x4b9d('0x3'));var rs=require(_0x4b9d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b9d('0x5'))['db'];var utils=require(_0x4b9d('0x6'));var logger=require(_0x4b9d('0x7'))('rpc');var config=require(_0x4b9d('0x8'));var jayson=require(_0x4b9d('0x9'));var client=jayson[_0x4b9d('0xa')][_0x4b9d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9e8f,_0x523dc3,_0x43052f){return new BPromise(function(_0x6ffa58,_0xcaee9c){return client[_0x4b9d('0xc')](_0x3f9e8f,_0x43052f)[_0x4b9d('0xd')](function(_0x6ee8c7){logger[_0x4b9d('0xe')](_0x4b9d('0xf'),_0x523dc3,_0x4b9d('0x10'));logger[_0x4b9d('0x11')](_0x4b9d('0x12'),_0x523dc3,_0x4b9d('0x10'),JSON[_0x4b9d('0x13')](_0x6ee8c7));if(_0x6ee8c7[_0x4b9d('0x14')]){if(_0x6ee8c7[_0x4b9d('0x14')]['code']===0x1f4){logger[_0x4b9d('0x14')](_0x4b9d('0xf'),_0x523dc3,_0x6ee8c7[_0x4b9d('0x14')]['message']);return _0xcaee9c(_0x6ee8c7[_0x4b9d('0x14')][_0x4b9d('0x15')]);}logger[_0x4b9d('0x14')](_0x4b9d('0xf'),_0x523dc3,_0x6ee8c7[_0x4b9d('0x14')][_0x4b9d('0x15')]);return _0x6ffa58(_0x6ee8c7[_0x4b9d('0x14')][_0x4b9d('0x15')]);}else{logger[_0x4b9d('0xe')](_0x4b9d('0xf'),_0x523dc3,_0x4b9d('0x10'));_0x6ffa58(_0x6ee8c7[_0x4b9d('0x16')][_0x4b9d('0x15')]);}})[_0x4b9d('0x17')](function(_0xe0f9c){logger[_0x4b9d('0x14')](_0x4b9d('0xf'),_0x523dc3,_0xe0f9c);_0xcaee9c(_0xe0f9c);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index bae8365..5f12035 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 _0x8684=['/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8684,0x182));var _0x4868=function(_0x1dcba0,_0x341963){_0x1dcba0=_0x1dcba0-0x0;var _0x3dedbe=_0x8684[_0x1dcba0];return _0x3dedbe;};'use strict';var multer=require(_0x4868('0x0'));var util=require(_0x4868('0x1'));var path=require('path');var timeout=require(_0x4868('0x2'));var express=require(_0x4868('0x3'));var router=express['Router']();var auth=require(_0x4868('0x4'));var interaction=require(_0x4868('0x5'));var config=require('../../config/environment');var controller=require(_0x4868('0x6'));router[_0x4868('0x7')]('/',auth[_0x4868('0x8')](),controller[_0x4868('0x9')]);router[_0x4868('0x7')](_0x4868('0xa'),auth[_0x4868('0x8')](),controller[_0x4868('0xb')]);router[_0x4868('0xc')]('/',auth['isAuthenticated'](),controller[_0x4868('0xd')]);router[_0x4868('0xe')](_0x4868('0xa'),auth[_0x4868('0x8')](),controller['update']);router[_0x4868('0xf')](_0x4868('0xa'),auth['isAuthenticated'](),controller[_0x4868('0x10')]);module[_0x4868('0x11')]=router; \ No newline at end of file +var _0x531e=['../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x9f9816,_0x579b0e){var _0x40a913=function(_0x5340c4){while(--_0x5340c4){_0x9f9816['push'](_0x9f9816['shift']());}};_0x40a913(++_0x579b0e);}(_0x531e,0x93));var _0xe531=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0x531e[_0x4394b6];return _0x360244;};'use strict';var multer=require('multer');var util=require(_0xe531('0x0'));var path=require('path');var timeout=require(_0xe531('0x1'));var express=require(_0xe531('0x2'));var router=express[_0xe531('0x3')]();var auth=require(_0xe531('0x4'));var interaction=require(_0xe531('0x5'));var config=require(_0xe531('0x6'));var controller=require(_0xe531('0x7'));router[_0xe531('0x8')]('/',auth['isAuthenticated'](),controller[_0xe531('0x9')]);router[_0xe531('0x8')](_0xe531('0xa'),auth[_0xe531('0xb')](),controller[_0xe531('0xc')]);router['post']('/',auth[_0xe531('0xb')](),controller[_0xe531('0xd')]);router[_0xe531('0xe')](_0xe531('0xa'),auth[_0xe531('0xb')](),controller[_0xe531('0xf')]);router[_0xe531('0x10')](_0xe531('0xa'),auth['isAuthenticated'](),controller[_0xe531('0x11')]);module[_0xe531('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 89eda52..92ad530 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 _0x8075=['STRING','variable','BOOLEAN','sequelize','exports','string','customVariable','keyValue'];(function(_0x4b03c9,_0x17ce03){var _0x161ba2=function(_0xb952db){while(--_0xb952db){_0x4b03c9['push'](_0x4b03c9['shift']());}};_0x161ba2(++_0x17ce03);}(_0x8075,0xab));var _0x5807=function(_0x3ead6c,_0x6444ac){_0x3ead6c=_0x3ead6c-0x0;var _0x5b55ce=_0x8075[_0x3ead6c];return _0x5b55ce;};'use strict';var Sequelize=require(_0x5807('0x0'));module[_0x5807('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5807('0x2'),'variable',_0x5807('0x3'),_0x5807('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5807('0x5')]},'key':{'type':Sequelize[_0x5807('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x5807('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x5807('0x5')]},'idField':{'type':Sequelize[_0x5807('0x5')]},'nameField':{'type':Sequelize[_0x5807('0x5')]},'customField':{'type':Sequelize[_0x5807('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5807('0x5')]}}; \ No newline at end of file +var _0x06cb=['ENUM','string','keyValue','STRING','customVariable','BOOLEAN','sequelize','exports'];(function(_0x5b9876,_0x293130){var _0x58538b=function(_0x54912d){while(--_0x54912d){_0x5b9876['push'](_0x5b9876['shift']());}};_0x58538b(++_0x293130);}(_0x06cb,0x1c6));var _0xb06c=function(_0x2bb0ee,_0x3e33c0){_0x2bb0ee=_0x2bb0ee-0x0;var _0x2f00e0=_0x06cb[_0x2bb0ee];return _0x2f00e0;};'use strict';var Sequelize=require(_0xb06c('0x0'));module[_0xb06c('0x1')]={'type':{'type':Sequelize[_0xb06c('0x2')](_0xb06c('0x3'),'variable','customVariable',_0xb06c('0x4')),'defaultValue':_0xb06c('0x3')},'content':{'type':Sequelize[_0xb06c('0x5')]},'key':{'type':Sequelize[_0xb06c('0x5')]},'keyType':{'type':Sequelize[_0xb06c('0x2')](_0xb06c('0x3'),'variable',_0xb06c('0x6'))},'keyContent':{'type':Sequelize[_0xb06c('0x5')]},'idField':{'type':Sequelize[_0xb06c('0x5')]},'nameField':{'type':Sequelize[_0xb06c('0x5')]},'customField':{'type':Sequelize[_0xb06c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb06c('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index e5bd3e7..8241edb 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 _0xa456=['nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','keys','find','create','body','params','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','ZendeskField','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa456,0x142));var _0x6a45=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xa456[_0x5f0089];return _0x193892;};'use strict';var pdf=require(_0x6a45('0x0'));var emlformat=require(_0x6a45('0x1'));var rimraf=require(_0x6a45('0x2'));var zipdir=require(_0x6a45('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a45('0x4'));var moment=require(_0x6a45('0x5'));var BPromise=require(_0x6a45('0x6'));var Mustache=require('mustache');var util=require(_0x6a45('0x7'));var path=require(_0x6a45('0x8'));var sox=require(_0x6a45('0x9'));var csv=require(_0x6a45('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6a45('0xb'));var squel=require(_0x6a45('0xc'));var crypto=require(_0x6a45('0xd'));var jsforce=require(_0x6a45('0xe'));var deskjs=require(_0x6a45('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6a45('0x10'));var Papa=require('papaparse');var Redis=require(_0x6a45('0x11'));var authService=require(_0x6a45('0x12'));var qs=require(_0x6a45('0x13'));var as=require(_0x6a45('0x14'));var hardwareService=require(_0x6a45('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x6a45('0x16'));var config=require(_0x6a45('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x511b92,_0x1aa4b4){_0x1aa4b4=_0x1aa4b4||0xcc;return function(_0x25a8b9){if(_0x25a8b9){return _0x511b92[_0x6a45('0x18')](_0x1aa4b4);}return _0x511b92[_0x6a45('0x19')](_0x1aa4b4)[_0x6a45('0x1a')]();};}function respondWithResult(_0x5a9f29,_0x563c3b){_0x563c3b=_0x563c3b||0xc8;return function(_0x3a5d94){if(_0x3a5d94){return _0x5a9f29[_0x6a45('0x19')](_0x563c3b)['json'](_0x3a5d94);}};}function respondWithFilteredResult(_0x2c20db,_0x171176){return function(_0x3fab82){if(_0x3fab82){var _0x13adc0=_0x3fab82[_0x6a45('0x1b')],_0x548634=_0x171176[_0x6a45('0x1c')],_0x54507b=_0x171176[_0x6a45('0x1c')]+_0x171176['limit'],_0x49023f;if(_0x54507b>=_0x13adc0){_0x54507b=_0x13adc0;_0x49023f=0xc8;}else{_0x49023f=0xce;}_0x2c20db[_0x6a45('0x19')](_0x49023f);return _0x2c20db[_0x6a45('0x1d')](_0x6a45('0x1e'),_0x548634+'-'+_0x54507b+'/'+_0x13adc0)['json'](_0x3fab82);}return null;};}function patchUpdates(_0x52e7bf){return function(_0x573453){try{jsonpatch[_0x6a45('0x1f')](_0x573453,_0x52e7bf,!![]);}catch(_0x2ed1e5){return BPromise['reject'](_0x2ed1e5);}return _0x573453[_0x6a45('0x20')]();};}function saveUpdates(_0x1be485,_0x4f7000){return function(_0x4f7110){if(_0x4f7110){return _0x4f7110[_0x6a45('0x21')](_0x1be485)[_0x6a45('0x22')](function(_0x458b99){return _0x458b99;});}return null;};}function removeEntity(_0x15ad0e,_0x487666){return function(_0x5d990e){if(_0x5d990e){return _0x5d990e[_0x6a45('0x23')]()[_0x6a45('0x22')](function(){_0x15ad0e[_0x6a45('0x19')](0xcc)[_0x6a45('0x1a')]();});}};}function handleEntityNotFound(_0x25a380,_0x3ad898){return function(_0x170623){if(!_0x170623){_0x25a380[_0x6a45('0x18')](0x194);}return _0x170623;};}function handleError(_0x316f6b,_0x18a5b8){_0x18a5b8=_0x18a5b8||0x1f4;return function(_0x1310d7){logger[_0x6a45('0x24')](_0x1310d7['stack']);if(_0x1310d7[_0x6a45('0x25')]){delete _0x1310d7['name'];}_0x316f6b[_0x6a45('0x19')](_0x18a5b8)[_0x6a45('0x26')](_0x1310d7);};}exports[_0x6a45('0x27')]=function(_0x2c7315,_0x3ede76){var _0x526062={},_0x2b8cc8={},_0x308003={'count':0x0,'rows':[]};var _0x4770cc=_[_0x6a45('0x28')](db[_0x6a45('0x29')][_0x6a45('0x2a')],function(_0x3fac9b){return{'name':_0x3fac9b[_0x6a45('0x2b')],'type':_0x3fac9b['type'][_0x6a45('0x2c')]};});_0x2b8cc8[_0x6a45('0x2d')]=_[_0x6a45('0x28')](_0x4770cc,_0x6a45('0x25'));_0x2b8cc8[_0x6a45('0x2e')]=_['keys'](_0x2c7315[_0x6a45('0x2e')]);_0x2b8cc8[_0x6a45('0x2f')]=_[_0x6a45('0x30')](_0x2b8cc8[_0x6a45('0x2d')],_0x2b8cc8['query']);_0x526062['attributes']=_[_0x6a45('0x30')](_0x2b8cc8['model'],qs[_0x6a45('0x31')](_0x2c7315['query'][_0x6a45('0x31')]));_0x526062[_0x6a45('0x32')]=_0x526062[_0x6a45('0x32')][_0x6a45('0x33')]?_0x526062[_0x6a45('0x32')]:_0x2b8cc8[_0x6a45('0x2d')];if(!_0x2c7315[_0x6a45('0x2e')][_0x6a45('0x34')](_0x6a45('0x35'))){_0x526062[_0x6a45('0x36')]=qs[_0x6a45('0x36')](_0x2c7315[_0x6a45('0x2e')][_0x6a45('0x36')]);_0x526062['offset']=qs[_0x6a45('0x1c')](_0x2c7315['query'][_0x6a45('0x1c')]);}_0x526062[_0x6a45('0x37')]=qs[_0x6a45('0x38')](_0x2c7315[_0x6a45('0x2e')][_0x6a45('0x38')]);_0x526062[_0x6a45('0x39')]=qs['filters'](_[_0x6a45('0x3a')](_0x2c7315[_0x6a45('0x2e')],_0x2b8cc8[_0x6a45('0x2f')]),_0x4770cc);if(_0x2c7315[_0x6a45('0x2e')][_0x6a45('0x3b')]){_0x526062[_0x6a45('0x39')]=_['merge'](_0x526062[_0x6a45('0x39')],{'$or':_[_0x6a45('0x28')](_0x4770cc,function(_0x5c76bd){if(_0x5c76bd[_0x6a45('0x3c')]!==_0x6a45('0x3d')){var _0x10cb71={};_0x10cb71[_0x5c76bd[_0x6a45('0x25')]]={'$like':'%'+_0x2c7315[_0x6a45('0x2e')]['filter']+'%'};return _0x10cb71;}})});}_0x526062=_[_0x6a45('0x3e')]({},_0x526062,_0x2c7315[_0x6a45('0x3f')]);var _0x205afd={'where':_0x526062[_0x6a45('0x39')]};return db[_0x6a45('0x29')][_0x6a45('0x1b')](_0x205afd)[_0x6a45('0x22')](function(_0x59ce5a){_0x308003[_0x6a45('0x1b')]=_0x59ce5a;if(_0x2c7315['query'][_0x6a45('0x40')]){_0x526062[_0x6a45('0x41')]=[{'all':!![]}];}return db[_0x6a45('0x29')][_0x6a45('0x42')](_0x526062);})['then'](function(_0x4805dd){_0x308003[_0x6a45('0x43')]=_0x4805dd;return _0x308003;})[_0x6a45('0x22')](respondWithFilteredResult(_0x3ede76,_0x526062))['catch'](handleError(_0x3ede76,null));};exports[_0x6a45('0x44')]=function(_0x3d8513,_0x3bd926){var _0x33347b={'raw':!![],'where':{'id':_0x3d8513['params']['id']}},_0x4baffb={};_0x4baffb['model']=_['keys'](db[_0x6a45('0x29')][_0x6a45('0x2a')]);_0x4baffb[_0x6a45('0x2e')]=_[_0x6a45('0x45')](_0x3d8513[_0x6a45('0x2e')]);_0x4baffb[_0x6a45('0x2f')]=_[_0x6a45('0x30')](_0x4baffb[_0x6a45('0x2d')],_0x4baffb['query']);_0x33347b[_0x6a45('0x32')]=_['intersection'](_0x4baffb['model'],qs[_0x6a45('0x31')](_0x3d8513[_0x6a45('0x2e')]['fields']));_0x33347b[_0x6a45('0x32')]=_0x33347b['attributes'][_0x6a45('0x33')]?_0x33347b[_0x6a45('0x32')]:_0x4baffb[_0x6a45('0x2d')];if(_0x3d8513[_0x6a45('0x2e')]['includeAll']){_0x33347b[_0x6a45('0x41')]=[{'all':!![]}];}_0x33347b=_[_0x6a45('0x3e')]({},_0x33347b,_0x3d8513[_0x6a45('0x3f')]);return db[_0x6a45('0x29')][_0x6a45('0x46')](_0x33347b)['then'](handleEntityNotFound(_0x3bd926,null))[_0x6a45('0x22')](respondWithResult(_0x3bd926,null))['catch'](handleError(_0x3bd926,null));};exports[_0x6a45('0x47')]=function(_0x33da06,_0x4887b9){return db[_0x6a45('0x29')][_0x6a45('0x47')](_0x33da06[_0x6a45('0x48')],{})[_0x6a45('0x22')](respondWithResult(_0x4887b9,0xc9))['catch'](handleError(_0x4887b9,null));};exports[_0x6a45('0x21')]=function(_0x4f20c2,_0x1fb773){if(_0x4f20c2['body']['id']){delete _0x4f20c2[_0x6a45('0x48')]['id'];}return db[_0x6a45('0x29')][_0x6a45('0x46')]({'where':{'id':_0x4f20c2[_0x6a45('0x49')]['id']}})['then'](handleEntityNotFound(_0x1fb773,null))[_0x6a45('0x22')](saveUpdates(_0x4f20c2[_0x6a45('0x48')],null))[_0x6a45('0x22')](respondWithResult(_0x1fb773,null))[_0x6a45('0x4a')](handleError(_0x1fb773,null));};exports[_0x6a45('0x23')]=function(_0xf32894,_0xc7ee18){return db[_0x6a45('0x29')][_0x6a45('0x46')]({'where':{'id':_0xf32894[_0x6a45('0x49')]['id']}})['then'](handleEntityNotFound(_0xc7ee18,null))[_0x6a45('0x22')](removeEntity(_0xc7ee18,null))[_0x6a45('0x4a')](handleError(_0xc7ee18,null));}; \ No newline at end of file +var _0x1623=['name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','ZendeskField','includeAll','include','catch','show','params','create','body','update','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','destroy','then','sendStatus','error','stack'];(function(_0x1346e7,_0x3e21e3){var _0x2fbd14=function(_0x37c040){while(--_0x37c040){_0x1346e7['push'](_0x1346e7['shift']());}};_0x2fbd14(++_0x3e21e3);}(_0x1623,0xab));var _0x3162=function(_0x1b4f98,_0x5a62b3){_0x1b4f98=_0x1b4f98-0x0;var _0xe74f5=_0x1623[_0x1b4f98];return _0xe74f5;};'use strict';var pdf=require(_0x3162('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3162('0x1'));var jsonpatch=require(_0x3162('0x2'));var rp=require(_0x3162('0x3'));var moment=require(_0x3162('0x4'));var BPromise=require(_0x3162('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3162('0x6'));var sox=require('sox');var csv=require(_0x3162('0x7'));var ejs=require(_0x3162('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0x7'));var querystring=require(_0x3162('0xd'));var Papa=require(_0x3162('0xe'));var Redis=require(_0x3162('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x10'));var hardwareService=require(_0x3162('0x11'));var logger=require(_0x3162('0x12'))(_0x3162('0x13'));var utils=require(_0x3162('0x14'));var config=require(_0x3162('0x15'));var licenseUtil=require(_0x3162('0x16'));var db=require(_0x3162('0x17'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x18')](_0x4c3625)[_0x3162('0x19')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x18')](_0x4a393a)[_0x3162('0x1a')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=_0x3d0bea[_0x3162('0x1b')],_0x490371=_0x15e348[_0x3162('0x1c')],_0x78a56c=_0x15e348[_0x3162('0x1c')]+_0x15e348[_0x3162('0x1d')],_0x42cf7d;if(_0x78a56c>=_0x2705d1){_0x78a56c=_0x2705d1;_0x42cf7d=0xc8;}else{_0x42cf7d=0xce;}_0x4b8a3b[_0x3162('0x18')](_0x42cf7d);return _0x4b8a3b['set'](_0x3162('0x1e'),_0x490371+'-'+_0x78a56c+'/'+_0x2705d1)[_0x3162('0x1a')](_0x3d0bea);}return null;};}function patchUpdates(_0x460b7b){return function(_0x36ca97){try{jsonpatch['apply'](_0x36ca97,_0x460b7b,!![]);}catch(_0x1dfd5c){return BPromise['reject'](_0x1dfd5c);}return _0x36ca97['save']();};}function saveUpdates(_0xa5c62b,_0x3e4d23){return function(_0x31946d){if(_0x31946d){return _0x31946d['update'](_0xa5c62b)['then'](function(_0x27133e){return _0x27133e;});}return null;};}function removeEntity(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x1f')]()[_0x3162('0x20')](function(){_0x396372[_0x3162('0x18')](0xcc)[_0x3162('0x19')]();});}};}function handleEntityNotFound(_0x5a4994,_0xd283d6){return function(_0x2433f8){if(!_0x2433f8){_0x5a4994[_0x3162('0x21')](0x194);}return _0x2433f8;};}function handleError(_0x1fd76f,_0x1c9992){_0x1c9992=_0x1c9992||0x1f4;return function(_0x3c543e){logger[_0x3162('0x22')](_0x3c543e[_0x3162('0x23')]);if(_0x3c543e[_0x3162('0x24')]){delete _0x3c543e[_0x3162('0x24')];}_0x1fd76f[_0x3162('0x18')](_0x1c9992)[_0x3162('0x25')](_0x3c543e);};}exports[_0x3162('0x26')]=function(_0x48de45,_0x4025c3){var _0x552469={},_0x37acdd={},_0x31f7fd={'count':0x0,'rows':[]};var _0x10c90b=_['map'](db['ZendeskField'][_0x3162('0x27')],function(_0xaa1f35){return{'name':_0xaa1f35[_0x3162('0x28')],'type':_0xaa1f35[_0x3162('0x29')][_0x3162('0x2a')]};});_0x37acdd['model']=_[_0x3162('0x2b')](_0x10c90b,'name');_0x37acdd[_0x3162('0x2c')]=_[_0x3162('0x2d')](_0x48de45[_0x3162('0x2c')]);_0x37acdd[_0x3162('0x2e')]=_[_0x3162('0x2f')](_0x37acdd[_0x3162('0x30')],_0x37acdd[_0x3162('0x2c')]);_0x552469[_0x3162('0x31')]=_['intersection'](_0x37acdd[_0x3162('0x30')],qs[_0x3162('0x32')](_0x48de45['query'][_0x3162('0x32')]));_0x552469[_0x3162('0x31')]=_0x552469['attributes']['length']?_0x552469[_0x3162('0x31')]:_0x37acdd['model'];if(!_0x48de45[_0x3162('0x2c')][_0x3162('0x33')](_0x3162('0x34'))){_0x552469['limit']=qs['limit'](_0x48de45[_0x3162('0x2c')][_0x3162('0x1d')]);_0x552469['offset']=qs[_0x3162('0x1c')](_0x48de45['query'][_0x3162('0x1c')]);}_0x552469[_0x3162('0x35')]=qs[_0x3162('0x36')](_0x48de45[_0x3162('0x2c')][_0x3162('0x36')]);_0x552469[_0x3162('0x37')]=qs[_0x3162('0x2e')](_[_0x3162('0x38')](_0x48de45[_0x3162('0x2c')],_0x37acdd[_0x3162('0x2e')]),_0x10c90b);if(_0x48de45[_0x3162('0x2c')]['filter']){_0x552469[_0x3162('0x37')]=_[_0x3162('0x39')](_0x552469[_0x3162('0x37')],{'$or':_['map'](_0x10c90b,function(_0x59759d){if(_0x59759d[_0x3162('0x29')]!==_0x3162('0x3a')){var _0x2e1ab5={};_0x2e1ab5[_0x59759d[_0x3162('0x24')]]={'$like':'%'+_0x48de45['query'][_0x3162('0x3b')]+'%'};return _0x2e1ab5;}})});}_0x552469=_['merge']({},_0x552469,_0x48de45['options']);var _0x5dee49={'where':_0x552469[_0x3162('0x37')]};return db[_0x3162('0x3c')][_0x3162('0x1b')](_0x5dee49)['then'](function(_0xbf9e0c){_0x31f7fd[_0x3162('0x1b')]=_0xbf9e0c;if(_0x48de45[_0x3162('0x2c')][_0x3162('0x3d')]){_0x552469[_0x3162('0x3e')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x552469);})[_0x3162('0x20')](function(_0x3783bd){_0x31f7fd['rows']=_0x3783bd;return _0x31f7fd;})['then'](respondWithFilteredResult(_0x4025c3,_0x552469))[_0x3162('0x3f')](handleError(_0x4025c3,null));};exports[_0x3162('0x40')]=function(_0x379756,_0x4883ac){var _0x3502ba={'raw':!![],'where':{'id':_0x379756[_0x3162('0x41')]['id']}},_0x3efd0d={};_0x3efd0d[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3c')][_0x3162('0x27')]);_0x3efd0d['query']=_[_0x3162('0x2d')](_0x379756[_0x3162('0x2c')]);_0x3efd0d['filters']=_[_0x3162('0x2f')](_0x3efd0d[_0x3162('0x30')],_0x3efd0d['query']);_0x3502ba[_0x3162('0x31')]=_['intersection'](_0x3efd0d[_0x3162('0x30')],qs[_0x3162('0x32')](_0x379756[_0x3162('0x2c')][_0x3162('0x32')]));_0x3502ba[_0x3162('0x31')]=_0x3502ba[_0x3162('0x31')]['length']?_0x3502ba[_0x3162('0x31')]:_0x3efd0d[_0x3162('0x30')];if(_0x379756[_0x3162('0x2c')]['includeAll']){_0x3502ba[_0x3162('0x3e')]=[{'all':!![]}];}_0x3502ba=_[_0x3162('0x39')]({},_0x3502ba,_0x379756['options']);return db[_0x3162('0x3c')]['find'](_0x3502ba)['then'](handleEntityNotFound(_0x4883ac,null))['then'](respondWithResult(_0x4883ac,null))[_0x3162('0x3f')](handleError(_0x4883ac,null));};exports[_0x3162('0x42')]=function(_0x2f68a0,_0x2dfc2e){return db[_0x3162('0x3c')][_0x3162('0x42')](_0x2f68a0[_0x3162('0x43')],{})[_0x3162('0x20')](respondWithResult(_0x2dfc2e,0xc9))[_0x3162('0x3f')](handleError(_0x2dfc2e,null));};exports[_0x3162('0x44')]=function(_0x1c81b5,_0x3a167f){if(_0x1c81b5[_0x3162('0x43')]['id']){delete _0x1c81b5['body']['id'];}return db[_0x3162('0x3c')]['find']({'where':{'id':_0x1c81b5['params']['id']}})[_0x3162('0x20')](handleEntityNotFound(_0x3a167f,null))[_0x3162('0x20')](saveUpdates(_0x1c81b5[_0x3162('0x43')],null))[_0x3162('0x20')](respondWithResult(_0x3a167f,null))['catch'](handleError(_0x3a167f,null));};exports[_0x3162('0x1f')]=function(_0x54941b,_0xa11c6e){return db[_0x3162('0x3c')]['find']({'where':{'id':_0x54941b[_0x3162('0x41')]['id']}})['then'](handleEntityNotFound(_0xa11c6e,null))['then'](removeEntity(_0xa11c6e,null))[_0x3162('0x3f')](handleError(_0xa11c6e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 3837182..c4f1f4a 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 _0x3eec=['rimraf','../../config/environment','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0xa54a35,_0x106875){var _0x5a611d=function(_0x5de7c6){while(--_0x5de7c6){_0xa54a35['push'](_0xa54a35['shift']());}};_0x5a611d(++_0x106875);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x196916,_0x1f9e88){_0x196916=_0x196916-0x0;var _0x2b0ed4=_0x3eec[_0x196916];return _0x2b0ed4;};'use strict';var _=require(_0xc3ee('0x0'));var util=require(_0xc3ee('0x1'));var logger=require(_0xc3ee('0x2'))(_0xc3ee('0x3'));var moment=require('moment');var BPromise=require(_0xc3ee('0x4'));var rp=require(_0xc3ee('0x5'));var fs=require('fs');var path=require(_0xc3ee('0x6'));var rimraf=require(_0xc3ee('0x7'));var config=require(_0xc3ee('0x8'));var attributes=require(_0xc3ee('0x9'));module['exports']=function(_0x471de7,_0xbd5b6){return _0x471de7[_0xc3ee('0xa')](_0xc3ee('0xb'),attributes,{'tableName':_0xc3ee('0xc'),'paranoid':![],'indexes':[{'name':_0xc3ee('0xd'),'fields':[_0xc3ee('0xe'),_0xc3ee('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f3c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x4f3c,0x15d));var _0xc4f3=function(_0x58cb21,_0x4737cc){_0x58cb21=_0x58cb21-0x0;var _0x37e679=_0x4f3c[_0x58cb21];return _0x37e679;};'use strict';var _=require(_0xc4f3('0x0'));var util=require(_0xc4f3('0x1'));var logger=require(_0xc4f3('0x2'))(_0xc4f3('0x3'));var moment=require(_0xc4f3('0x4'));var BPromise=require(_0xc4f3('0x5'));var rp=require(_0xc4f3('0x6'));var fs=require('fs');var path=require(_0xc4f3('0x7'));var rimraf=require(_0xc4f3('0x8'));var config=require(_0xc4f3('0x9'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x21d027,_0x14f1cc){return _0x21d027[_0xc4f3('0xa')](_0xc4f3('0xb'),attributes,{'tableName':_0xc4f3('0xc'),'paranoid':![],'indexes':[{'name':_0xc4f3('0xd'),'fields':[_0xc4f3('0xe'),_0xc4f3('0xf')],'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 4495c5e..87f6fad 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 _0x4463=['result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message'];(function(_0x38baf6,_0x57b2f3){var _0x40ff28=function(_0xda441d){while(--_0xda441d){_0x38baf6['push'](_0x38baf6['shift']());}};_0x40ff28(++_0x57b2f3);}(_0x4463,0x112));var _0x3446=function(_0x297d77,_0xe6318e){_0x297d77=_0x297d77-0x0;var _0x3ae517=_0x4463[_0x297d77];return _0x3ae517;};'use strict';var _=require(_0x3446('0x0'));var util=require('util');var moment=require(_0x3446('0x1'));var BPromise=require(_0x3446('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3446('0x3'));var db=require(_0x3446('0x4'))['db'];var utils=require(_0x3446('0x5'));var logger=require(_0x3446('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3446('0x7'));var client=jayson[_0x3446('0x8')][_0x3446('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ba373,_0x76a5c0,_0x5032f3){return new BPromise(function(_0x2e2def,_0x13add1){return client['request'](_0x1ba373,_0x5032f3)[_0x3446('0xa')](function(_0x143ef0){logger[_0x3446('0xb')]('ZendeskField,\x20%s,\x20%s',_0x76a5c0,_0x3446('0xc'));logger[_0x3446('0xd')](_0x3446('0xe'),_0x76a5c0,_0x3446('0xc'),JSON[_0x3446('0xf')](_0x143ef0));if(_0x143ef0['error']){if(_0x143ef0[_0x3446('0x10')][_0x3446('0x11')]===0x1f4){logger[_0x3446('0x10')](_0x3446('0x12'),_0x76a5c0,_0x143ef0[_0x3446('0x10')][_0x3446('0x13')]);return _0x13add1(_0x143ef0[_0x3446('0x10')][_0x3446('0x13')]);}logger[_0x3446('0x10')]('ZendeskField,\x20%s,\x20%s',_0x76a5c0,_0x143ef0[_0x3446('0x10')]['message']);return _0x2e2def(_0x143ef0[_0x3446('0x10')][_0x3446('0x13')]);}else{logger['info'](_0x3446('0x12'),_0x76a5c0,_0x3446('0xc'));_0x2e2def(_0x143ef0[_0x3446('0x14')][_0x3446('0x13')]);}})['catch'](function(_0x379165){logger[_0x3446('0x10')](_0x3446('0x12'),_0x76a5c0,_0x379165);_0x13add1(_0x379165);});});} \ No newline at end of file +var _0xf9b7=['request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3be658,_0x5b5905){var _0x8382ed=function(_0x361b7d){while(--_0x361b7d){_0x3be658['push'](_0x3be658['shift']());}};_0x8382ed(++_0x5b5905);}(_0xf9b7,0x11e));var _0x7f9b=function(_0x2ad84d,_0x44b2e3){_0x2ad84d=_0x2ad84d-0x0;var _0x153f55=_0xf9b7[_0x2ad84d];return _0x153f55;};'use strict';var _=require(_0x7f9b('0x0'));var util=require(_0x7f9b('0x1'));var moment=require(_0x7f9b('0x2'));var BPromise=require(_0x7f9b('0x3'));var rs=require(_0x7f9b('0x4'));var fs=require('fs');var Redis=require(_0x7f9b('0x5'));var db=require(_0x7f9b('0x6'))['db'];var utils=require(_0x7f9b('0x7'));var logger=require(_0x7f9b('0x8'))(_0x7f9b('0x9'));var config=require(_0x7f9b('0xa'));var jayson=require(_0x7f9b('0xb'));var client=jayson[_0x7f9b('0xc')][_0x7f9b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4e73c6,_0x5151a2,_0x260626){return new BPromise(function(_0x3d67fd,_0x365f56){return client[_0x7f9b('0xe')](_0x4e73c6,_0x260626)[_0x7f9b('0xf')](function(_0x5b852f){logger[_0x7f9b('0x10')](_0x7f9b('0x11'),_0x5151a2,_0x7f9b('0x12'));logger['debug'](_0x7f9b('0x13'),_0x5151a2,_0x7f9b('0x12'),JSON['stringify'](_0x5b852f));if(_0x5b852f[_0x7f9b('0x14')]){if(_0x5b852f[_0x7f9b('0x14')][_0x7f9b('0x15')]===0x1f4){logger[_0x7f9b('0x14')](_0x7f9b('0x11'),_0x5151a2,_0x5b852f[_0x7f9b('0x14')][_0x7f9b('0x16')]);return _0x365f56(_0x5b852f[_0x7f9b('0x14')]['message']);}logger[_0x7f9b('0x14')]('ZendeskField,\x20%s,\x20%s',_0x5151a2,_0x5b852f[_0x7f9b('0x14')]['message']);return _0x3d67fd(_0x5b852f['error'][_0x7f9b('0x16')]);}else{logger[_0x7f9b('0x10')](_0x7f9b('0x11'),_0x5151a2,_0x7f9b('0x12'));_0x3d67fd(_0x5b852f[_0x7f9b('0x17')][_0x7f9b('0x16')]);}})[_0x7f9b('0x18')](function(_0x5d284f){logger[_0x7f9b('0x14')]('ZendeskField,\x20%s,\x20%s',_0x5151a2,_0x5d284f);_0x365f56(_0x5d284f);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 7fe2e6d..bc44058 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 _0xa9e0=['/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated'];(function(_0x5ae0ee,_0x22a0a9){var _0x46de1d=function(_0x12ae35){while(--_0x12ae35){_0x5ae0ee['push'](_0x5ae0ee['shift']());}};_0x46de1d(++_0x22a0a9);}(_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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file +var _0xa9e0=['/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated'];(function(_0x5e8e19,_0x32fbf2){var _0x469267=function(_0x36a5ca){while(--_0x36a5ca){_0x5e8e19['push'](_0x5e8e19['shift']());}};_0x469267(++_0x32fbf2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index fde7b82..64e0528 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 _0x6588=['STRING','sequelize'];(function(_0x3f6c60,_0x486af8){var _0x2bbe6a=function(_0x25c875){while(--_0x25c875){_0x3f6c60['push'](_0x3f6c60['shift']());}};_0x2bbe6a(++_0x486af8);}(_0x6588,0xc1));var _0x8658=function(_0x5a0e32,_0x347ae2){_0x5a0e32=_0x5a0e32-0x0;var _0xea8f24=_0x6588[_0x5a0e32];return _0xea8f24;};'use strict';var Sequelize=require(_0x8658('0x0'));module['exports']={'name':{'type':Sequelize[_0x8658('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8658('0x1')]},'clientId':{'type':Sequelize[_0x8658('0x1')]},'clientSecret':{'type':Sequelize[_0x8658('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x8658('0x1')]},'refreshToken':{'type':Sequelize[_0x8658('0x1')]}}; \ No newline at end of file +var _0x422a=['sequelize','exports','STRING'];(function(_0x2600b3,_0x27b5c3){var _0x59f150=function(_0x12c873){while(--_0x12c873){_0x2600b3['push'](_0x2600b3['shift']());}};_0x59f150(++_0x27b5c3);}(_0x422a,0x195));var _0xa422=function(_0x2a1d8c,_0x491526){_0x2a1d8c=_0x2a1d8c-0x0;var _0x20b1a8=_0x422a[_0x2a1d8c];return _0x20b1a8;};'use strict';var Sequelize=require(_0xa422('0x0'));module[_0xa422('0x1')]={'name':{'type':Sequelize[_0xa422('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xa422('0x2')]},'zone':{'type':Sequelize[_0xa422('0x2')]},'clientId':{'type':Sequelize[_0xa422('0x2')]},'clientSecret':{'type':Sequelize[_0xa422('0x2')]},'serverUrl':{'type':Sequelize[_0xa422('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xa422('0x2')]},'refreshToken':{'type':Sequelize[_0xa422('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 7d11b82..6ac53ba 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 _0xd6f9=['ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','serverUrl','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Type','api_name','push','display_label','data_type','picklist','pick_list_values','statusCode','stringify','test','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','ZohoAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ZohoAccount','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','length','find','create','body','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions'];(function(_0x51ac5d,_0x5eb100){var _0x30ff4b=function(_0x2a9738){while(--_0x2a9738){_0x51ac5d['push'](_0x51ac5d['shift']());}};_0x30ff4b(++_0x5eb100);}(_0xd6f9,0x1ca));var _0x9d6f=function(_0x23ec06,_0x561142){_0x23ec06=_0x23ec06-0x0;var _0x2831d4=_0xd6f9[_0x23ec06];return _0x2831d4;};'use strict';var pdf=require(_0x9d6f('0x0'));var emlformat=require(_0x9d6f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9d6f('0x2'));var rp=require(_0x9d6f('0x3'));var moment=require(_0x9d6f('0x4'));var BPromise=require(_0x9d6f('0x5'));var Mustache=require('mustache');var util=require(_0x9d6f('0x6'));var path=require(_0x9d6f('0x7'));var sox=require(_0x9d6f('0x8'));var csv=require('to-csv');var ejs=require(_0x9d6f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9d6f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9d6f('0xb'));var toCsv=require(_0x9d6f('0xc'));var querystring=require(_0x9d6f('0xd'));var Papa=require(_0x9d6f('0xe'));var Redis=require(_0x9d6f('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d6f('0x10'));var logger=require(_0x9d6f('0x11'))(_0x9d6f('0x12'));var utils=require(_0x9d6f('0x13'));var config=require(_0x9d6f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d6f('0x15'))['db'];var integrations=require(_0x9d6f('0x16'));var jayson=require(_0x9d6f('0x17'));var client=jayson[_0x9d6f('0x18')][_0x9d6f('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4e833c,_0x30e407,_0x2da36f,_0x34e8dd){return new BPromise(function(_0x3916f1,_0x3f049b){var _0x5c7489=_0x34e8dd||client;return _0x5c7489[_0x9d6f('0x1a')](_0x4e833c,_0x2da36f)[_0x9d6f('0x1b')](function(_0x41546b){logger[_0x9d6f('0x1c')]('ZohoAccount,\x20%s,\x20%s',_0x30e407,_0x9d6f('0x1d'));logger[_0x9d6f('0x1e')](_0x9d6f('0x1f'),_0x30e407,_0x9d6f('0x1d'),JSON['stringify'](_0x41546b));if(_0x41546b[_0x9d6f('0x20')]){if(_0x41546b[_0x9d6f('0x20')]['code']===0x1f4){logger[_0x9d6f('0x20')](_0x9d6f('0x21'),_0x30e407,_0x41546b[_0x9d6f('0x20')]['message']);return _0x3f049b(_0x41546b[_0x9d6f('0x20')][_0x9d6f('0x22')]);}logger[_0x9d6f('0x20')]('ZohoAccount,\x20%s,\x20%s',_0x30e407,_0x41546b[_0x9d6f('0x20')][_0x9d6f('0x22')]);return _0x3916f1(_0x41546b[_0x9d6f('0x20')][_0x9d6f('0x22')]);}else{logger[_0x9d6f('0x1c')]('ZohoAccount,\x20%s,\x20%s',_0x30e407,_0x9d6f('0x1d'));_0x3916f1(_0x41546b[_0x9d6f('0x23')][_0x9d6f('0x22')]);}})[_0x9d6f('0x24')](function(_0x525c03){logger[_0x9d6f('0x20')](_0x9d6f('0x21'),_0x30e407,_0x525c03);_0x3f049b(_0x525c03);});});}function respondWithStatusCode(_0x367d48,_0x2a13dc){_0x2a13dc=_0x2a13dc||0xcc;return function(_0x2d615){if(_0x2d615){return _0x367d48[_0x9d6f('0x25')](_0x2a13dc);}return _0x367d48[_0x9d6f('0x26')](_0x2a13dc)[_0x9d6f('0x27')]();};}function respondWithResult(_0x6d51d8,_0x10ec7a){_0x10ec7a=_0x10ec7a||0xc8;return function(_0x233c17){if(_0x233c17){return _0x6d51d8['status'](_0x10ec7a)[_0x9d6f('0x28')](_0x233c17);}};}function respondWithFilteredResult(_0x44aee2,_0x3c2714){return function(_0x537bb3){if(_0x537bb3){var _0x2d01b5=_0x537bb3[_0x9d6f('0x29')],_0x5cded2=_0x3c2714[_0x9d6f('0x2a')],_0x320145=_0x3c2714['offset']+_0x3c2714['limit'],_0x18e323;if(_0x320145>=_0x2d01b5){_0x320145=_0x2d01b5;_0x18e323=0xc8;}else{_0x18e323=0xce;}_0x44aee2['status'](_0x18e323);return _0x44aee2['set'](_0x9d6f('0x2b'),_0x5cded2+'-'+_0x320145+'/'+_0x2d01b5)[_0x9d6f('0x28')](_0x537bb3);}return null;};}function patchUpdates(_0x1823a2){return function(_0x1e332c){try{jsonpatch[_0x9d6f('0x2c')](_0x1e332c,_0x1823a2,!![]);}catch(_0x489185){return BPromise[_0x9d6f('0x2d')](_0x489185);}return _0x1e332c[_0x9d6f('0x2e')]();};}function saveUpdates(_0x45ed53,_0x2b346f){return function(_0x36c531){if(_0x36c531){return _0x36c531[_0x9d6f('0x2f')](_0x45ed53)[_0x9d6f('0x1b')](function(_0x189cb2){return _0x189cb2;});}return null;};}function removeEntity(_0x3a4d6d,_0x4c103a){return function(_0x315da7){if(_0x315da7){return _0x315da7[_0x9d6f('0x30')]()[_0x9d6f('0x1b')](function(){_0x3a4d6d[_0x9d6f('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x459205,_0x525784){return function(_0x5b4fee){if(!_0x5b4fee){_0x459205[_0x9d6f('0x25')](0x194);}return _0x5b4fee;};}function handleError(_0x435941,_0x2043f6){_0x2043f6=_0x2043f6||0x1f4;return function(_0x685bdd){logger[_0x9d6f('0x20')](_0x685bdd[_0x9d6f('0x31')]);if(_0x685bdd[_0x9d6f('0x32')]){delete _0x685bdd[_0x9d6f('0x32')];}_0x435941[_0x9d6f('0x26')](_0x2043f6)[_0x9d6f('0x33')](_0x685bdd);};}exports[_0x9d6f('0x34')]=function(_0x3935d5,_0x522fc0){var _0x5daa29={},_0x10b62b={},_0x16bb4c={'count':0x0,'rows':[]};var _0x28adb2=_[_0x9d6f('0x35')](db[_0x9d6f('0x36')][_0x9d6f('0x37')],function(_0x45de7c){return{'name':_0x45de7c['fieldName'],'type':_0x45de7c[_0x9d6f('0x38')][_0x9d6f('0x39')]};});_0x10b62b['model']=_[_0x9d6f('0x35')](_0x28adb2,'name');_0x10b62b[_0x9d6f('0x3a')]=_[_0x9d6f('0x3b')](_0x3935d5['query']);_0x10b62b[_0x9d6f('0x3c')]=_[_0x9d6f('0x3d')](_0x10b62b[_0x9d6f('0x3e')],_0x10b62b['query']);_0x5daa29[_0x9d6f('0x3f')]=_['intersection'](_0x10b62b[_0x9d6f('0x3e')],qs[_0x9d6f('0x40')](_0x3935d5[_0x9d6f('0x3a')][_0x9d6f('0x40')]));_0x5daa29[_0x9d6f('0x3f')]=_0x5daa29[_0x9d6f('0x3f')]['length']?_0x5daa29[_0x9d6f('0x3f')]:_0x10b62b[_0x9d6f('0x3e')];if(!_0x3935d5['query'][_0x9d6f('0x41')](_0x9d6f('0x42'))){_0x5daa29[_0x9d6f('0x43')]=qs[_0x9d6f('0x43')](_0x3935d5[_0x9d6f('0x3a')][_0x9d6f('0x43')]);_0x5daa29[_0x9d6f('0x2a')]=qs[_0x9d6f('0x2a')](_0x3935d5[_0x9d6f('0x3a')][_0x9d6f('0x2a')]);}_0x5daa29[_0x9d6f('0x44')]=qs['sort'](_0x3935d5['query'][_0x9d6f('0x45')]);_0x5daa29['where']=qs[_0x9d6f('0x3c')](_['pick'](_0x3935d5[_0x9d6f('0x3a')],_0x10b62b['filters']),_0x28adb2);if(_0x3935d5[_0x9d6f('0x3a')]['filter']){_0x5daa29[_0x9d6f('0x46')]=_['merge'](_0x5daa29['where'],{'$or':_['map'](_0x28adb2,function(_0x13ffce){if(_0x13ffce[_0x9d6f('0x38')]!=='VIRTUAL'){var _0x53d359={};_0x53d359[_0x13ffce[_0x9d6f('0x32')]]={'$like':'%'+_0x3935d5['query'][_0x9d6f('0x47')]+'%'};return _0x53d359;}})});}_0x5daa29=_[_0x9d6f('0x48')]({},_0x5daa29,_0x3935d5[_0x9d6f('0x49')]);var _0x43662c={'where':_0x5daa29[_0x9d6f('0x46')]};return db['ZohoAccount'][_0x9d6f('0x29')](_0x43662c)[_0x9d6f('0x1b')](function(_0x149a69){_0x16bb4c[_0x9d6f('0x29')]=_0x149a69;if(_0x3935d5[_0x9d6f('0x3a')][_0x9d6f('0x4a')]){_0x5daa29[_0x9d6f('0x4b')]=[{'all':!![]}];}return db[_0x9d6f('0x36')][_0x9d6f('0x4c')](_0x5daa29);})['then'](function(_0xbc3c6d){_0x16bb4c[_0x9d6f('0x4d')]=_0xbc3c6d;return _0x16bb4c;})[_0x9d6f('0x1b')](respondWithFilteredResult(_0x522fc0,_0x5daa29))[_0x9d6f('0x24')](handleError(_0x522fc0,null));};exports[_0x9d6f('0x4e')]=function(_0x12611c,_0x5eef41){var _0x21f520={'raw':![],'where':{'id':_0x12611c[_0x9d6f('0x4f')]['id']}},_0x2f5c55={};_0x2f5c55['model']=_['keys'](db[_0x9d6f('0x36')]['rawAttributes']);_0x2f5c55[_0x9d6f('0x3a')]=_[_0x9d6f('0x3b')](_0x12611c[_0x9d6f('0x3a')]);_0x2f5c55[_0x9d6f('0x3c')]=_[_0x9d6f('0x3d')](_0x2f5c55[_0x9d6f('0x3e')],_0x2f5c55[_0x9d6f('0x3a')]);_0x21f520[_0x9d6f('0x3f')]=_[_0x9d6f('0x3d')](_0x2f5c55[_0x9d6f('0x3e')],qs[_0x9d6f('0x40')](_0x12611c[_0x9d6f('0x3a')][_0x9d6f('0x40')]));_0x21f520[_0x9d6f('0x3f')]=_0x21f520[_0x9d6f('0x3f')][_0x9d6f('0x50')]?_0x21f520[_0x9d6f('0x3f')]:_0x2f5c55[_0x9d6f('0x3e')];if(_0x12611c[_0x9d6f('0x3a')][_0x9d6f('0x4a')]){_0x21f520[_0x9d6f('0x4b')]=[{'all':!![]}];}_0x21f520=_[_0x9d6f('0x48')]({},_0x21f520,_0x12611c[_0x9d6f('0x49')]);return db['ZohoAccount'][_0x9d6f('0x51')](_0x21f520)[_0x9d6f('0x1b')](handleEntityNotFound(_0x5eef41,null))[_0x9d6f('0x1b')](respondWithResult(_0x5eef41,null))[_0x9d6f('0x24')](handleError(_0x5eef41,null));};exports[_0x9d6f('0x52')]=function(_0xe06ff,_0x272479){return db[_0x9d6f('0x36')]['create'](_0xe06ff[_0x9d6f('0x53')],{})[_0x9d6f('0x1b')](respondWithResult(_0x272479,0xc9))['catch'](handleError(_0x272479,null));};exports['update']=function(_0x2fcdf5,_0x161439){if(_0x2fcdf5[_0x9d6f('0x53')]['id']){delete _0x2fcdf5[_0x9d6f('0x53')]['id'];}return db[_0x9d6f('0x36')][_0x9d6f('0x51')]({'where':{'id':_0x2fcdf5[_0x9d6f('0x4f')]['id']}})[_0x9d6f('0x1b')](handleEntityNotFound(_0x161439,null))[_0x9d6f('0x1b')](saveUpdates(_0x2fcdf5['body'],null))[_0x9d6f('0x1b')](respondWithResult(_0x161439,null))[_0x9d6f('0x24')](handleError(_0x161439,null));};exports[_0x9d6f('0x30')]=function(_0x49c4db,_0x3c9b17){return db[_0x9d6f('0x36')][_0x9d6f('0x51')]({'where':{'id':_0x49c4db[_0x9d6f('0x4f')]['id']}})[_0x9d6f('0x1b')](handleEntityNotFound(_0x3c9b17,null))['then'](removeEntity(_0x3c9b17,null))[_0x9d6f('0x24')](handleError(_0x3c9b17,null));};exports[_0x9d6f('0x54')]=function(_0x2a1762,_0x3106f2,_0x473bb8){var _0x84e656={};var _0x1e6bf7={};var _0x39da1e;var _0xee001d;return db[_0x9d6f('0x36')][_0x9d6f('0x55')]({'where':{'id':_0x2a1762[_0x9d6f('0x4f')]['id']}})[_0x9d6f('0x1b')](handleEntityNotFound(_0x3106f2,null))[_0x9d6f('0x1b')](function(_0x51c668){if(_0x51c668){_0x39da1e=_0x51c668;_0x1e6bf7[_0x9d6f('0x3e')]=_[_0x9d6f('0x3b')](db['ZohoConfiguration'][_0x9d6f('0x37')]);_0x1e6bf7[_0x9d6f('0x3a')]=_['keys'](_0x2a1762[_0x9d6f('0x3a')]);_0x1e6bf7[_0x9d6f('0x3c')]=_[_0x9d6f('0x3d')](_0x1e6bf7[_0x9d6f('0x3e')],_0x1e6bf7['query']);_0x84e656['attributes']=_[_0x9d6f('0x3d')](_0x1e6bf7[_0x9d6f('0x3e')],qs[_0x9d6f('0x40')](_0x2a1762[_0x9d6f('0x3a')]['fields']));_0x84e656[_0x9d6f('0x3f')]=_0x84e656['attributes'][_0x9d6f('0x50')]?_0x84e656['attributes']:_0x1e6bf7[_0x9d6f('0x3e')];_0x84e656[_0x9d6f('0x44')]=qs[_0x9d6f('0x45')](_0x2a1762['query']['sort']);_0x84e656[_0x9d6f('0x46')]=qs[_0x9d6f('0x3c')](_[_0x9d6f('0x56')](_0x2a1762['query'],_0x1e6bf7['filters']));if(_0x2a1762[_0x9d6f('0x3a')][_0x9d6f('0x47')]){_0x84e656['where']=_['merge'](_0x84e656[_0x9d6f('0x46')],{'$or':_[_0x9d6f('0x35')](_0x84e656[_0x9d6f('0x3f')],function(_0x3da90e){var _0x16470a={};_0x16470a[_0x3da90e]={'$like':'%'+_0x2a1762[_0x9d6f('0x3a')][_0x9d6f('0x47')]+'%'};return _0x16470a;})});}_0x84e656=_['merge']({},_0x84e656,_0x2a1762[_0x9d6f('0x49')]);return _0x39da1e[_0x9d6f('0x54')](_0x84e656);}})[_0x9d6f('0x1b')](function(_0x1daa68){if(_0x1daa68){_0xee001d=_0x1daa68['length'];if(!_0x2a1762['query'][_0x9d6f('0x41')]('nolimit')){_0x84e656[_0x9d6f('0x43')]=qs['limit'](_0x2a1762[_0x9d6f('0x3a')][_0x9d6f('0x43')]);_0x84e656[_0x9d6f('0x2a')]=qs[_0x9d6f('0x2a')](_0x2a1762[_0x9d6f('0x3a')][_0x9d6f('0x2a')]);}return _0x39da1e[_0x9d6f('0x54')](_0x84e656);}})[_0x9d6f('0x1b')](function(_0x337c28){if(_0x337c28){return _0x337c28?{'count':_0xee001d,'rows':_0x337c28}:null;}})[_0x9d6f('0x1b')](respondWithResult(_0x3106f2,null))[_0x9d6f('0x24')](handleError(_0x3106f2,null));};exports[_0x9d6f('0x57')]=function(_0x4f26dd,_0x102153,_0x41f7ac){if(_0x4f26dd[_0x9d6f('0x53')]['id']){delete _0x4f26dd[_0x9d6f('0x53')]['id'];}return db[_0x9d6f('0x36')][_0x9d6f('0x55')]({'where':{'id':_0x4f26dd[_0x9d6f('0x4f')]['id']}})[_0x9d6f('0x1b')](handleEntityNotFound(_0x102153,null))[_0x9d6f('0x1b')](function(_0x448db8){if(_0x448db8){_0x4f26dd[_0x9d6f('0x53')][_0x9d6f('0x58')]=_0x448db8['id'];_0x4f26dd[_0x9d6f('0x53')][_0x9d6f('0x59')]=integrations[_0x9d6f('0x5a')](_0x4f26dd[_0x9d6f('0x53')][_0x9d6f('0x5b')],_0x4f26dd[_0x9d6f('0x53')][_0x9d6f('0x38')]);_0x4f26dd['body'][_0x9d6f('0x5c')]=integrations[_0x9d6f('0x5d')](_0x4f26dd[_0x9d6f('0x53')]['channel'],_0x4f26dd['body'][_0x9d6f('0x38')]);return db[_0x9d6f('0x5e')][_0x9d6f('0x52')](_0x4f26dd[_0x9d6f('0x53')],{'include':[{'model':db[_0x9d6f('0x5f')],'as':_0x9d6f('0x59')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x102153,null))[_0x9d6f('0x24')](handleError(_0x102153,null));};function getAccessToken(_0x1ac1b2){return new Promise(function(_0xeea53e,_0x548abc){var _0x402931;switch(_0x1ac1b2[_0x9d6f('0x60')]){case'US':_0x402931=_0x9d6f('0x61');break;case'AU':_0x402931=_0x9d6f('0x62');break;case'EU':_0x402931=_0x9d6f('0x63');break;case'IN':_0x402931='https://accounts.zoho.in';break;case'CN':_0x402931=_0x9d6f('0x64');break;default:_0x402931='https://accounts.zoho.eu';break;}var _0x49c423={'method':_0x9d6f('0x65'),'uri':_0x402931+_0x9d6f('0x66'),'qs':{'refresh_token':_0x1ac1b2[_0x9d6f('0x67')],'client_id':_0x1ac1b2['clientId'],'client_secret':_0x1ac1b2[_0x9d6f('0x68')],'grant_type':_0x9d6f('0x69')},'json':!![]};return rp(_0x49c423)[_0x9d6f('0x1b')](function(_0x4cf643){if(_0x4cf643[_0x9d6f('0x6a')]){_0xeea53e(_0x4cf643[_0x9d6f('0x6a')]);}else{_0x548abc(_0x9d6f('0x6b'));}})['catch'](function(_0x26af79){_0x548abc(_0x26af79);});});}exports[_0x9d6f('0x6c')]=function(_0x20cc12,_0x1654e1,_0x28b576){var _0x5a7e6b,_0x5b1dcb,_0x200453,_0x2a33bc,_0x51b637;return db[_0x9d6f('0x36')]['findOne']({'where':{'id':_0x20cc12[_0x9d6f('0x4f')]['id']},'attributes':['id',_0x9d6f('0x6d'),_0x9d6f('0x60'),_0x9d6f('0x6e'),_0x9d6f('0x68'),_0x9d6f('0x6f'),'code',_0x9d6f('0x67')]})[_0x9d6f('0x1b')](handleEntityNotFound(_0x1654e1,null))[_0x9d6f('0x1b')](function(_0x3d4255){_0x51b637=_0x3d4255;_0x5a7e6b=_0x51b637[_0x9d6f('0x6d')];_0x5b1dcb=_0x5a7e6b===_0x9d6f('0x70')?'eu':_0x9d6f('0x71');_0x200453=_0x51b637['serverUrl'];var _0x52ac7a=_0x200453[_0x9d6f('0x72')](-0x1);if(_0x52ac7a==='/'||_0x52ac7a==='\x5c'||_0x52ac7a===':'){_0x200453=_0x200453['substring'](0x0,_0x200453[_0x9d6f('0x73')](_0x52ac7a));}if(!_0x51b637['refreshToken']){throw new Error(_0x9d6f('0x74'));}return getAccessToken(_0x51b637);})[_0x9d6f('0x1b')](function(_0xbab468){if(_0xbab468){return rp({'method':'GET','uri':util[_0x9d6f('0x75')](_0x9d6f('0x76'),_0x5b1dcb),'qs':{'module':_0x9d6f('0x77')},'headers':{'Authorization':_0x9d6f('0x78')+_0xbab468},'json':!![]});}})[_0x9d6f('0x1b')](function(_0x25c132){if(_0x25c132){if(_0x25c132['response']&&_0x25c132[_0x9d6f('0x79')]['error']){throw new Error(_0x25c132[_0x9d6f('0x79')][_0x9d6f('0x20')][_0x9d6f('0x22')]);}var _0x3f440c=[];var _0x34b350=[];var _0x31d04c=[_0x9d6f('0x7a'),_0x9d6f('0x7b'),'Description',_0x9d6f('0x7c'),_0x9d6f('0x7d'),_0x9d6f('0x7e'),'Call_Start_Time',_0x9d6f('0x7f')];_0x34b350=_['remove'](_0x25c132[_0x9d6f('0x40')],function(_0x21f76f){return _0x31d04c['includes'](_0x21f76f[_0x9d6f('0x80')]);});for(var _0xb7994d=0x0;_0xb7994d<_0x34b350[_0x9d6f('0x50')];_0xb7994d++){if(_0x34b350[_0xb7994d]['system_mandatory']===![]){_0x3f440c[_0x9d6f('0x81')]({'id':_0x34b350[_0xb7994d]['id'],'name':_0x34b350[_0xb7994d][_0x9d6f('0x82')],'custom':_0x34b350[_0xb7994d]['custom_field'],'options':_0x34b350[_0xb7994d][_0x9d6f('0x83')]===_0x9d6f('0x84')&&_0x34b350[_0xb7994d][_0x9d6f('0x85')][_0x9d6f('0x50')]>-0x1?_[_0x9d6f('0x35')](_0x34b350[_0xb7994d][_0x9d6f('0x85')],function(_0x36fbca){return{'name':_0x36fbca,'value':_0x36fbca};}):[]});}}return{'count':_0x3f440c[_0x9d6f('0x50')],'rows':_0x3f440c};}else{return{'count':0x0,'rows':[]};}})[_0x9d6f('0x1b')](respondWithResult(_0x1654e1,null))[_0x9d6f('0x24')](function(_0x562228){var _0x53d4d7=_0x20cc12[_0x9d6f('0x3a')]['test']?0x1f4:_0x562228[_0x9d6f('0x86')]||0x1f4;logger[_0x9d6f('0x20')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x53d4d7,JSON[_0x9d6f('0x87')](_0x562228));delete _0x562228[_0x9d6f('0x32')];if(_0x53d4d7===0x191){_0x53d4d7=0x190;}_0x1654e1[_0x9d6f('0x26')](_0x53d4d7)['send'](_0x20cc12[_0x9d6f('0x3a')][_0x9d6f('0x88')]?{'message':_0x9d6f('0x89'),'statusCode':_0x562228[_0x9d6f('0x86')]}:_0x562228);});}; \ No newline at end of file +var _0x86dc=['Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Subject','Description','WhoId','Call_Result','Call_Start_Time','remove','includes','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','ZohoAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','count','offset','limit','json','apply','reject','save','update','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','name','rows','show','keys','length','includeAll','options','find','create','body','params','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId'];(function(_0x5c3c4f,_0x50a675){var _0x3dd693=function(_0x52fb4a){while(--_0x52fb4a){_0x5c3c4f['push'](_0x5c3c4f['shift']());}};_0x3dd693(++_0x50a675);}(_0x86dc,0x13e));var _0xc86d=function(_0x24a97c,_0xf7f941){_0x24a97c=_0x24a97c-0x0;var _0x187447=_0x86dc[_0x24a97c];return _0x187447;};'use strict';var pdf=require(_0xc86d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc86d('0x1'));var jsonpatch=require(_0xc86d('0x2'));var rp=require(_0xc86d('0x3'));var moment=require(_0xc86d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc86d('0x5'));var util=require('util');var path=require(_0xc86d('0x6'));var sox=require('sox');var csv=require(_0xc86d('0x7'));var ejs=require(_0xc86d('0x8'));var fs=require('fs');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('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc86d('0xc'));var authService=require(_0xc86d('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xc86d('0xe'));var hardwareService=require(_0xc86d('0xf'));var logger=require(_0xc86d('0x10'))(_0xc86d('0x11'));var utils=require(_0xc86d('0x12'));var config=require(_0xc86d('0x13'));var licenseUtil=require(_0xc86d('0x14'));var db=require(_0xc86d('0x15'))['db'];var integrations=require(_0xc86d('0x16'));var jayson=require(_0xc86d('0x17'));var client=jayson[_0xc86d('0x18')][_0xc86d('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x33b1a0,_0xccef31,_0x450fb1,_0x2a963c){return new BPromise(function(_0x176ce1,_0x313c16){var _0x2bc469=_0x2a963c||client;return _0x2bc469[_0xc86d('0x1a')](_0x33b1a0,_0x450fb1)[_0xc86d('0x1b')](function(_0x5e58aa){logger['info']('ZohoAccount,\x20%s,\x20%s',_0xccef31,_0xc86d('0x1c'));logger[_0xc86d('0x1d')](_0xc86d('0x1e'),_0xccef31,_0xc86d('0x1c'),JSON[_0xc86d('0x1f')](_0x5e58aa));if(_0x5e58aa[_0xc86d('0x20')]){if(_0x5e58aa[_0xc86d('0x20')]['code']===0x1f4){logger['error'](_0xc86d('0x21'),_0xccef31,_0x5e58aa[_0xc86d('0x20')][_0xc86d('0x22')]);return _0x313c16(_0x5e58aa['error'][_0xc86d('0x22')]);}logger[_0xc86d('0x20')](_0xc86d('0x21'),_0xccef31,_0x5e58aa['error'][_0xc86d('0x22')]);return _0x176ce1(_0x5e58aa[_0xc86d('0x20')]['message']);}else{logger[_0xc86d('0x23')](_0xc86d('0x21'),_0xccef31,_0xc86d('0x1c'));_0x176ce1(_0x5e58aa[_0xc86d('0x24')]['message']);}})[_0xc86d('0x25')](function(_0x350cda){logger[_0xc86d('0x20')](_0xc86d('0x21'),_0xccef31,_0x350cda);_0x313c16(_0x350cda);});});}function respondWithStatusCode(_0xbeed40,_0x56278d){_0x56278d=_0x56278d||0xcc;return function(_0x38fb11){if(_0x38fb11){return _0xbeed40[_0xc86d('0x26')](_0x56278d);}return _0xbeed40[_0xc86d('0x27')](_0x56278d)[_0xc86d('0x28')]();};}function respondWithResult(_0x27d636,_0x5347f7){_0x5347f7=_0x5347f7||0xc8;return function(_0x1458fe){if(_0x1458fe){return _0x27d636['status'](_0x5347f7)['json'](_0x1458fe);}};}function respondWithFilteredResult(_0x533cce,_0x2782b8){return function(_0x3948c4){if(_0x3948c4){var _0x273c5a=_0x3948c4[_0xc86d('0x29')],_0x1e29be=_0x2782b8[_0xc86d('0x2a')],_0xd8b255=_0x2782b8['offset']+_0x2782b8[_0xc86d('0x2b')],_0x1ad978;if(_0xd8b255>=_0x273c5a){_0xd8b255=_0x273c5a;_0x1ad978=0xc8;}else{_0x1ad978=0xce;}_0x533cce[_0xc86d('0x27')](_0x1ad978);return _0x533cce['set']('Content-Range',_0x1e29be+'-'+_0xd8b255+'/'+_0x273c5a)[_0xc86d('0x2c')](_0x3948c4);}return null;};}function patchUpdates(_0x1f5772){return function(_0x54a9f6){try{jsonpatch[_0xc86d('0x2d')](_0x54a9f6,_0x1f5772,!![]);}catch(_0x384bc9){return BPromise[_0xc86d('0x2e')](_0x384bc9);}return _0x54a9f6[_0xc86d('0x2f')]();};}function saveUpdates(_0x5a4ef1,_0x5bda1c){return function(_0x205a2b){if(_0x205a2b){return _0x205a2b[_0xc86d('0x30')](_0x5a4ef1)[_0xc86d('0x1b')](function(_0x219673){return _0x219673;});}return null;};}function removeEntity(_0x28dd82,_0x5b80cb){return function(_0x3ca99a){if(_0x3ca99a){return _0x3ca99a['destroy']()[_0xc86d('0x1b')](function(){_0x28dd82[_0xc86d('0x27')](0xcc)[_0xc86d('0x28')]();});}};}function handleEntityNotFound(_0x21377a,_0x3a469d){return function(_0x1d7fe8){if(!_0x1d7fe8){_0x21377a[_0xc86d('0x26')](0x194);}return _0x1d7fe8;};}function handleError(_0x100258,_0x12ea63){_0x12ea63=_0x12ea63||0x1f4;return function(_0x4e51bd){logger['error'](_0x4e51bd['stack']);if(_0x4e51bd['name']){delete _0x4e51bd['name'];}_0x100258['status'](_0x12ea63)[_0xc86d('0x31')](_0x4e51bd);};}exports[_0xc86d('0x32')]=function(_0x3fa1dd,_0x118007){var _0x2cba68={},_0x225a25={},_0x51924c={'count':0x0,'rows':[]};var _0x3b0940=_[_0xc86d('0x33')](db[_0xc86d('0x34')][_0xc86d('0x35')],function(_0x10f6a1){return{'name':_0x10f6a1[_0xc86d('0x36')],'type':_0x10f6a1[_0xc86d('0x37')][_0xc86d('0x38')]};});_0x225a25[_0xc86d('0x39')]=_[_0xc86d('0x33')](_0x3b0940,'name');_0x225a25[_0xc86d('0x3a')]=_['keys'](_0x3fa1dd[_0xc86d('0x3a')]);_0x225a25[_0xc86d('0x3b')]=_[_0xc86d('0x3c')](_0x225a25['model'],_0x225a25[_0xc86d('0x3a')]);_0x2cba68[_0xc86d('0x3d')]=_[_0xc86d('0x3c')](_0x225a25['model'],qs[_0xc86d('0x3e')](_0x3fa1dd[_0xc86d('0x3a')][_0xc86d('0x3e')]));_0x2cba68[_0xc86d('0x3d')]=_0x2cba68[_0xc86d('0x3d')]['length']?_0x2cba68[_0xc86d('0x3d')]:_0x225a25[_0xc86d('0x39')];if(!_0x3fa1dd[_0xc86d('0x3a')][_0xc86d('0x3f')](_0xc86d('0x40'))){_0x2cba68[_0xc86d('0x2b')]=qs['limit'](_0x3fa1dd[_0xc86d('0x3a')]['limit']);_0x2cba68[_0xc86d('0x2a')]=qs[_0xc86d('0x2a')](_0x3fa1dd[_0xc86d('0x3a')][_0xc86d('0x2a')]);}_0x2cba68['order']=qs['sort'](_0x3fa1dd['query'][_0xc86d('0x41')]);_0x2cba68[_0xc86d('0x42')]=qs[_0xc86d('0x3b')](_[_0xc86d('0x43')](_0x3fa1dd['query'],_0x225a25[_0xc86d('0x3b')]),_0x3b0940);if(_0x3fa1dd[_0xc86d('0x3a')][_0xc86d('0x44')]){_0x2cba68[_0xc86d('0x42')]=_[_0xc86d('0x45')](_0x2cba68['where'],{'$or':_[_0xc86d('0x33')](_0x3b0940,function(_0x32fd2e){if(_0x32fd2e[_0xc86d('0x37')]!==_0xc86d('0x46')){var _0x515b18={};_0x515b18[_0x32fd2e[_0xc86d('0x47')]]={'$like':'%'+_0x3fa1dd['query']['filter']+'%'};return _0x515b18;}})});}_0x2cba68=_[_0xc86d('0x45')]({},_0x2cba68,_0x3fa1dd['options']);var _0x2f3fa6={'where':_0x2cba68[_0xc86d('0x42')]};return db[_0xc86d('0x34')][_0xc86d('0x29')](_0x2f3fa6)['then'](function(_0x207999){_0x51924c[_0xc86d('0x29')]=_0x207999;if(_0x3fa1dd[_0xc86d('0x3a')]['includeAll']){_0x2cba68['include']=[{'all':!![]}];}return db[_0xc86d('0x34')]['findAll'](_0x2cba68);})[_0xc86d('0x1b')](function(_0x281007){_0x51924c[_0xc86d('0x48')]=_0x281007;return _0x51924c;})['then'](respondWithFilteredResult(_0x118007,_0x2cba68))['catch'](handleError(_0x118007,null));};exports[_0xc86d('0x49')]=function(_0x21b745,_0x39c3db){var _0x574663={'raw':![],'where':{'id':_0x21b745['params']['id']}},_0xb9c6e8={};_0xb9c6e8[_0xc86d('0x39')]=_[_0xc86d('0x4a')](db['ZohoAccount'][_0xc86d('0x35')]);_0xb9c6e8[_0xc86d('0x3a')]=_['keys'](_0x21b745[_0xc86d('0x3a')]);_0xb9c6e8['filters']=_[_0xc86d('0x3c')](_0xb9c6e8[_0xc86d('0x39')],_0xb9c6e8[_0xc86d('0x3a')]);_0x574663['attributes']=_['intersection'](_0xb9c6e8[_0xc86d('0x39')],qs[_0xc86d('0x3e')](_0x21b745[_0xc86d('0x3a')][_0xc86d('0x3e')]));_0x574663['attributes']=_0x574663[_0xc86d('0x3d')][_0xc86d('0x4b')]?_0x574663[_0xc86d('0x3d')]:_0xb9c6e8[_0xc86d('0x39')];if(_0x21b745[_0xc86d('0x3a')][_0xc86d('0x4c')]){_0x574663['include']=[{'all':!![]}];}_0x574663=_[_0xc86d('0x45')]({},_0x574663,_0x21b745[_0xc86d('0x4d')]);return db[_0xc86d('0x34')][_0xc86d('0x4e')](_0x574663)[_0xc86d('0x1b')](handleEntityNotFound(_0x39c3db,null))[_0xc86d('0x1b')](respondWithResult(_0x39c3db,null))[_0xc86d('0x25')](handleError(_0x39c3db,null));};exports[_0xc86d('0x4f')]=function(_0x5b6fdb,_0x4f57f7){return db[_0xc86d('0x34')]['create'](_0x5b6fdb[_0xc86d('0x50')],{})[_0xc86d('0x1b')](respondWithResult(_0x4f57f7,0xc9))['catch'](handleError(_0x4f57f7,null));};exports[_0xc86d('0x30')]=function(_0x64d4f7,_0x2bf181){if(_0x64d4f7[_0xc86d('0x50')]['id']){delete _0x64d4f7[_0xc86d('0x50')]['id'];}return db[_0xc86d('0x34')][_0xc86d('0x4e')]({'where':{'id':_0x64d4f7[_0xc86d('0x51')]['id']}})['then'](handleEntityNotFound(_0x2bf181,null))[_0xc86d('0x1b')](saveUpdates(_0x64d4f7[_0xc86d('0x50')],null))[_0xc86d('0x1b')](respondWithResult(_0x2bf181,null))[_0xc86d('0x25')](handleError(_0x2bf181,null));};exports['destroy']=function(_0x246021,_0x5cfb45){return db[_0xc86d('0x34')][_0xc86d('0x4e')]({'where':{'id':_0x246021[_0xc86d('0x51')]['id']}})['then'](handleEntityNotFound(_0x5cfb45,null))[_0xc86d('0x1b')](removeEntity(_0x5cfb45,null))[_0xc86d('0x25')](handleError(_0x5cfb45,null));};exports[_0xc86d('0x52')]=function(_0x45e763,_0x4fa36a,_0x4f30e2){var _0x135f26={};var _0x529926={};var _0xbe263a;var _0x569ac9;return db[_0xc86d('0x34')][_0xc86d('0x53')]({'where':{'id':_0x45e763[_0xc86d('0x51')]['id']}})['then'](handleEntityNotFound(_0x4fa36a,null))['then'](function(_0x4f0d12){if(_0x4f0d12){_0xbe263a=_0x4f0d12;_0x529926[_0xc86d('0x39')]=_[_0xc86d('0x4a')](db[_0xc86d('0x54')][_0xc86d('0x35')]);_0x529926[_0xc86d('0x3a')]=_[_0xc86d('0x4a')](_0x45e763['query']);_0x529926['filters']=_[_0xc86d('0x3c')](_0x529926[_0xc86d('0x39')],_0x529926[_0xc86d('0x3a')]);_0x135f26[_0xc86d('0x3d')]=_[_0xc86d('0x3c')](_0x529926[_0xc86d('0x39')],qs[_0xc86d('0x3e')](_0x45e763[_0xc86d('0x3a')][_0xc86d('0x3e')]));_0x135f26['attributes']=_0x135f26[_0xc86d('0x3d')][_0xc86d('0x4b')]?_0x135f26['attributes']:_0x529926['model'];_0x135f26['order']=qs[_0xc86d('0x41')](_0x45e763[_0xc86d('0x3a')][_0xc86d('0x41')]);_0x135f26[_0xc86d('0x42')]=qs[_0xc86d('0x3b')](_[_0xc86d('0x43')](_0x45e763[_0xc86d('0x3a')],_0x529926[_0xc86d('0x3b')]));if(_0x45e763['query'][_0xc86d('0x44')]){_0x135f26['where']=_[_0xc86d('0x45')](_0x135f26[_0xc86d('0x42')],{'$or':_[_0xc86d('0x33')](_0x135f26[_0xc86d('0x3d')],function(_0x36497f){var _0x267d2a={};_0x267d2a[_0x36497f]={'$like':'%'+_0x45e763[_0xc86d('0x3a')][_0xc86d('0x44')]+'%'};return _0x267d2a;})});}_0x135f26=_[_0xc86d('0x45')]({},_0x135f26,_0x45e763[_0xc86d('0x4d')]);return _0xbe263a[_0xc86d('0x52')](_0x135f26);}})[_0xc86d('0x1b')](function(_0x5b6abc){if(_0x5b6abc){_0x569ac9=_0x5b6abc[_0xc86d('0x4b')];if(!_0x45e763[_0xc86d('0x3a')][_0xc86d('0x3f')](_0xc86d('0x40'))){_0x135f26[_0xc86d('0x2b')]=qs[_0xc86d('0x2b')](_0x45e763['query']['limit']);_0x135f26[_0xc86d('0x2a')]=qs[_0xc86d('0x2a')](_0x45e763[_0xc86d('0x3a')]['offset']);}return _0xbe263a[_0xc86d('0x52')](_0x135f26);}})[_0xc86d('0x1b')](function(_0x542d27){if(_0x542d27){return _0x542d27?{'count':_0x569ac9,'rows':_0x542d27}:null;}})['then'](respondWithResult(_0x4fa36a,null))[_0xc86d('0x25')](handleError(_0x4fa36a,null));};exports[_0xc86d('0x55')]=function(_0x332cae,_0x2263dc,_0x21d56f){if(_0x332cae[_0xc86d('0x50')]['id']){delete _0x332cae[_0xc86d('0x50')]['id'];}return db[_0xc86d('0x34')][_0xc86d('0x53')]({'where':{'id':_0x332cae[_0xc86d('0x51')]['id']}})[_0xc86d('0x1b')](handleEntityNotFound(_0x2263dc,null))[_0xc86d('0x1b')](function(_0x362614){if(_0x362614){_0x332cae[_0xc86d('0x50')][_0xc86d('0x56')]=_0x362614['id'];_0x332cae[_0xc86d('0x50')][_0xc86d('0x57')]=integrations[_0xc86d('0x58')](_0x332cae['body'][_0xc86d('0x59')],_0x332cae[_0xc86d('0x50')]['type']);_0x332cae['body'][_0xc86d('0x5a')]=integrations['getDescriptions'](_0x332cae[_0xc86d('0x50')][_0xc86d('0x59')],_0x332cae[_0xc86d('0x50')]['type']);return db[_0xc86d('0x54')][_0xc86d('0x4f')](_0x332cae[_0xc86d('0x50')],{'include':[{'model':db[_0xc86d('0x5b')],'as':_0xc86d('0x57')},{'model':db[_0xc86d('0x5b')],'as':_0xc86d('0x5a')}]});}return null;})['then'](respondWithResult(_0x2263dc,null))[_0xc86d('0x25')](handleError(_0x2263dc,null));};function getAccessToken(_0x224b33){return new Promise(function(_0x61ca65,_0x48224e){var _0xd6d9f;switch(_0x224b33[_0xc86d('0x5c')]){case'US':_0xd6d9f=_0xc86d('0x5d');break;case'AU':_0xd6d9f=_0xc86d('0x5e');break;case'EU':_0xd6d9f=_0xc86d('0x5f');break;case'IN':_0xd6d9f=_0xc86d('0x60');break;case'CN':_0xd6d9f=_0xc86d('0x61');break;default:_0xd6d9f=_0xc86d('0x5f');break;}var _0x30113a={'method':_0xc86d('0x62'),'uri':_0xd6d9f+_0xc86d('0x63'),'qs':{'refresh_token':_0x224b33[_0xc86d('0x64')],'client_id':_0x224b33[_0xc86d('0x65')],'client_secret':_0x224b33[_0xc86d('0x66')],'grant_type':_0xc86d('0x67')},'json':!![]};return rp(_0x30113a)['then'](function(_0x34e77e){if(_0x34e77e[_0xc86d('0x68')]){_0x61ca65(_0x34e77e[_0xc86d('0x68')]);}else{_0x48224e('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xc86d('0x25')](function(_0x1115db){_0x48224e(_0x1115db);});});}exports[_0xc86d('0x69')]=function(_0x3e9f50,_0x322e30,_0x90a73f){var _0x504b67,_0xce0099,_0x45d52e,_0x4aee9f,_0x28a69c;return db[_0xc86d('0x34')][_0xc86d('0x53')]({'where':{'id':_0x3e9f50['params']['id']},'attributes':['id',_0xc86d('0x6a'),_0xc86d('0x5c'),_0xc86d('0x65'),_0xc86d('0x66'),_0xc86d('0x6b'),'code','refreshToken']})[_0xc86d('0x1b')](handleEntityNotFound(_0x322e30,null))['then'](function(_0x4bbac8){_0x28a69c=_0x4bbac8;_0x504b67=_0x28a69c[_0xc86d('0x6a')];_0xce0099=_0x504b67==='zoho.eu'?'eu':_0xc86d('0x6c');_0x45d52e=_0x28a69c[_0xc86d('0x6b')];var _0xa17588=_0x45d52e[_0xc86d('0x6d')](-0x1);if(_0xa17588==='/'||_0xa17588==='\x5c'||_0xa17588===':'){_0x45d52e=_0x45d52e[_0xc86d('0x6e')](0x0,_0x45d52e[_0xc86d('0x6f')](_0xa17588));}if(!_0x28a69c[_0xc86d('0x64')]){throw new Error(_0xc86d('0x70'));}return getAccessToken(_0x28a69c);})[_0xc86d('0x1b')](function(_0x3944c3){if(_0x3944c3){return rp({'method':_0xc86d('0x71'),'uri':util[_0xc86d('0x72')](_0xc86d('0x73'),_0xce0099),'qs':{'module':'Calls'},'headers':{'Authorization':_0xc86d('0x74')+_0x3944c3},'json':!![]});}})[_0xc86d('0x1b')](function(_0x5ace7e){if(_0x5ace7e){if(_0x5ace7e['response']&&_0x5ace7e['response'][_0xc86d('0x20')]){throw new Error(_0x5ace7e[_0xc86d('0x75')][_0xc86d('0x20')][_0xc86d('0x22')]);}var _0x2029ab=[];var _0xbba47f=[];var _0x3ef3cb=['Owner',_0xc86d('0x76'),_0xc86d('0x77'),_0xc86d('0x78'),'Call_Duration',_0xc86d('0x79'),_0xc86d('0x7a'),'Call_Type'];_0xbba47f=_[_0xc86d('0x7b')](_0x5ace7e[_0xc86d('0x3e')],function(_0x568467){return _0x3ef3cb[_0xc86d('0x7c')](_0x568467['api_name']);});for(var _0x192761=0x0;_0x192761<_0xbba47f[_0xc86d('0x4b')];_0x192761++){if(_0xbba47f[_0x192761][_0xc86d('0x7d')]===![]){_0x2029ab['push']({'id':_0xbba47f[_0x192761]['id'],'name':_0xbba47f[_0x192761][_0xc86d('0x7e')],'custom':_0xbba47f[_0x192761][_0xc86d('0x7f')],'options':_0xbba47f[_0x192761][_0xc86d('0x80')]===_0xc86d('0x81')&&_0xbba47f[_0x192761][_0xc86d('0x82')][_0xc86d('0x4b')]>-0x1?_[_0xc86d('0x33')](_0xbba47f[_0x192761]['pick_list_values'],function(_0x48efe3){return{'name':_0x48efe3,'value':_0x48efe3};}):[]});}}return{'count':_0x2029ab[_0xc86d('0x4b')],'rows':_0x2029ab};}else{return{'count':0x0,'rows':[]};}})[_0xc86d('0x1b')](respondWithResult(_0x322e30,null))['catch'](function(_0x2ffbc7){var _0x1baa4b=_0x3e9f50[_0xc86d('0x3a')][_0xc86d('0x83')]?0x1f4:_0x2ffbc7['statusCode']||0x1f4;logger[_0xc86d('0x20')](_0xc86d('0x84'),'getFields',_0x1baa4b,JSON['stringify'](_0x2ffbc7));delete _0x2ffbc7[_0xc86d('0x47')];if(_0x1baa4b===0x191){_0x1baa4b=0x190;}_0x322e30[_0xc86d('0x27')](_0x1baa4b)['send'](_0x3e9f50[_0xc86d('0x3a')][_0xc86d('0x83')]?{'message':_0xc86d('0x85'),'statusCode':_0x2ffbc7[_0xc86d('0x86')]}:_0x2ffbc7);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index e281730..5c542ec 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 _0x2950=['changed','zone','serverUrl','clientId','clientSecret','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','error','code','substring','https://accounts.zoho.com.cn','https://accounts.zoho.eu','catch','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','int_zoho_accounts'];(function(_0x50ec34,_0x174738){var _0xed4ce=function(_0x235cd7){while(--_0x235cd7){_0x50ec34['push'](_0x50ec34['shift']());}};_0xed4ce(++_0x174738);}(_0x2950,0x12d));var _0x0295=function(_0x277b6c,_0x4401f3){_0x277b6c=_0x277b6c-0x0;var _0x28f414=_0x2950[_0x277b6c];return _0x28f414;};'use strict';var _=require(_0x0295('0x0'));var util=require(_0x0295('0x1'));var logger=require(_0x0295('0x2'))(_0x0295('0x3'));var moment=require(_0x0295('0x4'));var BPromise=require(_0x0295('0x5'));var rp=require(_0x0295('0x6'));var fs=require('fs');var path=require(_0x0295('0x7'));var rimraf=require(_0x0295('0x8'));var config=require(_0x0295('0x9'));var attributes=require(_0x0295('0xa'));var integrations=require(_0x0295('0xb'));module[_0x0295('0xc')]=function(_0x74e944,_0x45a2ea){return _0x74e944['define']('ZohoAccount',attributes,{'tableName':_0x0295('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4ac046,_0x4fa498,_0x5944b0){if(_0x4ac046[_0x0295('0xe')](_0x0295('0xf'))||_0x4ac046[_0x0295('0xe')](_0x0295('0x10'))||_0x4ac046[_0x0295('0xe')](_0x0295('0x11'))||_0x4ac046[_0x0295('0xe')](_0x0295('0x12'))||_0x4ac046['changed']('code')||_0x4ac046[_0x0295('0xe')](_0x0295('0x13'))){var _0x2763c3,_0x1df933;_0x2763c3=_0x4ac046[_0x0295('0x10')];var _0x11ba70=_0x2763c3[_0x0295('0x14')](-0x1);if(_0x11ba70==='/'||_0x11ba70==='\x5c'||_0x11ba70===':'){_0x2763c3=_0x2763c3['substring'](0x0,_0x2763c3[_0x0295('0x15')](_0x11ba70));}switch(_0x4ac046[_0x0295('0xf')]){case'US':_0x1df933=_0x0295('0x16');break;case'AU':_0x1df933=_0x0295('0x17');break;case'IN':_0x1df933=_0x0295('0x18');break;case'CN':_0x1df933='https://accounts.zoho.com.cn';break;default:_0x1df933='https://accounts.zoho.eu';break;}var _0xc3eecb={'method':_0x0295('0x19'),'uri':_0x1df933+_0x0295('0x1a'),'form':{'grant_type':_0x0295('0x1b'),'client_id':_0x4ac046[_0x0295('0x11')],'client_secret':_0x4ac046[_0x0295('0x12')],'redirect_uri':_0x4ac046['serverUrl'],'code':_0x4ac046['code']},'headers':{'Content-Type':_0x0295('0x1c')}};return rp(_0xc3eecb)[_0x0295('0x1d')](function(_0x44fd9d){var _0x5e6e6c=JSON[_0x0295('0x1e')](_0x44fd9d);if(_0x5e6e6c[_0x0295('0x1f')]){_0x4ac046[_0x0295('0x20')]=_0x5e6e6c[_0x0295('0x1f')];logger[_0x0295('0x21')](util[_0x0295('0x22')](_0x0295('0x23'),_0x4ac046[_0x0295('0x24')],_0x4ac046['id']));}else{logger['error'](util[_0x0295('0x22')](_0x0295('0x25'),_0x4ac046['name'],_0x4ac046['id']),util[_0x0295('0x26')](_0x5e6e6c,{'showHidden':![],'depth':null}));}return _0x5944b0(null,_0x4fa498);})['catch'](function(_0x297fc1){logger[_0x0295('0x27')](util[_0x0295('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4ac046['name'],_0x4ac046['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x5944b0(_0x297fc1);});}else{return _0x5944b0(null,_0x4fa498);}},'beforeUpdate':function(_0x4c36f9,_0x1b27ff,_0x240b58){if(_0x4c36f9[_0x0295('0xe')](_0x0295('0xf'))||_0x4c36f9['changed'](_0x0295('0x10'))||_0x4c36f9[_0x0295('0xe')](_0x0295('0x11'))||_0x4c36f9[_0x0295('0xe')](_0x0295('0x12'))||_0x4c36f9['changed'](_0x0295('0x28'))||_0x4c36f9[_0x0295('0xe')](_0x0295('0x13'))){var _0x4e6587,_0x278dc0;_0x4e6587=_0x4c36f9[_0x0295('0x10')];var _0x21f39a=_0x4e6587[_0x0295('0x14')](-0x1);if(_0x21f39a==='/'||_0x21f39a==='\x5c'||_0x21f39a===':'){_0x4e6587=_0x4e6587[_0x0295('0x29')](0x0,_0x4e6587[_0x0295('0x15')](_0x21f39a));}switch(_0x4c36f9['zone']){case'US':_0x278dc0=_0x0295('0x16');break;case'AU':_0x278dc0=_0x0295('0x17');break;case'IN':_0x278dc0=_0x0295('0x18');break;case'CN':_0x278dc0=_0x0295('0x2a');break;default:_0x278dc0=_0x0295('0x2b');break;}var _0x3fb9ff={'method':_0x0295('0x19'),'uri':_0x278dc0+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x4c36f9[_0x0295('0x11')],'client_secret':_0x4c36f9[_0x0295('0x12')],'redirect_uri':_0x4c36f9['serverUrl'],'code':_0x4c36f9['code']},'headers':{'Content-Type':_0x0295('0x1c')}};return rp(_0x3fb9ff)[_0x0295('0x1d')](function(_0x3a5502){var _0x33ef2d=JSON[_0x0295('0x1e')](_0x3a5502);if(_0x33ef2d[_0x0295('0x1f')]){_0x4c36f9[_0x0295('0x20')]=_0x33ef2d[_0x0295('0x1f')];logger['info'](util[_0x0295('0x22')](_0x0295('0x23'),_0x4c36f9['name'],_0x4c36f9['id']));}else{logger[_0x0295('0x27')](util[_0x0295('0x22')](_0x0295('0x25'),_0x4c36f9['name'],_0x4c36f9['id']),util[_0x0295('0x26')](_0x33ef2d,{'showHidden':![],'depth':null}));}return _0x240b58(null,_0x1b27ff);})[_0x0295('0x2c')](function(_0x2d6fe3){logger[_0x0295('0x27')](util[_0x0295('0x22')](_0x0295('0x25'),_0x4c36f9[_0x0295('0x24')],_0x4c36f9['id']),util[_0x0295('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x240b58(_0x2d6fe3);});}else{return _0x240b58(null,_0x1b27ff);}}}});}; \ No newline at end of file +var _0x92a0=['./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','https://accounts.zoho.in','POST','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5cf940,_0x28a7de){var _0x2535e8=function(_0xb478db){while(--_0xb478db){_0x5cf940['push'](_0x5cf940['shift']());}};_0x2535e8(++_0x28a7de);}(_0x92a0,0x10b));var _0x092a=function(_0x1977c2,_0x19446a){_0x1977c2=_0x1977c2-0x0;var _0x1f591c=_0x92a0[_0x1977c2];return _0x1f591c;};'use strict';var _=require(_0x092a('0x0'));var util=require(_0x092a('0x1'));var logger=require(_0x092a('0x2'))(_0x092a('0x3'));var moment=require('moment');var BPromise=require(_0x092a('0x4'));var rp=require(_0x092a('0x5'));var fs=require('fs');var path=require(_0x092a('0x6'));var rimraf=require(_0x092a('0x7'));var config=require(_0x092a('0x8'));var attributes=require(_0x092a('0x9'));var integrations=require(_0x092a('0xa'));module[_0x092a('0xb')]=function(_0x45890d,_0x3c80f5){return _0x45890d[_0x092a('0xc')](_0x092a('0xd'),attributes,{'tableName':_0x092a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x59e646,_0x108e5a,_0x4a2ae4){if(_0x59e646[_0x092a('0xf')](_0x092a('0x10'))||_0x59e646['changed'](_0x092a('0x11'))||_0x59e646['changed'](_0x092a('0x12'))||_0x59e646['changed'](_0x092a('0x13'))||_0x59e646[_0x092a('0xf')](_0x092a('0x14'))||_0x59e646[_0x092a('0xf')](_0x092a('0x15'))){var _0x3fd5e1,_0x455292;_0x3fd5e1=_0x59e646['serverUrl'];var _0x572ba2=_0x3fd5e1[_0x092a('0x16')](-0x1);if(_0x572ba2==='/'||_0x572ba2==='\x5c'||_0x572ba2===':'){_0x3fd5e1=_0x3fd5e1[_0x092a('0x17')](0x0,_0x3fd5e1[_0x092a('0x18')](_0x572ba2));}switch(_0x59e646[_0x092a('0x10')]){case'US':_0x455292=_0x092a('0x19');break;case'AU':_0x455292=_0x092a('0x1a');break;case'IN':_0x455292='https://accounts.zoho.in';break;case'CN':_0x455292=_0x092a('0x1b');break;default:_0x455292=_0x092a('0x1c');break;}var _0x9da015={'method':'POST','uri':_0x455292+_0x092a('0x1d'),'form':{'grant_type':_0x092a('0x1e'),'client_id':_0x59e646[_0x092a('0x12')],'client_secret':_0x59e646[_0x092a('0x13')],'redirect_uri':_0x59e646['serverUrl'],'code':_0x59e646['code']},'headers':{'Content-Type':_0x092a('0x1f')}};return rp(_0x9da015)[_0x092a('0x20')](function(_0x5f4fe0){var _0x3b269d=JSON[_0x092a('0x21')](_0x5f4fe0);if(_0x3b269d[_0x092a('0x22')]){_0x59e646[_0x092a('0x23')]=_0x3b269d[_0x092a('0x22')];logger[_0x092a('0x24')](util[_0x092a('0x25')](_0x092a('0x26'),_0x59e646['name'],_0x59e646['id']));}else{logger[_0x092a('0x27')](util[_0x092a('0x25')](_0x092a('0x28'),_0x59e646[_0x092a('0x29')],_0x59e646['id']),util[_0x092a('0x2a')](_0x3b269d,{'showHidden':![],'depth':null}));}return _0x4a2ae4(null,_0x108e5a);})[_0x092a('0x2b')](function(_0x30bfd){logger[_0x092a('0x27')](util[_0x092a('0x25')](_0x092a('0x28'),_0x59e646[_0x092a('0x29')],_0x59e646['id']),util[_0x092a('0x2a')](parsedResult,{'showHidden':![],'depth':null}));return _0x4a2ae4(_0x30bfd);});}else{return _0x4a2ae4(null,_0x108e5a);}},'beforeUpdate':function(_0x4125fc,_0x27910d,_0x555fa5){if(_0x4125fc[_0x092a('0xf')](_0x092a('0x10'))||_0x4125fc[_0x092a('0xf')](_0x092a('0x11'))||_0x4125fc[_0x092a('0xf')](_0x092a('0x12'))||_0x4125fc['changed'](_0x092a('0x13'))||_0x4125fc[_0x092a('0xf')](_0x092a('0x14'))||_0x4125fc[_0x092a('0xf')](_0x092a('0x15'))){var _0x583fab,_0x1f0f4b;_0x583fab=_0x4125fc[_0x092a('0x11')];var _0x319039=_0x583fab['slice'](-0x1);if(_0x319039==='/'||_0x319039==='\x5c'||_0x319039===':'){_0x583fab=_0x583fab['substring'](0x0,_0x583fab[_0x092a('0x18')](_0x319039));}switch(_0x4125fc[_0x092a('0x10')]){case'US':_0x1f0f4b='https://accounts.zoho.com';break;case'AU':_0x1f0f4b=_0x092a('0x1a');break;case'IN':_0x1f0f4b=_0x092a('0x2c');break;case'CN':_0x1f0f4b=_0x092a('0x1b');break;default:_0x1f0f4b=_0x092a('0x1c');break;}var _0x5793d8={'method':_0x092a('0x2d'),'uri':_0x1f0f4b+_0x092a('0x1d'),'form':{'grant_type':'authorization_code','client_id':_0x4125fc[_0x092a('0x12')],'client_secret':_0x4125fc[_0x092a('0x13')],'redirect_uri':_0x4125fc[_0x092a('0x11')],'code':_0x4125fc[_0x092a('0x14')]},'headers':{'Content-Type':_0x092a('0x1f')}};return rp(_0x5793d8)[_0x092a('0x20')](function(_0x1d4ced){var _0xedfa8=JSON[_0x092a('0x21')](_0x1d4ced);if(_0xedfa8[_0x092a('0x22')]){_0x4125fc[_0x092a('0x23')]=_0xedfa8[_0x092a('0x22')];logger[_0x092a('0x24')](util['format'](_0x092a('0x26'),_0x4125fc[_0x092a('0x29')],_0x4125fc['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4125fc[_0x092a('0x29')],_0x4125fc['id']),util[_0x092a('0x2a')](_0xedfa8,{'showHidden':![],'depth':null}));}return _0x555fa5(null,_0x27910d);})['catch'](function(_0x2e5362){logger[_0x092a('0x27')](util['format'](_0x092a('0x28'),_0x4125fc['name'],_0x4125fc['id']),util[_0x092a('0x2a')](parsedResult,{'showHidden':![],'depth':null}));return _0x555fa5(_0x2e5362);});}else{return _0x555fa5(null,_0x27910d);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 71531ba..bd84129 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 _0xcdd2=['jayson/promise','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','include','map','model','attributes','find','ShowZohoAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2673a4,_0x4d0b8d){var _0x5e3a6a=function(_0x59e268){while(--_0x59e268){_0x2673a4['push'](_0x2673a4['shift']());}};_0x5e3a6a(++_0x4d0b8d);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var moment=require(_0x2cdd('0x2'));var BPromise=require(_0x2cdd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2cdd('0x4'));var db=require(_0x2cdd('0x5'))['db'];var utils=require(_0x2cdd('0x6'));var logger=require(_0x2cdd('0x7'))('rpc');var config=require(_0x2cdd('0x8'));var jayson=require(_0x2cdd('0x9'));var client=jayson['client'][_0x2cdd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36f9ad,_0x2647e6,_0x2ff8e0){return new BPromise(function(_0x506b09,_0x569943){return client['request'](_0x36f9ad,_0x2ff8e0)[_0x2cdd('0xb')](function(_0x4cd731){logger[_0x2cdd('0xc')](_0x2cdd('0xd'),_0x2647e6,_0x2cdd('0xe'));logger[_0x2cdd('0xf')](_0x2cdd('0x10'),_0x2647e6,_0x2cdd('0xe'),JSON[_0x2cdd('0x11')](_0x4cd731));if(_0x4cd731[_0x2cdd('0x12')]){if(_0x4cd731[_0x2cdd('0x12')][_0x2cdd('0x13')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x2647e6,_0x4cd731[_0x2cdd('0x12')][_0x2cdd('0x14')]);return _0x569943(_0x4cd731['error'][_0x2cdd('0x14')]);}logger[_0x2cdd('0x12')](_0x2cdd('0xd'),_0x2647e6,_0x4cd731[_0x2cdd('0x12')][_0x2cdd('0x14')]);return _0x506b09(_0x4cd731['error'][_0x2cdd('0x14')]);}else{logger[_0x2cdd('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x2647e6,_0x2cdd('0xe'));_0x506b09(_0x4cd731[_0x2cdd('0x15')][_0x2cdd('0x14')]);}})[_0x2cdd('0x16')](function(_0x3af7c8){logger[_0x2cdd('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x2647e6,_0x3af7c8);_0x569943(_0x3af7c8);});});}exports[_0x2cdd('0x17')]=function(_0x9491c8){var _0x281101=this;return new Promise(function(_0x23eb4e,_0x57fcb8){return db[_0x2cdd('0x18')][_0x2cdd('0x19')]({'raw':_0x9491c8[_0x2cdd('0x1a')]?_0x9491c8[_0x2cdd('0x1a')][_0x2cdd('0x1b')]===undefined?!![]:![]:!![],'where':_0x9491c8[_0x2cdd('0x1a')]?_0x9491c8[_0x2cdd('0x1a')][_0x2cdd('0x1c')]||null:null,'attributes':_0x9491c8[_0x2cdd('0x1a')]?_0x9491c8[_0x2cdd('0x1a')]['attributes']||null:null,'limit':_0x9491c8['options']?_0x9491c8[_0x2cdd('0x1a')]['limit']||null:null,'include':_0x9491c8['options']?_0x9491c8[_0x2cdd('0x1a')][_0x2cdd('0x1d')]?_[_0x2cdd('0x1e')](_0x9491c8[_0x2cdd('0x1a')]['include'],function(_0x5a7b76){return{'model':db[_0x5a7b76[_0x2cdd('0x1f')]],'as':_0x5a7b76['as'],'attributes':_0x5a7b76[_0x2cdd('0x20')],'include':_0x5a7b76[_0x2cdd('0x1d')]?_[_0x2cdd('0x1e')](_0x5a7b76[_0x2cdd('0x1d')],function(_0xdd4650){return{'model':db[_0xdd4650[_0x2cdd('0x1f')]],'as':_0xdd4650['as'],'attributes':_0xdd4650['attributes'],'include':_0xdd4650[_0x2cdd('0x1d')]?_[_0x2cdd('0x1e')](_0xdd4650[_0x2cdd('0x1d')],function(_0x5a8eff){return{'model':db[_0x5a8eff['model']],'as':_0x5a8eff['as'],'attributes':_0x5a8eff['attributes']};}):[]};}):[]};}):[]:[]})[_0x2cdd('0xb')](function(_0xcf73db){logger['info'](_0x2cdd('0x17'),_0x9491c8);logger[_0x2cdd('0xf')](_0x2cdd('0x17'),_0x9491c8,JSON[_0x2cdd('0x11')](_0xcf73db));_0x23eb4e(_0xcf73db);})[_0x2cdd('0x16')](function(_0x33117f){logger['error'](_0x2cdd('0x17'),_0x33117f[_0x2cdd('0x14')],_0x9491c8);_0x57fcb8(_0x281101[_0x2cdd('0x12')](0x1f4,_0x33117f[_0x2cdd('0x14')]));});});};exports['ShowZohoAccount']=function(_0x447051){var _0x1ab62e=this;return new Promise(function(_0x4b5916,_0x1ca10a){return db[_0x2cdd('0x18')][_0x2cdd('0x21')]({'raw':_0x447051[_0x2cdd('0x1a')]?_0x447051[_0x2cdd('0x1a')][_0x2cdd('0x1b')]===undefined?!![]:![]:!![],'where':_0x447051[_0x2cdd('0x1a')]?_0x447051[_0x2cdd('0x1a')][_0x2cdd('0x1c')]||null:null,'attributes':_0x447051['options']?_0x447051[_0x2cdd('0x1a')][_0x2cdd('0x20')]||null:null,'include':_0x447051[_0x2cdd('0x1a')]?_0x447051['options']['include']?_['map'](_0x447051[_0x2cdd('0x1a')][_0x2cdd('0x1d')],function(_0x5379ce){return{'model':db[_0x5379ce[_0x2cdd('0x1f')]],'as':_0x5379ce['as'],'attributes':_0x5379ce[_0x2cdd('0x20')],'include':_0x5379ce[_0x2cdd('0x1d')]?_[_0x2cdd('0x1e')](_0x5379ce[_0x2cdd('0x1d')],function(_0x5a10b7){return{'model':db[_0x5a10b7['model']],'as':_0x5a10b7['as'],'attributes':_0x5a10b7[_0x2cdd('0x20')],'include':_0x5a10b7[_0x2cdd('0x1d')]?_[_0x2cdd('0x1e')](_0x5a10b7[_0x2cdd('0x1d')],function(_0x41156e){return{'model':db[_0x41156e['model']],'as':_0x41156e['as'],'attributes':_0x41156e[_0x2cdd('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2cdd('0xb')](function(_0x3bfc78){logger[_0x2cdd('0xc')](_0x2cdd('0x22'),_0x447051);logger[_0x2cdd('0xf')](_0x2cdd('0x22'),_0x447051,JSON['stringify'](_0x3bfc78));_0x4b5916(_0x3bfc78);})[_0x2cdd('0x16')](function(_0x3d3421){logger[_0x2cdd('0x12')](_0x2cdd('0x22'),_0x3d3421[_0x2cdd('0x14')],_0x447051);_0x1ca10a(_0x1ab62e[_0x2cdd('0x12')](0x1f4,_0x3d3421[_0x2cdd('0x14')]));});});}; \ No newline at end of file +var _0x4016=['catch','GetZohoAccount','findAll','options','raw','where','attributes','include','map','model','debug','stringify','ShowZohoAccount','ZohoAccount','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x1f3135,_0x2c5097){var _0x48f9a1=function(_0x36f5b3){while(--_0x36f5b3){_0x1f3135['push'](_0x1f3135['shift']());}};_0x48f9a1(++_0x2c5097);}(_0x4016,0x1a2));var _0x6401=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4016[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x6401('0x0'));var moment=require(_0x6401('0x1'));var BPromise=require(_0x6401('0x2'));var rs=require(_0x6401('0x3'));var fs=require('fs');var Redis=require(_0x6401('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6401('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6401('0x6'));var client=jayson['client'][_0x6401('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x20f62a,_0x2fbe74,_0x51fd86){return new BPromise(function(_0x5f4179,_0x2f7051){return client[_0x6401('0x8')](_0x20f62a,_0x51fd86)[_0x6401('0x9')](function(_0x54e537){logger[_0x6401('0xa')](_0x6401('0xb'),_0x2fbe74,_0x6401('0xc'));logger['debug'](_0x6401('0xd'),_0x2fbe74,'request\x20sent',JSON['stringify'](_0x54e537));if(_0x54e537['error']){if(_0x54e537['error']['code']===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x2fbe74,_0x54e537[_0x6401('0xe')][_0x6401('0xf')]);return _0x2f7051(_0x54e537[_0x6401('0xe')][_0x6401('0xf')]);}logger[_0x6401('0xe')](_0x6401('0xb'),_0x2fbe74,_0x54e537[_0x6401('0xe')][_0x6401('0xf')]);return _0x5f4179(_0x54e537['error'][_0x6401('0xf')]);}else{logger[_0x6401('0xa')](_0x6401('0xb'),_0x2fbe74,_0x6401('0xc'));_0x5f4179(_0x54e537['result'][_0x6401('0xf')]);}})[_0x6401('0x10')](function(_0x5b2039){logger[_0x6401('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x2fbe74,_0x5b2039);_0x2f7051(_0x5b2039);});});}exports[_0x6401('0x11')]=function(_0x58466a){var _0x5826c5=this;return new Promise(function(_0x16a7a6,_0x14f551){return db['ZohoAccount'][_0x6401('0x12')]({'raw':_0x58466a[_0x6401('0x13')]?_0x58466a[_0x6401('0x13')][_0x6401('0x14')]===undefined?!![]:![]:!![],'where':_0x58466a['options']?_0x58466a[_0x6401('0x13')][_0x6401('0x15')]||null:null,'attributes':_0x58466a[_0x6401('0x13')]?_0x58466a[_0x6401('0x13')][_0x6401('0x16')]||null:null,'limit':_0x58466a[_0x6401('0x13')]?_0x58466a[_0x6401('0x13')]['limit']||null:null,'include':_0x58466a[_0x6401('0x13')]?_0x58466a[_0x6401('0x13')][_0x6401('0x17')]?_[_0x6401('0x18')](_0x58466a[_0x6401('0x13')][_0x6401('0x17')],function(_0x1e58cd){return{'model':db[_0x1e58cd[_0x6401('0x19')]],'as':_0x1e58cd['as'],'attributes':_0x1e58cd[_0x6401('0x16')],'include':_0x1e58cd[_0x6401('0x17')]?_['map'](_0x1e58cd[_0x6401('0x17')],function(_0x462771){return{'model':db[_0x462771[_0x6401('0x19')]],'as':_0x462771['as'],'attributes':_0x462771[_0x6401('0x16')],'include':_0x462771[_0x6401('0x17')]?_[_0x6401('0x18')](_0x462771[_0x6401('0x17')],function(_0x261640){return{'model':db[_0x261640[_0x6401('0x19')]],'as':_0x261640['as'],'attributes':_0x261640[_0x6401('0x16')]};}):[]};}):[]};}):[]:[]})[_0x6401('0x9')](function(_0x1655dc){logger[_0x6401('0xa')](_0x6401('0x11'),_0x58466a);logger[_0x6401('0x1a')]('GetZohoAccount',_0x58466a,JSON[_0x6401('0x1b')](_0x1655dc));_0x16a7a6(_0x1655dc);})[_0x6401('0x10')](function(_0x66419d){logger[_0x6401('0xe')]('GetZohoAccount',_0x66419d[_0x6401('0xf')],_0x58466a);_0x14f551(_0x5826c5['error'](0x1f4,_0x66419d[_0x6401('0xf')]));});});};exports[_0x6401('0x1c')]=function(_0x190894){var _0x553254=this;return new Promise(function(_0xc8911f,_0x3cf07f){return db[_0x6401('0x1d')][_0x6401('0x1e')]({'raw':_0x190894['options']?_0x190894[_0x6401('0x13')][_0x6401('0x14')]===undefined?!![]:![]:!![],'where':_0x190894['options']?_0x190894[_0x6401('0x13')][_0x6401('0x15')]||null:null,'attributes':_0x190894['options']?_0x190894[_0x6401('0x13')][_0x6401('0x16')]||null:null,'include':_0x190894[_0x6401('0x13')]?_0x190894[_0x6401('0x13')][_0x6401('0x17')]?_[_0x6401('0x18')](_0x190894['options'][_0x6401('0x17')],function(_0x5501d9){return{'model':db[_0x5501d9['model']],'as':_0x5501d9['as'],'attributes':_0x5501d9[_0x6401('0x16')],'include':_0x5501d9[_0x6401('0x17')]?_[_0x6401('0x18')](_0x5501d9[_0x6401('0x17')],function(_0x5743e8){return{'model':db[_0x5743e8['model']],'as':_0x5743e8['as'],'attributes':_0x5743e8[_0x6401('0x16')],'include':_0x5743e8['include']?_[_0x6401('0x18')](_0x5743e8['include'],function(_0x1aff5e){return{'model':db[_0x1aff5e[_0x6401('0x19')]],'as':_0x1aff5e['as'],'attributes':_0x1aff5e['attributes']};}):[]};}):[]};}):[]:[]})[_0x6401('0x9')](function(_0x2e98bb){logger['info'](_0x6401('0x1c'),_0x190894);logger[_0x6401('0x1a')](_0x6401('0x1c'),_0x190894,JSON[_0x6401('0x1b')](_0x2e98bb));_0xc8911f(_0x2e98bb);})['catch'](function(_0xd4a1e3){logger['error'](_0x6401('0x1c'),_0xd4a1e3[_0x6401('0xf')],_0x190894);_0x3cf07f(_0x553254[_0x6401('0xe')](0x1f4,_0xd4a1e3['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 1685d21..0f7ed19 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 _0x324f=['getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','multer','util','path','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields'];(function(_0x1163c3,_0x3aedc6){var _0x7a7cb5=function(_0x2e4054){while(--_0x2e4054){_0x1163c3['push'](_0x1163c3['shift']());}};_0x7a7cb5(++_0x3aedc6);}(_0x324f,0x94));var _0xf324=function(_0x1890d5,_0x227b75){_0x1890d5=_0x1890d5-0x0;var _0x2eba05=_0x324f[_0x1890d5];return _0x2eba05;};'use strict';var multer=require(_0xf324('0x0'));var util=require(_0xf324('0x1'));var path=require(_0xf324('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf324('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf324('0x4'));var config=require(_0xf324('0x5'));var controller=require('./intZohoConfiguration.controller');router[_0xf324('0x6')]('/',auth[_0xf324('0x7')](),controller['index']);router[_0xf324('0x6')](_0xf324('0x8'),auth[_0xf324('0x7')](),controller[_0xf324('0x9')]);router[_0xf324('0x6')](_0xf324('0xa'),auth[_0xf324('0x7')](),controller[_0xf324('0xb')]);router[_0xf324('0x6')]('/:id/subjects',auth[_0xf324('0x7')](),controller[_0xf324('0xc')]);router[_0xf324('0x6')](_0xf324('0xd'),auth['isAuthenticated'](),controller[_0xf324('0xe')]);router[_0xf324('0xf')]('/',auth[_0xf324('0x7')](),controller[_0xf324('0x10')]);router[_0xf324('0x11')](_0xf324('0x8'),auth[_0xf324('0x7')](),controller[_0xf324('0x12')]);router[_0xf324('0x13')](_0xf324('0x8'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1707=['post','delete','destroy','exports','multer','express','Router','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions'];(function(_0x561d81,_0x41f03f){var _0x51e09e=function(_0x59c554){while(--_0x59c554){_0x561d81['push'](_0x561d81['shift']());}};_0x51e09e(++_0x41f03f);}(_0x1707,0x1df));var _0x7170=function(_0x49b036,_0x2941e9){_0x49b036=_0x49b036-0x0;var _0x4953bb=_0x1707[_0x49b036];return _0x4953bb;};'use strict';var multer=require(_0x7170('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7170('0x1'));var router=express[_0x7170('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x7170('0x3'));var config=require(_0x7170('0x4'));var controller=require(_0x7170('0x5'));router[_0x7170('0x6')]('/',auth[_0x7170('0x7')](),controller[_0x7170('0x8')]);router[_0x7170('0x6')](_0x7170('0x9'),auth[_0x7170('0x7')](),controller[_0x7170('0xa')]);router[_0x7170('0x6')](_0x7170('0xb'),auth[_0x7170('0x7')](),controller[_0x7170('0xc')]);router[_0x7170('0x6')](_0x7170('0xd'),auth[_0x7170('0x7')](),controller['getSubjects']);router[_0x7170('0x6')]('/:id/descriptions',auth[_0x7170('0x7')](),controller[_0x7170('0xe')]);router[_0x7170('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x7170('0x9'),auth[_0x7170('0x7')](),controller['update']);router[_0x7170('0x10')](_0x7170('0x9'),auth[_0x7170('0x7')](),controller[_0x7170('0x11')]);module[_0x7170('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 87e389d..31800c4 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 _0xf3fd=['sequelize','exports','STRING','ENUM','lead','contact','contact_lead'];(function(_0x20c4d4,_0x589a28){var _0x4e1ba8=function(_0xbaff3d){while(--_0xbaff3d){_0x20c4d4['push'](_0x20c4d4['shift']());}};_0x4e1ba8(++_0x589a28);}(_0xf3fd,0x18f));var _0xdf3f=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xf3fd[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xdf3f('0x0'));module[_0xdf3f('0x1')]={'name':{'type':Sequelize[_0xdf3f('0x2')]},'moduleCreate':{'type':Sequelize[_0xdf3f('0x3')](_0xdf3f('0x4'),_0xdf3f('0x5'),'nothing'),'defaultValue':_0xdf3f('0x4')},'moduleSearch':{'type':Sequelize[_0xdf3f('0x3')](_0xdf3f('0x6'),_0xdf3f('0x5'),'lead'),'defaultValue':_0xdf3f('0x6')},'description':{'type':Sequelize[_0xdf3f('0x2')]}}; \ No newline at end of file +var _0x88cc=['ENUM','lead','contact','nothing','contact_lead','STRING','exports'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0x88cc,0x7d));var _0xc88c=function(_0x1034bb,_0x4e20b3){_0x1034bb=_0x1034bb-0x0;var _0x453fdb=_0x88cc[_0x1034bb];return _0x453fdb;};'use strict';var Sequelize=require('sequelize');module[_0xc88c('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xc88c('0x1')](_0xc88c('0x2'),_0xc88c('0x3'),_0xc88c('0x4')),'defaultValue':_0xc88c('0x2')},'moduleSearch':{'type':Sequelize[_0xc88c('0x1')](_0xc88c('0x5'),_0xc88c('0x3'),'lead'),'defaultValue':_0xc88c('0x5')},'description':{'type':Sequelize[_0xc88c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 1d2359c..d5938d2 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 _0xa9e0=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZohoConfiguration','count','includeAll','include','findAll','rows','params','intersection','find','body','findOne','ZohoField','order','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model'];(function(_0x350182,_0x2a9feb){var _0x4a0892=function(_0x2c994d){while(--_0x2c994d){_0x350182['push'](_0x350182['shift']());}};_0x4a0892(++_0x2a9feb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['ZohoConfiguration'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x50')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x48')]['create'](_0x39d77d[_0x0a9e('0x51')],{})[_0x0a9e('0x2f')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x51')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x48')][_0x0a9e('0x50')]({'where':{'id':_0x2ef381[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x2f')](saveUpdates(_0x2ef381[_0x0a9e('0x51')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x2f')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getFields']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3b')]=_['intersection'](_0x65432[_0x0a9e('0x3c')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3d')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3d')]=_0x2f7092[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2f7092[_0x0a9e('0x3d')]:_0x65432[_0x0a9e('0x3c')];_0x2f7092[_0x0a9e('0x54')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3b')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2f7092[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x22')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x56')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9={};var _0x5150a4={};var _0x1b0b98;var _0x295763;return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x320898[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x412a72,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x1b0b98=_0x83f0b2;_0x5150a4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x5150a4['query']=_['keys'](_0x320898['query']);_0x5150a4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],_0x5150a4[_0x0a9e('0x39')]);_0x4257c9[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x320898['query'][_0x0a9e('0x3e')]));_0x4257c9[_0x0a9e('0x3d')]=_0x4257c9[_0x0a9e('0x3d')]['length']?_0x4257c9[_0x0a9e('0x3d')]:_0x5150a4['model'];_0x4257c9[_0x0a9e('0x54')]=qs[_0x0a9e('0x42')](_0x320898['query'][_0x0a9e('0x42')]);_0x4257c9[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x320898['query'],_0x5150a4[_0x0a9e('0x3b')]));if(_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x4257c9[_0x0a9e('0x43')]=_['merge'](_0x4257c9[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x4257c9[_0x0a9e('0x3d')],function(_0x361b21){var _0x4abc8f={};_0x4abc8f[_0x361b21]={'$like':'%'+_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x4abc8f;})});}_0x4257c9=_[_0x0a9e('0x46')]({},_0x4257c9,_0x320898[_0x0a9e('0x47')]);return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x40fc56){if(_0x40fc56){_0x295763=_0x40fc56[_0x0a9e('0x3f')];if(!_0x320898[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x4257c9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x320898[_0x0a9e('0x39')]['limit']);_0x4257c9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x320898[_0x0a9e('0x39')]['offset']);}return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x8cea96){if(_0x8cea96){return _0x8cea96?{'count':_0x295763,'rows':_0x8cea96}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x412a72,null))['catch'](handleError(_0x412a72,null));};exports['getDescriptions']=function(_0x7ebea8,_0x2bbdb5,_0x4c54fa){var _0x45108c={};var _0x53a6a1={};var _0x260f4b;var _0x8ebf02;return db['ZohoConfiguration'][_0x0a9e('0x52')]({'where':{'id':_0x7ebea8[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x2f')](function(_0x3755fe){if(_0x3755fe){_0x260f4b=_0x3755fe;_0x53a6a1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db['ZohoField'][_0x0a9e('0x36')]);_0x53a6a1[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7ebea8[_0x0a9e('0x39')]);_0x53a6a1['filters']=_[_0x0a9e('0x4f')](_0x53a6a1[_0x0a9e('0x3c')],_0x53a6a1['query']);_0x45108c[_0x0a9e('0x3d')]=_['intersection'](_0x53a6a1[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x45108c['attributes']=_0x45108c['attributes'][_0x0a9e('0x3f')]?_0x45108c[_0x0a9e('0x3d')]:_0x53a6a1[_0x0a9e('0x3c')];_0x45108c['order']=qs[_0x0a9e('0x42')](_0x7ebea8[_0x0a9e('0x39')]['sort']);_0x45108c['where']=qs[_0x0a9e('0x3b')](_['pick'](_0x7ebea8['query'],_0x53a6a1['filters']));if(_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x45108c[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x45108c[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x45108c['attributes'],function(_0x5fd5db){var _0x5955f1={};_0x5955f1[_0x5fd5db]={'$like':'%'+_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x5955f1;})});}_0x45108c=_[_0x0a9e('0x46')]({},_0x45108c,_0x7ebea8[_0x0a9e('0x47')]);return _0x260f4b['getDescriptions'](_0x45108c);}})[_0x0a9e('0x2f')](function(_0x32f761){if(_0x32f761){_0x8ebf02=_0x32f761[_0x0a9e('0x3f')];if(!_0x7ebea8['query'][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x45108c[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x45108c[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x7ebea8['query'][_0x0a9e('0x27')]);}return _0x260f4b[_0x0a9e('0x57')](_0x45108c);}})['then'](function(_0x40e0f0){if(_0x40e0f0){return _0x40e0f0?{'count':_0x8ebf02,'rows':_0x40e0f0}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2bbdb5,null))[_0x0a9e('0x22')](handleError(_0x2bbdb5,null));}; \ No newline at end of file +var _0xa9e0=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZohoConfiguration','count','includeAll','include','findAll','rows','params','intersection','find','body','findOne','ZohoField','order','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model'];(function(_0x56c70f,_0x4e4493){var _0x3812ed=function(_0x25460f){while(--_0x25460f){_0x56c70f['push'](_0x56c70f['shift']());}};_0x3812ed(++_0x4e4493);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['ZohoConfiguration'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x50')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x48')]['create'](_0x39d77d[_0x0a9e('0x51')],{})[_0x0a9e('0x2f')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x51')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x48')][_0x0a9e('0x50')]({'where':{'id':_0x2ef381[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x2f')](saveUpdates(_0x2ef381[_0x0a9e('0x51')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x2f')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getFields']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3b')]=_['intersection'](_0x65432[_0x0a9e('0x3c')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3d')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3d')]=_0x2f7092[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2f7092[_0x0a9e('0x3d')]:_0x65432[_0x0a9e('0x3c')];_0x2f7092[_0x0a9e('0x54')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3b')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2f7092[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x22')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x56')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9={};var _0x5150a4={};var _0x1b0b98;var _0x295763;return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x320898[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x412a72,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x1b0b98=_0x83f0b2;_0x5150a4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x5150a4['query']=_['keys'](_0x320898['query']);_0x5150a4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],_0x5150a4[_0x0a9e('0x39')]);_0x4257c9[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x320898['query'][_0x0a9e('0x3e')]));_0x4257c9[_0x0a9e('0x3d')]=_0x4257c9[_0x0a9e('0x3d')]['length']?_0x4257c9[_0x0a9e('0x3d')]:_0x5150a4['model'];_0x4257c9[_0x0a9e('0x54')]=qs[_0x0a9e('0x42')](_0x320898['query'][_0x0a9e('0x42')]);_0x4257c9[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x320898['query'],_0x5150a4[_0x0a9e('0x3b')]));if(_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x4257c9[_0x0a9e('0x43')]=_['merge'](_0x4257c9[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x4257c9[_0x0a9e('0x3d')],function(_0x361b21){var _0x4abc8f={};_0x4abc8f[_0x361b21]={'$like':'%'+_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x4abc8f;})});}_0x4257c9=_[_0x0a9e('0x46')]({},_0x4257c9,_0x320898[_0x0a9e('0x47')]);return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x40fc56){if(_0x40fc56){_0x295763=_0x40fc56[_0x0a9e('0x3f')];if(!_0x320898[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x4257c9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x320898[_0x0a9e('0x39')]['limit']);_0x4257c9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x320898[_0x0a9e('0x39')]['offset']);}return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x8cea96){if(_0x8cea96){return _0x8cea96?{'count':_0x295763,'rows':_0x8cea96}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x412a72,null))['catch'](handleError(_0x412a72,null));};exports['getDescriptions']=function(_0x7ebea8,_0x2bbdb5,_0x4c54fa){var _0x45108c={};var _0x53a6a1={};var _0x260f4b;var _0x8ebf02;return db['ZohoConfiguration'][_0x0a9e('0x52')]({'where':{'id':_0x7ebea8[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x2f')](function(_0x3755fe){if(_0x3755fe){_0x260f4b=_0x3755fe;_0x53a6a1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db['ZohoField'][_0x0a9e('0x36')]);_0x53a6a1[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7ebea8[_0x0a9e('0x39')]);_0x53a6a1['filters']=_[_0x0a9e('0x4f')](_0x53a6a1[_0x0a9e('0x3c')],_0x53a6a1['query']);_0x45108c[_0x0a9e('0x3d')]=_['intersection'](_0x53a6a1[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x45108c['attributes']=_0x45108c['attributes'][_0x0a9e('0x3f')]?_0x45108c[_0x0a9e('0x3d')]:_0x53a6a1[_0x0a9e('0x3c')];_0x45108c['order']=qs[_0x0a9e('0x42')](_0x7ebea8[_0x0a9e('0x39')]['sort']);_0x45108c['where']=qs[_0x0a9e('0x3b')](_['pick'](_0x7ebea8['query'],_0x53a6a1['filters']));if(_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x45108c[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x45108c[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x45108c['attributes'],function(_0x5fd5db){var _0x5955f1={};_0x5955f1[_0x5fd5db]={'$like':'%'+_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x5955f1;})});}_0x45108c=_[_0x0a9e('0x46')]({},_0x45108c,_0x7ebea8[_0x0a9e('0x47')]);return _0x260f4b['getDescriptions'](_0x45108c);}})[_0x0a9e('0x2f')](function(_0x32f761){if(_0x32f761){_0x8ebf02=_0x32f761[_0x0a9e('0x3f')];if(!_0x7ebea8['query'][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x45108c[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x45108c[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x7ebea8['query'][_0x0a9e('0x27')]);}return _0x260f4b[_0x0a9e('0x57')](_0x45108c);}})['then'](function(_0x40e0f0){if(_0x40e0f0){return _0x40e0f0?{'count':_0x8ebf02,'rows':_0x40e0f0}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2bbdb5,null))[_0x0a9e('0x22')](handleError(_0x2bbdb5,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 0c3636e..ab9e266 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 _0x7e9a=['ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoConfiguration.attributes','exports','define'];(function(_0x415d26,_0x282ce1){var _0x2987fd=function(_0x27f719){while(--_0x27f719){_0x415d26['push'](_0x415d26['shift']());}};_0x2987fd(++_0x282ce1);}(_0x7e9a,0x1de));var _0xa7e9=function(_0x175219,_0x23ec66){_0x175219=_0x175219-0x0;var _0x416369=_0x7e9a[_0x175219];return _0x416369;};'use strict';var _=require(_0xa7e9('0x0'));var util=require(_0xa7e9('0x1'));var logger=require(_0xa7e9('0x2'))(_0xa7e9('0x3'));var moment=require(_0xa7e9('0x4'));var BPromise=require(_0xa7e9('0x5'));var rp=require(_0xa7e9('0x6'));var fs=require('fs');var path=require(_0xa7e9('0x7'));var rimraf=require(_0xa7e9('0x8'));var config=require('../../config/environment');var attributes=require(_0xa7e9('0x9'));module[_0xa7e9('0xa')]=function(_0x32ec5a,_0x4ba60d){return _0x32ec5a[_0xa7e9('0xb')](_0xa7e9('0xc'),attributes,{'tableName':_0xa7e9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe12=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','util','../../config/logger'];(function(_0x42f154,_0x32110c){var _0x471993=function(_0x29154a){while(--_0x29154a){_0x42f154['push'](_0x42f154['shift']());}};_0x471993(++_0x32110c);}(_0xfe12,0x66));var _0x2fe1=function(_0x47d56f,_0x4115dc){_0x47d56f=_0x47d56f-0x0;var _0x4c66a1=_0xfe12[_0x47d56f];return _0x4c66a1;};'use strict';var _=require('lodash');var util=require(_0x2fe1('0x0'));var logger=require(_0x2fe1('0x1'))('api');var moment=require(_0x2fe1('0x2'));var BPromise=require(_0x2fe1('0x3'));var rp=require(_0x2fe1('0x4'));var fs=require('fs');var path=require(_0x2fe1('0x5'));var rimraf=require(_0x2fe1('0x6'));var config=require(_0x2fe1('0x7'));var attributes=require(_0x2fe1('0x8'));module[_0x2fe1('0x9')]=function(_0x2b486c,_0x5ec7c2){return _0x2b486c[_0x2fe1('0xa')](_0x2fe1('0xb'),attributes,{'tableName':_0x2fe1('0xc'),'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 59e243e..f36254e 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 _0x3f61=['debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZohoConfiguration,\x20%s,\x20%s','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent'];(function(_0x13945b,_0x289c94){var _0x1b1643=function(_0x18f4c3){while(--_0x18f4c3){_0x13945b['push'](_0x13945b['shift']());}};_0x1b1643(++_0x289c94);}(_0x3f61,0x1eb));var _0x13f6=function(_0x5e0617,_0x47acc6){_0x5e0617=_0x5e0617-0x0;var _0x3e1d59=_0x3f61[_0x5e0617];return _0x3e1d59;};'use strict';var _=require(_0x13f6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x13f6('0x1'));var rs=require(_0x13f6('0x2'));var fs=require('fs');var Redis=require(_0x13f6('0x3'));var db=require(_0x13f6('0x4'))['db'];var utils=require(_0x13f6('0x5'));var logger=require('../../config/logger')(_0x13f6('0x6'));var config=require(_0x13f6('0x7'));var jayson=require(_0x13f6('0x8'));var client=jayson['client'][_0x13f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c40d0,_0x321492,_0x2f15e9){return new BPromise(function(_0x29c187,_0x4eaf54){return client[_0x13f6('0xa')](_0x3c40d0,_0x2f15e9)['then'](function(_0x31b23e){logger[_0x13f6('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x321492,_0x13f6('0xc'));logger[_0x13f6('0xd')](_0x13f6('0xe'),_0x321492,_0x13f6('0xc'),JSON[_0x13f6('0xf')](_0x31b23e));if(_0x31b23e[_0x13f6('0x10')]){if(_0x31b23e[_0x13f6('0x10')][_0x13f6('0x11')]===0x1f4){logger[_0x13f6('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x321492,_0x31b23e['error'][_0x13f6('0x12')]);return _0x4eaf54(_0x31b23e['error'][_0x13f6('0x12')]);}logger['error'](_0x13f6('0x13'),_0x321492,_0x31b23e[_0x13f6('0x10')][_0x13f6('0x12')]);return _0x29c187(_0x31b23e['error'][_0x13f6('0x12')]);}else{logger['info'](_0x13f6('0x13'),_0x321492,_0x13f6('0xc'));_0x29c187(_0x31b23e['result'][_0x13f6('0x12')]);}})[_0x13f6('0x14')](function(_0x328e51){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x321492,_0x328e51);_0x4eaf54(_0x328e51);});});} \ No newline at end of file +var _0xa9a4=['rpc','../../config/environment','jayson/promise','client','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9a4,0x14a));var _0x4a9a=function(_0x513357,_0x3d0ecf){_0x513357=_0x513357-0x0;var _0x375256=_0xa9a4[_0x513357];return _0x375256;};'use strict';var _=require(_0x4a9a('0x0'));var util=require(_0x4a9a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4a9a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a9a('0x3'))['db'];var utils=require(_0x4a9a('0x4'));var logger=require(_0x4a9a('0x5'))(_0x4a9a('0x6'));var config=require(_0x4a9a('0x7'));var jayson=require(_0x4a9a('0x8'));var client=jayson[_0x4a9a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3665b6,_0x5bc3a4,_0x2f5cc5){return new BPromise(function(_0x2995c1,_0x4207a4){return client['request'](_0x3665b6,_0x2f5cc5)[_0x4a9a('0xa')](function(_0x208bc0){logger[_0x4a9a('0xb')](_0x4a9a('0xc'),_0x5bc3a4,'request\x20sent');logger[_0x4a9a('0xd')](_0x4a9a('0xe'),_0x5bc3a4,_0x4a9a('0xf'),JSON[_0x4a9a('0x10')](_0x208bc0));if(_0x208bc0['error']){if(_0x208bc0[_0x4a9a('0x11')][_0x4a9a('0x12')]===0x1f4){logger[_0x4a9a('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x5bc3a4,_0x208bc0[_0x4a9a('0x11')]['message']);return _0x4207a4(_0x208bc0[_0x4a9a('0x11')]['message']);}logger[_0x4a9a('0x11')](_0x4a9a('0xc'),_0x5bc3a4,_0x208bc0[_0x4a9a('0x11')][_0x4a9a('0x13')]);return _0x2995c1(_0x208bc0['error'][_0x4a9a('0x13')]);}else{logger[_0x4a9a('0xb')](_0x4a9a('0xc'),_0x5bc3a4,_0x4a9a('0xf'));_0x2995c1(_0x208bc0[_0x4a9a('0x14')]['message']);}})['catch'](function(_0x1cc5f1){logger[_0x4a9a('0x11')](_0x4a9a('0xc'),_0x5bc3a4,_0x1cc5f1);_0x4207a4(_0x1cc5f1);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 47933af..09631fc 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 _0xfcbb=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','index','get','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer'];(function(_0x286f2b,_0x171c07){var _0x33d6f4=function(_0x4ee289){while(--_0x4ee289){_0x286f2b['push'](_0x286f2b['shift']());}};_0x33d6f4(++_0x171c07);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x561863,_0x37b3f6){_0x561863=_0x561863-0x0;var _0x4f8f22=_0xfcbb[_0x561863];return _0x4f8f22;};'use strict';var multer=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var path=require(_0xbfcb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbfcb('0x3')]();var auth=require(_0xbfcb('0x4'));var interaction=require(_0xbfcb('0x5'));var config=require(_0xbfcb('0x6'));var controller=require(_0xbfcb('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xbfcb('0x8')]);router[_0xbfcb('0x9')](_0xbfcb('0xa'),auth[_0xbfcb('0xb')](),controller[_0xbfcb('0xc')]);router[_0xbfcb('0xd')]('/',auth[_0xbfcb('0xb')](),controller['create']);router[_0xbfcb('0xe')](_0xbfcb('0xa'),auth[_0xbfcb('0xb')](),controller['update']);router[_0xbfcb('0xf')](_0xbfcb('0xa'),auth[_0xbfcb('0xb')](),controller[_0xbfcb('0x10')]);module[_0xbfcb('0x11')]=router; \ No newline at end of file +var _0x3423=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','path','connect-timeout','express','Router'];(function(_0x59c0a6,_0x216f3a){var _0x14561d=function(_0x19e3f6){while(--_0x19e3f6){_0x59c0a6['push'](_0x59c0a6['shift']());}};_0x14561d(++_0x216f3a);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var auth=require(_0x3342('0x4'));var interaction=require(_0x3342('0x5'));var config=require(_0x3342('0x6'));var controller=require(_0x3342('0x7'));router[_0x3342('0x8')]('/',auth[_0x3342('0x9')](),controller[_0x3342('0xa')]);router[_0x3342('0x8')](_0x3342('0xb'),auth[_0x3342('0x9')](),controller[_0x3342('0xc')]);router[_0x3342('0xd')]('/',auth[_0x3342('0x9')](),controller[_0x3342('0xe')]);router[_0x3342('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3342('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3342('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 0fbdd4d..6a863d0 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 _0x4fd7=['ENUM','string','keyValue','STRING','customVariable','BOOLEAN','sequelize','exports'];(function(_0xff85ee,_0x5d145a){var _0x11d77d=function(_0x615695){while(--_0x615695){_0xff85ee['push'](_0xff85ee['shift']());}};_0x11d77d(++_0x5d145a);}(_0x4fd7,0xe6));var _0x74fd=function(_0x304616,_0xd25fdc){_0x304616=_0x304616-0x0;var _0x2f0ab6=_0x4fd7[_0x304616];return _0x2f0ab6;};'use strict';var Sequelize=require(_0x74fd('0x0'));module[_0x74fd('0x1')]={'type':{'type':Sequelize[_0x74fd('0x2')](_0x74fd('0x3'),'variable','customVariable',_0x74fd('0x4')),'defaultValue':_0x74fd('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x74fd('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x74fd('0x3'),'variable',_0x74fd('0x6'))},'keyContent':{'type':Sequelize[_0x74fd('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x74fd('0x5')]},'customField':{'type':Sequelize[_0x74fd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6732=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x6732,0x66));var _0x2673=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6732[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2673('0x0'));module[_0x2673('0x1')]={'type':{'type':Sequelize[_0x2673('0x2')](_0x2673('0x3'),'variable',_0x2673('0x4'),_0x2673('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2673('0x6')]},'key':{'type':Sequelize[_0x2673('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x2673('0x7'),_0x2673('0x4'))},'keyContent':{'type':Sequelize[_0x2673('0x6')]},'idField':{'type':Sequelize[_0x2673('0x6')]},'nameField':{'type':Sequelize[_0x2673('0x6')]},'customField':{'type':Sequelize[_0x2673('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2673('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 1d4ed11..2f47b6a 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 _0x1ebc=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','find','catch','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x3a3dc8,_0x1818dc){var _0x19f739=function(_0x4a5784){while(--_0x4a5784){_0x3a3dc8['push'](_0x3a3dc8['shift']());}};_0x19f739(++_0x1818dc);}(_0x1ebc,0x1aa));var _0xc1eb=function(_0x3e232f,_0x53eea1){_0x3e232f=_0x3e232f-0x0;var _0x450748=_0x1ebc[_0x3e232f];return _0x450748;};'use strict';var pdf=require(_0xc1eb('0x0'));var emlformat=require(_0xc1eb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc1eb('0x2'));var jsonpatch=require(_0xc1eb('0x3'));var rp=require(_0xc1eb('0x4'));var moment=require(_0xc1eb('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc1eb('0x6'));var sox=require('sox');var csv=require(_0xc1eb('0x7'));var ejs=require(_0xc1eb('0x8'));var fs=require('fs');var _=require(_0xc1eb('0x9'));var squel=require('squel');var crypto=require(_0xc1eb('0xa'));var jsforce=require(_0xc1eb('0xb'));var deskjs=require(_0xc1eb('0xc'));var toCsv=require(_0xc1eb('0x7'));var querystring=require(_0xc1eb('0xd'));var Papa=require(_0xc1eb('0xe'));var Redis=require(_0xc1eb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc1eb('0x10'));var as=require(_0xc1eb('0x11'));var hardwareService=require(_0xc1eb('0x12'));var logger=require(_0xc1eb('0x13'))(_0xc1eb('0x14'));var utils=require(_0xc1eb('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x437c44,_0x501a64){_0x501a64=_0x501a64||0xcc;return function(_0x5ceee0){if(_0x5ceee0){return _0x437c44[_0xc1eb('0x16')](_0x501a64);}return _0x437c44[_0xc1eb('0x17')](_0x501a64)[_0xc1eb('0x18')]();};}function respondWithResult(_0x5d5ce0,_0x3e42b7){_0x3e42b7=_0x3e42b7||0xc8;return function(_0x1b4a00){if(_0x1b4a00){return _0x5d5ce0[_0xc1eb('0x17')](_0x3e42b7)[_0xc1eb('0x19')](_0x1b4a00);}};}function respondWithFilteredResult(_0xabba4b,_0x3d3bd0){return function(_0x4b07ef){if(_0x4b07ef){var _0x4cbf74=_0x4b07ef[_0xc1eb('0x1a')],_0x49c813=_0x3d3bd0['offset'],_0x4097fb=_0x3d3bd0['offset']+_0x3d3bd0[_0xc1eb('0x1b')],_0x258d77;if(_0x4097fb>=_0x4cbf74){_0x4097fb=_0x4cbf74;_0x258d77=0xc8;}else{_0x258d77=0xce;}_0xabba4b['status'](_0x258d77);return _0xabba4b[_0xc1eb('0x1c')](_0xc1eb('0x1d'),_0x49c813+'-'+_0x4097fb+'/'+_0x4cbf74)[_0xc1eb('0x19')](_0x4b07ef);}return null;};}function patchUpdates(_0x1d1ef6){return function(_0x3e7d55){try{jsonpatch[_0xc1eb('0x1e')](_0x3e7d55,_0x1d1ef6,!![]);}catch(_0x510509){return BPromise[_0xc1eb('0x1f')](_0x510509);}return _0x3e7d55[_0xc1eb('0x20')]();};}function saveUpdates(_0x3a019a,_0x16c0c7){return function(_0x11f5de){if(_0x11f5de){return _0x11f5de[_0xc1eb('0x21')](_0x3a019a)[_0xc1eb('0x22')](function(_0x4750e5){return _0x4750e5;});}return null;};}function removeEntity(_0x5b1b77,_0x2b68d6){return function(_0x808f9d){if(_0x808f9d){return _0x808f9d[_0xc1eb('0x23')]()['then'](function(){_0x5b1b77[_0xc1eb('0x17')](0xcc)[_0xc1eb('0x18')]();});}};}function handleEntityNotFound(_0x17a1fe,_0x1f7c18){return function(_0x541cce){if(!_0x541cce){_0x17a1fe[_0xc1eb('0x16')](0x194);}return _0x541cce;};}function handleError(_0x7ac347,_0x1e8c44){_0x1e8c44=_0x1e8c44||0x1f4;return function(_0x41de4f){logger[_0xc1eb('0x24')](_0x41de4f[_0xc1eb('0x25')]);if(_0x41de4f[_0xc1eb('0x26')]){delete _0x41de4f['name'];}_0x7ac347[_0xc1eb('0x17')](_0x1e8c44)[_0xc1eb('0x27')](_0x41de4f);};}exports[_0xc1eb('0x28')]=function(_0x223919,_0x413464){var _0x26ca5e={},_0x266c84={},_0x3c7f48={'count':0x0,'rows':[]};var _0x42d32e=_[_0xc1eb('0x29')](db[_0xc1eb('0x2a')][_0xc1eb('0x2b')],function(_0x54f9b2){return{'name':_0x54f9b2['fieldName'],'type':_0x54f9b2[_0xc1eb('0x2c')][_0xc1eb('0x2d')]};});_0x266c84[_0xc1eb('0x2e')]=_[_0xc1eb('0x29')](_0x42d32e,'name');_0x266c84[_0xc1eb('0x2f')]=_[_0xc1eb('0x30')](_0x223919[_0xc1eb('0x2f')]);_0x266c84[_0xc1eb('0x31')]=_[_0xc1eb('0x32')](_0x266c84['model'],_0x266c84[_0xc1eb('0x2f')]);_0x26ca5e[_0xc1eb('0x33')]=_[_0xc1eb('0x32')](_0x266c84['model'],qs[_0xc1eb('0x34')](_0x223919[_0xc1eb('0x2f')]['fields']));_0x26ca5e['attributes']=_0x26ca5e[_0xc1eb('0x33')][_0xc1eb('0x35')]?_0x26ca5e['attributes']:_0x266c84[_0xc1eb('0x2e')];if(!_0x223919[_0xc1eb('0x2f')][_0xc1eb('0x36')](_0xc1eb('0x37'))){_0x26ca5e[_0xc1eb('0x1b')]=qs['limit'](_0x223919['query'][_0xc1eb('0x1b')]);_0x26ca5e[_0xc1eb('0x38')]=qs['offset'](_0x223919['query'][_0xc1eb('0x38')]);}_0x26ca5e[_0xc1eb('0x39')]=qs[_0xc1eb('0x3a')](_0x223919[_0xc1eb('0x2f')]['sort']);_0x26ca5e[_0xc1eb('0x3b')]=qs[_0xc1eb('0x31')](_[_0xc1eb('0x3c')](_0x223919[_0xc1eb('0x2f')],_0x266c84[_0xc1eb('0x31')]),_0x42d32e);if(_0x223919[_0xc1eb('0x2f')]['filter']){_0x26ca5e['where']=_[_0xc1eb('0x3d')](_0x26ca5e[_0xc1eb('0x3b')],{'$or':_[_0xc1eb('0x29')](_0x42d32e,function(_0x4660dc){if(_0x4660dc[_0xc1eb('0x2c')]!=='VIRTUAL'){var _0x47d712={};_0x47d712[_0x4660dc['name']]={'$like':'%'+_0x223919['query'][_0xc1eb('0x3e')]+'%'};return _0x47d712;}})});}_0x26ca5e=_['merge']({},_0x26ca5e,_0x223919[_0xc1eb('0x3f')]);var _0x5cd720={'where':_0x26ca5e[_0xc1eb('0x3b')]};return db[_0xc1eb('0x2a')][_0xc1eb('0x1a')](_0x5cd720)[_0xc1eb('0x22')](function(_0x3d533d){_0x3c7f48[_0xc1eb('0x1a')]=_0x3d533d;if(_0x223919['query'][_0xc1eb('0x40')]){_0x26ca5e[_0xc1eb('0x41')]=[{'all':!![]}];}return db['ZohoField'][_0xc1eb('0x42')](_0x26ca5e);})[_0xc1eb('0x22')](function(_0x30fc6c){_0x3c7f48[_0xc1eb('0x43')]=_0x30fc6c;return _0x3c7f48;})[_0xc1eb('0x22')](respondWithFilteredResult(_0x413464,_0x26ca5e))['catch'](handleError(_0x413464,null));};exports['show']=function(_0x11aca1,_0x1d788e){var _0x104762={'raw':!![],'where':{'id':_0x11aca1['params']['id']}},_0xb28835={};_0xb28835[_0xc1eb('0x2e')]=_[_0xc1eb('0x30')](db[_0xc1eb('0x2a')]['rawAttributes']);_0xb28835[_0xc1eb('0x2f')]=_[_0xc1eb('0x30')](_0x11aca1[_0xc1eb('0x2f')]);_0xb28835[_0xc1eb('0x31')]=_['intersection'](_0xb28835['model'],_0xb28835['query']);_0x104762['attributes']=_[_0xc1eb('0x32')](_0xb28835[_0xc1eb('0x2e')],qs[_0xc1eb('0x34')](_0x11aca1['query'][_0xc1eb('0x34')]));_0x104762[_0xc1eb('0x33')]=_0x104762['attributes']['length']?_0x104762['attributes']:_0xb28835['model'];if(_0x11aca1[_0xc1eb('0x2f')][_0xc1eb('0x40')]){_0x104762[_0xc1eb('0x41')]=[{'all':!![]}];}_0x104762=_[_0xc1eb('0x3d')]({},_0x104762,_0x11aca1['options']);return db['ZohoField'][_0xc1eb('0x44')](_0x104762)[_0xc1eb('0x22')](handleEntityNotFound(_0x1d788e,null))[_0xc1eb('0x22')](respondWithResult(_0x1d788e,null))[_0xc1eb('0x45')](handleError(_0x1d788e,null));};exports['create']=function(_0x267c20,_0x24109c){return db[_0xc1eb('0x2a')][_0xc1eb('0x46')](_0x267c20[_0xc1eb('0x47')],{})[_0xc1eb('0x22')](respondWithResult(_0x24109c,0xc9))['catch'](handleError(_0x24109c,null));};exports[_0xc1eb('0x21')]=function(_0x1e9491,_0x28ae88){if(_0x1e9491[_0xc1eb('0x47')]['id']){delete _0x1e9491['body']['id'];}return db[_0xc1eb('0x2a')]['find']({'where':{'id':_0x1e9491[_0xc1eb('0x48')]['id']}})[_0xc1eb('0x22')](handleEntityNotFound(_0x28ae88,null))[_0xc1eb('0x22')](saveUpdates(_0x1e9491[_0xc1eb('0x47')],null))[_0xc1eb('0x22')](respondWithResult(_0x28ae88,null))[_0xc1eb('0x45')](handleError(_0x28ae88,null));};exports['destroy']=function(_0x122350,_0x1b5bfc){return db[_0xc1eb('0x2a')][_0xc1eb('0x44')]({'where':{'id':_0x122350['params']['id']}})['then'](handleEntityNotFound(_0x1b5bfc,null))['then'](removeEntity(_0x1b5bfc,null))[_0xc1eb('0x45')](handleError(_0x1b5bfc,null));}; \ No newline at end of file +var _0x9c05=['moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','then','destroy','error','name','index','map','ZohoField','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','merge','type','VIRTUAL','filter','options','findAll','rows','catch','show','params','length','includeAll','include','find','create','body','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x4c60a5,_0x991968){var _0x4727d3=function(_0x34ac92){while(--_0x34ac92){_0x4c60a5['push'](_0x4c60a5['shift']());}};_0x4727d3(++_0x991968);}(_0x9c05,0x168));var _0x59c0=function(_0x11e285,_0x4c5ff1){_0x11e285=_0x11e285-0x0;var _0x4a44ff=_0x9c05[_0x11e285];return _0x4a44ff;};'use strict';var pdf=require(_0x59c0('0x0'));var emlformat=require(_0x59c0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x59c0('0x2'));var jsonpatch=require(_0x59c0('0x3'));var rp=require(_0x59c0('0x4'));var moment=require(_0x59c0('0x5'));var BPromise=require(_0x59c0('0x6'));var Mustache=require(_0x59c0('0x7'));var util=require(_0x59c0('0x8'));var path=require(_0x59c0('0x9'));var sox=require('sox');var csv=require(_0x59c0('0xa'));var ejs=require(_0x59c0('0xb'));var fs=require('fs');var _=require(_0x59c0('0xc'));var squel=require(_0x59c0('0xd'));var crypto=require(_0x59c0('0xe'));var jsforce=require(_0x59c0('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x59c0('0xa'));var querystring=require(_0x59c0('0x10'));var Papa=require('papaparse');var Redis=require(_0x59c0('0x11'));var authService=require(_0x59c0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x59c0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x59c0('0x14'))(_0x59c0('0x15'));var utils=require(_0x59c0('0x16'));var config=require(_0x59c0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x59c0('0x18'))['db'];function respondWithStatusCode(_0x417d01,_0x531d50){_0x531d50=_0x531d50||0xcc;return function(_0x1c0d66){if(_0x1c0d66){return _0x417d01[_0x59c0('0x19')](_0x531d50);}return _0x417d01[_0x59c0('0x1a')](_0x531d50)[_0x59c0('0x1b')]();};}function respondWithResult(_0x339c2a,_0x3a2c62){_0x3a2c62=_0x3a2c62||0xc8;return function(_0x3f11e7){if(_0x3f11e7){return _0x339c2a[_0x59c0('0x1a')](_0x3a2c62)[_0x59c0('0x1c')](_0x3f11e7);}};}function respondWithFilteredResult(_0x2e16ee,_0x4ac4b2){return function(_0x48baef){if(_0x48baef){var _0x2def6d=_0x48baef[_0x59c0('0x1d')],_0x461c8a=_0x4ac4b2[_0x59c0('0x1e')],_0x22dd01=_0x4ac4b2['offset']+_0x4ac4b2['limit'],_0x594ce8;if(_0x22dd01>=_0x2def6d){_0x22dd01=_0x2def6d;_0x594ce8=0xc8;}else{_0x594ce8=0xce;}_0x2e16ee[_0x59c0('0x1a')](_0x594ce8);return _0x2e16ee['set'](_0x59c0('0x1f'),_0x461c8a+'-'+_0x22dd01+'/'+_0x2def6d)[_0x59c0('0x1c')](_0x48baef);}return null;};}function patchUpdates(_0x2e9257){return function(_0x29a5ca){try{jsonpatch[_0x59c0('0x20')](_0x29a5ca,_0x2e9257,!![]);}catch(_0x14b4c4){return BPromise[_0x59c0('0x21')](_0x14b4c4);}return _0x29a5ca['save']();};}function saveUpdates(_0xd22b07,_0x3ec59e){return function(_0x321b37){if(_0x321b37){return _0x321b37['update'](_0xd22b07)[_0x59c0('0x22')](function(_0x4b59d9){return _0x4b59d9;});}return null;};}function removeEntity(_0x5599e9,_0xfdc6db){return function(_0x8f962c){if(_0x8f962c){return _0x8f962c[_0x59c0('0x23')]()[_0x59c0('0x22')](function(){_0x5599e9[_0x59c0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e629f,_0x46edc7){return function(_0x3d39cf){if(!_0x3d39cf){_0x4e629f[_0x59c0('0x19')](0x194);}return _0x3d39cf;};}function handleError(_0xcc5c57,_0x28de2a){_0x28de2a=_0x28de2a||0x1f4;return function(_0x29bf59){logger[_0x59c0('0x24')](_0x29bf59['stack']);if(_0x29bf59[_0x59c0('0x25')]){delete _0x29bf59[_0x59c0('0x25')];}_0xcc5c57['status'](_0x28de2a)['send'](_0x29bf59);};}exports[_0x59c0('0x26')]=function(_0x4aee7b,_0x5c8aff){var _0x136f4e={},_0x29cf1a={},_0x4ac79b={'count':0x0,'rows':[]};var _0xb66c1=_[_0x59c0('0x27')](db[_0x59c0('0x28')][_0x59c0('0x29')],function(_0x5f5d48){return{'name':_0x5f5d48['fieldName'],'type':_0x5f5d48['type'][_0x59c0('0x2a')]};});_0x29cf1a['model']=_[_0x59c0('0x27')](_0xb66c1,_0x59c0('0x25'));_0x29cf1a[_0x59c0('0x2b')]=_[_0x59c0('0x2c')](_0x4aee7b[_0x59c0('0x2b')]);_0x29cf1a[_0x59c0('0x2d')]=_[_0x59c0('0x2e')](_0x29cf1a[_0x59c0('0x2f')],_0x29cf1a[_0x59c0('0x2b')]);_0x136f4e[_0x59c0('0x30')]=_[_0x59c0('0x2e')](_0x29cf1a[_0x59c0('0x2f')],qs[_0x59c0('0x31')](_0x4aee7b[_0x59c0('0x2b')][_0x59c0('0x31')]));_0x136f4e[_0x59c0('0x30')]=_0x136f4e[_0x59c0('0x30')]['length']?_0x136f4e[_0x59c0('0x30')]:_0x29cf1a[_0x59c0('0x2f')];if(!_0x4aee7b[_0x59c0('0x2b')][_0x59c0('0x32')](_0x59c0('0x33'))){_0x136f4e[_0x59c0('0x34')]=qs[_0x59c0('0x34')](_0x4aee7b[_0x59c0('0x2b')]['limit']);_0x136f4e['offset']=qs[_0x59c0('0x1e')](_0x4aee7b[_0x59c0('0x2b')][_0x59c0('0x1e')]);}_0x136f4e[_0x59c0('0x35')]=qs[_0x59c0('0x36')](_0x4aee7b[_0x59c0('0x2b')][_0x59c0('0x36')]);_0x136f4e[_0x59c0('0x37')]=qs['filters'](_['pick'](_0x4aee7b[_0x59c0('0x2b')],_0x29cf1a[_0x59c0('0x2d')]),_0xb66c1);if(_0x4aee7b['query']['filter']){_0x136f4e[_0x59c0('0x37')]=_[_0x59c0('0x38')](_0x136f4e['where'],{'$or':_[_0x59c0('0x27')](_0xb66c1,function(_0x4ae7b8){if(_0x4ae7b8[_0x59c0('0x39')]!==_0x59c0('0x3a')){var _0x47b271={};_0x47b271[_0x4ae7b8['name']]={'$like':'%'+_0x4aee7b[_0x59c0('0x2b')][_0x59c0('0x3b')]+'%'};return _0x47b271;}})});}_0x136f4e=_[_0x59c0('0x38')]({},_0x136f4e,_0x4aee7b[_0x59c0('0x3c')]);var _0x38f202={'where':_0x136f4e[_0x59c0('0x37')]};return db[_0x59c0('0x28')]['count'](_0x38f202)[_0x59c0('0x22')](function(_0x248920){_0x4ac79b[_0x59c0('0x1d')]=_0x248920;if(_0x4aee7b[_0x59c0('0x2b')]['includeAll']){_0x136f4e['include']=[{'all':!![]}];}return db['ZohoField'][_0x59c0('0x3d')](_0x136f4e);})[_0x59c0('0x22')](function(_0x590b5c){_0x4ac79b[_0x59c0('0x3e')]=_0x590b5c;return _0x4ac79b;})['then'](respondWithFilteredResult(_0x5c8aff,_0x136f4e))[_0x59c0('0x3f')](handleError(_0x5c8aff,null));};exports[_0x59c0('0x40')]=function(_0x4483a7,_0x20379d){var _0x17542f={'raw':!![],'where':{'id':_0x4483a7[_0x59c0('0x41')]['id']}},_0x4fd458={};_0x4fd458[_0x59c0('0x2f')]=_[_0x59c0('0x2c')](db['ZohoField'][_0x59c0('0x29')]);_0x4fd458['query']=_[_0x59c0('0x2c')](_0x4483a7[_0x59c0('0x2b')]);_0x4fd458[_0x59c0('0x2d')]=_['intersection'](_0x4fd458['model'],_0x4fd458['query']);_0x17542f[_0x59c0('0x30')]=_[_0x59c0('0x2e')](_0x4fd458['model'],qs[_0x59c0('0x31')](_0x4483a7[_0x59c0('0x2b')]['fields']));_0x17542f[_0x59c0('0x30')]=_0x17542f['attributes'][_0x59c0('0x42')]?_0x17542f['attributes']:_0x4fd458[_0x59c0('0x2f')];if(_0x4483a7[_0x59c0('0x2b')][_0x59c0('0x43')]){_0x17542f[_0x59c0('0x44')]=[{'all':!![]}];}_0x17542f=_[_0x59c0('0x38')]({},_0x17542f,_0x4483a7[_0x59c0('0x3c')]);return db[_0x59c0('0x28')][_0x59c0('0x45')](_0x17542f)[_0x59c0('0x22')](handleEntityNotFound(_0x20379d,null))[_0x59c0('0x22')](respondWithResult(_0x20379d,null))['catch'](handleError(_0x20379d,null));};exports['create']=function(_0x5a8ed9,_0x47b412){return db[_0x59c0('0x28')][_0x59c0('0x46')](_0x5a8ed9[_0x59c0('0x47')],{})[_0x59c0('0x22')](respondWithResult(_0x47b412,0xc9))[_0x59c0('0x3f')](handleError(_0x47b412,null));};exports[_0x59c0('0x48')]=function(_0x411c69,_0x40120b){if(_0x411c69['body']['id']){delete _0x411c69[_0x59c0('0x47')]['id'];}return db[_0x59c0('0x28')]['find']({'where':{'id':_0x411c69[_0x59c0('0x41')]['id']}})['then'](handleEntityNotFound(_0x40120b,null))[_0x59c0('0x22')](saveUpdates(_0x411c69[_0x59c0('0x47')],null))[_0x59c0('0x22')](respondWithResult(_0x40120b,null))[_0x59c0('0x3f')](handleError(_0x40120b,null));};exports['destroy']=function(_0x912d0b,_0x22cd1e){return db[_0x59c0('0x28')][_0x59c0('0x45')]({'where':{'id':_0x912d0b['params']['id']}})[_0x59c0('0x22')](handleEntityNotFound(_0x22cd1e,null))['then'](removeEntity(_0x22cd1e,null))[_0x59c0('0x3f')](handleError(_0x22cd1e,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index c82639b..62e4f00 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 _0xc3bf=['ZohoField','zoho_unique_index','FieldId','lodash','util','moment','request-promise','rimraf','./intZohoField.attributes','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc3bf,0xe9));var _0xfc3b=function(_0x23aef8,_0x1696bb){_0x23aef8=_0x23aef8-0x0;var _0x12ab00=_0xc3bf[_0x23aef8];return _0x12ab00;};'use strict';var _=require(_0xfc3b('0x0'));var util=require(_0xfc3b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfc3b('0x2'));var BPromise=require('bluebird');var rp=require(_0xfc3b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc3b('0x4'));var config=require('../../config/environment');var attributes=require(_0xfc3b('0x5'));module[_0xfc3b('0x6')]=function(_0x386a4b,_0x3f6403){return _0x386a4b['define'](_0xfc3b('0x7'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xfc3b('0x8'),'fields':['idField',_0xfc3b('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x547f=['zoho_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','int_zoho_fields'];(function(_0x1d7183,_0x32288c){var _0x1c8e24=function(_0x23dcbe){while(--_0x23dcbe){_0x1d7183['push'](_0x1d7183['shift']());}};_0x1c8e24(++_0x32288c);}(_0x547f,0xf3));var _0xf547=function(_0x10756c,_0xf50e88){_0x10756c=_0x10756c-0x0;var _0x93180b=_0x547f[_0x10756c];return _0x93180b;};'use strict';var _=require('lodash');var util=require(_0xf547('0x0'));var logger=require(_0xf547('0x1'))(_0xf547('0x2'));var moment=require(_0xf547('0x3'));var BPromise=require(_0xf547('0x4'));var rp=require(_0xf547('0x5'));var fs=require('fs');var path=require(_0xf547('0x6'));var rimraf=require(_0xf547('0x7'));var config=require(_0xf547('0x8'));var attributes=require(_0xf547('0x9'));module[_0xf547('0xa')]=function(_0x2f3a54,_0x4f9dc4){return _0x2f3a54[_0xf547('0xb')]('ZohoField',attributes,{'tableName':_0xf547('0xc'),'paranoid':![],'indexes':[{'name':_0xf547('0xd'),'fields':[_0xf547('0xe'),_0xf547('0xf')],'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 3eb34d4..cb0831b 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 _0xb138=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xb138,0x1dd));var _0x8b13=function(_0x556fbf,_0x23b99f){_0x556fbf=_0x556fbf-0x0;var _0x57fb73=_0xb138[_0x556fbf];return _0x57fb73;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var moment=require(_0x8b13('0x2'));var BPromise=require(_0x8b13('0x3'));var rs=require(_0x8b13('0x4'));var fs=require('fs');var Redis=require(_0x8b13('0x5'));var db=require(_0x8b13('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b13('0x7'))(_0x8b13('0x8'));var config=require(_0x8b13('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8b13('0xa')][_0x8b13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d51b1,_0x3fdf4d,_0x33d1a7){return new BPromise(function(_0x22e157,_0x498832){return client[_0x8b13('0xc')](_0x5d51b1,_0x33d1a7)[_0x8b13('0xd')](function(_0x58683a){logger['info'](_0x8b13('0xe'),_0x3fdf4d,_0x8b13('0xf'));logger[_0x8b13('0x10')](_0x8b13('0x11'),_0x3fdf4d,_0x8b13('0xf'),JSON['stringify'](_0x58683a));if(_0x58683a[_0x8b13('0x12')]){if(_0x58683a[_0x8b13('0x12')][_0x8b13('0x13')]===0x1f4){logger[_0x8b13('0x12')](_0x8b13('0xe'),_0x3fdf4d,_0x58683a[_0x8b13('0x12')]['message']);return _0x498832(_0x58683a['error'][_0x8b13('0x14')]);}logger[_0x8b13('0x12')]('ZohoField,\x20%s,\x20%s',_0x3fdf4d,_0x58683a['error']['message']);return _0x22e157(_0x58683a[_0x8b13('0x12')][_0x8b13('0x14')]);}else{logger[_0x8b13('0x15')](_0x8b13('0xe'),_0x3fdf4d,_0x8b13('0xf'));_0x22e157(_0x58683a['result'][_0x8b13('0x14')]);}})[_0x8b13('0x16')](function(_0x393bc1){logger[_0x8b13('0x12')](_0x8b13('0xe'),_0x3fdf4d,_0x393bc1);_0x498832(_0x393bc1);});});} \ No newline at end of file +var _0xb458=['ZohoField,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','ZohoField,\x20%s,\x20%s','debug'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xb458,0x103));var _0x8b45=function(_0x2640fa,_0xaeaf32){_0x2640fa=_0x2640fa-0x0;var _0x5aa2cd=_0xb458[_0x2640fa];return _0x5aa2cd;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12bd05,_0x2daa9a,_0x3a8ccb){return new BPromise(function(_0x32342f,_0x4d1718){return client[_0x8b45('0x9')](_0x12bd05,_0x3a8ccb)[_0x8b45('0xa')](function(_0x33f30e){logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,'request\x20sent');logger[_0x8b45('0xd')](_0x8b45('0xe'),_0x2daa9a,'request\x20sent',JSON['stringify'](_0x33f30e));if(_0x33f30e['error']){if(_0x33f30e['error'][_0x8b45('0xf')]===0x1f4){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e['error'][_0x8b45('0x11')]);return _0x4d1718(_0x33f30e[_0x8b45('0x10')][_0x8b45('0x11')]);}logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e[_0x8b45('0x10')]['message']);return _0x32342f(_0x33f30e['error'][_0x8b45('0x11')]);}else{logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,_0x8b45('0x12'));_0x32342f(_0x33f30e[_0x8b45('0x13')][_0x8b45('0x11')]);}})[_0x8b45('0x14')](function(_0x147d6b){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x147d6b);_0x4d1718(_0x147d6b);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index cb3adec..17192ab 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 _0x3cc5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express'];(function(_0x57cc59,_0x2485b8){var _0x3a3cd8=function(_0x2c0949){while(--_0x2c0949){_0x57cc59['push'](_0x57cc59['shift']());}};_0x3a3cd8(++_0x2485b8);}(_0x3cc5,0xe1));var _0x53cc=function(_0x2bd7a3,_0x57c548){_0x2bd7a3=_0x2bd7a3-0x0;var _0x25b368=_0x3cc5[_0x2bd7a3];return _0x25b368;};'use strict';var multer=require(_0x53cc('0x0'));var util=require(_0x53cc('0x1'));var path=require(_0x53cc('0x2'));var timeout=require(_0x53cc('0x3'));var express=require(_0x53cc('0x4'));var router=express[_0x53cc('0x5')]();var auth=require(_0x53cc('0x6'));var interaction=require(_0x53cc('0x7'));var config=require(_0x53cc('0x8'));module[_0x53cc('0x9')]=router; \ No newline at end of file +var _0x076e=['express','Router','../../components/interaction/service','exports','multer','util','path','connect-timeout'];(function(_0xaf37a5,_0x417430){var _0x4f6f02=function(_0x259839){while(--_0x259839){_0xaf37a5['push'](_0xaf37a5['shift']());}};_0x4f6f02(++_0x417430);}(_0x076e,0x114));var _0xe076=function(_0x26a5cf,_0x31be5f){_0x26a5cf=_0x26a5cf-0x0;var _0x4c5568=_0x076e[_0x26a5cf];return _0x4c5568;};'use strict';var multer=require(_0xe076('0x0'));var util=require(_0xe076('0x1'));var path=require(_0xe076('0x2'));var timeout=require(_0xe076('0x3'));var express=require(_0xe076('0x4'));var router=express[_0xe076('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe076('0x6'));var config=require('../../config/environment');module[_0xe076('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 c7f612f..55d18dc 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 _0x4770=['BOOLEAN','state','STRING','unique_name_and_version','app.js'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4770,0x1ab));var _0x0477=function(_0x44040e,_0x2bbd3b){_0x44040e=_0x44040e-0x0;var _0x1ad8a1=_0x4770[_0x44040e];return _0x1ad8a1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0477('0x0')],'allowNull':![],'unique':_0x0477('0x1')},'version':{'type':Sequelize[_0x0477('0x0')],'allowNull':![],'unique':_0x0477('0x1')},'main':{'type':Sequelize[_0x0477('0x0')],'defaultValue':_0x0477('0x2')},'filename':{'type':Sequelize[_0x0477('0x0')]},'path':{'type':Sequelize[_0x0477('0x0')]},'type':{'type':Sequelize[_0x0477('0x0')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x0477('0x3')],'defaultValue':![]},'author':{'type':Sequelize[_0x0477('0x0')]},'logo':{'type':Sequelize[_0x0477('0x0')]},'state':{'type':Sequelize[_0x0477('0x0')],'unique':_0x0477('0x4')},'description':{'type':Sequelize[_0x0477('0x0')]},'title':{'type':Sequelize[_0x0477('0x0')]},'remoteUri':{'type':Sequelize[_0x0477('0x0')]},'link':{'type':Sequelize[_0x0477('0x0')],'defaultValue':'#'}}; \ No newline at end of file +var _0x9ea9=['INTEGER','BOOLEAN','state','sequelize','STRING','unique_name_and_version','app.js'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x9ea9,0x73));var _0x99ea=function(_0x2d8607,_0x2c444a){_0x2d8607=_0x2d8607-0x0;var _0x4c1cb3=_0x9ea9[_0x2d8607];return _0x4c1cb3;};'use strict';var Sequelize=require(_0x99ea('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x99ea('0x1')],'allowNull':![],'unique':_0x99ea('0x2')},'main':{'type':Sequelize[_0x99ea('0x1')],'defaultValue':_0x99ea('0x3')},'filename':{'type':Sequelize[_0x99ea('0x1')]},'path':{'type':Sequelize[_0x99ea('0x1')]},'type':{'type':Sequelize[_0x99ea('0x1')]},'size':{'type':Sequelize[_0x99ea('0x4')]},'active':{'type':Sequelize[_0x99ea('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x99ea('0x1')]},'logo':{'type':Sequelize[_0x99ea('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0x99ea('0x6')},'description':{'type':Sequelize[_0x99ea('0x1')]},'title':{'type':Sequelize[_0x99ea('0x1')]},'remoteUri':{'type':Sequelize[_0x99ea('0x1')]},'link':{'type':Sequelize[_0x99ea('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index c078245..e67114f 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 _0x8bc6=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','Integration','count','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x32b122,_0x1ad490){var _0x4ad25a=function(_0x590ee6){while(--_0x590ee6){_0x32b122['push'](_0x32b122['shift']());}};_0x4ad25a(++_0x1ad490);}(_0x8bc6,0xc4));var _0x68bc=function(_0x503ec3,_0x5f851e){_0x503ec3=_0x503ec3-0x0;var _0x4ce7cf=_0x8bc6[_0x503ec3];return _0x4ce7cf;};'use strict';var pdf=require(_0x68bc('0x0'));var emlformat=require(_0x68bc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x68bc('0x2'));var jsonpatch=require(_0x68bc('0x3'));var rp=require('request-promise');var moment=require(_0x68bc('0x4'));var BPromise=require(_0x68bc('0x5'));var Mustache=require(_0x68bc('0x6'));var util=require(_0x68bc('0x7'));var path=require('path');var sox=require(_0x68bc('0x8'));var csv=require(_0x68bc('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x68bc('0xa'));var crypto=require(_0x68bc('0xb'));var jsforce=require(_0x68bc('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x68bc('0xd'));var Papa=require(_0x68bc('0xe'));var Redis=require(_0x68bc('0xf'));var authService=require(_0x68bc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x68bc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x68bc('0x12'));var utils=require(_0x68bc('0x13'));var config=require(_0x68bc('0x14'));var licenseUtil=require(_0x68bc('0x15'));var db=require(_0x68bc('0x16'))['db'];function respondWithStatusCode(_0x3c44d7,_0x1e185e){_0x1e185e=_0x1e185e||0xcc;return function(_0x2bf9e1){if(_0x2bf9e1){return _0x3c44d7[_0x68bc('0x17')](_0x1e185e);}return _0x3c44d7[_0x68bc('0x18')](_0x1e185e)[_0x68bc('0x19')]();};}function respondWithResult(_0x2807ee,_0x23ffa2){_0x23ffa2=_0x23ffa2||0xc8;return function(_0x6c84af){if(_0x6c84af){return _0x2807ee[_0x68bc('0x18')](_0x23ffa2)[_0x68bc('0x1a')](_0x6c84af);}};}function respondWithFilteredResult(_0x42d045,_0x2f1cdc){return function(_0x298391){if(_0x298391){var _0x5c3ac5=_0x298391['count'],_0x2299f7=_0x2f1cdc[_0x68bc('0x1b')],_0x3bbdf5=_0x2f1cdc[_0x68bc('0x1b')]+_0x2f1cdc['limit'],_0x219917;if(_0x3bbdf5>=_0x5c3ac5){_0x3bbdf5=_0x5c3ac5;_0x219917=0xc8;}else{_0x219917=0xce;}_0x42d045[_0x68bc('0x18')](_0x219917);return _0x42d045[_0x68bc('0x1c')](_0x68bc('0x1d'),_0x2299f7+'-'+_0x3bbdf5+'/'+_0x5c3ac5)[_0x68bc('0x1a')](_0x298391);}return null;};}function patchUpdates(_0x272020){return function(_0x162aca){try{jsonpatch['apply'](_0x162aca,_0x272020,!![]);}catch(_0x532e73){return BPromise[_0x68bc('0x1e')](_0x532e73);}return _0x162aca[_0x68bc('0x1f')]();};}function saveUpdates(_0x8e4745,_0x5e0800){return function(_0x7f28ef){if(_0x7f28ef){return _0x7f28ef[_0x68bc('0x20')](_0x8e4745)[_0x68bc('0x21')](function(_0x2510a4){return _0x2510a4;});}return null;};}function removeEntity(_0x37e06a,_0x1b1b59){return function(_0x360dc1){if(_0x360dc1){return _0x360dc1['destroy']()[_0x68bc('0x21')](function(){_0x37e06a[_0x68bc('0x18')](0xcc)[_0x68bc('0x19')]();});}};}function handleEntityNotFound(_0xef9f1a,_0x10bc7f){return function(_0x1e9a35){if(!_0x1e9a35){_0xef9f1a[_0x68bc('0x17')](0x194);}return _0x1e9a35;};}function handleError(_0x43508d,_0x33f017){_0x33f017=_0x33f017||0x1f4;return function(_0x1411a9){logger[_0x68bc('0x22')](_0x1411a9['stack']);if(_0x1411a9[_0x68bc('0x23')]){delete _0x1411a9[_0x68bc('0x23')];}_0x43508d['status'](_0x33f017)[_0x68bc('0x24')](_0x1411a9);};}exports[_0x68bc('0x25')]=function(_0xbe980c,_0x112e04){var _0x10432e={},_0x5c4323={},_0x44e82c={'count':0x0,'rows':[]};var _0x580c2b=_[_0x68bc('0x26')](db['Integration'][_0x68bc('0x27')],function(_0x36a80a){return{'name':_0x36a80a[_0x68bc('0x28')],'type':_0x36a80a[_0x68bc('0x29')][_0x68bc('0x2a')]};});_0x5c4323[_0x68bc('0x2b')]=_[_0x68bc('0x26')](_0x580c2b,_0x68bc('0x23'));_0x5c4323[_0x68bc('0x2c')]=_[_0x68bc('0x2d')](_0xbe980c['query']);_0x5c4323['filters']=_['intersection'](_0x5c4323[_0x68bc('0x2b')],_0x5c4323[_0x68bc('0x2c')]);_0x10432e[_0x68bc('0x2e')]=_[_0x68bc('0x2f')](_0x5c4323[_0x68bc('0x2b')],qs[_0x68bc('0x30')](_0xbe980c[_0x68bc('0x2c')][_0x68bc('0x30')]));_0x10432e[_0x68bc('0x2e')]=_0x10432e[_0x68bc('0x2e')][_0x68bc('0x31')]?_0x10432e[_0x68bc('0x2e')]:_0x5c4323[_0x68bc('0x2b')];if(!_0xbe980c[_0x68bc('0x2c')][_0x68bc('0x32')](_0x68bc('0x33'))){_0x10432e[_0x68bc('0x34')]=qs[_0x68bc('0x34')](_0xbe980c[_0x68bc('0x2c')][_0x68bc('0x34')]);_0x10432e[_0x68bc('0x1b')]=qs[_0x68bc('0x1b')](_0xbe980c['query'][_0x68bc('0x1b')]);}_0x10432e[_0x68bc('0x35')]=qs[_0x68bc('0x36')](_0xbe980c['query'][_0x68bc('0x36')]);_0x10432e[_0x68bc('0x37')]=qs[_0x68bc('0x38')](_['pick'](_0xbe980c['query'],_0x5c4323[_0x68bc('0x38')]),_0x580c2b);if(_0xbe980c['query'][_0x68bc('0x39')]){_0x10432e[_0x68bc('0x37')]=_[_0x68bc('0x3a')](_0x10432e[_0x68bc('0x37')],{'$or':_['map'](_0x580c2b,function(_0x2959cd){if(_0x2959cd[_0x68bc('0x29')]!==_0x68bc('0x3b')){var _0x26d9e8={};_0x26d9e8[_0x2959cd[_0x68bc('0x23')]]={'$like':'%'+_0xbe980c[_0x68bc('0x2c')]['filter']+'%'};return _0x26d9e8;}})});}_0x10432e=_[_0x68bc('0x3a')]({},_0x10432e,_0xbe980c['options']);var _0x41fc2a={'where':_0x10432e[_0x68bc('0x37')]};return db[_0x68bc('0x3c')][_0x68bc('0x3d')](_0x41fc2a)['then'](function(_0xcc16ae){_0x44e82c[_0x68bc('0x3d')]=_0xcc16ae;if(_0xbe980c[_0x68bc('0x2c')][_0x68bc('0x3e')]){_0x10432e[_0x68bc('0x3f')]=[{'all':!![]}];}return db[_0x68bc('0x3c')][_0x68bc('0x40')](_0x10432e);})[_0x68bc('0x21')](function(_0x1e3848){_0x44e82c[_0x68bc('0x41')]=_0x1e3848;return _0x44e82c;})[_0x68bc('0x21')](respondWithFilteredResult(_0x112e04,_0x10432e))[_0x68bc('0x42')](handleError(_0x112e04,null));};exports['show']=function(_0x3ad2e8,_0x4d48c2){var _0x3293bf={'raw':![],'where':{'id':_0x3ad2e8[_0x68bc('0x43')]['id']}},_0x3d3811={};_0x3d3811[_0x68bc('0x2b')]=_['keys'](db[_0x68bc('0x3c')][_0x68bc('0x27')]);_0x3d3811['query']=_[_0x68bc('0x2d')](_0x3ad2e8[_0x68bc('0x2c')]);_0x3d3811['filters']=_['intersection'](_0x3d3811[_0x68bc('0x2b')],_0x3d3811['query']);_0x3293bf[_0x68bc('0x2e')]=_[_0x68bc('0x2f')](_0x3d3811[_0x68bc('0x2b')],qs[_0x68bc('0x30')](_0x3ad2e8['query']['fields']));_0x3293bf[_0x68bc('0x2e')]=_0x3293bf[_0x68bc('0x2e')][_0x68bc('0x31')]?_0x3293bf[_0x68bc('0x2e')]:_0x3d3811[_0x68bc('0x2b')];if(_0x3ad2e8[_0x68bc('0x2c')][_0x68bc('0x3e')]){_0x3293bf[_0x68bc('0x3f')]=[{'all':!![]}];}_0x3293bf=_['merge']({},_0x3293bf,_0x3ad2e8['options']);return db[_0x68bc('0x3c')][_0x68bc('0x44')](_0x3293bf)[_0x68bc('0x21')](handleEntityNotFound(_0x4d48c2,null))[_0x68bc('0x21')](respondWithResult(_0x4d48c2,null))[_0x68bc('0x42')](handleError(_0x4d48c2,null));};exports[_0x68bc('0x45')]=function(_0x45e929,_0x178a20){return db[_0x68bc('0x3c')][_0x68bc('0x45')](_0x45e929[_0x68bc('0x46')],{})['then'](respondWithResult(_0x178a20,0xc9))['catch'](handleError(_0x178a20,null));};exports[_0x68bc('0x20')]=function(_0x452f27,_0x40efbd){if(_0x452f27[_0x68bc('0x46')]['id']){delete _0x452f27[_0x68bc('0x46')]['id'];}return db[_0x68bc('0x3c')][_0x68bc('0x44')]({'where':{'id':_0x452f27[_0x68bc('0x43')]['id']}})[_0x68bc('0x21')](handleEntityNotFound(_0x40efbd,null))['then'](saveUpdates(_0x452f27['body'],null))[_0x68bc('0x21')](respondWithResult(_0x40efbd,null))[_0x68bc('0x42')](handleError(_0x40efbd,null));};exports[_0x68bc('0x47')]=function(_0x3c6b5a,_0x1397f2){return db['Integration'][_0x68bc('0x44')]({'where':{'id':_0x3c6b5a[_0x68bc('0x43')]['id']}})[_0x68bc('0x21')](handleEntityNotFound(_0x1397f2,null))[_0x68bc('0x21')](removeEntity(_0x1397f2,null))[_0x68bc('0x42')](handleError(_0x1397f2,null));}; \ No newline at end of file +var _0xdb2b=['sort','pick','filter','where','map','type','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','reject','save','update','destroy','then','error','stack','name','Integration','rawAttributes','fieldName','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order'];(function(_0x5c490c,_0x17cc06){var _0x344996=function(_0x446176){while(--_0x446176){_0x5c490c['push'](_0x5c490c['shift']());}};_0x344996(++_0x17cc06);}(_0xdb2b,0xa2));var _0xbdb2=function(_0x4cdecc,_0x321d1a){_0x4cdecc=_0x4cdecc-0x0;var _0x3948a9=_0xdb2b[_0x4cdecc];return _0x3948a9;};'use strict';var pdf=require(_0xbdb2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbdb2('0x1'));var zipdir=require(_0xbdb2('0x2'));var jsonpatch=require(_0xbdb2('0x3'));var rp=require(_0xbdb2('0x4'));var moment=require(_0xbdb2('0x5'));var BPromise=require(_0xbdb2('0x6'));var Mustache=require(_0xbdb2('0x7'));var util=require(_0xbdb2('0x8'));var path=require(_0xbdb2('0x9'));var sox=require(_0xbdb2('0xa'));var csv=require(_0xbdb2('0xb'));var ejs=require(_0xbdb2('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbdb2('0xd'));var jsforce=require(_0xbdb2('0xe'));var deskjs=require(_0xbdb2('0xf'));var toCsv=require(_0xbdb2('0xb'));var querystring=require(_0xbdb2('0x10'));var Papa=require(_0xbdb2('0x11'));var Redis=require('ioredis');var authService=require(_0xbdb2('0x12'));var qs=require(_0xbdb2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbdb2('0x14'));var logger=require(_0xbdb2('0x15'))('api');var utils=require(_0xbdb2('0x16'));var config=require(_0xbdb2('0x17'));var licenseUtil=require(_0xbdb2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c9d96,_0xb5cd89){_0xb5cd89=_0xb5cd89||0xcc;return function(_0xca2f9){if(_0xca2f9){return _0x2c9d96[_0xbdb2('0x19')](_0xb5cd89);}return _0x2c9d96['status'](_0xb5cd89)[_0xbdb2('0x1a')]();};}function respondWithResult(_0x475ffd,_0x500f1c){_0x500f1c=_0x500f1c||0xc8;return function(_0x5a6acf){if(_0x5a6acf){return _0x475ffd[_0xbdb2('0x1b')](_0x500f1c)[_0xbdb2('0x1c')](_0x5a6acf);}};}function respondWithFilteredResult(_0x15cfc0,_0x3c7e7e){return function(_0x767ab6){if(_0x767ab6){var _0xc38bda=_0x767ab6[_0xbdb2('0x1d')],_0x197822=_0x3c7e7e['offset'],_0x41c2ce=_0x3c7e7e[_0xbdb2('0x1e')]+_0x3c7e7e[_0xbdb2('0x1f')],_0x49f013;if(_0x41c2ce>=_0xc38bda){_0x41c2ce=_0xc38bda;_0x49f013=0xc8;}else{_0x49f013=0xce;}_0x15cfc0[_0xbdb2('0x1b')](_0x49f013);return _0x15cfc0['set']('Content-Range',_0x197822+'-'+_0x41c2ce+'/'+_0xc38bda)[_0xbdb2('0x1c')](_0x767ab6);}return null;};}function patchUpdates(_0x2e9c01){return function(_0x5619e8){try{jsonpatch['apply'](_0x5619e8,_0x2e9c01,!![]);}catch(_0x59ac40){return BPromise[_0xbdb2('0x20')](_0x59ac40);}return _0x5619e8[_0xbdb2('0x21')]();};}function saveUpdates(_0x3a9629,_0x228881){return function(_0x4062d7){if(_0x4062d7){return _0x4062d7[_0xbdb2('0x22')](_0x3a9629)['then'](function(_0x31eb52){return _0x31eb52;});}return null;};}function removeEntity(_0x557117,_0x2e8697){return function(_0x5c21c4){if(_0x5c21c4){return _0x5c21c4[_0xbdb2('0x23')]()[_0xbdb2('0x24')](function(){_0x557117['status'](0xcc)[_0xbdb2('0x1a')]();});}};}function handleEntityNotFound(_0x1efb1d,_0x48a477){return function(_0x4481d5){if(!_0x4481d5){_0x1efb1d[_0xbdb2('0x19')](0x194);}return _0x4481d5;};}function handleError(_0xdbfbbb,_0x48dc74){_0x48dc74=_0x48dc74||0x1f4;return function(_0x560feb){logger[_0xbdb2('0x25')](_0x560feb[_0xbdb2('0x26')]);if(_0x560feb['name']){delete _0x560feb[_0xbdb2('0x27')];}_0xdbfbbb[_0xbdb2('0x1b')](_0x48dc74)['send'](_0x560feb);};}exports['index']=function(_0x4bb221,_0x50d69b){var _0x596704={},_0x45d1a1={},_0x442b94={'count':0x0,'rows':[]};var _0x121312=_['map'](db[_0xbdb2('0x28')][_0xbdb2('0x29')],function(_0x1ad65a){return{'name':_0x1ad65a[_0xbdb2('0x2a')],'type':_0x1ad65a['type']['key']};});_0x45d1a1['model']=_['map'](_0x121312,_0xbdb2('0x27'));_0x45d1a1[_0xbdb2('0x2b')]=_[_0xbdb2('0x2c')](_0x4bb221[_0xbdb2('0x2b')]);_0x45d1a1[_0xbdb2('0x2d')]=_[_0xbdb2('0x2e')](_0x45d1a1['model'],_0x45d1a1['query']);_0x596704[_0xbdb2('0x2f')]=_[_0xbdb2('0x2e')](_0x45d1a1[_0xbdb2('0x30')],qs[_0xbdb2('0x31')](_0x4bb221['query'][_0xbdb2('0x31')]));_0x596704[_0xbdb2('0x2f')]=_0x596704[_0xbdb2('0x2f')][_0xbdb2('0x32')]?_0x596704['attributes']:_0x45d1a1[_0xbdb2('0x30')];if(!_0x4bb221[_0xbdb2('0x2b')][_0xbdb2('0x33')](_0xbdb2('0x34'))){_0x596704[_0xbdb2('0x1f')]=qs[_0xbdb2('0x1f')](_0x4bb221[_0xbdb2('0x2b')]['limit']);_0x596704[_0xbdb2('0x1e')]=qs['offset'](_0x4bb221[_0xbdb2('0x2b')][_0xbdb2('0x1e')]);}_0x596704[_0xbdb2('0x35')]=qs[_0xbdb2('0x36')](_0x4bb221[_0xbdb2('0x2b')][_0xbdb2('0x36')]);_0x596704['where']=qs[_0xbdb2('0x2d')](_[_0xbdb2('0x37')](_0x4bb221[_0xbdb2('0x2b')],_0x45d1a1['filters']),_0x121312);if(_0x4bb221['query'][_0xbdb2('0x38')]){_0x596704[_0xbdb2('0x39')]=_['merge'](_0x596704[_0xbdb2('0x39')],{'$or':_[_0xbdb2('0x3a')](_0x121312,function(_0xf3b945){if(_0xf3b945[_0xbdb2('0x3b')]!=='VIRTUAL'){var _0x53f7e5={};_0x53f7e5[_0xf3b945[_0xbdb2('0x27')]]={'$like':'%'+_0x4bb221[_0xbdb2('0x2b')]['filter']+'%'};return _0x53f7e5;}})});}_0x596704=_[_0xbdb2('0x3c')]({},_0x596704,_0x4bb221[_0xbdb2('0x3d')]);var _0x33e735={'where':_0x596704[_0xbdb2('0x39')]};return db['Integration'][_0xbdb2('0x1d')](_0x33e735)[_0xbdb2('0x24')](function(_0x3b4b09){_0x442b94['count']=_0x3b4b09;if(_0x4bb221[_0xbdb2('0x2b')]['includeAll']){_0x596704[_0xbdb2('0x3e')]=[{'all':!![]}];}return db[_0xbdb2('0x28')][_0xbdb2('0x3f')](_0x596704);})['then'](function(_0x169a21){_0x442b94[_0xbdb2('0x40')]=_0x169a21;return _0x442b94;})[_0xbdb2('0x24')](respondWithFilteredResult(_0x50d69b,_0x596704))[_0xbdb2('0x41')](handleError(_0x50d69b,null));};exports[_0xbdb2('0x42')]=function(_0x36fba6,_0x272447){var _0x4e7b17={'raw':![],'where':{'id':_0x36fba6[_0xbdb2('0x43')]['id']}},_0x37ec13={};_0x37ec13['model']=_['keys'](db[_0xbdb2('0x28')][_0xbdb2('0x29')]);_0x37ec13[_0xbdb2('0x2b')]=_[_0xbdb2('0x2c')](_0x36fba6[_0xbdb2('0x2b')]);_0x37ec13[_0xbdb2('0x2d')]=_[_0xbdb2('0x2e')](_0x37ec13['model'],_0x37ec13['query']);_0x4e7b17['attributes']=_[_0xbdb2('0x2e')](_0x37ec13[_0xbdb2('0x30')],qs['fields'](_0x36fba6[_0xbdb2('0x2b')][_0xbdb2('0x31')]));_0x4e7b17[_0xbdb2('0x2f')]=_0x4e7b17[_0xbdb2('0x2f')][_0xbdb2('0x32')]?_0x4e7b17['attributes']:_0x37ec13['model'];if(_0x36fba6[_0xbdb2('0x2b')][_0xbdb2('0x44')]){_0x4e7b17['include']=[{'all':!![]}];}_0x4e7b17=_['merge']({},_0x4e7b17,_0x36fba6[_0xbdb2('0x3d')]);return db[_0xbdb2('0x28')][_0xbdb2('0x45')](_0x4e7b17)[_0xbdb2('0x24')](handleEntityNotFound(_0x272447,null))[_0xbdb2('0x24')](respondWithResult(_0x272447,null))[_0xbdb2('0x41')](handleError(_0x272447,null));};exports['create']=function(_0x13cd6b,_0x114085){return db['Integration'][_0xbdb2('0x46')](_0x13cd6b[_0xbdb2('0x47')],{})[_0xbdb2('0x24')](respondWithResult(_0x114085,0xc9))['catch'](handleError(_0x114085,null));};exports['update']=function(_0x452d05,_0x105582){if(_0x452d05[_0xbdb2('0x47')]['id']){delete _0x452d05[_0xbdb2('0x47')]['id'];}return db[_0xbdb2('0x28')][_0xbdb2('0x45')]({'where':{'id':_0x452d05[_0xbdb2('0x43')]['id']}})['then'](handleEntityNotFound(_0x105582,null))[_0xbdb2('0x24')](saveUpdates(_0x452d05[_0xbdb2('0x47')],null))[_0xbdb2('0x24')](respondWithResult(_0x105582,null))[_0xbdb2('0x41')](handleError(_0x105582,null));};exports['destroy']=function(_0x4d9f4d,_0x1c6159){return db[_0xbdb2('0x28')][_0xbdb2('0x45')]({'where':{'id':_0x4d9f4d['params']['id']}})[_0xbdb2('0x24')](handleEntityNotFound(_0x1c6159,null))[_0xbdb2('0x24')](removeEntity(_0x1c6159,null))[_0xbdb2('0x41')](handleError(_0x1c6159,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 2957d56..20459b5 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 _0xe40e=['path','rimraf','./integration.attributes','exports','Integration','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0xced98a,_0x5cb79a){var _0x2055db=function(_0x7c4807){while(--_0x7c4807){_0xced98a['push'](_0xced98a['shift']());}};_0x2055db(++_0x5cb79a);}(_0xe40e,0x17b));var _0xee40=function(_0x1d00c0,_0x4494a0){_0x1d00c0=_0x1d00c0-0x0;var _0x2a95ed=_0xe40e[_0x1d00c0];return _0x2a95ed;};'use strict';var _=require(_0xee40('0x0'));var util=require(_0xee40('0x1'));var logger=require(_0xee40('0x2'))(_0xee40('0x3'));var moment=require('moment');var BPromise=require(_0xee40('0x4'));var rp=require(_0xee40('0x5'));var fs=require('fs');var path=require(_0xee40('0x6'));var rimraf=require(_0xee40('0x7'));var config=require('../../config/environment');var attributes=require(_0xee40('0x8'));module[_0xee40('0x9')]=function(_0x535c76,_0x19ae2d){return _0x535c76['define'](_0xee40('0xa'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x593b=['define','integrations','lodash','api','bluebird','../../config/environment'];(function(_0x3e6016,_0x46f40f){var _0x2f2190=function(_0x288f26){while(--_0x288f26){_0x3e6016['push'](_0x3e6016['shift']());}};_0x2f2190(++_0x46f40f);}(_0x593b,0x1a6));var _0xb593=function(_0x160780,_0x30d0d3){_0x160780=_0x160780-0x0;var _0x45ae9e=_0x593b[_0x160780];return _0x45ae9e;};'use strict';var _=require(_0xb593('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb593('0x1'));var moment=require('moment');var BPromise=require(_0xb593('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb593('0x3'));var attributes=require('./integration.attributes');module['exports']=function(_0x5cf301,_0x214861){return _0x5cf301[_0xb593('0x4')]('Integration',attributes,{'tableName':_0xb593('0x5'),'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 1eed841..e174f26 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 _0xba2d=['catch','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','debug','error','code','message','result'];(function(_0x514ea9,_0x56d41d){var _0x4f5583=function(_0x2e882f){while(--_0x2e882f){_0x514ea9['push'](_0x514ea9['shift']());}};_0x4f5583(++_0x56d41d);}(_0xba2d,0xa3));var _0xdba2=function(_0x4b1406,_0x478742){_0x4b1406=_0x4b1406-0x0;var _0x505937=_0xba2d[_0x4b1406];return _0x505937;};'use strict';var _=require('lodash');var util=require(_0xdba2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdba2('0x1'));var logger=require(_0xdba2('0x2'))(_0xdba2('0x3'));var config=require(_0xdba2('0x4'));var jayson=require(_0xdba2('0x5'));var client=jayson[_0xdba2('0x6')][_0xdba2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x30328d,_0x4ead61,_0x3ab6cf){return new BPromise(function(_0x544945,_0x159887){return client[_0xdba2('0x8')](_0x30328d,_0x3ab6cf)[_0xdba2('0x9')](function(_0x3b1d25){logger[_0xdba2('0xa')](_0xdba2('0xb'),_0x4ead61,'request\x20sent');logger[_0xdba2('0xc')]('Integration,\x20%s,\x20%s,\x20%s',_0x4ead61,'request\x20sent',JSON['stringify'](_0x3b1d25));if(_0x3b1d25[_0xdba2('0xd')]){if(_0x3b1d25[_0xdba2('0xd')][_0xdba2('0xe')]===0x1f4){logger[_0xdba2('0xd')](_0xdba2('0xb'),_0x4ead61,_0x3b1d25[_0xdba2('0xd')][_0xdba2('0xf')]);return _0x159887(_0x3b1d25[_0xdba2('0xd')][_0xdba2('0xf')]);}logger[_0xdba2('0xd')](_0xdba2('0xb'),_0x4ead61,_0x3b1d25[_0xdba2('0xd')][_0xdba2('0xf')]);return _0x544945(_0x3b1d25[_0xdba2('0xd')][_0xdba2('0xf')]);}else{logger[_0xdba2('0xa')]('Integration,\x20%s,\x20%s',_0x4ead61,'request\x20sent');_0x544945(_0x3b1d25[_0xdba2('0x10')]['message']);}})[_0xdba2('0x11')](function(_0xc69b24){logger['error'](_0xdba2('0xb'),_0x4ead61,_0xc69b24);_0x159887(_0xc69b24);});});} \ No newline at end of file +var _0xac47=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x7a42d9,_0x5a0c72){var _0x278b78=function(_0x1fa030){while(--_0x1fa030){_0x7a42d9['push'](_0x7a42d9['shift']());}};_0x278b78(++_0x5a0c72);}(_0xac47,0x1af));var _0x7ac4=function(_0x3bcb7c,_0x5af870){_0x3bcb7c=_0x3bcb7c-0x0;var _0x584411=_0xac47[_0x3bcb7c];return _0x584411;};'use strict';var _=require(_0x7ac4('0x0'));var util=require(_0x7ac4('0x1'));var moment=require(_0x7ac4('0x2'));var BPromise=require(_0x7ac4('0x3'));var rs=require(_0x7ac4('0x4'));var fs=require('fs');var Redis=require(_0x7ac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ac4('0x6'));var logger=require(_0x7ac4('0x7'))('rpc');var config=require(_0x7ac4('0x8'));var jayson=require(_0x7ac4('0x9'));var client=jayson[_0x7ac4('0xa')][_0x7ac4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x438c8e,_0x5c3623,_0x18c34d){return new BPromise(function(_0x435e68,_0xd8ec5f){return client[_0x7ac4('0xc')](_0x438c8e,_0x18c34d)[_0x7ac4('0xd')](function(_0x112fa0){logger[_0x7ac4('0xe')](_0x7ac4('0xf'),_0x5c3623,_0x7ac4('0x10'));logger[_0x7ac4('0x11')](_0x7ac4('0x12'),_0x5c3623,'request\x20sent',JSON[_0x7ac4('0x13')](_0x112fa0));if(_0x112fa0[_0x7ac4('0x14')]){if(_0x112fa0[_0x7ac4('0x14')]['code']===0x1f4){logger[_0x7ac4('0x14')](_0x7ac4('0xf'),_0x5c3623,_0x112fa0[_0x7ac4('0x14')]['message']);return _0xd8ec5f(_0x112fa0['error'][_0x7ac4('0x15')]);}logger[_0x7ac4('0x14')]('Integration,\x20%s,\x20%s',_0x5c3623,_0x112fa0[_0x7ac4('0x14')][_0x7ac4('0x15')]);return _0x435e68(_0x112fa0[_0x7ac4('0x14')][_0x7ac4('0x15')]);}else{logger['info'](_0x7ac4('0xf'),_0x5c3623,_0x7ac4('0x10'));_0x435e68(_0x112fa0[_0x7ac4('0x16')][_0x7ac4('0x15')]);}})[_0x7ac4('0x17')](function(_0x334141){logger[_0x7ac4('0x14')](_0x7ac4('0xf'),_0x5c3623,_0x334141);_0xd8ec5f(_0x334141);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 3f99696..6947aff 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 _0xa09f=['./integrationReport.controller','isAuthenticated','index','/describe','get','/:id','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2dd8c1,_0x1d9b73){var _0xbc698=function(_0x34d0e2){while(--_0x34d0e2){_0x2dd8c1['push'](_0x2dd8c1['shift']());}};_0xbc698(++_0x1d9b73);}(_0xa09f,0x188));var _0xfa09=function(_0x52f5b8,_0x5c1859){_0x52f5b8=_0x52f5b8-0x0;var _0x55448d=_0xa09f[_0x52f5b8];return _0x55448d;};'use strict';var multer=require('multer');var util=require(_0xfa09('0x0'));var path=require(_0xfa09('0x1'));var timeout=require(_0xfa09('0x2'));var express=require(_0xfa09('0x3'));var router=express[_0xfa09('0x4')]();var auth=require(_0xfa09('0x5'));var interaction=require(_0xfa09('0x6'));var config=require(_0xfa09('0x7'));var controller=require(_0xfa09('0x8'));router['get']('/',auth[_0xfa09('0x9')](),controller[_0xfa09('0xa')]);router['get'](_0xfa09('0xb'),auth[_0xfa09('0x9')](),controller['describe']);router[_0xfa09('0xc')](_0xfa09('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xfa09('0xe')]('/',auth[_0xfa09('0x9')](),controller[_0xfa09('0xf')]);router[_0xfa09('0x10')](_0xfa09('0xd'),auth[_0xfa09('0x9')](),controller['update']);router[_0xfa09('0x11')](_0xfa09('0xd'),auth[_0xfa09('0x9')](),controller[_0xfa09('0x12')]);module[_0xfa09('0x13')]=router; \ No newline at end of file +var _0xaea2=['../../components/auth/service','isAuthenticated','index','/describe','describe','get','/:id','post','put','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x4f683e,_0x353322){var _0xc3cc7c=function(_0x2ee5eb){while(--_0x2ee5eb){_0x4f683e['push'](_0x4f683e['shift']());}};_0xc3cc7c(++_0x353322);}(_0xaea2,0x12c));var _0x2aea=function(_0x1e1d07,_0x299b1e){_0x1e1d07=_0x1e1d07-0x0;var _0x225dce=_0xaea2[_0x1e1d07];return _0x225dce;};'use strict';var multer=require(_0x2aea('0x0'));var util=require(_0x2aea('0x1'));var path=require(_0x2aea('0x2'));var timeout=require(_0x2aea('0x3'));var express=require(_0x2aea('0x4'));var router=express[_0x2aea('0x5')]();var auth=require(_0x2aea('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./integrationReport.controller');router['get']('/',auth[_0x2aea('0x7')](),controller[_0x2aea('0x8')]);router['get'](_0x2aea('0x9'),auth[_0x2aea('0x7')](),controller[_0x2aea('0xa')]);router[_0x2aea('0xb')](_0x2aea('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2aea('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2aea('0xe')]('/:id',auth[_0x2aea('0x7')](),controller['update']);router[_0x2aea('0xf')]('/:id',auth[_0x2aea('0x7')](),controller[_0x2aea('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 9f0d5bd..02527fc 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 _0xf68a=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','exports'];(function(_0x35323f,_0x3b5e1c){var _0x4f82f2=function(_0x57532e){while(--_0x57532e){_0x35323f['push'](_0x35323f['shift']());}};_0x4f82f2(++_0x3b5e1c);}(_0xf68a,0x1cc));var _0xaf68=function(_0x2006a5,_0x27bfc3){_0x2006a5=_0x2006a5-0x0;var _0x3dca52=_0xf68a[_0x2006a5];return _0x3dca52;};'use strict';var Sequelize=require(_0xaf68('0x0'));module[_0xaf68('0x1')]={'integration':{'type':Sequelize[_0xaf68('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xaf68('0x2')]},'ticketId':{'type':Sequelize[_0xaf68('0x2')]},'integrationId':{'type':Sequelize[_0xaf68('0x3')]},'contacts':{'type':Sequelize[_0xaf68('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xaf68('0x2')]},'queue':{'type':Sequelize[_0xaf68('0x2')]},'interface':{'type':Sequelize[_0xaf68('0x2')]},'membername':{'type':Sequelize[_0xaf68('0x2')]},'agentcalledAt':{'type':Sequelize[_0xaf68('0x4')]},'agentconnectAt':{'type':Sequelize[_0xaf68('0x4')]},'holdtime':{'type':Sequelize[_0xaf68('0x3')]},'agentcomplete':{'type':Sequelize[_0xaf68('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xaf68('0x4')]},'talktime':{'type':Sequelize[_0xaf68('0x3')]},'agentacw':{'type':Sequelize[_0xaf68('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xaf68('0x4')]},'agentdump':{'type':Sequelize[_0xaf68('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xaf68('0x4')]},'lastevent':{'type':Sequelize[_0xaf68('0x2')]},'channel':{'type':Sequelize[_0xaf68('0x2')]},'channelstate':{'type':Sequelize[_0xaf68('0x3')]},'channelstatedesc':{'type':Sequelize[_0xaf68('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xaf68('0x2')]},'language':{'type':Sequelize[_0xaf68('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xaf68('0x2')]},'exten':{'type':Sequelize[_0xaf68('0x2')]},'priority':{'type':Sequelize[_0xaf68('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xaf68('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xaf68('0x2')]},'destcalleridnum':{'type':Sequelize[_0xaf68('0x2')]},'destcalleridname':{'type':Sequelize[_0xaf68('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xaf68('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xaf68('0x2')]},'destlanguage':{'type':Sequelize[_0xaf68('0x2')]},'destaccountcode':{'type':Sequelize[_0xaf68('0x2')]},'destcontext':{'type':Sequelize[_0xaf68('0x2')]},'destexten':{'type':Sequelize[_0xaf68('0x2')]},'destpriority':{'type':Sequelize[_0xaf68('0x2')]},'destuniqueid':{'type':Sequelize[_0xaf68('0x2')]},'messageId':{'type':Sequelize[_0xaf68('0x2')]},'inReplyTo':{'type':Sequelize[_0xaf68('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xaf68('0x2')]},'to':{'type':Sequelize[_0xaf68('0x2')]},'cc':{'type':Sequelize[_0xaf68('0x2')]},'attachment':{'type':Sequelize[_0xaf68('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xaf68('0x6')]},'status':{'type':Sequelize[_0xaf68('0x7')](_0xaf68('0x8'),'SENDING',_0xaf68('0x9'),_0xaf68('0xa'))},'url':{'type':Sequelize[_0xaf68('0x2')]},'app':{'type':Sequelize[_0xaf68('0x2')]},'appdata':{'type':Sequelize[_0xaf68('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x0627=['INTEGER','BOOLEAN','DATE','TEXT','ENUM','SENT','SENDING','FAILED','sequelize','exports','STRING'];(function(_0x62ee5e,_0x5be856){var _0x1a1785=function(_0x33d801){while(--_0x33d801){_0x62ee5e['push'](_0x62ee5e['shift']());}};_0x1a1785(++_0x5be856);}(_0x0627,0x1ec));var _0x7062=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x0627[_0x2eb5bc];return _0x51c7b1;};'use strict';var Sequelize=require(_0x7062('0x0'));module[_0x7062('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x7062('0x2')]},'exitStatus':{'type':Sequelize[_0x7062('0x2')]},'ticketId':{'type':Sequelize[_0x7062('0x2')]},'integrationId':{'type':Sequelize[_0x7062('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7062('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7062('0x2')]},'queue':{'type':Sequelize[_0x7062('0x2')]},'interface':{'type':Sequelize[_0x7062('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x7062('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x7062('0x5')]},'talktime':{'type':Sequelize[_0x7062('0x3')]},'agentacw':{'type':Sequelize[_0x7062('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7062('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x7062('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x7062('0x5')]},'agentdump':{'type':Sequelize[_0x7062('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7062('0x2')]},'channelstate':{'type':Sequelize[_0x7062('0x3')]},'channelstatedesc':{'type':Sequelize[_0x7062('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x7062('0x2')]},'language':{'type':Sequelize[_0x7062('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7062('0x2')]},'exten':{'type':Sequelize[_0x7062('0x2')]},'priority':{'type':Sequelize[_0x7062('0x2')]},'destchannel':{'type':Sequelize[_0x7062('0x2')]},'destchannelstate':{'type':Sequelize[_0x7062('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x7062('0x2')]},'destcalleridnum':{'type':Sequelize[_0x7062('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x7062('0x2')]},'destlanguage':{'type':Sequelize[_0x7062('0x2')]},'destaccountcode':{'type':Sequelize[_0x7062('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x7062('0x2')]},'destpriority':{'type':Sequelize[_0x7062('0x2')]},'destuniqueid':{'type':Sequelize[_0x7062('0x2')]},'messageId':{'type':Sequelize[_0x7062('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x7062('0x2')]},'to':{'type':Sequelize[_0x7062('0x2')]},'cc':{'type':Sequelize[_0x7062('0x2')]},'attachment':{'type':Sequelize[_0x7062('0x6')]},'html':{'type':Sequelize[_0x7062('0x6')]},'text':{'type':Sequelize[_0x7062('0x6')]},'status':{'type':Sequelize[_0x7062('0x7')](_0x7062('0x8'),_0x7062('0x9'),'RECEIVED',_0x7062('0xa'))},'url':{'type':Sequelize[_0x7062('0x2')]},'app':{'type':Sequelize[_0x7062('0x2')]},'appdata':{'type':Sequelize[_0x7062('0x2')]},'projectId':{'type':Sequelize[_0x7062('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 03cd0b3..57654db 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 _0x6ebf=['options','includeAll','include','rows','show','params','find','create','body','catch','update','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','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','count','offset','Content-Range','json','apply','reject','save','then','stack','name','index','map','IntegrationReport','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge'];(function(_0x17852a,_0x4cb1af){var _0x38a1b1=function(_0x313418){while(--_0x313418){_0x17852a['push'](_0x17852a['shift']());}};_0x38a1b1(++_0x4cb1af);}(_0x6ebf,0x1cf));var _0xf6eb=function(_0x3fb5eb,_0x5947a6){_0x3fb5eb=_0x3fb5eb-0x0;var _0x481291=_0x6ebf[_0x3fb5eb];return _0x481291;};'use strict';var pdf=require(_0xf6eb('0x0'));var emlformat=require(_0xf6eb('0x1'));var rimraf=require(_0xf6eb('0x2'));var zipdir=require(_0xf6eb('0x3'));var jsonpatch=require(_0xf6eb('0x4'));var rp=require(_0xf6eb('0x5'));var moment=require(_0xf6eb('0x6'));var BPromise=require(_0xf6eb('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf6eb('0x8'));var sox=require(_0xf6eb('0x9'));var csv=require(_0xf6eb('0xa'));var ejs=require(_0xf6eb('0xb'));var fs=require('fs');var _=require(_0xf6eb('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf6eb('0xd'));var toCsv=require(_0xf6eb('0xa'));var querystring=require(_0xf6eb('0xe'));var Papa=require(_0xf6eb('0xf'));var Redis=require(_0xf6eb('0x10'));var authService=require(_0xf6eb('0x11'));var qs=require(_0xf6eb('0x12'));var as=require(_0xf6eb('0x13'));var hardwareService=require(_0xf6eb('0x14'));var logger=require(_0xf6eb('0x15'))(_0xf6eb('0x16'));var utils=require(_0xf6eb('0x17'));var config=require(_0xf6eb('0x18'));var licenseUtil=require(_0xf6eb('0x19'));var db=require(_0xf6eb('0x1a'))['db'];function respondWithStatusCode(_0x134bd6,_0x3a5749){_0x3a5749=_0x3a5749||0xcc;return function(_0x40bec5){if(_0x40bec5){return _0x134bd6[_0xf6eb('0x1b')](_0x3a5749);}return _0x134bd6[_0xf6eb('0x1c')](_0x3a5749)[_0xf6eb('0x1d')]();};}function respondWithResult(_0x4feebb,_0x5ca3c1){_0x5ca3c1=_0x5ca3c1||0xc8;return function(_0xdd062b){if(_0xdd062b){return _0x4feebb['status'](_0x5ca3c1)['json'](_0xdd062b);}};}function respondWithFilteredResult(_0xb6e69a,_0x55e4be){return function(_0x2872dd){if(_0x2872dd){var _0x282c5d=_0x2872dd[_0xf6eb('0x1e')],_0x425f0b=_0x55e4be[_0xf6eb('0x1f')],_0x4d95d5=_0x55e4be[_0xf6eb('0x1f')]+_0x55e4be['limit'],_0x4441a8;if(_0x4d95d5>=_0x282c5d){_0x4d95d5=_0x282c5d;_0x4441a8=0xc8;}else{_0x4441a8=0xce;}_0xb6e69a[_0xf6eb('0x1c')](_0x4441a8);return _0xb6e69a['set'](_0xf6eb('0x20'),_0x425f0b+'-'+_0x4d95d5+'/'+_0x282c5d)[_0xf6eb('0x21')](_0x2872dd);}return null;};}function patchUpdates(_0x538ef6){return function(_0x15a9e8){try{jsonpatch[_0xf6eb('0x22')](_0x15a9e8,_0x538ef6,!![]);}catch(_0x12df87){return BPromise[_0xf6eb('0x23')](_0x12df87);}return _0x15a9e8[_0xf6eb('0x24')]();};}function saveUpdates(_0x1bd66f,_0x297385){return function(_0x3e8fc6){if(_0x3e8fc6){return _0x3e8fc6['update'](_0x1bd66f)[_0xf6eb('0x25')](function(_0x26a95a){return _0x26a95a;});}return null;};}function removeEntity(_0x21911b,_0x52ddfe){return function(_0xdd66fb){if(_0xdd66fb){return _0xdd66fb['destroy']()[_0xf6eb('0x25')](function(){_0x21911b[_0xf6eb('0x1c')](0xcc)[_0xf6eb('0x1d')]();});}};}function handleEntityNotFound(_0x2edf81,_0x332648){return function(_0x7f0c59){if(!_0x7f0c59){_0x2edf81['sendStatus'](0x194);}return _0x7f0c59;};}function handleError(_0x452c32,_0x18f0b1){_0x18f0b1=_0x18f0b1||0x1f4;return function(_0xe6964c){logger['error'](_0xe6964c[_0xf6eb('0x26')]);if(_0xe6964c[_0xf6eb('0x27')]){delete _0xe6964c[_0xf6eb('0x27')];}_0x452c32[_0xf6eb('0x1c')](_0x18f0b1)['send'](_0xe6964c);};}exports[_0xf6eb('0x28')]=function(_0x1fcbd1,_0x5d8e98){var _0x5a5405={},_0x5df8eb={},_0x1ba49a={'count':0x0,'rows':[]};var _0x44224e=_[_0xf6eb('0x29')](db[_0xf6eb('0x2a')][_0xf6eb('0x2b')],function(_0x2e5962){return{'name':_0x2e5962['fieldName'],'type':_0x2e5962[_0xf6eb('0x2c')]['key']};});_0x5df8eb[_0xf6eb('0x2d')]=_['map'](_0x44224e,_0xf6eb('0x27'));_0x5df8eb['query']=_[_0xf6eb('0x2e')](_0x1fcbd1[_0xf6eb('0x2f')]);_0x5df8eb[_0xf6eb('0x30')]=_[_0xf6eb('0x31')](_0x5df8eb[_0xf6eb('0x2d')],_0x5df8eb[_0xf6eb('0x2f')]);_0x5a5405[_0xf6eb('0x32')]=_['intersection'](_0x5df8eb['model'],qs[_0xf6eb('0x33')](_0x1fcbd1[_0xf6eb('0x2f')][_0xf6eb('0x33')]));_0x5a5405[_0xf6eb('0x32')]=_0x5a5405['attributes'][_0xf6eb('0x34')]?_0x5a5405[_0xf6eb('0x32')]:_0x5df8eb['model'];if(!_0x1fcbd1[_0xf6eb('0x2f')][_0xf6eb('0x35')](_0xf6eb('0x36'))){_0x5a5405[_0xf6eb('0x37')]=qs[_0xf6eb('0x37')](_0x1fcbd1[_0xf6eb('0x2f')][_0xf6eb('0x37')]);_0x5a5405[_0xf6eb('0x1f')]=qs['offset'](_0x1fcbd1[_0xf6eb('0x2f')]['offset']);}_0x5a5405[_0xf6eb('0x38')]=qs['sort'](_0x1fcbd1['query'][_0xf6eb('0x39')]);_0x5a5405['where']=qs[_0xf6eb('0x30')](_[_0xf6eb('0x3a')](_0x1fcbd1[_0xf6eb('0x2f')],_0x5df8eb[_0xf6eb('0x30')]),_0x44224e);if(_0x1fcbd1[_0xf6eb('0x2f')][_0xf6eb('0x3b')]){_0x5a5405[_0xf6eb('0x3c')]=_[_0xf6eb('0x3d')](_0x5a5405['where'],{'$or':_['map'](_0x44224e,function(_0x1afae4){if(_0x1afae4[_0xf6eb('0x2c')]!=='VIRTUAL'){var _0x90a2b3={};_0x90a2b3[_0x1afae4[_0xf6eb('0x27')]]={'$like':'%'+_0x1fcbd1[_0xf6eb('0x2f')][_0xf6eb('0x3b')]+'%'};return _0x90a2b3;}})});}_0x5a5405=_['merge']({},_0x5a5405,_0x1fcbd1[_0xf6eb('0x3e')]);var _0x31e73d={'where':_0x5a5405['where']};return db[_0xf6eb('0x2a')][_0xf6eb('0x1e')](_0x31e73d)['then'](function(_0x3f97a9){_0x1ba49a[_0xf6eb('0x1e')]=_0x3f97a9;if(_0x1fcbd1[_0xf6eb('0x2f')][_0xf6eb('0x3f')]){_0x5a5405[_0xf6eb('0x40')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x5a5405);})[_0xf6eb('0x25')](function(_0x136c38){_0x1ba49a[_0xf6eb('0x41')]=_0x136c38;return _0x1ba49a;})[_0xf6eb('0x25')](respondWithFilteredResult(_0x5d8e98,_0x5a5405))['catch'](handleError(_0x5d8e98,null));};exports[_0xf6eb('0x42')]=function(_0x4772d9,_0xcaf891){var _0x5f42a1={'raw':![],'where':{'id':_0x4772d9[_0xf6eb('0x43')]['id']}},_0x45e61d={};_0x45e61d[_0xf6eb('0x2d')]=_[_0xf6eb('0x2e')](db[_0xf6eb('0x2a')][_0xf6eb('0x2b')]);_0x45e61d['query']=_[_0xf6eb('0x2e')](_0x4772d9[_0xf6eb('0x2f')]);_0x45e61d[_0xf6eb('0x30')]=_['intersection'](_0x45e61d[_0xf6eb('0x2d')],_0x45e61d[_0xf6eb('0x2f')]);_0x5f42a1[_0xf6eb('0x32')]=_[_0xf6eb('0x31')](_0x45e61d[_0xf6eb('0x2d')],qs[_0xf6eb('0x33')](_0x4772d9['query'][_0xf6eb('0x33')]));_0x5f42a1['attributes']=_0x5f42a1[_0xf6eb('0x32')][_0xf6eb('0x34')]?_0x5f42a1[_0xf6eb('0x32')]:_0x45e61d[_0xf6eb('0x2d')];if(_0x4772d9[_0xf6eb('0x2f')][_0xf6eb('0x3f')]){_0x5f42a1[_0xf6eb('0x40')]=[{'all':!![]}];}_0x5f42a1=_[_0xf6eb('0x3d')]({},_0x5f42a1,_0x4772d9[_0xf6eb('0x3e')]);return db[_0xf6eb('0x2a')][_0xf6eb('0x44')](_0x5f42a1)[_0xf6eb('0x25')](handleEntityNotFound(_0xcaf891,null))[_0xf6eb('0x25')](respondWithResult(_0xcaf891,null))['catch'](handleError(_0xcaf891,null));};exports[_0xf6eb('0x45')]=function(_0x54e6b3,_0x3f98c9){return db[_0xf6eb('0x2a')][_0xf6eb('0x45')](_0x54e6b3[_0xf6eb('0x46')],{})[_0xf6eb('0x25')](respondWithResult(_0x3f98c9,0xc9))[_0xf6eb('0x47')](handleError(_0x3f98c9,null));};exports[_0xf6eb('0x48')]=function(_0x3504b9,_0x2dd435){if(_0x3504b9[_0xf6eb('0x46')]['id']){delete _0x3504b9[_0xf6eb('0x46')]['id'];}return db[_0xf6eb('0x2a')][_0xf6eb('0x44')]({'where':{'id':_0x3504b9[_0xf6eb('0x43')]['id']}})[_0xf6eb('0x25')](handleEntityNotFound(_0x2dd435,null))['then'](saveUpdates(_0x3504b9[_0xf6eb('0x46')],null))[_0xf6eb('0x25')](respondWithResult(_0x2dd435,null))[_0xf6eb('0x47')](handleError(_0x2dd435,null));};exports[_0xf6eb('0x49')]=function(_0x1e412e,_0x3d6b11){return db['IntegrationReport']['find']({'where':{'id':_0x1e412e[_0xf6eb('0x43')]['id']}})['then'](handleEntityNotFound(_0x3d6b11,null))[_0xf6eb('0x25')](removeEntity(_0x3d6b11,null))[_0xf6eb('0x47')](handleError(_0x3d6b11,null));};exports[_0xf6eb('0x4a')]=function(_0x56271a,_0xe86c9e){return db['IntegrationReport'][_0xf6eb('0x4a')]()[_0xf6eb('0x25')](respondWithResult(_0xe86c9e,null))[_0xf6eb('0x47')](handleError(_0xe86c9e,null));}; \ No newline at end of file +var _0xc9f3=['error','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','html-pdf','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy'];(function(_0x55e7ae,_0x328d98){var _0x4c19bd=function(_0x52a04c){while(--_0x52a04c){_0x55e7ae['push'](_0x55e7ae['shift']());}};_0x4c19bd(++_0x328d98);}(_0xc9f3,0x103));var _0x3c9f=function(_0x304fe3,_0x4d4fe8){_0x304fe3=_0x304fe3-0x0;var _0xad2fde=_0xc9f3[_0x304fe3];return _0xad2fde;};'use strict';var pdf=require(_0x3c9f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3c9f('0x1'));var zipdir=require(_0x3c9f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c9f('0x3'));var moment=require(_0x3c9f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3c9f('0x5'));var path=require(_0x3c9f('0x6'));var sox=require(_0x3c9f('0x7'));var csv=require(_0x3c9f('0x8'));var ejs=require(_0x3c9f('0x9'));var fs=require('fs');var _=require(_0x3c9f('0xa'));var squel=require(_0x3c9f('0xb'));var crypto=require(_0x3c9f('0xc'));var jsforce=require(_0x3c9f('0xd'));var deskjs=require(_0x3c9f('0xe'));var toCsv=require(_0x3c9f('0x8'));var querystring=require(_0x3c9f('0xf'));var Papa=require(_0x3c9f('0x10'));var Redis=require('ioredis');var authService=require(_0x3c9f('0x11'));var qs=require(_0x3c9f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3c9f('0x13'));var utils=require(_0x3c9f('0x14'));var config=require(_0x3c9f('0x15'));var licenseUtil=require(_0x3c9f('0x16'));var db=require(_0x3c9f('0x17'))['db'];function respondWithStatusCode(_0x3ecbdc,_0x173895){_0x173895=_0x173895||0xcc;return function(_0x31f891){if(_0x31f891){return _0x3ecbdc[_0x3c9f('0x18')](_0x173895);}return _0x3ecbdc[_0x3c9f('0x19')](_0x173895)[_0x3c9f('0x1a')]();};}function respondWithResult(_0x27d746,_0x4ddc9d){_0x4ddc9d=_0x4ddc9d||0xc8;return function(_0x541c45){if(_0x541c45){return _0x27d746[_0x3c9f('0x19')](_0x4ddc9d)[_0x3c9f('0x1b')](_0x541c45);}};}function respondWithFilteredResult(_0x1531d9,_0x3da72c){return function(_0x46f83a){if(_0x46f83a){var _0x3bf95b=_0x46f83a[_0x3c9f('0x1c')],_0x3ec8ff=_0x3da72c[_0x3c9f('0x1d')],_0x3211ed=_0x3da72c['offset']+_0x3da72c['limit'],_0x6ff13b;if(_0x3211ed>=_0x3bf95b){_0x3211ed=_0x3bf95b;_0x6ff13b=0xc8;}else{_0x6ff13b=0xce;}_0x1531d9[_0x3c9f('0x19')](_0x6ff13b);return _0x1531d9[_0x3c9f('0x1e')](_0x3c9f('0x1f'),_0x3ec8ff+'-'+_0x3211ed+'/'+_0x3bf95b)[_0x3c9f('0x1b')](_0x46f83a);}return null;};}function patchUpdates(_0x40d6c5){return function(_0x1913a8){try{jsonpatch['apply'](_0x1913a8,_0x40d6c5,!![]);}catch(_0x1de46f){return BPromise[_0x3c9f('0x20')](_0x1de46f);}return _0x1913a8[_0x3c9f('0x21')]();};}function saveUpdates(_0x332b90,_0x56ed86){return function(_0x4a83a9){if(_0x4a83a9){return _0x4a83a9[_0x3c9f('0x22')](_0x332b90)[_0x3c9f('0x23')](function(_0x4bfae9){return _0x4bfae9;});}return null;};}function removeEntity(_0x50414c,_0x1227dc){return function(_0x99589b){if(_0x99589b){return _0x99589b[_0x3c9f('0x24')]()[_0x3c9f('0x23')](function(){_0x50414c[_0x3c9f('0x19')](0xcc)[_0x3c9f('0x1a')]();});}};}function handleEntityNotFound(_0x5a2025,_0x2e8187){return function(_0x465f74){if(!_0x465f74){_0x5a2025[_0x3c9f('0x18')](0x194);}return _0x465f74;};}function handleError(_0xc9b2a0,_0x18cd87){_0x18cd87=_0x18cd87||0x1f4;return function(_0x54ad3c){logger[_0x3c9f('0x25')](_0x54ad3c['stack']);if(_0x54ad3c[_0x3c9f('0x26')]){delete _0x54ad3c[_0x3c9f('0x26')];}_0xc9b2a0['status'](_0x18cd87)[_0x3c9f('0x27')](_0x54ad3c);};}exports[_0x3c9f('0x28')]=function(_0x53a3e2,_0x4fbc90){var _0x168b01={},_0x3ae352={},_0x2e74eb={'count':0x0,'rows':[]};var _0x26f8b5=_[_0x3c9f('0x29')](db[_0x3c9f('0x2a')][_0x3c9f('0x2b')],function(_0x489d4e){return{'name':_0x489d4e[_0x3c9f('0x2c')],'type':_0x489d4e[_0x3c9f('0x2d')]['key']};});_0x3ae352[_0x3c9f('0x2e')]=_['map'](_0x26f8b5,_0x3c9f('0x26'));_0x3ae352[_0x3c9f('0x2f')]=_[_0x3c9f('0x30')](_0x53a3e2[_0x3c9f('0x2f')]);_0x3ae352[_0x3c9f('0x31')]=_[_0x3c9f('0x32')](_0x3ae352[_0x3c9f('0x2e')],_0x3ae352[_0x3c9f('0x2f')]);_0x168b01[_0x3c9f('0x33')]=_[_0x3c9f('0x32')](_0x3ae352[_0x3c9f('0x2e')],qs[_0x3c9f('0x34')](_0x53a3e2[_0x3c9f('0x2f')]['fields']));_0x168b01[_0x3c9f('0x33')]=_0x168b01[_0x3c9f('0x33')][_0x3c9f('0x35')]?_0x168b01['attributes']:_0x3ae352['model'];if(!_0x53a3e2['query'][_0x3c9f('0x36')](_0x3c9f('0x37'))){_0x168b01[_0x3c9f('0x38')]=qs['limit'](_0x53a3e2[_0x3c9f('0x2f')]['limit']);_0x168b01[_0x3c9f('0x1d')]=qs[_0x3c9f('0x1d')](_0x53a3e2[_0x3c9f('0x2f')][_0x3c9f('0x1d')]);}_0x168b01['order']=qs[_0x3c9f('0x39')](_0x53a3e2['query'][_0x3c9f('0x39')]);_0x168b01['where']=qs[_0x3c9f('0x31')](_['pick'](_0x53a3e2[_0x3c9f('0x2f')],_0x3ae352['filters']),_0x26f8b5);if(_0x53a3e2[_0x3c9f('0x2f')][_0x3c9f('0x3a')]){_0x168b01[_0x3c9f('0x3b')]=_[_0x3c9f('0x3c')](_0x168b01[_0x3c9f('0x3b')],{'$or':_[_0x3c9f('0x29')](_0x26f8b5,function(_0x1788fc){if(_0x1788fc[_0x3c9f('0x2d')]!==_0x3c9f('0x3d')){var _0x70a3e6={};_0x70a3e6[_0x1788fc[_0x3c9f('0x26')]]={'$like':'%'+_0x53a3e2[_0x3c9f('0x2f')][_0x3c9f('0x3a')]+'%'};return _0x70a3e6;}})});}_0x168b01=_[_0x3c9f('0x3c')]({},_0x168b01,_0x53a3e2[_0x3c9f('0x3e')]);var _0x4555fa={'where':_0x168b01[_0x3c9f('0x3b')]};return db[_0x3c9f('0x2a')][_0x3c9f('0x1c')](_0x4555fa)[_0x3c9f('0x23')](function(_0x12ca57){_0x2e74eb[_0x3c9f('0x1c')]=_0x12ca57;if(_0x53a3e2['query'][_0x3c9f('0x3f')]){_0x168b01[_0x3c9f('0x40')]=[{'all':!![]}];}return db[_0x3c9f('0x2a')][_0x3c9f('0x41')](_0x168b01);})['then'](function(_0x9f938){_0x2e74eb[_0x3c9f('0x42')]=_0x9f938;return _0x2e74eb;})['then'](respondWithFilteredResult(_0x4fbc90,_0x168b01))[_0x3c9f('0x43')](handleError(_0x4fbc90,null));};exports[_0x3c9f('0x44')]=function(_0x22ce38,_0x22b788){var _0x2db057={'raw':![],'where':{'id':_0x22ce38[_0x3c9f('0x45')]['id']}},_0x408a6d={};_0x408a6d[_0x3c9f('0x2e')]=_['keys'](db[_0x3c9f('0x2a')][_0x3c9f('0x2b')]);_0x408a6d['query']=_[_0x3c9f('0x30')](_0x22ce38['query']);_0x408a6d['filters']=_['intersection'](_0x408a6d['model'],_0x408a6d[_0x3c9f('0x2f')]);_0x2db057[_0x3c9f('0x33')]=_[_0x3c9f('0x32')](_0x408a6d[_0x3c9f('0x2e')],qs[_0x3c9f('0x34')](_0x22ce38[_0x3c9f('0x2f')]['fields']));_0x2db057[_0x3c9f('0x33')]=_0x2db057['attributes']['length']?_0x2db057[_0x3c9f('0x33')]:_0x408a6d[_0x3c9f('0x2e')];if(_0x22ce38['query'][_0x3c9f('0x3f')]){_0x2db057['include']=[{'all':!![]}];}_0x2db057=_[_0x3c9f('0x3c')]({},_0x2db057,_0x22ce38[_0x3c9f('0x3e')]);return db[_0x3c9f('0x2a')]['find'](_0x2db057)[_0x3c9f('0x23')](handleEntityNotFound(_0x22b788,null))[_0x3c9f('0x23')](respondWithResult(_0x22b788,null))[_0x3c9f('0x43')](handleError(_0x22b788,null));};exports[_0x3c9f('0x46')]=function(_0x3a231,_0x452587){return db[_0x3c9f('0x2a')][_0x3c9f('0x46')](_0x3a231[_0x3c9f('0x47')],{})[_0x3c9f('0x23')](respondWithResult(_0x452587,0xc9))[_0x3c9f('0x43')](handleError(_0x452587,null));};exports['update']=function(_0x472be4,_0x414cc4){if(_0x472be4[_0x3c9f('0x47')]['id']){delete _0x472be4[_0x3c9f('0x47')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x472be4[_0x3c9f('0x45')]['id']}})[_0x3c9f('0x23')](handleEntityNotFound(_0x414cc4,null))[_0x3c9f('0x23')](saveUpdates(_0x472be4['body'],null))['then'](respondWithResult(_0x414cc4,null))[_0x3c9f('0x43')](handleError(_0x414cc4,null));};exports[_0x3c9f('0x24')]=function(_0x4e5d11,_0x7794e8){return db[_0x3c9f('0x2a')][_0x3c9f('0x48')]({'where':{'id':_0x4e5d11[_0x3c9f('0x45')]['id']}})['then'](handleEntityNotFound(_0x7794e8,null))[_0x3c9f('0x23')](removeEntity(_0x7794e8,null))[_0x3c9f('0x43')](handleError(_0x7794e8,null));};exports[_0x3c9f('0x49')]=function(_0x4c5838,_0x38b167){return db[_0x3c9f('0x2a')]['describe']()['then'](respondWithResult(_0x38b167,null))['catch'](handleError(_0x38b167,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 7283709..f8b75dc 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 _0x5471=['api','bluebird','request-promise','rimraf','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5471,0x1c5));var _0x1547=function(_0x37ee76,_0x4408ba){_0x37ee76=_0x37ee76-0x0;var _0x1beec2=_0x5471[_0x37ee76];return _0x1beec2;};'use strict';var _=require(_0x1547('0x0'));var util=require(_0x1547('0x1'));var logger=require(_0x1547('0x2'))(_0x1547('0x3'));var moment=require('moment');var BPromise=require(_0x1547('0x4'));var rp=require(_0x1547('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1547('0x6'));var config=require('../../config/environment');var attributes=require(_0x1547('0x7'));module[_0x1547('0x8')]=function(_0x1590e9,_0x12da1d){return _0x1590e9[_0x1547('0x9')](_0x1547('0xa'),attributes,{'tableName':_0x1547('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d1e=['define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports'];(function(_0x3a3f0c,_0x174f79){var _0x184722=function(_0x4fb5c3){while(--_0x4fb5c3){_0x3a3f0c['push'](_0x3a3f0c['shift']());}};_0x184722(++_0x174f79);}(_0x0d1e,0x153));var _0xe0d1=function(_0x27dce9,_0x10d2f8){_0x27dce9=_0x27dce9-0x0;var _0x1fec31=_0x0d1e[_0x27dce9];return _0x1fec31;};'use strict';var _=require(_0xe0d1('0x0'));var util=require(_0xe0d1('0x1'));var logger=require(_0xe0d1('0x2'))(_0xe0d1('0x3'));var moment=require('moment');var BPromise=require(_0xe0d1('0x4'));var rp=require(_0xe0d1('0x5'));var fs=require('fs');var path=require(_0xe0d1('0x6'));var rimraf=require(_0xe0d1('0x7'));var config=require(_0xe0d1('0x8'));var attributes=require(_0xe0d1('0x9'));module[_0xe0d1('0xa')]=function(_0x27ad0a,_0x2567fd){return _0x27ad0a[_0xe0d1('0xb')](_0xe0d1('0xc'),attributes,{'tableName':_0xe0d1('0xd'),'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 ac58b42..217315d 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 _0xac4a=['IntegrationReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xac4a,0x13f));var _0xaac4=function(_0x498886,_0x21606a){_0x498886=_0x498886-0x0;var _0x10e8d5=_0xac4a[_0x498886];return _0x10e8d5;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('IntegrationReport,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('IntegrationReport,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0x757a=['request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x535284,_0xc17857){var _0x58c3fb=function(_0x39aa0c){while(--_0x39aa0c){_0x535284['push'](_0x535284['shift']());}};_0x58c3fb(++_0xc17857);}(_0x757a,0xde));var _0xa757=function(_0x389405,_0x58761e){_0x389405=_0x389405-0x0;var _0x5f12cc=_0x757a[_0x389405];return _0x5f12cc;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index d41ee07..5ffc746 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 _0xedd9=['getIntervals','post','addInterval','addIntervals','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/sub_intervals'];(function(_0x527524,_0x38c58e){var _0x1bc4d0=function(_0x19c43d){while(--_0x19c43d){_0x527524['push'](_0x527524['shift']());}};_0x1bc4d0(++_0x38c58e);}(_0xedd9,0xfc));var _0x9edd=function(_0x21ec08,_0x5a79f9){_0x21ec08=_0x21ec08-0x0;var _0x47c5fc=_0xedd9[_0x21ec08];return _0x47c5fc;};'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 auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./interval.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0x8')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router['post']('/',auth[_0x9edd('0x9')](),controller['create']);router[_0x9edd('0xd')](_0x9edd('0xb'),auth['isAuthenticated'](),controller[_0x9edd('0xe')]);router[_0x9edd('0xd')]('/:id/sub_intervals/create_many',auth[_0x9edd('0x9')](),controller[_0x9edd('0xf')]);router[_0x9edd('0x10')](_0x9edd('0x11'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')](_0x9edd('0x11'),auth['isAuthenticated'](),controller[_0x9edd('0x14')]);module[_0x9edd('0x15')]=router; \ No newline at end of file +var _0xedd9=['getIntervals','post','addInterval','addIntervals','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/sub_intervals'];(function(_0x4d3874,_0x2ba7b9){var _0x5aa0da=function(_0x20f68d){while(--_0x20f68d){_0x4d3874['push'](_0x4d3874['shift']());}};_0x5aa0da(++_0x2ba7b9);}(_0xedd9,0xfc));var _0x9edd=function(_0x1810b8,_0x3ad751){_0x1810b8=_0x1810b8-0x0;var _0x216864=_0xedd9[_0x1810b8];return _0x216864;};'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 auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./interval.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0x8')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router['post']('/',auth[_0x9edd('0x9')](),controller['create']);router[_0x9edd('0xd')](_0x9edd('0xb'),auth['isAuthenticated'](),controller[_0x9edd('0xe')]);router[_0x9edd('0xd')]('/:id/sub_intervals/create_many',auth[_0x9edd('0x9')](),controller[_0x9edd('0xf')]);router[_0x9edd('0x10')](_0x9edd('0x11'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')](_0x9edd('0x11'),auth['isAuthenticated'](),controller[_0x9edd('0x14')]);module[_0x9edd('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 0599282..bc3c732 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 _0x4b61=['exports','STRING'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4b61,0x9a));var _0x14b6=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0x4b61[_0x54defc];return _0x1955d3;};'use strict';var Sequelize=require('sequelize');module[_0x14b6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x14b6('0x1')]},'interval':{'type':Sequelize[_0x14b6('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x6ff5=['exports','STRING','sequelize'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6ff5,0x1eb));var _0x56ff=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x6ff5[_0xbd08b4];return _0x314f1e;};'use strict';var Sequelize=require(_0x56ff('0x0'));module[_0x56ff('0x1')]={'name':{'type':Sequelize[_0x56ff('0x2')]},'description':{'type':Sequelize[_0x56ff('0x2')]},'interval':{'type':Sequelize[_0x56ff('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index f22bc93..27c8bd2 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 _0x1c24=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','offset','limit','Content-Range','json','apply','update','then','destroy','get','Intervals','UserProfileResource','end','stack','name','send','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Interval','count','includeAll','include','findAll','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','body','addInterval','IntervalId','getIntervals','nolimit','addIntervals','findOne','bulkCreate','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','querystring','papaparse','ioredis'];(function(_0x910b22,_0x57e873){var _0x1f594d=function(_0x19dfa3){while(--_0x19dfa3){_0x910b22['push'](_0x910b22['shift']());}};_0x1f594d(++_0x57e873);}(_0x1c24,0x1ac));var _0x41c2=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x1c24[_0x580576];return _0x3f55a0;};'use strict';var pdf=require(_0x41c2('0x0'));var emlformat=require(_0x41c2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x41c2('0x2'));var jsonpatch=require(_0x41c2('0x3'));var rp=require(_0x41c2('0x4'));var moment=require(_0x41c2('0x5'));var BPromise=require(_0x41c2('0x6'));var Mustache=require(_0x41c2('0x7'));var util=require(_0x41c2('0x8'));var path=require(_0x41c2('0x9'));var sox=require(_0x41c2('0xa'));var csv=require(_0x41c2('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x41c2('0xc'));var squel=require('squel');var crypto=require(_0x41c2('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x41c2('0xb'));var querystring=require(_0x41c2('0xe'));var Papa=require(_0x41c2('0xf'));var Redis=require(_0x41c2('0x10'));var authService=require(_0x41c2('0x11'));var qs=require(_0x41c2('0x12'));var as=require(_0x41c2('0x13'));var hardwareService=require(_0x41c2('0x14'));var logger=require(_0x41c2('0x15'))(_0x41c2('0x16'));var utils=require(_0x41c2('0x17'));var config=require(_0x41c2('0x18'));var licenseUtil=require(_0x41c2('0x19'));var db=require(_0x41c2('0x1a'))['db'];var extensions=require(_0x41c2('0x1b'));function respondWithStatusCode(_0x44c4ec,_0x46747f){_0x46747f=_0x46747f||0xcc;return function(_0x530aa2){if(_0x530aa2){return _0x44c4ec[_0x41c2('0x1c')](_0x46747f);}return _0x44c4ec['status'](_0x46747f)['end']();};}function respondWithResult(_0x26823d,_0x3aa8eb){_0x3aa8eb=_0x3aa8eb||0xc8;return function(_0x3b0d66){if(_0x3b0d66){return _0x26823d[_0x41c2('0x1d')](_0x3aa8eb)['json'](_0x3b0d66);}};}function respondWithFilteredResult(_0x212071,_0x5d77d0){return function(_0x4d54ce){if(_0x4d54ce){var _0x545891=_0x4d54ce['count'],_0x434c4e=_0x5d77d0[_0x41c2('0x1e')],_0x573c2f=_0x5d77d0['offset']+_0x5d77d0[_0x41c2('0x1f')],_0x44faaa;if(_0x573c2f>=_0x545891){_0x573c2f=_0x545891;_0x44faaa=0xc8;}else{_0x44faaa=0xce;}_0x212071[_0x41c2('0x1d')](_0x44faaa);return _0x212071['set'](_0x41c2('0x20'),_0x434c4e+'-'+_0x573c2f+'/'+_0x545891)[_0x41c2('0x21')](_0x4d54ce);}return null;};}function patchUpdates(_0x3a1641){return function(_0x351567){try{jsonpatch[_0x41c2('0x22')](_0x351567,_0x3a1641,!![]);}catch(_0x94cc72){return BPromise['reject'](_0x94cc72);}return _0x351567['save']();};}function saveUpdates(_0x5b0031,_0x55da49){return function(_0x22bcb8){if(_0x22bcb8){return _0x22bcb8[_0x41c2('0x23')](_0x5b0031)[_0x41c2('0x24')](function(_0x1572c8){return _0x1572c8;});}return null;};}function removeEntity(_0x32a0b3,_0x4eaa7a){return function(_0x51ab75){if(_0x51ab75){return _0x51ab75[_0x41c2('0x25')]()['then'](function(){var _0x104371=_0x51ab75[_0x41c2('0x26')]({'plain':!![]});var _0x3f794c=_0x41c2('0x27');return db[_0x41c2('0x28')][_0x41c2('0x25')]({'where':{'type':_0x3f794c,'resourceId':_0x104371['id']}})[_0x41c2('0x24')](function(){return _0x51ab75;});})['then'](function(){_0x32a0b3[_0x41c2('0x1d')](0xcc)[_0x41c2('0x29')]();});}};}function handleEntityNotFound(_0x19ba98,_0x41d714){return function(_0x1b17e1){if(!_0x1b17e1){_0x19ba98[_0x41c2('0x1c')](0x194);}return _0x1b17e1;};}function handleError(_0x355cc6,_0x3f2e76){_0x3f2e76=_0x3f2e76||0x1f4;return function(_0x3bc5bf){logger['error'](_0x3bc5bf[_0x41c2('0x2a')]);if(_0x3bc5bf['name']){delete _0x3bc5bf[_0x41c2('0x2b')];}_0x355cc6['status'](_0x3f2e76)[_0x41c2('0x2c')](_0x3bc5bf);};}exports['index']=function(_0x15588e,_0x534e49){var _0x4ee1df={},_0x19654d={},_0x5e4088={'count':0x0,'rows':[]};var _0x26c941=_[_0x41c2('0x2d')](db['Interval'][_0x41c2('0x2e')],function(_0x46c1db){return{'name':_0x46c1db['fieldName'],'type':_0x46c1db['type'][_0x41c2('0x2f')]};});_0x19654d[_0x41c2('0x30')]=_[_0x41c2('0x2d')](_0x26c941,'name');_0x19654d[_0x41c2('0x31')]=_[_0x41c2('0x32')](_0x15588e[_0x41c2('0x31')]);_0x19654d[_0x41c2('0x33')]=_[_0x41c2('0x34')](_0x19654d[_0x41c2('0x30')],_0x19654d[_0x41c2('0x31')]);_0x4ee1df[_0x41c2('0x35')]=_[_0x41c2('0x34')](_0x19654d[_0x41c2('0x30')],qs['fields'](_0x15588e[_0x41c2('0x31')][_0x41c2('0x36')]));_0x4ee1df[_0x41c2('0x35')]=_0x4ee1df['attributes'][_0x41c2('0x37')]?_0x4ee1df[_0x41c2('0x35')]:_0x19654d[_0x41c2('0x30')];if(!_0x15588e[_0x41c2('0x31')][_0x41c2('0x38')]('nolimit')){_0x4ee1df[_0x41c2('0x1f')]=qs[_0x41c2('0x1f')](_0x15588e[_0x41c2('0x31')]['limit']);_0x4ee1df['offset']=qs[_0x41c2('0x1e')](_0x15588e[_0x41c2('0x31')][_0x41c2('0x1e')]);}_0x4ee1df[_0x41c2('0x39')]=qs['sort'](_0x15588e[_0x41c2('0x31')][_0x41c2('0x3a')]);_0x4ee1df[_0x41c2('0x3b')]=qs[_0x41c2('0x33')](_[_0x41c2('0x3c')](_0x15588e[_0x41c2('0x31')],_0x19654d[_0x41c2('0x33')]),_0x26c941);if(_0x15588e[_0x41c2('0x31')][_0x41c2('0x3d')]){_0x4ee1df[_0x41c2('0x3b')]=_[_0x41c2('0x3e')](_0x4ee1df['where'],{'$or':_[_0x41c2('0x2d')](_0x26c941,function(_0x3c700a){if(_0x3c700a[_0x41c2('0x3f')]!==_0x41c2('0x40')){var _0x1eee52={};_0x1eee52[_0x3c700a[_0x41c2('0x2b')]]={'$like':'%'+_0x15588e[_0x41c2('0x31')]['filter']+'%'};return _0x1eee52;}})});}_0x4ee1df=_[_0x41c2('0x3e')]({},_0x4ee1df,_0x15588e[_0x41c2('0x41')]);var _0x247851={'where':_0x4ee1df[_0x41c2('0x3b')]};return db[_0x41c2('0x42')][_0x41c2('0x43')](_0x247851)[_0x41c2('0x24')](function(_0x5549d5){_0x5e4088[_0x41c2('0x43')]=_0x5549d5;if(_0x15588e[_0x41c2('0x31')][_0x41c2('0x44')]){_0x4ee1df[_0x41c2('0x45')]=[{'all':!![]}];}return db[_0x41c2('0x42')][_0x41c2('0x46')](_0x4ee1df);})[_0x41c2('0x24')](function(_0x464a99){_0x5e4088['rows']=_0x464a99;return _0x5e4088;})[_0x41c2('0x24')](respondWithFilteredResult(_0x534e49,_0x4ee1df))[_0x41c2('0x47')](handleError(_0x534e49,null));};exports[_0x41c2('0x48')]=function(_0x83d3e3,_0x5c880a){var _0xfaa730={'raw':!![],'where':{'id':_0x83d3e3[_0x41c2('0x49')]['id']}},_0x5ad6a3={};_0x5ad6a3[_0x41c2('0x30')]=_[_0x41c2('0x32')](db[_0x41c2('0x42')][_0x41c2('0x2e')]);_0x5ad6a3[_0x41c2('0x31')]=_[_0x41c2('0x32')](_0x83d3e3['query']);_0x5ad6a3['filters']=_[_0x41c2('0x34')](_0x5ad6a3[_0x41c2('0x30')],_0x5ad6a3[_0x41c2('0x31')]);_0xfaa730['attributes']=_['intersection'](_0x5ad6a3[_0x41c2('0x30')],qs[_0x41c2('0x36')](_0x83d3e3[_0x41c2('0x31')][_0x41c2('0x36')]));_0xfaa730[_0x41c2('0x35')]=_0xfaa730[_0x41c2('0x35')][_0x41c2('0x37')]?_0xfaa730[_0x41c2('0x35')]:_0x5ad6a3[_0x41c2('0x30')];if(_0x83d3e3[_0x41c2('0x31')][_0x41c2('0x44')]){_0xfaa730[_0x41c2('0x45')]=[{'all':!![]}];}_0xfaa730=_[_0x41c2('0x3e')]({},_0xfaa730,_0x83d3e3[_0x41c2('0x41')]);return db[_0x41c2('0x42')][_0x41c2('0x4a')](_0xfaa730)[_0x41c2('0x24')](handleEntityNotFound(_0x5c880a,null))['then'](respondWithResult(_0x5c880a,null))['catch'](handleError(_0x5c880a,null));};exports[_0x41c2('0x4b')]=function(_0x439bb6,_0x1dda11){return db[_0x41c2('0x42')][_0x41c2('0x4b')](_0x439bb6['body'],{})[_0x41c2('0x24')](function(_0x394db0){var _0x17de9f=_0x439bb6[_0x41c2('0x4c')][_0x41c2('0x26')]({'plain':!![]});if(!_0x17de9f)throw new Error(_0x41c2('0x4d'));if(_0x17de9f['role']===_0x41c2('0x4c')){var _0x24421c=_0x394db0[_0x41c2('0x26')]({'plain':!![]});var _0x5682a8=_0x41c2('0x27');return db['UserProfileSection'][_0x41c2('0x4a')]({'where':{'name':_0x5682a8,'userProfileId':_0x17de9f[_0x41c2('0x4e')]},'raw':!![]})['then'](function(_0x4349c3){if(_0x4349c3&&_0x4349c3[_0x41c2('0x4f')]===0x0){return db[_0x41c2('0x28')][_0x41c2('0x4b')]({'name':_0x24421c['name'],'resourceId':_0x24421c['id'],'type':_0x4349c3[_0x41c2('0x2b')],'sectionId':_0x4349c3['id']},{})['then'](function(){return _0x394db0;});}else{return _0x394db0;}})['catch'](function(_0x31279e){logger[_0x41c2('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31279e);throw _0x31279e;});}return _0x394db0;})['then'](respondWithResult(_0x1dda11,0xc9))[_0x41c2('0x47')](handleError(_0x1dda11,null));};exports[_0x41c2('0x23')]=function(_0x35fdb3,_0x1a715d){if(_0x35fdb3[_0x41c2('0x51')]['id']){delete _0x35fdb3[_0x41c2('0x51')]['id'];}return db[_0x41c2('0x42')][_0x41c2('0x4a')]({'where':{'id':_0x35fdb3['params']['id']}})[_0x41c2('0x24')](handleEntityNotFound(_0x1a715d,null))['then'](saveUpdates(_0x35fdb3[_0x41c2('0x51')],null))[_0x41c2('0x24')](respondWithResult(_0x1a715d,null))[_0x41c2('0x47')](handleError(_0x1a715d,null));};exports[_0x41c2('0x25')]=function(_0x2ba20a,_0x107f68){return db['Interval'][_0x41c2('0x4a')]({'where':{'id':_0x2ba20a[_0x41c2('0x49')]['id']}})[_0x41c2('0x24')](handleEntityNotFound(_0x107f68,null))[_0x41c2('0x24')](removeEntity(_0x107f68,null))[_0x41c2('0x47')](handleError(_0x107f68,null));};exports[_0x41c2('0x52')]=function(_0x5bdd09,_0x45b98c,_0x4b34fc){if(_0x5bdd09[_0x41c2('0x51')]['id']){delete _0x5bdd09[_0x41c2('0x51')]['id'];}return db['Interval'][_0x41c2('0x4a')]({'where':{'id':_0x5bdd09['params']['id']}})[_0x41c2('0x24')](handleEntityNotFound(_0x45b98c,null))[_0x41c2('0x24')](function(_0x52a348){if(_0x52a348){_0x5bdd09[_0x41c2('0x51')][_0x41c2('0x53')]=_0x52a348['id'];return db[_0x41c2('0x42')][_0x41c2('0x4b')](_0x5bdd09[_0x41c2('0x51')]);}})[_0x41c2('0x24')](respondWithResult(_0x45b98c,null))[_0x41c2('0x47')](handleError(_0x45b98c,null));};exports[_0x41c2('0x54')]=function(_0x22841d,_0xeaa130,_0x4dc54b){var _0x3982a8={};var _0x2c7f36={};var _0x35aecf;var _0x39aef6;return db[_0x41c2('0x42')]['findOne']({'where':{'id':_0x22841d['params']['id']}})[_0x41c2('0x24')](handleEntityNotFound(_0xeaa130,null))['then'](function(_0x561a97){if(_0x561a97){_0x35aecf=_0x561a97;_0x2c7f36[_0x41c2('0x30')]=_[_0x41c2('0x32')](db[_0x41c2('0x42')]['rawAttributes']);_0x2c7f36[_0x41c2('0x31')]=_[_0x41c2('0x32')](_0x22841d['query']);_0x2c7f36[_0x41c2('0x33')]=_[_0x41c2('0x34')](_0x2c7f36[_0x41c2('0x30')],_0x2c7f36['query']);_0x3982a8[_0x41c2('0x35')]=_[_0x41c2('0x34')](_0x2c7f36['model'],qs[_0x41c2('0x36')](_0x22841d['query'][_0x41c2('0x36')]));_0x3982a8[_0x41c2('0x35')]=_0x3982a8['attributes'][_0x41c2('0x37')]?_0x3982a8[_0x41c2('0x35')]:_0x2c7f36[_0x41c2('0x30')];_0x3982a8[_0x41c2('0x39')]=qs[_0x41c2('0x3a')](_0x22841d['query']['sort']);_0x3982a8[_0x41c2('0x3b')]=qs[_0x41c2('0x33')](_[_0x41c2('0x3c')](_0x22841d[_0x41c2('0x31')],_0x2c7f36['filters']));if(_0x22841d[_0x41c2('0x31')][_0x41c2('0x3d')]){_0x3982a8[_0x41c2('0x3b')]=_[_0x41c2('0x3e')](_0x3982a8[_0x41c2('0x3b')],{'$or':_[_0x41c2('0x2d')](_0x3982a8[_0x41c2('0x35')],function(_0x442226){var _0x22dcee={};_0x22dcee[_0x442226]={'$like':'%'+_0x22841d['query']['filter']+'%'};return _0x22dcee;})});}_0x3982a8=_['merge']({},_0x3982a8,_0x22841d['options']);return _0x35aecf[_0x41c2('0x54')](_0x3982a8);}})[_0x41c2('0x24')](function(_0xa3b5c2){if(_0xa3b5c2){_0x39aef6=_0xa3b5c2[_0x41c2('0x37')];if(!_0x22841d[_0x41c2('0x31')]['hasOwnProperty'](_0x41c2('0x55'))){_0x3982a8[_0x41c2('0x1f')]=qs[_0x41c2('0x1f')](_0x22841d[_0x41c2('0x31')][_0x41c2('0x1f')]);_0x3982a8['offset']=qs['offset'](_0x22841d[_0x41c2('0x31')][_0x41c2('0x1e')]);}return _0x35aecf[_0x41c2('0x54')](_0x3982a8);}})['then'](function(_0x497167){if(_0x497167){return _0x497167?{'count':_0x39aef6,'rows':_0x497167}:null;}})[_0x41c2('0x24')](respondWithResult(_0xeaa130,null))[_0x41c2('0x47')](handleError(_0xeaa130,null));};exports[_0x41c2('0x56')]=function(_0x5f12cb,_0xbeb9e5,_0x2e13ed){return db[_0x41c2('0x42')][_0x41c2('0x57')]({'where':{'id':_0x5f12cb[_0x41c2('0x49')]['id']}})[_0x41c2('0x24')](handleEntityNotFound(_0xbeb9e5,null))['then'](function(_0x4d33a9){if(_0x4d33a9){return db['sequelize']['transaction'](function(_0x24afb5){return db[_0x41c2('0x42')]['destroy']({'where':{'IntervalId':_0x5f12cb[_0x41c2('0x49')]['id']},'transaction':_0x24afb5})[_0x41c2('0x24')](function(_0x20229d){var _0x3f0caa=_[_0x41c2('0x2d')](_0x5f12cb[_0x41c2('0x51')],function(_0x5955c2){delete _0x5955c2['id'];_0x5955c2['IntervalId']=_0x5f12cb[_0x41c2('0x49')]['id'];return _0x5955c2;});return db['Interval'][_0x41c2('0x58')](_0x3f0caa,{'transaction':_0x24afb5});});})[_0x41c2('0x24')](function(){return db[_0x41c2('0x42')][_0x41c2('0x46')]({'where':{'IntervalId':_0x5f12cb['params']['id']}});});}})[_0x41c2('0x24')](respondWithResult(_0xbeb9e5,null))[_0x41c2('0x47')](handleError(_0xbeb9e5,null));}; \ No newline at end of file +var _0xc1a9=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','error','name','send','index','map','Interval','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','count','include','catch','show','params','rawAttributes','length','includeAll','find','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','addInterval','IntervalId','findOne','getIntervals','addIntervals','sequelize','transaction','bulkCreate','findAll','html-pdf','eml-format','zip-dir','fast-json-patch','moment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc1a9,0x16f));var _0x9c1a=function(_0x398294,_0x5ceb9d){_0x398294=_0x398294-0x0;var _0x2a872d=_0xc1a9[_0x398294];return _0x2a872d;};'use strict';var pdf=require(_0x9c1a('0x0'));var emlformat=require(_0x9c1a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9c1a('0x2'));var jsonpatch=require(_0x9c1a('0x3'));var rp=require('request-promise');var moment=require(_0x9c1a('0x4'));var BPromise=require(_0x9c1a('0x5'));var Mustache=require(_0x9c1a('0x6'));var util=require(_0x9c1a('0x7'));var path=require(_0x9c1a('0x8'));var sox=require(_0x9c1a('0x9'));var csv=require(_0x9c1a('0xa'));var ejs=require(_0x9c1a('0xb'));var fs=require('fs');var _=require(_0x9c1a('0xc'));var squel=require('squel');var crypto=require(_0x9c1a('0xd'));var jsforce=require(_0x9c1a('0xe'));var deskjs=require(_0x9c1a('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9c1a('0x10'));var authService=require(_0x9c1a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c1a('0x12'));var logger=require(_0x9c1a('0x13'))('api');var utils=require(_0x9c1a('0x14'));var config=require(_0x9c1a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c1a('0x16'))['db'];var extensions=require(_0x9c1a('0x17'));function respondWithStatusCode(_0x478130,_0x2b96bf){_0x2b96bf=_0x2b96bf||0xcc;return function(_0xf296bc){if(_0xf296bc){return _0x478130[_0x9c1a('0x18')](_0x2b96bf);}return _0x478130[_0x9c1a('0x19')](_0x2b96bf)[_0x9c1a('0x1a')]();};}function respondWithResult(_0x2c6049,_0x17467a){_0x17467a=_0x17467a||0xc8;return function(_0x21e6d6){if(_0x21e6d6){return _0x2c6049[_0x9c1a('0x19')](_0x17467a)[_0x9c1a('0x1b')](_0x21e6d6);}};}function respondWithFilteredResult(_0x5e9eb4,_0x160465){return function(_0x54c644){if(_0x54c644){var _0x49a876=_0x54c644['count'],_0x1a4c02=_0x160465[_0x9c1a('0x1c')],_0x6f499a=_0x160465[_0x9c1a('0x1c')]+_0x160465['limit'],_0x5e3006;if(_0x6f499a>=_0x49a876){_0x6f499a=_0x49a876;_0x5e3006=0xc8;}else{_0x5e3006=0xce;}_0x5e9eb4[_0x9c1a('0x19')](_0x5e3006);return _0x5e9eb4[_0x9c1a('0x1d')](_0x9c1a('0x1e'),_0x1a4c02+'-'+_0x6f499a+'/'+_0x49a876)[_0x9c1a('0x1b')](_0x54c644);}return null;};}function patchUpdates(_0x214bfe){return function(_0x26a303){try{jsonpatch[_0x9c1a('0x1f')](_0x26a303,_0x214bfe,!![]);}catch(_0x296d54){return BPromise[_0x9c1a('0x20')](_0x296d54);}return _0x26a303[_0x9c1a('0x21')]();};}function saveUpdates(_0x8b418a,_0xa92266){return function(_0x572dab){if(_0x572dab){return _0x572dab[_0x9c1a('0x22')](_0x8b418a)[_0x9c1a('0x23')](function(_0x4a7022){return _0x4a7022;});}return null;};}function removeEntity(_0x17931a,_0x47b1c4){return function(_0x26b1bc){if(_0x26b1bc){return _0x26b1bc[_0x9c1a('0x24')]()['then'](function(){var _0x7f4076=_0x26b1bc[_0x9c1a('0x25')]({'plain':!![]});var _0x15772e=_0x9c1a('0x26');return db['UserProfileResource'][_0x9c1a('0x24')]({'where':{'type':_0x15772e,'resourceId':_0x7f4076['id']}})[_0x9c1a('0x23')](function(){return _0x26b1bc;});})[_0x9c1a('0x23')](function(){_0x17931a[_0x9c1a('0x19')](0xcc)[_0x9c1a('0x1a')]();});}};}function handleEntityNotFound(_0x24cd6b,_0x2f6b32){return function(_0xf1a3e1){if(!_0xf1a3e1){_0x24cd6b['sendStatus'](0x194);}return _0xf1a3e1;};}function handleError(_0x23c392,_0x29ce22){_0x29ce22=_0x29ce22||0x1f4;return function(_0x3c8a1a){logger[_0x9c1a('0x27')](_0x3c8a1a['stack']);if(_0x3c8a1a[_0x9c1a('0x28')]){delete _0x3c8a1a[_0x9c1a('0x28')];}_0x23c392[_0x9c1a('0x19')](_0x29ce22)[_0x9c1a('0x29')](_0x3c8a1a);};}exports[_0x9c1a('0x2a')]=function(_0x303b8d,_0x596a0f){var _0x54b396={},_0xe6f011={},_0x230b93={'count':0x0,'rows':[]};var _0x236434=_[_0x9c1a('0x2b')](db[_0x9c1a('0x2c')]['rawAttributes'],function(_0x5ea995){return{'name':_0x5ea995[_0x9c1a('0x2d')],'type':_0x5ea995[_0x9c1a('0x2e')][_0x9c1a('0x2f')]};});_0xe6f011[_0x9c1a('0x30')]=_['map'](_0x236434,_0x9c1a('0x28'));_0xe6f011[_0x9c1a('0x31')]=_[_0x9c1a('0x32')](_0x303b8d[_0x9c1a('0x31')]);_0xe6f011['filters']=_[_0x9c1a('0x33')](_0xe6f011[_0x9c1a('0x30')],_0xe6f011['query']);_0x54b396[_0x9c1a('0x34')]=_[_0x9c1a('0x33')](_0xe6f011[_0x9c1a('0x30')],qs['fields'](_0x303b8d['query'][_0x9c1a('0x35')]));_0x54b396['attributes']=_0x54b396[_0x9c1a('0x34')]['length']?_0x54b396['attributes']:_0xe6f011[_0x9c1a('0x30')];if(!_0x303b8d[_0x9c1a('0x31')][_0x9c1a('0x36')](_0x9c1a('0x37'))){_0x54b396[_0x9c1a('0x38')]=qs[_0x9c1a('0x38')](_0x303b8d[_0x9c1a('0x31')][_0x9c1a('0x38')]);_0x54b396['offset']=qs['offset'](_0x303b8d[_0x9c1a('0x31')]['offset']);}_0x54b396[_0x9c1a('0x39')]=qs[_0x9c1a('0x3a')](_0x303b8d[_0x9c1a('0x31')][_0x9c1a('0x3a')]);_0x54b396[_0x9c1a('0x3b')]=qs[_0x9c1a('0x3c')](_[_0x9c1a('0x3d')](_0x303b8d['query'],_0xe6f011[_0x9c1a('0x3c')]),_0x236434);if(_0x303b8d['query'][_0x9c1a('0x3e')]){_0x54b396[_0x9c1a('0x3b')]=_[_0x9c1a('0x3f')](_0x54b396[_0x9c1a('0x3b')],{'$or':_[_0x9c1a('0x2b')](_0x236434,function(_0x137050){if(_0x137050[_0x9c1a('0x2e')]!=='VIRTUAL'){var _0x53beea={};_0x53beea[_0x137050[_0x9c1a('0x28')]]={'$like':'%'+_0x303b8d[_0x9c1a('0x31')][_0x9c1a('0x3e')]+'%'};return _0x53beea;}})});}_0x54b396=_[_0x9c1a('0x3f')]({},_0x54b396,_0x303b8d[_0x9c1a('0x40')]);var _0x2a57c8={'where':_0x54b396[_0x9c1a('0x3b')]};return db[_0x9c1a('0x2c')][_0x9c1a('0x41')](_0x2a57c8)['then'](function(_0x597cfa){_0x230b93['count']=_0x597cfa;if(_0x303b8d[_0x9c1a('0x31')]['includeAll']){_0x54b396[_0x9c1a('0x42')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x54b396);})[_0x9c1a('0x23')](function(_0x7b1fc8){_0x230b93['rows']=_0x7b1fc8;return _0x230b93;})[_0x9c1a('0x23')](respondWithFilteredResult(_0x596a0f,_0x54b396))[_0x9c1a('0x43')](handleError(_0x596a0f,null));};exports[_0x9c1a('0x44')]=function(_0x4e24a9,_0xcee819){var _0x58ee9b={'raw':!![],'where':{'id':_0x4e24a9[_0x9c1a('0x45')]['id']}},_0x26dc43={};_0x26dc43[_0x9c1a('0x30')]=_['keys'](db[_0x9c1a('0x2c')][_0x9c1a('0x46')]);_0x26dc43['query']=_[_0x9c1a('0x32')](_0x4e24a9[_0x9c1a('0x31')]);_0x26dc43[_0x9c1a('0x3c')]=_['intersection'](_0x26dc43[_0x9c1a('0x30')],_0x26dc43[_0x9c1a('0x31')]);_0x58ee9b[_0x9c1a('0x34')]=_['intersection'](_0x26dc43[_0x9c1a('0x30')],qs[_0x9c1a('0x35')](_0x4e24a9[_0x9c1a('0x31')][_0x9c1a('0x35')]));_0x58ee9b[_0x9c1a('0x34')]=_0x58ee9b['attributes'][_0x9c1a('0x47')]?_0x58ee9b[_0x9c1a('0x34')]:_0x26dc43[_0x9c1a('0x30')];if(_0x4e24a9[_0x9c1a('0x31')][_0x9c1a('0x48')]){_0x58ee9b['include']=[{'all':!![]}];}_0x58ee9b=_['merge']({},_0x58ee9b,_0x4e24a9['options']);return db[_0x9c1a('0x2c')][_0x9c1a('0x49')](_0x58ee9b)['then'](handleEntityNotFound(_0xcee819,null))[_0x9c1a('0x23')](respondWithResult(_0xcee819,null))[_0x9c1a('0x43')](handleError(_0xcee819,null));};exports[_0x9c1a('0x4a')]=function(_0x570bee,_0x25756a){return db[_0x9c1a('0x2c')][_0x9c1a('0x4a')](_0x570bee[_0x9c1a('0x4b')],{})[_0x9c1a('0x23')](function(_0xda96a9){var _0x4f84bb=_0x570bee[_0x9c1a('0x4c')][_0x9c1a('0x25')]({'plain':!![]});if(!_0x4f84bb)throw new Error(_0x9c1a('0x4d'));if(_0x4f84bb[_0x9c1a('0x4e')]===_0x9c1a('0x4c')){var _0x1c61cf=_0xda96a9['get']({'plain':!![]});var _0x44fc69='Intervals';return db[_0x9c1a('0x4f')][_0x9c1a('0x49')]({'where':{'name':_0x44fc69,'userProfileId':_0x4f84bb[_0x9c1a('0x50')]},'raw':!![]})[_0x9c1a('0x23')](function(_0x186c1f){if(_0x186c1f&&_0x186c1f[_0x9c1a('0x51')]===0x0){return db[_0x9c1a('0x52')][_0x9c1a('0x4a')]({'name':_0x1c61cf[_0x9c1a('0x28')],'resourceId':_0x1c61cf['id'],'type':_0x186c1f[_0x9c1a('0x28')],'sectionId':_0x186c1f['id']},{})[_0x9c1a('0x23')](function(){return _0xda96a9;});}else{return _0xda96a9;}})[_0x9c1a('0x43')](function(_0x15eae6){logger[_0x9c1a('0x27')](_0x9c1a('0x53'),_0x15eae6);throw _0x15eae6;});}return _0xda96a9;})['then'](respondWithResult(_0x25756a,0xc9))[_0x9c1a('0x43')](handleError(_0x25756a,null));};exports['update']=function(_0x3bf9e5,_0x61f05){if(_0x3bf9e5['body']['id']){delete _0x3bf9e5[_0x9c1a('0x4b')]['id'];}return db[_0x9c1a('0x2c')]['find']({'where':{'id':_0x3bf9e5[_0x9c1a('0x45')]['id']}})[_0x9c1a('0x23')](handleEntityNotFound(_0x61f05,null))[_0x9c1a('0x23')](saveUpdates(_0x3bf9e5[_0x9c1a('0x4b')],null))[_0x9c1a('0x23')](respondWithResult(_0x61f05,null))[_0x9c1a('0x43')](handleError(_0x61f05,null));};exports[_0x9c1a('0x24')]=function(_0x25378f,_0x3fdaca){return db['Interval'][_0x9c1a('0x49')]({'where':{'id':_0x25378f[_0x9c1a('0x45')]['id']}})[_0x9c1a('0x23')](handleEntityNotFound(_0x3fdaca,null))[_0x9c1a('0x23')](removeEntity(_0x3fdaca,null))[_0x9c1a('0x43')](handleError(_0x3fdaca,null));};exports[_0x9c1a('0x54')]=function(_0x2d7ecf,_0x5709a4,_0x498991){if(_0x2d7ecf[_0x9c1a('0x4b')]['id']){delete _0x2d7ecf[_0x9c1a('0x4b')]['id'];}return db[_0x9c1a('0x2c')][_0x9c1a('0x49')]({'where':{'id':_0x2d7ecf[_0x9c1a('0x45')]['id']}})[_0x9c1a('0x23')](handleEntityNotFound(_0x5709a4,null))[_0x9c1a('0x23')](function(_0x3c24d7){if(_0x3c24d7){_0x2d7ecf[_0x9c1a('0x4b')][_0x9c1a('0x55')]=_0x3c24d7['id'];return db[_0x9c1a('0x2c')][_0x9c1a('0x4a')](_0x2d7ecf['body']);}})['then'](respondWithResult(_0x5709a4,null))[_0x9c1a('0x43')](handleError(_0x5709a4,null));};exports['getIntervals']=function(_0x4cda64,_0x18c27a,_0x113ca2){var _0x3db7d5={};var _0x5c9728={};var _0x56aa30;var _0xa22576;return db[_0x9c1a('0x2c')][_0x9c1a('0x56')]({'where':{'id':_0x4cda64[_0x9c1a('0x45')]['id']}})[_0x9c1a('0x23')](handleEntityNotFound(_0x18c27a,null))[_0x9c1a('0x23')](function(_0x195a0d){if(_0x195a0d){_0x56aa30=_0x195a0d;_0x5c9728[_0x9c1a('0x30')]=_[_0x9c1a('0x32')](db['Interval'][_0x9c1a('0x46')]);_0x5c9728[_0x9c1a('0x31')]=_['keys'](_0x4cda64[_0x9c1a('0x31')]);_0x5c9728[_0x9c1a('0x3c')]=_[_0x9c1a('0x33')](_0x5c9728[_0x9c1a('0x30')],_0x5c9728[_0x9c1a('0x31')]);_0x3db7d5[_0x9c1a('0x34')]=_[_0x9c1a('0x33')](_0x5c9728[_0x9c1a('0x30')],qs[_0x9c1a('0x35')](_0x4cda64[_0x9c1a('0x31')][_0x9c1a('0x35')]));_0x3db7d5[_0x9c1a('0x34')]=_0x3db7d5[_0x9c1a('0x34')][_0x9c1a('0x47')]?_0x3db7d5[_0x9c1a('0x34')]:_0x5c9728[_0x9c1a('0x30')];_0x3db7d5[_0x9c1a('0x39')]=qs['sort'](_0x4cda64[_0x9c1a('0x31')][_0x9c1a('0x3a')]);_0x3db7d5[_0x9c1a('0x3b')]=qs[_0x9c1a('0x3c')](_[_0x9c1a('0x3d')](_0x4cda64[_0x9c1a('0x31')],_0x5c9728[_0x9c1a('0x3c')]));if(_0x4cda64[_0x9c1a('0x31')][_0x9c1a('0x3e')]){_0x3db7d5['where']=_['merge'](_0x3db7d5['where'],{'$or':_[_0x9c1a('0x2b')](_0x3db7d5[_0x9c1a('0x34')],function(_0x303c59){var _0x3f8cfe={};_0x3f8cfe[_0x303c59]={'$like':'%'+_0x4cda64['query'][_0x9c1a('0x3e')]+'%'};return _0x3f8cfe;})});}_0x3db7d5=_[_0x9c1a('0x3f')]({},_0x3db7d5,_0x4cda64[_0x9c1a('0x40')]);return _0x56aa30[_0x9c1a('0x57')](_0x3db7d5);}})[_0x9c1a('0x23')](function(_0x98e1dd){if(_0x98e1dd){_0xa22576=_0x98e1dd[_0x9c1a('0x47')];if(!_0x4cda64[_0x9c1a('0x31')]['hasOwnProperty'](_0x9c1a('0x37'))){_0x3db7d5[_0x9c1a('0x38')]=qs[_0x9c1a('0x38')](_0x4cda64[_0x9c1a('0x31')][_0x9c1a('0x38')]);_0x3db7d5[_0x9c1a('0x1c')]=qs[_0x9c1a('0x1c')](_0x4cda64[_0x9c1a('0x31')][_0x9c1a('0x1c')]);}return _0x56aa30['getIntervals'](_0x3db7d5);}})[_0x9c1a('0x23')](function(_0x44f82c){if(_0x44f82c){return _0x44f82c?{'count':_0xa22576,'rows':_0x44f82c}:null;}})['then'](respondWithResult(_0x18c27a,null))[_0x9c1a('0x43')](handleError(_0x18c27a,null));};exports[_0x9c1a('0x58')]=function(_0x3beaac,_0x498bbc,_0x36f1cd){return db[_0x9c1a('0x2c')][_0x9c1a('0x56')]({'where':{'id':_0x3beaac[_0x9c1a('0x45')]['id']}})[_0x9c1a('0x23')](handleEntityNotFound(_0x498bbc,null))['then'](function(_0x2d1256){if(_0x2d1256){return db[_0x9c1a('0x59')][_0x9c1a('0x5a')](function(_0x37b3cf){return db[_0x9c1a('0x2c')]['destroy']({'where':{'IntervalId':_0x3beaac[_0x9c1a('0x45')]['id']},'transaction':_0x37b3cf})[_0x9c1a('0x23')](function(_0x440275){var _0x2f58ff=_[_0x9c1a('0x2b')](_0x3beaac[_0x9c1a('0x4b')],function(_0x733c19){delete _0x733c19['id'];_0x733c19['IntervalId']=_0x3beaac[_0x9c1a('0x45')]['id'];return _0x733c19;});return db[_0x9c1a('0x2c')][_0x9c1a('0x5b')](_0x2f58ff,{'transaction':_0x37b3cf});});})[_0x9c1a('0x23')](function(){return db[_0x9c1a('0x2c')][_0x9c1a('0x5c')]({'where':{'IntervalId':_0x3beaac[_0x9c1a('0x45')]['id']}});});}})[_0x9c1a('0x23')](respondWithResult(_0x498bbc,null))['catch'](handleError(_0x498bbc,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 8357bc8..0f7e5ce 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 _0x5271=['exports','define','tools_intervals','rewrite','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./interval.attributes'];(function(_0x17dc33,_0x5bb571){var _0x1dbb33=function(_0x72a772){while(--_0x72a772){_0x17dc33['push'](_0x17dc33['shift']());}};_0x1dbb33(++_0x5bb571);}(_0x5271,0xa0));var _0x1527=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x5271[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x1527('0x0'));var util=require('util');var logger=require(_0x1527('0x1'))(_0x1527('0x2'));var moment=require('moment');var BPromise=require(_0x1527('0x3'));var rp=require(_0x1527('0x4'));var fs=require('fs');var path=require(_0x1527('0x5'));var rimraf=require(_0x1527('0x6'));var config=require('../../config/environment');var attributes=require(_0x1527('0x7'));var extensions=require('../../components/extensions/rewrite');module[_0x1527('0x8')]=function(_0x55871f,_0x5b35a6){return _0x55871f[_0x1527('0x9')]('Interval',attributes,{'tableName':_0x1527('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xe62229,_0x117068){extensions[_0x1527('0xb')](_0x55871f,_0xe62229);},'afterBulkCreate':function(_0x68f9ce,_0x1f5c71,_0x2c4c7e){_0x2c4c7e();extensions[_0x1527('0xb')](_0x55871f,_0x68f9ce[0x0]);},'afterUpdate':function(_0x525fea,_0x240909){extensions['rewrite'](_0x55871f,_0x525fea);},'afterDestroy':function(_0x3ca587,_0x3e06ba){extensions[_0x1527('0xb')](_0x55871f,_0x3ca587);}}});}; \ No newline at end of file +var _0x2bb0=['define','tools_intervals','rewrite','lodash','util','../../config/logger','moment','path','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports'];(function(_0x3439ea,_0x1d81d4){var _0x1a55f3=function(_0x33db17){while(--_0x33db17){_0x3439ea['push'](_0x3439ea['shift']());}};_0x1a55f3(++_0x1d81d4);}(_0x2bb0,0xf3));var _0x02bb=function(_0x49eed6,_0x3e49a1){_0x49eed6=_0x49eed6-0x0;var _0x154c1f=_0x2bb0[_0x49eed6];return _0x154c1f;};'use strict';var _=require(_0x02bb('0x0'));var util=require(_0x02bb('0x1'));var logger=require(_0x02bb('0x2'))('api');var moment=require(_0x02bb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x02bb('0x4'));var rimraf=require('rimraf');var config=require(_0x02bb('0x5'));var attributes=require(_0x02bb('0x6'));var extensions=require(_0x02bb('0x7'));module[_0x02bb('0x8')]=function(_0x43dbb7,_0x16bb7c){return _0x43dbb7[_0x02bb('0x9')]('Interval',attributes,{'tableName':_0x02bb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x15e425,_0x23f816){extensions['rewrite'](_0x43dbb7,_0x15e425);},'afterBulkCreate':function(_0x3d28d5,_0x5a4a7f,_0x3edabe){_0x3edabe();extensions[_0x02bb('0xb')](_0x43dbb7,_0x3d28d5[0x0]);},'afterUpdate':function(_0x4d3418,_0x3f861e){extensions[_0x02bb('0xb')](_0x43dbb7,_0x4d3418);},'afterDestroy':function(_0x3c1149,_0x523480){extensions[_0x02bb('0xb')](_0x43dbb7,_0x3c1149);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 67cbffd..d41043a 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 _0xce6c=['randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','Interval','options','raw','where','attributes','limit','include','map','model','GetInterval','ShowInterval','debug','lodash','util','bluebird'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0xce6c,0x1ce));var _0xcce6=function(_0x67539a,_0xa029e1){_0x67539a=_0x67539a-0x0;var _0x3be5c1=_0xce6c[_0x67539a];return _0x3be5c1;};'use strict';var _=require(_0xcce6('0x0'));var util=require(_0xcce6('0x1'));var moment=require('moment');var BPromise=require(_0xcce6('0x2'));var rs=require(_0xcce6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcce6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcce6('0x5'));var config=require(_0xcce6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcce6('0x7')][_0xcce6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12a70c,_0x28c619,_0x14851e){return new BPromise(function(_0x16e1f6,_0xddbd82){return client[_0xcce6('0x9')](_0x12a70c,_0x14851e)[_0xcce6('0xa')](function(_0x23226b){logger[_0xcce6('0xb')](_0xcce6('0xc'),_0x28c619,_0xcce6('0xd'));logger['debug']('Interval,\x20%s,\x20%s,\x20%s',_0x28c619,_0xcce6('0xd'),JSON[_0xcce6('0xe')](_0x23226b));if(_0x23226b['error']){if(_0x23226b[_0xcce6('0xf')][_0xcce6('0x10')]===0x1f4){logger[_0xcce6('0xf')](_0xcce6('0xc'),_0x28c619,_0x23226b[_0xcce6('0xf')][_0xcce6('0x11')]);return _0xddbd82(_0x23226b['error'][_0xcce6('0x11')]);}logger[_0xcce6('0xf')](_0xcce6('0xc'),_0x28c619,_0x23226b[_0xcce6('0xf')][_0xcce6('0x11')]);return _0x16e1f6(_0x23226b[_0xcce6('0xf')]['message']);}else{logger[_0xcce6('0xb')]('Interval,\x20%s,\x20%s',_0x28c619,_0xcce6('0xd'));_0x16e1f6(_0x23226b['result'][_0xcce6('0x11')]);}})[_0xcce6('0x12')](function(_0x5d3b1d){logger[_0xcce6('0xf')](_0xcce6('0xc'),_0x28c619,_0x5d3b1d);_0xddbd82(_0x5d3b1d);});});}exports['GetInterval']=function(_0x41b937){var _0x1f8542=this;return new Promise(function(_0x459fd7,_0x53046d){return db[_0xcce6('0x13')]['findAll']({'raw':_0x41b937[_0xcce6('0x14')]?_0x41b937[_0xcce6('0x14')][_0xcce6('0x15')]===undefined?!![]:![]:!![],'where':_0x41b937[_0xcce6('0x14')]?_0x41b937['options'][_0xcce6('0x16')]||null:null,'attributes':_0x41b937['options']?_0x41b937[_0xcce6('0x14')][_0xcce6('0x17')]||null:null,'limit':_0x41b937[_0xcce6('0x14')]?_0x41b937['options'][_0xcce6('0x18')]||null:null,'include':_0x41b937[_0xcce6('0x14')]?_0x41b937[_0xcce6('0x14')][_0xcce6('0x19')]?_[_0xcce6('0x1a')](_0x41b937['options'][_0xcce6('0x19')],function(_0x1802d0){return{'model':db[_0x1802d0[_0xcce6('0x1b')]],'as':_0x1802d0['as'],'attributes':_0x1802d0[_0xcce6('0x17')],'include':_0x1802d0[_0xcce6('0x19')]?_[_0xcce6('0x1a')](_0x1802d0[_0xcce6('0x19')],function(_0x1ea015){return{'model':db[_0x1ea015['model']],'as':_0x1ea015['as'],'attributes':_0x1ea015[_0xcce6('0x17')],'include':_0x1ea015[_0xcce6('0x19')]?_[_0xcce6('0x1a')](_0x1ea015[_0xcce6('0x19')],function(_0x47386b){return{'model':db[_0x47386b[_0xcce6('0x1b')]],'as':_0x47386b['as'],'attributes':_0x47386b['attributes']};}):[]};}):[]};}):[]:[]})[_0xcce6('0xa')](function(_0x36baf6){logger[_0xcce6('0xb')](_0xcce6('0x1c'),_0x41b937);logger['debug']('GetInterval',_0x41b937,JSON[_0xcce6('0xe')](_0x36baf6));_0x459fd7(_0x36baf6);})[_0xcce6('0x12')](function(_0x3a18a4){logger[_0xcce6('0xf')](_0xcce6('0x1c'),_0x3a18a4[_0xcce6('0x11')],_0x41b937);_0x53046d(_0x1f8542[_0xcce6('0xf')](0x1f4,_0x3a18a4[_0xcce6('0x11')]));});});};exports[_0xcce6('0x1d')]=function(_0x40c753){var _0x1107e9=this;return new Promise(function(_0x239f6a,_0x5390ae){return db['Interval']['find']({'raw':_0x40c753[_0xcce6('0x14')]?_0x40c753[_0xcce6('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x40c753[_0xcce6('0x14')]?_0x40c753[_0xcce6('0x14')]['where']||null:null,'attributes':_0x40c753[_0xcce6('0x14')]?_0x40c753[_0xcce6('0x14')][_0xcce6('0x17')]||null:null,'include':_0x40c753[_0xcce6('0x14')]?_0x40c753['options'][_0xcce6('0x19')]?_[_0xcce6('0x1a')](_0x40c753[_0xcce6('0x14')][_0xcce6('0x19')],function(_0x1d5733){return{'model':db[_0x1d5733[_0xcce6('0x1b')]],'as':_0x1d5733['as'],'attributes':_0x1d5733[_0xcce6('0x17')],'include':_0x1d5733[_0xcce6('0x19')]?_[_0xcce6('0x1a')](_0x1d5733[_0xcce6('0x19')],function(_0xf5d244){return{'model':db[_0xf5d244[_0xcce6('0x1b')]],'as':_0xf5d244['as'],'attributes':_0xf5d244[_0xcce6('0x17')],'include':_0xf5d244[_0xcce6('0x19')]?_[_0xcce6('0x1a')](_0xf5d244[_0xcce6('0x19')],function(_0x30344a){return{'model':db[_0x30344a[_0xcce6('0x1b')]],'as':_0x30344a['as'],'attributes':_0x30344a[_0xcce6('0x17')]};}):[]};}):[]};}):[]:[]})[_0xcce6('0xa')](function(_0xd001f){logger[_0xcce6('0xb')](_0xcce6('0x1d'),_0x40c753);logger[_0xcce6('0x1e')](_0xcce6('0x1d'),_0x40c753,JSON[_0xcce6('0xe')](_0xd001f));_0x239f6a(_0xd001f);})['catch'](function(_0x1efde4){logger['error'](_0xcce6('0x1d'),_0x1efde4[_0xcce6('0x11')],_0x40c753);_0x5390ae(_0x1107e9['error'](0x1f4,_0x1efde4['message']));});});}; \ No newline at end of file +var _0x4f59=['code','message','result','catch','GetInterval','Interval','findAll','options','where','attributes','include','map','model','debug','stringify','ShowInterval','find','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','error'];(function(_0x3397fb,_0x2feb60){var _0x3ebdc2=function(_0x2a97fd){while(--_0x2a97fd){_0x3397fb['push'](_0x3397fb['shift']());}};_0x3ebdc2(++_0x2feb60);}(_0x4f59,0x17a));var _0x94f5=function(_0x5806c3,_0x5105d8){_0x5806c3=_0x5806c3-0x0;var _0x48ac77=_0x4f59[_0x5806c3];return _0x48ac77;};'use strict';var _=require('lodash');var util=require(_0x94f5('0x0'));var moment=require(_0x94f5('0x1'));var BPromise=require(_0x94f5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x94f5('0x3'));var db=require(_0x94f5('0x4'))['db'];var utils=require(_0x94f5('0x5'));var logger=require(_0x94f5('0x6'))(_0x94f5('0x7'));var config=require('../../config/environment');var jayson=require(_0x94f5('0x8'));var client=jayson[_0x94f5('0x9')][_0x94f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f45b9,_0x38ffe8,_0x130403){return new BPromise(function(_0x3ab7de,_0x99edad){return client[_0x94f5('0xb')](_0x4f45b9,_0x130403)[_0x94f5('0xc')](function(_0x5b0485){logger[_0x94f5('0xd')](_0x94f5('0xe'),_0x38ffe8,_0x94f5('0xf'));logger['debug'](_0x94f5('0x10'),_0x38ffe8,_0x94f5('0xf'),JSON['stringify'](_0x5b0485));if(_0x5b0485[_0x94f5('0x11')]){if(_0x5b0485[_0x94f5('0x11')][_0x94f5('0x12')]===0x1f4){logger[_0x94f5('0x11')](_0x94f5('0xe'),_0x38ffe8,_0x5b0485[_0x94f5('0x11')][_0x94f5('0x13')]);return _0x99edad(_0x5b0485[_0x94f5('0x11')]['message']);}logger[_0x94f5('0x11')](_0x94f5('0xe'),_0x38ffe8,_0x5b0485[_0x94f5('0x11')][_0x94f5('0x13')]);return _0x3ab7de(_0x5b0485['error'][_0x94f5('0x13')]);}else{logger['info']('Interval,\x20%s,\x20%s',_0x38ffe8,_0x94f5('0xf'));_0x3ab7de(_0x5b0485[_0x94f5('0x14')][_0x94f5('0x13')]);}})[_0x94f5('0x15')](function(_0x16a48a){logger['error'](_0x94f5('0xe'),_0x38ffe8,_0x16a48a);_0x99edad(_0x16a48a);});});}exports[_0x94f5('0x16')]=function(_0x5e95be){var _0x5e7435=this;return new Promise(function(_0x4ab664,_0x30cb7c){return db[_0x94f5('0x17')][_0x94f5('0x18')]({'raw':_0x5e95be['options']?_0x5e95be[_0x94f5('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5e95be[_0x94f5('0x19')]?_0x5e95be[_0x94f5('0x19')][_0x94f5('0x1a')]||null:null,'attributes':_0x5e95be[_0x94f5('0x19')]?_0x5e95be['options'][_0x94f5('0x1b')]||null:null,'limit':_0x5e95be[_0x94f5('0x19')]?_0x5e95be[_0x94f5('0x19')]['limit']||null:null,'include':_0x5e95be['options']?_0x5e95be[_0x94f5('0x19')][_0x94f5('0x1c')]?_[_0x94f5('0x1d')](_0x5e95be[_0x94f5('0x19')][_0x94f5('0x1c')],function(_0x56731c){return{'model':db[_0x56731c['model']],'as':_0x56731c['as'],'attributes':_0x56731c[_0x94f5('0x1b')],'include':_0x56731c[_0x94f5('0x1c')]?_[_0x94f5('0x1d')](_0x56731c[_0x94f5('0x1c')],function(_0x4d7be9){return{'model':db[_0x4d7be9['model']],'as':_0x4d7be9['as'],'attributes':_0x4d7be9[_0x94f5('0x1b')],'include':_0x4d7be9['include']?_['map'](_0x4d7be9[_0x94f5('0x1c')],function(_0x3c8306){return{'model':db[_0x3c8306[_0x94f5('0x1e')]],'as':_0x3c8306['as'],'attributes':_0x3c8306[_0x94f5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x94f5('0xc')](function(_0x567f06){logger[_0x94f5('0xd')](_0x94f5('0x16'),_0x5e95be);logger[_0x94f5('0x1f')](_0x94f5('0x16'),_0x5e95be,JSON[_0x94f5('0x20')](_0x567f06));_0x4ab664(_0x567f06);})[_0x94f5('0x15')](function(_0x4a923b){logger[_0x94f5('0x11')](_0x94f5('0x16'),_0x4a923b['message'],_0x5e95be);_0x30cb7c(_0x5e7435[_0x94f5('0x11')](0x1f4,_0x4a923b['message']));});});};exports[_0x94f5('0x21')]=function(_0x2fdda0){var _0x39211d=this;return new Promise(function(_0x59115f,_0x5f0437){return db[_0x94f5('0x17')][_0x94f5('0x22')]({'raw':_0x2fdda0[_0x94f5('0x19')]?_0x2fdda0[_0x94f5('0x19')][_0x94f5('0x23')]===undefined?!![]:![]:!![],'where':_0x2fdda0[_0x94f5('0x19')]?_0x2fdda0[_0x94f5('0x19')][_0x94f5('0x1a')]||null:null,'attributes':_0x2fdda0[_0x94f5('0x19')]?_0x2fdda0['options']['attributes']||null:null,'include':_0x2fdda0[_0x94f5('0x19')]?_0x2fdda0[_0x94f5('0x19')][_0x94f5('0x1c')]?_['map'](_0x2fdda0[_0x94f5('0x19')][_0x94f5('0x1c')],function(_0x410855){return{'model':db[_0x410855['model']],'as':_0x410855['as'],'attributes':_0x410855[_0x94f5('0x1b')],'include':_0x410855[_0x94f5('0x1c')]?_[_0x94f5('0x1d')](_0x410855[_0x94f5('0x1c')],function(_0x2ab625){return{'model':db[_0x2ab625[_0x94f5('0x1e')]],'as':_0x2ab625['as'],'attributes':_0x2ab625[_0x94f5('0x1b')],'include':_0x2ab625[_0x94f5('0x1c')]?_['map'](_0x2ab625['include'],function(_0x3ce478){return{'model':db[_0x3ce478[_0x94f5('0x1e')]],'as':_0x3ce478['as'],'attributes':_0x3ce478['attributes']};}):[]};}):[]};}):[]:[]})[_0x94f5('0xc')](function(_0x16109a){logger['info']('ShowInterval',_0x2fdda0);logger[_0x94f5('0x1f')](_0x94f5('0x21'),_0x2fdda0,JSON[_0x94f5('0x20')](_0x16109a));_0x59115f(_0x16109a);})[_0x94f5('0x15')](function(_0x138f61){logger[_0x94f5('0x11')](_0x94f5('0x21'),_0x138f61[_0x94f5('0x13')],_0x2fdda0);_0x5f0437(_0x39211d[_0x94f5('0x11')](0x1f4,_0x138f61[_0x94f5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 242ffa7..bc97381 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 _0x0bb3=['Router','../../components/auth/service','./jira.controller','post','isAuthenticated','send','exports'];(function(_0x2d0d9f,_0x22c0d8){var _0x30243d=function(_0x29a92b){while(--_0x29a92b){_0x2d0d9f['push'](_0x2d0d9f['shift']());}};_0x30243d(++_0x22c0d8);}(_0x0bb3,0x126));var _0x30bb=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x0bb3[_0x257642];return _0x3d813b;};'use strict';var express=require('express');var router=express[_0x30bb('0x0')]();var auth=require(_0x30bb('0x1'));var controller=require(_0x30bb('0x2'));router[_0x30bb('0x3')]('/',auth[_0x30bb('0x4')](),controller[_0x30bb('0x5')]);module[_0x30bb('0x6')]=router; \ No newline at end of file +var _0x61a2=['isAuthenticated','send','exports','express','Router','./jira.controller','post'];(function(_0x24657d,_0x551c56){var _0xdc4b08=function(_0x3d0188){while(--_0x3d0188){_0x24657d['push'](_0x24657d['shift']());}};_0xdc4b08(++_0x551c56);}(_0x61a2,0x184));var _0x261a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x61a2[_0x432682];return _0x463d05;};'use strict';var express=require(_0x261a('0x0'));var router=express[_0x261a('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x261a('0x2'));router[_0x261a('0x3')]('/',auth[_0x261a('0x4')](),controller[_0x261a('0x5')]);module[_0x261a('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 9c0a8c1..79be7a3 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 _0xf19b=['summary','Report','\x20from\x20','description','customfield_11500','email','fields','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','toString','base64','stringify','request','setEncoding','utf8','data','end','statusCode','json','parse','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','x-forwarded-for','connection','remoteAddress','bluebird','../../config/logger','support','3eAmWpBVP0','key','MOTGUI'];(function(_0x3af1c3,_0x1cc7b6){var _0x124cc8=function(_0x532da4){while(--_0x532da4){_0x3af1c3['push'](_0x3af1c3['shift']());}};_0x124cc8(++_0x1cc7b6);}(_0xf19b,0x102));var _0xbf19=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xf19b[_0x6c993a];return _0x27f547;};'use strict';var BPromise=require(_0xbf19('0x0'));var https=require('https');var logger=require(_0xbf19('0x1'))('api');var USERNAME=_0xbf19('0x2');var PASSWORD=_0xbf19('0x3');function openIssue(_0x3dde51,_0x15422e){var _0x453690={'fields':{'project':{'key':_0x3dde51[_0xbf19('0x4')]||_0xbf19('0x5')},'summary':(_0x3dde51[_0xbf19('0x6')]||_0xbf19('0x7'))+_0xbf19('0x8')+_0x3dde51['ip'],'description':_0x3dde51[_0xbf19('0x9')]||JSON['stringify'](_0x3dde51),'issuetype':{'name':_0x3dde51['issuetype']||'Bug'}}};_0x453690['fields'][_0xbf19('0xa')]=_0x3dde51[_0xbf19('0xb')];_0x453690[_0xbf19('0xc')][_0xbf19('0xd')]=_0x3dde51['oldToken'];_0x453690[_0xbf19('0xc')][_0xbf19('0xe')]=_0x3dde51[_0xbf19('0xf')];_0x453690[_0xbf19('0xc')][_0xbf19('0x10')]=_0x3dde51[_0xbf19('0x11')];_0x453690[_0xbf19('0xc')][_0xbf19('0x12')]=_0x3dde51[_0xbf19('0x13')];_0x453690[_0xbf19('0xc')][_0xbf19('0x14')]=_0x3dde51['ip'];var _0x403890={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xbf19('0x15'),'method':_0xbf19('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xbf19('0x17'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xbf19('0x18')](_0xbf19('0x19'))}};var _0x3c5ed1=JSON[_0xbf19('0x1a')](_0x453690);var _0x1a3f20=https[_0xbf19('0x1b')](_0x403890,function(_0x460397){_0x460397[_0xbf19('0x1c')](_0xbf19('0x1d'));var _0x5ad907='';_0x460397['on'](_0xbf19('0x1e'),function(_0x353d7e){_0x5ad907+=_0x353d7e;});_0x460397['on'](_0xbf19('0x1f'),function(){if(_0x15422e){return _0x15422e['status'](_0x460397[_0xbf19('0x20')])[_0xbf19('0x21')](JSON[_0xbf19('0x22')](_0x5ad907));}});});_0x1a3f20['on'](_0xbf19('0x23'),function(_0xf74db0){if(_0x15422e){return _0x15422e[_0xbf19('0x24')](0x1f4)[_0xbf19('0x21')]({'errors':[{'message':_0xbf19('0x25'),'type':_0xbf19('0x26')}]});}});_0x1a3f20[_0xbf19('0x27')](_0x3c5ed1);_0x1a3f20[_0xbf19('0x1f')]();}exports[_0xbf19('0x28')]=openIssue;exports['send']=function(_0xf4d0a3,_0x24eefd){_0xf4d0a3['body']['ip']=_0xf4d0a3['headers'][_0xbf19('0x29')]||_0xf4d0a3[_0xbf19('0x2a')][_0xbf19('0x2b')]||_0xf4d0a3['socket']['remoteAddress']||_0xf4d0a3[_0xbf19('0x2a')]['socket'][_0xbf19('0x2b')];return openIssue(_0xf4d0a3['body'],_0x24eefd);}; \ No newline at end of file +var _0xc36c=['Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','body','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','stringify','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','parse','error','json'];(function(_0xadd012,_0x510368){var _0x3cc371=function(_0xaa583d){while(--_0xaa583d){_0xadd012['push'](_0xadd012['shift']());}};_0x3cc371(++_0x510368);}(_0xc36c,0x1c4));var _0xcc36=function(_0x21c469,_0x53cb89){_0x21c469=_0x21c469-0x0;var _0x3ade36=_0xc36c[_0x21c469];return _0x3ade36;};'use strict';var BPromise=require('bluebird');var https=require(_0xcc36('0x0'));var logger=require(_0xcc36('0x1'))('api');var USERNAME=_0xcc36('0x2');var PASSWORD=_0xcc36('0x3');function openIssue(_0x411088,_0x4e8296){var _0x4763e7={'fields':{'project':{'key':_0x411088[_0xcc36('0x4')]||_0xcc36('0x5')},'summary':(_0x411088['summary']||_0xcc36('0x6'))+_0xcc36('0x7')+_0x411088['ip'],'description':_0x411088[_0xcc36('0x8')]||JSON[_0xcc36('0x9')](_0x411088),'issuetype':{'name':_0x411088['issuetype']||_0xcc36('0xa')}}};_0x4763e7[_0xcc36('0xb')][_0xcc36('0xc')]=_0x411088['email'];_0x4763e7[_0xcc36('0xb')][_0xcc36('0xd')]=_0x411088[_0xcc36('0xe')];_0x4763e7[_0xcc36('0xb')][_0xcc36('0xf')]=_0x411088[_0xcc36('0x10')];_0x4763e7[_0xcc36('0xb')][_0xcc36('0x11')]=_0x411088[_0xcc36('0x12')];_0x4763e7[_0xcc36('0xb')][_0xcc36('0x13')]=_0x411088[_0xcc36('0x14')];_0x4763e7[_0xcc36('0xb')][_0xcc36('0x15')]=_0x411088['ip'];var _0x40855b={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xcc36('0x16'),'method':_0xcc36('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xcc36('0x18'),'Authorization':_0xcc36('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0xcc36('0x1a')](_0xcc36('0x1b'))}};var _0x45948e=JSON[_0xcc36('0x9')](_0x4763e7);var _0x225bca=https[_0xcc36('0x1c')](_0x40855b,function(_0x4dbd52){_0x4dbd52[_0xcc36('0x1d')](_0xcc36('0x1e'));var _0x36d1ff='';_0x4dbd52['on'](_0xcc36('0x1f'),function(_0x10fcbe){_0x36d1ff+=_0x10fcbe;});_0x4dbd52['on'](_0xcc36('0x20'),function(){if(_0x4e8296){return _0x4e8296[_0xcc36('0x21')](_0x4dbd52[_0xcc36('0x22')])['json'](JSON[_0xcc36('0x23')](_0x36d1ff));}});});_0x225bca['on'](_0xcc36('0x24'),function(_0x55add6){if(_0x4e8296){return _0x4e8296['status'](0x1f4)[_0xcc36('0x25')]({'errors':[{'message':_0xcc36('0x26'),'type':_0xcc36('0x27')}]});}});_0x225bca[_0xcc36('0x28')](_0x45948e);_0x225bca['end']();}exports[_0xcc36('0x29')]=openIssue;exports[_0xcc36('0x2a')]=function(_0x2efcdc,_0x18ccfc){_0x2efcdc['body']['ip']=_0x2efcdc[_0xcc36('0x2b')][_0xcc36('0x2c')]||_0x2efcdc[_0xcc36('0x2d')][_0xcc36('0x2e')]||_0x2efcdc['socket'][_0xcc36('0x2e')]||_0x2efcdc[_0xcc36('0x2d')][_0xcc36('0x2f')][_0xcc36('0x2e')];return openIssue(_0x2efcdc[_0xcc36('0x30')],_0x18ccfc);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 0e6a4cd..5b9ce46 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 _0xbf2b=['/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x2bc328,_0x329b0f){var _0x44ba81=function(_0x2e62d2){while(--_0x2e62d2){_0x2bc328['push'](_0x2bc328['shift']());}};_0x44ba81(++_0x329b0f);}(_0xbf2b,0xb0));var _0xbbf2=function(_0x5f255c,_0x170ba3){_0x5f255c=_0x5f255c-0x0;var _0x1375ab=_0xbf2b[_0x5f255c];return _0x1375ab;};'use strict';var multer=require(_0xbbf2('0x0'));var util=require(_0xbbf2('0x1'));var path=require(_0xbbf2('0x2'));var timeout=require(_0xbbf2('0x3'));var express=require(_0xbbf2('0x4'));var router=express[_0xbbf2('0x5')]();var auth=require(_0xbbf2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbbf2('0x7'));var controller=require('./jscriptyAnswerReport.controller');router['get']('/',auth[_0xbbf2('0x8')](),controller[_0xbbf2('0x9')]);router[_0xbbf2('0xa')](_0xbbf2('0xb'),auth[_0xbbf2('0x8')](),controller[_0xbbf2('0xc')]);router[_0xbbf2('0xa')](_0xbbf2('0xd'),auth['isAuthenticated'](),controller[_0xbbf2('0xe')]);router[_0xbbf2('0xf')]('/',auth[_0xbbf2('0x8')](),controller[_0xbbf2('0x10')]);router[_0xbbf2('0x11')](_0xbbf2('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xbbf2('0x12')](_0xbbf2('0xd'),auth[_0xbbf2('0x8')](),controller[_0xbbf2('0x13')]);module[_0xbbf2('0x14')]=router; \ No newline at end of file +var _0xeb71=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x119cd8,_0x556b73){var _0x7072a3=function(_0x5908d1){while(--_0x5908d1){_0x119cd8['push'](_0x119cd8['shift']());}};_0x7072a3(++_0x556b73);}(_0xeb71,0xb8));var _0x1eb7=function(_0x332e8a,_0x189cd1){_0x332e8a=_0x332e8a-0x0;var _0xd4b128=_0xeb71[_0x332e8a];return _0xd4b128;};'use strict';var multer=require(_0x1eb7('0x0'));var util=require(_0x1eb7('0x1'));var path=require(_0x1eb7('0x2'));var timeout=require(_0x1eb7('0x3'));var express=require(_0x1eb7('0x4'));var router=express[_0x1eb7('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x1eb7('0x6'));var config=require(_0x1eb7('0x7'));var controller=require('./jscriptyAnswerReport.controller');router[_0x1eb7('0x8')]('/',auth[_0x1eb7('0x9')](),controller[_0x1eb7('0xa')]);router[_0x1eb7('0x8')](_0x1eb7('0xb'),auth[_0x1eb7('0x9')](),controller[_0x1eb7('0xc')]);router[_0x1eb7('0x8')](_0x1eb7('0xd'),auth['isAuthenticated'](),controller[_0x1eb7('0xe')]);router[_0x1eb7('0xf')]('/',auth[_0x1eb7('0x9')](),controller[_0x1eb7('0x10')]);router[_0x1eb7('0x11')](_0x1eb7('0xd'),auth[_0x1eb7('0x9')](),controller[_0x1eb7('0x12')]);router['delete'](_0x1eb7('0xd'),auth[_0x1eb7('0x9')](),controller[_0x1eb7('0x13')]);module[_0x1eb7('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index be2424c..b2073ca 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 _0xe605=['STRING','sequelize','exports','TEXT','long'];(function(_0x56be2b,_0x565af8){var _0x4933df=function(_0x4f6097){while(--_0x4f6097){_0x56be2b['push'](_0x56be2b['shift']());}};_0x4933df(++_0x565af8);}(_0xe605,0x92));var _0x5e60=function(_0x3aa57d,_0x40e106){_0x3aa57d=_0x3aa57d-0x0;var _0x3f8616=_0xe605[_0x3aa57d];return _0x3f8616;};'use strict';var Sequelize=require(_0x5e60('0x0'));module[_0x5e60('0x1')]={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize[_0x5e60('0x2')](_0x5e60('0x3'))},'membername':{'type':Sequelize[_0x5e60('0x4')]},'projectname':{'type':Sequelize[_0x5e60('0x4')]},'queue':{'type':Sequelize[_0x5e60('0x4')]},'uniqueid':{'type':Sequelize[_0x5e60('0x4')]},'calleridname':{'type':Sequelize[_0x5e60('0x4')]},'calleridnum':{'type':Sequelize[_0x5e60('0x4')]},'questionId':{'type':Sequelize[_0x5e60('0x4')]}}; \ No newline at end of file +var _0x5eb8=['long','STRING','TEXT'];(function(_0x408757,_0x20b1c8){var _0x23d15d=function(_0x5937a8){while(--_0x5937a8){_0x408757['push'](_0x408757['shift']());}};_0x23d15d(++_0x20b1c8);}(_0x5eb8,0xb0));var _0x85eb=function(_0xfb65aa,_0x1651a6){_0xfb65aa=_0xfb65aa-0x0;var _0x2aee31=_0x5eb8[_0xfb65aa];return _0x2aee31;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize[_0x85eb('0x0')]},'answer':{'type':Sequelize[_0x85eb('0x0')](_0x85eb('0x1'))},'membername':{'type':Sequelize[_0x85eb('0x2')]},'projectname':{'type':Sequelize[_0x85eb('0x2')]},'queue':{'type':Sequelize[_0x85eb('0x2')]},'uniqueid':{'type':Sequelize[_0x85eb('0x2')]},'calleridname':{'type':Sequelize[_0x85eb('0x2')]},'calleridnum':{'type':Sequelize[_0x85eb('0x2')]},'questionId':{'type':Sequelize[_0x85eb('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 1c7c080..98f8294 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 _0x77af=['update','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x3f1710,_0x3877a2){var _0x528458=function(_0x4b5d0f){while(--_0x4b5d0f){_0x3f1710['push'](_0x3f1710['shift']());}};_0x528458(++_0x3877a2);}(_0x77af,0x19c));var _0xf77a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x77af[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require(_0xf77a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf77a('0x1'));var zipdir=require(_0xf77a('0x2'));var jsonpatch=require(_0xf77a('0x3'));var rp=require('request-promise');var moment=require(_0xf77a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf77a('0x5'));var sox=require('sox');var csv=require(_0xf77a('0x6'));var ejs=require(_0xf77a('0x7'));var fs=require('fs');var _=require(_0xf77a('0x8'));var squel=require('squel');var crypto=require(_0xf77a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xf77a('0xa'));var toCsv=require(_0xf77a('0x6'));var querystring=require(_0xf77a('0xb'));var Papa=require(_0xf77a('0xc'));var Redis=require(_0xf77a('0xd'));var authService=require(_0xf77a('0xe'));var qs=require(_0xf77a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf77a('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xf77a('0x11'));var config=require(_0xf77a('0x12'));var licenseUtil=require(_0xf77a('0x13'));var db=require(_0xf77a('0x14'))['db'];function respondWithStatusCode(_0x33f9e2,_0x450e7f){_0x450e7f=_0x450e7f||0xcc;return function(_0x3c1650){if(_0x3c1650){return _0x33f9e2[_0xf77a('0x15')](_0x450e7f);}return _0x33f9e2[_0xf77a('0x16')](_0x450e7f)[_0xf77a('0x17')]();};}function respondWithResult(_0x455500,_0x2eb4eb){_0x2eb4eb=_0x2eb4eb||0xc8;return function(_0x43963a){if(_0x43963a){return _0x455500[_0xf77a('0x16')](_0x2eb4eb)[_0xf77a('0x18')](_0x43963a);}};}function respondWithFilteredResult(_0x10d811,_0x3f65b4){return function(_0x30ec92){if(_0x30ec92){var _0x5bb037=_0x30ec92[_0xf77a('0x19')],_0x2625c4=_0x3f65b4[_0xf77a('0x1a')],_0x4b3c29=_0x3f65b4['offset']+_0x3f65b4[_0xf77a('0x1b')],_0x1d1bfb;if(_0x4b3c29>=_0x5bb037){_0x4b3c29=_0x5bb037;_0x1d1bfb=0xc8;}else{_0x1d1bfb=0xce;}_0x10d811[_0xf77a('0x16')](_0x1d1bfb);return _0x10d811[_0xf77a('0x1c')](_0xf77a('0x1d'),_0x2625c4+'-'+_0x4b3c29+'/'+_0x5bb037)[_0xf77a('0x18')](_0x30ec92);}return null;};}function patchUpdates(_0x397411){return function(_0xe7eba1){try{jsonpatch[_0xf77a('0x1e')](_0xe7eba1,_0x397411,!![]);}catch(_0x248bc2){return BPromise[_0xf77a('0x1f')](_0x248bc2);}return _0xe7eba1['save']();};}function saveUpdates(_0x174743,_0x3f64f3){return function(_0x408ca6){if(_0x408ca6){return _0x408ca6[_0xf77a('0x20')](_0x174743)['then'](function(_0x196158){return _0x196158;});}return null;};}function removeEntity(_0x4036ed,_0x4230c0){return function(_0x2f3ef7){if(_0x2f3ef7){return _0x2f3ef7['destroy']()[_0xf77a('0x21')](function(){_0x4036ed[_0xf77a('0x16')](0xcc)[_0xf77a('0x17')]();});}};}function handleEntityNotFound(_0x6da2d1,_0x46075b){return function(_0x51b06e){if(!_0x51b06e){_0x6da2d1[_0xf77a('0x15')](0x194);}return _0x51b06e;};}function handleError(_0x8dda22,_0x5c346a){_0x5c346a=_0x5c346a||0x1f4;return function(_0x22f8c1){logger[_0xf77a('0x22')](_0x22f8c1[_0xf77a('0x23')]);if(_0x22f8c1[_0xf77a('0x24')]){delete _0x22f8c1[_0xf77a('0x24')];}_0x8dda22[_0xf77a('0x16')](_0x5c346a)[_0xf77a('0x25')](_0x22f8c1);};}exports[_0xf77a('0x26')]=function(_0xf10278,_0x219d8a){var _0x2c34ae={},_0x188e0b={},_0x4e367e={'count':0x0,'rows':[]};var _0x1e2643=_[_0xf77a('0x27')](db[_0xf77a('0x28')][_0xf77a('0x29')],function(_0x87a495){return{'name':_0x87a495[_0xf77a('0x2a')],'type':_0x87a495['type'][_0xf77a('0x2b')]};});_0x188e0b[_0xf77a('0x2c')]=_[_0xf77a('0x27')](_0x1e2643,_0xf77a('0x24'));_0x188e0b[_0xf77a('0x2d')]=_['keys'](_0xf10278['query']);_0x188e0b[_0xf77a('0x2e')]=_['intersection'](_0x188e0b['model'],_0x188e0b[_0xf77a('0x2d')]);_0x2c34ae[_0xf77a('0x2f')]=_[_0xf77a('0x30')](_0x188e0b[_0xf77a('0x2c')],qs['fields'](_0xf10278[_0xf77a('0x2d')][_0xf77a('0x31')]));_0x2c34ae['attributes']=_0x2c34ae[_0xf77a('0x2f')][_0xf77a('0x32')]?_0x2c34ae[_0xf77a('0x2f')]:_0x188e0b[_0xf77a('0x2c')];if(!_0xf10278[_0xf77a('0x2d')][_0xf77a('0x33')](_0xf77a('0x34'))){_0x2c34ae[_0xf77a('0x1b')]=qs[_0xf77a('0x1b')](_0xf10278['query'][_0xf77a('0x1b')]);_0x2c34ae[_0xf77a('0x1a')]=qs[_0xf77a('0x1a')](_0xf10278['query'][_0xf77a('0x1a')]);}_0x2c34ae[_0xf77a('0x35')]=qs['sort'](_0xf10278[_0xf77a('0x2d')][_0xf77a('0x36')]);_0x2c34ae[_0xf77a('0x37')]=qs[_0xf77a('0x2e')](_[_0xf77a('0x38')](_0xf10278[_0xf77a('0x2d')],_0x188e0b[_0xf77a('0x2e')]),_0x1e2643);if(_0xf10278[_0xf77a('0x2d')][_0xf77a('0x39')]){_0x2c34ae[_0xf77a('0x37')]=_[_0xf77a('0x3a')](_0x2c34ae[_0xf77a('0x37')],{'$or':_[_0xf77a('0x27')](_0x1e2643,function(_0x501dd9){if(_0x501dd9[_0xf77a('0x3b')]!==_0xf77a('0x3c')){var _0x4b65a0={};_0x4b65a0[_0x501dd9[_0xf77a('0x24')]]={'$like':'%'+_0xf10278[_0xf77a('0x2d')][_0xf77a('0x39')]+'%'};return _0x4b65a0;}})});}_0x2c34ae=_[_0xf77a('0x3a')]({},_0x2c34ae,_0xf10278[_0xf77a('0x3d')]);var _0x147fc4={'where':_0x2c34ae[_0xf77a('0x37')]};return db[_0xf77a('0x28')][_0xf77a('0x19')](_0x147fc4)[_0xf77a('0x21')](function(_0x1a8029){_0x4e367e['count']=_0x1a8029;if(_0xf10278[_0xf77a('0x2d')][_0xf77a('0x3e')]){_0x2c34ae[_0xf77a('0x3f')]=[{'all':!![]}];}return db[_0xf77a('0x28')][_0xf77a('0x40')](_0x2c34ae);})[_0xf77a('0x21')](function(_0x41b827){_0x4e367e[_0xf77a('0x41')]=_0x41b827;return _0x4e367e;})[_0xf77a('0x21')](respondWithFilteredResult(_0x219d8a,_0x2c34ae))[_0xf77a('0x42')](handleError(_0x219d8a,null));};exports[_0xf77a('0x43')]=function(_0x50012f,_0x35f213){var _0x594052={'raw':!![],'where':{'id':_0x50012f[_0xf77a('0x44')]['id']}},_0x32ba59={};_0x32ba59['model']=_[_0xf77a('0x45')](db[_0xf77a('0x28')][_0xf77a('0x29')]);_0x32ba59[_0xf77a('0x2d')]=_[_0xf77a('0x45')](_0x50012f[_0xf77a('0x2d')]);_0x32ba59['filters']=_['intersection'](_0x32ba59[_0xf77a('0x2c')],_0x32ba59[_0xf77a('0x2d')]);_0x594052[_0xf77a('0x2f')]=_['intersection'](_0x32ba59[_0xf77a('0x2c')],qs[_0xf77a('0x31')](_0x50012f[_0xf77a('0x2d')][_0xf77a('0x31')]));_0x594052[_0xf77a('0x2f')]=_0x594052[_0xf77a('0x2f')][_0xf77a('0x32')]?_0x594052[_0xf77a('0x2f')]:_0x32ba59[_0xf77a('0x2c')];if(_0x50012f['query'][_0xf77a('0x3e')]){_0x594052[_0xf77a('0x3f')]=[{'all':!![]}];}_0x594052=_[_0xf77a('0x3a')]({},_0x594052,_0x50012f[_0xf77a('0x3d')]);return db['JscriptyAnswerReport'][_0xf77a('0x46')](_0x594052)['then'](handleEntityNotFound(_0x35f213,null))[_0xf77a('0x21')](respondWithResult(_0x35f213,null))[_0xf77a('0x42')](handleError(_0x35f213,null));};exports['create']=function(_0xd6f6cc,_0x417e24){return db[_0xf77a('0x28')][_0xf77a('0x47')](_0xd6f6cc[_0xf77a('0x48')],{})[_0xf77a('0x21')](respondWithResult(_0x417e24,0xc9))['catch'](handleError(_0x417e24,null));};exports['update']=function(_0x105c71,_0x42af80){if(_0x105c71[_0xf77a('0x48')]['id']){delete _0x105c71[_0xf77a('0x48')]['id'];}return db[_0xf77a('0x28')][_0xf77a('0x46')]({'where':{'id':_0x105c71[_0xf77a('0x44')]['id']}})['then'](handleEntityNotFound(_0x42af80,null))[_0xf77a('0x21')](saveUpdates(_0x105c71[_0xf77a('0x48')],null))[_0xf77a('0x21')](respondWithResult(_0x42af80,null))[_0xf77a('0x42')](handleError(_0x42af80,null));};exports['destroy']=function(_0x1616b6,_0x232ae6){return db[_0xf77a('0x28')][_0xf77a('0x46')]({'where':{'id':_0x1616b6['params']['id']}})[_0xf77a('0x21')](handleEntityNotFound(_0x232ae6,null))[_0xf77a('0x21')](removeEntity(_0x232ae6,null))[_0xf77a('0x42')](handleError(_0x232ae6,null));};exports[_0xf77a('0x49')]=function(_0x2d008d,_0x2883b7){return db[_0xf77a('0x28')][_0xf77a('0x49')]()[_0xf77a('0x21')](respondWithResult(_0x2883b7,null))[_0xf77a('0x42')](handleError(_0x2883b7,null));}; \ No newline at end of file +var _0x98ca=['../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','json','apply','save','update','destroy','error','stack','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','then','show','params','find','create','body','catch','describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../config/license/hardware'];(function(_0x3f161e,_0x164102){var _0x142d66=function(_0x549a1c){while(--_0x549a1c){_0x3f161e['push'](_0x3f161e['shift']());}};_0x142d66(++_0x164102);}(_0x98ca,0x149));var _0xa98c=function(_0x4ac0bc,_0x54e10d){_0x4ac0bc=_0x4ac0bc-0x0;var _0x5cd1b2=_0x98ca[_0x4ac0bc];return _0x5cd1b2;};'use strict';var pdf=require(_0xa98c('0x0'));var emlformat=require(_0xa98c('0x1'));var rimraf=require(_0xa98c('0x2'));var zipdir=require(_0xa98c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa98c('0x4'));var BPromise=require(_0xa98c('0x5'));var Mustache=require(_0xa98c('0x6'));var util=require(_0xa98c('0x7'));var path=require('path');var sox=require(_0xa98c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa98c('0x9'));var jsforce=require(_0xa98c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa98c('0xb'));var querystring=require(_0xa98c('0xc'));var Papa=require(_0xa98c('0xd'));var Redis=require(_0xa98c('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa98c('0xf'));var logger=require(_0xa98c('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xa98c('0x11'));var licenseUtil=require(_0xa98c('0x12'));var db=require(_0xa98c('0x13'))['db'];function respondWithStatusCode(_0x2c4fe8,_0x3ca906){_0x3ca906=_0x3ca906||0xcc;return function(_0x32ebf7){if(_0x32ebf7){return _0x2c4fe8[_0xa98c('0x14')](_0x3ca906);}return _0x2c4fe8[_0xa98c('0x15')](_0x3ca906)[_0xa98c('0x16')]();};}function respondWithResult(_0x3351b9,_0x242f3d){_0x242f3d=_0x242f3d||0xc8;return function(_0x100c57){if(_0x100c57){return _0x3351b9[_0xa98c('0x15')](_0x242f3d)['json'](_0x100c57);}};}function respondWithFilteredResult(_0x171654,_0x4d441f){return function(_0x362f1f){if(_0x362f1f){var _0x16baf0=_0x362f1f['count'],_0x55da8e=_0x4d441f[_0xa98c('0x17')],_0x116898=_0x4d441f[_0xa98c('0x17')]+_0x4d441f[_0xa98c('0x18')],_0x105e84;if(_0x116898>=_0x16baf0){_0x116898=_0x16baf0;_0x105e84=0xc8;}else{_0x105e84=0xce;}_0x171654['status'](_0x105e84);return _0x171654[_0xa98c('0x19')]('Content-Range',_0x55da8e+'-'+_0x116898+'/'+_0x16baf0)[_0xa98c('0x1a')](_0x362f1f);}return null;};}function patchUpdates(_0x1435a3){return function(_0x2ebd8b){try{jsonpatch[_0xa98c('0x1b')](_0x2ebd8b,_0x1435a3,!![]);}catch(_0x443ac7){return BPromise['reject'](_0x443ac7);}return _0x2ebd8b[_0xa98c('0x1c')]();};}function saveUpdates(_0x3b8588,_0x4ba5b0){return function(_0x248243){if(_0x248243){return _0x248243[_0xa98c('0x1d')](_0x3b8588)['then'](function(_0x1c1353){return _0x1c1353;});}return null;};}function removeEntity(_0x32f04d,_0x4e2d7f){return function(_0x1b1c6d){if(_0x1b1c6d){return _0x1b1c6d[_0xa98c('0x1e')]()['then'](function(){_0x32f04d[_0xa98c('0x15')](0xcc)[_0xa98c('0x16')]();});}};}function handleEntityNotFound(_0x4ef891,_0x4cd156){return function(_0x20918b){if(!_0x20918b){_0x4ef891[_0xa98c('0x14')](0x194);}return _0x20918b;};}function handleError(_0x5ed3b3,_0x557926){_0x557926=_0x557926||0x1f4;return function(_0x3314bd){logger[_0xa98c('0x1f')](_0x3314bd[_0xa98c('0x20')]);if(_0x3314bd['name']){delete _0x3314bd[_0xa98c('0x21')];}_0x5ed3b3[_0xa98c('0x15')](_0x557926)['send'](_0x3314bd);};}exports[_0xa98c('0x22')]=function(_0x41dcd1,_0x328ab7){var _0x4f729a={},_0x19f973={},_0x531900={'count':0x0,'rows':[]};var _0x2260bf=_[_0xa98c('0x23')](db[_0xa98c('0x24')][_0xa98c('0x25')],function(_0x1d7f49){return{'name':_0x1d7f49[_0xa98c('0x26')],'type':_0x1d7f49[_0xa98c('0x27')][_0xa98c('0x28')]};});_0x19f973[_0xa98c('0x29')]=_['map'](_0x2260bf,_0xa98c('0x21'));_0x19f973[_0xa98c('0x2a')]=_[_0xa98c('0x2b')](_0x41dcd1[_0xa98c('0x2a')]);_0x19f973[_0xa98c('0x2c')]=_['intersection'](_0x19f973[_0xa98c('0x29')],_0x19f973[_0xa98c('0x2a')]);_0x4f729a[_0xa98c('0x2d')]=_[_0xa98c('0x2e')](_0x19f973[_0xa98c('0x29')],qs[_0xa98c('0x2f')](_0x41dcd1[_0xa98c('0x2a')][_0xa98c('0x2f')]));_0x4f729a[_0xa98c('0x2d')]=_0x4f729a[_0xa98c('0x2d')][_0xa98c('0x30')]?_0x4f729a['attributes']:_0x19f973[_0xa98c('0x29')];if(!_0x41dcd1[_0xa98c('0x2a')]['hasOwnProperty'](_0xa98c('0x31'))){_0x4f729a['limit']=qs[_0xa98c('0x18')](_0x41dcd1['query'][_0xa98c('0x18')]);_0x4f729a[_0xa98c('0x17')]=qs['offset'](_0x41dcd1[_0xa98c('0x2a')][_0xa98c('0x17')]);}_0x4f729a[_0xa98c('0x32')]=qs[_0xa98c('0x33')](_0x41dcd1[_0xa98c('0x2a')][_0xa98c('0x33')]);_0x4f729a[_0xa98c('0x34')]=qs[_0xa98c('0x2c')](_['pick'](_0x41dcd1['query'],_0x19f973[_0xa98c('0x2c')]),_0x2260bf);if(_0x41dcd1['query'][_0xa98c('0x35')]){_0x4f729a['where']=_[_0xa98c('0x36')](_0x4f729a[_0xa98c('0x34')],{'$or':_['map'](_0x2260bf,function(_0x2c61d7){if(_0x2c61d7[_0xa98c('0x27')]!==_0xa98c('0x37')){var _0x2918a1={};_0x2918a1[_0x2c61d7[_0xa98c('0x21')]]={'$like':'%'+_0x41dcd1[_0xa98c('0x2a')][_0xa98c('0x35')]+'%'};return _0x2918a1;}})});}_0x4f729a=_['merge']({},_0x4f729a,_0x41dcd1[_0xa98c('0x38')]);var _0x4e9d63={'where':_0x4f729a[_0xa98c('0x34')]};return db[_0xa98c('0x24')][_0xa98c('0x39')](_0x4e9d63)['then'](function(_0x375e8a){_0x531900['count']=_0x375e8a;if(_0x41dcd1[_0xa98c('0x2a')][_0xa98c('0x3a')]){_0x4f729a[_0xa98c('0x3b')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xa98c('0x3c')](_0x4f729a);})['then'](function(_0x82d53b){_0x531900['rows']=_0x82d53b;return _0x531900;})[_0xa98c('0x3d')](respondWithFilteredResult(_0x328ab7,_0x4f729a))['catch'](handleError(_0x328ab7,null));};exports[_0xa98c('0x3e')]=function(_0x49bac9,_0x40d398){var _0x30dd0e={'raw':!![],'where':{'id':_0x49bac9[_0xa98c('0x3f')]['id']}},_0x296cfc={};_0x296cfc['model']=_['keys'](db['JscriptyAnswerReport'][_0xa98c('0x25')]);_0x296cfc[_0xa98c('0x2a')]=_[_0xa98c('0x2b')](_0x49bac9[_0xa98c('0x2a')]);_0x296cfc[_0xa98c('0x2c')]=_[_0xa98c('0x2e')](_0x296cfc[_0xa98c('0x29')],_0x296cfc[_0xa98c('0x2a')]);_0x30dd0e['attributes']=_[_0xa98c('0x2e')](_0x296cfc[_0xa98c('0x29')],qs['fields'](_0x49bac9[_0xa98c('0x2a')]['fields']));_0x30dd0e[_0xa98c('0x2d')]=_0x30dd0e[_0xa98c('0x2d')]['length']?_0x30dd0e[_0xa98c('0x2d')]:_0x296cfc[_0xa98c('0x29')];if(_0x49bac9[_0xa98c('0x2a')][_0xa98c('0x3a')]){_0x30dd0e[_0xa98c('0x3b')]=[{'all':!![]}];}_0x30dd0e=_[_0xa98c('0x36')]({},_0x30dd0e,_0x49bac9[_0xa98c('0x38')]);return db['JscriptyAnswerReport'][_0xa98c('0x40')](_0x30dd0e)[_0xa98c('0x3d')](handleEntityNotFound(_0x40d398,null))[_0xa98c('0x3d')](respondWithResult(_0x40d398,null))['catch'](handleError(_0x40d398,null));};exports[_0xa98c('0x41')]=function(_0x58e7a7,_0x3828f0){return db[_0xa98c('0x24')][_0xa98c('0x41')](_0x58e7a7[_0xa98c('0x42')],{})['then'](respondWithResult(_0x3828f0,0xc9))[_0xa98c('0x43')](handleError(_0x3828f0,null));};exports['update']=function(_0x5d137f,_0x38c617){if(_0x5d137f['body']['id']){delete _0x5d137f[_0xa98c('0x42')]['id'];}return db['JscriptyAnswerReport'][_0xa98c('0x40')]({'where':{'id':_0x5d137f[_0xa98c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x38c617,null))[_0xa98c('0x3d')](saveUpdates(_0x5d137f['body'],null))[_0xa98c('0x3d')](respondWithResult(_0x38c617,null))[_0xa98c('0x43')](handleError(_0x38c617,null));};exports[_0xa98c('0x1e')]=function(_0xce031c,_0x18c8ea){return db[_0xa98c('0x24')]['find']({'where':{'id':_0xce031c[_0xa98c('0x3f')]['id']}})[_0xa98c('0x3d')](handleEntityNotFound(_0x18c8ea,null))[_0xa98c('0x3d')](removeEntity(_0x18c8ea,null))[_0xa98c('0x43')](handleError(_0x18c8ea,null));};exports[_0xa98c('0x44')]=function(_0x51b45d,_0x1fdb5b){return db[_0xa98c('0x24')][_0xa98c('0x44')]()[_0xa98c('0x3d')](respondWithResult(_0x1fdb5b,null))[_0xa98c('0x43')](handleError(_0x1fdb5b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 8311ba4..6ad300e 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 _0xf908=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf908,0x1b0));var _0x8f90=function(_0x42b0e6,_0x5d78ba){_0x42b0e6=_0x42b0e6-0x0;var _0x2e6e52=_0xf908[_0x42b0e6];return _0x2e6e52;};'use strict';var _=require(_0x8f90('0x0'));var util=require(_0x8f90('0x1'));var logger=require(_0x8f90('0x2'))(_0x8f90('0x3'));var moment=require(_0x8f90('0x4'));var BPromise=require(_0x8f90('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8f90('0x6'));var rimraf=require(_0x8f90('0x7'));var config=require(_0x8f90('0x8'));var attributes=require(_0x8f90('0x9'));module[_0x8f90('0xa')]=function(_0x3ff785,_0x2399e4){return _0x3ff785[_0x8f90('0xb')](_0x8f90('0xc'),attributes,{'tableName':_0x8f90('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf546=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x4203a0,_0x1ee83d){var _0x3b0a10=function(_0x564d85){while(--_0x564d85){_0x4203a0['push'](_0x4203a0['shift']());}};_0x3b0a10(++_0x1ee83d);}(_0xf546,0x1d0));var _0x6f54=function(_0x318e7f,_0x4920c5){_0x318e7f=_0x318e7f-0x0;var _0x5aefd9=_0xf546[_0x318e7f];return _0x5aefd9;};'use strict';var _=require(_0x6f54('0x0'));var util=require(_0x6f54('0x1'));var logger=require(_0x6f54('0x2'))(_0x6f54('0x3'));var moment=require(_0x6f54('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f54('0x5'));var rimraf=require(_0x6f54('0x6'));var config=require(_0x6f54('0x7'));var attributes=require(_0x6f54('0x8'));module['exports']=function(_0xefe07,_0x16deff){return _0xefe07['define'](_0x6f54('0x9'),attributes,{'tableName':_0x6f54('0xa'),'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 db3f14c..aafbc74 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 _0x7607=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x7607,0x187));var _0x7760=function(_0x3f9878,_0x2e8893){_0x3f9878=_0x3f9878-0x0;var _0x39d4ab=_0x7607[_0x3f9878];return _0x39d4ab;};'use strict';var _=require(_0x7760('0x0'));var util=require(_0x7760('0x1'));var moment=require(_0x7760('0x2'));var BPromise=require(_0x7760('0x3'));var rs=require(_0x7760('0x4'));var fs=require('fs');var Redis=require(_0x7760('0x5'));var db=require(_0x7760('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7760('0x7'));var jayson=require(_0x7760('0x8'));var client=jayson[_0x7760('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x320bf3,_0x4deae1,_0x335312){return new BPromise(function(_0x45d922,_0x37873f){return client[_0x7760('0xa')](_0x320bf3,_0x335312)[_0x7760('0xb')](function(_0x1156c5){logger[_0x7760('0xc')](_0x7760('0xd'),_0x4deae1,_0x7760('0xe'));logger[_0x7760('0xf')](_0x7760('0x10'),_0x4deae1,'request\x20sent',JSON[_0x7760('0x11')](_0x1156c5));if(_0x1156c5['error']){if(_0x1156c5[_0x7760('0x12')][_0x7760('0x13')]===0x1f4){logger[_0x7760('0x12')](_0x7760('0xd'),_0x4deae1,_0x1156c5[_0x7760('0x12')][_0x7760('0x14')]);return _0x37873f(_0x1156c5[_0x7760('0x12')][_0x7760('0x14')]);}logger[_0x7760('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4deae1,_0x1156c5[_0x7760('0x12')][_0x7760('0x14')]);return _0x45d922(_0x1156c5[_0x7760('0x12')][_0x7760('0x14')]);}else{logger['info'](_0x7760('0xd'),_0x4deae1,_0x7760('0xe'));_0x45d922(_0x1156c5[_0x7760('0x15')]['message']);}})[_0x7760('0x16')](function(_0x425109){logger[_0x7760('0x12')](_0x7760('0xd'),_0x4deae1,_0x425109);_0x37873f(_0x425109);});});} \ No newline at end of file +var _0xccf4=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x45e18e,_0x47cc4d){var _0x175e61=function(_0x23d6c4){while(--_0x23d6c4){_0x45e18e['push'](_0x45e18e['shift']());}};_0x175e61(++_0x47cc4d);}(_0xccf4,0x9b));var _0x4ccf=function(_0x49b5de,_0x57fbfc){_0x49b5de=_0x49b5de-0x0;var _0x5e96cb=_0xccf4[_0x49b5de];return _0x5e96cb;};'use strict';var _=require(_0x4ccf('0x0'));var util=require(_0x4ccf('0x1'));var moment=require(_0x4ccf('0x2'));var BPromise=require(_0x4ccf('0x3'));var rs=require(_0x4ccf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ccf('0x5'))['db'];var utils=require(_0x4ccf('0x6'));var logger=require(_0x4ccf('0x7'))(_0x4ccf('0x8'));var config=require(_0x4ccf('0x9'));var jayson=require(_0x4ccf('0xa'));var client=jayson[_0x4ccf('0xb')][_0x4ccf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x183c6a,_0x2fcc80,_0x1470bb){return new BPromise(function(_0xce3dee,_0x1f9508){return client[_0x4ccf('0xd')](_0x183c6a,_0x1470bb)[_0x4ccf('0xe')](function(_0x38d1db){logger[_0x4ccf('0xf')](_0x4ccf('0x10'),_0x2fcc80,_0x4ccf('0x11'));logger[_0x4ccf('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x2fcc80,'request\x20sent',JSON[_0x4ccf('0x13')](_0x38d1db));if(_0x38d1db[_0x4ccf('0x14')]){if(_0x38d1db[_0x4ccf('0x14')][_0x4ccf('0x15')]===0x1f4){logger[_0x4ccf('0x14')](_0x4ccf('0x10'),_0x2fcc80,_0x38d1db[_0x4ccf('0x14')][_0x4ccf('0x16')]);return _0x1f9508(_0x38d1db[_0x4ccf('0x14')][_0x4ccf('0x16')]);}logger[_0x4ccf('0x14')](_0x4ccf('0x10'),_0x2fcc80,_0x38d1db[_0x4ccf('0x14')]['message']);return _0xce3dee(_0x38d1db[_0x4ccf('0x14')]['message']);}else{logger[_0x4ccf('0xf')](_0x4ccf('0x10'),_0x2fcc80,_0x4ccf('0x11'));_0xce3dee(_0x38d1db[_0x4ccf('0x17')][_0x4ccf('0x16')]);}})[_0x4ccf('0x18')](function(_0x1cb785){logger['error'](_0x4ccf('0x10'),_0x2fcc80,_0x1cb785);_0x1f9508(_0x1cb785);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 95f6520..0b6d6bf 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 _0x12a7=['/:id/clone','clone','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','index','get','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x12a7,0xd0));var _0x712a=function(_0x1791c4,_0x9d5a76){_0x1791c4=_0x1791c4-0x0;var _0x20316a=_0x12a7[_0x1791c4];return _0x20316a;};'use strict';var multer=require(_0x712a('0x0'));var util=require(_0x712a('0x1'));var path=require(_0x712a('0x2'));var timeout=require(_0x712a('0x3'));var express=require(_0x712a('0x4'));var router=express[_0x712a('0x5')]();var auth=require(_0x712a('0x6'));var interaction=require(_0x712a('0x7'));var config=require(_0x712a('0x8'));var controller=require(_0x712a('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x712a('0xa')]);router[_0x712a('0xb')](_0x712a('0xc'),auth[_0x712a('0xd')](),controller[_0x712a('0xe')]);router[_0x712a('0xb')](_0x712a('0xf'),auth[_0x712a('0xd')](),controller[_0x712a('0x10')]);router[_0x712a('0xb')](_0x712a('0x11'),auth[_0x712a('0xd')](),controller[_0x712a('0x12')]);router[_0x712a('0xb')](_0x712a('0x13'),auth[_0x712a('0xd')](),timeout(_0x712a('0x14')),controller[_0x712a('0x15')]);router[_0x712a('0x16')]('/',auth[_0x712a('0xd')](),controller[_0x712a('0x17')]);router[_0x712a('0x16')](_0x712a('0x18'),auth[_0x712a('0xd')](),controller[_0x712a('0x19')]);router['put'](_0x712a('0xc'),auth['isAuthenticated'](),controller[_0x712a('0x1a')]);router[_0x712a('0x1b')](_0x712a('0xc'),auth['isAuthenticated'](),controller[_0x712a('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x1f7e=['/:id','show','/:id/sessions','isAuthenticated','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','index','get'];(function(_0x36ac10,_0x10d60e){var _0xc3166b=function(_0xb9047e){while(--_0xb9047e){_0x36ac10['push'](_0x36ac10['shift']());}};_0xc3166b(++_0x10d60e);}(_0x1f7e,0xc6));var _0xe1f7=function(_0x3af153,_0x51258e){_0x3af153=_0x3af153-0x0;var _0xdfa90b=_0x1f7e[_0x3af153];return _0xdfa90b;};'use strict';var multer=require(_0xe1f7('0x0'));var util=require(_0xe1f7('0x1'));var path=require(_0xe1f7('0x2'));var timeout=require(_0xe1f7('0x3'));var express=require(_0xe1f7('0x4'));var router=express[_0xe1f7('0x5')]();var auth=require(_0xe1f7('0x6'));var interaction=require(_0xe1f7('0x7'));var config=require(_0xe1f7('0x8'));var controller=require(_0xe1f7('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe1f7('0xa')]);router[_0xe1f7('0xb')](_0xe1f7('0xc'),auth['isAuthenticated'](),controller[_0xe1f7('0xd')]);router[_0xe1f7('0xb')](_0xe1f7('0xe'),auth[_0xe1f7('0xf')](),controller[_0xe1f7('0x10')]);router[_0xe1f7('0xb')](_0xe1f7('0x11'),auth['isAuthenticated'](),controller[_0xe1f7('0x12')]);router[_0xe1f7('0xb')](_0xe1f7('0x13'),auth['isAuthenticated'](),timeout(_0xe1f7('0x14')),controller[_0xe1f7('0x15')]);router[_0xe1f7('0x16')]('/',auth['isAuthenticated'](),controller[_0xe1f7('0x17')]);router['post'](_0xe1f7('0x18'),auth['isAuthenticated'](),controller['clone']);router[_0xe1f7('0x19')](_0xe1f7('0xc'),auth[_0xe1f7('0xf')](),controller[_0xe1f7('0x1a')]);router[_0xe1f7('0x1b')](_0xe1f7('0xc'),auth['isAuthenticated'](),controller[_0xe1f7('0x1c')]);module[_0xe1f7('0x1d')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 0306696..55ada6c 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 _0x62b3=['util','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x62b3,0x19e));var _0x362b=function(_0x53b4cf,_0x44ca9c){_0x53b4cf=_0x53b4cf-0x0;var _0x215faa=_0x62b3[_0x53b4cf];return _0x215faa;};'use strict';var Sequelize=require(_0x362b('0x0'));var _=require(_0x362b('0x1'));var util=require(_0x362b('0x2'));module['exports']={'name':{'type':Sequelize[_0x362b('0x3')],'unique':_0x362b('0x4')},'description':{'type':Sequelize[_0x362b('0x3')]},'formData':{'type':Sequelize[_0x362b('0x5')](_0x362b('0x6')),'set':function(_0x43e5ad){if(_[_0x362b('0x7')](_0x43e5ad)){this[_0x362b('0x8')](_0x362b('0x9'),JSON[_0x362b('0xa')](_0x43e5ad));}else if(_[_0x362b('0xb')](_0x43e5ad)){this[_0x362b('0x8')](_0x362b('0x9'),_0x43e5ad);}else{this[_0x362b('0x8')](_0x362b('0x9'),util['format'](_0x362b('0xc'),this[_0x362b('0xd')]('name')||'',this[_0x362b('0xd')](_0x362b('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x362b('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x362b('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x23f3=['stringify','isString','formData','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','exports','STRING','name','long','isObjectLike'];(function(_0x1649ef,_0x588a91){var _0x2d31e5=function(_0xa7ea2c){while(--_0xa7ea2c){_0x1649ef['push'](_0x1649ef['shift']());}};_0x2d31e5(++_0x588a91);}(_0x23f3,0xea));var _0x323f=function(_0x3d3dfb,_0x562f7f){_0x3d3dfb=_0x3d3dfb-0x0;var _0x28a622=_0x23f3[_0x3d3dfb];return _0x28a622;};'use strict';var Sequelize=require('sequelize');var _=require(_0x323f('0x0'));var util=require('util');module[_0x323f('0x1')]={'name':{'type':Sequelize[_0x323f('0x2')],'unique':_0x323f('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x323f('0x4')),'set':function(_0x5a2e21){if(_[_0x323f('0x5')](_0x5a2e21)){this['setDataValue']('formData',JSON[_0x323f('0x6')](_0x5a2e21));}else if(_[_0x323f('0x7')](_0x5a2e21)){this['setDataValue'](_0x323f('0x8'),_0x5a2e21);}else{this[_0x323f('0x9')]('formData',util[_0x323f('0xa')](_0x323f('0xb'),this[_0x323f('0xc')]('name')||'',this[_0x323f('0xc')](_0x323f('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x323f('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x323f('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 56651f8..bfe75fd 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 _0xdc3e=['getSessions','findOne','JscriptySessionReport','ProjectId','filter','include','getAnswers','JscriptyAnswerReport','findAll','number','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','questionId','question','format','answer','push','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','html-pdf','eml-format','zip-dir','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','name','send','JscriptyProject','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x593c1b,_0x35c524){var _0x4e0c07=function(_0x8c0aab){while(--_0x8c0aab){_0x593c1b['push'](_0x593c1b['shift']());}};_0x4e0c07(++_0x35c524);}(_0xdc3e,0x112));var _0xedc3=function(_0x589170,_0x547741){_0x589170=_0x589170-0x0;var _0x4d1391=_0xdc3e[_0x589170];return _0x4d1391;};'use strict';var pdf=require(_0xedc3('0x0'));var emlformat=require(_0xedc3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xedc3('0x2'));var jsonpatch=require(_0xedc3('0x3'));var rp=require(_0xedc3('0x4'));var moment=require(_0xedc3('0x5'));var BPromise=require(_0xedc3('0x6'));var Mustache=require(_0xedc3('0x7'));var util=require(_0xedc3('0x8'));var path=require(_0xedc3('0x9'));var sox=require(_0xedc3('0xa'));var csv=require(_0xedc3('0xb'));var ejs=require(_0xedc3('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xedc3('0xd'));var crypto=require(_0xedc3('0xe'));var jsforce=require(_0xedc3('0xf'));var deskjs=require(_0xedc3('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xedc3('0x11'));var Redis=require(_0xedc3('0x12'));var authService=require(_0xedc3('0x13'));var qs=require(_0xedc3('0x14'));var as=require(_0xedc3('0x15'));var hardwareService=require(_0xedc3('0x16'));var logger=require(_0xedc3('0x17'))(_0xedc3('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xedc3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x936b41,_0x2e5a9b){_0x2e5a9b=_0x2e5a9b||0xcc;return function(_0x3f542d){if(_0x3f542d){return _0x936b41[_0xedc3('0x1a')](_0x2e5a9b);}return _0x936b41[_0xedc3('0x1b')](_0x2e5a9b)[_0xedc3('0x1c')]();};}function respondWithResult(_0x5c5dc2,_0x6dd77d){_0x6dd77d=_0x6dd77d||0xc8;return function(_0x2c873a){if(_0x2c873a){return _0x5c5dc2[_0xedc3('0x1b')](_0x6dd77d)[_0xedc3('0x1d')](_0x2c873a);}};}function respondWithFilteredResult(_0x6a0d82,_0x419e43){return function(_0x17886b){if(_0x17886b){var _0x1df4cc=_0x17886b[_0xedc3('0x1e')],_0x286f89=_0x419e43[_0xedc3('0x1f')],_0x5b1c6d=_0x419e43['offset']+_0x419e43[_0xedc3('0x20')],_0x74c0ec;if(_0x5b1c6d>=_0x1df4cc){_0x5b1c6d=_0x1df4cc;_0x74c0ec=0xc8;}else{_0x74c0ec=0xce;}_0x6a0d82[_0xedc3('0x1b')](_0x74c0ec);return _0x6a0d82[_0xedc3('0x21')](_0xedc3('0x22'),_0x286f89+'-'+_0x5b1c6d+'/'+_0x1df4cc)[_0xedc3('0x1d')](_0x17886b);}return null;};}function patchUpdates(_0x55a21f){return function(_0x527d70){try{jsonpatch[_0xedc3('0x23')](_0x527d70,_0x55a21f,!![]);}catch(_0x410636){return BPromise[_0xedc3('0x24')](_0x410636);}return _0x527d70[_0xedc3('0x25')]();};}function saveUpdates(_0x205ea2,_0xc67590){return function(_0x28de6f){if(_0x28de6f){return _0x28de6f[_0xedc3('0x26')](_0x205ea2)[_0xedc3('0x27')](function(_0xa21c63){return _0xa21c63;});}return null;};}function removeEntity(_0x21468f,_0xdfed3e){return function(_0x4cbb06){if(_0x4cbb06){return _0x4cbb06[_0xedc3('0x28')]()[_0xedc3('0x27')](function(){var _0x3107ed=_0x4cbb06[_0xedc3('0x29')]({'plain':!![]});var _0x1a0cc8=_0xedc3('0x2a');return db[_0xedc3('0x2b')][_0xedc3('0x28')]({'where':{'type':_0x1a0cc8,'resourceId':_0x3107ed['id']}})[_0xedc3('0x27')](function(){return _0x4cbb06;});})[_0xedc3('0x27')](function(){_0x21468f[_0xedc3('0x1b')](0xcc)[_0xedc3('0x1c')]();});}};}function handleEntityNotFound(_0x15cdc9,_0x15167f){return function(_0x23dce1){if(!_0x23dce1){_0x15cdc9[_0xedc3('0x1a')](0x194);}return _0x23dce1;};}function handleError(_0x5f2203,_0x328a9f){_0x328a9f=_0x328a9f||0x1f4;return function(_0x2e6ba7){logger[_0xedc3('0x2c')](_0x2e6ba7['stack']);if(_0x2e6ba7[_0xedc3('0x2d')]){delete _0x2e6ba7[_0xedc3('0x2d')];}_0x5f2203[_0xedc3('0x1b')](_0x328a9f)[_0xedc3('0x2e')](_0x2e6ba7);};}exports['index']=function(_0x214d9f,_0x42f5e6){var _0x26e01f={},_0x3db1bf={},_0x2e7900={'count':0x0,'rows':[]};var _0x3a1d5=_['map'](db[_0xedc3('0x2f')][_0xedc3('0x30')],function(_0x54c37f){return{'name':_0x54c37f[_0xedc3('0x31')],'type':_0x54c37f[_0xedc3('0x32')][_0xedc3('0x33')]};});_0x3db1bf[_0xedc3('0x34')]=_[_0xedc3('0x35')](_0x3a1d5,_0xedc3('0x2d'));_0x3db1bf[_0xedc3('0x36')]=_[_0xedc3('0x37')](_0x214d9f[_0xedc3('0x36')]);_0x3db1bf[_0xedc3('0x38')]=_['intersection'](_0x3db1bf[_0xedc3('0x34')],_0x3db1bf[_0xedc3('0x36')]);_0x26e01f[_0xedc3('0x39')]=_[_0xedc3('0x3a')](_0x3db1bf[_0xedc3('0x34')],qs[_0xedc3('0x3b')](_0x214d9f[_0xedc3('0x36')][_0xedc3('0x3b')]));_0x26e01f['attributes']=_0x26e01f[_0xedc3('0x39')][_0xedc3('0x3c')]?_0x26e01f[_0xedc3('0x39')]:_0x3db1bf[_0xedc3('0x34')];if(!_0x214d9f[_0xedc3('0x36')][_0xedc3('0x3d')](_0xedc3('0x3e'))){_0x26e01f[_0xedc3('0x20')]=qs['limit'](_0x214d9f['query'][_0xedc3('0x20')]);_0x26e01f[_0xedc3('0x1f')]=qs[_0xedc3('0x1f')](_0x214d9f[_0xedc3('0x36')][_0xedc3('0x1f')]);}_0x26e01f[_0xedc3('0x3f')]=qs[_0xedc3('0x40')](_0x214d9f['query']['sort']);_0x26e01f[_0xedc3('0x41')]=qs[_0xedc3('0x38')](_[_0xedc3('0x42')](_0x214d9f[_0xedc3('0x36')],_0x3db1bf['filters']),_0x3a1d5);if(_0x214d9f[_0xedc3('0x36')]['filter']){_0x26e01f[_0xedc3('0x41')]=_[_0xedc3('0x43')](_0x26e01f[_0xedc3('0x41')],{'$or':_[_0xedc3('0x35')](_0x3a1d5,function(_0x4ab8dd){if(_0x4ab8dd[_0xedc3('0x32')]!==_0xedc3('0x44')){var _0x25d2eb={};_0x25d2eb[_0x4ab8dd[_0xedc3('0x2d')]]={'$like':'%'+_0x214d9f[_0xedc3('0x36')]['filter']+'%'};return _0x25d2eb;}})});}_0x26e01f=_[_0xedc3('0x43')]({},_0x26e01f,_0x214d9f[_0xedc3('0x45')]);var _0x3c75c8={'where':_0x26e01f[_0xedc3('0x41')]};return db['JscriptyProject'][_0xedc3('0x1e')](_0x3c75c8)[_0xedc3('0x27')](function(_0x5a6440){_0x2e7900[_0xedc3('0x1e')]=_0x5a6440;if(_0x214d9f[_0xedc3('0x36')][_0xedc3('0x46')]){_0x26e01f['include']=[{'all':!![]}];}return db[_0xedc3('0x2f')]['findAll'](_0x26e01f);})[_0xedc3('0x27')](function(_0x444a76){_0x2e7900[_0xedc3('0x47')]=_0x444a76;return _0x2e7900;})[_0xedc3('0x27')](respondWithFilteredResult(_0x42f5e6,_0x26e01f))[_0xedc3('0x48')](handleError(_0x42f5e6,null));};exports[_0xedc3('0x49')]=function(_0x46c994,_0x690d70){var _0x437410={'raw':![],'where':{'id':_0x46c994[_0xedc3('0x4a')]['id']}},_0x1a3c58={};_0x1a3c58[_0xedc3('0x34')]=_[_0xedc3('0x37')](db[_0xedc3('0x2f')][_0xedc3('0x30')]);_0x1a3c58[_0xedc3('0x36')]=_[_0xedc3('0x37')](_0x46c994['query']);_0x1a3c58['filters']=_[_0xedc3('0x3a')](_0x1a3c58[_0xedc3('0x34')],_0x1a3c58[_0xedc3('0x36')]);_0x437410[_0xedc3('0x39')]=_['intersection'](_0x1a3c58[_0xedc3('0x34')],qs[_0xedc3('0x3b')](_0x46c994[_0xedc3('0x36')][_0xedc3('0x3b')]));_0x437410[_0xedc3('0x39')]=_0x437410[_0xedc3('0x39')][_0xedc3('0x3c')]?_0x437410[_0xedc3('0x39')]:_0x1a3c58[_0xedc3('0x34')];if(_0x46c994[_0xedc3('0x36')][_0xedc3('0x46')]){_0x437410['include']=[{'all':!![]}];}_0x437410=_['merge']({},_0x437410,_0x46c994[_0xedc3('0x45')]);return db['JscriptyProject'][_0xedc3('0x4b')](_0x437410)[_0xedc3('0x27')](handleEntityNotFound(_0x690d70,null))[_0xedc3('0x27')](respondWithResult(_0x690d70,null))[_0xedc3('0x48')](handleError(_0x690d70,null));};exports[_0xedc3('0x4c')]=function(_0x380e9f,_0x294388){return db[_0xedc3('0x2f')][_0xedc3('0x4c')](_0x380e9f['body'],{})['then'](function(_0x117fb7){var _0x3d8590=_0x380e9f[_0xedc3('0x4d')][_0xedc3('0x29')]({'plain':!![]});if(!_0x3d8590)throw new Error(_0xedc3('0x4e'));if(_0x3d8590[_0xedc3('0x4f')]===_0xedc3('0x4d')){var _0x225a04=_0x117fb7[_0xedc3('0x29')]({'plain':!![]});var _0x53493e=_0xedc3('0x2a');return db[_0xedc3('0x50')][_0xedc3('0x4b')]({'where':{'name':_0x53493e,'userProfileId':_0x3d8590[_0xedc3('0x51')]},'raw':!![]})[_0xedc3('0x27')](function(_0x5453e1){if(_0x5453e1&&_0x5453e1[_0xedc3('0x52')]===0x0){return db[_0xedc3('0x2b')]['create']({'name':_0x225a04['name'],'resourceId':_0x225a04['id'],'type':_0x5453e1[_0xedc3('0x2d')],'sectionId':_0x5453e1['id']},{})[_0xedc3('0x27')](function(){return _0x117fb7;});}else{return _0x117fb7;}})[_0xedc3('0x48')](function(_0x9936cb){logger[_0xedc3('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9936cb);throw _0x9936cb;});}return _0x117fb7;})[_0xedc3('0x27')](respondWithResult(_0x294388,0xc9))['catch'](handleError(_0x294388,null));};exports[_0xedc3('0x53')]=function(_0x59c3fe,_0x7dbf32){var _0x49e71b={'where':{'id':_0x59c3fe[_0xedc3('0x4a')]['id']}},_0x323623={};_0x323623[_0xedc3('0x34')]=_[_0xedc3('0x37')](db[_0xedc3('0x2f')][_0xedc3('0x30')]);_0x49e71b[_0xedc3('0x39')]=_[_0xedc3('0x3a')](_0x323623[_0xedc3('0x34')],qs[_0xedc3('0x3b')](_0x59c3fe[_0xedc3('0x36')][_0xedc3('0x3b')]));_0x49e71b[_0xedc3('0x39')]=_0x49e71b[_0xedc3('0x39')]['length']?_0x49e71b[_0xedc3('0x39')]:_0x323623[_0xedc3('0x34')];if(_0x59c3fe['query'][_0xedc3('0x46')]){_0x49e71b['include']=[{'all':!![]}];}_0x49e71b=_['merge']({},_0x49e71b,_0x59c3fe[_0xedc3('0x45')]);return db[_0xedc3('0x2f')][_0xedc3('0x4b')](_0x49e71b)[_0xedc3('0x27')](handleEntityNotFound(_0x7dbf32,null))['then'](function(_0x46d8e1){if(_0x46d8e1){var _0x1e48ea=_0x46d8e1[_0xedc3('0x29')]({'plain':!![]});_0x1e48ea=qs[_0xedc3('0x54')](_0x1e48ea,['id',_0xedc3('0x55'),_0xedc3('0x56')]);_0x59c3fe[_0xedc3('0x57')]=_[_0xedc3('0x54')](_0x59c3fe[_0xedc3('0x57')],['id',_0xedc3('0x55'),'updatedAt']);return db[_0xedc3('0x2f')]['create'](_[_0xedc3('0x43')](_0x1e48ea,_0x59c3fe[_0xedc3('0x57')]),{'include':_0x59c3fe[_0xedc3('0x36')][_0xedc3('0x46')]?[{'all':!![]}]:undefined})[_0xedc3('0x27')](function(_0x2bc4ec){var _0x24c020=_0x59c3fe['user'][_0xedc3('0x29')]({'plain':!![]});if(!_0x24c020)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24c020[_0xedc3('0x4f')]===_0xedc3('0x4d')){var _0x4df3ad=_0x2bc4ec[_0xedc3('0x29')]({'plain':!![]});var _0x41fd7d=_0xedc3('0x2a');return db[_0xedc3('0x50')][_0xedc3('0x4b')]({'where':{'name':_0x41fd7d,'userProfileId':_0x24c020[_0xedc3('0x51')]},'raw':!![]})[_0xedc3('0x27')](function(_0xdda77f){if(_0xdda77f&&_0xdda77f[_0xedc3('0x52')]===0x0){return db[_0xedc3('0x2b')][_0xedc3('0x4c')]({'name':_0x4df3ad[_0xedc3('0x2d')],'resourceId':_0x4df3ad['id'],'type':_0xdda77f[_0xedc3('0x2d')],'sectionId':_0xdda77f['id']},{})['then'](function(){return _0x2bc4ec;});}else{return _0x2bc4ec;}})['catch'](function(_0x2816c9){logger[_0xedc3('0x2c')](_0xedc3('0x58'),_0x2816c9);throw _0x2816c9;});}return _0x2bc4ec;});}})[_0xedc3('0x27')](respondWithResult(_0x7dbf32,0xc9))[_0xedc3('0x48')](handleError(_0x7dbf32,null));};exports['update']=function(_0x498435,_0x280ae2){if(_0x498435['body']['id']){delete _0x498435[_0xedc3('0x57')]['id'];}return db[_0xedc3('0x2f')]['find']({'where':{'id':_0x498435[_0xedc3('0x4a')]['id']}})[_0xedc3('0x27')](handleEntityNotFound(_0x280ae2,null))['then'](saveUpdates(_0x498435[_0xedc3('0x57')],null))[_0xedc3('0x27')](respondWithResult(_0x280ae2,null))[_0xedc3('0x48')](handleError(_0x280ae2,null));};exports['destroy']=function(_0x1dda10,_0x405462){return db['JscriptyProject'][_0xedc3('0x4b')]({'where':{'id':_0x1dda10[_0xedc3('0x4a')]['id']}})[_0xedc3('0x27')](handleEntityNotFound(_0x405462,null))[_0xedc3('0x27')](removeEntity(_0x405462,null))[_0xedc3('0x48')](handleError(_0x405462,null));};exports[_0xedc3('0x59')]=function(_0x2a40c5,_0x526cde,_0x2843fa){var _0x59e248={'raw':!![],'where':{}};var _0xfd1a9f={};var _0x533fba={'count':0x0,'rows':[]};return db[_0xedc3('0x2f')][_0xedc3('0x5a')]({'where':{'id':_0x2a40c5[_0xedc3('0x4a')]['id']}})[_0xedc3('0x27')](handleEntityNotFound(_0x526cde,null))[_0xedc3('0x27')](function(_0x4f34c0){if(_0x4f34c0){_0xfd1a9f[_0xedc3('0x34')]=_['keys'](db[_0xedc3('0x5b')][_0xedc3('0x30')]);_0xfd1a9f[_0xedc3('0x36')]=_[_0xedc3('0x37')](_0x2a40c5['query']);_0xfd1a9f[_0xedc3('0x38')]=_[_0xedc3('0x3a')](_0xfd1a9f[_0xedc3('0x34')],_0xfd1a9f['query']);_0x59e248[_0xedc3('0x39')]=_[_0xedc3('0x3a')](_0xfd1a9f[_0xedc3('0x34')],qs[_0xedc3('0x3b')](_0x2a40c5['query'][_0xedc3('0x3b')]));_0x59e248[_0xedc3('0x39')]=_0x59e248[_0xedc3('0x39')][_0xedc3('0x3c')]?_0x59e248[_0xedc3('0x39')]:_0xfd1a9f['model'];if(!_0x2a40c5[_0xedc3('0x36')][_0xedc3('0x3d')](_0xedc3('0x3e'))){_0x59e248[_0xedc3('0x20')]=qs[_0xedc3('0x20')](_0x2a40c5[_0xedc3('0x36')][_0xedc3('0x20')]);_0x59e248[_0xedc3('0x1f')]=qs[_0xedc3('0x1f')](_0x2a40c5['query'][_0xedc3('0x1f')]);}_0x59e248[_0xedc3('0x3f')]=qs[_0xedc3('0x40')](_0x2a40c5[_0xedc3('0x36')][_0xedc3('0x40')]);_0x59e248[_0xedc3('0x41')]=qs[_0xedc3('0x38')](_[_0xedc3('0x42')](_0x2a40c5['query'],_0xfd1a9f['filters']));_0x59e248[_0xedc3('0x41')][_0xedc3('0x5c')]=_0x4f34c0['id'];if(_0x2a40c5['query'][_0xedc3('0x5d')]){_0x59e248[_0xedc3('0x41')]=_[_0xedc3('0x43')](_0x59e248[_0xedc3('0x41')],{'$or':_[_0xedc3('0x35')](_0x59e248[_0xedc3('0x39')],function(_0x45ade2){var _0x5cc1b3={};_0x5cc1b3[_0x45ade2]={'$like':'%'+_0x2a40c5['query'][_0xedc3('0x5d')]+'%'};return _0x5cc1b3;})});}_0x59e248=_['merge']({},_0x59e248,_0x2a40c5['options']);return db[_0xedc3('0x5b')][_0xedc3('0x1e')]({'where':_0x59e248[_0xedc3('0x41')]})[_0xedc3('0x27')](function(_0xfc29ca){_0x533fba['count']=_0xfc29ca;if(_0x2a40c5[_0xedc3('0x36')][_0xedc3('0x46')]){_0x59e248[_0xedc3('0x5e')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x59e248);})[_0xedc3('0x27')](function(_0x20d7be){_0x533fba['rows']=_0x20d7be;return _0x533fba;});}})[_0xedc3('0x27')](respondWithFilteredResult(_0x526cde,_0x59e248))[_0xedc3('0x48')](handleError(_0x526cde,null));};exports[_0xedc3('0x5f')]=function(_0x2df952,_0x1c0d4a,_0x177323){var _0x447591={'raw':!![],'where':{}};var _0x4836aa={};var _0x2cf7c0={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xedc3('0x5a')]({'where':{'id':_0x2df952[_0xedc3('0x4a')]['id']}})[_0xedc3('0x27')](handleEntityNotFound(_0x1c0d4a,null))[_0xedc3('0x27')](function(_0xa5976e){if(_0xa5976e){_0x4836aa[_0xedc3('0x34')]=_[_0xedc3('0x37')](db[_0xedc3('0x60')][_0xedc3('0x30')]);_0x4836aa[_0xedc3('0x36')]=_['keys'](_0x2df952['query']);_0x4836aa[_0xedc3('0x38')]=_[_0xedc3('0x3a')](_0x4836aa[_0xedc3('0x34')],_0x4836aa['query']);_0x447591['attributes']=_[_0xedc3('0x3a')](_0x4836aa[_0xedc3('0x34')],qs[_0xedc3('0x3b')](_0x2df952[_0xedc3('0x36')][_0xedc3('0x3b')]));_0x447591['attributes']=_0x447591[_0xedc3('0x39')]['length']?_0x447591[_0xedc3('0x39')]:_0x4836aa[_0xedc3('0x34')];if(!_0x2df952[_0xedc3('0x36')]['hasOwnProperty'](_0xedc3('0x3e'))){_0x447591[_0xedc3('0x20')]=qs['limit'](_0x2df952['query']['limit']);_0x447591[_0xedc3('0x1f')]=qs[_0xedc3('0x1f')](_0x2df952['query'][_0xedc3('0x1f')]);}_0x447591[_0xedc3('0x3f')]=qs['sort'](_0x2df952['query'][_0xedc3('0x40')]);_0x447591[_0xedc3('0x41')]=qs[_0xedc3('0x38')](_['pick'](_0x2df952[_0xedc3('0x36')],_0x4836aa[_0xedc3('0x38')]));_0x447591[_0xedc3('0x41')][_0xedc3('0x5c')]=_0xa5976e['id'];if(_0x2df952[_0xedc3('0x36')]['filter']){_0x447591['where']=_[_0xedc3('0x43')](_0x447591['where'],{'$or':_[_0xedc3('0x35')](_0x447591[_0xedc3('0x39')],function(_0x46a0b2){var _0x3ff49c={};_0x3ff49c[_0x46a0b2]={'$like':'%'+_0x2df952[_0xedc3('0x36')]['filter']+'%'};return _0x3ff49c;})});}_0x447591=_[_0xedc3('0x43')]({},_0x447591,_0x2df952['options']);return db[_0xedc3('0x60')][_0xedc3('0x1e')]({'where':_0x447591[_0xedc3('0x41')]})[_0xedc3('0x27')](function(_0x2d5b4f){_0x2cf7c0[_0xedc3('0x1e')]=_0x2d5b4f;if(_0x2df952[_0xedc3('0x36')][_0xedc3('0x46')]){_0x447591[_0xedc3('0x5e')]=[{'all':!![]}];}return db[_0xedc3('0x60')][_0xedc3('0x61')](_0x447591);})['then'](function(_0x46f18b){_0x2cf7c0[_0xedc3('0x47')]=_0x46f18b;return _0x2cf7c0;});}})[_0xedc3('0x27')](respondWithFilteredResult(_0x1c0d4a,_0x447591))['catch'](handleError(_0x1c0d4a,null));};function char(_0x36532a){return _0xedc3('0x62')===typeof _0x36532a?String['fromCharCode']['apply'](null,arguments):_0x36532a;}function needsEncapsulation(_0x49c9d9){return!!_0x49c9d9&&(_0x49c9d9[_0xedc3('0x63')]()['indexOf'](char(0xd))>=0x0||_0x49c9d9['toString']()['indexOf'](char(0xa))>=0x0||_0x49c9d9[_0xedc3('0x63')]()[_0xedc3('0x64')](char(0x2c))>=0x0||_0x49c9d9[_0xedc3('0x63')]()[_0xedc3('0x64')](char(0x22))>=0x0);}function encapsulate(_0x565d05){var _0xe5379b=char(0x22),_0x5ca5a6='\x5c'+char(0x22),_0x575680=_0x565d05[_0xedc3('0x63')]()[_0xedc3('0x65')](new RegExp(_0xe5379b,'g'),_0x5ca5a6);return _0xe5379b+_0x575680+_0xe5379b;}exports[_0xedc3('0x66')]=function(_0x3629e9,_0x35b3d2,_0x4d88bf){var _0x33c3c7,_0x5afec7;var _0x171b84={'where':{'ProjectId':_0x3629e9[_0xedc3('0x4a')]['id']}};if(_0x3629e9[_0xedc3('0x36')][_0xedc3('0x67')]){_0x171b84[_0xedc3('0x41')][_0xedc3('0x68')]=JSON['parse'](_0x3629e9[_0xedc3('0x36')][_0xedc3('0x67')]);}return db[_0xedc3('0x5b')][_0xedc3('0x61')](_0x171b84)[_0xedc3('0x27')](handleEntityNotFound(_0x35b3d2,null))[_0xedc3('0x27')](function(_0x1145b9){if(_0x1145b9){_0x33c3c7=_0x1145b9;return db[_0xedc3('0x69')]['findAll']({'where':{'SessionId':{'$in':_[_0xedc3('0x35')](_0x33c3c7,'id')},'ProjectId':_0x3629e9[_0xedc3('0x4a')]['id']},'order':'-createdAt'});}})[_0xedc3('0x27')](handleEntityNotFound(_0x35b3d2,null))['then'](function(_0x5a1641){if(_0x5a1641){_0x5afec7=_0x5a1641;var _0x2b80f0={};for(var _0x2b5707=0x0,_0x574873=_0x5afec7[_0xedc3('0x3c')];_0x2b5707<_0x574873;_0x2b5707++){if(!_0x2b80f0['hasOwnProperty'](_0x5afec7[_0x2b5707]['questionId'])){_0x2b80f0[_0x5afec7[_0x2b5707][_0xedc3('0x6a')]]=needsEncapsulation(_0x5afec7[_0x2b5707][_0xedc3('0x6b')])?encapsulate(_0x5afec7[_0x2b5707][_0xedc3('0x6b')]):_0x5afec7[_0x2b5707]['question'];}}var _0x3b944a=[],_0x5ad050={};for(var _0x3b3334=0x0,_0x4d403f=_0x33c3c7['length'];_0x3b3334<_0x4d403f;_0x3b3334++){_0x5ad050={'ProjectId':_0x3629e9[_0xedc3('0x4a')]['id'],'SessionId':_0x33c3c7[_0x3b3334]['id'],'StartTime':moment(_0x33c3c7[_0x3b3334]['starttime'])[_0xedc3('0x6c')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x2bc412=0x0,_0x4124a6=_0x5afec7[_0xedc3('0x3c')];_0x2bc412<_0x4124a6;_0x2bc412++){if(_0x5afec7[_0x2bc412]['SessionId']==_0x33c3c7[_0x3b3334]['id']&&_0x2b80f0['hasOwnProperty'](_0x5afec7[_0x2bc412][_0xedc3('0x6a')])){_0x5ad050[_0x2b80f0[_0x5afec7[_0x2bc412][_0xedc3('0x6a')]]]=_0x5afec7[_0x2bc412][_0xedc3('0x6d')];}}for(var _0x5a0ff1 in _0x2b80f0){if(!_0x5ad050[_0xedc3('0x3d')](_0x2b80f0[_0x5a0ff1])){_0x5ad050[_0x2b80f0[_0x5a0ff1]]=null;}}_0x3b944a[_0xedc3('0x6e')](_0x5ad050);}return _0x3b944a;}})[_0xedc3('0x27')](function(_0x26f61b){if(!_[_0xedc3('0x6f')](_0x26f61b)){var _0xa884a1=toCsv(_0x26f61b);var _0x15666c=Date[_0xedc3('0x70')]();fs[_0xedc3('0x71')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x3629e9[_0xedc3('0x4a')]['id'],_0x15666c),_0xa884a1);_0x35b3d2[_0xedc3('0x72')](_0xedc3('0x73'),_0xedc3('0x74')+util[_0xedc3('0x6c')](_0xedc3('0x75'),_0x3629e9[_0xedc3('0x4a')]['id'],_0x15666c));_0x35b3d2['setHeader']('Content-type',_0xedc3('0x76'));return _0x35b3d2[_0xedc3('0x77')](util[_0xedc3('0x6c')](_0xedc3('0x78'),_0x3629e9['params']['id'],_0x15666c));}else{return _0x35b3d2[_0xedc3('0x1a')](0xcc);}})[_0xedc3('0x48')](handleError(_0x35b3d2,null));}; \ No newline at end of file +var _0x52de=['hasOwnProperty','number','apply','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','map','JscriptyProject','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','params','include','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','userProfileId','autoAssociation','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','omit','createdAt','UserProfileSection','UserProfileResource','findOne','JscriptySessionReport','order','ProjectId','getAnswers','JscriptyAnswerReport'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x52de,0x1e7));var _0xe52d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x52de[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xe52d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe52d('0x1'));var zipdir=require(_0xe52d('0x2'));var jsonpatch=require(_0xe52d('0x3'));var rp=require(_0xe52d('0x4'));var moment=require('moment');var BPromise=require(_0xe52d('0x5'));var Mustache=require(_0xe52d('0x6'));var util=require(_0xe52d('0x7'));var path=require(_0xe52d('0x8'));var sox=require(_0xe52d('0x9'));var csv=require(_0xe52d('0xa'));var ejs=require(_0xe52d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe52d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe52d('0xa'));var querystring=require(_0xe52d('0xd'));var Papa=require('papaparse');var Redis=require(_0xe52d('0xe'));var authService=require(_0xe52d('0xf'));var qs=require(_0xe52d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe52d('0x11'))(_0xe52d('0x12'));var utils=require('../../config/utils');var config=require(_0xe52d('0x13'));var licenseUtil=require(_0xe52d('0x14'));var db=require(_0xe52d('0x15'))['db'];function respondWithStatusCode(_0x4b7996,_0x593041){_0x593041=_0x593041||0xcc;return function(_0x5e5081){if(_0x5e5081){return _0x4b7996[_0xe52d('0x16')](_0x593041);}return _0x4b7996[_0xe52d('0x17')](_0x593041)[_0xe52d('0x18')]();};}function respondWithResult(_0x193b75,_0x2bbf72){_0x2bbf72=_0x2bbf72||0xc8;return function(_0x5aea25){if(_0x5aea25){return _0x193b75[_0xe52d('0x17')](_0x2bbf72)[_0xe52d('0x19')](_0x5aea25);}};}function respondWithFilteredResult(_0x3528e5,_0x33a2a7){return function(_0x3c7374){if(_0x3c7374){var _0x30dc5d=_0x3c7374[_0xe52d('0x1a')],_0x4ec9fd=_0x33a2a7[_0xe52d('0x1b')],_0x4d93cb=_0x33a2a7[_0xe52d('0x1b')]+_0x33a2a7['limit'],_0x3a8375;if(_0x4d93cb>=_0x30dc5d){_0x4d93cb=_0x30dc5d;_0x3a8375=0xc8;}else{_0x3a8375=0xce;}_0x3528e5['status'](_0x3a8375);return _0x3528e5[_0xe52d('0x1c')](_0xe52d('0x1d'),_0x4ec9fd+'-'+_0x4d93cb+'/'+_0x30dc5d)[_0xe52d('0x19')](_0x3c7374);}return null;};}function patchUpdates(_0xed15a7){return function(_0x344b0c){try{jsonpatch['apply'](_0x344b0c,_0xed15a7,!![]);}catch(_0xb39682){return BPromise[_0xe52d('0x1e')](_0xb39682);}return _0x344b0c[_0xe52d('0x1f')]();};}function saveUpdates(_0x566cb0,_0x267390){return function(_0x5bdba5){if(_0x5bdba5){return _0x5bdba5[_0xe52d('0x20')](_0x566cb0)[_0xe52d('0x21')](function(_0x26a073){return _0x26a073;});}return null;};}function removeEntity(_0x436d30,_0x4491a4){return function(_0x4bf5a8){if(_0x4bf5a8){return _0x4bf5a8['destroy']()[_0xe52d('0x21')](function(){var _0x3e0e4d=_0x4bf5a8['get']({'plain':!![]});var _0x567326='Projects';return db['UserProfileResource']['destroy']({'where':{'type':_0x567326,'resourceId':_0x3e0e4d['id']}})['then'](function(){return _0x4bf5a8;});})[_0xe52d('0x21')](function(){_0x436d30[_0xe52d('0x17')](0xcc)[_0xe52d('0x18')]();});}};}function handleEntityNotFound(_0x5f1291,_0x260fa8){return function(_0x4c28ca){if(!_0x4c28ca){_0x5f1291[_0xe52d('0x16')](0x194);}return _0x4c28ca;};}function handleError(_0x231112,_0x35f3da){_0x35f3da=_0x35f3da||0x1f4;return function(_0x3243e6){logger[_0xe52d('0x22')](_0x3243e6[_0xe52d('0x23')]);if(_0x3243e6['name']){delete _0x3243e6[_0xe52d('0x24')];}_0x231112[_0xe52d('0x17')](_0x35f3da)[_0xe52d('0x25')](_0x3243e6);};}exports['index']=function(_0xdb86ea,_0x124708){var _0xf5f68d={},_0x33e86c={},_0x26ad04={'count':0x0,'rows':[]};var _0x332b5e=_[_0xe52d('0x26')](db[_0xe52d('0x27')][_0xe52d('0x28')],function(_0x3e03d3){return{'name':_0x3e03d3[_0xe52d('0x29')],'type':_0x3e03d3['type'][_0xe52d('0x2a')]};});_0x33e86c[_0xe52d('0x2b')]=_['map'](_0x332b5e,_0xe52d('0x24'));_0x33e86c[_0xe52d('0x2c')]=_[_0xe52d('0x2d')](_0xdb86ea[_0xe52d('0x2c')]);_0x33e86c[_0xe52d('0x2e')]=_[_0xe52d('0x2f')](_0x33e86c[_0xe52d('0x2b')],_0x33e86c['query']);_0xf5f68d['attributes']=_[_0xe52d('0x2f')](_0x33e86c[_0xe52d('0x2b')],qs[_0xe52d('0x30')](_0xdb86ea[_0xe52d('0x2c')][_0xe52d('0x30')]));_0xf5f68d[_0xe52d('0x31')]=_0xf5f68d[_0xe52d('0x31')][_0xe52d('0x32')]?_0xf5f68d[_0xe52d('0x31')]:_0x33e86c[_0xe52d('0x2b')];if(!_0xdb86ea['query']['hasOwnProperty']('nolimit')){_0xf5f68d['limit']=qs[_0xe52d('0x33')](_0xdb86ea[_0xe52d('0x2c')][_0xe52d('0x33')]);_0xf5f68d['offset']=qs[_0xe52d('0x1b')](_0xdb86ea[_0xe52d('0x2c')][_0xe52d('0x1b')]);}_0xf5f68d['order']=qs['sort'](_0xdb86ea['query'][_0xe52d('0x34')]);_0xf5f68d[_0xe52d('0x35')]=qs[_0xe52d('0x2e')](_[_0xe52d('0x36')](_0xdb86ea['query'],_0x33e86c[_0xe52d('0x2e')]),_0x332b5e);if(_0xdb86ea['query'][_0xe52d('0x37')]){_0xf5f68d['where']=_['merge'](_0xf5f68d[_0xe52d('0x35')],{'$or':_['map'](_0x332b5e,function(_0x261b3b){if(_0x261b3b['type']!==_0xe52d('0x38')){var _0x32f5a3={};_0x32f5a3[_0x261b3b[_0xe52d('0x24')]]={'$like':'%'+_0xdb86ea['query'][_0xe52d('0x37')]+'%'};return _0x32f5a3;}})});}_0xf5f68d=_[_0xe52d('0x39')]({},_0xf5f68d,_0xdb86ea[_0xe52d('0x3a')]);var _0xcf63c7={'where':_0xf5f68d[_0xe52d('0x35')]};return db[_0xe52d('0x27')][_0xe52d('0x1a')](_0xcf63c7)['then'](function(_0x1ac32e){_0x26ad04['count']=_0x1ac32e;if(_0xdb86ea[_0xe52d('0x2c')][_0xe52d('0x3b')]){_0xf5f68d['include']=[{'all':!![]}];}return db[_0xe52d('0x27')][_0xe52d('0x3c')](_0xf5f68d);})[_0xe52d('0x21')](function(_0x16a94a){_0x26ad04[_0xe52d('0x3d')]=_0x16a94a;return _0x26ad04;})['then'](respondWithFilteredResult(_0x124708,_0xf5f68d))['catch'](handleError(_0x124708,null));};exports['show']=function(_0x51e1f3,_0x837664){var _0x3e17ff={'raw':![],'where':{'id':_0x51e1f3[_0xe52d('0x3e')]['id']}},_0x49bc25={};_0x49bc25['model']=_[_0xe52d('0x2d')](db['JscriptyProject']['rawAttributes']);_0x49bc25[_0xe52d('0x2c')]=_[_0xe52d('0x2d')](_0x51e1f3['query']);_0x49bc25['filters']=_[_0xe52d('0x2f')](_0x49bc25[_0xe52d('0x2b')],_0x49bc25['query']);_0x3e17ff['attributes']=_[_0xe52d('0x2f')](_0x49bc25['model'],qs[_0xe52d('0x30')](_0x51e1f3[_0xe52d('0x2c')]['fields']));_0x3e17ff[_0xe52d('0x31')]=_0x3e17ff[_0xe52d('0x31')][_0xe52d('0x32')]?_0x3e17ff['attributes']:_0x49bc25[_0xe52d('0x2b')];if(_0x51e1f3['query'][_0xe52d('0x3b')]){_0x3e17ff[_0xe52d('0x3f')]=[{'all':!![]}];}_0x3e17ff=_[_0xe52d('0x39')]({},_0x3e17ff,_0x51e1f3[_0xe52d('0x3a')]);return db[_0xe52d('0x27')][_0xe52d('0x40')](_0x3e17ff)[_0xe52d('0x21')](handleEntityNotFound(_0x837664,null))[_0xe52d('0x21')](respondWithResult(_0x837664,null))['catch'](handleError(_0x837664,null));};exports['create']=function(_0x201048,_0x581893){return db[_0xe52d('0x27')]['create'](_0x201048[_0xe52d('0x41')],{})[_0xe52d('0x21')](function(_0x25ccf5){var _0x269088=_0x201048[_0xe52d('0x42')][_0xe52d('0x43')]({'plain':!![]});if(!_0x269088)throw new Error(_0xe52d('0x44'));if(_0x269088[_0xe52d('0x45')]===_0xe52d('0x42')){var _0x15f5ee=_0x25ccf5[_0xe52d('0x43')]({'plain':!![]});var _0x1b0b96=_0xe52d('0x46');return db['UserProfileSection'][_0xe52d('0x40')]({'where':{'name':_0x1b0b96,'userProfileId':_0x269088[_0xe52d('0x47')]},'raw':!![]})[_0xe52d('0x21')](function(_0x60d35){if(_0x60d35&&_0x60d35[_0xe52d('0x48')]===0x0){return db['UserProfileResource'][_0xe52d('0x49')]({'name':_0x15f5ee[_0xe52d('0x24')],'resourceId':_0x15f5ee['id'],'type':_0x60d35[_0xe52d('0x24')],'sectionId':_0x60d35['id']},{})[_0xe52d('0x21')](function(){return _0x25ccf5;});}else{return _0x25ccf5;}})[_0xe52d('0x4a')](function(_0x571776){logger[_0xe52d('0x22')](_0xe52d('0x4b'),_0x571776);throw _0x571776;});}return _0x25ccf5;})[_0xe52d('0x21')](respondWithResult(_0x581893,0xc9))[_0xe52d('0x4a')](handleError(_0x581893,null));};exports[_0xe52d('0x4c')]=function(_0x1c1228,_0x4160ce){var _0x2f8549={'where':{'id':_0x1c1228['params']['id']}},_0x4398bb={};_0x4398bb['model']=_[_0xe52d('0x2d')](db[_0xe52d('0x27')]['rawAttributes']);_0x2f8549[_0xe52d('0x31')]=_[_0xe52d('0x2f')](_0x4398bb[_0xe52d('0x2b')],qs['fields'](_0x1c1228['query'][_0xe52d('0x30')]));_0x2f8549[_0xe52d('0x31')]=_0x2f8549[_0xe52d('0x31')]['length']?_0x2f8549[_0xe52d('0x31')]:_0x4398bb[_0xe52d('0x2b')];if(_0x1c1228[_0xe52d('0x2c')][_0xe52d('0x3b')]){_0x2f8549[_0xe52d('0x3f')]=[{'all':!![]}];}_0x2f8549=_['merge']({},_0x2f8549,_0x1c1228[_0xe52d('0x3a')]);return db[_0xe52d('0x27')][_0xe52d('0x40')](_0x2f8549)[_0xe52d('0x21')](handleEntityNotFound(_0x4160ce,null))[_0xe52d('0x21')](function(_0x4fbb0b){if(_0x4fbb0b){var _0x3a6a05=_0x4fbb0b[_0xe52d('0x43')]({'plain':!![]});_0x3a6a05=qs['omit'](_0x3a6a05,['id','createdAt',_0xe52d('0x4d')]);_0x1c1228['body']=_[_0xe52d('0x4e')](_0x1c1228[_0xe52d('0x41')],['id',_0xe52d('0x4f'),_0xe52d('0x4d')]);return db[_0xe52d('0x27')][_0xe52d('0x49')](_[_0xe52d('0x39')](_0x3a6a05,_0x1c1228['body']),{'include':_0x1c1228[_0xe52d('0x2c')][_0xe52d('0x3b')]?[{'all':!![]}]:undefined})[_0xe52d('0x21')](function(_0x3e4f3){var _0x4796b7=_0x1c1228[_0xe52d('0x42')][_0xe52d('0x43')]({'plain':!![]});if(!_0x4796b7)throw new Error(_0xe52d('0x44'));if(_0x4796b7['role']==='user'){var _0x5547cb=_0x3e4f3['get']({'plain':!![]});var _0x4861c4=_0xe52d('0x46');return db[_0xe52d('0x50')][_0xe52d('0x40')]({'where':{'name':_0x4861c4,'userProfileId':_0x4796b7[_0xe52d('0x47')]},'raw':!![]})['then'](function(_0x4b18fb){if(_0x4b18fb&&_0x4b18fb[_0xe52d('0x48')]===0x0){return db[_0xe52d('0x51')][_0xe52d('0x49')]({'name':_0x5547cb[_0xe52d('0x24')],'resourceId':_0x5547cb['id'],'type':_0x4b18fb[_0xe52d('0x24')],'sectionId':_0x4b18fb['id']},{})[_0xe52d('0x21')](function(){return _0x3e4f3;});}else{return _0x3e4f3;}})[_0xe52d('0x4a')](function(_0x1a9833){logger['error'](_0xe52d('0x4b'),_0x1a9833);throw _0x1a9833;});}return _0x3e4f3;});}})[_0xe52d('0x21')](respondWithResult(_0x4160ce,0xc9))[_0xe52d('0x4a')](handleError(_0x4160ce,null));};exports[_0xe52d('0x20')]=function(_0xe78785,_0x3d624c){if(_0xe78785[_0xe52d('0x41')]['id']){delete _0xe78785[_0xe52d('0x41')]['id'];}return db[_0xe52d('0x27')][_0xe52d('0x40')]({'where':{'id':_0xe78785[_0xe52d('0x3e')]['id']}})[_0xe52d('0x21')](handleEntityNotFound(_0x3d624c,null))[_0xe52d('0x21')](saveUpdates(_0xe78785[_0xe52d('0x41')],null))[_0xe52d('0x21')](respondWithResult(_0x3d624c,null))['catch'](handleError(_0x3d624c,null));};exports['destroy']=function(_0x3e3e21,_0x21746a){return db[_0xe52d('0x27')][_0xe52d('0x40')]({'where':{'id':_0x3e3e21[_0xe52d('0x3e')]['id']}})[_0xe52d('0x21')](handleEntityNotFound(_0x21746a,null))[_0xe52d('0x21')](removeEntity(_0x21746a,null))[_0xe52d('0x4a')](handleError(_0x21746a,null));};exports['getSessions']=function(_0xe60e4a,_0x4d98a9,_0xc2d6a5){var _0x748ff5={'raw':!![],'where':{}};var _0x589959={};var _0x338639={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xe52d('0x52')]({'where':{'id':_0xe60e4a[_0xe52d('0x3e')]['id']}})[_0xe52d('0x21')](handleEntityNotFound(_0x4d98a9,null))['then'](function(_0x34d420){if(_0x34d420){_0x589959[_0xe52d('0x2b')]=_['keys'](db[_0xe52d('0x53')]['rawAttributes']);_0x589959['query']=_[_0xe52d('0x2d')](_0xe60e4a[_0xe52d('0x2c')]);_0x589959[_0xe52d('0x2e')]=_[_0xe52d('0x2f')](_0x589959[_0xe52d('0x2b')],_0x589959[_0xe52d('0x2c')]);_0x748ff5['attributes']=_[_0xe52d('0x2f')](_0x589959[_0xe52d('0x2b')],qs['fields'](_0xe60e4a[_0xe52d('0x2c')][_0xe52d('0x30')]));_0x748ff5[_0xe52d('0x31')]=_0x748ff5[_0xe52d('0x31')]['length']?_0x748ff5[_0xe52d('0x31')]:_0x589959[_0xe52d('0x2b')];if(!_0xe60e4a['query']['hasOwnProperty']('nolimit')){_0x748ff5[_0xe52d('0x33')]=qs[_0xe52d('0x33')](_0xe60e4a[_0xe52d('0x2c')][_0xe52d('0x33')]);_0x748ff5[_0xe52d('0x1b')]=qs[_0xe52d('0x1b')](_0xe60e4a[_0xe52d('0x2c')]['offset']);}_0x748ff5[_0xe52d('0x54')]=qs['sort'](_0xe60e4a[_0xe52d('0x2c')][_0xe52d('0x34')]);_0x748ff5['where']=qs['filters'](_[_0xe52d('0x36')](_0xe60e4a[_0xe52d('0x2c')],_0x589959[_0xe52d('0x2e')]));_0x748ff5[_0xe52d('0x35')][_0xe52d('0x55')]=_0x34d420['id'];if(_0xe60e4a[_0xe52d('0x2c')][_0xe52d('0x37')]){_0x748ff5[_0xe52d('0x35')]=_[_0xe52d('0x39')](_0x748ff5[_0xe52d('0x35')],{'$or':_[_0xe52d('0x26')](_0x748ff5['attributes'],function(_0x171aa6){var _0x418605={};_0x418605[_0x171aa6]={'$like':'%'+_0xe60e4a[_0xe52d('0x2c')][_0xe52d('0x37')]+'%'};return _0x418605;})});}_0x748ff5=_[_0xe52d('0x39')]({},_0x748ff5,_0xe60e4a['options']);return db['JscriptySessionReport'][_0xe52d('0x1a')]({'where':_0x748ff5[_0xe52d('0x35')]})[_0xe52d('0x21')](function(_0x504d7a){_0x338639[_0xe52d('0x1a')]=_0x504d7a;if(_0xe60e4a['query'][_0xe52d('0x3b')]){_0x748ff5[_0xe52d('0x3f')]=[{'all':!![]}];}return db[_0xe52d('0x53')][_0xe52d('0x3c')](_0x748ff5);})[_0xe52d('0x21')](function(_0x416f7f){_0x338639['rows']=_0x416f7f;return _0x338639;});}})[_0xe52d('0x21')](respondWithFilteredResult(_0x4d98a9,_0x748ff5))['catch'](handleError(_0x4d98a9,null));};exports[_0xe52d('0x56')]=function(_0x109bf7,_0x368a0f,_0x412893){var _0x3221cd={'raw':!![],'where':{}};var _0x53aec7={};var _0x3bb267={'count':0x0,'rows':[]};return db[_0xe52d('0x27')][_0xe52d('0x52')]({'where':{'id':_0x109bf7[_0xe52d('0x3e')]['id']}})[_0xe52d('0x21')](handleEntityNotFound(_0x368a0f,null))['then'](function(_0x2b872a){if(_0x2b872a){_0x53aec7[_0xe52d('0x2b')]=_[_0xe52d('0x2d')](db[_0xe52d('0x57')][_0xe52d('0x28')]);_0x53aec7[_0xe52d('0x2c')]=_[_0xe52d('0x2d')](_0x109bf7['query']);_0x53aec7[_0xe52d('0x2e')]=_[_0xe52d('0x2f')](_0x53aec7[_0xe52d('0x2b')],_0x53aec7[_0xe52d('0x2c')]);_0x3221cd['attributes']=_['intersection'](_0x53aec7['model'],qs[_0xe52d('0x30')](_0x109bf7[_0xe52d('0x2c')]['fields']));_0x3221cd['attributes']=_0x3221cd[_0xe52d('0x31')][_0xe52d('0x32')]?_0x3221cd['attributes']:_0x53aec7[_0xe52d('0x2b')];if(!_0x109bf7[_0xe52d('0x2c')][_0xe52d('0x58')]('nolimit')){_0x3221cd[_0xe52d('0x33')]=qs['limit'](_0x109bf7[_0xe52d('0x2c')]['limit']);_0x3221cd[_0xe52d('0x1b')]=qs[_0xe52d('0x1b')](_0x109bf7[_0xe52d('0x2c')][_0xe52d('0x1b')]);}_0x3221cd['order']=qs[_0xe52d('0x34')](_0x109bf7[_0xe52d('0x2c')][_0xe52d('0x34')]);_0x3221cd['where']=qs['filters'](_[_0xe52d('0x36')](_0x109bf7['query'],_0x53aec7[_0xe52d('0x2e')]));_0x3221cd[_0xe52d('0x35')][_0xe52d('0x55')]=_0x2b872a['id'];if(_0x109bf7['query'][_0xe52d('0x37')]){_0x3221cd[_0xe52d('0x35')]=_[_0xe52d('0x39')](_0x3221cd[_0xe52d('0x35')],{'$or':_[_0xe52d('0x26')](_0x3221cd[_0xe52d('0x31')],function(_0x21b8b2){var _0x504fe6={};_0x504fe6[_0x21b8b2]={'$like':'%'+_0x109bf7[_0xe52d('0x2c')][_0xe52d('0x37')]+'%'};return _0x504fe6;})});}_0x3221cd=_[_0xe52d('0x39')]({},_0x3221cd,_0x109bf7[_0xe52d('0x3a')]);return db['JscriptyAnswerReport'][_0xe52d('0x1a')]({'where':_0x3221cd[_0xe52d('0x35')]})[_0xe52d('0x21')](function(_0x441320){_0x3bb267['count']=_0x441320;if(_0x109bf7[_0xe52d('0x2c')][_0xe52d('0x3b')]){_0x3221cd[_0xe52d('0x3f')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xe52d('0x3c')](_0x3221cd);})[_0xe52d('0x21')](function(_0x221e43){_0x3bb267[_0xe52d('0x3d')]=_0x221e43;return _0x3bb267;});}})[_0xe52d('0x21')](respondWithFilteredResult(_0x368a0f,_0x3221cd))[_0xe52d('0x4a')](handleError(_0x368a0f,null));};function char(_0x465938){return _0xe52d('0x59')===typeof _0x465938?String['fromCharCode'][_0xe52d('0x5a')](null,arguments):_0x465938;}function needsEncapsulation(_0x2ad57a){return!!_0x2ad57a&&(_0x2ad57a[_0xe52d('0x5b')]()['indexOf'](char(0xd))>=0x0||_0x2ad57a[_0xe52d('0x5b')]()[_0xe52d('0x5c')](char(0xa))>=0x0||_0x2ad57a[_0xe52d('0x5b')]()[_0xe52d('0x5c')](char(0x2c))>=0x0||_0x2ad57a['toString']()[_0xe52d('0x5c')](char(0x22))>=0x0);}function encapsulate(_0x483ebb){var _0x2278c2=char(0x22),_0x259f04='\x5c'+char(0x22),_0x47e3c2=_0x483ebb[_0xe52d('0x5b')]()[_0xe52d('0x5d')](new RegExp(_0x2278c2,'g'),_0x259f04);return _0x2278c2+_0x47e3c2+_0x2278c2;}exports[_0xe52d('0x5e')]=function(_0xc66489,_0x45d599,_0x329ba8){var _0x2eab7b,_0x7a6a8f;var _0x2aedc1={'where':{'ProjectId':_0xc66489['params']['id']}};if(_0xc66489[_0xe52d('0x2c')][_0xe52d('0x5f')]){_0x2aedc1[_0xe52d('0x35')][_0xe52d('0x60')]=JSON[_0xe52d('0x61')](_0xc66489['query'][_0xe52d('0x5f')]);}return db['JscriptySessionReport'][_0xe52d('0x3c')](_0x2aedc1)[_0xe52d('0x21')](handleEntityNotFound(_0x45d599,null))[_0xe52d('0x21')](function(_0x4ba0d8){if(_0x4ba0d8){_0x2eab7b=_0x4ba0d8;return db[_0xe52d('0x62')][_0xe52d('0x3c')]({'where':{'SessionId':{'$in':_[_0xe52d('0x26')](_0x2eab7b,'id')},'ProjectId':_0xc66489[_0xe52d('0x3e')]['id']},'order':'-createdAt'});}})[_0xe52d('0x21')](handleEntityNotFound(_0x45d599,null))['then'](function(_0x46534e){if(_0x46534e){_0x7a6a8f=_0x46534e;var _0x4de4cb={};for(var _0x1e55c2=0x0,_0x2f6194=_0x7a6a8f[_0xe52d('0x32')];_0x1e55c2<_0x2f6194;_0x1e55c2++){if(!_0x4de4cb[_0xe52d('0x58')](_0x7a6a8f[_0x1e55c2][_0xe52d('0x63')])){_0x4de4cb[_0x7a6a8f[_0x1e55c2][_0xe52d('0x63')]]=needsEncapsulation(_0x7a6a8f[_0x1e55c2][_0xe52d('0x64')])?encapsulate(_0x7a6a8f[_0x1e55c2][_0xe52d('0x64')]):_0x7a6a8f[_0x1e55c2][_0xe52d('0x64')];}}var _0x9ec816=[],_0x4331e9={};for(var _0x3454cf=0x0,_0x8aa48d=_0x2eab7b['length'];_0x3454cf<_0x8aa48d;_0x3454cf++){_0x4331e9={'ProjectId':_0xc66489[_0xe52d('0x3e')]['id'],'SessionId':_0x2eab7b[_0x3454cf]['id'],'StartTime':moment(_0x2eab7b[_0x3454cf][_0xe52d('0x60')])['format'](_0xe52d('0x65'))};for(var _0x20ac66=0x0,_0x5bc98e=_0x7a6a8f[_0xe52d('0x32')];_0x20ac66<_0x5bc98e;_0x20ac66++){if(_0x7a6a8f[_0x20ac66]['SessionId']==_0x2eab7b[_0x3454cf]['id']&&_0x4de4cb['hasOwnProperty'](_0x7a6a8f[_0x20ac66][_0xe52d('0x63')])){_0x4331e9[_0x4de4cb[_0x7a6a8f[_0x20ac66][_0xe52d('0x63')]]]=_0x7a6a8f[_0x20ac66][_0xe52d('0x66')];}}for(var _0xcff65c in _0x4de4cb){if(!_0x4331e9[_0xe52d('0x58')](_0x4de4cb[_0xcff65c])){_0x4331e9[_0x4de4cb[_0xcff65c]]=null;}}_0x9ec816[_0xe52d('0x67')](_0x4331e9);}return _0x9ec816;}})['then'](function(_0x29cab2){if(!_[_0xe52d('0x68')](_0x29cab2)){var _0xe1f7e=toCsv(_0x29cab2);var _0x36a078=Date[_0xe52d('0x69')]();fs[_0xe52d('0x6a')](util[_0xe52d('0x6b')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xc66489[_0xe52d('0x3e')]['id'],_0x36a078),_0xe1f7e);_0x45d599[_0xe52d('0x6c')](_0xe52d('0x6d'),_0xe52d('0x6e')+util[_0xe52d('0x6b')](_0xe52d('0x6f'),_0xc66489[_0xe52d('0x3e')]['id'],_0x36a078));_0x45d599['setHeader'](_0xe52d('0x70'),'text/csv');return _0x45d599[_0xe52d('0x71')](util[_0xe52d('0x6b')](_0xe52d('0x72'),_0xc66489[_0xe52d('0x3e')]['id'],_0x36a078));}else{return _0x45d599['sendStatus'](0xcc);}})[_0xe52d('0x4a')](handleError(_0x45d599,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 45220a8..8bc490b 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 _0x033b=['api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyProject.attributes','exports','jscripty_projects','lodash','util','../../config/logger'];(function(_0x380c5a,_0x36e9d9){var _0x537651=function(_0x95df1e){while(--_0x95df1e){_0x380c5a['push'](_0x380c5a['shift']());}};_0x537651(++_0x36e9d9);}(_0x033b,0x111));var _0xb033=function(_0x5294e5,_0x125187){_0x5294e5=_0x5294e5-0x0;var _0x1c4f8a=_0x033b[_0x5294e5];return _0x1c4f8a;};'use strict';var _=require(_0xb033('0x0'));var util=require(_0xb033('0x1'));var logger=require(_0xb033('0x2'))(_0xb033('0x3'));var moment=require(_0xb033('0x4'));var BPromise=require(_0xb033('0x5'));var rp=require(_0xb033('0x6'));var fs=require('fs');var path=require(_0xb033('0x7'));var rimraf=require('rimraf');var config=require(_0xb033('0x8'));var attributes=require(_0xb033('0x9'));module[_0xb033('0xa')]=function(_0x1a0df5,_0x2ddb65){return _0x1a0df5['define']('JscriptyProject',attributes,{'tableName':_0xb033('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdaf9=['util','../../config/logger','moment','request-promise','path','rimraf','./jscriptyProject.attributes','exports','jscripty_projects','lodash'];(function(_0xe733bd,_0x47e80f){var _0x396697=function(_0x22b242){while(--_0x22b242){_0xe733bd['push'](_0xe733bd['shift']());}};_0x396697(++_0x47e80f);}(_0xdaf9,0xe5));var _0x9daf=function(_0x5da93c,_0xc83e72){_0x5da93c=_0x5da93c-0x0;var _0x50f0f6=_0xdaf9[_0x5da93c];return _0x50f0f6;};'use strict';var _=require(_0x9daf('0x0'));var util=require(_0x9daf('0x1'));var logger=require(_0x9daf('0x2'))('api');var moment=require(_0x9daf('0x3'));var BPromise=require('bluebird');var rp=require(_0x9daf('0x4'));var fs=require('fs');var path=require(_0x9daf('0x5'));var rimraf=require(_0x9daf('0x6'));var config=require('../../config/environment');var attributes=require(_0x9daf('0x7'));module[_0x9daf('0x8')]=function(_0x11e944,_0x1b6adf){return _0x11e944['define']('JscriptyProject',attributes,{'tableName':_0x9daf('0x9'),'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 8ba4cd9..fac81a1 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 _0x9d32=['info','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','JscriptyProject,\x20%s,\x20%s','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x1a7c35,_0x4eb09c){var _0x54ca79=function(_0x436319){while(--_0x436319){_0x1a7c35['push'](_0x1a7c35['shift']());}};_0x54ca79(++_0x4eb09c);}(_0x9d32,0x1ba));var _0x29d3=function(_0x40a77f,_0x1d5f8d){_0x40a77f=_0x40a77f-0x0;var _0x415aa1=_0x9d32[_0x40a77f];return _0x415aa1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x29d3('0x0'));var BPromise=require(_0x29d3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x29d3('0x2'));var db=require(_0x29d3('0x3'))['db'];var utils=require(_0x29d3('0x4'));var logger=require(_0x29d3('0x5'))(_0x29d3('0x6'));var config=require(_0x29d3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x29d3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e7c9c,_0x2912f9,_0x3a3159){return new BPromise(function(_0x5795eb,_0x249ad9){return client[_0x29d3('0x9')](_0x5e7c9c,_0x3a3159)[_0x29d3('0xa')](function(_0x323a51){logger['info'](_0x29d3('0xb'),_0x2912f9,'request\x20sent');logger[_0x29d3('0xc')](_0x29d3('0xd'),_0x2912f9,_0x29d3('0xe'),JSON[_0x29d3('0xf')](_0x323a51));if(_0x323a51[_0x29d3('0x10')]){if(_0x323a51[_0x29d3('0x10')]['code']===0x1f4){logger[_0x29d3('0x10')](_0x29d3('0xb'),_0x2912f9,_0x323a51[_0x29d3('0x10')]['message']);return _0x249ad9(_0x323a51['error'][_0x29d3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x2912f9,_0x323a51[_0x29d3('0x10')][_0x29d3('0x11')]);return _0x5795eb(_0x323a51['error'][_0x29d3('0x11')]);}else{logger[_0x29d3('0x12')](_0x29d3('0xb'),_0x2912f9,_0x29d3('0xe'));_0x5795eb(_0x323a51['result'][_0x29d3('0x11')]);}})[_0x29d3('0x13')](function(_0x2ae3c6){logger[_0x29d3('0x10')](_0x29d3('0xb'),_0x2912f9,_0x2ae3c6);_0x249ad9(_0x2ae3c6);});});} \ No newline at end of file +var _0x46b9=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','error','message','result'];(function(_0x5b2ee5,_0x2fd352){var _0x3e3eb2=function(_0x3b0325){while(--_0x3b0325){_0x5b2ee5['push'](_0x5b2ee5['shift']());}};_0x3e3eb2(++_0x2fd352);}(_0x46b9,0x144));var _0x946b=function(_0x4ffbf,_0x5255ba){_0x4ffbf=_0x4ffbf-0x0;var _0x4b7bb6=_0x46b9[_0x4ffbf];return _0x4b7bb6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x946b('0x0'));var BPromise=require(_0x946b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x946b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x946b('0x3'));var logger=require(_0x946b('0x4'))(_0x946b('0x5'));var config=require('../../config/environment');var jayson=require(_0x946b('0x6'));var client=jayson[_0x946b('0x7')][_0x946b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33f1e6,_0x14712d,_0x30ea6e){return new BPromise(function(_0x370a12,_0x5dd6c2){return client[_0x946b('0x9')](_0x33f1e6,_0x30ea6e)[_0x946b('0xa')](function(_0x505636){logger[_0x946b('0xb')](_0x946b('0xc'),_0x14712d,_0x946b('0xd'));logger[_0x946b('0xe')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x14712d,_0x946b('0xd'),JSON['stringify'](_0x505636));if(_0x505636[_0x946b('0xf')]){if(_0x505636['error']['code']===0x1f4){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x14712d,_0x505636[_0x946b('0xf')][_0x946b('0x10')]);return _0x5dd6c2(_0x505636[_0x946b('0xf')][_0x946b('0x10')]);}logger[_0x946b('0xf')](_0x946b('0xc'),_0x14712d,_0x505636[_0x946b('0xf')][_0x946b('0x10')]);return _0x370a12(_0x505636[_0x946b('0xf')][_0x946b('0x10')]);}else{logger['info'](_0x946b('0xc'),_0x14712d,_0x946b('0xd'));_0x370a12(_0x505636[_0x946b('0x11')][_0x946b('0x10')]);}})['catch'](function(_0x39e2b9){logger[_0x946b('0xf')](_0x946b('0xc'),_0x14712d,_0x39e2b9);_0x5dd6c2(_0x39e2b9);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 412c505..5de8b62 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 _0x7e74=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x7e74,0xbd));var _0x47e7=function(_0x5cfe7d,_0x5efc7f){_0x5cfe7d=_0x5cfe7d-0x0;var _0x25b758=_0x7e74[_0x5cfe7d];return _0x25b758;};'use strict';var multer=require(_0x47e7('0x0'));var util=require('util');var path=require(_0x47e7('0x1'));var timeout=require(_0x47e7('0x2'));var express=require(_0x47e7('0x3'));var router=express[_0x47e7('0x4')]();var auth=require(_0x47e7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x47e7('0x6'));var controller=require(_0x47e7('0x7'));router[_0x47e7('0x8')]('/',auth[_0x47e7('0x9')](),controller[_0x47e7('0xa')]);router[_0x47e7('0x8')](_0x47e7('0xb'),auth['isAuthenticated'](),controller[_0x47e7('0xc')]);router['get'](_0x47e7('0xd'),auth[_0x47e7('0x9')](),controller[_0x47e7('0xe')]);router[_0x47e7('0xf')]('/',auth[_0x47e7('0x9')](),controller[_0x47e7('0x10')]);router[_0x47e7('0x11')](_0x47e7('0xd'),auth[_0x47e7('0x9')](),controller[_0x47e7('0x12')]);router[_0x47e7('0x13')](_0x47e7('0xd'),auth[_0x47e7('0x9')](),controller['destroy']);module[_0x47e7('0x14')]=router; \ No newline at end of file +var _0x0c07=['/:id','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','describe'];(function(_0x214023,_0x65e22b){var _0x10cf15=function(_0x3a05df){while(--_0x3a05df){_0x214023['push'](_0x214023['shift']());}};_0x10cf15(++_0x65e22b);}(_0x0c07,0x8b));var _0x70c0=function(_0x434467,_0x2c6a75){_0x434467=_0x434467-0x0;var _0x5248ba=_0x0c07[_0x434467];return _0x5248ba;};'use strict';var multer=require(_0x70c0('0x0'));var util=require(_0x70c0('0x1'));var path=require(_0x70c0('0x2'));var timeout=require(_0x70c0('0x3'));var express=require(_0x70c0('0x4'));var router=express[_0x70c0('0x5')]();var auth=require(_0x70c0('0x6'));var interaction=require(_0x70c0('0x7'));var config=require(_0x70c0('0x8'));var controller=require(_0x70c0('0x9'));router[_0x70c0('0xa')]('/',auth[_0x70c0('0xb')](),controller['index']);router[_0x70c0('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x70c0('0xc')]);router[_0x70c0('0xa')](_0x70c0('0xd'),auth[_0x70c0('0xb')](),controller['show']);router[_0x70c0('0xe')]('/',auth['isAuthenticated'](),controller[_0x70c0('0xf')]);router['put'](_0x70c0('0xd'),auth['isAuthenticated'](),controller[_0x70c0('0x10')]);router[_0x70c0('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x70c0('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index ed21285..30935a4 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 _0xcae2=['TEXT','long','STRING','sequelize','exports'];(function(_0x226948,_0x5e3fcd){var _0x4eda2c=function(_0x3c4387){while(--_0x3c4387){_0x226948['push'](_0x226948['shift']());}};_0x4eda2c(++_0x5e3fcd);}(_0xcae2,0x143));var _0x2cae=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcae2[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x2cae('0x0'));module[_0x2cae('0x1')]={'question':{'type':Sequelize[_0x2cae('0x2')]},'answer':{'type':Sequelize[_0x2cae('0x2')](_0x2cae('0x3'))},'membername':{'type':Sequelize[_0x2cae('0x4')]},'projectname':{'type':Sequelize[_0x2cae('0x4')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2cae('0x4')]},'calleridname':{'type':Sequelize[_0x2cae('0x4')]},'calleridnum':{'type':Sequelize[_0x2cae('0x4')]},'questionId':{'type':Sequelize[_0x2cae('0x4')]}}; \ No newline at end of file +var _0x1ba2=['sequelize','TEXT','long','STRING'];(function(_0x53dee9,_0x1dc404){var _0x4c5da0=function(_0x540a63){while(--_0x540a63){_0x53dee9['push'](_0x53dee9['shift']());}};_0x4c5da0(++_0x1dc404);}(_0x1ba2,0xb4));var _0x21ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ba2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x21ba('0x0'));module['exports']={'question':{'type':Sequelize[_0x21ba('0x1')]},'answer':{'type':Sequelize['TEXT'](_0x21ba('0x2'))},'membername':{'type':Sequelize[_0x21ba('0x3')]},'projectname':{'type':Sequelize[_0x21ba('0x3')]},'queue':{'type':Sequelize[_0x21ba('0x3')]},'uniqueid':{'type':Sequelize[_0x21ba('0x3')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x21ba('0x3')]},'questionId':{'type':Sequelize[_0x21ba('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index a512765..2609f28 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 _0x6fb0=['params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','then','stack','name','send','index','map','JscriptyQuestionReport','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body'];(function(_0x4c61f9,_0xc7672a){var _0x1de712=function(_0x1b0695){while(--_0x1b0695){_0x4c61f9['push'](_0x4c61f9['shift']());}};_0x1de712(++_0xc7672a);}(_0x6fb0,0x16f));var _0x06fb=function(_0x25059c,_0x7eaed4){_0x25059c=_0x25059c-0x0;var _0x1b58f2=_0x6fb0[_0x25059c];return _0x1b58f2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x06fb('0x0'));var rimraf=require(_0x06fb('0x1'));var zipdir=require(_0x06fb('0x2'));var jsonpatch=require(_0x06fb('0x3'));var rp=require(_0x06fb('0x4'));var moment=require(_0x06fb('0x5'));var BPromise=require(_0x06fb('0x6'));var Mustache=require('mustache');var util=require(_0x06fb('0x7'));var path=require(_0x06fb('0x8'));var sox=require(_0x06fb('0x9'));var csv=require(_0x06fb('0xa'));var ejs=require(_0x06fb('0xb'));var fs=require('fs');var _=require(_0x06fb('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x06fb('0xd'));var deskjs=require(_0x06fb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x06fb('0xf'));var Papa=require(_0x06fb('0x10'));var Redis=require(_0x06fb('0x11'));var authService=require(_0x06fb('0x12'));var qs=require(_0x06fb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06fb('0x14'));var logger=require(_0x06fb('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x06fb('0x16'));var licenseUtil=require(_0x06fb('0x17'));var db=require(_0x06fb('0x18'))['db'];function respondWithStatusCode(_0x28c5a0,_0x3d2d0a){_0x3d2d0a=_0x3d2d0a||0xcc;return function(_0x36399e){if(_0x36399e){return _0x28c5a0[_0x06fb('0x19')](_0x3d2d0a);}return _0x28c5a0[_0x06fb('0x1a')](_0x3d2d0a)[_0x06fb('0x1b')]();};}function respondWithResult(_0x35bb5b,_0x4c3dd7){_0x4c3dd7=_0x4c3dd7||0xc8;return function(_0xffbb96){if(_0xffbb96){return _0x35bb5b[_0x06fb('0x1a')](_0x4c3dd7)[_0x06fb('0x1c')](_0xffbb96);}};}function respondWithFilteredResult(_0x5d80de,_0x30941e){return function(_0x2586d1){if(_0x2586d1){var _0x1bad89=_0x2586d1[_0x06fb('0x1d')],_0x5e7592=_0x30941e['offset'],_0x3bf6bc=_0x30941e[_0x06fb('0x1e')]+_0x30941e[_0x06fb('0x1f')],_0x16aed2;if(_0x3bf6bc>=_0x1bad89){_0x3bf6bc=_0x1bad89;_0x16aed2=0xc8;}else{_0x16aed2=0xce;}_0x5d80de[_0x06fb('0x1a')](_0x16aed2);return _0x5d80de['set'](_0x06fb('0x20'),_0x5e7592+'-'+_0x3bf6bc+'/'+_0x1bad89)['json'](_0x2586d1);}return null;};}function patchUpdates(_0x52b2c6){return function(_0x48faa9){try{jsonpatch['apply'](_0x48faa9,_0x52b2c6,!![]);}catch(_0x51ef88){return BPromise[_0x06fb('0x21')](_0x51ef88);}return _0x48faa9[_0x06fb('0x22')]();};}function saveUpdates(_0x5f3824,_0x4f59e0){return function(_0x5b0cf2){if(_0x5b0cf2){return _0x5b0cf2[_0x06fb('0x23')](_0x5f3824)['then'](function(_0x42da09){return _0x42da09;});}return null;};}function removeEntity(_0x24fe73,_0x44cee0){return function(_0x261467){if(_0x261467){return _0x261467[_0x06fb('0x24')]()[_0x06fb('0x25')](function(){_0x24fe73[_0x06fb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17bda5,_0x1a9fcf){return function(_0x39ac49){if(!_0x39ac49){_0x17bda5[_0x06fb('0x19')](0x194);}return _0x39ac49;};}function handleError(_0x5a5367,_0x3485e7){_0x3485e7=_0x3485e7||0x1f4;return function(_0x31c11d){logger['error'](_0x31c11d[_0x06fb('0x26')]);if(_0x31c11d[_0x06fb('0x27')]){delete _0x31c11d[_0x06fb('0x27')];}_0x5a5367[_0x06fb('0x1a')](_0x3485e7)[_0x06fb('0x28')](_0x31c11d);};}exports[_0x06fb('0x29')]=function(_0x44ee9e,_0x139c90){var _0x59686a={},_0x55c5d6={},_0x4cd569={'count':0x0,'rows':[]};var _0x252f8f=_[_0x06fb('0x2a')](db[_0x06fb('0x2b')]['rawAttributes'],function(_0x2080f4){return{'name':_0x2080f4['fieldName'],'type':_0x2080f4[_0x06fb('0x2c')][_0x06fb('0x2d')]};});_0x55c5d6['model']=_['map'](_0x252f8f,_0x06fb('0x27'));_0x55c5d6[_0x06fb('0x2e')]=_[_0x06fb('0x2f')](_0x44ee9e[_0x06fb('0x2e')]);_0x55c5d6[_0x06fb('0x30')]=_['intersection'](_0x55c5d6[_0x06fb('0x31')],_0x55c5d6[_0x06fb('0x2e')]);_0x59686a[_0x06fb('0x32')]=_[_0x06fb('0x33')](_0x55c5d6['model'],qs[_0x06fb('0x34')](_0x44ee9e[_0x06fb('0x2e')]['fields']));_0x59686a[_0x06fb('0x32')]=_0x59686a[_0x06fb('0x32')][_0x06fb('0x35')]?_0x59686a[_0x06fb('0x32')]:_0x55c5d6['model'];if(!_0x44ee9e[_0x06fb('0x2e')][_0x06fb('0x36')]('nolimit')){_0x59686a[_0x06fb('0x1f')]=qs[_0x06fb('0x1f')](_0x44ee9e[_0x06fb('0x2e')][_0x06fb('0x1f')]);_0x59686a[_0x06fb('0x1e')]=qs[_0x06fb('0x1e')](_0x44ee9e[_0x06fb('0x2e')]['offset']);}_0x59686a['order']=qs['sort'](_0x44ee9e[_0x06fb('0x2e')]['sort']);_0x59686a[_0x06fb('0x37')]=qs[_0x06fb('0x30')](_[_0x06fb('0x38')](_0x44ee9e[_0x06fb('0x2e')],_0x55c5d6[_0x06fb('0x30')]),_0x252f8f);if(_0x44ee9e[_0x06fb('0x2e')][_0x06fb('0x39')]){_0x59686a[_0x06fb('0x37')]=_[_0x06fb('0x3a')](_0x59686a['where'],{'$or':_[_0x06fb('0x2a')](_0x252f8f,function(_0x90f297){if(_0x90f297['type']!==_0x06fb('0x3b')){var _0x1eb5ad={};_0x1eb5ad[_0x90f297['name']]={'$like':'%'+_0x44ee9e[_0x06fb('0x2e')][_0x06fb('0x39')]+'%'};return _0x1eb5ad;}})});}_0x59686a=_[_0x06fb('0x3a')]({},_0x59686a,_0x44ee9e[_0x06fb('0x3c')]);var _0x2e0b1b={'where':_0x59686a[_0x06fb('0x37')]};return db['JscriptyQuestionReport'][_0x06fb('0x1d')](_0x2e0b1b)[_0x06fb('0x25')](function(_0x3855be){_0x4cd569[_0x06fb('0x1d')]=_0x3855be;if(_0x44ee9e[_0x06fb('0x2e')][_0x06fb('0x3d')]){_0x59686a[_0x06fb('0x3e')]=[{'all':!![]}];}return db[_0x06fb('0x2b')][_0x06fb('0x3f')](_0x59686a);})[_0x06fb('0x25')](function(_0xda4769){_0x4cd569[_0x06fb('0x40')]=_0xda4769;return _0x4cd569;})['then'](respondWithFilteredResult(_0x139c90,_0x59686a))['catch'](handleError(_0x139c90,null));};exports[_0x06fb('0x41')]=function(_0x4ff31b,_0x13cb87){var _0x1ec1c1={'raw':!![],'where':{'id':_0x4ff31b['params']['id']}},_0x28e048={};_0x28e048[_0x06fb('0x31')]=_[_0x06fb('0x2f')](db[_0x06fb('0x2b')][_0x06fb('0x42')]);_0x28e048[_0x06fb('0x2e')]=_[_0x06fb('0x2f')](_0x4ff31b[_0x06fb('0x2e')]);_0x28e048[_0x06fb('0x30')]=_[_0x06fb('0x33')](_0x28e048[_0x06fb('0x31')],_0x28e048[_0x06fb('0x2e')]);_0x1ec1c1[_0x06fb('0x32')]=_['intersection'](_0x28e048['model'],qs['fields'](_0x4ff31b[_0x06fb('0x2e')]['fields']));_0x1ec1c1[_0x06fb('0x32')]=_0x1ec1c1[_0x06fb('0x32')]['length']?_0x1ec1c1[_0x06fb('0x32')]:_0x28e048[_0x06fb('0x31')];if(_0x4ff31b[_0x06fb('0x2e')]['includeAll']){_0x1ec1c1[_0x06fb('0x3e')]=[{'all':!![]}];}_0x1ec1c1=_['merge']({},_0x1ec1c1,_0x4ff31b['options']);return db['JscriptyQuestionReport'][_0x06fb('0x43')](_0x1ec1c1)[_0x06fb('0x25')](handleEntityNotFound(_0x13cb87,null))[_0x06fb('0x25')](respondWithResult(_0x13cb87,null))[_0x06fb('0x44')](handleError(_0x13cb87,null));};exports['create']=function(_0x4aa28d,_0x371cec){return db[_0x06fb('0x2b')][_0x06fb('0x45')](_0x4aa28d[_0x06fb('0x46')],{})['then'](respondWithResult(_0x371cec,0xc9))['catch'](handleError(_0x371cec,null));};exports[_0x06fb('0x23')]=function(_0x4d8776,_0x329eb5){if(_0x4d8776[_0x06fb('0x46')]['id']){delete _0x4d8776[_0x06fb('0x46')]['id'];}return db[_0x06fb('0x2b')][_0x06fb('0x43')]({'where':{'id':_0x4d8776[_0x06fb('0x47')]['id']}})[_0x06fb('0x25')](handleEntityNotFound(_0x329eb5,null))[_0x06fb('0x25')](saveUpdates(_0x4d8776['body'],null))['then'](respondWithResult(_0x329eb5,null))[_0x06fb('0x44')](handleError(_0x329eb5,null));};exports[_0x06fb('0x24')]=function(_0x3a6a6b,_0x1536ed){return db['JscriptyQuestionReport'][_0x06fb('0x43')]({'where':{'id':_0x3a6a6b[_0x06fb('0x47')]['id']}})[_0x06fb('0x25')](handleEntityNotFound(_0x1536ed,null))[_0x06fb('0x25')](removeEntity(_0x1536ed,null))[_0x06fb('0x44')](handleError(_0x1536ed,null));};exports['describe']=function(_0x327c06,_0x21c7e9){return db[_0x06fb('0x2b')][_0x06fb('0x48')]()[_0x06fb('0x25')](respondWithResult(_0x21c7e9,null))[_0x06fb('0x44')](handleError(_0x21c7e9,null));}; \ No newline at end of file +var _0xf150=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','JscriptyQuestionReport'];(function(_0x34c0bf,_0x3b8460){var _0x315559=function(_0x42f409){while(--_0x42f409){_0x34c0bf['push'](_0x34c0bf['shift']());}};_0x315559(++_0x3b8460);}(_0xf150,0xb7));var _0x0f15=function(_0x5a818a,_0x191edd){_0x5a818a=_0x5a818a-0x0;var _0x14353e=_0xf150[_0x5a818a];return _0x14353e;};'use strict';var pdf=require(_0x0f15('0x0'));var emlformat=require(_0x0f15('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0f15('0x2'));var jsonpatch=require(_0x0f15('0x3'));var rp=require(_0x0f15('0x4'));var moment=require(_0x0f15('0x5'));var BPromise=require(_0x0f15('0x6'));var Mustache=require('mustache');var util=require(_0x0f15('0x7'));var path=require(_0x0f15('0x8'));var sox=require(_0x0f15('0x9'));var csv=require('to-csv');var ejs=require(_0x0f15('0xa'));var fs=require('fs');var _=require(_0x0f15('0xb'));var squel=require(_0x0f15('0xc'));var crypto=require(_0x0f15('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0f15('0xe'));var querystring=require('querystring');var Papa=require(_0x0f15('0xf'));var Redis=require('ioredis');var authService=require(_0x0f15('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0f15('0x11'));var hardwareService=require(_0x0f15('0x12'));var logger=require(_0x0f15('0x13'))(_0x0f15('0x14'));var utils=require(_0x0f15('0x15'));var config=require(_0x0f15('0x16'));var licenseUtil=require(_0x0f15('0x17'));var db=require(_0x0f15('0x18'))['db'];function respondWithStatusCode(_0x284041,_0x115e1b){_0x115e1b=_0x115e1b||0xcc;return function(_0x169365){if(_0x169365){return _0x284041[_0x0f15('0x19')](_0x115e1b);}return _0x284041[_0x0f15('0x1a')](_0x115e1b)[_0x0f15('0x1b')]();};}function respondWithResult(_0x1eead7,_0x3c287c){_0x3c287c=_0x3c287c||0xc8;return function(_0x33f676){if(_0x33f676){return _0x1eead7['status'](_0x3c287c)[_0x0f15('0x1c')](_0x33f676);}};}function respondWithFilteredResult(_0x16aa9e,_0x4c0171){return function(_0x398025){if(_0x398025){var _0x21a147=_0x398025[_0x0f15('0x1d')],_0x330367=_0x4c0171[_0x0f15('0x1e')],_0x20f20d=_0x4c0171['offset']+_0x4c0171[_0x0f15('0x1f')],_0x57bf86;if(_0x20f20d>=_0x21a147){_0x20f20d=_0x21a147;_0x57bf86=0xc8;}else{_0x57bf86=0xce;}_0x16aa9e[_0x0f15('0x1a')](_0x57bf86);return _0x16aa9e[_0x0f15('0x20')](_0x0f15('0x21'),_0x330367+'-'+_0x20f20d+'/'+_0x21a147)[_0x0f15('0x1c')](_0x398025);}return null;};}function patchUpdates(_0xcf6a74){return function(_0x3619ae){try{jsonpatch[_0x0f15('0x22')](_0x3619ae,_0xcf6a74,!![]);}catch(_0x4d2302){return BPromise[_0x0f15('0x23')](_0x4d2302);}return _0x3619ae[_0x0f15('0x24')]();};}function saveUpdates(_0x7a00a7,_0x3842f3){return function(_0x142ac6){if(_0x142ac6){return _0x142ac6[_0x0f15('0x25')](_0x7a00a7)['then'](function(_0x16ed72){return _0x16ed72;});}return null;};}function removeEntity(_0x1cd7a9,_0xe34d9){return function(_0x10c5d2){if(_0x10c5d2){return _0x10c5d2['destroy']()[_0x0f15('0x26')](function(){_0x1cd7a9[_0x0f15('0x1a')](0xcc)[_0x0f15('0x1b')]();});}};}function handleEntityNotFound(_0x469bf9,_0x408bc1){return function(_0x2df028){if(!_0x2df028){_0x469bf9['sendStatus'](0x194);}return _0x2df028;};}function handleError(_0x1c293d,_0x488757){_0x488757=_0x488757||0x1f4;return function(_0x1510cb){logger[_0x0f15('0x27')](_0x1510cb[_0x0f15('0x28')]);if(_0x1510cb[_0x0f15('0x29')]){delete _0x1510cb['name'];}_0x1c293d[_0x0f15('0x1a')](_0x488757)['send'](_0x1510cb);};}exports[_0x0f15('0x2a')]=function(_0x3f3242,_0x471142){var _0xa72a57={},_0x21f4d9={},_0x1a2f04={'count':0x0,'rows':[]};var _0x486300=_[_0x0f15('0x2b')](db[_0x0f15('0x2c')][_0x0f15('0x2d')],function(_0xe959b1){return{'name':_0xe959b1[_0x0f15('0x2e')],'type':_0xe959b1[_0x0f15('0x2f')][_0x0f15('0x30')]};});_0x21f4d9[_0x0f15('0x31')]=_[_0x0f15('0x2b')](_0x486300,'name');_0x21f4d9[_0x0f15('0x32')]=_[_0x0f15('0x33')](_0x3f3242[_0x0f15('0x32')]);_0x21f4d9[_0x0f15('0x34')]=_[_0x0f15('0x35')](_0x21f4d9[_0x0f15('0x31')],_0x21f4d9[_0x0f15('0x32')]);_0xa72a57['attributes']=_[_0x0f15('0x35')](_0x21f4d9['model'],qs[_0x0f15('0x36')](_0x3f3242[_0x0f15('0x32')][_0x0f15('0x36')]));_0xa72a57[_0x0f15('0x37')]=_0xa72a57[_0x0f15('0x37')][_0x0f15('0x38')]?_0xa72a57[_0x0f15('0x37')]:_0x21f4d9[_0x0f15('0x31')];if(!_0x3f3242[_0x0f15('0x32')][_0x0f15('0x39')](_0x0f15('0x3a'))){_0xa72a57[_0x0f15('0x1f')]=qs[_0x0f15('0x1f')](_0x3f3242[_0x0f15('0x32')][_0x0f15('0x1f')]);_0xa72a57[_0x0f15('0x1e')]=qs[_0x0f15('0x1e')](_0x3f3242[_0x0f15('0x32')][_0x0f15('0x1e')]);}_0xa72a57['order']=qs['sort'](_0x3f3242['query'][_0x0f15('0x3b')]);_0xa72a57[_0x0f15('0x3c')]=qs[_0x0f15('0x34')](_[_0x0f15('0x3d')](_0x3f3242['query'],_0x21f4d9[_0x0f15('0x34')]),_0x486300);if(_0x3f3242['query']['filter']){_0xa72a57[_0x0f15('0x3c')]=_[_0x0f15('0x3e')](_0xa72a57[_0x0f15('0x3c')],{'$or':_[_0x0f15('0x2b')](_0x486300,function(_0x5a240e){if(_0x5a240e['type']!=='VIRTUAL'){var _0x1bfa54={};_0x1bfa54[_0x5a240e['name']]={'$like':'%'+_0x3f3242[_0x0f15('0x32')]['filter']+'%'};return _0x1bfa54;}})});}_0xa72a57=_[_0x0f15('0x3e')]({},_0xa72a57,_0x3f3242['options']);var _0xbf7af1={'where':_0xa72a57[_0x0f15('0x3c')]};return db[_0x0f15('0x2c')]['count'](_0xbf7af1)[_0x0f15('0x26')](function(_0x24197b){_0x1a2f04[_0x0f15('0x1d')]=_0x24197b;if(_0x3f3242[_0x0f15('0x32')][_0x0f15('0x3f')]){_0xa72a57[_0x0f15('0x40')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x0f15('0x41')](_0xa72a57);})[_0x0f15('0x26')](function(_0x4f04bc){_0x1a2f04[_0x0f15('0x42')]=_0x4f04bc;return _0x1a2f04;})[_0x0f15('0x26')](respondWithFilteredResult(_0x471142,_0xa72a57))[_0x0f15('0x43')](handleError(_0x471142,null));};exports[_0x0f15('0x44')]=function(_0x40443b,_0x3f3056){var _0xc41bf7={'raw':!![],'where':{'id':_0x40443b['params']['id']}},_0xff1d95={};_0xff1d95[_0x0f15('0x31')]=_[_0x0f15('0x33')](db[_0x0f15('0x2c')]['rawAttributes']);_0xff1d95[_0x0f15('0x32')]=_[_0x0f15('0x33')](_0x40443b[_0x0f15('0x32')]);_0xff1d95[_0x0f15('0x34')]=_['intersection'](_0xff1d95[_0x0f15('0x31')],_0xff1d95['query']);_0xc41bf7[_0x0f15('0x37')]=_[_0x0f15('0x35')](_0xff1d95['model'],qs[_0x0f15('0x36')](_0x40443b[_0x0f15('0x32')]['fields']));_0xc41bf7[_0x0f15('0x37')]=_0xc41bf7[_0x0f15('0x37')][_0x0f15('0x38')]?_0xc41bf7[_0x0f15('0x37')]:_0xff1d95[_0x0f15('0x31')];if(_0x40443b[_0x0f15('0x32')][_0x0f15('0x3f')]){_0xc41bf7[_0x0f15('0x40')]=[{'all':!![]}];}_0xc41bf7=_[_0x0f15('0x3e')]({},_0xc41bf7,_0x40443b[_0x0f15('0x45')]);return db[_0x0f15('0x2c')][_0x0f15('0x46')](_0xc41bf7)[_0x0f15('0x26')](handleEntityNotFound(_0x3f3056,null))[_0x0f15('0x26')](respondWithResult(_0x3f3056,null))[_0x0f15('0x43')](handleError(_0x3f3056,null));};exports[_0x0f15('0x47')]=function(_0x1b6d35,_0x7f3ccb){return db[_0x0f15('0x2c')]['create'](_0x1b6d35['body'],{})[_0x0f15('0x26')](respondWithResult(_0x7f3ccb,0xc9))[_0x0f15('0x43')](handleError(_0x7f3ccb,null));};exports[_0x0f15('0x25')]=function(_0x42eee5,_0x21f816){if(_0x42eee5[_0x0f15('0x48')]['id']){delete _0x42eee5[_0x0f15('0x48')]['id'];}return db[_0x0f15('0x2c')][_0x0f15('0x46')]({'where':{'id':_0x42eee5[_0x0f15('0x49')]['id']}})[_0x0f15('0x26')](handleEntityNotFound(_0x21f816,null))[_0x0f15('0x26')](saveUpdates(_0x42eee5[_0x0f15('0x48')],null))['then'](respondWithResult(_0x21f816,null))[_0x0f15('0x43')](handleError(_0x21f816,null));};exports[_0x0f15('0x4a')]=function(_0x54d40e,_0x5389b8){return db[_0x0f15('0x2c')][_0x0f15('0x46')]({'where':{'id':_0x54d40e[_0x0f15('0x49')]['id']}})[_0x0f15('0x26')](handleEntityNotFound(_0x5389b8,null))['then'](removeEntity(_0x5389b8,null))[_0x0f15('0x43')](handleError(_0x5389b8,null));};exports[_0x0f15('0x4b')]=function(_0x5a2b18,_0x495a93){return db[_0x0f15('0x2c')][_0x0f15('0x4b')]()[_0x0f15('0x26')](respondWithResult(_0x495a93,null))[_0x0f15('0x43')](handleError(_0x495a93,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 720882c..afefcb4 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 _0xcc26=['exports','JscriptyQuestionReport','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x507403,_0x3f954d){var _0x1327c=function(_0x2aea1b){while(--_0x2aea1b){_0x507403['push'](_0x507403['shift']());}};_0x1327c(++_0x3f954d);}(_0xcc26,0x1ba));var _0x6cc2=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xcc26[_0x1f9f37];return _0x21c080;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6cc2('0x0'))(_0x6cc2('0x1'));var moment=require(_0x6cc2('0x2'));var BPromise=require(_0x6cc2('0x3'));var rp=require(_0x6cc2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6cc2('0x5'));var config=require(_0x6cc2('0x6'));var attributes=require(_0x6cc2('0x7'));module[_0x6cc2('0x8')]=function(_0x1dda00,_0x59f0e9){return _0x1dda00['define'](_0x6cc2('0x9'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22f5=['rimraf','../../config/environment','exports','define','JscriptyQuestionReport','report_jscripty_questions','../../config/logger','api','moment','request-promise','path'];(function(_0x10d56a,_0x4746cd){var _0x17a405=function(_0x659108){while(--_0x659108){_0x10d56a['push'](_0x10d56a['shift']());}};_0x17a405(++_0x4746cd);}(_0x22f5,0xa0));var _0x522f=function(_0x182618,_0x53427e){_0x182618=_0x182618-0x0;var _0x73fc2f=_0x22f5[_0x182618];return _0x73fc2f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x522f('0x0'))(_0x522f('0x1'));var moment=require(_0x522f('0x2'));var BPromise=require('bluebird');var rp=require(_0x522f('0x3'));var fs=require('fs');var path=require(_0x522f('0x4'));var rimraf=require(_0x522f('0x5'));var config=require(_0x522f('0x6'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x522f('0x7')]=function(_0x5517bd,_0x213626){return _0x5517bd[_0x522f('0x8')](_0x522f('0x9'),attributes,{'tableName':_0x522f('0xa'),'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 03393aa..2ca7a6d 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 _0x5e1f=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','JscriptyQuestionReport,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x4e1e83,_0x4efcd0){var _0x2081ca=function(_0x5b03e6){while(--_0x5b03e6){_0x4e1e83['push'](_0x4e1e83['shift']());}};_0x2081ca(++_0x4efcd0);}(_0x5e1f,0x12f));var _0xf5e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e1f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf5e1('0x0'));var util=require('util');var moment=require(_0xf5e1('0x1'));var BPromise=require(_0xf5e1('0x2'));var rs=require(_0xf5e1('0x3'));var fs=require('fs');var Redis=require(_0xf5e1('0x4'));var db=require(_0xf5e1('0x5'))['db'];var utils=require(_0xf5e1('0x6'));var logger=require(_0xf5e1('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf5e1('0x8'));var client=jayson[_0xf5e1('0x9')][_0xf5e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecdad,_0x17a33b,_0x29edd8){return new BPromise(function(_0x5ee9fb,_0x3bc771){return client[_0xf5e1('0xb')](_0x5ecdad,_0x29edd8)[_0xf5e1('0xc')](function(_0x1f194e){logger[_0xf5e1('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x17a33b,'request\x20sent');logger[_0xf5e1('0xe')](_0xf5e1('0xf'),_0x17a33b,_0xf5e1('0x10'),JSON[_0xf5e1('0x11')](_0x1f194e));if(_0x1f194e[_0xf5e1('0x12')]){if(_0x1f194e['error']['code']===0x1f4){logger[_0xf5e1('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x17a33b,_0x1f194e[_0xf5e1('0x12')][_0xf5e1('0x13')]);return _0x3bc771(_0x1f194e[_0xf5e1('0x12')][_0xf5e1('0x13')]);}logger[_0xf5e1('0x12')](_0xf5e1('0x14'),_0x17a33b,_0x1f194e[_0xf5e1('0x12')][_0xf5e1('0x13')]);return _0x5ee9fb(_0x1f194e[_0xf5e1('0x12')][_0xf5e1('0x13')]);}else{logger[_0xf5e1('0xd')](_0xf5e1('0x14'),_0x17a33b,_0xf5e1('0x10'));_0x5ee9fb(_0x1f194e[_0xf5e1('0x15')][_0xf5e1('0x13')]);}})['catch'](function(_0x3e7116){logger[_0xf5e1('0x12')](_0xf5e1('0x14'),_0x17a33b,_0x3e7116);_0x3bc771(_0x3e7116);});});} \ No newline at end of file +var _0xb434=['code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x56a9fa,_0x50bac1){var _0x47576f=function(_0x5343d0){while(--_0x5343d0){_0x56a9fa['push'](_0x56a9fa['shift']());}};_0x47576f(++_0x50bac1);}(_0xb434,0x101));var _0x4b43=function(_0x4c2f17,_0x5c6821){_0x4c2f17=_0x4c2f17-0x0;var _0x20919e=_0xb434[_0x4c2f17];return _0x20919e;};'use strict';var _=require('lodash');var util=require(_0x4b43('0x0'));var moment=require('moment');var BPromise=require(_0x4b43('0x1'));var rs=require(_0x4b43('0x2'));var fs=require('fs');var Redis=require(_0x4b43('0x3'));var db=require(_0x4b43('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4b43('0x5'));var config=require(_0x4b43('0x6'));var jayson=require(_0x4b43('0x7'));var client=jayson[_0x4b43('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20dc5b,_0xb7182e,_0x4b4a7f){return new BPromise(function(_0x20a789,_0x1fd94c){return client[_0x4b43('0x9')](_0x20dc5b,_0x4b4a7f)[_0x4b43('0xa')](function(_0x4887a3){logger['info'](_0x4b43('0xb'),_0xb7182e,_0x4b43('0xc'));logger['debug'](_0x4b43('0xd'),_0xb7182e,_0x4b43('0xc'),JSON[_0x4b43('0xe')](_0x4887a3));if(_0x4887a3[_0x4b43('0xf')]){if(_0x4887a3[_0x4b43('0xf')][_0x4b43('0x10')]===0x1f4){logger[_0x4b43('0xf')](_0x4b43('0xb'),_0xb7182e,_0x4887a3[_0x4b43('0xf')][_0x4b43('0x11')]);return _0x1fd94c(_0x4887a3[_0x4b43('0xf')][_0x4b43('0x11')]);}logger['error'](_0x4b43('0xb'),_0xb7182e,_0x4887a3['error'][_0x4b43('0x11')]);return _0x20a789(_0x4887a3[_0x4b43('0xf')][_0x4b43('0x11')]);}else{logger[_0x4b43('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xb7182e,_0x4b43('0xc'));_0x20a789(_0x4887a3[_0x4b43('0x13')][_0x4b43('0x11')]);}})[_0x4b43('0x14')](function(_0x44a8ef){logger[_0x4b43('0xf')](_0x4b43('0xb'),_0xb7182e,_0x44a8ef);_0x1fd94c(_0x44a8ef);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index d13a2ed..d04d422 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 _0x79d3=['./jscriptySessionReport.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x32f527,_0x465e87){var _0x1c2793=function(_0x2ecd8a){while(--_0x2ecd8a){_0x32f527['push'](_0x32f527['shift']());}};_0x1c2793(++_0x465e87);}(_0x79d3,0x15f));var _0x379d=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x79d3[_0x481bf7];return _0x461787;};'use strict';var multer=require(_0x379d('0x0'));var util=require('util');var path=require(_0x379d('0x1'));var timeout=require('connect-timeout');var express=require(_0x379d('0x2'));var router=express[_0x379d('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x379d('0x4'));var config=require(_0x379d('0x5'));var controller=require(_0x379d('0x6'));router[_0x379d('0x7')]('/',auth[_0x379d('0x8')](),controller[_0x379d('0x9')]);router[_0x379d('0x7')]('/describe',auth[_0x379d('0x8')](),controller['describe']);router[_0x379d('0x7')](_0x379d('0xa'),auth[_0x379d('0x8')](),controller['show']);router[_0x379d('0x7')]('/:id/questions',auth['isAuthenticated'](),controller['getQuestions']);router[_0x379d('0xb')]('/',auth[_0x379d('0x8')](),controller[_0x379d('0xc')]);router['put'](_0x379d('0xa'),auth[_0x379d('0x8')](),controller[_0x379d('0xd')]);router[_0x379d('0xe')]('/:id',auth[_0x379d('0x8')](),controller[_0x379d('0xf')]);module[_0x379d('0x10')]=router; \ No newline at end of file +var _0x8b7c=['delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/questions','getQuestions','post','update'];(function(_0x2597aa,_0x19ae67){var _0x58ac0c=function(_0x533788){while(--_0x533788){_0x2597aa['push'](_0x2597aa['shift']());}};_0x58ac0c(++_0x19ae67);}(_0x8b7c,0x119));var _0xc8b7=function(_0x54fdd8,_0x2e81ae){_0x54fdd8=_0x54fdd8-0x0;var _0x4f6f8a=_0x8b7c[_0x54fdd8];return _0x4f6f8a;};'use strict';var multer=require(_0xc8b7('0x0'));var util=require(_0xc8b7('0x1'));var path=require(_0xc8b7('0x2'));var timeout=require(_0xc8b7('0x3'));var express=require(_0xc8b7('0x4'));var router=express[_0xc8b7('0x5')]();var auth=require(_0xc8b7('0x6'));var interaction=require(_0xc8b7('0x7'));var config=require('../../config/environment');var controller=require(_0xc8b7('0x8'));router[_0xc8b7('0x9')]('/',auth[_0xc8b7('0xa')](),controller['index']);router[_0xc8b7('0x9')](_0xc8b7('0xb'),auth[_0xc8b7('0xa')](),controller[_0xc8b7('0xc')]);router[_0xc8b7('0x9')](_0xc8b7('0xd'),auth['isAuthenticated'](),controller[_0xc8b7('0xe')]);router['get'](_0xc8b7('0xf'),auth[_0xc8b7('0xa')](),controller[_0xc8b7('0x10')]);router[_0xc8b7('0x11')]('/',auth[_0xc8b7('0xa')](),controller['create']);router['put']('/:id',auth[_0xc8b7('0xa')](),controller[_0xc8b7('0x12')]);router[_0xc8b7('0x13')](_0xc8b7('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index e35e57f..68b10ca 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 _0x4be6=['setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','exports','DATE'];(function(_0x180798,_0x32075e){var _0x45358c=function(_0x2498b7){while(--_0x2498b7){_0x180798['push'](_0x180798['shift']());}};_0x45358c(++_0x32075e);}(_0x4be6,0xcb));var _0x64be=function(_0x2dbb3e,_0x2686b5){_0x2dbb3e=_0x2dbb3e-0x0;var _0x211782=_0x4be6[_0x2dbb3e];return _0x211782;};'use strict';var moment=require(_0x64be('0x0'));var Sequelize=require(_0x64be('0x1'));module[_0x64be('0x2')]={'starttime':{'type':Sequelize[_0x64be('0x3')],'set':function(_0x659452){this[_0x64be('0x4')](_0x64be('0x5'),_0x659452);this[_0x64be('0x4')](_0x64be('0x6'),moment()['format'](_0x64be('0x7')));}},'endtime':{'type':Sequelize[_0x64be('0x3')]},'membername':{'type':Sequelize[_0x64be('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x64be('0x8')]},'uniqueid':{'type':Sequelize[_0x64be('0x8')]},'calleridname':{'type':Sequelize[_0x64be('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x830e=['endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','exports','DATE','starttime'];(function(_0x2b81be,_0x544bdf){var _0x8ed4a7=function(_0x4a7bf4){while(--_0x4a7bf4){_0x2b81be['push'](_0x2b81be['shift']());}};_0x8ed4a7(++_0x544bdf);}(_0x830e,0xcc));var _0xe830=function(_0x2f23fc,_0x50de14){_0x2f23fc=_0x2f23fc-0x0;var _0x4ebdbf=_0x830e[_0x2f23fc];return _0x4ebdbf;};'use strict';var moment=require(_0xe830('0x0'));var Sequelize=require('sequelize');module[_0xe830('0x1')]={'starttime':{'type':Sequelize[_0xe830('0x2')],'set':function(_0x3aa1d5){this['setDataValue'](_0xe830('0x3'),_0x3aa1d5);this['setDataValue'](_0xe830('0x4'),moment()['format'](_0xe830('0x5')));}},'endtime':{'type':Sequelize[_0xe830('0x2')]},'membername':{'type':Sequelize[_0xe830('0x6')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xe830('0x6')]},'uniqueid':{'type':Sequelize[_0xe830('0x6')]},'calleridname':{'type':Sequelize[_0xe830('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xe830('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 7c81a97..dad00d8 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 _0x0245=['html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','JscriptySessionReport','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','catch','show','params','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','rawAttributes','order','SessionId','findAll','rows'];(function(_0x11d700,_0x12c781){var _0x241077=function(_0x3e8098){while(--_0x3e8098){_0x11d700['push'](_0x11d700['shift']());}};_0x241077(++_0x12c781);}(_0x0245,0xf6));var _0x5024=function(_0x407f0f,_0xcd7393){_0x407f0f=_0x407f0f-0x0;var _0x12691d=_0x0245[_0x407f0f];return _0x12691d;};'use strict';var pdf=require(_0x5024('0x0'));var emlformat=require(_0x5024('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5024('0x2'));var jsonpatch=require(_0x5024('0x3'));var rp=require(_0x5024('0x4'));var moment=require(_0x5024('0x5'));var BPromise=require(_0x5024('0x6'));var Mustache=require(_0x5024('0x7'));var util=require(_0x5024('0x8'));var path=require(_0x5024('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5024('0xa'));var crypto=require(_0x5024('0xb'));var jsforce=require(_0x5024('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5024('0xd'));var querystring=require(_0x5024('0xe'));var Papa=require('papaparse');var Redis=require(_0x5024('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5024('0x10'));var as=require(_0x5024('0x11'));var hardwareService=require(_0x5024('0x12'));var logger=require(_0x5024('0x13'))(_0x5024('0x14'));var utils=require(_0x5024('0x15'));var config=require(_0x5024('0x16'));var licenseUtil=require(_0x5024('0x17'));var db=require(_0x5024('0x18'))['db'];function respondWithStatusCode(_0x885352,_0x39030f){_0x39030f=_0x39030f||0xcc;return function(_0x5557b3){if(_0x5557b3){return _0x885352[_0x5024('0x19')](_0x39030f);}return _0x885352[_0x5024('0x1a')](_0x39030f)[_0x5024('0x1b')]();};}function respondWithResult(_0x5b6b18,_0x1686f3){_0x1686f3=_0x1686f3||0xc8;return function(_0x48fafc){if(_0x48fafc){return _0x5b6b18[_0x5024('0x1a')](_0x1686f3)[_0x5024('0x1c')](_0x48fafc);}};}function respondWithFilteredResult(_0xe678f7,_0x56cd7d){return function(_0x2979a9){if(_0x2979a9){var _0x25a43e=_0x2979a9[_0x5024('0x1d')],_0x42961f=_0x56cd7d[_0x5024('0x1e')],_0x36e999=_0x56cd7d[_0x5024('0x1e')]+_0x56cd7d[_0x5024('0x1f')],_0x4210f8;if(_0x36e999>=_0x25a43e){_0x36e999=_0x25a43e;_0x4210f8=0xc8;}else{_0x4210f8=0xce;}_0xe678f7[_0x5024('0x1a')](_0x4210f8);return _0xe678f7[_0x5024('0x20')](_0x5024('0x21'),_0x42961f+'-'+_0x36e999+'/'+_0x25a43e)[_0x5024('0x1c')](_0x2979a9);}return null;};}function patchUpdates(_0x5a573b){return function(_0x5d6f15){try{jsonpatch[_0x5024('0x22')](_0x5d6f15,_0x5a573b,!![]);}catch(_0x4d9814){return BPromise[_0x5024('0x23')](_0x4d9814);}return _0x5d6f15[_0x5024('0x24')]();};}function saveUpdates(_0x551b18,_0x51acce){return function(_0x446048){if(_0x446048){return _0x446048['update'](_0x551b18)[_0x5024('0x25')](function(_0x5483ac){return _0x5483ac;});}return null;};}function removeEntity(_0x5429a8,_0x4c530c){return function(_0x5619a0){if(_0x5619a0){return _0x5619a0[_0x5024('0x26')]()[_0x5024('0x25')](function(){_0x5429a8['status'](0xcc)[_0x5024('0x1b')]();});}};}function handleEntityNotFound(_0x4231be,_0x3b82e2){return function(_0x3d3507){if(!_0x3d3507){_0x4231be[_0x5024('0x19')](0x194);}return _0x3d3507;};}function handleError(_0x3129c8,_0x290cda){_0x290cda=_0x290cda||0x1f4;return function(_0x615103){logger[_0x5024('0x27')](_0x615103[_0x5024('0x28')]);if(_0x615103[_0x5024('0x29')]){delete _0x615103['name'];}_0x3129c8[_0x5024('0x1a')](_0x290cda)[_0x5024('0x2a')](_0x615103);};}exports[_0x5024('0x2b')]=function(_0x1a8ee9,_0x12e693){var _0x94803={},_0x9e13b={},_0x493e2b={'count':0x0,'rows':[]};var _0x598111=_[_0x5024('0x2c')](db[_0x5024('0x2d')]['rawAttributes'],function(_0x43d4a8){return{'name':_0x43d4a8[_0x5024('0x2e')],'type':_0x43d4a8['type']['key']};});_0x9e13b[_0x5024('0x2f')]=_[_0x5024('0x2c')](_0x598111,'name');_0x9e13b[_0x5024('0x30')]=_[_0x5024('0x31')](_0x1a8ee9[_0x5024('0x30')]);_0x9e13b['filters']=_[_0x5024('0x32')](_0x9e13b[_0x5024('0x2f')],_0x9e13b[_0x5024('0x30')]);_0x94803[_0x5024('0x33')]=_[_0x5024('0x32')](_0x9e13b['model'],qs[_0x5024('0x34')](_0x1a8ee9['query']['fields']));_0x94803[_0x5024('0x33')]=_0x94803[_0x5024('0x33')][_0x5024('0x35')]?_0x94803[_0x5024('0x33')]:_0x9e13b[_0x5024('0x2f')];if(!_0x1a8ee9[_0x5024('0x30')][_0x5024('0x36')](_0x5024('0x37'))){_0x94803[_0x5024('0x1f')]=qs[_0x5024('0x1f')](_0x1a8ee9[_0x5024('0x30')][_0x5024('0x1f')]);_0x94803[_0x5024('0x1e')]=qs[_0x5024('0x1e')](_0x1a8ee9[_0x5024('0x30')][_0x5024('0x1e')]);}_0x94803['order']=qs[_0x5024('0x38')](_0x1a8ee9[_0x5024('0x30')][_0x5024('0x38')]);_0x94803['where']=qs[_0x5024('0x39')](_[_0x5024('0x3a')](_0x1a8ee9['query'],_0x9e13b[_0x5024('0x39')]),_0x598111);if(_0x1a8ee9[_0x5024('0x30')]['filter']){_0x94803[_0x5024('0x3b')]=_[_0x5024('0x3c')](_0x94803[_0x5024('0x3b')],{'$or':_[_0x5024('0x2c')](_0x598111,function(_0x4c356a){if(_0x4c356a[_0x5024('0x3d')]!==_0x5024('0x3e')){var _0x5d3499={};_0x5d3499[_0x4c356a[_0x5024('0x29')]]={'$like':'%'+_0x1a8ee9[_0x5024('0x30')][_0x5024('0x3f')]+'%'};return _0x5d3499;}})});}_0x94803=_['merge']({},_0x94803,_0x1a8ee9[_0x5024('0x40')]);var _0x38c9bd={'where':_0x94803[_0x5024('0x3b')]};return db[_0x5024('0x2d')][_0x5024('0x1d')](_0x38c9bd)[_0x5024('0x25')](function(_0x4d1fd8){_0x493e2b[_0x5024('0x1d')]=_0x4d1fd8;if(_0x1a8ee9[_0x5024('0x30')][_0x5024('0x41')]){_0x94803[_0x5024('0x42')]=[{'all':!![]}];}return db[_0x5024('0x2d')]['findAll'](_0x94803);})[_0x5024('0x25')](function(_0x53b5ed){_0x493e2b['rows']=_0x53b5ed;return _0x493e2b;})[_0x5024('0x25')](respondWithFilteredResult(_0x12e693,_0x94803))[_0x5024('0x43')](handleError(_0x12e693,null));};exports[_0x5024('0x44')]=function(_0x34eefd,_0x455662){var _0x4a6c69={'raw':!![],'where':{'id':_0x34eefd[_0x5024('0x45')]['id']}},_0x1a8af7={};_0x1a8af7[_0x5024('0x2f')]=_['keys'](db[_0x5024('0x2d')]['rawAttributes']);_0x1a8af7[_0x5024('0x30')]=_[_0x5024('0x31')](_0x34eefd[_0x5024('0x30')]);_0x1a8af7[_0x5024('0x39')]=_[_0x5024('0x32')](_0x1a8af7[_0x5024('0x2f')],_0x1a8af7[_0x5024('0x30')]);_0x4a6c69[_0x5024('0x33')]=_[_0x5024('0x32')](_0x1a8af7[_0x5024('0x2f')],qs[_0x5024('0x34')](_0x34eefd[_0x5024('0x30')][_0x5024('0x34')]));_0x4a6c69[_0x5024('0x33')]=_0x4a6c69[_0x5024('0x33')][_0x5024('0x35')]?_0x4a6c69[_0x5024('0x33')]:_0x1a8af7[_0x5024('0x2f')];if(_0x34eefd[_0x5024('0x30')][_0x5024('0x41')]){_0x4a6c69[_0x5024('0x42')]=[{'all':!![]}];}_0x4a6c69=_['merge']({},_0x4a6c69,_0x34eefd['options']);return db[_0x5024('0x2d')][_0x5024('0x46')](_0x4a6c69)[_0x5024('0x25')](handleEntityNotFound(_0x455662,null))['then'](respondWithResult(_0x455662,null))[_0x5024('0x43')](handleError(_0x455662,null));};exports['create']=function(_0x4d9630,_0x3e66a4){return db[_0x5024('0x2d')][_0x5024('0x47')](_0x4d9630['body'],{})[_0x5024('0x25')](respondWithResult(_0x3e66a4,0xc9))[_0x5024('0x43')](handleError(_0x3e66a4,null));};exports['update']=function(_0x5584b4,_0x23cc64){if(_0x5584b4[_0x5024('0x48')]['id']){delete _0x5584b4[_0x5024('0x48')]['id'];}return db[_0x5024('0x2d')]['find']({'where':{'id':_0x5584b4[_0x5024('0x45')]['id']}})[_0x5024('0x25')](handleEntityNotFound(_0x23cc64,null))[_0x5024('0x25')](saveUpdates(_0x5584b4[_0x5024('0x48')],null))[_0x5024('0x25')](respondWithResult(_0x23cc64,null))[_0x5024('0x43')](handleError(_0x23cc64,null));};exports[_0x5024('0x26')]=function(_0x4e1ccb,_0x1cd4a8){return db['JscriptySessionReport'][_0x5024('0x46')]({'where':{'id':_0x4e1ccb[_0x5024('0x45')]['id']}})[_0x5024('0x25')](handleEntityNotFound(_0x1cd4a8,null))[_0x5024('0x25')](removeEntity(_0x1cd4a8,null))['catch'](handleError(_0x1cd4a8,null));};exports[_0x5024('0x49')]=function(_0x29eb9c,_0x389d9a){return db[_0x5024('0x2d')]['describe']()[_0x5024('0x25')](respondWithResult(_0x389d9a,null))[_0x5024('0x43')](handleError(_0x389d9a,null));};exports[_0x5024('0x4a')]=function(_0x292ec3,_0x147723,_0x406a0e){var _0x43b327={'raw':!![],'where':{}};var _0x50e03c={};var _0x170d8f={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x5024('0x4b')]({'where':{'id':_0x292ec3['params']['id']}})[_0x5024('0x25')](handleEntityNotFound(_0x147723,null))['then'](function(_0x10a336){if(_0x10a336){_0x50e03c['model']=_[_0x5024('0x31')](db[_0x5024('0x4c')][_0x5024('0x4d')]);_0x50e03c[_0x5024('0x30')]=_[_0x5024('0x31')](_0x292ec3[_0x5024('0x30')]);_0x50e03c[_0x5024('0x39')]=_[_0x5024('0x32')](_0x50e03c[_0x5024('0x2f')],_0x50e03c[_0x5024('0x30')]);_0x43b327['attributes']=_[_0x5024('0x32')](_0x50e03c['model'],qs[_0x5024('0x34')](_0x292ec3[_0x5024('0x30')]['fields']));_0x43b327[_0x5024('0x33')]=_0x43b327['attributes'][_0x5024('0x35')]?_0x43b327[_0x5024('0x33')]:_0x50e03c['model'];if(!_0x292ec3[_0x5024('0x30')][_0x5024('0x36')]('nolimit')){_0x43b327[_0x5024('0x1f')]=qs[_0x5024('0x1f')](_0x292ec3[_0x5024('0x30')]['limit']);_0x43b327[_0x5024('0x1e')]=qs['offset'](_0x292ec3[_0x5024('0x30')][_0x5024('0x1e')]);}_0x43b327[_0x5024('0x4e')]=qs['sort'](_0x292ec3[_0x5024('0x30')][_0x5024('0x38')]);_0x43b327[_0x5024('0x3b')]=qs[_0x5024('0x39')](_[_0x5024('0x3a')](_0x292ec3[_0x5024('0x30')],_0x50e03c[_0x5024('0x39')]));_0x43b327['where'][_0x5024('0x4f')]=_0x10a336['id'];if(_0x292ec3[_0x5024('0x30')][_0x5024('0x3f')]){_0x43b327[_0x5024('0x3b')]=_[_0x5024('0x3c')](_0x43b327[_0x5024('0x3b')],{'$or':_['map'](_0x43b327[_0x5024('0x33')],function(_0xa496a1){var _0x3b2e4a={};_0x3b2e4a[_0xa496a1]={'$like':'%'+_0x292ec3['query']['filter']+'%'};return _0x3b2e4a;})});}_0x43b327=_[_0x5024('0x3c')]({},_0x43b327,_0x292ec3[_0x5024('0x40')]);return db['JscriptyQuestionReport'][_0x5024('0x1d')]({'where':_0x43b327[_0x5024('0x3b')]})[_0x5024('0x25')](function(_0x31fc1f){_0x170d8f[_0x5024('0x1d')]=_0x31fc1f;if(_0x292ec3[_0x5024('0x30')][_0x5024('0x41')]){_0x43b327[_0x5024('0x42')]=[{'all':!![]}];}return db[_0x5024('0x4c')][_0x5024('0x50')](_0x43b327);})[_0x5024('0x25')](function(_0x4271ea){_0x170d8f[_0x5024('0x51')]=_0x4271ea;return _0x170d8f;});}})[_0x5024('0x25')](respondWithFilteredResult(_0x147723,_0x43b327))[_0x5024('0x43')](handleError(_0x147723,null));}; \ No newline at end of file +var _0x81c9=['body','params','describe','getQuestions','findOne','JscriptyQuestionReport','map','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','sort','where','filters','pick','merge','VIRTUAL','filter','options','JscriptySessionReport','includeAll','include','findAll','rows','show','find','create','catch'];(function(_0x20d6f0,_0x33e54c){var _0x105ceb=function(_0x4927e9){while(--_0x4927e9){_0x20d6f0['push'](_0x20d6f0['shift']());}};_0x105ceb(++_0x33e54c);}(_0x81c9,0xa7));var _0x981c=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x81c9[_0x49ca18];return _0x145d54;};'use strict';var pdf=require(_0x981c('0x0'));var emlformat=require(_0x981c('0x1'));var rimraf=require(_0x981c('0x2'));var zipdir=require(_0x981c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x981c('0x4'));var moment=require('moment');var BPromise=require(_0x981c('0x5'));var Mustache=require(_0x981c('0x6'));var util=require(_0x981c('0x7'));var path=require('path');var sox=require(_0x981c('0x8'));var csv=require(_0x981c('0x9'));var ejs=require(_0x981c('0xa'));var fs=require('fs');var _=require(_0x981c('0xb'));var squel=require(_0x981c('0xc'));var crypto=require(_0x981c('0xd'));var jsforce=require(_0x981c('0xe'));var deskjs=require(_0x981c('0xf'));var toCsv=require(_0x981c('0x9'));var querystring=require(_0x981c('0x10'));var Papa=require('papaparse');var Redis=require(_0x981c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x981c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x981c('0x13'));var logger=require(_0x981c('0x14'))(_0x981c('0x15'));var utils=require(_0x981c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x981c('0x17'));var db=require(_0x981c('0x18'))['db'];function respondWithStatusCode(_0x14228e,_0x575cde){_0x575cde=_0x575cde||0xcc;return function(_0x1b0dee){if(_0x1b0dee){return _0x14228e[_0x981c('0x19')](_0x575cde);}return _0x14228e[_0x981c('0x1a')](_0x575cde)[_0x981c('0x1b')]();};}function respondWithResult(_0x422b81,_0x352125){_0x352125=_0x352125||0xc8;return function(_0x471fc0){if(_0x471fc0){return _0x422b81[_0x981c('0x1a')](_0x352125)['json'](_0x471fc0);}};}function respondWithFilteredResult(_0x178ac9,_0x5ef08d){return function(_0x49a654){if(_0x49a654){var _0x2d977d=_0x49a654[_0x981c('0x1c')],_0x213ade=_0x5ef08d['offset'],_0x4b06f3=_0x5ef08d['offset']+_0x5ef08d['limit'],_0x380613;if(_0x4b06f3>=_0x2d977d){_0x4b06f3=_0x2d977d;_0x380613=0xc8;}else{_0x380613=0xce;}_0x178ac9['status'](_0x380613);return _0x178ac9[_0x981c('0x1d')]('Content-Range',_0x213ade+'-'+_0x4b06f3+'/'+_0x2d977d)[_0x981c('0x1e')](_0x49a654);}return null;};}function patchUpdates(_0x3ec1ba){return function(_0x499bb6){try{jsonpatch[_0x981c('0x1f')](_0x499bb6,_0x3ec1ba,!![]);}catch(_0x44443c){return BPromise[_0x981c('0x20')](_0x44443c);}return _0x499bb6[_0x981c('0x21')]();};}function saveUpdates(_0x482d21,_0x23d48){return function(_0xf648a3){if(_0xf648a3){return _0xf648a3[_0x981c('0x22')](_0x482d21)[_0x981c('0x23')](function(_0x5cc190){return _0x5cc190;});}return null;};}function removeEntity(_0x305a53,_0x4ebdba){return function(_0x12d8b4){if(_0x12d8b4){return _0x12d8b4[_0x981c('0x24')]()['then'](function(){_0x305a53[_0x981c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56979c,_0x438ef8){return function(_0x54a10e){if(!_0x54a10e){_0x56979c[_0x981c('0x19')](0x194);}return _0x54a10e;};}function handleError(_0x5442a6,_0x1b6ec5){_0x1b6ec5=_0x1b6ec5||0x1f4;return function(_0x190527){logger[_0x981c('0x25')](_0x190527[_0x981c('0x26')]);if(_0x190527[_0x981c('0x27')]){delete _0x190527[_0x981c('0x27')];}_0x5442a6[_0x981c('0x1a')](_0x1b6ec5)[_0x981c('0x28')](_0x190527);};}exports[_0x981c('0x29')]=function(_0x5b8f33,_0x150db2){var _0x1f2fd3={},_0x356cd4={},_0xc69aae={'count':0x0,'rows':[]};var _0x3e2d7b=_['map'](db['JscriptySessionReport'][_0x981c('0x2a')],function(_0x58058c){return{'name':_0x58058c[_0x981c('0x2b')],'type':_0x58058c[_0x981c('0x2c')]['key']};});_0x356cd4[_0x981c('0x2d')]=_['map'](_0x3e2d7b,'name');_0x356cd4[_0x981c('0x2e')]=_[_0x981c('0x2f')](_0x5b8f33[_0x981c('0x2e')]);_0x356cd4['filters']=_[_0x981c('0x30')](_0x356cd4[_0x981c('0x2d')],_0x356cd4[_0x981c('0x2e')]);_0x1f2fd3['attributes']=_['intersection'](_0x356cd4[_0x981c('0x2d')],qs['fields'](_0x5b8f33['query'][_0x981c('0x31')]));_0x1f2fd3[_0x981c('0x32')]=_0x1f2fd3[_0x981c('0x32')][_0x981c('0x33')]?_0x1f2fd3[_0x981c('0x32')]:_0x356cd4[_0x981c('0x2d')];if(!_0x5b8f33[_0x981c('0x2e')][_0x981c('0x34')](_0x981c('0x35'))){_0x1f2fd3[_0x981c('0x36')]=qs[_0x981c('0x36')](_0x5b8f33[_0x981c('0x2e')][_0x981c('0x36')]);_0x1f2fd3[_0x981c('0x37')]=qs['offset'](_0x5b8f33[_0x981c('0x2e')][_0x981c('0x37')]);}_0x1f2fd3['order']=qs[_0x981c('0x38')](_0x5b8f33[_0x981c('0x2e')]['sort']);_0x1f2fd3[_0x981c('0x39')]=qs[_0x981c('0x3a')](_[_0x981c('0x3b')](_0x5b8f33[_0x981c('0x2e')],_0x356cd4['filters']),_0x3e2d7b);if(_0x5b8f33['query']['filter']){_0x1f2fd3[_0x981c('0x39')]=_[_0x981c('0x3c')](_0x1f2fd3[_0x981c('0x39')],{'$or':_['map'](_0x3e2d7b,function(_0xc2b755){if(_0xc2b755['type']!==_0x981c('0x3d')){var _0x529c10={};_0x529c10[_0xc2b755[_0x981c('0x27')]]={'$like':'%'+_0x5b8f33['query'][_0x981c('0x3e')]+'%'};return _0x529c10;}})});}_0x1f2fd3=_[_0x981c('0x3c')]({},_0x1f2fd3,_0x5b8f33[_0x981c('0x3f')]);var _0x33a5e6={'where':_0x1f2fd3[_0x981c('0x39')]};return db[_0x981c('0x40')][_0x981c('0x1c')](_0x33a5e6)[_0x981c('0x23')](function(_0x39f7ce){_0xc69aae[_0x981c('0x1c')]=_0x39f7ce;if(_0x5b8f33[_0x981c('0x2e')][_0x981c('0x41')]){_0x1f2fd3[_0x981c('0x42')]=[{'all':!![]}];}return db[_0x981c('0x40')][_0x981c('0x43')](_0x1f2fd3);})[_0x981c('0x23')](function(_0x35368f){_0xc69aae[_0x981c('0x44')]=_0x35368f;return _0xc69aae;})[_0x981c('0x23')](respondWithFilteredResult(_0x150db2,_0x1f2fd3))['catch'](handleError(_0x150db2,null));};exports[_0x981c('0x45')]=function(_0xa2a5f,_0x36b38b){var _0x58d4d9={'raw':!![],'where':{'id':_0xa2a5f['params']['id']}},_0x341096={};_0x341096[_0x981c('0x2d')]=_[_0x981c('0x2f')](db['JscriptySessionReport'][_0x981c('0x2a')]);_0x341096[_0x981c('0x2e')]=_[_0x981c('0x2f')](_0xa2a5f['query']);_0x341096[_0x981c('0x3a')]=_[_0x981c('0x30')](_0x341096[_0x981c('0x2d')],_0x341096[_0x981c('0x2e')]);_0x58d4d9[_0x981c('0x32')]=_[_0x981c('0x30')](_0x341096[_0x981c('0x2d')],qs[_0x981c('0x31')](_0xa2a5f['query'][_0x981c('0x31')]));_0x58d4d9[_0x981c('0x32')]=_0x58d4d9['attributes'][_0x981c('0x33')]?_0x58d4d9['attributes']:_0x341096[_0x981c('0x2d')];if(_0xa2a5f[_0x981c('0x2e')][_0x981c('0x41')]){_0x58d4d9[_0x981c('0x42')]=[{'all':!![]}];}_0x58d4d9=_[_0x981c('0x3c')]({},_0x58d4d9,_0xa2a5f['options']);return db[_0x981c('0x40')][_0x981c('0x46')](_0x58d4d9)['then'](handleEntityNotFound(_0x36b38b,null))[_0x981c('0x23')](respondWithResult(_0x36b38b,null))['catch'](handleError(_0x36b38b,null));};exports[_0x981c('0x47')]=function(_0xa13f25,_0x298c5f){return db[_0x981c('0x40')]['create'](_0xa13f25['body'],{})[_0x981c('0x23')](respondWithResult(_0x298c5f,0xc9))[_0x981c('0x48')](handleError(_0x298c5f,null));};exports[_0x981c('0x22')]=function(_0x56d06b,_0xa023d0){if(_0x56d06b['body']['id']){delete _0x56d06b[_0x981c('0x49')]['id'];}return db[_0x981c('0x40')][_0x981c('0x46')]({'where':{'id':_0x56d06b[_0x981c('0x4a')]['id']}})['then'](handleEntityNotFound(_0xa023d0,null))[_0x981c('0x23')](saveUpdates(_0x56d06b[_0x981c('0x49')],null))[_0x981c('0x23')](respondWithResult(_0xa023d0,null))[_0x981c('0x48')](handleError(_0xa023d0,null));};exports[_0x981c('0x24')]=function(_0x1d0c17,_0x18350b){return db['JscriptySessionReport'][_0x981c('0x46')]({'where':{'id':_0x1d0c17[_0x981c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x18350b,null))[_0x981c('0x23')](removeEntity(_0x18350b,null))['catch'](handleError(_0x18350b,null));};exports['describe']=function(_0x3fb4f8,_0x548bbb){return db[_0x981c('0x40')][_0x981c('0x4b')]()[_0x981c('0x23')](respondWithResult(_0x548bbb,null))['catch'](handleError(_0x548bbb,null));};exports[_0x981c('0x4c')]=function(_0x5e5643,_0x417111,_0xe09260){var _0x5a8d4f={'raw':!![],'where':{}};var _0x108c2e={};var _0x52fb05={'count':0x0,'rows':[]};return db[_0x981c('0x40')][_0x981c('0x4d')]({'where':{'id':_0x5e5643[_0x981c('0x4a')]['id']}})[_0x981c('0x23')](handleEntityNotFound(_0x417111,null))['then'](function(_0xa4bc7a){if(_0xa4bc7a){_0x108c2e[_0x981c('0x2d')]=_[_0x981c('0x2f')](db[_0x981c('0x4e')][_0x981c('0x2a')]);_0x108c2e['query']=_['keys'](_0x5e5643['query']);_0x108c2e['filters']=_['intersection'](_0x108c2e['model'],_0x108c2e[_0x981c('0x2e')]);_0x5a8d4f[_0x981c('0x32')]=_['intersection'](_0x108c2e['model'],qs['fields'](_0x5e5643[_0x981c('0x2e')][_0x981c('0x31')]));_0x5a8d4f[_0x981c('0x32')]=_0x5a8d4f['attributes'][_0x981c('0x33')]?_0x5a8d4f[_0x981c('0x32')]:_0x108c2e[_0x981c('0x2d')];if(!_0x5e5643[_0x981c('0x2e')][_0x981c('0x34')](_0x981c('0x35'))){_0x5a8d4f[_0x981c('0x36')]=qs[_0x981c('0x36')](_0x5e5643[_0x981c('0x2e')][_0x981c('0x36')]);_0x5a8d4f['offset']=qs['offset'](_0x5e5643[_0x981c('0x2e')]['offset']);}_0x5a8d4f['order']=qs[_0x981c('0x38')](_0x5e5643[_0x981c('0x2e')][_0x981c('0x38')]);_0x5a8d4f['where']=qs[_0x981c('0x3a')](_[_0x981c('0x3b')](_0x5e5643['query'],_0x108c2e[_0x981c('0x3a')]));_0x5a8d4f[_0x981c('0x39')]['SessionId']=_0xa4bc7a['id'];if(_0x5e5643[_0x981c('0x2e')][_0x981c('0x3e')]){_0x5a8d4f[_0x981c('0x39')]=_[_0x981c('0x3c')](_0x5a8d4f[_0x981c('0x39')],{'$or':_[_0x981c('0x4f')](_0x5a8d4f['attributes'],function(_0x7facfb){var _0x28e9f3={};_0x28e9f3[_0x7facfb]={'$like':'%'+_0x5e5643[_0x981c('0x2e')][_0x981c('0x3e')]+'%'};return _0x28e9f3;})});}_0x5a8d4f=_[_0x981c('0x3c')]({},_0x5a8d4f,_0x5e5643['options']);return db[_0x981c('0x4e')][_0x981c('0x1c')]({'where':_0x5a8d4f[_0x981c('0x39')]})[_0x981c('0x23')](function(_0x4a7279){_0x52fb05[_0x981c('0x1c')]=_0x4a7279;if(_0x5e5643['query'][_0x981c('0x41')]){_0x5a8d4f[_0x981c('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x981c('0x43')](_0x5a8d4f);})[_0x981c('0x23')](function(_0x4efac1){_0x52fb05['rows']=_0x4efac1;return _0x52fb05;});}})[_0x981c('0x23')](respondWithFilteredResult(_0x417111,_0x5a8d4f))[_0x981c('0x48')](handleError(_0x417111,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 41f52a5..349eea5 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 _0x3ff4=['path','../../config/environment','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2fc59b,_0x288aae){var _0x1c6618=function(_0x402947){while(--_0x402947){_0x2fc59b['push'](_0x2fc59b['shift']());}};_0x1c6618(++_0x288aae);}(_0x3ff4,0x8a));var _0x43ff=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x3ff4[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x43ff('0x0'));var util=require(_0x43ff('0x1'));var logger=require(_0x43ff('0x2'))('api');var moment=require(_0x43ff('0x3'));var BPromise=require(_0x43ff('0x4'));var rp=require(_0x43ff('0x5'));var fs=require('fs');var path=require(_0x43ff('0x6'));var rimraf=require('rimraf');var config=require(_0x43ff('0x7'));var attributes=require(_0x43ff('0x8'));module[_0x43ff('0x9')]=function(_0x7d3332,_0x290be1){return _0x7d3332[_0x43ff('0xa')]('JscriptySessionReport',attributes,{'tableName':_0x43ff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7605=['lodash','util','../../config/logger','moment','path','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x21786f,_0x5db1a2){var _0x1fc90a=function(_0x40197d){while(--_0x40197d){_0x21786f['push'](_0x21786f['shift']());}};_0x1fc90a(++_0x5db1a2);}(_0x7605,0x1dd));var _0x5760=function(_0x450809,_0x1452a7){_0x450809=_0x450809-0x0;var _0x38ecea=_0x7605[_0x450809];return _0x38ecea;};'use strict';var _=require(_0x5760('0x0'));var util=require(_0x5760('0x1'));var logger=require(_0x5760('0x2'))('api');var moment=require(_0x5760('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5760('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5760('0x5'));module[_0x5760('0x6')]=function(_0x3846d9,_0x135428){return _0x3846d9[_0x5760('0x7')](_0x5760('0x8'),attributes,{'tableName':'report_jscripty_sessions','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 9c36f5b..90b7d2f 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 _0x0b80=['message','error','result','catch','lodash','util','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b80,0xd5));var _0x00b8=function(_0x1b80ed,_0x1806d9){_0x1b80ed=_0x1b80ed-0x0;var _0x10a0bd=_0x0b80[_0x1b80ed];return _0x10a0bd;};'use strict';var _=require(_0x00b8('0x0'));var util=require(_0x00b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x00b8('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x00b8('0x3'));var config=require(_0x00b8('0x4'));var jayson=require(_0x00b8('0x5'));var client=jayson['client'][_0x00b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5ac2e7,_0x5af0c0,_0x5a6813){return new BPromise(function(_0x1d3f47,_0x46c5aa){return client[_0x00b8('0x7')](_0x5ac2e7,_0x5a6813)[_0x00b8('0x8')](function(_0x599ff9){logger[_0x00b8('0x9')](_0x00b8('0xa'),_0x5af0c0,_0x00b8('0xb'));logger[_0x00b8('0xc')](_0x00b8('0xd'),_0x5af0c0,'request\x20sent',JSON[_0x00b8('0xe')](_0x599ff9));if(_0x599ff9['error']){if(_0x599ff9['error']['code']===0x1f4){logger['error'](_0x00b8('0xa'),_0x5af0c0,_0x599ff9['error'][_0x00b8('0xf')]);return _0x46c5aa(_0x599ff9[_0x00b8('0x10')][_0x00b8('0xf')]);}logger[_0x00b8('0x10')](_0x00b8('0xa'),_0x5af0c0,_0x599ff9[_0x00b8('0x10')][_0x00b8('0xf')]);return _0x1d3f47(_0x599ff9[_0x00b8('0x10')][_0x00b8('0xf')]);}else{logger['info'](_0x00b8('0xa'),_0x5af0c0,_0x00b8('0xb'));_0x1d3f47(_0x599ff9[_0x00b8('0x11')][_0x00b8('0xf')]);}})[_0x00b8('0x12')](function(_0x42c545){logger[_0x00b8('0x10')](_0x00b8('0xa'),_0x5af0c0,_0x42c545);_0x46c5aa(_0x42c545);});});} \ No newline at end of file +var _0x7d51=['JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x535d2e,_0x5392e1){var _0x1bdca5=function(_0x920f8b){while(--_0x920f8b){_0x535d2e['push'](_0x535d2e['shift']());}};_0x1bdca5(++_0x5392e1);}(_0x7d51,0x1e9));var _0x17d5=function(_0x271397,_0x388be7){_0x271397=_0x271397-0x0;var _0xa73796=_0x7d51[_0x271397];return _0xa73796;};'use strict';var _=require(_0x17d5('0x0'));var util=require(_0x17d5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17d5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x17d5('0x3'))['db'];var utils=require(_0x17d5('0x4'));var logger=require(_0x17d5('0x5'))(_0x17d5('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x17d5('0x7')][_0x17d5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28afa2,_0x1a8312,_0x44fbee){return new BPromise(function(_0x16e098,_0x533125){return client[_0x17d5('0x9')](_0x28afa2,_0x44fbee)[_0x17d5('0xa')](function(_0x3147c4){logger[_0x17d5('0xb')](_0x17d5('0xc'),_0x1a8312,_0x17d5('0xd'));logger[_0x17d5('0xe')](_0x17d5('0xf'),_0x1a8312,_0x17d5('0xd'),JSON[_0x17d5('0x10')](_0x3147c4));if(_0x3147c4[_0x17d5('0x11')]){if(_0x3147c4[_0x17d5('0x11')][_0x17d5('0x12')]===0x1f4){logger['error'](_0x17d5('0xc'),_0x1a8312,_0x3147c4[_0x17d5('0x11')]['message']);return _0x533125(_0x3147c4[_0x17d5('0x11')][_0x17d5('0x13')]);}logger[_0x17d5('0x11')](_0x17d5('0xc'),_0x1a8312,_0x3147c4[_0x17d5('0x11')][_0x17d5('0x13')]);return _0x16e098(_0x3147c4['error'][_0x17d5('0x13')]);}else{logger[_0x17d5('0xb')](_0x17d5('0xc'),_0x1a8312,_0x17d5('0xd'));_0x16e098(_0x3147c4[_0x17d5('0x14')][_0x17d5('0x13')]);}})['catch'](function(_0x57b62f){logger[_0x17d5('0x11')](_0x17d5('0xc'),_0x1a8312,_0x57b62f);_0x533125(_0x57b62f);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index ebf7082..4dca386 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 _0x3417=['../../components/interaction/service','../../config/environment','index','put','/:id','isAuthenticated','exports','multer','util','path','Router'];(function(_0xe46401,_0x201a4f){var _0x2d51b7=function(_0x3ea259){while(--_0x3ea259){_0xe46401['push'](_0xe46401['shift']());}};_0x2d51b7(++_0x201a4f);}(_0x3417,0x1eb));var _0x7341=function(_0x2926d5,_0x50e525){_0x2926d5=_0x2926d5-0x0;var _0x400abe=_0x3417[_0x2926d5];return _0x400abe;};'use strict';var multer=require(_0x7341('0x0'));var util=require(_0x7341('0x1'));var path=require(_0x7341('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7341('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7341('0x4'));var config=require(_0x7341('0x5'));var controller=require('./license.controller');router['get']('/',controller[_0x7341('0x6')]);router[_0x7341('0x7')](_0x7341('0x8'),auth[_0x7341('0x9')](),controller['update']);module[_0x7341('0xa')]=router; \ No newline at end of file +var _0xb720=['put','/:id','update','exports','util','path','express','../../components/auth/service','../../components/interaction/service','./license.controller','get','index'];(function(_0x4c2bc5,_0x4984e2){var _0x487209=function(_0x3cabbf){while(--_0x3cabbf){_0x4c2bc5['push'](_0x4c2bc5['shift']());}};_0x487209(++_0x4984e2);}(_0xb720,0x118));var _0x0b72=function(_0x5dc755,_0x3254d0){_0x5dc755=_0x5dc755-0x0;var _0x24ce81=_0xb720[_0x5dc755];return _0x24ce81;};'use strict';var multer=require('multer');var util=require(_0x0b72('0x0'));var path=require(_0x0b72('0x1'));var timeout=require('connect-timeout');var express=require(_0x0b72('0x2'));var router=express['Router']();var auth=require(_0x0b72('0x3'));var interaction=require(_0x0b72('0x4'));var config=require('../../config/environment');var controller=require(_0x0b72('0x5'));router[_0x0b72('0x6')]('/',controller[_0x0b72('0x7')]);router[_0x0b72('0x8')](_0x0b72('0x9'),auth['isAuthenticated'](),controller[_0x0b72('0xa')]);module[_0x0b72('0xb')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 38b896b..4932d8f 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 _0x46ed=['sequelize','exports','STRING','INTEGER'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0x46ed,0x168));var _0xd46e=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x46ed[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xd46e('0x2')]},'data2':{'type':Sequelize[_0xd46e('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xd46e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1261=['exports','TEXT','STRING','INTEGER'];(function(_0x125a19,_0x5b9054){var _0x431ae0=function(_0x4a85d8){while(--_0x4a85d8){_0x125a19['push'](_0x125a19['shift']());}};_0x431ae0(++_0x5b9054);}(_0x1261,0x144));var _0x1126=function(_0x90a39a,_0x32020d){_0x90a39a=_0x90a39a-0x0;var _0x2b62f7=_0x1261[_0x90a39a];return _0x2b62f7;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'license':{'type':Sequelize[_0x1126('0x1')]},'data1':{'type':Sequelize[_0x1126('0x2')]},'data2':{'type':Sequelize[_0x1126('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x1126('0x3')],'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 e242a4b..54170c9 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 _0x9417=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','apply','then','destroy','sendStatus','error','stack','send','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','merge','options','catch','update','body','find','params','get','checkLicense','demo','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9417,0xb4));var _0x7941=function(_0x309385,_0x3ab38f){_0x309385=_0x309385-0x0;var _0x45b0f5=_0x9417[_0x309385];return _0x45b0f5;};'use strict';var pdf=require(_0x7941('0x0'));var emlformat=require(_0x7941('0x1'));var rimraf=require(_0x7941('0x2'));var zipdir=require(_0x7941('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7941('0x4'));var moment=require(_0x7941('0x5'));var BPromise=require(_0x7941('0x6'));var Mustache=require(_0x7941('0x7'));var util=require(_0x7941('0x8'));var path=require(_0x7941('0x9'));var sox=require(_0x7941('0xa'));var csv=require(_0x7941('0xb'));var ejs=require(_0x7941('0xc'));var fs=require('fs');var _=require(_0x7941('0xd'));var squel=require('squel');var crypto=require(_0x7941('0xe'));var jsforce=require(_0x7941('0xf'));var deskjs=require(_0x7941('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7941('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7941('0x12'));var qs=require(_0x7941('0x13'));var as=require(_0x7941('0x14'));var hardwareService=require(_0x7941('0x15'));var logger=require(_0x7941('0x16'))(_0x7941('0x17'));var utils=require(_0x7941('0x18'));var config=require(_0x7941('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7941('0x1a'))['db'];function respondWithStatusCode(_0x51aab8,_0x12b674){_0x12b674=_0x12b674||0xcc;return function(_0x46a86a){if(_0x46a86a){return _0x51aab8['sendStatus'](_0x12b674);}return _0x51aab8['status'](_0x12b674)[_0x7941('0x1b')]();};}function respondWithResult(_0x59f371,_0x18936d){_0x18936d=_0x18936d||0xc8;return function(_0x45c08f){if(_0x45c08f){return _0x59f371[_0x7941('0x1c')](_0x18936d)[_0x7941('0x1d')](_0x45c08f);}};}function respondWithFilteredResult(_0x1da410,_0x41b098){return function(_0x55320b){if(_0x55320b){var _0x11623c=_0x55320b[_0x7941('0x1e')],_0x459430=_0x41b098[_0x7941('0x1f')],_0x1c9e1b=_0x41b098[_0x7941('0x1f')]+_0x41b098[_0x7941('0x20')],_0x22dc49;if(_0x1c9e1b>=_0x11623c){_0x1c9e1b=_0x11623c;_0x22dc49=0xc8;}else{_0x22dc49=0xce;}_0x1da410[_0x7941('0x1c')](_0x22dc49);return _0x1da410['set']('Content-Range',_0x459430+'-'+_0x1c9e1b+'/'+_0x11623c)[_0x7941('0x1d')](_0x55320b);}return null;};}function patchUpdates(_0x570ec7){return function(_0x17442f){try{jsonpatch[_0x7941('0x21')](_0x17442f,_0x570ec7,!![]);}catch(_0xc228f1){return BPromise['reject'](_0xc228f1);}return _0x17442f['save']();};}function saveUpdates(_0x645e4c,_0x4d3b28){return function(_0x7ba1b0){if(_0x7ba1b0){return _0x7ba1b0['update'](_0x645e4c)[_0x7941('0x22')](function(_0x372df6){return _0x372df6;});}return null;};}function removeEntity(_0x42ff1f,_0x45ae78){return function(_0x3c2ae5){if(_0x3c2ae5){return _0x3c2ae5[_0x7941('0x23')]()[_0x7941('0x22')](function(){_0x42ff1f['status'](0xcc)[_0x7941('0x1b')]();});}};}function handleEntityNotFound(_0x531f20,_0x36ff77){return function(_0x26378f){if(!_0x26378f){_0x531f20[_0x7941('0x24')](0x194);}return _0x26378f;};}function handleError(_0x1b8a27,_0x5824e1){_0x5824e1=_0x5824e1||0x1f4;return function(_0x55f679){logger[_0x7941('0x25')](_0x55f679[_0x7941('0x26')]);if(_0x55f679['name']){delete _0x55f679['name'];}_0x1b8a27[_0x7941('0x1c')](_0x5824e1)[_0x7941('0x27')](_0x55f679);};}var utilLicense=require(_0x7941('0x28'));exports[_0x7941('0x29')]=function(_0x189f83,_0x4a414a){var _0x3f3d89={'raw':!![],'where':{'id':0x1}},_0x1f5de6={};_0x1f5de6[_0x7941('0x2a')]=_[_0x7941('0x2b')](db[_0x7941('0x2c')][_0x7941('0x2d')]);_0x1f5de6[_0x7941('0x2e')]=_['keys'](_0x189f83[_0x7941('0x2e')]);_0x1f5de6[_0x7941('0x2f')]=_[_0x7941('0x30')](_0x1f5de6['model'],_0x1f5de6[_0x7941('0x2e')]);_0x3f3d89['attributes']=_[_0x7941('0x30')](_0x1f5de6[_0x7941('0x2a')],qs[_0x7941('0x31')](_0x189f83['query'][_0x7941('0x31')]));_0x3f3d89[_0x7941('0x32')]=_0x3f3d89['attributes'][_0x7941('0x33')]?_0x3f3d89[_0x7941('0x32')]:_0x1f5de6['model'];_0x3f3d89=_[_0x7941('0x34')]({},_0x3f3d89,_0x189f83[_0x7941('0x35')]);return utilLicense['getLicense'](_0x3f3d89)[_0x7941('0x22')](respondWithResult(_0x4a414a,null))[_0x7941('0x36')](handleError(_0x4a414a,null));};exports[_0x7941('0x37')]=function(_0x3592d9,_0x2a18e2){if(_0x3592d9[_0x7941('0x38')]['id']){delete _0x3592d9[_0x7941('0x38')]['id'];}return db['License'][_0x7941('0x39')]({'where':{'id':_0x3592d9[_0x7941('0x3a')]['id']}})['then'](handleEntityNotFound(_0x2a18e2,null))[_0x7941('0x22')](function(_0x1375c5){var _0x26014a=_0x1375c5[_0x7941('0x3b')]({'plain':!![]});return utilLicense[_0x7941('0x3c')](_0x26014a,_0x3592d9[_0x7941('0x38')]['key']);})[_0x7941('0x22')](function(_0xc235d6){if(!_0xc235d6[_0x7941('0x3d')]){return saveUpdates(_0x3592d9[_0x7941('0x38')],null);}return _0xc235d6;})[_0x7941('0x22')](respondWithResult(_0x2a18e2,null))[_0x7941('0x36')](handleError(_0x2a18e2,null));}; \ No newline at end of file +var _0x6b4e=['json','count','status','apply','reject','save','then','destroy','stack','name','send','index','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','update','body','find','params','get','key','demo','eml-format','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x6b4e,0x1a8));var _0xe6b4=function(_0x3fd074,_0x24c281){_0x3fd074=_0x3fd074-0x0;var _0xe823eb=_0x6b4e[_0x3fd074];return _0xe823eb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe6b4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe6b4('0x1'));var BPromise=require(_0xe6b4('0x2'));var Mustache=require(_0xe6b4('0x3'));var util=require(_0xe6b4('0x4'));var path=require(_0xe6b4('0x5'));var sox=require(_0xe6b4('0x6'));var csv=require('to-csv');var ejs=require(_0xe6b4('0x7'));var fs=require('fs');var _=require(_0xe6b4('0x8'));var squel=require(_0xe6b4('0x9'));var crypto=require(_0xe6b4('0xa'));var jsforce=require(_0xe6b4('0xb'));var deskjs=require(_0xe6b4('0xc'));var toCsv=require(_0xe6b4('0xd'));var querystring=require(_0xe6b4('0xe'));var Papa=require(_0xe6b4('0xf'));var Redis=require(_0xe6b4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe6b4('0x11'));var as=require(_0xe6b4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe6b4('0x13'));var config=require(_0xe6b4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe6b4('0x15'))['db'];function respondWithStatusCode(_0x102306,_0x19fe43){_0x19fe43=_0x19fe43||0xcc;return function(_0x21ae59){if(_0x21ae59){return _0x102306[_0xe6b4('0x16')](_0x19fe43);}return _0x102306['status'](_0x19fe43)[_0xe6b4('0x17')]();};}function respondWithResult(_0x184353,_0x67ad14){_0x67ad14=_0x67ad14||0xc8;return function(_0x21ab5b){if(_0x21ab5b){return _0x184353['status'](_0x67ad14)[_0xe6b4('0x18')](_0x21ab5b);}};}function respondWithFilteredResult(_0x2022ca,_0x2e3eff){return function(_0x42876a){if(_0x42876a){var _0x25ad62=_0x42876a[_0xe6b4('0x19')],_0x5ec51c=_0x2e3eff['offset'],_0x3a64a5=_0x2e3eff['offset']+_0x2e3eff['limit'],_0x2c9335;if(_0x3a64a5>=_0x25ad62){_0x3a64a5=_0x25ad62;_0x2c9335=0xc8;}else{_0x2c9335=0xce;}_0x2022ca[_0xe6b4('0x1a')](_0x2c9335);return _0x2022ca['set']('Content-Range',_0x5ec51c+'-'+_0x3a64a5+'/'+_0x25ad62)[_0xe6b4('0x18')](_0x42876a);}return null;};}function patchUpdates(_0x4f7996){return function(_0x200c8f){try{jsonpatch[_0xe6b4('0x1b')](_0x200c8f,_0x4f7996,!![]);}catch(_0x38fb03){return BPromise[_0xe6b4('0x1c')](_0x38fb03);}return _0x200c8f[_0xe6b4('0x1d')]();};}function saveUpdates(_0x1899b4,_0xb7127){return function(_0x1013b8){if(_0x1013b8){return _0x1013b8['update'](_0x1899b4)[_0xe6b4('0x1e')](function(_0x51123e){return _0x51123e;});}return null;};}function removeEntity(_0x44648b,_0x1121cf){return function(_0x2dc1c5){if(_0x2dc1c5){return _0x2dc1c5[_0xe6b4('0x1f')]()[_0xe6b4('0x1e')](function(){_0x44648b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52ee39,_0x415b57){return function(_0x4aa07f){if(!_0x4aa07f){_0x52ee39[_0xe6b4('0x16')](0x194);}return _0x4aa07f;};}function handleError(_0x31b451,_0x21b07c){_0x21b07c=_0x21b07c||0x1f4;return function(_0x28bfef){logger['error'](_0x28bfef[_0xe6b4('0x20')]);if(_0x28bfef[_0xe6b4('0x21')]){delete _0x28bfef[_0xe6b4('0x21')];}_0x31b451['status'](_0x21b07c)[_0xe6b4('0x22')](_0x28bfef);};}var utilLicense=require('../../config/license/util');exports[_0xe6b4('0x23')]=function(_0x45168a,_0x5a4e25){var _0x332bbd={'raw':!![],'where':{'id':0x1}},_0x31df4a={};_0x31df4a[_0xe6b4('0x24')]=_['keys'](db['License'][_0xe6b4('0x25')]);_0x31df4a[_0xe6b4('0x26')]=_[_0xe6b4('0x27')](_0x45168a[_0xe6b4('0x26')]);_0x31df4a[_0xe6b4('0x28')]=_[_0xe6b4('0x29')](_0x31df4a[_0xe6b4('0x24')],_0x31df4a[_0xe6b4('0x26')]);_0x332bbd[_0xe6b4('0x2a')]=_['intersection'](_0x31df4a['model'],qs[_0xe6b4('0x2b')](_0x45168a[_0xe6b4('0x26')]['fields']));_0x332bbd[_0xe6b4('0x2a')]=_0x332bbd[_0xe6b4('0x2a')][_0xe6b4('0x2c')]?_0x332bbd['attributes']:_0x31df4a[_0xe6b4('0x24')];_0x332bbd=_[_0xe6b4('0x2d')]({},_0x332bbd,_0x45168a[_0xe6b4('0x2e')]);return utilLicense[_0xe6b4('0x2f')](_0x332bbd)[_0xe6b4('0x1e')](respondWithResult(_0x5a4e25,null))[_0xe6b4('0x30')](handleError(_0x5a4e25,null));};exports[_0xe6b4('0x31')]=function(_0x47c1ba,_0x195cb1){if(_0x47c1ba[_0xe6b4('0x32')]['id']){delete _0x47c1ba[_0xe6b4('0x32')]['id'];}return db['License'][_0xe6b4('0x33')]({'where':{'id':_0x47c1ba[_0xe6b4('0x34')]['id']}})['then'](handleEntityNotFound(_0x195cb1,null))[_0xe6b4('0x1e')](function(_0x425b84){var _0x2b846a=_0x425b84[_0xe6b4('0x35')]({'plain':!![]});return utilLicense['checkLicense'](_0x2b846a,_0x47c1ba[_0xe6b4('0x32')][_0xe6b4('0x36')]);})[_0xe6b4('0x1e')](function(_0x5d19c7){if(!_0x5d19c7[_0xe6b4('0x37')]){return saveUpdates(_0x47c1ba['body'],null);}return _0x5d19c7;})[_0xe6b4('0x1e')](respondWithResult(_0x195cb1,null))['catch'](handleError(_0x195cb1,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 3d0cf23..5f8afb7 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 _0xd8f6=['license','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./license.attributes','exports','License'];(function(_0x4b7c45,_0x2e19a0){var _0x231c21=function(_0xefffab){while(--_0xefffab){_0x4b7c45['push'](_0x4b7c45['shift']());}};_0x231c21(++_0x2e19a0);}(_0xd8f6,0x6f));var _0x6d8f=function(_0x171883,_0x42d27f){_0x171883=_0x171883-0x0;var _0x479038=_0xd8f6[_0x171883];return _0x479038;};'use strict';var _=require(_0x6d8f('0x0'));var util=require('util');var logger=require(_0x6d8f('0x1'))('api');var moment=require(_0x6d8f('0x2'));var BPromise=require(_0x6d8f('0x3'));var rp=require(_0x6d8f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6d8f('0x5'));var config=require('../../config/environment');var attributes=require(_0x6d8f('0x6'));module[_0x6d8f('0x7')]=function(_0x3173e5,_0x3cc67d){return _0x3173e5['define'](_0x6d8f('0x8'),attributes,{'tableName':_0x6d8f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6484=['../../config/logger','api','moment','request-promise','path','../../config/environment','./license.attributes','exports','define','License','license','util'];(function(_0x128d4f,_0x47cd69){var _0x19826b=function(_0xb0bbd4){while(--_0xb0bbd4){_0x128d4f['push'](_0x128d4f['shift']());}};_0x19826b(++_0x47cd69);}(_0x6484,0x1bb));var _0x4648=function(_0x334307,_0x59264a){_0x334307=_0x334307-0x0;var _0x157333=_0x6484[_0x334307];return _0x157333;};'use strict';var _=require('lodash');var util=require(_0x4648('0x0'));var logger=require(_0x4648('0x1'))(_0x4648('0x2'));var moment=require(_0x4648('0x3'));var BPromise=require('bluebird');var rp=require(_0x4648('0x4'));var fs=require('fs');var path=require(_0x4648('0x5'));var rimraf=require('rimraf');var config=require(_0x4648('0x6'));var attributes=require(_0x4648('0x7'));module[_0x4648('0x8')]=function(_0x59a611,_0x85581e){return _0x59a611[_0x4648('0x9')](_0x4648('0xa'),attributes,{'tableName':_0x4648('0xb'),'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 78fa672..2d83d46 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 _0x153c=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','License,\x20%s,\x20%s'];(function(_0x19756f,_0x1d877b){var _0x50c664=function(_0x132343){while(--_0x132343){_0x19756f['push'](_0x19756f['shift']());}};_0x50c664(++_0x1d877b);}(_0x153c,0x8c));var _0xc153=function(_0x479db6,_0x368f1f){_0x479db6=_0x479db6-0x0;var _0x3d5d91=_0x153c[_0x479db6];return _0x3d5d91;};'use strict';var _=require(_0xc153('0x0'));var util=require(_0xc153('0x1'));var moment=require(_0xc153('0x2'));var BPromise=require(_0xc153('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc153('0x4'));var db=require(_0xc153('0x5'))['db'];var utils=require(_0xc153('0x6'));var logger=require(_0xc153('0x7'))(_0xc153('0x8'));var config=require(_0xc153('0x9'));var jayson=require(_0xc153('0xa'));var client=jayson['client'][_0xc153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46a8b7,_0x38e0f8,_0x2144b){return new BPromise(function(_0x374a0c,_0x5a844b){return client['request'](_0x46a8b7,_0x2144b)['then'](function(_0x3843d3){logger[_0xc153('0xc')](_0xc153('0xd'),_0x38e0f8,_0xc153('0xe'));logger[_0xc153('0xf')]('License,\x20%s,\x20%s,\x20%s',_0x38e0f8,'request\x20sent',JSON[_0xc153('0x10')](_0x3843d3));if(_0x3843d3[_0xc153('0x11')]){if(_0x3843d3['error'][_0xc153('0x12')]===0x1f4){logger[_0xc153('0x11')]('License,\x20%s,\x20%s',_0x38e0f8,_0x3843d3['error'][_0xc153('0x13')]);return _0x5a844b(_0x3843d3[_0xc153('0x11')][_0xc153('0x13')]);}logger['error'](_0xc153('0xd'),_0x38e0f8,_0x3843d3[_0xc153('0x11')][_0xc153('0x13')]);return _0x374a0c(_0x3843d3['error'][_0xc153('0x13')]);}else{logger[_0xc153('0xc')]('License,\x20%s,\x20%s',_0x38e0f8,'request\x20sent');_0x374a0c(_0x3843d3[_0xc153('0x14')][_0xc153('0x13')]);}})[_0xc153('0x15')](function(_0x373a99){logger[_0xc153('0x11')](_0xc153('0xd'),_0x38e0f8,_0x373a99);_0x5a844b(_0x373a99);});});} \ No newline at end of file +var _0xfbe2=['jayson/promise','client','http','request','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0xbcde1a,_0x221ea8){var _0x30edcc=function(_0x38b8dc){while(--_0x38b8dc){_0xbcde1a['push'](_0xbcde1a['shift']());}};_0x30edcc(++_0x221ea8);}(_0xfbe2,0x1da));var _0x2fbe=function(_0x301785,_0x506056){_0x301785=_0x301785-0x0;var _0x4ea53b=_0xfbe2[_0x301785];return _0x4ea53b;};'use strict';var _=require(_0x2fbe('0x0'));var util=require(_0x2fbe('0x1'));var moment=require(_0x2fbe('0x2'));var BPromise=require(_0x2fbe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2fbe('0x4'));var db=require(_0x2fbe('0x5'))['db'];var utils=require(_0x2fbe('0x6'));var logger=require('../../config/logger')(_0x2fbe('0x7'));var config=require(_0x2fbe('0x8'));var jayson=require(_0x2fbe('0x9'));var client=jayson[_0x2fbe('0xa')][_0x2fbe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x221c08,_0x1f3340,_0x31f5da){return new BPromise(function(_0x1cd992,_0x1c32e9){return client[_0x2fbe('0xc')](_0x221c08,_0x31f5da)['then'](function(_0x4cf8b8){logger[_0x2fbe('0xd')](_0x2fbe('0xe'),_0x1f3340,_0x2fbe('0xf'));logger[_0x2fbe('0x10')](_0x2fbe('0x11'),_0x1f3340,_0x2fbe('0xf'),JSON[_0x2fbe('0x12')](_0x4cf8b8));if(_0x4cf8b8[_0x2fbe('0x13')]){if(_0x4cf8b8[_0x2fbe('0x13')][_0x2fbe('0x14')]===0x1f4){logger[_0x2fbe('0x13')](_0x2fbe('0xe'),_0x1f3340,_0x4cf8b8[_0x2fbe('0x13')][_0x2fbe('0x15')]);return _0x1c32e9(_0x4cf8b8['error'][_0x2fbe('0x15')]);}logger[_0x2fbe('0x13')](_0x2fbe('0xe'),_0x1f3340,_0x4cf8b8[_0x2fbe('0x13')][_0x2fbe('0x15')]);return _0x1cd992(_0x4cf8b8[_0x2fbe('0x13')]['message']);}else{logger[_0x2fbe('0xd')](_0x2fbe('0xe'),_0x1f3340,'request\x20sent');_0x1cd992(_0x4cf8b8[_0x2fbe('0x16')]['message']);}})['catch'](function(_0x33466c){logger[_0x2fbe('0x13')](_0x2fbe('0xe'),_0x1f3340,_0x33466c);_0x1c32e9(_0x33466c);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 848726c..1986e47 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 _0x5a5a=['../../components/interaction/service','../../config/environment','./mailAccount.controller','index','get','isAuthenticated','describe','/:id','/: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','verifySmtp','/:id/users','getAgents','addDisposition','post','create','addImap','addSmtp','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeImap','removeSmtp','removeAgents','exports','util','path','connect-timeout','express','Router'];(function(_0x33050f,_0x5ea673){var _0x45e2bd=function(_0x564c50){while(--_0x564c50){_0x33050f['push'](_0x33050f['shift']());}};_0x45e2bd(++_0x5ea673);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x284bb4,_0x598e6c){_0x284bb4=_0x284bb4-0x0;var _0x574d5b=_0x5a5a[_0x284bb4];return _0x574d5b;};'use strict';var multer=require('multer');var util=require(_0xa5a5('0x0'));var path=require(_0xa5a5('0x1'));var timeout=require(_0xa5a5('0x2'));var express=require(_0xa5a5('0x3'));var router=express[_0xa5a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa5a5('0x5'));var config=require(_0xa5a5('0x6'));var controller=require(_0xa5a5('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa5a5('0x8')]);router[_0xa5a5('0x9')]('/describe',auth[_0xa5a5('0xa')](),controller[_0xa5a5('0xb')]);router[_0xa5a5('0x9')](_0xa5a5('0xc'),auth[_0xa5a5('0xa')](),controller['show']);router[_0xa5a5('0x9')](_0xa5a5('0xd'),auth[_0xa5a5('0xa')](),controller[_0xa5a5('0xe')]);router[_0xa5a5('0x9')](_0xa5a5('0xf'),auth[_0xa5a5('0xa')](),controller[_0xa5a5('0x10')]);router[_0xa5a5('0x9')](_0xa5a5('0x11'),auth[_0xa5a5('0xa')](),controller[_0xa5a5('0x12')]);router['get'](_0xa5a5('0x13'),auth[_0xa5a5('0xa')](),controller[_0xa5a5('0x14')]);router[_0xa5a5('0x9')](_0xa5a5('0x15'),auth[_0xa5a5('0xa')](),controller['getInteractions']);router[_0xa5a5('0x9')](_0xa5a5('0x16'),auth[_0xa5a5('0xa')](),controller[_0xa5a5('0x17')]);router[_0xa5a5('0x9')](_0xa5a5('0x18'),auth[_0xa5a5('0xa')](),controller[_0xa5a5('0x19')]);router['get'](_0xa5a5('0x1a'),auth[_0xa5a5('0xa')](),controller[_0xa5a5('0x1b')]);router[_0xa5a5('0x9')](_0xa5a5('0x1c'),auth[_0xa5a5('0xa')](),controller[_0xa5a5('0x1d')]);router['post'](_0xa5a5('0xd'),auth[_0xa5a5('0xa')](),controller[_0xa5a5('0x1e')]);router[_0xa5a5('0x1f')]('/:id/canned_answers',auth[_0xa5a5('0xa')](),controller['addAnswer']);router[_0xa5a5('0x1f')]('/',auth[_0xa5a5('0xa')](),controller[_0xa5a5('0x20')]);router[_0xa5a5('0x1f')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xa5a5('0x21')]);router[_0xa5a5('0x1f')](_0xa5a5('0x13'),auth['isAuthenticated'](),controller[_0xa5a5('0x22')]);router['post'](_0xa5a5('0x15'),auth['isAuthenticated'](),controller['addInteraction']);router[_0xa5a5('0x1f')](_0xa5a5('0x16'),auth[_0xa5a5('0xa')](),controller[_0xa5a5('0x23')]);router['post'](_0xa5a5('0x24'),auth['isAuthenticated'](),controller[_0xa5a5('0x25')]);router[_0xa5a5('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0xa5a5('0x26')]);router[_0xa5a5('0x27')]('/:id',auth['isAuthenticated'](),controller[_0xa5a5('0x28')]);router[_0xa5a5('0x29')](_0xa5a5('0xd'),auth[_0xa5a5('0xa')](),controller[_0xa5a5('0x2a')]);router[_0xa5a5('0x29')]('/:id/canned_answers',auth[_0xa5a5('0xa')](),controller['removeAnswers']);router[_0xa5a5('0x29')]('/:id/in_servers',auth[_0xa5a5('0xa')](),controller[_0xa5a5('0x2b')]);router['delete']('/:id/out_servers',auth['isAuthenticated'](),controller[_0xa5a5('0x2c')]);router['delete'](_0xa5a5('0xc'),auth[_0xa5a5('0xa')](),controller['destroy']);router[_0xa5a5('0x29')](_0xa5a5('0x1c'),auth['isAuthenticated'](),controller[_0xa5a5('0x2d')]);module[_0xa5a5('0x2e')]=router; \ No newline at end of file +var _0xed1f=['util','express','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/canned_answers','/:id/in_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/verify','getAgents','post','/:id/dispositions','addDisposition','create','addImap','/:id/out_servers','addInteraction','addApplications','send','/:id/users','addAgents','/:id','update','removeDispositions','delete','removeImap','removeSmtp','removeAgents','exports','multer'];(function(_0x259c8c,_0x2e76cf){var _0x5f49f3=function(_0xbead04){while(--_0xbead04){_0x259c8c['push'](_0x259c8c['shift']());}};_0x5f49f3(++_0x2e76cf);}(_0xed1f,0x170));var _0xfed1=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xed1f[_0x580647];return _0x5f0792;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfed1('0x2'));var router=express['Router']();var auth=require(_0xfed1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfed1('0x4'));var controller=require(_0xfed1('0x5'));router[_0xfed1('0x6')]('/',auth[_0xfed1('0x7')](),controller[_0xfed1('0x8')]);router[_0xfed1('0x6')](_0xfed1('0x9'),auth[_0xfed1('0x7')](),controller[_0xfed1('0xa')]);router[_0xfed1('0x6')]('/:id',auth[_0xfed1('0x7')](),controller[_0xfed1('0xb')]);router[_0xfed1('0x6')]('/:id/dispositions',auth[_0xfed1('0x7')](),controller['getDispositions']);router['get'](_0xfed1('0xc'),auth[_0xfed1('0x7')](),controller['getAnswers']);router['get'](_0xfed1('0xd'),auth[_0xfed1('0x7')](),controller['getImap']);router[_0xfed1('0x6')]('/:id/out_servers',auth[_0xfed1('0x7')](),controller[_0xfed1('0xe')]);router[_0xfed1('0x6')](_0xfed1('0xf'),auth['isAuthenticated'](),controller[_0xfed1('0x10')]);router[_0xfed1('0x6')]('/:id/applications',auth['isAuthenticated'](),controller[_0xfed1('0x11')]);router[_0xfed1('0x6')](_0xfed1('0x12'),auth['isAuthenticated'](),controller[_0xfed1('0x13')]);router[_0xfed1('0x6')](_0xfed1('0x14'),auth[_0xfed1('0x7')](),controller['verifySmtp']);router[_0xfed1('0x6')]('/:id/users',auth[_0xfed1('0x7')](),controller[_0xfed1('0x15')]);router[_0xfed1('0x16')](_0xfed1('0x17'),auth[_0xfed1('0x7')](),controller[_0xfed1('0x18')]);router[_0xfed1('0x16')](_0xfed1('0xc'),auth[_0xfed1('0x7')](),controller['addAnswer']);router[_0xfed1('0x16')]('/',auth['isAuthenticated'](),controller[_0xfed1('0x19')]);router[_0xfed1('0x16')](_0xfed1('0xd'),auth[_0xfed1('0x7')](),controller[_0xfed1('0x1a')]);router[_0xfed1('0x16')](_0xfed1('0x1b'),auth[_0xfed1('0x7')](),controller['addSmtp']);router['post'](_0xfed1('0xf'),auth['isAuthenticated'](),controller[_0xfed1('0x1c')]);router[_0xfed1('0x16')]('/:id/applications',auth[_0xfed1('0x7')](),controller[_0xfed1('0x1d')]);router[_0xfed1('0x16')]('/:id/send',auth[_0xfed1('0x7')](),controller[_0xfed1('0x1e')]);router['post'](_0xfed1('0x1f'),auth[_0xfed1('0x7')](),controller[_0xfed1('0x20')]);router['put'](_0xfed1('0x21'),auth[_0xfed1('0x7')](),controller[_0xfed1('0x22')]);router['delete'](_0xfed1('0x17'),auth[_0xfed1('0x7')](),controller[_0xfed1('0x23')]);router[_0xfed1('0x24')](_0xfed1('0xc'),auth[_0xfed1('0x7')](),controller['removeAnswers']);router[_0xfed1('0x24')](_0xfed1('0xd'),auth['isAuthenticated'](),controller[_0xfed1('0x25')]);router[_0xfed1('0x24')](_0xfed1('0x1b'),auth['isAuthenticated'](),controller[_0xfed1('0x26')]);router[_0xfed1('0x24')](_0xfed1('0x21'),auth[_0xfed1('0x7')](),controller['destroy']);router[_0xfed1('0x24')](_0xfed1('0x1f'),auth[_0xfed1('0x7')](),controller[_0xfed1('0x27')]);module[_0xfed1('0x28')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 036d770..6c9f4f6 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 _0x028a=['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}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT'];(function(_0x21f13a,_0x5521ab){var _0x2005cd=function(_0x2f603e){while(--_0x2f603e){_0x21f13a['push'](_0x21f13a['shift']());}};_0x2005cd(++_0x5521ab);}(_0x028a,0x70));var _0xa028=function(_0xccc2c0,_0x5676be){_0xccc2c0=_0xccc2c0-0x0;var _0x320bb9=_0x028a[_0xccc2c0];return _0x320bb9;};'use strict';var Sequelize=require(_0xa028('0x0'));module[_0xa028('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xa028('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xa028('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xa028('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xa028('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xa028('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xa028('0x4')]},'markAsUnread':{'type':Sequelize[_0xa028('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xa028('0x2')],'allowNull':![],'defaultValue':_0xa028('0x5')},'fontSize':{'type':Sequelize[_0xa028('0x6')](0x2)[_0xa028('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xa028('0x4')],'defaultValue':function(){return _0xa028('0x8');}},'notificationSound':{'type':Sequelize[_0xa028('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa028('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa028('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa028('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa028('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa028('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa028('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xa028('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xa028('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x22e1ec){if(!_0x22e1ec)this[_0xa028('0xa')](_0xa028('0xb'),null);this[_0xa028('0xa')](_0xa028('0xc'),_0x22e1ec);}}}; \ No newline at end of file +var _0x472d=['sequelize','exports','STRING','TEXT','BOOLEAN','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0xb2f448,_0x126578){var _0xd56eb6=function(_0x4e5a02){while(--_0x4e5a02){_0xb2f448['push'](_0xb2f448['shift']());}};_0xd56eb6(++_0x126578);}(_0x472d,0x90));var _0xd472=function(_0x1ddd50,_0x53ba65){_0x1ddd50=_0x1ddd50-0x0;var _0x3d84bd=_0x472d[_0x1ddd50];return _0x3d84bd;};'use strict';var Sequelize=require(_0xd472('0x0'));module[_0xd472('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xd472('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xd472('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xd472('0x3')]},'markAsUnread':{'type':Sequelize[_0xd472('0x4')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xd472('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xd472('0x5')](0x2)[_0xd472('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xd472('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xd472('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd472('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd472('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd472('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd472('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd472('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xd472('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xd472('0x8'),'set':function(_0x3fc746){if(!_0x3fc746)this[_0xd472('0x9')](_0xd472('0xa'),null);this[_0xd472('0x9')](_0xd472('0xb'),_0x3fc746);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 994da04..7875202 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 _0xcfea=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','findOne','removeImap','setImap','getSmtp','addSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','User','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','List','Contacts','updatedAt','from','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','defaults','ListId','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','destroy','get','MailAccounts','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','options','count','includeAll','findAll','rows','params','include','find','body','update','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','filter','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','email','isNil','active','description','cservice','cauthentication','user','cuser','cpassword','authentication','host','port','service','password','pass'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xcfea,0x109));var _0xacfe=function(_0x2b4a41,_0x273f6d){_0x2b4a41=_0x2b4a41-0x0;var _0x224320=_0xcfea[_0x2b4a41];return _0x224320;};'use strict';var pdf=require(_0xacfe('0x0'));var emlformat=require(_0xacfe('0x1'));var rimraf=require(_0xacfe('0x2'));var zipdir=require(_0xacfe('0x3'));var jsonpatch=require(_0xacfe('0x4'));var rp=require(_0xacfe('0x5'));var moment=require(_0xacfe('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xacfe('0x7'));var util=require('util');var path=require(_0xacfe('0x8'));var sox=require(_0xacfe('0x9'));var csv=require(_0xacfe('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xacfe('0xb'));var squel=require(_0xacfe('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xacfe('0xa'));var querystring=require('querystring');var Papa=require(_0xacfe('0xd'));var htmlToText=require(_0xacfe('0xe'));var juice=require(_0xacfe('0xf'));var Redis=require(_0xacfe('0x10'));var authService=require(_0xacfe('0x11'));var qs=require(_0xacfe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xacfe('0x13'));var logger=require('../../config/logger')(_0xacfe('0x14'));var utils=require(_0xacfe('0x15'));var config=require(_0xacfe('0x16'));var licenseUtil=require(_0xacfe('0x17'));var db=require('../../mysqldb')['db'];config[_0xacfe('0x18')]=_['defaults'](config['redis'],{'host':_0xacfe('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xacfe('0x18')]));require('./mailAccount.socket')[_0xacfe('0x1a')](socket);var jayson=require(_0xacfe('0x1b'));var client=jayson[_0xacfe('0x1c')][_0xacfe('0x1d')]({'port':0x232b});function respondWithRpcPromise(_0x24b41d,_0xb8ec72,_0x1d093d,_0x513437){return new BPromise(function(_0x34acf4,_0x471026){var _0x7f27d7=_0x513437||client;return _0x7f27d7[_0xacfe('0x1e')](_0x24b41d,_0x1d093d)[_0xacfe('0x1f')](function(_0x3a2790){logger[_0xacfe('0x20')](_0xacfe('0x21'),_0xb8ec72,_0xacfe('0x22'));logger[_0xacfe('0x23')](_0xacfe('0x24'),_0xb8ec72,_0xacfe('0x22'),JSON[_0xacfe('0x25')](_0x3a2790));if(_0x3a2790[_0xacfe('0x26')]){if(_0x3a2790['error']['code']===0x1f4){logger['error'](_0xacfe('0x21'),_0xb8ec72,_0x3a2790[_0xacfe('0x26')][_0xacfe('0x27')]);return _0x471026(_0x3a2790[_0xacfe('0x26')][_0xacfe('0x27')]);}logger[_0xacfe('0x26')](_0xacfe('0x21'),_0xb8ec72,_0x3a2790['error'][_0xacfe('0x27')]);return _0x34acf4(_0x3a2790['error']['message']);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0xb8ec72,'request\x20sent');_0x34acf4(_0x3a2790[_0xacfe('0x28')][_0xacfe('0x27')]);}})[_0xacfe('0x29')](function(_0x557734){logger[_0xacfe('0x26')](_0xacfe('0x21'),_0xb8ec72,_0x557734);_0x471026(_0x557734);});});}function respondWithStatusCode(_0x118c86,_0x25c1d6){_0x25c1d6=_0x25c1d6||0xcc;return function(_0x5cca55){if(_0x5cca55){return _0x118c86[_0xacfe('0x2a')](_0x25c1d6);}return _0x118c86['status'](_0x25c1d6)[_0xacfe('0x2b')]();};}function respondWithResult(_0x40b829,_0x280044){_0x280044=_0x280044||0xc8;return function(_0x346be3){if(_0x346be3){return _0x40b829[_0xacfe('0x2c')](_0x280044)[_0xacfe('0x2d')](_0x346be3);}};}function respondWithFilteredResult(_0x5769d6,_0x3c4130){return function(_0x30e6e9){if(_0x30e6e9){var _0x4fa34d=_0x30e6e9['count'],_0x1f8ee8=_0x3c4130['offset'],_0x4913af=_0x3c4130[_0xacfe('0x2e')]+_0x3c4130['limit'],_0x3c9a0b;if(_0x4913af>=_0x4fa34d){_0x4913af=_0x4fa34d;_0x3c9a0b=0xc8;}else{_0x3c9a0b=0xce;}_0x5769d6[_0xacfe('0x2c')](_0x3c9a0b);return _0x5769d6[_0xacfe('0x2f')](_0xacfe('0x30'),_0x1f8ee8+'-'+_0x4913af+'/'+_0x4fa34d)[_0xacfe('0x2d')](_0x30e6e9);}return null;};}function patchUpdates(_0x82d96f){return function(_0x280f14){try{jsonpatch[_0xacfe('0x31')](_0x280f14,_0x82d96f,!![]);}catch(_0x58be50){return BPromise[_0xacfe('0x32')](_0x58be50);}return _0x280f14['save']();};}function saveUpdates(_0x3726b2,_0x3fde48){return function(_0x21c68d){if(_0x21c68d){return _0x21c68d['update'](_0x3726b2)['then'](function(_0x165fc2){return _0x165fc2;});}return null;};}function removeEntity(_0x37e993,_0x53ae2e){return function(_0x130444){if(_0x130444){return _0x130444[_0xacfe('0x33')]()[_0xacfe('0x1f')](function(){var _0x1672f9=_0x130444[_0xacfe('0x34')]({'plain':!![]});var _0xa894c=_0xacfe('0x35');return db['UserProfileResource'][_0xacfe('0x33')]({'where':{'type':_0xa894c,'resourceId':_0x1672f9['id']}})['then'](function(){return _0x130444;});})['then'](function(){_0x37e993[_0xacfe('0x2c')](0xcc)[_0xacfe('0x2b')]();});}};}function handleEntityNotFound(_0x6ccc0d,_0x292b9e){return function(_0x2c3017){if(!_0x2c3017){_0x6ccc0d[_0xacfe('0x2a')](0x194);}return _0x2c3017;};}function handleError(_0x134fc2,_0x358a6d){_0x358a6d=_0x358a6d||0x1f4;return function(_0x500067){logger[_0xacfe('0x26')](_0x500067[_0xacfe('0x36')]);if(_0x500067['name']){delete _0x500067[_0xacfe('0x37')];}_0x134fc2[_0xacfe('0x2c')](_0x358a6d)[_0xacfe('0x38')](_0x500067);};}exports[_0xacfe('0x39')]=function(_0x2ab006,_0x4de672){var _0x14cf21={'include':[{'model':db[_0xacfe('0x3a')],'as':_0xacfe('0x3b')},{'model':db[_0xacfe('0x3c')],'as':_0xacfe('0x3d')},{'model':db[_0xacfe('0x3e')],'as':_0xacfe('0x3f')}]},_0x10c2a0={},_0x4b3652={'count':0x0,'rows':[]};var _0x26930a=_[_0xacfe('0x40')](db[_0xacfe('0x41')][_0xacfe('0x42')],function(_0x33ea3d){return{'name':_0x33ea3d[_0xacfe('0x43')],'type':_0x33ea3d[_0xacfe('0x44')][_0xacfe('0x45')]};});_0x10c2a0[_0xacfe('0x46')]=_[_0xacfe('0x40')](_0x26930a,_0xacfe('0x37'));_0x10c2a0[_0xacfe('0x47')]=_[_0xacfe('0x48')](_0x2ab006['query']);_0x10c2a0[_0xacfe('0x49')]=_[_0xacfe('0x4a')](_0x10c2a0['model'],_0x10c2a0[_0xacfe('0x47')]);_0x14cf21[_0xacfe('0x4b')]=_['intersection'](_0x10c2a0[_0xacfe('0x46')],qs[_0xacfe('0x4c')](_0x2ab006[_0xacfe('0x47')][_0xacfe('0x4c')]));_0x14cf21[_0xacfe('0x4b')]=_0x14cf21[_0xacfe('0x4b')][_0xacfe('0x4d')]?_0x14cf21[_0xacfe('0x4b')]:_0x10c2a0[_0xacfe('0x46')];if(!_0x2ab006[_0xacfe('0x47')][_0xacfe('0x4e')](_0xacfe('0x4f'))){_0x14cf21[_0xacfe('0x50')]=qs['limit'](_0x2ab006[_0xacfe('0x47')]['limit']);_0x14cf21[_0xacfe('0x2e')]=qs[_0xacfe('0x2e')](_0x2ab006[_0xacfe('0x47')]['offset']);}_0x14cf21[_0xacfe('0x51')]=qs[_0xacfe('0x52')](_0x2ab006['query'][_0xacfe('0x52')]);_0x14cf21['where']=qs[_0xacfe('0x49')](_[_0xacfe('0x53')](_0x2ab006[_0xacfe('0x47')],_0x10c2a0[_0xacfe('0x49')]),_0x26930a);if(_0x2ab006[_0xacfe('0x47')]['filter']){_0x14cf21[_0xacfe('0x54')]=_[_0xacfe('0x55')](_0x14cf21[_0xacfe('0x54')],{'$or':_[_0xacfe('0x40')](_0x26930a,function(_0x2fea3b){if(_0x2fea3b[_0xacfe('0x44')]!=='VIRTUAL'){var _0x44c3bc={};_0x44c3bc[_0x2fea3b[_0xacfe('0x37')]]={'$like':'%'+_0x2ab006[_0xacfe('0x47')]['filter']+'%'};return _0x44c3bc;}})});}_0x14cf21=_[_0xacfe('0x55')]({},_0x14cf21,_0x2ab006[_0xacfe('0x56')]);var _0x1c11d2={'where':_0x14cf21['where']};return db['MailAccount']['count'](_0x1c11d2)[_0xacfe('0x1f')](function(_0x48da00){_0x4b3652[_0xacfe('0x57')]=_0x48da00;if(_0x2ab006['query'][_0xacfe('0x58')]){_0x14cf21['include']=[{'all':!![]}];}return db[_0xacfe('0x41')][_0xacfe('0x59')](_0x14cf21);})['then'](function(_0x3e5a6b){_0x4b3652[_0xacfe('0x5a')]=_0x3e5a6b;return _0x4b3652;})[_0xacfe('0x1f')](respondWithFilteredResult(_0x4de672,_0x14cf21))['catch'](handleError(_0x4de672,null));};exports['show']=function(_0xf94d32,_0x2f84b2){var _0x185a55={'raw':![],'where':{'id':_0xf94d32[_0xacfe('0x5b')]['id']},'include':[{'model':db[_0xacfe('0x3a')],'as':_0xacfe('0x3b')},{'model':db[_0xacfe('0x3c')],'as':_0xacfe('0x3d')},{'model':db[_0xacfe('0x3e')],'as':_0xacfe('0x3f')}]},_0x52bb1c={};_0x52bb1c['model']=_['keys'](db[_0xacfe('0x41')][_0xacfe('0x42')]);_0x52bb1c[_0xacfe('0x47')]=_[_0xacfe('0x48')](_0xf94d32[_0xacfe('0x47')]);_0x52bb1c['filters']=_[_0xacfe('0x4a')](_0x52bb1c[_0xacfe('0x46')],_0x52bb1c[_0xacfe('0x47')]);_0x185a55['attributes']=_[_0xacfe('0x4a')](_0x52bb1c[_0xacfe('0x46')],qs[_0xacfe('0x4c')](_0xf94d32['query'][_0xacfe('0x4c')]));_0x185a55['attributes']=_0x185a55[_0xacfe('0x4b')]['length']?_0x185a55[_0xacfe('0x4b')]:_0x52bb1c[_0xacfe('0x46')];if(_0xf94d32[_0xacfe('0x47')][_0xacfe('0x58')]){_0x185a55[_0xacfe('0x5c')]=[{'all':!![]}];}_0x185a55=_[_0xacfe('0x55')]({},_0x185a55,_0xf94d32['options']);return db['MailAccount'][_0xacfe('0x5d')](_0x185a55)['then'](handleEntityNotFound(_0x2f84b2,null))[_0xacfe('0x1f')](respondWithResult(_0x2f84b2,null))[_0xacfe('0x29')](handleError(_0x2f84b2,null));};exports['update']=function(_0x2e5def,_0x5b6964){if(_0x2e5def[_0xacfe('0x5e')]['id']){delete _0x2e5def[_0xacfe('0x5e')]['id'];}return db[_0xacfe('0x41')]['find']({'where':{'id':_0x2e5def[_0xacfe('0x5b')]['id']},'include':[{'model':db[_0xacfe('0x3a')],'as':_0xacfe('0x3b')},{'model':db[_0xacfe('0x3c')],'as':_0xacfe('0x3d')},{'model':db[_0xacfe('0x3e')],'as':'mandatoryDispositionPause'}]})[_0xacfe('0x1f')](handleEntityNotFound(_0x5b6964,null))[_0xacfe('0x1f')](saveUpdates(_0x2e5def[_0xacfe('0x5e')],null))[_0xacfe('0x1f')](function(_0x16e829){if(_0x16e829&&_0x2e5def[_0xacfe('0x5e')][_0xacfe('0x3b')]){return db['MailServerIn'][_0xacfe('0x5f')](_0x2e5def[_0xacfe('0x5e')][_0xacfe('0x3b')],{'where':{'MailAccountId':_0x16e829['id']}})[_0xacfe('0x1f')](function(){return _0x16e829;});}return _0x16e829;})[_0xacfe('0x1f')](function(_0x534a15){if(_0x534a15&&_0x2e5def[_0xacfe('0x5e')][_0xacfe('0x3d')]){return db[_0xacfe('0x3c')]['update'](_0x2e5def['body']['Smtp'],{'where':{'MailAccountId':_0x534a15['id']}})[_0xacfe('0x1f')](function(){return _0x534a15;});}return _0x534a15;})['then'](respondWithResult(_0x5b6964,null))[_0xacfe('0x29')](handleError(_0x5b6964,null));};exports[_0xacfe('0x60')]=function(_0x373b53,_0x262908){return db[_0xacfe('0x41')]['describe']()['then'](respondWithResult(_0x262908,null))[_0xacfe('0x29')](handleError(_0x262908,null));};exports[_0xacfe('0x61')]=function(_0x546e4e,_0x44cd36,_0x43f894){if(_0x546e4e[_0xacfe('0x5e')]['id']){delete _0x546e4e['body']['id'];}return db[_0xacfe('0x41')][_0xacfe('0x5d')]({'where':{'id':_0x546e4e['params']['id']}})[_0xacfe('0x1f')](handleEntityNotFound(_0x44cd36,null))['then'](function(_0x16c168){if(_0x16c168){_0x546e4e[_0xacfe('0x5e')][_0xacfe('0x62')]=_0x16c168['id'];return db[_0xacfe('0x63')][_0xacfe('0x64')](_0x546e4e[_0xacfe('0x5e')]);}})[_0xacfe('0x1f')](respondWithResult(_0x44cd36,null))[_0xacfe('0x29')](handleError(_0x44cd36,null));};exports[_0xacfe('0x65')]=function(_0x5d8098,_0x4e600f,_0x40e025){var _0x5305e4={'raw':![],'where':{}};var _0x1e0c65={};var _0x406ef5={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x5d8098[_0xacfe('0x5b')]['id']}})[_0xacfe('0x1f')](handleEntityNotFound(_0x4e600f,null))[_0xacfe('0x1f')](function(_0xdc4b24){if(_0xdc4b24){_0x1e0c65[_0xacfe('0x46')]=_[_0xacfe('0x48')](db[_0xacfe('0x63')][_0xacfe('0x42')]);_0x1e0c65[_0xacfe('0x47')]=_[_0xacfe('0x48')](_0x5d8098[_0xacfe('0x47')]);_0x1e0c65[_0xacfe('0x49')]=_[_0xacfe('0x4a')](_0x1e0c65[_0xacfe('0x46')],_0x1e0c65[_0xacfe('0x47')]);_0x5305e4[_0xacfe('0x4b')]=_[_0xacfe('0x4a')](_0x1e0c65['model'],qs[_0xacfe('0x4c')](_0x5d8098[_0xacfe('0x47')][_0xacfe('0x4c')]));_0x5305e4[_0xacfe('0x4b')]=_0x5305e4[_0xacfe('0x4b')]['length']?_0x5305e4['attributes']:_0x1e0c65[_0xacfe('0x46')];if(!_0x5d8098[_0xacfe('0x47')][_0xacfe('0x4e')](_0xacfe('0x4f'))){_0x5305e4['limit']=qs[_0xacfe('0x50')](_0x5d8098[_0xacfe('0x47')][_0xacfe('0x50')]);_0x5305e4[_0xacfe('0x2e')]=qs[_0xacfe('0x2e')](_0x5d8098['query'][_0xacfe('0x2e')]);}_0x5305e4[_0xacfe('0x51')]=qs[_0xacfe('0x52')](_0x5d8098[_0xacfe('0x47')][_0xacfe('0x52')]);_0x5305e4[_0xacfe('0x54')]=qs['filters'](_[_0xacfe('0x53')](_0x5d8098[_0xacfe('0x47')],_0x1e0c65['filters']));_0x5305e4[_0xacfe('0x54')]['MailAccountId']=_0xdc4b24['id'];if(_0x5d8098[_0xacfe('0x47')][_0xacfe('0x66')]){_0x5305e4[_0xacfe('0x54')]=_[_0xacfe('0x55')](_0x5305e4[_0xacfe('0x54')],{'$or':_[_0xacfe('0x40')](_0x5305e4[_0xacfe('0x4b')],function(_0x25fc63){var _0x40855c={};_0x40855c[_0x25fc63]={'$like':'%'+_0x5d8098[_0xacfe('0x47')][_0xacfe('0x66')]+'%'};return _0x40855c;})});}_0x5305e4=_[_0xacfe('0x55')]({},_0x5305e4,_0x5d8098[_0xacfe('0x56')]);return db[_0xacfe('0x63')][_0xacfe('0x57')]({'where':_0x5305e4[_0xacfe('0x54')]})[_0xacfe('0x1f')](function(_0x4d1f58){_0x406ef5['count']=_0x4d1f58;if(_0x5d8098[_0xacfe('0x47')][_0xacfe('0x58')]){_0x5305e4[_0xacfe('0x5c')]=[{'all':!![]}];}return db[_0xacfe('0x63')][_0xacfe('0x59')](_0x5305e4);})[_0xacfe('0x1f')](function(_0x45ad73){_0x406ef5[_0xacfe('0x5a')]=_0x45ad73;return _0x406ef5;});}})['then'](respondWithFilteredResult(_0x4e600f,_0x5305e4))['catch'](handleError(_0x4e600f,null));};exports['removeDispositions']=function(_0x29f866,_0x48ded3,_0x508356){return db[_0xacfe('0x41')][_0xacfe('0x5d')]({'where':{'id':_0x29f866[_0xacfe('0x5b')]['id']}})[_0xacfe('0x1f')](handleEntityNotFound(_0x48ded3,null))[_0xacfe('0x1f')](function(_0x3fb525){if(_0x3fb525){return _0x3fb525[_0xacfe('0x67')](_0x29f866['query']['ids']);}})[_0xacfe('0x1f')](respondWithStatusCode(_0x48ded3,null))['catch'](handleError(_0x48ded3,null));};exports['addAnswer']=function(_0x54d9e4,_0x26f26f,_0x39900b){if(_0x54d9e4['body']['id']){delete _0x54d9e4['body']['id'];}return db[_0xacfe('0x41')][_0xacfe('0x5d')]({'where':{'id':_0x54d9e4[_0xacfe('0x5b')]['id']}})[_0xacfe('0x1f')](handleEntityNotFound(_0x26f26f,null))[_0xacfe('0x1f')](function(_0x406859){if(_0x406859){_0x54d9e4['body'][_0xacfe('0x62')]=_0x406859['id'];return db[_0xacfe('0x68')]['create'](_0x54d9e4[_0xacfe('0x5e')]);}})[_0xacfe('0x1f')](respondWithResult(_0x26f26f,null))['catch'](handleError(_0x26f26f,null));};exports[_0xacfe('0x69')]=function(_0x12fa8c,_0x499649,_0x548878){var _0x4d27af={'raw':![],'where':{}};var _0x168c2f={};var _0x2a5390={'count':0x0,'rows':[]};return db[_0xacfe('0x41')]['findOne']({'where':{'id':_0x12fa8c['params']['id']}})[_0xacfe('0x1f')](handleEntityNotFound(_0x499649,null))[_0xacfe('0x1f')](function(_0x1885db){if(_0x1885db){_0x168c2f[_0xacfe('0x46')]=_[_0xacfe('0x48')](db[_0xacfe('0x68')][_0xacfe('0x42')]);_0x168c2f[_0xacfe('0x47')]=_[_0xacfe('0x48')](_0x12fa8c[_0xacfe('0x47')]);_0x168c2f[_0xacfe('0x49')]=_['intersection'](_0x168c2f['model'],_0x168c2f[_0xacfe('0x47')]);_0x4d27af[_0xacfe('0x4b')]=_[_0xacfe('0x4a')](_0x168c2f[_0xacfe('0x46')],qs[_0xacfe('0x4c')](_0x12fa8c[_0xacfe('0x47')][_0xacfe('0x4c')]));_0x4d27af[_0xacfe('0x4b')]=_0x4d27af[_0xacfe('0x4b')][_0xacfe('0x4d')]?_0x4d27af[_0xacfe('0x4b')]:_0x168c2f['model'];if(!_0x12fa8c['query'][_0xacfe('0x4e')](_0xacfe('0x4f'))){_0x4d27af[_0xacfe('0x50')]=qs[_0xacfe('0x50')](_0x12fa8c[_0xacfe('0x47')][_0xacfe('0x50')]);_0x4d27af[_0xacfe('0x2e')]=qs['offset'](_0x12fa8c[_0xacfe('0x47')]['offset']);}_0x4d27af[_0xacfe('0x51')]=qs[_0xacfe('0x52')](_0x12fa8c[_0xacfe('0x47')][_0xacfe('0x52')]);_0x4d27af[_0xacfe('0x54')]=qs[_0xacfe('0x49')](_[_0xacfe('0x53')](_0x12fa8c[_0xacfe('0x47')],_0x168c2f[_0xacfe('0x49')]));_0x4d27af[_0xacfe('0x54')][_0xacfe('0x62')]=_0x1885db['id'];if(_0x12fa8c[_0xacfe('0x47')]['filter']){_0x4d27af[_0xacfe('0x54')]=_[_0xacfe('0x55')](_0x4d27af[_0xacfe('0x54')],{'$or':_[_0xacfe('0x40')](_0x4d27af['attributes'],function(_0x5a740f){var _0x469496={};_0x469496[_0x5a740f]={'$like':'%'+_0x12fa8c['query'][_0xacfe('0x66')]+'%'};return _0x469496;})});}_0x4d27af=_['merge']({},_0x4d27af,_0x12fa8c[_0xacfe('0x56')]);return db['CannedAnswer'][_0xacfe('0x57')]({'where':_0x4d27af[_0xacfe('0x54')]})[_0xacfe('0x1f')](function(_0xedae6e){_0x2a5390['count']=_0xedae6e;if(_0x12fa8c['query'][_0xacfe('0x58')]){_0x4d27af[_0xacfe('0x5c')]=[{'all':!![]}];}return db[_0xacfe('0x68')][_0xacfe('0x59')](_0x4d27af);})[_0xacfe('0x1f')](function(_0x7ce4f1){_0x2a5390['rows']=_0x7ce4f1;return _0x2a5390;});}})['then'](respondWithFilteredResult(_0x499649,_0x4d27af))[_0xacfe('0x29')](handleError(_0x499649,null));};exports[_0xacfe('0x6a')]=function(_0x342485,_0x2afe98,_0x3bb294){return db['MailAccount'][_0xacfe('0x5d')]({'where':{'id':_0x342485['params']['id']}})[_0xacfe('0x1f')](handleEntityNotFound(_0x2afe98,null))[_0xacfe('0x1f')](function(_0x521d0d){if(_0x521d0d){return _0x521d0d[_0xacfe('0x6a')](_0x342485[_0xacfe('0x47')][_0xacfe('0x6b')]);}})[_0xacfe('0x1f')](respondWithStatusCode(_0x2afe98,null))[_0xacfe('0x29')](handleError(_0x2afe98,null));};exports[_0xacfe('0x64')]=function(_0x126fa6,_0x268d3a){var _0x5e5c10={'name':_0x126fa6[_0xacfe('0x5e')][_0xacfe('0x37')],'key':_0x126fa6[_0xacfe('0x5e')]['key'],'email':_0x126fa6[_0xacfe('0x5e')][_0xacfe('0x6c')],'ListId':_0x126fa6[_0xacfe('0x5e')]['ListId'],'active':!_[_0xacfe('0x6d')](_0x126fa6[_0xacfe('0x5e')]['active'])?_0x126fa6[_0xacfe('0x5e')][_0xacfe('0x6e')]:!![],'description':_0x126fa6[_0xacfe('0x5e')][_0xacfe('0x6f')]||null,'Imap':{},'Smtp':{}};if(_[_0xacfe('0x6d')](_0x126fa6['body'][_0xacfe('0x70')])){if(_0x126fa6[_0xacfe('0x5e')][_0xacfe('0x71')]){_0x5e5c10[_0xacfe('0x3b')]['user']=_0x5e5c10[_0xacfe('0x3d')][_0xacfe('0x72')]=_0x126fa6['body'][_0xacfe('0x73')];_0x5e5c10['Imap']['password']=_0x5e5c10['Smtp']['pass']=_0x126fa6['body'][_0xacfe('0x74')];}else{_0x5e5c10[_0xacfe('0x3b')]['authentication']=_0x5e5c10['Smtp'][_0xacfe('0x75')]=![];}_0x5e5c10[_0xacfe('0x3b')]['host']=_0x126fa6['body'][_0xacfe('0x3b')][_0xacfe('0x76')];_0x5e5c10[_0xacfe('0x3b')][_0xacfe('0x77')]=_0x126fa6['body'][_0xacfe('0x3b')][_0xacfe('0x77')];_0x5e5c10[_0xacfe('0x3d')][_0xacfe('0x76')]=_0x126fa6['body']['Smtp'][_0xacfe('0x76')];_0x5e5c10[_0xacfe('0x3d')][_0xacfe('0x77')]=_0x126fa6['body']['Smtp'][_0xacfe('0x77')];}else{_0x5e5c10[_0xacfe('0x3b')]['service']=_0x5e5c10[_0xacfe('0x3d')][_0xacfe('0x78')]=_0x126fa6[_0xacfe('0x5e')][_0xacfe('0x70')];_0x5e5c10[_0xacfe('0x3b')][_0xacfe('0x72')]=_0x5e5c10[_0xacfe('0x3d')][_0xacfe('0x72')]=_0x126fa6['body'][_0xacfe('0x73')];_0x5e5c10['Imap'][_0xacfe('0x79')]=_0x5e5c10[_0xacfe('0x3d')][_0xacfe('0x7a')]=_0x126fa6[_0xacfe('0x5e')][_0xacfe('0x74')];}return db[_0xacfe('0x41')]['create'](_0x5e5c10,{'include':[{'model':db[_0xacfe('0x3c')],'as':_0xacfe('0x3d')},{'model':db[_0xacfe('0x3a')],'as':_0xacfe('0x3b')}]})[_0xacfe('0x1f')](function(_0x547972){var _0x5882e9=_0x126fa6['user']['get']({'plain':!![]});if(!_0x5882e9)throw new Error(_0xacfe('0x7b'));if(_0x5882e9[_0xacfe('0x7c')]===_0xacfe('0x72')){var _0xd30e2b=_0x547972[_0xacfe('0x34')]({'plain':!![]});return db[_0xacfe('0x7d')][_0xacfe('0x5d')]({'where':{'name':_0xacfe('0x35'),'userProfileId':_0x5882e9[_0xacfe('0x7e')]},'raw':!![]})[_0xacfe('0x1f')](function(_0xb394f3){if(_0xb394f3&&_0xb394f3[_0xacfe('0x7f')]===0x0){return db[_0xacfe('0x80')][_0xacfe('0x64')]({'name':_0xd30e2b[_0xacfe('0x37')],'resourceId':_0xd30e2b['id'],'type':_0xb394f3['name'],'sectionId':_0xb394f3['id']},{})[_0xacfe('0x1f')](function(){return _0x547972;});}else{return _0x547972;}})[_0xacfe('0x29')](function(_0x48aff2){logger[_0xacfe('0x26')](_0xacfe('0x81'),_0x48aff2);throw _0x48aff2;});}return _0x547972;})[_0xacfe('0x1f')](respondWithResult(_0x268d3a,0xc9))[_0xacfe('0x29')](handleError(_0x268d3a,null));};exports[_0xacfe('0x82')]=function(_0x4a79a9,_0x246d07,_0x5505ea){return db[_0xacfe('0x41')][_0xacfe('0x83')]({'where':{'id':_0x4a79a9[_0xacfe('0x5b')]['id']}})[_0xacfe('0x1f')](handleEntityNotFound(_0x246d07,null))[_0xacfe('0x1f')](function(_0x36f58e){if(_0x36f58e){return _0x36f58e[_0xacfe('0x82')]();}return null;})[_0xacfe('0x1f')](respondWithResult(_0x246d07,null))['catch'](handleError(_0x246d07,null));};exports['addImap']=function(_0x4703b8,_0x3c8cad,_0x4774ed){if(_0x4703b8['body']['id']){delete _0x4703b8[_0xacfe('0x5e')]['id'];}return db[_0xacfe('0x41')]['find']({'where':{'id':_0x4703b8[_0xacfe('0x5b')]['id']}})[_0xacfe('0x1f')](handleEntityNotFound(_0x3c8cad,null))['then'](function(_0x2cf972){if(_0x2cf972){_0x4703b8['body'][_0xacfe('0x62')]=_0x2cf972['id'];return db['MailServerIn'][_0xacfe('0x64')](_0x4703b8[_0xacfe('0x5e')]);}})[_0xacfe('0x1f')](respondWithResult(_0x3c8cad,null))[_0xacfe('0x29')](handleError(_0x3c8cad,null));};exports[_0xacfe('0x84')]=function(_0x540333,_0x3091d8,_0x284591){return db[_0xacfe('0x41')][_0xacfe('0x83')]({'where':{'id':_0x540333['params']['id']}})[_0xacfe('0x1f')](handleEntityNotFound(_0x3091d8,null))[_0xacfe('0x1f')](function(_0x5dc2d4){if(_0x5dc2d4){return _0x5dc2d4[_0xacfe('0x85')](null);}return null;})[_0xacfe('0x1f')](respondWithStatusCode(_0x3091d8,null))['catch'](handleError(_0x3091d8,null));};exports['getSmtp']=function(_0xc7e835,_0x9ddf8f,_0x29970){return db[_0xacfe('0x41')][_0xacfe('0x83')]({'where':{'id':_0xc7e835[_0xacfe('0x5b')]['id']}})[_0xacfe('0x1f')](handleEntityNotFound(_0x9ddf8f,null))['then'](function(_0x4cde15){if(_0x4cde15){return _0x4cde15[_0xacfe('0x86')]();}return null;})[_0xacfe('0x1f')](respondWithResult(_0x9ddf8f,null))['catch'](handleError(_0x9ddf8f,null));};exports[_0xacfe('0x87')]=function(_0x3ca294,_0x1d560a,_0x14c815){if(_0x3ca294[_0xacfe('0x5e')]['id']){delete _0x3ca294[_0xacfe('0x5e')]['id'];}return db[_0xacfe('0x41')]['find']({'where':{'id':_0x3ca294['params']['id']}})[_0xacfe('0x1f')](handleEntityNotFound(_0x1d560a,null))['then'](function(_0x399a7b){if(_0x399a7b){_0x3ca294[_0xacfe('0x5e')]['MailAccountId']=_0x399a7b['id'];return db[_0xacfe('0x3c')]['create'](_0x3ca294[_0xacfe('0x5e')]);}})['then'](respondWithResult(_0x1d560a,null))[_0xacfe('0x29')](handleError(_0x1d560a,null));};exports['removeSmtp']=function(_0x5f5093,_0x22b744,_0x17d439){return db[_0xacfe('0x41')]['findOne']({'where':{'id':_0x5f5093[_0xacfe('0x5b')]['id']}})[_0xacfe('0x1f')](handleEntityNotFound(_0x22b744,null))[_0xacfe('0x1f')](function(_0x3691a4){if(_0x3691a4){return _0x3691a4['setSmtp'](null);}return null;})[_0xacfe('0x1f')](respondWithStatusCode(_0x22b744,null))[_0xacfe('0x29')](handleError(_0x22b744,null));};exports['addInteraction']=function(_0x2caab9,_0x4d3b6c,_0x3ae707){return db['MailInteraction']['find']({'where':{'id':_0x2caab9[_0xacfe('0x5b')]['id']}})[_0xacfe('0x1f')](handleEntityNotFound(_0x4d3b6c,null))['then'](function(_0x2ffa95){if(_0x2ffa95){return _0x2ffa95[_0xacfe('0x88')](_0x2caab9['body'][_0xacfe('0x6b')],_[_0xacfe('0x89')](_0x2caab9['body'],['ids','id'])||{});}})[_0xacfe('0x1f')](respondWithResult(_0x4d3b6c,null))[_0xacfe('0x29')](handleError(_0x4d3b6c,null));};exports[_0xacfe('0x8a')]=function(_0x43c0a6,_0x4f1888,_0x361f56){var _0x2e24c8={'raw':![],'where':{}};var _0x6c0ee2={};var _0x11b2a8={'count':0x0,'rows':[]};return db[_0xacfe('0x41')][_0xacfe('0x83')]({'where':{'id':_0x43c0a6['params']['id']}})[_0xacfe('0x1f')](handleEntityNotFound(_0x4f1888,null))[_0xacfe('0x1f')](function(_0x443bb3){if(_0x443bb3){_0x6c0ee2[_0xacfe('0x46')]=_[_0xacfe('0x48')](db[_0xacfe('0x8b')][_0xacfe('0x42')]);_0x6c0ee2[_0xacfe('0x47')]=_[_0xacfe('0x48')](_0x43c0a6['query']);_0x6c0ee2[_0xacfe('0x49')]=_['intersection'](_0x6c0ee2[_0xacfe('0x46')],_0x6c0ee2[_0xacfe('0x47')]);_0x2e24c8['attributes']=_[_0xacfe('0x4a')](_0x6c0ee2[_0xacfe('0x46')],qs['fields'](_0x43c0a6[_0xacfe('0x47')][_0xacfe('0x4c')]));_0x2e24c8[_0xacfe('0x4b')]=_0x2e24c8[_0xacfe('0x4b')][_0xacfe('0x4d')]?_0x2e24c8[_0xacfe('0x4b')]:_0x6c0ee2['model'];if(!_0x43c0a6[_0xacfe('0x47')]['hasOwnProperty']('nolimit')){_0x2e24c8[_0xacfe('0x50')]=qs[_0xacfe('0x50')](_0x43c0a6['query'][_0xacfe('0x50')]);_0x2e24c8[_0xacfe('0x2e')]=qs['offset'](_0x43c0a6[_0xacfe('0x47')][_0xacfe('0x2e')]);}_0x2e24c8[_0xacfe('0x51')]=qs[_0xacfe('0x52')](_0x43c0a6[_0xacfe('0x47')]['sort']);_0x2e24c8[_0xacfe('0x54')]=qs[_0xacfe('0x49')](_[_0xacfe('0x53')](_0x43c0a6['query'],_0x6c0ee2[_0xacfe('0x49')]));_0x2e24c8[_0xacfe('0x54')][_0xacfe('0x62')]=_0x443bb3['id'];if(_0x43c0a6['query']['filter']){_0x2e24c8[_0xacfe('0x54')]=_[_0xacfe('0x55')](_0x2e24c8['where'],{'$or':_['map'](_0x2e24c8['attributes'],function(_0x6137a5){var _0x58203a={};_0x58203a[_0x6137a5]={'$like':'%'+_0x43c0a6[_0xacfe('0x47')]['filter']+'%'};return _0x58203a;})});}_0x2e24c8=_[_0xacfe('0x55')]({},_0x2e24c8,_0x43c0a6[_0xacfe('0x56')]);return db['MailInteraction']['count']({'where':_0x2e24c8[_0xacfe('0x54')]})[_0xacfe('0x1f')](function(_0xc84aa8){_0x11b2a8[_0xacfe('0x57')]=_0xc84aa8;if(_0x43c0a6['query'][_0xacfe('0x58')]){_0x2e24c8[_0xacfe('0x5c')]=[{'model':db[_0xacfe('0x8c')],'as':_0xacfe('0x8d'),'required':![]},{'model':db[_0xacfe('0x8e')],'as':'Owner','attributes':['name',_0xacfe('0x8f'),'internal'],'required':![]},{'model':db[_0xacfe('0x90')],'as':_0xacfe('0x91'),'attributes':['id','name',_0xacfe('0x92')],'where':_0x43c0a6[_0xacfe('0x47')]['tag']?{'id':_0x43c0a6[_0xacfe('0x47')][_0xacfe('0x93')]}:undefined,'required':_0x43c0a6[_0xacfe('0x47')][_0xacfe('0x93')]?!![]:![]}];}return db[_0xacfe('0x8b')][_0xacfe('0x59')](_0x2e24c8);})[_0xacfe('0x1f')](function(_0x5378aa){_0x11b2a8[_0xacfe('0x5a')]=_0x5378aa;return _0x11b2a8;});}})[_0xacfe('0x1f')](respondWithFilteredResult(_0x4f1888,_0x2e24c8))[_0xacfe('0x29')](handleError(_0x4f1888,null));};exports[_0xacfe('0x94')]=function(_0x30394b,_0x45d136,_0x1c1e8b){return db[_0xacfe('0x41')][_0xacfe('0x83')]({'where':{'id':_0x30394b[_0xacfe('0x5b')]['id']}})['then'](handleEntityNotFound(_0x45d136,null))[_0xacfe('0x1f')](function(_0x30f00b){if(_0x30f00b){return db[_0xacfe('0x95')][_0xacfe('0x96')](function(_0x20a6ab){return db[_0xacfe('0x97')][_0xacfe('0x33')]({'where':{'MailAccountId':_0x30394b[_0xacfe('0x5b')]['id']},'transaction':_0x20a6ab})[_0xacfe('0x1f')](function(_0x13836b){var _0x5ed6d1=_[_0xacfe('0x40')](_0x30394b[_0xacfe('0x5e')],function(_0x56ce8f){_0x56ce8f[_0xacfe('0x62')]=_0x30394b[_0xacfe('0x5b')]['id'];return _0x56ce8f;});return db['MailApplication'][_0xacfe('0x98')](_0x5ed6d1,{'transaction':_0x20a6ab});});})['then'](function(){return db[_0xacfe('0x97')][_0xacfe('0x99')]({'where':{'MailAccountId':_0x30394b[_0xacfe('0x5b')]['id']},'order':_0xacfe('0x9a')});});}})[_0xacfe('0x1f')](respondWithResult(_0x45d136,null))[_0xacfe('0x29')](handleError(_0x45d136,null));};exports[_0xacfe('0x9b')]=function(_0x28ec48,_0x388000,_0x5970c8){var _0x4e73a8={};var _0x7464bf={};var _0x50f1f2;var _0x50df73;return db[_0xacfe('0x41')][_0xacfe('0x83')]({'where':{'id':_0x28ec48['params']['id']}})['then'](handleEntityNotFound(_0x388000,null))[_0xacfe('0x1f')](function(_0x2d47d0){if(_0x2d47d0){_0x50f1f2=_0x2d47d0;_0x7464bf[_0xacfe('0x46')]=_['keys'](db[_0xacfe('0x97')][_0xacfe('0x42')]);_0x7464bf[_0xacfe('0x47')]=_[_0xacfe('0x48')](_0x28ec48[_0xacfe('0x47')]);_0x7464bf[_0xacfe('0x49')]=_[_0xacfe('0x4a')](_0x7464bf[_0xacfe('0x46')],_0x7464bf[_0xacfe('0x47')]);_0x4e73a8['attributes']=_[_0xacfe('0x4a')](_0x7464bf[_0xacfe('0x46')],qs[_0xacfe('0x4c')](_0x28ec48[_0xacfe('0x47')][_0xacfe('0x4c')]));_0x4e73a8[_0xacfe('0x4b')]=_0x4e73a8[_0xacfe('0x4b')][_0xacfe('0x4d')]?_0x4e73a8['attributes']:_0x7464bf[_0xacfe('0x46')];_0x4e73a8[_0xacfe('0x51')]=qs[_0xacfe('0x52')](_0x28ec48['query']['sort']);_0x4e73a8[_0xacfe('0x54')]=qs['filters'](_[_0xacfe('0x53')](_0x28ec48[_0xacfe('0x47')],_0x7464bf['filters']));if(_0x28ec48[_0xacfe('0x47')][_0xacfe('0x66')]){_0x4e73a8['where']=_[_0xacfe('0x55')](_0x4e73a8[_0xacfe('0x54')],{'$or':_[_0xacfe('0x40')](_0x4e73a8[_0xacfe('0x4b')],function(_0x5e5b16){var _0x4e70bf={};_0x4e70bf[_0x5e5b16]={'$like':'%'+_0x28ec48['query'][_0xacfe('0x66')]+'%'};return _0x4e70bf;})});}_0x4e73a8=_[_0xacfe('0x55')]({},_0x4e73a8,_0x28ec48[_0xacfe('0x56')]);return _0x50f1f2['getApplications'](_0x4e73a8);}})[_0xacfe('0x1f')](function(_0xe46f84){if(_0xe46f84){_0x50df73=_0xe46f84[_0xacfe('0x4d')];if(!_0x28ec48[_0xacfe('0x47')][_0xacfe('0x4e')](_0xacfe('0x4f'))){_0x4e73a8[_0xacfe('0x50')]=qs[_0xacfe('0x50')](_0x28ec48[_0xacfe('0x47')][_0xacfe('0x50')]);_0x4e73a8[_0xacfe('0x2e')]=qs[_0xacfe('0x2e')](_0x28ec48[_0xacfe('0x47')]['offset']);}return _0x50f1f2['getApplications'](_0x4e73a8);}})[_0xacfe('0x1f')](function(_0x1ab145){if(_0x1ab145){return _0x1ab145?{'count':_0x50df73,'rows':_0x1ab145}:null;}})['then'](respondWithResult(_0x388000,null))[_0xacfe('0x29')](handleError(_0x388000,null));};exports['getMessages']=function(_0x7d0ef8,_0x567100,_0x139153){var _0x2f0d71={'raw':!![],'where':{}};var _0x304fbb={};var _0x50a716={'count':0x0,'rows':[]};return db[_0xacfe('0x41')][_0xacfe('0x83')]({'where':{'id':_0x7d0ef8[_0xacfe('0x5b')]['id']}})[_0xacfe('0x1f')](handleEntityNotFound(_0x567100,null))[_0xacfe('0x1f')](function(_0x5d1b0d){if(_0x5d1b0d){_0x304fbb[_0xacfe('0x46')]=_[_0xacfe('0x48')](db[_0xacfe('0x9c')][_0xacfe('0x42')]);_0x304fbb[_0xacfe('0x47')]=_[_0xacfe('0x48')](_0x7d0ef8[_0xacfe('0x47')]);_0x304fbb[_0xacfe('0x49')]=_[_0xacfe('0x4a')](_0x304fbb[_0xacfe('0x46')],_0x304fbb['query']);_0x2f0d71[_0xacfe('0x4b')]=_[_0xacfe('0x4a')](_0x304fbb[_0xacfe('0x46')],qs['fields'](_0x7d0ef8[_0xacfe('0x47')][_0xacfe('0x4c')]));_0x2f0d71[_0xacfe('0x4b')]=_0x2f0d71[_0xacfe('0x4b')]['length']?_0x2f0d71['attributes']:_0x304fbb[_0xacfe('0x46')];if(!_0x7d0ef8[_0xacfe('0x47')]['hasOwnProperty'](_0xacfe('0x4f'))){_0x2f0d71['limit']=qs[_0xacfe('0x50')](_0x7d0ef8[_0xacfe('0x47')]['limit']);_0x2f0d71['offset']=qs[_0xacfe('0x2e')](_0x7d0ef8[_0xacfe('0x47')][_0xacfe('0x2e')]);}_0x2f0d71[_0xacfe('0x51')]=qs[_0xacfe('0x52')](_0x7d0ef8['query'][_0xacfe('0x52')]);_0x2f0d71['where']=qs['filters'](_[_0xacfe('0x53')](_0x7d0ef8[_0xacfe('0x47')],_0x304fbb['filters']));_0x2f0d71[_0xacfe('0x54')][_0xacfe('0x62')]=_0x5d1b0d['id'];if(_0x7d0ef8[_0xacfe('0x47')][_0xacfe('0x66')]){_0x2f0d71[_0xacfe('0x54')]=_['merge'](_0x2f0d71[_0xacfe('0x54')],{'$or':_[_0xacfe('0x40')](_0x2f0d71[_0xacfe('0x4b')],function(_0x78f781){var _0x5c9afb={};_0x5c9afb[_0x78f781]={'$like':'%'+_0x7d0ef8[_0xacfe('0x47')][_0xacfe('0x66')]+'%'};return _0x5c9afb;})});}if(_0x7d0ef8['query'][_0xacfe('0x9d')]){var _0x2fc185=_0x7d0ef8[_0xacfe('0x47')][_0xacfe('0x9d')][_0xacfe('0x9e')](',');var _0x543fd7={};_0x543fd7[_0x2fc185[0x0]]={'$gte':moment(_0x2fc185[0x1])[_0xacfe('0x9f')](_0xacfe('0xa0'))};_0x2f0d71[_0xacfe('0x54')]=_[_0xacfe('0x55')](_0x2f0d71[_0xacfe('0x54')],_0x543fd7);}_0x2f0d71=_['merge']({},_0x2f0d71,_0x7d0ef8['options']);return db[_0xacfe('0x9c')][_0xacfe('0x57')]({'where':_0x2f0d71[_0xacfe('0x54')]})[_0xacfe('0x1f')](function(_0x34de02){_0x50a716[_0xacfe('0x57')]=_0x34de02;if(_0x7d0ef8[_0xacfe('0x47')]['includeAll']){_0x2f0d71[_0xacfe('0x5c')]=[{'all':!![]}];}return db[_0xacfe('0x9c')]['findAll'](_0x2f0d71);})['then'](function(_0x331793){if(_0x7d0ef8[_0xacfe('0x47')][_0xacfe('0xa1')]==='true'){for(var _0x42421f=0x0;_0x42421f<_0x331793[_0xacfe('0x4d')];_0x42421f++){_0x331793[_0x42421f][_0xacfe('0x5e')]=juice(_0x331793[_0x42421f][_0xacfe('0x5e')]);}}_0x50a716[_0xacfe('0x5a')]=_0x331793;return _0x50a716;});}})[_0xacfe('0x1f')](respondWithFilteredResult(_0x567100,_0x2f0d71))['catch'](handleError(_0x567100,null));};exports['send']=function(_0x409d09,_0x180c87,_0x57b156){var _0x5c986c,_0x2c4e1c={},_0x471205;if(_0x409d09['body']['to']){_0x471205=_0x409d09[_0xacfe('0x5e')]['to']['split'](',')[0x0];}return db[_0xacfe('0x41')][_0xacfe('0x5d')]({'where':{'id':_0x409d09[_0xacfe('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0xacfe('0xa2'),'include':[{'model':db[_0xacfe('0x8c')],'as':_0xacfe('0xa3'),'where':{'email':_0x471205},'limit':0x1,'order':[[_0xacfe('0xa4'),'DESC']]}]},{'model':db[_0xacfe('0x3c')],'as':_0xacfe('0x3d'),'raw':!![]}]})[_0xacfe('0x1f')](handleEntityNotFound(_0x180c87,null))[_0xacfe('0x1f')](function(_0x3ecb4f){if(_0x3ecb4f){_0x5c986c=_0x3ecb4f;if(_0x3ecb4f['Smtp']){if(_[_0xacfe('0x6d')](_0x409d09[_0xacfe('0x5e')][_0xacfe('0xa5')])){_0x409d09['body'][_0xacfe('0xa5')]=util[_0xacfe('0x9f')]('%s\x20<%s>',_0x3ecb4f['name'],_0x3ecb4f[_0xacfe('0x6c')]||_0x3ecb4f[_0xacfe('0x3d')][_0xacfe('0x72')]);}if(_0x409d09[_0xacfe('0x5e')]['attachments']&&_0x409d09['body'][_0xacfe('0xa6')][_0xacfe('0x4d')]){for(var _0x443f36=0x0;_0x443f36<_0x409d09[_0xacfe('0x5e')][_0xacfe('0xa6')][_0xacfe('0x4d')];_0x443f36+=0x1){_0x409d09[_0xacfe('0x5e')][_0xacfe('0xa6')][_0x443f36]={'filename':_0x409d09[_0xacfe('0x5e')][_0xacfe('0xa6')][_0x443f36][_0xacfe('0x37')],'path':path[_0xacfe('0xa7')](config[_0xacfe('0xa8')],_0xacfe('0xa9'),_0x409d09[_0xacfe('0x5e')][_0xacfe('0xa6')][_0x443f36][_0xacfe('0xaa')])};}}var _0x547540={'tls':{'rejectUnauthorized':![]}};if(_[_0xacfe('0x6d')](_0x3ecb4f[_0xacfe('0x3d')][_0xacfe('0x78')])){if(_0x3ecb4f[_0xacfe('0x3d')][_0xacfe('0x75')]){_0x547540[_0xacfe('0xab')]={'user':_0x3ecb4f[_0xacfe('0x3d')][_0xacfe('0x72')],'pass':_0x3ecb4f[_0xacfe('0x3d')]['pass']};}_0x547540['host']=_0x3ecb4f[_0xacfe('0x3d')][_0xacfe('0x76')];_0x547540[_0xacfe('0x77')]=_0x3ecb4f[_0xacfe('0x3d')][_0xacfe('0x77')];_0x547540[_0xacfe('0xac')]=_0x3ecb4f['Smtp'][_0xacfe('0xac')];}else{_0x547540[_0xacfe('0x78')]=_0x3ecb4f[_0xacfe('0x3d')][_0xacfe('0x78')];_0x547540[_0xacfe('0xab')]={'user':_0x3ecb4f['Smtp'][_0xacfe('0x72')],'pass':_0x3ecb4f[_0xacfe('0x3d')]['pass']};}return respondWithRpcPromise(_0xacfe('0xad'),_0xacfe('0xae'),{'account':_0x547540,'message':_0x409d09[_0xacfe('0x5e')]});}else{throw new Error('List\x20not\x20found');}}})[_0xacfe('0x1f')](function(_0x147fbc){if(_0x147fbc){_0x2c4e1c=_0x147fbc;if(_0x5c986c[_0xacfe('0xa2')]){if(_0x5c986c[_0xacfe('0xa2')]['Contacts']['length']){return _0x5c986c[_0xacfe('0xa2')][_0xacfe('0xa3')][0x0];}else{return db[_0xacfe('0x8c')][_0xacfe('0x64')](_[_0xacfe('0xaf')](_0x409d09[_0xacfe('0x5e')],{'firstName':_0x409d09[_0xacfe('0x5e')]['to'],'email':_0x409d09[_0xacfe('0x5e')]['to'],'phone':_0x409d09['body']['to'],'ListId':_0x5c986c[_0xacfe('0xb0')]}));}}else{throw new Error(_0xacfe('0xb1'));}}})[_0xacfe('0x1f')](function(_0x5d6cd2){if(_0x5d6cd2){var _0x5a6e4f={'UserId':_0x409d09[_0xacfe('0x72')]['id'],'ContactId':_0x5d6cd2['id'],'MailAccountId':_0x5c986c['id'],'inReplyTo':_0x2c4e1c[_0xacfe('0xb2')],'to':_0x409d09[_0xacfe('0x5e')][_0xacfe('0xa5')],'cc':_0x409d09[_0xacfe('0x5e')]['cc'],'subject':_0x409d09[_0xacfe('0x5e')][_0xacfe('0xb3')],'attach':_0x409d09[_0xacfe('0x5e')][_0xacfe('0xb4')],'firstMsgDirection':_0xacfe('0xb5'),'lastMsgAt':moment()[_0xacfe('0x9f')](_0xacfe('0xa0')),'lastMsgDirection':_0xacfe('0xb5'),'lastMsgBody':_0x409d09['body'][_0xacfe('0x5e')],'Messages':[_[_0xacfe('0x55')](_0x409d09['body'],{'messageId':_0x2c4e1c[_0xacfe('0xb2')],'sentAt':moment()[_0xacfe('0x9f')](_0xacfe('0xa0')),'read':!![],'MailAccountId':_0x5c986c['id'],'UserId':_0x409d09['user']['id'],'ContactId':_0x5d6cd2['id']})]};if(_0x409d09['body'][_0xacfe('0xb6')]){_0x5a6e4f=_[_0xacfe('0x55')](_0x5a6e4f,_0x409d09[_0xacfe('0x5e')][_0xacfe('0xb6')]);}return db[_0xacfe('0x8b')]['create'](_0x5a6e4f,{'include':[{'model':db[_0xacfe('0x9c')],'as':_0xacfe('0xb7')}]});}})[_0xacfe('0x1f')](respondWithResult(_0x180c87,null))[_0xacfe('0x29')](handleError(_0x180c87,null));};exports['verifySmtp']=function(_0x36678d,_0x56a094,_0x5d58f6){return db['MailAccount'][_0xacfe('0x5d')]({'where':{'id':_0x36678d[_0xacfe('0x5b')]['id']},'include':[{'model':db[_0xacfe('0x3c')],'as':_0xacfe('0x3d'),'raw':!![]}]})[_0xacfe('0x1f')](handleEntityNotFound(_0x56a094,null))[_0xacfe('0x1f')](function(_0x539115){if(_0x539115&&_0x539115[_0xacfe('0x3d')]){var _0x527006={'id':_0x539115['id'],'tls':{'rejectUnauthorized':![]}};if(_0x539115['Smtp']['service']){_0x527006[_0xacfe('0x78')]=_0x539115[_0xacfe('0x3d')][_0xacfe('0x78')];}else{_0x527006[_0xacfe('0x76')]=_0x539115[_0xacfe('0x3d')]['host'];_0x527006[_0xacfe('0x77')]=_0x539115[_0xacfe('0x3d')][_0xacfe('0x77')];_0x527006[_0xacfe('0xac')]=_0x539115[_0xacfe('0x3d')][_0xacfe('0xac')];}if(_0x539115[_0xacfe('0x3d')][_0xacfe('0x75')]){_0x527006[_0xacfe('0xab')]={'user':_0x539115['Smtp'][_0xacfe('0x72')],'pass':_0x539115['Smtp']['pass']};}return respondWithRpcPromise('VerifySmtp',_0xacfe('0xb8'),{'account':_0x527006});}})[_0xacfe('0x1f')](respondWithResult(_0x56a094,null))[_0xacfe('0x29')](handleError(_0x56a094,null));};exports[_0xacfe('0x33')]=function(_0x14f125,_0x295b38){return db['MailAccount'][_0xacfe('0x5d')]({'where':{'id':_0x14f125['params']['id']}})[_0xacfe('0x1f')](handleEntityNotFound(_0x295b38,null))[_0xacfe('0x1f')](function(_0x514b9b){if(_0x514b9b&&_0x514b9b[_0xacfe('0x78')]){throw new db['Sequelize'][(_0xacfe('0xb9'))](_0xacfe('0xba'));}return _0x514b9b;})[_0xacfe('0x1f')](removeEntity(_0x295b38,null))[_0xacfe('0x29')](handleError(_0x295b38,null));};exports[_0xacfe('0xbb')]=function(_0x58172e,_0x4a794f,_0x1b9d6b){return db['MailAccount'][_0xacfe('0x5d')]({'where':{'id':_0x58172e['params']['id']}})['then'](handleEntityNotFound(_0x4a794f,null))[_0xacfe('0x1f')](function(_0x467fd9){if(_0x467fd9){return _0x467fd9['addAgents'](_0x58172e[_0xacfe('0x5e')][_0xacfe('0x6b')],_[_0xacfe('0x89')](_0x58172e[_0xacfe('0x5e')],[_0xacfe('0x6b'),'id'])||{})[_0xacfe('0xbc')](function(_0x360bd4){for(var _0x24adef=0x0;_0x24adef<_0x58172e[_0xacfe('0x5e')][_0xacfe('0x6b')][_0xacfe('0x4d')];_0x24adef+=0x1){socket[_0xacfe('0xbd')](_0xacfe('0xbe'),{'UserId':_0x58172e[_0xacfe('0x5e')][_0xacfe('0x6b')][_0x24adef],'MailAccountId':_0x58172e[_0xacfe('0x5b')]['id']});}return _0x360bd4;});}})[_0xacfe('0x1f')](respondWithResult(_0x4a794f,null))[_0xacfe('0x29')](handleError(_0x4a794f,null));};exports['removeAgents']=function(_0xf5c94b,_0x14b30f,_0x37e46d){return db['MailAccount'][_0xacfe('0x5d')]({'where':{'id':_0xf5c94b[_0xacfe('0x5b')]['id']}})[_0xacfe('0x1f')](handleEntityNotFound(_0x14b30f,null))[_0xacfe('0x1f')](function(_0x16c303){if(_0x16c303){return _0x16c303[_0xacfe('0xbf')](_0xf5c94b[_0xacfe('0x47')][_0xacfe('0x6b')])[_0xacfe('0x1f')](function(){if(_[_0xacfe('0xc0')](_0xf5c94b[_0xacfe('0x47')][_0xacfe('0x6b')])){for(var _0x3e7a13=0x0;_0x3e7a13<_0xf5c94b[_0xacfe('0x47')][_0xacfe('0x6b')][_0xacfe('0x4d')];_0x3e7a13+=0x1){socket[_0xacfe('0xbd')]('userMailAccount:remove',{'UserId':Number(_0xf5c94b[_0xacfe('0x47')][_0xacfe('0x6b')][_0x3e7a13]),'MailAccountId':Number(_0xf5c94b[_0xacfe('0x5b')]['id'])});}}else{socket[_0xacfe('0xbd')]('userMailAccount:remove',{'UserId':Number(_0xf5c94b[_0xacfe('0x47')][_0xacfe('0x6b')]),'MailAccountId':Number(_0xf5c94b[_0xacfe('0x5b')]['id'])});}});}})[_0xacfe('0x1f')](respondWithStatusCode(_0x14b30f,null))[_0xacfe('0x29')](handleError(_0x14b30f,null));};exports[_0xacfe('0xc1')]=function(_0x2cb53e,_0x2f328b,_0x22f48e){var _0x348437={};var _0x4d4eed={};var _0x1f853f;var _0x216ff8;return db[_0xacfe('0x41')][_0xacfe('0x83')]({'where':{'id':_0x2cb53e['params']['id']}})[_0xacfe('0x1f')](handleEntityNotFound(_0x2f328b,null))['then'](function(_0x3725c4){if(_0x3725c4){_0x1f853f=_0x3725c4;_0x4d4eed[_0xacfe('0x46')]=_[_0xacfe('0x48')](db['User'][_0xacfe('0x42')]);_0x4d4eed['query']=_['keys'](_0x2cb53e[_0xacfe('0x47')]);_0x4d4eed[_0xacfe('0x49')]=_['intersection'](_0x4d4eed[_0xacfe('0x46')],_0x4d4eed[_0xacfe('0x47')]);_0x348437[_0xacfe('0x4b')]=_[_0xacfe('0x4a')](_0x4d4eed[_0xacfe('0x46')],qs[_0xacfe('0x4c')](_0x2cb53e[_0xacfe('0x47')][_0xacfe('0x4c')]));_0x348437[_0xacfe('0x4b')]=_0x348437[_0xacfe('0x4b')]['length']?_0x348437[_0xacfe('0x4b')]:_0x4d4eed['model'];_0x348437['order']=qs[_0xacfe('0x52')](_0x2cb53e['query'][_0xacfe('0x52')]);_0x348437['where']=qs[_0xacfe('0x49')](_[_0xacfe('0x53')](_0x2cb53e[_0xacfe('0x47')],_0x4d4eed[_0xacfe('0x49')]));if(_0x2cb53e['query'][_0xacfe('0x66')]){_0x348437[_0xacfe('0x54')]=_[_0xacfe('0x55')](_0x348437[_0xacfe('0x54')],{'$or':_['map'](_0x348437['attributes'],function(_0x1f0d10){var _0x2991d0={};_0x2991d0[_0x1f0d10]={'$like':'%'+_0x2cb53e[_0xacfe('0x47')][_0xacfe('0x66')]+'%'};return _0x2991d0;})});}_0x348437=_[_0xacfe('0x55')]({},_0x348437,_0x2cb53e[_0xacfe('0x56')]);return _0x1f853f[_0xacfe('0xc1')](_0x348437);}})[_0xacfe('0x1f')](function(_0x44e0c4){if(_0x44e0c4){_0x216ff8=_0x44e0c4[_0xacfe('0x4d')];if(!_0x2cb53e['query']['hasOwnProperty'](_0xacfe('0x4f'))){_0x348437[_0xacfe('0x50')]=qs['limit'](_0x2cb53e[_0xacfe('0x47')][_0xacfe('0x50')]);_0x348437[_0xacfe('0x2e')]=qs['offset'](_0x2cb53e[_0xacfe('0x47')]['offset']);}return _0x1f853f[_0xacfe('0xc1')](_0x348437);}})[_0xacfe('0x1f')](function(_0x1be999){if(_0x1be999){return _0x1be999?{'count':_0x216ff8,'rows':_0x1be999}:null;}})[_0xacfe('0x1f')](respondWithResult(_0x2f328b,null))[_0xacfe('0x29')](handleError(_0x2f328b,null));}; \ No newline at end of file +var _0x0260=['jsforce','desk.js','querystring','papaparse','html-to-text','../../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','./mailAccount.socket','register','client','http','then','info','request\x20sent','debug','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','MailAccounts','UserProfileResource','status','stack','name','send','index','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','includeAll','body','find','Pause','MailServerIn','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','rows','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','ListId','active','description','isNil','cservice','cauthentication','user','password','pass','cpassword','authentication','host','port','service','cuser','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','Contact','User','fullname','internal','Tags','color','tag','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmContact','Contacts','updatedAt','DESC','from','attachments','join','root','server/files/attachments','basename','secure','auth','List\x20not\x20found','List','subject','attach','out','messageId','Interaction','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto'];(function(_0x5386c3,_0x4471a2){var _0x2cfc1f=function(_0x2c091d){while(--_0x2c091d){_0x5386c3['push'](_0x5386c3['shift']());}};_0x2cfc1f(++_0x4471a2);}(_0x0260,0x178));var _0x0026=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x0260[_0x486f4a];return _0x135d99;};'use strict';var pdf=require(_0x0026('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0026('0x1'));var rp=require(_0x0026('0x2'));var moment=require(_0x0026('0x3'));var BPromise=require(_0x0026('0x4'));var Mustache=require(_0x0026('0x5'));var util=require('util');var path=require(_0x0026('0x6'));var sox=require(_0x0026('0x7'));var csv=require(_0x0026('0x8'));var ejs=require(_0x0026('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0026('0xa'));var crypto=require(_0x0026('0xb'));var jsforce=require(_0x0026('0xc'));var deskjs=require(_0x0026('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0026('0xe'));var Papa=require(_0x0026('0xf'));var htmlToText=require(_0x0026('0x10'));var juice=require('juice');var Redis=require('ioredis');var authService=require(_0x0026('0x11'));var qs=require(_0x0026('0x12'));var as=require(_0x0026('0x13'));var hardwareService=require(_0x0026('0x14'));var logger=require('../../config/logger')(_0x0026('0x15'));var utils=require(_0x0026('0x16'));var config=require(_0x0026('0x17'));var licenseUtil=require(_0x0026('0x18'));var db=require(_0x0026('0x19'))['db'];config[_0x0026('0x1a')]=_[_0x0026('0x1b')](config[_0x0026('0x1a')],{'host':_0x0026('0x1c'),'port':0x18eb});var socket=require(_0x0026('0x1d'))(new Redis(config['redis']));require(_0x0026('0x1e'))[_0x0026('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0026('0x20')][_0x0026('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x465baf,_0x2dc6e3,_0x21749c,_0x27d496){return new BPromise(function(_0x227435,_0x2423a4){var _0x150309=_0x27d496||client;return _0x150309['request'](_0x465baf,_0x21749c)[_0x0026('0x22')](function(_0x5495c7){logger[_0x0026('0x23')]('MailAccount,\x20%s,\x20%s',_0x2dc6e3,_0x0026('0x24'));logger[_0x0026('0x25')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2dc6e3,_0x0026('0x24'),JSON[_0x0026('0x26')](_0x5495c7));if(_0x5495c7[_0x0026('0x27')]){if(_0x5495c7[_0x0026('0x27')][_0x0026('0x28')]===0x1f4){logger[_0x0026('0x27')](_0x0026('0x29'),_0x2dc6e3,_0x5495c7[_0x0026('0x27')]['message']);return _0x2423a4(_0x5495c7[_0x0026('0x27')][_0x0026('0x2a')]);}logger['error'](_0x0026('0x29'),_0x2dc6e3,_0x5495c7['error'][_0x0026('0x2a')]);return _0x227435(_0x5495c7[_0x0026('0x27')]['message']);}else{logger[_0x0026('0x23')](_0x0026('0x29'),_0x2dc6e3,'request\x20sent');_0x227435(_0x5495c7[_0x0026('0x2b')][_0x0026('0x2a')]);}})[_0x0026('0x2c')](function(_0x3028e1){logger[_0x0026('0x27')](_0x0026('0x29'),_0x2dc6e3,_0x3028e1);_0x2423a4(_0x3028e1);});});}function respondWithStatusCode(_0x2e0d6c,_0x4b8f5f){_0x4b8f5f=_0x4b8f5f||0xcc;return function(_0x48dbb8){if(_0x48dbb8){return _0x2e0d6c[_0x0026('0x2d')](_0x4b8f5f);}return _0x2e0d6c['status'](_0x4b8f5f)[_0x0026('0x2e')]();};}function respondWithResult(_0x5639f4,_0x22c8d8){_0x22c8d8=_0x22c8d8||0xc8;return function(_0x9c6bb3){if(_0x9c6bb3){return _0x5639f4['status'](_0x22c8d8)[_0x0026('0x2f')](_0x9c6bb3);}};}function respondWithFilteredResult(_0x514b3c,_0x123cfe){return function(_0x4bb743){if(_0x4bb743){var _0xc4c2d2=_0x4bb743[_0x0026('0x30')],_0xce7d87=_0x123cfe[_0x0026('0x31')],_0x84fa1d=_0x123cfe[_0x0026('0x31')]+_0x123cfe[_0x0026('0x32')],_0x10b679;if(_0x84fa1d>=_0xc4c2d2){_0x84fa1d=_0xc4c2d2;_0x10b679=0xc8;}else{_0x10b679=0xce;}_0x514b3c['status'](_0x10b679);return _0x514b3c[_0x0026('0x33')](_0x0026('0x34'),_0xce7d87+'-'+_0x84fa1d+'/'+_0xc4c2d2)['json'](_0x4bb743);}return null;};}function patchUpdates(_0x160e10){return function(_0x151a2f){try{jsonpatch['apply'](_0x151a2f,_0x160e10,!![]);}catch(_0x285b47){return BPromise[_0x0026('0x35')](_0x285b47);}return _0x151a2f[_0x0026('0x36')]();};}function saveUpdates(_0x5b02ee,_0x2530cd){return function(_0x2b8b13){if(_0x2b8b13){return _0x2b8b13[_0x0026('0x37')](_0x5b02ee)['then'](function(_0x107458){return _0x107458;});}return null;};}function removeEntity(_0x11b22e,_0xd17cf1){return function(_0xab74c){if(_0xab74c){return _0xab74c[_0x0026('0x38')]()[_0x0026('0x22')](function(){var _0x151da7=_0xab74c['get']({'plain':!![]});var _0x36f752=_0x0026('0x39');return db[_0x0026('0x3a')]['destroy']({'where':{'type':_0x36f752,'resourceId':_0x151da7['id']}})[_0x0026('0x22')](function(){return _0xab74c;});})[_0x0026('0x22')](function(){_0x11b22e[_0x0026('0x3b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x349edf,_0x3a39bc){return function(_0x10c924){if(!_0x10c924){_0x349edf[_0x0026('0x2d')](0x194);}return _0x10c924;};}function handleError(_0x50763d,_0x364fe0){_0x364fe0=_0x364fe0||0x1f4;return function(_0x355213){logger['error'](_0x355213[_0x0026('0x3c')]);if(_0x355213['name']){delete _0x355213[_0x0026('0x3d')];}_0x50763d[_0x0026('0x3b')](_0x364fe0)[_0x0026('0x3e')](_0x355213);};}exports[_0x0026('0x3f')]=function(_0x342011,_0x4020c4){var _0x2857e1={'include':[{'model':db['MailServerIn'],'as':_0x0026('0x40')},{'model':db[_0x0026('0x41')],'as':_0x0026('0x42')},{'model':db['Pause'],'as':_0x0026('0x43')}]},_0xbed32e={},_0x359510={'count':0x0,'rows':[]};var _0x3d7d30=_[_0x0026('0x44')](db[_0x0026('0x45')][_0x0026('0x46')],function(_0x57b76c){return{'name':_0x57b76c[_0x0026('0x47')],'type':_0x57b76c[_0x0026('0x48')][_0x0026('0x49')]};});_0xbed32e[_0x0026('0x4a')]=_[_0x0026('0x44')](_0x3d7d30,'name');_0xbed32e[_0x0026('0x4b')]=_[_0x0026('0x4c')](_0x342011[_0x0026('0x4b')]);_0xbed32e[_0x0026('0x4d')]=_[_0x0026('0x4e')](_0xbed32e[_0x0026('0x4a')],_0xbed32e[_0x0026('0x4b')]);_0x2857e1['attributes']=_['intersection'](_0xbed32e['model'],qs[_0x0026('0x4f')](_0x342011[_0x0026('0x4b')][_0x0026('0x4f')]));_0x2857e1[_0x0026('0x50')]=_0x2857e1[_0x0026('0x50')][_0x0026('0x51')]?_0x2857e1['attributes']:_0xbed32e['model'];if(!_0x342011[_0x0026('0x4b')][_0x0026('0x52')](_0x0026('0x53'))){_0x2857e1[_0x0026('0x32')]=qs[_0x0026('0x32')](_0x342011['query'][_0x0026('0x32')]);_0x2857e1['offset']=qs[_0x0026('0x31')](_0x342011[_0x0026('0x4b')]['offset']);}_0x2857e1[_0x0026('0x54')]=qs[_0x0026('0x55')](_0x342011[_0x0026('0x4b')][_0x0026('0x55')]);_0x2857e1[_0x0026('0x56')]=qs[_0x0026('0x4d')](_[_0x0026('0x57')](_0x342011['query'],_0xbed32e[_0x0026('0x4d')]),_0x3d7d30);if(_0x342011[_0x0026('0x4b')][_0x0026('0x58')]){_0x2857e1[_0x0026('0x56')]=_[_0x0026('0x59')](_0x2857e1[_0x0026('0x56')],{'$or':_[_0x0026('0x44')](_0x3d7d30,function(_0x1e877e){if(_0x1e877e[_0x0026('0x48')]!==_0x0026('0x5a')){var _0x35236c={};_0x35236c[_0x1e877e[_0x0026('0x3d')]]={'$like':'%'+_0x342011[_0x0026('0x4b')]['filter']+'%'};return _0x35236c;}})});}_0x2857e1=_[_0x0026('0x59')]({},_0x2857e1,_0x342011[_0x0026('0x5b')]);var _0x288677={'where':_0x2857e1[_0x0026('0x56')]};return db[_0x0026('0x45')][_0x0026('0x30')](_0x288677)[_0x0026('0x22')](function(_0x49cdb6){_0x359510[_0x0026('0x30')]=_0x49cdb6;if(_0x342011[_0x0026('0x4b')]['includeAll']){_0x2857e1[_0x0026('0x5c')]=[{'all':!![]}];}return db[_0x0026('0x45')][_0x0026('0x5d')](_0x2857e1);})['then'](function(_0x5363aa){_0x359510['rows']=_0x5363aa;return _0x359510;})['then'](respondWithFilteredResult(_0x4020c4,_0x2857e1))['catch'](handleError(_0x4020c4,null));};exports[_0x0026('0x5e')]=function(_0x20c7a5,_0x16ecb7){var _0x664f4c={'raw':![],'where':{'id':_0x20c7a5[_0x0026('0x5f')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x0026('0x42')},{'model':db['Pause'],'as':_0x0026('0x43')}]},_0x45bda0={};_0x45bda0[_0x0026('0x4a')]=_['keys'](db['MailAccount']['rawAttributes']);_0x45bda0[_0x0026('0x4b')]=_['keys'](_0x20c7a5[_0x0026('0x4b')]);_0x45bda0[_0x0026('0x4d')]=_['intersection'](_0x45bda0[_0x0026('0x4a')],_0x45bda0[_0x0026('0x4b')]);_0x664f4c[_0x0026('0x50')]=_[_0x0026('0x4e')](_0x45bda0[_0x0026('0x4a')],qs[_0x0026('0x4f')](_0x20c7a5[_0x0026('0x4b')][_0x0026('0x4f')]));_0x664f4c[_0x0026('0x50')]=_0x664f4c[_0x0026('0x50')]['length']?_0x664f4c[_0x0026('0x50')]:_0x45bda0[_0x0026('0x4a')];if(_0x20c7a5[_0x0026('0x4b')][_0x0026('0x60')]){_0x664f4c[_0x0026('0x5c')]=[{'all':!![]}];}_0x664f4c=_[_0x0026('0x59')]({},_0x664f4c,_0x20c7a5[_0x0026('0x5b')]);return db['MailAccount']['find'](_0x664f4c)[_0x0026('0x22')](handleEntityNotFound(_0x16ecb7,null))[_0x0026('0x22')](respondWithResult(_0x16ecb7,null))['catch'](handleError(_0x16ecb7,null));};exports['update']=function(_0x36e7ac,_0x116dd3){if(_0x36e7ac[_0x0026('0x61')]['id']){delete _0x36e7ac[_0x0026('0x61')]['id'];}return db[_0x0026('0x45')][_0x0026('0x62')]({'where':{'id':_0x36e7ac[_0x0026('0x5f')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x0026('0x40')},{'model':db['MailServerOut'],'as':_0x0026('0x42')},{'model':db[_0x0026('0x63')],'as':_0x0026('0x43')}]})[_0x0026('0x22')](handleEntityNotFound(_0x116dd3,null))[_0x0026('0x22')](saveUpdates(_0x36e7ac[_0x0026('0x61')],null))['then'](function(_0x4bf396){if(_0x4bf396&&_0x36e7ac[_0x0026('0x61')][_0x0026('0x40')]){return db[_0x0026('0x64')][_0x0026('0x37')](_0x36e7ac['body'][_0x0026('0x40')],{'where':{'MailAccountId':_0x4bf396['id']}})[_0x0026('0x22')](function(){return _0x4bf396;});}return _0x4bf396;})[_0x0026('0x22')](function(_0x221ba2){if(_0x221ba2&&_0x36e7ac['body']['Smtp']){return db[_0x0026('0x41')][_0x0026('0x37')](_0x36e7ac[_0x0026('0x61')][_0x0026('0x42')],{'where':{'MailAccountId':_0x221ba2['id']}})[_0x0026('0x22')](function(){return _0x221ba2;});}return _0x221ba2;})[_0x0026('0x22')](respondWithResult(_0x116dd3,null))['catch'](handleError(_0x116dd3,null));};exports['describe']=function(_0x571bdb,_0x45b4e2){return db[_0x0026('0x45')][_0x0026('0x65')]()[_0x0026('0x22')](respondWithResult(_0x45b4e2,null))['catch'](handleError(_0x45b4e2,null));};exports[_0x0026('0x66')]=function(_0x2095cd,_0x4e42ad,_0x17a583){if(_0x2095cd[_0x0026('0x61')]['id']){delete _0x2095cd[_0x0026('0x61')]['id'];}return db['MailAccount'][_0x0026('0x62')]({'where':{'id':_0x2095cd[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x4e42ad,null))[_0x0026('0x22')](function(_0x41cab0){if(_0x41cab0){_0x2095cd['body'][_0x0026('0x67')]=_0x41cab0['id'];return db[_0x0026('0x68')][_0x0026('0x69')](_0x2095cd[_0x0026('0x61')]);}})[_0x0026('0x22')](respondWithResult(_0x4e42ad,null))[_0x0026('0x2c')](handleError(_0x4e42ad,null));};exports[_0x0026('0x6a')]=function(_0x39e83b,_0x57fa9c,_0x208517){var _0x5ab7c1={'raw':![],'where':{}};var _0x541ecd={};var _0x504df7={'count':0x0,'rows':[]};return db[_0x0026('0x45')][_0x0026('0x6b')]({'where':{'id':_0x39e83b[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x57fa9c,null))[_0x0026('0x22')](function(_0x2d740e){if(_0x2d740e){_0x541ecd[_0x0026('0x4a')]=_['keys'](db[_0x0026('0x68')]['rawAttributes']);_0x541ecd[_0x0026('0x4b')]=_[_0x0026('0x4c')](_0x39e83b[_0x0026('0x4b')]);_0x541ecd['filters']=_[_0x0026('0x4e')](_0x541ecd[_0x0026('0x4a')],_0x541ecd[_0x0026('0x4b')]);_0x5ab7c1['attributes']=_[_0x0026('0x4e')](_0x541ecd[_0x0026('0x4a')],qs[_0x0026('0x4f')](_0x39e83b['query'][_0x0026('0x4f')]));_0x5ab7c1['attributes']=_0x5ab7c1[_0x0026('0x50')][_0x0026('0x51')]?_0x5ab7c1[_0x0026('0x50')]:_0x541ecd['model'];if(!_0x39e83b[_0x0026('0x4b')]['hasOwnProperty'](_0x0026('0x53'))){_0x5ab7c1['limit']=qs[_0x0026('0x32')](_0x39e83b[_0x0026('0x4b')]['limit']);_0x5ab7c1['offset']=qs['offset'](_0x39e83b[_0x0026('0x4b')][_0x0026('0x31')]);}_0x5ab7c1['order']=qs[_0x0026('0x55')](_0x39e83b[_0x0026('0x4b')]['sort']);_0x5ab7c1[_0x0026('0x56')]=qs[_0x0026('0x4d')](_['pick'](_0x39e83b[_0x0026('0x4b')],_0x541ecd[_0x0026('0x4d')]));_0x5ab7c1[_0x0026('0x56')][_0x0026('0x67')]=_0x2d740e['id'];if(_0x39e83b[_0x0026('0x4b')]['filter']){_0x5ab7c1['where']=_[_0x0026('0x59')](_0x5ab7c1['where'],{'$or':_[_0x0026('0x44')](_0x5ab7c1[_0x0026('0x50')],function(_0x39bd25){var _0x379819={};_0x379819[_0x39bd25]={'$like':'%'+_0x39e83b[_0x0026('0x4b')][_0x0026('0x58')]+'%'};return _0x379819;})});}_0x5ab7c1=_[_0x0026('0x59')]({},_0x5ab7c1,_0x39e83b[_0x0026('0x5b')]);return db[_0x0026('0x68')][_0x0026('0x30')]({'where':_0x5ab7c1['where']})['then'](function(_0x536bd6){_0x504df7[_0x0026('0x30')]=_0x536bd6;if(_0x39e83b[_0x0026('0x4b')][_0x0026('0x60')]){_0x5ab7c1['include']=[{'all':!![]}];}return db[_0x0026('0x68')][_0x0026('0x5d')](_0x5ab7c1);})[_0x0026('0x22')](function(_0x77125f){_0x504df7[_0x0026('0x6c')]=_0x77125f;return _0x504df7;});}})[_0x0026('0x22')](respondWithFilteredResult(_0x57fa9c,_0x5ab7c1))[_0x0026('0x2c')](handleError(_0x57fa9c,null));};exports['removeDispositions']=function(_0x34c4ae,_0x31b6d3,_0x23a199){return db[_0x0026('0x45')]['find']({'where':{'id':_0x34c4ae[_0x0026('0x5f')]['id']}})['then'](handleEntityNotFound(_0x31b6d3,null))[_0x0026('0x22')](function(_0x5ccacb){if(_0x5ccacb){return _0x5ccacb[_0x0026('0x6d')](_0x34c4ae[_0x0026('0x4b')]['ids']);}})[_0x0026('0x22')](respondWithStatusCode(_0x31b6d3,null))[_0x0026('0x2c')](handleError(_0x31b6d3,null));};exports[_0x0026('0x6e')]=function(_0x19ce79,_0x4bb3a4,_0x274e55){if(_0x19ce79[_0x0026('0x61')]['id']){delete _0x19ce79['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x19ce79['params']['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x4bb3a4,null))[_0x0026('0x22')](function(_0x15fc03){if(_0x15fc03){_0x19ce79[_0x0026('0x61')][_0x0026('0x67')]=_0x15fc03['id'];return db['CannedAnswer'][_0x0026('0x69')](_0x19ce79[_0x0026('0x61')]);}})[_0x0026('0x22')](respondWithResult(_0x4bb3a4,null))[_0x0026('0x2c')](handleError(_0x4bb3a4,null));};exports[_0x0026('0x6f')]=function(_0x5e7f34,_0x1fbb24,_0x3b527d){var _0x412a4f={'raw':![],'where':{}};var _0x13850a={};var _0x39d76f={'count':0x0,'rows':[]};return db[_0x0026('0x45')]['findOne']({'where':{'id':_0x5e7f34[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x1fbb24,null))[_0x0026('0x22')](function(_0x1cd935){if(_0x1cd935){_0x13850a[_0x0026('0x4a')]=_[_0x0026('0x4c')](db[_0x0026('0x70')]['rawAttributes']);_0x13850a[_0x0026('0x4b')]=_[_0x0026('0x4c')](_0x5e7f34[_0x0026('0x4b')]);_0x13850a[_0x0026('0x4d')]=_[_0x0026('0x4e')](_0x13850a[_0x0026('0x4a')],_0x13850a[_0x0026('0x4b')]);_0x412a4f[_0x0026('0x50')]=_[_0x0026('0x4e')](_0x13850a[_0x0026('0x4a')],qs[_0x0026('0x4f')](_0x5e7f34[_0x0026('0x4b')][_0x0026('0x4f')]));_0x412a4f[_0x0026('0x50')]=_0x412a4f[_0x0026('0x50')]['length']?_0x412a4f[_0x0026('0x50')]:_0x13850a[_0x0026('0x4a')];if(!_0x5e7f34[_0x0026('0x4b')][_0x0026('0x52')](_0x0026('0x53'))){_0x412a4f['limit']=qs[_0x0026('0x32')](_0x5e7f34[_0x0026('0x4b')][_0x0026('0x32')]);_0x412a4f[_0x0026('0x31')]=qs[_0x0026('0x31')](_0x5e7f34[_0x0026('0x4b')][_0x0026('0x31')]);}_0x412a4f[_0x0026('0x54')]=qs[_0x0026('0x55')](_0x5e7f34['query'][_0x0026('0x55')]);_0x412a4f[_0x0026('0x56')]=qs[_0x0026('0x4d')](_['pick'](_0x5e7f34[_0x0026('0x4b')],_0x13850a[_0x0026('0x4d')]));_0x412a4f['where']['MailAccountId']=_0x1cd935['id'];if(_0x5e7f34[_0x0026('0x4b')]['filter']){_0x412a4f['where']=_[_0x0026('0x59')](_0x412a4f[_0x0026('0x56')],{'$or':_['map'](_0x412a4f['attributes'],function(_0x34eb61){var _0x45a26a={};_0x45a26a[_0x34eb61]={'$like':'%'+_0x5e7f34['query'][_0x0026('0x58')]+'%'};return _0x45a26a;})});}_0x412a4f=_['merge']({},_0x412a4f,_0x5e7f34[_0x0026('0x5b')]);return db['CannedAnswer']['count']({'where':_0x412a4f[_0x0026('0x56')]})['then'](function(_0x3d7ae4){_0x39d76f[_0x0026('0x30')]=_0x3d7ae4;if(_0x5e7f34['query'][_0x0026('0x60')]){_0x412a4f['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x0026('0x5d')](_0x412a4f);})[_0x0026('0x22')](function(_0x4ccc89){_0x39d76f[_0x0026('0x6c')]=_0x4ccc89;return _0x39d76f;});}})[_0x0026('0x22')](respondWithFilteredResult(_0x1fbb24,_0x412a4f))[_0x0026('0x2c')](handleError(_0x1fbb24,null));};exports[_0x0026('0x71')]=function(_0x20735c,_0x5572cf,_0xc903de){return db['MailAccount'][_0x0026('0x62')]({'where':{'id':_0x20735c['params']['id']}})['then'](handleEntityNotFound(_0x5572cf,null))[_0x0026('0x22')](function(_0x451f21){if(_0x451f21){return _0x451f21['removeAnswers'](_0x20735c[_0x0026('0x4b')][_0x0026('0x72')]);}})[_0x0026('0x22')](respondWithStatusCode(_0x5572cf,null))[_0x0026('0x2c')](handleError(_0x5572cf,null));};exports['create']=function(_0x205cfc,_0x3be841){var _0x232342={'name':_0x205cfc[_0x0026('0x61')][_0x0026('0x3d')],'key':_0x205cfc[_0x0026('0x61')][_0x0026('0x49')],'email':_0x205cfc[_0x0026('0x61')]['email'],'ListId':_0x205cfc[_0x0026('0x61')][_0x0026('0x73')],'active':!_['isNil'](_0x205cfc[_0x0026('0x61')][_0x0026('0x74')])?_0x205cfc[_0x0026('0x61')][_0x0026('0x74')]:!![],'description':_0x205cfc[_0x0026('0x61')][_0x0026('0x75')]||null,'Imap':{},'Smtp':{}};if(_[_0x0026('0x76')](_0x205cfc['body'][_0x0026('0x77')])){if(_0x205cfc[_0x0026('0x61')][_0x0026('0x78')]){_0x232342['Imap'][_0x0026('0x79')]=_0x232342[_0x0026('0x42')][_0x0026('0x79')]=_0x205cfc[_0x0026('0x61')]['cuser'];_0x232342[_0x0026('0x40')][_0x0026('0x7a')]=_0x232342['Smtp'][_0x0026('0x7b')]=_0x205cfc['body'][_0x0026('0x7c')];}else{_0x232342[_0x0026('0x40')][_0x0026('0x7d')]=_0x232342[_0x0026('0x42')][_0x0026('0x7d')]=![];}_0x232342[_0x0026('0x40')][_0x0026('0x7e')]=_0x205cfc[_0x0026('0x61')][_0x0026('0x40')][_0x0026('0x7e')];_0x232342[_0x0026('0x40')][_0x0026('0x7f')]=_0x205cfc['body'][_0x0026('0x40')]['port'];_0x232342[_0x0026('0x42')][_0x0026('0x7e')]=_0x205cfc[_0x0026('0x61')][_0x0026('0x42')][_0x0026('0x7e')];_0x232342[_0x0026('0x42')][_0x0026('0x7f')]=_0x205cfc[_0x0026('0x61')]['Smtp'][_0x0026('0x7f')];}else{_0x232342[_0x0026('0x40')][_0x0026('0x80')]=_0x232342[_0x0026('0x42')][_0x0026('0x80')]=_0x205cfc[_0x0026('0x61')][_0x0026('0x77')];_0x232342['Imap'][_0x0026('0x79')]=_0x232342[_0x0026('0x42')]['user']=_0x205cfc[_0x0026('0x61')][_0x0026('0x81')];_0x232342[_0x0026('0x40')]['password']=_0x232342[_0x0026('0x42')]['pass']=_0x205cfc['body']['cpassword'];}return db[_0x0026('0x45')][_0x0026('0x69')](_0x232342,{'include':[{'model':db[_0x0026('0x41')],'as':'Smtp'},{'model':db[_0x0026('0x64')],'as':_0x0026('0x40')}]})[_0x0026('0x22')](function(_0x51246c){var _0x246945=_0x205cfc['user'][_0x0026('0x82')]({'plain':!![]});if(!_0x246945)throw new Error(_0x0026('0x83'));if(_0x246945[_0x0026('0x84')]===_0x0026('0x79')){var _0x1687c4=_0x51246c[_0x0026('0x82')]({'plain':!![]});return db[_0x0026('0x85')][_0x0026('0x62')]({'where':{'name':'MailAccounts','userProfileId':_0x246945[_0x0026('0x86')]},'raw':!![]})['then'](function(_0x352cb9){if(_0x352cb9&&_0x352cb9[_0x0026('0x87')]===0x0){return db[_0x0026('0x3a')][_0x0026('0x69')]({'name':_0x1687c4['name'],'resourceId':_0x1687c4['id'],'type':_0x352cb9[_0x0026('0x3d')],'sectionId':_0x352cb9['id']},{})[_0x0026('0x22')](function(){return _0x51246c;});}else{return _0x51246c;}})[_0x0026('0x2c')](function(_0x3a89b4){logger[_0x0026('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a89b4);throw _0x3a89b4;});}return _0x51246c;})[_0x0026('0x22')](respondWithResult(_0x3be841,0xc9))[_0x0026('0x2c')](handleError(_0x3be841,null));};exports[_0x0026('0x88')]=function(_0x8bfa18,_0x1c9bab,_0x427a86){return db['MailAccount'][_0x0026('0x6b')]({'where':{'id':_0x8bfa18[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x1c9bab,null))[_0x0026('0x22')](function(_0x4115d5){if(_0x4115d5){return _0x4115d5[_0x0026('0x88')]();}return null;})['then'](respondWithResult(_0x1c9bab,null))[_0x0026('0x2c')](handleError(_0x1c9bab,null));};exports[_0x0026('0x89')]=function(_0x391c25,_0x4da749,_0x2408c9){if(_0x391c25[_0x0026('0x61')]['id']){delete _0x391c25['body']['id'];}return db[_0x0026('0x45')][_0x0026('0x62')]({'where':{'id':_0x391c25[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x4da749,null))[_0x0026('0x22')](function(_0x1e9d88){if(_0x1e9d88){_0x391c25[_0x0026('0x61')][_0x0026('0x67')]=_0x1e9d88['id'];return db[_0x0026('0x64')]['create'](_0x391c25['body']);}})[_0x0026('0x22')](respondWithResult(_0x4da749,null))[_0x0026('0x2c')](handleError(_0x4da749,null));};exports['removeImap']=function(_0x2e6cea,_0x494ee8,_0x3a1999){return db[_0x0026('0x45')][_0x0026('0x6b')]({'where':{'id':_0x2e6cea[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x494ee8,null))[_0x0026('0x22')](function(_0x465a1b){if(_0x465a1b){return _0x465a1b[_0x0026('0x8a')](null);}return null;})[_0x0026('0x22')](respondWithStatusCode(_0x494ee8,null))[_0x0026('0x2c')](handleError(_0x494ee8,null));};exports[_0x0026('0x8b')]=function(_0x355861,_0x3af0e1,_0x15f9ba){return db[_0x0026('0x45')][_0x0026('0x6b')]({'where':{'id':_0x355861[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x3af0e1,null))['then'](function(_0x495abf){if(_0x495abf){return _0x495abf[_0x0026('0x8b')]();}return null;})[_0x0026('0x22')](respondWithResult(_0x3af0e1,null))[_0x0026('0x2c')](handleError(_0x3af0e1,null));};exports['addSmtp']=function(_0x5e079a,_0x2f3abd,_0x6be90d){if(_0x5e079a['body']['id']){delete _0x5e079a[_0x0026('0x61')]['id'];}return db[_0x0026('0x45')]['find']({'where':{'id':_0x5e079a[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x2f3abd,null))[_0x0026('0x22')](function(_0x16049c){if(_0x16049c){_0x5e079a['body'][_0x0026('0x67')]=_0x16049c['id'];return db['MailServerOut'][_0x0026('0x69')](_0x5e079a[_0x0026('0x61')]);}})['then'](respondWithResult(_0x2f3abd,null))[_0x0026('0x2c')](handleError(_0x2f3abd,null));};exports[_0x0026('0x8c')]=function(_0x1c01e3,_0x3d1623,_0x2768bc){return db[_0x0026('0x45')][_0x0026('0x6b')]({'where':{'id':_0x1c01e3[_0x0026('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3d1623,null))['then'](function(_0x4d7307){if(_0x4d7307){return _0x4d7307[_0x0026('0x8d')](null);}return null;})[_0x0026('0x22')](respondWithStatusCode(_0x3d1623,null))[_0x0026('0x2c')](handleError(_0x3d1623,null));};exports[_0x0026('0x8e')]=function(_0x470bd1,_0x319e43,_0x3d4ee9){return db[_0x0026('0x8f')]['find']({'where':{'id':_0x470bd1[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x319e43,null))['then'](function(_0xb9d8a0){if(_0xb9d8a0){return _0xb9d8a0[_0x0026('0x8e')](_0x470bd1[_0x0026('0x61')][_0x0026('0x72')],_[_0x0026('0x90')](_0x470bd1[_0x0026('0x61')],[_0x0026('0x72'),'id'])||{});}})[_0x0026('0x22')](respondWithResult(_0x319e43,null))[_0x0026('0x2c')](handleError(_0x319e43,null));};exports['getInteractions']=function(_0x3e445b,_0x2ad60e,_0x5aea99){var _0xefb5b5={'raw':![],'where':{}};var _0x40c38d={};var _0x1d60ef={'count':0x0,'rows':[]};return db[_0x0026('0x45')]['findOne']({'where':{'id':_0x3e445b['params']['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x2ad60e,null))[_0x0026('0x22')](function(_0x3cc746){if(_0x3cc746){_0x40c38d[_0x0026('0x4a')]=_['keys'](db[_0x0026('0x8f')][_0x0026('0x46')]);_0x40c38d['query']=_[_0x0026('0x4c')](_0x3e445b[_0x0026('0x4b')]);_0x40c38d[_0x0026('0x4d')]=_[_0x0026('0x4e')](_0x40c38d[_0x0026('0x4a')],_0x40c38d[_0x0026('0x4b')]);_0xefb5b5['attributes']=_[_0x0026('0x4e')](_0x40c38d[_0x0026('0x4a')],qs['fields'](_0x3e445b[_0x0026('0x4b')]['fields']));_0xefb5b5[_0x0026('0x50')]=_0xefb5b5[_0x0026('0x50')][_0x0026('0x51')]?_0xefb5b5[_0x0026('0x50')]:_0x40c38d[_0x0026('0x4a')];if(!_0x3e445b['query'][_0x0026('0x52')](_0x0026('0x53'))){_0xefb5b5[_0x0026('0x32')]=qs['limit'](_0x3e445b[_0x0026('0x4b')][_0x0026('0x32')]);_0xefb5b5[_0x0026('0x31')]=qs[_0x0026('0x31')](_0x3e445b[_0x0026('0x4b')]['offset']);}_0xefb5b5[_0x0026('0x54')]=qs[_0x0026('0x55')](_0x3e445b['query']['sort']);_0xefb5b5[_0x0026('0x56')]=qs[_0x0026('0x4d')](_[_0x0026('0x57')](_0x3e445b[_0x0026('0x4b')],_0x40c38d['filters']));_0xefb5b5[_0x0026('0x56')][_0x0026('0x67')]=_0x3cc746['id'];if(_0x3e445b[_0x0026('0x4b')][_0x0026('0x58')]){_0xefb5b5[_0x0026('0x56')]=_[_0x0026('0x59')](_0xefb5b5[_0x0026('0x56')],{'$or':_['map'](_0xefb5b5[_0x0026('0x50')],function(_0x3bc8e5){var _0x2fdcd4={};_0x2fdcd4[_0x3bc8e5]={'$like':'%'+_0x3e445b[_0x0026('0x4b')][_0x0026('0x58')]+'%'};return _0x2fdcd4;})});}_0xefb5b5=_[_0x0026('0x59')]({},_0xefb5b5,_0x3e445b['options']);return db['MailInteraction'][_0x0026('0x30')]({'where':_0xefb5b5[_0x0026('0x56')]})[_0x0026('0x22')](function(_0x380733){_0x1d60ef[_0x0026('0x30')]=_0x380733;if(_0x3e445b[_0x0026('0x4b')][_0x0026('0x60')]){_0xefb5b5['include']=[{'model':db['CmContact'],'as':_0x0026('0x91'),'required':![]},{'model':db[_0x0026('0x92')],'as':'Owner','attributes':[_0x0026('0x3d'),_0x0026('0x93'),_0x0026('0x94')],'required':![]},{'model':db['Tag'],'as':_0x0026('0x95'),'attributes':['id',_0x0026('0x3d'),_0x0026('0x96')],'where':_0x3e445b[_0x0026('0x4b')][_0x0026('0x97')]?{'id':_0x3e445b['query'][_0x0026('0x97')]}:undefined,'required':_0x3e445b[_0x0026('0x4b')][_0x0026('0x97')]?!![]:![]}];}return db[_0x0026('0x8f')][_0x0026('0x5d')](_0xefb5b5);})[_0x0026('0x22')](function(_0x3df93e){_0x1d60ef['rows']=_0x3df93e;return _0x1d60ef;});}})[_0x0026('0x22')](respondWithFilteredResult(_0x2ad60e,_0xefb5b5))[_0x0026('0x2c')](handleError(_0x2ad60e,null));};exports['addApplications']=function(_0x198f8c,_0xbab166,_0x24bea6){return db['MailAccount'][_0x0026('0x6b')]({'where':{'id':_0x198f8c['params']['id']}})[_0x0026('0x22')](handleEntityNotFound(_0xbab166,null))['then'](function(_0x1d2344){if(_0x1d2344){return db[_0x0026('0x98')][_0x0026('0x99')](function(_0x5e42d5){return db[_0x0026('0x9a')][_0x0026('0x38')]({'where':{'MailAccountId':_0x198f8c['params']['id']},'transaction':_0x5e42d5})[_0x0026('0x22')](function(_0x3e31b5){var _0xacaf28=_['map'](_0x198f8c[_0x0026('0x61')],function(_0x50a7e2){_0x50a7e2[_0x0026('0x67')]=_0x198f8c[_0x0026('0x5f')]['id'];return _0x50a7e2;});return db[_0x0026('0x9a')][_0x0026('0x9b')](_0xacaf28,{'transaction':_0x5e42d5});});})['then'](function(){return db[_0x0026('0x9a')][_0x0026('0x9c')]({'where':{'MailAccountId':_0x198f8c[_0x0026('0x5f')]['id']},'order':'priority'});});}})[_0x0026('0x22')](respondWithResult(_0xbab166,null))[_0x0026('0x2c')](handleError(_0xbab166,null));};exports['getApplications']=function(_0x34ea07,_0x3c5d88,_0xf27cb6){var _0x5ca943={};var _0x13c72e={};var _0x3af79c;var _0x347e2e;return db[_0x0026('0x45')][_0x0026('0x6b')]({'where':{'id':_0x34ea07['params']['id']}})['then'](handleEntityNotFound(_0x3c5d88,null))[_0x0026('0x22')](function(_0x3b7594){if(_0x3b7594){_0x3af79c=_0x3b7594;_0x13c72e[_0x0026('0x4a')]=_[_0x0026('0x4c')](db[_0x0026('0x9a')][_0x0026('0x46')]);_0x13c72e['query']=_['keys'](_0x34ea07[_0x0026('0x4b')]);_0x13c72e[_0x0026('0x4d')]=_[_0x0026('0x4e')](_0x13c72e[_0x0026('0x4a')],_0x13c72e[_0x0026('0x4b')]);_0x5ca943[_0x0026('0x50')]=_['intersection'](_0x13c72e['model'],qs[_0x0026('0x4f')](_0x34ea07[_0x0026('0x4b')][_0x0026('0x4f')]));_0x5ca943[_0x0026('0x50')]=_0x5ca943[_0x0026('0x50')]['length']?_0x5ca943[_0x0026('0x50')]:_0x13c72e[_0x0026('0x4a')];_0x5ca943[_0x0026('0x54')]=qs[_0x0026('0x55')](_0x34ea07['query']['sort']);_0x5ca943[_0x0026('0x56')]=qs[_0x0026('0x4d')](_[_0x0026('0x57')](_0x34ea07[_0x0026('0x4b')],_0x13c72e[_0x0026('0x4d')]));if(_0x34ea07['query'][_0x0026('0x58')]){_0x5ca943[_0x0026('0x56')]=_[_0x0026('0x59')](_0x5ca943[_0x0026('0x56')],{'$or':_[_0x0026('0x44')](_0x5ca943[_0x0026('0x50')],function(_0x17b46a){var _0x43be1b={};_0x43be1b[_0x17b46a]={'$like':'%'+_0x34ea07[_0x0026('0x4b')][_0x0026('0x58')]+'%'};return _0x43be1b;})});}_0x5ca943=_[_0x0026('0x59')]({},_0x5ca943,_0x34ea07[_0x0026('0x5b')]);return _0x3af79c[_0x0026('0x9d')](_0x5ca943);}})[_0x0026('0x22')](function(_0x5bb8e7){if(_0x5bb8e7){_0x347e2e=_0x5bb8e7[_0x0026('0x51')];if(!_0x34ea07[_0x0026('0x4b')]['hasOwnProperty']('nolimit')){_0x5ca943[_0x0026('0x32')]=qs[_0x0026('0x32')](_0x34ea07[_0x0026('0x4b')][_0x0026('0x32')]);_0x5ca943[_0x0026('0x31')]=qs[_0x0026('0x31')](_0x34ea07[_0x0026('0x4b')]['offset']);}return _0x3af79c[_0x0026('0x9d')](_0x5ca943);}})[_0x0026('0x22')](function(_0x273e22){if(_0x273e22){return _0x273e22?{'count':_0x347e2e,'rows':_0x273e22}:null;}})[_0x0026('0x22')](respondWithResult(_0x3c5d88,null))['catch'](handleError(_0x3c5d88,null));};exports[_0x0026('0x9e')]=function(_0x94c907,_0x5d9d88,_0x113ff5){var _0x3bae1d={'raw':!![],'where':{}};var _0x24f74f={};var _0x242d50={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x94c907[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x5d9d88,null))['then'](function(_0x3d57ef){if(_0x3d57ef){_0x24f74f['model']=_[_0x0026('0x4c')](db[_0x0026('0x9f')][_0x0026('0x46')]);_0x24f74f[_0x0026('0x4b')]=_[_0x0026('0x4c')](_0x94c907[_0x0026('0x4b')]);_0x24f74f[_0x0026('0x4d')]=_['intersection'](_0x24f74f['model'],_0x24f74f['query']);_0x3bae1d['attributes']=_[_0x0026('0x4e')](_0x24f74f['model'],qs['fields'](_0x94c907[_0x0026('0x4b')][_0x0026('0x4f')]));_0x3bae1d[_0x0026('0x50')]=_0x3bae1d[_0x0026('0x50')]['length']?_0x3bae1d[_0x0026('0x50')]:_0x24f74f[_0x0026('0x4a')];if(!_0x94c907[_0x0026('0x4b')]['hasOwnProperty'](_0x0026('0x53'))){_0x3bae1d[_0x0026('0x32')]=qs[_0x0026('0x32')](_0x94c907[_0x0026('0x4b')][_0x0026('0x32')]);_0x3bae1d[_0x0026('0x31')]=qs[_0x0026('0x31')](_0x94c907[_0x0026('0x4b')][_0x0026('0x31')]);}_0x3bae1d[_0x0026('0x54')]=qs['sort'](_0x94c907[_0x0026('0x4b')][_0x0026('0x55')]);_0x3bae1d[_0x0026('0x56')]=qs[_0x0026('0x4d')](_['pick'](_0x94c907[_0x0026('0x4b')],_0x24f74f[_0x0026('0x4d')]));_0x3bae1d[_0x0026('0x56')][_0x0026('0x67')]=_0x3d57ef['id'];if(_0x94c907[_0x0026('0x4b')][_0x0026('0x58')]){_0x3bae1d[_0x0026('0x56')]=_[_0x0026('0x59')](_0x3bae1d['where'],{'$or':_['map'](_0x3bae1d[_0x0026('0x50')],function(_0x5a177b){var _0x36bbcc={};_0x36bbcc[_0x5a177b]={'$like':'%'+_0x94c907['query'][_0x0026('0x58')]+'%'};return _0x36bbcc;})});}if(_0x94c907['query'][_0x0026('0xa0')]){var _0x4d7c8e=_0x94c907[_0x0026('0x4b')][_0x0026('0xa0')][_0x0026('0xa1')](',');var _0x476df6={};_0x476df6[_0x4d7c8e[0x0]]={'$gte':moment(_0x4d7c8e[0x1])[_0x0026('0xa2')](_0x0026('0xa3'))};_0x3bae1d[_0x0026('0x56')]=_[_0x0026('0x59')](_0x3bae1d['where'],_0x476df6);}_0x3bae1d=_[_0x0026('0x59')]({},_0x3bae1d,_0x94c907[_0x0026('0x5b')]);return db[_0x0026('0x9f')][_0x0026('0x30')]({'where':_0x3bae1d[_0x0026('0x56')]})['then'](function(_0x1d1bd1){_0x242d50[_0x0026('0x30')]=_0x1d1bd1;if(_0x94c907[_0x0026('0x4b')]['includeAll']){_0x3bae1d['include']=[{'all':!![]}];}return db['MailMessage'][_0x0026('0x5d')](_0x3bae1d);})[_0x0026('0x22')](function(_0x1c454d){if(_0x94c907[_0x0026('0x4b')][_0x0026('0xa4')]==='true'){for(var _0x1c0553=0x0;_0x1c0553<_0x1c454d[_0x0026('0x51')];_0x1c0553++){_0x1c454d[_0x1c0553][_0x0026('0x61')]=juice(_0x1c454d[_0x1c0553][_0x0026('0x61')]);}}_0x242d50[_0x0026('0x6c')]=_0x1c454d;return _0x242d50;});}})[_0x0026('0x22')](respondWithFilteredResult(_0x5d9d88,_0x3bae1d))[_0x0026('0x2c')](handleError(_0x5d9d88,null));};exports[_0x0026('0x3e')]=function(_0x55d78c,_0x609188,_0x476070){var _0x142004,_0x20d5d0={},_0x1d6ed8;if(_0x55d78c['body']['to']){_0x1d6ed8=_0x55d78c[_0x0026('0x61')]['to'][_0x0026('0xa1')](',')[0x0];}return db[_0x0026('0x45')][_0x0026('0x62')]({'where':{'id':_0x55d78c[_0x0026('0x5f')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x0026('0xa5')],'as':_0x0026('0xa6'),'where':{'email':_0x1d6ed8},'limit':0x1,'order':[[_0x0026('0xa7'),_0x0026('0xa8')]]}]},{'model':db['MailServerOut'],'as':_0x0026('0x42'),'raw':!![]}]})[_0x0026('0x22')](handleEntityNotFound(_0x609188,null))[_0x0026('0x22')](function(_0x1aafa2){if(_0x1aafa2){_0x142004=_0x1aafa2;if(_0x1aafa2[_0x0026('0x42')]){if(_['isNil'](_0x55d78c[_0x0026('0x61')]['from'])){_0x55d78c[_0x0026('0x61')][_0x0026('0xa9')]=util['format']('%s\x20<%s>',_0x1aafa2[_0x0026('0x3d')],_0x1aafa2['email']||_0x1aafa2[_0x0026('0x42')]['user']);}if(_0x55d78c[_0x0026('0x61')]['attachments']&&_0x55d78c[_0x0026('0x61')][_0x0026('0xaa')][_0x0026('0x51')]){for(var _0xe92f07=0x0;_0xe92f07<_0x55d78c[_0x0026('0x61')]['attachments'][_0x0026('0x51')];_0xe92f07+=0x1){_0x55d78c[_0x0026('0x61')][_0x0026('0xaa')][_0xe92f07]={'filename':_0x55d78c[_0x0026('0x61')]['attachments'][_0xe92f07][_0x0026('0x3d')],'path':path[_0x0026('0xab')](config[_0x0026('0xac')],_0x0026('0xad'),_0x55d78c[_0x0026('0x61')][_0x0026('0xaa')][_0xe92f07][_0x0026('0xae')])};}}var _0x151253={'tls':{'rejectUnauthorized':![]}};if(_[_0x0026('0x76')](_0x1aafa2[_0x0026('0x42')]['service'])){if(_0x1aafa2['Smtp'][_0x0026('0x7d')]){_0x151253['auth']={'user':_0x1aafa2[_0x0026('0x42')][_0x0026('0x79')],'pass':_0x1aafa2[_0x0026('0x42')]['pass']};}_0x151253[_0x0026('0x7e')]=_0x1aafa2[_0x0026('0x42')][_0x0026('0x7e')];_0x151253[_0x0026('0x7f')]=_0x1aafa2[_0x0026('0x42')]['port'];_0x151253[_0x0026('0xaf')]=_0x1aafa2[_0x0026('0x42')][_0x0026('0xaf')];}else{_0x151253['service']=_0x1aafa2[_0x0026('0x42')][_0x0026('0x80')];_0x151253[_0x0026('0xb0')]={'user':_0x1aafa2[_0x0026('0x42')][_0x0026('0x79')],'pass':_0x1aafa2[_0x0026('0x42')]['pass']};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x151253,'message':_0x55d78c[_0x0026('0x61')]});}else{throw new Error(_0x0026('0xb1'));}}})[_0x0026('0x22')](function(_0x51e2cf){if(_0x51e2cf){_0x20d5d0=_0x51e2cf;if(_0x142004['List']){if(_0x142004[_0x0026('0xb2')]['Contacts']['length']){return _0x142004[_0x0026('0xb2')]['Contacts'][0x0];}else{return db['CmContact'][_0x0026('0x69')](_[_0x0026('0x1b')](_0x55d78c[_0x0026('0x61')],{'firstName':_0x55d78c[_0x0026('0x61')]['to'],'email':_0x55d78c[_0x0026('0x61')]['to'],'phone':_0x55d78c[_0x0026('0x61')]['to'],'ListId':_0x142004['ListId']}));}}else{throw new Error(_0x0026('0xb1'));}}})[_0x0026('0x22')](function(_0x1d4c94){if(_0x1d4c94){var _0x59fda1={'UserId':_0x55d78c[_0x0026('0x79')]['id'],'ContactId':_0x1d4c94['id'],'MailAccountId':_0x142004['id'],'inReplyTo':_0x20d5d0['messageId'],'to':_0x55d78c[_0x0026('0x61')]['from'],'cc':_0x55d78c['body']['cc'],'subject':_0x55d78c[_0x0026('0x61')][_0x0026('0xb3')],'attach':_0x55d78c['body'][_0x0026('0xb4')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x0026('0xa2')](_0x0026('0xa3')),'lastMsgDirection':_0x0026('0xb5'),'lastMsgBody':_0x55d78c[_0x0026('0x61')][_0x0026('0x61')],'Messages':[_[_0x0026('0x59')](_0x55d78c['body'],{'messageId':_0x20d5d0[_0x0026('0xb6')],'sentAt':moment()[_0x0026('0xa2')](_0x0026('0xa3')),'read':!![],'MailAccountId':_0x142004['id'],'UserId':_0x55d78c[_0x0026('0x79')]['id'],'ContactId':_0x1d4c94['id']})]};if(_0x55d78c[_0x0026('0x61')]['Interaction']){_0x59fda1=_[_0x0026('0x59')](_0x59fda1,_0x55d78c[_0x0026('0x61')][_0x0026('0xb7')]);}return db[_0x0026('0x8f')][_0x0026('0x69')](_0x59fda1,{'include':[{'model':db[_0x0026('0x9f')],'as':'Messages'}]});}})[_0x0026('0x22')](respondWithResult(_0x609188,null))[_0x0026('0x2c')](handleError(_0x609188,null));};exports[_0x0026('0xb8')]=function(_0x3943cd,_0x5ee1c4,_0x1cd5cb){return db[_0x0026('0x45')]['find']({'where':{'id':_0x3943cd[_0x0026('0x5f')]['id']},'include':[{'model':db[_0x0026('0x41')],'as':'Smtp','raw':!![]}]})[_0x0026('0x22')](handleEntityNotFound(_0x5ee1c4,null))[_0x0026('0x22')](function(_0x26530d){if(_0x26530d&&_0x26530d['Smtp']){var _0x54e7f1={'id':_0x26530d['id'],'tls':{'rejectUnauthorized':![]}};if(_0x26530d[_0x0026('0x42')][_0x0026('0x80')]){_0x54e7f1[_0x0026('0x80')]=_0x26530d[_0x0026('0x42')][_0x0026('0x80')];}else{_0x54e7f1['host']=_0x26530d[_0x0026('0x42')][_0x0026('0x7e')];_0x54e7f1['port']=_0x26530d['Smtp'][_0x0026('0x7f')];_0x54e7f1[_0x0026('0xaf')]=_0x26530d[_0x0026('0x42')][_0x0026('0xaf')];}if(_0x26530d['Smtp'][_0x0026('0x7d')]){_0x54e7f1[_0x0026('0xb0')]={'user':_0x26530d[_0x0026('0x42')][_0x0026('0x79')],'pass':_0x26530d['Smtp'][_0x0026('0x7b')]};}return respondWithRpcPromise(_0x0026('0xb9'),'verifySmtp',{'account':_0x54e7f1});}})[_0x0026('0x22')](respondWithResult(_0x5ee1c4,null))[_0x0026('0x2c')](handleError(_0x5ee1c4,null));};exports[_0x0026('0x38')]=function(_0xf74f36,_0x5afdc6){return db[_0x0026('0x45')]['find']({'where':{'id':_0xf74f36[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x5afdc6,null))['then'](function(_0x158749){if(_0x158749&&_0x158749['service']){throw new db[(_0x0026('0xba'))]['ValidationError'](_0x0026('0xbb'));}return _0x158749;})[_0x0026('0x22')](removeEntity(_0x5afdc6,null))[_0x0026('0x2c')](handleError(_0x5afdc6,null));};exports[_0x0026('0xbc')]=function(_0x2be024,_0x2bfdb0,_0x2bd531){return db['MailAccount'][_0x0026('0x62')]({'where':{'id':_0x2be024[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x2bfdb0,null))[_0x0026('0x22')](function(_0x4c2fbf){if(_0x4c2fbf){return _0x4c2fbf[_0x0026('0xbc')](_0x2be024[_0x0026('0x61')][_0x0026('0x72')],_[_0x0026('0x90')](_0x2be024[_0x0026('0x61')],[_0x0026('0x72'),'id'])||{})['spread'](function(_0x1aad42){for(var _0x8ed89=0x0;_0x8ed89<_0x2be024[_0x0026('0x61')][_0x0026('0x72')][_0x0026('0x51')];_0x8ed89+=0x1){socket[_0x0026('0xbd')](_0x0026('0xbe'),{'UserId':_0x2be024[_0x0026('0x61')][_0x0026('0x72')][_0x8ed89],'MailAccountId':_0x2be024['params']['id']});}return _0x1aad42;});}})[_0x0026('0x22')](respondWithResult(_0x2bfdb0,null))[_0x0026('0x2c')](handleError(_0x2bfdb0,null));};exports[_0x0026('0xbf')]=function(_0x4ee322,_0x50c3ce,_0x5b1ef9){return db[_0x0026('0x45')][_0x0026('0x62')]({'where':{'id':_0x4ee322[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x50c3ce,null))[_0x0026('0x22')](function(_0x585ad6){if(_0x585ad6){return _0x585ad6[_0x0026('0xbf')](_0x4ee322['query'][_0x0026('0x72')])[_0x0026('0x22')](function(){if(_[_0x0026('0xc0')](_0x4ee322[_0x0026('0x4b')][_0x0026('0x72')])){for(var _0x7923bc=0x0;_0x7923bc<_0x4ee322[_0x0026('0x4b')][_0x0026('0x72')][_0x0026('0x51')];_0x7923bc+=0x1){socket[_0x0026('0xbd')](_0x0026('0xc1'),{'UserId':Number(_0x4ee322['query']['ids'][_0x7923bc]),'MailAccountId':Number(_0x4ee322[_0x0026('0x5f')]['id'])});}}else{socket[_0x0026('0xbd')](_0x0026('0xc1'),{'UserId':Number(_0x4ee322[_0x0026('0x4b')][_0x0026('0x72')]),'MailAccountId':Number(_0x4ee322['params']['id'])});}});}})[_0x0026('0x22')](respondWithStatusCode(_0x50c3ce,null))[_0x0026('0x2c')](handleError(_0x50c3ce,null));};exports['getAgents']=function(_0x1315a1,_0x53eff6,_0x58c92b){var _0x45ef7e={};var _0x5a849f={};var _0x368a6c;var _0x30d321;return db[_0x0026('0x45')][_0x0026('0x6b')]({'where':{'id':_0x1315a1[_0x0026('0x5f')]['id']}})[_0x0026('0x22')](handleEntityNotFound(_0x53eff6,null))[_0x0026('0x22')](function(_0x2be9d4){if(_0x2be9d4){_0x368a6c=_0x2be9d4;_0x5a849f[_0x0026('0x4a')]=_[_0x0026('0x4c')](db[_0x0026('0x92')]['rawAttributes']);_0x5a849f[_0x0026('0x4b')]=_[_0x0026('0x4c')](_0x1315a1[_0x0026('0x4b')]);_0x5a849f[_0x0026('0x4d')]=_[_0x0026('0x4e')](_0x5a849f[_0x0026('0x4a')],_0x5a849f[_0x0026('0x4b')]);_0x45ef7e[_0x0026('0x50')]=_[_0x0026('0x4e')](_0x5a849f[_0x0026('0x4a')],qs[_0x0026('0x4f')](_0x1315a1[_0x0026('0x4b')]['fields']));_0x45ef7e[_0x0026('0x50')]=_0x45ef7e[_0x0026('0x50')]['length']?_0x45ef7e[_0x0026('0x50')]:_0x5a849f[_0x0026('0x4a')];_0x45ef7e['order']=qs[_0x0026('0x55')](_0x1315a1[_0x0026('0x4b')][_0x0026('0x55')]);_0x45ef7e[_0x0026('0x56')]=qs[_0x0026('0x4d')](_[_0x0026('0x57')](_0x1315a1[_0x0026('0x4b')],_0x5a849f[_0x0026('0x4d')]));if(_0x1315a1[_0x0026('0x4b')][_0x0026('0x58')]){_0x45ef7e[_0x0026('0x56')]=_['merge'](_0x45ef7e['where'],{'$or':_[_0x0026('0x44')](_0x45ef7e[_0x0026('0x50')],function(_0x37644d){var _0xf4efde={};_0xf4efde[_0x37644d]={'$like':'%'+_0x1315a1['query'][_0x0026('0x58')]+'%'};return _0xf4efde;})});}_0x45ef7e=_[_0x0026('0x59')]({},_0x45ef7e,_0x1315a1[_0x0026('0x5b')]);return _0x368a6c['getAgents'](_0x45ef7e);}})[_0x0026('0x22')](function(_0x5570e4){if(_0x5570e4){_0x30d321=_0x5570e4[_0x0026('0x51')];if(!_0x1315a1[_0x0026('0x4b')][_0x0026('0x52')](_0x0026('0x53'))){_0x45ef7e['limit']=qs[_0x0026('0x32')](_0x1315a1['query'][_0x0026('0x32')]);_0x45ef7e[_0x0026('0x31')]=qs[_0x0026('0x31')](_0x1315a1['query'][_0x0026('0x31')]);}return _0x368a6c['getAgents'](_0x45ef7e);}})[_0x0026('0x22')](function(_0x85aaa0){if(_0x85aaa0){return _0x85aaa0?{'count':_0x30d321,'rows':_0x85aaa0}:null;}})[_0x0026('0x22')](respondWithResult(_0x53eff6,null))['catch'](handleError(_0x53eff6,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 40710a3..ea5dece 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 _0x39a3=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update'];(function(_0x540643,_0xa2e0c8){var _0x143606=function(_0x1e1469){while(--_0x1e1469){_0x540643['push'](_0x540643['shift']());}};_0x143606(++_0xa2e0c8);}(_0x39a3,0x9f));var _0x339a=function(_0x482b74,_0x4ff641){_0x482b74=_0x482b74-0x0;var _0x3c478f=_0x39a3[_0x482b74];return _0x3c478f;};'use strict';var EventEmitter=require(_0x339a('0x0'));var MailAccount=require(_0x339a('0x1'))['db'][_0x339a('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x339a('0x3')](0x0);var events={'afterCreate':_0x339a('0x4'),'afterUpdate':_0x339a('0x5'),'afterDestroy':_0x339a('0x6')};function emitEvent(_0x5a4eac){return function(_0x1a822c,_0x351f17,_0x2400d8){MailAccountEvents[_0x339a('0x7')](_0x5a4eac+':'+_0x1a822c['id'],_0x1a822c);MailAccountEvents[_0x339a('0x7')](_0x5a4eac,_0x1a822c);_0x2400d8(null);};}for(var e in events){if(events[_0x339a('0x8')](e)){var event=events[e];MailAccount[_0x339a('0x9')](e,emitEvent(event));}}module[_0x339a('0xa')]=MailAccountEvents; \ No newline at end of file +var _0x2318=['update','remove','emit','hook','exports','events','MailAccount','save'];(function(_0x51cbdc,_0x45dd09){var _0x34b885=function(_0x124f48){while(--_0x124f48){_0x51cbdc['push'](_0x51cbdc['shift']());}};_0x34b885(++_0x45dd09);}(_0x2318,0x175));var _0x8231=function(_0x2d8225,_0xcb0d71){_0x2d8225=_0x2d8225-0x0;var _0x5c2eea=_0x2318[_0x2d8225];return _0x5c2eea;};'use strict';var EventEmitter=require(_0x8231('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x8231('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8231('0x2'),'afterUpdate':_0x8231('0x3'),'afterDestroy':_0x8231('0x4')};function emitEvent(_0xbc1a5f){return function(_0x52ea2e,_0x22200d,_0x140588){MailAccountEvents['emit'](_0xbc1a5f+':'+_0x52ea2e['id'],_0x52ea2e);MailAccountEvents[_0x8231('0x5')](_0xbc1a5f,_0x52ea2e);_0x140588(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x8231('0x6')](e,emitEvent(event));}}module[_0x8231('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index ee3e651..5ff9bfc 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 _0x6177=['../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','util','../../config/logger','api','moment','path','rimraf'];(function(_0x42e4d9,_0x516769){var _0x3588b8=function(_0x14d6a4){while(--_0x14d6a4){_0x42e4d9['push'](_0x42e4d9['shift']());}};_0x3588b8(++_0x516769);}(_0x6177,0x192));var _0x7617=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x6177[_0x2cfb58];return _0xd99951;};'use strict';var _=require('lodash');var util=require(_0x7617('0x0'));var logger=require(_0x7617('0x1'))(_0x7617('0x2'));var moment=require(_0x7617('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7617('0x4'));var rimraf=require(_0x7617('0x5'));var config=require(_0x7617('0x6'));var attributes=require(_0x7617('0x7'));module[_0x7617('0x8')]=function(_0x3e4035,_0x9496c){return _0x3e4035[_0x7617('0x9')](_0x7617('0xa'),attributes,{'tableName':_0x7617('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4766=['MailAccount','mail_accounts','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailAccount.attributes','define'];(function(_0x328dc2,_0x2b9ef0){var _0x2ca728=function(_0x4a7ee8){while(--_0x4a7ee8){_0x328dc2['push'](_0x328dc2['shift']());}};_0x2ca728(++_0x2b9ef0);}(_0x4766,0xe6));var _0x6476=function(_0x4def14,_0x208e20){_0x4def14=_0x4def14-0x0;var _0x377e4c=_0x4766[_0x4def14];return _0x377e4c;};'use strict';var _=require(_0x6476('0x0'));var util=require(_0x6476('0x1'));var logger=require(_0x6476('0x2'))(_0x6476('0x3'));var moment=require(_0x6476('0x4'));var BPromise=require('bluebird');var rp=require(_0x6476('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6476('0x6'));var config=require(_0x6476('0x7'));var attributes=require(_0x6476('0x8'));module['exports']=function(_0x3e7733,_0x210548){return _0x3e7733[_0x6476('0x9')](_0x6476('0xa'),attributes,{'tableName':_0x6476('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 86f0944..afbe089 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 _0x2356=['includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','account','CmList','List','Contacts','DESC','Applications','Smtp','get','omit','applications','orderBy','priority','push','length','close','autoclose','*,*,*,*','create','List\x20not\x20found','contact','generate','messageId','subject','attach','format','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','YYYY-MM-DD\x20HH:mm:ss','MailMessage','attachments','originCc','bcc','Attachments','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','ioredis','../../mysqldb','rpc','client','http','redis','socket.io-emitter','./mailAccount.socket','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailAccount','options','raw','where','attributes','limit','include','model','map','ShowMailAccount','find','body','keys','CmContact','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'];(function(_0x1869c1,_0x5f38af){var _0x5509f9=function(_0x5f3c25){while(--_0x5f3c25){_0x1869c1['push'](_0x1869c1['shift']());}};_0x5509f9(++_0x5f38af);}(_0x2356,0x14f));var _0x6235=function(_0x5b1f99,_0x5400b2){_0x5b1f99=_0x5b1f99-0x0;var _0x478845=_0x2356[_0x5b1f99];return _0x478845;};'use strict';var _=require('lodash');var util=require(_0x6235('0x0'));var moment=require(_0x6235('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6235('0x2'));var db=require(_0x6235('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6235('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6235('0x5')][_0x6235('0x6')]({'port':0x232c});config[_0x6235('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6235('0x8'))(new Redis(config['redis']));require(_0x6235('0x9'))[_0x6235('0xa')](socket);function respondWithRpcPromise(_0x3e0f96,_0x31fc6e,_0x5de19a){return new BPromise(function(_0x46fecf,_0x1b34a5){return client[_0x6235('0xb')](_0x3e0f96,_0x5de19a)[_0x6235('0xc')](function(_0x14342d){logger['info'](_0x6235('0xd'),_0x31fc6e,_0x6235('0xe'));logger[_0x6235('0xf')](_0x6235('0x10'),_0x31fc6e,'request\x20sent',JSON[_0x6235('0x11')](_0x14342d));if(_0x14342d[_0x6235('0x12')]){if(_0x14342d['error'][_0x6235('0x13')]===0x1f4){logger['error'](_0x6235('0xd'),_0x31fc6e,_0x14342d[_0x6235('0x12')]['message']);return _0x1b34a5(_0x14342d[_0x6235('0x12')][_0x6235('0x14')]);}logger[_0x6235('0x12')](_0x6235('0xd'),_0x31fc6e,_0x14342d['error'][_0x6235('0x14')]);return _0x46fecf(_0x14342d[_0x6235('0x12')][_0x6235('0x14')]);}else{logger[_0x6235('0x15')](_0x6235('0xd'),_0x31fc6e,_0x6235('0xe'));_0x46fecf(_0x14342d[_0x6235('0x16')][_0x6235('0x14')]);}})[_0x6235('0x17')](function(_0x1f8cd3){logger['error'](_0x6235('0xd'),_0x31fc6e,_0x1f8cd3);_0x1b34a5(_0x1f8cd3);});});}exports[_0x6235('0x18')]=function(_0x4a9846){var _0x534dab=this;return new Promise(function(_0x19075e,_0x4f0aa2){return db['MailAccount']['findAll']({'raw':_0x4a9846[_0x6235('0x19')]?_0x4a9846[_0x6235('0x19')][_0x6235('0x1a')]===undefined?!![]:![]:!![],'where':_0x4a9846[_0x6235('0x19')]?_0x4a9846[_0x6235('0x19')][_0x6235('0x1b')]||null:null,'attributes':_0x4a9846['options']?_0x4a9846['options'][_0x6235('0x1c')]||null:null,'limit':_0x4a9846['options']?_0x4a9846[_0x6235('0x19')][_0x6235('0x1d')]||null:null,'include':_0x4a9846[_0x6235('0x19')]?_0x4a9846[_0x6235('0x19')][_0x6235('0x1e')]?_['map'](_0x4a9846[_0x6235('0x19')][_0x6235('0x1e')],function(_0x168b01){return{'model':db[_0x168b01[_0x6235('0x1f')]],'as':_0x168b01['as'],'attributes':_0x168b01[_0x6235('0x1c')],'include':_0x168b01['include']?_['map'](_0x168b01['include'],function(_0x4f28f2){return{'model':db[_0x4f28f2[_0x6235('0x1f')]],'as':_0x4f28f2['as'],'attributes':_0x4f28f2[_0x6235('0x1c')],'include':_0x4f28f2[_0x6235('0x1e')]?_[_0x6235('0x20')](_0x4f28f2[_0x6235('0x1e')],function(_0x2acc8c){return{'model':db[_0x2acc8c['model']],'as':_0x2acc8c['as'],'attributes':_0x2acc8c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x94db3c){logger['info'](_0x6235('0x18'),_0x4a9846);logger[_0x6235('0xf')]('GetMailAccount',_0x4a9846,JSON[_0x6235('0x11')](_0x94db3c));_0x19075e(_0x94db3c);})[_0x6235('0x17')](function(_0x5bb691){logger[_0x6235('0x12')](_0x6235('0x18'),_0x5bb691[_0x6235('0x14')],_0x4a9846);_0x4f0aa2(_0x534dab[_0x6235('0x12')](0x1f4,_0x5bb691[_0x6235('0x14')]));});});};exports[_0x6235('0x21')]=function(_0x281e01){var _0x43a430=this;return new Promise(function(_0x2bdeda,_0x2e233d){return db['MailAccount'][_0x6235('0x22')]({'raw':_0x281e01['options']?_0x281e01['options'][_0x6235('0x1a')]===undefined?!![]:![]:!![],'where':_0x281e01['options']?_0x281e01['options'][_0x6235('0x1b')]||null:null,'attributes':_0x281e01['options']?_0x281e01['options'][_0x6235('0x1c')]||null:null,'include':_0x281e01[_0x6235('0x19')]?_0x281e01[_0x6235('0x19')]['include']?_[_0x6235('0x20')](_0x281e01[_0x6235('0x19')][_0x6235('0x1e')],function(_0x4db26d){return{'model':db[_0x4db26d[_0x6235('0x1f')]],'as':_0x4db26d['as'],'attributes':_0x4db26d['attributes'],'include':_0x4db26d[_0x6235('0x1e')]?_[_0x6235('0x20')](_0x4db26d[_0x6235('0x1e')],function(_0xcb0901){return{'model':db[_0xcb0901[_0x6235('0x1f')]],'as':_0xcb0901['as'],'attributes':_0xcb0901['attributes'],'include':_0xcb0901[_0x6235('0x1e')]?_['map'](_0xcb0901[_0x6235('0x1e')],function(_0x706301){return{'model':db[_0x706301[_0x6235('0x1f')]],'as':_0x706301['as'],'attributes':_0x706301[_0x6235('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6235('0xc')](function(_0x4f0461){logger['info'](_0x6235('0x21'),_0x281e01);logger[_0x6235('0xf')](_0x6235('0x21'),_0x281e01,JSON[_0x6235('0x11')](_0x4f0461));_0x2bdeda(_0x4f0461);})[_0x6235('0x17')](function(_0x4057aa){logger[_0x6235('0x12')](_0x6235('0x21'),_0x4057aa[_0x6235('0x14')],_0x281e01);_0x2e233d(_0x43a430[_0x6235('0x12')](0x1f4,_0x4057aa['message']));});});};exports['NotifyMailAccount']=function(_0x4d1cac){var _0x50537b=this;return new Promise(function(_0x585744,_0x1f32ed){var _0x3c2935={'body':_0x4d1cac[_0x6235('0x23')],'channel':'mail'};var _0x4054fe=_['difference'](_[_0x6235('0x24')](db[_0x6235('0x25')][_0x6235('0x26')]),[_0x6235('0x27'),_0x6235('0x28'),_0x6235('0x29'),_0x6235('0x2a')]);var _0x13f974=![];if(_0x4d1cac['body']['id']){delete _0x4d1cac['body']['id'];}if(_[_0x6235('0x2b')](_0x4d1cac['body'][_0x6235('0x2c')])){return _0x1f32ed(_0x50537b[_0x6235('0x12')](0x1f4,_0x6235('0x2d')));}if(_[_0x6235('0x2b')](_0x4d1cac[_0x6235('0x23')][_0x6235('0x23')])||_0x4d1cac[_0x6235('0x23')]['body']===''){return _0x1f32ed(_0x50537b[_0x6235('0x12')](0x1f4,_0x6235('0x2e')));}if(_[_0x6235('0x2b')](_0x4d1cac['body'][_0x6235('0x2f')])){return _0x1f32ed(_0x50537b[_0x6235('0x12')](0x1f4,_0x6235('0x30')+_0x4054fe));}if(!_[_0x6235('0x31')](_0x4054fe,_0x4d1cac[_0x6235('0x23')][_0x6235('0x2f')])){return _0x1f32ed(_0x50537b[_0x6235('0x12')](0x1f4,_0x6235('0x32')+_0x4054fe));}var _0x596f24={};_0x596f24[_0x4d1cac[_0x6235('0x23')][_0x6235('0x2f')]]=_0x4d1cac[_0x6235('0x23')]['from'];return db[_0x6235('0x33')][_0x6235('0x22')]({'where':{'id':_0x4d1cac[_0x6235('0x34')]['id']},'include':[{'model':db[_0x6235('0x35')],'as':_0x6235('0x36'),'include':[{'model':db[_0x6235('0x25')],'as':_0x6235('0x37'),'where':_0x596f24,'limit':0x1,'order':[[_0x6235('0x28'),_0x6235('0x38')]]}]},{'model':db['MailApplication'],'as':_0x6235('0x39')},{'model':db['MailServerOut'],'as':_0x6235('0x3a')}]})[_0x6235('0xc')](function(_0xe997ab){if(_0xe997ab&&_0xe997ab['List']){var _0x53c398=_0xe997ab[_0x6235('0x3b')]({'plain':!![]});_0x3c2935[_0x6235('0x34')]=_[_0x6235('0x3c')](_0x53c398,[_0x6235('0x39'),'List']);_0x3c2935[_0x6235('0x3d')]=_0x53c398[_0x6235('0x39')];_0x3c2935['list']=_0x53c398[_0x6235('0x36')];_0x3c2935['applications']=_[_0x6235('0x3e')](_0x3c2935[_0x6235('0x3d')],[_0x6235('0x3f')],['asc']);if(_0x3c2935[_0x6235('0x34')]&&_0x3c2935['account']['autoclose']){_0x3c2935['applications'][_0x6235('0x40')]({'id':0x0,'priority':_0x3c2935[_0x6235('0x3d')][_0x6235('0x41')]+0x1,'app':_0x6235('0x42'),'appdata':_0x6235('0x43'),'interval':_0x6235('0x44')});}if(_0x3c2935[_0x6235('0x34')]['Applications']){delete _0x3c2935[_0x6235('0x34')][_0x6235('0x39')];}if(_0x3c2935[_0x6235('0x34')][_0x6235('0x36')]){delete _0x3c2935['account'][_0x6235('0x36')];}if(_0x53c398[_0x6235('0x36')][_0x6235('0x37')]['length']){return _0x53c398[_0x6235('0x36')]['Contacts'][0x0];}var _0x4a4ad3=_['defaults'](_0x4d1cac[_0x6235('0x23')],{'firstName':_0x4d1cac['body'][_0x6235('0x2c')],'ListId':_0x53c398[_0x6235('0x2a')]});_0x4a4ad3[_0x4d1cac[_0x6235('0x23')]['mapKey']]=_0x4d1cac[_0x6235('0x23')]['from'];return db[_0x6235('0x25')][_0x6235('0x45')](_0x4a4ad3);}else{throw new Error(_0x6235('0x46'));}})[_0x6235('0xc')](function(_0x76bd9e){_0x3c2935[_0x6235('0x47')]=_0x76bd9e;if(_0x76bd9e){if(!_0x4d1cac[_0x6235('0x23')][_0x6235('0x14')]['messageId']){_0x4d1cac[_0x6235('0x23')][_0x6235('0x14')]['messageId']=rs[_0x6235('0x48')]()+'\x20'+_0x4d1cac['body']['message'][_0x6235('0x2c')];}var _0x5d3dd2={'ContactId':_0x76bd9e['id'],'MailAccountId':_0x4d1cac[_0x6235('0x34')]['id'],'inReplyTo':_0x4d1cac[_0x6235('0x23')][_0x6235('0x14')][_0x6235('0x49')],'to':_0x4d1cac[_0x6235('0x23')][_0x6235('0x14')][_0x6235('0x2c')],'cc':_0x4d1cac[_0x6235('0x23')][_0x6235('0x14')]['cc'],'subject':_0x4d1cac[_0x6235('0x23')][_0x6235('0x14')][_0x6235('0x4a')],'attach':_0x4d1cac[_0x6235('0x23')][_0x6235('0x14')][_0x6235('0x4b')],'lastMsgAt':moment()[_0x6235('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x4d1cac[_0x6235('0x23')][_0x6235('0x23')]};return db['MailInteraction'][_0x6235('0x22')]({'where':{'closed':![],'MailAccountId':_0x4d1cac[_0x6235('0x34')]['id']},'include':[{'model':db['MailMessage'],'as':_0x6235('0x4d'),'attributes':[_0x6235('0x49')],'where':{'messageId':_0x4d1cac['body'][_0x6235('0x14')][_0x6235('0x4e')]}}]})[_0x6235('0xc')](function(_0x557496){if(_0x557496){return[_0x557496,![]];}return db[_0x6235('0x4f')][_0x6235('0x45')](_0x5d3dd2)['then'](function(_0x5169f3){return[_0x5169f3,!![]];});});}else{throw new Error(_0x6235('0x50'));}})[_0x6235('0x51')](function(_0x39fab0,_0xcd5157){if(_0x39fab0){_0x13f974=_0xcd5157;if(!_0xcd5157){return _0x39fab0[_0x6235('0x52')]({'inReplyTo':_0x4d1cac[_0x6235('0x23')][_0x6235('0x14')][_0x6235('0x49')],'to':_0x4d1cac[_0x6235('0x23')][_0x6235('0x14')][_0x6235('0x2c')],'cc':_0x4d1cac[_0x6235('0x23')][_0x6235('0x14')]['cc'],'subject':_0x4d1cac[_0x6235('0x23')][_0x6235('0x14')][_0x6235('0x4a')],'attach':_0x39fab0[_0x6235('0x4b')]?_0x39fab0[_0x6235('0x4b')]:_0x4d1cac[_0x6235('0x23')][_0x6235('0x14')]['attach'],'substatus':null,'substatusAt':moment()[_0x6235('0x4c')](_0x6235('0x53')),'lastMsgAt':moment()[_0x6235('0x4c')](_0x6235('0x53')),'lastMsgDirection':'in','lastMsgBody':_0x4d1cac[_0x6235('0x23')][_0x6235('0x23')]});}else{return _0x39fab0;}}})['then'](function(_0x8943b1){_0x3c2935['interaction']=_0x8943b1[_0x6235('0x3b')]({'plain':!![]});_0x3c2935['interaction']['created']=_0x13f974;return db[_0x6235('0x54')][_0x6235('0x45')]({'body':_0x4d1cac[_0x6235('0x23')][_0x6235('0x23')],'MailAccountId':_0x4d1cac[_0x6235('0x34')]['id'],'MailInteractionId':_0x8943b1['id'],'direction':'in','ContactId':_0x3c2935[_0x6235('0x47')]['id'],'messageId':_0x4d1cac[_0x6235('0x23')]['message'][_0x6235('0x49')],'from':_0x4d1cac[_0x6235('0x23')]['message'][_0x6235('0x2c')],'to':_0x4d1cac[_0x6235('0x23')]['message']['to'],'cc':_0x4d1cac[_0x6235('0x23')][_0x6235('0x14')]['cc'],'subject':_0x4d1cac[_0x6235('0x23')][_0x6235('0x14')][_0x6235('0x4a')],'attach':_0x4d1cac['body'][_0x6235('0x14')][_0x6235('0x4b')],'Attachments':_0x4d1cac[_0x6235('0x23')][_0x6235('0x14')][_0x6235('0x55')],'originTo':_0x4d1cac[_0x6235('0x23')]['message']['originTo'],'originCc':_0x4d1cac[_0x6235('0x23')][_0x6235('0x14')][_0x6235('0x56')],'bcc':_0x4d1cac['body'][_0x6235('0x14')][_0x6235('0x57')]},{'include':[{'model':db['Attachment'],'as':_0x6235('0x58')}]});})[_0x6235('0xc')](function(_0x563d20){_0x3c2935[_0x6235('0x14')]=_0x563d20;if(_0x3c2935['interaction'][_0x6235('0x59')]){return db['User'][_0x6235('0x22')]({'attributes':['id',_0x6235('0x5a')],'where':{'id':_0x3c2935['interaction'][_0x6235('0x59')]}})[_0x6235('0xc')](function(_0x2d669e){if(_0x2d669e){_0x3c2935[_0x6235('0x3d')][_0x6235('0x5b')]({'id':0x0,'priority':0x0,'app':_0x6235('0x5c'),'appdata':_0x2d669e[_0x6235('0x5a')]+','+(_0x3c2935[_0x6235('0x34')][_0x6235('0x5d')]||0xa),'interval':_0x6235('0x44')});}return respondWithRpcPromise(_0x6235('0x5e'),_0x6235('0x5f'),_0x3c2935);});}return respondWithRpcPromise(_0x6235('0x5e'),_0x6235('0x5f'),_0x3c2935);})[_0x6235('0xc')](function(_0x4b5e71){_0x585744(_0x4b5e71);})['catch'](function(_0x56273b){_0x1f32ed(_0x50537b[_0x6235('0x12')](0x1f4,_0x56273b['message']));});});}; \ No newline at end of file +var _0x4517=['catch','GetMailAccount','MailAccount','findAll','options','attributes','limit','include','map','model','ShowMailAccount','raw','where','NotifyMailAccount','keys','CmContact','updatedAt','ListId','body','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','omit','list','orderBy','applications','priority','asc','autoclose','push','length','close','*,*,*,*','from','create','List\x20not\x20found','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','update','format','interaction','get','contact','attachments','originCc','bcc','Attachment','UserId','User','find','name','agent','Start','startRouting','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4517,0x112));var _0x7451=function(_0x5e4f50,_0x486764){_0x5e4f50=_0x5e4f50-0x0;var _0x4536aa=_0x4517[_0x5e4f50];return _0x4536aa;};'use strict';var _=require('lodash');var util=require(_0x7451('0x0'));var moment=require(_0x7451('0x1'));var BPromise=require('bluebird');var rs=require(_0x7451('0x2'));var fs=require('fs');var Redis=require(_0x7451('0x3'));var db=require(_0x7451('0x4'))['db'];var utils=require(_0x7451('0x5'));var logger=require(_0x7451('0x6'))(_0x7451('0x7'));var config=require(_0x7451('0x8'));var jayson=require(_0x7451('0x9'));var client=jayson[_0x7451('0xa')][_0x7451('0xb')]({'port':0x232c});config[_0x7451('0xc')]=_[_0x7451('0xd')](config[_0x7451('0xc')],{'host':_0x7451('0xe'),'port':0x18eb});var socket=require(_0x7451('0xf'))(new Redis(config[_0x7451('0xc')]));require(_0x7451('0x10'))['register'](socket);function respondWithRpcPromise(_0x29f2e1,_0xc586c3,_0x310fd1){return new BPromise(function(_0x197f6d,_0x323ba5){return client[_0x7451('0x11')](_0x29f2e1,_0x310fd1)[_0x7451('0x12')](function(_0x4aab85){logger['info'](_0x7451('0x13'),_0xc586c3,'request\x20sent');logger[_0x7451('0x14')](_0x7451('0x15'),_0xc586c3,'request\x20sent',JSON[_0x7451('0x16')](_0x4aab85));if(_0x4aab85[_0x7451('0x17')]){if(_0x4aab85['error'][_0x7451('0x18')]===0x1f4){logger[_0x7451('0x17')](_0x7451('0x13'),_0xc586c3,_0x4aab85[_0x7451('0x17')]['message']);return _0x323ba5(_0x4aab85[_0x7451('0x17')][_0x7451('0x19')]);}logger[_0x7451('0x17')]('MailAccount,\x20%s,\x20%s',_0xc586c3,_0x4aab85['error'][_0x7451('0x19')]);return _0x197f6d(_0x4aab85[_0x7451('0x17')][_0x7451('0x19')]);}else{logger[_0x7451('0x1a')](_0x7451('0x13'),_0xc586c3,_0x7451('0x1b'));_0x197f6d(_0x4aab85[_0x7451('0x1c')][_0x7451('0x19')]);}})[_0x7451('0x1d')](function(_0x5e52fe){logger[_0x7451('0x17')](_0x7451('0x13'),_0xc586c3,_0x5e52fe);_0x323ba5(_0x5e52fe);});});}exports[_0x7451('0x1e')]=function(_0x59e07e){var _0x59562d=this;return new Promise(function(_0x33f01c,_0x3ffb08){return db[_0x7451('0x1f')][_0x7451('0x20')]({'raw':_0x59e07e[_0x7451('0x21')]?_0x59e07e[_0x7451('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x59e07e[_0x7451('0x21')]?_0x59e07e[_0x7451('0x21')]['where']||null:null,'attributes':_0x59e07e[_0x7451('0x21')]?_0x59e07e[_0x7451('0x21')][_0x7451('0x22')]||null:null,'limit':_0x59e07e['options']?_0x59e07e[_0x7451('0x21')][_0x7451('0x23')]||null:null,'include':_0x59e07e[_0x7451('0x21')]?_0x59e07e[_0x7451('0x21')][_0x7451('0x24')]?_[_0x7451('0x25')](_0x59e07e[_0x7451('0x21')][_0x7451('0x24')],function(_0x3c4eae){return{'model':db[_0x3c4eae['model']],'as':_0x3c4eae['as'],'attributes':_0x3c4eae[_0x7451('0x22')],'include':_0x3c4eae[_0x7451('0x24')]?_['map'](_0x3c4eae['include'],function(_0xcc793e){return{'model':db[_0xcc793e[_0x7451('0x26')]],'as':_0xcc793e['as'],'attributes':_0xcc793e[_0x7451('0x22')],'include':_0xcc793e[_0x7451('0x24')]?_[_0x7451('0x25')](_0xcc793e[_0x7451('0x24')],function(_0x4b5b26){return{'model':db[_0x4b5b26[_0x7451('0x26')]],'as':_0x4b5b26['as'],'attributes':_0x4b5b26['attributes']};}):[]};}):[]};}):[]:[]})[_0x7451('0x12')](function(_0x6c10ee){logger['info'](_0x7451('0x1e'),_0x59e07e);logger[_0x7451('0x14')](_0x7451('0x1e'),_0x59e07e,JSON[_0x7451('0x16')](_0x6c10ee));_0x33f01c(_0x6c10ee);})[_0x7451('0x1d')](function(_0x4e24f7){logger[_0x7451('0x17')](_0x7451('0x1e'),_0x4e24f7[_0x7451('0x19')],_0x59e07e);_0x3ffb08(_0x59562d['error'](0x1f4,_0x4e24f7[_0x7451('0x19')]));});});};exports[_0x7451('0x27')]=function(_0x5dfc5e){var _0x4caef4=this;return new Promise(function(_0x10ba2c,_0x1363a6){return db['MailAccount']['find']({'raw':_0x5dfc5e[_0x7451('0x21')]?_0x5dfc5e[_0x7451('0x21')][_0x7451('0x28')]===undefined?!![]:![]:!![],'where':_0x5dfc5e[_0x7451('0x21')]?_0x5dfc5e[_0x7451('0x21')][_0x7451('0x29')]||null:null,'attributes':_0x5dfc5e[_0x7451('0x21')]?_0x5dfc5e[_0x7451('0x21')]['attributes']||null:null,'include':_0x5dfc5e[_0x7451('0x21')]?_0x5dfc5e[_0x7451('0x21')]['include']?_[_0x7451('0x25')](_0x5dfc5e[_0x7451('0x21')][_0x7451('0x24')],function(_0x93269f){return{'model':db[_0x93269f[_0x7451('0x26')]],'as':_0x93269f['as'],'attributes':_0x93269f[_0x7451('0x22')],'include':_0x93269f['include']?_[_0x7451('0x25')](_0x93269f[_0x7451('0x24')],function(_0x49d59e){return{'model':db[_0x49d59e[_0x7451('0x26')]],'as':_0x49d59e['as'],'attributes':_0x49d59e[_0x7451('0x22')],'include':_0x49d59e['include']?_['map'](_0x49d59e['include'],function(_0x54b60f){return{'model':db[_0x54b60f['model']],'as':_0x54b60f['as'],'attributes':_0x54b60f[_0x7451('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7451('0x12')](function(_0x3647f8){logger[_0x7451('0x1a')](_0x7451('0x27'),_0x5dfc5e);logger['debug']('ShowMailAccount',_0x5dfc5e,JSON['stringify'](_0x3647f8));_0x10ba2c(_0x3647f8);})['catch'](function(_0x5d11f0){logger[_0x7451('0x17')](_0x7451('0x27'),_0x5d11f0[_0x7451('0x19')],_0x5dfc5e);_0x1363a6(_0x4caef4[_0x7451('0x17')](0x1f4,_0x5d11f0[_0x7451('0x19')]));});});};exports[_0x7451('0x2a')]=function(_0xdbbc08){var _0x305cd5=this;return new Promise(function(_0x201d96,_0x92840){var _0x264c74={'body':_0xdbbc08['body'],'channel':'mail'};var _0x169d18=_['difference'](_[_0x7451('0x2b')](db[_0x7451('0x2c')]['rawAttributes']),['createdAt',_0x7451('0x2d'),'CompanyId',_0x7451('0x2e')]);var _0x514a3c=![];if(_0xdbbc08[_0x7451('0x2f')]['id']){delete _0xdbbc08[_0x7451('0x2f')]['id'];}if(_['isNil'](_0xdbbc08[_0x7451('0x2f')]['from'])){return _0x92840(_0x305cd5[_0x7451('0x17')](0x1f4,_0x7451('0x30')));}if(_[_0x7451('0x31')](_0xdbbc08[_0x7451('0x2f')][_0x7451('0x2f')])||_0xdbbc08[_0x7451('0x2f')][_0x7451('0x2f')]===''){return _0x92840(_0x305cd5[_0x7451('0x17')](0x1f4,_0x7451('0x32')));}if(_[_0x7451('0x31')](_0xdbbc08[_0x7451('0x2f')][_0x7451('0x33')])){return _0x92840(_0x305cd5[_0x7451('0x17')](0x1f4,_0x7451('0x34')+_0x169d18));}if(!_['includes'](_0x169d18,_0xdbbc08[_0x7451('0x2f')][_0x7451('0x33')])){return _0x92840(_0x305cd5[_0x7451('0x17')](0x1f4,_0x7451('0x35')+_0x169d18));}var _0x5bca4d={};_0x5bca4d[_0xdbbc08[_0x7451('0x2f')]['mapKey']]=_0xdbbc08['body']['from'];return db['MailAccount']['find']({'where':{'id':_0xdbbc08[_0x7451('0x36')]['id']},'include':[{'model':db[_0x7451('0x37')],'as':_0x7451('0x38'),'include':[{'model':db['CmContact'],'as':_0x7451('0x39'),'where':_0x5bca4d,'limit':0x1,'order':[[_0x7451('0x2d'),_0x7451('0x3a')]]}]},{'model':db[_0x7451('0x3b')],'as':_0x7451('0x3c')},{'model':db[_0x7451('0x3d')],'as':_0x7451('0x3e')}]})[_0x7451('0x12')](function(_0x14e7dc){if(_0x14e7dc&&_0x14e7dc['List']){var _0x4c779f=_0x14e7dc['get']({'plain':!![]});_0x264c74[_0x7451('0x36')]=_[_0x7451('0x3f')](_0x4c779f,[_0x7451('0x3c'),'List']);_0x264c74['applications']=_0x4c779f['Applications'];_0x264c74[_0x7451('0x40')]=_0x4c779f['List'];_0x264c74['applications']=_[_0x7451('0x41')](_0x264c74[_0x7451('0x42')],[_0x7451('0x43')],[_0x7451('0x44')]);if(_0x264c74[_0x7451('0x36')]&&_0x264c74['account'][_0x7451('0x45')]){_0x264c74['applications'][_0x7451('0x46')]({'id':0x0,'priority':_0x264c74[_0x7451('0x42')][_0x7451('0x47')]+0x1,'app':_0x7451('0x48'),'appdata':_0x7451('0x45'),'interval':_0x7451('0x49')});}if(_0x264c74[_0x7451('0x36')][_0x7451('0x3c')]){delete _0x264c74[_0x7451('0x36')]['Applications'];}if(_0x264c74['account'][_0x7451('0x38')]){delete _0x264c74[_0x7451('0x36')]['List'];}if(_0x4c779f['List']['Contacts'][_0x7451('0x47')]){return _0x4c779f[_0x7451('0x38')][_0x7451('0x39')][0x0];}var _0x22c4db=_[_0x7451('0xd')](_0xdbbc08[_0x7451('0x2f')],{'firstName':_0xdbbc08['body'][_0x7451('0x4a')],'ListId':_0x4c779f['ListId']});_0x22c4db[_0xdbbc08['body']['mapKey']]=_0xdbbc08[_0x7451('0x2f')][_0x7451('0x4a')];return db[_0x7451('0x2c')][_0x7451('0x4b')](_0x22c4db);}else{throw new Error(_0x7451('0x4c'));}})[_0x7451('0x12')](function(_0x36add5){_0x264c74['contact']=_0x36add5;if(_0x36add5){if(!_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x4d')]){_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x4d')]=rs[_0x7451('0x4e')]()+'\x20'+_0xdbbc08['body'][_0x7451('0x19')][_0x7451('0x4a')];}var _0x20bb3c={'ContactId':_0x36add5['id'],'MailAccountId':_0xdbbc08[_0x7451('0x36')]['id'],'inReplyTo':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')]['messageId'],'to':_0xdbbc08[_0x7451('0x2f')]['message']['from'],'cc':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')]['cc'],'subject':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x4f')],'attach':_0xdbbc08[_0x7451('0x2f')]['message'][_0x7451('0x50')],'lastMsgAt':moment()['format'](_0x7451('0x51')),'lastMsgDirection':'in','lastMsgBody':_0xdbbc08[_0x7451('0x2f')]['body']};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0xdbbc08['account']['id']},'include':[{'model':db[_0x7451('0x52')],'as':_0x7451('0x53'),'attributes':[_0x7451('0x4d')],'where':{'messageId':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x54')]}}]})['then'](function(_0x3de4c4){if(_0x3de4c4){return[_0x3de4c4,![]];}return db['MailInteraction'][_0x7451('0x4b')](_0x20bb3c)[_0x7451('0x12')](function(_0x184574){return[_0x184574,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x207593,_0x3cee16){if(_0x207593){_0x514a3c=_0x3cee16;if(!_0x3cee16){return _0x207593[_0x7451('0x55')]({'inReplyTo':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x4d')],'to':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x4a')],'cc':_0xdbbc08[_0x7451('0x2f')]['message']['cc'],'subject':_0xdbbc08['body'][_0x7451('0x19')][_0x7451('0x4f')],'attach':_0x207593[_0x7451('0x50')]?_0x207593['attach']:_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x50')],'substatus':null,'substatusAt':moment()['format'](_0x7451('0x51')),'lastMsgAt':moment()[_0x7451('0x56')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0xdbbc08['body'][_0x7451('0x2f')]});}else{return _0x207593;}}})[_0x7451('0x12')](function(_0x55d485){_0x264c74[_0x7451('0x57')]=_0x55d485[_0x7451('0x58')]({'plain':!![]});_0x264c74['interaction']['created']=_0x514a3c;return db['MailMessage'][_0x7451('0x4b')]({'body':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x2f')],'MailAccountId':_0xdbbc08[_0x7451('0x36')]['id'],'MailInteractionId':_0x55d485['id'],'direction':'in','ContactId':_0x264c74[_0x7451('0x59')]['id'],'messageId':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x4d')],'from':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x4a')],'to':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')]['to'],'cc':_0xdbbc08['body'][_0x7451('0x19')]['cc'],'subject':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x4f')],'attach':_0xdbbc08['body'][_0x7451('0x19')]['attach'],'Attachments':_0xdbbc08['body'][_0x7451('0x19')][_0x7451('0x5a')],'originTo':_0xdbbc08['body'][_0x7451('0x19')]['originTo'],'originCc':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x5b')],'bcc':_0xdbbc08[_0x7451('0x2f')][_0x7451('0x19')][_0x7451('0x5c')]},{'include':[{'model':db[_0x7451('0x5d')],'as':'Attachments'}]});})['then'](function(_0x5e6139){_0x264c74[_0x7451('0x19')]=_0x5e6139;if(_0x264c74[_0x7451('0x57')][_0x7451('0x5e')]){return db[_0x7451('0x5f')][_0x7451('0x60')]({'attributes':['id',_0x7451('0x61')],'where':{'id':_0x264c74['interaction']['UserId']}})[_0x7451('0x12')](function(_0x3e3417){if(_0x3e3417){_0x264c74[_0x7451('0x42')]['unshift']({'id':0x0,'priority':0x0,'app':_0x7451('0x62'),'appdata':_0x3e3417[_0x7451('0x61')]+','+(_0x264c74['account']['waitForTheAssignedAgent']||0xa),'interval':_0x7451('0x49')});}return respondWithRpcPromise(_0x7451('0x63'),_0x7451('0x64'),_0x264c74);});}return respondWithRpcPromise(_0x7451('0x63'),_0x7451('0x64'),_0x264c74);})[_0x7451('0x12')](function(_0x361e57){_0x201d96(_0x361e57);})[_0x7451('0x1d')](function(_0x1e02aa){_0x92840(_0x305cd5[_0x7451('0x17')](0x1f4,_0x1e02aa[_0x7451('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 872ea92..6f86277 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 _0xbdb9=['update','register','length','mailAccount:','./mailAccount.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdb9,0xac));var _0x9bdb=function(_0x1740c4,_0x1274db){_0x1740c4=_0x1740c4-0x0;var _0x3d9018=_0xbdb9[_0x1740c4];return _0x3d9018;};'use strict';var MailAccountEvents=require(_0x9bdb('0x0'));var events=[_0x9bdb('0x1'),_0x9bdb('0x2'),_0x9bdb('0x3')];function createListener(_0x23595d,_0x4fe743){return function(_0x24a6af){_0x4fe743['emit'](_0x23595d,_0x24a6af);};}function removeListener(_0x5dbce0,_0x5870f6){return function(){MailAccountEvents['removeListener'](_0x5dbce0,_0x5870f6);};}exports[_0x9bdb('0x4')]=function(_0x4f9fbe){for(var _0x225a66=0x0,_0x4e9c54=events[_0x9bdb('0x5')];_0x225a66<_0x4e9c54;_0x225a66++){var _0x27cdd8=events[_0x225a66];var _0x27c6b8=createListener(_0x9bdb('0x6')+_0x27cdd8,_0x4f9fbe);MailAccountEvents['on'](_0x27cdd8,_0x27c6b8);}}; \ No newline at end of file +var _0x0967=['emit','register','length','mailAccount:','./mailAccount.events','remove','update'];(function(_0x3f389f,_0x3f29e0){var _0x1f8796=function(_0x1483b3){while(--_0x1483b3){_0x3f389f['push'](_0x3f389f['shift']());}};_0x1f8796(++_0x3f29e0);}(_0x0967,0x100));var _0x7096=function(_0x111be8,_0x16ab9c){_0x111be8=_0x111be8-0x0;var _0x1eab53=_0x0967[_0x111be8];return _0x1eab53;};'use strict';var MailAccountEvents=require(_0x7096('0x0'));var events=['save',_0x7096('0x1'),_0x7096('0x2')];function createListener(_0x29b2ba,_0xc0c6b1){return function(_0x31f0b1){_0xc0c6b1[_0x7096('0x3')](_0x29b2ba,_0x31f0b1);};}function removeListener(_0x4106a2,_0x2a50e2){return function(){MailAccountEvents['removeListener'](_0x4106a2,_0x2a50e2);};}exports[_0x7096('0x4')]=function(_0x10181c){for(var _0xadd502=0x0,_0x1344c3=events[_0x7096('0x5')];_0xadd502<_0x1344c3;_0xadd502++){var _0x20f7ef=events[_0xadd502];var _0x2832fc=createListener(_0x7096('0x6')+_0x20f7ef,_0x10181c);MailAccountEvents['on'](_0x20f7ef,_0x2832fc);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 1eb9289..593f3c9 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 _0xeffd=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer'];(function(_0x50b76d,_0x5ef05b){var _0x2fa42a=function(_0x328c7f){while(--_0x328c7f){_0x50b76d['push'](_0x50b76d['shift']());}};_0x2fa42a(++_0x5ef05b);}(_0xeffd,0x6b));var _0xdeff=function(_0x3f44f4,_0x400917){_0x3f44f4=_0x3f44f4-0x0;var _0x3b5d02=_0xeffd[_0x3f44f4];return _0x3b5d02;};'use strict';var multer=require(_0xdeff('0x0'));var util=require('util');var path=require(_0xdeff('0x1'));var timeout=require(_0xdeff('0x2'));var express=require(_0xdeff('0x3'));var router=express[_0xdeff('0x4')]();var auth=require(_0xdeff('0x5'));var interaction=require(_0xdeff('0x6'));var config=require(_0xdeff('0x7'));var controller=require(_0xdeff('0x8'));router[_0xdeff('0x9')](_0xdeff('0xa'),auth[_0xdeff('0xb')](),controller[_0xdeff('0xc')]);router[_0xdeff('0xd')](_0xdeff('0xa'),auth[_0xdeff('0xb')](),controller[_0xdeff('0xe')]);router[_0xdeff('0xf')]('/:id',auth[_0xdeff('0xb')](),controller[_0xdeff('0x10')]);module[_0xdeff('0x11')]=router; \ No newline at end of file +var _0xea28=['/:id','show','put','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xea28,0x13a));var _0x8ea2=function(_0x4df858,_0x24abe0){_0x4df858=_0x4df858-0x0;var _0x177d26=_0xea28[_0x4df858];return _0x177d26;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var auth=require(_0x8ea2('0x6'));var interaction=require(_0x8ea2('0x7'));var config=require('../../config/environment');var controller=require(_0x8ea2('0x8'));router[_0x8ea2('0x9')](_0x8ea2('0xa'),auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xc')](_0x8ea2('0xa'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xf')](_0x8ea2('0xa'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);module[_0x8ea2('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index b73b899..6e3e1bc 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 _0x4c60=['exports','INTEGER','STRING','sequelize'];(function(_0xc1bc76,_0x1c2107){var _0x1d346f=function(_0x10dece){while(--_0x10dece){_0xc1bc76['push'](_0xc1bc76['shift']());}};_0x1d346f(++_0x1c2107);}(_0x4c60,0x97));var _0x04c6=function(_0xfacf56,_0x4f5183){_0xfacf56=_0xfacf56-0x0;var _0x2076b6=_0x4c60[_0xfacf56];return _0x2076b6;};'use strict';var Sequelize=require(_0x04c6('0x0'));module[_0x04c6('0x1')]={'priority':{'type':Sequelize[_0x04c6('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x04c6('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x04c6('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x1298=['STRING','noop'];(function(_0x4d9359,_0x59bd36){var _0x1d509a=function(_0x3a6947){while(--_0x3a6947){_0x4d9359['push'](_0x4d9359['shift']());}};_0x1d509a(++_0x59bd36);}(_0x1298,0x1a0));var _0x8129=function(_0x365b35,_0x4f0239){_0x365b35=_0x365b35-0x0;var _0x1ad5ce=_0x1298[_0x365b35];return _0x1ad5ce;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8129('0x0')],'allowNull':![],'defaultValue':_0x8129('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8129('0x0')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index c5004ce..a08f206 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 _0x9958=['then','error','stack','name','send','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','length','includeAll','merge','options','find','body','params','catch','destroy','html-pdf','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update'];(function(_0x2a5569,_0x2aa635){var _0x485d12=function(_0x3a1417){while(--_0x3a1417){_0x2a5569['push'](_0x2a5569['shift']());}};_0x485d12(++_0x2aa635);}(_0x9958,0x1ea));var _0x8995=function(_0x2c77d1,_0x690747){_0x2c77d1=_0x2c77d1-0x0;var _0x13265f=_0x9958[_0x2c77d1];return _0x13265f;};'use strict';var pdf=require(_0x8995('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8995('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8995('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8995('0x3'));var Mustache=require(_0x8995('0x4'));var util=require('util');var path=require(_0x8995('0x5'));var sox=require(_0x8995('0x6'));var csv=require(_0x8995('0x7'));var ejs=require(_0x8995('0x8'));var fs=require('fs');var _=require(_0x8995('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8995('0xa'));var toCsv=require(_0x8995('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8995('0xb'));var qs=require(_0x8995('0xc'));var as=require(_0x8995('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8995('0xe'));var utils=require('../../config/utils');var config=require(_0x8995('0xf'));var licenseUtil=require(_0x8995('0x10'));var db=require(_0x8995('0x11'))['db'];function respondWithStatusCode(_0x49558e,_0x3f7dc4){_0x3f7dc4=_0x3f7dc4||0xcc;return function(_0x1d1f0e){if(_0x1d1f0e){return _0x49558e[_0x8995('0x12')](_0x3f7dc4);}return _0x49558e[_0x8995('0x13')](_0x3f7dc4)[_0x8995('0x14')]();};}function respondWithResult(_0x507a06,_0x55c3ba){_0x55c3ba=_0x55c3ba||0xc8;return function(_0x4ee9dd){if(_0x4ee9dd){return _0x507a06[_0x8995('0x13')](_0x55c3ba)['json'](_0x4ee9dd);}};}function respondWithFilteredResult(_0x49ff61,_0x592ad1){return function(_0xd4222f){if(_0xd4222f){var _0x112a91=_0xd4222f['count'],_0x2fc4e1=_0x592ad1[_0x8995('0x15')],_0xfe0a8c=_0x592ad1[_0x8995('0x15')]+_0x592ad1[_0x8995('0x16')],_0x348ac6;if(_0xfe0a8c>=_0x112a91){_0xfe0a8c=_0x112a91;_0x348ac6=0xc8;}else{_0x348ac6=0xce;}_0x49ff61[_0x8995('0x13')](_0x348ac6);return _0x49ff61[_0x8995('0x17')](_0x8995('0x18'),_0x2fc4e1+'-'+_0xfe0a8c+'/'+_0x112a91)[_0x8995('0x19')](_0xd4222f);}return null;};}function patchUpdates(_0x5ee9e2){return function(_0x2638c6){try{jsonpatch[_0x8995('0x1a')](_0x2638c6,_0x5ee9e2,!![]);}catch(_0x214b1e){return BPromise[_0x8995('0x1b')](_0x214b1e);}return _0x2638c6[_0x8995('0x1c')]();};}function saveUpdates(_0x5d2215,_0x1a1bc2){return function(_0x594aea){if(_0x594aea){return _0x594aea[_0x8995('0x1d')](_0x5d2215)[_0x8995('0x1e')](function(_0x52688b){return _0x52688b;});}return null;};}function removeEntity(_0x4c3d00,_0x25b472){return function(_0x2dedc1){if(_0x2dedc1){return _0x2dedc1['destroy']()[_0x8995('0x1e')](function(){_0x4c3d00[_0x8995('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7102,_0x4efb63){return function(_0x5a6f32){if(!_0x5a6f32){_0x9d7102[_0x8995('0x12')](0x194);}return _0x5a6f32;};}function handleError(_0x4c4166,_0x1b55d1){_0x1b55d1=_0x1b55d1||0x1f4;return function(_0x2995b7){logger[_0x8995('0x1f')](_0x2995b7[_0x8995('0x20')]);if(_0x2995b7[_0x8995('0x21')]){delete _0x2995b7[_0x8995('0x21')];}_0x4c4166['status'](_0x1b55d1)[_0x8995('0x22')](_0x2995b7);};}exports['show']=function(_0x13a19b,_0x2f5900){var _0x1c9982={'raw':!![],'where':{'id':_0x13a19b['params']['id']}},_0x2aff6f={};_0x2aff6f[_0x8995('0x23')]=_[_0x8995('0x24')](db[_0x8995('0x25')][_0x8995('0x26')]);_0x2aff6f[_0x8995('0x27')]=_[_0x8995('0x24')](_0x13a19b['query']);_0x2aff6f[_0x8995('0x28')]=_[_0x8995('0x29')](_0x2aff6f['model'],_0x2aff6f[_0x8995('0x27')]);_0x1c9982[_0x8995('0x2a')]=_['intersection'](_0x2aff6f['model'],qs['fields'](_0x13a19b[_0x8995('0x27')]['fields']));_0x1c9982[_0x8995('0x2a')]=_0x1c9982[_0x8995('0x2a')][_0x8995('0x2b')]?_0x1c9982[_0x8995('0x2a')]:_0x2aff6f['model'];if(_0x13a19b[_0x8995('0x27')][_0x8995('0x2c')]){_0x1c9982['include']=[{'all':!![]}];}_0x1c9982=_[_0x8995('0x2d')]({},_0x1c9982,_0x13a19b[_0x8995('0x2e')]);return db[_0x8995('0x25')][_0x8995('0x2f')](_0x1c9982)[_0x8995('0x1e')](handleEntityNotFound(_0x2f5900,null))['then'](respondWithResult(_0x2f5900,null))['catch'](handleError(_0x2f5900,null));};exports['update']=function(_0x53e9b1,_0x34a218){if(_0x53e9b1['body']['id']){delete _0x53e9b1[_0x8995('0x30')]['id'];}return db[_0x8995('0x25')][_0x8995('0x2f')]({'where':{'id':_0x53e9b1[_0x8995('0x31')]['id']}})[_0x8995('0x1e')](handleEntityNotFound(_0x34a218,null))[_0x8995('0x1e')](saveUpdates(_0x53e9b1['body'],null))[_0x8995('0x1e')](respondWithResult(_0x34a218,null))[_0x8995('0x32')](handleError(_0x34a218,null));};exports[_0x8995('0x33')]=function(_0x1c4bd1,_0x549e52){return db['MailApplication'][_0x8995('0x2f')]({'where':{'id':_0x1c4bd1[_0x8995('0x31')]['id']}})['then'](handleEntityNotFound(_0x549e52,null))[_0x8995('0x1e')](removeEntity(_0x549e52,null))[_0x8995('0x32')](handleError(_0x549e52,null));}; \ No newline at end of file +var _0xfc45=['body','MailApplication','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','squel','crypto','jsforce','desk.js','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','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','params','query','keys','filters','intersection','attributes','model','fields','includeAll','include','merge','find','catch'];(function(_0x533437,_0x4d59d1){var _0x53f4ce=function(_0x483f6b){while(--_0x483f6b){_0x533437['push'](_0x533437['shift']());}};_0x53f4ce(++_0x4d59d1);}(_0xfc45,0x152));var _0x5fc4=function(_0x36d0f8,_0xa0f6d8){_0x36d0f8=_0x36d0f8-0x0;var _0x177352=_0xfc45[_0x36d0f8];return _0x177352;};'use strict';var pdf=require(_0x5fc4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5fc4('0x1'));var zipdir=require(_0x5fc4('0x2'));var jsonpatch=require(_0x5fc4('0x3'));var rp=require(_0x5fc4('0x4'));var moment=require('moment');var BPromise=require(_0x5fc4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5fc4('0x6'));var sox=require('sox');var csv=require(_0x5fc4('0x7'));var ejs=require(_0x5fc4('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5fc4('0x9'));var crypto=require(_0x5fc4('0xa'));var jsforce=require(_0x5fc4('0xb'));var deskjs=require(_0x5fc4('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5fc4('0xd'));var Redis=require('ioredis');var authService=require(_0x5fc4('0xe'));var qs=require(_0x5fc4('0xf'));var as=require(_0x5fc4('0x10'));var hardwareService=require(_0x5fc4('0x11'));var logger=require(_0x5fc4('0x12'))(_0x5fc4('0x13'));var utils=require(_0x5fc4('0x14'));var config=require(_0x5fc4('0x15'));var licenseUtil=require(_0x5fc4('0x16'));var db=require(_0x5fc4('0x17'))['db'];function respondWithStatusCode(_0x2b50ca,_0x437578){_0x437578=_0x437578||0xcc;return function(_0xde6cc){if(_0xde6cc){return _0x2b50ca['sendStatus'](_0x437578);}return _0x2b50ca[_0x5fc4('0x18')](_0x437578)[_0x5fc4('0x19')]();};}function respondWithResult(_0x5a820a,_0x42341){_0x42341=_0x42341||0xc8;return function(_0x545a8e){if(_0x545a8e){return _0x5a820a[_0x5fc4('0x18')](_0x42341)[_0x5fc4('0x1a')](_0x545a8e);}};}function respondWithFilteredResult(_0x2a00e0,_0x3881c0){return function(_0x862b23){if(_0x862b23){var _0x1abd77=_0x862b23[_0x5fc4('0x1b')],_0x56f6e4=_0x3881c0[_0x5fc4('0x1c')],_0x5153f3=_0x3881c0[_0x5fc4('0x1c')]+_0x3881c0['limit'],_0x28956;if(_0x5153f3>=_0x1abd77){_0x5153f3=_0x1abd77;_0x28956=0xc8;}else{_0x28956=0xce;}_0x2a00e0[_0x5fc4('0x18')](_0x28956);return _0x2a00e0['set'](_0x5fc4('0x1d'),_0x56f6e4+'-'+_0x5153f3+'/'+_0x1abd77)[_0x5fc4('0x1a')](_0x862b23);}return null;};}function patchUpdates(_0x33e966){return function(_0xd959f6){try{jsonpatch[_0x5fc4('0x1e')](_0xd959f6,_0x33e966,!![]);}catch(_0x11e00a){return BPromise[_0x5fc4('0x1f')](_0x11e00a);}return _0xd959f6[_0x5fc4('0x20')]();};}function saveUpdates(_0x5c0eaf,_0x415d0d){return function(_0x47a691){if(_0x47a691){return _0x47a691[_0x5fc4('0x21')](_0x5c0eaf)[_0x5fc4('0x22')](function(_0x511fd4){return _0x511fd4;});}return null;};}function removeEntity(_0x5f3262,_0x69dd2){return function(_0x91279c){if(_0x91279c){return _0x91279c[_0x5fc4('0x23')]()[_0x5fc4('0x22')](function(){_0x5f3262[_0x5fc4('0x18')](0xcc)[_0x5fc4('0x19')]();});}};}function handleEntityNotFound(_0x41f2a5,_0x400149){return function(_0x5a47b3){if(!_0x5a47b3){_0x41f2a5[_0x5fc4('0x24')](0x194);}return _0x5a47b3;};}function handleError(_0x1c8d38,_0xd49a3c){_0xd49a3c=_0xd49a3c||0x1f4;return function(_0x29e29d){logger[_0x5fc4('0x25')](_0x29e29d[_0x5fc4('0x26')]);if(_0x29e29d[_0x5fc4('0x27')]){delete _0x29e29d[_0x5fc4('0x27')];}_0x1c8d38['status'](_0xd49a3c)[_0x5fc4('0x28')](_0x29e29d);};}exports['show']=function(_0x1901e7,_0x7ebbaa){var _0x48e118={'raw':!![],'where':{'id':_0x1901e7[_0x5fc4('0x29')]['id']}},_0x215952={};_0x215952['model']=_['keys'](db['MailApplication']['rawAttributes']);_0x215952[_0x5fc4('0x2a')]=_[_0x5fc4('0x2b')](_0x1901e7[_0x5fc4('0x2a')]);_0x215952[_0x5fc4('0x2c')]=_[_0x5fc4('0x2d')](_0x215952['model'],_0x215952[_0x5fc4('0x2a')]);_0x48e118[_0x5fc4('0x2e')]=_[_0x5fc4('0x2d')](_0x215952[_0x5fc4('0x2f')],qs[_0x5fc4('0x30')](_0x1901e7[_0x5fc4('0x2a')][_0x5fc4('0x30')]));_0x48e118[_0x5fc4('0x2e')]=_0x48e118[_0x5fc4('0x2e')]['length']?_0x48e118['attributes']:_0x215952['model'];if(_0x1901e7[_0x5fc4('0x2a')][_0x5fc4('0x31')]){_0x48e118[_0x5fc4('0x32')]=[{'all':!![]}];}_0x48e118=_[_0x5fc4('0x33')]({},_0x48e118,_0x1901e7['options']);return db['MailApplication'][_0x5fc4('0x34')](_0x48e118)[_0x5fc4('0x22')](handleEntityNotFound(_0x7ebbaa,null))['then'](respondWithResult(_0x7ebbaa,null))[_0x5fc4('0x35')](handleError(_0x7ebbaa,null));};exports[_0x5fc4('0x21')]=function(_0x17b28d,_0x106854){if(_0x17b28d['body']['id']){delete _0x17b28d[_0x5fc4('0x36')]['id'];}return db[_0x5fc4('0x37')]['find']({'where':{'id':_0x17b28d['params']['id']}})['then'](handleEntityNotFound(_0x106854,null))[_0x5fc4('0x22')](saveUpdates(_0x17b28d[_0x5fc4('0x36')],null))[_0x5fc4('0x22')](respondWithResult(_0x106854,null))['catch'](handleError(_0x106854,null));};exports[_0x5fc4('0x23')]=function(_0x59e2a6,_0x4c6016){return db[_0x5fc4('0x37')][_0x5fc4('0x34')]({'where':{'id':_0x59e2a6[_0x5fc4('0x29')]['id']}})[_0x5fc4('0x22')](handleEntityNotFound(_0x4c6016,null))['then'](removeEntity(_0x4c6016,null))['catch'](handleError(_0x4c6016,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 0e35e4d..78b31b0 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 _0xafcd=['rimraf','../../config/environment','./mailApplication.attributes','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xafcd,0x157));var _0xdafc=function(_0x4d77a4,_0x3be85a){_0x4d77a4=_0x4d77a4-0x0;var _0x15a00e=_0xafcd[_0x4d77a4];return _0x15a00e;};'use strict';var _=require(_0xdafc('0x0'));var util=require(_0xdafc('0x1'));var logger=require(_0xdafc('0x2'))(_0xdafc('0x3'));var moment=require(_0xdafc('0x4'));var BPromise=require(_0xdafc('0x5'));var rp=require(_0xdafc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdafc('0x7'));var config=require(_0xdafc('0x8'));var attributes=require(_0xdafc('0x9'));module['exports']=function(_0x3b4373,_0x2aa781){return _0x3b4373[_0xdafc('0xa')]('MailApplication',attributes,{'tableName':_0xdafc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdafc('0xc'),'collate':_0xdafc('0xd')});}; \ No newline at end of file +var _0xb0ee=['rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x387dc1,_0x3ba649){var _0x17567c=function(_0x4690aa){while(--_0x4690aa){_0x387dc1['push'](_0x387dc1['shift']());}};_0x17567c(++_0x3ba649);}(_0xb0ee,0x18f));var _0xeb0e=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xb0ee[_0x26f702];return _0x11417d;};'use strict';var _=require('lodash');var util=require(_0xeb0e('0x0'));var logger=require(_0xeb0e('0x1'))(_0xeb0e('0x2'));var moment=require(_0xeb0e('0x3'));var BPromise=require(_0xeb0e('0x4'));var rp=require(_0xeb0e('0x5'));var fs=require('fs');var path=require(_0xeb0e('0x6'));var rimraf=require(_0xeb0e('0x7'));var config=require(_0xeb0e('0x8'));var attributes=require(_0xeb0e('0x9'));module['exports']=function(_0x1a95ad,_0x1e8dca){return _0x1a95ad[_0xeb0e('0xa')](_0xeb0e('0xb'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeb0e('0xc'),'collate':_0xeb0e('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 1054e60..d47f279 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 _0x8189=['request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailApplication','MailApplication','update','options','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x14d3f8,_0x2f1a01){var _0x199e6b=function(_0xff05f9){while(--_0xff05f9){_0x14d3f8['push'](_0x14d3f8['shift']());}};_0x199e6b(++_0x2f1a01);}(_0x8189,0x1e2));var _0x9818=function(_0x585075,_0x2d1e6e){_0x585075=_0x585075-0x0;var _0x14f527=_0x8189[_0x585075];return _0x14f527;};'use strict';var _=require(_0x9818('0x0'));var util=require(_0x9818('0x1'));var moment=require(_0x9818('0x2'));var BPromise=require(_0x9818('0x3'));var rs=require(_0x9818('0x4'));var fs=require('fs');var Redis=require(_0x9818('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9818('0x6'));var logger=require('../../config/logger')(_0x9818('0x7'));var config=require(_0x9818('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9818('0x9')][_0x9818('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x442a7e,_0x13ea4e,_0xd075f9){return new BPromise(function(_0x3f39f5,_0x54304f){return client[_0x9818('0xb')](_0x442a7e,_0xd075f9)[_0x9818('0xc')](function(_0x4908e2){logger[_0x9818('0xd')](_0x9818('0xe'),_0x13ea4e,_0x9818('0xf'));logger['debug'](_0x9818('0x10'),_0x13ea4e,'request\x20sent',JSON[_0x9818('0x11')](_0x4908e2));if(_0x4908e2['error']){if(_0x4908e2[_0x9818('0x12')][_0x9818('0x13')]===0x1f4){logger[_0x9818('0x12')](_0x9818('0xe'),_0x13ea4e,_0x4908e2[_0x9818('0x12')]['message']);return _0x54304f(_0x4908e2[_0x9818('0x12')][_0x9818('0x14')]);}logger['error'](_0x9818('0xe'),_0x13ea4e,_0x4908e2[_0x9818('0x12')]['message']);return _0x3f39f5(_0x4908e2[_0x9818('0x12')][_0x9818('0x14')]);}else{logger['info'](_0x9818('0xe'),_0x13ea4e,_0x9818('0xf'));_0x3f39f5(_0x4908e2['result'][_0x9818('0x14')]);}})[_0x9818('0x15')](function(_0x402e63){logger[_0x9818('0x12')]('MailApplication,\x20%s,\x20%s',_0x13ea4e,_0x402e63);_0x54304f(_0x402e63);});});}exports[_0x9818('0x16')]=function(_0xb407b1){var _0x184dbf=this;return new Promise(function(_0x299952,_0x1ae7fc){return db[_0x9818('0x17')][_0x9818('0x18')](_0xb407b1['body'],{'raw':_0xb407b1['options']?_0xb407b1[_0x9818('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb407b1[_0x9818('0x19')]?_0xb407b1[_0x9818('0x19')]['where']||null:null,'attributes':_0xb407b1['options']?_0xb407b1[_0x9818('0x19')][_0x9818('0x1a')]||null:null,'limit':_0xb407b1[_0x9818('0x19')]?_0xb407b1[_0x9818('0x19')][_0x9818('0x1b')]||null:null})[_0x9818('0xc')](function(_0x2903a2){logger['info']('UpdateMailApplication',_0xb407b1);logger[_0x9818('0x1c')]('UpdateMailApplication',_0xb407b1,JSON['stringify'](_0x2903a2));_0x299952(_0x2903a2);})[_0x9818('0x15')](function(_0x1e4377){logger[_0x9818('0x12')](_0x9818('0x16'),_0x1e4377[_0x9818('0x14')],_0xb407b1);_0x1ae7fc(_0x184dbf[_0x9818('0x12')](0x1f4,_0x1e4377[_0x9818('0x14')]));});});}; \ No newline at end of file +var _0x08a2=['attributes','limit','UpdateMailApplication','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','MailApplication','update','body','options','raw','where'];(function(_0x314134,_0x28129f){var _0x49b69b=function(_0x3a53d3){while(--_0x3a53d3){_0x314134['push'](_0x314134['shift']());}};_0x49b69b(++_0x28129f);}(_0x08a2,0xec));var _0x208a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x08a2[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x208a('0x0'));var util=require(_0x208a('0x1'));var moment=require(_0x208a('0x2'));var BPromise=require(_0x208a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x208a('0x4'));var db=require(_0x208a('0x5'))['db'];var utils=require(_0x208a('0x6'));var logger=require('../../config/logger')(_0x208a('0x7'));var config=require(_0x208a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x208a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ce3e6,_0x17b7ff,_0x5e6755){return new BPromise(function(_0x1e9676,_0x4dd043){return client[_0x208a('0xa')](_0x4ce3e6,_0x5e6755)[_0x208a('0xb')](function(_0x2636d1){logger[_0x208a('0xc')](_0x208a('0xd'),_0x17b7ff,_0x208a('0xe'));logger[_0x208a('0xf')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x17b7ff,_0x208a('0xe'),JSON['stringify'](_0x2636d1));if(_0x2636d1[_0x208a('0x10')]){if(_0x2636d1[_0x208a('0x10')]['code']===0x1f4){logger['error'](_0x208a('0xd'),_0x17b7ff,_0x2636d1['error'][_0x208a('0x11')]);return _0x4dd043(_0x2636d1[_0x208a('0x10')][_0x208a('0x11')]);}logger[_0x208a('0x10')](_0x208a('0xd'),_0x17b7ff,_0x2636d1[_0x208a('0x10')]['message']);return _0x1e9676(_0x2636d1[_0x208a('0x10')][_0x208a('0x11')]);}else{logger[_0x208a('0xc')](_0x208a('0xd'),_0x17b7ff,_0x208a('0xe'));_0x1e9676(_0x2636d1['result'][_0x208a('0x11')]);}})[_0x208a('0x12')](function(_0x193c99){logger[_0x208a('0x10')](_0x208a('0xd'),_0x17b7ff,_0x193c99);_0x4dd043(_0x193c99);});});}exports['UpdateMailApplication']=function(_0x1536a4){var _0x2e5a33=this;return new Promise(function(_0x1ca79d,_0x20360c){return db[_0x208a('0x13')][_0x208a('0x14')](_0x1536a4[_0x208a('0x15')],{'raw':_0x1536a4[_0x208a('0x16')]?_0x1536a4[_0x208a('0x16')][_0x208a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1536a4[_0x208a('0x16')]?_0x1536a4['options'][_0x208a('0x18')]||null:null,'attributes':_0x1536a4[_0x208a('0x16')]?_0x1536a4[_0x208a('0x16')][_0x208a('0x19')]||null:null,'limit':_0x1536a4[_0x208a('0x16')]?_0x1536a4[_0x208a('0x16')][_0x208a('0x1a')]||null:null})[_0x208a('0xb')](function(_0x54318c){logger[_0x208a('0xc')]('UpdateMailApplication',_0x1536a4);logger[_0x208a('0xf')](_0x208a('0x1b'),_0x1536a4,JSON[_0x208a('0x1c')](_0x54318c));_0x1ca79d(_0x54318c);})['catch'](function(_0x46d48a){logger[_0x208a('0x10')](_0x208a('0x1b'),_0x46d48a[_0x208a('0x11')],_0x1536a4);_0x20360c(_0x2e5a33[_0x208a('0x10')](0x1f4,_0x46d48a[_0x208a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 3e4e906..8b6f6c9 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 _0x9ff4=['removeTags','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','/:id/download','download','post','tracked','mailinteraction:addtags','addTags','put','mail','mailinteraction:update','delete','mailinteraction:destroy','destroy','/:id/tags'];(function(_0xf44d98,_0x12a472){var _0x5ebb04=function(_0x930c33){while(--_0x930c33){_0xf44d98['push'](_0xf44d98['shift']());}};_0x5ebb04(++_0x12a472);}(_0x9ff4,0x196));var _0x49ff=function(_0x4ad7cb,_0x5e1d25){_0x4ad7cb=_0x4ad7cb-0x0;var _0x411402=_0x9ff4[_0x4ad7cb];return _0x411402;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x49ff('0x0'));var express=require(_0x49ff('0x1'));var router=express[_0x49ff('0x2')]();var auth=require(_0x49ff('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x49ff('0x4'));var controller=require(_0x49ff('0x5'));router[_0x49ff('0x6')]('/',auth[_0x49ff('0x7')](),controller[_0x49ff('0x8')]);router[_0x49ff('0x6')](_0x49ff('0x9'),auth[_0x49ff('0x7')](),controller['describe']);router['get'](_0x49ff('0xa'),auth[_0x49ff('0x7')](),controller['show']);router['get'](_0x49ff('0xb'),auth[_0x49ff('0x7')](),controller[_0x49ff('0xc')]);router[_0x49ff('0x6')](_0x49ff('0xd'),auth[_0x49ff('0x7')](),controller[_0x49ff('0xe')]);router[_0x49ff('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x49ff('0xb'),auth[_0x49ff('0x7')](),controller['addMessage']);router[_0x49ff('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x49ff('0x10')]('mail',_0x49ff('0x11')),controller[_0x49ff('0x12')]);router[_0x49ff('0x13')](_0x49ff('0xa'),auth[_0x49ff('0x7')](),interaction[_0x49ff('0x10')](_0x49ff('0x14'),_0x49ff('0x15')),controller['update']);router[_0x49ff('0x16')]('/:id',auth[_0x49ff('0x7')](),interaction[_0x49ff('0x10')](_0x49ff('0x14'),_0x49ff('0x17')),controller[_0x49ff('0x18')]);router[_0x49ff('0x16')](_0x49ff('0x19'),auth[_0x49ff('0x7')](),controller[_0x49ff('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x9b67=['/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','create','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x1ca995,_0x458edc){var _0x6c1cbb=function(_0x109124){while(--_0x109124){_0x1ca995['push'](_0x1ca995['shift']());}};_0x6c1cbb(++_0x458edc);}(_0x9b67,0xf6));var _0x79b6=function(_0x2b5f15,_0x29c205){_0x2b5f15=_0x2b5f15-0x0;var _0x597874=_0x9b67[_0x2b5f15];return _0x597874;};'use strict';var multer=require(_0x79b6('0x0'));var util=require(_0x79b6('0x1'));var path=require(_0x79b6('0x2'));var timeout=require(_0x79b6('0x3'));var express=require(_0x79b6('0x4'));var router=express['Router']();var auth=require(_0x79b6('0x5'));var interaction=require(_0x79b6('0x6'));var config=require('../../config/environment');var controller=require('./mailInteraction.controller');router[_0x79b6('0x7')]('/',auth[_0x79b6('0x8')](),controller[_0x79b6('0x9')]);router[_0x79b6('0x7')](_0x79b6('0xa'),auth[_0x79b6('0x8')](),controller[_0x79b6('0xb')]);router['get'](_0x79b6('0xc'),auth[_0x79b6('0x8')](),controller[_0x79b6('0xd')]);router[_0x79b6('0x7')](_0x79b6('0xe'),auth['isAuthenticated'](),controller[_0x79b6('0xf')]);router[_0x79b6('0x7')](_0x79b6('0x10'),auth[_0x79b6('0x8')](),controller['download']);router['post']('/',auth[_0x79b6('0x8')](),controller[_0x79b6('0x11')]);router[_0x79b6('0x12')]('/:id/messages',auth[_0x79b6('0x8')](),controller[_0x79b6('0x13')]);router[_0x79b6('0x12')](_0x79b6('0x14'),auth[_0x79b6('0x8')](),interaction[_0x79b6('0x15')](_0x79b6('0x16'),_0x79b6('0x17')),controller[_0x79b6('0x18')]);router[_0x79b6('0x19')](_0x79b6('0xc'),auth[_0x79b6('0x8')](),interaction[_0x79b6('0x15')]('mail',_0x79b6('0x1a')),controller[_0x79b6('0x1b')]);router[_0x79b6('0x1c')](_0x79b6('0xc'),auth[_0x79b6('0x8')](),interaction[_0x79b6('0x15')](_0x79b6('0x16'),_0x79b6('0x1d')),controller[_0x79b6('0x1e')]);router[_0x79b6('0x1c')](_0x79b6('0x14'),auth[_0x79b6('0x8')](),controller[_0x79b6('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 6f26571..c43e03d 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 _0x471c=['long','ENUM','out','sequelize','iconv','exports','BOOLEAN','STRING','TEXT'];(function(_0x8f617,_0x791259){var _0x295342=function(_0x2c405f){while(--_0x2c405f){_0x8f617['push'](_0x8f617['shift']());}};_0x295342(++_0x791259);}(_0x471c,0x66));var _0xc471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x471c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc471('0x0'));var iconv=require(_0xc471('0x1'));module[_0xc471('0x2')]={'closed':{'type':Sequelize[_0xc471('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc471('0x4')]},'secondDisposition':{'type':Sequelize[_0xc471('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc471('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xc471('0x4')](0x1fe)},'to':{'type':Sequelize[_0xc471('0x4')]},'cc':{'type':Sequelize[_0xc471('0x5')](_0xc471('0x6'))},'subject':{'type':Sequelize[_0xc471('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xc471('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xc471('0x7')]('in',_0xc471('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xc471('0x7')]('in',_0xc471('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xc471('0x5')](_0xc471('0x6'))},'lastMsgText':{'type':Sequelize[_0xc471('0x5')](_0xc471('0x6'))}}; \ No newline at end of file +var _0x739c=['iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out'];(function(_0x276ee7,_0x2dbd47){var _0x2fc776=function(_0x2d6610){while(--_0x2d6610){_0x276ee7['push'](_0x276ee7['shift']());}};_0x2fc776(++_0x2dbd47);}(_0x739c,0x120));var _0xc739=function(_0x56949f,_0x54dd62){_0x56949f=_0x56949f-0x0;var _0x326f6d=_0x739c[_0x56949f];return _0x326f6d;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xc739('0x0'));module[_0xc739('0x1')]={'closed':{'type':Sequelize[_0xc739('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc739('0x3')]},'disposition':{'type':Sequelize[_0xc739('0x4')]},'secondDisposition':{'type':Sequelize[_0xc739('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc739('0x4')]},'note':{'type':Sequelize[_0xc739('0x4')]},'inReplyTo':{'type':Sequelize[_0xc739('0x4')](0x1fe)},'to':{'type':Sequelize[_0xc739('0x4')]},'cc':{'type':Sequelize[_0xc739('0x5')](_0xc739('0x6'))},'subject':{'type':Sequelize[_0xc739('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xc739('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xc739('0x7')]('in',_0xc739('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc739('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc739('0x7')]('in',_0xc739('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xc739('0x5')](_0xc739('0x6'))},'lastMsgText':{'type':Sequelize['TEXT'](_0xc739('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index e9300f3..9ea140e 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 _0x5eb8=['hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','tools_tags','u.id','u.fullname','ui.MailInteractionId','from','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','user','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','sequelize','count','toString','keyBy','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.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.substatus','i.ContactId','i.MailAccountId','i.UserId','c.firstName','c.lastName','c.email','c.phone','Contact.phone','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','MailInteractionId','enableEmailPreview','all','rows','params','includeAll','include','merge','options','create','body','destroy','addMessage','MailMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','spread','emit','removeTags','download','files','tmp','join','server','attachments','transcript-%d-%s.zip','Attachment','Attachments','bcc','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','log','err','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./mailInteraction.socket','register','sendStatus','end','offset','limit','apply','reject','save','update','then','status','error','stack','Users','map','fullname','TagIds','split','forEach','Tags','push','findOne','lastMsgBody','lastMsgText','trimStart','fromString','catch','index','MailInteraction','rawAttributes','fieldName','key','model','name','query','intersection','fields','attributes','length'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0x5eb8,0xb0));var _0x85eb=function(_0x1ceb7b,_0x894d3d){_0x1ceb7b=_0x1ceb7b-0x0;var _0x57c016=_0x5eb8[_0x1ceb7b];return _0x57c016;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x85eb('0x0'));var zipdir=require(_0x85eb('0x1'));var jsonpatch=require(_0x85eb('0x2'));var rp=require(_0x85eb('0x3'));var moment=require(_0x85eb('0x4'));var BPromise=require(_0x85eb('0x5'));var Mustache=require(_0x85eb('0x6'));var util=require(_0x85eb('0x7'));var path=require(_0x85eb('0x8'));var sox=require(_0x85eb('0x9'));var csv=require(_0x85eb('0xa'));var ejs=require(_0x85eb('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0xa'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var htmlToText=require(_0x85eb('0x10'));var juice=require(_0x85eb('0x11'));var Redis=require(_0x85eb('0x12'));var authService=require(_0x85eb('0x13'));var qs=require(_0x85eb('0x14'));var as=require(_0x85eb('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x85eb('0x16'))(_0x85eb('0x17'));var utils=require('../../config/utils');var config=require(_0x85eb('0x18'));var licenseUtil=require(_0x85eb('0x19'));var db=require(_0x85eb('0x1a'))['db'];config[_0x85eb('0x1b')]=_['defaults'](config['redis'],{'host':_0x85eb('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85eb('0x1b')]));require(_0x85eb('0x1d'))[_0x85eb('0x1e')](socket);function respondWithStatusCode(_0x1604ba,_0x183b0c){_0x183b0c=_0x183b0c||0xcc;return function(_0x49efdf){if(_0x49efdf){return _0x1604ba[_0x85eb('0x1f')](_0x183b0c);}return _0x1604ba['status'](_0x183b0c)[_0x85eb('0x20')]();};}function respondWithResult(_0x10c2c9,_0x3e23e8){_0x3e23e8=_0x3e23e8||0xc8;return function(_0x5deab1){if(_0x5deab1){return _0x10c2c9['status'](_0x3e23e8)['json'](_0x5deab1);}};}function respondWithFilteredResult(_0x50d2a8,_0xe198ca){return function(_0x39ca96){if(_0x39ca96){var _0x10cf2f=_0x39ca96['count'],_0x2e986c=_0xe198ca[_0x85eb('0x21')],_0x42dada=_0xe198ca[_0x85eb('0x21')]+_0xe198ca[_0x85eb('0x22')],_0x34f875;if(_0x42dada>=_0x10cf2f){_0x42dada=_0x10cf2f;_0x34f875=0xc8;}else{_0x34f875=0xce;}_0x50d2a8['status'](_0x34f875);return _0x50d2a8['set']('Content-Range',_0x2e986c+'-'+_0x42dada+'/'+_0x10cf2f)['json'](_0x39ca96);}return null;};}function patchUpdates(_0x244667){return function(_0x3fa785){try{jsonpatch[_0x85eb('0x23')](_0x3fa785,_0x244667,!![]);}catch(_0x255ca7){return BPromise[_0x85eb('0x24')](_0x255ca7);}return _0x3fa785[_0x85eb('0x25')]();};}function saveUpdates(_0x5c9895,_0x5491d5){return function(_0x5b48d9){if(_0x5b48d9){return _0x5b48d9[_0x85eb('0x26')](_0x5c9895)[_0x85eb('0x27')](function(_0x3f7a4d){return _0x3f7a4d;});}return null;};}function removeEntity(_0x28b87d,_0x312b3e){return function(_0x210aef){if(_0x210aef){return _0x210aef['destroy']()[_0x85eb('0x27')](function(){_0x28b87d[_0x85eb('0x28')](0xcc)[_0x85eb('0x20')]();});}};}function handleEntityNotFound(_0x30e766,_0x3e2326){return function(_0x57a03c){if(!_0x57a03c){_0x30e766[_0x85eb('0x1f')](0x194);}return _0x57a03c;};}function handleError(_0x792d3a,_0x291557){_0x291557=_0x291557||0x1f4;return function(_0x3e7eb9){logger[_0x85eb('0x29')](_0x3e7eb9[_0x85eb('0x2a')]);if(_0x3e7eb9['name']){delete _0x3e7eb9['name'];}_0x792d3a[_0x85eb('0x28')](_0x291557)['send'](_0x3e7eb9);};}function getInteractionUsers(_0xa9b14f,_0x5255eb){return new BPromise(function(_0x4229e9,_0x3570f7){try{if(_0x5255eb[_0xa9b14f['id']]){_0xa9b14f[_0x85eb('0x2b')]=_[_0x85eb('0x2c')](_0x5255eb[_0xa9b14f['id']],function(_0xa67e1c){return{'id':_0xa67e1c['id'],'fullname':_0xa67e1c[_0x85eb('0x2d')]};});}}catch(_0x41ed76){_0x3570f7(_0x41ed76);}_0x4229e9(_0xa9b14f);});}function getInteractionTags(_0x5decd5,_0x237f19){return new BPromise(function(_0xcbcf2b,_0x515ee9){try{if(_0x5decd5[_0x85eb('0x2e')]){_0x5decd5['Tags']=[];_0x5decd5['TagIds'][_0x85eb('0x2f')](',')[_0x85eb('0x30')](function(_0x3e6f34){_0x5decd5[_0x85eb('0x31')][_0x85eb('0x32')](_0x237f19[_0x3e6f34]);});}delete _0x5decd5[_0x85eb('0x2e')];}catch(_0x39b574){_0x515ee9(_0x39b574);}_0xcbcf2b(_0x5decd5);});}function getLastMessageText(_0x3858e6){return new BPromise(function(_0xa3fe68,_0x1008bf){return db['MailInteraction'][_0x85eb('0x33')]({'where':{'id':_0x3858e6['id']},'attributes':[_0x85eb('0x34'),'lastMsgText'],'raw':!![]})['then'](function(_0x340745){if(!_0x340745[_0x85eb('0x35')]){_0x3858e6[_0x85eb('0x35')]=_[_0x85eb('0x36')](htmlToText[_0x85eb('0x37')](_0x340745[_0x85eb('0x34')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x3858e6[_0x85eb('0x35')]=_0x340745[_0x85eb('0x35')];}_0xa3fe68(_0x3858e6);})[_0x85eb('0x38')](function(_0x373e5f){_0x1008bf(_0x373e5f);});});}function updateMailInteraction(_0x424053,_0x317d19,_0x317d86,_0x33605a){return new BPromise(function(_0x4b69a7,_0x4361e2){return getInteractionUsers(_0x424053,_0x317d86)[_0x85eb('0x27')](function(_0x58f091){return getInteractionTags(_0x58f091,_0x317d19);})['then'](function(_0x2b3747){if(_0x33605a){_0x4b69a7(getLastMessageText(_0x2b3747));}else{_0x4b69a7(_0x2b3747);}})[_0x85eb('0x38')](function(_0x5389d8){_0x4361e2(_0x5389d8);});});}exports[_0x85eb('0x39')]=function(_0x50c7f9,_0x4440ec){var _0x5937e5={},_0xaa27ca={},_0x5ce7e4={'count':0x0,'rows':[]};var _0x1fea52=_['map'](db[_0x85eb('0x3a')][_0x85eb('0x3b')],function(_0x4de24e){return{'name':_0x4de24e[_0x85eb('0x3c')],'type':_0x4de24e['type'][_0x85eb('0x3d')]};});_0xaa27ca[_0x85eb('0x3e')]=_['map'](_0x1fea52,_0x85eb('0x3f'));_0xaa27ca['query']=_['keys'](_0x50c7f9[_0x85eb('0x40')]);_0xaa27ca['filters']=_[_0x85eb('0x41')](_0xaa27ca[_0x85eb('0x3e')],_0xaa27ca['query']);_0x5937e5['attributes']=_[_0x85eb('0x41')](_0xaa27ca[_0x85eb('0x3e')],qs['fields'](_0x50c7f9['query'][_0x85eb('0x42')]));_0x5937e5[_0x85eb('0x43')]=_0x5937e5[_0x85eb('0x43')][_0x85eb('0x44')]?_0x5937e5[_0x85eb('0x43')]:_0xaa27ca['model'];if(!_0x50c7f9[_0x85eb('0x40')][_0x85eb('0x45')](_0x85eb('0x46'))){_0x5937e5[_0x85eb('0x22')]=qs[_0x85eb('0x22')](_0x50c7f9[_0x85eb('0x40')][_0x85eb('0x22')]);_0x5937e5[_0x85eb('0x21')]=qs[_0x85eb('0x21')](_0x50c7f9['query'][_0x85eb('0x21')]);}_0x5937e5[_0x85eb('0x47')]=qs['sort'](_0x50c7f9[_0x85eb('0x40')][_0x85eb('0x48')]);_0x5937e5[_0x85eb('0x49')]=qs[_0x85eb('0x4a')](_[_0x85eb('0x4b')](_0x50c7f9[_0x85eb('0x40')],_0xaa27ca['filters']),_0x1fea52);var _0x246f3a=[];var _0x1258bc=squel[_0x85eb('0x4c')]()[_0x85eb('0x4d')]('id')[_0x85eb('0x4d')](_0x85eb('0x3f'))[_0x85eb('0x4d')](_0x85eb('0x4e'))['from'](_0x85eb('0x4f'));var _0x26b226=squel[_0x85eb('0x4c')]()[_0x85eb('0x4d')](_0x85eb('0x50'))[_0x85eb('0x4d')](_0x85eb('0x51'))[_0x85eb('0x4d')](_0x85eb('0x52'))[_0x85eb('0x53')](_0x85eb('0x54'),'ui')[_0x85eb('0x55')]('users','u',_0x85eb('0x56'));var _0x2c951b=squel[_0x85eb('0x4c')]()['from'](_0x85eb('0x57'),'i')[_0x85eb('0x55')](_0x85eb('0x58'),'c',_0x85eb('0x59'))[_0x85eb('0x55')]('users','o',_0x85eb('0x5a'))[_0x85eb('0x55')](_0x85eb('0x5b'),'a','a.id\x20=\x20i.MailAccountId')[_0x85eb('0x55')](_0x85eb('0x5c'),'me',_0x85eb('0x5d'))['left_join']('mail_interaction_has_tags','it',_0x85eb('0x5e'))['left_join']('tools_tags','t',_0x85eb('0x5f'));var _0x593723=squel[_0x85eb('0x60')]();var _0xfb0ac=[];var _0x4e3d96=squel['expr']();var _0x27ce2a;if(_0x50c7f9[_0x85eb('0x40')][_0x85eb('0x61')]){_0x27ce2a=as[_0x85eb('0x62')](_0x50c7f9[_0x85eb('0x40')]['search']);var _0x1bb9f8=_0x27ce2a[_0x85eb('0x63')];for(var _0x270bb2=0x0;_0x270bb2<_0x27ce2a[_0x85eb('0x64')][_0x85eb('0x44')];_0x270bb2++){var _0x5318d3=_0x27ce2a[_0x85eb('0x64')][_0x270bb2];var _0x5cd2d3='i';var _0xd2e792=_[_0x85eb('0x65')](_0x1fea52,['name',_0x5318d3[_0x85eb('0x4d')]]);if(!_0xd2e792){switch(_0x5318d3[_0x85eb('0x4d')]){case _0x85eb('0x66'):if(_0x5318d3[_0x85eb('0x67')]==0x1){_0x2c951b[_0x85eb('0x68')]('`'+_0x5318d3[_0x85eb('0x4d')]+'`\x20=\x200');}else{_0x2c951b[_0x85eb('0x68')]('`'+_0x5318d3['field']+_0x85eb('0x69'));}break;case _0x85eb('0x6a'):if(_0x5318d3['operator']===_0x85eb('0x6b')){if(_0x5318d3[_0x85eb('0x67')]['split']('\x20')[_0x85eb('0x44')]>0x1){_0x593723[_0x1bb9f8]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x85eb('0x6c')](_0x5318d3[_0x85eb('0x67')]),null);}else{var _0x105bf8='%'+_0x5318d3[_0x85eb('0x67')]+'%';_0x593723[_0x1bb9f8](_0x85eb('0x6d'),_0x105bf8,_0x105bf8,_0x105bf8);}}else{_0xd2e792=_[_0x85eb('0x65')](_0x1fea52,['name',_0x85eb('0x6e')]);_0x5318d3[_0x85eb('0x4d')]=_0x85eb('0x6e');_0x34ecea=as[_0x85eb('0x6f')](_0x5cd2d3,_0xd2e792[_0x85eb('0x70')],_0x5318d3);_0x593723[_0x1bb9f8](_0x34ecea[_0x85eb('0x71')],_0x34ecea[_0x85eb('0x67')][_0x85eb('0x72')],_0x34ecea[_0x85eb('0x67')][_0x85eb('0x20')]);}break;case _0x85eb('0x73'):var _0x54112d=_0x5318d3[_0x85eb('0x67')][_0x85eb('0x2f')](',')[_0x85eb('0x2c')](function(_0xdaf2fe){return Number(_0xdaf2fe);});_0x54112d[_0x85eb('0x30')](function(_0x213b64){_0x4e3d96['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x213b64+',%');});_0xfb0ac=_[_0x85eb('0x74')](_0xfb0ac,_0x54112d);break;case'User':if(_0x5318d3[_0x85eb('0x75')]===_0x85eb('0x6b')){_0x593723[_0x1bb9f8](_0x85eb('0x76'),'%'+_0x5318d3[_0x85eb('0x67')]+'%',null);}else{_0xd2e792=_[_0x85eb('0x65')](_0x1fea52,['name',_0x85eb('0x77')]);_0x5318d3[_0x85eb('0x4d')]=_0x85eb('0x77');_0x34ecea=as[_0x85eb('0x6f')](_0x5cd2d3,_0xd2e792[_0x85eb('0x70')],_0x5318d3);_0x593723[_0x1bb9f8](_0x34ecea[_0x85eb('0x71')],_0x34ecea[_0x85eb('0x67')][_0x85eb('0x72')],_0x34ecea['value'][_0x85eb('0x20')]);}break;case'plainBody':_0x34ecea=as[_0x85eb('0x6f')]('me',null,_0x5318d3);_0x593723[_0x1bb9f8](_0x34ecea[_0x85eb('0x71')],_0x34ecea[_0x85eb('0x67')][_0x85eb('0x72')],_0x34ecea[_0x85eb('0x67')]['end']);break;}}else{var _0x34ecea=as[_0x85eb('0x6f')](_0x5cd2d3,_0xd2e792[_0x85eb('0x70')],_0x5318d3);_0x593723[_0x1bb9f8](_0x34ecea[_0x85eb('0x71')],_0x34ecea[_0x85eb('0x67')][_0x85eb('0x72')],_0x34ecea['value']['end']);}}}else{var _0x204662=_(_0x50c7f9['query'])[_0x85eb('0x78')]()[_0x85eb('0x2c')](function(_0xe08b39){return _[_0x85eb('0x79')](_0x1fea52,[_0x85eb('0x3f'),_0xe08b39])?_0xe08b39:undefined;})[_0x85eb('0x7a')]()['value']();if(!_[_0x85eb('0x7b')](_0x204662)){_0x204662[_0x85eb('0x30')](function(_0x3f30e4){if(_0x3f30e4===_0x85eb('0x7c')){_0x2c951b['where'](_0x85eb('0x7d'),[][_0x85eb('0x7e')](_0x50c7f9[_0x85eb('0x40')][_0x3f30e4]));}else if(_0x3f30e4===_0x85eb('0x7f')){var _0x5037c7=JSON[_0x85eb('0x80')](_0x50c7f9[_0x85eb('0x40')][_0x3f30e4])[_0x85eb('0x81')];var _0x5fcd48=JSON[_0x85eb('0x80')](_0x50c7f9[_0x85eb('0x40')][_0x3f30e4])[_0x85eb('0x82')];_0x2c951b[_0x85eb('0x49')](_0x85eb('0x83'),_0x5037c7,_0x5fcd48);}else{if(_0x50c7f9[_0x85eb('0x40')][_0x3f30e4]===_0x85eb('0x84')){_0x2c951b[_0x85eb('0x49')]('i.'+_0x3f30e4+_0x85eb('0x85'));}else{_0x2c951b[_0x85eb('0x49')]('i.'+_0x3f30e4+_0x85eb('0x86'),_0x50c7f9[_0x85eb('0x40')][_0x3f30e4]);}}});}if(_0x50c7f9[_0x85eb('0x40')][_0x85eb('0x87')]){if(_0x50c7f9[_0x85eb('0x40')]['read']==0x1){_0x2c951b[_0x85eb('0x68')]('`unreadMessages`\x20=\x200');}else{_0x2c951b[_0x85eb('0x68')](_0x85eb('0x88'));}}if(_0x50c7f9[_0x85eb('0x40')][_0x85eb('0x89')]){_0xfb0ac=_[_0x85eb('0x8a')](_0x50c7f9[_0x85eb('0x40')][_0x85eb('0x89')])?_0x50c7f9[_0x85eb('0x40')][_0x85eb('0x89')]:new Array(_0x50c7f9['query'][_0x85eb('0x89')]);_0xfb0ac[_0x85eb('0x30')](function(_0x2d795b){_0x4e3d96['or'](_0x85eb('0x8b'),'%,'+_0x2d795b+',%');});}if(_0x50c7f9[_0x85eb('0x40')]['filter']){var _0x2b4a71=_0x50c7f9['query'][_0x85eb('0x8c')][_0x85eb('0x8d')]('\x5c','\x5c\x5c')[_0x85eb('0x8d')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2b4a71)){_0x593723['or'](_0x85eb('0x8e'),_0x2b4a71+'%');}else if(qs[_0x85eb('0x8f')](_0x2b4a71)){_0x593723['or'](_0x85eb('0x90'),_0x2b4a71+'%');}else{_0x593723['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2b4a71))['or'](_0x85eb('0x91'),qs[_0x85eb('0x6c')](_0x2b4a71));}}}_0x2c951b[_0x85eb('0x49')](_0x593723);_0x2c951b[_0x85eb('0x92')]('i.id');var _0x8cb47={'type':db['Sequelize'][_0x85eb('0x93')][_0x85eb('0x94')],'raw':!![]};var _0x528d2e=_0x2c951b[_0x85eb('0x95')]();_0x528d2e[_0x85eb('0x4d')](_0x85eb('0x96'));_0x528d2e['field'](_0x85eb('0x97'),'unreadMessages');if(_0x5937e5[_0x85eb('0x47')]){_0x5937e5[_0x85eb('0x47')][_0x85eb('0x30')](function(_0x4befc2){var _0xcfe307=_0x4befc2[0x0]===_0x85eb('0x98')?_0x4befc2[0x0]:'i.'+_0x4befc2[0x0];_0x2c951b[_0x85eb('0x47')](_0xcfe307,_0x4befc2[0x1]===_0x85eb('0x99')?![]:!![]);});}if(!_[_0x85eb('0x7b')](_0xfb0ac)){_0x2c951b['having'](_0x4e3d96);_0x528d2e[_0x85eb('0x49')](_0x85eb('0x9a'),_0xfb0ac);}BPromise['resolve']()['then'](function(){if(!_0x27ce2a){if(_0x50c7f9[_0x85eb('0x40')]['MailAccountId'])return;_0x528d2e[_0x85eb('0x49')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x2c951b[_0x85eb('0x49')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x50c7f9[_0x85eb('0x9b')][_0x85eb('0x9c')]!=='agent')return;return _0x50c7f9[_0x85eb('0x9b')][_0x85eb('0x9d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x888c46){if(_[_0x85eb('0x7b')](_0x888c46)){_0x528d2e[_0x85eb('0x49')](_0x85eb('0x9e'));_0x2c951b['where'](_0x85eb('0x9e'));}else{_0x528d2e['where'](_0x85eb('0x7d'),_[_0x85eb('0x2c')](_0x888c46,'id'));_0x2c951b[_0x85eb('0x49')]('i.MailAccountId\x20IN\x20?',_[_0x85eb('0x2c')](_0x888c46,'id'));}});})[_0x85eb('0x27')](function(){if(_0x50c7f9[_0x85eb('0x9b')]['role']===_0x85eb('0x9f')&&!_0x27ce2a&&!_0x50c7f9['query'][_0x85eb('0x7c')])return[];return db[_0x85eb('0xa0')][_0x85eb('0x40')](_0x528d2e['toString'](),_0x8cb47);})['then'](function(_0x5eb0b8){_0x5ce7e4[_0x85eb('0xa1')]=_0x5eb0b8[_0x85eb('0x44')];if(_0x5ce7e4[_0x85eb('0xa1')]===0x0)return[];return db['sequelize'][_0x85eb('0x40')](_0x1258bc[_0x85eb('0xa2')](),_0x8cb47)[_0x85eb('0x27')](function(_0xbba8dc){_0x246f3a=_[_0x85eb('0xa3')](_0xbba8dc,'id');_0x8cb47=_['merge'](_0x8cb47,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x50c7f9[_0x85eb('0x40')][_0x85eb('0x42')]){_0x5937e5['attributes'][_0x85eb('0x30')](function(_0x954204){_0x2c951b[_0x85eb('0x4d')]('i.'+_0x954204);});}else{_0x2c951b[_0x85eb('0x4d')](_0x85eb('0x97'),_0x85eb('0x66'));_0x2c951b[_0x85eb('0x4d')](_0x85eb('0xa4'),_0x85eb('0xa5'));_0x2c951b[_0x85eb('0x4d')](_0x85eb('0xa6'),_0x85eb('0xa7'));_0x2c951b[_0x85eb('0x4d')](_0x85eb('0xa8'),_0x85eb('0x98'));_0x2c951b['field'](_0x85eb('0x96'));_0x2c951b[_0x85eb('0x4d')](_0x85eb('0xa9'));_0x2c951b[_0x85eb('0x4d')](_0x85eb('0xaa'));_0x2c951b[_0x85eb('0x4d')](_0x85eb('0xab'));_0x2c951b[_0x85eb('0x4d')](_0x85eb('0xac'));_0x2c951b[_0x85eb('0x4d')]('i.attach');_0x2c951b[_0x85eb('0x4d')](_0x85eb('0xad'));_0x2c951b[_0x85eb('0x4d')](_0x85eb('0xae'));_0x2c951b['field'](_0x85eb('0xaf'));_0x2c951b[_0x85eb('0x4d')](_0x85eb('0xb0'));_0x2c951b[_0x85eb('0x4d')](_0x85eb('0xb1'));_0x2c951b[_0x85eb('0x4d')]('i.thirdDisposition');_0x2c951b[_0x85eb('0x4d')](_0x85eb('0xb2'));_0x2c951b[_0x85eb('0x4d')]('i.to');_0x2c951b[_0x85eb('0x4d')](_0x85eb('0xb3'));_0x2c951b[_0x85eb('0x4d')](_0x85eb('0xb4'));_0x2c951b[_0x85eb('0x4d')](_0x85eb('0xb5'));_0x2c951b[_0x85eb('0x4d')](_0x85eb('0xb6'),'Contact.firstName');_0x2c951b[_0x85eb('0x4d')](_0x85eb('0xb7'),'Contact.lastName');_0x2c951b['field'](_0x85eb('0xb8'),'Contact.email');_0x2c951b[_0x85eb('0x4d')](_0x85eb('0xb9'),_0x85eb('0xba'));_0x2c951b[_0x85eb('0x4d')]('c.mobile','Contact.mobile');_0x2c951b[_0x85eb('0x4d')]('c.fax',_0x85eb('0xbb'));_0x2c951b[_0x85eb('0x4d')](_0x85eb('0xbc'),_0x85eb('0xbd'));_0x2c951b['field']('o.internal',_0x85eb('0xbe'));_0x2c951b[_0x85eb('0x4d')](_0x85eb('0xbf'),'TagIds');}if(_0x5937e5['limit'])_0x2c951b[_0x85eb('0x22')](_0x5937e5[_0x85eb('0x22')]);if(_0x5937e5[_0x85eb('0x21')])_0x2c951b[_0x85eb('0x21')](_0x5937e5[_0x85eb('0x21')]);return db[_0x85eb('0xa0')][_0x85eb('0x40')](_0x2c951b[_0x85eb('0xa2')](),_0x8cb47);})[_0x85eb('0x27')](function(_0x4115ae){_0x26b226[_0x85eb('0x49')]('ui.MailInteractionId\x20IN\x20?',_[_0x85eb('0x2c')](_0x4115ae,'id'));return db[_0x85eb('0xa0')]['query'](_0x26b226[_0x85eb('0xa2')](),_0x8cb47)[_0x85eb('0x27')](function(_0x205d45){var _0x3f7c06=_[_0x85eb('0xc0')](_0x205d45,_0x85eb('0xc1'));var _0x4c7651=[];return db['Setting'][_0x85eb('0x33')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0x85eb('0x27')](function(_0x5596c1){var _0x25c8e4=_0x5596c1[_0x85eb('0xc2')];_0x4115ae['forEach'](function(_0x54809c){_0x4c7651[_0x85eb('0x32')](updateMailInteraction(_0x54809c,_0x246f3a,_0x3f7c06,_0x25c8e4));});return BPromise[_0x85eb('0xc3')](_0x4c7651);});});});})['then'](function(_0x371b59){_0x5ce7e4[_0x85eb('0xc4')]=_0x371b59;return _0x5ce7e4;})[_0x85eb('0x27')](respondWithFilteredResult(_0x4440ec,_0x5937e5))['catch'](handleError(_0x4440ec,null));};exports['show']=function(_0x342302,_0x3a8d0d){var _0x189733={'raw':![],'where':{'id':_0x342302[_0x85eb('0xc5')]['id']}},_0x422d33={};_0x422d33[_0x85eb('0x3e')]=_[_0x85eb('0x78')](db[_0x85eb('0x3a')][_0x85eb('0x3b')]);_0x422d33[_0x85eb('0x40')]=_['keys'](_0x342302[_0x85eb('0x40')]);_0x422d33['filters']=_[_0x85eb('0x41')](_0x422d33[_0x85eb('0x3e')],_0x422d33[_0x85eb('0x40')]);_0x189733[_0x85eb('0x43')]=_[_0x85eb('0x41')](_0x422d33['model'],qs[_0x85eb('0x42')](_0x342302[_0x85eb('0x40')][_0x85eb('0x42')]));_0x189733['attributes']=_0x189733[_0x85eb('0x43')][_0x85eb('0x44')]?_0x189733[_0x85eb('0x43')]:_0x422d33[_0x85eb('0x3e')];if(_0x342302[_0x85eb('0x40')][_0x85eb('0xc6')]){_0x189733[_0x85eb('0xc7')]=[{'all':!![]}];}_0x189733=_[_0x85eb('0xc8')]({},_0x189733,_0x342302[_0x85eb('0xc9')]);return db[_0x85eb('0x3a')][_0x85eb('0x65')](_0x189733)[_0x85eb('0x27')](handleEntityNotFound(_0x3a8d0d,null))[_0x85eb('0x27')](respondWithResult(_0x3a8d0d,null))[_0x85eb('0x38')](handleError(_0x3a8d0d,null));};exports[_0x85eb('0xca')]=function(_0x13c3b4,_0x576bc0){return db[_0x85eb('0x3a')][_0x85eb('0xca')](_0x13c3b4[_0x85eb('0xcb')],{})[_0x85eb('0x27')](respondWithResult(_0x576bc0,0xc9))[_0x85eb('0x38')](handleError(_0x576bc0,null));};exports[_0x85eb('0x26')]=function(_0x3e4d2f,_0x55255d){if(_0x3e4d2f[_0x85eb('0xcb')]['id']){delete _0x3e4d2f[_0x85eb('0xcb')]['id'];}return db['MailInteraction'][_0x85eb('0x65')]({'where':{'id':_0x3e4d2f['params']['id']}})[_0x85eb('0x27')](handleEntityNotFound(_0x55255d,null))[_0x85eb('0x27')](saveUpdates(_0x3e4d2f[_0x85eb('0xcb')],null))[_0x85eb('0x27')](respondWithResult(_0x55255d,null))[_0x85eb('0x38')](handleError(_0x55255d,null));};exports[_0x85eb('0xcc')]=function(_0x317550,_0x1233be){return db['MailInteraction']['find']({'where':{'id':_0x317550[_0x85eb('0xc5')]['id']}})[_0x85eb('0x27')](handleEntityNotFound(_0x1233be,null))[_0x85eb('0x27')](removeEntity(_0x1233be,null))[_0x85eb('0x38')](handleError(_0x1233be,null));};exports['describe']=function(_0x44de5f,_0x2e2af5){return db[_0x85eb('0x3a')]['describe']()[_0x85eb('0x27')](respondWithResult(_0x2e2af5,null))[_0x85eb('0x38')](handleError(_0x2e2af5,null));};exports[_0x85eb('0xcd')]=function(_0x59b016,_0x1fa8f6,_0x38f314){return db[_0x85eb('0xce')]['find']({'where':{'id':_0x59b016[_0x85eb('0xc5')]['id']}})[_0x85eb('0x27')](handleEntityNotFound(_0x1fa8f6,null))[_0x85eb('0x27')](function(_0x39921d){if(_0x39921d){return _0x39921d[_0x85eb('0xcd')](_0x59b016[_0x85eb('0xcb')][_0x85eb('0xcf')],_[_0x85eb('0xd0')](_0x59b016[_0x85eb('0xcb')],['ids','id'])||{});}})[_0x85eb('0x27')](respondWithResult(_0x1fa8f6,null))[_0x85eb('0x38')](handleError(_0x1fa8f6,null));};exports[_0x85eb('0xd1')]=function(_0x2d2d0a,_0x10e6e5,_0x13e21d){var _0x5c80b1={'raw':![],'where':{}};var _0x56f23b={};var _0x8bb0d={'count':0x0,'rows':[]};return db[_0x85eb('0x3a')][_0x85eb('0x33')]({'where':{'id':_0x2d2d0a[_0x85eb('0xc5')]['id']}})[_0x85eb('0x27')](handleEntityNotFound(_0x10e6e5,null))[_0x85eb('0x27')](function(_0x37973e){if(_0x37973e){_0x56f23b['model']=_[_0x85eb('0x78')](db[_0x85eb('0xce')]['rawAttributes']);_0x56f23b[_0x85eb('0x40')]=_[_0x85eb('0x78')](_0x2d2d0a[_0x85eb('0x40')]);_0x56f23b[_0x85eb('0x4a')]=_[_0x85eb('0x41')](_0x56f23b[_0x85eb('0x3e')],_0x56f23b[_0x85eb('0x40')]);_0x5c80b1[_0x85eb('0x43')]=_[_0x85eb('0x41')](_0x56f23b['model'],qs['fields'](_0x2d2d0a['query'][_0x85eb('0x42')]));_0x5c80b1[_0x85eb('0x43')]=_0x5c80b1[_0x85eb('0x43')][_0x85eb('0x44')]?_0x5c80b1[_0x85eb('0x43')]:_0x56f23b[_0x85eb('0x3e')];if(!_0x2d2d0a[_0x85eb('0x40')][_0x85eb('0x45')](_0x85eb('0x46'))){_0x5c80b1[_0x85eb('0x22')]=qs['limit'](_0x2d2d0a[_0x85eb('0x40')][_0x85eb('0x22')]);_0x5c80b1[_0x85eb('0x21')]=qs[_0x85eb('0x21')](_0x2d2d0a[_0x85eb('0x40')][_0x85eb('0x21')]);}_0x5c80b1['order']=qs[_0x85eb('0x48')](_0x2d2d0a['query'][_0x85eb('0x48')]);_0x5c80b1['where']=qs[_0x85eb('0x4a')](_[_0x85eb('0x4b')](_0x2d2d0a[_0x85eb('0x40')],_0x56f23b[_0x85eb('0x4a')]));_0x5c80b1[_0x85eb('0x49')][_0x85eb('0xc1')]=_0x37973e['id'];if(_0x2d2d0a[_0x85eb('0x40')][_0x85eb('0x8c')]){_0x5c80b1['where']=_['merge'](_0x5c80b1[_0x85eb('0x49')],{'$or':_[_0x85eb('0x2c')](_0x5c80b1[_0x85eb('0x43')],function(_0x32f08c){var _0x3bfa4b={};_0x3bfa4b[_0x32f08c]={'$like':'%'+_0x2d2d0a['query'][_0x85eb('0x8c')]+'%'};return _0x3bfa4b;})});}if(_0x2d2d0a['query']['$gte']){var _0x2627e5=_0x2d2d0a[_0x85eb('0x40')]['$gte'][_0x85eb('0x2f')](',');var _0x590936={};_0x590936[_0x2627e5[0x0]]={'$gte':moment(_0x2627e5[0x1])[_0x85eb('0xd2')](_0x85eb('0xd3'))};_0x5c80b1[_0x85eb('0x49')]=_['merge'](_0x5c80b1[_0x85eb('0x49')],_0x590936);}_0x5c80b1=_[_0x85eb('0xc8')]({},_0x5c80b1,_0x2d2d0a[_0x85eb('0xc9')]);return db[_0x85eb('0xce')][_0x85eb('0xa1')]({'where':_0x5c80b1[_0x85eb('0x49')]})[_0x85eb('0x27')](function(_0xa35ee2){_0x8bb0d[_0x85eb('0xa1')]=_0xa35ee2;if(_0x2d2d0a[_0x85eb('0x40')]['includeAll']){_0x5c80b1['include']=[{'all':!![]}];}return db['MailMessage'][_0x85eb('0xd4')](_0x5c80b1);})[_0x85eb('0x27')](function(_0x2d15be){if(_0x2d2d0a['query'][_0x85eb('0xd5')]===_0x85eb('0xd6')){for(var _0x51de1d=0x0;_0x51de1d<_0x2d15be[_0x85eb('0x44')];_0x51de1d++){_0x2d15be[_0x51de1d][_0x85eb('0xcb')]=juice(_0x2d15be[_0x51de1d][_0x85eb('0xcb')]);}}_0x8bb0d[_0x85eb('0xc4')]=_0x2d15be;return _0x8bb0d;});}})['then'](respondWithFilteredResult(_0x10e6e5,_0x5c80b1))[_0x85eb('0x38')](handleError(_0x10e6e5,null));};exports[_0x85eb('0xd7')]=function(_0x37be49,_0x7c487a,_0x21ca8d){return db[_0x85eb('0x3a')][_0x85eb('0x65')]({'where':{'id':_0x37be49[_0x85eb('0xc5')]['id']}})['then'](handleEntityNotFound(_0x7c487a,null))[_0x85eb('0x27')](function(_0x120553){if(_0x120553){return _0x120553['setTags'](_0x37be49[_0x85eb('0xcb')]['ids'],_[_0x85eb('0xd0')](_0x37be49[_0x85eb('0xcb')],[_0x85eb('0xcf'),'id'])||{})[_0x85eb('0xd8')](function(){return db[_0x85eb('0x73')]['findAll']({'attributes':['id',_0x85eb('0x3f'),'color'],'where':{'id':_0x37be49['body'][_0x85eb('0xcf')]}});})[_0x85eb('0x27')](function(_0x58ba75){socket[_0x85eb('0xd9')]('mailInteractionTags:save',{'id':Number(_0x37be49[_0x85eb('0xc5')]['id']),'tags':_0x58ba75||[]});return{'id':Number(_0x37be49[_0x85eb('0xc5')]['id']),'tags':_0x58ba75||[]};});}})[_0x85eb('0x27')](respondWithResult(_0x7c487a,null))[_0x85eb('0x38')](handleError(_0x7c487a,null));};exports[_0x85eb('0xda')]=function(_0x184756,_0x32975d,_0x3c56a5){return db['MailInteraction']['find']({'where':{'id':_0x184756[_0x85eb('0xc5')]['id']}})[_0x85eb('0x27')](handleEntityNotFound(_0x32975d,null))[_0x85eb('0x27')](function(_0x174d51){if(_0x174d51){return _0x174d51[_0x85eb('0xda')](_0x184756[_0x85eb('0x40')][_0x85eb('0xcf')]);}})[_0x85eb('0x27')](respondWithStatusCode(_0x32975d,null))[_0x85eb('0x38')](handleError(_0x32975d,null));};exports[_0x85eb('0xdb')]=function(_0x2785e5,_0x31422d){var _0x263575=moment()['unix']()[_0x85eb('0xa2')]();var _0x15e356=path['join'](config['root'],'server',_0x85eb('0xdc'),_0x85eb('0xdd'));var _0x2423db=path[_0x85eb('0xde')](config['root'],_0x85eb('0xdf'),_0x85eb('0xdc'),_0x85eb('0xe0'));var _0x39bd74=path[_0x85eb('0xde')](_0x15e356,_0x263575);var _0x529048=util[_0x85eb('0xd2')](_0x85eb('0xe1'),_0x2785e5['params']['id'],_0x263575);var _0x1fe0b8=path[_0x85eb('0xde')](_0x15e356,_0x529048);var _0x44242b=[];if(_0x2785e5[_0x85eb('0x40')][_0x85eb('0xe0')]){_0x44242b[_0x85eb('0x32')]({'model':db[_0x85eb('0xe2')],'as':_0x85eb('0xe3'),'raw':!![]});}var _0x4ea6d8=[{'model':db['MailMessage'],'as':'Messages','attributes':['id',_0x85eb('0xcb'),'from','to','cc',_0x85eb('0xe4'),_0x85eb('0xe5'),_0x85eb('0x7f')],'where':{'secret':![]},'order':qs[_0x85eb('0x48')]('id'),'include':_0x44242b}];return db[_0x85eb('0x3a')][_0x85eb('0x65')]({'where':{'id':_0x2785e5['params']['id']},'include':_0x4ea6d8})[_0x85eb('0x27')](handleEntityNotFound(_0x31422d,null))[_0x85eb('0x27')](function(_0x2f4741){if(_0x2f4741&&_0x2f4741[_0x85eb('0xe6')]){var _0x2a4c48=_0x2f4741[_0x85eb('0xe7')]({'plain':!![]});fs[_0x85eb('0xe8')](_0x39bd74);return BPromise[_0x85eb('0xe9')](_0x2a4c48[_0x85eb('0xe6')],function(_0x57ef2f,_0x24ee12){var _0x3aec49={'from':_0x57ef2f['from'],'to':_0x57ef2f['to'],'subject':_0x57ef2f[_0x85eb('0xe5')],'html':_0x57ef2f[_0x85eb('0xcb')],'headers':{'Date':moment(_0x57ef2f[_0x85eb('0x7f')])[_0x85eb('0xd2')](_0x85eb('0xea'))},'attachments':[]};if(_0x57ef2f['cc']){_0x3aec49[_0x85eb('0xeb')]['Cc']=_0x57ef2f['cc'];}if(_0x57ef2f['bcc']){_0x3aec49[_0x85eb('0xeb')][_0x85eb('0xec')]=_0x57ef2f['bcc'];}return new BPromise(function(_0x51e78d,_0x4660b6){if(_0x57ef2f[_0x85eb('0xe3')]){for(var _0x4e346a=0x0;_0x4e346a<_0x57ef2f[_0x85eb('0xe3')][_0x85eb('0x44')];_0x4e346a++){var _0x535471=_0x57ef2f[_0x85eb('0xe3')][_0x4e346a];var _0x1cc31b=path[_0x85eb('0xde')](_0x2423db,_0x535471[_0x85eb('0xed')]);if(fs[_0x85eb('0xee')](_0x1cc31b)){_0x3aec49['attachments']['push']({'name':_0x535471[_0x85eb('0x3f')],'contentType':_0x535471[_0x85eb('0x70')],'data':fs[_0x85eb('0xef')](_0x1cc31b)});}}}emlformat[_0x85eb('0xf0')](_0x3aec49,function(_0x379019,_0x1d8f25){if(_0x379019)return _0x4660b6(_0x379019);fs[_0x85eb('0xf1')](path['join'](_0x39bd74,util[_0x85eb('0xd2')](_0x85eb('0xf2'),_0x24ee12)),_0x1d8f25);return _0x51e78d(_0x1d8f25);});});})[_0x85eb('0x27')](function(){return new BPromise(function(_0x32a45a,_0x372412){zipdir(_0x39bd74,{'saveTo':_0x1fe0b8},function(_0x2fbf4e,_0x353329){if(_0x2fbf4e)return _0x372412(_0x2fbf4e);return _0x32a45a(_0x353329);});})[_0x85eb('0x27')](function(){return new BPromise(function(_0x91ba2f,_0xa4486f){rimraf(_0x39bd74,function(_0x505b30){if(_0x505b30)_0xa4486f(_0x505b30);return _0x91ba2f();});});})[_0x85eb('0x27')](function(){return _0x31422d[_0x85eb('0xdb')](_0x1fe0b8,_0x529048,function(_0x24974c){if(_0x24974c){console[_0x85eb('0xf3')](_0x85eb('0xf4'),_0x24974c);}else{fs['unlinkSync'](_0x1fe0b8);}});});});}else{return _0x31422d['sendStatus'](0xc8);}})[_0x85eb('0x38')](handleError(_0x31422d,null));}; \ No newline at end of file +var _0xb7e7=['destroy','describe','MailMessage','addMessage','ids','omit','nolimit','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','setTags','emit','mailInteractionTags:save','removeTags','download','unix','join','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','readFileSync','build','writeFileSync','log','err','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','html-to-text','juice','../../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','./mailInteraction.socket','register','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','sendStatus','name','Users','fullname','Tags','TagIds','split','forEach','push','MailInteraction','findOne','lastMsgBody','then','lastMsgText','trimStart','fromString','catch','index','map','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','select','field','color','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','mail_interactions','cm_contacts','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','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?','UserId','plainBody','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','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','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','toString','merge','a.key','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.id','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','i.UserId','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','ui.MailInteractionId\x20IN\x20?','sequelize','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','rawAttributes','include','options','create','body','update'];(function(_0x561d9f,_0x447dea){var _0x4ecca0=function(_0x51a659){while(--_0x51a659){_0x561d9f['push'](_0x561d9f['shift']());}};_0x4ecca0(++_0x447dea);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xb7e7[_0x2faddb];return _0x273c05;};'use strict';var pdf=require(_0x7b7e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7b7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b7e('0x2'));var rp=require('request-promise');var moment=require(_0x7b7e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7b7e('0x4'));var util=require(_0x7b7e('0x5'));var path=require(_0x7b7e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b7e('0x7'));var fs=require('fs');var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var htmlToText=require(_0x7b7e('0xf'));var juice=require(_0x7b7e('0x10'));var Redis=require('ioredis');var authService=require(_0x7b7e('0x11'));var qs=require(_0x7b7e('0x12'));var as=require(_0x7b7e('0x13'));var hardwareService=require(_0x7b7e('0x14'));var logger=require(_0x7b7e('0x15'))(_0x7b7e('0x16'));var utils=require(_0x7b7e('0x17'));var config=require(_0x7b7e('0x18'));var licenseUtil=require(_0x7b7e('0x19'));var db=require('../../mysqldb')['db'];config[_0x7b7e('0x1a')]=_[_0x7b7e('0x1b')](config['redis'],{'host':_0x7b7e('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7b7e('0x1d'))[_0x7b7e('0x1e')](socket);function respondWithStatusCode(_0xf067da,_0x457ec5){_0x457ec5=_0x457ec5||0xcc;return function(_0x3d2fb2){if(_0x3d2fb2){return _0xf067da['sendStatus'](_0x457ec5);}return _0xf067da['status'](_0x457ec5)[_0x7b7e('0x1f')]();};}function respondWithResult(_0x36444d,_0x27f999){_0x27f999=_0x27f999||0xc8;return function(_0x26aaec){if(_0x26aaec){return _0x36444d[_0x7b7e('0x20')](_0x27f999)[_0x7b7e('0x21')](_0x26aaec);}};}function respondWithFilteredResult(_0x242368,_0x200ef7){return function(_0x2acb8c){if(_0x2acb8c){var _0x429a0e=_0x2acb8c[_0x7b7e('0x22')],_0x12e8e9=_0x200ef7[_0x7b7e('0x23')],_0x14f4fe=_0x200ef7[_0x7b7e('0x23')]+_0x200ef7[_0x7b7e('0x24')],_0x448980;if(_0x14f4fe>=_0x429a0e){_0x14f4fe=_0x429a0e;_0x448980=0xc8;}else{_0x448980=0xce;}_0x242368['status'](_0x448980);return _0x242368[_0x7b7e('0x25')](_0x7b7e('0x26'),_0x12e8e9+'-'+_0x14f4fe+'/'+_0x429a0e)[_0x7b7e('0x21')](_0x2acb8c);}return null;};}function patchUpdates(_0x4c0647){return function(_0x313122){try{jsonpatch[_0x7b7e('0x27')](_0x313122,_0x4c0647,!![]);}catch(_0x14243b){return BPromise[_0x7b7e('0x28')](_0x14243b);}return _0x313122[_0x7b7e('0x29')]();};}function saveUpdates(_0x303d8c,_0x28bf43){return function(_0x10a66a){if(_0x10a66a){return _0x10a66a['update'](_0x303d8c)['then'](function(_0x4a836a){return _0x4a836a;});}return null;};}function removeEntity(_0x26ee14,_0x22598e){return function(_0x23bfa3){if(_0x23bfa3){return _0x23bfa3['destroy']()['then'](function(){_0x26ee14['status'](0xcc)[_0x7b7e('0x1f')]();});}};}function handleEntityNotFound(_0x3c8192,_0x16a3c7){return function(_0x7aa71){if(!_0x7aa71){_0x3c8192[_0x7b7e('0x2a')](0x194);}return _0x7aa71;};}function handleError(_0x48fad1,_0x6a1e71){_0x6a1e71=_0x6a1e71||0x1f4;return function(_0x21a15){logger['error'](_0x21a15['stack']);if(_0x21a15['name']){delete _0x21a15[_0x7b7e('0x2b')];}_0x48fad1[_0x7b7e('0x20')](_0x6a1e71)['send'](_0x21a15);};}function getInteractionUsers(_0x3db8c4,_0x51d4b5){return new BPromise(function(_0x1b4341,_0xb9b6bf){try{if(_0x51d4b5[_0x3db8c4['id']]){_0x3db8c4[_0x7b7e('0x2c')]=_['map'](_0x51d4b5[_0x3db8c4['id']],function(_0x3960b8){return{'id':_0x3960b8['id'],'fullname':_0x3960b8[_0x7b7e('0x2d')]};});}}catch(_0x35602a){_0xb9b6bf(_0x35602a);}_0x1b4341(_0x3db8c4);});}function getInteractionTags(_0x326dd2,_0x33f9a1){return new BPromise(function(_0x5732ee,_0x41af57){try{if(_0x326dd2['TagIds']){_0x326dd2[_0x7b7e('0x2e')]=[];_0x326dd2[_0x7b7e('0x2f')][_0x7b7e('0x30')](',')[_0x7b7e('0x31')](function(_0x378faa){_0x326dd2[_0x7b7e('0x2e')][_0x7b7e('0x32')](_0x33f9a1[_0x378faa]);});}delete _0x326dd2['TagIds'];}catch(_0x5227a7){_0x41af57(_0x5227a7);}_0x5732ee(_0x326dd2);});}function getLastMessageText(_0xebcdbc){return new BPromise(function(_0x162b84,_0x5f25fe){return db[_0x7b7e('0x33')][_0x7b7e('0x34')]({'where':{'id':_0xebcdbc['id']},'attributes':[_0x7b7e('0x35'),'lastMsgText'],'raw':!![]})[_0x7b7e('0x36')](function(_0x256908){if(!_0x256908[_0x7b7e('0x37')]){_0xebcdbc[_0x7b7e('0x37')]=_[_0x7b7e('0x38')](htmlToText[_0x7b7e('0x39')](_0x256908[_0x7b7e('0x35')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0xebcdbc[_0x7b7e('0x37')]=_0x256908[_0x7b7e('0x37')];}_0x162b84(_0xebcdbc);})[_0x7b7e('0x3a')](function(_0xd5a64d){_0x5f25fe(_0xd5a64d);});});}function updateMailInteraction(_0x2d0620,_0x442366,_0xdcb8ef,_0x116563){return new BPromise(function(_0x279f46,_0x5a4f92){return getInteractionUsers(_0x2d0620,_0xdcb8ef)[_0x7b7e('0x36')](function(_0x156dca){return getInteractionTags(_0x156dca,_0x442366);})[_0x7b7e('0x36')](function(_0x242609){if(_0x116563){_0x279f46(getLastMessageText(_0x242609));}else{_0x279f46(_0x242609);}})[_0x7b7e('0x3a')](function(_0x909c65){_0x5a4f92(_0x909c65);});});}exports[_0x7b7e('0x3b')]=function(_0x1e6280,_0x1c6d11){var _0x18011c={},_0x5f3de5={},_0x3d6571={'count':0x0,'rows':[]};var _0x1fa75b=_[_0x7b7e('0x3c')](db[_0x7b7e('0x33')]['rawAttributes'],function(_0x280748){return{'name':_0x280748[_0x7b7e('0x3d')],'type':_0x280748[_0x7b7e('0x3e')]['key']};});_0x5f3de5['model']=_[_0x7b7e('0x3c')](_0x1fa75b,'name');_0x5f3de5[_0x7b7e('0x3f')]=_[_0x7b7e('0x40')](_0x1e6280['query']);_0x5f3de5[_0x7b7e('0x41')]=_[_0x7b7e('0x42')](_0x5f3de5[_0x7b7e('0x43')],_0x5f3de5[_0x7b7e('0x3f')]);_0x18011c[_0x7b7e('0x44')]=_[_0x7b7e('0x42')](_0x5f3de5[_0x7b7e('0x43')],qs[_0x7b7e('0x45')](_0x1e6280[_0x7b7e('0x3f')]['fields']));_0x18011c['attributes']=_0x18011c[_0x7b7e('0x44')]['length']?_0x18011c[_0x7b7e('0x44')]:_0x5f3de5['model'];if(!_0x1e6280['query'][_0x7b7e('0x46')]('nolimit')){_0x18011c[_0x7b7e('0x24')]=qs['limit'](_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x24')]);_0x18011c[_0x7b7e('0x23')]=qs[_0x7b7e('0x23')](_0x1e6280['query'][_0x7b7e('0x23')]);}_0x18011c[_0x7b7e('0x47')]=qs[_0x7b7e('0x48')](_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x48')]);_0x18011c[_0x7b7e('0x49')]=qs['filters'](_['pick'](_0x1e6280['query'],_0x5f3de5[_0x7b7e('0x41')]),_0x1fa75b);var _0x3576f1=[];var _0x2f9de2=squel[_0x7b7e('0x4a')]()[_0x7b7e('0x4b')]('id')[_0x7b7e('0x4b')]('name')[_0x7b7e('0x4b')](_0x7b7e('0x4c'))['from']('tools_tags');var _0x1dcb88=squel[_0x7b7e('0x4a')]()[_0x7b7e('0x4b')](_0x7b7e('0x4d'))[_0x7b7e('0x4b')](_0x7b7e('0x4e'))['field'](_0x7b7e('0x4f'))['from'](_0x7b7e('0x50'),'ui')[_0x7b7e('0x51')](_0x7b7e('0x52'),'u',_0x7b7e('0x53'));var _0x58e4e6=squel[_0x7b7e('0x4a')]()[_0x7b7e('0x54')](_0x7b7e('0x55'),'i')[_0x7b7e('0x51')](_0x7b7e('0x56'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x7b7e('0x51')](_0x7b7e('0x52'),'o',_0x7b7e('0x57'))[_0x7b7e('0x51')](_0x7b7e('0x58'),'a','a.id\x20=\x20i.MailAccountId')[_0x7b7e('0x51')](_0x7b7e('0x59'),'me',_0x7b7e('0x5a'))[_0x7b7e('0x51')](_0x7b7e('0x5b'),'it',_0x7b7e('0x5c'))[_0x7b7e('0x51')]('tools_tags','t',_0x7b7e('0x5d'));var _0x5d7c89=squel[_0x7b7e('0x5e')]();var _0x766a54=[];var _0x570303=squel[_0x7b7e('0x5e')]();var _0x44e3a0;if(_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x5f')]){_0x44e3a0=as[_0x7b7e('0x60')](_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x5f')]);var _0x5f15ce=_0x44e3a0[_0x7b7e('0x61')];for(var _0x3ff731=0x0;_0x3ff731<_0x44e3a0[_0x7b7e('0x62')][_0x7b7e('0x63')];_0x3ff731++){var _0x5b9ab5=_0x44e3a0['conditions'][_0x3ff731];var _0x5bdf1d='i';var _0x2471ad=_[_0x7b7e('0x64')](_0x1fa75b,[_0x7b7e('0x2b'),_0x5b9ab5['field']]);if(!_0x2471ad){switch(_0x5b9ab5['field']){case _0x7b7e('0x65'):if(_0x5b9ab5[_0x7b7e('0x66')]==0x1){_0x58e4e6['having']('`'+_0x5b9ab5[_0x7b7e('0x4b')]+_0x7b7e('0x67'));}else{_0x58e4e6[_0x7b7e('0x68')]('`'+_0x5b9ab5['field']+_0x7b7e('0x69'));}break;case _0x7b7e('0x6a'):if(_0x5b9ab5['operator']===_0x7b7e('0x6b')){if(_0x5b9ab5[_0x7b7e('0x66')][_0x7b7e('0x30')]('\x20')[_0x7b7e('0x63')]>0x1){_0x5d7c89[_0x5f15ce](_0x7b7e('0x6c'),qs[_0x7b7e('0x6d')](_0x5b9ab5[_0x7b7e('0x66')]),null);}else{var _0x2d1908='%'+_0x5b9ab5[_0x7b7e('0x66')]+'%';_0x5d7c89[_0x5f15ce]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2d1908,_0x2d1908,_0x2d1908);}}else{_0x2471ad=_[_0x7b7e('0x64')](_0x1fa75b,[_0x7b7e('0x2b'),'ContactId']);_0x5b9ab5[_0x7b7e('0x4b')]=_0x7b7e('0x6e');_0x1ebd58=as[_0x7b7e('0x6f')](_0x5bdf1d,_0x2471ad['type'],_0x5b9ab5);_0x5d7c89[_0x5f15ce](_0x1ebd58[_0x7b7e('0x70')],_0x1ebd58['value'][_0x7b7e('0x71')],_0x1ebd58[_0x7b7e('0x66')]['end']);}break;case _0x7b7e('0x72'):var _0x3b3168=_0x5b9ab5['value'][_0x7b7e('0x30')](',')[_0x7b7e('0x3c')](function(_0x1d43af){return Number(_0x1d43af);});_0x3b3168[_0x7b7e('0x31')](function(_0x5eb32c){_0x570303['or'](_0x7b7e('0x73'),'%,'+_0x5eb32c+',%');});_0x766a54=_[_0x7b7e('0x74')](_0x766a54,_0x3b3168);break;case _0x7b7e('0x75'):if(_0x5b9ab5[_0x7b7e('0x76')]===_0x7b7e('0x6b')){_0x5d7c89[_0x5f15ce](_0x7b7e('0x77'),'%'+_0x5b9ab5[_0x7b7e('0x66')]+'%',null);}else{_0x2471ad=_[_0x7b7e('0x64')](_0x1fa75b,[_0x7b7e('0x2b'),_0x7b7e('0x78')]);_0x5b9ab5['field']=_0x7b7e('0x78');_0x1ebd58=as['buildExpression'](_0x5bdf1d,_0x2471ad['type'],_0x5b9ab5);_0x5d7c89[_0x5f15ce](_0x1ebd58[_0x7b7e('0x70')],_0x1ebd58[_0x7b7e('0x66')][_0x7b7e('0x71')],_0x1ebd58[_0x7b7e('0x66')]['end']);}break;case _0x7b7e('0x79'):_0x1ebd58=as[_0x7b7e('0x6f')]('me',null,_0x5b9ab5);_0x5d7c89[_0x5f15ce](_0x1ebd58[_0x7b7e('0x70')],_0x1ebd58[_0x7b7e('0x66')][_0x7b7e('0x71')],_0x1ebd58[_0x7b7e('0x66')]['end']);break;}}else{var _0x1ebd58=as['buildExpression'](_0x5bdf1d,_0x2471ad['type'],_0x5b9ab5);_0x5d7c89[_0x5f15ce](_0x1ebd58[_0x7b7e('0x70')],_0x1ebd58['value'][_0x7b7e('0x71')],_0x1ebd58['value'][_0x7b7e('0x1f')]);}}}else{var _0x148dde=_(_0x1e6280['query'])[_0x7b7e('0x40')]()[_0x7b7e('0x3c')](function(_0x57e88f){return _[_0x7b7e('0x7a')](_0x1fa75b,[_0x7b7e('0x2b'),_0x57e88f])?_0x57e88f:undefined;})[_0x7b7e('0x7b')]()[_0x7b7e('0x66')]();if(!_[_0x7b7e('0x7c')](_0x148dde)){_0x148dde[_0x7b7e('0x31')](function(_0x8e9813){if(_0x8e9813===_0x7b7e('0x7d')){_0x58e4e6[_0x7b7e('0x49')](_0x7b7e('0x7e'),[]['concat'](_0x1e6280['query'][_0x8e9813]));}else if(_0x8e9813===_0x7b7e('0x7f')){var _0x46ac1f=JSON[_0x7b7e('0x80')](_0x1e6280[_0x7b7e('0x3f')][_0x8e9813])[_0x7b7e('0x81')];var _0x4e2c2b=JSON[_0x7b7e('0x80')](_0x1e6280['query'][_0x8e9813])[_0x7b7e('0x82')];_0x58e4e6[_0x7b7e('0x49')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x46ac1f,_0x4e2c2b);}else{if(_0x1e6280[_0x7b7e('0x3f')][_0x8e9813]===_0x7b7e('0x83')){_0x58e4e6[_0x7b7e('0x49')]('i.'+_0x8e9813+_0x7b7e('0x84'));}else{_0x58e4e6[_0x7b7e('0x49')]('i.'+_0x8e9813+_0x7b7e('0x85'),_0x1e6280[_0x7b7e('0x3f')][_0x8e9813]);}}});}if(_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x86')]){if(_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x86')]==0x1){_0x58e4e6['having'](_0x7b7e('0x87'));}else{_0x58e4e6[_0x7b7e('0x68')](_0x7b7e('0x88'));}}if(_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x89')]){_0x766a54=_[_0x7b7e('0x8a')](_0x1e6280[_0x7b7e('0x3f')]['tag'])?_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x89')]:new Array(_0x1e6280[_0x7b7e('0x3f')]['tag']);_0x766a54[_0x7b7e('0x31')](function(_0x195ae2){_0x570303['or'](_0x7b7e('0x73'),'%,'+_0x195ae2+',%');});}if(_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x8b')]){var _0x5ca9cd=_0x1e6280['query']['filter'][_0x7b7e('0x8c')]('\x5c','\x5c\x5c')[_0x7b7e('0x8c')](/'/g,'\x27\x27');if(qs[_0x7b7e('0x8d')](_0x5ca9cd)){_0x5d7c89['or']('i.id\x20LIKE\x20?',_0x5ca9cd+'%');}else if(qs[_0x7b7e('0x8e')](_0x5ca9cd)){_0x5d7c89['or'](_0x7b7e('0x8f'),_0x5ca9cd+'%');}else{_0x5d7c89['or'](_0x7b7e('0x90'),qs['getFullTextValue'](_0x5ca9cd))['or'](_0x7b7e('0x91'),qs[_0x7b7e('0x6d')](_0x5ca9cd));}}}_0x58e4e6[_0x7b7e('0x49')](_0x5d7c89);_0x58e4e6[_0x7b7e('0x92')]('i.id');var _0x315923={'type':db[_0x7b7e('0x93')][_0x7b7e('0x94')][_0x7b7e('0x95')],'raw':!![]};var _0x4f0745=_0x58e4e6['clone']();_0x4f0745[_0x7b7e('0x4b')]('i.id');_0x4f0745[_0x7b7e('0x4b')](_0x7b7e('0x96'),_0x7b7e('0x65'));if(_0x18011c[_0x7b7e('0x47')]){_0x18011c['order'][_0x7b7e('0x31')](function(_0x236b59){var _0x2e9cbc=_0x236b59[0x0]===_0x7b7e('0x97')?_0x236b59[0x0]:'i.'+_0x236b59[0x0];_0x58e4e6[_0x7b7e('0x47')](_0x2e9cbc,_0x236b59[0x1]===_0x7b7e('0x98')?![]:!![]);});}if(!_[_0x7b7e('0x7c')](_0x766a54)){_0x58e4e6[_0x7b7e('0x68')](_0x570303);_0x4f0745[_0x7b7e('0x49')](_0x7b7e('0x99'),_0x766a54);}BPromise[_0x7b7e('0x9a')]()[_0x7b7e('0x36')](function(){if(!_0x44e3a0){if(_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x7d')])return;_0x4f0745[_0x7b7e('0x49')](_0x7b7e('0x9b'));_0x58e4e6['where'](_0x7b7e('0x9b'));return;}if(_0x1e6280[_0x7b7e('0x9c')][_0x7b7e('0x9d')]!==_0x7b7e('0x9e'))return;return _0x1e6280[_0x7b7e('0x9c')][_0x7b7e('0x9f')]({'attributes':['id'],'raw':!![]})[_0x7b7e('0x36')](function(_0x5f075a){if(_[_0x7b7e('0x7c')](_0x5f075a)){_0x4f0745[_0x7b7e('0x49')](_0x7b7e('0xa0'));_0x58e4e6[_0x7b7e('0x49')](_0x7b7e('0xa0'));}else{_0x4f0745['where']('i.MailAccountId\x20IN\x20?',_[_0x7b7e('0x3c')](_0x5f075a,'id'));_0x58e4e6[_0x7b7e('0x49')](_0x7b7e('0x7e'),_[_0x7b7e('0x3c')](_0x5f075a,'id'));}});})[_0x7b7e('0x36')](function(){if(_0x1e6280[_0x7b7e('0x9c')][_0x7b7e('0x9d')]===_0x7b7e('0x9e')&&!_0x44e3a0&&!_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x7d')])return[];return db['sequelize'][_0x7b7e('0x3f')](_0x4f0745[_0x7b7e('0xa1')](),_0x315923);})[_0x7b7e('0x36')](function(_0x297a6f){_0x3d6571[_0x7b7e('0x22')]=_0x297a6f[_0x7b7e('0x63')];if(_0x3d6571[_0x7b7e('0x22')]===0x0)return[];return db['sequelize'][_0x7b7e('0x3f')](_0x2f9de2['toString'](),_0x315923)[_0x7b7e('0x36')](function(_0xdc6a5c){_0x3576f1=_['keyBy'](_0xdc6a5c,'id');_0x315923=_[_0x7b7e('0xa2')](_0x315923,{'model':db[_0x7b7e('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1e6280[_0x7b7e('0x3f')][_0x7b7e('0x45')]){_0x18011c[_0x7b7e('0x44')]['forEach'](function(_0x222b46){_0x58e4e6['field']('i.'+_0x222b46);});}else{_0x58e4e6['field'](_0x7b7e('0x96'),_0x7b7e('0x65'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xa3'),'Account.key');_0x58e4e6[_0x7b7e('0x4b')]('a.mandatoryDisposition',_0x7b7e('0xa4'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xa5'),_0x7b7e('0x97'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xa6'));_0x58e4e6[_0x7b7e('0x4b')]('i.createdAt');_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xa7'));_0x58e4e6['field'](_0x7b7e('0xa8'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xa9'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xaa'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xab'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xac'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xad'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xae'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xaf'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xb0'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xb1'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xb2'));_0x58e4e6[_0x7b7e('0x4b')]('i.ContactId');_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xb3'));_0x58e4e6['field'](_0x7b7e('0xb4'));_0x58e4e6['field']('c.firstName',_0x7b7e('0xb5'));_0x58e4e6['field']('c.lastName',_0x7b7e('0xb6'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xb7'),'Contact.email');_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xb8'),_0x7b7e('0xb9'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xba'),_0x7b7e('0xbb'));_0x58e4e6[_0x7b7e('0x4b')](_0x7b7e('0xbc'),_0x7b7e('0xbd'));_0x58e4e6['field'](_0x7b7e('0xbe'),_0x7b7e('0xbf'));_0x58e4e6[_0x7b7e('0x4b')]('o.internal',_0x7b7e('0xc0'));_0x58e4e6[_0x7b7e('0x4b')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x7b7e('0x2f'));}if(_0x18011c['limit'])_0x58e4e6['limit'](_0x18011c[_0x7b7e('0x24')]);if(_0x18011c[_0x7b7e('0x23')])_0x58e4e6['offset'](_0x18011c[_0x7b7e('0x23')]);return db['sequelize']['query'](_0x58e4e6[_0x7b7e('0xa1')](),_0x315923);})[_0x7b7e('0x36')](function(_0x2fac17){_0x1dcb88[_0x7b7e('0x49')](_0x7b7e('0xc1'),_[_0x7b7e('0x3c')](_0x2fac17,'id'));return db[_0x7b7e('0xc2')][_0x7b7e('0x3f')](_0x1dcb88['toString'](),_0x315923)[_0x7b7e('0x36')](function(_0x1e2bb7){var _0x3cc9bd=_[_0x7b7e('0xc3')](_0x1e2bb7,_0x7b7e('0xc4'));var _0x13c910=[];return db[_0x7b7e('0xc5')][_0x7b7e('0x34')]({'attributes':[_0x7b7e('0xc6')],'raw':!![]})[_0x7b7e('0x36')](function(_0x2f9f24){var _0x16ca92=_0x2f9f24['enableEmailPreview'];_0x2fac17['forEach'](function(_0x7d61a6){_0x13c910[_0x7b7e('0x32')](updateMailInteraction(_0x7d61a6,_0x3576f1,_0x3cc9bd,_0x16ca92));});return BPromise[_0x7b7e('0xc7')](_0x13c910);});});});})[_0x7b7e('0x36')](function(_0xb5e531){_0x3d6571[_0x7b7e('0xc8')]=_0xb5e531;return _0x3d6571;})[_0x7b7e('0x36')](respondWithFilteredResult(_0x1c6d11,_0x18011c))[_0x7b7e('0x3a')](handleError(_0x1c6d11,null));};exports[_0x7b7e('0xc9')]=function(_0x845b44,_0x1dfd0d){var _0x336f40={'raw':![],'where':{'id':_0x845b44[_0x7b7e('0xca')]['id']}},_0x4f22c5={};_0x4f22c5['model']=_[_0x7b7e('0x40')](db[_0x7b7e('0x33')][_0x7b7e('0xcb')]);_0x4f22c5['query']=_['keys'](_0x845b44['query']);_0x4f22c5[_0x7b7e('0x41')]=_[_0x7b7e('0x42')](_0x4f22c5[_0x7b7e('0x43')],_0x4f22c5[_0x7b7e('0x3f')]);_0x336f40[_0x7b7e('0x44')]=_[_0x7b7e('0x42')](_0x4f22c5[_0x7b7e('0x43')],qs[_0x7b7e('0x45')](_0x845b44[_0x7b7e('0x3f')][_0x7b7e('0x45')]));_0x336f40[_0x7b7e('0x44')]=_0x336f40['attributes'][_0x7b7e('0x63')]?_0x336f40[_0x7b7e('0x44')]:_0x4f22c5[_0x7b7e('0x43')];if(_0x845b44[_0x7b7e('0x3f')]['includeAll']){_0x336f40[_0x7b7e('0xcc')]=[{'all':!![]}];}_0x336f40=_[_0x7b7e('0xa2')]({},_0x336f40,_0x845b44[_0x7b7e('0xcd')]);return db[_0x7b7e('0x33')][_0x7b7e('0x64')](_0x336f40)[_0x7b7e('0x36')](handleEntityNotFound(_0x1dfd0d,null))[_0x7b7e('0x36')](respondWithResult(_0x1dfd0d,null))[_0x7b7e('0x3a')](handleError(_0x1dfd0d,null));};exports[_0x7b7e('0xce')]=function(_0x34491e,_0x309a08){return db[_0x7b7e('0x33')][_0x7b7e('0xce')](_0x34491e[_0x7b7e('0xcf')],{})[_0x7b7e('0x36')](respondWithResult(_0x309a08,0xc9))[_0x7b7e('0x3a')](handleError(_0x309a08,null));};exports[_0x7b7e('0xd0')]=function(_0x451862,_0x1ba63b){if(_0x451862[_0x7b7e('0xcf')]['id']){delete _0x451862[_0x7b7e('0xcf')]['id'];}return db[_0x7b7e('0x33')][_0x7b7e('0x64')]({'where':{'id':_0x451862[_0x7b7e('0xca')]['id']}})[_0x7b7e('0x36')](handleEntityNotFound(_0x1ba63b,null))[_0x7b7e('0x36')](saveUpdates(_0x451862[_0x7b7e('0xcf')],null))[_0x7b7e('0x36')](respondWithResult(_0x1ba63b,null))['catch'](handleError(_0x1ba63b,null));};exports[_0x7b7e('0xd1')]=function(_0x4ebfa7,_0x48e6a3){return db['MailInteraction'][_0x7b7e('0x64')]({'where':{'id':_0x4ebfa7[_0x7b7e('0xca')]['id']}})['then'](handleEntityNotFound(_0x48e6a3,null))['then'](removeEntity(_0x48e6a3,null))[_0x7b7e('0x3a')](handleError(_0x48e6a3,null));};exports[_0x7b7e('0xd2')]=function(_0x3b1083,_0x5b0abe){return db[_0x7b7e('0x33')]['describe']()['then'](respondWithResult(_0x5b0abe,null))[_0x7b7e('0x3a')](handleError(_0x5b0abe,null));};exports['addMessage']=function(_0x4deac2,_0xc55b86,_0x32197a){return db[_0x7b7e('0xd3')]['find']({'where':{'id':_0x4deac2['params']['id']}})[_0x7b7e('0x36')](handleEntityNotFound(_0xc55b86,null))[_0x7b7e('0x36')](function(_0x3f5130){if(_0x3f5130){return _0x3f5130[_0x7b7e('0xd4')](_0x4deac2[_0x7b7e('0xcf')][_0x7b7e('0xd5')],_[_0x7b7e('0xd6')](_0x4deac2[_0x7b7e('0xcf')],[_0x7b7e('0xd5'),'id'])||{});}})['then'](respondWithResult(_0xc55b86,null))[_0x7b7e('0x3a')](handleError(_0xc55b86,null));};exports['getMessages']=function(_0x459b23,_0x46690c,_0x41568a){var _0x38fc4f={'raw':![],'where':{}};var _0xc8849f={};var _0x4dfe50={'count':0x0,'rows':[]};return db[_0x7b7e('0x33')][_0x7b7e('0x34')]({'where':{'id':_0x459b23[_0x7b7e('0xca')]['id']}})[_0x7b7e('0x36')](handleEntityNotFound(_0x46690c,null))['then'](function(_0x137ba6){if(_0x137ba6){_0xc8849f[_0x7b7e('0x43')]=_['keys'](db[_0x7b7e('0xd3')][_0x7b7e('0xcb')]);_0xc8849f[_0x7b7e('0x3f')]=_[_0x7b7e('0x40')](_0x459b23[_0x7b7e('0x3f')]);_0xc8849f[_0x7b7e('0x41')]=_[_0x7b7e('0x42')](_0xc8849f[_0x7b7e('0x43')],_0xc8849f[_0x7b7e('0x3f')]);_0x38fc4f[_0x7b7e('0x44')]=_[_0x7b7e('0x42')](_0xc8849f['model'],qs[_0x7b7e('0x45')](_0x459b23[_0x7b7e('0x3f')]['fields']));_0x38fc4f[_0x7b7e('0x44')]=_0x38fc4f['attributes'][_0x7b7e('0x63')]?_0x38fc4f[_0x7b7e('0x44')]:_0xc8849f[_0x7b7e('0x43')];if(!_0x459b23['query'][_0x7b7e('0x46')](_0x7b7e('0xd7'))){_0x38fc4f[_0x7b7e('0x24')]=qs[_0x7b7e('0x24')](_0x459b23[_0x7b7e('0x3f')][_0x7b7e('0x24')]);_0x38fc4f[_0x7b7e('0x23')]=qs[_0x7b7e('0x23')](_0x459b23[_0x7b7e('0x3f')][_0x7b7e('0x23')]);}_0x38fc4f['order']=qs[_0x7b7e('0x48')](_0x459b23[_0x7b7e('0x3f')][_0x7b7e('0x48')]);_0x38fc4f['where']=qs['filters'](_[_0x7b7e('0xd8')](_0x459b23['query'],_0xc8849f['filters']));_0x38fc4f[_0x7b7e('0x49')][_0x7b7e('0xc4')]=_0x137ba6['id'];if(_0x459b23[_0x7b7e('0x3f')]['filter']){_0x38fc4f[_0x7b7e('0x49')]=_[_0x7b7e('0xa2')](_0x38fc4f[_0x7b7e('0x49')],{'$or':_[_0x7b7e('0x3c')](_0x38fc4f[_0x7b7e('0x44')],function(_0x570345){var _0x294d0e={};_0x294d0e[_0x570345]={'$like':'%'+_0x459b23[_0x7b7e('0x3f')][_0x7b7e('0x8b')]+'%'};return _0x294d0e;})});}if(_0x459b23[_0x7b7e('0x3f')][_0x7b7e('0x81')]){var _0x4299dd=_0x459b23['query']['$gte'][_0x7b7e('0x30')](',');var _0x4a9784={};_0x4a9784[_0x4299dd[0x0]]={'$gte':moment(_0x4299dd[0x1])[_0x7b7e('0xd9')](_0x7b7e('0xda'))};_0x38fc4f[_0x7b7e('0x49')]=_[_0x7b7e('0xa2')](_0x38fc4f[_0x7b7e('0x49')],_0x4a9784);}_0x38fc4f=_[_0x7b7e('0xa2')]({},_0x38fc4f,_0x459b23[_0x7b7e('0xcd')]);return db['MailMessage']['count']({'where':_0x38fc4f[_0x7b7e('0x49')]})[_0x7b7e('0x36')](function(_0x57852b){_0x4dfe50[_0x7b7e('0x22')]=_0x57852b;if(_0x459b23[_0x7b7e('0x3f')]['includeAll']){_0x38fc4f['include']=[{'all':!![]}];}return db[_0x7b7e('0xd3')][_0x7b7e('0xdb')](_0x38fc4f);})[_0x7b7e('0x36')](function(_0x5c8b43){if(_0x459b23[_0x7b7e('0x3f')][_0x7b7e('0xdc')]===_0x7b7e('0xdd')){for(var _0x23bcbc=0x0;_0x23bcbc<_0x5c8b43[_0x7b7e('0x63')];_0x23bcbc++){_0x5c8b43[_0x23bcbc][_0x7b7e('0xcf')]=juice(_0x5c8b43[_0x23bcbc][_0x7b7e('0xcf')]);}}_0x4dfe50[_0x7b7e('0xc8')]=_0x5c8b43;return _0x4dfe50;});}})[_0x7b7e('0x36')](respondWithFilteredResult(_0x46690c,_0x38fc4f))[_0x7b7e('0x3a')](handleError(_0x46690c,null));};exports['addTags']=function(_0x4e7778,_0x5b190a,_0x38e8e6){return db['MailInteraction'][_0x7b7e('0x64')]({'where':{'id':_0x4e7778[_0x7b7e('0xca')]['id']}})[_0x7b7e('0x36')](handleEntityNotFound(_0x5b190a,null))['then'](function(_0xa058e6){if(_0xa058e6){return _0xa058e6[_0x7b7e('0xde')](_0x4e7778[_0x7b7e('0xcf')][_0x7b7e('0xd5')],_[_0x7b7e('0xd6')](_0x4e7778[_0x7b7e('0xcf')],[_0x7b7e('0xd5'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x7b7e('0x2b'),_0x7b7e('0x4c')],'where':{'id':_0x4e7778[_0x7b7e('0xcf')][_0x7b7e('0xd5')]}});})[_0x7b7e('0x36')](function(_0xfc2b35){socket[_0x7b7e('0xdf')](_0x7b7e('0xe0'),{'id':Number(_0x4e7778[_0x7b7e('0xca')]['id']),'tags':_0xfc2b35||[]});return{'id':Number(_0x4e7778['params']['id']),'tags':_0xfc2b35||[]};});}})[_0x7b7e('0x36')](respondWithResult(_0x5b190a,null))[_0x7b7e('0x3a')](handleError(_0x5b190a,null));};exports[_0x7b7e('0xe1')]=function(_0x593a09,_0x188c70,_0x57d6fe){return db[_0x7b7e('0x33')][_0x7b7e('0x64')]({'where':{'id':_0x593a09[_0x7b7e('0xca')]['id']}})[_0x7b7e('0x36')](handleEntityNotFound(_0x188c70,null))['then'](function(_0x40b101){if(_0x40b101){return _0x40b101[_0x7b7e('0xe1')](_0x593a09[_0x7b7e('0x3f')][_0x7b7e('0xd5')]);}})[_0x7b7e('0x36')](respondWithStatusCode(_0x188c70,null))['catch'](handleError(_0x188c70,null));};exports[_0x7b7e('0xe2')]=function(_0xffaeea,_0x1aa06f){var _0x270cb9=moment()[_0x7b7e('0xe3')]()[_0x7b7e('0xa1')]();var _0x2502c0=path[_0x7b7e('0xe4')](config['root'],_0x7b7e('0xe5'),_0x7b7e('0xe6'),_0x7b7e('0xe7'));var _0x3ac56f=path[_0x7b7e('0xe4')](config['root'],_0x7b7e('0xe5'),_0x7b7e('0xe6'),_0x7b7e('0xe8'));var _0x3b972e=path[_0x7b7e('0xe4')](_0x2502c0,_0x270cb9);var _0x7fe4fe=util[_0x7b7e('0xd9')](_0x7b7e('0xe9'),_0xffaeea[_0x7b7e('0xca')]['id'],_0x270cb9);var _0x368a2b=path['join'](_0x2502c0,_0x7fe4fe);var _0x44d724=[];if(_0xffaeea['query'][_0x7b7e('0xe8')]){_0x44d724[_0x7b7e('0x32')]({'model':db[_0x7b7e('0xea')],'as':_0x7b7e('0xeb'),'raw':!![]});}var _0x2b23bf=[{'model':db[_0x7b7e('0xd3')],'as':_0x7b7e('0xec'),'attributes':['id',_0x7b7e('0xcf'),_0x7b7e('0x54'),'to','cc',_0x7b7e('0xed'),_0x7b7e('0xee'),_0x7b7e('0x7f')],'where':{'secret':![]},'order':qs[_0x7b7e('0x48')]('id'),'include':_0x44d724}];return db['MailInteraction']['find']({'where':{'id':_0xffaeea[_0x7b7e('0xca')]['id']},'include':_0x2b23bf})['then'](handleEntityNotFound(_0x1aa06f,null))[_0x7b7e('0x36')](function(_0x229b43){if(_0x229b43&&_0x229b43[_0x7b7e('0xec')]){var _0x28fe8a=_0x229b43[_0x7b7e('0xef')]({'plain':!![]});fs['mkdirSync'](_0x3b972e);return BPromise[_0x7b7e('0xf0')](_0x28fe8a['Messages'],function(_0x4c79cd,_0x4fd511){var _0x4213ae={'from':_0x4c79cd[_0x7b7e('0x54')],'to':_0x4c79cd['to'],'subject':_0x4c79cd[_0x7b7e('0xee')],'html':_0x4c79cd[_0x7b7e('0xcf')],'headers':{'Date':moment(_0x4c79cd[_0x7b7e('0x7f')])[_0x7b7e('0xd9')](_0x7b7e('0xf1'))},'attachments':[]};if(_0x4c79cd['cc']){_0x4213ae['headers']['Cc']=_0x4c79cd['cc'];}if(_0x4c79cd[_0x7b7e('0xed')]){_0x4213ae[_0x7b7e('0xf2')][_0x7b7e('0xf3')]=_0x4c79cd[_0x7b7e('0xed')];}return new BPromise(function(_0x10a228,_0x1c4f7c){if(_0x4c79cd[_0x7b7e('0xeb')]){for(var _0x7025d7=0x0;_0x7025d7<_0x4c79cd[_0x7b7e('0xeb')][_0x7b7e('0x63')];_0x7025d7++){var _0x4510f6=_0x4c79cd[_0x7b7e('0xeb')][_0x7025d7];var _0x23e672=path[_0x7b7e('0xe4')](_0x3ac56f,_0x4510f6['basename']);if(fs['existsSync'](_0x23e672)){_0x4213ae[_0x7b7e('0xe8')][_0x7b7e('0x32')]({'name':_0x4510f6[_0x7b7e('0x2b')],'contentType':_0x4510f6['type'],'data':fs[_0x7b7e('0xf4')](_0x23e672)});}}}emlformat[_0x7b7e('0xf5')](_0x4213ae,function(_0x1fecfb,_0x40203f){if(_0x1fecfb)return _0x1c4f7c(_0x1fecfb);fs[_0x7b7e('0xf6')](path['join'](_0x3b972e,util['format']('message%d.eml',_0x4fd511)),_0x40203f);return _0x10a228(_0x40203f);});});})[_0x7b7e('0x36')](function(){return new BPromise(function(_0xec692d,_0x3a5b34){zipdir(_0x3b972e,{'saveTo':_0x368a2b},function(_0x929974,_0x3f0f57){if(_0x929974)return _0x3a5b34(_0x929974);return _0xec692d(_0x3f0f57);});})['then'](function(){return new BPromise(function(_0x27bd67,_0x4a491a){rimraf(_0x3b972e,function(_0x2d17ae){if(_0x2d17ae)_0x4a491a(_0x2d17ae);return _0x27bd67();});});})['then'](function(){return _0x1aa06f['download'](_0x368a2b,_0x7fe4fe,function(_0x4d5be8){if(_0x4d5be8){console[_0x7b7e('0xf7')](_0x7b7e('0xf8'),_0x4d5be8);}else{fs['unlinkSync'](_0x368a2b);}});});});}else{return _0x1aa06f[_0x7b7e('0x2a')](0xc8);}})[_0x7b7e('0x3a')](handleError(_0x1aa06f,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 95c842f..2916014 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 _0xae13=['../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','exports','events'];(function(_0x19ec66,_0x255716){var _0x33bc01=function(_0x46445f){while(--_0x46445f){_0x19ec66['push'](_0x19ec66['shift']());}};_0x33bc01(++_0x255716);}(_0xae13,0xc5));var _0x3ae1=function(_0x2af63c,_0x44ab62){_0x2af63c=_0x2af63c-0x0;var _0x1a9ecb=_0xae13[_0x2af63c];return _0x1a9ecb;};'use strict';var EventEmitter=require(_0x3ae1('0x0'));var MailInteraction=require(_0x3ae1('0x1'))['db'][_0x3ae1('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x3ae1('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x3ae1('0x4')](0x0);var events={'afterCreate':_0x3ae1('0x5'),'afterUpdate':_0x3ae1('0x6'),'afterDestroy':_0x3ae1('0x7')};function emitEvent(_0x2ce830){return function(_0x4ea358,_0x2a772f,_0x2764d4){_0x4ea358[_0x3ae1('0x8')]({'attributes':['id'],'raw':!![]})[_0x3ae1('0x9')](function(_0x4a4086){_0x4ea358['setDataValue'](_0x3ae1('0xa'),_0x4a4086['map'](function(_0x13afb5){return{'id':_0x13afb5['id']};}));return MailMessage[_0x3ae1('0xb')]({'where':{'MailInteractionId':_0x4ea358['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x160727){_0x4ea358[_0x3ae1('0xc')](_0x3ae1('0xd'),_0x160727['length']);MailInteractionEvents['emit'](_0x2ce830+':'+_0x4ea358['id'],_0x4ea358);MailInteractionEvents[_0x3ae1('0xe')](_0x2ce830,_0x4ea358);_0x2764d4(null);})[_0x3ae1('0xf')](_0x2764d4(null));};}for(var e in events){if(events[_0x3ae1('0x10')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x3ae1('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0xf3fc=['Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','getUsers'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xf3fc,0x1a2));var _0xcf3f=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf3fc[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0xcf3f('0x0'));var MailInteraction=require(_0xcf3f('0x1'))['db'][_0xcf3f('0x2')];var MailMessage=require(_0xcf3f('0x1'))['db'][_0xcf3f('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xcf3f('0x4')](0x0);var events={'afterCreate':_0xcf3f('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x8a6516){return function(_0xee0903,_0x406748,_0x1400cb){_0xee0903[_0xcf3f('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x277211){_0xee0903['setDataValue'](_0xcf3f('0x7'),_0x277211[_0xcf3f('0x8')](function(_0xc2d1a9){return{'id':_0xc2d1a9['id']};}));return MailMessage[_0xcf3f('0x9')]({'where':{'MailInteractionId':_0xee0903['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcf3f('0xa')](function(_0x2c1952){_0xee0903['setDataValue'](_0xcf3f('0xb'),_0x2c1952[_0xcf3f('0xc')]);MailInteractionEvents[_0xcf3f('0xd')](_0x8a6516+':'+_0xee0903['id'],_0xee0903);MailInteractionEvents[_0xcf3f('0xd')](_0x8a6516,_0xee0903);_0x1400cb(null);})[_0xcf3f('0xe')](_0x1400cb(null));};}for(var e in events){if(events[_0xcf3f('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xcf3f('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 90d5594..2b74199 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 _0xeffd=['request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x505ca0,_0x2b7dbe){var _0x95ac11=function(_0x34c825){while(--_0x34c825){_0x505ca0['push'](_0x505ca0['shift']());}};_0x95ac11(++_0x2b7dbe);}(_0xeffd,0x6b));var _0xdeff=function(_0xc20e1f,_0x4ee309){_0xc20e1f=_0xc20e1f-0x0;var _0x59e7f0=_0xeffd[_0xc20e1f];return _0x59e7f0;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var logger=require(_0xdeff('0x1'))(_0xdeff('0x2'));var moment=require(_0xdeff('0x3'));var BPromise=require(_0xdeff('0x4'));var rp=require(_0xdeff('0x5'));var fs=require('fs');var path=require(_0xdeff('0x6'));var rimraf=require(_0xdeff('0x7'));var config=require(_0xdeff('0x8'));var attributes=require(_0xdeff('0x9'));module[_0xdeff('0xa')]=function(_0x1ed641,_0x132631){return _0x1ed641[_0xdeff('0xb')](_0xdeff('0xc'),attributes,{'tableName':_0xdeff('0xd'),'paranoid':![],'indexes':[{'name':_0xdeff('0xe'),'fields':[_0xdeff('0xf'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3ae201,_0x45a8a6,_0xf6d58d){if(_0x3ae201['substatus']){_0x3ae201[_0xdeff('0x10')]=moment()[_0xdeff('0x11')](_0xdeff('0x12'));}if(_0x3ae201[_0xdeff('0x13')]){_0x3ae201[_0xdeff('0x14')]=moment()[_0xdeff('0x11')](_0xdeff('0x12'));}_0xf6d58d(null,_0x45a8a6);},'beforeUpdate':function(_0x402075,_0x505d0c,_0x461699){if(_0x402075[_0xdeff('0x15')]('substatus')){_0x402075[_0xdeff('0x10')]=_0x402075['substatus']?moment()['format'](_0xdeff('0x12')):null;}if(_0x402075[_0xdeff('0x15')](_0xdeff('0x13'))){_0x402075[_0xdeff('0x14')]=moment()['format'](_0xdeff('0x12'));_0x402075[_0xdeff('0x16')]=null;_0x402075[_0xdeff('0x10')]=null;}_0x461699(null,_0x402075);},'afterUpdate':function(_0x391633,_0x3dbba1,_0x125659){var _0x577244=_0x1ed641['models'];var _0x7440af=_0x391633['get']({'plain':!![]});if(_0x7440af['closed']){return _0x577244[_0xdeff('0x17')][_0xdeff('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x7440af['id']}})['then'](function(){_0x125659();})[_0xdeff('0x19')](function(_0x42e98e){_0x125659(_0x42e98e);});}else{_0x125659();}}},'charset':_0xdeff('0x1a'),'collate':_0xdeff('0x1b')});}; \ No newline at end of file +var _0x0298=['YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x0298,0x74));var _0x8029=function(_0x809314,_0xaf27c0){_0x809314=_0x809314-0x0;var _0x1a94b6=_0x0298[_0x809314];return _0x1a94b6;};'use strict';var _=require(_0x8029('0x0'));var util=require(_0x8029('0x1'));var logger=require('../../config/logger')(_0x8029('0x2'));var moment=require('moment');var BPromise=require(_0x8029('0x3'));var rp=require(_0x8029('0x4'));var fs=require('fs');var path=require(_0x8029('0x5'));var rimraf=require(_0x8029('0x6'));var config=require(_0x8029('0x7'));var attributes=require(_0x8029('0x8'));module[_0x8029('0x9')]=function(_0x2be809,_0x5ddb9a){return _0x2be809[_0x8029('0xa')](_0x8029('0xb'),attributes,{'tableName':_0x8029('0xc'),'paranoid':![],'indexes':[{'name':_0x8029('0xd'),'fields':[_0x8029('0xe'),'to'],'type':_0x8029('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x276ca8,_0x5a0ddc,_0x11c672){if(_0x276ca8[_0x8029('0x10')]){_0x276ca8[_0x8029('0x11')]=moment()[_0x8029('0x12')](_0x8029('0x13'));}if(_0x276ca8[_0x8029('0x14')]){_0x276ca8[_0x8029('0x15')]=moment()[_0x8029('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}_0x11c672(null,_0x5a0ddc);},'beforeUpdate':function(_0x19a926,_0x3ee1db,_0x3b9fef){if(_0x19a926[_0x8029('0x16')](_0x8029('0x10'))){_0x19a926[_0x8029('0x11')]=_0x19a926[_0x8029('0x10')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x19a926[_0x8029('0x16')](_0x8029('0x14'))){_0x19a926[_0x8029('0x15')]=moment()[_0x8029('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x19a926[_0x8029('0x10')]=null;_0x19a926[_0x8029('0x11')]=null;}_0x3b9fef(null,_0x19a926);},'afterUpdate':function(_0x5900d5,_0x80d0a7,_0x4fa3cc){var _0xaa28da=_0x2be809[_0x8029('0x17')];var _0x4ce24c=_0x5900d5[_0x8029('0x18')]({'plain':!![]});if(_0x4ce24c[_0x8029('0x14')]){return _0xaa28da['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x4ce24c['id']}})['then'](function(){_0x4fa3cc();})['catch'](function(_0x4863c7){_0x4fa3cc(_0x4863c7);});}else{_0x4fa3cc();}}},'charset':_0x8029('0x19'),'collate':_0x8029('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 3366018..415379b 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 _0xae2b=['info','result','UpdateMailInteraction','MailInteraction','update','options','raw','where','attributes','limit','then','catch','find','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','./mailInteraction.socket','register','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x5ce358,_0xa88c44){var _0x107f30=function(_0x5d7f28){while(--_0x5d7f28){_0x5ce358['push'](_0x5ce358['shift']());}};_0x107f30(++_0xa88c44);}(_0xae2b,0xb3));var _0xbae2=function(_0x14b552,_0x410e6){_0x14b552=_0x14b552-0x0;var _0x1c80cd=_0xae2b[_0x14b552];return _0x1c80cd;};'use strict';var _=require(_0xbae2('0x0'));var util=require(_0xbae2('0x1'));var moment=require('moment');var BPromise=require(_0xbae2('0x2'));var rs=require(_0xbae2('0x3'));var fs=require('fs');var Redis=require(_0xbae2('0x4'));var db=require(_0xbae2('0x5'))['db'];var utils=require(_0xbae2('0x6'));var logger=require(_0xbae2('0x7'))('rpc');var config=require(_0xbae2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbae2('0x9')][_0xbae2('0xa')]({'port':0x232a});config[_0xbae2('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbae2('0xb')]));require(_0xbae2('0xc'))[_0xbae2('0xd')](socket);function respondWithRpcPromise(_0xf470fd,_0x27ea94,_0x193185){return new BPromise(function(_0x843207,_0x5a6d1f){return client['request'](_0xf470fd,_0x193185)['then'](function(_0x2087ed){logger['info'](_0xbae2('0xe'),_0x27ea94,_0xbae2('0xf'));logger[_0xbae2('0x10')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x27ea94,_0xbae2('0xf'),JSON[_0xbae2('0x11')](_0x2087ed));if(_0x2087ed['error']){if(_0x2087ed[_0xbae2('0x12')][_0xbae2('0x13')]===0x1f4){logger[_0xbae2('0x12')](_0xbae2('0xe'),_0x27ea94,_0x2087ed[_0xbae2('0x12')][_0xbae2('0x14')]);return _0x5a6d1f(_0x2087ed[_0xbae2('0x12')]['message']);}logger[_0xbae2('0x12')]('MailInteraction,\x20%s,\x20%s',_0x27ea94,_0x2087ed[_0xbae2('0x12')][_0xbae2('0x14')]);return _0x843207(_0x2087ed['error'][_0xbae2('0x14')]);}else{logger[_0xbae2('0x15')]('MailInteraction,\x20%s,\x20%s',_0x27ea94,_0xbae2('0xf'));_0x843207(_0x2087ed[_0xbae2('0x16')][_0xbae2('0x14')]);}})['catch'](function(_0x21c9fa){logger['error']('MailInteraction,\x20%s,\x20%s',_0x27ea94,_0x21c9fa);_0x5a6d1f(_0x21c9fa);});});}exports[_0xbae2('0x17')]=function(_0x2c40ea){var _0x114fbe=this;return new Promise(function(_0x17433d,_0x53b581){return db[_0xbae2('0x18')][_0xbae2('0x19')](_0x2c40ea['body'],{'raw':_0x2c40ea['options']?_0x2c40ea[_0xbae2('0x1a')][_0xbae2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c40ea[_0xbae2('0x1a')]?_0x2c40ea[_0xbae2('0x1a')][_0xbae2('0x1c')]||null:null,'attributes':_0x2c40ea['options']?_0x2c40ea['options'][_0xbae2('0x1d')]||null:null,'limit':_0x2c40ea[_0xbae2('0x1a')]?_0x2c40ea['options'][_0xbae2('0x1e')]||null:null})[_0xbae2('0x1f')](function(_0x4154fd){logger[_0xbae2('0x15')]('UpdateMailInteraction',_0x2c40ea);logger[_0xbae2('0x10')]('UpdateMailInteraction',_0x2c40ea,JSON[_0xbae2('0x11')](_0x4154fd));_0x17433d(_0x4154fd);})[_0xbae2('0x20')](function(_0x245a74){logger[_0xbae2('0x12')](_0xbae2('0x17'),_0x245a74['message'],_0x2c40ea);_0x53b581(_0x114fbe[_0xbae2('0x12')](0x1f4,_0x245a74[_0xbae2('0x14')]));});});};exports['AddTagsToMailInteraction']=function(_0x1361e7){return new Promise(function(_0x403286,_0x339f83){return db[_0xbae2('0x18')][_0xbae2('0x21')]({'where':_0x1361e7['options']?_0x1361e7[_0xbae2('0x1a')]['where']||null:null})[_0xbae2('0x1f')](function(_0x37e0f7){if(_0x37e0f7){return _0x37e0f7[_0xbae2('0x22')](_0x1361e7[_0xbae2('0x23')][_0xbae2('0x24')],_[_0xbae2('0x25')](_0x1361e7[_0xbae2('0x23')],[_0xbae2('0x24'),'id'])||{});}})[_0xbae2('0x26')](function(_0xc974d8){logger[_0xbae2('0x15')](_0xbae2('0x27'),_0x1361e7);logger[_0xbae2('0x10')](_0xbae2('0x27'),_0x1361e7,JSON[_0xbae2('0x11')](_0xc974d8));_0x403286(_0xc974d8);})[_0xbae2('0x20')](function(_0x4e4a01){logger[_0xbae2('0x12')](_0xbae2('0x27'),_0x4e4a01['message'],_0x1361e7);_0x339f83(_this['error'](0x1f4,_0x4e4a01[_0xbae2('0x14')]));});});}; \ No newline at end of file +var _0xb04a=['info','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','UpdateMailInteraction','MailInteraction','options','where','limit','catch','find','addTags','body','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','request','then'];(function(_0x43c268,_0x7d9f28){var _0x41c3a0=function(_0x443d5b){while(--_0x443d5b){_0x43c268['push'](_0x43c268['shift']());}};_0x41c3a0(++_0x7d9f28);}(_0xb04a,0xcf));var _0xab04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb04a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xab04('0x0'));var util=require(_0xab04('0x1'));var moment=require(_0xab04('0x2'));var BPromise=require(_0xab04('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab04('0x4'));var db=require(_0xab04('0x5'))['db'];var utils=require(_0xab04('0x6'));var logger=require('../../config/logger')(_0xab04('0x7'));var config=require(_0xab04('0x8'));var jayson=require(_0xab04('0x9'));var client=jayson['client'][_0xab04('0xa')]({'port':0x232a});config[_0xab04('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xab04('0xc'))(new Redis(config['redis']));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x1d4a39,_0x183c53,_0x381c7a){return new BPromise(function(_0x342f0e,_0x3bbc4a){return client[_0xab04('0xd')](_0x1d4a39,_0x381c7a)[_0xab04('0xe')](function(_0x332501){logger[_0xab04('0xf')]('MailInteraction,\x20%s,\x20%s',_0x183c53,'request\x20sent');logger[_0xab04('0x10')](_0xab04('0x11'),_0x183c53,_0xab04('0x12'),JSON[_0xab04('0x13')](_0x332501));if(_0x332501['error']){if(_0x332501[_0xab04('0x14')][_0xab04('0x15')]===0x1f4){logger['error'](_0xab04('0x16'),_0x183c53,_0x332501[_0xab04('0x14')][_0xab04('0x17')]);return _0x3bbc4a(_0x332501[_0xab04('0x14')][_0xab04('0x17')]);}logger['error'](_0xab04('0x16'),_0x183c53,_0x332501[_0xab04('0x14')][_0xab04('0x17')]);return _0x342f0e(_0x332501[_0xab04('0x14')][_0xab04('0x17')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x183c53,_0xab04('0x12'));_0x342f0e(_0x332501[_0xab04('0x18')][_0xab04('0x17')]);}})['catch'](function(_0x597abc){logger[_0xab04('0x14')](_0xab04('0x16'),_0x183c53,_0x597abc);_0x3bbc4a(_0x597abc);});});}exports[_0xab04('0x19')]=function(_0x538056){var _0x44cd5b=this;return new Promise(function(_0x553ed5,_0x395c6b){return db[_0xab04('0x1a')]['update'](_0x538056['body'],{'raw':_0x538056[_0xab04('0x1b')]?_0x538056[_0xab04('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x538056[_0xab04('0x1b')]?_0x538056[_0xab04('0x1b')][_0xab04('0x1c')]||null:null,'attributes':_0x538056[_0xab04('0x1b')]?_0x538056[_0xab04('0x1b')]['attributes']||null:null,'limit':_0x538056[_0xab04('0x1b')]?_0x538056['options'][_0xab04('0x1d')]||null:null})[_0xab04('0xe')](function(_0x561525){logger[_0xab04('0xf')]('UpdateMailInteraction',_0x538056);logger['debug']('UpdateMailInteraction',_0x538056,JSON[_0xab04('0x13')](_0x561525));_0x553ed5(_0x561525);})[_0xab04('0x1e')](function(_0x2f5a8c){logger[_0xab04('0x14')](_0xab04('0x19'),_0x2f5a8c['message'],_0x538056);_0x395c6b(_0x44cd5b['error'](0x1f4,_0x2f5a8c[_0xab04('0x17')]));});});};exports['AddTagsToMailInteraction']=function(_0xb8e7b){return new Promise(function(_0xdf0b96,_0x15cae9){return db[_0xab04('0x1a')][_0xab04('0x1f')]({'where':_0xb8e7b[_0xab04('0x1b')]?_0xb8e7b['options'][_0xab04('0x1c')]||null:null})[_0xab04('0xe')](function(_0x5c8696){if(_0x5c8696){return _0x5c8696[_0xab04('0x20')](_0xb8e7b[_0xab04('0x21')][_0xab04('0x22')],_[_0xab04('0x23')](_0xb8e7b[_0xab04('0x21')],[_0xab04('0x22'),'id'])||{});}})['spread'](function(_0x326f2f){logger['info'](_0xab04('0x24'),_0xb8e7b);logger[_0xab04('0x10')](_0xab04('0x24'),_0xb8e7b,JSON[_0xab04('0x13')](_0x326f2f));_0xdf0b96(_0x326f2f);})['catch'](function(_0x3ab245){logger['error'](_0xab04('0x24'),_0x3ab245[_0xab04('0x17')],_0xb8e7b);_0x15cae9(_this[_0xab04('0x14')](0x1f4,_0x3ab245[_0xab04('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index de2c906..a3063d5 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 _0x8586=['length','mailInteraction:','./mailInteraction.events','save','remove','emit','register'];(function(_0x1ed41a,_0x472f78){var _0x5d45a9=function(_0x1b5903){while(--_0x1b5903){_0x1ed41a['push'](_0x1ed41a['shift']());}};_0x5d45a9(++_0x472f78);}(_0x8586,0x18a));var _0x6858=function(_0x1ed034,_0x5d495d){_0x1ed034=_0x1ed034-0x0;var _0x4a82b7=_0x8586[_0x1ed034];return _0x4a82b7;};'use strict';var MailInteractionEvents=require(_0x6858('0x0'));var events=[_0x6858('0x1'),_0x6858('0x2'),'update'];function createListener(_0xd800b7,_0x24a9d4){return function(_0x465238){_0x24a9d4[_0x6858('0x3')](_0xd800b7,_0x465238);};}function removeListener(_0x9718aa,_0x55e177){return function(){MailInteractionEvents['removeListener'](_0x9718aa,_0x55e177);};}exports[_0x6858('0x4')]=function(_0x6b7351){for(var _0x2e23cd=0x0,_0x3b87c8=events[_0x6858('0x5')];_0x2e23cd<_0x3b87c8;_0x2e23cd++){var _0x180918=events[_0x2e23cd];var _0x517bea=createListener(_0x6858('0x6')+_0x180918,_0x6b7351);MailInteractionEvents['on'](_0x180918,_0x517bea);}}; \ No newline at end of file +var _0x0055=['length','mailInteraction:','remove','emit','removeListener'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x0055,0x13d));var _0x5005=function(_0x2af501,_0x453862){_0x2af501=_0x2af501-0x0;var _0x30f661=_0x0055[_0x2af501];return _0x30f661;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0x5005('0x0'),'update'];function createListener(_0x1a8cdc,_0xd99a0){return function(_0x4ec4bb){_0xd99a0[_0x5005('0x1')](_0x1a8cdc,_0x4ec4bb);};}function removeListener(_0x3464f5,_0x44f611){return function(){MailInteractionEvents[_0x5005('0x2')](_0x3464f5,_0x44f611);};}exports['register']=function(_0x51383f){for(var _0x1cceb5=0x0,_0x2c1349=events[_0x5005('0x3')];_0x1cceb5<_0x2c1349;_0x1cceb5++){var _0x3ccf41=events[_0x1cceb5];var _0x218100=createListener(_0x5005('0x4')+_0x3ccf41,_0x51383f);MailInteractionEvents['on'](_0x3ccf41,_0x218100);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 4653037..b99a930 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 _0xa41a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','describe','isAuthenticated','show','/:id/download','download','post','tracked','mailmessage:create','create','put','/:id/accept','accept','reject','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x39f421,_0x1cf712){var _0x405d61=function(_0xf4d0d){while(--_0xf4d0d){_0x39f421['push'](_0x39f421['shift']());}};_0x405d61(++_0x1cf712);}(_0xa41a,0x6b));var _0xaa41=function(_0x53af90,_0x35a120){_0x53af90=_0x53af90-0x0;var _0xc82ddd=_0xa41a[_0x53af90];return _0xc82ddd;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var auth=require(_0xaa41('0x5'));var interaction=require(_0xaa41('0x6'));var config=require(_0xaa41('0x7'));var controller=require(_0xaa41('0x8'));router[_0xaa41('0x9')]('/',auth['isAuthenticated'](),controller[_0xaa41('0xa')]);router[_0xaa41('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xaa41('0xb')]);router[_0xaa41('0x9')]('/:id',auth[_0xaa41('0xc')](),controller[_0xaa41('0xd')]);router[_0xaa41('0x9')](_0xaa41('0xe'),auth[_0xaa41('0xc')](),controller[_0xaa41('0xf')]);router[_0xaa41('0x10')]('/',auth[_0xaa41('0xc')](),interaction[_0xaa41('0x11')]('mail',_0xaa41('0x12')),controller[_0xaa41('0x13')]);router['put']('/:id',auth[_0xaa41('0xc')](),controller['update']);router[_0xaa41('0x14')](_0xaa41('0x15'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x16')]);router[_0xaa41('0x14')]('/:id/reject',auth[_0xaa41('0xc')](),controller[_0xaa41('0x17')]);router[_0xaa41('0x18')](_0xaa41('0x19'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x1a')]);module[_0xaa41('0x1b')]=router; \ No newline at end of file +var _0x24ca=['../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','update','put','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x28a714,_0x49a848){var _0x500cf3=function(_0xde946b){while(--_0xde946b){_0x28a714['push'](_0x28a714['shift']());}};_0x500cf3(++_0x49a848);}(_0x24ca,0x1bc));var _0xa24c=function(_0x30f5bb,_0x4db4bd){_0x30f5bb=_0x30f5bb-0x0;var _0x1cfc00=_0x24ca[_0x30f5bb];return _0x1cfc00;};'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 auth=require(_0xa24c('0x4'));var interaction=require(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var controller=require(_0xa24c('0x7'));router[_0xa24c('0x8')]('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xa')]);router[_0xa24c('0x8')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xc')]);router['get'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xe')]);router['get'](_0xa24c('0xf'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x10')]);router[_0xa24c('0x11')]('/',auth[_0xa24c('0x9')](),interaction[_0xa24c('0x12')](_0xa24c('0x13'),_0xa24c('0x14')),controller[_0xa24c('0x15')]);router['put'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x16')]);router[_0xa24c('0x17')]('/:id/accept',auth[_0xa24c('0x9')](),controller[_0xa24c('0x18')]);router[_0xa24c('0x17')](_0xa24c('0x19'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x1a')]);router[_0xa24c('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xa24c('0x1c')]);module[_0xa24c('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index efb5d2b..82e849e 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 _0xa9e1=['STRING','DATE','sequelize','lodash','TEXT','long','BOOLEAN','out'];(function(_0x35b499,_0x4e589f){var _0x57b0ee=function(_0x2217c7){while(--_0x2217c7){_0x35b499['push'](_0x35b499['shift']());}};_0x57b0ee(++_0x4e589f);}(_0xa9e1,0x7a));var _0x1a9e=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0xa9e1[_0x1fafa5];return _0xcf08c9;};'use strict';var Sequelize=require(_0x1a9e('0x0'));var _=require(_0x1a9e('0x1'));module['exports']={'body':{'type':Sequelize[_0x1a9e('0x2')](_0x1a9e('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x1a9e('0x2')]('medium')},'read':{'type':Sequelize[_0x1a9e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x1a9e('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x1a9e('0x6')](0x1fe)},'from':{'type':Sequelize[_0x1a9e('0x6')]},'to':{'type':Sequelize[_0x1a9e('0x2')](_0x1a9e('0x3'))},'cc':{'type':Sequelize[_0x1a9e('0x2')](_0x1a9e('0x3'))},'bcc':{'type':Sequelize[_0x1a9e('0x2')](_0x1a9e('0x3'))},'subject':{'type':Sequelize[_0x1a9e('0x2')]},'sentAt':{'type':Sequelize[_0x1a9e('0x7')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x1a9e('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0x1a9e('0x2')]('long')}}; \ No newline at end of file +var _0x1893=['INTEGER','DATE','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x5b0659,_0xe8b23b){var _0x63a86f=function(_0x4736bc){while(--_0x4736bc){_0x5b0659['push'](_0x5b0659['shift']());}};_0x63a86f(++_0xe8b23b);}(_0x1893,0xa2));var _0x3189=function(_0x4217e5,_0x4b69e6){_0x4217e5=_0x4217e5-0x0;var _0xb02bc5=_0x1893[_0x4217e5];return _0xb02bc5;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x3189('0x0')]={'body':{'type':Sequelize[_0x3189('0x1')](_0x3189('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x3189('0x1')](_0x3189('0x3'))},'read':{'type':Sequelize[_0x3189('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3189('0x5')]('in','out'),'defaultValue':_0x3189('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3189('0x7')](0x1fe)},'from':{'type':Sequelize[_0x3189('0x7')]},'to':{'type':Sequelize[_0x3189('0x1')](_0x3189('0x2'))},'cc':{'type':Sequelize[_0x3189('0x1')](_0x3189('0x2'))},'bcc':{'type':Sequelize[_0x3189('0x1')]('long')},'subject':{'type':Sequelize[_0x3189('0x1')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x3189('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x3189('0x9')]},'originTo':{'type':Sequelize[_0x3189('0x1')](_0x3189('0x2'))},'originCc':{'type':Sequelize[_0x3189('0x1')]('long')}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 46b538d..1042e3e 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 _0xa9e0=['sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','MailMessage','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','body','find','describe','create','out','secret','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','service','host','port','secure','authentication','user','auth','pass','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','accept','mail','read','readAt','UserId','Contact','get','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','mail-interactions','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','join','server','files','tmp','from','createdAt','Attachment','Attachments','bcc','headers','push','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','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'];(function(_0x3a55e3,_0x213270){var _0x5efbcb=function(_0x1714fc){while(--_0x1714fc){_0x3a55e3['push'](_0x3a55e3['shift']());}};_0x5efbcb(++_0x213270);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9003=jayson['client'][_0x0a9e('0x1c')]({'port':0x232b});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x519dfd,_0x16033c,_0x12066b,_0x48f32d){return new BPromise(function(_0x225616,_0x5a0a06){var _0x459eb1=_0x48f32d||client;return _0x459eb1[_0x0a9e('0x1d')](_0x519dfd,_0x12066b)[_0x0a9e('0x1e')](function(_0x205fd6){logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x16033c,_0x0a9e('0x21'),JSON[_0x0a9e('0x24')](_0x205fd6));if(_0x205fd6[_0x0a9e('0x25')]){if(_0x205fd6['error'][_0x0a9e('0x26')]===0x1f4){logger[_0x0a9e('0x25')]('MailMessage,\x20%s,\x20%s',_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x5a0a06(_0x205fd6['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x225616(_0x205fd6[_0x0a9e('0x25')][_0x0a9e('0x27')]);}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));_0x225616(_0x205fd6[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})['catch'](function(_0x59181e){logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x59181e);_0x5a0a06(_0x59181e);});});}function respondWithStatusCode(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0xcc;return function(_0x526cf3){if(_0x526cf3){return _0x40c424[_0x0a9e('0x29')](_0x33161b);}return _0x40c424['status'](_0x33161b)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x5bfb33,_0x1dc186){_0x1dc186=_0x1dc186||0xc8;return function(_0x34dc65){if(_0x34dc65){return _0x5bfb33[_0x0a9e('0x2b')](_0x1dc186)[_0x0a9e('0x2c')](_0x34dc65);}};}function respondWithFilteredResult(_0x140511,_0x1538a4){return function(_0x11c3b6){if(_0x11c3b6){var _0x14de77=_0x11c3b6[_0x0a9e('0x2d')],_0x5a101a=_0x1538a4[_0x0a9e('0x2e')],_0x3652a7=_0x1538a4['offset']+_0x1538a4[_0x0a9e('0x2f')],_0x468813;if(_0x3652a7>=_0x14de77){_0x3652a7=_0x14de77;_0x468813=0xc8;}else{_0x468813=0xce;}_0x140511[_0x0a9e('0x2b')](_0x468813);return _0x140511[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5a101a+'-'+_0x3652a7+'/'+_0x14de77)[_0x0a9e('0x2c')](_0x11c3b6);}return null;};}function patchUpdates(_0x563b45){return function(_0x296f41){try{jsonpatch[_0x0a9e('0x32')](_0x296f41,_0x563b45,!![]);}catch(_0x1dbde2){return BPromise['reject'](_0x1dbde2);}return _0x296f41[_0x0a9e('0x33')]();};}function saveUpdates(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x34')](_0x5d1e0e)[_0x0a9e('0x1e')](function(_0x25ce3a){return _0x25ce3a;});}return null;};}function removeEntity(_0x5180f1,_0x66c1d2){return function(_0x46f0a5){if(_0x46f0a5){return _0x46f0a5[_0x0a9e('0x35')]()[_0x0a9e('0x1e')](function(){_0x5180f1[_0x0a9e('0x2b')](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x332d35,_0x39e565){return function(_0x5583a4){if(!_0x5583a4){_0x332d35[_0x0a9e('0x29')](0x194);}return _0x5583a4;};}function handleError(_0x5e7238,_0x2cc7a0){_0x2cc7a0=_0x2cc7a0||0x1f4;return function(_0x14b13f){logger[_0x0a9e('0x25')](_0x14b13f[_0x0a9e('0x36')]);if(_0x14b13f['name']){delete _0x14b13f[_0x0a9e('0x37')];}_0x5e7238[_0x0a9e('0x2b')](_0x2cc7a0)[_0x0a9e('0x38')](_0x14b13f);};}exports[_0x0a9e('0x39')]=function(_0x4853b1,_0x54135e){var _0x1e8694={},_0x5640eb={},_0x24936a={'count':0x0,'rows':[]};var _0x3d9717=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x31916f){return{'name':_0x31916f[_0x0a9e('0x3c')],'type':_0x31916f[_0x0a9e('0x3d')]['key']};});_0x5640eb[_0x0a9e('0x3e')]=_[_0x0a9e('0x3a')](_0x3d9717,_0x0a9e('0x37'));_0x5640eb['query']=_['keys'](_0x4853b1[_0x0a9e('0x3f')]);_0x5640eb[_0x0a9e('0x40')]=_['intersection'](_0x5640eb[_0x0a9e('0x3e')],_0x5640eb[_0x0a9e('0x3f')]);_0x1e8694[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x5640eb['model'],qs['fields'](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1e8694['attributes']=_0x1e8694[_0x0a9e('0x41')][_0x0a9e('0x44')]?_0x1e8694[_0x0a9e('0x41')]:_0x5640eb['model'];if(!_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x45')](_0x0a9e('0x46'))){_0x1e8694[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2f')]);_0x1e8694[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2e')]);}_0x1e8694[_0x0a9e('0x47')]=qs[_0x0a9e('0x48')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x1e8694['where']=qs['filters'](_[_0x0a9e('0x49')](_0x4853b1[_0x0a9e('0x3f')],_0x5640eb[_0x0a9e('0x40')]),_0x3d9717);if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]){_0x1e8694[_0x0a9e('0x4b')]=_[_0x0a9e('0x4c')](_0x1e8694[_0x0a9e('0x4b')],{'$or':_[_0x0a9e('0x3a')](_0x3d9717,function(_0x25c6e6){if(_0x25c6e6[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0x5026aa={};_0x5026aa[_0x25c6e6[_0x0a9e('0x37')]]={'$like':'%'+_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]+'%'};return _0x5026aa;}})});}_0x1e8694=_[_0x0a9e('0x4c')]({},_0x1e8694,_0x4853b1[_0x0a9e('0x4e')]);var _0xbe9d19={'where':_0x1e8694[_0x0a9e('0x4b')]};return db[_0x0a9e('0x3b')]['count'](_0xbe9d19)[_0x0a9e('0x1e')](function(_0x48fd45){_0x24936a[_0x0a9e('0x2d')]=_0x48fd45;if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1e8694['include']=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x1e8694);})[_0x0a9e('0x1e')](function(_0x34aa5a){_0x24936a[_0x0a9e('0x51')]=_0x34aa5a;return _0x24936a;})[_0x0a9e('0x1e')](respondWithFilteredResult(_0x54135e,_0x1e8694))[_0x0a9e('0x52')](handleError(_0x54135e,null));};exports['show']=function(_0x13f44d,_0x1bde3c){var _0x1b5e80={'raw':!![],'where':{'id':_0x13f44d[_0x0a9e('0x53')]['id']}},_0x16f976={};_0x16f976[_0x0a9e('0x3e')]=_[_0x0a9e('0x54')](db[_0x0a9e('0x3b')][_0x0a9e('0x55')]);_0x16f976['query']=_[_0x0a9e('0x54')](_0x13f44d[_0x0a9e('0x3f')]);_0x16f976['filters']=_['intersection'](_0x16f976['model'],_0x16f976[_0x0a9e('0x3f')]);_0x1b5e80[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x16f976[_0x0a9e('0x3e')],qs[_0x0a9e('0x43')](_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1b5e80[_0x0a9e('0x41')]=_0x1b5e80['attributes']['length']?_0x1b5e80['attributes']:_0x16f976[_0x0a9e('0x3e')];if(_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1b5e80['include']=[{'all':!![]}];}_0x1b5e80=_[_0x0a9e('0x4c')]({},_0x1b5e80,_0x13f44d[_0x0a9e('0x4e')]);return db['MailMessage']['find'](_0x1b5e80)[_0x0a9e('0x1e')](handleEntityNotFound(_0x1bde3c,null))['then'](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x52')](handleError(_0x1bde3c,null));};exports['update']=function(_0x2e5e62,_0x3c20b2){if(_0x2e5e62[_0x0a9e('0x56')]['id']){delete _0x2e5e62['body']['id'];}return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x2e5e62['params']['id']}})['then'](handleEntityNotFound(_0x3c20b2,null))[_0x0a9e('0x1e')](saveUpdates(_0x2e5e62[_0x0a9e('0x56')],null))['then'](respondWithResult(_0x3c20b2,null))[_0x0a9e('0x52')](handleError(_0x3c20b2,null));};exports['destroy']=function(_0x211ef9,_0x523cd2){return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x211ef9['params']['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x1e')](removeEntity(_0x523cd2,null))['catch'](handleError(_0x523cd2,null));};exports[_0x0a9e('0x58')]=function(_0x65432,_0x3cfd00){return db[_0x0a9e('0x3b')][_0x0a9e('0x58')]()[_0x0a9e('0x1e')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x52')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x59')]=function(_0x4e67ab,_0x1c693e){return db[_0x0a9e('0x3b')][_0x0a9e('0x59')](_0x4e67ab[_0x0a9e('0x56')])[_0x0a9e('0x1e')](function(_0x156662){if(_0x156662){if(_0x156662['direction']===_0x0a9e('0x5a')&&!_0x156662[_0x0a9e('0x5b')]){var _0x5239ef,_0x3649cc,_0x5cc8fb;if(_0x4e67ab[_0x0a9e('0x56')]['to']){_0x3649cc=_0x4e67ab['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x0a9e('0x5c')]({'where':{'id':_0x156662['MailAccountId']},'include':[{'model':db[_0x0a9e('0x5d')],'as':_0x0a9e('0x5e'),'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x60'),'where':{'email':_0x3649cc},'limit':0x1,'order':[[_0x0a9e('0x61'),_0x0a9e('0x62')]]}]},{'model':db['MailServerOut'],'as':_0x0a9e('0x63'),'raw':!![]}]})['then'](function(_0xca4ade){_0x5239ef=_0xca4ade;if(_0x5239ef&&_0x5239ef[_0x0a9e('0x63')]){var _0x51aaf7={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x64')])){_0x51aaf7[_0x0a9e('0x65')]=_0x5239ef[_0x0a9e('0x63')]['host'];_0x51aaf7[_0x0a9e('0x66')]=_0x5239ef[_0x0a9e('0x63')]['port'];_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];if(_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x68')]){_0x51aaf7['auth']={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')]['pass']};}}else{_0x51aaf7[_0x0a9e('0x64')]=_0x5239ef['Smtp']['service'];_0x51aaf7[_0x0a9e('0x6a')]={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x6b')]};_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];}if(_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')]&&_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')]){for(var _0x2b8192=0x0;_0x2b8192<_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')];_0x2b8192+=0x1){_0x4e67ab[_0x0a9e('0x56')]['attachments'][_0x2b8192]={'filename':_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x37')],'path':path['join'](config[_0x0a9e('0x6d')],_0x0a9e('0x6e'),_0x4e67ab['body'][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x6f')])};}}_0x5cc8fb={'account':_0x51aaf7,'message':_0x4e67ab[_0x0a9e('0x56')]};return;}})[_0x0a9e('0x1e')](function(){if(_0x5239ef[_0x0a9e('0x5e')]){if(_0x5239ef['List']['Contacts']['length']){return _0x5239ef[_0x0a9e('0x5e')][_0x0a9e('0x60')][0x0];}else{return db[_0x0a9e('0x5f')][_0x0a9e('0x59')](_[_0x0a9e('0x16')](_0x4e67ab[_0x0a9e('0x56')],{'firstName':_0x4e67ab[_0x0a9e('0x56')]['to'],'email':_0x4e67ab[_0x0a9e('0x56')]['to'],'phone':_0x4e67ab['body']['to'],'ListId':_0x5239ef[_0x0a9e('0x70')]}));}}else{throw new Error(_0x0a9e('0x71'));}})[_0x0a9e('0x1e')](function(){if(_0x5cc8fb){return respondWithRpcPromise('SendMail',_0x0a9e('0x72'),_0x5cc8fb,client9003)['then'](function(_0x4437ff){return _0x156662[_0x0a9e('0x34')]({'read':!![],'messageId':_0x4437ff['messageId'],'sentAt':moment()[_0x0a9e('0x73')](_0x0a9e('0x74'))});})[_0x0a9e('0x52')](function(_0x317c0c){logger['error']('%s',JSON[_0x0a9e('0x24')](_0x317c0c));return _0x156662;});}return _0x156662;});}return _0x156662;}})[_0x0a9e('0x1e')](respondWithResult(_0x1c693e,0xc9))[_0x0a9e('0x52')](handleError(_0x1c693e,null));};var interaction_log=require(_0x0a9e('0x75'))('mail-interactions');exports[_0x0a9e('0x76')]=function(_0x3d91db,_0x2d5506,_0x361b21){var _0x4abc8f={'agent':{},'channel':_0x0a9e('0x77')};if(_0x3d91db[_0x0a9e('0x56')]['id']){delete _0x3d91db[_0x0a9e('0x56')]['id'];}_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x78')]=!![];_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x79')]=moment()[_0x0a9e('0x73')](_0x0a9e('0x74'));_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]||_0x3d91db[_0x0a9e('0x69')]['id'];_0x4abc8f['agent']['id']=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x3d91db[_0x0a9e('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x7b')}]})[_0x0a9e('0x1e')](handleEntityNotFound(_0x2d5506,null))['then'](saveUpdates(_0x3d91db['body'],null))[_0x0a9e('0x1e')](function(_0x2bbdb5){if(_0x2bbdb5){_0x4abc8f['message']=_0x2bbdb5[_0x0a9e('0x7c')]({'plain':!![]});return db['MailInteraction'][_0x0a9e('0x57')]({'where':{'id':_0x2bbdb5[_0x0a9e('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x2d5506,null))[_0x0a9e('0x1e')](function(_0x41cf12){if(_0x41cf12){return _0x41cf12[_0x0a9e('0x34')]({'UserId':_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')],'read1stAt':_[_0x0a9e('0x7e')](_0x41cf12[_0x0a9e('0x7f')])?moment()['format'](_0x0a9e('0x74')):undefined});}return null;})[_0x0a9e('0x1e')](function(_0x45c109){if(_0x45c109){_0x4abc8f[_0x0a9e('0x80')]=_0x45c109['get']({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x81'),_0x3d91db['user']['id'],_0x3d91db[_0x0a9e('0x69')]['name'],_0x3d91db[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x4abc8f[_0x0a9e('0x80')]['id'],_0x3d91db[_0x0a9e('0x56')]?JSON['stringify'](_0x3d91db['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x84'),_0x0a9e('0x85'),_0x4abc8f);}return null;})['then'](function(_0x3b4a9f){if(_0x3b4a9f){if(_0x3d91db[_0x0a9e('0x56')]['manual']){_0x4abc8f['message'][_0x0a9e('0x86')]=util['format']('SIP/%s',_0x3d91db['user'][_0x0a9e('0x37')]);_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x4abc8f[_0x0a9e('0x87')];_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x88')]='accept';return respondWithRpcPromise(_0x0a9e('0x89'),'EventManager',{'event':_0x0a9e('0x8a'),'message':_0x4abc8f[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x1e')](function(){return _0x4abc8f;});}return _0x4abc8f;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0x2d5506,null))['catch'](handleError(_0x2d5506,null));};var interaction_log=require(_0x0a9e('0x75'))(_0x0a9e('0x8b'));exports[_0x0a9e('0x8c')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d={'agent':{},'channel':_0x0a9e('0x77')};if(_0x5b74c3[_0x0a9e('0x56')]['id']){delete _0x5b74c3[_0x0a9e('0x56')]['id'];}_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x5b74c3['body'][_0x0a9e('0x7a')]||_0x5b74c3[_0x0a9e('0x69')]['id'];_0x2a563d['agent']['id']=_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5b74c3[_0x0a9e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x1e')](function(_0x2b5148){if(_0x2b5148){_0x2a563d[_0x0a9e('0x27')]=_0x2b5148[_0x0a9e('0x7c')]({'plain':!![]});return db[_0x0a9e('0x8d')][_0x0a9e('0x57')]({'where':{'id':_0x2b5148[_0x0a9e('0x7d')]}});}return null;})[_0x0a9e('0x1e')](handleEntityNotFound(_0xb6e411,null))['then'](function(_0x329d88){if(_0x329d88){_0x2a563d[_0x0a9e('0x80')]=_0x329d88[_0x0a9e('0x7c')]({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x8e'),_0x5b74c3[_0x0a9e('0x69')]['id'],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x37')],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x2a563d[_0x0a9e('0x80')]['id'],_0x5b74c3[_0x0a9e('0x56')]?JSON[_0x0a9e('0x24')](_0x5b74c3['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x8f'),_0x0a9e('0x90'),_0x2a563d);}return null;})[_0x0a9e('0x1e')](function(_0xb0599a){if(_0xb0599a){_0xb0599a['message'][_0x0a9e('0x86')]=util[_0x0a9e('0x73')]('SIP/%s',_0x5b74c3[_0x0a9e('0x69')]['name']);_0xb0599a[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x2a563d[_0x0a9e('0x87')];_0xb0599a[_0x0a9e('0x27')]['event']=_0x0a9e('0x8c');respondWithRpcPromise('EventManager',_0x0a9e('0x89'),{'event':_0x0a9e('0x91'),'message':_0xb0599a['message']},client9002);return _0x2a563d;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0xb6e411,null))[_0x0a9e('0x52')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x92')]=function(_0x4ab276,_0x4c788f){var _0x1b82b7=moment()[_0x0a9e('0x93')]()[_0x0a9e('0x94')]();var _0x413190=path[_0x0a9e('0x95')](config[_0x0a9e('0x6d')],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x98'));var _0x586510=path[_0x0a9e('0x95')](config['root'],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x6c'));var _0x28ce92=util[_0x0a9e('0x73')]('message-%s.eml',_0x1b82b7);return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x4ab276[_0x0a9e('0x53')]['id']},'attributes':['id',_0x0a9e('0x56'),_0x0a9e('0x99'),'to','cc','bcc','subject',_0x0a9e('0x9a')],'include':_0x4ab276['query'][_0x0a9e('0x6c')]?[{'model':db[_0x0a9e('0x9b')],'as':_0x0a9e('0x9c')}]:undefined})[_0x0a9e('0x1e')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x1e')](function(_0x213e5d){if(_0x213e5d){var _0x596312=_0x213e5d;var _0x4db918={'from':_0x596312[_0x0a9e('0x99')],'to':_0x596312['to'],'subject':_0x596312['subject'],'html':_0x596312[_0x0a9e('0x56')],'headers':{'Date':moment(_0x596312['createdAt'])[_0x0a9e('0x73')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x213e5d['cc']){_0x4db918['headers']['Cc']=_0x213e5d['cc'];}if(_0x213e5d[_0x0a9e('0x9d')]){_0x4db918[_0x0a9e('0x9e')]['Bcc']=_0x213e5d[_0x0a9e('0x9d')];}return new BPromise(function(_0x17cb30,_0x15c6b9){if(_0x213e5d[_0x0a9e('0x9c')]){for(var _0x2eb028=0x0;_0x2eb028<_0x213e5d['Attachments']['length'];_0x2eb028++){var _0x16449b=_0x213e5d[_0x0a9e('0x9c')][_0x2eb028];var _0x41c8cd=path[_0x0a9e('0x95')](_0x586510,_0x16449b[_0x0a9e('0x6f')]);if(fs['existsSync'](_0x41c8cd)){_0x4db918[_0x0a9e('0x6c')][_0x0a9e('0x9f')]({'name':_0x16449b['name'],'contentType':_0x16449b[_0x0a9e('0x3d')],'data':fs[_0x0a9e('0xa0')](_0x41c8cd)});}}}emlformat[_0x0a9e('0xa1')](_0x4db918,function(_0x2427d5,_0x23b25b){if(_0x2427d5)return _0x15c6b9(_0x2427d5);fs[_0x0a9e('0xa2')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92),_0x23b25b);return _0x17cb30(_0x23b25b);});});}})[_0x0a9e('0x1e')](function(_0x40dd2a){if(_0x40dd2a){return _0x4c788f[_0x0a9e('0x92')](path['join'](_0x413190,_0x28ce92),_0x28ce92,function(_0x1065a7){if(_0x1065a7){console[_0x0a9e('0xa3')](_0x0a9e('0xa4'),_0x1065a7);}else{fs[_0x0a9e('0xa5')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92));}});}})['catch'](handleError(_0x4c788f,null));}; \ No newline at end of file +var _0xa9e0=['sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','MailMessage','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','body','find','describe','create','out','secret','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','service','host','port','secure','authentication','user','auth','pass','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','accept','mail','read','readAt','UserId','Contact','get','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','mail-interactions','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','join','server','files','tmp','from','createdAt','Attachment','Attachments','bcc','headers','push','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','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'];(function(_0x1a89dc,_0x4ccfee){var _0x2a269f=function(_0x5ec68a){while(--_0x5ec68a){_0x1a89dc['push'](_0x1a89dc['shift']());}};_0x2a269f(++_0x4ccfee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9003=jayson['client'][_0x0a9e('0x1c')]({'port':0x232b});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x519dfd,_0x16033c,_0x12066b,_0x48f32d){return new BPromise(function(_0x225616,_0x5a0a06){var _0x459eb1=_0x48f32d||client;return _0x459eb1[_0x0a9e('0x1d')](_0x519dfd,_0x12066b)[_0x0a9e('0x1e')](function(_0x205fd6){logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x16033c,_0x0a9e('0x21'),JSON[_0x0a9e('0x24')](_0x205fd6));if(_0x205fd6[_0x0a9e('0x25')]){if(_0x205fd6['error'][_0x0a9e('0x26')]===0x1f4){logger[_0x0a9e('0x25')]('MailMessage,\x20%s,\x20%s',_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x5a0a06(_0x205fd6['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x225616(_0x205fd6[_0x0a9e('0x25')][_0x0a9e('0x27')]);}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));_0x225616(_0x205fd6[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})['catch'](function(_0x59181e){logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x59181e);_0x5a0a06(_0x59181e);});});}function respondWithStatusCode(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0xcc;return function(_0x526cf3){if(_0x526cf3){return _0x40c424[_0x0a9e('0x29')](_0x33161b);}return _0x40c424['status'](_0x33161b)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x5bfb33,_0x1dc186){_0x1dc186=_0x1dc186||0xc8;return function(_0x34dc65){if(_0x34dc65){return _0x5bfb33[_0x0a9e('0x2b')](_0x1dc186)[_0x0a9e('0x2c')](_0x34dc65);}};}function respondWithFilteredResult(_0x140511,_0x1538a4){return function(_0x11c3b6){if(_0x11c3b6){var _0x14de77=_0x11c3b6[_0x0a9e('0x2d')],_0x5a101a=_0x1538a4[_0x0a9e('0x2e')],_0x3652a7=_0x1538a4['offset']+_0x1538a4[_0x0a9e('0x2f')],_0x468813;if(_0x3652a7>=_0x14de77){_0x3652a7=_0x14de77;_0x468813=0xc8;}else{_0x468813=0xce;}_0x140511[_0x0a9e('0x2b')](_0x468813);return _0x140511[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5a101a+'-'+_0x3652a7+'/'+_0x14de77)[_0x0a9e('0x2c')](_0x11c3b6);}return null;};}function patchUpdates(_0x563b45){return function(_0x296f41){try{jsonpatch[_0x0a9e('0x32')](_0x296f41,_0x563b45,!![]);}catch(_0x1dbde2){return BPromise['reject'](_0x1dbde2);}return _0x296f41[_0x0a9e('0x33')]();};}function saveUpdates(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x34')](_0x5d1e0e)[_0x0a9e('0x1e')](function(_0x25ce3a){return _0x25ce3a;});}return null;};}function removeEntity(_0x5180f1,_0x66c1d2){return function(_0x46f0a5){if(_0x46f0a5){return _0x46f0a5[_0x0a9e('0x35')]()[_0x0a9e('0x1e')](function(){_0x5180f1[_0x0a9e('0x2b')](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x332d35,_0x39e565){return function(_0x5583a4){if(!_0x5583a4){_0x332d35[_0x0a9e('0x29')](0x194);}return _0x5583a4;};}function handleError(_0x5e7238,_0x2cc7a0){_0x2cc7a0=_0x2cc7a0||0x1f4;return function(_0x14b13f){logger[_0x0a9e('0x25')](_0x14b13f[_0x0a9e('0x36')]);if(_0x14b13f['name']){delete _0x14b13f[_0x0a9e('0x37')];}_0x5e7238[_0x0a9e('0x2b')](_0x2cc7a0)[_0x0a9e('0x38')](_0x14b13f);};}exports[_0x0a9e('0x39')]=function(_0x4853b1,_0x54135e){var _0x1e8694={},_0x5640eb={},_0x24936a={'count':0x0,'rows':[]};var _0x3d9717=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x31916f){return{'name':_0x31916f[_0x0a9e('0x3c')],'type':_0x31916f[_0x0a9e('0x3d')]['key']};});_0x5640eb[_0x0a9e('0x3e')]=_[_0x0a9e('0x3a')](_0x3d9717,_0x0a9e('0x37'));_0x5640eb['query']=_['keys'](_0x4853b1[_0x0a9e('0x3f')]);_0x5640eb[_0x0a9e('0x40')]=_['intersection'](_0x5640eb[_0x0a9e('0x3e')],_0x5640eb[_0x0a9e('0x3f')]);_0x1e8694[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x5640eb['model'],qs['fields'](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1e8694['attributes']=_0x1e8694[_0x0a9e('0x41')][_0x0a9e('0x44')]?_0x1e8694[_0x0a9e('0x41')]:_0x5640eb['model'];if(!_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x45')](_0x0a9e('0x46'))){_0x1e8694[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2f')]);_0x1e8694[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2e')]);}_0x1e8694[_0x0a9e('0x47')]=qs[_0x0a9e('0x48')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x1e8694['where']=qs['filters'](_[_0x0a9e('0x49')](_0x4853b1[_0x0a9e('0x3f')],_0x5640eb[_0x0a9e('0x40')]),_0x3d9717);if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]){_0x1e8694[_0x0a9e('0x4b')]=_[_0x0a9e('0x4c')](_0x1e8694[_0x0a9e('0x4b')],{'$or':_[_0x0a9e('0x3a')](_0x3d9717,function(_0x25c6e6){if(_0x25c6e6[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0x5026aa={};_0x5026aa[_0x25c6e6[_0x0a9e('0x37')]]={'$like':'%'+_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]+'%'};return _0x5026aa;}})});}_0x1e8694=_[_0x0a9e('0x4c')]({},_0x1e8694,_0x4853b1[_0x0a9e('0x4e')]);var _0xbe9d19={'where':_0x1e8694[_0x0a9e('0x4b')]};return db[_0x0a9e('0x3b')]['count'](_0xbe9d19)[_0x0a9e('0x1e')](function(_0x48fd45){_0x24936a[_0x0a9e('0x2d')]=_0x48fd45;if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1e8694['include']=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x1e8694);})[_0x0a9e('0x1e')](function(_0x34aa5a){_0x24936a[_0x0a9e('0x51')]=_0x34aa5a;return _0x24936a;})[_0x0a9e('0x1e')](respondWithFilteredResult(_0x54135e,_0x1e8694))[_0x0a9e('0x52')](handleError(_0x54135e,null));};exports['show']=function(_0x13f44d,_0x1bde3c){var _0x1b5e80={'raw':!![],'where':{'id':_0x13f44d[_0x0a9e('0x53')]['id']}},_0x16f976={};_0x16f976[_0x0a9e('0x3e')]=_[_0x0a9e('0x54')](db[_0x0a9e('0x3b')][_0x0a9e('0x55')]);_0x16f976['query']=_[_0x0a9e('0x54')](_0x13f44d[_0x0a9e('0x3f')]);_0x16f976['filters']=_['intersection'](_0x16f976['model'],_0x16f976[_0x0a9e('0x3f')]);_0x1b5e80[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x16f976[_0x0a9e('0x3e')],qs[_0x0a9e('0x43')](_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1b5e80[_0x0a9e('0x41')]=_0x1b5e80['attributes']['length']?_0x1b5e80['attributes']:_0x16f976[_0x0a9e('0x3e')];if(_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1b5e80['include']=[{'all':!![]}];}_0x1b5e80=_[_0x0a9e('0x4c')]({},_0x1b5e80,_0x13f44d[_0x0a9e('0x4e')]);return db['MailMessage']['find'](_0x1b5e80)[_0x0a9e('0x1e')](handleEntityNotFound(_0x1bde3c,null))['then'](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x52')](handleError(_0x1bde3c,null));};exports['update']=function(_0x2e5e62,_0x3c20b2){if(_0x2e5e62[_0x0a9e('0x56')]['id']){delete _0x2e5e62['body']['id'];}return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x2e5e62['params']['id']}})['then'](handleEntityNotFound(_0x3c20b2,null))[_0x0a9e('0x1e')](saveUpdates(_0x2e5e62[_0x0a9e('0x56')],null))['then'](respondWithResult(_0x3c20b2,null))[_0x0a9e('0x52')](handleError(_0x3c20b2,null));};exports['destroy']=function(_0x211ef9,_0x523cd2){return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x211ef9['params']['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x1e')](removeEntity(_0x523cd2,null))['catch'](handleError(_0x523cd2,null));};exports[_0x0a9e('0x58')]=function(_0x65432,_0x3cfd00){return db[_0x0a9e('0x3b')][_0x0a9e('0x58')]()[_0x0a9e('0x1e')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x52')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x59')]=function(_0x4e67ab,_0x1c693e){return db[_0x0a9e('0x3b')][_0x0a9e('0x59')](_0x4e67ab[_0x0a9e('0x56')])[_0x0a9e('0x1e')](function(_0x156662){if(_0x156662){if(_0x156662['direction']===_0x0a9e('0x5a')&&!_0x156662[_0x0a9e('0x5b')]){var _0x5239ef,_0x3649cc,_0x5cc8fb;if(_0x4e67ab[_0x0a9e('0x56')]['to']){_0x3649cc=_0x4e67ab['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x0a9e('0x5c')]({'where':{'id':_0x156662['MailAccountId']},'include':[{'model':db[_0x0a9e('0x5d')],'as':_0x0a9e('0x5e'),'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x60'),'where':{'email':_0x3649cc},'limit':0x1,'order':[[_0x0a9e('0x61'),_0x0a9e('0x62')]]}]},{'model':db['MailServerOut'],'as':_0x0a9e('0x63'),'raw':!![]}]})['then'](function(_0xca4ade){_0x5239ef=_0xca4ade;if(_0x5239ef&&_0x5239ef[_0x0a9e('0x63')]){var _0x51aaf7={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x64')])){_0x51aaf7[_0x0a9e('0x65')]=_0x5239ef[_0x0a9e('0x63')]['host'];_0x51aaf7[_0x0a9e('0x66')]=_0x5239ef[_0x0a9e('0x63')]['port'];_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];if(_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x68')]){_0x51aaf7['auth']={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')]['pass']};}}else{_0x51aaf7[_0x0a9e('0x64')]=_0x5239ef['Smtp']['service'];_0x51aaf7[_0x0a9e('0x6a')]={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x6b')]};_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];}if(_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')]&&_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')]){for(var _0x2b8192=0x0;_0x2b8192<_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')];_0x2b8192+=0x1){_0x4e67ab[_0x0a9e('0x56')]['attachments'][_0x2b8192]={'filename':_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x37')],'path':path['join'](config[_0x0a9e('0x6d')],_0x0a9e('0x6e'),_0x4e67ab['body'][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x6f')])};}}_0x5cc8fb={'account':_0x51aaf7,'message':_0x4e67ab[_0x0a9e('0x56')]};return;}})[_0x0a9e('0x1e')](function(){if(_0x5239ef[_0x0a9e('0x5e')]){if(_0x5239ef['List']['Contacts']['length']){return _0x5239ef[_0x0a9e('0x5e')][_0x0a9e('0x60')][0x0];}else{return db[_0x0a9e('0x5f')][_0x0a9e('0x59')](_[_0x0a9e('0x16')](_0x4e67ab[_0x0a9e('0x56')],{'firstName':_0x4e67ab[_0x0a9e('0x56')]['to'],'email':_0x4e67ab[_0x0a9e('0x56')]['to'],'phone':_0x4e67ab['body']['to'],'ListId':_0x5239ef[_0x0a9e('0x70')]}));}}else{throw new Error(_0x0a9e('0x71'));}})[_0x0a9e('0x1e')](function(){if(_0x5cc8fb){return respondWithRpcPromise('SendMail',_0x0a9e('0x72'),_0x5cc8fb,client9003)['then'](function(_0x4437ff){return _0x156662[_0x0a9e('0x34')]({'read':!![],'messageId':_0x4437ff['messageId'],'sentAt':moment()[_0x0a9e('0x73')](_0x0a9e('0x74'))});})[_0x0a9e('0x52')](function(_0x317c0c){logger['error']('%s',JSON[_0x0a9e('0x24')](_0x317c0c));return _0x156662;});}return _0x156662;});}return _0x156662;}})[_0x0a9e('0x1e')](respondWithResult(_0x1c693e,0xc9))[_0x0a9e('0x52')](handleError(_0x1c693e,null));};var interaction_log=require(_0x0a9e('0x75'))('mail-interactions');exports[_0x0a9e('0x76')]=function(_0x3d91db,_0x2d5506,_0x361b21){var _0x4abc8f={'agent':{},'channel':_0x0a9e('0x77')};if(_0x3d91db[_0x0a9e('0x56')]['id']){delete _0x3d91db[_0x0a9e('0x56')]['id'];}_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x78')]=!![];_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x79')]=moment()[_0x0a9e('0x73')](_0x0a9e('0x74'));_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]||_0x3d91db[_0x0a9e('0x69')]['id'];_0x4abc8f['agent']['id']=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x3d91db[_0x0a9e('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x7b')}]})[_0x0a9e('0x1e')](handleEntityNotFound(_0x2d5506,null))['then'](saveUpdates(_0x3d91db['body'],null))[_0x0a9e('0x1e')](function(_0x2bbdb5){if(_0x2bbdb5){_0x4abc8f['message']=_0x2bbdb5[_0x0a9e('0x7c')]({'plain':!![]});return db['MailInteraction'][_0x0a9e('0x57')]({'where':{'id':_0x2bbdb5[_0x0a9e('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x2d5506,null))[_0x0a9e('0x1e')](function(_0x41cf12){if(_0x41cf12){return _0x41cf12[_0x0a9e('0x34')]({'UserId':_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')],'read1stAt':_[_0x0a9e('0x7e')](_0x41cf12[_0x0a9e('0x7f')])?moment()['format'](_0x0a9e('0x74')):undefined});}return null;})[_0x0a9e('0x1e')](function(_0x45c109){if(_0x45c109){_0x4abc8f[_0x0a9e('0x80')]=_0x45c109['get']({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x81'),_0x3d91db['user']['id'],_0x3d91db[_0x0a9e('0x69')]['name'],_0x3d91db[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x4abc8f[_0x0a9e('0x80')]['id'],_0x3d91db[_0x0a9e('0x56')]?JSON['stringify'](_0x3d91db['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x84'),_0x0a9e('0x85'),_0x4abc8f);}return null;})['then'](function(_0x3b4a9f){if(_0x3b4a9f){if(_0x3d91db[_0x0a9e('0x56')]['manual']){_0x4abc8f['message'][_0x0a9e('0x86')]=util['format']('SIP/%s',_0x3d91db['user'][_0x0a9e('0x37')]);_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x4abc8f[_0x0a9e('0x87')];_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x88')]='accept';return respondWithRpcPromise(_0x0a9e('0x89'),'EventManager',{'event':_0x0a9e('0x8a'),'message':_0x4abc8f[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x1e')](function(){return _0x4abc8f;});}return _0x4abc8f;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0x2d5506,null))['catch'](handleError(_0x2d5506,null));};var interaction_log=require(_0x0a9e('0x75'))(_0x0a9e('0x8b'));exports[_0x0a9e('0x8c')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d={'agent':{},'channel':_0x0a9e('0x77')};if(_0x5b74c3[_0x0a9e('0x56')]['id']){delete _0x5b74c3[_0x0a9e('0x56')]['id'];}_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x5b74c3['body'][_0x0a9e('0x7a')]||_0x5b74c3[_0x0a9e('0x69')]['id'];_0x2a563d['agent']['id']=_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5b74c3[_0x0a9e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x1e')](function(_0x2b5148){if(_0x2b5148){_0x2a563d[_0x0a9e('0x27')]=_0x2b5148[_0x0a9e('0x7c')]({'plain':!![]});return db[_0x0a9e('0x8d')][_0x0a9e('0x57')]({'where':{'id':_0x2b5148[_0x0a9e('0x7d')]}});}return null;})[_0x0a9e('0x1e')](handleEntityNotFound(_0xb6e411,null))['then'](function(_0x329d88){if(_0x329d88){_0x2a563d[_0x0a9e('0x80')]=_0x329d88[_0x0a9e('0x7c')]({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x8e'),_0x5b74c3[_0x0a9e('0x69')]['id'],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x37')],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x2a563d[_0x0a9e('0x80')]['id'],_0x5b74c3[_0x0a9e('0x56')]?JSON[_0x0a9e('0x24')](_0x5b74c3['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x8f'),_0x0a9e('0x90'),_0x2a563d);}return null;})[_0x0a9e('0x1e')](function(_0xb0599a){if(_0xb0599a){_0xb0599a['message'][_0x0a9e('0x86')]=util[_0x0a9e('0x73')]('SIP/%s',_0x5b74c3[_0x0a9e('0x69')]['name']);_0xb0599a[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x2a563d[_0x0a9e('0x87')];_0xb0599a[_0x0a9e('0x27')]['event']=_0x0a9e('0x8c');respondWithRpcPromise('EventManager',_0x0a9e('0x89'),{'event':_0x0a9e('0x91'),'message':_0xb0599a['message']},client9002);return _0x2a563d;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0xb6e411,null))[_0x0a9e('0x52')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x92')]=function(_0x4ab276,_0x4c788f){var _0x1b82b7=moment()[_0x0a9e('0x93')]()[_0x0a9e('0x94')]();var _0x413190=path[_0x0a9e('0x95')](config[_0x0a9e('0x6d')],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x98'));var _0x586510=path[_0x0a9e('0x95')](config['root'],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x6c'));var _0x28ce92=util[_0x0a9e('0x73')]('message-%s.eml',_0x1b82b7);return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x4ab276[_0x0a9e('0x53')]['id']},'attributes':['id',_0x0a9e('0x56'),_0x0a9e('0x99'),'to','cc','bcc','subject',_0x0a9e('0x9a')],'include':_0x4ab276['query'][_0x0a9e('0x6c')]?[{'model':db[_0x0a9e('0x9b')],'as':_0x0a9e('0x9c')}]:undefined})[_0x0a9e('0x1e')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x1e')](function(_0x213e5d){if(_0x213e5d){var _0x596312=_0x213e5d;var _0x4db918={'from':_0x596312[_0x0a9e('0x99')],'to':_0x596312['to'],'subject':_0x596312['subject'],'html':_0x596312[_0x0a9e('0x56')],'headers':{'Date':moment(_0x596312['createdAt'])[_0x0a9e('0x73')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x213e5d['cc']){_0x4db918['headers']['Cc']=_0x213e5d['cc'];}if(_0x213e5d[_0x0a9e('0x9d')]){_0x4db918[_0x0a9e('0x9e')]['Bcc']=_0x213e5d[_0x0a9e('0x9d')];}return new BPromise(function(_0x17cb30,_0x15c6b9){if(_0x213e5d[_0x0a9e('0x9c')]){for(var _0x2eb028=0x0;_0x2eb028<_0x213e5d['Attachments']['length'];_0x2eb028++){var _0x16449b=_0x213e5d[_0x0a9e('0x9c')][_0x2eb028];var _0x41c8cd=path[_0x0a9e('0x95')](_0x586510,_0x16449b[_0x0a9e('0x6f')]);if(fs['existsSync'](_0x41c8cd)){_0x4db918[_0x0a9e('0x6c')][_0x0a9e('0x9f')]({'name':_0x16449b['name'],'contentType':_0x16449b[_0x0a9e('0x3d')],'data':fs[_0x0a9e('0xa0')](_0x41c8cd)});}}}emlformat[_0x0a9e('0xa1')](_0x4db918,function(_0x2427d5,_0x23b25b){if(_0x2427d5)return _0x15c6b9(_0x2427d5);fs[_0x0a9e('0xa2')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92),_0x23b25b);return _0x17cb30(_0x23b25b);});});}})[_0x0a9e('0x1e')](function(_0x40dd2a){if(_0x40dd2a){return _0x4c788f[_0x0a9e('0x92')](path['join'](_0x413190,_0x28ce92),_0x28ce92,function(_0x1065a7){if(_0x1065a7){console[_0x0a9e('0xa3')](_0x0a9e('0xa4'),_0x1065a7);}else{fs[_0x0a9e('0xa5')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92));}});}})['catch'](handleError(_0x4c788f,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index df6f46b..4651f27 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 _0x4dd5=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailMessage'];(function(_0x19a11f,_0x6d8be7){var _0x51485f=function(_0x1394a1){while(--_0x1394a1){_0x19a11f['push'](_0x19a11f['shift']());}};_0x51485f(++_0x6d8be7);}(_0x4dd5,0x192));var _0x54dd=function(_0x3a024b,_0x413f45){_0x3a024b=_0x3a024b-0x0;var _0x1c7fb8=_0x4dd5[_0x3a024b];return _0x1c7fb8;};'use strict';var EventEmitter=require(_0x54dd('0x0'));var MailMessage=require(_0x54dd('0x1'))['db'][_0x54dd('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x54dd('0x3'),'afterUpdate':_0x54dd('0x4'),'afterDestroy':_0x54dd('0x5')};function emitEvent(_0x2a77bb){return function(_0x1bbafc,_0x5b9c49,_0x3532ab){MailMessageEvents[_0x54dd('0x6')](_0x2a77bb+':'+_0x1bbafc['id'],_0x1bbafc);MailMessageEvents['emit'](_0x2a77bb,_0x1bbafc);_0x3532ab(null);};}for(var e in events){if(events[_0x54dd('0x7')](e)){var event=events[e];MailMessage[_0x54dd('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xeaa9=['emit','hasOwnProperty','hook','exports','../../mysqldb','MailMessage','update','remove'];(function(_0x79eeae,_0x4be496){var _0x4a7717=function(_0x54da49){while(--_0x54da49){_0x79eeae['push'](_0x79eeae['shift']());}};_0x4a7717(++_0x4be496);}(_0xeaa9,0x124));var _0x9eaa=function(_0xacf20c,_0x183c46){_0xacf20c=_0xacf20c-0x0;var _0x3948fd=_0xeaa9[_0xacf20c];return _0x3948fd;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x9eaa('0x0'))['db'][_0x9eaa('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9eaa('0x2'),'afterDestroy':_0x9eaa('0x3')};function emitEvent(_0x1ab0c9){return function(_0x146733,_0x384a68,_0x297731){MailMessageEvents[_0x9eaa('0x4')](_0x1ab0c9+':'+_0x146733['id'],_0x146733);MailMessageEvents['emit'](_0x1ab0c9,_0x146733);_0x297731(null);};}for(var e in events){if(events[_0x9eaa('0x5')](e)){var event=events[e];MailMessage[_0x9eaa('0x6')](e,emitEvent(event));}}module[_0x9eaa('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 e2d1663..e01baf1 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 _0x4195=['exports','define','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','models','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','catch','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment'];(function(_0x4c8b8c,_0x2a3d1b){var _0x344077=function(_0x52dd74){while(--_0x52dd74){_0x4c8b8c['push'](_0x4c8b8c['shift']());}};_0x344077(++_0x2a3d1b);}(_0x4195,0x91));var _0x5419=function(_0x4d1101,_0x415b12){_0x4d1101=_0x4d1101-0x0;var _0x4fe135=_0x4195[_0x4d1101];return _0x4fe135;};'use strict';var _=require('lodash');var util=require(_0x5419('0x0'));var logger=require(_0x5419('0x1'))(_0x5419('0x2'));var moment=require(_0x5419('0x3'));var BPromise=require(_0x5419('0x4'));var rp=require(_0x5419('0x5'));var htmlToText=require(_0x5419('0x6'));var fs=require('fs');var path=require(_0x5419('0x7'));var rimraf=require(_0x5419('0x8'));var config=require(_0x5419('0x9'));var attributes=require('./mailMessage.attributes');module[_0x5419('0xa')]=function(_0x308f99,_0x2a4639){return _0x308f99[_0x5419('0xb')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x5419('0xc'),'fields':[_0x5419('0xc')]},{'name':_0x5419('0xd'),'fields':[_0x5419('0xe'),_0x5419('0xf')],'type':_0x5419('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x957a25,_0x5718ca,_0x21f0d5){if(_0x957a25['body']){_0x957a25[_0x5419('0xe')]=htmlToText[_0x5419('0x11')](_0x957a25['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x21f0d5(null,_0x5718ca);},'afterCreate':function(_0x5a9dce,_0x35c265,_0xcc2984){var _0x6694b0=_0x308f99[_0x5419('0x12')];var _0x158c19=_0x5a9dce['get']({'plain':!![]});if(_0x158c19[_0x5419('0x13')]['toLowerCase']()==='in'||_0x158c19[_0x5419('0x13')][_0x5419('0x14')]()===_0x5419('0x15')&&!_0x158c19[_0x5419('0x16')]&&!_[_0x5419('0x17')](_0x158c19[_0x5419('0x18')])){_0x6694b0[_0x5419('0x19')]['findOne']({'where':{'id':_0x158c19[_0x5419('0x1a')]}})[_0x5419('0x1b')](function(_0x38d253){if(_0x38d253){_0x38d253[_0x5419('0x1c')]({'lastMsgAt':_0x158c19['createdAt'],'lastMsgDirection':_0x158c19[_0x5419('0x13')][_0x5419('0x14')](),'lastMsgBody':_0x158c19['body']});}})[_0x5419('0x1d')](function(_0x218a90){console['error'](_0x218a90);});}_0xcc2984();}},'charset':_0x5419('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa61b=['exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','rimraf','./mailMessage.attributes'];(function(_0xe19f0e,_0x395d0e){var _0x43433a=function(_0x189e16){while(--_0x189e16){_0xe19f0e['push'](_0xe19f0e['shift']());}};_0x43433a(++_0x395d0e);}(_0xa61b,0x8a));var _0xba61=function(_0x20f048,_0x42aef8){_0x20f048=_0x20f048-0x0;var _0x3057e3=_0xa61b[_0x20f048];return _0x3057e3;};'use strict';var _=require(_0xba61('0x0'));var util=require(_0xba61('0x1'));var logger=require(_0xba61('0x2'))(_0xba61('0x3'));var moment=require(_0xba61('0x4'));var BPromise=require(_0xba61('0x5'));var rp=require(_0xba61('0x6'));var htmlToText=require(_0xba61('0x7'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba61('0x8'));var config=require('../../config/environment');var attributes=require(_0xba61('0x9'));module[_0xba61('0xa')]=function(_0x251e17,_0x2c1cf6){return _0x251e17[_0xba61('0xb')](_0xba61('0xc'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xba61('0xd'),'fields':[_0xba61('0xd')]},{'name':_0xba61('0xe'),'fields':[_0xba61('0xf'),_0xba61('0x10')],'type':_0xba61('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x325976,_0x4c070e,_0x341c6f){if(_0x325976['body']){_0x325976[_0xba61('0xf')]=htmlToText[_0xba61('0x12')](_0x325976[_0xba61('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x341c6f(null,_0x4c070e);},'afterCreate':function(_0x57dbcf,_0x4eb42a,_0x139ccc){var _0x3c0013=_0x251e17[_0xba61('0x14')];var _0x10cea2=_0x57dbcf[_0xba61('0x15')]({'plain':!![]});if(_0x10cea2[_0xba61('0x16')][_0xba61('0x17')]()==='in'||_0x10cea2[_0xba61('0x16')][_0xba61('0x17')]()===_0xba61('0x18')&&!_0x10cea2[_0xba61('0x19')]&&!_[_0xba61('0x1a')](_0x10cea2[_0xba61('0x1b')])){_0x3c0013[_0xba61('0x1c')][_0xba61('0x1d')]({'where':{'id':_0x10cea2[_0xba61('0x1e')]}})[_0xba61('0x1f')](function(_0x32bced){if(_0x32bced){_0x32bced[_0xba61('0x20')]({'lastMsgAt':_0x10cea2[_0xba61('0x21')],'lastMsgDirection':_0x10cea2[_0xba61('0x16')][_0xba61('0x17')](),'lastMsgBody':_0x10cea2[_0xba61('0x13')]});}})[_0xba61('0x22')](function(_0xa58b1e){console[_0xba61('0x23')](_0xa58b1e);});}_0x139ccc();}},'charset':'utf8mb4','collate':_0xba61('0x24')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 862996f..fab9653 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 _0x1b69=['client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailMessage','create','body','options','raw','CreateMailMessage','debug','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x1b69,0x190));var _0x91b6=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x1b69[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x91b6('0x0'));var rs=require(_0x91b6('0x1'));var fs=require('fs');var Redis=require(_0x91b6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x91b6('0x3'));var logger=require(_0x91b6('0x4'))(_0x91b6('0x5'));var config=require(_0x91b6('0x6'));var jayson=require(_0x91b6('0x7'));var client=jayson[_0x91b6('0x8')][_0x91b6('0x9')]({'port':0x232a});config[_0x91b6('0xa')]=_[_0x91b6('0xb')](config[_0x91b6('0xa')],{'host':_0x91b6('0xc'),'port':0x18eb});var socket=require(_0x91b6('0xd'))(new Redis(config[_0x91b6('0xa')]));require(_0x91b6('0xe'))['register'](socket);function respondWithRpcPromise(_0x563f68,_0x579e5b,_0x3580be){return new BPromise(function(_0x416bdd,_0x59c9ea){return client[_0x91b6('0xf')](_0x563f68,_0x3580be)[_0x91b6('0x10')](function(_0x45b492){logger[_0x91b6('0x11')](_0x91b6('0x12'),_0x579e5b,_0x91b6('0x13'));logger['debug'](_0x91b6('0x14'),_0x579e5b,'request\x20sent',JSON[_0x91b6('0x15')](_0x45b492));if(_0x45b492[_0x91b6('0x16')]){if(_0x45b492[_0x91b6('0x16')][_0x91b6('0x17')]===0x1f4){logger['error'](_0x91b6('0x12'),_0x579e5b,_0x45b492[_0x91b6('0x16')][_0x91b6('0x18')]);return _0x59c9ea(_0x45b492[_0x91b6('0x16')][_0x91b6('0x18')]);}logger['error'](_0x91b6('0x12'),_0x579e5b,_0x45b492[_0x91b6('0x16')][_0x91b6('0x18')]);return _0x416bdd(_0x45b492[_0x91b6('0x16')]['message']);}else{logger['info'](_0x91b6('0x12'),_0x579e5b,_0x91b6('0x13'));_0x416bdd(_0x45b492[_0x91b6('0x19')][_0x91b6('0x18')]);}})[_0x91b6('0x1a')](function(_0x34f58b){logger['error'](_0x91b6('0x12'),_0x579e5b,_0x34f58b);_0x59c9ea(_0x34f58b);});});}exports['CreateMailMessage']=function(_0x180d91){var _0x459991=this;return new Promise(function(_0x2a8d1d,_0x294422){return db[_0x91b6('0x1b')][_0x91b6('0x1c')](_0x180d91[_0x91b6('0x1d')],{'raw':_0x180d91[_0x91b6('0x1e')]?_0x180d91['options'][_0x91b6('0x1f')]===undefined?!![]:![]:!![]})[_0x91b6('0x10')](function(_0xe34dc0){logger['info'](_0x91b6('0x20'),_0x180d91);logger[_0x91b6('0x21')]('CreateMailMessage',_0x180d91,JSON['stringify'](_0xe34dc0));_0x2a8d1d(_0xe34dc0);})[_0x91b6('0x1a')](function(_0x499f8c){logger[_0x91b6('0x16')](_0x91b6('0x20'),_0x499f8c[_0x91b6('0x18')],_0x180d91);_0x294422(_0x459991['error'](0x1f4,_0x499f8c[_0x91b6('0x18')]));});});}; \ No newline at end of file +var _0x389e=['then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','create','options','raw','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailMessage.socket','request'];(function(_0x4b7d7a,_0x560990){var _0x3d69ee=function(_0x50649d){while(--_0x50649d){_0x4b7d7a['push'](_0x4b7d7a['shift']());}};_0x3d69ee(++_0x560990);}(_0x389e,0x188));var _0xe389=function(_0x673dbf,_0x2f47f2){_0x673dbf=_0x673dbf-0x0;var _0x1e0318=_0x389e[_0x673dbf];return _0x1e0318;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe389('0x0'));var rs=require(_0xe389('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe389('0x2'))['db'];var utils=require(_0xe389('0x3'));var logger=require(_0xe389('0x4'))(_0xe389('0x5'));var config=require(_0xe389('0x6'));var jayson=require(_0xe389('0x7'));var client=jayson[_0xe389('0x8')]['http']({'port':0x232a});config[_0xe389('0x9')]=_[_0xe389('0xa')](config[_0xe389('0x9')],{'host':_0xe389('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe389('0x9')]));require(_0xe389('0xc'))['register'](socket);function respondWithRpcPromise(_0x5ce389,_0x2377fd,_0x3857b8){return new BPromise(function(_0x2dafb4,_0x14379d){return client[_0xe389('0xd')](_0x5ce389,_0x3857b8)[_0xe389('0xe')](function(_0x2a88de){logger[_0xe389('0xf')](_0xe389('0x10'),_0x2377fd,_0xe389('0x11'));logger['debug'](_0xe389('0x12'),_0x2377fd,_0xe389('0x11'),JSON[_0xe389('0x13')](_0x2a88de));if(_0x2a88de['error']){if(_0x2a88de[_0xe389('0x14')][_0xe389('0x15')]===0x1f4){logger[_0xe389('0x14')]('MailMessage,\x20%s,\x20%s',_0x2377fd,_0x2a88de['error'][_0xe389('0x16')]);return _0x14379d(_0x2a88de[_0xe389('0x14')][_0xe389('0x16')]);}logger[_0xe389('0x14')](_0xe389('0x10'),_0x2377fd,_0x2a88de[_0xe389('0x14')]['message']);return _0x2dafb4(_0x2a88de['error'][_0xe389('0x16')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x2377fd,'request\x20sent');_0x2dafb4(_0x2a88de[_0xe389('0x17')]['message']);}})[_0xe389('0x18')](function(_0x43d057){logger[_0xe389('0x14')](_0xe389('0x10'),_0x2377fd,_0x43d057);_0x14379d(_0x43d057);});});}exports[_0xe389('0x19')]=function(_0x4c67b2){var _0x407d4d=this;return new Promise(function(_0x4aff9d,_0x276b86){return db['MailMessage'][_0xe389('0x1a')](_0x4c67b2['body'],{'raw':_0x4c67b2[_0xe389('0x1b')]?_0x4c67b2[_0xe389('0x1b')][_0xe389('0x1c')]===undefined?!![]:![]:!![]})[_0xe389('0xe')](function(_0xb0dcea){logger['info'](_0xe389('0x19'),_0x4c67b2);logger['debug'](_0xe389('0x19'),_0x4c67b2,JSON[_0xe389('0x13')](_0xb0dcea));_0x4aff9d(_0xb0dcea);})[_0xe389('0x18')](function(_0x7cbea4){logger[_0xe389('0x14')](_0xe389('0x19'),_0x7cbea4[_0xe389('0x16')],_0x4c67b2);_0x276b86(_0x407d4d[_0xe389('0x14')](0x1f4,_0x7cbea4['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index a15e1a7..5e9e007 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 _0xaa2b=['emit','removeListener','register','length','save','remove','update'];(function(_0x2c73a3,_0x12bc0e){var _0x31531e=function(_0x316d5f){while(--_0x316d5f){_0x2c73a3['push'](_0x2c73a3['shift']());}};_0x31531e(++_0x12bc0e);}(_0xaa2b,0x1e7));var _0xbaa2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xaa2b[_0x2641f9];return _0x585741;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xbaa2('0x0'),_0xbaa2('0x1'),_0xbaa2('0x2')];function createListener(_0x12d527,_0x544fb9){return function(_0x597dbd){_0x544fb9[_0xbaa2('0x3')](_0x12d527,_0x597dbd);};}function removeListener(_0x5a7ec7,_0xc0e07d){return function(){MailMessageEvents[_0xbaa2('0x4')](_0x5a7ec7,_0xc0e07d);};}exports[_0xbaa2('0x5')]=function(_0x455ec7){for(var _0x176d37=0x0,_0x8867f7=events[_0xbaa2('0x6')];_0x176d37<_0x8867f7;_0x176d37++){var _0x28acb2=events[_0x176d37];var _0x562c3e=createListener('mailMessage:'+_0x28acb2,_0x455ec7);MailMessageEvents['on'](_0x28acb2,_0x562c3e);}}; \ No newline at end of file +var _0x4062=['emit','removeListener','register','length','save','update'];(function(_0x9ae685,_0x2c6652){var _0x4c492e=function(_0xde76ce){while(--_0xde76ce){_0x9ae685['push'](_0x9ae685['shift']());}};_0x4c492e(++_0x2c6652);}(_0x4062,0x1ae));var _0x2406=function(_0x3d92ba,_0x3b8424){_0x3d92ba=_0x3d92ba-0x0;var _0x2396db=_0x4062[_0x3d92ba];return _0x2396db;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x2406('0x0'),'remove',_0x2406('0x1')];function createListener(_0x4de7a0,_0xb00df7){return function(_0x4960da){_0xb00df7[_0x2406('0x2')](_0x4de7a0,_0x4960da);};}function removeListener(_0x5239c5,_0x1089ae){return function(){MailMessageEvents[_0x2406('0x3')](_0x5239c5,_0x1089ae);};}exports[_0x2406('0x4')]=function(_0x320b05){for(var _0x1e5450=0x0,_0x33fc20=events[_0x2406('0x5')];_0x1e5450<_0x33fc20;_0x1e5450++){var _0xc18f1b=events[_0x1e5450];var _0x49fd0a=createListener('mailMessage:'+_0xc18f1b,_0x320b05);MailMessageEvents['on'](_0xc18f1b,_0x49fd0a);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index f4ae994..70a9de7 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 _0xb351=['/:id/teams','addTeams','addAgents','put','update','destroy','removeTeams','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post'];(function(_0x22de70,_0x243f39){var _0x34050e=function(_0x21186e){while(--_0x21186e){_0x22de70['push'](_0x22de70['shift']());}};_0x34050e(++_0x243f39);}(_0xb351,0x10d));var _0x1b35=function(_0x28294a,_0x542642){_0x28294a=_0x28294a-0x0;var _0x3bef7d=_0xb351[_0x28294a];return _0x3bef7d;};'use strict';var multer=require(_0x1b35('0x0'));var util=require(_0x1b35('0x1'));var path=require('path');var timeout=require(_0x1b35('0x2'));var express=require(_0x1b35('0x3'));var router=express[_0x1b35('0x4')]();var auth=require(_0x1b35('0x5'));var interaction=require(_0x1b35('0x6'));var config=require(_0x1b35('0x7'));var controller=require('./mailQueue.controller');router['get']('/',auth[_0x1b35('0x8')](),controller[_0x1b35('0x9')]);router['get'](_0x1b35('0xa'),auth[_0x1b35('0x8')](),controller[_0x1b35('0xb')]);router[_0x1b35('0xc')](_0x1b35('0xd'),auth['isAuthenticated'](),controller[_0x1b35('0xe')]);router[_0x1b35('0xc')](_0x1b35('0xf'),auth['isAuthenticated'](),controller[_0x1b35('0x10')]);router['get']('/:id/teams',auth[_0x1b35('0x8')](),controller[_0x1b35('0x11')]);router['get'](_0x1b35('0x12'),auth[_0x1b35('0x8')](),controller[_0x1b35('0x13')]);router['post']('/',auth[_0x1b35('0x8')](),controller['create']);router[_0x1b35('0x14')](_0x1b35('0x15'),auth['isAuthenticated'](),controller[_0x1b35('0x16')]);router[_0x1b35('0x14')](_0x1b35('0x12'),auth[_0x1b35('0x8')](),controller[_0x1b35('0x17')]);router[_0x1b35('0x18')]('/:id',auth[_0x1b35('0x8')](),controller[_0x1b35('0x19')]);router['delete']('/:id',auth[_0x1b35('0x8')](),controller[_0x1b35('0x1a')]);router['delete'](_0x1b35('0x15'),auth[_0x1b35('0x8')](),controller[_0x1b35('0x1b')]);router['delete'](_0x1b35('0x12'),auth[_0x1b35('0x8')](),controller['removeAgents']);module[_0x1b35('0x1c')]=router; \ No newline at end of file +var _0x2130=['delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x2130,0x1b5));var _0x0213=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x2130[_0x13ce0c];return _0x4388fb;};'use strict';var multer=require(_0x0213('0x0'));var util=require(_0x0213('0x1'));var path=require(_0x0213('0x2'));var timeout=require('connect-timeout');var express=require(_0x0213('0x3'));var router=express[_0x0213('0x4')]();var auth=require(_0x0213('0x5'));var interaction=require(_0x0213('0x6'));var config=require(_0x0213('0x7'));var controller=require(_0x0213('0x8'));router[_0x0213('0x9')]('/',auth[_0x0213('0xa')](),controller[_0x0213('0xb')]);router[_0x0213('0x9')](_0x0213('0xc'),auth['isAuthenticated'](),controller[_0x0213('0xd')]);router[_0x0213('0x9')](_0x0213('0xe'),auth[_0x0213('0xa')](),controller[_0x0213('0xf')]);router['get'](_0x0213('0x10'),auth['isAuthenticated'](),controller[_0x0213('0x11')]);router['get'](_0x0213('0x12'),auth[_0x0213('0xa')](),controller[_0x0213('0x13')]);router[_0x0213('0x9')](_0x0213('0x14'),auth[_0x0213('0xa')](),controller[_0x0213('0x15')]);router[_0x0213('0x16')]('/',auth['isAuthenticated'](),controller[_0x0213('0x17')]);router[_0x0213('0x16')](_0x0213('0x12'),auth[_0x0213('0xa')](),controller['addTeams']);router[_0x0213('0x16')](_0x0213('0x14'),auth['isAuthenticated'](),controller[_0x0213('0x18')]);router[_0x0213('0x19')](_0x0213('0xe'),auth[_0x0213('0xa')](),controller[_0x0213('0x1a')]);router['delete'](_0x0213('0xe'),auth[_0x0213('0xa')](),controller['destroy']);router[_0x0213('0x1b')]('/:id/teams',auth[_0x0213('0xa')](),controller['removeTeams']);router['delete'](_0x0213('0x14'),auth[_0x0213('0xa')](),controller['removeAgents']);module[_0x0213('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index df801b1..8d9bd82 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 _0x1b64=['name','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x16d5ed,_0x496f84){var _0xd7e99d=function(_0x568909){while(--_0x568909){_0x16d5ed['push'](_0x16d5ed['shift']());}};_0xd7e99d(++_0x496f84);}(_0x1b64,0x76));var _0x41b6=function(_0xf84210,_0x417183){_0xf84210=_0xf84210-0x0;var _0x4287a4=_0x1b64[_0xf84210];return _0x4287a4;};'use strict';var Sequelize=require(_0x41b6('0x0'));module[_0x41b6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x41b6('0x2'),'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'](_0x41b6('0x3'),_0x41b6('0x4'),_0x41b6('0x5'))}}; \ No newline at end of file +var _0xd06f=['roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x6bbc50,_0x26b8e9){var _0x5e8e93=function(_0x2dda79){while(--_0x2dda79){_0x6bbc50['push'](_0x6bbc50['shift']());}};_0x5e8e93(++_0x26b8e9);}(_0xd06f,0x13c));var _0xfd06=function(_0x1ecbd5,_0xf05f7c){_0x1ecbd5=_0x1ecbd5-0x0;var _0x1be527=_0xd06f[_0x1ecbd5];return _0x1be527;};'use strict';var Sequelize=require(_0xfd06('0x0'));module[_0xfd06('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfd06('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfd06('0x3')]},'timeout':{'type':Sequelize[_0xfd06('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfd06('0x5')](_0xfd06('0x6'),_0xfd06('0x7'),_0xfd06('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 3b217fa..620c61b 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 _0xe34f=['error','describe','getMembers','findOne','UserMailQueue','pick','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','rows','%s/%s','SIP','getTeams','Team','addTeams','ids','findAll','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','union','compact','value','transaction','isEmpty','removeAgents','forEach','omit','spread','userMailQueue:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','MailQueue','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','options','includeAll','include','show','params','catch','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','MailQueues','find','userProfileId','UserProfileResource','create'];(function(_0x38cdab,_0x58005c){var _0x506ffc=function(_0x5366d3){while(--_0x5366d3){_0x38cdab['push'](_0x38cdab['shift']());}};_0x506ffc(++_0x58005c);}(_0xe34f,0xbc));var _0xfe34=function(_0x504d4c,_0x2e20ee){_0x504d4c=_0x504d4c-0x0;var _0x2e5c60=_0xe34f[_0x504d4c];return _0x2e5c60;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfe34('0x0'));var rp=require(_0xfe34('0x1'));var moment=require(_0xfe34('0x2'));var BPromise=require(_0xfe34('0x3'));var Mustache=require(_0xfe34('0x4'));var util=require(_0xfe34('0x5'));var path=require(_0xfe34('0x6'));var sox=require('sox');var csv=require(_0xfe34('0x7'));var ejs=require(_0xfe34('0x8'));var fs=require('fs');var _=require(_0xfe34('0x9'));var squel=require(_0xfe34('0xa'));var crypto=require(_0xfe34('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfe34('0x7'));var querystring=require(_0xfe34('0xc'));var Papa=require(_0xfe34('0xd'));var Redis=require(_0xfe34('0xe'));var authService=require(_0xfe34('0xf'));var qs=require(_0xfe34('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfe34('0x11'));var config=require(_0xfe34('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe34('0x13'))['db'];config[_0xfe34('0x14')]=_[_0xfe34('0x15')](config[_0xfe34('0x14')],{'host':_0xfe34('0x16'),'port':0x18eb});var socket=require(_0xfe34('0x17'))(new Redis(config['redis']));require(_0xfe34('0x18'))[_0xfe34('0x19')](socket);function respondWithStatusCode(_0x1b51b7,_0x2ee398){_0x2ee398=_0x2ee398||0xcc;return function(_0x2a7790){if(_0x2a7790){return _0x1b51b7['sendStatus'](_0x2ee398);}return _0x1b51b7[_0xfe34('0x1a')](_0x2ee398)[_0xfe34('0x1b')]();};}function respondWithResult(_0x2cdaa5,_0x40927b){_0x40927b=_0x40927b||0xc8;return function(_0x53099b){if(_0x53099b){return _0x2cdaa5['status'](_0x40927b)['json'](_0x53099b);}};}function respondWithFilteredResult(_0x2ce838,_0x59ba95){return function(_0x5c95f5){if(_0x5c95f5){var _0x495b48=_0x5c95f5[_0xfe34('0x1c')],_0x3f7f60=_0x59ba95['offset'],_0x19f7e3=_0x59ba95[_0xfe34('0x1d')]+_0x59ba95[_0xfe34('0x1e')],_0x46353a;if(_0x19f7e3>=_0x495b48){_0x19f7e3=_0x495b48;_0x46353a=0xc8;}else{_0x46353a=0xce;}_0x2ce838[_0xfe34('0x1a')](_0x46353a);return _0x2ce838[_0xfe34('0x1f')](_0xfe34('0x20'),_0x3f7f60+'-'+_0x19f7e3+'/'+_0x495b48)[_0xfe34('0x21')](_0x5c95f5);}return null;};}function patchUpdates(_0x5d1143){return function(_0x3e679b){try{jsonpatch[_0xfe34('0x22')](_0x3e679b,_0x5d1143,!![]);}catch(_0x415646){return BPromise['reject'](_0x415646);}return _0x3e679b[_0xfe34('0x23')]();};}function saveUpdates(_0x9137af,_0x148221){return function(_0x14ea09){if(_0x14ea09){return _0x14ea09[_0xfe34('0x24')](_0x9137af)[_0xfe34('0x25')](function(_0x249ffc){return _0x249ffc;});}return null;};}function removeEntity(_0x270d39,_0x371498){return function(_0x837b19){if(_0x837b19){return _0x837b19['destroy']()[_0xfe34('0x25')](function(){var _0x257c3c=_0x837b19['get']({'plain':!![]});var _0x1dbd50='MailQueues';return db['UserProfileResource'][_0xfe34('0x26')]({'where':{'type':_0x1dbd50,'resourceId':_0x257c3c['id']}})['then'](function(){return _0x837b19;});})['then'](function(){_0x270d39[_0xfe34('0x1a')](0xcc)[_0xfe34('0x1b')]();});}};}function handleEntityNotFound(_0x48a886,_0x372886){return function(_0x34b453){if(!_0x34b453){_0x48a886[_0xfe34('0x27')](0x194);}return _0x34b453;};}function handleError(_0x3ab3e5,_0x58eba7){_0x58eba7=_0x58eba7||0x1f4;return function(_0x4d153b){logger['error'](_0x4d153b[_0xfe34('0x28')]);if(_0x4d153b[_0xfe34('0x29')]){delete _0x4d153b[_0xfe34('0x29')];}_0x3ab3e5[_0xfe34('0x1a')](_0x58eba7)[_0xfe34('0x2a')](_0x4d153b);};}exports[_0xfe34('0x2b')]=function(_0x44adf0,_0x4b9b50){var _0x345c00={},_0x1a3cec={},_0x1aece7={'count':0x0,'rows':[]};var _0x510ec3=_[_0xfe34('0x2c')](db[_0xfe34('0x2d')][_0xfe34('0x2e')],function(_0x3b4d62){return{'name':_0x3b4d62['fieldName'],'type':_0x3b4d62[_0xfe34('0x2f')][_0xfe34('0x30')]};});_0x1a3cec['model']=_[_0xfe34('0x2c')](_0x510ec3,_0xfe34('0x29'));_0x1a3cec[_0xfe34('0x31')]=_[_0xfe34('0x32')](_0x44adf0[_0xfe34('0x31')]);_0x1a3cec['filters']=_['intersection'](_0x1a3cec[_0xfe34('0x33')],_0x1a3cec['query']);_0x345c00[_0xfe34('0x34')]=_[_0xfe34('0x35')](_0x1a3cec[_0xfe34('0x33')],qs[_0xfe34('0x36')](_0x44adf0[_0xfe34('0x31')][_0xfe34('0x36')]));_0x345c00['attributes']=_0x345c00[_0xfe34('0x34')][_0xfe34('0x37')]?_0x345c00[_0xfe34('0x34')]:_0x1a3cec[_0xfe34('0x33')];if(!_0x44adf0[_0xfe34('0x31')][_0xfe34('0x38')](_0xfe34('0x39'))){_0x345c00[_0xfe34('0x1e')]=qs[_0xfe34('0x1e')](_0x44adf0[_0xfe34('0x31')][_0xfe34('0x1e')]);_0x345c00[_0xfe34('0x1d')]=qs[_0xfe34('0x1d')](_0x44adf0[_0xfe34('0x31')][_0xfe34('0x1d')]);}_0x345c00[_0xfe34('0x3a')]=qs[_0xfe34('0x3b')](_0x44adf0[_0xfe34('0x31')][_0xfe34('0x3b')]);_0x345c00['where']=qs[_0xfe34('0x3c')](_['pick'](_0x44adf0[_0xfe34('0x31')],_0x1a3cec['filters']),_0x510ec3);if(_0x44adf0[_0xfe34('0x31')][_0xfe34('0x3d')]){_0x345c00[_0xfe34('0x3e')]=_[_0xfe34('0x3f')](_0x345c00['where'],{'$or':_['map'](_0x510ec3,function(_0x563830){if(_0x563830[_0xfe34('0x2f')]!=='VIRTUAL'){var _0x9b38bf={};_0x9b38bf[_0x563830[_0xfe34('0x29')]]={'$like':'%'+_0x44adf0[_0xfe34('0x31')][_0xfe34('0x3d')]+'%'};return _0x9b38bf;}})});}_0x345c00=_[_0xfe34('0x3f')]({},_0x345c00,_0x44adf0[_0xfe34('0x40')]);var _0x19058a={'where':_0x345c00[_0xfe34('0x3e')]};return db[_0xfe34('0x2d')][_0xfe34('0x1c')](_0x19058a)[_0xfe34('0x25')](function(_0x2bacc6){_0x1aece7['count']=_0x2bacc6;if(_0x44adf0[_0xfe34('0x31')][_0xfe34('0x41')]){_0x345c00[_0xfe34('0x42')]=[{'all':!![]}];}return db[_0xfe34('0x2d')]['findAll'](_0x345c00);})[_0xfe34('0x25')](function(_0x41f523){_0x1aece7['rows']=_0x41f523;return _0x1aece7;})[_0xfe34('0x25')](respondWithFilteredResult(_0x4b9b50,_0x345c00))['catch'](handleError(_0x4b9b50,null));};exports[_0xfe34('0x43')]=function(_0x54c2fb,_0x36ad3a){var _0x4f163c={'raw':!![],'where':{'id':_0x54c2fb[_0xfe34('0x44')]['id']}},_0x35a1ee={};_0x35a1ee[_0xfe34('0x33')]=_[_0xfe34('0x32')](db[_0xfe34('0x2d')][_0xfe34('0x2e')]);_0x35a1ee[_0xfe34('0x31')]=_['keys'](_0x54c2fb[_0xfe34('0x31')]);_0x35a1ee[_0xfe34('0x3c')]=_['intersection'](_0x35a1ee[_0xfe34('0x33')],_0x35a1ee['query']);_0x4f163c[_0xfe34('0x34')]=_[_0xfe34('0x35')](_0x35a1ee[_0xfe34('0x33')],qs[_0xfe34('0x36')](_0x54c2fb[_0xfe34('0x31')][_0xfe34('0x36')]));_0x4f163c[_0xfe34('0x34')]=_0x4f163c[_0xfe34('0x34')][_0xfe34('0x37')]?_0x4f163c[_0xfe34('0x34')]:_0x35a1ee[_0xfe34('0x33')];if(_0x54c2fb[_0xfe34('0x31')][_0xfe34('0x41')]){_0x4f163c[_0xfe34('0x42')]=[{'all':!![]}];}_0x4f163c=_[_0xfe34('0x3f')]({},_0x4f163c,_0x54c2fb['options']);return db[_0xfe34('0x2d')]['find'](_0x4f163c)[_0xfe34('0x25')](handleEntityNotFound(_0x36ad3a,null))[_0xfe34('0x25')](respondWithResult(_0x36ad3a,null))[_0xfe34('0x45')](handleError(_0x36ad3a,null));};exports['create']=function(_0x507362,_0x4707d4){return db['MailQueue']['create'](_0x507362[_0xfe34('0x46')],{})[_0xfe34('0x25')](function(_0x1ed876){var _0x408390=_0x507362['user'][_0xfe34('0x47')]({'plain':!![]});if(!_0x408390)throw new Error(_0xfe34('0x48'));if(_0x408390[_0xfe34('0x49')]===_0xfe34('0x4a')){var _0x4473a3=_0x1ed876[_0xfe34('0x47')]({'plain':!![]});var _0x26759d=_0xfe34('0x4b');return db['UserProfileSection'][_0xfe34('0x4c')]({'where':{'name':_0x26759d,'userProfileId':_0x408390[_0xfe34('0x4d')]},'raw':!![]})[_0xfe34('0x25')](function(_0x64eb94){if(_0x64eb94&&_0x64eb94['autoAssociation']===0x0){return db[_0xfe34('0x4e')][_0xfe34('0x4f')]({'name':_0x4473a3[_0xfe34('0x29')],'resourceId':_0x4473a3['id'],'type':_0x64eb94['name'],'sectionId':_0x64eb94['id']},{})['then'](function(){return _0x1ed876;});}else{return _0x1ed876;}})['catch'](function(_0x1e1de8){logger[_0xfe34('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e1de8);throw _0x1e1de8;});}return _0x1ed876;})[_0xfe34('0x25')](respondWithResult(_0x4707d4,0xc9))['catch'](handleError(_0x4707d4,null));};exports[_0xfe34('0x24')]=function(_0x151132,_0x11b64c){if(_0x151132[_0xfe34('0x46')]['id']){delete _0x151132[_0xfe34('0x46')]['id'];}return db['MailQueue'][_0xfe34('0x4c')]({'where':{'id':_0x151132[_0xfe34('0x44')]['id']}})[_0xfe34('0x25')](handleEntityNotFound(_0x11b64c,null))[_0xfe34('0x25')](saveUpdates(_0x151132['body'],null))['then'](respondWithResult(_0x11b64c,null))[_0xfe34('0x45')](handleError(_0x11b64c,null));};exports[_0xfe34('0x26')]=function(_0x3c9ab6,_0x26ce7b){return db['MailQueue'][_0xfe34('0x4c')]({'where':{'id':_0x3c9ab6[_0xfe34('0x44')]['id']}})[_0xfe34('0x25')](handleEntityNotFound(_0x26ce7b,null))[_0xfe34('0x25')](removeEntity(_0x26ce7b,null))['catch'](handleError(_0x26ce7b,null));};exports[_0xfe34('0x51')]=function(_0x4caa43,_0x40bce1){return db['MailQueue'][_0xfe34('0x51')]()[_0xfe34('0x25')](respondWithResult(_0x40bce1,null))[_0xfe34('0x45')](handleError(_0x40bce1,null));};exports[_0xfe34('0x52')]=function(_0xd0f6fc,_0x249e9a,_0x1cc5bb){var _0x4bef1c={'raw':!![],'where':{}},_0x574887={},_0x313151;return db[_0xfe34('0x2d')][_0xfe34('0x53')]({'where':{'id':_0xd0f6fc['params']['id']}})[_0xfe34('0x25')](handleEntityNotFound(_0x249e9a,null))[_0xfe34('0x25')](function(_0x4daf0f){if(_0x4daf0f){_0x313151=_0x4daf0f[_0xfe34('0x47')]({'plain':!![]});_0x574887['model']=_['keys'](db[_0xfe34('0x54')][_0xfe34('0x2e')]);_0x574887[_0xfe34('0x31')]=_[_0xfe34('0x32')](_0xd0f6fc[_0xfe34('0x31')]);_0x574887[_0xfe34('0x3c')]=_[_0xfe34('0x35')](_0x574887[_0xfe34('0x33')],_0x574887[_0xfe34('0x31')]);_0x4bef1c['attributes']=_[_0xfe34('0x35')](_0x574887[_0xfe34('0x33')],qs[_0xfe34('0x36')](_0xd0f6fc[_0xfe34('0x31')]['fields']));_0x4bef1c[_0xfe34('0x34')]=_0x4bef1c[_0xfe34('0x34')]['length']?_0x4bef1c[_0xfe34('0x34')]:_0x574887[_0xfe34('0x33')];if(!_0xd0f6fc['query'][_0xfe34('0x38')]('nolimit')){_0x4bef1c['limit']=qs['limit'](_0xd0f6fc[_0xfe34('0x31')][_0xfe34('0x1e')]);_0x4bef1c[_0xfe34('0x1d')]=qs[_0xfe34('0x1d')](_0xd0f6fc[_0xfe34('0x31')]['offset']);}_0x4bef1c[_0xfe34('0x3a')]=qs['sort'](_0xd0f6fc[_0xfe34('0x31')][_0xfe34('0x3b')]);_0x4bef1c[_0xfe34('0x3e')]=qs[_0xfe34('0x3c')](_[_0xfe34('0x55')](_0xd0f6fc[_0xfe34('0x31')],_0x574887[_0xfe34('0x3c')]));_0x4bef1c[_0xfe34('0x3e')]['MailQueueId']=_0x4daf0f['id'];if(_0xd0f6fc['query'][_0xfe34('0x3d')]){_0x4bef1c[_0xfe34('0x3e')]=_[_0xfe34('0x3f')](_0x4bef1c[_0xfe34('0x3e')],{'$or':_['map'](_0x4bef1c[_0xfe34('0x34')],function(_0x2b05dd){var _0x245b1f={};_0x245b1f[_0x2b05dd]={'$like':'%'+_0xd0f6fc[_0xfe34('0x31')][_0xfe34('0x3d')]+'%'};return _0x245b1f;})});}_0x4bef1c=_[_0xfe34('0x3f')]({},_0x4bef1c,_0xd0f6fc[_0xfe34('0x40')]);return db[_0xfe34('0x54')]['findAll'](_0x4bef1c);}})[_0xfe34('0x25')](function(_0x54a8bf){if(_0x54a8bf){return db[_0xfe34('0x56')][_0xfe34('0x57')]({'where':{'id':_['map'](_0x54a8bf,_0xfe34('0x58')),'role':'agent'},'attributes':['id',_0xfe34('0x29'),_0xfe34('0x59'),_0xfe34('0x5a'),_0xfe34('0x5b')]});}})[_0xfe34('0x25')](function(_0x1243d4){if(_0x1243d4){return{'count':_0x1243d4[_0xfe34('0x1c')],'rows':_['map'](_0x1243d4[_0xfe34('0x5c')],function(_0x5d8050){return{'membername':_0x5d8050[_0xfe34('0x29')],'UserId':_0x5d8050['id'],'queue_name':_0x313151['name'],'MailQueueId':_0x313151['id'],'interface':util['format'](_0xfe34('0x5d'),_0xfe34('0x5e'),_0x5d8050[_0xfe34('0x29')]),'penalty':0x0,'paused':_0x5d8050[_0xfe34('0x59')],'createdAt':_0x5d8050[_0xfe34('0x5b')],'updatedAt':_0x5d8050[_0xfe34('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfe34('0x25')](respondWithFilteredResult(_0x249e9a,_0x4bef1c))[_0xfe34('0x45')](handleError(_0x249e9a,null));};exports[_0xfe34('0x5f')]=function(_0x1c41be,_0x3c8a09,_0x242174){var _0x360654={};var _0x5e76dd={};var _0x848c6c;var _0x1eabc3;return db[_0xfe34('0x2d')][_0xfe34('0x53')]({'where':{'id':_0x1c41be[_0xfe34('0x44')]['id']}})[_0xfe34('0x25')](handleEntityNotFound(_0x3c8a09,null))[_0xfe34('0x25')](function(_0x3e2506){if(_0x3e2506){_0x848c6c=_0x3e2506;_0x5e76dd['model']=_[_0xfe34('0x32')](db[_0xfe34('0x60')][_0xfe34('0x2e')]);_0x5e76dd[_0xfe34('0x31')]=_[_0xfe34('0x32')](_0x1c41be[_0xfe34('0x31')]);_0x5e76dd['filters']=_[_0xfe34('0x35')](_0x5e76dd[_0xfe34('0x33')],_0x5e76dd['query']);_0x360654[_0xfe34('0x34')]=_[_0xfe34('0x35')](_0x5e76dd[_0xfe34('0x33')],qs[_0xfe34('0x36')](_0x1c41be['query'][_0xfe34('0x36')]));_0x360654[_0xfe34('0x34')]=_0x360654[_0xfe34('0x34')][_0xfe34('0x37')]?_0x360654['attributes']:_0x5e76dd['model'];_0x360654[_0xfe34('0x3a')]=qs[_0xfe34('0x3b')](_0x1c41be[_0xfe34('0x31')]['sort']);_0x360654[_0xfe34('0x3e')]=qs[_0xfe34('0x3c')](_['pick'](_0x1c41be['query'],_0x5e76dd[_0xfe34('0x3c')]));if(_0x1c41be[_0xfe34('0x31')][_0xfe34('0x3d')]){_0x360654[_0xfe34('0x3e')]=_[_0xfe34('0x3f')](_0x360654[_0xfe34('0x3e')],{'$or':_[_0xfe34('0x2c')](_0x360654[_0xfe34('0x34')],function(_0x18b829){var _0x4a9250={};_0x4a9250[_0x18b829]={'$like':'%'+_0x1c41be[_0xfe34('0x31')][_0xfe34('0x3d')]+'%'};return _0x4a9250;})});}_0x360654=_[_0xfe34('0x3f')]({},_0x360654,_0x1c41be[_0xfe34('0x40')]);return _0x848c6c[_0xfe34('0x5f')](_0x360654);}})['then'](function(_0x3ecc10){if(_0x3ecc10){_0x1eabc3=_0x3ecc10[_0xfe34('0x37')];if(!_0x1c41be[_0xfe34('0x31')][_0xfe34('0x38')](_0xfe34('0x39'))){_0x360654['limit']=qs[_0xfe34('0x1e')](_0x1c41be[_0xfe34('0x31')]['limit']);_0x360654['offset']=qs[_0xfe34('0x1d')](_0x1c41be[_0xfe34('0x31')][_0xfe34('0x1d')]);}return _0x848c6c[_0xfe34('0x5f')](_0x360654);}})[_0xfe34('0x25')](function(_0x10e640){if(_0x10e640){return _0x10e640?{'count':_0x1eabc3,'rows':_0x10e640}:null;}})['then'](respondWithResult(_0x3c8a09,null))['catch'](handleError(_0x3c8a09,null));};exports[_0xfe34('0x61')]=function(_0x1bd678,_0x215a8f,_0x166e48){var _0x3c9aaf=_0x1bd678['body'][_0xfe34('0x62')];return db[_0xfe34('0x60')][_0xfe34('0x63')]({'where':{'id':_0x3c9aaf},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfe34('0x64'),'attributes':['id',_0xfe34('0x29'),'online',_0xfe34('0x65'),_0xfe34('0x66')],'raw':!![]}]})[_0xfe34('0x25')](function(_0x5699a8){if(_0x5699a8){var _0x2c40a1=_[_0xfe34('0x67')](_0x5699a8,function(_0xfd92ad){var _0x48e58f=_0xfd92ad['get']({'plain':!![]});return _0x48e58f['Agents'];});return db['MailQueue'][_0xfe34('0x4c')]({'where':{'id':_0x1bd678['params']['id']}})[_0xfe34('0x25')](function(_0x448bff){return db[_0xfe34('0x68')]['transaction'](function(_0x4a8faf){return _0x448bff[_0xfe34('0x61')](_0x3c9aaf,{'transaction':_0x4a8faf})[_0xfe34('0x25')](function(){return BPromise[_0xfe34('0x69')](_0x2c40a1,function(_0x2819d9){return db[_0xfe34('0x54')][_0xfe34('0x6a')]({'where':{'UserId':_0x2819d9['id'],'MailQueueId':_0x1bd678[_0xfe34('0x44')]['id']},'transaction':_0x4a8faf});});})[_0xfe34('0x25')](function(){_0x2c40a1['forEach'](function(_0x32a7fe){socket[_0xfe34('0x6b')](_0xfe34('0x6c'),{'UserId':_0x32a7fe['id'],'MailQueueId':_0x448bff['id']});});});});});}})[_0xfe34('0x25')](respondWithStatusCode(_0x215a8f,null))[_0xfe34('0x45')](handleError(_0x215a8f,null));};exports[_0xfe34('0x6d')]=function(_0x670d24,_0x2d802e,_0x22fa7f){return db[_0xfe34('0x60')]['findAll']({'where':{'id':_0x670d24['query'][_0xfe34('0x62')]},'attributes':['id'],'include':[{'model':db[_0xfe34('0x56')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfe34('0x25')](handleEntityNotFound(_0x2d802e,null))['then'](function(_0x4c3d12){var _0x501c4a=_['map'](_0x4c3d12,'id');var _0x4482db=[];var _0x5949ed=[];var _0x33026e=squel[_0xfe34('0x6e')]();_0x33026e[_0xfe34('0x6f')](_0xfe34('0x70'))[_0xfe34('0x71')](_0xfe34('0x72'),'tq')[_0xfe34('0x73')]('user_has_teams','ut',_0xfe34('0x74'))['where']('MailQueueId\x20=\x20?',_0x670d24[_0xfe34('0x44')]['id']);for(var _0x457a58=0x0;_0x457a58<_0x4c3d12[_0xfe34('0x37')];_0x457a58+=0x1){let _0x1ea241=_0x4c3d12[_0x457a58];for(var _0x4863ef=0x0;_0x4863ef<_0x1ea241[_0xfe34('0x64')][_0xfe34('0x37')];_0x4863ef+=0x1){let _0x1a6404=_0x1ea241['Agents'][_0x4863ef];var _0x46980f=_0x33026e[_0xfe34('0x75')]();_0x46980f[_0xfe34('0x3e')](_0xfe34('0x76'),_0x1a6404['id']);_0x5949ed['push'](db[_0xfe34('0x68')][_0xfe34('0x31')](_0x46980f[_0xfe34('0x77')](),{'type':db[_0xfe34('0x68')][_0xfe34('0x78')][_0xfe34('0x79')]})[_0xfe34('0x25')](function(_0x356f0d){if(_0x356f0d[_0xfe34('0x37')]===0x1){return _0x1a6404['id'];}else{var _0x4bc336=_[_0xfe34('0x7a')](_[_0xfe34('0x2c')](_0x356f0d,'TeamId'),function(_0x334d48){return _['includes'](_0x501c4a,_0x334d48);});if(_0x4bc336){return _0x1a6404['id'];}}}));}}return BPromise['all'](_0x5949ed)['then'](function(_0x1ccc67){_0x4482db=_(_0x4482db)[_0xfe34('0x7b')](_0x1ccc67)[_0xfe34('0x7c')]()[_0xfe34('0x7d')]();return db[_0xfe34('0x2d')][_0xfe34('0x4c')]({'where':{'id':_0x670d24['params']['id']}})['then'](function(_0x336e9f){return db['sequelize'][_0xfe34('0x7e')](function(_0x3d8f4c){return _0x336e9f[_0xfe34('0x6d')](_0x670d24[_0xfe34('0x31')][_0xfe34('0x62')],{'transaction':_0x3d8f4c})[_0xfe34('0x25')](function(){if(!_[_0xfe34('0x7f')](_0x4482db)){return _0x336e9f[_0xfe34('0x80')](_0x4482db,{'transaction':_0x3d8f4c});}})['then'](function(){_0x4482db[_0xfe34('0x81')](function(_0x3981a8){socket[_0xfe34('0x6b')]('userMailQueue:remove',{'UserId':_0x3981a8,'MailQueueId':_0x336e9f['id']});});});});});});})[_0xfe34('0x25')](respondWithStatusCode(_0x2d802e,null))['catch'](handleError(_0x2d802e,null));};exports['addAgents']=function(_0xcd28b8,_0x3ea5f1,_0x27aad3){return db['MailQueue'][_0xfe34('0x4c')]({'where':{'id':_0xcd28b8[_0xfe34('0x44')]['id']}})['then'](handleEntityNotFound(_0x3ea5f1,null))[_0xfe34('0x25')](function(_0x981af3){if(_0x981af3){return _0x981af3['addAgents'](_0xcd28b8[_0xfe34('0x46')]['ids'],_[_0xfe34('0x82')](_0xcd28b8['body'],[_0xfe34('0x62'),'id'])||{})[_0xfe34('0x83')](function(_0x1168bd){for(var _0x4daca7=0x0;_0x4daca7<_0xcd28b8[_0xfe34('0x46')][_0xfe34('0x62')][_0xfe34('0x37')];_0x4daca7+=0x1){socket['emit'](_0xfe34('0x6c'),{'UserId':_0xcd28b8[_0xfe34('0x46')][_0xfe34('0x62')][_0x4daca7],'MailQueueId':_0xcd28b8[_0xfe34('0x44')]['id']});}return _0x1168bd;});}})[_0xfe34('0x25')](respondWithResult(_0x3ea5f1,null))[_0xfe34('0x45')](handleError(_0x3ea5f1,null));};exports[_0xfe34('0x80')]=function(_0x6a5250,_0xf7b297,_0x21de86){return db[_0xfe34('0x2d')][_0xfe34('0x4c')]({'where':{'id':_0x6a5250[_0xfe34('0x44')]['id']}})[_0xfe34('0x25')](handleEntityNotFound(_0xf7b297,null))['then'](function(_0x2061a6){if(_0x2061a6){return _0x2061a6['removeAgents'](_0x6a5250[_0xfe34('0x31')][_0xfe34('0x62')])[_0xfe34('0x25')](function(){if(_['isArray'](_0x6a5250[_0xfe34('0x31')][_0xfe34('0x62')])){for(var _0x58b586=0x0;_0x58b586<_0x6a5250['query'][_0xfe34('0x62')][_0xfe34('0x37')];_0x58b586+=0x1){socket[_0xfe34('0x6b')](_0xfe34('0x84'),{'UserId':Number(_0x6a5250['query'][_0xfe34('0x62')][_0x58b586]),'MailQueueId':Number(_0x6a5250['params']['id'])});}}else{socket[_0xfe34('0x6b')](_0xfe34('0x84'),{'UserId':Number(_0x6a5250[_0xfe34('0x31')]['ids']),'MailQueueId':Number(_0x6a5250['params']['id'])});}});}})[_0xfe34('0x25')](respondWithStatusCode(_0xf7b297,null))[_0xfe34('0x45')](handleError(_0xf7b297,null));};exports[_0xfe34('0x85')]=function(_0x271586,_0x313b10,_0x3e1fb1){var _0x5a9b9b={};var _0xe15f6f={};var _0x432fb8;var _0x56d66d;return db[_0xfe34('0x2d')][_0xfe34('0x53')]({'where':{'id':_0x271586[_0xfe34('0x44')]['id']}})['then'](handleEntityNotFound(_0x313b10,null))['then'](function(_0x1e2cd){if(_0x1e2cd){_0x432fb8=_0x1e2cd;_0xe15f6f['model']=_[_0xfe34('0x32')](db['User'][_0xfe34('0x2e')]);_0xe15f6f[_0xfe34('0x31')]=_[_0xfe34('0x32')](_0x271586[_0xfe34('0x31')]);_0xe15f6f[_0xfe34('0x3c')]=_['intersection'](_0xe15f6f['model'],_0xe15f6f[_0xfe34('0x31')]);_0x5a9b9b[_0xfe34('0x34')]=_[_0xfe34('0x35')](_0xe15f6f[_0xfe34('0x33')],qs['fields'](_0x271586['query'][_0xfe34('0x36')]));_0x5a9b9b[_0xfe34('0x34')]=_0x5a9b9b[_0xfe34('0x34')]['length']?_0x5a9b9b[_0xfe34('0x34')]:_0xe15f6f[_0xfe34('0x33')];_0x5a9b9b[_0xfe34('0x3a')]=qs['sort'](_0x271586[_0xfe34('0x31')][_0xfe34('0x3b')]);_0x5a9b9b[_0xfe34('0x3e')]=qs[_0xfe34('0x3c')](_[_0xfe34('0x55')](_0x271586[_0xfe34('0x31')],_0xe15f6f['filters']));if(_0x271586[_0xfe34('0x31')][_0xfe34('0x3d')]){_0x5a9b9b[_0xfe34('0x3e')]=_[_0xfe34('0x3f')](_0x5a9b9b['where'],{'$or':_['map'](_0x5a9b9b['attributes'],function(_0x1e7637){var _0x1f5689={};_0x1f5689[_0x1e7637]={'$like':'%'+_0x271586[_0xfe34('0x31')]['filter']+'%'};return _0x1f5689;})});}_0x5a9b9b=_[_0xfe34('0x3f')]({},_0x5a9b9b,_0x271586[_0xfe34('0x40')]);return _0x432fb8[_0xfe34('0x85')](_0x5a9b9b);}})['then'](function(_0x598e5e){if(_0x598e5e){_0x56d66d=_0x598e5e[_0xfe34('0x37')];if(!_0x271586['query'][_0xfe34('0x38')](_0xfe34('0x39'))){_0x5a9b9b[_0xfe34('0x1e')]=qs[_0xfe34('0x1e')](_0x271586[_0xfe34('0x31')][_0xfe34('0x1e')]);_0x5a9b9b[_0xfe34('0x1d')]=qs[_0xfe34('0x1d')](_0x271586[_0xfe34('0x31')][_0xfe34('0x1d')]);}return _0x432fb8[_0xfe34('0x85')](_0x5a9b9b);}})[_0xfe34('0x25')](function(_0x53c6b8){if(_0x53c6b8){return _0x53c6b8?{'count':_0x56d66d,'rows':_0x53c6b8}:null;}})[_0xfe34('0x25')](respondWithResult(_0x313b10,null))[_0xfe34('0x45')](handleError(_0x313b10,null));}; \ No newline at end of file +var _0x5464=['length','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','order','pick','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','each','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','every','TeamId','all','value','transaction','isEmpty','userMailQueue:remove','addAgents','spread','removeAgents','isArray','emit','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','MailQueues','UserProfileResource','stack','name','send','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','nolimit','sort','where','merge','VIRTUAL','filter','MailQueue','includeAll','include','findAll','rows','catch','show','params','keys'];(function(_0x5202ac,_0x4ca95a){var _0x27069a=function(_0x72923e){while(--_0x72923e){_0x5202ac['push'](_0x5202ac['shift']());}};_0x27069a(++_0x4ca95a);}(_0x5464,0x15d));var _0x4546=function(_0x168b93,_0x5bfe66){_0x168b93=_0x168b93-0x0;var _0x4d5ce8=_0x5464[_0x168b93];return _0x4d5ce8;};'use strict';var pdf=require(_0x4546('0x0'));var emlformat=require(_0x4546('0x1'));var rimraf=require(_0x4546('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4546('0x3'));var rp=require('request-promise');var moment=require(_0x4546('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4546('0x5'));var util=require(_0x4546('0x6'));var path=require(_0x4546('0x7'));var sox=require(_0x4546('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4546('0x9'));var crypto=require(_0x4546('0xa'));var jsforce=require(_0x4546('0xb'));var deskjs=require(_0x4546('0xc'));var toCsv=require(_0x4546('0xd'));var querystring=require(_0x4546('0xe'));var Papa=require(_0x4546('0xf'));var Redis=require(_0x4546('0x10'));var authService=require(_0x4546('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4546('0x12'));var hardwareService=require(_0x4546('0x13'));var logger=require(_0x4546('0x14'))('api');var utils=require(_0x4546('0x15'));var config=require(_0x4546('0x16'));var licenseUtil=require(_0x4546('0x17'));var db=require(_0x4546('0x18'))['db'];config['redis']=_['defaults'](config[_0x4546('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x4f5571,_0x102180){_0x102180=_0x102180||0xcc;return function(_0x51e279){if(_0x51e279){return _0x4f5571[_0x4546('0x1a')](_0x102180);}return _0x4f5571['status'](_0x102180)[_0x4546('0x1b')]();};}function respondWithResult(_0x564f3e,_0x3741f2){_0x3741f2=_0x3741f2||0xc8;return function(_0x18bc09){if(_0x18bc09){return _0x564f3e[_0x4546('0x1c')](_0x3741f2)[_0x4546('0x1d')](_0x18bc09);}};}function respondWithFilteredResult(_0x2a294b,_0x15e09e){return function(_0x57d8de){if(_0x57d8de){var _0x4ffd6b=_0x57d8de[_0x4546('0x1e')],_0x5780a7=_0x15e09e[_0x4546('0x1f')],_0x330235=_0x15e09e[_0x4546('0x1f')]+_0x15e09e[_0x4546('0x20')],_0x39f552;if(_0x330235>=_0x4ffd6b){_0x330235=_0x4ffd6b;_0x39f552=0xc8;}else{_0x39f552=0xce;}_0x2a294b[_0x4546('0x1c')](_0x39f552);return _0x2a294b[_0x4546('0x21')](_0x4546('0x22'),_0x5780a7+'-'+_0x330235+'/'+_0x4ffd6b)[_0x4546('0x1d')](_0x57d8de);}return null;};}function patchUpdates(_0x57d740){return function(_0x2d689f){try{jsonpatch[_0x4546('0x23')](_0x2d689f,_0x57d740,!![]);}catch(_0x52447c){return BPromise[_0x4546('0x24')](_0x52447c);}return _0x2d689f[_0x4546('0x25')]();};}function saveUpdates(_0x1a1984,_0x2f065d){return function(_0xc2997d){if(_0xc2997d){return _0xc2997d[_0x4546('0x26')](_0x1a1984)['then'](function(_0x3dab5c){return _0x3dab5c;});}return null;};}function removeEntity(_0x2cca8b,_0x4f9fcf){return function(_0x824698){if(_0x824698){return _0x824698[_0x4546('0x27')]()[_0x4546('0x28')](function(){var _0x4467ee=_0x824698[_0x4546('0x29')]({'plain':!![]});var _0x53ae5e=_0x4546('0x2a');return db[_0x4546('0x2b')][_0x4546('0x27')]({'where':{'type':_0x53ae5e,'resourceId':_0x4467ee['id']}})['then'](function(){return _0x824698;});})['then'](function(){_0x2cca8b[_0x4546('0x1c')](0xcc)[_0x4546('0x1b')]();});}};}function handleEntityNotFound(_0x15611c,_0x114963){return function(_0x29a3f0){if(!_0x29a3f0){_0x15611c[_0x4546('0x1a')](0x194);}return _0x29a3f0;};}function handleError(_0xcea7da,_0x586ff1){_0x586ff1=_0x586ff1||0x1f4;return function(_0x367b23){logger['error'](_0x367b23[_0x4546('0x2c')]);if(_0x367b23[_0x4546('0x2d')]){delete _0x367b23['name'];}_0xcea7da['status'](_0x586ff1)[_0x4546('0x2e')](_0x367b23);};}exports['index']=function(_0x3c7c7d,_0x58b69){var _0x480d8e={},_0x5f0226={},_0x1d20fc={'count':0x0,'rows':[]};var _0x3b673f=_[_0x4546('0x2f')](db['MailQueue'][_0x4546('0x30')],function(_0x2c8e44){return{'name':_0x2c8e44['fieldName'],'type':_0x2c8e44[_0x4546('0x31')]['key']};});_0x5f0226[_0x4546('0x32')]=_[_0x4546('0x2f')](_0x3b673f,_0x4546('0x2d'));_0x5f0226[_0x4546('0x33')]=_['keys'](_0x3c7c7d[_0x4546('0x33')]);_0x5f0226[_0x4546('0x34')]=_[_0x4546('0x35')](_0x5f0226[_0x4546('0x32')],_0x5f0226[_0x4546('0x33')]);_0x480d8e[_0x4546('0x36')]=_['intersection'](_0x5f0226[_0x4546('0x32')],qs[_0x4546('0x37')](_0x3c7c7d['query']['fields']));_0x480d8e[_0x4546('0x36')]=_0x480d8e[_0x4546('0x36')]['length']?_0x480d8e[_0x4546('0x36')]:_0x5f0226[_0x4546('0x32')];if(!_0x3c7c7d['query']['hasOwnProperty'](_0x4546('0x38'))){_0x480d8e[_0x4546('0x20')]=qs[_0x4546('0x20')](_0x3c7c7d[_0x4546('0x33')][_0x4546('0x20')]);_0x480d8e[_0x4546('0x1f')]=qs['offset'](_0x3c7c7d[_0x4546('0x33')][_0x4546('0x1f')]);}_0x480d8e['order']=qs[_0x4546('0x39')](_0x3c7c7d['query'][_0x4546('0x39')]);_0x480d8e[_0x4546('0x3a')]=qs['filters'](_['pick'](_0x3c7c7d[_0x4546('0x33')],_0x5f0226[_0x4546('0x34')]),_0x3b673f);if(_0x3c7c7d[_0x4546('0x33')]['filter']){_0x480d8e[_0x4546('0x3a')]=_[_0x4546('0x3b')](_0x480d8e[_0x4546('0x3a')],{'$or':_[_0x4546('0x2f')](_0x3b673f,function(_0x30649f){if(_0x30649f[_0x4546('0x31')]!==_0x4546('0x3c')){var _0xd589c5={};_0xd589c5[_0x30649f['name']]={'$like':'%'+_0x3c7c7d[_0x4546('0x33')][_0x4546('0x3d')]+'%'};return _0xd589c5;}})});}_0x480d8e=_['merge']({},_0x480d8e,_0x3c7c7d['options']);var _0x3bafee={'where':_0x480d8e[_0x4546('0x3a')]};return db[_0x4546('0x3e')][_0x4546('0x1e')](_0x3bafee)[_0x4546('0x28')](function(_0x482f29){_0x1d20fc[_0x4546('0x1e')]=_0x482f29;if(_0x3c7c7d[_0x4546('0x33')][_0x4546('0x3f')]){_0x480d8e[_0x4546('0x40')]=[{'all':!![]}];}return db[_0x4546('0x3e')][_0x4546('0x41')](_0x480d8e);})[_0x4546('0x28')](function(_0x39b27a){_0x1d20fc[_0x4546('0x42')]=_0x39b27a;return _0x1d20fc;})['then'](respondWithFilteredResult(_0x58b69,_0x480d8e))[_0x4546('0x43')](handleError(_0x58b69,null));};exports[_0x4546('0x44')]=function(_0x3510e0,_0x35b51e){var _0x1c8b5f={'raw':!![],'where':{'id':_0x3510e0[_0x4546('0x45')]['id']}},_0x1f65a8={};_0x1f65a8[_0x4546('0x32')]=_[_0x4546('0x46')](db[_0x4546('0x3e')][_0x4546('0x30')]);_0x1f65a8['query']=_[_0x4546('0x46')](_0x3510e0[_0x4546('0x33')]);_0x1f65a8['filters']=_[_0x4546('0x35')](_0x1f65a8[_0x4546('0x32')],_0x1f65a8[_0x4546('0x33')]);_0x1c8b5f['attributes']=_[_0x4546('0x35')](_0x1f65a8[_0x4546('0x32')],qs[_0x4546('0x37')](_0x3510e0[_0x4546('0x33')][_0x4546('0x37')]));_0x1c8b5f[_0x4546('0x36')]=_0x1c8b5f[_0x4546('0x36')][_0x4546('0x47')]?_0x1c8b5f[_0x4546('0x36')]:_0x1f65a8[_0x4546('0x32')];if(_0x3510e0['query'][_0x4546('0x3f')]){_0x1c8b5f[_0x4546('0x40')]=[{'all':!![]}];}_0x1c8b5f=_['merge']({},_0x1c8b5f,_0x3510e0[_0x4546('0x48')]);return db[_0x4546('0x3e')][_0x4546('0x49')](_0x1c8b5f)[_0x4546('0x28')](handleEntityNotFound(_0x35b51e,null))['then'](respondWithResult(_0x35b51e,null))[_0x4546('0x43')](handleError(_0x35b51e,null));};exports['create']=function(_0x3b6781,_0x27406c){return db[_0x4546('0x3e')]['create'](_0x3b6781[_0x4546('0x4a')],{})[_0x4546('0x28')](function(_0x13f705){var _0xc8a1f3=_0x3b6781[_0x4546('0x4b')][_0x4546('0x29')]({'plain':!![]});if(!_0xc8a1f3)throw new Error(_0x4546('0x4c'));if(_0xc8a1f3[_0x4546('0x4d')]===_0x4546('0x4b')){var _0x369dc3=_0x13f705[_0x4546('0x29')]({'plain':!![]});var _0x49b0d8=_0x4546('0x2a');return db[_0x4546('0x4e')]['find']({'where':{'name':_0x49b0d8,'userProfileId':_0xc8a1f3[_0x4546('0x4f')]},'raw':!![]})[_0x4546('0x28')](function(_0xca0f44){if(_0xca0f44&&_0xca0f44['autoAssociation']===0x0){return db[_0x4546('0x2b')][_0x4546('0x50')]({'name':_0x369dc3[_0x4546('0x2d')],'resourceId':_0x369dc3['id'],'type':_0xca0f44[_0x4546('0x2d')],'sectionId':_0xca0f44['id']},{})[_0x4546('0x28')](function(){return _0x13f705;});}else{return _0x13f705;}})[_0x4546('0x43')](function(_0x2ca7d8){logger[_0x4546('0x51')](_0x4546('0x52'),_0x2ca7d8);throw _0x2ca7d8;});}return _0x13f705;})[_0x4546('0x28')](respondWithResult(_0x27406c,0xc9))[_0x4546('0x43')](handleError(_0x27406c,null));};exports[_0x4546('0x26')]=function(_0x3d6094,_0x145284){if(_0x3d6094[_0x4546('0x4a')]['id']){delete _0x3d6094[_0x4546('0x4a')]['id'];}return db['MailQueue'][_0x4546('0x49')]({'where':{'id':_0x3d6094[_0x4546('0x45')]['id']}})['then'](handleEntityNotFound(_0x145284,null))[_0x4546('0x28')](saveUpdates(_0x3d6094[_0x4546('0x4a')],null))[_0x4546('0x28')](respondWithResult(_0x145284,null))[_0x4546('0x43')](handleError(_0x145284,null));};exports['destroy']=function(_0x2d3b5b,_0x32248c){return db[_0x4546('0x3e')][_0x4546('0x49')]({'where':{'id':_0x2d3b5b[_0x4546('0x45')]['id']}})[_0x4546('0x28')](handleEntityNotFound(_0x32248c,null))[_0x4546('0x28')](removeEntity(_0x32248c,null))[_0x4546('0x43')](handleError(_0x32248c,null));};exports[_0x4546('0x53')]=function(_0xcf682c,_0x67f40d){return db['MailQueue'][_0x4546('0x53')]()[_0x4546('0x28')](respondWithResult(_0x67f40d,null))[_0x4546('0x43')](handleError(_0x67f40d,null));};exports[_0x4546('0x54')]=function(_0x4890b4,_0x37d128,_0x4a1a00){var _0x28238f={'raw':!![],'where':{}},_0x24e66c={},_0x44e28e;return db[_0x4546('0x3e')][_0x4546('0x55')]({'where':{'id':_0x4890b4['params']['id']}})[_0x4546('0x28')](handleEntityNotFound(_0x37d128,null))['then'](function(_0x340d25){if(_0x340d25){_0x44e28e=_0x340d25['get']({'plain':!![]});_0x24e66c['model']=_['keys'](db[_0x4546('0x56')]['rawAttributes']);_0x24e66c[_0x4546('0x33')]=_[_0x4546('0x46')](_0x4890b4[_0x4546('0x33')]);_0x24e66c[_0x4546('0x34')]=_['intersection'](_0x24e66c[_0x4546('0x32')],_0x24e66c[_0x4546('0x33')]);_0x28238f[_0x4546('0x36')]=_[_0x4546('0x35')](_0x24e66c[_0x4546('0x32')],qs['fields'](_0x4890b4[_0x4546('0x33')][_0x4546('0x37')]));_0x28238f[_0x4546('0x36')]=_0x28238f['attributes'][_0x4546('0x47')]?_0x28238f[_0x4546('0x36')]:_0x24e66c[_0x4546('0x32')];if(!_0x4890b4['query'][_0x4546('0x57')](_0x4546('0x38'))){_0x28238f[_0x4546('0x20')]=qs[_0x4546('0x20')](_0x4890b4[_0x4546('0x33')][_0x4546('0x20')]);_0x28238f[_0x4546('0x1f')]=qs[_0x4546('0x1f')](_0x4890b4['query'][_0x4546('0x1f')]);}_0x28238f[_0x4546('0x58')]=qs[_0x4546('0x39')](_0x4890b4[_0x4546('0x33')][_0x4546('0x39')]);_0x28238f[_0x4546('0x3a')]=qs[_0x4546('0x34')](_[_0x4546('0x59')](_0x4890b4[_0x4546('0x33')],_0x24e66c[_0x4546('0x34')]));_0x28238f[_0x4546('0x3a')][_0x4546('0x5a')]=_0x340d25['id'];if(_0x4890b4[_0x4546('0x33')][_0x4546('0x3d')]){_0x28238f[_0x4546('0x3a')]=_['merge'](_0x28238f[_0x4546('0x3a')],{'$or':_['map'](_0x28238f[_0x4546('0x36')],function(_0xb938f9){var _0x4a5bd4={};_0x4a5bd4[_0xb938f9]={'$like':'%'+_0x4890b4[_0x4546('0x33')][_0x4546('0x3d')]+'%'};return _0x4a5bd4;})});}_0x28238f=_[_0x4546('0x3b')]({},_0x28238f,_0x4890b4[_0x4546('0x48')]);return db[_0x4546('0x56')][_0x4546('0x41')](_0x28238f);}})[_0x4546('0x28')](function(_0x2eb8a7){if(_0x2eb8a7){return db[_0x4546('0x5b')][_0x4546('0x5c')]({'where':{'id':_[_0x4546('0x2f')](_0x2eb8a7,_0x4546('0x5d')),'role':_0x4546('0x5e')},'attributes':['id','name',_0x4546('0x5f'),_0x4546('0x60'),_0x4546('0x61')]});}})['then'](function(_0xb6e936){if(_0xb6e936){return{'count':_0xb6e936[_0x4546('0x1e')],'rows':_[_0x4546('0x2f')](_0xb6e936[_0x4546('0x42')],function(_0x1b687a){return{'membername':_0x1b687a[_0x4546('0x2d')],'UserId':_0x1b687a['id'],'queue_name':_0x44e28e[_0x4546('0x2d')],'MailQueueId':_0x44e28e['id'],'interface':util['format'](_0x4546('0x62'),_0x4546('0x63'),_0x1b687a[_0x4546('0x2d')]),'penalty':0x0,'paused':_0x1b687a['mailPause'],'createdAt':_0x1b687a['createdAt'],'updatedAt':_0x1b687a[_0x4546('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4546('0x28')](respondWithFilteredResult(_0x37d128,_0x28238f))['catch'](handleError(_0x37d128,null));};exports[_0x4546('0x64')]=function(_0xdcd804,_0x121e51,_0x11e2e4){var _0x5e17a2={};var _0x4551a8={};var _0x2be477;var _0x345c7e;return db[_0x4546('0x3e')][_0x4546('0x55')]({'where':{'id':_0xdcd804[_0x4546('0x45')]['id']}})[_0x4546('0x28')](handleEntityNotFound(_0x121e51,null))[_0x4546('0x28')](function(_0x5666a3){if(_0x5666a3){_0x2be477=_0x5666a3;_0x4551a8[_0x4546('0x32')]=_[_0x4546('0x46')](db['Team'][_0x4546('0x30')]);_0x4551a8[_0x4546('0x33')]=_['keys'](_0xdcd804[_0x4546('0x33')]);_0x4551a8[_0x4546('0x34')]=_[_0x4546('0x35')](_0x4551a8['model'],_0x4551a8[_0x4546('0x33')]);_0x5e17a2[_0x4546('0x36')]=_[_0x4546('0x35')](_0x4551a8[_0x4546('0x32')],qs[_0x4546('0x37')](_0xdcd804[_0x4546('0x33')][_0x4546('0x37')]));_0x5e17a2['attributes']=_0x5e17a2['attributes'][_0x4546('0x47')]?_0x5e17a2[_0x4546('0x36')]:_0x4551a8[_0x4546('0x32')];_0x5e17a2[_0x4546('0x58')]=qs[_0x4546('0x39')](_0xdcd804[_0x4546('0x33')]['sort']);_0x5e17a2['where']=qs[_0x4546('0x34')](_[_0x4546('0x59')](_0xdcd804[_0x4546('0x33')],_0x4551a8[_0x4546('0x34')]));if(_0xdcd804[_0x4546('0x33')][_0x4546('0x3d')]){_0x5e17a2[_0x4546('0x3a')]=_[_0x4546('0x3b')](_0x5e17a2['where'],{'$or':_[_0x4546('0x2f')](_0x5e17a2['attributes'],function(_0x1590fc){var _0x4be378={};_0x4be378[_0x1590fc]={'$like':'%'+_0xdcd804[_0x4546('0x33')]['filter']+'%'};return _0x4be378;})});}_0x5e17a2=_[_0x4546('0x3b')]({},_0x5e17a2,_0xdcd804[_0x4546('0x48')]);return _0x2be477[_0x4546('0x64')](_0x5e17a2);}})[_0x4546('0x28')](function(_0xb07ca1){if(_0xb07ca1){_0x345c7e=_0xb07ca1[_0x4546('0x47')];if(!_0xdcd804[_0x4546('0x33')][_0x4546('0x57')](_0x4546('0x38'))){_0x5e17a2[_0x4546('0x20')]=qs['limit'](_0xdcd804[_0x4546('0x33')][_0x4546('0x20')]);_0x5e17a2['offset']=qs[_0x4546('0x1f')](_0xdcd804[_0x4546('0x33')][_0x4546('0x1f')]);}return _0x2be477[_0x4546('0x64')](_0x5e17a2);}})['then'](function(_0x5d8a33){if(_0x5d8a33){return _0x5d8a33?{'count':_0x345c7e,'rows':_0x5d8a33}:null;}})[_0x4546('0x28')](respondWithResult(_0x121e51,null))[_0x4546('0x43')](handleError(_0x121e51,null));};exports[_0x4546('0x65')]=function(_0x1ee186,_0x2b48a9,_0x4a7588){var _0x4ba66=_0x1ee186[_0x4546('0x4a')][_0x4546('0x66')];return db[_0x4546('0x67')][_0x4546('0x41')]({'where':{'id':_0x4ba66},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4546('0x68'),'attributes':['id','name',_0x4546('0x69'),_0x4546('0x6a'),_0x4546('0x6b')],'raw':!![]}]})[_0x4546('0x28')](function(_0x29e6e3){if(_0x29e6e3){var _0x19ff9b=_[_0x4546('0x6c')](_0x29e6e3,function(_0x210712){var _0x534f82=_0x210712[_0x4546('0x29')]({'plain':!![]});return _0x534f82[_0x4546('0x68')];});return db[_0x4546('0x3e')][_0x4546('0x49')]({'where':{'id':_0x1ee186[_0x4546('0x45')]['id']}})['then'](function(_0x39fbe2){return db['sequelize']['transaction'](function(_0x4c9e0b){return _0x39fbe2[_0x4546('0x65')](_0x4ba66,{'transaction':_0x4c9e0b})[_0x4546('0x28')](function(){return BPromise[_0x4546('0x6d')](_0x19ff9b,function(_0x13a29b){return db[_0x4546('0x56')][_0x4546('0x6e')]({'where':{'UserId':_0x13a29b['id'],'MailQueueId':_0x1ee186[_0x4546('0x45')]['id']},'transaction':_0x4c9e0b});});})[_0x4546('0x28')](function(){_0x19ff9b[_0x4546('0x6f')](function(_0x2df3d5){socket['emit'](_0x4546('0x70'),{'UserId':_0x2df3d5['id'],'MailQueueId':_0x39fbe2['id']});});});});});}})['then'](respondWithStatusCode(_0x2b48a9,null))[_0x4546('0x43')](handleError(_0x2b48a9,null));};exports[_0x4546('0x71')]=function(_0x3dbafd,_0x2d7999,_0xd25922){return db[_0x4546('0x67')][_0x4546('0x41')]({'where':{'id':_0x3dbafd['query'][_0x4546('0x66')]},'attributes':['id'],'include':[{'model':db[_0x4546('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4546('0x28')](handleEntityNotFound(_0x2d7999,null))[_0x4546('0x28')](function(_0xdb5b37){var _0x235f2d=_[_0x4546('0x2f')](_0xdb5b37,'id');var _0x2a9010=[];var _0x210d6d=[];var _0x23e34d=squel[_0x4546('0x72')]();_0x23e34d[_0x4546('0x73')](_0x4546('0x74'))[_0x4546('0x75')]('team_has_mail_queues','tq')[_0x4546('0x76')](_0x4546('0x77'),'ut',_0x4546('0x78'))[_0x4546('0x3a')](_0x4546('0x79'),_0x3dbafd[_0x4546('0x45')]['id']);for(var _0x3cc86c=0x0;_0x3cc86c<_0xdb5b37[_0x4546('0x47')];_0x3cc86c+=0x1){let _0x3855e9=_0xdb5b37[_0x3cc86c];for(var _0x27e99e=0x0;_0x27e99e<_0x3855e9[_0x4546('0x68')][_0x4546('0x47')];_0x27e99e+=0x1){let _0x3a5663=_0x3855e9[_0x4546('0x68')][_0x27e99e];var _0x1ebc4d=_0x23e34d[_0x4546('0x7a')]();_0x1ebc4d[_0x4546('0x3a')](_0x4546('0x7b'),_0x3a5663['id']);_0x210d6d[_0x4546('0x7c')](db[_0x4546('0x7d')][_0x4546('0x33')](_0x1ebc4d[_0x4546('0x7e')](),{'type':db[_0x4546('0x7d')]['QueryTypes']['SELECT']})[_0x4546('0x28')](function(_0x509745){if(_0x509745[_0x4546('0x47')]===0x1){return _0x3a5663['id'];}else{var _0x3ce918=_[_0x4546('0x7f')](_['map'](_0x509745,_0x4546('0x80')),function(_0x55010f){return _['includes'](_0x235f2d,_0x55010f);});if(_0x3ce918){return _0x3a5663['id'];}}}));}}return BPromise[_0x4546('0x81')](_0x210d6d)[_0x4546('0x28')](function(_0xad28f5){_0x2a9010=_(_0x2a9010)['union'](_0xad28f5)['compact']()[_0x4546('0x82')]();return db[_0x4546('0x3e')]['find']({'where':{'id':_0x3dbafd[_0x4546('0x45')]['id']}})[_0x4546('0x28')](function(_0x7157e6){return db[_0x4546('0x7d')][_0x4546('0x83')](function(_0x65a6a4){return _0x7157e6[_0x4546('0x71')](_0x3dbafd['query'][_0x4546('0x66')],{'transaction':_0x65a6a4})['then'](function(){if(!_[_0x4546('0x84')](_0x2a9010)){return _0x7157e6['removeAgents'](_0x2a9010,{'transaction':_0x65a6a4});}})['then'](function(){_0x2a9010[_0x4546('0x6f')](function(_0x4ceebf){socket['emit'](_0x4546('0x85'),{'UserId':_0x4ceebf,'MailQueueId':_0x7157e6['id']});});});});});});})[_0x4546('0x28')](respondWithStatusCode(_0x2d7999,null))[_0x4546('0x43')](handleError(_0x2d7999,null));};exports[_0x4546('0x86')]=function(_0x274341,_0x899186,_0x2b6b26){return db['MailQueue'][_0x4546('0x49')]({'where':{'id':_0x274341['params']['id']}})[_0x4546('0x28')](handleEntityNotFound(_0x899186,null))[_0x4546('0x28')](function(_0x24798b){if(_0x24798b){return _0x24798b[_0x4546('0x86')](_0x274341[_0x4546('0x4a')][_0x4546('0x66')],_['omit'](_0x274341[_0x4546('0x4a')],[_0x4546('0x66'),'id'])||{})[_0x4546('0x87')](function(_0xc0771c){for(var _0x53c40c=0x0;_0x53c40c<_0x274341[_0x4546('0x4a')][_0x4546('0x66')][_0x4546('0x47')];_0x53c40c+=0x1){socket['emit']('userMailQueue:save',{'UserId':_0x274341['body'][_0x4546('0x66')][_0x53c40c],'MailQueueId':_0x274341['params']['id']});}return _0xc0771c;});}})[_0x4546('0x28')](respondWithResult(_0x899186,null))['catch'](handleError(_0x899186,null));};exports[_0x4546('0x88')]=function(_0x55ec89,_0x43c37a,_0x645df3){return db['MailQueue'][_0x4546('0x49')]({'where':{'id':_0x55ec89['params']['id']}})[_0x4546('0x28')](handleEntityNotFound(_0x43c37a,null))[_0x4546('0x28')](function(_0x461231){if(_0x461231){return _0x461231[_0x4546('0x88')](_0x55ec89[_0x4546('0x33')]['ids'])[_0x4546('0x28')](function(){if(_[_0x4546('0x89')](_0x55ec89[_0x4546('0x33')][_0x4546('0x66')])){for(var _0x1b6f26=0x0;_0x1b6f26<_0x55ec89['query'][_0x4546('0x66')][_0x4546('0x47')];_0x1b6f26+=0x1){socket[_0x4546('0x8a')](_0x4546('0x85'),{'UserId':Number(_0x55ec89[_0x4546('0x33')][_0x4546('0x66')][_0x1b6f26]),'MailQueueId':Number(_0x55ec89['params']['id'])});}}else{socket['emit'](_0x4546('0x85'),{'UserId':Number(_0x55ec89[_0x4546('0x33')][_0x4546('0x66')]),'MailQueueId':Number(_0x55ec89[_0x4546('0x45')]['id'])});}});}})[_0x4546('0x28')](respondWithStatusCode(_0x43c37a,null))['catch'](handleError(_0x43c37a,null));};exports['getAgents']=function(_0x7f8632,_0x2c54ee,_0x697259){var _0x228e87={};var _0x1470c2={};var _0x18f264;var _0x93d675;return db[_0x4546('0x3e')][_0x4546('0x55')]({'where':{'id':_0x7f8632[_0x4546('0x45')]['id']}})[_0x4546('0x28')](handleEntityNotFound(_0x2c54ee,null))['then'](function(_0x4c1118){if(_0x4c1118){_0x18f264=_0x4c1118;_0x1470c2[_0x4546('0x32')]=_['keys'](db[_0x4546('0x5b')]['rawAttributes']);_0x1470c2['query']=_['keys'](_0x7f8632[_0x4546('0x33')]);_0x1470c2[_0x4546('0x34')]=_[_0x4546('0x35')](_0x1470c2[_0x4546('0x32')],_0x1470c2[_0x4546('0x33')]);_0x228e87['attributes']=_[_0x4546('0x35')](_0x1470c2[_0x4546('0x32')],qs[_0x4546('0x37')](_0x7f8632[_0x4546('0x33')][_0x4546('0x37')]));_0x228e87[_0x4546('0x36')]=_0x228e87[_0x4546('0x36')][_0x4546('0x47')]?_0x228e87[_0x4546('0x36')]:_0x1470c2[_0x4546('0x32')];_0x228e87['order']=qs[_0x4546('0x39')](_0x7f8632[_0x4546('0x33')]['sort']);_0x228e87['where']=qs[_0x4546('0x34')](_[_0x4546('0x59')](_0x7f8632['query'],_0x1470c2[_0x4546('0x34')]));if(_0x7f8632['query']['filter']){_0x228e87['where']=_[_0x4546('0x3b')](_0x228e87[_0x4546('0x3a')],{'$or':_['map'](_0x228e87[_0x4546('0x36')],function(_0x218edc){var _0x1bb34e={};_0x1bb34e[_0x218edc]={'$like':'%'+_0x7f8632[_0x4546('0x33')]['filter']+'%'};return _0x1bb34e;})});}_0x228e87=_[_0x4546('0x3b')]({},_0x228e87,_0x7f8632[_0x4546('0x48')]);return _0x18f264[_0x4546('0x8b')](_0x228e87);}})[_0x4546('0x28')](function(_0x10e2a3){if(_0x10e2a3){_0x93d675=_0x10e2a3[_0x4546('0x47')];if(!_0x7f8632['query'][_0x4546('0x57')]('nolimit')){_0x228e87['limit']=qs[_0x4546('0x20')](_0x7f8632['query'][_0x4546('0x20')]);_0x228e87[_0x4546('0x1f')]=qs[_0x4546('0x1f')](_0x7f8632[_0x4546('0x33')][_0x4546('0x1f')]);}return _0x18f264['getAgents'](_0x228e87);}})[_0x4546('0x28')](function(_0x3e9c0a){if(_0x3e9c0a){return _0x3e9c0a?{'count':_0x93d675,'rows':_0x3e9c0a}:null;}})['then'](respondWithResult(_0x2c54ee,null))[_0x4546('0x43')](handleError(_0x2c54ee,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 5495572..9678be8 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 _0xbc41=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','save','update'];(function(_0x598732,_0x9809dc){var _0x151939=function(_0xc75885){while(--_0xc75885){_0x598732['push'](_0x598732['shift']());}};_0x151939(++_0x9809dc);}(_0xbc41,0x1d1));var _0x1bc4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbc41[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x1bc4('0x0'));var MailQueue=require(_0x1bc4('0x1'))['db'][_0x1bc4('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1bc4('0x3'),'afterUpdate':_0x1bc4('0x4'),'afterDestroy':_0x1bc4('0x5')};function emitEvent(_0x5aa3c1){return function(_0x317597,_0x18a5ba,_0x140487){MailQueueEvents[_0x1bc4('0x6')](_0x5aa3c1+':'+_0x317597['id'],_0x317597);MailQueueEvents[_0x1bc4('0x6')](_0x5aa3c1,_0x317597);_0x140487(null);};}for(var e in events){if(events[_0x1bc4('0x7')](e)){var event=events[e];MailQueue[_0x1bc4('0x8')](e,emitEvent(event));}}module[_0x1bc4('0x9')]=MailQueueEvents; \ No newline at end of file +var _0xefd7=['update','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x3f6a96,_0x58d9a0){var _0x3bf420=function(_0x9bc98e){while(--_0x9bc98e){_0x3f6a96['push'](_0x3f6a96['shift']());}};_0x3bf420(++_0x58d9a0);}(_0xefd7,0xd6));var _0x7efd=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xefd7[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x7efd('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x7efd('0x1')](0x0);var events={'afterCreate':_0x7efd('0x2'),'afterUpdate':_0x7efd('0x3'),'afterDestroy':'remove'};function emitEvent(_0x657c93){return function(_0x5eda3b,_0x32aaff,_0x281534){MailQueueEvents['emit'](_0x657c93+':'+_0x5eda3b['id'],_0x5eda3b);MailQueueEvents['emit'](_0x657c93,_0x5eda3b);_0x281534(null);};}for(var e in events){if(events[_0x7efd('0x4')](e)){var event=events[e];MailQueue[_0x7efd('0x5')](e,emitEvent(event));}}module[_0x7efd('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 8251fa5..28ae9b4 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 _0xe0a6=['api','bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','lodash','../../config/logger'];(function(_0x6c2a4a,_0x2ad995){var _0x65a0ee=function(_0xe6b4e9){while(--_0xe6b4e9){_0x6c2a4a['push'](_0x6c2a4a['shift']());}};_0x65a0ee(++_0x2ad995);}(_0xe0a6,0xfb));var _0x6e0a=function(_0x2c8546,_0xe13fa2){_0x2c8546=_0x2c8546-0x0;var _0x2a4016=_0xe0a6[_0x2c8546];return _0x2a4016;};'use strict';var _=require(_0x6e0a('0x0'));var util=require('util');var logger=require(_0x6e0a('0x1'))(_0x6e0a('0x2'));var moment=require('moment');var BPromise=require(_0x6e0a('0x3'));var rp=require(_0x6e0a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e0a('0x5'));var config=require(_0x6e0a('0x6'));var attributes=require(_0x6e0a('0x7'));module['exports']=function(_0x3f6784,_0xacd5f2){return _0x3f6784[_0x6e0a('0x8')](_0x6e0a('0x9'),attributes,{'tableName':_0x6e0a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3cf=['bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment'];(function(_0x28a5ad,_0x520afa){var _0x176b8a=function(_0x3d71b){while(--_0x3d71b){_0x28a5ad['push'](_0x28a5ad['shift']());}};_0x176b8a(++_0x520afa);}(_0xd3cf,0x1bb));var _0xfd3c=function(_0x3bce43,_0xab1441){_0x3bce43=_0x3bce43-0x0;var _0x139427=_0xd3cf[_0x3bce43];return _0x139427;};'use strict';var _=require(_0xfd3c('0x0'));var util=require(_0xfd3c('0x1'));var logger=require(_0xfd3c('0x2'))(_0xfd3c('0x3'));var moment=require(_0xfd3c('0x4'));var BPromise=require(_0xfd3c('0x5'));var rp=require(_0xfd3c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd3c('0x7'));var config=require(_0xfd3c('0x8'));var attributes=require(_0xfd3c('0x9'));module[_0xfd3c('0xa')]=function(_0x21686f,_0x14df7f){return _0x21686f[_0xfd3c('0xb')](_0xfd3c('0xc'),attributes,{'tableName':_0xfd3c('0xd'),'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 2256501..ec916f8 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 _0x9405=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','MailQueue','findAll','options','raw','where','limit','include','map','model','debug','GetMailQueue','stringify','find','attributes','ShowMailQueue','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x25578b,_0x11705b){var _0x114641=function(_0x80ae46){while(--_0x80ae46){_0x25578b['push'](_0x25578b['shift']());}};_0x114641(++_0x11705b);}(_0x9405,0x1c6));var _0x5940=function(_0x33cbc1,_0x3bfd13){_0x33cbc1=_0x33cbc1-0x0;var _0x4828d3=_0x9405[_0x33cbc1];return _0x4828d3;};'use strict';var _=require(_0x5940('0x0'));var util=require(_0x5940('0x1'));var moment=require(_0x5940('0x2'));var BPromise=require(_0x5940('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5940('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5940('0x5'));var logger=require(_0x5940('0x6'))(_0x5940('0x7'));var config=require('../../config/environment');var jayson=require(_0x5940('0x8'));var client=jayson[_0x5940('0x9')][_0x5940('0xa')]({'port':0x232a});config[_0x5940('0xb')]=_[_0x5940('0xc')](config['redis'],{'host':_0x5940('0xd'),'port':0x18eb});var socket=require(_0x5940('0xe'))(new Redis(config['redis']));require(_0x5940('0xf'))[_0x5940('0x10')](socket);function respondWithRpcPromise(_0x270bb5,_0x313ca3,_0x1e10bf){return new BPromise(function(_0x5d5795,_0x175aee){return client['request'](_0x270bb5,_0x1e10bf)[_0x5940('0x11')](function(_0x1e56e8){logger[_0x5940('0x12')](_0x5940('0x13'),_0x313ca3,'request\x20sent');logger['debug'](_0x5940('0x14'),_0x313ca3,_0x5940('0x15'),JSON['stringify'](_0x1e56e8));if(_0x1e56e8[_0x5940('0x16')]){if(_0x1e56e8[_0x5940('0x16')][_0x5940('0x17')]===0x1f4){logger[_0x5940('0x16')](_0x5940('0x13'),_0x313ca3,_0x1e56e8[_0x5940('0x16')]['message']);return _0x175aee(_0x1e56e8[_0x5940('0x16')][_0x5940('0x18')]);}logger[_0x5940('0x16')](_0x5940('0x13'),_0x313ca3,_0x1e56e8['error'][_0x5940('0x18')]);return _0x5d5795(_0x1e56e8[_0x5940('0x16')][_0x5940('0x18')]);}else{logger[_0x5940('0x12')](_0x5940('0x13'),_0x313ca3,'request\x20sent');_0x5d5795(_0x1e56e8[_0x5940('0x19')][_0x5940('0x18')]);}})[_0x5940('0x1a')](function(_0x5e4941){logger[_0x5940('0x16')]('MailQueue,\x20%s,\x20%s',_0x313ca3,_0x5e4941);_0x175aee(_0x5e4941);});});}exports['GetMailQueue']=function(_0x2cda44){var _0x1a0857=this;return new Promise(function(_0x3c4cea,_0x5a2c17){return db[_0x5940('0x1b')][_0x5940('0x1c')]({'raw':_0x2cda44[_0x5940('0x1d')]?_0x2cda44[_0x5940('0x1d')][_0x5940('0x1e')]===undefined?!![]:![]:!![],'where':_0x2cda44[_0x5940('0x1d')]?_0x2cda44[_0x5940('0x1d')][_0x5940('0x1f')]||null:null,'attributes':_0x2cda44[_0x5940('0x1d')]?_0x2cda44['options']['attributes']||null:null,'limit':_0x2cda44[_0x5940('0x1d')]?_0x2cda44[_0x5940('0x1d')][_0x5940('0x20')]||null:null,'include':_0x2cda44['options']?_0x2cda44[_0x5940('0x1d')][_0x5940('0x21')]?_[_0x5940('0x22')](_0x2cda44[_0x5940('0x1d')][_0x5940('0x21')],function(_0x312253){return{'model':db[_0x312253[_0x5940('0x23')]],'as':_0x312253['as'],'attributes':_0x312253['attributes'],'include':_0x312253[_0x5940('0x21')]?_[_0x5940('0x22')](_0x312253[_0x5940('0x21')],function(_0x5f2dfd){return{'model':db[_0x5f2dfd['model']],'as':_0x5f2dfd['as'],'attributes':_0x5f2dfd['attributes'],'include':_0x5f2dfd[_0x5940('0x21')]?_[_0x5940('0x22')](_0x5f2dfd[_0x5940('0x21')],function(_0x14de0d){return{'model':db[_0x14de0d[_0x5940('0x23')]],'as':_0x14de0d['as'],'attributes':_0x14de0d['attributes']};}):[]};}):[]};}):[]:[]})[_0x5940('0x11')](function(_0x32c6c2){logger['info']('GetMailQueue',_0x2cda44);logger[_0x5940('0x24')](_0x5940('0x25'),_0x2cda44,JSON[_0x5940('0x26')](_0x32c6c2));_0x3c4cea(_0x32c6c2);})['catch'](function(_0x59e17f){logger[_0x5940('0x16')](_0x5940('0x25'),_0x59e17f[_0x5940('0x18')],_0x2cda44);_0x5a2c17(_0x1a0857[_0x5940('0x16')](0x1f4,_0x59e17f[_0x5940('0x18')]));});});};exports['ShowMailQueue']=function(_0x27eb3e){var _0x46c8d3=this;return new Promise(function(_0xdcaabb,_0x440376){return db[_0x5940('0x1b')][_0x5940('0x27')]({'raw':_0x27eb3e[_0x5940('0x1d')]?_0x27eb3e['options'][_0x5940('0x1e')]===undefined?!![]:![]:!![],'where':_0x27eb3e['options']?_0x27eb3e['options'][_0x5940('0x1f')]||null:null,'attributes':_0x27eb3e['options']?_0x27eb3e[_0x5940('0x1d')]['attributes']||null:null,'include':_0x27eb3e['options']?_0x27eb3e[_0x5940('0x1d')]['include']?_[_0x5940('0x22')](_0x27eb3e[_0x5940('0x1d')][_0x5940('0x21')],function(_0x370ae5){return{'model':db[_0x370ae5['model']],'as':_0x370ae5['as'],'attributes':_0x370ae5[_0x5940('0x28')],'include':_0x370ae5['include']?_[_0x5940('0x22')](_0x370ae5['include'],function(_0x31a707){return{'model':db[_0x31a707[_0x5940('0x23')]],'as':_0x31a707['as'],'attributes':_0x31a707['attributes'],'include':_0x31a707[_0x5940('0x21')]?_[_0x5940('0x22')](_0x31a707[_0x5940('0x21')],function(_0x388560){return{'model':db[_0x388560[_0x5940('0x23')]],'as':_0x388560['as'],'attributes':_0x388560[_0x5940('0x28')]};}):[]};}):[]};}):[]:[]})[_0x5940('0x11')](function(_0x58aa49){logger[_0x5940('0x12')](_0x5940('0x29'),_0x27eb3e);logger[_0x5940('0x24')]('ShowMailQueue',_0x27eb3e,JSON[_0x5940('0x26')](_0x58aa49));_0xdcaabb(_0x58aa49);})[_0x5940('0x1a')](function(_0x5fefcf){logger[_0x5940('0x16')](_0x5940('0x29'),_0x5fefcf[_0x5940('0x18')],_0x27eb3e);_0x440376(_0x46c8d3[_0x5940('0x16')](0x1f4,_0x5fefcf[_0x5940('0x18')]));});});}; \ No newline at end of file +var _0xda84=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','where','attributes','limit','include','map','model','info','ShowMailQueue','find','raw','lodash','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xda84,0x1ea));var _0x4da8=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xda84[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x4da8('0x0'));var util=require(_0x4da8('0x1'));var moment=require(_0x4da8('0x2'));var BPromise=require(_0x4da8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4da8('0x4'))['db'];var utils=require(_0x4da8('0x5'));var logger=require(_0x4da8('0x6'))('rpc');var config=require(_0x4da8('0x7'));var jayson=require(_0x4da8('0x8'));var client=jayson[_0x4da8('0x9')][_0x4da8('0xa')]({'port':0x232a});config[_0x4da8('0xb')]=_[_0x4da8('0xc')](config[_0x4da8('0xb')],{'host':_0x4da8('0xd'),'port':0x18eb});var socket=require(_0x4da8('0xe'))(new Redis(config[_0x4da8('0xb')]));require(_0x4da8('0xf'))[_0x4da8('0x10')](socket);function respondWithRpcPromise(_0x276b67,_0x19896b,_0x1ef2bd){return new BPromise(function(_0x5bf521,_0x3ae589){return client['request'](_0x276b67,_0x1ef2bd)[_0x4da8('0x11')](function(_0x14b0c4){logger['info'](_0x4da8('0x12'),_0x19896b,_0x4da8('0x13'));logger[_0x4da8('0x14')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x19896b,'request\x20sent',JSON[_0x4da8('0x15')](_0x14b0c4));if(_0x14b0c4[_0x4da8('0x16')]){if(_0x14b0c4['error'][_0x4da8('0x17')]===0x1f4){logger[_0x4da8('0x16')](_0x4da8('0x12'),_0x19896b,_0x14b0c4[_0x4da8('0x16')][_0x4da8('0x18')]);return _0x3ae589(_0x14b0c4['error']['message']);}logger[_0x4da8('0x16')]('MailQueue,\x20%s,\x20%s',_0x19896b,_0x14b0c4[_0x4da8('0x16')][_0x4da8('0x18')]);return _0x5bf521(_0x14b0c4['error'][_0x4da8('0x18')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x19896b,_0x4da8('0x13'));_0x5bf521(_0x14b0c4[_0x4da8('0x19')][_0x4da8('0x18')]);}})[_0x4da8('0x1a')](function(_0x3a4fba){logger[_0x4da8('0x16')](_0x4da8('0x12'),_0x19896b,_0x3a4fba);_0x3ae589(_0x3a4fba);});});}exports[_0x4da8('0x1b')]=function(_0x35d5d4){var _0x4b14b8=this;return new Promise(function(_0xb7af59,_0x38c689){return db[_0x4da8('0x1c')][_0x4da8('0x1d')]({'raw':_0x35d5d4[_0x4da8('0x1e')]?_0x35d5d4[_0x4da8('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x35d5d4[_0x4da8('0x1e')]?_0x35d5d4[_0x4da8('0x1e')][_0x4da8('0x1f')]||null:null,'attributes':_0x35d5d4[_0x4da8('0x1e')]?_0x35d5d4[_0x4da8('0x1e')][_0x4da8('0x20')]||null:null,'limit':_0x35d5d4[_0x4da8('0x1e')]?_0x35d5d4[_0x4da8('0x1e')][_0x4da8('0x21')]||null:null,'include':_0x35d5d4[_0x4da8('0x1e')]?_0x35d5d4[_0x4da8('0x1e')][_0x4da8('0x22')]?_[_0x4da8('0x23')](_0x35d5d4[_0x4da8('0x1e')]['include'],function(_0x85e523){return{'model':db[_0x85e523[_0x4da8('0x24')]],'as':_0x85e523['as'],'attributes':_0x85e523[_0x4da8('0x20')],'include':_0x85e523['include']?_[_0x4da8('0x23')](_0x85e523[_0x4da8('0x22')],function(_0x2baccb){return{'model':db[_0x2baccb[_0x4da8('0x24')]],'as':_0x2baccb['as'],'attributes':_0x2baccb[_0x4da8('0x20')],'include':_0x2baccb[_0x4da8('0x22')]?_[_0x4da8('0x23')](_0x2baccb['include'],function(_0xa36f53){return{'model':db[_0xa36f53[_0x4da8('0x24')]],'as':_0xa36f53['as'],'attributes':_0xa36f53[_0x4da8('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4da8('0x11')](function(_0x44150d){logger[_0x4da8('0x25')](_0x4da8('0x1b'),_0x35d5d4);logger['debug'](_0x4da8('0x1b'),_0x35d5d4,JSON[_0x4da8('0x15')](_0x44150d));_0xb7af59(_0x44150d);})[_0x4da8('0x1a')](function(_0x2c2454){logger[_0x4da8('0x16')]('GetMailQueue',_0x2c2454['message'],_0x35d5d4);_0x38c689(_0x4b14b8[_0x4da8('0x16')](0x1f4,_0x2c2454['message']));});});};exports[_0x4da8('0x26')]=function(_0x3a5aaa){var _0x1f21c6=this;return new Promise(function(_0x5967fd,_0x460e73){return db[_0x4da8('0x1c')][_0x4da8('0x27')]({'raw':_0x3a5aaa[_0x4da8('0x1e')]?_0x3a5aaa[_0x4da8('0x1e')][_0x4da8('0x28')]===undefined?!![]:![]:!![],'where':_0x3a5aaa[_0x4da8('0x1e')]?_0x3a5aaa[_0x4da8('0x1e')]['where']||null:null,'attributes':_0x3a5aaa[_0x4da8('0x1e')]?_0x3a5aaa[_0x4da8('0x1e')][_0x4da8('0x20')]||null:null,'include':_0x3a5aaa[_0x4da8('0x1e')]?_0x3a5aaa[_0x4da8('0x1e')][_0x4da8('0x22')]?_[_0x4da8('0x23')](_0x3a5aaa[_0x4da8('0x1e')][_0x4da8('0x22')],function(_0x4c879b){return{'model':db[_0x4c879b[_0x4da8('0x24')]],'as':_0x4c879b['as'],'attributes':_0x4c879b['attributes'],'include':_0x4c879b[_0x4da8('0x22')]?_[_0x4da8('0x23')](_0x4c879b[_0x4da8('0x22')],function(_0x4291ad){return{'model':db[_0x4291ad[_0x4da8('0x24')]],'as':_0x4291ad['as'],'attributes':_0x4291ad['attributes'],'include':_0x4291ad['include']?_[_0x4da8('0x23')](_0x4291ad[_0x4da8('0x22')],function(_0x26db85){return{'model':db[_0x26db85[_0x4da8('0x24')]],'as':_0x26db85['as'],'attributes':_0x26db85[_0x4da8('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4da8('0x11')](function(_0x16a357){logger[_0x4da8('0x25')](_0x4da8('0x26'),_0x3a5aaa);logger['debug']('ShowMailQueue',_0x3a5aaa,JSON[_0x4da8('0x15')](_0x16a357));_0x5967fd(_0x16a357);})['catch'](function(_0x7a1a88){logger[_0x4da8('0x16')](_0x4da8('0x26'),_0x7a1a88[_0x4da8('0x18')],_0x3a5aaa);_0x460e73(_0x1f21c6[_0x4da8('0x16')](0x1f4,_0x7a1a88[_0x4da8('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index a9025cb..8947ca9 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 _0x44cc=['update','emit','mailQueue:','./mailQueue.events'];(function(_0x232719,_0x37a326){var _0x21ee88=function(_0x4494ff){while(--_0x4494ff){_0x232719['push'](_0x232719['shift']());}};_0x21ee88(++_0x37a326);}(_0x44cc,0x73));var _0xc44c=function(_0x40a799,_0x5ddff4){_0x40a799=_0x40a799-0x0;var _0x5cb23b=_0x44cc[_0x40a799];return _0x5cb23b;};'use strict';var MailQueueEvents=require(_0xc44c('0x0'));var events=['save','remove',_0xc44c('0x1')];function createListener(_0x312d7e,_0x4c9044){return function(_0x825534){_0x4c9044[_0xc44c('0x2')](_0x312d7e,_0x825534);};}function removeListener(_0x366a12,_0xa894b3){return function(){MailQueueEvents['removeListener'](_0x366a12,_0xa894b3);};}exports['register']=function(_0x190b3b){for(var _0x3a07d3=0x0,_0x4c15a2=events['length'];_0x3a07d3<_0x4c15a2;_0x3a07d3++){var _0x55deca=events[_0x3a07d3];var _0x100cd4=createListener(_0xc44c('0x3')+_0x55deca,_0x190b3b);MailQueueEvents['on'](_0x55deca,_0x100cd4);}}; \ No newline at end of file +var _0xd1cc=['emit','removeListener','register','mailQueue:','./mailQueue.events','save'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xd1cc,0x10c));var _0xcd1c=function(_0x1c5502,_0x55269e){_0x1c5502=_0x1c5502-0x0;var _0x268ed4=_0xd1cc[_0x1c5502];return _0x268ed4;};'use strict';var MailQueueEvents=require(_0xcd1c('0x0'));var events=[_0xcd1c('0x1'),'remove','update'];function createListener(_0x51c5d0,_0x265fe2){return function(_0x1c41ed){_0x265fe2[_0xcd1c('0x2')](_0x51c5d0,_0x1c41ed);};}function removeListener(_0x593127,_0x2f79f6){return function(){MailQueueEvents[_0xcd1c('0x3')](_0x593127,_0x2f79f6);};}exports[_0xcd1c('0x4')]=function(_0x1f0451){for(var _0x13ae76=0x0,_0x2b54a8=events['length'];_0x13ae76<_0x2b54a8;_0x13ae76++){var _0x5b7ba5=events[_0x13ae76];var _0xd393a8=createListener(_0xcd1c('0x5')+_0x5b7ba5,_0x1f0451);MailQueueEvents['on'](_0x5b7ba5,_0xd393a8);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index a155521..aef4ffd 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 _0xb0f7=['connect-timeout','Router','../../components/auth/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','put','update','destroy','exports','multer','util','path'];(function(_0x153863,_0x41363d){var _0x3bfc32=function(_0x146041){while(--_0x146041){_0x153863['push'](_0x153863['shift']());}};_0x3bfc32(++_0x41363d);}(_0xb0f7,0x1c5));var _0x7b0f=function(_0x3875b1,_0x47cf1a){_0x3875b1=_0x3875b1-0x0;var _0x1e9c55=_0xb0f7[_0x3875b1];return _0x1e9c55;};'use strict';var multer=require(_0x7b0f('0x0'));var util=require(_0x7b0f('0x1'));var path=require(_0x7b0f('0x2'));var timeout=require(_0x7b0f('0x3'));var express=require('express');var router=express[_0x7b0f('0x4')]();var auth=require(_0x7b0f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7b0f('0x6'));var controller=require(_0x7b0f('0x7'));router['get']('/',auth[_0x7b0f('0x8')](),controller[_0x7b0f('0x9')]);router[_0x7b0f('0xa')]('/describe',auth[_0x7b0f('0x8')](),controller[_0x7b0f('0xb')]);router['get'](_0x7b0f('0xc'),auth[_0x7b0f('0x8')](),controller[_0x7b0f('0xd')]);router[_0x7b0f('0xe')]('/',auth[_0x7b0f('0x8')](),controller['create']);router[_0x7b0f('0xf')](_0x7b0f('0xc'),auth[_0x7b0f('0x8')](),controller[_0x7b0f('0x10')]);router['delete'](_0x7b0f('0xc'),auth[_0x7b0f('0x8')](),controller[_0x7b0f('0x11')]);module[_0x7b0f('0x12')]=router; \ No newline at end of file +var _0xf271=['Router','../../components/auth/service','./mailQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout','express'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf271,0x1b0));var _0x1f27=function(_0x4228a9,_0x40d3a3){_0x4228a9=_0x4228a9-0x0;var _0xdbce4a=_0xf271[_0x4228a9];return _0xdbce4a;};'use strict';var multer=require(_0x1f27('0x0'));var util=require(_0x1f27('0x1'));var path=require(_0x1f27('0x2'));var timeout=require(_0x1f27('0x3'));var express=require(_0x1f27('0x4'));var router=express[_0x1f27('0x5')]();var auth=require(_0x1f27('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1f27('0x7'));router[_0x1f27('0x8')]('/',auth[_0x1f27('0x9')](),controller['index']);router[_0x1f27('0x8')](_0x1f27('0xa'),auth[_0x1f27('0x9')](),controller[_0x1f27('0xb')]);router[_0x1f27('0x8')](_0x1f27('0xc'),auth[_0x1f27('0x9')](),controller[_0x1f27('0xd')]);router[_0x1f27('0xe')]('/',auth[_0x1f27('0x9')](),controller[_0x1f27('0xf')]);router[_0x1f27('0x10')](_0x1f27('0xc'),auth['isAuthenticated'](),controller[_0x1f27('0x11')]);router['delete'](_0x1f27('0xc'),auth[_0x1f27('0x9')](),controller[_0x1f27('0x12')]);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 d93f34e..b781f50 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 _0x640c=['exports','STRING','DATE','moment','sequelize'];(function(_0x316ce4,_0x162085){var _0x68adc4=function(_0x427645){while(--_0x427645){_0x316ce4['push'](_0x316ce4['shift']());}};_0x68adc4(++_0x162085);}(_0x640c,0xcb));var _0xc640=function(_0x515232,_0x3de920){_0x515232=_0x515232-0x0;var _0x45685c=_0x640c[_0x515232];return _0x45685c;};'use strict';var moment=require(_0xc640('0x0'));var Sequelize=require(_0xc640('0x1'));module[_0xc640('0x2')]={'uniqueid':{'type':Sequelize[_0xc640('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc640('0x4')]},'leaveAt':{'type':Sequelize[_0xc640('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc640('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x86e9=['exports','STRING','DATE','moment'];(function(_0x529cd3,_0x38ddb9){var _0xc64417=function(_0x20b986){while(--_0x20b986){_0x529cd3['push'](_0x529cd3['shift']());}};_0xc64417(++_0x38ddb9);}(_0x86e9,0x1d3));var _0x986e=function(_0x19fc2f,_0x2509a1){_0x19fc2f=_0x19fc2f-0x0;var _0x24a68f=_0x86e9[_0x19fc2f];return _0x24a68f;};'use strict';var moment=require(_0x986e('0x0'));var Sequelize=require('sequelize');module[_0x986e('0x1')]={'uniqueid':{'type':Sequelize[_0x986e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x986e('0x2')]},'joinAt':{'type':Sequelize[_0x986e('0x3')]},'leaveAt':{'type':Sequelize[_0x986e('0x3')]},'acceptAt':{'type':Sequelize[_0x986e('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 0d94207..e7c4e2f 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 _0x537e=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','key','model','map','query','intersection','fields','attributes','length','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','findAll','catch','params','keys','options','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache'];(function(_0x32c8ed,_0x45fef2){var _0x580764=function(_0xeb440e){while(--_0xeb440e){_0x32c8ed['push'](_0x32c8ed['shift']());}};_0x580764(++_0x45fef2);}(_0x537e,0x88));var _0xe537=function(_0x1c8ece,_0xd6de7b){_0x1c8ece=_0x1c8ece-0x0;var _0x5ee1bc=_0x537e[_0x1c8ece];return _0x5ee1bc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe537('0x0'));var rimraf=require(_0xe537('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe537('0x2'));var moment=require(_0xe537('0x3'));var BPromise=require(_0xe537('0x4'));var Mustache=require(_0xe537('0x5'));var util=require(_0xe537('0x6'));var path=require(_0xe537('0x7'));var sox=require(_0xe537('0x8'));var csv=require(_0xe537('0x9'));var ejs=require(_0xe537('0xa'));var fs=require('fs');var _=require(_0xe537('0xb'));var squel=require(_0xe537('0xc'));var crypto=require(_0xe537('0xd'));var jsforce=require(_0xe537('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe537('0xf'));var Papa=require(_0xe537('0x10'));var Redis=require(_0xe537('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe537('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe537('0x13'));var logger=require(_0xe537('0x14'))(_0xe537('0x15'));var utils=require(_0xe537('0x16'));var config=require(_0xe537('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c098d,_0x3ce1ff){_0x3ce1ff=_0x3ce1ff||0xcc;return function(_0x245475){if(_0x245475){return _0x1c098d[_0xe537('0x18')](_0x3ce1ff);}return _0x1c098d[_0xe537('0x19')](_0x3ce1ff)[_0xe537('0x1a')]();};}function respondWithResult(_0x66f666,_0x5a3f9e){_0x5a3f9e=_0x5a3f9e||0xc8;return function(_0x3e36ea){if(_0x3e36ea){return _0x66f666[_0xe537('0x19')](_0x5a3f9e)[_0xe537('0x1b')](_0x3e36ea);}};}function respondWithFilteredResult(_0x2200eb,_0x421281){return function(_0x117fcc){if(_0x117fcc){var _0x12b186=_0x117fcc[_0xe537('0x1c')],_0x121d5f=_0x421281[_0xe537('0x1d')],_0x34e458=_0x421281[_0xe537('0x1d')]+_0x421281[_0xe537('0x1e')],_0xbf24f3;if(_0x34e458>=_0x12b186){_0x34e458=_0x12b186;_0xbf24f3=0xc8;}else{_0xbf24f3=0xce;}_0x2200eb[_0xe537('0x19')](_0xbf24f3);return _0x2200eb['set'](_0xe537('0x1f'),_0x121d5f+'-'+_0x34e458+'/'+_0x12b186)[_0xe537('0x1b')](_0x117fcc);}return null;};}function patchUpdates(_0x289778){return function(_0x2f46fe){try{jsonpatch[_0xe537('0x20')](_0x2f46fe,_0x289778,!![]);}catch(_0x276689){return BPromise[_0xe537('0x21')](_0x276689);}return _0x2f46fe[_0xe537('0x22')]();};}function saveUpdates(_0x4122be,_0x3b584c){return function(_0x2ce832){if(_0x2ce832){return _0x2ce832[_0xe537('0x23')](_0x4122be)['then'](function(_0x229143){return _0x229143;});}return null;};}function removeEntity(_0x21fc9d,_0x9ffdc6){return function(_0x21e9a1){if(_0x21e9a1){return _0x21e9a1[_0xe537('0x24')]()[_0xe537('0x25')](function(){_0x21fc9d[_0xe537('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x338233,_0x258adc){return function(_0xe486bd){if(!_0xe486bd){_0x338233[_0xe537('0x18')](0x194);}return _0xe486bd;};}function handleError(_0x442333,_0xbbcaad){_0xbbcaad=_0xbbcaad||0x1f4;return function(_0x22e166){logger[_0xe537('0x26')](_0x22e166[_0xe537('0x27')]);if(_0x22e166[_0xe537('0x28')]){delete _0x22e166[_0xe537('0x28')];}_0x442333[_0xe537('0x19')](_0xbbcaad)[_0xe537('0x29')](_0x22e166);};}exports[_0xe537('0x2a')]=function(_0x1a52f2,_0x5365ba){var _0x53813b={},_0x1bf07e={},_0x4c2109={'count':0x0,'rows':[]};var _0x12f642=_['map'](db[_0xe537('0x2b')][_0xe537('0x2c')],function(_0xde5a36){return{'name':_0xde5a36[_0xe537('0x2d')],'type':_0xde5a36['type'][_0xe537('0x2e')]};});_0x1bf07e[_0xe537('0x2f')]=_[_0xe537('0x30')](_0x12f642,_0xe537('0x28'));_0x1bf07e[_0xe537('0x31')]=_['keys'](_0x1a52f2[_0xe537('0x31')]);_0x1bf07e['filters']=_[_0xe537('0x32')](_0x1bf07e[_0xe537('0x2f')],_0x1bf07e[_0xe537('0x31')]);_0x53813b['attributes']=_[_0xe537('0x32')](_0x1bf07e[_0xe537('0x2f')],qs[_0xe537('0x33')](_0x1a52f2[_0xe537('0x31')][_0xe537('0x33')]));_0x53813b[_0xe537('0x34')]=_0x53813b[_0xe537('0x34')][_0xe537('0x35')]?_0x53813b['attributes']:_0x1bf07e['model'];if(!_0x1a52f2[_0xe537('0x31')]['hasOwnProperty'](_0xe537('0x36'))){_0x53813b[_0xe537('0x1e')]=qs[_0xe537('0x1e')](_0x1a52f2[_0xe537('0x31')][_0xe537('0x1e')]);_0x53813b['offset']=qs[_0xe537('0x1d')](_0x1a52f2['query'][_0xe537('0x1d')]);}_0x53813b['order']=qs[_0xe537('0x37')](_0x1a52f2[_0xe537('0x31')][_0xe537('0x37')]);_0x53813b[_0xe537('0x38')]=qs[_0xe537('0x39')](_['pick'](_0x1a52f2['query'],_0x1bf07e[_0xe537('0x39')]),_0x12f642);if(_0x1a52f2[_0xe537('0x31')][_0xe537('0x3a')]){_0x53813b[_0xe537('0x38')]=_[_0xe537('0x3b')](_0x53813b[_0xe537('0x38')],{'$or':_[_0xe537('0x30')](_0x12f642,function(_0x1dc5d4){if(_0x1dc5d4[_0xe537('0x3c')]!==_0xe537('0x3d')){var _0x3b4888={};_0x3b4888[_0x1dc5d4[_0xe537('0x28')]]={'$like':'%'+_0x1a52f2[_0xe537('0x31')][_0xe537('0x3a')]+'%'};return _0x3b4888;}})});}_0x53813b=_[_0xe537('0x3b')]({},_0x53813b,_0x1a52f2['options']);var _0x3f64b7={'where':_0x53813b['where']};return db[_0xe537('0x2b')][_0xe537('0x1c')](_0x3f64b7)[_0xe537('0x25')](function(_0x1b945a){_0x4c2109[_0xe537('0x1c')]=_0x1b945a;if(_0x1a52f2[_0xe537('0x31')]['includeAll']){_0x53813b['include']=[{'all':!![]}];}return db[_0xe537('0x2b')][_0xe537('0x3e')](_0x53813b);})[_0xe537('0x25')](function(_0x3a3a10){_0x4c2109['rows']=_0x3a3a10;return _0x4c2109;})[_0xe537('0x25')](respondWithFilteredResult(_0x5365ba,_0x53813b))[_0xe537('0x3f')](handleError(_0x5365ba,null));};exports['show']=function(_0x105cbe,_0x239bc5){var _0xfa0b8={'raw':!![],'where':{'id':_0x105cbe[_0xe537('0x40')]['id']}},_0x49d27c={};_0x49d27c['model']=_['keys'](db['MailQueueReport']['rawAttributes']);_0x49d27c['query']=_[_0xe537('0x41')](_0x105cbe[_0xe537('0x31')]);_0x49d27c[_0xe537('0x39')]=_[_0xe537('0x32')](_0x49d27c['model'],_0x49d27c[_0xe537('0x31')]);_0xfa0b8[_0xe537('0x34')]=_['intersection'](_0x49d27c[_0xe537('0x2f')],qs['fields'](_0x105cbe['query'][_0xe537('0x33')]));_0xfa0b8['attributes']=_0xfa0b8['attributes']['length']?_0xfa0b8[_0xe537('0x34')]:_0x49d27c[_0xe537('0x2f')];if(_0x105cbe[_0xe537('0x31')]['includeAll']){_0xfa0b8['include']=[{'all':!![]}];}_0xfa0b8=_[_0xe537('0x3b')]({},_0xfa0b8,_0x105cbe[_0xe537('0x42')]);return db[_0xe537('0x2b')][_0xe537('0x43')](_0xfa0b8)['then'](handleEntityNotFound(_0x239bc5,null))['then'](respondWithResult(_0x239bc5,null))['catch'](handleError(_0x239bc5,null));};exports[_0xe537('0x44')]=function(_0xf9ea36,_0x1b86a0){return db['MailQueueReport']['create'](_0xf9ea36[_0xe537('0x45')],{})[_0xe537('0x25')](respondWithResult(_0x1b86a0,0xc9))[_0xe537('0x3f')](handleError(_0x1b86a0,null));};exports['update']=function(_0xeceab2,_0x124b30){if(_0xeceab2[_0xe537('0x45')]['id']){delete _0xeceab2[_0xe537('0x45')]['id'];}return db[_0xe537('0x2b')][_0xe537('0x43')]({'where':{'id':_0xeceab2[_0xe537('0x40')]['id']}})[_0xe537('0x25')](handleEntityNotFound(_0x124b30,null))[_0xe537('0x25')](saveUpdates(_0xeceab2[_0xe537('0x45')],null))['then'](respondWithResult(_0x124b30,null))[_0xe537('0x3f')](handleError(_0x124b30,null));};exports[_0xe537('0x24')]=function(_0xe9fe39,_0x1a18c2){return db[_0xe537('0x2b')][_0xe537('0x43')]({'where':{'id':_0xe9fe39[_0xe537('0x40')]['id']}})[_0xe537('0x25')](handleEntityNotFound(_0x1a18c2,null))['then'](removeEntity(_0x1a18c2,null))['catch'](handleError(_0x1a18c2,null));};exports[_0xe537('0x46')]=function(_0x1ddc4e,_0x213074){return db[_0xe537('0x2b')]['describe']()[_0xe537('0x25')](respondWithResult(_0x213074,null))[_0xe537('0x3f')](handleError(_0x213074,null));}; \ No newline at end of file +var _0x0416=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','MailQueueReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x0416,0x85));var _0x6041=function(_0x19b6c7,_0x428884){_0x19b6c7=_0x19b6c7-0x0;var _0x30cfa9=_0x0416[_0x19b6c7];return _0x30cfa9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6041('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6041('0x1'));var jsonpatch=require(_0x6041('0x2'));var rp=require('request-promise');var moment=require(_0x6041('0x3'));var BPromise=require(_0x6041('0x4'));var Mustache=require(_0x6041('0x5'));var util=require(_0x6041('0x6'));var path=require('path');var sox=require(_0x6041('0x7'));var csv=require(_0x6041('0x8'));var ejs=require(_0x6041('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6041('0xa'));var crypto=require(_0x6041('0xb'));var jsforce=require(_0x6041('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6041('0x8'));var querystring=require('querystring');var Papa=require(_0x6041('0xd'));var Redis=require(_0x6041('0xe'));var authService=require(_0x6041('0xf'));var qs=require(_0x6041('0x10'));var as=require(_0x6041('0x11'));var hardwareService=require(_0x6041('0x12'));var logger=require('../../config/logger')(_0x6041('0x13'));var utils=require(_0x6041('0x14'));var config=require(_0x6041('0x15'));var licenseUtil=require(_0x6041('0x16'));var db=require(_0x6041('0x17'))['db'];function respondWithStatusCode(_0x30c949,_0x2aee09){_0x2aee09=_0x2aee09||0xcc;return function(_0xea2724){if(_0xea2724){return _0x30c949['sendStatus'](_0x2aee09);}return _0x30c949[_0x6041('0x18')](_0x2aee09)[_0x6041('0x19')]();};}function respondWithResult(_0x4c95a7,_0x2df7da){_0x2df7da=_0x2df7da||0xc8;return function(_0x28630d){if(_0x28630d){return _0x4c95a7[_0x6041('0x18')](_0x2df7da)[_0x6041('0x1a')](_0x28630d);}};}function respondWithFilteredResult(_0x3042ce,_0x3bebf6){return function(_0x3dc959){if(_0x3dc959){var _0x149fd1=_0x3dc959[_0x6041('0x1b')],_0xc35f35=_0x3bebf6['offset'],_0x18d1aa=_0x3bebf6[_0x6041('0x1c')]+_0x3bebf6[_0x6041('0x1d')],_0x20da83;if(_0x18d1aa>=_0x149fd1){_0x18d1aa=_0x149fd1;_0x20da83=0xc8;}else{_0x20da83=0xce;}_0x3042ce['status'](_0x20da83);return _0x3042ce['set']('Content-Range',_0xc35f35+'-'+_0x18d1aa+'/'+_0x149fd1)[_0x6041('0x1a')](_0x3dc959);}return null;};}function patchUpdates(_0x396cce){return function(_0xf615ee){try{jsonpatch[_0x6041('0x1e')](_0xf615ee,_0x396cce,!![]);}catch(_0x20f5ab){return BPromise[_0x6041('0x1f')](_0x20f5ab);}return _0xf615ee[_0x6041('0x20')]();};}function saveUpdates(_0x2f379d,_0x314598){return function(_0xf757cc){if(_0xf757cc){return _0xf757cc['update'](_0x2f379d)[_0x6041('0x21')](function(_0x7a0964){return _0x7a0964;});}return null;};}function removeEntity(_0x29dd5b,_0x2f996f){return function(_0x2c990a){if(_0x2c990a){return _0x2c990a[_0x6041('0x22')]()['then'](function(){_0x29dd5b[_0x6041('0x18')](0xcc)[_0x6041('0x19')]();});}};}function handleEntityNotFound(_0x1ae02a,_0x136100){return function(_0x215666){if(!_0x215666){_0x1ae02a[_0x6041('0x23')](0x194);}return _0x215666;};}function handleError(_0x526f20,_0x188788){_0x188788=_0x188788||0x1f4;return function(_0x30324d){logger[_0x6041('0x24')](_0x30324d[_0x6041('0x25')]);if(_0x30324d[_0x6041('0x26')]){delete _0x30324d[_0x6041('0x26')];}_0x526f20['status'](_0x188788)[_0x6041('0x27')](_0x30324d);};}exports[_0x6041('0x28')]=function(_0x3a783a,_0x29ae94){var _0xa67402={},_0x4e8aa9={},_0xc0bd0e={'count':0x0,'rows':[]};var _0x5874dd=_[_0x6041('0x29')](db['MailQueueReport'][_0x6041('0x2a')],function(_0x30f65a){return{'name':_0x30f65a['fieldName'],'type':_0x30f65a[_0x6041('0x2b')][_0x6041('0x2c')]};});_0x4e8aa9[_0x6041('0x2d')]=_[_0x6041('0x29')](_0x5874dd,'name');_0x4e8aa9[_0x6041('0x2e')]=_['keys'](_0x3a783a[_0x6041('0x2e')]);_0x4e8aa9['filters']=_['intersection'](_0x4e8aa9[_0x6041('0x2d')],_0x4e8aa9[_0x6041('0x2e')]);_0xa67402['attributes']=_[_0x6041('0x2f')](_0x4e8aa9[_0x6041('0x2d')],qs[_0x6041('0x30')](_0x3a783a[_0x6041('0x2e')][_0x6041('0x30')]));_0xa67402[_0x6041('0x31')]=_0xa67402[_0x6041('0x31')][_0x6041('0x32')]?_0xa67402[_0x6041('0x31')]:_0x4e8aa9[_0x6041('0x2d')];if(!_0x3a783a[_0x6041('0x2e')][_0x6041('0x33')](_0x6041('0x34'))){_0xa67402[_0x6041('0x1d')]=qs[_0x6041('0x1d')](_0x3a783a[_0x6041('0x2e')]['limit']);_0xa67402[_0x6041('0x1c')]=qs[_0x6041('0x1c')](_0x3a783a[_0x6041('0x2e')][_0x6041('0x1c')]);}_0xa67402[_0x6041('0x35')]=qs['sort'](_0x3a783a[_0x6041('0x2e')][_0x6041('0x36')]);_0xa67402[_0x6041('0x37')]=qs[_0x6041('0x38')](_[_0x6041('0x39')](_0x3a783a[_0x6041('0x2e')],_0x4e8aa9['filters']),_0x5874dd);if(_0x3a783a[_0x6041('0x2e')]['filter']){_0xa67402[_0x6041('0x37')]=_[_0x6041('0x3a')](_0xa67402[_0x6041('0x37')],{'$or':_[_0x6041('0x29')](_0x5874dd,function(_0x480b3b){if(_0x480b3b[_0x6041('0x2b')]!==_0x6041('0x3b')){var _0x51599a={};_0x51599a[_0x480b3b[_0x6041('0x26')]]={'$like':'%'+_0x3a783a[_0x6041('0x2e')][_0x6041('0x3c')]+'%'};return _0x51599a;}})});}_0xa67402=_['merge']({},_0xa67402,_0x3a783a[_0x6041('0x3d')]);var _0x4279c3={'where':_0xa67402[_0x6041('0x37')]};return db[_0x6041('0x3e')][_0x6041('0x1b')](_0x4279c3)[_0x6041('0x21')](function(_0x29fbe9){_0xc0bd0e['count']=_0x29fbe9;if(_0x3a783a[_0x6041('0x2e')][_0x6041('0x3f')]){_0xa67402[_0x6041('0x40')]=[{'all':!![]}];}return db[_0x6041('0x3e')][_0x6041('0x41')](_0xa67402);})[_0x6041('0x21')](function(_0x594622){_0xc0bd0e[_0x6041('0x42')]=_0x594622;return _0xc0bd0e;})[_0x6041('0x21')](respondWithFilteredResult(_0x29ae94,_0xa67402))[_0x6041('0x43')](handleError(_0x29ae94,null));};exports[_0x6041('0x44')]=function(_0x182184,_0x49e7ba){var _0x802610={'raw':!![],'where':{'id':_0x182184[_0x6041('0x45')]['id']}},_0x4611b7={};_0x4611b7[_0x6041('0x2d')]=_[_0x6041('0x46')](db[_0x6041('0x3e')][_0x6041('0x2a')]);_0x4611b7[_0x6041('0x2e')]=_[_0x6041('0x46')](_0x182184[_0x6041('0x2e')]);_0x4611b7[_0x6041('0x38')]=_[_0x6041('0x2f')](_0x4611b7[_0x6041('0x2d')],_0x4611b7[_0x6041('0x2e')]);_0x802610[_0x6041('0x31')]=_[_0x6041('0x2f')](_0x4611b7['model'],qs[_0x6041('0x30')](_0x182184[_0x6041('0x2e')][_0x6041('0x30')]));_0x802610[_0x6041('0x31')]=_0x802610[_0x6041('0x31')][_0x6041('0x32')]?_0x802610[_0x6041('0x31')]:_0x4611b7[_0x6041('0x2d')];if(_0x182184['query'][_0x6041('0x3f')]){_0x802610['include']=[{'all':!![]}];}_0x802610=_[_0x6041('0x3a')]({},_0x802610,_0x182184[_0x6041('0x3d')]);return db[_0x6041('0x3e')][_0x6041('0x47')](_0x802610)[_0x6041('0x21')](handleEntityNotFound(_0x49e7ba,null))['then'](respondWithResult(_0x49e7ba,null))['catch'](handleError(_0x49e7ba,null));};exports[_0x6041('0x48')]=function(_0xa65d59,_0x1e5d55){return db[_0x6041('0x3e')][_0x6041('0x48')](_0xa65d59[_0x6041('0x49')],{})[_0x6041('0x21')](respondWithResult(_0x1e5d55,0xc9))[_0x6041('0x43')](handleError(_0x1e5d55,null));};exports['update']=function(_0xfd7738,_0x203fd8){if(_0xfd7738[_0x6041('0x49')]['id']){delete _0xfd7738[_0x6041('0x49')]['id'];}return db[_0x6041('0x3e')]['find']({'where':{'id':_0xfd7738['params']['id']}})[_0x6041('0x21')](handleEntityNotFound(_0x203fd8,null))[_0x6041('0x21')](saveUpdates(_0xfd7738[_0x6041('0x49')],null))['then'](respondWithResult(_0x203fd8,null))['catch'](handleError(_0x203fd8,null));};exports['destroy']=function(_0x48de08,_0x733e0c){return db[_0x6041('0x3e')]['find']({'where':{'id':_0x48de08[_0x6041('0x45')]['id']}})[_0x6041('0x21')](handleEntityNotFound(_0x733e0c,null))[_0x6041('0x21')](removeEntity(_0x733e0c,null))[_0x6041('0x43')](handleError(_0x733e0c,null));};exports[_0x6041('0x4a')]=function(_0x35a1a4,_0x5d3227){return db[_0x6041('0x3e')][_0x6041('0x4a')]()[_0x6041('0x21')](respondWithResult(_0x5d3227,null))['catch'](handleError(_0x5d3227,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index e67319d..a72ae39 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 _0x3d15=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x27c33b,_0x240b75){var _0x16aaa7=function(_0x2a7ac4){while(--_0x2a7ac4){_0x27c33b['push'](_0x27c33b['shift']());}};_0x16aaa7(++_0x240b75);}(_0x3d15,0x142));var _0x53d1=function(_0x8a2dae,_0x2a21a7){_0x8a2dae=_0x8a2dae-0x0;var _0x308f20=_0x3d15[_0x8a2dae];return _0x308f20;};'use strict';var _=require(_0x53d1('0x0'));var util=require(_0x53d1('0x1'));var logger=require(_0x53d1('0x2'))(_0x53d1('0x3'));var moment=require('moment');var BPromise=require(_0x53d1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x53d1('0x5'));var rimraf=require(_0x53d1('0x6'));var config=require(_0x53d1('0x7'));var attributes=require(_0x53d1('0x8'));module[_0x53d1('0x9')]=function(_0x299607,_0x1727ac){return _0x299607[_0x53d1('0xa')](_0x53d1('0xb'),attributes,{'tableName':_0x53d1('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x53d1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5065=['rimraf','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x487424,_0x156a01){var _0x42bea6=function(_0x1aba63){while(--_0x1aba63){_0x487424['push'](_0x487424['shift']());}};_0x42bea6(++_0x156a01);}(_0x5065,0x19e));var _0x5506=function(_0x2547ed,_0x1d6236){_0x2547ed=_0x2547ed-0x0;var _0x35151a=_0x5065[_0x2547ed];return _0x35151a;};'use strict';var _=require(_0x5506('0x0'));var util=require(_0x5506('0x1'));var logger=require(_0x5506('0x2'))('api');var moment=require(_0x5506('0x3'));var BPromise=require(_0x5506('0x4'));var rp=require(_0x5506('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5506('0x6'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0x5506('0x7')]=function(_0x76cd8e,_0x512a67){return _0x76cd8e[_0x5506('0x8')](_0x5506('0x9'),attributes,{'tableName':_0x5506('0xa'),'paranoid':![],'indexes':[{'name':_0x5506('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 8e74a94..573e108 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 _0xc675=['jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','where','attributes','limit','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5b8155,_0x51c636){var _0x1d6f07=function(_0x206950){while(--_0x206950){_0x5b8155['push'](_0x5b8155['shift']());}};_0x1d6f07(++_0x51c636);}(_0xc675,0x1c9));var _0x5c67=function(_0x405fb1,_0xa70054){_0x405fb1=_0x405fb1-0x0;var _0x4ca0be=_0xc675[_0x405fb1];return _0x4ca0be;};'use strict';var _=require('lodash');var util=require(_0x5c67('0x0'));var moment=require(_0x5c67('0x1'));var BPromise=require(_0x5c67('0x2'));var rs=require(_0x5c67('0x3'));var fs=require('fs');var Redis=require(_0x5c67('0x4'));var db=require(_0x5c67('0x5'))['db'];var utils=require(_0x5c67('0x6'));var logger=require('../../config/logger')(_0x5c67('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c67('0x8'));var client=jayson[_0x5c67('0x9')][_0x5c67('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c98e1,_0x23e203,_0x1edb89){return new BPromise(function(_0x55c291,_0xee5165){return client[_0x5c67('0xb')](_0x4c98e1,_0x1edb89)[_0x5c67('0xc')](function(_0x542f95){logger['info'](_0x5c67('0xd'),_0x23e203,_0x5c67('0xe'));logger[_0x5c67('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x23e203,_0x5c67('0xe'),JSON[_0x5c67('0x10')](_0x542f95));if(_0x542f95[_0x5c67('0x11')]){if(_0x542f95['error']['code']===0x1f4){logger[_0x5c67('0x11')](_0x5c67('0xd'),_0x23e203,_0x542f95[_0x5c67('0x11')][_0x5c67('0x12')]);return _0xee5165(_0x542f95[_0x5c67('0x11')]['message']);}logger[_0x5c67('0x11')](_0x5c67('0xd'),_0x23e203,_0x542f95[_0x5c67('0x11')][_0x5c67('0x12')]);return _0x55c291(_0x542f95[_0x5c67('0x11')][_0x5c67('0x12')]);}else{logger['info'](_0x5c67('0xd'),_0x23e203,'request\x20sent');_0x55c291(_0x542f95[_0x5c67('0x13')][_0x5c67('0x12')]);}})['catch'](function(_0x5a9d12){logger[_0x5c67('0x11')](_0x5c67('0xd'),_0x23e203,_0x5a9d12);_0xee5165(_0x5a9d12);});});}exports['CreateMailQueueReport']=function(_0x7399b0){var _0x2fe02c=this;return new Promise(function(_0x59f1df,_0x2dbfad){return db['MailQueueReport'][_0x5c67('0x14')](_0x7399b0[_0x5c67('0x15')],{'raw':_0x7399b0[_0x5c67('0x16')]?_0x7399b0[_0x5c67('0x16')][_0x5c67('0x17')]===undefined?!![]:![]:!![]})[_0x5c67('0xc')](function(_0xbedb48){logger['info'](_0x5c67('0x18'),_0x7399b0);logger[_0x5c67('0xf')](_0x5c67('0x18'),_0x7399b0,JSON['stringify'](_0xbedb48));_0x59f1df(_0xbedb48);})['catch'](function(_0x11d7c8){logger[_0x5c67('0x11')](_0x5c67('0x18'),_0x11d7c8[_0x5c67('0x12')],_0x7399b0);_0x2dbfad(_0x2fe02c[_0x5c67('0x11')](0x1f4,_0x11d7c8[_0x5c67('0x12')]));});});};exports[_0x5c67('0x19')]=function(_0x370ace){var _0x1cfae4=this;return new Promise(function(_0x34b45f,_0x52b2f6){return db['MailQueueReport']['update'](_0x370ace[_0x5c67('0x15')],{'raw':_0x370ace[_0x5c67('0x16')]?_0x370ace[_0x5c67('0x16')][_0x5c67('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x370ace[_0x5c67('0x16')]?_0x370ace['options'][_0x5c67('0x1a')]||null:null,'attributes':_0x370ace['options']?_0x370ace[_0x5c67('0x16')][_0x5c67('0x1b')]||null:null,'limit':_0x370ace[_0x5c67('0x16')]?_0x370ace[_0x5c67('0x16')][_0x5c67('0x1c')]||null:null})[_0x5c67('0xc')](function(_0x2f1702){logger[_0x5c67('0x1d')](_0x5c67('0x19'),_0x370ace);logger[_0x5c67('0xf')](_0x5c67('0x19'),_0x370ace,JSON[_0x5c67('0x10')](_0x2f1702));_0x34b45f(_0x2f1702);})[_0x5c67('0x1e')](function(_0xe3772){logger[_0x5c67('0x11')]('UpdateMailQueueReport',_0xe3772['message'],_0x370ace);_0x52b2f6(_0x1cfae4[_0x5c67('0x11')](0x1f4,_0xe3772['message']));});});}; \ No newline at end of file +var _0x84eb=['request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x84eb,0x1a0));var _0xb84e=function(_0x4f6c62,_0x5786a5){_0x4f6c62=_0x4f6c62-0x0;var _0x51f32b=_0x84eb[_0x4f6c62];return _0x51f32b;};'use strict';var _=require(_0xb84e('0x0'));var util=require(_0xb84e('0x1'));var moment=require(_0xb84e('0x2'));var BPromise=require(_0xb84e('0x3'));var rs=require(_0xb84e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84e('0x5'))['db'];var utils=require(_0xb84e('0x6'));var logger=require(_0xb84e('0x7'))(_0xb84e('0x8'));var config=require(_0xb84e('0x9'));var jayson=require(_0xb84e('0xa'));var client=jayson[_0xb84e('0xb')][_0xb84e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5de9a6,_0x3dd548,_0x2615ec){return new BPromise(function(_0x5c33af,_0x3d8ebe){return client[_0xb84e('0xd')](_0x5de9a6,_0x2615ec)[_0xb84e('0xe')](function(_0x3a4fcc){logger['info'](_0xb84e('0xf'),_0x3dd548,_0xb84e('0x10'));logger[_0xb84e('0x11')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3dd548,'request\x20sent',JSON[_0xb84e('0x12')](_0x3a4fcc));if(_0x3a4fcc[_0xb84e('0x13')]){if(_0x3a4fcc[_0xb84e('0x13')][_0xb84e('0x14')]===0x1f4){logger[_0xb84e('0x13')](_0xb84e('0xf'),_0x3dd548,_0x3a4fcc[_0xb84e('0x13')][_0xb84e('0x15')]);return _0x3d8ebe(_0x3a4fcc[_0xb84e('0x13')][_0xb84e('0x15')]);}logger[_0xb84e('0x13')]('MailQueueReport,\x20%s,\x20%s',_0x3dd548,_0x3a4fcc[_0xb84e('0x13')][_0xb84e('0x15')]);return _0x5c33af(_0x3a4fcc[_0xb84e('0x13')][_0xb84e('0x15')]);}else{logger[_0xb84e('0x16')](_0xb84e('0xf'),_0x3dd548,_0xb84e('0x10'));_0x5c33af(_0x3a4fcc[_0xb84e('0x17')][_0xb84e('0x15')]);}})[_0xb84e('0x18')](function(_0x5d82a5){logger[_0xb84e('0x13')](_0xb84e('0xf'),_0x3dd548,_0x5d82a5);_0x3d8ebe(_0x5d82a5);});});}exports[_0xb84e('0x19')]=function(_0x47ceed){var _0x5e087e=this;return new Promise(function(_0x5da27a,_0x278e65){return db[_0xb84e('0x1a')][_0xb84e('0x1b')](_0x47ceed[_0xb84e('0x1c')],{'raw':_0x47ceed[_0xb84e('0x1d')]?_0x47ceed['options'][_0xb84e('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0xf0b467){logger[_0xb84e('0x16')](_0xb84e('0x19'),_0x47ceed);logger[_0xb84e('0x11')]('CreateMailQueueReport',_0x47ceed,JSON['stringify'](_0xf0b467));_0x5da27a(_0xf0b467);})[_0xb84e('0x18')](function(_0x3f39b2){logger[_0xb84e('0x13')]('CreateMailQueueReport',_0x3f39b2[_0xb84e('0x15')],_0x47ceed);_0x278e65(_0x5e087e[_0xb84e('0x13')](0x1f4,_0x3f39b2[_0xb84e('0x15')]));});});};exports['UpdateMailQueueReport']=function(_0x1e02c4){var _0x1cf395=this;return new Promise(function(_0x238a47,_0x429f5d){return db[_0xb84e('0x1a')][_0xb84e('0x1f')](_0x1e02c4[_0xb84e('0x1c')],{'raw':_0x1e02c4[_0xb84e('0x1d')]?_0x1e02c4[_0xb84e('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e02c4[_0xb84e('0x1d')]?_0x1e02c4[_0xb84e('0x1d')][_0xb84e('0x20')]||null:null,'attributes':_0x1e02c4[_0xb84e('0x1d')]?_0x1e02c4[_0xb84e('0x1d')][_0xb84e('0x21')]||null:null,'limit':_0x1e02c4['options']?_0x1e02c4[_0xb84e('0x1d')][_0xb84e('0x22')]||null:null})[_0xb84e('0xe')](function(_0x3035b3){logger[_0xb84e('0x16')](_0xb84e('0x23'),_0x1e02c4);logger[_0xb84e('0x11')](_0xb84e('0x23'),_0x1e02c4,JSON[_0xb84e('0x12')](_0x3035b3));_0x238a47(_0x3035b3);})[_0xb84e('0x18')](function(_0x284111){logger['error'](_0xb84e('0x23'),_0x284111[_0xb84e('0x15')],_0x1e02c4);_0x429f5d(_0x1cf395[_0xb84e('0x13')](0x1f4,_0x284111['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 45825c9..a9b7919 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 _0xf5a9=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router'];(function(_0x4c5c8c,_0x19f2c7){var _0x2cdb02=function(_0x5ae1db){while(--_0x5ae1db){_0x4c5c8c['push'](_0x4c5c8c['shift']());}};_0x2cdb02(++_0x19f2c7);}(_0xf5a9,0x1ea));var _0x9f5a=function(_0x278c8f,_0xf98e3c){_0x278c8f=_0x278c8f-0x0;var _0x460976=_0xf5a9[_0x278c8f];return _0x460976;};'use strict';var multer=require(_0x9f5a('0x0'));var util=require(_0x9f5a('0x1'));var path=require(_0x9f5a('0x2'));var timeout=require('connect-timeout');var express=require(_0x9f5a('0x3'));var router=express[_0x9f5a('0x4')]();var auth=require(_0x9f5a('0x5'));var interaction=require(_0x9f5a('0x6'));var config=require(_0x9f5a('0x7'));module[_0x9f5a('0x8')]=router; \ No newline at end of file +var _0xcf92=['../../config/environment','exports','multer','util','path','express','Router','../../components/interaction/service'];(function(_0x5919dd,_0x5abc5f){var _0x5b4209=function(_0x235ddb){while(--_0x235ddb){_0x5919dd['push'](_0x5919dd['shift']());}};_0x5b4209(++_0x5abc5f);}(_0xcf92,0xea));var _0x2cf9=function(_0x3a6f75,_0x241f4c){_0x3a6f75=_0x3a6f75-0x0;var _0x4958f7=_0xcf92[_0x3a6f75];return _0x4958f7;};'use strict';var multer=require(_0x2cf9('0x0'));var util=require(_0x2cf9('0x1'));var path=require(_0x2cf9('0x2'));var timeout=require('connect-timeout');var express=require(_0x2cf9('0x3'));var router=express[_0x2cf9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2cf9('0x5'));var config=require(_0x2cf9('0x6'));module[_0x2cf9('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 9111fed..18dfc43 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 _0xa0aa=['STRING','INTEGER','BOOLEAN'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xa0aa,0x101));var _0xaa0a=function(_0x5a19f2,_0x91b0d4){_0x5a19f2=_0x5a19f2-0x0;var _0x535d08=_0xa0aa[_0x5a19f2];return _0x535d08;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xaa0a('0x0')],'defaultValue':!![]},'user':{'type':Sequelize[_0xaa0a('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xaa0a('0x1')]},'port':{'type':Sequelize[_0xaa0a('0x2')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xaa0a('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xaa0a('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0xaa0a('0x1')]}}; \ No newline at end of file +var _0x896b=['BOOLEAN','username','INTEGER','sequelize','exports','STRING'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x896b,0x75));var _0xb896=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x896b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb896('0x0'));module[_0xb896('0x1')]={'description':{'type':Sequelize[_0xb896('0x2')]},'host':{'type':Sequelize[_0xb896('0x2')]},'authentication':{'type':Sequelize[_0xb896('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xb896('0x2')],'unique':_0xb896('0x4')},'password':{'type':Sequelize[_0xb896('0x2')]},'port':{'type':Sequelize[_0xb896('0x5')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xb896('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xb896('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xb896('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0xb896('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 3b5676e..345d146 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 _0x01d3=['../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x22d72b,_0x112e6d){var _0x35f65f=function(_0x23d67f){while(--_0x23d67f){_0x22d72b['push'](_0x22d72b['shift']());}};_0x35f65f(++_0x112e6d);}(_0x01d3,0xa2));var _0x301d=function(_0x3412c5,_0xcc493c){_0x3412c5=_0x3412c5-0x0;var _0x1e090f=_0x01d3[_0x3412c5];return _0x1e090f;};'use strict';var _=require(_0x301d('0x0'));var util=require(_0x301d('0x1'));var logger=require(_0x301d('0x2'))(_0x301d('0x3'));var moment=require('moment');var BPromise=require(_0x301d('0x4'));var rp=require(_0x301d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x301d('0x6'));var config=require(_0x301d('0x7'));var attributes=require(_0x301d('0x8'));module[_0x301d('0x9')]=function(_0x5d1462,_0x318074){return _0x5d1462[_0x301d('0xa')](_0x301d('0xb'),attributes,{'tableName':_0x301d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96cc=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in'];(function(_0x45a472,_0x3fd9f6){var _0x46a410=function(_0x53e574){while(--_0x53e574){_0x45a472['push'](_0x45a472['shift']());}};_0x46a410(++_0x3fd9f6);}(_0x96cc,0x16c));var _0xc96c=function(_0x57b6ae,_0x2ca66e){_0x57b6ae=_0x57b6ae-0x0;var _0x8d7f4a=_0x96cc[_0x57b6ae];return _0x8d7f4a;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var logger=require(_0xc96c('0x1'))('api');var moment=require(_0xc96c('0x2'));var BPromise=require(_0xc96c('0x3'));var rp=require(_0xc96c('0x4'));var fs=require('fs');var path=require(_0xc96c('0x5'));var rimraf=require(_0xc96c('0x6'));var config=require(_0xc96c('0x7'));var attributes=require(_0xc96c('0x8'));module[_0xc96c('0x9')]=function(_0x3b7f45,_0x5142cd){return _0x3b7f45[_0xc96c('0xa')](_0xc96c('0xb'),attributes,{'tableName':_0xc96c('0xc'),'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 9b524b8..faf2020 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 _0xc028=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailServerIn,\x20%s,\x20%s','info','result','catch','GetMailServerIn','MailServerIn','findAll','options','attributes','limit','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4a4563,_0x2771c3){var _0x201be1=function(_0x32505c){while(--_0x32505c){_0x4a4563['push'](_0x4a4563['shift']());}};_0x201be1(++_0x2771c3);}(_0xc028,0x7d));var _0x8c02=function(_0x3efadb,_0x13d088){_0x3efadb=_0x3efadb-0x0;var _0x4726e8=_0xc028[_0x3efadb];return _0x4726e8;};'use strict';var _=require(_0x8c02('0x0'));var util=require(_0x8c02('0x1'));var moment=require(_0x8c02('0x2'));var BPromise=require(_0x8c02('0x3'));var rs=require(_0x8c02('0x4'));var fs=require('fs');var Redis=require(_0x8c02('0x5'));var db=require(_0x8c02('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c02('0x7'))(_0x8c02('0x8'));var config=require(_0x8c02('0x9'));var jayson=require(_0x8c02('0xa'));var client=jayson['client'][_0x8c02('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x135a05,_0xb1b6f9,_0x20f854){return new BPromise(function(_0xe163fb,_0x451a04){return client['request'](_0x135a05,_0x20f854)[_0x8c02('0xc')](function(_0x459e23){logger['info']('MailServerIn,\x20%s,\x20%s',_0xb1b6f9,'request\x20sent');logger[_0x8c02('0xd')](_0x8c02('0xe'),_0xb1b6f9,_0x8c02('0xf'),JSON[_0x8c02('0x10')](_0x459e23));if(_0x459e23[_0x8c02('0x11')]){if(_0x459e23[_0x8c02('0x11')][_0x8c02('0x12')]===0x1f4){logger[_0x8c02('0x11')]('MailServerIn,\x20%s,\x20%s',_0xb1b6f9,_0x459e23['error'][_0x8c02('0x13')]);return _0x451a04(_0x459e23[_0x8c02('0x11')][_0x8c02('0x13')]);}logger[_0x8c02('0x11')](_0x8c02('0x14'),_0xb1b6f9,_0x459e23['error'][_0x8c02('0x13')]);return _0xe163fb(_0x459e23['error'][_0x8c02('0x13')]);}else{logger[_0x8c02('0x15')](_0x8c02('0x14'),_0xb1b6f9,'request\x20sent');_0xe163fb(_0x459e23[_0x8c02('0x16')][_0x8c02('0x13')]);}})[_0x8c02('0x17')](function(_0x27a399){logger[_0x8c02('0x11')]('MailServerIn,\x20%s,\x20%s',_0xb1b6f9,_0x27a399);_0x451a04(_0x27a399);});});}exports[_0x8c02('0x18')]=function(_0x56e74f){var _0x16bcde=this;return new Promise(function(_0x3b8099,_0x32be8c){return db[_0x8c02('0x19')][_0x8c02('0x1a')]({'raw':_0x56e74f['options']?_0x56e74f[_0x8c02('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x56e74f[_0x8c02('0x1b')]?_0x56e74f[_0x8c02('0x1b')]['where']||null:null,'attributes':_0x56e74f[_0x8c02('0x1b')]?_0x56e74f['options'][_0x8c02('0x1c')]||null:null,'limit':_0x56e74f['options']?_0x56e74f[_0x8c02('0x1b')][_0x8c02('0x1d')]||null:null,'include':_0x56e74f[_0x8c02('0x1b')]?_0x56e74f[_0x8c02('0x1b')][_0x8c02('0x1e')]?_['map'](_0x56e74f[_0x8c02('0x1b')][_0x8c02('0x1e')],function(_0x10e39b){return{'model':db[_0x10e39b[_0x8c02('0x1f')]],'as':_0x10e39b['as'],'attributes':_0x10e39b[_0x8c02('0x1c')],'include':_0x10e39b[_0x8c02('0x1e')]?_[_0x8c02('0x20')](_0x10e39b[_0x8c02('0x1e')],function(_0x39c669){return{'model':db[_0x39c669[_0x8c02('0x1f')]],'as':_0x39c669['as'],'attributes':_0x39c669['attributes'],'include':_0x39c669[_0x8c02('0x1e')]?_['map'](_0x39c669[_0x8c02('0x1e')],function(_0x372d49){return{'model':db[_0x372d49[_0x8c02('0x1f')]],'as':_0x372d49['as'],'attributes':_0x372d49[_0x8c02('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8c02('0xc')](function(_0x58ac0a){logger[_0x8c02('0x15')]('GetMailServerIn',_0x56e74f);logger[_0x8c02('0xd')](_0x8c02('0x18'),_0x56e74f,JSON[_0x8c02('0x10')](_0x58ac0a));_0x3b8099(_0x58ac0a);})[_0x8c02('0x17')](function(_0x2f71b9){logger[_0x8c02('0x11')](_0x8c02('0x18'),_0x2f71b9[_0x8c02('0x13')],_0x56e74f);_0x32be8c(_0x16bcde[_0x8c02('0x11')](0x1f4,_0x2f71b9['message']));});});}; \ No newline at end of file +var _0xb63a=['debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','attributes','limit','include','map','model','then','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xb63a,0x147));var _0xab63=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xb63a[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0xab63('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xab63('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab63('0x2'));var db=require(_0xab63('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xab63('0x4'))(_0xab63('0x5'));var config=require(_0xab63('0x6'));var jayson=require(_0xab63('0x7'));var client=jayson[_0xab63('0x8')][_0xab63('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cf8ad,_0x561baf,_0x60d9a3){return new BPromise(function(_0x377eb5,_0x1bc231){return client[_0xab63('0xa')](_0x3cf8ad,_0x60d9a3)['then'](function(_0x5520c7){logger[_0xab63('0xb')](_0xab63('0xc'),_0x561baf,_0xab63('0xd'));logger[_0xab63('0xe')](_0xab63('0xf'),_0x561baf,_0xab63('0xd'),JSON[_0xab63('0x10')](_0x5520c7));if(_0x5520c7[_0xab63('0x11')]){if(_0x5520c7[_0xab63('0x11')]['code']===0x1f4){logger[_0xab63('0x11')](_0xab63('0xc'),_0x561baf,_0x5520c7[_0xab63('0x11')][_0xab63('0x12')]);return _0x1bc231(_0x5520c7[_0xab63('0x11')][_0xab63('0x12')]);}logger[_0xab63('0x11')](_0xab63('0xc'),_0x561baf,_0x5520c7['error']['message']);return _0x377eb5(_0x5520c7[_0xab63('0x11')][_0xab63('0x12')]);}else{logger[_0xab63('0xb')]('MailServerIn,\x20%s,\x20%s',_0x561baf,_0xab63('0xd'));_0x377eb5(_0x5520c7[_0xab63('0x13')]['message']);}})[_0xab63('0x14')](function(_0xde12d4){logger[_0xab63('0x11')](_0xab63('0xc'),_0x561baf,_0xde12d4);_0x1bc231(_0xde12d4);});});}exports[_0xab63('0x15')]=function(_0x305e79){var _0x2d9fea=this;return new Promise(function(_0x1b2d56,_0x1dbaef){return db[_0xab63('0x16')][_0xab63('0x17')]({'raw':_0x305e79['options']?_0x305e79[_0xab63('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x305e79[_0xab63('0x18')]?_0x305e79[_0xab63('0x18')]['where']||null:null,'attributes':_0x305e79[_0xab63('0x18')]?_0x305e79[_0xab63('0x18')][_0xab63('0x19')]||null:null,'limit':_0x305e79['options']?_0x305e79[_0xab63('0x18')][_0xab63('0x1a')]||null:null,'include':_0x305e79[_0xab63('0x18')]?_0x305e79[_0xab63('0x18')][_0xab63('0x1b')]?_['map'](_0x305e79[_0xab63('0x18')][_0xab63('0x1b')],function(_0x346030){return{'model':db[_0x346030['model']],'as':_0x346030['as'],'attributes':_0x346030[_0xab63('0x19')],'include':_0x346030[_0xab63('0x1b')]?_['map'](_0x346030[_0xab63('0x1b')],function(_0x16a2e5){return{'model':db[_0x16a2e5['model']],'as':_0x16a2e5['as'],'attributes':_0x16a2e5['attributes'],'include':_0x16a2e5['include']?_[_0xab63('0x1c')](_0x16a2e5['include'],function(_0x59c27e){return{'model':db[_0x59c27e[_0xab63('0x1d')]],'as':_0x59c27e['as'],'attributes':_0x59c27e[_0xab63('0x19')]};}):[]};}):[]};}):[]:[]})[_0xab63('0x1e')](function(_0x9177c8){logger[_0xab63('0xb')](_0xab63('0x15'),_0x305e79);logger[_0xab63('0xe')](_0xab63('0x15'),_0x305e79,JSON[_0xab63('0x10')](_0x9177c8));_0x1b2d56(_0x9177c8);})[_0xab63('0x14')](function(_0x5da7fc){logger[_0xab63('0x11')](_0xab63('0x15'),_0x5da7fc[_0xab63('0x12')],_0x305e79);_0x1dbaef(_0x2d9fea[_0xab63('0x11')](0x1f4,_0x5da7fc[_0xab63('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 5f1bf61..c0f0d7c 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 _0xc4f7=['show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x3922bf,_0xc3d306){var _0x56ba39=function(_0x5d8770){while(--_0x5d8770){_0x3922bf['push'](_0x3922bf['shift']());}};_0x56ba39(++_0xc3d306);}(_0xc4f7,0x128));var _0x7c4f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc4f7[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x7c4f('0x0'));var util=require(_0x7c4f('0x1'));var path=require(_0x7c4f('0x2'));var timeout=require(_0x7c4f('0x3'));var express=require('express');var router=express[_0x7c4f('0x4')]();var auth=require(_0x7c4f('0x5'));var interaction=require(_0x7c4f('0x6'));var config=require(_0x7c4f('0x7'));var controller=require('./mailServerOut.controller');router['get']('/',auth[_0x7c4f('0x8')](),controller[_0x7c4f('0x9')]);router['get']('/:id',auth[_0x7c4f('0x8')](),controller[_0x7c4f('0xa')]);router[_0x7c4f('0xb')]('/',auth['isAuthenticated'](),controller[_0x7c4f('0xc')]);router[_0x7c4f('0xd')](_0x7c4f('0xe'),auth[_0x7c4f('0x8')](),controller['update']);router[_0x7c4f('0xf')](_0x7c4f('0xe'),auth[_0x7c4f('0x8')](),controller[_0x7c4f('0x10')]);module[_0x7c4f('0x11')]=router; \ No newline at end of file +var _0xf517=['Router','../../components/auth/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','/:id','post','create','destroy','exports','util','path'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xf517,0x14e));var _0x7f51=function(_0x4b7c95,_0x11efd1){_0x4b7c95=_0x4b7c95-0x0;var _0x4b7ab5=_0xf517[_0x4b7c95];return _0x4b7ab5;};'use strict';var multer=require('multer');var util=require(_0x7f51('0x0'));var path=require(_0x7f51('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7f51('0x2')]();var auth=require(_0x7f51('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7f51('0x4'));var controller=require(_0x7f51('0x5'));router[_0x7f51('0x6')]('/',auth[_0x7f51('0x7')](),controller[_0x7f51('0x8')]);router[_0x7f51('0x6')](_0x7f51('0x9'),auth[_0x7f51('0x7')](),controller['show']);router[_0x7f51('0xa')]('/',auth[_0x7f51('0x7')](),controller[_0x7f51('0xb')]);router['put'](_0x7f51('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7f51('0x9'),auth['isAuthenticated'](),controller[_0x7f51('0xc')]);module[_0x7f51('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 8eeb5ca..3269046 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 _0x1189=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x15522c,_0x1208fd){var _0x528d3b=function(_0x1d4312){while(--_0x1d4312){_0x15522c['push'](_0x15522c['shift']());}};_0x528d3b(++_0x1208fd);}(_0x1189,0x17f));var _0x9118=function(_0x594a85,_0x42e865){_0x594a85=_0x594a85-0x0;var _0x1b8ba7=_0x1189[_0x594a85];return _0x1b8ba7;};'use strict';var Sequelize=require(_0x9118('0x0'));module[_0x9118('0x1')]={'description':{'type':Sequelize[_0x9118('0x2')]},'host':{'type':Sequelize[_0x9118('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x9118('0x2')]},'port':{'type':Sequelize[_0x9118('0x3')]},'secure':{'type':Sequelize[_0x9118('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x9118('0x2')]},'authentication':{'type':Sequelize[_0x9118('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf31b=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x53f02f,_0x179f5b){var _0x584a5e=function(_0x368e1b){while(--_0x368e1b){_0x53f02f['push'](_0x53f02f['shift']());}};_0x584a5e(++_0x179f5b);}(_0xf31b,0x1a0));var _0xbf31=function(_0x17e02a,_0x454ffb){_0x17e02a=_0x17e02a-0x0;var _0x7dbbfc=_0xf31b[_0x17e02a];return _0x7dbbfc;};'use strict';var Sequelize=require(_0xbf31('0x0'));module[_0xbf31('0x1')]={'description':{'type':Sequelize[_0xbf31('0x2')]},'host':{'type':Sequelize[_0xbf31('0x2')]},'user':{'type':Sequelize[_0xbf31('0x2')]},'pass':{'type':Sequelize[_0xbf31('0x2')]},'port':{'type':Sequelize[_0xbf31('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xbf31('0x2')]},'authentication':{'type':Sequelize[_0xbf31('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 67033ff..5236d15 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 _0x786d=['find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','index','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','MailServerOut','includeAll','include','rows','catch','show','params','keys','create','body'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x786d,0x1b7));var _0xd786=function(_0xac27b3,_0x330f89){_0xac27b3=_0xac27b3-0x0;var _0x1d8d2f=_0x786d[_0xac27b3];return _0x1d8d2f;};'use strict';var pdf=require(_0xd786('0x0'));var emlformat=require(_0xd786('0x1'));var rimraf=require(_0xd786('0x2'));var zipdir=require(_0xd786('0x3'));var jsonpatch=require(_0xd786('0x4'));var rp=require(_0xd786('0x5'));var moment=require(_0xd786('0x6'));var BPromise=require(_0xd786('0x7'));var Mustache=require('mustache');var util=require(_0xd786('0x8'));var path=require(_0xd786('0x9'));var sox=require(_0xd786('0xa'));var csv=require(_0xd786('0xb'));var ejs=require(_0xd786('0xc'));var fs=require('fs');var _=require(_0xd786('0xd'));var squel=require(_0xd786('0xe'));var crypto=require('crypto');var jsforce=require(_0xd786('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd786('0xb'));var querystring=require(_0xd786('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd786('0x11'));var qs=require(_0xd786('0x12'));var as=require(_0xd786('0x13'));var hardwareService=require(_0xd786('0x14'));var logger=require(_0xd786('0x15'))(_0xd786('0x16'));var utils=require(_0xd786('0x17'));var config=require(_0xd786('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb12744,_0x1dfaeb){_0x1dfaeb=_0x1dfaeb||0xcc;return function(_0x1d4b2a){if(_0x1d4b2a){return _0xb12744['sendStatus'](_0x1dfaeb);}return _0xb12744['status'](_0x1dfaeb)['end']();};}function respondWithResult(_0x15355b,_0x17d3ef){_0x17d3ef=_0x17d3ef||0xc8;return function(_0x54c34e){if(_0x54c34e){return _0x15355b[_0xd786('0x19')](_0x17d3ef)[_0xd786('0x1a')](_0x54c34e);}};}function respondWithFilteredResult(_0x528b5f,_0xa8a9e9){return function(_0xa4e575){if(_0xa4e575){var _0x58b37a=_0xa4e575[_0xd786('0x1b')],_0x42b9bf=_0xa8a9e9[_0xd786('0x1c')],_0x5d1bb6=_0xa8a9e9['offset']+_0xa8a9e9[_0xd786('0x1d')],_0x93b3ce;if(_0x5d1bb6>=_0x58b37a){_0x5d1bb6=_0x58b37a;_0x93b3ce=0xc8;}else{_0x93b3ce=0xce;}_0x528b5f[_0xd786('0x19')](_0x93b3ce);return _0x528b5f[_0xd786('0x1e')](_0xd786('0x1f'),_0x42b9bf+'-'+_0x5d1bb6+'/'+_0x58b37a)[_0xd786('0x1a')](_0xa4e575);}return null;};}function patchUpdates(_0x509fe3){return function(_0x549010){try{jsonpatch[_0xd786('0x20')](_0x549010,_0x509fe3,!![]);}catch(_0x5d83e7){return BPromise[_0xd786('0x21')](_0x5d83e7);}return _0x549010[_0xd786('0x22')]();};}function saveUpdates(_0x160b98,_0x48941a){return function(_0x3f80e1){if(_0x3f80e1){return _0x3f80e1[_0xd786('0x23')](_0x160b98)['then'](function(_0x381919){return _0x381919;});}return null;};}function removeEntity(_0x4ff343,_0xf7eb49){return function(_0x4ab23b){if(_0x4ab23b){return _0x4ab23b[_0xd786('0x24')]()[_0xd786('0x25')](function(){_0x4ff343[_0xd786('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x98acf4,_0x17b062){return function(_0xe03e51){if(!_0xe03e51){_0x98acf4[_0xd786('0x26')](0x194);}return _0xe03e51;};}function handleError(_0x4180f3,_0x3b3150){_0x3b3150=_0x3b3150||0x1f4;return function(_0x421406){logger['error'](_0x421406[_0xd786('0x27')]);if(_0x421406['name']){delete _0x421406['name'];}_0x4180f3[_0xd786('0x19')](_0x3b3150)['send'](_0x421406);};}exports[_0xd786('0x28')]=function(_0xfe22cc,_0x335c64){var _0x2559cd={},_0x32ede0={},_0x4be0bb={'count':0x0,'rows':[]};var _0x23e287=_['map'](db['MailServerOut'][_0xd786('0x29')],function(_0x1d86c7){return{'name':_0x1d86c7['fieldName'],'type':_0x1d86c7[_0xd786('0x2a')][_0xd786('0x2b')]};});_0x32ede0[_0xd786('0x2c')]=_['map'](_0x23e287,_0xd786('0x2d'));_0x32ede0[_0xd786('0x2e')]=_['keys'](_0xfe22cc[_0xd786('0x2e')]);_0x32ede0[_0xd786('0x2f')]=_[_0xd786('0x30')](_0x32ede0[_0xd786('0x2c')],_0x32ede0[_0xd786('0x2e')]);_0x2559cd[_0xd786('0x31')]=_[_0xd786('0x30')](_0x32ede0[_0xd786('0x2c')],qs[_0xd786('0x32')](_0xfe22cc[_0xd786('0x2e')][_0xd786('0x32')]));_0x2559cd['attributes']=_0x2559cd[_0xd786('0x31')][_0xd786('0x33')]?_0x2559cd[_0xd786('0x31')]:_0x32ede0[_0xd786('0x2c')];if(!_0xfe22cc[_0xd786('0x2e')][_0xd786('0x34')](_0xd786('0x35'))){_0x2559cd[_0xd786('0x1d')]=qs[_0xd786('0x1d')](_0xfe22cc[_0xd786('0x2e')][_0xd786('0x1d')]);_0x2559cd['offset']=qs[_0xd786('0x1c')](_0xfe22cc[_0xd786('0x2e')][_0xd786('0x1c')]);}_0x2559cd[_0xd786('0x36')]=qs[_0xd786('0x37')](_0xfe22cc[_0xd786('0x2e')][_0xd786('0x37')]);_0x2559cd[_0xd786('0x38')]=qs['filters'](_[_0xd786('0x39')](_0xfe22cc[_0xd786('0x2e')],_0x32ede0['filters']),_0x23e287);if(_0xfe22cc['query'][_0xd786('0x3a')]){_0x2559cd['where']=_[_0xd786('0x3b')](_0x2559cd[_0xd786('0x38')],{'$or':_[_0xd786('0x3c')](_0x23e287,function(_0x153fbc){if(_0x153fbc['type']!=='VIRTUAL'){var _0x3db4a8={};_0x3db4a8[_0x153fbc[_0xd786('0x2d')]]={'$like':'%'+_0xfe22cc[_0xd786('0x2e')][_0xd786('0x3a')]+'%'};return _0x3db4a8;}})});}_0x2559cd=_[_0xd786('0x3b')]({},_0x2559cd,_0xfe22cc[_0xd786('0x3d')]);var _0x2d414b={'where':_0x2559cd[_0xd786('0x38')]};return db[_0xd786('0x3e')]['count'](_0x2d414b)['then'](function(_0x214b6c){_0x4be0bb[_0xd786('0x1b')]=_0x214b6c;if(_0xfe22cc[_0xd786('0x2e')][_0xd786('0x3f')]){_0x2559cd[_0xd786('0x40')]=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x2559cd);})[_0xd786('0x25')](function(_0x285a96){_0x4be0bb[_0xd786('0x41')]=_0x285a96;return _0x4be0bb;})[_0xd786('0x25')](respondWithFilteredResult(_0x335c64,_0x2559cd))[_0xd786('0x42')](handleError(_0x335c64,null));};exports[_0xd786('0x43')]=function(_0x409c1,_0xb7ca83){var _0x413841={'raw':!![],'where':{'id':_0x409c1[_0xd786('0x44')]['id']}},_0x10ea40={};_0x10ea40['model']=_[_0xd786('0x45')](db[_0xd786('0x3e')][_0xd786('0x29')]);_0x10ea40[_0xd786('0x2e')]=_[_0xd786('0x45')](_0x409c1[_0xd786('0x2e')]);_0x10ea40[_0xd786('0x2f')]=_['intersection'](_0x10ea40[_0xd786('0x2c')],_0x10ea40['query']);_0x413841[_0xd786('0x31')]=_[_0xd786('0x30')](_0x10ea40[_0xd786('0x2c')],qs['fields'](_0x409c1[_0xd786('0x2e')][_0xd786('0x32')]));_0x413841['attributes']=_0x413841[_0xd786('0x31')][_0xd786('0x33')]?_0x413841['attributes']:_0x10ea40[_0xd786('0x2c')];if(_0x409c1['query']['includeAll']){_0x413841['include']=[{'all':!![]}];}_0x413841=_['merge']({},_0x413841,_0x409c1[_0xd786('0x3d')]);return db[_0xd786('0x3e')]['find'](_0x413841)[_0xd786('0x25')](handleEntityNotFound(_0xb7ca83,null))[_0xd786('0x25')](respondWithResult(_0xb7ca83,null))[_0xd786('0x42')](handleError(_0xb7ca83,null));};exports[_0xd786('0x46')]=function(_0x16cee6,_0x3cb6f7){return db[_0xd786('0x3e')][_0xd786('0x46')](_0x16cee6[_0xd786('0x47')],{})['then'](respondWithResult(_0x3cb6f7,0xc9))[_0xd786('0x42')](handleError(_0x3cb6f7,null));};exports[_0xd786('0x23')]=function(_0x19a101,_0x280578){if(_0x19a101[_0xd786('0x47')]['id']){delete _0x19a101['body']['id'];}return db['MailServerOut'][_0xd786('0x48')]({'where':{'id':_0x19a101[_0xd786('0x44')]['id']}})[_0xd786('0x25')](handleEntityNotFound(_0x280578,null))[_0xd786('0x25')](saveUpdates(_0x19a101[_0xd786('0x47')],null))[_0xd786('0x25')](respondWithResult(_0x280578,null))[_0xd786('0x42')](handleError(_0x280578,null));};exports[_0xd786('0x24')]=function(_0x5690cc,_0x522769){return db[_0xd786('0x3e')][_0xd786('0x48')]({'where':{'id':_0x5690cc[_0xd786('0x44')]['id']}})[_0xd786('0x25')](handleEntityNotFound(_0x522769,null))['then'](removeEntity(_0x522769,null))[_0xd786('0x42')](handleError(_0x522769,null));}; \ No newline at end of file +var _0xbaee=['find','destroy','html-pdf','request-promise','moment','bluebird','mustache','path','sox','to-csv','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','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','error','name','index','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','filter','MailServerOut','count','include','findAll','catch','show','params','keys','rawAttributes','includeAll','options','create','body'];(function(_0x42e97b,_0x59b053){var _0x247ef7=function(_0x3c52fb){while(--_0x3c52fb){_0x42e97b['push'](_0x42e97b['shift']());}};_0x247ef7(++_0x59b053);}(_0xbaee,0x1b2));var _0xebae=function(_0x65f7d6,_0x46b7e8){_0x65f7d6=_0x65f7d6-0x0;var _0xc6d4d5=_0xbaee[_0x65f7d6];return _0xc6d4d5;};'use strict';var pdf=require(_0xebae('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xebae('0x1'));var moment=require(_0xebae('0x2'));var BPromise=require(_0xebae('0x3'));var Mustache=require(_0xebae('0x4'));var util=require('util');var path=require(_0xebae('0x5'));var sox=require(_0xebae('0x6'));var csv=require(_0xebae('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xebae('0x8'));var squel=require(_0xebae('0x9'));var crypto=require(_0xebae('0xa'));var jsforce=require(_0xebae('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xebae('0x7'));var querystring=require(_0xebae('0xc'));var Papa=require(_0xebae('0xd'));var Redis=require(_0xebae('0xe'));var authService=require(_0xebae('0xf'));var qs=require(_0xebae('0x10'));var as=require(_0xebae('0x11'));var hardwareService=require(_0xebae('0x12'));var logger=require('../../config/logger')(_0xebae('0x13'));var utils=require(_0xebae('0x14'));var config=require(_0xebae('0x15'));var licenseUtil=require(_0xebae('0x16'));var db=require(_0xebae('0x17'))['db'];function respondWithStatusCode(_0x3cea97,_0x591474){_0x591474=_0x591474||0xcc;return function(_0x48ff5f){if(_0x48ff5f){return _0x3cea97[_0xebae('0x18')](_0x591474);}return _0x3cea97[_0xebae('0x19')](_0x591474)['end']();};}function respondWithResult(_0x547b0c,_0x719b92){_0x719b92=_0x719b92||0xc8;return function(_0x3ff375){if(_0x3ff375){return _0x547b0c[_0xebae('0x19')](_0x719b92)['json'](_0x3ff375);}};}function respondWithFilteredResult(_0xe7f2fc,_0x42fe77){return function(_0x1d82c7){if(_0x1d82c7){var _0x55ea2f=_0x1d82c7['count'],_0x37a07d=_0x42fe77[_0xebae('0x1a')],_0x1e750c=_0x42fe77[_0xebae('0x1a')]+_0x42fe77[_0xebae('0x1b')],_0x40fd06;if(_0x1e750c>=_0x55ea2f){_0x1e750c=_0x55ea2f;_0x40fd06=0xc8;}else{_0x40fd06=0xce;}_0xe7f2fc[_0xebae('0x19')](_0x40fd06);return _0xe7f2fc[_0xebae('0x1c')](_0xebae('0x1d'),_0x37a07d+'-'+_0x1e750c+'/'+_0x55ea2f)[_0xebae('0x1e')](_0x1d82c7);}return null;};}function patchUpdates(_0x47c111){return function(_0x2a1daf){try{jsonpatch[_0xebae('0x1f')](_0x2a1daf,_0x47c111,!![]);}catch(_0x21f160){return BPromise[_0xebae('0x20')](_0x21f160);}return _0x2a1daf[_0xebae('0x21')]();};}function saveUpdates(_0x1bcaf3,_0x4a081b){return function(_0x5b0240){if(_0x5b0240){return _0x5b0240[_0xebae('0x22')](_0x1bcaf3)['then'](function(_0x34323c){return _0x34323c;});}return null;};}function removeEntity(_0x3e0609,_0x1ad916){return function(_0x3d4af8){if(_0x3d4af8){return _0x3d4af8['destroy']()[_0xebae('0x23')](function(){_0x3e0609[_0xebae('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2166c9,_0x1ffa42){return function(_0x1dcdfc){if(!_0x1dcdfc){_0x2166c9[_0xebae('0x18')](0x194);}return _0x1dcdfc;};}function handleError(_0x334d15,_0x3e6fe5){_0x3e6fe5=_0x3e6fe5||0x1f4;return function(_0x3781e3){logger[_0xebae('0x24')](_0x3781e3['stack']);if(_0x3781e3['name']){delete _0x3781e3[_0xebae('0x25')];}_0x334d15[_0xebae('0x19')](_0x3e6fe5)['send'](_0x3781e3);};}exports[_0xebae('0x26')]=function(_0x39ae43,_0x34afac){var _0x267df9={},_0x28d0a0={},_0x504864={'count':0x0,'rows':[]};var _0x9a13d6=_['map'](db['MailServerOut']['rawAttributes'],function(_0x1bf4fb){return{'name':_0x1bf4fb[_0xebae('0x27')],'type':_0x1bf4fb[_0xebae('0x28')][_0xebae('0x29')]};});_0x28d0a0[_0xebae('0x2a')]=_['map'](_0x9a13d6,_0xebae('0x25'));_0x28d0a0['query']=_['keys'](_0x39ae43[_0xebae('0x2b')]);_0x28d0a0[_0xebae('0x2c')]=_[_0xebae('0x2d')](_0x28d0a0['model'],_0x28d0a0[_0xebae('0x2b')]);_0x267df9[_0xebae('0x2e')]=_['intersection'](_0x28d0a0['model'],qs[_0xebae('0x2f')](_0x39ae43[_0xebae('0x2b')]['fields']));_0x267df9['attributes']=_0x267df9['attributes']['length']?_0x267df9[_0xebae('0x2e')]:_0x28d0a0[_0xebae('0x2a')];if(!_0x39ae43['query'][_0xebae('0x30')]('nolimit')){_0x267df9[_0xebae('0x1b')]=qs[_0xebae('0x1b')](_0x39ae43[_0xebae('0x2b')][_0xebae('0x1b')]);_0x267df9['offset']=qs['offset'](_0x39ae43[_0xebae('0x2b')]['offset']);}_0x267df9[_0xebae('0x31')]=qs[_0xebae('0x32')](_0x39ae43['query'][_0xebae('0x32')]);_0x267df9[_0xebae('0x33')]=qs[_0xebae('0x2c')](_[_0xebae('0x34')](_0x39ae43[_0xebae('0x2b')],_0x28d0a0[_0xebae('0x2c')]),_0x9a13d6);if(_0x39ae43[_0xebae('0x2b')]['filter']){_0x267df9[_0xebae('0x33')]=_[_0xebae('0x35')](_0x267df9['where'],{'$or':_[_0xebae('0x36')](_0x9a13d6,function(_0x142c30){if(_0x142c30[_0xebae('0x28')]!==_0xebae('0x37')){var _0x1778cf={};_0x1778cf[_0x142c30[_0xebae('0x25')]]={'$like':'%'+_0x39ae43[_0xebae('0x2b')][_0xebae('0x38')]+'%'};return _0x1778cf;}})});}_0x267df9=_[_0xebae('0x35')]({},_0x267df9,_0x39ae43['options']);var _0x2a0df8={'where':_0x267df9[_0xebae('0x33')]};return db[_0xebae('0x39')][_0xebae('0x3a')](_0x2a0df8)[_0xebae('0x23')](function(_0x264d4a){_0x504864[_0xebae('0x3a')]=_0x264d4a;if(_0x39ae43[_0xebae('0x2b')]['includeAll']){_0x267df9[_0xebae('0x3b')]=[{'all':!![]}];}return db[_0xebae('0x39')][_0xebae('0x3c')](_0x267df9);})['then'](function(_0x1f21da){_0x504864['rows']=_0x1f21da;return _0x504864;})['then'](respondWithFilteredResult(_0x34afac,_0x267df9))[_0xebae('0x3d')](handleError(_0x34afac,null));};exports[_0xebae('0x3e')]=function(_0x6fdee1,_0x46df2d){var _0x506c86={'raw':!![],'where':{'id':_0x6fdee1[_0xebae('0x3f')]['id']}},_0x2f693e={};_0x2f693e['model']=_[_0xebae('0x40')](db['MailServerOut'][_0xebae('0x41')]);_0x2f693e[_0xebae('0x2b')]=_[_0xebae('0x40')](_0x6fdee1[_0xebae('0x2b')]);_0x2f693e[_0xebae('0x2c')]=_[_0xebae('0x2d')](_0x2f693e[_0xebae('0x2a')],_0x2f693e[_0xebae('0x2b')]);_0x506c86[_0xebae('0x2e')]=_[_0xebae('0x2d')](_0x2f693e[_0xebae('0x2a')],qs['fields'](_0x6fdee1[_0xebae('0x2b')][_0xebae('0x2f')]));_0x506c86[_0xebae('0x2e')]=_0x506c86[_0xebae('0x2e')]['length']?_0x506c86[_0xebae('0x2e')]:_0x2f693e[_0xebae('0x2a')];if(_0x6fdee1[_0xebae('0x2b')][_0xebae('0x42')]){_0x506c86[_0xebae('0x3b')]=[{'all':!![]}];}_0x506c86=_[_0xebae('0x35')]({},_0x506c86,_0x6fdee1[_0xebae('0x43')]);return db['MailServerOut']['find'](_0x506c86)['then'](handleEntityNotFound(_0x46df2d,null))[_0xebae('0x23')](respondWithResult(_0x46df2d,null))[_0xebae('0x3d')](handleError(_0x46df2d,null));};exports[_0xebae('0x44')]=function(_0x486d01,_0x56837c){return db[_0xebae('0x39')][_0xebae('0x44')](_0x486d01[_0xebae('0x45')],{})[_0xebae('0x23')](respondWithResult(_0x56837c,0xc9))['catch'](handleError(_0x56837c,null));};exports[_0xebae('0x22')]=function(_0x5e3f5e,_0x1a1b47){if(_0x5e3f5e[_0xebae('0x45')]['id']){delete _0x5e3f5e[_0xebae('0x45')]['id'];}return db[_0xebae('0x39')][_0xebae('0x46')]({'where':{'id':_0x5e3f5e[_0xebae('0x3f')]['id']}})[_0xebae('0x23')](handleEntityNotFound(_0x1a1b47,null))[_0xebae('0x23')](saveUpdates(_0x5e3f5e[_0xebae('0x45')],null))[_0xebae('0x23')](respondWithResult(_0x1a1b47,null))[_0xebae('0x3d')](handleError(_0x1a1b47,null));};exports[_0xebae('0x47')]=function(_0x254051,_0x17d939){return db[_0xebae('0x39')][_0xebae('0x46')]({'where':{'id':_0x254051[_0xebae('0x3f')]['id']}})[_0xebae('0x23')](handleEntityNotFound(_0x17d939,null))[_0xebae('0x23')](removeEntity(_0x17d939,null))[_0xebae('0x3d')](handleError(_0x17d939,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 7326580..cf60938 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 _0x24ca=['MailServerOut','mail_servers_out','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define'];(function(_0x5ce7f2,_0x79c537){var _0x3ca848=function(_0x2e38b0){while(--_0x2e38b0){_0x5ce7f2['push'](_0x5ce7f2['shift']());}};_0x3ca848(++_0x79c537);}(_0x24ca,0x1bc));var _0xa24c=function(_0x4f3c9b,_0x28e078){_0x4f3c9b=_0x4f3c9b-0x0;var _0x84e58a=_0x24ca[_0x4f3c9b];return _0x84e58a;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var logger=require(_0xa24c('0x1'))(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa24c('0x4'));var fs=require('fs');var path=require(_0xa24c('0x5'));var rimraf=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var attributes=require(_0xa24c('0x8'));module[_0xa24c('0x9')]=function(_0xf0511,_0x3c0aaa){return _0xf0511[_0xa24c('0xa')](_0xa24c('0xb'),attributes,{'tableName':_0xa24c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c5a=['define','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x307a07,_0x48b641){var _0x120421=function(_0x38c7b8){while(--_0x38c7b8){_0x307a07['push'](_0x307a07['shift']());}};_0x120421(++_0x48b641);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x2ec330,_0x4ccde2){_0x2ec330=_0x2ec330-0x0;var _0x49ff0e=_0x9c5a[_0x2ec330];return _0x49ff0e;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./mailServerOut.attributes');module[_0xa9c5('0x8')]=function(_0x4d9c7a,_0x394d84){return _0x4d9c7a[_0xa9c5('0x9')]('MailServerOut',attributes,{'tableName':'mail_servers_out','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 8fa6e51..28059b5 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 _0xd9ad=['debug','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','MailServerOut,\x20%s,\x20%s'];(function(_0xec6b2a,_0x38f6de){var _0x210f87=function(_0x903b52){while(--_0x903b52){_0xec6b2a['push'](_0xec6b2a['shift']());}};_0x210f87(++_0x38f6de);}(_0xd9ad,0x7c));var _0xdd9a=function(_0x10075c,_0x1c6300){_0x10075c=_0x10075c-0x0;var _0x410f78=_0xd9ad[_0x10075c];return _0x410f78;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdd9a('0x0'));var BPromise=require(_0xdd9a('0x1'));var rs=require(_0xdd9a('0x2'));var fs=require('fs');var Redis=require(_0xdd9a('0x3'));var db=require(_0xdd9a('0x4'))['db'];var utils=require(_0xdd9a('0x5'));var logger=require(_0xdd9a('0x6'))(_0xdd9a('0x7'));var config=require(_0xdd9a('0x8'));var jayson=require(_0xdd9a('0x9'));var client=jayson[_0xdd9a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3146bd,_0x469cef,_0x30042e){return new BPromise(function(_0x5a3cc8,_0x1f5756){return client['request'](_0x3146bd,_0x30042e)[_0xdd9a('0xb')](function(_0xb649dd){logger[_0xdd9a('0xc')](_0xdd9a('0xd'),_0x469cef,'request\x20sent');logger[_0xdd9a('0xe')](_0xdd9a('0xf'),_0x469cef,_0xdd9a('0x10'),JSON[_0xdd9a('0x11')](_0xb649dd));if(_0xb649dd[_0xdd9a('0x12')]){if(_0xb649dd[_0xdd9a('0x12')][_0xdd9a('0x13')]===0x1f4){logger['error'](_0xdd9a('0xd'),_0x469cef,_0xb649dd[_0xdd9a('0x12')][_0xdd9a('0x14')]);return _0x1f5756(_0xb649dd['error'][_0xdd9a('0x14')]);}logger[_0xdd9a('0x12')](_0xdd9a('0xd'),_0x469cef,_0xb649dd[_0xdd9a('0x12')]['message']);return _0x5a3cc8(_0xb649dd[_0xdd9a('0x12')][_0xdd9a('0x14')]);}else{logger['info'](_0xdd9a('0xd'),_0x469cef,_0xdd9a('0x10'));_0x5a3cc8(_0xb649dd[_0xdd9a('0x15')][_0xdd9a('0x14')]);}})[_0xdd9a('0x16')](function(_0x256e12){logger[_0xdd9a('0x12')]('MailServerOut,\x20%s,\x20%s',_0x469cef,_0x256e12);_0x1f5756(_0x256e12);});});} \ No newline at end of file +var _0x2ca5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment'];(function(_0x58e1d8,_0x376aa8){var _0x566728=function(_0x436e43){while(--_0x436e43){_0x58e1d8['push'](_0x58e1d8['shift']());}};_0x566728(++_0x376aa8);}(_0x2ca5,0x139));var _0x52ca=function(_0x451ef3,_0x4331d7){_0x451ef3=_0x451ef3-0x0;var _0x257295=_0x2ca5[_0x451ef3];return _0x257295;};'use strict';var _=require('lodash');var util=require(_0x52ca('0x0'));var moment=require(_0x52ca('0x1'));var BPromise=require('bluebird');var rs=require(_0x52ca('0x2'));var fs=require('fs');var Redis=require(_0x52ca('0x3'));var db=require(_0x52ca('0x4'))['db'];var utils=require(_0x52ca('0x5'));var logger=require(_0x52ca('0x6'))(_0x52ca('0x7'));var config=require(_0x52ca('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x52ca('0x9')][_0x52ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4287d0,_0x285391,_0x1d0445){return new BPromise(function(_0x4eb3dd,_0x1ec885){return client['request'](_0x4287d0,_0x1d0445)['then'](function(_0x5e05c1){logger['info'](_0x52ca('0xb'),_0x285391,_0x52ca('0xc'));logger[_0x52ca('0xd')](_0x52ca('0xe'),_0x285391,_0x52ca('0xc'),JSON[_0x52ca('0xf')](_0x5e05c1));if(_0x5e05c1['error']){if(_0x5e05c1[_0x52ca('0x10')][_0x52ca('0x11')]===0x1f4){logger[_0x52ca('0x10')](_0x52ca('0xb'),_0x285391,_0x5e05c1[_0x52ca('0x10')][_0x52ca('0x12')]);return _0x1ec885(_0x5e05c1[_0x52ca('0x10')][_0x52ca('0x12')]);}logger['error'](_0x52ca('0xb'),_0x285391,_0x5e05c1[_0x52ca('0x10')]['message']);return _0x4eb3dd(_0x5e05c1[_0x52ca('0x10')]['message']);}else{logger[_0x52ca('0x13')](_0x52ca('0xb'),_0x285391,_0x52ca('0xc'));_0x4eb3dd(_0x5e05c1['result'][_0x52ca('0x12')]);}})[_0x52ca('0x14')](function(_0x3cb48d){logger[_0x52ca('0x10')](_0x52ca('0xb'),_0x285391,_0x3cb48d);_0x1ec885(_0x3cb48d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 129e671..2f49a7f 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 _0xf832=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','show','/:id','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x257860,_0x2366ee){var _0x57972a=function(_0x16822c){while(--_0x16822c){_0x257860['push'](_0x257860['shift']());}};_0x57972a(++_0x2366ee);}(_0xf832,0x19b));var _0x2f83=function(_0x9c642a,_0x2bf217){_0x9c642a=_0x9c642a-0x0;var _0x2854e8=_0xf832[_0x9c642a];return _0x2854e8;};'use strict';var multer=require('multer');var util=require(_0x2f83('0x0'));var path=require(_0x2f83('0x1'));var timeout=require(_0x2f83('0x2'));var express=require(_0x2f83('0x3'));var router=express['Router']();var auth=require(_0x2f83('0x4'));var interaction=require(_0x2f83('0x5'));var config=require(_0x2f83('0x6'));var controller=require(_0x2f83('0x7'));router[_0x2f83('0x8')]('/',auth[_0x2f83('0x9')](),controller['index']);router[_0x2f83('0x8')](_0x2f83('0xa'),auth[_0x2f83('0x9')](),controller[_0x2f83('0xb')]);router['get']('/:id',auth[_0x2f83('0x9')](),controller[_0x2f83('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x2f83('0xd'),auth[_0x2f83('0x9')](),controller[_0x2f83('0xe')]);router[_0x2f83('0xf')]('/:id',auth[_0x2f83('0x9')](),controller[_0x2f83('0x10')]);module[_0x2f83('0x11')]=router; \ No newline at end of file +var _0xb3bb=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','show','delete','destroy','exports','util','path'];(function(_0x44f5e3,_0x580ec0){var _0x581ea9=function(_0x5e1640){while(--_0x5e1640){_0x44f5e3['push'](_0x44f5e3['shift']());}};_0x581ea9(++_0x580ec0);}(_0xb3bb,0x142));var _0xbb3b=function(_0x227187,_0x5e0666){_0x227187=_0x227187-0x0;var _0x16ebf4=_0xb3bb[_0x227187];return _0x16ebf4;};'use strict';var multer=require('multer');var util=require(_0xbb3b('0x0'));var path=require(_0xbb3b('0x1'));var timeout=require(_0xbb3b('0x2'));var express=require(_0xbb3b('0x3'));var router=express[_0xbb3b('0x4')]();var auth=require(_0xbb3b('0x5'));var interaction=require(_0xbb3b('0x6'));var config=require(_0xbb3b('0x7'));var controller=require(_0xbb3b('0x8'));router[_0xbb3b('0x9')]('/',auth[_0xbb3b('0xa')](),controller['index']);router['get'](_0xbb3b('0xb'),auth[_0xbb3b('0xa')](),controller[_0xbb3b('0xc')]);router['get'](_0xbb3b('0xd'),auth[_0xbb3b('0xa')](),controller[_0xbb3b('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xbb3b('0xd'),auth[_0xbb3b('0xa')](),controller['update']);router[_0xbb3b('0xf')](_0xbb3b('0xd'),auth[_0xbb3b('0xa')](),controller[_0xbb3b('0x10')]);module[_0xbb3b('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 42b25b6..f15225f 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 _0x97e6=['sequelize','STRING','name'];(function(_0x1c81c8,_0x70c123){var _0x4589de=function(_0x46b139){while(--_0x46b139){_0x1c81c8['push'](_0x1c81c8['shift']());}};_0x4589de(++_0x70c123);}(_0x97e6,0x159));var _0x697e=function(_0x56562d,_0x578183){_0x56562d=_0x56562d-0x0;var _0xdafef9=_0x97e6[_0x56562d];return _0xdafef9;};'use strict';var Sequelize=require(_0x697e('0x0'));module['exports']={'name':{'type':Sequelize[_0x697e('0x1')],'unique':_0x697e('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x697e('0x1')]}}; \ No newline at end of file +var _0x0324=['exports','STRING','name'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0324,0x90));var _0x4032=function(_0x3233de,_0x34415c){_0x3233de=_0x3233de-0x0;var _0x24e46b=_0x0324[_0x3233de];return _0x24e46b;};'use strict';var Sequelize=require('sequelize');module[_0x4032('0x0')]={'name':{'type':Sequelize[_0x4032('0x1')],'unique':_0x4032('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4032('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 6847922..16dd6df 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 _0x5d66=['squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','limit','set','apply','reject','update','then','destroy','stack','name','send','index','map','MailSubstatus','rawAttributes','type','key','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','lodash'];(function(_0x2c0c28,_0x394236){var _0x2e7a1d=function(_0x763fbf){while(--_0x763fbf){_0x2c0c28['push'](_0x2c0c28['shift']());}};_0x2e7a1d(++_0x394236);}(_0x5d66,0x164));var _0x65d6=function(_0x495cd1,_0x134956){_0x495cd1=_0x495cd1-0x0;var _0x247f26=_0x5d66[_0x495cd1];return _0x247f26;};'use strict';var pdf=require(_0x65d6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x65d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65d6('0x2'));var rp=require(_0x65d6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x65d6('0x4'));var path=require(_0x65d6('0x5'));var sox=require(_0x65d6('0x6'));var csv=require(_0x65d6('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x65d6('0x8'));var squel=require(_0x65d6('0x9'));var crypto=require('crypto');var jsforce=require(_0x65d6('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x65d6('0xb'));var Papa=require(_0x65d6('0xc'));var Redis=require(_0x65d6('0xd'));var authService=require(_0x65d6('0xe'));var qs=require(_0x65d6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x65d6('0x10'));var logger=require('../../config/logger')(_0x65d6('0x11'));var utils=require(_0x65d6('0x12'));var config=require(_0x65d6('0x13'));var licenseUtil=require(_0x65d6('0x14'));var db=require(_0x65d6('0x15'))['db'];function respondWithStatusCode(_0x59b72b,_0xb767cf){_0xb767cf=_0xb767cf||0xcc;return function(_0x4be8fb){if(_0x4be8fb){return _0x59b72b[_0x65d6('0x16')](_0xb767cf);}return _0x59b72b['status'](_0xb767cf)[_0x65d6('0x17')]();};}function respondWithResult(_0x218251,_0x6e45c8){_0x6e45c8=_0x6e45c8||0xc8;return function(_0x3f396f){if(_0x3f396f){return _0x218251[_0x65d6('0x18')](_0x6e45c8)[_0x65d6('0x19')](_0x3f396f);}};}function respondWithFilteredResult(_0x22839a,_0x4e30fc){return function(_0x328709){if(_0x328709){var _0x598f77=_0x328709[_0x65d6('0x1a')],_0x1d8201=_0x4e30fc['offset'],_0x402e6f=_0x4e30fc['offset']+_0x4e30fc[_0x65d6('0x1b')],_0x50d68d;if(_0x402e6f>=_0x598f77){_0x402e6f=_0x598f77;_0x50d68d=0xc8;}else{_0x50d68d=0xce;}_0x22839a[_0x65d6('0x18')](_0x50d68d);return _0x22839a[_0x65d6('0x1c')]('Content-Range',_0x1d8201+'-'+_0x402e6f+'/'+_0x598f77)[_0x65d6('0x19')](_0x328709);}return null;};}function patchUpdates(_0x2ca865){return function(_0xbcf54c){try{jsonpatch[_0x65d6('0x1d')](_0xbcf54c,_0x2ca865,!![]);}catch(_0x56452b){return BPromise[_0x65d6('0x1e')](_0x56452b);}return _0xbcf54c['save']();};}function saveUpdates(_0x2a848e,_0x220130){return function(_0x251731){if(_0x251731){return _0x251731[_0x65d6('0x1f')](_0x2a848e)[_0x65d6('0x20')](function(_0x46d0c0){return _0x46d0c0;});}return null;};}function removeEntity(_0x14f729,_0x154e26){return function(_0x1ebbc5){if(_0x1ebbc5){return _0x1ebbc5[_0x65d6('0x21')]()[_0x65d6('0x20')](function(){_0x14f729[_0x65d6('0x18')](0xcc)[_0x65d6('0x17')]();});}};}function handleEntityNotFound(_0x46688f,_0x5ce6be){return function(_0x5745ea){if(!_0x5745ea){_0x46688f[_0x65d6('0x16')](0x194);}return _0x5745ea;};}function handleError(_0x366acc,_0x2ca63a){_0x2ca63a=_0x2ca63a||0x1f4;return function(_0x4db297){logger['error'](_0x4db297[_0x65d6('0x22')]);if(_0x4db297[_0x65d6('0x23')]){delete _0x4db297[_0x65d6('0x23')];}_0x366acc[_0x65d6('0x18')](_0x2ca63a)[_0x65d6('0x24')](_0x4db297);};}exports[_0x65d6('0x25')]=function(_0x1e4599,_0x23bdd5){var _0x2e6f3d={},_0x2eae06={},_0x18f47e={'count':0x0,'rows':[]};var _0x25b616=_[_0x65d6('0x26')](db[_0x65d6('0x27')][_0x65d6('0x28')],function(_0x94f8e7){return{'name':_0x94f8e7['fieldName'],'type':_0x94f8e7[_0x65d6('0x29')][_0x65d6('0x2a')]};});_0x2eae06['model']=_[_0x65d6('0x26')](_0x25b616,_0x65d6('0x23'));_0x2eae06['query']=_['keys'](_0x1e4599['query']);_0x2eae06[_0x65d6('0x2b')]=_[_0x65d6('0x2c')](_0x2eae06[_0x65d6('0x2d')],_0x2eae06[_0x65d6('0x2e')]);_0x2e6f3d['attributes']=_[_0x65d6('0x2c')](_0x2eae06[_0x65d6('0x2d')],qs['fields'](_0x1e4599[_0x65d6('0x2e')][_0x65d6('0x2f')]));_0x2e6f3d[_0x65d6('0x30')]=_0x2e6f3d[_0x65d6('0x30')][_0x65d6('0x31')]?_0x2e6f3d[_0x65d6('0x30')]:_0x2eae06['model'];if(!_0x1e4599[_0x65d6('0x2e')][_0x65d6('0x32')](_0x65d6('0x33'))){_0x2e6f3d[_0x65d6('0x1b')]=qs['limit'](_0x1e4599[_0x65d6('0x2e')][_0x65d6('0x1b')]);_0x2e6f3d[_0x65d6('0x34')]=qs[_0x65d6('0x34')](_0x1e4599[_0x65d6('0x2e')][_0x65d6('0x34')]);}_0x2e6f3d[_0x65d6('0x35')]=qs[_0x65d6('0x36')](_0x1e4599[_0x65d6('0x2e')]['sort']);_0x2e6f3d['where']=qs[_0x65d6('0x2b')](_[_0x65d6('0x37')](_0x1e4599['query'],_0x2eae06[_0x65d6('0x2b')]),_0x25b616);if(_0x1e4599[_0x65d6('0x2e')][_0x65d6('0x38')]){_0x2e6f3d[_0x65d6('0x39')]=_[_0x65d6('0x3a')](_0x2e6f3d[_0x65d6('0x39')],{'$or':_[_0x65d6('0x26')](_0x25b616,function(_0x511635){if(_0x511635['type']!==_0x65d6('0x3b')){var _0x462516={};_0x462516[_0x511635[_0x65d6('0x23')]]={'$like':'%'+_0x1e4599[_0x65d6('0x2e')]['filter']+'%'};return _0x462516;}})});}_0x2e6f3d=_[_0x65d6('0x3a')]({},_0x2e6f3d,_0x1e4599['options']);var _0x4bef08={'where':_0x2e6f3d[_0x65d6('0x39')]};return db[_0x65d6('0x27')][_0x65d6('0x1a')](_0x4bef08)[_0x65d6('0x20')](function(_0x15d525){_0x18f47e['count']=_0x15d525;if(_0x1e4599[_0x65d6('0x2e')]['includeAll']){_0x2e6f3d[_0x65d6('0x3c')]=[{'all':!![]}];}return db[_0x65d6('0x27')][_0x65d6('0x3d')](_0x2e6f3d);})[_0x65d6('0x20')](function(_0x5309e3){_0x18f47e[_0x65d6('0x3e')]=_0x5309e3;return _0x18f47e;})[_0x65d6('0x20')](respondWithFilteredResult(_0x23bdd5,_0x2e6f3d))[_0x65d6('0x3f')](handleError(_0x23bdd5,null));};exports[_0x65d6('0x40')]=function(_0x4e1d0e,_0x4860e8){var _0x35024a={'raw':!![],'where':{'id':_0x4e1d0e[_0x65d6('0x41')]['id']}},_0x245cb5={};_0x245cb5[_0x65d6('0x2d')]=_[_0x65d6('0x42')](db[_0x65d6('0x27')]['rawAttributes']);_0x245cb5['query']=_[_0x65d6('0x42')](_0x4e1d0e['query']);_0x245cb5['filters']=_[_0x65d6('0x2c')](_0x245cb5[_0x65d6('0x2d')],_0x245cb5[_0x65d6('0x2e')]);_0x35024a[_0x65d6('0x30')]=_[_0x65d6('0x2c')](_0x245cb5[_0x65d6('0x2d')],qs['fields'](_0x4e1d0e[_0x65d6('0x2e')][_0x65d6('0x2f')]));_0x35024a['attributes']=_0x35024a[_0x65d6('0x30')][_0x65d6('0x31')]?_0x35024a['attributes']:_0x245cb5['model'];if(_0x4e1d0e[_0x65d6('0x2e')][_0x65d6('0x43')]){_0x35024a[_0x65d6('0x3c')]=[{'all':!![]}];}_0x35024a=_[_0x65d6('0x3a')]({},_0x35024a,_0x4e1d0e[_0x65d6('0x44')]);return db[_0x65d6('0x27')][_0x65d6('0x45')](_0x35024a)[_0x65d6('0x20')](handleEntityNotFound(_0x4860e8,null))[_0x65d6('0x20')](respondWithResult(_0x4860e8,null))[_0x65d6('0x3f')](handleError(_0x4860e8,null));};exports[_0x65d6('0x46')]=function(_0x5ba298,_0x307a1b){return db[_0x65d6('0x27')][_0x65d6('0x46')](_0x5ba298[_0x65d6('0x47')],{})[_0x65d6('0x20')](respondWithResult(_0x307a1b,0xc9))[_0x65d6('0x3f')](handleError(_0x307a1b,null));};exports[_0x65d6('0x1f')]=function(_0x13fd2f,_0x4ea9f0){if(_0x13fd2f['body']['id']){delete _0x13fd2f[_0x65d6('0x47')]['id'];}return db[_0x65d6('0x27')][_0x65d6('0x45')]({'where':{'id':_0x13fd2f[_0x65d6('0x41')]['id']}})['then'](handleEntityNotFound(_0x4ea9f0,null))['then'](saveUpdates(_0x13fd2f[_0x65d6('0x47')],null))[_0x65d6('0x20')](respondWithResult(_0x4ea9f0,null))[_0x65d6('0x3f')](handleError(_0x4ea9f0,null));};exports[_0x65d6('0x21')]=function(_0x19d32b,_0x186aa8){return db['MailSubstatus'][_0x65d6('0x45')]({'where':{'id':_0x19d32b['params']['id']}})[_0x65d6('0x20')](handleEntityNotFound(_0x186aa8,null))[_0x65d6('0x20')](removeEntity(_0x186aa8,null))[_0x65d6('0x3f')](handleError(_0x186aa8,null));};exports[_0x65d6('0x48')]=function(_0x586ef9,_0x28c15c){return db[_0x65d6('0x27')]['describe']()[_0x65d6('0x20')](respondWithResult(_0x28c15c,null))['catch'](handleError(_0x28c15c,null));}; \ No newline at end of file +var _0xe4ed=['include','findAll','rows','catch','params','length','includeAll','create','body','update','describe','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','MailSubstatus'];(function(_0x320e94,_0x4140b1){var _0x1002be=function(_0x3244e2){while(--_0x3244e2){_0x320e94['push'](_0x320e94['shift']());}};_0x1002be(++_0x4140b1);}(_0xe4ed,0x187));var _0xde4e=function(_0x233e57,_0x4a7ae2){_0x233e57=_0x233e57-0x0;var _0x463c2c=_0xe4ed[_0x233e57];return _0x463c2c;};'use strict';var pdf=require(_0xde4e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xde4e('0x1'));var jsonpatch=require(_0xde4e('0x2'));var rp=require(_0xde4e('0x3'));var moment=require('moment');var BPromise=require(_0xde4e('0x4'));var Mustache=require(_0xde4e('0x5'));var util=require(_0xde4e('0x6'));var path=require(_0xde4e('0x7'));var sox=require(_0xde4e('0x8'));var csv=require('to-csv');var ejs=require(_0xde4e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xde4e('0xa'));var crypto=require('crypto');var jsforce=require(_0xde4e('0xb'));var deskjs=require(_0xde4e('0xc'));var toCsv=require(_0xde4e('0xd'));var querystring=require(_0xde4e('0xe'));var Papa=require(_0xde4e('0xf'));var Redis=require(_0xde4e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xde4e('0x11'));var as=require(_0xde4e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xde4e('0x13'))(_0xde4e('0x14'));var utils=require(_0xde4e('0x15'));var config=require(_0xde4e('0x16'));var licenseUtil=require(_0xde4e('0x17'));var db=require(_0xde4e('0x18'))['db'];function respondWithStatusCode(_0x56ecac,_0x2a9f81){_0x2a9f81=_0x2a9f81||0xcc;return function(_0x26cc14){if(_0x26cc14){return _0x56ecac['sendStatus'](_0x2a9f81);}return _0x56ecac[_0xde4e('0x19')](_0x2a9f81)[_0xde4e('0x1a')]();};}function respondWithResult(_0x384c26,_0x2a8611){_0x2a8611=_0x2a8611||0xc8;return function(_0x1129a7){if(_0x1129a7){return _0x384c26[_0xde4e('0x19')](_0x2a8611)[_0xde4e('0x1b')](_0x1129a7);}};}function respondWithFilteredResult(_0x12588e,_0x616df9){return function(_0x5f0ca8){if(_0x5f0ca8){var _0x111989=_0x5f0ca8[_0xde4e('0x1c')],_0xec92f5=_0x616df9[_0xde4e('0x1d')],_0x42ad90=_0x616df9[_0xde4e('0x1d')]+_0x616df9['limit'],_0x2d953d;if(_0x42ad90>=_0x111989){_0x42ad90=_0x111989;_0x2d953d=0xc8;}else{_0x2d953d=0xce;}_0x12588e[_0xde4e('0x19')](_0x2d953d);return _0x12588e['set'](_0xde4e('0x1e'),_0xec92f5+'-'+_0x42ad90+'/'+_0x111989)['json'](_0x5f0ca8);}return null;};}function patchUpdates(_0x538c4a){return function(_0x1cde7d){try{jsonpatch[_0xde4e('0x1f')](_0x1cde7d,_0x538c4a,!![]);}catch(_0xcd945b){return BPromise[_0xde4e('0x20')](_0xcd945b);}return _0x1cde7d[_0xde4e('0x21')]();};}function saveUpdates(_0xffe4a0,_0x325000){return function(_0x4c6d15){if(_0x4c6d15){return _0x4c6d15['update'](_0xffe4a0)['then'](function(_0x11a665){return _0x11a665;});}return null;};}function removeEntity(_0x199cbb,_0x54c9a3){return function(_0xfc9d42){if(_0xfc9d42){return _0xfc9d42[_0xde4e('0x22')]()[_0xde4e('0x23')](function(){_0x199cbb[_0xde4e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3449f2,_0xe83de1){return function(_0x5d3a44){if(!_0x5d3a44){_0x3449f2[_0xde4e('0x24')](0x194);}return _0x5d3a44;};}function handleError(_0x1ce6bc,_0x3f7a54){_0x3f7a54=_0x3f7a54||0x1f4;return function(_0x54d4f5){logger[_0xde4e('0x25')](_0x54d4f5[_0xde4e('0x26')]);if(_0x54d4f5[_0xde4e('0x27')]){delete _0x54d4f5[_0xde4e('0x27')];}_0x1ce6bc[_0xde4e('0x19')](_0x3f7a54)[_0xde4e('0x28')](_0x54d4f5);};}exports[_0xde4e('0x29')]=function(_0x17ed59,_0x14c7f8){var _0x1bddef={},_0x3fdd44={},_0x56283b={'count':0x0,'rows':[]};var _0x340a02=_[_0xde4e('0x2a')](db['MailSubstatus'][_0xde4e('0x2b')],function(_0x1f7026){return{'name':_0x1f7026[_0xde4e('0x2c')],'type':_0x1f7026[_0xde4e('0x2d')]['key']};});_0x3fdd44[_0xde4e('0x2e')]=_['map'](_0x340a02,_0xde4e('0x27'));_0x3fdd44['query']=_[_0xde4e('0x2f')](_0x17ed59['query']);_0x3fdd44[_0xde4e('0x30')]=_[_0xde4e('0x31')](_0x3fdd44[_0xde4e('0x2e')],_0x3fdd44[_0xde4e('0x32')]);_0x1bddef['attributes']=_[_0xde4e('0x31')](_0x3fdd44[_0xde4e('0x2e')],qs[_0xde4e('0x33')](_0x17ed59['query']['fields']));_0x1bddef['attributes']=_0x1bddef['attributes']['length']?_0x1bddef[_0xde4e('0x34')]:_0x3fdd44[_0xde4e('0x2e')];if(!_0x17ed59[_0xde4e('0x32')][_0xde4e('0x35')](_0xde4e('0x36'))){_0x1bddef[_0xde4e('0x37')]=qs[_0xde4e('0x37')](_0x17ed59['query']['limit']);_0x1bddef[_0xde4e('0x1d')]=qs[_0xde4e('0x1d')](_0x17ed59[_0xde4e('0x32')][_0xde4e('0x1d')]);}_0x1bddef[_0xde4e('0x38')]=qs[_0xde4e('0x39')](_0x17ed59[_0xde4e('0x32')]['sort']);_0x1bddef[_0xde4e('0x3a')]=qs[_0xde4e('0x30')](_[_0xde4e('0x3b')](_0x17ed59[_0xde4e('0x32')],_0x3fdd44[_0xde4e('0x30')]),_0x340a02);if(_0x17ed59['query']['filter']){_0x1bddef[_0xde4e('0x3a')]=_[_0xde4e('0x3c')](_0x1bddef['where'],{'$or':_[_0xde4e('0x2a')](_0x340a02,function(_0x1c9439){if(_0x1c9439[_0xde4e('0x2d')]!==_0xde4e('0x3d')){var _0x10de22={};_0x10de22[_0x1c9439[_0xde4e('0x27')]]={'$like':'%'+_0x17ed59[_0xde4e('0x32')][_0xde4e('0x3e')]+'%'};return _0x10de22;}})});}_0x1bddef=_[_0xde4e('0x3c')]({},_0x1bddef,_0x17ed59[_0xde4e('0x3f')]);var _0x2a7cd0={'where':_0x1bddef[_0xde4e('0x3a')]};return db[_0xde4e('0x40')][_0xde4e('0x1c')](_0x2a7cd0)['then'](function(_0x54baf9){_0x56283b['count']=_0x54baf9;if(_0x17ed59[_0xde4e('0x32')]['includeAll']){_0x1bddef[_0xde4e('0x41')]=[{'all':!![]}];}return db[_0xde4e('0x40')][_0xde4e('0x42')](_0x1bddef);})['then'](function(_0x2858f8){_0x56283b[_0xde4e('0x43')]=_0x2858f8;return _0x56283b;})['then'](respondWithFilteredResult(_0x14c7f8,_0x1bddef))[_0xde4e('0x44')](handleError(_0x14c7f8,null));};exports['show']=function(_0x415b71,_0x13a3b0){var _0x1c1770={'raw':!![],'where':{'id':_0x415b71[_0xde4e('0x45')]['id']}},_0x57abeb={};_0x57abeb['model']=_[_0xde4e('0x2f')](db['MailSubstatus'][_0xde4e('0x2b')]);_0x57abeb['query']=_[_0xde4e('0x2f')](_0x415b71[_0xde4e('0x32')]);_0x57abeb[_0xde4e('0x30')]=_[_0xde4e('0x31')](_0x57abeb[_0xde4e('0x2e')],_0x57abeb[_0xde4e('0x32')]);_0x1c1770[_0xde4e('0x34')]=_[_0xde4e('0x31')](_0x57abeb[_0xde4e('0x2e')],qs[_0xde4e('0x33')](_0x415b71['query']['fields']));_0x1c1770[_0xde4e('0x34')]=_0x1c1770[_0xde4e('0x34')][_0xde4e('0x46')]?_0x1c1770[_0xde4e('0x34')]:_0x57abeb['model'];if(_0x415b71[_0xde4e('0x32')][_0xde4e('0x47')]){_0x1c1770['include']=[{'all':!![]}];}_0x1c1770=_[_0xde4e('0x3c')]({},_0x1c1770,_0x415b71[_0xde4e('0x3f')]);return db['MailSubstatus']['find'](_0x1c1770)['then'](handleEntityNotFound(_0x13a3b0,null))[_0xde4e('0x23')](respondWithResult(_0x13a3b0,null))[_0xde4e('0x44')](handleError(_0x13a3b0,null));};exports[_0xde4e('0x48')]=function(_0x47ead4,_0x30af8b){return db[_0xde4e('0x40')][_0xde4e('0x48')](_0x47ead4[_0xde4e('0x49')],{})['then'](respondWithResult(_0x30af8b,0xc9))[_0xde4e('0x44')](handleError(_0x30af8b,null));};exports[_0xde4e('0x4a')]=function(_0xf549dd,_0x353ab5){if(_0xf549dd['body']['id']){delete _0xf549dd[_0xde4e('0x49')]['id'];}return db[_0xde4e('0x40')]['find']({'where':{'id':_0xf549dd[_0xde4e('0x45')]['id']}})['then'](handleEntityNotFound(_0x353ab5,null))['then'](saveUpdates(_0xf549dd[_0xde4e('0x49')],null))['then'](respondWithResult(_0x353ab5,null))[_0xde4e('0x44')](handleError(_0x353ab5,null));};exports['destroy']=function(_0x43d693,_0x289a43){return db[_0xde4e('0x40')]['find']({'where':{'id':_0x43d693[_0xde4e('0x45')]['id']}})[_0xde4e('0x23')](handleEntityNotFound(_0x289a43,null))[_0xde4e('0x23')](removeEntity(_0x289a43,null))[_0xde4e('0x44')](handleError(_0x289a43,null));};exports[_0xde4e('0x4b')]=function(_0x4be2a8,_0x451fc3){return db[_0xde4e('0x40')][_0xde4e('0x4b')]()['then'](respondWithResult(_0x451fc3,null))[_0xde4e('0x44')](handleError(_0x451fc3,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index e154351..03f5276 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 _0x48ac=['../../config/environment','./mailSubstatus.attributes','exports','mail_substatuses','util','api','moment','bluebird','path','rimraf'];(function(_0x285b48,_0x41b4c6){var _0x5020e9=function(_0x537f18){while(--_0x537f18){_0x285b48['push'](_0x285b48['shift']());}};_0x5020e9(++_0x41b4c6);}(_0x48ac,0xe0));var _0xc48a=function(_0x36b12e,_0x47f816){_0x36b12e=_0x36b12e-0x0;var _0x18308f=_0x48ac[_0x36b12e];return _0x18308f;};'use strict';var _=require('lodash');var util=require(_0xc48a('0x0'));var logger=require('../../config/logger')(_0xc48a('0x1'));var moment=require(_0xc48a('0x2'));var BPromise=require(_0xc48a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc48a('0x4'));var rimraf=require(_0xc48a('0x5'));var config=require(_0xc48a('0x6'));var attributes=require(_0xc48a('0x7'));module[_0xc48a('0x8')]=function(_0x499749,_0x48205f){return _0x499749['define']('MailSubstatus',attributes,{'tableName':_0xc48a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73a1=['mail_substatuses','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailSubstatus'];(function(_0x223409,_0x25af64){var _0x31fa8d=function(_0x2ab57d){while(--_0x2ab57d){_0x223409['push'](_0x223409['shift']());}};_0x31fa8d(++_0x25af64);}(_0x73a1,0x161));var _0x173a=function(_0x44f974,_0x4db616){_0x44f974=_0x44f974-0x0;var _0x805dbd=_0x73a1[_0x44f974];return _0x805dbd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x173a('0x0'))(_0x173a('0x1'));var moment=require('moment');var BPromise=require(_0x173a('0x2'));var rp=require(_0x173a('0x3'));var fs=require('fs');var path=require(_0x173a('0x4'));var rimraf=require(_0x173a('0x5'));var config=require(_0x173a('0x6'));var attributes=require('./mailSubstatus.attributes');module[_0x173a('0x7')]=function(_0x1a8b94,_0xac84a){return _0x1a8b94[_0x173a('0x8')](_0x173a('0x9'),attributes,{'tableName':_0x173a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index a6c04ed..99ea720 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 _0x0a9a=['MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x2ea384,_0x20e770){var _0x4d591e=function(_0x3289d0){while(--_0x3289d0){_0x2ea384['push'](_0x2ea384['shift']());}};_0x4d591e(++_0x20e770);}(_0x0a9a,0x183));var _0xa0a9=function(_0xc8366a,_0x377070){_0xc8366a=_0xc8366a-0x0;var _0x610f4e=_0x0a9a[_0xc8366a];return _0x610f4e;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});} \ No newline at end of file +var _0x0a9a=['MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x343090,_0x433a80){var _0x3ff3e8=function(_0x16c811){while(--_0x16c811){_0x343090['push'](_0x343090['shift']());}};_0x3ff3e8(++_0x433a80);}(_0x0a9a,0x183));var _0xa0a9=function(_0x279e5f,_0x467a82){_0x279e5f=_0x279e5f-0x0;var _0x5399ec=_0x0a9a[_0x279e5f];return _0x5399ec;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 6f591f0..ccf6620 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 _0xe731=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','put','update','delete','multer'];(function(_0x3b4695,_0x352012){var _0x1f16fc=function(_0x2a079d){while(--_0x2a079d){_0x3b4695['push'](_0x3b4695['shift']());}};_0x1f16fc(++_0x352012);}(_0xe731,0xd0));var _0x1e73=function(_0x38272a,_0x2dd237){_0x38272a=_0x38272a-0x0;var _0x5b06c5=_0xe731[_0x38272a];return _0x5b06c5;};'use strict';var multer=require(_0x1e73('0x0'));var util=require('util');var path=require(_0x1e73('0x1'));var timeout=require(_0x1e73('0x2'));var express=require(_0x1e73('0x3'));var router=express[_0x1e73('0x4')]();var auth=require(_0x1e73('0x5'));var interaction=require(_0x1e73('0x6'));var config=require(_0x1e73('0x7'));var controller=require(_0x1e73('0x8'));router['get']('/',auth[_0x1e73('0x9')](),controller[_0x1e73('0xa')]);router[_0x1e73('0xb')](_0x1e73('0xc'),auth[_0x1e73('0x9')](),controller[_0x1e73('0xd')]);router[_0x1e73('0xb')](_0x1e73('0xe'),auth[_0x1e73('0x9')](),controller['show']);router[_0x1e73('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1e73('0x10')]('/:id',auth[_0x1e73('0x9')](),controller[_0x1e73('0x11')]);router[_0x1e73('0x12')](_0x1e73('0xe'),auth[_0x1e73('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x46e8=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x11ce39,_0x3ac6a0){var _0x426a41=function(_0x855944){while(--_0x855944){_0x11ce39['push'](_0x11ce39['shift']());}};_0x426a41(++_0x3ac6a0);}(_0x46e8,0x88));var _0x846e=function(_0xc72193,_0x25626a){_0xc72193=_0xc72193-0x0;var _0x5f48b2=_0x46e8[_0xc72193];return _0x5f48b2;};'use strict';var multer=require(_0x846e('0x0'));var util=require(_0x846e('0x1'));var path=require('path');var timeout=require(_0x846e('0x2'));var express=require(_0x846e('0x3'));var router=express['Router']();var auth=require(_0x846e('0x4'));var interaction=require(_0x846e('0x5'));var config=require(_0x846e('0x6'));var controller=require('./mailTransferReport.controller');router[_0x846e('0x7')]('/',auth[_0x846e('0x8')](),controller[_0x846e('0x9')]);router[_0x846e('0x7')](_0x846e('0xa'),auth[_0x846e('0x8')](),controller['describe']);router[_0x846e('0x7')]('/:id',auth[_0x846e('0x8')](),controller[_0x846e('0xb')]);router[_0x846e('0xc')]('/',auth[_0x846e('0x8')](),controller[_0x846e('0xd')]);router[_0x846e('0xe')](_0x846e('0xf'),auth[_0x846e('0x8')](),controller[_0x846e('0x10')]);router[_0x846e('0x11')](_0x846e('0xf'),auth[_0x846e('0x8')](),controller[_0x846e('0x12')]);module[_0x846e('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 6be1e69..a86e3bb 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 _0xa6fe=['DATE','NOW','moment','exports','STRING','account','agent','queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa6fe,0x1da));var _0xea6f=function(_0x10bde6,_0x4fa67c){_0x10bde6=_0x10bde6-0x0;var _0x40181f=_0xa6fe[_0x10bde6];return _0x40181f;};'use strict';var moment=require(_0xea6f('0x0'));var Sequelize=require('sequelize');module[_0xea6f('0x1')]={'uniqueid':{'type':Sequelize[_0xea6f('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xea6f('0x3'),_0xea6f('0x4'),_0xea6f('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xea6f('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xea6f('0x7')]}}; \ No newline at end of file +var _0x3fdf=['ENUM','account','agent','queue','NOW','moment','exports'];(function(_0x148c62,_0x10c795){var _0x4b7f8e=function(_0x27f649){while(--_0x27f649){_0x148c62['push'](_0x148c62['shift']());}};_0x4b7f8e(++_0x10c795);}(_0x3fdf,0x75));var _0xf3fd=function(_0x1f5ffd,_0x3bc33c){_0x1f5ffd=_0x1f5ffd-0x0;var _0x4f5695=_0x3fdf[_0x1f5ffd];return _0x4f5695;};'use strict';var moment=require(_0xf3fd('0x0'));var Sequelize=require('sequelize');module[_0xf3fd('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf3fd('0x2')](_0xf3fd('0x3'),_0xf3fd('0x4'),_0xf3fd('0x5')),'allowNull':![],'defaultValue':_0xf3fd('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xf3fd('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 9caed82..20b2734 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 _0x4a84=['MailTransferReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send'];(function(_0x242a98,_0x13988e){var _0x580999=function(_0x341927){while(--_0x341927){_0x242a98['push'](_0x242a98['shift']());}};_0x580999(++_0x13988e);}(_0x4a84,0x151));var _0x44a8=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4a84[_0x21a9d9];return _0x46adce;};'use strict';var pdf=require(_0x44a8('0x0'));var emlformat=require(_0x44a8('0x1'));var rimraf=require(_0x44a8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x44a8('0x3'));var rp=require(_0x44a8('0x4'));var moment=require(_0x44a8('0x5'));var BPromise=require(_0x44a8('0x6'));var Mustache=require(_0x44a8('0x7'));var util=require(_0x44a8('0x8'));var path=require(_0x44a8('0x9'));var sox=require(_0x44a8('0xa'));var csv=require(_0x44a8('0xb'));var ejs=require(_0x44a8('0xc'));var fs=require('fs');var _=require(_0x44a8('0xd'));var squel=require(_0x44a8('0xe'));var crypto=require(_0x44a8('0xf'));var jsforce=require(_0x44a8('0x10'));var deskjs=require(_0x44a8('0x11'));var toCsv=require(_0x44a8('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x44a8('0x12'));var authService=require(_0x44a8('0x13'));var qs=require(_0x44a8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x44a8('0x15'));var logger=require('../../config/logger')(_0x44a8('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x44a8('0x17'))['db'];function respondWithStatusCode(_0x4e2b6c,_0x5838f5){_0x5838f5=_0x5838f5||0xcc;return function(_0x482c24){if(_0x482c24){return _0x4e2b6c[_0x44a8('0x18')](_0x5838f5);}return _0x4e2b6c['status'](_0x5838f5)['end']();};}function respondWithResult(_0xea66fe,_0x2a9872){_0x2a9872=_0x2a9872||0xc8;return function(_0x2a5cb5){if(_0x2a5cb5){return _0xea66fe[_0x44a8('0x19')](_0x2a9872)[_0x44a8('0x1a')](_0x2a5cb5);}};}function respondWithFilteredResult(_0x3ab4c1,_0x555c5b){return function(_0x21fe7b){if(_0x21fe7b){var _0x16438a=_0x21fe7b[_0x44a8('0x1b')],_0x4af3f4=_0x555c5b['offset'],_0x43bad4=_0x555c5b[_0x44a8('0x1c')]+_0x555c5b[_0x44a8('0x1d')],_0x361ff6;if(_0x43bad4>=_0x16438a){_0x43bad4=_0x16438a;_0x361ff6=0xc8;}else{_0x361ff6=0xce;}_0x3ab4c1['status'](_0x361ff6);return _0x3ab4c1[_0x44a8('0x1e')](_0x44a8('0x1f'),_0x4af3f4+'-'+_0x43bad4+'/'+_0x16438a)['json'](_0x21fe7b);}return null;};}function patchUpdates(_0x58f951){return function(_0x53c903){try{jsonpatch[_0x44a8('0x20')](_0x53c903,_0x58f951,!![]);}catch(_0xceee50){return BPromise[_0x44a8('0x21')](_0xceee50);}return _0x53c903[_0x44a8('0x22')]();};}function saveUpdates(_0x4661a0,_0x2f203c){return function(_0x4486bd){if(_0x4486bd){return _0x4486bd[_0x44a8('0x23')](_0x4661a0)[_0x44a8('0x24')](function(_0x4e304f){return _0x4e304f;});}return null;};}function removeEntity(_0x22c3af,_0x1c055d){return function(_0xeae371){if(_0xeae371){return _0xeae371[_0x44a8('0x25')]()[_0x44a8('0x24')](function(){_0x22c3af['status'](0xcc)[_0x44a8('0x26')]();});}};}function handleEntityNotFound(_0x3e37fd,_0x29d848){return function(_0x3a25d6){if(!_0x3a25d6){_0x3e37fd[_0x44a8('0x18')](0x194);}return _0x3a25d6;};}function handleError(_0x40abea,_0x35697e){_0x35697e=_0x35697e||0x1f4;return function(_0x19d682){logger[_0x44a8('0x27')](_0x19d682[_0x44a8('0x28')]);if(_0x19d682[_0x44a8('0x29')]){delete _0x19d682[_0x44a8('0x29')];}_0x40abea[_0x44a8('0x19')](_0x35697e)[_0x44a8('0x2a')](_0x19d682);};}exports['index']=function(_0x9f92f6,_0x440db6){var _0x106154={},_0x2e6ebb={},_0x245c56={'count':0x0,'rows':[]};var _0x124593=_['map'](db[_0x44a8('0x2b')][_0x44a8('0x2c')],function(_0x16ece7){return{'name':_0x16ece7['fieldName'],'type':_0x16ece7[_0x44a8('0x2d')][_0x44a8('0x2e')]};});_0x2e6ebb[_0x44a8('0x2f')]=_[_0x44a8('0x30')](_0x124593,_0x44a8('0x29'));_0x2e6ebb[_0x44a8('0x31')]=_[_0x44a8('0x32')](_0x9f92f6[_0x44a8('0x31')]);_0x2e6ebb[_0x44a8('0x33')]=_[_0x44a8('0x34')](_0x2e6ebb[_0x44a8('0x2f')],_0x2e6ebb[_0x44a8('0x31')]);_0x106154[_0x44a8('0x35')]=_[_0x44a8('0x34')](_0x2e6ebb[_0x44a8('0x2f')],qs['fields'](_0x9f92f6[_0x44a8('0x31')][_0x44a8('0x36')]));_0x106154[_0x44a8('0x35')]=_0x106154[_0x44a8('0x35')][_0x44a8('0x37')]?_0x106154['attributes']:_0x2e6ebb[_0x44a8('0x2f')];if(!_0x9f92f6[_0x44a8('0x31')][_0x44a8('0x38')](_0x44a8('0x39'))){_0x106154[_0x44a8('0x1d')]=qs[_0x44a8('0x1d')](_0x9f92f6['query'][_0x44a8('0x1d')]);_0x106154[_0x44a8('0x1c')]=qs['offset'](_0x9f92f6[_0x44a8('0x31')][_0x44a8('0x1c')]);}_0x106154[_0x44a8('0x3a')]=qs[_0x44a8('0x3b')](_0x9f92f6[_0x44a8('0x31')][_0x44a8('0x3b')]);_0x106154[_0x44a8('0x3c')]=qs[_0x44a8('0x33')](_['pick'](_0x9f92f6['query'],_0x2e6ebb['filters']),_0x124593);if(_0x9f92f6['query'][_0x44a8('0x3d')]){_0x106154['where']=_[_0x44a8('0x3e')](_0x106154[_0x44a8('0x3c')],{'$or':_[_0x44a8('0x30')](_0x124593,function(_0x27fdac){if(_0x27fdac['type']!==_0x44a8('0x3f')){var _0x4e38bf={};_0x4e38bf[_0x27fdac[_0x44a8('0x29')]]={'$like':'%'+_0x9f92f6[_0x44a8('0x31')]['filter']+'%'};return _0x4e38bf;}})});}_0x106154=_[_0x44a8('0x3e')]({},_0x106154,_0x9f92f6[_0x44a8('0x40')]);var _0x18585e={'where':_0x106154[_0x44a8('0x3c')]};return db[_0x44a8('0x2b')][_0x44a8('0x1b')](_0x18585e)['then'](function(_0x149aa6){_0x245c56['count']=_0x149aa6;if(_0x9f92f6['query'][_0x44a8('0x41')]){_0x106154[_0x44a8('0x42')]=[{'all':!![]}];}return db[_0x44a8('0x2b')][_0x44a8('0x43')](_0x106154);})['then'](function(_0x1833b7){_0x245c56[_0x44a8('0x44')]=_0x1833b7;return _0x245c56;})[_0x44a8('0x24')](respondWithFilteredResult(_0x440db6,_0x106154))[_0x44a8('0x45')](handleError(_0x440db6,null));};exports[_0x44a8('0x46')]=function(_0x3ca153,_0x58352a){var _0x153928={'raw':!![],'where':{'id':_0x3ca153[_0x44a8('0x47')]['id']}},_0x5d7680={};_0x5d7680[_0x44a8('0x2f')]=_[_0x44a8('0x32')](db[_0x44a8('0x2b')][_0x44a8('0x2c')]);_0x5d7680[_0x44a8('0x31')]=_[_0x44a8('0x32')](_0x3ca153[_0x44a8('0x31')]);_0x5d7680[_0x44a8('0x33')]=_[_0x44a8('0x34')](_0x5d7680[_0x44a8('0x2f')],_0x5d7680[_0x44a8('0x31')]);_0x153928[_0x44a8('0x35')]=_[_0x44a8('0x34')](_0x5d7680[_0x44a8('0x2f')],qs[_0x44a8('0x36')](_0x3ca153[_0x44a8('0x31')][_0x44a8('0x36')]));_0x153928[_0x44a8('0x35')]=_0x153928[_0x44a8('0x35')][_0x44a8('0x37')]?_0x153928[_0x44a8('0x35')]:_0x5d7680['model'];if(_0x3ca153['query'][_0x44a8('0x41')]){_0x153928[_0x44a8('0x42')]=[{'all':!![]}];}_0x153928=_[_0x44a8('0x3e')]({},_0x153928,_0x3ca153[_0x44a8('0x40')]);return db['MailTransferReport']['find'](_0x153928)[_0x44a8('0x24')](handleEntityNotFound(_0x58352a,null))['then'](respondWithResult(_0x58352a,null))[_0x44a8('0x45')](handleError(_0x58352a,null));};exports[_0x44a8('0x48')]=function(_0x306876,_0x5b2945){return db[_0x44a8('0x2b')][_0x44a8('0x48')](_0x306876[_0x44a8('0x49')],{})[_0x44a8('0x24')](respondWithResult(_0x5b2945,0xc9))[_0x44a8('0x45')](handleError(_0x5b2945,null));};exports[_0x44a8('0x23')]=function(_0x3eb49b,_0x1bef3d){if(_0x3eb49b['body']['id']){delete _0x3eb49b[_0x44a8('0x49')]['id'];}return db['MailTransferReport'][_0x44a8('0x4a')]({'where':{'id':_0x3eb49b[_0x44a8('0x47')]['id']}})[_0x44a8('0x24')](handleEntityNotFound(_0x1bef3d,null))[_0x44a8('0x24')](saveUpdates(_0x3eb49b['body'],null))['then'](respondWithResult(_0x1bef3d,null))[_0x44a8('0x45')](handleError(_0x1bef3d,null));};exports[_0x44a8('0x25')]=function(_0x25a3a8,_0x82b639){return db[_0x44a8('0x2b')]['find']({'where':{'id':_0x25a3a8[_0x44a8('0x47')]['id']}})['then'](handleEntityNotFound(_0x82b639,null))[_0x44a8('0x24')](removeEntity(_0x82b639,null))['catch'](handleError(_0x82b639,null));};exports[_0x44a8('0x4b')]=function(_0x2e4b94,_0x1666fd){return db[_0x44a8('0x2b')][_0x44a8('0x4b')]()['then'](respondWithResult(_0x1666fd,null))['catch'](handleError(_0x1666fd,null));}; \ No newline at end of file +var _0x8900=['../../config/license/util','../../mysqldb','sendStatus','end','offset','status','set','Content-Range','save','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','then','rows','catch','show','params','fields','create','body','update','find','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x83a327,_0x53f000){var _0x54ca98=function(_0x3a43ed){while(--_0x3a43ed){_0x83a327['push'](_0x83a327['shift']());}};_0x54ca98(++_0x53f000);}(_0x8900,0x161));var _0x0890=function(_0x1bd04e,_0x6281bd){_0x1bd04e=_0x1bd04e-0x0;var _0x4d6ea0=_0x8900[_0x1bd04e];return _0x4d6ea0;};'use strict';var pdf=require(_0x0890('0x0'));var emlformat=require(_0x0890('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0890('0x2'));var jsonpatch=require(_0x0890('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0890('0x4'));var Mustache=require(_0x0890('0x5'));var util=require(_0x0890('0x6'));var path=require(_0x0890('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0890('0x8'));var squel=require(_0x0890('0x9'));var crypto=require(_0x0890('0xa'));var jsforce=require(_0x0890('0xb'));var deskjs=require(_0x0890('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0890('0xd'));var Papa=require(_0x0890('0xe'));var Redis=require(_0x0890('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0890('0x10'));var as=require(_0x0890('0x11'));var hardwareService=require(_0x0890('0x12'));var logger=require(_0x0890('0x13'))(_0x0890('0x14'));var utils=require('../../config/utils');var config=require(_0x0890('0x15'));var licenseUtil=require(_0x0890('0x16'));var db=require(_0x0890('0x17'))['db'];function respondWithStatusCode(_0x128c2d,_0x13b514){_0x13b514=_0x13b514||0xcc;return function(_0x51c6fc){if(_0x51c6fc){return _0x128c2d[_0x0890('0x18')](_0x13b514);}return _0x128c2d['status'](_0x13b514)[_0x0890('0x19')]();};}function respondWithResult(_0x1f7f2d,_0x11865b){_0x11865b=_0x11865b||0xc8;return function(_0x5e3855){if(_0x5e3855){return _0x1f7f2d['status'](_0x11865b)['json'](_0x5e3855);}};}function respondWithFilteredResult(_0x47cab2,_0x34c5ae){return function(_0x357bb1){if(_0x357bb1){var _0x3494a9=_0x357bb1['count'],_0x2c38d5=_0x34c5ae[_0x0890('0x1a')],_0x1437b9=_0x34c5ae[_0x0890('0x1a')]+_0x34c5ae['limit'],_0x26222c;if(_0x1437b9>=_0x3494a9){_0x1437b9=_0x3494a9;_0x26222c=0xc8;}else{_0x26222c=0xce;}_0x47cab2[_0x0890('0x1b')](_0x26222c);return _0x47cab2[_0x0890('0x1c')](_0x0890('0x1d'),_0x2c38d5+'-'+_0x1437b9+'/'+_0x3494a9)['json'](_0x357bb1);}return null;};}function patchUpdates(_0x29005c){return function(_0x243dfa){try{jsonpatch['apply'](_0x243dfa,_0x29005c,!![]);}catch(_0x29b782){return BPromise['reject'](_0x29b782);}return _0x243dfa[_0x0890('0x1e')]();};}function saveUpdates(_0x278e31,_0x1e382a){return function(_0x58ff05){if(_0x58ff05){return _0x58ff05['update'](_0x278e31)['then'](function(_0x4f8c37){return _0x4f8c37;});}return null;};}function removeEntity(_0x3d1593,_0x10be18){return function(_0x47ab16){if(_0x47ab16){return _0x47ab16['destroy']()['then'](function(){_0x3d1593[_0x0890('0x1b')](0xcc)[_0x0890('0x19')]();});}};}function handleEntityNotFound(_0x1cd02b,_0xf5bcf4){return function(_0xc1fdbe){if(!_0xc1fdbe){_0x1cd02b[_0x0890('0x18')](0x194);}return _0xc1fdbe;};}function handleError(_0x24dc49,_0x22d7d5){_0x22d7d5=_0x22d7d5||0x1f4;return function(_0x1a4fe0){logger[_0x0890('0x1f')](_0x1a4fe0[_0x0890('0x20')]);if(_0x1a4fe0[_0x0890('0x21')]){delete _0x1a4fe0[_0x0890('0x21')];}_0x24dc49['status'](_0x22d7d5)[_0x0890('0x22')](_0x1a4fe0);};}exports[_0x0890('0x23')]=function(_0x5d71cc,_0x31b51e){var _0x42b7ae={},_0x20ca41={},_0x2ab7e6={'count':0x0,'rows':[]};var _0x5cce8a=_[_0x0890('0x24')](db[_0x0890('0x25')][_0x0890('0x26')],function(_0x3cd487){return{'name':_0x3cd487[_0x0890('0x27')],'type':_0x3cd487['type'][_0x0890('0x28')]};});_0x20ca41['model']=_[_0x0890('0x24')](_0x5cce8a,_0x0890('0x21'));_0x20ca41[_0x0890('0x29')]=_[_0x0890('0x2a')](_0x5d71cc['query']);_0x20ca41[_0x0890('0x2b')]=_[_0x0890('0x2c')](_0x20ca41[_0x0890('0x2d')],_0x20ca41[_0x0890('0x29')]);_0x42b7ae[_0x0890('0x2e')]=_[_0x0890('0x2c')](_0x20ca41[_0x0890('0x2d')],qs['fields'](_0x5d71cc[_0x0890('0x29')]['fields']));_0x42b7ae['attributes']=_0x42b7ae[_0x0890('0x2e')][_0x0890('0x2f')]?_0x42b7ae[_0x0890('0x2e')]:_0x20ca41[_0x0890('0x2d')];if(!_0x5d71cc[_0x0890('0x29')][_0x0890('0x30')](_0x0890('0x31'))){_0x42b7ae[_0x0890('0x32')]=qs[_0x0890('0x32')](_0x5d71cc['query'][_0x0890('0x32')]);_0x42b7ae[_0x0890('0x1a')]=qs[_0x0890('0x1a')](_0x5d71cc['query']['offset']);}_0x42b7ae[_0x0890('0x33')]=qs[_0x0890('0x34')](_0x5d71cc[_0x0890('0x29')][_0x0890('0x34')]);_0x42b7ae[_0x0890('0x35')]=qs[_0x0890('0x2b')](_[_0x0890('0x36')](_0x5d71cc[_0x0890('0x29')],_0x20ca41[_0x0890('0x2b')]),_0x5cce8a);if(_0x5d71cc['query'][_0x0890('0x37')]){_0x42b7ae['where']=_[_0x0890('0x38')](_0x42b7ae[_0x0890('0x35')],{'$or':_['map'](_0x5cce8a,function(_0x49b583){if(_0x49b583[_0x0890('0x39')]!==_0x0890('0x3a')){var _0x4beac9={};_0x4beac9[_0x49b583[_0x0890('0x21')]]={'$like':'%'+_0x5d71cc[_0x0890('0x29')][_0x0890('0x37')]+'%'};return _0x4beac9;}})});}_0x42b7ae=_[_0x0890('0x38')]({},_0x42b7ae,_0x5d71cc[_0x0890('0x3b')]);var _0x4dffad={'where':_0x42b7ae[_0x0890('0x35')]};return db[_0x0890('0x25')]['count'](_0x4dffad)['then'](function(_0x35e370){_0x2ab7e6['count']=_0x35e370;if(_0x5d71cc[_0x0890('0x29')][_0x0890('0x3c')]){_0x42b7ae[_0x0890('0x3d')]=[{'all':!![]}];}return db[_0x0890('0x25')][_0x0890('0x3e')](_0x42b7ae);})[_0x0890('0x3f')](function(_0x14a755){_0x2ab7e6[_0x0890('0x40')]=_0x14a755;return _0x2ab7e6;})[_0x0890('0x3f')](respondWithFilteredResult(_0x31b51e,_0x42b7ae))[_0x0890('0x41')](handleError(_0x31b51e,null));};exports[_0x0890('0x42')]=function(_0x5a495d,_0x1dc213){var _0x5bbb1e={'raw':!![],'where':{'id':_0x5a495d[_0x0890('0x43')]['id']}},_0x5dfda9={};_0x5dfda9[_0x0890('0x2d')]=_[_0x0890('0x2a')](db[_0x0890('0x25')][_0x0890('0x26')]);_0x5dfda9['query']=_[_0x0890('0x2a')](_0x5a495d[_0x0890('0x29')]);_0x5dfda9[_0x0890('0x2b')]=_[_0x0890('0x2c')](_0x5dfda9[_0x0890('0x2d')],_0x5dfda9[_0x0890('0x29')]);_0x5bbb1e[_0x0890('0x2e')]=_['intersection'](_0x5dfda9['model'],qs[_0x0890('0x44')](_0x5a495d[_0x0890('0x29')]['fields']));_0x5bbb1e['attributes']=_0x5bbb1e[_0x0890('0x2e')][_0x0890('0x2f')]?_0x5bbb1e['attributes']:_0x5dfda9[_0x0890('0x2d')];if(_0x5a495d['query'][_0x0890('0x3c')]){_0x5bbb1e['include']=[{'all':!![]}];}_0x5bbb1e=_[_0x0890('0x38')]({},_0x5bbb1e,_0x5a495d[_0x0890('0x3b')]);return db[_0x0890('0x25')]['find'](_0x5bbb1e)[_0x0890('0x3f')](handleEntityNotFound(_0x1dc213,null))[_0x0890('0x3f')](respondWithResult(_0x1dc213,null))[_0x0890('0x41')](handleError(_0x1dc213,null));};exports[_0x0890('0x45')]=function(_0x3e0752,_0x17a87d){return db[_0x0890('0x25')][_0x0890('0x45')](_0x3e0752[_0x0890('0x46')],{})[_0x0890('0x3f')](respondWithResult(_0x17a87d,0xc9))[_0x0890('0x41')](handleError(_0x17a87d,null));};exports[_0x0890('0x47')]=function(_0x4147dd,_0x4f2ce8){if(_0x4147dd[_0x0890('0x46')]['id']){delete _0x4147dd[_0x0890('0x46')]['id'];}return db[_0x0890('0x25')][_0x0890('0x48')]({'where':{'id':_0x4147dd[_0x0890('0x43')]['id']}})[_0x0890('0x3f')](handleEntityNotFound(_0x4f2ce8,null))[_0x0890('0x3f')](saveUpdates(_0x4147dd[_0x0890('0x46')],null))[_0x0890('0x3f')](respondWithResult(_0x4f2ce8,null))[_0x0890('0x41')](handleError(_0x4f2ce8,null));};exports[_0x0890('0x49')]=function(_0x2e13f5,_0x5d101e){return db['MailTransferReport'][_0x0890('0x48')]({'where':{'id':_0x2e13f5[_0x0890('0x43')]['id']}})['then'](handleEntityNotFound(_0x5d101e,null))['then'](removeEntity(_0x5d101e,null))[_0x0890('0x41')](handleError(_0x5d101e,null));};exports[_0x0890('0x4a')]=function(_0x254e66,_0x29cd0a){return db[_0x0890('0x25')]['describe']()[_0x0890('0x3f')](respondWithResult(_0x29cd0a,null))[_0x0890('0x41')](handleError(_0x29cd0a,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 0b0936f..1e5776d 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 _0x9c75=['uniqueid','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer'];(function(_0x3f0afa,_0x5e5b2b){var _0x418b0c=function(_0x3b224e){while(--_0x3b224e){_0x3f0afa['push'](_0x3f0afa['shift']());}};_0x418b0c(++_0x5e5b2b);}(_0x9c75,0x1b3));var _0x59c7=function(_0x3b04f2,_0x1e54d9){_0x3b04f2=_0x3b04f2-0x0;var _0x2ba2b4=_0x9c75[_0x3b04f2];return _0x2ba2b4;};'use strict';var _=require(_0x59c7('0x0'));var util=require(_0x59c7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x59c7('0x2'));var BPromise=require(_0x59c7('0x3'));var rp=require(_0x59c7('0x4'));var fs=require('fs');var path=require(_0x59c7('0x5'));var rimraf=require(_0x59c7('0x6'));var config=require(_0x59c7('0x7'));var attributes=require(_0x59c7('0x8'));module[_0x59c7('0x9')]=function(_0x1bc352,_0x34d95e){return _0x1bc352[_0x59c7('0xa')](_0x59c7('0xb'),attributes,{'tableName':_0x59c7('0xc'),'paranoid':![],'indexes':[{'name':_0x59c7('0xd'),'fields':[_0x59c7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x729b=['request-promise','path','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x35ce1a,_0xe56d59){var _0x33cb6a=function(_0x1215d8){while(--_0x1215d8){_0x35ce1a['push'](_0x35ce1a['shift']());}};_0x33cb6a(++_0xe56d59);}(_0x729b,0x105));var _0xb729=function(_0x49ca35,_0x15f6aa){_0x49ca35=_0x49ca35-0x0;var _0x5842f4=_0x729b[_0x49ca35];return _0x5842f4;};'use strict';var _=require(_0xb729('0x0'));var util=require(_0xb729('0x1'));var logger=require(_0xb729('0x2'))(_0xb729('0x3'));var moment=require(_0xb729('0x4'));var BPromise=require('bluebird');var rp=require(_0xb729('0x5'));var fs=require('fs');var path=require(_0xb729('0x6'));var rimraf=require('rimraf');var config=require(_0xb729('0x7'));var attributes=require(_0xb729('0x8'));module[_0xb729('0x9')]=function(_0x3a3fce,_0x2b20d8){return _0x3a3fce[_0xb729('0xa')](_0xb729('0xb'),attributes,{'tableName':_0xb729('0xc'),'paranoid':![],'indexes':[{'name':_0xb729('0xd'),'fields':[_0xb729('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 9398238..389d99e 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 _0x4043=['then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x397c0a,_0x59643f){var _0x1fdf3a=function(_0x2e749d){while(--_0x2e749d){_0x397c0a['push'](_0x397c0a['shift']());}};_0x1fdf3a(++_0x59643f);}(_0x4043,0x1ae));var _0x3404=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4043[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x3404('0x0'));var moment=require('moment');var BPromise=require(_0x3404('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3404('0x2'));var db=require(_0x3404('0x3'))['db'];var utils=require(_0x3404('0x4'));var logger=require(_0x3404('0x5'))(_0x3404('0x6'));var config=require('../../config/environment');var jayson=require(_0x3404('0x7'));var client=jayson[_0x3404('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fb2c7,_0x7698c4,_0x56a274){return new BPromise(function(_0x163945,_0x39adb7){return client[_0x3404('0x9')](_0x4fb2c7,_0x56a274)[_0x3404('0xa')](function(_0x149167){logger[_0x3404('0xb')](_0x3404('0xc'),_0x7698c4,'request\x20sent');logger[_0x3404('0xd')](_0x3404('0xe'),_0x7698c4,_0x3404('0xf'),JSON[_0x3404('0x10')](_0x149167));if(_0x149167[_0x3404('0x11')]){if(_0x149167['error'][_0x3404('0x12')]===0x1f4){logger[_0x3404('0x11')](_0x3404('0xc'),_0x7698c4,_0x149167[_0x3404('0x11')][_0x3404('0x13')]);return _0x39adb7(_0x149167[_0x3404('0x11')]['message']);}logger[_0x3404('0x11')](_0x3404('0xc'),_0x7698c4,_0x149167['error'][_0x3404('0x13')]);return _0x163945(_0x149167[_0x3404('0x11')][_0x3404('0x13')]);}else{logger[_0x3404('0xb')](_0x3404('0xc'),_0x7698c4,_0x3404('0xf'));_0x163945(_0x149167[_0x3404('0x14')][_0x3404('0x13')]);}})[_0x3404('0x15')](function(_0xdfe894){logger[_0x3404('0x11')](_0x3404('0xc'),_0x7698c4,_0xdfe894);_0x39adb7(_0xdfe894);});});} \ No newline at end of file +var _0x9eae=['../../config/environment','request','then','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x9dea3f,_0x3ace7e){var _0x42dbdb=function(_0x492030){while(--_0x492030){_0x9dea3f['push'](_0x9dea3f['shift']());}};_0x42dbdb(++_0x3ace7e);}(_0x9eae,0x149));var _0xe9ea=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9eae[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xe9ea('0x0'));var util=require(_0xe9ea('0x1'));var moment=require(_0xe9ea('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9ea('0x3'));var db=require(_0xe9ea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe9ea('0x5'))(_0xe9ea('0x6'));var config=require(_0xe9ea('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ecf0a,_0x1d04ac,_0x4bf4ba){return new BPromise(function(_0x5ed036,_0x39a42d){return client[_0xe9ea('0x8')](_0x4ecf0a,_0x4bf4ba)[_0xe9ea('0x9')](function(_0x218460){logger['info'](_0xe9ea('0xa'),_0x1d04ac,'request\x20sent');logger[_0xe9ea('0xb')](_0xe9ea('0xc'),_0x1d04ac,'request\x20sent',JSON[_0xe9ea('0xd')](_0x218460));if(_0x218460[_0xe9ea('0xe')]){if(_0x218460[_0xe9ea('0xe')][_0xe9ea('0xf')]===0x1f4){logger[_0xe9ea('0xe')](_0xe9ea('0xa'),_0x1d04ac,_0x218460[_0xe9ea('0xe')][_0xe9ea('0x10')]);return _0x39a42d(_0x218460[_0xe9ea('0xe')][_0xe9ea('0x10')]);}logger[_0xe9ea('0xe')](_0xe9ea('0xa'),_0x1d04ac,_0x218460[_0xe9ea('0xe')][_0xe9ea('0x10')]);return _0x5ed036(_0x218460[_0xe9ea('0xe')][_0xe9ea('0x10')]);}else{logger[_0xe9ea('0x11')](_0xe9ea('0xa'),_0x1d04ac,_0xe9ea('0x12'));_0x5ed036(_0x218460[_0xe9ea('0x13')]['message']);}})[_0xe9ea('0x14')](function(_0x1c3ab9){logger[_0xe9ea('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x1d04ac,_0x1c3ab9);_0x39a42d(_0x1c3ab9);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 52b3617..90d5073 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 _0x7f49=['create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','/describe','isAuthenticated','/:id','show'];(function(_0x471512,_0x1b5b06){var _0x11f389=function(_0x1df7df){while(--_0x1df7df){_0x471512['push'](_0x471512['shift']());}};_0x11f389(++_0x1b5b06);}(_0x7f49,0xc4));var _0x97f4=function(_0x39d86e,_0x270aa0){_0x39d86e=_0x39d86e-0x0;var _0x6916b9=_0x7f49[_0x39d86e];return _0x6916b9;};'use strict';var multer=require(_0x97f4('0x0'));var util=require(_0x97f4('0x1'));var path=require(_0x97f4('0x2'));var timeout=require(_0x97f4('0x3'));var express=require(_0x97f4('0x4'));var router=express[_0x97f4('0x5')]();var auth=require(_0x97f4('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x97f4('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x97f4('0x8'),auth[_0x97f4('0x9')](),controller['describe']);router[_0x97f4('0x7')](_0x97f4('0xa'),auth[_0x97f4('0x9')](),controller[_0x97f4('0xb')]);router['post']('/',auth[_0x97f4('0x9')](),controller[_0x97f4('0xc')]);router['put']('/:id',auth[_0x97f4('0x9')](),controller['update']);router[_0x97f4('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x97f4('0xe')]);module[_0x97f4('0xf')]=router; \ No newline at end of file +var _0xd9bf=['/describe','describe','/:id','show','post','create','put','update','delete','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated'];(function(_0x3e6c8a,_0x422a26){var _0x401889=function(_0x27cf6f){while(--_0x27cf6f){_0x3e6c8a['push'](_0x3e6c8a['shift']());}};_0x401889(++_0x422a26);}(_0xd9bf,0xda));var _0xfd9b=function(_0x4c9304,_0x4a67da){_0x4c9304=_0x4c9304-0x0;var _0x21e678=_0xd9bf[_0x4c9304];return _0x21e678;};'use strict';var multer=require(_0xfd9b('0x0'));var util=require(_0xfd9b('0x1'));var path=require(_0xfd9b('0x2'));var timeout=require('connect-timeout');var express=require(_0xfd9b('0x3'));var router=express[_0xfd9b('0x4')]();var auth=require(_0xfd9b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfd9b('0x6'));var controller=require(_0xfd9b('0x7'));router[_0xfd9b('0x8')]('/',auth[_0xfd9b('0x9')](),controller['index']);router[_0xfd9b('0x8')](_0xfd9b('0xa'),auth['isAuthenticated'](),controller[_0xfd9b('0xb')]);router[_0xfd9b('0x8')](_0xfd9b('0xc'),auth[_0xfd9b('0x9')](),controller[_0xfd9b('0xd')]);router[_0xfd9b('0xe')]('/',auth['isAuthenticated'](),controller[_0xfd9b('0xf')]);router[_0xfd9b('0x10')]('/:id',auth[_0xfd9b('0x9')](),controller[_0xfd9b('0x11')]);router[_0xfd9b('0x12')]('/:id',auth[_0xfd9b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 716a405..b89d70f 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 _0xe053=['seconds','setDataValue','exitAt','talk:[start]','talk:[destination]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff'];(function(_0x1527a8,_0x5e0437){var _0x359467=function(_0x59f79d){while(--_0x59f79d){_0x1527a8['push'](_0x1527a8['shift']());}};_0x359467(++_0x5e0437);}(_0xe053,0x171));var _0x3e05=function(_0x5cabfd,_0x5dea47){_0x5cabfd=_0x5cabfd-0x0;var _0x4bc06c=_0xe053[_0x5cabfd];return _0x4bc06c;};'use strict';var Sequelize=require(_0x3e05('0x0'));var moment=require('moment');module[_0x3e05('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3e05('0x2')]},'interface':{'type':Sequelize[_0x3e05('0x2')]},'type':{'type':Sequelize[_0x3e05('0x2')],'defaultValue':_0x3e05('0x3'),'comment':_0x3e05('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x3e05('0x5')]},'exitAt':{'type':Sequelize[_0x3e05('0x5')],'set':function(_0x275d38){var _0x46c7b1=moment(_0x275d38);var _0x5ebfbe=moment(this[_0x3e05('0x6')](_0x3e05('0x7')));var _0x259706=_0x46c7b1[_0x3e05('0x8')](_0x5ebfbe,_0x3e05('0x9'));this[_0x3e05('0xa')](_0x3e05('0xb'),_0x275d38);this[_0x3e05('0xa')]('duration',_0x259706||null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x3e05('0x2')],'comment':_0x3e05('0xc')},'data3':{'type':Sequelize['STRING'],'comment':_0x3e05('0xd')},'data4':{'type':Sequelize[_0x3e05('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x3e05('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x3e05('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x3e05('0x2')]}}; \ No newline at end of file +var _0xd505=['talk:[destination]','talk:[dial\x20string]','INTEGER','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','enterAt','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]'];(function(_0x2ef714,_0x49e1c4){var _0x252ab0=function(_0x868e73){while(--_0x868e73){_0x2ef714['push'](_0x2ef714['shift']());}};_0x252ab0(++_0x49e1c4);}(_0xd505,0x143));var _0x5d50=function(_0x3f9525,_0x45e92a){_0x3f9525=_0x3f9525-0x0;var _0x158607=_0xd505[_0x3f9525];return _0x158607;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5d50('0x0'));module[_0x5d50('0x1')]={'channel':{'type':Sequelize[_0x5d50('0x2')]},'membername':{'type':Sequelize[_0x5d50('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5d50('0x2')],'defaultValue':_0x5d50('0x3'),'comment':_0x5d50('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x5d50('0x5')]},'exitAt':{'type':Sequelize[_0x5d50('0x5')],'set':function(_0x10e3b6){var _0x5e9e39=moment(_0x10e3b6);var _0x53ee0c=moment(this['getDataValue'](_0x5d50('0x6')));var _0x267f7a=_0x5e9e39['diff'](_0x53ee0c,_0x5d50('0x7'));this[_0x5d50('0x8')](_0x5d50('0x9'),_0x10e3b6);this['setDataValue'](_0x5d50('0xa'),_0x267f7a||null);}},'data1':{'type':Sequelize[_0x5d50('0x2')],'comment':_0x5d50('0xb')},'data2':{'type':Sequelize['STRING'],'comment':_0x5d50('0xc')},'data3':{'type':Sequelize[_0x5d50('0x2')],'comment':_0x5d50('0xd')},'data4':{'type':Sequelize[_0x5d50('0x2')],'comment':_0x5d50('0xe')},'data5':{'type':Sequelize[_0x5d50('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x5d50('0x2')]},'internal':{'type':Sequelize[_0x5d50('0xf')]},'uniqueid':{'type':Sequelize[_0x5d50('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 75979cf..56e93cf 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 _0xd012=['mustache','util','path','to-csv','ejs','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','status','offset','limit','set','json','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','MemberReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','catch','create','body','find','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3bae4a,_0x437771){var _0x3b4991=function(_0x5b3cda){while(--_0x5b3cda){_0x3bae4a['push'](_0x3bae4a['shift']());}};_0x3b4991(++_0x437771);}(_0xd012,0x94));var _0x2d01=function(_0x59094b,_0x47dd0d){_0x59094b=_0x59094b-0x0;var _0x2161a9=_0xd012[_0x59094b];return _0x2161a9;};'use strict';var pdf=require(_0x2d01('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2d01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d01('0x2'));var rp=require(_0x2d01('0x3'));var moment=require(_0x2d01('0x4'));var BPromise=require(_0x2d01('0x5'));var Mustache=require(_0x2d01('0x6'));var util=require(_0x2d01('0x7'));var path=require(_0x2d01('0x8'));var sox=require('sox');var csv=require(_0x2d01('0x9'));var ejs=require(_0x2d01('0xa'));var fs=require('fs');var _=require(_0x2d01('0xb'));var squel=require(_0x2d01('0xc'));var crypto=require('crypto');var jsforce=require(_0x2d01('0xd'));var deskjs=require(_0x2d01('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2d01('0xf'));var Papa=require(_0x2d01('0x10'));var Redis=require(_0x2d01('0x11'));var authService=require(_0x2d01('0x12'));var qs=require(_0x2d01('0x13'));var as=require(_0x2d01('0x14'));var hardwareService=require(_0x2d01('0x15'));var logger=require('../../config/logger')(_0x2d01('0x16'));var utils=require(_0x2d01('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2d01('0x18'));var db=require(_0x2d01('0x19'))['db'];function respondWithStatusCode(_0x3afe47,_0x394d44){_0x394d44=_0x394d44||0xcc;return function(_0x26a729){if(_0x26a729){return _0x3afe47['sendStatus'](_0x394d44);}return _0x3afe47[_0x2d01('0x1a')](_0x394d44)['end']();};}function respondWithResult(_0x28a04d,_0x176cbb){_0x176cbb=_0x176cbb||0xc8;return function(_0x3f898d){if(_0x3f898d){return _0x28a04d['status'](_0x176cbb)['json'](_0x3f898d);}};}function respondWithFilteredResult(_0x123d49,_0x260927){return function(_0x5ea1ee){if(_0x5ea1ee){var _0x1c67b4=_0x5ea1ee['count'],_0x5b2de5=_0x260927[_0x2d01('0x1b')],_0x14c213=_0x260927[_0x2d01('0x1b')]+_0x260927[_0x2d01('0x1c')],_0x1470c7;if(_0x14c213>=_0x1c67b4){_0x14c213=_0x1c67b4;_0x1470c7=0xc8;}else{_0x1470c7=0xce;}_0x123d49[_0x2d01('0x1a')](_0x1470c7);return _0x123d49[_0x2d01('0x1d')]('Content-Range',_0x5b2de5+'-'+_0x14c213+'/'+_0x1c67b4)[_0x2d01('0x1e')](_0x5ea1ee);}return null;};}function patchUpdates(_0x5f1bad){return function(_0x5c348b){try{jsonpatch['apply'](_0x5c348b,_0x5f1bad,!![]);}catch(_0x2ff5eb){return BPromise[_0x2d01('0x1f')](_0x2ff5eb);}return _0x5c348b[_0x2d01('0x20')]();};}function saveUpdates(_0x5e243d,_0x5c6c1a){return function(_0x577d5c){if(_0x577d5c){return _0x577d5c[_0x2d01('0x21')](_0x5e243d)[_0x2d01('0x22')](function(_0x2c8d7b){return _0x2c8d7b;});}return null;};}function removeEntity(_0x285938,_0x29c131){return function(_0x16a7b2){if(_0x16a7b2){return _0x16a7b2[_0x2d01('0x23')]()[_0x2d01('0x22')](function(){_0x285938[_0x2d01('0x1a')](0xcc)[_0x2d01('0x24')]();});}};}function handleEntityNotFound(_0xa80915,_0x5b7d13){return function(_0x22764b){if(!_0x22764b){_0xa80915[_0x2d01('0x25')](0x194);}return _0x22764b;};}function handleError(_0x135969,_0x8fe733){_0x8fe733=_0x8fe733||0x1f4;return function(_0x38b9d7){logger[_0x2d01('0x26')](_0x38b9d7[_0x2d01('0x27')]);if(_0x38b9d7['name']){delete _0x38b9d7[_0x2d01('0x28')];}_0x135969[_0x2d01('0x1a')](_0x8fe733)[_0x2d01('0x29')](_0x38b9d7);};}exports[_0x2d01('0x2a')]=function(_0x5081c1,_0x511a7b){var _0x5bf978={},_0x1b21bb={},_0x378f8e={'count':0x0,'rows':[]};var _0x49659f=_['map'](db[_0x2d01('0x2b')][_0x2d01('0x2c')],function(_0x76f28f){return{'name':_0x76f28f[_0x2d01('0x2d')],'type':_0x76f28f[_0x2d01('0x2e')][_0x2d01('0x2f')]};});_0x1b21bb[_0x2d01('0x30')]=_[_0x2d01('0x31')](_0x49659f,_0x2d01('0x28'));_0x1b21bb[_0x2d01('0x32')]=_[_0x2d01('0x33')](_0x5081c1[_0x2d01('0x32')]);_0x1b21bb[_0x2d01('0x34')]=_['intersection'](_0x1b21bb[_0x2d01('0x30')],_0x1b21bb[_0x2d01('0x32')]);_0x5bf978[_0x2d01('0x35')]=_[_0x2d01('0x36')](_0x1b21bb['model'],qs[_0x2d01('0x37')](_0x5081c1[_0x2d01('0x32')]['fields']));_0x5bf978['attributes']=_0x5bf978['attributes'][_0x2d01('0x38')]?_0x5bf978[_0x2d01('0x35')]:_0x1b21bb[_0x2d01('0x30')];if(!_0x5081c1['query']['hasOwnProperty'](_0x2d01('0x39'))){_0x5bf978[_0x2d01('0x1c')]=qs['limit'](_0x5081c1[_0x2d01('0x32')][_0x2d01('0x1c')]);_0x5bf978[_0x2d01('0x1b')]=qs[_0x2d01('0x1b')](_0x5081c1[_0x2d01('0x32')][_0x2d01('0x1b')]);}_0x5bf978[_0x2d01('0x3a')]=qs[_0x2d01('0x3b')](_0x5081c1[_0x2d01('0x32')][_0x2d01('0x3b')]);_0x5bf978[_0x2d01('0x3c')]=qs[_0x2d01('0x34')](_['pick'](_0x5081c1[_0x2d01('0x32')],_0x1b21bb[_0x2d01('0x34')]),_0x49659f);if(_0x5081c1[_0x2d01('0x32')][_0x2d01('0x3d')]){_0x5bf978[_0x2d01('0x3c')]=_[_0x2d01('0x3e')](_0x5bf978[_0x2d01('0x3c')],{'$or':_[_0x2d01('0x31')](_0x49659f,function(_0x50c805){if(_0x50c805[_0x2d01('0x2e')]!==_0x2d01('0x3f')){var _0x21b713={};_0x21b713[_0x50c805[_0x2d01('0x28')]]={'$like':'%'+_0x5081c1['query'][_0x2d01('0x3d')]+'%'};return _0x21b713;}})});}_0x5bf978=_[_0x2d01('0x3e')]({},_0x5bf978,_0x5081c1[_0x2d01('0x40')]);var _0x17d168={'where':_0x5bf978[_0x2d01('0x3c')]};return db[_0x2d01('0x2b')][_0x2d01('0x41')](_0x17d168)['then'](function(_0x451f50){_0x378f8e[_0x2d01('0x41')]=_0x451f50;if(_0x5081c1[_0x2d01('0x32')][_0x2d01('0x42')]){_0x5bf978[_0x2d01('0x43')]=[{'all':!![]}];}return db['MemberReport'][_0x2d01('0x44')](_0x5bf978);})['then'](function(_0x483d09){_0x378f8e[_0x2d01('0x45')]=_0x483d09;return _0x378f8e;})[_0x2d01('0x22')](respondWithFilteredResult(_0x511a7b,_0x5bf978))['catch'](handleError(_0x511a7b,null));};exports[_0x2d01('0x46')]=function(_0x8f33ad,_0x474f55){var _0x54ba45={'raw':!![],'where':{'id':_0x8f33ad[_0x2d01('0x47')]['id']}},_0x40b5b4={};_0x40b5b4['model']=_[_0x2d01('0x33')](db[_0x2d01('0x2b')][_0x2d01('0x2c')]);_0x40b5b4[_0x2d01('0x32')]=_['keys'](_0x8f33ad[_0x2d01('0x32')]);_0x40b5b4[_0x2d01('0x34')]=_[_0x2d01('0x36')](_0x40b5b4[_0x2d01('0x30')],_0x40b5b4[_0x2d01('0x32')]);_0x54ba45[_0x2d01('0x35')]=_[_0x2d01('0x36')](_0x40b5b4[_0x2d01('0x30')],qs[_0x2d01('0x37')](_0x8f33ad['query'][_0x2d01('0x37')]));_0x54ba45[_0x2d01('0x35')]=_0x54ba45[_0x2d01('0x35')][_0x2d01('0x38')]?_0x54ba45[_0x2d01('0x35')]:_0x40b5b4[_0x2d01('0x30')];if(_0x8f33ad[_0x2d01('0x32')][_0x2d01('0x42')]){_0x54ba45[_0x2d01('0x43')]=[{'all':!![]}];}_0x54ba45=_[_0x2d01('0x3e')]({},_0x54ba45,_0x8f33ad[_0x2d01('0x40')]);return db[_0x2d01('0x2b')]['find'](_0x54ba45)[_0x2d01('0x22')](handleEntityNotFound(_0x474f55,null))[_0x2d01('0x22')](respondWithResult(_0x474f55,null))[_0x2d01('0x48')](handleError(_0x474f55,null));};exports['create']=function(_0x44db01,_0x38917d){return db[_0x2d01('0x2b')][_0x2d01('0x49')](_0x44db01[_0x2d01('0x4a')],{})[_0x2d01('0x22')](respondWithResult(_0x38917d,0xc9))[_0x2d01('0x48')](handleError(_0x38917d,null));};exports['update']=function(_0x366a81,_0x527cd6){if(_0x366a81['body']['id']){delete _0x366a81['body']['id'];}return db[_0x2d01('0x2b')][_0x2d01('0x4b')]({'where':{'id':_0x366a81[_0x2d01('0x47')]['id']}})[_0x2d01('0x22')](handleEntityNotFound(_0x527cd6,null))[_0x2d01('0x22')](saveUpdates(_0x366a81[_0x2d01('0x4a')],null))[_0x2d01('0x22')](respondWithResult(_0x527cd6,null))[_0x2d01('0x48')](handleError(_0x527cd6,null));};exports[_0x2d01('0x23')]=function(_0x4d7a18,_0x4d34eb){return db[_0x2d01('0x2b')][_0x2d01('0x4b')]({'where':{'id':_0x4d7a18[_0x2d01('0x47')]['id']}})[_0x2d01('0x22')](handleEntityNotFound(_0x4d34eb,null))[_0x2d01('0x22')](removeEntity(_0x4d34eb,null))[_0x2d01('0x48')](handleError(_0x4d34eb,null));};exports[_0x2d01('0x4c')]=function(_0x58da52,_0x3892c5){return db[_0x2d01('0x2b')]['describe']()[_0x2d01('0x22')](respondWithResult(_0x3892c5,null))['catch'](handleError(_0x3892c5,null));}; \ No newline at end of file +var _0xbfea=['type','map','query','keys','filters','intersection','model','fields','attributes','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','create','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','sendStatus','stack','name','send','index','MemberReport','rawAttributes','fieldName'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbfea,0xac));var _0xabfe=function(_0x1437f6,_0x2bd652){_0x1437f6=_0x1437f6-0x0;var _0x3c61d8=_0xbfea[_0x1437f6];return _0x3c61d8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xabfe('0x0'));var rimraf=require(_0xabfe('0x1'));var zipdir=require(_0xabfe('0x2'));var jsonpatch=require(_0xabfe('0x3'));var rp=require(_0xabfe('0x4'));var moment=require(_0xabfe('0x5'));var BPromise=require(_0xabfe('0x6'));var Mustache=require('mustache');var util=require(_0xabfe('0x7'));var path=require(_0xabfe('0x8'));var sox=require(_0xabfe('0x9'));var csv=require(_0xabfe('0xa'));var ejs=require(_0xabfe('0xb'));var fs=require('fs');var _=require(_0xabfe('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xabfe('0xd'));var deskjs=require(_0xabfe('0xe'));var toCsv=require(_0xabfe('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xabfe('0xf'));var as=require(_0xabfe('0x10'));var hardwareService=require(_0xabfe('0x11'));var logger=require(_0xabfe('0x12'))(_0xabfe('0x13'));var utils=require('../../config/utils');var config=require(_0xabfe('0x14'));var licenseUtil=require(_0xabfe('0x15'));var db=require(_0xabfe('0x16'))['db'];function respondWithStatusCode(_0x46efd7,_0x1f2161){_0x1f2161=_0x1f2161||0xcc;return function(_0x2a815f){if(_0x2a815f){return _0x46efd7['sendStatus'](_0x1f2161);}return _0x46efd7[_0xabfe('0x17')](_0x1f2161)['end']();};}function respondWithResult(_0x27fa1a,_0x18d331){_0x18d331=_0x18d331||0xc8;return function(_0x3cd4cf){if(_0x3cd4cf){return _0x27fa1a['status'](_0x18d331)[_0xabfe('0x18')](_0x3cd4cf);}};}function respondWithFilteredResult(_0x5f395c,_0x1f0184){return function(_0x4a96c3){if(_0x4a96c3){var _0x5c0cb1=_0x4a96c3[_0xabfe('0x19')],_0x224ec8=_0x1f0184[_0xabfe('0x1a')],_0x31b0a5=_0x1f0184['offset']+_0x1f0184[_0xabfe('0x1b')],_0x2b3e3c;if(_0x31b0a5>=_0x5c0cb1){_0x31b0a5=_0x5c0cb1;_0x2b3e3c=0xc8;}else{_0x2b3e3c=0xce;}_0x5f395c[_0xabfe('0x17')](_0x2b3e3c);return _0x5f395c[_0xabfe('0x1c')](_0xabfe('0x1d'),_0x224ec8+'-'+_0x31b0a5+'/'+_0x5c0cb1)['json'](_0x4a96c3);}return null;};}function patchUpdates(_0x4e154e){return function(_0x5a06e8){try{jsonpatch[_0xabfe('0x1e')](_0x5a06e8,_0x4e154e,!![]);}catch(_0x531767){return BPromise[_0xabfe('0x1f')](_0x531767);}return _0x5a06e8[_0xabfe('0x20')]();};}function saveUpdates(_0x370427,_0x50342b){return function(_0x5273a1){if(_0x5273a1){return _0x5273a1[_0xabfe('0x21')](_0x370427)[_0xabfe('0x22')](function(_0x329fd6){return _0x329fd6;});}return null;};}function removeEntity(_0x9fb744,_0x3ae13c){return function(_0x37bfa1){if(_0x37bfa1){return _0x37bfa1['destroy']()[_0xabfe('0x22')](function(){_0x9fb744[_0xabfe('0x17')](0xcc)[_0xabfe('0x23')]();});}};}function handleEntityNotFound(_0x537fb1,_0x53d488){return function(_0x105287){if(!_0x105287){_0x537fb1[_0xabfe('0x24')](0x194);}return _0x105287;};}function handleError(_0x37a3a3,_0x1b123e){_0x1b123e=_0x1b123e||0x1f4;return function(_0x15e895){logger['error'](_0x15e895[_0xabfe('0x25')]);if(_0x15e895[_0xabfe('0x26')]){delete _0x15e895[_0xabfe('0x26')];}_0x37a3a3[_0xabfe('0x17')](_0x1b123e)[_0xabfe('0x27')](_0x15e895);};}exports[_0xabfe('0x28')]=function(_0x5d3ec9,_0x4fb2e3){var _0x44eb28={},_0x22abc4={},_0x4cfb90={'count':0x0,'rows':[]};var _0x5b848c=_['map'](db[_0xabfe('0x29')][_0xabfe('0x2a')],function(_0x164cb9){return{'name':_0x164cb9[_0xabfe('0x2b')],'type':_0x164cb9[_0xabfe('0x2c')]['key']};});_0x22abc4['model']=_[_0xabfe('0x2d')](_0x5b848c,_0xabfe('0x26'));_0x22abc4[_0xabfe('0x2e')]=_[_0xabfe('0x2f')](_0x5d3ec9[_0xabfe('0x2e')]);_0x22abc4[_0xabfe('0x30')]=_[_0xabfe('0x31')](_0x22abc4[_0xabfe('0x32')],_0x22abc4[_0xabfe('0x2e')]);_0x44eb28['attributes']=_[_0xabfe('0x31')](_0x22abc4[_0xabfe('0x32')],qs['fields'](_0x5d3ec9[_0xabfe('0x2e')][_0xabfe('0x33')]));_0x44eb28['attributes']=_0x44eb28['attributes']['length']?_0x44eb28[_0xabfe('0x34')]:_0x22abc4['model'];if(!_0x5d3ec9['query']['hasOwnProperty']('nolimit')){_0x44eb28[_0xabfe('0x1b')]=qs[_0xabfe('0x1b')](_0x5d3ec9[_0xabfe('0x2e')][_0xabfe('0x1b')]);_0x44eb28[_0xabfe('0x1a')]=qs[_0xabfe('0x1a')](_0x5d3ec9[_0xabfe('0x2e')][_0xabfe('0x1a')]);}_0x44eb28[_0xabfe('0x35')]=qs[_0xabfe('0x36')](_0x5d3ec9[_0xabfe('0x2e')]['sort']);_0x44eb28[_0xabfe('0x37')]=qs[_0xabfe('0x30')](_[_0xabfe('0x38')](_0x5d3ec9[_0xabfe('0x2e')],_0x22abc4['filters']),_0x5b848c);if(_0x5d3ec9[_0xabfe('0x2e')][_0xabfe('0x39')]){_0x44eb28[_0xabfe('0x37')]=_[_0xabfe('0x3a')](_0x44eb28[_0xabfe('0x37')],{'$or':_[_0xabfe('0x2d')](_0x5b848c,function(_0x3da672){if(_0x3da672['type']!==_0xabfe('0x3b')){var _0x4987f8={};_0x4987f8[_0x3da672['name']]={'$like':'%'+_0x5d3ec9[_0xabfe('0x2e')]['filter']+'%'};return _0x4987f8;}})});}_0x44eb28=_[_0xabfe('0x3a')]({},_0x44eb28,_0x5d3ec9['options']);var _0x5ed37b={'where':_0x44eb28[_0xabfe('0x37')]};return db[_0xabfe('0x29')][_0xabfe('0x19')](_0x5ed37b)[_0xabfe('0x22')](function(_0x15ab57){_0x4cfb90[_0xabfe('0x19')]=_0x15ab57;if(_0x5d3ec9[_0xabfe('0x2e')]['includeAll']){_0x44eb28[_0xabfe('0x3c')]=[{'all':!![]}];}return db[_0xabfe('0x29')][_0xabfe('0x3d')](_0x44eb28);})[_0xabfe('0x22')](function(_0x15b666){_0x4cfb90[_0xabfe('0x3e')]=_0x15b666;return _0x4cfb90;})['then'](respondWithFilteredResult(_0x4fb2e3,_0x44eb28))[_0xabfe('0x3f')](handleError(_0x4fb2e3,null));};exports[_0xabfe('0x40')]=function(_0x587eb4,_0x6eb783){var _0xae9e3d={'raw':!![],'where':{'id':_0x587eb4[_0xabfe('0x41')]['id']}},_0x1a27c1={};_0x1a27c1[_0xabfe('0x32')]=_[_0xabfe('0x2f')](db[_0xabfe('0x29')][_0xabfe('0x2a')]);_0x1a27c1[_0xabfe('0x2e')]=_['keys'](_0x587eb4['query']);_0x1a27c1['filters']=_['intersection'](_0x1a27c1[_0xabfe('0x32')],_0x1a27c1[_0xabfe('0x2e')]);_0xae9e3d[_0xabfe('0x34')]=_['intersection'](_0x1a27c1[_0xabfe('0x32')],qs['fields'](_0x587eb4[_0xabfe('0x2e')]['fields']));_0xae9e3d[_0xabfe('0x34')]=_0xae9e3d[_0xabfe('0x34')]['length']?_0xae9e3d[_0xabfe('0x34')]:_0x1a27c1[_0xabfe('0x32')];if(_0x587eb4[_0xabfe('0x2e')][_0xabfe('0x42')]){_0xae9e3d[_0xabfe('0x3c')]=[{'all':!![]}];}_0xae9e3d=_[_0xabfe('0x3a')]({},_0xae9e3d,_0x587eb4['options']);return db[_0xabfe('0x29')]['find'](_0xae9e3d)[_0xabfe('0x22')](handleEntityNotFound(_0x6eb783,null))['then'](respondWithResult(_0x6eb783,null))['catch'](handleError(_0x6eb783,null));};exports[_0xabfe('0x43')]=function(_0x4435d4,_0x13bf78){return db[_0xabfe('0x29')][_0xabfe('0x43')](_0x4435d4['body'],{})[_0xabfe('0x22')](respondWithResult(_0x13bf78,0xc9))['catch'](handleError(_0x13bf78,null));};exports[_0xabfe('0x21')]=function(_0x59af9e,_0x8c43f3){if(_0x59af9e[_0xabfe('0x44')]['id']){delete _0x59af9e[_0xabfe('0x44')]['id'];}return db[_0xabfe('0x29')]['find']({'where':{'id':_0x59af9e[_0xabfe('0x41')]['id']}})['then'](handleEntityNotFound(_0x8c43f3,null))['then'](saveUpdates(_0x59af9e[_0xabfe('0x44')],null))[_0xabfe('0x22')](respondWithResult(_0x8c43f3,null))[_0xabfe('0x3f')](handleError(_0x8c43f3,null));};exports[_0xabfe('0x45')]=function(_0xc14453,_0x4b755c){return db[_0xabfe('0x29')][_0xabfe('0x46')]({'where':{'id':_0xc14453['params']['id']}})[_0xabfe('0x22')](handleEntityNotFound(_0x4b755c,null))['then'](removeEntity(_0x4b755c,null))['catch'](handleError(_0x4b755c,null));};exports[_0xabfe('0x47')]=function(_0x28c204,_0x4a98a1){return db[_0xabfe('0x29')][_0xabfe('0x47')]()[_0xabfe('0x22')](respondWithResult(_0x4a98a1,null))[_0xabfe('0x3f')](handleError(_0x4a98a1,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index c8a4680..d2f5dce 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 _0x004a=['moment','bluebird','path','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api'];(function(_0x2a2137,_0x280212){var _0x466f22=function(_0x233867){while(--_0x233867){_0x2a2137['push'](_0x2a2137['shift']());}};_0x466f22(++_0x280212);}(_0x004a,0x164));var _0xa004=function(_0xf724d9,_0x5780b6){_0xf724d9=_0xf724d9-0x0;var _0x24ecfe=_0x004a[_0xf724d9];return _0x24ecfe;};'use strict';var _=require(_0xa004('0x0'));var util=require(_0xa004('0x1'));var logger=require(_0xa004('0x2'))(_0xa004('0x3'));var moment=require(_0xa004('0x4'));var BPromise=require(_0xa004('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa004('0x6'));var rimraf=require('rimraf');var config=require(_0xa004('0x7'));var attributes=require(_0xa004('0x8'));module[_0xa004('0x9')]=function(_0x1e2270,_0x55e93b){return _0x1e2270['define'](_0xa004('0xa'),attributes,{'tableName':_0xa004('0xb'),'paranoid':![],'indexes':[{'name':_0xa004('0xc'),'fields':[_0xa004('0xd'),_0xa004('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0245=['membername_interface','util','../../config/logger','api','moment','bluebird','rimraf','./memberReport.attributes','MemberReport','report_member'];(function(_0x2545b1,_0x4a8e22){var _0x5592e1=function(_0x1158d9){while(--_0x1158d9){_0x2545b1['push'](_0x2545b1['shift']());}};_0x5592e1(++_0x4a8e22);}(_0x0245,0x1cd));var _0x5024=function(_0x5ad8fb,_0x4a4145){_0x5ad8fb=_0x5ad8fb-0x0;var _0xa57ff6=_0x0245[_0x5ad8fb];return _0xa57ff6;};'use strict';var _=require('lodash');var util=require(_0x5024('0x0'));var logger=require(_0x5024('0x1'))(_0x5024('0x2'));var moment=require(_0x5024('0x3'));var BPromise=require(_0x5024('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5024('0x5'));var config=require('../../config/environment');var attributes=require(_0x5024('0x6'));module['exports']=function(_0x4e4815,_0x1aeaad){return _0x4e4815['define'](_0x5024('0x7'),attributes,{'tableName':_0x5024('0x8'),'paranoid':![],'indexes':[{'name':_0x5024('0x9'),'fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 399d0b5..296b12d 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 _0x6eb4=['MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateMemberReport','create','body','UpdateMemberReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0x6eb4,0x178));var _0x46eb=function(_0x404de1,_0x464a01){_0x404de1=_0x404de1-0x0;var _0x3fcf87=_0x6eb4[_0x404de1];return _0x3fcf87;};'use strict';var _=require(_0x46eb('0x0'));var util=require('util');var moment=require(_0x46eb('0x1'));var BPromise=require(_0x46eb('0x2'));var rs=require(_0x46eb('0x3'));var fs=require('fs');var Redis=require(_0x46eb('0x4'));var db=require(_0x46eb('0x5'))['db'];var utils=require(_0x46eb('0x6'));var logger=require(_0x46eb('0x7'))(_0x46eb('0x8'));var config=require(_0x46eb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x46eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2646ee,_0x21031c,_0x2fac25){return new BPromise(function(_0x2d544f,_0x23570b){return client[_0x46eb('0xb')](_0x2646ee,_0x2fac25)[_0x46eb('0xc')](function(_0x592261){logger[_0x46eb('0xd')](_0x46eb('0xe'),_0x21031c,_0x46eb('0xf'));logger[_0x46eb('0x10')](_0x46eb('0x11'),_0x21031c,_0x46eb('0xf'),JSON[_0x46eb('0x12')](_0x592261));if(_0x592261[_0x46eb('0x13')]){if(_0x592261['error'][_0x46eb('0x14')]===0x1f4){logger['error'](_0x46eb('0xe'),_0x21031c,_0x592261['error'][_0x46eb('0x15')]);return _0x23570b(_0x592261[_0x46eb('0x13')][_0x46eb('0x15')]);}logger[_0x46eb('0x13')]('MemberReport,\x20%s,\x20%s',_0x21031c,_0x592261[_0x46eb('0x13')][_0x46eb('0x15')]);return _0x2d544f(_0x592261[_0x46eb('0x13')][_0x46eb('0x15')]);}else{logger[_0x46eb('0xd')]('MemberReport,\x20%s,\x20%s',_0x21031c,_0x46eb('0xf'));_0x2d544f(_0x592261[_0x46eb('0x16')][_0x46eb('0x15')]);}})[_0x46eb('0x17')](function(_0x4c38f0){logger[_0x46eb('0x13')]('MemberReport,\x20%s,\x20%s',_0x21031c,_0x4c38f0);_0x23570b(_0x4c38f0);});});}exports[_0x46eb('0x18')]=function(_0x44bd02){var _0x1304a7=this;return new Promise(function(_0x5abd3a,_0x157c0a){return db[_0x46eb('0x19')][_0x46eb('0x1a')]({'raw':_0x44bd02[_0x46eb('0x1b')]?_0x44bd02[_0x46eb('0x1b')][_0x46eb('0x1c')]===undefined?!![]:![]:!![],'where':_0x44bd02['options']?_0x44bd02[_0x46eb('0x1b')][_0x46eb('0x1d')]||null:null,'attributes':_0x44bd02[_0x46eb('0x1b')]?_0x44bd02[_0x46eb('0x1b')][_0x46eb('0x1e')]||null:null,'limit':_0x44bd02[_0x46eb('0x1b')]?_0x44bd02['options'][_0x46eb('0x1f')]||null:null,'include':_0x44bd02[_0x46eb('0x1b')]?_0x44bd02[_0x46eb('0x1b')][_0x46eb('0x20')]?_[_0x46eb('0x21')](_0x44bd02['options'][_0x46eb('0x20')],function(_0x28cd09){return{'model':db[_0x28cd09['model']],'as':_0x28cd09['as'],'attributes':_0x28cd09['attributes'],'include':_0x28cd09[_0x46eb('0x20')]?_[_0x46eb('0x21')](_0x28cd09[_0x46eb('0x20')],function(_0x1942f8){return{'model':db[_0x1942f8[_0x46eb('0x22')]],'as':_0x1942f8['as'],'attributes':_0x1942f8[_0x46eb('0x1e')],'include':_0x1942f8[_0x46eb('0x20')]?_[_0x46eb('0x21')](_0x1942f8[_0x46eb('0x20')],function(_0x36c390){return{'model':db[_0x36c390[_0x46eb('0x22')]],'as':_0x36c390['as'],'attributes':_0x36c390[_0x46eb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x46eb('0xc')](function(_0x3f42a0){logger[_0x46eb('0xd')](_0x46eb('0x18'),_0x44bd02);logger[_0x46eb('0x10')](_0x46eb('0x18'),_0x44bd02,JSON['stringify'](_0x3f42a0));_0x5abd3a(_0x3f42a0);})[_0x46eb('0x17')](function(_0xca7ddc){logger[_0x46eb('0x13')](_0x46eb('0x18'),_0xca7ddc[_0x46eb('0x15')],_0x44bd02);_0x157c0a(_0x1304a7['error'](0x1f4,_0xca7ddc[_0x46eb('0x15')]));});});};exports[_0x46eb('0x23')]=function(_0x36658f){var _0x3eedd0=this;return new Promise(function(_0x5ce5b9,_0x463656){return db['MemberReport'][_0x46eb('0x24')](_0x36658f[_0x46eb('0x25')],{'raw':_0x36658f[_0x46eb('0x1b')]?_0x36658f[_0x46eb('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x46eb('0xc')](function(_0x44afbd){logger[_0x46eb('0xd')](_0x46eb('0x23'),_0x36658f);logger[_0x46eb('0x10')](_0x46eb('0x23'),_0x36658f,JSON['stringify'](_0x44afbd));_0x5ce5b9(_0x44afbd);})[_0x46eb('0x17')](function(_0x3562eb){logger[_0x46eb('0x13')](_0x46eb('0x23'),_0x3562eb[_0x46eb('0x15')],_0x36658f);_0x463656(_0x3eedd0[_0x46eb('0x13')](0x1f4,_0x3562eb[_0x46eb('0x15')]));});});};exports[_0x46eb('0x26')]=function(_0x30769f){var _0x519b3c=this;return new Promise(function(_0x4b1db6,_0x54343a){return db[_0x46eb('0x19')]['update'](_0x30769f['body'],{'raw':_0x30769f['options']?_0x30769f[_0x46eb('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30769f[_0x46eb('0x1b')]?_0x30769f[_0x46eb('0x1b')][_0x46eb('0x1d')]||null:null,'attributes':_0x30769f[_0x46eb('0x1b')]?_0x30769f[_0x46eb('0x1b')][_0x46eb('0x1e')]||null:null,'limit':_0x30769f[_0x46eb('0x1b')]?_0x30769f[_0x46eb('0x1b')][_0x46eb('0x1f')]||null:null})[_0x46eb('0xc')](function(_0x1ecdb7){logger[_0x46eb('0xd')](_0x46eb('0x26'),_0x30769f);logger['debug'](_0x46eb('0x26'),_0x30769f,JSON[_0x46eb('0x12')](_0x1ecdb7));_0x4b1db6(_0x1ecdb7);})[_0x46eb('0x17')](function(_0x9bd05c){logger[_0x46eb('0x13')](_0x46eb('0x26'),_0x9bd05c[_0x46eb('0x15')],_0x30769f);_0x54343a(_0x519b3c[_0x46eb('0x13')](0x1f4,_0x9bd05c['message']));});});}; \ No newline at end of file +var _0x1af1=['MemberReport,\x20%s,\x20%s','message','info','result','catch','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','GetMemberReport','stringify','CreateMemberReport','create','body','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x4f2c3a,_0x6bde90){var _0x17d91c=function(_0xaaf630){while(--_0xaaf630){_0x4f2c3a['push'](_0x4f2c3a['shift']());}};_0x17d91c(++_0x6bde90);}(_0x1af1,0x6a));var _0x11af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1af1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x11af('0x0'));var util=require(_0x11af('0x1'));var moment=require(_0x11af('0x2'));var BPromise=require(_0x11af('0x3'));var rs=require(_0x11af('0x4'));var fs=require('fs');var Redis=require(_0x11af('0x5'));var db=require(_0x11af('0x6'))['db'];var utils=require(_0x11af('0x7'));var logger=require(_0x11af('0x8'))(_0x11af('0x9'));var config=require(_0x11af('0xa'));var jayson=require(_0x11af('0xb'));var client=jayson[_0x11af('0xc')][_0x11af('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x564a2e,_0x220125,_0x2e12b0){return new BPromise(function(_0x35ff0f,_0x45bcdb){return client[_0x11af('0xe')](_0x564a2e,_0x2e12b0)[_0x11af('0xf')](function(_0x1b2b32){logger['info']('MemberReport,\x20%s,\x20%s',_0x220125,_0x11af('0x10'));logger[_0x11af('0x11')](_0x11af('0x12'),_0x220125,_0x11af('0x10'),JSON['stringify'](_0x1b2b32));if(_0x1b2b32[_0x11af('0x13')]){if(_0x1b2b32[_0x11af('0x13')]['code']===0x1f4){logger[_0x11af('0x13')](_0x11af('0x14'),_0x220125,_0x1b2b32[_0x11af('0x13')][_0x11af('0x15')]);return _0x45bcdb(_0x1b2b32[_0x11af('0x13')][_0x11af('0x15')]);}logger[_0x11af('0x13')](_0x11af('0x14'),_0x220125,_0x1b2b32[_0x11af('0x13')][_0x11af('0x15')]);return _0x35ff0f(_0x1b2b32[_0x11af('0x13')][_0x11af('0x15')]);}else{logger[_0x11af('0x16')](_0x11af('0x14'),_0x220125,_0x11af('0x10'));_0x35ff0f(_0x1b2b32[_0x11af('0x17')]['message']);}})[_0x11af('0x18')](function(_0x207e47){logger['error']('MemberReport,\x20%s,\x20%s',_0x220125,_0x207e47);_0x45bcdb(_0x207e47);});});}exports['GetMemberReport']=function(_0x14cb57){var _0x1f2910=this;return new Promise(function(_0x47177e,_0x412aea){return db[_0x11af('0x19')][_0x11af('0x1a')]({'raw':_0x14cb57[_0x11af('0x1b')]?_0x14cb57[_0x11af('0x1b')][_0x11af('0x1c')]===undefined?!![]:![]:!![],'where':_0x14cb57[_0x11af('0x1b')]?_0x14cb57['options'][_0x11af('0x1d')]||null:null,'attributes':_0x14cb57[_0x11af('0x1b')]?_0x14cb57['options'][_0x11af('0x1e')]||null:null,'limit':_0x14cb57[_0x11af('0x1b')]?_0x14cb57['options'][_0x11af('0x1f')]||null:null,'include':_0x14cb57[_0x11af('0x1b')]?_0x14cb57[_0x11af('0x1b')][_0x11af('0x20')]?_[_0x11af('0x21')](_0x14cb57[_0x11af('0x1b')][_0x11af('0x20')],function(_0x3450f4){return{'model':db[_0x3450f4[_0x11af('0x22')]],'as':_0x3450f4['as'],'attributes':_0x3450f4[_0x11af('0x1e')],'include':_0x3450f4[_0x11af('0x20')]?_[_0x11af('0x21')](_0x3450f4[_0x11af('0x20')],function(_0x55641c){return{'model':db[_0x55641c[_0x11af('0x22')]],'as':_0x55641c['as'],'attributes':_0x55641c[_0x11af('0x1e')],'include':_0x55641c[_0x11af('0x20')]?_[_0x11af('0x21')](_0x55641c[_0x11af('0x20')],function(_0x1d2900){return{'model':db[_0x1d2900[_0x11af('0x22')]],'as':_0x1d2900['as'],'attributes':_0x1d2900[_0x11af('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x11af('0xf')](function(_0x5ed8a4){logger[_0x11af('0x16')](_0x11af('0x23'),_0x14cb57);logger[_0x11af('0x11')](_0x11af('0x23'),_0x14cb57,JSON[_0x11af('0x24')](_0x5ed8a4));_0x47177e(_0x5ed8a4);})[_0x11af('0x18')](function(_0x48a8bb){logger[_0x11af('0x13')](_0x11af('0x23'),_0x48a8bb[_0x11af('0x15')],_0x14cb57);_0x412aea(_0x1f2910[_0x11af('0x13')](0x1f4,_0x48a8bb[_0x11af('0x15')]));});});};exports[_0x11af('0x25')]=function(_0xf9a8db){var _0x2669e1=this;return new Promise(function(_0x2006a0,_0x3398f7){return db[_0x11af('0x19')][_0x11af('0x26')](_0xf9a8db[_0x11af('0x27')],{'raw':_0xf9a8db[_0x11af('0x1b')]?_0xf9a8db['options'][_0x11af('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x48bfd8){logger['info']('CreateMemberReport',_0xf9a8db);logger[_0x11af('0x11')](_0x11af('0x25'),_0xf9a8db,JSON[_0x11af('0x24')](_0x48bfd8));_0x2006a0(_0x48bfd8);})[_0x11af('0x18')](function(_0x58b89a){logger[_0x11af('0x13')](_0x11af('0x25'),_0x58b89a['message'],_0xf9a8db);_0x3398f7(_0x2669e1['error'](0x1f4,_0x58b89a[_0x11af('0x15')]));});});};exports[_0x11af('0x28')]=function(_0x31ac86){var _0x4b7e9b=this;return new Promise(function(_0x31cdfb,_0x3e8bd8){return db[_0x11af('0x19')][_0x11af('0x29')](_0x31ac86[_0x11af('0x27')],{'raw':_0x31ac86['options']?_0x31ac86['options'][_0x11af('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31ac86[_0x11af('0x1b')]?_0x31ac86[_0x11af('0x1b')][_0x11af('0x1d')]||null:null,'attributes':_0x31ac86['options']?_0x31ac86[_0x11af('0x1b')]['attributes']||null:null,'limit':_0x31ac86['options']?_0x31ac86[_0x11af('0x1b')][_0x11af('0x1f')]||null:null})[_0x11af('0xf')](function(_0x334769){logger[_0x11af('0x16')](_0x11af('0x28'),_0x31ac86);logger[_0x11af('0x11')]('UpdateMemberReport',_0x31ac86,JSON[_0x11af('0x24')](_0x334769));_0x31cdfb(_0x334769);})[_0x11af('0x18')](function(_0x4d58b2){logger['error']('UpdateMemberReport',_0x4d58b2[_0x11af('0x15')],_0x31ac86);_0x3e8bd8(_0x4b7e9b[_0x11af('0x13')](0x1f4,_0x4d58b2[_0x11af('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 019324a..9dd483c 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 _0x0abf=['connect-timeout','../../components/auth/service','../../config/environment','./migration.controller','get','index','exports','multer','path'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0abf,0xe8));var _0xf0ab=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x0abf[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xf0ab('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf0ab('0x4'));var controller=require(_0xf0ab('0x5'));router[_0xf0ab('0x6')]('/',controller[_0xf0ab('0x7')]);module[_0xf0ab('0x8')]=router; \ No newline at end of file +var _0x5c00=['index','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x5d9e22,_0x24dd29){var _0x37a4f2=function(_0xc93d9b){while(--_0xc93d9b){_0x5d9e22['push'](_0x5d9e22['shift']());}};_0x37a4f2(++_0x24dd29);}(_0x5c00,0x17e));var _0x05c0=function(_0x98ac1f,_0x2effb0){_0x98ac1f=_0x98ac1f-0x0;var _0x1579d1=_0x5c00[_0x98ac1f];return _0x1579d1;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var auth=require(_0x05c0('0x4'));var interaction=require(_0x05c0('0x5'));var config=require(_0x05c0('0x6'));var controller=require(_0x05c0('0x7'));router['get']('/',controller[_0x05c0('0x8')]);module[_0x05c0('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 22e822f..dfad493 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 _0x4f0b=['STRING','version','sequelize','exports'];(function(_0x527733,_0x16051c){var _0x5400ba=function(_0x265d39){while(--_0x265d39){_0x527733['push'](_0x527733['shift']());}};_0x5400ba(++_0x16051c);}(_0x4f0b,0x1c6));var _0xb4f0=function(_0x284cf2,_0x2cd1d1){_0x284cf2=_0x284cf2-0x0;var _0x47703b=_0x4f0b[_0x284cf2];return _0x47703b;};'use strict';var Sequelize=require(_0xb4f0('0x0'));module[_0xb4f0('0x1')]={'version':{'type':Sequelize[_0xb4f0('0x2')],'unique':_0xb4f0('0x3')}}; \ No newline at end of file +var _0xc5a4=['sequelize','exports','STRING','version'];(function(_0x540315,_0x5e4286){var _0x45b752=function(_0x42f23e){while(--_0x42f23e){_0x540315['push'](_0x540315['shift']());}};_0x45b752(++_0x5e4286);}(_0xc5a4,0x184));var _0x4c5a=function(_0x113708,_0x3b72d5){_0x113708=_0x113708-0x0;var _0x33fc82=_0xc5a4[_0x113708];return _0x33fc82;};'use strict';var Sequelize=require(_0x4c5a('0x0'));module[_0x4c5a('0x1')]={'version':{'type':Sequelize[_0x4c5a('0x2')],'unique':_0x4c5a('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index a1cdbfa..47cf8c3 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 _0xdfb2=['sox','to-csv','ejs','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','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','index','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','Migration','count','includeAll','include','rows','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path'];(function(_0xfc0976,_0x33776f){var _0x23579f=function(_0x4143d9){while(--_0x4143d9){_0xfc0976['push'](_0xfc0976['shift']());}};_0x23579f(++_0x33776f);}(_0xdfb2,0x83));var _0x2dfb=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xdfb2[_0x278e3c];return _0x3e2d9b;};'use strict';var pdf=require(_0x2dfb('0x0'));var emlformat=require(_0x2dfb('0x1'));var rimraf=require(_0x2dfb('0x2'));var zipdir=require(_0x2dfb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2dfb('0x4'));var BPromise=require(_0x2dfb('0x5'));var Mustache=require(_0x2dfb('0x6'));var util=require(_0x2dfb('0x7'));var path=require(_0x2dfb('0x8'));var sox=require(_0x2dfb('0x9'));var csv=require(_0x2dfb('0xa'));var ejs=require(_0x2dfb('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2dfb('0xc'));var crypto=require(_0x2dfb('0xd'));var jsforce=require(_0x2dfb('0xe'));var deskjs=require(_0x2dfb('0xf'));var toCsv=require(_0x2dfb('0xa'));var querystring=require(_0x2dfb('0x10'));var Papa=require(_0x2dfb('0x11'));var Redis=require(_0x2dfb('0x12'));var authService=require(_0x2dfb('0x13'));var qs=require(_0x2dfb('0x14'));var as=require(_0x2dfb('0x15'));var hardwareService=require(_0x2dfb('0x16'));var logger=require(_0x2dfb('0x17'))(_0x2dfb('0x18'));var utils=require(_0x2dfb('0x19'));var config=require(_0x2dfb('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x2dfb('0x1b'))['db'];function respondWithStatusCode(_0x4d93d6,_0x956f32){_0x956f32=_0x956f32||0xcc;return function(_0x445926){if(_0x445926){return _0x4d93d6['sendStatus'](_0x956f32);}return _0x4d93d6[_0x2dfb('0x1c')](_0x956f32)[_0x2dfb('0x1d')]();};}function respondWithResult(_0x599dcd,_0x174b54){_0x174b54=_0x174b54||0xc8;return function(_0x582994){if(_0x582994){return _0x599dcd['status'](_0x174b54)[_0x2dfb('0x1e')](_0x582994);}};}function respondWithFilteredResult(_0xa28f09,_0x53331d){return function(_0x2911a2){if(_0x2911a2){var _0x4e238d=_0x2911a2['count'],_0xe0029f=_0x53331d[_0x2dfb('0x1f')],_0x22b397=_0x53331d[_0x2dfb('0x1f')]+_0x53331d[_0x2dfb('0x20')],_0x56244f;if(_0x22b397>=_0x4e238d){_0x22b397=_0x4e238d;_0x56244f=0xc8;}else{_0x56244f=0xce;}_0xa28f09['status'](_0x56244f);return _0xa28f09[_0x2dfb('0x21')](_0x2dfb('0x22'),_0xe0029f+'-'+_0x22b397+'/'+_0x4e238d)[_0x2dfb('0x1e')](_0x2911a2);}return null;};}function patchUpdates(_0x32d00e){return function(_0xe56773){try{jsonpatch[_0x2dfb('0x23')](_0xe56773,_0x32d00e,!![]);}catch(_0x1483d7){return BPromise[_0x2dfb('0x24')](_0x1483d7);}return _0xe56773[_0x2dfb('0x25')]();};}function saveUpdates(_0x572cf6,_0xc6df1a){return function(_0x301d1a){if(_0x301d1a){return _0x301d1a[_0x2dfb('0x26')](_0x572cf6)[_0x2dfb('0x27')](function(_0x1ed27a){return _0x1ed27a;});}return null;};}function removeEntity(_0x45f8c8,_0x4f270d){return function(_0x2eceeb){if(_0x2eceeb){return _0x2eceeb['destroy']()[_0x2dfb('0x27')](function(){_0x45f8c8[_0x2dfb('0x1c')](0xcc)[_0x2dfb('0x1d')]();});}};}function handleEntityNotFound(_0xfae424,_0x26c792){return function(_0x45ce1a){if(!_0x45ce1a){_0xfae424[_0x2dfb('0x28')](0x194);}return _0x45ce1a;};}function handleError(_0x1fd74c,_0x25f238){_0x25f238=_0x25f238||0x1f4;return function(_0x301108){logger[_0x2dfb('0x29')](_0x301108['stack']);if(_0x301108['name']){delete _0x301108[_0x2dfb('0x2a')];}_0x1fd74c[_0x2dfb('0x1c')](_0x25f238)[_0x2dfb('0x2b')](_0x301108);};}exports[_0x2dfb('0x2c')]=function(_0x4cb200,_0xb875fc){var _0x5ed012={},_0x125e73={},_0x557e8e={'count':0x0,'rows':[]};var _0xb9e2f9=_[_0x2dfb('0x2d')](db['Migration']['rawAttributes'],function(_0x25a439){return{'name':_0x25a439[_0x2dfb('0x2e')],'type':_0x25a439[_0x2dfb('0x2f')][_0x2dfb('0x30')]};});_0x125e73[_0x2dfb('0x31')]=_[_0x2dfb('0x2d')](_0xb9e2f9,_0x2dfb('0x2a'));_0x125e73[_0x2dfb('0x32')]=_[_0x2dfb('0x33')](_0x4cb200[_0x2dfb('0x32')]);_0x125e73['filters']=_['intersection'](_0x125e73[_0x2dfb('0x31')],_0x125e73[_0x2dfb('0x32')]);_0x5ed012[_0x2dfb('0x34')]=_[_0x2dfb('0x35')](_0x125e73[_0x2dfb('0x31')],qs[_0x2dfb('0x36')](_0x4cb200[_0x2dfb('0x32')][_0x2dfb('0x36')]));_0x5ed012[_0x2dfb('0x34')]=_0x5ed012[_0x2dfb('0x34')][_0x2dfb('0x37')]?_0x5ed012[_0x2dfb('0x34')]:_0x125e73[_0x2dfb('0x31')];if(!_0x4cb200[_0x2dfb('0x32')][_0x2dfb('0x38')]('nolimit')){_0x5ed012[_0x2dfb('0x20')]=qs[_0x2dfb('0x20')](_0x4cb200[_0x2dfb('0x32')][_0x2dfb('0x20')]);_0x5ed012['offset']=qs[_0x2dfb('0x1f')](_0x4cb200['query'][_0x2dfb('0x1f')]);}_0x5ed012[_0x2dfb('0x39')]=qs[_0x2dfb('0x3a')](_0x4cb200[_0x2dfb('0x32')][_0x2dfb('0x3a')]);_0x5ed012[_0x2dfb('0x3b')]=qs[_0x2dfb('0x3c')](_['pick'](_0x4cb200[_0x2dfb('0x32')],_0x125e73[_0x2dfb('0x3c')]),_0xb9e2f9);if(_0x4cb200['query'][_0x2dfb('0x3d')]){_0x5ed012['where']=_[_0x2dfb('0x3e')](_0x5ed012[_0x2dfb('0x3b')],{'$or':_[_0x2dfb('0x2d')](_0xb9e2f9,function(_0x30d91e){if(_0x30d91e['type']!==_0x2dfb('0x3f')){var _0x42c0e4={};_0x42c0e4[_0x30d91e[_0x2dfb('0x2a')]]={'$like':'%'+_0x4cb200[_0x2dfb('0x32')]['filter']+'%'};return _0x42c0e4;}})});}_0x5ed012=_[_0x2dfb('0x3e')]({},_0x5ed012,_0x4cb200[_0x2dfb('0x40')]);var _0x37e624={'where':_0x5ed012['where']};return db[_0x2dfb('0x41')][_0x2dfb('0x42')](_0x37e624)['then'](function(_0x3fa699){_0x557e8e[_0x2dfb('0x42')]=_0x3fa699;if(_0x4cb200[_0x2dfb('0x32')][_0x2dfb('0x43')]){_0x5ed012[_0x2dfb('0x44')]=[{'all':!![]}];}return db[_0x2dfb('0x41')]['findAll'](_0x5ed012);})[_0x2dfb('0x27')](function(_0x5e5917){_0x557e8e[_0x2dfb('0x45')]=_0x5e5917;return _0x557e8e;})[_0x2dfb('0x27')](respondWithFilteredResult(_0xb875fc,_0x5ed012))['catch'](handleError(_0xb875fc,null));}; \ No newline at end of file +var _0x0655=['fast-json-patch','request-promise','moment','bluebird','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','json','offset','limit','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x5db3ac,_0x3bc46f){var _0x43aab4=function(_0x1aeadc){while(--_0x1aeadc){_0x5db3ac['push'](_0x5db3ac['shift']());}};_0x43aab4(++_0x3bc46f);}(_0x0655,0x10c));var _0x5065=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0x0655[_0x3b1b23];return _0x1efc85;};'use strict';var pdf=require(_0x5065('0x0'));var emlformat=require(_0x5065('0x1'));var rimraf=require(_0x5065('0x2'));var zipdir=require(_0x5065('0x3'));var jsonpatch=require(_0x5065('0x4'));var rp=require(_0x5065('0x5'));var moment=require(_0x5065('0x6'));var BPromise=require(_0x5065('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5065('0x8'));var fs=require('fs');var _=require(_0x5065('0x9'));var squel=require(_0x5065('0xa'));var crypto=require(_0x5065('0xb'));var jsforce=require(_0x5065('0xc'));var deskjs=require(_0x5065('0xd'));var toCsv=require(_0x5065('0xe'));var querystring=require(_0x5065('0xf'));var Papa=require(_0x5065('0x10'));var Redis=require('ioredis');var authService=require(_0x5065('0x11'));var qs=require(_0x5065('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5065('0x13'));var logger=require('../../config/logger')(_0x5065('0x14'));var utils=require(_0x5065('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5065('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5333cc,_0x7fa4f1){_0x7fa4f1=_0x7fa4f1||0xcc;return function(_0x5dc02c){if(_0x5dc02c){return _0x5333cc['sendStatus'](_0x7fa4f1);}return _0x5333cc[_0x5065('0x17')](_0x7fa4f1)[_0x5065('0x18')]();};}function respondWithResult(_0x4e4564,_0x227bae){_0x227bae=_0x227bae||0xc8;return function(_0x4e0a1c){if(_0x4e0a1c){return _0x4e4564[_0x5065('0x17')](_0x227bae)[_0x5065('0x19')](_0x4e0a1c);}};}function respondWithFilteredResult(_0x1284d3,_0x5ae197){return function(_0x3f400b){if(_0x3f400b){var _0x1d4d2e=_0x3f400b['count'],_0x572b29=_0x5ae197[_0x5065('0x1a')],_0x2bd058=_0x5ae197['offset']+_0x5ae197[_0x5065('0x1b')],_0x18de33;if(_0x2bd058>=_0x1d4d2e){_0x2bd058=_0x1d4d2e;_0x18de33=0xc8;}else{_0x18de33=0xce;}_0x1284d3[_0x5065('0x17')](_0x18de33);return _0x1284d3['set'](_0x5065('0x1c'),_0x572b29+'-'+_0x2bd058+'/'+_0x1d4d2e)['json'](_0x3f400b);}return null;};}function patchUpdates(_0x3d90f9){return function(_0x4f6529){try{jsonpatch[_0x5065('0x1d')](_0x4f6529,_0x3d90f9,!![]);}catch(_0x1d714d){return BPromise[_0x5065('0x1e')](_0x1d714d);}return _0x4f6529[_0x5065('0x1f')]();};}function saveUpdates(_0x491793,_0x48ecfb){return function(_0x5cbd84){if(_0x5cbd84){return _0x5cbd84['update'](_0x491793)[_0x5065('0x20')](function(_0x2ba9d4){return _0x2ba9d4;});}return null;};}function removeEntity(_0x518010,_0x565c3b){return function(_0x3887d8){if(_0x3887d8){return _0x3887d8[_0x5065('0x21')]()[_0x5065('0x20')](function(){_0x518010[_0x5065('0x17')](0xcc)[_0x5065('0x18')]();});}};}function handleEntityNotFound(_0x48a517,_0x2882db){return function(_0x431d67){if(!_0x431d67){_0x48a517[_0x5065('0x22')](0x194);}return _0x431d67;};}function handleError(_0x2e6b0e,_0x2430d1){_0x2430d1=_0x2430d1||0x1f4;return function(_0x3995c1){logger[_0x5065('0x23')](_0x3995c1[_0x5065('0x24')]);if(_0x3995c1[_0x5065('0x25')]){delete _0x3995c1[_0x5065('0x25')];}_0x2e6b0e[_0x5065('0x17')](_0x2430d1)[_0x5065('0x26')](_0x3995c1);};}exports[_0x5065('0x27')]=function(_0xc26a8d,_0x509eab){var _0x4c3c1a={},_0x57303a={},_0x5b1488={'count':0x0,'rows':[]};var _0x478e19=_[_0x5065('0x28')](db[_0x5065('0x29')][_0x5065('0x2a')],function(_0x2c8046){return{'name':_0x2c8046[_0x5065('0x2b')],'type':_0x2c8046[_0x5065('0x2c')][_0x5065('0x2d')]};});_0x57303a[_0x5065('0x2e')]=_['map'](_0x478e19,_0x5065('0x25'));_0x57303a[_0x5065('0x2f')]=_[_0x5065('0x30')](_0xc26a8d['query']);_0x57303a[_0x5065('0x31')]=_[_0x5065('0x32')](_0x57303a[_0x5065('0x2e')],_0x57303a[_0x5065('0x2f')]);_0x4c3c1a[_0x5065('0x33')]=_[_0x5065('0x32')](_0x57303a[_0x5065('0x2e')],qs[_0x5065('0x34')](_0xc26a8d[_0x5065('0x2f')][_0x5065('0x34')]));_0x4c3c1a[_0x5065('0x33')]=_0x4c3c1a[_0x5065('0x33')]['length']?_0x4c3c1a[_0x5065('0x33')]:_0x57303a['model'];if(!_0xc26a8d[_0x5065('0x2f')]['hasOwnProperty'](_0x5065('0x35'))){_0x4c3c1a['limit']=qs[_0x5065('0x1b')](_0xc26a8d[_0x5065('0x2f')][_0x5065('0x1b')]);_0x4c3c1a[_0x5065('0x1a')]=qs[_0x5065('0x1a')](_0xc26a8d[_0x5065('0x2f')][_0x5065('0x1a')]);}_0x4c3c1a[_0x5065('0x36')]=qs['sort'](_0xc26a8d[_0x5065('0x2f')][_0x5065('0x37')]);_0x4c3c1a[_0x5065('0x38')]=qs[_0x5065('0x31')](_[_0x5065('0x39')](_0xc26a8d[_0x5065('0x2f')],_0x57303a[_0x5065('0x31')]),_0x478e19);if(_0xc26a8d[_0x5065('0x2f')][_0x5065('0x3a')]){_0x4c3c1a['where']=_['merge'](_0x4c3c1a[_0x5065('0x38')],{'$or':_[_0x5065('0x28')](_0x478e19,function(_0x25e773){if(_0x25e773[_0x5065('0x2c')]!==_0x5065('0x3b')){var _0x11e7ea={};_0x11e7ea[_0x25e773['name']]={'$like':'%'+_0xc26a8d[_0x5065('0x2f')][_0x5065('0x3a')]+'%'};return _0x11e7ea;}})});}_0x4c3c1a=_[_0x5065('0x3c')]({},_0x4c3c1a,_0xc26a8d[_0x5065('0x3d')]);var _0xc3e8f7={'where':_0x4c3c1a[_0x5065('0x38')]};return db[_0x5065('0x29')][_0x5065('0x3e')](_0xc3e8f7)[_0x5065('0x20')](function(_0x27ff87){_0x5b1488[_0x5065('0x3e')]=_0x27ff87;if(_0xc26a8d[_0x5065('0x2f')][_0x5065('0x3f')]){_0x4c3c1a[_0x5065('0x40')]=[{'all':!![]}];}return db[_0x5065('0x29')][_0x5065('0x41')](_0x4c3c1a);})[_0x5065('0x20')](function(_0x51c60e){_0x5b1488[_0x5065('0x42')]=_0x51c60e;return _0x5b1488;})[_0x5065('0x20')](respondWithFilteredResult(_0x509eab,_0x4c3c1a))[_0x5065('0x43')](handleError(_0x509eab,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index d97896d..eaae279 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 _0x1876=['request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','Migration','migrations','lodash','../../config/logger','api','moment'];(function(_0x416cdc,_0x213b87){var _0x1931ce=function(_0x1dc762){while(--_0x1dc762){_0x416cdc['push'](_0x416cdc['shift']());}};_0x1931ce(++_0x213b87);}(_0x1876,0xd4));var _0x6187=function(_0x33cbd3,_0x164dfd){_0x33cbd3=_0x33cbd3-0x0;var _0x56a810=_0x1876[_0x33cbd3];return _0x56a810;};'use strict';var _=require(_0x6187('0x0'));var util=require('util');var logger=require(_0x6187('0x1'))(_0x6187('0x2'));var moment=require(_0x6187('0x3'));var BPromise=require('bluebird');var rp=require(_0x6187('0x4'));var fs=require('fs');var path=require(_0x6187('0x5'));var rimraf=require(_0x6187('0x6'));var config=require(_0x6187('0x7'));var attributes=require(_0x6187('0x8'));module[_0x6187('0x9')]=function(_0x53b149,_0x2df289){return _0x53b149['define'](_0x6187('0xa'),attributes,{'tableName':_0x6187('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2189=['rimraf','./migration.attributes','exports','define','Migration','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x281db5,_0x286121){var _0x29f4bb=function(_0x57abaf){while(--_0x57abaf){_0x281db5['push'](_0x281db5['shift']());}};_0x29f4bb(++_0x286121);}(_0x2189,0x101));var _0x9218=function(_0x14c997,_0x23ba9b){_0x14c997=_0x14c997-0x0;var _0x5474d1=_0x2189[_0x14c997];return _0x5474d1;};'use strict';var _=require('lodash');var util=require(_0x9218('0x0'));var logger=require(_0x9218('0x1'))(_0x9218('0x2'));var moment=require(_0x9218('0x3'));var BPromise=require(_0x9218('0x4'));var rp=require(_0x9218('0x5'));var fs=require('fs');var path=require(_0x9218('0x6'));var rimraf=require(_0x9218('0x7'));var config=require('../../config/environment');var attributes=require(_0x9218('0x8'));module[_0x9218('0x9')]=function(_0x54e7a4,_0x3b9197){return _0x54e7a4[_0x9218('0xa')](_0x9218('0xb'),attributes,{'tableName':'migrations','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 d5623de..52c09dc 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 _0x4808=['stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x4808,0x160));var _0x8480=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x4808[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x8480('0x0'));var util=require(_0x8480('0x1'));var moment=require(_0x8480('0x2'));var BPromise=require('bluebird');var rs=require(_0x8480('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8480('0x4'))['db'];var utils=require(_0x8480('0x5'));var logger=require(_0x8480('0x6'))('rpc');var config=require(_0x8480('0x7'));var jayson=require(_0x8480('0x8'));var client=jayson['client'][_0x8480('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5060aa,_0x364f22,_0x4b9f45){return new BPromise(function(_0x3480e7,_0x2b1ffb){return client[_0x8480('0xa')](_0x5060aa,_0x4b9f45)[_0x8480('0xb')](function(_0x337d1e){logger['info'](_0x8480('0xc'),_0x364f22,_0x8480('0xd'));logger[_0x8480('0xe')](_0x8480('0xf'),_0x364f22,_0x8480('0xd'),JSON[_0x8480('0x10')](_0x337d1e));if(_0x337d1e[_0x8480('0x11')]){if(_0x337d1e[_0x8480('0x11')][_0x8480('0x12')]===0x1f4){logger[_0x8480('0x11')](_0x8480('0xc'),_0x364f22,_0x337d1e[_0x8480('0x11')][_0x8480('0x13')]);return _0x2b1ffb(_0x337d1e[_0x8480('0x11')][_0x8480('0x13')]);}logger[_0x8480('0x11')](_0x8480('0xc'),_0x364f22,_0x337d1e[_0x8480('0x11')][_0x8480('0x13')]);return _0x3480e7(_0x337d1e['error'][_0x8480('0x13')]);}else{logger[_0x8480('0x14')](_0x8480('0xc'),_0x364f22,'request\x20sent');_0x3480e7(_0x337d1e[_0x8480('0x15')][_0x8480('0x13')]);}})[_0x8480('0x16')](function(_0x35dd6a){logger[_0x8480('0x11')](_0x8480('0xc'),_0x364f22,_0x35dd6a);_0x2b1ffb(_0x35dd6a);});});} \ No newline at end of file +var _0x5aaa=['Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','Migration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x54e73b,_0x3956ae){var _0x357c4f=function(_0x3315d3){while(--_0x3315d3){_0x54e73b['push'](_0x54e73b['shift']());}};_0x357c4f(++_0x3956ae);}(_0x5aaa,0xeb));var _0xa5aa=function(_0xc206e4,_0x3467f6){_0xc206e4=_0xc206e4-0x0;var _0x46c3f6=_0x5aaa[_0xc206e4];return _0x46c3f6;};'use strict';var _=require(_0xa5aa('0x0'));var util=require(_0xa5aa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa5aa('0x2'));var fs=require('fs');var Redis=require(_0xa5aa('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa5aa('0x4'));var logger=require(_0xa5aa('0x5'))('rpc');var config=require(_0xa5aa('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa5aa('0x7')][_0xa5aa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48b057,_0x1338c4,_0x1e63f3){return new BPromise(function(_0x342598,_0x16e8bf){return client['request'](_0x48b057,_0x1e63f3)['then'](function(_0x46fa86){logger['info'](_0xa5aa('0x9'),_0x1338c4,_0xa5aa('0xa'));logger[_0xa5aa('0xb')](_0xa5aa('0xc'),_0x1338c4,_0xa5aa('0xa'),JSON[_0xa5aa('0xd')](_0x46fa86));if(_0x46fa86[_0xa5aa('0xe')]){if(_0x46fa86[_0xa5aa('0xe')][_0xa5aa('0xf')]===0x1f4){logger[_0xa5aa('0xe')]('Migration,\x20%s,\x20%s',_0x1338c4,_0x46fa86[_0xa5aa('0xe')][_0xa5aa('0x10')]);return _0x16e8bf(_0x46fa86['error'][_0xa5aa('0x10')]);}logger['error'](_0xa5aa('0x9'),_0x1338c4,_0x46fa86[_0xa5aa('0xe')]['message']);return _0x342598(_0x46fa86[_0xa5aa('0xe')]['message']);}else{logger['info']('Migration,\x20%s,\x20%s',_0x1338c4,_0xa5aa('0xa'));_0x342598(_0x46fa86[_0xa5aa('0x11')]['message']);}})[_0xa5aa('0x12')](function(_0x12cf15){logger['error'](_0xa5aa('0x9'),_0x1338c4,_0x12cf15);_0x16e8bf(_0x12cf15);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index f4abd13..a980556 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 _0x5958=['../../components/auth/service','../../config/environment','./network.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x447158,_0x3f22aa){var _0x52ebd8=function(_0x49d187){while(--_0x49d187){_0x447158['push'](_0x447158['shift']());}};_0x52ebd8(++_0x3f22aa);}(_0x5958,0x14e));var _0x8595=function(_0x23ec06,_0x561142){_0x23ec06=_0x23ec06-0x0;var _0x2831d4=_0x5958[_0x23ec06];return _0x2831d4;};'use strict';var multer=require(_0x8595('0x0'));var util=require(_0x8595('0x1'));var path=require(_0x8595('0x2'));var timeout=require(_0x8595('0x3'));var express=require(_0x8595('0x4'));var router=express[_0x8595('0x5')]();var auth=require(_0x8595('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8595('0x7'));var controller=require(_0x8595('0x8'));router['get']('/',auth[_0x8595('0x9')](),controller[_0x8595('0xa')]);router[_0x8595('0xb')](_0x8595('0xc'),auth[_0x8595('0x9')](),controller[_0x8595('0xd')]);router[_0x8595('0xe')]('/',auth[_0x8595('0x9')](),controller[_0x8595('0xf')]);router[_0x8595('0x10')](_0x8595('0xc'),auth[_0x8595('0x9')](),controller[_0x8595('0x11')]);router[_0x8595('0x12')]('/:id',auth[_0x8595('0x9')](),controller['destroy']);module[_0x8595('0x13')]=router; \ No newline at end of file +var _0x9269=['show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','../../config/environment','./network.controller','get','isAuthenticated','index'];(function(_0x2e537c,_0x13408a){var _0x13d3b7=function(_0x5a2382){while(--_0x5a2382){_0x2e537c['push'](_0x2e537c['shift']());}};_0x13d3b7(++_0x13408a);}(_0x9269,0x147));var _0x9926=function(_0x2ac5de,_0x2cebca){_0x2ac5de=_0x2ac5de-0x0;var _0x1415b2=_0x9269[_0x2ac5de];return _0x1415b2;};'use strict';var multer=require(_0x9926('0x0'));var util=require('util');var path=require(_0x9926('0x1'));var timeout=require(_0x9926('0x2'));var express=require(_0x9926('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9926('0x4'));var controller=require(_0x9926('0x5'));router[_0x9926('0x6')]('/',auth[_0x9926('0x7')](),controller[_0x9926('0x8')]);router[_0x9926('0x6')]('/:id',auth[_0x9926('0x7')](),controller[_0x9926('0x9')]);router[_0x9926('0xa')]('/',auth[_0x9926('0x7')](),controller[_0x9926('0xb')]);router[_0x9926('0xc')]('/:id',auth[_0x9926('0x7')](),controller[_0x9926('0xd')]);router['delete']('/:id',auth[_0x9926('0x7')](),controller[_0x9926('0xe')]);module[_0x9926('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 214b139..6986808 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 _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x2945ab,_0x583ca2){var _0x4587f4=function(_0x22712e){while(--_0x22712e){_0x2945ab['push'](_0x2945ab['shift']());}};_0x4587f4(++_0x583ca2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x237dde,_0x21f1f4){var _0x7734f8=function(_0x484dcd){while(--_0x484dcd){_0x237dde['push'](_0x237dde['shift']());}};_0x7734f8(++_0x21f1f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 0c9e2a9..148dc22 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 _0xe2de=['Network','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','show','find','create','sequelize','transaction','body','findAll','toUpperCase','STUN','readFileSync','join','root','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','params','server/files/templates/stun_multiple.ejs','eml-format','rimraf','zip-dir','moment','util','sox','to-csv','ejs','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','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','sendStatus','name','index','map'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe2de,0x100));var _0xee2d=function(_0x33330c,_0x311c5c){_0x33330c=_0x33330c-0x0;var _0x9e2133=_0xe2de[_0x33330c];return _0x9e2133;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xee2d('0x0'));var rimraf=require(_0xee2d('0x1'));var zipdir=require(_0xee2d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xee2d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xee2d('0x4'));var path=require('path');var sox=require(_0xee2d('0x5'));var csv=require(_0xee2d('0x6'));var ejs=require(_0xee2d('0x7'));var fs=require('fs');var _=require(_0xee2d('0x8'));var squel=require(_0xee2d('0x9'));var crypto=require(_0xee2d('0xa'));var jsforce=require(_0xee2d('0xb'));var deskjs=require(_0xee2d('0xc'));var toCsv=require('to-csv');var querystring=require(_0xee2d('0xd'));var Papa=require(_0xee2d('0xe'));var Redis=require(_0xee2d('0xf'));var authService=require(_0xee2d('0x10'));var qs=require(_0xee2d('0x11'));var as=require(_0xee2d('0x12'));var hardwareService=require(_0xee2d('0x13'));var logger=require(_0xee2d('0x14'))('api');var utils=require(_0xee2d('0x15'));var config=require(_0xee2d('0x16'));var licenseUtil=require(_0xee2d('0x17'));var db=require(_0xee2d('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xee2d('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2e794d,_0x205f9b,_0xdedccd,_0x3f670e){return new BPromise(function(_0x37e99d,_0x63abfc){var _0x24115f=_0x3f670e||client;return _0x24115f[_0xee2d('0x1a')](_0x2e794d,_0xdedccd)[_0xee2d('0x1b')](function(_0x2c8dce){logger[_0xee2d('0x1c')](_0xee2d('0x1d'),_0x205f9b,_0xee2d('0x1e'));logger[_0xee2d('0x1f')]('Network,\x20%s,\x20%s,\x20%s',_0x205f9b,'request\x20sent',JSON[_0xee2d('0x20')](_0x2c8dce));if(_0x2c8dce[_0xee2d('0x21')]){if(_0x2c8dce['error'][_0xee2d('0x22')]===0x1f4){logger[_0xee2d('0x21')](_0xee2d('0x1d'),_0x205f9b,_0x2c8dce[_0xee2d('0x21')]['message']);return _0x63abfc(_0x2c8dce[_0xee2d('0x21')][_0xee2d('0x23')]);}logger[_0xee2d('0x21')](_0xee2d('0x1d'),_0x205f9b,_0x2c8dce[_0xee2d('0x21')]['message']);return _0x37e99d(_0x2c8dce[_0xee2d('0x21')][_0xee2d('0x23')]);}else{logger[_0xee2d('0x1c')](_0xee2d('0x1d'),_0x205f9b,'request\x20sent');_0x37e99d(_0x2c8dce['result'][_0xee2d('0x23')]);}})[_0xee2d('0x24')](function(_0x1ea702){logger[_0xee2d('0x21')](_0xee2d('0x1d'),_0x205f9b,_0x1ea702);_0x63abfc(_0x1ea702);});});}function respondWithStatusCode(_0x584e12,_0x1e7519){_0x1e7519=_0x1e7519||0xcc;return function(_0x2a605d){if(_0x2a605d){return _0x584e12['sendStatus'](_0x1e7519);}return _0x584e12[_0xee2d('0x25')](_0x1e7519)[_0xee2d('0x26')]();};}function respondWithResult(_0x49dc1d,_0x220547){_0x220547=_0x220547||0xc8;return function(_0x4fb342){if(_0x4fb342){return _0x49dc1d[_0xee2d('0x25')](_0x220547)[_0xee2d('0x27')](_0x4fb342);}};}function respondWithFilteredResult(_0x227337,_0x58e32f){return function(_0x14e6da){if(_0x14e6da){var _0x3991be=_0x14e6da[_0xee2d('0x28')],_0x56b670=_0x58e32f['offset'],_0x2fc9cc=_0x58e32f[_0xee2d('0x29')]+_0x58e32f[_0xee2d('0x2a')],_0x11209f;if(_0x2fc9cc>=_0x3991be){_0x2fc9cc=_0x3991be;_0x11209f=0xc8;}else{_0x11209f=0xce;}_0x227337[_0xee2d('0x25')](_0x11209f);return _0x227337[_0xee2d('0x2b')](_0xee2d('0x2c'),_0x56b670+'-'+_0x2fc9cc+'/'+_0x3991be)[_0xee2d('0x27')](_0x14e6da);}return null;};}function patchUpdates(_0x22267e){return function(_0x96605c){try{jsonpatch[_0xee2d('0x2d')](_0x96605c,_0x22267e,!![]);}catch(_0x1fdb5b){return BPromise['reject'](_0x1fdb5b);}return _0x96605c[_0xee2d('0x2e')]();};}function saveUpdates(_0x44ddfe,_0xe2307d){return function(_0x79554d){if(_0x79554d){return _0x79554d[_0xee2d('0x2f')](_0x44ddfe)[_0xee2d('0x1b')](function(_0x5392fb){return _0x5392fb;});}return null;};}function removeEntity(_0x3f2911,_0x58b46a){return function(_0x8d751){if(_0x8d751){return _0x8d751[_0xee2d('0x30')]()[_0xee2d('0x1b')](function(){_0x3f2911['status'](0xcc)[_0xee2d('0x26')]();});}};}function handleEntityNotFound(_0x4d4fda,_0x31ac5a){return function(_0x21e935){if(!_0x21e935){_0x4d4fda[_0xee2d('0x31')](0x194);}return _0x21e935;};}function handleError(_0x5576e0,_0x105eaf){_0x105eaf=_0x105eaf||0x1f4;return function(_0x22be12){logger[_0xee2d('0x21')](_0x22be12['stack']);if(_0x22be12[_0xee2d('0x32')]){delete _0x22be12['name'];}_0x5576e0[_0xee2d('0x25')](_0x105eaf)['send'](_0x22be12);};}exports[_0xee2d('0x33')]=function(_0x939049,_0x586896){var _0x33b141={},_0x42f4e6={},_0x195ee1={'count':0x0,'rows':[]};var _0x3061f7=_[_0xee2d('0x34')](db[_0xee2d('0x35')][_0xee2d('0x36')],function(_0x31b036){return{'name':_0x31b036[_0xee2d('0x37')],'type':_0x31b036[_0xee2d('0x38')]['key']};});_0x42f4e6['model']=_[_0xee2d('0x34')](_0x3061f7,'name');_0x42f4e6[_0xee2d('0x39')]=_[_0xee2d('0x3a')](_0x939049[_0xee2d('0x39')]);_0x42f4e6[_0xee2d('0x3b')]=_[_0xee2d('0x3c')](_0x42f4e6[_0xee2d('0x3d')],_0x42f4e6[_0xee2d('0x39')]);_0x33b141[_0xee2d('0x3e')]=_[_0xee2d('0x3c')](_0x42f4e6[_0xee2d('0x3d')],qs[_0xee2d('0x3f')](_0x939049[_0xee2d('0x39')]['fields']));_0x33b141[_0xee2d('0x3e')]=_0x33b141[_0xee2d('0x3e')][_0xee2d('0x40')]?_0x33b141[_0xee2d('0x3e')]:_0x42f4e6['model'];if(!_0x939049[_0xee2d('0x39')]['hasOwnProperty']('nolimit')){_0x33b141[_0xee2d('0x2a')]=qs[_0xee2d('0x2a')](_0x939049['query'][_0xee2d('0x2a')]);_0x33b141[_0xee2d('0x29')]=qs[_0xee2d('0x29')](_0x939049[_0xee2d('0x39')]['offset']);}_0x33b141[_0xee2d('0x41')]=qs['sort'](_0x939049[_0xee2d('0x39')][_0xee2d('0x42')]);_0x33b141[_0xee2d('0x43')]=qs['filters'](_[_0xee2d('0x44')](_0x939049[_0xee2d('0x39')],_0x42f4e6[_0xee2d('0x3b')]),_0x3061f7);if(_0x939049[_0xee2d('0x39')][_0xee2d('0x45')]){_0x33b141[_0xee2d('0x43')]=_['merge'](_0x33b141['where'],{'$or':_[_0xee2d('0x34')](_0x3061f7,function(_0x2a2e5e){if(_0x2a2e5e[_0xee2d('0x38')]!==_0xee2d('0x46')){var _0x1e7a6e={};_0x1e7a6e[_0x2a2e5e[_0xee2d('0x32')]]={'$like':'%'+_0x939049[_0xee2d('0x39')][_0xee2d('0x45')]+'%'};return _0x1e7a6e;}})});}_0x33b141=_[_0xee2d('0x47')]({},_0x33b141,_0x939049['options']);var _0x56fbb8={'where':_0x33b141['where']};return db['Network'][_0xee2d('0x28')](_0x56fbb8)[_0xee2d('0x1b')](function(_0x23e884){_0x195ee1['count']=_0x23e884;if(_0x939049[_0xee2d('0x39')][_0xee2d('0x48')]){_0x33b141[_0xee2d('0x49')]=[{'all':!![]}];}return db[_0xee2d('0x35')]['findAll'](_0x33b141);})['then'](function(_0x3c266b){_0x195ee1[_0xee2d('0x4a')]=_0x3c266b;return _0x195ee1;})[_0xee2d('0x1b')](respondWithFilteredResult(_0x586896,_0x33b141))[_0xee2d('0x24')](handleError(_0x586896,null));};exports[_0xee2d('0x4b')]=function(_0x41d59d,_0x445381){var _0x3f6e03={'raw':!![],'where':{'id':_0x41d59d['params']['id']}},_0x3254a7={};_0x3254a7[_0xee2d('0x3d')]=_[_0xee2d('0x3a')](db[_0xee2d('0x35')][_0xee2d('0x36')]);_0x3254a7[_0xee2d('0x39')]=_['keys'](_0x41d59d[_0xee2d('0x39')]);_0x3254a7[_0xee2d('0x3b')]=_['intersection'](_0x3254a7[_0xee2d('0x3d')],_0x3254a7[_0xee2d('0x39')]);_0x3f6e03[_0xee2d('0x3e')]=_[_0xee2d('0x3c')](_0x3254a7[_0xee2d('0x3d')],qs['fields'](_0x41d59d[_0xee2d('0x39')][_0xee2d('0x3f')]));_0x3f6e03[_0xee2d('0x3e')]=_0x3f6e03[_0xee2d('0x3e')][_0xee2d('0x40')]?_0x3f6e03[_0xee2d('0x3e')]:_0x3254a7[_0xee2d('0x3d')];if(_0x41d59d[_0xee2d('0x39')][_0xee2d('0x48')]){_0x3f6e03[_0xee2d('0x49')]=[{'all':!![]}];}_0x3f6e03=_[_0xee2d('0x47')]({},_0x3f6e03,_0x41d59d['options']);return db['Network'][_0xee2d('0x4c')](_0x3f6e03)[_0xee2d('0x1b')](handleEntityNotFound(_0x445381,null))[_0xee2d('0x1b')](respondWithResult(_0x445381,null))['catch'](handleError(_0x445381,null));};exports[_0xee2d('0x4d')]=function(_0xb5285,_0x2d2530,_0x4e7262){var _0x2701cf;return db[_0xee2d('0x4e')][_0xee2d('0x4f')](function(_0x6588b2){return db[_0xee2d('0x35')]['create'](_0xb5285[_0xee2d('0x50')],{'raw':!![]})['then'](function(_0xd3c810){_0x2701cf=_0xd3c810;return db['Network'][_0xee2d('0x51')]({'where':{'type':_0xb5285[_0xee2d('0x50')][_0xee2d('0x38')]},'raw':!![]});})[_0xee2d('0x1b')](function(_0x552c49){if(_0x2701cf['type'][_0xee2d('0x52')]()==_0xee2d('0x53')){var _0x26d6fe=fs[_0xee2d('0x54')](path[_0xee2d('0x55')](config[_0xee2d('0x56')],'server/files/templates/stun_multiple.ejs'),_0xee2d('0x57'));var _0x2d7f3b=ejs[_0xee2d('0x58')](_0x26d6fe,{'networks':_0x552c49||[]});fs['writeFileSync'](_0xee2d('0x59'),_0x2d7f3b);return respondWithRpcPromise(_0xee2d('0x5a'),_0xee2d('0x4d'),{'module':_0xee2d('0x5b')});}else if(_0x2701cf[_0xee2d('0x38')]['toUpperCase']()==_0xee2d('0x5c')){var _0x1635b0=fs[_0xee2d('0x54')](path['join'](config[_0xee2d('0x56')],_0xee2d('0x5d')),'utf8');var _0x20665a=ejs[_0xee2d('0x58')](_0x1635b0,{'networks':_0x552c49||[]});fs[_0xee2d('0x5e')](_0xee2d('0x5f'),_0x20665a);return respondWithRpcPromise(_0xee2d('0x5a'),_0xee2d('0x4d'),{'module':_0xee2d('0x5b')});}else{var _0x4e0252=fs[_0xee2d('0x54')](path[_0xee2d('0x55')](config[_0xee2d('0x56')],_0xee2d('0x60')),_0xee2d('0x57'));var _0x13a283=ejs['render'](_0x4e0252,{'networks':_0x552c49||[]});fs['writeFileSync'](util[_0xee2d('0x61')](_0xee2d('0x62'),_0xb5285[_0xee2d('0x50')]['type'][_0xee2d('0x63')]()),_0x13a283);return respondWithRpcPromise(_0xee2d('0x5a'),_0xee2d('0x4d'),{'module':_0xee2d('0x64')});}return null;})['then'](function(){return _0x2701cf;});})['then'](respondWithResult(_0x2d2530,0xc9))[_0xee2d('0x24')](handleError(_0x2d2530,null));};exports[_0xee2d('0x2f')]=function(_0x455837,_0x3b86bc,_0x1df633){var _0x532ccb;return db[_0xee2d('0x4e')][_0xee2d('0x4f')](function(_0x3c3905){return db[_0xee2d('0x35')][_0xee2d('0x4c')]({'where':{'id':_0x455837[_0xee2d('0x65')]['id']}})[_0xee2d('0x1b')](handleEntityNotFound(_0x3b86bc,null))[_0xee2d('0x1b')](saveUpdates(_0x455837['body'],null))[_0xee2d('0x1b')](function(_0x29ffcd){if(_0x29ffcd){_0x532ccb=_0x29ffcd;return db[_0xee2d('0x35')][_0xee2d('0x51')]({'where':{'type':_0x532ccb[_0xee2d('0x38')]},'raw':!![]});}return null;})[_0xee2d('0x1b')](function(_0x14381a){if(_0x532ccb[_0xee2d('0x38')][_0xee2d('0x52')]()=='STUN'){var _0x38f637=fs[_0xee2d('0x54')](path[_0xee2d('0x55')](config[_0xee2d('0x56')],_0xee2d('0x66')),'utf8');var _0x178e3d=ejs[_0xee2d('0x58')](_0x38f637,{'networks':_0x14381a||[]});fs['writeFileSync'](_0xee2d('0x59'),_0x178e3d);return respondWithRpcPromise(_0xee2d('0x5a'),_0xee2d('0x2f'),{'module':_0xee2d('0x5b')});}else if(_0x532ccb[_0xee2d('0x38')][_0xee2d('0x52')]()=='TURN'){var _0x3b9ecb=fs[_0xee2d('0x54')](path[_0xee2d('0x55')](config[_0xee2d('0x56')],_0xee2d('0x5d')),_0xee2d('0x57'));var _0x2dd904=ejs[_0xee2d('0x58')](_0x3b9ecb,{'networks':_0x14381a||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x2dd904);return respondWithRpcPromise('Reload',_0xee2d('0x2f'),{'module':'res_stun_monitor.so'});}else{var _0x4f383a=fs[_0xee2d('0x54')](path[_0xee2d('0x55')](config['root'],_0xee2d('0x60')),_0xee2d('0x57'));var _0x435e76=ejs['render'](_0x4f383a,{'networks':_0x14381a||[]});fs[_0xee2d('0x5e')](util[_0xee2d('0x61')](_0xee2d('0x62'),_0x455837[_0xee2d('0x50')][_0xee2d('0x38')][_0xee2d('0x63')]()),_0x435e76);return respondWithRpcPromise(_0xee2d('0x5a'),_0xee2d('0x2f'),{'module':_0xee2d('0x64')});}return null;})['then'](function(_0x273202){if(_0x273202){return _0x532ccb;}return null;});})['then'](respondWithResult(_0x3b86bc,null))['catch'](handleError(_0x3b86bc,null));};exports['destroy']=function(_0x4b0bcb,_0x705c23,_0x486b74){var _0x1c1e88;return db[_0xee2d('0x35')][_0xee2d('0x4c')]({'where':{'id':_0x4b0bcb[_0xee2d('0x65')]['id']}})['then'](function(_0x4ea3a9){_0x1c1e88=_0x4ea3a9;return _0x4ea3a9;})[_0xee2d('0x1b')](handleEntityNotFound(_0x705c23,null))[_0xee2d('0x1b')](removeEntity(_0x705c23,null))[_0xee2d('0x1b')](function(){if(_0x1c1e88){return db['Network'][_0xee2d('0x51')]({'where':{'type':_0x1c1e88[_0xee2d('0x38')]},'raw':!![]});}})[_0xee2d('0x1b')](function(_0x1e9fc4){if(_0x1c1e88['type']['toUpperCase']()==_0xee2d('0x53')){var _0x5c194f=fs[_0xee2d('0x54')](path[_0xee2d('0x55')](config[_0xee2d('0x56')],_0xee2d('0x66')),_0xee2d('0x57'));var _0x584d24=ejs['render'](_0x5c194f,{'networks':_0x1e9fc4||[]});fs[_0xee2d('0x5e')](_0xee2d('0x59'),_0x584d24);return respondWithRpcPromise(_0xee2d('0x5a'),_0xee2d('0x30'),{'module':_0xee2d('0x5b')});}else if(_0x1c1e88[_0xee2d('0x38')][_0xee2d('0x52')]()==_0xee2d('0x5c')){var _0x50410f=fs['readFileSync'](path[_0xee2d('0x55')](config[_0xee2d('0x56')],'server/files/templates/turn_multiple.ejs'),_0xee2d('0x57'));var _0x45e310=ejs[_0xee2d('0x58')](_0x50410f,{'networks':_0x1e9fc4||[]});fs['writeFileSync'](_0xee2d('0x5f'),_0x45e310);return respondWithRpcPromise(_0xee2d('0x5a'),'destroy',{'module':_0xee2d('0x5b')});}else{var _0x513bc8=fs[_0xee2d('0x54')](path[_0xee2d('0x55')](config[_0xee2d('0x56')],'server/files/templates/network.ejs'),_0xee2d('0x57'));var _0x4c8ec6=ejs[_0xee2d('0x58')](_0x513bc8,{'networks':_0x1e9fc4||[]});fs['writeFileSync'](util['format'](_0xee2d('0x62'),_0x4b0bcb[_0xee2d('0x50')][_0xee2d('0x38')]['toLowerCase']()),_0x4c8ec6);return respondWithRpcPromise(_0xee2d('0x5a'),_0xee2d('0x30'),{'module':'chan_sip.so'});}return null;})['catch'](handleError(_0x705c23,null));}; \ No newline at end of file +var _0x62ef=['fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','filters','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','params','keys','find','create','transaction','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','/etc/asterisk/stun_xcally.conf','join','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','render','writeFileSync','format','/etc/asterisk/sip_xcally_%s.conf','Reload','update','TURN','server/files/templates/network.ejs','toLowerCase','chan_sip.so','server/files/templates/turn_multiple.ejs','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../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','end','status','json','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','Network','rawAttributes'];(function(_0x4927ea,_0xd8e606){var _0x49fe44=function(_0x2e8da9){while(--_0x2e8da9){_0x4927ea['push'](_0x4927ea['shift']());}};_0x49fe44(++_0xd8e606);}(_0x62ef,0x173));var _0xf62e=function(_0x136dbb,_0x2b0666){_0x136dbb=_0x136dbb-0x0;var _0x6a5309=_0x62ef[_0x136dbb];return _0x6a5309;};'use strict';var pdf=require(_0xf62e('0x0'));var emlformat=require(_0xf62e('0x1'));var rimraf=require(_0xf62e('0x2'));var zipdir=require(_0xf62e('0x3'));var jsonpatch=require(_0xf62e('0x4'));var rp=require(_0xf62e('0x5'));var moment=require(_0xf62e('0x6'));var BPromise=require(_0xf62e('0x7'));var Mustache=require(_0xf62e('0x8'));var util=require(_0xf62e('0x9'));var path=require(_0xf62e('0xa'));var sox=require(_0xf62e('0xb'));var csv=require(_0xf62e('0xc'));var ejs=require(_0xf62e('0xd'));var fs=require('fs');var _=require(_0xf62e('0xe'));var squel=require(_0xf62e('0xf'));var crypto=require('crypto');var jsforce=require(_0xf62e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf62e('0xc'));var querystring=require(_0xf62e('0x11'));var Papa=require(_0xf62e('0x12'));var Redis=require(_0xf62e('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf62e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf62e('0x15'))(_0xf62e('0x16'));var utils=require(_0xf62e('0x17'));var config=require(_0xf62e('0x18'));var licenseUtil=require(_0xf62e('0x19'));var db=require(_0xf62e('0x1a'))['db'];var jayson=require(_0xf62e('0x1b'));var client=jayson[_0xf62e('0x1c')][_0xf62e('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x46ea9f,_0xe3f951,_0x4aa9be,_0xbfcff2){return new BPromise(function(_0x545775,_0x46de2e){var _0x343b48=_0xbfcff2||client;return _0x343b48[_0xf62e('0x1e')](_0x46ea9f,_0x4aa9be)[_0xf62e('0x1f')](function(_0x263fac){logger[_0xf62e('0x20')](_0xf62e('0x21'),_0xe3f951,_0xf62e('0x22'));logger[_0xf62e('0x23')](_0xf62e('0x24'),_0xe3f951,_0xf62e('0x22'),JSON['stringify'](_0x263fac));if(_0x263fac[_0xf62e('0x25')]){if(_0x263fac[_0xf62e('0x25')][_0xf62e('0x26')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0xe3f951,_0x263fac[_0xf62e('0x25')][_0xf62e('0x27')]);return _0x46de2e(_0x263fac[_0xf62e('0x25')]['message']);}logger[_0xf62e('0x25')]('Network,\x20%s,\x20%s',_0xe3f951,_0x263fac[_0xf62e('0x25')][_0xf62e('0x27')]);return _0x545775(_0x263fac[_0xf62e('0x25')][_0xf62e('0x27')]);}else{logger[_0xf62e('0x20')]('Network,\x20%s,\x20%s',_0xe3f951,_0xf62e('0x22'));_0x545775(_0x263fac[_0xf62e('0x28')]['message']);}})[_0xf62e('0x29')](function(_0x506f41){logger[_0xf62e('0x25')](_0xf62e('0x21'),_0xe3f951,_0x506f41);_0x46de2e(_0x506f41);});});}function respondWithStatusCode(_0x8f5ada,_0xab64aa){_0xab64aa=_0xab64aa||0xcc;return function(_0x55c495){if(_0x55c495){return _0x8f5ada[_0xf62e('0x2a')](_0xab64aa);}return _0x8f5ada['status'](_0xab64aa)[_0xf62e('0x2b')]();};}function respondWithResult(_0x3140d9,_0x4f6480){_0x4f6480=_0x4f6480||0xc8;return function(_0x655182){if(_0x655182){return _0x3140d9[_0xf62e('0x2c')](_0x4f6480)[_0xf62e('0x2d')](_0x655182);}};}function respondWithFilteredResult(_0x30393a,_0x176ebd){return function(_0x3c42f6){if(_0x3c42f6){var _0x5f1ad3=_0x3c42f6[_0xf62e('0x2e')],_0xa98dd1=_0x176ebd[_0xf62e('0x2f')],_0x2fc729=_0x176ebd['offset']+_0x176ebd['limit'],_0x38ef7e;if(_0x2fc729>=_0x5f1ad3){_0x2fc729=_0x5f1ad3;_0x38ef7e=0xc8;}else{_0x38ef7e=0xce;}_0x30393a['status'](_0x38ef7e);return _0x30393a[_0xf62e('0x30')](_0xf62e('0x31'),_0xa98dd1+'-'+_0x2fc729+'/'+_0x5f1ad3)[_0xf62e('0x2d')](_0x3c42f6);}return null;};}function patchUpdates(_0x265c1f){return function(_0x81d4f6){try{jsonpatch[_0xf62e('0x32')](_0x81d4f6,_0x265c1f,!![]);}catch(_0x531efa){return BPromise[_0xf62e('0x33')](_0x531efa);}return _0x81d4f6[_0xf62e('0x34')]();};}function saveUpdates(_0x51ac13,_0x191100){return function(_0x2843f6){if(_0x2843f6){return _0x2843f6['update'](_0x51ac13)[_0xf62e('0x1f')](function(_0x174828){return _0x174828;});}return null;};}function removeEntity(_0x4abe2a,_0x55db24){return function(_0x332bc1){if(_0x332bc1){return _0x332bc1[_0xf62e('0x35')]()['then'](function(){_0x4abe2a['status'](0xcc)[_0xf62e('0x2b')]();});}};}function handleEntityNotFound(_0x4a1f61,_0x4ba605){return function(_0x3dd74e){if(!_0x3dd74e){_0x4a1f61['sendStatus'](0x194);}return _0x3dd74e;};}function handleError(_0x458c21,_0x4365fc){_0x4365fc=_0x4365fc||0x1f4;return function(_0x50d364){logger[_0xf62e('0x25')](_0x50d364[_0xf62e('0x36')]);if(_0x50d364[_0xf62e('0x37')]){delete _0x50d364['name'];}_0x458c21[_0xf62e('0x2c')](_0x4365fc)[_0xf62e('0x38')](_0x50d364);};}exports[_0xf62e('0x39')]=function(_0x3c3201,_0x47591e){var _0x9d707={},_0x4709ac={},_0x4ab2b6={'count':0x0,'rows':[]};var _0x2dda84=_[_0xf62e('0x3a')](db[_0xf62e('0x3b')][_0xf62e('0x3c')],function(_0x389aef){return{'name':_0x389aef[_0xf62e('0x3d')],'type':_0x389aef[_0xf62e('0x3e')][_0xf62e('0x3f')]};});_0x4709ac[_0xf62e('0x40')]=_[_0xf62e('0x3a')](_0x2dda84,'name');_0x4709ac['query']=_['keys'](_0x3c3201[_0xf62e('0x41')]);_0x4709ac['filters']=_[_0xf62e('0x42')](_0x4709ac[_0xf62e('0x40')],_0x4709ac[_0xf62e('0x41')]);_0x9d707[_0xf62e('0x43')]=_['intersection'](_0x4709ac[_0xf62e('0x40')],qs['fields'](_0x3c3201[_0xf62e('0x41')][_0xf62e('0x44')]));_0x9d707[_0xf62e('0x43')]=_0x9d707[_0xf62e('0x43')][_0xf62e('0x45')]?_0x9d707['attributes']:_0x4709ac[_0xf62e('0x40')];if(!_0x3c3201[_0xf62e('0x41')][_0xf62e('0x46')]('nolimit')){_0x9d707[_0xf62e('0x47')]=qs[_0xf62e('0x47')](_0x3c3201[_0xf62e('0x41')]['limit']);_0x9d707['offset']=qs[_0xf62e('0x2f')](_0x3c3201['query']['offset']);}_0x9d707['order']=qs['sort'](_0x3c3201[_0xf62e('0x41')]['sort']);_0x9d707['where']=qs[_0xf62e('0x48')](_['pick'](_0x3c3201[_0xf62e('0x41')],_0x4709ac[_0xf62e('0x48')]),_0x2dda84);if(_0x3c3201[_0xf62e('0x41')][_0xf62e('0x49')]){_0x9d707['where']=_[_0xf62e('0x4a')](_0x9d707[_0xf62e('0x4b')],{'$or':_[_0xf62e('0x3a')](_0x2dda84,function(_0x1c73d6){if(_0x1c73d6[_0xf62e('0x3e')]!==_0xf62e('0x4c')){var _0x4f731e={};_0x4f731e[_0x1c73d6[_0xf62e('0x37')]]={'$like':'%'+_0x3c3201['query'][_0xf62e('0x49')]+'%'};return _0x4f731e;}})});}_0x9d707=_[_0xf62e('0x4a')]({},_0x9d707,_0x3c3201[_0xf62e('0x4d')]);var _0x233507={'where':_0x9d707['where']};return db[_0xf62e('0x3b')][_0xf62e('0x2e')](_0x233507)[_0xf62e('0x1f')](function(_0x5d0531){_0x4ab2b6[_0xf62e('0x2e')]=_0x5d0531;if(_0x3c3201[_0xf62e('0x41')][_0xf62e('0x4e')]){_0x9d707[_0xf62e('0x4f')]=[{'all':!![]}];}return db['Network'][_0xf62e('0x50')](_0x9d707);})[_0xf62e('0x1f')](function(_0x2fdf4f){_0x4ab2b6['rows']=_0x2fdf4f;return _0x4ab2b6;})[_0xf62e('0x1f')](respondWithFilteredResult(_0x47591e,_0x9d707))[_0xf62e('0x29')](handleError(_0x47591e,null));};exports['show']=function(_0x15bd0a,_0x47015e){var _0x1ed49b={'raw':!![],'where':{'id':_0x15bd0a[_0xf62e('0x51')]['id']}},_0x13c60b={};_0x13c60b['model']=_[_0xf62e('0x52')](db['Network'][_0xf62e('0x3c')]);_0x13c60b[_0xf62e('0x41')]=_[_0xf62e('0x52')](_0x15bd0a[_0xf62e('0x41')]);_0x13c60b['filters']=_[_0xf62e('0x42')](_0x13c60b[_0xf62e('0x40')],_0x13c60b[_0xf62e('0x41')]);_0x1ed49b[_0xf62e('0x43')]=_[_0xf62e('0x42')](_0x13c60b[_0xf62e('0x40')],qs[_0xf62e('0x44')](_0x15bd0a[_0xf62e('0x41')][_0xf62e('0x44')]));_0x1ed49b['attributes']=_0x1ed49b['attributes']['length']?_0x1ed49b[_0xf62e('0x43')]:_0x13c60b[_0xf62e('0x40')];if(_0x15bd0a[_0xf62e('0x41')][_0xf62e('0x4e')]){_0x1ed49b[_0xf62e('0x4f')]=[{'all':!![]}];}_0x1ed49b=_['merge']({},_0x1ed49b,_0x15bd0a['options']);return db[_0xf62e('0x3b')][_0xf62e('0x53')](_0x1ed49b)[_0xf62e('0x1f')](handleEntityNotFound(_0x47015e,null))[_0xf62e('0x1f')](respondWithResult(_0x47015e,null))[_0xf62e('0x29')](handleError(_0x47015e,null));};exports[_0xf62e('0x54')]=function(_0x97adb4,_0x3552b6,_0x4536fb){var _0x34bda6;return db['sequelize'][_0xf62e('0x55')](function(_0x5bd104){return db[_0xf62e('0x3b')][_0xf62e('0x54')](_0x97adb4[_0xf62e('0x56')],{'raw':!![]})[_0xf62e('0x1f')](function(_0x57df98){_0x34bda6=_0x57df98;return db[_0xf62e('0x3b')][_0xf62e('0x50')]({'where':{'type':_0x97adb4[_0xf62e('0x56')][_0xf62e('0x3e')]},'raw':!![]});})[_0xf62e('0x1f')](function(_0xc5edf2){if(_0x34bda6['type'][_0xf62e('0x57')]()==_0xf62e('0x58')){var _0x3829fe=fs[_0xf62e('0x59')](path['join'](config[_0xf62e('0x5a')],_0xf62e('0x5b')),_0xf62e('0x5c'));var _0x530562=ejs['render'](_0x3829fe,{'networks':_0xc5edf2||[]});fs['writeFileSync'](_0xf62e('0x5d'),_0x530562);return respondWithRpcPromise('Reload','create',{'module':'res_stun_monitor.so'});}else if(_0x34bda6['type'][_0xf62e('0x57')]()=='TURN'){var _0x41fcf0=fs['readFileSync'](path[_0xf62e('0x5e')](config[_0xf62e('0x5a')],'server/files/templates/turn_multiple.ejs'),_0xf62e('0x5c'));var _0x14d616=ejs['render'](_0x41fcf0,{'networks':_0xc5edf2||[]});fs['writeFileSync'](_0xf62e('0x5f'),_0x14d616);return respondWithRpcPromise('Reload',_0xf62e('0x54'),{'module':_0xf62e('0x60')});}else{var _0x221a4e=fs[_0xf62e('0x59')](path['join'](config['root'],'server/files/templates/network.ejs'),_0xf62e('0x5c'));var _0xa7cefb=ejs[_0xf62e('0x61')](_0x221a4e,{'networks':_0xc5edf2||[]});fs[_0xf62e('0x62')](util[_0xf62e('0x63')](_0xf62e('0x64'),_0x97adb4['body'][_0xf62e('0x3e')]['toLowerCase']()),_0xa7cefb);return respondWithRpcPromise(_0xf62e('0x65'),_0xf62e('0x54'),{'module':'chan_sip.so'});}return null;})[_0xf62e('0x1f')](function(){return _0x34bda6;});})[_0xf62e('0x1f')](respondWithResult(_0x3552b6,0xc9))[_0xf62e('0x29')](handleError(_0x3552b6,null));};exports[_0xf62e('0x66')]=function(_0x16808d,_0x17a5bb,_0xbd7a72){var _0x5264f0;return db['sequelize'][_0xf62e('0x55')](function(_0x3b73e5){return db[_0xf62e('0x3b')]['find']({'where':{'id':_0x16808d[_0xf62e('0x51')]['id']}})[_0xf62e('0x1f')](handleEntityNotFound(_0x17a5bb,null))[_0xf62e('0x1f')](saveUpdates(_0x16808d[_0xf62e('0x56')],null))[_0xf62e('0x1f')](function(_0x6d5faf){if(_0x6d5faf){_0x5264f0=_0x6d5faf;return db['Network']['findAll']({'where':{'type':_0x5264f0[_0xf62e('0x3e')]},'raw':!![]});}return null;})[_0xf62e('0x1f')](function(_0x6f5448){if(_0x5264f0[_0xf62e('0x3e')]['toUpperCase']()=='STUN'){var _0x42f671=fs[_0xf62e('0x59')](path[_0xf62e('0x5e')](config[_0xf62e('0x5a')],_0xf62e('0x5b')),_0xf62e('0x5c'));var _0x52710d=ejs[_0xf62e('0x61')](_0x42f671,{'networks':_0x6f5448||[]});fs['writeFileSync'](_0xf62e('0x5d'),_0x52710d);return respondWithRpcPromise(_0xf62e('0x65'),_0xf62e('0x66'),{'module':'res_stun_monitor.so'});}else if(_0x5264f0[_0xf62e('0x3e')][_0xf62e('0x57')]()==_0xf62e('0x67')){var _0x1bbf73=fs[_0xf62e('0x59')](path[_0xf62e('0x5e')](config[_0xf62e('0x5a')],'server/files/templates/turn_multiple.ejs'),_0xf62e('0x5c'));var _0x4386a6=ejs[_0xf62e('0x61')](_0x1bbf73,{'networks':_0x6f5448||[]});fs['writeFileSync'](_0xf62e('0x5f'),_0x4386a6);return respondWithRpcPromise(_0xf62e('0x65'),'update',{'module':'res_stun_monitor.so'});}else{var _0x184f30=fs['readFileSync'](path[_0xf62e('0x5e')](config[_0xf62e('0x5a')],_0xf62e('0x68')),_0xf62e('0x5c'));var _0x419a03=ejs[_0xf62e('0x61')](_0x184f30,{'networks':_0x6f5448||[]});fs[_0xf62e('0x62')](util[_0xf62e('0x63')](_0xf62e('0x64'),_0x16808d[_0xf62e('0x56')]['type'][_0xf62e('0x69')]()),_0x419a03);return respondWithRpcPromise('Reload','update',{'module':_0xf62e('0x6a')});}return null;})[_0xf62e('0x1f')](function(_0x523705){if(_0x523705){return _0x5264f0;}return null;});})[_0xf62e('0x1f')](respondWithResult(_0x17a5bb,null))[_0xf62e('0x29')](handleError(_0x17a5bb,null));};exports[_0xf62e('0x35')]=function(_0x93be13,_0x33b8ea,_0x8a6d38){var _0xf620a3;return db['Network'][_0xf62e('0x53')]({'where':{'id':_0x93be13[_0xf62e('0x51')]['id']}})[_0xf62e('0x1f')](function(_0x44cf10){_0xf620a3=_0x44cf10;return _0x44cf10;})[_0xf62e('0x1f')](handleEntityNotFound(_0x33b8ea,null))['then'](removeEntity(_0x33b8ea,null))['then'](function(){if(_0xf620a3){return db[_0xf62e('0x3b')][_0xf62e('0x50')]({'where':{'type':_0xf620a3[_0xf62e('0x3e')]},'raw':!![]});}})['then'](function(_0x292845){if(_0xf620a3[_0xf62e('0x3e')][_0xf62e('0x57')]()==_0xf62e('0x58')){var _0x2e2649=fs[_0xf62e('0x59')](path[_0xf62e('0x5e')](config[_0xf62e('0x5a')],_0xf62e('0x5b')),_0xf62e('0x5c'));var _0x127c02=ejs[_0xf62e('0x61')](_0x2e2649,{'networks':_0x292845||[]});fs[_0xf62e('0x62')]('/etc/asterisk/stun_xcally.conf',_0x127c02);return respondWithRpcPromise('Reload',_0xf62e('0x35'),{'module':_0xf62e('0x60')});}else if(_0xf620a3['type'][_0xf62e('0x57')]()==_0xf62e('0x67')){var _0x125433=fs['readFileSync'](path[_0xf62e('0x5e')](config['root'],_0xf62e('0x6b')),'utf8');var _0xf199b6=ejs[_0xf62e('0x61')](_0x125433,{'networks':_0x292845||[]});fs[_0xf62e('0x62')](_0xf62e('0x5f'),_0xf199b6);return respondWithRpcPromise(_0xf62e('0x65'),'destroy',{'module':_0xf62e('0x60')});}else{var _0x4a3c1e=fs['readFileSync'](path[_0xf62e('0x5e')](config['root'],_0xf62e('0x68')),'utf8');var _0x43c0e1=ejs[_0xf62e('0x61')](_0x4a3c1e,{'networks':_0x292845||[]});fs[_0xf62e('0x62')](util[_0xf62e('0x63')](_0xf62e('0x64'),_0x93be13['body'][_0xf62e('0x3e')]['toLowerCase']()),_0x43c0e1);return respondWithRpcPromise(_0xf62e('0x65'),_0xf62e('0x35'),{'module':'chan_sip.so'});}return null;})[_0xf62e('0x29')](handleError(_0x33b8ea,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 19ac817..9f8a198 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 _0x34f7=['request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','util','../../config/logger','moment'];(function(_0x3a0d9d,_0x5f6bdd){var _0x43949e=function(_0x99dc21){while(--_0x99dc21){_0x3a0d9d['push'](_0x3a0d9d['shift']());}};_0x43949e(++_0x5f6bdd);}(_0x34f7,0x1ad));var _0x734f=function(_0x27bf19,_0x5eed7b){_0x27bf19=_0x27bf19-0x0;var _0x18788a=_0x34f7[_0x27bf19];return _0x18788a;};'use strict';var _=require('lodash');var util=require(_0x734f('0x0'));var logger=require(_0x734f('0x1'))('api');var moment=require(_0x734f('0x2'));var BPromise=require('bluebird');var rp=require(_0x734f('0x3'));var fs=require('fs');var path=require(_0x734f('0x4'));var rimraf=require(_0x734f('0x5'));var config=require(_0x734f('0x6'));var attributes=require(_0x734f('0x7'));module[_0x734f('0x8')]=function(_0x52d49b,_0x196f34){return _0x52d49b[_0x734f('0x9')](_0x734f('0xa'),attributes,{'tableName':_0x734f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc929=['exports','define','Network','network','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./network.attributes'];(function(_0x418ad2,_0xeae93b){var _0x4f4fe5=function(_0x424e28){while(--_0x424e28){_0x418ad2['push'](_0x418ad2['shift']());}};_0x4f4fe5(++_0xeae93b);}(_0xc929,0x1b4));var _0x9c92=function(_0x2696b9,_0x3f6ccb){_0x2696b9=_0x2696b9-0x0;var _0x375d1a=_0xc929[_0x2696b9];return _0x375d1a;};'use strict';var _=require(_0x9c92('0x0'));var util=require(_0x9c92('0x1'));var logger=require(_0x9c92('0x2'))(_0x9c92('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9c92('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9c92('0x5'));var config=require(_0x9c92('0x6'));var attributes=require(_0x9c92('0x7'));module[_0x9c92('0x8')]=function(_0x4a2019,_0x17fbea){return _0x4a2019[_0x9c92('0x9')](_0x9c92('0xa'),attributes,{'tableName':_0x9c92('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 0e85980..1be7b25 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 _0x9e0c=['message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x168296,_0x3ac73d){var _0x315970=function(_0x478bf4){while(--_0x478bf4){_0x168296['push'](_0x168296['shift']());}};_0x315970(++_0x3ac73d);}(_0x9e0c,0x193));var _0xc9e0=function(_0x25fda4,_0x2dedff){_0x25fda4=_0x25fda4-0x0;var _0x271575=_0x9e0c[_0x25fda4];return _0x271575;};'use strict';var _=require('lodash');var util=require(_0xc9e0('0x0'));var moment=require(_0xc9e0('0x1'));var BPromise=require('bluebird');var rs=require(_0xc9e0('0x2'));var fs=require('fs');var Redis=require(_0xc9e0('0x3'));var db=require(_0xc9e0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc9e0('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc9e0('0x6'));var client=jayson[_0xc9e0('0x7')][_0xc9e0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e7218,_0x40483e,_0x136bc3){return new BPromise(function(_0x560448,_0x1d8a43){return client[_0xc9e0('0x9')](_0x2e7218,_0x136bc3)['then'](function(_0x5de749){logger[_0xc9e0('0xa')](_0xc9e0('0xb'),_0x40483e,_0xc9e0('0xc'));logger['debug'](_0xc9e0('0xd'),_0x40483e,_0xc9e0('0xc'),JSON[_0xc9e0('0xe')](_0x5de749));if(_0x5de749['error']){if(_0x5de749[_0xc9e0('0xf')][_0xc9e0('0x10')]===0x1f4){logger['error'](_0xc9e0('0xb'),_0x40483e,_0x5de749['error'][_0xc9e0('0x11')]);return _0x1d8a43(_0x5de749['error'][_0xc9e0('0x11')]);}logger[_0xc9e0('0xf')](_0xc9e0('0xb'),_0x40483e,_0x5de749[_0xc9e0('0xf')][_0xc9e0('0x11')]);return _0x560448(_0x5de749[_0xc9e0('0xf')][_0xc9e0('0x11')]);}else{logger[_0xc9e0('0xa')](_0xc9e0('0xb'),_0x40483e,'request\x20sent');_0x560448(_0x5de749[_0xc9e0('0x12')][_0xc9e0('0x11')]);}})[_0xc9e0('0x13')](function(_0x32ec71){logger['error'](_0xc9e0('0xb'),_0x40483e,_0x32ec71);_0x1d8a43(_0x32ec71);});});} \ No newline at end of file +var _0x9686=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','lodash'];(function(_0x4debdd,_0x114aab){var _0x4a83e6=function(_0x4e8ed8){while(--_0x4e8ed8){_0x4debdd['push'](_0x4debdd['shift']());}};_0x4a83e6(++_0x114aab);}(_0x9686,0x1b8));var _0x6968=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9686[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6968('0x0'));var util=require('util');var moment=require(_0x6968('0x1'));var BPromise=require(_0x6968('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6968('0x3'));var db=require(_0x6968('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6968('0x5'))(_0x6968('0x6'));var config=require('../../config/environment');var jayson=require(_0x6968('0x7'));var client=jayson[_0x6968('0x8')][_0x6968('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x365f89,_0x54a2f8,_0x17e4b6){return new BPromise(function(_0x1b2307,_0x57f9aa){return client[_0x6968('0xa')](_0x365f89,_0x17e4b6)[_0x6968('0xb')](function(_0x2da59e){logger[_0x6968('0xc')]('Network,\x20%s,\x20%s',_0x54a2f8,_0x6968('0xd'));logger[_0x6968('0xe')](_0x6968('0xf'),_0x54a2f8,'request\x20sent',JSON[_0x6968('0x10')](_0x2da59e));if(_0x2da59e[_0x6968('0x11')]){if(_0x2da59e[_0x6968('0x11')][_0x6968('0x12')]===0x1f4){logger[_0x6968('0x11')](_0x6968('0x13'),_0x54a2f8,_0x2da59e[_0x6968('0x11')][_0x6968('0x14')]);return _0x57f9aa(_0x2da59e['error']['message']);}logger[_0x6968('0x11')]('Network,\x20%s,\x20%s',_0x54a2f8,_0x2da59e[_0x6968('0x11')][_0x6968('0x14')]);return _0x1b2307(_0x2da59e['error'][_0x6968('0x14')]);}else{logger[_0x6968('0xc')](_0x6968('0x13'),_0x54a2f8,_0x6968('0xd'));_0x1b2307(_0x2da59e['result'][_0x6968('0x14')]);}})['catch'](function(_0x406012){logger[_0x6968('0x11')](_0x6968('0x13'),_0x54a2f8,_0x406012);_0x57f9aa(_0x406012);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index e4328bd..5b0c187 100644 --- a/server/api/notification/index.js +++ b/server/api/notification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed92=['express','Router','post','sendNotification','exports','multer','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xed92,0xde));var _0x2ed9=function(_0x430752,_0x3474cf){_0x430752=_0x430752-0x0;var _0x41f50d=_0xed92[_0x430752];return _0x41f50d;};'use strict';var multer=require(_0x2ed9('0x0'));var util=require('util');var path=require(_0x2ed9('0x1'));var timeout=require('connect-timeout');var express=require(_0x2ed9('0x2'));var router=express[_0x2ed9('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./notification.controller');router[_0x2ed9('0x4')]('/',auth['isAuthenticated'](),controller[_0x2ed9('0x5')]);module[_0x2ed9('0x6')]=router; \ No newline at end of file +var _0x857f=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','exports','util'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x857f,0x8e));var _0xf857=function(_0x4a30cf,_0x312dd4){_0x4a30cf=_0x4a30cf-0x0;var _0x4d975b=_0x857f[_0x4a30cf];return _0x4d975b;};'use strict';var multer=require('multer');var util=require(_0xf857('0x0'));var path=require(_0xf857('0x1'));var timeout=require(_0xf857('0x2'));var express=require(_0xf857('0x3'));var router=express[_0xf857('0x4')]();var auth=require(_0xf857('0x5'));var interaction=require(_0xf857('0x6'));var config=require(_0xf857('0x7'));var controller=require(_0xf857('0x8'));router[_0xf857('0x9')]('/',auth[_0xf857('0xa')](),controller[_0xf857('0xb')]);module[_0xf857('0xc')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 75ecb0c..2d015e1 100644 --- a/server/api/notification/notification.attributes.js +++ b/server/api/notification/notification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe30c=['STRING','TEXT','BOOLEAN','exports'];(function(_0x3ff3ea,_0x5c8e99){var _0x1ed8a6=function(_0x264fd1){while(--_0x264fd1){_0x3ff3ea['push'](_0x3ff3ea['shift']());}};_0x1ed8a6(++_0x5c8e99);}(_0xe30c,0x67));var _0xce30=function(_0x5438f7,_0x49cfc3){_0x5438f7=_0x5438f7-0x0;var _0x21ed85=_0xe30c[_0x5438f7];return _0x21ed85;};'use strict';var Sequelize=require('sequelize');module[_0xce30('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xce30('0x1')]},'recipientsId':{'type':Sequelize[_0xce30('0x2')]},'recipientsDescription':{'type':Sequelize[_0xce30('0x1')]},'beep':{'type':Sequelize[_0xce30('0x3')]}}; \ No newline at end of file +var _0x140a=['TEXT','BOOLEAN','exports','STRING'];(function(_0x592409,_0xaa8b43){var _0x26e9aa=function(_0x223212){while(--_0x223212){_0x592409['push'](_0x592409['shift']());}};_0x26e9aa(++_0xaa8b43);}(_0x140a,0x6e));var _0xa140=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x140a[_0x485b5a];return _0xd2b34d;};'use strict';var Sequelize=require('sequelize');module[_0xa140('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xa140('0x1')]},'recipientsId':{'type':Sequelize[_0xa140('0x2')]},'recipientsDescription':{'type':Sequelize[_0xa140('0x1')]},'beep':{'type':Sequelize[_0xa140('0x3')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index e5fb325..4e1e1b4 100644 --- a/server/api/notification/notification.controller.js +++ b/server/api/notification/notification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23d7=['startCase','User','union','ids','queue','replace','Queue','push','all','flatten','map','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./notification.socket','register','sendStatus','status','json','count','offset','limit','set','apply','reject','then','destroy','end','stack','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','error','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','isEmpty','beep','SenderId','join','transaction','Notification','create','recipient','emit','notification:send','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','forEach'];(function(_0x28c6f1,_0x5b0cd9){var _0x45d430=function(_0x50edff){while(--_0x50edff){_0x28c6f1['push'](_0x28c6f1['shift']());}};_0x45d430(++_0x5b0cd9);}(_0x23d7,0x69));var _0x723d=function(_0x155719,_0x123b9d){_0x155719=_0x155719-0x0;var _0x41e840=_0x23d7[_0x155719];return _0x41e840;};'use strict';var pdf=require(_0x723d('0x0'));var emlformat=require(_0x723d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x723d('0x2'));var rp=require(_0x723d('0x3'));var moment=require(_0x723d('0x4'));var BPromise=require(_0x723d('0x5'));var Mustache=require('mustache');var util=require(_0x723d('0x6'));var path=require(_0x723d('0x7'));var sox=require('sox');var csv=require(_0x723d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x723d('0x9'));var squel=require(_0x723d('0xa'));var crypto=require(_0x723d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x723d('0xc'));var toCsv=require(_0x723d('0x8'));var querystring=require(_0x723d('0xd'));var Papa=require('papaparse');var Redis=require(_0x723d('0xe'));var authService=require(_0x723d('0xf'));var qs=require(_0x723d('0x10'));var as=require(_0x723d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x723d('0x12'));var utils=require('../../config/utils');var config=require(_0x723d('0x13'));var licenseUtil=require(_0x723d('0x14'));var db=require(_0x723d('0x15'))['db'];config[_0x723d('0x16')]=_['defaults'](config['redis'],{'host':_0x723d('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x723d('0x16')]));require(_0x723d('0x18'))[_0x723d('0x19')](socket);function respondWithStatusCode(_0x4e639e,_0x33e271){_0x33e271=_0x33e271||0xcc;return function(_0x1662c7){if(_0x1662c7){return _0x4e639e[_0x723d('0x1a')](_0x33e271);}return _0x4e639e[_0x723d('0x1b')](_0x33e271)['end']();};}function respondWithResult(_0x115829,_0x24ebd2){_0x24ebd2=_0x24ebd2||0xc8;return function(_0x19a59d){if(_0x19a59d){return _0x115829[_0x723d('0x1b')](_0x24ebd2)[_0x723d('0x1c')](_0x19a59d);}};}function respondWithFilteredResult(_0x1eed9a,_0x36820b){return function(_0x38f2a3){if(_0x38f2a3){var _0x5cdff7=_0x38f2a3[_0x723d('0x1d')],_0x67ffa=_0x36820b[_0x723d('0x1e')],_0x444827=_0x36820b['offset']+_0x36820b[_0x723d('0x1f')],_0x5539f6;if(_0x444827>=_0x5cdff7){_0x444827=_0x5cdff7;_0x5539f6=0xc8;}else{_0x5539f6=0xce;}_0x1eed9a[_0x723d('0x1b')](_0x5539f6);return _0x1eed9a[_0x723d('0x20')]('Content-Range',_0x67ffa+'-'+_0x444827+'/'+_0x5cdff7)[_0x723d('0x1c')](_0x38f2a3);}return null;};}function patchUpdates(_0x58197a){return function(_0x384a91){try{jsonpatch[_0x723d('0x21')](_0x384a91,_0x58197a,!![]);}catch(_0x55aa4c){return BPromise[_0x723d('0x22')](_0x55aa4c);}return _0x384a91['save']();};}function saveUpdates(_0x39b805,_0x4d4331){return function(_0x17a131){if(_0x17a131){return _0x17a131['update'](_0x39b805)[_0x723d('0x23')](function(_0x41365c){return _0x41365c;});}return null;};}function removeEntity(_0x54c5bc,_0x20aec5){return function(_0x5cc0d2){if(_0x5cc0d2){return _0x5cc0d2[_0x723d('0x24')]()['then'](function(){_0x54c5bc[_0x723d('0x1b')](0xcc)[_0x723d('0x25')]();});}};}function handleEntityNotFound(_0x2242c5,_0x3300e5){return function(_0x5c1af8){if(!_0x5c1af8){_0x2242c5[_0x723d('0x1a')](0x194);}return _0x5c1af8;};}function handleError(_0x28795a,_0x50a07f){_0x50a07f=_0x50a07f||0x1f4;return function(_0x457c48){logger['error'](_0x457c48[_0x723d('0x26')]);if(_0x457c48[_0x723d('0x27')]){delete _0x457c48[_0x723d('0x27')];}_0x28795a['status'](_0x50a07f)[_0x723d('0x28')](_0x457c48);};}exports['sendNotification']=function(_0x5151f7,_0x16f016,_0x5012a6){if(!_0x5151f7[_0x723d('0x29')][_0x723d('0x2a')](_0x723d('0x2b'))&&!_0x5151f7[_0x723d('0x29')][_0x723d('0x2a')](_0x723d('0x2c'))){throw new db[(_0x723d('0x2d'))][(_0x723d('0x2e'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x5151f7[_0x723d('0x29')]['hasOwnProperty'](_0x723d('0x2c'))&&!_0x5151f7[_0x723d('0x29')][_0x723d('0x2a')](_0x723d('0x2f'))){throw new db['Sequelize'][(_0x723d('0x2e'))](_0x723d('0x30'));}if(!_0x5151f7['body'][_0x723d('0x2a')]('recipients')){throw new db[(_0x723d('0x2d'))][(_0x723d('0x2e'))](_0x723d('0x31'));}else{try{var _0x2dff95=JSON['parse'](_0x5151f7[_0x723d('0x29')]['recipients']);}catch(_0x42afad){logger[_0x723d('0x32')](_0x42afad);throw new db['Sequelize'][(_0x723d('0x2e'))](_0x723d('0x33'));}var _0x575323=['chatqueue',_0x723d('0x34'),_0x723d('0x35'),_0x723d('0x36'),_0x723d('0x37'),_0x723d('0x38'),_0x723d('0x39'),'team','user'];if(_[_0x723d('0x3a')](_0x2dff95,function(_0x1c7a55){return!_[_0x723d('0x3b')](_0x575323,_0x1c7a55[_0x723d('0x3c')][_0x723d('0x3d')]());})){throw new db['Sequelize']['ValidationError'](_0x723d('0x3e'));}}}var _0x35a8ae={};_0x35a8ae[_0x723d('0x3f')]=_0x5151f7['body'][_0x723d('0x2a')]('senderName')?_0x5151f7[_0x723d('0x29')][_0x723d('0x3f')]:_0x5151f7[_0x723d('0x40')]['fullname'];_0x35a8ae[_0x723d('0x41')]=_[_0x723d('0x42')](_0x5151f7[_0x723d('0x29')][_0x723d('0x41')])?null:_0x5151f7['body'][_0x723d('0x41')];_0x35a8ae[_0x723d('0x43')]=_0x5151f7['body'][_0x723d('0x43')]||![];_0x35a8ae[_0x723d('0x44')]=_0x5151f7['user']['id'];return getContent(_0x5151f7[_0x723d('0x29')])[_0x723d('0x23')](function(_0x49bea5){_0x35a8ae['body']=_0x49bea5;return getRecipients(_0x2dff95);})['then'](function(_0xf2a87b){_0x35a8ae['recipientsId']=_['sortBy'](_0xf2a87b)[_0x723d('0x45')](',');return db['sequelize'][_0x723d('0x46')](function(_0x9416c0){return db[_0x723d('0x47')][_0x723d('0x48')](_0x35a8ae,{'raw':!![],'transaction':_0x9416c0})['then'](function(_0x26fbbb){var _0x2fd5f6={'sender':_0x35a8ae['senderName'],'description':_0x35a8ae['recipientsDescription'],'content':_0x35a8ae[_0x723d('0x29')],'beep':_0x35a8ae[_0x723d('0x43')]};_0xf2a87b['forEach'](function(_0x25c931){_0x2fd5f6[_0x723d('0x49')]=_0x25c931;socket[_0x723d('0x4a')](_0x723d('0x4b'),_0x2fd5f6);});return _0x26fbbb;});});})['then'](respondWithResult(_0x16f016,0xc9))['catch'](handleError(_0x16f016,null));};function getContent(_0x4d33e0){return new BPromise(function(_0x15f5c1,_0x3608ae){if(_0x4d33e0[_0x723d('0x2b')]){_0x15f5c1(_0x4d33e0[_0x723d('0x2b')]);return;}return db[_0x723d('0x4c')][_0x723d('0x4d')]({'attributes':[_0x723d('0x4e')],'where':{'id':_0x4d33e0[_0x723d('0x2c')]},'raw':!![]})[_0x723d('0x23')](function(_0x9370d4){if(!_0x9370d4)throw new db[(_0x723d('0x2d'))][(_0x723d('0x2e'))](_0x723d('0x4f'));var _0x2e2cdd=Mustache[_0x723d('0x50')](_0x9370d4[_0x723d('0x4e')],_0x4d33e0[_0x723d('0x2f')]);_0x15f5c1(_0x2e2cdd);})[_0x723d('0x51')](function(_0x131f24){_0x3608ae(_0x131f24);});});}function getRecipients(_0x335e5d){return new BPromise(function(_0x3c63ee,_0x116fce){var _0x194813=[];var _0x468a9d=[];_0x335e5d[_0x723d('0x52')](function(_0x43a287){var _0x2699bf=_[_0x723d('0x53')](_0x43a287[_0x723d('0x3c')]['toLowerCase']());if(_0x2699bf===_0x723d('0x54')){_0x194813=_[_0x723d('0x55')](_0x194813,_0x43a287[_0x723d('0x56')]);}else{if(_['includes'](_0x2699bf,_0x723d('0x57')))_0x2699bf=_0x2699bf[_0x723d('0x58')]('queue',_0x723d('0x59'));_0x43a287[_0x723d('0x56')][_0x723d('0x52')](function(_0x5e623d){_0x468a9d[_0x723d('0x5a')](getAgents(_0x2699bf,_0x5e623d));});}});return BPromise[_0x723d('0x5b')](_0x468a9d)[_0x723d('0x23')](function(_0x24d6c3){_0x194813=_[_0x723d('0x55')](_0x194813,_[_0x723d('0x5c')](_0x24d6c3));_0x3c63ee(_0x194813);})['catch'](function(_0x4da6a3){_0x116fce(_0x4da6a3);});});}function getAgents(_0x40bc6a,_0x10971f){return new BPromise(function(_0x6242c4,_0x195bd8){return db[_0x40bc6a]['findOne']({'where':{'id':_0x10971f}})[_0x723d('0x23')](function(_0x2f0b72){return _0x2f0b72['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x4f6486){var _0xc46fea=_[_0x723d('0x5d')](_0x4f6486,'id');_0x6242c4(_0xc46fea);});})[_0x723d('0x51')](function(_0x1acecf){_0x195bd8(_0x1acecf);});});} \ No newline at end of file +var _0x6b3d=['socket.io-emitter','./notification.socket','register','sendStatus','status','count','offset','Content-Range','json','reject','save','destroy','then','end','error','send','text','hasOwnProperty','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','body','view','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','sequelize','transaction','Notification','create','forEach','recipient','emit','notification:send','catch','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','User','union','queue','replace','Queue','push','all','flatten','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost'];(function(_0x39ffd1,_0x299703){var _0x31267e=function(_0x11b420){while(--_0x11b420){_0x39ffd1['push'](_0x39ffd1['shift']());}};_0x31267e(++_0x299703);}(_0x6b3d,0x173));var _0xd6b3=function(_0x2bb59a,_0x3815c6){_0x2bb59a=_0x2bb59a-0x0;var _0xae827a=_0x6b3d[_0x2bb59a];return _0xae827a;};'use strict';var pdf=require(_0xd6b3('0x0'));var emlformat=require(_0xd6b3('0x1'));var rimraf=require(_0xd6b3('0x2'));var zipdir=require(_0xd6b3('0x3'));var jsonpatch=require(_0xd6b3('0x4'));var rp=require(_0xd6b3('0x5'));var moment=require(_0xd6b3('0x6'));var BPromise=require(_0xd6b3('0x7'));var Mustache=require(_0xd6b3('0x8'));var util=require(_0xd6b3('0x9'));var path=require(_0xd6b3('0xa'));var sox=require(_0xd6b3('0xb'));var csv=require(_0xd6b3('0xc'));var ejs=require(_0xd6b3('0xd'));var fs=require('fs');var _=require(_0xd6b3('0xe'));var squel=require(_0xd6b3('0xf'));var crypto=require(_0xd6b3('0x10'));var jsforce=require(_0xd6b3('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xd6b3('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd6b3('0x12'));var authService=require(_0xd6b3('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd6b3('0x14'));var hardwareService=require(_0xd6b3('0x15'));var logger=require(_0xd6b3('0x16'))('api');var utils=require(_0xd6b3('0x17'));var config=require(_0xd6b3('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd6b3('0x19'))['db'];config[_0xd6b3('0x1a')]=_[_0xd6b3('0x1b')](config['redis'],{'host':_0xd6b3('0x1c'),'port':0x18eb});var socket=require(_0xd6b3('0x1d'))(new Redis(config[_0xd6b3('0x1a')]));require(_0xd6b3('0x1e'))[_0xd6b3('0x1f')](socket);function respondWithStatusCode(_0x1687ff,_0x5ddc07){_0x5ddc07=_0x5ddc07||0xcc;return function(_0x5a55b2){if(_0x5a55b2){return _0x1687ff[_0xd6b3('0x20')](_0x5ddc07);}return _0x1687ff[_0xd6b3('0x21')](_0x5ddc07)['end']();};}function respondWithResult(_0x2a0cac,_0x21a7d5){_0x21a7d5=_0x21a7d5||0xc8;return function(_0x262507){if(_0x262507){return _0x2a0cac['status'](_0x21a7d5)['json'](_0x262507);}};}function respondWithFilteredResult(_0x537c5e,_0x1ce573){return function(_0x5654b8){if(_0x5654b8){var _0x513748=_0x5654b8[_0xd6b3('0x22')],_0x4265f4=_0x1ce573[_0xd6b3('0x23')],_0x39e334=_0x1ce573[_0xd6b3('0x23')]+_0x1ce573['limit'],_0x3c1bc0;if(_0x39e334>=_0x513748){_0x39e334=_0x513748;_0x3c1bc0=0xc8;}else{_0x3c1bc0=0xce;}_0x537c5e[_0xd6b3('0x21')](_0x3c1bc0);return _0x537c5e['set'](_0xd6b3('0x24'),_0x4265f4+'-'+_0x39e334+'/'+_0x513748)[_0xd6b3('0x25')](_0x5654b8);}return null;};}function patchUpdates(_0x175247){return function(_0xf00376){try{jsonpatch['apply'](_0xf00376,_0x175247,!![]);}catch(_0x4c3261){return BPromise[_0xd6b3('0x26')](_0x4c3261);}return _0xf00376[_0xd6b3('0x27')]();};}function saveUpdates(_0x121310,_0x3b4696){return function(_0x26d1fa){if(_0x26d1fa){return _0x26d1fa['update'](_0x121310)['then'](function(_0x575176){return _0x575176;});}return null;};}function removeEntity(_0x2fc83a,_0x20cf0c){return function(_0x757ed0){if(_0x757ed0){return _0x757ed0[_0xd6b3('0x28')]()[_0xd6b3('0x29')](function(){_0x2fc83a[_0xd6b3('0x21')](0xcc)[_0xd6b3('0x2a')]();});}};}function handleEntityNotFound(_0x2e9c96,_0x366ede){return function(_0x2ec9df){if(!_0x2ec9df){_0x2e9c96[_0xd6b3('0x20')](0x194);}return _0x2ec9df;};}function handleError(_0x293b9f,_0x1d3919){_0x1d3919=_0x1d3919||0x1f4;return function(_0x1a2046){logger[_0xd6b3('0x2b')](_0x1a2046['stack']);if(_0x1a2046['name']){delete _0x1a2046['name'];}_0x293b9f[_0xd6b3('0x21')](_0x1d3919)[_0xd6b3('0x2c')](_0x1a2046);};}exports['sendNotification']=function(_0x120a8b,_0x4c2afa,_0x4a00b3){if(!_0x120a8b['body']['hasOwnProperty'](_0xd6b3('0x2d'))&&!_0x120a8b['body'][_0xd6b3('0x2e')](_0xd6b3('0x2f'))){throw new db[(_0xd6b3('0x30'))]['ValidationError'](_0xd6b3('0x31'));}else{if(_0x120a8b[_0xd6b3('0x32')][_0xd6b3('0x2e')](_0xd6b3('0x2f'))&&!_0x120a8b[_0xd6b3('0x32')][_0xd6b3('0x2e')](_0xd6b3('0x33'))){throw new db[(_0xd6b3('0x30'))][(_0xd6b3('0x34'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x120a8b[_0xd6b3('0x32')]['hasOwnProperty']('recipients')){throw new db[(_0xd6b3('0x30'))][(_0xd6b3('0x34'))](_0xd6b3('0x35'));}else{try{var _0x991f58=JSON[_0xd6b3('0x36')](_0x120a8b[_0xd6b3('0x32')][_0xd6b3('0x37')]);}catch(_0x467c06){logger[_0xd6b3('0x2b')](_0x467c06);throw new db['Sequelize'][(_0xd6b3('0x34'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x350e8b=[_0xd6b3('0x38'),_0xd6b3('0x39'),_0xd6b3('0x3a'),_0xd6b3('0x3b'),_0xd6b3('0x3c'),_0xd6b3('0x3d'),_0xd6b3('0x3e'),_0xd6b3('0x3f'),'user'];if(_[_0xd6b3('0x40')](_0x991f58,function(_0x5d86bc){return!_[_0xd6b3('0x41')](_0x350e8b,_0x5d86bc[_0xd6b3('0x42')]['toLowerCase']());})){throw new db[(_0xd6b3('0x30'))][(_0xd6b3('0x34'))](_0xd6b3('0x43'));}}}var _0x2458ce={};_0x2458ce[_0xd6b3('0x44')]=_0x120a8b[_0xd6b3('0x32')][_0xd6b3('0x2e')](_0xd6b3('0x44'))?_0x120a8b[_0xd6b3('0x32')]['senderName']:_0x120a8b[_0xd6b3('0x45')]['fullname'];_0x2458ce[_0xd6b3('0x46')]=_[_0xd6b3('0x47')](_0x120a8b[_0xd6b3('0x32')][_0xd6b3('0x46')])?null:_0x120a8b[_0xd6b3('0x32')][_0xd6b3('0x46')];_0x2458ce[_0xd6b3('0x48')]=_0x120a8b[_0xd6b3('0x32')][_0xd6b3('0x48')]||![];_0x2458ce['SenderId']=_0x120a8b['user']['id'];return getContent(_0x120a8b['body'])[_0xd6b3('0x29')](function(_0x25894a){_0x2458ce[_0xd6b3('0x32')]=_0x25894a;return getRecipients(_0x991f58);})[_0xd6b3('0x29')](function(_0x21d09d){_0x2458ce[_0xd6b3('0x49')]=_[_0xd6b3('0x4a')](_0x21d09d)[_0xd6b3('0x4b')](',');return db[_0xd6b3('0x4c')][_0xd6b3('0x4d')](function(_0x439896){return db[_0xd6b3('0x4e')][_0xd6b3('0x4f')](_0x2458ce,{'raw':!![],'transaction':_0x439896})[_0xd6b3('0x29')](function(_0x3efcd8){var _0x16e129={'sender':_0x2458ce[_0xd6b3('0x44')],'description':_0x2458ce[_0xd6b3('0x46')],'content':_0x2458ce[_0xd6b3('0x32')],'beep':_0x2458ce[_0xd6b3('0x48')]};_0x21d09d[_0xd6b3('0x50')](function(_0x10b23a){_0x16e129[_0xd6b3('0x51')]=_0x10b23a;socket[_0xd6b3('0x52')](_0xd6b3('0x53'),_0x16e129);});return _0x3efcd8;});});})[_0xd6b3('0x29')](respondWithResult(_0x4c2afa,0xc9))[_0xd6b3('0x54')](handleError(_0x4c2afa,null));};function getContent(_0x198f81){return new BPromise(function(_0x45ea5b,_0x2a4b93){if(_0x198f81[_0xd6b3('0x2d')]){_0x45ea5b(_0x198f81['text']);return;}return db['Template']['findOne']({'attributes':[_0xd6b3('0x55')],'where':{'id':_0x198f81[_0xd6b3('0x2f')]},'raw':!![]})[_0xd6b3('0x29')](function(_0x4a5f60){if(!_0x4a5f60)throw new db[(_0xd6b3('0x30'))][(_0xd6b3('0x34'))](_0xd6b3('0x56'));var _0x1fdc52=Mustache[_0xd6b3('0x57')](_0x4a5f60[_0xd6b3('0x55')],_0x198f81[_0xd6b3('0x33')]);_0x45ea5b(_0x1fdc52);})['catch'](function(_0x1736f0){_0x2a4b93(_0x1736f0);});});}function getRecipients(_0x16867){return new BPromise(function(_0x2a3bd5,_0x2bd899){var _0x4b94bf=[];var _0x6e431f=[];_0x16867[_0xd6b3('0x50')](function(_0x1ae056){var _0x48c6c9=_[_0xd6b3('0x58')](_0x1ae056[_0xd6b3('0x42')][_0xd6b3('0x59')]());if(_0x48c6c9===_0xd6b3('0x5a')){_0x4b94bf=_[_0xd6b3('0x5b')](_0x4b94bf,_0x1ae056['ids']);}else{if(_[_0xd6b3('0x41')](_0x48c6c9,_0xd6b3('0x5c')))_0x48c6c9=_0x48c6c9[_0xd6b3('0x5d')](_0xd6b3('0x5c'),_0xd6b3('0x5e'));_0x1ae056['ids'][_0xd6b3('0x50')](function(_0x481961){_0x6e431f[_0xd6b3('0x5f')](getAgents(_0x48c6c9,_0x481961));});}});return BPromise[_0xd6b3('0x60')](_0x6e431f)[_0xd6b3('0x29')](function(_0x5c96eb){_0x4b94bf=_[_0xd6b3('0x5b')](_0x4b94bf,_[_0xd6b3('0x61')](_0x5c96eb));_0x2a3bd5(_0x4b94bf);})[_0xd6b3('0x54')](function(_0x45c47a){_0x2bd899(_0x45c47a);});});}function getAgents(_0x1af71d,_0x1cfa25){return new BPromise(function(_0xdefc9d,_0x3d29c4){return db[_0x1af71d]['findOne']({'where':{'id':_0x1cfa25}})['then'](function(_0x23229f){return _0x23229f[_0xd6b3('0x62')]({'attributes':['id'],'raw':!![]})['then'](function(_0x848e6b){var _0x23d44b=_[_0xd6b3('0x63')](_0x848e6b,'id');_0xdefc9d(_0x23d44b);});})['catch'](function(_0xcab11d){_0x3d29c4(_0xcab11d);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index d9c907d..652b938 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['exports','../../mysqldb','Notification','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x2032,0xd9));var _0x2203=function(_0x157232,_0x1ba03e){_0x157232=_0x157232-0x0;var _0x284d4d=_0x2032[_0x157232];return _0x284d4d;};'use strict';var EventEmitter=require('events');var Notification=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){NotificationEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);NotificationEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];Notification[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=NotificationEvents; \ No newline at end of file +var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x2a6227,_0x603c31){var _0x5b186c=function(_0x45de3f){while(--_0x45de3f){_0x2a6227['push'](_0x2a6227['shift']());}};_0x5b186c(++_0x603c31);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require('events');var Notification=require(_0x65f6('0x0'))['db']['Notification'];var NotificationEvents=new EventEmitter();NotificationEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){NotificationEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);NotificationEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index dd69172..a3217cd 100644 --- a/server/api/notification/notification.model.js +++ b/server/api/notification/notification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30ca=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Notification','notifications','utf8mb4'];(function(_0x50c17d,_0x4c35a1){var _0x168736=function(_0x134eed){while(--_0x134eed){_0x50c17d['push'](_0x50c17d['shift']());}};_0x168736(++_0x4c35a1);}(_0x30ca,0xf1));var _0xa30c=function(_0x5a4650,_0x30d108){_0x5a4650=_0x5a4650-0x0;var _0x12ec86=_0x30ca[_0x5a4650];return _0x12ec86;};'use strict';var _=require(_0xa30c('0x0'));var util=require(_0xa30c('0x1'));var logger=require(_0xa30c('0x2'))(_0xa30c('0x3'));var moment=require(_0xa30c('0x4'));var BPromise=require(_0xa30c('0x5'));var rp=require(_0xa30c('0x6'));var fs=require('fs');var path=require(_0xa30c('0x7'));var rimraf=require(_0xa30c('0x8'));var config=require(_0xa30c('0x9'));var attributes=require('./notification.attributes');module[_0xa30c('0xa')]=function(_0x3726c6,_0x32459f){return _0x3726c6[_0xa30c('0xb')](_0xa30c('0xc'),attributes,{'tableName':_0xa30c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa30c('0xe'),'collate':_0xa30c('0xf')});}; \ No newline at end of file +var _0xc18c=['../../config/environment','./notification.attributes','exports','define','Notification','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x3df1fe,_0x1d2ae3){var _0x4e6d59=function(_0x1871b5){while(--_0x1871b5){_0x3df1fe['push'](_0x3df1fe['shift']());}};_0x4e6d59(++_0x1d2ae3);}(_0xc18c,0x13b));var _0xcc18=function(_0x4d5b88,_0x373a2d){_0x4d5b88=_0x4d5b88-0x0;var _0x297b8e=_0xc18c[_0x4d5b88];return _0x297b8e;};'use strict';var _=require(_0xcc18('0x0'));var util=require(_0xcc18('0x1'));var logger=require(_0xcc18('0x2'))(_0xcc18('0x3'));var moment=require(_0xcc18('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc18('0x5'));var rimraf=require(_0xcc18('0x6'));var config=require(_0xcc18('0x7'));var attributes=require(_0xcc18('0x8'));module[_0xcc18('0x9')]=function(_0x347a8b,_0x17e848){return _0x347a8b[_0xcc18('0xa')](_0xcc18('0xb'),attributes,{'tableName':'notifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcc18('0xc'),'collate':_0xcc18('0xd')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index ccada7b..a7cad2c 100644 --- a/server/api/notification/notification.rpc.js +++ b/server/api/notification/notification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde3e=['localhost','socket.io-emitter','./notification.socket','register','request','then','info','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','Notification,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults'];(function(_0x568d5f,_0x2ddab9){var _0x376af8=function(_0x3d85f4){while(--_0x3d85f4){_0x568d5f['push'](_0x568d5f['shift']());}};_0x376af8(++_0x2ddab9);}(_0xde3e,0x7c));var _0xede3=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xde3e[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0xede3('0x0'));var util=require(_0xede3('0x1'));var moment=require('moment');var BPromise=require(_0xede3('0x2'));var rs=require(_0xede3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xede3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xede3('0x5'))(_0xede3('0x6'));var config=require('../../config/environment');var jayson=require(_0xede3('0x7'));var client=jayson[_0xede3('0x8')]['http']({'port':0x232a});config[_0xede3('0x9')]=_[_0xede3('0xa')](config[_0xede3('0x9')],{'host':_0xede3('0xb'),'port':0x18eb});var socket=require(_0xede3('0xc'))(new Redis(config[_0xede3('0x9')]));require(_0xede3('0xd'))[_0xede3('0xe')](socket);function respondWithRpcPromise(_0x8c99e0,_0x54be0f,_0x33f87c){return new BPromise(function(_0x46932c,_0x2264f9){return client[_0xede3('0xf')](_0x8c99e0,_0x33f87c)[_0xede3('0x10')](function(_0x5261f5){logger[_0xede3('0x11')]('Notification,\x20%s,\x20%s',_0x54be0f,'request\x20sent');logger[_0xede3('0x12')](_0xede3('0x13'),_0x54be0f,_0xede3('0x14'),JSON['stringify'](_0x5261f5));if(_0x5261f5[_0xede3('0x15')]){if(_0x5261f5[_0xede3('0x15')][_0xede3('0x16')]===0x1f4){logger[_0xede3('0x15')]('Notification,\x20%s,\x20%s',_0x54be0f,_0x5261f5['error']['message']);return _0x2264f9(_0x5261f5[_0xede3('0x15')]['message']);}logger['error']('Notification,\x20%s,\x20%s',_0x54be0f,_0x5261f5['error'][_0xede3('0x17')]);return _0x46932c(_0x5261f5['error'][_0xede3('0x17')]);}else{logger[_0xede3('0x11')](_0xede3('0x18'),_0x54be0f,_0xede3('0x14'));_0x46932c(_0x5261f5[_0xede3('0x19')][_0xede3('0x17')]);}})[_0xede3('0x1a')](function(_0x35d885){logger[_0xede3('0x15')](_0xede3('0x18'),_0x54be0f,_0x35d885);_0x2264f9(_0x35d885);});});} \ No newline at end of file +var _0xf5b0=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','request','then','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','Notification,\x20%s,\x20%s','message','info','lodash'];(function(_0x2d18c2,_0x4e76a2){var _0xda4b31=function(_0x197a24){while(--_0x197a24){_0x2d18c2['push'](_0x2d18c2['shift']());}};_0xda4b31(++_0x4e76a2);}(_0xf5b0,0x9b));var _0x0f5b=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xf5b0[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x0f5b('0x0'));var util=require('util');var moment=require(_0x0f5b('0x1'));var BPromise=require(_0x0f5b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f5b('0x3'));var db=require(_0x0f5b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f5b('0x5'))(_0x0f5b('0x6'));var config=require(_0x0f5b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0f5b('0x8')][_0x0f5b('0x9')]({'port':0x232a});config[_0x0f5b('0xa')]=_[_0x0f5b('0xb')](config['redis'],{'host':_0x0f5b('0xc'),'port':0x18eb});var socket=require(_0x0f5b('0xd'))(new Redis(config[_0x0f5b('0xa')]));require(_0x0f5b('0xe'))[_0x0f5b('0xf')](socket);function respondWithRpcPromise(_0x2cbc66,_0x58bba3,_0x38efef){return new BPromise(function(_0xa57758,_0x29e9a2){return client[_0x0f5b('0x10')](_0x2cbc66,_0x38efef)[_0x0f5b('0x11')](function(_0x557a57){logger['info']('Notification,\x20%s,\x20%s',_0x58bba3,_0x0f5b('0x12'));logger[_0x0f5b('0x13')](_0x0f5b('0x14'),_0x58bba3,'request\x20sent',JSON[_0x0f5b('0x15')](_0x557a57));if(_0x557a57['error']){if(_0x557a57[_0x0f5b('0x16')]['code']===0x1f4){logger[_0x0f5b('0x16')](_0x0f5b('0x17'),_0x58bba3,_0x557a57[_0x0f5b('0x16')][_0x0f5b('0x18')]);return _0x29e9a2(_0x557a57[_0x0f5b('0x16')][_0x0f5b('0x18')]);}logger[_0x0f5b('0x16')](_0x0f5b('0x17'),_0x58bba3,_0x557a57[_0x0f5b('0x16')][_0x0f5b('0x18')]);return _0xa57758(_0x557a57[_0x0f5b('0x16')][_0x0f5b('0x18')]);}else{logger[_0x0f5b('0x19')]('Notification,\x20%s,\x20%s',_0x58bba3,_0x0f5b('0x12'));_0xa57758(_0x557a57['result'][_0x0f5b('0x18')]);}})['catch'](function(_0x4235e1){logger['error'](_0x0f5b('0x17'),_0x58bba3,_0x4235e1);_0x29e9a2(_0x4235e1);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 4af36d6..356d188 100644 --- a/server/api/notification/notification.socket.js +++ b/server/api/notification/notification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbcd6=['removeListener','length','save','update'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xbcd6,0x82));var _0x6bcd=function(_0x259244,_0x30c1d0){_0x259244=_0x259244-0x0;var _0x3d01e6=_0xbcd6[_0x259244];return _0x3d01e6;};'use strict';var NotificationEvents=require('./notification.events');var events=[_0x6bcd('0x0'),'remove',_0x6bcd('0x1')];function createListener(_0xf8b59,_0x1d9622){return function(_0x12fa20){_0x1d9622['emit'](_0xf8b59,_0x12fa20);};}function removeListener(_0x41747a,_0x219509){return function(){NotificationEvents[_0x6bcd('0x2')](_0x41747a,_0x219509);};}exports['register']=function(_0x26366a){for(var _0x2f4e85=0x0,_0x225723=events[_0x6bcd('0x3')];_0x2f4e85<_0x225723;_0x2f4e85++){var _0x992b23=events[_0x2f4e85];var _0xe50bd7=createListener('notification:'+_0x992b23,_0x26366a);NotificationEvents['on'](_0x992b23,_0xe50bd7);}}; \ No newline at end of file +var _0x5151=['./notification.events','save','update','emit','removeListener'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x5151,0x131));var _0x1515=function(_0x383cd5,_0x1f4b3c){_0x383cd5=_0x383cd5-0x0;var _0x205cf8=_0x5151[_0x383cd5];return _0x205cf8;};'use strict';var NotificationEvents=require(_0x1515('0x0'));var events=[_0x1515('0x1'),'remove',_0x1515('0x2')];function createListener(_0x223c2f,_0x5d2881){return function(_0x3fdf5e){_0x5d2881[_0x1515('0x3')](_0x223c2f,_0x3fdf5e);};}function removeListener(_0x3bdc09,_0x2ab069){return function(){NotificationEvents[_0x1515('0x4')](_0x3bdc09,_0x2ab069);};}exports['register']=function(_0x7d2697){for(var _0x2c592f=0x0,_0x4e169f=events['length'];_0x2c592f<_0x4e169f;_0x2c592f++){var _0x4d31eb=events[_0x2c592f];var _0x3503d0=createListener('notification:'+_0x4d31eb,_0x7d2697);NotificationEvents['on'](_0x4d31eb,_0x3503d0);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 12ee03c..8e87337 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 _0x0c33=['create','/:id/dispositions','addDisposition','addAnswer','/:id/notify','/:id/applications','addApplications','addAgents','/:id/send','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','express','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','/describe','describe','/:id','show','get','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post'];(function(_0x212985,_0x2cedc0){var _0x290a4e=function(_0x36b4c4){while(--_0x36b4c4){_0x212985['push'](_0x212985['shift']());}};_0x290a4e(++_0x2cedc0);}(_0x0c33,0x1e4));var _0x30c3=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x0c33[_0x47e7cb];return _0x2a8874;};'use strict';var multer=require(_0x30c3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x30c3('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x30c3('0x2'));var config=require(_0x30c3('0x3'));var controller=require(_0x30c3('0x4'));router['get']('/',auth[_0x30c3('0x5')](),controller['index']);router['get'](_0x30c3('0x6'),auth[_0x30c3('0x5')](),controller[_0x30c3('0x7')]);router['get'](_0x30c3('0x8'),auth[_0x30c3('0x5')](),controller[_0x30c3('0x9')]);router[_0x30c3('0xa')]('/:id/dispositions',auth[_0x30c3('0x5')](),controller[_0x30c3('0xb')]);router['get'](_0x30c3('0xc'),auth[_0x30c3('0x5')](),controller[_0x30c3('0xd')]);router['get']('/:id/applications',auth[_0x30c3('0x5')](),controller[_0x30c3('0xe')]);router[_0x30c3('0xa')](_0x30c3('0xf'),auth['isAuthenticated'](),controller[_0x30c3('0x10')]);router['get'](_0x30c3('0x11'),auth[_0x30c3('0x5')](),controller[_0x30c3('0x12')]);router[_0x30c3('0x13')]('/',auth[_0x30c3('0x5')](),controller[_0x30c3('0x14')]);router['post'](_0x30c3('0x15'),auth['isAuthenticated'](),controller[_0x30c3('0x16')]);router[_0x30c3('0x13')]('/:id/canned_answers',auth[_0x30c3('0x5')](),controller[_0x30c3('0x17')]);router['post'](_0x30c3('0x18'),controller['notify']);router[_0x30c3('0x13')](_0x30c3('0x19'),auth[_0x30c3('0x5')](),controller[_0x30c3('0x1a')]);router[_0x30c3('0x13')](_0x30c3('0x11'),auth[_0x30c3('0x5')](),controller[_0x30c3('0x1b')]);router[_0x30c3('0x13')](_0x30c3('0x1c'),auth[_0x30c3('0x5')](),controller['send']);router[_0x30c3('0x1d')](_0x30c3('0x8'),auth[_0x30c3('0x5')](),controller[_0x30c3('0x1e')]);router[_0x30c3('0x1f')](_0x30c3('0x8'),auth[_0x30c3('0x5')](),controller['destroy']);router[_0x30c3('0x1f')](_0x30c3('0x15'),auth[_0x30c3('0x5')](),controller[_0x30c3('0x20')]);router[_0x30c3('0x1f')](_0x30c3('0xc'),auth[_0x30c3('0x5')](),controller[_0x30c3('0x21')]);router[_0x30c3('0x1f')]('/:id/users',auth[_0x30c3('0x5')](),controller[_0x30c3('0x22')]);module[_0x30c3('0x23')]=router; \ No newline at end of file +var _0x4b30=['addApplications','/:id/users','addAgents','/:id/send','send','put','update','delete','destroy','removeAnswers','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getApplications','/:id/interactions','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','/:id/applications'];(function(_0x2a490f,_0x3cb94b){var _0x4683ff=function(_0x8fe63a){while(--_0x8fe63a){_0x2a490f['push'](_0x2a490f['shift']());}};_0x4683ff(++_0x3cb94b);}(_0x4b30,0x1a2));var _0x04b3=function(_0x17d928,_0x15f099){_0x17d928=_0x17d928-0x0;var _0x2c812c=_0x4b30[_0x17d928];return _0x2c812c;};'use strict';var multer=require(_0x04b3('0x0'));var util=require(_0x04b3('0x1'));var path=require('path');var timeout=require(_0x04b3('0x2'));var express=require(_0x04b3('0x3'));var router=express['Router']();var auth=require(_0x04b3('0x4'));var interaction=require(_0x04b3('0x5'));var config=require(_0x04b3('0x6'));var controller=require(_0x04b3('0x7'));router[_0x04b3('0x8')]('/',auth[_0x04b3('0x9')](),controller[_0x04b3('0xa')]);router[_0x04b3('0x8')]('/describe',auth[_0x04b3('0x9')](),controller[_0x04b3('0xb')]);router['get'](_0x04b3('0xc'),auth[_0x04b3('0x9')](),controller[_0x04b3('0xd')]);router[_0x04b3('0x8')](_0x04b3('0xe'),auth['isAuthenticated'](),controller[_0x04b3('0xf')]);router[_0x04b3('0x8')](_0x04b3('0x10'),auth[_0x04b3('0x9')](),controller['getAnswers']);router[_0x04b3('0x8')]('/:id/applications',auth[_0x04b3('0x9')](),controller[_0x04b3('0x11')]);router[_0x04b3('0x8')](_0x04b3('0x12'),auth[_0x04b3('0x9')](),controller['getInteractions']);router[_0x04b3('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x04b3('0x13')]);router['post']('/',auth[_0x04b3('0x9')](),controller['create']);router[_0x04b3('0x14')](_0x04b3('0xe'),auth[_0x04b3('0x9')](),controller[_0x04b3('0x15')]);router[_0x04b3('0x14')](_0x04b3('0x10'),auth[_0x04b3('0x9')](),controller[_0x04b3('0x16')]);router[_0x04b3('0x14')](_0x04b3('0x17'),controller[_0x04b3('0x18')]);router[_0x04b3('0x14')](_0x04b3('0x19'),auth[_0x04b3('0x9')](),controller[_0x04b3('0x1a')]);router['post'](_0x04b3('0x1b'),auth[_0x04b3('0x9')](),controller[_0x04b3('0x1c')]);router['post'](_0x04b3('0x1d'),auth[_0x04b3('0x9')](),controller[_0x04b3('0x1e')]);router[_0x04b3('0x1f')](_0x04b3('0xc'),auth['isAuthenticated'](),controller[_0x04b3('0x20')]);router[_0x04b3('0x21')]('/:id',auth[_0x04b3('0x9')](),controller[_0x04b3('0x22')]);router[_0x04b3('0x21')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x04b3('0x10'),auth[_0x04b3('0x9')](),controller[_0x04b3('0x23')]);router[_0x04b3('0x21')](_0x04b3('0x1b'),auth[_0x04b3('0x9')](),controller['removeAgents']);module[_0x04b3('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 36453ee..6c0142b 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 _0x1b19=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','randomstring','exports','STRING','name','generate','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'];(function(_0x28fbbf,_0x11f896){var _0x543af6=function(_0x27fa74){while(--_0x27fa74){_0x28fbbf['push'](_0x28fbbf['shift']());}};_0x543af6(++_0x11f896);}(_0x1b19,0x1ca));var _0x91b1=function(_0x1139be,_0xc963d1){_0x1139be=_0x1139be-0x0;var _0x4db5fc=_0x1b19[_0x1139be];return _0x4db5fc;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x91b1('0x0'));module[_0x91b1('0x1')]={'name':{'type':Sequelize[_0x91b1('0x2')],'unique':_0x91b1('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x91b1('0x2')],'defaultValue':function(){return rs[_0x91b1('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x91b1('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x91b1('0x5')],'defaultValue':function(){return _0x91b1('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x91b1('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x91b1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x91b1('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x91b1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x91b1('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x91b1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x91b1('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x91b1('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x91b1('0x7')],'defaultValue':![],'comment':_0x91b1('0xa'),'set':function(_0x309c4b){if(!_0x309c4b)this[_0x91b1('0xb')]('mandatoryDispositionPauseId',null);this[_0x91b1('0xb')]('mandatoryDisposition',_0x309c4b);}}}; \ No newline at end of file +var _0x1156=['mandatoryDisposition','sequelize','exports','STRING','generate','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'];(function(_0x4eeb1b,_0x3ffc9e){var _0x353931=function(_0x413dd3){while(--_0x413dd3){_0x4eeb1b['push'](_0x4eeb1b['shift']());}};_0x353931(++_0x3ffc9e);}(_0x1156,0x182));var _0x6115=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0x1156[_0x3b231a];return _0x18d67a;};'use strict';var Sequelize=require(_0x6115('0x0'));var rs=require('randomstring');module[_0x6115('0x1')]={'name':{'type':Sequelize[_0x6115('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x6115('0x2')]},'token':{'type':Sequelize[_0x6115('0x2')],'defaultValue':function(){return rs[_0x6115('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6115('0x4')],'defaultValue':function(){return _0x6115('0x5');}},'notificationSound':{'type':Sequelize[_0x6115('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6115('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6115('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6115('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6115('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6115('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6115('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x6115('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x6115('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2bc5dc){if(!_0x2bc5dc)this[_0x6115('0x9')]('mandatoryDispositionPauseId',null);this[_0x6115('0x9')](_0x6115('0xa'),_0x2bc5dc);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 558051e..6855be7 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 _0x1f52=['Content-Range','apply','reject','update','destroy','get','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','find','create','user','role','OpenchannelAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','map','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','OpenchannelApplication','Applications','List','applications','list','orderBy','priority','account','contact','lastName','threadId','OpenchannelInteraction','externalUrl','spread','firstName','messageId','interaction','created','autoclose','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','Contact','Owner','fullname','internal','Tag','color','tag','addAgents','omit','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','count','offset','limit','set'];(function(_0x36e38b,_0x44d175){var _0x586b09=function(_0x103a40){while(--_0x103a40){_0x36e38b['push'](_0x36e38b['shift']());}};_0x586b09(++_0x44d175);}(_0x1f52,0x85));var _0x21f5=function(_0x3c3d5f,_0x99c8e6){_0x3c3d5f=_0x3c3d5f-0x0;var _0x5d745e=_0x1f52[_0x3c3d5f];return _0x5d745e;};'use strict';var pdf=require(_0x21f5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x21f5('0x1'));var zipdir=require(_0x21f5('0x2'));var jsonpatch=require(_0x21f5('0x3'));var rp=require('request-promise');var moment=require(_0x21f5('0x4'));var BPromise=require(_0x21f5('0x5'));var Mustache=require('mustache');var util=require(_0x21f5('0x6'));var path=require(_0x21f5('0x7'));var sox=require(_0x21f5('0x8'));var csv=require(_0x21f5('0x9'));var ejs=require(_0x21f5('0xa'));var fs=require('fs');var _=require(_0x21f5('0xb'));var squel=require(_0x21f5('0xc'));var crypto=require(_0x21f5('0xd'));var jsforce=require(_0x21f5('0xe'));var deskjs=require(_0x21f5('0xf'));var toCsv=require(_0x21f5('0x9'));var querystring=require('querystring');var Papa=require(_0x21f5('0x10'));var Redis=require(_0x21f5('0x11'));var authService=require(_0x21f5('0x12'));var qs=require(_0x21f5('0x13'));var as=require(_0x21f5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x21f5('0x15'))(_0x21f5('0x16'));var utils=require('../../config/utils');var config=require(_0x21f5('0x17'));var licenseUtil=require(_0x21f5('0x18'));var db=require('../../mysqldb')['db'];config[_0x21f5('0x19')]=_[_0x21f5('0x1a')](config[_0x21f5('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x21f5('0x1b'))(new Redis(config[_0x21f5('0x19')]));require('./openchannelAccount.socket')[_0x21f5('0x1c')](socket);var jayson=require(_0x21f5('0x1d'));var client=jayson[_0x21f5('0x1e')][_0x21f5('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x21f5('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2d88c5,_0x214cb0,_0x19b90b,_0x1722c6){return new BPromise(function(_0x2dcc56,_0x334642){var _0x1d2b35=_0x1722c6||client;return _0x1d2b35['request'](_0x2d88c5,_0x19b90b)[_0x21f5('0x20')](function(_0x50900c){logger[_0x21f5('0x21')](_0x21f5('0x22'),_0x214cb0,_0x21f5('0x23'));logger[_0x21f5('0x24')](_0x21f5('0x25'),_0x214cb0,'request\x20sent',JSON[_0x21f5('0x26')](_0x50900c));if(_0x50900c[_0x21f5('0x27')]){if(_0x50900c[_0x21f5('0x27')][_0x21f5('0x28')]===0x1f4){logger[_0x21f5('0x27')](_0x21f5('0x22'),_0x214cb0,_0x50900c[_0x21f5('0x27')]['message']);return _0x334642(_0x50900c['error']['message']);}logger['error'](_0x21f5('0x22'),_0x214cb0,_0x50900c[_0x21f5('0x27')]['message']);return _0x2dcc56(_0x50900c['error'][_0x21f5('0x29')]);}else{logger[_0x21f5('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x214cb0,_0x21f5('0x23'));_0x2dcc56(_0x50900c[_0x21f5('0x2a')][_0x21f5('0x29')]);}})[_0x21f5('0x2b')](function(_0x311444){logger[_0x21f5('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x214cb0,_0x311444);_0x334642(_0x311444);});});}function respondWithStatusCode(_0x1a496f,_0xd7fb08){_0xd7fb08=_0xd7fb08||0xcc;return function(_0x3a4270){if(_0x3a4270){return _0x1a496f[_0x21f5('0x2c')](_0xd7fb08);}return _0x1a496f[_0x21f5('0x2d')](_0xd7fb08)['end']();};}function respondWithResult(_0x47c972,_0xc91d4){_0xc91d4=_0xc91d4||0xc8;return function(_0x43d68b){if(_0x43d68b){return _0x47c972[_0x21f5('0x2d')](_0xc91d4)['json'](_0x43d68b);}};}function respondWithFilteredResult(_0x517788,_0x5e795d){return function(_0x1dc500){if(_0x1dc500){var _0x114690=_0x1dc500[_0x21f5('0x2e')],_0x3f9aff=_0x5e795d[_0x21f5('0x2f')],_0x45f476=_0x5e795d['offset']+_0x5e795d[_0x21f5('0x30')],_0x384d00;if(_0x45f476>=_0x114690){_0x45f476=_0x114690;_0x384d00=0xc8;}else{_0x384d00=0xce;}_0x517788[_0x21f5('0x2d')](_0x384d00);return _0x517788[_0x21f5('0x31')](_0x21f5('0x32'),_0x3f9aff+'-'+_0x45f476+'/'+_0x114690)['json'](_0x1dc500);}return null;};}function patchUpdates(_0x3f47e0){return function(_0xbf1434){try{jsonpatch[_0x21f5('0x33')](_0xbf1434,_0x3f47e0,!![]);}catch(_0x365d30){return BPromise[_0x21f5('0x34')](_0x365d30);}return _0xbf1434['save']();};}function saveUpdates(_0x1d1aec,_0x2ec0dd){return function(_0x4c336f){if(_0x4c336f){return _0x4c336f[_0x21f5('0x35')](_0x1d1aec)[_0x21f5('0x20')](function(_0x2b7c9f){return _0x2b7c9f;});}return null;};}function removeEntity(_0x53f7df,_0x2d1e13){return function(_0x1f8661){if(_0x1f8661){return _0x1f8661[_0x21f5('0x36')]()[_0x21f5('0x20')](function(){var _0x569d9c=_0x1f8661[_0x21f5('0x37')]({'plain':!![]});var _0x22ce2f='OpenchannelAccounts';return db[_0x21f5('0x38')][_0x21f5('0x36')]({'where':{'type':_0x22ce2f,'resourceId':_0x569d9c['id']}})[_0x21f5('0x20')](function(){return _0x1f8661;});})[_0x21f5('0x20')](function(){_0x53f7df[_0x21f5('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17077c,_0x4ca3cb){return function(_0xb18870){if(!_0xb18870){_0x17077c['sendStatus'](0x194);}return _0xb18870;};}function handleError(_0x3191ab,_0xb8b148){_0xb8b148=_0xb8b148||0x1f4;return function(_0x47c2ab){logger[_0x21f5('0x27')](_0x47c2ab[_0x21f5('0x39')]);if(_0x47c2ab[_0x21f5('0x3a')]){delete _0x47c2ab[_0x21f5('0x3a')];}_0x3191ab['status'](_0xb8b148)[_0x21f5('0x3b')](_0x47c2ab);};}exports['index']=function(_0x442011,_0x24bb6b){var _0x20a371={'include':[{'model':db[_0x21f5('0x3c')],'as':_0x21f5('0x3d')}]},_0x3f6e02={},_0x49f2e0={'count':0x0,'rows':[]};var _0x4dea19=_['map'](db[_0x21f5('0x3e')][_0x21f5('0x3f')],function(_0x23093f){return{'name':_0x23093f['fieldName'],'type':_0x23093f[_0x21f5('0x40')][_0x21f5('0x41')]};});_0x3f6e02['model']=_['map'](_0x4dea19,_0x21f5('0x3a'));_0x3f6e02[_0x21f5('0x42')]=_['keys'](_0x442011['query']);_0x3f6e02[_0x21f5('0x43')]=_[_0x21f5('0x44')](_0x3f6e02['model'],_0x3f6e02[_0x21f5('0x42')]);_0x20a371[_0x21f5('0x45')]=_[_0x21f5('0x44')](_0x3f6e02[_0x21f5('0x46')],qs[_0x21f5('0x47')](_0x442011[_0x21f5('0x42')][_0x21f5('0x47')]));_0x20a371[_0x21f5('0x45')]=_0x20a371['attributes'][_0x21f5('0x48')]?_0x20a371['attributes']:_0x3f6e02[_0x21f5('0x46')];if(!_0x442011['query'][_0x21f5('0x49')](_0x21f5('0x4a'))){_0x20a371['limit']=qs[_0x21f5('0x30')](_0x442011[_0x21f5('0x42')][_0x21f5('0x30')]);_0x20a371[_0x21f5('0x2f')]=qs['offset'](_0x442011[_0x21f5('0x42')][_0x21f5('0x2f')]);}_0x20a371[_0x21f5('0x4b')]=qs[_0x21f5('0x4c')](_0x442011[_0x21f5('0x42')][_0x21f5('0x4c')]);_0x20a371[_0x21f5('0x4d')]=qs[_0x21f5('0x43')](_[_0x21f5('0x4e')](_0x442011[_0x21f5('0x42')],_0x3f6e02['filters']),_0x4dea19);if(_0x442011['query']['filter']){_0x20a371['where']=_[_0x21f5('0x4f')](_0x20a371[_0x21f5('0x4d')],{'$or':_['map'](_0x4dea19,function(_0x348132){if(_0x348132[_0x21f5('0x40')]!==_0x21f5('0x50')){var _0x5d7daa={};_0x5d7daa[_0x348132[_0x21f5('0x3a')]]={'$like':'%'+_0x442011[_0x21f5('0x42')][_0x21f5('0x51')]+'%'};return _0x5d7daa;}})});}_0x20a371=_[_0x21f5('0x4f')]({},_0x20a371,_0x442011[_0x21f5('0x52')]);var _0x17e71a={'where':_0x20a371[_0x21f5('0x4d')]};return db[_0x21f5('0x3e')][_0x21f5('0x2e')](_0x17e71a)[_0x21f5('0x20')](function(_0x125aa4){_0x49f2e0['count']=_0x125aa4;if(_0x442011[_0x21f5('0x42')][_0x21f5('0x53')]){_0x20a371[_0x21f5('0x54')]=[{'all':!![]}];}return db[_0x21f5('0x3e')][_0x21f5('0x55')](_0x20a371);})[_0x21f5('0x20')](function(_0x4eed9c){_0x49f2e0[_0x21f5('0x56')]=_0x4eed9c;return _0x49f2e0;})[_0x21f5('0x20')](respondWithFilteredResult(_0x24bb6b,_0x20a371))[_0x21f5('0x2b')](handleError(_0x24bb6b,null));};exports[_0x21f5('0x57')]=function(_0x163ac8,_0x2b5c10){var _0x507669={'raw':![],'where':{'id':_0x163ac8[_0x21f5('0x58')]['id']},'include':[{'model':db[_0x21f5('0x3c')],'as':_0x21f5('0x3d')}]},_0x161fda={};_0x161fda[_0x21f5('0x46')]=_[_0x21f5('0x59')](db[_0x21f5('0x3e')]['rawAttributes']);_0x161fda[_0x21f5('0x42')]=_[_0x21f5('0x59')](_0x163ac8[_0x21f5('0x42')]);_0x161fda[_0x21f5('0x43')]=_['intersection'](_0x161fda[_0x21f5('0x46')],_0x161fda[_0x21f5('0x42')]);_0x507669['attributes']=_[_0x21f5('0x44')](_0x161fda[_0x21f5('0x46')],qs[_0x21f5('0x47')](_0x163ac8[_0x21f5('0x42')]['fields']));_0x507669['attributes']=_0x507669[_0x21f5('0x45')][_0x21f5('0x48')]?_0x507669[_0x21f5('0x45')]:_0x161fda['model'];if(_0x163ac8['query'][_0x21f5('0x53')]){_0x507669[_0x21f5('0x54')]=[{'all':!![]}];}_0x507669=_['merge']({},_0x507669,_0x163ac8[_0x21f5('0x52')]);return db[_0x21f5('0x3e')][_0x21f5('0x5a')](_0x507669)[_0x21f5('0x20')](handleEntityNotFound(_0x2b5c10,null))[_0x21f5('0x20')](respondWithResult(_0x2b5c10,null))['catch'](handleError(_0x2b5c10,null));};exports[_0x21f5('0x5b')]=function(_0x3f2b63,_0x4d3b00){return db[_0x21f5('0x3e')][_0x21f5('0x5b')](_0x3f2b63['body'],{})[_0x21f5('0x20')](function(_0x14e6a9){var _0x15ad05=_0x3f2b63[_0x21f5('0x5c')][_0x21f5('0x37')]({'plain':!![]});if(!_0x15ad05)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15ad05[_0x21f5('0x5d')]===_0x21f5('0x5c')){var _0x20788c=_0x14e6a9['get']({'plain':!![]});var _0x206ba1=_0x21f5('0x5e');return db[_0x21f5('0x5f')][_0x21f5('0x5a')]({'where':{'name':_0x206ba1,'userProfileId':_0x15ad05['userProfileId']},'raw':!![]})[_0x21f5('0x20')](function(_0x848cfc){if(_0x848cfc&&_0x848cfc[_0x21f5('0x60')]===0x0){return db[_0x21f5('0x38')]['create']({'name':_0x20788c['name'],'resourceId':_0x20788c['id'],'type':_0x848cfc['name'],'sectionId':_0x848cfc['id']},{})[_0x21f5('0x20')](function(){return _0x14e6a9;});}else{return _0x14e6a9;}})[_0x21f5('0x2b')](function(_0x48a411){logger[_0x21f5('0x27')](_0x21f5('0x61'),_0x48a411);throw _0x48a411;});}return _0x14e6a9;})[_0x21f5('0x20')](respondWithResult(_0x4d3b00,0xc9))[_0x21f5('0x2b')](handleError(_0x4d3b00,null));};exports[_0x21f5('0x35')]=function(_0x1db781,_0x191b25){if(_0x1db781[_0x21f5('0x62')]['id']){delete _0x1db781[_0x21f5('0x62')]['id'];}return db[_0x21f5('0x3e')][_0x21f5('0x5a')]({'where':{'id':_0x1db781['params']['id']},'include':[{'model':db[_0x21f5('0x3c')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x191b25,null))[_0x21f5('0x20')](saveUpdates(_0x1db781['body'],null))[_0x21f5('0x20')](respondWithResult(_0x191b25,null))[_0x21f5('0x2b')](handleError(_0x191b25,null));};exports[_0x21f5('0x36')]=function(_0x3bf253,_0x10eda9){return db['OpenchannelAccount'][_0x21f5('0x5a')]({'where':{'id':_0x3bf253[_0x21f5('0x58')]['id']}})[_0x21f5('0x20')](handleEntityNotFound(_0x10eda9,null))[_0x21f5('0x20')](removeEntity(_0x10eda9,null))[_0x21f5('0x2b')](handleError(_0x10eda9,null));};exports[_0x21f5('0x63')]=function(_0x160cae,_0x39ea92){return db[_0x21f5('0x3e')][_0x21f5('0x63')]()[_0x21f5('0x20')](respondWithResult(_0x39ea92,null))[_0x21f5('0x2b')](handleError(_0x39ea92,null));};exports[_0x21f5('0x64')]=function(_0x18fcbc,_0x51b5ef,_0x32f4fa){if(_0x18fcbc[_0x21f5('0x62')]['id']){delete _0x18fcbc[_0x21f5('0x62')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x18fcbc[_0x21f5('0x58')]['id']}})['then'](handleEntityNotFound(_0x51b5ef,null))[_0x21f5('0x20')](function(_0x30d6a9){if(_0x30d6a9){_0x18fcbc[_0x21f5('0x62')][_0x21f5('0x65')]=_0x30d6a9['id'];return db['Disposition'][_0x21f5('0x5b')](_0x18fcbc[_0x21f5('0x62')]);}})[_0x21f5('0x20')](respondWithResult(_0x51b5ef,null))[_0x21f5('0x2b')](handleError(_0x51b5ef,null));};exports[_0x21f5('0x66')]=function(_0x3d534d,_0x26533f,_0x4e20e6){var _0x55cf7b={'raw':![],'where':{}};var _0xe76309={};var _0x369754={'count':0x0,'rows':[]};return db[_0x21f5('0x3e')][_0x21f5('0x67')]({'where':{'id':_0x3d534d[_0x21f5('0x58')]['id']}})['then'](handleEntityNotFound(_0x26533f,null))[_0x21f5('0x20')](function(_0x2db947){if(_0x2db947){_0xe76309['model']=_[_0x21f5('0x59')](db[_0x21f5('0x68')][_0x21f5('0x3f')]);_0xe76309['query']=_[_0x21f5('0x59')](_0x3d534d['query']);_0xe76309[_0x21f5('0x43')]=_[_0x21f5('0x44')](_0xe76309[_0x21f5('0x46')],_0xe76309[_0x21f5('0x42')]);_0x55cf7b['attributes']=_[_0x21f5('0x44')](_0xe76309['model'],qs[_0x21f5('0x47')](_0x3d534d[_0x21f5('0x42')][_0x21f5('0x47')]));_0x55cf7b[_0x21f5('0x45')]=_0x55cf7b['attributes'][_0x21f5('0x48')]?_0x55cf7b[_0x21f5('0x45')]:_0xe76309['model'];if(!_0x3d534d[_0x21f5('0x42')]['hasOwnProperty'](_0x21f5('0x4a'))){_0x55cf7b[_0x21f5('0x30')]=qs['limit'](_0x3d534d[_0x21f5('0x42')]['limit']);_0x55cf7b['offset']=qs[_0x21f5('0x2f')](_0x3d534d['query'][_0x21f5('0x2f')]);}_0x55cf7b[_0x21f5('0x4b')]=qs[_0x21f5('0x4c')](_0x3d534d[_0x21f5('0x42')]['sort']);_0x55cf7b[_0x21f5('0x4d')]=qs['filters'](_[_0x21f5('0x4e')](_0x3d534d[_0x21f5('0x42')],_0xe76309['filters']));_0x55cf7b[_0x21f5('0x4d')][_0x21f5('0x65')]=_0x2db947['id'];if(_0x3d534d[_0x21f5('0x42')][_0x21f5('0x51')]){_0x55cf7b[_0x21f5('0x4d')]=_[_0x21f5('0x4f')](_0x55cf7b['where'],{'$or':_[_0x21f5('0x69')](_0x55cf7b[_0x21f5('0x45')],function(_0x5b84b7){var _0x293cfc={};_0x293cfc[_0x5b84b7]={'$like':'%'+_0x3d534d[_0x21f5('0x42')]['filter']+'%'};return _0x293cfc;})});}_0x55cf7b=_[_0x21f5('0x4f')]({},_0x55cf7b,_0x3d534d[_0x21f5('0x52')]);return db[_0x21f5('0x68')][_0x21f5('0x2e')]({'where':_0x55cf7b['where']})['then'](function(_0x4eac51){_0x369754[_0x21f5('0x2e')]=_0x4eac51;if(_0x3d534d[_0x21f5('0x42')]['includeAll']){_0x55cf7b[_0x21f5('0x54')]=[{'all':!![]}];}return db[_0x21f5('0x68')][_0x21f5('0x55')](_0x55cf7b);})['then'](function(_0x528a4c){_0x369754['rows']=_0x528a4c;return _0x369754;});}})[_0x21f5('0x20')](respondWithFilteredResult(_0x26533f,_0x55cf7b))[_0x21f5('0x2b')](handleError(_0x26533f,null));};exports[_0x21f5('0x6a')]=function(_0x4f061c,_0x3386ec,_0x4e5b54){return db[_0x21f5('0x3e')][_0x21f5('0x5a')]({'where':{'id':_0x4f061c[_0x21f5('0x58')]['id']}})[_0x21f5('0x20')](handleEntityNotFound(_0x3386ec,null))[_0x21f5('0x20')](function(_0x2f0216){if(_0x2f0216){return _0x2f0216[_0x21f5('0x6a')](_0x4f061c[_0x21f5('0x42')][_0x21f5('0x6b')]);}})[_0x21f5('0x20')](respondWithStatusCode(_0x3386ec,null))['catch'](handleError(_0x3386ec,null));};exports['addAnswer']=function(_0x15663e,_0x23cb5c,_0x374ab4){if(_0x15663e[_0x21f5('0x62')]['id']){delete _0x15663e[_0x21f5('0x62')]['id'];}return db[_0x21f5('0x3e')][_0x21f5('0x5a')]({'where':{'id':_0x15663e['params']['id']}})['then'](handleEntityNotFound(_0x23cb5c,null))['then'](function(_0x4696e8){if(_0x4696e8){_0x15663e[_0x21f5('0x62')][_0x21f5('0x65')]=_0x4696e8['id'];return db['CannedAnswer']['create'](_0x15663e[_0x21f5('0x62')]);}})['then'](respondWithResult(_0x23cb5c,null))[_0x21f5('0x2b')](handleError(_0x23cb5c,null));};exports[_0x21f5('0x6c')]=function(_0x996474,_0x2e9ccd,_0x23691f){var _0x25d451={'raw':![],'where':{}};var _0x5920c2={};var _0x172a5e={'count':0x0,'rows':[]};return db[_0x21f5('0x3e')]['findOne']({'where':{'id':_0x996474['params']['id']}})[_0x21f5('0x20')](handleEntityNotFound(_0x2e9ccd,null))['then'](function(_0x4a438a){if(_0x4a438a){_0x5920c2[_0x21f5('0x46')]=_[_0x21f5('0x59')](db['CannedAnswer'][_0x21f5('0x3f')]);_0x5920c2[_0x21f5('0x42')]=_[_0x21f5('0x59')](_0x996474[_0x21f5('0x42')]);_0x5920c2[_0x21f5('0x43')]=_['intersection'](_0x5920c2[_0x21f5('0x46')],_0x5920c2[_0x21f5('0x42')]);_0x25d451['attributes']=_[_0x21f5('0x44')](_0x5920c2['model'],qs[_0x21f5('0x47')](_0x996474[_0x21f5('0x42')]['fields']));_0x25d451[_0x21f5('0x45')]=_0x25d451[_0x21f5('0x45')][_0x21f5('0x48')]?_0x25d451['attributes']:_0x5920c2[_0x21f5('0x46')];if(!_0x996474['query'][_0x21f5('0x49')]('nolimit')){_0x25d451['limit']=qs[_0x21f5('0x30')](_0x996474[_0x21f5('0x42')][_0x21f5('0x30')]);_0x25d451[_0x21f5('0x2f')]=qs[_0x21f5('0x2f')](_0x996474[_0x21f5('0x42')][_0x21f5('0x2f')]);}_0x25d451[_0x21f5('0x4b')]=qs[_0x21f5('0x4c')](_0x996474[_0x21f5('0x42')][_0x21f5('0x4c')]);_0x25d451['where']=qs[_0x21f5('0x43')](_[_0x21f5('0x4e')](_0x996474[_0x21f5('0x42')],_0x5920c2['filters']));_0x25d451[_0x21f5('0x4d')]['OpenchannelAccountId']=_0x4a438a['id'];if(_0x996474[_0x21f5('0x42')][_0x21f5('0x51')]){_0x25d451[_0x21f5('0x4d')]=_[_0x21f5('0x4f')](_0x25d451['where'],{'$or':_[_0x21f5('0x69')](_0x25d451['attributes'],function(_0xbf141){var _0x4f7b4d={};_0x4f7b4d[_0xbf141]={'$like':'%'+_0x996474['query']['filter']+'%'};return _0x4f7b4d;})});}_0x25d451=_[_0x21f5('0x4f')]({},_0x25d451,_0x996474['options']);return db[_0x21f5('0x6d')][_0x21f5('0x2e')]({'where':_0x25d451[_0x21f5('0x4d')]})[_0x21f5('0x20')](function(_0x3345ca){_0x172a5e[_0x21f5('0x2e')]=_0x3345ca;if(_0x996474['query'][_0x21f5('0x53')]){_0x25d451['include']=[{'all':!![]}];}return db[_0x21f5('0x6d')]['findAll'](_0x25d451);})['then'](function(_0x1467fd){_0x172a5e[_0x21f5('0x56')]=_0x1467fd;return _0x172a5e;});}})['then'](respondWithFilteredResult(_0x2e9ccd,_0x25d451))[_0x21f5('0x2b')](handleError(_0x2e9ccd,null));};exports[_0x21f5('0x6e')]=function(_0x2afb95,_0x3b40dd,_0x4c6300){return db[_0x21f5('0x3e')][_0x21f5('0x5a')]({'where':{'id':_0x2afb95[_0x21f5('0x58')]['id']}})[_0x21f5('0x20')](handleEntityNotFound(_0x3b40dd,null))[_0x21f5('0x20')](function(_0x3a9c9f){if(_0x3a9c9f){return _0x3a9c9f[_0x21f5('0x6e')](_0x2afb95[_0x21f5('0x42')][_0x21f5('0x6b')]);}})['then'](respondWithStatusCode(_0x3b40dd,null))[_0x21f5('0x2b')](handleError(_0x3b40dd,null));};exports[_0x21f5('0x6f')]=function(_0x161c45,_0x3e5e80,_0x297963){var _0x47c1d3={'body':_0x161c45[_0x21f5('0x62')],'channel':_0x21f5('0x70')};var _0x15ccec=[];var _0x5afd25=[];var _0x16bc42={};var _0x59eb79=![];return db[_0x21f5('0x71')]['describe']()[_0x21f5('0x20')](function(_0xfc3fb4){if(!_0xfc3fb4){throw new db[(_0x21f5('0x72'))][(_0x21f5('0x73'))](_0x21f5('0x74'));}_0x15ccec=_['difference'](_['keys'](_0xfc3fb4),[_0x21f5('0x75'),_0x21f5('0x76')]);_0x5afd25=_[_0x21f5('0x77')](_[_0x21f5('0x59')](_0xfc3fb4),[_0x21f5('0x75'),_0x21f5('0x76'),_0x21f5('0x78'),_0x21f5('0x79')]);if(_0x161c45['body']['id']){delete _0x161c45[_0x21f5('0x62')]['id'];}if(_[_0x21f5('0x7a')](_0x161c45['body'][_0x21f5('0x7b')])){throw new db['Sequelize']['ValidationError'](_0x21f5('0x7c'));}if(_[_0x21f5('0x7a')](_0x161c45[_0x21f5('0x62')][_0x21f5('0x62')])||_0x161c45['body'][_0x21f5('0x62')]===''){throw new db[(_0x21f5('0x72'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x21f5('0x7a')](_0x161c45[_0x21f5('0x62')]['mapKey'])){throw new db[(_0x21f5('0x72'))][(_0x21f5('0x73'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5afd25);}if(!_[_0x21f5('0x7d')](_0x5afd25,_0x161c45[_0x21f5('0x62')][_0x21f5('0x7e')])){throw new db['Sequelize'][(_0x21f5('0x73'))](_0x21f5('0x7f')+_0x5afd25);}_0x16bc42[_0x161c45['body']['mapKey']]=_0x161c45[_0x21f5('0x62')][_0x21f5('0x7b')];})['then'](function(){return db[_0x21f5('0x3e')][_0x21f5('0x5a')]({'where':{'id':_0x161c45[_0x21f5('0x58')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x21f5('0x71')],'as':_0x21f5('0x80'),'where':_0x16bc42,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x21f5('0x81')],'as':_0x21f5('0x82')}]});})[_0x21f5('0x20')](handleEntityNotFound(_0x3e5e80,null))[_0x21f5('0x20')](function(_0x1fa57d){if(_0x1fa57d&&_0x1fa57d[_0x21f5('0x83')]){_0x47c1d3['account']=_0x1fa57d;_0x47c1d3[_0x21f5('0x84')]=_0x1fa57d[_0x21f5('0x82')];_0x47c1d3[_0x21f5('0x85')]=_0x1fa57d[_0x21f5('0x83')];_0x47c1d3[_0x21f5('0x84')]=_[_0x21f5('0x86')](_0x47c1d3[_0x21f5('0x84')],[_0x21f5('0x87')],['asc']);if(_0x47c1d3[_0x21f5('0x88')][_0x21f5('0x82')]){delete _0x47c1d3[_0x21f5('0x88')][_0x21f5('0x82')];}if(_0x47c1d3['account'][_0x21f5('0x83')]&&_0x47c1d3[_0x21f5('0x88')][_0x21f5('0x83')][_0x21f5('0x80')][_0x21f5('0x48')]){return _0x47c1d3[_0x21f5('0x88')][_0x21f5('0x83')]['Contacts'][0x0];}var _0x16a0e9=_[_0x21f5('0x1a')](_0x161c45[_0x21f5('0x62')],{'firstName':_0x161c45[_0x21f5('0x62')]['from'],'ListId':_0x1fa57d[_0x21f5('0x79')]});_0x16a0e9[_0x161c45[_0x21f5('0x62')][_0x21f5('0x7e')]]=_0x161c45[_0x21f5('0x62')][_0x21f5('0x7b')];return db['CmContact'][_0x21f5('0x5b')](_0x16a0e9,{'fields':_0x15ccec,'raw':!![]});}})[_0x21f5('0x20')](handleEntityNotFound(_0x3e5e80,null))['then'](function(_0x471e7f){_0x47c1d3[_0x21f5('0x89')]=_0x471e7f;if(_0x471e7f){var _0x3d0005={'ContactId':_0x471e7f['id'],'OpenchannelAccountId':_0x161c45[_0x21f5('0x58')]['id'],'from':(_0x471e7f['firstName']||'')+'\x20'+(_0x471e7f[_0x21f5('0x8a')]||'')};var _0x2d52c2={'OpenchannelAccountId':_0x161c45['params']['id'],'closed':![]};if(_0x161c45[_0x21f5('0x62')]['threadId']){_0x2d52c2[_0x21f5('0x8b')]=_0x161c45[_0x21f5('0x62')][_0x21f5('0x8b')];return db[_0x21f5('0x8c')][_0x21f5('0x5a')]({'where':_0x2d52c2})[_0x21f5('0x20')](function(_0x121916){if(_0x121916){return[_0x121916,![]];}_0x3d0005[_0x21f5('0x8b')]=_0x161c45[_0x21f5('0x62')][_0x21f5('0x8b')];_0x3d0005[_0x21f5('0x8d')]=_0x161c45[_0x21f5('0x62')][_0x21f5('0x8d')];return db['OpenchannelInteraction'][_0x21f5('0x5b')](_0x3d0005)[_0x21f5('0x20')](function(_0x28bafd){return[_0x28bafd,!![]];});});}else{_0x2d52c2[_0x21f5('0x8b')]=null;}_0x2d52c2['ContactId']=_0x471e7f['id'];return db['OpenchannelInteraction']['find']({'where':_0x2d52c2})[_0x21f5('0x20')](function(_0x286a06){if(_0x286a06){return[_0x286a06,![]];}return db[_0x21f5('0x8c')][_0x21f5('0x5b')](_0x3d0005)[_0x21f5('0x20')](function(_0x27f42d){return[_0x27f42d,!![]];});});}})[_0x21f5('0x8e')](function(_0x287d06,_0x41435b){if(_0x287d06){_0x59eb79=_0x41435b;if(!_0x41435b){var _0x41fcb5={'from':(_0x47c1d3[_0x21f5('0x89')][_0x21f5('0x8f')]||'')+'\x20'+(_0x47c1d3['contact'][_0x21f5('0x8a')]||'')};if(_0x161c45[_0x21f5('0x62')]['threadId']&&_0x161c45[_0x21f5('0x62')][_0x21f5('0x90')]&&_0x161c45[_0x21f5('0x62')]['threadId']!=_0x161c45[_0x21f5('0x62')][_0x21f5('0x90')]){_0x41fcb5[_0x21f5('0x8b')]=_0x161c45[_0x21f5('0x62')][_0x21f5('0x90')];}return _0x287d06[_0x21f5('0x35')](_0x41fcb5);}else{return _0x287d06;}}})['then'](function(_0x4f7268){_0x47c1d3['interaction']=_0x4f7268[_0x21f5('0x37')]({'plain':!![]});_0x47c1d3[_0x21f5('0x91')][_0x21f5('0x92')]=_0x59eb79;if(_0x47c1d3[_0x21f5('0x91')][_0x21f5('0x92')]){if(_0x47c1d3[_0x21f5('0x88')][_0x21f5('0x93')]){_0x47c1d3[_0x21f5('0x84')]['push']({'id':0x0,'priority':_0x47c1d3['applications'][_0x21f5('0x48')]+0x1,'app':_0x21f5('0x94'),'appdata':'unmanaged','interval':_0x21f5('0x95')});}}return db[_0x21f5('0x96')][_0x21f5('0x5b')]({'body':_0x161c45[_0x21f5('0x62')][_0x21f5('0x62')],'OpenchannelAccountId':_0x161c45[_0x21f5('0x58')]['id'],'OpenchannelInteractionId':_0x4f7268['id'],'direction':'in','ContactId':_0x47c1d3[_0x21f5('0x89')]['id'],'AttachmentId':_0x161c45[_0x21f5('0x62')][_0x21f5('0x97')]});})[_0x21f5('0x20')](function(_0x91f5b0){_0x47c1d3[_0x21f5('0x29')]=_0x91f5b0;if(_0x47c1d3[_0x21f5('0x91')][_0x21f5('0x98')]){return db[_0x21f5('0x99')][_0x21f5('0x5a')]({'attributes':['id',_0x21f5('0x3a')],'where':{'id':_0x47c1d3[_0x21f5('0x91')][_0x21f5('0x98')]}})[_0x21f5('0x20')](function(_0x3ee893){if(_0x3ee893){_0x47c1d3[_0x21f5('0x84')]['unshift']({'id':0x0,'priority':0x0,'app':_0x21f5('0x9a'),'appdata':_0x3ee893['name']+','+(_0x47c1d3['account'][_0x21f5('0x9b')]||0xa),'interval':_0x21f5('0x95')});_0x47c1d3[_0x21f5('0x9c')]=![];}return respondWithRpcPromise('Start',_0x21f5('0x9d'),_0x47c1d3);});}return respondWithRpcPromise(_0x21f5('0x9e'),_0x21f5('0x9d'),_0x47c1d3);})[_0x21f5('0x20')](function(_0x422cf7){respondWithRpcPromise(_0x21f5('0x9f'),'EventManager',{'event':_0x21f5('0x6f'),'message':_0x422cf7},client9002);return _0x422cf7;})['then'](respondWithResult(_0x3e5e80,null))[_0x21f5('0x2b')](handleError(_0x3e5e80,null));};exports['addApplications']=function(_0x193be6,_0x10322e,_0x263b3e){return db[_0x21f5('0x3e')]['findOne']({'where':{'id':_0x193be6['params']['id']}})['then'](handleEntityNotFound(_0x10322e,null))[_0x21f5('0x20')](function(_0x1abf19){if(_0x1abf19){return db[_0x21f5('0xa0')][_0x21f5('0xa1')](function(_0x2c20d3){return db[_0x21f5('0x81')][_0x21f5('0x36')]({'where':{'OpenchannelAccountId':_0x193be6[_0x21f5('0x58')]['id']},'transaction':_0x2c20d3})[_0x21f5('0x20')](function(_0x54f338){var _0x57b428=_['map'](_0x193be6['body'],function(_0x26152d){_0x26152d[_0x21f5('0x65')]=_0x193be6[_0x21f5('0x58')]['id'];return _0x26152d;});return db[_0x21f5('0x81')][_0x21f5('0xa2')](_0x57b428,{'transaction':_0x2c20d3});});})[_0x21f5('0x20')](function(){return db[_0x21f5('0x81')][_0x21f5('0xa3')]({'where':{'OpenchannelAccountId':_0x193be6['params']['id']},'order':'priority'});});}})[_0x21f5('0x20')](respondWithResult(_0x10322e,null))[_0x21f5('0x2b')](handleError(_0x10322e,null));};exports[_0x21f5('0xa4')]=function(_0xdd6bda,_0x481330,_0x45804c){var _0x5889b2={};var _0x6b59a0={};var _0x38d74e;var _0x4b9617;return db[_0x21f5('0x3e')][_0x21f5('0x67')]({'where':{'id':_0xdd6bda[_0x21f5('0x58')]['id']}})[_0x21f5('0x20')](handleEntityNotFound(_0x481330,null))[_0x21f5('0x20')](function(_0x5c883){if(_0x5c883){_0x38d74e=_0x5c883;_0x6b59a0[_0x21f5('0x46')]=_['keys'](db[_0x21f5('0x81')][_0x21f5('0x3f')]);_0x6b59a0[_0x21f5('0x42')]=_['keys'](_0xdd6bda[_0x21f5('0x42')]);_0x6b59a0[_0x21f5('0x43')]=_[_0x21f5('0x44')](_0x6b59a0[_0x21f5('0x46')],_0x6b59a0[_0x21f5('0x42')]);_0x5889b2[_0x21f5('0x45')]=_[_0x21f5('0x44')](_0x6b59a0['model'],qs['fields'](_0xdd6bda[_0x21f5('0x42')][_0x21f5('0x47')]));_0x5889b2['attributes']=_0x5889b2['attributes'][_0x21f5('0x48')]?_0x5889b2['attributes']:_0x6b59a0['model'];_0x5889b2['order']=qs[_0x21f5('0x4c')](_0xdd6bda['query'][_0x21f5('0x4c')]);_0x5889b2[_0x21f5('0x4d')]=qs[_0x21f5('0x43')](_[_0x21f5('0x4e')](_0xdd6bda[_0x21f5('0x42')],_0x6b59a0[_0x21f5('0x43')]));if(_0xdd6bda['query'][_0x21f5('0x51')]){_0x5889b2[_0x21f5('0x4d')]=_['merge'](_0x5889b2['where'],{'$or':_[_0x21f5('0x69')](_0x5889b2[_0x21f5('0x45')],function(_0x21706f){var _0x46b4d8={};_0x46b4d8[_0x21706f]={'$like':'%'+_0xdd6bda[_0x21f5('0x42')][_0x21f5('0x51')]+'%'};return _0x46b4d8;})});}_0x5889b2=_[_0x21f5('0x4f')]({},_0x5889b2,_0xdd6bda[_0x21f5('0x52')]);return _0x38d74e[_0x21f5('0xa4')](_0x5889b2);}})['then'](function(_0x3841b4){if(_0x3841b4){_0x4b9617=_0x3841b4[_0x21f5('0x48')];if(!_0xdd6bda[_0x21f5('0x42')]['hasOwnProperty'](_0x21f5('0x4a'))){_0x5889b2[_0x21f5('0x30')]=qs[_0x21f5('0x30')](_0xdd6bda[_0x21f5('0x42')]['limit']);_0x5889b2[_0x21f5('0x2f')]=qs[_0x21f5('0x2f')](_0xdd6bda[_0x21f5('0x42')]['offset']);}return _0x38d74e['getApplications'](_0x5889b2);}})[_0x21f5('0x20')](function(_0x58f220){if(_0x58f220){return _0x58f220?{'count':_0x4b9617,'rows':_0x58f220}:null;}})[_0x21f5('0x20')](respondWithResult(_0x481330,null))[_0x21f5('0x2b')](handleError(_0x481330,null));};exports['getInteractions']=function(_0x5b97df,_0x172aa0,_0x4352b5){var _0x3ca4ac={'raw':![],'where':{}};var _0x539d68={};var _0x546c63={'count':0x0,'rows':[]};return db[_0x21f5('0x3e')][_0x21f5('0x67')]({'where':{'id':_0x5b97df[_0x21f5('0x58')]['id']}})[_0x21f5('0x20')](handleEntityNotFound(_0x172aa0,null))[_0x21f5('0x20')](function(_0x100519){if(_0x100519){_0x539d68[_0x21f5('0x46')]=_[_0x21f5('0x59')](db[_0x21f5('0x8c')][_0x21f5('0x3f')]);_0x539d68[_0x21f5('0x42')]=_['keys'](_0x5b97df[_0x21f5('0x42')]);_0x539d68[_0x21f5('0x43')]=_[_0x21f5('0x44')](_0x539d68[_0x21f5('0x46')],_0x539d68[_0x21f5('0x42')]);_0x3ca4ac[_0x21f5('0x45')]=_[_0x21f5('0x44')](_0x539d68['model'],qs[_0x21f5('0x47')](_0x5b97df[_0x21f5('0x42')][_0x21f5('0x47')]));_0x3ca4ac['attributes']=_0x3ca4ac[_0x21f5('0x45')][_0x21f5('0x48')]?_0x3ca4ac['attributes']:_0x539d68[_0x21f5('0x46')];if(!_0x5b97df[_0x21f5('0x42')][_0x21f5('0x49')]('nolimit')){_0x3ca4ac[_0x21f5('0x30')]=qs[_0x21f5('0x30')](_0x5b97df[_0x21f5('0x42')]['limit']);_0x3ca4ac[_0x21f5('0x2f')]=qs[_0x21f5('0x2f')](_0x5b97df['query'][_0x21f5('0x2f')]);}_0x3ca4ac[_0x21f5('0x4b')]=qs[_0x21f5('0x4c')](_0x5b97df['query'][_0x21f5('0x4c')]);_0x3ca4ac[_0x21f5('0x4d')]=qs[_0x21f5('0x43')](_[_0x21f5('0x4e')](_0x5b97df[_0x21f5('0x42')],_0x539d68[_0x21f5('0x43')]));_0x3ca4ac['where'][_0x21f5('0x65')]=_0x100519['id'];if(_0x5b97df[_0x21f5('0x42')][_0x21f5('0x51')]){_0x3ca4ac[_0x21f5('0x4d')]=_[_0x21f5('0x4f')](_0x3ca4ac[_0x21f5('0x4d')],{'$or':_[_0x21f5('0x69')](_0x3ca4ac[_0x21f5('0x45')],function(_0x1fa106){var _0x54fbe7={};_0x54fbe7[_0x1fa106]={'$like':'%'+_0x5b97df[_0x21f5('0x42')][_0x21f5('0x51')]+'%'};return _0x54fbe7;})});}_0x3ca4ac=_[_0x21f5('0x4f')]({},_0x3ca4ac,_0x5b97df[_0x21f5('0x52')]);return db['OpenchannelInteraction'][_0x21f5('0x2e')]({'where':_0x3ca4ac[_0x21f5('0x4d')]})[_0x21f5('0x20')](function(_0x1c670d){_0x546c63[_0x21f5('0x2e')]=_0x1c670d;if(_0x5b97df[_0x21f5('0x42')][_0x21f5('0x53')]){_0x3ca4ac[_0x21f5('0x54')]=[{'model':db['CmContact'],'as':_0x21f5('0xa5'),'required':![]},{'model':db[_0x21f5('0x99')],'as':_0x21f5('0xa6'),'attributes':['name',_0x21f5('0xa7'),_0x21f5('0xa8')],'required':![]},{'model':db[_0x21f5('0xa9')],'as':'Tags','attributes':['id','name',_0x21f5('0xaa')],'where':_0x5b97df[_0x21f5('0x42')][_0x21f5('0xab')]?{'id':_0x5b97df['query'][_0x21f5('0xab')]}:undefined,'required':_0x5b97df[_0x21f5('0x42')][_0x21f5('0xab')]?!![]:![]}];}return db[_0x21f5('0x8c')]['findAll'](_0x3ca4ac);})[_0x21f5('0x20')](function(_0x2949dc){_0x546c63[_0x21f5('0x56')]=_0x2949dc;return _0x546c63;});}})['then'](respondWithFilteredResult(_0x172aa0,_0x3ca4ac))[_0x21f5('0x2b')](handleError(_0x172aa0,null));};exports[_0x21f5('0xac')]=function(_0x531599,_0x2badf6,_0x4219cd){return db[_0x21f5('0x3e')]['find']({'where':{'id':_0x531599[_0x21f5('0x58')]['id']}})['then'](handleEntityNotFound(_0x2badf6,null))[_0x21f5('0x20')](function(_0x32cb81){if(_0x32cb81){return _0x32cb81[_0x21f5('0xac')](_0x531599[_0x21f5('0x62')][_0x21f5('0x6b')],_[_0x21f5('0xad')](_0x531599['body'],[_0x21f5('0x6b'),'id'])||{})['spread'](function(_0x1cba49){for(var _0x101ae5=0x0;_0x101ae5<_0x531599[_0x21f5('0x62')]['ids'][_0x21f5('0x48')];_0x101ae5+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':_0x531599['body'][_0x21f5('0x6b')][_0x101ae5],'OpenchannelAccountId':_0x531599[_0x21f5('0x58')]['id']});}return _0x1cba49;});}})[_0x21f5('0x20')](respondWithResult(_0x2badf6,null))[_0x21f5('0x2b')](handleError(_0x2badf6,null));};exports['removeAgents']=function(_0x1fdd2b,_0x269fb1,_0x2903ef){return db[_0x21f5('0x3e')]['find']({'where':{'id':_0x1fdd2b['params']['id']}})[_0x21f5('0x20')](handleEntityNotFound(_0x269fb1,null))['then'](function(_0x4480f4){if(_0x4480f4){return _0x4480f4[_0x21f5('0xae')](_0x1fdd2b[_0x21f5('0x42')][_0x21f5('0x6b')])[_0x21f5('0x20')](function(){if(_[_0x21f5('0xaf')](_0x1fdd2b[_0x21f5('0x42')][_0x21f5('0x6b')])){for(var _0x35598c=0x0;_0x35598c<_0x1fdd2b[_0x21f5('0x42')][_0x21f5('0x6b')]['length'];_0x35598c+=0x1){socket[_0x21f5('0xb0')](_0x21f5('0xb1'),{'UserId':Number(_0x1fdd2b[_0x21f5('0x42')][_0x21f5('0x6b')][_0x35598c]),'OpenchannelAccountId':Number(_0x1fdd2b['params']['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x1fdd2b['query'][_0x21f5('0x6b')]),'OpenchannelAccountId':Number(_0x1fdd2b[_0x21f5('0x58')]['id'])});}});}})[_0x21f5('0x20')](respondWithStatusCode(_0x269fb1,null))[_0x21f5('0x2b')](handleError(_0x269fb1,null));};exports[_0x21f5('0xb2')]=function(_0x188304,_0x5697b5,_0x50c1c0){var _0x47847e={};var _0x1810b7={};var _0x5bbb75;var _0x485776;return db['OpenchannelAccount'][_0x21f5('0x67')]({'where':{'id':_0x188304[_0x21f5('0x58')]['id']}})['then'](handleEntityNotFound(_0x5697b5,null))[_0x21f5('0x20')](function(_0x30407c){if(_0x30407c){_0x5bbb75=_0x30407c;_0x1810b7['model']=_[_0x21f5('0x59')](db[_0x21f5('0x99')][_0x21f5('0x3f')]);_0x1810b7['query']=_[_0x21f5('0x59')](_0x188304[_0x21f5('0x42')]);_0x1810b7[_0x21f5('0x43')]=_['intersection'](_0x1810b7[_0x21f5('0x46')],_0x1810b7[_0x21f5('0x42')]);_0x47847e[_0x21f5('0x45')]=_[_0x21f5('0x44')](_0x1810b7[_0x21f5('0x46')],qs[_0x21f5('0x47')](_0x188304[_0x21f5('0x42')][_0x21f5('0x47')]));_0x47847e[_0x21f5('0x45')]=_0x47847e[_0x21f5('0x45')][_0x21f5('0x48')]?_0x47847e[_0x21f5('0x45')]:_0x1810b7['model'];_0x47847e[_0x21f5('0x4b')]=qs[_0x21f5('0x4c')](_0x188304[_0x21f5('0x42')][_0x21f5('0x4c')]);_0x47847e[_0x21f5('0x4d')]=qs['filters'](_['pick'](_0x188304[_0x21f5('0x42')],_0x1810b7[_0x21f5('0x43')]));if(_0x188304[_0x21f5('0x42')][_0x21f5('0x51')]){_0x47847e['where']=_['merge'](_0x47847e[_0x21f5('0x4d')],{'$or':_[_0x21f5('0x69')](_0x47847e['attributes'],function(_0x55409d){var _0x33a10f={};_0x33a10f[_0x55409d]={'$like':'%'+_0x188304[_0x21f5('0x42')][_0x21f5('0x51')]+'%'};return _0x33a10f;})});}_0x47847e=_[_0x21f5('0x4f')]({},_0x47847e,_0x188304[_0x21f5('0x52')]);return _0x5bbb75[_0x21f5('0xb2')](_0x47847e);}})['then'](function(_0x1b3420){if(_0x1b3420){_0x485776=_0x1b3420[_0x21f5('0x48')];if(!_0x188304[_0x21f5('0x42')][_0x21f5('0x49')](_0x21f5('0x4a'))){_0x47847e[_0x21f5('0x30')]=qs[_0x21f5('0x30')](_0x188304['query']['limit']);_0x47847e[_0x21f5('0x2f')]=qs[_0x21f5('0x2f')](_0x188304[_0x21f5('0x42')][_0x21f5('0x2f')]);}return _0x5bbb75[_0x21f5('0xb2')](_0x47847e);}})['then'](function(_0x3702b7){if(_0x3702b7){return _0x3702b7?{'count':_0x485776,'rows':_0x3702b7}:null;}})[_0x21f5('0x20')](respondWithResult(_0x5697b5,null))[_0x21f5('0x2b')](handleError(_0x5697b5,null));};exports[_0x21f5('0x3b')]=function(_0x1a57e6,_0x1bf7c6,_0x12fb76){var _0x292f7c,_0x4e23d9,_0x32e8d6;if(_[_0x21f5('0x7a')](_0x1a57e6[_0x21f5('0x62')][_0x21f5('0x62')])||_0x1a57e6[_0x21f5('0x62')][_0x21f5('0x62')]===''){throw new db[(_0x21f5('0x72'))][(_0x21f5('0x73'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x21f5('0x7a')](_0x1a57e6[_0x21f5('0x62')]['to'])){}_0x292f7c=_0x1a57e6[_0x21f5('0x62')]['to'];return db[_0x21f5('0x3e')]['findOne']({'where':{'id':_0x1a57e6[_0x21f5('0x58')]['id']}})[_0x21f5('0x20')](handleEntityNotFound(_0x1bf7c6,null))['then'](function(_0x4f40c5){if(_0x4f40c5){return db[_0x21f5('0x3e')][_0x21f5('0x5a')]({'where':{'id':_0x4f40c5['id']},'include':[{'model':db[_0x21f5('0xb3')],'as':_0x21f5('0x83'),'include':[{'model':db[_0x21f5('0x71')],'as':_0x21f5('0x80'),'where':{[_0x4f40c5[_0x21f5('0x7e')]]:_0x292f7c},'limit':0x1,'order':[[_0x21f5('0x76'),'DESC']]}]}]})[_0x21f5('0x20')](handleEntityNotFound(_0x1bf7c6,null))[_0x21f5('0x20')](function(_0x5a2d1e){if(_0x5a2d1e&&_0x5a2d1e[_0x21f5('0x83')]){_0x4e23d9=_0x5a2d1e[_0x21f5('0x37')]({'plain':!![]});if(_0x4e23d9[_0x21f5('0x83')]&&_0x4e23d9[_0x21f5('0x83')][_0x21f5('0x80')][_0x21f5('0x48')]){return _0x4e23d9['List'][_0x21f5('0x80')][0x0];}return db[_0x21f5('0x71')][_0x21f5('0x5b')](_[_0x21f5('0x1a')](_0x1a57e6['body'],{'firstName':_0x292f7c,[_0x5a2d1e[_0x21f5('0x7e')]]:_0x292f7c,'phone':_0x292f7c,'ListId':_0x4e23d9[_0x21f5('0x79')]}));}})['then'](handleEntityNotFound(_0x1bf7c6,null))['then'](function(_0x4ab02a){if(_0x4ab02a){_0x32e8d6=_0x4ab02a;return db[_0x21f5('0x8c')][_0x21f5('0x5a')]({'where':{'ContactId':_0x32e8d6['id'],'closed':![],'OpenchannelAccountId':_0x4e23d9['id']}})['then'](function(_0x6b30f8){if(_0x6b30f8){return[_0x6b30f8,![]];}return db[_0x21f5('0x8c')][_0x21f5('0x5b')]({'UserId':_0x1a57e6[_0x21f5('0x5c')]['id'],'ContactId':_0x32e8d6['id'],'OpenchannelAccountId':_0x4e23d9['id'],'lastMsgDirection':_0x21f5('0xb4'),'Messages':[_[_0x21f5('0x4f')](_0x1a57e6[_0x21f5('0x62')],{'read':![],'body':_0x1a57e6[_0x21f5('0x62')][_0x21f5('0x62')],'OpenchannelAccountId':_0x4e23d9['id'],'UserId':_0x1a57e6['user']['id'],'ContactId':_0x32e8d6['id']})]},{'include':[{'model':db[_0x21f5('0x96')],'as':_0x21f5('0xb5')}]})[_0x21f5('0x20')](function(_0x29c2c0){return[_0x29c2c0,!![]];});});}})[_0x21f5('0x8e')](function(_0x4307c6,_0x3e2570){if(_0x3e2570){return _0x4307c6;}return db[_0x21f5('0x96')][_0x21f5('0x5b')](_[_0x21f5('0x4f')](_0x1a57e6['body'],{'read':![],'body':_0x1a57e6[_0x21f5('0x62')][_0x21f5('0x62')],'OpenchannelAccountId':_0x4e23d9['id'],'OpenchannelInteractionId':_0x4307c6['id'],'UserId':_0x1a57e6['user']['id'],'ContactId':_0x32e8d6['id']}))[_0x21f5('0x20')](function(_0x1ff80f){_0x4307c6[_0x21f5('0xb6')][_0x21f5('0xb5')]=[];_0x4307c6['dataValues'][_0x21f5('0xb5')]['push'](_0x1ff80f[_0x21f5('0xb6')]);return _0x4307c6;});});}})[_0x21f5('0x20')](respondWithResult(_0x1bf7c6,null))['catch'](handleError(_0x1bf7c6,null));}; \ No newline at end of file +var _0x84bb=['request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','sendStatus','json','count','limit','set','Content-Range','reject','save','update','destroy','get','UserProfileResource','stack','name','status','index','mandatoryDispositionPause','map','type','key','model','keys','query','intersection','fields','attributes','length','nolimit','offset','order','where','filters','filter','merge','VIRTUAL','options','includeAll','OpenchannelAccount','findAll','rows','show','params','Pause','include','find','create','body','role','OpenchannelAccounts','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','rawAttributes','sort','pick','removeDispositions','getAnswers','CannedAnswer','hasOwnProperty','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','DESC','OpenchannelApplication','Applications','account','applications','priority','asc','Contacts','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','getApplications','Contact','Owner','fullname','internal','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','isArray','getAgents','send','defaults','user','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','http'];(function(_0xe1b102,_0x542a72){var _0xed6dcc=function(_0x3191a6){while(--_0x3191a6){_0xe1b102['push'](_0xe1b102['shift']());}};_0xed6dcc(++_0x542a72);}(_0x84bb,0x9b));var _0xb84b=function(_0x20f4af,_0x4163e6){_0x20f4af=_0x20f4af-0x0;var _0x20b7ed=_0x84bb[_0x20f4af];return _0x20b7ed;};'use strict';var pdf=require(_0xb84b('0x0'));var emlformat=require(_0xb84b('0x1'));var rimraf=require(_0xb84b('0x2'));var zipdir=require(_0xb84b('0x3'));var jsonpatch=require(_0xb84b('0x4'));var rp=require(_0xb84b('0x5'));var moment=require('moment');var BPromise=require(_0xb84b('0x6'));var Mustache=require(_0xb84b('0x7'));var util=require(_0xb84b('0x8'));var path=require(_0xb84b('0x9'));var sox=require(_0xb84b('0xa'));var csv=require(_0xb84b('0xb'));var ejs=require(_0xb84b('0xc'));var fs=require('fs');var _=require(_0xb84b('0xd'));var squel=require(_0xb84b('0xe'));var crypto=require(_0xb84b('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xb84b('0x10'));var toCsv=require(_0xb84b('0xb'));var querystring=require(_0xb84b('0x11'));var Papa=require(_0xb84b('0x12'));var Redis=require(_0xb84b('0x13'));var authService=require(_0xb84b('0x14'));var qs=require(_0xb84b('0x15'));var as=require(_0xb84b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb84b('0x17'));var config=require(_0xb84b('0x18'));var licenseUtil=require(_0xb84b('0x19'));var db=require(_0xb84b('0x1a'))['db'];config[_0xb84b('0x1b')]=_['defaults'](config[_0xb84b('0x1b')],{'host':_0xb84b('0x1c'),'port':0x18eb});var socket=require(_0xb84b('0x1d'))(new Redis(config[_0xb84b('0x1b')]));require(_0xb84b('0x1e'))['register'](socket);var jayson=require(_0xb84b('0x1f'));var client=jayson['client'][_0xb84b('0x20')]({'port':0x232c});var client9002=jayson['client'][_0xb84b('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x3729e2,_0x32ef65,_0x13cd94,_0x332c6f){return new BPromise(function(_0x527946,_0x383119){var _0x3045c3=_0x332c6f||client;return _0x3045c3[_0xb84b('0x21')](_0x3729e2,_0x13cd94)[_0xb84b('0x22')](function(_0xfb356b){logger[_0xb84b('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x32ef65,_0xb84b('0x24'));logger[_0xb84b('0x25')](_0xb84b('0x26'),_0x32ef65,_0xb84b('0x24'),JSON[_0xb84b('0x27')](_0xfb356b));if(_0xfb356b[_0xb84b('0x28')]){if(_0xfb356b[_0xb84b('0x28')][_0xb84b('0x29')]===0x1f4){logger[_0xb84b('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x32ef65,_0xfb356b['error'][_0xb84b('0x2a')]);return _0x383119(_0xfb356b[_0xb84b('0x28')][_0xb84b('0x2a')]);}logger[_0xb84b('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x32ef65,_0xfb356b['error'][_0xb84b('0x2a')]);return _0x527946(_0xfb356b[_0xb84b('0x28')][_0xb84b('0x2a')]);}else{logger[_0xb84b('0x23')](_0xb84b('0x2b'),_0x32ef65,_0xb84b('0x24'));_0x527946(_0xfb356b[_0xb84b('0x2c')][_0xb84b('0x2a')]);}})[_0xb84b('0x2d')](function(_0xd98c7c){logger[_0xb84b('0x28')](_0xb84b('0x2b'),_0x32ef65,_0xd98c7c);_0x383119(_0xd98c7c);});});}function respondWithStatusCode(_0x459e12,_0x6148c4){_0x6148c4=_0x6148c4||0xcc;return function(_0x36d05f){if(_0x36d05f){return _0x459e12[_0xb84b('0x2e')](_0x6148c4);}return _0x459e12['status'](_0x6148c4)['end']();};}function respondWithResult(_0x185fd1,_0x4b51c2){_0x4b51c2=_0x4b51c2||0xc8;return function(_0x5493a8){if(_0x5493a8){return _0x185fd1['status'](_0x4b51c2)[_0xb84b('0x2f')](_0x5493a8);}};}function respondWithFilteredResult(_0x1b68df,_0x5b6795){return function(_0x5b8619){if(_0x5b8619){var _0x1a68d4=_0x5b8619[_0xb84b('0x30')],_0x382792=_0x5b6795['offset'],_0x286d21=_0x5b6795['offset']+_0x5b6795[_0xb84b('0x31')],_0x2a0372;if(_0x286d21>=_0x1a68d4){_0x286d21=_0x1a68d4;_0x2a0372=0xc8;}else{_0x2a0372=0xce;}_0x1b68df['status'](_0x2a0372);return _0x1b68df[_0xb84b('0x32')](_0xb84b('0x33'),_0x382792+'-'+_0x286d21+'/'+_0x1a68d4)[_0xb84b('0x2f')](_0x5b8619);}return null;};}function patchUpdates(_0x3edef1){return function(_0x9a77f2){try{jsonpatch['apply'](_0x9a77f2,_0x3edef1,!![]);}catch(_0x48a980){return BPromise[_0xb84b('0x34')](_0x48a980);}return _0x9a77f2[_0xb84b('0x35')]();};}function saveUpdates(_0x5b03d3,_0x26196f){return function(_0x458dff){if(_0x458dff){return _0x458dff[_0xb84b('0x36')](_0x5b03d3)[_0xb84b('0x22')](function(_0x490315){return _0x490315;});}return null;};}function removeEntity(_0x3628f3,_0x3b8895){return function(_0x16bfe6){if(_0x16bfe6){return _0x16bfe6[_0xb84b('0x37')]()['then'](function(){var _0x531d8c=_0x16bfe6[_0xb84b('0x38')]({'plain':!![]});var _0xa1d89b='OpenchannelAccounts';return db[_0xb84b('0x39')][_0xb84b('0x37')]({'where':{'type':_0xa1d89b,'resourceId':_0x531d8c['id']}})[_0xb84b('0x22')](function(){return _0x16bfe6;});})[_0xb84b('0x22')](function(){_0x3628f3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xcf08eb,_0x33c80c){return function(_0x490a38){if(!_0x490a38){_0xcf08eb[_0xb84b('0x2e')](0x194);}return _0x490a38;};}function handleError(_0x2a59fd,_0x470fe4){_0x470fe4=_0x470fe4||0x1f4;return function(_0x1d0696){logger[_0xb84b('0x28')](_0x1d0696[_0xb84b('0x3a')]);if(_0x1d0696['name']){delete _0x1d0696[_0xb84b('0x3b')];}_0x2a59fd[_0xb84b('0x3c')](_0x470fe4)['send'](_0x1d0696);};}exports[_0xb84b('0x3d')]=function(_0x28cc31,_0x1e4325){var _0x5bf924={'include':[{'model':db['Pause'],'as':_0xb84b('0x3e')}]},_0x4a89c8={},_0xcfa37f={'count':0x0,'rows':[]};var _0x1eccec=_[_0xb84b('0x3f')](db['OpenchannelAccount']['rawAttributes'],function(_0x540eec){return{'name':_0x540eec['fieldName'],'type':_0x540eec[_0xb84b('0x40')][_0xb84b('0x41')]};});_0x4a89c8[_0xb84b('0x42')]=_['map'](_0x1eccec,_0xb84b('0x3b'));_0x4a89c8['query']=_[_0xb84b('0x43')](_0x28cc31[_0xb84b('0x44')]);_0x4a89c8['filters']=_['intersection'](_0x4a89c8[_0xb84b('0x42')],_0x4a89c8[_0xb84b('0x44')]);_0x5bf924['attributes']=_[_0xb84b('0x45')](_0x4a89c8[_0xb84b('0x42')],qs[_0xb84b('0x46')](_0x28cc31[_0xb84b('0x44')][_0xb84b('0x46')]));_0x5bf924[_0xb84b('0x47')]=_0x5bf924[_0xb84b('0x47')][_0xb84b('0x48')]?_0x5bf924[_0xb84b('0x47')]:_0x4a89c8[_0xb84b('0x42')];if(!_0x28cc31[_0xb84b('0x44')]['hasOwnProperty'](_0xb84b('0x49'))){_0x5bf924['limit']=qs[_0xb84b('0x31')](_0x28cc31[_0xb84b('0x44')]['limit']);_0x5bf924['offset']=qs[_0xb84b('0x4a')](_0x28cc31[_0xb84b('0x44')][_0xb84b('0x4a')]);}_0x5bf924[_0xb84b('0x4b')]=qs['sort'](_0x28cc31[_0xb84b('0x44')]['sort']);_0x5bf924[_0xb84b('0x4c')]=qs['filters'](_['pick'](_0x28cc31[_0xb84b('0x44')],_0x4a89c8[_0xb84b('0x4d')]),_0x1eccec);if(_0x28cc31[_0xb84b('0x44')][_0xb84b('0x4e')]){_0x5bf924['where']=_[_0xb84b('0x4f')](_0x5bf924[_0xb84b('0x4c')],{'$or':_['map'](_0x1eccec,function(_0x1706c8){if(_0x1706c8[_0xb84b('0x40')]!==_0xb84b('0x50')){var _0x50f960={};_0x50f960[_0x1706c8[_0xb84b('0x3b')]]={'$like':'%'+_0x28cc31[_0xb84b('0x44')][_0xb84b('0x4e')]+'%'};return _0x50f960;}})});}_0x5bf924=_[_0xb84b('0x4f')]({},_0x5bf924,_0x28cc31[_0xb84b('0x51')]);var _0x2ea4d1={'where':_0x5bf924[_0xb84b('0x4c')]};return db['OpenchannelAccount'][_0xb84b('0x30')](_0x2ea4d1)[_0xb84b('0x22')](function(_0x53e0e8){_0xcfa37f[_0xb84b('0x30')]=_0x53e0e8;if(_0x28cc31['query'][_0xb84b('0x52')]){_0x5bf924['include']=[{'all':!![]}];}return db[_0xb84b('0x53')][_0xb84b('0x54')](_0x5bf924);})[_0xb84b('0x22')](function(_0x2878c4){_0xcfa37f[_0xb84b('0x55')]=_0x2878c4;return _0xcfa37f;})[_0xb84b('0x22')](respondWithFilteredResult(_0x1e4325,_0x5bf924))[_0xb84b('0x2d')](handleError(_0x1e4325,null));};exports[_0xb84b('0x56')]=function(_0x4b81ec,_0x12391f){var _0x2d17bf={'raw':![],'where':{'id':_0x4b81ec[_0xb84b('0x57')]['id']},'include':[{'model':db[_0xb84b('0x58')],'as':'mandatoryDispositionPause'}]},_0x3a8f57={};_0x3a8f57['model']=_['keys'](db[_0xb84b('0x53')]['rawAttributes']);_0x3a8f57[_0xb84b('0x44')]=_[_0xb84b('0x43')](_0x4b81ec[_0xb84b('0x44')]);_0x3a8f57['filters']=_[_0xb84b('0x45')](_0x3a8f57[_0xb84b('0x42')],_0x3a8f57[_0xb84b('0x44')]);_0x2d17bf[_0xb84b('0x47')]=_[_0xb84b('0x45')](_0x3a8f57['model'],qs[_0xb84b('0x46')](_0x4b81ec[_0xb84b('0x44')][_0xb84b('0x46')]));_0x2d17bf['attributes']=_0x2d17bf['attributes'][_0xb84b('0x48')]?_0x2d17bf[_0xb84b('0x47')]:_0x3a8f57[_0xb84b('0x42')];if(_0x4b81ec[_0xb84b('0x44')]['includeAll']){_0x2d17bf[_0xb84b('0x59')]=[{'all':!![]}];}_0x2d17bf=_[_0xb84b('0x4f')]({},_0x2d17bf,_0x4b81ec[_0xb84b('0x51')]);return db[_0xb84b('0x53')][_0xb84b('0x5a')](_0x2d17bf)[_0xb84b('0x22')](handleEntityNotFound(_0x12391f,null))[_0xb84b('0x22')](respondWithResult(_0x12391f,null))[_0xb84b('0x2d')](handleError(_0x12391f,null));};exports[_0xb84b('0x5b')]=function(_0xd248b8,_0x47defa){return db[_0xb84b('0x53')][_0xb84b('0x5b')](_0xd248b8[_0xb84b('0x5c')],{})[_0xb84b('0x22')](function(_0x4d1535){var _0x6e287a=_0xd248b8['user'][_0xb84b('0x38')]({'plain':!![]});if(!_0x6e287a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6e287a[_0xb84b('0x5d')]==='user'){var _0x76b790=_0x4d1535[_0xb84b('0x38')]({'plain':!![]});var _0x510182=_0xb84b('0x5e');return db[_0xb84b('0x5f')][_0xb84b('0x5a')]({'where':{'name':_0x510182,'userProfileId':_0x6e287a['userProfileId']},'raw':!![]})['then'](function(_0x2a95ac){if(_0x2a95ac&&_0x2a95ac['autoAssociation']===0x0){return db[_0xb84b('0x39')]['create']({'name':_0x76b790[_0xb84b('0x3b')],'resourceId':_0x76b790['id'],'type':_0x2a95ac[_0xb84b('0x3b')],'sectionId':_0x2a95ac['id']},{})['then'](function(){return _0x4d1535;});}else{return _0x4d1535;}})['catch'](function(_0x528c9f){logger['error'](_0xb84b('0x60'),_0x528c9f);throw _0x528c9f;});}return _0x4d1535;})[_0xb84b('0x22')](respondWithResult(_0x47defa,0xc9))['catch'](handleError(_0x47defa,null));};exports[_0xb84b('0x36')]=function(_0x30884e,_0x71d2d5){if(_0x30884e[_0xb84b('0x5c')]['id']){delete _0x30884e['body']['id'];}return db[_0xb84b('0x53')]['find']({'where':{'id':_0x30884e[_0xb84b('0x57')]['id']},'include':[{'model':db[_0xb84b('0x58')],'as':_0xb84b('0x3e')}]})[_0xb84b('0x22')](handleEntityNotFound(_0x71d2d5,null))['then'](saveUpdates(_0x30884e[_0xb84b('0x5c')],null))[_0xb84b('0x22')](respondWithResult(_0x71d2d5,null))[_0xb84b('0x2d')](handleError(_0x71d2d5,null));};exports['destroy']=function(_0x315b11,_0x174d4f){return db['OpenchannelAccount'][_0xb84b('0x5a')]({'where':{'id':_0x315b11[_0xb84b('0x57')]['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0x174d4f,null))['then'](removeEntity(_0x174d4f,null))[_0xb84b('0x2d')](handleError(_0x174d4f,null));};exports[_0xb84b('0x61')]=function(_0x535fee,_0x5261c9){return db[_0xb84b('0x53')][_0xb84b('0x61')]()[_0xb84b('0x22')](respondWithResult(_0x5261c9,null))[_0xb84b('0x2d')](handleError(_0x5261c9,null));};exports['addDisposition']=function(_0x2e05ff,_0x44c56e,_0x577d4d){if(_0x2e05ff['body']['id']){delete _0x2e05ff[_0xb84b('0x5c')]['id'];}return db[_0xb84b('0x53')]['find']({'where':{'id':_0x2e05ff[_0xb84b('0x57')]['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0x44c56e,null))[_0xb84b('0x22')](function(_0x40d4df){if(_0x40d4df){_0x2e05ff[_0xb84b('0x5c')][_0xb84b('0x62')]=_0x40d4df['id'];return db[_0xb84b('0x63')][_0xb84b('0x5b')](_0x2e05ff[_0xb84b('0x5c')]);}})[_0xb84b('0x22')](respondWithResult(_0x44c56e,null))[_0xb84b('0x2d')](handleError(_0x44c56e,null));};exports[_0xb84b('0x64')]=function(_0x49244f,_0x56ebe9,_0x3259fb){var _0x440bba={'raw':![],'where':{}};var _0x103e2b={};var _0x45fb6f={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xb84b('0x65')]({'where':{'id':_0x49244f[_0xb84b('0x57')]['id']}})['then'](handleEntityNotFound(_0x56ebe9,null))[_0xb84b('0x22')](function(_0x2c4920){if(_0x2c4920){_0x103e2b[_0xb84b('0x42')]=_[_0xb84b('0x43')](db[_0xb84b('0x63')][_0xb84b('0x66')]);_0x103e2b[_0xb84b('0x44')]=_['keys'](_0x49244f[_0xb84b('0x44')]);_0x103e2b[_0xb84b('0x4d')]=_[_0xb84b('0x45')](_0x103e2b[_0xb84b('0x42')],_0x103e2b[_0xb84b('0x44')]);_0x440bba[_0xb84b('0x47')]=_['intersection'](_0x103e2b[_0xb84b('0x42')],qs[_0xb84b('0x46')](_0x49244f['query'][_0xb84b('0x46')]));_0x440bba[_0xb84b('0x47')]=_0x440bba[_0xb84b('0x47')][_0xb84b('0x48')]?_0x440bba[_0xb84b('0x47')]:_0x103e2b[_0xb84b('0x42')];if(!_0x49244f[_0xb84b('0x44')]['hasOwnProperty']('nolimit')){_0x440bba['limit']=qs[_0xb84b('0x31')](_0x49244f[_0xb84b('0x44')][_0xb84b('0x31')]);_0x440bba[_0xb84b('0x4a')]=qs[_0xb84b('0x4a')](_0x49244f[_0xb84b('0x44')]['offset']);}_0x440bba[_0xb84b('0x4b')]=qs['sort'](_0x49244f['query'][_0xb84b('0x67')]);_0x440bba[_0xb84b('0x4c')]=qs['filters'](_[_0xb84b('0x68')](_0x49244f[_0xb84b('0x44')],_0x103e2b['filters']));_0x440bba[_0xb84b('0x4c')]['OpenchannelAccountId']=_0x2c4920['id'];if(_0x49244f['query'][_0xb84b('0x4e')]){_0x440bba[_0xb84b('0x4c')]=_['merge'](_0x440bba[_0xb84b('0x4c')],{'$or':_[_0xb84b('0x3f')](_0x440bba['attributes'],function(_0x17dc0e){var _0x419c0f={};_0x419c0f[_0x17dc0e]={'$like':'%'+_0x49244f[_0xb84b('0x44')]['filter']+'%'};return _0x419c0f;})});}_0x440bba=_['merge']({},_0x440bba,_0x49244f[_0xb84b('0x51')]);return db[_0xb84b('0x63')][_0xb84b('0x30')]({'where':_0x440bba[_0xb84b('0x4c')]})[_0xb84b('0x22')](function(_0x43ca13){_0x45fb6f[_0xb84b('0x30')]=_0x43ca13;if(_0x49244f[_0xb84b('0x44')][_0xb84b('0x52')]){_0x440bba[_0xb84b('0x59')]=[{'all':!![]}];}return db['Disposition'][_0xb84b('0x54')](_0x440bba);})[_0xb84b('0x22')](function(_0x41aae3){_0x45fb6f[_0xb84b('0x55')]=_0x41aae3;return _0x45fb6f;});}})[_0xb84b('0x22')](respondWithFilteredResult(_0x56ebe9,_0x440bba))[_0xb84b('0x2d')](handleError(_0x56ebe9,null));};exports[_0xb84b('0x69')]=function(_0x575c95,_0x3b5a20,_0x30e9b9){return db[_0xb84b('0x53')][_0xb84b('0x5a')]({'where':{'id':_0x575c95[_0xb84b('0x57')]['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0x3b5a20,null))[_0xb84b('0x22')](function(_0x36cf6b){if(_0x36cf6b){return _0x36cf6b[_0xb84b('0x69')](_0x575c95[_0xb84b('0x44')]['ids']);}})[_0xb84b('0x22')](respondWithStatusCode(_0x3b5a20,null))[_0xb84b('0x2d')](handleError(_0x3b5a20,null));};exports['addAnswer']=function(_0x37e064,_0xe38444,_0x1618d2){if(_0x37e064[_0xb84b('0x5c')]['id']){delete _0x37e064['body']['id'];}return db['OpenchannelAccount'][_0xb84b('0x5a')]({'where':{'id':_0x37e064[_0xb84b('0x57')]['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0xe38444,null))[_0xb84b('0x22')](function(_0x40d982){if(_0x40d982){_0x37e064[_0xb84b('0x5c')][_0xb84b('0x62')]=_0x40d982['id'];return db['CannedAnswer'][_0xb84b('0x5b')](_0x37e064[_0xb84b('0x5c')]);}})[_0xb84b('0x22')](respondWithResult(_0xe38444,null))[_0xb84b('0x2d')](handleError(_0xe38444,null));};exports[_0xb84b('0x6a')]=function(_0x26641c,_0x3ce2da,_0x375272){var _0x1a37df={'raw':![],'where':{}};var _0x25c9ce={};var _0x21987b={'count':0x0,'rows':[]};return db[_0xb84b('0x53')][_0xb84b('0x65')]({'where':{'id':_0x26641c['params']['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0x3ce2da,null))[_0xb84b('0x22')](function(_0x3cdd31){if(_0x3cdd31){_0x25c9ce[_0xb84b('0x42')]=_[_0xb84b('0x43')](db[_0xb84b('0x6b')][_0xb84b('0x66')]);_0x25c9ce[_0xb84b('0x44')]=_['keys'](_0x26641c['query']);_0x25c9ce[_0xb84b('0x4d')]=_[_0xb84b('0x45')](_0x25c9ce[_0xb84b('0x42')],_0x25c9ce[_0xb84b('0x44')]);_0x1a37df[_0xb84b('0x47')]=_[_0xb84b('0x45')](_0x25c9ce[_0xb84b('0x42')],qs['fields'](_0x26641c['query'][_0xb84b('0x46')]));_0x1a37df['attributes']=_0x1a37df[_0xb84b('0x47')][_0xb84b('0x48')]?_0x1a37df[_0xb84b('0x47')]:_0x25c9ce['model'];if(!_0x26641c[_0xb84b('0x44')][_0xb84b('0x6c')](_0xb84b('0x49'))){_0x1a37df[_0xb84b('0x31')]=qs['limit'](_0x26641c['query'][_0xb84b('0x31')]);_0x1a37df['offset']=qs[_0xb84b('0x4a')](_0x26641c['query'][_0xb84b('0x4a')]);}_0x1a37df[_0xb84b('0x4b')]=qs[_0xb84b('0x67')](_0x26641c[_0xb84b('0x44')]['sort']);_0x1a37df[_0xb84b('0x4c')]=qs[_0xb84b('0x4d')](_[_0xb84b('0x68')](_0x26641c[_0xb84b('0x44')],_0x25c9ce[_0xb84b('0x4d')]));_0x1a37df[_0xb84b('0x4c')][_0xb84b('0x62')]=_0x3cdd31['id'];if(_0x26641c[_0xb84b('0x44')][_0xb84b('0x4e')]){_0x1a37df[_0xb84b('0x4c')]=_[_0xb84b('0x4f')](_0x1a37df[_0xb84b('0x4c')],{'$or':_[_0xb84b('0x3f')](_0x1a37df[_0xb84b('0x47')],function(_0x12e94f){var _0x1d8a9a={};_0x1d8a9a[_0x12e94f]={'$like':'%'+_0x26641c[_0xb84b('0x44')][_0xb84b('0x4e')]+'%'};return _0x1d8a9a;})});}_0x1a37df=_[_0xb84b('0x4f')]({},_0x1a37df,_0x26641c[_0xb84b('0x51')]);return db[_0xb84b('0x6b')][_0xb84b('0x30')]({'where':_0x1a37df['where']})[_0xb84b('0x22')](function(_0x4ad17a){_0x21987b['count']=_0x4ad17a;if(_0x26641c[_0xb84b('0x44')]['includeAll']){_0x1a37df[_0xb84b('0x59')]=[{'all':!![]}];}return db[_0xb84b('0x6b')][_0xb84b('0x54')](_0x1a37df);})[_0xb84b('0x22')](function(_0x30fbd6){_0x21987b[_0xb84b('0x55')]=_0x30fbd6;return _0x21987b;});}})[_0xb84b('0x22')](respondWithFilteredResult(_0x3ce2da,_0x1a37df))[_0xb84b('0x2d')](handleError(_0x3ce2da,null));};exports[_0xb84b('0x6d')]=function(_0x43fd02,_0x7b4ad8,_0x40db7f){return db['OpenchannelAccount'][_0xb84b('0x5a')]({'where':{'id':_0x43fd02['params']['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0x7b4ad8,null))[_0xb84b('0x22')](function(_0x5441f8){if(_0x5441f8){return _0x5441f8['removeAnswers'](_0x43fd02['query'][_0xb84b('0x6e')]);}})['then'](respondWithStatusCode(_0x7b4ad8,null))[_0xb84b('0x2d')](handleError(_0x7b4ad8,null));};exports[_0xb84b('0x6f')]=function(_0x1fc12f,_0x2d7a56,_0x3aef96){var _0x175dc6={'body':_0x1fc12f[_0xb84b('0x5c')],'channel':_0xb84b('0x70')};var _0x5238c2=[];var _0x90fb08=[];var _0xcf038e={};var _0x55927c=![];return db[_0xb84b('0x71')][_0xb84b('0x61')]()['then'](function(_0x221ad4){if(!_0x221ad4){throw new db[(_0xb84b('0x72'))][(_0xb84b('0x73'))](_0xb84b('0x74'));}_0x5238c2=_[_0xb84b('0x75')](_[_0xb84b('0x43')](_0x221ad4),['createdAt',_0xb84b('0x76')]);_0x90fb08=_[_0xb84b('0x75')](_[_0xb84b('0x43')](_0x221ad4),[_0xb84b('0x77'),_0xb84b('0x76'),_0xb84b('0x78'),_0xb84b('0x79')]);if(_0x1fc12f[_0xb84b('0x5c')]['id']){delete _0x1fc12f[_0xb84b('0x5c')]['id'];}if(_['isNil'](_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x7a')])){throw new db[(_0xb84b('0x72'))]['ValidationError'](_0xb84b('0x7b'));}if(_[_0xb84b('0x7c')](_0x1fc12f['body'][_0xb84b('0x5c')])||_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x5c')]===''){throw new db[(_0xb84b('0x72'))][(_0xb84b('0x73'))](_0xb84b('0x7d'));}if(_[_0xb84b('0x7c')](_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x7e')])){throw new db[(_0xb84b('0x72'))]['ValidationError'](_0xb84b('0x7f')+_0x90fb08);}if(!_[_0xb84b('0x80')](_0x90fb08,_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x7e')])){throw new db[(_0xb84b('0x72'))][(_0xb84b('0x73'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x90fb08);}_0xcf038e[_0x1fc12f[_0xb84b('0x5c')]['mapKey']]=_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x7a')];})[_0xb84b('0x22')](function(){return db['OpenchannelAccount'][_0xb84b('0x5a')]({'where':{'id':_0x1fc12f['params']['id']},'include':[{'model':db[_0xb84b('0x81')],'as':_0xb84b('0x82'),'include':[{'model':db[_0xb84b('0x71')],'as':'Contacts','where':_0xcf038e,'limit':0x1,'order':[[_0xb84b('0x76'),_0xb84b('0x83')]]}]},{'model':db[_0xb84b('0x84')],'as':_0xb84b('0x85')}]});})[_0xb84b('0x22')](handleEntityNotFound(_0x2d7a56,null))['then'](function(_0x15ae32){if(_0x15ae32&&_0x15ae32[_0xb84b('0x82')]){_0x175dc6[_0xb84b('0x86')]=_0x15ae32;_0x175dc6[_0xb84b('0x87')]=_0x15ae32['Applications'];_0x175dc6['list']=_0x15ae32[_0xb84b('0x82')];_0x175dc6[_0xb84b('0x87')]=_['orderBy'](_0x175dc6[_0xb84b('0x87')],[_0xb84b('0x88')],[_0xb84b('0x89')]);if(_0x175dc6[_0xb84b('0x86')][_0xb84b('0x85')]){delete _0x175dc6['account'][_0xb84b('0x85')];}if(_0x175dc6['account'][_0xb84b('0x82')]&&_0x175dc6['account'][_0xb84b('0x82')][_0xb84b('0x8a')][_0xb84b('0x48')]){return _0x175dc6[_0xb84b('0x86')][_0xb84b('0x82')][_0xb84b('0x8a')][0x0];}var _0x3b80bb=_['defaults'](_0x1fc12f[_0xb84b('0x5c')],{'firstName':_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x7a')],'ListId':_0x15ae32[_0xb84b('0x79')]});_0x3b80bb[_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x7e')]]=_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x7a')];return db[_0xb84b('0x71')][_0xb84b('0x5b')](_0x3b80bb,{'fields':_0x5238c2,'raw':!![]});}})[_0xb84b('0x22')](handleEntityNotFound(_0x2d7a56,null))[_0xb84b('0x22')](function(_0x22bf47){_0x175dc6[_0xb84b('0x8b')]=_0x22bf47;if(_0x22bf47){var _0x3df504={'ContactId':_0x22bf47['id'],'OpenchannelAccountId':_0x1fc12f[_0xb84b('0x57')]['id'],'from':(_0x22bf47['firstName']||'')+'\x20'+(_0x22bf47[_0xb84b('0x8c')]||'')};var _0x38c448={'OpenchannelAccountId':_0x1fc12f['params']['id'],'closed':![]};if(_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x8d')]){_0x38c448[_0xb84b('0x8d')]=_0x1fc12f['body'][_0xb84b('0x8d')];return db[_0xb84b('0x8e')][_0xb84b('0x5a')]({'where':_0x38c448})[_0xb84b('0x22')](function(_0x1362c8){if(_0x1362c8){return[_0x1362c8,![]];}_0x3df504[_0xb84b('0x8d')]=_0x1fc12f[_0xb84b('0x5c')]['threadId'];_0x3df504[_0xb84b('0x8f')]=_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x8f')];return db[_0xb84b('0x8e')]['create'](_0x3df504)[_0xb84b('0x22')](function(_0x1c269f){return[_0x1c269f,!![]];});});}else{_0x38c448['threadId']=null;}_0x38c448[_0xb84b('0x90')]=_0x22bf47['id'];return db['OpenchannelInteraction'][_0xb84b('0x5a')]({'where':_0x38c448})['then'](function(_0x306ed7){if(_0x306ed7){return[_0x306ed7,![]];}return db[_0xb84b('0x8e')][_0xb84b('0x5b')](_0x3df504)[_0xb84b('0x22')](function(_0x38e5d5){return[_0x38e5d5,!![]];});});}})[_0xb84b('0x91')](function(_0x3a6408,_0x3dcea7){if(_0x3a6408){_0x55927c=_0x3dcea7;if(!_0x3dcea7){var _0x15961c={'from':(_0x175dc6[_0xb84b('0x8b')][_0xb84b('0x92')]||'')+'\x20'+(_0x175dc6['contact'][_0xb84b('0x8c')]||'')};if(_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x8d')]&&_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x93')]&&_0x1fc12f[_0xb84b('0x5c')]['threadId']!=_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x93')]){_0x15961c[_0xb84b('0x8d')]=_0x1fc12f['body']['messageId'];}return _0x3a6408['update'](_0x15961c);}else{return _0x3a6408;}}})[_0xb84b('0x22')](function(_0x5c3da8){_0x175dc6[_0xb84b('0x94')]=_0x5c3da8[_0xb84b('0x38')]({'plain':!![]});_0x175dc6['interaction'][_0xb84b('0x95')]=_0x55927c;if(_0x175dc6[_0xb84b('0x94')][_0xb84b('0x95')]){if(_0x175dc6[_0xb84b('0x86')][_0xb84b('0x96')]){_0x175dc6[_0xb84b('0x87')][_0xb84b('0x97')]({'id':0x0,'priority':_0x175dc6[_0xb84b('0x87')][_0xb84b('0x48')]+0x1,'app':_0xb84b('0x98'),'appdata':_0xb84b('0x99'),'interval':_0xb84b('0x9a')});}}return db[_0xb84b('0x9b')][_0xb84b('0x5b')]({'body':_0x1fc12f[_0xb84b('0x5c')]['body'],'OpenchannelAccountId':_0x1fc12f[_0xb84b('0x57')]['id'],'OpenchannelInteractionId':_0x5c3da8['id'],'direction':'in','ContactId':_0x175dc6[_0xb84b('0x8b')]['id'],'AttachmentId':_0x1fc12f[_0xb84b('0x5c')][_0xb84b('0x9c')]});})[_0xb84b('0x22')](function(_0x3ee82c){_0x175dc6[_0xb84b('0x2a')]=_0x3ee82c;if(_0x175dc6['interaction'][_0xb84b('0x9d')]){return db[_0xb84b('0x9e')][_0xb84b('0x5a')]({'attributes':['id',_0xb84b('0x3b')],'where':{'id':_0x175dc6[_0xb84b('0x94')]['UserId']}})[_0xb84b('0x22')](function(_0x412801){if(_0x412801){_0x175dc6[_0xb84b('0x87')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb84b('0x9f'),'appdata':_0x412801[_0xb84b('0x3b')]+','+(_0x175dc6[_0xb84b('0x86')][_0xb84b('0xa0')]||0xa),'interval':'*,*,*,*'});_0x175dc6[_0xb84b('0xa1')]=![];}return respondWithRpcPromise(_0xb84b('0xa2'),_0xb84b('0xa3'),_0x175dc6);});}return respondWithRpcPromise('Start',_0xb84b('0xa3'),_0x175dc6);})[_0xb84b('0x22')](function(_0x5dd5dc){respondWithRpcPromise('EventManager',_0xb84b('0xa4'),{'event':_0xb84b('0x6f'),'message':_0x5dd5dc},client9002);return _0x5dd5dc;})[_0xb84b('0x22')](respondWithResult(_0x2d7a56,null))[_0xb84b('0x2d')](handleError(_0x2d7a56,null));};exports[_0xb84b('0xa5')]=function(_0x5d1004,_0x29c91b,_0x4a01dd){return db['OpenchannelAccount'][_0xb84b('0x65')]({'where':{'id':_0x5d1004[_0xb84b('0x57')]['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0x29c91b,null))[_0xb84b('0x22')](function(_0x301291){if(_0x301291){return db[_0xb84b('0xa6')][_0xb84b('0xa7')](function(_0x1d261b){return db[_0xb84b('0x84')]['destroy']({'where':{'OpenchannelAccountId':_0x5d1004[_0xb84b('0x57')]['id']},'transaction':_0x1d261b})[_0xb84b('0x22')](function(_0x13903d){var _0x2f5da8=_['map'](_0x5d1004[_0xb84b('0x5c')],function(_0x280a78){_0x280a78[_0xb84b('0x62')]=_0x5d1004[_0xb84b('0x57')]['id'];return _0x280a78;});return db[_0xb84b('0x84')][_0xb84b('0xa8')](_0x2f5da8,{'transaction':_0x1d261b});});})[_0xb84b('0x22')](function(){return db[_0xb84b('0x84')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x5d1004[_0xb84b('0x57')]['id']},'order':_0xb84b('0x88')});});}})[_0xb84b('0x22')](respondWithResult(_0x29c91b,null))[_0xb84b('0x2d')](handleError(_0x29c91b,null));};exports[_0xb84b('0xa9')]=function(_0x52321e,_0x44a90a,_0x1d68ef){var _0x1c5fc7={};var _0x344c98={};var _0x550adc;var _0xa4c0fb;return db[_0xb84b('0x53')][_0xb84b('0x65')]({'where':{'id':_0x52321e[_0xb84b('0x57')]['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0x44a90a,null))[_0xb84b('0x22')](function(_0x50a5e8){if(_0x50a5e8){_0x550adc=_0x50a5e8;_0x344c98[_0xb84b('0x42')]=_['keys'](db[_0xb84b('0x84')][_0xb84b('0x66')]);_0x344c98['query']=_[_0xb84b('0x43')](_0x52321e['query']);_0x344c98['filters']=_['intersection'](_0x344c98['model'],_0x344c98[_0xb84b('0x44')]);_0x1c5fc7[_0xb84b('0x47')]=_[_0xb84b('0x45')](_0x344c98[_0xb84b('0x42')],qs[_0xb84b('0x46')](_0x52321e['query'][_0xb84b('0x46')]));_0x1c5fc7[_0xb84b('0x47')]=_0x1c5fc7['attributes'][_0xb84b('0x48')]?_0x1c5fc7['attributes']:_0x344c98[_0xb84b('0x42')];_0x1c5fc7['order']=qs['sort'](_0x52321e[_0xb84b('0x44')]['sort']);_0x1c5fc7[_0xb84b('0x4c')]=qs['filters'](_[_0xb84b('0x68')](_0x52321e[_0xb84b('0x44')],_0x344c98[_0xb84b('0x4d')]));if(_0x52321e[_0xb84b('0x44')][_0xb84b('0x4e')]){_0x1c5fc7[_0xb84b('0x4c')]=_[_0xb84b('0x4f')](_0x1c5fc7['where'],{'$or':_['map'](_0x1c5fc7['attributes'],function(_0x3fca30){var _0x577520={};_0x577520[_0x3fca30]={'$like':'%'+_0x52321e['query'][_0xb84b('0x4e')]+'%'};return _0x577520;})});}_0x1c5fc7=_['merge']({},_0x1c5fc7,_0x52321e['options']);return _0x550adc[_0xb84b('0xa9')](_0x1c5fc7);}})[_0xb84b('0x22')](function(_0x2ccca6){if(_0x2ccca6){_0xa4c0fb=_0x2ccca6[_0xb84b('0x48')];if(!_0x52321e[_0xb84b('0x44')][_0xb84b('0x6c')]('nolimit')){_0x1c5fc7[_0xb84b('0x31')]=qs[_0xb84b('0x31')](_0x52321e['query'][_0xb84b('0x31')]);_0x1c5fc7[_0xb84b('0x4a')]=qs[_0xb84b('0x4a')](_0x52321e[_0xb84b('0x44')][_0xb84b('0x4a')]);}return _0x550adc[_0xb84b('0xa9')](_0x1c5fc7);}})[_0xb84b('0x22')](function(_0xbe0012){if(_0xbe0012){return _0xbe0012?{'count':_0xa4c0fb,'rows':_0xbe0012}:null;}})[_0xb84b('0x22')](respondWithResult(_0x44a90a,null))[_0xb84b('0x2d')](handleError(_0x44a90a,null));};exports['getInteractions']=function(_0x49a137,_0x68b53,_0x4ccd43){var _0x3646c5={'raw':![],'where':{}};var _0x2b0e6b={};var _0x10b6bc={'count':0x0,'rows':[]};return db[_0xb84b('0x53')][_0xb84b('0x65')]({'where':{'id':_0x49a137[_0xb84b('0x57')]['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0x68b53,null))[_0xb84b('0x22')](function(_0x39a9c0){if(_0x39a9c0){_0x2b0e6b[_0xb84b('0x42')]=_[_0xb84b('0x43')](db[_0xb84b('0x8e')][_0xb84b('0x66')]);_0x2b0e6b[_0xb84b('0x44')]=_[_0xb84b('0x43')](_0x49a137['query']);_0x2b0e6b['filters']=_[_0xb84b('0x45')](_0x2b0e6b[_0xb84b('0x42')],_0x2b0e6b[_0xb84b('0x44')]);_0x3646c5[_0xb84b('0x47')]=_[_0xb84b('0x45')](_0x2b0e6b[_0xb84b('0x42')],qs[_0xb84b('0x46')](_0x49a137[_0xb84b('0x44')][_0xb84b('0x46')]));_0x3646c5[_0xb84b('0x47')]=_0x3646c5[_0xb84b('0x47')][_0xb84b('0x48')]?_0x3646c5['attributes']:_0x2b0e6b[_0xb84b('0x42')];if(!_0x49a137[_0xb84b('0x44')][_0xb84b('0x6c')]('nolimit')){_0x3646c5[_0xb84b('0x31')]=qs[_0xb84b('0x31')](_0x49a137[_0xb84b('0x44')][_0xb84b('0x31')]);_0x3646c5[_0xb84b('0x4a')]=qs[_0xb84b('0x4a')](_0x49a137[_0xb84b('0x44')][_0xb84b('0x4a')]);}_0x3646c5[_0xb84b('0x4b')]=qs[_0xb84b('0x67')](_0x49a137[_0xb84b('0x44')]['sort']);_0x3646c5[_0xb84b('0x4c')]=qs[_0xb84b('0x4d')](_['pick'](_0x49a137['query'],_0x2b0e6b[_0xb84b('0x4d')]));_0x3646c5['where']['OpenchannelAccountId']=_0x39a9c0['id'];if(_0x49a137[_0xb84b('0x44')]['filter']){_0x3646c5[_0xb84b('0x4c')]=_[_0xb84b('0x4f')](_0x3646c5[_0xb84b('0x4c')],{'$or':_[_0xb84b('0x3f')](_0x3646c5[_0xb84b('0x47')],function(_0x422d76){var _0x5f41f6={};_0x5f41f6[_0x422d76]={'$like':'%'+_0x49a137[_0xb84b('0x44')][_0xb84b('0x4e')]+'%'};return _0x5f41f6;})});}_0x3646c5=_[_0xb84b('0x4f')]({},_0x3646c5,_0x49a137[_0xb84b('0x51')]);return db[_0xb84b('0x8e')]['count']({'where':_0x3646c5[_0xb84b('0x4c')]})['then'](function(_0x2ed405){_0x10b6bc['count']=_0x2ed405;if(_0x49a137[_0xb84b('0x44')]['includeAll']){_0x3646c5[_0xb84b('0x59')]=[{'model':db[_0xb84b('0x71')],'as':_0xb84b('0xaa'),'required':![]},{'model':db[_0xb84b('0x9e')],'as':_0xb84b('0xab'),'attributes':[_0xb84b('0x3b'),_0xb84b('0xac'),_0xb84b('0xad')],'required':![]},{'model':db[_0xb84b('0xae')],'as':'Tags','attributes':['id',_0xb84b('0x3b'),_0xb84b('0xaf')],'where':_0x49a137['query'][_0xb84b('0xb0')]?{'id':_0x49a137[_0xb84b('0x44')]['tag']}:undefined,'required':_0x49a137[_0xb84b('0x44')][_0xb84b('0xb0')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xb84b('0x54')](_0x3646c5);})[_0xb84b('0x22')](function(_0x1b6d16){_0x10b6bc[_0xb84b('0x55')]=_0x1b6d16;return _0x10b6bc;});}})[_0xb84b('0x22')](respondWithFilteredResult(_0x68b53,_0x3646c5))[_0xb84b('0x2d')](handleError(_0x68b53,null));};exports['addAgents']=function(_0x4a04ca,_0x5ea08c,_0x24fffe){return db[_0xb84b('0x53')][_0xb84b('0x5a')]({'where':{'id':_0x4a04ca[_0xb84b('0x57')]['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0x5ea08c,null))[_0xb84b('0x22')](function(_0x55773d){if(_0x55773d){return _0x55773d[_0xb84b('0xb1')](_0x4a04ca[_0xb84b('0x5c')][_0xb84b('0x6e')],_[_0xb84b('0xb2')](_0x4a04ca[_0xb84b('0x5c')],[_0xb84b('0x6e'),'id'])||{})[_0xb84b('0x91')](function(_0x492e00){for(var _0x579cbb=0x0;_0x579cbb<_0x4a04ca[_0xb84b('0x5c')]['ids']['length'];_0x579cbb+=0x1){socket[_0xb84b('0xb3')](_0xb84b('0xb4'),{'UserId':_0x4a04ca[_0xb84b('0x5c')][_0xb84b('0x6e')][_0x579cbb],'OpenchannelAccountId':_0x4a04ca[_0xb84b('0x57')]['id']});}return _0x492e00;});}})[_0xb84b('0x22')](respondWithResult(_0x5ea08c,null))['catch'](handleError(_0x5ea08c,null));};exports['removeAgents']=function(_0x7e1222,_0xb6e5fc,_0x271b8f){return db[_0xb84b('0x53')][_0xb84b('0x5a')]({'where':{'id':_0x7e1222['params']['id']}})['then'](handleEntityNotFound(_0xb6e5fc,null))[_0xb84b('0x22')](function(_0x5db9fb){if(_0x5db9fb){return _0x5db9fb['removeAgents'](_0x7e1222[_0xb84b('0x44')]['ids'])['then'](function(){if(_[_0xb84b('0xb5')](_0x7e1222[_0xb84b('0x44')][_0xb84b('0x6e')])){for(var _0x24630f=0x0;_0x24630f<_0x7e1222['query'][_0xb84b('0x6e')]['length'];_0x24630f+=0x1){socket[_0xb84b('0xb3')]('userOpenchannelAccount:remove',{'UserId':Number(_0x7e1222[_0xb84b('0x44')][_0xb84b('0x6e')][_0x24630f]),'OpenchannelAccountId':Number(_0x7e1222[_0xb84b('0x57')]['id'])});}}else{socket[_0xb84b('0xb3')]('userOpenchannelAccount:remove',{'UserId':Number(_0x7e1222['query'][_0xb84b('0x6e')]),'OpenchannelAccountId':Number(_0x7e1222['params']['id'])});}});}})[_0xb84b('0x22')](respondWithStatusCode(_0xb6e5fc,null))[_0xb84b('0x2d')](handleError(_0xb6e5fc,null));};exports[_0xb84b('0xb6')]=function(_0x46df7c,_0x520118,_0x3a4285){var _0x12d796={};var _0x5bc04d={};var _0x36f5a1;var _0x186202;return db['OpenchannelAccount'][_0xb84b('0x65')]({'where':{'id':_0x46df7c[_0xb84b('0x57')]['id']}})[_0xb84b('0x22')](handleEntityNotFound(_0x520118,null))[_0xb84b('0x22')](function(_0x18117c){if(_0x18117c){_0x36f5a1=_0x18117c;_0x5bc04d[_0xb84b('0x42')]=_[_0xb84b('0x43')](db['User'][_0xb84b('0x66')]);_0x5bc04d[_0xb84b('0x44')]=_[_0xb84b('0x43')](_0x46df7c[_0xb84b('0x44')]);_0x5bc04d[_0xb84b('0x4d')]=_[_0xb84b('0x45')](_0x5bc04d[_0xb84b('0x42')],_0x5bc04d[_0xb84b('0x44')]);_0x12d796[_0xb84b('0x47')]=_[_0xb84b('0x45')](_0x5bc04d[_0xb84b('0x42')],qs[_0xb84b('0x46')](_0x46df7c[_0xb84b('0x44')][_0xb84b('0x46')]));_0x12d796[_0xb84b('0x47')]=_0x12d796[_0xb84b('0x47')]['length']?_0x12d796['attributes']:_0x5bc04d[_0xb84b('0x42')];_0x12d796['order']=qs['sort'](_0x46df7c[_0xb84b('0x44')][_0xb84b('0x67')]);_0x12d796[_0xb84b('0x4c')]=qs[_0xb84b('0x4d')](_[_0xb84b('0x68')](_0x46df7c['query'],_0x5bc04d[_0xb84b('0x4d')]));if(_0x46df7c[_0xb84b('0x44')][_0xb84b('0x4e')]){_0x12d796[_0xb84b('0x4c')]=_[_0xb84b('0x4f')](_0x12d796[_0xb84b('0x4c')],{'$or':_[_0xb84b('0x3f')](_0x12d796[_0xb84b('0x47')],function(_0x599dda){var _0x3415fc={};_0x3415fc[_0x599dda]={'$like':'%'+_0x46df7c['query'][_0xb84b('0x4e')]+'%'};return _0x3415fc;})});}_0x12d796=_[_0xb84b('0x4f')]({},_0x12d796,_0x46df7c[_0xb84b('0x51')]);return _0x36f5a1['getAgents'](_0x12d796);}})['then'](function(_0x46f9bd){if(_0x46f9bd){_0x186202=_0x46f9bd['length'];if(!_0x46df7c['query'][_0xb84b('0x6c')]('nolimit')){_0x12d796[_0xb84b('0x31')]=qs[_0xb84b('0x31')](_0x46df7c[_0xb84b('0x44')][_0xb84b('0x31')]);_0x12d796[_0xb84b('0x4a')]=qs[_0xb84b('0x4a')](_0x46df7c['query'][_0xb84b('0x4a')]);}return _0x36f5a1[_0xb84b('0xb6')](_0x12d796);}})[_0xb84b('0x22')](function(_0x1fea7e){if(_0x1fea7e){return _0x1fea7e?{'count':_0x186202,'rows':_0x1fea7e}:null;}})[_0xb84b('0x22')](respondWithResult(_0x520118,null))[_0xb84b('0x2d')](handleError(_0x520118,null));};exports[_0xb84b('0xb7')]=function(_0x1980da,_0x55628f,_0x380ee2){var _0x2e6507,_0x13ac50,_0x3a9a3e;if(_['isNil'](_0x1980da[_0xb84b('0x5c')][_0xb84b('0x5c')])||_0x1980da[_0xb84b('0x5c')][_0xb84b('0x5c')]===''){throw new db['Sequelize'][(_0xb84b('0x73'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb84b('0x7c')](_0x1980da[_0xb84b('0x5c')]['to'])){}_0x2e6507=_0x1980da['body']['to'];return db[_0xb84b('0x53')]['findOne']({'where':{'id':_0x1980da[_0xb84b('0x57')]['id']}})['then'](handleEntityNotFound(_0x55628f,null))[_0xb84b('0x22')](function(_0xf07ee9){if(_0xf07ee9){return db['OpenchannelAccount'][_0xb84b('0x5a')]({'where':{'id':_0xf07ee9['id']},'include':[{'model':db['CmList'],'as':_0xb84b('0x82'),'include':[{'model':db[_0xb84b('0x71')],'as':_0xb84b('0x8a'),'where':{[_0xf07ee9[_0xb84b('0x7e')]]:_0x2e6507},'limit':0x1,'order':[['updatedAt',_0xb84b('0x83')]]}]}]})['then'](handleEntityNotFound(_0x55628f,null))['then'](function(_0x255a69){if(_0x255a69&&_0x255a69[_0xb84b('0x82')]){_0x13ac50=_0x255a69[_0xb84b('0x38')]({'plain':!![]});if(_0x13ac50[_0xb84b('0x82')]&&_0x13ac50[_0xb84b('0x82')][_0xb84b('0x8a')]['length']){return _0x13ac50[_0xb84b('0x82')][_0xb84b('0x8a')][0x0];}return db[_0xb84b('0x71')]['create'](_[_0xb84b('0xb8')](_0x1980da[_0xb84b('0x5c')],{'firstName':_0x2e6507,[_0x255a69['mapKey']]:_0x2e6507,'phone':_0x2e6507,'ListId':_0x13ac50['ListId']}));}})[_0xb84b('0x22')](handleEntityNotFound(_0x55628f,null))[_0xb84b('0x22')](function(_0x4f9135){if(_0x4f9135){_0x3a9a3e=_0x4f9135;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x3a9a3e['id'],'closed':![],'OpenchannelAccountId':_0x13ac50['id']}})['then'](function(_0x396ebe){if(_0x396ebe){return[_0x396ebe,![]];}return db['OpenchannelInteraction'][_0xb84b('0x5b')]({'UserId':_0x1980da[_0xb84b('0xb9')]['id'],'ContactId':_0x3a9a3e['id'],'OpenchannelAccountId':_0x13ac50['id'],'lastMsgDirection':'out','Messages':[_[_0xb84b('0x4f')](_0x1980da[_0xb84b('0x5c')],{'read':![],'body':_0x1980da['body'][_0xb84b('0x5c')],'OpenchannelAccountId':_0x13ac50['id'],'UserId':_0x1980da[_0xb84b('0xb9')]['id'],'ContactId':_0x3a9a3e['id']})]},{'include':[{'model':db[_0xb84b('0x9b')],'as':_0xb84b('0xba')}]})[_0xb84b('0x22')](function(_0x5a9c55){return[_0x5a9c55,!![]];});});}})[_0xb84b('0x91')](function(_0x13ae44,_0x7bfb9b){if(_0x7bfb9b){return _0x13ae44;}return db[_0xb84b('0x9b')][_0xb84b('0x5b')](_[_0xb84b('0x4f')](_0x1980da[_0xb84b('0x5c')],{'read':![],'body':_0x1980da[_0xb84b('0x5c')][_0xb84b('0x5c')],'OpenchannelAccountId':_0x13ac50['id'],'OpenchannelInteractionId':_0x13ae44['id'],'UserId':_0x1980da['user']['id'],'ContactId':_0x3a9a3e['id']}))[_0xb84b('0x22')](function(_0x391654){_0x13ae44[_0xb84b('0xbb')][_0xb84b('0xba')]=[];_0x13ae44[_0xb84b('0xbb')][_0xb84b('0xba')][_0xb84b('0x97')](_0x391654[_0xb84b('0xbb')]);return _0x13ae44;});});}})[_0xb84b('0x22')](respondWithResult(_0x55628f,null))[_0xb84b('0x2d')](handleError(_0x55628f,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index efef927..387395b 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 _0xd22f=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x36a146,_0x46ff84){var _0xe41f0f=function(_0x32a4c8){while(--_0x32a4c8){_0x36a146['push'](_0x36a146['shift']());}};_0xe41f0f(++_0x46ff84);}(_0xd22f,0x198));var _0xfd22=function(_0x4eb1e7,_0x2db0be){_0x4eb1e7=_0x4eb1e7-0x0;var _0x11f7bb=_0xd22f[_0x4eb1e7];return _0x11f7bb;};'use strict';var EventEmitter=require(_0xfd22('0x0'));var OpenchannelAccount=require(_0xfd22('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xfd22('0x2')](0x0);var events={'afterCreate':_0xfd22('0x3'),'afterUpdate':'update','afterDestroy':_0xfd22('0x4')};function emitEvent(_0x264dab){return function(_0x15dc8a,_0x438216,_0x3941c9){OpenchannelAccountEvents['emit'](_0x264dab+':'+_0x15dc8a['id'],_0x15dc8a);OpenchannelAccountEvents[_0xfd22('0x5')](_0x264dab,_0x15dc8a);_0x3941c9(null);};}for(var e in events){if(events[_0xfd22('0x6')](e)){var event=events[e];OpenchannelAccount[_0xfd22('0x7')](e,emitEvent(event));}}module[_0xfd22('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xc520=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x4aac5a,_0x15b04c){var _0x42e7bc=function(_0x1da766){while(--_0x1da766){_0x4aac5a['push'](_0x4aac5a['shift']());}};_0x42e7bc(++_0x15b04c);}(_0xc520,0x146));var _0x0c52=function(_0xbab103,_0x1ca6e0){_0xbab103=_0xbab103-0x0;var _0x42541a=_0xc520[_0xbab103];return _0x42541a;};'use strict';var EventEmitter=require(_0x0c52('0x0'));var OpenchannelAccount=require(_0x0c52('0x1'))['db'][_0x0c52('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x0c52('0x3')](0x0);var events={'afterCreate':_0x0c52('0x4'),'afterUpdate':_0x0c52('0x5'),'afterDestroy':_0x0c52('0x6')};function emitEvent(_0x29bc58){return function(_0x4f2346,_0x3c3e13,_0x3660f2){OpenchannelAccountEvents[_0x0c52('0x7')](_0x29bc58+':'+_0x4f2346['id'],_0x4f2346);OpenchannelAccountEvents[_0x0c52('0x7')](_0x29bc58,_0x4f2346);_0x3660f2(null);};}for(var e in events){if(events[_0x0c52('0x8')](e)){var event=events[e];OpenchannelAccount[_0x0c52('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 9261fc8..4fe68a1 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 _0x22ef=['moment','bluebird','request-promise','../../config/environment','./openchannelAccount.attributes','exports','define','openchannel_accounts','util','../../config/logger','api'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x22ef,0x1b5));var _0xf22e=function(_0x45d7a3,_0x6410bc){_0x45d7a3=_0x45d7a3-0x0;var _0x4d1a17=_0x22ef[_0x45d7a3];return _0x4d1a17;};'use strict';var _=require('lodash');var util=require(_0xf22e('0x0'));var logger=require(_0xf22e('0x1'))(_0xf22e('0x2'));var moment=require(_0xf22e('0x3'));var BPromise=require(_0xf22e('0x4'));var rp=require(_0xf22e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf22e('0x6'));var attributes=require(_0xf22e('0x7'));module[_0xf22e('0x8')]=function(_0xc7703f,_0x10e9d8){return _0xc7703f[_0xf22e('0x9')]('OpenchannelAccount',attributes,{'tableName':_0xf22e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e82=['path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3beb4e,_0x2d1a69){var _0xd40198=function(_0x4a1f72){while(--_0x4a1f72){_0x3beb4e['push'](_0x3beb4e['shift']());}};_0xd40198(++_0x2d1a69);}(_0x6e82,0x1a7));var _0x26e8=function(_0x1b5256,_0x10179d){_0x1b5256=_0x1b5256-0x0;var _0x2ffa09=_0x6e82[_0x1b5256];return _0x2ffa09;};'use strict';var _=require('lodash');var util=require(_0x26e8('0x0'));var logger=require(_0x26e8('0x1'))(_0x26e8('0x2'));var moment=require(_0x26e8('0x3'));var BPromise=require(_0x26e8('0x4'));var rp=require(_0x26e8('0x5'));var fs=require('fs');var path=require(_0x26e8('0x6'));var rimraf=require(_0x26e8('0x7'));var config=require(_0x26e8('0x8'));var attributes=require(_0x26e8('0x9'));module[_0x26e8('0xa')]=function(_0x56a7e3,_0x4c287a){return _0x56a7e3[_0x26e8('0xb')](_0x26e8('0xc'),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 6dc0d02..853626d 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 _0x1d14=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x33c36e,_0x3d4558){var _0x22a5d1=function(_0x556de6){while(--_0x556de6){_0x33c36e['push'](_0x33c36e['shift']());}};_0x22a5d1(++_0x3d4558);}(_0x1d14,0xf5));var _0x41d1=function(_0x421933,_0x14db0b){_0x421933=_0x421933-0x0;var _0x20dddc=_0x1d14[_0x421933];return _0x20dddc;};'use strict';var _=require(_0x41d1('0x0'));var util=require(_0x41d1('0x1'));var moment=require(_0x41d1('0x2'));var BPromise=require(_0x41d1('0x3'));var rs=require(_0x41d1('0x4'));var fs=require('fs');var Redis=require(_0x41d1('0x5'));var db=require(_0x41d1('0x6'))['db'];var utils=require(_0x41d1('0x7'));var logger=require(_0x41d1('0x8'))(_0x41d1('0x9'));var config=require(_0x41d1('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x41d1('0xb')][_0x41d1('0xc')]({'port':0x232a});config['redis']=_[_0x41d1('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x41d1('0xe'))[_0x41d1('0xf')](socket);function respondWithRpcPromise(_0x5e6068,_0x58b435,_0x116e94){return new BPromise(function(_0xc5563d,_0x276799){return client[_0x41d1('0x10')](_0x5e6068,_0x116e94)[_0x41d1('0x11')](function(_0x5a5f95){logger['info'](_0x41d1('0x12'),_0x58b435,_0x41d1('0x13'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x58b435,_0x41d1('0x13'),JSON[_0x41d1('0x14')](_0x5a5f95));if(_0x5a5f95[_0x41d1('0x15')]){if(_0x5a5f95['error'][_0x41d1('0x16')]===0x1f4){logger['error'](_0x41d1('0x12'),_0x58b435,_0x5a5f95[_0x41d1('0x15')][_0x41d1('0x17')]);return _0x276799(_0x5a5f95[_0x41d1('0x15')][_0x41d1('0x17')]);}logger[_0x41d1('0x15')](_0x41d1('0x12'),_0x58b435,_0x5a5f95[_0x41d1('0x15')][_0x41d1('0x17')]);return _0xc5563d(_0x5a5f95[_0x41d1('0x15')]['message']);}else{logger[_0x41d1('0x18')](_0x41d1('0x12'),_0x58b435,_0x41d1('0x13'));_0xc5563d(_0x5a5f95[_0x41d1('0x19')][_0x41d1('0x17')]);}})[_0x41d1('0x1a')](function(_0x3c792b){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x58b435,_0x3c792b);_0x276799(_0x3c792b);});});} \ No newline at end of file +var _0x1950=['OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4f39af,_0x3ba41a){var _0x134223=function(_0x191fee){while(--_0x191fee){_0x4f39af['push'](_0x4f39af['shift']());}};_0x134223(++_0x3ba41a);}(_0x1950,0xce));var _0x0195=function(_0x35b9f9,_0x31e2cd){_0x35b9f9=_0x35b9f9-0x0;var _0x5e5ebb=_0x1950[_0x35b9f9];return _0x5e5ebb;};'use strict';var _=require(_0x0195('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0195('0x1'));var rs=require(_0x0195('0x2'));var fs=require('fs');var Redis=require(_0x0195('0x3'));var db=require(_0x0195('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0195('0x5'))(_0x0195('0x6'));var config=require('../../config/environment');var jayson=require(_0x0195('0x7'));var client=jayson[_0x0195('0x8')][_0x0195('0x9')]({'port':0x232a});config[_0x0195('0xa')]=_[_0x0195('0xb')](config[_0x0195('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0195('0xc'))(new Redis(config['redis']));require(_0x0195('0xd'))['register'](socket);function respondWithRpcPromise(_0x4f61ba,_0x4339b0,_0x1e39b3){return new BPromise(function(_0x36154b,_0x116459){return client[_0x0195('0xe')](_0x4f61ba,_0x1e39b3)['then'](function(_0x12ec11){logger[_0x0195('0xf')](_0x0195('0x10'),_0x4339b0,_0x0195('0x11'));logger[_0x0195('0x12')](_0x0195('0x13'),_0x4339b0,_0x0195('0x11'),JSON[_0x0195('0x14')](_0x12ec11));if(_0x12ec11['error']){if(_0x12ec11[_0x0195('0x15')][_0x0195('0x16')]===0x1f4){logger['error'](_0x0195('0x10'),_0x4339b0,_0x12ec11['error'][_0x0195('0x17')]);return _0x116459(_0x12ec11[_0x0195('0x15')]['message']);}logger[_0x0195('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x4339b0,_0x12ec11[_0x0195('0x15')][_0x0195('0x17')]);return _0x36154b(_0x12ec11[_0x0195('0x15')][_0x0195('0x17')]);}else{logger[_0x0195('0xf')](_0x0195('0x10'),_0x4339b0,_0x0195('0x11'));_0x36154b(_0x12ec11['result'][_0x0195('0x17')]);}})[_0x0195('0x18')](function(_0x45bb6f){logger[_0x0195('0x15')](_0x0195('0x10'),_0x4339b0,_0x45bb6f);_0x116459(_0x45bb6f);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 7d3f30c..8ded4e7 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 _0x2edc=['remove','update','emit','register','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x340ef1,_0x46c405){var _0x853456=function(_0x315525){while(--_0x315525){_0x340ef1['push'](_0x340ef1['shift']());}};_0x853456(++_0x46c405);}(_0x2edc,0xfa));var _0xc2ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2edc[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelAccountEvents=require(_0xc2ed('0x0'));var events=[_0xc2ed('0x1'),_0xc2ed('0x2'),_0xc2ed('0x3')];function createListener(_0x51c9e3,_0x1084f0){return function(_0xa2095e){_0x1084f0[_0xc2ed('0x4')](_0x51c9e3,_0xa2095e);};}function removeListener(_0xafccce,_0x13246a){return function(){OpenchannelAccountEvents['removeListener'](_0xafccce,_0x13246a);};}exports[_0xc2ed('0x5')]=function(_0x1e0f3b){for(var _0x79bf26=0x0,_0x36301d=events['length'];_0x79bf26<_0x36301d;_0x79bf26++){var _0x22da2e=events[_0x79bf26];var _0x2a8e11=createListener(_0xc2ed('0x6')+_0x22da2e,_0x1e0f3b);OpenchannelAccountEvents['on'](_0x22da2e,_0x2a8e11);}}; \ No newline at end of file +var _0xcb2b=['length','openchannelAccount:','./openchannelAccount.events','update','register'];(function(_0x2f823f,_0x464f7c){var _0x44df3c=function(_0x1ba9cf){while(--_0x1ba9cf){_0x2f823f['push'](_0x2f823f['shift']());}};_0x44df3c(++_0x464f7c);}(_0xcb2b,0x129));var _0xbcb2=function(_0xf18cc,_0x41e268){_0xf18cc=_0xf18cc-0x0;var _0x2f8777=_0xcb2b[_0xf18cc];return _0x2f8777;};'use strict';var OpenchannelAccountEvents=require(_0xbcb2('0x0'));var events=['save','remove',_0xbcb2('0x1')];function createListener(_0x3f6f20,_0x9900a6){return function(_0xb1f29c){_0x9900a6['emit'](_0x3f6f20,_0xb1f29c);};}function removeListener(_0x3e34da,_0x90d995){return function(){OpenchannelAccountEvents['removeListener'](_0x3e34da,_0x90d995);};}exports[_0xbcb2('0x2')]=function(_0x2cfa45){for(var _0x206a7a=0x0,_0x25e6fc=events[_0xbcb2('0x3')];_0x206a7a<_0x25e6fc;_0x206a7a++){var _0x3a8efc=events[_0x206a7a];var _0x198c88=createListener(_0xbcb2('0x4')+_0x3a8efc,_0x2cfa45);OpenchannelAccountEvents['on'](_0x3a8efc,_0x198c88);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 81aa3e2..a7eab1a 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 _0x3e90=['show','update','delete','destroy','exports','path','express','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','/:id'];(function(_0x58d316,_0x21352b){var _0xa4343=function(_0x5c10d2){while(--_0x5c10d2){_0x58d316['push'](_0x58d316['shift']());}};_0xa4343(++_0x21352b);}(_0x3e90,0x1e1));var _0x03e9=function(_0x217e21,_0x46b59f){_0x217e21=_0x217e21-0x0;var _0x17e31a=_0x3e90[_0x217e21];return _0x17e31a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x03e9('0x0'));var timeout=require('connect-timeout');var express=require(_0x03e9('0x1'));var router=express[_0x03e9('0x2')]();var auth=require(_0x03e9('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x03e9('0x4'));var controller=require(_0x03e9('0x5'));router['get']('/',auth[_0x03e9('0x6')](),controller[_0x03e9('0x7')]);router['get'](_0x03e9('0x8'),auth['isAuthenticated'](),controller[_0x03e9('0x9')]);router['post']('/',auth[_0x03e9('0x6')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x03e9('0xa')]);router[_0x03e9('0xb')](_0x03e9('0x8'),auth['isAuthenticated'](),controller[_0x03e9('0xc')]);module[_0x03e9('0xd')]=router; \ No newline at end of file +var _0x941f=['Router','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','show','post','put','update','destroy','exports','path','connect-timeout','express'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x941f,0x6d));var _0xf941=function(_0x26012b,_0x2124bc){_0x26012b=_0x26012b-0x0;var _0x121489=_0x941f[_0x26012b];return _0x121489;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf941('0x0'));var timeout=require(_0xf941('0x1'));var express=require(_0xf941('0x2'));var router=express[_0xf941('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf941('0x4'));var config=require(_0xf941('0x5'));var controller=require(_0xf941('0x6'));router[_0xf941('0x7')]('/',auth[_0xf941('0x8')](),controller['index']);router[_0xf941('0x7')](_0xf941('0x9'),auth['isAuthenticated'](),controller[_0xf941('0xa')]);router[_0xf941('0xb')]('/',auth[_0xf941('0x8')](),controller['create']);router[_0xf941('0xc')](_0xf941('0x9'),auth['isAuthenticated'](),controller[_0xf941('0xd')]);router['delete'](_0xf941('0x9'),auth['isAuthenticated'](),controller[_0xf941('0xe')]);module[_0xf941('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 2b1920e..97734e8 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 _0xc2da=['STRING','*,*,*,*','sequelize','INTEGER','noop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2da,0x124));var _0xac2d=function(_0x5d225a,_0x2debe9){_0x5d225a=_0x5d225a-0x0;var _0x1e7761=_0xc2da[_0x5d225a];return _0x1e7761;};'use strict';var Sequelize=require(_0xac2d('0x0'));module['exports']={'priority':{'type':Sequelize[_0xac2d('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xac2d('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xac2d('0x3')]},'interval':{'type':Sequelize[_0xac2d('0x3')],'defaultValue':_0xac2d('0x4')}}; \ No newline at end of file +var _0x34d2=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0xad5ac0,_0x45df5a){var _0x544129=function(_0x4db235){while(--_0x4db235){_0xad5ac0['push'](_0xad5ac0['shift']());}};_0x544129(++_0x45df5a);}(_0x34d2,0x89));var _0x234d=function(_0x27fab3,_0x5c0f50){_0x27fab3=_0x27fab3-0x0;var _0x31bfa5=_0x34d2[_0x27fab3];return _0x31bfa5;};'use strict';var Sequelize=require(_0x234d('0x0'));module[_0x234d('0x1')]={'priority':{'type':Sequelize[_0x234d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x234d('0x3')],'allowNull':![],'defaultValue':_0x234d('0x4')},'appdata':{'type':Sequelize[_0x234d('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x234d('0x3')],'defaultValue':_0x234d('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 379bb92..e9547b8 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 _0x455a=['OpenchannelApplication','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','where','pick','filters','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','html-pdf','eml-format','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','then','destroy','error','stack','name','send','index','map'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0x455a,0x66));var _0xa455=function(_0x49acee,_0x49c7ab){_0x49acee=_0x49acee-0x0;var _0x18a8f8=_0x455a[_0x49acee];return _0x18a8f8;};'use strict';var pdf=require(_0xa455('0x0'));var emlformat=require(_0xa455('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa455('0x2'));var moment=require(_0xa455('0x3'));var BPromise=require(_0xa455('0x4'));var Mustache=require('mustache');var util=require(_0xa455('0x5'));var path=require(_0xa455('0x6'));var sox=require(_0xa455('0x7'));var csv=require(_0xa455('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa455('0x9'));var crypto=require(_0xa455('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa455('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa455('0xc'));var Papa=require('papaparse');var Redis=require(_0xa455('0xd'));var authService=require(_0xa455('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xa455('0xf'));var hardwareService=require(_0xa455('0x10'));var logger=require(_0xa455('0x11'))(_0xa455('0x12'));var utils=require(_0xa455('0x13'));var config=require(_0xa455('0x14'));var licenseUtil=require(_0xa455('0x15'));var db=require(_0xa455('0x16'))['db'];function respondWithStatusCode(_0x151bfe,_0x20c5e1){_0x20c5e1=_0x20c5e1||0xcc;return function(_0x4309c9){if(_0x4309c9){return _0x151bfe[_0xa455('0x17')](_0x20c5e1);}return _0x151bfe[_0xa455('0x18')](_0x20c5e1)[_0xa455('0x19')]();};}function respondWithResult(_0x1503ef,_0x275199){_0x275199=_0x275199||0xc8;return function(_0x4fd339){if(_0x4fd339){return _0x1503ef['status'](_0x275199)['json'](_0x4fd339);}};}function respondWithFilteredResult(_0x582cfa,_0xc92e2a){return function(_0x305689){if(_0x305689){var _0x63a523=_0x305689[_0xa455('0x1a')],_0x338aa9=_0xc92e2a['offset'],_0x560478=_0xc92e2a[_0xa455('0x1b')]+_0xc92e2a[_0xa455('0x1c')],_0x365b07;if(_0x560478>=_0x63a523){_0x560478=_0x63a523;_0x365b07=0xc8;}else{_0x365b07=0xce;}_0x582cfa[_0xa455('0x18')](_0x365b07);return _0x582cfa[_0xa455('0x1d')]('Content-Range',_0x338aa9+'-'+_0x560478+'/'+_0x63a523)[_0xa455('0x1e')](_0x305689);}return null;};}function patchUpdates(_0x5a9bf2){return function(_0x1b84e){try{jsonpatch[_0xa455('0x1f')](_0x1b84e,_0x5a9bf2,!![]);}catch(_0x1ff246){return BPromise['reject'](_0x1ff246);}return _0x1b84e['save']();};}function saveUpdates(_0xa1efdd,_0x4eac05){return function(_0x105e84){if(_0x105e84){return _0x105e84['update'](_0xa1efdd)[_0xa455('0x20')](function(_0x3d5719){return _0x3d5719;});}return null;};}function removeEntity(_0x5d3786,_0x220eed){return function(_0x137146){if(_0x137146){return _0x137146[_0xa455('0x21')]()['then'](function(){_0x5d3786['status'](0xcc)[_0xa455('0x19')]();});}};}function handleEntityNotFound(_0x55f8ca,_0x5be552){return function(_0x29525e){if(!_0x29525e){_0x55f8ca[_0xa455('0x17')](0x194);}return _0x29525e;};}function handleError(_0x311f65,_0x52a6ce){_0x52a6ce=_0x52a6ce||0x1f4;return function(_0x370dc7){logger[_0xa455('0x22')](_0x370dc7[_0xa455('0x23')]);if(_0x370dc7['name']){delete _0x370dc7[_0xa455('0x24')];}_0x311f65[_0xa455('0x18')](_0x52a6ce)[_0xa455('0x25')](_0x370dc7);};}exports[_0xa455('0x26')]=function(_0x244cfe,_0x5423e9){var _0x4c5d20={},_0x216bf7={},_0x41fbff={'count':0x0,'rows':[]};var _0xeed5df=_[_0xa455('0x27')](db[_0xa455('0x28')][_0xa455('0x29')],function(_0x3fb70f){return{'name':_0x3fb70f[_0xa455('0x2a')],'type':_0x3fb70f[_0xa455('0x2b')][_0xa455('0x2c')]};});_0x216bf7[_0xa455('0x2d')]=_[_0xa455('0x27')](_0xeed5df,_0xa455('0x24'));_0x216bf7['query']=_[_0xa455('0x2e')](_0x244cfe[_0xa455('0x2f')]);_0x216bf7['filters']=_[_0xa455('0x30')](_0x216bf7[_0xa455('0x2d')],_0x216bf7['query']);_0x4c5d20[_0xa455('0x31')]=_['intersection'](_0x216bf7[_0xa455('0x2d')],qs[_0xa455('0x32')](_0x244cfe['query'][_0xa455('0x32')]));_0x4c5d20['attributes']=_0x4c5d20[_0xa455('0x31')][_0xa455('0x33')]?_0x4c5d20[_0xa455('0x31')]:_0x216bf7[_0xa455('0x2d')];if(!_0x244cfe[_0xa455('0x2f')]['hasOwnProperty'](_0xa455('0x34'))){_0x4c5d20[_0xa455('0x1c')]=qs[_0xa455('0x1c')](_0x244cfe[_0xa455('0x2f')][_0xa455('0x1c')]);_0x4c5d20['offset']=qs[_0xa455('0x1b')](_0x244cfe[_0xa455('0x2f')][_0xa455('0x1b')]);}_0x4c5d20[_0xa455('0x35')]=qs['sort'](_0x244cfe['query']['sort']);_0x4c5d20[_0xa455('0x36')]=qs['filters'](_[_0xa455('0x37')](_0x244cfe[_0xa455('0x2f')],_0x216bf7[_0xa455('0x38')]),_0xeed5df);if(_0x244cfe[_0xa455('0x2f')][_0xa455('0x39')]){_0x4c5d20[_0xa455('0x36')]=_[_0xa455('0x3a')](_0x4c5d20[_0xa455('0x36')],{'$or':_[_0xa455('0x27')](_0xeed5df,function(_0x475867){if(_0x475867[_0xa455('0x2b')]!=='VIRTUAL'){var _0x3a5057={};_0x3a5057[_0x475867['name']]={'$like':'%'+_0x244cfe['query']['filter']+'%'};return _0x3a5057;}})});}_0x4c5d20=_[_0xa455('0x3a')]({},_0x4c5d20,_0x244cfe[_0xa455('0x3b')]);var _0x20b0e1={'where':_0x4c5d20[_0xa455('0x36')]};return db[_0xa455('0x28')][_0xa455('0x1a')](_0x20b0e1)[_0xa455('0x20')](function(_0x236a52){_0x41fbff['count']=_0x236a52;if(_0x244cfe[_0xa455('0x2f')]['includeAll']){_0x4c5d20[_0xa455('0x3c')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0xa455('0x3d')](_0x4c5d20);})[_0xa455('0x20')](function(_0x5218c8){_0x41fbff[_0xa455('0x3e')]=_0x5218c8;return _0x41fbff;})[_0xa455('0x20')](respondWithFilteredResult(_0x5423e9,_0x4c5d20))[_0xa455('0x3f')](handleError(_0x5423e9,null));};exports[_0xa455('0x40')]=function(_0x198df9,_0x284ac0){var _0x6bff06={'raw':!![],'where':{'id':_0x198df9[_0xa455('0x41')]['id']}},_0x29edab={};_0x29edab[_0xa455('0x2d')]=_[_0xa455('0x2e')](db[_0xa455('0x28')][_0xa455('0x29')]);_0x29edab['query']=_[_0xa455('0x2e')](_0x198df9['query']);_0x29edab['filters']=_[_0xa455('0x30')](_0x29edab[_0xa455('0x2d')],_0x29edab[_0xa455('0x2f')]);_0x6bff06[_0xa455('0x31')]=_[_0xa455('0x30')](_0x29edab[_0xa455('0x2d')],qs[_0xa455('0x32')](_0x198df9[_0xa455('0x2f')][_0xa455('0x32')]));_0x6bff06[_0xa455('0x31')]=_0x6bff06[_0xa455('0x31')][_0xa455('0x33')]?_0x6bff06['attributes']:_0x29edab[_0xa455('0x2d')];if(_0x198df9[_0xa455('0x2f')][_0xa455('0x42')]){_0x6bff06['include']=[{'all':!![]}];}_0x6bff06=_[_0xa455('0x3a')]({},_0x6bff06,_0x198df9['options']);return db['OpenchannelApplication'][_0xa455('0x43')](_0x6bff06)[_0xa455('0x20')](handleEntityNotFound(_0x284ac0,null))[_0xa455('0x20')](respondWithResult(_0x284ac0,null))[_0xa455('0x3f')](handleError(_0x284ac0,null));};exports[_0xa455('0x44')]=function(_0x444709,_0x38d07b){return db[_0xa455('0x28')][_0xa455('0x44')](_0x444709[_0xa455('0x45')],{})[_0xa455('0x20')](respondWithResult(_0x38d07b,0xc9))[_0xa455('0x3f')](handleError(_0x38d07b,null));};exports[_0xa455('0x46')]=function(_0x25009f,_0x5d13f9){if(_0x25009f[_0xa455('0x45')]['id']){delete _0x25009f['body']['id'];}return db['OpenchannelApplication'][_0xa455('0x43')]({'where':{'id':_0x25009f[_0xa455('0x41')]['id']}})['then'](handleEntityNotFound(_0x5d13f9,null))[_0xa455('0x20')](saveUpdates(_0x25009f[_0xa455('0x45')],null))['then'](respondWithResult(_0x5d13f9,null))['catch'](handleError(_0x5d13f9,null));};exports[_0xa455('0x21')]=function(_0x3bcafb,_0x107886){return db['OpenchannelApplication']['find']({'where':{'id':_0x3bcafb[_0xa455('0x41')]['id']}})[_0xa455('0x20')](handleEntityNotFound(_0x107886,null))[_0xa455('0x20')](removeEntity(_0x107886,null))[_0xa455('0x3f')](handleError(_0x107886,null));}; \ No newline at end of file +var _0xdb7d=['html-pdf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','update','then','destroy','error','stack','name','map','OpenchannelApplication','rawAttributes','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','options','include','rows','catch','show','params','fields','find','create','body'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xdb7d,0x13b));var _0xddb7=function(_0x2bb30a,_0x13c669){_0x2bb30a=_0x2bb30a-0x0;var _0x1d0ae8=_0xdb7d[_0x2bb30a];return _0x1d0ae8;};'use strict';var pdf=require(_0xddb7('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xddb7('0x1'));var jsonpatch=require(_0xddb7('0x2'));var rp=require(_0xddb7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xddb7('0x4'));var path=require(_0xddb7('0x5'));var sox=require(_0xddb7('0x6'));var csv=require(_0xddb7('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xddb7('0x8'));var squel=require(_0xddb7('0x9'));var crypto=require('crypto');var jsforce=require(_0xddb7('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xddb7('0x7'));var querystring=require(_0xddb7('0xb'));var Papa=require('papaparse');var Redis=require(_0xddb7('0xc'));var authService=require(_0xddb7('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xddb7('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xddb7('0xf'));var utils=require(_0xddb7('0x10'));var config=require(_0xddb7('0x11'));var licenseUtil=require(_0xddb7('0x12'));var db=require(_0xddb7('0x13'))['db'];function respondWithStatusCode(_0x370f83,_0x2dd4aa){_0x2dd4aa=_0x2dd4aa||0xcc;return function(_0x59af1a){if(_0x59af1a){return _0x370f83[_0xddb7('0x14')](_0x2dd4aa);}return _0x370f83[_0xddb7('0x15')](_0x2dd4aa)[_0xddb7('0x16')]();};}function respondWithResult(_0x2fd30d,_0x8bb943){_0x8bb943=_0x8bb943||0xc8;return function(_0x3138a7){if(_0x3138a7){return _0x2fd30d[_0xddb7('0x15')](_0x8bb943)['json'](_0x3138a7);}};}function respondWithFilteredResult(_0x4794b9,_0x3b4787){return function(_0x34f187){if(_0x34f187){var _0xbb7c67=_0x34f187[_0xddb7('0x17')],_0x21c068=_0x3b4787['offset'],_0x30950c=_0x3b4787[_0xddb7('0x18')]+_0x3b4787['limit'],_0x1f648b;if(_0x30950c>=_0xbb7c67){_0x30950c=_0xbb7c67;_0x1f648b=0xc8;}else{_0x1f648b=0xce;}_0x4794b9[_0xddb7('0x15')](_0x1f648b);return _0x4794b9[_0xddb7('0x19')](_0xddb7('0x1a'),_0x21c068+'-'+_0x30950c+'/'+_0xbb7c67)['json'](_0x34f187);}return null;};}function patchUpdates(_0x404d76){return function(_0x82fcd2){try{jsonpatch['apply'](_0x82fcd2,_0x404d76,!![]);}catch(_0x425906){return BPromise['reject'](_0x425906);}return _0x82fcd2['save']();};}function saveUpdates(_0x435ad4,_0x2350bf){return function(_0x3b8e23){if(_0x3b8e23){return _0x3b8e23[_0xddb7('0x1b')](_0x435ad4)[_0xddb7('0x1c')](function(_0x4e5d54){return _0x4e5d54;});}return null;};}function removeEntity(_0x5c9ff4,_0x3fc76a){return function(_0x1f982e){if(_0x1f982e){return _0x1f982e[_0xddb7('0x1d')]()[_0xddb7('0x1c')](function(){_0x5c9ff4[_0xddb7('0x15')](0xcc)[_0xddb7('0x16')]();});}};}function handleEntityNotFound(_0x2a05dc,_0x3deead){return function(_0x55dbef){if(!_0x55dbef){_0x2a05dc[_0xddb7('0x14')](0x194);}return _0x55dbef;};}function handleError(_0x56187,_0x7abccf){_0x7abccf=_0x7abccf||0x1f4;return function(_0x65d4cb){logger[_0xddb7('0x1e')](_0x65d4cb[_0xddb7('0x1f')]);if(_0x65d4cb[_0xddb7('0x20')]){delete _0x65d4cb[_0xddb7('0x20')];}_0x56187[_0xddb7('0x15')](_0x7abccf)['send'](_0x65d4cb);};}exports['index']=function(_0x40cda1,_0x9f9256){var _0x562405={},_0x97f932={},_0x15f1b6={'count':0x0,'rows':[]};var _0x529388=_[_0xddb7('0x21')](db[_0xddb7('0x22')][_0xddb7('0x23')],function(_0x1cf269){return{'name':_0x1cf269['fieldName'],'type':_0x1cf269['type'][_0xddb7('0x24')]};});_0x97f932['model']=_['map'](_0x529388,'name');_0x97f932[_0xddb7('0x25')]=_[_0xddb7('0x26')](_0x40cda1[_0xddb7('0x25')]);_0x97f932[_0xddb7('0x27')]=_[_0xddb7('0x28')](_0x97f932[_0xddb7('0x29')],_0x97f932[_0xddb7('0x25')]);_0x562405[_0xddb7('0x2a')]=_[_0xddb7('0x28')](_0x97f932[_0xddb7('0x29')],qs['fields'](_0x40cda1[_0xddb7('0x25')]['fields']));_0x562405[_0xddb7('0x2a')]=_0x562405['attributes'][_0xddb7('0x2b')]?_0x562405[_0xddb7('0x2a')]:_0x97f932[_0xddb7('0x29')];if(!_0x40cda1[_0xddb7('0x25')][_0xddb7('0x2c')](_0xddb7('0x2d'))){_0x562405['limit']=qs[_0xddb7('0x2e')](_0x40cda1[_0xddb7('0x25')][_0xddb7('0x2e')]);_0x562405[_0xddb7('0x18')]=qs[_0xddb7('0x18')](_0x40cda1[_0xddb7('0x25')][_0xddb7('0x18')]);}_0x562405[_0xddb7('0x2f')]=qs[_0xddb7('0x30')](_0x40cda1[_0xddb7('0x25')]['sort']);_0x562405[_0xddb7('0x31')]=qs[_0xddb7('0x27')](_['pick'](_0x40cda1['query'],_0x97f932[_0xddb7('0x27')]),_0x529388);if(_0x40cda1[_0xddb7('0x25')][_0xddb7('0x32')]){_0x562405[_0xddb7('0x31')]=_[_0xddb7('0x33')](_0x562405[_0xddb7('0x31')],{'$or':_[_0xddb7('0x21')](_0x529388,function(_0xc6ed8c){if(_0xc6ed8c[_0xddb7('0x34')]!=='VIRTUAL'){var _0x1dabf0={};_0x1dabf0[_0xc6ed8c[_0xddb7('0x20')]]={'$like':'%'+_0x40cda1[_0xddb7('0x25')][_0xddb7('0x32')]+'%'};return _0x1dabf0;}})});}_0x562405=_[_0xddb7('0x33')]({},_0x562405,_0x40cda1[_0xddb7('0x35')]);var _0x5ba310={'where':_0x562405['where']};return db[_0xddb7('0x22')]['count'](_0x5ba310)[_0xddb7('0x1c')](function(_0x29092e){_0x15f1b6[_0xddb7('0x17')]=_0x29092e;if(_0x40cda1[_0xddb7('0x25')]['includeAll']){_0x562405[_0xddb7('0x36')]=[{'all':!![]}];}return db[_0xddb7('0x22')]['findAll'](_0x562405);})['then'](function(_0x531e72){_0x15f1b6[_0xddb7('0x37')]=_0x531e72;return _0x15f1b6;})[_0xddb7('0x1c')](respondWithFilteredResult(_0x9f9256,_0x562405))[_0xddb7('0x38')](handleError(_0x9f9256,null));};exports[_0xddb7('0x39')]=function(_0xdac4eb,_0xca3dfa){var _0x34db3e={'raw':!![],'where':{'id':_0xdac4eb[_0xddb7('0x3a')]['id']}},_0x23b93f={};_0x23b93f[_0xddb7('0x29')]=_[_0xddb7('0x26')](db['OpenchannelApplication'][_0xddb7('0x23')]);_0x23b93f[_0xddb7('0x25')]=_[_0xddb7('0x26')](_0xdac4eb['query']);_0x23b93f['filters']=_[_0xddb7('0x28')](_0x23b93f[_0xddb7('0x29')],_0x23b93f[_0xddb7('0x25')]);_0x34db3e[_0xddb7('0x2a')]=_[_0xddb7('0x28')](_0x23b93f[_0xddb7('0x29')],qs[_0xddb7('0x3b')](_0xdac4eb[_0xddb7('0x25')][_0xddb7('0x3b')]));_0x34db3e[_0xddb7('0x2a')]=_0x34db3e[_0xddb7('0x2a')]['length']?_0x34db3e[_0xddb7('0x2a')]:_0x23b93f[_0xddb7('0x29')];if(_0xdac4eb[_0xddb7('0x25')]['includeAll']){_0x34db3e[_0xddb7('0x36')]=[{'all':!![]}];}_0x34db3e=_[_0xddb7('0x33')]({},_0x34db3e,_0xdac4eb[_0xddb7('0x35')]);return db['OpenchannelApplication'][_0xddb7('0x3c')](_0x34db3e)[_0xddb7('0x1c')](handleEntityNotFound(_0xca3dfa,null))[_0xddb7('0x1c')](respondWithResult(_0xca3dfa,null))[_0xddb7('0x38')](handleError(_0xca3dfa,null));};exports['create']=function(_0x18c95b,_0x131be1){return db[_0xddb7('0x22')][_0xddb7('0x3d')](_0x18c95b[_0xddb7('0x3e')],{})[_0xddb7('0x1c')](respondWithResult(_0x131be1,0xc9))[_0xddb7('0x38')](handleError(_0x131be1,null));};exports['update']=function(_0x1c7bf7,_0x4e3583){if(_0x1c7bf7[_0xddb7('0x3e')]['id']){delete _0x1c7bf7[_0xddb7('0x3e')]['id'];}return db[_0xddb7('0x22')][_0xddb7('0x3c')]({'where':{'id':_0x1c7bf7[_0xddb7('0x3a')]['id']}})['then'](handleEntityNotFound(_0x4e3583,null))[_0xddb7('0x1c')](saveUpdates(_0x1c7bf7['body'],null))[_0xddb7('0x1c')](respondWithResult(_0x4e3583,null))['catch'](handleError(_0x4e3583,null));};exports[_0xddb7('0x1d')]=function(_0x2d9c95,_0x36fd9a){return db['OpenchannelApplication']['find']({'where':{'id':_0x2d9c95['params']['id']}})[_0xddb7('0x1c')](handleEntityNotFound(_0x36fd9a,null))[_0xddb7('0x1c')](removeEntity(_0x36fd9a,null))[_0xddb7('0x38')](handleError(_0x36fd9a,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 7ca0de0..d49a25a 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 _0x20fe=['rimraf','exports','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path'];(function(_0x35d294,_0x3a9b4){var _0xb9ae9a=function(_0x3c08ce){while(--_0x3c08ce){_0x35d294['push'](_0x35d294['shift']());}};_0xb9ae9a(++_0x3a9b4);}(_0x20fe,0x8a));var _0xe20f=function(_0x1ec009,_0x3340bc){_0x1ec009=_0x1ec009-0x0;var _0x419ec7=_0x20fe[_0x1ec009];return _0x419ec7;};'use strict';var _=require(_0xe20f('0x0'));var util=require(_0xe20f('0x1'));var logger=require('../../config/logger')(_0xe20f('0x2'));var moment=require('moment');var BPromise=require(_0xe20f('0x3'));var rp=require(_0xe20f('0x4'));var fs=require('fs');var path=require(_0xe20f('0x5'));var rimraf=require(_0xe20f('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0xe20f('0x7')]=function(_0x164142,_0x4d45aa){return _0x164142['define'](_0xe20f('0x8'),attributes,{'tableName':_0xe20f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe20f('0xa'),'collate':_0xe20f('0xb')});}; \ No newline at end of file +var _0x91de=['define','openchannel_applications','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./openchannelApplication.attributes','exports'];(function(_0x207910,_0x4450bc){var _0x487c56=function(_0x166d4b){while(--_0x166d4b){_0x207910['push'](_0x207910['shift']());}};_0x487c56(++_0x4450bc);}(_0x91de,0x115));var _0xe91d=function(_0x34ab95,_0x5e4bfb){_0x34ab95=_0x34ab95-0x0;var _0x7a3f82=_0x91de[_0x34ab95];return _0x7a3f82;};'use strict';var _=require(_0xe91d('0x0'));var util=require(_0xe91d('0x1'));var logger=require(_0xe91d('0x2'))(_0xe91d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe91d('0x4'));var fs=require('fs');var path=require(_0xe91d('0x5'));var rimraf=require('rimraf');var config=require(_0xe91d('0x6'));var attributes=require(_0xe91d('0x7'));module[_0xe91d('0x8')]=function(_0x4bff5a,_0x2d513e){return _0x4bff5a[_0xe91d('0x9')]('OpenchannelApplication',attributes,{'tableName':_0xe91d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 2599c7d..6020159 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 _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x1ad4c6,_0x1c6e4b){var _0x2a81c0=function(_0x2582b7){while(--_0x2582b7){_0x1ad4c6['push'](_0x1ad4c6['shift']());}};_0x2a81c0(++_0x1c6e4b);}(_0xb10b,0x12a));var _0xbb10=function(_0x123623,_0x9694e2){_0x123623=_0x123623-0x0;var _0x3b00d1=_0xb10b[_0x123623];return _0x3b00d1;};'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')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x3ca1c4,_0x4f0fc9){var _0x122abe=function(_0x179d3f){while(--_0x179d3f){_0x3ca1c4['push'](_0x3ca1c4['shift']());}};_0x122abe(++_0x4f0fc9);}(_0xb10b,0x12a));var _0xbb10=function(_0x392368,_0x1e14a5){_0x392368=_0x392368-0x0;var _0x33efe7=_0xb10b[_0x392368];return _0x33efe7;};'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')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 2cbbf8d..2e45d59 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 _0xb974=['openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','create','post','/:id/tags','tracked'];(function(_0x42eb4f,_0x3e1a17){var _0xb03f52=function(_0x270068){while(--_0x270068){_0x42eb4f['push'](_0x42eb4f['shift']());}};_0xb03f52(++_0x3e1a17);}(_0xb974,0x7c));var _0x4b97=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb974[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x4b97('0x0'));var util=require(_0x4b97('0x1'));var path=require('path');var timeout=require(_0x4b97('0x2'));var express=require(_0x4b97('0x3'));var router=express[_0x4b97('0x4')]();var auth=require(_0x4b97('0x5'));var interaction=require(_0x4b97('0x6'));var config=require(_0x4b97('0x7'));var controller=require(_0x4b97('0x8'));router[_0x4b97('0x9')]('/',auth[_0x4b97('0xa')](),controller['index']);router[_0x4b97('0x9')]('/describe',auth[_0x4b97('0xa')](),controller[_0x4b97('0xb')]);router[_0x4b97('0x9')](_0x4b97('0xc'),auth[_0x4b97('0xa')](),controller[_0x4b97('0xd')]);router[_0x4b97('0x9')](_0x4b97('0xe'),auth[_0x4b97('0xa')](),controller['getMessages']);router[_0x4b97('0x9')](_0x4b97('0xf'),auth['isAuthenticated'](),controller[_0x4b97('0x10')]);router['post']('/',auth[_0x4b97('0xa')](),controller[_0x4b97('0x11')]);router[_0x4b97('0x12')]('/:id/messages',auth[_0x4b97('0xa')](),controller['addMessage']);router[_0x4b97('0x12')](_0x4b97('0x13'),auth[_0x4b97('0xa')](),interaction[_0x4b97('0x14')]('openchannel',_0x4b97('0x15')),controller[_0x4b97('0x16')]);router[_0x4b97('0x17')](_0x4b97('0xc'),auth[_0x4b97('0xa')](),interaction[_0x4b97('0x14')]('openchannel',_0x4b97('0x18')),controller[_0x4b97('0x19')]);router[_0x4b97('0x1a')](_0x4b97('0xc'),auth[_0x4b97('0xa')](),interaction[_0x4b97('0x14')]('openchannel',_0x4b97('0x1b')),controller['destroy']);router[_0x4b97('0x1a')](_0x4b97('0x13'),auth[_0x4b97('0xa')](),controller['removeTags']);module[_0x4b97('0x1c')]=router; \ No newline at end of file +var _0x9049=['destroy','removeTags','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','show','/:id/messages','download','addMessage','post','/:id/tags','tracked','openchannel','addTags','put','openchannelinteraction:update','delete','/:id','openchannelinteraction:destroy'];(function(_0xd81a1c,_0x2737ed){var _0x4d40f4=function(_0x2eba45){while(--_0x2eba45){_0xd81a1c['push'](_0xd81a1c['shift']());}};_0x4d40f4(++_0x2737ed);}(_0x9049,0xfe));var _0x9904=function(_0x5709d4,_0x4b5c60){_0x5709d4=_0x5709d4-0x0;var _0x5a38fb=_0x9049[_0x5709d4];return _0x5a38fb;};'use strict';var multer=require(_0x9904('0x0'));var util=require(_0x9904('0x1'));var path=require(_0x9904('0x2'));var timeout=require(_0x9904('0x3'));var express=require(_0x9904('0x4'));var router=express[_0x9904('0x5')]();var auth=require(_0x9904('0x6'));var interaction=require(_0x9904('0x7'));var config=require(_0x9904('0x8'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0x9904('0x9')](),controller['index']);router[_0x9904('0xa')]('/describe',auth[_0x9904('0x9')](),controller[_0x9904('0xb')]);router[_0x9904('0xa')]('/:id',auth[_0x9904('0x9')](),controller[_0x9904('0xc')]);router[_0x9904('0xa')](_0x9904('0xd'),auth[_0x9904('0x9')](),controller['getMessages']);router[_0x9904('0xa')]('/:id/download',auth[_0x9904('0x9')](),controller[_0x9904('0xe')]);router['post']('/',auth[_0x9904('0x9')](),controller['create']);router['post']('/:id/messages',auth[_0x9904('0x9')](),controller[_0x9904('0xf')]);router[_0x9904('0x10')](_0x9904('0x11'),auth[_0x9904('0x9')](),interaction[_0x9904('0x12')](_0x9904('0x13'),'openchannelinteraction:addtags'),controller[_0x9904('0x14')]);router[_0x9904('0x15')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x9904('0x13'),_0x9904('0x16')),controller['update']);router[_0x9904('0x17')](_0x9904('0x18'),auth['isAuthenticated'](),interaction['tracked'](_0x9904('0x13'),_0x9904('0x19')),controller[_0x9904('0x1a')]);router[_0x9904('0x17')](_0x9904('0x11'),auth[_0x9904('0x9')](),controller[_0x9904('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index b0dcb4f..ff85431 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 _0x9956=['DATE','STRING','sequelize','BOOLEAN'];(function(_0xd2dd5d,_0x5a9f98){var _0x131e97=function(_0x32235a){while(--_0x32235a){_0xd2dd5d['push'](_0xd2dd5d['shift']());}};_0x131e97(++_0x5a9f98);}(_0x9956,0x1b6));var _0x6995=function(_0x32a6f7,_0x427b20){_0x32a6f7=_0x32a6f7-0x0;var _0x172190=_0x9956[_0x32a6f7];return _0x172190;};'use strict';var Sequelize=require(_0x6995('0x0'));module['exports']={'closed':{'type':Sequelize[_0x6995('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6995('0x2')]},'disposition':{'type':Sequelize[_0x6995('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6995('0x3')]},'note':{'type':Sequelize[_0x6995('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x6995('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x6995('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x6995('0x3')]}}; \ No newline at end of file +var _0x5e30=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0xff87f1,_0xadc52d){var _0x598e99=function(_0x44213a){while(--_0x44213a){_0xff87f1['push'](_0xff87f1['shift']());}};_0x598e99(++_0xadc52d);}(_0x5e30,0x7b));var _0x05e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e30[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x05e3('0x0'));module[_0x05e3('0x1')]={'closed':{'type':Sequelize[_0x05e3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x05e3('0x3')]},'disposition':{'type':Sequelize[_0x05e3('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x05e3('0x3')]},'threadId':{'type':Sequelize[_0x05e3('0x4')]},'externalUrl':{'type':Sequelize[_0x05e3('0x4')]},'lastMsgAt':{'type':Sequelize[_0x05e3('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x05e3('0x5')]('in',_0x05e3('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 8fbf88e..cc3d8c5 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 _0x0628=['c.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','groupBy','OpenchannelInteractionId','push','all','catch','show','params','includeAll','include','options','create','update','describe','addMessage','omit','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','rows','ids','spread','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','attachments','format','transcript-%d-%s.zip','firstName','lastName','Attachment','OpenchannelMessage','Messages','secret','Account','Owner','10px','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Openchannel','N.A.','closed','closedAt','disposition','Public','Private','existsSync','createReadStream','pipe','createWriteStream','basename','direction','out','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','json','apply','save','destroy','then','error','stack','name','fullname','TagIds','Tags','split','forEach','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','length','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','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','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','body','text','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','fields','Account.key','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','i.*','c.lastName','c.email','Contact.email'];(function(_0x3ccfe0,_0x5a5464){var _0x5216a5=function(_0x380b7e){while(--_0x380b7e){_0x3ccfe0['push'](_0x3ccfe0['shift']());}};_0x5216a5(++_0x5a5464);}(_0x0628,0x13d));var _0x8062=function(_0x1f84a8,_0x118028){_0x1f84a8=_0x1f84a8-0x0;var _0x59fc30=_0x0628[_0x1f84a8];return _0x59fc30;};'use strict';var pdf=require(_0x8062('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8062('0x1'));var jsonpatch=require(_0x8062('0x2'));var rp=require(_0x8062('0x3'));var moment=require(_0x8062('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8062('0x5'));var util=require(_0x8062('0x6'));var path=require(_0x8062('0x7'));var sox=require(_0x8062('0x8'));var csv=require(_0x8062('0x9'));var ejs=require(_0x8062('0xa'));var fs=require('fs');var _=require(_0x8062('0xb'));var squel=require(_0x8062('0xc'));var crypto=require(_0x8062('0xd'));var jsforce=require(_0x8062('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8062('0xf'));var Papa=require(_0x8062('0x10'));var Redis=require(_0x8062('0x11'));var authService=require(_0x8062('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8062('0x13'));var hardwareService=require(_0x8062('0x14'));var logger=require('../../config/logger')(_0x8062('0x15'));var utils=require(_0x8062('0x16'));var config=require(_0x8062('0x17'));var licenseUtil=require(_0x8062('0x18'));var db=require(_0x8062('0x19'))['db'];config['redis']=_['defaults'](config[_0x8062('0x1a')],{'host':_0x8062('0x1b'),'port':0x18eb});var socket=require(_0x8062('0x1c'))(new Redis(config[_0x8062('0x1a')]));require('./openchannelInteraction.socket')[_0x8062('0x1d')](socket);function respondWithStatusCode(_0x5439b4,_0x352527){_0x352527=_0x352527||0xcc;return function(_0x40c169){if(_0x40c169){return _0x5439b4[_0x8062('0x1e')](_0x352527);}return _0x5439b4[_0x8062('0x1f')](_0x352527)[_0x8062('0x20')]();};}function respondWithResult(_0x56fdb1,_0x4585dd){_0x4585dd=_0x4585dd||0xc8;return function(_0x25bf8d){if(_0x25bf8d){return _0x56fdb1[_0x8062('0x1f')](_0x4585dd)['json'](_0x25bf8d);}};}function respondWithFilteredResult(_0x43d226,_0x163175){return function(_0xa6ce71){if(_0xa6ce71){var _0x151847=_0xa6ce71[_0x8062('0x21')],_0x24f777=_0x163175[_0x8062('0x22')],_0x3762fc=_0x163175[_0x8062('0x22')]+_0x163175[_0x8062('0x23')],_0x23311e;if(_0x3762fc>=_0x151847){_0x3762fc=_0x151847;_0x23311e=0xc8;}else{_0x23311e=0xce;}_0x43d226['status'](_0x23311e);return _0x43d226['set']('Content-Range',_0x24f777+'-'+_0x3762fc+'/'+_0x151847)[_0x8062('0x24')](_0xa6ce71);}return null;};}function patchUpdates(_0x349740){return function(_0xef33cb){try{jsonpatch[_0x8062('0x25')](_0xef33cb,_0x349740,!![]);}catch(_0x48b028){return BPromise['reject'](_0x48b028);}return _0xef33cb[_0x8062('0x26')]();};}function saveUpdates(_0x319586,_0xff4dc){return function(_0x425956){if(_0x425956){return _0x425956['update'](_0x319586)['then'](function(_0x239287){return _0x239287;});}return null;};}function removeEntity(_0x16573a,_0x3e2d8d){return function(_0x523353){if(_0x523353){return _0x523353[_0x8062('0x27')]()[_0x8062('0x28')](function(){_0x16573a[_0x8062('0x1f')](0xcc)[_0x8062('0x20')]();});}};}function handleEntityNotFound(_0x5aa034,_0x500832){return function(_0x44e5dc){if(!_0x44e5dc){_0x5aa034[_0x8062('0x1e')](0x194);}return _0x44e5dc;};}function handleError(_0xc768bc,_0x5f51c5){_0x5f51c5=_0x5f51c5||0x1f4;return function(_0x149920){logger[_0x8062('0x29')](_0x149920[_0x8062('0x2a')]);if(_0x149920[_0x8062('0x2b')]){delete _0x149920[_0x8062('0x2b')];}_0xc768bc[_0x8062('0x1f')](_0x5f51c5)['send'](_0x149920);};}function getInteractionUsers(_0x459f62,_0x4cccd3){return new BPromise(function(_0x2c0f5f,_0x26d53f){try{if(_0x4cccd3[_0x459f62['id']]){_0x459f62['Users']=_['map'](_0x4cccd3[_0x459f62['id']],function(_0x2d82a9){return{'id':_0x2d82a9['id'],'fullname':_0x2d82a9[_0x8062('0x2c')]};});}}catch(_0x408364){_0x26d53f(_0x408364);}_0x2c0f5f(_0x459f62);});}function getInteractionTags(_0x31775c,_0x2bc40b){return new BPromise(function(_0x434fce,_0x14323a){try{if(_0x31775c[_0x8062('0x2d')]){_0x31775c[_0x8062('0x2e')]=[];_0x31775c[_0x8062('0x2d')][_0x8062('0x2f')](',')[_0x8062('0x30')](function(_0x4e9e46){_0x31775c[_0x8062('0x2e')]['push'](_0x2bc40b[_0x4e9e46]);});}delete _0x31775c[_0x8062('0x2d')];}catch(_0x30ef4f){_0x14323a(_0x30ef4f);}_0x434fce(_0x31775c);});}function updateOpenchannelInteraction(_0x45eb2a,_0x5cde49,_0x1757a3){return new BPromise(function(_0x3fc1dd,_0x524f25){return getInteractionUsers(_0x45eb2a,_0x1757a3)[_0x8062('0x28')](function(_0x4f96c5){return getInteractionTags(_0x4f96c5,_0x5cde49);})['then'](function(_0x3923b5){_0x3fc1dd(_0x3923b5);})['catch'](function(_0x1e6a99){_0x524f25(_0x1e6a99);});});}exports['index']=function(_0x1ebb0d,_0x35dcb4){var _0x19ddd8={},_0x4ed680={},_0x1a238a={'count':0x0,'rows':[]};var _0x6d6546=_[_0x8062('0x31')](db[_0x8062('0x32')][_0x8062('0x33')],function(_0x300941){return{'name':_0x300941[_0x8062('0x34')],'type':_0x300941[_0x8062('0x35')][_0x8062('0x36')]};});_0x4ed680[_0x8062('0x37')]=_[_0x8062('0x31')](_0x6d6546,_0x8062('0x2b'));_0x4ed680['query']=_[_0x8062('0x38')](_0x1ebb0d['query']);_0x4ed680[_0x8062('0x39')]=_[_0x8062('0x3a')](_0x4ed680['model'],_0x4ed680[_0x8062('0x3b')]);_0x19ddd8[_0x8062('0x3c')]=_['intersection'](_0x4ed680[_0x8062('0x37')],qs['fields'](_0x1ebb0d[_0x8062('0x3b')]['fields']));_0x19ddd8[_0x8062('0x3c')]=_0x19ddd8[_0x8062('0x3c')][_0x8062('0x3d')]?_0x19ddd8['attributes']:_0x4ed680[_0x8062('0x37')];if(!_0x1ebb0d[_0x8062('0x3b')]['hasOwnProperty'](_0x8062('0x3e'))){_0x19ddd8[_0x8062('0x23')]=qs[_0x8062('0x23')](_0x1ebb0d[_0x8062('0x3b')][_0x8062('0x23')]);_0x19ddd8[_0x8062('0x22')]=qs[_0x8062('0x22')](_0x1ebb0d['query']['offset']);}_0x19ddd8[_0x8062('0x3f')]=qs[_0x8062('0x40')](_0x1ebb0d['query']['sort']);_0x19ddd8[_0x8062('0x41')]=qs[_0x8062('0x39')](_[_0x8062('0x42')](_0x1ebb0d[_0x8062('0x3b')],_0x4ed680[_0x8062('0x39')]),_0x6d6546);var _0x220c0b=[];var _0x502241=squel[_0x8062('0x43')]()[_0x8062('0x44')]('id')[_0x8062('0x44')]('name')['field']('color')[_0x8062('0x45')](_0x8062('0x46'));var _0x57182b=squel[_0x8062('0x43')]()[_0x8062('0x44')](_0x8062('0x47'))[_0x8062('0x44')](_0x8062('0x48'))[_0x8062('0x44')](_0x8062('0x49'))[_0x8062('0x45')](_0x8062('0x4a'),'ui')[_0x8062('0x4b')](_0x8062('0x4c'),'u',_0x8062('0x4d'));var _0x38f06c=squel[_0x8062('0x43')]()[_0x8062('0x45')](_0x8062('0x4e'),'i')[_0x8062('0x4b')](_0x8062('0x4f'),'c',_0x8062('0x50'))[_0x8062('0x4b')]('users','o',_0x8062('0x51'))['left_join'](_0x8062('0x52'),'a',_0x8062('0x53'))[_0x8062('0x4b')](_0x8062('0x54'),'me',_0x8062('0x55'))[_0x8062('0x4b')](_0x8062('0x56'),'it',_0x8062('0x57'))['left_join']('tools_tags','t',_0x8062('0x58'));var _0x593709=squel[_0x8062('0x59')]();var _0xe7d5eb=[];var _0x1bb16c=squel['expr']();var _0xd76f83;if(_0x1ebb0d['query'][_0x8062('0x5a')]){_0xd76f83=as[_0x8062('0x5b')](_0x1ebb0d[_0x8062('0x3b')][_0x8062('0x5a')]);var _0x2e61ff=_0xd76f83[_0x8062('0x5c')];for(var _0x466a40=0x0;_0x466a40<_0xd76f83[_0x8062('0x5d')]['length'];_0x466a40++){var _0x486937=_0xd76f83[_0x8062('0x5d')][_0x466a40];var _0xf46a61='i';var _0x4156fb=_[_0x8062('0x5e')](_0x6d6546,[_0x8062('0x2b'),_0x486937[_0x8062('0x44')]]);if(!_0x4156fb){switch(_0x486937['field']){case _0x8062('0x5f'):if(_0x486937[_0x8062('0x60')]==0x1){_0x38f06c[_0x8062('0x61')]('`'+_0x486937[_0x8062('0x44')]+_0x8062('0x62'));}else{_0x38f06c[_0x8062('0x61')]('`'+_0x486937[_0x8062('0x44')]+_0x8062('0x63'));}break;case _0x8062('0x64'):if(_0x486937[_0x8062('0x65')]===_0x8062('0x66')){if(_0x486937['value'][_0x8062('0x2f')]('\x20')[_0x8062('0x3d')]>0x1){_0x593709[_0x2e61ff]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8062('0x67')](_0x486937['value']),null);}else{var _0x360d4f='%'+_0x486937[_0x8062('0x60')]+'%';_0x593709[_0x2e61ff](_0x8062('0x68'),_0x360d4f,_0x360d4f,_0x360d4f);}}else{_0x4156fb=_[_0x8062('0x5e')](_0x6d6546,[_0x8062('0x2b'),_0x8062('0x69')]);_0x486937[_0x8062('0x44')]=_0x8062('0x69');_0x55328e=as[_0x8062('0x6a')](_0xf46a61,_0x4156fb[_0x8062('0x35')],_0x486937);_0x593709[_0x2e61ff](_0x55328e['text'],_0x55328e[_0x8062('0x60')][_0x8062('0x6b')],_0x55328e[_0x8062('0x60')][_0x8062('0x20')]);}break;case _0x8062('0x6c'):var _0x26faf7=_0x486937['value'][_0x8062('0x2f')](',')['map'](function(_0xff1f1e){return Number(_0xff1f1e);});_0x26faf7['forEach'](function(_0x4beb6b){_0x1bb16c['or'](_0x8062('0x6d'),'%,'+_0x4beb6b+',%');});_0xe7d5eb=_[_0x8062('0x6e')](_0xe7d5eb,_0x26faf7);break;case _0x8062('0x6f'):if(_0x486937[_0x8062('0x65')]===_0x8062('0x66')){_0x593709[_0x2e61ff]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x486937[_0x8062('0x60')]+'%',null);}else{_0x4156fb=_[_0x8062('0x5e')](_0x6d6546,[_0x8062('0x2b'),_0x8062('0x70')]);_0x486937[_0x8062('0x44')]=_0x8062('0x70');_0x55328e=as['buildExpression'](_0xf46a61,_0x4156fb[_0x8062('0x35')],_0x486937);_0x593709[_0x2e61ff](_0x55328e['text'],_0x55328e[_0x8062('0x60')][_0x8062('0x6b')],_0x55328e[_0x8062('0x60')][_0x8062('0x20')]);}break;case _0x8062('0x71'):_0x55328e=as[_0x8062('0x6a')]('me',null,_0x486937);_0x593709[_0x2e61ff](_0x55328e['text'],_0x55328e[_0x8062('0x60')][_0x8062('0x6b')],_0x55328e[_0x8062('0x60')][_0x8062('0x20')]);break;}}else{var _0x55328e=as['buildExpression'](_0xf46a61,_0x4156fb['type'],_0x486937);_0x593709[_0x2e61ff](_0x55328e[_0x8062('0x72')],_0x55328e['value'][_0x8062('0x6b')],_0x55328e[_0x8062('0x60')][_0x8062('0x20')]);}}}else{var _0x44d4d9=_(_0x1ebb0d[_0x8062('0x3b')])[_0x8062('0x38')]()['map'](function(_0x32c972){return _['some'](_0x6d6546,[_0x8062('0x2b'),_0x32c972])?_0x32c972:undefined;})[_0x8062('0x73')]()[_0x8062('0x60')]();if(!_[_0x8062('0x74')](_0x44d4d9)){_0x44d4d9['forEach'](function(_0xdc6f27){if(_0xdc6f27===_0x8062('0x75')){_0x38f06c[_0x8062('0x41')](_0x8062('0x76'),[][_0x8062('0x77')](_0x1ebb0d[_0x8062('0x3b')][_0xdc6f27]));}else if(_0xdc6f27===_0x8062('0x78')){var _0x32c6e6=JSON['parse'](_0x1ebb0d[_0x8062('0x3b')][_0xdc6f27])[_0x8062('0x79')];var _0x4e72f5=JSON[_0x8062('0x7a')](_0x1ebb0d[_0x8062('0x3b')][_0xdc6f27])[_0x8062('0x7b')];_0x38f06c[_0x8062('0x41')](_0x8062('0x7c'),_0x32c6e6,_0x4e72f5);}else{if(_0x1ebb0d[_0x8062('0x3b')][_0xdc6f27]===_0x8062('0x7d')){_0x38f06c['where']('i.'+_0xdc6f27+'\x20IS\x20NULL');}else{_0x38f06c[_0x8062('0x41')]('i.'+_0xdc6f27+_0x8062('0x7e'),_0x1ebb0d[_0x8062('0x3b')][_0xdc6f27]);}}});}if(_0x1ebb0d[_0x8062('0x3b')][_0x8062('0x7f')]){if(_0x1ebb0d[_0x8062('0x3b')][_0x8062('0x7f')]==0x1){_0x38f06c[_0x8062('0x61')](_0x8062('0x80'));}else{_0x38f06c['having'](_0x8062('0x81'));}}if(_0x1ebb0d[_0x8062('0x3b')][_0x8062('0x82')]){_0xe7d5eb=_[_0x8062('0x83')](_0x1ebb0d[_0x8062('0x3b')][_0x8062('0x82')])?_0x1ebb0d[_0x8062('0x3b')]['tag']:new Array(_0x1ebb0d['query'][_0x8062('0x82')]);_0xe7d5eb[_0x8062('0x30')](function(_0x5455e9){_0x1bb16c['or'](_0x8062('0x6d'),'%,'+_0x5455e9+',%');});}if(_0x1ebb0d[_0x8062('0x3b')][_0x8062('0x84')]){var _0x2ea9b0=_0x1ebb0d['query'][_0x8062('0x84')][_0x8062('0x85')]('\x5c','\x5c\x5c')[_0x8062('0x85')](/'/g,'\x27\x27');if(qs[_0x8062('0x86')](_0x2ea9b0)){_0x593709['or'](_0x8062('0x87'),_0x2ea9b0+'%');}else{_0x593709['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8062('0x67')](_0x2ea9b0))['or'](_0x8062('0x88'),_0x2ea9b0+'%')['or'](_0x8062('0x89'),_0x2ea9b0+'%');}}}_0x38f06c[_0x8062('0x41')](_0x593709);_0x38f06c['group'](_0x8062('0x8a'));var _0xb397c8={'type':db[_0x8062('0x8b')][_0x8062('0x8c')]['SELECT'],'raw':!![]};var _0x36650d=_0x38f06c[_0x8062('0x8d')]();_0x36650d[_0x8062('0x44')](_0x8062('0x8a'));_0x36650d[_0x8062('0x44')](_0x8062('0x8e'),_0x8062('0x5f'));if(_0x19ddd8[_0x8062('0x3f')]){_0x19ddd8[_0x8062('0x3f')][_0x8062('0x30')](function(_0x493618){var _0x47d366=_0x493618[0x0]===_0x8062('0x8f')?_0x493618[0x0]:'i.'+_0x493618[0x0];_0x38f06c[_0x8062('0x3f')](_0x47d366,_0x493618[0x1]==='DESC'?![]:!![]);});}if(!_[_0x8062('0x74')](_0xe7d5eb)){_0x38f06c[_0x8062('0x61')](_0x1bb16c);_0x36650d[_0x8062('0x41')]('t.id\x20IN\x20?',_0xe7d5eb);}BPromise[_0x8062('0x90')]()['then'](function(){if(!_0xd76f83){if(_0x1ebb0d[_0x8062('0x3b')][_0x8062('0x75')])return;_0x36650d[_0x8062('0x41')](_0x8062('0x91'));_0x38f06c['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x1ebb0d['user']['role']!==_0x8062('0x92'))return;return _0x1ebb0d[_0x8062('0x93')][_0x8062('0x94')]({'attributes':['id'],'raw':!![]})[_0x8062('0x28')](function(_0x52845d){if(_[_0x8062('0x74')](_0x52845d)){_0x36650d[_0x8062('0x41')](_0x8062('0x95'));_0x38f06c['where'](_0x8062('0x95'));}else{_0x36650d[_0x8062('0x41')](_0x8062('0x76'),_['map'](_0x52845d,'id'));_0x38f06c[_0x8062('0x41')](_0x8062('0x76'),_[_0x8062('0x31')](_0x52845d,'id'));}});})[_0x8062('0x28')](function(){if(_0x1ebb0d[_0x8062('0x93')][_0x8062('0x96')]===_0x8062('0x92')&&!_0xd76f83&&!_0x1ebb0d[_0x8062('0x3b')]['OpenchannelAccountId'])return[];return db[_0x8062('0x97')][_0x8062('0x3b')](_0x36650d[_0x8062('0x98')](),_0xb397c8);})[_0x8062('0x28')](function(_0xc369fd){_0x1a238a[_0x8062('0x21')]=_0xc369fd[_0x8062('0x3d')];if(_0x1a238a[_0x8062('0x21')]===0x0)return[];return db[_0x8062('0x97')][_0x8062('0x3b')](_0x502241['toString'](),_0xb397c8)[_0x8062('0x28')](function(_0x2d3dfc){_0x220c0b=_[_0x8062('0x99')](_0x2d3dfc,'id');_0xb397c8=_[_0x8062('0x9a')](_0xb397c8,{'model':db[_0x8062('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1ebb0d[_0x8062('0x3b')][_0x8062('0x9b')]){_0x19ddd8[_0x8062('0x3c')]['forEach'](function(_0x2aea3c){_0x38f06c[_0x8062('0x44')]('i.'+_0x2aea3c);});}else{_0x38f06c[_0x8062('0x44')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x38f06c['field']('a.key',_0x8062('0x9c'));_0x38f06c[_0x8062('0x44')]('a.mandatoryDisposition',_0x8062('0x9d'));_0x38f06c[_0x8062('0x44')](_0x8062('0x9e'),_0x8062('0x8f'));_0x38f06c['field'](_0x8062('0x9f'));_0x38f06c[_0x8062('0x44')]('c.firstName','Contact.firstName');_0x38f06c[_0x8062('0x44')](_0x8062('0xa0'),'Contact.lastName');_0x38f06c[_0x8062('0x44')](_0x8062('0xa1'),_0x8062('0xa2'));_0x38f06c[_0x8062('0x44')](_0x8062('0xa3'),'Contact.phone');_0x38f06c['field'](_0x8062('0xa4'),'Contact.mobile');_0x38f06c[_0x8062('0x44')](_0x8062('0xa5'),_0x8062('0xa6'));_0x38f06c[_0x8062('0x44')](_0x8062('0xa7'),_0x8062('0xa8'));_0x38f06c['field']('o.internal',_0x8062('0xa9'));_0x38f06c[_0x8062('0x44')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x8062('0x2d'));}if(_0x19ddd8[_0x8062('0x23')])_0x38f06c[_0x8062('0x23')](_0x19ddd8[_0x8062('0x23')]);if(_0x19ddd8[_0x8062('0x22')])_0x38f06c[_0x8062('0x22')](_0x19ddd8[_0x8062('0x22')]);return db[_0x8062('0x97')][_0x8062('0x3b')](_0x38f06c[_0x8062('0x98')](),_0xb397c8);})[_0x8062('0x28')](function(_0x34aacd){_0x57182b[_0x8062('0x41')]('ui.OpenchannelInteractionId\x20IN\x20?',_['map'](_0x34aacd,'id'));return db[_0x8062('0x97')][_0x8062('0x3b')](_0x57182b['toString'](),_0xb397c8)[_0x8062('0x28')](function(_0x14e292){var _0x3ad84c=_[_0x8062('0xaa')](_0x14e292,_0x8062('0xab'));var _0x253f72=[];_0x34aacd['forEach'](function(_0x38c2c5){_0x253f72[_0x8062('0xac')](updateOpenchannelInteraction(_0x38c2c5,_0x220c0b,_0x3ad84c));});return BPromise[_0x8062('0xad')](_0x253f72);});});})[_0x8062('0x28')](function(_0x35b056){_0x1a238a['rows']=_0x35b056;return _0x1a238a;})[_0x8062('0x28')](respondWithFilteredResult(_0x35dcb4,_0x19ddd8))[_0x8062('0xae')](handleError(_0x35dcb4,null));};exports[_0x8062('0xaf')]=function(_0xfd9a0c,_0x2de628){var _0x34b58e={};if(_0xfd9a0c[_0x8062('0x3b')][_0x8062('0x35')]&&_0xfd9a0c[_0x8062('0x3b')][_0x8062('0x35')]===_0x8062('0x45')){_0x34b58e[_0x8062('0x45')]=_0xfd9a0c[_0x8062('0xb0')]['id'];}else{_0x34b58e['id']=_0xfd9a0c[_0x8062('0xb0')]['id'];}var _0x24b144={'raw':![],'where':_0x34b58e},_0x251bf5={};_0x251bf5[_0x8062('0x37')]=_[_0x8062('0x38')](db[_0x8062('0x32')][_0x8062('0x33')]);_0x251bf5['query']=_[_0x8062('0x38')](_0xfd9a0c[_0x8062('0x3b')]);_0x251bf5[_0x8062('0x39')]=_['intersection'](_0x251bf5[_0x8062('0x37')],_0x251bf5[_0x8062('0x3b')]);_0x24b144[_0x8062('0x3c')]=_[_0x8062('0x3a')](_0x251bf5[_0x8062('0x37')],qs[_0x8062('0x9b')](_0xfd9a0c[_0x8062('0x3b')][_0x8062('0x9b')]));_0x24b144['attributes']=_0x24b144[_0x8062('0x3c')][_0x8062('0x3d')]?_0x24b144[_0x8062('0x3c')]:_0x251bf5['model'];if(_0xfd9a0c[_0x8062('0x3b')][_0x8062('0xb1')]){_0x24b144[_0x8062('0xb2')]=[{'all':!![]}];}_0x24b144=_[_0x8062('0x9a')]({},_0x24b144,_0xfd9a0c[_0x8062('0xb3')]);return db[_0x8062('0x32')][_0x8062('0x5e')](_0x24b144)['then'](handleEntityNotFound(_0x2de628,null))['then'](respondWithResult(_0x2de628,null))[_0x8062('0xae')](handleError(_0x2de628,null));};exports[_0x8062('0xb4')]=function(_0x2d3041,_0x4dadc4){return db['OpenchannelInteraction'][_0x8062('0xb4')](_0x2d3041[_0x8062('0x71')],{})['then'](respondWithResult(_0x4dadc4,0xc9))[_0x8062('0xae')](handleError(_0x4dadc4,null));};exports[_0x8062('0xb5')]=function(_0x51a37e,_0x21802c){if(_0x51a37e['body']['id']){delete _0x51a37e[_0x8062('0x71')]['id'];}return db[_0x8062('0x32')]['find']({'where':{'id':_0x51a37e['params']['id']}})[_0x8062('0x28')](handleEntityNotFound(_0x21802c,null))[_0x8062('0x28')](saveUpdates(_0x51a37e[_0x8062('0x71')],null))[_0x8062('0x28')](respondWithResult(_0x21802c,null))[_0x8062('0xae')](handleError(_0x21802c,null));};exports[_0x8062('0x27')]=function(_0x2999ff,_0x187c41){return db['OpenchannelInteraction']['find']({'where':{'id':_0x2999ff[_0x8062('0xb0')]['id']}})[_0x8062('0x28')](handleEntityNotFound(_0x187c41,null))[_0x8062('0x28')](removeEntity(_0x187c41,null))[_0x8062('0xae')](handleError(_0x187c41,null));};exports[_0x8062('0xb6')]=function(_0x44ac8e,_0x2036f6){return db[_0x8062('0x32')][_0x8062('0xb6')]()[_0x8062('0x28')](respondWithResult(_0x2036f6,null))['catch'](handleError(_0x2036f6,null));};exports[_0x8062('0xb7')]=function(_0x417250,_0x47458f,_0x1dae0f){return db['OpenchannelMessage']['find']({'where':{'id':_0x417250[_0x8062('0xb0')]['id']}})[_0x8062('0x28')](handleEntityNotFound(_0x47458f,null))[_0x8062('0x28')](function(_0x89738d){if(_0x89738d){return _0x89738d[_0x8062('0xb7')](_0x417250[_0x8062('0x71')]['ids'],_[_0x8062('0xb8')](_0x417250[_0x8062('0x71')],['ids','id'])||{});}})[_0x8062('0x28')](respondWithResult(_0x47458f,null))['catch'](handleError(_0x47458f,null));};exports[_0x8062('0xb9')]=function(_0x264165,_0x534da2,_0x82ff1e){var _0x395e14={'raw':![],'where':{}};var _0x8fb12c={};var _0x1409b7={'count':0x0,'rows':[]};return db[_0x8062('0x32')][_0x8062('0xba')]({'where':{'id':_0x264165[_0x8062('0xb0')]['id']}})[_0x8062('0x28')](handleEntityNotFound(_0x534da2,null))['then'](function(_0x458e2a){if(_0x458e2a){_0x8fb12c[_0x8062('0x37')]=_[_0x8062('0x38')](db['OpenchannelMessage'][_0x8062('0x33')]);_0x8fb12c[_0x8062('0x3b')]=_[_0x8062('0x38')](_0x264165[_0x8062('0x3b')]);_0x8fb12c[_0x8062('0x39')]=_[_0x8062('0x3a')](_0x8fb12c['model'],_0x8fb12c[_0x8062('0x3b')]);_0x395e14[_0x8062('0x3c')]=_['intersection'](_0x8fb12c[_0x8062('0x37')],qs[_0x8062('0x9b')](_0x264165[_0x8062('0x3b')]['fields']));_0x395e14[_0x8062('0x3c')]=_0x395e14['attributes'][_0x8062('0x3d')]?_0x395e14['attributes']:_0x8fb12c[_0x8062('0x37')];if(!_0x264165[_0x8062('0x3b')]['hasOwnProperty']('nolimit')){_0x395e14[_0x8062('0x23')]=qs['limit'](_0x264165[_0x8062('0x3b')][_0x8062('0x23')]);_0x395e14[_0x8062('0x22')]=qs[_0x8062('0x22')](_0x264165[_0x8062('0x3b')][_0x8062('0x22')]);}_0x395e14[_0x8062('0x3f')]=qs['sort'](_0x264165[_0x8062('0x3b')][_0x8062('0x40')]);_0x395e14[_0x8062('0x41')]=qs['filters'](_[_0x8062('0x42')](_0x264165[_0x8062('0x3b')],_0x8fb12c[_0x8062('0x39')]));_0x395e14[_0x8062('0x41')][_0x8062('0xab')]=_0x458e2a['id'];if(_0x264165[_0x8062('0x3b')][_0x8062('0x84')]){_0x395e14['where']=_['merge'](_0x395e14[_0x8062('0x41')],{'$or':_[_0x8062('0x31')](_0x395e14[_0x8062('0x3c')],function(_0x58f893){var _0xca5ef7={};_0xca5ef7[_0x58f893]={'$like':'%'+_0x264165[_0x8062('0x3b')][_0x8062('0x84')]+'%'};return _0xca5ef7;})});}if(_0x264165['query'][_0x8062('0x79')]){var _0x2f34cb=_0x264165[_0x8062('0x3b')][_0x8062('0x79')][_0x8062('0x2f')](',');var _0xe8a5={};_0xe8a5[_0x2f34cb[0x0]]={'$gte':moment(_0x2f34cb[0x1])['format'](_0x8062('0xbb'))};_0x395e14[_0x8062('0x41')]=_['merge'](_0x395e14[_0x8062('0x41')],_0xe8a5);}_0x395e14=_[_0x8062('0x9a')]({},_0x395e14,_0x264165[_0x8062('0xb3')]);return db['OpenchannelMessage'][_0x8062('0x21')]({'where':_0x395e14[_0x8062('0x41')]})[_0x8062('0x28')](function(_0x2cb5a7){_0x1409b7['count']=_0x2cb5a7;if(_0x264165[_0x8062('0x3b')][_0x8062('0xb1')]){_0x395e14['include']=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x395e14);})[_0x8062('0x28')](function(_0x5cea35){_0x1409b7[_0x8062('0xbc')]=_0x5cea35;return _0x1409b7;});}})[_0x8062('0x28')](respondWithFilteredResult(_0x534da2,_0x395e14))[_0x8062('0xae')](handleError(_0x534da2,null));};exports['addTags']=function(_0x21672c,_0x25cf68,_0x4a7550){return db[_0x8062('0x32')][_0x8062('0x5e')]({'where':{'id':_0x21672c['params']['id']}})['then'](handleEntityNotFound(_0x25cf68,null))[_0x8062('0x28')](function(_0x3c259d){if(_0x3c259d){return _0x3c259d['setTags'](_0x21672c[_0x8062('0x71')][_0x8062('0xbd')],_['omit'](_0x21672c[_0x8062('0x71')],['ids','id'])||{})[_0x8062('0xbe')](function(){return db['Tag'][_0x8062('0xbf')]({'attributes':['id',_0x8062('0x2b'),'color'],'where':{'id':_0x21672c[_0x8062('0x71')]['ids']}});})['then'](function(_0x228745){socket[_0x8062('0xc0')](_0x8062('0xc1'),{'id':Number(_0x21672c['params']['id']),'tags':_0x228745||[]});return{'id':Number(_0x21672c[_0x8062('0xb0')]['id']),'tags':_0x228745||[]};});}})[_0x8062('0x28')](respondWithResult(_0x25cf68,null))['catch'](handleError(_0x25cf68,null));};exports[_0x8062('0xc2')]=function(_0x16bd25,_0x3ef017,_0x3931f2){return db[_0x8062('0x32')][_0x8062('0x5e')]({'where':{'id':_0x16bd25['params']['id']}})['then'](handleEntityNotFound(_0x3ef017,null))['then'](function(_0x1e5ac0){if(_0x1e5ac0){return _0x1e5ac0[_0x8062('0xc2')](_0x16bd25[_0x8062('0x3b')][_0x8062('0xbd')]);}})[_0x8062('0x28')](respondWithStatusCode(_0x3ef017,null))[_0x8062('0xae')](handleError(_0x3ef017,null));};exports[_0x8062('0xc3')]=function(_0x4aba2f,_0x97d77f){var _0x1bd70e=moment()[_0x8062('0xc4')]()[_0x8062('0x98')]();var _0x17a199=path[_0x8062('0xc5')](config[_0x8062('0xc6')],'server',_0x8062('0xc7'),_0x8062('0xc8'));var _0x35b0ab=path[_0x8062('0xc5')](config[_0x8062('0xc6')],_0x8062('0xc9'),'files',_0x8062('0xca'));var _0x3ac5a2=path[_0x8062('0xc5')](_0x17a199,_0x1bd70e);var _0x21ecb0=util[_0x8062('0xcb')](_0x8062('0xcc'),_0x4aba2f[_0x8062('0xb0')]['id'],_0x1bd70e);var _0x495e3c=path['join'](_0x17a199,_0x21ecb0);var _0x312f62=[];_0x312f62['push']({'model':db[_0x8062('0x6f')],'as':_0x8062('0x6f'),'attributes':['id',_0x8062('0x2c')],'raw':!![]});_0x312f62[_0x8062('0xac')]({'model':db['CmContact'],'as':_0x8062('0x64'),'attributes':['id',_0x8062('0xcd'),_0x8062('0xce')],'raw':!![]});if(_0x4aba2f[_0x8062('0x3b')][_0x8062('0xca')]){_0x312f62[_0x8062('0xac')]({'model':db[_0x8062('0xcf')],'as':_0x8062('0xcf'),'raw':!![]});}var _0x1587e3=[{'model':db[_0x8062('0xd0')],'as':_0x8062('0xd1'),'attributes':['id',_0x8062('0x71'),_0x8062('0x78'),'direction',_0x8062('0xd2'),_0x8062('0x7f')],'include':_0x312f62}];_0x1587e3['push']({'model':db['OpenchannelAccount'],'as':_0x8062('0xd3'),'attributes':['id',_0x8062('0x2b')]});_0x1587e3['push']({'model':db['User'],'as':_0x8062('0xd4'),'attributes':['id',_0x8062('0x2c')]});return db[_0x8062('0x32')][_0x8062('0x5e')]({'where':{'id':_0x4aba2f[_0x8062('0xb0')]['id']},'include':_0x1587e3})['then'](handleEntityNotFound(_0x97d77f,null))['then'](function(_0x4c2316){if(_0x4c2316){var _0x4705ce=_0x4c2316['get']({'plain':!![]});fs['mkdirSync'](_0x3ac5a2);var _0x9d06a1={'format':'A4','border':_0x8062('0xd5'),'header':{'height':_0x8062('0xd6'),'contents':{'first':_0x8062('0xd7')}},'footer':{'height':_0x8062('0xd8'),'contents':{'default':util[_0x8062('0xcb')](_0x8062('0xd9'),util[_0x8062('0xcb')]('%s\x20#%d',_0x8062('0xda'),_0x4705ce['id']),moment()[_0x8062('0xcb')]('YYYY-MM-DD')[_0x8062('0x98')]())}}};var _0x44bc7f={'channel':_0x8062('0xda'),'account':_0x4705ce[_0x8062('0xd3')]['name'],'agent':_0x4705ce[_0x8062('0xd4')]?_0x4705ce[_0x8062('0xd4')][_0x8062('0x2c')]:_0x8062('0xdb'),'createdAt':moment(_0x4705ce[_0x8062('0x78')])[_0x8062('0xcb')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8062('0x98')](),'closedAt':_0x4705ce[_0x8062('0xdc')]?moment(_0x4705ce[_0x8062('0xdd')])[_0x8062('0xcb')](_0x8062('0xbb'))[_0x8062('0x98')]():'','disposition':_0x4705ce[_0x8062('0xde')],'visibility':_0x4705ce['threadId']?_0x8062('0xdf'):_0x8062('0xe0'),'messages':_(_0x4705ce[_0x8062('0xd1')])['filter']({'secret':![]})['map'](function(_0x264396){if(_0x264396['Attachment']){var _0xcf4e8d=path['join'](_0x35b0ab,_0x264396[_0x8062('0xcf')]['basename']);if(fs[_0x8062('0xe1')](_0xcf4e8d)){fs[_0x8062('0xe2')](_0xcf4e8d)[_0x8062('0xe3')](fs[_0x8062('0xe4')](path[_0x8062('0xc5')](_0x3ac5a2,_0x264396['Attachment'][_0x8062('0xe5')])));}}return{'date':moment(_0x264396[_0x8062('0x78')])['format'](_0x8062('0xbb'))[_0x8062('0x98')](),'sender':_0x264396[_0x8062('0xe6')]===_0x8062('0xe7')?_0x264396[_0x8062('0x6f')]?_0x264396[_0x8062('0x6f')][_0x8062('0x2c')]:'System':_0x264396['Contact'][_0x8062('0xcd')]+(_0x264396[_0x8062('0x64')]['lastName']?'\x20'+_0x264396[_0x8062('0x64')][_0x8062('0xce')]:''),'body':_0x264396['Attachment']?_0x264396[_0x8062('0xcf')][_0x8062('0xe5')]:_0x264396['body'],'direction':_0x264396[_0x8062('0xe6')]==='out'?'A':'C','secret':_0x264396[_0x8062('0xd2')],'read':_0x264396[_0x8062('0x7f')],'attachment':_0x264396['Attachment']};})[_0x8062('0x60')]()};return ejs['renderFile'](path[_0x8062('0xc5')](config[_0x8062('0xc6')],_0x8062('0xc9'),_0x8062('0xe8'),_0x8062('0xe9')),{'interaction':_0x44bc7f})[_0x8062('0x28')](function(_0x5dbc5b){return new BPromise(function(_0x36a527,_0x1a2c10){pdf[_0x8062('0xb4')](_0x5dbc5b,_0x9d06a1)[_0x8062('0xea')](path[_0x8062('0xc5')](_0x3ac5a2,_0x8062('0xeb')+_0x4705ce['id']+'-'+_0x1bd70e+_0x8062('0xec')),function(_0x10142f,_0x232762){if(_0x10142f)return _0x1a2c10(_0x10142f);_0x36a527(_0x232762);});});})[_0x8062('0x28')](function(){return new BPromise(function(_0x2e0c51,_0x9a8820){zipdir(_0x3ac5a2,{'saveTo':_0x495e3c},function(_0x23fda7,_0x2ff3f2){if(_0x23fda7)return _0x9a8820(_0x23fda7);return _0x2e0c51(_0x2ff3f2);});})[_0x8062('0x28')](function(){return new BPromise(function(_0x4ea629,_0x8aa59e){rimraf(_0x3ac5a2,function(_0x486006){if(_0x486006)_0x8aa59e(_0x486006);return _0x4ea629();});});})[_0x8062('0x28')](function(){return _0x97d77f[_0x8062('0xc3')](_0x495e3c,_0x21ecb0,function(_0x6fd2d9){if(_0x6fd2d9){console[_0x8062('0xed')](_0x8062('0xee'),_0x6fd2d9);}else{fs[_0x8062('0xef')](_0x495e3c);}});});});}else{return _0x97d77f[_0x8062('0x1e')](0xc8);}})[_0x8062('0xae')](handleError(_0x97d77f,null));}; \ No newline at end of file +var _0xd4dd=['type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','select','field','color','from','tools_tags','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','compact','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','group','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','keyBy','OpenchannelInteraction','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','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','rows','show','params','includeAll','include','merge','options','create','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','tmp','server','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','OpenchannelAccount','Account','Owner','get','10px','40px','30px','%s\x20#%d','Openchannel','YYYY-MM-DD','closed','closedAt','disposition','threadId','Public','Private','basename','pipe','createWriteStream','out','System','direction','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','sendStatus','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','catch','index','rawAttributes'];(function(_0x400322,_0x4353a8){var _0xfdd597=function(_0xd914b6){while(--_0xd914b6){_0x400322['push'](_0x400322['shift']());}};_0xfdd597(++_0x4353a8);}(_0xd4dd,0x1ad));var _0xdd4d=function(_0xa8010,_0x1b6797){_0xa8010=_0xa8010-0x0;var _0x80080a=_0xd4dd[_0xa8010];return _0x80080a;};'use strict';var pdf=require(_0xdd4d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdd4d('0x1'));var zipdir=require(_0xdd4d('0x2'));var jsonpatch=require(_0xdd4d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdd4d('0x4'));var Mustache=require('mustache');var util=require(_0xdd4d('0x5'));var path=require(_0xdd4d('0x6'));var sox=require(_0xdd4d('0x7'));var csv=require(_0xdd4d('0x8'));var ejs=require(_0xdd4d('0x9'));var fs=require('fs');var _=require(_0xdd4d('0xa'));var squel=require(_0xdd4d('0xb'));var crypto=require(_0xdd4d('0xc'));var jsforce=require(_0xdd4d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdd4d('0x8'));var querystring=require(_0xdd4d('0xe'));var Papa=require(_0xdd4d('0xf'));var Redis=require(_0xdd4d('0x10'));var authService=require(_0xdd4d('0x11'));var qs=require(_0xdd4d('0x12'));var as=require(_0xdd4d('0x13'));var hardwareService=require(_0xdd4d('0x14'));var logger=require(_0xdd4d('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xdd4d('0x16'));var licenseUtil=require(_0xdd4d('0x17'));var db=require(_0xdd4d('0x18'))['db'];config[_0xdd4d('0x19')]=_[_0xdd4d('0x1a')](config[_0xdd4d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xdd4d('0x1b'))(new Redis(config[_0xdd4d('0x19')]));require('./openchannelInteraction.socket')[_0xdd4d('0x1c')](socket);function respondWithStatusCode(_0x30e9c6,_0x3456cd){_0x3456cd=_0x3456cd||0xcc;return function(_0x180eb5){if(_0x180eb5){return _0x30e9c6['sendStatus'](_0x3456cd);}return _0x30e9c6['status'](_0x3456cd)[_0xdd4d('0x1d')]();};}function respondWithResult(_0x5301b3,_0x3b1ba2){_0x3b1ba2=_0x3b1ba2||0xc8;return function(_0x83f230){if(_0x83f230){return _0x5301b3[_0xdd4d('0x1e')](_0x3b1ba2)[_0xdd4d('0x1f')](_0x83f230);}};}function respondWithFilteredResult(_0x51ac16,_0xa8a25d){return function(_0x2d05ab){if(_0x2d05ab){var _0x49d1ff=_0x2d05ab[_0xdd4d('0x20')],_0x1f6449=_0xa8a25d[_0xdd4d('0x21')],_0xc394e0=_0xa8a25d[_0xdd4d('0x21')]+_0xa8a25d[_0xdd4d('0x22')],_0x27eee7;if(_0xc394e0>=_0x49d1ff){_0xc394e0=_0x49d1ff;_0x27eee7=0xc8;}else{_0x27eee7=0xce;}_0x51ac16[_0xdd4d('0x1e')](_0x27eee7);return _0x51ac16[_0xdd4d('0x23')](_0xdd4d('0x24'),_0x1f6449+'-'+_0xc394e0+'/'+_0x49d1ff)[_0xdd4d('0x1f')](_0x2d05ab);}return null;};}function patchUpdates(_0x1c3083){return function(_0x3fd7b3){try{jsonpatch['apply'](_0x3fd7b3,_0x1c3083,!![]);}catch(_0x52f860){return BPromise[_0xdd4d('0x25')](_0x52f860);}return _0x3fd7b3[_0xdd4d('0x26')]();};}function saveUpdates(_0x45c30e,_0x3f0fe0){return function(_0x330078){if(_0x330078){return _0x330078[_0xdd4d('0x27')](_0x45c30e)['then'](function(_0x8237c2){return _0x8237c2;});}return null;};}function removeEntity(_0x30c16d,_0x175ea6){return function(_0x3f7ce1){if(_0x3f7ce1){return _0x3f7ce1[_0xdd4d('0x28')]()[_0xdd4d('0x29')](function(){_0x30c16d['status'](0xcc)[_0xdd4d('0x1d')]();});}};}function handleEntityNotFound(_0x2b0ec7,_0x137341){return function(_0x8b0bef){if(!_0x8b0bef){_0x2b0ec7[_0xdd4d('0x2a')](0x194);}return _0x8b0bef;};}function handleError(_0x5cb5b7,_0x538f12){_0x538f12=_0x538f12||0x1f4;return function(_0x81a06c){logger['error'](_0x81a06c[_0xdd4d('0x2b')]);if(_0x81a06c[_0xdd4d('0x2c')]){delete _0x81a06c[_0xdd4d('0x2c')];}_0x5cb5b7[_0xdd4d('0x1e')](_0x538f12)[_0xdd4d('0x2d')](_0x81a06c);};}function getInteractionUsers(_0x5a6def,_0x3090ee){return new BPromise(function(_0x5cae6d,_0x353259){try{if(_0x3090ee[_0x5a6def['id']]){_0x5a6def[_0xdd4d('0x2e')]=_[_0xdd4d('0x2f')](_0x3090ee[_0x5a6def['id']],function(_0x594955){return{'id':_0x594955['id'],'fullname':_0x594955[_0xdd4d('0x30')]};});}}catch(_0x1b748d){_0x353259(_0x1b748d);}_0x5cae6d(_0x5a6def);});}function getInteractionTags(_0xf6f3dc,_0x498303){return new BPromise(function(_0x4526c1,_0x4fa00a){try{if(_0xf6f3dc['TagIds']){_0xf6f3dc['Tags']=[];_0xf6f3dc[_0xdd4d('0x31')][_0xdd4d('0x32')](',')[_0xdd4d('0x33')](function(_0xbc17ad){_0xf6f3dc[_0xdd4d('0x34')][_0xdd4d('0x35')](_0x498303[_0xbc17ad]);});}delete _0xf6f3dc[_0xdd4d('0x31')];}catch(_0x34b178){_0x4fa00a(_0x34b178);}_0x4526c1(_0xf6f3dc);});}function updateOpenchannelInteraction(_0x4cf1ae,_0x29831f,_0x1a0024){return new BPromise(function(_0x4072f2,_0x4eeb56){return getInteractionUsers(_0x4cf1ae,_0x1a0024)[_0xdd4d('0x29')](function(_0x2b400b){return getInteractionTags(_0x2b400b,_0x29831f);})[_0xdd4d('0x29')](function(_0x563783){_0x4072f2(_0x563783);})[_0xdd4d('0x36')](function(_0x14b12e){_0x4eeb56(_0x14b12e);});});}exports[_0xdd4d('0x37')]=function(_0x3f6c54,_0x2d618c){var _0x4e0f3e={},_0x46c312={},_0x55f121={'count':0x0,'rows':[]};var _0x293f06=_[_0xdd4d('0x2f')](db['OpenchannelInteraction'][_0xdd4d('0x38')],function(_0x52b706){return{'name':_0x52b706['fieldName'],'type':_0x52b706[_0xdd4d('0x39')][_0xdd4d('0x3a')]};});_0x46c312[_0xdd4d('0x3b')]=_[_0xdd4d('0x2f')](_0x293f06,_0xdd4d('0x2c'));_0x46c312[_0xdd4d('0x3c')]=_[_0xdd4d('0x3d')](_0x3f6c54[_0xdd4d('0x3c')]);_0x46c312[_0xdd4d('0x3e')]=_[_0xdd4d('0x3f')](_0x46c312['model'],_0x46c312[_0xdd4d('0x3c')]);_0x4e0f3e['attributes']=_[_0xdd4d('0x3f')](_0x46c312[_0xdd4d('0x3b')],qs[_0xdd4d('0x40')](_0x3f6c54[_0xdd4d('0x3c')]['fields']));_0x4e0f3e[_0xdd4d('0x41')]=_0x4e0f3e[_0xdd4d('0x41')][_0xdd4d('0x42')]?_0x4e0f3e[_0xdd4d('0x41')]:_0x46c312[_0xdd4d('0x3b')];if(!_0x3f6c54[_0xdd4d('0x3c')][_0xdd4d('0x43')]('nolimit')){_0x4e0f3e['limit']=qs[_0xdd4d('0x22')](_0x3f6c54['query'][_0xdd4d('0x22')]);_0x4e0f3e[_0xdd4d('0x21')]=qs[_0xdd4d('0x21')](_0x3f6c54[_0xdd4d('0x3c')][_0xdd4d('0x21')]);}_0x4e0f3e[_0xdd4d('0x44')]=qs[_0xdd4d('0x45')](_0x3f6c54['query'][_0xdd4d('0x45')]);_0x4e0f3e['where']=qs[_0xdd4d('0x3e')](_[_0xdd4d('0x46')](_0x3f6c54[_0xdd4d('0x3c')],_0x46c312[_0xdd4d('0x3e')]),_0x293f06);var _0x507326=[];var _0x72936d=squel[_0xdd4d('0x47')]()[_0xdd4d('0x48')]('id')[_0xdd4d('0x48')](_0xdd4d('0x2c'))[_0xdd4d('0x48')](_0xdd4d('0x49'))[_0xdd4d('0x4a')](_0xdd4d('0x4b'));var _0x274b07=squel[_0xdd4d('0x47')]()['field']('u.id')[_0xdd4d('0x48')]('u.fullname')[_0xdd4d('0x48')](_0xdd4d('0x4c'))['from'](_0xdd4d('0x4d'),'ui')[_0xdd4d('0x4e')](_0xdd4d('0x4f'),'u',_0xdd4d('0x50'));var _0x1b5a83=squel['select']()['from'](_0xdd4d('0x51'),'i')[_0xdd4d('0x4e')](_0xdd4d('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xdd4d('0x4e')]('users','o',_0xdd4d('0x53'))['left_join'](_0xdd4d('0x54'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xdd4d('0x4e')](_0xdd4d('0x55'),'me',_0xdd4d('0x56'))['left_join'](_0xdd4d('0x57'),'it',_0xdd4d('0x58'))['left_join'](_0xdd4d('0x4b'),'t',_0xdd4d('0x59'));var _0x620688=squel[_0xdd4d('0x5a')]();var _0x313b72=[];var _0x1bc0b3=squel[_0xdd4d('0x5a')]();var _0x10fc7b;if(_0x3f6c54[_0xdd4d('0x3c')]['search']){_0x10fc7b=as[_0xdd4d('0x5b')](_0x3f6c54[_0xdd4d('0x3c')][_0xdd4d('0x5c')]);var _0x540871=_0x10fc7b['sqlOperator'];for(var _0x44f19a=0x0;_0x44f19a<_0x10fc7b[_0xdd4d('0x5d')][_0xdd4d('0x42')];_0x44f19a++){var _0x4ab413=_0x10fc7b[_0xdd4d('0x5d')][_0x44f19a];var _0x2cf8ee='i';var _0x3c14ad=_[_0xdd4d('0x5e')](_0x293f06,[_0xdd4d('0x2c'),_0x4ab413['field']]);if(!_0x3c14ad){switch(_0x4ab413[_0xdd4d('0x48')]){case _0xdd4d('0x5f'):if(_0x4ab413[_0xdd4d('0x60')]==0x1){_0x1b5a83[_0xdd4d('0x61')]('`'+_0x4ab413[_0xdd4d('0x48')]+_0xdd4d('0x62'));}else{_0x1b5a83[_0xdd4d('0x61')]('`'+_0x4ab413['field']+_0xdd4d('0x63'));}break;case _0xdd4d('0x64'):if(_0x4ab413[_0xdd4d('0x65')]===_0xdd4d('0x66')){if(_0x4ab413[_0xdd4d('0x60')]['split']('\x20')[_0xdd4d('0x42')]>0x1){_0x620688[_0x540871]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xdd4d('0x67')](_0x4ab413[_0xdd4d('0x60')]),null);}else{var _0x229904='%'+_0x4ab413[_0xdd4d('0x60')]+'%';_0x620688[_0x540871](_0xdd4d('0x68'),_0x229904,_0x229904,_0x229904);}}else{_0x3c14ad=_[_0xdd4d('0x5e')](_0x293f06,[_0xdd4d('0x2c'),_0xdd4d('0x69')]);_0x4ab413[_0xdd4d('0x48')]=_0xdd4d('0x69');_0x475860=as['buildExpression'](_0x2cf8ee,_0x3c14ad[_0xdd4d('0x39')],_0x4ab413);_0x620688[_0x540871](_0x475860[_0xdd4d('0x6a')],_0x475860[_0xdd4d('0x60')][_0xdd4d('0x6b')],_0x475860[_0xdd4d('0x60')][_0xdd4d('0x1d')]);}break;case _0xdd4d('0x6c'):var _0x477ae0=_0x4ab413[_0xdd4d('0x60')][_0xdd4d('0x32')](',')['map'](function(_0x30bd05){return Number(_0x30bd05);});_0x477ae0[_0xdd4d('0x33')](function(_0x3296df){_0x1bc0b3['or'](_0xdd4d('0x6d'),'%,'+_0x3296df+',%');});_0x313b72=_[_0xdd4d('0x6e')](_0x313b72,_0x477ae0);break;case _0xdd4d('0x6f'):if(_0x4ab413[_0xdd4d('0x65')]===_0xdd4d('0x66')){_0x620688[_0x540871](_0xdd4d('0x70'),'%'+_0x4ab413['value']+'%',null);}else{_0x3c14ad=_[_0xdd4d('0x5e')](_0x293f06,[_0xdd4d('0x2c'),_0xdd4d('0x71')]);_0x4ab413[_0xdd4d('0x48')]=_0xdd4d('0x71');_0x475860=as[_0xdd4d('0x72')](_0x2cf8ee,_0x3c14ad[_0xdd4d('0x39')],_0x4ab413);_0x620688[_0x540871](_0x475860[_0xdd4d('0x6a')],_0x475860[_0xdd4d('0x60')]['start'],_0x475860[_0xdd4d('0x60')][_0xdd4d('0x1d')]);}break;case _0xdd4d('0x73'):_0x475860=as[_0xdd4d('0x72')]('me',null,_0x4ab413);_0x620688[_0x540871](_0x475860[_0xdd4d('0x6a')],_0x475860[_0xdd4d('0x60')][_0xdd4d('0x6b')],_0x475860[_0xdd4d('0x60')][_0xdd4d('0x1d')]);break;}}else{var _0x475860=as[_0xdd4d('0x72')](_0x2cf8ee,_0x3c14ad[_0xdd4d('0x39')],_0x4ab413);_0x620688[_0x540871](_0x475860[_0xdd4d('0x6a')],_0x475860[_0xdd4d('0x60')][_0xdd4d('0x6b')],_0x475860['value'][_0xdd4d('0x1d')]);}}}else{var _0x287409=_(_0x3f6c54['query'])[_0xdd4d('0x3d')]()['map'](function(_0x464604){return _[_0xdd4d('0x74')](_0x293f06,[_0xdd4d('0x2c'),_0x464604])?_0x464604:undefined;})[_0xdd4d('0x75')]()[_0xdd4d('0x60')]();if(!_[_0xdd4d('0x76')](_0x287409)){_0x287409[_0xdd4d('0x33')](function(_0x4f727a){if(_0x4f727a===_0xdd4d('0x77')){_0x1b5a83[_0xdd4d('0x78')](_0xdd4d('0x79'),[][_0xdd4d('0x7a')](_0x3f6c54[_0xdd4d('0x3c')][_0x4f727a]));}else if(_0x4f727a===_0xdd4d('0x7b')){var _0x43a10f=JSON[_0xdd4d('0x7c')](_0x3f6c54[_0xdd4d('0x3c')][_0x4f727a])[_0xdd4d('0x7d')];var _0x3a28fd=JSON[_0xdd4d('0x7c')](_0x3f6c54[_0xdd4d('0x3c')][_0x4f727a])['$lte'];_0x1b5a83['where'](_0xdd4d('0x7e'),_0x43a10f,_0x3a28fd);}else{if(_0x3f6c54[_0xdd4d('0x3c')][_0x4f727a]===_0xdd4d('0x7f')){_0x1b5a83[_0xdd4d('0x78')]('i.'+_0x4f727a+_0xdd4d('0x80'));}else{_0x1b5a83['where']('i.'+_0x4f727a+_0xdd4d('0x81'),_0x3f6c54[_0xdd4d('0x3c')][_0x4f727a]);}}});}if(_0x3f6c54[_0xdd4d('0x3c')][_0xdd4d('0x82')]){if(_0x3f6c54[_0xdd4d('0x3c')][_0xdd4d('0x82')]==0x1){_0x1b5a83['having']('`unreadMessages`\x20=\x200');}else{_0x1b5a83[_0xdd4d('0x61')](_0xdd4d('0x83'));}}if(_0x3f6c54[_0xdd4d('0x3c')]['tag']){_0x313b72=_[_0xdd4d('0x84')](_0x3f6c54['query'][_0xdd4d('0x85')])?_0x3f6c54['query'][_0xdd4d('0x85')]:new Array(_0x3f6c54[_0xdd4d('0x3c')][_0xdd4d('0x85')]);_0x313b72[_0xdd4d('0x33')](function(_0xfce34c){_0x1bc0b3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xfce34c+',%');});}if(_0x3f6c54[_0xdd4d('0x3c')][_0xdd4d('0x86')]){var _0x3d8aaf=_0x3f6c54[_0xdd4d('0x3c')][_0xdd4d('0x86')]['replace']('\x5c','\x5c\x5c')[_0xdd4d('0x87')](/'/g,'\x27\x27');if(qs[_0xdd4d('0x88')](_0x3d8aaf)){_0x620688['or'](_0xdd4d('0x89'),_0x3d8aaf+'%');}else{_0x620688['or'](_0xdd4d('0x8a'),qs[_0xdd4d('0x67')](_0x3d8aaf))['or'](_0xdd4d('0x8b'),_0x3d8aaf+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3d8aaf+'%');}}}_0x1b5a83[_0xdd4d('0x78')](_0x620688);_0x1b5a83[_0xdd4d('0x8c')](_0xdd4d('0x8d'));var _0x1edbfb={'type':db['Sequelize']['QueryTypes'][_0xdd4d('0x8e')],'raw':!![]};var _0x126316=_0x1b5a83[_0xdd4d('0x8f')]();_0x126316['field'](_0xdd4d('0x8d'));_0x126316[_0xdd4d('0x48')](_0xdd4d('0x90'),'unreadMessages');if(_0x4e0f3e['order']){_0x4e0f3e[_0xdd4d('0x44')]['forEach'](function(_0x535c27){var _0x36ea25=_0x535c27[0x0]===_0xdd4d('0x91')?_0x535c27[0x0]:'i.'+_0x535c27[0x0];_0x1b5a83[_0xdd4d('0x44')](_0x36ea25,_0x535c27[0x1]===_0xdd4d('0x92')?![]:!![]);});}if(!_[_0xdd4d('0x76')](_0x313b72)){_0x1b5a83[_0xdd4d('0x61')](_0x1bc0b3);_0x126316[_0xdd4d('0x78')]('t.id\x20IN\x20?',_0x313b72);}BPromise['resolve']()[_0xdd4d('0x29')](function(){if(!_0x10fc7b){if(_0x3f6c54['query'][_0xdd4d('0x77')])return;_0x126316[_0xdd4d('0x78')](_0xdd4d('0x93'));_0x1b5a83['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x3f6c54[_0xdd4d('0x94')][_0xdd4d('0x95')]!==_0xdd4d('0x96'))return;return _0x3f6c54[_0xdd4d('0x94')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xdd4d('0x29')](function(_0x38c7bf){if(_['isEmpty'](_0x38c7bf)){_0x126316[_0xdd4d('0x78')](_0xdd4d('0x97'));_0x1b5a83[_0xdd4d('0x78')](_0xdd4d('0x97'));}else{_0x126316['where']('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x38c7bf,'id'));_0x1b5a83[_0xdd4d('0x78')](_0xdd4d('0x79'),_['map'](_0x38c7bf,'id'));}});})[_0xdd4d('0x29')](function(){if(_0x3f6c54[_0xdd4d('0x94')][_0xdd4d('0x95')]===_0xdd4d('0x96')&&!_0x10fc7b&&!_0x3f6c54[_0xdd4d('0x3c')][_0xdd4d('0x77')])return[];return db['sequelize'][_0xdd4d('0x3c')](_0x126316[_0xdd4d('0x98')](),_0x1edbfb);})[_0xdd4d('0x29')](function(_0x3439d0){_0x55f121[_0xdd4d('0x20')]=_0x3439d0[_0xdd4d('0x42')];if(_0x55f121[_0xdd4d('0x20')]===0x0)return[];return db[_0xdd4d('0x99')][_0xdd4d('0x3c')](_0x72936d['toString'](),_0x1edbfb)[_0xdd4d('0x29')](function(_0x322b4b){_0x507326=_[_0xdd4d('0x9a')](_0x322b4b,'id');_0x1edbfb=_['merge'](_0x1edbfb,{'model':db[_0xdd4d('0x9b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3f6c54['query'][_0xdd4d('0x40')]){_0x4e0f3e[_0xdd4d('0x41')][_0xdd4d('0x33')](function(_0x579658){_0x1b5a83['field']('i.'+_0x579658);});}else{_0x1b5a83[_0xdd4d('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x1b5a83['field'](_0xdd4d('0x9c'),_0xdd4d('0x9d'));_0x1b5a83[_0xdd4d('0x48')](_0xdd4d('0x9e'),_0xdd4d('0x9f'));_0x1b5a83[_0xdd4d('0x48')](_0xdd4d('0xa0'),_0xdd4d('0x91'));_0x1b5a83['field'](_0xdd4d('0xa1'));_0x1b5a83[_0xdd4d('0x48')](_0xdd4d('0xa2'),_0xdd4d('0xa3'));_0x1b5a83[_0xdd4d('0x48')](_0xdd4d('0xa4'),_0xdd4d('0xa5'));_0x1b5a83['field'](_0xdd4d('0xa6'),_0xdd4d('0xa7'));_0x1b5a83[_0xdd4d('0x48')]('c.phone',_0xdd4d('0xa8'));_0x1b5a83[_0xdd4d('0x48')](_0xdd4d('0xa9'),'Contact.mobile');_0x1b5a83[_0xdd4d('0x48')]('c.fax',_0xdd4d('0xaa'));_0x1b5a83[_0xdd4d('0x48')](_0xdd4d('0xab'),_0xdd4d('0xac'));_0x1b5a83[_0xdd4d('0x48')](_0xdd4d('0xad'),_0xdd4d('0xae'));_0x1b5a83[_0xdd4d('0x48')](_0xdd4d('0xaf'),'TagIds');}if(_0x4e0f3e[_0xdd4d('0x22')])_0x1b5a83[_0xdd4d('0x22')](_0x4e0f3e[_0xdd4d('0x22')]);if(_0x4e0f3e[_0xdd4d('0x21')])_0x1b5a83[_0xdd4d('0x21')](_0x4e0f3e['offset']);return db[_0xdd4d('0x99')][_0xdd4d('0x3c')](_0x1b5a83['toString'](),_0x1edbfb);})[_0xdd4d('0x29')](function(_0x147486){_0x274b07[_0xdd4d('0x78')](_0xdd4d('0xb0'),_['map'](_0x147486,'id'));return db[_0xdd4d('0x99')][_0xdd4d('0x3c')](_0x274b07[_0xdd4d('0x98')](),_0x1edbfb)[_0xdd4d('0x29')](function(_0x12225e){var _0x3f4d12=_['groupBy'](_0x12225e,_0xdd4d('0xb1'));var _0x3b1a8c=[];_0x147486[_0xdd4d('0x33')](function(_0x4d2bf0){_0x3b1a8c[_0xdd4d('0x35')](updateOpenchannelInteraction(_0x4d2bf0,_0x507326,_0x3f4d12));});return BPromise[_0xdd4d('0xb2')](_0x3b1a8c);});});})[_0xdd4d('0x29')](function(_0x29ac03){_0x55f121[_0xdd4d('0xb3')]=_0x29ac03;return _0x55f121;})[_0xdd4d('0x29')](respondWithFilteredResult(_0x2d618c,_0x4e0f3e))[_0xdd4d('0x36')](handleError(_0x2d618c,null));};exports[_0xdd4d('0xb4')]=function(_0x27929e,_0x2ca6f4){var _0x2e2512={};if(_0x27929e['query'][_0xdd4d('0x39')]&&_0x27929e['query'][_0xdd4d('0x39')]===_0xdd4d('0x4a')){_0x2e2512['from']=_0x27929e[_0xdd4d('0xb5')]['id'];}else{_0x2e2512['id']=_0x27929e['params']['id'];}var _0x2830cf={'raw':![],'where':_0x2e2512},_0x51456a={};_0x51456a[_0xdd4d('0x3b')]=_[_0xdd4d('0x3d')](db[_0xdd4d('0x9b')]['rawAttributes']);_0x51456a[_0xdd4d('0x3c')]=_['keys'](_0x27929e[_0xdd4d('0x3c')]);_0x51456a['filters']=_['intersection'](_0x51456a['model'],_0x51456a[_0xdd4d('0x3c')]);_0x2830cf[_0xdd4d('0x41')]=_['intersection'](_0x51456a['model'],qs[_0xdd4d('0x40')](_0x27929e['query'][_0xdd4d('0x40')]));_0x2830cf['attributes']=_0x2830cf[_0xdd4d('0x41')][_0xdd4d('0x42')]?_0x2830cf[_0xdd4d('0x41')]:_0x51456a[_0xdd4d('0x3b')];if(_0x27929e['query'][_0xdd4d('0xb6')]){_0x2830cf[_0xdd4d('0xb7')]=[{'all':!![]}];}_0x2830cf=_[_0xdd4d('0xb8')]({},_0x2830cf,_0x27929e[_0xdd4d('0xb9')]);return db['OpenchannelInteraction'][_0xdd4d('0x5e')](_0x2830cf)['then'](handleEntityNotFound(_0x2ca6f4,null))[_0xdd4d('0x29')](respondWithResult(_0x2ca6f4,null))[_0xdd4d('0x36')](handleError(_0x2ca6f4,null));};exports[_0xdd4d('0xba')]=function(_0x1241cb,_0x311daf){return db[_0xdd4d('0x9b')][_0xdd4d('0xba')](_0x1241cb[_0xdd4d('0x73')],{})['then'](respondWithResult(_0x311daf,0xc9))[_0xdd4d('0x36')](handleError(_0x311daf,null));};exports[_0xdd4d('0x27')]=function(_0x5c4fc0,_0x4df9fa){if(_0x5c4fc0[_0xdd4d('0x73')]['id']){delete _0x5c4fc0[_0xdd4d('0x73')]['id'];}return db[_0xdd4d('0x9b')][_0xdd4d('0x5e')]({'where':{'id':_0x5c4fc0[_0xdd4d('0xb5')]['id']}})[_0xdd4d('0x29')](handleEntityNotFound(_0x4df9fa,null))[_0xdd4d('0x29')](saveUpdates(_0x5c4fc0[_0xdd4d('0x73')],null))[_0xdd4d('0x29')](respondWithResult(_0x4df9fa,null))['catch'](handleError(_0x4df9fa,null));};exports[_0xdd4d('0x28')]=function(_0x4dba14,_0x3b475d){return db[_0xdd4d('0x9b')][_0xdd4d('0x5e')]({'where':{'id':_0x4dba14[_0xdd4d('0xb5')]['id']}})[_0xdd4d('0x29')](handleEntityNotFound(_0x3b475d,null))[_0xdd4d('0x29')](removeEntity(_0x3b475d,null))[_0xdd4d('0x36')](handleError(_0x3b475d,null));};exports[_0xdd4d('0xbb')]=function(_0x2ef92e,_0x44156b){return db[_0xdd4d('0x9b')][_0xdd4d('0xbb')]()['then'](respondWithResult(_0x44156b,null))[_0xdd4d('0x36')](handleError(_0x44156b,null));};exports['addMessage']=function(_0x5aeeeb,_0x2acb5f,_0x2c81cc){return db[_0xdd4d('0xbc')]['find']({'where':{'id':_0x5aeeeb['params']['id']}})['then'](handleEntityNotFound(_0x2acb5f,null))[_0xdd4d('0x29')](function(_0x5b7244){if(_0x5b7244){return _0x5b7244[_0xdd4d('0xbd')](_0x5aeeeb[_0xdd4d('0x73')][_0xdd4d('0xbe')],_[_0xdd4d('0xbf')](_0x5aeeeb[_0xdd4d('0x73')],[_0xdd4d('0xbe'),'id'])||{});}})['then'](respondWithResult(_0x2acb5f,null))[_0xdd4d('0x36')](handleError(_0x2acb5f,null));};exports[_0xdd4d('0xc0')]=function(_0x56d1ed,_0x4c4753,_0x4fc16c){var _0x3c4021={'raw':![],'where':{}};var _0x1df0e4={};var _0x176aeb={'count':0x0,'rows':[]};return db[_0xdd4d('0x9b')][_0xdd4d('0xc1')]({'where':{'id':_0x56d1ed[_0xdd4d('0xb5')]['id']}})[_0xdd4d('0x29')](handleEntityNotFound(_0x4c4753,null))[_0xdd4d('0x29')](function(_0x15b377){if(_0x15b377){_0x1df0e4[_0xdd4d('0x3b')]=_[_0xdd4d('0x3d')](db[_0xdd4d('0xbc')][_0xdd4d('0x38')]);_0x1df0e4[_0xdd4d('0x3c')]=_['keys'](_0x56d1ed[_0xdd4d('0x3c')]);_0x1df0e4[_0xdd4d('0x3e')]=_['intersection'](_0x1df0e4[_0xdd4d('0x3b')],_0x1df0e4[_0xdd4d('0x3c')]);_0x3c4021[_0xdd4d('0x41')]=_[_0xdd4d('0x3f')](_0x1df0e4[_0xdd4d('0x3b')],qs['fields'](_0x56d1ed[_0xdd4d('0x3c')][_0xdd4d('0x40')]));_0x3c4021[_0xdd4d('0x41')]=_0x3c4021['attributes'][_0xdd4d('0x42')]?_0x3c4021[_0xdd4d('0x41')]:_0x1df0e4['model'];if(!_0x56d1ed[_0xdd4d('0x3c')]['hasOwnProperty']('nolimit')){_0x3c4021[_0xdd4d('0x22')]=qs[_0xdd4d('0x22')](_0x56d1ed[_0xdd4d('0x3c')][_0xdd4d('0x22')]);_0x3c4021[_0xdd4d('0x21')]=qs[_0xdd4d('0x21')](_0x56d1ed[_0xdd4d('0x3c')][_0xdd4d('0x21')]);}_0x3c4021[_0xdd4d('0x44')]=qs[_0xdd4d('0x45')](_0x56d1ed['query'][_0xdd4d('0x45')]);_0x3c4021['where']=qs['filters'](_[_0xdd4d('0x46')](_0x56d1ed[_0xdd4d('0x3c')],_0x1df0e4['filters']));_0x3c4021['where'][_0xdd4d('0xb1')]=_0x15b377['id'];if(_0x56d1ed['query'][_0xdd4d('0x86')]){_0x3c4021['where']=_['merge'](_0x3c4021['where'],{'$or':_['map'](_0x3c4021[_0xdd4d('0x41')],function(_0x24bd9e){var _0x534700={};_0x534700[_0x24bd9e]={'$like':'%'+_0x56d1ed[_0xdd4d('0x3c')]['filter']+'%'};return _0x534700;})});}if(_0x56d1ed['query'][_0xdd4d('0x7d')]){var _0x1a8738=_0x56d1ed[_0xdd4d('0x3c')][_0xdd4d('0x7d')][_0xdd4d('0x32')](',');var _0x23f3e8={};_0x23f3e8[_0x1a8738[0x0]]={'$gte':moment(_0x1a8738[0x1])[_0xdd4d('0xc2')](_0xdd4d('0xc3'))};_0x3c4021[_0xdd4d('0x78')]=_[_0xdd4d('0xb8')](_0x3c4021[_0xdd4d('0x78')],_0x23f3e8);}_0x3c4021=_[_0xdd4d('0xb8')]({},_0x3c4021,_0x56d1ed[_0xdd4d('0xb9')]);return db[_0xdd4d('0xbc')]['count']({'where':_0x3c4021[_0xdd4d('0x78')]})[_0xdd4d('0x29')](function(_0x4befa2){_0x176aeb[_0xdd4d('0x20')]=_0x4befa2;if(_0x56d1ed[_0xdd4d('0x3c')][_0xdd4d('0xb6')]){_0x3c4021[_0xdd4d('0xb7')]=[{'all':!![]}];}return db[_0xdd4d('0xbc')]['findAll'](_0x3c4021);})['then'](function(_0xcfb76a){_0x176aeb[_0xdd4d('0xb3')]=_0xcfb76a;return _0x176aeb;});}})[_0xdd4d('0x29')](respondWithFilteredResult(_0x4c4753,_0x3c4021))[_0xdd4d('0x36')](handleError(_0x4c4753,null));};exports['addTags']=function(_0x293d14,_0x42c270,_0x121a1d){return db[_0xdd4d('0x9b')][_0xdd4d('0x5e')]({'where':{'id':_0x293d14[_0xdd4d('0xb5')]['id']}})[_0xdd4d('0x29')](handleEntityNotFound(_0x42c270,null))[_0xdd4d('0x29')](function(_0x2caa73){if(_0x2caa73){return _0x2caa73[_0xdd4d('0xc4')](_0x293d14['body'][_0xdd4d('0xbe')],_[_0xdd4d('0xbf')](_0x293d14[_0xdd4d('0x73')],[_0xdd4d('0xbe'),'id'])||{})[_0xdd4d('0xc5')](function(){return db['Tag']['findAll']({'attributes':['id',_0xdd4d('0x2c'),'color'],'where':{'id':_0x293d14['body'][_0xdd4d('0xbe')]}});})[_0xdd4d('0x29')](function(_0x45e5e2){socket[_0xdd4d('0xc6')](_0xdd4d('0xc7'),{'id':Number(_0x293d14[_0xdd4d('0xb5')]['id']),'tags':_0x45e5e2||[]});return{'id':Number(_0x293d14[_0xdd4d('0xb5')]['id']),'tags':_0x45e5e2||[]};});}})[_0xdd4d('0x29')](respondWithResult(_0x42c270,null))[_0xdd4d('0x36')](handleError(_0x42c270,null));};exports[_0xdd4d('0xc8')]=function(_0x59b833,_0x5ef4d4,_0x44e7b2){return db['OpenchannelInteraction'][_0xdd4d('0x5e')]({'where':{'id':_0x59b833[_0xdd4d('0xb5')]['id']}})[_0xdd4d('0x29')](handleEntityNotFound(_0x5ef4d4,null))[_0xdd4d('0x29')](function(_0xb1e11c){if(_0xb1e11c){return _0xb1e11c[_0xdd4d('0xc8')](_0x59b833[_0xdd4d('0x3c')][_0xdd4d('0xbe')]);}})['then'](respondWithStatusCode(_0x5ef4d4,null))[_0xdd4d('0x36')](handleError(_0x5ef4d4,null));};exports[_0xdd4d('0xc9')]=function(_0x405784,_0x55ccf7){var _0x52e8c5=moment()[_0xdd4d('0xca')]()['toString']();var _0x4eca89=path[_0xdd4d('0xcb')](config[_0xdd4d('0xcc')],'server','files',_0xdd4d('0xcd'));var _0x318924=path[_0xdd4d('0xcb')](config['root'],_0xdd4d('0xce'),'files',_0xdd4d('0xcf'));var _0x43d1c6=path[_0xdd4d('0xcb')](_0x4eca89,_0x52e8c5);var _0x19d61d=util[_0xdd4d('0xc2')](_0xdd4d('0xd0'),_0x405784[_0xdd4d('0xb5')]['id'],_0x52e8c5);var _0x3efa2f=path[_0xdd4d('0xcb')](_0x4eca89,_0x19d61d);var _0xe6945f=[];_0xe6945f[_0xdd4d('0x35')]({'model':db[_0xdd4d('0x6f')],'as':'User','attributes':['id',_0xdd4d('0x30')],'raw':!![]});_0xe6945f[_0xdd4d('0x35')]({'model':db[_0xdd4d('0xd1')],'as':'Contact','attributes':['id',_0xdd4d('0xd2'),_0xdd4d('0xd3')],'raw':!![]});if(_0x405784[_0xdd4d('0x3c')][_0xdd4d('0xcf')]){_0xe6945f[_0xdd4d('0x35')]({'model':db[_0xdd4d('0xd4')],'as':_0xdd4d('0xd4'),'raw':!![]});}var _0x54f28=[{'model':db[_0xdd4d('0xbc')],'as':_0xdd4d('0xd5'),'attributes':['id',_0xdd4d('0x73'),_0xdd4d('0x7b'),'direction','secret',_0xdd4d('0x82')],'include':_0xe6945f}];_0x54f28[_0xdd4d('0x35')]({'model':db[_0xdd4d('0xd6')],'as':_0xdd4d('0xd7'),'attributes':['id',_0xdd4d('0x2c')]});_0x54f28[_0xdd4d('0x35')]({'model':db[_0xdd4d('0x6f')],'as':_0xdd4d('0xd8'),'attributes':['id','fullname']});return db[_0xdd4d('0x9b')][_0xdd4d('0x5e')]({'where':{'id':_0x405784[_0xdd4d('0xb5')]['id']},'include':_0x54f28})[_0xdd4d('0x29')](handleEntityNotFound(_0x55ccf7,null))[_0xdd4d('0x29')](function(_0x4db2da){if(_0x4db2da){var _0x5c2661=_0x4db2da[_0xdd4d('0xd9')]({'plain':!![]});fs['mkdirSync'](_0x43d1c6);var _0x2b1752={'format':'A4','border':_0xdd4d('0xda'),'header':{'height':_0xdd4d('0xdb'),'contents':{'first':'\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20'}},'footer':{'height':_0xdd4d('0xdc'),'contents':{'default':util[_0xdd4d('0xc2')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xdd4d('0xc2')](_0xdd4d('0xdd'),_0xdd4d('0xde'),_0x5c2661['id']),moment()[_0xdd4d('0xc2')](_0xdd4d('0xdf'))['toString']())}}};var _0x529d10={'channel':_0xdd4d('0xde'),'account':_0x5c2661[_0xdd4d('0xd7')][_0xdd4d('0x2c')],'agent':_0x5c2661[_0xdd4d('0xd8')]?_0x5c2661[_0xdd4d('0xd8')][_0xdd4d('0x30')]:'N.A.','createdAt':moment(_0x5c2661[_0xdd4d('0x7b')])[_0xdd4d('0xc2')](_0xdd4d('0xc3'))[_0xdd4d('0x98')](),'closedAt':_0x5c2661[_0xdd4d('0xe0')]?moment(_0x5c2661[_0xdd4d('0xe1')])[_0xdd4d('0xc2')](_0xdd4d('0xc3'))['toString']():'','disposition':_0x5c2661[_0xdd4d('0xe2')],'visibility':_0x5c2661[_0xdd4d('0xe3')]?_0xdd4d('0xe4'):_0xdd4d('0xe5'),'messages':_(_0x5c2661[_0xdd4d('0xd5')])['filter']({'secret':![]})[_0xdd4d('0x2f')](function(_0x4c3361){if(_0x4c3361[_0xdd4d('0xd4')]){var _0x3da272=path[_0xdd4d('0xcb')](_0x318924,_0x4c3361['Attachment'][_0xdd4d('0xe6')]);if(fs['existsSync'](_0x3da272)){fs['createReadStream'](_0x3da272)[_0xdd4d('0xe7')](fs[_0xdd4d('0xe8')](path[_0xdd4d('0xcb')](_0x43d1c6,_0x4c3361['Attachment'][_0xdd4d('0xe6')])));}}return{'date':moment(_0x4c3361[_0xdd4d('0x7b')])[_0xdd4d('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xdd4d('0x98')](),'sender':_0x4c3361['direction']===_0xdd4d('0xe9')?_0x4c3361[_0xdd4d('0x6f')]?_0x4c3361[_0xdd4d('0x6f')][_0xdd4d('0x30')]:_0xdd4d('0xea'):_0x4c3361['Contact']['firstName']+(_0x4c3361[_0xdd4d('0x64')][_0xdd4d('0xd3')]?'\x20'+_0x4c3361['Contact']['lastName']:''),'body':_0x4c3361[_0xdd4d('0xd4')]?_0x4c3361[_0xdd4d('0xd4')][_0xdd4d('0xe6')]:_0x4c3361[_0xdd4d('0x73')],'direction':_0x4c3361[_0xdd4d('0xeb')]===_0xdd4d('0xe9')?'A':'C','secret':_0x4c3361['secret'],'read':_0x4c3361['read'],'attachment':_0x4c3361[_0xdd4d('0xd4')]};})[_0xdd4d('0x60')]()};return ejs['renderFile'](path[_0xdd4d('0xcb')](config['root'],_0xdd4d('0xce'),_0xdd4d('0xec'),_0xdd4d('0xed')),{'interaction':_0x529d10})[_0xdd4d('0x29')](function(_0x59fe5f){return new BPromise(function(_0x219cea,_0x5f0cbf){pdf[_0xdd4d('0xba')](_0x59fe5f,_0x2b1752)[_0xdd4d('0xee')](path['join'](_0x43d1c6,_0xdd4d('0xef')+_0x5c2661['id']+'-'+_0x52e8c5+_0xdd4d('0xf0')),function(_0x49c5f3,_0x32e184){if(_0x49c5f3)return _0x5f0cbf(_0x49c5f3);_0x219cea(_0x32e184);});});})[_0xdd4d('0x29')](function(){return new BPromise(function(_0x29b2fe,_0x2a5f9f){zipdir(_0x43d1c6,{'saveTo':_0x3efa2f},function(_0x46dd88,_0x551de5){if(_0x46dd88)return _0x2a5f9f(_0x46dd88);return _0x29b2fe(_0x551de5);});})['then'](function(){return new BPromise(function(_0x29091d,_0x30e356){rimraf(_0x43d1c6,function(_0x1a4fdd){if(_0x1a4fdd)_0x30e356(_0x1a4fdd);return _0x29091d();});});})[_0xdd4d('0x29')](function(){return _0x55ccf7[_0xdd4d('0xc9')](_0x3efa2f,_0x19d61d,function(_0x4fe50c){if(_0x4fe50c){console[_0xdd4d('0xf1')](_0xdd4d('0xf2'),_0x4fe50c);}else{fs['unlinkSync'](_0x3efa2f);}});});});}else{return _0x55ccf7['sendStatus'](0xc8);}})[_0xdd4d('0x36')](handleError(_0x55ccf7,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index c062ebc..a443b22 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 _0x1933=['catch','hasOwnProperty','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','getUsers','then','Users','map','length','emit'];(function(_0x54a17c,_0x41f2f6){var _0x1bb614=function(_0x394ca4){while(--_0x394ca4){_0x54a17c['push'](_0x54a17c['shift']());}};_0x1bb614(++_0x41f2f6);}(_0x1933,0x14c));var _0x3193=function(_0x19035a,_0x27888){_0x19035a=_0x19035a-0x0;var _0x27c40c=_0x1933[_0x19035a];return _0x27c40c;};'use strict';var EventEmitter=require(_0x3193('0x0'));var OpenchannelInteraction=require(_0x3193('0x1'))['db'][_0x3193('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x3193('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x3193('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3193('0x5'),'afterDestroy':_0x3193('0x6')};function emitEvent(_0x136206){return function(_0x36e223,_0x5ce96e,_0x31b1bf){_0x36e223[_0x3193('0x7')]({'attributes':['id'],'raw':!![]})[_0x3193('0x8')](function(_0x547ebe){_0x36e223['setDataValue'](_0x3193('0x9'),_0x547ebe[_0x3193('0xa')](function(_0x4e882f){return{'id':_0x4e882f['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x36e223['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3193('0x8')](function(_0x153919){_0x36e223['setDataValue']('unreadMessages',_0x153919[_0x3193('0xb')]);OpenchannelInteractionEvents[_0x3193('0xc')](_0x136206+':'+_0x36e223['id'],_0x36e223);OpenchannelInteractionEvents[_0x3193('0xc')](_0x136206,_0x36e223);_0x31b1bf(null);})[_0x3193('0xd')](_0x31b1bf(null));};}for(var e in events){if(events[_0x3193('0xe')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x08a2=['map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','getUsers','then','setDataValue'];(function(_0xd15a1b,_0x3d6cbe){var _0x2ab062=function(_0x2b09bf){while(--_0x2b09bf){_0xd15a1b['push'](_0xd15a1b['shift']());}};_0x2ab062(++_0x3d6cbe);}(_0x08a2,0x17e));var _0x208a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x08a2[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x208a('0x0'))['db'][_0x208a('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x208a('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x208a('0x3')](0x0);var events={'afterCreate':_0x208a('0x4'),'afterUpdate':_0x208a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x233159){return function(_0x8ed456,_0x23911c,_0x565a9d){_0x8ed456[_0x208a('0x6')]({'attributes':['id'],'raw':!![]})[_0x208a('0x7')](function(_0x1fc385){_0x8ed456[_0x208a('0x8')]('Users',_0x1fc385[_0x208a('0x9')](function(_0x1d5186){return{'id':_0x1d5186['id']};}));return OpenchannelMessage[_0x208a('0xa')]({'where':{'OpenchannelInteractionId':_0x8ed456['id'],'direction':'in','read':![]},'raw':!![]});})[_0x208a('0x7')](function(_0x347deb){_0x8ed456[_0x208a('0x8')](_0x208a('0xb'),_0x347deb[_0x208a('0xc')]);OpenchannelInteractionEvents[_0x208a('0xd')](_0x233159+':'+_0x8ed456['id'],_0x8ed456);OpenchannelInteractionEvents[_0x208a('0xd')](_0x233159,_0x8ed456);_0x565a9d(null);})[_0x208a('0xe')](_0x565a9d(null));};}for(var e in events){if(events[_0x208a('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x208a('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 41f789a..68ced71 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 _0x8ca9=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed'];(function(_0x77d6ae,_0xce2e62){var _0x166a3b=function(_0x169dba){while(--_0x169dba){_0x77d6ae['push'](_0x77d6ae['shift']());}};_0x166a3b(++_0xce2e62);}(_0x8ca9,0x9c));var _0x98ca=function(_0xf02b3f,_0x4aaf47){_0xf02b3f=_0xf02b3f-0x0;var _0x51d908=_0x8ca9[_0xf02b3f];return _0x51d908;};'use strict';var _=require(_0x98ca('0x0'));var util=require(_0x98ca('0x1'));var logger=require(_0x98ca('0x2'))(_0x98ca('0x3'));var moment=require(_0x98ca('0x4'));var BPromise=require(_0x98ca('0x5'));var rp=require(_0x98ca('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x98ca('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0x98ca('0x8')]=function(_0x48415d,_0x219619){return _0x48415d[_0x98ca('0x9')](_0x98ca('0xa'),attributes,{'tableName':_0x98ca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x323c95,_0x28a37a,_0x162bd0){if(_0x323c95[_0x98ca('0xc')](_0x98ca('0xd'))){_0x323c95[_0x98ca('0xe')]=moment()[_0x98ca('0xf')](_0x98ca('0x10'));}_0x162bd0(null,_0x323c95);}}});}; \ No newline at end of file +var _0x02a7=['define','OpenchannelInteraction','openchannel_interactions','changed','closedAt','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x02a7,0x7a));var _0x702a=function(_0x2261b0,_0x2155e6){_0x2261b0=_0x2261b0-0x0;var _0x49b3b4=_0x02a7[_0x2261b0];return _0x49b3b4;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x702a('0x1'));var BPromise=require(_0x702a('0x2'));var rp=require(_0x702a('0x3'));var fs=require('fs');var path=require(_0x702a('0x4'));var rimraf=require(_0x702a('0x5'));var config=require(_0x702a('0x6'));var attributes=require(_0x702a('0x7'));module['exports']=function(_0x1bcfe5,_0x5b7d8c){return _0x1bcfe5[_0x702a('0x8')](_0x702a('0x9'),attributes,{'tableName':_0x702a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x161dee,_0x430cf3,_0x20c009){if(_0x161dee[_0x702a('0xb')]('closed')){_0x161dee[_0x702a('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x20c009(null,_0x161dee);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 62fc542..4b66337 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 _0xa569=['ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','limit','then','AddTagsToOpenchannelInteraction','find','body'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xa569,0x106));var _0x9a56=function(_0x3f6565,_0x12a8bb){_0x3f6565=_0x3f6565-0x0;var _0x4abd23=_0xa569[_0x3f6565];return _0x4abd23;};'use strict';var _=require(_0x9a56('0x0'));var util=require(_0x9a56('0x1'));var moment=require(_0x9a56('0x2'));var BPromise=require(_0x9a56('0x3'));var rs=require(_0x9a56('0x4'));var fs=require('fs');var Redis=require(_0x9a56('0x5'));var db=require(_0x9a56('0x6'))['db'];var utils=require(_0x9a56('0x7'));var logger=require(_0x9a56('0x8'))(_0x9a56('0x9'));var config=require(_0x9a56('0xa'));var jayson=require(_0x9a56('0xb'));var client=jayson[_0x9a56('0xc')][_0x9a56('0xd')]({'port':0x232a});config[_0x9a56('0xe')]=_[_0x9a56('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9a56('0x10'))(new Redis(config[_0x9a56('0xe')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x10dc1f,_0x4f9495,_0xcec74f){return new BPromise(function(_0xed82f2,_0x23aaf0){return client['request'](_0x10dc1f,_0xcec74f)['then'](function(_0x593141){logger['info'](_0x9a56('0x11'),_0x4f9495,_0x9a56('0x12'));logger[_0x9a56('0x13')](_0x9a56('0x14'),_0x4f9495,_0x9a56('0x12'),JSON[_0x9a56('0x15')](_0x593141));if(_0x593141[_0x9a56('0x16')]){if(_0x593141['error'][_0x9a56('0x17')]===0x1f4){logger[_0x9a56('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4f9495,_0x593141['error']['message']);return _0x23aaf0(_0x593141['error'][_0x9a56('0x18')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x4f9495,_0x593141['error'][_0x9a56('0x18')]);return _0xed82f2(_0x593141['error'][_0x9a56('0x18')]);}else{logger[_0x9a56('0x19')](_0x9a56('0x11'),_0x4f9495,_0x9a56('0x12'));_0xed82f2(_0x593141[_0x9a56('0x1a')][_0x9a56('0x18')]);}})[_0x9a56('0x1b')](function(_0x3517dd){logger[_0x9a56('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4f9495,_0x3517dd);_0x23aaf0(_0x3517dd);});});}exports[_0x9a56('0x1c')]=function(_0x3848ae){var _0x3da998=this;return new Promise(function(_0xd6859b,_0x454b6a){return db[_0x9a56('0x1d')][_0x9a56('0x1e')](_0x3848ae['body'],{'raw':_0x3848ae[_0x9a56('0x1f')]?_0x3848ae['options'][_0x9a56('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3848ae['options']?_0x3848ae[_0x9a56('0x1f')][_0x9a56('0x21')]||null:null,'attributes':_0x3848ae[_0x9a56('0x1f')]?_0x3848ae[_0x9a56('0x1f')]['attributes']||null:null,'limit':_0x3848ae[_0x9a56('0x1f')]?_0x3848ae[_0x9a56('0x1f')][_0x9a56('0x22')]||null:null})[_0x9a56('0x23')](function(_0x54009c){logger[_0x9a56('0x19')]('UpdateOpenchannelInteraction',_0x3848ae);logger[_0x9a56('0x13')](_0x9a56('0x1c'),_0x3848ae,JSON[_0x9a56('0x15')](_0x54009c));_0xd6859b(_0x54009c);})[_0x9a56('0x1b')](function(_0x18c4e3){logger[_0x9a56('0x16')](_0x9a56('0x1c'),_0x18c4e3[_0x9a56('0x18')],_0x3848ae);_0x454b6a(_0x3da998[_0x9a56('0x16')](0x1f4,_0x18c4e3[_0x9a56('0x18')]));});});};exports[_0x9a56('0x24')]=function(_0x1c86d5){return new Promise(function(_0x24ee09,_0x3bc3ff){return db[_0x9a56('0x1d')][_0x9a56('0x25')]({'where':_0x1c86d5[_0x9a56('0x1f')]?_0x1c86d5[_0x9a56('0x1f')][_0x9a56('0x21')]||null:null})['then'](function(_0x48ccbb){if(_0x48ccbb){return _0x48ccbb['addTags'](_0x1c86d5[_0x9a56('0x26')][_0x9a56('0x27')],_[_0x9a56('0x28')](_0x1c86d5[_0x9a56('0x26')],[_0x9a56('0x27'),'id'])||{});}})[_0x9a56('0x29')](function(_0x39009b){logger[_0x9a56('0x19')](_0x9a56('0x2a'),_0x1c86d5);logger[_0x9a56('0x13')](_0x9a56('0x2a'),_0x1c86d5,JSON['stringify'](_0x39009b));_0x24ee09(_0x39009b);})['catch'](function(_0x27cffa){logger[_0x9a56('0x16')](_0x9a56('0x2a'),_0x27cffa[_0x9a56('0x18')],_0x1c86d5);_0x3bc3ff(_this['error'](0x1f4,_0x27cffa[_0x9a56('0x18')]));});});}; \ No newline at end of file +var _0xb7d8=['AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','catch','AddTagsToOpenchannelInteraction','find','addTags','ids','spread'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xb7d8,0x7c));var _0x8b7d=function(_0x2f6f17,_0x4a5c08){_0x2f6f17=_0x2f6f17-0x0;var _0x5ea888=_0xb7d8[_0x2f6f17];return _0x5ea888;};'use strict';var _=require(_0x8b7d('0x0'));var util=require(_0x8b7d('0x1'));var moment=require(_0x8b7d('0x2'));var BPromise=require('bluebird');var rs=require(_0x8b7d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b7d('0x4'))['db'];var utils=require(_0x8b7d('0x5'));var logger=require(_0x8b7d('0x6'))(_0x8b7d('0x7'));var config=require('../../config/environment');var jayson=require(_0x8b7d('0x8'));var client=jayson[_0x8b7d('0x9')][_0x8b7d('0xa')]({'port':0x232a});config['redis']=_[_0x8b7d('0xb')](config[_0x8b7d('0xc')],{'host':_0x8b7d('0xd'),'port':0x18eb});var socket=require(_0x8b7d('0xe'))(new Redis(config[_0x8b7d('0xc')]));require(_0x8b7d('0xf'))[_0x8b7d('0x10')](socket);function respondWithRpcPromise(_0x2046ac,_0x50b875,_0x48c624){return new BPromise(function(_0x35912f,_0xcf9791){return client[_0x8b7d('0x11')](_0x2046ac,_0x48c624)[_0x8b7d('0x12')](function(_0x16310b){logger[_0x8b7d('0x13')](_0x8b7d('0x14'),_0x50b875,'request\x20sent');logger[_0x8b7d('0x15')](_0x8b7d('0x16'),_0x50b875,'request\x20sent',JSON[_0x8b7d('0x17')](_0x16310b));if(_0x16310b[_0x8b7d('0x18')]){if(_0x16310b[_0x8b7d('0x18')][_0x8b7d('0x19')]===0x1f4){logger[_0x8b7d('0x18')](_0x8b7d('0x14'),_0x50b875,_0x16310b[_0x8b7d('0x18')]['message']);return _0xcf9791(_0x16310b[_0x8b7d('0x18')]['message']);}logger[_0x8b7d('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x50b875,_0x16310b['error'][_0x8b7d('0x1a')]);return _0x35912f(_0x16310b[_0x8b7d('0x18')]['message']);}else{logger[_0x8b7d('0x13')](_0x8b7d('0x14'),_0x50b875,'request\x20sent');_0x35912f(_0x16310b[_0x8b7d('0x1b')][_0x8b7d('0x1a')]);}})['catch'](function(_0x52a1ed){logger[_0x8b7d('0x18')](_0x8b7d('0x14'),_0x50b875,_0x52a1ed);_0xcf9791(_0x52a1ed);});});}exports[_0x8b7d('0x1c')]=function(_0xc1e611){var _0x3127c7=this;return new Promise(function(_0x74b2e8,_0x5a5cf3){return db[_0x8b7d('0x1d')][_0x8b7d('0x1e')](_0xc1e611[_0x8b7d('0x1f')],{'raw':_0xc1e611[_0x8b7d('0x20')]?_0xc1e611[_0x8b7d('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc1e611[_0x8b7d('0x20')]?_0xc1e611['options'][_0x8b7d('0x21')]||null:null,'attributes':_0xc1e611[_0x8b7d('0x20')]?_0xc1e611[_0x8b7d('0x20')]['attributes']||null:null,'limit':_0xc1e611['options']?_0xc1e611['options']['limit']||null:null})['then'](function(_0x2aac45){logger['info'](_0x8b7d('0x1c'),_0xc1e611);logger[_0x8b7d('0x15')]('UpdateOpenchannelInteraction',_0xc1e611,JSON[_0x8b7d('0x17')](_0x2aac45));_0x74b2e8(_0x2aac45);})[_0x8b7d('0x22')](function(_0xde1b1e){logger[_0x8b7d('0x18')](_0x8b7d('0x1c'),_0xde1b1e[_0x8b7d('0x1a')],_0xc1e611);_0x5a5cf3(_0x3127c7[_0x8b7d('0x18')](0x1f4,_0xde1b1e['message']));});});};exports[_0x8b7d('0x23')]=function(_0xc0d3a3){return new Promise(function(_0x16b061,_0xbfb691){return db[_0x8b7d('0x1d')][_0x8b7d('0x24')]({'where':_0xc0d3a3['options']?_0xc0d3a3[_0x8b7d('0x20')][_0x8b7d('0x21')]||null:null})[_0x8b7d('0x12')](function(_0x4548e7){if(_0x4548e7){return _0x4548e7[_0x8b7d('0x25')](_0xc0d3a3[_0x8b7d('0x1f')][_0x8b7d('0x26')],_['omit'](_0xc0d3a3[_0x8b7d('0x1f')],[_0x8b7d('0x26'),'id'])||{});}})[_0x8b7d('0x27')](function(_0x138e02){logger[_0x8b7d('0x13')](_0x8b7d('0x28'),_0xc0d3a3);logger[_0x8b7d('0x15')](_0x8b7d('0x28'),_0xc0d3a3,JSON['stringify'](_0x138e02));_0x16b061(_0x138e02);})['catch'](function(_0x47bb62){logger['error'](_0x8b7d('0x28'),_0x47bb62['message'],_0xc0d3a3);_0xbfb691(_this[_0x8b7d('0x18')](0x1f4,_0x47bb62[_0x8b7d('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 84192e6..4c5fd36 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 _0x7f1a=['update','emit','removeListener','length','remove'];(function(_0x1e8185,_0x55fc9b){var _0x4e6850=function(_0x267aa4){while(--_0x267aa4){_0x1e8185['push'](_0x1e8185['shift']());}};_0x4e6850(++_0x55fc9b);}(_0x7f1a,0x12b));var _0xa7f1=function(_0xe7731d,_0x315f4c){_0xe7731d=_0xe7731d-0x0;var _0x44863c=_0x7f1a[_0xe7731d];return _0x44863c;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save',_0xa7f1('0x0'),_0xa7f1('0x1')];function createListener(_0x481471,_0x12008b){return function(_0x5ab4d0){_0x12008b[_0xa7f1('0x2')](_0x481471,_0x5ab4d0);};}function removeListener(_0x284135,_0x5edd16){return function(){OpenchannelInteractionEvents[_0xa7f1('0x3')](_0x284135,_0x5edd16);};}exports['register']=function(_0x526d1a){for(var _0x3dd8b1=0x0,_0x4a29d9=events[_0xa7f1('0x4')];_0x3dd8b1<_0x4a29d9;_0x3dd8b1++){var _0x5f13ca=events[_0x3dd8b1];var _0xe53b9f=createListener('openchannelInteraction:'+_0x5f13ca,_0x526d1a);OpenchannelInteractionEvents['on'](_0x5f13ca,_0xe53b9f);}}; \ No newline at end of file +var _0x1b04=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','update'];(function(_0x3c0edc,_0xeccbdd){var _0xd7fd1b=function(_0x18e128){while(--_0x18e128){_0x3c0edc['push'](_0x3c0edc['shift']());}};_0xd7fd1b(++_0xeccbdd);}(_0x1b04,0x169));var _0x41b0=function(_0x891c55,_0x233fe8){_0x891c55=_0x891c55-0x0;var _0x260823=_0x1b04[_0x891c55];return _0x260823;};'use strict';var OpenchannelInteractionEvents=require(_0x41b0('0x0'));var events=[_0x41b0('0x1'),'remove',_0x41b0('0x2')];function createListener(_0x34688e,_0x411cc4){return function(_0x114f69){_0x411cc4['emit'](_0x34688e,_0x114f69);};}function removeListener(_0x5b6270,_0x396ca4){return function(){OpenchannelInteractionEvents[_0x41b0('0x3')](_0x5b6270,_0x396ca4);};}exports[_0x41b0('0x4')]=function(_0x3ceafd){for(var _0x2f1dbe=0x0,_0x4789fe=events[_0x41b0('0x5')];_0x2f1dbe<_0x4789fe;_0x2f1dbe++){var _0x3a92d7=events[_0x2f1dbe];var _0x2527f9=createListener(_0x41b0('0x6')+_0x3a92d7,_0x3ceafd);OpenchannelInteractionEvents['on'](_0x3a92d7,_0x2527f9);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index ffb0652..413ba13 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 _0x775c=['/:id/accept','accept','/:id/reject','reject','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','show','tracked','openchannel','openchannelmessage:create','create','/:id','update','put'];(function(_0x1c5c6c,_0x3c9621){var _0x333e26=function(_0x4ce006){while(--_0x4ce006){_0x1c5c6c['push'](_0x1c5c6c['shift']());}};_0x333e26(++_0x3c9621);}(_0x775c,0x1eb));var _0xc775=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0x775c[_0x240261];return _0x45c332;};'use strict';var multer=require(_0xc775('0x0'));var util=require('util');var path=require(_0xc775('0x1'));var timeout=require(_0xc775('0x2'));var express=require(_0xc775('0x3'));var router=express[_0xc775('0x4')]();var auth=require(_0xc775('0x5'));var interaction=require(_0xc775('0x6'));var config=require(_0xc775('0x7'));var controller=require(_0xc775('0x8'));router[_0xc775('0x9')]('/',auth[_0xc775('0xa')](),controller[_0xc775('0xb')]);router['get'](_0xc775('0xc'),auth[_0xc775('0xa')](),controller[_0xc775('0xd')]);router[_0xc775('0x9')]('/:id',auth[_0xc775('0xa')](),controller[_0xc775('0xe')]);router['post']('/',auth[_0xc775('0xa')](),interaction[_0xc775('0xf')](_0xc775('0x10'),_0xc775('0x11')),controller[_0xc775('0x12')]);router['put'](_0xc775('0x13'),auth[_0xc775('0xa')](),controller[_0xc775('0x14')]);router[_0xc775('0x15')](_0xc775('0x16'),auth[_0xc775('0xa')](),controller[_0xc775('0x17')]);router['put'](_0xc775('0x18'),auth[_0xc775('0xa')](),controller[_0xc775('0x19')]);router[_0xc775('0x1a')]('/:id',auth[_0xc775('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5ff4=['Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util'];(function(_0x246148,_0x1358ee){var _0x453d94=function(_0x59920e){while(--_0x59920e){_0x246148['push'](_0x246148['shift']());}};_0x453d94(++_0x1358ee);}(_0x5ff4,0x14e));var _0x45ff=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x5ff4[_0x565c49];return _0x20ca34;};'use strict';var multer=require(_0x45ff('0x0'));var util=require(_0x45ff('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x45ff('0x2')]();var auth=require(_0x45ff('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x45ff('0x4'));var controller=require('./openchannelMessage.controller');router[_0x45ff('0x5')]('/',auth[_0x45ff('0x6')](),controller['index']);router[_0x45ff('0x5')]('/describe',auth[_0x45ff('0x6')](),controller['describe']);router[_0x45ff('0x5')](_0x45ff('0x7'),auth[_0x45ff('0x6')](),controller['show']);router[_0x45ff('0x8')]('/',auth[_0x45ff('0x6')](),interaction[_0x45ff('0x9')](_0x45ff('0xa'),'openchannelmessage:create'),controller[_0x45ff('0xb')]);router[_0x45ff('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x45ff('0xd')]);router[_0x45ff('0xc')](_0x45ff('0xe'),auth['isAuthenticated'](),controller[_0x45ff('0xf')]);router[_0x45ff('0xc')](_0x45ff('0x10'),auth['isAuthenticated'](),controller[_0x45ff('0x11')]);router[_0x45ff('0x12')](_0x45ff('0x7'),auth['isAuthenticated'](),controller[_0x45ff('0x13')]);module[_0x45ff('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 77c699d..9460a4f 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 _0x2af9=['TEXT','medium','BOOLEAN','out','STRING','sequelize','exports'];(function(_0xb74997,_0x195e6f){var _0x515640=function(_0x51ba5f){while(--_0x51ba5f){_0xb74997['push'](_0xb74997['shift']());}};_0x515640(++_0x195e6f);}(_0x2af9,0x140));var _0x92af=function(_0x50412e,_0xda6a88){_0x50412e=_0x50412e-0x0;var _0x5545a3=_0x2af9[_0x50412e];return _0x5545a3;};'use strict';var Sequelize=require(_0x92af('0x0'));module[_0x92af('0x1')]={'body':{'type':Sequelize[_0x92af('0x2')](_0x92af('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x92af('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x92af('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x92af('0x6')]},'providerResponse':{'type':Sequelize[_0x92af('0x2')]}}; \ No newline at end of file +var _0xd744=['out','DATE','STRING','exports','TEXT','medium','BOOLEAN'];(function(_0x27052d,_0x42f7fe){var _0x552681=function(_0x37c597){while(--_0x37c597){_0x27052d['push'](_0x27052d['shift']());}};_0x552681(++_0x42f7fe);}(_0xd744,0x1e6));var _0x4d74=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd744[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0x4d74('0x0')]={'body':{'type':Sequelize[_0x4d74('0x1')](_0x4d74('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4d74('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4d74('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4d74('0x4')),'defaultValue':_0x4d74('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4d74('0x5')]},'providerName':{'type':Sequelize[_0x4d74('0x6')]},'providerResponse':{'type':Sequelize[_0x4d74('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 6f785fe..d60a817 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 _0xc14a=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','OpenchannelMessage','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','manual','interface','format','SIP/%s','channel','event','acceptmessage','rejectMessage','EventManager','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','./openchannelMessage.socket','register','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','status','end','offset','limit','set','json','apply','reject','update','destroy','name','send','index','map','rawAttributes','fieldName','type','model'];(function(_0x580424,_0x12abef){var _0x569c15=function(_0x30f619){while(--_0x30f619){_0x580424['push'](_0x580424['shift']());}};_0x569c15(++_0x12abef);}(_0xc14a,0xa9));var _0xac14=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xc14a[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0xac14('0x0'));var emlformat=require(_0xac14('0x1'));var rimraf=require(_0xac14('0x2'));var zipdir=require(_0xac14('0x3'));var jsonpatch=require(_0xac14('0x4'));var rp=require('request-promise');var moment=require(_0xac14('0x5'));var BPromise=require(_0xac14('0x6'));var Mustache=require('mustache');var util=require(_0xac14('0x7'));var path=require('path');var sox=require(_0xac14('0x8'));var csv=require(_0xac14('0x9'));var ejs=require(_0xac14('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xac14('0xb'));var crypto=require(_0xac14('0xc'));var jsforce=require(_0xac14('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xac14('0x9'));var querystring=require(_0xac14('0xe'));var Papa=require(_0xac14('0xf'));var Redis=require(_0xac14('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xac14('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac14('0x12'));var logger=require(_0xac14('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xac14('0x14'));var licenseUtil=require(_0xac14('0x15'));var db=require('../../mysqldb')['db'];config[_0xac14('0x16')]=_[_0xac14('0x17')](config['redis'],{'host':_0xac14('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac14('0x16')]));require(_0xac14('0x19'))[_0xac14('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xac14('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0xac14('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x497be2,_0x270284,_0x19edc6,_0x1023e2){return new BPromise(function(_0x22cb60,_0x3b4e6a){var _0x4d7f22=_0x1023e2||client;return _0x4d7f22[_0xac14('0x1c')](_0x497be2,_0x19edc6)[_0xac14('0x1d')](function(_0x39a6e8){logger[_0xac14('0x1e')](_0xac14('0x1f'),_0x270284,_0xac14('0x20'));logger[_0xac14('0x21')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x270284,_0xac14('0x20'),JSON[_0xac14('0x22')](_0x39a6e8));if(_0x39a6e8[_0xac14('0x23')]){if(_0x39a6e8[_0xac14('0x23')][_0xac14('0x24')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x270284,_0x39a6e8[_0xac14('0x23')][_0xac14('0x25')]);return _0x3b4e6a(_0x39a6e8['error'][_0xac14('0x25')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x270284,_0x39a6e8['error'][_0xac14('0x25')]);return _0x22cb60(_0x39a6e8['error'][_0xac14('0x25')]);}else{logger[_0xac14('0x1e')](_0xac14('0x1f'),_0x270284,_0xac14('0x20'));_0x22cb60(_0x39a6e8['result'][_0xac14('0x25')]);}})['catch'](function(_0x186a10){logger[_0xac14('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x270284,_0x186a10);_0x3b4e6a(_0x186a10);});});}function respondWithStatusCode(_0xeb26c2,_0x34f641){_0x34f641=_0x34f641||0xcc;return function(_0x3d2eeb){if(_0x3d2eeb){return _0xeb26c2[_0xac14('0x26')](_0x34f641);}return _0xeb26c2[_0xac14('0x27')](_0x34f641)[_0xac14('0x28')]();};}function respondWithResult(_0x5d033d,_0xc7dd39){_0xc7dd39=_0xc7dd39||0xc8;return function(_0x5de6e5){if(_0x5de6e5){return _0x5d033d['status'](_0xc7dd39)['json'](_0x5de6e5);}};}function respondWithFilteredResult(_0x23a5b3,_0x25b07e){return function(_0x2f6914){if(_0x2f6914){var _0x53584e=_0x2f6914['count'],_0x4b72e0=_0x25b07e[_0xac14('0x29')],_0x506837=_0x25b07e[_0xac14('0x29')]+_0x25b07e[_0xac14('0x2a')],_0x5b944b;if(_0x506837>=_0x53584e){_0x506837=_0x53584e;_0x5b944b=0xc8;}else{_0x5b944b=0xce;}_0x23a5b3[_0xac14('0x27')](_0x5b944b);return _0x23a5b3[_0xac14('0x2b')]('Content-Range',_0x4b72e0+'-'+_0x506837+'/'+_0x53584e)[_0xac14('0x2c')](_0x2f6914);}return null;};}function patchUpdates(_0x4c4904){return function(_0x30dc81){try{jsonpatch[_0xac14('0x2d')](_0x30dc81,_0x4c4904,!![]);}catch(_0x17389f){return BPromise[_0xac14('0x2e')](_0x17389f);}return _0x30dc81['save']();};}function saveUpdates(_0x1f491a,_0x1f2cb1){return function(_0x1678c6){if(_0x1678c6){return _0x1678c6[_0xac14('0x2f')](_0x1f491a)[_0xac14('0x1d')](function(_0x176915){return _0x176915;});}return null;};}function removeEntity(_0x507ded,_0x4ceb76){return function(_0x4958c8){if(_0x4958c8){return _0x4958c8[_0xac14('0x30')]()[_0xac14('0x1d')](function(){_0x507ded[_0xac14('0x27')](0xcc)[_0xac14('0x28')]();});}};}function handleEntityNotFound(_0x58389f,_0x410731){return function(_0x3496ba){if(!_0x3496ba){_0x58389f[_0xac14('0x26')](0x194);}return _0x3496ba;};}function handleError(_0x580cf8,_0xb25ee0){_0xb25ee0=_0xb25ee0||0x1f4;return function(_0x3fe422){logger['error'](_0x3fe422['stack']);if(_0x3fe422['name']){delete _0x3fe422[_0xac14('0x31')];}_0x580cf8[_0xac14('0x27')](_0xb25ee0)[_0xac14('0x32')](_0x3fe422);};}exports[_0xac14('0x33')]=function(_0x3e7edb,_0x191ad8){var _0xc99555={},_0x3ce1fa={},_0x4ce01e={'count':0x0,'rows':[]};var _0x323cea=_[_0xac14('0x34')](db['OpenchannelMessage'][_0xac14('0x35')],function(_0x321b20){return{'name':_0x321b20[_0xac14('0x36')],'type':_0x321b20[_0xac14('0x37')]['key']};});_0x3ce1fa[_0xac14('0x38')]=_[_0xac14('0x34')](_0x323cea,_0xac14('0x31'));_0x3ce1fa[_0xac14('0x39')]=_[_0xac14('0x3a')](_0x3e7edb['query']);_0x3ce1fa[_0xac14('0x3b')]=_[_0xac14('0x3c')](_0x3ce1fa[_0xac14('0x38')],_0x3ce1fa[_0xac14('0x39')]);_0xc99555['attributes']=_[_0xac14('0x3c')](_0x3ce1fa['model'],qs[_0xac14('0x3d')](_0x3e7edb[_0xac14('0x39')][_0xac14('0x3d')]));_0xc99555[_0xac14('0x3e')]=_0xc99555[_0xac14('0x3e')][_0xac14('0x3f')]?_0xc99555[_0xac14('0x3e')]:_0x3ce1fa['model'];if(!_0x3e7edb[_0xac14('0x39')][_0xac14('0x40')](_0xac14('0x41'))){_0xc99555['limit']=qs[_0xac14('0x2a')](_0x3e7edb[_0xac14('0x39')][_0xac14('0x2a')]);_0xc99555[_0xac14('0x29')]=qs[_0xac14('0x29')](_0x3e7edb[_0xac14('0x39')][_0xac14('0x29')]);}_0xc99555['order']=qs[_0xac14('0x42')](_0x3e7edb[_0xac14('0x39')][_0xac14('0x42')]);_0xc99555[_0xac14('0x43')]=qs['filters'](_['pick'](_0x3e7edb[_0xac14('0x39')],_0x3ce1fa[_0xac14('0x3b')]),_0x323cea);if(_0x3e7edb[_0xac14('0x39')][_0xac14('0x44')]){_0xc99555[_0xac14('0x43')]=_['merge'](_0xc99555[_0xac14('0x43')],{'$or':_[_0xac14('0x34')](_0x323cea,function(_0x4f6fee){if(_0x4f6fee[_0xac14('0x37')]!==_0xac14('0x45')){var _0x5193b8={};_0x5193b8[_0x4f6fee[_0xac14('0x31')]]={'$like':'%'+_0x3e7edb['query'][_0xac14('0x44')]+'%'};return _0x5193b8;}})});}_0xc99555=_[_0xac14('0x46')]({},_0xc99555,_0x3e7edb[_0xac14('0x47')]);var _0x1708aa={'where':_0xc99555[_0xac14('0x43')]};return db[_0xac14('0x48')][_0xac14('0x49')](_0x1708aa)[_0xac14('0x1d')](function(_0x145810){_0x4ce01e[_0xac14('0x49')]=_0x145810;if(_0x3e7edb[_0xac14('0x39')][_0xac14('0x4a')]){_0xc99555[_0xac14('0x4b')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xac14('0x4c')](_0xc99555);})[_0xac14('0x1d')](function(_0x18c886){_0x4ce01e[_0xac14('0x4d')]=_0x18c886;return _0x4ce01e;})[_0xac14('0x1d')](respondWithFilteredResult(_0x191ad8,_0xc99555))[_0xac14('0x4e')](handleError(_0x191ad8,null));};exports[_0xac14('0x4f')]=function(_0x21ca96,_0x1a1d97){var _0x4d679a={'raw':!![],'where':{'id':_0x21ca96[_0xac14('0x50')]['id']}},_0x5e7c4e={};_0x5e7c4e[_0xac14('0x38')]=_[_0xac14('0x3a')](db['OpenchannelMessage'][_0xac14('0x35')]);_0x5e7c4e[_0xac14('0x39')]=_[_0xac14('0x3a')](_0x21ca96['query']);_0x5e7c4e[_0xac14('0x3b')]=_[_0xac14('0x3c')](_0x5e7c4e['model'],_0x5e7c4e[_0xac14('0x39')]);_0x4d679a[_0xac14('0x3e')]=_[_0xac14('0x3c')](_0x5e7c4e['model'],qs[_0xac14('0x3d')](_0x21ca96[_0xac14('0x39')][_0xac14('0x3d')]));_0x4d679a[_0xac14('0x3e')]=_0x4d679a[_0xac14('0x3e')][_0xac14('0x3f')]?_0x4d679a[_0xac14('0x3e')]:_0x5e7c4e[_0xac14('0x38')];if(_0x21ca96[_0xac14('0x39')][_0xac14('0x4a')]){_0x4d679a[_0xac14('0x4b')]=[{'all':!![]}];}_0x4d679a=_[_0xac14('0x46')]({},_0x4d679a,_0x21ca96[_0xac14('0x47')]);return db[_0xac14('0x48')][_0xac14('0x51')](_0x4d679a)[_0xac14('0x1d')](handleEntityNotFound(_0x1a1d97,null))[_0xac14('0x1d')](respondWithResult(_0x1a1d97,null))[_0xac14('0x4e')](handleError(_0x1a1d97,null));};exports[_0xac14('0x52')]=function(_0x2c4725,_0x208234){return db[_0xac14('0x48')][_0xac14('0x52')](_0x2c4725[_0xac14('0x53')],{})[_0xac14('0x1d')](respondWithResult(_0x208234,0xc9))[_0xac14('0x4e')](handleError(_0x208234,null));};exports[_0xac14('0x2f')]=function(_0x210ccb,_0x21c1af){if(_0x210ccb['body']['id']){delete _0x210ccb[_0xac14('0x53')]['id'];}return db['OpenchannelMessage'][_0xac14('0x51')]({'where':{'id':_0x210ccb[_0xac14('0x50')]['id']}})['then'](handleEntityNotFound(_0x21c1af,null))[_0xac14('0x1d')](saveUpdates(_0x210ccb[_0xac14('0x53')],null))['then'](respondWithResult(_0x21c1af,null))[_0xac14('0x4e')](handleError(_0x21c1af,null));};exports[_0xac14('0x30')]=function(_0x3f058f,_0x2b93d1){return db[_0xac14('0x48')][_0xac14('0x51')]({'where':{'id':_0x3f058f['params']['id']}})['then'](handleEntityNotFound(_0x2b93d1,null))[_0xac14('0x1d')](removeEntity(_0x2b93d1,null))[_0xac14('0x4e')](handleError(_0x2b93d1,null));};exports['describe']=function(_0x51fd38,_0xea4ae8){return db[_0xac14('0x48')]['describe']()[_0xac14('0x1d')](respondWithResult(_0xea4ae8,null))[_0xac14('0x4e')](handleError(_0xea4ae8,null));};var interaction_log=require(_0xac14('0x13'))(_0xac14('0x54'));exports[_0xac14('0x55')]=function(_0x53f08d,_0x1265f6,_0x55e058){var _0xd14603={'agent':{},'channel':_0xac14('0x56')};if(_0x53f08d[_0xac14('0x53')]['id']){delete _0x53f08d[_0xac14('0x53')]['id'];}_0x53f08d[_0xac14('0x53')][_0xac14('0x57')]=!![];_0x53f08d[_0xac14('0x53')][_0xac14('0x58')]=moment()['format'](_0xac14('0x59'));_0x53f08d['body'][_0xac14('0x5a')]=_0x53f08d[_0xac14('0x53')]['UserId']||_0x53f08d['user']['id'];_0xd14603[_0xac14('0x5b')]['id']=_0x53f08d[_0xac14('0x53')]['UserId'];return db[_0xac14('0x48')][_0xac14('0x51')]({'where':{'id':_0x53f08d[_0xac14('0x50')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xac14('0x5c')}]})[_0xac14('0x1d')](handleEntityNotFound(_0x1265f6,null))[_0xac14('0x1d')](saveUpdates(_0x53f08d[_0xac14('0x53')],null))['then'](function(_0x5ef94a){if(_0x5ef94a){_0xd14603['message']=_0x5ef94a[_0xac14('0x5d')]({'plain':!![]});return db[_0xac14('0x5e')][_0xac14('0x51')]({'where':{'id':_0x5ef94a[_0xac14('0x5f')]}});}return null;})[_0xac14('0x1d')](handleEntityNotFound(_0x1265f6,null))[_0xac14('0x1d')](function(_0x3e3ebc){if(_0x3e3ebc){return _0x3e3ebc['update']({'UserId':_0x53f08d[_0xac14('0x53')][_0xac14('0x5a')],'read1stAt':_[_0xac14('0x60')](_0x3e3ebc[_0xac14('0x61')])?moment()['format'](_0xac14('0x59')):undefined});}return null;})['then'](function(_0x49e61c){if(_0x49e61c){_0xd14603[_0xac14('0x62')]=_0x49e61c[_0xac14('0x5d')]({'plain':!![]});interaction_log['info'](_0xac14('0x63'),_0x53f08d[_0xac14('0x64')]['id'],_0x53f08d[_0xac14('0x64')]['name'],_0x53f08d['user']['role'],_0xd14603[_0xac14('0x62')]['id'],_0x53f08d[_0xac14('0x53')]?JSON[_0xac14('0x22')](_0x53f08d[_0xac14('0x53')]):_0xac14('0x65'));return respondWithRpcPromise(_0xac14('0x66'),'acceptMessage',_0xd14603);}return null;})['then'](function(_0x510ef2){if(_0x510ef2){if(_0x53f08d[_0xac14('0x53')][_0xac14('0x67')]){_0xd14603[_0xac14('0x25')][_0xac14('0x68')]=util[_0xac14('0x69')](_0xac14('0x6a'),_0x53f08d[_0xac14('0x64')][_0xac14('0x31')]);_0xd14603[_0xac14('0x25')][_0xac14('0x6b')]=_0xd14603[_0xac14('0x6b')];_0xd14603[_0xac14('0x25')][_0xac14('0x6c')]=_0xac14('0x55');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xac14('0x6d'),'message':_0xd14603['message']},client9002)[_0xac14('0x1d')](function(){return _0xd14603;});}return _0xd14603;}return null;})[_0xac14('0x1d')](respondWithResult(_0x1265f6,null))[_0xac14('0x4e')](handleError(_0x1265f6,null));};var interaction_log=require(_0xac14('0x13'))('openchannel-interactions');exports[_0xac14('0x2e')]=function(_0x48decc,_0x410f32,_0x555beb){var _0x289c78={'agent':{},'channel':_0xac14('0x56')};if(_0x48decc['body']['id']){delete _0x48decc[_0xac14('0x53')]['id'];}_0x48decc[_0xac14('0x53')][_0xac14('0x5a')]=_0x48decc[_0xac14('0x53')]['UserId']||_0x48decc[_0xac14('0x64')]['id'];_0x289c78['agent']['id']=_0x48decc[_0xac14('0x53')][_0xac14('0x5a')];return db[_0xac14('0x48')][_0xac14('0x51')]({'where':{'id':_0x48decc[_0xac14('0x50')]['id'],'UserId':null}})[_0xac14('0x1d')](handleEntityNotFound(_0x410f32,null))[_0xac14('0x1d')](function(_0x3d2ee5){if(_0x3d2ee5){_0x289c78[_0xac14('0x25')]=_0x3d2ee5[_0xac14('0x5d')]({'plain':!![]});return db[_0xac14('0x5e')][_0xac14('0x51')]({'where':{'id':_0x3d2ee5[_0xac14('0x5f')]}});}return null;})[_0xac14('0x1d')](handleEntityNotFound(_0x410f32,null))[_0xac14('0x1d')](function(_0x29dbc1){if(_0x29dbc1){_0x289c78[_0xac14('0x62')]=_0x29dbc1[_0xac14('0x5d')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x48decc['user']['id'],_0x48decc['user'][_0xac14('0x31')],_0x48decc[_0xac14('0x64')]['role'],_0x289c78[_0xac14('0x62')]['id'],_0x48decc[_0xac14('0x53')]?JSON['stringify'](_0x48decc['body']):_0xac14('0x65'));return respondWithRpcPromise('RejectMessage',_0xac14('0x6e'),_0x289c78);}return null;})[_0xac14('0x1d')](function(_0xd27795){if(_0xd27795){_0xd27795[_0xac14('0x25')]['interface']=util['format']('SIP/%s',_0x48decc[_0xac14('0x64')][_0xac14('0x31')]);_0xd27795['message'][_0xac14('0x6b')]=_0x289c78['channel'];_0xd27795[_0xac14('0x25')]['event']=_0xac14('0x2e');respondWithRpcPromise(_0xac14('0x6f'),_0xac14('0x6f'),{'event':_0xac14('0x70'),'message':_0xd27795[_0xac14('0x25')]},client9002);return _0x289c78;}return null;})[_0xac14('0x1d')](respondWithResult(_0x410f32,null))['catch'](handleError(_0x410f32,null));}; \ No newline at end of file +var _0x0734=['register','jayson/promise','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','update','destroy','stack','name','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','length','include','create','body','find','params','describe','../../config/logger','openchannel-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','Contact','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','channel','EventManager','acceptmessage','reject','openchannel','role','RejectMessage','rejectMessage','SIP/%s','event','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelMessage.socket'];(function(_0x4429d0,_0x209ae7){var _0x2c7403=function(_0x5f2342){while(--_0x5f2342){_0x4429d0['push'](_0x4429d0['shift']());}};_0x2c7403(++_0x209ae7);}(_0x0734,0xd4));var _0x4073=function(_0x6308f7,_0x9cfa98){_0x6308f7=_0x6308f7-0x0;var _0x4c2e6a=_0x0734[_0x6308f7];return _0x4c2e6a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4073('0x0'));var rp=require(_0x4073('0x1'));var moment=require(_0x4073('0x2'));var BPromise=require(_0x4073('0x3'));var Mustache=require(_0x4073('0x4'));var util=require('util');var path=require(_0x4073('0x5'));var sox=require('sox');var csv=require(_0x4073('0x6'));var ejs=require(_0x4073('0x7'));var fs=require('fs');var _=require(_0x4073('0x8'));var squel=require('squel');var crypto=require(_0x4073('0x9'));var jsforce=require(_0x4073('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4073('0x6'));var querystring=require(_0x4073('0xb'));var Papa=require(_0x4073('0xc'));var Redis=require(_0x4073('0xd'));var authService=require(_0x4073('0xe'));var qs=require(_0x4073('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4073('0x10'));var utils=require(_0x4073('0x11'));var config=require(_0x4073('0x12'));var licenseUtil=require(_0x4073('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x4073('0x14')],{'host':_0x4073('0x15'),'port':0x18eb});var socket=require(_0x4073('0x16'))(new Redis(config[_0x4073('0x14')]));require(_0x4073('0x17'))[_0x4073('0x18')](socket);var jayson=require(_0x4073('0x19'));var client=jayson['client'][_0x4073('0x1a')]({'port':0x232c});var client9002=jayson['client'][_0x4073('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4df4f5,_0x14faf7,_0x49901d,_0x2900f0){return new BPromise(function(_0x1d0017,_0x47a86d){var _0x405576=_0x2900f0||client;return _0x405576[_0x4073('0x1b')](_0x4df4f5,_0x49901d)[_0x4073('0x1c')](function(_0x53132a){logger[_0x4073('0x1d')](_0x4073('0x1e'),_0x14faf7,_0x4073('0x1f'));logger[_0x4073('0x20')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x14faf7,'request\x20sent',JSON[_0x4073('0x21')](_0x53132a));if(_0x53132a[_0x4073('0x22')]){if(_0x53132a[_0x4073('0x22')][_0x4073('0x23')]===0x1f4){logger[_0x4073('0x22')](_0x4073('0x1e'),_0x14faf7,_0x53132a[_0x4073('0x22')][_0x4073('0x24')]);return _0x47a86d(_0x53132a[_0x4073('0x22')][_0x4073('0x24')]);}logger[_0x4073('0x22')](_0x4073('0x1e'),_0x14faf7,_0x53132a[_0x4073('0x22')][_0x4073('0x24')]);return _0x1d0017(_0x53132a[_0x4073('0x22')][_0x4073('0x24')]);}else{logger[_0x4073('0x1d')](_0x4073('0x1e'),_0x14faf7,_0x4073('0x1f'));_0x1d0017(_0x53132a[_0x4073('0x25')][_0x4073('0x24')]);}})['catch'](function(_0x76d39d){logger[_0x4073('0x22')](_0x4073('0x1e'),_0x14faf7,_0x76d39d);_0x47a86d(_0x76d39d);});});}function respondWithStatusCode(_0x3ece7a,_0x3e67cf){_0x3e67cf=_0x3e67cf||0xcc;return function(_0xb5671f){if(_0xb5671f){return _0x3ece7a[_0x4073('0x26')](_0x3e67cf);}return _0x3ece7a[_0x4073('0x27')](_0x3e67cf)[_0x4073('0x28')]();};}function respondWithResult(_0x1caae4,_0x3faf13){_0x3faf13=_0x3faf13||0xc8;return function(_0x1ccef8){if(_0x1ccef8){return _0x1caae4[_0x4073('0x27')](_0x3faf13)[_0x4073('0x29')](_0x1ccef8);}};}function respondWithFilteredResult(_0x5b532f,_0x14b172){return function(_0x2202ed){if(_0x2202ed){var _0x4277e0=_0x2202ed[_0x4073('0x2a')],_0x4171cc=_0x14b172[_0x4073('0x2b')],_0x3ffc4f=_0x14b172[_0x4073('0x2b')]+_0x14b172[_0x4073('0x2c')],_0x59fb15;if(_0x3ffc4f>=_0x4277e0){_0x3ffc4f=_0x4277e0;_0x59fb15=0xc8;}else{_0x59fb15=0xce;}_0x5b532f[_0x4073('0x27')](_0x59fb15);return _0x5b532f[_0x4073('0x2d')](_0x4073('0x2e'),_0x4171cc+'-'+_0x3ffc4f+'/'+_0x4277e0)[_0x4073('0x29')](_0x2202ed);}return null;};}function patchUpdates(_0x26f255){return function(_0x102025){try{jsonpatch['apply'](_0x102025,_0x26f255,!![]);}catch(_0xd2fdb9){return BPromise['reject'](_0xd2fdb9);}return _0x102025['save']();};}function saveUpdates(_0x36d16a,_0x1d50fd){return function(_0xb31467){if(_0xb31467){return _0xb31467[_0x4073('0x2f')](_0x36d16a)['then'](function(_0x364a8a){return _0x364a8a;});}return null;};}function removeEntity(_0xda8bea,_0x5cc7a1){return function(_0x4825c1){if(_0x4825c1){return _0x4825c1[_0x4073('0x30')]()[_0x4073('0x1c')](function(){_0xda8bea['status'](0xcc)[_0x4073('0x28')]();});}};}function handleEntityNotFound(_0x57bf2e,_0x29dd0d){return function(_0x52b20e){if(!_0x52b20e){_0x57bf2e[_0x4073('0x26')](0x194);}return _0x52b20e;};}function handleError(_0x4b3ef7,_0x496f5f){_0x496f5f=_0x496f5f||0x1f4;return function(_0x269d57){logger[_0x4073('0x22')](_0x269d57[_0x4073('0x31')]);if(_0x269d57[_0x4073('0x32')]){delete _0x269d57['name'];}_0x4b3ef7['status'](_0x496f5f)['send'](_0x269d57);};}exports[_0x4073('0x33')]=function(_0x12827c,_0x4622f2){var _0x4bff6d={},_0x35832b={},_0xd7772a={'count':0x0,'rows':[]};var _0x2ec147=_[_0x4073('0x34')](db[_0x4073('0x35')][_0x4073('0x36')],function(_0x192c3d){return{'name':_0x192c3d[_0x4073('0x37')],'type':_0x192c3d[_0x4073('0x38')][_0x4073('0x39')]};});_0x35832b[_0x4073('0x3a')]=_[_0x4073('0x34')](_0x2ec147,_0x4073('0x32'));_0x35832b[_0x4073('0x3b')]=_[_0x4073('0x3c')](_0x12827c[_0x4073('0x3b')]);_0x35832b[_0x4073('0x3d')]=_[_0x4073('0x3e')](_0x35832b['model'],_0x35832b[_0x4073('0x3b')]);_0x4bff6d['attributes']=_['intersection'](_0x35832b[_0x4073('0x3a')],qs[_0x4073('0x3f')](_0x12827c[_0x4073('0x3b')][_0x4073('0x3f')]));_0x4bff6d[_0x4073('0x40')]=_0x4bff6d['attributes']['length']?_0x4bff6d[_0x4073('0x40')]:_0x35832b[_0x4073('0x3a')];if(!_0x12827c['query']['hasOwnProperty'](_0x4073('0x41'))){_0x4bff6d['limit']=qs[_0x4073('0x2c')](_0x12827c[_0x4073('0x3b')][_0x4073('0x2c')]);_0x4bff6d[_0x4073('0x2b')]=qs[_0x4073('0x2b')](_0x12827c[_0x4073('0x3b')]['offset']);}_0x4bff6d[_0x4073('0x42')]=qs[_0x4073('0x43')](_0x12827c[_0x4073('0x3b')][_0x4073('0x43')]);_0x4bff6d[_0x4073('0x44')]=qs[_0x4073('0x3d')](_[_0x4073('0x45')](_0x12827c['query'],_0x35832b[_0x4073('0x3d')]),_0x2ec147);if(_0x12827c[_0x4073('0x3b')][_0x4073('0x46')]){_0x4bff6d[_0x4073('0x44')]=_[_0x4073('0x47')](_0x4bff6d[_0x4073('0x44')],{'$or':_[_0x4073('0x34')](_0x2ec147,function(_0xd0f652){if(_0xd0f652[_0x4073('0x38')]!==_0x4073('0x48')){var _0x39d416={};_0x39d416[_0xd0f652[_0x4073('0x32')]]={'$like':'%'+_0x12827c[_0x4073('0x3b')][_0x4073('0x46')]+'%'};return _0x39d416;}})});}_0x4bff6d=_[_0x4073('0x47')]({},_0x4bff6d,_0x12827c[_0x4073('0x49')]);var _0x4e4f65={'where':_0x4bff6d[_0x4073('0x44')]};return db[_0x4073('0x35')][_0x4073('0x2a')](_0x4e4f65)[_0x4073('0x1c')](function(_0x4276d5){_0xd7772a[_0x4073('0x2a')]=_0x4276d5;if(_0x12827c[_0x4073('0x3b')][_0x4073('0x4a')]){_0x4bff6d['include']=[{'all':!![]}];}return db[_0x4073('0x35')][_0x4073('0x4b')](_0x4bff6d);})['then'](function(_0x4f29b4){_0xd7772a[_0x4073('0x4c')]=_0x4f29b4;return _0xd7772a;})[_0x4073('0x1c')](respondWithFilteredResult(_0x4622f2,_0x4bff6d))[_0x4073('0x4d')](handleError(_0x4622f2,null));};exports['show']=function(_0x2c0cae,_0x21083b){var _0xa52173={'raw':!![],'where':{'id':_0x2c0cae['params']['id']}},_0x13887b={};_0x13887b[_0x4073('0x3a')]=_['keys'](db[_0x4073('0x35')][_0x4073('0x36')]);_0x13887b['query']=_[_0x4073('0x3c')](_0x2c0cae[_0x4073('0x3b')]);_0x13887b[_0x4073('0x3d')]=_[_0x4073('0x3e')](_0x13887b[_0x4073('0x3a')],_0x13887b[_0x4073('0x3b')]);_0xa52173['attributes']=_[_0x4073('0x3e')](_0x13887b[_0x4073('0x3a')],qs['fields'](_0x2c0cae[_0x4073('0x3b')]['fields']));_0xa52173[_0x4073('0x40')]=_0xa52173['attributes'][_0x4073('0x4e')]?_0xa52173[_0x4073('0x40')]:_0x13887b['model'];if(_0x2c0cae['query'][_0x4073('0x4a')]){_0xa52173[_0x4073('0x4f')]=[{'all':!![]}];}_0xa52173=_[_0x4073('0x47')]({},_0xa52173,_0x2c0cae[_0x4073('0x49')]);return db[_0x4073('0x35')]['find'](_0xa52173)['then'](handleEntityNotFound(_0x21083b,null))[_0x4073('0x1c')](respondWithResult(_0x21083b,null))['catch'](handleError(_0x21083b,null));};exports['create']=function(_0x297b2a,_0x1fe317){return db[_0x4073('0x35')][_0x4073('0x50')](_0x297b2a[_0x4073('0x51')],{})[_0x4073('0x1c')](respondWithResult(_0x1fe317,0xc9))[_0x4073('0x4d')](handleError(_0x1fe317,null));};exports[_0x4073('0x2f')]=function(_0x2855c8,_0x1e54cc){if(_0x2855c8[_0x4073('0x51')]['id']){delete _0x2855c8['body']['id'];}return db[_0x4073('0x35')][_0x4073('0x52')]({'where':{'id':_0x2855c8[_0x4073('0x53')]['id']}})[_0x4073('0x1c')](handleEntityNotFound(_0x1e54cc,null))[_0x4073('0x1c')](saveUpdates(_0x2855c8['body'],null))[_0x4073('0x1c')](respondWithResult(_0x1e54cc,null))['catch'](handleError(_0x1e54cc,null));};exports[_0x4073('0x30')]=function(_0x498fb6,_0x4efc5b){return db['OpenchannelMessage'][_0x4073('0x52')]({'where':{'id':_0x498fb6[_0x4073('0x53')]['id']}})[_0x4073('0x1c')](handleEntityNotFound(_0x4efc5b,null))[_0x4073('0x1c')](removeEntity(_0x4efc5b,null))[_0x4073('0x4d')](handleError(_0x4efc5b,null));};exports[_0x4073('0x54')]=function(_0x3e0536,_0x5b7077){return db[_0x4073('0x35')][_0x4073('0x54')]()['then'](respondWithResult(_0x5b7077,null))[_0x4073('0x4d')](handleError(_0x5b7077,null));};var interaction_log=require(_0x4073('0x55'))(_0x4073('0x56'));exports[_0x4073('0x57')]=function(_0x5d3f23,_0x213ed9,_0x3a85bf){var _0x2bbd54={'agent':{},'channel':'openchannel'};if(_0x5d3f23['body']['id']){delete _0x5d3f23['body']['id'];}_0x5d3f23['body'][_0x4073('0x58')]=!![];_0x5d3f23[_0x4073('0x51')][_0x4073('0x59')]=moment()[_0x4073('0x5a')](_0x4073('0x5b'));_0x5d3f23[_0x4073('0x51')]['UserId']=_0x5d3f23['body'][_0x4073('0x5c')]||_0x5d3f23[_0x4073('0x5d')]['id'];_0x2bbd54[_0x4073('0x5e')]['id']=_0x5d3f23[_0x4073('0x51')][_0x4073('0x5c')];return db[_0x4073('0x35')][_0x4073('0x52')]({'where':{'id':_0x5d3f23[_0x4073('0x53')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x4073('0x5f')}]})[_0x4073('0x1c')](handleEntityNotFound(_0x213ed9,null))['then'](saveUpdates(_0x5d3f23[_0x4073('0x51')],null))[_0x4073('0x1c')](function(_0xbc79d4){if(_0xbc79d4){_0x2bbd54[_0x4073('0x24')]=_0xbc79d4['get']({'plain':!![]});return db[_0x4073('0x60')][_0x4073('0x52')]({'where':{'id':_0xbc79d4[_0x4073('0x61')]}});}return null;})[_0x4073('0x1c')](handleEntityNotFound(_0x213ed9,null))[_0x4073('0x1c')](function(_0x5c8180){if(_0x5c8180){return _0x5c8180[_0x4073('0x2f')]({'UserId':_0x5d3f23[_0x4073('0x51')]['UserId'],'read1stAt':_[_0x4073('0x62')](_0x5c8180[_0x4073('0x63')])?moment()[_0x4073('0x5a')](_0x4073('0x5b')):undefined});}return null;})[_0x4073('0x1c')](function(_0x428657){if(_0x428657){_0x2bbd54[_0x4073('0x64')]=_0x428657[_0x4073('0x65')]({'plain':!![]});interaction_log[_0x4073('0x1d')](_0x4073('0x66'),_0x5d3f23[_0x4073('0x5d')]['id'],_0x5d3f23[_0x4073('0x5d')][_0x4073('0x32')],_0x5d3f23['user']['role'],_0x2bbd54[_0x4073('0x64')]['id'],_0x5d3f23[_0x4073('0x51')]?JSON[_0x4073('0x21')](_0x5d3f23[_0x4073('0x51')]):_0x4073('0x67'));return respondWithRpcPromise(_0x4073('0x68'),_0x4073('0x69'),_0x2bbd54);}return null;})[_0x4073('0x1c')](function(_0x5a772d){if(_0x5a772d){if(_0x5d3f23[_0x4073('0x51')][_0x4073('0x6a')]){_0x2bbd54[_0x4073('0x24')][_0x4073('0x6b')]=util[_0x4073('0x5a')]('SIP/%s',_0x5d3f23[_0x4073('0x5d')][_0x4073('0x32')]);_0x2bbd54[_0x4073('0x24')]['channel']=_0x2bbd54[_0x4073('0x6c')];_0x2bbd54[_0x4073('0x24')]['event']='accept';return respondWithRpcPromise(_0x4073('0x6d'),_0x4073('0x6d'),{'event':_0x4073('0x6e'),'message':_0x2bbd54[_0x4073('0x24')]},client9002)[_0x4073('0x1c')](function(){return _0x2bbd54;});}return _0x2bbd54;}return null;})['then'](respondWithResult(_0x213ed9,null))[_0x4073('0x4d')](handleError(_0x213ed9,null));};var interaction_log=require(_0x4073('0x55'))(_0x4073('0x56'));exports[_0x4073('0x6f')]=function(_0x3e8796,_0x466362,_0x49206e){var _0x39471d={'agent':{},'channel':_0x4073('0x70')};if(_0x3e8796[_0x4073('0x51')]['id']){delete _0x3e8796['body']['id'];}_0x3e8796['body'][_0x4073('0x5c')]=_0x3e8796['body'][_0x4073('0x5c')]||_0x3e8796[_0x4073('0x5d')]['id'];_0x39471d['agent']['id']=_0x3e8796[_0x4073('0x51')]['UserId'];return db[_0x4073('0x35')]['find']({'where':{'id':_0x3e8796[_0x4073('0x53')]['id'],'UserId':null}})[_0x4073('0x1c')](handleEntityNotFound(_0x466362,null))[_0x4073('0x1c')](function(_0x2d0adb){if(_0x2d0adb){_0x39471d['message']=_0x2d0adb[_0x4073('0x65')]({'plain':!![]});return db[_0x4073('0x60')]['find']({'where':{'id':_0x2d0adb[_0x4073('0x61')]}});}return null;})[_0x4073('0x1c')](handleEntityNotFound(_0x466362,null))['then'](function(_0x5b7fe1){if(_0x5b7fe1){_0x39471d[_0x4073('0x64')]=_0x5b7fe1[_0x4073('0x65')]({'plain':!![]});interaction_log[_0x4073('0x1d')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3e8796[_0x4073('0x5d')]['id'],_0x3e8796['user'][_0x4073('0x32')],_0x3e8796[_0x4073('0x5d')][_0x4073('0x71')],_0x39471d[_0x4073('0x64')]['id'],_0x3e8796['body']?JSON[_0x4073('0x21')](_0x3e8796['body']):_0x4073('0x67'));return respondWithRpcPromise(_0x4073('0x72'),_0x4073('0x73'),_0x39471d);}return null;})[_0x4073('0x1c')](function(_0x25707f){if(_0x25707f){_0x25707f[_0x4073('0x24')][_0x4073('0x6b')]=util['format'](_0x4073('0x74'),_0x3e8796[_0x4073('0x5d')][_0x4073('0x32')]);_0x25707f[_0x4073('0x24')]['channel']=_0x39471d['channel'];_0x25707f[_0x4073('0x24')][_0x4073('0x75')]='reject';respondWithRpcPromise('EventManager',_0x4073('0x6d'),{'event':'rejectmessage','message':_0x25707f[_0x4073('0x24')]},client9002);return _0x39471d;}return null;})[_0x4073('0x1c')](respondWithResult(_0x466362,null))['catch'](handleError(_0x466362,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 100c772..431fdbd 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 _0x274a=['events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','emit','hook','exports'];(function(_0x365bb6,_0x3f32e0){var _0x62e1c8=function(_0x12a7b0){while(--_0x12a7b0){_0x365bb6['push'](_0x365bb6['shift']());}};_0x62e1c8(++_0x3f32e0);}(_0x274a,0x17a));var _0xa274=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0x274a[_0xf73c09];return _0xa8923c;};'use strict';var EventEmitter=require(_0xa274('0x0'));var OpenchannelMessage=require(_0xa274('0x1'))['db'][_0xa274('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xa274('0x3')](0x0);var events={'afterCreate':_0xa274('0x4'),'afterUpdate':_0xa274('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4d5407){return function(_0x31edf1,_0x976f02,_0x4014ab){OpenchannelMessageEvents[_0xa274('0x6')](_0x4d5407+':'+_0x31edf1['id'],_0x31edf1);OpenchannelMessageEvents[_0xa274('0x6')](_0x4d5407,_0x31edf1);_0x4014ab(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xa274('0x7')](e,emitEvent(event));}}module[_0xa274('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x4df9=['emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','remove'];(function(_0xd90969,_0x538fd9){var _0xa05989=function(_0x572fe3){while(--_0x572fe3){_0xd90969['push'](_0xd90969['shift']());}};_0xa05989(++_0x538fd9);}(_0x4df9,0x73));var _0x94df=function(_0x3e93e2,_0xd6999e){_0x3e93e2=_0x3e93e2-0x0;var _0x150f7d=_0x4df9[_0x3e93e2];return _0x150f7d;};'use strict';var EventEmitter=require(_0x94df('0x0'));var OpenchannelMessage=require(_0x94df('0x1'))['db'][_0x94df('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x94df('0x3')};function emitEvent(_0x1b21b0){return function(_0x1f4ab5,_0x13b3f6,_0x53d440){OpenchannelMessageEvents[_0x94df('0x4')](_0x1b21b0+':'+_0x1f4ab5['id'],_0x1f4ab5);OpenchannelMessageEvents[_0x94df('0x4')](_0x1b21b0,_0x1f4ab5);_0x53d440(null);};}for(var e in events){if(events[_0x94df('0x5')](e)){var event=events[e];OpenchannelMessage[_0x94df('0x6')](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 3e3e09b..f31a7c8 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 _0x5b67=['omit','POST','method','GET','threadId','update','Interaction','inspect','finally','util','api','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length'];(function(_0x14538f,_0x5f11a2){var _0x42db04=function(_0x5bc627){while(--_0x5bc627){_0x14538f['push'](_0x14538f['shift']());}};_0x42db04(++_0x5f11a2);}(_0x5b67,0x6d));var _0x75b6=function(_0x180561,_0x1e208b){_0x180561=_0x180561-0x0;var _0x2b3997=_0x5b67[_0x180561];return _0x2b3997;};'use strict';var _=require('lodash');var util=require(_0x75b6('0x0'));var logger=require('../../config/logger')(_0x75b6('0x1'));var moment=require('moment');var BPromise=require(_0x75b6('0x2'));var rp=require(_0x75b6('0x3'));var fs=require('fs');var path=require(_0x75b6('0x4'));var rimraf=require(_0x75b6('0x5'));var config=require('../../config/environment');var attributes=require(_0x75b6('0x6'));module[_0x75b6('0x7')]=function(_0x349c8a,_0x2a9acb){return _0x349c8a[_0x75b6('0x8')](_0x75b6('0x9'),attributes,{'tableName':_0x75b6('0xa'),'paranoid':![],'indexes':[{'name':_0x75b6('0xb'),'fields':[_0x75b6('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a1593,_0x58aece,_0x3dc6e9){var _0x3c4610=_0x349c8a[_0x75b6('0xd')];var _0x1c2f0=_0x2a1593[_0x75b6('0xe')]({'plain':!![]});if(_0x1c2f0[_0x75b6('0xf')][_0x75b6('0x10')]()==='in'||_0x1c2f0[_0x75b6('0xf')]['toLowerCase']()===_0x75b6('0x11')&&!_0x1c2f0[_0x75b6('0x12')]&&!_['isNil'](_0x1c2f0[_0x75b6('0x13')])){_0x3c4610[_0x75b6('0x14')]['findOne']({'where':{'id':_0x1c2f0[_0x75b6('0x15')]}})[_0x75b6('0x16')](function(_0x12fea8){if(_0x12fea8){_0x12fea8['update']({'lastMsgAt':_0x1c2f0[_0x75b6('0x17')],'lastMsgDirection':_0x1c2f0['direction'][_0x75b6('0x10')]()});}})[_0x75b6('0x18')](function(_0xf74fc9){console[_0x75b6('0x19')](_0xf74fc9);});}if(_0x1c2f0['direction']==='out'&&!_0x1c2f0[_0x75b6('0x12')]){var _0xd066cb;_0x3c4610[_0x75b6('0x1a')][_0x75b6('0x1b')]()['then'](function(_0x4c0e50){return _0x3c4610[_0x75b6('0x1c')][_0x75b6('0x1d')]({'where':{'id':_0x1c2f0[_0x75b6('0x1e')]},'include':[{'model':_0x3c4610['OpenchannelInteraction'],'as':_0x75b6('0x1f'),'where':{'id':_0x1c2f0[_0x75b6('0x15')]},'limit':0x1,'include':[{'model':_0x3c4610[_0x75b6('0x1a')],'as':_0x75b6('0x20'),'attributes':_[_0x75b6('0x21')](_0x4c0e50)}]}]});})['then'](function(_0x12b839){_0xd066cb=_0x12b839[_0x75b6('0xe')]({'plain':!![]});if(_0xd066cb&&_0xd066cb[_0x75b6('0x22')]){logger[_0x75b6('0x23')](_0x75b6('0x24'),_0x75b6('0x25'),util[_0x75b6('0x26')](_0x75b6('0x27'),_0x1c2f0['id'],_0xd066cb[_0x75b6('0x22')]));if(_0xd066cb[_0x75b6('0x1f')]&&_0xd066cb['Interactions'][_0x75b6('0x28')]){_0x1c2f0['Interaction']=_[_0x75b6('0x29')](_0xd066cb[_0x75b6('0x1f')][0x0],_0x75b6('0x20'));_0x1c2f0[_0x75b6('0x20')]=_0xd066cb['Interactions'][0x0][_0x75b6('0x20')];}var _0x58aece={'method':_0x75b6('0x2a'),'uri':encodeURI(_0xd066cb[_0x75b6('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x58aece[_0x75b6('0x2b')]){case _0x75b6('0x2c'):_0x58aece['qs']=_0x1c2f0;break;case _0x75b6('0x2a'):_0x58aece[_0x75b6('0xc')]=_0x1c2f0;break;}return rp(_0x58aece)['then'](function(_0x1d9349){logger[_0x75b6('0x23')](_0x75b6('0x24'),'afterCreate',util[_0x75b6('0x26')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x1c2f0['id'],_0xd066cb[_0x75b6('0x22')]));if(_0x1d9349[_0x75b6('0xc')][_0x75b6('0x2d')]&&_0x1d9349[_0x75b6('0xc')][_0x75b6('0x2d')]!=_0x1c2f0['Interaction']['threadId']){return _0x3c4610['OpenchannelInteraction'][_0x75b6('0x2e')]({'threadId':_0x1d9349[_0x75b6('0xc')]['threadId']},{'logging':!![],'where':{'id':_0x1c2f0[_0x75b6('0x2f')]['id']}});}else{return;}})[_0x75b6('0x16')](function(){return _0x2a1593[_0x75b6('0x2e')]({'read':!![]});})[_0x75b6('0x18')](function(_0x20b92b){logger['error'](_0x75b6('0x24'),_0x75b6('0x25'),util[_0x75b6('0x30')](_0x20b92b,{'showHidden':![],'depth':null}));_0x3dc6e9();});}else{_0x3dc6e9();}})[_0x75b6('0x31')](function(){_0x3dc6e9();});}else{_0x3dc6e9();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x375d=['Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','error','inspect','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','models','get','toLowerCase','direction','out','secret','isNil','OpenchannelInteraction','OpenchannelInteractionId','then','update','OpenchannelAccount','find','OpenchannelAccountId','Interactions','CmContact','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','POST','method','info','afterCreate','format'];(function(_0x3f9f0f,_0x531b30){var _0x2eb31d=function(_0x43feb1){while(--_0x43feb1){_0x3f9f0f['push'](_0x3f9f0f['shift']());}};_0x2eb31d(++_0x531b30);}(_0x375d,0x9a));var _0xd375=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x375d[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xd375('0x0'));var logger=require(_0xd375('0x1'))(_0xd375('0x2'));var moment=require(_0xd375('0x3'));var BPromise=require(_0xd375('0x4'));var rp=require(_0xd375('0x5'));var fs=require('fs');var path=require(_0xd375('0x6'));var rimraf=require(_0xd375('0x7'));var config=require('../../config/environment');var attributes=require(_0xd375('0x8'));module[_0xd375('0x9')]=function(_0x28606e,_0x193ece){return _0x28606e[_0xd375('0xa')]('OpenchannelMessage',attributes,{'tableName':_0xd375('0xb'),'paranoid':![],'indexes':[{'name':_0xd375('0xc'),'fields':[_0xd375('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x66a455,_0x264c1c,_0x253c4d){var _0x1c0ad1=_0x28606e[_0xd375('0xe')];var _0x594c42=_0x66a455[_0xd375('0xf')]({'plain':!![]});if(_0x594c42['direction'][_0xd375('0x10')]()==='in'||_0x594c42[_0xd375('0x11')][_0xd375('0x10')]()===_0xd375('0x12')&&!_0x594c42[_0xd375('0x13')]&&!_[_0xd375('0x14')](_0x594c42['UserId'])){_0x1c0ad1[_0xd375('0x15')]['findOne']({'where':{'id':_0x594c42[_0xd375('0x16')]}})[_0xd375('0x17')](function(_0x5443c2){if(_0x5443c2){_0x5443c2[_0xd375('0x18')]({'lastMsgAt':_0x594c42['createdAt'],'lastMsgDirection':_0x594c42[_0xd375('0x11')][_0xd375('0x10')]()});}})['catch'](function(_0x21159f){console['error'](_0x21159f);});}if(_0x594c42['direction']===_0xd375('0x12')&&!_0x594c42[_0xd375('0x13')]){var _0x5877cd;_0x1c0ad1['CmContact']['describe']()[_0xd375('0x17')](function(_0xa605e1){return _0x1c0ad1[_0xd375('0x19')][_0xd375('0x1a')]({'where':{'id':_0x594c42[_0xd375('0x1b')]},'include':[{'model':_0x1c0ad1[_0xd375('0x15')],'as':_0xd375('0x1c'),'where':{'id':_0x594c42['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x1c0ad1[_0xd375('0x1d')],'as':_0xd375('0x1e'),'attributes':_[_0xd375('0x1f')](_0xa605e1)}]}]});})[_0xd375('0x17')](function(_0x403a0b){_0x5877cd=_0x403a0b[_0xd375('0xf')]({'plain':!![]});if(_0x5877cd&&_0x5877cd[_0xd375('0x20')]){logger['info'](_0xd375('0x21'),'afterCreate',util['format'](_0xd375('0x22'),_0x594c42['id'],_0x5877cd[_0xd375('0x20')]));if(_0x5877cd['Interactions']&&_0x5877cd['Interactions'][_0xd375('0x23')]){_0x594c42[_0xd375('0x24')]=_['omit'](_0x5877cd[_0xd375('0x1c')][0x0],_0xd375('0x1e'));_0x594c42[_0xd375('0x1e')]=_0x5877cd['Interactions'][0x0][_0xd375('0x1e')];}var _0x264c1c={'method':_0xd375('0x25'),'uri':encodeURI(_0x5877cd['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x264c1c[_0xd375('0x26')]){case'GET':_0x264c1c['qs']=_0x594c42;break;case'POST':_0x264c1c[_0xd375('0xd')]=_0x594c42;break;}return rp(_0x264c1c)[_0xd375('0x17')](function(_0x2ac3b7){logger[_0xd375('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0xd375('0x28'),util[_0xd375('0x29')](_0xd375('0x2a'),_0x594c42['id'],_0x5877cd[_0xd375('0x20')]));if(_0x2ac3b7[_0xd375('0xd')][_0xd375('0x2b')]&&_0x2ac3b7['body'][_0xd375('0x2b')]!=_0x594c42[_0xd375('0x24')][_0xd375('0x2b')]){return _0x1c0ad1[_0xd375('0x15')][_0xd375('0x18')]({'threadId':_0x2ac3b7['body'][_0xd375('0x2b')]},{'logging':!![],'where':{'id':_0x594c42[_0xd375('0x24')]['id']}});}else{return;}})[_0xd375('0x17')](function(){return _0x66a455[_0xd375('0x18')]({'read':!![]});})[_0xd375('0x2c')](function(_0x25c54d){logger[_0xd375('0x2d')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xd375('0x2e')](_0x25c54d,{'showHidden':![],'depth':null}));_0x253c4d();});}else{_0x253c4d();}})[_0xd375('0x2f')](function(){_0x253c4d();});}else{_0x253c4d();}}},'charset':'utf8mb4','collate':_0xd375('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 0ee620f..13b4993 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 _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0x131bf5,_0x25748b){var _0x399747=function(_0x42e8e3){while(--_0x42e8e3){_0x131bf5['push'](_0x131bf5['shift']());}};_0x399747(++_0x25748b);}(_0xb10b,0x12a));var _0xbb10=function(_0x5b47d9,_0x1327ce){_0x5b47d9=_0x5b47d9-0x0;var _0x4151f0=_0xb10b[_0x5b47d9];return _0x4151f0;};'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});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file +var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0x5b3ef5,_0x4199a7){var _0x185542=function(_0x5166bd){while(--_0x5166bd){_0x5b3ef5['push'](_0x5b3ef5['shift']());}};_0x185542(++_0x4199a7);}(_0xb10b,0x12a));var _0xbb10=function(_0x49ab20,_0x204482){_0x49ab20=_0x49ab20-0x0;var _0x3c10b4=_0xb10b[_0x49ab20];return _0x3c10b4;};'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});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 776eed4..95a7d37 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 _0xb43b=['./openchannelMessage.events','save','update','emit','removeListener','length','openchannelMessage:'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4f989a,_0x27f5f3){_0x4f989a=_0x4f989a-0x0;var _0x292d51=_0xb43b[_0x4f989a];return _0x292d51;};'use strict';var OpenchannelMessageEvents=require(_0xbb43('0x0'));var events=[_0xbb43('0x1'),'remove',_0xbb43('0x2')];function createListener(_0x1995f8,_0x22bc86){return function(_0x4cf605){_0x22bc86[_0xbb43('0x3')](_0x1995f8,_0x4cf605);};}function removeListener(_0x41aff6,_0x351254){return function(){OpenchannelMessageEvents[_0xbb43('0x4')](_0x41aff6,_0x351254);};}exports['register']=function(_0x491fb9){for(var _0x378df5=0x0,_0x553520=events[_0xbb43('0x5')];_0x378df5<_0x553520;_0x378df5++){var _0x1ccd49=events[_0x378df5];var _0x2a2f11=createListener(_0xbb43('0x6')+_0x1ccd49,_0x491fb9);OpenchannelMessageEvents['on'](_0x1ccd49,_0x2a2f11);}}; \ No newline at end of file +var _0x9bde=['openchannelMessage:','save','update','emit','removeListener','register','length'];(function(_0x29d623,_0x1a5c9c){var _0x242e59=function(_0x2c78ab){while(--_0x2c78ab){_0x29d623['push'](_0x29d623['shift']());}};_0x242e59(++_0x1a5c9c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5d765a,_0x24b15e){_0x5d765a=_0x5d765a-0x0;var _0x7ad8f2=_0x9bde[_0x5d765a];return _0x7ad8f2;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xe9bd('0x0'),'remove',_0xe9bd('0x1')];function createListener(_0x4c63ca,_0x51786f){return function(_0x3005aa){_0x51786f[_0xe9bd('0x2')](_0x4c63ca,_0x3005aa);};}function removeListener(_0x1c1b34,_0x10822d){return function(){OpenchannelMessageEvents[_0xe9bd('0x3')](_0x1c1b34,_0x10822d);};}exports[_0xe9bd('0x4')]=function(_0x4fd7b8){for(var _0x4763e9=0x0,_0x5f18fe=events[_0xe9bd('0x5')];_0x4763e9<_0x5f18fe;_0x4763e9++){var _0xa66ae2=events[_0x4763e9];var _0x2d5c75=createListener(_0xe9bd('0x6')+_0xa66ae2,_0x4fd7b8);OpenchannelMessageEvents['on'](_0xa66ae2,_0x2d5c75);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 196a5a6..25f80e4 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 _0xeecc=['isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','./openchannelQueue.controller','get'];(function(_0x2c0ded,_0x3de22c){var _0x4473e5=function(_0x3705bc){while(--_0x3705bc){_0x2c0ded['push'](_0x2c0ded['shift']());}};_0x4473e5(++_0x3de22c);}(_0xeecc,0x12d));var _0xceec=function(_0x83c9d6,_0x50f6f4){_0x83c9d6=_0x83c9d6-0x0;var _0x196cef=_0xeecc[_0x83c9d6];return _0x196cef;};'use strict';var multer=require(_0xceec('0x0'));var util=require(_0xceec('0x1'));var path=require(_0xceec('0x2'));var timeout=require(_0xceec('0x3'));var express=require('express');var router=express[_0xceec('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xceec('0x5'));router[_0xceec('0x6')]('/',auth[_0xceec('0x7')](),controller[_0xceec('0x8')]);router['get'](_0xceec('0x9'),auth['isAuthenticated'](),controller[_0xceec('0xa')]);router[_0xceec('0x6')](_0xceec('0xb'),auth[_0xceec('0x7')](),controller[_0xceec('0xc')]);router[_0xceec('0x6')](_0xceec('0xd'),auth['isAuthenticated'](),controller[_0xceec('0xe')]);router[_0xceec('0x6')](_0xceec('0xf'),auth[_0xceec('0x7')](),controller[_0xceec('0x10')]);router['get'](_0xceec('0x11'),auth[_0xceec('0x7')](),controller[_0xceec('0x12')]);router[_0xceec('0x13')]('/',auth[_0xceec('0x7')](),controller['create']);router[_0xceec('0x13')]('/:id/teams',auth[_0xceec('0x7')](),controller[_0xceec('0x14')]);router[_0xceec('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0xceec('0x15')]);router['put'](_0xceec('0xb'),auth[_0xceec('0x7')](),controller[_0xceec('0x16')]);router[_0xceec('0x17')](_0xceec('0xb'),auth[_0xceec('0x7')](),controller[_0xceec('0x18')]);router[_0xceec('0x17')](_0xceec('0xf'),auth[_0xceec('0x7')](),controller[_0xceec('0x19')]);router['delete'](_0xceec('0x11'),auth[_0xceec('0x7')](),controller[_0xceec('0x1a')]);module[_0xceec('0x1b')]=router; \ No newline at end of file +var _0x51f2=['describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x39de0c,_0x33efb4){var _0x161315=function(_0x1e752d){while(--_0x1e752d){_0x39de0c['push'](_0x39de0c['shift']());}};_0x161315(++_0x33efb4);}(_0x51f2,0xeb));var _0x251f=function(_0x17d9a0,_0x18e847){_0x17d9a0=_0x17d9a0-0x0;var _0x1f1420=_0x51f2[_0x17d9a0];return _0x1f1420;};'use strict';var multer=require(_0x251f('0x0'));var util=require(_0x251f('0x1'));var path=require(_0x251f('0x2'));var timeout=require(_0x251f('0x3'));var express=require(_0x251f('0x4'));var router=express[_0x251f('0x5')]();var auth=require(_0x251f('0x6'));var interaction=require(_0x251f('0x7'));var config=require(_0x251f('0x8'));var controller=require('./openchannelQueue.controller');router[_0x251f('0x9')]('/',auth[_0x251f('0xa')](),controller[_0x251f('0xb')]);router[_0x251f('0x9')](_0x251f('0xc'),auth['isAuthenticated'](),controller[_0x251f('0xd')]);router[_0x251f('0x9')](_0x251f('0xe'),auth[_0x251f('0xa')](),controller['show']);router[_0x251f('0x9')](_0x251f('0xf'),auth[_0x251f('0xa')](),controller[_0x251f('0x10')]);router['get'](_0x251f('0x11'),auth[_0x251f('0xa')](),controller[_0x251f('0x12')]);router[_0x251f('0x9')]('/:id/users',auth[_0x251f('0xa')](),controller[_0x251f('0x13')]);router[_0x251f('0x14')]('/',auth[_0x251f('0xa')](),controller[_0x251f('0x15')]);router[_0x251f('0x14')](_0x251f('0x11'),auth[_0x251f('0xa')](),controller[_0x251f('0x16')]);router[_0x251f('0x14')](_0x251f('0x17'),auth['isAuthenticated'](),controller[_0x251f('0x18')]);router[_0x251f('0x19')]('/:id',auth[_0x251f('0xa')](),controller[_0x251f('0x1a')]);router[_0x251f('0x1b')](_0x251f('0xe'),auth[_0x251f('0xa')](),controller['destroy']);router['delete'](_0x251f('0x11'),auth[_0x251f('0xa')](),controller[_0x251f('0x1c')]);router[_0x251f('0x1b')](_0x251f('0x17'),auth['isAuthenticated'](),controller[_0x251f('0x1d')]);module[_0x251f('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 2d9317f..594a0ab 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 _0xb8cb=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','beepall'];(function(_0x69a748,_0x7e2ee1){var _0x116db0=function(_0x67e3ab){while(--_0x67e3ab){_0x69a748['push'](_0x69a748['shift']());}};_0x116db0(++_0x7e2ee1);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x5645f9,_0x2b915f){_0x5645f9=_0x5645f9-0x0;var _0x27f808=_0xb8cb[_0x5645f9];return _0x27f808;};'use strict';var Sequelize=require(_0xbb8c('0x0'));module[_0xbb8c('0x1')]={'name':{'type':Sequelize[_0xbb8c('0x2')],'unique':_0xbb8c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbb8c('0x2')]},'timeout':{'type':Sequelize[_0xbb8c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbb8c('0x5')]('rrmemory',_0xbb8c('0x6'),_0xbb8c('0x7'))}}; \ No newline at end of file +var _0xa884=['rrmemory','sequelize','exports','STRING','name'];(function(_0xb540ba,_0x22d81f){var _0x20b84c=function(_0x5249ef){while(--_0x5249ef){_0xb540ba['push'](_0xb540ba['shift']());}};_0x20b84c(++_0x22d81f);}(_0xa884,0x1b4));var _0x4a88=function(_0x71b765,_0x3053f8){_0x71b765=_0x71b765-0x0;var _0x34cb24=_0xa884[_0x71b765];return _0x34cb24;};'use strict';var Sequelize=require(_0x4a88('0x0'));module[_0x4a88('0x1')]={'name':{'type':Sequelize[_0x4a88('0x2')],'unique':_0x4a88('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4a88('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4a88('0x4'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 2c6dd94..2bcdcf8 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 _0xf31d=['OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeTeams','isEmpty','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','OpenchannelQueues','sendStatus','stack','name','index','map','OpenchannelQueue','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','destroy','describe','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','SIP','Team','getTeams','addTeams','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','ids','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0xf31d,0x132));var _0xdf31=function(_0x102f97,_0x5bda2f){_0x102f97=_0x102f97-0x0;var _0xd22058=_0xf31d[_0x102f97];return _0xd22058;};'use strict';var pdf=require(_0xdf31('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdf31('0x1'));var rp=require(_0xdf31('0x2'));var moment=require(_0xdf31('0x3'));var BPromise=require(_0xdf31('0x4'));var Mustache=require('mustache');var util=require(_0xdf31('0x5'));var path=require('path');var sox=require(_0xdf31('0x6'));var csv=require(_0xdf31('0x7'));var ejs=require(_0xdf31('0x8'));var fs=require('fs');var _=require(_0xdf31('0x9'));var squel=require(_0xdf31('0xa'));var crypto=require(_0xdf31('0xb'));var jsforce=require(_0xdf31('0xc'));var deskjs=require(_0xdf31('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdf31('0xe'));var Papa=require(_0xdf31('0xf'));var Redis=require('ioredis');var authService=require(_0xdf31('0x10'));var qs=require(_0xdf31('0x11'));var as=require(_0xdf31('0x12'));var hardwareService=require(_0xdf31('0x13'));var logger=require(_0xdf31('0x14'))(_0xdf31('0x15'));var utils=require(_0xdf31('0x16'));var config=require(_0xdf31('0x17'));var licenseUtil=require(_0xdf31('0x18'));var db=require(_0xdf31('0x19'))['db'];config[_0xdf31('0x1a')]=_[_0xdf31('0x1b')](config[_0xdf31('0x1a')],{'host':_0xdf31('0x1c'),'port':0x18eb});var socket=require(_0xdf31('0x1d'))(new Redis(config[_0xdf31('0x1a')]));require(_0xdf31('0x1e'))[_0xdf31('0x1f')](socket);function respondWithStatusCode(_0x3b6625,_0x1101c3){_0x1101c3=_0x1101c3||0xcc;return function(_0x1b7fdf){if(_0x1b7fdf){return _0x3b6625['sendStatus'](_0x1101c3);}return _0x3b6625[_0xdf31('0x20')](_0x1101c3)[_0xdf31('0x21')]();};}function respondWithResult(_0x133904,_0x5befa6){_0x5befa6=_0x5befa6||0xc8;return function(_0x556722){if(_0x556722){return _0x133904[_0xdf31('0x20')](_0x5befa6)[_0xdf31('0x22')](_0x556722);}};}function respondWithFilteredResult(_0x5c635a,_0x311fa3){return function(_0x71f709){if(_0x71f709){var _0x2bed2e=_0x71f709[_0xdf31('0x23')],_0x2ab2cb=_0x311fa3['offset'],_0x274fbd=_0x311fa3[_0xdf31('0x24')]+_0x311fa3[_0xdf31('0x25')],_0x4a31dd;if(_0x274fbd>=_0x2bed2e){_0x274fbd=_0x2bed2e;_0x4a31dd=0xc8;}else{_0x4a31dd=0xce;}_0x5c635a[_0xdf31('0x20')](_0x4a31dd);return _0x5c635a[_0xdf31('0x26')](_0xdf31('0x27'),_0x2ab2cb+'-'+_0x274fbd+'/'+_0x2bed2e)['json'](_0x71f709);}return null;};}function patchUpdates(_0x2be80c){return function(_0x8d4174){try{jsonpatch[_0xdf31('0x28')](_0x8d4174,_0x2be80c,!![]);}catch(_0x414cc8){return BPromise['reject'](_0x414cc8);}return _0x8d4174['save']();};}function saveUpdates(_0x1e5fc3,_0x2de2c7){return function(_0x97a55a){if(_0x97a55a){return _0x97a55a[_0xdf31('0x29')](_0x1e5fc3)[_0xdf31('0x2a')](function(_0x475c06){return _0x475c06;});}return null;};}function removeEntity(_0x5ca81c,_0x96fec6){return function(_0x2b053a){if(_0x2b053a){return _0x2b053a['destroy']()[_0xdf31('0x2a')](function(){var _0x2cb282=_0x2b053a['get']({'plain':!![]});var _0xb22487=_0xdf31('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0xb22487,'resourceId':_0x2cb282['id']}})[_0xdf31('0x2a')](function(){return _0x2b053a;});})[_0xdf31('0x2a')](function(){_0x5ca81c[_0xdf31('0x20')](0xcc)[_0xdf31('0x21')]();});}};}function handleEntityNotFound(_0x306b69,_0x2777de){return function(_0x49ac31){if(!_0x49ac31){_0x306b69[_0xdf31('0x2c')](0x194);}return _0x49ac31;};}function handleError(_0x408de3,_0x242391){_0x242391=_0x242391||0x1f4;return function(_0x2e35aa){logger['error'](_0x2e35aa[_0xdf31('0x2d')]);if(_0x2e35aa[_0xdf31('0x2e')]){delete _0x2e35aa['name'];}_0x408de3[_0xdf31('0x20')](_0x242391)['send'](_0x2e35aa);};}exports[_0xdf31('0x2f')]=function(_0x35fa2a,_0x59103e){var _0x40b8ba={},_0x394c62={},_0x349ba0={'count':0x0,'rows':[]};var _0x35e46a=_[_0xdf31('0x30')](db[_0xdf31('0x31')][_0xdf31('0x32')],function(_0x2dea7f){return{'name':_0x2dea7f['fieldName'],'type':_0x2dea7f[_0xdf31('0x33')][_0xdf31('0x34')]};});_0x394c62[_0xdf31('0x35')]=_[_0xdf31('0x30')](_0x35e46a,_0xdf31('0x2e'));_0x394c62[_0xdf31('0x36')]=_[_0xdf31('0x37')](_0x35fa2a[_0xdf31('0x36')]);_0x394c62[_0xdf31('0x38')]=_['intersection'](_0x394c62[_0xdf31('0x35')],_0x394c62[_0xdf31('0x36')]);_0x40b8ba[_0xdf31('0x39')]=_[_0xdf31('0x3a')](_0x394c62[_0xdf31('0x35')],qs[_0xdf31('0x3b')](_0x35fa2a[_0xdf31('0x36')][_0xdf31('0x3b')]));_0x40b8ba['attributes']=_0x40b8ba['attributes'][_0xdf31('0x3c')]?_0x40b8ba[_0xdf31('0x39')]:_0x394c62[_0xdf31('0x35')];if(!_0x35fa2a['query'][_0xdf31('0x3d')](_0xdf31('0x3e'))){_0x40b8ba['limit']=qs[_0xdf31('0x25')](_0x35fa2a[_0xdf31('0x36')][_0xdf31('0x25')]);_0x40b8ba[_0xdf31('0x24')]=qs[_0xdf31('0x24')](_0x35fa2a['query'][_0xdf31('0x24')]);}_0x40b8ba[_0xdf31('0x3f')]=qs[_0xdf31('0x40')](_0x35fa2a[_0xdf31('0x36')][_0xdf31('0x40')]);_0x40b8ba[_0xdf31('0x41')]=qs[_0xdf31('0x38')](_[_0xdf31('0x42')](_0x35fa2a['query'],_0x394c62[_0xdf31('0x38')]),_0x35e46a);if(_0x35fa2a['query'][_0xdf31('0x43')]){_0x40b8ba[_0xdf31('0x41')]=_[_0xdf31('0x44')](_0x40b8ba[_0xdf31('0x41')],{'$or':_[_0xdf31('0x30')](_0x35e46a,function(_0x3758db){if(_0x3758db[_0xdf31('0x33')]!==_0xdf31('0x45')){var _0x40d71f={};_0x40d71f[_0x3758db[_0xdf31('0x2e')]]={'$like':'%'+_0x35fa2a[_0xdf31('0x36')][_0xdf31('0x43')]+'%'};return _0x40d71f;}})});}_0x40b8ba=_[_0xdf31('0x44')]({},_0x40b8ba,_0x35fa2a[_0xdf31('0x46')]);var _0x30b455={'where':_0x40b8ba[_0xdf31('0x41')]};return db[_0xdf31('0x31')][_0xdf31('0x23')](_0x30b455)[_0xdf31('0x2a')](function(_0x5648a5){_0x349ba0['count']=_0x5648a5;if(_0x35fa2a[_0xdf31('0x36')]['includeAll']){_0x40b8ba[_0xdf31('0x47')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0xdf31('0x48')](_0x40b8ba);})['then'](function(_0x5cfe1a){_0x349ba0[_0xdf31('0x49')]=_0x5cfe1a;return _0x349ba0;})[_0xdf31('0x2a')](respondWithFilteredResult(_0x59103e,_0x40b8ba))[_0xdf31('0x4a')](handleError(_0x59103e,null));};exports[_0xdf31('0x4b')]=function(_0x856d60,_0x4b2dfc){var _0xe9783b={'raw':!![],'where':{'id':_0x856d60[_0xdf31('0x4c')]['id']}},_0x1bf678={};_0x1bf678[_0xdf31('0x35')]=_[_0xdf31('0x37')](db['OpenchannelQueue']['rawAttributes']);_0x1bf678[_0xdf31('0x36')]=_['keys'](_0x856d60[_0xdf31('0x36')]);_0x1bf678[_0xdf31('0x38')]=_[_0xdf31('0x3a')](_0x1bf678[_0xdf31('0x35')],_0x1bf678['query']);_0xe9783b[_0xdf31('0x39')]=_[_0xdf31('0x3a')](_0x1bf678[_0xdf31('0x35')],qs[_0xdf31('0x3b')](_0x856d60[_0xdf31('0x36')]['fields']));_0xe9783b[_0xdf31('0x39')]=_0xe9783b[_0xdf31('0x39')][_0xdf31('0x3c')]?_0xe9783b['attributes']:_0x1bf678[_0xdf31('0x35')];if(_0x856d60['query'][_0xdf31('0x4d')]){_0xe9783b['include']=[{'all':!![]}];}_0xe9783b=_[_0xdf31('0x44')]({},_0xe9783b,_0x856d60[_0xdf31('0x46')]);return db[_0xdf31('0x31')]['find'](_0xe9783b)[_0xdf31('0x2a')](handleEntityNotFound(_0x4b2dfc,null))[_0xdf31('0x2a')](respondWithResult(_0x4b2dfc,null))[_0xdf31('0x4a')](handleError(_0x4b2dfc,null));};exports[_0xdf31('0x4e')]=function(_0x2d7c35,_0x364074){return db[_0xdf31('0x31')][_0xdf31('0x4e')](_0x2d7c35[_0xdf31('0x4f')],{})[_0xdf31('0x2a')](function(_0x1d2f59){var _0x24d6a0=_0x2d7c35['user'][_0xdf31('0x50')]({'plain':!![]});if(!_0x24d6a0)throw new Error(_0xdf31('0x51'));if(_0x24d6a0['role']===_0xdf31('0x52')){var _0x57d4fc=_0x1d2f59[_0xdf31('0x50')]({'plain':!![]});var _0x23e047='OpenchannelQueues';return db[_0xdf31('0x53')][_0xdf31('0x54')]({'where':{'name':_0x23e047,'userProfileId':_0x24d6a0[_0xdf31('0x55')]},'raw':!![]})[_0xdf31('0x2a')](function(_0x1317bc){if(_0x1317bc&&_0x1317bc[_0xdf31('0x56')]===0x0){return db[_0xdf31('0x57')][_0xdf31('0x4e')]({'name':_0x57d4fc[_0xdf31('0x2e')],'resourceId':_0x57d4fc['id'],'type':_0x1317bc[_0xdf31('0x2e')],'sectionId':_0x1317bc['id']},{})['then'](function(){return _0x1d2f59;});}else{return _0x1d2f59;}})[_0xdf31('0x4a')](function(_0x5aabc9){logger[_0xdf31('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5aabc9);throw _0x5aabc9;});}return _0x1d2f59;})['then'](respondWithResult(_0x364074,0xc9))[_0xdf31('0x4a')](handleError(_0x364074,null));};exports[_0xdf31('0x29')]=function(_0x2c3c2f,_0x36749e){if(_0x2c3c2f[_0xdf31('0x4f')]['id']){delete _0x2c3c2f[_0xdf31('0x4f')]['id'];}return db[_0xdf31('0x31')][_0xdf31('0x54')]({'where':{'id':_0x2c3c2f[_0xdf31('0x4c')]['id']}})['then'](handleEntityNotFound(_0x36749e,null))[_0xdf31('0x2a')](saveUpdates(_0x2c3c2f['body'],null))[_0xdf31('0x2a')](respondWithResult(_0x36749e,null))[_0xdf31('0x4a')](handleError(_0x36749e,null));};exports[_0xdf31('0x59')]=function(_0x11c39e,_0x1a2bbe){return db[_0xdf31('0x31')][_0xdf31('0x54')]({'where':{'id':_0x11c39e[_0xdf31('0x4c')]['id']}})[_0xdf31('0x2a')](handleEntityNotFound(_0x1a2bbe,null))[_0xdf31('0x2a')](removeEntity(_0x1a2bbe,null))[_0xdf31('0x4a')](handleError(_0x1a2bbe,null));};exports[_0xdf31('0x5a')]=function(_0x9d2cfc,_0xaa4be7){return db['OpenchannelQueue'][_0xdf31('0x5a')]()[_0xdf31('0x2a')](respondWithResult(_0xaa4be7,null))[_0xdf31('0x4a')](handleError(_0xaa4be7,null));};exports['getMembers']=function(_0xfc1b9c,_0x3bd875,_0x47d3c5){var _0x188038={'raw':!![],'where':{}},_0x14166e={},_0x4a0999;return db[_0xdf31('0x31')][_0xdf31('0x5b')]({'where':{'id':_0xfc1b9c['params']['id']}})[_0xdf31('0x2a')](handleEntityNotFound(_0x3bd875,null))[_0xdf31('0x2a')](function(_0x59aaf6){if(_0x59aaf6){_0x4a0999=_0x59aaf6[_0xdf31('0x50')]({'plain':!![]});_0x14166e['model']=_[_0xdf31('0x37')](db[_0xdf31('0x5c')][_0xdf31('0x32')]);_0x14166e[_0xdf31('0x36')]=_[_0xdf31('0x37')](_0xfc1b9c[_0xdf31('0x36')]);_0x14166e['filters']=_[_0xdf31('0x3a')](_0x14166e['model'],_0x14166e[_0xdf31('0x36')]);_0x188038[_0xdf31('0x39')]=_[_0xdf31('0x3a')](_0x14166e[_0xdf31('0x35')],qs[_0xdf31('0x3b')](_0xfc1b9c[_0xdf31('0x36')][_0xdf31('0x3b')]));_0x188038[_0xdf31('0x39')]=_0x188038[_0xdf31('0x39')][_0xdf31('0x3c')]?_0x188038[_0xdf31('0x39')]:_0x14166e[_0xdf31('0x35')];if(!_0xfc1b9c['query'][_0xdf31('0x3d')](_0xdf31('0x3e'))){_0x188038[_0xdf31('0x25')]=qs[_0xdf31('0x25')](_0xfc1b9c[_0xdf31('0x36')]['limit']);_0x188038[_0xdf31('0x24')]=qs[_0xdf31('0x24')](_0xfc1b9c['query'][_0xdf31('0x24')]);}_0x188038[_0xdf31('0x3f')]=qs[_0xdf31('0x40')](_0xfc1b9c[_0xdf31('0x36')][_0xdf31('0x40')]);_0x188038[_0xdf31('0x41')]=qs['filters'](_[_0xdf31('0x42')](_0xfc1b9c[_0xdf31('0x36')],_0x14166e[_0xdf31('0x38')]));_0x188038[_0xdf31('0x41')][_0xdf31('0x5d')]=_0x59aaf6['id'];if(_0xfc1b9c[_0xdf31('0x36')][_0xdf31('0x43')]){_0x188038['where']=_['merge'](_0x188038[_0xdf31('0x41')],{'$or':_['map'](_0x188038['attributes'],function(_0x3e3a9d){var _0x5e77e4={};_0x5e77e4[_0x3e3a9d]={'$like':'%'+_0xfc1b9c[_0xdf31('0x36')][_0xdf31('0x43')]+'%'};return _0x5e77e4;})});}_0x188038=_[_0xdf31('0x44')]({},_0x188038,_0xfc1b9c['options']);return db[_0xdf31('0x5c')][_0xdf31('0x48')](_0x188038);}})[_0xdf31('0x2a')](function(_0x5a5a6c){if(_0x5a5a6c){return db[_0xdf31('0x5e')][_0xdf31('0x5f')]({'where':{'id':_[_0xdf31('0x30')](_0x5a5a6c,_0xdf31('0x60')),'role':_0xdf31('0x61')},'attributes':['id',_0xdf31('0x2e'),'openchannelPause',_0xdf31('0x62'),_0xdf31('0x63')]});}})['then'](function(_0x423639){if(_0x423639){return{'count':_0x423639[_0xdf31('0x23')],'rows':_[_0xdf31('0x30')](_0x423639['rows'],function(_0x3062de){return{'membername':_0x3062de[_0xdf31('0x2e')],'UserId':_0x3062de['id'],'queue_name':_0x4a0999[_0xdf31('0x2e')],'OpenchannelQueueId':_0x4a0999['id'],'interface':util['format'](_0xdf31('0x64'),_0xdf31('0x65'),_0x3062de[_0xdf31('0x2e')]),'penalty':0x0,'paused':_0x3062de['openchannelPause'],'createdAt':_0x3062de[_0xdf31('0x63')],'updatedAt':_0x3062de['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3bd875,_0x188038))[_0xdf31('0x4a')](handleError(_0x3bd875,null));};exports['getTeams']=function(_0x193068,_0x12f011,_0xaeb51a){var _0x2c2ba3={};var _0x56586b={};var _0x28c7ef;var _0x3bfbc4;return db[_0xdf31('0x31')][_0xdf31('0x5b')]({'where':{'id':_0x193068['params']['id']}})['then'](handleEntityNotFound(_0x12f011,null))[_0xdf31('0x2a')](function(_0xc77048){if(_0xc77048){_0x28c7ef=_0xc77048;_0x56586b[_0xdf31('0x35')]=_[_0xdf31('0x37')](db[_0xdf31('0x66')][_0xdf31('0x32')]);_0x56586b['query']=_[_0xdf31('0x37')](_0x193068['query']);_0x56586b[_0xdf31('0x38')]=_[_0xdf31('0x3a')](_0x56586b[_0xdf31('0x35')],_0x56586b[_0xdf31('0x36')]);_0x2c2ba3[_0xdf31('0x39')]=_[_0xdf31('0x3a')](_0x56586b[_0xdf31('0x35')],qs[_0xdf31('0x3b')](_0x193068[_0xdf31('0x36')]['fields']));_0x2c2ba3['attributes']=_0x2c2ba3[_0xdf31('0x39')][_0xdf31('0x3c')]?_0x2c2ba3[_0xdf31('0x39')]:_0x56586b['model'];_0x2c2ba3[_0xdf31('0x3f')]=qs[_0xdf31('0x40')](_0x193068['query'][_0xdf31('0x40')]);_0x2c2ba3[_0xdf31('0x41')]=qs[_0xdf31('0x38')](_[_0xdf31('0x42')](_0x193068['query'],_0x56586b['filters']));if(_0x193068['query'][_0xdf31('0x43')]){_0x2c2ba3[_0xdf31('0x41')]=_[_0xdf31('0x44')](_0x2c2ba3['where'],{'$or':_[_0xdf31('0x30')](_0x2c2ba3[_0xdf31('0x39')],function(_0x474a3e){var _0x5e77c8={};_0x5e77c8[_0x474a3e]={'$like':'%'+_0x193068[_0xdf31('0x36')][_0xdf31('0x43')]+'%'};return _0x5e77c8;})});}_0x2c2ba3=_[_0xdf31('0x44')]({},_0x2c2ba3,_0x193068['options']);return _0x28c7ef[_0xdf31('0x67')](_0x2c2ba3);}})['then'](function(_0x1c22fa){if(_0x1c22fa){_0x3bfbc4=_0x1c22fa[_0xdf31('0x3c')];if(!_0x193068[_0xdf31('0x36')][_0xdf31('0x3d')](_0xdf31('0x3e'))){_0x2c2ba3[_0xdf31('0x25')]=qs[_0xdf31('0x25')](_0x193068['query'][_0xdf31('0x25')]);_0x2c2ba3[_0xdf31('0x24')]=qs[_0xdf31('0x24')](_0x193068[_0xdf31('0x36')][_0xdf31('0x24')]);}return _0x28c7ef[_0xdf31('0x67')](_0x2c2ba3);}})[_0xdf31('0x2a')](function(_0x28a7d6){if(_0x28a7d6){return _0x28a7d6?{'count':_0x3bfbc4,'rows':_0x28a7d6}:null;}})['then'](respondWithResult(_0x12f011,null))[_0xdf31('0x4a')](handleError(_0x12f011,null));};exports[_0xdf31('0x68')]=function(_0x3d8713,_0x450de5,_0x1dc9a6){var _0x3b9256=_0x3d8713[_0xdf31('0x4f')]['ids'];return db[_0xdf31('0x66')][_0xdf31('0x48')]({'where':{'id':_0x3b9256},'attributes':['id'],'include':[{'model':db[_0xdf31('0x5e')],'as':_0xdf31('0x69'),'attributes':['id',_0xdf31('0x2e'),'online',_0xdf31('0x6a'),_0xdf31('0x6b')],'raw':!![]}]})[_0xdf31('0x2a')](function(_0x289468){if(_0x289468){var _0x2905df=_[_0xdf31('0x6c')](_0x289468,function(_0x51c48b){var _0x37e2b0=_0x51c48b[_0xdf31('0x50')]({'plain':!![]});return _0x37e2b0[_0xdf31('0x69')];});return db[_0xdf31('0x31')][_0xdf31('0x54')]({'where':{'id':_0x3d8713[_0xdf31('0x4c')]['id']}})[_0xdf31('0x2a')](function(_0x4b61af){return db[_0xdf31('0x6d')][_0xdf31('0x6e')](function(_0x125114){return _0x4b61af[_0xdf31('0x68')](_0x3b9256,{'transaction':_0x125114})['then'](function(){return BPromise[_0xdf31('0x6f')](_0x2905df,function(_0x5443e9){return db[_0xdf31('0x5c')][_0xdf31('0x70')]({'where':{'UserId':_0x5443e9['id'],'OpenchannelQueueId':_0x3d8713[_0xdf31('0x4c')]['id']},'transaction':_0x125114});});})[_0xdf31('0x2a')](function(){_0x2905df[_0xdf31('0x71')](function(_0x33a151){socket[_0xdf31('0x72')](_0xdf31('0x73'),{'UserId':_0x33a151['id'],'OpenchannelQueueId':_0x4b61af['id']});});});});});}})['then'](respondWithStatusCode(_0x450de5,null))[_0xdf31('0x4a')](handleError(_0x450de5,null));};exports['removeTeams']=function(_0x4d2ab8,_0x42745c,_0x4c5303){return db['Team'][_0xdf31('0x48')]({'where':{'id':_0x4d2ab8['query'][_0xdf31('0x74')]},'attributes':['id'],'include':[{'model':db[_0xdf31('0x5e')],'as':_0xdf31('0x69'),'attributes':['id'],'raw':!![]}]})[_0xdf31('0x2a')](handleEntityNotFound(_0x42745c,null))[_0xdf31('0x2a')](function(_0x2cd297){var _0x2fec44=_['map'](_0x2cd297,'id');var _0x27c3ae=[];var _0x671b05=[];var _0x20d429=squel[_0xdf31('0x75')]();_0x20d429[_0xdf31('0x76')](_0xdf31('0x77'))[_0xdf31('0x78')]('team_has_openchannel_queues','tq')['join'](_0xdf31('0x79'),'ut',_0xdf31('0x7a'))[_0xdf31('0x41')](_0xdf31('0x7b'),_0x4d2ab8['params']['id']);for(var _0x187641=0x0;_0x187641<_0x2cd297[_0xdf31('0x3c')];_0x187641+=0x1){let _0x5dd85d=_0x2cd297[_0x187641];for(var _0x16c87b=0x0;_0x16c87b<_0x5dd85d['Agents'][_0xdf31('0x3c')];_0x16c87b+=0x1){let _0x5e4a01=_0x5dd85d[_0xdf31('0x69')][_0x16c87b];var _0x16f09a=_0x20d429['clone']();_0x16f09a['where'](_0xdf31('0x7c'),_0x5e4a01['id']);_0x671b05['push'](db['sequelize']['query'](_0x16f09a[_0xdf31('0x7d')](),{'type':db[_0xdf31('0x6d')][_0xdf31('0x7e')][_0xdf31('0x7f')]})[_0xdf31('0x2a')](function(_0x35ee18){if(_0x35ee18[_0xdf31('0x3c')]===0x1){return _0x5e4a01['id'];}else{var _0x42005a=_[_0xdf31('0x80')](_['map'](_0x35ee18,_0xdf31('0x81')),function(_0x40d5a7){return _[_0xdf31('0x82')](_0x2fec44,_0x40d5a7);});if(_0x42005a){return _0x5e4a01['id'];}}}));}}return BPromise['all'](_0x671b05)[_0xdf31('0x2a')](function(_0x4ba3f5){_0x27c3ae=_(_0x27c3ae)[_0xdf31('0x83')](_0x4ba3f5)[_0xdf31('0x84')]()[_0xdf31('0x85')]();return db[_0xdf31('0x31')]['find']({'where':{'id':_0x4d2ab8['params']['id']}})['then'](function(_0x29f119){return db[_0xdf31('0x6d')][_0xdf31('0x6e')](function(_0x28232b){return _0x29f119[_0xdf31('0x86')](_0x4d2ab8[_0xdf31('0x36')][_0xdf31('0x74')],{'transaction':_0x28232b})[_0xdf31('0x2a')](function(){if(!_[_0xdf31('0x87')](_0x27c3ae)){return _0x29f119['removeAgents'](_0x27c3ae,{'transaction':_0x28232b});}})['then'](function(){_0x27c3ae[_0xdf31('0x71')](function(_0x3b727e){socket[_0xdf31('0x72')](_0xdf31('0x88'),{'UserId':_0x3b727e,'OpenchannelQueueId':_0x29f119['id']});});});});});});})[_0xdf31('0x2a')](respondWithStatusCode(_0x42745c,null))[_0xdf31('0x4a')](handleError(_0x42745c,null));};exports[_0xdf31('0x89')]=function(_0x26b32b,_0x301c78,_0x3606df){return db['OpenchannelQueue'][_0xdf31('0x54')]({'where':{'id':_0x26b32b[_0xdf31('0x4c')]['id']}})[_0xdf31('0x2a')](handleEntityNotFound(_0x301c78,null))[_0xdf31('0x2a')](function(_0x324ba9){if(_0x324ba9){return _0x324ba9['addAgents'](_0x26b32b[_0xdf31('0x4f')][_0xdf31('0x74')],_[_0xdf31('0x8a')](_0x26b32b[_0xdf31('0x4f')],[_0xdf31('0x74'),'id'])||{})[_0xdf31('0x8b')](function(_0x4df9b2){for(var _0x2c559d=0x0;_0x2c559d<_0x26b32b[_0xdf31('0x4f')][_0xdf31('0x74')][_0xdf31('0x3c')];_0x2c559d+=0x1){socket[_0xdf31('0x72')](_0xdf31('0x73'),{'UserId':_0x26b32b[_0xdf31('0x4f')][_0xdf31('0x74')][_0x2c559d],'OpenchannelQueueId':_0x26b32b[_0xdf31('0x4c')]['id']});}return _0x4df9b2;});}})[_0xdf31('0x2a')](respondWithResult(_0x301c78,null))[_0xdf31('0x4a')](handleError(_0x301c78,null));};exports[_0xdf31('0x8c')]=function(_0x478cb1,_0x451cf6,_0x47c039){return db[_0xdf31('0x31')][_0xdf31('0x54')]({'where':{'id':_0x478cb1[_0xdf31('0x4c')]['id']}})[_0xdf31('0x2a')](handleEntityNotFound(_0x451cf6,null))[_0xdf31('0x2a')](function(_0x473fef){if(_0x473fef){return _0x473fef[_0xdf31('0x8c')](_0x478cb1[_0xdf31('0x36')][_0xdf31('0x74')])[_0xdf31('0x2a')](function(){if(_[_0xdf31('0x8d')](_0x478cb1['query'][_0xdf31('0x74')])){for(var _0x20b3cf=0x0;_0x20b3cf<_0x478cb1['query'][_0xdf31('0x74')][_0xdf31('0x3c')];_0x20b3cf+=0x1){socket[_0xdf31('0x72')](_0xdf31('0x88'),{'UserId':Number(_0x478cb1[_0xdf31('0x36')][_0xdf31('0x74')][_0x20b3cf]),'OpenchannelQueueId':Number(_0x478cb1[_0xdf31('0x4c')]['id'])});}}else{socket[_0xdf31('0x72')](_0xdf31('0x88'),{'UserId':Number(_0x478cb1[_0xdf31('0x36')][_0xdf31('0x74')]),'OpenchannelQueueId':Number(_0x478cb1[_0xdf31('0x4c')]['id'])});}});}})[_0xdf31('0x2a')](respondWithStatusCode(_0x451cf6,null))[_0xdf31('0x4a')](handleError(_0x451cf6,null));};exports[_0xdf31('0x8e')]=function(_0x1481ac,_0xbc9a74,_0xa5cbbf){var _0x9c21d2={};var _0x3154bf={};var _0x5c1414;var _0x37f0af;return db['OpenchannelQueue'][_0xdf31('0x5b')]({'where':{'id':_0x1481ac[_0xdf31('0x4c')]['id']}})[_0xdf31('0x2a')](handleEntityNotFound(_0xbc9a74,null))[_0xdf31('0x2a')](function(_0x37a871){if(_0x37a871){_0x5c1414=_0x37a871;_0x3154bf[_0xdf31('0x35')]=_[_0xdf31('0x37')](db[_0xdf31('0x5e')][_0xdf31('0x32')]);_0x3154bf[_0xdf31('0x36')]=_[_0xdf31('0x37')](_0x1481ac['query']);_0x3154bf['filters']=_[_0xdf31('0x3a')](_0x3154bf['model'],_0x3154bf[_0xdf31('0x36')]);_0x9c21d2[_0xdf31('0x39')]=_[_0xdf31('0x3a')](_0x3154bf[_0xdf31('0x35')],qs['fields'](_0x1481ac[_0xdf31('0x36')][_0xdf31('0x3b')]));_0x9c21d2[_0xdf31('0x39')]=_0x9c21d2['attributes'][_0xdf31('0x3c')]?_0x9c21d2['attributes']:_0x3154bf[_0xdf31('0x35')];_0x9c21d2[_0xdf31('0x3f')]=qs[_0xdf31('0x40')](_0x1481ac[_0xdf31('0x36')][_0xdf31('0x40')]);_0x9c21d2['where']=qs['filters'](_[_0xdf31('0x42')](_0x1481ac[_0xdf31('0x36')],_0x3154bf[_0xdf31('0x38')]));if(_0x1481ac[_0xdf31('0x36')][_0xdf31('0x43')]){_0x9c21d2['where']=_[_0xdf31('0x44')](_0x9c21d2[_0xdf31('0x41')],{'$or':_[_0xdf31('0x30')](_0x9c21d2['attributes'],function(_0x164cd2){var _0x69ef40={};_0x69ef40[_0x164cd2]={'$like':'%'+_0x1481ac[_0xdf31('0x36')][_0xdf31('0x43')]+'%'};return _0x69ef40;})});}_0x9c21d2=_[_0xdf31('0x44')]({},_0x9c21d2,_0x1481ac[_0xdf31('0x46')]);return _0x5c1414[_0xdf31('0x8e')](_0x9c21d2);}})[_0xdf31('0x2a')](function(_0x2d53fa){if(_0x2d53fa){_0x37f0af=_0x2d53fa[_0xdf31('0x3c')];if(!_0x1481ac[_0xdf31('0x36')][_0xdf31('0x3d')](_0xdf31('0x3e'))){_0x9c21d2[_0xdf31('0x25')]=qs['limit'](_0x1481ac[_0xdf31('0x36')][_0xdf31('0x25')]);_0x9c21d2[_0xdf31('0x24')]=qs['offset'](_0x1481ac['query'][_0xdf31('0x24')]);}return _0x5c1414[_0xdf31('0x8e')](_0x9c21d2);}})[_0xdf31('0x2a')](function(_0x4c1c9a){if(_0x4c1c9a){return _0x4c1c9a?{'count':_0x37f0af,'rows':_0x4c1c9a}:null;}})['then'](respondWithResult(_0xbc9a74,null))[_0xdf31('0x4a')](handleError(_0xbc9a74,null));}; \ No newline at end of file +var _0xa923=['../../config/logger','api','redis','defaults','socket.io-emitter','register','sendStatus','status','json','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','OpenchannelQueue','fieldName','type','key','map','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','UserId','openchannelPause','updatedAt','format','%s/%s','getTeams','ids','Team','Agents','online','interface','flatMap','sequelize','transaction','forEach','userOpenchannelQueue:save','select','field','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3a0a3a,_0x505db0){var _0x22b760=function(_0x5a5e5c){while(--_0x5a5e5c){_0x3a0a3a['push'](_0x3a0a3a['shift']());}};_0x22b760(++_0x505db0);}(_0xa923,0x17a));var _0x3a92=function(_0xb8a12,_0x49b2c8){_0xb8a12=_0xb8a12-0x0;var _0x1a950c=_0xa923[_0xb8a12];return _0x1a950c;};'use strict';var pdf=require(_0x3a92('0x0'));var emlformat=require(_0x3a92('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3a92('0x2'));var jsonpatch=require(_0x3a92('0x3'));var rp=require('request-promise');var moment=require(_0x3a92('0x4'));var BPromise=require(_0x3a92('0x5'));var Mustache=require('mustache');var util=require(_0x3a92('0x6'));var path=require(_0x3a92('0x7'));var sox=require(_0x3a92('0x8'));var csv=require(_0x3a92('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3a92('0xa'));var crypto=require(_0x3a92('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3a92('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3a92('0xd'));var Redis=require('ioredis');var authService=require(_0x3a92('0xe'));var qs=require(_0x3a92('0xf'));var as=require(_0x3a92('0x10'));var hardwareService=require(_0x3a92('0x11'));var logger=require(_0x3a92('0x12'))(_0x3a92('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3a92('0x14')]=_[_0x3a92('0x15')](config[_0x3a92('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x3a92('0x16'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x3a92('0x17')](socket);function respondWithStatusCode(_0x4fc5a0,_0x2e6599){_0x2e6599=_0x2e6599||0xcc;return function(_0x25c919){if(_0x25c919){return _0x4fc5a0[_0x3a92('0x18')](_0x2e6599);}return _0x4fc5a0[_0x3a92('0x19')](_0x2e6599)['end']();};}function respondWithResult(_0x5d8e48,_0x4c0cff){_0x4c0cff=_0x4c0cff||0xc8;return function(_0xac6f09){if(_0xac6f09){return _0x5d8e48[_0x3a92('0x19')](_0x4c0cff)[_0x3a92('0x1a')](_0xac6f09);}};}function respondWithFilteredResult(_0x290dbd,_0x404b6b){return function(_0x42347b){if(_0x42347b){var _0x29ab7c=_0x42347b['count'],_0xeb748=_0x404b6b['offset'],_0x542e12=_0x404b6b['offset']+_0x404b6b[_0x3a92('0x1b')],_0x28d4f;if(_0x542e12>=_0x29ab7c){_0x542e12=_0x29ab7c;_0x28d4f=0xc8;}else{_0x28d4f=0xce;}_0x290dbd['status'](_0x28d4f);return _0x290dbd[_0x3a92('0x1c')](_0x3a92('0x1d'),_0xeb748+'-'+_0x542e12+'/'+_0x29ab7c)[_0x3a92('0x1a')](_0x42347b);}return null;};}function patchUpdates(_0x3027c5){return function(_0x4ce717){try{jsonpatch[_0x3a92('0x1e')](_0x4ce717,_0x3027c5,!![]);}catch(_0x24e86e){return BPromise[_0x3a92('0x1f')](_0x24e86e);}return _0x4ce717['save']();};}function saveUpdates(_0x3b3554,_0x35c723){return function(_0x1eaa08){if(_0x1eaa08){return _0x1eaa08[_0x3a92('0x20')](_0x3b3554)[_0x3a92('0x21')](function(_0x5a9696){return _0x5a9696;});}return null;};}function removeEntity(_0x575d30,_0x5a2c22){return function(_0x2254ac){if(_0x2254ac){return _0x2254ac[_0x3a92('0x22')]()[_0x3a92('0x21')](function(){var _0x42a1d2=_0x2254ac[_0x3a92('0x23')]({'plain':!![]});var _0x40d3fe='OpenchannelQueues';return db[_0x3a92('0x24')][_0x3a92('0x22')]({'where':{'type':_0x40d3fe,'resourceId':_0x42a1d2['id']}})[_0x3a92('0x21')](function(){return _0x2254ac;});})['then'](function(){_0x575d30[_0x3a92('0x19')](0xcc)[_0x3a92('0x25')]();});}};}function handleEntityNotFound(_0x3176f4,_0x269831){return function(_0xc63dcb){if(!_0xc63dcb){_0x3176f4[_0x3a92('0x18')](0x194);}return _0xc63dcb;};}function handleError(_0x4f59ab,_0xcd4a7a){_0xcd4a7a=_0xcd4a7a||0x1f4;return function(_0x3801bb){logger[_0x3a92('0x26')](_0x3801bb[_0x3a92('0x27')]);if(_0x3801bb[_0x3a92('0x28')]){delete _0x3801bb[_0x3a92('0x28')];}_0x4f59ab['status'](_0xcd4a7a)[_0x3a92('0x29')](_0x3801bb);};}exports[_0x3a92('0x2a')]=function(_0x2d646a,_0xd1d8de){var _0x408743={},_0x412efb={},_0x588bce={'count':0x0,'rows':[]};var _0xc80798=_['map'](db[_0x3a92('0x2b')]['rawAttributes'],function(_0x5923e1){return{'name':_0x5923e1[_0x3a92('0x2c')],'type':_0x5923e1[_0x3a92('0x2d')][_0x3a92('0x2e')]};});_0x412efb['model']=_[_0x3a92('0x2f')](_0xc80798,'name');_0x412efb[_0x3a92('0x30')]=_['keys'](_0x2d646a['query']);_0x412efb[_0x3a92('0x31')]=_[_0x3a92('0x32')](_0x412efb['model'],_0x412efb['query']);_0x408743[_0x3a92('0x33')]=_[_0x3a92('0x32')](_0x412efb[_0x3a92('0x34')],qs[_0x3a92('0x35')](_0x2d646a['query']['fields']));_0x408743[_0x3a92('0x33')]=_0x408743[_0x3a92('0x33')]['length']?_0x408743[_0x3a92('0x33')]:_0x412efb['model'];if(!_0x2d646a[_0x3a92('0x30')][_0x3a92('0x36')](_0x3a92('0x37'))){_0x408743[_0x3a92('0x1b')]=qs['limit'](_0x2d646a['query'][_0x3a92('0x1b')]);_0x408743[_0x3a92('0x38')]=qs[_0x3a92('0x38')](_0x2d646a['query'][_0x3a92('0x38')]);}_0x408743[_0x3a92('0x39')]=qs[_0x3a92('0x3a')](_0x2d646a[_0x3a92('0x30')][_0x3a92('0x3a')]);_0x408743[_0x3a92('0x3b')]=qs['filters'](_[_0x3a92('0x3c')](_0x2d646a[_0x3a92('0x30')],_0x412efb['filters']),_0xc80798);if(_0x2d646a[_0x3a92('0x30')][_0x3a92('0x3d')]){_0x408743[_0x3a92('0x3b')]=_['merge'](_0x408743[_0x3a92('0x3b')],{'$or':_[_0x3a92('0x2f')](_0xc80798,function(_0x5226c1){if(_0x5226c1[_0x3a92('0x2d')]!=='VIRTUAL'){var _0x421e78={};_0x421e78[_0x5226c1[_0x3a92('0x28')]]={'$like':'%'+_0x2d646a[_0x3a92('0x30')][_0x3a92('0x3d')]+'%'};return _0x421e78;}})});}_0x408743=_[_0x3a92('0x3e')]({},_0x408743,_0x2d646a[_0x3a92('0x3f')]);var _0x1d2942={'where':_0x408743[_0x3a92('0x3b')]};return db[_0x3a92('0x2b')][_0x3a92('0x40')](_0x1d2942)[_0x3a92('0x21')](function(_0x3b47b2){_0x588bce['count']=_0x3b47b2;if(_0x2d646a[_0x3a92('0x30')][_0x3a92('0x41')]){_0x408743[_0x3a92('0x42')]=[{'all':!![]}];}return db[_0x3a92('0x2b')][_0x3a92('0x43')](_0x408743);})[_0x3a92('0x21')](function(_0x1fb4d0){_0x588bce[_0x3a92('0x44')]=_0x1fb4d0;return _0x588bce;})[_0x3a92('0x21')](respondWithFilteredResult(_0xd1d8de,_0x408743))[_0x3a92('0x45')](handleError(_0xd1d8de,null));};exports['show']=function(_0x129d54,_0x2a1489){var _0x5e7743={'raw':!![],'where':{'id':_0x129d54[_0x3a92('0x46')]['id']}},_0x1129ca={};_0x1129ca[_0x3a92('0x34')]=_[_0x3a92('0x47')](db['OpenchannelQueue'][_0x3a92('0x48')]);_0x1129ca['query']=_[_0x3a92('0x47')](_0x129d54['query']);_0x1129ca[_0x3a92('0x31')]=_['intersection'](_0x1129ca[_0x3a92('0x34')],_0x1129ca[_0x3a92('0x30')]);_0x5e7743['attributes']=_[_0x3a92('0x32')](_0x1129ca[_0x3a92('0x34')],qs['fields'](_0x129d54[_0x3a92('0x30')]['fields']));_0x5e7743[_0x3a92('0x33')]=_0x5e7743[_0x3a92('0x33')][_0x3a92('0x49')]?_0x5e7743[_0x3a92('0x33')]:_0x1129ca['model'];if(_0x129d54[_0x3a92('0x30')][_0x3a92('0x41')]){_0x5e7743['include']=[{'all':!![]}];}_0x5e7743=_[_0x3a92('0x3e')]({},_0x5e7743,_0x129d54[_0x3a92('0x3f')]);return db['OpenchannelQueue'][_0x3a92('0x4a')](_0x5e7743)[_0x3a92('0x21')](handleEntityNotFound(_0x2a1489,null))[_0x3a92('0x21')](respondWithResult(_0x2a1489,null))['catch'](handleError(_0x2a1489,null));};exports[_0x3a92('0x4b')]=function(_0x3c2b86,_0x324de2){return db[_0x3a92('0x2b')][_0x3a92('0x4b')](_0x3c2b86['body'],{})[_0x3a92('0x21')](function(_0x2a1140){var _0x34b267=_0x3c2b86[_0x3a92('0x4c')][_0x3a92('0x23')]({'plain':!![]});if(!_0x34b267)throw new Error(_0x3a92('0x4d'));if(_0x34b267[_0x3a92('0x4e')]===_0x3a92('0x4c')){var _0x6ddff6=_0x2a1140[_0x3a92('0x23')]({'plain':!![]});var _0xe4bca9='OpenchannelQueues';return db[_0x3a92('0x4f')][_0x3a92('0x4a')]({'where':{'name':_0xe4bca9,'userProfileId':_0x34b267[_0x3a92('0x50')]},'raw':!![]})['then'](function(_0x769f76){if(_0x769f76&&_0x769f76['autoAssociation']===0x0){return db[_0x3a92('0x24')][_0x3a92('0x4b')]({'name':_0x6ddff6[_0x3a92('0x28')],'resourceId':_0x6ddff6['id'],'type':_0x769f76[_0x3a92('0x28')],'sectionId':_0x769f76['id']},{})['then'](function(){return _0x2a1140;});}else{return _0x2a1140;}})['catch'](function(_0x1d409e){logger[_0x3a92('0x26')](_0x3a92('0x51'),_0x1d409e);throw _0x1d409e;});}return _0x2a1140;})[_0x3a92('0x21')](respondWithResult(_0x324de2,0xc9))[_0x3a92('0x45')](handleError(_0x324de2,null));};exports[_0x3a92('0x20')]=function(_0xa6659d,_0x58acda){if(_0xa6659d[_0x3a92('0x52')]['id']){delete _0xa6659d[_0x3a92('0x52')]['id'];}return db[_0x3a92('0x2b')]['find']({'where':{'id':_0xa6659d[_0x3a92('0x46')]['id']}})['then'](handleEntityNotFound(_0x58acda,null))['then'](saveUpdates(_0xa6659d['body'],null))[_0x3a92('0x21')](respondWithResult(_0x58acda,null))['catch'](handleError(_0x58acda,null));};exports[_0x3a92('0x22')]=function(_0x46a7f1,_0x45e2ba){return db['OpenchannelQueue'][_0x3a92('0x4a')]({'where':{'id':_0x46a7f1[_0x3a92('0x46')]['id']}})[_0x3a92('0x21')](handleEntityNotFound(_0x45e2ba,null))['then'](removeEntity(_0x45e2ba,null))[_0x3a92('0x45')](handleError(_0x45e2ba,null));};exports[_0x3a92('0x53')]=function(_0x3a18e7,_0x267b1b){return db[_0x3a92('0x2b')][_0x3a92('0x53')]()[_0x3a92('0x21')](respondWithResult(_0x267b1b,null))['catch'](handleError(_0x267b1b,null));};exports['getMembers']=function(_0x56851a,_0x2457aa,_0x34fb69){var _0x2a5ea9={'raw':!![],'where':{}},_0x47fe3a={},_0x5a5a1f;return db[_0x3a92('0x2b')][_0x3a92('0x54')]({'where':{'id':_0x56851a['params']['id']}})['then'](handleEntityNotFound(_0x2457aa,null))[_0x3a92('0x21')](function(_0x7ffb3d){if(_0x7ffb3d){_0x5a5a1f=_0x7ffb3d[_0x3a92('0x23')]({'plain':!![]});_0x47fe3a[_0x3a92('0x34')]=_['keys'](db[_0x3a92('0x55')][_0x3a92('0x48')]);_0x47fe3a[_0x3a92('0x30')]=_[_0x3a92('0x47')](_0x56851a[_0x3a92('0x30')]);_0x47fe3a[_0x3a92('0x31')]=_[_0x3a92('0x32')](_0x47fe3a[_0x3a92('0x34')],_0x47fe3a[_0x3a92('0x30')]);_0x2a5ea9['attributes']=_['intersection'](_0x47fe3a['model'],qs[_0x3a92('0x35')](_0x56851a[_0x3a92('0x30')][_0x3a92('0x35')]));_0x2a5ea9[_0x3a92('0x33')]=_0x2a5ea9[_0x3a92('0x33')][_0x3a92('0x49')]?_0x2a5ea9[_0x3a92('0x33')]:_0x47fe3a[_0x3a92('0x34')];if(!_0x56851a[_0x3a92('0x30')][_0x3a92('0x36')](_0x3a92('0x37'))){_0x2a5ea9[_0x3a92('0x1b')]=qs[_0x3a92('0x1b')](_0x56851a['query']['limit']);_0x2a5ea9['offset']=qs[_0x3a92('0x38')](_0x56851a[_0x3a92('0x30')][_0x3a92('0x38')]);}_0x2a5ea9[_0x3a92('0x39')]=qs[_0x3a92('0x3a')](_0x56851a[_0x3a92('0x30')]['sort']);_0x2a5ea9['where']=qs['filters'](_[_0x3a92('0x3c')](_0x56851a[_0x3a92('0x30')],_0x47fe3a[_0x3a92('0x31')]));_0x2a5ea9['where'][_0x3a92('0x56')]=_0x7ffb3d['id'];if(_0x56851a[_0x3a92('0x30')]['filter']){_0x2a5ea9[_0x3a92('0x3b')]=_[_0x3a92('0x3e')](_0x2a5ea9[_0x3a92('0x3b')],{'$or':_['map'](_0x2a5ea9[_0x3a92('0x33')],function(_0x32f615){var _0x2daf5d={};_0x2daf5d[_0x32f615]={'$like':'%'+_0x56851a[_0x3a92('0x30')][_0x3a92('0x3d')]+'%'};return _0x2daf5d;})});}_0x2a5ea9=_[_0x3a92('0x3e')]({},_0x2a5ea9,_0x56851a[_0x3a92('0x3f')]);return db['UserOpenchannelQueue'][_0x3a92('0x43')](_0x2a5ea9);}})['then'](function(_0x50e108){if(_0x50e108){return db[_0x3a92('0x57')]['findAndCountAll']({'where':{'id':_[_0x3a92('0x2f')](_0x50e108,_0x3a92('0x58')),'role':'agent'},'attributes':['id',_0x3a92('0x28'),_0x3a92('0x59'),_0x3a92('0x5a'),'createdAt']});}})[_0x3a92('0x21')](function(_0x19b271){if(_0x19b271){return{'count':_0x19b271[_0x3a92('0x40')],'rows':_[_0x3a92('0x2f')](_0x19b271['rows'],function(_0xab7adf){return{'membername':_0xab7adf[_0x3a92('0x28')],'UserId':_0xab7adf['id'],'queue_name':_0x5a5a1f[_0x3a92('0x28')],'OpenchannelQueueId':_0x5a5a1f['id'],'interface':util[_0x3a92('0x5b')](_0x3a92('0x5c'),'SIP',_0xab7adf[_0x3a92('0x28')]),'penalty':0x0,'paused':_0xab7adf[_0x3a92('0x59')],'createdAt':_0xab7adf['createdAt'],'updatedAt':_0xab7adf['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3a92('0x21')](respondWithFilteredResult(_0x2457aa,_0x2a5ea9))[_0x3a92('0x45')](handleError(_0x2457aa,null));};exports['getTeams']=function(_0x44add7,_0x1f0bd2,_0x30b666){var _0x16f102={};var _0x31d527={};var _0xd86647;var _0x23afc2;return db['OpenchannelQueue'][_0x3a92('0x54')]({'where':{'id':_0x44add7[_0x3a92('0x46')]['id']}})[_0x3a92('0x21')](handleEntityNotFound(_0x1f0bd2,null))[_0x3a92('0x21')](function(_0x1c8260){if(_0x1c8260){_0xd86647=_0x1c8260;_0x31d527['model']=_[_0x3a92('0x47')](db['Team']['rawAttributes']);_0x31d527[_0x3a92('0x30')]=_[_0x3a92('0x47')](_0x44add7['query']);_0x31d527[_0x3a92('0x31')]=_[_0x3a92('0x32')](_0x31d527[_0x3a92('0x34')],_0x31d527[_0x3a92('0x30')]);_0x16f102[_0x3a92('0x33')]=_[_0x3a92('0x32')](_0x31d527[_0x3a92('0x34')],qs[_0x3a92('0x35')](_0x44add7['query'][_0x3a92('0x35')]));_0x16f102['attributes']=_0x16f102[_0x3a92('0x33')][_0x3a92('0x49')]?_0x16f102['attributes']:_0x31d527['model'];_0x16f102['order']=qs[_0x3a92('0x3a')](_0x44add7[_0x3a92('0x30')][_0x3a92('0x3a')]);_0x16f102[_0x3a92('0x3b')]=qs[_0x3a92('0x31')](_[_0x3a92('0x3c')](_0x44add7[_0x3a92('0x30')],_0x31d527[_0x3a92('0x31')]));if(_0x44add7[_0x3a92('0x30')][_0x3a92('0x3d')]){_0x16f102[_0x3a92('0x3b')]=_[_0x3a92('0x3e')](_0x16f102[_0x3a92('0x3b')],{'$or':_['map'](_0x16f102[_0x3a92('0x33')],function(_0x32539b){var _0x5513fb={};_0x5513fb[_0x32539b]={'$like':'%'+_0x44add7[_0x3a92('0x30')]['filter']+'%'};return _0x5513fb;})});}_0x16f102=_[_0x3a92('0x3e')]({},_0x16f102,_0x44add7['options']);return _0xd86647['getTeams'](_0x16f102);}})[_0x3a92('0x21')](function(_0x554fb8){if(_0x554fb8){_0x23afc2=_0x554fb8[_0x3a92('0x49')];if(!_0x44add7['query']['hasOwnProperty'](_0x3a92('0x37'))){_0x16f102[_0x3a92('0x1b')]=qs[_0x3a92('0x1b')](_0x44add7[_0x3a92('0x30')][_0x3a92('0x1b')]);_0x16f102[_0x3a92('0x38')]=qs[_0x3a92('0x38')](_0x44add7['query'][_0x3a92('0x38')]);}return _0xd86647[_0x3a92('0x5d')](_0x16f102);}})['then'](function(_0xc21bec){if(_0xc21bec){return _0xc21bec?{'count':_0x23afc2,'rows':_0xc21bec}:null;}})[_0x3a92('0x21')](respondWithResult(_0x1f0bd2,null))[_0x3a92('0x45')](handleError(_0x1f0bd2,null));};exports['addTeams']=function(_0x97a540,_0x3fbdba,_0x4f7c13){var _0x385621=_0x97a540[_0x3a92('0x52')][_0x3a92('0x5e')];return db[_0x3a92('0x5f')][_0x3a92('0x43')]({'where':{'id':_0x385621},'attributes':['id'],'include':[{'model':db[_0x3a92('0x57')],'as':_0x3a92('0x60'),'attributes':['id',_0x3a92('0x28'),_0x3a92('0x61'),'voicePause',_0x3a92('0x62')],'raw':!![]}]})['then'](function(_0x98e444){if(_0x98e444){var _0x598563=_[_0x3a92('0x63')](_0x98e444,function(_0x2d24f8){var _0x41431c=_0x2d24f8['get']({'plain':!![]});return _0x41431c['Agents'];});return db[_0x3a92('0x2b')][_0x3a92('0x4a')]({'where':{'id':_0x97a540[_0x3a92('0x46')]['id']}})[_0x3a92('0x21')](function(_0x1e154e){return db[_0x3a92('0x64')][_0x3a92('0x65')](function(_0x44350d){return _0x1e154e['addTeams'](_0x385621,{'transaction':_0x44350d})[_0x3a92('0x21')](function(){return BPromise['each'](_0x598563,function(_0x10d161){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x10d161['id'],'OpenchannelQueueId':_0x97a540[_0x3a92('0x46')]['id']},'transaction':_0x44350d});});})[_0x3a92('0x21')](function(){_0x598563[_0x3a92('0x66')](function(_0x5c08c8){socket['emit'](_0x3a92('0x67'),{'UserId':_0x5c08c8['id'],'OpenchannelQueueId':_0x1e154e['id']});});});});});}})[_0x3a92('0x21')](respondWithStatusCode(_0x3fbdba,null))[_0x3a92('0x45')](handleError(_0x3fbdba,null));};exports['removeTeams']=function(_0x5f4034,_0x100df7,_0x247d3e){return db[_0x3a92('0x5f')]['findAll']({'where':{'id':_0x5f4034[_0x3a92('0x30')][_0x3a92('0x5e')]},'attributes':['id'],'include':[{'model':db[_0x3a92('0x57')],'as':_0x3a92('0x60'),'attributes':['id'],'raw':!![]}]})[_0x3a92('0x21')](handleEntityNotFound(_0x100df7,null))['then'](function(_0x50c551){var _0x14d34c=_[_0x3a92('0x2f')](_0x50c551,'id');var _0xb9bc91=[];var _0x4596e8=[];var _0x18a642=squel[_0x3a92('0x68')]();_0x18a642[_0x3a92('0x69')](_0x3a92('0x6a'))[_0x3a92('0x6b')](_0x3a92('0x6c'),'tq')[_0x3a92('0x6d')]('user_has_teams','ut',_0x3a92('0x6e'))[_0x3a92('0x3b')](_0x3a92('0x6f'),_0x5f4034[_0x3a92('0x46')]['id']);for(var _0x5b0ac9=0x0;_0x5b0ac9<_0x50c551[_0x3a92('0x49')];_0x5b0ac9+=0x1){let _0x48ce98=_0x50c551[_0x5b0ac9];for(var _0x34d0da=0x0;_0x34d0da<_0x48ce98[_0x3a92('0x60')][_0x3a92('0x49')];_0x34d0da+=0x1){let _0x3ca3d5=_0x48ce98[_0x3a92('0x60')][_0x34d0da];var _0x505ffc=_0x18a642['clone']();_0x505ffc[_0x3a92('0x3b')](_0x3a92('0x70'),_0x3ca3d5['id']);_0x4596e8[_0x3a92('0x71')](db[_0x3a92('0x64')][_0x3a92('0x30')](_0x505ffc[_0x3a92('0x72')](),{'type':db[_0x3a92('0x64')][_0x3a92('0x73')]['SELECT']})[_0x3a92('0x21')](function(_0x286aed){if(_0x286aed['length']===0x1){return _0x3ca3d5['id'];}else{var _0x406f73=_[_0x3a92('0x74')](_[_0x3a92('0x2f')](_0x286aed,_0x3a92('0x75')),function(_0x58a8c5){return _[_0x3a92('0x76')](_0x14d34c,_0x58a8c5);});if(_0x406f73){return _0x3ca3d5['id'];}}}));}}return BPromise[_0x3a92('0x77')](_0x4596e8)[_0x3a92('0x21')](function(_0x61ef6a){_0xb9bc91=_(_0xb9bc91)[_0x3a92('0x78')](_0x61ef6a)[_0x3a92('0x79')]()['value']();return db[_0x3a92('0x2b')]['find']({'where':{'id':_0x5f4034['params']['id']}})['then'](function(_0x2e5e49){return db[_0x3a92('0x64')]['transaction'](function(_0x9be808){return _0x2e5e49[_0x3a92('0x7a')](_0x5f4034[_0x3a92('0x30')][_0x3a92('0x5e')],{'transaction':_0x9be808})[_0x3a92('0x21')](function(){if(!_[_0x3a92('0x7b')](_0xb9bc91)){return _0x2e5e49[_0x3a92('0x7c')](_0xb9bc91,{'transaction':_0x9be808});}})['then'](function(){_0xb9bc91[_0x3a92('0x66')](function(_0x44d61b){socket['emit'](_0x3a92('0x7d'),{'UserId':_0x44d61b,'OpenchannelQueueId':_0x2e5e49['id']});});});});});});})[_0x3a92('0x21')](respondWithStatusCode(_0x100df7,null))[_0x3a92('0x45')](handleError(_0x100df7,null));};exports[_0x3a92('0x7e')]=function(_0x1f495e,_0x33606e,_0x79cbca){return db['OpenchannelQueue'][_0x3a92('0x4a')]({'where':{'id':_0x1f495e['params']['id']}})[_0x3a92('0x21')](handleEntityNotFound(_0x33606e,null))[_0x3a92('0x21')](function(_0x590547){if(_0x590547){return _0x590547[_0x3a92('0x7e')](_0x1f495e[_0x3a92('0x52')][_0x3a92('0x5e')],_[_0x3a92('0x7f')](_0x1f495e[_0x3a92('0x52')],[_0x3a92('0x5e'),'id'])||{})[_0x3a92('0x80')](function(_0x4c5c4b){for(var _0x1006b7=0x0;_0x1006b7<_0x1f495e[_0x3a92('0x52')][_0x3a92('0x5e')][_0x3a92('0x49')];_0x1006b7+=0x1){socket[_0x3a92('0x81')]('userOpenchannelQueue:save',{'UserId':_0x1f495e[_0x3a92('0x52')][_0x3a92('0x5e')][_0x1006b7],'OpenchannelQueueId':_0x1f495e[_0x3a92('0x46')]['id']});}return _0x4c5c4b;});}})[_0x3a92('0x21')](respondWithResult(_0x33606e,null))[_0x3a92('0x45')](handleError(_0x33606e,null));};exports[_0x3a92('0x7c')]=function(_0x3d439c,_0x4d21af,_0x20d554){return db[_0x3a92('0x2b')][_0x3a92('0x4a')]({'where':{'id':_0x3d439c[_0x3a92('0x46')]['id']}})['then'](handleEntityNotFound(_0x4d21af,null))[_0x3a92('0x21')](function(_0x3986d6){if(_0x3986d6){return _0x3986d6['removeAgents'](_0x3d439c['query'][_0x3a92('0x5e')])[_0x3a92('0x21')](function(){if(_[_0x3a92('0x82')](_0x3d439c[_0x3a92('0x30')][_0x3a92('0x5e')])){for(var _0x4d0b24=0x0;_0x4d0b24<_0x3d439c[_0x3a92('0x30')][_0x3a92('0x5e')][_0x3a92('0x49')];_0x4d0b24+=0x1){socket[_0x3a92('0x81')](_0x3a92('0x7d'),{'UserId':Number(_0x3d439c[_0x3a92('0x30')][_0x3a92('0x5e')][_0x4d0b24]),'OpenchannelQueueId':Number(_0x3d439c[_0x3a92('0x46')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x3d439c[_0x3a92('0x30')]['ids']),'OpenchannelQueueId':Number(_0x3d439c[_0x3a92('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0x4d21af,null))[_0x3a92('0x45')](handleError(_0x4d21af,null));};exports['getAgents']=function(_0x5cd985,_0x54de60,_0x388055){var _0x2d6e6b={};var _0xd2f24a={};var _0x5657aa;var _0x5b36c8;return db[_0x3a92('0x2b')][_0x3a92('0x54')]({'where':{'id':_0x5cd985[_0x3a92('0x46')]['id']}})['then'](handleEntityNotFound(_0x54de60,null))[_0x3a92('0x21')](function(_0x477bc8){if(_0x477bc8){_0x5657aa=_0x477bc8;_0xd2f24a[_0x3a92('0x34')]=_['keys'](db[_0x3a92('0x57')][_0x3a92('0x48')]);_0xd2f24a[_0x3a92('0x30')]=_[_0x3a92('0x47')](_0x5cd985[_0x3a92('0x30')]);_0xd2f24a['filters']=_[_0x3a92('0x32')](_0xd2f24a[_0x3a92('0x34')],_0xd2f24a[_0x3a92('0x30')]);_0x2d6e6b[_0x3a92('0x33')]=_[_0x3a92('0x32')](_0xd2f24a[_0x3a92('0x34')],qs[_0x3a92('0x35')](_0x5cd985['query'][_0x3a92('0x35')]));_0x2d6e6b[_0x3a92('0x33')]=_0x2d6e6b['attributes'][_0x3a92('0x49')]?_0x2d6e6b[_0x3a92('0x33')]:_0xd2f24a[_0x3a92('0x34')];_0x2d6e6b['order']=qs[_0x3a92('0x3a')](_0x5cd985[_0x3a92('0x30')][_0x3a92('0x3a')]);_0x2d6e6b[_0x3a92('0x3b')]=qs[_0x3a92('0x31')](_[_0x3a92('0x3c')](_0x5cd985[_0x3a92('0x30')],_0xd2f24a[_0x3a92('0x31')]));if(_0x5cd985[_0x3a92('0x30')]['filter']){_0x2d6e6b[_0x3a92('0x3b')]=_[_0x3a92('0x3e')](_0x2d6e6b[_0x3a92('0x3b')],{'$or':_[_0x3a92('0x2f')](_0x2d6e6b[_0x3a92('0x33')],function(_0x2a6444){var _0x1cecf1={};_0x1cecf1[_0x2a6444]={'$like':'%'+_0x5cd985[_0x3a92('0x30')][_0x3a92('0x3d')]+'%'};return _0x1cecf1;})});}_0x2d6e6b=_[_0x3a92('0x3e')]({},_0x2d6e6b,_0x5cd985[_0x3a92('0x3f')]);return _0x5657aa['getAgents'](_0x2d6e6b);}})['then'](function(_0x3daadd){if(_0x3daadd){_0x5b36c8=_0x3daadd[_0x3a92('0x49')];if(!_0x5cd985[_0x3a92('0x30')]['hasOwnProperty'](_0x3a92('0x37'))){_0x2d6e6b['limit']=qs['limit'](_0x5cd985[_0x3a92('0x30')][_0x3a92('0x1b')]);_0x2d6e6b[_0x3a92('0x38')]=qs[_0x3a92('0x38')](_0x5cd985[_0x3a92('0x30')]['offset']);}return _0x5657aa[_0x3a92('0x83')](_0x2d6e6b);}})[_0x3a92('0x21')](function(_0x262a38){if(_0x262a38){return _0x262a38?{'count':_0x5b36c8,'rows':_0x262a38}:null;}})['then'](respondWithResult(_0x54de60,null))[_0x3a92('0x45')](handleError(_0x54de60,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index ad2ac74..988b1cf 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 _0x289d=['OpenchannelQueue','setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb'];(function(_0x596f67,_0x449fc2){var _0x50817b=function(_0x1d638a){while(--_0x1d638a){_0x596f67['push'](_0x596f67['shift']());}};_0x50817b(++_0x449fc2);}(_0x289d,0x97));var _0xd289=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x289d[_0x1ac595];return _0x455fff;};'use strict';var EventEmitter=require(_0xd289('0x0'));var OpenchannelQueue=require(_0xd289('0x1'))['db'][_0xd289('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd289('0x3')](0x0);var events={'afterCreate':_0xd289('0x4'),'afterUpdate':_0xd289('0x5'),'afterDestroy':'remove'};function emitEvent(_0x68653f){return function(_0x33666b,_0x45dfa9,_0x58c451){OpenchannelQueueEvents[_0xd289('0x6')](_0x68653f+':'+_0x33666b['id'],_0x33666b);OpenchannelQueueEvents[_0xd289('0x6')](_0x68653f,_0x33666b);_0x58c451(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xd289('0x7')](e,emitEvent(event));}}module[_0xd289('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x1f8c=['events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x34232c,_0x18e61d){var _0x4d4f4e=function(_0x1aeb3d){while(--_0x1aeb3d){_0x34232c['push'](_0x34232c['shift']());}};_0x4d4f4e(++_0x18e61d);}(_0x1f8c,0x11e));var _0xc1f8=function(_0x38ce4c,_0xfdbe8c){_0x38ce4c=_0x38ce4c-0x0;var _0x5d4544=_0x1f8c[_0x38ce4c];return _0x5d4544;};'use strict';var EventEmitter=require(_0xc1f8('0x0'));var OpenchannelQueue=require(_0xc1f8('0x1'))['db'][_0xc1f8('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xc1f8('0x3')](0x0);var events={'afterCreate':_0xc1f8('0x4'),'afterUpdate':_0xc1f8('0x5'),'afterDestroy':_0xc1f8('0x6')};function emitEvent(_0x1cc535){return function(_0x3ec183,_0x2dc3c2,_0x2475af){OpenchannelQueueEvents[_0xc1f8('0x7')](_0x1cc535+':'+_0x3ec183['id'],_0x3ec183);OpenchannelQueueEvents['emit'](_0x1cc535,_0x3ec183);_0x2475af(null);};}for(var e in events){if(events[_0xc1f8('0x8')](e)){var event=events[e];OpenchannelQueue[_0xc1f8('0x9')](e,emitEvent(event));}}module[_0xc1f8('0xa')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 18aecb2..6bce202 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 _0x04cc=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash'];(function(_0x2ff027,_0x50e53b){var _0x45d082=function(_0x3ab185){while(--_0x3ab185){_0x2ff027['push'](_0x2ff027['shift']());}};_0x45d082(++_0x50e53b);}(_0x04cc,0x1bf));var _0xc04c=function(_0x2f89c0,_0x455702){_0x2f89c0=_0x2f89c0-0x0;var _0x164223=_0x04cc[_0x2f89c0];return _0x164223;};'use strict';var _=require(_0xc04c('0x0'));var util=require(_0xc04c('0x1'));var logger=require(_0xc04c('0x2'))(_0xc04c('0x3'));var moment=require(_0xc04c('0x4'));var BPromise=require('bluebird');var rp=require(_0xc04c('0x5'));var fs=require('fs');var path=require(_0xc04c('0x6'));var rimraf=require(_0xc04c('0x7'));var config=require(_0xc04c('0x8'));var attributes=require(_0xc04c('0x9'));module[_0xc04c('0xa')]=function(_0x3ed884,_0x227653){return _0x3ed884[_0xc04c('0xb')](_0xc04c('0xc'),attributes,{'tableName':_0xc04c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2d4=['OpenchannelQueue','openchannel_queues','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x55cc58,_0x5ce0af){var _0x26062e=function(_0x59e29d){while(--_0x59e29d){_0x55cc58['push'](_0x55cc58['shift']());}};_0x26062e(++_0x5ce0af);}(_0xb2d4,0x10a));var _0x4b2d=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xb2d4[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x4b2d('0x0'));var util=require('util');var logger=require(_0x4b2d('0x1'))('api');var moment=require(_0x4b2d('0x2'));var BPromise=require(_0x4b2d('0x3'));var rp=require(_0x4b2d('0x4'));var fs=require('fs');var path=require(_0x4b2d('0x5'));var rimraf=require(_0x4b2d('0x6'));var config=require(_0x4b2d('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0x4b2d('0x8')]=function(_0x4b88a3,_0x5b0564){return _0x4b88a3[_0x4b2d('0x9')](_0x4b2d('0xa'),attributes,{'tableName':_0x4b2d('0xb'),'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 8fa9d4a..28c09dc 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 _0x58d7=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','limit','include','map','attributes','model','ShowOpenchannelQueue','find'];(function(_0x1e7adf,_0xb3c6cc){var _0x48a47f=function(_0x4df149){while(--_0x4df149){_0x1e7adf['push'](_0x1e7adf['shift']());}};_0x48a47f(++_0xb3c6cc);}(_0x58d7,0x138));var _0x758d=function(_0x1efcbb,_0x5304ea){_0x1efcbb=_0x1efcbb-0x0;var _0x1f76db=_0x58d7[_0x1efcbb];return _0x1f76db;};'use strict';var _=require(_0x758d('0x0'));var util=require(_0x758d('0x1'));var moment=require('moment');var BPromise=require(_0x758d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x758d('0x3'));var db=require(_0x758d('0x4'))['db'];var utils=require(_0x758d('0x5'));var logger=require(_0x758d('0x6'))(_0x758d('0x7'));var config=require(_0x758d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x758d('0x9')][_0x758d('0xa')]({'port':0x232a});config[_0x758d('0xb')]=_[_0x758d('0xc')](config[_0x758d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x758d('0xd'))(new Redis(config['redis']));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x3f92ed,_0xeed71e,_0x1fe616){return new BPromise(function(_0x4fbc51,_0x158da6){return client[_0x758d('0xe')](_0x3f92ed,_0x1fe616)[_0x758d('0xf')](function(_0x39ad32){logger[_0x758d('0x10')](_0x758d('0x11'),_0xeed71e,_0x758d('0x12'));logger[_0x758d('0x13')](_0x758d('0x14'),_0xeed71e,_0x758d('0x12'),JSON[_0x758d('0x15')](_0x39ad32));if(_0x39ad32[_0x758d('0x16')]){if(_0x39ad32[_0x758d('0x16')][_0x758d('0x17')]===0x1f4){logger['error'](_0x758d('0x11'),_0xeed71e,_0x39ad32[_0x758d('0x16')]['message']);return _0x158da6(_0x39ad32[_0x758d('0x16')][_0x758d('0x18')]);}logger[_0x758d('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0xeed71e,_0x39ad32[_0x758d('0x16')][_0x758d('0x18')]);return _0x4fbc51(_0x39ad32[_0x758d('0x16')][_0x758d('0x18')]);}else{logger[_0x758d('0x10')](_0x758d('0x11'),_0xeed71e,_0x758d('0x12'));_0x4fbc51(_0x39ad32['result'][_0x758d('0x18')]);}})[_0x758d('0x19')](function(_0x155117){logger['error'](_0x758d('0x11'),_0xeed71e,_0x155117);_0x158da6(_0x155117);});});}exports[_0x758d('0x1a')]=function(_0x10ca6b){var _0x24bb45=this;return new Promise(function(_0x2a4ec2,_0x59f6ec){return db[_0x758d('0x1b')][_0x758d('0x1c')]({'raw':_0x10ca6b[_0x758d('0x1d')]?_0x10ca6b[_0x758d('0x1d')][_0x758d('0x1e')]===undefined?!![]:![]:!![],'where':_0x10ca6b[_0x758d('0x1d')]?_0x10ca6b[_0x758d('0x1d')][_0x758d('0x1f')]||null:null,'attributes':_0x10ca6b[_0x758d('0x1d')]?_0x10ca6b[_0x758d('0x1d')]['attributes']||null:null,'limit':_0x10ca6b['options']?_0x10ca6b[_0x758d('0x1d')][_0x758d('0x20')]||null:null,'include':_0x10ca6b[_0x758d('0x1d')]?_0x10ca6b[_0x758d('0x1d')][_0x758d('0x21')]?_[_0x758d('0x22')](_0x10ca6b['options'][_0x758d('0x21')],function(_0x157ef5){return{'model':db[_0x157ef5['model']],'as':_0x157ef5['as'],'attributes':_0x157ef5[_0x758d('0x23')],'include':_0x157ef5[_0x758d('0x21')]?_[_0x758d('0x22')](_0x157ef5[_0x758d('0x21')],function(_0x239baa){return{'model':db[_0x239baa[_0x758d('0x24')]],'as':_0x239baa['as'],'attributes':_0x239baa[_0x758d('0x23')],'include':_0x239baa[_0x758d('0x21')]?_['map'](_0x239baa[_0x758d('0x21')],function(_0x165ce0){return{'model':db[_0x165ce0[_0x758d('0x24')]],'as':_0x165ce0['as'],'attributes':_0x165ce0[_0x758d('0x23')]};}):[]};}):[]};}):[]:[]})[_0x758d('0xf')](function(_0xc39f75){logger[_0x758d('0x10')]('GetOpenchannelQueue',_0x10ca6b);logger[_0x758d('0x13')]('GetOpenchannelQueue',_0x10ca6b,JSON[_0x758d('0x15')](_0xc39f75));_0x2a4ec2(_0xc39f75);})['catch'](function(_0x45fa95){logger[_0x758d('0x16')](_0x758d('0x1a'),_0x45fa95[_0x758d('0x18')],_0x10ca6b);_0x59f6ec(_0x24bb45[_0x758d('0x16')](0x1f4,_0x45fa95['message']));});});};exports[_0x758d('0x25')]=function(_0x571275){var _0x45f417=this;return new Promise(function(_0x1037e9,_0x2542b9){return db['OpenchannelQueue'][_0x758d('0x26')]({'raw':_0x571275['options']?_0x571275['options'][_0x758d('0x1e')]===undefined?!![]:![]:!![],'where':_0x571275[_0x758d('0x1d')]?_0x571275['options'][_0x758d('0x1f')]||null:null,'attributes':_0x571275[_0x758d('0x1d')]?_0x571275[_0x758d('0x1d')]['attributes']||null:null,'include':_0x571275[_0x758d('0x1d')]?_0x571275[_0x758d('0x1d')][_0x758d('0x21')]?_['map'](_0x571275['options'][_0x758d('0x21')],function(_0x758223){return{'model':db[_0x758223[_0x758d('0x24')]],'as':_0x758223['as'],'attributes':_0x758223[_0x758d('0x23')],'include':_0x758223[_0x758d('0x21')]?_['map'](_0x758223['include'],function(_0x5d83ea){return{'model':db[_0x5d83ea[_0x758d('0x24')]],'as':_0x5d83ea['as'],'attributes':_0x5d83ea[_0x758d('0x23')],'include':_0x5d83ea[_0x758d('0x21')]?_[_0x758d('0x22')](_0x5d83ea['include'],function(_0x4142f6){return{'model':db[_0x4142f6[_0x758d('0x24')]],'as':_0x4142f6['as'],'attributes':_0x4142f6[_0x758d('0x23')]};}):[]};}):[]};}):[]:[]})[_0x758d('0xf')](function(_0x1ffb2e){logger[_0x758d('0x10')]('ShowOpenchannelQueue',_0x571275);logger['debug'](_0x758d('0x25'),_0x571275,JSON[_0x758d('0x15')](_0x1ffb2e));_0x1037e9(_0x1ffb2e);})['catch'](function(_0x3943e3){logger[_0x758d('0x16')](_0x758d('0x25'),_0x3943e3['message'],_0x571275);_0x2542b9(_0x45f417[_0x758d('0x16')](0x1f4,_0x3943e3[_0x758d('0x18')]));});});}; \ No newline at end of file +var _0x34d8=['../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','limit','map','model','include','then','find','where','ShowOpenchannelQueue','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x212fcc,_0x1a8867){var _0x4d8190=function(_0x347f7b){while(--_0x347f7b){_0x212fcc['push'](_0x212fcc['shift']());}};_0x4d8190(++_0x1a8867);}(_0x34d8,0x69));var _0x834d=function(_0x223e27,_0x4b9133){_0x223e27=_0x223e27-0x0;var _0x35f4db=_0x34d8[_0x223e27];return _0x35f4db;};'use strict';var _=require(_0x834d('0x0'));var util=require('util');var moment=require(_0x834d('0x1'));var BPromise=require(_0x834d('0x2'));var rs=require(_0x834d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x834d('0x4'))['db'];var utils=require(_0x834d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x834d('0x6'));var jayson=require(_0x834d('0x7'));var client=jayson['client'][_0x834d('0x8')]({'port':0x232a});config[_0x834d('0x9')]=_['defaults'](config[_0x834d('0x9')],{'host':_0x834d('0xa'),'port':0x18eb});var socket=require(_0x834d('0xb'))(new Redis(config[_0x834d('0x9')]));require(_0x834d('0xc'))['register'](socket);function respondWithRpcPromise(_0x189df5,_0x60ee68,_0x24abda){return new BPromise(function(_0x589c0b,_0x972e68){return client[_0x834d('0xd')](_0x189df5,_0x24abda)['then'](function(_0x953504){logger[_0x834d('0xe')](_0x834d('0xf'),_0x60ee68,_0x834d('0x10'));logger[_0x834d('0x11')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x60ee68,_0x834d('0x10'),JSON[_0x834d('0x12')](_0x953504));if(_0x953504[_0x834d('0x13')]){if(_0x953504[_0x834d('0x13')][_0x834d('0x14')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x60ee68,_0x953504[_0x834d('0x13')][_0x834d('0x15')]);return _0x972e68(_0x953504[_0x834d('0x13')]['message']);}logger[_0x834d('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x60ee68,_0x953504[_0x834d('0x13')][_0x834d('0x15')]);return _0x589c0b(_0x953504[_0x834d('0x13')][_0x834d('0x15')]);}else{logger['info'](_0x834d('0xf'),_0x60ee68,_0x834d('0x10'));_0x589c0b(_0x953504['result'][_0x834d('0x15')]);}})[_0x834d('0x16')](function(_0x29ce70){logger[_0x834d('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x60ee68,_0x29ce70);_0x972e68(_0x29ce70);});});}exports[_0x834d('0x17')]=function(_0x3d7f5){var _0xa3c64a=this;return new Promise(function(_0x451035,_0x324352){return db[_0x834d('0x18')][_0x834d('0x19')]({'raw':_0x3d7f5[_0x834d('0x1a')]?_0x3d7f5[_0x834d('0x1a')][_0x834d('0x1b')]===undefined?!![]:![]:!![],'where':_0x3d7f5[_0x834d('0x1a')]?_0x3d7f5['options']['where']||null:null,'attributes':_0x3d7f5[_0x834d('0x1a')]?_0x3d7f5[_0x834d('0x1a')][_0x834d('0x1c')]||null:null,'limit':_0x3d7f5[_0x834d('0x1a')]?_0x3d7f5[_0x834d('0x1a')][_0x834d('0x1d')]||null:null,'include':_0x3d7f5[_0x834d('0x1a')]?_0x3d7f5[_0x834d('0x1a')]['include']?_[_0x834d('0x1e')](_0x3d7f5[_0x834d('0x1a')]['include'],function(_0x159c74){return{'model':db[_0x159c74[_0x834d('0x1f')]],'as':_0x159c74['as'],'attributes':_0x159c74[_0x834d('0x1c')],'include':_0x159c74[_0x834d('0x20')]?_['map'](_0x159c74[_0x834d('0x20')],function(_0x31d356){return{'model':db[_0x31d356[_0x834d('0x1f')]],'as':_0x31d356['as'],'attributes':_0x31d356[_0x834d('0x1c')],'include':_0x31d356['include']?_[_0x834d('0x1e')](_0x31d356[_0x834d('0x20')],function(_0x443808){return{'model':db[_0x443808[_0x834d('0x1f')]],'as':_0x443808['as'],'attributes':_0x443808[_0x834d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x834d('0x21')](function(_0x5490a1){logger[_0x834d('0xe')](_0x834d('0x17'),_0x3d7f5);logger[_0x834d('0x11')]('GetOpenchannelQueue',_0x3d7f5,JSON[_0x834d('0x12')](_0x5490a1));_0x451035(_0x5490a1);})['catch'](function(_0xd54f3f){logger[_0x834d('0x13')](_0x834d('0x17'),_0xd54f3f[_0x834d('0x15')],_0x3d7f5);_0x324352(_0xa3c64a[_0x834d('0x13')](0x1f4,_0xd54f3f[_0x834d('0x15')]));});});};exports['ShowOpenchannelQueue']=function(_0x19ba12){var _0x5d3c30=this;return new Promise(function(_0x4740e0,_0x5d223d){return db[_0x834d('0x18')][_0x834d('0x22')]({'raw':_0x19ba12[_0x834d('0x1a')]?_0x19ba12[_0x834d('0x1a')][_0x834d('0x1b')]===undefined?!![]:![]:!![],'where':_0x19ba12[_0x834d('0x1a')]?_0x19ba12[_0x834d('0x1a')][_0x834d('0x23')]||null:null,'attributes':_0x19ba12[_0x834d('0x1a')]?_0x19ba12[_0x834d('0x1a')][_0x834d('0x1c')]||null:null,'include':_0x19ba12[_0x834d('0x1a')]?_0x19ba12[_0x834d('0x1a')][_0x834d('0x20')]?_[_0x834d('0x1e')](_0x19ba12[_0x834d('0x1a')][_0x834d('0x20')],function(_0x5115a7){return{'model':db[_0x5115a7[_0x834d('0x1f')]],'as':_0x5115a7['as'],'attributes':_0x5115a7[_0x834d('0x1c')],'include':_0x5115a7[_0x834d('0x20')]?_[_0x834d('0x1e')](_0x5115a7[_0x834d('0x20')],function(_0x4a2b66){return{'model':db[_0x4a2b66[_0x834d('0x1f')]],'as':_0x4a2b66['as'],'attributes':_0x4a2b66['attributes'],'include':_0x4a2b66['include']?_[_0x834d('0x1e')](_0x4a2b66[_0x834d('0x20')],function(_0x1f409e){return{'model':db[_0x1f409e['model']],'as':_0x1f409e['as'],'attributes':_0x1f409e[_0x834d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x834d('0x21')](function(_0x2c31e2){logger[_0x834d('0xe')](_0x834d('0x24'),_0x19ba12);logger[_0x834d('0x11')](_0x834d('0x24'),_0x19ba12,JSON[_0x834d('0x12')](_0x2c31e2));_0x4740e0(_0x2c31e2);})[_0x834d('0x16')](function(_0x55026d){logger[_0x834d('0x13')]('ShowOpenchannelQueue',_0x55026d[_0x834d('0x15')],_0x19ba12);_0x5d223d(_0x5d3c30[_0x834d('0x13')](0x1f4,_0x55026d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 9a93bf3..5b0ef79 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 _0x3f4a=['emit','register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3f4a,0x15c));var _0xa3f4=function(_0x2a17dc,_0x7cb99b){_0x2a17dc=_0x2a17dc-0x0;var _0x663c7d=_0x3f4a[_0x2a17dc];return _0x663c7d;};'use strict';var OpenchannelQueueEvents=require(_0xa3f4('0x0'));var events=[_0xa3f4('0x1'),_0xa3f4('0x2'),_0xa3f4('0x3')];function createListener(_0x3315aa,_0x2d7f30){return function(_0x3a1e65){_0x2d7f30[_0xa3f4('0x4')](_0x3315aa,_0x3a1e65);};}function removeListener(_0x4ffde1,_0x1b676f){return function(){OpenchannelQueueEvents['removeListener'](_0x4ffde1,_0x1b676f);};}exports[_0xa3f4('0x5')]=function(_0x49d43c){for(var _0x82b2e0=0x0,_0x3ed8cc=events[_0xa3f4('0x6')];_0x82b2e0<_0x3ed8cc;_0x82b2e0++){var _0x5505c4=events[_0x82b2e0];var _0xf41c9d=createListener(_0xa3f4('0x7')+_0x5505c4,_0x49d43c);OpenchannelQueueEvents['on'](_0x5505c4,_0xf41c9d);}}; \ No newline at end of file +var _0x7938=['emit','register','length','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x4af3fb,_0x210d00){var _0x2fff9d=function(_0x2bac78){while(--_0x2bac78){_0x4af3fb['push'](_0x4af3fb['shift']());}};_0x2fff9d(++_0x210d00);}(_0x7938,0xd6));var _0x8793=function(_0x28f156,_0xd6ecbc){_0x28f156=_0x28f156-0x0;var _0x5276e8=_0x7938[_0x28f156];return _0x5276e8;};'use strict';var OpenchannelQueueEvents=require(_0x8793('0x0'));var events=[_0x8793('0x1'),'remove','update'];function createListener(_0xefcd77,_0x3101f7){return function(_0x4e7c75){_0x3101f7[_0x8793('0x2')](_0xefcd77,_0x4e7c75);};}function removeListener(_0x219344,_0x14bc9f){return function(){OpenchannelQueueEvents['removeListener'](_0x219344,_0x14bc9f);};}exports[_0x8793('0x3')]=function(_0x2dfa65){for(var _0x5a8291=0x0,_0x590949=events[_0x8793('0x4')];_0x5a8291<_0x590949;_0x5a8291++){var _0x315ded=events[_0x5a8291];var _0x1a6bf6=createListener(_0x8793('0x5')+_0x315ded,_0x2dfa65);OpenchannelQueueEvents['on'](_0x315ded,_0x1a6bf6);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index a8ff0b9..de9cc80 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 _0xfe49=['get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller'];(function(_0xe5804c,_0x49dace){var _0x44da25=function(_0x13d9ab){while(--_0x13d9ab){_0xe5804c['push'](_0xe5804c['shift']());}};_0x44da25(++_0x49dace);}(_0xfe49,0x12c));var _0x9fe4=function(_0x775d87,_0x3e5dde){_0x775d87=_0x775d87-0x0;var _0x495d46=_0xfe49[_0x775d87];return _0x495d46;};'use strict';var multer=require(_0x9fe4('0x0'));var util=require(_0x9fe4('0x1'));var path=require(_0x9fe4('0x2'));var timeout=require(_0x9fe4('0x3'));var express=require('express');var router=express[_0x9fe4('0x4')]();var auth=require(_0x9fe4('0x5'));var interaction=require(_0x9fe4('0x6'));var config=require('../../config/environment');var controller=require(_0x9fe4('0x7'));router[_0x9fe4('0x8')]('/',auth[_0x9fe4('0x9')](),controller[_0x9fe4('0xa')]);router[_0x9fe4('0x8')](_0x9fe4('0xb'),auth[_0x9fe4('0x9')](),controller[_0x9fe4('0xc')]);router[_0x9fe4('0x8')]('/:id',auth[_0x9fe4('0x9')](),controller[_0x9fe4('0xd')]);router[_0x9fe4('0xe')]('/',auth[_0x9fe4('0x9')](),controller[_0x9fe4('0xf')]);router[_0x9fe4('0x10')](_0x9fe4('0x11'),auth[_0x9fe4('0x9')](),controller[_0x9fe4('0x12')]);router[_0x9fe4('0x13')](_0x9fe4('0x11'),auth[_0x9fe4('0x9')](),controller[_0x9fe4('0x14')]);module[_0x9fe4('0x15')]=router; \ No newline at end of file +var _0x7db0=['multer','util','connect-timeout','express','Router','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete','destroy','exports'];(function(_0xfc478,_0x171be9){var _0x41375d=function(_0x44f136){while(--_0x44f136){_0xfc478['push'](_0xfc478['shift']());}};_0x41375d(++_0x171be9);}(_0x7db0,0x64));var _0x07db=function(_0x1a1b6e,_0x3a07a9){_0x1a1b6e=_0x1a1b6e-0x0;var _0x571e2c=_0x7db0[_0x1a1b6e];return _0x571e2c;};'use strict';var multer=require(_0x07db('0x0'));var util=require(_0x07db('0x1'));var path=require('path');var timeout=require(_0x07db('0x2'));var express=require(_0x07db('0x3'));var router=express[_0x07db('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x07db('0x5'));var controller=require(_0x07db('0x6'));router['get']('/',auth[_0x07db('0x7')](),controller[_0x07db('0x8')]);router[_0x07db('0x9')](_0x07db('0xa'),auth[_0x07db('0x7')](),controller[_0x07db('0xb')]);router[_0x07db('0x9')](_0x07db('0xc'),auth['isAuthenticated'](),controller[_0x07db('0xd')]);router['post']('/',auth[_0x07db('0x7')](),controller[_0x07db('0xe')]);router[_0x07db('0xf')](_0x07db('0xc'),auth[_0x07db('0x7')](),controller[_0x07db('0x10')]);router[_0x07db('0x11')](_0x07db('0xc'),auth[_0x07db('0x7')](),controller[_0x07db('0x12')]);module[_0x07db('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 f10833c..43d98d4 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 _0x03af=['STRING','DATE','sequelize','exports'];(function(_0xf4ccda,_0x2164ae){var _0x545f7c=function(_0x544205){while(--_0x544205){_0xf4ccda['push'](_0xf4ccda['shift']());}};_0x545f7c(++_0x2164ae);}(_0x03af,0x152));var _0xf03a=function(_0x179bc8,_0x52a208){_0x179bc8=_0x179bc8-0x0;var _0x49c91e=_0x03af[_0x179bc8];return _0x49c91e;};'use strict';var moment=require('moment');var Sequelize=require(_0xf03a('0x0'));module[_0xf03a('0x1')]={'uniqueid':{'type':Sequelize[_0xf03a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf03a('0x2')]},'joinAt':{'type':Sequelize[_0xf03a('0x3')]},'leaveAt':{'type':Sequelize[_0xf03a('0x3')]},'acceptAt':{'type':Sequelize[_0xf03a('0x3')]},'exitAt':{'type':Sequelize[_0xf03a('0x3')]},'reason':{'type':Sequelize[_0xf03a('0x2')]}}; \ No newline at end of file +var _0x3882=['STRING','DATE','moment','sequelize','exports'];(function(_0x68c24f,_0x1eeec8){var _0xf3d83c=function(_0x45ca6e){while(--_0x45ca6e){_0x68c24f['push'](_0x68c24f['shift']());}};_0xf3d83c(++_0x1eeec8);}(_0x3882,0x89));var _0x2388=function(_0x140715,_0x2486ff){_0x140715=_0x140715-0x0;var _0x1324a0=_0x3882[_0x140715];return _0x1324a0;};'use strict';var moment=require(_0x2388('0x0'));var Sequelize=require(_0x2388('0x1'));module[_0x2388('0x2')]={'uniqueid':{'type':Sequelize[_0x2388('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x2388('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x2388('0x4')]},'exitAt':{'type':Sequelize[_0x2388('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 3985759..53dbcd3 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 _0x2e35=['error','stack','name','index','OpenchannelQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','length','hasOwnProperty','limit','order','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','count','includeAll','include','catch','show','params','fields','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','set','Content-Range','apply','reject','save','update','then','end','sendStatus'];(function(_0x2bd55,_0x486310){var _0x3b7209=function(_0x4cc099){while(--_0x4cc099){_0x2bd55['push'](_0x2bd55['shift']());}};_0x3b7209(++_0x486310);}(_0x2e35,0x1d0));var _0x52e3=function(_0x1c8a21,_0xc67417){_0x1c8a21=_0x1c8a21-0x0;var _0x401b5e=_0x2e35[_0x1c8a21];return _0x401b5e;};'use strict';var pdf=require(_0x52e3('0x0'));var emlformat=require(_0x52e3('0x1'));var rimraf=require(_0x52e3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x52e3('0x3'));var rp=require(_0x52e3('0x4'));var moment=require(_0x52e3('0x5'));var BPromise=require(_0x52e3('0x6'));var Mustache=require('mustache');var util=require(_0x52e3('0x7'));var path=require(_0x52e3('0x8'));var sox=require(_0x52e3('0x9'));var csv=require(_0x52e3('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x52e3('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x52e3('0xa'));var querystring=require(_0x52e3('0xc'));var Papa=require('papaparse');var Redis=require(_0x52e3('0xd'));var authService=require(_0x52e3('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x52e3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x52e3('0x10'))(_0x52e3('0x11'));var utils=require(_0x52e3('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x52e3('0x13'));var db=require(_0x52e3('0x14'))['db'];function respondWithStatusCode(_0x4f9486,_0x11fb88){_0x11fb88=_0x11fb88||0xcc;return function(_0x4f4661){if(_0x4f4661){return _0x4f9486['sendStatus'](_0x11fb88);}return _0x4f9486['status'](_0x11fb88)['end']();};}function respondWithResult(_0x4d97f2,_0x105c80){_0x105c80=_0x105c80||0xc8;return function(_0x1224dc){if(_0x1224dc){return _0x4d97f2[_0x52e3('0x15')](_0x105c80)[_0x52e3('0x16')](_0x1224dc);}};}function respondWithFilteredResult(_0x46a90b,_0x445438){return function(_0x31a498){if(_0x31a498){var _0xdf1853=_0x31a498['count'],_0x46e236=_0x445438[_0x52e3('0x17')],_0x23c4f8=_0x445438[_0x52e3('0x17')]+_0x445438['limit'],_0x3355e7;if(_0x23c4f8>=_0xdf1853){_0x23c4f8=_0xdf1853;_0x3355e7=0xc8;}else{_0x3355e7=0xce;}_0x46a90b[_0x52e3('0x15')](_0x3355e7);return _0x46a90b[_0x52e3('0x18')](_0x52e3('0x19'),_0x46e236+'-'+_0x23c4f8+'/'+_0xdf1853)[_0x52e3('0x16')](_0x31a498);}return null;};}function patchUpdates(_0x1c3272){return function(_0xa9e99a){try{jsonpatch[_0x52e3('0x1a')](_0xa9e99a,_0x1c3272,!![]);}catch(_0x30a7bb){return BPromise[_0x52e3('0x1b')](_0x30a7bb);}return _0xa9e99a[_0x52e3('0x1c')]();};}function saveUpdates(_0x42593f,_0x31a4b8){return function(_0x184951){if(_0x184951){return _0x184951[_0x52e3('0x1d')](_0x42593f)[_0x52e3('0x1e')](function(_0x4c20e4){return _0x4c20e4;});}return null;};}function removeEntity(_0x4f3378,_0x588b92){return function(_0x164872){if(_0x164872){return _0x164872['destroy']()['then'](function(){_0x4f3378['status'](0xcc)[_0x52e3('0x1f')]();});}};}function handleEntityNotFound(_0x54f571,_0x3010f9){return function(_0x4ae9d1){if(!_0x4ae9d1){_0x54f571[_0x52e3('0x20')](0x194);}return _0x4ae9d1;};}function handleError(_0x55babb,_0x5b9ff1){_0x5b9ff1=_0x5b9ff1||0x1f4;return function(_0x3eefb3){logger[_0x52e3('0x21')](_0x3eefb3[_0x52e3('0x22')]);if(_0x3eefb3[_0x52e3('0x23')]){delete _0x3eefb3['name'];}_0x55babb['status'](_0x5b9ff1)['send'](_0x3eefb3);};}exports[_0x52e3('0x24')]=function(_0x11d967,_0x11a5c8){var _0x701259={},_0x3fe875={},_0x5940be={'count':0x0,'rows':[]};var _0xd644d6=_['map'](db[_0x52e3('0x25')][_0x52e3('0x26')],function(_0x2ceaa4){return{'name':_0x2ceaa4[_0x52e3('0x27')],'type':_0x2ceaa4['type'][_0x52e3('0x28')]};});_0x3fe875[_0x52e3('0x29')]=_['map'](_0xd644d6,'name');_0x3fe875[_0x52e3('0x2a')]=_[_0x52e3('0x2b')](_0x11d967[_0x52e3('0x2a')]);_0x3fe875['filters']=_[_0x52e3('0x2c')](_0x3fe875[_0x52e3('0x29')],_0x3fe875[_0x52e3('0x2a')]);_0x701259[_0x52e3('0x2d')]=_[_0x52e3('0x2c')](_0x3fe875[_0x52e3('0x29')],qs['fields'](_0x11d967[_0x52e3('0x2a')]['fields']));_0x701259[_0x52e3('0x2d')]=_0x701259[_0x52e3('0x2d')][_0x52e3('0x2e')]?_0x701259[_0x52e3('0x2d')]:_0x3fe875[_0x52e3('0x29')];if(!_0x11d967['query'][_0x52e3('0x2f')]('nolimit')){_0x701259['limit']=qs[_0x52e3('0x30')](_0x11d967[_0x52e3('0x2a')][_0x52e3('0x30')]);_0x701259[_0x52e3('0x17')]=qs[_0x52e3('0x17')](_0x11d967['query'][_0x52e3('0x17')]);}_0x701259[_0x52e3('0x31')]=qs[_0x52e3('0x32')](_0x11d967[_0x52e3('0x2a')]['sort']);_0x701259['where']=qs[_0x52e3('0x33')](_[_0x52e3('0x34')](_0x11d967['query'],_0x3fe875['filters']),_0xd644d6);if(_0x11d967['query'][_0x52e3('0x35')]){_0x701259[_0x52e3('0x36')]=_['merge'](_0x701259[_0x52e3('0x36')],{'$or':_['map'](_0xd644d6,function(_0x37d706){if(_0x37d706[_0x52e3('0x37')]!==_0x52e3('0x38')){var _0x2460c8={};_0x2460c8[_0x37d706[_0x52e3('0x23')]]={'$like':'%'+_0x11d967[_0x52e3('0x2a')][_0x52e3('0x35')]+'%'};return _0x2460c8;}})});}_0x701259=_[_0x52e3('0x39')]({},_0x701259,_0x11d967[_0x52e3('0x3a')]);var _0x2a3921={'where':_0x701259[_0x52e3('0x36')]};return db[_0x52e3('0x25')][_0x52e3('0x3b')](_0x2a3921)[_0x52e3('0x1e')](function(_0x3f54d4){_0x5940be['count']=_0x3f54d4;if(_0x11d967[_0x52e3('0x2a')][_0x52e3('0x3c')]){_0x701259[_0x52e3('0x3d')]=[{'all':!![]}];}return db[_0x52e3('0x25')]['findAll'](_0x701259);})[_0x52e3('0x1e')](function(_0x520f74){_0x5940be['rows']=_0x520f74;return _0x5940be;})['then'](respondWithFilteredResult(_0x11a5c8,_0x701259))[_0x52e3('0x3e')](handleError(_0x11a5c8,null));};exports[_0x52e3('0x3f')]=function(_0x3b0ec3,_0x100cd8){var _0xede8ed={'raw':!![],'where':{'id':_0x3b0ec3[_0x52e3('0x40')]['id']}},_0x4567c6={};_0x4567c6[_0x52e3('0x29')]=_['keys'](db[_0x52e3('0x25')][_0x52e3('0x26')]);_0x4567c6[_0x52e3('0x2a')]=_[_0x52e3('0x2b')](_0x3b0ec3[_0x52e3('0x2a')]);_0x4567c6[_0x52e3('0x33')]=_[_0x52e3('0x2c')](_0x4567c6[_0x52e3('0x29')],_0x4567c6[_0x52e3('0x2a')]);_0xede8ed[_0x52e3('0x2d')]=_[_0x52e3('0x2c')](_0x4567c6[_0x52e3('0x29')],qs[_0x52e3('0x41')](_0x3b0ec3[_0x52e3('0x2a')][_0x52e3('0x41')]));_0xede8ed[_0x52e3('0x2d')]=_0xede8ed[_0x52e3('0x2d')]['length']?_0xede8ed[_0x52e3('0x2d')]:_0x4567c6['model'];if(_0x3b0ec3[_0x52e3('0x2a')][_0x52e3('0x3c')]){_0xede8ed['include']=[{'all':!![]}];}_0xede8ed=_[_0x52e3('0x39')]({},_0xede8ed,_0x3b0ec3[_0x52e3('0x3a')]);return db['OpenchannelQueueReport'][_0x52e3('0x42')](_0xede8ed)[_0x52e3('0x1e')](handleEntityNotFound(_0x100cd8,null))[_0x52e3('0x1e')](respondWithResult(_0x100cd8,null))[_0x52e3('0x3e')](handleError(_0x100cd8,null));};exports[_0x52e3('0x43')]=function(_0x562859,_0x2de974){return db['OpenchannelQueueReport'][_0x52e3('0x43')](_0x562859[_0x52e3('0x44')],{})['then'](respondWithResult(_0x2de974,0xc9))['catch'](handleError(_0x2de974,null));};exports[_0x52e3('0x1d')]=function(_0x5f052a,_0x588782){if(_0x5f052a[_0x52e3('0x44')]['id']){delete _0x5f052a[_0x52e3('0x44')]['id'];}return db[_0x52e3('0x25')]['find']({'where':{'id':_0x5f052a[_0x52e3('0x40')]['id']}})['then'](handleEntityNotFound(_0x588782,null))[_0x52e3('0x1e')](saveUpdates(_0x5f052a['body'],null))[_0x52e3('0x1e')](respondWithResult(_0x588782,null))[_0x52e3('0x3e')](handleError(_0x588782,null));};exports[_0x52e3('0x45')]=function(_0x3918f1,_0x2e65b5){return db[_0x52e3('0x25')]['find']({'where':{'id':_0x3918f1[_0x52e3('0x40')]['id']}})[_0x52e3('0x1e')](handleEntityNotFound(_0x2e65b5,null))[_0x52e3('0x1e')](removeEntity(_0x2e65b5,null))[_0x52e3('0x3e')](handleError(_0x2e65b5,null));};exports[_0x52e3('0x46')]=function(_0x3b13b8,_0x14609a){return db[_0x52e3('0x25')][_0x52e3('0x46')]()[_0x52e3('0x1e')](respondWithResult(_0x14609a,null))[_0x52e3('0x3e')](handleError(_0x14609a,null));}; \ No newline at end of file +var _0x3a32=['rows','catch','show','params','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll'];(function(_0x2ea6c4,_0x5bb790){var _0x33200f=function(_0x4981ef){while(--_0x4981ef){_0x2ea6c4['push'](_0x2ea6c4['shift']());}};_0x33200f(++_0x5bb790);}(_0x3a32,0x9b));var _0x23a3=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x3a32[_0x53cf8e];return _0x459197;};'use strict';var pdf=require(_0x23a3('0x0'));var emlformat=require(_0x23a3('0x1'));var rimraf=require(_0x23a3('0x2'));var zipdir=require(_0x23a3('0x3'));var jsonpatch=require(_0x23a3('0x4'));var rp=require(_0x23a3('0x5'));var moment=require(_0x23a3('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x23a3('0x7'));var path=require(_0x23a3('0x8'));var sox=require('sox');var csv=require(_0x23a3('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x23a3('0xa'));var squel=require(_0x23a3('0xb'));var crypto=require(_0x23a3('0xc'));var jsforce=require(_0x23a3('0xd'));var deskjs=require(_0x23a3('0xe'));var toCsv=require(_0x23a3('0x9'));var querystring=require('querystring');var Papa=require(_0x23a3('0xf'));var Redis=require(_0x23a3('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x23a3('0x11'));var hardwareService=require(_0x23a3('0x12'));var logger=require(_0x23a3('0x13'))('api');var utils=require(_0x23a3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x23a3('0x15'));var db=require(_0x23a3('0x16'))['db'];function respondWithStatusCode(_0x1ebeae,_0x4b65d9){_0x4b65d9=_0x4b65d9||0xcc;return function(_0x5f31f2){if(_0x5f31f2){return _0x1ebeae[_0x23a3('0x17')](_0x4b65d9);}return _0x1ebeae[_0x23a3('0x18')](_0x4b65d9)[_0x23a3('0x19')]();};}function respondWithResult(_0x2af741,_0x52243b){_0x52243b=_0x52243b||0xc8;return function(_0x3c0e0e){if(_0x3c0e0e){return _0x2af741[_0x23a3('0x18')](_0x52243b)['json'](_0x3c0e0e);}};}function respondWithFilteredResult(_0x73759f,_0xcd0167){return function(_0x480bcd){if(_0x480bcd){var _0x2e9730=_0x480bcd[_0x23a3('0x1a')],_0x23ed6d=_0xcd0167[_0x23a3('0x1b')],_0x1a52ff=_0xcd0167[_0x23a3('0x1b')]+_0xcd0167[_0x23a3('0x1c')],_0x3e3cc1;if(_0x1a52ff>=_0x2e9730){_0x1a52ff=_0x2e9730;_0x3e3cc1=0xc8;}else{_0x3e3cc1=0xce;}_0x73759f['status'](_0x3e3cc1);return _0x73759f[_0x23a3('0x1d')](_0x23a3('0x1e'),_0x23ed6d+'-'+_0x1a52ff+'/'+_0x2e9730)['json'](_0x480bcd);}return null;};}function patchUpdates(_0x502144){return function(_0x289eb7){try{jsonpatch[_0x23a3('0x1f')](_0x289eb7,_0x502144,!![]);}catch(_0x453bf3){return BPromise[_0x23a3('0x20')](_0x453bf3);}return _0x289eb7[_0x23a3('0x21')]();};}function saveUpdates(_0x1dd837,_0x1a4cfc){return function(_0x3efa00){if(_0x3efa00){return _0x3efa00[_0x23a3('0x22')](_0x1dd837)[_0x23a3('0x23')](function(_0x436871){return _0x436871;});}return null;};}function removeEntity(_0x53ccdf,_0x51885){return function(_0x2bfe31){if(_0x2bfe31){return _0x2bfe31[_0x23a3('0x24')]()[_0x23a3('0x23')](function(){_0x53ccdf[_0x23a3('0x18')](0xcc)[_0x23a3('0x19')]();});}};}function handleEntityNotFound(_0x509aa3,_0x48a73c){return function(_0x4eefe5){if(!_0x4eefe5){_0x509aa3[_0x23a3('0x17')](0x194);}return _0x4eefe5;};}function handleError(_0x515be1,_0x38b014){_0x38b014=_0x38b014||0x1f4;return function(_0x525b5f){logger[_0x23a3('0x25')](_0x525b5f['stack']);if(_0x525b5f[_0x23a3('0x26')]){delete _0x525b5f[_0x23a3('0x26')];}_0x515be1['status'](_0x38b014)[_0x23a3('0x27')](_0x525b5f);};}exports[_0x23a3('0x28')]=function(_0xb84c6c,_0x21db90){var _0x2ace31={},_0x5510d1={},_0x1ceaf0={'count':0x0,'rows':[]};var _0x748cda=_[_0x23a3('0x29')](db[_0x23a3('0x2a')][_0x23a3('0x2b')],function(_0x35519f){return{'name':_0x35519f[_0x23a3('0x2c')],'type':_0x35519f[_0x23a3('0x2d')]['key']};});_0x5510d1[_0x23a3('0x2e')]=_[_0x23a3('0x29')](_0x748cda,_0x23a3('0x26'));_0x5510d1[_0x23a3('0x2f')]=_[_0x23a3('0x30')](_0xb84c6c['query']);_0x5510d1[_0x23a3('0x31')]=_[_0x23a3('0x32')](_0x5510d1[_0x23a3('0x2e')],_0x5510d1[_0x23a3('0x2f')]);_0x2ace31[_0x23a3('0x33')]=_[_0x23a3('0x32')](_0x5510d1[_0x23a3('0x2e')],qs[_0x23a3('0x34')](_0xb84c6c[_0x23a3('0x2f')][_0x23a3('0x34')]));_0x2ace31[_0x23a3('0x33')]=_0x2ace31[_0x23a3('0x33')]['length']?_0x2ace31[_0x23a3('0x33')]:_0x5510d1[_0x23a3('0x2e')];if(!_0xb84c6c[_0x23a3('0x2f')][_0x23a3('0x35')]('nolimit')){_0x2ace31[_0x23a3('0x1c')]=qs[_0x23a3('0x1c')](_0xb84c6c['query']['limit']);_0x2ace31[_0x23a3('0x1b')]=qs[_0x23a3('0x1b')](_0xb84c6c[_0x23a3('0x2f')][_0x23a3('0x1b')]);}_0x2ace31[_0x23a3('0x36')]=qs['sort'](_0xb84c6c[_0x23a3('0x2f')][_0x23a3('0x37')]);_0x2ace31[_0x23a3('0x38')]=qs['filters'](_[_0x23a3('0x39')](_0xb84c6c['query'],_0x5510d1[_0x23a3('0x31')]),_0x748cda);if(_0xb84c6c['query'][_0x23a3('0x3a')]){_0x2ace31[_0x23a3('0x38')]=_[_0x23a3('0x3b')](_0x2ace31[_0x23a3('0x38')],{'$or':_[_0x23a3('0x29')](_0x748cda,function(_0x1ff3ed){if(_0x1ff3ed[_0x23a3('0x2d')]!==_0x23a3('0x3c')){var _0xda40cd={};_0xda40cd[_0x1ff3ed['name']]={'$like':'%'+_0xb84c6c[_0x23a3('0x2f')][_0x23a3('0x3a')]+'%'};return _0xda40cd;}})});}_0x2ace31=_[_0x23a3('0x3b')]({},_0x2ace31,_0xb84c6c[_0x23a3('0x3d')]);var _0x353d55={'where':_0x2ace31[_0x23a3('0x38')]};return db[_0x23a3('0x2a')][_0x23a3('0x1a')](_0x353d55)[_0x23a3('0x23')](function(_0x34eb89){_0x1ceaf0[_0x23a3('0x1a')]=_0x34eb89;if(_0xb84c6c[_0x23a3('0x2f')][_0x23a3('0x3e')]){_0x2ace31['include']=[{'all':!![]}];}return db[_0x23a3('0x2a')][_0x23a3('0x3f')](_0x2ace31);})[_0x23a3('0x23')](function(_0x7c7923){_0x1ceaf0[_0x23a3('0x40')]=_0x7c7923;return _0x1ceaf0;})[_0x23a3('0x23')](respondWithFilteredResult(_0x21db90,_0x2ace31))[_0x23a3('0x41')](handleError(_0x21db90,null));};exports[_0x23a3('0x42')]=function(_0x4c0b81,_0x1f89ce){var _0x19e0ef={'raw':!![],'where':{'id':_0x4c0b81[_0x23a3('0x43')]['id']}},_0x1e56f1={};_0x1e56f1[_0x23a3('0x2e')]=_[_0x23a3('0x30')](db[_0x23a3('0x2a')][_0x23a3('0x2b')]);_0x1e56f1[_0x23a3('0x2f')]=_[_0x23a3('0x30')](_0x4c0b81[_0x23a3('0x2f')]);_0x1e56f1[_0x23a3('0x31')]=_[_0x23a3('0x32')](_0x1e56f1[_0x23a3('0x2e')],_0x1e56f1[_0x23a3('0x2f')]);_0x19e0ef[_0x23a3('0x33')]=_[_0x23a3('0x32')](_0x1e56f1[_0x23a3('0x2e')],qs['fields'](_0x4c0b81[_0x23a3('0x2f')][_0x23a3('0x34')]));_0x19e0ef[_0x23a3('0x33')]=_0x19e0ef[_0x23a3('0x33')][_0x23a3('0x44')]?_0x19e0ef[_0x23a3('0x33')]:_0x1e56f1[_0x23a3('0x2e')];if(_0x4c0b81[_0x23a3('0x2f')][_0x23a3('0x3e')]){_0x19e0ef['include']=[{'all':!![]}];}_0x19e0ef=_[_0x23a3('0x3b')]({},_0x19e0ef,_0x4c0b81[_0x23a3('0x3d')]);return db[_0x23a3('0x2a')][_0x23a3('0x45')](_0x19e0ef)[_0x23a3('0x23')](handleEntityNotFound(_0x1f89ce,null))[_0x23a3('0x23')](respondWithResult(_0x1f89ce,null))[_0x23a3('0x41')](handleError(_0x1f89ce,null));};exports[_0x23a3('0x46')]=function(_0xc9dd3b,_0x26bfd2){return db[_0x23a3('0x2a')][_0x23a3('0x46')](_0xc9dd3b[_0x23a3('0x47')],{})['then'](respondWithResult(_0x26bfd2,0xc9))['catch'](handleError(_0x26bfd2,null));};exports[_0x23a3('0x22')]=function(_0x50ef1c,_0x433a6e){if(_0x50ef1c[_0x23a3('0x47')]['id']){delete _0x50ef1c['body']['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x50ef1c[_0x23a3('0x43')]['id']}})['then'](handleEntityNotFound(_0x433a6e,null))[_0x23a3('0x23')](saveUpdates(_0x50ef1c[_0x23a3('0x47')],null))[_0x23a3('0x23')](respondWithResult(_0x433a6e,null))[_0x23a3('0x41')](handleError(_0x433a6e,null));};exports[_0x23a3('0x24')]=function(_0x308b50,_0x773725){return db[_0x23a3('0x2a')]['find']({'where':{'id':_0x308b50[_0x23a3('0x43')]['id']}})['then'](handleEntityNotFound(_0x773725,null))[_0x23a3('0x23')](removeEntity(_0x773725,null))['catch'](handleError(_0x773725,null));};exports[_0x23a3('0x48')]=function(_0x27f43a,_0x3cbd2f){return db['OpenchannelQueueReport'][_0x23a3('0x48')]()['then'](respondWithResult(_0x3cbd2f,null))['catch'](handleError(_0x3cbd2f,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 7059904..4e2c400 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 _0x4a99=['rimraf','../../config/environment','./openchannelQueueReport.attributes','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','api','moment','request-promise'];(function(_0x3f9092,_0x35ffc8){var _0x5e65d3=function(_0xd7e74a){while(--_0xd7e74a){_0x3f9092['push'](_0x3f9092['shift']());}};_0x5e65d3(++_0x35ffc8);}(_0x4a99,0x1aa));var _0x94a9=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x4a99[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x94a9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x94a9('0x1'));var moment=require(_0x94a9('0x2'));var BPromise=require('bluebird');var rp=require(_0x94a9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x94a9('0x4'));var config=require(_0x94a9('0x5'));var attributes=require(_0x94a9('0x6'));module['exports']=function(_0x3cad6a,_0x1b86d8){return _0x3cad6a['define'](_0x94a9('0x7'),attributes,{'tableName':_0x94a9('0x8'),'paranoid':![],'indexes':[{'name':_0x94a9('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x87df=['bluebird','request-promise','path','rimraf','../../config/environment','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x87df,0x167));var _0xf87d=function(_0x5a6d3b,_0x15a93b){_0x5a6d3b=_0x5a6d3b-0x0;var _0x3aaf17=_0x87df[_0x5a6d3b];return _0x3aaf17;};'use strict';var _=require(_0xf87d('0x0'));var util=require(_0xf87d('0x1'));var logger=require(_0xf87d('0x2'))(_0xf87d('0x3'));var moment=require(_0xf87d('0x4'));var BPromise=require(_0xf87d('0x5'));var rp=require(_0xf87d('0x6'));var fs=require('fs');var path=require(_0xf87d('0x7'));var rimraf=require(_0xf87d('0x8'));var config=require(_0xf87d('0x9'));var attributes=require('./openchannelQueueReport.attributes');module['exports']=function(_0x38045e,_0x40a15b){return _0x38045e['define'](_0xf87d('0xa'),attributes,{'tableName':_0xf87d('0xb'),'paranoid':![],'indexes':[{'name':_0xf87d('0xc'),'fields':[_0xf87d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index a225452..2f72774 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 _0xa0d9=['request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','where','limit','lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x502f03,_0xd5b780){var _0x163452=function(_0x12e5cd){while(--_0x12e5cd){_0x502f03['push'](_0x502f03['shift']());}};_0x163452(++_0xd5b780);}(_0xa0d9,0xbc));var _0x9a0d=function(_0x46111d,_0x5d286b){_0x46111d=_0x46111d-0x0;var _0xe82586=_0xa0d9[_0x46111d];return _0xe82586;};'use strict';var _=require(_0x9a0d('0x0'));var util=require(_0x9a0d('0x1'));var moment=require(_0x9a0d('0x2'));var BPromise=require(_0x9a0d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9a0d('0x4'))(_0x9a0d('0x5'));var config=require(_0x9a0d('0x6'));var jayson=require(_0x9a0d('0x7'));var client=jayson[_0x9a0d('0x8')][_0x9a0d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x108921,_0x16e133,_0x47fc81){return new BPromise(function(_0x552069,_0x2d9e93){return client[_0x9a0d('0xa')](_0x108921,_0x47fc81)[_0x9a0d('0xb')](function(_0xfe7691){logger[_0x9a0d('0xc')](_0x9a0d('0xd'),_0x16e133,_0x9a0d('0xe'));logger[_0x9a0d('0xf')](_0x9a0d('0x10'),_0x16e133,_0x9a0d('0xe'),JSON[_0x9a0d('0x11')](_0xfe7691));if(_0xfe7691[_0x9a0d('0x12')]){if(_0xfe7691[_0x9a0d('0x12')][_0x9a0d('0x13')]===0x1f4){logger[_0x9a0d('0x12')](_0x9a0d('0xd'),_0x16e133,_0xfe7691[_0x9a0d('0x12')][_0x9a0d('0x14')]);return _0x2d9e93(_0xfe7691[_0x9a0d('0x12')][_0x9a0d('0x14')]);}logger[_0x9a0d('0x12')](_0x9a0d('0xd'),_0x16e133,_0xfe7691[_0x9a0d('0x12')]['message']);return _0x552069(_0xfe7691[_0x9a0d('0x12')][_0x9a0d('0x14')]);}else{logger[_0x9a0d('0xc')](_0x9a0d('0xd'),_0x16e133,_0x9a0d('0xe'));_0x552069(_0xfe7691[_0x9a0d('0x15')][_0x9a0d('0x14')]);}})[_0x9a0d('0x16')](function(_0x2d6e40){logger[_0x9a0d('0x12')](_0x9a0d('0xd'),_0x16e133,_0x2d6e40);_0x2d9e93(_0x2d6e40);});});}exports[_0x9a0d('0x17')]=function(_0x159b0d){var _0x415b65=this;return new Promise(function(_0x473849,_0x5c3292){return db[_0x9a0d('0x18')][_0x9a0d('0x19')](_0x159b0d[_0x9a0d('0x1a')],{'raw':_0x159b0d[_0x9a0d('0x1b')]?_0x159b0d[_0x9a0d('0x1b')][_0x9a0d('0x1c')]===undefined?!![]:![]:!![]})[_0x9a0d('0xb')](function(_0x3fb895){logger[_0x9a0d('0xc')](_0x9a0d('0x17'),_0x159b0d);logger[_0x9a0d('0xf')](_0x9a0d('0x17'),_0x159b0d,JSON[_0x9a0d('0x11')](_0x3fb895));_0x473849(_0x3fb895);})[_0x9a0d('0x16')](function(_0xeb2694){logger[_0x9a0d('0x12')](_0x9a0d('0x17'),_0xeb2694['message'],_0x159b0d);_0x5c3292(_0x415b65['error'](0x1f4,_0xeb2694[_0x9a0d('0x14')]));});});};exports[_0x9a0d('0x1d')]=function(_0x4ebb88){var _0x29384c=this;return new Promise(function(_0x38e980,_0x550110){return db[_0x9a0d('0x18')][_0x9a0d('0x1e')](_0x4ebb88['body'],{'raw':_0x4ebb88[_0x9a0d('0x1b')]?_0x4ebb88['options'][_0x9a0d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ebb88['options']?_0x4ebb88['options'][_0x9a0d('0x1f')]||null:null,'attributes':_0x4ebb88[_0x9a0d('0x1b')]?_0x4ebb88[_0x9a0d('0x1b')]['attributes']||null:null,'limit':_0x4ebb88['options']?_0x4ebb88[_0x9a0d('0x1b')][_0x9a0d('0x20')]||null:null})[_0x9a0d('0xb')](function(_0x22cab8){logger[_0x9a0d('0xc')](_0x9a0d('0x1d'),_0x4ebb88);logger[_0x9a0d('0xf')](_0x9a0d('0x1d'),_0x4ebb88,JSON[_0x9a0d('0x11')](_0x22cab8));_0x38e980(_0x22cab8);})['catch'](function(_0x3c4c8a){logger[_0x9a0d('0x12')]('UpdateOpenchannelQueueReport',_0x3c4c8a[_0x9a0d('0x14')],_0x4ebb88);_0x550110(_0x29384c[_0x9a0d('0x12')](0x1f4,_0x3c4c8a[_0x9a0d('0x14')]));});});}; \ No newline at end of file +var _0x2487=['code','error','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','stringify','update','where','attributes','limit','UpdateOpenchannelQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x297b8b,_0x10031d){var _0x4566e9=function(_0x45062b){while(--_0x45062b){_0x297b8b['push'](_0x297b8b['shift']());}};_0x4566e9(++_0x10031d);}(_0x2487,0x164));var _0x7248=function(_0x4dd7e8,_0x406d92){_0x4dd7e8=_0x4dd7e8-0x0;var _0x53939a=_0x2487[_0x4dd7e8];return _0x53939a;};'use strict';var _=require(_0x7248('0x0'));var util=require(_0x7248('0x1'));var moment=require(_0x7248('0x2'));var BPromise=require('bluebird');var rs=require(_0x7248('0x3'));var fs=require('fs');var Redis=require(_0x7248('0x4'));var db=require(_0x7248('0x5'))['db'];var utils=require(_0x7248('0x6'));var logger=require(_0x7248('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7248('0x8'));var client=jayson[_0x7248('0x9')][_0x7248('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59ba76,_0x4c0dd8,_0x28662a){return new BPromise(function(_0x3162c3,_0x2ff6fc){return client[_0x7248('0xb')](_0x59ba76,_0x28662a)[_0x7248('0xc')](function(_0x57f716){logger[_0x7248('0xd')](_0x7248('0xe'),_0x4c0dd8,_0x7248('0xf'));logger[_0x7248('0x10')](_0x7248('0x11'),_0x4c0dd8,_0x7248('0xf'),JSON['stringify'](_0x57f716));if(_0x57f716['error']){if(_0x57f716['error'][_0x7248('0x12')]===0x1f4){logger[_0x7248('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4c0dd8,_0x57f716[_0x7248('0x13')][_0x7248('0x14')]);return _0x2ff6fc(_0x57f716[_0x7248('0x13')][_0x7248('0x14')]);}logger[_0x7248('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4c0dd8,_0x57f716[_0x7248('0x13')]['message']);return _0x3162c3(_0x57f716[_0x7248('0x13')]['message']);}else{logger['info'](_0x7248('0xe'),_0x4c0dd8,_0x7248('0xf'));_0x3162c3(_0x57f716[_0x7248('0x15')][_0x7248('0x14')]);}})[_0x7248('0x16')](function(_0x2594c0){logger[_0x7248('0x13')](_0x7248('0xe'),_0x4c0dd8,_0x2594c0);_0x2ff6fc(_0x2594c0);});});}exports[_0x7248('0x17')]=function(_0x43d888){var _0x2d00ab=this;return new Promise(function(_0x1c180b,_0x251cb2){return db[_0x7248('0x18')][_0x7248('0x19')](_0x43d888['body'],{'raw':_0x43d888['options']?_0x43d888[_0x7248('0x1a')][_0x7248('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x524eeb){logger[_0x7248('0xd')](_0x7248('0x17'),_0x43d888);logger[_0x7248('0x10')]('CreateOpenchannelQueueReport',_0x43d888,JSON[_0x7248('0x1c')](_0x524eeb));_0x1c180b(_0x524eeb);})[_0x7248('0x16')](function(_0x3f48ad){logger[_0x7248('0x13')](_0x7248('0x17'),_0x3f48ad[_0x7248('0x14')],_0x43d888);_0x251cb2(_0x2d00ab['error'](0x1f4,_0x3f48ad[_0x7248('0x14')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x3888fa){var _0x40c09b=this;return new Promise(function(_0x4d87f5,_0x5bdbb3){return db['OpenchannelQueueReport'][_0x7248('0x1d')](_0x3888fa['body'],{'raw':_0x3888fa[_0x7248('0x1a')]?_0x3888fa['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3888fa['options']?_0x3888fa['options'][_0x7248('0x1e')]||null:null,'attributes':_0x3888fa[_0x7248('0x1a')]?_0x3888fa[_0x7248('0x1a')][_0x7248('0x1f')]||null:null,'limit':_0x3888fa['options']?_0x3888fa['options'][_0x7248('0x20')]||null:null})[_0x7248('0xc')](function(_0x5a919c){logger[_0x7248('0xd')](_0x7248('0x21'),_0x3888fa);logger['debug'](_0x7248('0x21'),_0x3888fa,JSON[_0x7248('0x1c')](_0x5a919c));_0x4d87f5(_0x5a919c);})['catch'](function(_0x87f707){logger[_0x7248('0x13')](_0x7248('0x21'),_0x87f707[_0x7248('0x14')],_0x3888fa);_0x5bdbb3(_0x40c09b[_0x7248('0x13')](0x1f4,_0x87f707['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 2d58bd0..73347ed 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 _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file +var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index d2cf366..0c77aa4 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 _0x50c7=['moment','sequelize','exports','STRING','DATE'];(function(_0x48245c,_0x35e4ca){var _0x612fd3=function(_0x60542c){while(--_0x60542c){_0x48245c['push'](_0x48245c['shift']());}};_0x612fd3(++_0x35e4ca);}(_0x50c7,0x12c));var _0x750c=function(_0x3eda2d,_0x21b0c0){_0x3eda2d=_0x3eda2d-0x0;var _0x3a3f07=_0x50c7[_0x3eda2d];return _0x3a3f07;};'use strict';var moment=require(_0x750c('0x0'));var Sequelize=require(_0x750c('0x1'));module[_0x750c('0x2')]={'uniqueid':{'type':Sequelize[_0x750c('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent','queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x750c('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x932c=['agent','queue','DATE','NOW','moment','exports','STRING','account'];(function(_0x2c6af3,_0x3ce442){var _0x4895bf=function(_0x5566cf){while(--_0x5566cf){_0x2c6af3['push'](_0x2c6af3['shift']());}};_0x4895bf(++_0x3ce442);}(_0x932c,0x1c4));var _0xc932=function(_0x5b4615,_0x3fad71){_0x5b4615=_0x5b4615-0x0;var _0x44eb78=_0x932c[_0x5b4615];return _0x44eb78;};'use strict';var moment=require(_0xc932('0x0'));var Sequelize=require('sequelize');module[_0xc932('0x1')]={'uniqueid':{'type':Sequelize[_0xc932('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc932('0x3'),_0xc932('0x4'),_0xc932('0x5')),'allowNull':![],'defaultValue':_0xc932('0x5')},'transferredAt':{'type':Sequelize[_0xc932('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xc932('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 5e90749..63d8271 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 _0xc3a5=['nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','then','includeAll','rows','params','rawAttributes','length','catch','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','name','send','index','map','OpenchannelTransferReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty'];(function(_0x1e6716,_0xd3530c){var _0xb693f6=function(_0x4f17c0){while(--_0x4f17c0){_0x1e6716['push'](_0x1e6716['shift']());}};_0xb693f6(++_0xd3530c);}(_0xc3a5,0xf5));var _0x5c3a=function(_0xd5c857,_0x4a494b){_0xd5c857=_0xd5c857-0x0;var _0x267b67=_0xc3a5[_0xd5c857];return _0x267b67;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5c3a('0x0'));var zipdir=require(_0x5c3a('0x1'));var jsonpatch=require(_0x5c3a('0x2'));var rp=require(_0x5c3a('0x3'));var moment=require(_0x5c3a('0x4'));var BPromise=require(_0x5c3a('0x5'));var Mustache=require(_0x5c3a('0x6'));var util=require(_0x5c3a('0x7'));var path=require(_0x5c3a('0x8'));var sox=require(_0x5c3a('0x9'));var csv=require(_0x5c3a('0xa'));var ejs=require(_0x5c3a('0xb'));var fs=require('fs');var _=require(_0x5c3a('0xc'));var squel=require(_0x5c3a('0xd'));var crypto=require(_0x5c3a('0xe'));var jsforce=require(_0x5c3a('0xf'));var deskjs=require(_0x5c3a('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5c3a('0x11'));var Papa=require('papaparse');var Redis=require(_0x5c3a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5c3a('0x13'));var as=require(_0x5c3a('0x14'));var hardwareService=require(_0x5c3a('0x15'));var logger=require('../../config/logger')(_0x5c3a('0x16'));var utils=require(_0x5c3a('0x17'));var config=require(_0x5c3a('0x18'));var licenseUtil=require(_0x5c3a('0x19'));var db=require(_0x5c3a('0x1a'))['db'];function respondWithStatusCode(_0x1398b7,_0x3c70c2){_0x3c70c2=_0x3c70c2||0xcc;return function(_0x223d48){if(_0x223d48){return _0x1398b7[_0x5c3a('0x1b')](_0x3c70c2);}return _0x1398b7[_0x5c3a('0x1c')](_0x3c70c2)[_0x5c3a('0x1d')]();};}function respondWithResult(_0x4bd4b3,_0x122552){_0x122552=_0x122552||0xc8;return function(_0x156fc4){if(_0x156fc4){return _0x4bd4b3[_0x5c3a('0x1c')](_0x122552)[_0x5c3a('0x1e')](_0x156fc4);}};}function respondWithFilteredResult(_0x35535c,_0x28e4a8){return function(_0x3b06f8){if(_0x3b06f8){var _0x311f00=_0x3b06f8[_0x5c3a('0x1f')],_0x30aa54=_0x28e4a8[_0x5c3a('0x20')],_0x44de6c=_0x28e4a8[_0x5c3a('0x20')]+_0x28e4a8[_0x5c3a('0x21')],_0xa3ad7a;if(_0x44de6c>=_0x311f00){_0x44de6c=_0x311f00;_0xa3ad7a=0xc8;}else{_0xa3ad7a=0xce;}_0x35535c[_0x5c3a('0x1c')](_0xa3ad7a);return _0x35535c[_0x5c3a('0x22')](_0x5c3a('0x23'),_0x30aa54+'-'+_0x44de6c+'/'+_0x311f00)[_0x5c3a('0x1e')](_0x3b06f8);}return null;};}function patchUpdates(_0x5e39c8){return function(_0x3e6276){try{jsonpatch['apply'](_0x3e6276,_0x5e39c8,!![]);}catch(_0x44a915){return BPromise[_0x5c3a('0x24')](_0x44a915);}return _0x3e6276[_0x5c3a('0x25')]();};}function saveUpdates(_0x100d39,_0x19fac6){return function(_0x36d554){if(_0x36d554){return _0x36d554[_0x5c3a('0x26')](_0x100d39)['then'](function(_0x2a23f2){return _0x2a23f2;});}return null;};}function removeEntity(_0x34b9d9,_0x58c129){return function(_0xe78c35){if(_0xe78c35){return _0xe78c35[_0x5c3a('0x27')]()['then'](function(){_0x34b9d9[_0x5c3a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb9b992,_0x162e51){return function(_0x55eacd){if(!_0x55eacd){_0xb9b992['sendStatus'](0x194);}return _0x55eacd;};}function handleError(_0x1cd5a0,_0x4cfd09){_0x4cfd09=_0x4cfd09||0x1f4;return function(_0x375873){logger['error'](_0x375873['stack']);if(_0x375873['name']){delete _0x375873[_0x5c3a('0x28')];}_0x1cd5a0[_0x5c3a('0x1c')](_0x4cfd09)[_0x5c3a('0x29')](_0x375873);};}exports[_0x5c3a('0x2a')]=function(_0x24d50d,_0x2b5070){var _0x2a22f3={},_0x42ca6f={},_0x264a0c={'count':0x0,'rows':[]};var _0x50caf5=_[_0x5c3a('0x2b')](db[_0x5c3a('0x2c')]['rawAttributes'],function(_0x555cf5){return{'name':_0x555cf5[_0x5c3a('0x2d')],'type':_0x555cf5[_0x5c3a('0x2e')][_0x5c3a('0x2f')]};});_0x42ca6f[_0x5c3a('0x30')]=_[_0x5c3a('0x2b')](_0x50caf5,'name');_0x42ca6f[_0x5c3a('0x31')]=_[_0x5c3a('0x32')](_0x24d50d[_0x5c3a('0x31')]);_0x42ca6f['filters']=_[_0x5c3a('0x33')](_0x42ca6f[_0x5c3a('0x30')],_0x42ca6f[_0x5c3a('0x31')]);_0x2a22f3[_0x5c3a('0x34')]=_['intersection'](_0x42ca6f['model'],qs[_0x5c3a('0x35')](_0x24d50d['query']['fields']));_0x2a22f3[_0x5c3a('0x34')]=_0x2a22f3[_0x5c3a('0x34')]['length']?_0x2a22f3[_0x5c3a('0x34')]:_0x42ca6f['model'];if(!_0x24d50d[_0x5c3a('0x31')][_0x5c3a('0x36')](_0x5c3a('0x37'))){_0x2a22f3[_0x5c3a('0x21')]=qs[_0x5c3a('0x21')](_0x24d50d[_0x5c3a('0x31')][_0x5c3a('0x21')]);_0x2a22f3[_0x5c3a('0x20')]=qs[_0x5c3a('0x20')](_0x24d50d[_0x5c3a('0x31')][_0x5c3a('0x20')]);}_0x2a22f3[_0x5c3a('0x38')]=qs[_0x5c3a('0x39')](_0x24d50d['query'][_0x5c3a('0x39')]);_0x2a22f3[_0x5c3a('0x3a')]=qs['filters'](_['pick'](_0x24d50d[_0x5c3a('0x31')],_0x42ca6f[_0x5c3a('0x3b')]),_0x50caf5);if(_0x24d50d[_0x5c3a('0x31')]['filter']){_0x2a22f3[_0x5c3a('0x3a')]=_[_0x5c3a('0x3c')](_0x2a22f3[_0x5c3a('0x3a')],{'$or':_[_0x5c3a('0x2b')](_0x50caf5,function(_0x212bed){if(_0x212bed[_0x5c3a('0x2e')]!==_0x5c3a('0x3d')){var _0x5e40d9={};_0x5e40d9[_0x212bed[_0x5c3a('0x28')]]={'$like':'%'+_0x24d50d[_0x5c3a('0x31')][_0x5c3a('0x3e')]+'%'};return _0x5e40d9;}})});}_0x2a22f3=_['merge']({},_0x2a22f3,_0x24d50d[_0x5c3a('0x3f')]);var _0x3d9135={'where':_0x2a22f3['where']};return db[_0x5c3a('0x2c')]['count'](_0x3d9135)[_0x5c3a('0x40')](function(_0x364d8a){_0x264a0c[_0x5c3a('0x1f')]=_0x364d8a;if(_0x24d50d[_0x5c3a('0x31')][_0x5c3a('0x41')]){_0x2a22f3['include']=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x2a22f3);})[_0x5c3a('0x40')](function(_0x421163){_0x264a0c[_0x5c3a('0x42')]=_0x421163;return _0x264a0c;})['then'](respondWithFilteredResult(_0x2b5070,_0x2a22f3))['catch'](handleError(_0x2b5070,null));};exports['show']=function(_0x33ee71,_0x3358f7){var _0x15ff6c={'raw':!![],'where':{'id':_0x33ee71[_0x5c3a('0x43')]['id']}},_0x527df1={};_0x527df1[_0x5c3a('0x30')]=_['keys'](db[_0x5c3a('0x2c')][_0x5c3a('0x44')]);_0x527df1[_0x5c3a('0x31')]=_[_0x5c3a('0x32')](_0x33ee71[_0x5c3a('0x31')]);_0x527df1['filters']=_['intersection'](_0x527df1[_0x5c3a('0x30')],_0x527df1[_0x5c3a('0x31')]);_0x15ff6c[_0x5c3a('0x34')]=_[_0x5c3a('0x33')](_0x527df1[_0x5c3a('0x30')],qs[_0x5c3a('0x35')](_0x33ee71['query']['fields']));_0x15ff6c[_0x5c3a('0x34')]=_0x15ff6c[_0x5c3a('0x34')][_0x5c3a('0x45')]?_0x15ff6c[_0x5c3a('0x34')]:_0x527df1[_0x5c3a('0x30')];if(_0x33ee71[_0x5c3a('0x31')][_0x5c3a('0x41')]){_0x15ff6c['include']=[{'all':!![]}];}_0x15ff6c=_[_0x5c3a('0x3c')]({},_0x15ff6c,_0x33ee71['options']);return db[_0x5c3a('0x2c')]['find'](_0x15ff6c)['then'](handleEntityNotFound(_0x3358f7,null))[_0x5c3a('0x40')](respondWithResult(_0x3358f7,null))[_0x5c3a('0x46')](handleError(_0x3358f7,null));};exports[_0x5c3a('0x47')]=function(_0x37c0ee,_0x4520cc){return db[_0x5c3a('0x2c')][_0x5c3a('0x47')](_0x37c0ee[_0x5c3a('0x48')],{})[_0x5c3a('0x40')](respondWithResult(_0x4520cc,0xc9))[_0x5c3a('0x46')](handleError(_0x4520cc,null));};exports[_0x5c3a('0x26')]=function(_0x44f273,_0x3a8f06){if(_0x44f273[_0x5c3a('0x48')]['id']){delete _0x44f273[_0x5c3a('0x48')]['id'];}return db[_0x5c3a('0x2c')][_0x5c3a('0x49')]({'where':{'id':_0x44f273[_0x5c3a('0x43')]['id']}})['then'](handleEntityNotFound(_0x3a8f06,null))['then'](saveUpdates(_0x44f273[_0x5c3a('0x48')],null))[_0x5c3a('0x40')](respondWithResult(_0x3a8f06,null))['catch'](handleError(_0x3a8f06,null));};exports[_0x5c3a('0x27')]=function(_0x22ff31,_0x5cdef1){return db['OpenchannelTransferReport'][_0x5c3a('0x49')]({'where':{'id':_0x22ff31[_0x5c3a('0x43')]['id']}})[_0x5c3a('0x40')](handleEntityNotFound(_0x5cdef1,null))['then'](removeEntity(_0x5cdef1,null))[_0x5c3a('0x46')](handleError(_0x5cdef1,null));};exports[_0x5c3a('0x4a')]=function(_0x45335a,_0x2dfc57){return db['OpenchannelTransferReport'][_0x5c3a('0x4a')]()[_0x5c3a('0x40')](respondWithResult(_0x2dfc57,null))[_0x5c3a('0x46')](handleError(_0x2dfc57,null));}; \ No newline at end of file +var _0x1958=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','OpenchannelTransferReport','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','describe','html-pdf','eml-format'];(function(_0x1d45ac,_0x9199a6){var _0x21b6f7=function(_0x54c3ca){while(--_0x54c3ca){_0x1d45ac['push'](_0x1d45ac['shift']());}};_0x21b6f7(++_0x9199a6);}(_0x1958,0x12e));var _0x8195=function(_0x5b142f,_0x10815a){_0x5b142f=_0x5b142f-0x0;var _0x327bbd=_0x1958[_0x5b142f];return _0x327bbd;};'use strict';var pdf=require(_0x8195('0x0'));var emlformat=require(_0x8195('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8195('0x2'));var jsonpatch=require(_0x8195('0x3'));var rp=require(_0x8195('0x4'));var moment=require(_0x8195('0x5'));var BPromise=require(_0x8195('0x6'));var Mustache=require(_0x8195('0x7'));var util=require('util');var path=require('path');var sox=require(_0x8195('0x8'));var csv=require(_0x8195('0x9'));var ejs=require(_0x8195('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8195('0xb'));var crypto=require(_0x8195('0xc'));var jsforce=require(_0x8195('0xd'));var deskjs=require(_0x8195('0xe'));var toCsv=require(_0x8195('0x9'));var querystring=require('querystring');var Papa=require(_0x8195('0xf'));var Redis=require(_0x8195('0x10'));var authService=require(_0x8195('0x11'));var qs=require(_0x8195('0x12'));var as=require(_0x8195('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8195('0x14'))(_0x8195('0x15'));var utils=require('../../config/utils');var config=require(_0x8195('0x16'));var licenseUtil=require(_0x8195('0x17'));var db=require(_0x8195('0x18'))['db'];function respondWithStatusCode(_0x1b1d56,_0x42c84f){_0x42c84f=_0x42c84f||0xcc;return function(_0x4f0735){if(_0x4f0735){return _0x1b1d56[_0x8195('0x19')](_0x42c84f);}return _0x1b1d56[_0x8195('0x1a')](_0x42c84f)['end']();};}function respondWithResult(_0x1f955d,_0xfc72aa){_0xfc72aa=_0xfc72aa||0xc8;return function(_0x48aac5){if(_0x48aac5){return _0x1f955d[_0x8195('0x1a')](_0xfc72aa)[_0x8195('0x1b')](_0x48aac5);}};}function respondWithFilteredResult(_0x259a6d,_0xff684b){return function(_0x1ce998){if(_0x1ce998){var _0x3db1e5=_0x1ce998['count'],_0x263687=_0xff684b[_0x8195('0x1c')],_0x25558c=_0xff684b[_0x8195('0x1c')]+_0xff684b['limit'],_0x543143;if(_0x25558c>=_0x3db1e5){_0x25558c=_0x3db1e5;_0x543143=0xc8;}else{_0x543143=0xce;}_0x259a6d[_0x8195('0x1a')](_0x543143);return _0x259a6d[_0x8195('0x1d')](_0x8195('0x1e'),_0x263687+'-'+_0x25558c+'/'+_0x3db1e5)[_0x8195('0x1b')](_0x1ce998);}return null;};}function patchUpdates(_0x9fe1c1){return function(_0x396591){try{jsonpatch[_0x8195('0x1f')](_0x396591,_0x9fe1c1,!![]);}catch(_0x2daffd){return BPromise[_0x8195('0x20')](_0x2daffd);}return _0x396591[_0x8195('0x21')]();};}function saveUpdates(_0x1c496f,_0xd8f36e){return function(_0x509ff0){if(_0x509ff0){return _0x509ff0[_0x8195('0x22')](_0x1c496f)[_0x8195('0x23')](function(_0x9f1103){return _0x9f1103;});}return null;};}function removeEntity(_0x507f27,_0x4401bd){return function(_0x5cea8b){if(_0x5cea8b){return _0x5cea8b[_0x8195('0x24')]()['then'](function(){_0x507f27[_0x8195('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x74e709,_0xbd3d3e){return function(_0x1a35c8){if(!_0x1a35c8){_0x74e709['sendStatus'](0x194);}return _0x1a35c8;};}function handleError(_0x280219,_0x443e97){_0x443e97=_0x443e97||0x1f4;return function(_0x31e175){logger[_0x8195('0x25')](_0x31e175['stack']);if(_0x31e175[_0x8195('0x26')]){delete _0x31e175[_0x8195('0x26')];}_0x280219[_0x8195('0x1a')](_0x443e97)[_0x8195('0x27')](_0x31e175);};}exports['index']=function(_0x198651,_0x1db1dc){var _0x3959ae={},_0x27d89e={},_0x1fb3a1={'count':0x0,'rows':[]};var _0x5f53c5=_['map'](db[_0x8195('0x28')]['rawAttributes'],function(_0x4147b1){return{'name':_0x4147b1[_0x8195('0x29')],'type':_0x4147b1[_0x8195('0x2a')][_0x8195('0x2b')]};});_0x27d89e[_0x8195('0x2c')]=_[_0x8195('0x2d')](_0x5f53c5,_0x8195('0x26'));_0x27d89e[_0x8195('0x2e')]=_['keys'](_0x198651[_0x8195('0x2e')]);_0x27d89e[_0x8195('0x2f')]=_[_0x8195('0x30')](_0x27d89e[_0x8195('0x2c')],_0x27d89e[_0x8195('0x2e')]);_0x3959ae[_0x8195('0x31')]=_[_0x8195('0x30')](_0x27d89e['model'],qs[_0x8195('0x32')](_0x198651[_0x8195('0x2e')]['fields']));_0x3959ae[_0x8195('0x31')]=_0x3959ae[_0x8195('0x31')]['length']?_0x3959ae['attributes']:_0x27d89e['model'];if(!_0x198651[_0x8195('0x2e')][_0x8195('0x33')](_0x8195('0x34'))){_0x3959ae[_0x8195('0x35')]=qs[_0x8195('0x35')](_0x198651[_0x8195('0x2e')][_0x8195('0x35')]);_0x3959ae[_0x8195('0x1c')]=qs[_0x8195('0x1c')](_0x198651[_0x8195('0x2e')][_0x8195('0x1c')]);}_0x3959ae[_0x8195('0x36')]=qs[_0x8195('0x37')](_0x198651[_0x8195('0x2e')][_0x8195('0x37')]);_0x3959ae['where']=qs['filters'](_[_0x8195('0x38')](_0x198651[_0x8195('0x2e')],_0x27d89e['filters']),_0x5f53c5);if(_0x198651[_0x8195('0x2e')][_0x8195('0x39')]){_0x3959ae[_0x8195('0x3a')]=_[_0x8195('0x3b')](_0x3959ae[_0x8195('0x3a')],{'$or':_['map'](_0x5f53c5,function(_0x2ae7a2){if(_0x2ae7a2[_0x8195('0x2a')]!==_0x8195('0x3c')){var _0x3fbd3c={};_0x3fbd3c[_0x2ae7a2['name']]={'$like':'%'+_0x198651[_0x8195('0x2e')]['filter']+'%'};return _0x3fbd3c;}})});}_0x3959ae=_['merge']({},_0x3959ae,_0x198651[_0x8195('0x3d')]);var _0x5377b2={'where':_0x3959ae[_0x8195('0x3a')]};return db[_0x8195('0x28')][_0x8195('0x3e')](_0x5377b2)[_0x8195('0x23')](function(_0xe8420){_0x1fb3a1[_0x8195('0x3e')]=_0xe8420;if(_0x198651['query'][_0x8195('0x3f')]){_0x3959ae[_0x8195('0x40')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x8195('0x41')](_0x3959ae);})[_0x8195('0x23')](function(_0x283c85){_0x1fb3a1[_0x8195('0x42')]=_0x283c85;return _0x1fb3a1;})['then'](respondWithFilteredResult(_0x1db1dc,_0x3959ae))['catch'](handleError(_0x1db1dc,null));};exports[_0x8195('0x43')]=function(_0x4512b5,_0xe26bc3){var _0x2b7f2c={'raw':!![],'where':{'id':_0x4512b5[_0x8195('0x44')]['id']}},_0x32c01d={};_0x32c01d[_0x8195('0x2c')]=_[_0x8195('0x45')](db[_0x8195('0x28')]['rawAttributes']);_0x32c01d[_0x8195('0x2e')]=_['keys'](_0x4512b5['query']);_0x32c01d[_0x8195('0x2f')]=_[_0x8195('0x30')](_0x32c01d['model'],_0x32c01d[_0x8195('0x2e')]);_0x2b7f2c[_0x8195('0x31')]=_[_0x8195('0x30')](_0x32c01d[_0x8195('0x2c')],qs[_0x8195('0x32')](_0x4512b5['query'][_0x8195('0x32')]));_0x2b7f2c[_0x8195('0x31')]=_0x2b7f2c[_0x8195('0x31')][_0x8195('0x46')]?_0x2b7f2c['attributes']:_0x32c01d[_0x8195('0x2c')];if(_0x4512b5[_0x8195('0x2e')]['includeAll']){_0x2b7f2c[_0x8195('0x40')]=[{'all':!![]}];}_0x2b7f2c=_[_0x8195('0x3b')]({},_0x2b7f2c,_0x4512b5[_0x8195('0x3d')]);return db[_0x8195('0x28')][_0x8195('0x47')](_0x2b7f2c)[_0x8195('0x23')](handleEntityNotFound(_0xe26bc3,null))[_0x8195('0x23')](respondWithResult(_0xe26bc3,null))[_0x8195('0x48')](handleError(_0xe26bc3,null));};exports['create']=function(_0x137cd2,_0x348aa1){return db[_0x8195('0x28')][_0x8195('0x49')](_0x137cd2[_0x8195('0x4a')],{})[_0x8195('0x23')](respondWithResult(_0x348aa1,0xc9))[_0x8195('0x48')](handleError(_0x348aa1,null));};exports[_0x8195('0x22')]=function(_0x1ad51d,_0x3e09bf){if(_0x1ad51d[_0x8195('0x4a')]['id']){delete _0x1ad51d[_0x8195('0x4a')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x1ad51d[_0x8195('0x44')]['id']}})[_0x8195('0x23')](handleEntityNotFound(_0x3e09bf,null))[_0x8195('0x23')](saveUpdates(_0x1ad51d['body'],null))['then'](respondWithResult(_0x3e09bf,null))[_0x8195('0x48')](handleError(_0x3e09bf,null));};exports[_0x8195('0x24')]=function(_0x3aaa79,_0x17fb54){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x3aaa79[_0x8195('0x44')]['id']}})[_0x8195('0x23')](handleEntityNotFound(_0x17fb54,null))['then'](removeEntity(_0x17fb54,null))[_0x8195('0x48')](handleError(_0x17fb54,null));};exports[_0x8195('0x4b')]=function(_0x59985a,_0x5a8834){return db[_0x8195('0x28')][_0x8195('0x4b')]()[_0x8195('0x23')](respondWithResult(_0x5a8834,null))[_0x8195('0x48')](handleError(_0x5a8834,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 0e26730..5ac6647 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 _0xf79d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','lodash','util'];(function(_0x57791d,_0x129184){var _0x4d1cbe=function(_0x292829){while(--_0x292829){_0x57791d['push'](_0x57791d['shift']());}};_0x4d1cbe(++_0x129184);}(_0xf79d,0x67));var _0xdf79=function(_0x2cad82,_0x33367a){_0x2cad82=_0x2cad82-0x0;var _0x1cc2fa=_0xf79d[_0x2cad82];return _0x1cc2fa;};'use strict';var _=require(_0xdf79('0x0'));var util=require(_0xdf79('0x1'));var logger=require(_0xdf79('0x2'))(_0xdf79('0x3'));var moment=require(_0xdf79('0x4'));var BPromise=require(_0xdf79('0x5'));var rp=require(_0xdf79('0x6'));var fs=require('fs');var path=require(_0xdf79('0x7'));var rimraf=require(_0xdf79('0x8'));var config=require(_0xdf79('0x9'));var attributes=require(_0xdf79('0xa'));module[_0xdf79('0xb')]=function(_0x282288,_0x5907b6){return _0x282288[_0xdf79('0xc')](_0xdf79('0xd'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xdf79('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5645=['../../config/environment','exports','define','OpenchannelTransferReport','lodash','../../config/logger','api','moment','path'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x5645,0x163));var _0x5564=function(_0x151ed4,_0x23cfb8){_0x151ed4=_0x151ed4-0x0;var _0x1c6f7e=_0x5645[_0x151ed4];return _0x1c6f7e;};'use strict';var _=require(_0x5564('0x0'));var util=require('util');var logger=require(_0x5564('0x1'))(_0x5564('0x2'));var moment=require(_0x5564('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5564('0x4'));var rimraf=require('rimraf');var config=require(_0x5564('0x5'));var attributes=require('./openchannelTransferReport.attributes');module[_0x5564('0x6')]=function(_0x44a3da,_0x28dcd0){return _0x44a3da[_0x5564('0x7')](_0x5564('0x8'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 7e1beca..e0c79ad 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 _0x0bfd=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util'];(function(_0x504f10,_0x372728){var _0x23a8b7=function(_0x12b991){while(--_0x12b991){_0x504f10['push'](_0x504f10['shift']());}};_0x23a8b7(++_0x372728);}(_0x0bfd,0x10f));var _0xd0bf=function(_0x10a551,_0x3e2f9a){_0x10a551=_0x10a551-0x0;var _0x261da0=_0x0bfd[_0x10a551];return _0x261da0;};'use strict';var _=require(_0xd0bf('0x0'));var util=require(_0xd0bf('0x1'));var moment=require('moment');var BPromise=require(_0xd0bf('0x2'));var rs=require(_0xd0bf('0x3'));var fs=require('fs');var Redis=require(_0xd0bf('0x4'));var db=require(_0xd0bf('0x5'))['db'];var utils=require(_0xd0bf('0x6'));var logger=require('../../config/logger')(_0xd0bf('0x7'));var config=require(_0xd0bf('0x8'));var jayson=require(_0xd0bf('0x9'));var client=jayson[_0xd0bf('0xa')][_0xd0bf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56b2a6,_0x32343d,_0x5f5dff){return new BPromise(function(_0xa830f6,_0x585b96){return client['request'](_0x56b2a6,_0x5f5dff)['then'](function(_0x559e19){logger[_0xd0bf('0xc')](_0xd0bf('0xd'),_0x32343d,'request\x20sent');logger[_0xd0bf('0xe')](_0xd0bf('0xf'),_0x32343d,_0xd0bf('0x10'),JSON[_0xd0bf('0x11')](_0x559e19));if(_0x559e19[_0xd0bf('0x12')]){if(_0x559e19[_0xd0bf('0x12')]['code']===0x1f4){logger[_0xd0bf('0x12')](_0xd0bf('0xd'),_0x32343d,_0x559e19[_0xd0bf('0x12')][_0xd0bf('0x13')]);return _0x585b96(_0x559e19['error']['message']);}logger[_0xd0bf('0x12')](_0xd0bf('0xd'),_0x32343d,_0x559e19[_0xd0bf('0x12')][_0xd0bf('0x13')]);return _0xa830f6(_0x559e19[_0xd0bf('0x12')][_0xd0bf('0x13')]);}else{logger[_0xd0bf('0xc')](_0xd0bf('0xd'),_0x32343d,_0xd0bf('0x10'));_0xa830f6(_0x559e19[_0xd0bf('0x14')][_0xd0bf('0x13')]);}})['catch'](function(_0x549410){logger[_0xd0bf('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x32343d,_0x549410);_0x585b96(_0x549410);});});} \ No newline at end of file +var _0x6a54=['debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x2e8cab,_0x28b8e9){var _0x1c2448=function(_0x4f8f9e){while(--_0x4f8f9e){_0x2e8cab['push'](_0x2e8cab['shift']());}};_0x1c2448(++_0x28b8e9);}(_0x6a54,0xe1));var _0x46a5=function(_0x5a4af4,_0x1d21e7){_0x5a4af4=_0x5a4af4-0x0;var _0x31c9bd=_0x6a54[_0x5a4af4];return _0x31c9bd;};'use strict';var _=require(_0x46a5('0x0'));var util=require(_0x46a5('0x1'));var moment=require(_0x46a5('0x2'));var BPromise=require(_0x46a5('0x3'));var rs=require(_0x46a5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46a5('0x5'))['db'];var utils=require(_0x46a5('0x6'));var logger=require(_0x46a5('0x7'))(_0x46a5('0x8'));var config=require('../../config/environment');var jayson=require(_0x46a5('0x9'));var client=jayson[_0x46a5('0xa')][_0x46a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d8d49,_0x361201,_0x1f7562){return new BPromise(function(_0x3969aa,_0x47db02){return client[_0x46a5('0xc')](_0x1d8d49,_0x1f7562)[_0x46a5('0xd')](function(_0x490445){logger[_0x46a5('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x361201,'request\x20sent');logger[_0x46a5('0xf')](_0x46a5('0x10'),_0x361201,'request\x20sent',JSON[_0x46a5('0x11')](_0x490445));if(_0x490445[_0x46a5('0x12')]){if(_0x490445[_0x46a5('0x12')][_0x46a5('0x13')]===0x1f4){logger[_0x46a5('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x361201,_0x490445[_0x46a5('0x12')][_0x46a5('0x14')]);return _0x47db02(_0x490445['error'][_0x46a5('0x14')]);}logger[_0x46a5('0x12')](_0x46a5('0x15'),_0x361201,_0x490445[_0x46a5('0x12')][_0x46a5('0x14')]);return _0x3969aa(_0x490445[_0x46a5('0x12')][_0x46a5('0x14')]);}else{logger[_0x46a5('0xe')](_0x46a5('0x15'),_0x361201,_0x46a5('0x16'));_0x3969aa(_0x490445['result']['message']);}})[_0x46a5('0x17')](function(_0x7f136d){logger['error'](_0x46a5('0x15'),_0x361201,_0x7f136d);_0x47db02(_0x7f136d);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 4661bcb..b759a28 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 _0x2651=['/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','index'];(function(_0x456b77,_0x4fed12){var _0x118bb6=function(_0x2ea238){while(--_0x2ea238){_0x456b77['push'](_0x456b77['shift']());}};_0x118bb6(++_0x4fed12);}(_0x2651,0x15c));var _0x1265=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x2651[_0x47a349];return _0x18ab75;};'use strict';var multer=require(_0x1265('0x0'));var util=require(_0x1265('0x1'));var path=require(_0x1265('0x2'));var timeout=require(_0x1265('0x3'));var express=require(_0x1265('0x4'));var router=express[_0x1265('0x5')]();var auth=require(_0x1265('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1265('0x7'));var controller=require(_0x1265('0x8'));router[_0x1265('0x9')]('/',auth[_0x1265('0xa')](),controller[_0x1265('0xb')]);router['get'](_0x1265('0xc'),auth['isAuthenticated'](),controller[_0x1265('0xd')]);router[_0x1265('0xe')]('/',auth[_0x1265('0xa')](),controller[_0x1265('0xf')]);router[_0x1265('0x10')](_0x1265('0xc'),auth['isAuthenticated'](),controller[_0x1265('0x11')]);router[_0x1265('0x12')](_0x1265('0xc'),auth[_0x1265('0xa')](),controller['destroy']);module[_0x1265('0x13')]=router; \ No newline at end of file +var _0x9e23=['create','put','/:id','update','delete','destroy','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x504ddc,_0x41b40d){var _0x12aaee=function(_0x5182be){while(--_0x5182be){_0x504ddc['push'](_0x504ddc['shift']());}};_0x12aaee(++_0x41b40d);}(_0x9e23,0xa0));var _0x39e2=function(_0x38334e,_0x298750){_0x38334e=_0x38334e-0x0;var _0x30aa60=_0x9e23[_0x38334e];return _0x30aa60;};'use strict';var multer=require('multer');var util=require(_0x39e2('0x0'));var path=require(_0x39e2('0x1'));var timeout=require('connect-timeout');var express=require(_0x39e2('0x2'));var router=express[_0x39e2('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x39e2('0x4'));var config=require(_0x39e2('0x5'));var controller=require('./pause.controller');router[_0x39e2('0x6')]('/',auth[_0x39e2('0x7')](),controller[_0x39e2('0x8')]);router[_0x39e2('0x6')]('/:id',auth[_0x39e2('0x7')](),controller[_0x39e2('0x9')]);router['post']('/',auth[_0x39e2('0x7')](),controller[_0x39e2('0xa')]);router[_0x39e2('0xb')](_0x39e2('0xc'),auth['isAuthenticated'](),controller[_0x39e2('0xd')]);router[_0x39e2('0xe')](_0x39e2('0xc'),auth['isAuthenticated'](),controller[_0x39e2('0xf')]);module[_0x39e2('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index ae2d1ec..aa813f7 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 _0xc984=['exports','STRING','name','sequelize'];(function(_0x403e03,_0xf55073){var _0x345593=function(_0xea7ea6){while(--_0xea7ea6){_0x403e03['push'](_0x403e03['shift']());}};_0x345593(++_0xf55073);}(_0xc984,0x1d7));var _0x4c98=function(_0x525cc0,_0x4c448d){_0x525cc0=_0x525cc0-0x0;var _0x65dd77=_0xc984[_0x525cc0];return _0x65dd77;};'use strict';var Sequelize=require(_0x4c98('0x0'));module[_0x4c98('0x1')]={'name':{'type':Sequelize[_0x4c98('0x2')],'unique':_0x4c98('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x4c98('0x2')]}}; \ No newline at end of file +var _0x0a4a=['STRING','sequelize','exports','name'];(function(_0x3adb8e,_0x247ca2){var _0x3eacdb=function(_0x127ddf){while(--_0x127ddf){_0x3adb8e['push'](_0x3adb8e['shift']());}};_0x3eacdb(++_0x247ca2);}(_0x0a4a,0x1ad));var _0xa0a4=function(_0x3550ab,_0x4a3df9){_0x3550ab=_0x3550ab-0x0;var _0x4e53d0=_0x0a4a[_0x3550ab];return _0x4e53d0;};'use strict';var Sequelize=require(_0xa0a4('0x0'));module[_0xa0a4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa0a4('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xa0a4('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index d24facc..c12aa49 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 _0xbf0e=['nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','Pauses','UserProfileResource','then','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','model','keys','intersection','query','fields','attributes','length','hasOwnProperty'];(function(_0x25a9eb,_0x35ea1f){var _0x3e248b=function(_0x5266e1){while(--_0x5266e1){_0x25a9eb['push'](_0x25a9eb['shift']());}};_0x3e248b(++_0x35ea1f);}(_0xbf0e,0x16e));var _0xebf0=function(_0xb10695,_0x4b9e18){_0xb10695=_0xb10695-0x0;var _0xa95f67=_0xbf0e[_0xb10695];return _0xa95f67;};'use strict';var pdf=require(_0xebf0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xebf0('0x1'));var zipdir=require(_0xebf0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xebf0('0x3'));var moment=require(_0xebf0('0x4'));var BPromise=require(_0xebf0('0x5'));var Mustache=require(_0xebf0('0x6'));var util=require(_0xebf0('0x7'));var path=require(_0xebf0('0x8'));var sox=require('sox');var csv=require(_0xebf0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xebf0('0xa'));var crypto=require(_0xebf0('0xb'));var jsforce=require(_0xebf0('0xc'));var deskjs=require(_0xebf0('0xd'));var toCsv=require('to-csv');var querystring=require(_0xebf0('0xe'));var Papa=require(_0xebf0('0xf'));var Redis=require(_0xebf0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xebf0('0x11'));var as=require(_0xebf0('0x12'));var hardwareService=require(_0xebf0('0x13'));var logger=require(_0xebf0('0x14'))(_0xebf0('0x15'));var utils=require(_0xebf0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xebf0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x183073,_0x5d4d92){_0x5d4d92=_0x5d4d92||0xcc;return function(_0x2f2ad7){if(_0x2f2ad7){return _0x183073[_0xebf0('0x18')](_0x5d4d92);}return _0x183073[_0xebf0('0x19')](_0x5d4d92)[_0xebf0('0x1a')]();};}function respondWithResult(_0x26c10b,_0x1323d5){_0x1323d5=_0x1323d5||0xc8;return function(_0x596458){if(_0x596458){return _0x26c10b[_0xebf0('0x19')](_0x1323d5)[_0xebf0('0x1b')](_0x596458);}};}function respondWithFilteredResult(_0xb2be3a,_0x45b785){return function(_0x19d772){if(_0x19d772){var _0x36387e=_0x19d772[_0xebf0('0x1c')],_0x2a4ee7=_0x45b785['offset'],_0x22a605=_0x45b785[_0xebf0('0x1d')]+_0x45b785[_0xebf0('0x1e')],_0x5b9216;if(_0x22a605>=_0x36387e){_0x22a605=_0x36387e;_0x5b9216=0xc8;}else{_0x5b9216=0xce;}_0xb2be3a[_0xebf0('0x19')](_0x5b9216);return _0xb2be3a[_0xebf0('0x1f')](_0xebf0('0x20'),_0x2a4ee7+'-'+_0x22a605+'/'+_0x36387e)['json'](_0x19d772);}return null;};}function patchUpdates(_0x49246b){return function(_0x2d9272){try{jsonpatch[_0xebf0('0x21')](_0x2d9272,_0x49246b,!![]);}catch(_0x3ed13e){return BPromise[_0xebf0('0x22')](_0x3ed13e);}return _0x2d9272[_0xebf0('0x23')]();};}function saveUpdates(_0x3d3eba,_0x239373){return function(_0x4c344a){if(_0x4c344a){return _0x4c344a[_0xebf0('0x24')](_0x3d3eba)['then'](function(_0x301898){return _0x301898;});}return null;};}function removeEntity(_0x5da27f,_0x317e9c){return function(_0x7c29b1){if(_0x7c29b1){return _0x7c29b1[_0xebf0('0x25')]()['then'](function(){var _0x16bc16=_0x7c29b1['get']({'plain':!![]});var _0x35aeeb=_0xebf0('0x26');return db[_0xebf0('0x27')][_0xebf0('0x25')]({'where':{'type':_0x35aeeb,'resourceId':_0x16bc16['id']}})['then'](function(){return _0x7c29b1;});})[_0xebf0('0x28')](function(){_0x5da27f[_0xebf0('0x19')](0xcc)[_0xebf0('0x1a')]();});}};}function handleEntityNotFound(_0x26ceba,_0x1ab020){return function(_0x569fc8){if(!_0x569fc8){_0x26ceba[_0xebf0('0x18')](0x194);}return _0x569fc8;};}function handleError(_0x47bb52,_0x40b575){_0x40b575=_0x40b575||0x1f4;return function(_0x3feb18){logger[_0xebf0('0x29')](_0x3feb18[_0xebf0('0x2a')]);if(_0x3feb18[_0xebf0('0x2b')]){delete _0x3feb18['name'];}_0x47bb52[_0xebf0('0x19')](_0x40b575)[_0xebf0('0x2c')](_0x3feb18);};}exports[_0xebf0('0x2d')]=function(_0x9d53a1,_0x59d151){var _0x417f2c={},_0x29cc52={},_0x4277d3={'count':0x0,'rows':[]};var _0x518fba=_[_0xebf0('0x2e')](db[_0xebf0('0x2f')][_0xebf0('0x30')],function(_0xed9ba0){return{'name':_0xed9ba0[_0xebf0('0x31')],'type':_0xed9ba0[_0xebf0('0x32')]['key']};});_0x29cc52[_0xebf0('0x33')]=_[_0xebf0('0x2e')](_0x518fba,_0xebf0('0x2b'));_0x29cc52['query']=_[_0xebf0('0x34')](_0x9d53a1['query']);_0x29cc52['filters']=_[_0xebf0('0x35')](_0x29cc52['model'],_0x29cc52[_0xebf0('0x36')]);_0x417f2c['attributes']=_[_0xebf0('0x35')](_0x29cc52[_0xebf0('0x33')],qs[_0xebf0('0x37')](_0x9d53a1[_0xebf0('0x36')][_0xebf0('0x37')]));_0x417f2c[_0xebf0('0x38')]=_0x417f2c[_0xebf0('0x38')][_0xebf0('0x39')]?_0x417f2c[_0xebf0('0x38')]:_0x29cc52[_0xebf0('0x33')];if(!_0x9d53a1['query'][_0xebf0('0x3a')](_0xebf0('0x3b'))){_0x417f2c['limit']=qs[_0xebf0('0x1e')](_0x9d53a1[_0xebf0('0x36')]['limit']);_0x417f2c[_0xebf0('0x1d')]=qs['offset'](_0x9d53a1[_0xebf0('0x36')][_0xebf0('0x1d')]);}_0x417f2c[_0xebf0('0x3c')]=qs[_0xebf0('0x3d')](_0x9d53a1[_0xebf0('0x36')][_0xebf0('0x3d')]);_0x417f2c[_0xebf0('0x3e')]=qs[_0xebf0('0x3f')](_[_0xebf0('0x40')](_0x9d53a1[_0xebf0('0x36')],_0x29cc52[_0xebf0('0x3f')]),_0x518fba);if(_0x9d53a1[_0xebf0('0x36')][_0xebf0('0x41')]){_0x417f2c['where']=_[_0xebf0('0x42')](_0x417f2c[_0xebf0('0x3e')],{'$or':_['map'](_0x518fba,function(_0x25531f){if(_0x25531f['type']!==_0xebf0('0x43')){var _0x1c937e={};_0x1c937e[_0x25531f['name']]={'$like':'%'+_0x9d53a1['query'][_0xebf0('0x41')]+'%'};return _0x1c937e;}})});}_0x417f2c=_[_0xebf0('0x42')]({},_0x417f2c,_0x9d53a1[_0xebf0('0x44')]);var _0x5f465e={'where':_0x417f2c[_0xebf0('0x3e')]};return db[_0xebf0('0x2f')]['count'](_0x5f465e)['then'](function(_0x19e49a){_0x4277d3[_0xebf0('0x1c')]=_0x19e49a;if(_0x9d53a1['query'][_0xebf0('0x45')]){_0x417f2c[_0xebf0('0x46')]=[{'all':!![]}];}return db[_0xebf0('0x2f')][_0xebf0('0x47')](_0x417f2c);})[_0xebf0('0x28')](function(_0xd7e1e5){_0x4277d3[_0xebf0('0x48')]=_0xd7e1e5;return _0x4277d3;})[_0xebf0('0x28')](respondWithFilteredResult(_0x59d151,_0x417f2c))['catch'](handleError(_0x59d151,null));};exports[_0xebf0('0x49')]=function(_0x224c3d,_0x1b4163){var _0x5753a9={'raw':!![],'where':{'id':_0x224c3d[_0xebf0('0x4a')]['id']}},_0x20e7a4={};_0x20e7a4[_0xebf0('0x33')]=_['keys'](db['Pause'][_0xebf0('0x30')]);_0x20e7a4[_0xebf0('0x36')]=_['keys'](_0x224c3d[_0xebf0('0x36')]);_0x20e7a4[_0xebf0('0x3f')]=_[_0xebf0('0x35')](_0x20e7a4[_0xebf0('0x33')],_0x20e7a4['query']);_0x5753a9[_0xebf0('0x38')]=_[_0xebf0('0x35')](_0x20e7a4[_0xebf0('0x33')],qs['fields'](_0x224c3d['query'][_0xebf0('0x37')]));_0x5753a9[_0xebf0('0x38')]=_0x5753a9['attributes'][_0xebf0('0x39')]?_0x5753a9['attributes']:_0x20e7a4[_0xebf0('0x33')];if(_0x224c3d[_0xebf0('0x36')]['includeAll']){_0x5753a9[_0xebf0('0x46')]=[{'all':!![]}];}_0x5753a9=_[_0xebf0('0x42')]({},_0x5753a9,_0x224c3d[_0xebf0('0x44')]);return db[_0xebf0('0x2f')]['find'](_0x5753a9)[_0xebf0('0x28')](handleEntityNotFound(_0x1b4163,null))[_0xebf0('0x28')](respondWithResult(_0x1b4163,null))['catch'](handleError(_0x1b4163,null));};exports[_0xebf0('0x4b')]=function(_0x40a942,_0x588312){return db['Pause'][_0xebf0('0x4b')](_0x40a942[_0xebf0('0x4c')],{})[_0xebf0('0x28')](function(_0xa6e8b6){var _0x99bb81=_0x40a942[_0xebf0('0x4d')][_0xebf0('0x4e')]({'plain':!![]});if(!_0x99bb81)throw new Error(_0xebf0('0x4f'));if(_0x99bb81['role']===_0xebf0('0x4d')){var _0x470e2b=_0xa6e8b6['get']({'plain':!![]});var _0x2a338a=_0xebf0('0x26');return db[_0xebf0('0x50')][_0xebf0('0x51')]({'where':{'name':_0x2a338a,'userProfileId':_0x99bb81['userProfileId']},'raw':!![]})['then'](function(_0x3bcefe){if(_0x3bcefe&&_0x3bcefe[_0xebf0('0x52')]===0x0){return db[_0xebf0('0x27')][_0xebf0('0x4b')]({'name':_0x470e2b[_0xebf0('0x2b')],'resourceId':_0x470e2b['id'],'type':_0x3bcefe['name'],'sectionId':_0x3bcefe['id']},{})[_0xebf0('0x28')](function(){return _0xa6e8b6;});}else{return _0xa6e8b6;}})['catch'](function(_0x4af1dd){logger['error'](_0xebf0('0x53'),_0x4af1dd);throw _0x4af1dd;});}return _0xa6e8b6;})[_0xebf0('0x28')](respondWithResult(_0x588312,0xc9))['catch'](handleError(_0x588312,null));};exports[_0xebf0('0x24')]=function(_0x553901,_0x3db61b){if(_0x553901['body']['id']){delete _0x553901[_0xebf0('0x4c')]['id'];}return db[_0xebf0('0x2f')][_0xebf0('0x51')]({'where':{'id':_0x553901[_0xebf0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3db61b,null))[_0xebf0('0x28')](saveUpdates(_0x553901[_0xebf0('0x4c')],null))[_0xebf0('0x28')](respondWithResult(_0x3db61b,null))[_0xebf0('0x54')](handleError(_0x3db61b,null));};exports[_0xebf0('0x25')]=function(_0x1dc825,_0x18b3d9){return db['Pause'][_0xebf0('0x51')]({'where':{'id':_0x1dc825[_0xebf0('0x4a')]['id']}})[_0xebf0('0x28')](handleEntityNotFound(_0x18b3d9,null))['then'](removeEntity(_0x18b3d9,null))[_0xebf0('0x54')](handleError(_0x18b3d9,null));}; \ No newline at end of file +var _0xee70=['get','Pauses','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','offset','sort','where','filters','pick','filter','merge','count','includeAll','include','Pause','findAll','show','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee70,0xc9));var _0x0ee7=function(_0x162e5d,_0x38eaa2){_0x162e5d=_0x162e5d-0x0;var _0x196e98=_0xee70[_0x162e5d];return _0x196e98;};'use strict';var pdf=require(_0x0ee7('0x0'));var emlformat=require(_0x0ee7('0x1'));var rimraf=require(_0x0ee7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ee7('0x3'));var rp=require(_0x0ee7('0x4'));var moment=require('moment');var BPromise=require(_0x0ee7('0x5'));var Mustache=require(_0x0ee7('0x6'));var util=require(_0x0ee7('0x7'));var path=require(_0x0ee7('0x8'));var sox=require('sox');var csv=require(_0x0ee7('0x9'));var ejs=require(_0x0ee7('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0ee7('0xb'));var crypto=require(_0x0ee7('0xc'));var jsforce=require(_0x0ee7('0xd'));var deskjs=require(_0x0ee7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0ee7('0xf'));var Papa=require(_0x0ee7('0x10'));var Redis=require(_0x0ee7('0x11'));var authService=require(_0x0ee7('0x12'));var qs=require(_0x0ee7('0x13'));var as=require(_0x0ee7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0ee7('0x15'));var utils=require(_0x0ee7('0x16'));var config=require(_0x0ee7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0ee7('0x18'))['db'];function respondWithStatusCode(_0x436773,_0x45d1fb){_0x45d1fb=_0x45d1fb||0xcc;return function(_0x1d1424){if(_0x1d1424){return _0x436773[_0x0ee7('0x19')](_0x45d1fb);}return _0x436773[_0x0ee7('0x1a')](_0x45d1fb)['end']();};}function respondWithResult(_0x3943aa,_0x409c3d){_0x409c3d=_0x409c3d||0xc8;return function(_0x19b3f1){if(_0x19b3f1){return _0x3943aa['status'](_0x409c3d)['json'](_0x19b3f1);}};}function respondWithFilteredResult(_0x3f8092,_0x37bc2d){return function(_0x161128){if(_0x161128){var _0x53a0ed=_0x161128['count'],_0x4b8839=_0x37bc2d['offset'],_0x1d6e48=_0x37bc2d['offset']+_0x37bc2d[_0x0ee7('0x1b')],_0x155160;if(_0x1d6e48>=_0x53a0ed){_0x1d6e48=_0x53a0ed;_0x155160=0xc8;}else{_0x155160=0xce;}_0x3f8092[_0x0ee7('0x1a')](_0x155160);return _0x3f8092[_0x0ee7('0x1c')](_0x0ee7('0x1d'),_0x4b8839+'-'+_0x1d6e48+'/'+_0x53a0ed)['json'](_0x161128);}return null;};}function patchUpdates(_0x242118){return function(_0x4224fa){try{jsonpatch[_0x0ee7('0x1e')](_0x4224fa,_0x242118,!![]);}catch(_0x487d67){return BPromise[_0x0ee7('0x1f')](_0x487d67);}return _0x4224fa[_0x0ee7('0x20')]();};}function saveUpdates(_0x23c177,_0x219127){return function(_0x274876){if(_0x274876){return _0x274876[_0x0ee7('0x21')](_0x23c177)[_0x0ee7('0x22')](function(_0x1d979a){return _0x1d979a;});}return null;};}function removeEntity(_0x4ac430,_0x355541){return function(_0x9e6688){if(_0x9e6688){return _0x9e6688[_0x0ee7('0x23')]()[_0x0ee7('0x22')](function(){var _0x1bd660=_0x9e6688[_0x0ee7('0x24')]({'plain':!![]});var _0x113072=_0x0ee7('0x25');return db[_0x0ee7('0x26')]['destroy']({'where':{'type':_0x113072,'resourceId':_0x1bd660['id']}})[_0x0ee7('0x22')](function(){return _0x9e6688;});})[_0x0ee7('0x22')](function(){_0x4ac430[_0x0ee7('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47f3f9,_0x4af547){return function(_0x5307a9){if(!_0x5307a9){_0x47f3f9[_0x0ee7('0x19')](0x194);}return _0x5307a9;};}function handleError(_0x7bdde4,_0x59462c){_0x59462c=_0x59462c||0x1f4;return function(_0x35f645){logger['error'](_0x35f645[_0x0ee7('0x27')]);if(_0x35f645[_0x0ee7('0x28')]){delete _0x35f645[_0x0ee7('0x28')];}_0x7bdde4[_0x0ee7('0x1a')](_0x59462c)[_0x0ee7('0x29')](_0x35f645);};}exports[_0x0ee7('0x2a')]=function(_0x25bb40,_0x1d06bb){var _0x2f18c3={},_0x1c06f2={},_0x287282={'count':0x0,'rows':[]};var _0x2d7b14=_[_0x0ee7('0x2b')](db['Pause'][_0x0ee7('0x2c')],function(_0x37b193){return{'name':_0x37b193[_0x0ee7('0x2d')],'type':_0x37b193[_0x0ee7('0x2e')][_0x0ee7('0x2f')]};});_0x1c06f2[_0x0ee7('0x30')]=_[_0x0ee7('0x2b')](_0x2d7b14,_0x0ee7('0x28'));_0x1c06f2[_0x0ee7('0x31')]=_[_0x0ee7('0x32')](_0x25bb40[_0x0ee7('0x31')]);_0x1c06f2['filters']=_['intersection'](_0x1c06f2[_0x0ee7('0x30')],_0x1c06f2[_0x0ee7('0x31')]);_0x2f18c3[_0x0ee7('0x33')]=_[_0x0ee7('0x34')](_0x1c06f2[_0x0ee7('0x30')],qs[_0x0ee7('0x35')](_0x25bb40['query'][_0x0ee7('0x35')]));_0x2f18c3[_0x0ee7('0x33')]=_0x2f18c3[_0x0ee7('0x33')][_0x0ee7('0x36')]?_0x2f18c3[_0x0ee7('0x33')]:_0x1c06f2['model'];if(!_0x25bb40[_0x0ee7('0x31')]['hasOwnProperty'](_0x0ee7('0x37'))){_0x2f18c3[_0x0ee7('0x1b')]=qs['limit'](_0x25bb40[_0x0ee7('0x31')]['limit']);_0x2f18c3[_0x0ee7('0x38')]=qs[_0x0ee7('0x38')](_0x25bb40[_0x0ee7('0x31')][_0x0ee7('0x38')]);}_0x2f18c3['order']=qs['sort'](_0x25bb40[_0x0ee7('0x31')][_0x0ee7('0x39')]);_0x2f18c3[_0x0ee7('0x3a')]=qs[_0x0ee7('0x3b')](_[_0x0ee7('0x3c')](_0x25bb40['query'],_0x1c06f2[_0x0ee7('0x3b')]),_0x2d7b14);if(_0x25bb40[_0x0ee7('0x31')][_0x0ee7('0x3d')]){_0x2f18c3[_0x0ee7('0x3a')]=_['merge'](_0x2f18c3[_0x0ee7('0x3a')],{'$or':_[_0x0ee7('0x2b')](_0x2d7b14,function(_0x1d5ff5){if(_0x1d5ff5['type']!=='VIRTUAL'){var _0x571f59={};_0x571f59[_0x1d5ff5['name']]={'$like':'%'+_0x25bb40[_0x0ee7('0x31')][_0x0ee7('0x3d')]+'%'};return _0x571f59;}})});}_0x2f18c3=_[_0x0ee7('0x3e')]({},_0x2f18c3,_0x25bb40['options']);var _0x4a6a76={'where':_0x2f18c3[_0x0ee7('0x3a')]};return db['Pause'][_0x0ee7('0x3f')](_0x4a6a76)[_0x0ee7('0x22')](function(_0x5e4149){_0x287282[_0x0ee7('0x3f')]=_0x5e4149;if(_0x25bb40[_0x0ee7('0x31')][_0x0ee7('0x40')]){_0x2f18c3[_0x0ee7('0x41')]=[{'all':!![]}];}return db[_0x0ee7('0x42')][_0x0ee7('0x43')](_0x2f18c3);})[_0x0ee7('0x22')](function(_0x5273e4){_0x287282['rows']=_0x5273e4;return _0x287282;})[_0x0ee7('0x22')](respondWithFilteredResult(_0x1d06bb,_0x2f18c3))['catch'](handleError(_0x1d06bb,null));};exports[_0x0ee7('0x44')]=function(_0x4e2b2c,_0x561851){var _0x1c4be7={'raw':!![],'where':{'id':_0x4e2b2c['params']['id']}},_0x2c80ea={};_0x2c80ea[_0x0ee7('0x30')]=_[_0x0ee7('0x32')](db[_0x0ee7('0x42')][_0x0ee7('0x2c')]);_0x2c80ea[_0x0ee7('0x31')]=_['keys'](_0x4e2b2c['query']);_0x2c80ea[_0x0ee7('0x3b')]=_[_0x0ee7('0x34')](_0x2c80ea[_0x0ee7('0x30')],_0x2c80ea[_0x0ee7('0x31')]);_0x1c4be7[_0x0ee7('0x33')]=_['intersection'](_0x2c80ea[_0x0ee7('0x30')],qs['fields'](_0x4e2b2c[_0x0ee7('0x31')][_0x0ee7('0x35')]));_0x1c4be7['attributes']=_0x1c4be7[_0x0ee7('0x33')]['length']?_0x1c4be7[_0x0ee7('0x33')]:_0x2c80ea[_0x0ee7('0x30')];if(_0x4e2b2c[_0x0ee7('0x31')][_0x0ee7('0x40')]){_0x1c4be7['include']=[{'all':!![]}];}_0x1c4be7=_['merge']({},_0x1c4be7,_0x4e2b2c['options']);return db[_0x0ee7('0x42')][_0x0ee7('0x45')](_0x1c4be7)['then'](handleEntityNotFound(_0x561851,null))[_0x0ee7('0x22')](respondWithResult(_0x561851,null))[_0x0ee7('0x46')](handleError(_0x561851,null));};exports[_0x0ee7('0x47')]=function(_0x496fb3,_0x4c3e71){return db[_0x0ee7('0x42')][_0x0ee7('0x47')](_0x496fb3[_0x0ee7('0x48')],{})['then'](function(_0x5a2ac7){var _0x42d9b8=_0x496fb3[_0x0ee7('0x49')][_0x0ee7('0x24')]({'plain':!![]});if(!_0x42d9b8)throw new Error(_0x0ee7('0x4a'));if(_0x42d9b8[_0x0ee7('0x4b')]==='user'){var _0x19ce7b=_0x5a2ac7[_0x0ee7('0x24')]({'plain':!![]});var _0x50683d='Pauses';return db['UserProfileSection'][_0x0ee7('0x45')]({'where':{'name':_0x50683d,'userProfileId':_0x42d9b8['userProfileId']},'raw':!![]})[_0x0ee7('0x22')](function(_0x419e12){if(_0x419e12&&_0x419e12[_0x0ee7('0x4c')]===0x0){return db[_0x0ee7('0x26')]['create']({'name':_0x19ce7b[_0x0ee7('0x28')],'resourceId':_0x19ce7b['id'],'type':_0x419e12[_0x0ee7('0x28')],'sectionId':_0x419e12['id']},{})[_0x0ee7('0x22')](function(){return _0x5a2ac7;});}else{return _0x5a2ac7;}})[_0x0ee7('0x46')](function(_0x37d1bd){logger['error'](_0x0ee7('0x4d'),_0x37d1bd);throw _0x37d1bd;});}return _0x5a2ac7;})[_0x0ee7('0x22')](respondWithResult(_0x4c3e71,0xc9))['catch'](handleError(_0x4c3e71,null));};exports[_0x0ee7('0x21')]=function(_0x534127,_0x27b10c){if(_0x534127[_0x0ee7('0x48')]['id']){delete _0x534127['body']['id'];}return db[_0x0ee7('0x42')][_0x0ee7('0x45')]({'where':{'id':_0x534127['params']['id']}})['then'](handleEntityNotFound(_0x27b10c,null))[_0x0ee7('0x22')](saveUpdates(_0x534127[_0x0ee7('0x48')],null))[_0x0ee7('0x22')](respondWithResult(_0x27b10c,null))[_0x0ee7('0x46')](handleError(_0x27b10c,null));};exports[_0x0ee7('0x23')]=function(_0x1ff92f,_0x1c0b96){return db['Pause']['find']({'where':{'id':_0x1ff92f[_0x0ee7('0x4e')]['id']}})[_0x0ee7('0x22')](handleEntityNotFound(_0x1c0b96,null))[_0x0ee7('0x22')](removeEntity(_0x1c0b96,null))[_0x0ee7('0x46')](handleError(_0x1c0b96,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 99912b3..e86b605 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 _0x032e=['./pause.attributes','exports','Pause','tools_pauses','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5713f2,_0x40ef5f){var _0x52232b=function(_0x3b30f1){while(--_0x3b30f1){_0x5713f2['push'](_0x5713f2['shift']());}};_0x52232b(++_0x40ef5f);}(_0x032e,0x1cc));var _0xe032=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x032e[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require('lodash');var util=require(_0xe032('0x0'));var logger=require(_0xe032('0x1'))(_0xe032('0x2'));var moment=require(_0xe032('0x3'));var BPromise=require(_0xe032('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe032('0x5'));var rimraf=require(_0xe032('0x6'));var config=require(_0xe032('0x7'));var attributes=require(_0xe032('0x8'));module[_0xe032('0x9')]=function(_0x43dc81,_0x20da91){return _0x43dc81['define'](_0xe032('0xa'),attributes,{'tableName':_0xe032('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ed9=['moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes','define','Pause','tools_pauses','lodash','util','api'];(function(_0x599346,_0x412daf){var _0x39f8c4=function(_0x3b445d){while(--_0x3b445d){_0x599346['push'](_0x599346['shift']());}};_0x39f8c4(++_0x412daf);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5ed9[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x95ed('0x0'));var util=require(_0x95ed('0x1'));var logger=require('../../config/logger')(_0x95ed('0x2'));var moment=require(_0x95ed('0x3'));var BPromise=require(_0x95ed('0x4'));var rp=require(_0x95ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95ed('0x6'));var config=require(_0x95ed('0x7'));var attributes=require(_0x95ed('0x8'));module['exports']=function(_0x2c9009,_0x5a5117){return _0x2c9009[_0x95ed('0x9')](_0x95ed('0xa'),attributes,{'tableName':_0x95ed('0xb'),'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 91c1111..0aea526 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 _0x5139=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowPause','Pause','find','options','raw','where','include','map','model','attributes','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5139,0xa4));var _0x9513=function(_0x16cf18,_0x248d91){_0x16cf18=_0x16cf18-0x0;var _0xe9f480=_0x5139[_0x16cf18];return _0xe9f480;};'use strict';var _=require('lodash');var util=require(_0x9513('0x0'));var moment=require('moment');var BPromise=require(_0x9513('0x1'));var rs=require(_0x9513('0x2'));var fs=require('fs');var Redis=require(_0x9513('0x3'));var db=require(_0x9513('0x4'))['db'];var utils=require(_0x9513('0x5'));var logger=require(_0x9513('0x6'))(_0x9513('0x7'));var config=require(_0x9513('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9513('0x9')][_0x9513('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bbbdf,_0x43d6d5,_0x54e3f8){return new BPromise(function(_0x4b35e1,_0x40e4d2){return client[_0x9513('0xb')](_0x4bbbdf,_0x54e3f8)[_0x9513('0xc')](function(_0x577f10){logger[_0x9513('0xd')](_0x9513('0xe'),_0x43d6d5,'request\x20sent');logger[_0x9513('0xf')](_0x9513('0x10'),_0x43d6d5,_0x9513('0x11'),JSON[_0x9513('0x12')](_0x577f10));if(_0x577f10[_0x9513('0x13')]){if(_0x577f10['error'][_0x9513('0x14')]===0x1f4){logger[_0x9513('0x13')](_0x9513('0xe'),_0x43d6d5,_0x577f10[_0x9513('0x13')]['message']);return _0x40e4d2(_0x577f10['error'][_0x9513('0x15')]);}logger[_0x9513('0x13')](_0x9513('0xe'),_0x43d6d5,_0x577f10['error']['message']);return _0x4b35e1(_0x577f10[_0x9513('0x13')][_0x9513('0x15')]);}else{logger[_0x9513('0xd')](_0x9513('0xe'),_0x43d6d5,_0x9513('0x11'));_0x4b35e1(_0x577f10[_0x9513('0x16')][_0x9513('0x15')]);}})[_0x9513('0x17')](function(_0x48e9de){logger['error']('Pause,\x20%s,\x20%s',_0x43d6d5,_0x48e9de);_0x40e4d2(_0x48e9de);});});}exports[_0x9513('0x18')]=function(_0x320462){var _0x3a21aa=this;return new Promise(function(_0x1d577c,_0xf7ca19){return db[_0x9513('0x19')][_0x9513('0x1a')]({'raw':_0x320462[_0x9513('0x1b')]?_0x320462[_0x9513('0x1b')][_0x9513('0x1c')]===undefined?!![]:![]:!![],'where':_0x320462[_0x9513('0x1b')]?_0x320462['options'][_0x9513('0x1d')]||null:null,'attributes':_0x320462['options']?_0x320462[_0x9513('0x1b')]['attributes']||null:null,'include':_0x320462[_0x9513('0x1b')]?_0x320462[_0x9513('0x1b')][_0x9513('0x1e')]?_[_0x9513('0x1f')](_0x320462[_0x9513('0x1b')]['include'],function(_0x45b717){return{'model':db[_0x45b717[_0x9513('0x20')]],'as':_0x45b717['as'],'attributes':_0x45b717[_0x9513('0x21')],'include':_0x45b717[_0x9513('0x1e')]?_[_0x9513('0x1f')](_0x45b717['include'],function(_0x35e819){return{'model':db[_0x35e819[_0x9513('0x20')]],'as':_0x35e819['as'],'attributes':_0x35e819['attributes'],'include':_0x35e819[_0x9513('0x1e')]?_[_0x9513('0x1f')](_0x35e819[_0x9513('0x1e')],function(_0x414605){return{'model':db[_0x414605[_0x9513('0x20')]],'as':_0x414605['as'],'attributes':_0x414605[_0x9513('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9513('0xc')](function(_0x5426d9){logger[_0x9513('0xd')](_0x9513('0x18'),_0x320462);logger[_0x9513('0xf')]('ShowPause',_0x320462,JSON[_0x9513('0x12')](_0x5426d9));_0x1d577c(_0x5426d9);})[_0x9513('0x17')](function(_0x4e5fff){logger[_0x9513('0x13')]('ShowPause',_0x4e5fff[_0x9513('0x15')],_0x320462);_0xf7ca19(_0x3a21aa['error'](0x1f4,_0x4e5fff['message']));});});}; \ No newline at end of file +var _0x663c=['model','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','Pause,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowPause','find','options','where','attributes','include'];(function(_0x4593df,_0x3a4901){var _0x57bbbc=function(_0xe5169b){while(--_0xe5169b){_0x4593df['push'](_0x4593df['shift']());}};_0x57bbbc(++_0x3a4901);}(_0x663c,0x1ef));var _0xc663=function(_0x42ebba,_0x4cbf87){_0x42ebba=_0x42ebba-0x0;var _0x3fd2af=_0x663c[_0x42ebba];return _0x3fd2af;};'use strict';var _=require(_0xc663('0x0'));var util=require('util');var moment=require(_0xc663('0x1'));var BPromise=require(_0xc663('0x2'));var rs=require(_0xc663('0x3'));var fs=require('fs');var Redis=require(_0xc663('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc663('0x5'));var logger=require(_0xc663('0x6'))(_0xc663('0x7'));var config=require('../../config/environment');var jayson=require(_0xc663('0x8'));var client=jayson[_0xc663('0x9')][_0xc663('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x943e2a,_0x4ba065,_0x5cd8c4){return new BPromise(function(_0x129139,_0x25f74a){return client[_0xc663('0xb')](_0x943e2a,_0x5cd8c4)[_0xc663('0xc')](function(_0x24df22){logger[_0xc663('0xd')](_0xc663('0xe'),_0x4ba065,_0xc663('0xf'));logger['debug'](_0xc663('0x10'),_0x4ba065,_0xc663('0xf'),JSON[_0xc663('0x11')](_0x24df22));if(_0x24df22['error']){if(_0x24df22[_0xc663('0x12')]['code']===0x1f4){logger[_0xc663('0x12')](_0xc663('0xe'),_0x4ba065,_0x24df22[_0xc663('0x12')][_0xc663('0x13')]);return _0x25f74a(_0x24df22[_0xc663('0x12')][_0xc663('0x13')]);}logger[_0xc663('0x12')](_0xc663('0xe'),_0x4ba065,_0x24df22[_0xc663('0x12')][_0xc663('0x13')]);return _0x129139(_0x24df22[_0xc663('0x12')][_0xc663('0x13')]);}else{logger[_0xc663('0xd')](_0xc663('0xe'),_0x4ba065,'request\x20sent');_0x129139(_0x24df22[_0xc663('0x14')][_0xc663('0x13')]);}})['catch'](function(_0x2ee920){logger[_0xc663('0x12')](_0xc663('0xe'),_0x4ba065,_0x2ee920);_0x25f74a(_0x2ee920);});});}exports[_0xc663('0x15')]=function(_0x2e8d66){var _0x1cb16d=this;return new Promise(function(_0x40edca,_0x539e70){return db['Pause'][_0xc663('0x16')]({'raw':_0x2e8d66['options']?_0x2e8d66[_0xc663('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2e8d66[_0xc663('0x17')]?_0x2e8d66['options'][_0xc663('0x18')]||null:null,'attributes':_0x2e8d66['options']?_0x2e8d66[_0xc663('0x17')][_0xc663('0x19')]||null:null,'include':_0x2e8d66[_0xc663('0x17')]?_0x2e8d66[_0xc663('0x17')][_0xc663('0x1a')]?_['map'](_0x2e8d66[_0xc663('0x17')][_0xc663('0x1a')],function(_0x5f0202){return{'model':db[_0x5f0202[_0xc663('0x1b')]],'as':_0x5f0202['as'],'attributes':_0x5f0202[_0xc663('0x19')],'include':_0x5f0202['include']?_[_0xc663('0x1c')](_0x5f0202[_0xc663('0x1a')],function(_0x200ee7){return{'model':db[_0x200ee7[_0xc663('0x1b')]],'as':_0x200ee7['as'],'attributes':_0x200ee7[_0xc663('0x19')],'include':_0x200ee7['include']?_[_0xc663('0x1c')](_0x200ee7[_0xc663('0x1a')],function(_0x460467){return{'model':db[_0x460467[_0xc663('0x1b')]],'as':_0x460467['as'],'attributes':_0x460467[_0xc663('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc663('0xc')](function(_0x201997){logger[_0xc663('0xd')](_0xc663('0x15'),_0x2e8d66);logger['debug'](_0xc663('0x15'),_0x2e8d66,JSON[_0xc663('0x11')](_0x201997));_0x40edca(_0x201997);})['catch'](function(_0xe47572){logger[_0xc663('0x12')](_0xc663('0x15'),_0xe47572[_0xc663('0x13')],_0x2e8d66);_0x539e70(_0x1cb16d[_0xc663('0x12')](0x1f4,_0xe47572[_0xc663('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index d3c3761..4d2267f 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 _0x3863=['update','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','/webhook','show','/:id/download','download','diskStorage','join','root','server/files/plugins','format','originalname','extname','now','single','file','upload','post','webhookPost','/:id'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3863,0x8d));var _0x3386=function(_0x3664de,_0x46fb18){_0x3664de=_0x3664de-0x0;var _0xaf09bf=_0x3863[_0x3664de];return _0xaf09bf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3386('0x0'));var timeout=require(_0x3386('0x1'));var express=require(_0x3386('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3386('0x3'));var config=require(_0x3386('0x4'));var controller=require(_0x3386('0x5'));router['get']('/',auth[_0x3386('0x6')](),controller[_0x3386('0x7')]);router[_0x3386('0x8')](_0x3386('0x9'),controller['webhookGet']);router['get']('/:id',auth[_0x3386('0x6')](),controller[_0x3386('0xa')]);router[_0x3386('0x8')](_0x3386('0xb'),auth[_0x3386('0x6')](),controller[_0x3386('0xc')]);var upload=multer({'storage':multer[_0x3386('0xd')]({'destination':function(_0x123dd1,_0x44d970,_0x27d0ae){_0x27d0ae(null,path[_0x3386('0xe')](config[_0x3386('0xf')],_0x3386('0x10')));},'filename':function(_0x53b139,_0x5936a6,_0x148f97){_0x5936a6['originalname']=_0x5936a6['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x148f97(null,util[_0x3386('0x11')]('%s-%s%s',path['basename'](_0x5936a6[_0x3386('0x12')],path[_0x3386('0x13')](_0x5936a6[_0x3386('0x12')])),Date[_0x3386('0x14')](),path[_0x3386('0x13')](_0x5936a6[_0x3386('0x12')])));}})});router['post']('/',upload[_0x3386('0x15')](_0x3386('0x16')),controller[_0x3386('0x17')]);router[_0x3386('0x18')](_0x3386('0x9'),controller[_0x3386('0x19')]);router['put'](_0x3386('0x1a'),auth[_0x3386('0x6')](),controller[_0x3386('0x1b')]);router['delete']('/:id',auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0x29c3=['file','webhookPost','put','update','delete','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','join','root','originalname','replace','format','%s-%s%s','extname','now','post','single'];(function(_0x336d11,_0x12f3fa){var _0x326636=function(_0x63575c){while(--_0x63575c){_0x336d11['push'](_0x336d11['shift']());}};_0x326636(++_0x12f3fa);}(_0x29c3,0x165));var _0x329c=function(_0x5efb92,_0x9fc12f){_0x5efb92=_0x5efb92-0x0;var _0x2d0729=_0x29c3[_0x5efb92];return _0x2d0729;};'use strict';var multer=require(_0x329c('0x0'));var util=require('util');var path=require(_0x329c('0x1'));var timeout=require('connect-timeout');var express=require(_0x329c('0x2'));var router=express[_0x329c('0x3')]();var auth=require(_0x329c('0x4'));var interaction=require(_0x329c('0x5'));var config=require(_0x329c('0x6'));var controller=require(_0x329c('0x7'));router[_0x329c('0x8')]('/',auth[_0x329c('0x9')](),controller[_0x329c('0xa')]);router[_0x329c('0x8')](_0x329c('0xb'),controller[_0x329c('0xc')]);router['get'](_0x329c('0xd'),auth[_0x329c('0x9')](),controller[_0x329c('0xe')]);router[_0x329c('0x8')](_0x329c('0xf'),auth[_0x329c('0x9')](),controller[_0x329c('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5787f4,_0x303b14,_0x5c3c24){_0x5c3c24(null,path[_0x329c('0x11')](config[_0x329c('0x12')],'server/files/plugins'));},'filename':function(_0x44ff30,_0x1b55fd,_0x2ec42a){_0x1b55fd[_0x329c('0x13')]=_0x1b55fd[_0x329c('0x13')][_0x329c('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2ec42a(null,util[_0x329c('0x15')](_0x329c('0x16'),path['basename'](_0x1b55fd['originalname'],path[_0x329c('0x17')](_0x1b55fd[_0x329c('0x13')])),Date[_0x329c('0x18')](),path[_0x329c('0x17')](_0x1b55fd[_0x329c('0x13')])));}})});router[_0x329c('0x19')]('/',upload[_0x329c('0x1a')](_0x329c('0x1b')),controller['upload']);router['post']('/webhook',controller[_0x329c('0x1c')]);router[_0x329c('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0x329c('0x1e')]);router[_0x329c('0x1f')](_0x329c('0xd'),auth[_0x329c('0x9')](),controller[_0x329c('0x1f')]);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 039f836..c9a9ed1 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 _0x8f2e=['sequelize','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x34fbf0,_0x585bc6){var _0x1beeb1=function(_0x15b065){while(--_0x15b065){_0x34fbf0['push'](_0x34fbf0['shift']());}};_0x1beeb1(++_0x585bc6);}(_0x8f2e,0xb0));var _0xe8f2=function(_0xfe72a,_0xc91d0){_0xfe72a=_0xfe72a-0x0;var _0x33e3d1=_0x8f2e[_0xfe72a];return _0x33e3d1;};'use strict';var Sequelize=require(_0xe8f2('0x0'));module['exports']={'name':{'type':Sequelize[_0xe8f2('0x1')]},'type':{'type':Sequelize['ENUM'](_0xe8f2('0x2'),_0xe8f2('0x3'))},'description':{'type':Sequelize[_0xe8f2('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xe8f2('0x1')],'comment':_0xe8f2('0x5')},'active':{'type':Sequelize[_0xe8f2('0x6')],'defaultValue':0x0,'comment':_0xe8f2('0x7')},'sidebar':{'type':Sequelize['ENUM']('adminOnly','agentOnly',_0xe8f2('0x8'),_0xe8f2('0x9')),'defaultValue':_0xe8f2('0x8'),'comment':_0xe8f2('0xa')},'icon':{'type':Sequelize[_0xe8f2('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xe8f2('0x1')]},'scriptName':{'type':Sequelize[_0xe8f2('0x1')]},'scriptPath':{'type':Sequelize[_0xe8f2('0x1')]}}; \ No newline at end of file +var _0x8776=['ENUM','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0x1a5d62,_0x508f3b){var _0x4987de=function(_0x2a5efa){while(--_0x2a5efa){_0x1a5d62['push'](_0x1a5d62['shift']());}};_0x4987de(++_0x508f3b);}(_0x8776,0x136));var _0x6877=function(_0xf946b3,_0x204bb3){_0xf946b3=_0xf946b3-0x0;var _0x508854=_0x8776[_0xf946b3];return _0x508854;};'use strict';var Sequelize=require(_0x6877('0x0'));module[_0x6877('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6877('0x2')]('html',_0x6877('0x3'))},'description':{'type':Sequelize[_0x6877('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x6877('0x5')],'comment':_0x6877('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x6877('0x7')},'sidebar':{'type':Sequelize[_0x6877('0x2')](_0x6877('0x8'),_0x6877('0x9'),_0x6877('0xa'),_0x6877('0xb')),'defaultValue':'always','comment':_0x6877('0xc')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x6877('0x5')]},'agentUrl':{'type':Sequelize[_0x6877('0x5')]},'scriptName':{'type':Sequelize[_0x6877('0x5')]},'scriptPath':{'type':Sequelize[_0x6877('0x5')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 108013b..d4ddc5f 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 _0xf8c0=['fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','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','socket.io-emitter','redis','./plugin.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','error','stack','name','map','Plugin','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','download','find','join','root','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','info','Temporary\x20file\x20removed','upload','extname','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20type\x20missing','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','agent','type','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','unlinkSync','Extracted\x20folder\x20removed','webhookGet','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x38175c,_0x40cce2){var _0xcdf252=function(_0x2ec709){while(--_0x2ec709){_0x38175c['push'](_0x38175c['shift']());}};_0xcdf252(++_0x40cce2);}(_0xf8c0,0x158));var _0x0f8c=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0xf8c0[_0x31b5b2];return _0x364f13;};'use strict';var pdf=require(_0x0f8c('0x0'));var emlformat=require(_0x0f8c('0x1'));var rimraf=require(_0x0f8c('0x2'));var zipdir=require(_0x0f8c('0x3'));var jsonpatch=require(_0x0f8c('0x4'));var rp=require('request-promise');var moment=require(_0x0f8c('0x5'));var BPromise=require(_0x0f8c('0x6'));var Mustache=require(_0x0f8c('0x7'));var util=require(_0x0f8c('0x8'));var path=require(_0x0f8c('0x9'));var sox=require('sox');var csv=require(_0x0f8c('0xa'));var ejs=require(_0x0f8c('0xb'));var fs=require('fs');var _=require(_0x0f8c('0xc'));var squel=require(_0x0f8c('0xd'));var crypto=require(_0x0f8c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0f8c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0f8c('0x10'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0x0f8c('0x2'));var archiver=require('archiver');var Redis=require(_0x0f8c('0x11'));var authService=require(_0x0f8c('0x12'));var qs=require(_0x0f8c('0x13'));var as=require(_0x0f8c('0x14'));var hardwareService=require(_0x0f8c('0x15'));var logger=require(_0x0f8c('0x16'))(_0x0f8c('0x17'));var utils=require(_0x0f8c('0x18'));var config=require(_0x0f8c('0x19'));var licenseUtil=require(_0x0f8c('0x1a'));var db=require(_0x0f8c('0x1b'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0f8c('0x1c'))(new Redis(config[_0x0f8c('0x1d')]));require(_0x0f8c('0x1e'))[_0x0f8c('0x1f')](socket);function respondWithStatusCode(_0x23b44d,_0x59d49e){_0x59d49e=_0x59d49e||0xcc;return function(_0x5a732c){if(_0x5a732c){return _0x23b44d[_0x0f8c('0x20')](_0x59d49e);}return _0x23b44d[_0x0f8c('0x21')](_0x59d49e)[_0x0f8c('0x22')]();};}function respondWithResult(_0x53f55f,_0x4de1cb){_0x4de1cb=_0x4de1cb||0xc8;return function(_0x967745){if(_0x967745){return _0x53f55f[_0x0f8c('0x21')](_0x4de1cb)['json'](_0x967745);}};}function respondWithFilteredResult(_0xfb992,_0x5e0966){return function(_0x1f2224){if(_0x1f2224){var _0x5ea69b=_0x1f2224[_0x0f8c('0x23')],_0x5bfe51=_0x5e0966[_0x0f8c('0x24')],_0x31af6b=_0x5e0966[_0x0f8c('0x24')]+_0x5e0966[_0x0f8c('0x25')],_0x4c7e7b;if(_0x31af6b>=_0x5ea69b){_0x31af6b=_0x5ea69b;_0x4c7e7b=0xc8;}else{_0x4c7e7b=0xce;}_0xfb992['status'](_0x4c7e7b);return _0xfb992[_0x0f8c('0x26')](_0x0f8c('0x27'),_0x5bfe51+'-'+_0x31af6b+'/'+_0x5ea69b)[_0x0f8c('0x28')](_0x1f2224);}return null;};}function patchUpdates(_0xf177e6){return function(_0x426c50){try{jsonpatch[_0x0f8c('0x29')](_0x426c50,_0xf177e6,!![]);}catch(_0x59c1e3){return BPromise[_0x0f8c('0x2a')](_0x59c1e3);}return _0x426c50[_0x0f8c('0x2b')]();};}function saveUpdates(_0x310bf9,_0x686bee){return function(_0x43a463){if(_0x43a463){return _0x43a463[_0x0f8c('0x2c')](_0x310bf9)[_0x0f8c('0x2d')](function(_0x389b6a){return _0x389b6a;});}return null;};}function removeEntity(_0x51d443,_0xae9434){return function(_0x34407){if(_0x34407){return _0x34407[_0x0f8c('0x2e')]()[_0x0f8c('0x2d')](function(){var _0x13a8aa=_0x34407[_0x0f8c('0x2f')]({'plain':!![]});var _0x31a1e6='Plugins';return db['UserProfileResource'][_0x0f8c('0x2e')]({'where':{'type':_0x31a1e6,'resourceId':_0x13a8aa['id']}})[_0x0f8c('0x2d')](function(){return _0x34407;});})[_0x0f8c('0x2d')](function(){_0x51d443['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fa3a6,_0x3c91bf){return function(_0x2f3f40){if(!_0x2f3f40){_0x4fa3a6[_0x0f8c('0x20')](0x194);}return _0x2f3f40;};}function handleError(_0x1c4732,_0x4bbaa8){_0x4bbaa8=_0x4bbaa8||0x1f4;return function(_0x1f5429){logger[_0x0f8c('0x30')](_0x1f5429[_0x0f8c('0x31')]);if(_0x1f5429['name']){delete _0x1f5429[_0x0f8c('0x32')];}_0x1c4732['status'](_0x4bbaa8)['send'](_0x1f5429);};}exports['index']=function(_0x63b75e,_0x28c482){var _0x284f66={},_0x1ff8e7={},_0x19c0df={'count':0x0,'rows':[]};var _0x330bad=_[_0x0f8c('0x33')](db[_0x0f8c('0x34')][_0x0f8c('0x35')],function(_0x1f02ab){return{'name':_0x1f02ab[_0x0f8c('0x36')],'type':_0x1f02ab['type'][_0x0f8c('0x37')]};});_0x1ff8e7[_0x0f8c('0x38')]=_['map'](_0x330bad,_0x0f8c('0x32'));_0x1ff8e7[_0x0f8c('0x39')]=_[_0x0f8c('0x3a')](_0x63b75e['query']);_0x1ff8e7['filters']=_[_0x0f8c('0x3b')](_0x1ff8e7['model'],_0x1ff8e7['query']);_0x284f66['attributes']=_[_0x0f8c('0x3b')](_0x1ff8e7[_0x0f8c('0x38')],qs[_0x0f8c('0x3c')](_0x63b75e[_0x0f8c('0x39')]['fields']));_0x284f66[_0x0f8c('0x3d')]=_0x284f66['attributes'][_0x0f8c('0x3e')]?_0x284f66[_0x0f8c('0x3d')]:_0x1ff8e7[_0x0f8c('0x38')];if(!_0x63b75e[_0x0f8c('0x39')][_0x0f8c('0x3f')]('nolimit')){_0x284f66[_0x0f8c('0x25')]=qs[_0x0f8c('0x25')](_0x63b75e[_0x0f8c('0x39')][_0x0f8c('0x25')]);_0x284f66[_0x0f8c('0x24')]=qs[_0x0f8c('0x24')](_0x63b75e[_0x0f8c('0x39')][_0x0f8c('0x24')]);}_0x284f66[_0x0f8c('0x40')]=qs[_0x0f8c('0x41')](_0x63b75e[_0x0f8c('0x39')][_0x0f8c('0x41')]);_0x284f66[_0x0f8c('0x42')]=qs[_0x0f8c('0x43')](_[_0x0f8c('0x44')](_0x63b75e[_0x0f8c('0x39')],_0x1ff8e7[_0x0f8c('0x43')]),_0x330bad);if(_0x63b75e[_0x0f8c('0x39')][_0x0f8c('0x45')]){_0x284f66[_0x0f8c('0x42')]=_[_0x0f8c('0x46')](_0x284f66['where'],{'$or':_[_0x0f8c('0x33')](_0x330bad,function(_0x41184e){if(_0x41184e['type']!==_0x0f8c('0x47')){var _0x18291e={};_0x18291e[_0x41184e[_0x0f8c('0x32')]]={'$like':'%'+_0x63b75e['query'][_0x0f8c('0x45')]+'%'};return _0x18291e;}})});}_0x284f66=_[_0x0f8c('0x46')]({},_0x284f66,_0x63b75e[_0x0f8c('0x48')]);var _0x4010a4={'where':_0x284f66[_0x0f8c('0x42')]};return db[_0x0f8c('0x34')][_0x0f8c('0x23')](_0x4010a4)['then'](function(_0x34c339){_0x19c0df['count']=_0x34c339;if(_0x63b75e[_0x0f8c('0x39')][_0x0f8c('0x49')]){_0x284f66[_0x0f8c('0x4a')]=[{'all':!![]}];}return db[_0x0f8c('0x34')][_0x0f8c('0x4b')](_0x284f66);})[_0x0f8c('0x2d')](function(_0x1a257d){_0x19c0df['rows']=_0x1a257d;return _0x19c0df;})[_0x0f8c('0x2d')](respondWithFilteredResult(_0x28c482,_0x284f66))[_0x0f8c('0x4c')](handleError(_0x28c482,null));};exports[_0x0f8c('0x4d')]=function(_0x4438ad,_0x12f8bd){var _0x4c9197={'raw':!![],'where':{'id':_0x4438ad[_0x0f8c('0x4e')]['id']}},_0x56f81e={};_0x56f81e[_0x0f8c('0x38')]=_[_0x0f8c('0x3a')](db['Plugin'][_0x0f8c('0x35')]);_0x56f81e[_0x0f8c('0x39')]=_[_0x0f8c('0x3a')](_0x4438ad[_0x0f8c('0x39')]);_0x56f81e['filters']=_['intersection'](_0x56f81e[_0x0f8c('0x38')],_0x56f81e[_0x0f8c('0x39')]);_0x4c9197['attributes']=_[_0x0f8c('0x3b')](_0x56f81e[_0x0f8c('0x38')],qs[_0x0f8c('0x3c')](_0x4438ad[_0x0f8c('0x39')][_0x0f8c('0x3c')]));_0x4c9197[_0x0f8c('0x3d')]=_0x4c9197['attributes'][_0x0f8c('0x3e')]?_0x4c9197['attributes']:_0x56f81e[_0x0f8c('0x38')];if(_0x4438ad[_0x0f8c('0x39')][_0x0f8c('0x49')]){_0x4c9197[_0x0f8c('0x4a')]=[{'all':!![]}];}_0x4c9197=_['merge']({},_0x4c9197,_0x4438ad[_0x0f8c('0x48')]);return db['Plugin']['find'](_0x4c9197)[_0x0f8c('0x2d')](handleEntityNotFound(_0x12f8bd,null))[_0x0f8c('0x2d')](respondWithResult(_0x12f8bd,null))[_0x0f8c('0x4c')](handleError(_0x12f8bd,null));};exports[_0x0f8c('0x4f')]=function(_0x4b2993,_0x4f2cb9,_0x35c87c){return db[_0x0f8c('0x34')][_0x0f8c('0x50')]({'where':{'id':_0x4b2993[_0x0f8c('0x4e')]['id']},'attributes':[_0x0f8c('0x32'),_0x0f8c('0x9')],'raw':!![]})[_0x0f8c('0x2d')](handleEntityNotFound(_0x4f2cb9,null))[_0x0f8c('0x2d')](function(_0x55921d){if(_0x55921d){var _0xf963d2=path[_0x0f8c('0x51')](config[_0x0f8c('0x52')],_0x0f8c('0x53'),util[_0x0f8c('0x54')](_0x0f8c('0x55'),path['basename'](_0x55921d[_0x0f8c('0x9')])));var _0x152e3b=fs[_0x0f8c('0x56')](_0xf963d2);var _0x150108=archiver(_0x0f8c('0x57'),{'zlib':{'level':0x9}});_0x150108['on'](_0x0f8c('0x58'),function(_0x584675){if(_0x584675[_0x0f8c('0x59')]==='ENOENT'){logger[_0x0f8c('0x30')](_0x584675);}else{throw new db[(_0x0f8c('0x5a'))][(_0x0f8c('0x5b'))](_0x0f8c('0x5c'));}});_0x150108['on'](_0x0f8c('0x30'),function(_0x2c360e){throw new db[(_0x0f8c('0x5a'))][(_0x0f8c('0x5b'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x150108[_0x0f8c('0x5d')](_0x152e3b);_0x150108[_0x0f8c('0x5e')](_0x0f8c('0x5f'),{'cwd':path[_0x0f8c('0x51')](config[_0x0f8c('0x52')],_0x0f8c('0x53'),path[_0x0f8c('0x60')](_0x55921d[_0x0f8c('0x9')])),'ignore':[path['join'](path[_0x0f8c('0x61')](_0x55921d[_0x0f8c('0x9')]),_0x0f8c('0x62')),path['join'](path['basename'](_0x55921d[_0x0f8c('0x9')]),_0x0f8c('0x63'))],'nodir':!![]})[_0x0f8c('0x64')]();_0x152e3b['on'](_0x0f8c('0x65'),function(){if(!fs['existsSync'](_0xf963d2)){throw new db[(_0x0f8c('0x5a'))][(_0x0f8c('0x5b'))](_0x0f8c('0x66'));}return _0x4f2cb9['download'](_0xf963d2,util[_0x0f8c('0x54')]('%s.zip',path[_0x0f8c('0x61')](_0x55921d[_0x0f8c('0x9')])),function(_0x3d29fe){if(_0x3d29fe){throw new db[(_0x0f8c('0x5a'))]['Error'](_0x0f8c('0x67'));}fs['unlinkSync'](_0xf963d2);logger['info'](_0x0f8c('0x68'));logger[_0x0f8c('0x69')](_0x0f8c('0x6a'));});});}return null;})['catch'](handleError(_0x4f2cb9,null));};exports[_0x0f8c('0x6b')]=function(_0x3397ca,_0x16958a,_0x4b8b3c){var _0x58e76e=path[_0x0f8c('0x61')](_0x3397ca['file']['filename'],path[_0x0f8c('0x6c')](_0x3397ca[_0x0f8c('0x6d')]['filename']));var _0x332e25=path[_0x0f8c('0x51')](config['root'],_0x0f8c('0x53'),_0x3397ca[_0x0f8c('0x6d')][_0x0f8c('0x6e')]);var _0x185e31=path[_0x0f8c('0x51')](config[_0x0f8c('0x52')],_0x0f8c('0x53'),_0x58e76e);logger[_0x0f8c('0x69')](_0x0f8c('0x6f'),_0x332e25);logger[_0x0f8c('0x69')](_0x0f8c('0x70'),_0x185e31);try{fs['chmodSync'](_0x332e25,parseInt(_0x0f8c('0x71'),0x8));extract(_0x332e25,{'dir':_0x185e31},function(_0x1a3c9e){if(_0x1a3c9e){logger[_0x0f8c('0x30')](_0x1a3c9e);handleError(_0x1a3c9e,!![]);};var _0x67b373=fs[_0x0f8c('0x72')](_0x185e31);if(_0x67b373['length']>0x1){removeReferences(_0x332e25,_0x185e31);logger[_0x0f8c('0x30')]('Invalid\x20plugin\x20structure');return _0x4b8b3c(new Error(_0x0f8c('0x73')));}var _0x1d7c68=fs['lstatSync'](path[_0x0f8c('0x51')](_0x185e31,_0x67b373[0x0]));if(_0x1d7c68[_0x0f8c('0x74')]()){removeReferences(_0x332e25,_0x185e31);logger[_0x0f8c('0x30')](_0x0f8c('0x73'));return _0x4b8b3c(new Error('Invalid\x20plugin\x20structure'));}if(_0x1d7c68[_0x0f8c('0x75')]()){var _0xbe5f4=fs['readdirSync'](path[_0x0f8c('0x51')](_0x185e31,_0x67b373[0x0]));if(_0xbe5f4[_0x0f8c('0x3e')]===0x0){removeReferences(_0x332e25,_0x185e31);logger[_0x0f8c('0x30')]('Invalid\x20plugin\x20structure');return _0x4b8b3c(new Error(_0x0f8c('0x73')));}var _0x455f43=_0xbe5f4[_0x0f8c('0x76')](function(_0x37c772){return _0x37c772===_0x0f8c('0x77');});if(!_0x455f43){return _0x4b8b3c(new Error(_0x0f8c('0x78')));}var _0x881f66=fs[_0x0f8c('0x79')](path['join'](_0x185e31,_0x67b373[0x0],_0x0f8c('0x77')));var _0x925531=JSON[_0x0f8c('0x7a')](_0x881f66);if(_0x0f8c('0x7b')==typeof _0x925531['name']){return _0x4b8b3c(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x0f8c('0x7b')==typeof _0x925531['type']){return _0x4b8b3c(new Error(_0x0f8c('0x7c')));}if(_0x0f8c('0x7b')==typeof _0x925531['version']){return _0x4b8b3c(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x0f8c('0x7b')==typeof _0x925531[_0x0f8c('0x7d')]){return _0x4b8b3c(new Error(_0x0f8c('0x7e')));}if(_0x925531['type']===_0x0f8c('0x7f')){if(_0x0f8c('0x7b')==typeof _0x925531[_0x0f8c('0x7d')][_0x0f8c('0x80')]){return _0x4b8b3c(new Error(_0x0f8c('0x81')));}if('undefined'==typeof _0x925531[_0x0f8c('0x7d')][_0x0f8c('0x80')]['admin']&&_0x0f8c('0x7b')==typeof _0x925531[_0x0f8c('0x7d')][_0x0f8c('0x80')][_0x0f8c('0x82')]){return _0x4b8b3c(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x925531[_0x0f8c('0x83')]===_0x0f8c('0x84')){if(_0x0f8c('0x7b')==typeof _0x925531[_0x0f8c('0x7d')][_0x0f8c('0x85')]){return _0x4b8b3c(new Error(_0x0f8c('0x86')));}if(_0x0f8c('0x7b')==typeof _0x925531[_0x0f8c('0x7d')][_0x0f8c('0x87')]){return _0x4b8b3c(new Error(_0x0f8c('0x88')));}}else{return _0x4b8b3c(new Error(_0x0f8c('0x89')));}var _0x395269=_0x925531[_0x0f8c('0x32')];var _0x334213=_0x925531[_0x0f8c('0x8a')];var _0x16889f=_0x925531[_0x0f8c('0x83')];var _0x114183=_0x925531['sidebar']?_0x925531[_0x0f8c('0x8b')]:_0x0f8c('0x8c');var _0x343156=_0x925531['icon']?_0x925531[_0x0f8c('0x8d')]:_0x0f8c('0x8e');var _0x1818f3='';var _0xf8d0aa='';var _0x142759='';var _0x4b65b2='';var _0x7e108c=_0x925531['version'];if(_0x16889f===_0x0f8c('0x7f')){if(_0x0f8c('0x7b')!=typeof _0x925531['parameters'][_0x0f8c('0x80')][_0x0f8c('0x8f')]){var _0x141bf7=_0x925531[_0x0f8c('0x7d')][_0x0f8c('0x80')][_0x0f8c('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0x0f8c('0x90')](_0x141bf7)){_0x1818f3=path[_0x0f8c('0x51')]('plugins',_0x58e76e,_0x67b373[0x0],_0x141bf7);}else{_0x1818f3=_0x141bf7;}}else{logger['info'](_0x0f8c('0x91'));}if('undefined'!=typeof _0x925531['parameters']['views']['agent']){var _0x5b2c8f=_0x925531[_0x0f8c('0x7d')][_0x0f8c('0x80')][_0x0f8c('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x0f8c('0x90')](_0x5b2c8f)){_0xf8d0aa=path[_0x0f8c('0x51')](_0x0f8c('0x92'),_0x58e76e,_0x67b373[0x0],_0x5b2c8f);}else{_0xf8d0aa=_0x5b2c8f;}}else{logger[_0x0f8c('0x69')](_0x0f8c('0x93'));}}else if(_0x16889f==='script'){_0x142759=_0x925531[_0x0f8c('0x7d')][_0x0f8c('0x85')];_0x4b65b2=_0x925531[_0x0f8c('0x7d')][_0x0f8c('0x87')];if('undefined'!=typeof _0x925531[_0x0f8c('0x7d')]['views']){if(_0x0f8c('0x7b')!=typeof _0x925531[_0x0f8c('0x7d')][_0x0f8c('0x80')][_0x0f8c('0x8f')]){var _0x141bf7=_0x925531['parameters'][_0x0f8c('0x80')][_0x0f8c('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0x0f8c('0x90')](_0x141bf7)){_0x1818f3=path[_0x0f8c('0x51')]('plugins',_0x58e76e,_0x67b373[0x0],_0x141bf7);}else{_0x1818f3=_0x141bf7;}}if(_0x0f8c('0x7b')!=typeof _0x925531[_0x0f8c('0x7d')][_0x0f8c('0x80')][_0x0f8c('0x82')]){var _0x5b2c8f=_0x925531['parameters'][_0x0f8c('0x80')][_0x0f8c('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x0f8c('0x90')](_0x5b2c8f)){_0xf8d0aa=path[_0x0f8c('0x51')](_0x0f8c('0x92'),_0x58e76e,_0x67b373[0x0],_0x5b2c8f);}else{_0xf8d0aa=_0x5b2c8f;}}}}var _0x34f9d2={'name':_0x395269,'description':_0x334213,'path':path['join'](_0x58e76e,_0x67b373[0x0]),'type':_0x16889f,'sidebar':_0x114183,'icon':_0x343156,'adminUrl':_0x1818f3,'agentUrl':_0xf8d0aa,'scriptName':_0x142759,'scriptPath':_0x4b65b2,'version':_0x7e108c};removeReferences(_0x332e25,null);return db['Plugin']['create'](_0x34f9d2)['then'](function(_0x5f2416){var _0x902de={'role':_0x3397ca['body'][_0x0f8c('0x94')],'userProfileId':_0x3397ca[_0x0f8c('0x95')]['userProfileId']};if(!_0x902de)throw new Error(_0x0f8c('0x96'));if(_0x902de[_0x0f8c('0x94')]===_0x0f8c('0x97')){var _0x3e6387=_0x5f2416[_0x0f8c('0x2f')]({'plain':!![]});return db[_0x0f8c('0x98')][_0x0f8c('0x50')]({'where':{'name':'Plugins','userProfileId':_0x902de[_0x0f8c('0x99')]},'raw':!![]})[_0x0f8c('0x2d')](function(_0x41f7a9){if(_0x41f7a9&&_0x41f7a9[_0x0f8c('0x9a')]===0x0){return db[_0x0f8c('0x9b')]['create']({'name':_0x3e6387['name'],'resourceId':_0x3e6387['id'],'type':_0x41f7a9[_0x0f8c('0x32')],'sectionId':_0x41f7a9['id']},{})[_0x0f8c('0x2d')](function(){return _0x5f2416;});}else{return _0x5f2416;}})[_0x0f8c('0x4c')](function(_0x554f36){logger['error'](_0x0f8c('0x9c'),_0x554f36);throw _0x554f36;});}return _0x5f2416;})[_0x0f8c('0x2d')](respondWithResult(_0x16958a,null))[_0x0f8c('0x4c')](handleError(_0x16958a,null));}});}catch(_0xfee83d){_0x16958a[_0x0f8c('0x21')](0x1f4)[_0x0f8c('0x9d')](_0xfee83d);}};function removeReferences(_0x25c543,_0x1e54d5){try{if(_0x25c543){fs[_0x0f8c('0x9e')](_0x25c543);logger[_0x0f8c('0x69')]('Zip\x20archive\x20removed');}if(_0x1e54d5){rimraf(_0x1e54d5,function(){});logger[_0x0f8c('0x69')](_0x0f8c('0x9f'));}}catch(_0x468e24){logger['error'](_0x468e24);}}exports[_0x0f8c('0x2c')]=function(_0x42aa54,_0x3d211d,_0x5867c0){return db[_0x0f8c('0x34')][_0x0f8c('0x50')]({'where':{'id':_0x42aa54[_0x0f8c('0x4e')]['id']}})[_0x0f8c('0x2d')](handleEntityNotFound(_0x3d211d,null))['then'](saveUpdates(_0x42aa54[_0x0f8c('0x95')],null))[_0x0f8c('0x2d')](respondWithResult(_0x3d211d,null))[_0x0f8c('0x4c')](handleError(_0x3d211d,null));};exports['delete']=function(_0x6608f,_0x11e550,_0x4a97ba){return db['Plugin'][_0x0f8c('0x50')]({'where':{'id':_0x6608f[_0x0f8c('0x4e')]['id']}})[_0x0f8c('0x2d')](function(_0x39ade1){if(_0x39ade1){return _0x39ade1['destroy']();}})[_0x0f8c('0x2d')](function(_0x187404){rimraf(path['join'](config[_0x0f8c('0x52')],_0x0f8c('0x53'),path[_0x0f8c('0x60')](_0x187404[_0x0f8c('0x9')])),function(){});return _0x187404;})[_0x0f8c('0x2d')](handleEntityNotFound(_0x11e550,null))[_0x0f8c('0x2d')](respondWithStatusCode(_0x11e550,null))[_0x0f8c('0x4c')](handleError(_0x11e550,null));};exports[_0x0f8c('0xa0')]=function(_0x58b903,_0x34570e,_0x4b48a){return BPromise['resolve']()[_0x0f8c('0x2d')](function(){if(!_0x58b903[_0x0f8c('0x39')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x58b903[_0x0f8c('0x39')][_0x0f8c('0xa1')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x270a0b=_0x58b903[_0x0f8c('0x39')][_0x0f8c('0xa2')]?_0x58b903['query'][_0x0f8c('0xa2')]+':'+_0x58b903[_0x0f8c('0x39')][_0x0f8c('0xa1')]:_0x0f8c('0xa3')+_0x58b903[_0x0f8c('0x39')]['port'];var _0x114a18=_0x58b903[_0x0f8c('0x39')][_0x0f8c('0x28')]?_0x58b903[_0x0f8c('0x39')][_0x0f8c('0x28')]:!![];var _0x14e0f3=_0x58b903[_0x0f8c('0x39')][_0x0f8c('0xa4')]?_0x58b903['query'][_0x0f8c('0xa4')]:null;var _0xb5b24={'method':_0x58b903[_0x0f8c('0xa5')],'uri':util[_0x0f8c('0x54')](_0x0f8c('0xa6'),_0x270a0b,_0x58b903[_0x0f8c('0x39')][_0x0f8c('0x9')]),'json':_0x114a18,'resolveWithFullResponse':!![],'encoding':_0x14e0f3,'qs':_0x58b903[_0x0f8c('0x39')]};if(_0x58b903['headers']){_0xb5b24[_0x0f8c('0xa7')]=_0x58b903[_0x0f8c('0xa7')];if(_0xb5b24['headers'][_0x0f8c('0xa8')]){delete _0xb5b24[_0x0f8c('0xa7')][_0x0f8c('0xa8')];}}if(_0xb5b24['headers']['content-type']){delete _0xb5b24[_0x0f8c('0xa7')][_0x0f8c('0xa9')];}return rp(_0xb5b24);})[_0x0f8c('0x2d')](function(_0x40018a){if(_0x40018a){_0x34570e[_0x0f8c('0x26')](_0x40018a[_0x0f8c('0xa7')]);logger[_0x0f8c('0x69')](_0x40018a[_0x0f8c('0x95')]);if(_[_0x0f8c('0xaa')](_0x58b903[_0x0f8c('0x39')][_0x0f8c('0x9')],'download')&&_0x40018a[_0x0f8c('0xab')]==0x1f4){return _0x34570e[_0x0f8c('0x20')](_0x40018a[_0x0f8c('0xab')]);}else{return _0x34570e['status'](_0x40018a[_0x0f8c('0xab')])['send'](_0x40018a['body']);}}else{return _0x34570e[_0x0f8c('0x20')](0xc8);}})['catch'](handleError(_0x34570e,null));};exports['webhookPost']=function(_0x248472,_0x25d89a,_0x26e122){return BPromise[_0x0f8c('0xac')]()[_0x0f8c('0x2d')](function(){if(!_0x248472['query'][_0x0f8c('0x9')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x248472['query'][_0x0f8c('0xa1')]){throw new Error(_0x0f8c('0xad'));}var _0x4d9d48=_0x248472[_0x0f8c('0x39')][_0x0f8c('0xa2')]?_0x248472[_0x0f8c('0x39')][_0x0f8c('0xa2')]+':'+_0x248472[_0x0f8c('0x39')]['port']:'http://localhost:'+_0x248472[_0x0f8c('0x39')][_0x0f8c('0xa1')];var _0x367dfc=_0x248472[_0x0f8c('0x39')][_0x0f8c('0x28')]?_0x248472[_0x0f8c('0x39')][_0x0f8c('0x28')]:!![];var _0x1bcd20=_0x248472[_0x0f8c('0x39')][_0x0f8c('0xa4')]?_0x248472[_0x0f8c('0x39')][_0x0f8c('0xa4')]:null;var _0x5aa8eb={'method':_0x248472[_0x0f8c('0xa5')],'uri':util[_0x0f8c('0x54')]('%s%s',_0x4d9d48,_0x248472[_0x0f8c('0x39')]['path']),'json':_0x367dfc,'resolveWithFullResponse':!![],'encoding':_0x1bcd20,'body':_0x248472[_0x0f8c('0x95')]};if(_0x248472['headers']){_0x5aa8eb[_0x0f8c('0xa7')]=_0x248472[_0x0f8c('0xa7')];if(_0x5aa8eb[_0x0f8c('0xa7')][_0x0f8c('0xa8')]){delete _0x5aa8eb[_0x0f8c('0xa7')][_0x0f8c('0xa8')];}}if(_0x5aa8eb[_0x0f8c('0xa7')][_0x0f8c('0xa9')]){delete _0x5aa8eb[_0x0f8c('0xa7')][_0x0f8c('0xa9')];}return rp(_0x5aa8eb);})[_0x0f8c('0x2d')](function(_0x564163){if(_0x564163){_0x25d89a[_0x0f8c('0x26')](_0x564163[_0x0f8c('0xa7')]);logger['info'](_0x564163[_0x0f8c('0x95')]);return _0x25d89a[_0x0f8c('0x21')](_0x564163['statusCode'])[_0x0f8c('0x9d')](_0x564163['body']);}else{return _0x25d89a['sendStatus'](0xc8);}})[_0x0f8c('0x4c')](handleError(_0x25d89a,null));}; \ No newline at end of file +var _0x7409=['userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','%s%s','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','ejs','lodash','jsforce','desk.js','to-csv','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','update','destroy','then','get','UserProfileResource','error','stack','name','index','Plugin','rawAttributes','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','map','options','includeAll','findAll','catch','show','params','intersection','length','download','path','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','dirname','attachments/**/*','finalize','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','type','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon','icon-apps','version','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','agent','create','body','role','user','UserProfileSection','find'];(function(_0xa6180a,_0x508ff9){var _0x10f626=function(_0x1bf882){while(--_0x1bf882){_0xa6180a['push'](_0xa6180a['shift']());}};_0x10f626(++_0x508ff9);}(_0x7409,0x15d));var _0x9740=function(_0x38a3d6,_0x52e305){_0x38a3d6=_0x38a3d6-0x0;var _0x3768d7=_0x7409[_0x38a3d6];return _0x3768d7;};'use strict';var pdf=require(_0x9740('0x0'));var emlformat=require(_0x9740('0x1'));var rimraf=require(_0x9740('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9740('0x3'));var moment=require(_0x9740('0x4'));var BPromise=require(_0x9740('0x5'));var Mustache=require(_0x9740('0x6'));var util=require(_0x9740('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9740('0x8'));var fs=require('fs');var _=require(_0x9740('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9740('0xa'));var deskjs=require(_0x9740('0xb'));var toCsv=require(_0x9740('0xc'));var querystring=require(_0x9740('0xd'));var Papa=require('papaparse');var extract=require(_0x9740('0xe'));var rimraf=require('rimraf');var archiver=require(_0x9740('0xf'));var Redis=require(_0x9740('0x10'));var authService=require(_0x9740('0x11'));var qs=require(_0x9740('0x12'));var as=require(_0x9740('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9740('0x14'))('api');var utils=require(_0x9740('0x15'));var config=require(_0x9740('0x16'));var licenseUtil=require(_0x9740('0x17'));var db=require(_0x9740('0x18'))['db'];config[_0x9740('0x19')]=_['defaults'](config[_0x9740('0x19')],{'host':_0x9740('0x1a'),'port':0x18eb});var socket=require(_0x9740('0x1b'))(new Redis(config[_0x9740('0x19')]));require('./plugin.socket')[_0x9740('0x1c')](socket);function respondWithStatusCode(_0x286671,_0x4b3827){_0x4b3827=_0x4b3827||0xcc;return function(_0x4bc1ec){if(_0x4bc1ec){return _0x286671[_0x9740('0x1d')](_0x4b3827);}return _0x286671[_0x9740('0x1e')](_0x4b3827)[_0x9740('0x1f')]();};}function respondWithResult(_0x43bb35,_0x30c1f1){_0x30c1f1=_0x30c1f1||0xc8;return function(_0x53fe37){if(_0x53fe37){return _0x43bb35[_0x9740('0x1e')](_0x30c1f1)['json'](_0x53fe37);}};}function respondWithFilteredResult(_0x27a7a0,_0x162d5f){return function(_0x3f458f){if(_0x3f458f){var _0x2168a8=_0x3f458f[_0x9740('0x20')],_0x4c361c=_0x162d5f['offset'],_0x3ccc99=_0x162d5f[_0x9740('0x21')]+_0x162d5f[_0x9740('0x22')],_0x38ac62;if(_0x3ccc99>=_0x2168a8){_0x3ccc99=_0x2168a8;_0x38ac62=0xc8;}else{_0x38ac62=0xce;}_0x27a7a0['status'](_0x38ac62);return _0x27a7a0['set'](_0x9740('0x23'),_0x4c361c+'-'+_0x3ccc99+'/'+_0x2168a8)[_0x9740('0x24')](_0x3f458f);}return null;};}function patchUpdates(_0x4c99cf){return function(_0x10d46d){try{jsonpatch[_0x9740('0x25')](_0x10d46d,_0x4c99cf,!![]);}catch(_0x3ef127){return BPromise['reject'](_0x3ef127);}return _0x10d46d['save']();};}function saveUpdates(_0x130d65,_0x699837){return function(_0x29e12c){if(_0x29e12c){return _0x29e12c[_0x9740('0x26')](_0x130d65)['then'](function(_0x20d16a){return _0x20d16a;});}return null;};}function removeEntity(_0x29cbd3,_0x5c3de6){return function(_0x5a50ef){if(_0x5a50ef){return _0x5a50ef[_0x9740('0x27')]()[_0x9740('0x28')](function(){var _0x4316c4=_0x5a50ef[_0x9740('0x29')]({'plain':!![]});var _0x47bfa1='Plugins';return db[_0x9740('0x2a')]['destroy']({'where':{'type':_0x47bfa1,'resourceId':_0x4316c4['id']}})[_0x9740('0x28')](function(){return _0x5a50ef;});})['then'](function(){_0x29cbd3[_0x9740('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d7656,_0x1d96ad){return function(_0x282f2d){if(!_0x282f2d){_0x1d7656[_0x9740('0x1d')](0x194);}return _0x282f2d;};}function handleError(_0x3987bd,_0x18800e){_0x18800e=_0x18800e||0x1f4;return function(_0x174dc9){logger[_0x9740('0x2b')](_0x174dc9[_0x9740('0x2c')]);if(_0x174dc9['name']){delete _0x174dc9[_0x9740('0x2d')];}_0x3987bd[_0x9740('0x1e')](_0x18800e)['send'](_0x174dc9);};}exports[_0x9740('0x2e')]=function(_0x284ec2,_0x4edc41){var _0x1a8ba8={},_0x436f8f={},_0x4b9ad0={'count':0x0,'rows':[]};var _0x3f1d4d=_['map'](db[_0x9740('0x2f')][_0x9740('0x30')],function(_0x521a87){return{'name':_0x521a87[_0x9740('0x31')],'type':_0x521a87['type']['key']};});_0x436f8f[_0x9740('0x32')]=_['map'](_0x3f1d4d,'name');_0x436f8f[_0x9740('0x33')]=_[_0x9740('0x34')](_0x284ec2[_0x9740('0x33')]);_0x436f8f[_0x9740('0x35')]=_['intersection'](_0x436f8f['model'],_0x436f8f[_0x9740('0x33')]);_0x1a8ba8['attributes']=_['intersection'](_0x436f8f[_0x9740('0x32')],qs[_0x9740('0x36')](_0x284ec2[_0x9740('0x33')][_0x9740('0x36')]));_0x1a8ba8['attributes']=_0x1a8ba8[_0x9740('0x37')]['length']?_0x1a8ba8[_0x9740('0x37')]:_0x436f8f[_0x9740('0x32')];if(!_0x284ec2[_0x9740('0x33')][_0x9740('0x38')]('nolimit')){_0x1a8ba8[_0x9740('0x22')]=qs[_0x9740('0x22')](_0x284ec2[_0x9740('0x33')][_0x9740('0x22')]);_0x1a8ba8[_0x9740('0x21')]=qs['offset'](_0x284ec2[_0x9740('0x33')][_0x9740('0x21')]);}_0x1a8ba8[_0x9740('0x39')]=qs[_0x9740('0x3a')](_0x284ec2[_0x9740('0x33')][_0x9740('0x3a')]);_0x1a8ba8[_0x9740('0x3b')]=qs[_0x9740('0x35')](_['pick'](_0x284ec2[_0x9740('0x33')],_0x436f8f[_0x9740('0x35')]),_0x3f1d4d);if(_0x284ec2[_0x9740('0x33')][_0x9740('0x3c')]){_0x1a8ba8[_0x9740('0x3b')]=_[_0x9740('0x3d')](_0x1a8ba8[_0x9740('0x3b')],{'$or':_[_0x9740('0x3e')](_0x3f1d4d,function(_0x35aa75){if(_0x35aa75['type']!=='VIRTUAL'){var _0x52b721={};_0x52b721[_0x35aa75[_0x9740('0x2d')]]={'$like':'%'+_0x284ec2[_0x9740('0x33')][_0x9740('0x3c')]+'%'};return _0x52b721;}})});}_0x1a8ba8=_[_0x9740('0x3d')]({},_0x1a8ba8,_0x284ec2[_0x9740('0x3f')]);var _0x541ac0={'where':_0x1a8ba8['where']};return db[_0x9740('0x2f')]['count'](_0x541ac0)[_0x9740('0x28')](function(_0x4f7e63){_0x4b9ad0[_0x9740('0x20')]=_0x4f7e63;if(_0x284ec2['query'][_0x9740('0x40')]){_0x1a8ba8['include']=[{'all':!![]}];}return db[_0x9740('0x2f')][_0x9740('0x41')](_0x1a8ba8);})[_0x9740('0x28')](function(_0x19c822){_0x4b9ad0['rows']=_0x19c822;return _0x4b9ad0;})['then'](respondWithFilteredResult(_0x4edc41,_0x1a8ba8))[_0x9740('0x42')](handleError(_0x4edc41,null));};exports[_0x9740('0x43')]=function(_0x3168d0,_0x591468){var _0x312b6d={'raw':!![],'where':{'id':_0x3168d0[_0x9740('0x44')]['id']}},_0x4f98f6={};_0x4f98f6[_0x9740('0x32')]=_[_0x9740('0x34')](db[_0x9740('0x2f')][_0x9740('0x30')]);_0x4f98f6[_0x9740('0x33')]=_[_0x9740('0x34')](_0x3168d0[_0x9740('0x33')]);_0x4f98f6['filters']=_[_0x9740('0x45')](_0x4f98f6[_0x9740('0x32')],_0x4f98f6[_0x9740('0x33')]);_0x312b6d[_0x9740('0x37')]=_[_0x9740('0x45')](_0x4f98f6[_0x9740('0x32')],qs[_0x9740('0x36')](_0x3168d0['query'][_0x9740('0x36')]));_0x312b6d['attributes']=_0x312b6d[_0x9740('0x37')][_0x9740('0x46')]?_0x312b6d['attributes']:_0x4f98f6['model'];if(_0x3168d0[_0x9740('0x33')][_0x9740('0x40')]){_0x312b6d['include']=[{'all':!![]}];}_0x312b6d=_['merge']({},_0x312b6d,_0x3168d0[_0x9740('0x3f')]);return db['Plugin']['find'](_0x312b6d)[_0x9740('0x28')](handleEntityNotFound(_0x591468,null))[_0x9740('0x28')](respondWithResult(_0x591468,null))[_0x9740('0x42')](handleError(_0x591468,null));};exports[_0x9740('0x47')]=function(_0x42f15c,_0x3ae813,_0x1272d4){return db[_0x9740('0x2f')]['find']({'where':{'id':_0x42f15c[_0x9740('0x44')]['id']},'attributes':[_0x9740('0x2d'),_0x9740('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x3ae813,null))[_0x9740('0x28')](function(_0x24a1db){if(_0x24a1db){var _0xea72ec=path[_0x9740('0x49')](config[_0x9740('0x4a')],_0x9740('0x4b'),util[_0x9740('0x4c')](_0x9740('0x4d'),path[_0x9740('0x4e')](_0x24a1db[_0x9740('0x48')])));var _0x163cb3=fs[_0x9740('0x4f')](_0xea72ec);var _0x46695d=archiver('zip',{'zlib':{'level':0x9}});_0x46695d['on'](_0x9740('0x50'),function(_0x37fa37){if(_0x37fa37[_0x9740('0x51')]===_0x9740('0x52')){logger[_0x9740('0x2b')](_0x37fa37);}else{throw new db[(_0x9740('0x53'))]['Error'](_0x9740('0x54'));}});_0x46695d['on'](_0x9740('0x2b'),function(_0x3dd8a1){throw new db['Sequelize'][(_0x9740('0x55'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x46695d[_0x9740('0x56')](_0x163cb3);_0x46695d[_0x9740('0x57')]('**/*',{'cwd':path[_0x9740('0x49')](config['root'],'server/files/plugins',path[_0x9740('0x58')](_0x24a1db[_0x9740('0x48')])),'ignore':[path[_0x9740('0x49')](path[_0x9740('0x4e')](_0x24a1db[_0x9740('0x48')]),'node_modules/**/*'),path[_0x9740('0x49')](path[_0x9740('0x4e')](_0x24a1db['path']),_0x9740('0x59'))],'nodir':!![]})[_0x9740('0x5a')]();_0x163cb3['on']('close',function(){if(!fs['existsSync'](_0xea72ec)){throw new db['Sequelize']['Error'](_0x9740('0x5b'));}return _0x3ae813['download'](_0xea72ec,util[_0x9740('0x4c')](_0x9740('0x4d'),path[_0x9740('0x4e')](_0x24a1db[_0x9740('0x48')])),function(_0x244642){if(_0x244642){throw new db[(_0x9740('0x53'))]['Error'](_0x9740('0x5c'));}fs['unlinkSync'](_0xea72ec);logger[_0x9740('0x5d')](_0x9740('0x5e'));logger['info']('Temporary\x20file\x20removed');});});}return null;})[_0x9740('0x42')](handleError(_0x3ae813,null));};exports[_0x9740('0x5f')]=function(_0x465803,_0x53fe96,_0x4c3f61){var _0x2bb12e=path[_0x9740('0x4e')](_0x465803[_0x9740('0x60')][_0x9740('0x61')],path[_0x9740('0x62')](_0x465803[_0x9740('0x60')][_0x9740('0x61')]));var _0x561ce1=path[_0x9740('0x49')](config[_0x9740('0x4a')],_0x9740('0x4b'),_0x465803['file']['filename']);var _0x326aeb=path[_0x9740('0x49')](config[_0x9740('0x4a')],'server/files/plugins',_0x2bb12e);logger[_0x9740('0x5d')]('Plugin\x20upload\x20filepath:\x20%s',_0x561ce1);logger[_0x9740('0x5d')](_0x9740('0x63'),_0x326aeb);try{fs[_0x9740('0x64')](_0x561ce1,parseInt('0777',0x8));extract(_0x561ce1,{'dir':_0x326aeb},function(_0x14d04f){if(_0x14d04f){logger['error'](_0x14d04f);handleError(_0x14d04f,!![]);};var _0x334750=fs[_0x9740('0x65')](_0x326aeb);if(_0x334750[_0x9740('0x46')]>0x1){removeReferences(_0x561ce1,_0x326aeb);logger['error']('Invalid\x20plugin\x20structure');return _0x4c3f61(new Error(_0x9740('0x66')));}var _0x29d4c2=fs[_0x9740('0x67')](path[_0x9740('0x49')](_0x326aeb,_0x334750[0x0]));if(_0x29d4c2[_0x9740('0x68')]()){removeReferences(_0x561ce1,_0x326aeb);logger[_0x9740('0x2b')](_0x9740('0x66'));return _0x4c3f61(new Error(_0x9740('0x66')));}if(_0x29d4c2[_0x9740('0x69')]()){var _0x3884a4=fs[_0x9740('0x65')](path[_0x9740('0x49')](_0x326aeb,_0x334750[0x0]));if(_0x3884a4[_0x9740('0x46')]===0x0){removeReferences(_0x561ce1,_0x326aeb);logger[_0x9740('0x2b')]('Invalid\x20plugin\x20structure');return _0x4c3f61(new Error('Invalid\x20plugin\x20structure'));}var _0x2292f6=_0x3884a4['some'](function(_0x1f894b){return _0x1f894b===_0x9740('0x6a');});if(!_0x2292f6){return _0x4c3f61(new Error(_0x9740('0x6b')));}var _0x207096=fs[_0x9740('0x6c')](path['join'](_0x326aeb,_0x334750[0x0],_0x9740('0x6a')));var _0x413fb6=JSON[_0x9740('0x6d')](_0x207096);if(_0x9740('0x6e')==typeof _0x413fb6[_0x9740('0x2d')]){return _0x4c3f61(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x9740('0x6e')==typeof _0x413fb6[_0x9740('0x6f')]){return _0x4c3f61(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x9740('0x6e')==typeof _0x413fb6['version']){return _0x4c3f61(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x413fb6[_0x9740('0x70')]){return _0x4c3f61(new Error(_0x9740('0x71')));}if(_0x413fb6[_0x9740('0x6f')]===_0x9740('0x72')){if(_0x9740('0x6e')==typeof _0x413fb6[_0x9740('0x70')][_0x9740('0x73')]){return _0x4c3f61(new Error(_0x9740('0x74')));}if(_0x9740('0x6e')==typeof _0x413fb6[_0x9740('0x70')]['views']['admin']&&'undefined'==typeof _0x413fb6[_0x9740('0x70')]['views']['agent']){return _0x4c3f61(new Error(_0x9740('0x75')));}}else if(_0x413fb6[_0x9740('0x6f')]===_0x9740('0x76')){if(_0x9740('0x6e')==typeof _0x413fb6['parameters'][_0x9740('0x77')]){return _0x4c3f61(new Error(_0x9740('0x78')));}if(_0x9740('0x6e')==typeof _0x413fb6[_0x9740('0x70')][_0x9740('0x79')]){return _0x4c3f61(new Error(_0x9740('0x7a')));}}else{return _0x4c3f61(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x3a4f5a=_0x413fb6[_0x9740('0x2d')];var _0x4316a5=_0x413fb6['description'];var _0x4a09f0=_0x413fb6[_0x9740('0x6f')];var _0xb497ae=_0x413fb6[_0x9740('0x7b')]?_0x413fb6['sidebar']:_0x9740('0x7c');var _0x30748f=_0x413fb6[_0x9740('0x7d')]?_0x413fb6[_0x9740('0x7d')]:_0x9740('0x7e');var _0x158827='';var _0x60c907='';var _0x2069fc='';var _0x39ddcb='';var _0x3b3c60=_0x413fb6[_0x9740('0x7f')];if(_0x4a09f0===_0x9740('0x72')){if(_0x9740('0x6e')!=typeof _0x413fb6['parameters'][_0x9740('0x73')]['admin']){var _0x53711f=_0x413fb6['parameters'][_0x9740('0x73')][_0x9740('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x9740('0x81')](_0x53711f)){_0x158827=path[_0x9740('0x49')](_0x9740('0x82'),_0x2bb12e,_0x334750[0x0],_0x53711f);}else{_0x158827=_0x53711f;}}else{logger[_0x9740('0x5d')](_0x9740('0x83'));}if('undefined'!=typeof _0x413fb6[_0x9740('0x70')][_0x9740('0x73')]['agent']){var _0x31a363=_0x413fb6[_0x9740('0x70')][_0x9740('0x73')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x9740('0x81')](_0x31a363)){_0x60c907=path['join'](_0x9740('0x82'),_0x2bb12e,_0x334750[0x0],_0x31a363);}else{_0x60c907=_0x31a363;}}else{logger[_0x9740('0x5d')](_0x9740('0x84'));}}else if(_0x4a09f0===_0x9740('0x76')){_0x2069fc=_0x413fb6[_0x9740('0x70')][_0x9740('0x77')];_0x39ddcb=_0x413fb6[_0x9740('0x70')]['scriptPath'];if(_0x9740('0x6e')!=typeof _0x413fb6['parameters'][_0x9740('0x73')]){if(_0x9740('0x6e')!=typeof _0x413fb6[_0x9740('0x70')][_0x9740('0x73')][_0x9740('0x80')]){var _0x53711f=_0x413fb6['parameters']['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x9740('0x81')](_0x53711f)){_0x158827=path[_0x9740('0x49')]('plugins',_0x2bb12e,_0x334750[0x0],_0x53711f);}else{_0x158827=_0x53711f;}}if(_0x9740('0x6e')!=typeof _0x413fb6[_0x9740('0x70')][_0x9740('0x73')][_0x9740('0x85')]){var _0x31a363=_0x413fb6[_0x9740('0x70')][_0x9740('0x73')][_0x9740('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x9740('0x81')](_0x31a363)){_0x60c907=path['join'](_0x9740('0x82'),_0x2bb12e,_0x334750[0x0],_0x31a363);}else{_0x60c907=_0x31a363;}}}}var _0x5e0b4b={'name':_0x3a4f5a,'description':_0x4316a5,'path':path[_0x9740('0x49')](_0x2bb12e,_0x334750[0x0]),'type':_0x4a09f0,'sidebar':_0xb497ae,'icon':_0x30748f,'adminUrl':_0x158827,'agentUrl':_0x60c907,'scriptName':_0x2069fc,'scriptPath':_0x39ddcb,'version':_0x3b3c60};removeReferences(_0x561ce1,null);return db[_0x9740('0x2f')][_0x9740('0x86')](_0x5e0b4b)[_0x9740('0x28')](function(_0x196db1){var _0x2efa5e={'role':_0x465803['body']['role'],'userProfileId':_0x465803[_0x9740('0x87')]['userProfileId']};if(!_0x2efa5e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2efa5e[_0x9740('0x88')]===_0x9740('0x89')){var _0x4b8b3b=_0x196db1[_0x9740('0x29')]({'plain':!![]});return db[_0x9740('0x8a')][_0x9740('0x8b')]({'where':{'name':'Plugins','userProfileId':_0x2efa5e[_0x9740('0x8c')]},'raw':!![]})['then'](function(_0x41c32b){if(_0x41c32b&&_0x41c32b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4b8b3b['name'],'resourceId':_0x4b8b3b['id'],'type':_0x41c32b[_0x9740('0x2d')],'sectionId':_0x41c32b['id']},{})[_0x9740('0x28')](function(){return _0x196db1;});}else{return _0x196db1;}})[_0x9740('0x42')](function(_0x1c54ca){logger['error'](_0x9740('0x8d'),_0x1c54ca);throw _0x1c54ca;});}return _0x196db1;})[_0x9740('0x28')](respondWithResult(_0x53fe96,null))[_0x9740('0x42')](handleError(_0x53fe96,null));}});}catch(_0x234b3b){_0x53fe96[_0x9740('0x1e')](0x1f4)[_0x9740('0x8e')](_0x234b3b);}};function removeReferences(_0x106193,_0x132d59){try{if(_0x106193){fs[_0x9740('0x8f')](_0x106193);logger['info'](_0x9740('0x90'));}if(_0x132d59){rimraf(_0x132d59,function(){});logger['info'](_0x9740('0x91'));}}catch(_0x2cda01){logger[_0x9740('0x2b')](_0x2cda01);}}exports[_0x9740('0x26')]=function(_0x2018e0,_0x43efe4,_0x2bc839){return db[_0x9740('0x2f')][_0x9740('0x8b')]({'where':{'id':_0x2018e0[_0x9740('0x44')]['id']}})[_0x9740('0x28')](handleEntityNotFound(_0x43efe4,null))[_0x9740('0x28')](saveUpdates(_0x2018e0[_0x9740('0x87')],null))[_0x9740('0x28')](respondWithResult(_0x43efe4,null))[_0x9740('0x42')](handleError(_0x43efe4,null));};exports[_0x9740('0x92')]=function(_0x395494,_0x216f40,_0x485ee5){return db[_0x9740('0x2f')][_0x9740('0x8b')]({'where':{'id':_0x395494[_0x9740('0x44')]['id']}})['then'](function(_0x2b5fda){if(_0x2b5fda){return _0x2b5fda[_0x9740('0x27')]();}})[_0x9740('0x28')](function(_0x3e028f){rimraf(path[_0x9740('0x49')](config[_0x9740('0x4a')],_0x9740('0x4b'),path['dirname'](_0x3e028f[_0x9740('0x48')])),function(){});return _0x3e028f;})[_0x9740('0x28')](handleEntityNotFound(_0x216f40,null))[_0x9740('0x28')](respondWithStatusCode(_0x216f40,null))['catch'](handleError(_0x216f40,null));};exports['webhookGet']=function(_0x11e79b,_0x55ceef,_0x4931c2){return BPromise[_0x9740('0x93')]()[_0x9740('0x28')](function(){if(!_0x11e79b['query'][_0x9740('0x48')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x11e79b[_0x9740('0x33')][_0x9740('0x94')]){throw new Error(_0x9740('0x95'));}var _0x566472=_0x11e79b[_0x9740('0x33')][_0x9740('0x96')]?_0x11e79b[_0x9740('0x33')][_0x9740('0x96')]+':'+_0x11e79b['query'][_0x9740('0x94')]:_0x9740('0x97')+_0x11e79b[_0x9740('0x33')][_0x9740('0x94')];var _0x577856=_0x11e79b['query']['json']?_0x11e79b['query'][_0x9740('0x24')]:!![];var _0x271d9d=_0x11e79b[_0x9740('0x33')]['encoding']?_0x11e79b[_0x9740('0x33')][_0x9740('0x98')]:null;var _0x54ef91={'method':_0x11e79b[_0x9740('0x99')],'uri':util[_0x9740('0x4c')]('%s%s',_0x566472,_0x11e79b[_0x9740('0x33')][_0x9740('0x48')]),'json':_0x577856,'resolveWithFullResponse':!![],'encoding':_0x271d9d,'qs':_0x11e79b[_0x9740('0x33')]};if(_0x11e79b[_0x9740('0x9a')]){_0x54ef91[_0x9740('0x9a')]=_0x11e79b['headers'];if(_0x54ef91['headers'][_0x9740('0x9b')]){delete _0x54ef91['headers'][_0x9740('0x9b')];}}if(_0x54ef91['headers'][_0x9740('0x9c')]){delete _0x54ef91[_0x9740('0x9a')][_0x9740('0x9c')];}return rp(_0x54ef91);})[_0x9740('0x28')](function(_0x3e64b3){if(_0x3e64b3){_0x55ceef[_0x9740('0x9d')](_0x3e64b3[_0x9740('0x9a')]);logger[_0x9740('0x5d')](_0x3e64b3[_0x9740('0x87')]);if(_[_0x9740('0x9e')](_0x11e79b['query'][_0x9740('0x48')],'download')&&_0x3e64b3[_0x9740('0x9f')]==0x1f4){return _0x55ceef['sendStatus'](_0x3e64b3[_0x9740('0x9f')]);}else{return _0x55ceef['status'](_0x3e64b3['statusCode'])[_0x9740('0x8e')](_0x3e64b3['body']);}}else{return _0x55ceef[_0x9740('0x1d')](0xc8);}})['catch'](handleError(_0x55ceef,null));};exports[_0x9740('0xa0')]=function(_0x3c5c19,_0x1dd9fd,_0x228fdd){return BPromise[_0x9740('0x93')]()['then'](function(){if(!_0x3c5c19[_0x9740('0x33')][_0x9740('0x48')]){throw new Error(_0x9740('0xa1'));}if(!_0x3c5c19[_0x9740('0x33')][_0x9740('0x94')]){throw new Error(_0x9740('0x95'));}var _0x27f3a6=_0x3c5c19[_0x9740('0x33')][_0x9740('0x96')]?_0x3c5c19[_0x9740('0x33')][_0x9740('0x96')]+':'+_0x3c5c19[_0x9740('0x33')]['port']:_0x9740('0x97')+_0x3c5c19[_0x9740('0x33')]['port'];var _0x39a79e=_0x3c5c19[_0x9740('0x33')]['json']?_0x3c5c19[_0x9740('0x33')][_0x9740('0x24')]:!![];var _0x2a5b44=_0x3c5c19['query'][_0x9740('0x98')]?_0x3c5c19[_0x9740('0x33')][_0x9740('0x98')]:null;var _0x391071={'method':_0x3c5c19[_0x9740('0x99')],'uri':util[_0x9740('0x4c')](_0x9740('0xa2'),_0x27f3a6,_0x3c5c19['query'][_0x9740('0x48')]),'json':_0x39a79e,'resolveWithFullResponse':!![],'encoding':_0x2a5b44,'body':_0x3c5c19['body']};if(_0x3c5c19[_0x9740('0x9a')]){_0x391071[_0x9740('0x9a')]=_0x3c5c19[_0x9740('0x9a')];if(_0x391071['headers'][_0x9740('0x9b')]){delete _0x391071[_0x9740('0x9a')][_0x9740('0x9b')];}}if(_0x391071['headers'][_0x9740('0x9c')]){delete _0x391071['headers'][_0x9740('0x9c')];}return rp(_0x391071);})['then'](function(_0x7da873){if(_0x7da873){_0x1dd9fd['set'](_0x7da873['headers']);logger[_0x9740('0x5d')](_0x7da873['body']);return _0x1dd9fd['status'](_0x7da873[_0x9740('0x9f')])[_0x9740('0x8e')](_0x7da873[_0x9740('0x87')]);}else{return _0x1dd9fd[_0x9740('0x1d')](0xc8);}})[_0x9740('0x42')](handleError(_0x1dd9fd,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 1397cca..fc12625 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 _0xfef3=['events','Plugin','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x9c9266,_0x48e5dd){var _0x4a5b0e=function(_0x4d08f8){while(--_0x4d08f8){_0x9c9266['push'](_0x9c9266['shift']());}};_0x4a5b0e(++_0x48e5dd);}(_0xfef3,0x118));var _0x3fef=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0xfef3[_0x251e8c];return _0x1e0c1d;};'use strict';var EventEmitter=require(_0x3fef('0x0'));var Plugin=require('../../mysqldb')['db'][_0x3fef('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3fef('0x2'),'afterUpdate':_0x3fef('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1873fc){return function(_0x3b71e5,_0x538f28,_0x2f88b8){PluginEvents[_0x3fef('0x4')](_0x1873fc+':'+_0x3b71e5['id'],_0x3b71e5);PluginEvents['emit'](_0x1873fc,_0x3b71e5);_0x2f88b8(null);};}for(var e in events){if(events[_0x3fef('0x5')](e)){var event=events[e];Plugin[_0x3fef('0x6')](e,emitEvent(event));}}module[_0x3fef('0x7')]=PluginEvents; \ No newline at end of file +var _0xeb3b=['events','../../mysqldb','Plugin','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x33187f,_0x477656){var _0xd3c0d=function(_0x185186){while(--_0x185186){_0x33187f['push'](_0x33187f['shift']());}};_0xd3c0d(++_0x477656);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0xeb3b[_0x173452];return _0xee3fd0;};'use strict';var EventEmitter=require(_0xbeb3('0x0'));var Plugin=require(_0xbeb3('0x1'))['db'][_0xbeb3('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xbeb3('0x3')](0x0);var events={'afterCreate':_0xbeb3('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4734b5){return function(_0x5b0e3b,_0x2e8ce3,_0x4852ca){PluginEvents[_0xbeb3('0x5')](_0x4734b5+':'+_0x5b0e3b['id'],_0x5b0e3b);PluginEvents[_0xbeb3('0x5')](_0x4734b5,_0x5b0e3b);_0x4852ca(null);};}for(var e in events){if(events[_0xbeb3('0x6')](e)){var event=events[e];Plugin[_0xbeb3('0x7')](e,emitEvent(event));}}module[_0xbeb3('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index c32e8b4..bdfbc09 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 _0xac31=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','Plugin','plugins','lodash','util'];(function(_0x5c6e8d,_0xef3649){var _0x3ac459=function(_0x21b802){while(--_0x21b802){_0x5c6e8d['push'](_0x5c6e8d['shift']());}};_0x3ac459(++_0xef3649);}(_0xac31,0xca));var _0x1ac3=function(_0xef6f43,_0x544c38){_0xef6f43=_0xef6f43-0x0;var _0xa1b4c=_0xac31[_0xef6f43];return _0xa1b4c;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var logger=require(_0x1ac3('0x2'))(_0x1ac3('0x3'));var moment=require(_0x1ac3('0x4'));var BPromise=require(_0x1ac3('0x5'));var rp=require(_0x1ac3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var attributes=require('./plugin.attributes');module['exports']=function(_0xbe22b7,_0x20027f){return _0xbe22b7[_0x1ac3('0x9')](_0x1ac3('0xa'),attributes,{'tableName':_0x1ac3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x207c=['api','moment','bluebird','request-promise','path','../../config/environment','define','Plugin','util','../../config/logger'];(function(_0xea9e1c,_0x577088){var _0x3bdb61=function(_0x35e3c1){while(--_0x35e3c1){_0xea9e1c['push'](_0xea9e1c['shift']());}};_0x3bdb61(++_0x577088);}(_0x207c,0x1e8));var _0xc207=function(_0x1d5a18,_0x585dc8){_0x1d5a18=_0x1d5a18-0x0;var _0x411450=_0x207c[_0x1d5a18];return _0x411450;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var logger=require(_0xc207('0x1'))(_0xc207('0x2'));var moment=require(_0xc207('0x3'));var BPromise=require(_0xc207('0x4'));var rp=require(_0xc207('0x5'));var fs=require('fs');var path=require(_0xc207('0x6'));var rimraf=require('rimraf');var config=require(_0xc207('0x7'));var attributes=require('./plugin.attributes');module['exports']=function(_0x55023e,_0xc88789){return _0x55023e[_0xc207('0x8')](_0xc207('0x9'),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 f51cca0..6809486 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 _0x5a4c=['create','options','raw','then','info','CreatePlugin','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./plugin.socket','register','request','Plugin,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','Plugin'];(function(_0x29e7eb,_0x31eafb){var _0x3815f1=function(_0x1b39a1){while(--_0x1b39a1){_0x29e7eb['push'](_0x29e7eb['shift']());}};_0x3815f1(++_0x31eafb);}(_0x5a4c,0xee));var _0xc5a4=function(_0x571dc5,_0x59a6ca){_0x571dc5=_0x571dc5-0x0;var _0x12fbef=_0x5a4c[_0x571dc5];return _0x12fbef;};'use strict';var _=require(_0xc5a4('0x0'));var util=require(_0xc5a4('0x1'));var moment=require('moment');var BPromise=require(_0xc5a4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5a4('0x3'));var db=require(_0xc5a4('0x4'))['db'];var utils=require(_0xc5a4('0x5'));var logger=require('../../config/logger')(_0xc5a4('0x6'));var config=require('../../config/environment');var jayson=require(_0xc5a4('0x7'));var client=jayson[_0xc5a4('0x8')][_0xc5a4('0x9')]({'port':0x232a});config['redis']=_[_0xc5a4('0xa')](config['redis'],{'host':_0xc5a4('0xb'),'port':0x18eb});var socket=require(_0xc5a4('0xc'))(new Redis(config[_0xc5a4('0xd')]));require(_0xc5a4('0xe'))[_0xc5a4('0xf')](socket);function respondWithRpcPromise(_0x297111,_0x4e1d73,_0x22c6f2){return new BPromise(function(_0x59dc67,_0x506040){return client[_0xc5a4('0x10')](_0x297111,_0x22c6f2)['then'](function(_0x171878){logger['info'](_0xc5a4('0x11'),_0x4e1d73,'request\x20sent');logger[_0xc5a4('0x12')]('Plugin,\x20%s,\x20%s,\x20%s',_0x4e1d73,'request\x20sent',JSON['stringify'](_0x171878));if(_0x171878[_0xc5a4('0x13')]){if(_0x171878['error'][_0xc5a4('0x14')]===0x1f4){logger['error'](_0xc5a4('0x11'),_0x4e1d73,_0x171878[_0xc5a4('0x13')]['message']);return _0x506040(_0x171878[_0xc5a4('0x13')]['message']);}logger[_0xc5a4('0x13')](_0xc5a4('0x11'),_0x4e1d73,_0x171878[_0xc5a4('0x13')][_0xc5a4('0x15')]);return _0x59dc67(_0x171878[_0xc5a4('0x13')]['message']);}else{logger['info'](_0xc5a4('0x11'),_0x4e1d73,_0xc5a4('0x16'));_0x59dc67(_0x171878[_0xc5a4('0x17')][_0xc5a4('0x15')]);}})[_0xc5a4('0x18')](function(_0x3a53b3){logger['error'](_0xc5a4('0x11'),_0x4e1d73,_0x3a53b3);_0x506040(_0x3a53b3);});});}exports['CreatePlugin']=function(_0x410182){var _0x575eec=this;return new Promise(function(_0x461f7a,_0x2c4d5a){return db[_0xc5a4('0x19')][_0xc5a4('0x1a')](_0x410182['body'],{'raw':_0x410182[_0xc5a4('0x1b')]?_0x410182[_0xc5a4('0x1b')][_0xc5a4('0x1c')]===undefined?!![]:![]:!![]})[_0xc5a4('0x1d')](function(_0x367f66){logger[_0xc5a4('0x1e')](_0xc5a4('0x1f'),_0x410182);logger['debug'](_0xc5a4('0x1f'),_0x410182,JSON[_0xc5a4('0x20')](_0x367f66));_0x461f7a(_0x367f66);})[_0xc5a4('0x18')](function(_0x302006){logger[_0xc5a4('0x13')](_0xc5a4('0x1f'),_0x302006[_0xc5a4('0x15')],_0x410182);_0x2c4d5a(_0x575eec[_0xc5a4('0x13')](0x1f4,_0x302006[_0xc5a4('0x15')]));});});}; \ No newline at end of file +var _0x4ca1=['rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','register','request','then','request\x20sent','debug','stringify','code','error','Plugin,\x20%s,\x20%s','message','result','catch','create','body','options','CreatePlugin','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0x4ca1,0xa7));var _0x14ca=function(_0x4a7fd1,_0x4bdde1){_0x4a7fd1=_0x4a7fd1-0x0;var _0x12ef10=_0x4ca1[_0x4a7fd1];return _0x12ef10;};'use strict';var _=require(_0x14ca('0x0'));var util=require('util');var moment=require(_0x14ca('0x1'));var BPromise=require('bluebird');var rs=require(_0x14ca('0x2'));var fs=require('fs');var Redis=require(_0x14ca('0x3'));var db=require(_0x14ca('0x4'))['db'];var utils=require(_0x14ca('0x5'));var logger=require(_0x14ca('0x6'))(_0x14ca('0x7'));var config=require(_0x14ca('0x8'));var jayson=require(_0x14ca('0x9'));var client=jayson['client'][_0x14ca('0xa')]({'port':0x232a});config[_0x14ca('0xb')]=_['defaults'](config[_0x14ca('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x14ca('0xc'))(new Redis(config[_0x14ca('0xb')]));require('./plugin.socket')[_0x14ca('0xd')](socket);function respondWithRpcPromise(_0x3bdef5,_0x1df9c0,_0x1e4956){return new BPromise(function(_0x4d9767,_0x420e20){return client[_0x14ca('0xe')](_0x3bdef5,_0x1e4956)[_0x14ca('0xf')](function(_0x541459){logger['info']('Plugin,\x20%s,\x20%s',_0x1df9c0,_0x14ca('0x10'));logger[_0x14ca('0x11')]('Plugin,\x20%s,\x20%s,\x20%s',_0x1df9c0,'request\x20sent',JSON[_0x14ca('0x12')](_0x541459));if(_0x541459['error']){if(_0x541459['error'][_0x14ca('0x13')]===0x1f4){logger[_0x14ca('0x14')](_0x14ca('0x15'),_0x1df9c0,_0x541459[_0x14ca('0x14')][_0x14ca('0x16')]);return _0x420e20(_0x541459[_0x14ca('0x14')]['message']);}logger['error'](_0x14ca('0x15'),_0x1df9c0,_0x541459[_0x14ca('0x14')]['message']);return _0x4d9767(_0x541459[_0x14ca('0x14')][_0x14ca('0x16')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x1df9c0,_0x14ca('0x10'));_0x4d9767(_0x541459[_0x14ca('0x17')][_0x14ca('0x16')]);}})[_0x14ca('0x18')](function(_0x29a74b){logger[_0x14ca('0x14')]('Plugin,\x20%s,\x20%s',_0x1df9c0,_0x29a74b);_0x420e20(_0x29a74b);});});}exports['CreatePlugin']=function(_0x4934a0){var _0x41acc1=this;return new Promise(function(_0x1bd968,_0x5df536){return db['Plugin'][_0x14ca('0x19')](_0x4934a0[_0x14ca('0x1a')],{'raw':_0x4934a0[_0x14ca('0x1b')]?_0x4934a0[_0x14ca('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x14ca('0xf')](function(_0x5510f7){logger['info'](_0x14ca('0x1c'),_0x4934a0);logger[_0x14ca('0x11')](_0x14ca('0x1c'),_0x4934a0,JSON[_0x14ca('0x12')](_0x5510f7));_0x1bd968(_0x5510f7);})[_0x14ca('0x18')](function(_0x43c4c8){logger[_0x14ca('0x14')](_0x14ca('0x1c'),_0x43c4c8[_0x14ca('0x16')],_0x4934a0);_0x5df536(_0x41acc1[_0x14ca('0x14')](0x1f4,_0x43c4c8[_0x14ca('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 9bebafb..90d8e4c 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 _0x2d12=['removeListener','length','plugin:','save','emit'];(function(_0x2892d0,_0xedc1b7){var _0x5a2b08=function(_0x531721){while(--_0x531721){_0x2892d0['push'](_0x2892d0['shift']());}};_0x5a2b08(++_0xedc1b7);}(_0x2d12,0x198));var _0x22d1=function(_0x5ca746,_0x4b1943){_0x5ca746=_0x5ca746-0x0;var _0x59a85b=_0x2d12[_0x5ca746];return _0x59a85b;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x22d1('0x0'),'remove','update'];function createListener(_0x97088a,_0x32b762){return function(_0x284cf0){_0x32b762[_0x22d1('0x1')](_0x97088a,_0x284cf0);};}function removeListener(_0x263133,_0xda6ce5){return function(){PluginEvents[_0x22d1('0x2')](_0x263133,_0xda6ce5);};}exports['register']=function(_0x49d9cf){for(var _0x5f3305=0x0,_0x2c27fb=events[_0x22d1('0x3')];_0x5f3305<_0x2c27fb;_0x5f3305++){var _0x50a020=events[_0x5f3305];var _0x54a4a4=createListener(_0x22d1('0x4')+_0x50a020,_0x49d9cf);PluginEvents['on'](_0x50a020,_0x54a4a4);}}; \ No newline at end of file +var _0x0b95=['update','emit','length','save','remove'];(function(_0x2b93f5,_0x235dad){var _0x5859e1=function(_0x320f25){while(--_0x320f25){_0x2b93f5['push'](_0x2b93f5['shift']());}};_0x5859e1(++_0x235dad);}(_0x0b95,0x198));var _0x50b9=function(_0x50ae81,_0x31a9ea){_0x50ae81=_0x50ae81-0x0;var _0x1b58b7=_0x0b95[_0x50ae81];return _0x1b58b7;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x50b9('0x0'),_0x50b9('0x1'),_0x50b9('0x2')];function createListener(_0x366e6e,_0x203952){return function(_0xd05b11){_0x203952[_0x50b9('0x3')](_0x366e6e,_0xd05b11);};}function removeListener(_0xc6e273,_0x52c068){return function(){PluginEvents['removeListener'](_0xc6e273,_0x52c068);};}exports['register']=function(_0x284b34){for(var _0x19f3af=0x0,_0x892061=events[_0x50b9('0x4')];_0x19f3af<_0x892061;_0x19f3af++){var _0x4ffdd8=events[_0x19f3af];var _0x2b5fbb=createListener('plugin:'+_0x4ffdd8,_0x284b34);PluginEvents['on'](_0x4ffdd8,_0x2b5fbb);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index eb63c01..f88f6a1 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 _0xbf62=['express','Router','./pm2.controller','get','index','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports'];(function(_0x5a5523,_0x350331){var _0x41c6fb=function(_0x29c28f){while(--_0x29c28f){_0x5a5523['push'](_0x5a5523['shift']());}};_0x41c6fb(++_0x350331);}(_0xbf62,0x1ce));var _0x2bf6=function(_0x4cce3e,_0x4a1349){_0x4cce3e=_0x4cce3e-0x0;var _0x391e08=_0xbf62[_0x4cce3e];return _0x391e08;};'use strict';var express=require(_0x2bf6('0x0'));var router=express[_0x2bf6('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x2bf6('0x2'));router[_0x2bf6('0x3')]('/',auth['isAuthenticated'](),controller[_0x2bf6('0x4')]);router[_0x2bf6('0x3')](_0x2bf6('0x5'),auth['isAuthenticated'](),controller[_0x2bf6('0x6')]);router['post']('/',auth[_0x2bf6('0x7')](),controller[_0x2bf6('0x8')]);router[_0x2bf6('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2bf6('0xa')]);router[_0x2bf6('0xb')](_0x2bf6('0x5'),auth[_0x2bf6('0x7')](),controller[_0x2bf6('0xc')]);module[_0x2bf6('0xd')]=router; \ No newline at end of file +var _0x2900=['post','create','update','delete','exports','express','Router','../../components/auth/service','./pm2.controller','get','isAuthenticated','/:id','show'];(function(_0x4f72d4,_0x416985){var _0xe6d78b=function(_0x9e2161){while(--_0x9e2161){_0x4f72d4['push'](_0x4f72d4['shift']());}};_0xe6d78b(++_0x416985);}(_0x2900,0xfc));var _0x0290=function(_0x37a9d7,_0x2b6fde){_0x37a9d7=_0x37a9d7-0x0;var _0x1343d3=_0x2900[_0x37a9d7];return _0x1343d3;};'use strict';var express=require(_0x0290('0x0'));var router=express[_0x0290('0x1')]();var auth=require(_0x0290('0x2'));var controller=require(_0x0290('0x3'));router[_0x0290('0x4')]('/',auth[_0x0290('0x5')](),controller['index']);router[_0x0290('0x4')](_0x0290('0x6'),auth[_0x0290('0x5')](),controller[_0x0290('0x7')]);router[_0x0290('0x8')]('/',auth['isAuthenticated'](),controller[_0x0290('0x9')]);router['put'](_0x0290('0x6'),auth[_0x0290('0x5')](),controller[_0x0290('0xa')]);router[_0x0290('0xb')](_0x0290('0x6'),auth[_0x0290('0x5')](),controller['destroy']);module[_0x0290('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 a8ccf56..7c83667 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 _0x2e29=['catch','show','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','dump','lodash','../../config/pm2','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','index','list','then','reject','motion2','length'];(function(_0x5275b2,_0x511b38){var _0x4e5926=function(_0x127e5a){while(--_0x127e5a){_0x5275b2['push'](_0x5275b2['shift']());}};_0x4e5926(++_0x511b38);}(_0x2e29,0x87));var _0x92e2=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x2e29[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x92e2('0x0'));var pm2=require(_0x92e2('0x1'));var logger=require('../../config/logger')(_0x92e2('0x2'));var path=require(_0x92e2('0x3'));var exec=require(_0x92e2('0x4'))[_0x92e2('0x5')];var BPromise=require(_0x92e2('0x6'));function handleEntityNotFound(_0x31883a,_0x2372a2){return function(_0x3fcd79){if(!_0x3fcd79){_0x31883a[_0x92e2('0x7')](0x194);;}return _0x3fcd79;};}function respondWithResult(_0x2cae49,_0x31096e){_0x31096e=_0x31096e||0xc8;return function(_0x54e5a4){if(_0x54e5a4){return _0x2cae49[_0x92e2('0x8')](_0x31096e)[_0x92e2('0x9')](_0x54e5a4);}return null;};}function handleError(_0x205f4f,_0x4f07c5){_0x4f07c5=_0x4f07c5||0x1f4;return function(_0x59dccb){logger[_0x92e2('0xa')](_0x59dccb[_0x92e2('0xb')]);if(_0x59dccb[_0x92e2('0xc')]){delete _0x59dccb[_0x92e2('0xc')];}_0x205f4f[_0x92e2('0x8')](_0x4f07c5)[_0x92e2('0xd')](_0x59dccb);};}function execChildProcess(){return new BPromise(function(_0x61ab19,_0x7e3ad0){exec(_0x92e2('0xe'),function(_0x6d003c,_0x3b2e6d,_0x2f9275){logger['info'](_0x3b2e6d);logger['info'](_0x2f9275);if(_0x6d003c){logger['error'](_0x6d003c);return _0x7e3ad0(_0x6d003c);}return _0x61ab19(_0x3b2e6d);});});}exports[_0x92e2('0xf')]=function(_0x21076a,_0x484a9f){return pm2[_0x92e2('0x10')]()[_0x92e2('0x11')](function(_0xeb8fde){if(_0xeb8fde){var _0x41ba34=_[_0x92e2('0x12')](_0xeb8fde,function(_0x562866){return _0x562866[_0x92e2('0xc')]==='express'||_0x562866[_0x92e2('0xc')]===_0x92e2('0x13');});return{'rows':_0x41ba34,'count':_0x41ba34[_0x92e2('0x14')]};}return null;})['then'](respondWithResult(_0x484a9f,null))[_0x92e2('0x15')](handleError(_0x484a9f,null));};exports[_0x92e2('0x16')]=function(_0x130ced,_0x47c9b1){return pm2['describe'](_0x130ced[_0x92e2('0x17')]['id'])['then'](respondWithResult(_0x47c9b1,null))[_0x92e2('0x11')](handleEntityNotFound(_0x47c9b1,null))[_0x92e2('0x15')](handleError(_0x47c9b1,null));};exports['create']=function(_0x21dba8,_0x4da0db){if(_0x21dba8['body'][_0x92e2('0xc')]&&_0x21dba8[_0x92e2('0x18')][_0x92e2('0x19')]){var _0x190bba=path[_0x92e2('0x1a')](__dirname,_0x92e2('0x1b'),_0x21dba8['body'][_0x92e2('0x19')]);var _0x443bac=process[_0x92e2('0x1c')]();process[_0x92e2('0x1d')](path[_0x92e2('0x1e')](_0x190bba));return execChildProcess()[_0x92e2('0x11')](function(_0x24f72f){process['chdir'](_0x443bac);return pm2[_0x92e2('0x1f')]({'name':_0x21dba8[_0x92e2('0x18')][_0x92e2('0xc')],'script':_0x190bba});})[_0x92e2('0x11')](function(_0x27436b){pm2['dump']();return _0x27436b[0x0];})[_0x92e2('0x11')](respondWithResult(_0x4da0db,0xc9))[_0x92e2('0x15')](handleError(_0x4da0db,null));}else{return _0x4da0db[_0x92e2('0x8')](0x1f4)[_0x92e2('0xd')]({'message':_0x92e2('0x20')});}};exports[_0x92e2('0x21')]=function(_0x48cbc6,_0x5bf33b){if(_0x48cbc6['body']['id']){delete _0x48cbc6[_0x92e2('0x18')]['id'];}var _0xa5b934={'online':_0x92e2('0x22'),'stopped':_0x92e2('0x23')};if(_0xa5b934[_0x92e2('0x24')](_0x48cbc6[_0x92e2('0x18')][_0x92e2('0x8')])){return pm2[_0xa5b934[_0x48cbc6[_0x92e2('0x18')][_0x92e2('0x8')]]](_0x48cbc6[_0x92e2('0x17')]['id'])[_0x92e2('0x11')](respondWithResult(_0x5bf33b,0xc8))[_0x92e2('0x15')](handleError(_0x5bf33b,null));}else{return _0x5bf33b[_0x92e2('0x8')](0x1f4)[_0x92e2('0xd')]({'message':_0x92e2('0x25')});}};exports['destroy']=function(_0xe86a4c,_0x54e7d0){if(_0xe86a4c['body']['id']){delete _0xe86a4c['body']['id'];}if(_0xe86a4c[_0x92e2('0x17')]['id']){return pm2['delete'](_0xe86a4c[_0x92e2('0x17')]['id'])[_0x92e2('0x11')](function(_0x27e1cf){pm2[_0x92e2('0x26')]();return _0x27e1cf[0x0];})[_0x92e2('0x11')](respondWithResult(_0x54e7d0,null))[_0x92e2('0x15')](handleError(_0x54e7d0,null));}else{return _0x54e7d0['status'](0x1f4)[_0x92e2('0xd')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x3aa2=['dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','index','list','then','reject','motion2','length','catch','show','describe','params','create','body','join','script','cwd','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','Unknown\x20status','destroy'];(function(_0x3400ca,_0x27c04d){var _0x26e8d1=function(_0x2284e9){while(--_0x2284e9){_0x3400ca['push'](_0x3400ca['shift']());}};_0x26e8d1(++_0x27c04d);}(_0x3aa2,0x7a));var _0x23aa=function(_0x1da8f5,_0xc052c4){_0x1da8f5=_0x1da8f5-0x0;var _0x2973a4=_0x3aa2[_0x1da8f5];return _0x2973a4;};'use strict';var _=require(_0x23aa('0x0'));var pm2=require(_0x23aa('0x1'));var logger=require(_0x23aa('0x2'))(_0x23aa('0x3'));var path=require(_0x23aa('0x4'));var exec=require(_0x23aa('0x5'))['exec'];var BPromise=require(_0x23aa('0x6'));function handleEntityNotFound(_0x62dafa,_0x390c81){return function(_0x512878){if(!_0x512878){_0x62dafa[_0x23aa('0x7')](0x194);;}return _0x512878;};}function respondWithResult(_0x349a41,_0x9bf763){_0x9bf763=_0x9bf763||0xc8;return function(_0x362cf7){if(_0x362cf7){return _0x349a41[_0x23aa('0x8')](_0x9bf763)[_0x23aa('0x9')](_0x362cf7);}return null;};}function handleError(_0x4171ab,_0x474e0d){_0x474e0d=_0x474e0d||0x1f4;return function(_0x75690a){logger[_0x23aa('0xa')](_0x75690a['stack']);if(_0x75690a[_0x23aa('0xb')]){delete _0x75690a[_0x23aa('0xb')];}_0x4171ab[_0x23aa('0x8')](_0x474e0d)[_0x23aa('0xc')](_0x75690a);};}function execChildProcess(){return new BPromise(function(_0x425d9d,_0x621227){exec(_0x23aa('0xd'),function(_0x238a47,_0x447ad5,_0x47d01e){logger[_0x23aa('0xe')](_0x447ad5);logger[_0x23aa('0xe')](_0x47d01e);if(_0x238a47){logger['error'](_0x238a47);return _0x621227(_0x238a47);}return _0x425d9d(_0x447ad5);});});}exports[_0x23aa('0xf')]=function(_0xd583d7,_0x8118f){return pm2[_0x23aa('0x10')]()[_0x23aa('0x11')](function(_0x4aaf43){if(_0x4aaf43){var _0x32f5fe=_[_0x23aa('0x12')](_0x4aaf43,function(_0x374d04){return _0x374d04['name']==='express'||_0x374d04[_0x23aa('0xb')]===_0x23aa('0x13');});return{'rows':_0x32f5fe,'count':_0x32f5fe[_0x23aa('0x14')]};}return null;})[_0x23aa('0x11')](respondWithResult(_0x8118f,null))[_0x23aa('0x15')](handleError(_0x8118f,null));};exports[_0x23aa('0x16')]=function(_0x25f4b4,_0x2531a2){return pm2[_0x23aa('0x17')](_0x25f4b4[_0x23aa('0x18')]['id'])[_0x23aa('0x11')](respondWithResult(_0x2531a2,null))[_0x23aa('0x11')](handleEntityNotFound(_0x2531a2,null))[_0x23aa('0x15')](handleError(_0x2531a2,null));};exports[_0x23aa('0x19')]=function(_0x3cca40,_0x3183f2){if(_0x3cca40[_0x23aa('0x1a')][_0x23aa('0xb')]&&_0x3cca40[_0x23aa('0x1a')]['script']){var _0x31f26f=path[_0x23aa('0x1b')](__dirname,'../../files/plugins',_0x3cca40[_0x23aa('0x1a')][_0x23aa('0x1c')]);var _0x26d1c4=process[_0x23aa('0x1d')]();process[_0x23aa('0x1e')](path[_0x23aa('0x1f')](_0x31f26f));return execChildProcess()[_0x23aa('0x11')](function(_0x570a13){process['chdir'](_0x26d1c4);return pm2[_0x23aa('0x20')]({'name':_0x3cca40[_0x23aa('0x1a')][_0x23aa('0xb')],'script':_0x31f26f});})[_0x23aa('0x11')](function(_0xda8bf8){pm2['dump']();return _0xda8bf8[0x0];})[_0x23aa('0x11')](respondWithResult(_0x3183f2,0xc9))['catch'](handleError(_0x3183f2,null));}else{return _0x3183f2['status'](0x1f4)[_0x23aa('0xc')]({'message':_0x23aa('0x21')});}};exports[_0x23aa('0x22')]=function(_0x6c7ff6,_0x4f79c0){if(_0x6c7ff6[_0x23aa('0x1a')]['id']){delete _0x6c7ff6[_0x23aa('0x1a')]['id'];}var _0x507e60={'online':_0x23aa('0x23'),'stopped':'stop'};if(_0x507e60['hasOwnProperty'](_0x6c7ff6[_0x23aa('0x1a')][_0x23aa('0x8')])){return pm2[_0x507e60[_0x6c7ff6['body'][_0x23aa('0x8')]]](_0x6c7ff6[_0x23aa('0x18')]['id'])['then'](respondWithResult(_0x4f79c0,0xc8))[_0x23aa('0x15')](handleError(_0x4f79c0,null));}else{return _0x4f79c0[_0x23aa('0x8')](0x1f4)[_0x23aa('0xc')]({'message':_0x23aa('0x24')});}};exports[_0x23aa('0x25')]=function(_0x5ad2bc,_0x5b254c){if(_0x5ad2bc[_0x23aa('0x1a')]['id']){delete _0x5ad2bc[_0x23aa('0x1a')]['id'];}if(_0x5ad2bc[_0x23aa('0x18')]['id']){return pm2['delete'](_0x5ad2bc[_0x23aa('0x18')]['id'])[_0x23aa('0x11')](function(_0x581042){pm2[_0x23aa('0x26')]();return _0x581042[0x0];})[_0x23aa('0x11')](respondWithResult(_0x5b254c,null))[_0x23aa('0x15')](handleError(_0x5b254c,null));}else{return _0x5b254c[_0x23aa('0x8')](0x1f4)[_0x23aa('0xc')]({'message':_0x23aa('0x27')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 739f802..ad0f27b 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 _0x5013=['../../components/interaction/service','multer','util','path','connect-timeout','express'];(function(_0x27a45d,_0x14499a){var _0x5aee32=function(_0x3958f2){while(--_0x3958f2){_0x27a45d['push'](_0x27a45d['shift']());}};_0x5aee32(++_0x14499a);}(_0x5013,0x157));var _0x3501=function(_0x5c6994,_0x19ad9a){_0x5c6994=_0x5c6994-0x0;var _0x1d5c84=_0x5013[_0x5c6994];return _0x1d5c84;};'use strict';var multer=require(_0x3501('0x0'));var util=require(_0x3501('0x1'));var path=require(_0x3501('0x2'));var timeout=require(_0x3501('0x3'));var express=require(_0x3501('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3501('0x5'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x3543=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x3e762f,_0x52155f){var _0x5277a3=function(_0x26d7f4){while(--_0x26d7f4){_0x3e762f['push'](_0x3e762f['shift']());}};_0x5277a3(++_0x52155f);}(_0x3543,0x196));var _0x3354=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3543[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x3354('0x0'));var util=require(_0x3354('0x1'));var path=require(_0x3354('0x2'));var timeout=require(_0x3354('0x3'));var express=require(_0x3354('0x4'));var router=express[_0x3354('0x5')]();var auth=require(_0x3354('0x6'));var interaction=require(_0x3354('0x7'));var config=require(_0x3354('0x8'));module[_0x3354('0x9')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index bacdf4b..a29599a 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 _0x83bd=['DATE','exports','INTEGER','STRING'];(function(_0x4aab29,_0xe600b8){var _0x521231=function(_0x310a4b){while(--_0x310a4b){_0x4aab29['push'](_0x4aab29['shift']());}};_0x521231(++_0xe600b8);}(_0x83bd,0x75));var _0xd83b=function(_0x3a04ab,_0x31b9fd){_0x3a04ab=_0x3a04ab-0x0;var _0x4bff6d=_0x83bd[_0x3a04ab];return _0x4bff6d;};'use strict';var Sequelize=require('sequelize');module[_0xd83b('0x0')]={'state':{'type':Sequelize[_0xd83b('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xd83b('0x2')]},'scheduledat':{'type':Sequelize[_0xd83b('0x3')]},'uniqueid':{'type':Sequelize[_0xd83b('0x2')]},'starttime':{'type':Sequelize[_0xd83b('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xd83b('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xd83b('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd83b('0x2')]}}; \ No newline at end of file +var _0xa665=['STRING','DATE','exports','INTEGER'];(function(_0x422a2a,_0x413600){var _0xbc9bb3=function(_0x382441){while(--_0x382441){_0x422a2a['push'](_0x422a2a['shift']());}};_0xbc9bb3(++_0x413600);}(_0xa665,0xb2));var _0x5a66=function(_0x1f5ab3,_0x2d2473){_0x1f5ab3=_0x1f5ab3-0x0;var _0x2bd0d7=_0xa665[_0x1f5ab3];return _0x2bd0d7;};'use strict';var Sequelize=require('sequelize');module[_0x5a66('0x0')]={'state':{'type':Sequelize[_0x5a66('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x5a66('0x2')]},'scheduledat':{'type':Sequelize[_0x5a66('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x5a66('0x3')]},'responsetime':{'type':Sequelize[_0x5a66('0x3')]},'ringtime':{'type':Sequelize[_0x5a66('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5a66('0x2')]},'campaigntype':{'type':Sequelize[_0x5a66('0x2')]},'membername':{'type':Sequelize[_0x5a66('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index a95c25c..db95cd6 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 _0x3149=['exports','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0x56f414,_0x1c8f69){var _0x47c7bf=function(_0x27e35e){while(--_0x27e35e){_0x56f414['push'](_0x56f414['shift']());}};_0x47c7bf(++_0x1c8f69);}(_0x3149,0x7a));var _0x9314=function(_0x1b4f68,_0x5eb8dd){_0x1b4f68=_0x1b4f68-0x0;var _0x528b72=_0x3149[_0x1b4f68];return _0x528b72;};'use strict';var _=require(_0x9314('0x0'));var util=require(_0x9314('0x1'));var logger=require(_0x9314('0x2'))(_0x9314('0x3'));var moment=require(_0x9314('0x4'));var BPromise=require('bluebird');var rp=require(_0x9314('0x5'));var fs=require('fs');var path=require(_0x9314('0x6'));var rimraf=require(_0x9314('0x7'));var config=require(_0x9314('0x8'));var attributes=require(_0x9314('0x9'));module[_0x9314('0xa')]=function(_0x53952f,_0x1d510a){return _0x53952f['define']('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0e9=['report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview'];(function(_0x29f625,_0x445ba8){var _0x189378=function(_0x215c79){while(--_0x215c79){_0x29f625['push'](_0x29f625['shift']());}};_0x189378(++_0x445ba8);}(_0xd0e9,0x16d));var _0x9d0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0e9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9d0e('0x0'));var util=require(_0x9d0e('0x1'));var logger=require(_0x9d0e('0x2'))(_0x9d0e('0x3'));var moment=require(_0x9d0e('0x4'));var BPromise=require(_0x9d0e('0x5'));var rp=require(_0x9d0e('0x6'));var fs=require('fs');var path=require(_0x9d0e('0x7'));var rimraf=require(_0x9d0e('0x8'));var config=require(_0x9d0e('0x9'));var attributes=require(_0x9d0e('0xa'));module['exports']=function(_0x37059e,_0x3cfcd1){return _0x37059e['define'](_0x9d0e('0xb'),attributes,{'tableName':_0x9d0e('0xc'),'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 b6356a0..5ef1862 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 _0xc1ae=['info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateReportAgentPreview','options','raw','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request'];(function(_0x12994a,_0x47ebbb){var _0x504157=function(_0x347df7){while(--_0x347df7){_0x12994a['push'](_0x12994a['shift']());}};_0x504157(++_0x47ebbb);}(_0xc1ae,0xef));var _0xec1a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc1ae[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xec1a('0x0'));var util=require(_0xec1a('0x1'));var moment=require('moment');var BPromise=require(_0xec1a('0x2'));var rs=require(_0xec1a('0x3'));var fs=require('fs');var Redis=require(_0xec1a('0x4'));var db=require(_0xec1a('0x5'))['db'];var utils=require(_0xec1a('0x6'));var logger=require(_0xec1a('0x7'))(_0xec1a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xec1a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47d602,_0x2749bf,_0x291df2){return new BPromise(function(_0x5c5fd2,_0x529445){return client[_0xec1a('0xa')](_0x47d602,_0x291df2)['then'](function(_0x50c54b){logger[_0xec1a('0xb')](_0xec1a('0xc'),_0x2749bf,_0xec1a('0xd'));logger[_0xec1a('0xe')](_0xec1a('0xf'),_0x2749bf,_0xec1a('0xd'),JSON[_0xec1a('0x10')](_0x50c54b));if(_0x50c54b[_0xec1a('0x11')]){if(_0x50c54b[_0xec1a('0x11')][_0xec1a('0x12')]===0x1f4){logger[_0xec1a('0x11')](_0xec1a('0xc'),_0x2749bf,_0x50c54b['error'][_0xec1a('0x13')]);return _0x529445(_0x50c54b[_0xec1a('0x11')][_0xec1a('0x13')]);}logger['error'](_0xec1a('0xc'),_0x2749bf,_0x50c54b['error'][_0xec1a('0x13')]);return _0x5c5fd2(_0x50c54b[_0xec1a('0x11')][_0xec1a('0x13')]);}else{logger[_0xec1a('0xb')](_0xec1a('0xc'),_0x2749bf,_0xec1a('0xd'));_0x5c5fd2(_0x50c54b['result']['message']);}})[_0xec1a('0x14')](function(_0x3048e2){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x2749bf,_0x3048e2);_0x529445(_0x3048e2);});});}exports[_0xec1a('0x15')]=function(_0x586c24){var _0x432934=this;return new Promise(function(_0x2f0955,_0xcd14ab){return db['ReportAgentPreview']['create'](_0x586c24['body'],{'raw':_0x586c24['options']?_0x586c24[_0xec1a('0x16')][_0xec1a('0x17')]===undefined?!![]:![]:!![]})[_0xec1a('0x18')](function(_0x15f11d){logger[_0xec1a('0xb')](_0xec1a('0x15'),_0x586c24);logger['debug']('CreateReportAgentPreview',_0x586c24,JSON['stringify'](_0x15f11d));_0x2f0955(_0x15f11d);})[_0xec1a('0x14')](function(_0x324165){logger[_0xec1a('0x11')](_0xec1a('0x15'),_0x324165[_0xec1a('0x13')],_0x586c24);_0xcd14ab(_0x432934[_0xec1a('0x11')](0x1f4,_0x324165[_0xec1a('0x13')]));});});}; \ No newline at end of file +var _0x326d=['code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error'];(function(_0x3c118b,_0x4b6937){var _0x587725=function(_0x3ac6cf){while(--_0x3ac6cf){_0x3c118b['push'](_0x3c118b['shift']());}};_0x587725(++_0x4b6937);}(_0x326d,0x107));var _0xd326=function(_0x577026,_0x4a48ef){_0x577026=_0x577026-0x0;var _0x10477a=_0x326d[_0x577026];return _0x10477a;};'use strict';var _=require(_0xd326('0x0'));var util=require(_0xd326('0x1'));var moment=require('moment');var BPromise=require(_0xd326('0x2'));var rs=require(_0xd326('0x3'));var fs=require('fs');var Redis=require(_0xd326('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd326('0x5'));var logger=require(_0xd326('0x6'))(_0xd326('0x7'));var config=require(_0xd326('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd326('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eb0e7,_0x3fb5d9,_0x640b63){return new BPromise(function(_0x22b00d,_0x4d4cce){return client['request'](_0x2eb0e7,_0x640b63)[_0xd326('0xa')](function(_0x2b86f7){logger[_0xd326('0xb')](_0xd326('0xc'),_0x3fb5d9,_0xd326('0xd'));logger[_0xd326('0xe')](_0xd326('0xf'),_0x3fb5d9,_0xd326('0xd'),JSON['stringify'](_0x2b86f7));if(_0x2b86f7[_0xd326('0x10')]){if(_0x2b86f7['error'][_0xd326('0x11')]===0x1f4){logger['error'](_0xd326('0xc'),_0x3fb5d9,_0x2b86f7[_0xd326('0x10')]['message']);return _0x4d4cce(_0x2b86f7['error'][_0xd326('0x12')]);}logger[_0xd326('0x10')](_0xd326('0xc'),_0x3fb5d9,_0x2b86f7[_0xd326('0x10')][_0xd326('0x12')]);return _0x22b00d(_0x2b86f7['error'][_0xd326('0x12')]);}else{logger[_0xd326('0xb')](_0xd326('0xc'),_0x3fb5d9,'request\x20sent');_0x22b00d(_0x2b86f7[_0xd326('0x13')]['message']);}})[_0xd326('0x14')](function(_0x9d1129){logger[_0xd326('0x10')](_0xd326('0xc'),_0x3fb5d9,_0x9d1129);_0x4d4cce(_0x9d1129);});});}exports[_0xd326('0x15')]=function(_0x468f3f){var _0x47902e=this;return new Promise(function(_0x57348d,_0x45dd1b){return db[_0xd326('0x16')][_0xd326('0x17')](_0x468f3f[_0xd326('0x18')],{'raw':_0x468f3f[_0xd326('0x19')]?_0x468f3f[_0xd326('0x19')][_0xd326('0x1a')]===undefined?!![]:![]:!![]})[_0xd326('0xa')](function(_0x52e4d1){logger[_0xd326('0xb')](_0xd326('0x15'),_0x468f3f);logger[_0xd326('0xe')]('CreateReportAgentPreview',_0x468f3f,JSON[_0xd326('0x1b')](_0x52e4d1));_0x57348d(_0x52e4d1);})[_0xd326('0x14')](function(_0x2f6bf7){logger['error'](_0xd326('0x15'),_0x2f6bf7['message'],_0x468f3f);_0x45dd1b(_0x47902e[_0xd326('0x10')](0x1f4,_0x2f6bf7[_0xd326('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 9af8927..c26e33b 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 _0xc36a=['/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','/outbound','outbound','/outbound/channels','outboundChannels','agents','put','/agents/:id/capacity','/telephones','telephones','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','chat','showChatQueues','post','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues'];(function(_0x3fe603,_0x58a8bd){var _0x1ee2e3=function(_0x2f3b38){while(--_0x2f3b38){_0x3fe603['push'](_0x3fe603['shift']());}};_0x1ee2e3(++_0x58a8bd);}(_0xc36a,0x86));var _0xac36=function(_0x5a71ec,_0x216c70){_0x5a71ec=_0x5a71ec-0x0;var _0x4170bd=_0xc36a[_0x5a71ec];return _0x4170bd;};'use strict';var multer=require(_0xac36('0x0'));var util=require(_0xac36('0x1'));var path=require(_0xac36('0x2'));var express=require(_0xac36('0x3'));var router=express[_0xac36('0x4')]();var auth=require(_0xac36('0x5'));var controller=require('./rpc.controller');router[_0xac36('0x6')](_0xac36('0x7'),auth[_0xac36('0x8')](),controller['voiceChannels']);router[_0xac36('0x6')](_0xac36('0x9'),auth[_0xac36('0x8')](),controller['voiceChannelMixMonitor']);router[_0xac36('0x6')](_0xac36('0xa'),auth[_0xac36('0x8')](),controller[_0xac36('0xb')]);router[_0xac36('0x6')]('/voice/queues',auth[_0xac36('0x8')](),controller[_0xac36('0xc')]);router[_0xac36('0x6')](_0xac36('0xd'),auth[_0xac36('0x8')](),controller[_0xac36('0xe')]);router['get'](_0xac36('0xf'),auth[_0xac36('0x8')](),controller[_0xac36('0x10')]);router['get']('/mail/accounts',auth[_0xac36('0x8')](),controller[_0xac36('0x11')]);router[_0xac36('0x6')](_0xac36('0x12'),auth[_0xac36('0x8')](),controller[_0xac36('0x13')]);router[_0xac36('0x6')](_0xac36('0x14'),auth[_0xac36('0x8')](),controller[_0xac36('0x15')]);router[_0xac36('0x6')](_0xac36('0x16'),auth['isAuthenticated'](),controller[_0xac36('0x17')]);router['get'](_0xac36('0x18'),auth['isAuthenticated'](),controller[_0xac36('0x19')]);router[_0xac36('0x6')](_0xac36('0x1a'),auth['isAuthenticated'](),controller['voiceQueuesPreview']);router[_0xac36('0x6')]('/voice/queues/channels',auth['isAuthenticated'](),controller[_0xac36('0x1b')]);router['get']('/voice/queues/channels/:uniqueid',auth[_0xac36('0x8')](),controller[_0xac36('0x1c')]);router['get'](_0xac36('0x1d'),auth['isAuthenticated'](),controller[_0xac36('0x1e')]);router[_0xac36('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xac36('0x8')](),controller[_0xac36('0x1f')]);router['get'](_0xac36('0x20'),auth['isAuthenticated'](),controller['showVoiceQueues']);router['get'](_0xac36('0x21'),auth['isAuthenticated'](),controller[_0xac36('0x22')]);router[_0xac36('0x6')](_0xac36('0x23'),auth[_0xac36('0x8')](),controller[_0xac36('0x24')]);router[_0xac36('0x6')]('/agents',auth[_0xac36('0x8')](),controller[_0xac36('0x25')]);router[_0xac36('0x26')](_0xac36('0x27'),auth[_0xac36('0x8')](),controller['agentCapacity']);router[_0xac36('0x6')](_0xac36('0x28'),auth[_0xac36('0x8')](),controller[_0xac36('0x29')]);router[_0xac36('0x6')]('/trunks',auth[_0xac36('0x8')](),controller['trunks']);router['get'](_0xac36('0x2a'),auth[_0xac36('0x8')](),controller['campaigns']);router['get'](_0xac36('0x2b'),auth[_0xac36('0x8')](),controller[_0xac36('0x2c')]);router['get'](_0xac36('0x2d'),auth[_0xac36('0x8')](),controller[_0xac36('0x2e')]);router[_0xac36('0x6')]('/mail/queues/waitinginteractions',auth[_0xac36('0x8')](),controller[_0xac36('0x2f')]);router[_0xac36('0x6')]('/openchannel/queues/waitinginteractions',auth[_0xac36('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0xac36('0x6')](_0xac36('0x30'),auth[_0xac36('0x8')](),controller[_0xac36('0x31')]);router[_0xac36('0x6')](_0xac36('0x32'),auth['isAuthenticated'](),controller[_0xac36('0x33')]);router[_0xac36('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0xac36('0x8')](),controller[_0xac36('0x34')]);router[_0xac36('0x6')](_0xac36('0x35'),auth[_0xac36('0x8')](),controller['faxQueuesWaitingInteractions']);router['post'](_0xac36('0x36'),auth['isAuthenticated'](),controller[_0xac36('0x37')](_0xac36('0x38')));router[_0xac36('0x6')](_0xac36('0x39'),auth[_0xac36('0x8')](),controller[_0xac36('0x3a')]);router['post']('/chat/queues/:id/notify',auth[_0xac36('0x8')](),controller[_0xac36('0x37')](_0xac36('0x3b')));router[_0xac36('0x6')]('/chat/queues/:id',auth[_0xac36('0x8')](),controller[_0xac36('0x3c')]);router[_0xac36('0x3d')]('/fax/queues/:id/notify',auth[_0xac36('0x8')](),controller[_0xac36('0x37')]('fax'));router[_0xac36('0x6')](_0xac36('0x3e'),auth[_0xac36('0x8')](),controller[_0xac36('0x3f')]);router['post']('/openchannel/queues/:id/notify',auth[_0xac36('0x8')](),controller[_0xac36('0x37')](_0xac36('0x40')));router[_0xac36('0x6')](_0xac36('0x41'),auth[_0xac36('0x8')](),controller[_0xac36('0x42')]);router['post'](_0xac36('0x43'),auth[_0xac36('0x8')](),controller[_0xac36('0x37')](_0xac36('0x44')));router[_0xac36('0x3d')](_0xac36('0x45'),auth[_0xac36('0x8')](),controller[_0xac36('0x37')](_0xac36('0x46')));router[_0xac36('0x6')](_0xac36('0x47'),auth[_0xac36('0x8')](),controller[_0xac36('0x48')]);router['get'](_0xac36('0x49'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router['post'](_0xac36('0x4a'),auth[_0xac36('0x8')](),controller[_0xac36('0x4b')]);module[_0xac36('0x4c')]=router; \ No newline at end of file +var _0x2c1a=['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','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','agentCapacity','telephones','/trunks','trunks','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','queueNotify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','isAuthenticated','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues'];(function(_0x5bfa44,_0x76dacc){var _0x43815f=function(_0x307fca){while(--_0x307fca){_0x5bfa44['push'](_0x5bfa44['shift']());}};_0x43815f(++_0x76dacc);}(_0x2c1a,0x12d));var _0xa2c1=function(_0xd42797,_0x108065){_0xd42797=_0xd42797-0x0;var _0x2d27ee=_0x2c1a[_0xd42797];return _0x2d27ee;};'use strict';var multer=require(_0xa2c1('0x0'));var util=require('util');var path=require(_0xa2c1('0x1'));var express=require('express');var router=express[_0xa2c1('0x2')]();var auth=require(_0xa2c1('0x3'));var controller=require(_0xa2c1('0x4'));router[_0xa2c1('0x5')]('/voice/channels',auth['isAuthenticated'](),controller['voiceChannels']);router['get'](_0xa2c1('0x6'),auth['isAuthenticated'](),controller[_0xa2c1('0x7')]);router[_0xa2c1('0x5')](_0xa2c1('0x8'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0xa')]);router[_0xa2c1('0x5')](_0xa2c1('0xb'),auth['isAuthenticated'](),controller[_0xa2c1('0xc')]);router[_0xa2c1('0x5')]('/chat/queues',auth['isAuthenticated'](),controller[_0xa2c1('0xd')]);router[_0xa2c1('0x5')](_0xa2c1('0xe'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0xf')]);router['get'](_0xa2c1('0x10'),auth[_0xa2c1('0x9')](),controller['mailAccounts']);router['get'](_0xa2c1('0x11'),auth['isAuthenticated'](),controller[_0xa2c1('0x12')]);router[_0xa2c1('0x5')]('/sms/queues',auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x13')]);router[_0xa2c1('0x5')](_0xa2c1('0x14'),auth['isAuthenticated'](),controller[_0xa2c1('0x15')]);router[_0xa2c1('0x5')](_0xa2c1('0x16'),auth['isAuthenticated'](),controller[_0xa2c1('0x17')]);router['get'](_0xa2c1('0x18'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x19')]);router[_0xa2c1('0x5')](_0xa2c1('0x1a'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x1b')]);router[_0xa2c1('0x5')](_0xa2c1('0x1c'),auth['isAuthenticated'](),controller[_0xa2c1('0x1d')]);router[_0xa2c1('0x5')](_0xa2c1('0x1e'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x1f')]);router['get'](_0xa2c1('0x20'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x21')]);router['get']('/voice/queues/:id',auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x22')]);router[_0xa2c1('0x5')](_0xa2c1('0x23'),auth['isAuthenticated'](),controller[_0xa2c1('0x24')]);router[_0xa2c1('0x5')](_0xa2c1('0x25'),auth['isAuthenticated'](),controller[_0xa2c1('0x26')]);router['get'](_0xa2c1('0x27'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x28')]);router[_0xa2c1('0x29')]('/agents/:id/capacity',auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x2a')]);router['get']('/telephones',auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x2b')]);router[_0xa2c1('0x5')](_0xa2c1('0x2c'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x2d')]);router[_0xa2c1('0x5')](_0xa2c1('0x2e'),auth[_0xa2c1('0x9')](),controller['campaigns']);router['get'](_0xa2c1('0x2f'),auth[_0xa2c1('0x9')](),controller['faxAccounts']);router[_0xa2c1('0x5')](_0xa2c1('0x30'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x31')]);router[_0xa2c1('0x5')](_0xa2c1('0x32'),auth['isAuthenticated'](),controller[_0xa2c1('0x33')]);router[_0xa2c1('0x5')](_0xa2c1('0x34'),auth['isAuthenticated'](),controller[_0xa2c1('0x35')]);router[_0xa2c1('0x5')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0xa2c1('0x36')]);router[_0xa2c1('0x5')](_0xa2c1('0x37'),auth['isAuthenticated'](),controller[_0xa2c1('0x38')]);router[_0xa2c1('0x5')](_0xa2c1('0x39'),auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router[_0xa2c1('0x5')](_0xa2c1('0x3a'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x3b')]);router['post'](_0xa2c1('0x3c'),auth[_0xa2c1('0x9')](),controller['queueNotify'](_0xa2c1('0x3d')));router['get'](_0xa2c1('0x3e'),auth['isAuthenticated'](),controller[_0xa2c1('0x3f')]);router[_0xa2c1('0x40')](_0xa2c1('0x41'),auth['isAuthenticated'](),controller[_0xa2c1('0x42')]('chat'));router[_0xa2c1('0x5')](_0xa2c1('0x43'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x44')]);router[_0xa2c1('0x40')](_0xa2c1('0x45'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x42')]('fax'));router[_0xa2c1('0x5')]('/fax/queues/:id',auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x46')]);router[_0xa2c1('0x40')](_0xa2c1('0x47'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x42')]('openchannel'));router['get']('/openchannel/queues/:id',auth[_0xa2c1('0x9')](),controller['showOpenchannelQueues']);router[_0xa2c1('0x40')](_0xa2c1('0x48'),auth['isAuthenticated'](),controller[_0xa2c1('0x42')](_0xa2c1('0x49')));router[_0xa2c1('0x40')]('/whatsapp/queues/:id/notify',auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x42')](_0xa2c1('0x4a')));router[_0xa2c1('0x5')](_0xa2c1('0x4b'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x4c')]);router['get'](_0xa2c1('0x4d'),auth[_0xa2c1('0x9')](),controller[_0xa2c1('0x4e')]);router[_0xa2c1('0x40')](_0xa2c1('0x4f'),auth[_0xa2c1('0x9')](),controller['agentNotify']);module[_0xa2c1('0x50')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index e2dbeb4..dfd73b8 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 _0x5654=['chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','InteractionId','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','Agent\x20not\x20found','queue','MessageId','Start','bluebird','moment','lodash','util','../../mysqldb','jayson/promise','http','client','then','error','code','message','result','catch','status','json','stack','send','isNil','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','user','name','interaction','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','interface','agent','internal','telephones','Telephones','trunks','Trunks','Campaigns','chatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x5654,0x10e));var _0x4565=function(_0x2f3614,_0x38bfab){_0x2f3614=_0x2f3614-0x0;var _0x28baab=_0x5654[_0x2f3614];return _0x28baab;};'use strict';var BPromise=require(_0x4565('0x0'));var moment=require(_0x4565('0x1'));var _=require(_0x4565('0x2'));var util=require(_0x4565('0x3'));var db=require(_0x4565('0x4'))['db'];var logger=require('../../config/logger')('api');var jayson=require(_0x4565('0x5'));var amiClient=jayson['client'][_0x4565('0x6')]({'port':0x232a});var mailClient=jayson[_0x4565('0x7')][_0x4565('0x6')]({'port':0x232b});var routingClient=jayson[_0x4565('0x7')][_0x4565('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x4f9098,_0x2714cf,_0x20425a){return new BPromise(function(_0x3a4022,_0x5a80f0){var _0x2f6d55=_0x20425a?_0x20425a:amiClient;return _0x2f6d55['request'](_0x4f9098,_0x2714cf)[_0x4565('0x8')](function(_0x174884){if(_0x174884[_0x4565('0x9')]){if(_0x174884[_0x4565('0x9')][_0x4565('0xa')]===0x1f4){return _0x5a80f0(_0x174884['error'][_0x4565('0xb')]);}return _0x3a4022(_0x174884['error'][_0x4565('0xb')]);}else{_0x3a4022(_0x174884[_0x4565('0xc')]);}})[_0x4565('0xd')](function(_0x49c273){_0x5a80f0(_0x49c273);});});}function respondWithResult(_0x483d5a,_0x36ee0c){_0x36ee0c=_0x36ee0c||0xc8;return function(_0x57b6d5){if(_0x57b6d5){return _0x483d5a[_0x4565('0xe')](_0x36ee0c)[_0x4565('0xf')](_0x57b6d5);}return _0x483d5a['sendStatus'](0x194);};}function handleError(_0x53b0b1,_0x103dda){_0x103dda=_0x103dda||0x1f4;return function(_0x1008be){logger[_0x4565('0x9')](_0x1008be[_0x4565('0x10')]);if(_0x1008be['name']){delete _0x1008be['name'];}_0x53b0b1[_0x4565('0xe')](_0x103dda)[_0x4565('0x11')](_0x1008be);};}function findById(_0x1b3faa){return function(_0x8dafb8){if(!_[_0x4565('0x12')](_0x1b3faa)&&!_[_0x4565('0x12')](_0x8dafb8)&&!_[_0x4565('0x12')](_0x8dafb8[_0x4565('0x13')])){return _['find'](_0x8dafb8[_0x4565('0x13')],function(_0x5bb954){return _0x5bb954['id']==_0x1b3faa;});}return null;};}exports[_0x4565('0x14')]=function(_0x5f4d3d,_0x17b792){return respondWithRpcPromise(_0x4565('0x15'),_0x5f4d3d[_0x4565('0x16')])['then'](respondWithResult(_0x17b792,null))[_0x4565('0xd')](handleError(_0x17b792,null));};exports[_0x4565('0x17')]=function(_0x375fc1,_0x2996f6){return respondWithRpcPromise(_0x4565('0x18'),_[_0x4565('0x19')](_0x375fc1[_0x4565('0x16')],_0x375fc1[_0x4565('0x1a')]))[_0x4565('0x8')](respondWithResult(_0x2996f6,null))[_0x4565('0xd')](handleError(_0x2996f6,null));};exports[_0x4565('0x1b')]=function(_0x21d836,_0x48bdc3){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x21d836[_0x4565('0x16')],_0x21d836['params']))[_0x4565('0x8')](respondWithResult(_0x48bdc3,null))[_0x4565('0xd')](handleError(_0x48bdc3,null));};exports[_0x4565('0x1c')]=function(_0x144912,_0x56d177){return respondWithRpcPromise(_0x4565('0x1d'),_0x144912['query'])[_0x4565('0x8')](respondWithResult(_0x56d177,null))['catch'](handleError(_0x56d177,null));};exports[_0x4565('0x1e')]=function(_0x46b49d,_0xac088f){return respondWithRpcPromise('VoiceQueues',_0x46b49d['query'])[_0x4565('0x8')](findById(_0x46b49d['params']['id']))[_0x4565('0x8')](respondWithResult(_0xac088f,null))[_0x4565('0xd')](handleError(_0xac088f,null));};exports[_0x4565('0x1f')]=function(_0x40db39,_0x49ac79){return respondWithRpcPromise(_0x4565('0x20'),_['merge'](_0x40db39['query'],_0x40db39[_0x4565('0x1a')]))[_0x4565('0x8')](respondWithResult(_0x49ac79,null))[_0x4565('0xd')](handleError(_0x49ac79,null));};exports['voiceQueuesChannels']=function(_0x3e59e5,_0x4a6f59){return respondWithRpcPromise(_0x4565('0x21'),_0x3e59e5[_0x4565('0x16')])[_0x4565('0x8')](respondWithResult(_0x4a6f59,null))[_0x4565('0xd')](handleError(_0x4a6f59,null));};exports['voiceQueuesChannel']=function(_0x97c139,_0x1be259){return respondWithRpcPromise(_0x4565('0x22'),_[_0x4565('0x19')](_0x97c139[_0x4565('0x16')],_0x97c139[_0x4565('0x1a')]))[_0x4565('0x8')](respondWithResult(_0x1be259,null))[_0x4565('0xd')](handleError(_0x1be259,null));};exports[_0x4565('0x23')]=function(_0x4e7021,_0x4e9ee9){return respondWithRpcPromise(_0x4565('0x24'),_[_0x4565('0x19')](_0x4e7021[_0x4565('0x16')],_0x4e7021[_0x4565('0x1a')]))[_0x4565('0x8')](respondWithResult(_0x4e9ee9,null))[_0x4565('0xd')](handleError(_0x4e9ee9,null));};exports[_0x4565('0x25')]=function(_0x58f483,_0x12cb1d){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_['merge'](_0x58f483[_0x4565('0x16')],_0x58f483[_0x4565('0x1a')]))[_0x4565('0x8')](respondWithResult(_0x12cb1d,null))[_0x4565('0xd')](handleError(_0x12cb1d,null));};exports['outbound']=function(_0x22c26c,_0x39f683){return respondWithRpcPromise(_0x4565('0x26'),_0x22c26c[_0x4565('0x16')])[_0x4565('0x8')](respondWithResult(_0x39f683,null))['catch'](handleError(_0x39f683,null));};exports['outboundChannels']=function(_0x3dbb2d,_0x4769a9){return respondWithRpcPromise(_0x4565('0x27'),_0x3dbb2d['query'])[_0x4565('0x8')](respondWithResult(_0x4769a9,null))[_0x4565('0xd')](handleError(_0x4769a9,null));};exports[_0x4565('0x28')]=function(_0xc71d64,_0x28ca35){var _0x25b95d;return respondWithRpcPromise('Agents',_0xc71d64['query'])[_0x4565('0x8')](function(_0x1bc275){_0x25b95d=_0x1bc275;return respondWithRpcPromise(_0x4565('0x29'),_0xc71d64[_0x4565('0x16')],routingClient);})[_0x4565('0x8')](function(_0x21a754){return _[_0x4565('0x19')]({},_0x21a754,_0x25b95d);})['then'](respondWithResult(_0x28ca35,null))[_0x4565('0xd')](handleError(_0x28ca35,null));};exports[_0x4565('0x2a')]=function(_0x4bd2a8,_0x4436b7){if(_0x4bd2a8[_0x4565('0x2b')]&&_0x4bd2a8['body']['interaction']&&_0x4bd2a8[_0x4565('0x2c')]&&_0x4bd2a8[_0x4565('0x2c')][_0x4565('0x2d')]){for(var _0xd22e3 in _0x4bd2a8[_0x4565('0x2b')][_0x4565('0x2e')]){if(_0x4bd2a8['body'][_0x4565('0x2e')]['hasOwnProperty'](_0xd22e3)){db[_0x4565('0x2f')]['findAll']({'where':{'channel':_0xd22e3,'membername':_0x4bd2a8[_0x4565('0x2c')][_0x4565('0x2d')],'type':_0x4565('0x30'),'exitAt':null,'uniqueid':_0x4bd2a8['body'][_0x4565('0x2e')][_0xd22e3]&&_0x4bd2a8[_0x4565('0x2b')]['interaction'][_0xd22e3][_0x4565('0x31')]?{'$notIn':_0x4bd2a8[_0x4565('0x2b')]['interaction'][_0xd22e3]}:{'$ne':null}}})[_0x4565('0x8')](function(_0x3b74cf){var _0x44b206=moment()[_0x4565('0x32')](_0x4565('0x33'));for(var _0x1665c7=0x0,_0x34af18=_0x3b74cf[_0x4565('0x31')];_0x1665c7<_0x34af18;_0x1665c7+=0x1){_0x3b74cf[_0x1665c7]['updateAttributes']({'exitAt':_0x44b206});}});for(var _0x1c45d2=0x0;_0x1c45d2<_0x4bd2a8[_0x4565('0x2b')]['interaction'][_0xd22e3]['length'];_0x1c45d2+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0xd22e3,'membername':_0x4bd2a8[_0x4565('0x2c')][_0x4565('0x2d')],'type':_0x4565('0x30'),'uniqueid':_0x4bd2a8[_0x4565('0x2b')][_0x4565('0x2e')][_0xd22e3][_0x1c45d2],'exitAt':null},'defaults':{'channel':_0xd22e3,'membername':_0x4bd2a8[_0x4565('0x2c')][_0x4565('0x2d')],'interface':_[_0x4565('0x12')](_0x4bd2a8[_0x4565('0x2c')]['interface'])?util[_0x4565('0x32')]('SIP/%s',_0x4bd2a8['user'][_0x4565('0x2d')]):_0x4bd2a8['user'][_0x4565('0x34')],'type':_0x4565('0x30'),'enterAt':moment()[_0x4565('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x4565('0x35'),'internal':_0x4bd2a8['user'][_0x4565('0x36')],'uniqueid':_0x4bd2a8['body']['interaction'][_0xd22e3][_0x1c45d2]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x4bd2a8[_0x4565('0x1a')]['id'],'capacity':_0x4bd2a8['body']['capacity']},routingClient)[_0x4565('0x8')](respondWithResult(_0x4436b7,null))[_0x4565('0xd')](handleError(_0x4436b7,null));};exports[_0x4565('0x37')]=function(_0x3d8ba4,_0x4d27fd){return respondWithRpcPromise(_0x4565('0x38'),_0x3d8ba4[_0x4565('0x16')])['then'](respondWithResult(_0x4d27fd,null))[_0x4565('0xd')](handleError(_0x4d27fd,null));};exports[_0x4565('0x39')]=function(_0x5511bf,_0x2136dc){return respondWithRpcPromise(_0x4565('0x3a'),_0x5511bf[_0x4565('0x16')])[_0x4565('0x8')](respondWithResult(_0x2136dc,null))[_0x4565('0xd')](handleError(_0x2136dc,null));};exports['campaigns']=function(_0x4c7ffd,_0x26e6f8){return respondWithRpcPromise(_0x4565('0x3b'),_0x4c7ffd[_0x4565('0x16')])['then'](respondWithResult(_0x26e6f8,null))['catch'](handleError(_0x26e6f8,null));};exports[_0x4565('0x3c')]=function(_0x1ee626,_0x14a622){return respondWithRpcPromise('ChatQueues',_0x1ee626[_0x4565('0x16')],routingClient)[_0x4565('0x8')](respondWithResult(_0x14a622,null))['catch'](handleError(_0x14a622,null));};exports[_0x4565('0x3d')]=function(_0x478bf5,_0x3f2fbe){return respondWithRpcPromise('ChatQueues',_0x478bf5[_0x4565('0x16')],routingClient)[_0x4565('0x8')](findById(_0x478bf5[_0x4565('0x1a')]['id']))['then'](respondWithResult(_0x3f2fbe,null))[_0x4565('0xd')](handleError(_0x3f2fbe,null));};exports[_0x4565('0x3e')]=function(_0x448d1f,_0x1f2daf){return respondWithRpcPromise('MailQueues',_0x448d1f[_0x4565('0x16')],routingClient)[_0x4565('0x8')](respondWithResult(_0x1f2daf,null))[_0x4565('0xd')](handleError(_0x1f2daf,null));};exports[_0x4565('0x3f')]=function(_0x1af2f6,_0x1f81ab){return respondWithRpcPromise(_0x4565('0x40'),_0x1af2f6[_0x4565('0x16')],routingClient)['then'](findById(_0x1af2f6[_0x4565('0x1a')]['id']))[_0x4565('0x8')](respondWithResult(_0x1f81ab,null))[_0x4565('0xd')](handleError(_0x1f81ab,null));};exports['mailAccounts']=function(_0x3d6861,_0x3b582e){return respondWithRpcPromise(_0x4565('0x41'),_0x3d6861['query'],mailClient)[_0x4565('0x8')](respondWithResult(_0x3b582e,null))['catch'](handleError(_0x3b582e,null));};exports[_0x4565('0x42')]=function(_0x2624bb,_0x2faa1a){return respondWithRpcPromise(_0x4565('0x43'),_0x2624bb[_0x4565('0x16')],routingClient)[_0x4565('0x8')](respondWithResult(_0x2faa1a,null))[_0x4565('0xd')](handleError(_0x2faa1a,null));};exports['showOpenchannelQueues']=function(_0x36c0fa,_0x44994b){return respondWithRpcPromise(_0x4565('0x43'),_0x36c0fa[_0x4565('0x16')],routingClient)['then'](findById(_0x36c0fa['params']['id']))['then'](respondWithResult(_0x44994b,null))[_0x4565('0xd')](handleError(_0x44994b,null));};exports[_0x4565('0x44')]=function(_0x53fc95,_0x5e84dc){return respondWithRpcPromise(_0x4565('0x45'),_0x53fc95[_0x4565('0x16')],routingClient)[_0x4565('0x8')](respondWithResult(_0x5e84dc,null))[_0x4565('0xd')](handleError(_0x5e84dc,null));};exports[_0x4565('0x46')]=function(_0x4d7870,_0x412557){return respondWithRpcPromise(_0x4565('0x45'),_0x4d7870[_0x4565('0x16')],routingClient)[_0x4565('0x8')](findById(_0x4d7870[_0x4565('0x1a')]['id']))[_0x4565('0x8')](respondWithResult(_0x412557,null))[_0x4565('0xd')](handleError(_0x412557,null));};exports[_0x4565('0x47')]=function(_0x38755c,_0x3fda99){return respondWithRpcPromise(_0x4565('0x48'),_0x38755c[_0x4565('0x16')],routingClient)[_0x4565('0x8')](respondWithResult(_0x3fda99,null))[_0x4565('0xd')](handleError(_0x3fda99,null));};exports[_0x4565('0x49')]=function(_0x572560,_0x55566c){return respondWithRpcPromise(_0x4565('0x48'),_0x572560[_0x4565('0x16')],routingClient)['then'](findById(_0x572560[_0x4565('0x1a')]['id']))[_0x4565('0x8')](respondWithResult(_0x55566c,null))['catch'](handleError(_0x55566c,null));};exports['faxQueues']=function(_0x13b74d,_0x222eaf){return respondWithRpcPromise(_0x4565('0x4a'),_0x13b74d['query'],routingClient)['then'](respondWithResult(_0x222eaf,null))[_0x4565('0xd')](handleError(_0x222eaf,null));};exports[_0x4565('0x4b')]=function(_0x34e664,_0x8cfbc5){return respondWithRpcPromise('FaxQueues',_0x34e664[_0x4565('0x16')],routingClient)[_0x4565('0x8')](findById(_0x34e664[_0x4565('0x1a')]['id']))[_0x4565('0x8')](respondWithResult(_0x8cfbc5,null))[_0x4565('0xd')](handleError(_0x8cfbc5,null));};exports[_0x4565('0x4c')]=function(_0x5c605a,_0x15712){return respondWithRpcPromise(_0x4565('0x4d'),_0x5c605a[_0x4565('0x16')])['then'](respondWithResult(_0x15712,null))['catch'](handleError(_0x15712,null));};exports[_0x4565('0x4e')]=function(_0x21f2bc,_0x549981){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x21f2bc[_0x4565('0x16')],routingClient)[_0x4565('0x8')](respondWithResult(_0x549981,null))['catch'](handleError(_0x549981,null));};exports[_0x4565('0x4f')]=function(_0x3d3017,_0x58410e){return respondWithRpcPromise(_0x4565('0x50'),_0x3d3017[_0x4565('0x16')],routingClient)[_0x4565('0x8')](respondWithResult(_0x58410e,null))[_0x4565('0xd')](handleError(_0x58410e,null));};exports[_0x4565('0x51')]=function(_0xe3dfe3,_0x5e0e04){return respondWithRpcPromise(_0x4565('0x52'),_0xe3dfe3[_0x4565('0x16')],routingClient)[_0x4565('0x8')](respondWithResult(_0x5e0e04,null))[_0x4565('0xd')](handleError(_0x5e0e04,null));};exports[_0x4565('0x53')]=function(_0x20a404,_0x3ed470){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x20a404[_0x4565('0x16')],routingClient)['then'](function(_0x452c99){if(_0x20a404[_0x4565('0x16')][_0x4565('0x54')]!==undefined){var _0x33cfd5=_(_0x452c99[_0x4565('0x13')])['filter']([_0x20a404[_0x4565('0x16')][_0x4565('0x54')],_0x20a404[_0x4565('0x1a')]['id']])[_0x4565('0x55')](_0x4565('0x56'))[_0x4565('0x57')]()[_0x4565('0x58')]();return _0x452c99[_0x4565('0x13')]['filter'](function(_0x48053e){return _0x33cfd5['indexOf'](_0x48053e[_0x4565('0x56')])>-0x1;});}else{return _0x452c99[_0x4565('0x13')]['filter'](function(_0x184bf2){return _0x184bf2[_0x4565('0x56')]===parseInt(_0x20a404[_0x4565('0x1a')]['id']);});}})[_0x4565('0x8')](respondWithResult(_0x3ed470,null))['catch'](handleError(_0x3ed470,null));};exports[_0x4565('0x59')]=function(_0x17e3c0,_0x297269){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x17e3c0[_0x4565('0x16')],routingClient)[_0x4565('0x8')](respondWithResult(_0x297269,null))[_0x4565('0xd')](handleError(_0x297269,null));};exports[_0x4565('0x5a')]=function(_0x3e9410,_0x3049aa){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x3e9410['query'],routingClient)[_0x4565('0x8')](respondWithResult(_0x3049aa,null))[_0x4565('0xd')](handleError(_0x3049aa,null));};exports[_0x4565('0x5b')]=function(_0x61282d,_0x5e3ce4){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x61282d[_0x4565('0x16')],routingClient)[_0x4565('0x8')](respondWithResult(_0x5e3ce4,null))[_0x4565('0xd')](handleError(_0x5e3ce4,null));};exports['queueNotify']=function(_0x809956){return function(_0x3d0aaf,_0x4bfaa9){var _0x1ea2a5,_0x4ded72;var _0x8f672d=_['capitalize'](_0x809956);var _0x489294=_0x809956==='chat'?_0x4565('0x5c'):_0x4565('0x5d');return db[_0x8f672d+'Queue'][_0x4565('0x5e')]({'raw':!![],'where':{'id':_0x3d0aaf[_0x4565('0x1a')]['id']}})[_0x4565('0x8')](function(_0x3cfbf6){if(_[_0x4565('0x12')](_0x3cfbf6)){throw new Error(_0x8f672d+_0x4565('0x5f'));}_0x1ea2a5=_0x3cfbf6;return db[_0x8f672d+_0x4565('0x60')][_0x4565('0x5e')]({'where':{'id':_0x3d0aaf[_0x4565('0x2b')][_0x4565('0x61')]},'include':[{'model':db[_0x8f672d+_0x4565('0x62')],'as':_0x4565('0x62')},{'model':db[_0x8f672d+_0x489294],'as':'Account'}]});})[_0x4565('0x8')](function(_0x234598){if(_[_0x4565('0x12')](_0x234598)){throw new Error(_0x8f672d+_0x4565('0x63'));}_0x4ded72=_0x234598;return _0x234598[_0x4565('0x64')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4565('0x8')](function(){var _0x134d17={'uniqueid':_0x809956+'.'+_0x4ded72['id']+'.'+_0x4ded72['Interaction']['id'],'FromUserId':_0x3d0aaf[_0x4565('0x2c')]['id'],'type':'queue'};_0x134d17[_0x8f672d+'MessageId']=_0x4ded72['id'];_0x134d17[_0x8f672d+_0x4565('0x65')]=_0x4ded72[_0x4565('0x62')]['id'];_0x134d17['From'+_0x8f672d+_0x489294+'Id']=_0x4ded72[_0x4565('0x5d')]['id'];_0x134d17['To'+_0x8f672d+_0x4565('0x66')]=_0x1ea2a5['id'];return db[_0x8f672d+_0x4565('0x67')][_0x4565('0x68')](_0x134d17);})[_0x4565('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x809956,'interaction':_0x4ded72[_0x4565('0x62')],'message':_0x4ded72,'account':_0x4ded72['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1ea2a5[_0x4565('0x2d')]+','+(_0x4ded72[_0x4565('0x5d')][_0x4565('0x69')]||0x12c),'interval':_0x4565('0x6a')}]},routingClient);})[_0x4565('0x8')](respondWithResult(_0x4bfaa9,null))[_0x4565('0xd')](handleError(_0x4bfaa9,null));};};exports[_0x4565('0x6b')]=function(_0x545bd0,_0x1fe39c){var _0x2ffc16,_0x58ab54;if(_[_0x4565('0x12')](_0x545bd0[_0x4565('0x2b')][_0x4565('0x6c')])){throw new Error(_0x4565('0x6d'));}var _0x3a5ac8=_0x545bd0['body'][_0x4565('0x6c')];var _0x4c2858=_[_0x4565('0x6e')](_0x3a5ac8);var _0x21b138=_0x3a5ac8===_0x4565('0x6f')?'Website':_0x4565('0x5d');return db['User'][_0x4565('0x5e')]({'raw':!![],'where':{'id':_0x545bd0[_0x4565('0x1a')]['id'],'role':_0x4565('0x35')}})[_0x4565('0x8')](function(_0x49bb83){if(_[_0x4565('0x12')](_0x49bb83)){throw new Error(_0x4565('0x70'));}_0x2ffc16=_0x49bb83;return db[_0x4c2858+_0x4565('0x60')][_0x4565('0x5e')]({'where':{'id':_0x545bd0[_0x4565('0x2b')][_0x4565('0x61')]},'include':[{'model':db[_0x4c2858+_0x4565('0x62')],'as':_0x4565('0x62')},{'model':db[_0x4c2858+_0x21b138],'as':'Account'}]});})[_0x4565('0x8')](function(_0x109998){if(_[_0x4565('0x12')](_0x109998)){throw new Error(_0x4c2858+_0x4565('0x63'));}_0x58ab54=_0x109998;return _0x109998['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x4565('0x8')](function(){var _0x55c3d3={'uniqueid':_0x3a5ac8+'.'+_0x58ab54['id']+'.'+_0x58ab54[_0x4565('0x62')]['id'],'FromUserId':_0x545bd0[_0x4565('0x2c')]['id'],'type':_0x4565('0x71'),'ToUserId':_0x2ffc16['id']};_0x55c3d3[_0x4c2858+_0x4565('0x72')]=_0x58ab54['id'];_0x55c3d3[_0x4c2858+_0x4565('0x65')]=_0x58ab54[_0x4565('0x62')]['id'];_0x55c3d3['From'+_0x4c2858+_0x21b138+'Id']=_0x58ab54[_0x4565('0x5d')]['id'];return db[_0x4c2858+_0x4565('0x67')]['create'](_0x55c3d3);})[_0x4565('0x8')](function(){return respondWithRpcPromise(_0x4565('0x73'),{'channel':_0x3a5ac8,'interaction':_0x58ab54[_0x4565('0x62')],'message':_0x58ab54,'account':_0x58ab54['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x2ffc16['name']+','+(_0x58ab54['Account']['agentTransferTimeout']||0x12c),'interval':_0x4565('0x6a')}]},routingClient);})[_0x4565('0x8')](respondWithResult(_0x1fe39c,null))[_0x4565('0xd')](handleError(_0x1fe39c,null));}; \ No newline at end of file +var _0xde02=['message','result','catch','status','json','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','update','MessageId','InteractionId','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','From','agentTransferTimeout','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','error','code'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0xde02,0xeb));var _0x2de0=function(_0x5a83b8,_0x3bb4eb){_0x5a83b8=_0x5a83b8-0x0;var _0x36ec8a=_0xde02[_0x5a83b8];return _0x36ec8a;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x2de0('0x0'));var util=require(_0x2de0('0x1'));var db=require(_0x2de0('0x2'))['db'];var logger=require(_0x2de0('0x3'))(_0x2de0('0x4'));var jayson=require(_0x2de0('0x5'));var amiClient=jayson[_0x2de0('0x6')][_0x2de0('0x7')]({'port':0x232a});var mailClient=jayson[_0x2de0('0x6')][_0x2de0('0x7')]({'port':0x232b});var routingClient=jayson[_0x2de0('0x6')][_0x2de0('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x2c0bab,_0x1946d7,_0x262e51){return new BPromise(function(_0xf0784e,_0xa13964){var _0x4baeaf=_0x262e51?_0x262e51:amiClient;return _0x4baeaf[_0x2de0('0x8')](_0x2c0bab,_0x1946d7)['then'](function(_0x52f9e2){if(_0x52f9e2[_0x2de0('0x9')]){if(_0x52f9e2[_0x2de0('0x9')][_0x2de0('0xa')]===0x1f4){return _0xa13964(_0x52f9e2[_0x2de0('0x9')][_0x2de0('0xb')]);}return _0xf0784e(_0x52f9e2[_0x2de0('0x9')][_0x2de0('0xb')]);}else{_0xf0784e(_0x52f9e2[_0x2de0('0xc')]);}})[_0x2de0('0xd')](function(_0x209002){_0xa13964(_0x209002);});});}function respondWithResult(_0x38b197,_0x1ea6ce){_0x1ea6ce=_0x1ea6ce||0xc8;return function(_0x4aa5d6){if(_0x4aa5d6){return _0x38b197[_0x2de0('0xe')](_0x1ea6ce)[_0x2de0('0xf')](_0x4aa5d6);}return _0x38b197[_0x2de0('0x10')](0x194);};}function handleError(_0x41ed5a,_0x4d8513){_0x4d8513=_0x4d8513||0x1f4;return function(_0x591971){logger[_0x2de0('0x9')](_0x591971[_0x2de0('0x11')]);if(_0x591971['name']){delete _0x591971[_0x2de0('0x12')];}_0x41ed5a[_0x2de0('0xe')](_0x4d8513)['send'](_0x591971);};}function findById(_0x280dbc){return function(_0x4cc1a0){if(!_[_0x2de0('0x13')](_0x280dbc)&&!_[_0x2de0('0x13')](_0x4cc1a0)&&!_['isNil'](_0x4cc1a0[_0x2de0('0x14')])){return _['find'](_0x4cc1a0[_0x2de0('0x14')],function(_0x3452c0){return _0x3452c0['id']==_0x280dbc;});}return null;};}exports[_0x2de0('0x15')]=function(_0x2c80af,_0x5c2db3){return respondWithRpcPromise(_0x2de0('0x16'),_0x2c80af[_0x2de0('0x17')])[_0x2de0('0x18')](respondWithResult(_0x5c2db3,null))[_0x2de0('0xd')](handleError(_0x5c2db3,null));};exports[_0x2de0('0x19')]=function(_0x4f2a8e,_0x24ff4f){return respondWithRpcPromise(_0x2de0('0x1a'),_[_0x2de0('0x1b')](_0x4f2a8e[_0x2de0('0x17')],_0x4f2a8e[_0x2de0('0x1c')]))['then'](respondWithResult(_0x24ff4f,null))[_0x2de0('0xd')](handleError(_0x24ff4f,null));};exports['voiceChannelStopMixMonitor']=function(_0x218885,_0x1f2296){return respondWithRpcPromise(_0x2de0('0x1d'),_[_0x2de0('0x1b')](_0x218885['query'],_0x218885[_0x2de0('0x1c')]))['then'](respondWithResult(_0x1f2296,null))[_0x2de0('0xd')](handleError(_0x1f2296,null));};exports[_0x2de0('0x1e')]=function(_0xb277cc,_0x21a9e9){return respondWithRpcPromise(_0x2de0('0x1f'),_0xb277cc[_0x2de0('0x17')])[_0x2de0('0x18')](respondWithResult(_0x21a9e9,null))[_0x2de0('0xd')](handleError(_0x21a9e9,null));};exports[_0x2de0('0x20')]=function(_0x4724f0,_0x48134d){return respondWithRpcPromise(_0x2de0('0x1f'),_0x4724f0[_0x2de0('0x17')])['then'](findById(_0x4724f0[_0x2de0('0x1c')]['id']))[_0x2de0('0x18')](respondWithResult(_0x48134d,null))[_0x2de0('0xd')](handleError(_0x48134d,null));};exports['voiceQueuesPreview']=function(_0x12c365,_0x215d7d){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x2de0('0x1b')](_0x12c365[_0x2de0('0x17')],_0x12c365[_0x2de0('0x1c')]))[_0x2de0('0x18')](respondWithResult(_0x215d7d,null))[_0x2de0('0xd')](handleError(_0x215d7d,null));};exports['voiceQueuesChannels']=function(_0x35ba26,_0x2bfd72){return respondWithRpcPromise(_0x2de0('0x21'),_0x35ba26[_0x2de0('0x17')])['then'](respondWithResult(_0x2bfd72,null))[_0x2de0('0xd')](handleError(_0x2bfd72,null));};exports[_0x2de0('0x22')]=function(_0x329421,_0x521438){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x2de0('0x1b')](_0x329421['query'],_0x329421[_0x2de0('0x1c')]))[_0x2de0('0x18')](respondWithResult(_0x521438,null))[_0x2de0('0xd')](handleError(_0x521438,null));};exports[_0x2de0('0x23')]=function(_0x19f98a,_0x28c0f6){return respondWithRpcPromise(_0x2de0('0x24'),_['merge'](_0x19f98a[_0x2de0('0x17')],_0x19f98a[_0x2de0('0x1c')]))[_0x2de0('0x18')](respondWithResult(_0x28c0f6,null))['catch'](handleError(_0x28c0f6,null));};exports['voiceQueuesChannelRedirect']=function(_0x48da6a,_0x5b539a){return respondWithRpcPromise(_0x2de0('0x25'),_[_0x2de0('0x1b')](_0x48da6a[_0x2de0('0x17')],_0x48da6a[_0x2de0('0x1c')]))['then'](respondWithResult(_0x5b539a,null))[_0x2de0('0xd')](handleError(_0x5b539a,null));};exports['outbound']=function(_0xd6711a,_0x3e7788){return respondWithRpcPromise(_0x2de0('0x26'),_0xd6711a['query'])[_0x2de0('0x18')](respondWithResult(_0x3e7788,null))[_0x2de0('0xd')](handleError(_0x3e7788,null));};exports[_0x2de0('0x27')]=function(_0x28efef,_0x259598){return respondWithRpcPromise(_0x2de0('0x28'),_0x28efef[_0x2de0('0x17')])[_0x2de0('0x18')](respondWithResult(_0x259598,null))[_0x2de0('0xd')](handleError(_0x259598,null));};exports['agents']=function(_0x4a5402,_0x30ff34){var _0x37eef0;return respondWithRpcPromise(_0x2de0('0x29'),_0x4a5402[_0x2de0('0x17')])[_0x2de0('0x18')](function(_0x1cde73){_0x37eef0=_0x1cde73;return respondWithRpcPromise('Agents',_0x4a5402[_0x2de0('0x17')],routingClient);})[_0x2de0('0x18')](function(_0x46e8bf){return _[_0x2de0('0x1b')]({},_0x46e8bf,_0x37eef0);})[_0x2de0('0x18')](respondWithResult(_0x30ff34,null))[_0x2de0('0xd')](handleError(_0x30ff34,null));};exports['agentCapacity']=function(_0x1badd8,_0x2c720d){if(_0x1badd8['body']&&_0x1badd8[_0x2de0('0x2a')][_0x2de0('0x2b')]&&_0x1badd8[_0x2de0('0x2c')]&&_0x1badd8[_0x2de0('0x2c')][_0x2de0('0x12')]){for(var _0xface5b in _0x1badd8[_0x2de0('0x2a')][_0x2de0('0x2b')]){if(_0x1badd8[_0x2de0('0x2a')]['interaction'][_0x2de0('0x2d')](_0xface5b)){db[_0x2de0('0x2e')][_0x2de0('0x2f')]({'where':{'channel':_0xface5b,'membername':_0x1badd8['user'][_0x2de0('0x12')],'type':_0x2de0('0x30'),'exitAt':null,'uniqueid':_0x1badd8[_0x2de0('0x2a')][_0x2de0('0x2b')][_0xface5b]&&_0x1badd8['body'][_0x2de0('0x2b')][_0xface5b]['length']?{'$notIn':_0x1badd8[_0x2de0('0x2a')][_0x2de0('0x2b')][_0xface5b]}:{'$ne':null}}})[_0x2de0('0x18')](function(_0x448aa4){var _0x4c7022=moment()[_0x2de0('0x31')](_0x2de0('0x32'));for(var _0x51b491=0x0,_0x26d003=_0x448aa4[_0x2de0('0x33')];_0x51b491<_0x26d003;_0x51b491+=0x1){_0x448aa4[_0x51b491]['updateAttributes']({'exitAt':_0x4c7022});}});for(var _0x43e31e=0x0;_0x43e31e<_0x1badd8['body'][_0x2de0('0x2b')][_0xface5b]['length'];_0x43e31e+=0x1){db[_0x2de0('0x2e')][_0x2de0('0x34')]({'where':{'channel':_0xface5b,'membername':_0x1badd8[_0x2de0('0x2c')][_0x2de0('0x12')],'type':'INTERACTION','uniqueid':_0x1badd8[_0x2de0('0x2a')]['interaction'][_0xface5b][_0x43e31e],'exitAt':null},'defaults':{'channel':_0xface5b,'membername':_0x1badd8['user'][_0x2de0('0x12')],'interface':_[_0x2de0('0x13')](_0x1badd8['user'][_0x2de0('0x35')])?util['format'](_0x2de0('0x36'),_0x1badd8[_0x2de0('0x2c')][_0x2de0('0x12')]):_0x1badd8[_0x2de0('0x2c')][_0x2de0('0x35')],'type':_0x2de0('0x30'),'enterAt':moment()[_0x2de0('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2de0('0x37'),'internal':_0x1badd8[_0x2de0('0x2c')][_0x2de0('0x38')],'uniqueid':_0x1badd8[_0x2de0('0x2a')][_0x2de0('0x2b')][_0xface5b][_0x43e31e]}});}}}}return respondWithRpcPromise(_0x2de0('0x39'),{'id':_0x1badd8[_0x2de0('0x1c')]['id'],'capacity':_0x1badd8[_0x2de0('0x2a')][_0x2de0('0x3a')]},routingClient)[_0x2de0('0x18')](respondWithResult(_0x2c720d,null))[_0x2de0('0xd')](handleError(_0x2c720d,null));};exports[_0x2de0('0x3b')]=function(_0x34fd3b,_0x5b7525){return respondWithRpcPromise(_0x2de0('0x3c'),_0x34fd3b[_0x2de0('0x17')])[_0x2de0('0x18')](respondWithResult(_0x5b7525,null))[_0x2de0('0xd')](handleError(_0x5b7525,null));};exports[_0x2de0('0x3d')]=function(_0x48f51a,_0x432367){return respondWithRpcPromise('Trunks',_0x48f51a[_0x2de0('0x17')])['then'](respondWithResult(_0x432367,null))[_0x2de0('0xd')](handleError(_0x432367,null));};exports[_0x2de0('0x3e')]=function(_0x576e68,_0x507062){return respondWithRpcPromise(_0x2de0('0x3f'),_0x576e68[_0x2de0('0x17')])[_0x2de0('0x18')](respondWithResult(_0x507062,null))[_0x2de0('0xd')](handleError(_0x507062,null));};exports['chatQueues']=function(_0x35644d,_0x5d4ec4){return respondWithRpcPromise(_0x2de0('0x40'),_0x35644d['query'],routingClient)[_0x2de0('0x18')](respondWithResult(_0x5d4ec4,null))[_0x2de0('0xd')](handleError(_0x5d4ec4,null));};exports[_0x2de0('0x41')]=function(_0x1798de,_0x14b38a){return respondWithRpcPromise(_0x2de0('0x40'),_0x1798de[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](findById(_0x1798de[_0x2de0('0x1c')]['id']))[_0x2de0('0x18')](respondWithResult(_0x14b38a,null))['catch'](handleError(_0x14b38a,null));};exports[_0x2de0('0x42')]=function(_0x6551cc,_0xdc2dbb){return respondWithRpcPromise(_0x2de0('0x43'),_0x6551cc[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](respondWithResult(_0xdc2dbb,null))[_0x2de0('0xd')](handleError(_0xdc2dbb,null));};exports['showMailQueues']=function(_0x5663b4,_0x3f84f0){return respondWithRpcPromise(_0x2de0('0x43'),_0x5663b4['query'],routingClient)['then'](findById(_0x5663b4['params']['id']))[_0x2de0('0x18')](respondWithResult(_0x3f84f0,null))[_0x2de0('0xd')](handleError(_0x3f84f0,null));};exports[_0x2de0('0x44')]=function(_0x48a1ef,_0x3dc932){return respondWithRpcPromise(_0x2de0('0x45'),_0x48a1ef[_0x2de0('0x17')],mailClient)[_0x2de0('0x18')](respondWithResult(_0x3dc932,null))[_0x2de0('0xd')](handleError(_0x3dc932,null));};exports[_0x2de0('0x46')]=function(_0x251a97,_0x188321){return respondWithRpcPromise('OpenchannelQueues',_0x251a97[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](respondWithResult(_0x188321,null))['catch'](handleError(_0x188321,null));};exports['showOpenchannelQueues']=function(_0x281872,_0x974d53){return respondWithRpcPromise(_0x2de0('0x47'),_0x281872[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](findById(_0x281872[_0x2de0('0x1c')]['id']))[_0x2de0('0x18')](respondWithResult(_0x974d53,null))[_0x2de0('0xd')](handleError(_0x974d53,null));};exports[_0x2de0('0x48')]=function(_0x4be03a,_0x518c25){return respondWithRpcPromise('SmsQueues',_0x4be03a[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](respondWithResult(_0x518c25,null))[_0x2de0('0xd')](handleError(_0x518c25,null));};exports['showSmsQueues']=function(_0x423f0a,_0x2180e0){return respondWithRpcPromise(_0x2de0('0x49'),_0x423f0a[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](findById(_0x423f0a[_0x2de0('0x1c')]['id']))['then'](respondWithResult(_0x2180e0,null))['catch'](handleError(_0x2180e0,null));};exports['whatsappQueues']=function(_0x1df317,_0x4dcd21){return respondWithRpcPromise('WhatsappQueues',_0x1df317[_0x2de0('0x17')],routingClient)['then'](respondWithResult(_0x4dcd21,null))[_0x2de0('0xd')](handleError(_0x4dcd21,null));};exports[_0x2de0('0x4a')]=function(_0x2b5a62,_0x55d47a){return respondWithRpcPromise(_0x2de0('0x4b'),_0x2b5a62[_0x2de0('0x17')],routingClient)['then'](findById(_0x2b5a62[_0x2de0('0x1c')]['id']))[_0x2de0('0x18')](respondWithResult(_0x55d47a,null))['catch'](handleError(_0x55d47a,null));};exports[_0x2de0('0x4c')]=function(_0x2f1a3b,_0x5ae03b){return respondWithRpcPromise(_0x2de0('0x4d'),_0x2f1a3b['query'],routingClient)[_0x2de0('0x18')](respondWithResult(_0x5ae03b,null))['catch'](handleError(_0x5ae03b,null));};exports[_0x2de0('0x4e')]=function(_0x36cc4b,_0x59bd8e){return respondWithRpcPromise(_0x2de0('0x4d'),_0x36cc4b[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](findById(_0x36cc4b[_0x2de0('0x1c')]['id']))[_0x2de0('0x18')](respondWithResult(_0x59bd8e,null))[_0x2de0('0xd')](handleError(_0x59bd8e,null));};exports[_0x2de0('0x4f')]=function(_0x2cc5bb,_0x4e4ba9){return respondWithRpcPromise(_0x2de0('0x50'),_0x2cc5bb['query'])[_0x2de0('0x18')](respondWithResult(_0x4e4ba9,null))[_0x2de0('0xd')](handleError(_0x4e4ba9,null));};exports['chatQueuesWaitingInteractions']=function(_0x4c1f70,_0x5aa4c2){return respondWithRpcPromise(_0x2de0('0x51'),_0x4c1f70[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](respondWithResult(_0x5aa4c2,null))[_0x2de0('0xd')](handleError(_0x5aa4c2,null));};exports['mailQueuesWaitingInteractions']=function(_0x534ab1,_0x24d0cc){return respondWithRpcPromise(_0x2de0('0x52'),_0x534ab1[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](respondWithResult(_0x24d0cc,null))[_0x2de0('0xd')](handleError(_0x24d0cc,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x2bce90,_0x123f9e){return respondWithRpcPromise(_0x2de0('0x53'),_0x2bce90[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](respondWithResult(_0x123f9e,null))[_0x2de0('0xd')](handleError(_0x123f9e,null));};exports[_0x2de0('0x54')]=function(_0x2b4fc2,_0x3fadd0){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x2b4fc2[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](function(_0x7c73cb){if(_0x2b4fc2['query'][_0x2de0('0x55')]!==undefined){var _0x46622e=_(_0x7c73cb[_0x2de0('0x14')])['filter']([_0x2b4fc2['query']['type'],_0x2b4fc2[_0x2de0('0x1c')]['id']])[_0x2de0('0x56')](_0x2de0('0x57'))[_0x2de0('0x58')]()[_0x2de0('0x59')]();return _0x7c73cb[_0x2de0('0x14')][_0x2de0('0x5a')](function(_0x514d68){return _0x46622e[_0x2de0('0x5b')](_0x514d68[_0x2de0('0x57')])>-0x1;});}else{return _0x7c73cb[_0x2de0('0x14')]['filter'](function(_0x1a80d7){return _0x1a80d7[_0x2de0('0x57')]===parseInt(_0x2b4fc2[_0x2de0('0x1c')]['id']);});}})[_0x2de0('0x18')](respondWithResult(_0x3fadd0,null))[_0x2de0('0xd')](handleError(_0x3fadd0,null));};exports[_0x2de0('0x5c')]=function(_0x5cc1ff,_0x3c90d8){return respondWithRpcPromise(_0x2de0('0x5d'),_0x5cc1ff[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](respondWithResult(_0x3c90d8,null))[_0x2de0('0xd')](handleError(_0x3c90d8,null));};exports['whatsappQueuesWaitingInteractions']=function(_0xda1603,_0x31b02d){return respondWithRpcPromise(_0x2de0('0x5e'),_0xda1603['query'],routingClient)[_0x2de0('0x18')](respondWithResult(_0x31b02d,null))['catch'](handleError(_0x31b02d,null));};exports[_0x2de0('0x5f')]=function(_0x5644a2,_0x207207){return respondWithRpcPromise(_0x2de0('0x60'),_0x5644a2[_0x2de0('0x17')],routingClient)[_0x2de0('0x18')](respondWithResult(_0x207207,null))['catch'](handleError(_0x207207,null));};exports[_0x2de0('0x61')]=function(_0xbcb881){return function(_0x2b0783,_0x3f1d0a){var _0x4f2ea6,_0x20c0d7;var _0x27ca15=_[_0x2de0('0x62')](_0xbcb881);var _0x1d73d6=_0xbcb881===_0x2de0('0x63')?_0x2de0('0x64'):_0x2de0('0x65');return db[_0x27ca15+_0x2de0('0x66')][_0x2de0('0x67')]({'raw':!![],'where':{'id':_0x2b0783[_0x2de0('0x1c')]['id']}})[_0x2de0('0x18')](function(_0x2ddeef){if(_['isNil'](_0x2ddeef)){throw new Error(_0x27ca15+_0x2de0('0x68'));}_0x4f2ea6=_0x2ddeef;return db[_0x27ca15+_0x2de0('0x69')]['findOne']({'where':{'id':_0x2b0783[_0x2de0('0x2a')][_0x2de0('0x6a')]},'include':[{'model':db[_0x27ca15+_0x2de0('0x6b')],'as':_0x2de0('0x6b')},{'model':db[_0x27ca15+_0x1d73d6],'as':_0x2de0('0x65')}]});})[_0x2de0('0x18')](function(_0xe49c6b){if(_[_0x2de0('0x13')](_0xe49c6b)){throw new Error(_0x27ca15+'\x20Message\x20not\x20found');}_0x20c0d7=_0xe49c6b;return _0xe49c6b[_0x2de0('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x2de0('0x18')](function(){var _0x27121b={'uniqueid':_0xbcb881+'.'+_0x20c0d7['id']+'.'+_0x20c0d7['Interaction']['id'],'FromUserId':_0x2b0783[_0x2de0('0x2c')]['id'],'type':'queue'};_0x27121b[_0x27ca15+_0x2de0('0x6d')]=_0x20c0d7['id'];_0x27121b[_0x27ca15+_0x2de0('0x6e')]=_0x20c0d7[_0x2de0('0x6b')]['id'];_0x27121b['From'+_0x27ca15+_0x1d73d6+'Id']=_0x20c0d7[_0x2de0('0x65')]['id'];_0x27121b['To'+_0x27ca15+_0x2de0('0x6f')]=_0x4f2ea6['id'];return db[_0x27ca15+_0x2de0('0x70')][_0x2de0('0x71')](_0x27121b);})[_0x2de0('0x18')](function(){return respondWithRpcPromise('Start',{'channel':_0xbcb881,'interaction':_0x20c0d7[_0x2de0('0x6b')],'message':_0x20c0d7,'account':_0x20c0d7[_0x2de0('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4f2ea6[_0x2de0('0x12')]+','+(_0x20c0d7[_0x2de0('0x65')][_0x2de0('0x72')]||0x12c),'interval':_0x2de0('0x73')}]},routingClient);})['then'](respondWithResult(_0x3f1d0a,null))['catch'](handleError(_0x3f1d0a,null));};};exports[_0x2de0('0x74')]=function(_0x59cd10,_0x447d07){var _0x2dc2d0,_0x376130;if(_[_0x2de0('0x13')](_0x59cd10['body'][_0x2de0('0x75')])){throw new Error(_0x2de0('0x76'));}var _0xda2f2f=_0x59cd10[_0x2de0('0x2a')][_0x2de0('0x75')];var _0x235d96=_[_0x2de0('0x62')](_0xda2f2f);var _0x2a8946=_0xda2f2f===_0x2de0('0x63')?_0x2de0('0x64'):'Account';return db[_0x2de0('0x77')][_0x2de0('0x67')]({'raw':!![],'where':{'id':_0x59cd10[_0x2de0('0x1c')]['id'],'role':_0x2de0('0x37')}})[_0x2de0('0x18')](function(_0x400904){if(_[_0x2de0('0x13')](_0x400904)){throw new Error(_0x2de0('0x78'));}_0x2dc2d0=_0x400904;return db[_0x235d96+_0x2de0('0x69')]['findOne']({'where':{'id':_0x59cd10[_0x2de0('0x2a')]['messageId']},'include':[{'model':db[_0x235d96+'Interaction'],'as':_0x2de0('0x6b')},{'model':db[_0x235d96+_0x2a8946],'as':_0x2de0('0x65')}]});})[_0x2de0('0x18')](function(_0x364208){if(_['isNil'](_0x364208)){throw new Error(_0x235d96+'\x20Message\x20not\x20found');}_0x376130=_0x364208;return _0x364208[_0x2de0('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2a7d8c={'uniqueid':_0xda2f2f+'.'+_0x376130['id']+'.'+_0x376130[_0x2de0('0x6b')]['id'],'FromUserId':_0x59cd10[_0x2de0('0x2c')]['id'],'type':'queue','ToUserId':_0x2dc2d0['id']};_0x2a7d8c[_0x235d96+_0x2de0('0x6d')]=_0x376130['id'];_0x2a7d8c[_0x235d96+_0x2de0('0x6e')]=_0x376130[_0x2de0('0x6b')]['id'];_0x2a7d8c[_0x2de0('0x79')+_0x235d96+_0x2a8946+'Id']=_0x376130[_0x2de0('0x65')]['id'];return db[_0x235d96+_0x2de0('0x70')][_0x2de0('0x71')](_0x2a7d8c);})[_0x2de0('0x18')](function(){return respondWithRpcPromise('Start',{'channel':_0xda2f2f,'interaction':_0x376130['Interaction'],'message':_0x376130,'account':_0x376130[_0x2de0('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x2de0('0x37'),'appdata':_0x2dc2d0[_0x2de0('0x12')]+','+(_0x376130['Account'][_0x2de0('0x7a')]||0x12c),'interval':_0x2de0('0x73')}]},routingClient);})[_0x2de0('0x18')](respondWithResult(_0x447d07,null))[_0x2de0('0xd')](handleError(_0x447d07,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index a60cd23..c3b7bd9 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 _0x9963=['../../components/interaction/service','./schedule.controller','get','isAuthenticated','index','/:id','/:id/run','post','create','put','update','delete','destroy','util','connect-timeout','express','Router'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x9963,0x13f));var _0x3996=function(_0x2c2980,_0x34282a){_0x2c2980=_0x2c2980-0x0;var _0x2a20a9=_0x9963[_0x2c2980];return _0x2a20a9;};'use strict';var multer=require('multer');var util=require(_0x3996('0x0'));var path=require('path');var timeout=require(_0x3996('0x1'));var express=require(_0x3996('0x2'));var router=express[_0x3996('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3996('0x4'));var config=require('../../config/environment');var controller=require(_0x3996('0x5'));router[_0x3996('0x6')]('/',auth[_0x3996('0x7')](),controller[_0x3996('0x8')]);router[_0x3996('0x6')](_0x3996('0x9'),auth[_0x3996('0x7')](),controller['show']);router[_0x3996('0x6')](_0x3996('0xa'),auth[_0x3996('0x7')](),controller['run']);router[_0x3996('0xb')]('/',auth['isAuthenticated'](),controller[_0x3996('0xc')]);router[_0x3996('0xd')]('/:id',auth[_0x3996('0x7')](),controller[_0x3996('0xe')]);router[_0x3996('0xf')](_0x3996('0x9'),auth['isAuthenticated'](),controller[_0x3996('0x10')]);module['exports']=router; \ No newline at end of file +var _0xbf4c=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','run','post','create','put','update','delete','multer'];(function(_0x3e5e83,_0x242e92){var _0xa8af11=function(_0x37e34f){while(--_0x37e34f){_0x3e5e83['push'](_0x3e5e83['shift']());}};_0xa8af11(++_0x242e92);}(_0xbf4c,0x1a1));var _0xcbf4=function(_0x28ef66,_0x29af0a){_0x28ef66=_0x28ef66-0x0;var _0x138493=_0xbf4c[_0x28ef66];return _0x138493;};'use strict';var multer=require(_0xcbf4('0x0'));var util=require(_0xcbf4('0x1'));var path=require(_0xcbf4('0x2'));var timeout=require(_0xcbf4('0x3'));var express=require(_0xcbf4('0x4'));var router=express[_0xcbf4('0x5')]();var auth=require(_0xcbf4('0x6'));var interaction=require(_0xcbf4('0x7'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0xcbf4('0x8')]('/',auth[_0xcbf4('0x9')](),controller[_0xcbf4('0xa')]);router[_0xcbf4('0x8')](_0xcbf4('0xb'),auth[_0xcbf4('0x9')](),controller[_0xcbf4('0xc')]);router[_0xcbf4('0x8')]('/:id/run',auth['isAuthenticated'](),controller[_0xcbf4('0xd')]);router[_0xcbf4('0xe')]('/',auth['isAuthenticated'](),controller[_0xcbf4('0xf')]);router[_0xcbf4('0x10')]('/:id',auth[_0xcbf4('0x9')](),controller[_0xcbf4('0x11')]);router[_0xcbf4('0x12')](_0xcbf4('0xb'),auth[_0xcbf4('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 05fb159..86aabed 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 _0x0272=['pdf','xlsx','csv','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','years','quarters','months','minutes','ENUM'];(function(_0x3e29b0,_0x556552){var _0x272b9a=function(_0x51d89b){while(--_0x51d89b){_0x3e29b0['push'](_0x3e29b0['shift']());}};_0x272b9a(++_0x556552);}(_0x0272,0x15a));var _0x2027=function(_0x1e3015,_0x130cb3){_0x1e3015=_0x1e3015-0x0;var _0x3f459a=_0x0272[_0x1e3015];return _0x3f459a;};'use strict';var Sequelize=require(_0x2027('0x0'));module[_0x2027('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x2027('0x2')]},'active':{'type':Sequelize[_0x2027('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x2027('0x2')],'allowNull':![],'defaultValue':_0x2027('0x4')},'startAt':{'type':Sequelize[_0x2027('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x2027('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x2027('0x6'),_0x2027('0x7'),_0x2027('0x8'),'weeks','days','hours',_0x2027('0x9')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x2027('0xa')]('csv',_0x2027('0xb'),_0x2027('0xc')),'allowNull':![],'defaultValue':_0x2027('0xd')},'type':{'type':Sequelize[_0x2027('0xa')]('custom',_0x2027('0xe')),'allowNull':![],'defaultValue':_0x2027('0xf')},'sendMail':{'type':Sequelize[_0x2027('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x2027('0x2')]},'cc':{'type':Sequelize[_0x2027('0x10')]},'bcc':{'type':Sequelize[_0x2027('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x0f80=['quarters','months','weeks','days','hours','minutes','ENUM','csv','pdf','custom','default','TEXT','exports','STRING','BOOLEAN','DATE','INTEGER','years'];(function(_0x2f0d27,_0x13b905){var _0x2bfd1f=function(_0x3e3cfe){while(--_0x3e3cfe){_0x2f0d27['push'](_0x2f0d27['shift']());}};_0x2bfd1f(++_0x13b905);}(_0x0f80,0x108));var _0x00f8=function(_0x130f9d,_0xbf09a1){_0x130f9d=_0x130f9d-0x0;var _0x361385=_0x0f80[_0x130f9d];return _0x361385;};'use strict';var Sequelize=require('sequelize');module[_0x00f8('0x0')]={'name':{'type':Sequelize[_0x00f8('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x00f8('0x1')]},'active':{'type':Sequelize[_0x00f8('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x00f8('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x00f8('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x00f8('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x00f8('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x00f8('0x5'),_0x00f8('0x6'),_0x00f8('0x7'),_0x00f8('0x8'),_0x00f8('0x9'),_0x00f8('0xa'),_0x00f8('0xb')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x00f8('0xc')](_0x00f8('0xd'),_0x00f8('0xe'),'xlsx'),'allowNull':![],'defaultValue':_0x00f8('0xd')},'type':{'type':Sequelize[_0x00f8('0xc')](_0x00f8('0xf'),_0x00f8('0x10')),'allowNull':![],'defaultValue':_0x00f8('0xf')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x00f8('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 6f7b5e3..8ff6249 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 _0x3a60=['show','params','rawAttributes','keys','fields','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','map','Schedule','type','key','model','query','filters','attributes','intersection','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch'];(function(_0x4b9eec,_0x2dfbb0){var _0x2f530f=function(_0x4b87d6){while(--_0x4b87d6){_0x4b9eec['push'](_0x4b9eec['shift']());}};_0x2f530f(++_0x2dfbb0);}(_0x3a60,0xb1));var _0x03a6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3a60[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x03a6('0x0'));var emlformat=require(_0x03a6('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x03a6('0x2'));var rp=require(_0x03a6('0x3'));var moment=require('moment');var BPromise=require(_0x03a6('0x4'));var Mustache=require(_0x03a6('0x5'));var util=require(_0x03a6('0x6'));var path=require(_0x03a6('0x7'));var sox=require(_0x03a6('0x8'));var csv=require(_0x03a6('0x9'));var ejs=require(_0x03a6('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x03a6('0xb'));var jsforce=require(_0x03a6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x03a6('0x9'));var querystring=require(_0x03a6('0xd'));var Papa=require(_0x03a6('0xe'));var Redis=require('ioredis');var authService=require(_0x03a6('0xf'));var qs=require(_0x03a6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x03a6('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x03a6('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x03a6('0x13'))['db'];function respondWithStatusCode(_0x3d86ee,_0x4ac7a1){_0x4ac7a1=_0x4ac7a1||0xcc;return function(_0x10027f){if(_0x10027f){return _0x3d86ee[_0x03a6('0x14')](_0x4ac7a1);}return _0x3d86ee[_0x03a6('0x15')](_0x4ac7a1)[_0x03a6('0x16')]();};}function respondWithResult(_0x3901a5,_0x26bf9d){_0x26bf9d=_0x26bf9d||0xc8;return function(_0x1407b8){if(_0x1407b8){return _0x3901a5['status'](_0x26bf9d)['json'](_0x1407b8);}};}function respondWithFilteredResult(_0x4d7264,_0x5a4758){return function(_0x5d3ba2){if(_0x5d3ba2){var _0x20127d=_0x5d3ba2[_0x03a6('0x17')],_0x592914=_0x5a4758[_0x03a6('0x18')],_0x3d4e27=_0x5a4758['offset']+_0x5a4758[_0x03a6('0x19')],_0x5be9d6;if(_0x3d4e27>=_0x20127d){_0x3d4e27=_0x20127d;_0x5be9d6=0xc8;}else{_0x5be9d6=0xce;}_0x4d7264[_0x03a6('0x15')](_0x5be9d6);return _0x4d7264[_0x03a6('0x1a')](_0x03a6('0x1b'),_0x592914+'-'+_0x3d4e27+'/'+_0x20127d)[_0x03a6('0x1c')](_0x5d3ba2);}return null;};}function patchUpdates(_0x4fe555){return function(_0x81d160){try{jsonpatch[_0x03a6('0x1d')](_0x81d160,_0x4fe555,!![]);}catch(_0x3adebb){return BPromise[_0x03a6('0x1e')](_0x3adebb);}return _0x81d160[_0x03a6('0x1f')]();};}function saveUpdates(_0x2df1ef,_0x53d7da){return function(_0x54c7e5){if(_0x54c7e5){return _0x54c7e5[_0x03a6('0x20')](_0x2df1ef)[_0x03a6('0x21')](function(_0x2f6dbd){return _0x2f6dbd;});}return null;};}function removeEntity(_0x159183,_0x1ec5e6){return function(_0x3198b2){if(_0x3198b2){return _0x3198b2[_0x03a6('0x22')]()['then'](function(){var _0x3bac58=_0x3198b2[_0x03a6('0x23')]({'plain':!![]});var _0x37825c=_0x03a6('0x24');return db[_0x03a6('0x25')][_0x03a6('0x22')]({'where':{'type':_0x37825c,'resourceId':_0x3bac58['id']}})['then'](function(){return _0x3198b2;});})[_0x03a6('0x21')](function(){_0x159183[_0x03a6('0x15')](0xcc)[_0x03a6('0x16')]();});}};}function handleEntityNotFound(_0x32189e,_0x259c60){return function(_0x47ee19){if(!_0x47ee19){_0x32189e[_0x03a6('0x14')](0x194);}return _0x47ee19;};}function handleError(_0x18700f,_0x1aeaa6){_0x1aeaa6=_0x1aeaa6||0x1f4;return function(_0xc59b80){logger[_0x03a6('0x26')](_0xc59b80[_0x03a6('0x27')]);if(_0xc59b80[_0x03a6('0x28')]){delete _0xc59b80[_0x03a6('0x28')];}_0x18700f[_0x03a6('0x15')](_0x1aeaa6)[_0x03a6('0x29')](_0xc59b80);};}exports['index']=function(_0x361162,_0x4ba0cf){var _0x1df58e={},_0x29272f={},_0x5f37c3={'count':0x0,'rows':[]};var _0x5111cf=_[_0x03a6('0x2a')](db[_0x03a6('0x2b')]['rawAttributes'],function(_0x3f6632){return{'name':_0x3f6632['fieldName'],'type':_0x3f6632[_0x03a6('0x2c')][_0x03a6('0x2d')]};});_0x29272f[_0x03a6('0x2e')]=_[_0x03a6('0x2a')](_0x5111cf,'name');_0x29272f['query']=_['keys'](_0x361162[_0x03a6('0x2f')]);_0x29272f[_0x03a6('0x30')]=_['intersection'](_0x29272f[_0x03a6('0x2e')],_0x29272f[_0x03a6('0x2f')]);_0x1df58e[_0x03a6('0x31')]=_[_0x03a6('0x32')](_0x29272f['model'],qs['fields'](_0x361162[_0x03a6('0x2f')]['fields']));_0x1df58e[_0x03a6('0x31')]=_0x1df58e['attributes'][_0x03a6('0x33')]?_0x1df58e[_0x03a6('0x31')]:_0x29272f[_0x03a6('0x2e')];if(!_0x361162['query']['hasOwnProperty'](_0x03a6('0x34'))){_0x1df58e[_0x03a6('0x19')]=qs['limit'](_0x361162[_0x03a6('0x2f')][_0x03a6('0x19')]);_0x1df58e[_0x03a6('0x18')]=qs[_0x03a6('0x18')](_0x361162[_0x03a6('0x2f')]['offset']);}_0x1df58e[_0x03a6('0x35')]=qs['sort'](_0x361162['query'][_0x03a6('0x36')]);_0x1df58e[_0x03a6('0x37')]=qs[_0x03a6('0x30')](_[_0x03a6('0x38')](_0x361162[_0x03a6('0x2f')],_0x29272f[_0x03a6('0x30')]),_0x5111cf);if(_0x361162[_0x03a6('0x2f')][_0x03a6('0x39')]){_0x1df58e['where']=_['merge'](_0x1df58e[_0x03a6('0x37')],{'$or':_[_0x03a6('0x2a')](_0x5111cf,function(_0x32ca7d){if(_0x32ca7d[_0x03a6('0x2c')]!==_0x03a6('0x3a')){var _0xf6ae5d={};_0xf6ae5d[_0x32ca7d[_0x03a6('0x28')]]={'$like':'%'+_0x361162[_0x03a6('0x2f')]['filter']+'%'};return _0xf6ae5d;}})});}_0x1df58e=_[_0x03a6('0x3b')]({},_0x1df58e,_0x361162[_0x03a6('0x3c')]);var _0x12722e={'where':_0x1df58e[_0x03a6('0x37')]};return db[_0x03a6('0x2b')]['count'](_0x12722e)['then'](function(_0x5015cd){_0x5f37c3[_0x03a6('0x17')]=_0x5015cd;if(_0x361162[_0x03a6('0x2f')][_0x03a6('0x3d')]){_0x1df58e[_0x03a6('0x3e')]=[{'all':!![]}];}return db[_0x03a6('0x2b')][_0x03a6('0x3f')](_0x1df58e);})[_0x03a6('0x21')](function(_0x1e25a6){_0x5f37c3[_0x03a6('0x40')]=_0x1e25a6;return _0x5f37c3;})[_0x03a6('0x21')](respondWithFilteredResult(_0x4ba0cf,_0x1df58e))[_0x03a6('0x41')](handleError(_0x4ba0cf,null));};exports[_0x03a6('0x42')]=function(_0x19de42,_0x5b9b11){var _0x4f2039={'raw':![],'where':{'id':_0x19de42[_0x03a6('0x43')]['id']}},_0x2a91fd={};_0x2a91fd['model']=_['keys'](db[_0x03a6('0x2b')][_0x03a6('0x44')]);_0x2a91fd['query']=_[_0x03a6('0x45')](_0x19de42['query']);_0x2a91fd['filters']=_['intersection'](_0x2a91fd['model'],_0x2a91fd[_0x03a6('0x2f')]);_0x4f2039[_0x03a6('0x31')]=_[_0x03a6('0x32')](_0x2a91fd[_0x03a6('0x2e')],qs[_0x03a6('0x46')](_0x19de42[_0x03a6('0x2f')][_0x03a6('0x46')]));_0x4f2039[_0x03a6('0x31')]=_0x4f2039['attributes']['length']?_0x4f2039[_0x03a6('0x31')]:_0x2a91fd[_0x03a6('0x2e')];if(_0x19de42[_0x03a6('0x2f')][_0x03a6('0x3d')]){_0x4f2039[_0x03a6('0x3e')]=[{'all':!![]}];}_0x4f2039=_[_0x03a6('0x3b')]({},_0x4f2039,_0x19de42[_0x03a6('0x3c')]);return db[_0x03a6('0x2b')][_0x03a6('0x47')](_0x4f2039)['then'](handleEntityNotFound(_0x5b9b11,null))[_0x03a6('0x21')](respondWithResult(_0x5b9b11,null))[_0x03a6('0x41')](handleError(_0x5b9b11,null));};exports[_0x03a6('0x48')]=function(_0x2a05c9,_0x228d0f){return db[_0x03a6('0x2b')][_0x03a6('0x48')](_0x2a05c9[_0x03a6('0x49')],{})[_0x03a6('0x21')](function(_0x5dc780){var _0x5deb75=_0x2a05c9[_0x03a6('0x4a')][_0x03a6('0x23')]({'plain':!![]});if(!_0x5deb75)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5deb75[_0x03a6('0x4b')]===_0x03a6('0x4a')){var _0x2632ad=_0x5dc780['get']({'plain':!![]});var _0x39d0bc=_0x03a6('0x24');return db[_0x03a6('0x4c')][_0x03a6('0x47')]({'where':{'name':_0x39d0bc,'userProfileId':_0x5deb75[_0x03a6('0x4d')]},'raw':!![]})[_0x03a6('0x21')](function(_0x230ef6){if(_0x230ef6&&_0x230ef6['autoAssociation']===0x0){return db[_0x03a6('0x25')]['create']({'name':_0x2632ad[_0x03a6('0x28')],'resourceId':_0x2632ad['id'],'type':_0x230ef6['name'],'sectionId':_0x230ef6['id']},{})['then'](function(){return _0x5dc780;});}else{return _0x5dc780;}})[_0x03a6('0x41')](function(_0x46ec70){logger[_0x03a6('0x26')](_0x03a6('0x4e'),_0x46ec70);throw _0x46ec70;});}return _0x5dc780;})[_0x03a6('0x21')](respondWithResult(_0x228d0f,0xc9))[_0x03a6('0x41')](handleError(_0x228d0f,null));};exports[_0x03a6('0x20')]=function(_0x2e2d7e,_0x451f7f){if(_0x2e2d7e[_0x03a6('0x49')]['id']){delete _0x2e2d7e[_0x03a6('0x49')]['id'];}return db[_0x03a6('0x2b')]['find']({'where':{'id':_0x2e2d7e[_0x03a6('0x43')]['id']}})[_0x03a6('0x21')](handleEntityNotFound(_0x451f7f,null))[_0x03a6('0x21')](saveUpdates(_0x2e2d7e[_0x03a6('0x49')],null))['then'](respondWithResult(_0x451f7f,null))['catch'](handleError(_0x451f7f,null));};exports['destroy']=function(_0x4ad5c1,_0x22c4ef){return db['Schedule'][_0x03a6('0x47')]({'where':{'id':_0x4ad5c1[_0x03a6('0x43')]['id']}})[_0x03a6('0x21')](handleEntityNotFound(_0x22c4ef,null))[_0x03a6('0x21')](removeEntity(_0x22c4ef,null))[_0x03a6('0x41')](handleError(_0x22c4ef,null));};exports[_0x03a6('0x4f')]=function(_0x1c4eb2,_0x1c982a,_0x212ac4){var _0x2866a1=require(_0x03a6('0x50'));return db[_0x03a6('0x2b')][_0x03a6('0x47')]({'where':{'id':_0x1c4eb2[_0x03a6('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1c982a,null))[_0x03a6('0x21')](function(){_0x2866a1[_0x03a6('0x4f')](_0x1c4eb2['params']['id']);})[_0x03a6('0x21')](respondWithStatusCode(_0x1c982a,null))[_0x03a6('0x41')](handleError(_0x1c982a,null));}; \ No newline at end of file +var _0x332f=['name','send','index','map','Schedule','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','autoAssociation','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error'];(function(_0x48ab04,_0x160f27){var _0x1904e4=function(_0x8bacd9){while(--_0x8bacd9){_0x48ab04['push'](_0x48ab04['shift']());}};_0x1904e4(++_0x160f27);}(_0x332f,0x1da));var _0xf332=function(_0x33f3e7,_0x57d963){_0x33f3e7=_0x33f3e7-0x0;var _0x5a9d31=_0x332f[_0x33f3e7];return _0x5a9d31;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf332('0x0'));var rimraf=require(_0xf332('0x1'));var zipdir=require(_0xf332('0x2'));var jsonpatch=require(_0xf332('0x3'));var rp=require(_0xf332('0x4'));var moment=require(_0xf332('0x5'));var BPromise=require(_0xf332('0x6'));var Mustache=require(_0xf332('0x7'));var util=require(_0xf332('0x8'));var path=require(_0xf332('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf332('0xa'));var squel=require(_0xf332('0xb'));var crypto=require(_0xf332('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf332('0xd'));var toCsv=require(_0xf332('0xe'));var querystring=require(_0xf332('0xf'));var Papa=require(_0xf332('0x10'));var Redis=require(_0xf332('0x11'));var authService=require(_0xf332('0x12'));var qs=require(_0xf332('0x13'));var as=require(_0xf332('0x14'));var hardwareService=require(_0xf332('0x15'));var logger=require(_0xf332('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xf332('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf332('0x18'))['db'];function respondWithStatusCode(_0x4fc738,_0x236724){_0x236724=_0x236724||0xcc;return function(_0x1faad1){if(_0x1faad1){return _0x4fc738[_0xf332('0x19')](_0x236724);}return _0x4fc738[_0xf332('0x1a')](_0x236724)[_0xf332('0x1b')]();};}function respondWithResult(_0x30fa1a,_0x2a1291){_0x2a1291=_0x2a1291||0xc8;return function(_0x48365a){if(_0x48365a){return _0x30fa1a[_0xf332('0x1a')](_0x2a1291)[_0xf332('0x1c')](_0x48365a);}};}function respondWithFilteredResult(_0x2c6984,_0x1a0fdd){return function(_0x3f8a4f){if(_0x3f8a4f){var _0x4a1675=_0x3f8a4f['count'],_0x218be4=_0x1a0fdd[_0xf332('0x1d')],_0x20329b=_0x1a0fdd[_0xf332('0x1d')]+_0x1a0fdd[_0xf332('0x1e')],_0x24e270;if(_0x20329b>=_0x4a1675){_0x20329b=_0x4a1675;_0x24e270=0xc8;}else{_0x24e270=0xce;}_0x2c6984[_0xf332('0x1a')](_0x24e270);return _0x2c6984[_0xf332('0x1f')](_0xf332('0x20'),_0x218be4+'-'+_0x20329b+'/'+_0x4a1675)[_0xf332('0x1c')](_0x3f8a4f);}return null;};}function patchUpdates(_0x54d105){return function(_0x5eafa3){try{jsonpatch[_0xf332('0x21')](_0x5eafa3,_0x54d105,!![]);}catch(_0x1f6bee){return BPromise[_0xf332('0x22')](_0x1f6bee);}return _0x5eafa3[_0xf332('0x23')]();};}function saveUpdates(_0x4b719f,_0x223a19){return function(_0x541785){if(_0x541785){return _0x541785[_0xf332('0x24')](_0x4b719f)[_0xf332('0x25')](function(_0x1f1b43){return _0x1f1b43;});}return null;};}function removeEntity(_0x2e5e54,_0x3fcc8c){return function(_0x38f898){if(_0x38f898){return _0x38f898[_0xf332('0x26')]()[_0xf332('0x25')](function(){var _0x480964=_0x38f898[_0xf332('0x27')]({'plain':!![]});var _0xbc4207='Scheduler';return db[_0xf332('0x28')][_0xf332('0x26')]({'where':{'type':_0xbc4207,'resourceId':_0x480964['id']}})[_0xf332('0x25')](function(){return _0x38f898;});})[_0xf332('0x25')](function(){_0x2e5e54[_0xf332('0x1a')](0xcc)[_0xf332('0x1b')]();});}};}function handleEntityNotFound(_0x48cf28,_0x1f187d){return function(_0x5e6332){if(!_0x5e6332){_0x48cf28[_0xf332('0x19')](0x194);}return _0x5e6332;};}function handleError(_0x357fdc,_0x3931e9){_0x3931e9=_0x3931e9||0x1f4;return function(_0x2c3720){logger[_0xf332('0x29')](_0x2c3720['stack']);if(_0x2c3720[_0xf332('0x2a')]){delete _0x2c3720[_0xf332('0x2a')];}_0x357fdc[_0xf332('0x1a')](_0x3931e9)[_0xf332('0x2b')](_0x2c3720);};}exports[_0xf332('0x2c')]=function(_0x1d019a,_0x102cb0){var _0x2b6c67={},_0x42d4f6={},_0x3f8be2={'count':0x0,'rows':[]};var _0x28b773=_[_0xf332('0x2d')](db[_0xf332('0x2e')]['rawAttributes'],function(_0x327d44){return{'name':_0x327d44[_0xf332('0x2f')],'type':_0x327d44['type'][_0xf332('0x30')]};});_0x42d4f6[_0xf332('0x31')]=_[_0xf332('0x2d')](_0x28b773,'name');_0x42d4f6[_0xf332('0x32')]=_['keys'](_0x1d019a[_0xf332('0x32')]);_0x42d4f6[_0xf332('0x33')]=_['intersection'](_0x42d4f6[_0xf332('0x31')],_0x42d4f6['query']);_0x2b6c67['attributes']=_[_0xf332('0x34')](_0x42d4f6[_0xf332('0x31')],qs[_0xf332('0x35')](_0x1d019a[_0xf332('0x32')][_0xf332('0x35')]));_0x2b6c67[_0xf332('0x36')]=_0x2b6c67[_0xf332('0x36')][_0xf332('0x37')]?_0x2b6c67[_0xf332('0x36')]:_0x42d4f6[_0xf332('0x31')];if(!_0x1d019a[_0xf332('0x32')][_0xf332('0x38')]('nolimit')){_0x2b6c67[_0xf332('0x1e')]=qs['limit'](_0x1d019a[_0xf332('0x32')][_0xf332('0x1e')]);_0x2b6c67['offset']=qs['offset'](_0x1d019a[_0xf332('0x32')][_0xf332('0x1d')]);}_0x2b6c67[_0xf332('0x39')]=qs[_0xf332('0x3a')](_0x1d019a[_0xf332('0x32')]['sort']);_0x2b6c67[_0xf332('0x3b')]=qs[_0xf332('0x33')](_[_0xf332('0x3c')](_0x1d019a[_0xf332('0x32')],_0x42d4f6[_0xf332('0x33')]),_0x28b773);if(_0x1d019a[_0xf332('0x32')][_0xf332('0x3d')]){_0x2b6c67[_0xf332('0x3b')]=_[_0xf332('0x3e')](_0x2b6c67[_0xf332('0x3b')],{'$or':_['map'](_0x28b773,function(_0x687f95){if(_0x687f95[_0xf332('0x3f')]!==_0xf332('0x40')){var _0x2fb401={};_0x2fb401[_0x687f95['name']]={'$like':'%'+_0x1d019a[_0xf332('0x32')][_0xf332('0x3d')]+'%'};return _0x2fb401;}})});}_0x2b6c67=_[_0xf332('0x3e')]({},_0x2b6c67,_0x1d019a['options']);var _0x470c14={'where':_0x2b6c67['where']};return db[_0xf332('0x2e')][_0xf332('0x41')](_0x470c14)['then'](function(_0x44b24c){_0x3f8be2[_0xf332('0x41')]=_0x44b24c;if(_0x1d019a[_0xf332('0x32')][_0xf332('0x42')]){_0x2b6c67[_0xf332('0x43')]=[{'all':!![]}];}return db[_0xf332('0x2e')][_0xf332('0x44')](_0x2b6c67);})[_0xf332('0x25')](function(_0x3994f2){_0x3f8be2[_0xf332('0x45')]=_0x3994f2;return _0x3f8be2;})[_0xf332('0x25')](respondWithFilteredResult(_0x102cb0,_0x2b6c67))[_0xf332('0x46')](handleError(_0x102cb0,null));};exports[_0xf332('0x47')]=function(_0x4ee78b,_0x4f1411){var _0x17475e={'raw':![],'where':{'id':_0x4ee78b[_0xf332('0x48')]['id']}},_0x315280={};_0x315280[_0xf332('0x31')]=_[_0xf332('0x49')](db[_0xf332('0x2e')][_0xf332('0x4a')]);_0x315280['query']=_[_0xf332('0x49')](_0x4ee78b[_0xf332('0x32')]);_0x315280[_0xf332('0x33')]=_[_0xf332('0x34')](_0x315280['model'],_0x315280[_0xf332('0x32')]);_0x17475e[_0xf332('0x36')]=_[_0xf332('0x34')](_0x315280[_0xf332('0x31')],qs[_0xf332('0x35')](_0x4ee78b[_0xf332('0x32')]['fields']));_0x17475e[_0xf332('0x36')]=_0x17475e[_0xf332('0x36')][_0xf332('0x37')]?_0x17475e[_0xf332('0x36')]:_0x315280['model'];if(_0x4ee78b[_0xf332('0x32')][_0xf332('0x42')]){_0x17475e[_0xf332('0x43')]=[{'all':!![]}];}_0x17475e=_[_0xf332('0x3e')]({},_0x17475e,_0x4ee78b[_0xf332('0x4b')]);return db['Schedule'][_0xf332('0x4c')](_0x17475e)[_0xf332('0x25')](handleEntityNotFound(_0x4f1411,null))[_0xf332('0x25')](respondWithResult(_0x4f1411,null))[_0xf332('0x46')](handleError(_0x4f1411,null));};exports['create']=function(_0xad2158,_0x213b46){return db[_0xf332('0x2e')][_0xf332('0x4d')](_0xad2158[_0xf332('0x4e')],{})[_0xf332('0x25')](function(_0x23b2ff){var _0x2d1afb=_0xad2158[_0xf332('0x4f')][_0xf332('0x27')]({'plain':!![]});if(!_0x2d1afb)throw new Error(_0xf332('0x50'));if(_0x2d1afb[_0xf332('0x51')]==='user'){var _0x3495c1=_0x23b2ff[_0xf332('0x27')]({'plain':!![]});var _0x525249=_0xf332('0x52');return db['UserProfileSection'][_0xf332('0x4c')]({'where':{'name':_0x525249,'userProfileId':_0x2d1afb['userProfileId']},'raw':!![]})[_0xf332('0x25')](function(_0x31c86f){if(_0x31c86f&&_0x31c86f[_0xf332('0x53')]===0x0){return db[_0xf332('0x28')][_0xf332('0x4d')]({'name':_0x3495c1[_0xf332('0x2a')],'resourceId':_0x3495c1['id'],'type':_0x31c86f[_0xf332('0x2a')],'sectionId':_0x31c86f['id']},{})[_0xf332('0x25')](function(){return _0x23b2ff;});}else{return _0x23b2ff;}})['catch'](function(_0x32ac0d){logger[_0xf332('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32ac0d);throw _0x32ac0d;});}return _0x23b2ff;})[_0xf332('0x25')](respondWithResult(_0x213b46,0xc9))['catch'](handleError(_0x213b46,null));};exports[_0xf332('0x24')]=function(_0x372d0f,_0x360355){if(_0x372d0f[_0xf332('0x4e')]['id']){delete _0x372d0f[_0xf332('0x4e')]['id'];}return db[_0xf332('0x2e')]['find']({'where':{'id':_0x372d0f[_0xf332('0x48')]['id']}})[_0xf332('0x25')](handleEntityNotFound(_0x360355,null))[_0xf332('0x25')](saveUpdates(_0x372d0f['body'],null))[_0xf332('0x25')](respondWithResult(_0x360355,null))[_0xf332('0x46')](handleError(_0x360355,null));};exports[_0xf332('0x26')]=function(_0x48e69a,_0x5711d2){return db['Schedule'][_0xf332('0x4c')]({'where':{'id':_0x48e69a['params']['id']}})[_0xf332('0x25')](handleEntityNotFound(_0x5711d2,null))[_0xf332('0x25')](removeEntity(_0x5711d2,null))[_0xf332('0x46')](handleError(_0x5711d2,null));};exports[_0xf332('0x54')]=function(_0x5099da,_0x15964d,_0x3ccf81){var _0x29843e=require(_0xf332('0x55'));return db[_0xf332('0x2e')][_0xf332('0x4c')]({'where':{'id':_0x5099da[_0xf332('0x48')]['id']},'raw':!![]})[_0xf332('0x25')](handleEntityNotFound(_0x15964d,null))[_0xf332('0x25')](function(){_0x29843e[_0xf332('0x54')](_0x5099da['params']['id']);})[_0xf332('0x25')](respondWithStatusCode(_0x15964d,null))[_0xf332('0x46')](handleError(_0x15964d,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index d2f996a..54ce8b1 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 _0x2b13=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./schedule.attributes','define','Schedule','tools_schedules','lodash','util','../../config/logger'];(function(_0x2a04df,_0x48f2de){var _0x1369a2=function(_0x11724e){while(--_0x11724e){_0x2a04df['push'](_0x2a04df['shift']());}};_0x1369a2(++_0x48f2de);}(_0x2b13,0x169));var _0x32b1=function(_0x52a792,_0x594537){_0x52a792=_0x52a792-0x0;var _0x6422f6=_0x2b13[_0x52a792];return _0x6422f6;};'use strict';var _=require(_0x32b1('0x0'));var util=require(_0x32b1('0x1'));var logger=require(_0x32b1('0x2'))(_0x32b1('0x3'));var moment=require(_0x32b1('0x4'));var BPromise=require(_0x32b1('0x5'));var rp=require(_0x32b1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x32b1('0x7'));var config=require(_0x32b1('0x8'));var attributes=require(_0x32b1('0x9'));module['exports']=function(_0x3998a4,_0x38b817){return _0x3998a4[_0x32b1('0xa')](_0x32b1('0xb'),attributes,{'tableName':_0x32b1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7221=['bluebird','request-promise','path','rimraf','../../config/environment','tools_schedules','lodash','../../config/logger','api','moment'];(function(_0x2eb97e,_0x28342f){var _0x14b474=function(_0x16fee9){while(--_0x16fee9){_0x2eb97e['push'](_0x2eb97e['shift']());}};_0x14b474(++_0x28342f);}(_0x7221,0xb0));var _0x1722=function(_0x4d1c45,_0x6ff874){_0x4d1c45=_0x4d1c45-0x0;var _0x44775c=_0x7221[_0x4d1c45];return _0x44775c;};'use strict';var _=require(_0x1722('0x0'));var util=require('util');var logger=require(_0x1722('0x1'))(_0x1722('0x2'));var moment=require(_0x1722('0x3'));var BPromise=require(_0x1722('0x4'));var rp=require(_0x1722('0x5'));var fs=require('fs');var path=require(_0x1722('0x6'));var rimraf=require(_0x1722('0x7'));var config=require(_0x1722('0x8'));var attributes=require('./schedule.attributes');module['exports']=function(_0x3a7398,_0x1e6702){return _0x3a7398['define']('Schedule',attributes,{'tableName':_0x1722('0x9'),'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 1dc4823..1cce731 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 _0xdc86=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x392735,_0x531194){var _0x4b5057=function(_0x114f46){while(--_0x114f46){_0x392735['push'](_0x392735['shift']());}};_0x4b5057(++_0x531194);}(_0xdc86,0x8a));var _0x6dc8=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xdc86[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0x6dc8('0x0'));var util=require(_0x6dc8('0x1'));var moment=require(_0x6dc8('0x2'));var BPromise=require(_0x6dc8('0x3'));var rs=require(_0x6dc8('0x4'));var fs=require('fs');var Redis=require(_0x6dc8('0x5'));var db=require(_0x6dc8('0x6'))['db'];var utils=require(_0x6dc8('0x7'));var logger=require('../../config/logger')(_0x6dc8('0x8'));var config=require(_0x6dc8('0x9'));var jayson=require(_0x6dc8('0xa'));var client=jayson[_0x6dc8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42d665,_0x296a01,_0x556d7f){return new BPromise(function(_0x784d91,_0xe98a3a){return client[_0x6dc8('0xc')](_0x42d665,_0x556d7f)['then'](function(_0x14f0c3){logger[_0x6dc8('0xd')](_0x6dc8('0xe'),_0x296a01,'request\x20sent');logger[_0x6dc8('0xf')](_0x6dc8('0x10'),_0x296a01,_0x6dc8('0x11'),JSON[_0x6dc8('0x12')](_0x14f0c3));if(_0x14f0c3['error']){if(_0x14f0c3[_0x6dc8('0x13')][_0x6dc8('0x14')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x296a01,_0x14f0c3[_0x6dc8('0x13')]['message']);return _0xe98a3a(_0x14f0c3[_0x6dc8('0x13')][_0x6dc8('0x15')]);}logger['error'](_0x6dc8('0xe'),_0x296a01,_0x14f0c3[_0x6dc8('0x13')][_0x6dc8('0x15')]);return _0x784d91(_0x14f0c3[_0x6dc8('0x13')]['message']);}else{logger[_0x6dc8('0xd')]('Schedule,\x20%s,\x20%s',_0x296a01,_0x6dc8('0x11'));_0x784d91(_0x14f0c3['result'][_0x6dc8('0x15')]);}})[_0x6dc8('0x16')](function(_0x3f665d){logger[_0x6dc8('0x13')](_0x6dc8('0xe'),_0x296a01,_0x3f665d);_0xe98a3a(_0x3f665d);});});} \ No newline at end of file +var _0x1fed=['error','code','message','info','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x41920b,_0x2d534f){var _0x4294af=function(_0x25d1a3){while(--_0x25d1a3){_0x41920b['push'](_0x41920b['shift']());}};_0x4294af(++_0x2d534f);}(_0x1fed,0xcc));var _0xd1fe=function(_0x4c644c,_0x1a5d4f){_0x4c644c=_0x4c644c-0x0;var _0x18b89e=_0x1fed[_0x4c644c];return _0x18b89e;};'use strict';var _=require(_0xd1fe('0x0'));var util=require('util');var moment=require(_0xd1fe('0x1'));var BPromise=require('bluebird');var rs=require(_0xd1fe('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd1fe('0x3'));var logger=require(_0xd1fe('0x4'))(_0xd1fe('0x5'));var config=require(_0xd1fe('0x6'));var jayson=require(_0xd1fe('0x7'));var client=jayson[_0xd1fe('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fae2c,_0x5616de,_0x317928){return new BPromise(function(_0x36dc19,_0xfb8d0){return client[_0xd1fe('0x9')](_0x1fae2c,_0x317928)[_0xd1fe('0xa')](function(_0x368f06){logger['info'](_0xd1fe('0xb'),_0x5616de,'request\x20sent');logger[_0xd1fe('0xc')](_0xd1fe('0xd'),_0x5616de,_0xd1fe('0xe'),JSON[_0xd1fe('0xf')](_0x368f06));if(_0x368f06[_0xd1fe('0x10')]){if(_0x368f06['error'][_0xd1fe('0x11')]===0x1f4){logger[_0xd1fe('0x10')]('Schedule,\x20%s,\x20%s',_0x5616de,_0x368f06[_0xd1fe('0x10')]['message']);return _0xfb8d0(_0x368f06[_0xd1fe('0x10')]['message']);}logger['error'](_0xd1fe('0xb'),_0x5616de,_0x368f06[_0xd1fe('0x10')]['message']);return _0x36dc19(_0x368f06[_0xd1fe('0x10')][_0xd1fe('0x12')]);}else{logger[_0xd1fe('0x13')](_0xd1fe('0xb'),_0x5616de,_0xd1fe('0xe'));_0x36dc19(_0x368f06[_0xd1fe('0x14')]['message']);}})[_0xd1fe('0x15')](function(_0x2a0c83){logger[_0xd1fe('0x10')](_0xd1fe('0xb'),_0x5616de,_0x2a0c83);_0xfb8d0(_0x2a0c83);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 1b0efe7..313732c 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 _0x85e7=['create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','/:id'];(function(_0x23fdae,_0xeaa17a){var _0x33efc3=function(_0x2c61e1){while(--_0x2c61e1){_0x23fdae['push'](_0x23fdae['shift']());}};_0x33efc3(++_0xeaa17a);}(_0x85e7,0x16b));var _0x785e=function(_0x471a87,_0x454edc){_0x471a87=_0x471a87-0x0;var _0x1b0340=_0x85e7[_0x471a87];return _0x1b0340;};'use strict';var multer=require('multer');var util=require(_0x785e('0x0'));var path=require(_0x785e('0x1'));var timeout=require('connect-timeout');var express=require(_0x785e('0x2'));var router=express[_0x785e('0x3')]();var auth=require(_0x785e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x785e('0x5'));var controller=require('./screenRecording.controller');router['get']('/',auth[_0x785e('0x6')](),controller[_0x785e('0x7')]);router[_0x785e('0x8')](_0x785e('0x9'),auth[_0x785e('0x6')](),controller['describe']);router[_0x785e('0x8')](_0x785e('0xa'),auth[_0x785e('0x6')](),controller['show']);router[_0x785e('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x785e('0xb')]);router[_0x785e('0xc')](_0x785e('0xa'),auth[_0x785e('0x6')](),controller[_0x785e('0xd')]);router[_0x785e('0xe')](_0x785e('0xa'),auth[_0x785e('0x6')](),controller[_0x785e('0xf')]);module[_0x785e('0x10')]=router; \ No newline at end of file +var _0xe25d=['/describe','describe','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','./screenRecording.controller','get','isAuthenticated'];(function(_0xb76f4e,_0x33038f){var _0x523c4c=function(_0x180378){while(--_0x180378){_0xb76f4e['push'](_0xb76f4e['shift']());}};_0x523c4c(++_0x33038f);}(_0xe25d,0x14c));var _0xde25=function(_0x3bbfc8,_0x39520d){_0x3bbfc8=_0x3bbfc8-0x0;var _0x4f8707=_0xe25d[_0x3bbfc8];return _0x4f8707;};'use strict';var multer=require(_0xde25('0x0'));var util=require(_0xde25('0x1'));var path=require(_0xde25('0x2'));var timeout=require(_0xde25('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xde25('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xde25('0x5'));router[_0xde25('0x6')]('/',auth[_0xde25('0x7')](),controller['index']);router[_0xde25('0x6')](_0xde25('0x8'),auth['isAuthenticated'](),controller[_0xde25('0x9')]);router[_0xde25('0x6')](_0xde25('0xa'),auth['isAuthenticated'](),controller[_0xde25('0xb')]);router[_0xde25('0x6')](_0xde25('0xc'),auth[_0xde25('0x7')](),controller[_0xde25('0xd')]);router[_0xde25('0xe')]('/',auth[_0xde25('0x7')](),controller[_0xde25('0xf')]);router[_0xde25('0x10')](_0xde25('0xa'),auth[_0xde25('0x7')](),controller['update']);router[_0xde25('0x11')](_0xde25('0xa'),auth[_0xde25('0x7')](),controller[_0xde25('0x12')]);module[_0xde25('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index c2b5783..0ffa203 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 _0xbd50=['setDataValue','DATE','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','INTEGER','startedAt','subtract','closedAt'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd50,0x196));var _0x0bd5=function(_0x5943f6,_0x5c5715){_0x5943f6=_0x5943f6-0x0;var _0x1d2e0f=_0xbd50[_0x5943f6];return _0x1d2e0f;};'use strict';var Sequelize=require(_0x0bd5('0x0'));var moment=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var config=require('../../config/environment');module[_0x0bd5('0x3')]={'format':{'type':Sequelize[_0x0bd5('0x4')],'get':function(){return this[_0x0bd5('0x5')](_0x0bd5('0x6'))?path[_0x0bd5('0x7')](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0bd5('0x8')]},'value':{'type':Sequelize[_0x0bd5('0x8')],'set':function(_0xcc6cfa){var _0x2c0db1=_0xcc6cfa[_0x0bd5('0x9')](/\\/g,'/');this['setDataValue']('value',_0x2c0db1);}},'rating':{'type':Sequelize[_0x0bd5('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x0bd5('0xa')],'set':function(_0x259f4c){this['setDataValue'](_0x0bd5('0xb'),moment()[_0x0bd5('0xc')](_0x259f4c,'ms'));this['setDataValue'](_0x0bd5('0xd'),moment());this[_0x0bd5('0xe')]('duration',_0x259f4c);}},'startedAt':{'type':Sequelize[_0x0bd5('0xf')],'get':function(){return moment(this[_0x0bd5('0x5')](_0x0bd5('0xb')))['format'](_0x0bd5('0x10'))[_0x0bd5('0x11')]();}},'closedAt':{'type':Sequelize[_0x0bd5('0xf')],'get':function(){return moment(this[_0x0bd5('0x5')](_0x0bd5('0xd')))[_0x0bd5('0x12')](_0x0bd5('0x10'))[_0x0bd5('0x11')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0bd5('0x5')](_0x0bd5('0x13')))['format'](_0x0bd5('0x10'))[_0x0bd5('0x11')]();}},'updatedAt':{'type':Sequelize[_0x0bd5('0xf')],'get':function(){return moment(this[_0x0bd5('0x5')]('updatedAt'))[_0x0bd5('0x12')](_0x0bd5('0x10'))[_0x0bd5('0x11')]();}}}; \ No newline at end of file +var _0xbd50=['setDataValue','DATE','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','INTEGER','startedAt','subtract','closedAt'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd50,0x196));var _0x0bd5=function(_0x12cbd8,_0x8ef0ce){_0x12cbd8=_0x12cbd8-0x0;var _0x2fb1ab=_0xbd50[_0x12cbd8];return _0x2fb1ab;};'use strict';var Sequelize=require(_0x0bd5('0x0'));var moment=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var config=require('../../config/environment');module[_0x0bd5('0x3')]={'format':{'type':Sequelize[_0x0bd5('0x4')],'get':function(){return this[_0x0bd5('0x5')](_0x0bd5('0x6'))?path[_0x0bd5('0x7')](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0bd5('0x8')]},'value':{'type':Sequelize[_0x0bd5('0x8')],'set':function(_0xcc6cfa){var _0x2c0db1=_0xcc6cfa[_0x0bd5('0x9')](/\\/g,'/');this['setDataValue']('value',_0x2c0db1);}},'rating':{'type':Sequelize[_0x0bd5('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x0bd5('0xa')],'set':function(_0x259f4c){this['setDataValue'](_0x0bd5('0xb'),moment()[_0x0bd5('0xc')](_0x259f4c,'ms'));this['setDataValue'](_0x0bd5('0xd'),moment());this[_0x0bd5('0xe')]('duration',_0x259f4c);}},'startedAt':{'type':Sequelize[_0x0bd5('0xf')],'get':function(){return moment(this[_0x0bd5('0x5')](_0x0bd5('0xb')))['format'](_0x0bd5('0x10'))[_0x0bd5('0x11')]();}},'closedAt':{'type':Sequelize[_0x0bd5('0xf')],'get':function(){return moment(this[_0x0bd5('0x5')](_0x0bd5('0xd')))[_0x0bd5('0x12')](_0x0bd5('0x10'))[_0x0bd5('0x11')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0bd5('0x5')](_0x0bd5('0x13')))['format'](_0x0bd5('0x10'))[_0x0bd5('0x11')]();}},'updatedAt':{'type':Sequelize[_0x0bd5('0xf')],'get':function(){return moment(this[_0x0bd5('0x5')]('updatedAt'))[_0x0bd5('0x12')](_0x0bd5('0x10'))[_0x0bd5('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 9a99e30..2741449 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 _0xba07=['lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','type','key','map','format','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','ScreenRecording','findAll','catch','params','create','body','createdAt','closedAt','value','describe','download','uniqueid','find','root','server/files/screen_recordings','decryptFile','recording','join','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','info','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','eml-format','request-promise','moment','bluebird','mustache','path','to-csv','ejs'];(function(_0x51d8ce,_0x1c1e94){var _0x4effbf=function(_0x5788df){while(--_0x5788df){_0x51d8ce['push'](_0x51d8ce['shift']());}};_0x4effbf(++_0x1c1e94);}(_0xba07,0x117));var _0x7ba0=function(_0xd3f369,_0x3010fc){_0xd3f369=_0xd3f369-0x0;var _0x17bc1c=_0xba07[_0xd3f369];return _0x17bc1c;};'use strict';var pdf=require(_0x7ba0('0x0'));var emlformat=require(_0x7ba0('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7ba0('0x2'));var moment=require(_0x7ba0('0x3'));var BPromise=require(_0x7ba0('0x4'));var Mustache=require(_0x7ba0('0x5'));var util=require('util');var path=require(_0x7ba0('0x6'));var sox=require('sox');var csv=require(_0x7ba0('0x7'));var ejs=require(_0x7ba0('0x8'));var fs=require('fs');var _=require(_0x7ba0('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7ba0('0xa'));var deskjs=require(_0x7ba0('0xb'));var toCsv=require(_0x7ba0('0x7'));var querystring=require(_0x7ba0('0xc'));var Papa=require(_0x7ba0('0xd'));var Redis=require(_0x7ba0('0xe'));var authService=require(_0x7ba0('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7ba0('0x10'));var hardwareService=require(_0x7ba0('0x11'));var logger=require(_0x7ba0('0x12'))('api');var utils=require(_0x7ba0('0x13'));var config=require(_0x7ba0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7ba0('0x15'))['db'];function respondWithStatusCode(_0x105c0a,_0x165d4a){_0x165d4a=_0x165d4a||0xcc;return function(_0x7dd0b5){if(_0x7dd0b5){return _0x105c0a['sendStatus'](_0x165d4a);}return _0x105c0a[_0x7ba0('0x16')](_0x165d4a)[_0x7ba0('0x17')]();};}function respondWithResult(_0x11f9de,_0x1e7cb8){_0x1e7cb8=_0x1e7cb8||0xc8;return function(_0x363d30){if(_0x363d30){return _0x11f9de['status'](_0x1e7cb8)[_0x7ba0('0x18')](_0x363d30);}};}function respondWithFilteredResult(_0xb86135,_0x34ef0d){return function(_0x2dfbde){if(_0x2dfbde){var _0x586011=_0x2dfbde[_0x7ba0('0x19')],_0xe963a4=_0x34ef0d['offset'],_0x11c6dd=_0x34ef0d['offset']+_0x34ef0d[_0x7ba0('0x1a')],_0x52836b;if(_0x11c6dd>=_0x586011){_0x11c6dd=_0x586011;_0x52836b=0xc8;}else{_0x52836b=0xce;}_0xb86135[_0x7ba0('0x16')](_0x52836b);return _0xb86135['set']('Content-Range',_0xe963a4+'-'+_0x11c6dd+'/'+_0x586011)[_0x7ba0('0x18')](_0x2dfbde);}return null;};}function patchUpdates(_0x39a4e9){return function(_0xdad100){try{jsonpatch[_0x7ba0('0x1b')](_0xdad100,_0x39a4e9,!![]);}catch(_0x6bdeaa){return BPromise[_0x7ba0('0x1c')](_0x6bdeaa);}return _0xdad100[_0x7ba0('0x1d')]();};}function saveUpdates(_0x571c1b,_0x479b0d){return function(_0x335af3){if(_0x335af3){return _0x335af3[_0x7ba0('0x1e')](_0x571c1b)[_0x7ba0('0x1f')](function(_0x560371){return _0x560371;});}return null;};}function removeEntity(_0x5ed408,_0x1501bd){return function(_0x275209){if(_0x275209){return _0x275209[_0x7ba0('0x20')]()[_0x7ba0('0x1f')](function(){_0x5ed408[_0x7ba0('0x16')](0xcc)[_0x7ba0('0x17')]();});}};}function handleEntityNotFound(_0x26d6e3,_0x5ebccd){return function(_0x2e8eb5){if(!_0x2e8eb5){_0x26d6e3['sendStatus'](0x194);}return _0x2e8eb5;};}function handleError(_0x295011,_0x11068f){_0x11068f=_0x11068f||0x1f4;return function(_0x171909){logger[_0x7ba0('0x21')](_0x171909[_0x7ba0('0x22')]);if(_0x171909['name']){delete _0x171909[_0x7ba0('0x23')];}_0x295011[_0x7ba0('0x16')](_0x11068f)[_0x7ba0('0x24')](_0x171909);};}exports[_0x7ba0('0x25')]=function(_0x330d4e,_0x2ba518){var _0x2542f1={},_0x56df4c={},_0x85b75a={'count':0x0,'rows':[]};var _0x3268c4=_['map'](db['ScreenRecording'][_0x7ba0('0x26')],function(_0x45146a){return{'name':_0x45146a['fieldName'],'type':_0x45146a[_0x7ba0('0x27')][_0x7ba0('0x28')]};});_0x56df4c['model']=_['differenceBy'](_[_0x7ba0('0x29')](_0x3268c4,_0x7ba0('0x23')),[_0x7ba0('0x2a')]);_0x56df4c[_0x7ba0('0x2b')]=_[_0x7ba0('0x2c')](_0x330d4e[_0x7ba0('0x2b')]);_0x56df4c[_0x7ba0('0x2d')]=_['intersection'](_0x56df4c[_0x7ba0('0x2e')],_0x56df4c[_0x7ba0('0x2b')]);_0x2542f1[_0x7ba0('0x2f')]=_[_0x7ba0('0x30')](_0x56df4c[_0x7ba0('0x2e')],qs[_0x7ba0('0x31')](_0x330d4e[_0x7ba0('0x2b')][_0x7ba0('0x31')]));_0x2542f1[_0x7ba0('0x2f')]=_0x2542f1[_0x7ba0('0x2f')][_0x7ba0('0x32')]?_0x2542f1[_0x7ba0('0x2f')]:_0x56df4c['model'];if(!_0x330d4e[_0x7ba0('0x2b')][_0x7ba0('0x33')](_0x7ba0('0x34'))){_0x2542f1[_0x7ba0('0x1a')]=qs[_0x7ba0('0x1a')](_0x330d4e[_0x7ba0('0x2b')][_0x7ba0('0x1a')]);_0x2542f1[_0x7ba0('0x35')]=qs[_0x7ba0('0x35')](_0x330d4e[_0x7ba0('0x2b')][_0x7ba0('0x35')]);}_0x2542f1[_0x7ba0('0x36')]=qs[_0x7ba0('0x37')](_0x330d4e[_0x7ba0('0x2b')]['sort']);_0x2542f1[_0x7ba0('0x38')]=qs[_0x7ba0('0x2d')](_['pick'](_0x330d4e['query'],_0x56df4c[_0x7ba0('0x2d')]),_0x3268c4);if(_0x330d4e[_0x7ba0('0x2b')][_0x7ba0('0x39')]){_0x2542f1[_0x7ba0('0x38')]=_[_0x7ba0('0x3a')](_0x2542f1[_0x7ba0('0x38')],{'$or':_[_0x7ba0('0x29')](_0x3268c4,function(_0x5cda98){if(_0x5cda98[_0x7ba0('0x27')]!==_0x7ba0('0x3b')){var _0x37e8ca={};_0x37e8ca[_0x5cda98[_0x7ba0('0x23')]]={'$like':'%'+_0x330d4e[_0x7ba0('0x2b')]['filter']+'%'};return _0x37e8ca;}})});}_0x2542f1=_['merge']({},_0x2542f1,_0x330d4e[_0x7ba0('0x3c')]);var _0x53a1c1={'where':_0x2542f1['where']};return db['ScreenRecording'][_0x7ba0('0x19')](_0x53a1c1)[_0x7ba0('0x1f')](function(_0x4720e5){_0x85b75a['count']=_0x4720e5;if(_0x330d4e['query'][_0x7ba0('0x3d')]){_0x2542f1[_0x7ba0('0x3e')]=[{'all':!![]}];}return db[_0x7ba0('0x3f')][_0x7ba0('0x40')](_0x2542f1);})[_0x7ba0('0x1f')](function(_0x59b0dd){_0x85b75a['rows']=_0x59b0dd;return _0x85b75a;})[_0x7ba0('0x1f')](respondWithFilteredResult(_0x2ba518,_0x2542f1))[_0x7ba0('0x41')](handleError(_0x2ba518,null));};exports['show']=function(_0x2d8f1d,_0x310883){var _0x429d07={'raw':![],'where':{'id':_0x2d8f1d[_0x7ba0('0x42')]['id']}},_0x2ea7e4={};_0x2ea7e4[_0x7ba0('0x2e')]=_['keys'](db[_0x7ba0('0x3f')]['rawAttributes']);_0x2ea7e4[_0x7ba0('0x2b')]=_[_0x7ba0('0x2c')](_0x2d8f1d[_0x7ba0('0x2b')]);_0x2ea7e4[_0x7ba0('0x2d')]=_[_0x7ba0('0x30')](_0x2ea7e4['model'],_0x2ea7e4['query']);_0x429d07['attributes']=_[_0x7ba0('0x30')](_0x2ea7e4[_0x7ba0('0x2e')],qs['fields'](_0x2d8f1d[_0x7ba0('0x2b')][_0x7ba0('0x31')]));_0x429d07[_0x7ba0('0x2f')]=_0x429d07['attributes'][_0x7ba0('0x32')]?_0x429d07['attributes']:_0x2ea7e4[_0x7ba0('0x2e')];if(_0x2d8f1d[_0x7ba0('0x2b')][_0x7ba0('0x3d')]){_0x429d07['include']=[{'all':!![]}];}_0x429d07=_[_0x7ba0('0x3a')]({},_0x429d07,_0x2d8f1d[_0x7ba0('0x3c')]);return db['ScreenRecording']['find'](_0x429d07)[_0x7ba0('0x1f')](handleEntityNotFound(_0x310883,null))[_0x7ba0('0x1f')](respondWithResult(_0x310883,null))['catch'](handleError(_0x310883,null));};exports['create']=function(_0xef88,_0x31d12c){return db['ScreenRecording'][_0x7ba0('0x43')](_0xef88[_0x7ba0('0x44')],{})[_0x7ba0('0x1f')](respondWithResult(_0x31d12c,0xc9))['catch'](handleError(_0x31d12c,null));};exports[_0x7ba0('0x1e')]=function(_0x3fb7e8,_0xda55c6){if(_0x3fb7e8['body']['id']){delete _0x3fb7e8[_0x7ba0('0x44')]['id'];}delete _0x3fb7e8[_0x7ba0('0x44')]['duration'];delete _0x3fb7e8[_0x7ba0('0x44')][_0x7ba0('0x45')];delete _0x3fb7e8[_0x7ba0('0x44')][_0x7ba0('0x46')];delete _0x3fb7e8[_0x7ba0('0x44')][_0x7ba0('0x47')];return db[_0x7ba0('0x3f')]['find']({'where':{'id':_0x3fb7e8[_0x7ba0('0x42')]['id']}})[_0x7ba0('0x1f')](handleEntityNotFound(_0xda55c6,null))[_0x7ba0('0x1f')](saveUpdates(_0x3fb7e8['body'],null))[_0x7ba0('0x1f')](respondWithResult(_0xda55c6,null))[_0x7ba0('0x41')](handleError(_0xda55c6,null));};exports[_0x7ba0('0x48')]=function(_0x33a978,_0x43bc15){return db['ScreenRecording']['describe']()[_0x7ba0('0x1f')](respondWithResult(_0x43bc15,null))[_0x7ba0('0x41')](handleError(_0x43bc15,null));};exports[_0x7ba0('0x49')]=function(_0x319132,_0xeba0e6,_0x5e9dbe){var _0x12c517=require('../../components/encryptor');var _0x501681=![];var _0x2217ce={};if(_0x319132[_0x7ba0('0x2b')][_0x7ba0('0x27')]&&_0x319132[_0x7ba0('0x2b')][_0x7ba0('0x27')]===_0x7ba0('0x4a')){_0x2217ce['uniqueid']=_0x319132['params']['id'];}else{_0x2217ce['id']=_0x319132[_0x7ba0('0x42')]['id'];}return db[_0x7ba0('0x3f')][_0x7ba0('0x4b')]({'where':_0x2217ce,'attributes':['id',_0x7ba0('0x47')],'raw':!![]})[_0x7ba0('0x1f')](handleEntityNotFound(_0xeba0e6,null))['then'](function(_0x16ccde){if(_0x16ccde){var _0xa4caeb=path['join'](config[_0x7ba0('0x4c')],_0x7ba0('0x4d'),_0x16ccde[_0x7ba0('0x47')]);var _0x2bbf8e=util[_0x7ba0('0x2a')]('%s.cypher',_0xa4caeb);if(fs['existsSync'](_0x2bbf8e)){_0x501681=!![];return _0x12c517[_0x7ba0('0x4e')](_0x2bbf8e,_0xa4caeb,config['secrets'][_0x7ba0('0x4f')])[_0x7ba0('0x1f')](function(){return _0x16ccde;});}return _0x16ccde;}})['then'](function(_0x34252a){if(_0x34252a){var _0x22bdef=path[_0x7ba0('0x50')](config['root'],'server/files/screen_recordings',_0x34252a[_0x7ba0('0x47')]);if(!fs[_0x7ba0('0x51')](_0x22bdef)){throw new db[(_0x7ba0('0x52'))][(_0x7ba0('0x53'))](_0x7ba0('0x54'));}if(_0x34252a[_0x7ba0('0x55')]){return _0xeba0e6[_0x7ba0('0x49')](_0x22bdef,_0x34252a[_0x7ba0('0x55')]+path[_0x7ba0('0x56')](_0x22bdef),function(){if(_0x501681){fs[_0x7ba0('0x57')](_0x22bdef);}});}else{return _0xeba0e6[_0x7ba0('0x49')](_0x22bdef,function(_0x4037a5){if(_0x501681){fs[_0x7ba0('0x57')](_0x22bdef);}});}}})['catch'](function(_0x540838){if(_0x540838[_0x7ba0('0x58')]===_0x7ba0('0x54')){_0xeba0e6[_0x7ba0('0x16')](0x194)[_0x7ba0('0x24')](_0x7ba0('0x59'));}else{return handleError(_0xeba0e6,null);}});};exports[_0x7ba0('0x20')]=function(_0x43d987,_0x3eacab){return db['ScreenRecording'][_0x7ba0('0x4b')]({'where':{'id':_0x43d987['params']['id']}})[_0x7ba0('0x1f')](function(_0x355552){if(!_0x355552)throw new ReferenceError('Entity\x20not\x20found');return _0x355552;})[_0x7ba0('0x1f')](function(_0x2adac8){var _0xf3ba8f=path['join'](config['root'],_0x7ba0('0x4d'),_0x2adac8[_0x7ba0('0x47')]);logger[_0x7ba0('0x5a')]('cancellazione\x20fisica\x20documento\x20%s',_0xf3ba8f);if(!_[_0x7ba0('0x5b')](_0x2adac8['value'])&&fs[_0x7ba0('0x51')](_0xf3ba8f)){logger[_0x7ba0('0x5a')](_0x7ba0('0x5c')+_0xf3ba8f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x7ba0('0x5d')](_0xf3ba8f);}_0xf3ba8f=_0xf3ba8f+_0x7ba0('0x5e');if(!_['isNil'](_0x2adac8['value'])&&fs[_0x7ba0('0x51')](_0xf3ba8f)){logger[_0x7ba0('0x5a')](_0x7ba0('0x5c')+_0xf3ba8f+_0x7ba0('0x5f'));fs[_0x7ba0('0x5d')](_0xf3ba8f);}return _0x2adac8;})[_0x7ba0('0x1f')](function(_0x37860d){if(!_0x37860d)throw new InternalError();return _0x37860d[_0x7ba0('0x20')]();})[_0x7ba0('0x1f')](function(){_0x3eacab[_0x7ba0('0x16')](0xcc)['end']();})[_0x7ba0('0x41')](handleError(_0x3eacab,null));}; \ No newline at end of file +var _0x7571=['format','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','duration','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','server/files/screen_recordings','decryptFile','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','existsSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy'];(function(_0xecc94b,_0x197b31){var _0x288f46=function(_0x50dba6){while(--_0x50dba6){_0xecc94b['push'](_0xecc94b['shift']());}};_0x288f46(++_0x197b31);}(_0x7571,0x17c));var _0x1757=function(_0x44207d,_0x1e61aa){_0x44207d=_0x44207d-0x0;var _0x14fd11=_0x7571[_0x44207d];return _0x14fd11;};'use strict';var pdf=require(_0x1757('0x0'));var emlformat=require(_0x1757('0x1'));var rimraf=require(_0x1757('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1757('0x3'));var rp=require(_0x1757('0x4'));var moment=require('moment');var BPromise=require(_0x1757('0x5'));var Mustache=require(_0x1757('0x6'));var util=require(_0x1757('0x7'));var path=require(_0x1757('0x8'));var sox=require(_0x1757('0x9'));var csv=require(_0x1757('0xa'));var ejs=require(_0x1757('0xb'));var fs=require('fs');var _=require(_0x1757('0xc'));var squel=require(_0x1757('0xd'));var crypto=require(_0x1757('0xe'));var jsforce=require(_0x1757('0xf'));var deskjs=require(_0x1757('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1757('0x11'));var Papa=require(_0x1757('0x12'));var Redis=require(_0x1757('0x13'));var authService=require(_0x1757('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x1757('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1757('0x16'))(_0x1757('0x17'));var utils=require(_0x1757('0x18'));var config=require(_0x1757('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1757('0x1a'))['db'];function respondWithStatusCode(_0x4b0948,_0x29aeeb){_0x29aeeb=_0x29aeeb||0xcc;return function(_0x3d85e1){if(_0x3d85e1){return _0x4b0948[_0x1757('0x1b')](_0x29aeeb);}return _0x4b0948[_0x1757('0x1c')](_0x29aeeb)[_0x1757('0x1d')]();};}function respondWithResult(_0x395750,_0x1c8713){_0x1c8713=_0x1c8713||0xc8;return function(_0x4ebae7){if(_0x4ebae7){return _0x395750['status'](_0x1c8713)[_0x1757('0x1e')](_0x4ebae7);}};}function respondWithFilteredResult(_0x17e818,_0x42e303){return function(_0x1e0fd2){if(_0x1e0fd2){var _0x2ce82f=_0x1e0fd2['count'],_0x5b8113=_0x42e303['offset'],_0x2e2d96=_0x42e303[_0x1757('0x1f')]+_0x42e303[_0x1757('0x20')],_0x22d576;if(_0x2e2d96>=_0x2ce82f){_0x2e2d96=_0x2ce82f;_0x22d576=0xc8;}else{_0x22d576=0xce;}_0x17e818[_0x1757('0x1c')](_0x22d576);return _0x17e818[_0x1757('0x21')](_0x1757('0x22'),_0x5b8113+'-'+_0x2e2d96+'/'+_0x2ce82f)[_0x1757('0x1e')](_0x1e0fd2);}return null;};}function patchUpdates(_0x934d79){return function(_0x52b36e){try{jsonpatch[_0x1757('0x23')](_0x52b36e,_0x934d79,!![]);}catch(_0x3c437a){return BPromise[_0x1757('0x24')](_0x3c437a);}return _0x52b36e[_0x1757('0x25')]();};}function saveUpdates(_0x5e7bb2,_0x3972a3){return function(_0x4995d0){if(_0x4995d0){return _0x4995d0['update'](_0x5e7bb2)['then'](function(_0x3a9f3a){return _0x3a9f3a;});}return null;};}function removeEntity(_0x91eb6c,_0x15b929){return function(_0x40eef3){if(_0x40eef3){return _0x40eef3[_0x1757('0x26')]()[_0x1757('0x27')](function(){_0x91eb6c['status'](0xcc)[_0x1757('0x1d')]();});}};}function handleEntityNotFound(_0x1b40ee,_0xd65559){return function(_0x186afc){if(!_0x186afc){_0x1b40ee[_0x1757('0x1b')](0x194);}return _0x186afc;};}function handleError(_0x478e1b,_0x4eb26d){_0x4eb26d=_0x4eb26d||0x1f4;return function(_0x21bc53){logger[_0x1757('0x28')](_0x21bc53[_0x1757('0x29')]);if(_0x21bc53['name']){delete _0x21bc53[_0x1757('0x2a')];}_0x478e1b[_0x1757('0x1c')](_0x4eb26d)['send'](_0x21bc53);};}exports[_0x1757('0x2b')]=function(_0x39bb88,_0x16db6a){var _0x3efb2c={},_0x3190c6={},_0x4ac471={'count':0x0,'rows':[]};var _0x115cd8=_[_0x1757('0x2c')](db[_0x1757('0x2d')][_0x1757('0x2e')],function(_0x34987f){return{'name':_0x34987f[_0x1757('0x2f')],'type':_0x34987f[_0x1757('0x30')][_0x1757('0x31')]};});_0x3190c6[_0x1757('0x32')]=_[_0x1757('0x33')](_[_0x1757('0x2c')](_0x115cd8,_0x1757('0x2a')),[_0x1757('0x34')]);_0x3190c6[_0x1757('0x35')]=_[_0x1757('0x36')](_0x39bb88[_0x1757('0x35')]);_0x3190c6[_0x1757('0x37')]=_[_0x1757('0x38')](_0x3190c6[_0x1757('0x32')],_0x3190c6['query']);_0x3efb2c[_0x1757('0x39')]=_['intersection'](_0x3190c6['model'],qs[_0x1757('0x3a')](_0x39bb88[_0x1757('0x35')]['fields']));_0x3efb2c[_0x1757('0x39')]=_0x3efb2c[_0x1757('0x39')][_0x1757('0x3b')]?_0x3efb2c[_0x1757('0x39')]:_0x3190c6[_0x1757('0x32')];if(!_0x39bb88[_0x1757('0x35')]['hasOwnProperty'](_0x1757('0x3c'))){_0x3efb2c[_0x1757('0x20')]=qs[_0x1757('0x20')](_0x39bb88['query'][_0x1757('0x20')]);_0x3efb2c[_0x1757('0x1f')]=qs[_0x1757('0x1f')](_0x39bb88[_0x1757('0x35')][_0x1757('0x1f')]);}_0x3efb2c[_0x1757('0x3d')]=qs[_0x1757('0x3e')](_0x39bb88[_0x1757('0x35')][_0x1757('0x3e')]);_0x3efb2c['where']=qs[_0x1757('0x37')](_[_0x1757('0x3f')](_0x39bb88['query'],_0x3190c6[_0x1757('0x37')]),_0x115cd8);if(_0x39bb88[_0x1757('0x35')][_0x1757('0x40')]){_0x3efb2c[_0x1757('0x41')]=_['merge'](_0x3efb2c['where'],{'$or':_['map'](_0x115cd8,function(_0x1b354f){if(_0x1b354f[_0x1757('0x30')]!==_0x1757('0x42')){var _0x5d94dd={};_0x5d94dd[_0x1b354f[_0x1757('0x2a')]]={'$like':'%'+_0x39bb88[_0x1757('0x35')]['filter']+'%'};return _0x5d94dd;}})});}_0x3efb2c=_[_0x1757('0x43')]({},_0x3efb2c,_0x39bb88['options']);var _0x76c908={'where':_0x3efb2c['where']};return db[_0x1757('0x2d')][_0x1757('0x44')](_0x76c908)[_0x1757('0x27')](function(_0x5ee262){_0x4ac471['count']=_0x5ee262;if(_0x39bb88['query'][_0x1757('0x45')]){_0x3efb2c[_0x1757('0x46')]=[{'all':!![]}];}return db['ScreenRecording'][_0x1757('0x47')](_0x3efb2c);})[_0x1757('0x27')](function(_0x1b67b6){_0x4ac471[_0x1757('0x48')]=_0x1b67b6;return _0x4ac471;})[_0x1757('0x27')](respondWithFilteredResult(_0x16db6a,_0x3efb2c))[_0x1757('0x49')](handleError(_0x16db6a,null));};exports[_0x1757('0x4a')]=function(_0x148059,_0x1fa8b4){var _0x42d3d8={'raw':![],'where':{'id':_0x148059[_0x1757('0x4b')]['id']}},_0x13fe18={};_0x13fe18[_0x1757('0x32')]=_[_0x1757('0x36')](db[_0x1757('0x2d')][_0x1757('0x2e')]);_0x13fe18['query']=_[_0x1757('0x36')](_0x148059['query']);_0x13fe18[_0x1757('0x37')]=_[_0x1757('0x38')](_0x13fe18[_0x1757('0x32')],_0x13fe18[_0x1757('0x35')]);_0x42d3d8['attributes']=_['intersection'](_0x13fe18[_0x1757('0x32')],qs[_0x1757('0x3a')](_0x148059[_0x1757('0x35')]['fields']));_0x42d3d8[_0x1757('0x39')]=_0x42d3d8['attributes']['length']?_0x42d3d8[_0x1757('0x39')]:_0x13fe18[_0x1757('0x32')];if(_0x148059[_0x1757('0x35')][_0x1757('0x45')]){_0x42d3d8['include']=[{'all':!![]}];}_0x42d3d8=_[_0x1757('0x43')]({},_0x42d3d8,_0x148059[_0x1757('0x4c')]);return db[_0x1757('0x2d')][_0x1757('0x4d')](_0x42d3d8)['then'](handleEntityNotFound(_0x1fa8b4,null))[_0x1757('0x27')](respondWithResult(_0x1fa8b4,null))['catch'](handleError(_0x1fa8b4,null));};exports[_0x1757('0x4e')]=function(_0x5d2ed5,_0x685fbe){return db[_0x1757('0x2d')][_0x1757('0x4e')](_0x5d2ed5['body'],{})['then'](respondWithResult(_0x685fbe,0xc9))['catch'](handleError(_0x685fbe,null));};exports['update']=function(_0x2993aa,_0x33f2b8){if(_0x2993aa[_0x1757('0x4f')]['id']){delete _0x2993aa[_0x1757('0x4f')]['id'];}delete _0x2993aa['body'][_0x1757('0x50')];delete _0x2993aa['body']['createdAt'];delete _0x2993aa['body'][_0x1757('0x51')];delete _0x2993aa[_0x1757('0x4f')][_0x1757('0x52')];return db[_0x1757('0x2d')][_0x1757('0x4d')]({'where':{'id':_0x2993aa['params']['id']}})[_0x1757('0x27')](handleEntityNotFound(_0x33f2b8,null))[_0x1757('0x27')](saveUpdates(_0x2993aa[_0x1757('0x4f')],null))[_0x1757('0x27')](respondWithResult(_0x33f2b8,null))[_0x1757('0x49')](handleError(_0x33f2b8,null));};exports[_0x1757('0x53')]=function(_0x5358c1,_0xc597fd){return db['ScreenRecording'][_0x1757('0x53')]()[_0x1757('0x27')](respondWithResult(_0xc597fd,null))[_0x1757('0x49')](handleError(_0xc597fd,null));};exports[_0x1757('0x54')]=function(_0x11333c,_0x1b0f64,_0x232d54){var _0x4f1142=require(_0x1757('0x55'));var _0x2a2264=![];var _0x55a6d3={};if(_0x11333c['query'][_0x1757('0x30')]&&_0x11333c['query'][_0x1757('0x30')]===_0x1757('0x56')){_0x55a6d3[_0x1757('0x56')]=_0x11333c[_0x1757('0x4b')]['id'];}else{_0x55a6d3['id']=_0x11333c['params']['id'];}return db[_0x1757('0x2d')][_0x1757('0x4d')]({'where':_0x55a6d3,'attributes':['id',_0x1757('0x52')],'raw':!![]})[_0x1757('0x27')](handleEntityNotFound(_0x1b0f64,null))[_0x1757('0x27')](function(_0x2c020b){if(_0x2c020b){var _0x517914=path[_0x1757('0x57')](config['root'],_0x1757('0x58'),_0x2c020b[_0x1757('0x52')]);var _0x5662ab=util[_0x1757('0x34')]('%s.cypher',_0x517914);if(fs['existsSync'](_0x5662ab)){_0x2a2264=!![];return _0x4f1142[_0x1757('0x59')](_0x5662ab,_0x517914,config[_0x1757('0x5a')][_0x1757('0x5b')])[_0x1757('0x27')](function(){return _0x2c020b;});}return _0x2c020b;}})[_0x1757('0x27')](function(_0x5f3825){if(_0x5f3825){var _0x36e0bd=path[_0x1757('0x57')](config[_0x1757('0x5c')],'server/files/screen_recordings',_0x5f3825[_0x1757('0x52')]);if(!fs['existsSync'](_0x36e0bd)){throw new db[(_0x1757('0x5d'))][(_0x1757('0x5e'))](_0x1757('0x5f'));}if(_0x5f3825[_0x1757('0x60')]){return _0x1b0f64[_0x1757('0x54')](_0x36e0bd,_0x5f3825[_0x1757('0x60')]+path[_0x1757('0x61')](_0x36e0bd),function(){if(_0x2a2264){fs[_0x1757('0x62')](_0x36e0bd);}});}else{return _0x1b0f64[_0x1757('0x54')](_0x36e0bd,function(_0x375554){if(_0x2a2264){fs[_0x1757('0x62')](_0x36e0bd);}});}}})['catch'](function(_0x4b4ebd){if(_0x4b4ebd[_0x1757('0x63')]==='ScreenRecording\x20not\x20found'){_0x1b0f64['status'](0x194)['send'](_0x1757('0x64'));}else{return handleError(_0x1b0f64,null);}});};exports[_0x1757('0x26')]=function(_0x5f27ee,_0x432577){return db[_0x1757('0x2d')]['find']({'where':{'id':_0x5f27ee[_0x1757('0x4b')]['id']}})[_0x1757('0x27')](function(_0x27cf12){if(!_0x27cf12)throw new ReferenceError(_0x1757('0x65'));return _0x27cf12;})[_0x1757('0x27')](function(_0x414bd4){var _0x30e3ed=path['join'](config[_0x1757('0x5c')],_0x1757('0x58'),_0x414bd4['value']);logger[_0x1757('0x66')]('cancellazione\x20fisica\x20documento\x20%s',_0x30e3ed);if(!_[_0x1757('0x67')](_0x414bd4[_0x1757('0x52')])&&fs[_0x1757('0x68')](_0x30e3ed)){logger[_0x1757('0x66')](_0x1757('0x69')+_0x30e3ed+_0x1757('0x6a'));fs['unlinkSync'](_0x30e3ed);}_0x30e3ed=_0x30e3ed+'.cypher';if(!_[_0x1757('0x67')](_0x414bd4[_0x1757('0x52')])&&fs[_0x1757('0x68')](_0x30e3ed)){logger['info'](_0x1757('0x69')+_0x30e3ed+_0x1757('0x6a'));fs[_0x1757('0x6b')](_0x30e3ed);}return _0x414bd4;})['then'](function(_0x5ae875){if(!_0x5ae875)throw new InternalError();return _0x5ae875[_0x1757('0x26')]();})[_0x1757('0x27')](function(){_0x432577['status'](0xcc)[_0x1757('0x1d')]();})[_0x1757('0x49')](handleError(_0x432577,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 0f55f53..3f63901 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 _0x59f6=['api','moment','request-promise','path','rimraf','../../config/environment','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x59f6,0xbd));var _0x659f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x59f6[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x659f('0x0'));var util=require(_0x659f('0x1'));var logger=require(_0x659f('0x2'))(_0x659f('0x3'));var moment=require(_0x659f('0x4'));var BPromise=require('bluebird');var rp=require(_0x659f('0x5'));var fs=require('fs');var path=require(_0x659f('0x6'));var rimraf=require(_0x659f('0x7'));var config=require(_0x659f('0x8'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x373635,_0x33d05f){return _0x373635['define'](_0x659f('0x9'),attributes,{'tableName':_0x659f('0xa'),'paranoid':![],'indexes':[{'name':_0x659f('0xb'),'fields':[_0x659f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7821=['util','../../config/logger','api','bluebird','request-promise','./screenRecording.attributes','ScreenRecording','screen_recordings','interactionid','lodash'];(function(_0x1ca4cc,_0x402c23){var _0x108010=function(_0x4c5082){while(--_0x4c5082){_0x1ca4cc['push'](_0x1ca4cc['shift']());}};_0x108010(++_0x402c23);}(_0x7821,0x10d));var _0x1782=function(_0x46ef1d,_0x24926){_0x46ef1d=_0x46ef1d-0x0;var _0x49ce69=_0x7821[_0x46ef1d];return _0x49ce69;};'use strict';var _=require(_0x1782('0x0'));var util=require(_0x1782('0x1'));var logger=require(_0x1782('0x2'))(_0x1782('0x3'));var moment=require('moment');var BPromise=require(_0x1782('0x4'));var rp=require(_0x1782('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1782('0x6'));module['exports']=function(_0x42c0c1,_0xcbc22f){return _0x42c0c1['define'](_0x1782('0x7'),attributes,{'tableName':_0x1782('0x8'),'paranoid':![],'indexes':[{'name':_0x1782('0x9'),'fields':[_0x1782('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 3dc2e8f..9ca92d0 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 _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\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(_0x3e47c4,_0x19eb4a){var _0x1271aa=function(_0x285f06){while(--_0x285f06){_0x3e47c4['push'](_0x3e47c4['shift']());}};_0x1271aa(++_0x19eb4a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\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(_0x331cf3,_0x3b5745){var _0x3ae273=function(_0x1f8166){while(--_0x1f8166){_0x331cf3['push'](_0x331cf3['shift']());}};_0x3ae273(++_0x3b5745);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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/setting/index.js b/server/api/setting/index.js index e052c2c..aeb1f3d 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 _0xce54=['index','/now','show','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','post','single','file','addLogo','originalname','preferred','favicon','put','/:id','isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./setting.controller','get'];(function(_0x2523be,_0x7d256d){var _0x527676=function(_0x1557cc){while(--_0x1557cc){_0x2523be['push'](_0x2523be['shift']());}};_0x527676(++_0x7d256d);}(_0xce54,0x1ae));var _0x4ce5=function(_0x4be415,_0x3d4438){_0x4be415=_0x4be415-0x0;var _0x26222d=_0xce54[_0x4be415];return _0x26222d;};'use strict';var multer=require(_0x4ce5('0x0'));var util=require(_0x4ce5('0x1'));var path=require(_0x4ce5('0x2'));var timeout=require(_0x4ce5('0x3'));var express=require(_0x4ce5('0x4'));var router=express[_0x4ce5('0x5')]();var auth=require(_0x4ce5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4ce5('0x7'));var controller=require(_0x4ce5('0x8'));router[_0x4ce5('0x9')]('/',auth['isAuthenticated'](),controller[_0x4ce5('0xa')]);router['get'](_0x4ce5('0xb'),controller['getDate']);router[_0x4ce5('0x9')]('/:id',controller[_0x4ce5('0xc')]);router[_0x4ce5('0x9')]('/:id/logo',controller[_0x4ce5('0xd')]);router[_0x4ce5('0x9')](_0x4ce5('0xe'),controller[_0x4ce5('0xf')]);router[_0x4ce5('0x9')]('/:id/gdpr',controller[_0x4ce5('0x10')]);router[_0x4ce5('0x9')](_0x4ce5('0x11'),controller[_0x4ce5('0x12')]);router[_0x4ce5('0x9')](_0x4ce5('0x13'),controller[_0x4ce5('0x14')]);var upload=multer({'storage':multer[_0x4ce5('0x15')]({'destination':function(_0x237fc4,_0x2be005,_0x1fd0f7){_0x1fd0f7(null,path[_0x4ce5('0x16')](config[_0x4ce5('0x17')],_0x4ce5('0x18')));},'filename':function(_0x41466a,_0x247775,_0x2a0ce2){_0x2a0ce2(null,util[_0x4ce5('0x19')](_0x4ce5('0x1a'),_0x4ce5('0x1b'),path[_0x4ce5('0x1c')](_0x247775['originalname'])));}})});router[_0x4ce5('0x1d')]('/:id/logo',upload[_0x4ce5('0x1e')](_0x4ce5('0x1f')),controller[_0x4ce5('0x20')]);var upload=multer({'storage':multer[_0x4ce5('0x15')]({'destination':function(_0x271866,_0x48646d,_0x58be6d){_0x58be6d(null,path[_0x4ce5('0x16')](config[_0x4ce5('0x17')],_0x4ce5('0x18')));},'filename':function(_0x38c45a,_0x2598f3,_0x455cd8){_0x455cd8(null,util['format'](_0x4ce5('0x1a'),'logologin',path['extname'](_0x2598f3[_0x4ce5('0x21')])));}})});router['post'](_0x4ce5('0xe'),upload['single'](_0x4ce5('0x1f')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x4ce5('0x15')]({'destination':function(_0x3aba9f,_0x5a2e74,_0x117a57){_0x117a57(null,path[_0x4ce5('0x16')](config['root'],_0x4ce5('0x18')));},'filename':function(_0x1654f0,_0x75984a,_0x59ebdf){_0x59ebdf(null,util['format'](_0x4ce5('0x1a'),_0x4ce5('0x22'),path['extname'](_0x75984a['originalname'])));}})});router[_0x4ce5('0x1d')]('/:id/preferred',upload['single'](_0x4ce5('0x1f')),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a3d1c,_0x505052,_0x36c84b){_0x36c84b(null,path[_0x4ce5('0x16')](config[_0x4ce5('0x17')],'server/files/images/logos/'));},'filename':function(_0x2601e1,_0x8e4037,_0x3f3252){_0x3f3252(null,util[_0x4ce5('0x19')](_0x4ce5('0x1a'),_0x4ce5('0x23'),path[_0x4ce5('0x1c')](_0x8e4037[_0x4ce5('0x21')])));}})});router[_0x4ce5('0x1d')](_0x4ce5('0x13'),upload[_0x4ce5('0x1e')](_0x4ce5('0x1f')),controller['addFavicon']);router[_0x4ce5('0x24')](_0x4ce5('0x25'),auth[_0x4ce5('0x26')](),controller['update']);module[_0x4ce5('0x27')]=router; \ No newline at end of file +var _0x96f4=['file','addLogo','logologin','addLogoLogin','preferred','addPreferred','format','favicon','addFavicon','put','isAuthenticated','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./setting.controller','get','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','%s%s','logo','extname','originalname','post','single'];(function(_0x3a2732,_0x432bc0){var _0x380bd3=function(_0x269abe){while(--_0x269abe){_0x3a2732['push'](_0x3a2732['shift']());}};_0x380bd3(++_0x432bc0);}(_0x96f4,0x1f0));var _0x496f=function(_0x5a19fc,_0x58f9f4){_0x5a19fc=_0x5a19fc-0x0;var _0x34b413=_0x96f4[_0x5a19fc];return _0x34b413;};'use strict';var multer=require(_0x496f('0x0'));var util=require(_0x496f('0x1'));var path=require(_0x496f('0x2'));var timeout=require(_0x496f('0x3'));var express=require(_0x496f('0x4'));var router=express[_0x496f('0x5')]();var auth=require(_0x496f('0x6'));var interaction=require(_0x496f('0x7'));var config=require('../../config/environment');var controller=require(_0x496f('0x8'));router[_0x496f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/now',controller[_0x496f('0xa')]);router['get'](_0x496f('0xb'),controller[_0x496f('0xc')]);router[_0x496f('0x9')](_0x496f('0xd'),controller[_0x496f('0xe')]);router[_0x496f('0x9')](_0x496f('0xf'),controller[_0x496f('0x10')]);router[_0x496f('0x9')](_0x496f('0x11'),controller[_0x496f('0x12')]);router[_0x496f('0x9')](_0x496f('0x13'),controller[_0x496f('0x14')]);router[_0x496f('0x9')](_0x496f('0x15'),controller['getFavicon']);var upload=multer({'storage':multer[_0x496f('0x16')]({'destination':function(_0x3c0316,_0x37a441,_0x23f238){_0x23f238(null,path[_0x496f('0x17')](config[_0x496f('0x18')],_0x496f('0x19')));},'filename':function(_0xd51000,_0x183e10,_0x3aa8aa){_0x3aa8aa(null,util['format'](_0x496f('0x1a'),_0x496f('0x1b'),path[_0x496f('0x1c')](_0x183e10[_0x496f('0x1d')])));}})});router[_0x496f('0x1e')](_0x496f('0xd'),upload[_0x496f('0x1f')](_0x496f('0x20')),controller[_0x496f('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3cfd8b,_0x5d9601,_0x3bda7f){_0x3bda7f(null,path[_0x496f('0x17')](config[_0x496f('0x18')],'server/files/images/logos/'));},'filename':function(_0x422d0a,_0x184e32,_0x2b6e9c){_0x2b6e9c(null,util['format']('%s%s',_0x496f('0x22'),path[_0x496f('0x1c')](_0x184e32[_0x496f('0x1d')])));}})});router[_0x496f('0x1e')](_0x496f('0xf'),upload['single'](_0x496f('0x20')),controller[_0x496f('0x23')]);var upload=multer({'storage':multer[_0x496f('0x16')]({'destination':function(_0x224251,_0x24e1ac,_0x502d62){_0x502d62(null,path[_0x496f('0x17')](config[_0x496f('0x18')],_0x496f('0x19')));},'filename':function(_0x2e794a,_0x3394f4,_0x2821d0){_0x2821d0(null,util['format'](_0x496f('0x1a'),_0x496f('0x24'),path[_0x496f('0x1c')](_0x3394f4[_0x496f('0x1d')])));}})});router[_0x496f('0x1e')]('/:id/preferred',upload['single']('file'),controller[_0x496f('0x25')]);var upload=multer({'storage':multer[_0x496f('0x16')]({'destination':function(_0x20844d,_0x57431e,_0x576da0){_0x576da0(null,path[_0x496f('0x17')](config['root'],_0x496f('0x19')));},'filename':function(_0x1bec22,_0x5b0507,_0xdfa005){_0xdfa005(null,util[_0x496f('0x26')](_0x496f('0x1a'),_0x496f('0x27'),path[_0x496f('0x1c')](_0x5b0507[_0x496f('0x1d')])));}})});router['post']('/:id/favicon',upload[_0x496f('0x1f')](_0x496f('0x20')),controller[_0x496f('0x28')]);router[_0x496f('0x29')](_0x496f('0xb'),auth[_0x496f('0x2a')](),controller[_0x496f('0x2b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 3303784..b28e5cd 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 _0x9aaa=['INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','min_internal'];(function(_0x4c7b09,_0x13b98d){var _0x361034=function(_0x1dcd85){while(--_0x1dcd85){_0x4c7b09['push'](_0x4c7b09['shift']());}};_0x361034(++_0x13b98d);}(_0x9aaa,0x1e8));var _0xa9aa=function(_0x6a27db,_0x2731a7){_0x6a27db=_0x6a27db-0x0;var _0xd814f5=_0x9aaa[_0x6a27db];return _0xd814f5;};'use strict';var Sequelize=require(_0xa9aa('0x0'));module['exports']={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xa9aa('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xa9aa('0x2')](0xb),'unique':_0xa9aa('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xa9aa('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xa9aa('0x4')],'defaultValue':_0xa9aa('0x5')},'logo':{'type':Sequelize[_0xa9aa('0x4')]},'defaultLogo':{'type':Sequelize[_0xa9aa('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xa9aa('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xa9aa('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xa9aa('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xa9aa('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xa9aa('0x4')]},'turnusername':{'type':Sequelize[_0xa9aa('0x4')]},'turnpassword':{'type':Sequelize[_0xa9aa('0x4')]},'pageTitle':{'type':Sequelize[_0xa9aa('0x4')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xa9aa('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xa9aa('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xa9aa('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xa9aa('0x4')],'defaultValue':_0xa9aa('0x7')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0xa9aa('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xa9aa('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xa9aa('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xa9aa('0x4')],'defaultValue':_0xa9aa('0x8')},'chatTimeout':{'type':Sequelize[_0xa9aa('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xa9aa('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xa9aa('0x4')]},'defaultPreferred':{'type':Sequelize[_0xa9aa('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xa9aa('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xa9aa('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xa9aa('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xa9aa('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xa9aa('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xa9aa('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xa9aa('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xa9aa('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xa9aa('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0xa9aa('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xa9aa('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xa9aa('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0xa9aa('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xa9aa('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xa9aa('0x2')](0x2)[_0xa9aa('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xa9aa('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xa9aa('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xa9aa('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xa9aa('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8e6d=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','sequelize','exports','INTEGER','min_internal'];(function(_0x1f9eaf,_0x1ca183){var _0x4ef4a8=function(_0x3150c8){while(--_0x3150c8){_0x1f9eaf['push'](_0x1f9eaf['shift']());}};_0x4ef4a8(++_0x1ca183);}(_0x8e6d,0x7a));var _0xd8e6=function(_0x1238ed,_0x266dde){_0x1238ed=_0x1238ed-0x0;var _0x560a37=_0x8e6d[_0x1238ed];return _0x560a37;};'use strict';var Sequelize=require(_0xd8e6('0x0'));module[_0xd8e6('0x1')]={'min_internal':{'type':Sequelize[_0xd8e6('0x2')](0xb),'unique':_0xd8e6('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xd8e6('0x2')](0xb),'unique':_0xd8e6('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xd8e6('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xd8e6('0x5')],'defaultValue':_0xd8e6('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xd8e6('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xd8e6('0x5')]},'turnusername':{'type':Sequelize[_0xd8e6('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xd8e6('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xd8e6('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xd8e6('0x5')],'defaultValue':_0xd8e6('0x8')},'enableEmailPreview':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xd8e6('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xd8e6('0x5')]},'defaultPreferred':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xd8e6('0x5')]},'defaultFavicon':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xd8e6('0x2')]},'transcribeRegion':{'type':Sequelize[_0xd8e6('0x5')]},'sentiment':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xd8e6('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd8e6('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xd8e6('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0xd8e6('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xd8e6('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 6474cb6..29a0117 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 _0x358a=['body','find','addLogo','file','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','join','toLower','root','default_logo.svg','default','upperFirst','custom','existsSync','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultLogo','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','then','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','sendStatus','status','end','json','count','offset','set','Content-Range','apply','update','destroy','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','type','VIRTUAL','merge','options','Setting','includeAll','include','findAll','rows','catch','show','params','length'];(function(_0x396ac0,_0x9024e3){var _0x3b6f4d=function(_0xfe185e){while(--_0xfe185e){_0x396ac0['push'](_0x396ac0['shift']());}};_0x3b6f4d(++_0x9024e3);}(_0x358a,0x124));var _0xa358=function(_0x52334f,_0x17401f){_0x52334f=_0x52334f-0x0;var _0x1e490a=_0x358a[_0x52334f];return _0x1e490a;};'use strict';var pdf=require(_0xa358('0x0'));var emlformat=require(_0xa358('0x1'));var rimraf=require(_0xa358('0x2'));var zipdir=require(_0xa358('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa358('0x4'));var BPromise=require(_0xa358('0x5'));var Mustache=require(_0xa358('0x6'));var util=require(_0xa358('0x7'));var path=require(_0xa358('0x8'));var sox=require(_0xa358('0x9'));var csv=require(_0xa358('0xa'));var ejs=require(_0xa358('0xb'));var fs=require('fs');var _=require(_0xa358('0xc'));var squel=require('squel');var crypto=require(_0xa358('0xd'));var jsforce=require(_0xa358('0xe'));var deskjs=require(_0xa358('0xf'));var toCsv=require(_0xa358('0xa'));var querystring=require(_0xa358('0x10'));var Papa=require(_0xa358('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa358('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa358('0x13'));var logger=require(_0xa358('0x14'))(_0xa358('0x15'));var utils=require(_0xa358('0x16'));var config=require(_0xa358('0x17'));var licenseUtil=require(_0xa358('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa358('0x19'));var client=jayson[_0xa358('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x731b21,_0x3aafba,_0x54e8b3,_0x1d5afe){return new BPromise(function(_0x52d947,_0x3afd54){var _0x444b15=_0x1d5afe||client;return _0x444b15['request'](_0x731b21,_0x54e8b3)[_0xa358('0x1b')](function(_0x27ebe1){logger[_0xa358('0x1c')](_0xa358('0x1d'),_0x3aafba,'request\x20sent');logger['debug'](_0xa358('0x1e'),_0x3aafba,_0xa358('0x1f'),JSON[_0xa358('0x20')](_0x27ebe1));if(_0x27ebe1['error']){if(_0x27ebe1['error'][_0xa358('0x21')]===0x1f4){logger[_0xa358('0x22')]('Setting,\x20%s,\x20%s',_0x3aafba,_0x27ebe1['error'][_0xa358('0x23')]);return _0x3afd54(_0x27ebe1[_0xa358('0x22')]['message']);}logger['error']('Setting,\x20%s,\x20%s',_0x3aafba,_0x27ebe1[_0xa358('0x22')][_0xa358('0x23')]);return _0x52d947(_0x27ebe1[_0xa358('0x22')]['message']);}else{logger[_0xa358('0x1c')](_0xa358('0x1d'),_0x3aafba,_0xa358('0x1f'));_0x52d947(_0x27ebe1[_0xa358('0x24')][_0xa358('0x23')]);}})['catch'](function(_0xeee60e){logger[_0xa358('0x22')](_0xa358('0x1d'),_0x3aafba,_0xeee60e);_0x3afd54(_0xeee60e);});});}function respondWithStatusCode(_0x575c7e,_0x5d63eb){_0x5d63eb=_0x5d63eb||0xcc;return function(_0x1c69c0){if(_0x1c69c0){return _0x575c7e[_0xa358('0x25')](_0x5d63eb);}return _0x575c7e[_0xa358('0x26')](_0x5d63eb)[_0xa358('0x27')]();};}function respondWithResult(_0x41b5ea,_0x48e3d7){_0x48e3d7=_0x48e3d7||0xc8;return function(_0x4663d2){if(_0x4663d2){return _0x41b5ea['status'](_0x48e3d7)[_0xa358('0x28')](_0x4663d2);}};}function respondWithFilteredResult(_0x586fbb,_0x3bc2e7){return function(_0x4d535a){if(_0x4d535a){var _0x49470a=_0x4d535a[_0xa358('0x29')],_0x564cc9=_0x3bc2e7[_0xa358('0x2a')],_0x2b9870=_0x3bc2e7['offset']+_0x3bc2e7['limit'],_0x164d83;if(_0x2b9870>=_0x49470a){_0x2b9870=_0x49470a;_0x164d83=0xc8;}else{_0x164d83=0xce;}_0x586fbb[_0xa358('0x26')](_0x164d83);return _0x586fbb[_0xa358('0x2b')](_0xa358('0x2c'),_0x564cc9+'-'+_0x2b9870+'/'+_0x49470a)[_0xa358('0x28')](_0x4d535a);}return null;};}function patchUpdates(_0x3276a5){return function(_0x5cec1d){try{jsonpatch[_0xa358('0x2d')](_0x5cec1d,_0x3276a5,!![]);}catch(_0x3443a9){return BPromise['reject'](_0x3443a9);}return _0x5cec1d['save']();};}function saveUpdates(_0x55c429,_0x34f0ad){return function(_0x2ec0b2){if(_0x2ec0b2){return _0x2ec0b2[_0xa358('0x2e')](_0x55c429)[_0xa358('0x1b')](function(_0x25a5f8){return _0x25a5f8;});}return null;};}function removeEntity(_0xad2edc,_0x26faa5){return function(_0x2dd7e5){if(_0x2dd7e5){return _0x2dd7e5[_0xa358('0x2f')]()[_0xa358('0x1b')](function(){_0xad2edc['status'](0xcc)[_0xa358('0x27')]();});}};}function handleEntityNotFound(_0x237af2,_0x3407f9){return function(_0x37bb19){if(!_0x37bb19){_0x237af2[_0xa358('0x25')](0x194);}return _0x37bb19;};}function handleError(_0x4fd94a,_0x5a38da){_0x5a38da=_0x5a38da||0x1f4;return function(_0xb1895e){logger[_0xa358('0x22')](_0xb1895e[_0xa358('0x30')]);if(_0xb1895e['name']){delete _0xb1895e[_0xa358('0x31')];}_0x4fd94a[_0xa358('0x26')](_0x5a38da)[_0xa358('0x32')](_0xb1895e);};}exports[_0xa358('0x33')]=function(_0x3831fa,_0xa99c98){var _0x4d7c8d={},_0x3f0a6={},_0x49afa2={'count':0x0,'rows':[]};var _0x2febad=_[_0xa358('0x34')](db['Setting'][_0xa358('0x35')],function(_0x5f1d75){return{'name':_0x5f1d75['fieldName'],'type':_0x5f1d75['type'][_0xa358('0x36')]};});_0x3f0a6[_0xa358('0x37')]=_[_0xa358('0x34')](_0x2febad,_0xa358('0x31'));_0x3f0a6[_0xa358('0x38')]=_[_0xa358('0x39')](_0x3831fa['query']);_0x3f0a6[_0xa358('0x3a')]=_[_0xa358('0x3b')](_0x3f0a6[_0xa358('0x37')],_0x3f0a6[_0xa358('0x38')]);_0x4d7c8d['attributes']=_[_0xa358('0x3b')](_0x3f0a6[_0xa358('0x37')],qs[_0xa358('0x3c')](_0x3831fa['query']['fields']));_0x4d7c8d[_0xa358('0x3d')]=_0x4d7c8d['attributes']['length']?_0x4d7c8d[_0xa358('0x3d')]:_0x3f0a6[_0xa358('0x37')];if(!_0x3831fa[_0xa358('0x38')][_0xa358('0x3e')](_0xa358('0x3f'))){_0x4d7c8d[_0xa358('0x40')]=qs[_0xa358('0x40')](_0x3831fa[_0xa358('0x38')][_0xa358('0x40')]);_0x4d7c8d[_0xa358('0x2a')]=qs[_0xa358('0x2a')](_0x3831fa[_0xa358('0x38')][_0xa358('0x2a')]);}_0x4d7c8d['order']=qs[_0xa358('0x41')](_0x3831fa[_0xa358('0x38')][_0xa358('0x41')]);_0x4d7c8d[_0xa358('0x42')]=qs[_0xa358('0x3a')](_['pick'](_0x3831fa['query'],_0x3f0a6[_0xa358('0x3a')]),_0x2febad);if(_0x3831fa['query']['filter']){_0x4d7c8d[_0xa358('0x42')]=_['merge'](_0x4d7c8d[_0xa358('0x42')],{'$or':_[_0xa358('0x34')](_0x2febad,function(_0x5c75ce){if(_0x5c75ce[_0xa358('0x43')]!==_0xa358('0x44')){var _0xb75b84={};_0xb75b84[_0x5c75ce[_0xa358('0x31')]]={'$like':'%'+_0x3831fa['query']['filter']+'%'};return _0xb75b84;}})});}_0x4d7c8d=_[_0xa358('0x45')]({},_0x4d7c8d,_0x3831fa[_0xa358('0x46')]);var _0x558b4c={'where':_0x4d7c8d[_0xa358('0x42')]};return db[_0xa358('0x47')]['count'](_0x558b4c)[_0xa358('0x1b')](function(_0x126c55){_0x49afa2[_0xa358('0x29')]=_0x126c55;if(_0x3831fa[_0xa358('0x38')][_0xa358('0x48')]){_0x4d7c8d[_0xa358('0x49')]=[{'all':!![]}];}return db['Setting'][_0xa358('0x4a')](_0x4d7c8d);})[_0xa358('0x1b')](function(_0x1318ed){_0x49afa2[_0xa358('0x4b')]=_0x1318ed;return _0x49afa2;})[_0xa358('0x1b')](respondWithFilteredResult(_0xa99c98,_0x4d7c8d))[_0xa358('0x4c')](handleError(_0xa99c98,null));};exports[_0xa358('0x4d')]=function(_0x6d1456,_0x5a6266){var _0x583548={'raw':![],'where':{'id':_0x6d1456[_0xa358('0x4e')]['id']}},_0x5bd967={};_0x5bd967['model']=_['keys'](db['Setting']['rawAttributes']);_0x5bd967['query']=_[_0xa358('0x39')](_0x6d1456[_0xa358('0x38')]);_0x5bd967['filters']=_[_0xa358('0x3b')](_0x5bd967[_0xa358('0x37')],_0x5bd967['query']);_0x583548[_0xa358('0x3d')]=_[_0xa358('0x3b')](_0x5bd967[_0xa358('0x37')],qs[_0xa358('0x3c')](_0x6d1456['query']['fields']));_0x583548['attributes']=_0x583548[_0xa358('0x3d')][_0xa358('0x4f')]?_0x583548[_0xa358('0x3d')]:_0x5bd967['model'];if(_0x6d1456['query'][_0xa358('0x48')]){_0x583548[_0xa358('0x49')]=[{'all':!![]}];}_0x583548=_[_0xa358('0x45')]({},_0x583548,_0x6d1456['options']);return db[_0xa358('0x47')]['find'](_0x583548)['then'](handleEntityNotFound(_0x5a6266,null))[_0xa358('0x1b')](respondWithResult(_0x5a6266,null))[_0xa358('0x4c')](handleError(_0x5a6266,null));};exports[_0xa358('0x2e')]=function(_0x5e24ac,_0x80ec59){if(_0x5e24ac[_0xa358('0x50')]['id']){delete _0x5e24ac[_0xa358('0x50')]['id'];}return db['Setting'][_0xa358('0x51')]({'where':{'id':_0x5e24ac[_0xa358('0x4e')]['id']}})['then'](handleEntityNotFound(_0x80ec59,null))[_0xa358('0x1b')](saveUpdates(_0x5e24ac[_0xa358('0x50')],null))[_0xa358('0x1b')](respondWithResult(_0x80ec59,null))[_0xa358('0x4c')](handleError(_0x80ec59,null));};exports[_0xa358('0x52')]=function(_0x165b34,_0x4189ba,_0x4ba515){if(_0x165b34['file']&&_0x165b34[_0xa358('0x53')][_0xa358('0x54')]){_0x165b34['body']['logo']=_0x165b34['file'][_0xa358('0x54')];}return db[_0xa358('0x47')][_0xa358('0x51')]({'where':{'id':_0x165b34[_0xa358('0x4e')]['id']}})[_0xa358('0x1b')](handleEntityNotFound(_0x4189ba,null))[_0xa358('0x1b')](saveUpdates(_0x165b34[_0xa358('0x50')],null))[_0xa358('0x1b')](respondWithResult(_0x4189ba,null))[_0xa358('0x4c')](handleError(_0x4189ba,null));};exports[_0xa358('0x55')]=function(_0x1a661d,_0xf989b0,_0x15bcbb){if(_0x1a661d[_0xa358('0x53')]&&_0x1a661d[_0xa358('0x53')][_0xa358('0x54')]){_0x1a661d[_0xa358('0x50')][_0xa358('0x56')]=_0x1a661d[_0xa358('0x53')][_0xa358('0x54')];}return db[_0xa358('0x47')]['find']({'where':{'id':_0x1a661d[_0xa358('0x4e')]['id']}})[_0xa358('0x1b')](handleEntityNotFound(_0xf989b0,null))['then'](saveUpdates(_0x1a661d[_0xa358('0x50')],null))[_0xa358('0x1b')](respondWithResult(_0xf989b0,null))[_0xa358('0x4c')](handleError(_0xf989b0,null));};var utilLicense=require(_0xa358('0x18'));exports[_0xa358('0x57')]=function(_0x43b821,_0x52328d,_0x514e8e){var _0x1077b0=_0xa358('0x58');var _0x3d5cc6={'custom':![]};return utilLicense[_0xa358('0x59')]()[_0xa358('0x1b')](function(_0x4cb870){if(_0x4cb870){_0x3d5cc6=_0x4cb870;}return db[_0xa358('0x47')][_0xa358('0x51')]({'where':{'id':_0x43b821[_0xa358('0x4e')]['id']},'attributes':[_0xa358('0x5a'),'loginLogo',_0xa358('0x5b'),_0xa358('0x5c'),'defaultLogo',_0xa358('0x5d'),_0xa358('0x5e'),_0xa358('0x5f')],'raw':!![]});})[_0xa358('0x1b')](handleEntityNotFound(_0x52328d,null))[_0xa358('0x1b')](function(_0x3bbb8f){if(_0x3bbb8f){var _0x2090df=_0x3bbb8f[_0xa358('0x5a')]&&fs['existsSync'](path[_0xa358('0x60')](config['root'],_0x1077b0,_[_0xa358('0x61')](_0x3bbb8f[_0xa358('0x5a')])))?path[_0xa358('0x60')](config[_0xa358('0x62')],_0x1077b0,_[_0xa358('0x61')](_0x3bbb8f[_0xa358('0x5a')])):path[_0xa358('0x60')](config[_0xa358('0x62')],_0x1077b0,_[_0xa358('0x61')](_0xa358('0x63')));var _0x39748d=_0xa358('0x64')+_[_0xa358('0x65')](_0xa358('0x5a'));if(_0x3bbb8f[_0x39748d]||!_0x3d5cc6[_0xa358('0x66')]){_0x2090df=path[_0xa358('0x60')](config['root'],_0x1077b0,_[_0xa358('0x61')](_0xa358('0x63')));}if(!fs[_0xa358('0x67')](_0x2090df)){throw new db[(_0xa358('0x68'))][(_0xa358('0x69'))](_['upperFirst'](_0xa358('0x5a'))+_0xa358('0x6a'));}return _0x52328d[_0xa358('0x6b')](_0x2090df);}})[_0xa358('0x4c')](handleError(_0x52328d,null));};var utilLicense=require(_0xa358('0x18'));exports[_0xa358('0x6c')]=function(_0x428b1c,_0x2c9bc2,_0x2e4c8e){var _0x4354f5=_0xa358('0x58');var _0x33cdbf={'custom':![]};return utilLicense[_0xa358('0x59')]()[_0xa358('0x1b')](function(_0x1b5c3f){if(_0x1b5c3f){_0x33cdbf=_0x1b5c3f;}return db[_0xa358('0x47')]['find']({'where':{'id':_0x428b1c['params']['id']},'attributes':['logo',_0xa358('0x56'),_0xa358('0x5b'),'favicon',_0xa358('0x6d'),_0xa358('0x5d'),_0xa358('0x5e'),_0xa358('0x5f')],'raw':!![]});})[_0xa358('0x1b')](handleEntityNotFound(_0x2c9bc2,null))[_0xa358('0x1b')](function(_0x114aaa){if(_0x114aaa){var _0x1b23c6=_0x114aaa[_0xa358('0x56')]&&fs[_0xa358('0x67')](path[_0xa358('0x60')](config['root'],_0x4354f5,_[_0xa358('0x61')](_0x114aaa['loginLogo'])))?path[_0xa358('0x60')](config[_0xa358('0x62')],_0x4354f5,_['toLower'](_0x114aaa[_0xa358('0x56')])):path[_0xa358('0x60')](config[_0xa358('0x62')],_0x4354f5,_[_0xa358('0x61')](_0xa358('0x6e')));var _0x58b2dd=_0xa358('0x64')+_[_0xa358('0x65')]('loginLogo');if(_0x114aaa[_0x58b2dd]||!_0x33cdbf[_0xa358('0x66')]){_0x1b23c6=path[_0xa358('0x60')](config[_0xa358('0x62')],_0x4354f5,_[_0xa358('0x61')]('default_loginLogo.svg'));}if(!fs[_0xa358('0x67')](_0x1b23c6)){throw new db[(_0xa358('0x68'))]['ValidationError'](_['upperFirst'](_0xa358('0x56'))+'\x20not\x20found');}return _0x2c9bc2['download'](_0x1b23c6);}})[_0xa358('0x4c')](handleError(_0x2c9bc2,null));};exports[_0xa358('0x6f')]=function(_0x30c13b,_0x5b4895){return db[_0xa358('0x47')][_0xa358('0x51')]({'where':{'id':_0x30c13b[_0xa358('0x4e')]['id']},'attributes':[_0xa358('0x70')]})[_0xa358('0x1b')](respondWithResult(_0x5b4895,null))['catch'](handleError(_0x5b4895,null));};exports[_0xa358('0x71')]=function(_0x48211f,_0xd3fea6,_0x4a7929){if(_0x48211f[_0xa358('0x53')]&&_0x48211f[_0xa358('0x53')][_0xa358('0x54')]){_0x48211f['body']['preferred']=_0x48211f[_0xa358('0x53')][_0xa358('0x54')];}return db[_0xa358('0x47')]['find']({'where':{'id':_0x48211f['params']['id']}})['then'](handleEntityNotFound(_0xd3fea6,null))[_0xa358('0x1b')](saveUpdates(_0x48211f[_0xa358('0x50')],null))['then'](respondWithResult(_0xd3fea6,null))['catch'](handleError(_0xd3fea6,null));};var utilLicense=require(_0xa358('0x18'));exports[_0xa358('0x72')]=function(_0x3d7697,_0x3ea069,_0x95e353){var _0x6256c5=_0xa358('0x58');var _0x3ae3df={'custom':![]};return utilLicense[_0xa358('0x59')]()[_0xa358('0x1b')](function(_0x1b211d){if(_0x1b211d){_0x3ae3df=_0x1b211d;}return db[_0xa358('0x47')][_0xa358('0x51')]({'where':{'id':_0x3d7697['params']['id']},'attributes':['logo',_0xa358('0x56'),_0xa358('0x5b'),_0xa358('0x5c'),'defaultLogo','defaultLoginLogo',_0xa358('0x5e'),_0xa358('0x5f')],'raw':!![]});})[_0xa358('0x1b')](handleEntityNotFound(_0x3ea069,null))[_0xa358('0x1b')](function(_0x201d76){if(_0x201d76){var _0x3251e4=_0x201d76[_0xa358('0x5b')]&&fs[_0xa358('0x67')](path['join'](config[_0xa358('0x62')],_0x6256c5,_[_0xa358('0x61')](_0x201d76[_0xa358('0x5b')])))?path['join'](config[_0xa358('0x62')],_0x6256c5,_[_0xa358('0x61')](_0x201d76['preferred'])):path[_0xa358('0x60')](config[_0xa358('0x62')],_0x6256c5,_[_0xa358('0x61')](_0xa358('0x73')));var _0x464669='default'+_[_0xa358('0x65')](_0xa358('0x5b'));if(_0x201d76[_0x464669]||!_0x3ae3df[_0xa358('0x66')]||!_0x3ae3df[_0xa358('0x5b')]){_0x3251e4=path['join'](config[_0xa358('0x62')],_0x6256c5,_[_0xa358('0x61')](_0xa358('0x73')));}if(!fs[_0xa358('0x67')](_0x3251e4)){throw new db['Sequelize'][(_0xa358('0x69'))](_['upperFirst'](_0xa358('0x5b'))+_0xa358('0x6a'));}return _0x3ea069['download'](_0x3251e4);}})[_0xa358('0x4c')](handleError(_0x3ea069,null));};exports[_0xa358('0x74')]=function(_0x2cf6f3,_0x429b3c,_0x396175){if(_0x2cf6f3[_0xa358('0x53')]&&_0x2cf6f3[_0xa358('0x53')]['filename']){_0x2cf6f3['body'][_0xa358('0x5c')]=_0x2cf6f3['file'][_0xa358('0x54')];}return db[_0xa358('0x47')][_0xa358('0x51')]({'where':{'id':_0x2cf6f3[_0xa358('0x4e')]['id']}})[_0xa358('0x1b')](handleEntityNotFound(_0x429b3c,null))[_0xa358('0x1b')](saveUpdates(_0x2cf6f3[_0xa358('0x50')],null))[_0xa358('0x1b')](respondWithResult(_0x429b3c,null))[_0xa358('0x4c')](handleError(_0x429b3c,null));};var utilLicense=require(_0xa358('0x18'));exports[_0xa358('0x75')]=function(_0x1cc39c,_0x75b9ba,_0x54c877){var _0x6d2052=_0xa358('0x58');var _0x16c344={'custom':![]};return utilLicense[_0xa358('0x59')]()[_0xa358('0x1b')](function(_0x1f0443){if(_0x1f0443){_0x16c344=_0x1f0443;}return db[_0xa358('0x47')][_0xa358('0x51')]({'where':{'id':_0x1cc39c[_0xa358('0x4e')]['id']},'attributes':[_0xa358('0x5a'),_0xa358('0x56'),_0xa358('0x5b'),_0xa358('0x5c'),_0xa358('0x6d'),'defaultLoginLogo','defaultPreferred',_0xa358('0x5f')],'raw':!![]});})[_0xa358('0x1b')](handleEntityNotFound(_0x75b9ba,null))[_0xa358('0x1b')](function(_0x22fe6e){if(_0x22fe6e){var _0x223416=_0x22fe6e[_0xa358('0x5c')]&&fs[_0xa358('0x67')](path[_0xa358('0x60')](config['root'],_0x6d2052,_[_0xa358('0x61')](_0x22fe6e[_0xa358('0x5c')])))?path['join'](config[_0xa358('0x62')],_0x6d2052,_['toLower'](_0x22fe6e['favicon'])):path['join'](config[_0xa358('0x62')],_0x6d2052,_[_0xa358('0x61')](_0xa358('0x76')));var _0x50e988=_0xa358('0x64')+_[_0xa358('0x65')](_0xa358('0x5c'));if(_0x22fe6e[_0x50e988]||!_0x16c344['custom']){_0x223416=path[_0xa358('0x60')](config[_0xa358('0x62')],_0x6d2052,_['toLower'](_0xa358('0x76')));}if(!fs['existsSync'](_0x223416)){throw new db['Sequelize'][(_0xa358('0x69'))](_['upperFirst'](_0xa358('0x5c'))+_0xa358('0x6a'));}return _0x75b9ba[_0xa358('0x6b')](_0x223416);}})['catch'](handleError(_0x75b9ba,null));};exports[_0xa358('0x77')]=function(_0x26b565,_0xfbe231){var _0x3f7d69={'offset':moment()[_0xa358('0x78')]()};_0x3f7d69[_0xa358('0x79')]=moment()[_0xa358('0x78')](_0x3f7d69[_0xa358('0x2a')])[_0xa358('0x7a')](_0xa358('0x7b'));return _0xfbe231['status'](0xc8)['send'](_0x3f7d69);}; \ No newline at end of file +var _0xdc32=['download','getLogoLogin','defaultLoginLogo','default_loginLogo.svg','Sequelize','gdpr','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','set','reject','save','stack','name','send','index','map','Setting','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','body','find','addLogo','file','logo','addLogoLogin','filename','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','custom','ValidationError','\x20not\x20found'];(function(_0x544799,_0x592b0a){var _0x4af6bb=function(_0x59d2e2){while(--_0x59d2e2){_0x544799['push'](_0x544799['shift']());}};_0x4af6bb(++_0x592b0a);}(_0xdc32,0x1e2));var _0x2dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc32[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x2dc3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2dc3('0x1'));var zipdir=require(_0x2dc3('0x2'));var jsonpatch=require(_0x2dc3('0x3'));var rp=require(_0x2dc3('0x4'));var moment=require('moment');var BPromise=require(_0x2dc3('0x5'));var Mustache=require(_0x2dc3('0x6'));var util=require(_0x2dc3('0x7'));var path=require(_0x2dc3('0x8'));var sox=require(_0x2dc3('0x9'));var csv=require(_0x2dc3('0xa'));var ejs=require(_0x2dc3('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2dc3('0xc'));var crypto=require(_0x2dc3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2dc3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2dc3('0xf'));var Papa=require(_0x2dc3('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2dc3('0x11'));var as=require(_0x2dc3('0x12'));var hardwareService=require(_0x2dc3('0x13'));var logger=require(_0x2dc3('0x14'))('api');var utils=require(_0x2dc3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2dc3('0x16'));var db=require(_0x2dc3('0x17'))['db'];var jayson=require(_0x2dc3('0x18'));var client=jayson[_0x2dc3('0x19')][_0x2dc3('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x52942e,_0x3691b8,_0x1fff7f,_0x2e5410){return new BPromise(function(_0x3bac49,_0x275521){var _0x3ba008=_0x2e5410||client;return _0x3ba008['request'](_0x52942e,_0x1fff7f)[_0x2dc3('0x1b')](function(_0x45d53c){logger['info'](_0x2dc3('0x1c'),_0x3691b8,_0x2dc3('0x1d'));logger['debug'](_0x2dc3('0x1e'),_0x3691b8,_0x2dc3('0x1d'),JSON[_0x2dc3('0x1f')](_0x45d53c));if(_0x45d53c['error']){if(_0x45d53c[_0x2dc3('0x20')][_0x2dc3('0x21')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x3691b8,_0x45d53c['error'][_0x2dc3('0x22')]);return _0x275521(_0x45d53c['error'][_0x2dc3('0x22')]);}logger[_0x2dc3('0x20')]('Setting,\x20%s,\x20%s',_0x3691b8,_0x45d53c[_0x2dc3('0x20')][_0x2dc3('0x22')]);return _0x3bac49(_0x45d53c[_0x2dc3('0x20')][_0x2dc3('0x22')]);}else{logger[_0x2dc3('0x23')]('Setting,\x20%s,\x20%s',_0x3691b8,_0x2dc3('0x1d'));_0x3bac49(_0x45d53c[_0x2dc3('0x24')][_0x2dc3('0x22')]);}})['catch'](function(_0xdc51df){logger[_0x2dc3('0x20')]('Setting,\x20%s,\x20%s',_0x3691b8,_0xdc51df);_0x275521(_0xdc51df);});});}function respondWithStatusCode(_0x5df087,_0xa5327f){_0xa5327f=_0xa5327f||0xcc;return function(_0x3e788c){if(_0x3e788c){return _0x5df087[_0x2dc3('0x25')](_0xa5327f);}return _0x5df087[_0x2dc3('0x26')](_0xa5327f)[_0x2dc3('0x27')]();};}function respondWithResult(_0x1ebdab,_0x427288){_0x427288=_0x427288||0xc8;return function(_0x3b1215){if(_0x3b1215){return _0x1ebdab['status'](_0x427288)[_0x2dc3('0x28')](_0x3b1215);}};}function respondWithFilteredResult(_0xecbac8,_0x5f0909){return function(_0x331a16){if(_0x331a16){var _0x2e63b6=_0x331a16[_0x2dc3('0x29')],_0x1c8196=_0x5f0909[_0x2dc3('0x2a')],_0x4f6848=_0x5f0909[_0x2dc3('0x2a')]+_0x5f0909['limit'],_0x7de196;if(_0x4f6848>=_0x2e63b6){_0x4f6848=_0x2e63b6;_0x7de196=0xc8;}else{_0x7de196=0xce;}_0xecbac8[_0x2dc3('0x26')](_0x7de196);return _0xecbac8[_0x2dc3('0x2b')]('Content-Range',_0x1c8196+'-'+_0x4f6848+'/'+_0x2e63b6)[_0x2dc3('0x28')](_0x331a16);}return null;};}function patchUpdates(_0x3ac8fa){return function(_0x2eef5a){try{jsonpatch['apply'](_0x2eef5a,_0x3ac8fa,!![]);}catch(_0x118d11){return BPromise[_0x2dc3('0x2c')](_0x118d11);}return _0x2eef5a[_0x2dc3('0x2d')]();};}function saveUpdates(_0x4f4985,_0xe972e3){return function(_0x1c0430){if(_0x1c0430){return _0x1c0430['update'](_0x4f4985)[_0x2dc3('0x1b')](function(_0x186ce8){return _0x186ce8;});}return null;};}function removeEntity(_0x1ba27e,_0x30100c){return function(_0x3a1f25){if(_0x3a1f25){return _0x3a1f25['destroy']()[_0x2dc3('0x1b')](function(){_0x1ba27e[_0x2dc3('0x26')](0xcc)[_0x2dc3('0x27')]();});}};}function handleEntityNotFound(_0x5c6bb9,_0x124dcf){return function(_0x514e90){if(!_0x514e90){_0x5c6bb9[_0x2dc3('0x25')](0x194);}return _0x514e90;};}function handleError(_0x1f55bb,_0xa635dd){_0xa635dd=_0xa635dd||0x1f4;return function(_0x33363d){logger[_0x2dc3('0x20')](_0x33363d[_0x2dc3('0x2e')]);if(_0x33363d[_0x2dc3('0x2f')]){delete _0x33363d[_0x2dc3('0x2f')];}_0x1f55bb[_0x2dc3('0x26')](_0xa635dd)[_0x2dc3('0x30')](_0x33363d);};}exports[_0x2dc3('0x31')]=function(_0x4ec2d7,_0x4a10a8){var _0x33f438={},_0xdb2979={},_0x3dd2ac={'count':0x0,'rows':[]};var _0xee203b=_[_0x2dc3('0x32')](db[_0x2dc3('0x33')][_0x2dc3('0x34')],function(_0x182b5f){return{'name':_0x182b5f['fieldName'],'type':_0x182b5f['type']['key']};});_0xdb2979[_0x2dc3('0x35')]=_['map'](_0xee203b,_0x2dc3('0x2f'));_0xdb2979[_0x2dc3('0x36')]=_[_0x2dc3('0x37')](_0x4ec2d7[_0x2dc3('0x36')]);_0xdb2979[_0x2dc3('0x38')]=_[_0x2dc3('0x39')](_0xdb2979['model'],_0xdb2979[_0x2dc3('0x36')]);_0x33f438['attributes']=_[_0x2dc3('0x39')](_0xdb2979['model'],qs[_0x2dc3('0x3a')](_0x4ec2d7[_0x2dc3('0x36')]['fields']));_0x33f438[_0x2dc3('0x3b')]=_0x33f438['attributes'][_0x2dc3('0x3c')]?_0x33f438[_0x2dc3('0x3b')]:_0xdb2979[_0x2dc3('0x35')];if(!_0x4ec2d7['query'][_0x2dc3('0x3d')](_0x2dc3('0x3e'))){_0x33f438[_0x2dc3('0x3f')]=qs[_0x2dc3('0x3f')](_0x4ec2d7[_0x2dc3('0x36')][_0x2dc3('0x3f')]);_0x33f438[_0x2dc3('0x2a')]=qs[_0x2dc3('0x2a')](_0x4ec2d7[_0x2dc3('0x36')][_0x2dc3('0x2a')]);}_0x33f438['order']=qs[_0x2dc3('0x40')](_0x4ec2d7[_0x2dc3('0x36')][_0x2dc3('0x40')]);_0x33f438['where']=qs['filters'](_[_0x2dc3('0x41')](_0x4ec2d7[_0x2dc3('0x36')],_0xdb2979['filters']),_0xee203b);if(_0x4ec2d7[_0x2dc3('0x36')][_0x2dc3('0x42')]){_0x33f438[_0x2dc3('0x43')]=_[_0x2dc3('0x44')](_0x33f438[_0x2dc3('0x43')],{'$or':_[_0x2dc3('0x32')](_0xee203b,function(_0x468ed5){if(_0x468ed5['type']!==_0x2dc3('0x45')){var _0x7a33c2={};_0x7a33c2[_0x468ed5['name']]={'$like':'%'+_0x4ec2d7[_0x2dc3('0x36')][_0x2dc3('0x42')]+'%'};return _0x7a33c2;}})});}_0x33f438=_['merge']({},_0x33f438,_0x4ec2d7[_0x2dc3('0x46')]);var _0x40c07b={'where':_0x33f438[_0x2dc3('0x43')]};return db['Setting']['count'](_0x40c07b)['then'](function(_0x370a14){_0x3dd2ac['count']=_0x370a14;if(_0x4ec2d7[_0x2dc3('0x36')][_0x2dc3('0x47')]){_0x33f438[_0x2dc3('0x48')]=[{'all':!![]}];}return db['Setting'][_0x2dc3('0x49')](_0x33f438);})[_0x2dc3('0x1b')](function(_0x5b487c){_0x3dd2ac[_0x2dc3('0x4a')]=_0x5b487c;return _0x3dd2ac;})['then'](respondWithFilteredResult(_0x4a10a8,_0x33f438))[_0x2dc3('0x4b')](handleError(_0x4a10a8,null));};exports['show']=function(_0x5f0925,_0x4cb52b){var _0x2365f4={'raw':![],'where':{'id':_0x5f0925[_0x2dc3('0x4c')]['id']}},_0x4b98a0={};_0x4b98a0['model']=_[_0x2dc3('0x37')](db[_0x2dc3('0x33')]['rawAttributes']);_0x4b98a0[_0x2dc3('0x36')]=_['keys'](_0x5f0925[_0x2dc3('0x36')]);_0x4b98a0[_0x2dc3('0x38')]=_[_0x2dc3('0x39')](_0x4b98a0[_0x2dc3('0x35')],_0x4b98a0['query']);_0x2365f4[_0x2dc3('0x3b')]=_['intersection'](_0x4b98a0[_0x2dc3('0x35')],qs[_0x2dc3('0x3a')](_0x5f0925[_0x2dc3('0x36')]['fields']));_0x2365f4[_0x2dc3('0x3b')]=_0x2365f4[_0x2dc3('0x3b')][_0x2dc3('0x3c')]?_0x2365f4[_0x2dc3('0x3b')]:_0x4b98a0[_0x2dc3('0x35')];if(_0x5f0925[_0x2dc3('0x36')][_0x2dc3('0x47')]){_0x2365f4['include']=[{'all':!![]}];}_0x2365f4=_['merge']({},_0x2365f4,_0x5f0925['options']);return db[_0x2dc3('0x33')]['find'](_0x2365f4)['then'](handleEntityNotFound(_0x4cb52b,null))['then'](respondWithResult(_0x4cb52b,null))[_0x2dc3('0x4b')](handleError(_0x4cb52b,null));};exports['update']=function(_0x2f514f,_0x14a32d){if(_0x2f514f['body']['id']){delete _0x2f514f[_0x2dc3('0x4d')]['id'];}return db[_0x2dc3('0x33')][_0x2dc3('0x4e')]({'where':{'id':_0x2f514f[_0x2dc3('0x4c')]['id']}})[_0x2dc3('0x1b')](handleEntityNotFound(_0x14a32d,null))[_0x2dc3('0x1b')](saveUpdates(_0x2f514f[_0x2dc3('0x4d')],null))[_0x2dc3('0x1b')](respondWithResult(_0x14a32d,null))['catch'](handleError(_0x14a32d,null));};exports[_0x2dc3('0x4f')]=function(_0x457c61,_0x1b773c,_0x8b1312){if(_0x457c61[_0x2dc3('0x50')]&&_0x457c61[_0x2dc3('0x50')]['filename']){_0x457c61[_0x2dc3('0x4d')][_0x2dc3('0x51')]=_0x457c61['file']['filename'];}return db['Setting'][_0x2dc3('0x4e')]({'where':{'id':_0x457c61[_0x2dc3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1b773c,null))['then'](saveUpdates(_0x457c61[_0x2dc3('0x4d')],null))[_0x2dc3('0x1b')](respondWithResult(_0x1b773c,null))[_0x2dc3('0x4b')](handleError(_0x1b773c,null));};exports[_0x2dc3('0x52')]=function(_0x1df57c,_0x497077,_0x2cf121){if(_0x1df57c[_0x2dc3('0x50')]&&_0x1df57c[_0x2dc3('0x50')][_0x2dc3('0x53')]){_0x1df57c[_0x2dc3('0x4d')][_0x2dc3('0x54')]=_0x1df57c[_0x2dc3('0x50')][_0x2dc3('0x53')];}return db['Setting'][_0x2dc3('0x4e')]({'where':{'id':_0x1df57c[_0x2dc3('0x4c')]['id']}})[_0x2dc3('0x1b')](handleEntityNotFound(_0x497077,null))[_0x2dc3('0x1b')](saveUpdates(_0x1df57c[_0x2dc3('0x4d')],null))[_0x2dc3('0x1b')](respondWithResult(_0x497077,null))['catch'](handleError(_0x497077,null));};var utilLicense=require(_0x2dc3('0x16'));exports[_0x2dc3('0x55')]=function(_0x1d0add,_0x2c54d3,_0x46a0f2){var _0x545344=_0x2dc3('0x56');var _0x335e3f={'custom':![]};return utilLicense[_0x2dc3('0x57')]()[_0x2dc3('0x1b')](function(_0x5693d2){if(_0x5693d2){_0x335e3f=_0x5693d2;}return db['Setting'][_0x2dc3('0x4e')]({'where':{'id':_0x1d0add[_0x2dc3('0x4c')]['id']},'attributes':[_0x2dc3('0x51'),'loginLogo',_0x2dc3('0x58'),_0x2dc3('0x59'),_0x2dc3('0x5a'),'defaultLoginLogo',_0x2dc3('0x5b'),_0x2dc3('0x5c')],'raw':!![]});})[_0x2dc3('0x1b')](handleEntityNotFound(_0x2c54d3,null))[_0x2dc3('0x1b')](function(_0x2f2b68){if(_0x2f2b68){var _0x1b9173=_0x2f2b68['logo']&&fs[_0x2dc3('0x5d')](path[_0x2dc3('0x5e')](config['root'],_0x545344,_[_0x2dc3('0x5f')](_0x2f2b68[_0x2dc3('0x51')])))?path[_0x2dc3('0x5e')](config[_0x2dc3('0x60')],_0x545344,_[_0x2dc3('0x5f')](_0x2f2b68[_0x2dc3('0x51')])):path[_0x2dc3('0x5e')](config[_0x2dc3('0x60')],_0x545344,_[_0x2dc3('0x5f')](_0x2dc3('0x61')));var _0x425fcf=_0x2dc3('0x62')+_[_0x2dc3('0x63')](_0x2dc3('0x51'));if(_0x2f2b68[_0x425fcf]||!_0x335e3f[_0x2dc3('0x64')]){_0x1b9173=path['join'](config['root'],_0x545344,_[_0x2dc3('0x5f')](_0x2dc3('0x61')));}if(!fs[_0x2dc3('0x5d')](_0x1b9173)){throw new db['Sequelize'][(_0x2dc3('0x65'))](_['upperFirst']('logo')+_0x2dc3('0x66'));}return _0x2c54d3[_0x2dc3('0x67')](_0x1b9173);}})['catch'](handleError(_0x2c54d3,null));};var utilLicense=require(_0x2dc3('0x16'));exports[_0x2dc3('0x68')]=function(_0x5f49ce,_0x315ddc,_0x2a8f13){var _0x451f53=_0x2dc3('0x56');var _0x97a5a8={'custom':![]};return utilLicense[_0x2dc3('0x57')]()[_0x2dc3('0x1b')](function(_0x507e50){if(_0x507e50){_0x97a5a8=_0x507e50;}return db['Setting']['find']({'where':{'id':_0x5f49ce[_0x2dc3('0x4c')]['id']},'attributes':[_0x2dc3('0x51'),_0x2dc3('0x54'),_0x2dc3('0x58'),_0x2dc3('0x59'),_0x2dc3('0x5a'),_0x2dc3('0x69'),'defaultPreferred',_0x2dc3('0x5c')],'raw':!![]});})[_0x2dc3('0x1b')](handleEntityNotFound(_0x315ddc,null))[_0x2dc3('0x1b')](function(_0x21dbf3){if(_0x21dbf3){var _0x2b0a4e=_0x21dbf3['loginLogo']&&fs[_0x2dc3('0x5d')](path['join'](config[_0x2dc3('0x60')],_0x451f53,_[_0x2dc3('0x5f')](_0x21dbf3[_0x2dc3('0x54')])))?path[_0x2dc3('0x5e')](config[_0x2dc3('0x60')],_0x451f53,_[_0x2dc3('0x5f')](_0x21dbf3['loginLogo'])):path[_0x2dc3('0x5e')](config[_0x2dc3('0x60')],_0x451f53,_[_0x2dc3('0x5f')](_0x2dc3('0x6a')));var _0x3fa561=_0x2dc3('0x62')+_[_0x2dc3('0x63')](_0x2dc3('0x54'));if(_0x21dbf3[_0x3fa561]||!_0x97a5a8[_0x2dc3('0x64')]){_0x2b0a4e=path[_0x2dc3('0x5e')](config['root'],_0x451f53,_[_0x2dc3('0x5f')](_0x2dc3('0x6a')));}if(!fs[_0x2dc3('0x5d')](_0x2b0a4e)){throw new db[(_0x2dc3('0x6b'))][(_0x2dc3('0x65'))](_[_0x2dc3('0x63')](_0x2dc3('0x54'))+_0x2dc3('0x66'));}return _0x315ddc['download'](_0x2b0a4e);}})['catch'](handleError(_0x315ddc,null));};exports[_0x2dc3('0x6c')]=function(_0x4b5461,_0x277ec1){return db[_0x2dc3('0x33')][_0x2dc3('0x4e')]({'where':{'id':_0x4b5461[_0x2dc3('0x4c')]['id']},'attributes':['securePassword']})[_0x2dc3('0x1b')](respondWithResult(_0x277ec1,null))[_0x2dc3('0x4b')](handleError(_0x277ec1,null));};exports['addPreferred']=function(_0x12f6f1,_0x32438c,_0x4b5f7a){if(_0x12f6f1[_0x2dc3('0x50')]&&_0x12f6f1['file'][_0x2dc3('0x53')]){_0x12f6f1[_0x2dc3('0x4d')][_0x2dc3('0x58')]=_0x12f6f1[_0x2dc3('0x50')]['filename'];}return db['Setting'][_0x2dc3('0x4e')]({'where':{'id':_0x12f6f1[_0x2dc3('0x4c')]['id']}})[_0x2dc3('0x1b')](handleEntityNotFound(_0x32438c,null))[_0x2dc3('0x1b')](saveUpdates(_0x12f6f1[_0x2dc3('0x4d')],null))[_0x2dc3('0x1b')](respondWithResult(_0x32438c,null))[_0x2dc3('0x4b')](handleError(_0x32438c,null));};var utilLicense=require(_0x2dc3('0x16'));exports['getPreferred']=function(_0x455307,_0x266814,_0x352e3c){var _0x283683=_0x2dc3('0x56');var _0x3709d6={'custom':![]};return utilLicense[_0x2dc3('0x57')]()['then'](function(_0x2d58eb){if(_0x2d58eb){_0x3709d6=_0x2d58eb;}return db[_0x2dc3('0x33')][_0x2dc3('0x4e')]({'where':{'id':_0x455307['params']['id']},'attributes':[_0x2dc3('0x51'),_0x2dc3('0x54'),'preferred','favicon',_0x2dc3('0x5a'),_0x2dc3('0x69'),_0x2dc3('0x5b'),_0x2dc3('0x5c')],'raw':!![]});})[_0x2dc3('0x1b')](handleEntityNotFound(_0x266814,null))[_0x2dc3('0x1b')](function(_0x5a1409){if(_0x5a1409){var _0x230be0=_0x5a1409['preferred']&&fs[_0x2dc3('0x5d')](path['join'](config[_0x2dc3('0x60')],_0x283683,_[_0x2dc3('0x5f')](_0x5a1409[_0x2dc3('0x58')])))?path[_0x2dc3('0x5e')](config[_0x2dc3('0x60')],_0x283683,_[_0x2dc3('0x5f')](_0x5a1409[_0x2dc3('0x58')])):path[_0x2dc3('0x5e')](config[_0x2dc3('0x60')],_0x283683,_[_0x2dc3('0x5f')](_0x2dc3('0x6d')));var _0x400af5=_0x2dc3('0x62')+_[_0x2dc3('0x63')](_0x2dc3('0x58'));if(_0x5a1409[_0x400af5]||!_0x3709d6[_0x2dc3('0x64')]||!_0x3709d6[_0x2dc3('0x58')]){_0x230be0=path[_0x2dc3('0x5e')](config[_0x2dc3('0x60')],_0x283683,_[_0x2dc3('0x5f')](_0x2dc3('0x6d')));}if(!fs[_0x2dc3('0x5d')](_0x230be0)){throw new db[(_0x2dc3('0x6b'))][(_0x2dc3('0x65'))](_[_0x2dc3('0x63')]('preferred')+'\x20not\x20found');}return _0x266814[_0x2dc3('0x67')](_0x230be0);}})[_0x2dc3('0x4b')](handleError(_0x266814,null));};exports[_0x2dc3('0x6e')]=function(_0xa84f61,_0x3bc2da,_0x3cfe91){if(_0xa84f61['file']&&_0xa84f61[_0x2dc3('0x50')][_0x2dc3('0x53')]){_0xa84f61[_0x2dc3('0x4d')][_0x2dc3('0x59')]=_0xa84f61[_0x2dc3('0x50')]['filename'];}return db['Setting'][_0x2dc3('0x4e')]({'where':{'id':_0xa84f61[_0x2dc3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3bc2da,null))['then'](saveUpdates(_0xa84f61['body'],null))['then'](respondWithResult(_0x3bc2da,null))['catch'](handleError(_0x3bc2da,null));};var utilLicense=require(_0x2dc3('0x16'));exports[_0x2dc3('0x6f')]=function(_0x45a5a2,_0xacb027,_0x2940fa){var _0x49738d=_0x2dc3('0x56');var _0x231a4e={'custom':![]};return utilLicense[_0x2dc3('0x57')]()['then'](function(_0xb532a3){if(_0xb532a3){_0x231a4e=_0xb532a3;}return db[_0x2dc3('0x33')][_0x2dc3('0x4e')]({'where':{'id':_0x45a5a2[_0x2dc3('0x4c')]['id']},'attributes':[_0x2dc3('0x51'),'loginLogo','preferred',_0x2dc3('0x59'),_0x2dc3('0x5a'),_0x2dc3('0x69'),_0x2dc3('0x5b'),_0x2dc3('0x5c')],'raw':!![]});})[_0x2dc3('0x1b')](handleEntityNotFound(_0xacb027,null))[_0x2dc3('0x1b')](function(_0x44d039){if(_0x44d039){var _0x11144a=_0x44d039[_0x2dc3('0x59')]&&fs['existsSync'](path['join'](config[_0x2dc3('0x60')],_0x49738d,_['toLower'](_0x44d039[_0x2dc3('0x59')])))?path[_0x2dc3('0x5e')](config[_0x2dc3('0x60')],_0x49738d,_['toLower'](_0x44d039['favicon'])):path['join'](config['root'],_0x49738d,_[_0x2dc3('0x5f')](_0x2dc3('0x70')));var _0x286416='default'+_['upperFirst']('favicon');if(_0x44d039[_0x286416]||!_0x231a4e[_0x2dc3('0x64')]){_0x11144a=path[_0x2dc3('0x5e')](config[_0x2dc3('0x60')],_0x49738d,_[_0x2dc3('0x5f')](_0x2dc3('0x70')));}if(!fs[_0x2dc3('0x5d')](_0x11144a)){throw new db[(_0x2dc3('0x6b'))][(_0x2dc3('0x65'))](_[_0x2dc3('0x63')](_0x2dc3('0x59'))+_0x2dc3('0x66'));}return _0xacb027[_0x2dc3('0x67')](_0x11144a);}})[_0x2dc3('0x4b')](handleError(_0xacb027,null));};exports[_0x2dc3('0x71')]=function(_0x2d1d85,_0x16f816){var _0x1a1f8b={'offset':moment()[_0x2dc3('0x72')]()};_0x1a1f8b[_0x2dc3('0x73')]=moment()[_0x2dc3('0x72')](_0x1a1f8b['offset'])[_0x2dc3('0x74')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x16f816['status'](0xc8)['send'](_0x1a1f8b);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 0f60e4e..3bc2226 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 _0x1c7e=['request-promise','path','../../config/environment','exports','define','Setting','settings','util','api','moment'];(function(_0x7a1153,_0x48c2a3){var _0x1fc52b=function(_0x45c1bd){while(--_0x45c1bd){_0x7a1153['push'](_0x7a1153['shift']());}};_0x1fc52b(++_0x48c2a3);}(_0x1c7e,0x133));var _0xe1c7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1c7e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xe1c7('0x0'));var logger=require('../../config/logger')(_0xe1c7('0x1'));var moment=require(_0xe1c7('0x2'));var BPromise=require('bluebird');var rp=require(_0xe1c7('0x3'));var fs=require('fs');var path=require(_0xe1c7('0x4'));var rimraf=require('rimraf');var config=require(_0xe1c7('0x5'));var attributes=require('./setting.attributes');module[_0xe1c7('0x6')]=function(_0x42248a,_0x2e9725){return _0x42248a[_0xe1c7('0x7')](_0xe1c7('0x8'),attributes,{'tableName':_0xe1c7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbeda=['lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','settings'];(function(_0x2525f1,_0x47034f){var _0x13c1b5=function(_0x2beb2e){while(--_0x2beb2e){_0x2525f1['push'](_0x2525f1['shift']());}};_0x13c1b5(++_0x47034f);}(_0xbeda,0x1b8));var _0xabed=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0xbeda[_0x99868f];return _0x27a71b;};'use strict';var _=require(_0xabed('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xabed('0x1'));var moment=require(_0xabed('0x2'));var BPromise=require(_0xabed('0x3'));var rp=require(_0xabed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xabed('0x5'));var config=require(_0xabed('0x6'));var attributes=require('./setting.attributes');module[_0xabed('0x7')]=function(_0x13ad4a,_0x1c68f1){return _0x13ad4a[_0xabed('0x8')]('Setting',attributes,{'tableName':_0xabed('0x9'),'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 c384f4a..ba963e3 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 _0xe9da=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb'];(function(_0xc59487,_0x5b1158){var _0x5d0908=function(_0x4dd73b){while(--_0x4dd73b){_0xc59487['push'](_0xc59487['shift']());}};_0x5d0908(++_0x5b1158);}(_0xe9da,0xb8));var _0xae9d=function(_0x267f76,_0x1d99bb){_0x267f76=_0x267f76-0x0;var _0x483a37=_0xe9da[_0x267f76];return _0x483a37;};'use strict';var _=require(_0xae9d('0x0'));var util=require(_0xae9d('0x1'));var moment=require(_0xae9d('0x2'));var BPromise=require(_0xae9d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae9d('0x4'))['db'];var utils=require(_0xae9d('0x5'));var logger=require(_0xae9d('0x6'))('rpc');var config=require(_0xae9d('0x7'));var jayson=require(_0xae9d('0x8'));var client=jayson[_0xae9d('0x9')][_0xae9d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x222759,_0x2f7449,_0x49397a){return new BPromise(function(_0x45a8f4,_0x57ff50){return client[_0xae9d('0xb')](_0x222759,_0x49397a)['then'](function(_0x3fe8d1){logger[_0xae9d('0xc')](_0xae9d('0xd'),_0x2f7449,_0xae9d('0xe'));logger['debug'](_0xae9d('0xf'),_0x2f7449,'request\x20sent',JSON[_0xae9d('0x10')](_0x3fe8d1));if(_0x3fe8d1[_0xae9d('0x11')]){if(_0x3fe8d1[_0xae9d('0x11')][_0xae9d('0x12')]===0x1f4){logger['error'](_0xae9d('0xd'),_0x2f7449,_0x3fe8d1[_0xae9d('0x11')][_0xae9d('0x13')]);return _0x57ff50(_0x3fe8d1[_0xae9d('0x11')][_0xae9d('0x13')]);}logger[_0xae9d('0x11')](_0xae9d('0xd'),_0x2f7449,_0x3fe8d1[_0xae9d('0x11')]['message']);return _0x45a8f4(_0x3fe8d1[_0xae9d('0x11')][_0xae9d('0x13')]);}else{logger['info'](_0xae9d('0xd'),_0x2f7449,_0xae9d('0xe'));_0x45a8f4(_0x3fe8d1[_0xae9d('0x14')][_0xae9d('0x13')]);}})['catch'](function(_0xdd997c){logger['error'](_0xae9d('0xd'),_0x2f7449,_0xdd997c);_0x57ff50(_0xdd997c);});});} \ No newline at end of file +var _0xe925=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x13e99e,_0x1c56f4){var _0x28196b=function(_0xe034d0){while(--_0xe034d0){_0x13e99e['push'](_0x13e99e['shift']());}};_0x28196b(++_0x1c56f4);}(_0xe925,0x1b6));var _0x5e92=function(_0x1637f4,_0x3216fe){_0x1637f4=_0x1637f4-0x0;var _0x1369e3=_0xe925[_0x1637f4];return _0x1369e3;};'use strict';var _=require(_0x5e92('0x0'));var util=require(_0x5e92('0x1'));var moment=require(_0x5e92('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e92('0x3'));var db=require(_0x5e92('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e92('0x5'))('rpc');var config=require(_0x5e92('0x6'));var jayson=require(_0x5e92('0x7'));var client=jayson[_0x5e92('0x8')][_0x5e92('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcd9ddb,_0x18ff86,_0x1422a9){return new BPromise(function(_0x29e7f0,_0x4d48e8){return client['request'](_0xcd9ddb,_0x1422a9)[_0x5e92('0xa')](function(_0x18b263){logger['info'](_0x5e92('0xb'),_0x18ff86,'request\x20sent');logger[_0x5e92('0xc')](_0x5e92('0xd'),_0x18ff86,_0x5e92('0xe'),JSON[_0x5e92('0xf')](_0x18b263));if(_0x18b263[_0x5e92('0x10')]){if(_0x18b263['error'][_0x5e92('0x11')]===0x1f4){logger['error'](_0x5e92('0xb'),_0x18ff86,_0x18b263[_0x5e92('0x10')][_0x5e92('0x12')]);return _0x4d48e8(_0x18b263[_0x5e92('0x10')][_0x5e92('0x12')]);}logger[_0x5e92('0x10')](_0x5e92('0xb'),_0x18ff86,_0x18b263[_0x5e92('0x10')][_0x5e92('0x12')]);return _0x29e7f0(_0x18b263[_0x5e92('0x10')]['message']);}else{logger['info'](_0x5e92('0xb'),_0x18ff86,_0x5e92('0xe'));_0x29e7f0(_0x18b263[_0x5e92('0x13')][_0x5e92('0x12')]);}})[_0x5e92('0x14')](function(_0x3d2487){logger[_0x5e92('0x10')](_0x5e92('0xb'),_0x18ff86,_0x3d2487);_0x4d48e8(_0x3d2487);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 8532b30..e5e7a5c 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 _0x2688=['/:id/send','send','status','addAgents','update','removeDispositions','delete','util','connect-timeout','../../components/auth/service','../../config/environment','./smsAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications'];(function(_0x33a7b5,_0x985819){var _0x26f377=function(_0x503770){while(--_0x503770){_0x33a7b5['push'](_0x33a7b5['shift']());}};_0x26f377(++_0x985819);}(_0x2688,0x172));var _0x8268=function(_0x2068ee,_0x42966a){_0x2068ee=_0x2068ee-0x0;var _0xa36814=_0x2688[_0x2068ee];return _0xa36814;};'use strict';var multer=require('multer');var util=require(_0x8268('0x0'));var path=require('path');var timeout=require(_0x8268('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x8268('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x8268('0x3'));var controller=require(_0x8268('0x4'));router[_0x8268('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8268('0x5')](_0x8268('0x6'),auth[_0x8268('0x7')](),controller[_0x8268('0x8')]);router[_0x8268('0x5')](_0x8268('0x9'),auth[_0x8268('0x7')](),controller[_0x8268('0xa')]);router['get'](_0x8268('0xb'),auth[_0x8268('0x7')](),controller[_0x8268('0xc')]);router[_0x8268('0x5')](_0x8268('0xd'),auth[_0x8268('0x7')](),controller[_0x8268('0xe')]);router[_0x8268('0x5')](_0x8268('0xf'),auth[_0x8268('0x7')](),controller['getApplications']);router[_0x8268('0x5')]('/:id/interactions',auth[_0x8268('0x7')](),controller[_0x8268('0x10')]);router[_0x8268('0x5')]('/:id/status',controller['statusGet']);router[_0x8268('0x5')](_0x8268('0x11'),auth[_0x8268('0x7')](),controller[_0x8268('0x12')]);router[_0x8268('0x13')]('/',auth[_0x8268('0x7')](),controller[_0x8268('0x14')]);router[_0x8268('0x13')](_0x8268('0xb'),auth[_0x8268('0x7')](),controller[_0x8268('0x15')]);router[_0x8268('0x13')](_0x8268('0xd'),auth[_0x8268('0x7')](),controller[_0x8268('0x16')]);router[_0x8268('0x13')](_0x8268('0x17'),controller[_0x8268('0x18')]);router['post'](_0x8268('0xf'),auth[_0x8268('0x7')](),controller[_0x8268('0x19')]);router[_0x8268('0x13')](_0x8268('0x1a'),auth[_0x8268('0x7')](),controller[_0x8268('0x1b')]);router[_0x8268('0x13')]('/:id/status',controller[_0x8268('0x1c')]);router[_0x8268('0x13')](_0x8268('0x11'),auth[_0x8268('0x7')](),controller[_0x8268('0x1d')]);router['put'](_0x8268('0x9'),auth[_0x8268('0x7')](),controller[_0x8268('0x1e')]);router['delete'](_0x8268('0x9'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x8268('0xb'),auth['isAuthenticated'](),controller[_0x8268('0x1f')]);router[_0x8268('0x20')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x8268('0x20')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xda6d=['removeAgents','multer','util','connect-timeout','Router','./smsAccount.controller','isAuthenticated','index','get','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','addAnswer','/:id/notify','/:id/applications','addApplications','/:id/send','send','status','/:id','update','destroy','delete','removeDispositions','removeAnswers'];(function(_0x1b8a09,_0xfa4f73){var _0x53c51c=function(_0x198446){while(--_0x198446){_0x1b8a09['push'](_0x1b8a09['shift']());}};_0x53c51c(++_0xfa4f73);}(_0xda6d,0xdf));var _0xdda6=function(_0x4eac56,_0x291177){_0x4eac56=_0x4eac56-0x0;var _0x1cffe3=_0xda6d[_0x4eac56];return _0x1cffe3;};'use strict';var multer=require(_0xdda6('0x0'));var util=require(_0xdda6('0x1'));var path=require('path');var timeout=require(_0xdda6('0x2'));var express=require('express');var router=express[_0xdda6('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdda6('0x4'));router['get']('/',auth[_0xdda6('0x5')](),controller[_0xdda6('0x6')]);router[_0xdda6('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xdda6('0x7')]('/:id',auth[_0xdda6('0x5')](),controller[_0xdda6('0x8')]);router[_0xdda6('0x7')](_0xdda6('0x9'),auth['isAuthenticated'](),controller[_0xdda6('0xa')]);router['get'](_0xdda6('0xb'),auth[_0xdda6('0x5')](),controller[_0xdda6('0xc')]);router['get']('/:id/applications',auth[_0xdda6('0x5')](),controller[_0xdda6('0xd')]);router[_0xdda6('0x7')](_0xdda6('0xe'),auth[_0xdda6('0x5')](),controller[_0xdda6('0xf')]);router[_0xdda6('0x7')](_0xdda6('0x10'),controller[_0xdda6('0x11')]);router[_0xdda6('0x7')](_0xdda6('0x12'),auth[_0xdda6('0x5')](),controller[_0xdda6('0x13')]);router['post']('/',auth[_0xdda6('0x5')](),controller[_0xdda6('0x14')]);router[_0xdda6('0x15')](_0xdda6('0x9'),auth[_0xdda6('0x5')](),controller[_0xdda6('0x16')]);router[_0xdda6('0x15')](_0xdda6('0xb'),auth[_0xdda6('0x5')](),controller[_0xdda6('0x17')]);router['post'](_0xdda6('0x18'),controller['notify']);router[_0xdda6('0x15')](_0xdda6('0x19'),auth[_0xdda6('0x5')](),controller[_0xdda6('0x1a')]);router[_0xdda6('0x15')](_0xdda6('0x1b'),auth[_0xdda6('0x5')](),controller[_0xdda6('0x1c')]);router[_0xdda6('0x15')](_0xdda6('0x10'),controller[_0xdda6('0x1d')]);router['post'](_0xdda6('0x12'),auth[_0xdda6('0x5')](),controller['addAgents']);router['put'](_0xdda6('0x1e'),auth[_0xdda6('0x5')](),controller[_0xdda6('0x1f')]);router['delete']('/:id',auth[_0xdda6('0x5')](),controller[_0xdda6('0x20')]);router[_0xdda6('0x21')](_0xdda6('0x9'),auth['isAuthenticated'](),controller[_0xdda6('0x22')]);router[_0xdda6('0x21')]('/:id/canned_answers',auth[_0xdda6('0x5')](),controller[_0xdda6('0x23')]);router[_0xdda6('0x21')](_0xdda6('0x12'),auth['isAuthenticated'](),controller[_0xdda6('0x24')]);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 ace1a27..a389a1c 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 _0xaa5e=['skebby','plivo','clickatell','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','name','ENUM','twilio'];(function(_0x23629f,_0x4b37fa){var _0x4d810a=function(_0x4a6d95){while(--_0x4a6d95){_0x23629f['push'](_0x23629f['shift']());}};_0x4d810a(++_0x4b37fa);}(_0xaa5e,0xa5));var _0xeaa5=function(_0x2ec0e8,_0x37eb26){_0x2ec0e8=_0x2ec0e8-0x0;var _0x242521=_0xaa5e[_0x2ec0e8];return _0x242521;};'use strict';var Sequelize=require(_0xeaa5('0x0'));var rs=require(_0xeaa5('0x1'));module['exports']={'name':{'type':Sequelize[_0xeaa5('0x2')],'unique':_0xeaa5('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xeaa5('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xeaa5('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xeaa5('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xeaa5('0x2')]},'type':{'type':Sequelize[_0xeaa5('0x4')](_0xeaa5('0x5'),_0xeaa5('0x6'),'connectel','clicksend',_0xeaa5('0x7'),_0xeaa5('0x8'),'bandwidth',_0xeaa5('0x9'),_0xeaa5('0xa'),'intelepeer')},'accountSid':{'type':Sequelize[_0xeaa5('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xeaa5('0x2')]},'smsMethod':{'type':Sequelize[_0xeaa5('0x4')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xeaa5('0x2')]},'apiKey':{'type':Sequelize[_0xeaa5('0x2')]},'applicationId':{'type':Sequelize[_0xeaa5('0x2')]},'accountId':{'type':Sequelize[_0xeaa5('0x2')]},'senderString':{'type':Sequelize[_0xeaa5('0x2')]},'deliveryReport':{'type':Sequelize[_0xeaa5('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0xeaa5('0x2')]},'notificationTemplate':{'type':Sequelize[_0xeaa5('0xc')],'defaultValue':function(){return _0xeaa5('0xd');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xeaa5('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xeaa5('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xeaa5('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xeaa5('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xeaa5('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xeaa5('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xeaa5('0xf')},'mandatoryDisposition':{'type':Sequelize[_0xeaa5('0xb')],'defaultValue':![],'comment':_0xeaa5('0x10'),'set':function(_0x507fb4){if(!_0x507fb4)this[_0xeaa5('0x11')]('mandatoryDispositionPauseId',null);this[_0xeaa5('0x11')](_0xeaa5('0x12'),_0x507fb4);}}}; \ No newline at end of file +var _0x3176=['skebby','connectel','clicksend','plivo','bandwidth','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','setDataValue','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio'];(function(_0x38713e,_0x4bdc87){var _0x3adf5a=function(_0x417cc9){while(--_0x417cc9){_0x38713e['push'](_0x38713e['shift']());}};_0x3adf5a(++_0x4bdc87);}(_0x3176,0x1d8));var _0x6317=function(_0x2bb99f,_0x3b8167){_0x2bb99f=_0x2bb99f-0x0;var _0x1632ba=_0x3176[_0x2bb99f];return _0x1632ba;};'use strict';var Sequelize=require(_0x6317('0x0'));var rs=require(_0x6317('0x1'));module[_0x6317('0x2')]={'name':{'type':Sequelize[_0x6317('0x3')],'unique':_0x6317('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x6317('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x6317('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x6317('0x3')],'defaultValue':function(){return rs[_0x6317('0x5')]();}},'phone':{'type':Sequelize[_0x6317('0x3')]},'type':{'type':Sequelize[_0x6317('0x6')](_0x6317('0x7'),_0x6317('0x8'),_0x6317('0x9'),_0x6317('0xa'),_0x6317('0xb'),'clickatell',_0x6317('0xc'),_0x6317('0xd'),_0x6317('0xe'),'intelepeer')},'accountSid':{'type':Sequelize[_0x6317('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x6317('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x6317('0x3')]},'password':{'type':Sequelize[_0x6317('0x3')]},'apiKey':{'type':Sequelize[_0x6317('0x3')]},'applicationId':{'type':Sequelize[_0x6317('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x6317('0x3')]},'deliveryReport':{'type':Sequelize[_0x6317('0xf')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x6317('0x10')],'defaultValue':function(){return _0x6317('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6317('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6317('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6317('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6317('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6317('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x6317('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6317('0x12')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1b42b3){if(!_0x1b42b3)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x6317('0x13')]('mandatoryDisposition',_0x1b42b3);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 43de0d2..68d8e6c 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 _0xfb83=['merge','options','include','rows','show','params','length','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','offset','includeAll','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','SmsApplication','Applications','account','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','from','From','Body','MessageSid','skebby','sender','connectel','clicksend','plivo','Text','messageId','MessageUUID','infobip','results','text','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','Contacts','DESC','list','omit','defaults','contact','spread','interaction','created','autoclose','applications','unmanaged','*,*,*,*','SmsMessage','AttachmentId','User','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','send','\x0a','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','SmsInteraction','Contact','Owner','internal','Tag','Tags','color','tag','List','out','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','RECEIVED_BY_RECIPIENT','bandwidth','DELIVRD','ACCEPTD','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','emit','getAgents','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','set','Content-Range','apply','save','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','type'];(function(_0x30f9b6,_0x1ec958){var _0x297bd8=function(_0xcebf3){while(--_0xcebf3){_0x30f9b6['push'](_0x30f9b6['shift']());}};_0x297bd8(++_0x1ec958);}(_0xfb83,0x93));var _0x3fb8=function(_0x13c70c,_0x546b34){_0x13c70c=_0x13c70c-0x0;var _0x50f0f2=_0xfb83[_0x13c70c];return _0x50f0f2;};'use strict';var pdf=require(_0x3fb8('0x0'));var emlformat=require(_0x3fb8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3fb8('0x2'));var rp=require('request-promise');var moment=require(_0x3fb8('0x3'));var BPromise=require(_0x3fb8('0x4'));var Mustache=require(_0x3fb8('0x5'));var util=require(_0x3fb8('0x6'));var path=require(_0x3fb8('0x7'));var sox=require(_0x3fb8('0x8'));var csv=require(_0x3fb8('0x9'));var ejs=require(_0x3fb8('0xa'));var fs=require('fs');var _=require(_0x3fb8('0xb'));var squel=require(_0x3fb8('0xc'));var crypto=require(_0x3fb8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3fb8('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3fb8('0xf'));var Redis=require('ioredis');var authService=require(_0x3fb8('0x10'));var qs=require(_0x3fb8('0x11'));var as=require(_0x3fb8('0x12'));var hardwareService=require(_0x3fb8('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3fb8('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3fb8('0x15'))['db'];config[_0x3fb8('0x16')]=_['defaults'](config[_0x3fb8('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x3fb8('0x17'))(new Redis(config[_0x3fb8('0x16')]));require(_0x3fb8('0x18'))[_0x3fb8('0x19')](socket);var jayson=require(_0x3fb8('0x1a'));var client=jayson[_0x3fb8('0x1b')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2d681f,_0x4e622b,_0x250f13,_0x2a5b24){return new BPromise(function(_0x36378,_0x588bbc){var _0x502f6f=_0x2a5b24||client;return _0x502f6f['request'](_0x2d681f,_0x250f13)[_0x3fb8('0x1c')](function(_0x291d7f){logger['info'](_0x3fb8('0x1d'),_0x4e622b,_0x3fb8('0x1e'));logger['debug'](_0x3fb8('0x1f'),_0x4e622b,_0x3fb8('0x1e'),JSON[_0x3fb8('0x20')](_0x291d7f));if(_0x291d7f[_0x3fb8('0x21')]){if(_0x291d7f[_0x3fb8('0x21')][_0x3fb8('0x22')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x4e622b,_0x291d7f['error'][_0x3fb8('0x23')]);return _0x588bbc(_0x291d7f['error'][_0x3fb8('0x23')]);}logger[_0x3fb8('0x21')](_0x3fb8('0x1d'),_0x4e622b,_0x291d7f[_0x3fb8('0x21')][_0x3fb8('0x23')]);return _0x36378(_0x291d7f[_0x3fb8('0x21')][_0x3fb8('0x23')]);}else{logger['info'](_0x3fb8('0x1d'),_0x4e622b,_0x3fb8('0x1e'));_0x36378(_0x291d7f[_0x3fb8('0x24')][_0x3fb8('0x23')]);}})[_0x3fb8('0x25')](function(_0x22a1bc){logger[_0x3fb8('0x21')](_0x3fb8('0x1d'),_0x4e622b,_0x22a1bc);_0x588bbc(_0x22a1bc);});});}function respondWithStatusCode(_0x205cad,_0x529ce1){_0x529ce1=_0x529ce1||0xcc;return function(_0x2485fe){if(_0x2485fe){return _0x205cad[_0x3fb8('0x26')](_0x529ce1);}return _0x205cad['status'](_0x529ce1)[_0x3fb8('0x27')]();};}function respondWithResult(_0x365ce1,_0x430ac6){_0x430ac6=_0x430ac6||0xc8;return function(_0x228cc0){if(_0x228cc0){return _0x365ce1[_0x3fb8('0x28')](_0x430ac6)[_0x3fb8('0x29')](_0x228cc0);}};}function respondWithFilteredResult(_0x3e49ed,_0x312696){return function(_0x2f45e6){if(_0x2f45e6){var _0x2628c1=_0x2f45e6[_0x3fb8('0x2a')],_0xc3d44f=_0x312696['offset'],_0xa23399=_0x312696['offset']+_0x312696['limit'],_0x32851e;if(_0xa23399>=_0x2628c1){_0xa23399=_0x2628c1;_0x32851e=0xc8;}else{_0x32851e=0xce;}_0x3e49ed[_0x3fb8('0x28')](_0x32851e);return _0x3e49ed[_0x3fb8('0x2b')](_0x3fb8('0x2c'),_0xc3d44f+'-'+_0xa23399+'/'+_0x2628c1)[_0x3fb8('0x29')](_0x2f45e6);}return null;};}function patchUpdates(_0x318bb1){return function(_0x163a84){try{jsonpatch[_0x3fb8('0x2d')](_0x163a84,_0x318bb1,!![]);}catch(_0x163904){return BPromise['reject'](_0x163904);}return _0x163a84[_0x3fb8('0x2e')]();};}function saveUpdates(_0x4943f6,_0x59f8ec){return function(_0x43aa40){if(_0x43aa40){return _0x43aa40[_0x3fb8('0x2f')](_0x4943f6)['then'](function(_0x525570){return _0x525570;});}return null;};}function removeEntity(_0x35db5a,_0xe414e3){return function(_0x25f072){if(_0x25f072){return _0x25f072[_0x3fb8('0x30')]()[_0x3fb8('0x1c')](function(){var _0x5ec523=_0x25f072[_0x3fb8('0x31')]({'plain':!![]});var _0x3b7a88=_0x3fb8('0x32');return db[_0x3fb8('0x33')][_0x3fb8('0x30')]({'where':{'type':_0x3b7a88,'resourceId':_0x5ec523['id']}})[_0x3fb8('0x1c')](function(){return _0x25f072;});})[_0x3fb8('0x1c')](function(){_0x35db5a[_0x3fb8('0x28')](0xcc)[_0x3fb8('0x27')]();});}};}function handleEntityNotFound(_0x54a27c,_0x37c93b){return function(_0x14accc){if(!_0x14accc){_0x54a27c[_0x3fb8('0x26')](0x194);}return _0x14accc;};}function handleError(_0x1f250a,_0x58e408){_0x58e408=_0x58e408||0x1f4;return function(_0x282bb7){logger[_0x3fb8('0x21')](_0x282bb7[_0x3fb8('0x34')]);if(_0x282bb7[_0x3fb8('0x35')]){delete _0x282bb7[_0x3fb8('0x35')];}_0x1f250a[_0x3fb8('0x28')](_0x58e408)['send'](_0x282bb7);};}exports[_0x3fb8('0x36')]=function(_0x96d752,_0x5a7d34){var _0xd716a6={'include':[{'model':db[_0x3fb8('0x37')],'as':_0x3fb8('0x38')}]},_0x1661a3={},_0x519344={'count':0x0,'rows':[]};var _0x54f53c=_[_0x3fb8('0x39')](db[_0x3fb8('0x3a')][_0x3fb8('0x3b')],function(_0x397d97){return{'name':_0x397d97['fieldName'],'type':_0x397d97['type'][_0x3fb8('0x3c')]};});_0x1661a3['model']=_[_0x3fb8('0x39')](_0x54f53c,'name');_0x1661a3[_0x3fb8('0x3d')]=_[_0x3fb8('0x3e')](_0x96d752[_0x3fb8('0x3d')]);_0x1661a3['filters']=_[_0x3fb8('0x3f')](_0x1661a3['model'],_0x1661a3[_0x3fb8('0x3d')]);_0xd716a6[_0x3fb8('0x40')]=_['intersection'](_0x1661a3[_0x3fb8('0x41')],qs[_0x3fb8('0x42')](_0x96d752[_0x3fb8('0x3d')][_0x3fb8('0x42')]));_0xd716a6[_0x3fb8('0x40')]=_0xd716a6['attributes']['length']?_0xd716a6[_0x3fb8('0x40')]:_0x1661a3[_0x3fb8('0x41')];if(!_0x96d752[_0x3fb8('0x3d')][_0x3fb8('0x43')]('nolimit')){_0xd716a6[_0x3fb8('0x44')]=qs[_0x3fb8('0x44')](_0x96d752[_0x3fb8('0x3d')]['limit']);_0xd716a6['offset']=qs['offset'](_0x96d752['query']['offset']);}_0xd716a6[_0x3fb8('0x45')]=qs[_0x3fb8('0x46')](_0x96d752[_0x3fb8('0x3d')][_0x3fb8('0x46')]);_0xd716a6[_0x3fb8('0x47')]=qs[_0x3fb8('0x48')](_[_0x3fb8('0x49')](_0x96d752[_0x3fb8('0x3d')],_0x1661a3[_0x3fb8('0x48')]),_0x54f53c);if(_0x96d752[_0x3fb8('0x3d')][_0x3fb8('0x4a')]){_0xd716a6['where']=_['merge'](_0xd716a6[_0x3fb8('0x47')],{'$or':_[_0x3fb8('0x39')](_0x54f53c,function(_0xc32753){if(_0xc32753[_0x3fb8('0x4b')]!=='VIRTUAL'){var _0x103155={};_0x103155[_0xc32753[_0x3fb8('0x35')]]={'$like':'%'+_0x96d752[_0x3fb8('0x3d')][_0x3fb8('0x4a')]+'%'};return _0x103155;}})});}_0xd716a6=_[_0x3fb8('0x4c')]({},_0xd716a6,_0x96d752[_0x3fb8('0x4d')]);var _0x145c82={'where':_0xd716a6[_0x3fb8('0x47')]};return db[_0x3fb8('0x3a')]['count'](_0x145c82)[_0x3fb8('0x1c')](function(_0x321c58){_0x519344[_0x3fb8('0x2a')]=_0x321c58;if(_0x96d752[_0x3fb8('0x3d')]['includeAll']){_0xd716a6[_0x3fb8('0x4e')]=[{'all':!![]}];}return db[_0x3fb8('0x3a')]['findAll'](_0xd716a6);})[_0x3fb8('0x1c')](function(_0x46399c){_0x519344[_0x3fb8('0x4f')]=_0x46399c;return _0x519344;})[_0x3fb8('0x1c')](respondWithFilteredResult(_0x5a7d34,_0xd716a6))[_0x3fb8('0x25')](handleError(_0x5a7d34,null));};exports[_0x3fb8('0x50')]=function(_0x53add1,_0x799cd5){var _0x35f066={'raw':![],'where':{'id':_0x53add1[_0x3fb8('0x51')]['id']},'include':[{'model':db[_0x3fb8('0x37')],'as':'mandatoryDispositionPause'}]},_0x19df20={};_0x19df20[_0x3fb8('0x41')]=_['keys'](db['SmsAccount'][_0x3fb8('0x3b')]);_0x19df20[_0x3fb8('0x3d')]=_[_0x3fb8('0x3e')](_0x53add1[_0x3fb8('0x3d')]);_0x19df20[_0x3fb8('0x48')]=_[_0x3fb8('0x3f')](_0x19df20[_0x3fb8('0x41')],_0x19df20['query']);_0x35f066[_0x3fb8('0x40')]=_[_0x3fb8('0x3f')](_0x19df20[_0x3fb8('0x41')],qs['fields'](_0x53add1[_0x3fb8('0x3d')][_0x3fb8('0x42')]));_0x35f066['attributes']=_0x35f066[_0x3fb8('0x40')][_0x3fb8('0x52')]?_0x35f066[_0x3fb8('0x40')]:_0x19df20[_0x3fb8('0x41')];if(_0x53add1['query']['includeAll']){_0x35f066[_0x3fb8('0x4e')]=[{'all':!![]}];}_0x35f066=_['merge']({},_0x35f066,_0x53add1[_0x3fb8('0x4d')]);return db[_0x3fb8('0x3a')]['find'](_0x35f066)[_0x3fb8('0x1c')](handleEntityNotFound(_0x799cd5,null))[_0x3fb8('0x1c')](respondWithResult(_0x799cd5,null))[_0x3fb8('0x25')](handleError(_0x799cd5,null));};exports[_0x3fb8('0x53')]=function(_0x164ee9,_0x247fb0){return db[_0x3fb8('0x3a')]['create'](_0x164ee9['body'],{})[_0x3fb8('0x1c')](function(_0x51b1da){var _0x4d87dd=_0x164ee9['user'][_0x3fb8('0x31')]({'plain':!![]});if(!_0x4d87dd)throw new Error(_0x3fb8('0x54'));if(_0x4d87dd[_0x3fb8('0x55')]===_0x3fb8('0x56')){var _0x2a71d2=_0x51b1da[_0x3fb8('0x31')]({'plain':!![]});var _0x4796e8=_0x3fb8('0x32');return db[_0x3fb8('0x57')][_0x3fb8('0x58')]({'where':{'name':_0x4796e8,'userProfileId':_0x4d87dd[_0x3fb8('0x59')]},'raw':!![]})[_0x3fb8('0x1c')](function(_0x299d40){if(_0x299d40&&_0x299d40[_0x3fb8('0x5a')]===0x0){return db[_0x3fb8('0x33')][_0x3fb8('0x53')]({'name':_0x2a71d2[_0x3fb8('0x35')],'resourceId':_0x2a71d2['id'],'type':_0x299d40['name'],'sectionId':_0x299d40['id']},{})[_0x3fb8('0x1c')](function(){return _0x51b1da;});}else{return _0x51b1da;}})['catch'](function(_0x24e2b1){logger[_0x3fb8('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24e2b1);throw _0x24e2b1;});}return _0x51b1da;})[_0x3fb8('0x1c')](respondWithResult(_0x247fb0,0xc9))[_0x3fb8('0x25')](handleError(_0x247fb0,null));};exports[_0x3fb8('0x2f')]=function(_0x1403c0,_0x9278a3){if(_0x1403c0[_0x3fb8('0x5b')]['id']){delete _0x1403c0['body']['id'];}return db[_0x3fb8('0x3a')][_0x3fb8('0x58')]({'where':{'id':_0x1403c0[_0x3fb8('0x51')]['id']},'include':[{'model':db[_0x3fb8('0x37')],'as':_0x3fb8('0x38')}]})[_0x3fb8('0x1c')](handleEntityNotFound(_0x9278a3,null))[_0x3fb8('0x1c')](saveUpdates(_0x1403c0['body'],null))[_0x3fb8('0x1c')](respondWithResult(_0x9278a3,null))[_0x3fb8('0x25')](handleError(_0x9278a3,null));};exports[_0x3fb8('0x30')]=function(_0x47876f,_0x1071f8){return db[_0x3fb8('0x3a')][_0x3fb8('0x58')]({'where':{'id':_0x47876f[_0x3fb8('0x51')]['id']}})[_0x3fb8('0x1c')](handleEntityNotFound(_0x1071f8,null))[_0x3fb8('0x1c')](removeEntity(_0x1071f8,null))['catch'](handleError(_0x1071f8,null));};exports[_0x3fb8('0x5c')]=function(_0x4718e5,_0x365abb){return db[_0x3fb8('0x3a')][_0x3fb8('0x5c')]()[_0x3fb8('0x1c')](respondWithResult(_0x365abb,null))[_0x3fb8('0x25')](handleError(_0x365abb,null));};exports[_0x3fb8('0x5d')]=function(_0x539d8e,_0x1caf1e,_0x172aa1){if(_0x539d8e[_0x3fb8('0x5b')]['id']){delete _0x539d8e['body']['id'];}return db[_0x3fb8('0x3a')][_0x3fb8('0x58')]({'where':{'id':_0x539d8e[_0x3fb8('0x51')]['id']}})[_0x3fb8('0x1c')](handleEntityNotFound(_0x1caf1e,null))['then'](function(_0x42af15){if(_0x42af15){_0x539d8e[_0x3fb8('0x5b')][_0x3fb8('0x5e')]=_0x42af15['id'];return db[_0x3fb8('0x5f')][_0x3fb8('0x53')](_0x539d8e['body']);}})[_0x3fb8('0x1c')](respondWithResult(_0x1caf1e,null))['catch'](handleError(_0x1caf1e,null));};exports[_0x3fb8('0x60')]=function(_0x156eda,_0x5f5c69,_0x29b36a){var _0x27836d={'raw':![],'where':{}};var _0xfef44c={};var _0x476f54={'count':0x0,'rows':[]};return db[_0x3fb8('0x3a')][_0x3fb8('0x61')]({'where':{'id':_0x156eda[_0x3fb8('0x51')]['id']}})[_0x3fb8('0x1c')](handleEntityNotFound(_0x5f5c69,null))['then'](function(_0x1c5309){if(_0x1c5309){_0xfef44c[_0x3fb8('0x41')]=_[_0x3fb8('0x3e')](db[_0x3fb8('0x5f')][_0x3fb8('0x3b')]);_0xfef44c[_0x3fb8('0x3d')]=_[_0x3fb8('0x3e')](_0x156eda['query']);_0xfef44c[_0x3fb8('0x48')]=_['intersection'](_0xfef44c[_0x3fb8('0x41')],_0xfef44c[_0x3fb8('0x3d')]);_0x27836d['attributes']=_['intersection'](_0xfef44c[_0x3fb8('0x41')],qs['fields'](_0x156eda[_0x3fb8('0x3d')]['fields']));_0x27836d['attributes']=_0x27836d[_0x3fb8('0x40')][_0x3fb8('0x52')]?_0x27836d[_0x3fb8('0x40')]:_0xfef44c[_0x3fb8('0x41')];if(!_0x156eda['query'][_0x3fb8('0x43')](_0x3fb8('0x62'))){_0x27836d['limit']=qs[_0x3fb8('0x44')](_0x156eda[_0x3fb8('0x3d')][_0x3fb8('0x44')]);_0x27836d[_0x3fb8('0x63')]=qs[_0x3fb8('0x63')](_0x156eda[_0x3fb8('0x3d')][_0x3fb8('0x63')]);}_0x27836d[_0x3fb8('0x45')]=qs[_0x3fb8('0x46')](_0x156eda[_0x3fb8('0x3d')][_0x3fb8('0x46')]);_0x27836d[_0x3fb8('0x47')]=qs['filters'](_[_0x3fb8('0x49')](_0x156eda['query'],_0xfef44c['filters']));_0x27836d['where'][_0x3fb8('0x5e')]=_0x1c5309['id'];if(_0x156eda[_0x3fb8('0x3d')][_0x3fb8('0x4a')]){_0x27836d[_0x3fb8('0x47')]=_[_0x3fb8('0x4c')](_0x27836d['where'],{'$or':_[_0x3fb8('0x39')](_0x27836d[_0x3fb8('0x40')],function(_0x1171b0){var _0x567ef6={};_0x567ef6[_0x1171b0]={'$like':'%'+_0x156eda[_0x3fb8('0x3d')][_0x3fb8('0x4a')]+'%'};return _0x567ef6;})});}_0x27836d=_[_0x3fb8('0x4c')]({},_0x27836d,_0x156eda[_0x3fb8('0x4d')]);return db[_0x3fb8('0x5f')]['count']({'where':_0x27836d[_0x3fb8('0x47')]})['then'](function(_0x31fbb9){_0x476f54[_0x3fb8('0x2a')]=_0x31fbb9;if(_0x156eda['query'][_0x3fb8('0x64')]){_0x27836d[_0x3fb8('0x4e')]=[{'all':!![]}];}return db[_0x3fb8('0x5f')][_0x3fb8('0x65')](_0x27836d);})[_0x3fb8('0x1c')](function(_0x25830b){_0x476f54[_0x3fb8('0x4f')]=_0x25830b;return _0x476f54;});}})[_0x3fb8('0x1c')](respondWithFilteredResult(_0x5f5c69,_0x27836d))['catch'](handleError(_0x5f5c69,null));};exports[_0x3fb8('0x66')]=function(_0x280da0,_0x31e2d9,_0xf6715b){return db[_0x3fb8('0x3a')]['find']({'where':{'id':_0x280da0[_0x3fb8('0x51')]['id']}})[_0x3fb8('0x1c')](handleEntityNotFound(_0x31e2d9,null))[_0x3fb8('0x1c')](function(_0xb24342){if(_0xb24342){return _0xb24342[_0x3fb8('0x66')](_0x280da0['query'][_0x3fb8('0x67')]);}})[_0x3fb8('0x1c')](respondWithStatusCode(_0x31e2d9,null))[_0x3fb8('0x25')](handleError(_0x31e2d9,null));};exports['addAnswer']=function(_0x4f9340,_0x3cf9e8,_0x1077b5){if(_0x4f9340['body']['id']){delete _0x4f9340[_0x3fb8('0x5b')]['id'];}return db['SmsAccount'][_0x3fb8('0x58')]({'where':{'id':_0x4f9340['params']['id']}})[_0x3fb8('0x1c')](handleEntityNotFound(_0x3cf9e8,null))['then'](function(_0x1c26f){if(_0x1c26f){_0x4f9340[_0x3fb8('0x5b')]['SmsAccountId']=_0x1c26f['id'];return db[_0x3fb8('0x68')][_0x3fb8('0x53')](_0x4f9340['body']);}})[_0x3fb8('0x1c')](respondWithResult(_0x3cf9e8,null))[_0x3fb8('0x25')](handleError(_0x3cf9e8,null));};exports[_0x3fb8('0x69')]=function(_0x5925e1,_0x27e831,_0x15fd04){var _0x405e2b={'raw':![],'where':{}};var _0x5e114d={};var _0x1b26a7={'count':0x0,'rows':[]};return db[_0x3fb8('0x3a')][_0x3fb8('0x61')]({'where':{'id':_0x5925e1['params']['id']}})[_0x3fb8('0x1c')](handleEntityNotFound(_0x27e831,null))[_0x3fb8('0x1c')](function(_0x337fa7){if(_0x337fa7){_0x5e114d[_0x3fb8('0x41')]=_[_0x3fb8('0x3e')](db[_0x3fb8('0x68')][_0x3fb8('0x3b')]);_0x5e114d[_0x3fb8('0x3d')]=_[_0x3fb8('0x3e')](_0x5925e1[_0x3fb8('0x3d')]);_0x5e114d[_0x3fb8('0x48')]=_[_0x3fb8('0x3f')](_0x5e114d[_0x3fb8('0x41')],_0x5e114d[_0x3fb8('0x3d')]);_0x405e2b[_0x3fb8('0x40')]=_['intersection'](_0x5e114d[_0x3fb8('0x41')],qs[_0x3fb8('0x42')](_0x5925e1[_0x3fb8('0x3d')][_0x3fb8('0x42')]));_0x405e2b[_0x3fb8('0x40')]=_0x405e2b[_0x3fb8('0x40')][_0x3fb8('0x52')]?_0x405e2b[_0x3fb8('0x40')]:_0x5e114d['model'];if(!_0x5925e1[_0x3fb8('0x3d')][_0x3fb8('0x43')](_0x3fb8('0x62'))){_0x405e2b[_0x3fb8('0x44')]=qs['limit'](_0x5925e1[_0x3fb8('0x3d')][_0x3fb8('0x44')]);_0x405e2b[_0x3fb8('0x63')]=qs[_0x3fb8('0x63')](_0x5925e1[_0x3fb8('0x3d')][_0x3fb8('0x63')]);}_0x405e2b[_0x3fb8('0x45')]=qs[_0x3fb8('0x46')](_0x5925e1['query']['sort']);_0x405e2b[_0x3fb8('0x47')]=qs[_0x3fb8('0x48')](_[_0x3fb8('0x49')](_0x5925e1[_0x3fb8('0x3d')],_0x5e114d['filters']));_0x405e2b[_0x3fb8('0x47')][_0x3fb8('0x5e')]=_0x337fa7['id'];if(_0x5925e1[_0x3fb8('0x3d')]['filter']){_0x405e2b[_0x3fb8('0x47')]=_['merge'](_0x405e2b[_0x3fb8('0x47')],{'$or':_['map'](_0x405e2b[_0x3fb8('0x40')],function(_0x2ac626){var _0x3cb56d={};_0x3cb56d[_0x2ac626]={'$like':'%'+_0x5925e1[_0x3fb8('0x3d')]['filter']+'%'};return _0x3cb56d;})});}_0x405e2b=_[_0x3fb8('0x4c')]({},_0x405e2b,_0x5925e1[_0x3fb8('0x4d')]);return db['CannedAnswer']['count']({'where':_0x405e2b[_0x3fb8('0x47')]})[_0x3fb8('0x1c')](function(_0x16e080){_0x1b26a7[_0x3fb8('0x2a')]=_0x16e080;if(_0x5925e1[_0x3fb8('0x3d')]['includeAll']){_0x405e2b[_0x3fb8('0x4e')]=[{'all':!![]}];}return db[_0x3fb8('0x68')][_0x3fb8('0x65')](_0x405e2b);})[_0x3fb8('0x1c')](function(_0x2b15f0){_0x1b26a7[_0x3fb8('0x4f')]=_0x2b15f0;return _0x1b26a7;});}})[_0x3fb8('0x1c')](respondWithFilteredResult(_0x27e831,_0x405e2b))[_0x3fb8('0x25')](handleError(_0x27e831,null));};exports[_0x3fb8('0x6a')]=function(_0x32d9e7,_0x75d5f1,_0xe27af2){return db[_0x3fb8('0x3a')][_0x3fb8('0x58')]({'where':{'id':_0x32d9e7[_0x3fb8('0x51')]['id']}})[_0x3fb8('0x1c')](handleEntityNotFound(_0x75d5f1,null))['then'](function(_0x2c4421){if(_0x2c4421){return _0x2c4421[_0x3fb8('0x6a')](_0x32d9e7[_0x3fb8('0x3d')][_0x3fb8('0x67')]);}})['then'](respondWithStatusCode(_0x75d5f1,null))[_0x3fb8('0x25')](handleError(_0x75d5f1,null));};exports[_0x3fb8('0x6b')]=function(_0x568a89,_0x167bc3,_0x5c77c4){var _0x16b179={'channel':'sms'};var _0xf679b4=[];var _0x3db521=[];var _0x9ccad1={};return db[_0x3fb8('0x3a')][_0x3fb8('0x58')]({'where':{'id':_0x568a89[_0x3fb8('0x51')]['id']},'include':[{'model':db[_0x3fb8('0x6c')],'as':_0x3fb8('0x6d')}]})['then'](handleEntityNotFound(_0x167bc3,null))[_0x3fb8('0x1c')](function(_0x132089){_0x16b179[_0x3fb8('0x6e')]=_0x132089;_0x16b179['applications']=_[_0x3fb8('0x6f')](_0x132089['Applications'],[_0x3fb8('0x70')],[_0x3fb8('0x71')]);if(_0x16b179[_0x3fb8('0x6e')][_0x3fb8('0x6d')]){delete _0x16b179[_0x3fb8('0x6e')][_0x3fb8('0x6d')];}return db[_0x3fb8('0x72')][_0x3fb8('0x5c')]();})[_0x3fb8('0x1c')](function(_0x646990){if(!_0x646990){throw new db[(_0x3fb8('0x73'))][(_0x3fb8('0x74'))](_0x3fb8('0x75'));}_0xf679b4=_[_0x3fb8('0x76')](_['keys'](_0x646990),['createdAt',_0x3fb8('0x77')]);_0x3db521=_['difference'](_[_0x3fb8('0x3e')](_0x646990),[_0x3fb8('0x78'),_0x3fb8('0x77'),_0x3fb8('0x79'),_0x3fb8('0x7a')]);_0x16b179['body']={'mapKey':_0x3fb8('0x7b')};if(_0x16b179[_0x3fb8('0x6e')][_0x3fb8('0x4b')]){switch(_0x16b179[_0x3fb8('0x6e')][_0x3fb8('0x4b')]){case'twilio':_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x7c')]=_0x568a89[_0x3fb8('0x5b')][_0x3fb8('0x7d')];_0x16b179[_0x3fb8('0x5b')]['body']=_0x568a89['body'][_0x3fb8('0x7e')];_0x16b179['body']['messageId']=_0x568a89[_0x3fb8('0x5b')][_0x3fb8('0x7f')];break;case _0x3fb8('0x80'):_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x7c')]='+'+_0x568a89[_0x3fb8('0x5b')][_0x3fb8('0x81')];_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x5b')]=_0x568a89[_0x3fb8('0x5b')]['text'];break;case _0x3fb8('0x82'):_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x7c')]=_0x568a89[_0x3fb8('0x5b')]['from'];_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x5b')]=_0x568a89['body'][_0x3fb8('0x23')];break;case _0x3fb8('0x83'):_0x16b179[_0x3fb8('0x5b')]['from']=_0x568a89['body'][_0x3fb8('0x7c')];_0x16b179['body']['body']=_0x568a89[_0x3fb8('0x5b')]['body'];_0x16b179[_0x3fb8('0x5b')]['messageId']=_0x568a89[_0x3fb8('0x5b')]['message_id'];break;case _0x3fb8('0x84'):_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x7c')]=_0x568a89['body'][_0x3fb8('0x7d')];_0x16b179['body'][_0x3fb8('0x5b')]=_0x568a89[_0x3fb8('0x5b')][_0x3fb8('0x85')];_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x86')]=_0x568a89[_0x3fb8('0x5b')][_0x3fb8('0x87')];break;case _0x3fb8('0x88'):_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x7c')]='+'+_0x568a89[_0x3fb8('0x5b')][_0x3fb8('0x89')][0x0][_0x3fb8('0x7c')];_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x5b')]=_0x568a89[_0x3fb8('0x5b')][_0x3fb8('0x89')][0x0][_0x3fb8('0x8a')];_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x86')]=_0x568a89[_0x3fb8('0x5b')][_0x3fb8('0x89')][0x0][_0x3fb8('0x86')];break;case _0x3fb8('0x8b'):_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x7c')]=_0x568a89[_0x3fb8('0x5b')][_0x3fb8('0x8c')];_0x16b179[_0x3fb8('0x5b')]['body']=_0x568a89['body'][_0x3fb8('0x8d')][_0x3fb8('0x23')];break;case _0x3fb8('0x8e'):_0x16b179[_0x3fb8('0x5b')]['from']=_0x568a89['body'][_0x3fb8('0x8f')];_0x16b179['body'][_0x3fb8('0x5b')]=_0x568a89[_0x3fb8('0x5b')][_0x3fb8('0x8a')];_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x86')]=_0x568a89['body'][_0x3fb8('0x90')];break;case'bandwidth':_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x86')]=_0x568a89['body'][0x0][_0x3fb8('0x23')]['id'];_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x7c')]=_0x568a89[_0x3fb8('0x5b')][0x0][_0x3fb8('0x23')][_0x3fb8('0x7c')];_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x5b')]=_0x568a89[_0x3fb8('0x5b')][0x0][_0x3fb8('0x23')][_0x3fb8('0x8a')];break;case _0x3fb8('0x91'):_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x7c')]=_0x568a89[_0x3fb8('0x5b')][_0x3fb8('0x7c')];_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x5b')]=_0x568a89[_0x3fb8('0x5b')][_0x3fb8('0x23')];_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x86')]=_0x568a89[_0x3fb8('0x5b')][_0x3fb8('0x92')];break;}}if(_0x16b179[_0x3fb8('0x5b')]['id']){delete _0x16b179[_0x3fb8('0x5b')]['id'];}if(_[_0x3fb8('0x93')](_0x16b179['body'][_0x3fb8('0x7c')])){throw new db[(_0x3fb8('0x73'))][(_0x3fb8('0x74'))](_0x3fb8('0x94'));}if(_['isNil'](_0x16b179[_0x3fb8('0x5b')]['body'])||_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x5b')]===''){throw new db[(_0x3fb8('0x73'))][(_0x3fb8('0x74'))](_0x3fb8('0x95'));}if(_[_0x3fb8('0x93')](_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x96')])){throw new db[(_0x3fb8('0x73'))][(_0x3fb8('0x74'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3db521);}if(!_[_0x3fb8('0x97')](_0x3db521,_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x96')])){throw new db[(_0x3fb8('0x73'))][(_0x3fb8('0x74'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3db521);}_0x9ccad1[_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x96')]]=_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x7c')];return db[_0x3fb8('0x98')][_0x3fb8('0x58')]({'where':{'id':_0x16b179[_0x3fb8('0x6e')][_0x3fb8('0x7a')]},'include':[{'model':db[_0x3fb8('0x72')],'as':_0x3fb8('0x99'),'where':_0x9ccad1,'limit':0x1,'order':[[_0x3fb8('0x77'),_0x3fb8('0x9a')]]}]});})[_0x3fb8('0x1c')](handleEntityNotFound(_0x167bc3,null))[_0x3fb8('0x1c')](function(_0x29fd38){if(_0x29fd38){_0x16b179[_0x3fb8('0x9b')]=_[_0x3fb8('0x9c')](_0x29fd38,[_0x3fb8('0x99')]);if(_0x29fd38[_0x3fb8('0x99')][_0x3fb8('0x52')]){return _0x29fd38[_0x3fb8('0x99')][0x0];}var _0x4b0bcd=_[_0x3fb8('0x9d')](_0x16b179['body'],{'firstName':_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x7c')],'ListId':_0x29fd38['id']});_0x4b0bcd[_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x96')]]=_0x16b179['body'][_0x3fb8('0x7c')];return db[_0x3fb8('0x72')][_0x3fb8('0x53')](_0x4b0bcd,{'fields':_0xf679b4,'raw':!![]});}})[_0x3fb8('0x1c')](handleEntityNotFound(_0x167bc3,null))[_0x3fb8('0x1c')](function(_0x1b14f2){if(_0x1b14f2){_0x16b179[_0x3fb8('0x9e')]=_0x1b14f2;var _0x3f80ed={'ContactId':_0x1b14f2['id'],'phone':_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x7c')],'SmsAccountId':_0x568a89['params']['id']};var _0x3006ca={'ContactId':_0x1b14f2['id'],'SmsAccountId':_0x568a89[_0x3fb8('0x51')]['id'],'closed':![]};return db['SmsInteraction'][_0x3fb8('0x58')]({'where':_0x3006ca})['then'](function(_0x5147ce){if(_0x5147ce){return[_0x5147ce,![]];}return db['SmsInteraction'][_0x3fb8('0x53')](_0x3f80ed)[_0x3fb8('0x1c')](function(_0x4c1706){return[_0x4c1706,!![]];});});}})[_0x3fb8('0x9f')](function(_0x2a64e4,_0x2f0533){_0x16b179[_0x3fb8('0xa0')]=_0x2a64e4[_0x3fb8('0x31')]({'plain':!![]});_0x16b179['interaction'][_0x3fb8('0xa1')]=![];if(_0x2f0533){if(_0x16b179[_0x3fb8('0x6e')][_0x3fb8('0xa2')]){_0x16b179[_0x3fb8('0xa3')]['push']({'id':0x0,'priority':_0x16b179[_0x3fb8('0xa3')][_0x3fb8('0x52')]+0x1,'app':'close','appdata':_0x3fb8('0xa4'),'interval':_0x3fb8('0xa5')});}_0x16b179[_0x3fb8('0xa0')][_0x3fb8('0xa1')]=!![];}return db[_0x3fb8('0xa6')]['create']({'phone':_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x7c')],'messageId':_0x16b179['body']['messageId'],'body':_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0x5b')],'SmsAccountId':_0x568a89[_0x3fb8('0x51')]['id'],'SmsInteractionId':_0x2a64e4['id'],'direction':'in','ContactId':_0x2a64e4['ContactId'],'AttachmentId':_0x16b179[_0x3fb8('0x5b')][_0x3fb8('0xa7')]});})[_0x3fb8('0x1c')](function(_0x2a700){_0x16b179[_0x3fb8('0x23')]=_0x2a700;if(_0x16b179[_0x3fb8('0xa0')]['UserId']){return db[_0x3fb8('0xa8')]['find']({'attributes':['id','name'],'where':{'id':_0x16b179[_0x3fb8('0xa0')][_0x3fb8('0xa9')]}})['then'](function(_0x165924){if(_0x165924){_0x16b179[_0x3fb8('0xa3')][_0x3fb8('0xaa')]({'id':0x0,'priority':0x0,'app':_0x3fb8('0xab'),'appdata':_0x165924[_0x3fb8('0x35')]+','+(_0x16b179[_0x3fb8('0x6e')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x3fb8('0xac'),_0x3fb8('0xad'),_0x16b179);});}return respondWithRpcPromise(_0x3fb8('0xac'),'startRouting',_0x16b179);})[_0x3fb8('0x1c')](function(_0x3ca3e1){if(_0x3ca3e1){var _0x5c0951=0xc8;var _0x13e728=_0x3fb8('0xae');logger['info'](_0x3fb8('0x1f'),_0x13e728,_0x5c0951,_0x3fb8('0xaf'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x13e728,_0x5c0951,_0x3fb8('0xaf'),JSON[_0x3fb8('0x20')](_0x3ca3e1));if(_0x16b179['account'][_0x3fb8('0x4b')]==='twilio'){return _0x167bc3['status'](_0x5c0951)[_0x3fb8('0x2b')](_0x3fb8('0xb0'),_0x3fb8('0xb1'))[_0x3fb8('0xb2')](_0x3fb8('0xb3'));}else{return _0x167bc3[_0x3fb8('0x28')](_0x5c0951)[_0x3fb8('0x29')](_0x3ca3e1);}}})[_0x3fb8('0x25')](handleError(_0x167bc3,null));};exports[_0x3fb8('0xb4')]=function(_0x1993ff,_0x16c776,_0x5c115a){return db[_0x3fb8('0x3a')][_0x3fb8('0x61')]({'where':{'id':_0x1993ff['params']['id']}})['then'](handleEntityNotFound(_0x16c776,null))[_0x3fb8('0x1c')](function(_0x5c8862){if(_0x5c8862){return db[_0x3fb8('0xb5')][_0x3fb8('0xb6')](function(_0x56eeea){return db[_0x3fb8('0x6c')][_0x3fb8('0x30')]({'where':{'SmsAccountId':_0x1993ff[_0x3fb8('0x51')]['id']},'transaction':_0x56eeea})[_0x3fb8('0x1c')](function(_0x1e0693){var _0x1b2d77=_[_0x3fb8('0x39')](_0x1993ff[_0x3fb8('0x5b')],function(_0xbecec5){_0xbecec5['SmsAccountId']=_0x1993ff[_0x3fb8('0x51')]['id'];return _0xbecec5;});return db[_0x3fb8('0x6c')][_0x3fb8('0xb7')](_0x1b2d77,{'transaction':_0x56eeea});});})[_0x3fb8('0x1c')](function(){return db['SmsApplication'][_0x3fb8('0xb8')]({'where':{'SmsAccountId':_0x1993ff[_0x3fb8('0x51')]['id']},'order':_0x3fb8('0x70')});});}})['then'](respondWithResult(_0x16c776,null))[_0x3fb8('0x25')](handleError(_0x16c776,null));};exports[_0x3fb8('0xb9')]=function(_0x31adfb,_0x1787e7,_0x4eb1fb){var _0x27bfcd={};var _0x481f45={};var _0x55058c;var _0x11e44a;return db['SmsAccount'][_0x3fb8('0x61')]({'where':{'id':_0x31adfb[_0x3fb8('0x51')]['id']}})['then'](handleEntityNotFound(_0x1787e7,null))[_0x3fb8('0x1c')](function(_0x315dee){if(_0x315dee){_0x55058c=_0x315dee;_0x481f45['model']=_[_0x3fb8('0x3e')](db[_0x3fb8('0x6c')]['rawAttributes']);_0x481f45[_0x3fb8('0x3d')]=_[_0x3fb8('0x3e')](_0x31adfb[_0x3fb8('0x3d')]);_0x481f45['filters']=_[_0x3fb8('0x3f')](_0x481f45[_0x3fb8('0x41')],_0x481f45[_0x3fb8('0x3d')]);_0x27bfcd[_0x3fb8('0x40')]=_[_0x3fb8('0x3f')](_0x481f45[_0x3fb8('0x41')],qs[_0x3fb8('0x42')](_0x31adfb['query'][_0x3fb8('0x42')]));_0x27bfcd[_0x3fb8('0x40')]=_0x27bfcd['attributes']['length']?_0x27bfcd[_0x3fb8('0x40')]:_0x481f45[_0x3fb8('0x41')];_0x27bfcd[_0x3fb8('0x45')]=qs[_0x3fb8('0x46')](_0x31adfb[_0x3fb8('0x3d')]['sort']);_0x27bfcd[_0x3fb8('0x47')]=qs['filters'](_[_0x3fb8('0x49')](_0x31adfb[_0x3fb8('0x3d')],_0x481f45[_0x3fb8('0x48')]));if(_0x31adfb[_0x3fb8('0x3d')][_0x3fb8('0x4a')]){_0x27bfcd[_0x3fb8('0x47')]=_[_0x3fb8('0x4c')](_0x27bfcd['where'],{'$or':_[_0x3fb8('0x39')](_0x27bfcd['attributes'],function(_0x2311e1){var _0x181b26={};_0x181b26[_0x2311e1]={'$like':'%'+_0x31adfb[_0x3fb8('0x3d')][_0x3fb8('0x4a')]+'%'};return _0x181b26;})});}_0x27bfcd=_[_0x3fb8('0x4c')]({},_0x27bfcd,_0x31adfb[_0x3fb8('0x4d')]);return _0x55058c[_0x3fb8('0xb9')](_0x27bfcd);}})['then'](function(_0x1d90c4){if(_0x1d90c4){_0x11e44a=_0x1d90c4['length'];if(!_0x31adfb[_0x3fb8('0x3d')][_0x3fb8('0x43')](_0x3fb8('0x62'))){_0x27bfcd[_0x3fb8('0x44')]=qs[_0x3fb8('0x44')](_0x31adfb[_0x3fb8('0x3d')][_0x3fb8('0x44')]);_0x27bfcd[_0x3fb8('0x63')]=qs[_0x3fb8('0x63')](_0x31adfb[_0x3fb8('0x3d')][_0x3fb8('0x63')]);}return _0x55058c['getApplications'](_0x27bfcd);}})[_0x3fb8('0x1c')](function(_0x2d789a){if(_0x2d789a){return _0x2d789a?{'count':_0x11e44a,'rows':_0x2d789a}:null;}})[_0x3fb8('0x1c')](respondWithResult(_0x1787e7,null))[_0x3fb8('0x25')](handleError(_0x1787e7,null));};exports[_0x3fb8('0xba')]=function(_0x41fe09,_0x1162ec,_0x2d3cd6){var _0x11c816={'raw':![],'where':{}};var _0x5d0a62={};var _0xc0f414={'count':0x0,'rows':[]};return db['SmsAccount'][_0x3fb8('0x61')]({'where':{'id':_0x41fe09[_0x3fb8('0x51')]['id']}})['then'](handleEntityNotFound(_0x1162ec,null))[_0x3fb8('0x1c')](function(_0x2fddda){if(_0x2fddda){_0x5d0a62[_0x3fb8('0x41')]=_['keys'](db[_0x3fb8('0xbb')][_0x3fb8('0x3b')]);_0x5d0a62[_0x3fb8('0x3d')]=_['keys'](_0x41fe09[_0x3fb8('0x3d')]);_0x5d0a62[_0x3fb8('0x48')]=_[_0x3fb8('0x3f')](_0x5d0a62['model'],_0x5d0a62[_0x3fb8('0x3d')]);_0x11c816[_0x3fb8('0x40')]=_[_0x3fb8('0x3f')](_0x5d0a62[_0x3fb8('0x41')],qs['fields'](_0x41fe09[_0x3fb8('0x3d')][_0x3fb8('0x42')]));_0x11c816[_0x3fb8('0x40')]=_0x11c816[_0x3fb8('0x40')][_0x3fb8('0x52')]?_0x11c816['attributes']:_0x5d0a62[_0x3fb8('0x41')];if(!_0x41fe09['query'][_0x3fb8('0x43')]('nolimit')){_0x11c816['limit']=qs[_0x3fb8('0x44')](_0x41fe09[_0x3fb8('0x3d')]['limit']);_0x11c816[_0x3fb8('0x63')]=qs[_0x3fb8('0x63')](_0x41fe09['query']['offset']);}_0x11c816[_0x3fb8('0x45')]=qs[_0x3fb8('0x46')](_0x41fe09[_0x3fb8('0x3d')][_0x3fb8('0x46')]);_0x11c816[_0x3fb8('0x47')]=qs[_0x3fb8('0x48')](_[_0x3fb8('0x49')](_0x41fe09[_0x3fb8('0x3d')],_0x5d0a62[_0x3fb8('0x48')]));_0x11c816[_0x3fb8('0x47')][_0x3fb8('0x5e')]=_0x2fddda['id'];if(_0x41fe09[_0x3fb8('0x3d')][_0x3fb8('0x4a')]){_0x11c816[_0x3fb8('0x47')]=_['merge'](_0x11c816['where'],{'$or':_[_0x3fb8('0x39')](_0x11c816['attributes'],function(_0x2ff7a8){var _0x3b3245={};_0x3b3245[_0x2ff7a8]={'$like':'%'+_0x41fe09[_0x3fb8('0x3d')][_0x3fb8('0x4a')]+'%'};return _0x3b3245;})});}_0x11c816=_['merge']({},_0x11c816,_0x41fe09[_0x3fb8('0x4d')]);return db[_0x3fb8('0xbb')]['count']({'where':_0x11c816[_0x3fb8('0x47')]})[_0x3fb8('0x1c')](function(_0x2d2a45){_0xc0f414[_0x3fb8('0x2a')]=_0x2d2a45;if(_0x41fe09[_0x3fb8('0x3d')]['includeAll']){_0x11c816['include']=[{'model':db[_0x3fb8('0x72')],'as':_0x3fb8('0xbc'),'required':![]},{'model':db[_0x3fb8('0xa8')],'as':_0x3fb8('0xbd'),'attributes':[_0x3fb8('0x35'),'fullname',_0x3fb8('0xbe')],'required':![]},{'model':db[_0x3fb8('0xbf')],'as':_0x3fb8('0xc0'),'attributes':['id',_0x3fb8('0x35'),_0x3fb8('0xc1')],'where':_0x41fe09[_0x3fb8('0x3d')][_0x3fb8('0xc2')]?{'id':_0x41fe09[_0x3fb8('0x3d')][_0x3fb8('0xc2')]}:undefined,'required':_0x41fe09[_0x3fb8('0x3d')][_0x3fb8('0xc2')]?!![]:![]}];}return db[_0x3fb8('0xbb')][_0x3fb8('0x65')](_0x11c816);})['then'](function(_0x267ee4){_0xc0f414[_0x3fb8('0x4f')]=_0x267ee4;return _0xc0f414;});}})['then'](respondWithFilteredResult(_0x1162ec,_0x11c816))[_0x3fb8('0x25')](handleError(_0x1162ec,null));};exports['send']=function(_0x187d97,_0x2872d2,_0x1dea9a){var _0x31050b,_0x10c52a,_0x162e98;if(_[_0x3fb8('0x93')](_0x187d97[_0x3fb8('0x5b')][_0x3fb8('0x5b')])||_0x187d97[_0x3fb8('0x5b')]['body']===''){throw new db[(_0x3fb8('0x73'))][(_0x3fb8('0x74'))](_0x3fb8('0x95'));}if(_[_0x3fb8('0x93')](_0x187d97[_0x3fb8('0x5b')]['to'])){throw new db[(_0x3fb8('0x73'))]['ValidationError']('to\x20is\x20mandatory');}_0x31050b=_0x187d97[_0x3fb8('0x5b')]['to'];return db['SmsAccount'][_0x3fb8('0x58')]({'where':{'id':_0x187d97[_0x3fb8('0x51')]['id']},'include':[{'model':db[_0x3fb8('0x98')],'as':'List','include':[{'model':db[_0x3fb8('0x72')],'as':'Contacts','where':{'mobile':_0x31050b},'limit':0x1,'order':[['updatedAt',_0x3fb8('0x9a')]]}]}]})[_0x3fb8('0x1c')](handleEntityNotFound(_0x2872d2,null))[_0x3fb8('0x1c')](function(_0x550e23){if(_0x550e23&&_0x550e23[_0x3fb8('0xc3')]){_0x10c52a=_0x550e23['get']({'plain':!![]});if(_0x10c52a[_0x3fb8('0xc3')]&&_0x10c52a[_0x3fb8('0xc3')][_0x3fb8('0x99')][_0x3fb8('0x52')]){return _0x10c52a['List'][_0x3fb8('0x99')][0x0];}return db[_0x3fb8('0x72')][_0x3fb8('0x53')](_['defaults'](_0x187d97[_0x3fb8('0x5b')],{'firstName':_0x31050b,'mobile':_0x31050b,'phone':_0x31050b,'ListId':_0x10c52a['ListId']}));}})[_0x3fb8('0x1c')](handleEntityNotFound(_0x2872d2,null))[_0x3fb8('0x1c')](function(_0x354b16){if(_0x354b16){_0x162e98=_0x354b16;return db[_0x3fb8('0xbb')]['find']({'where':{'ContactId':_0x162e98['id'],'closed':![],'SmsAccountId':_0x10c52a['id']}})[_0x3fb8('0x1c')](function(_0x25fbb8){if(_0x25fbb8){return[_0x25fbb8,![]];}return db[_0x3fb8('0xbb')]['create']({'UserId':_0x187d97[_0x3fb8('0x56')]['id'],'ContactId':_0x162e98['id'],'SmsAccountId':_0x10c52a['id'],'phone':_0x31050b,'firstMsgDirection':_0x3fb8('0xc4'),'Messages':[_[_0x3fb8('0x4c')](_0x187d97['body'],{'read':![],'body':_0x187d97['body'][_0x3fb8('0x5b')],'phone':_0x31050b,'SmsAccountId':_0x10c52a['id'],'UserId':_0x187d97[_0x3fb8('0x56')]['id'],'ContactId':_0x162e98['id']})]},{'include':[{'model':db[_0x3fb8('0xa6')],'as':_0x3fb8('0xc5')}]})[_0x3fb8('0x1c')](function(_0x2b0ccd){return[_0x2b0ccd,!![]];});});}})['spread'](function(_0x497e11,_0xe6139a){if(_0xe6139a){return _0x497e11;}return db[_0x3fb8('0xa6')]['create'](_[_0x3fb8('0x4c')](_0x187d97[_0x3fb8('0x5b')],{'read':![],'body':_0x187d97['body']['body'],'phone':_0x31050b,'SmsAccountId':_0x10c52a['id'],'SmsInteractionId':_0x497e11['id'],'UserId':_0x187d97[_0x3fb8('0x56')]['id'],'ContactId':_0x162e98['id']}))[_0x3fb8('0x1c')](function(_0x279a62){_0x497e11[_0x3fb8('0xc6')][_0x3fb8('0xc5')]=[];_0x497e11['dataValues'][_0x3fb8('0xc5')][_0x3fb8('0xc7')](_0x279a62[_0x3fb8('0xc6')]);return _0x497e11;});})[_0x3fb8('0x1c')](respondWithResult(_0x2872d2,null))[_0x3fb8('0x25')](handleError(_0x2872d2,null));};exports[_0x3fb8('0x28')]=function(_0x3947bc,_0x3f9129,_0x4d77ff){if(_0x3947bc[_0x3fb8('0x5b')]['id']){delete _0x3947bc[_0x3fb8('0x5b')]['id'];}var _0x778fbd,_0x21ba1c,_0x38ad74;return db[_0x3fb8('0x3a')][_0x3fb8('0x58')]({'where':{'id':_0x3947bc[_0x3fb8('0x51')]['id']}})[_0x3fb8('0x1c')](handleEntityNotFound(_0x3f9129,null))[_0x3fb8('0x1c')](function(_0x515c74){if(_0x515c74){_0x38ad74=_0x515c74;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3fb8('0x28'),_0x3fb8('0xc8'),_0x515c74[_0x3fb8('0x4b')],util[_0x3fb8('0xc9')](_0x3947bc[_0x3fb8('0x5b')],{'showHidden':![],'depth':null}));switch(_0x515c74['type']){case _0x3fb8('0x80'):if(_0x3947bc[_0x3fb8('0x5b')][_0x3fb8('0xca')]&&_0x3947bc[_0x3fb8('0x5b')][_0x3fb8('0x28')]){_0x21ba1c=_0x3947bc[_0x3fb8('0x5b')][_0x3fb8('0x28')];return db[_0x3fb8('0xa6')]['find']({'where':{'messageId':_0x3947bc[_0x3fb8('0x5b')]['skebby_dispatch_id']}});}break;case _0x3fb8('0x82'):if(_0x3947bc[_0x3fb8('0x5b')][_0x3fb8('0xcb')]&&_0x3947bc[_0x3fb8('0x5b')][_0x3fb8('0xcc')]){_0x21ba1c=_0x3947bc[_0x3fb8('0x5b')][_0x3fb8('0xcc')];return db[_0x3fb8('0xa6')]['find']({'where':{'messageId':_0x3947bc['body'][_0x3fb8('0xcb')]}});}break;case _0x3fb8('0x83'):if(_0x3947bc[_0x3fb8('0x5b')]['message_id']&&_0x3947bc[_0x3fb8('0x5b')][_0x3fb8('0xcd')]){_0x21ba1c=_0x3947bc['body'][_0x3fb8('0xcd')];return db['SmsMessage'][_0x3fb8('0x58')]({'where':{'messageId':_0x3947bc[_0x3fb8('0x5b')]['message_id']}});}break;case'infobip':var _0x1e4afb=_0x3947bc[_0x3fb8('0x5b')][_0x3fb8('0x89')][0x0];if(_0x1e4afb[_0x3fb8('0x86')]&&_0x1e4afb[_0x3fb8('0x28')][_0x3fb8('0xce')]===_0x3fb8('0xcf')){_0x21ba1c=_0x1e4afb['status']['groupName'];return db[_0x3fb8('0xa6')][_0x3fb8('0x58')]({'where':{'messageId':_0x1e4afb[_0x3fb8('0x86')]}});}break;case'clickatell':if(_0x3947bc[_0x3fb8('0x5b')][_0x3fb8('0x86')]&&_0x3947bc[_0x3fb8('0x5b')]['status']){_0x21ba1c=_0x3947bc[_0x3fb8('0x5b')][_0x3fb8('0x28')];return db[_0x3fb8('0xa6')]['find']({'where':{'messageId':_0x3947bc[_0x3fb8('0x5b')][_0x3fb8('0x86')]}});}break;case'bandwidth':if(_0x3947bc['body'][0x0][_0x3fb8('0x23')]['id']){_0x21ba1c=_0x3947bc['body'][0x0]['type'];return db[_0x3fb8('0xa6')][_0x3fb8('0x58')]({'where':{'messageId':_0x3947bc[_0x3fb8('0x5b')][0x0][_0x3fb8('0x23')]['id']}});}break;case'intelepeer':if(_0x3947bc[_0x3fb8('0x5b')][_0x3fb8('0xd0')]&&_0x3947bc['body'][_0x3fb8('0x28')]){_0x21ba1c=_0x3947bc[_0x3fb8('0x5b')]['status'];return db['SmsMessage'][_0x3fb8('0x58')]({'where':{'messageId':_0x3947bc['body'][_0x3fb8('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x3f9129,null))[_0x3fb8('0x1c')](function(_0x434ad5){if(_0x434ad5){_0x778fbd=_0x434ad5;switch(_0x38ad74['type']){case'skebby':if(_0x21ba1c==='DELIVERED'){return _0x778fbd['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3fb8('0x28'),_0x3fb8('0x80'),util[_0x3fb8('0xc9')](_0x3947bc[_0x3fb8('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x3fb8('0x82'):if(_0x21ba1c==='1'){return _0x778fbd['update']({'read':!![]});}else{logger[_0x3fb8('0x21')](_0x3fb8('0x1f'),_0x3fb8('0x28'),'skebby',util['inspect'](_0x3947bc[_0x3fb8('0x5b')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x3947bc[_0x3fb8('0x5b')][_0x3fb8('0xd1')]&&_0x21ba1c>=0xc8&&_0x21ba1c<=0xce){return _0x778fbd[_0x3fb8('0x2f')]({'read':!![]});}else{logger[_0x3fb8('0x21')](_0x3fb8('0x1f'),'status',_0x3fb8('0x83'),util[_0x3fb8('0xc9')](_0x3947bc[_0x3fb8('0x5b')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xb7188d=_0x3947bc['body'][_0x3fb8('0x89')][0x0];if(_0xb7188d[_0x3fb8('0x28')]['groupName']===_0x3fb8('0xcf')){return _0x778fbd[_0x3fb8('0x2f')]({'read':!![]});}else{logger[_0x3fb8('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3fb8('0x28'),'infobip',util[_0x3fb8('0xc9')](_0x3947bc['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x21ba1c=='DELIVERED_TO_GATEWAY'||_0x21ba1c==_0x3fb8('0xd2')){return _0x778fbd[_0x3fb8('0x2f')]({'read':!![]});}else{logger[_0x3fb8('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3fb8('0x28'),_0x3fb8('0x8e'),util[_0x3fb8('0xc9')](_0x3947bc[_0x3fb8('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x3fb8('0xd3'):if(_0x21ba1c=='message-delivered'){return _0x778fbd['update']({'read':!![]});}else{logger[_0x3fb8('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3fb8('0x28'),_0x3fb8('0xd3'),util['inspect'](_0x3947bc[_0x3fb8('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x3fb8('0x91'):if(_0x21ba1c===_0x3fb8('0xd4')||_0x21ba1c===_0x3fb8('0xd5')){return _0x778fbd[_0x3fb8('0x2f')]({'read':!![]});}else{logger[_0x3fb8('0x21')](_0x3fb8('0x1f'),_0x3fb8('0x28'),_0x3fb8('0x91'),util['inspect'](_0x3947bc[_0x3fb8('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x778fbd;}})[_0x3fb8('0x1c')](respondWithResult(_0x3f9129,null))[_0x3fb8('0x25')](handleError(_0x3f9129,null));};exports['statusGet']=function(_0x368e6c,_0x3743f5,_0x16dc57){var _0x15d16c,_0x2a07c4,_0x551ae0;return db[_0x3fb8('0x3a')][_0x3fb8('0x58')]({'where':{'id':_0x368e6c[_0x3fb8('0x51')]['id']}})[_0x3fb8('0x1c')](handleEntityNotFound(_0x3743f5,null))['then'](function(_0x8545d4){if(_0x8545d4){_0x551ae0=_0x8545d4;logger['debug'](_0x3fb8('0x1f'),'status',_0x3fb8('0xc8'),_0x8545d4[_0x3fb8('0x4b')],util[_0x3fb8('0xc9')](_0x368e6c[_0x3fb8('0x3d')],{'showHidden':![],'depth':null}));switch(_0x8545d4['type']){case _0x3fb8('0x8b'):if(_0x368e6c[_0x3fb8('0x3d')][_0x3fb8('0xd6')]&&_0x368e6c[_0x3fb8('0x3d')][_0x3fb8('0xd7')]){_0x2a07c4=_0x368e6c[_0x3fb8('0x3d')][_0x3fb8('0xd7')];return db[_0x3fb8('0xa6')]['find']({'where':{'messageId':_0x368e6c[_0x3fb8('0x3d')][_0x3fb8('0xd6')]}});}break;}}})[_0x3fb8('0x1c')](handleEntityNotFound(_0x3743f5,null))[_0x3fb8('0x1c')](function(_0x1df7d0){if(_0x1df7d0){_0x15d16c=_0x1df7d0;switch(_0x551ae0[_0x3fb8('0x4b')]){case _0x3fb8('0x8b'):if(_0x2a07c4==='2'||_0x2a07c4==='6'){return _0x15d16c['update']({'read':!![]});}else{logger[_0x3fb8('0x21')](_0x3fb8('0x1f'),_0x3fb8('0x28'),'csc',util[_0x3fb8('0xc9')](_0x368e6c['query'],{'showHidden':![],'depth':null}));};break;}return _0x15d16c;}})['then'](respondWithResult(_0x3743f5,null))[_0x3fb8('0x25')](handleError(_0x3743f5,null));};exports[_0x3fb8('0xd8')]=function(_0x1fc456,_0x341906,_0x57f498){return db['SmsAccount'][_0x3fb8('0x58')]({'where':{'id':_0x1fc456[_0x3fb8('0x51')]['id']}})[_0x3fb8('0x1c')](handleEntityNotFound(_0x341906,null))[_0x3fb8('0x1c')](function(_0x44604b){if(_0x44604b){return _0x44604b[_0x3fb8('0xd8')](_0x1fc456[_0x3fb8('0x5b')][_0x3fb8('0x67')],_[_0x3fb8('0x9c')](_0x1fc456[_0x3fb8('0x5b')],[_0x3fb8('0x67'),'id'])||{})[_0x3fb8('0x9f')](function(_0xf796e8){for(var _0x303df2=0x0;_0x303df2<_0x1fc456[_0x3fb8('0x5b')]['ids']['length'];_0x303df2+=0x1){socket['emit'](_0x3fb8('0xd9'),{'UserId':_0x1fc456[_0x3fb8('0x5b')][_0x3fb8('0x67')][_0x303df2],'SmsAccountId':_0x1fc456[_0x3fb8('0x51')]['id']});}return _0xf796e8;});}})['then'](respondWithResult(_0x341906,null))[_0x3fb8('0x25')](handleError(_0x341906,null));};exports[_0x3fb8('0xda')]=function(_0x1af98d,_0xfb635c,_0x55085c){return db[_0x3fb8('0x3a')]['find']({'where':{'id':_0x1af98d[_0x3fb8('0x51')]['id']}})[_0x3fb8('0x1c')](handleEntityNotFound(_0xfb635c,null))[_0x3fb8('0x1c')](function(_0x1f5490){if(_0x1f5490){return _0x1f5490['removeAgents'](_0x1af98d['query'][_0x3fb8('0x67')])[_0x3fb8('0x1c')](function(){if(_[_0x3fb8('0xdb')](_0x1af98d[_0x3fb8('0x3d')][_0x3fb8('0x67')])){for(var _0x2c30f7=0x0;_0x2c30f7<_0x1af98d[_0x3fb8('0x3d')][_0x3fb8('0x67')][_0x3fb8('0x52')];_0x2c30f7+=0x1){socket['emit'](_0x3fb8('0xdc'),{'UserId':Number(_0x1af98d[_0x3fb8('0x3d')][_0x3fb8('0x67')][_0x2c30f7]),'SmsAccountId':Number(_0x1af98d[_0x3fb8('0x51')]['id'])});}}else{socket[_0x3fb8('0xdd')](_0x3fb8('0xdc'),{'UserId':Number(_0x1af98d['query']['ids']),'SmsAccountId':Number(_0x1af98d[_0x3fb8('0x51')]['id'])});}});}})[_0x3fb8('0x1c')](respondWithStatusCode(_0xfb635c,null))[_0x3fb8('0x25')](handleError(_0xfb635c,null));};exports['getAgents']=function(_0x589bda,_0x3831ef,_0x20e818){var _0x5c108e={};var _0x1edb62={};var _0x4e8ddf;var _0xc35d79;return db[_0x3fb8('0x3a')][_0x3fb8('0x61')]({'where':{'id':_0x589bda[_0x3fb8('0x51')]['id']}})[_0x3fb8('0x1c')](handleEntityNotFound(_0x3831ef,null))[_0x3fb8('0x1c')](function(_0x15bb35){if(_0x15bb35){_0x4e8ddf=_0x15bb35;_0x1edb62[_0x3fb8('0x41')]=_[_0x3fb8('0x3e')](db[_0x3fb8('0xa8')][_0x3fb8('0x3b')]);_0x1edb62[_0x3fb8('0x3d')]=_[_0x3fb8('0x3e')](_0x589bda[_0x3fb8('0x3d')]);_0x1edb62[_0x3fb8('0x48')]=_['intersection'](_0x1edb62['model'],_0x1edb62[_0x3fb8('0x3d')]);_0x5c108e[_0x3fb8('0x40')]=_['intersection'](_0x1edb62[_0x3fb8('0x41')],qs[_0x3fb8('0x42')](_0x589bda[_0x3fb8('0x3d')][_0x3fb8('0x42')]));_0x5c108e[_0x3fb8('0x40')]=_0x5c108e[_0x3fb8('0x40')][_0x3fb8('0x52')]?_0x5c108e[_0x3fb8('0x40')]:_0x1edb62[_0x3fb8('0x41')];_0x5c108e[_0x3fb8('0x45')]=qs[_0x3fb8('0x46')](_0x589bda[_0x3fb8('0x3d')]['sort']);_0x5c108e[_0x3fb8('0x47')]=qs[_0x3fb8('0x48')](_[_0x3fb8('0x49')](_0x589bda[_0x3fb8('0x3d')],_0x1edb62[_0x3fb8('0x48')]));if(_0x589bda['query'][_0x3fb8('0x4a')]){_0x5c108e[_0x3fb8('0x47')]=_[_0x3fb8('0x4c')](_0x5c108e['where'],{'$or':_[_0x3fb8('0x39')](_0x5c108e[_0x3fb8('0x40')],function(_0x11d3b4){var _0x38f7c7={};_0x38f7c7[_0x11d3b4]={'$like':'%'+_0x589bda[_0x3fb8('0x3d')]['filter']+'%'};return _0x38f7c7;})});}_0x5c108e=_[_0x3fb8('0x4c')]({},_0x5c108e,_0x589bda['options']);return _0x4e8ddf[_0x3fb8('0xde')](_0x5c108e);}})[_0x3fb8('0x1c')](function(_0x405a79){if(_0x405a79){_0xc35d79=_0x405a79[_0x3fb8('0x52')];if(!_0x589bda[_0x3fb8('0x3d')][_0x3fb8('0x43')]('nolimit')){_0x5c108e['limit']=qs[_0x3fb8('0x44')](_0x589bda[_0x3fb8('0x3d')]['limit']);_0x5c108e['offset']=qs['offset'](_0x589bda[_0x3fb8('0x3d')][_0x3fb8('0x63')]);}return _0x4e8ddf[_0x3fb8('0xde')](_0x5c108e);}})[_0x3fb8('0x1c')](function(_0x548bf9){if(_0x548bf9){return _0x548bf9?{'count':_0xc35d79,'rows':_0x548bf9}:null;}})[_0x3fb8('0x1c')](respondWithResult(_0x3831ef,null))['catch'](handleError(_0x3831ef,null));}; \ No newline at end of file +var _0x138d=['./smsAccount.socket','register','jayson/promise','client','http','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','SmsAccount,\x20%s,\x20%s','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','UserProfileResource','then','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','map','type','VIRTUAL','options','includeAll','include','findAll','show','params','create','body','user','get','role','SmsAccounts','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','pick','removeAnswers','notify','sms','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','CompanyId','mobile','twilio','from','From','messageId','text','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','intelepeer','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','list','omit','contact','spread','interaction','created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','info','entity\x20found','Content-Type','send','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','SmsInteraction','Contact','Owner','fullname','internal','Tag','Tags','color','tag','rows','to\x20is\x20mandatory','List','DESC','Messages','SmsMessage','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','DELIVERED','bandwidth','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter'];(function(_0x2b6798,_0x2163e6){var _0x4991ab=function(_0x4bc90a){while(--_0x4bc90a){_0x2b6798['push'](_0x2b6798['shift']());}};_0x4991ab(++_0x2163e6);}(_0x138d,0x1a5));var _0xd138=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0x138d[_0x56f7e2];return _0x36240b;};'use strict';var pdf=require(_0xd138('0x0'));var emlformat=require(_0xd138('0x1'));var rimraf=require(_0xd138('0x2'));var zipdir=require(_0xd138('0x3'));var jsonpatch=require(_0xd138('0x4'));var rp=require('request-promise');var moment=require(_0xd138('0x5'));var BPromise=require(_0xd138('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd138('0x7'));var sox=require('sox');var csv=require(_0xd138('0x8'));var ejs=require(_0xd138('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd138('0xa'));var crypto=require(_0xd138('0xb'));var jsforce=require(_0xd138('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd138('0x8'));var querystring=require(_0xd138('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd138('0xe'));var qs=require(_0xd138('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd138('0x10'));var logger=require(_0xd138('0x11'))(_0xd138('0x12'));var utils=require(_0xd138('0x13'));var config=require(_0xd138('0x14'));var licenseUtil=require(_0xd138('0x15'));var db=require(_0xd138('0x16'))['db'];config['redis']=_[_0xd138('0x17')](config[_0xd138('0x18')],{'host':_0xd138('0x19'),'port':0x18eb});var socket=require(_0xd138('0x1a'))(new Redis(config[_0xd138('0x18')]));require(_0xd138('0x1b'))[_0xd138('0x1c')](socket);var jayson=require(_0xd138('0x1d'));var client=jayson[_0xd138('0x1e')][_0xd138('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0xf89f0f,_0x473079,_0x3a6760,_0x55c7bf){return new BPromise(function(_0x54ff81,_0xc812ab){var _0x253262=_0x55c7bf||client;return _0x253262['request'](_0xf89f0f,_0x3a6760)['then'](function(_0x22976b){logger['info']('SmsAccount,\x20%s,\x20%s',_0x473079,_0xd138('0x20'));logger[_0xd138('0x21')](_0xd138('0x22'),_0x473079,_0xd138('0x20'),JSON[_0xd138('0x23')](_0x22976b));if(_0x22976b['error']){if(_0x22976b['error'][_0xd138('0x24')]===0x1f4){logger[_0xd138('0x25')]('SmsAccount,\x20%s,\x20%s',_0x473079,_0x22976b[_0xd138('0x25')]['message']);return _0xc812ab(_0x22976b[_0xd138('0x25')][_0xd138('0x26')]);}logger[_0xd138('0x25')](_0xd138('0x27'),_0x473079,_0x22976b['error'][_0xd138('0x26')]);return _0x54ff81(_0x22976b['error'][_0xd138('0x26')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x473079,_0xd138('0x20'));_0x54ff81(_0x22976b[_0xd138('0x28')][_0xd138('0x26')]);}})[_0xd138('0x29')](function(_0x3ec95f){logger[_0xd138('0x25')]('SmsAccount,\x20%s,\x20%s',_0x473079,_0x3ec95f);_0xc812ab(_0x3ec95f);});});}function respondWithStatusCode(_0x54a75e,_0x3a5b19){_0x3a5b19=_0x3a5b19||0xcc;return function(_0x2d82cd){if(_0x2d82cd){return _0x54a75e['sendStatus'](_0x3a5b19);}return _0x54a75e[_0xd138('0x2a')](_0x3a5b19)[_0xd138('0x2b')]();};}function respondWithResult(_0x59e0a4,_0x1a1c65){_0x1a1c65=_0x1a1c65||0xc8;return function(_0xa5b49b){if(_0xa5b49b){return _0x59e0a4[_0xd138('0x2a')](_0x1a1c65)[_0xd138('0x2c')](_0xa5b49b);}};}function respondWithFilteredResult(_0x2f9b6,_0x4427da){return function(_0x4497ed){if(_0x4497ed){var _0x3da0d=_0x4497ed[_0xd138('0x2d')],_0x12856e=_0x4427da['offset'],_0x200c82=_0x4427da[_0xd138('0x2e')]+_0x4427da[_0xd138('0x2f')],_0x177b93;if(_0x200c82>=_0x3da0d){_0x200c82=_0x3da0d;_0x177b93=0xc8;}else{_0x177b93=0xce;}_0x2f9b6[_0xd138('0x2a')](_0x177b93);return _0x2f9b6[_0xd138('0x30')](_0xd138('0x31'),_0x12856e+'-'+_0x200c82+'/'+_0x3da0d)[_0xd138('0x2c')](_0x4497ed);}return null;};}function patchUpdates(_0xfe92fb){return function(_0x28493d){try{jsonpatch[_0xd138('0x32')](_0x28493d,_0xfe92fb,!![]);}catch(_0x384ff3){return BPromise[_0xd138('0x33')](_0x384ff3);}return _0x28493d['save']();};}function saveUpdates(_0x4e99d2,_0x27b4b0){return function(_0x5a4bfc){if(_0x5a4bfc){return _0x5a4bfc[_0xd138('0x34')](_0x4e99d2)['then'](function(_0xc7c622){return _0xc7c622;});}return null;};}function removeEntity(_0x1c15b2,_0x309523){return function(_0x3968d6){if(_0x3968d6){return _0x3968d6[_0xd138('0x35')]()['then'](function(){var _0x3ea9a2=_0x3968d6['get']({'plain':!![]});var _0x28d6bc='SmsAccounts';return db[_0xd138('0x36')][_0xd138('0x35')]({'where':{'type':_0x28d6bc,'resourceId':_0x3ea9a2['id']}})[_0xd138('0x37')](function(){return _0x3968d6;});})[_0xd138('0x37')](function(){_0x1c15b2['status'](0xcc)[_0xd138('0x2b')]();});}};}function handleEntityNotFound(_0x18c6a4,_0x40790c){return function(_0x39f6de){if(!_0x39f6de){_0x18c6a4[_0xd138('0x38')](0x194);}return _0x39f6de;};}function handleError(_0x56cbc9,_0xbca792){_0xbca792=_0xbca792||0x1f4;return function(_0x911737){logger[_0xd138('0x25')](_0x911737[_0xd138('0x39')]);if(_0x911737[_0xd138('0x3a')]){delete _0x911737[_0xd138('0x3a')];}_0x56cbc9[_0xd138('0x2a')](_0xbca792)['send'](_0x911737);};}exports[_0xd138('0x3b')]=function(_0x49cd4f,_0x5ec29b){var _0x24aa4b={'include':[{'model':db[_0xd138('0x3c')],'as':_0xd138('0x3d')}]},_0x415498={},_0xb985b0={'count':0x0,'rows':[]};var _0x450f18=_['map'](db[_0xd138('0x3e')][_0xd138('0x3f')],function(_0x50406d){return{'name':_0x50406d[_0xd138('0x40')],'type':_0x50406d['type'][_0xd138('0x41')]};});_0x415498[_0xd138('0x42')]=_['map'](_0x450f18,_0xd138('0x3a'));_0x415498['query']=_[_0xd138('0x43')](_0x49cd4f[_0xd138('0x44')]);_0x415498[_0xd138('0x45')]=_[_0xd138('0x46')](_0x415498[_0xd138('0x42')],_0x415498[_0xd138('0x44')]);_0x24aa4b[_0xd138('0x47')]=_[_0xd138('0x46')](_0x415498[_0xd138('0x42')],qs[_0xd138('0x48')](_0x49cd4f['query']['fields']));_0x24aa4b['attributes']=_0x24aa4b[_0xd138('0x47')][_0xd138('0x49')]?_0x24aa4b['attributes']:_0x415498['model'];if(!_0x49cd4f[_0xd138('0x44')][_0xd138('0x4a')](_0xd138('0x4b'))){_0x24aa4b[_0xd138('0x2f')]=qs[_0xd138('0x2f')](_0x49cd4f[_0xd138('0x44')][_0xd138('0x2f')]);_0x24aa4b['offset']=qs[_0xd138('0x2e')](_0x49cd4f[_0xd138('0x44')]['offset']);}_0x24aa4b[_0xd138('0x4c')]=qs[_0xd138('0x4d')](_0x49cd4f['query'][_0xd138('0x4d')]);_0x24aa4b['where']=qs[_0xd138('0x45')](_['pick'](_0x49cd4f['query'],_0x415498[_0xd138('0x45')]),_0x450f18);if(_0x49cd4f[_0xd138('0x44')][_0xd138('0x4e')]){_0x24aa4b['where']=_[_0xd138('0x4f')](_0x24aa4b[_0xd138('0x50')],{'$or':_[_0xd138('0x51')](_0x450f18,function(_0x368e8f){if(_0x368e8f[_0xd138('0x52')]!==_0xd138('0x53')){var _0x12908d={};_0x12908d[_0x368e8f['name']]={'$like':'%'+_0x49cd4f['query'][_0xd138('0x4e')]+'%'};return _0x12908d;}})});}_0x24aa4b=_[_0xd138('0x4f')]({},_0x24aa4b,_0x49cd4f[_0xd138('0x54')]);var _0x5b0e39={'where':_0x24aa4b[_0xd138('0x50')]};return db[_0xd138('0x3e')][_0xd138('0x2d')](_0x5b0e39)['then'](function(_0x24b75d){_0xb985b0[_0xd138('0x2d')]=_0x24b75d;if(_0x49cd4f['query'][_0xd138('0x55')]){_0x24aa4b[_0xd138('0x56')]=[{'all':!![]}];}return db[_0xd138('0x3e')][_0xd138('0x57')](_0x24aa4b);})['then'](function(_0x1f4f75){_0xb985b0['rows']=_0x1f4f75;return _0xb985b0;})[_0xd138('0x37')](respondWithFilteredResult(_0x5ec29b,_0x24aa4b))[_0xd138('0x29')](handleError(_0x5ec29b,null));};exports[_0xd138('0x58')]=function(_0x2816ac,_0x756304){var _0x35679d={'raw':![],'where':{'id':_0x2816ac[_0xd138('0x59')]['id']},'include':[{'model':db[_0xd138('0x3c')],'as':_0xd138('0x3d')}]},_0x37b931={};_0x37b931[_0xd138('0x42')]=_[_0xd138('0x43')](db[_0xd138('0x3e')][_0xd138('0x3f')]);_0x37b931[_0xd138('0x44')]=_['keys'](_0x2816ac[_0xd138('0x44')]);_0x37b931['filters']=_[_0xd138('0x46')](_0x37b931['model'],_0x37b931[_0xd138('0x44')]);_0x35679d[_0xd138('0x47')]=_[_0xd138('0x46')](_0x37b931['model'],qs[_0xd138('0x48')](_0x2816ac[_0xd138('0x44')][_0xd138('0x48')]));_0x35679d[_0xd138('0x47')]=_0x35679d[_0xd138('0x47')][_0xd138('0x49')]?_0x35679d[_0xd138('0x47')]:_0x37b931['model'];if(_0x2816ac[_0xd138('0x44')][_0xd138('0x55')]){_0x35679d[_0xd138('0x56')]=[{'all':!![]}];}_0x35679d=_[_0xd138('0x4f')]({},_0x35679d,_0x2816ac[_0xd138('0x54')]);return db[_0xd138('0x3e')]['find'](_0x35679d)[_0xd138('0x37')](handleEntityNotFound(_0x756304,null))[_0xd138('0x37')](respondWithResult(_0x756304,null))['catch'](handleError(_0x756304,null));};exports['create']=function(_0x3c3a3b,_0x35e9e3){return db[_0xd138('0x3e')][_0xd138('0x5a')](_0x3c3a3b[_0xd138('0x5b')],{})[_0xd138('0x37')](function(_0x3ededb){var _0x49f86a=_0x3c3a3b[_0xd138('0x5c')][_0xd138('0x5d')]({'plain':!![]});if(!_0x49f86a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49f86a[_0xd138('0x5e')]===_0xd138('0x5c')){var _0x1e16ab=_0x3ededb[_0xd138('0x5d')]({'plain':!![]});var _0x142ab2=_0xd138('0x5f');return db['UserProfileSection'][_0xd138('0x60')]({'where':{'name':_0x142ab2,'userProfileId':_0x49f86a[_0xd138('0x61')]},'raw':!![]})[_0xd138('0x37')](function(_0x15c5ba){if(_0x15c5ba&&_0x15c5ba[_0xd138('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x1e16ab[_0xd138('0x3a')],'resourceId':_0x1e16ab['id'],'type':_0x15c5ba[_0xd138('0x3a')],'sectionId':_0x15c5ba['id']},{})[_0xd138('0x37')](function(){return _0x3ededb;});}else{return _0x3ededb;}})[_0xd138('0x29')](function(_0x48e5e1){logger[_0xd138('0x25')](_0xd138('0x63'),_0x48e5e1);throw _0x48e5e1;});}return _0x3ededb;})['then'](respondWithResult(_0x35e9e3,0xc9))['catch'](handleError(_0x35e9e3,null));};exports[_0xd138('0x34')]=function(_0x29fd2a,_0x1718e1){if(_0x29fd2a['body']['id']){delete _0x29fd2a[_0xd138('0x5b')]['id'];}return db[_0xd138('0x3e')][_0xd138('0x60')]({'where':{'id':_0x29fd2a[_0xd138('0x59')]['id']},'include':[{'model':db[_0xd138('0x3c')],'as':_0xd138('0x3d')}]})['then'](handleEntityNotFound(_0x1718e1,null))[_0xd138('0x37')](saveUpdates(_0x29fd2a[_0xd138('0x5b')],null))[_0xd138('0x37')](respondWithResult(_0x1718e1,null))[_0xd138('0x29')](handleError(_0x1718e1,null));};exports[_0xd138('0x35')]=function(_0x22855a,_0x7e15af){return db[_0xd138('0x3e')][_0xd138('0x60')]({'where':{'id':_0x22855a[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x7e15af,null))[_0xd138('0x37')](removeEntity(_0x7e15af,null))[_0xd138('0x29')](handleError(_0x7e15af,null));};exports[_0xd138('0x64')]=function(_0x4dc8a4,_0x4b00fa){return db[_0xd138('0x3e')][_0xd138('0x64')]()['then'](respondWithResult(_0x4b00fa,null))[_0xd138('0x29')](handleError(_0x4b00fa,null));};exports[_0xd138('0x65')]=function(_0x2b5a03,_0x2d50da,_0x3b731b){if(_0x2b5a03[_0xd138('0x5b')]['id']){delete _0x2b5a03[_0xd138('0x5b')]['id'];}return db[_0xd138('0x3e')][_0xd138('0x60')]({'where':{'id':_0x2b5a03[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x2d50da,null))[_0xd138('0x37')](function(_0xc7df72){if(_0xc7df72){_0x2b5a03['body'][_0xd138('0x66')]=_0xc7df72['id'];return db[_0xd138('0x67')][_0xd138('0x5a')](_0x2b5a03[_0xd138('0x5b')]);}})[_0xd138('0x37')](respondWithResult(_0x2d50da,null))[_0xd138('0x29')](handleError(_0x2d50da,null));};exports[_0xd138('0x68')]=function(_0x3bee1d,_0xfe5a10,_0x9489fc){var _0x11a87b={'raw':![],'where':{}};var _0xd4e6c9={};var _0x42ea09={'count':0x0,'rows':[]};return db[_0xd138('0x3e')][_0xd138('0x69')]({'where':{'id':_0x3bee1d[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0xfe5a10,null))[_0xd138('0x37')](function(_0x217bc1){if(_0x217bc1){_0xd4e6c9[_0xd138('0x42')]=_[_0xd138('0x43')](db[_0xd138('0x67')][_0xd138('0x3f')]);_0xd4e6c9[_0xd138('0x44')]=_[_0xd138('0x43')](_0x3bee1d[_0xd138('0x44')]);_0xd4e6c9[_0xd138('0x45')]=_[_0xd138('0x46')](_0xd4e6c9[_0xd138('0x42')],_0xd4e6c9[_0xd138('0x44')]);_0x11a87b[_0xd138('0x47')]=_[_0xd138('0x46')](_0xd4e6c9['model'],qs[_0xd138('0x48')](_0x3bee1d[_0xd138('0x44')][_0xd138('0x48')]));_0x11a87b[_0xd138('0x47')]=_0x11a87b[_0xd138('0x47')][_0xd138('0x49')]?_0x11a87b[_0xd138('0x47')]:_0xd4e6c9[_0xd138('0x42')];if(!_0x3bee1d['query']['hasOwnProperty'](_0xd138('0x4b'))){_0x11a87b[_0xd138('0x2f')]=qs[_0xd138('0x2f')](_0x3bee1d[_0xd138('0x44')][_0xd138('0x2f')]);_0x11a87b[_0xd138('0x2e')]=qs[_0xd138('0x2e')](_0x3bee1d['query']['offset']);}_0x11a87b[_0xd138('0x4c')]=qs[_0xd138('0x4d')](_0x3bee1d[_0xd138('0x44')]['sort']);_0x11a87b['where']=qs[_0xd138('0x45')](_['pick'](_0x3bee1d[_0xd138('0x44')],_0xd4e6c9[_0xd138('0x45')]));_0x11a87b[_0xd138('0x50')]['SmsAccountId']=_0x217bc1['id'];if(_0x3bee1d[_0xd138('0x44')]['filter']){_0x11a87b[_0xd138('0x50')]=_[_0xd138('0x4f')](_0x11a87b[_0xd138('0x50')],{'$or':_[_0xd138('0x51')](_0x11a87b[_0xd138('0x47')],function(_0x29b4f8){var _0x281478={};_0x281478[_0x29b4f8]={'$like':'%'+_0x3bee1d[_0xd138('0x44')][_0xd138('0x4e')]+'%'};return _0x281478;})});}_0x11a87b=_[_0xd138('0x4f')]({},_0x11a87b,_0x3bee1d['options']);return db[_0xd138('0x67')][_0xd138('0x2d')]({'where':_0x11a87b[_0xd138('0x50')]})['then'](function(_0x4c2277){_0x42ea09[_0xd138('0x2d')]=_0x4c2277;if(_0x3bee1d[_0xd138('0x44')][_0xd138('0x55')]){_0x11a87b['include']=[{'all':!![]}];}return db[_0xd138('0x67')][_0xd138('0x57')](_0x11a87b);})[_0xd138('0x37')](function(_0x2bd6a2){_0x42ea09['rows']=_0x2bd6a2;return _0x42ea09;});}})[_0xd138('0x37')](respondWithFilteredResult(_0xfe5a10,_0x11a87b))[_0xd138('0x29')](handleError(_0xfe5a10,null));};exports[_0xd138('0x6a')]=function(_0x422e69,_0x7424f4,_0x38a108){return db[_0xd138('0x3e')][_0xd138('0x60')]({'where':{'id':_0x422e69[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x7424f4,null))[_0xd138('0x37')](function(_0x5e4823){if(_0x5e4823){return _0x5e4823[_0xd138('0x6a')](_0x422e69['query'][_0xd138('0x6b')]);}})[_0xd138('0x37')](respondWithStatusCode(_0x7424f4,null))[_0xd138('0x29')](handleError(_0x7424f4,null));};exports[_0xd138('0x6c')]=function(_0x3277fa,_0x4c1407,_0x2bbecd){if(_0x3277fa['body']['id']){delete _0x3277fa['body']['id'];}return db['SmsAccount'][_0xd138('0x60')]({'where':{'id':_0x3277fa[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x4c1407,null))[_0xd138('0x37')](function(_0x9fc03c){if(_0x9fc03c){_0x3277fa['body'][_0xd138('0x66')]=_0x9fc03c['id'];return db['CannedAnswer'][_0xd138('0x5a')](_0x3277fa[_0xd138('0x5b')]);}})['then'](respondWithResult(_0x4c1407,null))[_0xd138('0x29')](handleError(_0x4c1407,null));};exports['getAnswers']=function(_0x4a443f,_0x4e7419,_0x44ffdc){var _0x2b6350={'raw':![],'where':{}};var _0x2870c4={};var _0xbde71d={'count':0x0,'rows':[]};return db[_0xd138('0x3e')][_0xd138('0x69')]({'where':{'id':_0x4a443f[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x4e7419,null))[_0xd138('0x37')](function(_0x19c345){if(_0x19c345){_0x2870c4[_0xd138('0x42')]=_[_0xd138('0x43')](db[_0xd138('0x6d')][_0xd138('0x3f')]);_0x2870c4[_0xd138('0x44')]=_[_0xd138('0x43')](_0x4a443f[_0xd138('0x44')]);_0x2870c4[_0xd138('0x45')]=_[_0xd138('0x46')](_0x2870c4[_0xd138('0x42')],_0x2870c4[_0xd138('0x44')]);_0x2b6350['attributes']=_[_0xd138('0x46')](_0x2870c4['model'],qs['fields'](_0x4a443f['query'][_0xd138('0x48')]));_0x2b6350[_0xd138('0x47')]=_0x2b6350['attributes']['length']?_0x2b6350[_0xd138('0x47')]:_0x2870c4['model'];if(!_0x4a443f[_0xd138('0x44')][_0xd138('0x4a')](_0xd138('0x4b'))){_0x2b6350[_0xd138('0x2f')]=qs['limit'](_0x4a443f[_0xd138('0x44')][_0xd138('0x2f')]);_0x2b6350[_0xd138('0x2e')]=qs['offset'](_0x4a443f[_0xd138('0x44')]['offset']);}_0x2b6350[_0xd138('0x4c')]=qs['sort'](_0x4a443f['query'][_0xd138('0x4d')]);_0x2b6350[_0xd138('0x50')]=qs['filters'](_[_0xd138('0x6e')](_0x4a443f['query'],_0x2870c4[_0xd138('0x45')]));_0x2b6350['where'][_0xd138('0x66')]=_0x19c345['id'];if(_0x4a443f['query'][_0xd138('0x4e')]){_0x2b6350[_0xd138('0x50')]=_[_0xd138('0x4f')](_0x2b6350['where'],{'$or':_[_0xd138('0x51')](_0x2b6350[_0xd138('0x47')],function(_0xf7819){var _0x2e8932={};_0x2e8932[_0xf7819]={'$like':'%'+_0x4a443f[_0xd138('0x44')][_0xd138('0x4e')]+'%'};return _0x2e8932;})});}_0x2b6350=_[_0xd138('0x4f')]({},_0x2b6350,_0x4a443f[_0xd138('0x54')]);return db[_0xd138('0x6d')][_0xd138('0x2d')]({'where':_0x2b6350[_0xd138('0x50')]})[_0xd138('0x37')](function(_0x3692cd){_0xbde71d['count']=_0x3692cd;if(_0x4a443f[_0xd138('0x44')][_0xd138('0x55')]){_0x2b6350[_0xd138('0x56')]=[{'all':!![]}];}return db[_0xd138('0x6d')][_0xd138('0x57')](_0x2b6350);})[_0xd138('0x37')](function(_0x1931cd){_0xbde71d['rows']=_0x1931cd;return _0xbde71d;});}})[_0xd138('0x37')](respondWithFilteredResult(_0x4e7419,_0x2b6350))[_0xd138('0x29')](handleError(_0x4e7419,null));};exports[_0xd138('0x6f')]=function(_0x2be671,_0x4c26f3,_0x585450){return db[_0xd138('0x3e')]['find']({'where':{'id':_0x2be671[_0xd138('0x59')]['id']}})['then'](handleEntityNotFound(_0x4c26f3,null))['then'](function(_0x2152dc){if(_0x2152dc){return _0x2152dc[_0xd138('0x6f')](_0x2be671[_0xd138('0x44')][_0xd138('0x6b')]);}})[_0xd138('0x37')](respondWithStatusCode(_0x4c26f3,null))[_0xd138('0x29')](handleError(_0x4c26f3,null));};exports[_0xd138('0x70')]=function(_0x4c49a3,_0x4c64ce,_0x1739f7){var _0x513c27={'channel':_0xd138('0x71')};var _0x5b8915=[];var _0x4d6423=[];var _0x265036={};return db[_0xd138('0x3e')][_0xd138('0x60')]({'where':{'id':_0x4c49a3['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0xd138('0x72')}]})[_0xd138('0x37')](handleEntityNotFound(_0x4c64ce,null))['then'](function(_0x3e0a4f){_0x513c27[_0xd138('0x73')]=_0x3e0a4f;_0x513c27[_0xd138('0x74')]=_[_0xd138('0x75')](_0x3e0a4f[_0xd138('0x72')],[_0xd138('0x76')],[_0xd138('0x77')]);if(_0x513c27['account'][_0xd138('0x72')]){delete _0x513c27[_0xd138('0x73')][_0xd138('0x72')];}return db[_0xd138('0x78')]['describe']();})[_0xd138('0x37')](function(_0x226516){if(!_0x226516){throw new db[(_0xd138('0x79'))][(_0xd138('0x7a'))](_0xd138('0x7b'));}_0x5b8915=_['difference'](_[_0xd138('0x43')](_0x226516),['createdAt',_0xd138('0x7c')]);_0x4d6423=_[_0xd138('0x7d')](_[_0xd138('0x43')](_0x226516),['createdAt',_0xd138('0x7c'),_0xd138('0x7e'),'ListId']);_0x513c27[_0xd138('0x5b')]={'mapKey':_0xd138('0x7f')};if(_0x513c27[_0xd138('0x73')][_0xd138('0x52')]){switch(_0x513c27['account']['type']){case _0xd138('0x80'):_0x513c27[_0xd138('0x5b')][_0xd138('0x81')]=_0x4c49a3['body'][_0xd138('0x82')];_0x513c27[_0xd138('0x5b')][_0xd138('0x5b')]=_0x4c49a3[_0xd138('0x5b')]['Body'];_0x513c27['body'][_0xd138('0x83')]=_0x4c49a3[_0xd138('0x5b')]['MessageSid'];break;case'skebby':_0x513c27[_0xd138('0x5b')][_0xd138('0x81')]='+'+_0x4c49a3['body']['sender'];_0x513c27['body'][_0xd138('0x5b')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x84')];break;case'connectel':_0x513c27['body']['from']=_0x4c49a3[_0xd138('0x5b')]['from'];_0x513c27[_0xd138('0x5b')][_0xd138('0x5b')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x26')];break;case _0xd138('0x85'):_0x513c27[_0xd138('0x5b')][_0xd138('0x81')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x81')];_0x513c27['body'][_0xd138('0x5b')]=_0x4c49a3['body'][_0xd138('0x5b')];_0x513c27[_0xd138('0x5b')][_0xd138('0x83')]=_0x4c49a3['body'][_0xd138('0x86')];break;case _0xd138('0x87'):_0x513c27[_0xd138('0x5b')][_0xd138('0x81')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x82')];_0x513c27[_0xd138('0x5b')][_0xd138('0x5b')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x88')];_0x513c27[_0xd138('0x5b')][_0xd138('0x83')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x89')];break;case _0xd138('0x8a'):_0x513c27[_0xd138('0x5b')][_0xd138('0x81')]='+'+_0x4c49a3[_0xd138('0x5b')][_0xd138('0x8b')][0x0][_0xd138('0x81')];_0x513c27[_0xd138('0x5b')][_0xd138('0x5b')]=_0x4c49a3['body']['results'][0x0]['text'];_0x513c27[_0xd138('0x5b')][_0xd138('0x83')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x8b')][0x0][_0xd138('0x83')];break;case _0xd138('0x8c'):_0x513c27['body'][_0xd138('0x81')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x8d')];_0x513c27[_0xd138('0x5b')][_0xd138('0x5b')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x8e')]['message'];break;case _0xd138('0x8f'):_0x513c27[_0xd138('0x5b')]['from']=_0x4c49a3[_0xd138('0x5b')]['fromNumber'];_0x513c27[_0xd138('0x5b')][_0xd138('0x5b')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x84')];_0x513c27['body'][_0xd138('0x83')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x90')];break;case'bandwidth':_0x513c27['body']['messageId']=_0x4c49a3[_0xd138('0x5b')][0x0]['message']['id'];_0x513c27[_0xd138('0x5b')][_0xd138('0x81')]=_0x4c49a3[_0xd138('0x5b')][0x0][_0xd138('0x26')][_0xd138('0x81')];_0x513c27[_0xd138('0x5b')][_0xd138('0x5b')]=_0x4c49a3[_0xd138('0x5b')][0x0][_0xd138('0x26')][_0xd138('0x84')];break;case _0xd138('0x91'):_0x513c27['body'][_0xd138('0x81')]=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x81')];_0x513c27[_0xd138('0x5b')]['body']=_0x4c49a3[_0xd138('0x5b')][_0xd138('0x26')];_0x513c27[_0xd138('0x5b')]['messageId']=_0x4c49a3[_0xd138('0x5b')]['refid'];break;}}if(_0x513c27[_0xd138('0x5b')]['id']){delete _0x513c27[_0xd138('0x5b')]['id'];}if(_[_0xd138('0x92')](_0x513c27[_0xd138('0x5b')][_0xd138('0x81')])){throw new db['Sequelize'][(_0xd138('0x7a'))](_0xd138('0x93'));}if(_[_0xd138('0x92')](_0x513c27['body'][_0xd138('0x5b')])||_0x513c27['body'][_0xd138('0x5b')]===''){throw new db[(_0xd138('0x79'))][(_0xd138('0x7a'))](_0xd138('0x94'));}if(_[_0xd138('0x92')](_0x513c27[_0xd138('0x5b')]['mapKey'])){throw new db['Sequelize'][(_0xd138('0x7a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4d6423);}if(!_[_0xd138('0x95')](_0x4d6423,_0x513c27[_0xd138('0x5b')][_0xd138('0x96')])){throw new db['Sequelize'][(_0xd138('0x7a'))](_0xd138('0x97')+_0x4d6423);}_0x265036[_0x513c27[_0xd138('0x5b')]['mapKey']]=_0x513c27[_0xd138('0x5b')]['from'];return db[_0xd138('0x98')]['find']({'where':{'id':_0x513c27[_0xd138('0x73')][_0xd138('0x99')]},'include':[{'model':db[_0xd138('0x78')],'as':_0xd138('0x9a'),'where':_0x265036,'limit':0x1,'order':[[_0xd138('0x7c'),'DESC']]}]});})[_0xd138('0x37')](handleEntityNotFound(_0x4c64ce,null))['then'](function(_0x17d468){if(_0x17d468){_0x513c27[_0xd138('0x9b')]=_[_0xd138('0x9c')](_0x17d468,[_0xd138('0x9a')]);if(_0x17d468[_0xd138('0x9a')][_0xd138('0x49')]){return _0x17d468['Contacts'][0x0];}var _0x182520=_[_0xd138('0x17')](_0x513c27[_0xd138('0x5b')],{'firstName':_0x513c27[_0xd138('0x5b')][_0xd138('0x81')],'ListId':_0x17d468['id']});_0x182520[_0x513c27[_0xd138('0x5b')][_0xd138('0x96')]]=_0x513c27[_0xd138('0x5b')][_0xd138('0x81')];return db['CmContact'][_0xd138('0x5a')](_0x182520,{'fields':_0x5b8915,'raw':!![]});}})['then'](handleEntityNotFound(_0x4c64ce,null))[_0xd138('0x37')](function(_0x1d9eec){if(_0x1d9eec){_0x513c27[_0xd138('0x9d')]=_0x1d9eec;var _0x4ae830={'ContactId':_0x1d9eec['id'],'phone':_0x513c27[_0xd138('0x5b')][_0xd138('0x81')],'SmsAccountId':_0x4c49a3[_0xd138('0x59')]['id']};var _0x234e50={'ContactId':_0x1d9eec['id'],'SmsAccountId':_0x4c49a3[_0xd138('0x59')]['id'],'closed':![]};return db['SmsInteraction'][_0xd138('0x60')]({'where':_0x234e50})['then'](function(_0x49cf36){if(_0x49cf36){return[_0x49cf36,![]];}return db['SmsInteraction'][_0xd138('0x5a')](_0x4ae830)[_0xd138('0x37')](function(_0x2465a4){return[_0x2465a4,!![]];});});}})[_0xd138('0x9e')](function(_0x32942b,_0x10ac01){_0x513c27['interaction']=_0x32942b[_0xd138('0x5d')]({'plain':!![]});_0x513c27[_0xd138('0x9f')][_0xd138('0xa0')]=![];if(_0x10ac01){if(_0x513c27[_0xd138('0x73')][_0xd138('0xa1')]){_0x513c27[_0xd138('0x74')][_0xd138('0xa2')]({'id':0x0,'priority':_0x513c27[_0xd138('0x74')]['length']+0x1,'app':_0xd138('0xa3'),'appdata':'unmanaged','interval':_0xd138('0xa4')});}_0x513c27['interaction'][_0xd138('0xa0')]=!![];}return db['SmsMessage']['create']({'phone':_0x513c27[_0xd138('0x5b')][_0xd138('0x81')],'messageId':_0x513c27[_0xd138('0x5b')][_0xd138('0x83')],'body':_0x513c27[_0xd138('0x5b')][_0xd138('0x5b')],'SmsAccountId':_0x4c49a3[_0xd138('0x59')]['id'],'SmsInteractionId':_0x32942b['id'],'direction':'in','ContactId':_0x32942b['ContactId'],'AttachmentId':_0x513c27[_0xd138('0x5b')][_0xd138('0xa5')]});})[_0xd138('0x37')](function(_0x125fdf){_0x513c27[_0xd138('0x26')]=_0x125fdf;if(_0x513c27[_0xd138('0x9f')][_0xd138('0xa6')]){return db[_0xd138('0xa7')][_0xd138('0x60')]({'attributes':['id',_0xd138('0x3a')],'where':{'id':_0x513c27[_0xd138('0x9f')][_0xd138('0xa6')]}})['then'](function(_0x12750a){if(_0x12750a){_0x513c27[_0xd138('0x74')][_0xd138('0xa8')]({'id':0x0,'priority':0x0,'app':_0xd138('0xa9'),'appdata':_0x12750a[_0xd138('0x3a')]+','+(_0x513c27[_0xd138('0x73')][_0xd138('0xaa')]||0xa),'interval':_0xd138('0xa4')});}return respondWithRpcPromise(_0xd138('0xab'),_0xd138('0xac'),_0x513c27);});}return respondWithRpcPromise('Start',_0xd138('0xac'),_0x513c27);})[_0xd138('0x37')](function(_0x53969f){if(_0x53969f){var _0x3f1157=0xc8;var _0x507805=_0xd138('0xad');logger[_0xd138('0xae')](_0xd138('0x22'),_0x507805,_0x3f1157,_0xd138('0xaf'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x507805,_0x3f1157,'entity\x20found',JSON['stringify'](_0x53969f));if(_0x513c27[_0xd138('0x73')][_0xd138('0x52')]==='twilio'){return _0x4c64ce[_0xd138('0x2a')](_0x3f1157)['set'](_0xd138('0xb0'),'text/xml')[_0xd138('0xb1')]('\x0a');}else{return _0x4c64ce[_0xd138('0x2a')](_0x3f1157)['json'](_0x53969f);}}})['catch'](handleError(_0x4c64ce,null));};exports[_0xd138('0xb2')]=function(_0x1ffad8,_0xc20f9a,_0xb09410){return db[_0xd138('0x3e')]['findOne']({'where':{'id':_0x1ffad8[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0xc20f9a,null))[_0xd138('0x37')](function(_0x343ca1){if(_0x343ca1){return db[_0xd138('0xb3')][_0xd138('0xb4')](function(_0x363e3b){return db[_0xd138('0xb5')][_0xd138('0x35')]({'where':{'SmsAccountId':_0x1ffad8[_0xd138('0x59')]['id']},'transaction':_0x363e3b})[_0xd138('0x37')](function(_0x210045){var _0x15e53a=_[_0xd138('0x51')](_0x1ffad8['body'],function(_0x2c7640){_0x2c7640['SmsAccountId']=_0x1ffad8[_0xd138('0x59')]['id'];return _0x2c7640;});return db[_0xd138('0xb5')][_0xd138('0xb6')](_0x15e53a,{'transaction':_0x363e3b});});})['then'](function(){return db[_0xd138('0xb5')][_0xd138('0xb7')]({'where':{'SmsAccountId':_0x1ffad8[_0xd138('0x59')]['id']},'order':_0xd138('0x76')});});}})[_0xd138('0x37')](respondWithResult(_0xc20f9a,null))[_0xd138('0x29')](handleError(_0xc20f9a,null));};exports[_0xd138('0xb8')]=function(_0x2216d5,_0x2293a0,_0xc15dfa){var _0x3b6bff={};var _0x4c3034={};var _0x4e90d9;var _0x937162;return db[_0xd138('0x3e')]['findOne']({'where':{'id':_0x2216d5[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x2293a0,null))[_0xd138('0x37')](function(_0x548c37){if(_0x548c37){_0x4e90d9=_0x548c37;_0x4c3034[_0xd138('0x42')]=_[_0xd138('0x43')](db[_0xd138('0xb5')][_0xd138('0x3f')]);_0x4c3034[_0xd138('0x44')]=_[_0xd138('0x43')](_0x2216d5[_0xd138('0x44')]);_0x4c3034[_0xd138('0x45')]=_['intersection'](_0x4c3034['model'],_0x4c3034['query']);_0x3b6bff[_0xd138('0x47')]=_[_0xd138('0x46')](_0x4c3034[_0xd138('0x42')],qs['fields'](_0x2216d5['query']['fields']));_0x3b6bff[_0xd138('0x47')]=_0x3b6bff[_0xd138('0x47')][_0xd138('0x49')]?_0x3b6bff[_0xd138('0x47')]:_0x4c3034['model'];_0x3b6bff[_0xd138('0x4c')]=qs['sort'](_0x2216d5[_0xd138('0x44')][_0xd138('0x4d')]);_0x3b6bff['where']=qs['filters'](_[_0xd138('0x6e')](_0x2216d5[_0xd138('0x44')],_0x4c3034[_0xd138('0x45')]));if(_0x2216d5['query']['filter']){_0x3b6bff[_0xd138('0x50')]=_[_0xd138('0x4f')](_0x3b6bff['where'],{'$or':_[_0xd138('0x51')](_0x3b6bff[_0xd138('0x47')],function(_0x1faed8){var _0x2ad511={};_0x2ad511[_0x1faed8]={'$like':'%'+_0x2216d5[_0xd138('0x44')][_0xd138('0x4e')]+'%'};return _0x2ad511;})});}_0x3b6bff=_[_0xd138('0x4f')]({},_0x3b6bff,_0x2216d5[_0xd138('0x54')]);return _0x4e90d9['getApplications'](_0x3b6bff);}})[_0xd138('0x37')](function(_0x4c9118){if(_0x4c9118){_0x937162=_0x4c9118[_0xd138('0x49')];if(!_0x2216d5[_0xd138('0x44')][_0xd138('0x4a')](_0xd138('0x4b'))){_0x3b6bff[_0xd138('0x2f')]=qs['limit'](_0x2216d5[_0xd138('0x44')]['limit']);_0x3b6bff[_0xd138('0x2e')]=qs[_0xd138('0x2e')](_0x2216d5[_0xd138('0x44')]['offset']);}return _0x4e90d9['getApplications'](_0x3b6bff);}})[_0xd138('0x37')](function(_0x50f622){if(_0x50f622){return _0x50f622?{'count':_0x937162,'rows':_0x50f622}:null;}})['then'](respondWithResult(_0x2293a0,null))['catch'](handleError(_0x2293a0,null));};exports[_0xd138('0xb9')]=function(_0x34a561,_0x3b5c9a,_0x164454){var _0x24f5ae={'raw':![],'where':{}};var _0x34ab70={};var _0x1bb2bc={'count':0x0,'rows':[]};return db[_0xd138('0x3e')][_0xd138('0x69')]({'where':{'id':_0x34a561[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x3b5c9a,null))['then'](function(_0x8c4c32){if(_0x8c4c32){_0x34ab70[_0xd138('0x42')]=_[_0xd138('0x43')](db[_0xd138('0xba')][_0xd138('0x3f')]);_0x34ab70[_0xd138('0x44')]=_['keys'](_0x34a561['query']);_0x34ab70[_0xd138('0x45')]=_[_0xd138('0x46')](_0x34ab70[_0xd138('0x42')],_0x34ab70['query']);_0x24f5ae[_0xd138('0x47')]=_[_0xd138('0x46')](_0x34ab70[_0xd138('0x42')],qs[_0xd138('0x48')](_0x34a561[_0xd138('0x44')]['fields']));_0x24f5ae[_0xd138('0x47')]=_0x24f5ae['attributes'][_0xd138('0x49')]?_0x24f5ae[_0xd138('0x47')]:_0x34ab70[_0xd138('0x42')];if(!_0x34a561['query'][_0xd138('0x4a')]('nolimit')){_0x24f5ae[_0xd138('0x2f')]=qs[_0xd138('0x2f')](_0x34a561['query'][_0xd138('0x2f')]);_0x24f5ae['offset']=qs['offset'](_0x34a561['query'][_0xd138('0x2e')]);}_0x24f5ae['order']=qs['sort'](_0x34a561[_0xd138('0x44')]['sort']);_0x24f5ae[_0xd138('0x50')]=qs[_0xd138('0x45')](_[_0xd138('0x6e')](_0x34a561['query'],_0x34ab70[_0xd138('0x45')]));_0x24f5ae['where'][_0xd138('0x66')]=_0x8c4c32['id'];if(_0x34a561['query'][_0xd138('0x4e')]){_0x24f5ae['where']=_[_0xd138('0x4f')](_0x24f5ae[_0xd138('0x50')],{'$or':_['map'](_0x24f5ae['attributes'],function(_0x4324e0){var _0x510f1b={};_0x510f1b[_0x4324e0]={'$like':'%'+_0x34a561['query']['filter']+'%'};return _0x510f1b;})});}_0x24f5ae=_[_0xd138('0x4f')]({},_0x24f5ae,_0x34a561['options']);return db[_0xd138('0xba')][_0xd138('0x2d')]({'where':_0x24f5ae[_0xd138('0x50')]})['then'](function(_0x3faa75){_0x1bb2bc[_0xd138('0x2d')]=_0x3faa75;if(_0x34a561[_0xd138('0x44')][_0xd138('0x55')]){_0x24f5ae[_0xd138('0x56')]=[{'model':db[_0xd138('0x78')],'as':_0xd138('0xbb'),'required':![]},{'model':db[_0xd138('0xa7')],'as':_0xd138('0xbc'),'attributes':[_0xd138('0x3a'),_0xd138('0xbd'),_0xd138('0xbe')],'required':![]},{'model':db[_0xd138('0xbf')],'as':_0xd138('0xc0'),'attributes':['id',_0xd138('0x3a'),_0xd138('0xc1')],'where':_0x34a561[_0xd138('0x44')]['tag']?{'id':_0x34a561[_0xd138('0x44')][_0xd138('0xc2')]}:undefined,'required':_0x34a561[_0xd138('0x44')][_0xd138('0xc2')]?!![]:![]}];}return db[_0xd138('0xba')]['findAll'](_0x24f5ae);})[_0xd138('0x37')](function(_0x2a6784){_0x1bb2bc[_0xd138('0xc3')]=_0x2a6784;return _0x1bb2bc;});}})['then'](respondWithFilteredResult(_0x3b5c9a,_0x24f5ae))[_0xd138('0x29')](handleError(_0x3b5c9a,null));};exports['send']=function(_0x2baa39,_0x3387e1,_0x11ecc8){var _0x5e5cfa,_0x3140b4,_0x1987f6;if(_[_0xd138('0x92')](_0x2baa39[_0xd138('0x5b')][_0xd138('0x5b')])||_0x2baa39['body'][_0xd138('0x5b')]===''){throw new db[(_0xd138('0x79'))][(_0xd138('0x7a'))](_0xd138('0x94'));}if(_[_0xd138('0x92')](_0x2baa39[_0xd138('0x5b')]['to'])){throw new db[(_0xd138('0x79'))][(_0xd138('0x7a'))](_0xd138('0xc4'));}_0x5e5cfa=_0x2baa39[_0xd138('0x5b')]['to'];return db[_0xd138('0x3e')][_0xd138('0x60')]({'where':{'id':_0x2baa39[_0xd138('0x59')]['id']},'include':[{'model':db[_0xd138('0x98')],'as':_0xd138('0xc5'),'include':[{'model':db['CmContact'],'as':_0xd138('0x9a'),'where':{'mobile':_0x5e5cfa},'limit':0x1,'order':[[_0xd138('0x7c'),_0xd138('0xc6')]]}]}]})[_0xd138('0x37')](handleEntityNotFound(_0x3387e1,null))[_0xd138('0x37')](function(_0x46ad8b){if(_0x46ad8b&&_0x46ad8b[_0xd138('0xc5')]){_0x3140b4=_0x46ad8b['get']({'plain':!![]});if(_0x3140b4[_0xd138('0xc5')]&&_0x3140b4['List']['Contacts'][_0xd138('0x49')]){return _0x3140b4['List'][_0xd138('0x9a')][0x0];}return db['CmContact']['create'](_[_0xd138('0x17')](_0x2baa39[_0xd138('0x5b')],{'firstName':_0x5e5cfa,'mobile':_0x5e5cfa,'phone':_0x5e5cfa,'ListId':_0x3140b4[_0xd138('0x99')]}));}})['then'](handleEntityNotFound(_0x3387e1,null))[_0xd138('0x37')](function(_0xc7f21a){if(_0xc7f21a){_0x1987f6=_0xc7f21a;return db['SmsInteraction'][_0xd138('0x60')]({'where':{'ContactId':_0x1987f6['id'],'closed':![],'SmsAccountId':_0x3140b4['id']}})[_0xd138('0x37')](function(_0x515bda){if(_0x515bda){return[_0x515bda,![]];}return db[_0xd138('0xba')][_0xd138('0x5a')]({'UserId':_0x2baa39[_0xd138('0x5c')]['id'],'ContactId':_0x1987f6['id'],'SmsAccountId':_0x3140b4['id'],'phone':_0x5e5cfa,'firstMsgDirection':'out','Messages':[_[_0xd138('0x4f')](_0x2baa39[_0xd138('0x5b')],{'read':![],'body':_0x2baa39[_0xd138('0x5b')][_0xd138('0x5b')],'phone':_0x5e5cfa,'SmsAccountId':_0x3140b4['id'],'UserId':_0x2baa39['user']['id'],'ContactId':_0x1987f6['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xd138('0xc7')}]})['then'](function(_0x3bded0){return[_0x3bded0,!![]];});});}})[_0xd138('0x9e')](function(_0x5230f8,_0x893f10){if(_0x893f10){return _0x5230f8;}return db[_0xd138('0xc8')][_0xd138('0x5a')](_['merge'](_0x2baa39[_0xd138('0x5b')],{'read':![],'body':_0x2baa39['body'][_0xd138('0x5b')],'phone':_0x5e5cfa,'SmsAccountId':_0x3140b4['id'],'SmsInteractionId':_0x5230f8['id'],'UserId':_0x2baa39[_0xd138('0x5c')]['id'],'ContactId':_0x1987f6['id']}))[_0xd138('0x37')](function(_0x41fb00){_0x5230f8['dataValues'][_0xd138('0xc7')]=[];_0x5230f8[_0xd138('0xc9')]['Messages'][_0xd138('0xa2')](_0x41fb00[_0xd138('0xc9')]);return _0x5230f8;});})[_0xd138('0x37')](respondWithResult(_0x3387e1,null))['catch'](handleError(_0x3387e1,null));};exports[_0xd138('0x2a')]=function(_0x2d7c8f,_0x5f0f50,_0x4ef786){if(_0x2d7c8f[_0xd138('0x5b')]['id']){delete _0x2d7c8f[_0xd138('0x5b')]['id'];}var _0x445e82,_0x508284,_0x2a6fc1;return db[_0xd138('0x3e')][_0xd138('0x60')]({'where':{'id':_0x2d7c8f['params']['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x5f0f50,null))[_0xd138('0x37')](function(_0x5d53bb){if(_0x5d53bb){_0x2a6fc1=_0x5d53bb;logger[_0xd138('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd138('0x2a'),_0xd138('0xca'),_0x5d53bb[_0xd138('0x52')],util[_0xd138('0xcb')](_0x2d7c8f[_0xd138('0x5b')],{'showHidden':![],'depth':null}));switch(_0x5d53bb[_0xd138('0x52')]){case _0xd138('0xcc'):if(_0x2d7c8f[_0xd138('0x5b')][_0xd138('0xcd')]&&_0x2d7c8f[_0xd138('0x5b')][_0xd138('0x2a')]){_0x508284=_0x2d7c8f[_0xd138('0x5b')][_0xd138('0x2a')];return db['SmsMessage'][_0xd138('0x60')]({'where':{'messageId':_0x2d7c8f[_0xd138('0x5b')][_0xd138('0xcd')]}});}break;case _0xd138('0xce'):if(_0x2d7c8f[_0xd138('0x5b')][_0xd138('0xcf')]&&_0x2d7c8f[_0xd138('0x5b')][_0xd138('0xd0')]){_0x508284=_0x2d7c8f[_0xd138('0x5b')][_0xd138('0xd0')];return db[_0xd138('0xc8')][_0xd138('0x60')]({'where':{'messageId':_0x2d7c8f[_0xd138('0x5b')][_0xd138('0xcf')]}});}break;case _0xd138('0x85'):if(_0x2d7c8f[_0xd138('0x5b')][_0xd138('0x86')]&&_0x2d7c8f[_0xd138('0x5b')][_0xd138('0xd1')]){_0x508284=_0x2d7c8f['body'][_0xd138('0xd1')];return db['SmsMessage'][_0xd138('0x60')]({'where':{'messageId':_0x2d7c8f['body'][_0xd138('0x86')]}});}break;case'infobip':var _0x1438bf=_0x2d7c8f[_0xd138('0x5b')][_0xd138('0x8b')][0x0];if(_0x1438bf[_0xd138('0x83')]&&_0x1438bf[_0xd138('0x2a')][_0xd138('0xd2')]===_0xd138('0xd3')){_0x508284=_0x1438bf[_0xd138('0x2a')][_0xd138('0xd2')];return db[_0xd138('0xc8')][_0xd138('0x60')]({'where':{'messageId':_0x1438bf[_0xd138('0x83')]}});}break;case _0xd138('0x8f'):if(_0x2d7c8f[_0xd138('0x5b')]['messageId']&&_0x2d7c8f[_0xd138('0x5b')]['status']){_0x508284=_0x2d7c8f[_0xd138('0x5b')][_0xd138('0x2a')];return db[_0xd138('0xc8')][_0xd138('0x60')]({'where':{'messageId':_0x2d7c8f[_0xd138('0x5b')][_0xd138('0x83')]}});}break;case _0xd138('0xd4'):if(_0x2d7c8f[_0xd138('0x5b')][0x0]['message']['id']){_0x508284=_0x2d7c8f['body'][0x0][_0xd138('0x52')];return db['SmsMessage'][_0xd138('0x60')]({'where':{'messageId':_0x2d7c8f[_0xd138('0x5b')][0x0][_0xd138('0x26')]['id']}});}break;case'intelepeer':if(_0x2d7c8f[_0xd138('0x5b')]['redif']&&_0x2d7c8f[_0xd138('0x5b')]['status']){_0x508284=_0x2d7c8f[_0xd138('0x5b')][_0xd138('0x2a')];return db[_0xd138('0xc8')][_0xd138('0x60')]({'where':{'messageId':_0x2d7c8f[_0xd138('0x5b')]['redif']}});}break;}}})[_0xd138('0x37')](handleEntityNotFound(_0x5f0f50,null))[_0xd138('0x37')](function(_0x720b51){if(_0x720b51){_0x445e82=_0x720b51;switch(_0x2a6fc1[_0xd138('0x52')]){case _0xd138('0xcc'):if(_0x508284===_0xd138('0xd3')){return _0x445e82[_0xd138('0x34')]({'read':!![]});}else{logger[_0xd138('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xd138('0xcc'),util[_0xd138('0xcb')](_0x2d7c8f['body'],{'showHidden':![],'depth':null}));}break;case _0xd138('0xce'):if(_0x508284==='1'){return _0x445e82[_0xd138('0x34')]({'read':!![]});}else{logger['error'](_0xd138('0x22'),_0xd138('0x2a'),_0xd138('0xcc'),util[_0xd138('0xcb')](_0x2d7c8f[_0xd138('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd138('0x85'):if(!_0x2d7c8f[_0xd138('0x5b')]['error_code']&&_0x508284>=0xc8&&_0x508284<=0xce){return _0x445e82[_0xd138('0x34')]({'read':!![]});}else{logger[_0xd138('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd138('0x2a'),_0xd138('0x85'),util[_0xd138('0xcb')](_0x2d7c8f[_0xd138('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd138('0x8a'):var _0x1189d3=_0x2d7c8f[_0xd138('0x5b')][_0xd138('0x8b')][0x0];if(_0x1189d3[_0xd138('0x2a')]['groupName']===_0xd138('0xd3')){return _0x445e82[_0xd138('0x34')]({'read':!![]});}else{logger[_0xd138('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd138('0x2a'),'infobip',util[_0xd138('0xcb')](_0x2d7c8f[_0xd138('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd138('0x8f'):if(_0x508284==_0xd138('0xd5')||_0x508284==_0xd138('0xd6')){return _0x445e82[_0xd138('0x34')]({'read':!![]});}else{logger[_0xd138('0x25')](_0xd138('0x22'),_0xd138('0x2a'),_0xd138('0x8f'),util[_0xd138('0xcb')](_0x2d7c8f[_0xd138('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd138('0xd4'):if(_0x508284==_0xd138('0xd7')){return _0x445e82['update']({'read':!![]});}else{logger[_0xd138('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xd138('0xd4'),util[_0xd138('0xcb')](_0x2d7c8f[_0xd138('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd138('0x91'):if(_0x508284==='DELIVRD'||_0x508284===_0xd138('0xd8')){return _0x445e82[_0xd138('0x34')]({'read':!![]});}else{logger['error'](_0xd138('0x22'),_0xd138('0x2a'),_0xd138('0x91'),util[_0xd138('0xcb')](_0x2d7c8f[_0xd138('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x445e82;}})['then'](respondWithResult(_0x5f0f50,null))['catch'](handleError(_0x5f0f50,null));};exports['statusGet']=function(_0x4dba98,_0x53a57e,_0xbb716d){var _0x3b85eb,_0x193eab,_0x5d7e87;return db['SmsAccount'][_0xd138('0x60')]({'where':{'id':_0x4dba98[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x53a57e,null))['then'](function(_0x16e4ab){if(_0x16e4ab){_0x5d7e87=_0x16e4ab;logger[_0xd138('0x21')](_0xd138('0x22'),_0xd138('0x2a'),'received\x20delivery\x20report\x20from',_0x16e4ab[_0xd138('0x52')],util['inspect'](_0x4dba98[_0xd138('0x44')],{'showHidden':![],'depth':null}));switch(_0x16e4ab[_0xd138('0x52')]){case _0xd138('0x8c'):if(_0x4dba98[_0xd138('0x44')]['message-id']&&_0x4dba98[_0xd138('0x44')]['state']){_0x193eab=_0x4dba98[_0xd138('0x44')][_0xd138('0xd9')];return db[_0xd138('0xc8')][_0xd138('0x60')]({'where':{'messageId':_0x4dba98[_0xd138('0x44')][_0xd138('0xda')]}});}break;}}})[_0xd138('0x37')](handleEntityNotFound(_0x53a57e,null))['then'](function(_0x5e8e3f){if(_0x5e8e3f){_0x3b85eb=_0x5e8e3f;switch(_0x5d7e87['type']){case _0xd138('0x8c'):if(_0x193eab==='2'||_0x193eab==='6'){return _0x3b85eb['update']({'read':!![]});}else{logger[_0xd138('0x25')](_0xd138('0x22'),'status',_0xd138('0x8c'),util[_0xd138('0xcb')](_0x4dba98[_0xd138('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x3b85eb;}})[_0xd138('0x37')](respondWithResult(_0x53a57e,null))[_0xd138('0x29')](handleError(_0x53a57e,null));};exports[_0xd138('0xdb')]=function(_0x416076,_0x32322e,_0x5478df){return db[_0xd138('0x3e')]['find']({'where':{'id':_0x416076[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x32322e,null))[_0xd138('0x37')](function(_0x120f60){if(_0x120f60){return _0x120f60['addAgents'](_0x416076[_0xd138('0x5b')]['ids'],_[_0xd138('0x9c')](_0x416076[_0xd138('0x5b')],[_0xd138('0x6b'),'id'])||{})[_0xd138('0x9e')](function(_0x1fc0ed){for(var _0x596aeb=0x0;_0x596aeb<_0x416076[_0xd138('0x5b')]['ids'][_0xd138('0x49')];_0x596aeb+=0x1){socket[_0xd138('0xdc')](_0xd138('0xdd'),{'UserId':_0x416076[_0xd138('0x5b')]['ids'][_0x596aeb],'SmsAccountId':_0x416076['params']['id']});}return _0x1fc0ed;});}})[_0xd138('0x37')](respondWithResult(_0x32322e,null))['catch'](handleError(_0x32322e,null));};exports[_0xd138('0xde')]=function(_0x188917,_0x4bf19f,_0x3047bb){return db[_0xd138('0x3e')][_0xd138('0x60')]({'where':{'id':_0x188917[_0xd138('0x59')]['id']}})['then'](handleEntityNotFound(_0x4bf19f,null))[_0xd138('0x37')](function(_0x22ed64){if(_0x22ed64){return _0x22ed64[_0xd138('0xde')](_0x188917[_0xd138('0x44')][_0xd138('0x6b')])['then'](function(){if(_['isArray'](_0x188917[_0xd138('0x44')][_0xd138('0x6b')])){for(var _0x1973b0=0x0;_0x1973b0<_0x188917[_0xd138('0x44')][_0xd138('0x6b')]['length'];_0x1973b0+=0x1){socket[_0xd138('0xdc')]('userSmsAccount:remove',{'UserId':Number(_0x188917[_0xd138('0x44')]['ids'][_0x1973b0]),'SmsAccountId':Number(_0x188917[_0xd138('0x59')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x188917[_0xd138('0x44')]['ids']),'SmsAccountId':Number(_0x188917[_0xd138('0x59')]['id'])});}});}})[_0xd138('0x37')](respondWithStatusCode(_0x4bf19f,null))[_0xd138('0x29')](handleError(_0x4bf19f,null));};exports['getAgents']=function(_0x221a25,_0x3249e3,_0x5ff852){var _0x591746={};var _0x5ae12d={};var _0x10d675;var _0x4d409d;return db[_0xd138('0x3e')][_0xd138('0x69')]({'where':{'id':_0x221a25[_0xd138('0x59')]['id']}})[_0xd138('0x37')](handleEntityNotFound(_0x3249e3,null))[_0xd138('0x37')](function(_0x2beb64){if(_0x2beb64){_0x10d675=_0x2beb64;_0x5ae12d[_0xd138('0x42')]=_[_0xd138('0x43')](db[_0xd138('0xa7')]['rawAttributes']);_0x5ae12d[_0xd138('0x44')]=_[_0xd138('0x43')](_0x221a25[_0xd138('0x44')]);_0x5ae12d[_0xd138('0x45')]=_[_0xd138('0x46')](_0x5ae12d[_0xd138('0x42')],_0x5ae12d[_0xd138('0x44')]);_0x591746[_0xd138('0x47')]=_[_0xd138('0x46')](_0x5ae12d[_0xd138('0x42')],qs[_0xd138('0x48')](_0x221a25['query'][_0xd138('0x48')]));_0x591746[_0xd138('0x47')]=_0x591746['attributes'][_0xd138('0x49')]?_0x591746['attributes']:_0x5ae12d[_0xd138('0x42')];_0x591746[_0xd138('0x4c')]=qs['sort'](_0x221a25[_0xd138('0x44')][_0xd138('0x4d')]);_0x591746['where']=qs[_0xd138('0x45')](_[_0xd138('0x6e')](_0x221a25[_0xd138('0x44')],_0x5ae12d[_0xd138('0x45')]));if(_0x221a25['query'][_0xd138('0x4e')]){_0x591746['where']=_[_0xd138('0x4f')](_0x591746[_0xd138('0x50')],{'$or':_[_0xd138('0x51')](_0x591746[_0xd138('0x47')],function(_0x4362d5){var _0x4e4473={};_0x4e4473[_0x4362d5]={'$like':'%'+_0x221a25[_0xd138('0x44')][_0xd138('0x4e')]+'%'};return _0x4e4473;})});}_0x591746=_['merge']({},_0x591746,_0x221a25[_0xd138('0x54')]);return _0x10d675[_0xd138('0xdf')](_0x591746);}})['then'](function(_0x39e3aa){if(_0x39e3aa){_0x4d409d=_0x39e3aa[_0xd138('0x49')];if(!_0x221a25[_0xd138('0x44')][_0xd138('0x4a')](_0xd138('0x4b'))){_0x591746[_0xd138('0x2f')]=qs[_0xd138('0x2f')](_0x221a25[_0xd138('0x44')][_0xd138('0x2f')]);_0x591746['offset']=qs['offset'](_0x221a25[_0xd138('0x44')]['offset']);}return _0x10d675[_0xd138('0xdf')](_0x591746);}})[_0xd138('0x37')](function(_0x1ef17f){if(_0x1ef17f){return _0x1ef17f?{'count':_0x4d409d,'rows':_0x1ef17f}:null;}})[_0xd138('0x37')](respondWithResult(_0x3249e3,null))[_0xd138('0x29')](handleError(_0x3249e3,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index c1199c8..7ea6698 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 _0x91d2=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','save'];(function(_0x50e163,_0x21040a){var _0x58592d=function(_0x11043c){while(--_0x11043c){_0x50e163['push'](_0x50e163['shift']());}};_0x58592d(++_0x21040a);}(_0x91d2,0x188));var _0x291d=function(_0x2178c3,_0x45bdad){_0x2178c3=_0x2178c3-0x0;var _0x406cd3=_0x91d2[_0x2178c3];return _0x406cd3;};'use strict';var EventEmitter=require(_0x291d('0x0'));var SmsAccount=require(_0x291d('0x1'))['db'][_0x291d('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x291d('0x3'),'afterUpdate':_0x291d('0x4'),'afterDestroy':'remove'};function emitEvent(_0xaac7f7){return function(_0x531907,_0xc2febe,_0x41179c){SmsAccountEvents[_0x291d('0x5')](_0xaac7f7+':'+_0x531907['id'],_0x531907);SmsAccountEvents['emit'](_0xaac7f7,_0x531907);_0x41179c(null);};}for(var e in events){if(events[_0x291d('0x6')](e)){var event=events[e];SmsAccount[_0x291d('0x7')](e,emitEvent(event));}}module[_0x291d('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x0c17=['exports','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3153ef,_0x583952){var _0x43c421=function(_0x29cc4f){while(--_0x29cc4f){_0x3153ef['push'](_0x3153ef['shift']());}};_0x43c421(++_0x583952);}(_0x0c17,0xe1));var _0x70c1=function(_0x1159d3,_0x51f60d){_0x1159d3=_0x1159d3-0x0;var _0x26d2ae=_0x0c17[_0x1159d3];return _0x26d2ae;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x70c1('0x0')](0x0);var events={'afterCreate':_0x70c1('0x1'),'afterUpdate':_0x70c1('0x2'),'afterDestroy':_0x70c1('0x3')};function emitEvent(_0x497708){return function(_0x4b3d91,_0x90248b,_0x24559a){SmsAccountEvents[_0x70c1('0x4')](_0x497708+':'+_0x4b3d91['id'],_0x4b3d91);SmsAccountEvents[_0x70c1('0x4')](_0x497708,_0x4b3d91);_0x24559a(null);};}for(var e in events){if(events[_0x70c1('0x5')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x70c1('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 5e50c01..b49f0c4 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 _0x2172=['path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','lodash','util','moment','bluebird','request-promise'];(function(_0x4352e2,_0x550bb3){var _0x59af28=function(_0x49bc4f){while(--_0x49bc4f){_0x4352e2['push'](_0x4352e2['shift']());}};_0x59af28(++_0x550bb3);}(_0x2172,0xd7));var _0x2217=function(_0x2950ed,_0x4d8ffb){_0x2950ed=_0x2950ed-0x0;var _0xd30178=_0x2172[_0x2950ed];return _0xd30178;};'use strict';var _=require(_0x2217('0x0'));var util=require(_0x2217('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2217('0x2'));var BPromise=require(_0x2217('0x3'));var rp=require(_0x2217('0x4'));var fs=require('fs');var path=require(_0x2217('0x5'));var rimraf=require(_0x2217('0x6'));var config=require(_0x2217('0x7'));var attributes=require(_0x2217('0x8'));module[_0x2217('0x9')]=function(_0x4eb455,_0x6cf9a9){return _0x4eb455[_0x2217('0xa')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe833=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','../../config/logger','api'];(function(_0x564a30,_0x5cd902){var _0xa0e034=function(_0x1b7fbb){while(--_0x1b7fbb){_0x564a30['push'](_0x564a30['shift']());}};_0xa0e034(++_0x5cd902);}(_0xe833,0xf9));var _0x3e83=function(_0x132e7b,_0x117ea1){_0x132e7b=_0x132e7b-0x0;var _0x47c67a=_0xe833[_0x132e7b];return _0x47c67a;};'use strict';var _=require(_0x3e83('0x0'));var util=require('util');var logger=require(_0x3e83('0x1'))(_0x3e83('0x2'));var moment=require(_0x3e83('0x3'));var BPromise=require(_0x3e83('0x4'));var rp=require(_0x3e83('0x5'));var fs=require('fs');var path=require(_0x3e83('0x6'));var rimraf=require(_0x3e83('0x7'));var config=require(_0x3e83('0x8'));var attributes=require(_0x3e83('0x9'));module[_0x3e83('0xa')]=function(_0x5e9fd8,_0x3f8e7b){return _0x5e9fd8[_0x3e83('0xb')](_0x3e83('0xc'),attributes,{'tableName':_0x3e83('0xd'),'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 2813c7f..ec1c41b 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 _0x3b50=['http','redis','defaults','localhost','socket.io-emitter','register','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','include','map','model','attributes','then','debug','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise'];(function(_0x1dd532,_0x36e81c){var _0x3732aa=function(_0x19d50a){while(--_0x19d50a){_0x1dd532['push'](_0x1dd532['shift']());}};_0x3732aa(++_0x36e81c);}(_0x3b50,0xc0));var _0x03b5=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x3b50[_0x1d1d09];return _0x8827e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x03b5('0x0'));var BPromise=require(_0x03b5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x03b5('0x2'));var db=require(_0x03b5('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x03b5('0x4'));var jayson=require(_0x03b5('0x5'));var client=jayson['client'][_0x03b5('0x6')]({'port':0x232a});config[_0x03b5('0x7')]=_[_0x03b5('0x8')](config[_0x03b5('0x7')],{'host':_0x03b5('0x9'),'port':0x18eb});var socket=require(_0x03b5('0xa'))(new Redis(config[_0x03b5('0x7')]));require('./smsAccount.socket')[_0x03b5('0xb')](socket);function respondWithRpcPromise(_0x2748a8,_0x518ba5,_0x5296b4){return new BPromise(function(_0x985e39,_0x1709bb){return client['request'](_0x2748a8,_0x5296b4)['then'](function(_0x4e12b1){logger['info'](_0x03b5('0xc'),_0x518ba5,_0x03b5('0xd'));logger['debug'](_0x03b5('0xe'),_0x518ba5,_0x03b5('0xd'),JSON[_0x03b5('0xf')](_0x4e12b1));if(_0x4e12b1[_0x03b5('0x10')]){if(_0x4e12b1[_0x03b5('0x10')][_0x03b5('0x11')]===0x1f4){logger[_0x03b5('0x10')](_0x03b5('0xc'),_0x518ba5,_0x4e12b1[_0x03b5('0x10')][_0x03b5('0x12')]);return _0x1709bb(_0x4e12b1[_0x03b5('0x10')]['message']);}logger['error'](_0x03b5('0xc'),_0x518ba5,_0x4e12b1[_0x03b5('0x10')]['message']);return _0x985e39(_0x4e12b1[_0x03b5('0x10')][_0x03b5('0x12')]);}else{logger[_0x03b5('0x13')](_0x03b5('0xc'),_0x518ba5,_0x03b5('0xd'));_0x985e39(_0x4e12b1['result'][_0x03b5('0x12')]);}})[_0x03b5('0x14')](function(_0x4155b8){logger[_0x03b5('0x10')](_0x03b5('0xc'),_0x518ba5,_0x4155b8);_0x1709bb(_0x4155b8);});});}exports[_0x03b5('0x15')]=function(_0x158620){var _0x250286=this;return new Promise(function(_0x4cfa33,_0x202ba5){return db[_0x03b5('0x16')][_0x03b5('0x17')]({'raw':_0x158620[_0x03b5('0x18')]?_0x158620[_0x03b5('0x18')][_0x03b5('0x19')]===undefined?!![]:![]:!![],'where':_0x158620[_0x03b5('0x18')]?_0x158620[_0x03b5('0x18')][_0x03b5('0x1a')]||null:null,'attributes':_0x158620['options']?_0x158620[_0x03b5('0x18')]['attributes']||null:null,'include':_0x158620[_0x03b5('0x18')]?_0x158620[_0x03b5('0x18')][_0x03b5('0x1b')]?_[_0x03b5('0x1c')](_0x158620['options'][_0x03b5('0x1b')],function(_0x655ad9){return{'model':db[_0x655ad9[_0x03b5('0x1d')]],'as':_0x655ad9['as'],'attributes':_0x655ad9[_0x03b5('0x1e')],'include':_0x655ad9[_0x03b5('0x1b')]?_[_0x03b5('0x1c')](_0x655ad9[_0x03b5('0x1b')],function(_0x19d93a){return{'model':db[_0x19d93a[_0x03b5('0x1d')]],'as':_0x19d93a['as'],'attributes':_0x19d93a['attributes'],'include':_0x19d93a[_0x03b5('0x1b')]?_[_0x03b5('0x1c')](_0x19d93a[_0x03b5('0x1b')],function(_0x44800){return{'model':db[_0x44800[_0x03b5('0x1d')]],'as':_0x44800['as'],'attributes':_0x44800['attributes']};}):[]};}):[]};}):[]:[]})[_0x03b5('0x1f')](function(_0x5ca74d){logger[_0x03b5('0x13')]('ShowSmsAccount',_0x158620);logger[_0x03b5('0x20')](_0x03b5('0x15'),_0x158620,JSON['stringify'](_0x5ca74d));_0x4cfa33(_0x5ca74d);})['catch'](function(_0x3145f7){logger[_0x03b5('0x10')]('ShowSmsAccount',_0x3145f7['message'],_0x158620);_0x202ba5(_0x250286[_0x03b5('0x10')](0x1f4,_0x3145f7[_0x03b5('0x12')]));});});}; \ No newline at end of file +var _0xbf68=['../../config/environment','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','SmsAccount','find','options','raw','where','attributes','map','model','include','ShowSmsAccount','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x38a10f,_0x56ef14){var _0x1c03d3=function(_0x30cc61){while(--_0x30cc61){_0x38a10f['push'](_0x38a10f['shift']());}};_0x1c03d3(++_0x56ef14);}(_0xbf68,0x6d));var _0x8bf6=function(_0x4faa5c,_0x4198ee){_0x4faa5c=_0x4faa5c-0x0;var _0x1f0339=_0xbf68[_0x4faa5c];return _0x1f0339;};'use strict';var _=require(_0x8bf6('0x0'));var util=require(_0x8bf6('0x1'));var moment=require(_0x8bf6('0x2'));var BPromise=require(_0x8bf6('0x3'));var rs=require(_0x8bf6('0x4'));var fs=require('fs');var Redis=require(_0x8bf6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8bf6('0x6'));var logger=require(_0x8bf6('0x7'))('rpc');var config=require(_0x8bf6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8bf6('0x9')][_0x8bf6('0xa')]({'port':0x232a});config[_0x8bf6('0xb')]=_['defaults'](config[_0x8bf6('0xb')],{'host':_0x8bf6('0xc'),'port':0x18eb});var socket=require(_0x8bf6('0xd'))(new Redis(config[_0x8bf6('0xb')]));require(_0x8bf6('0xe'))[_0x8bf6('0xf')](socket);function respondWithRpcPromise(_0x255ebd,_0x2ab04a,_0x555996){return new BPromise(function(_0x105f14,_0x77d683){return client[_0x8bf6('0x10')](_0x255ebd,_0x555996)[_0x8bf6('0x11')](function(_0x310301){logger[_0x8bf6('0x12')](_0x8bf6('0x13'),_0x2ab04a,'request\x20sent');logger[_0x8bf6('0x14')](_0x8bf6('0x15'),_0x2ab04a,_0x8bf6('0x16'),JSON['stringify'](_0x310301));if(_0x310301[_0x8bf6('0x17')]){if(_0x310301[_0x8bf6('0x17')][_0x8bf6('0x18')]===0x1f4){logger[_0x8bf6('0x17')]('SmsAccount,\x20%s,\x20%s',_0x2ab04a,_0x310301[_0x8bf6('0x17')][_0x8bf6('0x19')]);return _0x77d683(_0x310301[_0x8bf6('0x17')][_0x8bf6('0x19')]);}logger[_0x8bf6('0x17')](_0x8bf6('0x13'),_0x2ab04a,_0x310301[_0x8bf6('0x17')][_0x8bf6('0x19')]);return _0x105f14(_0x310301[_0x8bf6('0x17')][_0x8bf6('0x19')]);}else{logger[_0x8bf6('0x12')](_0x8bf6('0x13'),_0x2ab04a,'request\x20sent');_0x105f14(_0x310301[_0x8bf6('0x1a')][_0x8bf6('0x19')]);}})[_0x8bf6('0x1b')](function(_0x22dca3){logger['error'](_0x8bf6('0x13'),_0x2ab04a,_0x22dca3);_0x77d683(_0x22dca3);});});}exports['ShowSmsAccount']=function(_0x23b8de){var _0x157917=this;return new Promise(function(_0x1245fa,_0x294393){return db[_0x8bf6('0x1c')][_0x8bf6('0x1d')]({'raw':_0x23b8de['options']?_0x23b8de[_0x8bf6('0x1e')][_0x8bf6('0x1f')]===undefined?!![]:![]:!![],'where':_0x23b8de[_0x8bf6('0x1e')]?_0x23b8de[_0x8bf6('0x1e')][_0x8bf6('0x20')]||null:null,'attributes':_0x23b8de[_0x8bf6('0x1e')]?_0x23b8de[_0x8bf6('0x1e')][_0x8bf6('0x21')]||null:null,'include':_0x23b8de[_0x8bf6('0x1e')]?_0x23b8de['options']['include']?_[_0x8bf6('0x22')](_0x23b8de[_0x8bf6('0x1e')]['include'],function(_0x1b98f5){return{'model':db[_0x1b98f5[_0x8bf6('0x23')]],'as':_0x1b98f5['as'],'attributes':_0x1b98f5[_0x8bf6('0x21')],'include':_0x1b98f5[_0x8bf6('0x24')]?_[_0x8bf6('0x22')](_0x1b98f5[_0x8bf6('0x24')],function(_0x5bc6f5){return{'model':db[_0x5bc6f5['model']],'as':_0x5bc6f5['as'],'attributes':_0x5bc6f5[_0x8bf6('0x21')],'include':_0x5bc6f5[_0x8bf6('0x24')]?_[_0x8bf6('0x22')](_0x5bc6f5[_0x8bf6('0x24')],function(_0x15daee){return{'model':db[_0x15daee['model']],'as':_0x15daee['as'],'attributes':_0x15daee[_0x8bf6('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8bf6('0x11')](function(_0x1071b6){logger[_0x8bf6('0x12')](_0x8bf6('0x25'),_0x23b8de);logger[_0x8bf6('0x14')](_0x8bf6('0x25'),_0x23b8de,JSON[_0x8bf6('0x26')](_0x1071b6));_0x1245fa(_0x1071b6);})[_0x8bf6('0x1b')](function(_0x2e6b29){logger[_0x8bf6('0x17')]('ShowSmsAccount',_0x2e6b29[_0x8bf6('0x19')],_0x23b8de);_0x294393(_0x157917[_0x8bf6('0x17')](0x1f4,_0x2e6b29['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 2c5d2ed..72e44eb 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 _0xe1e8=['remove','emit','register','smsAccount:','./smsAccount.events'];(function(_0x4a367f,_0x4e05f2){var _0x2bedd5=function(_0x5b5e70){while(--_0x5b5e70){_0x4a367f['push'](_0x4a367f['shift']());}};_0x2bedd5(++_0x4e05f2);}(_0xe1e8,0x1cb));var _0x8e1e=function(_0x2d129b,_0x56c468){_0x2d129b=_0x2d129b-0x0;var _0x3e4123=_0xe1e8[_0x2d129b];return _0x3e4123;};'use strict';var SmsAccountEvents=require(_0x8e1e('0x0'));var events=['save',_0x8e1e('0x1'),'update'];function createListener(_0x4d8c47,_0x362e4b){return function(_0x40110){_0x362e4b[_0x8e1e('0x2')](_0x4d8c47,_0x40110);};}function removeListener(_0x1a69dc,_0x50f4bf){return function(){SmsAccountEvents['removeListener'](_0x1a69dc,_0x50f4bf);};}exports[_0x8e1e('0x3')]=function(_0xf371b5){for(var _0x13c945=0x0,_0x1861ce=events['length'];_0x13c945<_0x1861ce;_0x13c945++){var _0x21ee75=events[_0x13c945];var _0xe8a658=createListener(_0x8e1e('0x4')+_0x21ee75,_0xf371b5);SmsAccountEvents['on'](_0x21ee75,_0xe8a658);}}; \ No newline at end of file +var _0xef82=['length','smsAccount:','save','remove','emit','register'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xef82,0x98));var _0x2ef8=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xef82[_0x47aa64];return _0x549c7a;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0x2ef8('0x0'),_0x2ef8('0x1'),'update'];function createListener(_0x5b6433,_0x5e4d7f){return function(_0x392f4a){_0x5e4d7f[_0x2ef8('0x2')](_0x5b6433,_0x392f4a);};}function removeListener(_0x36eca7,_0x2ad549){return function(){SmsAccountEvents['removeListener'](_0x36eca7,_0x2ad549);};}exports[_0x2ef8('0x3')]=function(_0x3504f7){for(var _0x1d3e23=0x0,_0x3a217d=events[_0x2ef8('0x4')];_0x1d3e23<_0x3a217d;_0x1d3e23++){var _0x4a0026=events[_0x1d3e23];var _0xa6eac8=createListener(_0x2ef8('0x5')+_0x4a0026,_0x3504f7);SmsAccountEvents['on'](_0x4a0026,_0xa6eac8);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 19a0bff..418bae8 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 _0x15e5=['../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x15e5,0xb8));var _0x515e=function(_0x3e1eda,_0xb957c3){_0x3e1eda=_0x3e1eda-0x0;var _0x4591b9=_0x15e5[_0x3e1eda];return _0x4591b9;};'use strict';var multer=require(_0x515e('0x0'));var util=require(_0x515e('0x1'));var path=require(_0x515e('0x2'));var timeout=require(_0x515e('0x3'));var express=require(_0x515e('0x4'));var router=express[_0x515e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x515e('0x6'));var config=require(_0x515e('0x7'));var controller=require(_0x515e('0x8'));router[_0x515e('0x9')]('/',auth[_0x515e('0xa')](),controller['index']);router[_0x515e('0x9')](_0x515e('0xb'),auth[_0x515e('0xa')](),controller[_0x515e('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x515e('0xd')]);router[_0x515e('0xe')]('/:id',auth[_0x515e('0xa')](),controller[_0x515e('0xf')]);router[_0x515e('0x10')](_0x515e('0xb'),auth[_0x515e('0xa')](),controller[_0x515e('0x11')]);module[_0x515e('0x12')]=router; \ No newline at end of file +var _0xc895=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x36199a,_0x4f756c){var _0x5b36f1=function(_0x29480d){while(--_0x29480d){_0x36199a['push'](_0x36199a['shift']());}};_0x5b36f1(++_0x4f756c);}(_0xc895,0x74));var _0x5c89=function(_0x53daae,_0x51a400){_0x53daae=_0x53daae-0x0;var _0x12be55=_0xc895[_0x53daae];return _0x12be55;};'use strict';var multer=require('multer');var util=require(_0x5c89('0x0'));var path=require(_0x5c89('0x1'));var timeout=require(_0x5c89('0x2'));var express=require(_0x5c89('0x3'));var router=express[_0x5c89('0x4')]();var auth=require(_0x5c89('0x5'));var interaction=require(_0x5c89('0x6'));var config=require(_0x5c89('0x7'));var controller=require(_0x5c89('0x8'));router[_0x5c89('0x9')]('/',auth[_0x5c89('0xa')](),controller['index']);router[_0x5c89('0x9')](_0x5c89('0xb'),auth['isAuthenticated'](),controller[_0x5c89('0xc')]);router[_0x5c89('0xd')]('/',auth[_0x5c89('0xa')](),controller[_0x5c89('0xe')]);router[_0x5c89('0xf')](_0x5c89('0xb'),auth[_0x5c89('0xa')](),controller[_0x5c89('0x10')]);router[_0x5c89('0x11')](_0x5c89('0xb'),auth[_0x5c89('0xa')](),controller[_0x5c89('0x12')]);module[_0x5c89('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index c0b23e9..3e86ec2 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 _0xb4fe=['TEXT','sequelize','STRING','noop'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xb4fe,0x1ad));var _0xeb4f=function(_0x278450,_0x2b93d4){_0x278450=_0x278450-0x0;var _0x59f848=_0xb4fe[_0x278450];return _0x59f848;};'use strict';var Sequelize=require(_0xeb4f('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xeb4f('0x1')],'allowNull':![],'defaultValue':_0xeb4f('0x2')},'appdata':{'type':Sequelize[_0xeb4f('0x3')]()},'description':{'type':Sequelize[_0xeb4f('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x4f40=['sequelize','exports','TEXT','STRING','*,*,*,*'];(function(_0x4dc4bd,_0x490bf0){var _0x22a362=function(_0x1512b1){while(--_0x1512b1){_0x4dc4bd['push'](_0x4dc4bd['shift']());}};_0x22a362(++_0x490bf0);}(_0x4f40,0x1d6));var _0x04f4=function(_0xe306b9,_0x476092){_0xe306b9=_0xe306b9-0x0;var _0x382c55=_0x4f40[_0xe306b9];return _0x382c55;};'use strict';var Sequelize=require(_0x04f4('0x0'));module[_0x04f4('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x04f4('0x2')]()},'description':{'type':Sequelize[_0x04f4('0x3')]},'interval':{'type':Sequelize[_0x04f4('0x3')],'defaultValue':_0x04f4('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 11e1323..5cddec7 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 _0xf5d4=['status','end','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','map','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','merge','VIRTUAL','options','SmsApplication','then','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','body','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf5d4,0x19f));var _0x4f5d=function(_0x186315,_0x443efb){_0x186315=_0x186315-0x0;var _0x1f67d6=_0xf5d4[_0x186315];return _0x1f67d6;};'use strict';var pdf=require(_0x4f5d('0x0'));var emlformat=require(_0x4f5d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4f5d('0x2'));var moment=require(_0x4f5d('0x3'));var BPromise=require(_0x4f5d('0x4'));var Mustache=require(_0x4f5d('0x5'));var util=require(_0x4f5d('0x6'));var path=require('path');var sox=require(_0x4f5d('0x7'));var csv=require('to-csv');var ejs=require(_0x4f5d('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4f5d('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4f5d('0xa'));var toCsv=require(_0x4f5d('0xb'));var querystring=require(_0x4f5d('0xc'));var Papa=require(_0x4f5d('0xd'));var Redis=require(_0x4f5d('0xe'));var authService=require(_0x4f5d('0xf'));var qs=require(_0x4f5d('0x10'));var as=require(_0x4f5d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4f5d('0x12'));var utils=require(_0x4f5d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4f5d('0x14'));var db=require(_0x4f5d('0x15'))['db'];function respondWithStatusCode(_0x2ba2f8,_0x4413b7){_0x4413b7=_0x4413b7||0xcc;return function(_0xf1fb0c){if(_0xf1fb0c){return _0x2ba2f8[_0x4f5d('0x16')](_0x4413b7);}return _0x2ba2f8[_0x4f5d('0x17')](_0x4413b7)[_0x4f5d('0x18')]();};}function respondWithResult(_0x545926,_0xac1dda){_0xac1dda=_0xac1dda||0xc8;return function(_0x1320c9){if(_0x1320c9){return _0x545926['status'](_0xac1dda)['json'](_0x1320c9);}};}function respondWithFilteredResult(_0x1d8040,_0x409390){return function(_0x59f140){if(_0x59f140){var _0x46afd9=_0x59f140[_0x4f5d('0x19')],_0x107ace=_0x409390['offset'],_0x45af27=_0x409390['offset']+_0x409390[_0x4f5d('0x1a')],_0x3ded33;if(_0x45af27>=_0x46afd9){_0x45af27=_0x46afd9;_0x3ded33=0xc8;}else{_0x3ded33=0xce;}_0x1d8040[_0x4f5d('0x17')](_0x3ded33);return _0x1d8040[_0x4f5d('0x1b')](_0x4f5d('0x1c'),_0x107ace+'-'+_0x45af27+'/'+_0x46afd9)[_0x4f5d('0x1d')](_0x59f140);}return null;};}function patchUpdates(_0xa1177c){return function(_0xc49a9){try{jsonpatch[_0x4f5d('0x1e')](_0xc49a9,_0xa1177c,!![]);}catch(_0x2b9e0c){return BPromise[_0x4f5d('0x1f')](_0x2b9e0c);}return _0xc49a9[_0x4f5d('0x20')]();};}function saveUpdates(_0x464193,_0x34a281){return function(_0x425f42){if(_0x425f42){return _0x425f42[_0x4f5d('0x21')](_0x464193)['then'](function(_0x55d0e3){return _0x55d0e3;});}return null;};}function removeEntity(_0x467d76,_0x47eaf8){return function(_0x38ffdf){if(_0x38ffdf){return _0x38ffdf[_0x4f5d('0x22')]()['then'](function(){_0x467d76[_0x4f5d('0x17')](0xcc)[_0x4f5d('0x18')]();});}};}function handleEntityNotFound(_0x493091,_0x48971d){return function(_0x1069cc){if(!_0x1069cc){_0x493091[_0x4f5d('0x16')](0x194);}return _0x1069cc;};}function handleError(_0x25149d,_0x293814){_0x293814=_0x293814||0x1f4;return function(_0x13bc7e){logger[_0x4f5d('0x23')](_0x13bc7e[_0x4f5d('0x24')]);if(_0x13bc7e[_0x4f5d('0x25')]){delete _0x13bc7e[_0x4f5d('0x25')];}_0x25149d[_0x4f5d('0x17')](_0x293814)[_0x4f5d('0x26')](_0x13bc7e);};}exports['index']=function(_0x287588,_0x17e315){var _0x768c0={},_0x3a56e6={},_0xb474b2={'count':0x0,'rows':[]};var _0x110522=_[_0x4f5d('0x27')](db['SmsApplication']['rawAttributes'],function(_0x85552c){return{'name':_0x85552c[_0x4f5d('0x28')],'type':_0x85552c[_0x4f5d('0x29')][_0x4f5d('0x2a')]};});_0x3a56e6[_0x4f5d('0x2b')]=_[_0x4f5d('0x27')](_0x110522,'name');_0x3a56e6['query']=_[_0x4f5d('0x2c')](_0x287588[_0x4f5d('0x2d')]);_0x3a56e6[_0x4f5d('0x2e')]=_['intersection'](_0x3a56e6[_0x4f5d('0x2b')],_0x3a56e6[_0x4f5d('0x2d')]);_0x768c0[_0x4f5d('0x2f')]=_[_0x4f5d('0x30')](_0x3a56e6['model'],qs[_0x4f5d('0x31')](_0x287588[_0x4f5d('0x2d')][_0x4f5d('0x31')]));_0x768c0['attributes']=_0x768c0['attributes'][_0x4f5d('0x32')]?_0x768c0['attributes']:_0x3a56e6[_0x4f5d('0x2b')];if(!_0x287588[_0x4f5d('0x2d')][_0x4f5d('0x33')](_0x4f5d('0x34'))){_0x768c0['limit']=qs['limit'](_0x287588[_0x4f5d('0x2d')][_0x4f5d('0x1a')]);_0x768c0[_0x4f5d('0x35')]=qs['offset'](_0x287588['query']['offset']);}_0x768c0['order']=qs[_0x4f5d('0x36')](_0x287588[_0x4f5d('0x2d')]['sort']);_0x768c0[_0x4f5d('0x37')]=qs[_0x4f5d('0x2e')](_[_0x4f5d('0x38')](_0x287588[_0x4f5d('0x2d')],_0x3a56e6['filters']),_0x110522);if(_0x287588[_0x4f5d('0x2d')]['filter']){_0x768c0[_0x4f5d('0x37')]=_[_0x4f5d('0x39')](_0x768c0[_0x4f5d('0x37')],{'$or':_[_0x4f5d('0x27')](_0x110522,function(_0x3de3ea){if(_0x3de3ea[_0x4f5d('0x29')]!==_0x4f5d('0x3a')){var _0x13ec1e={};_0x13ec1e[_0x3de3ea[_0x4f5d('0x25')]]={'$like':'%'+_0x287588[_0x4f5d('0x2d')]['filter']+'%'};return _0x13ec1e;}})});}_0x768c0=_['merge']({},_0x768c0,_0x287588[_0x4f5d('0x3b')]);var _0x2d1862={'where':_0x768c0[_0x4f5d('0x37')]};return db[_0x4f5d('0x3c')]['count'](_0x2d1862)[_0x4f5d('0x3d')](function(_0x5f211f){_0xb474b2[_0x4f5d('0x19')]=_0x5f211f;if(_0x287588[_0x4f5d('0x2d')][_0x4f5d('0x3e')]){_0x768c0['include']=[{'all':!![]}];}return db[_0x4f5d('0x3c')][_0x4f5d('0x3f')](_0x768c0);})['then'](function(_0x424740){_0xb474b2[_0x4f5d('0x40')]=_0x424740;return _0xb474b2;})[_0x4f5d('0x3d')](respondWithFilteredResult(_0x17e315,_0x768c0))['catch'](handleError(_0x17e315,null));};exports[_0x4f5d('0x41')]=function(_0x53a833,_0x310731){var _0x29da43={'raw':!![],'where':{'id':_0x53a833[_0x4f5d('0x42')]['id']}},_0xe793d6={};_0xe793d6[_0x4f5d('0x2b')]=_[_0x4f5d('0x2c')](db[_0x4f5d('0x3c')][_0x4f5d('0x43')]);_0xe793d6[_0x4f5d('0x2d')]=_[_0x4f5d('0x2c')](_0x53a833['query']);_0xe793d6[_0x4f5d('0x2e')]=_[_0x4f5d('0x30')](_0xe793d6[_0x4f5d('0x2b')],_0xe793d6['query']);_0x29da43[_0x4f5d('0x2f')]=_[_0x4f5d('0x30')](_0xe793d6[_0x4f5d('0x2b')],qs[_0x4f5d('0x31')](_0x53a833[_0x4f5d('0x2d')][_0x4f5d('0x31')]));_0x29da43['attributes']=_0x29da43[_0x4f5d('0x2f')][_0x4f5d('0x32')]?_0x29da43[_0x4f5d('0x2f')]:_0xe793d6[_0x4f5d('0x2b')];if(_0x53a833['query'][_0x4f5d('0x3e')]){_0x29da43[_0x4f5d('0x44')]=[{'all':!![]}];}_0x29da43=_[_0x4f5d('0x39')]({},_0x29da43,_0x53a833['options']);return db['SmsApplication'][_0x4f5d('0x45')](_0x29da43)['then'](handleEntityNotFound(_0x310731,null))[_0x4f5d('0x3d')](respondWithResult(_0x310731,null))[_0x4f5d('0x46')](handleError(_0x310731,null));};exports['create']=function(_0x199bc1,_0x16c13a){return db['SmsApplication'][_0x4f5d('0x47')](_0x199bc1[_0x4f5d('0x48')],{})[_0x4f5d('0x3d')](respondWithResult(_0x16c13a,0xc9))[_0x4f5d('0x46')](handleError(_0x16c13a,null));};exports[_0x4f5d('0x21')]=function(_0x2efeb1,_0x38ea65){if(_0x2efeb1['body']['id']){delete _0x2efeb1[_0x4f5d('0x48')]['id'];}return db[_0x4f5d('0x3c')]['find']({'where':{'id':_0x2efeb1[_0x4f5d('0x42')]['id']}})[_0x4f5d('0x3d')](handleEntityNotFound(_0x38ea65,null))[_0x4f5d('0x3d')](saveUpdates(_0x2efeb1['body'],null))[_0x4f5d('0x3d')](respondWithResult(_0x38ea65,null))[_0x4f5d('0x46')](handleError(_0x38ea65,null));};exports[_0x4f5d('0x22')]=function(_0x2f7d39,_0x540a6f){return db[_0x4f5d('0x3c')][_0x4f5d('0x45')]({'where':{'id':_0x2f7d39['params']['id']}})[_0x4f5d('0x3d')](handleEntityNotFound(_0x540a6f,null))[_0x4f5d('0x3d')](removeEntity(_0x540a6f,null))['catch'](handleError(_0x540a6f,null));}; \ No newline at end of file +var _0xb77e=['type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SmsApplication','count','includeAll','rows','show','params','catch','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName'];(function(_0x2ee6fe,_0x37baf0){var _0x4bce15=function(_0x504f92){while(--_0x504f92){_0x2ee6fe['push'](_0x2ee6fe['shift']());}};_0x4bce15(++_0x37baf0);}(_0xb77e,0x1e6));var _0xeb77=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb77e[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0xeb77('0x0'));var emlformat=require(_0xeb77('0x1'));var rimraf=require(_0xeb77('0x2'));var zipdir=require(_0xeb77('0x3'));var jsonpatch=require(_0xeb77('0x4'));var rp=require(_0xeb77('0x5'));var moment=require(_0xeb77('0x6'));var BPromise=require(_0xeb77('0x7'));var Mustache=require(_0xeb77('0x8'));var util=require(_0xeb77('0x9'));var path=require(_0xeb77('0xa'));var sox=require(_0xeb77('0xb'));var csv=require(_0xeb77('0xc'));var ejs=require(_0xeb77('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xeb77('0xe'));var crypto=require(_0xeb77('0xf'));var jsforce=require(_0xeb77('0x10'));var deskjs=require(_0xeb77('0x11'));var toCsv=require(_0xeb77('0xc'));var querystring=require(_0xeb77('0x12'));var Papa=require('papaparse');var Redis=require(_0xeb77('0x13'));var authService=require(_0xeb77('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb77('0x15'));var logger=require(_0xeb77('0x16'))(_0xeb77('0x17'));var utils=require(_0xeb77('0x18'));var config=require(_0xeb77('0x19'));var licenseUtil=require(_0xeb77('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9d0a64,_0x473501){_0x473501=_0x473501||0xcc;return function(_0x34d8d7){if(_0x34d8d7){return _0x9d0a64[_0xeb77('0x1b')](_0x473501);}return _0x9d0a64['status'](_0x473501)[_0xeb77('0x1c')]();};}function respondWithResult(_0x2844ea,_0x2f47b5){_0x2f47b5=_0x2f47b5||0xc8;return function(_0x1e50b7){if(_0x1e50b7){return _0x2844ea[_0xeb77('0x1d')](_0x2f47b5)[_0xeb77('0x1e')](_0x1e50b7);}};}function respondWithFilteredResult(_0x29343f,_0x12e535){return function(_0xd3503b){if(_0xd3503b){var _0x4ce2e0=_0xd3503b['count'],_0x3a436b=_0x12e535[_0xeb77('0x1f')],_0x4c0e77=_0x12e535['offset']+_0x12e535['limit'],_0x54c00f;if(_0x4c0e77>=_0x4ce2e0){_0x4c0e77=_0x4ce2e0;_0x54c00f=0xc8;}else{_0x54c00f=0xce;}_0x29343f[_0xeb77('0x1d')](_0x54c00f);return _0x29343f[_0xeb77('0x20')](_0xeb77('0x21'),_0x3a436b+'-'+_0x4c0e77+'/'+_0x4ce2e0)[_0xeb77('0x1e')](_0xd3503b);}return null;};}function patchUpdates(_0x348559){return function(_0x1f7fc8){try{jsonpatch[_0xeb77('0x22')](_0x1f7fc8,_0x348559,!![]);}catch(_0x2df83d){return BPromise['reject'](_0x2df83d);}return _0x1f7fc8[_0xeb77('0x23')]();};}function saveUpdates(_0x56e100,_0x3d8fda){return function(_0x527d2c){if(_0x527d2c){return _0x527d2c[_0xeb77('0x24')](_0x56e100)['then'](function(_0x51ce9c){return _0x51ce9c;});}return null;};}function removeEntity(_0x207af7,_0x2b2d7a){return function(_0x45945c){if(_0x45945c){return _0x45945c[_0xeb77('0x25')]()[_0xeb77('0x26')](function(){_0x207af7[_0xeb77('0x1d')](0xcc)[_0xeb77('0x1c')]();});}};}function handleEntityNotFound(_0x381958,_0x28cdfd){return function(_0xde9abe){if(!_0xde9abe){_0x381958[_0xeb77('0x1b')](0x194);}return _0xde9abe;};}function handleError(_0x1bc3cf,_0x596d41){_0x596d41=_0x596d41||0x1f4;return function(_0x36a80a){logger[_0xeb77('0x27')](_0x36a80a[_0xeb77('0x28')]);if(_0x36a80a['name']){delete _0x36a80a[_0xeb77('0x29')];}_0x1bc3cf[_0xeb77('0x1d')](_0x596d41)[_0xeb77('0x2a')](_0x36a80a);};}exports[_0xeb77('0x2b')]=function(_0x4a4962,_0x37bd20){var _0x3a4fa7={},_0x141a94={},_0x306a95={'count':0x0,'rows':[]};var _0x3f0698=_['map'](db['SmsApplication'][_0xeb77('0x2c')],function(_0x3a4d36){return{'name':_0x3a4d36[_0xeb77('0x2d')],'type':_0x3a4d36[_0xeb77('0x2e')]['key']};});_0x141a94[_0xeb77('0x2f')]=_[_0xeb77('0x30')](_0x3f0698,_0xeb77('0x29'));_0x141a94[_0xeb77('0x31')]=_[_0xeb77('0x32')](_0x4a4962['query']);_0x141a94['filters']=_[_0xeb77('0x33')](_0x141a94[_0xeb77('0x2f')],_0x141a94[_0xeb77('0x31')]);_0x3a4fa7['attributes']=_[_0xeb77('0x33')](_0x141a94[_0xeb77('0x2f')],qs[_0xeb77('0x34')](_0x4a4962[_0xeb77('0x31')][_0xeb77('0x34')]));_0x3a4fa7['attributes']=_0x3a4fa7[_0xeb77('0x35')][_0xeb77('0x36')]?_0x3a4fa7[_0xeb77('0x35')]:_0x141a94[_0xeb77('0x2f')];if(!_0x4a4962[_0xeb77('0x31')][_0xeb77('0x37')]('nolimit')){_0x3a4fa7[_0xeb77('0x38')]=qs[_0xeb77('0x38')](_0x4a4962['query'][_0xeb77('0x38')]);_0x3a4fa7[_0xeb77('0x1f')]=qs['offset'](_0x4a4962[_0xeb77('0x31')][_0xeb77('0x1f')]);}_0x3a4fa7[_0xeb77('0x39')]=qs[_0xeb77('0x3a')](_0x4a4962[_0xeb77('0x31')][_0xeb77('0x3a')]);_0x3a4fa7[_0xeb77('0x3b')]=qs[_0xeb77('0x3c')](_[_0xeb77('0x3d')](_0x4a4962[_0xeb77('0x31')],_0x141a94[_0xeb77('0x3c')]),_0x3f0698);if(_0x4a4962[_0xeb77('0x31')][_0xeb77('0x3e')]){_0x3a4fa7[_0xeb77('0x3b')]=_[_0xeb77('0x3f')](_0x3a4fa7['where'],{'$or':_[_0xeb77('0x30')](_0x3f0698,function(_0x185e9a){if(_0x185e9a['type']!==_0xeb77('0x40')){var _0x2b3032={};_0x2b3032[_0x185e9a[_0xeb77('0x29')]]={'$like':'%'+_0x4a4962[_0xeb77('0x31')][_0xeb77('0x3e')]+'%'};return _0x2b3032;}})});}_0x3a4fa7=_['merge']({},_0x3a4fa7,_0x4a4962[_0xeb77('0x41')]);var _0x1b677b={'where':_0x3a4fa7[_0xeb77('0x3b')]};return db[_0xeb77('0x42')][_0xeb77('0x43')](_0x1b677b)[_0xeb77('0x26')](function(_0x53addf){_0x306a95[_0xeb77('0x43')]=_0x53addf;if(_0x4a4962[_0xeb77('0x31')][_0xeb77('0x44')]){_0x3a4fa7['include']=[{'all':!![]}];}return db[_0xeb77('0x42')]['findAll'](_0x3a4fa7);})[_0xeb77('0x26')](function(_0x59be32){_0x306a95[_0xeb77('0x45')]=_0x59be32;return _0x306a95;})[_0xeb77('0x26')](respondWithFilteredResult(_0x37bd20,_0x3a4fa7))['catch'](handleError(_0x37bd20,null));};exports[_0xeb77('0x46')]=function(_0x2c5f17,_0x1d00fb){var _0x36b14a={'raw':!![],'where':{'id':_0x2c5f17[_0xeb77('0x47')]['id']}},_0x4a37da={};_0x4a37da['model']=_[_0xeb77('0x32')](db[_0xeb77('0x42')][_0xeb77('0x2c')]);_0x4a37da['query']=_[_0xeb77('0x32')](_0x2c5f17['query']);_0x4a37da['filters']=_[_0xeb77('0x33')](_0x4a37da[_0xeb77('0x2f')],_0x4a37da[_0xeb77('0x31')]);_0x36b14a[_0xeb77('0x35')]=_[_0xeb77('0x33')](_0x4a37da[_0xeb77('0x2f')],qs[_0xeb77('0x34')](_0x2c5f17[_0xeb77('0x31')]['fields']));_0x36b14a[_0xeb77('0x35')]=_0x36b14a[_0xeb77('0x35')]['length']?_0x36b14a['attributes']:_0x4a37da[_0xeb77('0x2f')];if(_0x2c5f17['query'][_0xeb77('0x44')]){_0x36b14a['include']=[{'all':!![]}];}_0x36b14a=_['merge']({},_0x36b14a,_0x2c5f17[_0xeb77('0x41')]);return db['SmsApplication']['find'](_0x36b14a)[_0xeb77('0x26')](handleEntityNotFound(_0x1d00fb,null))[_0xeb77('0x26')](respondWithResult(_0x1d00fb,null))[_0xeb77('0x48')](handleError(_0x1d00fb,null));};exports[_0xeb77('0x49')]=function(_0x15bd32,_0x33bb52){return db[_0xeb77('0x42')][_0xeb77('0x49')](_0x15bd32[_0xeb77('0x4a')],{})[_0xeb77('0x26')](respondWithResult(_0x33bb52,0xc9))[_0xeb77('0x48')](handleError(_0x33bb52,null));};exports[_0xeb77('0x24')]=function(_0x414fd5,_0x3835e8){if(_0x414fd5[_0xeb77('0x4a')]['id']){delete _0x414fd5[_0xeb77('0x4a')]['id'];}return db[_0xeb77('0x42')]['find']({'where':{'id':_0x414fd5[_0xeb77('0x47')]['id']}})[_0xeb77('0x26')](handleEntityNotFound(_0x3835e8,null))[_0xeb77('0x26')](saveUpdates(_0x414fd5[_0xeb77('0x4a')],null))[_0xeb77('0x26')](respondWithResult(_0x3835e8,null))[_0xeb77('0x48')](handleError(_0x3835e8,null));};exports[_0xeb77('0x25')]=function(_0x3a5b58,_0x591745){return db['SmsApplication'][_0xeb77('0x4b')]({'where':{'id':_0x3a5b58[_0xeb77('0x47')]['id']}})[_0xeb77('0x26')](handleEntityNotFound(_0x591745,null))[_0xeb77('0x26')](removeEntity(_0x591745,null))[_0xeb77('0x48')](handleError(_0x591745,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 27fef2c..36bb0fa 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 _0xa3ff=['sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication'];(function(_0x11c7a2,_0x4ba0c8){var _0x25c8f8=function(_0x237113){while(--_0x237113){_0x11c7a2['push'](_0x11c7a2['shift']());}};_0x25c8f8(++_0x4ba0c8);}(_0xa3ff,0x11a));var _0xfa3f=function(_0x2e353f,_0x15d70a){_0x2e353f=_0x2e353f-0x0;var _0x4b0700=_0xa3ff[_0x2e353f];return _0x4b0700;};'use strict';var _=require(_0xfa3f('0x0'));var util=require(_0xfa3f('0x1'));var logger=require(_0xfa3f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfa3f('0x3'));var rp=require(_0xfa3f('0x4'));var fs=require('fs');var path=require(_0xfa3f('0x5'));var rimraf=require(_0xfa3f('0x6'));var config=require(_0xfa3f('0x7'));var attributes=require(_0xfa3f('0x8'));module[_0xfa3f('0x9')]=function(_0x20c2b8,_0x42720e){return _0x20c2b8[_0xfa3f('0xa')](_0xfa3f('0xb'),attributes,{'tableName':_0xfa3f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xfa3f('0xd')});}; \ No newline at end of file +var _0x7531=['../../config/logger','api','moment','rimraf','./smsApplication.attributes','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x43eaa0,_0x4de588){var _0x32fde6=function(_0x16c7b1){while(--_0x16c7b1){_0x43eaa0['push'](_0x43eaa0['shift']());}};_0x32fde6(++_0x4de588);}(_0x7531,0xe4));var _0x1753=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7531[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x1753('0x0'));var util=require(_0x1753('0x1'));var logger=require(_0x1753('0x2'))(_0x1753('0x3'));var moment=require(_0x1753('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1753('0x5'));var config=require('../../config/environment');var attributes=require(_0x1753('0x6'));module['exports']=function(_0x5788c9,_0x5f511a){return _0x5788c9['define'](_0x1753('0x7'),attributes,{'tableName':_0x1753('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1753('0x9')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index b3fd02d..13cd482 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 _0x92e0=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','request\x20sent','error','message','SmsApplication,\x20%s,\x20%s','result','catch','lodash','moment'];(function(_0x163fe0,_0x458ba8){var _0x5c718b=function(_0x1da526){while(--_0x1da526){_0x163fe0['push'](_0x163fe0['shift']());}};_0x5c718b(++_0x458ba8);}(_0x92e0,0x154));var _0x092e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x92e0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x092e('0x0'));var util=require('util');var moment=require(_0x092e('0x1'));var BPromise=require(_0x092e('0x2'));var rs=require(_0x092e('0x3'));var fs=require('fs');var Redis=require(_0x092e('0x4'));var db=require(_0x092e('0x5'))['db'];var utils=require(_0x092e('0x6'));var logger=require(_0x092e('0x7'))(_0x092e('0x8'));var config=require(_0x092e('0x9'));var jayson=require(_0x092e('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f1f0b,_0x1ddace,_0x1af53d){return new BPromise(function(_0x4c73a9,_0x414a72){return client['request'](_0x2f1f0b,_0x1af53d)['then'](function(_0x2b4a69){logger[_0x092e('0xb')]('SmsApplication,\x20%s,\x20%s',_0x1ddace,_0x092e('0xc'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x1ddace,_0x092e('0xc'),JSON['stringify'](_0x2b4a69));if(_0x2b4a69[_0x092e('0xd')]){if(_0x2b4a69['error']['code']===0x1f4){logger[_0x092e('0xd')]('SmsApplication,\x20%s,\x20%s',_0x1ddace,_0x2b4a69[_0x092e('0xd')][_0x092e('0xe')]);return _0x414a72(_0x2b4a69[_0x092e('0xd')][_0x092e('0xe')]);}logger[_0x092e('0xd')]('SmsApplication,\x20%s,\x20%s',_0x1ddace,_0x2b4a69['error'][_0x092e('0xe')]);return _0x4c73a9(_0x2b4a69[_0x092e('0xd')]['message']);}else{logger[_0x092e('0xb')](_0x092e('0xf'),_0x1ddace,_0x092e('0xc'));_0x4c73a9(_0x2b4a69[_0x092e('0x10')]['message']);}})[_0x092e('0x11')](function(_0x13bdf1){logger[_0x092e('0xd')]('SmsApplication,\x20%s,\x20%s',_0x1ddace,_0x13bdf1);_0x414a72(_0x13bdf1);});});} \ No newline at end of file +var _0x7dfd=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x58464f,_0x4918f7){var _0x1d56e=function(_0x21ebd3){while(--_0x21ebd3){_0x58464f['push'](_0x58464f['shift']());}};_0x1d56e(++_0x4918f7);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var moment=require(_0xd7df('0x2'));var BPromise=require(_0xd7df('0x3'));var rs=require(_0xd7df('0x4'));var fs=require('fs');var Redis=require(_0xd7df('0x5'));var db=require(_0xd7df('0x6'))['db'];var utils=require(_0xd7df('0x7'));var logger=require(_0xd7df('0x8'))(_0xd7df('0x9'));var config=require(_0xd7df('0xa'));var jayson=require(_0xd7df('0xb'));var client=jayson[_0xd7df('0xc')][_0xd7df('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x354ea7,_0x16e50,_0x2c48a4){return new BPromise(function(_0x5c220a,_0xab6742){return client[_0xd7df('0xe')](_0x354ea7,_0x2c48a4)[_0xd7df('0xf')](function(_0x3dee59){logger['info'](_0xd7df('0x10'),_0x16e50,'request\x20sent');logger[_0xd7df('0x11')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x16e50,_0xd7df('0x12'),JSON[_0xd7df('0x13')](_0x3dee59));if(_0x3dee59[_0xd7df('0x14')]){if(_0x3dee59[_0xd7df('0x14')][_0xd7df('0x15')]===0x1f4){logger[_0xd7df('0x14')](_0xd7df('0x10'),_0x16e50,_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);return _0xab6742(_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);}logger[_0xd7df('0x14')](_0xd7df('0x10'),_0x16e50,_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);return _0x5c220a(_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);}else{logger['info'](_0xd7df('0x10'),_0x16e50,_0xd7df('0x12'));_0x5c220a(_0x3dee59['result'][_0xd7df('0x16')]);}})[_0xd7df('0x17')](function(_0x5d3beb){logger[_0xd7df('0x14')](_0xd7df('0x10'),_0x16e50,_0x5d3beb);_0xab6742(_0x5d3beb);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 6826744..a3feb44 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 _0x5dad=['isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','smsinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5dad,0x128));var _0xd5da=function(_0x3a25ba,_0x3d3597){_0x3a25ba=_0x3a25ba-0x0;var _0x2c883e=_0x5dad[_0x3a25ba];return _0x2c883e;};'use strict';var multer=require(_0xd5da('0x0'));var util=require(_0xd5da('0x1'));var path=require(_0xd5da('0x2'));var timeout=require(_0xd5da('0x3'));var express=require(_0xd5da('0x4'));var router=express[_0xd5da('0x5')]();var auth=require(_0xd5da('0x6'));var interaction=require(_0xd5da('0x7'));var config=require('../../config/environment');var controller=require(_0xd5da('0x8'));router[_0xd5da('0x9')]('/',auth[_0xd5da('0xa')](),controller[_0xd5da('0xb')]);router[_0xd5da('0x9')](_0xd5da('0xc'),auth[_0xd5da('0xa')](),controller[_0xd5da('0xd')]);router[_0xd5da('0x9')](_0xd5da('0xe'),auth[_0xd5da('0xa')](),controller[_0xd5da('0xf')]);router[_0xd5da('0x9')](_0xd5da('0x10'),auth[_0xd5da('0xa')](),controller[_0xd5da('0x11')]);router[_0xd5da('0x9')](_0xd5da('0x12'),auth['isAuthenticated'](),controller[_0xd5da('0x13')]);router[_0xd5da('0x14')]('/',auth[_0xd5da('0xa')](),controller[_0xd5da('0x15')]);router[_0xd5da('0x14')](_0xd5da('0x10'),auth['isAuthenticated'](),controller[_0xd5da('0x16')]);router[_0xd5da('0x14')](_0xd5da('0x17'),auth['isAuthenticated'](),interaction[_0xd5da('0x18')](_0xd5da('0x19'),'smsinteraction:addtags'),controller[_0xd5da('0x1a')]);router[_0xd5da('0x1b')](_0xd5da('0xe'),auth[_0xd5da('0xa')](),interaction[_0xd5da('0x18')]('sms',_0xd5da('0x1c')),controller[_0xd5da('0x1d')]);router[_0xd5da('0x1e')](_0xd5da('0xe'),auth[_0xd5da('0xa')](),interaction[_0xd5da('0x18')](_0xd5da('0x19'),'smsinteraction:destroy'),controller[_0xd5da('0x1f')]);router['delete'](_0xd5da('0x17'),auth[_0xd5da('0xa')](),controller[_0xd5da('0x20')]);module[_0xd5da('0x21')]=router; \ No newline at end of file +var _0x04aa=['smsinteraction:update','update','delete','smsinteraction:destroy','removeTags','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','/describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x04aa,0xb3));var _0xa04a=function(_0x45db20,_0x3cf0ca){_0x45db20=_0x45db20-0x0;var _0x43e3c0=_0x04aa[_0x45db20];return _0x43e3c0;};'use strict';var multer=require('multer');var util=require(_0xa04a('0x0'));var path=require(_0xa04a('0x1'));var timeout=require(_0xa04a('0x2'));var express=require('express');var router=express[_0xa04a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa04a('0x4'));var config=require(_0xa04a('0x5'));var controller=require(_0xa04a('0x6'));router[_0xa04a('0x7')]('/',auth[_0xa04a('0x8')](),controller['index']);router['get'](_0xa04a('0x9'),auth[_0xa04a('0x8')](),controller['describe']);router[_0xa04a('0x7')](_0xa04a('0xa'),auth[_0xa04a('0x8')](),controller[_0xa04a('0xb')]);router[_0xa04a('0x7')](_0xa04a('0xc'),auth['isAuthenticated'](),controller['getMessages']);router[_0xa04a('0x7')](_0xa04a('0xd'),auth[_0xa04a('0x8')](),controller[_0xa04a('0xe')]);router[_0xa04a('0xf')]('/',auth[_0xa04a('0x8')](),controller[_0xa04a('0x10')]);router[_0xa04a('0xf')]('/:id/messages',auth[_0xa04a('0x8')](),controller[_0xa04a('0x11')]);router['post'](_0xa04a('0x12'),auth['isAuthenticated'](),interaction[_0xa04a('0x13')](_0xa04a('0x14'),_0xa04a('0x15')),controller[_0xa04a('0x16')]);router[_0xa04a('0x17')](_0xa04a('0xa'),auth[_0xa04a('0x8')](),interaction[_0xa04a('0x13')](_0xa04a('0x14'),_0xa04a('0x18')),controller[_0xa04a('0x19')]);router[_0xa04a('0x1a')](_0xa04a('0xa'),auth['isAuthenticated'](),interaction[_0xa04a('0x13')]('sms',_0xa04a('0x1b')),controller['destroy']);router[_0xa04a('0x1a')]('/:id/tags',auth[_0xa04a('0x8')](),controller[_0xa04a('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index d306918..1da3b7d 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 _0x4afb=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x241dc8,_0x940a01){var _0x1bdc3c=function(_0x22b190){while(--_0x22b190){_0x241dc8['push'](_0x241dc8['shift']());}};_0x1bdc3c(++_0x940a01);}(_0x4afb,0xf5));var _0xb4af=function(_0x32807c,_0x464fd1){_0x32807c=_0x32807c-0x0;var _0x3267d3=_0x4afb[_0x32807c];return _0x3267d3;};'use strict';var Sequelize=require(_0xb4af('0x0'));var moment=require(_0xb4af('0x1'));module[_0xb4af('0x2')]={'closed':{'type':Sequelize[_0xb4af('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb4af('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xb4af('0x5')]},'thirdDisposition':{'type':Sequelize[_0xb4af('0x5')]},'note':{'type':Sequelize[_0xb4af('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xb4af('0x6')]('in',_0xb4af('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb4af('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xb4af('0x6')]('in',_0xb4af('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xd7a4=['ENUM','out','sequelize','moment','DATE','STRING'];(function(_0x2245ce,_0x372263){var _0x1cf09f=function(_0xf595ad){while(--_0xf595ad){_0x2245ce['push'](_0x2245ce['shift']());}};_0x1cf09f(++_0x372263);}(_0xd7a4,0x17c));var _0x4d7a=function(_0x3fd515,_0x1eb68f){_0x3fd515=_0x3fd515-0x0;var _0x441a28=_0xd7a4[_0x3fd515];return _0x441a28;};'use strict';var Sequelize=require(_0x4d7a('0x0'));var moment=require(_0x4d7a('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4d7a('0x2')]},'disposition':{'type':Sequelize[_0x4d7a('0x3')]},'secondDisposition':{'type':Sequelize[_0x4d7a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4d7a('0x3')]},'note':{'type':Sequelize[_0x4d7a('0x3')]},'phone':{'type':Sequelize[_0x4d7a('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x4d7a('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4d7a('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x4d7a('0x4')]('in',_0x4d7a('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 158d67b..a09f955 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 _0xa9e0=['params','keys','includeAll','include','options','create','body','describe','SmsMessage','addMessage','ids','omit','getMessages','format','rows','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','lastName','direction','SmsAccount','Owner','mkdirSync','10px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','Sms','YYYY-MM-DD','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','Messages','out','System','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','index','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','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','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','ContactId','buildExpression','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','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?','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','QueryTypes','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','length','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function updateSmsInteraction(_0x2407f9,_0x3ae878,_0x1122db){return new BPromise(function(_0x33bdb7,_0x25ce3a){return getInteractionUsers(_0x2407f9,_0x1122db)['then'](function(_0x66c1d2){return getInteractionTags(_0x66c1d2,_0x3ae878);})[_0x0a9e('0x22')](function(_0x40cb85){_0x33bdb7(_0x40cb85);})[_0x0a9e('0x2d')](function(_0x2b45ea){_0x25ce3a(_0x2b45ea);});});}exports[_0x0a9e('0x2e')]=function(_0x332d35,_0x39e565){var _0x5583a4={},_0x44295a={},_0x5e7238={'count':0x0,'rows':[]};var _0x2cc7a0=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x567193){return{'name':_0x567193[_0x0a9e('0x32')],'type':_0x567193[_0x0a9e('0x33')][_0x0a9e('0x34')]};});_0x44295a[_0x0a9e('0x35')]=_['map'](_0x2cc7a0,'name');_0x44295a[_0x0a9e('0x36')]=_['keys'](_0x332d35[_0x0a9e('0x36')]);_0x44295a[_0x0a9e('0x37')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],_0x44295a['query']);_0x5583a4[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],qs['fields'](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]));_0x5583a4[_0x0a9e('0x39')]=_0x5583a4['attributes']['length']?_0x5583a4[_0x0a9e('0x39')]:_0x44295a[_0x0a9e('0x35')];if(!_0x332d35['query'][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x5583a4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x332d35['query']['limit']);_0x5583a4[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x332d35['query'][_0x0a9e('0x1c')]);}_0x5583a4[_0x0a9e('0x3d')]=qs[_0x0a9e('0x3e')](_0x332d35['query'][_0x0a9e('0x3e')]);_0x5583a4[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x40')](_0x332d35[_0x0a9e('0x36')],_0x44295a[_0x0a9e('0x37')]),_0x2cc7a0);var _0x2881b3=[];var _0x45a9b8=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x25'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')]('tools_tags');var _0x52628e=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')](_0x0a9e('0x45'))[_0x0a9e('0x42')](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x44')](_0x0a9e('0x48'),'ui')[_0x0a9e('0x49')](_0x0a9e('0x4a'),'u',_0x0a9e('0x4b'));var _0x5026aa=squel[_0x0a9e('0x41')]()[_0x0a9e('0x44')](_0x0a9e('0x4c'),'i')[_0x0a9e('0x49')](_0x0a9e('0x4d'),'c',_0x0a9e('0x4e'))[_0x0a9e('0x49')](_0x0a9e('0x4a'),'o','o.id\x20=\x20i.UserId')[_0x0a9e('0x49')]('sms_accounts','a',_0x0a9e('0x4f'))[_0x0a9e('0x49')](_0x0a9e('0x50'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x0a9e('0x49')](_0x0a9e('0x51'),'it',_0x0a9e('0x52'))[_0x0a9e('0x49')](_0x0a9e('0x53'),'t',_0x0a9e('0x54'));var _0x45bf7f=squel['expr']();var _0x13f44d=[];var _0x1bde3c=squel[_0x0a9e('0x55')]();var _0x16f976;if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]){_0x16f976=as[_0x0a9e('0x57')](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]);var _0x58a5c2=_0x16f976[_0x0a9e('0x58')];for(var _0x3fe430=0x0;_0x3fe430<_0x16f976['conditions']['length'];_0x3fe430++){var _0x5ddf84=_0x16f976[_0x0a9e('0x59')][_0x3fe430];var _0x4317e3='i';var _0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x5ddf84[_0x0a9e('0x42')]]);if(!_0x37edaa){switch(_0x5ddf84[_0x0a9e('0x42')]){case _0x0a9e('0x5b'):if(_0x5ddf84['value']==0x1){_0x5026aa['having']('`'+_0x5ddf84['field']+_0x0a9e('0x5c'));}else{_0x5026aa[_0x0a9e('0x5d')]('`'+_0x5ddf84[_0x0a9e('0x42')]+'`\x20>\x200');}break;case _0x0a9e('0x5e'):if(_0x5ddf84[_0x0a9e('0x5f')]==='$substring'){if(_0x5ddf84['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x45bf7f[_0x58a5c2](_0x0a9e('0x60'),qs['getFullTextValue'](_0x5ddf84[_0x0a9e('0x61')]),null);}else{var _0x3c20b2='%'+_0x5ddf84[_0x0a9e('0x61')]+'%';_0x45bf7f[_0x58a5c2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3c20b2,_0x3c20b2,_0x3c20b2);}}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),'ContactId']);_0x5ddf84['field']=_0x0a9e('0x62');_0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa['type'],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'Tag':var _0x5da27d=_0x5ddf84['value'][_0x0a9e('0x2b')](',')['map'](function(_0x2f7092){return Number(_0x2f7092);});_0x5da27d[_0x0a9e('0x2c')](function(_0x3cfd00){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x3cfd00+',%');});_0x13f44d=_[_0x0a9e('0x68')](_0x13f44d,_0x5da27d);break;case _0x0a9e('0x69'):if(_0x5ddf84[_0x0a9e('0x5f')]===_0x0a9e('0x6a')){_0x45bf7f[_0x58a5c2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5ddf84[_0x0a9e('0x61')]+'%',null);}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x0a9e('0x6b')]);_0x5ddf84[_0x0a9e('0x42')]=_0x0a9e('0x6b');_0x261adb=as['buildExpression'](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'body':_0x261adb=as['buildExpression']('me',null,_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb['text'],_0x261adb[_0x0a9e('0x61')]['start'],_0x261adb[_0x0a9e('0x61')][_0x0a9e('0x66')]);break;}}else{var _0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}}}else{var _0x1f07cb=_(_0x332d35[_0x0a9e('0x36')])['keys']()[_0x0a9e('0x2f')](function(_0x156f1c){return _[_0x0a9e('0x6c')](_0x2cc7a0,[_0x0a9e('0x25'),_0x156f1c])?_0x156f1c:undefined;})['compact']()[_0x0a9e('0x61')]();if(!_[_0x0a9e('0x6d')](_0x1f07cb)){_0x1f07cb['forEach'](function(_0x797b45){if(_0x797b45===_0x0a9e('0x6e')){_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x6f'),[][_0x0a9e('0x70')](_0x332d35['query'][_0x797b45]));}else if(_0x797b45===_0x0a9e('0x71')){var _0x2937e0=JSON[_0x0a9e('0x72')](_0x332d35['query'][_0x797b45])[_0x0a9e('0x73')];var _0x4f1e60=JSON['parse'](_0x332d35[_0x0a9e('0x36')][_0x797b45])[_0x0a9e('0x74')];_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x75'),_0x2937e0,_0x4f1e60);}else{if(_0x332d35[_0x0a9e('0x36')][_0x797b45]===_0x0a9e('0x76')){_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x77'));}else{_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x78'),_0x332d35[_0x0a9e('0x36')][_0x797b45]);}}});}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]==0x1){_0x5026aa[_0x0a9e('0x5d')](_0x0a9e('0x7a'));}else{_0x5026aa[_0x0a9e('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]){_0x13f44d=_[_0x0a9e('0x7c')](_0x332d35['query'][_0x0a9e('0x7b')])?_0x332d35[_0x0a9e('0x36')]['tag']:new Array(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]);_0x13f44d[_0x0a9e('0x2c')](function(_0x427946){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x427946+',%');});}if(_0x332d35['query']['filter']){var _0x4a2438=_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7d')][_0x0a9e('0x7e')]('\x5c','\x5c\x5c')[_0x0a9e('0x7e')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x7f')](_0x4a2438)){_0x45bf7f['or'](_0x0a9e('0x80'),_0x4a2438+'%')['or'](_0x0a9e('0x81'),_0x4a2438+'%');}else{_0x45bf7f['or'](_0x0a9e('0x82'),qs['getFullTextValue'](_0x4a2438))['or'](_0x0a9e('0x83'),_0x4a2438+'%');}}}_0x5026aa[_0x0a9e('0x3f')](_0x45bf7f);_0x5026aa[_0x0a9e('0x84')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x85')][_0x0a9e('0x86')],'raw':!![]};var _0x4c46c1=_0x5026aa[_0x0a9e('0x87')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x88'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5b'));if(_0x5583a4[_0x0a9e('0x3d')]){_0x5583a4[_0x0a9e('0x3d')][_0x0a9e('0x2c')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x89')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x5026aa[_0x0a9e('0x3d')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x13f44d)){_0x5026aa[_0x0a9e('0x5d')](_0x1bde3c);_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8b'),_0x13f44d);}BPromise[_0x0a9e('0x8c')]()[_0x0a9e('0x22')](function(){if(!_0x16f976){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return;_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8d'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x8d'));return;}if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]!==_0x0a9e('0x90'))return;return _0x332d35['user'][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x92'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x92'));}else{_0x4c46c1['where']('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));_0x5026aa[_0x0a9e('0x3f')]('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));}});})['then'](function(){if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]==='agent'&&!_0x16f976&&!_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x4c46c1[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x444f1f){_0x5e7238['count']=_0x444f1f[_0x0a9e('0x95')];if(_0x5e7238[_0x0a9e('0x1b')]===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x45a9b8['toString'](),_0x2bdc44)[_0x0a9e('0x22')](function(_0xf0db1){_0x2881b3=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x96')](_0x2bdc44,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]){_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x2c')](function(_0x5af453){_0x5026aa['field']('i.'+_0x5af453);});}else{_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x97'),_0x0a9e('0x5b'));_0x5026aa['field'](_0x0a9e('0x98'),_0x0a9e('0x99'));_0x5026aa['field']('a.mandatoryDisposition',_0x0a9e('0x9a'));_0x5026aa['field']('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');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9b'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9c'),_0x0a9e('0x9d'));_0x5026aa[_0x0a9e('0x42')]('c.lastName',_0x0a9e('0x9e'));_0x5026aa['field'](_0x0a9e('0x9f'),_0x0a9e('0xa0'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa1'),'Contact.phone');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x5026aa['field'](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x5026aa['field'](_0x0a9e('0xaa'),_0x0a9e('0x29'));}if(_0x5583a4['limit'])_0x5026aa[_0x0a9e('0x1d')](_0x5583a4[_0x0a9e('0x1d')]);if(_0x5583a4[_0x0a9e('0x1c')])_0x5026aa['offset'](_0x5583a4[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x36')](_0x5026aa[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x1f29bd){_0x52628e[_0x0a9e('0x3f')](_0x0a9e('0xab'),_[_0x0a9e('0x2f')](_0x1f29bd,'id'));return db[_0x0a9e('0x93')]['query'](_0x52628e[_0x0a9e('0x94')](),_0x2bdc44)[_0x0a9e('0x22')](function(_0x17f692){var _0x30ef6e=_[_0x0a9e('0xac')](_0x17f692,_0x0a9e('0xad'));var _0x6803d6=[];_0x1f29bd[_0x0a9e('0x2c')](function(_0x1808ba){_0x6803d6[_0x0a9e('0xae')](updateSmsInteraction(_0x1808ba,_0x2881b3,_0x30ef6e));});return BPromise[_0x0a9e('0xaf')](_0x6803d6);});});})[_0x0a9e('0x22')](function(_0x18273f){_0x5e7238['rows']=_0x18273f;return _0x5e7238;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x39e565,_0x5583a4))[_0x0a9e('0x2d')](handleError(_0x39e565,null));};exports[_0x0a9e('0xb0')]=function(_0x2ed526,_0xb0599a){var _0x5d9ddb={'raw':![],'where':{'id':_0x2ed526[_0x0a9e('0xb1')]['id']}},_0x3afc8c={};_0x3afc8c['model']=_[_0x0a9e('0xb2')](db['SmsInteraction'][_0x0a9e('0x31')]);_0x3afc8c[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x2ed526[_0x0a9e('0x36')]);_0x3afc8c['filters']=_[_0x0a9e('0x38')](_0x3afc8c['model'],_0x3afc8c[_0x0a9e('0x36')]);_0x5d9ddb[_0x0a9e('0x39')]=_['intersection'](_0x3afc8c[_0x0a9e('0x35')],qs[_0x0a9e('0x3a')](_0x2ed526[_0x0a9e('0x36')]['fields']));_0x5d9ddb['attributes']=_0x5d9ddb[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x5d9ddb[_0x0a9e('0x39')]:_0x3afc8c[_0x0a9e('0x35')];if(_0x2ed526[_0x0a9e('0x36')][_0x0a9e('0xb3')]){_0x5d9ddb[_0x0a9e('0xb4')]=[{'all':!![]}];}_0x5d9ddb=_[_0x0a9e('0x96')]({},_0x5d9ddb,_0x2ed526[_0x0a9e('0xb5')]);return db['SmsInteraction'][_0x0a9e('0x5a')](_0x5d9ddb)['then'](handleEntityNotFound(_0xb0599a,null))[_0x0a9e('0x22')](respondWithResult(_0xb0599a,null))[_0x0a9e('0x2d')](handleError(_0xb0599a,null));};exports[_0x0a9e('0xb6')]=function(_0x28ce92,_0x1b61d5){return db['SmsInteraction'][_0x0a9e('0xb6')](_0x28ce92[_0x0a9e('0xb7')],{})[_0x0a9e('0x22')](respondWithResult(_0x1b61d5,0xc9))[_0x0a9e('0x2d')](handleError(_0x1b61d5,null));};exports[_0x0a9e('0x20')]=function(_0x5c66ef,_0x4f074c){if(_0x5c66ef[_0x0a9e('0xb7')]['id']){delete _0x5c66ef['body']['id'];}return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x5c66ef[_0x0a9e('0xb1')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](saveUpdates(_0x5c66ef[_0x0a9e('0xb7')],null))['then'](respondWithResult(_0x4f074c,null))['catch'](handleError(_0x4f074c,null));};exports[_0x0a9e('0x21')]=function(_0x5dfbe2,_0x2469d1){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x5dfbe2['params']['id']}})['then'](handleEntityNotFound(_0x2469d1,null))[_0x0a9e('0x22')](removeEntity(_0x2469d1,null))[_0x0a9e('0x2d')](handleError(_0x2469d1,null));};exports['describe']=function(_0x170af6,_0x17cb30){return db[_0x0a9e('0x30')][_0x0a9e('0xb8')]()[_0x0a9e('0x22')](respondWithResult(_0x17cb30,null))['catch'](handleError(_0x17cb30,null));};exports['addMessage']=function(_0x16449b,_0x22286c,_0x41c8cd){return db[_0x0a9e('0xb9')][_0x0a9e('0x5a')]({'where':{'id':_0x16449b['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x22286c,null))[_0x0a9e('0x22')](function(_0x5416a9){if(_0x5416a9){return _0x5416a9[_0x0a9e('0xba')](_0x16449b[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_[_0x0a9e('0xbc')](_0x16449b[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x22286c,null))[_0x0a9e('0x2d')](handleError(_0x22286c,null));};exports[_0x0a9e('0xbd')]=function(_0x16afb3,_0x4bdebb,_0x1065a7){var _0x301047={'raw':![],'where':{}};var _0x2ada60={};var _0x1c4232={'count':0x0,'rows':[]};return db[_0x0a9e('0x30')]['findOne']({'where':{'id':_0x16afb3['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4bdebb,null))[_0x0a9e('0x22')](function(_0x466bbf){if(_0x466bbf){_0x2ada60[_0x0a9e('0x35')]=_[_0x0a9e('0xb2')](db['SmsMessage'][_0x0a9e('0x31')]);_0x2ada60[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x16afb3['query']);_0x2ada60[_0x0a9e('0x37')]=_['intersection'](_0x2ada60[_0x0a9e('0x35')],_0x2ada60['query']);_0x301047[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x2ada60[_0x0a9e('0x35')],qs['fields'](_0x16afb3[_0x0a9e('0x36')]['fields']));_0x301047[_0x0a9e('0x39')]=_0x301047[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x301047[_0x0a9e('0x39')]:_0x2ada60[_0x0a9e('0x35')];if(!_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x301047[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1d')]);_0x301047[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1c')]);}_0x301047['order']=qs['sort'](_0x16afb3[_0x0a9e('0x36')]['sort']);_0x301047[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_['pick'](_0x16afb3[_0x0a9e('0x36')],_0x2ada60[_0x0a9e('0x37')]));_0x301047[_0x0a9e('0x3f')][_0x0a9e('0xad')]=_0x466bbf['id'];if(_0x16afb3['query'][_0x0a9e('0x7d')]){_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047[_0x0a9e('0x3f')],{'$or':_['map'](_0x301047[_0x0a9e('0x39')],function(_0x1a0b08){var _0x2b7092={};_0x2b7092[_0x1a0b08]={'$like':'%'+_0x16afb3['query'][_0x0a9e('0x7d')]+'%'};return _0x2b7092;})});}if(_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')]){var _0x54b107=_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')][_0x0a9e('0x2b')](',');var _0x1a7f58={};_0x1a7f58[_0x54b107[0x0]]={'$gte':moment(_0x54b107[0x1])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047['where'],_0x1a7f58);}_0x301047=_[_0x0a9e('0x96')]({},_0x301047,_0x16afb3[_0x0a9e('0xb5')]);return db[_0x0a9e('0xb9')]['count']({'where':_0x301047['where']})['then'](function(_0x1015aa){_0x1c4232[_0x0a9e('0x1b')]=_0x1015aa;if(_0x16afb3['query'][_0x0a9e('0xb3')]){_0x301047[_0x0a9e('0xb4')]=[{'all':!![]}];}return db[_0x0a9e('0xb9')]['findAll'](_0x301047);})[_0x0a9e('0x22')](function(_0x30e037){_0x1c4232[_0x0a9e('0xbf')]=_0x30e037;return _0x1c4232;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4bdebb,_0x301047))[_0x0a9e('0x2d')](handleError(_0x4bdebb,null));};exports[_0x0a9e('0xc0')]=function(_0x40e6e7,_0x328ec5,_0x3b5bda){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x40e6e7['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x328ec5,null))[_0x0a9e('0x22')](function(_0x2097d8){if(_0x2097d8){return _0x2097d8[_0x0a9e('0xc1')](_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_['omit'](_0x40e6e7[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{})[_0x0a9e('0xc2')](function(){return db[_0x0a9e('0xc3')]['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x43')],'where':{'id':_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')]}});})[_0x0a9e('0x22')](function(_0x2be526){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]});return{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]};});}})['then'](respondWithResult(_0x328ec5,null))[_0x0a9e('0x2d')](handleError(_0x328ec5,null));};exports[_0x0a9e('0xc6')]=function(_0x2ff265,_0x26b826,_0xea8bd1){return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x2ff265[_0x0a9e('0xb1')]['id']}})['then'](handleEntityNotFound(_0x26b826,null))[_0x0a9e('0x22')](function(_0xd2391){if(_0xd2391){return _0xd2391[_0x0a9e('0xc6')](_0x2ff265['query'][_0x0a9e('0xbb')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x26b826,null))[_0x0a9e('0x2d')](handleError(_0x26b826,null));};exports[_0x0a9e('0xc7')]=function(_0x370b5e,_0x1ba457){var _0x424f1b=moment()[_0x0a9e('0xc8')]()[_0x0a9e('0x94')]();var _0x451010=path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xcb'),_0x0a9e('0xcc'));var _0x2b624e=path[_0x0a9e('0xcd')](config['root'],_0x0a9e('0xca'),'files','attachments');var _0x573df6=path[_0x0a9e('0xcd')](_0x451010,_0x424f1b);var _0x3fa3f2=util[_0x0a9e('0xbe')](_0x0a9e('0xce'),_0x370b5e['params']['id'],_0x424f1b);var _0x4156a5=path[_0x0a9e('0xcd')](_0x451010,_0x3fa3f2);var _0x3ddbc7=[];_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0x69')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xcf')],'as':_0x0a9e('0x5e'),'attributes':['id','firstName',_0x0a9e('0xd0')],'raw':!![]});var _0x248a9a=[{'model':db[_0x0a9e('0xb9')],'as':'Messages','attributes':['id',_0x0a9e('0xb7'),_0x0a9e('0x71'),_0x0a9e('0xd1'),'secret',_0x0a9e('0x79')],'include':_0x3ddbc7}];_0x248a9a[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xd2')],'as':'Account','attributes':['id','name']});_0x248a9a['push']({'model':db[_0x0a9e('0x69')],'as':_0x0a9e('0xd3'),'attributes':['id',_0x0a9e('0x28')]});return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x370b5e[_0x0a9e('0xb1')]['id']},'include':_0x248a9a})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x2ff2ab){if(_0x2ff2ab){var _0x242f23=_0x2ff2ab['get']({'plain':!![]});fs[_0x0a9e('0xd4')](_0x573df6);var _0x33a26c={'format':'A4','border':_0x0a9e('0xd5'),'header':{'height':'40px','contents':{'first':_0x0a9e('0xd6')}},'footer':{'height':'30px','contents':{'default':util[_0x0a9e('0xbe')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x0a9e('0xbe')]('%s\x20#%d',_0x0a9e('0xd7'),_0x242f23['id']),moment()[_0x0a9e('0xbe')](_0x0a9e('0xd8'))[_0x0a9e('0x94')]())}}};var _0x1e306c={'channel':_0x0a9e('0xd7'),'account':_0x242f23[_0x0a9e('0xd9')]['name'],'agent':_0x242f23[_0x0a9e('0xd3')]?_0x242f23[_0x0a9e('0xd3')]['fullname']:_0x0a9e('0xda'),'createdAt':moment(_0x242f23[_0x0a9e('0x71')])['format'](_0x0a9e('0xdb'))[_0x0a9e('0x94')](),'closedAt':_0x242f23[_0x0a9e('0xdc')]?moment(_0x242f23['closedAt'])[_0x0a9e('0xbe')](_0x0a9e('0xdb'))[_0x0a9e('0x94')]():'','disposition':_0x242f23[_0x0a9e('0xdd')],'messages':_(_0x242f23[_0x0a9e('0xde')])[_0x0a9e('0x7d')]({'secret':![]})[_0x0a9e('0x2f')](function(_0x74d9b8){return{'date':moment(_0x74d9b8[_0x0a9e('0x71')])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x94')](),'sender':_0x74d9b8['direction']===_0x0a9e('0xdf')?_0x74d9b8[_0x0a9e('0x69')]?_0x74d9b8[_0x0a9e('0x69')][_0x0a9e('0x28')]:_0x0a9e('0xe0'):_0x74d9b8[_0x0a9e('0x5e')]['firstName']+(_0x74d9b8[_0x0a9e('0x5e')][_0x0a9e('0xd0')]?'\x20'+_0x74d9b8[_0x0a9e('0x5e')]['lastName']:''),'body':_0x74d9b8[_0x0a9e('0xb7')],'direction':_0x74d9b8[_0x0a9e('0xd1')]===_0x0a9e('0xdf')?'A':'C','secret':_0x74d9b8[_0x0a9e('0xe1')],'read':_0x74d9b8[_0x0a9e('0x79')]};})[_0x0a9e('0x61')]()};return ejs[_0x0a9e('0xe2')](path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xe3'),_0x0a9e('0xe4')),{'interaction':_0x1e306c})[_0x0a9e('0x22')](function(_0x241404){return new BPromise(function(_0x8120e,_0x5d6a48){pdf['create'](_0x241404,_0x33a26c)[_0x0a9e('0xe5')](path[_0x0a9e('0xcd')](_0x573df6,_0x0a9e('0xe6')+_0x242f23['id']+'-'+_0x424f1b+_0x0a9e('0xe7')),function(_0x40e2da,_0x131da8){if(_0x40e2da)return _0x5d6a48(_0x40e2da);_0x8120e(_0x131da8);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x584854,_0x39ea62){zipdir(_0x573df6,{'saveTo':_0x4156a5},function(_0x1d7fc4,_0x2d8e91){if(_0x1d7fc4)return _0x39ea62(_0x1d7fc4);return _0x584854(_0x2d8e91);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1b1757,_0x3c6082){rimraf(_0x573df6,function(_0x16be7e){if(_0x16be7e)_0x3c6082(_0x16be7e);return _0x1b1757();});});})['then'](function(){return _0x1ba457[_0x0a9e('0xc7')](_0x4156a5,_0x3fa3f2,function(_0x294310){if(_0x294310){console[_0x0a9e('0xe8')]('err',_0x294310);}else{fs[_0x0a9e('0xe9')](_0x4156a5);}});});});}else{return _0x1ba457[_0x0a9e('0x23')](0xc8);}})[_0x0a9e('0x2d')](handleError(_0x1ba457,null));}; \ No newline at end of file +var _0xa9e0=['params','keys','includeAll','include','options','create','body','describe','SmsMessage','addMessage','ids','omit','getMessages','format','rows','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','lastName','direction','SmsAccount','Owner','mkdirSync','10px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','Sms','YYYY-MM-DD','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','Messages','out','System','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','index','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','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','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','ContactId','buildExpression','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','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?','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','QueryTypes','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','length','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','show'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function updateSmsInteraction(_0x2407f9,_0x3ae878,_0x1122db){return new BPromise(function(_0x33bdb7,_0x25ce3a){return getInteractionUsers(_0x2407f9,_0x1122db)['then'](function(_0x66c1d2){return getInteractionTags(_0x66c1d2,_0x3ae878);})[_0x0a9e('0x22')](function(_0x40cb85){_0x33bdb7(_0x40cb85);})[_0x0a9e('0x2d')](function(_0x2b45ea){_0x25ce3a(_0x2b45ea);});});}exports[_0x0a9e('0x2e')]=function(_0x332d35,_0x39e565){var _0x5583a4={},_0x44295a={},_0x5e7238={'count':0x0,'rows':[]};var _0x2cc7a0=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x567193){return{'name':_0x567193[_0x0a9e('0x32')],'type':_0x567193[_0x0a9e('0x33')][_0x0a9e('0x34')]};});_0x44295a[_0x0a9e('0x35')]=_['map'](_0x2cc7a0,'name');_0x44295a[_0x0a9e('0x36')]=_['keys'](_0x332d35[_0x0a9e('0x36')]);_0x44295a[_0x0a9e('0x37')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],_0x44295a['query']);_0x5583a4[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],qs['fields'](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]));_0x5583a4[_0x0a9e('0x39')]=_0x5583a4['attributes']['length']?_0x5583a4[_0x0a9e('0x39')]:_0x44295a[_0x0a9e('0x35')];if(!_0x332d35['query'][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x5583a4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x332d35['query']['limit']);_0x5583a4[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x332d35['query'][_0x0a9e('0x1c')]);}_0x5583a4[_0x0a9e('0x3d')]=qs[_0x0a9e('0x3e')](_0x332d35['query'][_0x0a9e('0x3e')]);_0x5583a4[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x40')](_0x332d35[_0x0a9e('0x36')],_0x44295a[_0x0a9e('0x37')]),_0x2cc7a0);var _0x2881b3=[];var _0x45a9b8=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x25'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')]('tools_tags');var _0x52628e=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')](_0x0a9e('0x45'))[_0x0a9e('0x42')](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x44')](_0x0a9e('0x48'),'ui')[_0x0a9e('0x49')](_0x0a9e('0x4a'),'u',_0x0a9e('0x4b'));var _0x5026aa=squel[_0x0a9e('0x41')]()[_0x0a9e('0x44')](_0x0a9e('0x4c'),'i')[_0x0a9e('0x49')](_0x0a9e('0x4d'),'c',_0x0a9e('0x4e'))[_0x0a9e('0x49')](_0x0a9e('0x4a'),'o','o.id\x20=\x20i.UserId')[_0x0a9e('0x49')]('sms_accounts','a',_0x0a9e('0x4f'))[_0x0a9e('0x49')](_0x0a9e('0x50'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x0a9e('0x49')](_0x0a9e('0x51'),'it',_0x0a9e('0x52'))[_0x0a9e('0x49')](_0x0a9e('0x53'),'t',_0x0a9e('0x54'));var _0x45bf7f=squel['expr']();var _0x13f44d=[];var _0x1bde3c=squel[_0x0a9e('0x55')]();var _0x16f976;if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]){_0x16f976=as[_0x0a9e('0x57')](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]);var _0x58a5c2=_0x16f976[_0x0a9e('0x58')];for(var _0x3fe430=0x0;_0x3fe430<_0x16f976['conditions']['length'];_0x3fe430++){var _0x5ddf84=_0x16f976[_0x0a9e('0x59')][_0x3fe430];var _0x4317e3='i';var _0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x5ddf84[_0x0a9e('0x42')]]);if(!_0x37edaa){switch(_0x5ddf84[_0x0a9e('0x42')]){case _0x0a9e('0x5b'):if(_0x5ddf84['value']==0x1){_0x5026aa['having']('`'+_0x5ddf84['field']+_0x0a9e('0x5c'));}else{_0x5026aa[_0x0a9e('0x5d')]('`'+_0x5ddf84[_0x0a9e('0x42')]+'`\x20>\x200');}break;case _0x0a9e('0x5e'):if(_0x5ddf84[_0x0a9e('0x5f')]==='$substring'){if(_0x5ddf84['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x45bf7f[_0x58a5c2](_0x0a9e('0x60'),qs['getFullTextValue'](_0x5ddf84[_0x0a9e('0x61')]),null);}else{var _0x3c20b2='%'+_0x5ddf84[_0x0a9e('0x61')]+'%';_0x45bf7f[_0x58a5c2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3c20b2,_0x3c20b2,_0x3c20b2);}}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),'ContactId']);_0x5ddf84['field']=_0x0a9e('0x62');_0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa['type'],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'Tag':var _0x5da27d=_0x5ddf84['value'][_0x0a9e('0x2b')](',')['map'](function(_0x2f7092){return Number(_0x2f7092);});_0x5da27d[_0x0a9e('0x2c')](function(_0x3cfd00){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x3cfd00+',%');});_0x13f44d=_[_0x0a9e('0x68')](_0x13f44d,_0x5da27d);break;case _0x0a9e('0x69'):if(_0x5ddf84[_0x0a9e('0x5f')]===_0x0a9e('0x6a')){_0x45bf7f[_0x58a5c2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5ddf84[_0x0a9e('0x61')]+'%',null);}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x0a9e('0x6b')]);_0x5ddf84[_0x0a9e('0x42')]=_0x0a9e('0x6b');_0x261adb=as['buildExpression'](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'body':_0x261adb=as['buildExpression']('me',null,_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb['text'],_0x261adb[_0x0a9e('0x61')]['start'],_0x261adb[_0x0a9e('0x61')][_0x0a9e('0x66')]);break;}}else{var _0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}}}else{var _0x1f07cb=_(_0x332d35[_0x0a9e('0x36')])['keys']()[_0x0a9e('0x2f')](function(_0x156f1c){return _[_0x0a9e('0x6c')](_0x2cc7a0,[_0x0a9e('0x25'),_0x156f1c])?_0x156f1c:undefined;})['compact']()[_0x0a9e('0x61')]();if(!_[_0x0a9e('0x6d')](_0x1f07cb)){_0x1f07cb['forEach'](function(_0x797b45){if(_0x797b45===_0x0a9e('0x6e')){_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x6f'),[][_0x0a9e('0x70')](_0x332d35['query'][_0x797b45]));}else if(_0x797b45===_0x0a9e('0x71')){var _0x2937e0=JSON[_0x0a9e('0x72')](_0x332d35['query'][_0x797b45])[_0x0a9e('0x73')];var _0x4f1e60=JSON['parse'](_0x332d35[_0x0a9e('0x36')][_0x797b45])[_0x0a9e('0x74')];_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x75'),_0x2937e0,_0x4f1e60);}else{if(_0x332d35[_0x0a9e('0x36')][_0x797b45]===_0x0a9e('0x76')){_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x77'));}else{_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x78'),_0x332d35[_0x0a9e('0x36')][_0x797b45]);}}});}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]==0x1){_0x5026aa[_0x0a9e('0x5d')](_0x0a9e('0x7a'));}else{_0x5026aa[_0x0a9e('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]){_0x13f44d=_[_0x0a9e('0x7c')](_0x332d35['query'][_0x0a9e('0x7b')])?_0x332d35[_0x0a9e('0x36')]['tag']:new Array(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]);_0x13f44d[_0x0a9e('0x2c')](function(_0x427946){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x427946+',%');});}if(_0x332d35['query']['filter']){var _0x4a2438=_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7d')][_0x0a9e('0x7e')]('\x5c','\x5c\x5c')[_0x0a9e('0x7e')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x7f')](_0x4a2438)){_0x45bf7f['or'](_0x0a9e('0x80'),_0x4a2438+'%')['or'](_0x0a9e('0x81'),_0x4a2438+'%');}else{_0x45bf7f['or'](_0x0a9e('0x82'),qs['getFullTextValue'](_0x4a2438))['or'](_0x0a9e('0x83'),_0x4a2438+'%');}}}_0x5026aa[_0x0a9e('0x3f')](_0x45bf7f);_0x5026aa[_0x0a9e('0x84')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x85')][_0x0a9e('0x86')],'raw':!![]};var _0x4c46c1=_0x5026aa[_0x0a9e('0x87')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x88'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5b'));if(_0x5583a4[_0x0a9e('0x3d')]){_0x5583a4[_0x0a9e('0x3d')][_0x0a9e('0x2c')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x89')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x5026aa[_0x0a9e('0x3d')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x13f44d)){_0x5026aa[_0x0a9e('0x5d')](_0x1bde3c);_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8b'),_0x13f44d);}BPromise[_0x0a9e('0x8c')]()[_0x0a9e('0x22')](function(){if(!_0x16f976){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return;_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8d'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x8d'));return;}if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]!==_0x0a9e('0x90'))return;return _0x332d35['user'][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x92'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x92'));}else{_0x4c46c1['where']('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));_0x5026aa[_0x0a9e('0x3f')]('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));}});})['then'](function(){if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]==='agent'&&!_0x16f976&&!_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x4c46c1[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x444f1f){_0x5e7238['count']=_0x444f1f[_0x0a9e('0x95')];if(_0x5e7238[_0x0a9e('0x1b')]===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x45a9b8['toString'](),_0x2bdc44)[_0x0a9e('0x22')](function(_0xf0db1){_0x2881b3=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x96')](_0x2bdc44,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]){_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x2c')](function(_0x5af453){_0x5026aa['field']('i.'+_0x5af453);});}else{_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x97'),_0x0a9e('0x5b'));_0x5026aa['field'](_0x0a9e('0x98'),_0x0a9e('0x99'));_0x5026aa['field']('a.mandatoryDisposition',_0x0a9e('0x9a'));_0x5026aa['field']('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');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9b'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9c'),_0x0a9e('0x9d'));_0x5026aa[_0x0a9e('0x42')]('c.lastName',_0x0a9e('0x9e'));_0x5026aa['field'](_0x0a9e('0x9f'),_0x0a9e('0xa0'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa1'),'Contact.phone');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x5026aa['field'](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x5026aa['field'](_0x0a9e('0xaa'),_0x0a9e('0x29'));}if(_0x5583a4['limit'])_0x5026aa[_0x0a9e('0x1d')](_0x5583a4[_0x0a9e('0x1d')]);if(_0x5583a4[_0x0a9e('0x1c')])_0x5026aa['offset'](_0x5583a4[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x36')](_0x5026aa[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x1f29bd){_0x52628e[_0x0a9e('0x3f')](_0x0a9e('0xab'),_[_0x0a9e('0x2f')](_0x1f29bd,'id'));return db[_0x0a9e('0x93')]['query'](_0x52628e[_0x0a9e('0x94')](),_0x2bdc44)[_0x0a9e('0x22')](function(_0x17f692){var _0x30ef6e=_[_0x0a9e('0xac')](_0x17f692,_0x0a9e('0xad'));var _0x6803d6=[];_0x1f29bd[_0x0a9e('0x2c')](function(_0x1808ba){_0x6803d6[_0x0a9e('0xae')](updateSmsInteraction(_0x1808ba,_0x2881b3,_0x30ef6e));});return BPromise[_0x0a9e('0xaf')](_0x6803d6);});});})[_0x0a9e('0x22')](function(_0x18273f){_0x5e7238['rows']=_0x18273f;return _0x5e7238;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x39e565,_0x5583a4))[_0x0a9e('0x2d')](handleError(_0x39e565,null));};exports[_0x0a9e('0xb0')]=function(_0x2ed526,_0xb0599a){var _0x5d9ddb={'raw':![],'where':{'id':_0x2ed526[_0x0a9e('0xb1')]['id']}},_0x3afc8c={};_0x3afc8c['model']=_[_0x0a9e('0xb2')](db['SmsInteraction'][_0x0a9e('0x31')]);_0x3afc8c[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x2ed526[_0x0a9e('0x36')]);_0x3afc8c['filters']=_[_0x0a9e('0x38')](_0x3afc8c['model'],_0x3afc8c[_0x0a9e('0x36')]);_0x5d9ddb[_0x0a9e('0x39')]=_['intersection'](_0x3afc8c[_0x0a9e('0x35')],qs[_0x0a9e('0x3a')](_0x2ed526[_0x0a9e('0x36')]['fields']));_0x5d9ddb['attributes']=_0x5d9ddb[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x5d9ddb[_0x0a9e('0x39')]:_0x3afc8c[_0x0a9e('0x35')];if(_0x2ed526[_0x0a9e('0x36')][_0x0a9e('0xb3')]){_0x5d9ddb[_0x0a9e('0xb4')]=[{'all':!![]}];}_0x5d9ddb=_[_0x0a9e('0x96')]({},_0x5d9ddb,_0x2ed526[_0x0a9e('0xb5')]);return db['SmsInteraction'][_0x0a9e('0x5a')](_0x5d9ddb)['then'](handleEntityNotFound(_0xb0599a,null))[_0x0a9e('0x22')](respondWithResult(_0xb0599a,null))[_0x0a9e('0x2d')](handleError(_0xb0599a,null));};exports[_0x0a9e('0xb6')]=function(_0x28ce92,_0x1b61d5){return db['SmsInteraction'][_0x0a9e('0xb6')](_0x28ce92[_0x0a9e('0xb7')],{})[_0x0a9e('0x22')](respondWithResult(_0x1b61d5,0xc9))[_0x0a9e('0x2d')](handleError(_0x1b61d5,null));};exports[_0x0a9e('0x20')]=function(_0x5c66ef,_0x4f074c){if(_0x5c66ef[_0x0a9e('0xb7')]['id']){delete _0x5c66ef['body']['id'];}return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x5c66ef[_0x0a9e('0xb1')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](saveUpdates(_0x5c66ef[_0x0a9e('0xb7')],null))['then'](respondWithResult(_0x4f074c,null))['catch'](handleError(_0x4f074c,null));};exports[_0x0a9e('0x21')]=function(_0x5dfbe2,_0x2469d1){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x5dfbe2['params']['id']}})['then'](handleEntityNotFound(_0x2469d1,null))[_0x0a9e('0x22')](removeEntity(_0x2469d1,null))[_0x0a9e('0x2d')](handleError(_0x2469d1,null));};exports['describe']=function(_0x170af6,_0x17cb30){return db[_0x0a9e('0x30')][_0x0a9e('0xb8')]()[_0x0a9e('0x22')](respondWithResult(_0x17cb30,null))['catch'](handleError(_0x17cb30,null));};exports['addMessage']=function(_0x16449b,_0x22286c,_0x41c8cd){return db[_0x0a9e('0xb9')][_0x0a9e('0x5a')]({'where':{'id':_0x16449b['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x22286c,null))[_0x0a9e('0x22')](function(_0x5416a9){if(_0x5416a9){return _0x5416a9[_0x0a9e('0xba')](_0x16449b[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_[_0x0a9e('0xbc')](_0x16449b[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x22286c,null))[_0x0a9e('0x2d')](handleError(_0x22286c,null));};exports[_0x0a9e('0xbd')]=function(_0x16afb3,_0x4bdebb,_0x1065a7){var _0x301047={'raw':![],'where':{}};var _0x2ada60={};var _0x1c4232={'count':0x0,'rows':[]};return db[_0x0a9e('0x30')]['findOne']({'where':{'id':_0x16afb3['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4bdebb,null))[_0x0a9e('0x22')](function(_0x466bbf){if(_0x466bbf){_0x2ada60[_0x0a9e('0x35')]=_[_0x0a9e('0xb2')](db['SmsMessage'][_0x0a9e('0x31')]);_0x2ada60[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x16afb3['query']);_0x2ada60[_0x0a9e('0x37')]=_['intersection'](_0x2ada60[_0x0a9e('0x35')],_0x2ada60['query']);_0x301047[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x2ada60[_0x0a9e('0x35')],qs['fields'](_0x16afb3[_0x0a9e('0x36')]['fields']));_0x301047[_0x0a9e('0x39')]=_0x301047[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x301047[_0x0a9e('0x39')]:_0x2ada60[_0x0a9e('0x35')];if(!_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x301047[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1d')]);_0x301047[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1c')]);}_0x301047['order']=qs['sort'](_0x16afb3[_0x0a9e('0x36')]['sort']);_0x301047[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_['pick'](_0x16afb3[_0x0a9e('0x36')],_0x2ada60[_0x0a9e('0x37')]));_0x301047[_0x0a9e('0x3f')][_0x0a9e('0xad')]=_0x466bbf['id'];if(_0x16afb3['query'][_0x0a9e('0x7d')]){_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047[_0x0a9e('0x3f')],{'$or':_['map'](_0x301047[_0x0a9e('0x39')],function(_0x1a0b08){var _0x2b7092={};_0x2b7092[_0x1a0b08]={'$like':'%'+_0x16afb3['query'][_0x0a9e('0x7d')]+'%'};return _0x2b7092;})});}if(_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')]){var _0x54b107=_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')][_0x0a9e('0x2b')](',');var _0x1a7f58={};_0x1a7f58[_0x54b107[0x0]]={'$gte':moment(_0x54b107[0x1])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047['where'],_0x1a7f58);}_0x301047=_[_0x0a9e('0x96')]({},_0x301047,_0x16afb3[_0x0a9e('0xb5')]);return db[_0x0a9e('0xb9')]['count']({'where':_0x301047['where']})['then'](function(_0x1015aa){_0x1c4232[_0x0a9e('0x1b')]=_0x1015aa;if(_0x16afb3['query'][_0x0a9e('0xb3')]){_0x301047[_0x0a9e('0xb4')]=[{'all':!![]}];}return db[_0x0a9e('0xb9')]['findAll'](_0x301047);})[_0x0a9e('0x22')](function(_0x30e037){_0x1c4232[_0x0a9e('0xbf')]=_0x30e037;return _0x1c4232;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4bdebb,_0x301047))[_0x0a9e('0x2d')](handleError(_0x4bdebb,null));};exports[_0x0a9e('0xc0')]=function(_0x40e6e7,_0x328ec5,_0x3b5bda){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x40e6e7['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x328ec5,null))[_0x0a9e('0x22')](function(_0x2097d8){if(_0x2097d8){return _0x2097d8[_0x0a9e('0xc1')](_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_['omit'](_0x40e6e7[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{})[_0x0a9e('0xc2')](function(){return db[_0x0a9e('0xc3')]['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x43')],'where':{'id':_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')]}});})[_0x0a9e('0x22')](function(_0x2be526){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]});return{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]};});}})['then'](respondWithResult(_0x328ec5,null))[_0x0a9e('0x2d')](handleError(_0x328ec5,null));};exports[_0x0a9e('0xc6')]=function(_0x2ff265,_0x26b826,_0xea8bd1){return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x2ff265[_0x0a9e('0xb1')]['id']}})['then'](handleEntityNotFound(_0x26b826,null))[_0x0a9e('0x22')](function(_0xd2391){if(_0xd2391){return _0xd2391[_0x0a9e('0xc6')](_0x2ff265['query'][_0x0a9e('0xbb')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x26b826,null))[_0x0a9e('0x2d')](handleError(_0x26b826,null));};exports[_0x0a9e('0xc7')]=function(_0x370b5e,_0x1ba457){var _0x424f1b=moment()[_0x0a9e('0xc8')]()[_0x0a9e('0x94')]();var _0x451010=path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xcb'),_0x0a9e('0xcc'));var _0x2b624e=path[_0x0a9e('0xcd')](config['root'],_0x0a9e('0xca'),'files','attachments');var _0x573df6=path[_0x0a9e('0xcd')](_0x451010,_0x424f1b);var _0x3fa3f2=util[_0x0a9e('0xbe')](_0x0a9e('0xce'),_0x370b5e['params']['id'],_0x424f1b);var _0x4156a5=path[_0x0a9e('0xcd')](_0x451010,_0x3fa3f2);var _0x3ddbc7=[];_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0x69')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xcf')],'as':_0x0a9e('0x5e'),'attributes':['id','firstName',_0x0a9e('0xd0')],'raw':!![]});var _0x248a9a=[{'model':db[_0x0a9e('0xb9')],'as':'Messages','attributes':['id',_0x0a9e('0xb7'),_0x0a9e('0x71'),_0x0a9e('0xd1'),'secret',_0x0a9e('0x79')],'include':_0x3ddbc7}];_0x248a9a[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xd2')],'as':'Account','attributes':['id','name']});_0x248a9a['push']({'model':db[_0x0a9e('0x69')],'as':_0x0a9e('0xd3'),'attributes':['id',_0x0a9e('0x28')]});return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x370b5e[_0x0a9e('0xb1')]['id']},'include':_0x248a9a})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x2ff2ab){if(_0x2ff2ab){var _0x242f23=_0x2ff2ab['get']({'plain':!![]});fs[_0x0a9e('0xd4')](_0x573df6);var _0x33a26c={'format':'A4','border':_0x0a9e('0xd5'),'header':{'height':'40px','contents':{'first':_0x0a9e('0xd6')}},'footer':{'height':'30px','contents':{'default':util[_0x0a9e('0xbe')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x0a9e('0xbe')]('%s\x20#%d',_0x0a9e('0xd7'),_0x242f23['id']),moment()[_0x0a9e('0xbe')](_0x0a9e('0xd8'))[_0x0a9e('0x94')]())}}};var _0x1e306c={'channel':_0x0a9e('0xd7'),'account':_0x242f23[_0x0a9e('0xd9')]['name'],'agent':_0x242f23[_0x0a9e('0xd3')]?_0x242f23[_0x0a9e('0xd3')]['fullname']:_0x0a9e('0xda'),'createdAt':moment(_0x242f23[_0x0a9e('0x71')])['format'](_0x0a9e('0xdb'))[_0x0a9e('0x94')](),'closedAt':_0x242f23[_0x0a9e('0xdc')]?moment(_0x242f23['closedAt'])[_0x0a9e('0xbe')](_0x0a9e('0xdb'))[_0x0a9e('0x94')]():'','disposition':_0x242f23[_0x0a9e('0xdd')],'messages':_(_0x242f23[_0x0a9e('0xde')])[_0x0a9e('0x7d')]({'secret':![]})[_0x0a9e('0x2f')](function(_0x74d9b8){return{'date':moment(_0x74d9b8[_0x0a9e('0x71')])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x94')](),'sender':_0x74d9b8['direction']===_0x0a9e('0xdf')?_0x74d9b8[_0x0a9e('0x69')]?_0x74d9b8[_0x0a9e('0x69')][_0x0a9e('0x28')]:_0x0a9e('0xe0'):_0x74d9b8[_0x0a9e('0x5e')]['firstName']+(_0x74d9b8[_0x0a9e('0x5e')][_0x0a9e('0xd0')]?'\x20'+_0x74d9b8[_0x0a9e('0x5e')]['lastName']:''),'body':_0x74d9b8[_0x0a9e('0xb7')],'direction':_0x74d9b8[_0x0a9e('0xd1')]===_0x0a9e('0xdf')?'A':'C','secret':_0x74d9b8[_0x0a9e('0xe1')],'read':_0x74d9b8[_0x0a9e('0x79')]};})[_0x0a9e('0x61')]()};return ejs[_0x0a9e('0xe2')](path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xe3'),_0x0a9e('0xe4')),{'interaction':_0x1e306c})[_0x0a9e('0x22')](function(_0x241404){return new BPromise(function(_0x8120e,_0x5d6a48){pdf['create'](_0x241404,_0x33a26c)[_0x0a9e('0xe5')](path[_0x0a9e('0xcd')](_0x573df6,_0x0a9e('0xe6')+_0x242f23['id']+'-'+_0x424f1b+_0x0a9e('0xe7')),function(_0x40e2da,_0x131da8){if(_0x40e2da)return _0x5d6a48(_0x40e2da);_0x8120e(_0x131da8);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x584854,_0x39ea62){zipdir(_0x573df6,{'saveTo':_0x4156a5},function(_0x1d7fc4,_0x2d8e91){if(_0x1d7fc4)return _0x39ea62(_0x1d7fc4);return _0x584854(_0x2d8e91);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1b1757,_0x3c6082){rimraf(_0x573df6,function(_0x16be7e){if(_0x16be7e)_0x3c6082(_0x16be7e);return _0x1b1757();});});})['then'](function(){return _0x1ba457[_0x0a9e('0xc7')](_0x4156a5,_0x3fa3f2,function(_0x294310){if(_0x294310){console[_0x0a9e('0xe8')]('err',_0x294310);}else{fs[_0x0a9e('0xe9')](_0x4156a5);}});});});}else{return _0x1ba457[_0x0a9e('0x23')](0xc8);}})[_0x0a9e('0x2d')](handleError(_0x1ba457,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index f5c5b79..f67c82d 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 _0xbd50=['SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','findAll','unreadMessages','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0xbd50,0x196));var _0x0bd5=function(_0x435b0c,_0x23372c){_0x435b0c=_0x435b0c-0x0;var _0x3e3f55=_0xbd50[_0x435b0c];return _0x3e3f55;};'use strict';var EventEmitter=require(_0x0bd5('0x0'));var SmsInteraction=require(_0x0bd5('0x1'))['db'][_0x0bd5('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0x0bd5('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x0bd5('0x4')](0x0);var events={'afterCreate':_0x0bd5('0x5'),'afterUpdate':_0x0bd5('0x6'),'afterDestroy':_0x0bd5('0x7')};function emitEvent(_0x4c17ee){return function(_0x558e89,_0x560cf1,_0x376024){_0x558e89[_0x0bd5('0x8')]({'attributes':['id'],'raw':!![]})[_0x0bd5('0x9')](function(_0x2c0db1){_0x558e89[_0x0bd5('0xa')]('Users',_0x2c0db1['map'](function(_0x1a5cb9){return{'id':_0x1a5cb9['id']};}));return SmsMessage[_0x0bd5('0xb')]({'where':{'SmsInteractionId':_0x558e89['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0bd5('0x9')](function(_0x5f5a0c){_0x558e89[_0x0bd5('0xa')](_0x0bd5('0xc'),_0x5f5a0c['length']);SmsInteractionEvents[_0x0bd5('0xd')](_0x4c17ee+':'+_0x558e89['id'],_0x558e89);SmsInteractionEvents[_0x0bd5('0xd')](_0x4c17ee,_0x558e89);_0x376024(null);})['catch'](_0x376024(null));};}for(var e in events){if(events[_0x0bd5('0xe')](e)){var event=events[e];SmsInteraction[_0x0bd5('0xf')](e,emitEvent(event));}}module[_0x0bd5('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0x032e=['catch','hasOwnProperty','hook','exports','events','SmsInteraction','../../mysqldb','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x032e,0x124));var _0xe032=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x032e[_0x2b5eae];return _0x5f3ac9;};'use strict';var EventEmitter=require(_0xe032('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xe032('0x1')];var SmsMessage=require(_0xe032('0x2'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe032('0x3'),'afterUpdate':_0xe032('0x4'),'afterDestroy':_0xe032('0x5')};function emitEvent(_0x1983cc){return function(_0x306f3d,_0x420020,_0x2ba8a0){_0x306f3d[_0xe032('0x6')]({'attributes':['id'],'raw':!![]})[_0xe032('0x7')](function(_0x1576c8){_0x306f3d[_0xe032('0x8')](_0xe032('0x9'),_0x1576c8[_0xe032('0xa')](function(_0x3b0ef8){return{'id':_0x3b0ef8['id']};}));return SmsMessage[_0xe032('0xb')]({'where':{'SmsInteractionId':_0x306f3d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe032('0x7')](function(_0x2dc9e5){_0x306f3d[_0xe032('0x8')]('unreadMessages',_0x2dc9e5[_0xe032('0xc')]);SmsInteractionEvents[_0xe032('0xd')](_0x1983cc+':'+_0x306f3d['id'],_0x306f3d);SmsInteractionEvents[_0xe032('0xd')](_0x1983cc,_0x306f3d);_0x2ba8a0(null);})[_0xe032('0xe')](_0x2ba8a0(null));};}for(var e in events){if(events[_0xe032('0xf')](e)){var event=events[e];SmsInteraction[_0xe032('0x10')](e,emitEvent(event));}}module[_0xe032('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 2a59c81..45622f6 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 _0x0e8e=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closedAt'];(function(_0x21b037,_0x1f310a){var _0x20556c=function(_0x1855a9){while(--_0x1855a9){_0x21b037['push'](_0x21b037['shift']());}};_0x20556c(++_0x1f310a);}(_0x0e8e,0x1c1));var _0xe0e8=function(_0x5581ec,_0x27182c){_0x5581ec=_0x5581ec-0x0;var _0x43249b=_0x0e8e[_0x5581ec];return _0x43249b;};'use strict';var _=require(_0xe0e8('0x0'));var util=require(_0xe0e8('0x1'));var logger=require('../../config/logger')(_0xe0e8('0x2'));var moment=require(_0xe0e8('0x3'));var BPromise=require(_0xe0e8('0x4'));var rp=require(_0xe0e8('0x5'));var fs=require('fs');var path=require(_0xe0e8('0x6'));var rimraf=require(_0xe0e8('0x7'));var config=require(_0xe0e8('0x8'));var attributes=require(_0xe0e8('0x9'));module['exports']=function(_0xd94114,_0x13a055){return _0xd94114[_0xe0e8('0xa')](_0xe0e8('0xb'),attributes,{'tableName':_0xe0e8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x48459c,_0x5166d9,_0x4cb7d4){if(_0x48459c[_0xe0e8('0xd')]('closed')){_0x48459c[_0xe0e8('0xe')]=moment()['format'](_0xe0e8('0xf'));}_0x4cb7d4(null,_0x48459c);}}});}; \ No newline at end of file +var _0xd1ac=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','format'];(function(_0x22fd6a,_0x50be64){var _0x31a7fe=function(_0x3dae06){while(--_0x3dae06){_0x22fd6a['push'](_0x22fd6a['shift']());}};_0x31a7fe(++_0x50be64);}(_0xd1ac,0x18d));var _0xcd1a=function(_0x2f8b3d,_0x408d44){_0x2f8b3d=_0x2f8b3d-0x0;var _0xfe9e29=_0xd1ac[_0x2f8b3d];return _0xfe9e29;};'use strict';var _=require(_0xcd1a('0x0'));var util=require(_0xcd1a('0x1'));var logger=require('../../config/logger')(_0xcd1a('0x2'));var moment=require(_0xcd1a('0x3'));var BPromise=require(_0xcd1a('0x4'));var rp=require(_0xcd1a('0x5'));var fs=require('fs');var path=require(_0xcd1a('0x6'));var rimraf=require(_0xcd1a('0x7'));var config=require(_0xcd1a('0x8'));var attributes=require(_0xcd1a('0x9'));module[_0xcd1a('0xa')]=function(_0x1a3d79,_0x1a0298){return _0x1a3d79['define'](_0xcd1a('0xb'),attributes,{'tableName':_0xcd1a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x290cbb,_0x3e9c57,_0x2f4849){if(_0x290cbb[_0xcd1a('0xd')](_0xcd1a('0xe'))){_0x290cbb[_0xcd1a('0xf')]=moment()[_0xcd1a('0x10')](_0xcd1a('0x11'));}_0x2f4849(null,_0x290cbb);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index e60ea2f..c0016fc 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 _0xbb05=['result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','limit','stringify','AddTagsToSmsInteraction','where','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent'];(function(_0x581c2c,_0x51783d){var _0x110224=function(_0x11bb54){while(--_0x11bb54){_0x581c2c['push'](_0x581c2c['shift']());}};_0x110224(++_0x51783d);}(_0xbb05,0x1dc));var _0x5bb0=function(_0x4cff82,_0x4c2d2c){_0x4cff82=_0x4cff82-0x0;var _0x385730=_0xbb05[_0x4cff82];return _0x385730;};'use strict';var _=require(_0x5bb0('0x0'));var util=require(_0x5bb0('0x1'));var moment=require(_0x5bb0('0x2'));var BPromise=require(_0x5bb0('0x3'));var rs=require(_0x5bb0('0x4'));var fs=require('fs');var Redis=require(_0x5bb0('0x5'));var db=require(_0x5bb0('0x6'))['db'];var utils=require(_0x5bb0('0x7'));var logger=require(_0x5bb0('0x8'))(_0x5bb0('0x9'));var config=require(_0x5bb0('0xa'));var jayson=require(_0x5bb0('0xb'));var client=jayson[_0x5bb0('0xc')][_0x5bb0('0xd')]({'port':0x232a});config[_0x5bb0('0xe')]=_[_0x5bb0('0xf')](config[_0x5bb0('0xe')],{'host':_0x5bb0('0x10'),'port':0x18eb});var socket=require(_0x5bb0('0x11'))(new Redis(config[_0x5bb0('0xe')]));require(_0x5bb0('0x12'))[_0x5bb0('0x13')](socket);function respondWithRpcPromise(_0xf451a4,_0x237f11,_0x3fae80){return new BPromise(function(_0x1e50ca,_0x8926ae){return client[_0x5bb0('0x14')](_0xf451a4,_0x3fae80)[_0x5bb0('0x15')](function(_0x18187a){logger[_0x5bb0('0x16')](_0x5bb0('0x17'),_0x237f11,'request\x20sent');logger[_0x5bb0('0x18')](_0x5bb0('0x19'),_0x237f11,'request\x20sent',JSON['stringify'](_0x18187a));if(_0x18187a[_0x5bb0('0x1a')]){if(_0x18187a['error'][_0x5bb0('0x1b')]===0x1f4){logger[_0x5bb0('0x1a')]('SmsInteraction,\x20%s,\x20%s',_0x237f11,_0x18187a[_0x5bb0('0x1a')][_0x5bb0('0x1c')]);return _0x8926ae(_0x18187a[_0x5bb0('0x1a')][_0x5bb0('0x1c')]);}logger[_0x5bb0('0x1a')]('SmsInteraction,\x20%s,\x20%s',_0x237f11,_0x18187a[_0x5bb0('0x1a')][_0x5bb0('0x1c')]);return _0x1e50ca(_0x18187a[_0x5bb0('0x1a')][_0x5bb0('0x1c')]);}else{logger[_0x5bb0('0x16')](_0x5bb0('0x17'),_0x237f11,_0x5bb0('0x1d'));_0x1e50ca(_0x18187a[_0x5bb0('0x1e')][_0x5bb0('0x1c')]);}})[_0x5bb0('0x1f')](function(_0x25d5f2){logger[_0x5bb0('0x1a')](_0x5bb0('0x17'),_0x237f11,_0x25d5f2);_0x8926ae(_0x25d5f2);});});}exports[_0x5bb0('0x20')]=function(_0x2fb4d0){var _0x529c76=this;return new Promise(function(_0x25b5e7,_0x202520){return db[_0x5bb0('0x21')][_0x5bb0('0x22')](_0x2fb4d0[_0x5bb0('0x23')],{'raw':_0x2fb4d0[_0x5bb0('0x24')]?_0x2fb4d0[_0x5bb0('0x24')][_0x5bb0('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fb4d0[_0x5bb0('0x24')]?_0x2fb4d0[_0x5bb0('0x24')]['where']||null:null,'attributes':_0x2fb4d0['options']?_0x2fb4d0[_0x5bb0('0x24')]['attributes']||null:null,'limit':_0x2fb4d0[_0x5bb0('0x24')]?_0x2fb4d0[_0x5bb0('0x24')][_0x5bb0('0x26')]||null:null})[_0x5bb0('0x15')](function(_0x46243f){logger['info'](_0x5bb0('0x20'),_0x2fb4d0);logger['debug'](_0x5bb0('0x20'),_0x2fb4d0,JSON[_0x5bb0('0x27')](_0x46243f));_0x25b5e7(_0x46243f);})['catch'](function(_0x3857c3){logger[_0x5bb0('0x1a')](_0x5bb0('0x20'),_0x3857c3['message'],_0x2fb4d0);_0x202520(_0x529c76[_0x5bb0('0x1a')](0x1f4,_0x3857c3['message']));});});};exports[_0x5bb0('0x28')]=function(_0x30f40a){return new Promise(function(_0x2a2e48,_0x3e4590){return db[_0x5bb0('0x21')]['find']({'where':_0x30f40a[_0x5bb0('0x24')]?_0x30f40a[_0x5bb0('0x24')][_0x5bb0('0x29')]||null:null})[_0x5bb0('0x15')](function(_0x19d16f){if(_0x19d16f){return _0x19d16f[_0x5bb0('0x2a')](_0x30f40a[_0x5bb0('0x23')][_0x5bb0('0x2b')],_[_0x5bb0('0x2c')](_0x30f40a['body'],['ids','id'])||{});}})['spread'](function(_0x221a23){logger[_0x5bb0('0x16')](_0x5bb0('0x2d'),_0x30f40a);logger[_0x5bb0('0x18')](_0x5bb0('0x2d'),_0x30f40a,JSON[_0x5bb0('0x27')](_0x221a23));_0x2a2e48(_0x221a23);})[_0x5bb0('0x1f')](function(_0x48fb89){logger[_0x5bb0('0x1a')]('AddTags',_0x48fb89[_0x5bb0('0x1c')],_0x30f40a);_0x3e4590(_this[_0x5bb0('0x1a')](0x1f4,_0x48fb89[_0x5bb0('0x1c')]));});});}; \ No newline at end of file +var _0x284c=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./smsInteraction.socket','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateSmsInteraction','SmsInteraction','update','options','raw','attributes','limit','then','catch','AddTagsToSmsInteraction','where','body','omit','ids','spread','AddTags','lodash'];(function(_0x3185b0,_0x52d2a5){var _0x52a45b=function(_0x5ad24a){while(--_0x5ad24a){_0x3185b0['push'](_0x3185b0['shift']());}};_0x52a45b(++_0x52d2a5);}(_0x284c,0x182));var _0xc284=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x284c[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xc284('0x0'));var util=require(_0xc284('0x1'));var moment=require(_0xc284('0x2'));var BPromise=require(_0xc284('0x3'));var rs=require(_0xc284('0x4'));var fs=require('fs');var Redis=require(_0xc284('0x5'));var db=require(_0xc284('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc284('0x7'));var config=require(_0xc284('0x8'));var jayson=require(_0xc284('0x9'));var client=jayson[_0xc284('0xa')][_0xc284('0xb')]({'port':0x232a});config['redis']=_[_0xc284('0xc')](config['redis'],{'host':_0xc284('0xd'),'port':0x18eb});var socket=require(_0xc284('0xe'))(new Redis(config[_0xc284('0xf')]));require(_0xc284('0x10'))['register'](socket);function respondWithRpcPromise(_0x13bb62,_0xe1a5fb,_0x3fe639){return new BPromise(function(_0x212b34,_0x115035){return client[_0xc284('0x11')](_0x13bb62,_0x3fe639)['then'](function(_0x2dacb0){logger[_0xc284('0x12')](_0xc284('0x13'),_0xe1a5fb,_0xc284('0x14'));logger[_0xc284('0x15')](_0xc284('0x16'),_0xe1a5fb,'request\x20sent',JSON[_0xc284('0x17')](_0x2dacb0));if(_0x2dacb0['error']){if(_0x2dacb0[_0xc284('0x18')][_0xc284('0x19')]===0x1f4){logger['error'](_0xc284('0x13'),_0xe1a5fb,_0x2dacb0[_0xc284('0x18')][_0xc284('0x1a')]);return _0x115035(_0x2dacb0['error'][_0xc284('0x1a')]);}logger[_0xc284('0x18')]('SmsInteraction,\x20%s,\x20%s',_0xe1a5fb,_0x2dacb0['error'][_0xc284('0x1a')]);return _0x212b34(_0x2dacb0[_0xc284('0x18')][_0xc284('0x1a')]);}else{logger[_0xc284('0x12')](_0xc284('0x13'),_0xe1a5fb,_0xc284('0x14'));_0x212b34(_0x2dacb0['result'][_0xc284('0x1a')]);}})['catch'](function(_0x11fc5e){logger[_0xc284('0x18')](_0xc284('0x13'),_0xe1a5fb,_0x11fc5e);_0x115035(_0x11fc5e);});});}exports[_0xc284('0x1b')]=function(_0x163369){var _0x492e24=this;return new Promise(function(_0x509c04,_0x16bf06){return db[_0xc284('0x1c')][_0xc284('0x1d')](_0x163369['body'],{'raw':_0x163369[_0xc284('0x1e')]?_0x163369[_0xc284('0x1e')][_0xc284('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x163369['options']?_0x163369[_0xc284('0x1e')]['where']||null:null,'attributes':_0x163369['options']?_0x163369[_0xc284('0x1e')][_0xc284('0x20')]||null:null,'limit':_0x163369[_0xc284('0x1e')]?_0x163369[_0xc284('0x1e')][_0xc284('0x21')]||null:null})[_0xc284('0x22')](function(_0x1df70e){logger['info'](_0xc284('0x1b'),_0x163369);logger[_0xc284('0x15')](_0xc284('0x1b'),_0x163369,JSON[_0xc284('0x17')](_0x1df70e));_0x509c04(_0x1df70e);})[_0xc284('0x23')](function(_0x3d8d93){logger[_0xc284('0x18')](_0xc284('0x1b'),_0x3d8d93['message'],_0x163369);_0x16bf06(_0x492e24[_0xc284('0x18')](0x1f4,_0x3d8d93[_0xc284('0x1a')]));});});};exports[_0xc284('0x24')]=function(_0x426a3e){return new Promise(function(_0x3547ff,_0xa452d5){return db[_0xc284('0x1c')]['find']({'where':_0x426a3e[_0xc284('0x1e')]?_0x426a3e[_0xc284('0x1e')][_0xc284('0x25')]||null:null})['then'](function(_0x39303f){if(_0x39303f){return _0x39303f['addTags'](_0x426a3e[_0xc284('0x26')]['ids'],_[_0xc284('0x27')](_0x426a3e['body'],[_0xc284('0x28'),'id'])||{});}})[_0xc284('0x29')](function(_0x548ab8){logger['info'](_0xc284('0x2a'),_0x426a3e);logger[_0xc284('0x15')](_0xc284('0x2a'),_0x426a3e,JSON['stringify'](_0x548ab8));_0x3547ff(_0x548ab8);})[_0xc284('0x23')](function(_0x2bf08a){logger[_0xc284('0x18')]('AddTags',_0x2bf08a['message'],_0x426a3e);_0xa452d5(_this[_0xc284('0x18')](0x1f4,_0x2bf08a[_0xc284('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 0f8c74e..f5ea70e 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 _0x2032=['save','remove','update','removeListener','register','length','smsInteraction:'];(function(_0x135904,_0x1e252b){var _0x1ce7d5=function(_0x25a721){while(--_0x25a721){_0x135904['push'](_0x135904['shift']());}};_0x1ce7d5(++_0x1e252b);}(_0x2032,0xd9));var _0x2203=function(_0x5d6ce5,_0x3d5cb6){_0x5d6ce5=_0x5d6ce5-0x0;var _0x57d926=_0x2032[_0x5d6ce5];return _0x57d926;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2203('0x0'),_0x2203('0x1'),_0x2203('0x2')];function createListener(_0x4c28da,_0x486390){return function(_0x228a29){_0x486390['emit'](_0x4c28da,_0x228a29);};}function removeListener(_0x46c49a,_0x880dcd){return function(){SmsInteractionEvents[_0x2203('0x3')](_0x46c49a,_0x880dcd);};}exports[_0x2203('0x4')]=function(_0x3f7ba1){for(var _0x13367a=0x0,_0x2e0f63=events[_0x2203('0x5')];_0x13367a<_0x2e0f63;_0x13367a++){var _0x18c4d6=events[_0x13367a];var _0x2049ff=createListener(_0x2203('0x6')+_0x18c4d6,_0x3f7ba1);SmsInteractionEvents['on'](_0x18c4d6,_0x2049ff);}}; \ No newline at end of file +var _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x22d944,_0x4a9133){var _0xf640af=function(_0x36c0af){while(--_0x36c0af){_0x22d944['push'](_0x22d944['shift']());}};_0xf640af(++_0x4a9133);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x65f6('0x0'),'remove',_0x65f6('0x1')];function createListener(_0x2f06ae,_0x3461cd){return function(_0xbce843){_0x3461cd[_0x65f6('0x2')](_0x2f06ae,_0xbce843);};}function removeListener(_0x5eb9ad,_0x3c5029){return function(){SmsInteractionEvents['removeListener'](_0x5eb9ad,_0x3c5029);};}exports[_0x65f6('0x3')]=function(_0x22b017){for(var _0x4ec221=0x0,_0x4ed98f=events[_0x65f6('0x4')];_0x4ec221<_0x4ed98f;_0x4ec221++){var _0x2c6571=events[_0x4ec221];var _0x112079=createListener(_0x65f6('0x5')+_0x2c6571,_0x22b017);SmsInteractionEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index d02ee19..4007604 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 _0x6a93=['express','Router','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x3df9dd,_0x26f5cd){var _0x4f11e4=function(_0x1993fe){while(--_0x1993fe){_0x3df9dd['push'](_0x3df9dd['shift']());}};_0x4f11e4(++_0x26f5cd);}(_0x6a93,0x1ed));var _0x36a9=function(_0x415206,_0x532e28){_0x415206=_0x415206-0x0;var _0x1ac398=_0x6a93[_0x415206];return _0x1ac398;};'use strict';var multer=require(_0x36a9('0x0'));var util=require('util');var path=require(_0x36a9('0x1'));var timeout=require(_0x36a9('0x2'));var express=require(_0x36a9('0x3'));var router=express[_0x36a9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x36a9('0x5'));var config=require(_0x36a9('0x6'));var controller=require(_0x36a9('0x7'));router[_0x36a9('0x8')]('/',auth[_0x36a9('0x9')](),controller[_0x36a9('0xa')]);router[_0x36a9('0x8')](_0x36a9('0xb'),auth[_0x36a9('0x9')](),controller[_0x36a9('0xc')]);router[_0x36a9('0x8')]('/:id',auth[_0x36a9('0x9')](),controller[_0x36a9('0xd')]);router[_0x36a9('0xe')]('/',auth[_0x36a9('0x9')](),interaction[_0x36a9('0xf')](_0x36a9('0x10'),_0x36a9('0x11')),controller[_0x36a9('0x12')]);router['post'](_0x36a9('0x13'),controller[_0x36a9('0x14')]);router[_0x36a9('0x15')](_0x36a9('0x16'),auth[_0x36a9('0x9')](),controller[_0x36a9('0x17')]);router['put'](_0x36a9('0x18'),auth[_0x36a9('0x9')](),controller[_0x36a9('0x19')]);router['put'](_0x36a9('0x1a'),auth['isAuthenticated'](),controller[_0x36a9('0x1b')]);router[_0x36a9('0x1c')](_0x36a9('0x16'),auth[_0x36a9('0x9')](),controller[_0x36a9('0x1d')]);module[_0x36a9('0x1e')]=router; \ No newline at end of file +var _0x8824=['accept','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','describe','/:id','isAuthenticated','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept'];(function(_0x5314e5,_0x3c92c6){var _0x41c2e4=function(_0x910012){while(--_0x910012){_0x5314e5['push'](_0x5314e5['shift']());}};_0x41c2e4(++_0x3c92c6);}(_0x8824,0x6c));var _0x4882=function(_0xa662a3,_0x338633){_0xa662a3=_0xa662a3-0x0;var _0x25e427=_0x8824[_0xa662a3];return _0x25e427;};'use strict';var multer=require(_0x4882('0x0'));var util=require(_0x4882('0x1'));var path=require(_0x4882('0x2'));var timeout=require(_0x4882('0x3'));var express=require(_0x4882('0x4'));var router=express[_0x4882('0x5')]();var auth=require(_0x4882('0x6'));var interaction=require(_0x4882('0x7'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0x4882('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x4882('0x9')]);router['get'](_0x4882('0xa'),auth[_0x4882('0xb')](),controller['show']);router[_0x4882('0xc')]('/',auth[_0x4882('0xb')](),interaction[_0x4882('0xd')](_0x4882('0xe'),_0x4882('0xf')),controller[_0x4882('0x10')]);router[_0x4882('0xc')](_0x4882('0x11'),controller[_0x4882('0x12')]);router[_0x4882('0x13')](_0x4882('0xa'),auth[_0x4882('0xb')](),controller[_0x4882('0x14')]);router[_0x4882('0x13')](_0x4882('0x15'),auth[_0x4882('0xb')](),controller[_0x4882('0x16')]);router[_0x4882('0x13')]('/:id/reject',auth[_0x4882('0xb')](),controller[_0x4882('0x17')]);router['delete'](_0x4882('0xa'),auth[_0x4882('0xb')](),controller[_0x4882('0x18')]);module[_0x4882('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 928bd8b..469ecac 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 _0x956d=['exports','medium','BOOLEAN','ENUM','out','DATE','STRING','TEXT'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x956d,0x98));var _0xd956=function(_0x449649,_0x2a0519){_0x449649=_0x449649-0x0;var _0x568ff0=_0x956d[_0x449649];return _0x568ff0;};'use strict';var Sequelize=require('sequelize');module[_0xd956('0x0')]={'body':{'type':Sequelize['TEXT'](_0xd956('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xd956('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd956('0x3')]('in',_0xd956('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xd956('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd956('0x6')]},'providerResponse':{'type':Sequelize[_0xd956('0x7')]}}; \ No newline at end of file +var _0xb2ab=['TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize','exports'];(function(_0x5716b6,_0x4a3d5a){var _0x547e98=function(_0x34bd48){while(--_0x34bd48){_0x5716b6['push'](_0x5716b6['shift']());}};_0x547e98(++_0x4a3d5a);}(_0xb2ab,0x8e));var _0xbb2a=function(_0x564cb0,_0x198b72){_0x564cb0=_0x564cb0-0x0;var _0x1fceeb=_0xb2ab[_0x564cb0];return _0x1fceeb;};'use strict';var Sequelize=require(_0xbb2a('0x0'));module[_0xbb2a('0x1')]={'body':{'type':Sequelize[_0xbb2a('0x2')](_0xbb2a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xbb2a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbb2a('0x5')]('in','out'),'defaultValue':_0xbb2a('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xbb2a('0x7')](0xbe)},'phone':{'type':Sequelize[_0xbb2a('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xbb2a('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbb2a('0x7')]},'providerResponse':{'type':Sequelize[_0xbb2a('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 1201cb4..9b6d6ad 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 _0xa457=['delivered','Status','plivio','results','groupName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./smsMessage.socket','register','jayson/promise','http','client','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','count','offset','json','apply','save','update','destroy','then','stack','name','send','index','map','SmsMessage','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','rawAttributes','create','body','find','params','describe','sms-interactions','sms','readAt','format','UserId','user','agent','CmContact','Contact','SmsInteraction','SmsInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','get','role','null','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf'];(function(_0x193ab8,_0x38bd82){var _0xdfe5a3=function(_0x4aac4c){while(--_0x4aac4c){_0x193ab8['push'](_0x193ab8['shift']());}};_0xdfe5a3(++_0x38bd82);}(_0xa457,0x113));var _0x7a45=function(_0x290336,_0x2ba617){_0x290336=_0x290336-0x0;var _0x5a0856=_0xa457[_0x290336];return _0x5a0856;};'use strict';var pdf=require(_0x7a45('0x0'));var emlformat=require(_0x7a45('0x1'));var rimraf=require(_0x7a45('0x2'));var zipdir=require(_0x7a45('0x3'));var jsonpatch=require(_0x7a45('0x4'));var rp=require('request-promise');var moment=require(_0x7a45('0x5'));var BPromise=require(_0x7a45('0x6'));var Mustache=require(_0x7a45('0x7'));var util=require(_0x7a45('0x8'));var path=require(_0x7a45('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7a45('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7a45('0xb'));var crypto=require(_0x7a45('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7a45('0xd'));var toCsv=require(_0x7a45('0xe'));var querystring=require(_0x7a45('0xf'));var Papa=require(_0x7a45('0x10'));var Redis=require('ioredis');var authService=require(_0x7a45('0x11'));var qs=require(_0x7a45('0x12'));var as=require(_0x7a45('0x13'));var hardwareService=require(_0x7a45('0x14'));var logger=require(_0x7a45('0x15'))(_0x7a45('0x16'));var utils=require(_0x7a45('0x17'));var config=require(_0x7a45('0x18'));var licenseUtil=require(_0x7a45('0x19'));var db=require('../../mysqldb')['db'];config[_0x7a45('0x1a')]=_['defaults'](config[_0x7a45('0x1a')],{'host':_0x7a45('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7a45('0x1a')]));require(_0x7a45('0x1c'))[_0x7a45('0x1d')](socket);var jayson=require(_0x7a45('0x1e'));var client=jayson['client'][_0x7a45('0x1f')]({'port':0x232c});var client9002=jayson[_0x7a45('0x20')][_0x7a45('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2be561,_0x187a57,_0xabb0bc,_0x255659){return new BPromise(function(_0xdcd0ca,_0x1f303e){var _0x3cb00d=_0x255659||client;return _0x3cb00d['request'](_0x2be561,_0xabb0bc)['then'](function(_0x2d580d){logger[_0x7a45('0x21')](_0x7a45('0x22'),_0x187a57,_0x7a45('0x23'));logger[_0x7a45('0x24')](_0x7a45('0x25'),_0x187a57,_0x7a45('0x23'),JSON[_0x7a45('0x26')](_0x2d580d));if(_0x2d580d[_0x7a45('0x27')]){if(_0x2d580d[_0x7a45('0x27')][_0x7a45('0x28')]===0x1f4){logger[_0x7a45('0x27')](_0x7a45('0x22'),_0x187a57,_0x2d580d[_0x7a45('0x27')][_0x7a45('0x29')]);return _0x1f303e(_0x2d580d[_0x7a45('0x27')][_0x7a45('0x29')]);}logger['error'](_0x7a45('0x22'),_0x187a57,_0x2d580d[_0x7a45('0x27')]['message']);return _0xdcd0ca(_0x2d580d[_0x7a45('0x27')][_0x7a45('0x29')]);}else{logger[_0x7a45('0x21')](_0x7a45('0x22'),_0x187a57,_0x7a45('0x23'));_0xdcd0ca(_0x2d580d['result'][_0x7a45('0x29')]);}})[_0x7a45('0x2a')](function(_0x5a5ae5){logger[_0x7a45('0x27')]('SmsMessage,\x20%s,\x20%s',_0x187a57,_0x5a5ae5);_0x1f303e(_0x5a5ae5);});});}function respondWithStatusCode(_0xcdaa25,_0x1490ba){_0x1490ba=_0x1490ba||0xcc;return function(_0x3c8435){if(_0x3c8435){return _0xcdaa25[_0x7a45('0x2b')](_0x1490ba);}return _0xcdaa25[_0x7a45('0x2c')](_0x1490ba)[_0x7a45('0x2d')]();};}function respondWithResult(_0x327fa4,_0x282252){_0x282252=_0x282252||0xc8;return function(_0x940045){if(_0x940045){return _0x327fa4['status'](_0x282252)['json'](_0x940045);}};}function respondWithFilteredResult(_0x5c7805,_0xaf7644){return function(_0x5fab31){if(_0x5fab31){var _0x3cc549=_0x5fab31[_0x7a45('0x2e')],_0x264e7a=_0xaf7644[_0x7a45('0x2f')],_0x1993ca=_0xaf7644['offset']+_0xaf7644['limit'],_0x4a01b6;if(_0x1993ca>=_0x3cc549){_0x1993ca=_0x3cc549;_0x4a01b6=0xc8;}else{_0x4a01b6=0xce;}_0x5c7805['status'](_0x4a01b6);return _0x5c7805['set']('Content-Range',_0x264e7a+'-'+_0x1993ca+'/'+_0x3cc549)[_0x7a45('0x30')](_0x5fab31);}return null;};}function patchUpdates(_0x2db7f0){return function(_0xd4ebc7){try{jsonpatch[_0x7a45('0x31')](_0xd4ebc7,_0x2db7f0,!![]);}catch(_0x2c19c0){return BPromise['reject'](_0x2c19c0);}return _0xd4ebc7[_0x7a45('0x32')]();};}function saveUpdates(_0x3165bf,_0x282717){return function(_0x3145f0){if(_0x3145f0){return _0x3145f0[_0x7a45('0x33')](_0x3165bf)['then'](function(_0x48373f){return _0x48373f;});}return null;};}function removeEntity(_0x134bf2,_0x3fe737){return function(_0x3c589f){if(_0x3c589f){return _0x3c589f[_0x7a45('0x34')]()[_0x7a45('0x35')](function(){_0x134bf2[_0x7a45('0x2c')](0xcc)[_0x7a45('0x2d')]();});}};}function handleEntityNotFound(_0x1a42ac,_0x42a8bf){return function(_0x2373f3){if(!_0x2373f3){_0x1a42ac[_0x7a45('0x2b')](0x194);}return _0x2373f3;};}function handleError(_0x2269c1,_0x90a56c){_0x90a56c=_0x90a56c||0x1f4;return function(_0x5b8042){logger['error'](_0x5b8042[_0x7a45('0x36')]);if(_0x5b8042['name']){delete _0x5b8042[_0x7a45('0x37')];}_0x2269c1[_0x7a45('0x2c')](_0x90a56c)[_0x7a45('0x38')](_0x5b8042);};}exports[_0x7a45('0x39')]=function(_0x501b1e,_0x48ec43){var _0x1792e5={},_0xb14018={},_0x5769ab={'count':0x0,'rows':[]};var _0x55c856=_[_0x7a45('0x3a')](db[_0x7a45('0x3b')]['rawAttributes'],function(_0x1a59ff){return{'name':_0x1a59ff['fieldName'],'type':_0x1a59ff[_0x7a45('0x3c')][_0x7a45('0x3d')]};});_0xb14018[_0x7a45('0x3e')]=_[_0x7a45('0x3a')](_0x55c856,_0x7a45('0x37'));_0xb14018[_0x7a45('0x3f')]=_[_0x7a45('0x40')](_0x501b1e[_0x7a45('0x3f')]);_0xb14018['filters']=_[_0x7a45('0x41')](_0xb14018[_0x7a45('0x3e')],_0xb14018[_0x7a45('0x3f')]);_0x1792e5['attributes']=_[_0x7a45('0x41')](_0xb14018[_0x7a45('0x3e')],qs[_0x7a45('0x42')](_0x501b1e[_0x7a45('0x3f')][_0x7a45('0x42')]));_0x1792e5[_0x7a45('0x43')]=_0x1792e5[_0x7a45('0x43')][_0x7a45('0x44')]?_0x1792e5[_0x7a45('0x43')]:_0xb14018['model'];if(!_0x501b1e['query'][_0x7a45('0x45')](_0x7a45('0x46'))){_0x1792e5[_0x7a45('0x47')]=qs[_0x7a45('0x47')](_0x501b1e[_0x7a45('0x3f')]['limit']);_0x1792e5['offset']=qs['offset'](_0x501b1e[_0x7a45('0x3f')][_0x7a45('0x2f')]);}_0x1792e5[_0x7a45('0x48')]=qs[_0x7a45('0x49')](_0x501b1e[_0x7a45('0x3f')][_0x7a45('0x49')]);_0x1792e5['where']=qs[_0x7a45('0x4a')](_[_0x7a45('0x4b')](_0x501b1e[_0x7a45('0x3f')],_0xb14018[_0x7a45('0x4a')]),_0x55c856);if(_0x501b1e[_0x7a45('0x3f')][_0x7a45('0x4c')]){_0x1792e5[_0x7a45('0x4d')]=_[_0x7a45('0x4e')](_0x1792e5['where'],{'$or':_[_0x7a45('0x3a')](_0x55c856,function(_0x18431b){if(_0x18431b[_0x7a45('0x3c')]!==_0x7a45('0x4f')){var _0x4f34cf={};_0x4f34cf[_0x18431b['name']]={'$like':'%'+_0x501b1e['query']['filter']+'%'};return _0x4f34cf;}})});}_0x1792e5=_['merge']({},_0x1792e5,_0x501b1e[_0x7a45('0x50')]);var _0x34421f={'where':_0x1792e5[_0x7a45('0x4d')]};return db[_0x7a45('0x3b')][_0x7a45('0x2e')](_0x34421f)[_0x7a45('0x35')](function(_0x4e28d6){_0x5769ab[_0x7a45('0x2e')]=_0x4e28d6;if(_0x501b1e[_0x7a45('0x3f')][_0x7a45('0x51')]){_0x1792e5[_0x7a45('0x52')]=[{'all':!![]}];}return db['SmsMessage'][_0x7a45('0x53')](_0x1792e5);})[_0x7a45('0x35')](function(_0x54180b){_0x5769ab[_0x7a45('0x54')]=_0x54180b;return _0x5769ab;})[_0x7a45('0x35')](respondWithFilteredResult(_0x48ec43,_0x1792e5))[_0x7a45('0x2a')](handleError(_0x48ec43,null));};exports['show']=function(_0x22f3b9,_0x1bcac6){var _0xa9577c={'raw':!![],'where':{'id':_0x22f3b9['params']['id']}},_0x2c242d={};_0x2c242d[_0x7a45('0x3e')]=_['keys'](db['SmsMessage'][_0x7a45('0x55')]);_0x2c242d[_0x7a45('0x3f')]=_['keys'](_0x22f3b9[_0x7a45('0x3f')]);_0x2c242d[_0x7a45('0x4a')]=_['intersection'](_0x2c242d[_0x7a45('0x3e')],_0x2c242d[_0x7a45('0x3f')]);_0xa9577c[_0x7a45('0x43')]=_[_0x7a45('0x41')](_0x2c242d['model'],qs[_0x7a45('0x42')](_0x22f3b9[_0x7a45('0x3f')][_0x7a45('0x42')]));_0xa9577c[_0x7a45('0x43')]=_0xa9577c[_0x7a45('0x43')]['length']?_0xa9577c[_0x7a45('0x43')]:_0x2c242d['model'];if(_0x22f3b9[_0x7a45('0x3f')]['includeAll']){_0xa9577c[_0x7a45('0x52')]=[{'all':!![]}];}_0xa9577c=_[_0x7a45('0x4e')]({},_0xa9577c,_0x22f3b9[_0x7a45('0x50')]);return db[_0x7a45('0x3b')]['find'](_0xa9577c)[_0x7a45('0x35')](handleEntityNotFound(_0x1bcac6,null))['then'](respondWithResult(_0x1bcac6,null))['catch'](handleError(_0x1bcac6,null));};exports[_0x7a45('0x56')]=function(_0x1be0f1,_0x5c48a7){return db[_0x7a45('0x3b')]['create'](_0x1be0f1['body'],{})[_0x7a45('0x35')](respondWithResult(_0x5c48a7,0xc9))['catch'](handleError(_0x5c48a7,null));};exports[_0x7a45('0x33')]=function(_0x3ac7e6,_0x499648){if(_0x3ac7e6[_0x7a45('0x57')]['id']){delete _0x3ac7e6['body']['id'];}return db[_0x7a45('0x3b')][_0x7a45('0x58')]({'where':{'id':_0x3ac7e6[_0x7a45('0x59')]['id']}})[_0x7a45('0x35')](handleEntityNotFound(_0x499648,null))['then'](saveUpdates(_0x3ac7e6[_0x7a45('0x57')],null))[_0x7a45('0x35')](respondWithResult(_0x499648,null))[_0x7a45('0x2a')](handleError(_0x499648,null));};exports[_0x7a45('0x34')]=function(_0x43bca1,_0x89e574){return db[_0x7a45('0x3b')][_0x7a45('0x58')]({'where':{'id':_0x43bca1[_0x7a45('0x59')]['id']}})[_0x7a45('0x35')](handleEntityNotFound(_0x89e574,null))[_0x7a45('0x35')](removeEntity(_0x89e574,null))['catch'](handleError(_0x89e574,null));};exports['describe']=function(_0x3e6f9c,_0x43c6b7){return db['SmsMessage'][_0x7a45('0x5a')]()[_0x7a45('0x35')](respondWithResult(_0x43c6b7,null))['catch'](handleError(_0x43c6b7,null));};var interaction_log=require('../../config/logger')(_0x7a45('0x5b'));exports['accept']=function(_0x3eb892,_0x43428d,_0xa95eed){var _0x14e7c3={'agent':{},'channel':_0x7a45('0x5c')};if(_0x3eb892['body']['id']){delete _0x3eb892['body']['id'];}_0x3eb892['body']['read']=!![];_0x3eb892['body'][_0x7a45('0x5d')]=moment()[_0x7a45('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x3eb892['body'][_0x7a45('0x5f')]=_0x3eb892[_0x7a45('0x57')][_0x7a45('0x5f')]||_0x3eb892[_0x7a45('0x60')]['id'];_0x14e7c3[_0x7a45('0x61')]['id']=_0x3eb892['body'][_0x7a45('0x5f')];return db[_0x7a45('0x3b')][_0x7a45('0x58')]({'where':{'id':_0x3eb892[_0x7a45('0x59')]['id'],'UserId':null},'include':[{'model':db[_0x7a45('0x62')],'as':_0x7a45('0x63')}]})[_0x7a45('0x35')](handleEntityNotFound(_0x43428d,null))['then'](saveUpdates(_0x3eb892[_0x7a45('0x57')],null))[_0x7a45('0x35')](function(_0x397a34){if(_0x397a34){_0x14e7c3[_0x7a45('0x29')]=_0x397a34['get']({'plain':!![]});return db[_0x7a45('0x64')][_0x7a45('0x58')]({'where':{'id':_0x397a34[_0x7a45('0x65')]}});}return null;})[_0x7a45('0x35')](handleEntityNotFound(_0x43428d,null))[_0x7a45('0x35')](function(_0x33b5fb){if(_0x33b5fb){return _0x33b5fb[_0x7a45('0x33')]({'UserId':_0x3eb892[_0x7a45('0x57')]['UserId'],'read1stAt':_[_0x7a45('0x66')](_0x33b5fb['read1stAt'])?moment()[_0x7a45('0x5e')](_0x7a45('0x67')):undefined});}return null;})['then'](function(_0x90192c){if(_0x90192c){_0x14e7c3[_0x7a45('0x68')]=_0x90192c[_0x7a45('0x69')]({'plain':!![]});interaction_log[_0x7a45('0x21')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3eb892[_0x7a45('0x60')]['id'],_0x3eb892['user'][_0x7a45('0x37')],_0x3eb892[_0x7a45('0x60')][_0x7a45('0x6a')],_0x14e7c3[_0x7a45('0x68')]['id'],_0x3eb892[_0x7a45('0x57')]?JSON[_0x7a45('0x26')](_0x3eb892[_0x7a45('0x57')]):_0x7a45('0x6b'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x14e7c3);}return null;})[_0x7a45('0x35')](function(_0x204dce){if(_0x204dce){if(_0x3eb892[_0x7a45('0x57')][_0x7a45('0x6c')]){_0x14e7c3[_0x7a45('0x29')][_0x7a45('0x6d')]=util[_0x7a45('0x5e')](_0x7a45('0x6e'),_0x3eb892[_0x7a45('0x60')]['name']);_0x14e7c3['message']['channel']=_0x14e7c3[_0x7a45('0x6f')];_0x14e7c3[_0x7a45('0x29')][_0x7a45('0x70')]=_0x7a45('0x71');return respondWithRpcPromise(_0x7a45('0x72'),'EventManager',{'event':_0x7a45('0x73'),'message':_0x14e7c3['message']},client9002)['then'](function(){return _0x14e7c3;});}return _0x14e7c3;}return null;})[_0x7a45('0x35')](respondWithResult(_0x43428d,null))[_0x7a45('0x2a')](handleError(_0x43428d,null));};var interaction_log=require(_0x7a45('0x15'))(_0x7a45('0x5b'));exports[_0x7a45('0x74')]=function(_0x2b6f88,_0x3e0c11,_0x54a6b4){var _0x4f3b5d={'agent':{},'channel':_0x7a45('0x5c')};if(_0x2b6f88[_0x7a45('0x57')]['id']){delete _0x2b6f88[_0x7a45('0x57')]['id'];}_0x2b6f88['body'][_0x7a45('0x5f')]=_0x2b6f88[_0x7a45('0x57')][_0x7a45('0x5f')]||_0x2b6f88[_0x7a45('0x60')]['id'];_0x4f3b5d[_0x7a45('0x61')]['id']=_0x2b6f88[_0x7a45('0x57')][_0x7a45('0x5f')];return db[_0x7a45('0x3b')][_0x7a45('0x58')]({'where':{'id':_0x2b6f88[_0x7a45('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3e0c11,null))[_0x7a45('0x35')](function(_0x4f476a){if(_0x4f476a){_0x4f3b5d[_0x7a45('0x29')]=_0x4f476a[_0x7a45('0x69')]({'plain':!![]});return db[_0x7a45('0x64')][_0x7a45('0x58')]({'where':{'id':_0x4f476a[_0x7a45('0x65')]}});}return null;})[_0x7a45('0x35')](handleEntityNotFound(_0x3e0c11,null))[_0x7a45('0x35')](function(_0x49319f){if(_0x49319f){_0x4f3b5d[_0x7a45('0x68')]=_0x49319f[_0x7a45('0x69')]({'plain':!![]});interaction_log[_0x7a45('0x21')](_0x7a45('0x75'),_0x2b6f88['user']['id'],_0x2b6f88['user'][_0x7a45('0x37')],_0x2b6f88[_0x7a45('0x60')]['role'],_0x4f3b5d[_0x7a45('0x68')]['id'],_0x2b6f88[_0x7a45('0x57')]?JSON[_0x7a45('0x26')](_0x2b6f88[_0x7a45('0x57')]):_0x7a45('0x6b'));return respondWithRpcPromise(_0x7a45('0x76'),_0x7a45('0x77'),_0x4f3b5d);}return null;})['then'](function(_0x49b0c6){if(_0x49b0c6){_0x49b0c6[_0x7a45('0x29')][_0x7a45('0x6d')]=util[_0x7a45('0x5e')](_0x7a45('0x6e'),_0x2b6f88[_0x7a45('0x60')][_0x7a45('0x37')]);_0x49b0c6[_0x7a45('0x29')][_0x7a45('0x6f')]=_0x4f3b5d[_0x7a45('0x6f')];_0x49b0c6['message'][_0x7a45('0x70')]='reject';respondWithRpcPromise(_0x7a45('0x72'),_0x7a45('0x72'),{'event':'rejectmessage','message':_0x49b0c6[_0x7a45('0x29')]},client9002);return _0x4f3b5d;}return null;})[_0x7a45('0x35')](respondWithResult(_0x3e0c11,null))[_0x7a45('0x2a')](handleError(_0x3e0c11,null));};exports[_0x7a45('0x2c')]=function(_0x3ec0e9,_0x376593,_0x48ee59){if(_0x3ec0e9[_0x7a45('0x57')]['id']){delete _0x3ec0e9['body']['id'];}var _0x5039df;return db['SmsMessage'][_0x7a45('0x58')]({'where':{'id':_0x3ec0e9[_0x7a45('0x59')]['id']}})[_0x7a45('0x35')](handleEntityNotFound(_0x376593,null))[_0x7a45('0x35')](function(_0x1140b9){if(_0x1140b9){_0x5039df=_0x1140b9;return db[_0x7a45('0x78')][_0x7a45('0x58')]({'where':{'id':_0x1140b9[_0x7a45('0x79')]}});}})['then'](handleEntityNotFound(_0x376593,null))[_0x7a45('0x35')](function(_0x4a2e52){if(_0x4a2e52){logger[_0x7a45('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7a45('0x2c'),_0x7a45('0x7a'),_0x4a2e52[_0x7a45('0x3c')],util[_0x7a45('0x7b')](_0x3ec0e9[_0x7a45('0x57')],{'showHidden':![],'depth':null}));switch(_0x4a2e52[_0x7a45('0x3c')]){case _0x7a45('0x7c'):if(_0x3ec0e9[_0x7a45('0x57')][_0x7a45('0x7d')]&&_0x3ec0e9['body'][_0x7a45('0x7d')]===_0x5039df[_0x7a45('0x7e')]){return _0x5039df['update']({'read':!![]});}else{logger[_0x7a45('0x27')](_0x7a45('0x7f'),_0x7a45('0x2c'),'twilio',util[_0x7a45('0x7b')](_0x3ec0e9[_0x7a45('0x57')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x3ec0e9[_0x7a45('0x57')][_0x7a45('0x80')]&&_0x3ec0e9['body'][_0x7a45('0x80')]===_0x5039df[_0x7a45('0x7e')]&&_[_0x7a45('0x81')](['sent',_0x7a45('0x82')],_0x3ec0e9[_0x7a45('0x57')][_0x7a45('0x83')])>=0x0){return _0x5039df['update']({'read':!![]});}else{logger[_0x7a45('0x27')](_0x7a45('0x7f'),_0x7a45('0x2c'),_0x7a45('0x84'),util[_0x7a45('0x7b')](_0x3ec0e9[_0x7a45('0x57')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x148013=_0x3ec0e9[_0x7a45('0x57')][_0x7a45('0x85')][0x0];if(_0x148013[_0x7a45('0x2c')][_0x7a45('0x86')]==='DELIVERED'){return _0x5039df['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7a45('0x2c'),'infobip',util[_0x7a45('0x7b')](_0x3ec0e9[_0x7a45('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x5039df;}})[_0x7a45('0x35')](respondWithResult(_0x376593,null))[_0x7a45('0x2a')](handleError(_0x376593,null));}; \ No newline at end of file +var _0x345a=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','name','send','index','SmsMessage','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','length','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','params','intersection','fields','find','create','body','destroy','describe','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','SmsInteraction','read1stAt','interaction','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','accept','EventManager','acceptmessage','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','event','SmsAccount','inspect','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','messageId','indexOf','delivered','Status','plivio','results','groupName','DELIVERED','infobip','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x4f8deb,_0x2bea10){var _0xe80579=function(_0x5c48c2){while(--_0x5c48c2){_0x4f8deb['push'](_0x4f8deb['shift']());}};_0xe80579(++_0x2bea10);}(_0x345a,0xfc));var _0xa345=function(_0x2e6362,_0x90c25){_0x2e6362=_0x2e6362-0x0;var _0x1a5a3b=_0x345a[_0x2e6362];return _0x1a5a3b;};'use strict';var pdf=require(_0xa345('0x0'));var emlformat=require(_0xa345('0x1'));var rimraf=require(_0xa345('0x2'));var zipdir=require(_0xa345('0x3'));var jsonpatch=require(_0xa345('0x4'));var rp=require(_0xa345('0x5'));var moment=require(_0xa345('0x6'));var BPromise=require(_0xa345('0x7'));var Mustache=require('mustache');var util=require(_0xa345('0x8'));var path=require(_0xa345('0x9'));var sox=require(_0xa345('0xa'));var csv=require(_0xa345('0xb'));var ejs=require(_0xa345('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa345('0xd'));var jsforce=require(_0xa345('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa345('0xb'));var querystring=require('querystring');var Papa=require(_0xa345('0xf'));var Redis=require('ioredis');var authService=require(_0xa345('0x10'));var qs=require(_0xa345('0x11'));var as=require(_0xa345('0x12'));var hardwareService=require(_0xa345('0x13'));var logger=require(_0xa345('0x14'))(_0xa345('0x15'));var utils=require(_0xa345('0x16'));var config=require(_0xa345('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa345('0x18'))['db'];config[_0xa345('0x19')]=_[_0xa345('0x1a')](config['redis'],{'host':_0xa345('0x1b'),'port':0x18eb});var socket=require(_0xa345('0x1c'))(new Redis(config[_0xa345('0x19')]));require(_0xa345('0x1d'))[_0xa345('0x1e')](socket);var jayson=require(_0xa345('0x1f'));var client=jayson[_0xa345('0x20')][_0xa345('0x21')]({'port':0x232c});var client9002=jayson[_0xa345('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17019b,_0x471f28,_0x1ac152,_0x447b3e){return new BPromise(function(_0x161d84,_0x462f47){var _0x56e963=_0x447b3e||client;return _0x56e963['request'](_0x17019b,_0x1ac152)[_0xa345('0x22')](function(_0x181841){logger[_0xa345('0x23')](_0xa345('0x24'),_0x471f28,_0xa345('0x25'));logger[_0xa345('0x26')](_0xa345('0x27'),_0x471f28,'request\x20sent',JSON[_0xa345('0x28')](_0x181841));if(_0x181841[_0xa345('0x29')]){if(_0x181841[_0xa345('0x29')][_0xa345('0x2a')]===0x1f4){logger[_0xa345('0x29')]('SmsMessage,\x20%s,\x20%s',_0x471f28,_0x181841[_0xa345('0x29')][_0xa345('0x2b')]);return _0x462f47(_0x181841['error'][_0xa345('0x2b')]);}logger[_0xa345('0x29')]('SmsMessage,\x20%s,\x20%s',_0x471f28,_0x181841['error']['message']);return _0x161d84(_0x181841[_0xa345('0x29')][_0xa345('0x2b')]);}else{logger['info'](_0xa345('0x24'),_0x471f28,_0xa345('0x25'));_0x161d84(_0x181841[_0xa345('0x2c')][_0xa345('0x2b')]);}})[_0xa345('0x2d')](function(_0x6e2902){logger[_0xa345('0x29')](_0xa345('0x24'),_0x471f28,_0x6e2902);_0x462f47(_0x6e2902);});});}function respondWithStatusCode(_0x22f109,_0x1d7af5){_0x1d7af5=_0x1d7af5||0xcc;return function(_0x19b550){if(_0x19b550){return _0x22f109[_0xa345('0x2e')](_0x1d7af5);}return _0x22f109[_0xa345('0x2f')](_0x1d7af5)[_0xa345('0x30')]();};}function respondWithResult(_0x179f62,_0x212850){_0x212850=_0x212850||0xc8;return function(_0x5c33b6){if(_0x5c33b6){return _0x179f62['status'](_0x212850)[_0xa345('0x31')](_0x5c33b6);}};}function respondWithFilteredResult(_0x279474,_0x2851df){return function(_0x28ed74){if(_0x28ed74){var _0x131ad8=_0x28ed74[_0xa345('0x32')],_0xa6f4e9=_0x2851df[_0xa345('0x33')],_0x316438=_0x2851df[_0xa345('0x33')]+_0x2851df[_0xa345('0x34')],_0x121106;if(_0x316438>=_0x131ad8){_0x316438=_0x131ad8;_0x121106=0xc8;}else{_0x121106=0xce;}_0x279474['status'](_0x121106);return _0x279474[_0xa345('0x35')](_0xa345('0x36'),_0xa6f4e9+'-'+_0x316438+'/'+_0x131ad8)[_0xa345('0x31')](_0x28ed74);}return null;};}function patchUpdates(_0x10c054){return function(_0x225112){try{jsonpatch[_0xa345('0x37')](_0x225112,_0x10c054,!![]);}catch(_0x49c84e){return BPromise[_0xa345('0x38')](_0x49c84e);}return _0x225112[_0xa345('0x39')]();};}function saveUpdates(_0x43b5db,_0x5083e3){return function(_0x11aa75){if(_0x11aa75){return _0x11aa75[_0xa345('0x3a')](_0x43b5db)['then'](function(_0xfdf2ed){return _0xfdf2ed;});}return null;};}function removeEntity(_0x4d0f93,_0x430fc0){return function(_0x2a94a0){if(_0x2a94a0){return _0x2a94a0['destroy']()[_0xa345('0x22')](function(){_0x4d0f93[_0xa345('0x2f')](0xcc)[_0xa345('0x30')]();});}};}function handleEntityNotFound(_0x437055,_0x3c8bf0){return function(_0x34fc31){if(!_0x34fc31){_0x437055[_0xa345('0x2e')](0x194);}return _0x34fc31;};}function handleError(_0x10ed35,_0x968ca9){_0x968ca9=_0x968ca9||0x1f4;return function(_0x3ca770){logger[_0xa345('0x29')](_0x3ca770['stack']);if(_0x3ca770[_0xa345('0x3b')]){delete _0x3ca770['name'];}_0x10ed35[_0xa345('0x2f')](_0x968ca9)[_0xa345('0x3c')](_0x3ca770);};}exports[_0xa345('0x3d')]=function(_0xc0868,_0x410abd){var _0x3c46db={},_0x24b23e={},_0x1749ca={'count':0x0,'rows':[]};var _0x2c29e0=_['map'](db[_0xa345('0x3e')][_0xa345('0x3f')],function(_0x2d0b71){return{'name':_0x2d0b71[_0xa345('0x40')],'type':_0x2d0b71[_0xa345('0x41')][_0xa345('0x42')]};});_0x24b23e['model']=_[_0xa345('0x43')](_0x2c29e0,_0xa345('0x3b'));_0x24b23e[_0xa345('0x44')]=_[_0xa345('0x45')](_0xc0868['query']);_0x24b23e[_0xa345('0x46')]=_['intersection'](_0x24b23e[_0xa345('0x47')],_0x24b23e['query']);_0x3c46db[_0xa345('0x48')]=_['intersection'](_0x24b23e[_0xa345('0x47')],qs['fields'](_0xc0868['query']['fields']));_0x3c46db[_0xa345('0x48')]=_0x3c46db['attributes'][_0xa345('0x49')]?_0x3c46db[_0xa345('0x48')]:_0x24b23e[_0xa345('0x47')];if(!_0xc0868['query']['hasOwnProperty'](_0xa345('0x4a'))){_0x3c46db[_0xa345('0x34')]=qs[_0xa345('0x34')](_0xc0868[_0xa345('0x44')][_0xa345('0x34')]);_0x3c46db['offset']=qs[_0xa345('0x33')](_0xc0868[_0xa345('0x44')][_0xa345('0x33')]);}_0x3c46db['order']=qs[_0xa345('0x4b')](_0xc0868[_0xa345('0x44')][_0xa345('0x4b')]);_0x3c46db[_0xa345('0x4c')]=qs[_0xa345('0x46')](_[_0xa345('0x4d')](_0xc0868['query'],_0x24b23e['filters']),_0x2c29e0);if(_0xc0868['query']['filter']){_0x3c46db[_0xa345('0x4c')]=_[_0xa345('0x4e')](_0x3c46db[_0xa345('0x4c')],{'$or':_[_0xa345('0x43')](_0x2c29e0,function(_0x10b1f8){if(_0x10b1f8[_0xa345('0x41')]!==_0xa345('0x4f')){var _0x2a62d8={};_0x2a62d8[_0x10b1f8[_0xa345('0x3b')]]={'$like':'%'+_0xc0868[_0xa345('0x44')]['filter']+'%'};return _0x2a62d8;}})});}_0x3c46db=_[_0xa345('0x4e')]({},_0x3c46db,_0xc0868[_0xa345('0x50')]);var _0x4865ce={'where':_0x3c46db[_0xa345('0x4c')]};return db[_0xa345('0x3e')]['count'](_0x4865ce)[_0xa345('0x22')](function(_0xf6e81c){_0x1749ca[_0xa345('0x32')]=_0xf6e81c;if(_0xc0868[_0xa345('0x44')][_0xa345('0x51')]){_0x3c46db[_0xa345('0x52')]=[{'all':!![]}];}return db[_0xa345('0x3e')]['findAll'](_0x3c46db);})[_0xa345('0x22')](function(_0x5c347f){_0x1749ca[_0xa345('0x53')]=_0x5c347f;return _0x1749ca;})[_0xa345('0x22')](respondWithFilteredResult(_0x410abd,_0x3c46db))['catch'](handleError(_0x410abd,null));};exports['show']=function(_0x23a200,_0x2e8db1){var _0x564374={'raw':!![],'where':{'id':_0x23a200[_0xa345('0x54')]['id']}},_0x35b969={};_0x35b969[_0xa345('0x47')]=_['keys'](db[_0xa345('0x3e')][_0xa345('0x3f')]);_0x35b969[_0xa345('0x44')]=_[_0xa345('0x45')](_0x23a200[_0xa345('0x44')]);_0x35b969[_0xa345('0x46')]=_['intersection'](_0x35b969[_0xa345('0x47')],_0x35b969['query']);_0x564374['attributes']=_[_0xa345('0x55')](_0x35b969[_0xa345('0x47')],qs['fields'](_0x23a200[_0xa345('0x44')][_0xa345('0x56')]));_0x564374[_0xa345('0x48')]=_0x564374[_0xa345('0x48')]['length']?_0x564374['attributes']:_0x35b969[_0xa345('0x47')];if(_0x23a200['query'][_0xa345('0x51')]){_0x564374[_0xa345('0x52')]=[{'all':!![]}];}_0x564374=_['merge']({},_0x564374,_0x23a200[_0xa345('0x50')]);return db[_0xa345('0x3e')][_0xa345('0x57')](_0x564374)[_0xa345('0x22')](handleEntityNotFound(_0x2e8db1,null))['then'](respondWithResult(_0x2e8db1,null))[_0xa345('0x2d')](handleError(_0x2e8db1,null));};exports[_0xa345('0x58')]=function(_0x4d5a45,_0xa727ce){return db[_0xa345('0x3e')][_0xa345('0x58')](_0x4d5a45[_0xa345('0x59')],{})[_0xa345('0x22')](respondWithResult(_0xa727ce,0xc9))[_0xa345('0x2d')](handleError(_0xa727ce,null));};exports[_0xa345('0x3a')]=function(_0x982d0b,_0x5abb86){if(_0x982d0b[_0xa345('0x59')]['id']){delete _0x982d0b[_0xa345('0x59')]['id'];}return db[_0xa345('0x3e')][_0xa345('0x57')]({'where':{'id':_0x982d0b['params']['id']}})[_0xa345('0x22')](handleEntityNotFound(_0x5abb86,null))[_0xa345('0x22')](saveUpdates(_0x982d0b[_0xa345('0x59')],null))[_0xa345('0x22')](respondWithResult(_0x5abb86,null))['catch'](handleError(_0x5abb86,null));};exports[_0xa345('0x5a')]=function(_0x39db6f,_0x3cda5a){return db['SmsMessage'][_0xa345('0x57')]({'where':{'id':_0x39db6f['params']['id']}})[_0xa345('0x22')](handleEntityNotFound(_0x3cda5a,null))[_0xa345('0x22')](removeEntity(_0x3cda5a,null))['catch'](handleError(_0x3cda5a,null));};exports[_0xa345('0x5b')]=function(_0x55bc71,_0x38a77d){return db[_0xa345('0x3e')][_0xa345('0x5b')]()[_0xa345('0x22')](respondWithResult(_0x38a77d,null))[_0xa345('0x2d')](handleError(_0x38a77d,null));};var interaction_log=require('../../config/logger')(_0xa345('0x5c'));exports['accept']=function(_0x4a5543,_0x3a3e8e,_0x5794a){var _0x29d339={'agent':{},'channel':_0xa345('0x5d')};if(_0x4a5543['body']['id']){delete _0x4a5543[_0xa345('0x59')]['id'];}_0x4a5543[_0xa345('0x59')][_0xa345('0x5e')]=!![];_0x4a5543['body'][_0xa345('0x5f')]=moment()[_0xa345('0x60')](_0xa345('0x61'));_0x4a5543['body'][_0xa345('0x62')]=_0x4a5543[_0xa345('0x59')]['UserId']||_0x4a5543[_0xa345('0x63')]['id'];_0x29d339[_0xa345('0x64')]['id']=_0x4a5543[_0xa345('0x59')]['UserId'];return db[_0xa345('0x3e')]['find']({'where':{'id':_0x4a5543[_0xa345('0x54')]['id'],'UserId':null},'include':[{'model':db[_0xa345('0x65')],'as':_0xa345('0x66')}]})['then'](handleEntityNotFound(_0x3a3e8e,null))[_0xa345('0x22')](saveUpdates(_0x4a5543[_0xa345('0x59')],null))[_0xa345('0x22')](function(_0x301722){if(_0x301722){_0x29d339['message']=_0x301722[_0xa345('0x67')]({'plain':!![]});return db[_0xa345('0x68')]['find']({'where':{'id':_0x301722['SmsInteractionId']}});}return null;})[_0xa345('0x22')](handleEntityNotFound(_0x3a3e8e,null))['then'](function(_0x5954db){if(_0x5954db){return _0x5954db[_0xa345('0x3a')]({'UserId':_0x4a5543[_0xa345('0x59')][_0xa345('0x62')],'read1stAt':_['isNil'](_0x5954db[_0xa345('0x69')])?moment()[_0xa345('0x60')](_0xa345('0x61')):undefined});}return null;})['then'](function(_0x2810ca){if(_0x2810ca){_0x29d339[_0xa345('0x6a')]=_0x2810ca[_0xa345('0x67')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4a5543[_0xa345('0x63')]['id'],_0x4a5543['user'][_0xa345('0x3b')],_0x4a5543['user'][_0xa345('0x6b')],_0x29d339[_0xa345('0x6a')]['id'],_0x4a5543['body']?JSON[_0xa345('0x28')](_0x4a5543[_0xa345('0x59')]):'null');return respondWithRpcPromise(_0xa345('0x6c'),_0xa345('0x6d'),_0x29d339);}return null;})[_0xa345('0x22')](function(_0x2ed9c7){if(_0x2ed9c7){if(_0x4a5543['body'][_0xa345('0x6e')]){_0x29d339['message'][_0xa345('0x6f')]=util[_0xa345('0x60')](_0xa345('0x70'),_0x4a5543[_0xa345('0x63')][_0xa345('0x3b')]);_0x29d339[_0xa345('0x2b')][_0xa345('0x71')]=_0x29d339['channel'];_0x29d339[_0xa345('0x2b')]['event']=_0xa345('0x72');return respondWithRpcPromise(_0xa345('0x73'),_0xa345('0x73'),{'event':_0xa345('0x74'),'message':_0x29d339[_0xa345('0x2b')]},client9002)['then'](function(){return _0x29d339;});}return _0x29d339;}return null;})[_0xa345('0x22')](respondWithResult(_0x3a3e8e,null))[_0xa345('0x2d')](handleError(_0x3a3e8e,null));};var interaction_log=require(_0xa345('0x14'))(_0xa345('0x5c'));exports[_0xa345('0x38')]=function(_0xda5d0e,_0x2fd26d,_0x563c74){var _0x1bfa00={'agent':{},'channel':_0xa345('0x5d')};if(_0xda5d0e[_0xa345('0x59')]['id']){delete _0xda5d0e['body']['id'];}_0xda5d0e[_0xa345('0x59')]['UserId']=_0xda5d0e[_0xa345('0x59')][_0xa345('0x62')]||_0xda5d0e[_0xa345('0x63')]['id'];_0x1bfa00[_0xa345('0x64')]['id']=_0xda5d0e['body'][_0xa345('0x62')];return db[_0xa345('0x3e')][_0xa345('0x57')]({'where':{'id':_0xda5d0e[_0xa345('0x54')]['id'],'UserId':null}})[_0xa345('0x22')](handleEntityNotFound(_0x2fd26d,null))['then'](function(_0x23b58d){if(_0x23b58d){_0x1bfa00[_0xa345('0x2b')]=_0x23b58d[_0xa345('0x67')]({'plain':!![]});return db[_0xa345('0x68')][_0xa345('0x57')]({'where':{'id':_0x23b58d[_0xa345('0x75')]}});}return null;})[_0xa345('0x22')](handleEntityNotFound(_0x2fd26d,null))[_0xa345('0x22')](function(_0x56f11c){if(_0x56f11c){_0x1bfa00[_0xa345('0x6a')]=_0x56f11c[_0xa345('0x67')]({'plain':!![]});interaction_log['info'](_0xa345('0x76'),_0xda5d0e['user']['id'],_0xda5d0e[_0xa345('0x63')][_0xa345('0x3b')],_0xda5d0e[_0xa345('0x63')][_0xa345('0x6b')],_0x1bfa00['interaction']['id'],_0xda5d0e[_0xa345('0x59')]?JSON[_0xa345('0x28')](_0xda5d0e[_0xa345('0x59')]):_0xa345('0x77'));return respondWithRpcPromise(_0xa345('0x78'),'rejectMessage',_0x1bfa00);}return null;})['then'](function(_0xf377bf){if(_0xf377bf){_0xf377bf[_0xa345('0x2b')]['interface']=util[_0xa345('0x60')](_0xa345('0x70'),_0xda5d0e[_0xa345('0x63')][_0xa345('0x3b')]);_0xf377bf['message'][_0xa345('0x71')]=_0x1bfa00[_0xa345('0x71')];_0xf377bf[_0xa345('0x2b')][_0xa345('0x79')]=_0xa345('0x38');respondWithRpcPromise(_0xa345('0x73'),_0xa345('0x73'),{'event':'rejectmessage','message':_0xf377bf[_0xa345('0x2b')]},client9002);return _0x1bfa00;}return null;})[_0xa345('0x22')](respondWithResult(_0x2fd26d,null))[_0xa345('0x2d')](handleError(_0x2fd26d,null));};exports[_0xa345('0x2f')]=function(_0x8b26d5,_0x56c114,_0x5d0877){if(_0x8b26d5[_0xa345('0x59')]['id']){delete _0x8b26d5[_0xa345('0x59')]['id'];}var _0x1605c2;return db[_0xa345('0x3e')]['find']({'where':{'id':_0x8b26d5[_0xa345('0x54')]['id']}})['then'](handleEntityNotFound(_0x56c114,null))[_0xa345('0x22')](function(_0x1aeb94){if(_0x1aeb94){_0x1605c2=_0x1aeb94;return db[_0xa345('0x7a')]['find']({'where':{'id':_0x1aeb94['SmsAccountId']}});}})[_0xa345('0x22')](handleEntityNotFound(_0x56c114,null))[_0xa345('0x22')](function(_0x39b400){if(_0x39b400){logger[_0xa345('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa345('0x2f'),'received\x20delivery\x20report\x20from',_0x39b400[_0xa345('0x41')],util[_0xa345('0x7b')](_0x8b26d5['body'],{'showHidden':![],'depth':null}));switch(_0x39b400[_0xa345('0x41')]){case'twilio':if(_0x8b26d5['body'][_0xa345('0x7c')]&&_0x8b26d5[_0xa345('0x59')][_0xa345('0x7c')]===_0x1605c2['messageId']){return _0x1605c2[_0xa345('0x3a')]({'read':!![]});}else{logger[_0xa345('0x29')](_0xa345('0x7d'),_0xa345('0x2f'),_0xa345('0x7e'),util[_0xa345('0x7b')](_0x8b26d5[_0xa345('0x59')],{'showHidden':![],'depth':null}));}break;case _0xa345('0x7f'):if(_0x8b26d5['body'][_0xa345('0x80')]&&_0x8b26d5[_0xa345('0x59')][_0xa345('0x80')]===_0x1605c2[_0xa345('0x81')]&&_[_0xa345('0x82')](['sent',_0xa345('0x83')],_0x8b26d5[_0xa345('0x59')][_0xa345('0x84')])>=0x0){return _0x1605c2[_0xa345('0x3a')]({'read':!![]});}else{logger[_0xa345('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa345('0x2f'),_0xa345('0x85'),util[_0xa345('0x7b')](_0x8b26d5['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x2d072f=_0x8b26d5[_0xa345('0x59')][_0xa345('0x86')][0x0];if(_0x2d072f[_0xa345('0x2f')][_0xa345('0x87')]===_0xa345('0x88')){return _0x1605c2[_0xa345('0x3a')]({'read':!![]});}else{logger[_0xa345('0x29')](_0xa345('0x7d'),'status',_0xa345('0x89'),util[_0xa345('0x7b')](_0x8b26d5[_0xa345('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x1605c2;}})[_0xa345('0x22')](respondWithResult(_0x56c114,null))[_0xa345('0x2d')](handleError(_0x56c114,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index ec15545..f1262e1 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 _0x3c9b=['emit','hasOwnProperty','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x56a549,_0x457b13){var _0x470b73=function(_0x1beb88){while(--_0x1beb88){_0x56a549['push'](_0x56a549['shift']());}};_0x470b73(++_0x457b13);}(_0x3c9b,0x125));var _0xb3c9=function(_0x1dd6e7,_0x4f3ea7){_0x1dd6e7=_0x1dd6e7-0x0;var _0x76389f=_0x3c9b[_0x1dd6e7];return _0x76389f;};'use strict';var EventEmitter=require(_0xb3c9('0x0'));var SmsMessage=require(_0xb3c9('0x1'))['db'][_0xb3c9('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xb3c9('0x3')](0x0);var events={'afterCreate':_0xb3c9('0x4'),'afterUpdate':_0xb3c9('0x5'),'afterDestroy':_0xb3c9('0x6')};function emitEvent(_0x52d92b){return function(_0x328af0,_0x8b3a73,_0x1e0404){SmsMessageEvents['emit'](_0x52d92b+':'+_0x328af0['id'],_0x328af0);SmsMessageEvents[_0xb3c9('0x7')](_0x52d92b,_0x328af0);_0x1e0404(null);};}for(var e in events){if(events[_0xb3c9('0x8')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xb3c9('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0xabb4=['remove','exports','events','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x23b7d9,_0x55ed3b){var _0x5309e7=function(_0x5c60da){while(--_0x5c60da){_0x23b7d9['push'](_0x23b7d9['shift']());}};_0x5309e7(++_0x55ed3b);}(_0xabb4,0x13a));var _0x4abb=function(_0x3e57e5,_0x50ec4a){_0x3e57e5=_0x3e57e5-0x0;var _0x5dbda3=_0xabb4[_0x3e57e5];return _0x5dbda3;};'use strict';var EventEmitter=require(_0x4abb('0x0'));var SmsMessage=require(_0x4abb('0x1'))['db'][_0x4abb('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x4abb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4abb('0x4')};function emitEvent(_0x59c0f0){return function(_0x517293,_0x5365b0,_0x4d52cd){SmsMessageEvents['emit'](_0x59c0f0+':'+_0x517293['id'],_0x517293);SmsMessageEvents['emit'](_0x59c0f0,_0x517293);_0x4d52cd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x4abb('0x5')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index ed50e41..1dac376 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 _0x2c27=['authToken','phone','messages','create','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','&password=','password','split','sms','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','data','queued_count','head','clickSend','remote','/api/sms/messages/','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','timestamp','keys','length','apiKey','createHash','md5','digest','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','message','refid','status','utf8mb4','util','moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','sms_messages','messageId','fti_sms_messages','body','models','get','direction','out','secret','SmsInteraction','findOne','SmsInteractionId','then','createdAt','toLowerCase','catch','error','find','type','twilio','accountSid'];(function(_0x1ee50d,_0x142939){var _0x5514ed=function(_0x5df92c){while(--_0x5df92c){_0x1ee50d['push'](_0x1ee50d['shift']());}};_0x5514ed(++_0x142939);}(_0x2c27,0xcc));var _0x72c2=function(_0x19c2c0,_0x4f78af){_0x19c2c0=_0x19c2c0-0x0;var _0x132964=_0x2c27[_0x19c2c0];return _0x132964;};'use strict';var _=require('lodash');var util=require(_0x72c2('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x72c2('0x1'));var BPromise=require(_0x72c2('0x2'));var rp=require(_0x72c2('0x3'));var fs=require('fs');var path=require(_0x72c2('0x4'));var rimraf=require(_0x72c2('0x5'));var config=require('../../config/environment');var attributes=require(_0x72c2('0x6'));module['exports']=function(_0x5e9ded,_0x3d65e0){return _0x5e9ded['define']('SmsMessage',attributes,{'tableName':_0x72c2('0x7'),'paranoid':![],'indexes':[{'name':_0x72c2('0x8'),'fields':[_0x72c2('0x8')]},{'name':_0x72c2('0x9'),'fields':[_0x72c2('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f02d0,_0x1013a3,_0x24d8c8){var _0x316fb6=_0x5e9ded[_0x72c2('0xb')];var _0x437d41=_0x2f02d0[_0x72c2('0xc')]({'plain':!![]});if(_0x437d41[_0x72c2('0xd')]['toLowerCase']()==='in'||_0x437d41[_0x72c2('0xd')]['toLowerCase']()===_0x72c2('0xe')&&!_0x437d41[_0x72c2('0xf')]&&!_['isNil'](_0x437d41['UserId'])){_0x316fb6[_0x72c2('0x10')][_0x72c2('0x11')]({'where':{'id':_0x437d41[_0x72c2('0x12')]}})[_0x72c2('0x13')](function(_0x35c193){if(_0x35c193){_0x35c193['update']({'lastMsgAt':_0x437d41[_0x72c2('0x14')],'lastMsgDirection':_0x437d41['direction'][_0x72c2('0x15')]()});}})[_0x72c2('0x16')](function(_0x471627){console[_0x72c2('0x17')](_0x471627);});}if(_0x437d41[_0x72c2('0xd')]===_0x72c2('0xe')&&!_0x437d41['secret']){var _0x9f7017;_0x316fb6['SmsAccount'][_0x72c2('0x18')]({'where':{'id':_0x437d41['SmsAccountId']},'raw':!![]})[_0x72c2('0x13')](function(_0x480337){_0x9f7017=_0x480337;if(_0x9f7017&&_0x9f7017[_0x72c2('0x19')]){switch(_0x9f7017[_0x72c2('0x19')]){case _0x72c2('0x1a'):var _0x39e301=require(_0x72c2('0x1a'));if(_0x9f7017[_0x72c2('0x1b')]&&_0x9f7017[_0x72c2('0x1c')]&&_0x9f7017[_0x72c2('0x1d')]){var _0x5e9713=new _0x39e301(_0x9f7017[_0x72c2('0x1b')],_0x9f7017['authToken']);_0x5e9713[_0x72c2('0x1e')][_0x72c2('0x1f')]({'body':_0x437d41['body'],'to':_0x437d41[_0x72c2('0x1d')],'from':_0x9f7017[_0x72c2('0x1d')],'statusCallback':_0x9f7017['remote']+'/api/sms/messages/'+_0x437d41['id']+_0x72c2('0x20')+_0x9f7017[_0x72c2('0x21')]})[_0x72c2('0x13')](function(_0x27427c){if(_0x27427c[_0x72c2('0x22')]){return _0x2f02d0[_0x72c2('0x23')]({'messageId':_0x27427c[_0x72c2('0x22')]});}})['catch'](function(_0x284206){logger['error'](_0x72c2('0x24'),_0x72c2('0x25'),'twilio',util[_0x72c2('0x26')](_0x284206,{'showHidden':![],'depth':null}));});}else{logger[_0x72c2('0x17')](_0x72c2('0x24'),_0x72c2('0x25'),_0x72c2('0x1a'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x72c2('0x27'):var _0x1fbcdd=_0x72c2('0x28');if(_0x9f7017[_0x72c2('0x29')]&&_0x9f7017['password']){var _0x21990d={'recipient':[_0x437d41[_0x72c2('0x1d')]],'message':_0x437d41[_0x72c2('0xa')],'message_type':_0x9f7017['smsMethod']};if(_0x9f7017[_0x72c2('0x2a')]&&_0x9f7017[_0x72c2('0x2a')]!=='SI'){_0x21990d[_0x72c2('0x2b')]=_0x9f7017[_0x72c2('0x1d')];}var _0x44caaa={'url':_0x1fbcdd+'login?username='+_0x9f7017['username']+_0x72c2('0x2c')+_0x9f7017[_0x72c2('0x2d')],'method':'GET'};rp(_0x44caaa)[_0x72c2('0x13')](function(_0x1759f6){var _0x1489e0=_0x1759f6[_0x72c2('0x2e')](';');var _0x31c4e4={'user_key':_0x1489e0[0x0],'session_key':_0x1489e0[0x1]};_0x44caaa={'url':_0x1fbcdd+_0x72c2('0x2f'),'method':'POST','headers':{'user_key':_0x31c4e4['user_key'],'Session_key':_0x31c4e4['session_key']},'json':!![],'body':_0x21990d};return rp(_0x44caaa);})[_0x72c2('0x13')](function(_0x444b1e){if(_0x444b1e[_0x72c2('0x30')]>=0x1){var _0xd107e3={'messageId':_0x444b1e[_0x72c2('0x31')]};if(_0x9f7017[_0x72c2('0x2a')]!=='GP'||!_0x9f7017[_0x72c2('0x32')]){_0xd107e3[_0x72c2('0x33')]=!![];}return _0x2f02d0[_0x72c2('0x23')](_0xd107e3);}else{return logger[_0x72c2('0x17')](_0x72c2('0x24'),'afterCreate','skebby',util[_0x72c2('0x26')](_0x444b1e,{'showHidden':![],'depth':null}));}})['catch'](function(_0x36c8f5){return logger[_0x72c2('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x72c2('0x25'),'skebby',util[_0x72c2('0x26')](_0x36c8f5,{'showHidden':![],'depth':null}));});}else{logger[_0x72c2('0x17')](_0x72c2('0x24'),'afterCreate','skebby',_0x72c2('0x34'));}break;case _0x72c2('0x35'):if(_0x9f7017[_0x72c2('0x1c')]){var _0x592f60={'recipient':_0x437d41[_0x72c2('0x1d')],'message':_0x437d41[_0x72c2('0xa')],'sender':_0x9f7017[_0x72c2('0x36')]||_0x9f7017[_0x72c2('0x1d')],'authorization':_0x9f7017[_0x72c2('0x1c')]};var _0x1013a3={'method':_0x72c2('0x37'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x592f60,'json':!![]};rp(_0x1013a3)[_0x72c2('0x13')](function(_0x2c502a){var _0x4faa3e={'messageId':_0x2c502a[_0x72c2('0x38')]};if(!_0x9f7017['deliveryReport']){_0x4faa3e[_0x72c2('0x33')]=!![];}return _0x2f02d0[_0x72c2('0x23')](_0x4faa3e);})['catch'](function(_0xf5cb6){logger[_0x72c2('0x17')](_0x72c2('0x24'),_0x72c2('0x25'),_0x72c2('0x35'),util[_0x72c2('0x26')](_0xf5cb6,{'showHidden':![],'depth':null}));});}else{logger[_0x72c2('0x17')](_0x72c2('0x24'),'afterCreate',_0x72c2('0x35'),_0x72c2('0x39'));}break;case _0x72c2('0x3a'):if(_0x9f7017[_0x72c2('0x29')]&&_0x9f7017[_0x72c2('0x2d')]){var _0x592f60={'messages':[{'source':_0x72c2('0x3b'),'to':_0x437d41['phone'],'body':_0x437d41[_0x72c2('0xa')],'from':_0x9f7017[_0x72c2('0x36')]||_0x9f7017['phone']}]};var _0x29a2ad=util[_0x72c2('0x3c')](_0x72c2('0x3d'),_0x9f7017[_0x72c2('0x29')],_0x9f7017[_0x72c2('0x2d')]);var _0x1013a3={'method':'POST','uri':_0x72c2('0x3e'),'body':_0x592f60,'headers':{'Authorization':util['format'](_0x72c2('0x3f'),new Buffer(_0x29a2ad)[_0x72c2('0x40')](_0x72c2('0x41')))},'json':!![]};rp(_0x1013a3)[_0x72c2('0x13')](function(_0x478fde){if(_0x478fde['http_code']>=0xc8&&_0x478fde['http_code']<=0xce){if(_0x478fde[_0x72c2('0x42')]&&_0x478fde['data'][_0x72c2('0x43')]>0x0){var _0x31e437=_[_0x72c2('0x44')](_0x478fde[_0x72c2('0x42')][_0x72c2('0x1e')]);var _0x5007df={'messageId':_0x31e437['message_id']};if(!_0x9f7017[_0x72c2('0x32')]){_0x5007df[_0x72c2('0x33')]=!![];}return _0x2f02d0['update'](_0x5007df);}else{logger[_0x72c2('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x72c2('0x25'),_0x72c2('0x45'),util['inspect'](_0x478fde,{'showHidden':![],'depth':null}));}}else{logger[_0x72c2('0x17')](_0x72c2('0x24'),_0x72c2('0x25'),'clickSend',util[_0x72c2('0x26')](_0x478fde,{'showHidden':![],'depth':null}));}})[_0x72c2('0x16')](function(_0x3d2f7e){logger['error'](_0x72c2('0x24'),_0x72c2('0x25'),_0x72c2('0x45'),util[_0x72c2('0x26')](_0x3d2f7e,{'showHidden':![],'depth':null}));});}else{logger[_0x72c2('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x72c2('0x25'),_0x72c2('0x45'),_0x72c2('0x34'));}break;case'plivo':if(_0x9f7017['authId']&&_0x9f7017[_0x72c2('0x1c')]){var _0x592f60={'dst':_0x437d41[_0x72c2('0x1d')],'text':_0x437d41[_0x72c2('0xa')],'src':_0x9f7017[_0x72c2('0x36')]||_0x9f7017[_0x72c2('0x1d')],'url':_0x9f7017[_0x72c2('0x46')]+_0x72c2('0x47')+_0x437d41['id']+_0x72c2('0x20')+_0x9f7017[_0x72c2('0x21')]};var _0x29a2ad=util[_0x72c2('0x3c')](_0x72c2('0x3d'),_0x9f7017[_0x72c2('0x48')],_0x9f7017[_0x72c2('0x1c')]);var _0x1013a3={'method':'POST','uri':util[_0x72c2('0x3c')](_0x72c2('0x49'),_0x9f7017[_0x72c2('0x48')]),'body':_0x592f60,'headers':{'Authorization':util['format'](_0x72c2('0x3f'),new Buffer(_0x29a2ad)['toString'](_0x72c2('0x41')))},'json':!![]};rp(_0x1013a3)['then'](function(_0x1b77ca){var _0x4f536e={'messageId':_0x1b77ca[_0x72c2('0x4a')][0x0]};return _0x2f02d0[_0x72c2('0x23')](_0x4f536e);})[_0x72c2('0x16')](function(_0x5cc3f2){logger[_0x72c2('0x17')](_0x72c2('0x24'),_0x72c2('0x25'),'plivo',util[_0x72c2('0x26')](_0x5cc3f2,{'showHidden':![],'depth':null}));});}else{logger[_0x72c2('0x17')](_0x72c2('0x24'),_0x72c2('0x25'),_0x72c2('0x4b'),_0x72c2('0x4c'));}break;case _0x72c2('0x4d'):if(_0x9f7017['username']&&_0x9f7017[_0x72c2('0x2d')]){if(_0x9f7017[_0x72c2('0x4e')]){var _0x583130={'method':_0x72c2('0x37'),'uri':_0x9f7017[_0x72c2('0x4e')]+_0x72c2('0x4f'),'body':{'username':_0x9f7017[_0x72c2('0x29')],'password':_0x9f7017[_0x72c2('0x2d')]},'json':!![]};return rp(_0x583130)[_0x72c2('0x13')](function(_0x1f6e4f){var _0x2a9bf6={'method':_0x72c2('0x37'),'uri':_0x9f7017[_0x72c2('0x4e')]+_0x72c2('0x50'),'body':{'messages':[{'from':_0x9f7017[_0x72c2('0x1d')],'destinations':[{'to':_0x437d41[_0x72c2('0x1d')]}],'text':_0x437d41[_0x72c2('0xa')],'notifyUrl':_0x9f7017[_0x72c2('0x46')]+_0x72c2('0x47')+_0x437d41['id']+_0x72c2('0x20')+_0x9f7017[_0x72c2('0x21')],'notifyContentType':_0x72c2('0x51'),'callbackData':_0x9f7017['phone']+';'+_0x437d41[_0x72c2('0xa')]}]},'headers':{'Authorization':_0x72c2('0x52')+_0x1f6e4f[_0x72c2('0x21')]},'json':!![]};return rp(_0x2a9bf6)['then'](function(_0x530453){if(_0x530453[_0x72c2('0x1e')]){var _0x5c79b6={'messageId':_0x530453[_0x72c2('0x1e')][0x0][_0x72c2('0x8')]};if(!_0x9f7017[_0x72c2('0x32')]){_0x5c79b6[_0x72c2('0x33')]=!![];}return _0x2f02d0[_0x72c2('0x23')](_0x5c79b6);}else{return logger[_0x72c2('0x17')](_0x72c2('0x24'),_0x72c2('0x25'),_0x72c2('0x4d'),util[_0x72c2('0x26')](_0x530453,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x9e9dbc){return logger[_0x72c2('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x72c2('0x4d'),util[_0x72c2('0x26')](_0x9e9dbc,{'showHidden':![],'depth':null}));});}else{logger[_0x72c2('0x17')](_0x72c2('0x24'),_0x72c2('0x25'),_0x72c2('0x4d'),_0x72c2('0x53'));}}else{logger[_0x72c2('0x17')](_0x72c2('0x24'),'afterCreate','infobip',_0x72c2('0x34'));}break;case _0x72c2('0x54'):var _0x29d87f=require(_0x72c2('0x55'));if(_0x9f7017['apiKey']){var _0x24f945={};_0x24f945[_0x72c2('0x56')]=_0x9f7017['username'];_0x24f945[_0x72c2('0x1d')]=_0x437d41[_0x72c2('0x1d')];_0x24f945[_0x72c2('0x2b')]=_0x9f7017[_0x72c2('0x1d')];_0x24f945['text']=_0x437d41['body'];_0x24f945[_0x72c2('0x57')]=+new Date();var _0x473f6b='';var _0x3c8231='';var _0x22d58f=Object[_0x72c2('0x58')](_0x24f945);_0x22d58f['sort']();for(var _0xbe0cdb=0x0;_0xbe0cdb<_0x22d58f[_0x72c2('0x59')];_0xbe0cdb++){if(_0x473f6b!=''){_0x473f6b+='&';}_0x473f6b+=_0x22d58f[_0xbe0cdb]+'='+encodeURIComponent(_0x24f945[_0x22d58f[_0xbe0cdb]]);_0x3c8231+=_0x24f945[_0x22d58f[_0xbe0cdb]];}_0x3c8231+=_0x9f7017[_0x72c2('0x5a')];_0x3c8231=_0x29d87f[_0x72c2('0x5b')](_0x72c2('0x5c'))[_0x72c2('0x23')](_0x3c8231)[_0x72c2('0x5d')]('hex');if(_0x473f6b!==''){_0x473f6b+='&';}_0x473f6b+=_0x72c2('0x5e')+_0x3c8231;var _0x44caaa={'method':'GET','uri':_0x9f7017[_0x72c2('0x4e')]+_0x72c2('0x5f')+_0x473f6b,'json':!![]};return rp(_0x44caaa)[_0x72c2('0x13')](function(_0x4d9a56){var _0x8d855d=Object[_0x72c2('0x58')](_0x4d9a56);if(_0x4d9a56[_0x8d855d[0x0]]['error']&&parseInt(_0x4d9a56[_0x8d855d[0x0]][_0x72c2('0x17')])===0x0){var _0x27eeab={'messageId':_0x4d9a56[_0x8d855d[0x0]][_0x72c2('0x60')]};if(!_0x9f7017[_0x72c2('0x32')]){_0x27eeab[_0x72c2('0x33')]=!![];}return _0x2f02d0['update'](_0x27eeab);}else{return logger['error'](_0x72c2('0x24'),_0x72c2('0x25'),_0x72c2('0x54'),util[_0x72c2('0x26')](_0x4d9a56[_0x72c2('0x17')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x44af6e){return logger[_0x72c2('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x72c2('0x25'),_0x72c2('0x54'),util['inspect'](_0x44af6e,{'showHidden':![],'depth':null}));});}else{logger[_0x72c2('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x72c2('0x25'),_0x72c2('0x54'),_0x72c2('0x61'));}break;case _0x72c2('0x62'):if(_0x9f7017[_0x72c2('0x5a')]){var _0x2dc202={'method':_0x72c2('0x37'),'uri':_0x72c2('0x63'),'headers':{'Authorization':_0x9f7017[_0x72c2('0x5a')]},'body':{'content':_0x437d41[_0x72c2('0xa')],'to':[_0x437d41[_0x72c2('0x1d')]],'from':_0x9f7017['phone'],'binary':![],'clientMessageId':_0x72c2('0x64'),'charset':_0x72c2('0x65')},'json':!![]};rp(_0x2dc202)['then'](function(_0x152673){if(!_0x152673[_0x72c2('0x17')]){var _0x131a9f={'messageId':_0x152673[_0x72c2('0x1e')][0x0][_0x72c2('0x66')]};if(!_0x9f7017[_0x72c2('0x32')]){_0x131a9f['read']=!![];}return _0x2f02d0[_0x72c2('0x23')](_0x131a9f);}else{return logger['error'](_0x72c2('0x24'),_0x72c2('0x25'),_0x72c2('0x62'),util[_0x72c2('0x26')](_0x152673[_0x72c2('0x17')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x33c266){return logger[_0x72c2('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x72c2('0x25'),'clickatell',util[_0x72c2('0x26')](_0x33c266,{'showHidden':![],'depth':null}));});}else{logger[_0x72c2('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x72c2('0x25'),_0x72c2('0x62'),'Missing\x20parameters:\x20apiKey');}break;case _0x72c2('0x67'):if(_0x9f7017[_0x72c2('0x29')]&&_0x9f7017[_0x72c2('0x2d')]){var _0x29a2ad=util['format'](_0x72c2('0x3d'),_0x9f7017[_0x72c2('0x29')],_0x9f7017[_0x72c2('0x2d')]);var _0x1013a3={'method':_0x72c2('0x37'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x9f7017[_0x72c2('0x68')]+_0x72c2('0x69'),'body':{'to':[_0x437d41['phone']],'text':_0x437d41[_0x72c2('0xa')],'from':_0x9f7017[_0x72c2('0x1d')],'applicationId':_0x9f7017[_0x72c2('0x6a')]},'headers':{'Authorization':util[_0x72c2('0x3c')]('Basic\x20%s',new Buffer(_0x29a2ad)[_0x72c2('0x40')](_0x72c2('0x41')))},'json':!![]};rp(_0x1013a3)['then'](function(_0x31a3b3){if(_0x31a3b3['id']){var _0x4c18b1={'messageId':_0x31a3b3['id']};return _0x2f02d0[_0x72c2('0x23')](_0x4c18b1);}else{logger['error'](_0x72c2('0x24'),_0x72c2('0x25'),_0x72c2('0x67'),util['inspect'](_0x31a3b3,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2c4c4f){logger[_0x72c2('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x72c2('0x67'),util['inspect'](_0x2c4c4f,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x72c2('0x25'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0x72c2('0x6b'):if(_0x9f7017[_0x72c2('0x5a')]){var _0x3f71e6={};var _0x44caaa={'method':_0x72c2('0x37'),'uri':_0x72c2('0x6c'),'headers':{'Authorization':'Bearer\x20'+_0x9f7017[_0x72c2('0x5a')],'Content-Type':_0x72c2('0x51')},'body':{'from':_0x9f7017['phone'],'to':_0x437d41[_0x72c2('0x1d')],'text':_0x437d41[_0x72c2('0xa')]},'json':!![]};return rp(_0x44caaa)[_0x72c2('0x13')](function(_0x535a59){if(_0x535a59[_0x72c2('0x6d')]==0xca){_0x3f71e6['message']=_0x535a59;var _0x39400b={'method':_0x72c2('0x37'),'uri':_0x72c2('0x6e'),'headers':{'Authorization':_0x72c2('0x6f')+_0x9f7017['apiKey'],'Content-Type':_0x72c2('0x51')},'body':{'refid':_0x3f71e6[_0x72c2('0x70')][_0x72c2('0x71')]},'json':!![]};return rp(_0x39400b)[_0x72c2('0x13')](function(_0xb6343a){_0x3f71e6[_0x72c2('0x72')]=_0xb6343a;var _0x593f81={'messageId':_0x3f71e6[_0x72c2('0x70')][_0x72c2('0x71')],'read':!![]};return _0x2f02d0[_0x72c2('0x23')](_0x593f81);});}else{return logger[_0x72c2('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x72c2('0x25'),_0x72c2('0x6b'),util[_0x72c2('0x26')](_0x535a59,{'showHidden':![],'depth':null}));}})[_0x72c2('0x16')](function(_0x1e3641){return logger['error'](_0x72c2('0x24'),_0x72c2('0x25'),_0x72c2('0x6b'),util[_0x72c2('0x26')](_0x1e3641,{'showHidden':![],'depth':null}));});}else{return logger[_0x72c2('0x17')](_0x72c2('0x24'),_0x72c2('0x25'),'intelepeer','Token\x20not\x20received');}break;}}})['finally'](function(){_0x24d8c8();});}else{_0x24d8c8();}}},'charset':_0x72c2('0x73'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x11fb=['authToken','phone','create','remote','token','then','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','split','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','toString','http_code','data','head','messages','message_id','clickSend','authId','/api/sms/messages/','base64','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','/status?token=','application/json','IBSSO\x20','infobip','csc','apiKey','login','text','timestamp','digest','hex','signature=','GET','/external/get/send.php?','keys','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','accountId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','SmsInteractionId','createdAt','catch','error','SmsAccount','SmsAccountId','type','twilio','accountSid'];(function(_0x5d57fc,_0x49f7d6){var _0x2729c9=function(_0xb5463e){while(--_0xb5463e){_0x5d57fc['push'](_0x5d57fc['shift']());}};_0x2729c9(++_0x49f7d6);}(_0x11fb,0x147));var _0xb11f=function(_0x34d8ab,_0x468f0e){_0x34d8ab=_0x34d8ab-0x0;var _0x46643e=_0x11fb[_0x34d8ab];return _0x46643e;};'use strict';var _=require(_0xb11f('0x0'));var util=require(_0xb11f('0x1'));var logger=require('../../config/logger')(_0xb11f('0x2'));var moment=require(_0xb11f('0x3'));var BPromise=require(_0xb11f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb11f('0x5'));var rimraf=require(_0xb11f('0x6'));var config=require(_0xb11f('0x7'));var attributes=require(_0xb11f('0x8'));module[_0xb11f('0x9')]=function(_0x3e26db,_0x2a8483){return _0x3e26db[_0xb11f('0xa')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xb11f('0xb'),'fields':[_0xb11f('0xb')]},{'name':_0xb11f('0xc'),'fields':[_0xb11f('0xd')],'type':_0xb11f('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4677a1,_0x203783,_0x10639d){var _0x1407ab=_0x3e26db[_0xb11f('0xf')];var _0x2fc26a=_0x4677a1[_0xb11f('0x10')]({'plain':!![]});if(_0x2fc26a[_0xb11f('0x11')][_0xb11f('0x12')]()==='in'||_0x2fc26a[_0xb11f('0x11')][_0xb11f('0x12')]()===_0xb11f('0x13')&&!_0x2fc26a[_0xb11f('0x14')]&&!_[_0xb11f('0x15')](_0x2fc26a[_0xb11f('0x16')])){_0x1407ab[_0xb11f('0x17')]['findOne']({'where':{'id':_0x2fc26a[_0xb11f('0x18')]}})['then'](function(_0x3d70df){if(_0x3d70df){_0x3d70df['update']({'lastMsgAt':_0x2fc26a[_0xb11f('0x19')],'lastMsgDirection':_0x2fc26a[_0xb11f('0x11')][_0xb11f('0x12')]()});}})[_0xb11f('0x1a')](function(_0x1f85be){console[_0xb11f('0x1b')](_0x1f85be);});}if(_0x2fc26a[_0xb11f('0x11')]==='out'&&!_0x2fc26a[_0xb11f('0x14')]){var _0x53eb9f;_0x1407ab[_0xb11f('0x1c')]['find']({'where':{'id':_0x2fc26a[_0xb11f('0x1d')]},'raw':!![]})['then'](function(_0x5ec6d5){_0x53eb9f=_0x5ec6d5;if(_0x53eb9f&&_0x53eb9f[_0xb11f('0x1e')]){switch(_0x53eb9f[_0xb11f('0x1e')]){case'twilio':var _0x3d6520=require(_0xb11f('0x1f'));if(_0x53eb9f[_0xb11f('0x20')]&&_0x53eb9f[_0xb11f('0x21')]&&_0x53eb9f[_0xb11f('0x22')]){var _0x19dc64=new _0x3d6520(_0x53eb9f[_0xb11f('0x20')],_0x53eb9f[_0xb11f('0x21')]);_0x19dc64['messages'][_0xb11f('0x23')]({'body':_0x2fc26a[_0xb11f('0xd')],'to':_0x2fc26a[_0xb11f('0x22')],'from':_0x53eb9f[_0xb11f('0x22')],'statusCallback':_0x53eb9f[_0xb11f('0x24')]+'/api/sms/messages/'+_0x2fc26a['id']+'/status?token='+_0x53eb9f[_0xb11f('0x25')]})[_0xb11f('0x26')](function(_0x3a649d){if(_0x3a649d[_0xb11f('0x27')]){return _0x4677a1[_0xb11f('0x28')]({'messageId':_0x3a649d[_0xb11f('0x27')]});}})[_0xb11f('0x1a')](function(_0x253b43){logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x1f'),util[_0xb11f('0x2b')](_0x253b43,{'showHidden':![],'depth':null}));});}else{logger[_0xb11f('0x1b')](_0xb11f('0x29'),'afterCreate',_0xb11f('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xb11f('0x2c'):var _0x1e17d7=_0xb11f('0x2d');if(_0x53eb9f[_0xb11f('0x2e')]&&_0x53eb9f[_0xb11f('0x2f')]){var _0x54880e={'recipient':[_0x2fc26a[_0xb11f('0x22')]],'message':_0x2fc26a[_0xb11f('0xd')],'message_type':_0x53eb9f[_0xb11f('0x30')]};if(_0x53eb9f[_0xb11f('0x30')]&&_0x53eb9f[_0xb11f('0x30')]!=='SI'){_0x54880e[_0xb11f('0x31')]=_0x53eb9f[_0xb11f('0x22')];}var _0xa307ef={'url':_0x1e17d7+_0xb11f('0x32')+_0x53eb9f[_0xb11f('0x2e')]+_0xb11f('0x33')+_0x53eb9f[_0xb11f('0x2f')],'method':'GET'};rp(_0xa307ef)[_0xb11f('0x26')](function(_0x1599ea){var _0x321855=_0x1599ea[_0xb11f('0x34')](';');var _0xb795bc={'user_key':_0x321855[0x0],'session_key':_0x321855[0x1]};_0xa307ef={'url':_0x1e17d7+'sms','method':_0xb11f('0x35'),'headers':{'user_key':_0xb795bc[_0xb11f('0x36')],'Session_key':_0xb795bc[_0xb11f('0x37')]},'json':!![],'body':_0x54880e};return rp(_0xa307ef);})[_0xb11f('0x26')](function(_0x727e7e){if(_0x727e7e[_0xb11f('0x38')]>=0x1){var _0x937101={'messageId':_0x727e7e[_0xb11f('0x39')]};if(_0x53eb9f[_0xb11f('0x30')]!=='GP'||!_0x53eb9f[_0xb11f('0x3a')]){_0x937101['read']=!![];}return _0x4677a1['update'](_0x937101);}else{return logger[_0xb11f('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb11f('0x2a'),_0xb11f('0x2c'),util[_0xb11f('0x2b')](_0x727e7e,{'showHidden':![],'depth':null}));}})[_0xb11f('0x1a')](function(_0xf582ae){return logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x2c'),util[_0xb11f('0x2b')](_0xf582ae,{'showHidden':![],'depth':null}));});}else{logger[_0xb11f('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb11f('0x2a'),'skebby',_0xb11f('0x3b'));}break;case _0xb11f('0x3c'):if(_0x53eb9f[_0xb11f('0x21')]){var _0x53465d={'recipient':_0x2fc26a[_0xb11f('0x22')],'message':_0x2fc26a[_0xb11f('0xd')],'sender':_0x53eb9f[_0xb11f('0x3d')]||_0x53eb9f['phone'],'authorization':_0x53eb9f[_0xb11f('0x21')]};var _0x203783={'method':'POST','uri':_0xb11f('0x3e'),'body':_0x53465d,'json':!![]};rp(_0x203783)[_0xb11f('0x26')](function(_0x3664ed){var _0x4f13ec={'messageId':_0x3664ed['requestid']};if(!_0x53eb9f[_0xb11f('0x3a')]){_0x4f13ec[_0xb11f('0x3f')]=!![];}return _0x4677a1[_0xb11f('0x28')](_0x4f13ec);})[_0xb11f('0x1a')](function(_0x224860){logger[_0xb11f('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb11f('0x2a'),'connectel',util['inspect'](_0x224860,{'showHidden':![],'depth':null}));});}else{logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),'connectel',_0xb11f('0x40'));}break;case _0xb11f('0x41'):if(_0x53eb9f[_0xb11f('0x2e')]&&_0x53eb9f[_0xb11f('0x2f')]){var _0x53465d={'messages':[{'source':_0xb11f('0x42'),'to':_0x2fc26a[_0xb11f('0x22')],'body':_0x2fc26a['body'],'from':_0x53eb9f['senderString']||_0x53eb9f[_0xb11f('0x22')]}]};var _0x1f2fc0=util[_0xb11f('0x43')](_0xb11f('0x44'),_0x53eb9f['username'],_0x53eb9f[_0xb11f('0x2f')]);var _0x203783={'method':_0xb11f('0x35'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x53465d,'headers':{'Authorization':util[_0xb11f('0x43')](_0xb11f('0x45'),new Buffer(_0x1f2fc0)[_0xb11f('0x46')]('base64'))},'json':!![]};rp(_0x203783)[_0xb11f('0x26')](function(_0x4e8b86){if(_0x4e8b86[_0xb11f('0x47')]>=0xc8&&_0x4e8b86['http_code']<=0xce){if(_0x4e8b86[_0xb11f('0x48')]&&_0x4e8b86[_0xb11f('0x48')]['queued_count']>0x0){var _0x4f9e60=_[_0xb11f('0x49')](_0x4e8b86[_0xb11f('0x48')][_0xb11f('0x4a')]);var _0x3898a9={'messageId':_0x4f9e60[_0xb11f('0x4b')]};if(!_0x53eb9f[_0xb11f('0x3a')]){_0x3898a9[_0xb11f('0x3f')]=!![];}return _0x4677a1[_0xb11f('0x28')](_0x3898a9);}else{logger[_0xb11f('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb11f('0x2a'),_0xb11f('0x4c'),util['inspect'](_0x4e8b86,{'showHidden':![],'depth':null}));}}else{logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x4c'),util['inspect'](_0x4e8b86,{'showHidden':![],'depth':null}));}})['catch'](function(_0x576778){logger[_0xb11f('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb11f('0x2a'),_0xb11f('0x4c'),util[_0xb11f('0x2b')](_0x576778,{'showHidden':![],'depth':null}));});}else{logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x4c'),_0xb11f('0x3b'));}break;case'plivo':if(_0x53eb9f[_0xb11f('0x4d')]&&_0x53eb9f[_0xb11f('0x21')]){var _0x53465d={'dst':_0x2fc26a[_0xb11f('0x22')],'text':_0x2fc26a[_0xb11f('0xd')],'src':_0x53eb9f[_0xb11f('0x3d')]||_0x53eb9f[_0xb11f('0x22')],'url':_0x53eb9f[_0xb11f('0x24')]+_0xb11f('0x4e')+_0x2fc26a['id']+'/status?token='+_0x53eb9f[_0xb11f('0x25')]};var _0x1f2fc0=util[_0xb11f('0x43')]('%s:%s',_0x53eb9f[_0xb11f('0x4d')],_0x53eb9f[_0xb11f('0x21')]);var _0x203783={'method':_0xb11f('0x35'),'uri':util[_0xb11f('0x43')]('https://api.plivo.com/v1/Account/%s/Message/',_0x53eb9f['authId']),'body':_0x53465d,'headers':{'Authorization':util[_0xb11f('0x43')](_0xb11f('0x45'),new Buffer(_0x1f2fc0)[_0xb11f('0x46')](_0xb11f('0x4f')))},'json':!![]};rp(_0x203783)[_0xb11f('0x26')](function(_0x3768e4){var _0x9aefc8={'messageId':_0x3768e4[_0xb11f('0x50')][0x0]};return _0x4677a1[_0xb11f('0x28')](_0x9aefc8);})[_0xb11f('0x1a')](function(_0x494c54){logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x51'),util['inspect'](_0x494c54,{'showHidden':![],'depth':null}));});}else{logger[_0xb11f('0x1b')](_0xb11f('0x29'),'afterCreate',_0xb11f('0x51'),_0xb11f('0x52'));}break;case'infobip':if(_0x53eb9f[_0xb11f('0x2e')]&&_0x53eb9f['password']){if(_0x53eb9f[_0xb11f('0x53')]){var _0x299599={'method':_0xb11f('0x35'),'uri':_0x53eb9f[_0xb11f('0x53')]+_0xb11f('0x54'),'body':{'username':_0x53eb9f[_0xb11f('0x2e')],'password':_0x53eb9f['password']},'json':!![]};return rp(_0x299599)[_0xb11f('0x26')](function(_0x51f017){var _0x6694fd={'method':_0xb11f('0x35'),'uri':_0x53eb9f[_0xb11f('0x53')]+_0xb11f('0x55'),'body':{'messages':[{'from':_0x53eb9f[_0xb11f('0x22')],'destinations':[{'to':_0x2fc26a['phone']}],'text':_0x2fc26a[_0xb11f('0xd')],'notifyUrl':_0x53eb9f[_0xb11f('0x24')]+'/api/sms/messages/'+_0x2fc26a['id']+_0xb11f('0x56')+_0x53eb9f[_0xb11f('0x25')],'notifyContentType':_0xb11f('0x57'),'callbackData':_0x53eb9f[_0xb11f('0x22')]+';'+_0x2fc26a[_0xb11f('0xd')]}]},'headers':{'Authorization':_0xb11f('0x58')+_0x51f017[_0xb11f('0x25')]},'json':!![]};return rp(_0x6694fd)['then'](function(_0x478599){if(_0x478599[_0xb11f('0x4a')]){var _0x38e270={'messageId':_0x478599['messages'][0x0]['messageId']};if(!_0x53eb9f[_0xb11f('0x3a')]){_0x38e270['read']=!![];}return _0x4677a1[_0xb11f('0x28')](_0x38e270);}else{return logger[_0xb11f('0x1b')](_0xb11f('0x29'),'afterCreate',_0xb11f('0x59'),util[_0xb11f('0x2b')](_0x478599,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x267c62){return logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x59'),util[_0xb11f('0x2b')](_0x267c62,{'showHidden':![],'depth':null}));});}else{logger[_0xb11f('0x1b')](_0xb11f('0x29'),'afterCreate',_0xb11f('0x59'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),'infobip',_0xb11f('0x3b'));}break;case _0xb11f('0x5a'):var _0x1c391c=require('crypto');if(_0x53eb9f[_0xb11f('0x5b')]){var _0x273d35={};_0x273d35[_0xb11f('0x5c')]=_0x53eb9f[_0xb11f('0x2e')];_0x273d35[_0xb11f('0x22')]=_0x2fc26a[_0xb11f('0x22')];_0x273d35[_0xb11f('0x31')]=_0x53eb9f[_0xb11f('0x22')];_0x273d35[_0xb11f('0x5d')]=_0x2fc26a[_0xb11f('0xd')];_0x273d35[_0xb11f('0x5e')]=+new Date();var _0x2c5001='';var _0x142799='';var _0x53baf0=Object['keys'](_0x273d35);_0x53baf0['sort']();for(var _0x16ceb2=0x0;_0x16ceb2<_0x53baf0['length'];_0x16ceb2++){if(_0x2c5001!=''){_0x2c5001+='&';}_0x2c5001+=_0x53baf0[_0x16ceb2]+'='+encodeURIComponent(_0x273d35[_0x53baf0[_0x16ceb2]]);_0x142799+=_0x273d35[_0x53baf0[_0x16ceb2]];}_0x142799+=_0x53eb9f[_0xb11f('0x5b')];_0x142799=_0x1c391c['createHash']('md5')[_0xb11f('0x28')](_0x142799)[_0xb11f('0x5f')](_0xb11f('0x60'));if(_0x2c5001!==''){_0x2c5001+='&';}_0x2c5001+=_0xb11f('0x61')+_0x142799;var _0xa307ef={'method':_0xb11f('0x62'),'uri':_0x53eb9f['baseUrl']+_0xb11f('0x63')+_0x2c5001,'json':!![]};return rp(_0xa307ef)[_0xb11f('0x26')](function(_0x2c4520){var _0x52d2ac=Object[_0xb11f('0x64')](_0x2c4520);if(_0x2c4520[_0x52d2ac[0x0]][_0xb11f('0x1b')]&&parseInt(_0x2c4520[_0x52d2ac[0x0]]['error'])===0x0){var _0x8d3011={'messageId':_0x2c4520[_0x52d2ac[0x0]][_0xb11f('0x65')]};if(!_0x53eb9f[_0xb11f('0x3a')]){_0x8d3011[_0xb11f('0x3f')]=!![];}return _0x4677a1[_0xb11f('0x28')](_0x8d3011);}else{return logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x5a'),util['inspect'](_0x2c4520[_0xb11f('0x1b')],{'showHidden':![],'depth':null}));}})[_0xb11f('0x1a')](function(_0x57a8b2){return logger[_0xb11f('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb11f('0x2a'),_0xb11f('0x5a'),util[_0xb11f('0x2b')](_0x57a8b2,{'showHidden':![],'depth':null}));});}else{logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x5a'),'Missing\x20parameters:\x20apiKey');}break;case _0xb11f('0x66'):if(_0x53eb9f[_0xb11f('0x5b')]){var _0x32e287={'method':_0xb11f('0x35'),'uri':_0xb11f('0x67'),'headers':{'Authorization':_0x53eb9f['apiKey']},'body':{'content':_0x2fc26a[_0xb11f('0xd')],'to':[_0x2fc26a[_0xb11f('0x22')]],'from':_0x53eb9f[_0xb11f('0x22')],'binary':![],'clientMessageId':_0xb11f('0x68'),'charset':_0xb11f('0x69')},'json':!![]};rp(_0x32e287)[_0xb11f('0x26')](function(_0x26cfd6){if(!_0x26cfd6[_0xb11f('0x1b')]){var _0xcdd7d6={'messageId':_0x26cfd6['messages'][0x0][_0xb11f('0x6a')]};if(!_0x53eb9f['deliveryReport']){_0xcdd7d6[_0xb11f('0x3f')]=!![];}return _0x4677a1[_0xb11f('0x28')](_0xcdd7d6);}else{return logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x66'),util[_0xb11f('0x2b')](_0x26cfd6[_0xb11f('0x1b')],{'showHidden':![],'depth':null}));}})[_0xb11f('0x1a')](function(_0x342390){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb11f('0x2a'),_0xb11f('0x66'),util[_0xb11f('0x2b')](_0x342390,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb11f('0x29'),'afterCreate','clickatell',_0xb11f('0x6b'));}break;case _0xb11f('0x6c'):if(_0x53eb9f[_0xb11f('0x2e')]&&_0x53eb9f[_0xb11f('0x2f')]){var _0x1f2fc0=util[_0xb11f('0x43')](_0xb11f('0x44'),_0x53eb9f[_0xb11f('0x2e')],_0x53eb9f[_0xb11f('0x2f')]);var _0x203783={'method':_0xb11f('0x35'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x53eb9f[_0xb11f('0x6d')]+'/messages','body':{'to':[_0x2fc26a[_0xb11f('0x22')]],'text':_0x2fc26a['body'],'from':_0x53eb9f[_0xb11f('0x22')],'applicationId':_0x53eb9f['applicationId']},'headers':{'Authorization':util[_0xb11f('0x43')](_0xb11f('0x45'),new Buffer(_0x1f2fc0)[_0xb11f('0x46')]('base64'))},'json':!![]};rp(_0x203783)[_0xb11f('0x26')](function(_0x3e1256){if(_0x3e1256['id']){var _0x3472c3={'messageId':_0x3e1256['id']};return _0x4677a1[_0xb11f('0x28')](_0x3472c3);}else{logger[_0xb11f('0x1b')](_0xb11f('0x29'),'afterCreate',_0xb11f('0x6c'),util[_0xb11f('0x2b')](_0x3e1256,{'showHidden':![],'depth':null}));}})[_0xb11f('0x1a')](function(_0x55cf35){logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x6c'),util[_0xb11f('0x2b')](_0x55cf35,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x6c'),_0xb11f('0x3b'));}break;case _0xb11f('0x6e'):if(_0x53eb9f['apiKey']){var _0x1b4879={};var _0xa307ef={'method':_0xb11f('0x35'),'uri':_0xb11f('0x6f'),'headers':{'Authorization':_0xb11f('0x70')+_0x53eb9f[_0xb11f('0x5b')],'Content-Type':_0xb11f('0x57')},'body':{'from':_0x53eb9f['phone'],'to':_0x2fc26a[_0xb11f('0x22')],'text':_0x2fc26a['body']},'json':!![]};return rp(_0xa307ef)[_0xb11f('0x26')](function(_0x1969c4){if(_0x1969c4[_0xb11f('0x71')]==0xca){_0x1b4879[_0xb11f('0x72')]=_0x1969c4;var _0x54c95f={'method':_0xb11f('0x35'),'uri':_0xb11f('0x73'),'headers':{'Authorization':_0xb11f('0x70')+_0x53eb9f[_0xb11f('0x5b')],'Content-Type':'application/json'},'body':{'refid':_0x1b4879[_0xb11f('0x72')][_0xb11f('0x74')]},'json':!![]};return rp(_0x54c95f)[_0xb11f('0x26')](function(_0x1e43b2){_0x1b4879['status']=_0x1e43b2;var _0x5bf4af={'messageId':_0x1b4879[_0xb11f('0x72')][_0xb11f('0x74')],'read':!![]};return _0x4677a1['update'](_0x5bf4af);});}else{return logger[_0xb11f('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb11f('0x2a'),_0xb11f('0x6e'),util[_0xb11f('0x2b')](_0x1969c4,{'showHidden':![],'depth':null}));}})[_0xb11f('0x1a')](function(_0x5df3c0){return logger[_0xb11f('0x1b')](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x6e'),util['inspect'](_0x5df3c0,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xb11f('0x29'),_0xb11f('0x2a'),_0xb11f('0x6e'),_0xb11f('0x75'));}break;}}})['finally'](function(){_0x10639d();});}else{_0x10639d();}}},'charset':_0xb11f('0x76'),'collate':_0xb11f('0x77')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 7e53345..6ce8345 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 _0x6253=['../../config/environment','client','http','defaults','localhost','redis','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','CreateSmsMessage','SmsMessage','create','body','raw','stringify','moment','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6253,0xf7));var _0x3625=function(_0x16789b,_0xff65c){_0x16789b=_0x16789b-0x0;var _0x144900=_0x6253[_0x16789b];return _0x144900;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3625('0x0'));var BPromise=require('bluebird');var rs=require(_0x3625('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3625('0x2'));var logger=require(_0x3625('0x3'))(_0x3625('0x4'));var config=require(_0x3625('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3625('0x6')][_0x3625('0x7')]({'port':0x232a});config['redis']=_[_0x3625('0x8')](config['redis'],{'host':_0x3625('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3625('0xa')]));require(_0x3625('0xb'))[_0x3625('0xc')](socket);function respondWithRpcPromise(_0x22a1ba,_0x3a3aaa,_0x317169){return new BPromise(function(_0xe0f6a5,_0x148b36){return client[_0x3625('0xd')](_0x22a1ba,_0x317169)[_0x3625('0xe')](function(_0x39c04a){logger[_0x3625('0xf')](_0x3625('0x10'),_0x3a3aaa,_0x3625('0x11'));logger[_0x3625('0x12')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3a3aaa,_0x3625('0x11'),JSON['stringify'](_0x39c04a));if(_0x39c04a[_0x3625('0x13')]){if(_0x39c04a[_0x3625('0x13')]['code']===0x1f4){logger[_0x3625('0x13')](_0x3625('0x10'),_0x3a3aaa,_0x39c04a[_0x3625('0x13')][_0x3625('0x14')]);return _0x148b36(_0x39c04a[_0x3625('0x13')][_0x3625('0x14')]);}logger['error'](_0x3625('0x10'),_0x3a3aaa,_0x39c04a[_0x3625('0x13')][_0x3625('0x14')]);return _0xe0f6a5(_0x39c04a[_0x3625('0x13')][_0x3625('0x14')]);}else{logger[_0x3625('0xf')](_0x3625('0x10'),_0x3a3aaa,_0x3625('0x11'));_0xe0f6a5(_0x39c04a[_0x3625('0x15')][_0x3625('0x14')]);}})['catch'](function(_0x5329a0){logger['error']('SmsMessage,\x20%s,\x20%s',_0x3a3aaa,_0x5329a0);_0x148b36(_0x5329a0);});});}exports[_0x3625('0x16')]=function(_0x58f468){var _0xc439c5=this;return new Promise(function(_0x4f6ae9,_0x11c216){return db[_0x3625('0x17')][_0x3625('0x18')](_0x58f468[_0x3625('0x19')],{'raw':_0x58f468['options']?_0x58f468['options'][_0x3625('0x1a')]===undefined?!![]:![]:!![]})[_0x3625('0xe')](function(_0x39cfdf){logger[_0x3625('0xf')]('CreateSmsMessage',_0x58f468);logger[_0x3625('0x12')](_0x3625('0x16'),_0x58f468,JSON[_0x3625('0x1b')](_0x39cfdf));_0x4f6ae9(_0x39cfdf);})['catch'](function(_0x11eefc){logger['error'](_0x3625('0x16'),_0x11eefc[_0x3625('0x14')],_0x58f468);_0x11c216(_0xc439c5[_0x3625('0x13')](0x1f4,_0x11eefc[_0x3625('0x14')]));});});}; \ No newline at end of file +var _0xffc9=['request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateSmsMessage','create','body','options','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','defaults','socket.io-emitter','./smsMessage.socket'];(function(_0x1d54ed,_0x30feb1){var _0x5a287c=function(_0x1009b7){while(--_0x1009b7){_0x1d54ed['push'](_0x1d54ed['shift']());}};_0x5a287c(++_0x30feb1);}(_0xffc9,0xb1));var _0x9ffc=function(_0xa91f01,_0x169324){_0xa91f01=_0xa91f01-0x0;var _0x5d9610=_0xffc9[_0xa91f01];return _0x5d9610;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9ffc('0x0'));var BPromise=require(_0x9ffc('0x1'));var rs=require(_0x9ffc('0x2'));var fs=require('fs');var Redis=require(_0x9ffc('0x3'));var db=require(_0x9ffc('0x4'))['db'];var utils=require(_0x9ffc('0x5'));var logger=require('../../config/logger')(_0x9ffc('0x6'));var config=require(_0x9ffc('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x9ffc('0x8')]=_[_0x9ffc('0x9')](config[_0x9ffc('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x9ffc('0xa'))(new Redis(config['redis']));require(_0x9ffc('0xb'))['register'](socket);function respondWithRpcPromise(_0x100ed4,_0x5a5210,_0x2f7ec6){return new BPromise(function(_0x381430,_0x156f0a){return client[_0x9ffc('0xc')](_0x100ed4,_0x2f7ec6)['then'](function(_0x20ed01){logger[_0x9ffc('0xd')](_0x9ffc('0xe'),_0x5a5210,_0x9ffc('0xf'));logger[_0x9ffc('0x10')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5a5210,'request\x20sent',JSON['stringify'](_0x20ed01));if(_0x20ed01['error']){if(_0x20ed01[_0x9ffc('0x11')][_0x9ffc('0x12')]===0x1f4){logger['error'](_0x9ffc('0xe'),_0x5a5210,_0x20ed01[_0x9ffc('0x11')][_0x9ffc('0x13')]);return _0x156f0a(_0x20ed01[_0x9ffc('0x11')]['message']);}logger[_0x9ffc('0x11')](_0x9ffc('0xe'),_0x5a5210,_0x20ed01[_0x9ffc('0x11')][_0x9ffc('0x13')]);return _0x381430(_0x20ed01[_0x9ffc('0x11')][_0x9ffc('0x13')]);}else{logger[_0x9ffc('0xd')](_0x9ffc('0xe'),_0x5a5210,_0x9ffc('0xf'));_0x381430(_0x20ed01[_0x9ffc('0x14')]['message']);}})[_0x9ffc('0x15')](function(_0x54fa4c){logger['error'](_0x9ffc('0xe'),_0x5a5210,_0x54fa4c);_0x156f0a(_0x54fa4c);});});}exports[_0x9ffc('0x16')]=function(_0x2f7479){var _0x284c8c=this;return new Promise(function(_0x1d37b6,_0x1d777d){return db['SmsMessage'][_0x9ffc('0x17')](_0x2f7479[_0x9ffc('0x18')],{'raw':_0x2f7479[_0x9ffc('0x19')]?_0x2f7479[_0x9ffc('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x9ffc('0x1a')](function(_0x12949c){logger[_0x9ffc('0xd')](_0x9ffc('0x16'),_0x2f7479);logger[_0x9ffc('0x10')](_0x9ffc('0x16'),_0x2f7479,JSON['stringify'](_0x12949c));_0x1d37b6(_0x12949c);})['catch'](function(_0x277d21){logger[_0x9ffc('0x11')](_0x9ffc('0x16'),_0x277d21['message'],_0x2f7479);_0x1d777d(_0x284c8c[_0x9ffc('0x11')](0x1f4,_0x277d21[_0x9ffc('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index eff462a..e1b82f4 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 _0x9556=['length','smsMessage:','./smsMessage.events','save','update','emit','removeListener','register'];(function(_0x2d6242,_0x5ce461){var _0x24e1ad=function(_0x577e98){while(--_0x577e98){_0x2d6242['push'](_0x2d6242['shift']());}};_0x24e1ad(++_0x5ce461);}(_0x9556,0xda));var _0x6955=function(_0x3c2c45,_0x46e89c){_0x3c2c45=_0x3c2c45-0x0;var _0x204c5f=_0x9556[_0x3c2c45];return _0x204c5f;};'use strict';var SmsMessageEvents=require(_0x6955('0x0'));var events=[_0x6955('0x1'),'remove',_0x6955('0x2')];function createListener(_0x5022a7,_0x1d8b22){return function(_0x533888){_0x1d8b22[_0x6955('0x3')](_0x5022a7,_0x533888);};}function removeListener(_0x29d56a,_0x3ad35f){return function(){SmsMessageEvents[_0x6955('0x4')](_0x29d56a,_0x3ad35f);};}exports[_0x6955('0x5')]=function(_0x213658){for(var _0x5ed2e6=0x0,_0x1b8f64=events[_0x6955('0x6')];_0x5ed2e6<_0x1b8f64;_0x5ed2e6++){var _0x506880=events[_0x5ed2e6];var _0x78ef47=createListener(_0x6955('0x7')+_0x506880,_0x213658);SmsMessageEvents['on'](_0x506880,_0x78ef47);}}; \ No newline at end of file +var _0x518f=['length','./smsMessage.events','save','remove','update','emit','register'];(function(_0x14f6af,_0x579b70){var _0x21f19f=function(_0x2df1c2){while(--_0x2df1c2){_0x14f6af['push'](_0x14f6af['shift']());}};_0x21f19f(++_0x579b70);}(_0x518f,0x119));var _0xf518=function(_0x328ac9,_0x2f7225){_0x328ac9=_0x328ac9-0x0;var _0x2b3a0a=_0x518f[_0x328ac9];return _0x2b3a0a;};'use strict';var SmsMessageEvents=require(_0xf518('0x0'));var events=[_0xf518('0x1'),_0xf518('0x2'),_0xf518('0x3')];function createListener(_0x574d4a,_0x534e43){return function(_0x20ead5){_0x534e43[_0xf518('0x4')](_0x574d4a,_0x20ead5);};}function removeListener(_0xe041a2,_0x3ad45b){return function(){SmsMessageEvents['removeListener'](_0xe041a2,_0x3ad45b);};}exports[_0xf518('0x5')]=function(_0x2e3dea){for(var _0x17d3b2=0x0,_0x2362b2=events[_0xf518('0x6')];_0x17d3b2<_0x2362b2;_0x17d3b2++){var _0x49eb74=events[_0x17d3b2];var _0x5e935d=createListener('smsMessage:'+_0x49eb74,_0x2e3dea);SmsMessageEvents['on'](_0x49eb74,_0x5e935d);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 743a03c..d33a283 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 _0xb296=['/:id/users','getAgents','create','addTeams','addAgents','put','/:id','update','destroy','removeTeams','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0xf6f2f9,_0x434af3){var _0x58c5e9=function(_0x35b7df){while(--_0x35b7df){_0xf6f2f9['push'](_0xf6f2f9['shift']());}};_0x58c5e9(++_0x434af3);}(_0xb296,0xa3));var _0x6b29=function(_0x801e77,_0x231180){_0x801e77=_0x801e77-0x0;var _0x4c2075=_0xb296[_0x801e77];return _0x4c2075;};'use strict';var multer=require(_0x6b29('0x0'));var util=require(_0x6b29('0x1'));var path=require(_0x6b29('0x2'));var timeout=require(_0x6b29('0x3'));var express=require(_0x6b29('0x4'));var router=express[_0x6b29('0x5')]();var auth=require(_0x6b29('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6b29('0x7'));var controller=require('./smsQueue.controller');router[_0x6b29('0x8')]('/',auth[_0x6b29('0x9')](),controller['index']);router[_0x6b29('0x8')](_0x6b29('0xa'),auth[_0x6b29('0x9')](),controller[_0x6b29('0xb')]);router[_0x6b29('0x8')]('/:id',auth[_0x6b29('0x9')](),controller[_0x6b29('0xc')]);router[_0x6b29('0x8')](_0x6b29('0xd'),auth[_0x6b29('0x9')](),controller[_0x6b29('0xe')]);router[_0x6b29('0x8')](_0x6b29('0xf'),auth['isAuthenticated'](),controller[_0x6b29('0x10')]);router[_0x6b29('0x8')](_0x6b29('0x11'),auth['isAuthenticated'](),controller[_0x6b29('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6b29('0x13')]);router['post']('/:id/teams',auth[_0x6b29('0x9')](),controller[_0x6b29('0x14')]);router['post'](_0x6b29('0x11'),auth[_0x6b29('0x9')](),controller[_0x6b29('0x15')]);router[_0x6b29('0x16')](_0x6b29('0x17'),auth[_0x6b29('0x9')](),controller[_0x6b29('0x18')]);router['delete'](_0x6b29('0x17'),auth[_0x6b29('0x9')](),controller[_0x6b29('0x19')]);router['delete']('/:id/teams',auth[_0x6b29('0x9')](),controller[_0x6b29('0x1a')]);router[_0x6b29('0x1b')](_0x6b29('0x11'),auth[_0x6b29('0x9')](),controller[_0x6b29('0x1c')]);module[_0x6b29('0x1d')]=router; \ No newline at end of file +var _0x7ebb=['destroy','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','/:id','update','delete'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7ebb,0x161));var _0xb7eb=function(_0x5d1566,_0x3fed4b){_0x5d1566=_0x5d1566-0x0;var _0x3441a2=_0x7ebb[_0x5d1566];return _0x3441a2;};'use strict';var multer=require(_0xb7eb('0x0'));var util=require(_0xb7eb('0x1'));var path=require(_0xb7eb('0x2'));var timeout=require(_0xb7eb('0x3'));var express=require(_0xb7eb('0x4'));var router=express[_0xb7eb('0x5')]();var auth=require(_0xb7eb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb7eb('0x7'));var controller=require(_0xb7eb('0x8'));router[_0xb7eb('0x9')]('/',auth[_0xb7eb('0xa')](),controller[_0xb7eb('0xb')]);router[_0xb7eb('0x9')](_0xb7eb('0xc'),auth[_0xb7eb('0xa')](),controller[_0xb7eb('0xd')]);router[_0xb7eb('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xb7eb('0xe')]);router[_0xb7eb('0x9')](_0xb7eb('0xf'),auth[_0xb7eb('0xa')](),controller['getMembers']);router[_0xb7eb('0x9')](_0xb7eb('0x10'),auth['isAuthenticated'](),controller[_0xb7eb('0x11')]);router[_0xb7eb('0x9')](_0xb7eb('0x12'),auth[_0xb7eb('0xa')](),controller[_0xb7eb('0x13')]);router[_0xb7eb('0x14')]('/',auth[_0xb7eb('0xa')](),controller['create']);router[_0xb7eb('0x14')](_0xb7eb('0x10'),auth[_0xb7eb('0xa')](),controller['addTeams']);router[_0xb7eb('0x14')](_0xb7eb('0x12'),auth[_0xb7eb('0xa')](),controller[_0xb7eb('0x15')]);router['put'](_0xb7eb('0x16'),auth['isAuthenticated'](),controller[_0xb7eb('0x17')]);router[_0xb7eb('0x18')](_0xb7eb('0x16'),auth['isAuthenticated'](),controller[_0xb7eb('0x19')]);router[_0xb7eb('0x18')](_0xb7eb('0x10'),auth[_0xb7eb('0xa')](),controller['removeTeams']);router[_0xb7eb('0x18')]('/:id/users',auth[_0xb7eb('0xa')](),controller[_0xb7eb('0x1a')]);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 4d50caf..246c033 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 _0x1cc4=['rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x1cc4,0x144));var _0x41cc=function(_0x4e55a9,_0x241b22){_0x4e55a9=_0x4e55a9-0x0;var _0x4a9b67=_0x1cc4[_0x4e55a9];return _0x4a9b67;};'use strict';var Sequelize=require(_0x41cc('0x0'));module[_0x41cc('0x1')]={'name':{'type':Sequelize[_0x41cc('0x2')],'unique':_0x41cc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x41cc('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x41cc('0x5'),'beepall',_0x41cc('0x6'))}}; \ No newline at end of file +var _0x6ffa=['sequelize','STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0xd5419,_0x199c4e){var _0x59ad9f=function(_0x216c75){while(--_0x216c75){_0xd5419['push'](_0xd5419['shift']());}};_0x59ad9f(++_0x199c4e);}(_0x6ffa,0x173));var _0xa6ff=function(_0x647f18,_0x3f82d3){_0x647f18=_0x647f18-0x0;var _0x36bf54=_0x6ffa[_0x647f18];return _0x36bf54;};'use strict';var Sequelize=require(_0xa6ff('0x0'));module['exports']={'name':{'type':Sequelize[_0xa6ff('0x1')],'unique':_0xa6ff('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa6ff('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa6ff('0x3')](_0xa6ff('0x4'),_0xa6ff('0x5'),_0xa6ff('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 1f3ae99..c02f6f6 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 _0xdbf5=['../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','limit','set','Content-Range','json','reject','save','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','catch','update','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','SIP','getTeams','Team','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','every','includes','all','union','compact','isEmpty','removeAgents','forEach','userSmsQueue:remove','addAgents','spread','userSmsQueue:save','isArray','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x52d9e9,_0x2a56a6){_0x52d9e9=_0x52d9e9-0x0;var _0x3d406f=_0xdbf5[_0x52d9e9];return _0x3d406f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5dbf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5dbf('0x1'));var rp=require(_0x5dbf('0x2'));var moment=require(_0x5dbf('0x3'));var BPromise=require(_0x5dbf('0x4'));var Mustache=require(_0x5dbf('0x5'));var util=require(_0x5dbf('0x6'));var path=require(_0x5dbf('0x7'));var sox=require(_0x5dbf('0x8'));var csv=require(_0x5dbf('0x9'));var ejs=require(_0x5dbf('0xa'));var fs=require('fs');var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];config[_0x5dbf('0x16')]=_[_0x5dbf('0x17')](config[_0x5dbf('0x16')],{'host':_0x5dbf('0x18'),'port':0x18eb});var socket=require(_0x5dbf('0x19'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x5dbf('0x1a')](socket);function respondWithStatusCode(_0x3480c8,_0x48e7fd){_0x48e7fd=_0x48e7fd||0xcc;return function(_0x19624e){if(_0x19624e){return _0x3480c8[_0x5dbf('0x1b')](_0x48e7fd);}return _0x3480c8[_0x5dbf('0x1c')](_0x48e7fd)[_0x5dbf('0x1d')]();};}function respondWithResult(_0x181816,_0x472eb9){_0x472eb9=_0x472eb9||0xc8;return function(_0x2d32cc){if(_0x2d32cc){return _0x181816['status'](_0x472eb9)['json'](_0x2d32cc);}};}function respondWithFilteredResult(_0x16dc82,_0xc4cb1c){return function(_0x39c7aa){if(_0x39c7aa){var _0x14abf7=_0x39c7aa['count'],_0x20c2b0=_0xc4cb1c['offset'],_0x5ce68e=_0xc4cb1c['offset']+_0xc4cb1c[_0x5dbf('0x1e')],_0x11cd00;if(_0x5ce68e>=_0x14abf7){_0x5ce68e=_0x14abf7;_0x11cd00=0xc8;}else{_0x11cd00=0xce;}_0x16dc82[_0x5dbf('0x1c')](_0x11cd00);return _0x16dc82[_0x5dbf('0x1f')](_0x5dbf('0x20'),_0x20c2b0+'-'+_0x5ce68e+'/'+_0x14abf7)[_0x5dbf('0x21')](_0x39c7aa);}return null;};}function patchUpdates(_0x5b2518){return function(_0x2764ea){try{jsonpatch['apply'](_0x2764ea,_0x5b2518,!![]);}catch(_0xb68f92){return BPromise[_0x5dbf('0x22')](_0xb68f92);}return _0x2764ea[_0x5dbf('0x23')]();};}function saveUpdates(_0x43a612,_0x3b763c){return function(_0x2f154e){if(_0x2f154e){return _0x2f154e['update'](_0x43a612)[_0x5dbf('0x24')](function(_0x3e3a2d){return _0x3e3a2d;});}return null;};}function removeEntity(_0x2d3e1b,_0x2079fc){return function(_0x2763ec){if(_0x2763ec){return _0x2763ec[_0x5dbf('0x25')]()[_0x5dbf('0x24')](function(){var _0x20ab1b=_0x2763ec[_0x5dbf('0x26')]({'plain':!![]});var _0x15a790=_0x5dbf('0x27');return db[_0x5dbf('0x28')][_0x5dbf('0x25')]({'where':{'type':_0x15a790,'resourceId':_0x20ab1b['id']}})[_0x5dbf('0x24')](function(){return _0x2763ec;});})[_0x5dbf('0x24')](function(){_0x2d3e1b[_0x5dbf('0x1c')](0xcc)[_0x5dbf('0x1d')]();});}};}function handleEntityNotFound(_0x3f8341,_0x159e61){return function(_0x22ec42){if(!_0x22ec42){_0x3f8341[_0x5dbf('0x1b')](0x194);}return _0x22ec42;};}function handleError(_0x471027,_0x21cd00){_0x21cd00=_0x21cd00||0x1f4;return function(_0x5768b7){logger[_0x5dbf('0x29')](_0x5768b7[_0x5dbf('0x2a')]);if(_0x5768b7[_0x5dbf('0x2b')]){delete _0x5768b7[_0x5dbf('0x2b')];}_0x471027[_0x5dbf('0x1c')](_0x21cd00)[_0x5dbf('0x2c')](_0x5768b7);};}exports[_0x5dbf('0x2d')]=function(_0x31d57a,_0x406ce6){var _0x273b63={},_0x294dd7={},_0x50a307={'count':0x0,'rows':[]};var _0x4c1587=_[_0x5dbf('0x2e')](db[_0x5dbf('0x2f')][_0x5dbf('0x30')],function(_0x3b73ad){return{'name':_0x3b73ad[_0x5dbf('0x31')],'type':_0x3b73ad['type']['key']};});_0x294dd7[_0x5dbf('0x32')]=_[_0x5dbf('0x2e')](_0x4c1587,'name');_0x294dd7[_0x5dbf('0x33')]=_[_0x5dbf('0x34')](_0x31d57a[_0x5dbf('0x33')]);_0x294dd7[_0x5dbf('0x35')]=_[_0x5dbf('0x36')](_0x294dd7['model'],_0x294dd7[_0x5dbf('0x33')]);_0x273b63[_0x5dbf('0x37')]=_[_0x5dbf('0x36')](_0x294dd7[_0x5dbf('0x32')],qs[_0x5dbf('0x38')](_0x31d57a['query'][_0x5dbf('0x38')]));_0x273b63[_0x5dbf('0x37')]=_0x273b63[_0x5dbf('0x37')][_0x5dbf('0x39')]?_0x273b63['attributes']:_0x294dd7[_0x5dbf('0x32')];if(!_0x31d57a[_0x5dbf('0x33')][_0x5dbf('0x3a')](_0x5dbf('0x3b'))){_0x273b63[_0x5dbf('0x1e')]=qs[_0x5dbf('0x1e')](_0x31d57a[_0x5dbf('0x33')][_0x5dbf('0x1e')]);_0x273b63[_0x5dbf('0x3c')]=qs[_0x5dbf('0x3c')](_0x31d57a[_0x5dbf('0x33')]['offset']);}_0x273b63[_0x5dbf('0x3d')]=qs[_0x5dbf('0x3e')](_0x31d57a[_0x5dbf('0x33')]['sort']);_0x273b63[_0x5dbf('0x3f')]=qs[_0x5dbf('0x35')](_[_0x5dbf('0x40')](_0x31d57a['query'],_0x294dd7[_0x5dbf('0x35')]),_0x4c1587);if(_0x31d57a[_0x5dbf('0x33')][_0x5dbf('0x41')]){_0x273b63['where']=_[_0x5dbf('0x42')](_0x273b63[_0x5dbf('0x3f')],{'$or':_[_0x5dbf('0x2e')](_0x4c1587,function(_0x260c9f){if(_0x260c9f[_0x5dbf('0x43')]!==_0x5dbf('0x44')){var _0x321ae3={};_0x321ae3[_0x260c9f[_0x5dbf('0x2b')]]={'$like':'%'+_0x31d57a['query']['filter']+'%'};return _0x321ae3;}})});}_0x273b63=_['merge']({},_0x273b63,_0x31d57a['options']);var _0x28b28f={'where':_0x273b63[_0x5dbf('0x3f')]};return db['SmsQueue'][_0x5dbf('0x45')](_0x28b28f)[_0x5dbf('0x24')](function(_0x5a60e8){_0x50a307[_0x5dbf('0x45')]=_0x5a60e8;if(_0x31d57a[_0x5dbf('0x33')][_0x5dbf('0x46')]){_0x273b63[_0x5dbf('0x47')]=[{'all':!![]}];}return db[_0x5dbf('0x2f')][_0x5dbf('0x48')](_0x273b63);})[_0x5dbf('0x24')](function(_0x1c020a){_0x50a307[_0x5dbf('0x49')]=_0x1c020a;return _0x50a307;})[_0x5dbf('0x24')](respondWithFilteredResult(_0x406ce6,_0x273b63))['catch'](handleError(_0x406ce6,null));};exports[_0x5dbf('0x4a')]=function(_0x22f958,_0xec1d28){var _0x50880d={'raw':!![],'where':{'id':_0x22f958[_0x5dbf('0x4b')]['id']}},_0x16b0ff={};_0x16b0ff[_0x5dbf('0x32')]=_[_0x5dbf('0x34')](db['SmsQueue'][_0x5dbf('0x30')]);_0x16b0ff['query']=_[_0x5dbf('0x34')](_0x22f958[_0x5dbf('0x33')]);_0x16b0ff[_0x5dbf('0x35')]=_[_0x5dbf('0x36')](_0x16b0ff['model'],_0x16b0ff['query']);_0x50880d[_0x5dbf('0x37')]=_[_0x5dbf('0x36')](_0x16b0ff[_0x5dbf('0x32')],qs['fields'](_0x22f958[_0x5dbf('0x33')]['fields']));_0x50880d['attributes']=_0x50880d['attributes']['length']?_0x50880d[_0x5dbf('0x37')]:_0x16b0ff[_0x5dbf('0x32')];if(_0x22f958['query'][_0x5dbf('0x46')]){_0x50880d[_0x5dbf('0x47')]=[{'all':!![]}];}_0x50880d=_['merge']({},_0x50880d,_0x22f958[_0x5dbf('0x4c')]);return db[_0x5dbf('0x2f')]['find'](_0x50880d)[_0x5dbf('0x24')](handleEntityNotFound(_0xec1d28,null))['then'](respondWithResult(_0xec1d28,null))['catch'](handleError(_0xec1d28,null));};exports[_0x5dbf('0x4d')]=function(_0x2a3d30,_0x17a1c0){return db['SmsQueue']['create'](_0x2a3d30[_0x5dbf('0x4e')],{})[_0x5dbf('0x24')](function(_0x21f477){var _0x307a00=_0x2a3d30[_0x5dbf('0x4f')][_0x5dbf('0x26')]({'plain':!![]});if(!_0x307a00)throw new Error(_0x5dbf('0x50'));if(_0x307a00[_0x5dbf('0x51')]==='user'){var _0x3f38a0=_0x21f477[_0x5dbf('0x26')]({'plain':!![]});var _0x2927a3=_0x5dbf('0x27');return db[_0x5dbf('0x52')][_0x5dbf('0x53')]({'where':{'name':_0x2927a3,'userProfileId':_0x307a00[_0x5dbf('0x54')]},'raw':!![]})['then'](function(_0x1b0b13){if(_0x1b0b13&&_0x1b0b13['autoAssociation']===0x0){return db[_0x5dbf('0x28')][_0x5dbf('0x4d')]({'name':_0x3f38a0[_0x5dbf('0x2b')],'resourceId':_0x3f38a0['id'],'type':_0x1b0b13[_0x5dbf('0x2b')],'sectionId':_0x1b0b13['id']},{})[_0x5dbf('0x24')](function(){return _0x21f477;});}else{return _0x21f477;}})[_0x5dbf('0x55')](function(_0x353d0f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x353d0f);throw _0x353d0f;});}return _0x21f477;})['then'](respondWithResult(_0x17a1c0,0xc9))[_0x5dbf('0x55')](handleError(_0x17a1c0,null));};exports[_0x5dbf('0x56')]=function(_0x36a787,_0x56c8b2){if(_0x36a787['body']['id']){delete _0x36a787[_0x5dbf('0x4e')]['id'];}return db[_0x5dbf('0x2f')][_0x5dbf('0x53')]({'where':{'id':_0x36a787['params']['id']}})[_0x5dbf('0x24')](handleEntityNotFound(_0x56c8b2,null))['then'](saveUpdates(_0x36a787[_0x5dbf('0x4e')],null))[_0x5dbf('0x24')](respondWithResult(_0x56c8b2,null))[_0x5dbf('0x55')](handleError(_0x56c8b2,null));};exports['destroy']=function(_0x55fd51,_0x1b316d){return db[_0x5dbf('0x2f')][_0x5dbf('0x53')]({'where':{'id':_0x55fd51[_0x5dbf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1b316d,null))[_0x5dbf('0x24')](removeEntity(_0x1b316d,null))[_0x5dbf('0x55')](handleError(_0x1b316d,null));};exports['describe']=function(_0x5485f3,_0x19ec03){return db[_0x5dbf('0x2f')][_0x5dbf('0x57')]()[_0x5dbf('0x24')](respondWithResult(_0x19ec03,null))[_0x5dbf('0x55')](handleError(_0x19ec03,null));};exports[_0x5dbf('0x58')]=function(_0x50a029,_0x4107f1,_0x542970){var _0x50d5e0={'raw':!![],'where':{}},_0x4f1b40={},_0x38f253;return db['SmsQueue'][_0x5dbf('0x59')]({'where':{'id':_0x50a029[_0x5dbf('0x4b')]['id']}})[_0x5dbf('0x24')](handleEntityNotFound(_0x4107f1,null))[_0x5dbf('0x24')](function(_0x461ffb){if(_0x461ffb){_0x38f253=_0x461ffb[_0x5dbf('0x26')]({'plain':!![]});_0x4f1b40[_0x5dbf('0x32')]=_[_0x5dbf('0x34')](db[_0x5dbf('0x5a')][_0x5dbf('0x30')]);_0x4f1b40[_0x5dbf('0x33')]=_[_0x5dbf('0x34')](_0x50a029[_0x5dbf('0x33')]);_0x4f1b40[_0x5dbf('0x35')]=_[_0x5dbf('0x36')](_0x4f1b40['model'],_0x4f1b40[_0x5dbf('0x33')]);_0x50d5e0['attributes']=_[_0x5dbf('0x36')](_0x4f1b40[_0x5dbf('0x32')],qs[_0x5dbf('0x38')](_0x50a029[_0x5dbf('0x33')]['fields']));_0x50d5e0[_0x5dbf('0x37')]=_0x50d5e0[_0x5dbf('0x37')][_0x5dbf('0x39')]?_0x50d5e0[_0x5dbf('0x37')]:_0x4f1b40[_0x5dbf('0x32')];if(!_0x50a029[_0x5dbf('0x33')]['hasOwnProperty'](_0x5dbf('0x3b'))){_0x50d5e0[_0x5dbf('0x1e')]=qs[_0x5dbf('0x1e')](_0x50a029[_0x5dbf('0x33')][_0x5dbf('0x1e')]);_0x50d5e0[_0x5dbf('0x3c')]=qs[_0x5dbf('0x3c')](_0x50a029[_0x5dbf('0x33')][_0x5dbf('0x3c')]);}_0x50d5e0[_0x5dbf('0x3d')]=qs[_0x5dbf('0x3e')](_0x50a029[_0x5dbf('0x33')]['sort']);_0x50d5e0['where']=qs[_0x5dbf('0x35')](_[_0x5dbf('0x40')](_0x50a029[_0x5dbf('0x33')],_0x4f1b40[_0x5dbf('0x35')]));_0x50d5e0[_0x5dbf('0x3f')][_0x5dbf('0x5b')]=_0x461ffb['id'];if(_0x50a029[_0x5dbf('0x33')][_0x5dbf('0x41')]){_0x50d5e0[_0x5dbf('0x3f')]=_['merge'](_0x50d5e0['where'],{'$or':_['map'](_0x50d5e0['attributes'],function(_0x408b51){var _0x398326={};_0x398326[_0x408b51]={'$like':'%'+_0x50a029[_0x5dbf('0x33')][_0x5dbf('0x41')]+'%'};return _0x398326;})});}_0x50d5e0=_[_0x5dbf('0x42')]({},_0x50d5e0,_0x50a029[_0x5dbf('0x4c')]);return db['UserSmsQueue']['findAll'](_0x50d5e0);}})[_0x5dbf('0x24')](function(_0x3d3b38){if(_0x3d3b38){return db['User'][_0x5dbf('0x5c')]({'where':{'id':_[_0x5dbf('0x2e')](_0x3d3b38,_0x5dbf('0x5d')),'role':_0x5dbf('0x5e')},'attributes':['id','name',_0x5dbf('0x5f'),_0x5dbf('0x60'),_0x5dbf('0x61')]});}})[_0x5dbf('0x24')](function(_0x2aed16){if(_0x2aed16){return{'count':_0x2aed16['count'],'rows':_[_0x5dbf('0x2e')](_0x2aed16[_0x5dbf('0x49')],function(_0x1ee65e){return{'membername':_0x1ee65e[_0x5dbf('0x2b')],'UserId':_0x1ee65e['id'],'queue_name':_0x38f253['name'],'SmsQueueId':_0x38f253['id'],'interface':util[_0x5dbf('0x62')]('%s/%s',_0x5dbf('0x63'),_0x1ee65e[_0x5dbf('0x2b')]),'penalty':0x0,'paused':_0x1ee65e[_0x5dbf('0x5f')],'createdAt':_0x1ee65e['createdAt'],'updatedAt':_0x1ee65e[_0x5dbf('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5dbf('0x24')](respondWithFilteredResult(_0x4107f1,_0x50d5e0))[_0x5dbf('0x55')](handleError(_0x4107f1,null));};exports[_0x5dbf('0x64')]=function(_0x50db0b,_0x1f9d2d,_0x66d864){var _0x2f1b01={};var _0x1f56a9={};var _0x392a9b;var _0xf84095;return db['SmsQueue'][_0x5dbf('0x59')]({'where':{'id':_0x50db0b[_0x5dbf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1f9d2d,null))[_0x5dbf('0x24')](function(_0x2754bb){if(_0x2754bb){_0x392a9b=_0x2754bb;_0x1f56a9[_0x5dbf('0x32')]=_[_0x5dbf('0x34')](db[_0x5dbf('0x65')][_0x5dbf('0x30')]);_0x1f56a9[_0x5dbf('0x33')]=_[_0x5dbf('0x34')](_0x50db0b[_0x5dbf('0x33')]);_0x1f56a9[_0x5dbf('0x35')]=_[_0x5dbf('0x36')](_0x1f56a9[_0x5dbf('0x32')],_0x1f56a9[_0x5dbf('0x33')]);_0x2f1b01[_0x5dbf('0x37')]=_[_0x5dbf('0x36')](_0x1f56a9[_0x5dbf('0x32')],qs['fields'](_0x50db0b[_0x5dbf('0x33')][_0x5dbf('0x38')]));_0x2f1b01[_0x5dbf('0x37')]=_0x2f1b01[_0x5dbf('0x37')]['length']?_0x2f1b01[_0x5dbf('0x37')]:_0x1f56a9[_0x5dbf('0x32')];_0x2f1b01[_0x5dbf('0x3d')]=qs[_0x5dbf('0x3e')](_0x50db0b[_0x5dbf('0x33')]['sort']);_0x2f1b01[_0x5dbf('0x3f')]=qs[_0x5dbf('0x35')](_['pick'](_0x50db0b['query'],_0x1f56a9[_0x5dbf('0x35')]));if(_0x50db0b[_0x5dbf('0x33')][_0x5dbf('0x41')]){_0x2f1b01[_0x5dbf('0x3f')]=_[_0x5dbf('0x42')](_0x2f1b01[_0x5dbf('0x3f')],{'$or':_[_0x5dbf('0x2e')](_0x2f1b01['attributes'],function(_0x310078){var _0x3b01c0={};_0x3b01c0[_0x310078]={'$like':'%'+_0x50db0b[_0x5dbf('0x33')][_0x5dbf('0x41')]+'%'};return _0x3b01c0;})});}_0x2f1b01=_[_0x5dbf('0x42')]({},_0x2f1b01,_0x50db0b[_0x5dbf('0x4c')]);return _0x392a9b['getTeams'](_0x2f1b01);}})[_0x5dbf('0x24')](function(_0x2a0c11){if(_0x2a0c11){_0xf84095=_0x2a0c11[_0x5dbf('0x39')];if(!_0x50db0b[_0x5dbf('0x33')][_0x5dbf('0x3a')]('nolimit')){_0x2f1b01[_0x5dbf('0x1e')]=qs['limit'](_0x50db0b['query']['limit']);_0x2f1b01['offset']=qs[_0x5dbf('0x3c')](_0x50db0b[_0x5dbf('0x33')][_0x5dbf('0x3c')]);}return _0x392a9b[_0x5dbf('0x64')](_0x2f1b01);}})[_0x5dbf('0x24')](function(_0x4cb92d){if(_0x4cb92d){return _0x4cb92d?{'count':_0xf84095,'rows':_0x4cb92d}:null;}})['then'](respondWithResult(_0x1f9d2d,null))[_0x5dbf('0x55')](handleError(_0x1f9d2d,null));};exports['addTeams']=function(_0x25315f,_0x6e4f3c,_0x541241){var _0x3c7eaa=_0x25315f['body'][_0x5dbf('0x66')];return db[_0x5dbf('0x65')][_0x5dbf('0x48')]({'where':{'id':_0x3c7eaa},'attributes':['id'],'include':[{'model':db[_0x5dbf('0x67')],'as':_0x5dbf('0x68'),'attributes':['id','name',_0x5dbf('0x69'),_0x5dbf('0x6a'),_0x5dbf('0x6b')],'raw':!![]}]})[_0x5dbf('0x24')](function(_0x56cf57){if(_0x56cf57){var _0x21df52=_[_0x5dbf('0x6c')](_0x56cf57,function(_0x2244aa){var _0x285d54=_0x2244aa[_0x5dbf('0x26')]({'plain':!![]});return _0x285d54[_0x5dbf('0x68')];});return db[_0x5dbf('0x2f')][_0x5dbf('0x53')]({'where':{'id':_0x25315f['params']['id']}})['then'](function(_0x5bf068){return db[_0x5dbf('0x6d')][_0x5dbf('0x6e')](function(_0x5cffa9){return _0x5bf068['addTeams'](_0x3c7eaa,{'transaction':_0x5cffa9})['then'](function(){return BPromise[_0x5dbf('0x6f')](_0x21df52,function(_0x20bda9){return db[_0x5dbf('0x5a')][_0x5dbf('0x70')]({'where':{'UserId':_0x20bda9['id'],'SmsQueueId':_0x25315f[_0x5dbf('0x4b')]['id']},'transaction':_0x5cffa9});});})[_0x5dbf('0x24')](function(){_0x21df52['forEach'](function(_0x31fd8d){socket[_0x5dbf('0x71')]('userSmsQueue:save',{'UserId':_0x31fd8d['id'],'SmsQueueId':_0x5bf068['id']});});});});});}})['then'](respondWithStatusCode(_0x6e4f3c,null))[_0x5dbf('0x55')](handleError(_0x6e4f3c,null));};exports['removeTeams']=function(_0x492cc8,_0x3a27c4,_0x3620d2){return db[_0x5dbf('0x65')]['findAll']({'where':{'id':_0x492cc8[_0x5dbf('0x33')][_0x5dbf('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5dbf('0x68'),'attributes':['id'],'raw':!![]}]})[_0x5dbf('0x24')](handleEntityNotFound(_0x3a27c4,null))[_0x5dbf('0x24')](function(_0x3b3fa0){var _0x7957cb=_[_0x5dbf('0x2e')](_0x3b3fa0,'id');var _0x125ed6=[];var _0x399f88=[];var _0x551b29=squel['select']();_0x551b29['field'](_0x5dbf('0x72'))[_0x5dbf('0x73')](_0x5dbf('0x74'),'tq')[_0x5dbf('0x75')](_0x5dbf('0x76'),'ut',_0x5dbf('0x77'))[_0x5dbf('0x3f')](_0x5dbf('0x78'),_0x492cc8[_0x5dbf('0x4b')]['id']);for(var _0x990814=0x0;_0x990814<_0x3b3fa0['length'];_0x990814+=0x1){let _0x2ded2b=_0x3b3fa0[_0x990814];for(var _0x1e815c=0x0;_0x1e815c<_0x2ded2b[_0x5dbf('0x68')][_0x5dbf('0x39')];_0x1e815c+=0x1){let _0x7b77cb=_0x2ded2b[_0x5dbf('0x68')][_0x1e815c];var _0x2e6b5d=_0x551b29[_0x5dbf('0x79')]();_0x2e6b5d['where']('ut.UserId\x20=\x20?',_0x7b77cb['id']);_0x399f88[_0x5dbf('0x7a')](db['sequelize']['query'](_0x2e6b5d[_0x5dbf('0x7b')](),{'type':db['sequelize']['QueryTypes']['SELECT']})['then'](function(_0x1d375f){if(_0x1d375f['length']===0x1){return _0x7b77cb['id'];}else{var _0x4d9ada=_[_0x5dbf('0x7c')](_[_0x5dbf('0x2e')](_0x1d375f,'TeamId'),function(_0x43959d){return _[_0x5dbf('0x7d')](_0x7957cb,_0x43959d);});if(_0x4d9ada){return _0x7b77cb['id'];}}}));}}return BPromise[_0x5dbf('0x7e')](_0x399f88)['then'](function(_0x140255){_0x125ed6=_(_0x125ed6)[_0x5dbf('0x7f')](_0x140255)[_0x5dbf('0x80')]()['value']();return db[_0x5dbf('0x2f')][_0x5dbf('0x53')]({'where':{'id':_0x492cc8[_0x5dbf('0x4b')]['id']}})['then'](function(_0x451ceb){return db[_0x5dbf('0x6d')][_0x5dbf('0x6e')](function(_0x594af1){return _0x451ceb['removeTeams'](_0x492cc8['query'][_0x5dbf('0x66')],{'transaction':_0x594af1})[_0x5dbf('0x24')](function(){if(!_[_0x5dbf('0x81')](_0x125ed6)){return _0x451ceb[_0x5dbf('0x82')](_0x125ed6,{'transaction':_0x594af1});}})[_0x5dbf('0x24')](function(){_0x125ed6[_0x5dbf('0x83')](function(_0x4df7b5){socket[_0x5dbf('0x71')](_0x5dbf('0x84'),{'UserId':_0x4df7b5,'SmsQueueId':_0x451ceb['id']});});});});});});})[_0x5dbf('0x24')](respondWithStatusCode(_0x3a27c4,null))['catch'](handleError(_0x3a27c4,null));};exports[_0x5dbf('0x85')]=function(_0x5f8b72,_0x330830,_0x3ed5c3){return db[_0x5dbf('0x2f')][_0x5dbf('0x53')]({'where':{'id':_0x5f8b72[_0x5dbf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x330830,null))[_0x5dbf('0x24')](function(_0x527807){if(_0x527807){return _0x527807[_0x5dbf('0x85')](_0x5f8b72[_0x5dbf('0x4e')][_0x5dbf('0x66')],_['omit'](_0x5f8b72['body'],['ids','id'])||{})[_0x5dbf('0x86')](function(_0x4649a4){for(var _0x502a42=0x0;_0x502a42<_0x5f8b72[_0x5dbf('0x4e')]['ids'][_0x5dbf('0x39')];_0x502a42+=0x1){socket[_0x5dbf('0x71')](_0x5dbf('0x87'),{'UserId':_0x5f8b72['body'][_0x5dbf('0x66')][_0x502a42],'SmsQueueId':_0x5f8b72[_0x5dbf('0x4b')]['id']});}return _0x4649a4;});}})[_0x5dbf('0x24')](respondWithResult(_0x330830,null))[_0x5dbf('0x55')](handleError(_0x330830,null));};exports[_0x5dbf('0x82')]=function(_0x2bbac1,_0x440939,_0x52117f){return db[_0x5dbf('0x2f')]['find']({'where':{'id':_0x2bbac1[_0x5dbf('0x4b')]['id']}})[_0x5dbf('0x24')](handleEntityNotFound(_0x440939,null))[_0x5dbf('0x24')](function(_0x581634){if(_0x581634){return _0x581634[_0x5dbf('0x82')](_0x2bbac1[_0x5dbf('0x33')][_0x5dbf('0x66')])[_0x5dbf('0x24')](function(){if(_[_0x5dbf('0x88')](_0x2bbac1[_0x5dbf('0x33')]['ids'])){for(var _0x226cbe=0x0;_0x226cbe<_0x2bbac1['query'][_0x5dbf('0x66')][_0x5dbf('0x39')];_0x226cbe+=0x1){socket[_0x5dbf('0x71')](_0x5dbf('0x84'),{'UserId':Number(_0x2bbac1[_0x5dbf('0x33')][_0x5dbf('0x66')][_0x226cbe]),'SmsQueueId':Number(_0x2bbac1['params']['id'])});}}else{socket[_0x5dbf('0x71')](_0x5dbf('0x84'),{'UserId':Number(_0x2bbac1[_0x5dbf('0x33')]['ids']),'SmsQueueId':Number(_0x2bbac1[_0x5dbf('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x440939,null))['catch'](handleError(_0x440939,null));};exports[_0x5dbf('0x89')]=function(_0x1d0cdd,_0x33bb36,_0x2c56d0){var _0x2531f1={};var _0x56738a={};var _0x52d3c2;var _0x4f38a0;return db[_0x5dbf('0x2f')][_0x5dbf('0x59')]({'where':{'id':_0x1d0cdd[_0x5dbf('0x4b')]['id']}})[_0x5dbf('0x24')](handleEntityNotFound(_0x33bb36,null))[_0x5dbf('0x24')](function(_0x1ea6ed){if(_0x1ea6ed){_0x52d3c2=_0x1ea6ed;_0x56738a[_0x5dbf('0x32')]=_[_0x5dbf('0x34')](db['User'][_0x5dbf('0x30')]);_0x56738a[_0x5dbf('0x33')]=_[_0x5dbf('0x34')](_0x1d0cdd[_0x5dbf('0x33')]);_0x56738a[_0x5dbf('0x35')]=_[_0x5dbf('0x36')](_0x56738a[_0x5dbf('0x32')],_0x56738a[_0x5dbf('0x33')]);_0x2531f1[_0x5dbf('0x37')]=_[_0x5dbf('0x36')](_0x56738a['model'],qs['fields'](_0x1d0cdd['query'][_0x5dbf('0x38')]));_0x2531f1['attributes']=_0x2531f1[_0x5dbf('0x37')]['length']?_0x2531f1[_0x5dbf('0x37')]:_0x56738a[_0x5dbf('0x32')];_0x2531f1[_0x5dbf('0x3d')]=qs[_0x5dbf('0x3e')](_0x1d0cdd[_0x5dbf('0x33')]['sort']);_0x2531f1[_0x5dbf('0x3f')]=qs[_0x5dbf('0x35')](_[_0x5dbf('0x40')](_0x1d0cdd[_0x5dbf('0x33')],_0x56738a[_0x5dbf('0x35')]));if(_0x1d0cdd['query'][_0x5dbf('0x41')]){_0x2531f1[_0x5dbf('0x3f')]=_[_0x5dbf('0x42')](_0x2531f1[_0x5dbf('0x3f')],{'$or':_['map'](_0x2531f1[_0x5dbf('0x37')],function(_0x1efaea){var _0x3acaf8={};_0x3acaf8[_0x1efaea]={'$like':'%'+_0x1d0cdd[_0x5dbf('0x33')][_0x5dbf('0x41')]+'%'};return _0x3acaf8;})});}_0x2531f1=_[_0x5dbf('0x42')]({},_0x2531f1,_0x1d0cdd[_0x5dbf('0x4c')]);return _0x52d3c2['getAgents'](_0x2531f1);}})['then'](function(_0x51864c){if(_0x51864c){_0x4f38a0=_0x51864c[_0x5dbf('0x39')];if(!_0x1d0cdd[_0x5dbf('0x33')]['hasOwnProperty'](_0x5dbf('0x3b'))){_0x2531f1['limit']=qs[_0x5dbf('0x1e')](_0x1d0cdd['query'][_0x5dbf('0x1e')]);_0x2531f1[_0x5dbf('0x3c')]=qs[_0x5dbf('0x3c')](_0x1d0cdd[_0x5dbf('0x33')][_0x5dbf('0x3c')]);}return _0x52d3c2[_0x5dbf('0x89')](_0x2531f1);}})[_0x5dbf('0x24')](function(_0x4a1c85){if(_0x4a1c85){return _0x4a1c85?{'count':_0x4f38a0,'rows':_0x4a1c85}:null;}})[_0x5dbf('0x24')](respondWithResult(_0x33bb36,null))[_0x5dbf('0x55')](handleError(_0x33bb36,null));}; \ No newline at end of file +var _0x038b=['crypto','to-csv','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','./smsQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','SmsQueues','error','name','send','index','map','SmsQueue','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','params','rawAttributes','include','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','User','findAndCountAll','updatedAt','format','%s/%s','SIP','smsPause','createdAt','getTeams','Team','addTeams','ids','online','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','isEmpty','emit','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel'];(function(_0x50b13e,_0x5415bb){var _0x1ac476=function(_0xbab6d){while(--_0xbab6d){_0x50b13e['push'](_0x50b13e['shift']());}};_0x1ac476(++_0x5415bb);}(_0x038b,0x114));var _0xb038=function(_0x550b5b,_0x22f75b){_0x550b5b=_0x550b5b-0x0;var _0x4e84e4=_0x038b[_0x550b5b];return _0x4e84e4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb038('0x0'));var rimraf=require(_0xb038('0x1'));var zipdir=require(_0xb038('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb038('0x3'));var moment=require('moment');var BPromise=require(_0xb038('0x4'));var Mustache=require(_0xb038('0x5'));var util=require('util');var path=require(_0xb038('0x6'));var sox=require(_0xb038('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb038('0x8'));var squel=require(_0xb038('0x9'));var crypto=require(_0xb038('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb038('0xb'));var querystring=require(_0xb038('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb038('0xd'));var qs=require(_0xb038('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb038('0xf'));var logger=require(_0xb038('0x10'))(_0xb038('0x11'));var utils=require(_0xb038('0x12'));var config=require(_0xb038('0x13'));var licenseUtil=require(_0xb038('0x14'));var db=require(_0xb038('0x15'))['db'];config[_0xb038('0x16')]=_[_0xb038('0x17')](config[_0xb038('0x16')],{'host':_0xb038('0x18'),'port':0x18eb});var socket=require(_0xb038('0x19'))(new Redis(config[_0xb038('0x16')]));require(_0xb038('0x1a'))[_0xb038('0x1b')](socket);function respondWithStatusCode(_0x13acc7,_0x13f893){_0x13f893=_0x13f893||0xcc;return function(_0x535109){if(_0x535109){return _0x13acc7[_0xb038('0x1c')](_0x13f893);}return _0x13acc7[_0xb038('0x1d')](_0x13f893)[_0xb038('0x1e')]();};}function respondWithResult(_0x39323e,_0xdef213){_0xdef213=_0xdef213||0xc8;return function(_0x2b4173){if(_0x2b4173){return _0x39323e['status'](_0xdef213)[_0xb038('0x1f')](_0x2b4173);}};}function respondWithFilteredResult(_0x3039b0,_0xd1fae0){return function(_0x3b095a){if(_0x3b095a){var _0x4aa892=_0x3b095a[_0xb038('0x20')],_0x49b237=_0xd1fae0[_0xb038('0x21')],_0x20cea2=_0xd1fae0['offset']+_0xd1fae0[_0xb038('0x22')],_0x3f48e6;if(_0x20cea2>=_0x4aa892){_0x20cea2=_0x4aa892;_0x3f48e6=0xc8;}else{_0x3f48e6=0xce;}_0x3039b0[_0xb038('0x1d')](_0x3f48e6);return _0x3039b0[_0xb038('0x23')](_0xb038('0x24'),_0x49b237+'-'+_0x20cea2+'/'+_0x4aa892)[_0xb038('0x1f')](_0x3b095a);}return null;};}function patchUpdates(_0x55be53){return function(_0x2e0369){try{jsonpatch[_0xb038('0x25')](_0x2e0369,_0x55be53,!![]);}catch(_0x2481e2){return BPromise[_0xb038('0x26')](_0x2481e2);}return _0x2e0369['save']();};}function saveUpdates(_0x2812c9,_0x1b7505){return function(_0x4bbf38){if(_0x4bbf38){return _0x4bbf38[_0xb038('0x27')](_0x2812c9)[_0xb038('0x28')](function(_0x573f93){return _0x573f93;});}return null;};}function removeEntity(_0x241329,_0x5337e3){return function(_0x25ff46){if(_0x25ff46){return _0x25ff46[_0xb038('0x29')]()[_0xb038('0x28')](function(){var _0x1df7c4=_0x25ff46[_0xb038('0x2a')]({'plain':!![]});var _0xe4ceda=_0xb038('0x2b');return db['UserProfileResource'][_0xb038('0x29')]({'where':{'type':_0xe4ceda,'resourceId':_0x1df7c4['id']}})[_0xb038('0x28')](function(){return _0x25ff46;});})[_0xb038('0x28')](function(){_0x241329['status'](0xcc)[_0xb038('0x1e')]();});}};}function handleEntityNotFound(_0x3af191,_0x1fa72d){return function(_0x47ff40){if(!_0x47ff40){_0x3af191[_0xb038('0x1c')](0x194);}return _0x47ff40;};}function handleError(_0x2855a6,_0x28a6a9){_0x28a6a9=_0x28a6a9||0x1f4;return function(_0x12b3b6){logger[_0xb038('0x2c')](_0x12b3b6['stack']);if(_0x12b3b6[_0xb038('0x2d')]){delete _0x12b3b6[_0xb038('0x2d')];}_0x2855a6[_0xb038('0x1d')](_0x28a6a9)[_0xb038('0x2e')](_0x12b3b6);};}exports[_0xb038('0x2f')]=function(_0xbc8958,_0x29a0d7){var _0x3695aa={},_0xe4eb72={},_0x22fb2c={'count':0x0,'rows':[]};var _0x1599c9=_[_0xb038('0x30')](db[_0xb038('0x31')]['rawAttributes'],function(_0x1d807a){return{'name':_0x1d807a['fieldName'],'type':_0x1d807a[_0xb038('0x32')][_0xb038('0x33')]};});_0xe4eb72[_0xb038('0x34')]=_[_0xb038('0x30')](_0x1599c9,_0xb038('0x2d'));_0xe4eb72[_0xb038('0x35')]=_[_0xb038('0x36')](_0xbc8958[_0xb038('0x35')]);_0xe4eb72[_0xb038('0x37')]=_[_0xb038('0x38')](_0xe4eb72['model'],_0xe4eb72[_0xb038('0x35')]);_0x3695aa[_0xb038('0x39')]=_[_0xb038('0x38')](_0xe4eb72['model'],qs['fields'](_0xbc8958['query'][_0xb038('0x3a')]));_0x3695aa[_0xb038('0x39')]=_0x3695aa[_0xb038('0x39')][_0xb038('0x3b')]?_0x3695aa[_0xb038('0x39')]:_0xe4eb72[_0xb038('0x34')];if(!_0xbc8958['query'][_0xb038('0x3c')](_0xb038('0x3d'))){_0x3695aa[_0xb038('0x22')]=qs[_0xb038('0x22')](_0xbc8958['query'][_0xb038('0x22')]);_0x3695aa[_0xb038('0x21')]=qs['offset'](_0xbc8958['query'][_0xb038('0x21')]);}_0x3695aa[_0xb038('0x3e')]=qs[_0xb038('0x3f')](_0xbc8958[_0xb038('0x35')][_0xb038('0x3f')]);_0x3695aa['where']=qs[_0xb038('0x37')](_[_0xb038('0x40')](_0xbc8958[_0xb038('0x35')],_0xe4eb72[_0xb038('0x37')]),_0x1599c9);if(_0xbc8958['query'][_0xb038('0x41')]){_0x3695aa[_0xb038('0x42')]=_[_0xb038('0x43')](_0x3695aa['where'],{'$or':_[_0xb038('0x30')](_0x1599c9,function(_0x594c0d){if(_0x594c0d[_0xb038('0x32')]!==_0xb038('0x44')){var _0x3ac1db={};_0x3ac1db[_0x594c0d['name']]={'$like':'%'+_0xbc8958[_0xb038('0x35')][_0xb038('0x41')]+'%'};return _0x3ac1db;}})});}_0x3695aa=_[_0xb038('0x43')]({},_0x3695aa,_0xbc8958['options']);var _0x1a164e={'where':_0x3695aa[_0xb038('0x42')]};return db[_0xb038('0x31')][_0xb038('0x20')](_0x1a164e)['then'](function(_0x28b922){_0x22fb2c[_0xb038('0x20')]=_0x28b922;if(_0xbc8958[_0xb038('0x35')][_0xb038('0x45')]){_0x3695aa['include']=[{'all':!![]}];}return db[_0xb038('0x31')][_0xb038('0x46')](_0x3695aa);})['then'](function(_0x207fb5){_0x22fb2c[_0xb038('0x47')]=_0x207fb5;return _0x22fb2c;})[_0xb038('0x28')](respondWithFilteredResult(_0x29a0d7,_0x3695aa))['catch'](handleError(_0x29a0d7,null));};exports[_0xb038('0x48')]=function(_0x317e51,_0x5495c7){var _0x527eaa={'raw':!![],'where':{'id':_0x317e51[_0xb038('0x49')]['id']}},_0x28f1c8={};_0x28f1c8[_0xb038('0x34')]=_[_0xb038('0x36')](db[_0xb038('0x31')][_0xb038('0x4a')]);_0x28f1c8[_0xb038('0x35')]=_[_0xb038('0x36')](_0x317e51['query']);_0x28f1c8['filters']=_['intersection'](_0x28f1c8[_0xb038('0x34')],_0x28f1c8[_0xb038('0x35')]);_0x527eaa['attributes']=_[_0xb038('0x38')](_0x28f1c8[_0xb038('0x34')],qs[_0xb038('0x3a')](_0x317e51['query'][_0xb038('0x3a')]));_0x527eaa['attributes']=_0x527eaa['attributes'][_0xb038('0x3b')]?_0x527eaa[_0xb038('0x39')]:_0x28f1c8[_0xb038('0x34')];if(_0x317e51[_0xb038('0x35')][_0xb038('0x45')]){_0x527eaa[_0xb038('0x4b')]=[{'all':!![]}];}_0x527eaa=_[_0xb038('0x43')]({},_0x527eaa,_0x317e51[_0xb038('0x4c')]);return db[_0xb038('0x31')][_0xb038('0x4d')](_0x527eaa)['then'](handleEntityNotFound(_0x5495c7,null))[_0xb038('0x28')](respondWithResult(_0x5495c7,null))[_0xb038('0x4e')](handleError(_0x5495c7,null));};exports['create']=function(_0x906c9c,_0x19ab72){return db['SmsQueue'][_0xb038('0x4f')](_0x906c9c[_0xb038('0x50')],{})[_0xb038('0x28')](function(_0x32bd6b){var _0x369088=_0x906c9c[_0xb038('0x51')][_0xb038('0x2a')]({'plain':!![]});if(!_0x369088)throw new Error(_0xb038('0x52'));if(_0x369088[_0xb038('0x53')]==='user'){var _0x62daba=_0x32bd6b[_0xb038('0x2a')]({'plain':!![]});var _0x3fda13=_0xb038('0x2b');return db[_0xb038('0x54')][_0xb038('0x4d')]({'where':{'name':_0x3fda13,'userProfileId':_0x369088['userProfileId']},'raw':!![]})[_0xb038('0x28')](function(_0x2f3622){if(_0x2f3622&&_0x2f3622[_0xb038('0x55')]===0x0){return db[_0xb038('0x56')][_0xb038('0x4f')]({'name':_0x62daba[_0xb038('0x2d')],'resourceId':_0x62daba['id'],'type':_0x2f3622[_0xb038('0x2d')],'sectionId':_0x2f3622['id']},{})['then'](function(){return _0x32bd6b;});}else{return _0x32bd6b;}})[_0xb038('0x4e')](function(_0x5c4a79){logger[_0xb038('0x2c')](_0xb038('0x57'),_0x5c4a79);throw _0x5c4a79;});}return _0x32bd6b;})[_0xb038('0x28')](respondWithResult(_0x19ab72,0xc9))[_0xb038('0x4e')](handleError(_0x19ab72,null));};exports[_0xb038('0x27')]=function(_0x5ea7df,_0x5b10cb){if(_0x5ea7df['body']['id']){delete _0x5ea7df[_0xb038('0x50')]['id'];}return db[_0xb038('0x31')][_0xb038('0x4d')]({'where':{'id':_0x5ea7df[_0xb038('0x49')]['id']}})[_0xb038('0x28')](handleEntityNotFound(_0x5b10cb,null))[_0xb038('0x28')](saveUpdates(_0x5ea7df['body'],null))[_0xb038('0x28')](respondWithResult(_0x5b10cb,null))[_0xb038('0x4e')](handleError(_0x5b10cb,null));};exports['destroy']=function(_0x5b27d3,_0xf2907b){return db['SmsQueue'][_0xb038('0x4d')]({'where':{'id':_0x5b27d3['params']['id']}})[_0xb038('0x28')](handleEntityNotFound(_0xf2907b,null))[_0xb038('0x28')](removeEntity(_0xf2907b,null))[_0xb038('0x4e')](handleError(_0xf2907b,null));};exports[_0xb038('0x58')]=function(_0x4ee38b,_0x32aea0){return db[_0xb038('0x31')][_0xb038('0x58')]()[_0xb038('0x28')](respondWithResult(_0x32aea0,null))[_0xb038('0x4e')](handleError(_0x32aea0,null));};exports[_0xb038('0x59')]=function(_0x14a553,_0x401f4c,_0x41623a){var _0x1f524e={'raw':!![],'where':{}},_0x1c9d66={},_0x12aba5;return db['SmsQueue'][_0xb038('0x5a')]({'where':{'id':_0x14a553[_0xb038('0x49')]['id']}})[_0xb038('0x28')](handleEntityNotFound(_0x401f4c,null))[_0xb038('0x28')](function(_0x38417c){if(_0x38417c){_0x12aba5=_0x38417c['get']({'plain':!![]});_0x1c9d66[_0xb038('0x34')]=_['keys'](db[_0xb038('0x5b')][_0xb038('0x4a')]);_0x1c9d66['query']=_[_0xb038('0x36')](_0x14a553[_0xb038('0x35')]);_0x1c9d66[_0xb038('0x37')]=_[_0xb038('0x38')](_0x1c9d66[_0xb038('0x34')],_0x1c9d66[_0xb038('0x35')]);_0x1f524e[_0xb038('0x39')]=_[_0xb038('0x38')](_0x1c9d66[_0xb038('0x34')],qs[_0xb038('0x3a')](_0x14a553['query'][_0xb038('0x3a')]));_0x1f524e['attributes']=_0x1f524e[_0xb038('0x39')][_0xb038('0x3b')]?_0x1f524e[_0xb038('0x39')]:_0x1c9d66[_0xb038('0x34')];if(!_0x14a553[_0xb038('0x35')][_0xb038('0x3c')](_0xb038('0x3d'))){_0x1f524e['limit']=qs['limit'](_0x14a553[_0xb038('0x35')][_0xb038('0x22')]);_0x1f524e[_0xb038('0x21')]=qs['offset'](_0x14a553['query'][_0xb038('0x21')]);}_0x1f524e['order']=qs[_0xb038('0x3f')](_0x14a553['query'][_0xb038('0x3f')]);_0x1f524e['where']=qs[_0xb038('0x37')](_[_0xb038('0x40')](_0x14a553[_0xb038('0x35')],_0x1c9d66[_0xb038('0x37')]));_0x1f524e[_0xb038('0x42')][_0xb038('0x5c')]=_0x38417c['id'];if(_0x14a553['query']['filter']){_0x1f524e[_0xb038('0x42')]=_['merge'](_0x1f524e[_0xb038('0x42')],{'$or':_[_0xb038('0x30')](_0x1f524e[_0xb038('0x39')],function(_0x538690){var _0x3071c8={};_0x3071c8[_0x538690]={'$like':'%'+_0x14a553['query'][_0xb038('0x41')]+'%'};return _0x3071c8;})});}_0x1f524e=_[_0xb038('0x43')]({},_0x1f524e,_0x14a553[_0xb038('0x4c')]);return db[_0xb038('0x5b')][_0xb038('0x46')](_0x1f524e);}})[_0xb038('0x28')](function(_0x3e2b92){if(_0x3e2b92){return db[_0xb038('0x5d')][_0xb038('0x5e')]({'where':{'id':_['map'](_0x3e2b92,'UserId'),'role':'agent'},'attributes':['id',_0xb038('0x2d'),'smsPause',_0xb038('0x5f'),'createdAt']});}})[_0xb038('0x28')](function(_0x240e88){if(_0x240e88){return{'count':_0x240e88[_0xb038('0x20')],'rows':_[_0xb038('0x30')](_0x240e88[_0xb038('0x47')],function(_0x45a91a){return{'membername':_0x45a91a[_0xb038('0x2d')],'UserId':_0x45a91a['id'],'queue_name':_0x12aba5[_0xb038('0x2d')],'SmsQueueId':_0x12aba5['id'],'interface':util[_0xb038('0x60')](_0xb038('0x61'),_0xb038('0x62'),_0x45a91a[_0xb038('0x2d')]),'penalty':0x0,'paused':_0x45a91a[_0xb038('0x63')],'createdAt':_0x45a91a[_0xb038('0x64')],'updatedAt':_0x45a91a[_0xb038('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb038('0x28')](respondWithFilteredResult(_0x401f4c,_0x1f524e))[_0xb038('0x4e')](handleError(_0x401f4c,null));};exports[_0xb038('0x65')]=function(_0x1f9a30,_0x5d0f38,_0x23adc3){var _0x3c194d={};var _0x22e5ba={};var _0x16bb58;var _0xdaacfe;return db['SmsQueue'][_0xb038('0x5a')]({'where':{'id':_0x1f9a30[_0xb038('0x49')]['id']}})[_0xb038('0x28')](handleEntityNotFound(_0x5d0f38,null))[_0xb038('0x28')](function(_0x34e222){if(_0x34e222){_0x16bb58=_0x34e222;_0x22e5ba[_0xb038('0x34')]=_[_0xb038('0x36')](db[_0xb038('0x66')][_0xb038('0x4a')]);_0x22e5ba['query']=_['keys'](_0x1f9a30[_0xb038('0x35')]);_0x22e5ba['filters']=_[_0xb038('0x38')](_0x22e5ba['model'],_0x22e5ba['query']);_0x3c194d['attributes']=_[_0xb038('0x38')](_0x22e5ba[_0xb038('0x34')],qs['fields'](_0x1f9a30[_0xb038('0x35')][_0xb038('0x3a')]));_0x3c194d[_0xb038('0x39')]=_0x3c194d[_0xb038('0x39')][_0xb038('0x3b')]?_0x3c194d[_0xb038('0x39')]:_0x22e5ba[_0xb038('0x34')];_0x3c194d[_0xb038('0x3e')]=qs[_0xb038('0x3f')](_0x1f9a30[_0xb038('0x35')]['sort']);_0x3c194d[_0xb038('0x42')]=qs[_0xb038('0x37')](_[_0xb038('0x40')](_0x1f9a30[_0xb038('0x35')],_0x22e5ba[_0xb038('0x37')]));if(_0x1f9a30[_0xb038('0x35')][_0xb038('0x41')]){_0x3c194d['where']=_[_0xb038('0x43')](_0x3c194d[_0xb038('0x42')],{'$or':_[_0xb038('0x30')](_0x3c194d['attributes'],function(_0x551fcc){var _0x2adf3b={};_0x2adf3b[_0x551fcc]={'$like':'%'+_0x1f9a30[_0xb038('0x35')][_0xb038('0x41')]+'%'};return _0x2adf3b;})});}_0x3c194d=_['merge']({},_0x3c194d,_0x1f9a30[_0xb038('0x4c')]);return _0x16bb58[_0xb038('0x65')](_0x3c194d);}})['then'](function(_0x2e6db4){if(_0x2e6db4){_0xdaacfe=_0x2e6db4[_0xb038('0x3b')];if(!_0x1f9a30[_0xb038('0x35')][_0xb038('0x3c')](_0xb038('0x3d'))){_0x3c194d[_0xb038('0x22')]=qs[_0xb038('0x22')](_0x1f9a30[_0xb038('0x35')][_0xb038('0x22')]);_0x3c194d[_0xb038('0x21')]=qs[_0xb038('0x21')](_0x1f9a30[_0xb038('0x35')][_0xb038('0x21')]);}return _0x16bb58[_0xb038('0x65')](_0x3c194d);}})['then'](function(_0x17a3c9){if(_0x17a3c9){return _0x17a3c9?{'count':_0xdaacfe,'rows':_0x17a3c9}:null;}})[_0xb038('0x28')](respondWithResult(_0x5d0f38,null))[_0xb038('0x4e')](handleError(_0x5d0f38,null));};exports[_0xb038('0x67')]=function(_0x623d4e,_0x1df908,_0x3ce0a2){var _0xf9caa5=_0x623d4e['body'][_0xb038('0x68')];return db[_0xb038('0x66')]['findAll']({'where':{'id':_0xf9caa5},'attributes':['id'],'include':[{'model':db[_0xb038('0x5d')],'as':'Agents','attributes':['id','name',_0xb038('0x69'),'voicePause',_0xb038('0x6a')],'raw':!![]}]})['then'](function(_0x3493da){if(_0x3493da){var _0x1d15df=_[_0xb038('0x6b')](_0x3493da,function(_0xfe866a){var _0x367475=_0xfe866a[_0xb038('0x2a')]({'plain':!![]});return _0x367475[_0xb038('0x6c')];});return db[_0xb038('0x31')]['find']({'where':{'id':_0x623d4e['params']['id']}})[_0xb038('0x28')](function(_0x3365d2){return db[_0xb038('0x6d')][_0xb038('0x6e')](function(_0x4c505f){return _0x3365d2[_0xb038('0x67')](_0xf9caa5,{'transaction':_0x4c505f})[_0xb038('0x28')](function(){return BPromise[_0xb038('0x6f')](_0x1d15df,function(_0x29b84d){return db[_0xb038('0x5b')][_0xb038('0x70')]({'where':{'UserId':_0x29b84d['id'],'SmsQueueId':_0x623d4e[_0xb038('0x49')]['id']},'transaction':_0x4c505f});});})[_0xb038('0x28')](function(){_0x1d15df[_0xb038('0x71')](function(_0x38a66b){socket['emit']('userSmsQueue:save',{'UserId':_0x38a66b['id'],'SmsQueueId':_0x3365d2['id']});});});});});}})[_0xb038('0x28')](respondWithStatusCode(_0x1df908,null))[_0xb038('0x4e')](handleError(_0x1df908,null));};exports[_0xb038('0x72')]=function(_0x291660,_0x3ee569,_0x5fbd02){return db[_0xb038('0x66')]['findAll']({'where':{'id':_0x291660[_0xb038('0x35')][_0xb038('0x68')]},'attributes':['id'],'include':[{'model':db[_0xb038('0x5d')],'as':_0xb038('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xb038('0x28')](handleEntityNotFound(_0x3ee569,null))[_0xb038('0x28')](function(_0x4de432){var _0x451fe5=_[_0xb038('0x30')](_0x4de432,'id');var _0x8bd4c0=[];var _0x3cecdf=[];var _0x4383e6=squel[_0xb038('0x73')]();_0x4383e6[_0xb038('0x74')](_0xb038('0x75'))[_0xb038('0x76')](_0xb038('0x77'),'tq')[_0xb038('0x78')](_0xb038('0x79'),'ut',_0xb038('0x7a'))[_0xb038('0x42')](_0xb038('0x7b'),_0x291660[_0xb038('0x49')]['id']);for(var _0x5448e3=0x0;_0x5448e3<_0x4de432['length'];_0x5448e3+=0x1){let _0x183048=_0x4de432[_0x5448e3];for(var _0x17870b=0x0;_0x17870b<_0x183048[_0xb038('0x6c')]['length'];_0x17870b+=0x1){let _0x283e2b=_0x183048[_0xb038('0x6c')][_0x17870b];var _0xe1fce=_0x4383e6[_0xb038('0x7c')]();_0xe1fce['where']('ut.UserId\x20=\x20?',_0x283e2b['id']);_0x3cecdf[_0xb038('0x7d')](db[_0xb038('0x6d')]['query'](_0xe1fce[_0xb038('0x7e')](),{'type':db[_0xb038('0x6d')][_0xb038('0x7f')][_0xb038('0x80')]})['then'](function(_0xb204f3){if(_0xb204f3[_0xb038('0x3b')]===0x1){return _0x283e2b['id'];}else{var _0x44e0d6=_[_0xb038('0x81')](_[_0xb038('0x30')](_0xb204f3,_0xb038('0x82')),function(_0x108021){return _['includes'](_0x451fe5,_0x108021);});if(_0x44e0d6){return _0x283e2b['id'];}}}));}}return BPromise[_0xb038('0x83')](_0x3cecdf)[_0xb038('0x28')](function(_0x1746c2){_0x8bd4c0=_(_0x8bd4c0)['union'](_0x1746c2)[_0xb038('0x84')]()['value']();return db[_0xb038('0x31')]['find']({'where':{'id':_0x291660[_0xb038('0x49')]['id']}})[_0xb038('0x28')](function(_0x301811){return db['sequelize']['transaction'](function(_0x50a6f3){return _0x301811[_0xb038('0x72')](_0x291660[_0xb038('0x35')][_0xb038('0x68')],{'transaction':_0x50a6f3})['then'](function(){if(!_[_0xb038('0x85')](_0x8bd4c0)){return _0x301811['removeAgents'](_0x8bd4c0,{'transaction':_0x50a6f3});}})[_0xb038('0x28')](function(){_0x8bd4c0['forEach'](function(_0x5d4094){socket[_0xb038('0x86')](_0xb038('0x87'),{'UserId':_0x5d4094,'SmsQueueId':_0x301811['id']});});});});});});})[_0xb038('0x28')](respondWithStatusCode(_0x3ee569,null))[_0xb038('0x4e')](handleError(_0x3ee569,null));};exports[_0xb038('0x88')]=function(_0x6afa65,_0x468a93,_0x4aaf53){return db[_0xb038('0x31')]['find']({'where':{'id':_0x6afa65['params']['id']}})[_0xb038('0x28')](handleEntityNotFound(_0x468a93,null))[_0xb038('0x28')](function(_0x2b161d){if(_0x2b161d){return _0x2b161d[_0xb038('0x88')](_0x6afa65[_0xb038('0x50')][_0xb038('0x68')],_[_0xb038('0x89')](_0x6afa65['body'],[_0xb038('0x68'),'id'])||{})[_0xb038('0x8a')](function(_0x23e0f3){for(var _0x180714=0x0;_0x180714<_0x6afa65[_0xb038('0x50')]['ids'][_0xb038('0x3b')];_0x180714+=0x1){socket[_0xb038('0x86')](_0xb038('0x8b'),{'UserId':_0x6afa65[_0xb038('0x50')]['ids'][_0x180714],'SmsQueueId':_0x6afa65[_0xb038('0x49')]['id']});}return _0x23e0f3;});}})[_0xb038('0x28')](respondWithResult(_0x468a93,null))['catch'](handleError(_0x468a93,null));};exports[_0xb038('0x8c')]=function(_0x538b4d,_0x35aba3,_0x529198){return db['SmsQueue']['find']({'where':{'id':_0x538b4d[_0xb038('0x49')]['id']}})['then'](handleEntityNotFound(_0x35aba3,null))[_0xb038('0x28')](function(_0xc95faf){if(_0xc95faf){return _0xc95faf[_0xb038('0x8c')](_0x538b4d[_0xb038('0x35')][_0xb038('0x68')])[_0xb038('0x28')](function(){if(_[_0xb038('0x8d')](_0x538b4d[_0xb038('0x35')]['ids'])){for(var _0x4fd98e=0x0;_0x4fd98e<_0x538b4d[_0xb038('0x35')]['ids']['length'];_0x4fd98e+=0x1){socket['emit'](_0xb038('0x87'),{'UserId':Number(_0x538b4d[_0xb038('0x35')][_0xb038('0x68')][_0x4fd98e]),'SmsQueueId':Number(_0x538b4d['params']['id'])});}}else{socket[_0xb038('0x86')](_0xb038('0x87'),{'UserId':Number(_0x538b4d[_0xb038('0x35')][_0xb038('0x68')]),'SmsQueueId':Number(_0x538b4d['params']['id'])});}});}})[_0xb038('0x28')](respondWithStatusCode(_0x35aba3,null))[_0xb038('0x4e')](handleError(_0x35aba3,null));};exports[_0xb038('0x8e')]=function(_0x48d1fa,_0x38cd65,_0x19771f){var _0x52c780={};var _0x16fa8d={};var _0x5e30a7;var _0x55be63;return db[_0xb038('0x31')][_0xb038('0x5a')]({'where':{'id':_0x48d1fa['params']['id']}})['then'](handleEntityNotFound(_0x38cd65,null))[_0xb038('0x28')](function(_0x38c614){if(_0x38c614){_0x5e30a7=_0x38c614;_0x16fa8d[_0xb038('0x34')]=_[_0xb038('0x36')](db[_0xb038('0x5d')][_0xb038('0x4a')]);_0x16fa8d[_0xb038('0x35')]=_[_0xb038('0x36')](_0x48d1fa[_0xb038('0x35')]);_0x16fa8d[_0xb038('0x37')]=_[_0xb038('0x38')](_0x16fa8d[_0xb038('0x34')],_0x16fa8d[_0xb038('0x35')]);_0x52c780[_0xb038('0x39')]=_[_0xb038('0x38')](_0x16fa8d[_0xb038('0x34')],qs[_0xb038('0x3a')](_0x48d1fa[_0xb038('0x35')]['fields']));_0x52c780[_0xb038('0x39')]=_0x52c780['attributes']['length']?_0x52c780['attributes']:_0x16fa8d[_0xb038('0x34')];_0x52c780[_0xb038('0x3e')]=qs[_0xb038('0x3f')](_0x48d1fa[_0xb038('0x35')][_0xb038('0x3f')]);_0x52c780[_0xb038('0x42')]=qs[_0xb038('0x37')](_[_0xb038('0x40')](_0x48d1fa[_0xb038('0x35')],_0x16fa8d['filters']));if(_0x48d1fa[_0xb038('0x35')][_0xb038('0x41')]){_0x52c780[_0xb038('0x42')]=_[_0xb038('0x43')](_0x52c780['where'],{'$or':_[_0xb038('0x30')](_0x52c780['attributes'],function(_0x326fa3){var _0xf3e0ab={};_0xf3e0ab[_0x326fa3]={'$like':'%'+_0x48d1fa[_0xb038('0x35')][_0xb038('0x41')]+'%'};return _0xf3e0ab;})});}_0x52c780=_['merge']({},_0x52c780,_0x48d1fa[_0xb038('0x4c')]);return _0x5e30a7[_0xb038('0x8e')](_0x52c780);}})[_0xb038('0x28')](function(_0x3fc071){if(_0x3fc071){_0x55be63=_0x3fc071[_0xb038('0x3b')];if(!_0x48d1fa[_0xb038('0x35')][_0xb038('0x3c')]('nolimit')){_0x52c780['limit']=qs[_0xb038('0x22')](_0x48d1fa[_0xb038('0x35')]['limit']);_0x52c780['offset']=qs[_0xb038('0x21')](_0x48d1fa['query'][_0xb038('0x21')]);}return _0x5e30a7[_0xb038('0x8e')](_0x52c780);}})[_0xb038('0x28')](function(_0x1f42a2){if(_0x1f42a2){return _0x1f42a2?{'count':_0x55be63,'rows':_0x1f42a2}:null;}})['then'](respondWithResult(_0x38cd65,null))['catch'](handleError(_0x38cd65,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index b7bc97b..8084a23 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 _0x19c7=['update','remove','emit','hook','exports','../../mysqldb','SmsQueue','setMaxListeners','save'];(function(_0x1f99d4,_0x365a50){var _0xb916db=function(_0xd46003){while(--_0xd46003){_0x1f99d4['push'](_0x1f99d4['shift']());}};_0xb916db(++_0x365a50);}(_0x19c7,0x16d));var _0x719c=function(_0x45411c,_0x29b687){_0x45411c=_0x45411c-0x0;var _0x43ad53=_0x19c7[_0x45411c];return _0x43ad53;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x719c('0x0'))['db'][_0x719c('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x719c('0x2')](0x0);var events={'afterCreate':_0x719c('0x3'),'afterUpdate':_0x719c('0x4'),'afterDestroy':_0x719c('0x5')};function emitEvent(_0x109bae){return function(_0x144405,_0x3ad380,_0x15a5d6){SmsQueueEvents[_0x719c('0x6')](_0x109bae+':'+_0x144405['id'],_0x144405);SmsQueueEvents[_0x719c('0x6')](_0x109bae,_0x144405);_0x15a5d6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x719c('0x7')](e,emitEvent(event));}}module[_0x719c('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x5d21=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x36abe4,_0x8a583f){var _0x544474=function(_0x314342){while(--_0x314342){_0x36abe4['push'](_0x36abe4['shift']());}};_0x544474(++_0x8a583f);}(_0x5d21,0x178));var _0x15d2=function(_0x2265d0,_0x145b4f){_0x2265d0=_0x2265d0-0x0;var _0x27e4fa=_0x5d21[_0x2265d0];return _0x27e4fa;};'use strict';var EventEmitter=require(_0x15d2('0x0'));var SmsQueue=require(_0x15d2('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x15d2('0x2')](0x0);var events={'afterCreate':_0x15d2('0x3'),'afterUpdate':_0x15d2('0x4'),'afterDestroy':_0x15d2('0x5')};function emitEvent(_0x41aeb7){return function(_0x18b955,_0x5e8f31,_0x273821){SmsQueueEvents[_0x15d2('0x6')](_0x41aeb7+':'+_0x18b955['id'],_0x18b955);SmsQueueEvents['emit'](_0x41aeb7,_0x18b955);_0x273821(null);};}for(var e in events){if(events[_0x15d2('0x7')](e)){var event=events[e];SmsQueue[_0x15d2('0x8')](e,emitEvent(event));}}module[_0x15d2('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index fcda664..1e3d0f5 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 _0x1680=['exports','define','SmsQueue','sms_queues','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x2a53e2,_0x80e842){var _0x49f265=function(_0xb638cd){while(--_0xb638cd){_0x2a53e2['push'](_0x2a53e2['shift']());}};_0x49f265(++_0x80e842);}(_0x1680,0x160));var _0x0168=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0x1680[_0x1ed116];return _0x574066;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0168('0x0'))(_0x0168('0x1'));var moment=require(_0x0168('0x2'));var BPromise=require('bluebird');var rp=require(_0x0168('0x3'));var fs=require('fs');var path=require(_0x0168('0x4'));var rimraf=require(_0x0168('0x5'));var config=require(_0x0168('0x6'));var attributes=require(_0x0168('0x7'));module[_0x0168('0x8')]=function(_0x183a0f,_0x57b7b3){return _0x183a0f[_0x0168('0x9')](_0x0168('0xa'),attributes,{'tableName':_0x0168('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d99=['define','SmsQueue','sms_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports'];(function(_0x169c71,_0x3b6e39){var _0x5a19c2=function(_0x46286a){while(--_0x46286a){_0x169c71['push'](_0x169c71['shift']());}};_0x5a19c2(++_0x3b6e39);}(_0x1d99,0x16f));var _0x91d9=function(_0x73402b,_0x36e524){_0x73402b=_0x73402b-0x0;var _0x4ecce5=_0x1d99[_0x73402b];return _0x4ecce5;};'use strict';var _=require('lodash');var util=require(_0x91d9('0x0'));var logger=require(_0x91d9('0x1'))(_0x91d9('0x2'));var moment=require(_0x91d9('0x3'));var BPromise=require(_0x91d9('0x4'));var rp=require(_0x91d9('0x5'));var fs=require('fs');var path=require(_0x91d9('0x6'));var rimraf=require(_0x91d9('0x7'));var config=require(_0x91d9('0x8'));var attributes=require(_0x91d9('0x9'));module[_0x91d9('0xa')]=function(_0x41f355,_0x617d88){return _0x41f355[_0x91d9('0xb')](_0x91d9('0xc'),attributes,{'tableName':_0x91d9('0xd'),'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 48ee22a..efac8f3 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 _0xe5bf=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','include','map','debug','ShowSmsQueue','find','where','model','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5e4d07,_0x3cadfb){var _0x2758c8=function(_0x56737e){while(--_0x56737e){_0x5e4d07['push'](_0x5e4d07['shift']());}};_0x2758c8(++_0x3cadfb);}(_0xe5bf,0x1e4));var _0xfe5b=function(_0xe7a0e2,_0x5a31e2){_0xe7a0e2=_0xe7a0e2-0x0;var _0x1ea9c=_0xe5bf[_0xe7a0e2];return _0x1ea9c;};'use strict';var _=require(_0xfe5b('0x0'));var util=require('util');var moment=require(_0xfe5b('0x1'));var BPromise=require(_0xfe5b('0x2'));var rs=require(_0xfe5b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfe5b('0x4'))['db'];var utils=require(_0xfe5b('0x5'));var logger=require(_0xfe5b('0x6'))(_0xfe5b('0x7'));var config=require('../../config/environment');var jayson=require(_0xfe5b('0x8'));var client=jayson['client'][_0xfe5b('0x9')]({'port':0x232a});config[_0xfe5b('0xa')]=_[_0xfe5b('0xb')](config[_0xfe5b('0xa')],{'host':_0xfe5b('0xc'),'port':0x18eb});var socket=require(_0xfe5b('0xd'))(new Redis(config['redis']));require(_0xfe5b('0xe'))[_0xfe5b('0xf')](socket);function respondWithRpcPromise(_0x2d3baa,_0x339463,_0x450655){return new BPromise(function(_0x150c14,_0x5eefa9){return client[_0xfe5b('0x10')](_0x2d3baa,_0x450655)[_0xfe5b('0x11')](function(_0x386f44){logger[_0xfe5b('0x12')](_0xfe5b('0x13'),_0x339463,_0xfe5b('0x14'));logger['debug'](_0xfe5b('0x15'),_0x339463,_0xfe5b('0x14'),JSON[_0xfe5b('0x16')](_0x386f44));if(_0x386f44[_0xfe5b('0x17')]){if(_0x386f44['error'][_0xfe5b('0x18')]===0x1f4){logger[_0xfe5b('0x17')](_0xfe5b('0x13'),_0x339463,_0x386f44[_0xfe5b('0x17')][_0xfe5b('0x19')]);return _0x5eefa9(_0x386f44[_0xfe5b('0x17')]['message']);}logger[_0xfe5b('0x17')]('SmsQueue,\x20%s,\x20%s',_0x339463,_0x386f44[_0xfe5b('0x17')][_0xfe5b('0x19')]);return _0x150c14(_0x386f44[_0xfe5b('0x17')][_0xfe5b('0x19')]);}else{logger['info'](_0xfe5b('0x13'),_0x339463,'request\x20sent');_0x150c14(_0x386f44[_0xfe5b('0x1a')][_0xfe5b('0x19')]);}})[_0xfe5b('0x1b')](function(_0x485e7b){logger['error']('SmsQueue,\x20%s,\x20%s',_0x339463,_0x485e7b);_0x5eefa9(_0x485e7b);});});}exports[_0xfe5b('0x1c')]=function(_0x581395){var _0x41a340=this;return new Promise(function(_0x2c2509,_0x35238c){return db[_0xfe5b('0x1d')][_0xfe5b('0x1e')]({'raw':_0x581395[_0xfe5b('0x1f')]?_0x581395['options'][_0xfe5b('0x20')]===undefined?!![]:![]:!![],'where':_0x581395[_0xfe5b('0x1f')]?_0x581395[_0xfe5b('0x1f')]['where']||null:null,'attributes':_0x581395[_0xfe5b('0x1f')]?_0x581395[_0xfe5b('0x1f')][_0xfe5b('0x21')]||null:null,'limit':_0x581395[_0xfe5b('0x1f')]?_0x581395[_0xfe5b('0x1f')]['limit']||null:null,'include':_0x581395[_0xfe5b('0x1f')]?_0x581395[_0xfe5b('0x1f')][_0xfe5b('0x22')]?_['map'](_0x581395[_0xfe5b('0x1f')]['include'],function(_0x46e39c){return{'model':db[_0x46e39c['model']],'as':_0x46e39c['as'],'attributes':_0x46e39c[_0xfe5b('0x21')],'include':_0x46e39c[_0xfe5b('0x22')]?_[_0xfe5b('0x23')](_0x46e39c['include'],function(_0x1538d7){return{'model':db[_0x1538d7['model']],'as':_0x1538d7['as'],'attributes':_0x1538d7[_0xfe5b('0x21')],'include':_0x1538d7[_0xfe5b('0x22')]?_[_0xfe5b('0x23')](_0x1538d7[_0xfe5b('0x22')],function(_0x17aac7){return{'model':db[_0x17aac7['model']],'as':_0x17aac7['as'],'attributes':_0x17aac7[_0xfe5b('0x21')]};}):[]};}):[]};}):[]:[]})[_0xfe5b('0x11')](function(_0x5e8b86){logger[_0xfe5b('0x12')]('GetSmsQueue',_0x581395);logger[_0xfe5b('0x24')]('GetSmsQueue',_0x581395,JSON['stringify'](_0x5e8b86));_0x2c2509(_0x5e8b86);})[_0xfe5b('0x1b')](function(_0x45b086){logger[_0xfe5b('0x17')](_0xfe5b('0x1c'),_0x45b086[_0xfe5b('0x19')],_0x581395);_0x35238c(_0x41a340[_0xfe5b('0x17')](0x1f4,_0x45b086['message']));});});};exports[_0xfe5b('0x25')]=function(_0x2a625e){var _0x43388b=this;return new Promise(function(_0x46e00a,_0x2fe637){return db['SmsQueue'][_0xfe5b('0x26')]({'raw':_0x2a625e[_0xfe5b('0x1f')]?_0x2a625e[_0xfe5b('0x1f')][_0xfe5b('0x20')]===undefined?!![]:![]:!![],'where':_0x2a625e[_0xfe5b('0x1f')]?_0x2a625e[_0xfe5b('0x1f')][_0xfe5b('0x27')]||null:null,'attributes':_0x2a625e[_0xfe5b('0x1f')]?_0x2a625e[_0xfe5b('0x1f')][_0xfe5b('0x21')]||null:null,'include':_0x2a625e[_0xfe5b('0x1f')]?_0x2a625e['options'][_0xfe5b('0x22')]?_[_0xfe5b('0x23')](_0x2a625e[_0xfe5b('0x1f')][_0xfe5b('0x22')],function(_0x14688b){return{'model':db[_0x14688b[_0xfe5b('0x28')]],'as':_0x14688b['as'],'attributes':_0x14688b['attributes'],'include':_0x14688b['include']?_[_0xfe5b('0x23')](_0x14688b[_0xfe5b('0x22')],function(_0x5ad462){return{'model':db[_0x5ad462[_0xfe5b('0x28')]],'as':_0x5ad462['as'],'attributes':_0x5ad462[_0xfe5b('0x21')],'include':_0x5ad462[_0xfe5b('0x22')]?_[_0xfe5b('0x23')](_0x5ad462[_0xfe5b('0x22')],function(_0x25b1c5){return{'model':db[_0x25b1c5['model']],'as':_0x25b1c5['as'],'attributes':_0x25b1c5['attributes']};}):[]};}):[]};}):[]:[]})[_0xfe5b('0x11')](function(_0x21b877){logger['info']('ShowSmsQueue',_0x2a625e);logger[_0xfe5b('0x24')](_0xfe5b('0x25'),_0x2a625e,JSON['stringify'](_0x21b877));_0x46e00a(_0x21b877);})[_0xfe5b('0x1b')](function(_0x31adbf){logger[_0xfe5b('0x17')](_0xfe5b('0x25'),_0x31adbf[_0xfe5b('0x19')],_0x2a625e);_0x2fe637(_0x43388b[_0xfe5b('0x17')](0x1f4,_0x31adbf[_0xfe5b('0x19')]));});});}; \ No newline at end of file +var _0x5ffb=['../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetSmsQueue','SmsQueue','options','attributes','limit','include','map','model','then','stringify','ShowSmsQueue','find','raw','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5864ef,_0x496812){var _0x21c244=function(_0x433f8a){while(--_0x433f8a){_0x5864ef['push'](_0x5864ef['shift']());}};_0x21c244(++_0x496812);}(_0x5ffb,0x1aa));var _0xb5ff=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5ffb[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb5ff('0x0'));var BPromise=require(_0xb5ff('0x1'));var rs=require(_0xb5ff('0x2'));var fs=require('fs');var Redis=require(_0xb5ff('0x3'));var db=require(_0xb5ff('0x4'))['db'];var utils=require(_0xb5ff('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb5ff('0x6'));var jayson=require(_0xb5ff('0x7'));var client=jayson[_0xb5ff('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xb5ff('0x9')],{'host':_0xb5ff('0xa'),'port':0x18eb});var socket=require(_0xb5ff('0xb'))(new Redis(config['redis']));require(_0xb5ff('0xc'))[_0xb5ff('0xd')](socket);function respondWithRpcPromise(_0x209d6f,_0x50351b,_0x27409d){return new BPromise(function(_0x228314,_0x5de446){return client[_0xb5ff('0xe')](_0x209d6f,_0x27409d)['then'](function(_0x5c7602){logger[_0xb5ff('0xf')](_0xb5ff('0x10'),_0x50351b,_0xb5ff('0x11'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x50351b,_0xb5ff('0x11'),JSON['stringify'](_0x5c7602));if(_0x5c7602[_0xb5ff('0x12')]){if(_0x5c7602[_0xb5ff('0x12')]['code']===0x1f4){logger[_0xb5ff('0x12')](_0xb5ff('0x10'),_0x50351b,_0x5c7602[_0xb5ff('0x12')][_0xb5ff('0x13')]);return _0x5de446(_0x5c7602[_0xb5ff('0x12')][_0xb5ff('0x13')]);}logger['error'](_0xb5ff('0x10'),_0x50351b,_0x5c7602[_0xb5ff('0x12')][_0xb5ff('0x13')]);return _0x228314(_0x5c7602['error'][_0xb5ff('0x13')]);}else{logger[_0xb5ff('0xf')](_0xb5ff('0x10'),_0x50351b,_0xb5ff('0x11'));_0x228314(_0x5c7602[_0xb5ff('0x14')][_0xb5ff('0x13')]);}})[_0xb5ff('0x15')](function(_0x13ca53){logger[_0xb5ff('0x12')](_0xb5ff('0x10'),_0x50351b,_0x13ca53);_0x5de446(_0x13ca53);});});}exports[_0xb5ff('0x16')]=function(_0xfe4012){var _0x4915ee=this;return new Promise(function(_0x4cd05e,_0x2cb2de){return db[_0xb5ff('0x17')]['findAll']({'raw':_0xfe4012[_0xb5ff('0x18')]?_0xfe4012[_0xb5ff('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xfe4012['options']?_0xfe4012[_0xb5ff('0x18')]['where']||null:null,'attributes':_0xfe4012['options']?_0xfe4012['options'][_0xb5ff('0x19')]||null:null,'limit':_0xfe4012[_0xb5ff('0x18')]?_0xfe4012[_0xb5ff('0x18')][_0xb5ff('0x1a')]||null:null,'include':_0xfe4012[_0xb5ff('0x18')]?_0xfe4012[_0xb5ff('0x18')][_0xb5ff('0x1b')]?_[_0xb5ff('0x1c')](_0xfe4012[_0xb5ff('0x18')][_0xb5ff('0x1b')],function(_0x5a9950){return{'model':db[_0x5a9950[_0xb5ff('0x1d')]],'as':_0x5a9950['as'],'attributes':_0x5a9950['attributes'],'include':_0x5a9950['include']?_[_0xb5ff('0x1c')](_0x5a9950['include'],function(_0x2ae303){return{'model':db[_0x2ae303[_0xb5ff('0x1d')]],'as':_0x2ae303['as'],'attributes':_0x2ae303[_0xb5ff('0x19')],'include':_0x2ae303['include']?_[_0xb5ff('0x1c')](_0x2ae303[_0xb5ff('0x1b')],function(_0x209a1e){return{'model':db[_0x209a1e[_0xb5ff('0x1d')]],'as':_0x209a1e['as'],'attributes':_0x209a1e[_0xb5ff('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb5ff('0x1e')](function(_0x57ba39){logger['info']('GetSmsQueue',_0xfe4012);logger['debug']('GetSmsQueue',_0xfe4012,JSON[_0xb5ff('0x1f')](_0x57ba39));_0x4cd05e(_0x57ba39);})[_0xb5ff('0x15')](function(_0x2ece76){logger['error']('GetSmsQueue',_0x2ece76[_0xb5ff('0x13')],_0xfe4012);_0x2cb2de(_0x4915ee['error'](0x1f4,_0x2ece76[_0xb5ff('0x13')]));});});};exports[_0xb5ff('0x20')]=function(_0x34ac2a){var _0x87449e=this;return new Promise(function(_0x519942,_0x44211c){return db[_0xb5ff('0x17')][_0xb5ff('0x21')]({'raw':_0x34ac2a[_0xb5ff('0x18')]?_0x34ac2a[_0xb5ff('0x18')][_0xb5ff('0x22')]===undefined?!![]:![]:!![],'where':_0x34ac2a[_0xb5ff('0x18')]?_0x34ac2a[_0xb5ff('0x18')][_0xb5ff('0x23')]||null:null,'attributes':_0x34ac2a[_0xb5ff('0x18')]?_0x34ac2a['options'][_0xb5ff('0x19')]||null:null,'include':_0x34ac2a[_0xb5ff('0x18')]?_0x34ac2a[_0xb5ff('0x18')][_0xb5ff('0x1b')]?_[_0xb5ff('0x1c')](_0x34ac2a[_0xb5ff('0x18')]['include'],function(_0x431bd0){return{'model':db[_0x431bd0[_0xb5ff('0x1d')]],'as':_0x431bd0['as'],'attributes':_0x431bd0[_0xb5ff('0x19')],'include':_0x431bd0[_0xb5ff('0x1b')]?_[_0xb5ff('0x1c')](_0x431bd0['include'],function(_0x393736){return{'model':db[_0x393736[_0xb5ff('0x1d')]],'as':_0x393736['as'],'attributes':_0x393736[_0xb5ff('0x19')],'include':_0x393736[_0xb5ff('0x1b')]?_[_0xb5ff('0x1c')](_0x393736[_0xb5ff('0x1b')],function(_0x52a9d2){return{'model':db[_0x52a9d2[_0xb5ff('0x1d')]],'as':_0x52a9d2['as'],'attributes':_0x52a9d2[_0xb5ff('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb5ff('0x1e')](function(_0xd7db93){logger[_0xb5ff('0xf')](_0xb5ff('0x20'),_0x34ac2a);logger['debug'](_0xb5ff('0x20'),_0x34ac2a,JSON[_0xb5ff('0x1f')](_0xd7db93));_0x519942(_0xd7db93);})[_0xb5ff('0x15')](function(_0x1c5171){logger[_0xb5ff('0x12')]('ShowSmsQueue',_0x1c5171['message'],_0x34ac2a);_0x44211c(_0x87449e[_0xb5ff('0x12')](0x1f4,_0x1c5171[_0xb5ff('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 9c3478d..2debaf9 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 _0x47ab=['emit','removeListener','length','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x4fabd8,_0x950c6e){var _0x40a4f8=function(_0x47abe3){while(--_0x47abe3){_0x4fabd8['push'](_0x4fabd8['shift']());}};_0x40a4f8(++_0x950c6e);}(_0x47ab,0x19c));var _0xb47a=function(_0x335703,_0x1f358d){_0x335703=_0x335703-0x0;var _0x52b331=_0x47ab[_0x335703];return _0x52b331;};'use strict';var SmsQueueEvents=require(_0xb47a('0x0'));var events=[_0xb47a('0x1'),_0xb47a('0x2'),_0xb47a('0x3')];function createListener(_0x308b24,_0x4cdcc3){return function(_0x18ccf5){_0x4cdcc3[_0xb47a('0x4')](_0x308b24,_0x18ccf5);};}function removeListener(_0x279e1b,_0x3bce34){return function(){SmsQueueEvents[_0xb47a('0x5')](_0x279e1b,_0x3bce34);};}exports['register']=function(_0x48ab71){for(var _0x48da9e=0x0,_0x621771=events[_0xb47a('0x6')];_0x48da9e<_0x621771;_0x48da9e++){var _0x584578=events[_0x48da9e];var _0x2f4f7f=createListener(_0xb47a('0x7')+_0x584578,_0x48ab71);SmsQueueEvents['on'](_0x584578,_0x2f4f7f);}}; \ No newline at end of file +var _0xabb1=['update','removeListener','register','length','./smsQueue.events','remove'];(function(_0x20a618,_0x3d1a7b){var _0x3be658=function(_0x2cef18){while(--_0x2cef18){_0x20a618['push'](_0x20a618['shift']());}};_0x3be658(++_0x3d1a7b);}(_0xabb1,0x88));var _0x1abb=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xabb1[_0x263a74];return _0x2aa86c;};'use strict';var SmsQueueEvents=require(_0x1abb('0x0'));var events=['save',_0x1abb('0x1'),_0x1abb('0x2')];function createListener(_0x32ebf0,_0x35440f){return function(_0x19ef39){_0x35440f['emit'](_0x32ebf0,_0x19ef39);};}function removeListener(_0x34c941,_0x3ef3e2){return function(){SmsQueueEvents[_0x1abb('0x3')](_0x34c941,_0x3ef3e2);};}exports[_0x1abb('0x4')]=function(_0xd954b8){for(var _0x4695e9=0x0,_0x23face=events[_0x1abb('0x5')];_0x4695e9<_0x23face;_0x4695e9++){var _0x1c9116=events[_0x4695e9];var _0x46876a=createListener('smsQueue:'+_0x1c9116,_0xd954b8);SmsQueueEvents['on'](_0x1c9116,_0x46876a);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 1051e0c..359d69c 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 _0x2521=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','multer','path'];(function(_0x95916a,_0x3707d7){var _0x2a0ac4=function(_0x4754c4){while(--_0x4754c4){_0x95916a['push'](_0x95916a['shift']());}};_0x2a0ac4(++_0x3707d7);}(_0x2521,0x1de));var _0x1252=function(_0x3ff2f9,_0x544ba1){_0x3ff2f9=_0x3ff2f9-0x0;var _0x3b0913=_0x2521[_0x3ff2f9];return _0x3b0913;};'use strict';var multer=require(_0x1252('0x0'));var util=require('util');var path=require(_0x1252('0x1'));var timeout=require(_0x1252('0x2'));var express=require(_0x1252('0x3'));var router=express[_0x1252('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1252('0x5'));var config=require(_0x1252('0x6'));var controller=require(_0x1252('0x7'));router[_0x1252('0x8')]('/',auth['isAuthenticated'](),controller[_0x1252('0x9')]);router[_0x1252('0x8')](_0x1252('0xa'),auth[_0x1252('0xb')](),controller[_0x1252('0xc')]);router[_0x1252('0x8')](_0x1252('0xd'),auth[_0x1252('0xb')](),controller['show']);router[_0x1252('0xe')]('/',auth[_0x1252('0xb')](),controller[_0x1252('0xf')]);router[_0x1252('0x10')](_0x1252('0xd'),auth[_0x1252('0xb')](),controller[_0x1252('0x11')]);router['delete'](_0x1252('0xd'),auth[_0x1252('0xb')](),controller[_0x1252('0x12')]);module[_0x1252('0x13')]=router; \ No newline at end of file +var _0x5363=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer'];(function(_0x1a6544,_0x4ebaa8){var _0x45126d=function(_0x1c13bd){while(--_0x1c13bd){_0x1a6544['push'](_0x1a6544['shift']());}};_0x45126d(++_0x4ebaa8);}(_0x5363,0x167));var _0x3536=function(_0x4246bd,_0xdab764){_0x4246bd=_0x4246bd-0x0;var _0x20e0b7=_0x5363[_0x4246bd];return _0x20e0b7;};'use strict';var multer=require(_0x3536('0x0'));var util=require(_0x3536('0x1'));var path=require(_0x3536('0x2'));var timeout=require('connect-timeout');var express=require(_0x3536('0x3'));var router=express[_0x3536('0x4')]();var auth=require(_0x3536('0x5'));var interaction=require(_0x3536('0x6'));var config=require('../../config/environment');var controller=require(_0x3536('0x7'));router[_0x3536('0x8')]('/',auth[_0x3536('0x9')](),controller[_0x3536('0xa')]);router['get'](_0x3536('0xb'),auth[_0x3536('0x9')](),controller[_0x3536('0xc')]);router['get'](_0x3536('0xd'),auth[_0x3536('0x9')](),controller[_0x3536('0xe')]);router[_0x3536('0xf')]('/',auth[_0x3536('0x9')](),controller['create']);router['put']('/:id',auth[_0x3536('0x9')](),controller[_0x3536('0x10')]);router[_0x3536('0x11')](_0x3536('0xd'),auth[_0x3536('0x9')](),controller[_0x3536('0x12')]);module[_0x3536('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 f3abc23..1fa98d9 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 _0xadec=['DATE','moment','sequelize','STRING'];(function(_0x533ddd,_0xc432bf){var _0x1f765f=function(_0x39ef7a){while(--_0x39ef7a){_0x533ddd['push'](_0x533ddd['shift']());}};_0x1f765f(++_0xc432bf);}(_0xadec,0x1a9));var _0xcade=function(_0x25ce6e,_0x56e3a8){_0x25ce6e=_0x25ce6e-0x0;var _0x49e1ce=_0xadec[_0x25ce6e];return _0x49e1ce;};'use strict';var moment=require(_0xcade('0x0'));var Sequelize=require(_0xcade('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xcade('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xcade('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xcade('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xcade('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1847=['DATE','moment','sequelize','exports','STRING'];(function(_0x155fac,_0x12c9d5){var _0x116783=function(_0x3bc4c9){while(--_0x3bc4c9){_0x155fac['push'](_0x155fac['shift']());}};_0x116783(++_0x12c9d5);}(_0x1847,0x12d));var _0x7184=function(_0x1cb9ab,_0x57c3f2){_0x1cb9ab=_0x1cb9ab-0x0;var _0x543464=_0x1847[_0x1cb9ab];return _0x543464;};'use strict';var moment=require(_0x7184('0x0'));var Sequelize=require(_0x7184('0x1'));module[_0x7184('0x2')]={'uniqueid':{'type':Sequelize[_0x7184('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x7184('0x4')]},'leaveAt':{'type':Sequelize[_0x7184('0x4')]},'acceptAt':{'type':Sequelize[_0x7184('0x4')]},'exitAt':{'type':Sequelize[_0x7184('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index ad0e7a2..9689872 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 _0x8439=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','json','apply','reject','save','then','destroy','error','stack','name','send','SmsQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','filter','where','merge','map','VIRTUAL','include','catch','show','params','length','includeAll','options','find','create','update','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','crypto'];(function(_0x4d2f00,_0x4e94d5){var _0x2d7b7f=function(_0x18fa08){while(--_0x18fa08){_0x4d2f00['push'](_0x4d2f00['shift']());}};_0x2d7b7f(++_0x4e94d5);}(_0x8439,0x1d8));var _0x9843=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x8439[_0x2db12b];return _0x20990b;};'use strict';var pdf=require(_0x9843('0x0'));var emlformat=require(_0x9843('0x1'));var rimraf=require(_0x9843('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9843('0x3'));var rp=require(_0x9843('0x4'));var moment=require(_0x9843('0x5'));var BPromise=require(_0x9843('0x6'));var Mustache=require('mustache');var util=require(_0x9843('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9843('0x8'));var fs=require('fs');var _=require(_0x9843('0x9'));var squel=require('squel');var crypto=require(_0x9843('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9843('0xb'));var Papa=require(_0x9843('0xc'));var Redis=require(_0x9843('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9843('0xe'));var as=require(_0x9843('0xf'));var hardwareService=require(_0x9843('0x10'));var logger=require(_0x9843('0x11'))(_0x9843('0x12'));var utils=require(_0x9843('0x13'));var config=require(_0x9843('0x14'));var licenseUtil=require(_0x9843('0x15'));var db=require(_0x9843('0x16'))['db'];function respondWithStatusCode(_0x1558da,_0x1ca9f2){_0x1ca9f2=_0x1ca9f2||0xcc;return function(_0x3e1941){if(_0x3e1941){return _0x1558da['sendStatus'](_0x1ca9f2);}return _0x1558da[_0x9843('0x17')](_0x1ca9f2)[_0x9843('0x18')]();};}function respondWithResult(_0x47332b,_0x79f3dc){_0x79f3dc=_0x79f3dc||0xc8;return function(_0x3ee1ff){if(_0x3ee1ff){return _0x47332b[_0x9843('0x17')](_0x79f3dc)['json'](_0x3ee1ff);}};}function respondWithFilteredResult(_0x455619,_0x12f7bb){return function(_0x56a738){if(_0x56a738){var _0x57d765=_0x56a738[_0x9843('0x19')],_0x753351=_0x12f7bb[_0x9843('0x1a')],_0xbcdf34=_0x12f7bb['offset']+_0x12f7bb[_0x9843('0x1b')],_0x4e4e25;if(_0xbcdf34>=_0x57d765){_0xbcdf34=_0x57d765;_0x4e4e25=0xc8;}else{_0x4e4e25=0xce;}_0x455619[_0x9843('0x17')](_0x4e4e25);return _0x455619['set']('Content-Range',_0x753351+'-'+_0xbcdf34+'/'+_0x57d765)[_0x9843('0x1c')](_0x56a738);}return null;};}function patchUpdates(_0x4b012c){return function(_0x492e2b){try{jsonpatch[_0x9843('0x1d')](_0x492e2b,_0x4b012c,!![]);}catch(_0x5e5750){return BPromise[_0x9843('0x1e')](_0x5e5750);}return _0x492e2b[_0x9843('0x1f')]();};}function saveUpdates(_0x29c635,_0x3df235){return function(_0x43add3){if(_0x43add3){return _0x43add3['update'](_0x29c635)[_0x9843('0x20')](function(_0x1f6e6d){return _0x1f6e6d;});}return null;};}function removeEntity(_0x345665,_0x142e00){return function(_0x4af0e2){if(_0x4af0e2){return _0x4af0e2[_0x9843('0x21')]()['then'](function(){_0x345665[_0x9843('0x17')](0xcc)[_0x9843('0x18')]();});}};}function handleEntityNotFound(_0x531ec8,_0x9536da){return function(_0x30558b){if(!_0x30558b){_0x531ec8['sendStatus'](0x194);}return _0x30558b;};}function handleError(_0x50ebed,_0x40717d){_0x40717d=_0x40717d||0x1f4;return function(_0x31c462){logger[_0x9843('0x22')](_0x31c462[_0x9843('0x23')]);if(_0x31c462[_0x9843('0x24')]){delete _0x31c462[_0x9843('0x24')];}_0x50ebed[_0x9843('0x17')](_0x40717d)[_0x9843('0x25')](_0x31c462);};}exports['index']=function(_0x3235f5,_0x4c6d95){var _0x1bd04a={},_0x178ca2={},_0x36c4d3={'count':0x0,'rows':[]};var _0x72dc16=_['map'](db[_0x9843('0x26')][_0x9843('0x27')],function(_0x4f3141){return{'name':_0x4f3141[_0x9843('0x28')],'type':_0x4f3141[_0x9843('0x29')][_0x9843('0x2a')]};});_0x178ca2['model']=_['map'](_0x72dc16,_0x9843('0x24'));_0x178ca2[_0x9843('0x2b')]=_[_0x9843('0x2c')](_0x3235f5[_0x9843('0x2b')]);_0x178ca2[_0x9843('0x2d')]=_[_0x9843('0x2e')](_0x178ca2['model'],_0x178ca2[_0x9843('0x2b')]);_0x1bd04a['attributes']=_['intersection'](_0x178ca2[_0x9843('0x2f')],qs[_0x9843('0x30')](_0x3235f5[_0x9843('0x2b')][_0x9843('0x30')]));_0x1bd04a[_0x9843('0x31')]=_0x1bd04a['attributes']['length']?_0x1bd04a[_0x9843('0x31')]:_0x178ca2['model'];if(!_0x3235f5[_0x9843('0x2b')][_0x9843('0x32')](_0x9843('0x33'))){_0x1bd04a[_0x9843('0x1b')]=qs[_0x9843('0x1b')](_0x3235f5['query']['limit']);_0x1bd04a[_0x9843('0x1a')]=qs[_0x9843('0x1a')](_0x3235f5[_0x9843('0x2b')]['offset']);}_0x1bd04a['order']=qs[_0x9843('0x34')](_0x3235f5[_0x9843('0x2b')][_0x9843('0x34')]);_0x1bd04a['where']=qs[_0x9843('0x2d')](_['pick'](_0x3235f5['query'],_0x178ca2[_0x9843('0x2d')]),_0x72dc16);if(_0x3235f5[_0x9843('0x2b')][_0x9843('0x35')]){_0x1bd04a[_0x9843('0x36')]=_[_0x9843('0x37')](_0x1bd04a['where'],{'$or':_[_0x9843('0x38')](_0x72dc16,function(_0x2d1815){if(_0x2d1815['type']!==_0x9843('0x39')){var _0x1bd270={};_0x1bd270[_0x2d1815[_0x9843('0x24')]]={'$like':'%'+_0x3235f5[_0x9843('0x2b')][_0x9843('0x35')]+'%'};return _0x1bd270;}})});}_0x1bd04a=_['merge']({},_0x1bd04a,_0x3235f5['options']);var _0x50edc4={'where':_0x1bd04a['where']};return db[_0x9843('0x26')]['count'](_0x50edc4)[_0x9843('0x20')](function(_0x3e93f2){_0x36c4d3[_0x9843('0x19')]=_0x3e93f2;if(_0x3235f5[_0x9843('0x2b')]['includeAll']){_0x1bd04a[_0x9843('0x3a')]=[{'all':!![]}];}return db[_0x9843('0x26')]['findAll'](_0x1bd04a);})[_0x9843('0x20')](function(_0xed26da){_0x36c4d3['rows']=_0xed26da;return _0x36c4d3;})[_0x9843('0x20')](respondWithFilteredResult(_0x4c6d95,_0x1bd04a))[_0x9843('0x3b')](handleError(_0x4c6d95,null));};exports[_0x9843('0x3c')]=function(_0x3ba516,_0x4de04f){var _0x2c811d={'raw':!![],'where':{'id':_0x3ba516[_0x9843('0x3d')]['id']}},_0x52dae6={};_0x52dae6[_0x9843('0x2f')]=_[_0x9843('0x2c')](db[_0x9843('0x26')][_0x9843('0x27')]);_0x52dae6['query']=_[_0x9843('0x2c')](_0x3ba516[_0x9843('0x2b')]);_0x52dae6[_0x9843('0x2d')]=_[_0x9843('0x2e')](_0x52dae6[_0x9843('0x2f')],_0x52dae6[_0x9843('0x2b')]);_0x2c811d[_0x9843('0x31')]=_[_0x9843('0x2e')](_0x52dae6['model'],qs[_0x9843('0x30')](_0x3ba516['query'][_0x9843('0x30')]));_0x2c811d[_0x9843('0x31')]=_0x2c811d['attributes'][_0x9843('0x3e')]?_0x2c811d['attributes']:_0x52dae6['model'];if(_0x3ba516[_0x9843('0x2b')][_0x9843('0x3f')]){_0x2c811d[_0x9843('0x3a')]=[{'all':!![]}];}_0x2c811d=_[_0x9843('0x37')]({},_0x2c811d,_0x3ba516[_0x9843('0x40')]);return db[_0x9843('0x26')][_0x9843('0x41')](_0x2c811d)[_0x9843('0x20')](handleEntityNotFound(_0x4de04f,null))['then'](respondWithResult(_0x4de04f,null))[_0x9843('0x3b')](handleError(_0x4de04f,null));};exports[_0x9843('0x42')]=function(_0x5737d9,_0x3080c5){return db['SmsQueueReport'][_0x9843('0x42')](_0x5737d9['body'],{})[_0x9843('0x20')](respondWithResult(_0x3080c5,0xc9))[_0x9843('0x3b')](handleError(_0x3080c5,null));};exports[_0x9843('0x43')]=function(_0x4829b8,_0x364431){if(_0x4829b8['body']['id']){delete _0x4829b8[_0x9843('0x44')]['id'];}return db[_0x9843('0x26')][_0x9843('0x41')]({'where':{'id':_0x4829b8[_0x9843('0x3d')]['id']}})[_0x9843('0x20')](handleEntityNotFound(_0x364431,null))[_0x9843('0x20')](saveUpdates(_0x4829b8['body'],null))[_0x9843('0x20')](respondWithResult(_0x364431,null))[_0x9843('0x3b')](handleError(_0x364431,null));};exports[_0x9843('0x21')]=function(_0x146ad6,_0x270e81){return db[_0x9843('0x26')][_0x9843('0x41')]({'where':{'id':_0x146ad6[_0x9843('0x3d')]['id']}})[_0x9843('0x20')](handleEntityNotFound(_0x270e81,null))[_0x9843('0x20')](removeEntity(_0x270e81,null))[_0x9843('0x3b')](handleError(_0x270e81,null));};exports['describe']=function(_0x4e88a0,_0x33205d){return db['SmsQueueReport']['describe']()[_0x9843('0x20')](respondWithResult(_0x33205d,null))['catch'](handleError(_0x33205d,null));}; \ No newline at end of file +var _0xe663=['request-promise','moment','bluebird','mustache','util','path','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','reject','save','then','destroy','end','error','stack','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','update','describe','html-pdf','zip-dir','fast-json-patch'];(function(_0x258fb0,_0x5362dc){var _0x4d1afe=function(_0x1c8f24){while(--_0x1c8f24){_0x258fb0['push'](_0x258fb0['shift']());}};_0x4d1afe(++_0x5362dc);}(_0xe663,0x12d));var _0x3e66=function(_0x32ea48,_0x2c4d9a){_0x32ea48=_0x32ea48-0x0;var _0x2e2152=_0xe663[_0x32ea48];return _0x2e2152;};'use strict';var pdf=require(_0x3e66('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3e66('0x1'));var jsonpatch=require(_0x3e66('0x2'));var rp=require(_0x3e66('0x3'));var moment=require(_0x3e66('0x4'));var BPromise=require(_0x3e66('0x5'));var Mustache=require(_0x3e66('0x6'));var util=require(_0x3e66('0x7'));var path=require(_0x3e66('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3e66('0x9'));var squel=require('squel');var crypto=require(_0x3e66('0xa'));var jsforce=require(_0x3e66('0xb'));var deskjs=require(_0x3e66('0xc'));var toCsv=require(_0x3e66('0xd'));var querystring=require(_0x3e66('0xe'));var Papa=require('papaparse');var Redis=require(_0x3e66('0xf'));var authService=require(_0x3e66('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3e66('0x11'));var hardwareService=require(_0x3e66('0x12'));var logger=require(_0x3e66('0x13'))(_0x3e66('0x14'));var utils=require(_0x3e66('0x15'));var config=require(_0x3e66('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3e66('0x17'))['db'];function respondWithStatusCode(_0x2192ac,_0x47d2d4){_0x47d2d4=_0x47d2d4||0xcc;return function(_0x396517){if(_0x396517){return _0x2192ac[_0x3e66('0x18')](_0x47d2d4);}return _0x2192ac[_0x3e66('0x19')](_0x47d2d4)['end']();};}function respondWithResult(_0x1e0a9b,_0x1b6507){_0x1b6507=_0x1b6507||0xc8;return function(_0x11add6){if(_0x11add6){return _0x1e0a9b['status'](_0x1b6507)[_0x3e66('0x1a')](_0x11add6);}};}function respondWithFilteredResult(_0x232fac,_0x3f019d){return function(_0x27579a){if(_0x27579a){var _0x47428=_0x27579a[_0x3e66('0x1b')],_0x2c408b=_0x3f019d['offset'],_0x3657e9=_0x3f019d['offset']+_0x3f019d[_0x3e66('0x1c')],_0xf2263e;if(_0x3657e9>=_0x47428){_0x3657e9=_0x47428;_0xf2263e=0xc8;}else{_0xf2263e=0xce;}_0x232fac['status'](_0xf2263e);return _0x232fac[_0x3e66('0x1d')](_0x3e66('0x1e'),_0x2c408b+'-'+_0x3657e9+'/'+_0x47428)['json'](_0x27579a);}return null;};}function patchUpdates(_0x45b67f){return function(_0x25b1cf){try{jsonpatch['apply'](_0x25b1cf,_0x45b67f,!![]);}catch(_0x247709){return BPromise[_0x3e66('0x1f')](_0x247709);}return _0x25b1cf[_0x3e66('0x20')]();};}function saveUpdates(_0x3f3810,_0x51e738){return function(_0x24c065){if(_0x24c065){return _0x24c065['update'](_0x3f3810)[_0x3e66('0x21')](function(_0x4fdfd7){return _0x4fdfd7;});}return null;};}function removeEntity(_0x1e1d8b,_0x2dc5b7){return function(_0xb4a40d){if(_0xb4a40d){return _0xb4a40d[_0x3e66('0x22')]()[_0x3e66('0x21')](function(){_0x1e1d8b['status'](0xcc)[_0x3e66('0x23')]();});}};}function handleEntityNotFound(_0x47633d,_0x272c68){return function(_0x290194){if(!_0x290194){_0x47633d['sendStatus'](0x194);}return _0x290194;};}function handleError(_0x2b6f70,_0x3f393a){_0x3f393a=_0x3f393a||0x1f4;return function(_0x11a93a){logger[_0x3e66('0x24')](_0x11a93a[_0x3e66('0x25')]);if(_0x11a93a['name']){delete _0x11a93a['name'];}_0x2b6f70[_0x3e66('0x19')](_0x3f393a)[_0x3e66('0x26')](_0x11a93a);};}exports[_0x3e66('0x27')]=function(_0x5afd7e,_0x3050c0){var _0x17faad={},_0x32cb8c={},_0x4c34a9={'count':0x0,'rows':[]};var _0x531ec3=_[_0x3e66('0x28')](db[_0x3e66('0x29')][_0x3e66('0x2a')],function(_0x2ac942){return{'name':_0x2ac942[_0x3e66('0x2b')],'type':_0x2ac942['type'][_0x3e66('0x2c')]};});_0x32cb8c[_0x3e66('0x2d')]=_[_0x3e66('0x28')](_0x531ec3,_0x3e66('0x2e'));_0x32cb8c[_0x3e66('0x2f')]=_['keys'](_0x5afd7e[_0x3e66('0x2f')]);_0x32cb8c[_0x3e66('0x30')]=_[_0x3e66('0x31')](_0x32cb8c[_0x3e66('0x2d')],_0x32cb8c[_0x3e66('0x2f')]);_0x17faad[_0x3e66('0x32')]=_['intersection'](_0x32cb8c['model'],qs[_0x3e66('0x33')](_0x5afd7e[_0x3e66('0x2f')][_0x3e66('0x33')]));_0x17faad['attributes']=_0x17faad[_0x3e66('0x32')][_0x3e66('0x34')]?_0x17faad[_0x3e66('0x32')]:_0x32cb8c[_0x3e66('0x2d')];if(!_0x5afd7e[_0x3e66('0x2f')][_0x3e66('0x35')](_0x3e66('0x36'))){_0x17faad[_0x3e66('0x1c')]=qs['limit'](_0x5afd7e[_0x3e66('0x2f')][_0x3e66('0x1c')]);_0x17faad['offset']=qs[_0x3e66('0x37')](_0x5afd7e['query'][_0x3e66('0x37')]);}_0x17faad[_0x3e66('0x38')]=qs[_0x3e66('0x39')](_0x5afd7e[_0x3e66('0x2f')][_0x3e66('0x39')]);_0x17faad[_0x3e66('0x3a')]=qs['filters'](_['pick'](_0x5afd7e['query'],_0x32cb8c[_0x3e66('0x30')]),_0x531ec3);if(_0x5afd7e[_0x3e66('0x2f')][_0x3e66('0x3b')]){_0x17faad[_0x3e66('0x3a')]=_[_0x3e66('0x3c')](_0x17faad[_0x3e66('0x3a')],{'$or':_['map'](_0x531ec3,function(_0x174965){if(_0x174965['type']!==_0x3e66('0x3d')){var _0x4ef93b={};_0x4ef93b[_0x174965[_0x3e66('0x2e')]]={'$like':'%'+_0x5afd7e[_0x3e66('0x2f')]['filter']+'%'};return _0x4ef93b;}})});}_0x17faad=_[_0x3e66('0x3c')]({},_0x17faad,_0x5afd7e['options']);var _0x3df012={'where':_0x17faad[_0x3e66('0x3a')]};return db[_0x3e66('0x29')][_0x3e66('0x1b')](_0x3df012)[_0x3e66('0x21')](function(_0x475b3e){_0x4c34a9[_0x3e66('0x1b')]=_0x475b3e;if(_0x5afd7e[_0x3e66('0x2f')][_0x3e66('0x3e')]){_0x17faad[_0x3e66('0x3f')]=[{'all':!![]}];}return db[_0x3e66('0x29')][_0x3e66('0x40')](_0x17faad);})[_0x3e66('0x21')](function(_0x204b64){_0x4c34a9[_0x3e66('0x41')]=_0x204b64;return _0x4c34a9;})[_0x3e66('0x21')](respondWithFilteredResult(_0x3050c0,_0x17faad))[_0x3e66('0x42')](handleError(_0x3050c0,null));};exports[_0x3e66('0x43')]=function(_0x10c5dc,_0x4aba23){var _0x200c6e={'raw':!![],'where':{'id':_0x10c5dc[_0x3e66('0x44')]['id']}},_0x14d280={};_0x14d280[_0x3e66('0x2d')]=_['keys'](db[_0x3e66('0x29')]['rawAttributes']);_0x14d280['query']=_[_0x3e66('0x45')](_0x10c5dc[_0x3e66('0x2f')]);_0x14d280[_0x3e66('0x30')]=_[_0x3e66('0x31')](_0x14d280[_0x3e66('0x2d')],_0x14d280['query']);_0x200c6e[_0x3e66('0x32')]=_['intersection'](_0x14d280['model'],qs[_0x3e66('0x33')](_0x10c5dc[_0x3e66('0x2f')][_0x3e66('0x33')]));_0x200c6e[_0x3e66('0x32')]=_0x200c6e[_0x3e66('0x32')][_0x3e66('0x34')]?_0x200c6e[_0x3e66('0x32')]:_0x14d280[_0x3e66('0x2d')];if(_0x10c5dc['query'][_0x3e66('0x3e')]){_0x200c6e[_0x3e66('0x3f')]=[{'all':!![]}];}_0x200c6e=_[_0x3e66('0x3c')]({},_0x200c6e,_0x10c5dc[_0x3e66('0x46')]);return db[_0x3e66('0x29')][_0x3e66('0x47')](_0x200c6e)[_0x3e66('0x21')](handleEntityNotFound(_0x4aba23,null))[_0x3e66('0x21')](respondWithResult(_0x4aba23,null))[_0x3e66('0x42')](handleError(_0x4aba23,null));};exports[_0x3e66('0x48')]=function(_0x3188c2,_0x4f7261){return db[_0x3e66('0x29')][_0x3e66('0x48')](_0x3188c2[_0x3e66('0x49')],{})[_0x3e66('0x21')](respondWithResult(_0x4f7261,0xc9))[_0x3e66('0x42')](handleError(_0x4f7261,null));};exports[_0x3e66('0x4a')]=function(_0x372b56,_0x2fdbe3){if(_0x372b56['body']['id']){delete _0x372b56['body']['id'];}return db[_0x3e66('0x29')][_0x3e66('0x47')]({'where':{'id':_0x372b56['params']['id']}})['then'](handleEntityNotFound(_0x2fdbe3,null))[_0x3e66('0x21')](saveUpdates(_0x372b56['body'],null))['then'](respondWithResult(_0x2fdbe3,null))['catch'](handleError(_0x2fdbe3,null));};exports[_0x3e66('0x22')]=function(_0x50f49e,_0x3f7786){return db['SmsQueueReport']['find']({'where':{'id':_0x50f49e[_0x3e66('0x44')]['id']}})[_0x3e66('0x21')](handleEntityNotFound(_0x3f7786,null))['then'](removeEntity(_0x3f7786,null))[_0x3e66('0x42')](handleError(_0x3f7786,null));};exports[_0x3e66('0x4b')]=function(_0x5bb24c,_0x32f7c2){return db[_0x3e66('0x29')][_0x3e66('0x4b')]()[_0x3e66('0x21')](respondWithResult(_0x32f7c2,null))[_0x3e66('0x42')](handleError(_0x32f7c2,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 162ea59..ae85c3c 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 _0x7085=['request-promise','rimraf','../../config/environment','report_sms_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x53ed44,_0x485721){var _0x2df77c=function(_0x13a970){while(--_0x13a970){_0x53ed44['push'](_0x53ed44['shift']());}};_0x2df77c(++_0x485721);}(_0x7085,0x7e));var _0x5708=function(_0x4e75c5,_0x5eeb93){_0x4e75c5=_0x4e75c5-0x0;var _0x872171=_0x7085[_0x4e75c5];return _0x872171;};'use strict';var _=require(_0x5708('0x0'));var util=require(_0x5708('0x1'));var logger=require(_0x5708('0x2'))(_0x5708('0x3'));var moment=require(_0x5708('0x4'));var BPromise=require(_0x5708('0x5'));var rp=require(_0x5708('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5708('0x7'));var config=require(_0x5708('0x8'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x7d7fbf,_0x245a90){return _0x7d7fbf['define']('SmsQueueReport',attributes,{'tableName':_0x5708('0x9'),'paranoid':![],'indexes':[{'name':_0x5708('0xa'),'fields':[_0x5708('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8039=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x16d895,_0x2be928){var _0x39d786=function(_0x40ff78){while(--_0x40ff78){_0x16d895['push'](_0x16d895['shift']());}};_0x39d786(++_0x2be928);}(_0x8039,0x14a));var _0x9803=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0x8039[_0xbc346f];return _0x9f9260;};'use strict';var _=require(_0x9803('0x0'));var util=require(_0x9803('0x1'));var logger=require(_0x9803('0x2'))(_0x9803('0x3'));var moment=require(_0x9803('0x4'));var BPromise=require(_0x9803('0x5'));var rp=require(_0x9803('0x6'));var fs=require('fs');var path=require(_0x9803('0x7'));var rimraf=require(_0x9803('0x8'));var config=require(_0x9803('0x9'));var attributes=require('./smsQueueReport.attributes');module[_0x9803('0xa')]=function(_0x247903,_0x17d183){return _0x247903[_0x9803('0xb')](_0x9803('0xc'),attributes,{'tableName':_0x9803('0xd'),'paranoid':![],'indexes':[{'name':_0x9803('0xe'),'fields':[_0x9803('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index cdf192d..33d5e0c 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 _0x3450=['debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','stringify','where','attributes','UpdateSmsQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','SmsQueueReport,\x20%s,\x20%s'];(function(_0x50a805,_0x514091){var _0xb33c67=function(_0x3e12e4){while(--_0x3e12e4){_0x50a805['push'](_0x50a805['shift']());}};_0xb33c67(++_0x514091);}(_0x3450,0x6b));var _0x0345=function(_0x37e03a,_0x202315){_0x37e03a=_0x37e03a-0x0;var _0x37216e=_0x3450[_0x37e03a];return _0x37216e;};'use strict';var _=require(_0x0345('0x0'));var util=require(_0x0345('0x1'));var moment=require('moment');var BPromise=require(_0x0345('0x2'));var rs=require(_0x0345('0x3'));var fs=require('fs');var Redis=require(_0x0345('0x4'));var db=require(_0x0345('0x5'))['db'];var utils=require(_0x0345('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0345('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0345('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d8f4a,_0x2f9f54,_0x258ec8){return new BPromise(function(_0x4ef55a,_0x4de02d){return client[_0x0345('0x9')](_0x4d8f4a,_0x258ec8)[_0x0345('0xa')](function(_0x2bad83){logger[_0x0345('0xb')](_0x0345('0xc'),_0x2f9f54,'request\x20sent');logger[_0x0345('0xd')](_0x0345('0xe'),_0x2f9f54,_0x0345('0xf'),JSON['stringify'](_0x2bad83));if(_0x2bad83[_0x0345('0x10')]){if(_0x2bad83[_0x0345('0x10')][_0x0345('0x11')]===0x1f4){logger[_0x0345('0x10')](_0x0345('0xc'),_0x2f9f54,_0x2bad83[_0x0345('0x10')][_0x0345('0x12')]);return _0x4de02d(_0x2bad83[_0x0345('0x10')][_0x0345('0x12')]);}logger[_0x0345('0x10')](_0x0345('0xc'),_0x2f9f54,_0x2bad83[_0x0345('0x10')][_0x0345('0x12')]);return _0x4ef55a(_0x2bad83[_0x0345('0x10')]['message']);}else{logger[_0x0345('0xb')](_0x0345('0xc'),_0x2f9f54,'request\x20sent');_0x4ef55a(_0x2bad83[_0x0345('0x13')]['message']);}})[_0x0345('0x14')](function(_0x3f59ac){logger[_0x0345('0x10')](_0x0345('0xc'),_0x2f9f54,_0x3f59ac);_0x4de02d(_0x3f59ac);});});}exports[_0x0345('0x15')]=function(_0x5df1d0){var _0xbbe975=this;return new Promise(function(_0x10017c,_0x1495b5){return db[_0x0345('0x16')]['create'](_0x5df1d0[_0x0345('0x17')],{'raw':_0x5df1d0[_0x0345('0x18')]?_0x5df1d0[_0x0345('0x18')][_0x0345('0x19')]===undefined?!![]:![]:!![]})[_0x0345('0xa')](function(_0x17bb37){logger[_0x0345('0xb')](_0x0345('0x15'),_0x5df1d0);logger[_0x0345('0xd')](_0x0345('0x15'),_0x5df1d0,JSON[_0x0345('0x1a')](_0x17bb37));_0x10017c(_0x17bb37);})[_0x0345('0x14')](function(_0x5e1096){logger['error'](_0x0345('0x15'),_0x5e1096[_0x0345('0x12')],_0x5df1d0);_0x1495b5(_0xbbe975[_0x0345('0x10')](0x1f4,_0x5e1096[_0x0345('0x12')]));});});};exports['UpdateSmsQueueReport']=function(_0x2acda5){var _0x5040ad=this;return new Promise(function(_0x3cb6dc,_0x2ed538){return db[_0x0345('0x16')]['update'](_0x2acda5[_0x0345('0x17')],{'raw':_0x2acda5[_0x0345('0x18')]?_0x2acda5[_0x0345('0x18')][_0x0345('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2acda5[_0x0345('0x18')]?_0x2acda5[_0x0345('0x18')][_0x0345('0x1b')]||null:null,'attributes':_0x2acda5['options']?_0x2acda5[_0x0345('0x18')][_0x0345('0x1c')]||null:null,'limit':_0x2acda5[_0x0345('0x18')]?_0x2acda5['options']['limit']||null:null})['then'](function(_0x53e978){logger[_0x0345('0xb')](_0x0345('0x1d'),_0x2acda5);logger[_0x0345('0xd')](_0x0345('0x1d'),_0x2acda5,JSON[_0x0345('0x1a')](_0x53e978));_0x3cb6dc(_0x53e978);})[_0x0345('0x14')](function(_0x11db0c){logger[_0x0345('0x10')](_0x0345('0x1d'),_0x11db0c['message'],_0x2acda5);_0x2ed538(_0x5040ad[_0x0345('0x10')](0x1f4,_0x11db0c['message']));});});}; \ No newline at end of file +var _0xd3fa=['lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','debug','update','where','limit','UpdateSmsQueueReport'];(function(_0x55680e,_0xb76d61){var _0x18183a=function(_0x3ea21c){while(--_0x3ea21c){_0x55680e['push'](_0x55680e['shift']());}};_0x18183a(++_0xb76d61);}(_0xd3fa,0x176));var _0xad3f=function(_0x58ed4c,_0x14c986){_0x58ed4c=_0x58ed4c-0x0;var _0x12d61a=_0xd3fa[_0x58ed4c];return _0x12d61a;};'use strict';var _=require(_0xad3f('0x0'));var util=require('util');var moment=require(_0xad3f('0x1'));var BPromise=require(_0xad3f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad3f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xad3f('0x4'));var logger=require(_0xad3f('0x5'))(_0xad3f('0x6'));var config=require(_0xad3f('0x7'));var jayson=require(_0xad3f('0x8'));var client=jayson[_0xad3f('0x9')][_0xad3f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a63e3,_0x104937,_0x455087){return new BPromise(function(_0x3c6003,_0x1b05d1){return client[_0xad3f('0xb')](_0x2a63e3,_0x455087)[_0xad3f('0xc')](function(_0xd7027a){logger[_0xad3f('0xd')](_0xad3f('0xe'),_0x104937,_0xad3f('0xf'));logger['debug'](_0xad3f('0x10'),_0x104937,'request\x20sent',JSON[_0xad3f('0x11')](_0xd7027a));if(_0xd7027a[_0xad3f('0x12')]){if(_0xd7027a[_0xad3f('0x12')][_0xad3f('0x13')]===0x1f4){logger['error'](_0xad3f('0xe'),_0x104937,_0xd7027a['error'][_0xad3f('0x14')]);return _0x1b05d1(_0xd7027a[_0xad3f('0x12')][_0xad3f('0x14')]);}logger[_0xad3f('0x12')](_0xad3f('0xe'),_0x104937,_0xd7027a['error'][_0xad3f('0x14')]);return _0x3c6003(_0xd7027a[_0xad3f('0x12')][_0xad3f('0x14')]);}else{logger[_0xad3f('0xd')](_0xad3f('0xe'),_0x104937,_0xad3f('0xf'));_0x3c6003(_0xd7027a[_0xad3f('0x15')][_0xad3f('0x14')]);}})[_0xad3f('0x16')](function(_0x24a197){logger[_0xad3f('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x104937,_0x24a197);_0x1b05d1(_0x24a197);});});}exports[_0xad3f('0x17')]=function(_0x2b3bf5){var _0x52fb74=this;return new Promise(function(_0xa932f,_0x13ede9){return db[_0xad3f('0x18')][_0xad3f('0x19')](_0x2b3bf5[_0xad3f('0x1a')],{'raw':_0x2b3bf5[_0xad3f('0x1b')]?_0x2b3bf5[_0xad3f('0x1b')][_0xad3f('0x1c')]===undefined?!![]:![]:!![]})[_0xad3f('0xc')](function(_0x1036e4){logger[_0xad3f('0xd')](_0xad3f('0x17'),_0x2b3bf5);logger[_0xad3f('0x1d')](_0xad3f('0x17'),_0x2b3bf5,JSON['stringify'](_0x1036e4));_0xa932f(_0x1036e4);})['catch'](function(_0x2d7fcc){logger[_0xad3f('0x12')](_0xad3f('0x17'),_0x2d7fcc['message'],_0x2b3bf5);_0x13ede9(_0x52fb74['error'](0x1f4,_0x2d7fcc[_0xad3f('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0xedff81){var _0xd62bd1=this;return new Promise(function(_0x85ba1d,_0x391943){return db[_0xad3f('0x18')][_0xad3f('0x1e')](_0xedff81[_0xad3f('0x1a')],{'raw':_0xedff81['options']?_0xedff81['options'][_0xad3f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xedff81[_0xad3f('0x1b')]?_0xedff81[_0xad3f('0x1b')][_0xad3f('0x1f')]||null:null,'attributes':_0xedff81['options']?_0xedff81[_0xad3f('0x1b')]['attributes']||null:null,'limit':_0xedff81['options']?_0xedff81[_0xad3f('0x1b')][_0xad3f('0x20')]||null:null})[_0xad3f('0xc')](function(_0x15f0ca){logger[_0xad3f('0xd')](_0xad3f('0x21'),_0xedff81);logger['debug'](_0xad3f('0x21'),_0xedff81,JSON['stringify'](_0x15f0ca));_0x85ba1d(_0x15f0ca);})[_0xad3f('0x16')](function(_0x47ff72){logger[_0xad3f('0x12')](_0xad3f('0x21'),_0x47ff72[_0xad3f('0x14')],_0xedff81);_0x391943(_0xd62bd1[_0xad3f('0x12')](0x1f4,_0x47ff72[_0xad3f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index c2f89b9..c663ae2 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 _0x4024=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./smsTransferReport.controller','index','get','/describe','describe','isAuthenticated','put','delete','/:id','destroy'];(function(_0x4915f0,_0x574f1e){var _0x1e2a4b=function(_0x4304ff){while(--_0x4304ff){_0x4915f0['push'](_0x4915f0['shift']());}};_0x1e2a4b(++_0x574f1e);}(_0x4024,0x89));var _0x4402=function(_0xce830b,_0x569dbc){_0xce830b=_0xce830b-0x0;var _0x1ec0aa=_0x4024[_0xce830b];return _0x1ec0aa;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var auth=require(_0x4402('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4402('0x5'));var controller=require(_0x4402('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x4402('0x7')]);router[_0x4402('0x8')](_0x4402('0x9'),auth['isAuthenticated'](),controller[_0x4402('0xa')]);router['get']('/:id',auth[_0x4402('0xb')](),controller['show']);router['post']('/',auth[_0x4402('0xb')](),controller['create']);router[_0x4402('0xc')]('/:id',auth[_0x4402('0xb')](),controller['update']);router[_0x4402('0xd')](_0x4402('0xe'),auth['isAuthenticated'](),controller[_0x4402('0xf')]);module[_0x4402('0x10')]=router; \ No newline at end of file +var _0x4213=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post'];(function(_0x409c8b,_0x4892d4){var _0x430500=function(_0x386132){while(--_0x386132){_0x409c8b['push'](_0x409c8b['shift']());}};_0x430500(++_0x4892d4);}(_0x4213,0x77));var _0x3421=function(_0x1946aa,_0x493b74){_0x1946aa=_0x1946aa-0x0;var _0x3c4133=_0x4213[_0x1946aa];return _0x3c4133;};'use strict';var multer=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var path=require(_0x3421('0x2'));var timeout=require(_0x3421('0x3'));var express=require(_0x3421('0x4'));var router=express[_0x3421('0x5')]();var auth=require(_0x3421('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3421('0x7'));var controller=require('./smsTransferReport.controller');router[_0x3421('0x8')]('/',auth[_0x3421('0x9')](),controller[_0x3421('0xa')]);router[_0x3421('0x8')]('/describe',auth[_0x3421('0x9')](),controller[_0x3421('0xb')]);router[_0x3421('0x8')](_0x3421('0xc'),auth[_0x3421('0x9')](),controller['show']);router[_0x3421('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3421('0xe')]('/:id',auth[_0x3421('0x9')](),controller[_0x3421('0xf')]);router[_0x3421('0x10')](_0x3421('0xc'),auth[_0x3421('0x9')](),controller[_0x3421('0x11')]);module[_0x3421('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 3c3c537..342d196 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 _0xaa4e=['NOW','moment','exports','ENUM','queue','DATE'];(function(_0x21869d,_0x48fd44){var _0x3b27bf=function(_0x27b544){while(--_0x27b544){_0x21869d['push'](_0x21869d['shift']());}};_0x3b27bf(++_0x48fd44);}(_0xaa4e,0xdf));var _0xeaa4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xaa4e[_0x3bf83f];return _0x22c4a9;};'use strict';var moment=require(_0xeaa4('0x0'));var Sequelize=require('sequelize');module[_0xeaa4('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xeaa4('0x2')]('account','agent',_0xeaa4('0x3')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xeaa4('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xeaa4('0x5')]}}; \ No newline at end of file +var _0x349a=['NOW','moment','sequelize','STRING','ENUM','account','agent','queue','DATE'];(function(_0x9e3162,_0x4bca71){var _0x46f9f7=function(_0x5047f4){while(--_0x5047f4){_0x9e3162['push'](_0x9e3162['shift']());}};_0x46f9f7(++_0x4bca71);}(_0x349a,0x64));var _0xa349=function(_0x3f6426,_0x12cbf9){_0x3f6426=_0x3f6426-0x0;var _0x25d790=_0x349a[_0x3f6426];return _0x25d790;};'use strict';var moment=require(_0xa349('0x0'));var Sequelize=require(_0xa349('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xa349('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x4'),_0xa349('0x5'),_0xa349('0x6')),'allowNull':![],'defaultValue':_0xa349('0x6')},'transferredAt':{'type':Sequelize[_0xa349('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xa349('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 105f7e1..84ff156 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 _0xe13a=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SmsTransferReport','include','findAll','rows','catch','show','includeAll','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4b0753,_0x50877e){var _0x4ac745=function(_0x57d411){while(--_0x57d411){_0x4b0753['push'](_0x4b0753['shift']());}};_0x4ac745(++_0x50877e);}(_0xe13a,0x178));var _0xae13=function(_0x3dc3f6,_0x17f58b){_0x3dc3f6=_0x3dc3f6-0x0;var _0x910be9=_0xe13a[_0x3dc3f6];return _0x910be9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xae13('0x0'));var rimraf=require(_0xae13('0x1'));var zipdir=require(_0xae13('0x2'));var jsonpatch=require(_0xae13('0x3'));var rp=require('request-promise');var moment=require(_0xae13('0x4'));var BPromise=require(_0xae13('0x5'));var Mustache=require(_0xae13('0x6'));var util=require(_0xae13('0x7'));var path=require(_0xae13('0x8'));var sox=require(_0xae13('0x9'));var csv=require(_0xae13('0xa'));var ejs=require(_0xae13('0xb'));var fs=require('fs');var _=require(_0xae13('0xc'));var squel=require('squel');var crypto=require(_0xae13('0xd'));var jsforce=require(_0xae13('0xe'));var deskjs=require(_0xae13('0xf'));var toCsv=require(_0xae13('0xa'));var querystring=require(_0xae13('0x10'));var Papa=require(_0xae13('0x11'));var Redis=require(_0xae13('0x12'));var authService=require(_0xae13('0x13'));var qs=require(_0xae13('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae13('0x15'));var logger=require(_0xae13('0x16'))(_0xae13('0x17'));var utils=require(_0xae13('0x18'));var config=require(_0xae13('0x19'));var licenseUtil=require(_0xae13('0x1a'));var db=require(_0xae13('0x1b'))['db'];function respondWithStatusCode(_0x4dd599,_0x42d869){_0x42d869=_0x42d869||0xcc;return function(_0x159632){if(_0x159632){return _0x4dd599['sendStatus'](_0x42d869);}return _0x4dd599['status'](_0x42d869)['end']();};}function respondWithResult(_0x50f7c4,_0x52484b){_0x52484b=_0x52484b||0xc8;return function(_0x26ff3e){if(_0x26ff3e){return _0x50f7c4[_0xae13('0x1c')](_0x52484b)[_0xae13('0x1d')](_0x26ff3e);}};}function respondWithFilteredResult(_0x90cdc1,_0x537889){return function(_0x2912a2){if(_0x2912a2){var _0x5c25a4=_0x2912a2[_0xae13('0x1e')],_0x3c488f=_0x537889[_0xae13('0x1f')],_0x5e46bc=_0x537889[_0xae13('0x1f')]+_0x537889[_0xae13('0x20')],_0xe10aab;if(_0x5e46bc>=_0x5c25a4){_0x5e46bc=_0x5c25a4;_0xe10aab=0xc8;}else{_0xe10aab=0xce;}_0x90cdc1[_0xae13('0x1c')](_0xe10aab);return _0x90cdc1[_0xae13('0x21')](_0xae13('0x22'),_0x3c488f+'-'+_0x5e46bc+'/'+_0x5c25a4)[_0xae13('0x1d')](_0x2912a2);}return null;};}function patchUpdates(_0x544937){return function(_0x4462a5){try{jsonpatch['apply'](_0x4462a5,_0x544937,!![]);}catch(_0x17a8c6){return BPromise[_0xae13('0x23')](_0x17a8c6);}return _0x4462a5['save']();};}function saveUpdates(_0x25a195,_0x39d41c){return function(_0x3e4bc8){if(_0x3e4bc8){return _0x3e4bc8[_0xae13('0x24')](_0x25a195)[_0xae13('0x25')](function(_0x2fd0e9){return _0x2fd0e9;});}return null;};}function removeEntity(_0x54b3b4,_0x520692){return function(_0x149eda){if(_0x149eda){return _0x149eda[_0xae13('0x26')]()['then'](function(){_0x54b3b4[_0xae13('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13c2de,_0x194437){return function(_0x3f12b0){if(!_0x3f12b0){_0x13c2de['sendStatus'](0x194);}return _0x3f12b0;};}function handleError(_0x57124a,_0x4e38c3){_0x4e38c3=_0x4e38c3||0x1f4;return function(_0x4edb8c){logger[_0xae13('0x27')](_0x4edb8c[_0xae13('0x28')]);if(_0x4edb8c['name']){delete _0x4edb8c[_0xae13('0x29')];}_0x57124a['status'](_0x4e38c3)[_0xae13('0x2a')](_0x4edb8c);};}exports['index']=function(_0xbeda8d,_0x3117c2){var _0x526e4e={},_0xa98d6c={},_0x370ee0={'count':0x0,'rows':[]};var _0x64b40b=_[_0xae13('0x2b')](db['SmsTransferReport'][_0xae13('0x2c')],function(_0x27b737){return{'name':_0x27b737[_0xae13('0x2d')],'type':_0x27b737[_0xae13('0x2e')][_0xae13('0x2f')]};});_0xa98d6c[_0xae13('0x30')]=_[_0xae13('0x2b')](_0x64b40b,'name');_0xa98d6c[_0xae13('0x31')]=_['keys'](_0xbeda8d[_0xae13('0x31')]);_0xa98d6c[_0xae13('0x32')]=_[_0xae13('0x33')](_0xa98d6c[_0xae13('0x30')],_0xa98d6c[_0xae13('0x31')]);_0x526e4e[_0xae13('0x34')]=_[_0xae13('0x33')](_0xa98d6c['model'],qs['fields'](_0xbeda8d[_0xae13('0x31')][_0xae13('0x35')]));_0x526e4e[_0xae13('0x34')]=_0x526e4e[_0xae13('0x34')][_0xae13('0x36')]?_0x526e4e[_0xae13('0x34')]:_0xa98d6c[_0xae13('0x30')];if(!_0xbeda8d[_0xae13('0x31')][_0xae13('0x37')](_0xae13('0x38'))){_0x526e4e['limit']=qs[_0xae13('0x20')](_0xbeda8d[_0xae13('0x31')][_0xae13('0x20')]);_0x526e4e['offset']=qs['offset'](_0xbeda8d['query']['offset']);}_0x526e4e['order']=qs['sort'](_0xbeda8d[_0xae13('0x31')][_0xae13('0x39')]);_0x526e4e[_0xae13('0x3a')]=qs['filters'](_[_0xae13('0x3b')](_0xbeda8d[_0xae13('0x31')],_0xa98d6c[_0xae13('0x32')]),_0x64b40b);if(_0xbeda8d[_0xae13('0x31')][_0xae13('0x3c')]){_0x526e4e['where']=_[_0xae13('0x3d')](_0x526e4e[_0xae13('0x3a')],{'$or':_[_0xae13('0x2b')](_0x64b40b,function(_0x535b0b){if(_0x535b0b['type']!==_0xae13('0x3e')){var _0xd7006d={};_0xd7006d[_0x535b0b[_0xae13('0x29')]]={'$like':'%'+_0xbeda8d[_0xae13('0x31')]['filter']+'%'};return _0xd7006d;}})});}_0x526e4e=_[_0xae13('0x3d')]({},_0x526e4e,_0xbeda8d[_0xae13('0x3f')]);var _0x538283={'where':_0x526e4e[_0xae13('0x3a')]};return db[_0xae13('0x40')]['count'](_0x538283)[_0xae13('0x25')](function(_0xfbe515){_0x370ee0[_0xae13('0x1e')]=_0xfbe515;if(_0xbeda8d[_0xae13('0x31')]['includeAll']){_0x526e4e[_0xae13('0x41')]=[{'all':!![]}];}return db[_0xae13('0x40')][_0xae13('0x42')](_0x526e4e);})[_0xae13('0x25')](function(_0x4ed070){_0x370ee0[_0xae13('0x43')]=_0x4ed070;return _0x370ee0;})[_0xae13('0x25')](respondWithFilteredResult(_0x3117c2,_0x526e4e))[_0xae13('0x44')](handleError(_0x3117c2,null));};exports[_0xae13('0x45')]=function(_0x4c8b8d,_0x49428a){var _0x34bf8b={'raw':!![],'where':{'id':_0x4c8b8d['params']['id']}},_0xde6962={};_0xde6962[_0xae13('0x30')]=_['keys'](db[_0xae13('0x40')][_0xae13('0x2c')]);_0xde6962[_0xae13('0x31')]=_['keys'](_0x4c8b8d[_0xae13('0x31')]);_0xde6962[_0xae13('0x32')]=_[_0xae13('0x33')](_0xde6962[_0xae13('0x30')],_0xde6962['query']);_0x34bf8b[_0xae13('0x34')]=_[_0xae13('0x33')](_0xde6962[_0xae13('0x30')],qs[_0xae13('0x35')](_0x4c8b8d[_0xae13('0x31')][_0xae13('0x35')]));_0x34bf8b[_0xae13('0x34')]=_0x34bf8b[_0xae13('0x34')]['length']?_0x34bf8b[_0xae13('0x34')]:_0xde6962['model'];if(_0x4c8b8d[_0xae13('0x31')][_0xae13('0x46')]){_0x34bf8b[_0xae13('0x41')]=[{'all':!![]}];}_0x34bf8b=_[_0xae13('0x3d')]({},_0x34bf8b,_0x4c8b8d['options']);return db[_0xae13('0x40')]['find'](_0x34bf8b)[_0xae13('0x25')](handleEntityNotFound(_0x49428a,null))[_0xae13('0x25')](respondWithResult(_0x49428a,null))['catch'](handleError(_0x49428a,null));};exports[_0xae13('0x47')]=function(_0xde904a,_0x352ea5){return db[_0xae13('0x40')][_0xae13('0x47')](_0xde904a[_0xae13('0x48')],{})['then'](respondWithResult(_0x352ea5,0xc9))[_0xae13('0x44')](handleError(_0x352ea5,null));};exports[_0xae13('0x24')]=function(_0xd15aa7,_0x3dbfb7){if(_0xd15aa7[_0xae13('0x48')]['id']){delete _0xd15aa7['body']['id'];}return db[_0xae13('0x40')][_0xae13('0x49')]({'where':{'id':_0xd15aa7[_0xae13('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3dbfb7,null))['then'](saveUpdates(_0xd15aa7['body'],null))['then'](respondWithResult(_0x3dbfb7,null))[_0xae13('0x44')](handleError(_0x3dbfb7,null));};exports['destroy']=function(_0x2db53a,_0x5554a6){return db[_0xae13('0x40')][_0xae13('0x49')]({'where':{'id':_0x2db53a[_0xae13('0x4a')]['id']}})[_0xae13('0x25')](handleEntityNotFound(_0x5554a6,null))[_0xae13('0x25')](removeEntity(_0x5554a6,null))['catch'](handleError(_0x5554a6,null));};exports[_0xae13('0x4b')]=function(_0x2560f1,_0x5eb0ec){return db[_0xae13('0x40')][_0xae13('0x4b')]()['then'](respondWithResult(_0x5eb0ec,null))['catch'](handleError(_0x5eb0ec,null));}; \ No newline at end of file +var _0xf194=['find','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','save','then','destroy','end','error','stack','name','index','SmsTransferReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','options','create','body'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xf194,0x91));var _0x4f19=function(_0x22d98e,_0x27bea7){_0x22d98e=_0x22d98e-0x0;var _0x15fa84=_0xf194[_0x22d98e];return _0x15fa84;};'use strict';var pdf=require(_0x4f19('0x0'));var emlformat=require(_0x4f19('0x1'));var rimraf=require(_0x4f19('0x2'));var zipdir=require(_0x4f19('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f19('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4f19('0x5'));var path=require(_0x4f19('0x6'));var sox=require(_0x4f19('0x7'));var csv=require('to-csv');var ejs=require(_0x4f19('0x8'));var fs=require('fs');var _=require(_0x4f19('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f19('0xa'));var deskjs=require(_0x4f19('0xb'));var toCsv=require(_0x4f19('0xc'));var querystring=require(_0x4f19('0xd'));var Papa=require('papaparse');var Redis=require(_0x4f19('0xe'));var authService=require(_0x4f19('0xf'));var qs=require(_0x4f19('0x10'));var as=require(_0x4f19('0x11'));var hardwareService=require(_0x4f19('0x12'));var logger=require(_0x4f19('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4f19('0x14'));var db=require(_0x4f19('0x15'))['db'];function respondWithStatusCode(_0x5f4f1d,_0x6280a0){_0x6280a0=_0x6280a0||0xcc;return function(_0x26348c){if(_0x26348c){return _0x5f4f1d[_0x4f19('0x16')](_0x6280a0);}return _0x5f4f1d[_0x4f19('0x17')](_0x6280a0)['end']();};}function respondWithResult(_0x144e21,_0x25e5ce){_0x25e5ce=_0x25e5ce||0xc8;return function(_0x4b7198){if(_0x4b7198){return _0x144e21[_0x4f19('0x17')](_0x25e5ce)[_0x4f19('0x18')](_0x4b7198);}};}function respondWithFilteredResult(_0x5b77b1,_0x298562){return function(_0x55e1f8){if(_0x55e1f8){var _0x33bded=_0x55e1f8[_0x4f19('0x19')],_0x16405f=_0x298562[_0x4f19('0x1a')],_0x4b9c07=_0x298562[_0x4f19('0x1a')]+_0x298562['limit'],_0x4d8021;if(_0x4b9c07>=_0x33bded){_0x4b9c07=_0x33bded;_0x4d8021=0xc8;}else{_0x4d8021=0xce;}_0x5b77b1[_0x4f19('0x17')](_0x4d8021);return _0x5b77b1[_0x4f19('0x1b')](_0x4f19('0x1c'),_0x16405f+'-'+_0x4b9c07+'/'+_0x33bded)[_0x4f19('0x18')](_0x55e1f8);}return null;};}function patchUpdates(_0x4377b4){return function(_0x5915a2){try{jsonpatch[_0x4f19('0x1d')](_0x5915a2,_0x4377b4,!![]);}catch(_0xf4de7b){return BPromise['reject'](_0xf4de7b);}return _0x5915a2[_0x4f19('0x1e')]();};}function saveUpdates(_0x14ff93,_0x3312f8){return function(_0x327605){if(_0x327605){return _0x327605['update'](_0x14ff93)[_0x4f19('0x1f')](function(_0x142755){return _0x142755;});}return null;};}function removeEntity(_0x13cdcb,_0xcbe002){return function(_0x11a272){if(_0x11a272){return _0x11a272[_0x4f19('0x20')]()[_0x4f19('0x1f')](function(){_0x13cdcb[_0x4f19('0x17')](0xcc)[_0x4f19('0x21')]();});}};}function handleEntityNotFound(_0x10e164,_0x4531f4){return function(_0x2e2bf5){if(!_0x2e2bf5){_0x10e164[_0x4f19('0x16')](0x194);}return _0x2e2bf5;};}function handleError(_0x3457a4,_0x202965){_0x202965=_0x202965||0x1f4;return function(_0x39cb12){logger[_0x4f19('0x22')](_0x39cb12[_0x4f19('0x23')]);if(_0x39cb12[_0x4f19('0x24')]){delete _0x39cb12['name'];}_0x3457a4[_0x4f19('0x17')](_0x202965)['send'](_0x39cb12);};}exports[_0x4f19('0x25')]=function(_0x515956,_0x759454){var _0x5321a8={},_0x3aac82={},_0x22f4ad={'count':0x0,'rows':[]};var _0xc37e6f=_['map'](db[_0x4f19('0x26')][_0x4f19('0x27')],function(_0x2175ff){return{'name':_0x2175ff[_0x4f19('0x28')],'type':_0x2175ff[_0x4f19('0x29')]['key']};});_0x3aac82[_0x4f19('0x2a')]=_[_0x4f19('0x2b')](_0xc37e6f,'name');_0x3aac82[_0x4f19('0x2c')]=_[_0x4f19('0x2d')](_0x515956[_0x4f19('0x2c')]);_0x3aac82[_0x4f19('0x2e')]=_[_0x4f19('0x2f')](_0x3aac82[_0x4f19('0x2a')],_0x3aac82['query']);_0x5321a8[_0x4f19('0x30')]=_[_0x4f19('0x2f')](_0x3aac82[_0x4f19('0x2a')],qs['fields'](_0x515956[_0x4f19('0x2c')][_0x4f19('0x31')]));_0x5321a8[_0x4f19('0x30')]=_0x5321a8[_0x4f19('0x30')][_0x4f19('0x32')]?_0x5321a8[_0x4f19('0x30')]:_0x3aac82['model'];if(!_0x515956[_0x4f19('0x2c')][_0x4f19('0x33')]('nolimit')){_0x5321a8[_0x4f19('0x34')]=qs[_0x4f19('0x34')](_0x515956[_0x4f19('0x2c')][_0x4f19('0x34')]);_0x5321a8[_0x4f19('0x1a')]=qs[_0x4f19('0x1a')](_0x515956[_0x4f19('0x2c')]['offset']);}_0x5321a8[_0x4f19('0x35')]=qs[_0x4f19('0x36')](_0x515956[_0x4f19('0x2c')][_0x4f19('0x36')]);_0x5321a8[_0x4f19('0x37')]=qs[_0x4f19('0x2e')](_[_0x4f19('0x38')](_0x515956[_0x4f19('0x2c')],_0x3aac82[_0x4f19('0x2e')]),_0xc37e6f);if(_0x515956['query'][_0x4f19('0x39')]){_0x5321a8[_0x4f19('0x37')]=_[_0x4f19('0x3a')](_0x5321a8[_0x4f19('0x37')],{'$or':_[_0x4f19('0x2b')](_0xc37e6f,function(_0x5242cf){if(_0x5242cf['type']!==_0x4f19('0x3b')){var _0x216973={};_0x216973[_0x5242cf['name']]={'$like':'%'+_0x515956['query'][_0x4f19('0x39')]+'%'};return _0x216973;}})});}_0x5321a8=_[_0x4f19('0x3a')]({},_0x5321a8,_0x515956['options']);var _0x51e694={'where':_0x5321a8[_0x4f19('0x37')]};return db['SmsTransferReport'][_0x4f19('0x19')](_0x51e694)[_0x4f19('0x1f')](function(_0x23a565){_0x22f4ad[_0x4f19('0x19')]=_0x23a565;if(_0x515956[_0x4f19('0x2c')][_0x4f19('0x3c')]){_0x5321a8[_0x4f19('0x3d')]=[{'all':!![]}];}return db[_0x4f19('0x26')][_0x4f19('0x3e')](_0x5321a8);})['then'](function(_0x3c930a){_0x22f4ad['rows']=_0x3c930a;return _0x22f4ad;})[_0x4f19('0x1f')](respondWithFilteredResult(_0x759454,_0x5321a8))[_0x4f19('0x3f')](handleError(_0x759454,null));};exports[_0x4f19('0x40')]=function(_0x1c29a0,_0x26b18e){var _0x1690b0={'raw':!![],'where':{'id':_0x1c29a0['params']['id']}},_0x494362={};_0x494362[_0x4f19('0x2a')]=_[_0x4f19('0x2d')](db[_0x4f19('0x26')]['rawAttributes']);_0x494362[_0x4f19('0x2c')]=_[_0x4f19('0x2d')](_0x1c29a0[_0x4f19('0x2c')]);_0x494362['filters']=_[_0x4f19('0x2f')](_0x494362[_0x4f19('0x2a')],_0x494362[_0x4f19('0x2c')]);_0x1690b0['attributes']=_['intersection'](_0x494362[_0x4f19('0x2a')],qs[_0x4f19('0x31')](_0x1c29a0[_0x4f19('0x2c')]['fields']));_0x1690b0['attributes']=_0x1690b0[_0x4f19('0x30')][_0x4f19('0x32')]?_0x1690b0[_0x4f19('0x30')]:_0x494362[_0x4f19('0x2a')];if(_0x1c29a0[_0x4f19('0x2c')][_0x4f19('0x3c')]){_0x1690b0[_0x4f19('0x3d')]=[{'all':!![]}];}_0x1690b0=_[_0x4f19('0x3a')]({},_0x1690b0,_0x1c29a0[_0x4f19('0x41')]);return db[_0x4f19('0x26')]['find'](_0x1690b0)[_0x4f19('0x1f')](handleEntityNotFound(_0x26b18e,null))[_0x4f19('0x1f')](respondWithResult(_0x26b18e,null))[_0x4f19('0x3f')](handleError(_0x26b18e,null));};exports[_0x4f19('0x42')]=function(_0x1dec3c,_0x46ec9d){return db[_0x4f19('0x26')][_0x4f19('0x42')](_0x1dec3c[_0x4f19('0x43')],{})[_0x4f19('0x1f')](respondWithResult(_0x46ec9d,0xc9))[_0x4f19('0x3f')](handleError(_0x46ec9d,null));};exports['update']=function(_0x40a5b1,_0x48b026){if(_0x40a5b1['body']['id']){delete _0x40a5b1[_0x4f19('0x43')]['id'];}return db[_0x4f19('0x26')][_0x4f19('0x44')]({'where':{'id':_0x40a5b1[_0x4f19('0x45')]['id']}})['then'](handleEntityNotFound(_0x48b026,null))['then'](saveUpdates(_0x40a5b1['body'],null))['then'](respondWithResult(_0x48b026,null))['catch'](handleError(_0x48b026,null));};exports['destroy']=function(_0x5b72ad,_0x1f94f7){return db[_0x4f19('0x26')][_0x4f19('0x44')]({'where':{'id':_0x5b72ad[_0x4f19('0x45')]['id']}})[_0x4f19('0x1f')](handleEntityNotFound(_0x1f94f7,null))[_0x4f19('0x1f')](removeEntity(_0x1f94f7,null))['catch'](handleError(_0x1f94f7,null));};exports[_0x4f19('0x46')]=function(_0x20c979,_0xd4d63e){return db[_0x4f19('0x26')]['describe']()['then'](respondWithResult(_0xd4d63e,null))[_0x4f19('0x3f')](handleError(_0xd4d63e,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 35dc15e..cb371f4 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 _0x0f4d=['define','SmsTransferReport','uniqueid','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x428728,_0x5c0891){var _0x849eb9=function(_0x426b56){while(--_0x426b56){_0x428728['push'](_0x428728['shift']());}};_0x849eb9(++_0x5c0891);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x3b3e1f,_0x512b59){_0x3b3e1f=_0x3b3e1f-0x0;var _0x5b212d=_0x0f4d[_0x3b3e1f];return _0x5b212d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd0f4('0x0'));var moment=require('moment');var BPromise=require(_0xd0f4('0x1'));var rp=require(_0xd0f4('0x2'));var fs=require('fs');var path=require(_0xd0f4('0x3'));var rimraf=require(_0xd0f4('0x4'));var config=require(_0xd0f4('0x5'));var attributes=require(_0xd0f4('0x6'));module[_0xd0f4('0x7')]=function(_0x1d9a9d,_0x531f85){return _0x1d9a9d[_0xd0f4('0x8')](_0xd0f4('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xd0f4('0xa'),'fields':[_0xd0f4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6a55=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','moment','path','../../config/environment','exports','define'];(function(_0x2e2720,_0x1ae995){var _0x3f9d2d=function(_0x5067a2){while(--_0x5067a2){_0x2e2720['push'](_0x2e2720['shift']());}};_0x3f9d2d(++_0x1ae995);}(_0x6a55,0xdb));var _0x56a5=function(_0x5c846d,_0x5c02ce){_0x5c846d=_0x5c846d-0x0;var _0xd064e4=_0x6a55[_0x5c846d];return _0xd064e4;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x56a5('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x56a5('0x2'));var rimraf=require('rimraf');var config=require(_0x56a5('0x3'));var attributes=require('./smsTransferReport.attributes');module[_0x56a5('0x4')]=function(_0x380b1b,_0x42d164){return _0x380b1b[_0x56a5('0x5')](_0x56a5('0x6'),attributes,{'tableName':_0x56a5('0x7'),'paranoid':![],'indexes':[{'name':_0x56a5('0x8'),'fields':[_0x56a5('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index d374046..d7b01e0 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 _0x65b3=['catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','SmsTransferReport,\x20%s,\x20%s','message'];(function(_0x2c2cc0,_0xc5c014){var _0x45b2b1=function(_0x5b6522){while(--_0x5b6522){_0x2c2cc0['push'](_0x2c2cc0['shift']());}};_0x45b2b1(++_0xc5c014);}(_0x65b3,0x17d));var _0x365b=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0x65b3[_0x3f3f40];return _0x403b7a;};'use strict';var _=require('lodash');var util=require(_0x365b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x365b('0x1'));var fs=require('fs');var Redis=require(_0x365b('0x2'));var db=require(_0x365b('0x3'))['db'];var utils=require(_0x365b('0x4'));var logger=require(_0x365b('0x5'))(_0x365b('0x6'));var config=require('../../config/environment');var jayson=require(_0x365b('0x7'));var client=jayson[_0x365b('0x8')][_0x365b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x421268,_0x146e86,_0x387316){return new BPromise(function(_0x10c528,_0x1fa5a1){return client[_0x365b('0xa')](_0x421268,_0x387316)[_0x365b('0xb')](function(_0x2e270d){logger[_0x365b('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x146e86,_0x365b('0xd'));logger[_0x365b('0xe')](_0x365b('0xf'),_0x146e86,_0x365b('0xd'),JSON['stringify'](_0x2e270d));if(_0x2e270d[_0x365b('0x10')]){if(_0x2e270d[_0x365b('0x10')]['code']===0x1f4){logger[_0x365b('0x10')](_0x365b('0x11'),_0x146e86,_0x2e270d[_0x365b('0x10')][_0x365b('0x12')]);return _0x1fa5a1(_0x2e270d[_0x365b('0x10')][_0x365b('0x12')]);}logger[_0x365b('0x10')](_0x365b('0x11'),_0x146e86,_0x2e270d[_0x365b('0x10')][_0x365b('0x12')]);return _0x10c528(_0x2e270d['error'][_0x365b('0x12')]);}else{logger[_0x365b('0xc')](_0x365b('0x11'),_0x146e86,_0x365b('0xd'));_0x10c528(_0x2e270d['result'][_0x365b('0x12')]);}})[_0x365b('0x13')](function(_0x53c500){logger['error'](_0x365b('0x11'),_0x146e86,_0x53c500);_0x1fa5a1(_0x53c500);});});} \ No newline at end of file +var _0x8582=['info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then'];(function(_0x27a06c,_0x3cb334){var _0x3ffa58=function(_0x1a10cb){while(--_0x1a10cb){_0x27a06c['push'](_0x27a06c['shift']());}};_0x3ffa58(++_0x3cb334);}(_0x8582,0x105));var _0x2858=function(_0xf829f6,_0x58a0c1){_0xf829f6=_0xf829f6-0x0;var _0x221de7=_0x8582[_0xf829f6];return _0x221de7;};'use strict';var _=require(_0x2858('0x0'));var util=require(_0x2858('0x1'));var moment=require(_0x2858('0x2'));var BPromise=require(_0x2858('0x3'));var rs=require(_0x2858('0x4'));var fs=require('fs');var Redis=require(_0x2858('0x5'));var db=require(_0x2858('0x6'))['db'];var utils=require(_0x2858('0x7'));var logger=require(_0x2858('0x8'))(_0x2858('0x9'));var config=require(_0x2858('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x526a85,_0x862396,_0xf006e7){return new BPromise(function(_0x492683,_0x1182e6){return client['request'](_0x526a85,_0xf006e7)[_0x2858('0xb')](function(_0x5cfc9a){logger[_0x2858('0xc')](_0x2858('0xd'),_0x862396,_0x2858('0xe'));logger['debug'](_0x2858('0xf'),_0x862396,_0x2858('0xe'),JSON[_0x2858('0x10')](_0x5cfc9a));if(_0x5cfc9a['error']){if(_0x5cfc9a['error'][_0x2858('0x11')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x862396,_0x5cfc9a['error'][_0x2858('0x12')]);return _0x1182e6(_0x5cfc9a[_0x2858('0x13')]['message']);}logger[_0x2858('0x13')](_0x2858('0xd'),_0x862396,_0x5cfc9a[_0x2858('0x13')]['message']);return _0x492683(_0x5cfc9a['error'][_0x2858('0x12')]);}else{logger[_0x2858('0xc')](_0x2858('0xd'),_0x862396,_0x2858('0xe'));_0x492683(_0x5cfc9a[_0x2858('0x14')][_0x2858('0x12')]);}})['catch'](function(_0x69eb52){logger[_0x2858('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x862396,_0x69eb52);_0x1182e6(_0x69eb52);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index a16d7a0..43acfca 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 _0x6ac7=['get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','originalname','replace','%s-%s%s','basename','extname','now','post','single','file','create','put','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./sound.controller'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6ac7,0x1d8));var _0x76ac=function(_0x1f50a7,_0x4b7031){_0x1f50a7=_0x1f50a7-0x0;var _0x498e3e=_0x6ac7[_0x1f50a7];return _0x498e3e;};'use strict';var multer=require(_0x76ac('0x0'));var util=require(_0x76ac('0x1'));var path=require(_0x76ac('0x2'));var timeout=require(_0x76ac('0x3'));var express=require('express');var router=express[_0x76ac('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x76ac('0x5'));var config=require(_0x76ac('0x6'));var controller=require(_0x76ac('0x7'));router[_0x76ac('0x8')]('/',auth[_0x76ac('0x9')](),controller[_0x76ac('0xa')]);router[_0x76ac('0x8')](_0x76ac('0xb'),auth[_0x76ac('0x9')](),controller[_0x76ac('0xc')]);router[_0x76ac('0x8')](_0x76ac('0xd'),auth['isAuthenticated'](),controller[_0x76ac('0xe')]);var upload=multer({'storage':multer[_0x76ac('0xf')]({'destination':function(_0x298f31,_0x4c78cf,_0x2411b9){_0x2411b9(null,path[_0x76ac('0x10')](config[_0x76ac('0x11')],'server/files/sounds/original/'));},'filename':function(_0x3ab4fd,_0x370152,_0x145a3a){_0x370152[_0x76ac('0x12')]=_0x370152[_0x76ac('0x12')][_0x76ac('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x145a3a(null,util['format'](_0x76ac('0x14'),path[_0x76ac('0x15')](_0x370152['originalname'],path[_0x76ac('0x16')](_0x370152[_0x76ac('0x12')])),Date[_0x76ac('0x17')](),path['extname'](_0x370152['originalname'])));}})});router[_0x76ac('0x18')]('/',upload[_0x76ac('0x19')](_0x76ac('0x1a')),controller[_0x76ac('0x1b')]);router[_0x76ac('0x1c')](_0x76ac('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x76ac('0x9')](),controller['delete']);module[_0x76ac('0x1d')]=router; \ No newline at end of file +var _0x0593=['/:id/download','download','diskStorage','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','now','extname','post','single','file','create','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x12111d,_0x30d9b4){var _0x14b510=function(_0x54dd27){while(--_0x54dd27){_0x12111d['push'](_0x12111d['shift']());}};_0x14b510(++_0x30d9b4);}(_0x0593,0x150));var _0x3059=function(_0x27796c,_0x13817c){_0x27796c=_0x27796c-0x0;var _0x1b67f6=_0x0593[_0x27796c];return _0x1b67f6;};'use strict';var multer=require(_0x3059('0x0'));var util=require(_0x3059('0x1'));var path=require(_0x3059('0x2'));var timeout=require(_0x3059('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x3059('0x4'));var interaction=require(_0x3059('0x5'));var config=require(_0x3059('0x6'));var controller=require('./sound.controller');router[_0x3059('0x7')]('/',auth[_0x3059('0x8')](),controller[_0x3059('0x9')]);router[_0x3059('0x7')](_0x3059('0xa'),auth['isAuthenticated'](),controller[_0x3059('0xb')]);router[_0x3059('0x7')](_0x3059('0xc'),auth[_0x3059('0x8')](),controller[_0x3059('0xd')]);var upload=multer({'storage':multer[_0x3059('0xe')]({'destination':function(_0x30e253,_0x15f1e8,_0x4ae8c1){_0x4ae8c1(null,path['join'](config['root'],_0x3059('0xf')));},'filename':function(_0x266ccf,_0x4f9c4,_0x159496){_0x4f9c4['originalname']=_0x4f9c4[_0x3059('0x10')][_0x3059('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x159496(null,util[_0x3059('0x12')](_0x3059('0x13'),path[_0x3059('0x14')](_0x4f9c4[_0x3059('0x10')],path['extname'](_0x4f9c4[_0x3059('0x10')])),Date[_0x3059('0x15')](),path[_0x3059('0x16')](_0x4f9c4[_0x3059('0x10')])));}})});router[_0x3059('0x17')]('/',upload[_0x3059('0x18')](_0x3059('0x19')),controller[_0x3059('0x1a')]);router['put'](_0x3059('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x3059('0x1b')]('/:id',auth[_0x3059('0x8')](),controller['delete']);module[_0x3059('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index dea187f..774baba 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 _0xc70f=['FLOAT','INTEGER','BIGINT','sequelize','exports','STRING'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0xc70f,0x165));var _0xfc70=function(_0x3be356,_0x376dfb){_0x3be356=_0x3be356-0x0;var _0x308617=_0xc70f[_0x3be356];return _0x308617;};'use strict';var Sequelize=require(_0xfc70('0x0'));module[_0xfc70('0x1')]={'name':{'type':Sequelize[_0xfc70('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xfc70('0x2')]},'display_name':{'type':Sequelize[_0xfc70('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xfc70('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xfc70('0x4')]},'original_bitRate':{'type':Sequelize[_0xfc70('0x5')]},'original_sampleRate':{'type':Sequelize[_0xfc70('0x4')]},'converted_format':{'type':Sequelize[_0xfc70('0x2')]},'converted_duration':{'type':Sequelize[_0xfc70('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xfc70('0x5')]},'converted_channelCount':{'type':Sequelize[_0xfc70('0x4')]},'converted_bitRate':{'type':Sequelize[_0xfc70('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xfc70('0x4')]}}; \ No newline at end of file +var _0x85f5=['STRING','name','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x23ad48,_0x104b01){var _0x199a20=function(_0x4805d0){while(--_0x4805d0){_0x23ad48['push'](_0x23ad48['shift']());}};_0x199a20(++_0x104b01);}(_0x85f5,0x167));var _0x585f=function(_0x39010b,_0x17e844){_0x39010b=_0x39010b-0x0;var _0x3d8797=_0x85f5[_0x39010b];return _0x3d8797;};'use strict';var Sequelize=require(_0x585f('0x0'));module['exports']={'name':{'type':Sequelize[_0x585f('0x1')],'unique':_0x585f('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x585f('0x1')]},'display_name':{'type':Sequelize[_0x585f('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x585f('0x1')]},'original_duration':{'type':Sequelize[_0x585f('0x3')]},'original_sampleCount':{'type':Sequelize[_0x585f('0x4')]},'original_channelCount':{'type':Sequelize[_0x585f('0x5')]},'original_bitRate':{'type':Sequelize[_0x585f('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x585f('0x1')]},'converted_duration':{'type':Sequelize[_0x585f('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x585f('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'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 b7966d2..2c9ab92 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 _0x99f7=['root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','join','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','src','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','update','destroy','then','UserProfileResource','stack','name','send','index','map','Sound','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','params','rawAttributes','catch','download','find','save_name','converted_format','existsSync'];(function(_0x213aac,_0x30117f){var _0x20bc6f=function(_0x2b1baf){while(--_0x2b1baf){_0x213aac['push'](_0x213aac['shift']());}};_0x20bc6f(++_0x30117f);}(_0x99f7,0x12f));var _0x799f=function(_0x2977fb,_0x4a946e){_0x2977fb=_0x2977fb-0x0;var _0x38757e=_0x99f7[_0x2977fb];return _0x38757e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x799f('0x0'));var zipdir=require(_0x799f('0x1'));var jsonpatch=require(_0x799f('0x2'));var rp=require(_0x799f('0x3'));var moment=require(_0x799f('0x4'));var BPromise=require(_0x799f('0x5'));var Mustache=require(_0x799f('0x6'));var util=require(_0x799f('0x7'));var path=require(_0x799f('0x8'));var sox=require(_0x799f('0x9'));var csv=require(_0x799f('0xa'));var ejs=require(_0x799f('0xb'));var fs=require('fs');var _=require(_0x799f('0xc'));var squel=require(_0x799f('0xd'));var crypto=require('crypto');var jsforce=require(_0x799f('0xe'));var deskjs=require(_0x799f('0xf'));var toCsv=require(_0x799f('0xa'));var querystring=require('querystring');var Papa=require(_0x799f('0x10'));var Redis=require(_0x799f('0x11'));var authService=require(_0x799f('0x12'));var qs=require(_0x799f('0x13'));var as=require(_0x799f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x799f('0x15'));var utils=require('../../config/utils');var config=require(_0x799f('0x16'));var licenseUtil=require(_0x799f('0x17'));var db=require(_0x799f('0x18'))['db'];function respondWithStatusCode(_0x32a75d,_0x22ffac){_0x22ffac=_0x22ffac||0xcc;return function(_0x3acb45){if(_0x3acb45){return _0x32a75d[_0x799f('0x19')](_0x22ffac);}return _0x32a75d[_0x799f('0x1a')](_0x22ffac)[_0x799f('0x1b')]();};}function respondWithResult(_0xe6c52c,_0x1311df){_0x1311df=_0x1311df||0xc8;return function(_0x4a06fe){if(_0x4a06fe){return _0xe6c52c[_0x799f('0x1a')](_0x1311df)[_0x799f('0x1c')](_0x4a06fe);}};}function respondWithFilteredResult(_0x1ff666,_0x57b2dd){return function(_0xe9f2c6){if(_0xe9f2c6){var _0xa12199=_0xe9f2c6[_0x799f('0x1d')],_0x2cc77e=_0x57b2dd[_0x799f('0x1e')],_0x5a9192=_0x57b2dd[_0x799f('0x1e')]+_0x57b2dd['limit'],_0x1beae9;if(_0x5a9192>=_0xa12199){_0x5a9192=_0xa12199;_0x1beae9=0xc8;}else{_0x1beae9=0xce;}_0x1ff666['status'](_0x1beae9);return _0x1ff666[_0x799f('0x1f')]('Content-Range',_0x2cc77e+'-'+_0x5a9192+'/'+_0xa12199)['json'](_0xe9f2c6);}return null;};}function patchUpdates(_0x382ae8){return function(_0x3bae89){try{jsonpatch[_0x799f('0x20')](_0x3bae89,_0x382ae8,!![]);}catch(_0x290014){return BPromise[_0x799f('0x21')](_0x290014);}return _0x3bae89['save']();};}function saveUpdates(_0x2c0465,_0x1c68fd){return function(_0x459fea){if(_0x459fea){return _0x459fea[_0x799f('0x22')](_0x2c0465)['then'](function(_0x2b2302){return _0x2b2302;});}return null;};}function removeEntity(_0x1622fa,_0x4b4164){return function(_0x421fc1){if(_0x421fc1){return _0x421fc1[_0x799f('0x23')]()[_0x799f('0x24')](function(){var _0xfbefb1=_0x421fc1['get']({'plain':!![]});var _0x5e6380='Sounds';return db[_0x799f('0x25')][_0x799f('0x23')]({'where':{'type':_0x5e6380,'resourceId':_0xfbefb1['id']}})[_0x799f('0x24')](function(){return _0x421fc1;});})[_0x799f('0x24')](function(){_0x1622fa['status'](0xcc)[_0x799f('0x1b')]();});}};}function handleEntityNotFound(_0x539e06,_0x3c174f){return function(_0x119dd2){if(!_0x119dd2){_0x539e06[_0x799f('0x19')](0x194);}return _0x119dd2;};}function handleError(_0x2b81b2,_0x16a93e){_0x16a93e=_0x16a93e||0x1f4;return function(_0x1246e0){logger['error'](_0x1246e0[_0x799f('0x26')]);if(_0x1246e0[_0x799f('0x27')]){delete _0x1246e0['name'];}_0x2b81b2[_0x799f('0x1a')](_0x16a93e)[_0x799f('0x28')](_0x1246e0);};}exports[_0x799f('0x29')]=function(_0x4325ea,_0x567e2b){var _0x23f3e4={},_0x471a21={},_0x15ad55={'count':0x0,'rows':[]};var _0x24f7d0=_[_0x799f('0x2a')](db[_0x799f('0x2b')]['rawAttributes'],function(_0x5d305f){return{'name':_0x5d305f[_0x799f('0x2c')],'type':_0x5d305f['type']['key']};});_0x471a21[_0x799f('0x2d')]=_[_0x799f('0x2a')](_0x24f7d0,_0x799f('0x27'));_0x471a21[_0x799f('0x2e')]=_[_0x799f('0x2f')](_0x4325ea[_0x799f('0x2e')]);_0x471a21[_0x799f('0x30')]=_[_0x799f('0x31')](_0x471a21[_0x799f('0x2d')],_0x471a21[_0x799f('0x2e')]);_0x23f3e4[_0x799f('0x32')]=_[_0x799f('0x31')](_0x471a21[_0x799f('0x2d')],qs[_0x799f('0x33')](_0x4325ea[_0x799f('0x2e')][_0x799f('0x33')]));_0x23f3e4[_0x799f('0x32')]=_0x23f3e4[_0x799f('0x32')][_0x799f('0x34')]?_0x23f3e4['attributes']:_0x471a21[_0x799f('0x2d')];if(!_0x4325ea[_0x799f('0x2e')][_0x799f('0x35')](_0x799f('0x36'))){_0x23f3e4['limit']=qs[_0x799f('0x37')](_0x4325ea[_0x799f('0x2e')][_0x799f('0x37')]);_0x23f3e4[_0x799f('0x1e')]=qs['offset'](_0x4325ea['query'][_0x799f('0x1e')]);}_0x23f3e4[_0x799f('0x38')]=qs[_0x799f('0x39')](_0x4325ea[_0x799f('0x2e')]['sort']);_0x23f3e4[_0x799f('0x3a')]=qs[_0x799f('0x30')](_['pick'](_0x4325ea[_0x799f('0x2e')],_0x471a21[_0x799f('0x30')]),_0x24f7d0);if(_0x4325ea[_0x799f('0x2e')][_0x799f('0x3b')]){_0x23f3e4[_0x799f('0x3a')]=_[_0x799f('0x3c')](_0x23f3e4[_0x799f('0x3a')],{'$or':_[_0x799f('0x2a')](_0x24f7d0,function(_0x3bf6c3){if(_0x3bf6c3[_0x799f('0x3d')]!==_0x799f('0x3e')){var _0x35abdc={};_0x35abdc[_0x3bf6c3['name']]={'$like':'%'+_0x4325ea[_0x799f('0x2e')][_0x799f('0x3b')]+'%'};return _0x35abdc;}})});}_0x23f3e4=_[_0x799f('0x3c')]({},_0x23f3e4,_0x4325ea[_0x799f('0x3f')]);var _0x188eb8={'where':_0x23f3e4['where']};return db['Sound'][_0x799f('0x1d')](_0x188eb8)['then'](function(_0x48554d){_0x15ad55[_0x799f('0x1d')]=_0x48554d;if(_0x4325ea[_0x799f('0x2e')][_0x799f('0x40')]){_0x23f3e4[_0x799f('0x41')]=[{'all':!![]}];}return db[_0x799f('0x2b')][_0x799f('0x42')](_0x23f3e4);})[_0x799f('0x24')](function(_0x22cc7d){_0x15ad55['rows']=_0x22cc7d;return _0x15ad55;})[_0x799f('0x24')](respondWithFilteredResult(_0x567e2b,_0x23f3e4))['catch'](handleError(_0x567e2b,null));};exports['show']=function(_0x72c2db,_0x283c48){var _0xe9b83a={'raw':!![],'where':{'id':_0x72c2db[_0x799f('0x43')]['id']}},_0x53c752={};_0x53c752[_0x799f('0x2d')]=_[_0x799f('0x2f')](db[_0x799f('0x2b')][_0x799f('0x44')]);_0x53c752[_0x799f('0x2e')]=_[_0x799f('0x2f')](_0x72c2db[_0x799f('0x2e')]);_0x53c752['filters']=_['intersection'](_0x53c752[_0x799f('0x2d')],_0x53c752['query']);_0xe9b83a[_0x799f('0x32')]=_[_0x799f('0x31')](_0x53c752['model'],qs[_0x799f('0x33')](_0x72c2db['query']['fields']));_0xe9b83a[_0x799f('0x32')]=_0xe9b83a[_0x799f('0x32')][_0x799f('0x34')]?_0xe9b83a[_0x799f('0x32')]:_0x53c752[_0x799f('0x2d')];if(_0x72c2db[_0x799f('0x2e')]['includeAll']){_0xe9b83a[_0x799f('0x41')]=[{'all':!![]}];}_0xe9b83a=_['merge']({},_0xe9b83a,_0x72c2db[_0x799f('0x3f')]);return db['Sound']['find'](_0xe9b83a)[_0x799f('0x24')](handleEntityNotFound(_0x283c48,null))[_0x799f('0x24')](respondWithResult(_0x283c48,null))[_0x799f('0x45')](handleError(_0x283c48,null));};exports[_0x799f('0x46')]=function(_0x63caf0,_0x354fe2,_0x2cf49e){return db[_0x799f('0x2b')][_0x799f('0x47')]({'where':{'id':_0x63caf0[_0x799f('0x43')]['id']},'attributes':[_0x799f('0x27'),_0x799f('0x48'),_0x799f('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x354fe2,null))[_0x799f('0x24')](function(_0x5edd85){if(_0x5edd85){if(!fs[_0x799f('0x4a')](path['join'](config[_0x799f('0x4b')],_0x799f('0x4c'),_0x5edd85[_0x799f('0x48')]+'.'+_0x5edd85[_0x799f('0x49')]))){throw new db['Sequelize'][(_0x799f('0x4d'))](_0x799f('0x4e'));}return _0x354fe2[_0x799f('0x46')](path['join'](config[_0x799f('0x4b')],_0x799f('0x4c'),util[_0x799f('0x4f')](_0x799f('0x50'),_0x5edd85[_0x799f('0x48')],_0x5edd85[_0x799f('0x49')])),util[_0x799f('0x4f')](_0x799f('0x50'),_0x5edd85[_0x799f('0x27')],_0x5edd85[_0x799f('0x49')]));}return null;})[_0x799f('0x45')](handleError(_0x354fe2,null));};exports[_0x799f('0x51')]=function(_0x293ba2,_0x1f5355,_0x1835ec){var _0x4c1fc5={'name':path[_0x799f('0x52')](_0x293ba2[_0x799f('0x53')][_0x799f('0x54')],path[_0x799f('0x55')](_0x293ba2[_0x799f('0x53')][_0x799f('0x54')])),'save_name':path[_0x799f('0x52')](_0x293ba2['file']['filename'],path[_0x799f('0x55')](_0x293ba2[_0x799f('0x53')][_0x799f('0x56')])),'original_format':path['extname'](_0x293ba2[_0x799f('0x53')]['originalname'])[_0x799f('0x57')](0x1),'converted_format':_0x799f('0x58')};var _0x31e059=path['join'](config['root'],_0x799f('0x59'),_0x293ba2[_0x799f('0x53')]['filename']);var _0x5a1afd=path[_0x799f('0x5a')](config[_0x799f('0x4b')],_0x799f('0x4c'),util['format']('%s.%s',path['basename'](_0x293ba2[_0x799f('0x53')][_0x799f('0x56')],path['extname'](_0x293ba2[_0x799f('0x53')]['filename'])),_0x4c1fc5[_0x799f('0x49')]));logger['info'](_0x799f('0x5b'),_0x31e059);logger[_0x799f('0x5c')](_0x799f('0x5d'),_0x5a1afd);try{fs[_0x799f('0x5e')](_0x31e059,parseInt(_0x799f('0x5f'),0x8));var _0x19967e=sox[_0x799f('0x60')](_0x31e059,_0x5a1afd,{'sampleRate':0x1f40,'format':_0x799f('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x19967e['on'](_0x799f('0x61'),function(_0x4764be){fs[_0x799f('0x62')](_0x31e059);_0x1f5355[_0x799f('0x1a')](0x1f4)[_0x799f('0x28')](_0x4764be);});_0x19967e['on'](_0x799f('0x63'),function(_0x1302e8){_0x4c1fc5['original_duration']=isNaN(_0x1302e8[_0x799f('0x64')])?null:_0x1302e8[_0x799f('0x64')]*0x3e8;_0x4c1fc5['original_sampleCount']=isNaN(_0x1302e8[_0x799f('0x65')])?null:_0x1302e8[_0x799f('0x65')];_0x4c1fc5[_0x799f('0x66')]=isNaN(_0x1302e8[_0x799f('0x67')])?null:_0x1302e8[_0x799f('0x67')];_0x4c1fc5[_0x799f('0x68')]=isNaN(_0x1302e8[_0x799f('0x69')])?null:_0x1302e8[_0x799f('0x69')];_0x4c1fc5[_0x799f('0x6a')]=isNaN(_0x1302e8['sampleRate'])?null:_0x1302e8[_0x799f('0x6b')];});_0x19967e['on'](_0x799f('0x6c'),function(_0x3ca58d){_0x4c1fc5[_0x799f('0x6d')]=isNaN(_0x3ca58d[_0x799f('0x64')])?null:_0x3ca58d['duration']*0x3e8;_0x4c1fc5[_0x799f('0x6e')]=isNaN(_0x3ca58d['sampleCount'])?null:_0x3ca58d[_0x799f('0x65')];_0x4c1fc5[_0x799f('0x6f')]=isNaN(_0x3ca58d[_0x799f('0x67')])?null:_0x3ca58d[_0x799f('0x67')];_0x4c1fc5[_0x799f('0x70')]=isNaN(_0x3ca58d[_0x799f('0x69')])?null:_0x3ca58d[_0x799f('0x69')];_0x4c1fc5[_0x799f('0x71')]=isNaN(_0x3ca58d[_0x799f('0x6b')])?null:_0x3ca58d[_0x799f('0x6b')];});_0x19967e['on'](_0x799f('0x1b'),function(){fs[_0x799f('0x5e')](_0x5a1afd,parseInt('0777',0x8));return db[_0x799f('0x2b')][_0x799f('0x51')](_0x4c1fc5)[_0x799f('0x24')](function(_0x33e4c2){var _0x8ff937={'role':_0x293ba2[_0x799f('0x72')][_0x799f('0x73')],'userProfileId':_0x293ba2[_0x799f('0x72')][_0x799f('0x74')]};if(!_0x8ff937)throw new Error(_0x799f('0x75'));if(_0x8ff937[_0x799f('0x73')]===_0x799f('0x76')){var _0x313a33=_0x33e4c2[_0x799f('0x77')]({'plain':!![]});return db[_0x799f('0x78')][_0x799f('0x47')]({'where':{'name':_0x799f('0x79'),'userProfileId':_0x8ff937[_0x799f('0x74')]},'raw':!![]})[_0x799f('0x24')](function(_0x19cdab){if(_0x19cdab&&_0x19cdab[_0x799f('0x7a')]===0x0){return db[_0x799f('0x25')][_0x799f('0x51')]({'name':_0x313a33[_0x799f('0x27')],'resourceId':_0x313a33['id'],'type':_0x19cdab[_0x799f('0x27')],'sectionId':_0x19cdab['id']},{})['then'](function(){return _0x33e4c2;});}else{return _0x33e4c2;}})[_0x799f('0x45')](function(_0x301709){logger[_0x799f('0x61')](_0x799f('0x7b'),_0x301709);throw _0x301709;});}return _0x33e4c2;})['then'](respondWithResult(_0x1f5355,null))['catch'](handleError(_0x1f5355,null));});_0x19967e[_0x799f('0x7c')]();}catch(_0x17493f){_0x1f5355[_0x799f('0x1a')](0x1f4)[_0x799f('0x28')](_0x17493f);}};exports[_0x799f('0x22')]=function(_0x4f30c6,_0x922f54,_0xd85b0c){return db[_0x799f('0x2b')][_0x799f('0x47')]({'where':{'id':_0x4f30c6['params']['id']}})['then'](handleEntityNotFound(_0x922f54,null))[_0x799f('0x24')](saveUpdates(_['pick'](_0x4f30c6[_0x799f('0x72')],[_0x799f('0x27'),_0x799f('0x7d')]),null))['then'](respondWithResult(_0x922f54,null))[_0x799f('0x45')](handleError(_0x922f54,null));};exports['delete']=function(_0x5a497e,_0x5df03a,_0x2fa80){return db[_0x799f('0x2b')][_0x799f('0x47')]({'where':{'id':_0x5a497e[_0x799f('0x43')]['id']}})['then'](function(_0x58f448){if(_0x58f448){return _0x58f448[_0x799f('0x23')]();}})[_0x799f('0x24')](function(_0x4be208){var _0xf5ef27=path[_0x799f('0x5a')](config[_0x799f('0x4b')],_0x799f('0x59'),util['format']('%s.%s',_0x4be208['save_name'],_0x4be208['original_format']));var _0x2f5e96=path[_0x799f('0x5a')](config[_0x799f('0x4b')],_0x799f('0x4c'),util[_0x799f('0x4f')](_0x799f('0x50'),_0x4be208['save_name'],_0x4be208[_0x799f('0x49')]));fs[_0x799f('0x62')](_0xf5ef27);fs[_0x799f('0x62')](_0x2f5e96);return _0x4be208;})[_0x799f('0x24')](function(_0x55b5ba){if(_0x55b5ba){return _0x5df03a[_0x799f('0x1a')](0xcc)['end']();}})[_0x799f('0x24')](handleEntityNotFound(_0x5df03a,null))[_0x799f('0x45')](handleError(_0x5df03a,null));}; \ No newline at end of file +var _0x4bd7=['order','sort','pick','filter','merge','where','VIRTUAL','options','count','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','download','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','file','extname','originalname','basename','filename','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','unlinkSync','src','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','duration','converted_sampleCount','sampleCount','body','userProfileId','role','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','description','delete','original_format','join','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','status','set','Content-Range','json','reject','save','then','destroy','get','Sounds','UserProfileResource','name','send','map','Sound','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x555c1e,_0x3f8176){var _0x556044=function(_0x1d1afc){while(--_0x1d1afc){_0x555c1e['push'](_0x555c1e['shift']());}};_0x556044(++_0x3f8176);}(_0x4bd7,0x1aa));var _0x74bd=function(_0x245e0e,_0xcab6db){_0x245e0e=_0x245e0e-0x0;var _0xafcff4=_0x4bd7[_0x245e0e];return _0xafcff4;};'use strict';var pdf=require(_0x74bd('0x0'));var emlformat=require(_0x74bd('0x1'));var rimraf=require(_0x74bd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x74bd('0x3'));var rp=require(_0x74bd('0x4'));var moment=require(_0x74bd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x74bd('0x6'));var util=require('util');var path=require(_0x74bd('0x7'));var sox=require(_0x74bd('0x8'));var csv=require(_0x74bd('0x9'));var ejs=require(_0x74bd('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x74bd('0xb'));var deskjs=require(_0x74bd('0xc'));var toCsv=require(_0x74bd('0x9'));var querystring=require(_0x74bd('0xd'));var Papa=require('papaparse');var Redis=require(_0x74bd('0xe'));var authService=require(_0x74bd('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x74bd('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x74bd('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x74bd('0x12'));var db=require(_0x74bd('0x13'))['db'];function respondWithStatusCode(_0xacba40,_0x3c93ea){_0x3c93ea=_0x3c93ea||0xcc;return function(_0x4f8216){if(_0x4f8216){return _0xacba40[_0x74bd('0x14')](_0x3c93ea);}return _0xacba40['status'](_0x3c93ea)[_0x74bd('0x15')]();};}function respondWithResult(_0x37ae2d,_0x29fade){_0x29fade=_0x29fade||0xc8;return function(_0x100417){if(_0x100417){return _0x37ae2d['status'](_0x29fade)['json'](_0x100417);}};}function respondWithFilteredResult(_0x3e266c,_0x214784){return function(_0x10f40a){if(_0x10f40a){var _0x1b9ad3=_0x10f40a['count'],_0x1f460b=_0x214784['offset'],_0x1a7b4a=_0x214784[_0x74bd('0x16')]+_0x214784[_0x74bd('0x17')],_0x55379b;if(_0x1a7b4a>=_0x1b9ad3){_0x1a7b4a=_0x1b9ad3;_0x55379b=0xc8;}else{_0x55379b=0xce;}_0x3e266c[_0x74bd('0x18')](_0x55379b);return _0x3e266c[_0x74bd('0x19')](_0x74bd('0x1a'),_0x1f460b+'-'+_0x1a7b4a+'/'+_0x1b9ad3)[_0x74bd('0x1b')](_0x10f40a);}return null;};}function patchUpdates(_0x19915a){return function(_0x11ee82){try{jsonpatch['apply'](_0x11ee82,_0x19915a,!![]);}catch(_0x57f459){return BPromise[_0x74bd('0x1c')](_0x57f459);}return _0x11ee82[_0x74bd('0x1d')]();};}function saveUpdates(_0x465ce7,_0x2faef5){return function(_0x2c9223){if(_0x2c9223){return _0x2c9223['update'](_0x465ce7)[_0x74bd('0x1e')](function(_0x41eea7){return _0x41eea7;});}return null;};}function removeEntity(_0x439ba8,_0x870918){return function(_0x114683){if(_0x114683){return _0x114683[_0x74bd('0x1f')]()[_0x74bd('0x1e')](function(){var _0x211c1f=_0x114683[_0x74bd('0x20')]({'plain':!![]});var _0x562178=_0x74bd('0x21');return db[_0x74bd('0x22')]['destroy']({'where':{'type':_0x562178,'resourceId':_0x211c1f['id']}})[_0x74bd('0x1e')](function(){return _0x114683;});})[_0x74bd('0x1e')](function(){_0x439ba8[_0x74bd('0x18')](0xcc)[_0x74bd('0x15')]();});}};}function handleEntityNotFound(_0x49e96c,_0x19d80d){return function(_0x2e63f5){if(!_0x2e63f5){_0x49e96c['sendStatus'](0x194);}return _0x2e63f5;};}function handleError(_0x3e0381,_0x11b530){_0x11b530=_0x11b530||0x1f4;return function(_0x21eb02){logger['error'](_0x21eb02['stack']);if(_0x21eb02[_0x74bd('0x23')]){delete _0x21eb02[_0x74bd('0x23')];}_0x3e0381[_0x74bd('0x18')](_0x11b530)[_0x74bd('0x24')](_0x21eb02);};}exports['index']=function(_0x24ecbe,_0x963ed8){var _0xf7ed14={},_0x48e30f={},_0x5480e9={'count':0x0,'rows':[]};var _0x3b0f3f=_[_0x74bd('0x25')](db[_0x74bd('0x26')]['rawAttributes'],function(_0x178f28){return{'name':_0x178f28['fieldName'],'type':_0x178f28[_0x74bd('0x27')][_0x74bd('0x28')]};});_0x48e30f[_0x74bd('0x29')]=_[_0x74bd('0x25')](_0x3b0f3f,_0x74bd('0x23'));_0x48e30f[_0x74bd('0x2a')]=_[_0x74bd('0x2b')](_0x24ecbe[_0x74bd('0x2a')]);_0x48e30f[_0x74bd('0x2c')]=_[_0x74bd('0x2d')](_0x48e30f[_0x74bd('0x29')],_0x48e30f[_0x74bd('0x2a')]);_0xf7ed14[_0x74bd('0x2e')]=_[_0x74bd('0x2d')](_0x48e30f[_0x74bd('0x29')],qs[_0x74bd('0x2f')](_0x24ecbe[_0x74bd('0x2a')]['fields']));_0xf7ed14['attributes']=_0xf7ed14[_0x74bd('0x2e')][_0x74bd('0x30')]?_0xf7ed14['attributes']:_0x48e30f['model'];if(!_0x24ecbe[_0x74bd('0x2a')]['hasOwnProperty'](_0x74bd('0x31'))){_0xf7ed14['limit']=qs[_0x74bd('0x17')](_0x24ecbe[_0x74bd('0x2a')][_0x74bd('0x17')]);_0xf7ed14[_0x74bd('0x16')]=qs[_0x74bd('0x16')](_0x24ecbe[_0x74bd('0x2a')][_0x74bd('0x16')]);}_0xf7ed14[_0x74bd('0x32')]=qs[_0x74bd('0x33')](_0x24ecbe['query'][_0x74bd('0x33')]);_0xf7ed14['where']=qs[_0x74bd('0x2c')](_[_0x74bd('0x34')](_0x24ecbe[_0x74bd('0x2a')],_0x48e30f[_0x74bd('0x2c')]),_0x3b0f3f);if(_0x24ecbe[_0x74bd('0x2a')][_0x74bd('0x35')]){_0xf7ed14['where']=_[_0x74bd('0x36')](_0xf7ed14[_0x74bd('0x37')],{'$or':_[_0x74bd('0x25')](_0x3b0f3f,function(_0x59748e){if(_0x59748e['type']!==_0x74bd('0x38')){var _0x404a6d={};_0x404a6d[_0x59748e[_0x74bd('0x23')]]={'$like':'%'+_0x24ecbe['query'][_0x74bd('0x35')]+'%'};return _0x404a6d;}})});}_0xf7ed14=_[_0x74bd('0x36')]({},_0xf7ed14,_0x24ecbe[_0x74bd('0x39')]);var _0x49511d={'where':_0xf7ed14[_0x74bd('0x37')]};return db[_0x74bd('0x26')][_0x74bd('0x3a')](_0x49511d)['then'](function(_0x2aaf7b){_0x5480e9[_0x74bd('0x3a')]=_0x2aaf7b;if(_0x24ecbe[_0x74bd('0x2a')]['includeAll']){_0xf7ed14[_0x74bd('0x3b')]=[{'all':!![]}];}return db['Sound'][_0x74bd('0x3c')](_0xf7ed14);})[_0x74bd('0x1e')](function(_0x3d57b7){_0x5480e9[_0x74bd('0x3d')]=_0x3d57b7;return _0x5480e9;})[_0x74bd('0x1e')](respondWithFilteredResult(_0x963ed8,_0xf7ed14))[_0x74bd('0x3e')](handleError(_0x963ed8,null));};exports[_0x74bd('0x3f')]=function(_0x2fedf6,_0x306b24){var _0x25735a={'raw':!![],'where':{'id':_0x2fedf6[_0x74bd('0x40')]['id']}},_0xe04245={};_0xe04245['model']=_[_0x74bd('0x2b')](db[_0x74bd('0x26')][_0x74bd('0x41')]);_0xe04245[_0x74bd('0x2a')]=_[_0x74bd('0x2b')](_0x2fedf6[_0x74bd('0x2a')]);_0xe04245[_0x74bd('0x2c')]=_[_0x74bd('0x2d')](_0xe04245[_0x74bd('0x29')],_0xe04245[_0x74bd('0x2a')]);_0x25735a[_0x74bd('0x2e')]=_[_0x74bd('0x2d')](_0xe04245[_0x74bd('0x29')],qs[_0x74bd('0x2f')](_0x2fedf6[_0x74bd('0x2a')]['fields']));_0x25735a[_0x74bd('0x2e')]=_0x25735a[_0x74bd('0x2e')][_0x74bd('0x30')]?_0x25735a[_0x74bd('0x2e')]:_0xe04245[_0x74bd('0x29')];if(_0x2fedf6[_0x74bd('0x2a')][_0x74bd('0x42')]){_0x25735a['include']=[{'all':!![]}];}_0x25735a=_[_0x74bd('0x36')]({},_0x25735a,_0x2fedf6['options']);return db[_0x74bd('0x26')][_0x74bd('0x43')](_0x25735a)[_0x74bd('0x1e')](handleEntityNotFound(_0x306b24,null))[_0x74bd('0x1e')](respondWithResult(_0x306b24,null))[_0x74bd('0x3e')](handleError(_0x306b24,null));};exports[_0x74bd('0x44')]=function(_0x58cca3,_0x45778f,_0x4c20be){return db[_0x74bd('0x26')][_0x74bd('0x43')]({'where':{'id':_0x58cca3[_0x74bd('0x40')]['id']},'attributes':[_0x74bd('0x23'),_0x74bd('0x45'),_0x74bd('0x46')],'raw':!![]})[_0x74bd('0x1e')](handleEntityNotFound(_0x45778f,null))['then'](function(_0x1526e3){if(_0x1526e3){if(!fs[_0x74bd('0x47')](path['join'](config[_0x74bd('0x48')],_0x74bd('0x49'),_0x1526e3[_0x74bd('0x45')]+'.'+_0x1526e3['converted_format']))){throw new db[(_0x74bd('0x4a'))][(_0x74bd('0x4b'))](_0x74bd('0x4c'));}return _0x45778f[_0x74bd('0x44')](path['join'](config[_0x74bd('0x48')],_0x74bd('0x49'),util[_0x74bd('0x4d')](_0x74bd('0x4e'),_0x1526e3[_0x74bd('0x45')],_0x1526e3['converted_format'])),util[_0x74bd('0x4d')](_0x74bd('0x4e'),_0x1526e3[_0x74bd('0x23')],_0x1526e3[_0x74bd('0x46')]));}return null;})[_0x74bd('0x3e')](handleError(_0x45778f,null));};exports[_0x74bd('0x4f')]=function(_0x1fcd2e,_0x4b8251,_0x4b4a8c){var _0x52de5c={'name':path['basename'](_0x1fcd2e[_0x74bd('0x50')]['originalname'],path[_0x74bd('0x51')](_0x1fcd2e[_0x74bd('0x50')][_0x74bd('0x52')])),'save_name':path[_0x74bd('0x53')](_0x1fcd2e[_0x74bd('0x50')][_0x74bd('0x54')],path['extname'](_0x1fcd2e['file']['filename'])),'original_format':path[_0x74bd('0x51')](_0x1fcd2e['file']['originalname'])['substring'](0x1),'converted_format':'wav'};var _0x231b73=path['join'](config[_0x74bd('0x48')],_0x74bd('0x55'),_0x1fcd2e[_0x74bd('0x50')]['filename']);var _0x10cd32=path['join'](config[_0x74bd('0x48')],_0x74bd('0x49'),util[_0x74bd('0x4d')]('%s.%s',path[_0x74bd('0x53')](_0x1fcd2e[_0x74bd('0x50')]['filename'],path[_0x74bd('0x51')](_0x1fcd2e[_0x74bd('0x50')][_0x74bd('0x54')])),_0x52de5c[_0x74bd('0x46')]));logger[_0x74bd('0x56')]('Sound\x20upload\x20filepath:\x20%s',_0x231b73);logger[_0x74bd('0x56')](_0x74bd('0x57'),_0x10cd32);try{fs[_0x74bd('0x58')](_0x231b73,parseInt(_0x74bd('0x59'),0x8));var _0x36b515=sox[_0x74bd('0x5a')](_0x231b73,_0x10cd32,{'sampleRate':0x1f40,'format':_0x74bd('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x36b515['on']('error',function(_0x596fb2){fs[_0x74bd('0x5c')](_0x231b73);_0x4b8251[_0x74bd('0x18')](0x1f4)[_0x74bd('0x24')](_0x596fb2);});_0x36b515['on'](_0x74bd('0x5d'),function(_0x53f449){_0x52de5c['original_duration']=isNaN(_0x53f449['duration'])?null:_0x53f449['duration']*0x3e8;_0x52de5c['original_sampleCount']=isNaN(_0x53f449['sampleCount'])?null:_0x53f449['sampleCount'];_0x52de5c[_0x74bd('0x5e')]=isNaN(_0x53f449[_0x74bd('0x5f')])?null:_0x53f449[_0x74bd('0x5f')];_0x52de5c[_0x74bd('0x60')]=isNaN(_0x53f449[_0x74bd('0x61')])?null:_0x53f449['bitRate'];_0x52de5c[_0x74bd('0x62')]=isNaN(_0x53f449[_0x74bd('0x63')])?null:_0x53f449[_0x74bd('0x63')];});_0x36b515['on'](_0x74bd('0x64'),function(_0x541d0c){_0x52de5c[_0x74bd('0x65')]=isNaN(_0x541d0c[_0x74bd('0x66')])?null:_0x541d0c[_0x74bd('0x66')]*0x3e8;_0x52de5c[_0x74bd('0x67')]=isNaN(_0x541d0c[_0x74bd('0x68')])?null:_0x541d0c[_0x74bd('0x68')];_0x52de5c['converted_channelCount']=isNaN(_0x541d0c['channelCount'])?null:_0x541d0c[_0x74bd('0x5f')];_0x52de5c['converted_bitRate']=isNaN(_0x541d0c[_0x74bd('0x61')])?null:_0x541d0c['bitRate'];_0x52de5c['converted_sampleRate']=isNaN(_0x541d0c[_0x74bd('0x63')])?null:_0x541d0c[_0x74bd('0x63')];});_0x36b515['on'](_0x74bd('0x15'),function(){fs[_0x74bd('0x58')](_0x10cd32,parseInt('0777',0x8));return db[_0x74bd('0x26')][_0x74bd('0x4f')](_0x52de5c)[_0x74bd('0x1e')](function(_0x5199f3){var _0x12f446={'role':_0x1fcd2e[_0x74bd('0x69')]['role'],'userProfileId':_0x1fcd2e['body'][_0x74bd('0x6a')]};if(!_0x12f446)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12f446[_0x74bd('0x6b')]===_0x74bd('0x6c')){var _0x5507aa=_0x5199f3[_0x74bd('0x20')]({'plain':!![]});return db[_0x74bd('0x6d')][_0x74bd('0x43')]({'where':{'name':'Sounds','userProfileId':_0x12f446[_0x74bd('0x6a')]},'raw':!![]})[_0x74bd('0x1e')](function(_0xb632c3){if(_0xb632c3&&_0xb632c3[_0x74bd('0x6e')]===0x0){return db[_0x74bd('0x22')]['create']({'name':_0x5507aa[_0x74bd('0x23')],'resourceId':_0x5507aa['id'],'type':_0xb632c3[_0x74bd('0x23')],'sectionId':_0xb632c3['id']},{})[_0x74bd('0x1e')](function(){return _0x5199f3;});}else{return _0x5199f3;}})['catch'](function(_0x5ac230){logger[_0x74bd('0x6f')](_0x74bd('0x70'),_0x5ac230);throw _0x5ac230;});}return _0x5199f3;})[_0x74bd('0x1e')](respondWithResult(_0x4b8251,null))[_0x74bd('0x3e')](handleError(_0x4b8251,null));});_0x36b515[_0x74bd('0x71')]();}catch(_0x358364){_0x4b8251[_0x74bd('0x18')](0x1f4)['send'](_0x358364);}};exports[_0x74bd('0x72')]=function(_0x2b9e6c,_0x1c5674,_0x50ce04){return db[_0x74bd('0x26')][_0x74bd('0x43')]({'where':{'id':_0x2b9e6c['params']['id']}})['then'](handleEntityNotFound(_0x1c5674,null))['then'](saveUpdates(_[_0x74bd('0x34')](_0x2b9e6c[_0x74bd('0x69')],[_0x74bd('0x23'),_0x74bd('0x73')]),null))['then'](respondWithResult(_0x1c5674,null))['catch'](handleError(_0x1c5674,null));};exports[_0x74bd('0x74')]=function(_0x3d3884,_0xc57f2e,_0x5ad4ba){return db[_0x74bd('0x26')]['find']({'where':{'id':_0x3d3884[_0x74bd('0x40')]['id']}})[_0x74bd('0x1e')](function(_0x461ef8){if(_0x461ef8){return _0x461ef8[_0x74bd('0x1f')]();}})[_0x74bd('0x1e')](function(_0x44dcd4){var _0x53d7be=path['join'](config[_0x74bd('0x48')],'server/files/sounds/original',util[_0x74bd('0x4d')](_0x74bd('0x4e'),_0x44dcd4[_0x74bd('0x45')],_0x44dcd4[_0x74bd('0x75')]));var _0x59ad18=path[_0x74bd('0x76')](config[_0x74bd('0x48')],_0x74bd('0x49'),util[_0x74bd('0x4d')](_0x74bd('0x4e'),_0x44dcd4[_0x74bd('0x45')],_0x44dcd4[_0x74bd('0x46')]));fs['unlinkSync'](_0x53d7be);fs['unlinkSync'](_0x59ad18);return _0x44dcd4;})[_0x74bd('0x1e')](function(_0x5c1f95){if(_0x5c1f95){return _0xc57f2e[_0x74bd('0x18')](0xcc)[_0x74bd('0x15')]();}})[_0x74bd('0x1e')](handleEntityNotFound(_0xc57f2e,null))[_0x74bd('0x3e')](handleError(_0xc57f2e,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 8520443..22f7a00 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 _0x8473=['rimraf','../../config/environment','./sound.attributes','exports','define','Sound','lodash','util','api','moment','bluebird','request-promise'];(function(_0x25a23f,_0x41d099){var _0x18643c=function(_0x53d2db){while(--_0x53d2db){_0x25a23f['push'](_0x25a23f['shift']());}};_0x18643c(++_0x41d099);}(_0x8473,0x1da));var _0x3847=function(_0x1b1aee,_0x5994f5){_0x1b1aee=_0x1b1aee-0x0;var _0x2e62a3=_0x8473[_0x1b1aee];return _0x2e62a3;};'use strict';var _=require(_0x3847('0x0'));var util=require(_0x3847('0x1'));var logger=require('../../config/logger')(_0x3847('0x2'));var moment=require(_0x3847('0x3'));var BPromise=require(_0x3847('0x4'));var rp=require(_0x3847('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3847('0x6'));var config=require(_0x3847('0x7'));var attributes=require(_0x3847('0x8'));module[_0x3847('0x9')]=function(_0x3c748d,_0x4f25f2){return _0x3c748d[_0x3847('0xa')](_0x3847('0xb'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2890=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash'];(function(_0x2857fc,_0x411fd1){var _0x49047c=function(_0x30ceb2){while(--_0x30ceb2){_0x2857fc['push'](_0x2857fc['shift']());}};_0x49047c(++_0x411fd1);}(_0x2890,0x1df));var _0x0289=function(_0x1d4a3c,_0x230e34){_0x1d4a3c=_0x1d4a3c-0x0;var _0x5ac981=_0x2890[_0x1d4a3c];return _0x5ac981;};'use strict';var _=require(_0x0289('0x0'));var util=require(_0x0289('0x1'));var logger=require(_0x0289('0x2'))(_0x0289('0x3'));var moment=require(_0x0289('0x4'));var BPromise=require(_0x0289('0x5'));var rp=require(_0x0289('0x6'));var fs=require('fs');var path=require(_0x0289('0x7'));var rimraf=require(_0x0289('0x8'));var config=require(_0x0289('0x9'));var attributes=require('./sound.attributes');module[_0x0289('0xa')]=function(_0x5c72b8,_0x223b13){return _0x5c72b8[_0x0289('0xb')]('Sound',attributes,{'tableName':'tools_sounds','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 0798356..adbeb4f 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 _0x14ce=['model','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowSound','find','options','raw','where','include','attributes','map'];(function(_0x29d4b5,_0x1913e2){var _0x3fbb01=function(_0x8b0a41){while(--_0x8b0a41){_0x29d4b5['push'](_0x29d4b5['shift']());}};_0x3fbb01(++_0x1913e2);}(_0x14ce,0xfa));var _0xe14c=function(_0x2458a5,_0x4eddd8){_0x2458a5=_0x2458a5-0x0;var _0x27d4c7=_0x14ce[_0x2458a5];return _0x27d4c7;};'use strict';var _=require(_0xe14c('0x0'));var util=require(_0xe14c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe14c('0x2'));var fs=require('fs');var Redis=require(_0xe14c('0x3'));var db=require(_0xe14c('0x4'))['db'];var utils=require(_0xe14c('0x5'));var logger=require(_0xe14c('0x6'))('rpc');var config=require(_0xe14c('0x7'));var jayson=require(_0xe14c('0x8'));var client=jayson[_0xe14c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39a6ce,_0x5e4fe6,_0x3e7fe4){return new BPromise(function(_0x530a2f,_0x4730ad){return client[_0xe14c('0xa')](_0x39a6ce,_0x3e7fe4)[_0xe14c('0xb')](function(_0x304293){logger[_0xe14c('0xc')](_0xe14c('0xd'),_0x5e4fe6,_0xe14c('0xe'));logger[_0xe14c('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x5e4fe6,'request\x20sent',JSON['stringify'](_0x304293));if(_0x304293[_0xe14c('0x10')]){if(_0x304293['error'][_0xe14c('0x11')]===0x1f4){logger['error'](_0xe14c('0xd'),_0x5e4fe6,_0x304293['error'][_0xe14c('0x12')]);return _0x4730ad(_0x304293[_0xe14c('0x10')][_0xe14c('0x12')]);}logger[_0xe14c('0x10')](_0xe14c('0xd'),_0x5e4fe6,_0x304293[_0xe14c('0x10')][_0xe14c('0x12')]);return _0x530a2f(_0x304293[_0xe14c('0x10')]['message']);}else{logger['info'](_0xe14c('0xd'),_0x5e4fe6,_0xe14c('0xe'));_0x530a2f(_0x304293[_0xe14c('0x13')][_0xe14c('0x12')]);}})[_0xe14c('0x14')](function(_0x165660){logger['error'](_0xe14c('0xd'),_0x5e4fe6,_0x165660);_0x4730ad(_0x165660);});});}exports[_0xe14c('0x15')]=function(_0x47bff4){var _0x137a47=this;return new Promise(function(_0x136d86,_0x2a11bb){return db['Sound'][_0xe14c('0x16')]({'raw':_0x47bff4[_0xe14c('0x17')]?_0x47bff4[_0xe14c('0x17')][_0xe14c('0x18')]===undefined?!![]:![]:!![],'where':_0x47bff4['options']?_0x47bff4[_0xe14c('0x17')][_0xe14c('0x19')]||null:null,'attributes':_0x47bff4['options']?_0x47bff4[_0xe14c('0x17')]['attributes']||null:null,'include':_0x47bff4[_0xe14c('0x17')]?_0x47bff4[_0xe14c('0x17')]['include']?_['map'](_0x47bff4[_0xe14c('0x17')][_0xe14c('0x1a')],function(_0x4ebe08){return{'model':db[_0x4ebe08['model']],'as':_0x4ebe08['as'],'attributes':_0x4ebe08[_0xe14c('0x1b')],'include':_0x4ebe08[_0xe14c('0x1a')]?_[_0xe14c('0x1c')](_0x4ebe08['include'],function(_0x1ad208){return{'model':db[_0x1ad208[_0xe14c('0x1d')]],'as':_0x1ad208['as'],'attributes':_0x1ad208[_0xe14c('0x1b')],'include':_0x1ad208[_0xe14c('0x1a')]?_[_0xe14c('0x1c')](_0x1ad208['include'],function(_0x43ecad){return{'model':db[_0x43ecad[_0xe14c('0x1d')]],'as':_0x43ecad['as'],'attributes':_0x43ecad[_0xe14c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe14c('0xb')](function(_0x209a14){logger[_0xe14c('0xc')](_0xe14c('0x15'),_0x47bff4);logger[_0xe14c('0xf')]('ShowSound',_0x47bff4,JSON[_0xe14c('0x1e')](_0x209a14));_0x136d86(_0x209a14);})['catch'](function(_0x50a982){logger[_0xe14c('0x10')](_0xe14c('0x15'),_0x50a982[_0xe14c('0x12')],_0x47bff4);_0x2a11bb(_0x137a47[_0xe14c('0x10')](0x1f4,_0x50a982[_0xe14c('0x12')]));});});}; \ No newline at end of file +var _0x54e8=['Sound','options','raw','where','include','map','model','attributes','then','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','catch','ShowSound'];(function(_0x48b35c,_0x568f70){var _0x46fc38=function(_0x25a9f){while(--_0x25a9f){_0x48b35c['push'](_0x48b35c['shift']());}};_0x46fc38(++_0x568f70);}(_0x54e8,0x149));var _0x854e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x54e8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x854e('0x0'));var util=require('util');var moment=require(_0x854e('0x1'));var BPromise=require(_0x854e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x854e('0x3'));var db=require(_0x854e('0x4'))['db'];var utils=require(_0x854e('0x5'));var logger=require(_0x854e('0x6'))(_0x854e('0x7'));var config=require(_0x854e('0x8'));var jayson=require(_0x854e('0x9'));var client=jayson[_0x854e('0xa')][_0x854e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1954ee,_0x50215e,_0x48485b){return new BPromise(function(_0x1ed4ba,_0x177950){return client[_0x854e('0xc')](_0x1954ee,_0x48485b)['then'](function(_0x4297d9){logger[_0x854e('0xd')]('Sound,\x20%s,\x20%s',_0x50215e,'request\x20sent');logger[_0x854e('0xe')](_0x854e('0xf'),_0x50215e,'request\x20sent',JSON[_0x854e('0x10')](_0x4297d9));if(_0x4297d9[_0x854e('0x11')]){if(_0x4297d9['error'][_0x854e('0x12')]===0x1f4){logger['error'](_0x854e('0x13'),_0x50215e,_0x4297d9[_0x854e('0x11')][_0x854e('0x14')]);return _0x177950(_0x4297d9['error'][_0x854e('0x14')]);}logger[_0x854e('0x11')](_0x854e('0x13'),_0x50215e,_0x4297d9[_0x854e('0x11')][_0x854e('0x14')]);return _0x1ed4ba(_0x4297d9[_0x854e('0x11')]['message']);}else{logger[_0x854e('0xd')]('Sound,\x20%s,\x20%s',_0x50215e,'request\x20sent');_0x1ed4ba(_0x4297d9['result'][_0x854e('0x14')]);}})[_0x854e('0x15')](function(_0x2aa4ba){logger[_0x854e('0x11')]('Sound,\x20%s,\x20%s',_0x50215e,_0x2aa4ba);_0x177950(_0x2aa4ba);});});}exports[_0x854e('0x16')]=function(_0xd5b137){var _0x27e94b=this;return new Promise(function(_0x26b76d,_0x1981f3){return db[_0x854e('0x17')]['find']({'raw':_0xd5b137['options']?_0xd5b137[_0x854e('0x18')][_0x854e('0x19')]===undefined?!![]:![]:!![],'where':_0xd5b137['options']?_0xd5b137[_0x854e('0x18')][_0x854e('0x1a')]||null:null,'attributes':_0xd5b137[_0x854e('0x18')]?_0xd5b137[_0x854e('0x18')]['attributes']||null:null,'include':_0xd5b137[_0x854e('0x18')]?_0xd5b137[_0x854e('0x18')][_0x854e('0x1b')]?_[_0x854e('0x1c')](_0xd5b137['options'][_0x854e('0x1b')],function(_0x516cc2){return{'model':db[_0x516cc2[_0x854e('0x1d')]],'as':_0x516cc2['as'],'attributes':_0x516cc2[_0x854e('0x1e')],'include':_0x516cc2[_0x854e('0x1b')]?_[_0x854e('0x1c')](_0x516cc2[_0x854e('0x1b')],function(_0x4fbc92){return{'model':db[_0x4fbc92[_0x854e('0x1d')]],'as':_0x4fbc92['as'],'attributes':_0x4fbc92['attributes'],'include':_0x4fbc92[_0x854e('0x1b')]?_[_0x854e('0x1c')](_0x4fbc92[_0x854e('0x1b')],function(_0x55967a){return{'model':db[_0x55967a[_0x854e('0x1d')]],'as':_0x55967a['as'],'attributes':_0x55967a[_0x854e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x854e('0x1f')](function(_0x1cbac5){logger['info'](_0x854e('0x16'),_0xd5b137);logger[_0x854e('0xe')](_0x854e('0x16'),_0xd5b137,JSON[_0x854e('0x10')](_0x1cbac5));_0x26b76d(_0x1cbac5);})[_0x854e('0x15')](function(_0x3915e9){logger[_0x854e('0x11')](_0x854e('0x16'),_0x3915e9[_0x854e('0x14')],_0xd5b137);_0x1981f3(_0x27e94b['error'](0x1f4,_0x3915e9[_0x854e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 8930cb9..6948e9e 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 _0x580f=['util','path','connect-timeout','express','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x2a0fc4,_0x2eaf74){var _0x531d00=function(_0xa4388f){while(--_0xa4388f){_0x2a0fc4['push'](_0x2a0fc4['shift']());}};_0x531d00(++_0x2eaf74);}(_0x580f,0x8c));var _0xf580=function(_0x958c08,_0x21cb68){_0x958c08=_0x958c08-0x0;var _0x40aef4=_0x580f[_0x958c08];return _0x40aef4;};'use strict';var multer=require('multer');var util=require(_0xf580('0x0'));var path=require(_0xf580('0x1'));var timeout=require(_0xf580('0x2'));var express=require(_0xf580('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf580('0x4'));var config=require('../../config/environment');var controller=require('./squareMessage.controller');router[_0xf580('0x5')]('/',auth[_0xf580('0x6')](),controller[_0xf580('0x7')]);router[_0xf580('0x5')](_0xf580('0x8'),auth[_0xf580('0x6')](),controller[_0xf580('0x9')]);router[_0xf580('0xa')]('/',auth[_0xf580('0x6')](),controller[_0xf580('0xb')]);router[_0xf580('0xc')](_0xf580('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xf580('0xd')](_0xf580('0x8'),auth[_0xf580('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7201=['multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy'];(function(_0x36a1d4,_0x5c3a68){var _0x5eadb5=function(_0x5d9ca0){while(--_0x5d9ca0){_0x36a1d4['push'](_0x36a1d4['shift']());}};_0x5eadb5(++_0x5c3a68);}(_0x7201,0xd8));var _0x1720=function(_0x4bfd56,_0x571439){_0x4bfd56=_0x4bfd56-0x0;var _0xae6ee2=_0x7201[_0x4bfd56];return _0xae6ee2;};'use strict';var multer=require(_0x1720('0x0'));var util=require('util');var path=require(_0x1720('0x1'));var timeout=require(_0x1720('0x2'));var express=require(_0x1720('0x3'));var router=express[_0x1720('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1720('0x5'));var config=require(_0x1720('0x6'));var controller=require(_0x1720('0x7'));router[_0x1720('0x8')]('/',auth[_0x1720('0x9')](),controller[_0x1720('0xa')]);router[_0x1720('0x8')](_0x1720('0xb'),auth[_0x1720('0x9')](),controller['show']);router[_0x1720('0xc')]('/',auth[_0x1720('0x9')](),controller[_0x1720('0xd')]);router[_0x1720('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x1720('0xf')]);router[_0x1720('0x10')](_0x1720('0xb'),auth['isAuthenticated'](),controller[_0x1720('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index a3820b9..d5ae27d 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 _0x723e=['STRING','TEXT','medium','ENUM','out','exports'];(function(_0x10b4fc,_0x24b4f1){var _0x427d62=function(_0x4c8116){while(--_0x4c8116){_0x10b4fc['push'](_0x10b4fc['shift']());}};_0x427d62(++_0x24b4f1);}(_0x723e,0x179));var _0xe723=function(_0x5d184e,_0x36df53){_0x5d184e=_0x5d184e-0x0;var _0x7610a2=_0x723e[_0x5d184e];return _0x7610a2;};'use strict';var Sequelize=require('sequelize');module[_0xe723('0x0')]={'uniqueid':{'type':Sequelize[_0xe723('0x1')]},'body':{'type':Sequelize[_0xe723('0x2')](_0xe723('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xe723('0x4')]('in',_0xe723('0x5')),'defaultValue':_0xe723('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe723('0x1')]},'providerResponse':{'type':Sequelize[_0xe723('0x2')]}}; \ No newline at end of file +var _0xd67b=['ENUM','out','exports','TEXT','medium'];(function(_0x2aa161,_0x236bf0){var _0x23f86d=function(_0xe0584){while(--_0xe0584){_0x2aa161['push'](_0x2aa161['shift']());}};_0x23f86d(++_0x236bf0);}(_0xd67b,0x133));var _0xbd67=function(_0x308354,_0x4433a5){_0x308354=_0x308354-0x0;var _0x38d4e9=_0xd67b[_0x308354];return _0x38d4e9;};'use strict';var Sequelize=require('sequelize');module[_0xbd67('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xbd67('0x1')](_0xbd67('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0xbd67('0x3')]('in','out'),'defaultValue':_0xbd67('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xbd67('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 0245d51..df65b80 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 _0xf390=['query','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','params','create','body','find','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','destroy','error','stack','name','send','index','SquareMessage','rawAttributes','fieldName','key','model','keys','filters','intersection'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xf390,0x12a));var _0x0f39=function(_0x1ef026,_0x3361e1){_0x1ef026=_0x1ef026-0x0;var _0x5625fd=_0xf390[_0x1ef026];return _0x5625fd;};'use strict';var pdf=require(_0x0f39('0x0'));var emlformat=require(_0x0f39('0x1'));var rimraf=require(_0x0f39('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0f39('0x3'));var moment=require(_0x0f39('0x4'));var BPromise=require(_0x0f39('0x5'));var Mustache=require('mustache');var util=require(_0x0f39('0x6'));var path=require(_0x0f39('0x7'));var sox=require(_0x0f39('0x8'));var csv=require(_0x0f39('0x9'));var ejs=require(_0x0f39('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0f39('0xb'));var crypto=require(_0x0f39('0xc'));var jsforce=require(_0x0f39('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0f39('0x9'));var querystring=require(_0x0f39('0xe'));var Papa=require('papaparse');var Redis=require(_0x0f39('0xf'));var authService=require(_0x0f39('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f39('0x11'));var logger=require(_0x0f39('0x12'))('api');var utils=require(_0x0f39('0x13'));var config=require(_0x0f39('0x14'));var licenseUtil=require(_0x0f39('0x15'));var db=require(_0x0f39('0x16'))['db'];function respondWithStatusCode(_0x353806,_0x5d6773){_0x5d6773=_0x5d6773||0xcc;return function(_0x1131db){if(_0x1131db){return _0x353806[_0x0f39('0x17')](_0x5d6773);}return _0x353806['status'](_0x5d6773)['end']();};}function respondWithResult(_0x1d0503,_0x5d59a9){_0x5d59a9=_0x5d59a9||0xc8;return function(_0x5a2cb9){if(_0x5a2cb9){return _0x1d0503[_0x0f39('0x18')](_0x5d59a9)[_0x0f39('0x19')](_0x5a2cb9);}};}function respondWithFilteredResult(_0x48bea9,_0x3a1659){return function(_0x34cfb7){if(_0x34cfb7){var _0x1b8322=_0x34cfb7[_0x0f39('0x1a')],_0x17e158=_0x3a1659[_0x0f39('0x1b')],_0x22a356=_0x3a1659[_0x0f39('0x1b')]+_0x3a1659[_0x0f39('0x1c')],_0x37613e;if(_0x22a356>=_0x1b8322){_0x22a356=_0x1b8322;_0x37613e=0xc8;}else{_0x37613e=0xce;}_0x48bea9[_0x0f39('0x18')](_0x37613e);return _0x48bea9['set'](_0x0f39('0x1d'),_0x17e158+'-'+_0x22a356+'/'+_0x1b8322)[_0x0f39('0x19')](_0x34cfb7);}return null;};}function patchUpdates(_0x511e3d){return function(_0x22569b){try{jsonpatch['apply'](_0x22569b,_0x511e3d,!![]);}catch(_0x6548b4){return BPromise[_0x0f39('0x1e')](_0x6548b4);}return _0x22569b[_0x0f39('0x1f')]();};}function saveUpdates(_0x4f427d,_0x4eaf38){return function(_0x239861){if(_0x239861){return _0x239861[_0x0f39('0x20')](_0x4f427d)['then'](function(_0x5db7a4){return _0x5db7a4;});}return null;};}function removeEntity(_0x3441fe,_0x34106a){return function(_0xdebf69){if(_0xdebf69){return _0xdebf69[_0x0f39('0x21')]()['then'](function(){_0x3441fe[_0x0f39('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29a0ab,_0x440235){return function(_0x52e1a2){if(!_0x52e1a2){_0x29a0ab[_0x0f39('0x17')](0x194);}return _0x52e1a2;};}function handleError(_0x4783ff,_0x6ab593){_0x6ab593=_0x6ab593||0x1f4;return function(_0x3cb140){logger[_0x0f39('0x22')](_0x3cb140[_0x0f39('0x23')]);if(_0x3cb140[_0x0f39('0x24')]){delete _0x3cb140[_0x0f39('0x24')];}_0x4783ff['status'](_0x6ab593)[_0x0f39('0x25')](_0x3cb140);};}exports[_0x0f39('0x26')]=function(_0x3fd093,_0x5236c8){var _0x21e705={},_0x269c34={},_0x364e4d={'count':0x0,'rows':[]};var _0x1031da=_['map'](db[_0x0f39('0x27')][_0x0f39('0x28')],function(_0x4ec624){return{'name':_0x4ec624[_0x0f39('0x29')],'type':_0x4ec624['type'][_0x0f39('0x2a')]};});_0x269c34[_0x0f39('0x2b')]=_['map'](_0x1031da,_0x0f39('0x24'));_0x269c34['query']=_[_0x0f39('0x2c')](_0x3fd093['query']);_0x269c34[_0x0f39('0x2d')]=_[_0x0f39('0x2e')](_0x269c34['model'],_0x269c34[_0x0f39('0x2f')]);_0x21e705[_0x0f39('0x30')]=_[_0x0f39('0x2e')](_0x269c34[_0x0f39('0x2b')],qs[_0x0f39('0x31')](_0x3fd093[_0x0f39('0x2f')][_0x0f39('0x31')]));_0x21e705[_0x0f39('0x30')]=_0x21e705[_0x0f39('0x30')][_0x0f39('0x32')]?_0x21e705[_0x0f39('0x30')]:_0x269c34[_0x0f39('0x2b')];if(!_0x3fd093['query'][_0x0f39('0x33')]('nolimit')){_0x21e705['limit']=qs[_0x0f39('0x1c')](_0x3fd093[_0x0f39('0x2f')][_0x0f39('0x1c')]);_0x21e705[_0x0f39('0x1b')]=qs[_0x0f39('0x1b')](_0x3fd093['query'][_0x0f39('0x1b')]);}_0x21e705['order']=qs[_0x0f39('0x34')](_0x3fd093[_0x0f39('0x2f')][_0x0f39('0x34')]);_0x21e705[_0x0f39('0x35')]=qs[_0x0f39('0x2d')](_[_0x0f39('0x36')](_0x3fd093[_0x0f39('0x2f')],_0x269c34[_0x0f39('0x2d')]),_0x1031da);if(_0x3fd093[_0x0f39('0x2f')]['filter']){_0x21e705['where']=_[_0x0f39('0x37')](_0x21e705['where'],{'$or':_['map'](_0x1031da,function(_0x53ca16){if(_0x53ca16[_0x0f39('0x38')]!==_0x0f39('0x39')){var _0x3c9718={};_0x3c9718[_0x53ca16['name']]={'$like':'%'+_0x3fd093[_0x0f39('0x2f')]['filter']+'%'};return _0x3c9718;}})});}_0x21e705=_[_0x0f39('0x37')]({},_0x21e705,_0x3fd093[_0x0f39('0x3a')]);var _0x1a1339={'where':_0x21e705[_0x0f39('0x35')]};return db['SquareMessage']['count'](_0x1a1339)[_0x0f39('0x3b')](function(_0x49e4b8){_0x364e4d[_0x0f39('0x1a')]=_0x49e4b8;if(_0x3fd093[_0x0f39('0x2f')][_0x0f39('0x3c')]){_0x21e705[_0x0f39('0x3d')]=[{'all':!![]}];}return db[_0x0f39('0x27')][_0x0f39('0x3e')](_0x21e705);})[_0x0f39('0x3b')](function(_0x4f3584){_0x364e4d[_0x0f39('0x3f')]=_0x4f3584;return _0x364e4d;})[_0x0f39('0x3b')](respondWithFilteredResult(_0x5236c8,_0x21e705))[_0x0f39('0x40')](handleError(_0x5236c8,null));};exports['show']=function(_0x31ea48,_0x4716c2){var _0x307a7f={'raw':!![],'where':{'id':_0x31ea48[_0x0f39('0x41')]['id']}},_0x20a0e2={};_0x20a0e2[_0x0f39('0x2b')]=_[_0x0f39('0x2c')](db[_0x0f39('0x27')][_0x0f39('0x28')]);_0x20a0e2[_0x0f39('0x2f')]=_[_0x0f39('0x2c')](_0x31ea48[_0x0f39('0x2f')]);_0x20a0e2['filters']=_[_0x0f39('0x2e')](_0x20a0e2[_0x0f39('0x2b')],_0x20a0e2[_0x0f39('0x2f')]);_0x307a7f['attributes']=_[_0x0f39('0x2e')](_0x20a0e2[_0x0f39('0x2b')],qs[_0x0f39('0x31')](_0x31ea48[_0x0f39('0x2f')]['fields']));_0x307a7f[_0x0f39('0x30')]=_0x307a7f[_0x0f39('0x30')][_0x0f39('0x32')]?_0x307a7f['attributes']:_0x20a0e2[_0x0f39('0x2b')];if(_0x31ea48['query'][_0x0f39('0x3c')]){_0x307a7f['include']=[{'all':!![]}];}_0x307a7f=_[_0x0f39('0x37')]({},_0x307a7f,_0x31ea48[_0x0f39('0x3a')]);return db[_0x0f39('0x27')]['find'](_0x307a7f)[_0x0f39('0x3b')](handleEntityNotFound(_0x4716c2,null))['then'](respondWithResult(_0x4716c2,null))[_0x0f39('0x40')](handleError(_0x4716c2,null));};exports[_0x0f39('0x42')]=function(_0x1cd959,_0xce6102){return db[_0x0f39('0x27')]['create'](_0x1cd959['body'],{})[_0x0f39('0x3b')](respondWithResult(_0xce6102,0xc9))[_0x0f39('0x40')](handleError(_0xce6102,null));};exports[_0x0f39('0x20')]=function(_0x1fa0b1,_0x386222){if(_0x1fa0b1[_0x0f39('0x43')]['id']){delete _0x1fa0b1[_0x0f39('0x43')]['id'];}return db[_0x0f39('0x27')][_0x0f39('0x44')]({'where':{'id':_0x1fa0b1[_0x0f39('0x41')]['id']}})[_0x0f39('0x3b')](handleEntityNotFound(_0x386222,null))['then'](saveUpdates(_0x1fa0b1[_0x0f39('0x43')],null))['then'](respondWithResult(_0x386222,null))['catch'](handleError(_0x386222,null));};exports[_0x0f39('0x21')]=function(_0x3022fe,_0x1b3517){return db['SquareMessage'][_0x0f39('0x44')]({'where':{'id':_0x3022fe['params']['id']}})[_0x0f39('0x3b')](handleEntityNotFound(_0x1b3517,null))[_0x0f39('0x3b')](removeEntity(_0x1b3517,null))[_0x0f39('0x40')](handleError(_0x1b3517,null));}; \ No newline at end of file +var _0x1419=['html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','limit','set','Content-Range','apply','save','update','destroy','error','name','send','index','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','offset','order','sort','where','filters','pick','merge','map','VIRTUAL','filter','options','SquareMessage','includeAll','include','findAll','rows','then','params','keys','rawAttributes','find','create','body','catch'];(function(_0x586fdb,_0x3f61c9){var _0x43d731=function(_0x71cccc){while(--_0x71cccc){_0x586fdb['push'](_0x586fdb['shift']());}};_0x43d731(++_0x3f61c9);}(_0x1419,0x1bc));var _0x9141=function(_0x2ad4e6,_0x29e609){_0x2ad4e6=_0x2ad4e6-0x0;var _0x4242c1=_0x1419[_0x2ad4e6];return _0x4242c1;};'use strict';var pdf=require(_0x9141('0x0'));var emlformat=require(_0x9141('0x1'));var rimraf=require(_0x9141('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9141('0x3'));var rp=require(_0x9141('0x4'));var moment=require(_0x9141('0x5'));var BPromise=require(_0x9141('0x6'));var Mustache=require('mustache');var util=require(_0x9141('0x7'));var path=require('path');var sox=require(_0x9141('0x8'));var csv=require('to-csv');var ejs=require(_0x9141('0x9'));var fs=require('fs');var _=require(_0x9141('0xa'));var squel=require('squel');var crypto=require(_0x9141('0xb'));var jsforce=require(_0x9141('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9141('0xd'));var querystring=require(_0x9141('0xe'));var Papa=require(_0x9141('0xf'));var Redis=require(_0x9141('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9141('0x11'));var as=require(_0x9141('0x12'));var hardwareService=require(_0x9141('0x13'));var logger=require(_0x9141('0x14'))(_0x9141('0x15'));var utils=require(_0x9141('0x16'));var config=require(_0x9141('0x17'));var licenseUtil=require(_0x9141('0x18'));var db=require(_0x9141('0x19'))['db'];function respondWithStatusCode(_0xd7a90c,_0x43eb00){_0x43eb00=_0x43eb00||0xcc;return function(_0x23570a){if(_0x23570a){return _0xd7a90c['sendStatus'](_0x43eb00);}return _0xd7a90c[_0x9141('0x1a')](_0x43eb00)[_0x9141('0x1b')]();};}function respondWithResult(_0x37d22f,_0x5b0dcf){_0x5b0dcf=_0x5b0dcf||0xc8;return function(_0x2e1e57){if(_0x2e1e57){return _0x37d22f[_0x9141('0x1a')](_0x5b0dcf)[_0x9141('0x1c')](_0x2e1e57);}};}function respondWithFilteredResult(_0x47f5a0,_0x5e9e07){return function(_0x5155ca){if(_0x5155ca){var _0x4443ff=_0x5155ca[_0x9141('0x1d')],_0x165783=_0x5e9e07['offset'],_0x22ece0=_0x5e9e07['offset']+_0x5e9e07[_0x9141('0x1e')],_0x4e1115;if(_0x22ece0>=_0x4443ff){_0x22ece0=_0x4443ff;_0x4e1115=0xc8;}else{_0x4e1115=0xce;}_0x47f5a0['status'](_0x4e1115);return _0x47f5a0[_0x9141('0x1f')](_0x9141('0x20'),_0x165783+'-'+_0x22ece0+'/'+_0x4443ff)[_0x9141('0x1c')](_0x5155ca);}return null;};}function patchUpdates(_0x42dee8){return function(_0x52e763){try{jsonpatch[_0x9141('0x21')](_0x52e763,_0x42dee8,!![]);}catch(_0x291e3c){return BPromise['reject'](_0x291e3c);}return _0x52e763[_0x9141('0x22')]();};}function saveUpdates(_0x1c8063,_0x33fe1f){return function(_0x2515fb){if(_0x2515fb){return _0x2515fb[_0x9141('0x23')](_0x1c8063)['then'](function(_0x3637d2){return _0x3637d2;});}return null;};}function removeEntity(_0x1d1287,_0x35ef6a){return function(_0x3f4ffc){if(_0x3f4ffc){return _0x3f4ffc[_0x9141('0x24')]()['then'](function(){_0x1d1287['status'](0xcc)[_0x9141('0x1b')]();});}};}function handleEntityNotFound(_0x586cd5,_0x1de309){return function(_0x15a19a){if(!_0x15a19a){_0x586cd5['sendStatus'](0x194);}return _0x15a19a;};}function handleError(_0x1c081c,_0x1b4a32){_0x1b4a32=_0x1b4a32||0x1f4;return function(_0x881928){logger[_0x9141('0x25')](_0x881928['stack']);if(_0x881928[_0x9141('0x26')]){delete _0x881928[_0x9141('0x26')];}_0x1c081c[_0x9141('0x1a')](_0x1b4a32)[_0x9141('0x27')](_0x881928);};}exports[_0x9141('0x28')]=function(_0x4f2acc,_0x252c00){var _0x3dabc2={},_0x319246={},_0x4fcb94={'count':0x0,'rows':[]};var _0x31a426=_['map'](db['SquareMessage']['rawAttributes'],function(_0x3b3a10){return{'name':_0x3b3a10['fieldName'],'type':_0x3b3a10[_0x9141('0x29')][_0x9141('0x2a')]};});_0x319246['model']=_['map'](_0x31a426,_0x9141('0x26'));_0x319246[_0x9141('0x2b')]=_['keys'](_0x4f2acc[_0x9141('0x2b')]);_0x319246['filters']=_[_0x9141('0x2c')](_0x319246['model'],_0x319246[_0x9141('0x2b')]);_0x3dabc2[_0x9141('0x2d')]=_[_0x9141('0x2c')](_0x319246[_0x9141('0x2e')],qs[_0x9141('0x2f')](_0x4f2acc['query'][_0x9141('0x2f')]));_0x3dabc2[_0x9141('0x2d')]=_0x3dabc2['attributes'][_0x9141('0x30')]?_0x3dabc2['attributes']:_0x319246[_0x9141('0x2e')];if(!_0x4f2acc['query'][_0x9141('0x31')]('nolimit')){_0x3dabc2[_0x9141('0x1e')]=qs[_0x9141('0x1e')](_0x4f2acc[_0x9141('0x2b')][_0x9141('0x1e')]);_0x3dabc2[_0x9141('0x32')]=qs[_0x9141('0x32')](_0x4f2acc[_0x9141('0x2b')][_0x9141('0x32')]);}_0x3dabc2[_0x9141('0x33')]=qs[_0x9141('0x34')](_0x4f2acc[_0x9141('0x2b')]['sort']);_0x3dabc2[_0x9141('0x35')]=qs[_0x9141('0x36')](_[_0x9141('0x37')](_0x4f2acc[_0x9141('0x2b')],_0x319246[_0x9141('0x36')]),_0x31a426);if(_0x4f2acc[_0x9141('0x2b')]['filter']){_0x3dabc2[_0x9141('0x35')]=_[_0x9141('0x38')](_0x3dabc2['where'],{'$or':_[_0x9141('0x39')](_0x31a426,function(_0x448d3e){if(_0x448d3e[_0x9141('0x29')]!==_0x9141('0x3a')){var _0x172be1={};_0x172be1[_0x448d3e[_0x9141('0x26')]]={'$like':'%'+_0x4f2acc[_0x9141('0x2b')][_0x9141('0x3b')]+'%'};return _0x172be1;}})});}_0x3dabc2=_['merge']({},_0x3dabc2,_0x4f2acc[_0x9141('0x3c')]);var _0x239c0f={'where':_0x3dabc2['where']};return db[_0x9141('0x3d')][_0x9141('0x1d')](_0x239c0f)['then'](function(_0x5d6d6d){_0x4fcb94[_0x9141('0x1d')]=_0x5d6d6d;if(_0x4f2acc[_0x9141('0x2b')][_0x9141('0x3e')]){_0x3dabc2[_0x9141('0x3f')]=[{'all':!![]}];}return db[_0x9141('0x3d')][_0x9141('0x40')](_0x3dabc2);})['then'](function(_0x335137){_0x4fcb94[_0x9141('0x41')]=_0x335137;return _0x4fcb94;})[_0x9141('0x42')](respondWithFilteredResult(_0x252c00,_0x3dabc2))['catch'](handleError(_0x252c00,null));};exports['show']=function(_0x1a0a86,_0xa57043){var _0x1580f3={'raw':!![],'where':{'id':_0x1a0a86[_0x9141('0x43')]['id']}},_0x5792a8={};_0x5792a8[_0x9141('0x2e')]=_[_0x9141('0x44')](db[_0x9141('0x3d')][_0x9141('0x45')]);_0x5792a8[_0x9141('0x2b')]=_[_0x9141('0x44')](_0x1a0a86[_0x9141('0x2b')]);_0x5792a8[_0x9141('0x36')]=_[_0x9141('0x2c')](_0x5792a8['model'],_0x5792a8[_0x9141('0x2b')]);_0x1580f3['attributes']=_['intersection'](_0x5792a8[_0x9141('0x2e')],qs[_0x9141('0x2f')](_0x1a0a86[_0x9141('0x2b')][_0x9141('0x2f')]));_0x1580f3['attributes']=_0x1580f3[_0x9141('0x2d')][_0x9141('0x30')]?_0x1580f3[_0x9141('0x2d')]:_0x5792a8['model'];if(_0x1a0a86[_0x9141('0x2b')]['includeAll']){_0x1580f3[_0x9141('0x3f')]=[{'all':!![]}];}_0x1580f3=_[_0x9141('0x38')]({},_0x1580f3,_0x1a0a86[_0x9141('0x3c')]);return db[_0x9141('0x3d')][_0x9141('0x46')](_0x1580f3)[_0x9141('0x42')](handleEntityNotFound(_0xa57043,null))[_0x9141('0x42')](respondWithResult(_0xa57043,null))['catch'](handleError(_0xa57043,null));};exports[_0x9141('0x47')]=function(_0x259a80,_0xe14325){return db[_0x9141('0x3d')][_0x9141('0x47')](_0x259a80[_0x9141('0x48')],{})[_0x9141('0x42')](respondWithResult(_0xe14325,0xc9))[_0x9141('0x49')](handleError(_0xe14325,null));};exports['update']=function(_0xe86c28,_0x5232c){if(_0xe86c28[_0x9141('0x48')]['id']){delete _0xe86c28[_0x9141('0x48')]['id'];}return db[_0x9141('0x3d')]['find']({'where':{'id':_0xe86c28[_0x9141('0x43')]['id']}})['then'](handleEntityNotFound(_0x5232c,null))[_0x9141('0x42')](saveUpdates(_0xe86c28[_0x9141('0x48')],null))[_0x9141('0x42')](respondWithResult(_0x5232c,null))['catch'](handleError(_0x5232c,null));};exports[_0x9141('0x24')]=function(_0x53a097,_0x1eba32){return db[_0x9141('0x3d')][_0x9141('0x46')]({'where':{'id':_0x53a097[_0x9141('0x43')]['id']}})[_0x9141('0x42')](handleEntityNotFound(_0x1eba32,null))['then'](removeEntity(_0x1eba32,null))[_0x9141('0x49')](handleError(_0x1eba32,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index f92c00d..63cab42 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 _0x66e9=['square_messages','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./squareMessage.attributes','exports'];(function(_0x3b11f9,_0x8da90a){var _0x3bc3fb=function(_0x306b08){while(--_0x306b08){_0x3b11f9['push'](_0x3b11f9['shift']());}};_0x3bc3fb(++_0x8da90a);}(_0x66e9,0x123));var _0x966e=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0x66e9[_0x3e2fcf];return _0x497db7;};'use strict';var _=require(_0x966e('0x0'));var util=require(_0x966e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x966e('0x2'));var BPromise=require(_0x966e('0x3'));var rp=require(_0x966e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x966e('0x5'));var config=require(_0x966e('0x6'));var attributes=require(_0x966e('0x7'));module[_0x966e('0x8')]=function(_0x1c4708,_0x29d426){return _0x1c4708['define']('SquareMessage',attributes,{'tableName':_0x966e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4ae=['./squareMessage.attributes','exports','define','SquareMessage','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x56e2d3,_0x303138){var _0x432040=function(_0x53b4b3){while(--_0x53b4b3){_0x56e2d3['push'](_0x56e2d3['shift']());}};_0x432040(++_0x303138);}(_0xa4ae,0x1f3));var _0xea4a=function(_0x58b301,_0x45e991){_0x58b301=_0x58b301-0x0;var _0x2171b3=_0xa4ae[_0x58b301];return _0x2171b3;};'use strict';var _=require('lodash');var util=require(_0xea4a('0x0'));var logger=require(_0xea4a('0x1'))(_0xea4a('0x2'));var moment=require(_0xea4a('0x3'));var BPromise=require('bluebird');var rp=require(_0xea4a('0x4'));var fs=require('fs');var path=require(_0xea4a('0x5'));var rimraf=require(_0xea4a('0x6'));var config=require('../../config/environment');var attributes=require(_0xea4a('0x7'));module[_0xea4a('0x8')]=function(_0x349608,_0x4e5273){return _0x349608[_0xea4a('0x9')](_0xea4a('0xa'),attributes,{'tableName':'square_messages','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 115b374..a7fdf7c 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 _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x301916,_0x538b1d){var _0x53634f=function(_0xb97873){while(--_0xb97873){_0x301916['push'](_0x301916['shift']());}};_0x53634f(++_0x538b1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file +var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x526470,_0xd952d9){var _0x5b43f9=function(_0x30a2c8){while(--_0x30a2c8){_0x526470['push'](_0x526470['shift']());}};_0x5b43f9(++_0xd952d9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index df73561..f4dcd82 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 _0x6a28=['../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','/:id','show','/:id/test','isAuthenticated','15s','test','post','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x299c4b,_0x389c17){var _0x2d39a9=function(_0x4b99eb){while(--_0x4b99eb){_0x299c4b['push'](_0x299c4b['shift']());}};_0x2d39a9(++_0x389c17);}(_0x6a28,0x1c9));var _0x86a2=function(_0x4156e2,_0x3747fa){_0x4156e2=_0x4156e2-0x0;var _0x4fcacf=_0x6a28[_0x4156e2];return _0x4fcacf;};'use strict';var multer=require(_0x86a2('0x0'));var util=require(_0x86a2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x86a2('0x2'));var router=express[_0x86a2('0x3')]();var auth=require(_0x86a2('0x4'));var interaction=require(_0x86a2('0x5'));var config=require(_0x86a2('0x6'));var controller=require(_0x86a2('0x7'));router[_0x86a2('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x86a2('0x8')](_0x86a2('0x9'),auth['isAuthenticated'](),controller[_0x86a2('0xa')]);router['get'](_0x86a2('0xb'),auth[_0x86a2('0xc')](),timeout(_0x86a2('0xd')),controller[_0x86a2('0xe')]);router[_0x86a2('0xf')]('/',auth[_0x86a2('0xc')](),controller['create']);router[_0x86a2('0x10')]('/:id',auth[_0x86a2('0xc')](),controller[_0x86a2('0x11')]);router[_0x86a2('0x12')](_0x86a2('0x9'),auth[_0x86a2('0xc')](),controller[_0x86a2('0x13')]);module[_0x86a2('0x14')]=router; \ No newline at end of file +var _0x03e5=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','post','create','put'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0x03e5,0x128));var _0x503e=function(_0x4f70fc,_0x1c006b){_0x4f70fc=_0x4f70fc-0x0;var _0xde6b05=_0x03e5[_0x4f70fc];return _0xde6b05;};'use strict';var multer=require(_0x503e('0x0'));var util=require(_0x503e('0x1'));var path=require(_0x503e('0x2'));var timeout=require(_0x503e('0x3'));var express=require(_0x503e('0x4'));var router=express[_0x503e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x503e('0x6'));var config=require(_0x503e('0x7'));var controller=require('./squareOdbc.controller');router[_0x503e('0x8')]('/',auth[_0x503e('0x9')](),controller[_0x503e('0xa')]);router['get'](_0x503e('0xb'),auth[_0x503e('0x9')](),controller[_0x503e('0xc')]);router[_0x503e('0x8')](_0x503e('0xd'),auth[_0x503e('0x9')](),timeout(_0x503e('0xe')),controller[_0x503e('0xf')]);router[_0x503e('0x10')]('/',auth[_0x503e('0x9')](),controller[_0x503e('0x11')]);router[_0x503e('0x12')](_0x503e('0xb'),auth[_0x503e('0x9')](),controller['update']);router['delete'](_0x503e('0xb'),auth['isAuthenticated'](),controller[_0x503e('0x13')]);module[_0x503e('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 5bd9ee9..2f6f089 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 _0x1926=['exports','STRING','name','sequelize'];(function(_0x1aea25,_0x99afee){var _0x304215=function(_0x362065){while(--_0x362065){_0x1aea25['push'](_0x1aea25['shift']());}};_0x304215(++_0x99afee);}(_0x1926,0x16b));var _0x6192=function(_0x2a6505,_0x122a9c){_0x2a6505=_0x2a6505-0x0;var _0x46cbb4=_0x1926[_0x2a6505];return _0x46cbb4;};'use strict';var Sequelize=require(_0x6192('0x0'));module[_0x6192('0x1')]={'name':{'type':Sequelize[_0x6192('0x2')],'unique':_0x6192('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x6192('0x2')]},'description':{'type':Sequelize[_0x6192('0x2')]}}; \ No newline at end of file +var _0x1891=['sequelize','exports','STRING','name'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0x1891,0x1f4));var _0x1189=function(_0x1406ae,_0x292395){_0x1406ae=_0x1406ae-0x0;var _0x23a076=_0x1891[_0x1406ae];return _0x23a076;};'use strict';var Sequelize=require(_0x1189('0x0'));module[_0x1189('0x1')]={'name':{'type':Sequelize[_0x1189('0x2')],'unique':_0x1189('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1189('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index e69ee8b..838a533 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 _0x0906=['set','Content-Range','reject','save','update','then','destroy','get','ODBC','UserProfileResource','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','include','findAll','catch','show','params','fields','merge','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','dsn','odbc','openSync','closeSync','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit'];(function(_0x581ecb,_0x397f4a){var _0x5de5d6=function(_0x2190b7){while(--_0x2190b7){_0x581ecb['push'](_0x581ecb['shift']());}};_0x5de5d6(++_0x397f4a);}(_0x0906,0x132));var _0x6090=function(_0x5f27d0,_0x132e9f){_0x5f27d0=_0x5f27d0-0x0;var _0x507ef0=_0x0906[_0x5f27d0];return _0x507ef0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6090('0x0'));var jsonpatch=require(_0x6090('0x1'));var rp=require(_0x6090('0x2'));var moment=require('moment');var BPromise=require(_0x6090('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6090('0x4'));var sox=require(_0x6090('0x5'));var csv=require(_0x6090('0x6'));var ejs=require(_0x6090('0x7'));var fs=require('fs');var _=require(_0x6090('0x8'));var squel=require(_0x6090('0x9'));var crypto=require(_0x6090('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6090('0xb'));var Papa=require(_0x6090('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6090('0xd'));var as=require(_0x6090('0xe'));var hardwareService=require(_0x6090('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x6090('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x6090('0x11'));var db=require(_0x6090('0x12'))['db'];function respondWithStatusCode(_0x380217,_0x337555){_0x337555=_0x337555||0xcc;return function(_0x418779){if(_0x418779){return _0x380217[_0x6090('0x13')](_0x337555);}return _0x380217[_0x6090('0x14')](_0x337555)[_0x6090('0x15')]();};}function respondWithResult(_0x42acec,_0x54da7e){_0x54da7e=_0x54da7e||0xc8;return function(_0x46fd20){if(_0x46fd20){return _0x42acec[_0x6090('0x14')](_0x54da7e)[_0x6090('0x16')](_0x46fd20);}};}function respondWithFilteredResult(_0xce0da8,_0x8275fa){return function(_0x457171){if(_0x457171){var _0x1c79dc=_0x457171[_0x6090('0x17')],_0x340458=_0x8275fa[_0x6090('0x18')],_0x33809e=_0x8275fa['offset']+_0x8275fa[_0x6090('0x19')],_0x446ee1;if(_0x33809e>=_0x1c79dc){_0x33809e=_0x1c79dc;_0x446ee1=0xc8;}else{_0x446ee1=0xce;}_0xce0da8['status'](_0x446ee1);return _0xce0da8[_0x6090('0x1a')](_0x6090('0x1b'),_0x340458+'-'+_0x33809e+'/'+_0x1c79dc)['json'](_0x457171);}return null;};}function patchUpdates(_0x5dea2e){return function(_0x538d39){try{jsonpatch['apply'](_0x538d39,_0x5dea2e,!![]);}catch(_0x16128c){return BPromise[_0x6090('0x1c')](_0x16128c);}return _0x538d39[_0x6090('0x1d')]();};}function saveUpdates(_0x25c0d0,_0x5812b9){return function(_0x1ce9ef){if(_0x1ce9ef){return _0x1ce9ef[_0x6090('0x1e')](_0x25c0d0)[_0x6090('0x1f')](function(_0x519603){return _0x519603;});}return null;};}function removeEntity(_0x438869,_0x4df764){return function(_0x38da5e){if(_0x38da5e){return _0x38da5e[_0x6090('0x20')]()['then'](function(){var _0x4d2976=_0x38da5e[_0x6090('0x21')]({'plain':!![]});var _0x42b8bd=_0x6090('0x22');return db[_0x6090('0x23')][_0x6090('0x20')]({'where':{'type':_0x42b8bd,'resourceId':_0x4d2976['id']}})[_0x6090('0x1f')](function(){return _0x38da5e;});})['then'](function(){_0x438869['status'](0xcc)[_0x6090('0x15')]();});}};}function handleEntityNotFound(_0x1ed15e,_0x57a353){return function(_0x32de41){if(!_0x32de41){_0x1ed15e[_0x6090('0x13')](0x194);}return _0x32de41;};}function handleError(_0x47b661,_0x5ff3f){_0x5ff3f=_0x5ff3f||0x1f4;return function(_0x5df849){logger['error'](_0x5df849[_0x6090('0x24')]);if(_0x5df849[_0x6090('0x25')]){delete _0x5df849[_0x6090('0x25')];}_0x47b661[_0x6090('0x14')](_0x5ff3f)['send'](_0x5df849);};}exports[_0x6090('0x26')]=function(_0x2fbe7f,_0x43259c){var _0x54d5e7={},_0x5f3f42={},_0x45fcf8={'count':0x0,'rows':[]};var _0x2fcd8a=_[_0x6090('0x27')](db[_0x6090('0x28')][_0x6090('0x29')],function(_0x165d9c){return{'name':_0x165d9c[_0x6090('0x2a')],'type':_0x165d9c[_0x6090('0x2b')][_0x6090('0x2c')]};});_0x5f3f42[_0x6090('0x2d')]=_['map'](_0x2fcd8a,_0x6090('0x25'));_0x5f3f42['query']=_[_0x6090('0x2e')](_0x2fbe7f[_0x6090('0x2f')]);_0x5f3f42[_0x6090('0x30')]=_[_0x6090('0x31')](_0x5f3f42['model'],_0x5f3f42[_0x6090('0x2f')]);_0x54d5e7[_0x6090('0x32')]=_[_0x6090('0x31')](_0x5f3f42[_0x6090('0x2d')],qs['fields'](_0x2fbe7f[_0x6090('0x2f')]['fields']));_0x54d5e7[_0x6090('0x32')]=_0x54d5e7[_0x6090('0x32')][_0x6090('0x33')]?_0x54d5e7[_0x6090('0x32')]:_0x5f3f42[_0x6090('0x2d')];if(!_0x2fbe7f[_0x6090('0x2f')][_0x6090('0x34')](_0x6090('0x35'))){_0x54d5e7[_0x6090('0x19')]=qs[_0x6090('0x19')](_0x2fbe7f[_0x6090('0x2f')]['limit']);_0x54d5e7[_0x6090('0x18')]=qs[_0x6090('0x18')](_0x2fbe7f['query']['offset']);}_0x54d5e7[_0x6090('0x36')]=qs['sort'](_0x2fbe7f['query'][_0x6090('0x37')]);_0x54d5e7[_0x6090('0x38')]=qs[_0x6090('0x30')](_[_0x6090('0x39')](_0x2fbe7f[_0x6090('0x2f')],_0x5f3f42[_0x6090('0x30')]),_0x2fcd8a);if(_0x2fbe7f[_0x6090('0x2f')][_0x6090('0x3a')]){_0x54d5e7['where']=_['merge'](_0x54d5e7[_0x6090('0x38')],{'$or':_[_0x6090('0x27')](_0x2fcd8a,function(_0x2b6c9b){if(_0x2b6c9b[_0x6090('0x2b')]!=='VIRTUAL'){var _0x2cdc65={};_0x2cdc65[_0x2b6c9b[_0x6090('0x25')]]={'$like':'%'+_0x2fbe7f[_0x6090('0x2f')][_0x6090('0x3a')]+'%'};return _0x2cdc65;}})});}_0x54d5e7=_['merge']({},_0x54d5e7,_0x2fbe7f['options']);var _0x34fb6e={'where':_0x54d5e7[_0x6090('0x38')]};return db[_0x6090('0x28')][_0x6090('0x17')](_0x34fb6e)['then'](function(_0x17e5d3){_0x45fcf8['count']=_0x17e5d3;if(_0x2fbe7f['query'][_0x6090('0x3b')]){_0x54d5e7[_0x6090('0x3c')]=[{'all':!![]}];}return db[_0x6090('0x28')][_0x6090('0x3d')](_0x54d5e7);})['then'](function(_0x5651a3){_0x45fcf8['rows']=_0x5651a3;return _0x45fcf8;})[_0x6090('0x1f')](respondWithFilteredResult(_0x43259c,_0x54d5e7))[_0x6090('0x3e')](handleError(_0x43259c,null));};exports[_0x6090('0x3f')]=function(_0x5a39ed,_0x5c4c67){var _0x7c070a={'raw':!![],'where':{'id':_0x5a39ed[_0x6090('0x40')]['id']}},_0x445829={};_0x445829[_0x6090('0x2d')]=_[_0x6090('0x2e')](db[_0x6090('0x28')][_0x6090('0x29')]);_0x445829[_0x6090('0x2f')]=_[_0x6090('0x2e')](_0x5a39ed['query']);_0x445829[_0x6090('0x30')]=_[_0x6090('0x31')](_0x445829[_0x6090('0x2d')],_0x445829[_0x6090('0x2f')]);_0x7c070a[_0x6090('0x32')]=_[_0x6090('0x31')](_0x445829[_0x6090('0x2d')],qs[_0x6090('0x41')](_0x5a39ed[_0x6090('0x2f')][_0x6090('0x41')]));_0x7c070a[_0x6090('0x32')]=_0x7c070a['attributes'][_0x6090('0x33')]?_0x7c070a['attributes']:_0x445829[_0x6090('0x2d')];if(_0x5a39ed['query'][_0x6090('0x3b')]){_0x7c070a[_0x6090('0x3c')]=[{'all':!![]}];}_0x7c070a=_[_0x6090('0x42')]({},_0x7c070a,_0x5a39ed[_0x6090('0x43')]);return db[_0x6090('0x28')]['find'](_0x7c070a)[_0x6090('0x1f')](handleEntityNotFound(_0x5c4c67,null))[_0x6090('0x1f')](respondWithResult(_0x5c4c67,null))[_0x6090('0x3e')](handleError(_0x5c4c67,null));};exports[_0x6090('0x44')]=function(_0x38246a,_0x38be1f){return db[_0x6090('0x28')][_0x6090('0x44')](_0x38246a[_0x6090('0x45')],{})['then'](function(_0x5ef9ae){var _0x5c25b5=_0x38246a['user']['get']({'plain':!![]});if(!_0x5c25b5)throw new Error(_0x6090('0x46'));if(_0x5c25b5[_0x6090('0x47')]===_0x6090('0x48')){var _0x154761=_0x5ef9ae[_0x6090('0x21')]({'plain':!![]});var _0x2c3e59=_0x6090('0x22');return db[_0x6090('0x49')]['find']({'where':{'name':_0x2c3e59,'userProfileId':_0x5c25b5[_0x6090('0x4a')]},'raw':!![]})[_0x6090('0x1f')](function(_0x293075){if(_0x293075&&_0x293075[_0x6090('0x4b')]===0x0){return db[_0x6090('0x23')][_0x6090('0x44')]({'name':_0x154761['name'],'resourceId':_0x154761['id'],'type':_0x293075['name'],'sectionId':_0x293075['id']},{})[_0x6090('0x1f')](function(){return _0x5ef9ae;});}else{return _0x5ef9ae;}})['catch'](function(_0x3b202b){logger[_0x6090('0x4c')](_0x6090('0x4d'),_0x3b202b);throw _0x3b202b;});}return _0x5ef9ae;})[_0x6090('0x1f')](respondWithResult(_0x38be1f,0xc9))[_0x6090('0x3e')](handleError(_0x38be1f,null));};exports['update']=function(_0x1d077a,_0x5da691){if(_0x1d077a[_0x6090('0x45')]['id']){delete _0x1d077a[_0x6090('0x45')]['id'];}return db[_0x6090('0x28')][_0x6090('0x4e')]({'where':{'id':_0x1d077a['params']['id']}})[_0x6090('0x1f')](handleEntityNotFound(_0x5da691,null))[_0x6090('0x1f')](saveUpdates(_0x1d077a['body'],null))[_0x6090('0x1f')](respondWithResult(_0x5da691,null))[_0x6090('0x3e')](handleError(_0x5da691,null));};exports['destroy']=function(_0x39e944,_0x32c89b){return db[_0x6090('0x28')][_0x6090('0x4e')]({'where':{'id':_0x39e944['params']['id']}})[_0x6090('0x1f')](handleEntityNotFound(_0x32c89b,null))['then'](removeEntity(_0x32c89b,null))[_0x6090('0x3e')](handleError(_0x32c89b,null));};exports['test']=function(_0x119f19,_0x492101,_0x14e9db){var _0x20e900;return db['SquareOdbc'][_0x6090('0x4e')]({'where':{'id':_0x119f19[_0x6090('0x40')]['id']},'attributes':['id',_0x6090('0x4f')]})[_0x6090('0x1f')](handleEntityNotFound(_0x492101,null))[_0x6090('0x1f')](function(_0x50cef9){if(_0x50cef9){var _0x5cb1a8=require(_0x6090('0x50'))();_0x5cb1a8[_0x6090('0x51')](_0x50cef9[_0x6090('0x4f')]);_0x5cb1a8[_0x6090('0x52')]();return _0x50cef9;}})[_0x6090('0x1f')](respondWithResult(_0x492101,null))[_0x6090('0x3e')](handleError(_0x492101,null));}; \ No newline at end of file +var _0x6c06=['../../config/license/util','../../mysqldb','status','json','offset','limit','set','Content-Range','reject','save','update','then','get','ODBC','UserProfileResource','end','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','SquareOdbc','count','findAll','rows','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','error','test','odbc','openSync','dsn','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x731761,_0x7b2458){var _0x4f6d56=function(_0x49f3e2){while(--_0x49f3e2){_0x731761['push'](_0x731761['shift']());}};_0x4f6d56(++_0x7b2458);}(_0x6c06,0x1e5));var _0x66c0=function(_0x39e643,_0x5a491c){_0x39e643=_0x39e643-0x0;var _0x27014e=_0x6c06[_0x39e643];return _0x27014e;};'use strict';var pdf=require(_0x66c0('0x0'));var emlformat=require(_0x66c0('0x1'));var rimraf=require(_0x66c0('0x2'));var zipdir=require(_0x66c0('0x3'));var jsonpatch=require(_0x66c0('0x4'));var rp=require(_0x66c0('0x5'));var moment=require(_0x66c0('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x66c0('0x7'));var util=require('util');var path=require(_0x66c0('0x8'));var sox=require(_0x66c0('0x9'));var csv=require(_0x66c0('0xa'));var ejs=require(_0x66c0('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x66c0('0xc'));var crypto=require(_0x66c0('0xd'));var jsforce=require(_0x66c0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x66c0('0xa'));var querystring=require(_0x66c0('0xf'));var Papa=require(_0x66c0('0x10'));var Redis=require('ioredis');var authService=require(_0x66c0('0x11'));var qs=require(_0x66c0('0x12'));var as=require(_0x66c0('0x13'));var hardwareService=require(_0x66c0('0x14'));var logger=require(_0x66c0('0x15'))(_0x66c0('0x16'));var utils=require(_0x66c0('0x17'));var config=require(_0x66c0('0x18'));var licenseUtil=require(_0x66c0('0x19'));var db=require(_0x66c0('0x1a'))['db'];function respondWithStatusCode(_0x4aab7d,_0x5426a0){_0x5426a0=_0x5426a0||0xcc;return function(_0x3c818a){if(_0x3c818a){return _0x4aab7d['sendStatus'](_0x5426a0);}return _0x4aab7d['status'](_0x5426a0)['end']();};}function respondWithResult(_0x397dfb,_0x126e0c){_0x126e0c=_0x126e0c||0xc8;return function(_0x3b9442){if(_0x3b9442){return _0x397dfb[_0x66c0('0x1b')](_0x126e0c)[_0x66c0('0x1c')](_0x3b9442);}};}function respondWithFilteredResult(_0x525e98,_0x34675e){return function(_0x18ee04){if(_0x18ee04){var _0x10665a=_0x18ee04['count'],_0x3fea1c=_0x34675e[_0x66c0('0x1d')],_0x292cc2=_0x34675e[_0x66c0('0x1d')]+_0x34675e[_0x66c0('0x1e')],_0x847aa7;if(_0x292cc2>=_0x10665a){_0x292cc2=_0x10665a;_0x847aa7=0xc8;}else{_0x847aa7=0xce;}_0x525e98[_0x66c0('0x1b')](_0x847aa7);return _0x525e98[_0x66c0('0x1f')](_0x66c0('0x20'),_0x3fea1c+'-'+_0x292cc2+'/'+_0x10665a)[_0x66c0('0x1c')](_0x18ee04);}return null;};}function patchUpdates(_0x3625c0){return function(_0x61cc20){try{jsonpatch['apply'](_0x61cc20,_0x3625c0,!![]);}catch(_0x2aeb41){return BPromise[_0x66c0('0x21')](_0x2aeb41);}return _0x61cc20[_0x66c0('0x22')]();};}function saveUpdates(_0x365608,_0x5a904a){return function(_0x3898ef){if(_0x3898ef){return _0x3898ef[_0x66c0('0x23')](_0x365608)[_0x66c0('0x24')](function(_0x109ef0){return _0x109ef0;});}return null;};}function removeEntity(_0x6e52aa,_0x2290d1){return function(_0x3b7aa0){if(_0x3b7aa0){return _0x3b7aa0['destroy']()[_0x66c0('0x24')](function(){var _0x4f165f=_0x3b7aa0[_0x66c0('0x25')]({'plain':!![]});var _0x2b98a0=_0x66c0('0x26');return db[_0x66c0('0x27')]['destroy']({'where':{'type':_0x2b98a0,'resourceId':_0x4f165f['id']}})[_0x66c0('0x24')](function(){return _0x3b7aa0;});})['then'](function(){_0x6e52aa[_0x66c0('0x1b')](0xcc)[_0x66c0('0x28')]();});}};}function handleEntityNotFound(_0x3bf0d5,_0x3576fa){return function(_0x580094){if(!_0x580094){_0x3bf0d5['sendStatus'](0x194);}return _0x580094;};}function handleError(_0x4bf180,_0x1d1db3){_0x1d1db3=_0x1d1db3||0x1f4;return function(_0x671ff3){logger['error'](_0x671ff3[_0x66c0('0x29')]);if(_0x671ff3[_0x66c0('0x2a')]){delete _0x671ff3[_0x66c0('0x2a')];}_0x4bf180[_0x66c0('0x1b')](_0x1d1db3)[_0x66c0('0x2b')](_0x671ff3);};}exports['index']=function(_0x4eb492,_0x39236d){var _0x5d747e={},_0x27ff61={},_0xf0e851={'count':0x0,'rows':[]};var _0x4853cf=_[_0x66c0('0x2c')](db['SquareOdbc'][_0x66c0('0x2d')],function(_0x17d20a){return{'name':_0x17d20a[_0x66c0('0x2e')],'type':_0x17d20a[_0x66c0('0x2f')]['key']};});_0x27ff61[_0x66c0('0x30')]=_[_0x66c0('0x2c')](_0x4853cf,_0x66c0('0x2a'));_0x27ff61[_0x66c0('0x31')]=_[_0x66c0('0x32')](_0x4eb492['query']);_0x27ff61[_0x66c0('0x33')]=_[_0x66c0('0x34')](_0x27ff61['model'],_0x27ff61[_0x66c0('0x31')]);_0x5d747e[_0x66c0('0x35')]=_[_0x66c0('0x34')](_0x27ff61[_0x66c0('0x30')],qs[_0x66c0('0x36')](_0x4eb492[_0x66c0('0x31')][_0x66c0('0x36')]));_0x5d747e[_0x66c0('0x35')]=_0x5d747e[_0x66c0('0x35')]['length']?_0x5d747e['attributes']:_0x27ff61['model'];if(!_0x4eb492['query'][_0x66c0('0x37')]('nolimit')){_0x5d747e[_0x66c0('0x1e')]=qs[_0x66c0('0x1e')](_0x4eb492[_0x66c0('0x31')]['limit']);_0x5d747e['offset']=qs[_0x66c0('0x1d')](_0x4eb492[_0x66c0('0x31')][_0x66c0('0x1d')]);}_0x5d747e['order']=qs['sort'](_0x4eb492[_0x66c0('0x31')][_0x66c0('0x38')]);_0x5d747e[_0x66c0('0x39')]=qs[_0x66c0('0x33')](_[_0x66c0('0x3a')](_0x4eb492[_0x66c0('0x31')],_0x27ff61[_0x66c0('0x33')]),_0x4853cf);if(_0x4eb492[_0x66c0('0x31')][_0x66c0('0x3b')]){_0x5d747e['where']=_[_0x66c0('0x3c')](_0x5d747e[_0x66c0('0x39')],{'$or':_['map'](_0x4853cf,function(_0x2ca3be){if(_0x2ca3be[_0x66c0('0x2f')]!==_0x66c0('0x3d')){var _0x211829={};_0x211829[_0x2ca3be[_0x66c0('0x2a')]]={'$like':'%'+_0x4eb492[_0x66c0('0x31')][_0x66c0('0x3b')]+'%'};return _0x211829;}})});}_0x5d747e=_['merge']({},_0x5d747e,_0x4eb492[_0x66c0('0x3e')]);var _0xdb248e={'where':_0x5d747e[_0x66c0('0x39')]};return db[_0x66c0('0x3f')][_0x66c0('0x40')](_0xdb248e)['then'](function(_0x1d360e){_0xf0e851[_0x66c0('0x40')]=_0x1d360e;if(_0x4eb492[_0x66c0('0x31')]['includeAll']){_0x5d747e['include']=[{'all':!![]}];}return db['SquareOdbc'][_0x66c0('0x41')](_0x5d747e);})[_0x66c0('0x24')](function(_0x21f995){_0xf0e851[_0x66c0('0x42')]=_0x21f995;return _0xf0e851;})[_0x66c0('0x24')](respondWithFilteredResult(_0x39236d,_0x5d747e))['catch'](handleError(_0x39236d,null));};exports[_0x66c0('0x43')]=function(_0x44a1c7,_0x214f67){var _0x2cc501={'raw':!![],'where':{'id':_0x44a1c7[_0x66c0('0x44')]['id']}},_0x1d738d={};_0x1d738d['model']=_[_0x66c0('0x32')](db['SquareOdbc'][_0x66c0('0x2d')]);_0x1d738d[_0x66c0('0x31')]=_[_0x66c0('0x32')](_0x44a1c7['query']);_0x1d738d[_0x66c0('0x33')]=_[_0x66c0('0x34')](_0x1d738d[_0x66c0('0x30')],_0x1d738d[_0x66c0('0x31')]);_0x2cc501[_0x66c0('0x35')]=_[_0x66c0('0x34')](_0x1d738d[_0x66c0('0x30')],qs[_0x66c0('0x36')](_0x44a1c7[_0x66c0('0x31')]['fields']));_0x2cc501[_0x66c0('0x35')]=_0x2cc501[_0x66c0('0x35')][_0x66c0('0x45')]?_0x2cc501[_0x66c0('0x35')]:_0x1d738d['model'];if(_0x44a1c7[_0x66c0('0x31')]['includeAll']){_0x2cc501['include']=[{'all':!![]}];}_0x2cc501=_['merge']({},_0x2cc501,_0x44a1c7[_0x66c0('0x3e')]);return db[_0x66c0('0x3f')][_0x66c0('0x46')](_0x2cc501)['then'](handleEntityNotFound(_0x214f67,null))[_0x66c0('0x24')](respondWithResult(_0x214f67,null))['catch'](handleError(_0x214f67,null));};exports[_0x66c0('0x47')]=function(_0x14d9f9,_0xcac6aa){return db[_0x66c0('0x3f')][_0x66c0('0x47')](_0x14d9f9[_0x66c0('0x48')],{})['then'](function(_0x24ac77){var _0x363cba=_0x14d9f9[_0x66c0('0x49')][_0x66c0('0x25')]({'plain':!![]});if(!_0x363cba)throw new Error(_0x66c0('0x4a'));if(_0x363cba[_0x66c0('0x4b')]===_0x66c0('0x49')){var _0x51c17e=_0x24ac77[_0x66c0('0x25')]({'plain':!![]});var _0x42f607='ODBC';return db[_0x66c0('0x4c')][_0x66c0('0x46')]({'where':{'name':_0x42f607,'userProfileId':_0x363cba['userProfileId']},'raw':!![]})[_0x66c0('0x24')](function(_0x1d942a){if(_0x1d942a&&_0x1d942a[_0x66c0('0x4d')]===0x0){return db[_0x66c0('0x27')]['create']({'name':_0x51c17e['name'],'resourceId':_0x51c17e['id'],'type':_0x1d942a[_0x66c0('0x2a')],'sectionId':_0x1d942a['id']},{})[_0x66c0('0x24')](function(){return _0x24ac77;});}else{return _0x24ac77;}})[_0x66c0('0x4e')](function(_0x3dd440){logger[_0x66c0('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dd440);throw _0x3dd440;});}return _0x24ac77;})['then'](respondWithResult(_0xcac6aa,0xc9))[_0x66c0('0x4e')](handleError(_0xcac6aa,null));};exports[_0x66c0('0x23')]=function(_0xb1864e,_0x263988){if(_0xb1864e['body']['id']){delete _0xb1864e[_0x66c0('0x48')]['id'];}return db['SquareOdbc'][_0x66c0('0x46')]({'where':{'id':_0xb1864e[_0x66c0('0x44')]['id']}})[_0x66c0('0x24')](handleEntityNotFound(_0x263988,null))['then'](saveUpdates(_0xb1864e['body'],null))[_0x66c0('0x24')](respondWithResult(_0x263988,null))[_0x66c0('0x4e')](handleError(_0x263988,null));};exports['destroy']=function(_0x3a1c51,_0x5611e5){return db[_0x66c0('0x3f')][_0x66c0('0x46')]({'where':{'id':_0x3a1c51[_0x66c0('0x44')]['id']}})[_0x66c0('0x24')](handleEntityNotFound(_0x5611e5,null))['then'](removeEntity(_0x5611e5,null))[_0x66c0('0x4e')](handleError(_0x5611e5,null));};exports[_0x66c0('0x50')]=function(_0x514fd5,_0x18ee40,_0x2ada99){var _0x890430;return db['SquareOdbc']['find']({'where':{'id':_0x514fd5[_0x66c0('0x44')]['id']},'attributes':['id','dsn']})[_0x66c0('0x24')](handleEntityNotFound(_0x18ee40,null))[_0x66c0('0x24')](function(_0x3d3314){if(_0x3d3314){var _0x1ab55e=require(_0x66c0('0x51'))();_0x1ab55e[_0x66c0('0x52')](_0x3d3314[_0x66c0('0x53')]);_0x1ab55e[_0x66c0('0x54')]();return _0x3d3314;}})[_0x66c0('0x24')](respondWithResult(_0x18ee40,null))['catch'](handleError(_0x18ee40,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 50b93a9..9c5f1ff 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 _0x1724=['./squareOdbc.attributes','exports','define','SquareOdbc','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x3f4a8e,_0x507c39){var _0x7f68fd=function(_0x29890f){while(--_0x29890f){_0x3f4a8e['push'](_0x3f4a8e['shift']());}};_0x7f68fd(++_0x507c39);}(_0x1724,0xca));var _0x4172=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x1724[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x4172('0x0'));var util=require('util');var logger=require(_0x4172('0x1'))(_0x4172('0x2'));var moment=require(_0x4172('0x3'));var BPromise=require('bluebird');var rp=require(_0x4172('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4172('0x5'));var config=require(_0x4172('0x6'));var attributes=require(_0x4172('0x7'));module[_0x4172('0x8')]=function(_0x4bc1c7,_0x59e272){return _0x4bc1c7[_0x4172('0x9')](_0x4172('0xa'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf9f=['lodash','util','bluebird','path','rimraf','../../config/environment','define','SquareOdbc'];(function(_0x37cbc1,_0x224b70){var _0x528f9b=function(_0xda5316){while(--_0xda5316){_0x37cbc1['push'](_0x37cbc1['shift']());}};_0x528f9b(++_0x224b70);}(_0xcf9f,0x178));var _0xfcf9=function(_0x2263d8,_0x2f5193){_0x2263d8=_0x2263d8-0x0;var _0x43e672=_0xcf9f[_0x2263d8];return _0x43e672;};'use strict';var _=require(_0xfcf9('0x0'));var util=require(_0xfcf9('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfcf9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcf9('0x3'));var rimraf=require(_0xfcf9('0x4'));var config=require(_0xfcf9('0x5'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x1b7701,_0x5d7c40){return _0x1b7701[_0xfcf9('0x6')](_0xfcf9('0x7'),attributes,{'tableName':'square_odbc','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 702c019..f0389b5 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 _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','catch','ShowSquareOdbc','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x87cb2b,_0x33c1a6){var _0x152d0d=function(_0x26357e){while(--_0x26357e){_0x87cb2b['push'](_0x87cb2b['shift']());}};_0x152d0d(++_0x33c1a6);}(_0x5fc3,0xa8));var _0x35fc=function(_0x493a51,_0x45128c){_0x493a51=_0x493a51-0x0;var _0xc85756=_0x5fc3[_0x493a51];return _0xc85756;};'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')]('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('SquareOdbc,\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']('SquareOdbc,\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);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['SquareOdbc'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file +var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','catch','ShowSquareOdbc','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x14a83c,_0x394b54){var _0x345d56=function(_0x34cfcd){while(--_0x34cfcd){_0x14a83c['push'](_0x14a83c['shift']());}};_0x345d56(++_0x394b54);}(_0x5fc3,0xa8));var _0x35fc=function(_0x74745d,_0x177606){_0x74745d=_0x74745d-0x0;var _0x174ab3=_0x5fc3[_0x74745d];return _0x174ab3;};'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')]('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('SquareOdbc,\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']('SquareOdbc,\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);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['SquareOdbc'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index d447b60..82439f4 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 _0x6712=['multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./squareProject.controller','get','/:id','isAuthenticated','/:id/users','post','create','addUsers','put','update','destroy','removeUsers'];(function(_0x1ebe11,_0x5077c0){var _0x562626=function(_0x2a48b1){while(--_0x2a48b1){_0x1ebe11['push'](_0x1ebe11['shift']());}};_0x562626(++_0x5077c0);}(_0x6712,0xc6));var _0x2671=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x6712[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0x2671('0x0'));var util=require(_0x2671('0x1'));var path=require(_0x2671('0x2'));var timeout=require(_0x2671('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2671('0x4'));var config=require(_0x2671('0x5'));var controller=require(_0x2671('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2671('0x7')](_0x2671('0x8'),auth[_0x2671('0x9')](),controller['show']);router[_0x2671('0x7')](_0x2671('0xa'),auth[_0x2671('0x9')](),controller['getUsers']);router[_0x2671('0xb')]('/',auth[_0x2671('0x9')](),controller[_0x2671('0xc')]);router[_0x2671('0xb')](_0x2671('0xa'),auth[_0x2671('0x9')](),controller[_0x2671('0xd')]);router[_0x2671('0xe')](_0x2671('0x8'),auth['isAuthenticated'](),controller[_0x2671('0xf')]);router['delete'](_0x2671('0x8'),auth[_0x2671('0x9')](),controller[_0x2671('0x10')]);router['delete'](_0x2671('0xa'),auth['isAuthenticated'](),controller[_0x2671('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3de3=['update','delete','removeUsers','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id/users','post','create','addUsers','put','/:id'];(function(_0x3510be,_0x2cf8f5){var _0x737e04=function(_0x2527db){while(--_0x2527db){_0x3510be['push'](_0x3510be['shift']());}};_0x737e04(++_0x2cf8f5);}(_0x3de3,0x168));var _0x33de=function(_0x2f5c1b,_0x2c832c){_0x2f5c1b=_0x2f5c1b-0x0;var _0x30df81=_0x3de3[_0x2f5c1b];return _0x30df81;};'use strict';var multer=require('multer');var util=require(_0x33de('0x0'));var path=require(_0x33de('0x1'));var timeout=require(_0x33de('0x2'));var express=require(_0x33de('0x3'));var router=express[_0x33de('0x4')]();var auth=require(_0x33de('0x5'));var interaction=require(_0x33de('0x6'));var config=require(_0x33de('0x7'));var controller=require(_0x33de('0x8'));router[_0x33de('0x9')]('/',auth[_0x33de('0xa')](),controller[_0x33de('0xb')]);router['get']('/:id',auth[_0x33de('0xa')](),controller['show']);router[_0x33de('0x9')](_0x33de('0xc'),auth[_0x33de('0xa')](),controller['getUsers']);router[_0x33de('0xd')]('/',auth[_0x33de('0xa')](),controller[_0x33de('0xe')]);router[_0x33de('0xd')](_0x33de('0xc'),auth['isAuthenticated'](),controller[_0x33de('0xf')]);router[_0x33de('0x10')](_0x33de('0x11'),auth[_0x33de('0xa')](),controller[_0x33de('0x12')]);router['delete'](_0x33de('0x11'),auth[_0x33de('0xa')](),controller['destroy']);router[_0x33de('0x13')]('/:id/users',auth[_0x33de('0xa')](),controller[_0x33de('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index e83b2ea..8c6903a 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 _0x13b5=['TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','exports','name','STRING'];(function(_0x4b77a4,_0x238eef){var _0x434550=function(_0x24ae69){while(--_0x24ae69){_0x4b77a4['push'](_0x4b77a4['shift']());}};_0x434550(++_0x238eef);}(_0x13b5,0x69));var _0x513b=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x13b5[_0x565ed7];return _0x183ad7;};'use strict';var Sequelize=require('sequelize');module[_0x513b('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x513b('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x513b('0x2')]},'notes':{'type':Sequelize[_0x513b('0x3')]},'preproduction':{'type':Sequelize[_0x513b('0x4')](_0x513b('0x5')),'get':function(){if(this[_0x513b('0x6')](_0x513b('0x7'))){return this['getDataValue'](_0x513b('0x7'))[_0x513b('0x8')](_0x513b('0x9'));}}},'production':{'type':Sequelize[_0x513b('0x4')](_0x513b('0x5')),'get':function(){if(this[_0x513b('0x6')](_0x513b('0xa'))){return this[_0x513b('0x6')]('production')[_0x513b('0x8')](_0x513b('0x9'));}}},'savedAt':{'type':Sequelize[_0x513b('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x725e=['DATE','sequelize','name','TEXT','BLOB','long','getDataValue','preproduction','toString','production','utf8'];(function(_0x247031,_0x3948d4){var _0x4e6a28=function(_0x1395ea){while(--_0x1395ea){_0x247031['push'](_0x247031['shift']());}};_0x4e6a28(++_0x3948d4);}(_0x725e,0x12a));var _0xe725=function(_0x24c14d,_0x125e66){_0x24c14d=_0x24c14d-0x0;var _0x228823=_0x725e[_0x24c14d];return _0x228823;};'use strict';var Sequelize=require(_0xe725('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xe725('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xe725('0x2')]},'preproduction':{'type':Sequelize[_0xe725('0x3')](_0xe725('0x4')),'get':function(){if(this[_0xe725('0x5')]('preproduction')){return this[_0xe725('0x5')](_0xe725('0x6'))[_0xe725('0x7')]('utf8');}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0xe725('0x5')](_0xe725('0x8'))){return this[_0xe725('0x5')](_0xe725('0x8'))[_0xe725('0x7')](_0xe725('0x9'));}}},'savedAt':{'type':Sequelize[_0xe725('0xa')]},'publishedAt':{'type':Sequelize[_0xe725('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 544c4c8..5f7d6cd 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 _0x57ed=['include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','nolimit','html-pdf','eml-format','zip-dir','moment','mustache','util','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','end','json','offset','set','Content-Range','apply','save','update','then','get','SquareProjects','destroy','stack','name','send','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','rows','catch','show','params'];(function(_0x48acb8,_0x34c48a){var _0x3e3f37=function(_0x2c13fa){while(--_0x2c13fa){_0x48acb8['push'](_0x48acb8['shift']());}};_0x3e3f37(++_0x34c48a);}(_0x57ed,0x191));var _0xd57e=function(_0x3562a8,_0x5cfc6c){_0x3562a8=_0x3562a8-0x0;var _0x1748c9=_0x57ed[_0x3562a8];return _0x1748c9;};'use strict';var pdf=require(_0xd57e('0x0'));var emlformat=require(_0xd57e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd57e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd57e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd57e('0x4'));var util=require(_0xd57e('0x5'));var path=require('path');var sox=require(_0xd57e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd57e('0x7'));var squel=require(_0xd57e('0x8'));var crypto=require(_0xd57e('0x9'));var jsforce=require(_0xd57e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd57e('0xb'));var querystring=require(_0xd57e('0xc'));var Papa=require(_0xd57e('0xd'));var Redis=require(_0xd57e('0xe'));var authService=require(_0xd57e('0xf'));var qs=require(_0xd57e('0x10'));var as=require(_0xd57e('0x11'));var hardwareService=require(_0xd57e('0x12'));var logger=require(_0xd57e('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xd57e('0x14'));var licenseUtil=require(_0xd57e('0x15'));var db=require(_0xd57e('0x16'))['db'];config['redis']=_[_0xd57e('0x17')](config[_0xd57e('0x18')],{'host':_0xd57e('0x19'),'port':0x18eb});var socket=require(_0xd57e('0x1a'))(new Redis(config[_0xd57e('0x18')]));require(_0xd57e('0x1b'))[_0xd57e('0x1c')](socket);function respondWithStatusCode(_0xed3be9,_0x3199f1){_0x3199f1=_0x3199f1||0xcc;return function(_0x21a051){if(_0x21a051){return _0xed3be9['sendStatus'](_0x3199f1);}return _0xed3be9[_0xd57e('0x1d')](_0x3199f1)[_0xd57e('0x1e')]();};}function respondWithResult(_0x5164bb,_0x3b2c24){_0x3b2c24=_0x3b2c24||0xc8;return function(_0x140df8){if(_0x140df8){return _0x5164bb[_0xd57e('0x1d')](_0x3b2c24)[_0xd57e('0x1f')](_0x140df8);}};}function respondWithFilteredResult(_0x46e694,_0x10bc67){return function(_0x359e84){if(_0x359e84){var _0x5684b5=_0x359e84['count'],_0x50d2d0=_0x10bc67[_0xd57e('0x20')],_0x3c4a74=_0x10bc67['offset']+_0x10bc67['limit'],_0x1d1ddc;if(_0x3c4a74>=_0x5684b5){_0x3c4a74=_0x5684b5;_0x1d1ddc=0xc8;}else{_0x1d1ddc=0xce;}_0x46e694[_0xd57e('0x1d')](_0x1d1ddc);return _0x46e694[_0xd57e('0x21')](_0xd57e('0x22'),_0x50d2d0+'-'+_0x3c4a74+'/'+_0x5684b5)[_0xd57e('0x1f')](_0x359e84);}return null;};}function patchUpdates(_0x34d5ed){return function(_0x17cf4e){try{jsonpatch[_0xd57e('0x23')](_0x17cf4e,_0x34d5ed,!![]);}catch(_0x443474){return BPromise['reject'](_0x443474);}return _0x17cf4e[_0xd57e('0x24')]();};}function saveUpdates(_0x561950,_0x262ff4){return function(_0x38117f){if(_0x38117f){return _0x38117f[_0xd57e('0x25')](_0x561950)[_0xd57e('0x26')](function(_0xd233c5){return _0xd233c5;});}return null;};}function removeEntity(_0x477ac1,_0x2598f5){return function(_0x2c38c8){if(_0x2c38c8){return _0x2c38c8['destroy']()['then'](function(){var _0x1f8648=_0x2c38c8[_0xd57e('0x27')]({'plain':!![]});var _0x23696b=_0xd57e('0x28');return db['UserProfileResource'][_0xd57e('0x29')]({'where':{'type':_0x23696b,'resourceId':_0x1f8648['id']}})[_0xd57e('0x26')](function(){return _0x2c38c8;});})[_0xd57e('0x26')](function(){_0x477ac1[_0xd57e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25acba,_0x20a599){return function(_0x25e494){if(!_0x25e494){_0x25acba['sendStatus'](0x194);}return _0x25e494;};}function handleError(_0x4b4d1a,_0x491a4a){_0x491a4a=_0x491a4a||0x1f4;return function(_0x70365d){logger['error'](_0x70365d[_0xd57e('0x2a')]);if(_0x70365d['name']){delete _0x70365d[_0xd57e('0x2b')];}_0x4b4d1a['status'](_0x491a4a)[_0xd57e('0x2c')](_0x70365d);};}exports['index']=function(_0x665145,_0x13ab55){var _0x168f9b={},_0x50f8b4={},_0x11b4b8={'count':0x0,'rows':[]};var _0x3624c8=_[_0xd57e('0x2d')](db[_0xd57e('0x2e')][_0xd57e('0x2f')],function(_0x428b23){return{'name':_0x428b23[_0xd57e('0x30')],'type':_0x428b23[_0xd57e('0x31')][_0xd57e('0x32')]};});_0x50f8b4[_0xd57e('0x33')]=_[_0xd57e('0x2d')](_0x3624c8,'name');_0x50f8b4[_0xd57e('0x34')]=_[_0xd57e('0x35')](_0x665145[_0xd57e('0x34')]);_0x50f8b4[_0xd57e('0x36')]=_['intersection'](_0x50f8b4[_0xd57e('0x33')],_0x50f8b4[_0xd57e('0x34')]);_0x168f9b[_0xd57e('0x37')]=_[_0xd57e('0x38')](_0x50f8b4[_0xd57e('0x33')],qs[_0xd57e('0x39')](_0x665145[_0xd57e('0x34')][_0xd57e('0x39')]));_0x168f9b[_0xd57e('0x37')]=_0x168f9b['attributes'][_0xd57e('0x3a')]?_0x168f9b[_0xd57e('0x37')]:_0x50f8b4[_0xd57e('0x33')];if(!_0x665145[_0xd57e('0x34')][_0xd57e('0x3b')]('nolimit')){_0x168f9b[_0xd57e('0x3c')]=qs[_0xd57e('0x3c')](_0x665145[_0xd57e('0x34')]['limit']);_0x168f9b['offset']=qs[_0xd57e('0x20')](_0x665145['query'][_0xd57e('0x20')]);}_0x168f9b[_0xd57e('0x3d')]=qs[_0xd57e('0x3e')](_0x665145['query'][_0xd57e('0x3e')]);_0x168f9b[_0xd57e('0x3f')]=qs[_0xd57e('0x36')](_[_0xd57e('0x40')](_0x665145[_0xd57e('0x34')],_0x50f8b4[_0xd57e('0x36')]),_0x3624c8);if(_0x665145['query'][_0xd57e('0x41')]){_0x168f9b['where']=_[_0xd57e('0x42')](_0x168f9b[_0xd57e('0x3f')],{'$or':_[_0xd57e('0x2d')](_0x3624c8,function(_0x162332){if(_0x162332[_0xd57e('0x31')]!==_0xd57e('0x43')){var _0x1d0b1f={};_0x1d0b1f[_0x162332['name']]={'$like':'%'+_0x665145['query'][_0xd57e('0x41')]+'%'};return _0x1d0b1f;}})});}_0x168f9b=_[_0xd57e('0x42')]({},_0x168f9b,_0x665145[_0xd57e('0x44')]);var _0x2ce077={'where':_0x168f9b[_0xd57e('0x3f')]};return db['SquareProject'][_0xd57e('0x45')](_0x2ce077)['then'](function(_0x1fe3a5){_0x11b4b8[_0xd57e('0x45')]=_0x1fe3a5;if(_0x665145[_0xd57e('0x34')]['includeAll']){_0x168f9b['include']=[{'all':!![]}];}return db[_0xd57e('0x2e')]['findAll'](_0x168f9b);})['then'](function(_0x40e7b9){_0x11b4b8[_0xd57e('0x46')]=_0x40e7b9;return _0x11b4b8;})[_0xd57e('0x26')](respondWithFilteredResult(_0x13ab55,_0x168f9b))[_0xd57e('0x47')](handleError(_0x13ab55,null));};exports[_0xd57e('0x48')]=function(_0x28f783,_0x3518ce){var _0x4a56d8={'raw':![],'where':{'id':_0x28f783[_0xd57e('0x49')]['id']}},_0x1dc94c={};_0x1dc94c[_0xd57e('0x33')]=_['keys'](db[_0xd57e('0x2e')][_0xd57e('0x2f')]);_0x1dc94c[_0xd57e('0x34')]=_['keys'](_0x28f783['query']);_0x1dc94c['filters']=_[_0xd57e('0x38')](_0x1dc94c['model'],_0x1dc94c[_0xd57e('0x34')]);_0x4a56d8[_0xd57e('0x37')]=_[_0xd57e('0x38')](_0x1dc94c[_0xd57e('0x33')],qs[_0xd57e('0x39')](_0x28f783[_0xd57e('0x34')][_0xd57e('0x39')]));_0x4a56d8[_0xd57e('0x37')]=_0x4a56d8['attributes'][_0xd57e('0x3a')]?_0x4a56d8['attributes']:_0x1dc94c[_0xd57e('0x33')];if(_0x28f783[_0xd57e('0x34')]['includeAll']){_0x4a56d8[_0xd57e('0x4a')]=[{'all':!![]}];}_0x4a56d8=_[_0xd57e('0x42')]({},_0x4a56d8,_0x28f783[_0xd57e('0x44')]);return db[_0xd57e('0x2e')][_0xd57e('0x4b')](_0x4a56d8)[_0xd57e('0x26')](handleEntityNotFound(_0x3518ce,null))[_0xd57e('0x26')](respondWithResult(_0x3518ce,null))['catch'](handleError(_0x3518ce,null));};exports[_0xd57e('0x4c')]=function(_0x5a407e,_0xe54665){return db[_0xd57e('0x2e')]['create'](_0x5a407e[_0xd57e('0x4d')],{})[_0xd57e('0x26')](function(_0x1eb788){var _0x58eacf=_0x5a407e[_0xd57e('0x4e')][_0xd57e('0x27')]({'plain':!![]});if(!_0x58eacf)throw new Error(_0xd57e('0x4f'));if(_0x58eacf[_0xd57e('0x50')]===_0xd57e('0x4e')){var _0x81b88b=_0x1eb788['get']({'plain':!![]});var _0x5c8e4b=_0xd57e('0x28');return db[_0xd57e('0x51')][_0xd57e('0x4b')]({'where':{'name':_0x5c8e4b,'userProfileId':_0x58eacf[_0xd57e('0x52')]},'raw':!![]})[_0xd57e('0x26')](function(_0x1a908c){if(_0x1a908c&&_0x1a908c['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x81b88b[_0xd57e('0x2b')],'resourceId':_0x81b88b['id'],'type':_0x1a908c[_0xd57e('0x2b')],'sectionId':_0x1a908c['id']},{})['then'](function(){return _0x1eb788;});}else{return _0x1eb788;}})['catch'](function(_0x7183c){logger[_0xd57e('0x53')](_0xd57e('0x54'),_0x7183c);throw _0x7183c;});}return _0x1eb788;})[_0xd57e('0x26')](respondWithResult(_0xe54665,0xc9))[_0xd57e('0x47')](handleError(_0xe54665,null));};exports['update']=function(_0x2dcfc1,_0x17c8ff){if(_0x2dcfc1[_0xd57e('0x4d')]['id']){delete _0x2dcfc1[_0xd57e('0x4d')]['id'];}return db[_0xd57e('0x2e')][_0xd57e('0x4b')]({'where':{'id':_0x2dcfc1['params']['id']}})[_0xd57e('0x26')](handleEntityNotFound(_0x17c8ff,null))[_0xd57e('0x26')](saveUpdates(_0x2dcfc1[_0xd57e('0x4d')],null))[_0xd57e('0x26')](respondWithResult(_0x17c8ff,null))[_0xd57e('0x47')](handleError(_0x17c8ff,null));};exports[_0xd57e('0x29')]=function(_0x9a3041,_0x519321){return db[_0xd57e('0x2e')][_0xd57e('0x4b')]({'where':{'id':_0x9a3041[_0xd57e('0x49')]['id']}})['then'](handleEntityNotFound(_0x519321,null))[_0xd57e('0x26')](removeEntity(_0x519321,null))[_0xd57e('0x47')](handleError(_0x519321,null));};exports[_0xd57e('0x55')]=function(_0x3968f6,_0x326f0f,_0x49fd61){return db[_0xd57e('0x2e')][_0xd57e('0x4b')]({'where':{'id':_0x3968f6[_0xd57e('0x49')]['id']}})[_0xd57e('0x26')](handleEntityNotFound(_0x326f0f,null))[_0xd57e('0x26')](function(_0x4d7568){if(_0x4d7568){return _0x4d7568[_0xd57e('0x55')](_0x3968f6[_0xd57e('0x4d')][_0xd57e('0x56')],_[_0xd57e('0x57')](_0x3968f6[_0xd57e('0x4d')],[_0xd57e('0x56'),'id'])||{});}})[_0xd57e('0x26')](respondWithResult(_0x326f0f,null))['catch'](handleError(_0x326f0f,null));};exports[_0xd57e('0x58')]=function(_0x1afe7c,_0x1ad6eb,_0x142655){return db[_0xd57e('0x2e')][_0xd57e('0x4b')]({'where':{'id':_0x1afe7c['params']['id']}})['then'](handleEntityNotFound(_0x1ad6eb,null))[_0xd57e('0x26')](function(_0x35a40d){if(_0x35a40d){return _0x35a40d[_0xd57e('0x58')](_0x1afe7c[_0xd57e('0x34')]['ids'])[_0xd57e('0x26')](function(){if(_[_0xd57e('0x59')](_0x1afe7c[_0xd57e('0x34')][_0xd57e('0x56')])){for(var _0x25ff27=0x0;_0x25ff27<_0x1afe7c[_0xd57e('0x34')][_0xd57e('0x56')]['length'];_0x25ff27+=0x1){socket['emit'](_0xd57e('0x5a'),{'UserId':Number(_0x1afe7c[_0xd57e('0x34')][_0xd57e('0x56')][_0x25ff27]),'SquareProjectId':Number(_0x1afe7c['params']['id'])});}}else{socket[_0xd57e('0x5b')](_0xd57e('0x5a'),{'UserId':Number(_0x1afe7c['query'][_0xd57e('0x56')]),'SquareProjectId':Number(_0x1afe7c[_0xd57e('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x1ad6eb,null))[_0xd57e('0x47')](handleError(_0x1ad6eb,null));};exports[_0xd57e('0x5c')]=function(_0x31a657,_0xa03d9,_0x5eaff7){var _0x54d7b5={};var _0x1d1e92={};var _0x523979;var _0x474b4b;return db[_0xd57e('0x2e')][_0xd57e('0x5d')]({'where':{'id':_0x31a657['params']['id']}})['then'](handleEntityNotFound(_0xa03d9,null))[_0xd57e('0x26')](function(_0x5dc9b8){if(_0x5dc9b8){_0x523979=_0x5dc9b8;_0x1d1e92[_0xd57e('0x33')]=_[_0xd57e('0x35')](db['User'][_0xd57e('0x2f')]);_0x1d1e92[_0xd57e('0x34')]=_['keys'](_0x31a657['query']);_0x1d1e92[_0xd57e('0x36')]=_[_0xd57e('0x38')](_0x1d1e92['model'],_0x1d1e92[_0xd57e('0x34')]);_0x54d7b5[_0xd57e('0x37')]=_[_0xd57e('0x38')](_0x1d1e92[_0xd57e('0x33')],qs[_0xd57e('0x39')](_0x31a657[_0xd57e('0x34')][_0xd57e('0x39')]));_0x54d7b5[_0xd57e('0x37')]=_0x54d7b5[_0xd57e('0x37')][_0xd57e('0x3a')]?_0x54d7b5[_0xd57e('0x37')]:_0x1d1e92['model'];_0x54d7b5[_0xd57e('0x3d')]=qs[_0xd57e('0x3e')](_0x31a657[_0xd57e('0x34')][_0xd57e('0x3e')]);_0x54d7b5[_0xd57e('0x3f')]=qs[_0xd57e('0x36')](_[_0xd57e('0x40')](_0x31a657[_0xd57e('0x34')],_0x1d1e92[_0xd57e('0x36')]));if(_0x31a657['query'][_0xd57e('0x41')]){_0x54d7b5['where']=_[_0xd57e('0x42')](_0x54d7b5[_0xd57e('0x3f')],{'$or':_[_0xd57e('0x2d')](_0x54d7b5[_0xd57e('0x37')],function(_0x592563){var _0x49ea09={};_0x49ea09[_0x592563]={'$like':'%'+_0x31a657[_0xd57e('0x34')][_0xd57e('0x41')]+'%'};return _0x49ea09;})});}_0x54d7b5=_[_0xd57e('0x42')]({},_0x54d7b5,_0x31a657[_0xd57e('0x44')]);return _0x523979[_0xd57e('0x5c')](_0x54d7b5);}})[_0xd57e('0x26')](function(_0x22fd54){if(_0x22fd54){_0x474b4b=_0x22fd54[_0xd57e('0x3a')];if(!_0x31a657[_0xd57e('0x34')]['hasOwnProperty'](_0xd57e('0x5e'))){_0x54d7b5[_0xd57e('0x3c')]=qs[_0xd57e('0x3c')](_0x31a657[_0xd57e('0x34')][_0xd57e('0x3c')]);_0x54d7b5[_0xd57e('0x20')]=qs[_0xd57e('0x20')](_0x31a657[_0xd57e('0x34')][_0xd57e('0x20')]);}return _0x523979['getUsers'](_0x54d7b5);}})[_0xd57e('0x26')](function(_0x41fb95){if(_0x41fb95){return _0x41fb95?{'count':_0x474b4b,'rows':_0x41fb95}:null;}})[_0xd57e('0x26')](respondWithResult(_0xa03d9,null))['catch'](handleError(_0xa03d9,null));}; \ No newline at end of file +var _0xf725=['api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x2f14bf,_0x24bab1){var _0x305b16=function(_0x4ea477){while(--_0x4ea477){_0x2f14bf['push'](_0x2f14bf['shift']());}};_0x305b16(++_0x24bab1);}(_0xf725,0x112));var _0x5f72=function(_0x48b19f,_0x7f18fd){_0x48b19f=_0x48b19f-0x0;var _0x211ab2=_0xf725[_0x48b19f];return _0x211ab2;};'use strict';var pdf=require(_0x5f72('0x0'));var emlformat=require(_0x5f72('0x1'));var rimraf=require(_0x5f72('0x2'));var zipdir=require(_0x5f72('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f72('0x4'));var moment=require(_0x5f72('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5f72('0x6'));var util=require('util');var path=require(_0x5f72('0x7'));var sox=require(_0x5f72('0x8'));var csv=require(_0x5f72('0x9'));var ejs=require(_0x5f72('0xa'));var fs=require('fs');var _=require(_0x5f72('0xb'));var squel=require(_0x5f72('0xc'));var crypto=require(_0x5f72('0xd'));var jsforce=require(_0x5f72('0xe'));var deskjs=require(_0x5f72('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5f72('0x10'));var authService=require(_0x5f72('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5f72('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5f72('0x13'))(_0x5f72('0x14'));var utils=require('../../config/utils');var config=require(_0x5f72('0x15'));var licenseUtil=require(_0x5f72('0x16'));var db=require(_0x5f72('0x17'))['db'];config['redis']=_[_0x5f72('0x18')](config[_0x5f72('0x19')],{'host':_0x5f72('0x1a'),'port':0x18eb});var socket=require(_0x5f72('0x1b'))(new Redis(config[_0x5f72('0x19')]));require(_0x5f72('0x1c'))['register'](socket);function respondWithStatusCode(_0xa1496d,_0x5f363a){_0x5f363a=_0x5f363a||0xcc;return function(_0x48e8c2){if(_0x48e8c2){return _0xa1496d[_0x5f72('0x1d')](_0x5f363a);}return _0xa1496d[_0x5f72('0x1e')](_0x5f363a)[_0x5f72('0x1f')]();};}function respondWithResult(_0x98a51f,_0x153cf3){_0x153cf3=_0x153cf3||0xc8;return function(_0x54c7b0){if(_0x54c7b0){return _0x98a51f[_0x5f72('0x1e')](_0x153cf3)[_0x5f72('0x20')](_0x54c7b0);}};}function respondWithFilteredResult(_0x35de07,_0x8ceac7){return function(_0x720b78){if(_0x720b78){var _0xb2c317=_0x720b78[_0x5f72('0x21')],_0x2442a6=_0x8ceac7[_0x5f72('0x22')],_0x57c79d=_0x8ceac7[_0x5f72('0x22')]+_0x8ceac7[_0x5f72('0x23')],_0x36b5fb;if(_0x57c79d>=_0xb2c317){_0x57c79d=_0xb2c317;_0x36b5fb=0xc8;}else{_0x36b5fb=0xce;}_0x35de07[_0x5f72('0x1e')](_0x36b5fb);return _0x35de07[_0x5f72('0x24')](_0x5f72('0x25'),_0x2442a6+'-'+_0x57c79d+'/'+_0xb2c317)[_0x5f72('0x20')](_0x720b78);}return null;};}function patchUpdates(_0xa82bf3){return function(_0x2a21d0){try{jsonpatch[_0x5f72('0x26')](_0x2a21d0,_0xa82bf3,!![]);}catch(_0x30166e){return BPromise[_0x5f72('0x27')](_0x30166e);}return _0x2a21d0[_0x5f72('0x28')]();};}function saveUpdates(_0x5945ed,_0x3c590c){return function(_0x139f7d){if(_0x139f7d){return _0x139f7d[_0x5f72('0x29')](_0x5945ed)[_0x5f72('0x2a')](function(_0x110f8f){return _0x110f8f;});}return null;};}function removeEntity(_0x103199,_0x45d36f){return function(_0x3b8cf7){if(_0x3b8cf7){return _0x3b8cf7[_0x5f72('0x2b')]()['then'](function(){var _0x309811=_0x3b8cf7[_0x5f72('0x2c')]({'plain':!![]});var _0x425020=_0x5f72('0x2d');return db[_0x5f72('0x2e')][_0x5f72('0x2b')]({'where':{'type':_0x425020,'resourceId':_0x309811['id']}})[_0x5f72('0x2a')](function(){return _0x3b8cf7;});})[_0x5f72('0x2a')](function(){_0x103199[_0x5f72('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f56f7,_0xd8c1eb){return function(_0xb059b4){if(!_0xb059b4){_0x4f56f7[_0x5f72('0x1d')](0x194);}return _0xb059b4;};}function handleError(_0x25ca3c,_0xfa5140){_0xfa5140=_0xfa5140||0x1f4;return function(_0x52d4ca){logger['error'](_0x52d4ca[_0x5f72('0x2f')]);if(_0x52d4ca['name']){delete _0x52d4ca[_0x5f72('0x30')];}_0x25ca3c[_0x5f72('0x1e')](_0xfa5140)[_0x5f72('0x31')](_0x52d4ca);};}exports[_0x5f72('0x32')]=function(_0x597856,_0x33057d){var _0x4efb9e={},_0x517420={},_0x1f707e={'count':0x0,'rows':[]};var _0x298aad=_[_0x5f72('0x33')](db[_0x5f72('0x34')][_0x5f72('0x35')],function(_0x2f2495){return{'name':_0x2f2495[_0x5f72('0x36')],'type':_0x2f2495[_0x5f72('0x37')]['key']};});_0x517420[_0x5f72('0x38')]=_[_0x5f72('0x33')](_0x298aad,_0x5f72('0x30'));_0x517420['query']=_[_0x5f72('0x39')](_0x597856['query']);_0x517420[_0x5f72('0x3a')]=_[_0x5f72('0x3b')](_0x517420[_0x5f72('0x38')],_0x517420['query']);_0x4efb9e[_0x5f72('0x3c')]=_['intersection'](_0x517420[_0x5f72('0x38')],qs[_0x5f72('0x3d')](_0x597856[_0x5f72('0x3e')]['fields']));_0x4efb9e[_0x5f72('0x3c')]=_0x4efb9e['attributes'][_0x5f72('0x3f')]?_0x4efb9e[_0x5f72('0x3c')]:_0x517420[_0x5f72('0x38')];if(!_0x597856[_0x5f72('0x3e')][_0x5f72('0x40')](_0x5f72('0x41'))){_0x4efb9e['limit']=qs[_0x5f72('0x23')](_0x597856[_0x5f72('0x3e')][_0x5f72('0x23')]);_0x4efb9e[_0x5f72('0x22')]=qs[_0x5f72('0x22')](_0x597856[_0x5f72('0x3e')][_0x5f72('0x22')]);}_0x4efb9e[_0x5f72('0x42')]=qs['sort'](_0x597856[_0x5f72('0x3e')][_0x5f72('0x43')]);_0x4efb9e['where']=qs[_0x5f72('0x3a')](_[_0x5f72('0x44')](_0x597856[_0x5f72('0x3e')],_0x517420[_0x5f72('0x3a')]),_0x298aad);if(_0x597856[_0x5f72('0x3e')][_0x5f72('0x45')]){_0x4efb9e[_0x5f72('0x46')]=_[_0x5f72('0x47')](_0x4efb9e[_0x5f72('0x46')],{'$or':_[_0x5f72('0x33')](_0x298aad,function(_0x8fbb91){if(_0x8fbb91['type']!==_0x5f72('0x48')){var _0x49e29d={};_0x49e29d[_0x8fbb91[_0x5f72('0x30')]]={'$like':'%'+_0x597856[_0x5f72('0x3e')]['filter']+'%'};return _0x49e29d;}})});}_0x4efb9e=_['merge']({},_0x4efb9e,_0x597856[_0x5f72('0x49')]);var _0x5948e0={'where':_0x4efb9e[_0x5f72('0x46')]};return db[_0x5f72('0x34')]['count'](_0x5948e0)[_0x5f72('0x2a')](function(_0x5a0ab0){_0x1f707e['count']=_0x5a0ab0;if(_0x597856[_0x5f72('0x3e')][_0x5f72('0x4a')]){_0x4efb9e[_0x5f72('0x4b')]=[{'all':!![]}];}return db[_0x5f72('0x34')]['findAll'](_0x4efb9e);})['then'](function(_0x1f2594){_0x1f707e[_0x5f72('0x4c')]=_0x1f2594;return _0x1f707e;})[_0x5f72('0x2a')](respondWithFilteredResult(_0x33057d,_0x4efb9e))[_0x5f72('0x4d')](handleError(_0x33057d,null));};exports[_0x5f72('0x4e')]=function(_0x2c0f13,_0x1db5df){var _0x3f13bd={'raw':![],'where':{'id':_0x2c0f13[_0x5f72('0x4f')]['id']}},_0x5822e7={};_0x5822e7['model']=_['keys'](db[_0x5f72('0x34')][_0x5f72('0x35')]);_0x5822e7['query']=_[_0x5f72('0x39')](_0x2c0f13[_0x5f72('0x3e')]);_0x5822e7[_0x5f72('0x3a')]=_[_0x5f72('0x3b')](_0x5822e7[_0x5f72('0x38')],_0x5822e7[_0x5f72('0x3e')]);_0x3f13bd['attributes']=_[_0x5f72('0x3b')](_0x5822e7[_0x5f72('0x38')],qs[_0x5f72('0x3d')](_0x2c0f13[_0x5f72('0x3e')]['fields']));_0x3f13bd[_0x5f72('0x3c')]=_0x3f13bd[_0x5f72('0x3c')][_0x5f72('0x3f')]?_0x3f13bd[_0x5f72('0x3c')]:_0x5822e7[_0x5f72('0x38')];if(_0x2c0f13[_0x5f72('0x3e')][_0x5f72('0x4a')]){_0x3f13bd['include']=[{'all':!![]}];}_0x3f13bd=_[_0x5f72('0x47')]({},_0x3f13bd,_0x2c0f13['options']);return db[_0x5f72('0x34')][_0x5f72('0x50')](_0x3f13bd)[_0x5f72('0x2a')](handleEntityNotFound(_0x1db5df,null))[_0x5f72('0x2a')](respondWithResult(_0x1db5df,null))[_0x5f72('0x4d')](handleError(_0x1db5df,null));};exports[_0x5f72('0x51')]=function(_0x582da3,_0x49cd3a){return db[_0x5f72('0x34')]['create'](_0x582da3['body'],{})[_0x5f72('0x2a')](function(_0x3e94a6){var _0x2fbc27=_0x582da3[_0x5f72('0x52')][_0x5f72('0x2c')]({'plain':!![]});if(!_0x2fbc27)throw new Error(_0x5f72('0x53'));if(_0x2fbc27['role']===_0x5f72('0x52')){var _0x41326c=_0x3e94a6['get']({'plain':!![]});var _0x3da520=_0x5f72('0x2d');return db[_0x5f72('0x54')]['find']({'where':{'name':_0x3da520,'userProfileId':_0x2fbc27[_0x5f72('0x55')]},'raw':!![]})[_0x5f72('0x2a')](function(_0x4258f3){if(_0x4258f3&&_0x4258f3[_0x5f72('0x56')]===0x0){return db[_0x5f72('0x2e')][_0x5f72('0x51')]({'name':_0x41326c[_0x5f72('0x30')],'resourceId':_0x41326c['id'],'type':_0x4258f3[_0x5f72('0x30')],'sectionId':_0x4258f3['id']},{})[_0x5f72('0x2a')](function(){return _0x3e94a6;});}else{return _0x3e94a6;}})[_0x5f72('0x4d')](function(_0x5266d9){logger['error'](_0x5f72('0x57'),_0x5266d9);throw _0x5266d9;});}return _0x3e94a6;})[_0x5f72('0x2a')](respondWithResult(_0x49cd3a,0xc9))[_0x5f72('0x4d')](handleError(_0x49cd3a,null));};exports['update']=function(_0x4c6fad,_0x4042f1){if(_0x4c6fad[_0x5f72('0x58')]['id']){delete _0x4c6fad[_0x5f72('0x58')]['id'];}return db[_0x5f72('0x34')][_0x5f72('0x50')]({'where':{'id':_0x4c6fad['params']['id']}})[_0x5f72('0x2a')](handleEntityNotFound(_0x4042f1,null))['then'](saveUpdates(_0x4c6fad[_0x5f72('0x58')],null))[_0x5f72('0x2a')](respondWithResult(_0x4042f1,null))[_0x5f72('0x4d')](handleError(_0x4042f1,null));};exports[_0x5f72('0x2b')]=function(_0x509eba,_0x4f20c3){return db['SquareProject']['find']({'where':{'id':_0x509eba[_0x5f72('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4f20c3,null))['then'](removeEntity(_0x4f20c3,null))[_0x5f72('0x4d')](handleError(_0x4f20c3,null));};exports['addUsers']=function(_0x16c978,_0x1f75ff,_0x4cdcbf){return db[_0x5f72('0x34')][_0x5f72('0x50')]({'where':{'id':_0x16c978[_0x5f72('0x4f')]['id']}})[_0x5f72('0x2a')](handleEntityNotFound(_0x1f75ff,null))[_0x5f72('0x2a')](function(_0x358dc){if(_0x358dc){return _0x358dc[_0x5f72('0x59')](_0x16c978[_0x5f72('0x58')][_0x5f72('0x5a')],_['omit'](_0x16c978[_0x5f72('0x58')],[_0x5f72('0x5a'),'id'])||{});}})[_0x5f72('0x2a')](respondWithResult(_0x1f75ff,null))[_0x5f72('0x4d')](handleError(_0x1f75ff,null));};exports[_0x5f72('0x5b')]=function(_0xbcc9b1,_0x8ca16d,_0x122f71){return db[_0x5f72('0x34')][_0x5f72('0x50')]({'where':{'id':_0xbcc9b1['params']['id']}})[_0x5f72('0x2a')](handleEntityNotFound(_0x8ca16d,null))[_0x5f72('0x2a')](function(_0x39888){if(_0x39888){return _0x39888[_0x5f72('0x5b')](_0xbcc9b1[_0x5f72('0x3e')][_0x5f72('0x5a')])[_0x5f72('0x2a')](function(){if(_[_0x5f72('0x5c')](_0xbcc9b1[_0x5f72('0x3e')]['ids'])){for(var _0x2d4491=0x0;_0x2d4491<_0xbcc9b1[_0x5f72('0x3e')][_0x5f72('0x5a')][_0x5f72('0x3f')];_0x2d4491+=0x1){socket[_0x5f72('0x5d')]('userSquareProject:remove',{'UserId':Number(_0xbcc9b1['query'][_0x5f72('0x5a')][_0x2d4491]),'SquareProjectId':Number(_0xbcc9b1[_0x5f72('0x4f')]['id'])});}}else{socket[_0x5f72('0x5d')](_0x5f72('0x5e'),{'UserId':Number(_0xbcc9b1['query']['ids']),'SquareProjectId':Number(_0xbcc9b1['params']['id'])});}});}})[_0x5f72('0x2a')](respondWithStatusCode(_0x8ca16d,null))[_0x5f72('0x4d')](handleError(_0x8ca16d,null));};exports[_0x5f72('0x5f')]=function(_0x2377fa,_0x407801,_0x33ad55){var _0x1b070b={};var _0x56d5a2={};var _0x35e15a;var _0x1ca6b9;return db['SquareProject'][_0x5f72('0x60')]({'where':{'id':_0x2377fa[_0x5f72('0x4f')]['id']}})[_0x5f72('0x2a')](handleEntityNotFound(_0x407801,null))[_0x5f72('0x2a')](function(_0xeb8960){if(_0xeb8960){_0x35e15a=_0xeb8960;_0x56d5a2['model']=_[_0x5f72('0x39')](db[_0x5f72('0x61')][_0x5f72('0x35')]);_0x56d5a2['query']=_[_0x5f72('0x39')](_0x2377fa['query']);_0x56d5a2['filters']=_[_0x5f72('0x3b')](_0x56d5a2['model'],_0x56d5a2['query']);_0x1b070b[_0x5f72('0x3c')]=_['intersection'](_0x56d5a2[_0x5f72('0x38')],qs[_0x5f72('0x3d')](_0x2377fa[_0x5f72('0x3e')][_0x5f72('0x3d')]));_0x1b070b[_0x5f72('0x3c')]=_0x1b070b[_0x5f72('0x3c')]['length']?_0x1b070b[_0x5f72('0x3c')]:_0x56d5a2[_0x5f72('0x38')];_0x1b070b[_0x5f72('0x42')]=qs['sort'](_0x2377fa[_0x5f72('0x3e')][_0x5f72('0x43')]);_0x1b070b[_0x5f72('0x46')]=qs[_0x5f72('0x3a')](_[_0x5f72('0x44')](_0x2377fa['query'],_0x56d5a2['filters']));if(_0x2377fa[_0x5f72('0x3e')]['filter']){_0x1b070b[_0x5f72('0x46')]=_[_0x5f72('0x47')](_0x1b070b[_0x5f72('0x46')],{'$or':_['map'](_0x1b070b[_0x5f72('0x3c')],function(_0x5d074e){var _0x551b7f={};_0x551b7f[_0x5d074e]={'$like':'%'+_0x2377fa['query'][_0x5f72('0x45')]+'%'};return _0x551b7f;})});}_0x1b070b=_[_0x5f72('0x47')]({},_0x1b070b,_0x2377fa[_0x5f72('0x49')]);return _0x35e15a[_0x5f72('0x5f')](_0x1b070b);}})[_0x5f72('0x2a')](function(_0x2c5d9d){if(_0x2c5d9d){_0x1ca6b9=_0x2c5d9d[_0x5f72('0x3f')];if(!_0x2377fa[_0x5f72('0x3e')][_0x5f72('0x40')](_0x5f72('0x41'))){_0x1b070b[_0x5f72('0x23')]=qs['limit'](_0x2377fa['query'][_0x5f72('0x23')]);_0x1b070b[_0x5f72('0x22')]=qs[_0x5f72('0x22')](_0x2377fa['query'][_0x5f72('0x22')]);}return _0x35e15a['getUsers'](_0x1b070b);}})[_0x5f72('0x2a')](function(_0x24b04f){if(_0x24b04f){return _0x24b04f?{'count':_0x1ca6b9,'rows':_0x24b04f}:null;}})[_0x5f72('0x2a')](respondWithResult(_0x407801,null))[_0x5f72('0x4d')](handleError(_0x407801,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 1167d10..9a48ff0 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 _0x8ea8=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x3ff672,_0x3882c2){var _0x44952a=function(_0x5bc755){while(--_0x5bc755){_0x3ff672['push'](_0x3ff672['shift']());}};_0x44952a(++_0x3882c2);}(_0x8ea8,0xca));var _0x88ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ea8[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x88ea('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x88ea('0x1')](0x0);var events={'afterCreate':_0x88ea('0x2'),'afterUpdate':_0x88ea('0x3'),'afterDestroy':_0x88ea('0x4')};function emitEvent(_0x2cd354){return function(_0x5db2e5,_0x433244,_0x5c71b7){SquareProjectEvents['emit'](_0x2cd354+':'+_0x5db2e5['id'],_0x5db2e5);SquareProjectEvents[_0x88ea('0x5')](_0x2cd354,_0x5db2e5);_0x5c71b7(null);};}for(var e in events){if(events[_0x88ea('0x6')](e)){var event=events[e];SquareProject[_0x88ea('0x7')](e,emitEvent(event));}}module[_0x88ea('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xadd2=['remove','emit','exports','SquareProject','save','update'];(function(_0xaf3140,_0xa4ca3d){var _0x5701e3=function(_0x4d4d43){while(--_0x4d4d43){_0xaf3140['push'](_0xaf3140['shift']());}};_0x5701e3(++_0xa4ca3d);}(_0xadd2,0xa5));var _0x2add=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xadd2[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0x2add('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2add('0x1'),'afterUpdate':_0x2add('0x2'),'afterDestroy':_0x2add('0x3')};function emitEvent(_0x270575){return function(_0x1ecb83,_0x217444,_0x328cc0){SquareProjectEvents[_0x2add('0x4')](_0x270575+':'+_0x1ecb83['id'],_0x1ecb83);SquareProjectEvents[_0x2add('0x4')](_0x270575,_0x1ecb83);_0x328cc0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x2add('0x5')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 3921430..7a95cf0 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 _0xeb79=['changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','format','../../config/logger','moment','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','define','square_projects'];(function(_0x55a584,_0x16fc23){var _0x1e0648=function(_0x20bd2a){while(--_0x20bd2a){_0x55a584['push'](_0x55a584['shift']());}};_0x1e0648(++_0x16fc23);}(_0xeb79,0x87));var _0x9eb7=function(_0x424d84,_0x1ae7b3){_0x424d84=_0x424d84-0x0;var _0x470900=_0xeb79[_0x424d84];return _0x470900;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9eb7('0x0'))('api');var moment=require(_0x9eb7('0x1'));var BPromise=require('bluebird');var rp=require(_0x9eb7('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9eb7('0x3'));var config=require(_0x9eb7('0x4'));var attributes=require(_0x9eb7('0x5'));module[_0x9eb7('0x6')]=function(_0x58bc03,_0x501d0c){return _0x58bc03[_0x9eb7('0x7')]('SquareProject',attributes,{'tableName':_0x9eb7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x127fb9,_0x352bb8,_0x20ca15){if(_0x127fb9[_0x9eb7('0x9')](_0x9eb7('0xa'))){_0x127fb9[_0x9eb7('0xb')]=moment()['format'](_0x9eb7('0xc'));}if(_0x127fb9[_0x9eb7('0x9')](_0x9eb7('0xd'))){_0x127fb9[_0x9eb7('0xe')]=moment()[_0x9eb7('0xf')](_0x9eb7('0xc'));}_0x20ca15(null,_0x127fb9);}}});}; \ No newline at end of file +var _0xfcbd=['exports','define','SquareProject','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes'];(function(_0x2847ec,_0x40ce19){var _0x507988=function(_0x3545a1){while(--_0x3545a1){_0x2847ec['push'](_0x2847ec['shift']());}};_0x507988(++_0x40ce19);}(_0xfcbd,0x160));var _0xdfcb=function(_0x1fd563,_0x196466){_0x1fd563=_0x1fd563-0x0;var _0x4673f3=_0xfcbd[_0x1fd563];return _0x4673f3;};'use strict';var _=require(_0xdfcb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdfcb('0x1'));var moment=require(_0xdfcb('0x2'));var BPromise=require(_0xdfcb('0x3'));var rp=require(_0xdfcb('0x4'));var fs=require('fs');var path=require(_0xdfcb('0x5'));var rimraf=require(_0xdfcb('0x6'));var config=require(_0xdfcb('0x7'));var attributes=require(_0xdfcb('0x8'));module[_0xdfcb('0x9')]=function(_0x4bdf76,_0x5615a6){return _0x4bdf76[_0xdfcb('0xa')](_0xdfcb('0xb'),attributes,{'tableName':_0xdfcb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3c5431,_0xbe50d6,_0x13fb1c){if(_0x3c5431[_0xdfcb('0xd')]('preproduction')){_0x3c5431[_0xdfcb('0xe')]=moment()[_0xdfcb('0xf')](_0xdfcb('0x10'));}if(_0x3c5431[_0xdfcb('0xd')](_0xdfcb('0x11'))){_0x3c5431[_0xdfcb('0x12')]=moment()[_0xdfcb('0xf')](_0xdfcb('0x10'));}_0x13fb1c(null,_0x3c5431);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index b5943ff..2d44747 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 _0x93ae=['error','message','result','ShowSquareProject','find','options','raw','where','include','map','model','attributes','stringify','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','localhost','socket.io-emitter','redis','./squareProject.socket','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s'];(function(_0x77cb50,_0x5af067){var _0x1124fb=function(_0x46bbf5){while(--_0x46bbf5){_0x77cb50['push'](_0x77cb50['shift']());}};_0x1124fb(++_0x5af067);}(_0x93ae,0x1ca));var _0xe93a=function(_0x276413,_0x2c8e7a){_0x276413=_0x276413-0x0;var _0xff711d=_0x93ae[_0x276413];return _0xff711d;};'use strict';var _=require(_0xe93a('0x0'));var util=require(_0xe93a('0x1'));var moment=require('moment');var BPromise=require(_0xe93a('0x2'));var rs=require(_0xe93a('0x3'));var fs=require('fs');var Redis=require(_0xe93a('0x4'));var db=require(_0xe93a('0x5'))['db'];var utils=require(_0xe93a('0x6'));var logger=require(_0xe93a('0x7'))(_0xe93a('0x8'));var config=require('../../config/environment');var jayson=require(_0xe93a('0x9'));var client=jayson[_0xe93a('0xa')][_0xe93a('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xe93a('0xc'),'port':0x18eb});var socket=require(_0xe93a('0xd'))(new Redis(config[_0xe93a('0xe')]));require(_0xe93a('0xf'))[_0xe93a('0x10')](socket);function respondWithRpcPromise(_0x5cee2e,_0x5cc24d,_0xc162e){return new BPromise(function(_0x1c4546,_0x5be857){return client['request'](_0x5cee2e,_0xc162e)[_0xe93a('0x11')](function(_0x11c43b){logger[_0xe93a('0x12')](_0xe93a('0x13'),_0x5cc24d,_0xe93a('0x14'));logger[_0xe93a('0x15')](_0xe93a('0x16'),_0x5cc24d,'request\x20sent',JSON['stringify'](_0x11c43b));if(_0x11c43b['error']){if(_0x11c43b['error']['code']===0x1f4){logger[_0xe93a('0x17')]('SquareProject,\x20%s,\x20%s',_0x5cc24d,_0x11c43b[_0xe93a('0x17')][_0xe93a('0x18')]);return _0x5be857(_0x11c43b[_0xe93a('0x17')][_0xe93a('0x18')]);}logger[_0xe93a('0x17')](_0xe93a('0x13'),_0x5cc24d,_0x11c43b[_0xe93a('0x17')][_0xe93a('0x18')]);return _0x1c4546(_0x11c43b[_0xe93a('0x17')]['message']);}else{logger[_0xe93a('0x12')](_0xe93a('0x13'),_0x5cc24d,_0xe93a('0x14'));_0x1c4546(_0x11c43b[_0xe93a('0x19')][_0xe93a('0x18')]);}})['catch'](function(_0x1ed407){logger[_0xe93a('0x17')]('SquareProject,\x20%s,\x20%s',_0x5cc24d,_0x1ed407);_0x5be857(_0x1ed407);});});}exports[_0xe93a('0x1a')]=function(_0x239766){var _0x3579e1=this;return new Promise(function(_0x5bc9aa,_0x326eb4){return db['SquareProject'][_0xe93a('0x1b')]({'raw':_0x239766[_0xe93a('0x1c')]?_0x239766[_0xe93a('0x1c')][_0xe93a('0x1d')]===undefined?!![]:![]:!![],'where':_0x239766['options']?_0x239766['options'][_0xe93a('0x1e')]||null:null,'attributes':_0x239766[_0xe93a('0x1c')]?_0x239766['options']['attributes']||null:null,'include':_0x239766[_0xe93a('0x1c')]?_0x239766[_0xe93a('0x1c')][_0xe93a('0x1f')]?_[_0xe93a('0x20')](_0x239766[_0xe93a('0x1c')][_0xe93a('0x1f')],function(_0x445445){return{'model':db[_0x445445[_0xe93a('0x21')]],'as':_0x445445['as'],'attributes':_0x445445[_0xe93a('0x22')],'include':_0x445445[_0xe93a('0x1f')]?_['map'](_0x445445[_0xe93a('0x1f')],function(_0x5ab6ed){return{'model':db[_0x5ab6ed[_0xe93a('0x21')]],'as':_0x5ab6ed['as'],'attributes':_0x5ab6ed[_0xe93a('0x22')],'include':_0x5ab6ed[_0xe93a('0x1f')]?_[_0xe93a('0x20')](_0x5ab6ed['include'],function(_0x5d6218){return{'model':db[_0x5d6218[_0xe93a('0x21')]],'as':_0x5d6218['as'],'attributes':_0x5d6218['attributes']};}):[]};}):[]};}):[]:[]})[_0xe93a('0x11')](function(_0x1448ca){logger[_0xe93a('0x12')](_0xe93a('0x1a'),_0x239766);logger['debug'](_0xe93a('0x1a'),_0x239766,JSON[_0xe93a('0x23')](_0x1448ca));_0x5bc9aa(_0x1448ca);})[_0xe93a('0x24')](function(_0x35fed7){logger['error'](_0xe93a('0x1a'),_0x35fed7[_0xe93a('0x18')],_0x239766);_0x326eb4(_0x3579e1[_0xe93a('0x17')](0x1f4,_0x35fed7[_0xe93a('0x18')]));});});}; \ No newline at end of file +var _0xa04d=['request\x20sent','result','catch','ShowSquareProject','find','options','raw','where','attributes','include','map','model','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','SquareProject,\x20%s,\x20%s','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0xf3ac0b,_0x45a93a){var _0x45ad94=function(_0x325984){while(--_0x325984){_0xf3ac0b['push'](_0xf3ac0b['shift']());}};_0x45ad94(++_0x45a93a);}(_0xa04d,0x17f));var _0xda04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa04d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xda04('0x0'));var util=require(_0xda04('0x1'));var moment=require('moment');var BPromise=require(_0xda04('0x2'));var rs=require(_0xda04('0x3'));var fs=require('fs');var Redis=require(_0xda04('0x4'));var db=require(_0xda04('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xda04('0x6'))(_0xda04('0x7'));var config=require('../../config/environment');var jayson=require(_0xda04('0x8'));var client=jayson[_0xda04('0x9')][_0xda04('0xa')]({'port':0x232a});config[_0xda04('0xb')]=_[_0xda04('0xc')](config[_0xda04('0xb')],{'host':_0xda04('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xda04('0xb')]));require('./squareProject.socket')[_0xda04('0xe')](socket);function respondWithRpcPromise(_0x32e877,_0x19ee37,_0x2bdb89){return new BPromise(function(_0xdbe31e,_0x48d7fc){return client[_0xda04('0xf')](_0x32e877,_0x2bdb89)[_0xda04('0x10')](function(_0x28eeff){logger[_0xda04('0x11')](_0xda04('0x12'),_0x19ee37,'request\x20sent');logger[_0xda04('0x13')](_0xda04('0x14'),_0x19ee37,'request\x20sent',JSON['stringify'](_0x28eeff));if(_0x28eeff['error']){if(_0x28eeff[_0xda04('0x15')][_0xda04('0x16')]===0x1f4){logger[_0xda04('0x15')](_0xda04('0x12'),_0x19ee37,_0x28eeff['error'][_0xda04('0x17')]);return _0x48d7fc(_0x28eeff[_0xda04('0x15')][_0xda04('0x17')]);}logger[_0xda04('0x15')](_0xda04('0x12'),_0x19ee37,_0x28eeff[_0xda04('0x15')][_0xda04('0x17')]);return _0xdbe31e(_0x28eeff[_0xda04('0x15')][_0xda04('0x17')]);}else{logger['info'](_0xda04('0x12'),_0x19ee37,_0xda04('0x18'));_0xdbe31e(_0x28eeff[_0xda04('0x19')]['message']);}})[_0xda04('0x1a')](function(_0xe22b09){logger[_0xda04('0x15')](_0xda04('0x12'),_0x19ee37,_0xe22b09);_0x48d7fc(_0xe22b09);});});}exports[_0xda04('0x1b')]=function(_0x29743d){var _0x253fea=this;return new Promise(function(_0x4326cd,_0x19cd20){return db['SquareProject'][_0xda04('0x1c')]({'raw':_0x29743d[_0xda04('0x1d')]?_0x29743d[_0xda04('0x1d')][_0xda04('0x1e')]===undefined?!![]:![]:!![],'where':_0x29743d['options']?_0x29743d[_0xda04('0x1d')][_0xda04('0x1f')]||null:null,'attributes':_0x29743d['options']?_0x29743d[_0xda04('0x1d')][_0xda04('0x20')]||null:null,'include':_0x29743d['options']?_0x29743d['options'][_0xda04('0x21')]?_[_0xda04('0x22')](_0x29743d[_0xda04('0x1d')][_0xda04('0x21')],function(_0x27d332){return{'model':db[_0x27d332[_0xda04('0x23')]],'as':_0x27d332['as'],'attributes':_0x27d332[_0xda04('0x20')],'include':_0x27d332[_0xda04('0x21')]?_['map'](_0x27d332['include'],function(_0x2929fd){return{'model':db[_0x2929fd['model']],'as':_0x2929fd['as'],'attributes':_0x2929fd[_0xda04('0x20')],'include':_0x2929fd[_0xda04('0x21')]?_['map'](_0x2929fd[_0xda04('0x21')],function(_0x5cc0db){return{'model':db[_0x5cc0db[_0xda04('0x23')]],'as':_0x5cc0db['as'],'attributes':_0x5cc0db[_0xda04('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b444a){logger[_0xda04('0x11')](_0xda04('0x1b'),_0x29743d);logger[_0xda04('0x13')](_0xda04('0x1b'),_0x29743d,JSON[_0xda04('0x24')](_0x2b444a));_0x4326cd(_0x2b444a);})[_0xda04('0x1a')](function(_0x4dec49){logger[_0xda04('0x15')](_0xda04('0x1b'),_0x4dec49[_0xda04('0x17')],_0x29743d);_0x19cd20(_0x253fea['error'](0x1f4,_0x4dec49[_0xda04('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index e75afb2..a1dece9 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 _0x5d58=['register'];(function(_0x1c0d11,_0x3fe71d){var _0x52c727=function(_0x599f88){while(--_0x599f88){_0x1c0d11['push'](_0x1c0d11['shift']());}};_0x52c727(++_0x3fe71d);}(_0x5d58,0x187));var _0x85d5=function(_0xbbe8f6,_0x4df9e8){_0xbbe8f6=_0xbbe8f6-0x0;var _0x3d9fba=_0x5d58[_0xbbe8f6];return _0x3d9fba;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save','remove','update'];function createListener(_0x501631,_0x64d32c){return function(_0x1eff3b){_0x64d32c['emit'](_0x501631,_0x1eff3b);};}function removeListener(_0x1469fc,_0x30bfe8){return function(){SquareProjectEvents['removeListener'](_0x1469fc,_0x30bfe8);};}exports[_0x85d5('0x0')]=function(_0x2d457a){for(var _0x578fad=0x0,_0x46e7b4=events['length'];_0x578fad<_0x46e7b4;_0x578fad++){var _0x98c963=events[_0x578fad];var _0x3fecca=createListener('squareProject:'+_0x98c963,_0x2d457a);SquareProjectEvents['on'](_0x98c963,_0x3fecca);}}; \ No newline at end of file +var _0x1623=['removeListener','length','squareProject:','./squareProject.events','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1623,0xab));var _0x3162=function(_0x23c4f2,_0x247712){_0x23c4f2=_0x23c4f2-0x0;var _0x3b9c56=_0x1623[_0x23c4f2];return _0x3b9c56;};'use strict';var SquareProjectEvents=require(_0x3162('0x0'));var events=['save','remove',_0x3162('0x1')];function createListener(_0x27ee21,_0x36ccc3){return function(_0x2cc4d7){_0x36ccc3[_0x3162('0x2')](_0x27ee21,_0x2cc4d7);};}function removeListener(_0x4ce2bd,_0x5d49d0){return function(){SquareProjectEvents[_0x3162('0x3')](_0x4ce2bd,_0x5d49d0);};}exports['register']=function(_0x1b55f2){for(var _0x428de6=0x0,_0x53260d=events[_0x3162('0x4')];_0x428de6<_0x53260d;_0x428de6++){var _0x2dc07e=events[_0x428de6];var _0x26ee32=createListener(_0x3162('0x5')+_0x2dc07e,_0x1b55f2);SquareProjectEvents['on'](_0x2dc07e,_0x26ee32);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index c314496..2ee8ebf 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 _0x13a8=['show','download','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id'];(function(_0x1bbd88,_0xde54a3){var _0x15162f=function(_0x3a1dac){while(--_0x3a1dac){_0x1bbd88['push'](_0x1bbd88['shift']());}};_0x15162f(++_0xde54a3);}(_0x13a8,0x15d));var _0x813a=function(_0x52ea23,_0x146676){_0x52ea23=_0x52ea23-0x0;var _0x4fe2eb=_0x13a8[_0x52ea23];return _0x4fe2eb;};'use strict';var multer=require(_0x813a('0x0'));var util=require(_0x813a('0x1'));var path=require(_0x813a('0x2'));var timeout=require(_0x813a('0x3'));var express=require(_0x813a('0x4'));var router=express[_0x813a('0x5')]();var auth=require(_0x813a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x813a('0x7'));router[_0x813a('0x8')]('/',auth[_0x813a('0x9')](),controller[_0x813a('0xa')]);router[_0x813a('0x8')](_0x813a('0xb'),auth['isAuthenticated'](),controller[_0x813a('0xc')]);router[_0x813a('0x8')]('/:id/download',auth[_0x813a('0x9')](),controller[_0x813a('0xd')]);router[_0x813a('0xe')]('/',auth[_0x813a('0x9')](),controller[_0x813a('0xf')]);router['put'](_0x813a('0xb'),auth['isAuthenticated'](),controller[_0x813a('0x10')]);router['delete']('/:id/delete',auth[_0x813a('0x9')](),controller[_0x813a('0x11')]);module[_0x813a('0x12')]=router; \ No newline at end of file +var _0xa0af=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','isAuthenticated','show','/:id/download','download','create','put','/:id','delete'];(function(_0xdb5808,_0x58c067){var _0x111072=function(_0x3c3f27){while(--_0x3c3f27){_0xdb5808['push'](_0xdb5808['shift']());}};_0x111072(++_0x58c067);}(_0xa0af,0x18e));var _0xfa0a=function(_0x37fbeb,_0x54ea57){_0x37fbeb=_0x37fbeb-0x0;var _0xc3ccb9=_0xa0af[_0x37fbeb];return _0xc3ccb9;};'use strict';var multer=require(_0xfa0a('0x0'));var util=require(_0xfa0a('0x1'));var path=require(_0xfa0a('0x2'));var timeout=require(_0xfa0a('0x3'));var express=require(_0xfa0a('0x4'));var router=express[_0xfa0a('0x5')]();var auth=require(_0xfa0a('0x6'));var interaction=require(_0xfa0a('0x7'));var config=require(_0xfa0a('0x8'));var controller=require(_0xfa0a('0x9'));router[_0xfa0a('0xa')]('/',auth['isAuthenticated'](),controller[_0xfa0a('0xb')]);router[_0xfa0a('0xa')]('/:id',auth[_0xfa0a('0xc')](),controller[_0xfa0a('0xd')]);router['get'](_0xfa0a('0xe'),auth[_0xfa0a('0xc')](),controller[_0xfa0a('0xf')]);router['post']('/',auth[_0xfa0a('0xc')](),controller[_0xfa0a('0x10')]);router[_0xfa0a('0x11')](_0xfa0a('0x12'),auth[_0xfa0a('0xc')](),controller['update']);router[_0xfa0a('0x13')]('/:id/delete',auth[_0xfa0a('0xc')](),controller[_0xfa0a('0x14')]);module[_0xfa0a('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 5a53741..18eeb88 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 _0x6960=['exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf','sequelize'];(function(_0x4d0a5a,_0x578f87){var _0x3b5766=function(_0x51401e){while(--_0x51401e){_0x4d0a5a['push'](_0x4d0a5a['shift']());}};_0x3b5766(++_0x578f87);}(_0x6960,0xae));var _0x0696=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x6960[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0696('0x0'));module[_0x0696('0x1')]={'uniqueid':{'type':Sequelize[_0x0696('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0696('0x2')]},'context':{'type':Sequelize[_0x0696('0x2')]},'extension':{'type':Sequelize[_0x0696('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x0696('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x0696('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x0696('0x3')],'get':function(){var _0x2acd2a='';var _0x300f94=this[_0x0696('0x4')](_0x0696('0x5'));if(_0x300f94){_0x2acd2a=_0x300f94['substring'](_0x300f94[_0x0696('0x6')]('.'));}return _0x2acd2a;}}}; \ No newline at end of file +var _0xc7bd=['VIRTUAL','getDataValue','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x59eeb6,_0x2e7b71){var _0xba965f=function(_0x28e7f3){while(--_0x28e7f3){_0x59eeb6['push'](_0x59eeb6['shift']());}};_0xba965f(++_0x2e7b71);}(_0xc7bd,0x170));var _0xdc7b=function(_0x22dbf6,_0xdad8e6){_0x22dbf6=_0x22dbf6-0x0;var _0x3d01fc=_0xc7bd[_0x22dbf6];return _0x3d01fc;};'use strict';var Sequelize=require(_0xdc7b('0x0'));module[_0xdc7b('0x1')]={'uniqueid':{'type':Sequelize[_0xdc7b('0x2')]},'callerid':{'type':Sequelize[_0xdc7b('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xdc7b('0x2')]},'priority':{'type':Sequelize[_0xdc7b('0x2')]},'accountcode':{'type':Sequelize[_0xdc7b('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xdc7b('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xdc7b('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xdc7b('0x3')],'get':function(){var _0x6a2c2c='';var _0x5688dd=this[_0xdc7b('0x4')]('savePath');if(_0x5688dd){_0x6a2c2c=_0x5688dd[_0xdc7b('0x5')](_0x5688dd[_0xdc7b('0x6')]('.'));}return _0x6a2c2c;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 42eb7f4..f184001 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 _0x9a4e=['../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','apply','reject','update','then','sendStatus','stack','name','send','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','download','../../components/encryptor','uniqueid','filename','format','%s.cypher','decryptFile','secrets','savePath','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','info','unlinkSync','.cypher','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x84128f,_0x1f487e){var _0xe80ecc=function(_0x5d55a1){while(--_0x5d55a1){_0x84128f['push'](_0x84128f['shift']());}};_0xe80ecc(++_0x1f487e);}(_0x9a4e,0x1c9));var _0xe9a4=function(_0x207c93,_0x5ee335){_0x207c93=_0x207c93-0x0;var _0x4c8766=_0x9a4e[_0x207c93];return _0x4c8766;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe9a4('0x0'));var rimraf=require(_0xe9a4('0x1'));var zipdir=require(_0xe9a4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe9a4('0x3'));var moment=require(_0xe9a4('0x4'));var BPromise=require(_0xe9a4('0x5'));var Mustache=require('mustache');var util=require(_0xe9a4('0x6'));var path=require('path');var sox=require(_0xe9a4('0x7'));var csv=require(_0xe9a4('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe9a4('0x9'));var squel=require(_0xe9a4('0xa'));var crypto=require(_0xe9a4('0xb'));var jsforce=require(_0xe9a4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe9a4('0x8'));var querystring=require(_0xe9a4('0xd'));var Papa=require(_0xe9a4('0xe'));var Redis=require(_0xe9a4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe9a4('0x10'));var as=require(_0xe9a4('0x11'));var hardwareService=require(_0xe9a4('0x12'));var logger=require('../../config/logger')(_0xe9a4('0x13'));var utils=require(_0xe9a4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe9a4('0x15'));var db=require(_0xe9a4('0x16'))['db'];function respondWithStatusCode(_0x5c69ef,_0x3c0b2b){_0x3c0b2b=_0x3c0b2b||0xcc;return function(_0x1c5510){if(_0x1c5510){return _0x5c69ef['sendStatus'](_0x3c0b2b);}return _0x5c69ef['status'](_0x3c0b2b)[_0xe9a4('0x17')]();};}function respondWithResult(_0x3a2c87,_0x28757b){_0x28757b=_0x28757b||0xc8;return function(_0x52ce37){if(_0x52ce37){return _0x3a2c87[_0xe9a4('0x18')](_0x28757b)[_0xe9a4('0x19')](_0x52ce37);}};}function respondWithFilteredResult(_0x560422,_0x2b9155){return function(_0x52bda1){if(_0x52bda1){var _0x5ce236=_0x52bda1[_0xe9a4('0x1a')],_0x518d26=_0x2b9155[_0xe9a4('0x1b')],_0x1a2f37=_0x2b9155[_0xe9a4('0x1b')]+_0x2b9155[_0xe9a4('0x1c')],_0x599649;if(_0x1a2f37>=_0x5ce236){_0x1a2f37=_0x5ce236;_0x599649=0xc8;}else{_0x599649=0xce;}_0x560422[_0xe9a4('0x18')](_0x599649);return _0x560422[_0xe9a4('0x1d')]('Content-Range',_0x518d26+'-'+_0x1a2f37+'/'+_0x5ce236)['json'](_0x52bda1);}return null;};}function patchUpdates(_0x1088c6){return function(_0x56d446){try{jsonpatch[_0xe9a4('0x1e')](_0x56d446,_0x1088c6,!![]);}catch(_0x24c5b9){return BPromise[_0xe9a4('0x1f')](_0x24c5b9);}return _0x56d446['save']();};}function saveUpdates(_0x43e368,_0x3fe763){return function(_0x3203fc){if(_0x3203fc){return _0x3203fc[_0xe9a4('0x20')](_0x43e368)['then'](function(_0x3d8b21){return _0x3d8b21;});}return null;};}function removeEntity(_0xfb090d,_0x5add81){return function(_0x4b9ef3){if(_0x4b9ef3){return _0x4b9ef3['destroy']()[_0xe9a4('0x21')](function(){_0xfb090d[_0xe9a4('0x18')](0xcc)[_0xe9a4('0x17')]();});}};}function handleEntityNotFound(_0x135af0,_0x45c93a){return function(_0x53d246){if(!_0x53d246){_0x135af0[_0xe9a4('0x22')](0x194);}return _0x53d246;};}function handleError(_0x3973f4,_0x2504fe){_0x2504fe=_0x2504fe||0x1f4;return function(_0x2ae19c){logger['error'](_0x2ae19c[_0xe9a4('0x23')]);if(_0x2ae19c[_0xe9a4('0x24')]){delete _0x2ae19c[_0xe9a4('0x24')];}_0x3973f4[_0xe9a4('0x18')](_0x2504fe)[_0xe9a4('0x25')](_0x2ae19c);};}exports['index']=function(_0x5d8a0e,_0x577ce1){var _0x1045ce={},_0x267cc5={},_0x4a6d82={'count':0x0,'rows':[]};var _0x497bf0=_[_0xe9a4('0x26')](db[_0xe9a4('0x27')][_0xe9a4('0x28')],function(_0x403502){return{'name':_0x403502[_0xe9a4('0x29')],'type':_0x403502[_0xe9a4('0x2a')][_0xe9a4('0x2b')]};});_0x267cc5[_0xe9a4('0x2c')]=_[_0xe9a4('0x26')](_0x497bf0,_0xe9a4('0x24'));_0x267cc5[_0xe9a4('0x2d')]=_[_0xe9a4('0x2e')](_0x5d8a0e[_0xe9a4('0x2d')]);_0x267cc5['filters']=_[_0xe9a4('0x2f')](_0x267cc5['model'],_0x267cc5[_0xe9a4('0x2d')]);_0x1045ce[_0xe9a4('0x30')]=_['intersection'](_0x267cc5[_0xe9a4('0x2c')],qs['fields'](_0x5d8a0e[_0xe9a4('0x2d')][_0xe9a4('0x31')]));_0x1045ce['attributes']=_0x1045ce[_0xe9a4('0x30')][_0xe9a4('0x32')]?_0x1045ce[_0xe9a4('0x30')]:_0x267cc5[_0xe9a4('0x2c')];if(!_0x5d8a0e[_0xe9a4('0x2d')][_0xe9a4('0x33')]('nolimit')){_0x1045ce['limit']=qs['limit'](_0x5d8a0e['query']['limit']);_0x1045ce[_0xe9a4('0x1b')]=qs[_0xe9a4('0x1b')](_0x5d8a0e['query']['offset']);}_0x1045ce[_0xe9a4('0x34')]=qs[_0xe9a4('0x35')](_0x5d8a0e[_0xe9a4('0x2d')][_0xe9a4('0x35')]);_0x1045ce[_0xe9a4('0x36')]=qs[_0xe9a4('0x37')](_[_0xe9a4('0x38')](_0x5d8a0e[_0xe9a4('0x2d')],_0x267cc5[_0xe9a4('0x37')]),_0x497bf0);if(_0x5d8a0e['query'][_0xe9a4('0x39')]){_0x1045ce[_0xe9a4('0x36')]=_[_0xe9a4('0x3a')](_0x1045ce[_0xe9a4('0x36')],{'$or':_[_0xe9a4('0x26')](_0x497bf0,function(_0x490e6f){if(_0x490e6f[_0xe9a4('0x2a')]!=='VIRTUAL'){var _0x2c88bd={};_0x2c88bd[_0x490e6f[_0xe9a4('0x24')]]={'$like':'%'+_0x5d8a0e['query'][_0xe9a4('0x39')]+'%'};return _0x2c88bd;}})});}_0x1045ce=_[_0xe9a4('0x3a')]({},_0x1045ce,_0x5d8a0e[_0xe9a4('0x3b')]);var _0x45953a={'where':_0x1045ce[_0xe9a4('0x36')]};return db[_0xe9a4('0x27')][_0xe9a4('0x1a')](_0x45953a)[_0xe9a4('0x21')](function(_0x4c9dc2){_0x4a6d82[_0xe9a4('0x1a')]=_0x4c9dc2;if(_0x5d8a0e[_0xe9a4('0x2d')][_0xe9a4('0x3c')]){_0x1045ce[_0xe9a4('0x3d')]=[{'all':!![]}];}return db[_0xe9a4('0x27')][_0xe9a4('0x3e')](_0x1045ce);})['then'](function(_0x22463a){_0x4a6d82[_0xe9a4('0x3f')]=_0x22463a;return _0x4a6d82;})[_0xe9a4('0x21')](respondWithFilteredResult(_0x577ce1,_0x1045ce))[_0xe9a4('0x40')](handleError(_0x577ce1,null));};exports[_0xe9a4('0x41')]=function(_0x267cf5,_0x696b36){var _0x33b159={'raw':!![],'where':{'id':_0x267cf5[_0xe9a4('0x42')]['id']}},_0x5ecb9a={};_0x5ecb9a['model']=_[_0xe9a4('0x2e')](db[_0xe9a4('0x27')][_0xe9a4('0x28')]);_0x5ecb9a[_0xe9a4('0x2d')]=_[_0xe9a4('0x2e')](_0x267cf5[_0xe9a4('0x2d')]);_0x5ecb9a[_0xe9a4('0x37')]=_['intersection'](_0x5ecb9a[_0xe9a4('0x2c')],_0x5ecb9a[_0xe9a4('0x2d')]);_0x33b159['attributes']=_[_0xe9a4('0x2f')](_0x5ecb9a[_0xe9a4('0x2c')],qs['fields'](_0x267cf5[_0xe9a4('0x2d')][_0xe9a4('0x31')]));_0x33b159[_0xe9a4('0x30')]=_0x33b159[_0xe9a4('0x30')][_0xe9a4('0x32')]?_0x33b159[_0xe9a4('0x30')]:_0x5ecb9a[_0xe9a4('0x2c')];if(_0x267cf5[_0xe9a4('0x2d')]['includeAll']){_0x33b159[_0xe9a4('0x3d')]=[{'all':!![]}];}_0x33b159=_[_0xe9a4('0x3a')]({},_0x33b159,_0x267cf5[_0xe9a4('0x3b')]);return db[_0xe9a4('0x27')][_0xe9a4('0x43')](_0x33b159)[_0xe9a4('0x21')](handleEntityNotFound(_0x696b36,null))[_0xe9a4('0x21')](respondWithResult(_0x696b36,null))[_0xe9a4('0x40')](handleError(_0x696b36,null));};exports[_0xe9a4('0x44')]=function(_0x2febf8,_0x4de21d){return db[_0xe9a4('0x27')][_0xe9a4('0x44')](_0x2febf8['body'],{})[_0xe9a4('0x21')](respondWithResult(_0x4de21d,0xc9))[_0xe9a4('0x40')](handleError(_0x4de21d,null));};exports[_0xe9a4('0x20')]=function(_0x1801ad,_0x18f314){if(_0x1801ad['body']['id']){delete _0x1801ad[_0xe9a4('0x45')]['id'];}return db[_0xe9a4('0x27')]['find']({'where':{'id':_0x1801ad[_0xe9a4('0x42')]['id']}})[_0xe9a4('0x21')](handleEntityNotFound(_0x18f314,null))[_0xe9a4('0x21')](saveUpdates(_0x1801ad[_0xe9a4('0x45')],null))['then'](respondWithResult(_0x18f314,null))[_0xe9a4('0x40')](handleError(_0x18f314,null));};exports[_0xe9a4('0x46')]=function(_0x11d231,_0x4f3dd6,_0x9b047d){var _0x24a8a4=require(_0xe9a4('0x47'));var _0x565829=![];var _0x113fed={};if(_0x11d231[_0xe9a4('0x2d')][_0xe9a4('0x2a')]&&_0x11d231[_0xe9a4('0x2d')]['type']===_0xe9a4('0x48')){_0x113fed[_0xe9a4('0x48')]=_0x11d231[_0xe9a4('0x42')]['id'];}else{_0x113fed['id']=_0x11d231[_0xe9a4('0x42')]['id'];}return db['SquareRecording'][_0xe9a4('0x43')]({'where':_0x113fed,'attributes':['id','savePath',_0xe9a4('0x49')],'raw':!![]})[_0xe9a4('0x21')](handleEntityNotFound(_0x4f3dd6,null))[_0xe9a4('0x21')](function(_0x4d9204){if(_0x4d9204){var _0x43b2d9=_0x4d9204['savePath'];var _0x2406ab=util[_0xe9a4('0x4a')](_0xe9a4('0x4b'),_0x43b2d9);if(fs['existsSync'](_0x2406ab)){_0x565829=!![];return _0x24a8a4[_0xe9a4('0x4c')](_0x2406ab,_0x43b2d9,config[_0xe9a4('0x4d')]['recording'])[_0xe9a4('0x21')](function(){return _0x4d9204;});}return _0x4d9204;}})[_0xe9a4('0x21')](function(_0x49b939){if(_0x49b939){var _0x4e4638=_0x49b939[_0xe9a4('0x4e')];if(!fs[_0xe9a4('0x4f')](_0x4e4638)){throw new db[(_0xe9a4('0x50'))][(_0xe9a4('0x51'))](_0xe9a4('0x52'));}if(_0x49b939[_0xe9a4('0x49')]){return _0x4f3dd6[_0xe9a4('0x46')](_0x4e4638,_0x49b939['filename']+path[_0xe9a4('0x53')](_0x4e4638),function(){if(_0x565829){fs['unlink'](_0x4e4638);}});}else{return _0x4f3dd6[_0xe9a4('0x46')](_0x4e4638,function(_0x4770a6){if(_0x565829){fs[_0xe9a4('0x54')](_0x4e4638);}});}}})[_0xe9a4('0x40')](function(_0x103f8c){if(_0x103f8c[_0xe9a4('0x55')]==='SquareRecording\x20not\x20found'){_0x4f3dd6['status'](0x194)[_0xe9a4('0x25')](_0xe9a4('0x56'));}else{return handleError(_0x4f3dd6,null);}});};exports[_0xe9a4('0x57')]=function(_0x4c7a43,_0x38c86c){return db[_0xe9a4('0x27')][_0xe9a4('0x43')]({'where':{'id':_0x4c7a43[_0xe9a4('0x42')]['id']}})[_0xe9a4('0x21')](function(_0x1eeb79){if(!_0x1eeb79)throw new ReferenceError(_0xe9a4('0x58'));return _0x1eeb79;})[_0xe9a4('0x21')](function(_0x382221){var _0x23cc09=_0x382221[_0xe9a4('0x4e')];logger[_0xe9a4('0x59')]('cancellazione\x20fisica\x20documento\x20%s',_0x23cc09);if(!_['isNil'](_0x382221[_0xe9a4('0x4e')])&&fs[_0xe9a4('0x4f')](_0x23cc09)){logger[_0xe9a4('0x59')]('File:\x20\x22'+_0x23cc09+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe9a4('0x5a')](_0x23cc09);}_0x23cc09=_0x23cc09+_0xe9a4('0x5b');if(!_[_0xe9a4('0x5c')](_0x382221[_0xe9a4('0x4e')])&&fs[_0xe9a4('0x4f')](_0x23cc09)){logger['info'](_0xe9a4('0x5d')+_0x23cc09+_0xe9a4('0x5e'));fs[_0xe9a4('0x5a')](_0x23cc09);}return _0x382221;})[_0xe9a4('0x21')](function(_0x468223){if(!_0x468223)throw new InternalError();return _0x468223['destroy']();})['then'](function(){_0x38c86c[_0xe9a4('0x18')](0xcc)['end']();})['catch'](handleError(_0x38c86c,null));}; \ No newline at end of file +var _0x355b=['querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','Content-Range','reject','save','then','destroy','error','name','send','map','SquareRecording','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','rows','catch','show','params','length','includeAll','create','body','download','../../components/encryptor','uniqueid','savePath','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','find','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x428029,_0x1a5eb3){var _0x52033a=function(_0x5d73a8){while(--_0x5d73a8){_0x428029['push'](_0x428029['shift']());}};_0x52033a(++_0x1a5eb3);}(_0x355b,0x115));var _0xb355=function(_0x3b68f8,_0x367db8){_0x3b68f8=_0x3b68f8-0x0;var _0x3a2040=_0x355b[_0x3b68f8];return _0x3a2040;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb355('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb355('0x1'));var rp=require(_0xb355('0x2'));var moment=require(_0xb355('0x3'));var BPromise=require(_0xb355('0x4'));var Mustache=require(_0xb355('0x5'));var util=require(_0xb355('0x6'));var path=require('path');var sox=require(_0xb355('0x7'));var csv=require(_0xb355('0x8'));var ejs=require(_0xb355('0x9'));var fs=require('fs');var _=require(_0xb355('0xa'));var squel=require('squel');var crypto=require(_0xb355('0xb'));var jsforce=require(_0xb355('0xc'));var deskjs=require(_0xb355('0xd'));var toCsv=require(_0xb355('0x8'));var querystring=require(_0xb355('0xe'));var Papa=require(_0xb355('0xf'));var Redis=require(_0xb355('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb355('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb355('0x12'));var logger=require(_0xb355('0x13'))(_0xb355('0x14'));var utils=require(_0xb355('0x15'));var config=require(_0xb355('0x16'));var licenseUtil=require(_0xb355('0x17'));var db=require(_0xb355('0x18'))['db'];function respondWithStatusCode(_0x37fd51,_0x447214){_0x447214=_0x447214||0xcc;return function(_0x3359be){if(_0x3359be){return _0x37fd51[_0xb355('0x19')](_0x447214);}return _0x37fd51['status'](_0x447214)[_0xb355('0x1a')]();};}function respondWithResult(_0x353253,_0x128da8){_0x128da8=_0x128da8||0xc8;return function(_0x3163be){if(_0x3163be){return _0x353253[_0xb355('0x1b')](_0x128da8)[_0xb355('0x1c')](_0x3163be);}};}function respondWithFilteredResult(_0x5425fd,_0x389d48){return function(_0x48dda9){if(_0x48dda9){var _0x3b2dd9=_0x48dda9['count'],_0x5a7044=_0x389d48[_0xb355('0x1d')],_0x31b1e9=_0x389d48['offset']+_0x389d48[_0xb355('0x1e')],_0x5672ff;if(_0x31b1e9>=_0x3b2dd9){_0x31b1e9=_0x3b2dd9;_0x5672ff=0xc8;}else{_0x5672ff=0xce;}_0x5425fd[_0xb355('0x1b')](_0x5672ff);return _0x5425fd['set'](_0xb355('0x1f'),_0x5a7044+'-'+_0x31b1e9+'/'+_0x3b2dd9)['json'](_0x48dda9);}return null;};}function patchUpdates(_0x293894){return function(_0x1f9028){try{jsonpatch['apply'](_0x1f9028,_0x293894,!![]);}catch(_0x6a54b8){return BPromise[_0xb355('0x20')](_0x6a54b8);}return _0x1f9028[_0xb355('0x21')]();};}function saveUpdates(_0x5225e0,_0x313d2d){return function(_0xf5dca7){if(_0xf5dca7){return _0xf5dca7['update'](_0x5225e0)[_0xb355('0x22')](function(_0x307b9a){return _0x307b9a;});}return null;};}function removeEntity(_0xb3404a,_0x3ac4b0){return function(_0x56a4fd){if(_0x56a4fd){return _0x56a4fd[_0xb355('0x23')]()[_0xb355('0x22')](function(){_0xb3404a[_0xb355('0x1b')](0xcc)[_0xb355('0x1a')]();});}};}function handleEntityNotFound(_0x5ec812,_0x451c5b){return function(_0x33a187){if(!_0x33a187){_0x5ec812['sendStatus'](0x194);}return _0x33a187;};}function handleError(_0x546380,_0x4b6c8d){_0x4b6c8d=_0x4b6c8d||0x1f4;return function(_0x1043cc){logger[_0xb355('0x24')](_0x1043cc['stack']);if(_0x1043cc[_0xb355('0x25')]){delete _0x1043cc[_0xb355('0x25')];}_0x546380[_0xb355('0x1b')](_0x4b6c8d)[_0xb355('0x26')](_0x1043cc);};}exports['index']=function(_0x285235,_0x23bee2){var _0x19ad55={},_0x1201a0={},_0x280e47={'count':0x0,'rows':[]};var _0x1c8256=_[_0xb355('0x27')](db[_0xb355('0x28')][_0xb355('0x29')],function(_0x295f1b){return{'name':_0x295f1b[_0xb355('0x2a')],'type':_0x295f1b['type'][_0xb355('0x2b')]};});_0x1201a0[_0xb355('0x2c')]=_['map'](_0x1c8256,'name');_0x1201a0[_0xb355('0x2d')]=_[_0xb355('0x2e')](_0x285235['query']);_0x1201a0[_0xb355('0x2f')]=_[_0xb355('0x30')](_0x1201a0[_0xb355('0x2c')],_0x1201a0[_0xb355('0x2d')]);_0x19ad55[_0xb355('0x31')]=_[_0xb355('0x30')](_0x1201a0[_0xb355('0x2c')],qs[_0xb355('0x32')](_0x285235['query'][_0xb355('0x32')]));_0x19ad55[_0xb355('0x31')]=_0x19ad55[_0xb355('0x31')]['length']?_0x19ad55['attributes']:_0x1201a0[_0xb355('0x2c')];if(!_0x285235[_0xb355('0x2d')][_0xb355('0x33')](_0xb355('0x34'))){_0x19ad55[_0xb355('0x1e')]=qs[_0xb355('0x1e')](_0x285235[_0xb355('0x2d')][_0xb355('0x1e')]);_0x19ad55[_0xb355('0x1d')]=qs[_0xb355('0x1d')](_0x285235[_0xb355('0x2d')][_0xb355('0x1d')]);}_0x19ad55[_0xb355('0x35')]=qs[_0xb355('0x36')](_0x285235['query'][_0xb355('0x36')]);_0x19ad55[_0xb355('0x37')]=qs[_0xb355('0x2f')](_[_0xb355('0x38')](_0x285235[_0xb355('0x2d')],_0x1201a0[_0xb355('0x2f')]),_0x1c8256);if(_0x285235[_0xb355('0x2d')][_0xb355('0x39')]){_0x19ad55[_0xb355('0x37')]=_[_0xb355('0x3a')](_0x19ad55[_0xb355('0x37')],{'$or':_[_0xb355('0x27')](_0x1c8256,function(_0x3cfce2){if(_0x3cfce2[_0xb355('0x3b')]!==_0xb355('0x3c')){var _0x2ba0f8={};_0x2ba0f8[_0x3cfce2[_0xb355('0x25')]]={'$like':'%'+_0x285235[_0xb355('0x2d')][_0xb355('0x39')]+'%'};return _0x2ba0f8;}})});}_0x19ad55=_[_0xb355('0x3a')]({},_0x19ad55,_0x285235[_0xb355('0x3d')]);var _0x1ac6c7={'where':_0x19ad55[_0xb355('0x37')]};return db[_0xb355('0x28')]['count'](_0x1ac6c7)[_0xb355('0x22')](function(_0x2b3460){_0x280e47[_0xb355('0x3e')]=_0x2b3460;if(_0x285235[_0xb355('0x2d')]['includeAll']){_0x19ad55[_0xb355('0x3f')]=[{'all':!![]}];}return db[_0xb355('0x28')][_0xb355('0x40')](_0x19ad55);})[_0xb355('0x22')](function(_0x85b9df){_0x280e47[_0xb355('0x41')]=_0x85b9df;return _0x280e47;})[_0xb355('0x22')](respondWithFilteredResult(_0x23bee2,_0x19ad55))[_0xb355('0x42')](handleError(_0x23bee2,null));};exports[_0xb355('0x43')]=function(_0x3fd509,_0x4a7165){var _0x47a556={'raw':!![],'where':{'id':_0x3fd509[_0xb355('0x44')]['id']}},_0x1e8364={};_0x1e8364['model']=_[_0xb355('0x2e')](db['SquareRecording'][_0xb355('0x29')]);_0x1e8364['query']=_['keys'](_0x3fd509['query']);_0x1e8364['filters']=_[_0xb355('0x30')](_0x1e8364[_0xb355('0x2c')],_0x1e8364['query']);_0x47a556[_0xb355('0x31')]=_[_0xb355('0x30')](_0x1e8364[_0xb355('0x2c')],qs['fields'](_0x3fd509[_0xb355('0x2d')][_0xb355('0x32')]));_0x47a556['attributes']=_0x47a556[_0xb355('0x31')][_0xb355('0x45')]?_0x47a556[_0xb355('0x31')]:_0x1e8364['model'];if(_0x3fd509[_0xb355('0x2d')][_0xb355('0x46')]){_0x47a556[_0xb355('0x3f')]=[{'all':!![]}];}_0x47a556=_[_0xb355('0x3a')]({},_0x47a556,_0x3fd509['options']);return db[_0xb355('0x28')]['find'](_0x47a556)['then'](handleEntityNotFound(_0x4a7165,null))[_0xb355('0x22')](respondWithResult(_0x4a7165,null))[_0xb355('0x42')](handleError(_0x4a7165,null));};exports[_0xb355('0x47')]=function(_0x4407e9,_0x48abfd){return db[_0xb355('0x28')][_0xb355('0x47')](_0x4407e9['body'],{})[_0xb355('0x22')](respondWithResult(_0x48abfd,0xc9))[_0xb355('0x42')](handleError(_0x48abfd,null));};exports['update']=function(_0x51b63d,_0x5ae3be){if(_0x51b63d[_0xb355('0x48')]['id']){delete _0x51b63d['body']['id'];}return db[_0xb355('0x28')]['find']({'where':{'id':_0x51b63d['params']['id']}})[_0xb355('0x22')](handleEntityNotFound(_0x5ae3be,null))[_0xb355('0x22')](saveUpdates(_0x51b63d[_0xb355('0x48')],null))[_0xb355('0x22')](respondWithResult(_0x5ae3be,null))['catch'](handleError(_0x5ae3be,null));};exports[_0xb355('0x49')]=function(_0x427f67,_0x2fa166,_0x3a36be){var _0x1a0088=require(_0xb355('0x4a'));var _0x3aa794=![];var _0x25947f={};if(_0x427f67['query'][_0xb355('0x3b')]&&_0x427f67[_0xb355('0x2d')][_0xb355('0x3b')]===_0xb355('0x4b')){_0x25947f[_0xb355('0x4b')]=_0x427f67[_0xb355('0x44')]['id'];}else{_0x25947f['id']=_0x427f67[_0xb355('0x44')]['id'];}return db[_0xb355('0x28')]['find']({'where':_0x25947f,'attributes':['id',_0xb355('0x4c'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0x2fa166,null))[_0xb355('0x22')](function(_0x5a5456){if(_0x5a5456){var _0x4ae4d0=_0x5a5456['savePath'];var _0x2206d4=util['format']('%s.cypher',_0x4ae4d0);if(fs[_0xb355('0x4d')](_0x2206d4)){_0x3aa794=!![];return _0x1a0088[_0xb355('0x4e')](_0x2206d4,_0x4ae4d0,config[_0xb355('0x4f')]['recording'])[_0xb355('0x22')](function(){return _0x5a5456;});}return _0x5a5456;}})[_0xb355('0x22')](function(_0x9ac046){if(_0x9ac046){var _0x286cc0=_0x9ac046[_0xb355('0x4c')];if(!fs['existsSync'](_0x286cc0)){throw new db[(_0xb355('0x50'))][(_0xb355('0x51'))](_0xb355('0x52'));}if(_0x9ac046[_0xb355('0x53')]){return _0x2fa166['download'](_0x286cc0,_0x9ac046[_0xb355('0x53')]+path[_0xb355('0x54')](_0x286cc0),function(){if(_0x3aa794){fs[_0xb355('0x55')](_0x286cc0);}});}else{return _0x2fa166[_0xb355('0x49')](_0x286cc0,function(_0x5c66ee){if(_0x3aa794){fs[_0xb355('0x55')](_0x286cc0);}});}}})[_0xb355('0x42')](function(_0xc263a1){if(_0xc263a1[_0xb355('0x56')]==='SquareRecording\x20not\x20found'){_0x2fa166['status'](0x194)[_0xb355('0x26')](_0xb355('0x57'));}else{return handleError(_0x2fa166,null);}});};exports['destroy']=function(_0x512de0,_0xb919a2){return db['SquareRecording'][_0xb355('0x58')]({'where':{'id':_0x512de0[_0xb355('0x44')]['id']}})[_0xb355('0x22')](function(_0x4fda46){if(!_0x4fda46)throw new ReferenceError(_0xb355('0x59'));return _0x4fda46;})[_0xb355('0x22')](function(_0x256db8){var _0x2ff9f4=_0x256db8[_0xb355('0x4c')];logger[_0xb355('0x5a')](_0xb355('0x5b'),_0x2ff9f4);if(!_[_0xb355('0x5c')](_0x256db8[_0xb355('0x4c')])&&fs[_0xb355('0x4d')](_0x2ff9f4)){logger[_0xb355('0x5a')](_0xb355('0x5d')+_0x2ff9f4+_0xb355('0x5e'));fs['unlinkSync'](_0x2ff9f4);}_0x2ff9f4=_0x2ff9f4+_0xb355('0x5f');if(!_[_0xb355('0x5c')](_0x256db8[_0xb355('0x4c')])&&fs[_0xb355('0x4d')](_0x2ff9f4)){logger[_0xb355('0x5a')]('File:\x20\x22'+_0x2ff9f4+_0xb355('0x5e'));fs[_0xb355('0x60')](_0x2ff9f4);}return _0x256db8;})[_0xb355('0x22')](function(_0x1667fd){if(!_0x1667fd)throw new InternalError();return _0x1667fd[_0xb355('0x23')]();})[_0xb355('0x22')](function(){_0xb919a2['status'](0xcc)[_0xb355('0x1a')]();})[_0xb355('0x42')](handleError(_0xb919a2,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 03b2861..f5ed460 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 _0x79a3=['./squareRecording.attributes','exports','lodash','../../config/logger','api','bluebird','../../config/environment'];(function(_0x1702d7,_0x1a9b05){var _0x373f3e=function(_0x4af588){while(--_0x4af588){_0x1702d7['push'](_0x1702d7['shift']());}};_0x373f3e(++_0x1a9b05);}(_0x79a3,0x80));var _0x379a=function(_0x46293a,_0x4e06d8){_0x46293a=_0x46293a-0x0;var _0x4d4be9=_0x79a3[_0x46293a];return _0x4d4be9;};'use strict';var _=require(_0x379a('0x0'));var util=require('util');var logger=require(_0x379a('0x1'))(_0x379a('0x2'));var moment=require('moment');var BPromise=require(_0x379a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x379a('0x4'));var attributes=require(_0x379a('0x5'));module[_0x379a('0x6')]=function(_0x14907a,_0x9e6da6){return _0x14907a['define']('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdaa8=['api','./squareRecording.attributes','exports','SquareRecording','lodash','util','../../config/logger'];(function(_0xe3b7bb,_0x263836){var _0x2df486=function(_0x527828){while(--_0x527828){_0xe3b7bb['push'](_0xe3b7bb['shift']());}};_0x2df486(++_0x263836);}(_0xdaa8,0xe4));var _0x8daa=function(_0x4fdeec,_0x1c444c){_0x4fdeec=_0x4fdeec-0x0;var _0x3df500=_0xdaa8[_0x4fdeec];return _0x3df500;};'use strict';var _=require(_0x8daa('0x0'));var util=require(_0x8daa('0x1'));var logger=require(_0x8daa('0x2'))(_0x8daa('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('rimraf');var config=require('../../config/environment');var attributes=require(_0x8daa('0x4'));module[_0x8daa('0x5')]=function(_0x46f753,_0x4d2392){return _0x46f753['define'](_0x8daa('0x6'),attributes,{'tableName':'square_recordings','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 91c837a..09854c3 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 _0x3aa7=['stringify','code','error','message','info','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','debug','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s'];(function(_0x1626e3,_0x3be75a){var _0x1b8d3a=function(_0x4997e9){while(--_0x4997e9){_0x1626e3['push'](_0x1626e3['shift']());}};_0x1b8d3a(++_0x3be75a);}(_0x3aa7,0x99));var _0x73aa=function(_0x50a0f3,_0x4b43d0){_0x50a0f3=_0x50a0f3-0x0;var _0xdba9dc=_0x3aa7[_0x50a0f3];return _0xdba9dc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x73aa('0x0'));var BPromise=require(_0x73aa('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73aa('0x2'))['db'];var utils=require(_0x73aa('0x3'));var logger=require(_0x73aa('0x4'))(_0x73aa('0x5'));var config=require(_0x73aa('0x6'));var jayson=require(_0x73aa('0x7'));var client=jayson[_0x73aa('0x8')][_0x73aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x312fc6,_0x246fed,_0x43464a){return new BPromise(function(_0x4000e2,_0x392353){return client[_0x73aa('0xa')](_0x312fc6,_0x43464a)[_0x73aa('0xb')](function(_0x10c36d){logger['info'](_0x73aa('0xc'),_0x246fed,_0x73aa('0xd'));logger['debug'](_0x73aa('0xe'),_0x246fed,_0x73aa('0xd'),JSON[_0x73aa('0xf')](_0x10c36d));if(_0x10c36d['error']){if(_0x10c36d['error'][_0x73aa('0x10')]===0x1f4){logger[_0x73aa('0x11')](_0x73aa('0xc'),_0x246fed,_0x10c36d['error'][_0x73aa('0x12')]);return _0x392353(_0x10c36d[_0x73aa('0x11')][_0x73aa('0x12')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x246fed,_0x10c36d[_0x73aa('0x11')]['message']);return _0x4000e2(_0x10c36d[_0x73aa('0x11')][_0x73aa('0x12')]);}else{logger[_0x73aa('0x13')](_0x73aa('0xc'),_0x246fed,_0x73aa('0xd'));_0x4000e2(_0x10c36d['result']['message']);}})[_0x73aa('0x14')](function(_0x3f6358){logger[_0x73aa('0x11')](_0x73aa('0xc'),_0x246fed,_0x3f6358);_0x392353(_0x3f6358);});});}exports['CreateSquareRecording']=function(_0x1129c6){var _0x31ea4f=this;return new Promise(function(_0x127de3,_0x26158f){return db[_0x73aa('0x15')][_0x73aa('0x16')](_0x1129c6[_0x73aa('0x17')],{'raw':_0x1129c6[_0x73aa('0x18')]?_0x1129c6['options'][_0x73aa('0x19')]===undefined?!![]:![]:!![]})[_0x73aa('0xb')](function(_0x40f8af){logger[_0x73aa('0x13')](_0x73aa('0x1a'),_0x1129c6);logger[_0x73aa('0x1b')](_0x73aa('0x1a'),_0x1129c6,JSON[_0x73aa('0xf')](_0x40f8af));_0x127de3(_0x40f8af);})['catch'](function(_0x25827d){logger[_0x73aa('0x11')](_0x73aa('0x1a'),_0x25827d[_0x73aa('0x12')],_0x1129c6);_0x26158f(_0x31ea4f[_0x73aa('0x11')](0x1f4,_0x25827d[_0x73aa('0x12')]));});});}; \ No newline at end of file +var _0xf7c6=['request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','CreateSquareRecording','create','body','options','raw','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x36b435,_0x1287e){var _0x28a608=function(_0x1b1220){while(--_0x1b1220){_0x36b435['push'](_0x36b435['shift']());}};_0x28a608(++_0x1287e);}(_0xf7c6,0x1b6));var _0x6f7c=function(_0x1ad992,_0x5ddc63){_0x1ad992=_0x1ad992-0x0;var _0x535234=_0xf7c6[_0x1ad992];return _0x535234;};'use strict';var _=require(_0x6f7c('0x0'));var util=require(_0x6f7c('0x1'));var moment=require(_0x6f7c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6f7c('0x3'));var fs=require('fs');var Redis=require(_0x6f7c('0x4'));var db=require(_0x6f7c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6f7c('0x6'))(_0x6f7c('0x7'));var config=require('../../config/environment');var jayson=require(_0x6f7c('0x8'));var client=jayson[_0x6f7c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x518487,_0x1892b2,_0x797619){return new BPromise(function(_0x50b436,_0x16915e){return client[_0x6f7c('0xa')](_0x518487,_0x797619)[_0x6f7c('0xb')](function(_0x4fd8c2){logger[_0x6f7c('0xc')](_0x6f7c('0xd'),_0x1892b2,_0x6f7c('0xe'));logger[_0x6f7c('0xf')](_0x6f7c('0x10'),_0x1892b2,_0x6f7c('0xe'),JSON[_0x6f7c('0x11')](_0x4fd8c2));if(_0x4fd8c2['error']){if(_0x4fd8c2['error'][_0x6f7c('0x12')]===0x1f4){logger[_0x6f7c('0x13')](_0x6f7c('0xd'),_0x1892b2,_0x4fd8c2[_0x6f7c('0x13')][_0x6f7c('0x14')]);return _0x16915e(_0x4fd8c2[_0x6f7c('0x13')][_0x6f7c('0x14')]);}logger[_0x6f7c('0x13')](_0x6f7c('0xd'),_0x1892b2,_0x4fd8c2[_0x6f7c('0x13')][_0x6f7c('0x14')]);return _0x50b436(_0x4fd8c2[_0x6f7c('0x13')][_0x6f7c('0x14')]);}else{logger[_0x6f7c('0xc')](_0x6f7c('0xd'),_0x1892b2,_0x6f7c('0xe'));_0x50b436(_0x4fd8c2[_0x6f7c('0x15')][_0x6f7c('0x14')]);}})['catch'](function(_0x2815ad){logger[_0x6f7c('0x13')](_0x6f7c('0xd'),_0x1892b2,_0x2815ad);_0x16915e(_0x2815ad);});});}exports[_0x6f7c('0x16')]=function(_0xb377c1){var _0x5b477f=this;return new Promise(function(_0x5bac32,_0xea8b04){return db['SquareRecording'][_0x6f7c('0x17')](_0xb377c1[_0x6f7c('0x18')],{'raw':_0xb377c1[_0x6f7c('0x19')]?_0xb377c1['options'][_0x6f7c('0x1a')]===undefined?!![]:![]:!![]})[_0x6f7c('0xb')](function(_0x12f601){logger[_0x6f7c('0xc')](_0x6f7c('0x16'),_0xb377c1);logger[_0x6f7c('0xf')](_0x6f7c('0x16'),_0xb377c1,JSON[_0x6f7c('0x11')](_0x12f601));_0x5bac32(_0x12f601);})[_0x6f7c('0x1b')](function(_0x2137e7){logger['error'](_0x6f7c('0x16'),_0x2137e7[_0x6f7c('0x14')],_0xb377c1);_0xea8b04(_0x5b477f[_0x6f7c('0x13')](0x1f4,_0x2137e7['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 3c6e73d..8948ee4 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 _0xbd67=['index','/describe','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','get'];(function(_0x51042b,_0x12cca8){var _0x450779=function(_0x394dbc){while(--_0x394dbc){_0x51042b['push'](_0x51042b['shift']());}};_0x450779(++_0x12cca8);}(_0xbd67,0x1f1));var _0x7bd6=function(_0x31acc7,_0x168431){_0x31acc7=_0x31acc7-0x0;var _0x10d549=_0xbd67[_0x31acc7];return _0x10d549;};'use strict';var multer=require(_0x7bd6('0x0'));var util=require(_0x7bd6('0x1'));var path=require(_0x7bd6('0x2'));var timeout=require('connect-timeout');var express=require(_0x7bd6('0x3'));var router=express['Router']();var auth=require(_0x7bd6('0x4'));var interaction=require(_0x7bd6('0x5'));var config=require('../../config/environment');var controller=require('./squareReport.controller');router[_0x7bd6('0x6')]('/',auth['isAuthenticated'](),controller[_0x7bd6('0x7')]);router['get'](_0x7bd6('0x8'),auth[_0x7bd6('0x9')](),controller['describe']);router[_0x7bd6('0x6')](_0x7bd6('0xa'),auth[_0x7bd6('0x9')](),controller['show']);router[_0x7bd6('0xb')]('/',auth[_0x7bd6('0x9')](),controller[_0x7bd6('0xc')]);router[_0x7bd6('0xd')](_0x7bd6('0xa'),auth['isAuthenticated'](),controller[_0x7bd6('0xe')]);router[_0x7bd6('0xf')](_0x7bd6('0xa'),auth[_0x7bd6('0x9')](),controller[_0x7bd6('0x10')]);module[_0x7bd6('0x11')]=router; \ No newline at end of file +var _0x79d7=['post','create','put','delete','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReport.controller','isAuthenticated','index','get','/:id','show'];(function(_0x2bb19b,_0x2f7631){var _0x2d5d6e=function(_0x5406c8){while(--_0x5406c8){_0x2bb19b['push'](_0x2bb19b['shift']());}};_0x2d5d6e(++_0x2f7631);}(_0x79d7,0x94));var _0x779d=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x79d7[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require(_0x779d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x779d('0x1'));var express=require(_0x779d('0x2'));var router=express[_0x779d('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x779d('0x4'));var config=require(_0x779d('0x5'));var controller=require(_0x779d('0x6'));router['get']('/',auth[_0x779d('0x7')](),controller[_0x779d('0x8')]);router['get']('/describe',auth[_0x779d('0x7')](),controller['describe']);router[_0x779d('0x9')](_0x779d('0xa'),auth['isAuthenticated'](),controller[_0x779d('0xb')]);router[_0x779d('0xc')]('/',auth[_0x779d('0x7')](),controller[_0x779d('0xd')]);router[_0x779d('0xe')]('/:id',auth[_0x779d('0x7')](),controller['update']);router[_0x779d('0xf')](_0x779d('0xa'),auth[_0x779d('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index da9488e..1cc809e 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 _0xf2f3=['exports','STRING','DATE','BOOLEAN'];(function(_0x391e58,_0x571f00){var _0xd1e531=function(_0x2e714a){while(--_0x2e714a){_0x391e58['push'](_0x391e58['shift']());}};_0xd1e531(++_0x571f00);}(_0xf2f3,0x12c));var _0x3f2f=function(_0x4d3f9a,_0x480013){_0x4d3f9a=_0x4d3f9a-0x0;var _0x4e3830=_0xf2f3[_0x4d3f9a];return _0x4e3830;};'use strict';var Sequelize=require('sequelize');module[_0x3f2f('0x0')]={'network':{'type':Sequelize[_0x3f2f('0x1')]},'network_script':{'type':Sequelize[_0x3f2f('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3f2f('0x1')]},'version':{'type':Sequelize[_0x3f2f('0x1')]},'callerid':{'type':Sequelize[_0x3f2f('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x3f2f('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x3f2f('0x1')]},'dnid':{'type':Sequelize[_0x3f2f('0x1')]},'rdnis':{'type':Sequelize[_0x3f2f('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3f2f('0x1')]},'threadid':{'type':Sequelize[_0x3f2f('0x1')]},'project_name':{'type':Sequelize[_0x3f2f('0x1')]},'joinAt':{'type':Sequelize[_0x3f2f('0x2')]},'leaveAt':{'type':Sequelize[_0x3f2f('0x2')]},'bot':{'type':Sequelize[_0x3f2f('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf067=['STRING','DATE','BOOLEAN','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf067,0x6b));var _0x7f06=function(_0x5c8147,_0x225105){_0x5c8147=_0x5c8147-0x0;var _0x339961=_0xf067[_0x5c8147];return _0x339961;};'use strict';var Sequelize=require('sequelize');module[_0x7f06('0x0')]={'network':{'type':Sequelize[_0x7f06('0x1')]},'network_script':{'type':Sequelize[_0x7f06('0x1')]},'request':{'type':Sequelize[_0x7f06('0x1')]},'channel':{'type':Sequelize[_0x7f06('0x1')]},'language':{'type':Sequelize[_0x7f06('0x1')]},'type':{'type':Sequelize[_0x7f06('0x1')]},'uniqueid':{'type':Sequelize[_0x7f06('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7f06('0x1')]},'calleridname':{'type':Sequelize[_0x7f06('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x7f06('0x1')]},'callingtns':{'type':Sequelize[_0x7f06('0x1')]},'dnid':{'type':Sequelize[_0x7f06('0x1')]},'rdnis':{'type':Sequelize[_0x7f06('0x1')]},'context':{'type':Sequelize[_0x7f06('0x1')]},'extension':{'type':Sequelize[_0x7f06('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x7f06('0x1')]},'accountcode':{'type':Sequelize[_0x7f06('0x1')]},'threadid':{'type':Sequelize[_0x7f06('0x1')]},'project_name':{'type':Sequelize[_0x7f06('0x1')]},'joinAt':{'type':Sequelize[_0x7f06('0x2')]},'leaveAt':{'type':Sequelize[_0x7f06('0x2')]},'bot':{'type':Sequelize[_0x7f06('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index ea76ed2..7a835c3 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 _0x3974=['end','status','json','count','offset','limit','set','Content-Range','apply','reject','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','filters','attributes','fields','sort','where','pick','merge','filter','options','includeAll','include','SquareReport','catch','show','params','intersection','length','find','create','update','body','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4454af,_0x2fbd17){var _0x17a38d=function(_0x3b44e4){while(--_0x3b44e4){_0x4454af['push'](_0x4454af['shift']());}};_0x17a38d(++_0x2fbd17);}(_0x3974,0xbc));var _0x4397=function(_0x176941,_0x441e57){_0x176941=_0x176941-0x0;var _0xc1cc57=_0x3974[_0x176941];return _0xc1cc57;};'use strict';var pdf=require(_0x4397('0x0'));var emlformat=require(_0x4397('0x1'));var rimraf=require(_0x4397('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4397('0x3'));var moment=require(_0x4397('0x4'));var BPromise=require(_0x4397('0x5'));var Mustache=require(_0x4397('0x6'));var util=require(_0x4397('0x7'));var path=require('path');var sox=require(_0x4397('0x8'));var csv=require(_0x4397('0x9'));var ejs=require(_0x4397('0xa'));var fs=require('fs');var _=require(_0x4397('0xb'));var squel=require('squel');var crypto=require(_0x4397('0xc'));var jsforce=require(_0x4397('0xd'));var deskjs=require(_0x4397('0xe'));var toCsv=require(_0x4397('0x9'));var querystring=require('querystring');var Papa=require(_0x4397('0xf'));var Redis=require(_0x4397('0x10'));var authService=require(_0x4397('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4397('0x12'));var logger=require(_0x4397('0x13'))(_0x4397('0x14'));var utils=require('../../config/utils');var config=require(_0x4397('0x15'));var licenseUtil=require(_0x4397('0x16'));var db=require(_0x4397('0x17'))['db'];function respondWithStatusCode(_0x50b80d,_0x1354f5){_0x1354f5=_0x1354f5||0xcc;return function(_0x35f6ba){if(_0x35f6ba){return _0x50b80d[_0x4397('0x18')](_0x1354f5);}return _0x50b80d['status'](_0x1354f5)[_0x4397('0x19')]();};}function respondWithResult(_0x541bf0,_0x3b7b4a){_0x3b7b4a=_0x3b7b4a||0xc8;return function(_0x5f5899){if(_0x5f5899){return _0x541bf0[_0x4397('0x1a')](_0x3b7b4a)[_0x4397('0x1b')](_0x5f5899);}};}function respondWithFilteredResult(_0x3b6dfa,_0x1aa61f){return function(_0x172ce2){if(_0x172ce2){var _0x423224=_0x172ce2[_0x4397('0x1c')],_0x4fa1fa=_0x1aa61f[_0x4397('0x1d')],_0x428f3b=_0x1aa61f[_0x4397('0x1d')]+_0x1aa61f[_0x4397('0x1e')],_0x380666;if(_0x428f3b>=_0x423224){_0x428f3b=_0x423224;_0x380666=0xc8;}else{_0x380666=0xce;}_0x3b6dfa[_0x4397('0x1a')](_0x380666);return _0x3b6dfa[_0x4397('0x1f')](_0x4397('0x20'),_0x4fa1fa+'-'+_0x428f3b+'/'+_0x423224)['json'](_0x172ce2);}return null;};}function patchUpdates(_0x4d3284){return function(_0xff27cd){try{jsonpatch[_0x4397('0x21')](_0xff27cd,_0x4d3284,!![]);}catch(_0x6ebced){return BPromise[_0x4397('0x22')](_0x6ebced);}return _0xff27cd['save']();};}function saveUpdates(_0x523002,_0x64406d){return function(_0x1049c7){if(_0x1049c7){return _0x1049c7['update'](_0x523002)['then'](function(_0x499ebd){return _0x499ebd;});}return null;};}function removeEntity(_0x2cc426,_0x5b33e9){return function(_0x4f60f1){if(_0x4f60f1){return _0x4f60f1[_0x4397('0x23')]()[_0x4397('0x24')](function(){_0x2cc426['status'](0xcc)[_0x4397('0x19')]();});}};}function handleEntityNotFound(_0x4d6de6,_0x2655f1){return function(_0x2d3b13){if(!_0x2d3b13){_0x4d6de6['sendStatus'](0x194);}return _0x2d3b13;};}function handleError(_0x514472,_0x5d2b17){_0x5d2b17=_0x5d2b17||0x1f4;return function(_0x3fe57d){logger[_0x4397('0x25')](_0x3fe57d[_0x4397('0x26')]);if(_0x3fe57d[_0x4397('0x27')]){delete _0x3fe57d[_0x4397('0x27')];}_0x514472[_0x4397('0x1a')](_0x5d2b17)[_0x4397('0x28')](_0x3fe57d);};}exports[_0x4397('0x29')]=function(_0x47161d,_0x1c224b){var _0x411522={},_0xa59687={},_0x73cad0={'count':0x0,'rows':[]};var _0xc76066=_['map'](db['SquareReport'][_0x4397('0x2a')],function(_0x575536){return{'name':_0x575536[_0x4397('0x2b')],'type':_0x575536[_0x4397('0x2c')]['key']};});_0xa59687[_0x4397('0x2d')]=_[_0x4397('0x2e')](_0xc76066,_0x4397('0x27'));_0xa59687['query']=_[_0x4397('0x2f')](_0x47161d[_0x4397('0x30')]);_0xa59687[_0x4397('0x31')]=_['intersection'](_0xa59687[_0x4397('0x2d')],_0xa59687['query']);_0x411522[_0x4397('0x32')]=_['intersection'](_0xa59687[_0x4397('0x2d')],qs[_0x4397('0x33')](_0x47161d[_0x4397('0x30')][_0x4397('0x33')]));_0x411522[_0x4397('0x32')]=_0x411522[_0x4397('0x32')]['length']?_0x411522[_0x4397('0x32')]:_0xa59687[_0x4397('0x2d')];if(!_0x47161d['query']['hasOwnProperty']('nolimit')){_0x411522[_0x4397('0x1e')]=qs[_0x4397('0x1e')](_0x47161d[_0x4397('0x30')][_0x4397('0x1e')]);_0x411522[_0x4397('0x1d')]=qs[_0x4397('0x1d')](_0x47161d[_0x4397('0x30')]['offset']);}_0x411522['order']=qs[_0x4397('0x34')](_0x47161d[_0x4397('0x30')][_0x4397('0x34')]);_0x411522[_0x4397('0x35')]=qs['filters'](_[_0x4397('0x36')](_0x47161d[_0x4397('0x30')],_0xa59687[_0x4397('0x31')]),_0xc76066);if(_0x47161d[_0x4397('0x30')]['filter']){_0x411522[_0x4397('0x35')]=_[_0x4397('0x37')](_0x411522['where'],{'$or':_[_0x4397('0x2e')](_0xc76066,function(_0x1ff6ef){if(_0x1ff6ef[_0x4397('0x2c')]!=='VIRTUAL'){var _0x4ddc42={};_0x4ddc42[_0x1ff6ef[_0x4397('0x27')]]={'$like':'%'+_0x47161d[_0x4397('0x30')][_0x4397('0x38')]+'%'};return _0x4ddc42;}})});}_0x411522=_[_0x4397('0x37')]({},_0x411522,_0x47161d[_0x4397('0x39')]);var _0x32f144={'where':_0x411522['where']};return db['SquareReport'][_0x4397('0x1c')](_0x32f144)['then'](function(_0x40aad7){_0x73cad0[_0x4397('0x1c')]=_0x40aad7;if(_0x47161d[_0x4397('0x30')][_0x4397('0x3a')]){_0x411522[_0x4397('0x3b')]=[{'all':!![]}];}return db[_0x4397('0x3c')]['findAll'](_0x411522);})[_0x4397('0x24')](function(_0x278fc8){_0x73cad0['rows']=_0x278fc8;return _0x73cad0;})[_0x4397('0x24')](respondWithFilteredResult(_0x1c224b,_0x411522))[_0x4397('0x3d')](handleError(_0x1c224b,null));};exports[_0x4397('0x3e')]=function(_0x4cf255,_0x5aa05a){var _0x1fb51f={'raw':!![],'where':{'id':_0x4cf255[_0x4397('0x3f')]['id']}},_0x575f82={};_0x575f82[_0x4397('0x2d')]=_[_0x4397('0x2f')](db[_0x4397('0x3c')]['rawAttributes']);_0x575f82[_0x4397('0x30')]=_[_0x4397('0x2f')](_0x4cf255[_0x4397('0x30')]);_0x575f82[_0x4397('0x31')]=_[_0x4397('0x40')](_0x575f82[_0x4397('0x2d')],_0x575f82['query']);_0x1fb51f[_0x4397('0x32')]=_[_0x4397('0x40')](_0x575f82[_0x4397('0x2d')],qs['fields'](_0x4cf255[_0x4397('0x30')][_0x4397('0x33')]));_0x1fb51f[_0x4397('0x32')]=_0x1fb51f[_0x4397('0x32')][_0x4397('0x41')]?_0x1fb51f[_0x4397('0x32')]:_0x575f82[_0x4397('0x2d')];if(_0x4cf255['query'][_0x4397('0x3a')]){_0x1fb51f[_0x4397('0x3b')]=[{'all':!![]}];}_0x1fb51f=_[_0x4397('0x37')]({},_0x1fb51f,_0x4cf255['options']);return db[_0x4397('0x3c')][_0x4397('0x42')](_0x1fb51f)[_0x4397('0x24')](handleEntityNotFound(_0x5aa05a,null))[_0x4397('0x24')](respondWithResult(_0x5aa05a,null))[_0x4397('0x3d')](handleError(_0x5aa05a,null));};exports[_0x4397('0x43')]=function(_0x45653c,_0x60bc33){return db[_0x4397('0x3c')][_0x4397('0x43')](_0x45653c['body'],{})['then'](respondWithResult(_0x60bc33,0xc9))[_0x4397('0x3d')](handleError(_0x60bc33,null));};exports[_0x4397('0x44')]=function(_0x363028,_0x3dcffa){if(_0x363028[_0x4397('0x45')]['id']){delete _0x363028[_0x4397('0x45')]['id'];}return db['SquareReport'][_0x4397('0x42')]({'where':{'id':_0x363028[_0x4397('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3dcffa,null))['then'](saveUpdates(_0x363028[_0x4397('0x45')],null))[_0x4397('0x24')](respondWithResult(_0x3dcffa,null))[_0x4397('0x3d')](handleError(_0x3dcffa,null));};exports['destroy']=function(_0x20f4be,_0x23c91a){return db['SquareReport'][_0x4397('0x42')]({'where':{'id':_0x20f4be['params']['id']}})[_0x4397('0x24')](handleEntityNotFound(_0x23c91a,null))['then'](removeEntity(_0x23c91a,null))[_0x4397('0x3d')](handleError(_0x23c91a,null));};exports[_0x4397('0x46')]=function(_0x3c606a,_0x233136){return db[_0x4397('0x3c')][_0x4397('0x46')]()['then'](respondWithResult(_0x233136,null))[_0x4397('0x3d')](handleError(_0x233136,null));}; \ No newline at end of file +var _0x8ff3=['then','sendStatus','error','name','send','map','SquareReport','rawAttributes','fieldName','key','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','keys','intersection','includeAll','find','create','body','catch','update','params','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','json','apply','save'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8ff3,0x72));var _0x38ff=function(_0x122fe6,_0x4ac758){_0x122fe6=_0x122fe6-0x0;var _0x36b7d2=_0x8ff3[_0x122fe6];return _0x36b7d2;};'use strict';var pdf=require(_0x38ff('0x0'));var emlformat=require(_0x38ff('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x38ff('0x2'));var jsonpatch=require(_0x38ff('0x3'));var rp=require(_0x38ff('0x4'));var moment=require(_0x38ff('0x5'));var BPromise=require(_0x38ff('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x38ff('0x7'));var sox=require('sox');var csv=require(_0x38ff('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x38ff('0x9'));var squel=require(_0x38ff('0xa'));var crypto=require(_0x38ff('0xb'));var jsforce=require(_0x38ff('0xc'));var deskjs=require(_0x38ff('0xd'));var toCsv=require(_0x38ff('0x8'));var querystring=require(_0x38ff('0xe'));var Papa=require(_0x38ff('0xf'));var Redis=require(_0x38ff('0x10'));var authService=require(_0x38ff('0x11'));var qs=require(_0x38ff('0x12'));var as=require(_0x38ff('0x13'));var hardwareService=require(_0x38ff('0x14'));var logger=require('../../config/logger')(_0x38ff('0x15'));var utils=require(_0x38ff('0x16'));var config=require(_0x38ff('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x38ff('0x18'))['db'];function respondWithStatusCode(_0x83cfbc,_0x148a54){_0x148a54=_0x148a54||0xcc;return function(_0x465ed9){if(_0x465ed9){return _0x83cfbc['sendStatus'](_0x148a54);}return _0x83cfbc[_0x38ff('0x19')](_0x148a54)[_0x38ff('0x1a')]();};}function respondWithResult(_0x4d40da,_0xeb7d8a){_0xeb7d8a=_0xeb7d8a||0xc8;return function(_0x1227aa){if(_0x1227aa){return _0x4d40da[_0x38ff('0x19')](_0xeb7d8a)['json'](_0x1227aa);}};}function respondWithFilteredResult(_0x2428c5,_0x5dfcfd){return function(_0x40ebd0){if(_0x40ebd0){var _0x4e994a=_0x40ebd0[_0x38ff('0x1b')],_0x2e43bd=_0x5dfcfd[_0x38ff('0x1c')],_0x58c999=_0x5dfcfd[_0x38ff('0x1c')]+_0x5dfcfd[_0x38ff('0x1d')],_0x51c521;if(_0x58c999>=_0x4e994a){_0x58c999=_0x4e994a;_0x51c521=0xc8;}else{_0x51c521=0xce;}_0x2428c5[_0x38ff('0x19')](_0x51c521);return _0x2428c5[_0x38ff('0x1e')]('Content-Range',_0x2e43bd+'-'+_0x58c999+'/'+_0x4e994a)[_0x38ff('0x1f')](_0x40ebd0);}return null;};}function patchUpdates(_0xd5098c){return function(_0x5d3aec){try{jsonpatch[_0x38ff('0x20')](_0x5d3aec,_0xd5098c,!![]);}catch(_0x571235){return BPromise['reject'](_0x571235);}return _0x5d3aec[_0x38ff('0x21')]();};}function saveUpdates(_0x3e985b,_0x55052a){return function(_0xbbd596){if(_0xbbd596){return _0xbbd596['update'](_0x3e985b)[_0x38ff('0x22')](function(_0x2d3d4f){return _0x2d3d4f;});}return null;};}function removeEntity(_0x26291d,_0x4f6b6b){return function(_0x4f7639){if(_0x4f7639){return _0x4f7639['destroy']()[_0x38ff('0x22')](function(){_0x26291d[_0x38ff('0x19')](0xcc)[_0x38ff('0x1a')]();});}};}function handleEntityNotFound(_0x2f3408,_0x47f47e){return function(_0x154c0f){if(!_0x154c0f){_0x2f3408[_0x38ff('0x23')](0x194);}return _0x154c0f;};}function handleError(_0x10eb55,_0x30c59e){_0x30c59e=_0x30c59e||0x1f4;return function(_0x146997){logger[_0x38ff('0x24')](_0x146997['stack']);if(_0x146997[_0x38ff('0x25')]){delete _0x146997[_0x38ff('0x25')];}_0x10eb55['status'](_0x30c59e)[_0x38ff('0x26')](_0x146997);};}exports['index']=function(_0x2e943a,_0x188025){var _0x2a112a={},_0xf71750={},_0x585616={'count':0x0,'rows':[]};var _0xb5dd42=_[_0x38ff('0x27')](db[_0x38ff('0x28')][_0x38ff('0x29')],function(_0x2821bf){return{'name':_0x2821bf[_0x38ff('0x2a')],'type':_0x2821bf['type'][_0x38ff('0x2b')]};});_0xf71750['model']=_[_0x38ff('0x27')](_0xb5dd42,'name');_0xf71750['query']=_['keys'](_0x2e943a[_0x38ff('0x2c')]);_0xf71750[_0x38ff('0x2d')]=_['intersection'](_0xf71750[_0x38ff('0x2e')],_0xf71750[_0x38ff('0x2c')]);_0x2a112a[_0x38ff('0x2f')]=_['intersection'](_0xf71750[_0x38ff('0x2e')],qs[_0x38ff('0x30')](_0x2e943a[_0x38ff('0x2c')]['fields']));_0x2a112a[_0x38ff('0x2f')]=_0x2a112a[_0x38ff('0x2f')][_0x38ff('0x31')]?_0x2a112a[_0x38ff('0x2f')]:_0xf71750[_0x38ff('0x2e')];if(!_0x2e943a[_0x38ff('0x2c')][_0x38ff('0x32')](_0x38ff('0x33'))){_0x2a112a[_0x38ff('0x1d')]=qs[_0x38ff('0x1d')](_0x2e943a[_0x38ff('0x2c')][_0x38ff('0x1d')]);_0x2a112a[_0x38ff('0x1c')]=qs[_0x38ff('0x1c')](_0x2e943a[_0x38ff('0x2c')][_0x38ff('0x1c')]);}_0x2a112a['order']=qs[_0x38ff('0x34')](_0x2e943a['query'][_0x38ff('0x34')]);_0x2a112a[_0x38ff('0x35')]=qs[_0x38ff('0x2d')](_[_0x38ff('0x36')](_0x2e943a[_0x38ff('0x2c')],_0xf71750['filters']),_0xb5dd42);if(_0x2e943a[_0x38ff('0x2c')][_0x38ff('0x37')]){_0x2a112a[_0x38ff('0x35')]=_[_0x38ff('0x38')](_0x2a112a[_0x38ff('0x35')],{'$or':_['map'](_0xb5dd42,function(_0x59c713){if(_0x59c713[_0x38ff('0x39')]!==_0x38ff('0x3a')){var _0x5e49a1={};_0x5e49a1[_0x59c713[_0x38ff('0x25')]]={'$like':'%'+_0x2e943a[_0x38ff('0x2c')]['filter']+'%'};return _0x5e49a1;}})});}_0x2a112a=_[_0x38ff('0x38')]({},_0x2a112a,_0x2e943a[_0x38ff('0x3b')]);var _0xb17d5e={'where':_0x2a112a[_0x38ff('0x35')]};return db[_0x38ff('0x28')][_0x38ff('0x1b')](_0xb17d5e)[_0x38ff('0x22')](function(_0x5a2414){_0x585616[_0x38ff('0x1b')]=_0x5a2414;if(_0x2e943a[_0x38ff('0x2c')]['includeAll']){_0x2a112a[_0x38ff('0x3c')]=[{'all':!![]}];}return db[_0x38ff('0x28')][_0x38ff('0x3d')](_0x2a112a);})[_0x38ff('0x22')](function(_0x26a2f4){_0x585616[_0x38ff('0x3e')]=_0x26a2f4;return _0x585616;})[_0x38ff('0x22')](respondWithFilteredResult(_0x188025,_0x2a112a))['catch'](handleError(_0x188025,null));};exports['show']=function(_0x450fb4,_0x3832bb){var _0x52160c={'raw':!![],'where':{'id':_0x450fb4['params']['id']}},_0xaa907c={};_0xaa907c[_0x38ff('0x2e')]=_['keys'](db['SquareReport']['rawAttributes']);_0xaa907c[_0x38ff('0x2c')]=_[_0x38ff('0x3f')](_0x450fb4['query']);_0xaa907c[_0x38ff('0x2d')]=_[_0x38ff('0x40')](_0xaa907c[_0x38ff('0x2e')],_0xaa907c[_0x38ff('0x2c')]);_0x52160c[_0x38ff('0x2f')]=_[_0x38ff('0x40')](_0xaa907c[_0x38ff('0x2e')],qs[_0x38ff('0x30')](_0x450fb4[_0x38ff('0x2c')][_0x38ff('0x30')]));_0x52160c[_0x38ff('0x2f')]=_0x52160c['attributes']['length']?_0x52160c[_0x38ff('0x2f')]:_0xaa907c[_0x38ff('0x2e')];if(_0x450fb4[_0x38ff('0x2c')][_0x38ff('0x41')]){_0x52160c[_0x38ff('0x3c')]=[{'all':!![]}];}_0x52160c=_['merge']({},_0x52160c,_0x450fb4[_0x38ff('0x3b')]);return db[_0x38ff('0x28')][_0x38ff('0x42')](_0x52160c)[_0x38ff('0x22')](handleEntityNotFound(_0x3832bb,null))[_0x38ff('0x22')](respondWithResult(_0x3832bb,null))['catch'](handleError(_0x3832bb,null));};exports[_0x38ff('0x43')]=function(_0x17566b,_0x5d5b95){return db['SquareReport']['create'](_0x17566b[_0x38ff('0x44')],{})[_0x38ff('0x22')](respondWithResult(_0x5d5b95,0xc9))[_0x38ff('0x45')](handleError(_0x5d5b95,null));};exports[_0x38ff('0x46')]=function(_0x291ad2,_0x44f746){if(_0x291ad2[_0x38ff('0x44')]['id']){delete _0x291ad2['body']['id'];}return db[_0x38ff('0x28')][_0x38ff('0x42')]({'where':{'id':_0x291ad2[_0x38ff('0x47')]['id']}})[_0x38ff('0x22')](handleEntityNotFound(_0x44f746,null))['then'](saveUpdates(_0x291ad2[_0x38ff('0x44')],null))[_0x38ff('0x22')](respondWithResult(_0x44f746,null))['catch'](handleError(_0x44f746,null));};exports[_0x38ff('0x48')]=function(_0x340038,_0x80bc13){return db[_0x38ff('0x28')][_0x38ff('0x42')]({'where':{'id':_0x340038[_0x38ff('0x47')]['id']}})[_0x38ff('0x22')](handleEntityNotFound(_0x80bc13,null))[_0x38ff('0x22')](removeEntity(_0x80bc13,null))[_0x38ff('0x45')](handleError(_0x80bc13,null));};exports['describe']=function(_0x8dc51c,_0x7a47d5){return db[_0x38ff('0x28')][_0x38ff('0x49')]()[_0x38ff('0x22')](respondWithResult(_0x7a47d5,null))[_0x38ff('0x45')](handleError(_0x7a47d5,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index a0d5583..f9bbec5 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 _0x91b9=['project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport','uniqueid'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x91b9,0x1c2));var _0x991b=function(_0x2d9037,_0x3ce4ae){_0x2d9037=_0x2d9037-0x0;var _0xc57379=_0x91b9[_0x2d9037];return _0xc57379;};'use strict';var _=require(_0x991b('0x0'));var util=require(_0x991b('0x1'));var logger=require(_0x991b('0x2'))(_0x991b('0x3'));var moment=require(_0x991b('0x4'));var BPromise=require(_0x991b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x991b('0x6'));var config=require(_0x991b('0x7'));var attributes=require(_0x991b('0x8'));module['exports']=function(_0x8b45e6,_0x32d606){return _0x8b45e6[_0x991b('0x9')](_0x991b('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x991b('0xb'),_0x991b('0xc')]},{'name':_0x991b('0xd'),'fields':[_0x991b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbef0=['moment','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','define','SquareReport','uniqueid','project_name','leaveAt','lodash','util','api'];(function(_0xdc356f,_0x3003d0){var _0x339eaa=function(_0xc2283e){while(--_0xc2283e){_0xdc356f['push'](_0xdc356f['shift']());}};_0x339eaa(++_0x3003d0);}(_0xbef0,0x107));var _0x0bef=function(_0x233ae1,_0x2bdd91){_0x233ae1=_0x233ae1-0x0;var _0x1e2d15=_0xbef0[_0x233ae1];return _0x1e2d15;};'use strict';var _=require(_0x0bef('0x0'));var util=require(_0x0bef('0x1'));var logger=require('../../config/logger')(_0x0bef('0x2'));var moment=require(_0x0bef('0x3'));var BPromise=require(_0x0bef('0x4'));var rp=require(_0x0bef('0x5'));var fs=require('fs');var path=require(_0x0bef('0x6'));var rimraf=require('rimraf');var config=require(_0x0bef('0x7'));var attributes=require(_0x0bef('0x8'));module['exports']=function(_0x56487e,_0x4febd0){return _0x56487e[_0x0bef('0x9')](_0x0bef('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x0bef('0xb'),_0x0bef('0xc')]},{'name':_0x0bef('0xd'),'fields':[_0x0bef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index c654f8f..142a8ac 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 _0xf2ca=['then','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','SquareReport','create','body','options','raw','CreateSquareReport','UpdateSquareReport','update','where','attributes','limit'];(function(_0x1347de,_0x15ed4d){var _0x26d3df=function(_0x3cdc01){while(--_0x3cdc01){_0x1347de['push'](_0x1347de['shift']());}};_0x26d3df(++_0x15ed4d);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x3aeb36,_0x312dc9){_0x3aeb36=_0x3aeb36-0x0;var _0xa2ef21=_0xf2ca[_0x3aeb36];return _0xa2ef21;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var moment=require(_0xaf2c('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf2c('0x3'));var fs=require('fs');var Redis=require(_0xaf2c('0x4'));var db=require(_0xaf2c('0x5'))['db'];var utils=require(_0xaf2c('0x6'));var logger=require(_0xaf2c('0x7'))(_0xaf2c('0x8'));var config=require('../../config/environment');var jayson=require(_0xaf2c('0x9'));var client=jayson[_0xaf2c('0xa')][_0xaf2c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f9531,_0x58351f,_0x37fedd){return new BPromise(function(_0x3c0421,_0x4a7397){return client[_0xaf2c('0xc')](_0x1f9531,_0x37fedd)['then'](function(_0x439ca3){logger['info'](_0xaf2c('0xd'),_0x58351f,_0xaf2c('0xe'));logger[_0xaf2c('0xf')](_0xaf2c('0x10'),_0x58351f,'request\x20sent',JSON['stringify'](_0x439ca3));if(_0x439ca3[_0xaf2c('0x11')]){if(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x12')]===0x1f4){logger[_0xaf2c('0x11')](_0xaf2c('0xd'),_0x58351f,_0x439ca3['error']['message']);return _0x4a7397(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);}logger[_0xaf2c('0x11')](_0xaf2c('0xd'),_0x58351f,_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);return _0x3c0421(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);}else{logger[_0xaf2c('0x14')](_0xaf2c('0xd'),_0x58351f,_0xaf2c('0xe'));_0x3c0421(_0x439ca3[_0xaf2c('0x15')][_0xaf2c('0x13')]);}})[_0xaf2c('0x16')](function(_0x705d09){logger['error'](_0xaf2c('0xd'),_0x58351f,_0x705d09);_0x4a7397(_0x705d09);});});}exports['CreateSquareReport']=function(_0x278a28){var _0x474c80=this;return new Promise(function(_0x1d544a,_0x578492){return db[_0xaf2c('0x17')][_0xaf2c('0x18')](_0x278a28[_0xaf2c('0x19')],{'raw':_0x278a28[_0xaf2c('0x1a')]?_0x278a28[_0xaf2c('0x1a')][_0xaf2c('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x35e712){logger[_0xaf2c('0x14')](_0xaf2c('0x1c'),_0x278a28);logger[_0xaf2c('0xf')](_0xaf2c('0x1c'),_0x278a28,JSON['stringify'](_0x35e712));_0x1d544a(_0x35e712);})[_0xaf2c('0x16')](function(_0xbf6f62){logger[_0xaf2c('0x11')]('CreateSquareReport',_0xbf6f62['message'],_0x278a28);_0x578492(_0x474c80[_0xaf2c('0x11')](0x1f4,_0xbf6f62[_0xaf2c('0x13')]));});});};exports[_0xaf2c('0x1d')]=function(_0x99f78d){var _0x591aff=this;return new Promise(function(_0x2b8f1a,_0xf1a7cf){return db[_0xaf2c('0x17')][_0xaf2c('0x1e')](_0x99f78d[_0xaf2c('0x19')],{'raw':_0x99f78d[_0xaf2c('0x1a')]?_0x99f78d[_0xaf2c('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x99f78d[_0xaf2c('0x1a')]?_0x99f78d[_0xaf2c('0x1a')][_0xaf2c('0x1f')]||null:null,'attributes':_0x99f78d[_0xaf2c('0x1a')]?_0x99f78d['options'][_0xaf2c('0x20')]||null:null,'limit':_0x99f78d['options']?_0x99f78d[_0xaf2c('0x1a')][_0xaf2c('0x21')]||null:null})[_0xaf2c('0x22')](function(_0x5d685a){logger[_0xaf2c('0x14')](_0xaf2c('0x1d'),_0x99f78d);logger[_0xaf2c('0xf')]('UpdateSquareReport',_0x99f78d,JSON[_0xaf2c('0x23')](_0x5d685a));_0x2b8f1a(_0x5d685a);})[_0xaf2c('0x16')](function(_0x42e2a5){logger[_0xaf2c('0x11')]('UpdateSquareReport',_0x42e2a5[_0xaf2c('0x13')],_0x99f78d);_0xf1a7cf(_0x591aff[_0xaf2c('0x11')](0x1f4,_0x42e2a5[_0xaf2c('0x13')]));});});}; \ No newline at end of file +var _0xd6d6=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','body','options','raw','then','CreateSquareReport','UpdateSquareReport','SquareReport','update','where','lodash','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x13fce7,_0x12b8e6){_0x13fce7=_0x13fce7-0x0;var _0x27baf4=_0xd6d6[_0x13fce7];return _0x27baf4;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var BPromise=require(_0x6d6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6d('0x4'));var db=require(_0x6d6d('0x5'))['db'];var utils=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var config=require(_0x6d6d('0x9'));var jayson=require(_0x6d6d('0xa'));var client=jayson['client'][_0x6d6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bf731,_0x44f83d,_0x18f824){return new BPromise(function(_0xd49f57,_0x408f88){return client[_0x6d6d('0xc')](_0x1bf731,_0x18f824)['then'](function(_0x51dd38){logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,_0x6d6d('0xf'));logger[_0x6d6d('0x10')](_0x6d6d('0x11'),_0x44f83d,'request\x20sent',JSON[_0x6d6d('0x12')](_0x51dd38));if(_0x51dd38[_0x6d6d('0x13')]){if(_0x51dd38['error']['code']===0x1f4){logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);return _0x408f88(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38['error'][_0x6d6d('0x14')]);return _0xd49f57(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}else{logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,'request\x20sent');_0xd49f57(_0x51dd38[_0x6d6d('0x15')]['message']);}})[_0x6d6d('0x16')](function(_0x2cbc86){logger[_0x6d6d('0x13')]('SquareReport,\x20%s,\x20%s',_0x44f83d,_0x2cbc86);_0x408f88(_0x2cbc86);});});}exports['CreateSquareReport']=function(_0x9e1e18){var _0x1a75d8=this;return new Promise(function(_0x2b59d4,_0x2c5314){return db['SquareReport']['create'](_0x9e1e18[_0x6d6d('0x17')],{'raw':_0x9e1e18['options']?_0x9e1e18[_0x6d6d('0x18')][_0x6d6d('0x19')]===undefined?!![]:![]:!![]})[_0x6d6d('0x1a')](function(_0x450352){logger[_0x6d6d('0xd')](_0x6d6d('0x1b'),_0x9e1e18);logger[_0x6d6d('0x10')](_0x6d6d('0x1b'),_0x9e1e18,JSON[_0x6d6d('0x12')](_0x450352));_0x2b59d4(_0x450352);})[_0x6d6d('0x16')](function(_0x24b10d){logger[_0x6d6d('0x13')](_0x6d6d('0x1b'),_0x24b10d[_0x6d6d('0x14')],_0x9e1e18);_0x2c5314(_0x1a75d8[_0x6d6d('0x13')](0x1f4,_0x24b10d[_0x6d6d('0x14')]));});});};exports[_0x6d6d('0x1c')]=function(_0x583b10){var _0x3b73e5=this;return new Promise(function(_0x2dcb9c,_0x99f7d6){return db[_0x6d6d('0x1d')][_0x6d6d('0x1e')](_0x583b10[_0x6d6d('0x17')],{'raw':_0x583b10['options']?_0x583b10[_0x6d6d('0x18')][_0x6d6d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x583b10[_0x6d6d('0x18')]?_0x583b10[_0x6d6d('0x18')][_0x6d6d('0x1f')]||null:null,'attributes':_0x583b10[_0x6d6d('0x18')]?_0x583b10[_0x6d6d('0x18')]['attributes']||null:null,'limit':_0x583b10[_0x6d6d('0x18')]?_0x583b10[_0x6d6d('0x18')]['limit']||null:null})['then'](function(_0x3edcce){logger[_0x6d6d('0xd')](_0x6d6d('0x1c'),_0x583b10);logger['debug'](_0x6d6d('0x1c'),_0x583b10,JSON[_0x6d6d('0x12')](_0x3edcce));_0x2dcb9c(_0x3edcce);})[_0x6d6d('0x16')](function(_0x1c8340){logger[_0x6d6d('0x13')](_0x6d6d('0x1c'),_0x1c8340[_0x6d6d('0x14')],_0x583b10);_0x99f7d6(_0x3b73e5[_0x6d6d('0x13')](0x1f4,_0x1c8340[_0x6d6d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 0f34d7a..234e72b 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 _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x3219ab,_0x4dcf46){var _0x5c6f11=function(_0x48e4fa){while(--_0x48e4fa){_0x3219ab['push'](_0x3219ab['shift']());}};_0x5c6f11(++_0x4dcf46);}(_0x7a54,0x106));var _0x47a5=function(_0x4e2b21,_0x28eef0){_0x4e2b21=_0x4e2b21-0x0;var _0x1d171d=_0x7a54[_0x4e2b21];return _0x1d171d;};'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 auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file +var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x2b43c6,_0x16c020){var _0x3c2c42=function(_0x2ee132){while(--_0x2ee132){_0x2b43c6['push'](_0x2b43c6['shift']());}};_0x3c2c42(++_0x16c020);}(_0x7a54,0x106));var _0x47a5=function(_0x36e938,_0x36e8cf){_0x36e938=_0x36e938-0x0;var _0x5622ec=_0x7a54[_0x36e938];return _0x5622ec;};'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 auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 2a9b3f2..aff6397 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 _0x59b0=['sequelize','STRING','TEXT'];(function(_0x4d38c3,_0x3b09e3){var _0x4068c2=function(_0xd8ac56){while(--_0xd8ac56){_0x4d38c3['push'](_0x4d38c3['shift']());}};_0x4068c2(++_0x3b09e3);}(_0x59b0,0x1da));var _0x059b=function(_0x26d9b3,_0x591f4e){_0x26d9b3=_0x26d9b3-0x0;var _0x15c226=_0x59b0[_0x26d9b3];return _0x15c226;};'use strict';var Sequelize=require(_0x059b('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x059b('0x1')]},'node':{'type':Sequelize[_0x059b('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x059b('0x2')]},'project_name':{'type':Sequelize[_0x059b('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x30d6=['STRING','sequelize','exports'];(function(_0x314bef,_0x5e4fa3){var _0x3b58cc=function(_0x33f116){while(--_0x33f116){_0x314bef['push'](_0x314bef['shift']());}};_0x3b58cc(++_0x5e4fa3);}(_0x30d6,0x130));var _0x630d=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x30d6[_0x4de586];return _0x46baf5;};'use strict';var Sequelize=require(_0x630d('0x0'));module[_0x630d('0x1')]={'uniqueid':{'type':Sequelize[_0x630d('0x2')]},'node':{'type':Sequelize[_0x630d('0x2')]},'application':{'type':Sequelize[_0x630d('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x630d('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index b849272..ead1797 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 _0xc700=['params','rawAttributes','options','find','create','body','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','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','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','SquareDetailsReport','fieldName','type','key','map','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','includeAll','findAll','catch'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0xc700,0x9b));var _0x0c70=function(_0x553543,_0x1c6238){_0x553543=_0x553543-0x0;var _0x51b4c1=_0xc700[_0x553543];return _0x51b4c1;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0c70('0x0'));var jsonpatch=require(_0x0c70('0x1'));var rp=require(_0x0c70('0x2'));var moment=require('moment');var BPromise=require(_0x0c70('0x3'));var Mustache=require(_0x0c70('0x4'));var util=require(_0x0c70('0x5'));var path=require(_0x0c70('0x6'));var sox=require(_0x0c70('0x7'));var csv=require(_0x0c70('0x8'));var ejs=require(_0x0c70('0x9'));var fs=require('fs');var _=require(_0x0c70('0xa'));var squel=require(_0x0c70('0xb'));var crypto=require('crypto');var jsforce=require(_0x0c70('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0c70('0x8'));var querystring=require(_0x0c70('0xd'));var Papa=require(_0x0c70('0xe'));var Redis=require(_0x0c70('0xf'));var authService=require(_0x0c70('0x10'));var qs=require(_0x0c70('0x11'));var as=require(_0x0c70('0x12'));var hardwareService=require(_0x0c70('0x13'));var logger=require(_0x0c70('0x14'))(_0x0c70('0x15'));var utils=require(_0x0c70('0x16'));var config=require(_0x0c70('0x17'));var licenseUtil=require(_0x0c70('0x18'));var db=require(_0x0c70('0x19'))['db'];function respondWithStatusCode(_0xb9008b,_0x521568){_0x521568=_0x521568||0xcc;return function(_0x413abd){if(_0x413abd){return _0xb9008b[_0x0c70('0x1a')](_0x521568);}return _0xb9008b[_0x0c70('0x1b')](_0x521568)['end']();};}function respondWithResult(_0x459221,_0x132abf){_0x132abf=_0x132abf||0xc8;return function(_0x7bde0){if(_0x7bde0){return _0x459221[_0x0c70('0x1b')](_0x132abf)['json'](_0x7bde0);}};}function respondWithFilteredResult(_0x23667e,_0x5e3ae4){return function(_0x58f46){if(_0x58f46){var _0x4f087f=_0x58f46[_0x0c70('0x1c')],_0x50783b=_0x5e3ae4['offset'],_0x309f81=_0x5e3ae4['offset']+_0x5e3ae4[_0x0c70('0x1d')],_0x14c110;if(_0x309f81>=_0x4f087f){_0x309f81=_0x4f087f;_0x14c110=0xc8;}else{_0x14c110=0xce;}_0x23667e[_0x0c70('0x1b')](_0x14c110);return _0x23667e[_0x0c70('0x1e')](_0x0c70('0x1f'),_0x50783b+'-'+_0x309f81+'/'+_0x4f087f)[_0x0c70('0x20')](_0x58f46);}return null;};}function patchUpdates(_0x1f50bb){return function(_0x2a3701){try{jsonpatch[_0x0c70('0x21')](_0x2a3701,_0x1f50bb,!![]);}catch(_0x1a9e73){return BPromise[_0x0c70('0x22')](_0x1a9e73);}return _0x2a3701[_0x0c70('0x23')]();};}function saveUpdates(_0x11ae2f,_0x1e6aac){return function(_0x3b72c5){if(_0x3b72c5){return _0x3b72c5[_0x0c70('0x24')](_0x11ae2f)['then'](function(_0x44a240){return _0x44a240;});}return null;};}function removeEntity(_0x489820,_0x240007){return function(_0x48afa3){if(_0x48afa3){return _0x48afa3[_0x0c70('0x25')]()[_0x0c70('0x26')](function(){_0x489820[_0x0c70('0x1b')](0xcc)[_0x0c70('0x27')]();});}};}function handleEntityNotFound(_0x21f7b8,_0x1e3e7f){return function(_0x151605){if(!_0x151605){_0x21f7b8[_0x0c70('0x1a')](0x194);}return _0x151605;};}function handleError(_0x18980b,_0x146e67){_0x146e67=_0x146e67||0x1f4;return function(_0x59ea42){logger[_0x0c70('0x28')](_0x59ea42[_0x0c70('0x29')]);if(_0x59ea42[_0x0c70('0x2a')]){delete _0x59ea42[_0x0c70('0x2a')];}_0x18980b[_0x0c70('0x1b')](_0x146e67)['send'](_0x59ea42);};}exports['index']=function(_0x6ebf89,_0x331f22){var _0x5df1eb={},_0x2bb262={},_0x162dd6={'count':0x0,'rows':[]};var _0x356095=_['map'](db[_0x0c70('0x2b')]['rawAttributes'],function(_0x36bd89){return{'name':_0x36bd89[_0x0c70('0x2c')],'type':_0x36bd89[_0x0c70('0x2d')][_0x0c70('0x2e')]};});_0x2bb262['model']=_[_0x0c70('0x2f')](_0x356095,'name');_0x2bb262['query']=_[_0x0c70('0x30')](_0x6ebf89[_0x0c70('0x31')]);_0x2bb262[_0x0c70('0x32')]=_['intersection'](_0x2bb262[_0x0c70('0x33')],_0x2bb262[_0x0c70('0x31')]);_0x5df1eb[_0x0c70('0x34')]=_[_0x0c70('0x35')](_0x2bb262['model'],qs['fields'](_0x6ebf89[_0x0c70('0x31')][_0x0c70('0x36')]));_0x5df1eb[_0x0c70('0x34')]=_0x5df1eb[_0x0c70('0x34')][_0x0c70('0x37')]?_0x5df1eb[_0x0c70('0x34')]:_0x2bb262[_0x0c70('0x33')];if(!_0x6ebf89[_0x0c70('0x31')][_0x0c70('0x38')](_0x0c70('0x39'))){_0x5df1eb['limit']=qs[_0x0c70('0x1d')](_0x6ebf89['query']['limit']);_0x5df1eb[_0x0c70('0x3a')]=qs[_0x0c70('0x3a')](_0x6ebf89[_0x0c70('0x31')][_0x0c70('0x3a')]);}_0x5df1eb['order']=qs['sort'](_0x6ebf89[_0x0c70('0x31')][_0x0c70('0x3b')]);_0x5df1eb[_0x0c70('0x3c')]=qs['filters'](_[_0x0c70('0x3d')](_0x6ebf89[_0x0c70('0x31')],_0x2bb262[_0x0c70('0x32')]),_0x356095);if(_0x6ebf89[_0x0c70('0x31')][_0x0c70('0x3e')]){_0x5df1eb[_0x0c70('0x3c')]=_[_0x0c70('0x3f')](_0x5df1eb[_0x0c70('0x3c')],{'$or':_['map'](_0x356095,function(_0x59bf16){if(_0x59bf16['type']!=='VIRTUAL'){var _0x542de1={};_0x542de1[_0x59bf16[_0x0c70('0x2a')]]={'$like':'%'+_0x6ebf89[_0x0c70('0x31')]['filter']+'%'};return _0x542de1;}})});}_0x5df1eb=_[_0x0c70('0x3f')]({},_0x5df1eb,_0x6ebf89['options']);var _0x4630c1={'where':_0x5df1eb[_0x0c70('0x3c')]};return db[_0x0c70('0x2b')][_0x0c70('0x1c')](_0x4630c1)[_0x0c70('0x26')](function(_0xa8b622){_0x162dd6[_0x0c70('0x1c')]=_0xa8b622;if(_0x6ebf89[_0x0c70('0x31')][_0x0c70('0x40')]){_0x5df1eb['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0x0c70('0x41')](_0x5df1eb);})[_0x0c70('0x26')](function(_0x1975d6){_0x162dd6['rows']=_0x1975d6;return _0x162dd6;})[_0x0c70('0x26')](respondWithFilteredResult(_0x331f22,_0x5df1eb))[_0x0c70('0x42')](handleError(_0x331f22,null));};exports['show']=function(_0x179095,_0x2d4012){var _0x5b3271={'raw':!![],'where':{'id':_0x179095[_0x0c70('0x43')]['id']}},_0xdcafb4={};_0xdcafb4['model']=_[_0x0c70('0x30')](db[_0x0c70('0x2b')][_0x0c70('0x44')]);_0xdcafb4['query']=_[_0x0c70('0x30')](_0x179095[_0x0c70('0x31')]);_0xdcafb4[_0x0c70('0x32')]=_[_0x0c70('0x35')](_0xdcafb4[_0x0c70('0x33')],_0xdcafb4['query']);_0x5b3271[_0x0c70('0x34')]=_[_0x0c70('0x35')](_0xdcafb4[_0x0c70('0x33')],qs['fields'](_0x179095[_0x0c70('0x31')]['fields']));_0x5b3271[_0x0c70('0x34')]=_0x5b3271[_0x0c70('0x34')][_0x0c70('0x37')]?_0x5b3271[_0x0c70('0x34')]:_0xdcafb4['model'];if(_0x179095[_0x0c70('0x31')]['includeAll']){_0x5b3271['include']=[{'all':!![]}];}_0x5b3271=_['merge']({},_0x5b3271,_0x179095[_0x0c70('0x45')]);return db['SquareDetailsReport'][_0x0c70('0x46')](_0x5b3271)[_0x0c70('0x26')](handleEntityNotFound(_0x2d4012,null))[_0x0c70('0x26')](respondWithResult(_0x2d4012,null))[_0x0c70('0x42')](handleError(_0x2d4012,null));};exports[_0x0c70('0x47')]=function(_0x54f655,_0x31543b){return db[_0x0c70('0x2b')]['create'](_0x54f655['body'],{})[_0x0c70('0x26')](respondWithResult(_0x31543b,0xc9))['catch'](handleError(_0x31543b,null));};exports[_0x0c70('0x24')]=function(_0xc96108,_0xea8c6f){if(_0xc96108[_0x0c70('0x48')]['id']){delete _0xc96108[_0x0c70('0x48')]['id'];}return db[_0x0c70('0x2b')][_0x0c70('0x46')]({'where':{'id':_0xc96108[_0x0c70('0x43')]['id']}})['then'](handleEntityNotFound(_0xea8c6f,null))[_0x0c70('0x26')](saveUpdates(_0xc96108[_0x0c70('0x48')],null))[_0x0c70('0x26')](respondWithResult(_0xea8c6f,null))[_0x0c70('0x42')](handleError(_0xea8c6f,null));};exports[_0x0c70('0x25')]=function(_0x216242,_0x491e89){return db['SquareDetailsReport'][_0x0c70('0x46')]({'where':{'id':_0x216242['params']['id']}})['then'](handleEntityNotFound(_0x491e89,null))[_0x0c70('0x26')](removeEntity(_0x491e89,null))['catch'](handleError(_0x491e89,null));};exports[_0x0c70('0x49')]=function(_0x540362,_0x137629){return db[_0x0c70('0x2b')][_0x0c70('0x49')]()[_0x0c70('0x26')](respondWithResult(_0x137629,null))['catch'](handleError(_0x137629,null));}; \ No newline at end of file +var _0xff84=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','SquareDetailsReport','count','includeAll','include','findAll','catch','params','keys','create','body','find','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','apply','reject','save','update','then','status','error','stack','name','index','rawAttributes','fieldName','type','map','query'];(function(_0x42417b,_0x1d7e69){var _0x5ba244=function(_0x243a1a){while(--_0x243a1a){_0x42417b['push'](_0x42417b['shift']());}};_0x5ba244(++_0x1d7e69);}(_0xff84,0x13a));var _0x4ff8=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xff84[_0x2be8c2];return _0x97f531;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4ff8('0x0'));var jsonpatch=require(_0x4ff8('0x1'));var rp=require('request-promise');var moment=require(_0x4ff8('0x2'));var BPromise=require(_0x4ff8('0x3'));var Mustache=require(_0x4ff8('0x4'));var util=require(_0x4ff8('0x5'));var path=require(_0x4ff8('0x6'));var sox=require(_0x4ff8('0x7'));var csv=require(_0x4ff8('0x8'));var ejs=require(_0x4ff8('0x9'));var fs=require('fs');var _=require(_0x4ff8('0xa'));var squel=require(_0x4ff8('0xb'));var crypto=require(_0x4ff8('0xc'));var jsforce=require(_0x4ff8('0xd'));var deskjs=require(_0x4ff8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4ff8('0xf'));var Papa=require(_0x4ff8('0x10'));var Redis=require(_0x4ff8('0x11'));var authService=require(_0x4ff8('0x12'));var qs=require(_0x4ff8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ff8('0x14'));var logger=require(_0x4ff8('0x15'))(_0x4ff8('0x16'));var utils=require(_0x4ff8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ff8('0x18'));var db=require(_0x4ff8('0x19'))['db'];function respondWithStatusCode(_0x4cf8ad,_0x8eb3b2){_0x8eb3b2=_0x8eb3b2||0xcc;return function(_0x273c30){if(_0x273c30){return _0x4cf8ad[_0x4ff8('0x1a')](_0x8eb3b2);}return _0x4cf8ad['status'](_0x8eb3b2)[_0x4ff8('0x1b')]();};}function respondWithResult(_0x49866d,_0x47da11){_0x47da11=_0x47da11||0xc8;return function(_0x3e5fe0){if(_0x3e5fe0){return _0x49866d['status'](_0x47da11)[_0x4ff8('0x1c')](_0x3e5fe0);}};}function respondWithFilteredResult(_0x308b54,_0x3b1691){return function(_0x4b4124){if(_0x4b4124){var _0x2658aa=_0x4b4124['count'],_0x2809cb=_0x3b1691[_0x4ff8('0x1d')],_0x26c921=_0x3b1691['offset']+_0x3b1691[_0x4ff8('0x1e')],_0x9d03e6;if(_0x26c921>=_0x2658aa){_0x26c921=_0x2658aa;_0x9d03e6=0xc8;}else{_0x9d03e6=0xce;}_0x308b54['status'](_0x9d03e6);return _0x308b54['set']('Content-Range',_0x2809cb+'-'+_0x26c921+'/'+_0x2658aa)[_0x4ff8('0x1c')](_0x4b4124);}return null;};}function patchUpdates(_0x1621df){return function(_0x482e88){try{jsonpatch[_0x4ff8('0x1f')](_0x482e88,_0x1621df,!![]);}catch(_0x5ef2e0){return BPromise[_0x4ff8('0x20')](_0x5ef2e0);}return _0x482e88[_0x4ff8('0x21')]();};}function saveUpdates(_0x5bce72,_0x261d03){return function(_0x4933de){if(_0x4933de){return _0x4933de[_0x4ff8('0x22')](_0x5bce72)[_0x4ff8('0x23')](function(_0x59ff99){return _0x59ff99;});}return null;};}function removeEntity(_0xadf5d8,_0x3e0d1b){return function(_0x27a0a2){if(_0x27a0a2){return _0x27a0a2['destroy']()[_0x4ff8('0x23')](function(){_0xadf5d8[_0x4ff8('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d47de,_0x5f3b6f){return function(_0x279b73){if(!_0x279b73){_0x9d47de[_0x4ff8('0x1a')](0x194);}return _0x279b73;};}function handleError(_0x552f45,_0x4500b3){_0x4500b3=_0x4500b3||0x1f4;return function(_0x5bfa73){logger[_0x4ff8('0x25')](_0x5bfa73[_0x4ff8('0x26')]);if(_0x5bfa73['name']){delete _0x5bfa73[_0x4ff8('0x27')];}_0x552f45['status'](_0x4500b3)['send'](_0x5bfa73);};}exports[_0x4ff8('0x28')]=function(_0x11a082,_0x1497fa){var _0x2bad85={},_0x18050a={},_0x4b9af6={'count':0x0,'rows':[]};var _0x4eefb8=_['map'](db['SquareDetailsReport'][_0x4ff8('0x29')],function(_0x1bda6c){return{'name':_0x1bda6c[_0x4ff8('0x2a')],'type':_0x1bda6c[_0x4ff8('0x2b')]['key']};});_0x18050a['model']=_[_0x4ff8('0x2c')](_0x4eefb8,'name');_0x18050a[_0x4ff8('0x2d')]=_['keys'](_0x11a082[_0x4ff8('0x2d')]);_0x18050a[_0x4ff8('0x2e')]=_[_0x4ff8('0x2f')](_0x18050a[_0x4ff8('0x30')],_0x18050a['query']);_0x2bad85[_0x4ff8('0x31')]=_[_0x4ff8('0x2f')](_0x18050a[_0x4ff8('0x30')],qs[_0x4ff8('0x32')](_0x11a082[_0x4ff8('0x2d')][_0x4ff8('0x32')]));_0x2bad85[_0x4ff8('0x31')]=_0x2bad85[_0x4ff8('0x31')][_0x4ff8('0x33')]?_0x2bad85['attributes']:_0x18050a[_0x4ff8('0x30')];if(!_0x11a082[_0x4ff8('0x2d')][_0x4ff8('0x34')](_0x4ff8('0x35'))){_0x2bad85['limit']=qs[_0x4ff8('0x1e')](_0x11a082[_0x4ff8('0x2d')][_0x4ff8('0x1e')]);_0x2bad85[_0x4ff8('0x1d')]=qs[_0x4ff8('0x1d')](_0x11a082[_0x4ff8('0x2d')][_0x4ff8('0x1d')]);}_0x2bad85[_0x4ff8('0x36')]=qs[_0x4ff8('0x37')](_0x11a082[_0x4ff8('0x2d')][_0x4ff8('0x37')]);_0x2bad85[_0x4ff8('0x38')]=qs['filters'](_[_0x4ff8('0x39')](_0x11a082[_0x4ff8('0x2d')],_0x18050a['filters']),_0x4eefb8);if(_0x11a082[_0x4ff8('0x2d')][_0x4ff8('0x3a')]){_0x2bad85[_0x4ff8('0x38')]=_['merge'](_0x2bad85[_0x4ff8('0x38')],{'$or':_[_0x4ff8('0x2c')](_0x4eefb8,function(_0x2f707a){if(_0x2f707a[_0x4ff8('0x2b')]!=='VIRTUAL'){var _0x3c2918={};_0x3c2918[_0x2f707a[_0x4ff8('0x27')]]={'$like':'%'+_0x11a082['query'][_0x4ff8('0x3a')]+'%'};return _0x3c2918;}})});}_0x2bad85=_['merge']({},_0x2bad85,_0x11a082[_0x4ff8('0x3b')]);var _0x5c120e={'where':_0x2bad85['where']};return db[_0x4ff8('0x3c')][_0x4ff8('0x3d')](_0x5c120e)[_0x4ff8('0x23')](function(_0x16dd57){_0x4b9af6['count']=_0x16dd57;if(_0x11a082[_0x4ff8('0x2d')][_0x4ff8('0x3e')]){_0x2bad85[_0x4ff8('0x3f')]=[{'all':!![]}];}return db[_0x4ff8('0x3c')][_0x4ff8('0x40')](_0x2bad85);})['then'](function(_0x17d256){_0x4b9af6['rows']=_0x17d256;return _0x4b9af6;})['then'](respondWithFilteredResult(_0x1497fa,_0x2bad85))[_0x4ff8('0x41')](handleError(_0x1497fa,null));};exports['show']=function(_0x19d5c8,_0x4a09c8){var _0x8caac2={'raw':!![],'where':{'id':_0x19d5c8[_0x4ff8('0x42')]['id']}},_0x4fe182={};_0x4fe182[_0x4ff8('0x30')]=_[_0x4ff8('0x43')](db[_0x4ff8('0x3c')][_0x4ff8('0x29')]);_0x4fe182['query']=_[_0x4ff8('0x43')](_0x19d5c8['query']);_0x4fe182[_0x4ff8('0x2e')]=_[_0x4ff8('0x2f')](_0x4fe182[_0x4ff8('0x30')],_0x4fe182[_0x4ff8('0x2d')]);_0x8caac2[_0x4ff8('0x31')]=_[_0x4ff8('0x2f')](_0x4fe182['model'],qs['fields'](_0x19d5c8[_0x4ff8('0x2d')][_0x4ff8('0x32')]));_0x8caac2[_0x4ff8('0x31')]=_0x8caac2[_0x4ff8('0x31')][_0x4ff8('0x33')]?_0x8caac2[_0x4ff8('0x31')]:_0x4fe182['model'];if(_0x19d5c8[_0x4ff8('0x2d')][_0x4ff8('0x3e')]){_0x8caac2[_0x4ff8('0x3f')]=[{'all':!![]}];}_0x8caac2=_['merge']({},_0x8caac2,_0x19d5c8[_0x4ff8('0x3b')]);return db[_0x4ff8('0x3c')]['find'](_0x8caac2)['then'](handleEntityNotFound(_0x4a09c8,null))[_0x4ff8('0x23')](respondWithResult(_0x4a09c8,null))[_0x4ff8('0x41')](handleError(_0x4a09c8,null));};exports['create']=function(_0x5213c1,_0x5ea1d0){return db[_0x4ff8('0x3c')][_0x4ff8('0x44')](_0x5213c1[_0x4ff8('0x45')],{})[_0x4ff8('0x23')](respondWithResult(_0x5ea1d0,0xc9))[_0x4ff8('0x41')](handleError(_0x5ea1d0,null));};exports[_0x4ff8('0x22')]=function(_0x390fa7,_0x1a5545){if(_0x390fa7[_0x4ff8('0x45')]['id']){delete _0x390fa7['body']['id'];}return db[_0x4ff8('0x3c')]['find']({'where':{'id':_0x390fa7[_0x4ff8('0x42')]['id']}})['then'](handleEntityNotFound(_0x1a5545,null))[_0x4ff8('0x23')](saveUpdates(_0x390fa7[_0x4ff8('0x45')],null))[_0x4ff8('0x23')](respondWithResult(_0x1a5545,null))[_0x4ff8('0x41')](handleError(_0x1a5545,null));};exports['destroy']=function(_0x3d9b24,_0x24e56f){return db['SquareDetailsReport'][_0x4ff8('0x46')]({'where':{'id':_0x3d9b24[_0x4ff8('0x42')]['id']}})[_0x4ff8('0x23')](handleEntityNotFound(_0x24e56f,null))[_0x4ff8('0x23')](removeEntity(_0x24e56f,null))['catch'](handleError(_0x24e56f,null));};exports['describe']=function(_0x3d6642,_0x6d5a88){return db['SquareDetailsReport'][_0x4ff8('0x47')]()['then'](respondWithResult(_0x6d5a88,null))[_0x4ff8('0x41')](handleError(_0x6d5a88,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 63447c7..1b17974 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 _0xe857=['define','SquareDetailsReport','report_square_details','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./squareReportDetail.attributes','exports'];(function(_0x5c619e,_0x1bccdf){var _0x445cf8=function(_0x2eaa64){while(--_0x2eaa64){_0x5c619e['push'](_0x5c619e['shift']());}};_0x445cf8(++_0x1bccdf);}(_0xe857,0x1b0));var _0x7e85=function(_0x4833d5,_0x4810c5){_0x4833d5=_0x4833d5-0x0;var _0x2d833a=_0xe857[_0x4833d5];return _0x2d833a;};'use strict';var _=require(_0x7e85('0x0'));var util=require('util');var logger=require(_0x7e85('0x1'))(_0x7e85('0x2'));var moment=require(_0x7e85('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7e85('0x4'));var config=require(_0x7e85('0x5'));var attributes=require(_0x7e85('0x6'));module[_0x7e85('0x7')]=function(_0x5b0c5a,_0x215155){return _0x5b0c5a[_0x7e85('0x8')](_0x7e85('0x9'),attributes,{'tableName':_0x7e85('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b29=['path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','util','../../config/logger','api','moment','request-promise'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x2b29,0x163));var _0x92b2=function(_0x4feb1c,_0x44896e){_0x4feb1c=_0x4feb1c-0x0;var _0x3f807f=_0x2b29[_0x4feb1c];return _0x3f807f;};'use strict';var _=require('lodash');var util=require(_0x92b2('0x0'));var logger=require(_0x92b2('0x1'))(_0x92b2('0x2'));var moment=require(_0x92b2('0x3'));var BPromise=require('bluebird');var rp=require(_0x92b2('0x4'));var fs=require('fs');var path=require(_0x92b2('0x5'));var rimraf=require(_0x92b2('0x6'));var config=require(_0x92b2('0x7'));var attributes=require(_0x92b2('0x8'));module[_0x92b2('0x9')]=function(_0x47c522,_0xb1d856){return _0x47c522['define'](_0x92b2('0xa'),attributes,{'tableName':_0x92b2('0xb'),'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 df1c194..80b2b55 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 _0x0e70=['http','request','info','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','SquareDetailsReport,\x20%s,\x20%s','message','CreateSquareDetailsReport','create','options','raw','then','debug','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4773a4,_0xbf87f3){var _0x5e6a3a=function(_0x17ae4f){while(--_0x17ae4f){_0x4773a4['push'](_0x4773a4['shift']());}};_0x5e6a3a(++_0xbf87f3);}(_0x0e70,0xf8));var _0x00e7=function(_0x527877,_0x3be2bf){_0x527877=_0x527877-0x0;var _0x312e3f=_0x0e70[_0x527877];return _0x312e3f;};'use strict';var _=require(_0x00e7('0x0'));var util=require(_0x00e7('0x1'));var moment=require(_0x00e7('0x2'));var BPromise=require(_0x00e7('0x3'));var rs=require(_0x00e7('0x4'));var fs=require('fs');var Redis=require(_0x00e7('0x5'));var db=require(_0x00e7('0x6'))['db'];var utils=require(_0x00e7('0x7'));var logger=require(_0x00e7('0x8'))(_0x00e7('0x9'));var config=require(_0x00e7('0xa'));var jayson=require(_0x00e7('0xb'));var client=jayson[_0x00e7('0xc')][_0x00e7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1a603b,_0x1765fd,_0x48bf51){return new BPromise(function(_0x5994f3,_0x40256a){return client[_0x00e7('0xe')](_0x1a603b,_0x48bf51)['then'](function(_0x49f1c1){logger[_0x00e7('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x1765fd,_0x00e7('0x10'));logger['debug'](_0x00e7('0x11'),_0x1765fd,_0x00e7('0x10'),JSON['stringify'](_0x49f1c1));if(_0x49f1c1[_0x00e7('0x12')]){if(_0x49f1c1[_0x00e7('0x12')]['code']===0x1f4){logger[_0x00e7('0x12')](_0x00e7('0x13'),_0x1765fd,_0x49f1c1['error']['message']);return _0x40256a(_0x49f1c1[_0x00e7('0x12')]['message']);}logger['error'](_0x00e7('0x13'),_0x1765fd,_0x49f1c1[_0x00e7('0x12')][_0x00e7('0x14')]);return _0x5994f3(_0x49f1c1[_0x00e7('0x12')][_0x00e7('0x14')]);}else{logger['info'](_0x00e7('0x13'),_0x1765fd,_0x00e7('0x10'));_0x5994f3(_0x49f1c1['result'][_0x00e7('0x14')]);}})['catch'](function(_0x4cd213){logger[_0x00e7('0x12')](_0x00e7('0x13'),_0x1765fd,_0x4cd213);_0x40256a(_0x4cd213);});});}exports[_0x00e7('0x15')]=function(_0x2bb838){var _0x17de0e=this;return new Promise(function(_0x4684ec,_0x409915){return db['SquareDetailsReport'][_0x00e7('0x16')](_0x2bb838['body'],{'raw':_0x2bb838[_0x00e7('0x17')]?_0x2bb838[_0x00e7('0x17')][_0x00e7('0x18')]===undefined?!![]:![]:!![]})[_0x00e7('0x19')](function(_0x4fd2a2){logger[_0x00e7('0xf')]('CreateSquareDetailsReport',_0x2bb838);logger[_0x00e7('0x1a')]('CreateSquareDetailsReport',_0x2bb838,JSON[_0x00e7('0x1b')](_0x4fd2a2));_0x4684ec(_0x4fd2a2);})[_0x00e7('0x1c')](function(_0x40058b){logger[_0x00e7('0x12')](_0x00e7('0x15'),_0x40058b[_0x00e7('0x14')],_0x2bb838);_0x409915(_0x17de0e[_0x00e7('0x12')](0x1f4,_0x40058b['message']));});});}; \ No newline at end of file +var _0x9919=['then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SquareDetailsReport','create','body','options','CreateSquareDetailsReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x18e815,_0x171312){var _0x3ae01b=function(_0x1b5e55){while(--_0x1b5e55){_0x18e815['push'](_0x18e815['shift']());}};_0x3ae01b(++_0x171312);}(_0x9919,0x13c));var _0x9991=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0x9919[_0x1e6db3];return _0x1de886;};'use strict';var _=require(_0x9991('0x0'));var util=require(_0x9991('0x1'));var moment=require(_0x9991('0x2'));var BPromise=require(_0x9991('0x3'));var rs=require(_0x9991('0x4'));var fs=require('fs');var Redis=require(_0x9991('0x5'));var db=require(_0x9991('0x6'))['db'];var utils=require(_0x9991('0x7'));var logger=require(_0x9991('0x8'))(_0x9991('0x9'));var config=require('../../config/environment');var jayson=require(_0x9991('0xa'));var client=jayson[_0x9991('0xb')][_0x9991('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5845b4,_0x3052e2,_0x16de71){return new BPromise(function(_0x286720,_0x2e10f7){return client[_0x9991('0xd')](_0x5845b4,_0x16de71)[_0x9991('0xe')](function(_0x39b336){logger[_0x9991('0xf')](_0x9991('0x10'),_0x3052e2,_0x9991('0x11'));logger[_0x9991('0x12')](_0x9991('0x13'),_0x3052e2,_0x9991('0x11'),JSON[_0x9991('0x14')](_0x39b336));if(_0x39b336[_0x9991('0x15')]){if(_0x39b336[_0x9991('0x15')][_0x9991('0x16')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x3052e2,_0x39b336[_0x9991('0x15')][_0x9991('0x17')]);return _0x2e10f7(_0x39b336[_0x9991('0x15')][_0x9991('0x17')]);}logger[_0x9991('0x15')](_0x9991('0x10'),_0x3052e2,_0x39b336[_0x9991('0x15')]['message']);return _0x286720(_0x39b336[_0x9991('0x15')][_0x9991('0x17')]);}else{logger['info'](_0x9991('0x10'),_0x3052e2,_0x9991('0x11'));_0x286720(_0x39b336['result'][_0x9991('0x17')]);}})[_0x9991('0x18')](function(_0x1c6ce8){logger[_0x9991('0x15')](_0x9991('0x10'),_0x3052e2,_0x1c6ce8);_0x2e10f7(_0x1c6ce8);});});}exports['CreateSquareDetailsReport']=function(_0x55d7a7){var _0x534575=this;return new Promise(function(_0x1e3b76,_0x5127b3){return db[_0x9991('0x19')][_0x9991('0x1a')](_0x55d7a7[_0x9991('0x1b')],{'raw':_0x55d7a7[_0x9991('0x1c')]?_0x55d7a7[_0x9991('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x50f809){logger[_0x9991('0xf')](_0x9991('0x1d'),_0x55d7a7);logger[_0x9991('0x12')](_0x9991('0x1d'),_0x55d7a7,JSON[_0x9991('0x14')](_0x50f809));_0x1e3b76(_0x50f809);})['catch'](function(_0x43cd00){logger[_0x9991('0x15')](_0x9991('0x1d'),_0x43cd00[_0x9991('0x17')],_0x55d7a7);_0x5127b3(_0x534575[_0x9991('0x15')](0x1f4,_0x43cd00[_0x9991('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 05d19c6..ad25e1a 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 _0x7455=['/process/:pid/kill','killProcess','exports','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index'];(function(_0x33ac28,_0xbcde95){var _0x263076=function(_0xa46653){while(--_0xa46653){_0x33ac28['push'](_0x33ac28['shift']());}};_0x263076(++_0xbcde95);}(_0x7455,0x17d));var _0x5745=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7455[_0x14add3];return _0x4a174f;};'use strict';var express=require('express');var router=express[_0x5745('0x0')]();var auth=require(_0x5745('0x1'));var controller=require(_0x5745('0x2'));router[_0x5745('0x3')]('/',auth[_0x5745('0x4')](),controller[_0x5745('0x5')]);router[_0x5745('0x3')](_0x5745('0x6'),auth['isAuthenticated'](),controller[_0x5745('0x7')]);module[_0x5745('0x8')]=router; \ No newline at end of file +var _0x37a9=['/process/:pid/kill','killProcess','Router','../../components/auth/service','./system.controller','isAuthenticated','index','get'];(function(_0x3df356,_0x5948fc){var _0x81efeb=function(_0x1f78a0){while(--_0x1f78a0){_0x3df356['push'](_0x3df356['shift']());}};_0x81efeb(++_0x5948fc);}(_0x37a9,0x132));var _0x937a=function(_0x40ca2b,_0x3fa84f){_0x40ca2b=_0x40ca2b-0x0;var _0x990011=_0x37a9[_0x40ca2b];return _0x990011;};'use strict';var express=require('express');var router=express[_0x937a('0x0')]();var auth=require(_0x937a('0x1'));var controller=require(_0x937a('0x2'));router['get']('/',auth[_0x937a('0x3')](),controller[_0x937a('0x4')]);router[_0x937a('0x5')](_0x937a('0x6'),auth['isAuthenticated'](),controller[_0x937a('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 84dbba8..e0d9bfe 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 _0x6048=['index','getAllData','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','length','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','../../config/logger','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send'];(function(_0x277132,_0x56f1cd){var _0x18f869=function(_0x46bc60){while(--_0x46bc60){_0x277132['push'](_0x277132['shift']());}};_0x18f869(++_0x56f1cd);}(_0x6048,0x167));var _0x8604=function(_0x232328,_0x4c3439){_0x232328=_0x232328-0x0;var _0x39c46b=_0x6048[_0x232328];return _0x39c46b;};'use strict';var info=require('systeminformation');var exec=require(_0x8604('0x0'))['exec'];var logger=require(_0x8604('0x1'))('api');var util=require('util');var BPromise=require('bluebird');var _=require(_0x8604('0x2'));function handleError(_0x305c0a,_0x2ca85e,_0xe07417){_0x2ca85e=_0x2ca85e||0x1f4;return function(_0x4e4253){logger[_0x8604('0x3')](_0x8604('0x4'),_0xe07417,_0x2ca85e,util[_0x8604('0x5')](_0x4e4253,{'showHidden':![],'depth':null}));delete _0x4e4253[_0x8604('0x6')];_0x305c0a[_0x8604('0x7')](_0x2ca85e)[_0x8604('0x8')](_0x4e4253);};}exports[_0x8604('0x9')]=function(_0x2a521b,_0x262819){return info[_0x8604('0xa')]()[_0x8604('0xb')](function(_0x49bfb1){return _0x262819[_0x8604('0x7')](0xc8)[_0x8604('0xc')](_0x49bfb1);})['catch'](function(_0x5e4255){return _0x262819[_0x8604('0x7')](0x1f4)['json'](_0x5e4255);});};exports[_0x8604('0xd')]=function(_0x1bc4a0,_0x28db9b){var _0x1a5b33=[_0x8604('0xe')];return new BPromise(function(_0x275565,_0x56a473){return exec(util[_0x8604('0xf')](_0x8604('0x10'),_0x1bc4a0[_0x8604('0x11')]['pid']),function(_0x5085df,_0x1da3aa,_0x4eeb4c){if(_0x5085df){return _0x56a473(_0x5085df);}return _0x275565(_0x1da3aa);});})[_0x8604('0xb')](function(_0x57f68c){var _0x38beb5=![];var _0x194d19=_0x57f68c['split'](/\n/);for(var _0x33e648=0x0,_0x51ec6b=_0x1a5b33[_0x8604('0x12')];_0x33e648<_0x51ec6b,_0x38beb5===![];_0x33e648+=0x1){if(_0x57f68c['indexOf'](_0x1a5b33[_0x33e648])>=0x0){_0x38beb5=!![];}}if(!_0x38beb5){throw new Error(util[_0x8604('0xf')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x1bc4a0[_0x8604('0x11')][_0x8604('0x13')]));}process[_0x8604('0x14')](_0x1bc4a0['params'][_0x8604('0x13')],_0x8604('0x15'));return _0x28db9b['status'](0xc8)[_0x8604('0xc')]({'message':util[_0x8604('0xf')](_0x8604('0x16'),_0x1bc4a0[_0x8604('0x11')]['pid'])});})['catch'](handleError(_0x28db9b,null,'killProcess'));}; \ No newline at end of file +var _0x4072=['split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','json','catch','killProcess','systeminformation','child_process','exec','util','bluebird','lodash','error','inspect','name','index','then','status','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid'];(function(_0x37687f,_0x577dcc){var _0x3853e0=function(_0x26ecfb){while(--_0x26ecfb){_0x37687f['push'](_0x37687f['shift']());}};_0x3853e0(++_0x577dcc);}(_0x4072,0x198));var _0x2407=function(_0x2467b8,_0x584199){_0x2467b8=_0x2467b8-0x0;var _0x5d3095=_0x4072[_0x2467b8];return _0x5d3095;};'use strict';var info=require(_0x2407('0x0'));var exec=require(_0x2407('0x1'))[_0x2407('0x2')];var logger=require('../../config/logger')('api');var util=require(_0x2407('0x3'));var BPromise=require(_0x2407('0x4'));var _=require(_0x2407('0x5'));function handleError(_0x42a9a6,_0x35986b,_0x3513da){_0x35986b=_0x35986b||0x1f4;return function(_0x1d27df){logger[_0x2407('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x3513da,_0x35986b,util[_0x2407('0x7')](_0x1d27df,{'showHidden':![],'depth':null}));delete _0x1d27df[_0x2407('0x8')];_0x42a9a6['status'](_0x35986b)['send'](_0x1d27df);};}exports[_0x2407('0x9')]=function(_0x35c9ee,_0x4c19c7){return info['getAllData']()[_0x2407('0xa')](function(_0x268d1e){return _0x4c19c7[_0x2407('0xb')](0xc8)['json'](_0x268d1e);})['catch'](function(_0x2d66d4){return _0x4c19c7[_0x2407('0xb')](0x1f4)['json'](_0x2d66d4);});};exports['killProcess']=function(_0x43d790,_0x430442){var _0x4bc7dc=[_0x2407('0xc')];return new BPromise(function(_0x4f627c,_0x102d41){return exec(util[_0x2407('0xd')](_0x2407('0xe'),_0x43d790[_0x2407('0xf')][_0x2407('0x10')]),function(_0x13edaa,_0x224d37,_0x3bd33f){if(_0x13edaa){return _0x102d41(_0x13edaa);}return _0x4f627c(_0x224d37);});})['then'](function(_0x52b564){var _0xdc2272=![];var _0x542387=_0x52b564[_0x2407('0x11')](/\n/);for(var _0x33c9a6=0x0,_0x5ee401=_0x4bc7dc[_0x2407('0x12')];_0x33c9a6<_0x5ee401,_0xdc2272===![];_0x33c9a6+=0x1){if(_0x52b564[_0x2407('0x13')](_0x4bc7dc[_0x33c9a6])>=0x0){_0xdc2272=!![];}}if(!_0xdc2272){throw new Error(util[_0x2407('0xd')](_0x2407('0x14'),_0x43d790[_0x2407('0xf')][_0x2407('0x10')]));}process['kill'](_0x43d790[_0x2407('0xf')][_0x2407('0x10')],_0x2407('0x15'));return _0x430442[_0x2407('0xb')](0xc8)[_0x2407('0x16')]({'message':util[_0x2407('0xd')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x43d790[_0x2407('0xf')][_0x2407('0x10')])});})[_0x2407('0x17')](handleError(_0x430442,null,_0x2407('0x18')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 1cece4e..a50092a 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 _0x1339=['./tag.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2ee20d,_0x354e70){var _0xade530=function(_0x1db7cc){while(--_0x1db7cc){_0x2ee20d['push'](_0x2ee20d['shift']());}};_0xade530(++_0x354e70);}(_0x1339,0x1ed));var _0x9133=function(_0x531e25,_0xf6c5c){_0x531e25=_0x531e25-0x0;var _0x432311=_0x1339[_0x531e25];return _0x432311;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9133('0x0'));var timeout=require(_0x9133('0x1'));var express=require(_0x9133('0x2'));var router=express[_0x9133('0x3')]();var auth=require(_0x9133('0x4'));var interaction=require(_0x9133('0x5'));var config=require(_0x9133('0x6'));var controller=require(_0x9133('0x7'));router['get']('/',auth[_0x9133('0x8')](),controller[_0x9133('0x9')]);router[_0x9133('0xa')]('/:id',auth[_0x9133('0x8')](),controller[_0x9133('0xb')]);router[_0x9133('0xc')]('/',auth[_0x9133('0x8')](),controller[_0x9133('0xd')]);router[_0x9133('0xe')](_0x9133('0xf'),auth[_0x9133('0x8')](),controller[_0x9133('0x10')]);router[_0x9133('0x11')]('/:id',auth[_0x9133('0x8')](),controller[_0x9133('0x12')]);module[_0x9133('0x13')]=router; \ No newline at end of file +var _0xbec5=['isAuthenticated','/:id','show','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./tag.controller','get'];(function(_0x3ab8dc,_0xd40762){var _0x1e9ad8=function(_0x1b82ea){while(--_0x1b82ea){_0x3ab8dc['push'](_0x3ab8dc['shift']());}};_0x1e9ad8(++_0xd40762);}(_0xbec5,0xe5));var _0x5bec=function(_0x38a3d6,_0x52e305){_0x38a3d6=_0x38a3d6-0x0;var _0x3768d7=_0xbec5[_0x38a3d6];return _0x3768d7;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var auth=require(_0x5bec('0x5'));var interaction=require(_0x5bec('0x6'));var config=require('../../config/environment');var controller=require(_0x5bec('0x7'));router[_0x5bec('0x8')]('/',auth[_0x5bec('0x9')](),controller['index']);router[_0x5bec('0x8')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xb')]);router[_0x5bec('0xc')]('/',auth[_0x5bec('0x9')](),controller[_0x5bec('0xd')]);router[_0x5bec('0xe')]('/:id',auth[_0x5bec('0x9')](),controller['update']);router[_0x5bec('0xf')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller['destroy']);module[_0x5bec('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index a7922c3..7f7461f 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 _0x0713=['#0091EA','STRING','name'];(function(_0x22529c,_0x159dad){var _0x4cfdb3=function(_0xed19bb){while(--_0xed19bb){_0x22529c['push'](_0x22529c['shift']());}};_0x4cfdb3(++_0x159dad);}(_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')],'unique':_0x3071('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x2')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0x878f=['STRING','name','#0091EA','exports'];(function(_0x50c505,_0x13b7ce){var _0x2e2ca8=function(_0x38b0dd){while(--_0x38b0dd){_0x50c505['push'](_0x50c505['shift']());}};_0x2e2ca8(++_0x13b7ce);}(_0x878f,0x173));var _0xf878=function(_0x2293eb,_0x4f2cfd){_0x2293eb=_0x2293eb-0x0;var _0x1311bd=_0x878f[_0x2293eb];return _0x1311bd;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'name':{'type':Sequelize[_0xf878('0x1')],'unique':_0xf878('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xf878('0x1')],'defaultValue':_0xf878('0x3')},'description':{'type':Sequelize[_0xf878('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 5ba8eef..4c66774 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 _0xcfb0=['desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','Tag','key','query','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','keys','rawAttributes','filters','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Tags','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','jsforce'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xcfb0,0x1ce));var _0x0cfb=function(_0xa32ca1,_0x1d6d75){_0xa32ca1=_0xa32ca1-0x0;var _0x5b4171=_0xcfb0[_0xa32ca1];return _0x5b4171;};'use strict';var pdf=require(_0x0cfb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0cfb('0x1'));var zipdir=require(_0x0cfb('0x2'));var jsonpatch=require(_0x0cfb('0x3'));var rp=require('request-promise');var moment=require(_0x0cfb('0x4'));var BPromise=require(_0x0cfb('0x5'));var Mustache=require(_0x0cfb('0x6'));var util=require(_0x0cfb('0x7'));var path=require(_0x0cfb('0x8'));var sox=require(_0x0cfb('0x9'));var csv=require(_0x0cfb('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0cfb('0xb'));var deskjs=require(_0x0cfb('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0cfb('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x0cfb('0xe'));var as=require(_0x0cfb('0xf'));var hardwareService=require(_0x0cfb('0x10'));var logger=require(_0x0cfb('0x11'))(_0x0cfb('0x12'));var utils=require(_0x0cfb('0x13'));var config=require(_0x0cfb('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0cfb('0x15'))['db'];function respondWithStatusCode(_0x296e41,_0x1b655c){_0x1b655c=_0x1b655c||0xcc;return function(_0x34e779){if(_0x34e779){return _0x296e41[_0x0cfb('0x16')](_0x1b655c);}return _0x296e41[_0x0cfb('0x17')](_0x1b655c)[_0x0cfb('0x18')]();};}function respondWithResult(_0x3c2e00,_0x249af0){_0x249af0=_0x249af0||0xc8;return function(_0x2edf55){if(_0x2edf55){return _0x3c2e00[_0x0cfb('0x17')](_0x249af0)[_0x0cfb('0x19')](_0x2edf55);}};}function respondWithFilteredResult(_0x18607e,_0x25ee69){return function(_0x4458cf){if(_0x4458cf){var _0xc7f3fe=_0x4458cf[_0x0cfb('0x1a')],_0x21f3d6=_0x25ee69[_0x0cfb('0x1b')],_0x774ecf=_0x25ee69['offset']+_0x25ee69[_0x0cfb('0x1c')],_0xcaea81;if(_0x774ecf>=_0xc7f3fe){_0x774ecf=_0xc7f3fe;_0xcaea81=0xc8;}else{_0xcaea81=0xce;}_0x18607e[_0x0cfb('0x17')](_0xcaea81);return _0x18607e['set'](_0x0cfb('0x1d'),_0x21f3d6+'-'+_0x774ecf+'/'+_0xc7f3fe)[_0x0cfb('0x19')](_0x4458cf);}return null;};}function patchUpdates(_0x26151f){return function(_0x2dc988){try{jsonpatch[_0x0cfb('0x1e')](_0x2dc988,_0x26151f,!![]);}catch(_0x3e2813){return BPromise['reject'](_0x3e2813);}return _0x2dc988[_0x0cfb('0x1f')]();};}function saveUpdates(_0x45f029,_0x254afc){return function(_0x2f6009){if(_0x2f6009){return _0x2f6009[_0x0cfb('0x20')](_0x45f029)[_0x0cfb('0x21')](function(_0x2c8f2d){return _0x2c8f2d;});}return null;};}function removeEntity(_0x2db1e9,_0x4c7049){return function(_0x1a303c){if(_0x1a303c){return _0x1a303c['destroy']()[_0x0cfb('0x21')](function(){var _0xed9bc4=_0x1a303c[_0x0cfb('0x22')]({'plain':!![]});var _0x432136='Tags';return db[_0x0cfb('0x23')][_0x0cfb('0x24')]({'where':{'type':_0x432136,'resourceId':_0xed9bc4['id']}})[_0x0cfb('0x21')](function(){return _0x1a303c;});})[_0x0cfb('0x21')](function(){_0x2db1e9[_0x0cfb('0x17')](0xcc)[_0x0cfb('0x18')]();});}};}function handleEntityNotFound(_0x125b32,_0x570fc2){return function(_0x5996d2){if(!_0x5996d2){_0x125b32['sendStatus'](0x194);}return _0x5996d2;};}function handleError(_0x497422,_0x103338){_0x103338=_0x103338||0x1f4;return function(_0x22f3b4){logger[_0x0cfb('0x25')](_0x22f3b4[_0x0cfb('0x26')]);if(_0x22f3b4['name']){delete _0x22f3b4[_0x0cfb('0x27')];}_0x497422[_0x0cfb('0x17')](_0x103338)[_0x0cfb('0x28')](_0x22f3b4);};}exports[_0x0cfb('0x29')]=function(_0x5976ed,_0x44d280){var _0x2718ff={},_0x461108={},_0x190b78={'count':0x0,'rows':[]};var _0x5eeebf=_[_0x0cfb('0x2a')](db[_0x0cfb('0x2b')]['rawAttributes'],function(_0x1c7c29){return{'name':_0x1c7c29['fieldName'],'type':_0x1c7c29['type'][_0x0cfb('0x2c')]};});_0x461108['model']=_['map'](_0x5eeebf,_0x0cfb('0x27'));_0x461108[_0x0cfb('0x2d')]=_['keys'](_0x5976ed[_0x0cfb('0x2d')]);_0x461108['filters']=_['intersection'](_0x461108[_0x0cfb('0x2e')],_0x461108[_0x0cfb('0x2d')]);_0x2718ff[_0x0cfb('0x2f')]=_[_0x0cfb('0x30')](_0x461108[_0x0cfb('0x2e')],qs[_0x0cfb('0x31')](_0x5976ed['query'][_0x0cfb('0x31')]));_0x2718ff[_0x0cfb('0x2f')]=_0x2718ff[_0x0cfb('0x2f')][_0x0cfb('0x32')]?_0x2718ff[_0x0cfb('0x2f')]:_0x461108[_0x0cfb('0x2e')];if(!_0x5976ed['query']['hasOwnProperty'](_0x0cfb('0x33'))){_0x2718ff[_0x0cfb('0x1c')]=qs[_0x0cfb('0x1c')](_0x5976ed[_0x0cfb('0x2d')][_0x0cfb('0x1c')]);_0x2718ff[_0x0cfb('0x1b')]=qs[_0x0cfb('0x1b')](_0x5976ed[_0x0cfb('0x2d')][_0x0cfb('0x1b')]);}_0x2718ff[_0x0cfb('0x34')]=qs[_0x0cfb('0x35')](_0x5976ed['query']['sort']);_0x2718ff[_0x0cfb('0x36')]=qs['filters'](_[_0x0cfb('0x37')](_0x5976ed[_0x0cfb('0x2d')],_0x461108['filters']),_0x5eeebf);if(_0x5976ed[_0x0cfb('0x2d')][_0x0cfb('0x38')]){_0x2718ff[_0x0cfb('0x36')]=_[_0x0cfb('0x39')](_0x2718ff[_0x0cfb('0x36')],{'$or':_[_0x0cfb('0x2a')](_0x5eeebf,function(_0x5d5f5b){if(_0x5d5f5b['type']!==_0x0cfb('0x3a')){var _0x27338b={};_0x27338b[_0x5d5f5b['name']]={'$like':'%'+_0x5976ed[_0x0cfb('0x2d')][_0x0cfb('0x38')]+'%'};return _0x27338b;}})});}_0x2718ff=_['merge']({},_0x2718ff,_0x5976ed[_0x0cfb('0x3b')]);var _0xa522c2={'where':_0x2718ff[_0x0cfb('0x36')]};return db['Tag'][_0x0cfb('0x1a')](_0xa522c2)[_0x0cfb('0x21')](function(_0x1f05a9){_0x190b78[_0x0cfb('0x1a')]=_0x1f05a9;if(_0x5976ed[_0x0cfb('0x2d')]['includeAll']){_0x2718ff[_0x0cfb('0x3c')]=[{'all':!![]}];}return db[_0x0cfb('0x2b')][_0x0cfb('0x3d')](_0x2718ff);})[_0x0cfb('0x21')](function(_0x2c5543){_0x190b78[_0x0cfb('0x3e')]=_0x2c5543;return _0x190b78;})[_0x0cfb('0x21')](respondWithFilteredResult(_0x44d280,_0x2718ff))['catch'](handleError(_0x44d280,null));};exports[_0x0cfb('0x3f')]=function(_0x239aec,_0x1ffad4){var _0x280c35={'raw':!![],'where':{'id':_0x239aec['params']['id']}},_0x3cf32d={};_0x3cf32d[_0x0cfb('0x2e')]=_[_0x0cfb('0x40')](db[_0x0cfb('0x2b')][_0x0cfb('0x41')]);_0x3cf32d[_0x0cfb('0x2d')]=_[_0x0cfb('0x40')](_0x239aec[_0x0cfb('0x2d')]);_0x3cf32d[_0x0cfb('0x42')]=_['intersection'](_0x3cf32d['model'],_0x3cf32d[_0x0cfb('0x2d')]);_0x280c35[_0x0cfb('0x2f')]=_[_0x0cfb('0x30')](_0x3cf32d['model'],qs[_0x0cfb('0x31')](_0x239aec[_0x0cfb('0x2d')]['fields']));_0x280c35[_0x0cfb('0x2f')]=_0x280c35[_0x0cfb('0x2f')]['length']?_0x280c35['attributes']:_0x3cf32d[_0x0cfb('0x2e')];if(_0x239aec[_0x0cfb('0x2d')]['includeAll']){_0x280c35[_0x0cfb('0x3c')]=[{'all':!![]}];}_0x280c35=_[_0x0cfb('0x39')]({},_0x280c35,_0x239aec[_0x0cfb('0x3b')]);return db[_0x0cfb('0x2b')][_0x0cfb('0x43')](_0x280c35)[_0x0cfb('0x21')](handleEntityNotFound(_0x1ffad4,null))[_0x0cfb('0x21')](respondWithResult(_0x1ffad4,null))[_0x0cfb('0x44')](handleError(_0x1ffad4,null));};exports[_0x0cfb('0x45')]=function(_0x2efde6,_0x2a9559){return db[_0x0cfb('0x2b')][_0x0cfb('0x45')](_0x2efde6[_0x0cfb('0x46')],{})[_0x0cfb('0x21')](function(_0x26ba13){var _0x11a56d=_0x2efde6[_0x0cfb('0x47')]['get']({'plain':!![]});if(!_0x11a56d)throw new Error(_0x0cfb('0x48'));if(_0x11a56d['role']===_0x0cfb('0x47')){var _0x4170a7=_0x26ba13[_0x0cfb('0x22')]({'plain':!![]});var _0x1d7bde=_0x0cfb('0x49');return db[_0x0cfb('0x4a')][_0x0cfb('0x43')]({'where':{'name':_0x1d7bde,'userProfileId':_0x11a56d[_0x0cfb('0x4b')]},'raw':!![]})['then'](function(_0x53895){if(_0x53895&&_0x53895[_0x0cfb('0x4c')]===0x0){return db['UserProfileResource'][_0x0cfb('0x45')]({'name':_0x4170a7[_0x0cfb('0x27')],'resourceId':_0x4170a7['id'],'type':_0x53895['name'],'sectionId':_0x53895['id']},{})['then'](function(){return _0x26ba13;});}else{return _0x26ba13;}})['catch'](function(_0x4ea681){logger[_0x0cfb('0x25')](_0x0cfb('0x4d'),_0x4ea681);throw _0x4ea681;});}return _0x26ba13;})[_0x0cfb('0x21')](respondWithResult(_0x2a9559,0xc9))['catch'](handleError(_0x2a9559,null));};exports[_0x0cfb('0x20')]=function(_0x2e7242,_0x8df604){if(_0x2e7242[_0x0cfb('0x46')]['id']){delete _0x2e7242[_0x0cfb('0x46')]['id'];}return db['Tag'][_0x0cfb('0x43')]({'where':{'id':_0x2e7242[_0x0cfb('0x4e')]['id']}})[_0x0cfb('0x21')](handleEntityNotFound(_0x8df604,null))[_0x0cfb('0x21')](saveUpdates(_0x2e7242[_0x0cfb('0x46')],null))['then'](respondWithResult(_0x8df604,null))[_0x0cfb('0x44')](handleError(_0x8df604,null));};exports[_0x0cfb('0x24')]=function(_0x1e760e,_0x4c69f0){return db[_0x0cfb('0x2b')][_0x0cfb('0x43')]({'where':{'id':_0x1e760e[_0x0cfb('0x4e')]['id']}})[_0x0cfb('0x21')](handleEntityNotFound(_0x4c69f0,null))[_0x0cfb('0x21')](removeEntity(_0x4c69f0,null))[_0x0cfb('0x44')](handleError(_0x4c69f0,null));}; \ No newline at end of file +var _0x8338=['crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','set','apply','reject','update','then','destroy','get','end','error','stack','name','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','lodash','squel'];(function(_0x4f998e,_0x19e487){var _0xec46f5=function(_0x4fd248){while(--_0x4fd248){_0x4f998e['push'](_0x4f998e['shift']());}};_0xec46f5(++_0x19e487);}(_0x8338,0x140));var _0x8833=function(_0x4e1518,_0x414afa){_0x4e1518=_0x4e1518-0x0;var _0x464071=_0x8338[_0x4e1518];return _0x464071;};'use strict';var pdf=require(_0x8833('0x0'));var emlformat=require(_0x8833('0x1'));var rimraf=require(_0x8833('0x2'));var zipdir=require(_0x8833('0x3'));var jsonpatch=require(_0x8833('0x4'));var rp=require(_0x8833('0x5'));var moment=require('moment');var BPromise=require(_0x8833('0x6'));var Mustache=require(_0x8833('0x7'));var util=require(_0x8833('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8833('0x9'));var fs=require('fs');var _=require(_0x8833('0xa'));var squel=require(_0x8833('0xb'));var crypto=require(_0x8833('0xc'));var jsforce=require(_0x8833('0xd'));var deskjs=require(_0x8833('0xe'));var toCsv=require(_0x8833('0xf'));var querystring=require('querystring');var Papa=require(_0x8833('0x10'));var Redis=require('ioredis');var authService=require(_0x8833('0x11'));var qs=require(_0x8833('0x12'));var as=require(_0x8833('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8833('0x14'))(_0x8833('0x15'));var utils=require(_0x8833('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8833('0x17'))['db'];function respondWithStatusCode(_0x1335da,_0x14edbf){_0x14edbf=_0x14edbf||0xcc;return function(_0x121947){if(_0x121947){return _0x1335da[_0x8833('0x18')](_0x14edbf);}return _0x1335da[_0x8833('0x19')](_0x14edbf)['end']();};}function respondWithResult(_0x49cf91,_0x3064a5){_0x3064a5=_0x3064a5||0xc8;return function(_0x5e82db){if(_0x5e82db){return _0x49cf91[_0x8833('0x19')](_0x3064a5)[_0x8833('0x1a')](_0x5e82db);}};}function respondWithFilteredResult(_0x54aa6f,_0x4c1e7c){return function(_0x459946){if(_0x459946){var _0x298ab5=_0x459946['count'],_0x3de82a=_0x4c1e7c[_0x8833('0x1b')],_0x39c525=_0x4c1e7c[_0x8833('0x1b')]+_0x4c1e7c[_0x8833('0x1c')],_0x33e86c;if(_0x39c525>=_0x298ab5){_0x39c525=_0x298ab5;_0x33e86c=0xc8;}else{_0x33e86c=0xce;}_0x54aa6f[_0x8833('0x19')](_0x33e86c);return _0x54aa6f[_0x8833('0x1d')]('Content-Range',_0x3de82a+'-'+_0x39c525+'/'+_0x298ab5)[_0x8833('0x1a')](_0x459946);}return null;};}function patchUpdates(_0x44d2e9){return function(_0x571ca3){try{jsonpatch[_0x8833('0x1e')](_0x571ca3,_0x44d2e9,!![]);}catch(_0x3269d0){return BPromise[_0x8833('0x1f')](_0x3269d0);}return _0x571ca3['save']();};}function saveUpdates(_0x31dcac,_0x449b6e){return function(_0xc1eb17){if(_0xc1eb17){return _0xc1eb17[_0x8833('0x20')](_0x31dcac)[_0x8833('0x21')](function(_0x3c2a4a){return _0x3c2a4a;});}return null;};}function removeEntity(_0x3d06f2,_0x204167){return function(_0x542961){if(_0x542961){return _0x542961[_0x8833('0x22')]()[_0x8833('0x21')](function(){var _0x410856=_0x542961[_0x8833('0x23')]({'plain':!![]});var _0x55f6ed='Tags';return db['UserProfileResource'][_0x8833('0x22')]({'where':{'type':_0x55f6ed,'resourceId':_0x410856['id']}})[_0x8833('0x21')](function(){return _0x542961;});})[_0x8833('0x21')](function(){_0x3d06f2['status'](0xcc)[_0x8833('0x24')]();});}};}function handleEntityNotFound(_0x18b0c2,_0x1d4613){return function(_0x1112d2){if(!_0x1112d2){_0x18b0c2['sendStatus'](0x194);}return _0x1112d2;};}function handleError(_0x2f6500,_0x5b503a){_0x5b503a=_0x5b503a||0x1f4;return function(_0x3d4cc9){logger[_0x8833('0x25')](_0x3d4cc9[_0x8833('0x26')]);if(_0x3d4cc9[_0x8833('0x27')]){delete _0x3d4cc9[_0x8833('0x27')];}_0x2f6500[_0x8833('0x19')](_0x5b503a)['send'](_0x3d4cc9);};}exports[_0x8833('0x28')]=function(_0x414c12,_0x479f77){var _0x4f5e63={},_0x2a1201={},_0x225801={'count':0x0,'rows':[]};var _0x1e796a=_[_0x8833('0x29')](db[_0x8833('0x2a')][_0x8833('0x2b')],function(_0x5f53ee){return{'name':_0x5f53ee[_0x8833('0x2c')],'type':_0x5f53ee[_0x8833('0x2d')][_0x8833('0x2e')]};});_0x2a1201[_0x8833('0x2f')]=_[_0x8833('0x29')](_0x1e796a,'name');_0x2a1201[_0x8833('0x30')]=_[_0x8833('0x31')](_0x414c12[_0x8833('0x30')]);_0x2a1201[_0x8833('0x32')]=_[_0x8833('0x33')](_0x2a1201['model'],_0x2a1201[_0x8833('0x30')]);_0x4f5e63['attributes']=_[_0x8833('0x33')](_0x2a1201[_0x8833('0x2f')],qs[_0x8833('0x34')](_0x414c12[_0x8833('0x30')][_0x8833('0x34')]));_0x4f5e63[_0x8833('0x35')]=_0x4f5e63['attributes'][_0x8833('0x36')]?_0x4f5e63['attributes']:_0x2a1201[_0x8833('0x2f')];if(!_0x414c12[_0x8833('0x30')][_0x8833('0x37')](_0x8833('0x38'))){_0x4f5e63[_0x8833('0x1c')]=qs[_0x8833('0x1c')](_0x414c12[_0x8833('0x30')][_0x8833('0x1c')]);_0x4f5e63[_0x8833('0x1b')]=qs[_0x8833('0x1b')](_0x414c12[_0x8833('0x30')][_0x8833('0x1b')]);}_0x4f5e63[_0x8833('0x39')]=qs[_0x8833('0x3a')](_0x414c12[_0x8833('0x30')][_0x8833('0x3a')]);_0x4f5e63[_0x8833('0x3b')]=qs[_0x8833('0x32')](_['pick'](_0x414c12['query'],_0x2a1201[_0x8833('0x32')]),_0x1e796a);if(_0x414c12[_0x8833('0x30')][_0x8833('0x3c')]){_0x4f5e63['where']=_[_0x8833('0x3d')](_0x4f5e63[_0x8833('0x3b')],{'$or':_[_0x8833('0x29')](_0x1e796a,function(_0xa4686e){if(_0xa4686e['type']!==_0x8833('0x3e')){var _0x26b452={};_0x26b452[_0xa4686e[_0x8833('0x27')]]={'$like':'%'+_0x414c12[_0x8833('0x30')][_0x8833('0x3c')]+'%'};return _0x26b452;}})});}_0x4f5e63=_[_0x8833('0x3d')]({},_0x4f5e63,_0x414c12['options']);var _0x5294be={'where':_0x4f5e63['where']};return db[_0x8833('0x2a')]['count'](_0x5294be)[_0x8833('0x21')](function(_0x1b4732){_0x225801[_0x8833('0x3f')]=_0x1b4732;if(_0x414c12[_0x8833('0x30')][_0x8833('0x40')]){_0x4f5e63[_0x8833('0x41')]=[{'all':!![]}];}return db[_0x8833('0x2a')][_0x8833('0x42')](_0x4f5e63);})[_0x8833('0x21')](function(_0x566ad9){_0x225801[_0x8833('0x43')]=_0x566ad9;return _0x225801;})[_0x8833('0x21')](respondWithFilteredResult(_0x479f77,_0x4f5e63))[_0x8833('0x44')](handleError(_0x479f77,null));};exports[_0x8833('0x45')]=function(_0x3ea5ca,_0x4df85a){var _0x1f35e3={'raw':!![],'where':{'id':_0x3ea5ca['params']['id']}},_0x5ee8ff={};_0x5ee8ff[_0x8833('0x2f')]=_[_0x8833('0x31')](db[_0x8833('0x2a')][_0x8833('0x2b')]);_0x5ee8ff[_0x8833('0x30')]=_[_0x8833('0x31')](_0x3ea5ca[_0x8833('0x30')]);_0x5ee8ff[_0x8833('0x32')]=_[_0x8833('0x33')](_0x5ee8ff[_0x8833('0x2f')],_0x5ee8ff[_0x8833('0x30')]);_0x1f35e3[_0x8833('0x35')]=_[_0x8833('0x33')](_0x5ee8ff[_0x8833('0x2f')],qs[_0x8833('0x34')](_0x3ea5ca[_0x8833('0x30')][_0x8833('0x34')]));_0x1f35e3['attributes']=_0x1f35e3['attributes']['length']?_0x1f35e3[_0x8833('0x35')]:_0x5ee8ff['model'];if(_0x3ea5ca['query'][_0x8833('0x40')]){_0x1f35e3[_0x8833('0x41')]=[{'all':!![]}];}_0x1f35e3=_[_0x8833('0x3d')]({},_0x1f35e3,_0x3ea5ca['options']);return db[_0x8833('0x2a')][_0x8833('0x46')](_0x1f35e3)[_0x8833('0x21')](handleEntityNotFound(_0x4df85a,null))[_0x8833('0x21')](respondWithResult(_0x4df85a,null))[_0x8833('0x44')](handleError(_0x4df85a,null));};exports[_0x8833('0x47')]=function(_0x3d3f12,_0x313cc4){return db[_0x8833('0x2a')][_0x8833('0x47')](_0x3d3f12[_0x8833('0x48')],{})[_0x8833('0x21')](function(_0x5f004e){var _0x3ecbe9=_0x3d3f12[_0x8833('0x49')][_0x8833('0x23')]({'plain':!![]});if(!_0x3ecbe9)throw new Error(_0x8833('0x4a'));if(_0x3ecbe9[_0x8833('0x4b')]===_0x8833('0x49')){var _0x51ece1=_0x5f004e[_0x8833('0x23')]({'plain':!![]});var _0x3c64ae=_0x8833('0x4c');return db[_0x8833('0x4d')][_0x8833('0x46')]({'where':{'name':_0x3c64ae,'userProfileId':_0x3ecbe9[_0x8833('0x4e')]},'raw':!![]})['then'](function(_0x131e07){if(_0x131e07&&_0x131e07[_0x8833('0x4f')]===0x0){return db[_0x8833('0x50')][_0x8833('0x47')]({'name':_0x51ece1[_0x8833('0x27')],'resourceId':_0x51ece1['id'],'type':_0x131e07[_0x8833('0x27')],'sectionId':_0x131e07['id']},{})[_0x8833('0x21')](function(){return _0x5f004e;});}else{return _0x5f004e;}})[_0x8833('0x44')](function(_0x26b1ab){logger[_0x8833('0x25')](_0x8833('0x51'),_0x26b1ab);throw _0x26b1ab;});}return _0x5f004e;})[_0x8833('0x21')](respondWithResult(_0x313cc4,0xc9))[_0x8833('0x44')](handleError(_0x313cc4,null));};exports[_0x8833('0x20')]=function(_0x55c46b,_0x48d783){if(_0x55c46b[_0x8833('0x48')]['id']){delete _0x55c46b[_0x8833('0x48')]['id'];}return db[_0x8833('0x2a')][_0x8833('0x46')]({'where':{'id':_0x55c46b[_0x8833('0x52')]['id']}})['then'](handleEntityNotFound(_0x48d783,null))['then'](saveUpdates(_0x55c46b[_0x8833('0x48')],null))[_0x8833('0x21')](respondWithResult(_0x48d783,null))[_0x8833('0x44')](handleError(_0x48d783,null));};exports['destroy']=function(_0x23b60c,_0x5befd5){return db['Tag'][_0x8833('0x46')]({'where':{'id':_0x23b60c[_0x8833('0x52')]['id']}})[_0x8833('0x21')](handleEntityNotFound(_0x5befd5,null))['then'](removeEntity(_0x5befd5,null))['catch'](handleError(_0x5befd5,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 52afe66..3f57e73 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 _0x1dcc=['api','moment','path','rimraf','../../config/environment','./tag.attributes','exports','Tag','tools_tags','lodash'];(function(_0x239139,_0x397c5e){var _0xce8f53=function(_0x5713f1){while(--_0x5713f1){_0x239139['push'](_0x239139['shift']());}};_0xce8f53(++_0x397c5e);}(_0x1dcc,0x77));var _0xc1dc=function(_0x2052df,_0x2561b5){_0x2052df=_0x2052df-0x0;var _0x114f6b=_0x1dcc[_0x2052df];return _0x114f6b;};'use strict';var _=require(_0xc1dc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc1dc('0x1'));var moment=require(_0xc1dc('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc1dc('0x3'));var rimraf=require(_0xc1dc('0x4'));var config=require(_0xc1dc('0x5'));var attributes=require(_0xc1dc('0x6'));module[_0xc1dc('0x7')]=function(_0x11ff86,_0x37cd11){return _0x11ff86['define'](_0xc1dc('0x8'),attributes,{'tableName':_0xc1dc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe75a=['api','moment','request-promise','path','rimraf','define','Tag','util','../../config/logger'];(function(_0xd7b3,_0xe260c7){var _0x4c39a5=function(_0x3d10ab){while(--_0x3d10ab){_0xd7b3['push'](_0xd7b3['shift']());}};_0x4c39a5(++_0xe260c7);}(_0xe75a,0x115));var _0xae75=function(_0x20025e,_0x44c8e1){_0x20025e=_0x20025e-0x0;var _0x4a5ac4=_0xe75a[_0x20025e];return _0x4a5ac4;};'use strict';var _=require('lodash');var util=require(_0xae75('0x0'));var logger=require(_0xae75('0x1'))(_0xae75('0x2'));var moment=require(_0xae75('0x3'));var BPromise=require('bluebird');var rp=require(_0xae75('0x4'));var fs=require('fs');var path=require(_0xae75('0x5'));var rimraf=require(_0xae75('0x6'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module['exports']=function(_0x3e7f3d,_0x25bd3f){return _0x3e7f3d[_0xae75('0x7')](_0xae75('0x8'),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 fc4202a..d41fd69 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 _0x0102=['info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/environment','jayson/promise','client','http','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0102,0x186));var _0x2010=function(_0x509cbb,_0x5ef8b8){_0x509cbb=_0x509cbb-0x0;var _0x2c07a8=_0x0102[_0x509cbb];return _0x2c07a8;};'use strict';var _=require('lodash');var util=require(_0x2010('0x0'));var moment=require(_0x2010('0x1'));var BPromise=require(_0x2010('0x2'));var rs=require(_0x2010('0x3'));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(_0x2010('0x4'));var jayson=require(_0x2010('0x5'));var client=jayson[_0x2010('0x6')][_0x2010('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4eeb67,_0x453fc0,_0x495d98){return new BPromise(function(_0x4728c0,_0x160e41){return client['request'](_0x4eeb67,_0x495d98)[_0x2010('0x8')](function(_0x3c2d98){logger[_0x2010('0x9')](_0x2010('0xa'),_0x453fc0,_0x2010('0xb'));logger[_0x2010('0xc')](_0x2010('0xd'),_0x453fc0,_0x2010('0xb'),JSON[_0x2010('0xe')](_0x3c2d98));if(_0x3c2d98[_0x2010('0xf')]){if(_0x3c2d98[_0x2010('0xf')][_0x2010('0x10')]===0x1f4){logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);return _0x160e41(_0x3c2d98['error']['message']);}logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);return _0x4728c0(_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);}else{logger['info'](_0x2010('0xa'),_0x453fc0,_0x2010('0xb'));_0x4728c0(_0x3c2d98['result'][_0x2010('0x11')]);}})[_0x2010('0x12')](function(_0x410889){logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x410889);_0x160e41(_0x410889);});});} \ No newline at end of file +var _0x44a3=['http','request','then','info','request\x20sent','debug','error','code','message','Tag,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0xdfea88,_0x14a9e9){var _0x5638a3=function(_0x5e46a8){while(--_0x5e46a8){_0xdfea88['push'](_0xdfea88['shift']());}};_0x5638a3(++_0x14a9e9);}(_0x44a3,0x1a9));var _0x344a=function(_0x483888,_0x2ff778){_0x483888=_0x483888-0x0;var _0x4be161=_0x44a3[_0x483888];return _0x4be161;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var moment=require(_0x344a('0x2'));var BPromise=require(_0x344a('0x3'));var rs=require(_0x344a('0x4'));var fs=require('fs');var Redis=require(_0x344a('0x5'));var db=require(_0x344a('0x6'))['db'];var utils=require(_0x344a('0x7'));var logger=require('../../config/logger')(_0x344a('0x8'));var config=require(_0x344a('0x9'));var jayson=require(_0x344a('0xa'));var client=jayson[_0x344a('0xb')][_0x344a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x504bd1,_0x553d97,_0x55ddca){return new BPromise(function(_0x484661,_0x475dab){return client[_0x344a('0xd')](_0x504bd1,_0x55ddca)[_0x344a('0xe')](function(_0x233ca1){logger[_0x344a('0xf')]('Tag,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'));logger[_0x344a('0x11')]('Tag,\x20%s,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'),JSON['stringify'](_0x233ca1));if(_0x233ca1[_0x344a('0x12')]){if(_0x233ca1['error'][_0x344a('0x13')]===0x1f4){logger[_0x344a('0x12')]('Tag,\x20%s,\x20%s',_0x553d97,_0x233ca1['error'][_0x344a('0x14')]);return _0x475dab(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}logger[_0x344a('0x12')](_0x344a('0x15'),_0x553d97,_0x233ca1[_0x344a('0x12')]['message']);return _0x484661(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}else{logger[_0x344a('0xf')](_0x344a('0x15'),_0x553d97,'request\x20sent');_0x484661(_0x233ca1['result'][_0x344a('0x14')]);}})[_0x344a('0x16')](function(_0x36227e){logger[_0x344a('0x12')]('Tag,\x20%s,\x20%s',_0x553d97,_0x36227e);_0x475dab(_0x36227e);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index efa146f..ede1250 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 _0x0fe3=['../../config/environment','./team.controller','get','isAuthenticated','index','show','getQueues','/:id/users','getAgents','post','create','addQueues','addAgents','/:id','delete','destroy','/:id/queues','removeQueues','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x147b6b,_0x23c714){var _0x8da7ac=function(_0x282beb){while(--_0x282beb){_0x147b6b['push'](_0x147b6b['shift']());}};_0x8da7ac(++_0x23c714);}(_0x0fe3,0x1c2));var _0x30fe=function(_0x479372,_0x1bb4d3){_0x479372=_0x479372-0x0;var _0x3a9b00=_0x0fe3[_0x479372];return _0x3a9b00;};'use strict';var multer=require('multer');var util=require(_0x30fe('0x0'));var path=require(_0x30fe('0x1'));var timeout=require(_0x30fe('0x2'));var express=require('express');var router=express[_0x30fe('0x3')]();var auth=require(_0x30fe('0x4'));var interaction=require(_0x30fe('0x5'));var config=require(_0x30fe('0x6'));var controller=require(_0x30fe('0x7'));router[_0x30fe('0x8')]('/',auth[_0x30fe('0x9')](),controller[_0x30fe('0xa')]);router[_0x30fe('0x8')]('/:id',auth[_0x30fe('0x9')](),controller[_0x30fe('0xb')]);router[_0x30fe('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x30fe('0xc')]);router[_0x30fe('0x8')](_0x30fe('0xd'),auth['isAuthenticated'](),controller[_0x30fe('0xe')]);router[_0x30fe('0xf')]('/',auth[_0x30fe('0x9')](),controller[_0x30fe('0x10')]);router[_0x30fe('0xf')]('/:id/queues',auth[_0x30fe('0x9')](),controller[_0x30fe('0x11')]);router[_0x30fe('0xf')](_0x30fe('0xd'),auth[_0x30fe('0x9')](),controller[_0x30fe('0x12')]);router['put'](_0x30fe('0x13'),auth['isAuthenticated'](),controller['update']);router[_0x30fe('0x14')](_0x30fe('0x13'),auth[_0x30fe('0x9')](),controller[_0x30fe('0x15')]);router['delete'](_0x30fe('0x16'),auth[_0x30fe('0x9')](),controller[_0x30fe('0x17')]);router[_0x30fe('0x14')](_0x30fe('0xd'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x49f7=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','index','get','/:id','show','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','put','delete','/:id/queues','removeQueues','exports','multer','path','connect-timeout'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x49f7,0x17d));var _0x749f=function(_0x181b97,_0x5e59ce){_0x181b97=_0x181b97-0x0;var _0x504f2d=_0x49f7[_0x181b97];return _0x504f2d;};'use strict';var multer=require(_0x749f('0x0'));var util=require('util');var path=require(_0x749f('0x1'));var timeout=require(_0x749f('0x2'));var express=require('express');var router=express[_0x749f('0x3')]();var auth=require(_0x749f('0x4'));var interaction=require(_0x749f('0x5'));var config=require(_0x749f('0x6'));var controller=require(_0x749f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x749f('0x8')]);router[_0x749f('0x9')](_0x749f('0xa'),auth['isAuthenticated'](),controller[_0x749f('0xb')]);router['get']('/:id/queues',auth['isAuthenticated'](),controller[_0x749f('0xc')]);router['get'](_0x749f('0xd'),auth[_0x749f('0xe')](),controller[_0x749f('0xf')]);router[_0x749f('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x749f('0x10')]('/:id/queues',auth[_0x749f('0xe')](),controller[_0x749f('0x11')]);router[_0x749f('0x10')](_0x749f('0xd'),auth[_0x749f('0xe')](),controller[_0x749f('0x12')]);router[_0x749f('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x749f('0x14')](_0x749f('0xa'),auth[_0x749f('0xe')](),controller['destroy']);router[_0x749f('0x14')](_0x749f('0x15'),auth[_0x749f('0xe')](),controller[_0x749f('0x16')]);router[_0x749f('0x14')](_0x749f('0xd'),auth[_0x749f('0xe')](),controller['removeAgents']);module[_0x749f('0x17')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index a1475df..bb955f3 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 _0x89f6=['STRING','exports'];(function(_0x187842,_0x2f1456){var _0x40dc51=function(_0x48995d){while(--_0x48995d){_0x187842['push'](_0x187842['shift']());}};_0x40dc51(++_0x2f1456);}(_0x89f6,0x83));var _0x689f=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x89f6[_0x33032e];return _0x13316b;};'use strict';var Sequelize=require('sequelize');module[_0x689f('0x0')]={'name':{'type':Sequelize[_0x689f('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x689f('0x1')]}}; \ No newline at end of file +var _0xd58e=['exports','name','STRING','sequelize'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd58e,0x14b));var _0xed58=function(_0x136a53,_0x50e12f){_0x136a53=_0x136a53-0x0;var _0x56a3b2=_0xd58e[_0x136a53];return _0x56a3b2;};'use strict';var Sequelize=require(_0xed58('0x0'));module[_0xed58('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xed58('0x2')},'description':{'type':Sequelize[_0xed58('0x3')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index a16ac6a..019398b 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 _0xe211=['show','keys','find','create','body','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getQueues','findOne','params','channel','Sequelize','ValidationError','Unknown\x20channel','toLowerCase','Queue','capitalize','Queues','addQueues','isValidChannel','add','ids','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','each','User','findAll','online','interface','UserVoiceQueueRt','upsert','isNil','voicePause','spread','emit','userTeam:save','removeAgents','voice','chat','sms','fax','userTeam:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','get','Teams','UserProfileResource','sendStatus','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch'];(function(_0x2c8d85,_0x590fef){var _0x277ef4=function(_0x7c7a91){while(--_0x7c7a91){_0x2c8d85['push'](_0x2c8d85['shift']());}};_0x277ef4(++_0x590fef);}(_0xe211,0xb7));var _0x1e21=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe211[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1e21('0x0'));var rimraf=require(_0x1e21('0x1'));var zipdir=require(_0x1e21('0x2'));var jsonpatch=require(_0x1e21('0x3'));var rp=require('request-promise');var moment=require(_0x1e21('0x4'));var BPromise=require(_0x1e21('0x5'));var Mustache=require(_0x1e21('0x6'));var util=require(_0x1e21('0x7'));var path=require(_0x1e21('0x8'));var sox=require(_0x1e21('0x9'));var csv=require(_0x1e21('0xa'));var ejs=require(_0x1e21('0xb'));var fs=require('fs');var _=require(_0x1e21('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1e21('0xa'));var querystring=require('querystring');var Papa=require(_0x1e21('0xd'));var Redis=require(_0x1e21('0xe'));var authService=require(_0x1e21('0xf'));var qs=require(_0x1e21('0x10'));var as=require(_0x1e21('0x11'));var hardwareService=require(_0x1e21('0x12'));var logger=require('../../config/logger')(_0x1e21('0x13'));var utils=require('../../config/utils');var config=require(_0x1e21('0x14'));var licenseUtil=require(_0x1e21('0x15'));var db=require(_0x1e21('0x16'))['db'];config[_0x1e21('0x17')]=_[_0x1e21('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1e21('0x19'))(new Redis(config['redis']));require(_0x1e21('0x1a'))['register'](socket);function respondWithStatusCode(_0x5b9e77,_0x3cc96e){_0x3cc96e=_0x3cc96e||0xcc;return function(_0x2785b7){if(_0x2785b7){return _0x5b9e77['sendStatus'](_0x3cc96e);}return _0x5b9e77['status'](_0x3cc96e)[_0x1e21('0x1b')]();};}function respondWithResult(_0x3e170b,_0x34fbc8){_0x34fbc8=_0x34fbc8||0xc8;return function(_0x314eec){if(_0x314eec){return _0x3e170b['status'](_0x34fbc8)[_0x1e21('0x1c')](_0x314eec);}};}function respondWithFilteredResult(_0x92b1aa,_0x677e80){return function(_0x5f4098){if(_0x5f4098){var _0x3f0220=_0x5f4098[_0x1e21('0x1d')],_0x4b7991=_0x677e80[_0x1e21('0x1e')],_0x3e3ae0=_0x677e80[_0x1e21('0x1e')]+_0x677e80[_0x1e21('0x1f')],_0x1ec321;if(_0x3e3ae0>=_0x3f0220){_0x3e3ae0=_0x3f0220;_0x1ec321=0xc8;}else{_0x1ec321=0xce;}_0x92b1aa[_0x1e21('0x20')](_0x1ec321);return _0x92b1aa[_0x1e21('0x21')](_0x1e21('0x22'),_0x4b7991+'-'+_0x3e3ae0+'/'+_0x3f0220)[_0x1e21('0x1c')](_0x5f4098);}return null;};}function patchUpdates(_0x4c114e){return function(_0x1e5260){try{jsonpatch[_0x1e21('0x23')](_0x1e5260,_0x4c114e,!![]);}catch(_0x24615d){return BPromise[_0x1e21('0x24')](_0x24615d);}return _0x1e5260[_0x1e21('0x25')]();};}function saveUpdates(_0x448a36,_0x34cae9){return function(_0x546c31){if(_0x546c31){return _0x546c31[_0x1e21('0x26')](_0x448a36)['then'](function(_0x5ba1bd){return _0x5ba1bd;});}return null;};}function removeEntity(_0x549eb3,_0x497506){return function(_0x450a5e){if(_0x450a5e){return _0x450a5e['destroy']()[_0x1e21('0x27')](function(){var _0x304cdc=_0x450a5e[_0x1e21('0x28')]({'plain':!![]});var _0x4296a6=_0x1e21('0x29');return db[_0x1e21('0x2a')]['destroy']({'where':{'type':_0x4296a6,'resourceId':_0x304cdc['id']}})[_0x1e21('0x27')](function(){return _0x450a5e;});})[_0x1e21('0x27')](function(){_0x549eb3[_0x1e21('0x20')](0xcc)[_0x1e21('0x1b')]();});}};}function handleEntityNotFound(_0x1ed525,_0x1b9015){return function(_0x271d00){if(!_0x271d00){_0x1ed525[_0x1e21('0x2b')](0x194);}return _0x271d00;};}function handleError(_0x150a2c,_0x4c9c0d){_0x4c9c0d=_0x4c9c0d||0x1f4;return function(_0x410918){logger[_0x1e21('0x2c')](_0x410918[_0x1e21('0x2d')]);if(_0x410918[_0x1e21('0x2e')]){delete _0x410918[_0x1e21('0x2e')];}_0x150a2c[_0x1e21('0x20')](_0x4c9c0d)[_0x1e21('0x2f')](_0x410918);};}exports[_0x1e21('0x30')]=function(_0x1b9eb7,_0x35e49b){var _0x44ffb1={},_0x4de84e={},_0x279e27={'count':0x0,'rows':[]};var _0x87f42c=_[_0x1e21('0x31')](db[_0x1e21('0x32')][_0x1e21('0x33')],function(_0x369cb3){return{'name':_0x369cb3[_0x1e21('0x34')],'type':_0x369cb3[_0x1e21('0x35')][_0x1e21('0x36')]};});_0x4de84e[_0x1e21('0x37')]=_[_0x1e21('0x31')](_0x87f42c,'name');_0x4de84e[_0x1e21('0x38')]=_['keys'](_0x1b9eb7[_0x1e21('0x38')]);_0x4de84e[_0x1e21('0x39')]=_[_0x1e21('0x3a')](_0x4de84e[_0x1e21('0x37')],_0x4de84e[_0x1e21('0x38')]);_0x44ffb1[_0x1e21('0x3b')]=_[_0x1e21('0x3a')](_0x4de84e[_0x1e21('0x37')],qs['fields'](_0x1b9eb7[_0x1e21('0x38')][_0x1e21('0x3c')]));_0x44ffb1[_0x1e21('0x3b')]=_0x44ffb1['attributes'][_0x1e21('0x3d')]?_0x44ffb1['attributes']:_0x4de84e['model'];if(!_0x1b9eb7[_0x1e21('0x38')][_0x1e21('0x3e')](_0x1e21('0x3f'))){_0x44ffb1[_0x1e21('0x1f')]=qs[_0x1e21('0x1f')](_0x1b9eb7[_0x1e21('0x38')]['limit']);_0x44ffb1[_0x1e21('0x1e')]=qs[_0x1e21('0x1e')](_0x1b9eb7[_0x1e21('0x38')][_0x1e21('0x1e')]);}_0x44ffb1[_0x1e21('0x40')]=qs[_0x1e21('0x41')](_0x1b9eb7[_0x1e21('0x38')][_0x1e21('0x41')]);_0x44ffb1[_0x1e21('0x42')]=qs[_0x1e21('0x39')](_[_0x1e21('0x43')](_0x1b9eb7[_0x1e21('0x38')],_0x4de84e[_0x1e21('0x39')]),_0x87f42c);if(_0x1b9eb7[_0x1e21('0x38')][_0x1e21('0x44')]){_0x44ffb1[_0x1e21('0x42')]=_['merge'](_0x44ffb1[_0x1e21('0x42')],{'$or':_[_0x1e21('0x31')](_0x87f42c,function(_0x581994){if(_0x581994[_0x1e21('0x35')]!=='VIRTUAL'){var _0x1c5015={};_0x1c5015[_0x581994[_0x1e21('0x2e')]]={'$like':'%'+_0x1b9eb7['query'][_0x1e21('0x44')]+'%'};return _0x1c5015;}})});}_0x44ffb1=_[_0x1e21('0x45')]({},_0x44ffb1,_0x1b9eb7[_0x1e21('0x46')]);var _0xe03daa={'where':_0x44ffb1['where']};return db[_0x1e21('0x32')]['count'](_0xe03daa)[_0x1e21('0x27')](function(_0x5cb154){_0x279e27[_0x1e21('0x1d')]=_0x5cb154;if(_0x1b9eb7['query'][_0x1e21('0x47')]){_0x44ffb1[_0x1e21('0x48')]=[{'all':!![]}];}return db[_0x1e21('0x32')]['findAll'](_0x44ffb1);})[_0x1e21('0x27')](function(_0x24fb59){_0x279e27[_0x1e21('0x49')]=_0x24fb59;return _0x279e27;})[_0x1e21('0x27')](respondWithFilteredResult(_0x35e49b,_0x44ffb1))[_0x1e21('0x4a')](handleError(_0x35e49b,null));};exports[_0x1e21('0x4b')]=function(_0x4f8936,_0x45e004){var _0x78a12d={'raw':![],'where':{'id':_0x4f8936['params']['id']}},_0x17ac02={};_0x17ac02[_0x1e21('0x37')]=_[_0x1e21('0x4c')](db[_0x1e21('0x32')][_0x1e21('0x33')]);_0x17ac02[_0x1e21('0x38')]=_[_0x1e21('0x4c')](_0x4f8936[_0x1e21('0x38')]);_0x17ac02[_0x1e21('0x39')]=_[_0x1e21('0x3a')](_0x17ac02['model'],_0x17ac02[_0x1e21('0x38')]);_0x78a12d[_0x1e21('0x3b')]=_[_0x1e21('0x3a')](_0x17ac02[_0x1e21('0x37')],qs[_0x1e21('0x3c')](_0x4f8936['query'][_0x1e21('0x3c')]));_0x78a12d[_0x1e21('0x3b')]=_0x78a12d[_0x1e21('0x3b')][_0x1e21('0x3d')]?_0x78a12d[_0x1e21('0x3b')]:_0x17ac02['model'];if(_0x4f8936['query'][_0x1e21('0x47')]){_0x78a12d['include']=[{'all':!![]}];}_0x78a12d=_[_0x1e21('0x45')]({},_0x78a12d,_0x4f8936['options']);return db[_0x1e21('0x32')][_0x1e21('0x4d')](_0x78a12d)[_0x1e21('0x27')](handleEntityNotFound(_0x45e004,null))['then'](respondWithResult(_0x45e004,null))[_0x1e21('0x4a')](handleError(_0x45e004,null));};exports[_0x1e21('0x4e')]=function(_0x50a78e,_0x280516){return db[_0x1e21('0x32')]['create'](_0x50a78e[_0x1e21('0x4f')],{})[_0x1e21('0x27')](function(_0x15006b){var _0x4b8ba9=_0x50a78e['user'][_0x1e21('0x28')]({'plain':!![]});if(!_0x4b8ba9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b8ba9[_0x1e21('0x50')]===_0x1e21('0x51')){var _0x4eeaff=_0x15006b['get']({'plain':!![]});var _0x338b98=_0x1e21('0x29');return db[_0x1e21('0x52')]['find']({'where':{'name':_0x338b98,'userProfileId':_0x4b8ba9['userProfileId']},'raw':!![]})[_0x1e21('0x27')](function(_0x194d23){if(_0x194d23&&_0x194d23[_0x1e21('0x53')]===0x0){return db[_0x1e21('0x2a')][_0x1e21('0x4e')]({'name':_0x4eeaff[_0x1e21('0x2e')],'resourceId':_0x4eeaff['id'],'type':_0x194d23[_0x1e21('0x2e')],'sectionId':_0x194d23['id']},{})[_0x1e21('0x27')](function(){return _0x15006b;});}else{return _0x15006b;}})[_0x1e21('0x4a')](function(_0x591f08){logger[_0x1e21('0x2c')](_0x1e21('0x54'),_0x591f08);throw _0x591f08;});}return _0x15006b;})[_0x1e21('0x27')](respondWithResult(_0x280516,0xc9))['catch'](handleError(_0x280516,null));};exports[_0x1e21('0x26')]=function(_0x4df2a9,_0x2d7563){if(_0x4df2a9['body']['id']){delete _0x4df2a9[_0x1e21('0x4f')]['id'];}return db[_0x1e21('0x32')][_0x1e21('0x4d')]({'where':{'id':_0x4df2a9['params']['id']}})[_0x1e21('0x27')](handleEntityNotFound(_0x2d7563,null))[_0x1e21('0x27')](saveUpdates(_0x4df2a9[_0x1e21('0x4f')],null))[_0x1e21('0x27')](respondWithResult(_0x2d7563,null))[_0x1e21('0x4a')](handleError(_0x2d7563,null));};exports[_0x1e21('0x55')]=function(_0x5ce32b,_0xb53eed){return db[_0x1e21('0x32')]['find']({'where':{'id':_0x5ce32b['params']['id']}})[_0x1e21('0x27')](handleEntityNotFound(_0xb53eed,null))[_0x1e21('0x27')](removeEntity(_0xb53eed,null))[_0x1e21('0x4a')](handleError(_0xb53eed,null));};exports[_0x1e21('0x56')]=function(_0x17de2c,_0x3a770f,_0x3c0261){return db[_0x1e21('0x32')][_0x1e21('0x57')]({'where':{'id':_0x17de2c[_0x1e21('0x58')]['id']}})['then'](handleEntityNotFound(_0x3a770f,null))[_0x1e21('0x27')](function(_0xb93bf8){if(!_0x17de2c[_0x1e21('0x38')][_0x1e21('0x59')]||!utils['isValidChannel'](_0x17de2c[_0x1e21('0x38')]['channel'])){throw new db[(_0x1e21('0x5a'))][(_0x1e21('0x5b'))](_0x1e21('0x5c'));}var _0x4a140d={};var _0x4a5919={};_0x4a5919['model']=_[_0x1e21('0x4c')](db[_['capitalize'](_0x17de2c['query'][_0x1e21('0x59')][_0x1e21('0x5d')]())+_0x1e21('0x5e')][_0x1e21('0x33')]);_0x4a5919['query']=_[_0x1e21('0x4c')](_0x17de2c[_0x1e21('0x38')]);_0x4a5919[_0x1e21('0x39')]=_[_0x1e21('0x3a')](_0x4a5919['model'],_0x4a5919[_0x1e21('0x38')]);_0x4a140d['attributes']=_[_0x1e21('0x3a')](_0x4a5919[_0x1e21('0x37')],qs[_0x1e21('0x3c')](_0x17de2c[_0x1e21('0x38')][_0x1e21('0x3c')]));_0x4a140d[_0x1e21('0x3b')]=_0x4a140d[_0x1e21('0x3b')][_0x1e21('0x3d')]?_0x4a140d['attributes']:_0x4a5919[_0x1e21('0x37')];_0x4a140d[_0x1e21('0x1f')]=qs[_0x1e21('0x1f')](_0x17de2c[_0x1e21('0x38')][_0x1e21('0x1f')]);_0x4a140d[_0x1e21('0x1e')]=qs[_0x1e21('0x1e')](_0x17de2c[_0x1e21('0x38')][_0x1e21('0x1e')]);_0x4a140d['order']=qs[_0x1e21('0x41')](_0x17de2c[_0x1e21('0x38')]['sort']);_0x4a140d['where']=qs[_0x1e21('0x39')](_[_0x1e21('0x43')](_0x17de2c[_0x1e21('0x38')],_0x4a5919[_0x1e21('0x39')]));_0x4a140d=_[_0x1e21('0x45')]({},_0x4a140d,_0x17de2c[_0x1e21('0x46')]);return _0xb93bf8[_0x1e21('0x28')+_[_0x1e21('0x5f')](_0x17de2c[_0x1e21('0x38')]['channel']['toLowerCase']())+_0x1e21('0x60')](_0x4a140d);})['then'](respondWithResult(_0x3a770f,null))['catch'](handleError(_0x3a770f,null));};exports[_0x1e21('0x61')]=function(_0x43027b,_0x4b3c67,_0x25a660){return db['Team'][_0x1e21('0x57')]({'where':{'id':_0x43027b[_0x1e21('0x58')]['id']}})[_0x1e21('0x27')](function(_0x4dcf8b){if(_0x4dcf8b){if(!_0x43027b[_0x1e21('0x4f')][_0x1e21('0x59')]||!utils[_0x1e21('0x62')](_0x43027b['body']['channel'])){throw new db[(_0x1e21('0x5a'))][(_0x1e21('0x5b'))]('Unknown\x20channel');}return _0x4dcf8b[_0x1e21('0x63')+_['capitalize'](_0x43027b[_0x1e21('0x4f')]['channel'][_0x1e21('0x5d')]())+_0x1e21('0x60')](_0x43027b[_0x1e21('0x4f')][_0x1e21('0x64')]);}return null;})[_0x1e21('0x27')](handleEntityNotFound(_0x4b3c67,null))[_0x1e21('0x27')](respondWithStatusCode(_0x4b3c67,null))[_0x1e21('0x4a')](handleError(_0x4b3c67,null));};exports['removeQueues']=function(_0x50b104,_0x5aad98,_0x4f1e22){return db[_0x1e21('0x32')][_0x1e21('0x57')]({'where':{'id':_0x50b104['params']['id']}})[_0x1e21('0x27')](function(_0x40e26d){if(_0x40e26d){if(!_0x50b104[_0x1e21('0x38')][_0x1e21('0x59')]||!utils[_0x1e21('0x62')](_0x50b104[_0x1e21('0x38')]['channel'])){throw new db[(_0x1e21('0x5a'))][(_0x1e21('0x5b'))](_0x1e21('0x5c'));}return _0x40e26d[_0x1e21('0x65')+_[_0x1e21('0x5f')](_0x50b104['query']['channel']['toLowerCase']())+_0x1e21('0x60')](_0x50b104[_0x1e21('0x38')][_0x1e21('0x64')]);}return null;})['then'](handleEntityNotFound(_0x5aad98,null))[_0x1e21('0x27')](respondWithStatusCode(_0x5aad98,null))[_0x1e21('0x4a')](handleError(_0x5aad98,null));};exports[_0x1e21('0x66')]=function(_0x516acb,_0x5decc6,_0x47e8da){return db[_0x1e21('0x32')]['find']({'where':{'id':_0x516acb[_0x1e21('0x58')]['id']}})[_0x1e21('0x27')](handleEntityNotFound(_0x5decc6,null))['then'](function(_0x16e508){if(_0x16e508){var _0x253f91=[_0x1e21('0x67'),_0x1e21('0x68'),_0x1e21('0x69'),_0x1e21('0x6a'),_0x1e21('0x6b'),_0x1e21('0x6c'),_0x1e21('0x6d')];return BPromise['each'](_0x253f91,function(_0x1e1e15){return _0x16e508['get'+_0x1e1e15+_0x1e21('0x60')]({'attributes':['id',_0x1e21('0x2e')]})[_0x1e21('0x27')](function(_0x30e555){return BPromise[_0x1e21('0x6e')](_0x30e555,function(_0x4f24ef){return _0x4f24ef[_0x1e21('0x66')](_0x516acb['body'][_0x1e21('0x64')])[_0x1e21('0x27')](function(){if(_0x1e1e15==='Voice'){return db[_0x1e21('0x6f')][_0x1e21('0x70')]({'where':{'id':_0x516acb['body'][_0x1e21('0x64')]},'attributes':['id',_0x1e21('0x2e'),_0x1e21('0x71'),'voicePause',_0x1e21('0x72')],'raw':!![]})[_0x1e21('0x27')](function(_0x55c73b){return BPromise[_0x1e21('0x6e')](_[_0x1e21('0x44')](_0x55c73b,{'online':0x1}),function(_0x3e1f34){return db[_0x1e21('0x73')][_0x1e21('0x74')]({'membername':_0x3e1f34['name'],'UserId':_0x3e1f34['id'],'queue_name':_0x4f24ef[_0x1e21('0x2e')],'VoiceQueueId':_0x4f24ef['id'],'interface':_[_0x1e21('0x75')](_0x3e1f34['interface'])?util['format']('SIP/%s',_0x3e1f34[_0x1e21('0x2e')]):_0x3e1f34['interface'],'paused':_0x3e1f34[_0x1e21('0x76')]||![],'penalty':0x0});});});}});});})[_0x1e21('0x27')](function(){return _0x16e508;});})[_0x1e21('0x27')](function(){return _0x16e508;});}})[_0x1e21('0x27')](function(_0x2a5b26){if(_0x2a5b26){return _0x2a5b26[_0x1e21('0x66')](_0x516acb[_0x1e21('0x4f')][_0x1e21('0x64')],_['omit'](_0x516acb[_0x1e21('0x4f')],[_0x1e21('0x64'),'id'])||{})[_0x1e21('0x77')](function(_0xd76519){for(var _0x1dabbc=0x0;_0x1dabbc<_0x516acb['body'][_0x1e21('0x64')][_0x1e21('0x3d')];_0x1dabbc+=0x1){socket[_0x1e21('0x78')](_0x1e21('0x79'),{'UserId':_0x516acb[_0x1e21('0x4f')]['ids'][_0x1dabbc],'TeamId':_0x516acb[_0x1e21('0x58')]['id']});}return _0xd76519;});}})[_0x1e21('0x27')](respondWithResult(_0x5decc6,null))[_0x1e21('0x4a')](handleError(_0x5decc6,null));};exports[_0x1e21('0x7a')]=function(_0x221199,_0x5c7dbd,_0x35c348){return db['Team']['find']({'where':{'id':_0x221199[_0x1e21('0x58')]['id']}})[_0x1e21('0x27')](handleEntityNotFound(_0x5c7dbd,null))['then'](function(_0x29d1c9){if(_0x29d1c9){return BPromise['each']([_0x1e21('0x7b'),_0x1e21('0x7c'),'mail',_0x1e21('0x7d'),_0x1e21('0x7e'),'openchannel','whatsapp'],function(_0x1683a1){return _0x29d1c9[_0x1e21('0x28')+_['capitalize'](_0x1683a1)+_0x1e21('0x60')]({'attributes':['id',_0x1e21('0x2e')]})[_0x1e21('0x27')](function(_0x60b334){return BPromise['each'](_0x60b334,function(_0x439d8b){return _0x439d8b[_0x1e21('0x7a')](_0x221199['query'][_0x1e21('0x64')])['then'](function(){if(_0x1683a1==='voice'){return db[_0x1e21('0x73')][_0x1e21('0x55')]({'where':{'VoiceQueueId':_0x439d8b['id'],'UserId':_0x221199[_0x1e21('0x38')][_0x1e21('0x64')]}});}});});})[_0x1e21('0x27')](function(){return _0x29d1c9;});})[_0x1e21('0x27')](function(){return _0x29d1c9;});}})[_0x1e21('0x27')](function(_0x1d3acb){if(_0x1d3acb){return _0x1d3acb[_0x1e21('0x7a')](_0x221199[_0x1e21('0x38')][_0x1e21('0x64')])[_0x1e21('0x27')](function(){if(_['isArray'](_0x221199[_0x1e21('0x38')][_0x1e21('0x64')])){for(var _0x5d5292=0x0;_0x5d5292<_0x221199[_0x1e21('0x38')][_0x1e21('0x64')][_0x1e21('0x3d')];_0x5d5292+=0x1){socket[_0x1e21('0x78')]('userTeam:remove',{'UserId':Number(_0x221199[_0x1e21('0x38')]['ids'][_0x5d5292]),'TeamId':Number(_0x221199[_0x1e21('0x58')]['id'])});}}else{socket[_0x1e21('0x78')](_0x1e21('0x7f'),{'UserId':Number(_0x221199['query'][_0x1e21('0x64')]),'TeamId':Number(_0x221199['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5c7dbd,null))[_0x1e21('0x4a')](handleError(_0x5c7dbd,null));};exports[_0x1e21('0x80')]=function(_0x472b2a,_0x58a531,_0x4bd3d0){var _0x3e9bf4={};var _0x1d3e99={};var _0x299789;var _0xe2002a;return db['Team'][_0x1e21('0x57')]({'where':{'id':_0x472b2a[_0x1e21('0x58')]['id']}})[_0x1e21('0x27')](handleEntityNotFound(_0x58a531,null))[_0x1e21('0x27')](function(_0x1ac741){if(_0x1ac741){_0x299789=_0x1ac741;_0x1d3e99[_0x1e21('0x37')]=_[_0x1e21('0x4c')](db[_0x1e21('0x6f')][_0x1e21('0x33')]);_0x1d3e99[_0x1e21('0x38')]=_[_0x1e21('0x4c')](_0x472b2a['query']);_0x1d3e99[_0x1e21('0x39')]=_[_0x1e21('0x3a')](_0x1d3e99[_0x1e21('0x37')],_0x1d3e99['query']);_0x3e9bf4[_0x1e21('0x3b')]=_[_0x1e21('0x3a')](_0x1d3e99[_0x1e21('0x37')],qs[_0x1e21('0x3c')](_0x472b2a['query'][_0x1e21('0x3c')]));_0x3e9bf4[_0x1e21('0x3b')]=_0x3e9bf4[_0x1e21('0x3b')][_0x1e21('0x3d')]?_0x3e9bf4[_0x1e21('0x3b')]:_0x1d3e99[_0x1e21('0x37')];_0x3e9bf4['order']=qs[_0x1e21('0x41')](_0x472b2a['query'][_0x1e21('0x41')]);_0x3e9bf4[_0x1e21('0x42')]=qs['filters'](_[_0x1e21('0x43')](_0x472b2a[_0x1e21('0x38')],_0x1d3e99[_0x1e21('0x39')]));if(_0x472b2a['query']['filter']){_0x3e9bf4[_0x1e21('0x42')]=_[_0x1e21('0x45')](_0x3e9bf4[_0x1e21('0x42')],{'$or':_[_0x1e21('0x31')](_0x3e9bf4[_0x1e21('0x3b')],function(_0x51774e){var _0x516ce9={};_0x516ce9[_0x51774e]={'$like':'%'+_0x472b2a[_0x1e21('0x38')][_0x1e21('0x44')]+'%'};return _0x516ce9;})});}_0x3e9bf4=_[_0x1e21('0x45')]({},_0x3e9bf4,_0x472b2a[_0x1e21('0x46')]);return _0x299789[_0x1e21('0x80')](_0x3e9bf4);}})[_0x1e21('0x27')](function(_0x1d138a){if(_0x1d138a){_0xe2002a=_0x1d138a[_0x1e21('0x3d')];if(!_0x472b2a['query'][_0x1e21('0x3e')]('nolimit')){_0x3e9bf4[_0x1e21('0x1f')]=qs[_0x1e21('0x1f')](_0x472b2a[_0x1e21('0x38')][_0x1e21('0x1f')]);_0x3e9bf4['offset']=qs[_0x1e21('0x1e')](_0x472b2a[_0x1e21('0x38')]['offset']);}return _0x299789['getAgents'](_0x3e9bf4);}})[_0x1e21('0x27')](function(_0x5266aa){if(_0x5266aa){return _0x5266aa?{'count':_0xe2002a,'rows':_0x5266aa}:null;}})['then'](respondWithResult(_0x58a531,null))[_0x1e21('0x4a')](handleError(_0x58a531,null));}; \ No newline at end of file +var _0x50e9=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./team.socket','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Teams','UserProfileResource','sendStatus','error','name','send','index','Team','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','findOne','channel','Unknown\x20channel','Queue','capitalize','toLowerCase','addQueues','isValidChannel','Sequelize','ValidationError','add','Queues','ids','addAgents','Chat','Mail','Sms','Openchannel','Whatsapp','each','User','online','isNil','SIP/%s','interface','voicePause','omit','spread','userTeam:save','chat','fax','openchannel','voice','UserVoiceQueueRt','emit','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x4632f7,_0x529597){var _0x415281=function(_0x3fdca3){while(--_0x3fdca3){_0x4632f7['push'](_0x4632f7['shift']());}};_0x415281(++_0x529597);}(_0x50e9,0xec));var _0x950e=function(_0x100890,_0x5f0b22){_0x100890=_0x100890-0x0;var _0x308d99=_0x50e9[_0x100890];return _0x308d99;};'use strict';var pdf=require(_0x950e('0x0'));var emlformat=require(_0x950e('0x1'));var rimraf=require(_0x950e('0x2'));var zipdir=require(_0x950e('0x3'));var jsonpatch=require(_0x950e('0x4'));var rp=require('request-promise');var moment=require(_0x950e('0x5'));var BPromise=require(_0x950e('0x6'));var Mustache=require(_0x950e('0x7'));var util=require(_0x950e('0x8'));var path=require(_0x950e('0x9'));var sox=require('sox');var csv=require(_0x950e('0xa'));var ejs=require(_0x950e('0xb'));var fs=require('fs');var _=require(_0x950e('0xc'));var squel=require(_0x950e('0xd'));var crypto=require(_0x950e('0xe'));var jsforce=require(_0x950e('0xf'));var deskjs=require(_0x950e('0x10'));var toCsv=require(_0x950e('0xa'));var querystring=require(_0x950e('0x11'));var Papa=require(_0x950e('0x12'));var Redis=require('ioredis');var authService=require(_0x950e('0x13'));var qs=require(_0x950e('0x14'));var as=require(_0x950e('0x15'));var hardwareService=require(_0x950e('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x950e('0x17'));var config=require(_0x950e('0x18'));var licenseUtil=require(_0x950e('0x19'));var db=require('../../mysqldb')['db'];config[_0x950e('0x1a')]=_[_0x950e('0x1b')](config[_0x950e('0x1a')],{'host':_0x950e('0x1c'),'port':0x18eb});var socket=require(_0x950e('0x1d'))(new Redis(config[_0x950e('0x1a')]));require(_0x950e('0x1e'))['register'](socket);function respondWithStatusCode(_0x4b70cb,_0x535299){_0x535299=_0x535299||0xcc;return function(_0x197a1c){if(_0x197a1c){return _0x4b70cb['sendStatus'](_0x535299);}return _0x4b70cb[_0x950e('0x1f')](_0x535299)[_0x950e('0x20')]();};}function respondWithResult(_0x5b40e3,_0x2f3588){_0x2f3588=_0x2f3588||0xc8;return function(_0x6a1c14){if(_0x6a1c14){return _0x5b40e3[_0x950e('0x1f')](_0x2f3588)[_0x950e('0x21')](_0x6a1c14);}};}function respondWithFilteredResult(_0x2c5f94,_0x4e8bdf){return function(_0x286fa3){if(_0x286fa3){var _0x439cbc=_0x286fa3[_0x950e('0x22')],_0x5013b8=_0x4e8bdf['offset'],_0x48d4ee=_0x4e8bdf[_0x950e('0x23')]+_0x4e8bdf[_0x950e('0x24')],_0x333990;if(_0x48d4ee>=_0x439cbc){_0x48d4ee=_0x439cbc;_0x333990=0xc8;}else{_0x333990=0xce;}_0x2c5f94[_0x950e('0x1f')](_0x333990);return _0x2c5f94[_0x950e('0x25')](_0x950e('0x26'),_0x5013b8+'-'+_0x48d4ee+'/'+_0x439cbc)['json'](_0x286fa3);}return null;};}function patchUpdates(_0x5531b7){return function(_0x1b035b){try{jsonpatch['apply'](_0x1b035b,_0x5531b7,!![]);}catch(_0x3c328c){return BPromise[_0x950e('0x27')](_0x3c328c);}return _0x1b035b[_0x950e('0x28')]();};}function saveUpdates(_0x46cb44,_0xbac570){return function(_0x1facc4){if(_0x1facc4){return _0x1facc4[_0x950e('0x29')](_0x46cb44)[_0x950e('0x2a')](function(_0x27db9c){return _0x27db9c;});}return null;};}function removeEntity(_0x918297,_0x42c2a5){return function(_0x5f38f1){if(_0x5f38f1){return _0x5f38f1[_0x950e('0x2b')]()['then'](function(){var _0x32b403=_0x5f38f1[_0x950e('0x2c')]({'plain':!![]});var _0x53d2b9=_0x950e('0x2d');return db[_0x950e('0x2e')][_0x950e('0x2b')]({'where':{'type':_0x53d2b9,'resourceId':_0x32b403['id']}})[_0x950e('0x2a')](function(){return _0x5f38f1;});})[_0x950e('0x2a')](function(){_0x918297[_0x950e('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5db660,_0x1c71ce){return function(_0xeee784){if(!_0xeee784){_0x5db660[_0x950e('0x2f')](0x194);}return _0xeee784;};}function handleError(_0x43e8bf,_0x5e2e18){_0x5e2e18=_0x5e2e18||0x1f4;return function(_0x5bb256){logger[_0x950e('0x30')](_0x5bb256['stack']);if(_0x5bb256[_0x950e('0x31')]){delete _0x5bb256[_0x950e('0x31')];}_0x43e8bf[_0x950e('0x1f')](_0x5e2e18)[_0x950e('0x32')](_0x5bb256);};}exports[_0x950e('0x33')]=function(_0x53e8be,_0x468a9b){var _0x5058e3={},_0x42ee21={},_0x525ee6={'count':0x0,'rows':[]};var _0x1ea5a1=_['map'](db[_0x950e('0x34')]['rawAttributes'],function(_0x24c4a4){return{'name':_0x24c4a4['fieldName'],'type':_0x24c4a4['type'][_0x950e('0x35')]};});_0x42ee21['model']=_[_0x950e('0x36')](_0x1ea5a1,_0x950e('0x31'));_0x42ee21[_0x950e('0x37')]=_['keys'](_0x53e8be[_0x950e('0x37')]);_0x42ee21[_0x950e('0x38')]=_[_0x950e('0x39')](_0x42ee21['model'],_0x42ee21[_0x950e('0x37')]);_0x5058e3['attributes']=_[_0x950e('0x39')](_0x42ee21[_0x950e('0x3a')],qs[_0x950e('0x3b')](_0x53e8be[_0x950e('0x37')][_0x950e('0x3b')]));_0x5058e3['attributes']=_0x5058e3[_0x950e('0x3c')][_0x950e('0x3d')]?_0x5058e3[_0x950e('0x3c')]:_0x42ee21['model'];if(!_0x53e8be['query'][_0x950e('0x3e')](_0x950e('0x3f'))){_0x5058e3[_0x950e('0x24')]=qs[_0x950e('0x24')](_0x53e8be['query'][_0x950e('0x24')]);_0x5058e3[_0x950e('0x23')]=qs[_0x950e('0x23')](_0x53e8be['query'][_0x950e('0x23')]);}_0x5058e3[_0x950e('0x40')]=qs[_0x950e('0x41')](_0x53e8be[_0x950e('0x37')][_0x950e('0x41')]);_0x5058e3[_0x950e('0x42')]=qs['filters'](_[_0x950e('0x43')](_0x53e8be[_0x950e('0x37')],_0x42ee21[_0x950e('0x38')]),_0x1ea5a1);if(_0x53e8be[_0x950e('0x37')]['filter']){_0x5058e3[_0x950e('0x42')]=_[_0x950e('0x44')](_0x5058e3[_0x950e('0x42')],{'$or':_[_0x950e('0x36')](_0x1ea5a1,function(_0x5998e6){if(_0x5998e6[_0x950e('0x45')]!=='VIRTUAL'){var _0x21d52f={};_0x21d52f[_0x5998e6[_0x950e('0x31')]]={'$like':'%'+_0x53e8be[_0x950e('0x37')][_0x950e('0x46')]+'%'};return _0x21d52f;}})});}_0x5058e3=_[_0x950e('0x44')]({},_0x5058e3,_0x53e8be[_0x950e('0x47')]);var _0x1387d8={'where':_0x5058e3[_0x950e('0x42')]};return db[_0x950e('0x34')][_0x950e('0x22')](_0x1387d8)[_0x950e('0x2a')](function(_0x4bc759){_0x525ee6[_0x950e('0x22')]=_0x4bc759;if(_0x53e8be[_0x950e('0x37')][_0x950e('0x48')]){_0x5058e3[_0x950e('0x49')]=[{'all':!![]}];}return db[_0x950e('0x34')][_0x950e('0x4a')](_0x5058e3);})[_0x950e('0x2a')](function(_0x5e02fa){_0x525ee6[_0x950e('0x4b')]=_0x5e02fa;return _0x525ee6;})[_0x950e('0x2a')](respondWithFilteredResult(_0x468a9b,_0x5058e3))[_0x950e('0x4c')](handleError(_0x468a9b,null));};exports['show']=function(_0x181522,_0x3f3b3c){var _0x4bc5df={'raw':![],'where':{'id':_0x181522[_0x950e('0x4d')]['id']}},_0x5cd301={};_0x5cd301[_0x950e('0x3a')]=_[_0x950e('0x4e')](db[_0x950e('0x34')][_0x950e('0x4f')]);_0x5cd301[_0x950e('0x37')]=_[_0x950e('0x4e')](_0x181522[_0x950e('0x37')]);_0x5cd301[_0x950e('0x38')]=_[_0x950e('0x39')](_0x5cd301['model'],_0x5cd301[_0x950e('0x37')]);_0x4bc5df[_0x950e('0x3c')]=_[_0x950e('0x39')](_0x5cd301[_0x950e('0x3a')],qs[_0x950e('0x3b')](_0x181522[_0x950e('0x37')][_0x950e('0x3b')]));_0x4bc5df[_0x950e('0x3c')]=_0x4bc5df[_0x950e('0x3c')][_0x950e('0x3d')]?_0x4bc5df[_0x950e('0x3c')]:_0x5cd301['model'];if(_0x181522[_0x950e('0x37')][_0x950e('0x48')]){_0x4bc5df['include']=[{'all':!![]}];}_0x4bc5df=_[_0x950e('0x44')]({},_0x4bc5df,_0x181522[_0x950e('0x47')]);return db[_0x950e('0x34')]['find'](_0x4bc5df)[_0x950e('0x2a')](handleEntityNotFound(_0x3f3b3c,null))[_0x950e('0x2a')](respondWithResult(_0x3f3b3c,null))[_0x950e('0x4c')](handleError(_0x3f3b3c,null));};exports[_0x950e('0x50')]=function(_0x4c1b97,_0x56b202){return db[_0x950e('0x34')][_0x950e('0x50')](_0x4c1b97[_0x950e('0x51')],{})['then'](function(_0x40d455){var _0x509bf7=_0x4c1b97['user'][_0x950e('0x2c')]({'plain':!![]});if(!_0x509bf7)throw new Error(_0x950e('0x52'));if(_0x509bf7['role']===_0x950e('0x53')){var _0x570913=_0x40d455[_0x950e('0x2c')]({'plain':!![]});var _0x1b2040=_0x950e('0x2d');return db[_0x950e('0x54')]['find']({'where':{'name':_0x1b2040,'userProfileId':_0x509bf7[_0x950e('0x55')]},'raw':!![]})[_0x950e('0x2a')](function(_0x2aaa55){if(_0x2aaa55&&_0x2aaa55[_0x950e('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x570913[_0x950e('0x31')],'resourceId':_0x570913['id'],'type':_0x2aaa55[_0x950e('0x31')],'sectionId':_0x2aaa55['id']},{})[_0x950e('0x2a')](function(){return _0x40d455;});}else{return _0x40d455;}})[_0x950e('0x4c')](function(_0x12b28b){logger[_0x950e('0x30')](_0x950e('0x57'),_0x12b28b);throw _0x12b28b;});}return _0x40d455;})['then'](respondWithResult(_0x56b202,0xc9))['catch'](handleError(_0x56b202,null));};exports['update']=function(_0x18f2a6,_0x2767d6){if(_0x18f2a6[_0x950e('0x51')]['id']){delete _0x18f2a6[_0x950e('0x51')]['id'];}return db[_0x950e('0x34')][_0x950e('0x58')]({'where':{'id':_0x18f2a6[_0x950e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2767d6,null))[_0x950e('0x2a')](saveUpdates(_0x18f2a6[_0x950e('0x51')],null))[_0x950e('0x2a')](respondWithResult(_0x2767d6,null))[_0x950e('0x4c')](handleError(_0x2767d6,null));};exports[_0x950e('0x2b')]=function(_0x3ffb17,_0xf193bd){return db[_0x950e('0x34')][_0x950e('0x58')]({'where':{'id':_0x3ffb17[_0x950e('0x4d')]['id']}})['then'](handleEntityNotFound(_0xf193bd,null))['then'](removeEntity(_0xf193bd,null))['catch'](handleError(_0xf193bd,null));};exports['getQueues']=function(_0x103778,_0x2235c6,_0x46617b){return db[_0x950e('0x34')][_0x950e('0x59')]({'where':{'id':_0x103778[_0x950e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2235c6,null))['then'](function(_0x1d5880){if(!_0x103778[_0x950e('0x37')]['channel']||!utils['isValidChannel'](_0x103778[_0x950e('0x37')][_0x950e('0x5a')])){throw new db['Sequelize']['ValidationError'](_0x950e('0x5b'));}var _0x1d5ea4={};var _0x38af45={};_0x38af45['model']=_['keys'](db[_['capitalize'](_0x103778['query'][_0x950e('0x5a')]['toLowerCase']())+_0x950e('0x5c')][_0x950e('0x4f')]);_0x38af45['query']=_[_0x950e('0x4e')](_0x103778[_0x950e('0x37')]);_0x38af45['filters']=_[_0x950e('0x39')](_0x38af45[_0x950e('0x3a')],_0x38af45[_0x950e('0x37')]);_0x1d5ea4['attributes']=_['intersection'](_0x38af45[_0x950e('0x3a')],qs[_0x950e('0x3b')](_0x103778[_0x950e('0x37')][_0x950e('0x3b')]));_0x1d5ea4['attributes']=_0x1d5ea4[_0x950e('0x3c')][_0x950e('0x3d')]?_0x1d5ea4[_0x950e('0x3c')]:_0x38af45[_0x950e('0x3a')];_0x1d5ea4[_0x950e('0x24')]=qs[_0x950e('0x24')](_0x103778[_0x950e('0x37')][_0x950e('0x24')]);_0x1d5ea4[_0x950e('0x23')]=qs[_0x950e('0x23')](_0x103778[_0x950e('0x37')][_0x950e('0x23')]);_0x1d5ea4[_0x950e('0x40')]=qs[_0x950e('0x41')](_0x103778[_0x950e('0x37')]['sort']);_0x1d5ea4[_0x950e('0x42')]=qs[_0x950e('0x38')](_[_0x950e('0x43')](_0x103778[_0x950e('0x37')],_0x38af45[_0x950e('0x38')]));_0x1d5ea4=_['merge']({},_0x1d5ea4,_0x103778[_0x950e('0x47')]);return _0x1d5880[_0x950e('0x2c')+_[_0x950e('0x5d')](_0x103778[_0x950e('0x37')][_0x950e('0x5a')][_0x950e('0x5e')]())+'Queues'](_0x1d5ea4);})[_0x950e('0x2a')](respondWithResult(_0x2235c6,null))[_0x950e('0x4c')](handleError(_0x2235c6,null));};exports[_0x950e('0x5f')]=function(_0x1815a6,_0x5151d0,_0x52d056){return db[_0x950e('0x34')]['findOne']({'where':{'id':_0x1815a6[_0x950e('0x4d')]['id']}})['then'](function(_0xc204df){if(_0xc204df){if(!_0x1815a6[_0x950e('0x51')][_0x950e('0x5a')]||!utils[_0x950e('0x60')](_0x1815a6[_0x950e('0x51')]['channel'])){throw new db[(_0x950e('0x61'))][(_0x950e('0x62'))](_0x950e('0x5b'));}return _0xc204df[_0x950e('0x63')+_[_0x950e('0x5d')](_0x1815a6[_0x950e('0x51')][_0x950e('0x5a')][_0x950e('0x5e')]())+_0x950e('0x64')](_0x1815a6['body'][_0x950e('0x65')]);}return null;})[_0x950e('0x2a')](handleEntityNotFound(_0x5151d0,null))[_0x950e('0x2a')](respondWithStatusCode(_0x5151d0,null))['catch'](handleError(_0x5151d0,null));};exports['removeQueues']=function(_0x5f0072,_0xdcadc7,_0x359e95){return db[_0x950e('0x34')][_0x950e('0x59')]({'where':{'id':_0x5f0072[_0x950e('0x4d')]['id']}})[_0x950e('0x2a')](function(_0x1f8537){if(_0x1f8537){if(!_0x5f0072['query'][_0x950e('0x5a')]||!utils['isValidChannel'](_0x5f0072[_0x950e('0x37')][_0x950e('0x5a')])){throw new db[(_0x950e('0x61'))][(_0x950e('0x62'))](_0x950e('0x5b'));}return _0x1f8537['remove'+_[_0x950e('0x5d')](_0x5f0072[_0x950e('0x37')][_0x950e('0x5a')]['toLowerCase']())+_0x950e('0x64')](_0x5f0072[_0x950e('0x37')][_0x950e('0x65')]);}return null;})[_0x950e('0x2a')](handleEntityNotFound(_0xdcadc7,null))['then'](respondWithStatusCode(_0xdcadc7,null))[_0x950e('0x4c')](handleError(_0xdcadc7,null));};exports[_0x950e('0x66')]=function(_0x4dc139,_0x1e269b,_0x1f4d21){return db['Team']['find']({'where':{'id':_0x4dc139['params']['id']}})[_0x950e('0x2a')](handleEntityNotFound(_0x1e269b,null))[_0x950e('0x2a')](function(_0x10f97d){if(_0x10f97d){var _0x446222=['Voice',_0x950e('0x67'),_0x950e('0x68'),_0x950e('0x69'),'Fax',_0x950e('0x6a'),_0x950e('0x6b')];return BPromise[_0x950e('0x6c')](_0x446222,function(_0x29df54){return _0x10f97d['get'+_0x29df54+'Queues']({'attributes':['id',_0x950e('0x31')]})['then'](function(_0x23c5f4){return BPromise['each'](_0x23c5f4,function(_0x15d127){return _0x15d127['addAgents'](_0x4dc139['body'][_0x950e('0x65')])[_0x950e('0x2a')](function(){if(_0x29df54==='Voice'){return db[_0x950e('0x6d')][_0x950e('0x4a')]({'where':{'id':_0x4dc139[_0x950e('0x51')][_0x950e('0x65')]},'attributes':['id',_0x950e('0x31'),_0x950e('0x6e'),'voicePause','interface'],'raw':!![]})[_0x950e('0x2a')](function(_0x257e74){return BPromise[_0x950e('0x6c')](_[_0x950e('0x46')](_0x257e74,{'online':0x1}),function(_0x56689d){return db['UserVoiceQueueRt']['upsert']({'membername':_0x56689d[_0x950e('0x31')],'UserId':_0x56689d['id'],'queue_name':_0x15d127[_0x950e('0x31')],'VoiceQueueId':_0x15d127['id'],'interface':_[_0x950e('0x6f')](_0x56689d['interface'])?util['format'](_0x950e('0x70'),_0x56689d[_0x950e('0x31')]):_0x56689d[_0x950e('0x71')],'paused':_0x56689d[_0x950e('0x72')]||![],'penalty':0x0});});});}});});})[_0x950e('0x2a')](function(){return _0x10f97d;});})[_0x950e('0x2a')](function(){return _0x10f97d;});}})['then'](function(_0x4bde33){if(_0x4bde33){return _0x4bde33['addAgents'](_0x4dc139[_0x950e('0x51')][_0x950e('0x65')],_[_0x950e('0x73')](_0x4dc139[_0x950e('0x51')],[_0x950e('0x65'),'id'])||{})[_0x950e('0x74')](function(_0x135cc6){for(var _0x276df6=0x0;_0x276df6<_0x4dc139[_0x950e('0x51')][_0x950e('0x65')][_0x950e('0x3d')];_0x276df6+=0x1){socket['emit'](_0x950e('0x75'),{'UserId':_0x4dc139['body'][_0x950e('0x65')][_0x276df6],'TeamId':_0x4dc139[_0x950e('0x4d')]['id']});}return _0x135cc6;});}})[_0x950e('0x2a')](respondWithResult(_0x1e269b,null))[_0x950e('0x4c')](handleError(_0x1e269b,null));};exports['removeAgents']=function(_0x1d37d8,_0x75bccd,_0x2a9c28){return db[_0x950e('0x34')][_0x950e('0x58')]({'where':{'id':_0x1d37d8[_0x950e('0x4d')]['id']}})[_0x950e('0x2a')](handleEntityNotFound(_0x75bccd,null))[_0x950e('0x2a')](function(_0x4b1324){if(_0x4b1324){return BPromise[_0x950e('0x6c')](['voice',_0x950e('0x76'),'mail','sms',_0x950e('0x77'),_0x950e('0x78'),'whatsapp'],function(_0x1d2178){return _0x4b1324[_0x950e('0x2c')+_[_0x950e('0x5d')](_0x1d2178)+'Queues']({'attributes':['id',_0x950e('0x31')]})[_0x950e('0x2a')](function(_0x1fcf49){return BPromise[_0x950e('0x6c')](_0x1fcf49,function(_0x371437){return _0x371437['removeAgents'](_0x1d37d8[_0x950e('0x37')][_0x950e('0x65')])['then'](function(){if(_0x1d2178===_0x950e('0x79')){return db[_0x950e('0x7a')]['destroy']({'where':{'VoiceQueueId':_0x371437['id'],'UserId':_0x1d37d8[_0x950e('0x37')][_0x950e('0x65')]}});}});});})[_0x950e('0x2a')](function(){return _0x4b1324;});})['then'](function(){return _0x4b1324;});}})[_0x950e('0x2a')](function(_0x24138f){if(_0x24138f){return _0x24138f['removeAgents'](_0x1d37d8[_0x950e('0x37')][_0x950e('0x65')])[_0x950e('0x2a')](function(){if(_['isArray'](_0x1d37d8[_0x950e('0x37')][_0x950e('0x65')])){for(var _0x1dca14=0x0;_0x1dca14<_0x1d37d8[_0x950e('0x37')][_0x950e('0x65')]['length'];_0x1dca14+=0x1){socket[_0x950e('0x7b')](_0x950e('0x7c'),{'UserId':Number(_0x1d37d8[_0x950e('0x37')][_0x950e('0x65')][_0x1dca14]),'TeamId':Number(_0x1d37d8[_0x950e('0x4d')]['id'])});}}else{socket['emit'](_0x950e('0x7c'),{'UserId':Number(_0x1d37d8[_0x950e('0x37')][_0x950e('0x65')]),'TeamId':Number(_0x1d37d8['params']['id'])});}});}})[_0x950e('0x2a')](respondWithStatusCode(_0x75bccd,null))['catch'](handleError(_0x75bccd,null));};exports['getAgents']=function(_0x3b0b83,_0x40ff92,_0x214b0e){var _0x59d5b4={};var _0x590d15={};var _0x392749;var _0x4a36e2;return db[_0x950e('0x34')][_0x950e('0x59')]({'where':{'id':_0x3b0b83[_0x950e('0x4d')]['id']}})[_0x950e('0x2a')](handleEntityNotFound(_0x40ff92,null))[_0x950e('0x2a')](function(_0x2b3ce4){if(_0x2b3ce4){_0x392749=_0x2b3ce4;_0x590d15['model']=_[_0x950e('0x4e')](db[_0x950e('0x6d')][_0x950e('0x4f')]);_0x590d15[_0x950e('0x37')]=_[_0x950e('0x4e')](_0x3b0b83['query']);_0x590d15[_0x950e('0x38')]=_['intersection'](_0x590d15[_0x950e('0x3a')],_0x590d15[_0x950e('0x37')]);_0x59d5b4[_0x950e('0x3c')]=_[_0x950e('0x39')](_0x590d15[_0x950e('0x3a')],qs['fields'](_0x3b0b83[_0x950e('0x37')][_0x950e('0x3b')]));_0x59d5b4[_0x950e('0x3c')]=_0x59d5b4['attributes'][_0x950e('0x3d')]?_0x59d5b4[_0x950e('0x3c')]:_0x590d15[_0x950e('0x3a')];_0x59d5b4[_0x950e('0x40')]=qs[_0x950e('0x41')](_0x3b0b83['query'][_0x950e('0x41')]);_0x59d5b4[_0x950e('0x42')]=qs[_0x950e('0x38')](_[_0x950e('0x43')](_0x3b0b83[_0x950e('0x37')],_0x590d15[_0x950e('0x38')]));if(_0x3b0b83[_0x950e('0x37')][_0x950e('0x46')]){_0x59d5b4[_0x950e('0x42')]=_['merge'](_0x59d5b4[_0x950e('0x42')],{'$or':_[_0x950e('0x36')](_0x59d5b4['attributes'],function(_0x14fe01){var _0x43cb97={};_0x43cb97[_0x14fe01]={'$like':'%'+_0x3b0b83[_0x950e('0x37')][_0x950e('0x46')]+'%'};return _0x43cb97;})});}_0x59d5b4=_[_0x950e('0x44')]({},_0x59d5b4,_0x3b0b83['options']);return _0x392749[_0x950e('0x7d')](_0x59d5b4);}})[_0x950e('0x2a')](function(_0x3f64f3){if(_0x3f64f3){_0x4a36e2=_0x3f64f3[_0x950e('0x3d')];if(!_0x3b0b83[_0x950e('0x37')][_0x950e('0x3e')](_0x950e('0x3f'))){_0x59d5b4[_0x950e('0x24')]=qs[_0x950e('0x24')](_0x3b0b83[_0x950e('0x37')][_0x950e('0x24')]);_0x59d5b4[_0x950e('0x23')]=qs[_0x950e('0x23')](_0x3b0b83['query']['offset']);}return _0x392749[_0x950e('0x7d')](_0x59d5b4);}})['then'](function(_0x3950ee){if(_0x3950ee){return _0x3950ee?{'count':_0x4a36e2,'rows':_0x3950ee}:null;}})[_0x950e('0x2a')](respondWithResult(_0x40ff92,null))['catch'](handleError(_0x40ff92,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 70ef6e2..62ed481 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 _0x27b3=['update','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x4d5399,_0x4e168d){var _0x1b5b9f=function(_0x415f95){while(--_0x415f95){_0x4d5399['push'](_0x4d5399['shift']());}};_0x1b5b9f(++_0x4e168d);}(_0x27b3,0x169));var _0x327b=function(_0x52dba4,_0x16054e){_0x52dba4=_0x52dba4-0x0;var _0x1ad308=_0x27b3[_0x52dba4];return _0x1ad308;};'use strict';var EventEmitter=require(_0x327b('0x0'));var Team=require(_0x327b('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x327b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x327b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3d81ee){return function(_0x330e45,_0x2b69ef,_0x2d0e6a){TeamEvents[_0x327b('0x4')](_0x3d81ee+':'+_0x330e45['id'],_0x330e45);TeamEvents['emit'](_0x3d81ee,_0x330e45);_0x2d0e6a(null);};}for(var e in events){if(events[_0x327b('0x5')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x327b('0x6')]=TeamEvents; \ No newline at end of file +var _0x5de5=['exports','Team','setMaxListeners','save','update','remove','emit'];(function(_0x4715d2,_0x3371b2){var _0x141811=function(_0x520bc6){while(--_0x520bc6){_0x4715d2['push'](_0x4715d2['shift']());}};_0x141811(++_0x3371b2);}(_0x5de5,0x6a));var _0x55de=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5de5[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0x55de('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0x55de('0x1')](0x0);var events={'afterCreate':_0x55de('0x2'),'afterUpdate':_0x55de('0x3'),'afterDestroy':_0x55de('0x4')};function emitEvent(_0x566cf4){return function(_0x597692,_0x36b646,_0x54ed99){TeamEvents['emit'](_0x566cf4+':'+_0x597692['id'],_0x597692);TeamEvents[_0x55de('0x5')](_0x566cf4,_0x597692);_0x54ed99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x55de('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 4e68f9a..7442969 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 _0x1042=['rimraf','../../config/environment','./team.attributes','exports','define','Team','teams','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x1042,0x93));var _0x2104=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1042[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2104('0x0'));var util=require('util');var logger=require(_0x2104('0x1'))(_0x2104('0x2'));var moment=require(_0x2104('0x3'));var BPromise=require(_0x2104('0x4'));var rp=require(_0x2104('0x5'));var fs=require('fs');var path=require(_0x2104('0x6'));var rimraf=require(_0x2104('0x7'));var config=require(_0x2104('0x8'));var attributes=require(_0x2104('0x9'));module[_0x2104('0xa')]=function(_0x3f3414,_0x22beb6){return _0x3f3414[_0x2104('0xb')](_0x2104('0xc'),attributes,{'tableName':_0x2104('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b29=['bluebird','request-promise','path','rimraf','../../config/environment','define','Team','teams','lodash','util','api'];(function(_0x23e5d9,_0xf3db15){var _0x9f9065=function(_0x5c87d0){while(--_0x5c87d0){_0x23e5d9['push'](_0x23e5d9['shift']());}};_0x9f9065(++_0xf3db15);}(_0x2b29,0x1e1));var _0x92b2=function(_0x5f0149,_0x67957d){_0x5f0149=_0x5f0149-0x0;var _0x42da19=_0x2b29[_0x5f0149];return _0x42da19;};'use strict';var _=require(_0x92b2('0x0'));var util=require(_0x92b2('0x1'));var logger=require('../../config/logger')(_0x92b2('0x2'));var moment=require('moment');var BPromise=require(_0x92b2('0x3'));var rp=require(_0x92b2('0x4'));var fs=require('fs');var path=require(_0x92b2('0x5'));var rimraf=require(_0x92b2('0x6'));var config=require(_0x92b2('0x7'));var attributes=require('./team.attributes');module['exports']=function(_0x55090e,_0x3e2930){return _0x55090e[_0x92b2('0x8')](_0x92b2('0x9'),attributes,{'tableName':_0x92b2('0xa'),'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 9863bed..1fffc47 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 _0x5ee4=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','defaults','redis','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5ee4,0x76));var _0x45ee=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x5ee4[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x45ee('0x0'));var util=require(_0x45ee('0x1'));var moment=require(_0x45ee('0x2'));var BPromise=require(_0x45ee('0x3'));var rs=require(_0x45ee('0x4'));var fs=require('fs');var Redis=require(_0x45ee('0x5'));var db=require(_0x45ee('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x45ee('0x7'));var config=require(_0x45ee('0x8'));var jayson=require(_0x45ee('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x45ee('0xa')](config[_0x45ee('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x45ee('0xb')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x33bf72,_0x579633,_0x3d3723){return new BPromise(function(_0x5c1956,_0x739297){return client[_0x45ee('0xc')](_0x33bf72,_0x3d3723)[_0x45ee('0xd')](function(_0x32e0e6){logger[_0x45ee('0xe')](_0x45ee('0xf'),_0x579633,_0x45ee('0x10'));logger[_0x45ee('0x11')](_0x45ee('0x12'),_0x579633,_0x45ee('0x10'),JSON['stringify'](_0x32e0e6));if(_0x32e0e6['error']){if(_0x32e0e6[_0x45ee('0x13')][_0x45ee('0x14')]===0x1f4){logger['error'](_0x45ee('0xf'),_0x579633,_0x32e0e6[_0x45ee('0x13')]['message']);return _0x739297(_0x32e0e6[_0x45ee('0x13')][_0x45ee('0x15')]);}logger[_0x45ee('0x13')](_0x45ee('0xf'),_0x579633,_0x32e0e6['error'][_0x45ee('0x15')]);return _0x5c1956(_0x32e0e6[_0x45ee('0x13')]['message']);}else{logger[_0x45ee('0xe')](_0x45ee('0xf'),_0x579633,_0x45ee('0x10'));_0x5c1956(_0x32e0e6['result'][_0x45ee('0x15')]);}})[_0x45ee('0x16')](function(_0x2fb88d){logger[_0x45ee('0x13')]('Team,\x20%s,\x20%s',_0x579633,_0x2fb88d);_0x739297(_0x2fb88d);});});} \ No newline at end of file +var _0x935e=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x935e,0x9a));var _0xe935=function(_0x47b4b3,_0x32efb9){_0x47b4b3=_0x47b4b3-0x0;var _0x463180=_0x935e[_0x47b4b3];return _0x463180;};'use strict';var _=require(_0xe935('0x0'));var util=require(_0xe935('0x1'));var moment=require(_0xe935('0x2'));var BPromise=require(_0xe935('0x3'));var rs=require(_0xe935('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe935('0x5'))['db'];var utils=require(_0xe935('0x6'));var logger=require(_0xe935('0x7'))(_0xe935('0x8'));var config=require(_0xe935('0x9'));var jayson=require(_0xe935('0xa'));var client=jayson[_0xe935('0xb')]['http']({'port':0x232a});config[_0xe935('0xc')]=_['defaults'](config[_0xe935('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./team.socket')[_0xe935('0xd')](socket);function respondWithRpcPromise(_0x596167,_0x3fc729,_0x4db099){return new BPromise(function(_0x11f3d5,_0x1a6011){return client[_0xe935('0xe')](_0x596167,_0x4db099)[_0xe935('0xf')](function(_0x2acd8c){logger[_0xe935('0x10')](_0xe935('0x11'),_0x3fc729,_0xe935('0x12'));logger[_0xe935('0x13')](_0xe935('0x14'),_0x3fc729,_0xe935('0x12'),JSON[_0xe935('0x15')](_0x2acd8c));if(_0x2acd8c[_0xe935('0x16')]){if(_0x2acd8c[_0xe935('0x16')]['code']===0x1f4){logger[_0xe935('0x16')](_0xe935('0x11'),_0x3fc729,_0x2acd8c[_0xe935('0x16')][_0xe935('0x17')]);return _0x1a6011(_0x2acd8c[_0xe935('0x16')][_0xe935('0x17')]);}logger[_0xe935('0x16')](_0xe935('0x11'),_0x3fc729,_0x2acd8c['error']['message']);return _0x11f3d5(_0x2acd8c['error'][_0xe935('0x17')]);}else{logger[_0xe935('0x10')](_0xe935('0x11'),_0x3fc729,_0xe935('0x12'));_0x11f3d5(_0x2acd8c[_0xe935('0x18')]['message']);}})[_0xe935('0x19')](function(_0x49dc41){logger['error'](_0xe935('0x11'),_0x3fc729,_0x49dc41);_0x1a6011(_0x49dc41);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 3a69bcf..598ce5f 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 _0xbe2c=['./team.events','save','update','emit','register','length','team:'];(function(_0xe043f3,_0x1a03ab){var _0x63deb2=function(_0x23841e){while(--_0x23841e){_0xe043f3['push'](_0xe043f3['shift']());}};_0x63deb2(++_0x1a03ab);}(_0xbe2c,0x18f));var _0xcbe2=function(_0x2e59db,_0x22cc59){_0x2e59db=_0x2e59db-0x0;var _0x73903e=_0xbe2c[_0x2e59db];return _0x73903e;};'use strict';var TeamEvents=require(_0xcbe2('0x0'));var events=[_0xcbe2('0x1'),'remove',_0xcbe2('0x2')];function createListener(_0x4d2b3b,_0x236599){return function(_0x438d55){_0x236599[_0xcbe2('0x3')](_0x4d2b3b,_0x438d55);};}function removeListener(_0x42c28d,_0x3f9f67){return function(){TeamEvents['removeListener'](_0x42c28d,_0x3f9f67);};}exports[_0xcbe2('0x4')]=function(_0x2f1e95){for(var _0x519925=0x0,_0x2c0389=events[_0xcbe2('0x5')];_0x519925<_0x2c0389;_0x519925++){var _0x1c28ab=events[_0x519925];var _0x294a61=createListener(_0xcbe2('0x6')+_0x1c28ab,_0x2f1e95);TeamEvents['on'](_0x1c28ab,_0x294a61);}}; \ No newline at end of file +var _0xf1c6=['removeListener','register','length','team:','./team.events','save','remove','update'];(function(_0x31aa0f,_0x42ef74){var _0x3a307b=function(_0x2cae11){while(--_0x2cae11){_0x31aa0f['push'](_0x31aa0f['shift']());}};_0x3a307b(++_0x42ef74);}(_0xf1c6,0xf4));var _0x6f1c=function(_0x31d1f1,_0xeec92){_0x31d1f1=_0x31d1f1-0x0;var _0x5ede69=_0xf1c6[_0x31d1f1];return _0x5ede69;};'use strict';var TeamEvents=require(_0x6f1c('0x0'));var events=[_0x6f1c('0x1'),_0x6f1c('0x2'),_0x6f1c('0x3')];function createListener(_0x381044,_0x17a05a){return function(_0x15b146){_0x17a05a['emit'](_0x381044,_0x15b146);};}function removeListener(_0x3747f8,_0x2c875e){return function(){TeamEvents[_0x6f1c('0x4')](_0x3747f8,_0x2c875e);};}exports[_0x6f1c('0x5')]=function(_0x4fd3fc){for(var _0x57bb67=0x0,_0x1a3460=events[_0x6f1c('0x6')];_0x57bb67<_0x1a3460;_0x57bb67++){var _0x3f7b30=events[_0x57bb67];var _0x2efcb5=createListener(_0x6f1c('0x7')+_0x3f7b30,_0x4fd3fc);TeamEvents['on'](_0x3f7b30,_0x2efcb5);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index d72b739..05aa138 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 _0x8a7f=['Router','exports','multer','path','connect-timeout','express'];(function(_0x560375,_0x164117){var _0xc9aa4f=function(_0x119136){while(--_0x119136){_0x560375['push'](_0x560375['shift']());}};_0xc9aa4f(++_0x164117);}(_0x8a7f,0x1b8));var _0xf8a7=function(_0xb714e8,_0x21bc18){_0xb714e8=_0xb714e8-0x0;var _0x5ceafe=_0x8a7f[_0xb714e8];return _0x5ceafe;};'use strict';var multer=require(_0xf8a7('0x0'));var util=require('util');var path=require(_0xf8a7('0x1'));var timeout=require(_0xf8a7('0x2'));var express=require(_0xf8a7('0x3'));var router=express[_0xf8a7('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xf8a7('0x5')]=router; \ No newline at end of file +var _0xafbc=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout','express','Router'];(function(_0x3de906,_0x5c33fa){var _0x2e1a48=function(_0x5373b4){while(--_0x5373b4){_0x3de906['push'](_0x3de906['shift']());}};_0x2e1a48(++_0x5c33fa);}(_0xafbc,0xa6));var _0xcafb=function(_0x2e6360,_0x320a4f){_0x2e6360=_0x2e6360-0x0;var _0x2b0b07=_0xafbc[_0x2e6360];return _0x2b0b07;};'use strict';var multer=require(_0xcafb('0x0'));var util=require('util');var path=require(_0xcafb('0x1'));var timeout=require(_0xcafb('0x2'));var express=require(_0xcafb('0x3'));var router=express[_0xcafb('0x4')]();var auth=require(_0xcafb('0x5'));var interaction=require(_0xcafb('0x6'));var config=require(_0xcafb('0x7'));module[_0xcafb('0x8')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 17fa1d0..bd06b6d 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x2d68e2,_0x2feae3){var _0x5c6b8f=function(_0x1adf96){while(--_0x1adf96){_0x2d68e2['push'](_0x2d68e2['shift']());}};_0x5c6b8f(++_0x2feae3);}(_0xe706,0xa3));var _0x6e70=function(_0x48d218,_0x38ae7b){_0x48d218=_0x48d218-0x0;var _0x5d86c7=_0xe706[_0x48d218];return _0x5d86c7;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x57b7f9,_0x45a8e4){var _0x2cc4fe=function(_0x5dcbdf){while(--_0x5dcbdf){_0x57b7f9['push'](_0x57b7f9['shift']());}};_0x2cc4fe(++_0x45a8e4);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 486054b..2958e4e 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 _0x5aa7=['rimraf','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1f0099,_0x33153d){var _0xfb9b16=function(_0x12a8b1){while(--_0x12a8b1){_0x1f0099['push'](_0x1f0099['shift']());}};_0xfb9b16(++_0x33153d);}(_0x5aa7,0x130));var _0x75aa=function(_0x37d1bb,_0x45bbbd){_0x37d1bb=_0x37d1bb-0x0;var _0x5c8f34=_0x5aa7[_0x37d1bb];return _0x5c8f34;};'use strict';var _=require(_0x75aa('0x0'));var util=require(_0x75aa('0x1'));var logger=require(_0x75aa('0x2'))(_0x75aa('0x3'));var moment=require(_0x75aa('0x4'));var BPromise=require(_0x75aa('0x5'));var rp=require(_0x75aa('0x6'));var fs=require('fs');var path=require(_0x75aa('0x7'));var rimraf=require(_0x75aa('0x8'));var config=require('../../config/environment');var attributes=require(_0x75aa('0x9'));module['exports']=function(_0x58398d,_0x1f5c31){return _0x58398d[_0x75aa('0xa')](_0x75aa('0xb'),attributes,{'tableName':_0x75aa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95c4=['./teamVoiceQueue.attributes','exports','TeamVoiceQueue','team_has_voice_queues','lodash','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x95c4,0x86));var _0x495c=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x95c4[_0x344a3f];return _0x264712;};'use strict';var _=require(_0x495c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x495c('0x1'));var BPromise=require(_0x495c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x495c('0x3'));var rimraf=require(_0x495c('0x4'));var config=require(_0x495c('0x5'));var attributes=require(_0x495c('0x6'));module[_0x495c('0x7')]=function(_0x4424c7,_0x16ecde){return _0x4424c7['define'](_0x495c('0x8'),attributes,{'tableName':_0x495c('0x9'),'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 26127f3..3e84030 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 _0xe7d4=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash'];(function(_0x595df8,_0x341318){var _0x598c99=function(_0x12dec7){while(--_0x12dec7){_0x595df8['push'](_0x595df8['shift']());}};_0x598c99(++_0x341318);}(_0xe7d4,0xc5));var _0x4e7d=function(_0x38b0eb,_0x36a802){_0x38b0eb=_0x38b0eb-0x0;var _0x3f46c2=_0xe7d4[_0x38b0eb];return _0x3f46c2;};'use strict';var _=require(_0x4e7d('0x0'));var util=require(_0x4e7d('0x1'));var moment=require(_0x4e7d('0x2'));var BPromise=require('bluebird');var rs=require(_0x4e7d('0x3'));var fs=require('fs');var Redis=require(_0x4e7d('0x4'));var db=require(_0x4e7d('0x5'))['db'];var utils=require(_0x4e7d('0x6'));var logger=require(_0x4e7d('0x7'))('rpc');var config=require(_0x4e7d('0x8'));var jayson=require(_0x4e7d('0x9'));var client=jayson[_0x4e7d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a5f94,_0x4961fc,_0x415564){return new BPromise(function(_0x4adf85,_0x240839){return client[_0x4e7d('0xb')](_0x1a5f94,_0x415564)[_0x4e7d('0xc')](function(_0x17a9a9){logger[_0x4e7d('0xd')](_0x4e7d('0xe'),_0x4961fc,'request\x20sent');logger['debug'](_0x4e7d('0xf'),_0x4961fc,_0x4e7d('0x10'),JSON['stringify'](_0x17a9a9));if(_0x17a9a9[_0x4e7d('0x11')]){if(_0x17a9a9['error'][_0x4e7d('0x12')]===0x1f4){logger[_0x4e7d('0x11')](_0x4e7d('0xe'),_0x4961fc,_0x17a9a9['error'][_0x4e7d('0x13')]);return _0x240839(_0x17a9a9['error'][_0x4e7d('0x13')]);}logger[_0x4e7d('0x11')](_0x4e7d('0xe'),_0x4961fc,_0x17a9a9[_0x4e7d('0x11')][_0x4e7d('0x13')]);return _0x4adf85(_0x17a9a9[_0x4e7d('0x11')]['message']);}else{logger[_0x4e7d('0xd')](_0x4e7d('0xe'),_0x4961fc,'request\x20sent');_0x4adf85(_0x17a9a9[_0x4e7d('0x14')]['message']);}})[_0x4e7d('0x15')](function(_0x18dd11){logger['error'](_0x4e7d('0xe'),_0x4961fc,_0x18dd11);_0x240839(_0x18dd11);});});} \ No newline at end of file +var _0x6734=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x5bb5ab,_0x4ae6ee){var _0x20cd05=function(_0xeb61f1){while(--_0xeb61f1){_0x5bb5ab['push'](_0x5bb5ab['shift']());}};_0x20cd05(++_0x4ae6ee);}(_0x6734,0x86));var _0x4673=function(_0x19ef2b,_0x354f66){_0x19ef2b=_0x19ef2b-0x0;var _0x4df537=_0x6734[_0x19ef2b];return _0x4df537;};'use strict';var _=require(_0x4673('0x0'));var util=require(_0x4673('0x1'));var moment=require(_0x4673('0x2'));var BPromise=require(_0x4673('0x3'));var rs=require(_0x4673('0x4'));var fs=require('fs');var Redis=require(_0x4673('0x5'));var db=require(_0x4673('0x6'))['db'];var utils=require(_0x4673('0x7'));var logger=require(_0x4673('0x8'))(_0x4673('0x9'));var config=require('../../config/environment');var jayson=require(_0x4673('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31ead4,_0x16f55,_0x34d4ef){return new BPromise(function(_0xdf9f7e,_0x41e2a3){return client['request'](_0x31ead4,_0x34d4ef)[_0x4673('0xb')](function(_0xd69a16){logger[_0x4673('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x16f55,_0x4673('0xd'));logger[_0x4673('0xe')](_0x4673('0xf'),_0x16f55,'request\x20sent',JSON[_0x4673('0x10')](_0xd69a16));if(_0xd69a16[_0x4673('0x11')]){if(_0xd69a16[_0x4673('0x11')][_0x4673('0x12')]===0x1f4){logger[_0x4673('0x11')](_0x4673('0x13'),_0x16f55,_0xd69a16[_0x4673('0x11')]['message']);return _0x41e2a3(_0xd69a16[_0x4673('0x11')][_0x4673('0x14')]);}logger[_0x4673('0x11')](_0x4673('0x13'),_0x16f55,_0xd69a16[_0x4673('0x11')][_0x4673('0x14')]);return _0xdf9f7e(_0xd69a16[_0x4673('0x11')][_0x4673('0x14')]);}else{logger[_0x4673('0xc')](_0x4673('0x13'),_0x16f55,_0x4673('0xd'));_0xdf9f7e(_0xd69a16[_0x4673('0x15')][_0x4673('0x14')]);}})[_0x4673('0x16')](function(_0x23bba6){logger[_0x4673('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x16f55,_0x23bba6);_0x41e2a3(_0x23bba6);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 3a2d58a..5106d09 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 _0x9569=['post','create','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','./template.controller','get','isAuthenticated','index','/:id'];(function(_0x4dc3c1,_0x20275b){var _0x3eb9de=function(_0x55372c){while(--_0x55372c){_0x4dc3c1['push'](_0x4dc3c1['shift']());}};_0x3eb9de(++_0x20275b);}(_0x9569,0x66));var _0x9956=function(_0x166a66,_0x84e2a9){_0x166a66=_0x166a66-0x0;var _0x3b0485=_0x9569[_0x166a66];return _0x3b0485;};'use strict';var multer=require('multer');var util=require(_0x9956('0x0'));var path=require(_0x9956('0x1'));var timeout=require(_0x9956('0x2'));var express=require(_0x9956('0x3'));var router=express['Router']();var auth=require(_0x9956('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9956('0x5'));router[_0x9956('0x6')]('/',auth[_0x9956('0x7')](),controller[_0x9956('0x8')]);router[_0x9956('0x6')](_0x9956('0x9'),auth[_0x9956('0x7')](),controller['show']);router[_0x9956('0xa')]('/',auth['isAuthenticated'](),controller[_0x9956('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9956('0xc')](_0x9956('0x9'),auth['isAuthenticated'](),controller[_0x9956('0xd')]);module['exports']=router; \ No newline at end of file +var _0x9771=['delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0x9771,0x1e3));var _0x1977=function(_0x81ad07,_0x4f570e){_0x81ad07=_0x81ad07-0x0;var _0x201b21=_0x9771[_0x81ad07];return _0x201b21;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1977('0x0'));var timeout=require(_0x1977('0x1'));var express=require(_0x1977('0x2'));var router=express['Router']();var auth=require(_0x1977('0x3'));var interaction=require(_0x1977('0x4'));var config=require(_0x1977('0x5'));var controller=require('./template.controller');router[_0x1977('0x6')]('/',auth[_0x1977('0x7')](),controller[_0x1977('0x8')]);router[_0x1977('0x6')](_0x1977('0x9'),auth[_0x1977('0x7')](),controller['show']);router[_0x1977('0xa')]('/',auth['isAuthenticated'](),controller[_0x1977('0xb')]);router[_0x1977('0xc')](_0x1977('0x9'),auth[_0x1977('0x7')](),controller['update']);router[_0x1977('0xd')](_0x1977('0x9'),auth[_0x1977('0x7')](),controller[_0x1977('0xe')]);module[_0x1977('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 84aa627..63ce96e 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 _0xd112=['STRING','TEXT','exports'];(function(_0x524879,_0x2f9873){var _0x2fed57=function(_0x10cd02){while(--_0x10cd02){_0x524879['push'](_0x524879['shift']());}};_0x2fed57(++_0x2f9873);}(_0xd112,0x10a));var _0x2d11=function(_0x11c0cb,_0x4476aa){_0x11c0cb=_0x11c0cb-0x0;var _0x3dbf20=_0xd112[_0x11c0cb];return _0x3dbf20;};'use strict';var Sequelize=require('sequelize');module[_0x2d11('0x0')]={'name':{'type':Sequelize[_0x2d11('0x1')]},'description':{'type':Sequelize[_0x2d11('0x1')]},'html':{'type':Sequelize[_0x2d11('0x2')]}}; \ No newline at end of file +var _0x8eb0=['STRING'];(function(_0x4f3da5,_0x442069){var _0x259a2d=function(_0x15ecc0){while(--_0x15ecc0){_0x4f3da5['push'](_0x4f3da5['shift']());}};_0x259a2d(++_0x442069);}(_0x8eb0,0x96));var _0x08eb=function(_0x2cab94,_0x5abbc2){_0x2cab94=_0x2cab94-0x0;var _0x4222e7=_0x8eb0[_0x2cab94];return _0x4222e7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x08eb('0x0')]},'description':{'type':Sequelize[_0x08eb('0x0')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 175c401..f2d1c80 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 _0x326f=['UserProfileResource','error','stack','name','index','map','Template','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','intersection','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','then','destroy','get','Templates'];(function(_0x156645,_0x1f0a44){var _0x1f76f6=function(_0x46198a){while(--_0x46198a){_0x156645['push'](_0x156645['shift']());}};_0x1f76f6(++_0x1f0a44);}(_0x326f,0xd1));var _0xf326=function(_0x8383f0,_0x3286e7){_0x8383f0=_0x8383f0-0x0;var _0x499565=_0x326f[_0x8383f0];return _0x499565;};'use strict';var pdf=require(_0xf326('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf326('0x1'));var jsonpatch=require(_0xf326('0x2'));var rp=require(_0xf326('0x3'));var moment=require(_0xf326('0x4'));var BPromise=require(_0xf326('0x5'));var Mustache=require(_0xf326('0x6'));var util=require(_0xf326('0x7'));var path=require(_0xf326('0x8'));var sox=require(_0xf326('0x9'));var csv=require(_0xf326('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3162f9,_0x9ed463){_0x9ed463=_0x9ed463||0xcc;return function(_0x4b3966){if(_0x4b3966){return _0x3162f9[_0xf326('0x17')](_0x9ed463);}return _0x3162f9[_0xf326('0x18')](_0x9ed463)[_0xf326('0x19')]();};}function respondWithResult(_0x17a098,_0x5c8483){_0x5c8483=_0x5c8483||0xc8;return function(_0x45c1b6){if(_0x45c1b6){return _0x17a098['status'](_0x5c8483)['json'](_0x45c1b6);}};}function respondWithFilteredResult(_0xdf21d9,_0x11f6d2){return function(_0x1f2e5a){if(_0x1f2e5a){var _0xa63d1a=_0x1f2e5a[_0xf326('0x1a')],_0x292f4b=_0x11f6d2['offset'],_0x287a2a=_0x11f6d2[_0xf326('0x1b')]+_0x11f6d2[_0xf326('0x1c')],_0x34128e;if(_0x287a2a>=_0xa63d1a){_0x287a2a=_0xa63d1a;_0x34128e=0xc8;}else{_0x34128e=0xce;}_0xdf21d9[_0xf326('0x18')](_0x34128e);return _0xdf21d9[_0xf326('0x1d')](_0xf326('0x1e'),_0x292f4b+'-'+_0x287a2a+'/'+_0xa63d1a)[_0xf326('0x1f')](_0x1f2e5a);}return null;};}function patchUpdates(_0x4d3d41){return function(_0x4a5b6c){try{jsonpatch['apply'](_0x4a5b6c,_0x4d3d41,!![]);}catch(_0x16e605){return BPromise[_0xf326('0x20')](_0x16e605);}return _0x4a5b6c['save']();};}function saveUpdates(_0x4cabce,_0x128c68){return function(_0x4dfa76){if(_0x4dfa76){return _0x4dfa76['update'](_0x4cabce)[_0xf326('0x21')](function(_0x18ead3){return _0x18ead3;});}return null;};}function removeEntity(_0x549b46,_0x5aa184){return function(_0x19b8ba){if(_0x19b8ba){return _0x19b8ba[_0xf326('0x22')]()['then'](function(){var _0x337ed5=_0x19b8ba[_0xf326('0x23')]({'plain':!![]});var _0x43c53e=_0xf326('0x24');return db[_0xf326('0x25')][_0xf326('0x22')]({'where':{'type':_0x43c53e,'resourceId':_0x337ed5['id']}})['then'](function(){return _0x19b8ba;});})['then'](function(){_0x549b46['status'](0xcc)[_0xf326('0x19')]();});}};}function handleEntityNotFound(_0x1a2c4e,_0x2cd45a){return function(_0x1ff2b5){if(!_0x1ff2b5){_0x1a2c4e[_0xf326('0x17')](0x194);}return _0x1ff2b5;};}function handleError(_0x410237,_0x5217d4){_0x5217d4=_0x5217d4||0x1f4;return function(_0x201d28){logger[_0xf326('0x26')](_0x201d28[_0xf326('0x27')]);if(_0x201d28['name']){delete _0x201d28[_0xf326('0x28')];}_0x410237['status'](_0x5217d4)['send'](_0x201d28);};}exports[_0xf326('0x29')]=function(_0x1ae23a,_0x2fa28e){var _0x5dbe63={},_0xc115d9={},_0x292500={'count':0x0,'rows':[]};var _0x55790d=_[_0xf326('0x2a')](db[_0xf326('0x2b')][_0xf326('0x2c')],function(_0x18d110){return{'name':_0x18d110[_0xf326('0x2d')],'type':_0x18d110[_0xf326('0x2e')][_0xf326('0x2f')]};});_0xc115d9[_0xf326('0x30')]=_[_0xf326('0x2a')](_0x55790d,_0xf326('0x28'));_0xc115d9['query']=_[_0xf326('0x31')](_0x1ae23a[_0xf326('0x32')]);_0xc115d9[_0xf326('0x33')]=_['intersection'](_0xc115d9[_0xf326('0x30')],_0xc115d9[_0xf326('0x32')]);_0x5dbe63[_0xf326('0x34')]=_['intersection'](_0xc115d9['model'],qs[_0xf326('0x35')](_0x1ae23a[_0xf326('0x32')][_0xf326('0x35')]));_0x5dbe63[_0xf326('0x34')]=_0x5dbe63[_0xf326('0x34')][_0xf326('0x36')]?_0x5dbe63[_0xf326('0x34')]:_0xc115d9[_0xf326('0x30')];if(!_0x1ae23a['query'][_0xf326('0x37')](_0xf326('0x38'))){_0x5dbe63['limit']=qs[_0xf326('0x1c')](_0x1ae23a['query'][_0xf326('0x1c')]);_0x5dbe63['offset']=qs['offset'](_0x1ae23a[_0xf326('0x32')]['offset']);}_0x5dbe63[_0xf326('0x39')]=qs['sort'](_0x1ae23a[_0xf326('0x32')][_0xf326('0x3a')]);_0x5dbe63[_0xf326('0x3b')]=qs['filters'](_[_0xf326('0x3c')](_0x1ae23a[_0xf326('0x32')],_0xc115d9['filters']),_0x55790d);if(_0x1ae23a[_0xf326('0x32')][_0xf326('0x3d')]){_0x5dbe63[_0xf326('0x3b')]=_[_0xf326('0x3e')](_0x5dbe63['where'],{'$or':_[_0xf326('0x2a')](_0x55790d,function(_0xb1ef35){if(_0xb1ef35[_0xf326('0x2e')]!==_0xf326('0x3f')){var _0x1d88ed={};_0x1d88ed[_0xb1ef35['name']]={'$like':'%'+_0x1ae23a[_0xf326('0x32')][_0xf326('0x3d')]+'%'};return _0x1d88ed;}})});}_0x5dbe63=_['merge']({},_0x5dbe63,_0x1ae23a['options']);var _0x40564e={'where':_0x5dbe63['where']};return db['Template'][_0xf326('0x1a')](_0x40564e)['then'](function(_0x3e1e8c){_0x292500[_0xf326('0x1a')]=_0x3e1e8c;if(_0x1ae23a[_0xf326('0x32')][_0xf326('0x40')]){_0x5dbe63['include']=[{'all':!![]}];}return db[_0xf326('0x2b')][_0xf326('0x41')](_0x5dbe63);})[_0xf326('0x21')](function(_0x365627){_0x292500[_0xf326('0x42')]=_0x365627;return _0x292500;})[_0xf326('0x21')](respondWithFilteredResult(_0x2fa28e,_0x5dbe63))[_0xf326('0x43')](handleError(_0x2fa28e,null));};exports[_0xf326('0x44')]=function(_0x31283b,_0x1227d3){var _0x361776={'raw':!![],'where':{'id':_0x31283b['params']['id']}},_0x2bab13={};_0x2bab13[_0xf326('0x30')]=_[_0xf326('0x31')](db[_0xf326('0x2b')][_0xf326('0x2c')]);_0x2bab13[_0xf326('0x32')]=_[_0xf326('0x31')](_0x31283b['query']);_0x2bab13[_0xf326('0x33')]=_[_0xf326('0x45')](_0x2bab13['model'],_0x2bab13[_0xf326('0x32')]);_0x361776[_0xf326('0x34')]=_[_0xf326('0x45')](_0x2bab13[_0xf326('0x30')],qs[_0xf326('0x35')](_0x31283b['query']['fields']));_0x361776[_0xf326('0x34')]=_0x361776[_0xf326('0x34')]['length']?_0x361776['attributes']:_0x2bab13[_0xf326('0x30')];if(_0x31283b[_0xf326('0x32')][_0xf326('0x40')]){_0x361776['include']=[{'all':!![]}];}_0x361776=_[_0xf326('0x3e')]({},_0x361776,_0x31283b[_0xf326('0x46')]);return db[_0xf326('0x2b')][_0xf326('0x47')](_0x361776)[_0xf326('0x21')](handleEntityNotFound(_0x1227d3,null))[_0xf326('0x21')](respondWithResult(_0x1227d3,null))[_0xf326('0x43')](handleError(_0x1227d3,null));};exports[_0xf326('0x48')]=function(_0x3df9a8,_0x27ced1){return db[_0xf326('0x2b')][_0xf326('0x48')](_0x3df9a8[_0xf326('0x49')],{})[_0xf326('0x21')](function(_0xeac1a1){var _0x59f9a7=_0x3df9a8[_0xf326('0x4a')][_0xf326('0x23')]({'plain':!![]});if(!_0x59f9a7)throw new Error(_0xf326('0x4b'));if(_0x59f9a7[_0xf326('0x4c')]==='user'){var _0x10f437=_0xeac1a1[_0xf326('0x23')]({'plain':!![]});var _0xca88e=_0xf326('0x24');return db['UserProfileSection'][_0xf326('0x47')]({'where':{'name':_0xca88e,'userProfileId':_0x59f9a7[_0xf326('0x4d')]},'raw':!![]})[_0xf326('0x21')](function(_0x451ac7){if(_0x451ac7&&_0x451ac7[_0xf326('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x10f437[_0xf326('0x28')],'resourceId':_0x10f437['id'],'type':_0x451ac7[_0xf326('0x28')],'sectionId':_0x451ac7['id']},{})[_0xf326('0x21')](function(){return _0xeac1a1;});}else{return _0xeac1a1;}})['catch'](function(_0x102fba){logger[_0xf326('0x26')](_0xf326('0x4f'),_0x102fba);throw _0x102fba;});}return _0xeac1a1;})['then'](respondWithResult(_0x27ced1,0xc9))['catch'](handleError(_0x27ced1,null));};exports[_0xf326('0x50')]=function(_0x5b4832,_0x1cf58f){if(_0x5b4832['body']['id']){delete _0x5b4832[_0xf326('0x49')]['id'];}return db[_0xf326('0x2b')][_0xf326('0x47')]({'where':{'id':_0x5b4832[_0xf326('0x51')]['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x1cf58f,null))[_0xf326('0x21')](saveUpdates(_0x5b4832[_0xf326('0x49')],null))['then'](respondWithResult(_0x1cf58f,null))[_0xf326('0x43')](handleError(_0x1cf58f,null));};exports[_0xf326('0x22')]=function(_0x424d24,_0x4b0d8e){return db[_0xf326('0x2b')][_0xf326('0x47')]({'where':{'id':_0x424d24[_0xf326('0x51')]['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x4b0d8e,null))[_0xf326('0x21')](removeEntity(_0x4b0d8e,null))['catch'](handleError(_0x4b0d8e,null));}; \ No newline at end of file +var _0xe14b=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','get','Templates','then','error','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','fields','length','includeAll','find','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','params','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x61286b,_0x4b20e3){var _0x2a3b3d=function(_0x4fd856){while(--_0x4fd856){_0x61286b['push'](_0x61286b['shift']());}};_0x2a3b3d(++_0x4b20e3);}(_0xe14b,0x93));var _0xbe14=function(_0x35b57d,_0x3fc6ac){_0x35b57d=_0x35b57d-0x0;var _0x3c164c=_0xe14b[_0x35b57d];return _0x3c164c;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=_0xf4ac9[_0xbe14('0x19')],_0x4e8f34=_0x3dc4a9[_0xbe14('0x1a')],_0x21c789=_0x3dc4a9[_0xbe14('0x1a')]+_0x3dc4a9[_0xbe14('0x1b')],_0xe9c3ec;if(_0x21c789>=_0x37ce4e){_0x21c789=_0x37ce4e;_0xe9c3ec=0xc8;}else{_0xe9c3ec=0xce;}_0x3f58f5[_0xbe14('0x17')](_0xe9c3ec);return _0x3f58f5['set'](_0xbe14('0x1c'),_0x4e8f34+'-'+_0x21c789+'/'+_0x37ce4e)[_0xbe14('0x1d')](_0xf4ac9);}return null;};}function patchUpdates(_0x329588){return function(_0x433459){try{jsonpatch[_0xbe14('0x1e')](_0x433459,_0x329588,!![]);}catch(_0x37e4c1){return BPromise['reject'](_0x37e4c1);}return _0x433459[_0xbe14('0x1f')]();};}function saveUpdates(_0x4a1bbd,_0x417c8d){return function(_0xc12977){if(_0xc12977){return _0xc12977[_0xbe14('0x20')](_0x4a1bbd)['then'](function(_0xe60f42){return _0xe60f42;});}return null;};}function removeEntity(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')]()['then'](function(){var _0x274018=_0x56e80c[_0xbe14('0x22')]({'plain':!![]});var _0x505dbd=_0xbe14('0x23');return db['UserProfileResource'][_0xbe14('0x21')]({'where':{'type':_0x505dbd,'resourceId':_0x274018['id']}})['then'](function(){return _0x56e80c;});})[_0xbe14('0x24')](function(){_0x56d845[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x39cc81,_0x15ef02){return function(_0x2703f5){if(!_0x2703f5){_0x39cc81['sendStatus'](0x194);}return _0x2703f5;};}function handleError(_0x1822e0,_0x1ba46a){_0x1ba46a=_0x1ba46a||0x1f4;return function(_0x391556){logger[_0xbe14('0x25')](_0x391556['stack']);if(_0x391556[_0xbe14('0x26')]){delete _0x391556[_0xbe14('0x26')];}_0x1822e0['status'](_0x1ba46a)[_0xbe14('0x27')](_0x391556);};}exports[_0xbe14('0x28')]=function(_0x1c7cc7,_0x19252f){var _0x34d648={},_0x36d4b2={},_0x31a664={'count':0x0,'rows':[]};var _0x2b05cb=_[_0xbe14('0x29')](db[_0xbe14('0x2a')][_0xbe14('0x2b')],function(_0x3bf43c){return{'name':_0x3bf43c[_0xbe14('0x2c')],'type':_0x3bf43c[_0xbe14('0x2d')][_0xbe14('0x2e')]};});_0x36d4b2[_0xbe14('0x2f')]=_[_0xbe14('0x29')](_0x2b05cb,_0xbe14('0x26'));_0x36d4b2[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x1c7cc7['query']);_0x36d4b2[_0xbe14('0x32')]=_['intersection'](_0x36d4b2['model'],_0x36d4b2[_0xbe14('0x30')]);_0x34d648['attributes']=_[_0xbe14('0x33')](_0x36d4b2[_0xbe14('0x2f')],qs['fields'](_0x1c7cc7['query']['fields']));_0x34d648[_0xbe14('0x34')]=_0x34d648[_0xbe14('0x34')]['length']?_0x34d648[_0xbe14('0x34')]:_0x36d4b2[_0xbe14('0x2f')];if(!_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x34d648['limit']=qs['limit'](_0x1c7cc7[_0xbe14('0x30')]['limit']);_0x34d648['offset']=qs['offset'](_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x1a')]);}_0x34d648[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x38')]);_0x34d648[_0xbe14('0x39')]=qs[_0xbe14('0x32')](_[_0xbe14('0x3a')](_0x1c7cc7[_0xbe14('0x30')],_0x36d4b2[_0xbe14('0x32')]),_0x2b05cb);if(_0x1c7cc7[_0xbe14('0x30')]['filter']){_0x34d648['where']=_[_0xbe14('0x3b')](_0x34d648[_0xbe14('0x39')],{'$or':_[_0xbe14('0x29')](_0x2b05cb,function(_0x520e09){if(_0x520e09[_0xbe14('0x2d')]!==_0xbe14('0x3c')){var _0xeda70e={};_0xeda70e[_0x520e09[_0xbe14('0x26')]]={'$like':'%'+_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x3d')]+'%'};return _0xeda70e;}})});}_0x34d648=_[_0xbe14('0x3b')]({},_0x34d648,_0x1c7cc7[_0xbe14('0x3e')]);var _0x1b2608={'where':_0x34d648['where']};return db[_0xbe14('0x2a')][_0xbe14('0x19')](_0x1b2608)[_0xbe14('0x24')](function(_0x1b3118){_0x31a664[_0xbe14('0x19')]=_0x1b3118;if(_0x1c7cc7[_0xbe14('0x30')]['includeAll']){_0x34d648[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x2a')][_0xbe14('0x40')](_0x34d648);})[_0xbe14('0x24')](function(_0x5cf713){_0x31a664['rows']=_0x5cf713;return _0x31a664;})[_0xbe14('0x24')](respondWithFilteredResult(_0x19252f,_0x34d648))[_0xbe14('0x41')](handleError(_0x19252f,null));};exports[_0xbe14('0x42')]=function(_0x51c859,_0x5d5318){var _0x6b6aa8={'raw':!![],'where':{'id':_0x51c859['params']['id']}},_0x59ae4d={};_0x59ae4d[_0xbe14('0x2f')]=_[_0xbe14('0x31')](db[_0xbe14('0x2a')]['rawAttributes']);_0x59ae4d['query']=_['keys'](_0x51c859[_0xbe14('0x30')]);_0x59ae4d[_0xbe14('0x32')]=_[_0xbe14('0x33')](_0x59ae4d['model'],_0x59ae4d[_0xbe14('0x30')]);_0x6b6aa8[_0xbe14('0x34')]=_[_0xbe14('0x33')](_0x59ae4d[_0xbe14('0x2f')],qs['fields'](_0x51c859['query'][_0xbe14('0x43')]));_0x6b6aa8[_0xbe14('0x34')]=_0x6b6aa8[_0xbe14('0x34')][_0xbe14('0x44')]?_0x6b6aa8[_0xbe14('0x34')]:_0x59ae4d['model'];if(_0x51c859['query'][_0xbe14('0x45')]){_0x6b6aa8[_0xbe14('0x3f')]=[{'all':!![]}];}_0x6b6aa8=_[_0xbe14('0x3b')]({},_0x6b6aa8,_0x51c859[_0xbe14('0x3e')]);return db['Template'][_0xbe14('0x46')](_0x6b6aa8)[_0xbe14('0x24')](handleEntityNotFound(_0x5d5318,null))['then'](respondWithResult(_0x5d5318,null))[_0xbe14('0x41')](handleError(_0x5d5318,null));};exports[_0xbe14('0x47')]=function(_0x2d6ee8,_0x36c20c){return db['Template']['create'](_0x2d6ee8[_0xbe14('0x48')],{})[_0xbe14('0x24')](function(_0x4a1a37){var _0x5acf90=_0x2d6ee8[_0xbe14('0x49')][_0xbe14('0x22')]({'plain':!![]});if(!_0x5acf90)throw new Error(_0xbe14('0x4a'));if(_0x5acf90[_0xbe14('0x4b')]===_0xbe14('0x49')){var _0xd04fd5=_0x4a1a37[_0xbe14('0x22')]({'plain':!![]});var _0x5a4068=_0xbe14('0x23');return db[_0xbe14('0x4c')][_0xbe14('0x46')]({'where':{'name':_0x5a4068,'userProfileId':_0x5acf90[_0xbe14('0x4d')]},'raw':!![]})[_0xbe14('0x24')](function(_0x494c32){if(_0x494c32&&_0x494c32[_0xbe14('0x4e')]===0x0){return db[_0xbe14('0x4f')][_0xbe14('0x47')]({'name':_0xd04fd5[_0xbe14('0x26')],'resourceId':_0xd04fd5['id'],'type':_0x494c32[_0xbe14('0x26')],'sectionId':_0x494c32['id']},{})[_0xbe14('0x24')](function(){return _0x4a1a37;});}else{return _0x4a1a37;}})['catch'](function(_0x5aeea9){logger[_0xbe14('0x25')](_0xbe14('0x50'),_0x5aeea9);throw _0x5aeea9;});}return _0x4a1a37;})[_0xbe14('0x24')](respondWithResult(_0x36c20c,0xc9))['catch'](handleError(_0x36c20c,null));};exports['update']=function(_0x44fe0d,_0x134878){if(_0x44fe0d['body']['id']){delete _0x44fe0d[_0xbe14('0x48')]['id'];}return db[_0xbe14('0x2a')]['find']({'where':{'id':_0x44fe0d[_0xbe14('0x51')]['id']}})['then'](handleEntityNotFound(_0x134878,null))[_0xbe14('0x24')](saveUpdates(_0x44fe0d[_0xbe14('0x48')],null))[_0xbe14('0x24')](respondWithResult(_0x134878,null))['catch'](handleError(_0x134878,null));};exports[_0xbe14('0x21')]=function(_0x404212,_0x5dc78a){return db[_0xbe14('0x2a')][_0xbe14('0x46')]({'where':{'id':_0x404212[_0xbe14('0x51')]['id']}})[_0xbe14('0x24')](handleEntityNotFound(_0x5dc78a,null))[_0xbe14('0x24')](removeEntity(_0x5dc78a,null))['catch'](handleError(_0x5dc78a,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index ca6c175..f6491ba 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 _0x609d=['../../config/logger','moment','bluebird','path','../../config/environment','exports','Template','lodash'];(function(_0x3dc6e0,_0x48defd){var _0xc9be48=function(_0x2ae4b2){while(--_0x2ae4b2){_0x3dc6e0['push'](_0x3dc6e0['shift']());}};_0xc9be48(++_0x48defd);}(_0x609d,0xf7));var _0xd609=function(_0xc8ffc4,_0x2cea71){_0xc8ffc4=_0xc8ffc4-0x0;var _0x48e8e6=_0x609d[_0xc8ffc4];return _0x48e8e6;};'use strict';var _=require(_0xd609('0x0'));var util=require('util');var logger=require(_0xd609('0x1'))('api');var moment=require(_0xd609('0x2'));var BPromise=require(_0xd609('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd609('0x4'));var rimraf=require('rimraf');var config=require(_0xd609('0x5'));var attributes=require('./template.attributes');module[_0xd609('0x6')]=function(_0x36f7ca,_0x4509a7){return _0x36f7ca['define'](_0xd609('0x7'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf83a=['./template.attributes','exports','define','tools_templates','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf83a,0xe0));var _0xaf83=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xf83a[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0xaf83('0x0'));var util=require(_0xaf83('0x1'));var logger=require(_0xaf83('0x2'))('api');var moment=require(_0xaf83('0x3'));var BPromise=require(_0xaf83('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf83('0x5'));var rimraf=require('rimraf');var config=require(_0xaf83('0x6'));var attributes=require(_0xaf83('0x7'));module[_0xaf83('0x8')]=function(_0x5d25d2,_0x14667e){return _0x5d25d2[_0xaf83('0x9')]('Template',attributes,{'tableName':_0xaf83('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 720a7b4..28b4b27 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 _0xba90=['../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','GetTemplate','Template','findAll','options','raw','where','limit','include','map','attributes','model','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x4ba3c4,_0x24842d){var _0x2b6605=function(_0xc2698f){while(--_0xc2698f){_0x4ba3c4['push'](_0x4ba3c4['shift']());}};_0x2b6605(++_0x24842d);}(_0xba90,0x1ea));var _0x0ba9=function(_0x3d228d,_0x3d7a43){_0x3d228d=_0x3d228d-0x0;var _0x2908dd=_0xba90[_0x3d228d];return _0x2908dd;};'use strict';var _=require('lodash');var util=require(_0x0ba9('0x0'));var moment=require(_0x0ba9('0x1'));var BPromise=require(_0x0ba9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ba9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ba9('0x4'));var logger=require(_0x0ba9('0x5'))('rpc');var config=require(_0x0ba9('0x6'));var jayson=require(_0x0ba9('0x7'));var client=jayson[_0x0ba9('0x8')][_0x0ba9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ac7ff,_0x238d07,_0x43de31){return new BPromise(function(_0x4b0053,_0x465d80){return client[_0x0ba9('0xa')](_0x2ac7ff,_0x43de31)[_0x0ba9('0xb')](function(_0xb2c564){logger[_0x0ba9('0xc')](_0x0ba9('0xd'),_0x238d07,_0x0ba9('0xe'));logger[_0x0ba9('0xf')]('Template,\x20%s,\x20%s,\x20%s',_0x238d07,_0x0ba9('0xe'),JSON[_0x0ba9('0x10')](_0xb2c564));if(_0xb2c564[_0x0ba9('0x11')]){if(_0xb2c564[_0x0ba9('0x11')]['code']===0x1f4){logger[_0x0ba9('0x11')](_0x0ba9('0xd'),_0x238d07,_0xb2c564['error'][_0x0ba9('0x12')]);return _0x465d80(_0xb2c564[_0x0ba9('0x11')][_0x0ba9('0x12')]);}logger[_0x0ba9('0x11')]('Template,\x20%s,\x20%s',_0x238d07,_0xb2c564[_0x0ba9('0x11')][_0x0ba9('0x12')]);return _0x4b0053(_0xb2c564[_0x0ba9('0x11')][_0x0ba9('0x12')]);}else{logger[_0x0ba9('0xc')]('Template,\x20%s,\x20%s',_0x238d07,'request\x20sent');_0x4b0053(_0xb2c564['result'][_0x0ba9('0x12')]);}})['catch'](function(_0x3728df){logger[_0x0ba9('0x11')](_0x0ba9('0xd'),_0x238d07,_0x3728df);_0x465d80(_0x3728df);});});}exports[_0x0ba9('0x13')]=function(_0x1c1606){var _0x35e55e=this;return new Promise(function(_0x590940,_0x3b6130){return db[_0x0ba9('0x14')][_0x0ba9('0x15')]({'raw':_0x1c1606[_0x0ba9('0x16')]?_0x1c1606[_0x0ba9('0x16')][_0x0ba9('0x17')]===undefined?!![]:![]:!![],'where':_0x1c1606['options']?_0x1c1606[_0x0ba9('0x16')][_0x0ba9('0x18')]||null:null,'attributes':_0x1c1606[_0x0ba9('0x16')]?_0x1c1606[_0x0ba9('0x16')]['attributes']||null:null,'limit':_0x1c1606[_0x0ba9('0x16')]?_0x1c1606['options'][_0x0ba9('0x19')]||null:null,'include':_0x1c1606['options']?_0x1c1606['options'][_0x0ba9('0x1a')]?_[_0x0ba9('0x1b')](_0x1c1606[_0x0ba9('0x16')][_0x0ba9('0x1a')],function(_0x13e480){return{'model':db[_0x13e480['model']],'as':_0x13e480['as'],'attributes':_0x13e480[_0x0ba9('0x1c')],'include':_0x13e480[_0x0ba9('0x1a')]?_[_0x0ba9('0x1b')](_0x13e480['include'],function(_0x494ef2){return{'model':db[_0x494ef2[_0x0ba9('0x1d')]],'as':_0x494ef2['as'],'attributes':_0x494ef2[_0x0ba9('0x1c')],'include':_0x494ef2['include']?_['map'](_0x494ef2[_0x0ba9('0x1a')],function(_0x3cb855){return{'model':db[_0x3cb855[_0x0ba9('0x1d')]],'as':_0x3cb855['as'],'attributes':_0x3cb855[_0x0ba9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0ba9('0xb')](function(_0x273817){logger[_0x0ba9('0xc')]('GetTemplate',_0x1c1606);logger[_0x0ba9('0xf')](_0x0ba9('0x13'),_0x1c1606,JSON[_0x0ba9('0x10')](_0x273817));_0x590940(_0x273817);})[_0x0ba9('0x1e')](function(_0x629c25){logger[_0x0ba9('0x11')](_0x0ba9('0x13'),_0x629c25[_0x0ba9('0x12')],_0x1c1606);_0x3b6130(_0x35e55e[_0x0ba9('0x11')](0x1f4,_0x629c25[_0x0ba9('0x12')]));});});}; \ No newline at end of file +var _0xc2dc=['limit','include','map','model','attributes','then','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','info','result','GetTemplate','options','raw','where'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xc2dc,0x19f));var _0xcc2d=function(_0x3d3ddd,_0x59b504){_0x3d3ddd=_0x3d3ddd-0x0;var _0x52a4f9=_0xc2dc[_0x3d3ddd];return _0x52a4f9;};'use strict';var _=require(_0xcc2d('0x0'));var util=require(_0xcc2d('0x1'));var moment=require(_0xcc2d('0x2'));var BPromise=require(_0xcc2d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc2d('0x4'))['db'];var utils=require(_0xcc2d('0x5'));var logger=require(_0xcc2d('0x6'))(_0xcc2d('0x7'));var config=require(_0xcc2d('0x8'));var jayson=require(_0xcc2d('0x9'));var client=jayson[_0xcc2d('0xa')][_0xcc2d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ee9f7,_0x10266f,_0xa5309a){return new BPromise(function(_0x5a7f1d,_0x3875e9){return client[_0xcc2d('0xc')](_0x5ee9f7,_0xa5309a)['then'](function(_0x2bfcc3){logger['info']('Template,\x20%s,\x20%s',_0x10266f,_0xcc2d('0xd'));logger[_0xcc2d('0xe')](_0xcc2d('0xf'),_0x10266f,_0xcc2d('0xd'),JSON[_0xcc2d('0x10')](_0x2bfcc3));if(_0x2bfcc3['error']){if(_0x2bfcc3[_0xcc2d('0x11')][_0xcc2d('0x12')]===0x1f4){logger['error'](_0xcc2d('0x13'),_0x10266f,_0x2bfcc3[_0xcc2d('0x11')][_0xcc2d('0x14')]);return _0x3875e9(_0x2bfcc3['error'][_0xcc2d('0x14')]);}logger[_0xcc2d('0x11')](_0xcc2d('0x13'),_0x10266f,_0x2bfcc3[_0xcc2d('0x11')][_0xcc2d('0x14')]);return _0x5a7f1d(_0x2bfcc3['error']['message']);}else{logger[_0xcc2d('0x15')](_0xcc2d('0x13'),_0x10266f,_0xcc2d('0xd'));_0x5a7f1d(_0x2bfcc3[_0xcc2d('0x16')][_0xcc2d('0x14')]);}})['catch'](function(_0x29c087){logger[_0xcc2d('0x11')](_0xcc2d('0x13'),_0x10266f,_0x29c087);_0x3875e9(_0x29c087);});});}exports[_0xcc2d('0x17')]=function(_0x2a6bac){var _0x30712c=this;return new Promise(function(_0x2f88c3,_0xd4961b){return db['Template']['findAll']({'raw':_0x2a6bac[_0xcc2d('0x18')]?_0x2a6bac['options'][_0xcc2d('0x19')]===undefined?!![]:![]:!![],'where':_0x2a6bac[_0xcc2d('0x18')]?_0x2a6bac[_0xcc2d('0x18')][_0xcc2d('0x1a')]||null:null,'attributes':_0x2a6bac[_0xcc2d('0x18')]?_0x2a6bac[_0xcc2d('0x18')]['attributes']||null:null,'limit':_0x2a6bac[_0xcc2d('0x18')]?_0x2a6bac['options'][_0xcc2d('0x1b')]||null:null,'include':_0x2a6bac[_0xcc2d('0x18')]?_0x2a6bac[_0xcc2d('0x18')][_0xcc2d('0x1c')]?_['map'](_0x2a6bac[_0xcc2d('0x18')][_0xcc2d('0x1c')],function(_0xe2a17c){return{'model':db[_0xe2a17c['model']],'as':_0xe2a17c['as'],'attributes':_0xe2a17c['attributes'],'include':_0xe2a17c[_0xcc2d('0x1c')]?_[_0xcc2d('0x1d')](_0xe2a17c[_0xcc2d('0x1c')],function(_0x209d38){return{'model':db[_0x209d38[_0xcc2d('0x1e')]],'as':_0x209d38['as'],'attributes':_0x209d38['attributes'],'include':_0x209d38[_0xcc2d('0x1c')]?_['map'](_0x209d38[_0xcc2d('0x1c')],function(_0x4500c9){return{'model':db[_0x4500c9[_0xcc2d('0x1e')]],'as':_0x4500c9['as'],'attributes':_0x4500c9[_0xcc2d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xcc2d('0x20')](function(_0x2c422f){logger[_0xcc2d('0x15')](_0xcc2d('0x17'),_0x2a6bac);logger['debug'](_0xcc2d('0x17'),_0x2a6bac,JSON[_0xcc2d('0x10')](_0x2c422f));_0x2f88c3(_0x2c422f);})[_0xcc2d('0x21')](function(_0x162650){logger['error'](_0xcc2d('0x17'),_0x162650[_0xcc2d('0x14')],_0x2a6bac);_0xd4961b(_0x30712c[_0xcc2d('0x11')](0x1f4,_0x162650[_0xcc2d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 9540415..1906d74 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 _0xbb04=['getAllConditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/all_conditions'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xbb04,0xd1));var _0x4bb0=function(_0x44cad0,_0x229ce2){_0x44cad0=_0x44cad0-0x0;var _0x360e6f=_0xbb04[_0x44cad0];return _0x360e6f;};'use strict';var multer=require(_0x4bb0('0x0'));var util=require(_0x4bb0('0x1'));var path=require(_0x4bb0('0x2'));var timeout=require(_0x4bb0('0x3'));var express=require(_0x4bb0('0x4'));var router=express[_0x4bb0('0x5')]();var auth=require(_0x4bb0('0x6'));var interaction=require(_0x4bb0('0x7'));var config=require(_0x4bb0('0x8'));var controller=require('./trigger.controller');router['get']('/',auth[_0x4bb0('0x9')](),controller[_0x4bb0('0xa')]);router[_0x4bb0('0xb')](_0x4bb0('0xc'),auth[_0x4bb0('0x9')](),controller[_0x4bb0('0xd')]);router[_0x4bb0('0xb')](_0x4bb0('0xe'),auth[_0x4bb0('0x9')](),controller[_0x4bb0('0xf')]);router[_0x4bb0('0xb')]('/:id/any_conditions',auth[_0x4bb0('0x9')](),controller[_0x4bb0('0x10')]);router[_0x4bb0('0xb')](_0x4bb0('0x11'),auth[_0x4bb0('0x9')](),controller[_0x4bb0('0x12')]);router[_0x4bb0('0x13')]('/',auth[_0x4bb0('0x9')](),controller[_0x4bb0('0x14')]);router[_0x4bb0('0x13')](_0x4bb0('0xe'),auth[_0x4bb0('0x9')](),controller[_0x4bb0('0x15')]);router[_0x4bb0('0x13')](_0x4bb0('0x16'),auth[_0x4bb0('0x9')](),controller[_0x4bb0('0x17')]);router[_0x4bb0('0x13')]('/:id/actions',auth[_0x4bb0('0x9')](),controller['addAction']);router[_0x4bb0('0x18')]('/:id',auth[_0x4bb0('0x9')](),controller[_0x4bb0('0x19')]);router[_0x4bb0('0x1a')](_0x4bb0('0xc'),auth[_0x4bb0('0x9')](),controller[_0x4bb0('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x2534=['/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAction','put','update','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions'];(function(_0x2859a8,_0xaa50fd){var _0x441bb3=function(_0x1e73e6){while(--_0x1e73e6){_0x2859a8['push'](_0x2859a8['shift']());}};_0x441bb3(++_0xaa50fd);}(_0x2534,0x9a));var _0x4253=function(_0x4cf757,_0x170b8f){_0x4cf757=_0x4cf757-0x0;var _0x2b1947=_0x2534[_0x4cf757];return _0x2b1947;};'use strict';var multer=require(_0x4253('0x0'));var util=require('util');var path=require(_0x4253('0x1'));var timeout=require('connect-timeout');var express=require(_0x4253('0x2'));var router=express[_0x4253('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4253('0x4'));var config=require(_0x4253('0x5'));var controller=require(_0x4253('0x6'));router[_0x4253('0x7')]('/',auth[_0x4253('0x8')](),controller[_0x4253('0x9')]);router[_0x4253('0x7')](_0x4253('0xa'),auth[_0x4253('0x8')](),controller[_0x4253('0xb')]);router[_0x4253('0x7')](_0x4253('0xc'),auth['isAuthenticated'](),controller[_0x4253('0xd')]);router['get'](_0x4253('0xe'),auth[_0x4253('0x8')](),controller[_0x4253('0xf')]);router['get'](_0x4253('0x10'),auth[_0x4253('0x8')](),controller[_0x4253('0x11')]);router[_0x4253('0x12')]('/',auth['isAuthenticated'](),controller[_0x4253('0x13')]);router['post']('/:id/all_conditions',auth['isAuthenticated'](),controller['addAllCondition']);router[_0x4253('0x12')](_0x4253('0xe'),auth['isAuthenticated'](),controller['addAnyCondition']);router['post'](_0x4253('0x10'),auth[_0x4253('0x8')](),controller[_0x4253('0x14')]);router[_0x4253('0x15')](_0x4253('0xa'),auth[_0x4253('0x8')](),controller[_0x4253('0x16')]);router['delete'](_0x4253('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x4253('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 5b16e0f..3018513 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 _0xca03=['exports','STRING','sequelize'];(function(_0x2cc499,_0x30d44b){var _0x4c37b5=function(_0x2e97a1){while(--_0x2e97a1){_0x2cc499['push'](_0x2cc499['shift']());}};_0x4c37b5(++_0x30d44b);}(_0xca03,0x167));var _0x3ca0=function(_0x1cd3fa,_0x146a45){_0x1cd3fa=_0x1cd3fa-0x0;var _0x3b8034=_0xca03[_0x1cd3fa];return _0x3b8034;};'use strict';var Sequelize=require(_0x3ca0('0x0'));module[_0x3ca0('0x1')]={'name':{'type':Sequelize[_0x3ca0('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3ca0('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xcaa6=['sequelize','exports','STRING'];(function(_0x20d99c,_0x1abe9b){var _0x6df816=function(_0xd2a170){while(--_0xd2a170){_0x20d99c['push'](_0x20d99c['shift']());}};_0x6df816(++_0x1abe9b);}(_0xcaa6,0x1bc));var _0x6caa=function(_0x5b22f5,_0x1497b3){_0x5b22f5=_0x5b22f5-0x0;var _0x5ba3c8=_0xcaa6[_0x5b22f5];return _0x5ba3c8;};'use strict';var Sequelize=require(_0x6caa('0x0'));module[_0x6caa('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6caa('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index b05a0a4..1cc59d9 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 _0x49fe=['json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Triggers','UserProfileResource','destroy','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','sort','pick','getAnyConditions','addAction','Action','getActions','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0xdea05a,_0x11eb6d){var _0x21273f=function(_0x5a0fce){while(--_0x5a0fce){_0xdea05a['push'](_0xdea05a['shift']());}};_0x21273f(++_0x11eb6d);}(_0x49fe,0x100));var _0xe49f=function(_0x597106,_0x591833){_0x597106=_0x597106-0x0;var _0x4c8dc3=_0x49fe[_0x597106];return _0x4c8dc3;};'use strict';var pdf=require(_0xe49f('0x0'));var emlformat=require(_0xe49f('0x1'));var rimraf=require(_0xe49f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe49f('0x3'));var moment=require('moment');var BPromise=require(_0xe49f('0x4'));var Mustache=require(_0xe49f('0x5'));var util=require(_0xe49f('0x6'));var path=require(_0xe49f('0x7'));var sox=require('sox');var csv=require(_0xe49f('0x8'));var ejs=require(_0xe49f('0x9'));var fs=require('fs');var _=require(_0xe49f('0xa'));var squel=require(_0xe49f('0xb'));var crypto=require('crypto');var jsforce=require(_0xe49f('0xc'));var deskjs=require(_0xe49f('0xd'));var toCsv=require(_0xe49f('0x8'));var querystring=require(_0xe49f('0xe'));var Papa=require(_0xe49f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe49f('0x10'));var as=require(_0xe49f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe49f('0x12'));var utils=require(_0xe49f('0x13'));var config=require(_0xe49f('0x14'));var licenseUtil=require(_0xe49f('0x15'));var db=require(_0xe49f('0x16'))['db'];function respondWithStatusCode(_0x1d5ecc,_0x564edb){_0x564edb=_0x564edb||0xcc;return function(_0x5c8b24){if(_0x5c8b24){return _0x1d5ecc[_0xe49f('0x17')](_0x564edb);}return _0x1d5ecc[_0xe49f('0x18')](_0x564edb)[_0xe49f('0x19')]();};}function respondWithResult(_0x4213f6,_0x1cd9b4){_0x1cd9b4=_0x1cd9b4||0xc8;return function(_0x517e43){if(_0x517e43){return _0x4213f6[_0xe49f('0x18')](_0x1cd9b4)[_0xe49f('0x1a')](_0x517e43);}};}function respondWithFilteredResult(_0x2cff19,_0x575030){return function(_0x1b9291){if(_0x1b9291){var _0x4268b3=_0x1b9291[_0xe49f('0x1b')],_0x1a2a86=_0x575030[_0xe49f('0x1c')],_0x5096a8=_0x575030[_0xe49f('0x1c')]+_0x575030[_0xe49f('0x1d')],_0xcb0d16;if(_0x5096a8>=_0x4268b3){_0x5096a8=_0x4268b3;_0xcb0d16=0xc8;}else{_0xcb0d16=0xce;}_0x2cff19[_0xe49f('0x18')](_0xcb0d16);return _0x2cff19[_0xe49f('0x1e')](_0xe49f('0x1f'),_0x1a2a86+'-'+_0x5096a8+'/'+_0x4268b3)['json'](_0x1b9291);}return null;};}function patchUpdates(_0xc6c762){return function(_0x4b159c){try{jsonpatch[_0xe49f('0x20')](_0x4b159c,_0xc6c762,!![]);}catch(_0xe77edc){return BPromise[_0xe49f('0x21')](_0xe77edc);}return _0x4b159c[_0xe49f('0x22')]();};}function saveUpdates(_0x2a054e,_0xfe4d5d){return function(_0x511c45){if(_0x511c45){return _0x511c45[_0xe49f('0x23')](_0x2a054e)[_0xe49f('0x24')](function(_0x104860){return _0x104860;});}return null;};}function removeEntity(_0x128b89,_0x554398){return function(_0x40018d){if(_0x40018d){return _0x40018d['destroy']()[_0xe49f('0x24')](function(){var _0x11f953=_0x40018d[_0xe49f('0x25')]({'plain':!![]});var _0x5e8908=_0xe49f('0x26');return db[_0xe49f('0x27')][_0xe49f('0x28')]({'where':{'type':_0x5e8908,'resourceId':_0x11f953['id']}})[_0xe49f('0x24')](function(){return _0x40018d;});})[_0xe49f('0x24')](function(){_0x128b89['status'](0xcc)[_0xe49f('0x19')]();});}};}function handleEntityNotFound(_0x15cbef,_0xd0397f){return function(_0x3e434c){if(!_0x3e434c){_0x15cbef[_0xe49f('0x17')](0x194);}return _0x3e434c;};}function handleError(_0x47aee6,_0x4b75fd){_0x4b75fd=_0x4b75fd||0x1f4;return function(_0x703c08){logger[_0xe49f('0x29')](_0x703c08[_0xe49f('0x2a')]);if(_0x703c08['name']){delete _0x703c08[_0xe49f('0x2b')];}_0x47aee6[_0xe49f('0x18')](_0x4b75fd)[_0xe49f('0x2c')](_0x703c08);};}exports[_0xe49f('0x2d')]=function(_0x276ecd,_0x28d6c0){var _0x131713={},_0x1558ed={},_0x390c4c={'count':0x0,'rows':[]};var _0x3b0fc2=_[_0xe49f('0x2e')](db[_0xe49f('0x2f')][_0xe49f('0x30')],function(_0x5d7211){return{'name':_0x5d7211[_0xe49f('0x31')],'type':_0x5d7211[_0xe49f('0x32')]['key']};});_0x1558ed['model']=_[_0xe49f('0x2e')](_0x3b0fc2,'name');_0x1558ed[_0xe49f('0x33')]=_[_0xe49f('0x34')](_0x276ecd[_0xe49f('0x33')]);_0x1558ed['filters']=_[_0xe49f('0x35')](_0x1558ed['model'],_0x1558ed[_0xe49f('0x33')]);_0x131713[_0xe49f('0x36')]=_[_0xe49f('0x35')](_0x1558ed[_0xe49f('0x37')],qs[_0xe49f('0x38')](_0x276ecd[_0xe49f('0x33')][_0xe49f('0x38')]));_0x131713[_0xe49f('0x36')]=_0x131713[_0xe49f('0x36')]['length']?_0x131713[_0xe49f('0x36')]:_0x1558ed[_0xe49f('0x37')];if(!_0x276ecd[_0xe49f('0x33')][_0xe49f('0x39')](_0xe49f('0x3a'))){_0x131713[_0xe49f('0x1d')]=qs[_0xe49f('0x1d')](_0x276ecd[_0xe49f('0x33')][_0xe49f('0x1d')]);_0x131713[_0xe49f('0x1c')]=qs['offset'](_0x276ecd['query'][_0xe49f('0x1c')]);}_0x131713[_0xe49f('0x3b')]=qs['sort'](_0x276ecd[_0xe49f('0x33')]['sort']);_0x131713[_0xe49f('0x3c')]=qs[_0xe49f('0x3d')](_['pick'](_0x276ecd[_0xe49f('0x33')],_0x1558ed[_0xe49f('0x3d')]),_0x3b0fc2);if(_0x276ecd[_0xe49f('0x33')][_0xe49f('0x3e')]){_0x131713[_0xe49f('0x3c')]=_[_0xe49f('0x3f')](_0x131713['where'],{'$or':_[_0xe49f('0x2e')](_0x3b0fc2,function(_0x1905ea){if(_0x1905ea[_0xe49f('0x32')]!==_0xe49f('0x40')){var _0x3b626d={};_0x3b626d[_0x1905ea['name']]={'$like':'%'+_0x276ecd['query'][_0xe49f('0x3e')]+'%'};return _0x3b626d;}})});}_0x131713=_[_0xe49f('0x3f')]({},_0x131713,_0x276ecd[_0xe49f('0x41')]);var _0x4bebcb={'where':_0x131713[_0xe49f('0x3c')]};return db['Trigger']['count'](_0x4bebcb)[_0xe49f('0x24')](function(_0x366e9b){_0x390c4c[_0xe49f('0x1b')]=_0x366e9b;if(_0x276ecd[_0xe49f('0x33')][_0xe49f('0x42')]){_0x131713[_0xe49f('0x43')]=[{'all':!![]}];}return db[_0xe49f('0x2f')][_0xe49f('0x44')](_0x131713);})[_0xe49f('0x24')](function(_0x551907){_0x390c4c['rows']=_0x551907;return _0x390c4c;})['then'](respondWithFilteredResult(_0x28d6c0,_0x131713))[_0xe49f('0x45')](handleError(_0x28d6c0,null));};exports[_0xe49f('0x46')]=function(_0x2f9a39,_0x11b4db){var _0x295cbc={'raw':![],'where':{'id':_0x2f9a39[_0xe49f('0x47')]['id']}},_0x57c366={};_0x57c366[_0xe49f('0x37')]=_['keys'](db[_0xe49f('0x2f')][_0xe49f('0x30')]);_0x57c366[_0xe49f('0x33')]=_['keys'](_0x2f9a39['query']);_0x57c366[_0xe49f('0x3d')]=_[_0xe49f('0x35')](_0x57c366[_0xe49f('0x37')],_0x57c366[_0xe49f('0x33')]);_0x295cbc['attributes']=_[_0xe49f('0x35')](_0x57c366[_0xe49f('0x37')],qs[_0xe49f('0x38')](_0x2f9a39[_0xe49f('0x33')]['fields']));_0x295cbc[_0xe49f('0x36')]=_0x295cbc['attributes'][_0xe49f('0x48')]?_0x295cbc[_0xe49f('0x36')]:_0x57c366[_0xe49f('0x37')];if(_0x2f9a39[_0xe49f('0x33')][_0xe49f('0x42')]){_0x295cbc[_0xe49f('0x43')]=[{'all':!![]}];}_0x295cbc=_[_0xe49f('0x3f')]({},_0x295cbc,_0x2f9a39[_0xe49f('0x41')]);return db['Trigger']['find'](_0x295cbc)[_0xe49f('0x24')](handleEntityNotFound(_0x11b4db,null))[_0xe49f('0x24')](respondWithResult(_0x11b4db,null))[_0xe49f('0x45')](handleError(_0x11b4db,null));};exports[_0xe49f('0x49')]=function(_0x2635e6,_0x20598d){return db[_0xe49f('0x2f')][_0xe49f('0x49')](_0x2635e6['body'],{})['then'](function(_0x302e7d){var _0x25e77f=_0x2635e6[_0xe49f('0x4a')][_0xe49f('0x25')]({'plain':!![]});if(!_0x25e77f)throw new Error(_0xe49f('0x4b'));if(_0x25e77f['role']===_0xe49f('0x4a')){var _0x24a8d4=_0x302e7d[_0xe49f('0x25')]({'plain':!![]});var _0xb8349=_0xe49f('0x26');return db[_0xe49f('0x4c')]['find']({'where':{'name':_0xb8349,'userProfileId':_0x25e77f[_0xe49f('0x4d')]},'raw':!![]})[_0xe49f('0x24')](function(_0x5128ae){if(_0x5128ae&&_0x5128ae[_0xe49f('0x4e')]===0x0){return db[_0xe49f('0x27')][_0xe49f('0x49')]({'name':_0x24a8d4[_0xe49f('0x2b')],'resourceId':_0x24a8d4['id'],'type':_0x5128ae[_0xe49f('0x2b')],'sectionId':_0x5128ae['id']},{})[_0xe49f('0x24')](function(){return _0x302e7d;});}else{return _0x302e7d;}})[_0xe49f('0x45')](function(_0xdeb687){logger[_0xe49f('0x29')](_0xe49f('0x4f'),_0xdeb687);throw _0xdeb687;});}return _0x302e7d;})['then'](respondWithResult(_0x20598d,0xc9))['catch'](handleError(_0x20598d,null));};exports['update']=function(_0x2c9663,_0x19d0ad){if(_0x2c9663[_0xe49f('0x50')]['id']){delete _0x2c9663[_0xe49f('0x50')]['id'];}return db[_0xe49f('0x2f')][_0xe49f('0x51')]({'where':{'id':_0x2c9663[_0xe49f('0x47')]['id']}})['then'](handleEntityNotFound(_0x19d0ad,null))[_0xe49f('0x24')](saveUpdates(_0x2c9663[_0xe49f('0x50')],null))[_0xe49f('0x24')](respondWithResult(_0x19d0ad,null))[_0xe49f('0x45')](handleError(_0x19d0ad,null));};exports[_0xe49f('0x28')]=function(_0xf1ddb2,_0xb94303){return db[_0xe49f('0x2f')][_0xe49f('0x51')]({'where':{'id':_0xf1ddb2['params']['id']}})['then'](handleEntityNotFound(_0xb94303,null))[_0xe49f('0x24')](removeEntity(_0xb94303,null))[_0xe49f('0x45')](handleError(_0xb94303,null));};exports['addAllCondition']=function(_0x2f2e53,_0x646b06,_0x580a9a){if(_0x2f2e53['body']['id']){delete _0x2f2e53[_0xe49f('0x50')]['id'];}return db[_0xe49f('0x2f')][_0xe49f('0x51')]({'where':{'id':_0x2f2e53[_0xe49f('0x47')]['id']}})['then'](handleEntityNotFound(_0x646b06,null))[_0xe49f('0x24')](function(_0x856ef6){if(_0x856ef6){_0x2f2e53[_0xe49f('0x50')][_0xe49f('0x52')]=_0x856ef6['id'];return db[_0xe49f('0x53')][_0xe49f('0x49')](_0x2f2e53[_0xe49f('0x50')]);}})['then'](respondWithResult(_0x646b06,null))['catch'](handleError(_0x646b06,null));};exports[_0xe49f('0x54')]=function(_0x43f1a1,_0x20b596,_0x5d6f6e){if(_0x43f1a1[_0xe49f('0x50')]['id']){delete _0x43f1a1[_0xe49f('0x50')]['id'];}return db[_0xe49f('0x2f')][_0xe49f('0x51')]({'where':{'id':_0x43f1a1[_0xe49f('0x47')]['id']}})[_0xe49f('0x24')](handleEntityNotFound(_0x20b596,null))[_0xe49f('0x24')](function(_0x32fb6c){if(_0x32fb6c){_0x43f1a1[_0xe49f('0x50')][_0xe49f('0x55')]=_0x32fb6c['id'];return db['Condition'][_0xe49f('0x49')](_0x43f1a1[_0xe49f('0x50')]);}})['then'](respondWithResult(_0x20b596,null))['catch'](handleError(_0x20b596,null));};exports[_0xe49f('0x56')]=function(_0x1a02c7,_0x3e45cd,_0x1732fe){var _0x4502ce={};var _0x50094e={};var _0x13727b;var _0x126c89;return db[_0xe49f('0x2f')][_0xe49f('0x57')]({'where':{'id':_0x1a02c7[_0xe49f('0x47')]['id']}})[_0xe49f('0x24')](handleEntityNotFound(_0x3e45cd,null))[_0xe49f('0x24')](function(_0x114687){if(_0x114687){_0x13727b=_0x114687;_0x50094e[_0xe49f('0x37')]=_[_0xe49f('0x34')](db[_0xe49f('0x53')][_0xe49f('0x30')]);_0x50094e[_0xe49f('0x33')]=_[_0xe49f('0x34')](_0x1a02c7['query']);_0x50094e[_0xe49f('0x3d')]=_['intersection'](_0x50094e[_0xe49f('0x37')],_0x50094e[_0xe49f('0x33')]);_0x4502ce[_0xe49f('0x36')]=_['intersection'](_0x50094e[_0xe49f('0x37')],qs[_0xe49f('0x38')](_0x1a02c7[_0xe49f('0x33')][_0xe49f('0x38')]));_0x4502ce[_0xe49f('0x36')]=_0x4502ce[_0xe49f('0x36')][_0xe49f('0x48')]?_0x4502ce['attributes']:_0x50094e['model'];_0x4502ce[_0xe49f('0x3b')]=qs['sort'](_0x1a02c7[_0xe49f('0x33')][_0xe49f('0x58')]);_0x4502ce['where']=qs['filters'](_[_0xe49f('0x59')](_0x1a02c7[_0xe49f('0x33')],_0x50094e[_0xe49f('0x3d')]));if(_0x1a02c7[_0xe49f('0x33')][_0xe49f('0x3e')]){_0x4502ce[_0xe49f('0x3c')]=_[_0xe49f('0x3f')](_0x4502ce['where'],{'$or':_[_0xe49f('0x2e')](_0x4502ce['attributes'],function(_0x3436da){var _0x50bafa={};_0x50bafa[_0x3436da]={'$like':'%'+_0x1a02c7[_0xe49f('0x33')][_0xe49f('0x3e')]+'%'};return _0x50bafa;})});}_0x4502ce=_['merge']({},_0x4502ce,_0x1a02c7[_0xe49f('0x41')]);return _0x13727b['getAllConditions'](_0x4502ce);}})[_0xe49f('0x24')](function(_0x3a6a9a){if(_0x3a6a9a){_0x126c89=_0x3a6a9a[_0xe49f('0x48')];if(!_0x1a02c7[_0xe49f('0x33')][_0xe49f('0x39')]('nolimit')){_0x4502ce['limit']=qs[_0xe49f('0x1d')](_0x1a02c7['query']['limit']);_0x4502ce['offset']=qs['offset'](_0x1a02c7[_0xe49f('0x33')][_0xe49f('0x1c')]);}return _0x13727b[_0xe49f('0x56')](_0x4502ce);}})['then'](function(_0x4da328){if(_0x4da328){return _0x4da328?{'count':_0x126c89,'rows':_0x4da328}:null;}})['then'](respondWithResult(_0x3e45cd,null))[_0xe49f('0x45')](handleError(_0x3e45cd,null));};exports[_0xe49f('0x5a')]=function(_0x9c7849,_0x4d6417,_0x569135){var _0x5cfa7b={};var _0xa0b09={};var _0x269672;var _0x28dae8;return db[_0xe49f('0x2f')][_0xe49f('0x57')]({'where':{'id':_0x9c7849[_0xe49f('0x47')]['id']}})[_0xe49f('0x24')](handleEntityNotFound(_0x4d6417,null))['then'](function(_0x247a66){if(_0x247a66){_0x269672=_0x247a66;_0xa0b09[_0xe49f('0x37')]=_['keys'](db[_0xe49f('0x53')][_0xe49f('0x30')]);_0xa0b09[_0xe49f('0x33')]=_[_0xe49f('0x34')](_0x9c7849[_0xe49f('0x33')]);_0xa0b09[_0xe49f('0x3d')]=_[_0xe49f('0x35')](_0xa0b09[_0xe49f('0x37')],_0xa0b09[_0xe49f('0x33')]);_0x5cfa7b[_0xe49f('0x36')]=_[_0xe49f('0x35')](_0xa0b09[_0xe49f('0x37')],qs[_0xe49f('0x38')](_0x9c7849['query'][_0xe49f('0x38')]));_0x5cfa7b[_0xe49f('0x36')]=_0x5cfa7b[_0xe49f('0x36')]['length']?_0x5cfa7b[_0xe49f('0x36')]:_0xa0b09['model'];_0x5cfa7b['order']=qs[_0xe49f('0x58')](_0x9c7849[_0xe49f('0x33')][_0xe49f('0x58')]);_0x5cfa7b[_0xe49f('0x3c')]=qs[_0xe49f('0x3d')](_[_0xe49f('0x59')](_0x9c7849['query'],_0xa0b09[_0xe49f('0x3d')]));if(_0x9c7849[_0xe49f('0x33')]['filter']){_0x5cfa7b[_0xe49f('0x3c')]=_['merge'](_0x5cfa7b[_0xe49f('0x3c')],{'$or':_['map'](_0x5cfa7b[_0xe49f('0x36')],function(_0x29423e){var _0x5baf30={};_0x5baf30[_0x29423e]={'$like':'%'+_0x9c7849[_0xe49f('0x33')][_0xe49f('0x3e')]+'%'};return _0x5baf30;})});}_0x5cfa7b=_['merge']({},_0x5cfa7b,_0x9c7849[_0xe49f('0x41')]);return _0x269672[_0xe49f('0x5a')](_0x5cfa7b);}})[_0xe49f('0x24')](function(_0x33b8c4){if(_0x33b8c4){_0x28dae8=_0x33b8c4[_0xe49f('0x48')];if(!_0x9c7849['query'][_0xe49f('0x39')]('nolimit')){_0x5cfa7b[_0xe49f('0x1d')]=qs[_0xe49f('0x1d')](_0x9c7849[_0xe49f('0x33')][_0xe49f('0x1d')]);_0x5cfa7b[_0xe49f('0x1c')]=qs[_0xe49f('0x1c')](_0x9c7849['query'][_0xe49f('0x1c')]);}return _0x269672[_0xe49f('0x5a')](_0x5cfa7b);}})['then'](function(_0x35123c){if(_0x35123c){return _0x35123c?{'count':_0x28dae8,'rows':_0x35123c}:null;}})[_0xe49f('0x24')](respondWithResult(_0x4d6417,null))[_0xe49f('0x45')](handleError(_0x4d6417,null));};exports[_0xe49f('0x5b')]=function(_0x493a8f,_0x4cd8e3,_0x5758c9){if(_0x493a8f[_0xe49f('0x50')]['id']){delete _0x493a8f[_0xe49f('0x50')]['id'];}return db[_0xe49f('0x2f')]['find']({'where':{'id':_0x493a8f[_0xe49f('0x47')]['id']}})[_0xe49f('0x24')](handleEntityNotFound(_0x4cd8e3,null))['then'](function(_0x4112ac){if(_0x4112ac){_0x493a8f[_0xe49f('0x50')]['TriggerId']=_0x4112ac['id'];return db[_0xe49f('0x5c')][_0xe49f('0x49')](_0x493a8f['body']);}})[_0xe49f('0x24')](respondWithResult(_0x4cd8e3,null))[_0xe49f('0x45')](handleError(_0x4cd8e3,null));};exports[_0xe49f('0x5d')]=function(_0x28aebd,_0x2d49da,_0x532d0c){var _0x17e361={};var _0x11e976={};var _0x484f82;var _0x3f8e5e;return db[_0xe49f('0x2f')][_0xe49f('0x57')]({'where':{'id':_0x28aebd[_0xe49f('0x47')]['id']}})[_0xe49f('0x24')](handleEntityNotFound(_0x2d49da,null))[_0xe49f('0x24')](function(_0x38afef){if(_0x38afef){_0x484f82=_0x38afef;_0x11e976[_0xe49f('0x37')]=_[_0xe49f('0x34')](db[_0xe49f('0x5c')][_0xe49f('0x30')]);_0x11e976[_0xe49f('0x33')]=_[_0xe49f('0x34')](_0x28aebd[_0xe49f('0x33')]);_0x11e976[_0xe49f('0x3d')]=_[_0xe49f('0x35')](_0x11e976['model'],_0x11e976['query']);_0x17e361[_0xe49f('0x36')]=_['intersection'](_0x11e976[_0xe49f('0x37')],qs[_0xe49f('0x38')](_0x28aebd[_0xe49f('0x33')][_0xe49f('0x38')]));_0x17e361[_0xe49f('0x36')]=_0x17e361[_0xe49f('0x36')][_0xe49f('0x48')]?_0x17e361[_0xe49f('0x36')]:_0x11e976['model'];_0x17e361[_0xe49f('0x3b')]=qs['sort'](_0x28aebd['query'][_0xe49f('0x58')]);_0x17e361['where']=qs[_0xe49f('0x3d')](_['pick'](_0x28aebd[_0xe49f('0x33')],_0x11e976[_0xe49f('0x3d')]));if(_0x28aebd[_0xe49f('0x33')]['filter']){_0x17e361[_0xe49f('0x3c')]=_[_0xe49f('0x3f')](_0x17e361['where'],{'$or':_[_0xe49f('0x2e')](_0x17e361[_0xe49f('0x36')],function(_0x5bcb44){var _0x3f7efe={};_0x3f7efe[_0x5bcb44]={'$like':'%'+_0x28aebd[_0xe49f('0x33')][_0xe49f('0x3e')]+'%'};return _0x3f7efe;})});}_0x17e361=_['merge']({},_0x17e361,_0x28aebd['options']);return _0x484f82[_0xe49f('0x5d')](_0x17e361);}})[_0xe49f('0x24')](function(_0x3f3047){if(_0x3f3047){_0x3f8e5e=_0x3f3047[_0xe49f('0x48')];if(!_0x28aebd[_0xe49f('0x33')]['hasOwnProperty'](_0xe49f('0x3a'))){_0x17e361['limit']=qs[_0xe49f('0x1d')](_0x28aebd[_0xe49f('0x33')]['limit']);_0x17e361[_0xe49f('0x1c')]=qs[_0xe49f('0x1c')](_0x28aebd[_0xe49f('0x33')][_0xe49f('0x1c')]);}return _0x484f82[_0xe49f('0x5d')](_0x17e361);}})['then'](function(_0x29f86d){if(_0x29f86d){return _0x29f86d?{'count':_0x3f8e5e,'rows':_0x29f86d}:null;}})[_0xe49f('0x24')](respondWithResult(_0x2d49da,null))['catch'](handleError(_0x2d49da,null));}; \ No newline at end of file +var _0x61b8=['squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','Trigger','count','includeAll','include','findAll','rows','catch','show','keys','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Triggers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','addAllCondition','addAnyCondition','Condition','getAllConditions','findOne','pick','options','getAnyConditions','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0x61b8,0x169));var _0x861b=function(_0x3f44b,_0xede649){_0x3f44b=_0x3f44b-0x0;var _0x254458=_0x61b8[_0x3f44b];return _0x254458;};'use strict';var pdf=require(_0x861b('0x0'));var emlformat=require(_0x861b('0x1'));var rimraf=require(_0x861b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x861b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x861b('0x4'));var Mustache=require(_0x861b('0x5'));var util=require(_0x861b('0x6'));var path=require('path');var sox=require(_0x861b('0x7'));var csv=require(_0x861b('0x8'));var ejs=require(_0x861b('0x9'));var fs=require('fs');var _=require(_0x861b('0xa'));var squel=require(_0x861b('0xb'));var crypto=require(_0x861b('0xc'));var jsforce=require(_0x861b('0xd'));var deskjs=require(_0x861b('0xe'));var toCsv=require(_0x861b('0x8'));var querystring=require(_0x861b('0xf'));var Papa=require(_0x861b('0x10'));var Redis=require('ioredis');var authService=require(_0x861b('0x11'));var qs=require(_0x861b('0x12'));var as=require(_0x861b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x861b('0x14'))('api');var utils=require(_0x861b('0x15'));var config=require(_0x861b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x861b('0x17'))['db'];function respondWithStatusCode(_0x16eb59,_0x125345){_0x125345=_0x125345||0xcc;return function(_0x23c3db){if(_0x23c3db){return _0x16eb59[_0x861b('0x18')](_0x125345);}return _0x16eb59[_0x861b('0x19')](_0x125345)[_0x861b('0x1a')]();};}function respondWithResult(_0x21c585,_0x44b444){_0x44b444=_0x44b444||0xc8;return function(_0x226ee9){if(_0x226ee9){return _0x21c585[_0x861b('0x19')](_0x44b444)[_0x861b('0x1b')](_0x226ee9);}};}function respondWithFilteredResult(_0x264ba1,_0x3ee3ab){return function(_0x437bbd){if(_0x437bbd){var _0x3dbd5e=_0x437bbd['count'],_0x5121aa=_0x3ee3ab[_0x861b('0x1c')],_0x18b1d7=_0x3ee3ab['offset']+_0x3ee3ab[_0x861b('0x1d')],_0x5a4542;if(_0x18b1d7>=_0x3dbd5e){_0x18b1d7=_0x3dbd5e;_0x5a4542=0xc8;}else{_0x5a4542=0xce;}_0x264ba1[_0x861b('0x19')](_0x5a4542);return _0x264ba1['set'](_0x861b('0x1e'),_0x5121aa+'-'+_0x18b1d7+'/'+_0x3dbd5e)[_0x861b('0x1b')](_0x437bbd);}return null;};}function patchUpdates(_0x3b9740){return function(_0x11a914){try{jsonpatch['apply'](_0x11a914,_0x3b9740,!![]);}catch(_0x55d21b){return BPromise[_0x861b('0x1f')](_0x55d21b);}return _0x11a914[_0x861b('0x20')]();};}function saveUpdates(_0x20422f,_0x4e76a3){return function(_0x1223aa){if(_0x1223aa){return _0x1223aa['update'](_0x20422f)[_0x861b('0x21')](function(_0x1ad06c){return _0x1ad06c;});}return null;};}function removeEntity(_0x4af003,_0x4fd2b3){return function(_0x474f49){if(_0x474f49){return _0x474f49[_0x861b('0x22')]()['then'](function(){var _0x4e61cd=_0x474f49[_0x861b('0x23')]({'plain':!![]});var _0x47be04='Triggers';return db[_0x861b('0x24')]['destroy']({'where':{'type':_0x47be04,'resourceId':_0x4e61cd['id']}})['then'](function(){return _0x474f49;});})[_0x861b('0x21')](function(){_0x4af003[_0x861b('0x19')](0xcc)[_0x861b('0x1a')]();});}};}function handleEntityNotFound(_0xb763e2,_0x2a2074){return function(_0x58527c){if(!_0x58527c){_0xb763e2['sendStatus'](0x194);}return _0x58527c;};}function handleError(_0x726496,_0x130dbb){_0x130dbb=_0x130dbb||0x1f4;return function(_0x2d4ed8){logger[_0x861b('0x25')](_0x2d4ed8[_0x861b('0x26')]);if(_0x2d4ed8[_0x861b('0x27')]){delete _0x2d4ed8['name'];}_0x726496['status'](_0x130dbb)[_0x861b('0x28')](_0x2d4ed8);};}exports[_0x861b('0x29')]=function(_0x419259,_0x1fc11a){var _0xc94042={},_0x31c890={},_0x5bee82={'count':0x0,'rows':[]};var _0x4b21b9=_[_0x861b('0x2a')](db['Trigger'][_0x861b('0x2b')],function(_0x13d1c0){return{'name':_0x13d1c0[_0x861b('0x2c')],'type':_0x13d1c0[_0x861b('0x2d')][_0x861b('0x2e')]};});_0x31c890[_0x861b('0x2f')]=_[_0x861b('0x2a')](_0x4b21b9,_0x861b('0x27'));_0x31c890['query']=_['keys'](_0x419259[_0x861b('0x30')]);_0x31c890['filters']=_[_0x861b('0x31')](_0x31c890[_0x861b('0x2f')],_0x31c890['query']);_0xc94042[_0x861b('0x32')]=_['intersection'](_0x31c890['model'],qs[_0x861b('0x33')](_0x419259[_0x861b('0x30')]['fields']));_0xc94042[_0x861b('0x32')]=_0xc94042[_0x861b('0x32')]['length']?_0xc94042[_0x861b('0x32')]:_0x31c890[_0x861b('0x2f')];if(!_0x419259['query'][_0x861b('0x34')](_0x861b('0x35'))){_0xc94042[_0x861b('0x1d')]=qs[_0x861b('0x1d')](_0x419259[_0x861b('0x30')][_0x861b('0x1d')]);_0xc94042['offset']=qs[_0x861b('0x1c')](_0x419259[_0x861b('0x30')][_0x861b('0x1c')]);}_0xc94042[_0x861b('0x36')]=qs[_0x861b('0x37')](_0x419259['query']['sort']);_0xc94042[_0x861b('0x38')]=qs[_0x861b('0x39')](_['pick'](_0x419259['query'],_0x31c890[_0x861b('0x39')]),_0x4b21b9);if(_0x419259[_0x861b('0x30')][_0x861b('0x3a')]){_0xc94042[_0x861b('0x38')]=_[_0x861b('0x3b')](_0xc94042[_0x861b('0x38')],{'$or':_['map'](_0x4b21b9,function(_0x362e88){if(_0x362e88[_0x861b('0x2d')]!==_0x861b('0x3c')){var _0x75fca9={};_0x75fca9[_0x362e88[_0x861b('0x27')]]={'$like':'%'+_0x419259[_0x861b('0x30')]['filter']+'%'};return _0x75fca9;}})});}_0xc94042=_[_0x861b('0x3b')]({},_0xc94042,_0x419259['options']);var _0x25080a={'where':_0xc94042['where']};return db[_0x861b('0x3d')][_0x861b('0x3e')](_0x25080a)[_0x861b('0x21')](function(_0x1a4046){_0x5bee82[_0x861b('0x3e')]=_0x1a4046;if(_0x419259['query'][_0x861b('0x3f')]){_0xc94042[_0x861b('0x40')]=[{'all':!![]}];}return db[_0x861b('0x3d')][_0x861b('0x41')](_0xc94042);})['then'](function(_0x23ae99){_0x5bee82[_0x861b('0x42')]=_0x23ae99;return _0x5bee82;})['then'](respondWithFilteredResult(_0x1fc11a,_0xc94042))[_0x861b('0x43')](handleError(_0x1fc11a,null));};exports[_0x861b('0x44')]=function(_0x3a236c,_0x5f25b3){var _0x29cb4b={'raw':![],'where':{'id':_0x3a236c['params']['id']}},_0x396341={};_0x396341[_0x861b('0x2f')]=_[_0x861b('0x45')](db['Trigger'][_0x861b('0x2b')]);_0x396341[_0x861b('0x30')]=_['keys'](_0x3a236c[_0x861b('0x30')]);_0x396341[_0x861b('0x39')]=_[_0x861b('0x31')](_0x396341[_0x861b('0x2f')],_0x396341[_0x861b('0x30')]);_0x29cb4b[_0x861b('0x32')]=_['intersection'](_0x396341[_0x861b('0x2f')],qs['fields'](_0x3a236c[_0x861b('0x30')][_0x861b('0x33')]));_0x29cb4b['attributes']=_0x29cb4b[_0x861b('0x32')][_0x861b('0x46')]?_0x29cb4b[_0x861b('0x32')]:_0x396341[_0x861b('0x2f')];if(_0x3a236c[_0x861b('0x30')]['includeAll']){_0x29cb4b[_0x861b('0x40')]=[{'all':!![]}];}_0x29cb4b=_[_0x861b('0x3b')]({},_0x29cb4b,_0x3a236c['options']);return db[_0x861b('0x3d')][_0x861b('0x47')](_0x29cb4b)[_0x861b('0x21')](handleEntityNotFound(_0x5f25b3,null))[_0x861b('0x21')](respondWithResult(_0x5f25b3,null))[_0x861b('0x43')](handleError(_0x5f25b3,null));};exports[_0x861b('0x48')]=function(_0x37214c,_0x285537){return db[_0x861b('0x3d')][_0x861b('0x48')](_0x37214c['body'],{})[_0x861b('0x21')](function(_0x5f2145){var _0x1074f1=_0x37214c['user'][_0x861b('0x23')]({'plain':!![]});if(!_0x1074f1)throw new Error(_0x861b('0x49'));if(_0x1074f1['role']===_0x861b('0x4a')){var _0x4df88a=_0x5f2145[_0x861b('0x23')]({'plain':!![]});var _0x24d0ac=_0x861b('0x4b');return db['UserProfileSection'][_0x861b('0x47')]({'where':{'name':_0x24d0ac,'userProfileId':_0x1074f1[_0x861b('0x4c')]},'raw':!![]})[_0x861b('0x21')](function(_0x3b3124){if(_0x3b3124&&_0x3b3124[_0x861b('0x4d')]===0x0){return db[_0x861b('0x24')][_0x861b('0x48')]({'name':_0x4df88a[_0x861b('0x27')],'resourceId':_0x4df88a['id'],'type':_0x3b3124['name'],'sectionId':_0x3b3124['id']},{})[_0x861b('0x21')](function(){return _0x5f2145;});}else{return _0x5f2145;}})[_0x861b('0x43')](function(_0x408874){logger['error'](_0x861b('0x4e'),_0x408874);throw _0x408874;});}return _0x5f2145;})[_0x861b('0x21')](respondWithResult(_0x285537,0xc9))['catch'](handleError(_0x285537,null));};exports[_0x861b('0x4f')]=function(_0x4f025a,_0x1b9934){if(_0x4f025a[_0x861b('0x50')]['id']){delete _0x4f025a[_0x861b('0x50')]['id'];}return db[_0x861b('0x3d')]['find']({'where':{'id':_0x4f025a[_0x861b('0x51')]['id']}})[_0x861b('0x21')](handleEntityNotFound(_0x1b9934,null))['then'](saveUpdates(_0x4f025a[_0x861b('0x50')],null))[_0x861b('0x21')](respondWithResult(_0x1b9934,null))['catch'](handleError(_0x1b9934,null));};exports[_0x861b('0x22')]=function(_0x16f364,_0x192868){return db[_0x861b('0x3d')][_0x861b('0x47')]({'where':{'id':_0x16f364[_0x861b('0x51')]['id']}})[_0x861b('0x21')](handleEntityNotFound(_0x192868,null))[_0x861b('0x21')](removeEntity(_0x192868,null))[_0x861b('0x43')](handleError(_0x192868,null));};exports[_0x861b('0x52')]=function(_0x4e0e32,_0xa15789,_0x1153f3){if(_0x4e0e32[_0x861b('0x50')]['id']){delete _0x4e0e32[_0x861b('0x50')]['id'];}return db[_0x861b('0x3d')]['find']({'where':{'id':_0x4e0e32[_0x861b('0x51')]['id']}})[_0x861b('0x21')](handleEntityNotFound(_0xa15789,null))[_0x861b('0x21')](function(_0x49b1e4){if(_0x49b1e4){_0x4e0e32[_0x861b('0x50')]['TriggerAllId']=_0x49b1e4['id'];return db['Condition'][_0x861b('0x48')](_0x4e0e32[_0x861b('0x50')]);}})['then'](respondWithResult(_0xa15789,null))[_0x861b('0x43')](handleError(_0xa15789,null));};exports[_0x861b('0x53')]=function(_0x1530aa,_0x40ead7,_0x3ea660){if(_0x1530aa[_0x861b('0x50')]['id']){delete _0x1530aa[_0x861b('0x50')]['id'];}return db[_0x861b('0x3d')][_0x861b('0x47')]({'where':{'id':_0x1530aa[_0x861b('0x51')]['id']}})[_0x861b('0x21')](handleEntityNotFound(_0x40ead7,null))[_0x861b('0x21')](function(_0x3c61fd){if(_0x3c61fd){_0x1530aa['body']['TriggerAnyId']=_0x3c61fd['id'];return db[_0x861b('0x54')][_0x861b('0x48')](_0x1530aa[_0x861b('0x50')]);}})[_0x861b('0x21')](respondWithResult(_0x40ead7,null))[_0x861b('0x43')](handleError(_0x40ead7,null));};exports[_0x861b('0x55')]=function(_0x11207c,_0x654bcd,_0x5982e1){var _0x479a8f={};var _0x55fdf6={};var _0x246718;var _0x45cad8;return db[_0x861b('0x3d')][_0x861b('0x56')]({'where':{'id':_0x11207c['params']['id']}})[_0x861b('0x21')](handleEntityNotFound(_0x654bcd,null))[_0x861b('0x21')](function(_0xe7ea7a){if(_0xe7ea7a){_0x246718=_0xe7ea7a;_0x55fdf6[_0x861b('0x2f')]=_[_0x861b('0x45')](db['Condition'][_0x861b('0x2b')]);_0x55fdf6[_0x861b('0x30')]=_[_0x861b('0x45')](_0x11207c[_0x861b('0x30')]);_0x55fdf6[_0x861b('0x39')]=_['intersection'](_0x55fdf6[_0x861b('0x2f')],_0x55fdf6[_0x861b('0x30')]);_0x479a8f[_0x861b('0x32')]=_['intersection'](_0x55fdf6[_0x861b('0x2f')],qs[_0x861b('0x33')](_0x11207c['query'][_0x861b('0x33')]));_0x479a8f['attributes']=_0x479a8f['attributes']['length']?_0x479a8f[_0x861b('0x32')]:_0x55fdf6[_0x861b('0x2f')];_0x479a8f[_0x861b('0x36')]=qs[_0x861b('0x37')](_0x11207c[_0x861b('0x30')][_0x861b('0x37')]);_0x479a8f[_0x861b('0x38')]=qs['filters'](_[_0x861b('0x57')](_0x11207c['query'],_0x55fdf6[_0x861b('0x39')]));if(_0x11207c[_0x861b('0x30')]['filter']){_0x479a8f['where']=_[_0x861b('0x3b')](_0x479a8f['where'],{'$or':_[_0x861b('0x2a')](_0x479a8f[_0x861b('0x32')],function(_0x47d232){var _0x54ba64={};_0x54ba64[_0x47d232]={'$like':'%'+_0x11207c[_0x861b('0x30')][_0x861b('0x3a')]+'%'};return _0x54ba64;})});}_0x479a8f=_[_0x861b('0x3b')]({},_0x479a8f,_0x11207c[_0x861b('0x58')]);return _0x246718[_0x861b('0x55')](_0x479a8f);}})[_0x861b('0x21')](function(_0xb3895f){if(_0xb3895f){_0x45cad8=_0xb3895f[_0x861b('0x46')];if(!_0x11207c[_0x861b('0x30')][_0x861b('0x34')](_0x861b('0x35'))){_0x479a8f[_0x861b('0x1d')]=qs[_0x861b('0x1d')](_0x11207c[_0x861b('0x30')][_0x861b('0x1d')]);_0x479a8f['offset']=qs[_0x861b('0x1c')](_0x11207c[_0x861b('0x30')][_0x861b('0x1c')]);}return _0x246718[_0x861b('0x55')](_0x479a8f);}})[_0x861b('0x21')](function(_0xd929c7){if(_0xd929c7){return _0xd929c7?{'count':_0x45cad8,'rows':_0xd929c7}:null;}})[_0x861b('0x21')](respondWithResult(_0x654bcd,null))[_0x861b('0x43')](handleError(_0x654bcd,null));};exports['getAnyConditions']=function(_0x1311de,_0x32cf4e,_0x5ba1c0){var _0x5ce54d={};var _0x4857b1={};var _0x339ed2;var _0x313129;return db[_0x861b('0x3d')][_0x861b('0x56')]({'where':{'id':_0x1311de[_0x861b('0x51')]['id']}})['then'](handleEntityNotFound(_0x32cf4e,null))['then'](function(_0xdc7696){if(_0xdc7696){_0x339ed2=_0xdc7696;_0x4857b1[_0x861b('0x2f')]=_['keys'](db[_0x861b('0x54')][_0x861b('0x2b')]);_0x4857b1[_0x861b('0x30')]=_[_0x861b('0x45')](_0x1311de[_0x861b('0x30')]);_0x4857b1['filters']=_[_0x861b('0x31')](_0x4857b1['model'],_0x4857b1[_0x861b('0x30')]);_0x5ce54d[_0x861b('0x32')]=_[_0x861b('0x31')](_0x4857b1[_0x861b('0x2f')],qs[_0x861b('0x33')](_0x1311de[_0x861b('0x30')][_0x861b('0x33')]));_0x5ce54d[_0x861b('0x32')]=_0x5ce54d[_0x861b('0x32')]['length']?_0x5ce54d['attributes']:_0x4857b1[_0x861b('0x2f')];_0x5ce54d[_0x861b('0x36')]=qs[_0x861b('0x37')](_0x1311de[_0x861b('0x30')][_0x861b('0x37')]);_0x5ce54d[_0x861b('0x38')]=qs[_0x861b('0x39')](_['pick'](_0x1311de[_0x861b('0x30')],_0x4857b1['filters']));if(_0x1311de[_0x861b('0x30')][_0x861b('0x3a')]){_0x5ce54d['where']=_['merge'](_0x5ce54d[_0x861b('0x38')],{'$or':_[_0x861b('0x2a')](_0x5ce54d['attributes'],function(_0x546ce3){var _0x500f12={};_0x500f12[_0x546ce3]={'$like':'%'+_0x1311de[_0x861b('0x30')][_0x861b('0x3a')]+'%'};return _0x500f12;})});}_0x5ce54d=_['merge']({},_0x5ce54d,_0x1311de[_0x861b('0x58')]);return _0x339ed2[_0x861b('0x59')](_0x5ce54d);}})[_0x861b('0x21')](function(_0x439236){if(_0x439236){_0x313129=_0x439236[_0x861b('0x46')];if(!_0x1311de['query']['hasOwnProperty'](_0x861b('0x35'))){_0x5ce54d[_0x861b('0x1d')]=qs['limit'](_0x1311de[_0x861b('0x30')]['limit']);_0x5ce54d['offset']=qs['offset'](_0x1311de['query'][_0x861b('0x1c')]);}return _0x339ed2[_0x861b('0x59')](_0x5ce54d);}})[_0x861b('0x21')](function(_0x4500d1){if(_0x4500d1){return _0x4500d1?{'count':_0x313129,'rows':_0x4500d1}:null;}})['then'](respondWithResult(_0x32cf4e,null))['catch'](handleError(_0x32cf4e,null));};exports['addAction']=function(_0x3c4c8c,_0x569fd2,_0x57cba6){if(_0x3c4c8c[_0x861b('0x50')]['id']){delete _0x3c4c8c[_0x861b('0x50')]['id'];}return db[_0x861b('0x3d')]['find']({'where':{'id':_0x3c4c8c['params']['id']}})[_0x861b('0x21')](handleEntityNotFound(_0x569fd2,null))[_0x861b('0x21')](function(_0x428d27){if(_0x428d27){_0x3c4c8c[_0x861b('0x50')][_0x861b('0x5a')]=_0x428d27['id'];return db['Action'][_0x861b('0x48')](_0x3c4c8c[_0x861b('0x50')]);}})['then'](respondWithResult(_0x569fd2,null))[_0x861b('0x43')](handleError(_0x569fd2,null));};exports['getActions']=function(_0xdb4258,_0x4e2523,_0x2a0456){var _0x1372e9={};var _0x4bc5b9={};var _0x1db813;var _0x2e17fb;return db[_0x861b('0x3d')][_0x861b('0x56')]({'where':{'id':_0xdb4258[_0x861b('0x51')]['id']}})[_0x861b('0x21')](handleEntityNotFound(_0x4e2523,null))[_0x861b('0x21')](function(_0x4b49b4){if(_0x4b49b4){_0x1db813=_0x4b49b4;_0x4bc5b9[_0x861b('0x2f')]=_['keys'](db[_0x861b('0x5b')][_0x861b('0x2b')]);_0x4bc5b9[_0x861b('0x30')]=_['keys'](_0xdb4258['query']);_0x4bc5b9[_0x861b('0x39')]=_[_0x861b('0x31')](_0x4bc5b9[_0x861b('0x2f')],_0x4bc5b9[_0x861b('0x30')]);_0x1372e9[_0x861b('0x32')]=_[_0x861b('0x31')](_0x4bc5b9['model'],qs[_0x861b('0x33')](_0xdb4258[_0x861b('0x30')][_0x861b('0x33')]));_0x1372e9[_0x861b('0x32')]=_0x1372e9[_0x861b('0x32')][_0x861b('0x46')]?_0x1372e9[_0x861b('0x32')]:_0x4bc5b9[_0x861b('0x2f')];_0x1372e9[_0x861b('0x36')]=qs['sort'](_0xdb4258[_0x861b('0x30')][_0x861b('0x37')]);_0x1372e9['where']=qs[_0x861b('0x39')](_['pick'](_0xdb4258[_0x861b('0x30')],_0x4bc5b9[_0x861b('0x39')]));if(_0xdb4258['query']['filter']){_0x1372e9[_0x861b('0x38')]=_[_0x861b('0x3b')](_0x1372e9[_0x861b('0x38')],{'$or':_[_0x861b('0x2a')](_0x1372e9[_0x861b('0x32')],function(_0x1aee56){var _0x96a37f={};_0x96a37f[_0x1aee56]={'$like':'%'+_0xdb4258[_0x861b('0x30')]['filter']+'%'};return _0x96a37f;})});}_0x1372e9=_['merge']({},_0x1372e9,_0xdb4258['options']);return _0x1db813[_0x861b('0x5c')](_0x1372e9);}})[_0x861b('0x21')](function(_0x50bbd6){if(_0x50bbd6){_0x2e17fb=_0x50bbd6['length'];if(!_0xdb4258[_0x861b('0x30')][_0x861b('0x34')]('nolimit')){_0x1372e9[_0x861b('0x1d')]=qs['limit'](_0xdb4258[_0x861b('0x30')][_0x861b('0x1d')]);_0x1372e9[_0x861b('0x1c')]=qs[_0x861b('0x1c')](_0xdb4258[_0x861b('0x30')][_0x861b('0x1c')]);}return _0x1db813[_0x861b('0x5c')](_0x1372e9);}})['then'](function(_0xd4de61){if(_0xd4de61){return _0xd4de61?{'count':_0x2e17fb,'rows':_0xd4de61}:null;}})['then'](respondWithResult(_0x4e2523,null))[_0x861b('0x43')](handleError(_0x4e2523,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 677ae91..4c9ef57 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 _0x1427=['path','rimraf','../../config/environment','exports','define','Trigger','tools_triggers','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0x1427,0xd7));var _0x7142=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1427[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7142('0x0'));var logger=require(_0x7142('0x1'))(_0x7142('0x2'));var moment=require(_0x7142('0x3'));var BPromise=require(_0x7142('0x4'));var rp=require(_0x7142('0x5'));var fs=require('fs');var path=require(_0x7142('0x6'));var rimraf=require(_0x7142('0x7'));var config=require(_0x7142('0x8'));var attributes=require('./trigger.attributes');module[_0x7142('0x9')]=function(_0x17e10f,_0x19adb4){return _0x17e10f[_0x7142('0xa')](_0x7142('0xb'),attributes,{'tableName':_0x7142('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8324=['path','rimraf','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x46651b,_0x4a5cc5){var _0x4b6f92=function(_0x5ec09d){while(--_0x5ec09d){_0x46651b['push'](_0x46651b['shift']());}};_0x4b6f92(++_0x4a5cc5);}(_0x8324,0x1ab));var _0x4832=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0x8324[_0x15ea09];return _0x3e9c78;};'use strict';var _=require(_0x4832('0x0'));var util=require('util');var logger=require(_0x4832('0x1'))('api');var moment=require(_0x4832('0x2'));var BPromise=require(_0x4832('0x3'));var rp=require(_0x4832('0x4'));var fs=require('fs');var path=require(_0x4832('0x5'));var rimraf=require(_0x4832('0x6'));var config=require(_0x4832('0x7'));var attributes=require(_0x4832('0x8'));module[_0x4832('0x9')]=function(_0x4e3c0f,_0x193911){return _0x4e3c0f['define'](_0x4832('0xa'),attributes,{'tableName':_0x4832('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 491d8db..eb6eb46 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 _0x02ce=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Trigger','findAll','options','include','map','model','attributes','GetTrigger','ShowTrigger','find','raw','where','lodash','util','moment','randomstring'];(function(_0x5c2e93,_0xfa2cdb){var _0xbd9327=function(_0x1ddaf3){while(--_0x1ddaf3){_0x5c2e93['push'](_0x5c2e93['shift']());}};_0xbd9327(++_0xfa2cdb);}(_0x02ce,0x1ac));var _0xe02c=function(_0x1410d1,_0x37ae87){_0x1410d1=_0x1410d1-0x0;var _0x4c2468=_0x02ce[_0x1410d1];return _0x4c2468;};'use strict';var _=require(_0xe02c('0x0'));var util=require(_0xe02c('0x1'));var moment=require(_0xe02c('0x2'));var BPromise=require('bluebird');var rs=require(_0xe02c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe02c('0x4'))['db'];var utils=require(_0xe02c('0x5'));var logger=require(_0xe02c('0x6'))(_0xe02c('0x7'));var config=require(_0xe02c('0x8'));var jayson=require(_0xe02c('0x9'));var client=jayson[_0xe02c('0xa')][_0xe02c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36a87f,_0x4fecb3,_0x5eabb0){return new BPromise(function(_0x3c757e,_0x2d85d7){return client[_0xe02c('0xc')](_0x36a87f,_0x5eabb0)[_0xe02c('0xd')](function(_0x2afbf5){logger[_0xe02c('0xe')](_0xe02c('0xf'),_0x4fecb3,_0xe02c('0x10'));logger[_0xe02c('0x11')](_0xe02c('0x12'),_0x4fecb3,_0xe02c('0x10'),JSON[_0xe02c('0x13')](_0x2afbf5));if(_0x2afbf5[_0xe02c('0x14')]){if(_0x2afbf5[_0xe02c('0x14')][_0xe02c('0x15')]===0x1f4){logger[_0xe02c('0x14')](_0xe02c('0xf'),_0x4fecb3,_0x2afbf5[_0xe02c('0x14')]['message']);return _0x2d85d7(_0x2afbf5[_0xe02c('0x14')]['message']);}logger['error'](_0xe02c('0xf'),_0x4fecb3,_0x2afbf5['error'][_0xe02c('0x16')]);return _0x3c757e(_0x2afbf5['error'][_0xe02c('0x16')]);}else{logger['info'](_0xe02c('0xf'),_0x4fecb3,_0xe02c('0x10'));_0x3c757e(_0x2afbf5['result'][_0xe02c('0x16')]);}})[_0xe02c('0x17')](function(_0x51676c){logger[_0xe02c('0x14')](_0xe02c('0xf'),_0x4fecb3,_0x51676c);_0x2d85d7(_0x51676c);});});}exports['GetTrigger']=function(_0x52917f){var _0x3e37bf=this;return new Promise(function(_0x49604a,_0x1f8f37){return db[_0xe02c('0x18')][_0xe02c('0x19')]({'raw':_0x52917f[_0xe02c('0x1a')]?_0x52917f[_0xe02c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x52917f[_0xe02c('0x1a')]?_0x52917f['options']['where']||null:null,'attributes':_0x52917f[_0xe02c('0x1a')]?_0x52917f[_0xe02c('0x1a')]['attributes']||null:null,'limit':_0x52917f[_0xe02c('0x1a')]?_0x52917f[_0xe02c('0x1a')]['limit']||null:null,'include':_0x52917f[_0xe02c('0x1a')]?_0x52917f[_0xe02c('0x1a')][_0xe02c('0x1b')]?_[_0xe02c('0x1c')](_0x52917f[_0xe02c('0x1a')][_0xe02c('0x1b')],function(_0x3e80e3){return{'model':db[_0x3e80e3[_0xe02c('0x1d')]],'as':_0x3e80e3['as'],'attributes':_0x3e80e3[_0xe02c('0x1e')],'include':_0x3e80e3[_0xe02c('0x1b')]?_[_0xe02c('0x1c')](_0x3e80e3['include'],function(_0xefd882){return{'model':db[_0xefd882[_0xe02c('0x1d')]],'as':_0xefd882['as'],'attributes':_0xefd882[_0xe02c('0x1e')],'include':_0xefd882[_0xe02c('0x1b')]?_[_0xe02c('0x1c')](_0xefd882[_0xe02c('0x1b')],function(_0x43dc78){return{'model':db[_0x43dc78[_0xe02c('0x1d')]],'as':_0x43dc78['as'],'attributes':_0x43dc78['attributes']};}):[]};}):[]};}):[]:[]})[_0xe02c('0xd')](function(_0x3790eb){logger[_0xe02c('0xe')]('GetTrigger',_0x52917f);logger[_0xe02c('0x11')](_0xe02c('0x1f'),_0x52917f,JSON[_0xe02c('0x13')](_0x3790eb));_0x49604a(_0x3790eb);})[_0xe02c('0x17')](function(_0x1e7eab){logger[_0xe02c('0x14')](_0xe02c('0x1f'),_0x1e7eab[_0xe02c('0x16')],_0x52917f);_0x1f8f37(_0x3e37bf[_0xe02c('0x14')](0x1f4,_0x1e7eab[_0xe02c('0x16')]));});});};exports[_0xe02c('0x20')]=function(_0x5a2da0){var _0x3c3d2c=this;return new Promise(function(_0x3c1858,_0x22b783){return db[_0xe02c('0x18')][_0xe02c('0x21')]({'raw':_0x5a2da0[_0xe02c('0x1a')]?_0x5a2da0['options'][_0xe02c('0x22')]===undefined?!![]:![]:!![],'where':_0x5a2da0[_0xe02c('0x1a')]?_0x5a2da0['options'][_0xe02c('0x23')]||null:null,'attributes':_0x5a2da0[_0xe02c('0x1a')]?_0x5a2da0[_0xe02c('0x1a')][_0xe02c('0x1e')]||null:null,'include':_0x5a2da0[_0xe02c('0x1a')]?_0x5a2da0['options']['include']?_[_0xe02c('0x1c')](_0x5a2da0[_0xe02c('0x1a')]['include'],function(_0x1afae6){return{'model':db[_0x1afae6['model']],'as':_0x1afae6['as'],'attributes':_0x1afae6[_0xe02c('0x1e')],'include':_0x1afae6[_0xe02c('0x1b')]?_[_0xe02c('0x1c')](_0x1afae6[_0xe02c('0x1b')],function(_0x10ae8b){return{'model':db[_0x10ae8b['model']],'as':_0x10ae8b['as'],'attributes':_0x10ae8b[_0xe02c('0x1e')],'include':_0x10ae8b['include']?_[_0xe02c('0x1c')](_0x10ae8b[_0xe02c('0x1b')],function(_0x3d6f3d){return{'model':db[_0x3d6f3d[_0xe02c('0x1d')]],'as':_0x3d6f3d['as'],'attributes':_0x3d6f3d[_0xe02c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe02c('0xd')](function(_0x559bc1){logger[_0xe02c('0xe')](_0xe02c('0x20'),_0x5a2da0);logger['debug'](_0xe02c('0x20'),_0x5a2da0,JSON[_0xe02c('0x13')](_0x559bc1));_0x3c1858(_0x559bc1);})['catch'](function(_0x396a06){logger['error'](_0xe02c('0x20'),_0x396a06[_0xe02c('0x16')],_0x5a2da0);_0x22b783(_0x3c3d2c['error'](0x1f4,_0x396a06[_0xe02c('0x16')]));});});}; \ No newline at end of file +var _0x0102=['util','moment','bluebird','randomstring','../../config/environment','jayson/promise','client','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrigger','findAll','options','raw','where','attributes','include','model','map','find','ShowTrigger'];(function(_0x5708a1,_0x5cfd78){var _0x119002=function(_0x22fd89){while(--_0x22fd89){_0x5708a1['push'](_0x5708a1['shift']());}};_0x119002(++_0x5cfd78);}(_0x0102,0x186));var _0x2010=function(_0x4677ad,_0x5cffd7){_0x4677ad=_0x4677ad-0x0;var _0x5e5972=_0x0102[_0x4677ad];return _0x5e5972;};'use strict';var _=require('lodash');var util=require(_0x2010('0x0'));var moment=require(_0x2010('0x1'));var BPromise=require(_0x2010('0x2'));var rs=require(_0x2010('0x3'));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(_0x2010('0x4'));var jayson=require(_0x2010('0x5'));var client=jayson[_0x2010('0x6')][_0x2010('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4eeb67,_0x453fc0,_0x495d98){return new BPromise(function(_0x4728c0,_0x160e41){return client['request'](_0x4eeb67,_0x495d98)[_0x2010('0x8')](function(_0x3c2d98){logger[_0x2010('0x9')](_0x2010('0xa'),_0x453fc0,_0x2010('0xb'));logger[_0x2010('0xc')](_0x2010('0xd'),_0x453fc0,_0x2010('0xb'),JSON[_0x2010('0xe')](_0x3c2d98));if(_0x3c2d98[_0x2010('0xf')]){if(_0x3c2d98[_0x2010('0xf')][_0x2010('0x10')]===0x1f4){logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);return _0x160e41(_0x3c2d98['error']['message']);}logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);return _0x4728c0(_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);}else{logger['info'](_0x2010('0xa'),_0x453fc0,_0x2010('0xb'));_0x4728c0(_0x3c2d98['result'][_0x2010('0x11')]);}})[_0x2010('0x12')](function(_0x410889){logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x410889);_0x160e41(_0x410889);});});}exports[_0x2010('0x13')]=function(_0x83cd35){var _0x1476c0=this;return new Promise(function(_0x309477,_0x569de2){return db['Trigger'][_0x2010('0x14')]({'raw':_0x83cd35[_0x2010('0x15')]?_0x83cd35[_0x2010('0x15')][_0x2010('0x16')]===undefined?!![]:![]:!![],'where':_0x83cd35['options']?_0x83cd35['options'][_0x2010('0x17')]||null:null,'attributes':_0x83cd35[_0x2010('0x15')]?_0x83cd35[_0x2010('0x15')][_0x2010('0x18')]||null:null,'limit':_0x83cd35[_0x2010('0x15')]?_0x83cd35[_0x2010('0x15')]['limit']||null:null,'include':_0x83cd35[_0x2010('0x15')]?_0x83cd35[_0x2010('0x15')]['include']?_['map'](_0x83cd35['options'][_0x2010('0x19')],function(_0x574719){return{'model':db[_0x574719[_0x2010('0x1a')]],'as':_0x574719['as'],'attributes':_0x574719['attributes'],'include':_0x574719['include']?_[_0x2010('0x1b')](_0x574719[_0x2010('0x19')],function(_0x52b4fe){return{'model':db[_0x52b4fe[_0x2010('0x1a')]],'as':_0x52b4fe['as'],'attributes':_0x52b4fe['attributes'],'include':_0x52b4fe[_0x2010('0x19')]?_[_0x2010('0x1b')](_0x52b4fe[_0x2010('0x19')],function(_0x3dcea4){return{'model':db[_0x3dcea4[_0x2010('0x1a')]],'as':_0x3dcea4['as'],'attributes':_0x3dcea4[_0x2010('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2010('0x8')](function(_0x3eb4dc){logger[_0x2010('0x9')](_0x2010('0x13'),_0x83cd35);logger[_0x2010('0xc')](_0x2010('0x13'),_0x83cd35,JSON['stringify'](_0x3eb4dc));_0x309477(_0x3eb4dc);})[_0x2010('0x12')](function(_0x52fe5e){logger[_0x2010('0xf')](_0x2010('0x13'),_0x52fe5e[_0x2010('0x11')],_0x83cd35);_0x569de2(_0x1476c0[_0x2010('0xf')](0x1f4,_0x52fe5e['message']));});});};exports['ShowTrigger']=function(_0x136d5f){var _0x48d9f2=this;return new Promise(function(_0x2839f2,_0x1d5d7a){return db['Trigger'][_0x2010('0x1c')]({'raw':_0x136d5f[_0x2010('0x15')]?_0x136d5f[_0x2010('0x15')][_0x2010('0x16')]===undefined?!![]:![]:!![],'where':_0x136d5f[_0x2010('0x15')]?_0x136d5f['options'][_0x2010('0x17')]||null:null,'attributes':_0x136d5f[_0x2010('0x15')]?_0x136d5f[_0x2010('0x15')]['attributes']||null:null,'include':_0x136d5f['options']?_0x136d5f[_0x2010('0x15')][_0x2010('0x19')]?_[_0x2010('0x1b')](_0x136d5f['options']['include'],function(_0xac64e1){return{'model':db[_0xac64e1[_0x2010('0x1a')]],'as':_0xac64e1['as'],'attributes':_0xac64e1[_0x2010('0x18')],'include':_0xac64e1[_0x2010('0x19')]?_[_0x2010('0x1b')](_0xac64e1['include'],function(_0x569e13){return{'model':db[_0x569e13['model']],'as':_0x569e13['as'],'attributes':_0x569e13[_0x2010('0x18')],'include':_0x569e13[_0x2010('0x19')]?_[_0x2010('0x1b')](_0x569e13['include'],function(_0x1f7f49){return{'model':db[_0x1f7f49[_0x2010('0x1a')]],'as':_0x1f7f49['as'],'attributes':_0x1f7f49[_0x2010('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2010('0x8')](function(_0x4f5106){logger[_0x2010('0x9')](_0x2010('0x1d'),_0x136d5f);logger[_0x2010('0xc')]('ShowTrigger',_0x136d5f,JSON[_0x2010('0xe')](_0x4f5106));_0x2839f2(_0x4f5106);})['catch'](function(_0x13f88a){logger[_0x2010('0xf')](_0x2010('0x1d'),_0x13f88a[_0x2010('0x11')],_0x136d5f);_0x1d5d7a(_0x48d9f2[_0x2010('0xf')](0x1f4,_0x13f88a[_0x2010('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 6403a09..007c605 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 _0xfd28=['index','/:id','post','/:id/clone','create','update','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4a29b2,_0x47997a){var _0x31e0ab=function(_0x2bd1f3){while(--_0x2bd1f3){_0x4a29b2['push'](_0x4a29b2['shift']());}};_0x31e0ab(++_0x47997a);}(_0xfd28,0x148));var _0x8fd2=function(_0x20cf8a,_0x44cd6b){_0x20cf8a=_0x20cf8a-0x0;var _0x54e165=_0xfd28[_0x20cf8a];return _0x54e165;};'use strict';var multer=require('multer');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fd2('0x2'));var router=express['Router']();var auth=require(_0x8fd2('0x3'));var interaction=require(_0x8fd2('0x4'));var config=require(_0x8fd2('0x5'));var controller=require('./trunk.controller');router[_0x8fd2('0x6')]('/',auth[_0x8fd2('0x7')](),controller[_0x8fd2('0x8')]);router[_0x8fd2('0x6')](_0x8fd2('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x8fd2('0xa')](_0x8fd2('0xb'),auth[_0x8fd2('0x7')](),controller['clone']);router[_0x8fd2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8fd2('0xc')]);router['put'](_0x8fd2('0x9'),auth['isAuthenticated'](),controller[_0x8fd2('0xd')]);router['delete'](_0x8fd2('0x9'),auth['isAuthenticated'](),controller[_0x8fd2('0xe')]);module[_0x8fd2('0xf')]=router; \ No newline at end of file +var _0x4b84=['./trunk.controller','get','isAuthenticated','post','clone','put','/:id','update','delete','exports','multer','util','express','../../components/interaction/service','../../config/environment'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0x4b84[_0x5e9876];return _0x576c48;};'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 auth=require('../../components/auth/service');var interaction=require(_0x44b8('0x3'));var config=require(_0x44b8('0x4'));var controller=require(_0x44b8('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x44b8('0x6')]('/:id',auth[_0x44b8('0x7')](),controller['show']);router[_0x44b8('0x8')]('/:id/clone',auth['isAuthenticated'](),controller[_0x44b8('0x9')]);router[_0x44b8('0x8')]('/',auth[_0x44b8('0x7')](),controller['create']);router[_0x44b8('0xa')](_0x44b8('0xb'),auth[_0x44b8('0x7')](),controller[_0x44b8('0xc')]);router[_0x44b8('0xd')](_0x44b8('0xb'),auth[_0x44b8('0x7')](),controller['destroy']);module[_0x44b8('0xe')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index c729cb4..9b6b24c 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 _0xe9bd=['join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','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','INTEGER','\x22\x22\x20<>','always','accept','uac','uas','fingerprint','certificate','passive','dynamic','update,nonat','BOOLEAN','sequelize','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport'];(function(_0x3bf756,_0x5af8d0){var _0x44acc5=function(_0x32748f){while(--_0x32748f){_0x3bf756['push'](_0x3bf756['shift']());}};_0x44acc5(++_0x5af8d0);}(_0xe9bd,0xe1));var _0xde9b=function(_0x2eb37b,_0x40e269){_0x2eb37b=_0x2eb37b-0x0;var _0xc8c50=_0xe9bd[_0x2eb37b];return _0xc8c50;};'use strict';var Sequelize=require(_0xde9b('0x0'));module['exports']={'name':{'type':Sequelize[_0xde9b('0x1')],'allowNull':![],'unique':_0xde9b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xde9b('0x3')](_0xde9b('0x4'),_0xde9b('0x5'),'peer'),'allowNull':![],'defaultValue':_0xde9b('0x4')},'context':{'type':Sequelize[_0xde9b('0x1')],'allowNull':![],'defaultValue':_0xde9b('0x6')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0xde9b('0x7'),'ALLOWED_FAILED_SCREEN',_0xde9b('0x8'),_0xde9b('0x9'),_0xde9b('0xa'),'PROHIB_FAILED_SCREEN',_0xde9b('0xb'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xde9b('0x1')]},'md5secret':{'type':Sequelize[_0xde9b('0x1')]},'remotesecret':{'type':Sequelize[_0xde9b('0x1')]},'transport':{'type':Sequelize[_0xde9b('0x1')],'defaultValue':_0xde9b('0xc'),'set':function(_0x4486d5){this[_0xde9b('0xd')](_0xde9b('0xe'),_0x4486d5?_0x4486d5[_0xde9b('0xf')](','):null);},'get':function(){return this[_0xde9b('0x10')]('transport')?this[_0xde9b('0x10')](_0xde9b('0xe'))[_0xde9b('0x11')](','):null;},'comment':_0xde9b('0x12')},'dtmfmode':{'type':Sequelize[_0xde9b('0x3')](_0xde9b('0x13'),_0xde9b('0x14'),'shortinfo',_0xde9b('0x15'),_0xde9b('0x16')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xde9b('0x3')](_0xde9b('0x17'),'no',_0xde9b('0x18'),_0xde9b('0x19'),_0xde9b('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xde9b('0x3')](_0xde9b('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xde9b('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xde9b('0x1')],'defaultValue':_0xde9b('0x1b'),'set':function(_0x414fcb){this[_0xde9b('0xd')]('nat',_0x414fcb?_0x414fcb[_0xde9b('0xf')](','):null);},'get':function(){return this['getDataValue'](_0xde9b('0x1c'))?this['getDataValue'](_0xde9b('0x1c'))[_0xde9b('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xde9b('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xde9b('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xde9b('0x1')]},'language':{'type':Sequelize[_0xde9b('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xde9b('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0xde9b('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x50607a){this[_0xde9b('0xd')](_0xde9b('0x1d'),_0x50607a?_0x50607a[_0xde9b('0xf')](';'):_0xde9b('0x1e'));},'get':function(){return this[_0xde9b('0x10')](_0xde9b('0x1d'))?this[_0xde9b('0x10')]('allow')[_0xde9b('0x11')](';'):null;},'comment':_0xde9b('0x1f')},'autoframing':{'type':Sequelize[_0xde9b('0x3')](_0xde9b('0x17'),'no')},'insecure':{'type':Sequelize[_0xde9b('0x1')],'defaultValue':_0xde9b('0x20'),'set':function(_0x15e7cc){this['setDataValue'](_0xde9b('0x21'),_0x15e7cc?_0x15e7cc[_0xde9b('0xf')](','):null);},'get':function(){return this[_0xde9b('0x10')](_0xde9b('0x21'))?this[_0xde9b('0x10')](_0xde9b('0x21'))['split'](','):null;},'comment':_0xde9b('0x22')},'trustrpid':{'type':Sequelize['ENUM'](_0xde9b('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xde9b('0x3')](_0xde9b('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xde9b('0x3')](_0xde9b('0x17'),'no',_0xde9b('0x23'))},'promiscredir':{'type':Sequelize[_0xde9b('0x3')](_0xde9b('0x17'),'no')},'useclientcode':{'type':Sequelize[_0xde9b('0x3')](_0xde9b('0x17'),'no')},'accountcode':{'type':Sequelize[_0xde9b('0x24')](0xb)},'setvar':{'type':Sequelize[_0xde9b('0x1')]},'callerid':{'type':Sequelize[_0xde9b('0x1')],'defaultValue':_0xde9b('0x25')},'amaflags':{'type':Sequelize[_0xde9b('0x1')]},'callcounter':{'type':Sequelize[_0xde9b('0x3')]('yes','no'),'defaultValue':_0xde9b('0x17')},'busylevel':{'type':Sequelize[_0xde9b('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0xde9b('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xde9b('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xde9b('0x3')](_0xde9b('0x17'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xde9b('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0xde9b('0x1')]},'template':{'type':Sequelize[_0xde9b('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0xde9b('0x17'),'no',_0xde9b('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xde9b('0x3')]('yes','no')},'mailbox':{'type':Sequelize[_0xde9b('0x1')]},'session_timers':{'type':Sequelize[_0xde9b('0x3')](_0xde9b('0x27'),'refuse','originate')},'session_expires':{'type':Sequelize[_0xde9b('0x24')](0xb)},'session_minse':{'type':Sequelize[_0xde9b('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xde9b('0x3')](_0xde9b('0x28'),_0xde9b('0x29')),'defaultValue':_0xde9b('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0xde9b('0x1')]},'regexten':{'type':Sequelize[_0xde9b('0x1')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xde9b('0x1')]},'port':{'type':Sequelize[_0xde9b('0x24')](0x5)},'qualify':{'type':Sequelize[_0xde9b('0x3')](_0xde9b('0x17'),'no'),'defaultValue':_0xde9b('0x17')},'keepalive':{'type':Sequelize[_0xde9b('0x24')](0xb)},'defaultip':{'type':Sequelize[_0xde9b('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xde9b('0x3')](_0xde9b('0x17'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xde9b('0x1')]},'callbackextension':{'type':Sequelize[_0xde9b('0x1')]},'timert1':{'type':Sequelize[_0xde9b('0x24')](0xb)},'timerb':{'type':Sequelize[_0xde9b('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0xde9b('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0xde9b('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xde9b('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xde9b('0x1')]},'use_q850_reason':{'type':Sequelize[_0xde9b('0x1')]},'maxforwards':{'type':Sequelize[_0xde9b('0x24')](0xb)},'encryption':{'type':Sequelize[_0xde9b('0x3')](_0xde9b('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xde9b('0x17'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xde9b('0x17'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xde9b('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0xde9b('0x3')](_0xde9b('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0xde9b('0x3')](_0xde9b('0x17'),'no',_0xde9b('0x2a'),_0xde9b('0x2b'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xde9b('0x1')]},'dtlscafile':{'type':Sequelize[_0xde9b('0x1')]},'dtlscapath':{'type':Sequelize[_0xde9b('0x1')]},'dtlssetup':{'type':Sequelize[_0xde9b('0x3')]('active',_0xde9b('0x2c'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xde9b('0x1')]},'usereqphone':{'type':Sequelize[_0xde9b('0x3')](_0xde9b('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xde9b('0x1')]},'recordofffeature':{'type':Sequelize[_0xde9b('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xde9b('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xde9b('0x17'),'no')},'vmexten':{'type':Sequelize[_0xde9b('0x1')]},'mohinterpret':{'type':Sequelize[_0xde9b('0x1')]},'mohsuggest':{'type':Sequelize[_0xde9b('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xde9b('0x1')]},'host':{'type':Sequelize[_0xde9b('0x1')],'defaultValue':_0xde9b('0x2d')},'canreinvite':{'type':Sequelize[_0xde9b('0x3')]('yes','no',_0xde9b('0x18'),_0xde9b('0x19'),_0xde9b('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xde9b('0x1')]},'otherFields':{'type':Sequelize[_0xde9b('0x1')]},'active':{'type':Sequelize[_0xde9b('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xdb41=['friend','user','peer','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport','rfc2833','shortinfo','auto','yes','nonat','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','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<>','INTEGER','always','accept','refuse','originate','uas','pai','fingerprint','certificate','active','actpass','dynamic','update,nonat','BOOLEAN','sequelize','name','ENUM'];(function(_0x47037d,_0x5bea6b){var _0x401d0a=function(_0x1461eb){while(--_0x1461eb){_0x47037d['push'](_0x47037d['shift']());}};_0x401d0a(++_0x5bea6b);}(_0xdb41,0x90));var _0x1db4=function(_0x7c1a5d,_0x4bcb22){_0x7c1a5d=_0x7c1a5d-0x0;var _0x1cceb3=_0xdb41[_0x7c1a5d];return _0x1cceb3;};'use strict';var Sequelize=require(_0x1db4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1db4('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x3'),_0x1db4('0x4'),_0x1db4('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x1db4('0x6')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x7'),_0x1db4('0x8'),_0x1db4('0x9'),'ALLOWED',_0x1db4('0xa'),_0x1db4('0xb'),_0x1db4('0xc'),_0x1db4('0xd'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x1db4('0x6')]},'secret':{'type':Sequelize[_0x1db4('0x6')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x1db4('0x6')]},'transport':{'type':Sequelize[_0x1db4('0x6')],'defaultValue':_0x1db4('0xe'),'set':function(_0x47aeb2){this[_0x1db4('0xf')]('transport',_0x47aeb2?_0x47aeb2[_0x1db4('0x10')](','):null);},'get':function(){return this[_0x1db4('0x11')]('transport')?this[_0x1db4('0x11')](_0x1db4('0x12'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x13'),'info',_0x1db4('0x14'),'inband',_0x1db4('0x15')),'defaultValue':_0x1db4('0x13')},'directmedia':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no',_0x1db4('0x17'),'update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1db4('0x6')]},'directmediadeny':{'type':Sequelize[_0x1db4('0x6')]},'nat':{'type':Sequelize[_0x1db4('0x6')],'defaultValue':_0x1db4('0x18'),'set':function(_0x5e1893){this[_0x1db4('0xf')](_0x1db4('0x19'),_0x5e1893?_0x5e1893[_0x1db4('0x10')](','):null);},'get':function(){return this[_0x1db4('0x11')](_0x1db4('0x19'))?this[_0x1db4('0x11')](_0x1db4('0x19'))[_0x1db4('0x1a')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1db4('0x6')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x1db4('0x6')]},'language':{'type':Sequelize[_0x1db4('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1db4('0x6')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x1db4('0x6')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x1db4('0x6')],'allowNull':![],'defaultValue':_0x1db4('0x1b'),'set':function(_0x5664ec){this[_0x1db4('0xf')](_0x1db4('0x1c'),_0x5664ec?_0x5664ec[_0x1db4('0x10')](';'):_0x1db4('0x1b'));},'get':function(){return this[_0x1db4('0x11')](_0x1db4('0x1c'))?this['getDataValue'](_0x1db4('0x1c'))[_0x1db4('0x1a')](';'):null;},'comment':_0x1db4('0x1d')},'autoframing':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no')},'insecure':{'type':Sequelize[_0x1db4('0x6')],'defaultValue':_0x1db4('0x1e'),'set':function(_0x529273){this[_0x1db4('0xf')]('insecure',_0x529273?_0x529273['join'](','):null);},'get':function(){return this[_0x1db4('0x11')](_0x1db4('0x1f'))?this[_0x1db4('0x11')](_0x1db4('0x1f'))['split'](','):null;},'comment':_0x1db4('0x20')},'trustrpid':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x1db4('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1db4('0x2')]('yes','no',_0x1db4('0x21'))},'promiscredir':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x1db4('0x2')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x1db4('0x6')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x1db4('0x22')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no'),'defaultValue':_0x1db4('0x16')},'busylevel':{'type':Sequelize[_0x1db4('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x1db4('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x1db4('0x2')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x1db4('0x6')]},'videosupport':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no',_0x1db4('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1db4('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x1db4('0x2')]('yes','no')},'mailbox':{'type':Sequelize[_0x1db4('0x6')]},'session_timers':{'type':Sequelize['ENUM'](_0x1db4('0x25'),_0x1db4('0x26'),_0x1db4('0x27'))},'session_expires':{'type':Sequelize[_0x1db4('0x23')](0xb)},'session_minse':{'type':Sequelize[_0x1db4('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x1db4('0x2')]('uac',_0x1db4('0x28')),'defaultValue':_0x1db4('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x1db4('0x6')]},'regexten':{'type':Sequelize[_0x1db4('0x6')]},'fromdomain':{'type':Sequelize[_0x1db4('0x6')]},'fromuser':{'type':Sequelize[_0x1db4('0x6')]},'port':{'type':Sequelize[_0x1db4('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x1db4('0x16'),'no'),'defaultValue':_0x1db4('0x16')},'keepalive':{'type':Sequelize[_0x1db4('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x1db4('0x6')]},'defaultuser':{'type':Sequelize[_0x1db4('0x6')]},'rtptimeout':{'type':Sequelize[_0x1db4('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x1db4('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x1db4('0x16'),'no',_0x1db4('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1db4('0x6')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x1db4('0x23')](0xb)},'timerb':{'type':Sequelize[_0x1db4('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x1db4('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x1db4('0x6')]},'contactdeny':{'type':Sequelize[_0x1db4('0x6')]},'contactacl':{'type':Sequelize[_0x1db4('0x6')]},'unsolicited_mailbox':{'type':Sequelize[_0x1db4('0x6')]},'use_q850_reason':{'type':Sequelize[_0x1db4('0x6')]},'maxforwards':{'type':Sequelize[_0x1db4('0x23')](0xb)},'encryption':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no')},'force_avp':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no')},'icesupport':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x1db4('0x2')]('yes','no',_0x1db4('0x2a'),_0x1db4('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x1db4('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0x1db4('0x6')]},'dtlsprivatekey':{'type':Sequelize[_0x1db4('0x6')]},'dtlscipher':{'type':Sequelize[_0x1db4('0x6')]},'dtlscafile':{'type':Sequelize[_0x1db4('0x6')]},'dtlscapath':{'type':Sequelize[_0x1db4('0x6')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x1db4('0x2c'),'passive',_0x1db4('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1db4('0x6')]},'usereqphone':{'type':Sequelize[_0x1db4('0x2')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1db4('0x6')]},'recordofffeature':{'type':Sequelize[_0x1db4('0x6')]},'call_limit':{'type':Sequelize[_0x1db4('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x1db4('0x2')](_0x1db4('0x16'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x1db4('0x6')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x1db4('0x6')]},'description':{'type':Sequelize[_0x1db4('0x6')]},'host':{'type':Sequelize[_0x1db4('0x6')],'defaultValue':_0x1db4('0x2e')},'canreinvite':{'type':Sequelize['ENUM'](_0x1db4('0x16'),'no',_0x1db4('0x17'),'update',_0x1db4('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x1db4('0x6')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x1db4('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x1db4('0x6')],'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 852b160..de92913 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 _0x0725=['hasOwnProperty','nolimit','order','sort','where','filter','merge','options','Trunk','count','includeAll','findAll','show','params','clone','include','find','omit','createdAt','body','updatedAt','create','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','server/files/templates/trunk.ejs','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','/etc/asterisk/sip_xcally_trunks.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','set','reject','save','update','get','Trunks','UserProfileResource','destroy','end','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0725,0x100));var _0x5072=function(_0x1fb30c,_0x3cedc6){_0x1fb30c=_0x1fb30c-0x0;var _0x53dc19=_0x0725[_0x1fb30c];return _0x53dc19;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5072('0x0'));var rimraf=require(_0x5072('0x1'));var zipdir=require(_0x5072('0x2'));var jsonpatch=require(_0x5072('0x3'));var rp=require(_0x5072('0x4'));var moment=require('moment');var BPromise=require(_0x5072('0x5'));var Mustache=require(_0x5072('0x6'));var util=require(_0x5072('0x7'));var path=require(_0x5072('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5072('0x9'));var squel=require(_0x5072('0xa'));var crypto=require('crypto');var jsforce=require(_0x5072('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5072('0xc'));var querystring=require(_0x5072('0xd'));var Papa=require(_0x5072('0xe'));var Redis=require(_0x5072('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5072('0x10'));var hardwareService=require(_0x5072('0x11'));var logger=require(_0x5072('0x12'))('api');var utils=require(_0x5072('0x13'));var config=require(_0x5072('0x14'));var licenseUtil=require(_0x5072('0x15'));var db=require(_0x5072('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x5072('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x3a1c0e,_0x3fda2e,_0x587086,_0x4a6c24){return new BPromise(function(_0x394537,_0x5d3cea){var _0xf28ebc=_0x4a6c24||client;return _0xf28ebc['request'](_0x3a1c0e,_0x587086)[_0x5072('0x18')](function(_0x3ee5ae){logger[_0x5072('0x19')](_0x5072('0x1a'),_0x3fda2e,_0x5072('0x1b'));logger[_0x5072('0x1c')](_0x5072('0x1d'),_0x3fda2e,_0x5072('0x1b'),JSON[_0x5072('0x1e')](_0x3ee5ae));if(_0x3ee5ae[_0x5072('0x1f')]){if(_0x3ee5ae[_0x5072('0x1f')][_0x5072('0x20')]===0x1f4){logger[_0x5072('0x1f')](_0x5072('0x1a'),_0x3fda2e,_0x3ee5ae[_0x5072('0x1f')]['message']);return _0x5d3cea(_0x3ee5ae[_0x5072('0x1f')][_0x5072('0x21')]);}logger[_0x5072('0x1f')](_0x5072('0x1a'),_0x3fda2e,_0x3ee5ae[_0x5072('0x1f')][_0x5072('0x21')]);return _0x394537(_0x3ee5ae[_0x5072('0x1f')][_0x5072('0x21')]);}else{logger[_0x5072('0x19')](_0x5072('0x1a'),_0x3fda2e,_0x5072('0x1b'));_0x394537(_0x3ee5ae[_0x5072('0x22')][_0x5072('0x21')]);}})[_0x5072('0x23')](function(_0x59419){logger['error'](_0x5072('0x1a'),_0x3fda2e,_0x59419);_0x5d3cea(_0x59419);});});}function respondWithStatusCode(_0x3abca5,_0x3a7ad8){_0x3a7ad8=_0x3a7ad8||0xcc;return function(_0x3174ab){if(_0x3174ab){return _0x3abca5[_0x5072('0x24')](_0x3a7ad8);}return _0x3abca5['status'](_0x3a7ad8)['end']();};}function respondWithResult(_0x39887c,_0x14bd30){_0x14bd30=_0x14bd30||0xc8;return function(_0x35be98){if(_0x35be98){return _0x39887c[_0x5072('0x25')](_0x14bd30)[_0x5072('0x26')](_0x35be98);}};}function respondWithFilteredResult(_0x3097bf,_0x5f2eab){return function(_0x5684be){if(_0x5684be){var _0x1017d8=_0x5684be['count'],_0x5e90b1=_0x5f2eab[_0x5072('0x27')],_0x3ee6db=_0x5f2eab[_0x5072('0x27')]+_0x5f2eab[_0x5072('0x28')],_0x378034;if(_0x3ee6db>=_0x1017d8){_0x3ee6db=_0x1017d8;_0x378034=0xc8;}else{_0x378034=0xce;}_0x3097bf['status'](_0x378034);return _0x3097bf[_0x5072('0x29')]('Content-Range',_0x5e90b1+'-'+_0x3ee6db+'/'+_0x1017d8)['json'](_0x5684be);}return null;};}function patchUpdates(_0x570bd1){return function(_0x5e9364){try{jsonpatch['apply'](_0x5e9364,_0x570bd1,!![]);}catch(_0x53ec2f){return BPromise[_0x5072('0x2a')](_0x53ec2f);}return _0x5e9364[_0x5072('0x2b')]();};}function saveUpdates(_0x5bae22,_0x17cf9e){return function(_0x1166fb){if(_0x1166fb){return _0x1166fb[_0x5072('0x2c')](_0x5bae22)['then'](function(_0x4035d5){return _0x4035d5;});}return null;};}function removeEntity(_0x554765,_0x1bab9c){return function(_0xa0d5f4){if(_0xa0d5f4){return _0xa0d5f4['destroy']()[_0x5072('0x18')](function(){var _0x357b6f=_0xa0d5f4[_0x5072('0x2d')]({'plain':!![]});var _0x3fa87e=_0x5072('0x2e');return db[_0x5072('0x2f')][_0x5072('0x30')]({'where':{'type':_0x3fa87e,'resourceId':_0x357b6f['id']}})[_0x5072('0x18')](function(){return _0xa0d5f4;});})['then'](function(){_0x554765[_0x5072('0x25')](0xcc)[_0x5072('0x31')]();});}};}function handleEntityNotFound(_0x396aac,_0x546879){return function(_0x2a0aff){if(!_0x2a0aff){_0x396aac[_0x5072('0x24')](0x194);}return _0x2a0aff;};}function handleError(_0x3f4858,_0x7b7665){_0x7b7665=_0x7b7665||0x1f4;return function(_0xd17812){logger[_0x5072('0x1f')](_0xd17812['stack']);if(_0xd17812[_0x5072('0x32')]){delete _0xd17812[_0x5072('0x32')];}_0x3f4858[_0x5072('0x25')](_0x7b7665)['send'](_0xd17812);};}exports[_0x5072('0x33')]=function(_0x294d86,_0x367569){var _0x12d249={},_0x2a86c4={},_0x3d30c0={'count':0x0,'rows':[]};var _0x3aec2e=_[_0x5072('0x34')](db['Trunk'][_0x5072('0x35')],function(_0x135e6d){return{'name':_0x135e6d[_0x5072('0x36')],'type':_0x135e6d[_0x5072('0x37')][_0x5072('0x38')]};});_0x2a86c4[_0x5072('0x39')]=_[_0x5072('0x34')](_0x3aec2e,_0x5072('0x32'));_0x2a86c4[_0x5072('0x3a')]=_[_0x5072('0x3b')](_0x294d86[_0x5072('0x3a')]);_0x2a86c4[_0x5072('0x3c')]=_['intersection'](_0x2a86c4['model'],_0x2a86c4[_0x5072('0x3a')]);_0x12d249['attributes']=_[_0x5072('0x3d')](_0x2a86c4[_0x5072('0x39')],qs[_0x5072('0x3e')](_0x294d86['query'][_0x5072('0x3e')]));_0x12d249['attributes']=_0x12d249['attributes'][_0x5072('0x3f')]?_0x12d249[_0x5072('0x40')]:_0x2a86c4[_0x5072('0x39')];if(!_0x294d86['query'][_0x5072('0x41')](_0x5072('0x42'))){_0x12d249[_0x5072('0x28')]=qs['limit'](_0x294d86[_0x5072('0x3a')]['limit']);_0x12d249[_0x5072('0x27')]=qs[_0x5072('0x27')](_0x294d86['query'][_0x5072('0x27')]);}_0x12d249[_0x5072('0x43')]=qs['sort'](_0x294d86[_0x5072('0x3a')][_0x5072('0x44')]);_0x12d249[_0x5072('0x45')]=qs[_0x5072('0x3c')](_['pick'](_0x294d86['query'],_0x2a86c4[_0x5072('0x3c')]),_0x3aec2e);if(_0x294d86[_0x5072('0x3a')][_0x5072('0x46')]){_0x12d249['where']=_[_0x5072('0x47')](_0x12d249[_0x5072('0x45')],{'$or':_[_0x5072('0x34')](_0x3aec2e,function(_0x128905){if(_0x128905[_0x5072('0x37')]!=='VIRTUAL'){var _0x21b64d={};_0x21b64d[_0x128905[_0x5072('0x32')]]={'$like':'%'+_0x294d86[_0x5072('0x3a')]['filter']+'%'};return _0x21b64d;}})});}_0x12d249=_[_0x5072('0x47')]({},_0x12d249,_0x294d86[_0x5072('0x48')]);var _0x1b5b69={'where':_0x12d249[_0x5072('0x45')]};return db[_0x5072('0x49')]['count'](_0x1b5b69)[_0x5072('0x18')](function(_0x461b4d){_0x3d30c0[_0x5072('0x4a')]=_0x461b4d;if(_0x294d86['query'][_0x5072('0x4b')]){_0x12d249['include']=[{'all':!![]}];}return db[_0x5072('0x49')][_0x5072('0x4c')](_0x12d249);})['then'](function(_0x288c4a){_0x3d30c0['rows']=_0x288c4a;return _0x3d30c0;})[_0x5072('0x18')](respondWithFilteredResult(_0x367569,_0x12d249))[_0x5072('0x23')](handleError(_0x367569,null));};exports[_0x5072('0x4d')]=function(_0xd43654,_0x4de21c){var _0x387da2={'raw':![],'where':{'id':_0xd43654[_0x5072('0x4e')]['id']}},_0x239341={};_0x239341[_0x5072('0x39')]=_[_0x5072('0x3b')](db['Trunk']['rawAttributes']);_0x239341['query']=_[_0x5072('0x3b')](_0xd43654['query']);_0x239341[_0x5072('0x3c')]=_[_0x5072('0x3d')](_0x239341[_0x5072('0x39')],_0x239341[_0x5072('0x3a')]);_0x387da2['attributes']=_[_0x5072('0x3d')](_0x239341[_0x5072('0x39')],qs[_0x5072('0x3e')](_0xd43654[_0x5072('0x3a')][_0x5072('0x3e')]));_0x387da2['attributes']=_0x387da2[_0x5072('0x40')][_0x5072('0x3f')]?_0x387da2[_0x5072('0x40')]:_0x239341[_0x5072('0x39')];if(_0xd43654[_0x5072('0x3a')]['includeAll']){_0x387da2['include']=[{'all':!![]}];}_0x387da2=_['merge']({},_0x387da2,_0xd43654[_0x5072('0x48')]);return db[_0x5072('0x49')]['find'](_0x387da2)[_0x5072('0x18')](handleEntityNotFound(_0x4de21c,null))[_0x5072('0x18')](respondWithResult(_0x4de21c,null))[_0x5072('0x23')](handleError(_0x4de21c,null));};exports[_0x5072('0x4f')]=function(_0x29c249,_0x55aa42){var _0x1fd670={'where':{'id':_0x29c249[_0x5072('0x4e')]['id']}},_0x52fe72={};_0x52fe72[_0x5072('0x39')]=_['keys'](db[_0x5072('0x49')][_0x5072('0x35')]);_0x1fd670[_0x5072('0x40')]=_[_0x5072('0x3d')](_0x52fe72[_0x5072('0x39')],qs[_0x5072('0x3e')](_0x29c249[_0x5072('0x3a')][_0x5072('0x3e')]));_0x1fd670[_0x5072('0x40')]=_0x1fd670[_0x5072('0x40')][_0x5072('0x3f')]?_0x1fd670[_0x5072('0x40')]:_0x52fe72[_0x5072('0x39')];if(_0x29c249['query'][_0x5072('0x4b')]){_0x1fd670[_0x5072('0x50')]=[{'all':!![]}];}_0x1fd670=_[_0x5072('0x47')]({},_0x1fd670,_0x29c249['options']);return db[_0x5072('0x49')][_0x5072('0x51')](_0x1fd670)[_0x5072('0x18')](handleEntityNotFound(_0x55aa42,null))[_0x5072('0x18')](function(_0x2c93d9){if(_0x2c93d9){var _0x5affce=_0x2c93d9[_0x5072('0x2d')]({'plain':!![]});_0x5affce=qs[_0x5072('0x52')](_0x5affce,['id',_0x5072('0x53'),'updatedAt']);_0x29c249[_0x5072('0x54')]=_[_0x5072('0x52')](_0x29c249[_0x5072('0x54')],['id','createdAt',_0x5072('0x55')]);return db[_0x5072('0x49')][_0x5072('0x56')](_[_0x5072('0x47')](_0x5affce,_0x29c249[_0x5072('0x54')]),{'include':_0x29c249['query'][_0x5072('0x4b')]?[{'all':!![]}]:undefined})[_0x5072('0x18')](function(_0x5ee8a6){var _0x2adf65=_0x29c249['user'][_0x5072('0x2d')]({'plain':!![]});if(!_0x2adf65)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2adf65[_0x5072('0x57')]==='user'){var _0x5ada8c=_0x5ee8a6['get']({'plain':!![]});var _0x3d9b2d='Trunks';return db[_0x5072('0x58')][_0x5072('0x51')]({'where':{'name':_0x3d9b2d,'userProfileId':_0x2adf65[_0x5072('0x59')]},'raw':!![]})[_0x5072('0x18')](function(_0x22fb1c){if(_0x22fb1c&&_0x22fb1c[_0x5072('0x5a')]===0x0){return db[_0x5072('0x2f')][_0x5072('0x56')]({'name':_0x5ada8c[_0x5072('0x32')],'resourceId':_0x5ada8c['id'],'type':_0x22fb1c[_0x5072('0x32')],'sectionId':_0x22fb1c['id']},{})[_0x5072('0x18')](function(){return _0x5ee8a6;});}else{return _0x5ee8a6;}})[_0x5072('0x23')](function(_0x54a0f5){logger[_0x5072('0x1f')](_0x5072('0x5b'),_0x54a0f5);throw _0x54a0f5;});}return _0x5ee8a6;});}})[_0x5072('0x18')](respondWithResult(_0x55aa42,0xc9))['catch'](handleError(_0x55aa42,null));};exports['create']=function(_0x54a25d,_0x47a596,_0x5f242b){var _0x3bf703;return db[_0x5072('0x49')][_0x5072('0x56')](_0x54a25d['body'],{'raw':!![]})[_0x5072('0x18')](function(_0x463168){_0x3bf703=_0x463168;return db[_0x5072('0x49')][_0x5072('0x4c')]({'raw':!![]});})[_0x5072('0x18')](function(_0x5b5b4a){var _0x4f75fc=fs[_0x5072('0x5c')](path['join'](config[_0x5072('0x5d')],_0x5072('0x5e')),_0x5072('0x5f'));var _0x4206ff=fs[_0x5072('0x5c')](path[_0x5072('0x60')](config[_0x5072('0x5d')],_0x5072('0x61')),_0x5072('0x5f'));var _0x534d3f=ejs[_0x5072('0x62')](_0x4f75fc,{'trunks':_0x5b5b4a||[]});fs[_0x5072('0x63')]('/etc/asterisk/sip_xcally_trunks.conf',_0x534d3f);if(_0x3bf703[_0x5072('0x64')]){var _0x4a8d69=ejs[_0x5072('0x62')](_0x4206ff,{'trunks':_0x5b5b4a||[]});fs[_0x5072('0x63')](_0x5072('0x65'),_0x4a8d69);}})[_0x5072('0x18')](function(){return respondWithRpcPromise(_0x5072('0x66'),_0x5072('0x56'),{'module':_0x5072('0x67')});})[_0x5072('0x18')](function(){var _0x3b8ec3=_0x54a25d[_0x5072('0x68')][_0x5072('0x2d')]({'plain':!![]});if(!_0x3b8ec3)throw new Error(_0x5072('0x69'));if(_0x3b8ec3[_0x5072('0x57')]===_0x5072('0x68')){var _0x58805b=_0x3bf703[_0x5072('0x2d')]({'plain':!![]});return db[_0x5072('0x58')]['find']({'where':{'name':'Trunks','userProfileId':_0x3b8ec3[_0x5072('0x59')]},'raw':!![]})[_0x5072('0x18')](function(_0x3d0fa9){if(_0x3d0fa9&&_0x3d0fa9[_0x5072('0x5a')]===0x0){return db[_0x5072('0x2f')]['create']({'name':_0x58805b[_0x5072('0x32')],'resourceId':_0x58805b['id'],'type':_0x3d0fa9['name'],'sectionId':_0x3d0fa9['id']},{})['then'](function(){return _0x3bf703;});}else{return _0x3bf703;}})['catch'](function(_0x35df22){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35df22);throw _0x35df22;});}return _0x3bf703;})[_0x5072('0x18')](respondWithResult(_0x47a596,0xc9))['catch'](handleError(_0x47a596,null));};exports[_0x5072('0x2c')]=function(_0x9ab69d,_0x2e4be,_0x46c01d){var _0x376e17;return db['Trunk'][_0x5072('0x51')]({'where':{'id':_0x9ab69d['params']['id']}})[_0x5072('0x18')](handleEntityNotFound(_0x2e4be,null))[_0x5072('0x18')](saveUpdates(_0x9ab69d['body'],null))[_0x5072('0x18')](function(_0x2a6f65){if(_0x2a6f65){_0x376e17=_0x2a6f65;return db['Trunk']['findAll']({'raw':!![]});}})[_0x5072('0x18')](function(_0x4aabeb){if(_0x4aabeb){var _0x2de111=fs['readFileSync'](path[_0x5072('0x60')](config[_0x5072('0x5d')],_0x5072('0x5e')),'utf8');var _0xb66342=fs[_0x5072('0x5c')](path[_0x5072('0x60')](config[_0x5072('0x5d')],'server/files/templates/registry.ejs'),_0x5072('0x5f'));var _0x300360=ejs['render'](_0x2de111,{'trunks':_0x4aabeb||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x300360);var _0x32b471=ejs[_0x5072('0x62')](_0xb66342,{'trunks':_0x4aabeb||[]});fs[_0x5072('0x63')](_0x5072('0x65'),_0x32b471);return respondWithRpcPromise(_0x5072('0x66'),_0x5072('0x2c'),{'module':_0x5072('0x67')});}return null;})[_0x5072('0x18')](function(_0x429383){if(_0x429383){return _0x376e17;}})[_0x5072('0x18')](respondWithResult(_0x2e4be,null))[_0x5072('0x23')](handleError(_0x2e4be,null));};exports[_0x5072('0x30')]=function(_0x84f57a,_0x254467,_0x1cbce7){var _0x4c18ea;return db[_0x5072('0x49')][_0x5072('0x51')]({'where':{'id':_0x84f57a[_0x5072('0x4e')]['id']}})[_0x5072('0x18')](handleEntityNotFound(_0x254467,null))['then'](removeEntity(_0x254467,null))[_0x5072('0x18')](function(){return db[_0x5072('0x49')][_0x5072('0x4c')]({'raw':!![]});})[_0x5072('0x18')](function(_0x1e65d2){var _0x485d69=fs['readFileSync'](path[_0x5072('0x60')](config[_0x5072('0x5d')],_0x5072('0x5e')),_0x5072('0x5f'));var _0x22921e=fs[_0x5072('0x5c')](path['join'](config[_0x5072('0x5d')],'server/files/templates/registry.ejs'),_0x5072('0x5f'));var _0x478254=ejs['render'](_0x485d69,{'trunks':_0x1e65d2});var _0x29d353=ejs[_0x5072('0x62')](_0x22921e,{'trunks':_0x1e65d2});fs['writeFileSync'](_0x5072('0x6a'),_0x478254);fs[_0x5072('0x63')](_0x5072('0x65'),_0x29d353);return respondWithRpcPromise('Reload',_0x5072('0x30'),{'module':_0x5072('0x67')});})['catch'](handleError(_0x254467,null));}; \ No newline at end of file +var _0xa8df=['stringify','error','code','Trunk,\x20%s,\x20%s','message','info','result','status','end','json','count','offset','Content-Range','apply','reject','update','destroy','get','Trunks','UserProfileResource','stack','name','map','Trunk','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','include','find','omit','createdAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','server/files/templates/trunk.ejs','utf8','root','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','UserProfileSection','join','server/files/templates/registry.ejs','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa8df,0x126));var _0xfa8d=function(_0x473da,_0x1b7f25){_0x473da=_0x473da-0x0;var _0xd6a05e=_0xa8df[_0x473da];return _0xd6a05e;};'use strict';var pdf=require(_0xfa8d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfa8d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfa8d('0x2'));var moment=require(_0xfa8d('0x3'));var BPromise=require(_0xfa8d('0x4'));var Mustache=require(_0xfa8d('0x5'));var util=require(_0xfa8d('0x6'));var path=require(_0xfa8d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfa8d('0x8'));var fs=require('fs');var _=require(_0xfa8d('0x9'));var squel=require(_0xfa8d('0xa'));var crypto=require(_0xfa8d('0xb'));var jsforce=require(_0xfa8d('0xc'));var deskjs=require(_0xfa8d('0xd'));var toCsv=require(_0xfa8d('0xe'));var querystring=require(_0xfa8d('0xf'));var Papa=require(_0xfa8d('0x10'));var Redis=require(_0xfa8d('0x11'));var authService=require(_0xfa8d('0x12'));var qs=require(_0xfa8d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa8d('0x14'));var logger=require('../../config/logger')(_0xfa8d('0x15'));var utils=require(_0xfa8d('0x16'));var config=require(_0xfa8d('0x17'));var licenseUtil=require(_0xfa8d('0x18'));var db=require(_0xfa8d('0x19'))['db'];var jayson=require(_0xfa8d('0x1a'));var client=jayson[_0xfa8d('0x1b')][_0xfa8d('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x22cf19,_0x1ea86e,_0x2c6928,_0x440a16){return new BPromise(function(_0x446f00,_0x208b11){var _0x43faf3=_0x440a16||client;return _0x43faf3[_0xfa8d('0x1d')](_0x22cf19,_0x2c6928)[_0xfa8d('0x1e')](function(_0x4a1782){logger['info']('Trunk,\x20%s,\x20%s',_0x1ea86e,_0xfa8d('0x1f'));logger[_0xfa8d('0x20')]('Trunk,\x20%s,\x20%s,\x20%s',_0x1ea86e,_0xfa8d('0x1f'),JSON[_0xfa8d('0x21')](_0x4a1782));if(_0x4a1782[_0xfa8d('0x22')]){if(_0x4a1782[_0xfa8d('0x22')][_0xfa8d('0x23')]===0x1f4){logger[_0xfa8d('0x22')](_0xfa8d('0x24'),_0x1ea86e,_0x4a1782['error'][_0xfa8d('0x25')]);return _0x208b11(_0x4a1782['error'][_0xfa8d('0x25')]);}logger[_0xfa8d('0x22')](_0xfa8d('0x24'),_0x1ea86e,_0x4a1782['error']['message']);return _0x446f00(_0x4a1782[_0xfa8d('0x22')][_0xfa8d('0x25')]);}else{logger[_0xfa8d('0x26')](_0xfa8d('0x24'),_0x1ea86e,_0xfa8d('0x1f'));_0x446f00(_0x4a1782[_0xfa8d('0x27')][_0xfa8d('0x25')]);}})['catch'](function(_0x1cc068){logger[_0xfa8d('0x22')](_0xfa8d('0x24'),_0x1ea86e,_0x1cc068);_0x208b11(_0x1cc068);});});}function respondWithStatusCode(_0x5698f2,_0x360d8d){_0x360d8d=_0x360d8d||0xcc;return function(_0xdf1c8d){if(_0xdf1c8d){return _0x5698f2['sendStatus'](_0x360d8d);}return _0x5698f2[_0xfa8d('0x28')](_0x360d8d)[_0xfa8d('0x29')]();};}function respondWithResult(_0x3dfa0c,_0x184bc9){_0x184bc9=_0x184bc9||0xc8;return function(_0x467489){if(_0x467489){return _0x3dfa0c[_0xfa8d('0x28')](_0x184bc9)[_0xfa8d('0x2a')](_0x467489);}};}function respondWithFilteredResult(_0x34662d,_0x5f299a){return function(_0x1fb2e0){if(_0x1fb2e0){var _0x59e6d8=_0x1fb2e0[_0xfa8d('0x2b')],_0x5221b0=_0x5f299a[_0xfa8d('0x2c')],_0x4a2e9f=_0x5f299a[_0xfa8d('0x2c')]+_0x5f299a['limit'],_0x3eb35d;if(_0x4a2e9f>=_0x59e6d8){_0x4a2e9f=_0x59e6d8;_0x3eb35d=0xc8;}else{_0x3eb35d=0xce;}_0x34662d[_0xfa8d('0x28')](_0x3eb35d);return _0x34662d['set'](_0xfa8d('0x2d'),_0x5221b0+'-'+_0x4a2e9f+'/'+_0x59e6d8)[_0xfa8d('0x2a')](_0x1fb2e0);}return null;};}function patchUpdates(_0x4b18a4){return function(_0x27bad0){try{jsonpatch[_0xfa8d('0x2e')](_0x27bad0,_0x4b18a4,!![]);}catch(_0x2ea9c3){return BPromise[_0xfa8d('0x2f')](_0x2ea9c3);}return _0x27bad0['save']();};}function saveUpdates(_0x3e4850,_0x2df5b5){return function(_0x14efb0){if(_0x14efb0){return _0x14efb0[_0xfa8d('0x30')](_0x3e4850)[_0xfa8d('0x1e')](function(_0x417eb9){return _0x417eb9;});}return null;};}function removeEntity(_0x5249fd,_0x40d920){return function(_0x310ab5){if(_0x310ab5){return _0x310ab5[_0xfa8d('0x31')]()[_0xfa8d('0x1e')](function(){var _0x455853=_0x310ab5[_0xfa8d('0x32')]({'plain':!![]});var _0x12bac8=_0xfa8d('0x33');return db[_0xfa8d('0x34')]['destroy']({'where':{'type':_0x12bac8,'resourceId':_0x455853['id']}})[_0xfa8d('0x1e')](function(){return _0x310ab5;});})[_0xfa8d('0x1e')](function(){_0x5249fd['status'](0xcc)[_0xfa8d('0x29')]();});}};}function handleEntityNotFound(_0xe6d0c7,_0x5d4325){return function(_0x52baed){if(!_0x52baed){_0xe6d0c7['sendStatus'](0x194);}return _0x52baed;};}function handleError(_0x350c5a,_0x2b399f){_0x2b399f=_0x2b399f||0x1f4;return function(_0x52455d){logger[_0xfa8d('0x22')](_0x52455d[_0xfa8d('0x35')]);if(_0x52455d['name']){delete _0x52455d[_0xfa8d('0x36')];}_0x350c5a[_0xfa8d('0x28')](_0x2b399f)['send'](_0x52455d);};}exports['index']=function(_0x368e62,_0x20caa5){var _0x39c1eb={},_0x3d1e3e={},_0x54bd34={'count':0x0,'rows':[]};var _0x181823=_[_0xfa8d('0x37')](db[_0xfa8d('0x38')][_0xfa8d('0x39')],function(_0x19b655){return{'name':_0x19b655[_0xfa8d('0x3a')],'type':_0x19b655[_0xfa8d('0x3b')]['key']};});_0x3d1e3e[_0xfa8d('0x3c')]=_['map'](_0x181823,_0xfa8d('0x36'));_0x3d1e3e[_0xfa8d('0x3d')]=_[_0xfa8d('0x3e')](_0x368e62[_0xfa8d('0x3d')]);_0x3d1e3e[_0xfa8d('0x3f')]=_[_0xfa8d('0x40')](_0x3d1e3e[_0xfa8d('0x3c')],_0x3d1e3e[_0xfa8d('0x3d')]);_0x39c1eb[_0xfa8d('0x41')]=_['intersection'](_0x3d1e3e[_0xfa8d('0x3c')],qs[_0xfa8d('0x42')](_0x368e62[_0xfa8d('0x3d')]['fields']));_0x39c1eb[_0xfa8d('0x41')]=_0x39c1eb[_0xfa8d('0x41')][_0xfa8d('0x43')]?_0x39c1eb[_0xfa8d('0x41')]:_0x3d1e3e['model'];if(!_0x368e62['query'][_0xfa8d('0x44')](_0xfa8d('0x45'))){_0x39c1eb['limit']=qs[_0xfa8d('0x46')](_0x368e62[_0xfa8d('0x3d')][_0xfa8d('0x46')]);_0x39c1eb[_0xfa8d('0x2c')]=qs[_0xfa8d('0x2c')](_0x368e62[_0xfa8d('0x3d')]['offset']);}_0x39c1eb[_0xfa8d('0x47')]=qs[_0xfa8d('0x48')](_0x368e62[_0xfa8d('0x3d')][_0xfa8d('0x48')]);_0x39c1eb[_0xfa8d('0x49')]=qs[_0xfa8d('0x3f')](_[_0xfa8d('0x4a')](_0x368e62[_0xfa8d('0x3d')],_0x3d1e3e[_0xfa8d('0x3f')]),_0x181823);if(_0x368e62[_0xfa8d('0x3d')][_0xfa8d('0x4b')]){_0x39c1eb[_0xfa8d('0x49')]=_[_0xfa8d('0x4c')](_0x39c1eb[_0xfa8d('0x49')],{'$or':_['map'](_0x181823,function(_0x56b0de){if(_0x56b0de[_0xfa8d('0x3b')]!=='VIRTUAL'){var _0x141539={};_0x141539[_0x56b0de[_0xfa8d('0x36')]]={'$like':'%'+_0x368e62['query'][_0xfa8d('0x4b')]+'%'};return _0x141539;}})});}_0x39c1eb=_[_0xfa8d('0x4c')]({},_0x39c1eb,_0x368e62[_0xfa8d('0x4d')]);var _0x33d5d9={'where':_0x39c1eb[_0xfa8d('0x49')]};return db[_0xfa8d('0x38')][_0xfa8d('0x2b')](_0x33d5d9)[_0xfa8d('0x1e')](function(_0x84a64c){_0x54bd34[_0xfa8d('0x2b')]=_0x84a64c;if(_0x368e62['query'][_0xfa8d('0x4e')]){_0x39c1eb['include']=[{'all':!![]}];}return db['Trunk'][_0xfa8d('0x4f')](_0x39c1eb);})[_0xfa8d('0x1e')](function(_0x1d8f9b){_0x54bd34[_0xfa8d('0x50')]=_0x1d8f9b;return _0x54bd34;})[_0xfa8d('0x1e')](respondWithFilteredResult(_0x20caa5,_0x39c1eb))[_0xfa8d('0x51')](handleError(_0x20caa5,null));};exports['show']=function(_0x2db59f,_0x4c4dd0){var _0xa1a7f6={'raw':![],'where':{'id':_0x2db59f[_0xfa8d('0x52')]['id']}},_0xb06432={};_0xb06432['model']=_[_0xfa8d('0x3e')](db[_0xfa8d('0x38')][_0xfa8d('0x39')]);_0xb06432[_0xfa8d('0x3d')]=_['keys'](_0x2db59f[_0xfa8d('0x3d')]);_0xb06432[_0xfa8d('0x3f')]=_[_0xfa8d('0x40')](_0xb06432[_0xfa8d('0x3c')],_0xb06432[_0xfa8d('0x3d')]);_0xa1a7f6[_0xfa8d('0x41')]=_[_0xfa8d('0x40')](_0xb06432['model'],qs[_0xfa8d('0x42')](_0x2db59f['query'][_0xfa8d('0x42')]));_0xa1a7f6[_0xfa8d('0x41')]=_0xa1a7f6[_0xfa8d('0x41')][_0xfa8d('0x43')]?_0xa1a7f6['attributes']:_0xb06432[_0xfa8d('0x3c')];if(_0x2db59f[_0xfa8d('0x3d')][_0xfa8d('0x4e')]){_0xa1a7f6[_0xfa8d('0x53')]=[{'all':!![]}];}_0xa1a7f6=_[_0xfa8d('0x4c')]({},_0xa1a7f6,_0x2db59f[_0xfa8d('0x4d')]);return db[_0xfa8d('0x38')][_0xfa8d('0x54')](_0xa1a7f6)[_0xfa8d('0x1e')](handleEntityNotFound(_0x4c4dd0,null))[_0xfa8d('0x1e')](respondWithResult(_0x4c4dd0,null))[_0xfa8d('0x51')](handleError(_0x4c4dd0,null));};exports['clone']=function(_0x13e00a,_0x214f1f){var _0x73f309={'where':{'id':_0x13e00a[_0xfa8d('0x52')]['id']}},_0x1b84b5={};_0x1b84b5['model']=_[_0xfa8d('0x3e')](db[_0xfa8d('0x38')][_0xfa8d('0x39')]);_0x73f309[_0xfa8d('0x41')]=_[_0xfa8d('0x40')](_0x1b84b5[_0xfa8d('0x3c')],qs[_0xfa8d('0x42')](_0x13e00a[_0xfa8d('0x3d')]['fields']));_0x73f309[_0xfa8d('0x41')]=_0x73f309[_0xfa8d('0x41')][_0xfa8d('0x43')]?_0x73f309[_0xfa8d('0x41')]:_0x1b84b5['model'];if(_0x13e00a[_0xfa8d('0x3d')][_0xfa8d('0x4e')]){_0x73f309[_0xfa8d('0x53')]=[{'all':!![]}];}_0x73f309=_[_0xfa8d('0x4c')]({},_0x73f309,_0x13e00a[_0xfa8d('0x4d')]);return db[_0xfa8d('0x38')][_0xfa8d('0x54')](_0x73f309)[_0xfa8d('0x1e')](handleEntityNotFound(_0x214f1f,null))['then'](function(_0x2618b4){if(_0x2618b4){var _0x2ff354=_0x2618b4[_0xfa8d('0x32')]({'plain':!![]});_0x2ff354=qs[_0xfa8d('0x55')](_0x2ff354,['id',_0xfa8d('0x56'),'updatedAt']);_0x13e00a['body']=_[_0xfa8d('0x55')](_0x13e00a[_0xfa8d('0x57')],['id','createdAt','updatedAt']);return db[_0xfa8d('0x38')][_0xfa8d('0x58')](_['merge'](_0x2ff354,_0x13e00a[_0xfa8d('0x57')]),{'include':_0x13e00a['query']['includeAll']?[{'all':!![]}]:undefined})[_0xfa8d('0x1e')](function(_0x274012){var _0x37811e=_0x13e00a[_0xfa8d('0x59')][_0xfa8d('0x32')]({'plain':!![]});if(!_0x37811e)throw new Error(_0xfa8d('0x5a'));if(_0x37811e['role']===_0xfa8d('0x59')){var _0x146903=_0x274012[_0xfa8d('0x32')]({'plain':!![]});var _0x4d9500=_0xfa8d('0x33');return db['UserProfileSection'][_0xfa8d('0x54')]({'where':{'name':_0x4d9500,'userProfileId':_0x37811e[_0xfa8d('0x5b')]},'raw':!![]})[_0xfa8d('0x1e')](function(_0x4f63dc){if(_0x4f63dc&&_0x4f63dc[_0xfa8d('0x5c')]===0x0){return db[_0xfa8d('0x34')][_0xfa8d('0x58')]({'name':_0x146903[_0xfa8d('0x36')],'resourceId':_0x146903['id'],'type':_0x4f63dc[_0xfa8d('0x36')],'sectionId':_0x4f63dc['id']},{})['then'](function(){return _0x274012;});}else{return _0x274012;}})['catch'](function(_0x1460ba){logger['error'](_0xfa8d('0x5d'),_0x1460ba);throw _0x1460ba;});}return _0x274012;});}})[_0xfa8d('0x1e')](respondWithResult(_0x214f1f,0xc9))[_0xfa8d('0x51')](handleError(_0x214f1f,null));};exports['create']=function(_0x41803b,_0x2db95f,_0x3bc214){var _0x5850d6;return db[_0xfa8d('0x38')][_0xfa8d('0x58')](_0x41803b['body'],{'raw':!![]})['then'](function(_0x24013a){_0x5850d6=_0x24013a;return db[_0xfa8d('0x38')]['findAll']({'raw':!![]});})[_0xfa8d('0x1e')](function(_0x4fbb58){var _0x29780a=fs[_0xfa8d('0x5e')](path['join'](config['root'],_0xfa8d('0x5f')),_0xfa8d('0x60'));var _0x5ee0fa=fs[_0xfa8d('0x5e')](path['join'](config[_0xfa8d('0x61')],'server/files/templates/registry.ejs'),_0xfa8d('0x60'));var _0x11746e=ejs['render'](_0x29780a,{'trunks':_0x4fbb58||[]});fs[_0xfa8d('0x62')](_0xfa8d('0x63'),_0x11746e);if(_0x5850d6[_0xfa8d('0x64')]){var _0xb6d1fb=ejs[_0xfa8d('0x65')](_0x5ee0fa,{'trunks':_0x4fbb58||[]});fs[_0xfa8d('0x62')](_0xfa8d('0x66'),_0xb6d1fb);}})[_0xfa8d('0x1e')](function(){return respondWithRpcPromise(_0xfa8d('0x67'),_0xfa8d('0x58'),{'module':_0xfa8d('0x68')});})[_0xfa8d('0x1e')](function(){var _0x1d6548=_0x41803b['user'][_0xfa8d('0x32')]({'plain':!![]});if(!_0x1d6548)throw new Error(_0xfa8d('0x5a'));if(_0x1d6548[_0xfa8d('0x69')]===_0xfa8d('0x59')){var _0x3e1ef4=_0x5850d6[_0xfa8d('0x32')]({'plain':!![]});return db[_0xfa8d('0x6a')][_0xfa8d('0x54')]({'where':{'name':'Trunks','userProfileId':_0x1d6548[_0xfa8d('0x5b')]},'raw':!![]})[_0xfa8d('0x1e')](function(_0x11a150){if(_0x11a150&&_0x11a150['autoAssociation']===0x0){return db[_0xfa8d('0x34')][_0xfa8d('0x58')]({'name':_0x3e1ef4[_0xfa8d('0x36')],'resourceId':_0x3e1ef4['id'],'type':_0x11a150[_0xfa8d('0x36')],'sectionId':_0x11a150['id']},{})[_0xfa8d('0x1e')](function(){return _0x5850d6;});}else{return _0x5850d6;}})[_0xfa8d('0x51')](function(_0x1fd11b){logger[_0xfa8d('0x22')](_0xfa8d('0x5d'),_0x1fd11b);throw _0x1fd11b;});}return _0x5850d6;})['then'](respondWithResult(_0x2db95f,0xc9))[_0xfa8d('0x51')](handleError(_0x2db95f,null));};exports[_0xfa8d('0x30')]=function(_0x1bd83b,_0x24971a,_0x224749){var _0x33b07d;return db['Trunk']['find']({'where':{'id':_0x1bd83b[_0xfa8d('0x52')]['id']}})[_0xfa8d('0x1e')](handleEntityNotFound(_0x24971a,null))[_0xfa8d('0x1e')](saveUpdates(_0x1bd83b[_0xfa8d('0x57')],null))[_0xfa8d('0x1e')](function(_0x32267b){if(_0x32267b){_0x33b07d=_0x32267b;return db[_0xfa8d('0x38')][_0xfa8d('0x4f')]({'raw':!![]});}})[_0xfa8d('0x1e')](function(_0x1c2e32){if(_0x1c2e32){var _0x499bf3=fs[_0xfa8d('0x5e')](path[_0xfa8d('0x6b')](config[_0xfa8d('0x61')],'server/files/templates/trunk.ejs'),_0xfa8d('0x60'));var _0x1146bd=fs[_0xfa8d('0x5e')](path[_0xfa8d('0x6b')](config[_0xfa8d('0x61')],_0xfa8d('0x6c')),'utf8');var _0x39aeb5=ejs[_0xfa8d('0x65')](_0x499bf3,{'trunks':_0x1c2e32||[]});fs[_0xfa8d('0x62')](_0xfa8d('0x63'),_0x39aeb5);var _0x19bf09=ejs[_0xfa8d('0x65')](_0x1146bd,{'trunks':_0x1c2e32||[]});fs[_0xfa8d('0x62')](_0xfa8d('0x66'),_0x19bf09);return respondWithRpcPromise('Reload',_0xfa8d('0x30'),{'module':_0xfa8d('0x68')});}return null;})[_0xfa8d('0x1e')](function(_0x47bd5e){if(_0x47bd5e){return _0x33b07d;}})[_0xfa8d('0x1e')](respondWithResult(_0x24971a,null))[_0xfa8d('0x51')](handleError(_0x24971a,null));};exports[_0xfa8d('0x31')]=function(_0x46a18c,_0x267757,_0x3e87dd){var _0x1efd48;return db[_0xfa8d('0x38')]['find']({'where':{'id':_0x46a18c['params']['id']}})[_0xfa8d('0x1e')](handleEntityNotFound(_0x267757,null))[_0xfa8d('0x1e')](removeEntity(_0x267757,null))[_0xfa8d('0x1e')](function(){return db[_0xfa8d('0x38')][_0xfa8d('0x4f')]({'raw':!![]});})['then'](function(_0x39a4d4){var _0x39db00=fs[_0xfa8d('0x5e')](path[_0xfa8d('0x6b')](config[_0xfa8d('0x61')],_0xfa8d('0x5f')),_0xfa8d('0x60'));var _0x991d05=fs[_0xfa8d('0x5e')](path[_0xfa8d('0x6b')](config[_0xfa8d('0x61')],'server/files/templates/registry.ejs'),_0xfa8d('0x60'));var _0x2052b7=ejs['render'](_0x39db00,{'trunks':_0x39a4d4});var _0x5a2af1=ejs[_0xfa8d('0x65')](_0x991d05,{'trunks':_0x39a4d4});fs[_0xfa8d('0x62')](_0xfa8d('0x63'),_0x2052b7);fs[_0xfa8d('0x62')]('/etc/asterisk/sip_xcally_registers.conf',_0x5a2af1);return respondWithRpcPromise('Reload',_0xfa8d('0x31'),{'module':_0xfa8d('0x68')});})[_0xfa8d('0x51')](handleError(_0x267757,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index f22f4a4..6cc749b 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 _0xad38=['request-promise','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment'];(function(_0x1d154e,_0x5797c4){var _0x32ecbe=function(_0x480430){while(--_0x480430){_0x1d154e['push'](_0x1d154e['shift']());}};_0x32ecbe(++_0x5797c4);}(_0xad38,0x14d));var _0x8ad3=function(_0x4fd444,_0x26f6fc){_0x4fd444=_0x4fd444-0x0;var _0x9f830=_0xad38[_0x4fd444];return _0x9f830;};'use strict';var _=require(_0x8ad3('0x0'));var util=require(_0x8ad3('0x1'));var logger=require(_0x8ad3('0x2'))(_0x8ad3('0x3'));var moment=require(_0x8ad3('0x4'));var BPromise=require('bluebird');var rp=require(_0x8ad3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ad3('0x6'));var config=require(_0x8ad3('0x7'));var attributes=require(_0x8ad3('0x8'));module[_0x8ad3('0x9')]=function(_0x545978,_0x4fefb6){return _0x545978[_0x8ad3('0xa')](_0x8ad3('0xb'),attributes,{'tableName':_0x8ad3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf60=['./trunk.attributes','exports','define','Trunk','tools_trunks','util','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x9eaec5,_0x2e8c12){var _0x4b3002=function(_0x19e92b){while(--_0x19e92b){_0x9eaec5['push'](_0x9eaec5['shift']());}};_0x4b3002(++_0x2e8c12);}(_0xbf60,0x102));var _0x0bf6=function(_0x39d6a8,_0xc9c91a){_0x39d6a8=_0x39d6a8-0x0;var _0x93f3db=_0xbf60[_0x39d6a8];return _0x93f3db;};'use strict';var _=require('lodash');var util=require(_0x0bf6('0x0'));var logger=require(_0x0bf6('0x1'))(_0x0bf6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0bf6('0x3'));var rimraf=require(_0x0bf6('0x4'));var config=require(_0x0bf6('0x5'));var attributes=require(_0x0bf6('0x6'));module[_0x0bf6('0x7')]=function(_0xc43816,_0x2c7c61){return _0xc43816[_0x0bf6('0x8')](_0x0bf6('0x9'),attributes,{'tableName':_0x0bf6('0xa'),'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 0c32727..5616eb3 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 _0x8603=['result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowTrunk','debug','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x2befd5,_0x3c573e){var _0x58cf3e=function(_0xe6b78e){while(--_0xe6b78e){_0x2befd5['push'](_0x2befd5['shift']());}};_0x58cf3e(++_0x3c573e);}(_0x8603,0x190));var _0x3860=function(_0x1c3c85,_0x4d5e12){_0x1c3c85=_0x1c3c85-0x0;var _0x5d504a=_0x8603[_0x1c3c85];return _0x5d504a;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});}exports[_0x3860('0x12')]=function(_0x45b799){var _0x4b6b15=this;return new Promise(function(_0x4863bd,_0x373b06){return db[_0x3860('0x13')][_0x3860('0x14')]({'raw':_0x45b799['options']?_0x45b799[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x17')]||null:null,'attributes':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x18')]||null:null,'limit':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x19')]||null:null,'include':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x1a')]?_[_0x3860('0x1b')](_0x45b799['options'][_0x3860('0x1a')],function(_0x133093){return{'model':db[_0x133093[_0x3860('0x1c')]],'as':_0x133093['as'],'attributes':_0x133093[_0x3860('0x18')],'include':_0x133093[_0x3860('0x1a')]?_['map'](_0x133093[_0x3860('0x1a')],function(_0x568515){return{'model':db[_0x568515['model']],'as':_0x568515['as'],'attributes':_0x568515[_0x3860('0x18')],'include':_0x568515[_0x3860('0x1a')]?_['map'](_0x568515['include'],function(_0x5f42d5){return{'model':db[_0x5f42d5[_0x3860('0x1c')]],'as':_0x5f42d5['as'],'attributes':_0x5f42d5[_0x3860('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3860('0x9')](function(_0x371f3a){logger[_0x3860('0xf')](_0x3860('0x12'),_0x45b799);logger['debug']('GetTrunk',_0x45b799,JSON[_0x3860('0x1d')](_0x371f3a));_0x4863bd(_0x371f3a);})[_0x3860('0x11')](function(_0x5a9af2){logger[_0x3860('0xd')](_0x3860('0x12'),_0x5a9af2[_0x3860('0xe')],_0x45b799);_0x373b06(_0x4b6b15[_0x3860('0xd')](0x1f4,_0x5a9af2[_0x3860('0xe')]));});});};exports['ShowTrunk']=function(_0x36ae2b){var _0xf624ba=this;return new Promise(function(_0x367b14,_0x4bd90c){return db[_0x3860('0x13')]['find']({'raw':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b['options'][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b[_0x3860('0x15')]['where']||null:null,'attributes':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b[_0x3860('0x15')]['attributes']||null:null,'include':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b['options'][_0x3860('0x1a')]?_[_0x3860('0x1b')](_0x36ae2b[_0x3860('0x15')][_0x3860('0x1a')],function(_0x30dc2a){return{'model':db[_0x30dc2a[_0x3860('0x1c')]],'as':_0x30dc2a['as'],'attributes':_0x30dc2a[_0x3860('0x18')],'include':_0x30dc2a['include']?_[_0x3860('0x1b')](_0x30dc2a[_0x3860('0x1a')],function(_0x4d62e9){return{'model':db[_0x4d62e9[_0x3860('0x1c')]],'as':_0x4d62e9['as'],'attributes':_0x4d62e9[_0x3860('0x18')],'include':_0x4d62e9[_0x3860('0x1a')]?_['map'](_0x4d62e9['include'],function(_0x285b1b){return{'model':db[_0x285b1b[_0x3860('0x1c')]],'as':_0x285b1b['as'],'attributes':_0x285b1b[_0x3860('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3860('0x9')](function(_0x59271f){logger['info'](_0x3860('0x1e'),_0x36ae2b);logger[_0x3860('0x1f')](_0x3860('0x1e'),_0x36ae2b,JSON[_0x3860('0x1d')](_0x59271f));_0x367b14(_0x59271f);})[_0x3860('0x11')](function(_0x4df2a9){logger[_0x3860('0xd')](_0x3860('0x1e'),_0x4df2a9['message'],_0x36ae2b);_0x4bd90c(_0xf624ba['error'](0x1f4,_0x4df2a9[_0x3860('0xe')]));});});}; \ No newline at end of file +var _0x2032=['error','code','message','info','result','catch','GetTrunk','Trunk','options','raw','where','map','model','attributes','include','stringify','ShowTrunk','find','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4dc7d4,_0x21a542){var _0x109248=function(_0x491f78){while(--_0x491f78){_0x4dc7d4['push'](_0x4dc7d4['shift']());}};_0x109248(++_0x21a542);}(_0x2032,0xd9));var _0x2203=function(_0x3e27fd,_0x3ddacc){_0x3e27fd=_0x3e27fd-0x0;var _0x34698f=_0x2032[_0x3e27fd];return _0x34698f;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('Trunk,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('Trunk,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});}exports[_0x2203('0x14')]=function(_0x4893ff){var _0x3f9ef6=this;return new Promise(function(_0x8906e1,_0x4aeb9f){return db[_0x2203('0x15')]['findAll']({'raw':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x18')]||null:null,'attributes':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['attributes']||null:null,'limit':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['limit']||null:null,'include':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')]['include']?_[_0x2203('0x19')](_0x4893ff['options']['include'],function(_0x226374){return{'model':db[_0x226374[_0x2203('0x1a')]],'as':_0x226374['as'],'attributes':_0x226374[_0x2203('0x1b')],'include':_0x226374[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x226374[_0x2203('0x1c')],function(_0x49c12){return{'model':db[_0x49c12[_0x2203('0x1a')]],'as':_0x49c12['as'],'attributes':_0x49c12['attributes'],'include':_0x49c12[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x49c12[_0x2203('0x1c')],function(_0x5f11bf){return{'model':db[_0x5f11bf[_0x2203('0x1a')]],'as':_0x5f11bf['as'],'attributes':_0x5f11bf[_0x2203('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd6e109){logger[_0x2203('0x11')](_0x2203('0x14'),_0x4893ff);logger[_0x2203('0xd')](_0x2203('0x14'),_0x4893ff,JSON[_0x2203('0x1d')](_0xd6e109));_0x8906e1(_0xd6e109);})[_0x2203('0x13')](function(_0x5a95c1){logger[_0x2203('0xe')](_0x2203('0x14'),_0x5a95c1[_0x2203('0x10')],_0x4893ff);_0x4aeb9f(_0x3f9ef6[_0x2203('0xe')](0x1f4,_0x5a95c1['message']));});});};exports[_0x2203('0x1e')]=function(_0x21ff0d){var _0x287c95=this;return new Promise(function(_0xf59954,_0x520602){return db[_0x2203('0x15')][_0x2203('0x1f')]({'raw':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x18')]||null:null,'attributes':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d[_0x2203('0x16')][_0x2203('0x1b')]||null:null,'include':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d['options'][_0x2203('0x1c')]?_[_0x2203('0x19')](_0x21ff0d['options'][_0x2203('0x1c')],function(_0x20fbe1){return{'model':db[_0x20fbe1[_0x2203('0x1a')]],'as':_0x20fbe1['as'],'attributes':_0x20fbe1[_0x2203('0x1b')],'include':_0x20fbe1[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x20fbe1[_0x2203('0x1c')],function(_0x44228e){return{'model':db[_0x44228e[_0x2203('0x1a')]],'as':_0x44228e['as'],'attributes':_0x44228e['attributes'],'include':_0x44228e[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x44228e['include'],function(_0x54b90b){return{'model':db[_0x54b90b[_0x2203('0x1a')]],'as':_0x54b90b['as'],'attributes':_0x54b90b['attributes']};}):[]};}):[]};}):[]:[]})[_0x2203('0x20')](function(_0x3b1eeb){logger[_0x2203('0x11')]('ShowTrunk',_0x21ff0d);logger['debug'](_0x2203('0x1e'),_0x21ff0d,JSON['stringify'](_0x3b1eeb));_0xf59954(_0x3b1eeb);})[_0x2203('0x13')](function(_0x5cfe5e){logger[_0x2203('0xe')]('ShowTrunk',_0x5cfe5e[_0x2203('0x10')],_0x21ff0d);_0x520602(_0x287c95[_0x2203('0xe')](0x1f4,_0x5cfe5e[_0x2203('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 3cb4087..11ce4fb 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 _0xc875=['../../config/environment','./user.controller','get','isAuthenticated','index','describe','whoami','/:id','show','/:id/avatar','getAvatar','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','/:id/recordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/:id/contacts','addContacts','create','bulkCreate','addQueues','join','server/files/images/','format','%s-%s','now','originalname','single','addAvatar','/:id/login','login','logout','/:id/pause','pause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addChatWebsites','addSquareProjects','put','update','/:id/password','removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xc875,0x66));var _0x5c87=function(_0x118f57,_0x24dd41){_0x118f57=_0x118f57-0x0;var _0x52c794=_0xc875[_0x118f57];return _0x52c794;};'use strict';var multer=require(_0x5c87('0x0'));var util=require(_0x5c87('0x1'));var path=require(_0x5c87('0x2'));var timeout=require(_0x5c87('0x3'));var express=require(_0x5c87('0x4'));var router=express[_0x5c87('0x5')]();var auth=require(_0x5c87('0x6'));var interaction=require(_0x5c87('0x7'));var config=require(_0x5c87('0x8'));var controller=require(_0x5c87('0x9'));router[_0x5c87('0xa')]('/',auth[_0x5c87('0xb')](),controller[_0x5c87('0xc')]);router[_0x5c87('0xa')]('/describe',auth[_0x5c87('0xb')](),controller[_0x5c87('0xd')]);router[_0x5c87('0xa')]('/whoami',auth['isAuthenticated'](),controller[_0x5c87('0xe')]);router[_0x5c87('0xa')](_0x5c87('0xf'),auth['isAuthenticated'](),controller[_0x5c87('0x10')]);router[_0x5c87('0xa')](_0x5c87('0x11'),controller[_0x5c87('0x12')]);router[_0x5c87('0xa')]('/:id/contacts',auth[_0x5c87('0xb')](),controller['getContacts']);router[_0x5c87('0xa')](_0x5c87('0x13'),auth['isAuthenticated'](),controller[_0x5c87('0x14')]);router['get']('/:id/queues_rt',auth[_0x5c87('0xb')](),controller[_0x5c87('0x15')]);router[_0x5c87('0xa')](_0x5c87('0x16'),auth['isAuthenticated'](),controller['getGroups']);router[_0x5c87('0xa')](_0x5c87('0x17'),auth[_0x5c87('0xb')](),controller['getRecordings']);router[_0x5c87('0xa')](_0x5c87('0x18'),auth[_0x5c87('0xb')](),controller['getScreenRecordings']);router['get'](_0x5c87('0x19'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x1a')]);router[_0x5c87('0xa')](_0x5c87('0x1b'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x1c')]);router['get'](_0x5c87('0x1d'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x1e')]);router['get'](_0x5c87('0x1f'),auth['isAuthenticated'](),controller[_0x5c87('0x20')]);router[_0x5c87('0xa')](_0x5c87('0x21'),auth['isAuthenticated'](),controller[_0x5c87('0x22')]);router[_0x5c87('0xa')](_0x5c87('0x23'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x24')]);router['get']('/:id/teams',auth[_0x5c87('0xb')](),controller[_0x5c87('0x25')]);router[_0x5c87('0xa')](_0x5c87('0x26'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x27')]);router[_0x5c87('0xa')]('/:id/agents',auth[_0x5c87('0xb')](),controller[_0x5c87('0x28')]);router[_0x5c87('0xa')](_0x5c87('0x29'),auth[_0x5c87('0xb')](),controller['getVoicePrefixes']);router[_0x5c87('0xa')](_0x5c87('0x2a'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x2b')]);router[_0x5c87('0xa')](_0x5c87('0x2c'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x2d')]);router['get']('/:id/openchannel_accounts',auth[_0x5c87('0xb')](),controller['getOpenchannelAccounts']);router[_0x5c87('0xa')](_0x5c87('0x2e'),auth['isAuthenticated'](),controller[_0x5c87('0x2f')]);router['get'](_0x5c87('0x30'),auth['isAuthenticated'](),controller[_0x5c87('0x31')]);router['get'](_0x5c87('0x32'),auth[_0x5c87('0xb')](),controller['getWhatsappAccounts']);router['get'](_0x5c87('0x33'),auth['isAuthenticated'](),controller[_0x5c87('0x34')]);router[_0x5c87('0xa')](_0x5c87('0x35'),auth['isAuthenticated'](),controller[_0x5c87('0x36')]);router[_0x5c87('0xa')](_0x5c87('0x37'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x38')]);router[_0x5c87('0x39')](_0x5c87('0x3a'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x3b')]);router[_0x5c87('0x39')]('/',auth[_0x5c87('0xb')](),controller[_0x5c87('0x3c')]);router['post']('/create_many',auth['isAuthenticated'](),controller[_0x5c87('0x3d')]);router['post'](_0x5c87('0x13'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x3e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3937a7,_0xba46dc,_0xea8511){_0xea8511(null,path[_0x5c87('0x3f')](config['root'],_0x5c87('0x40')));},'filename':function(_0x2a585e,_0x2ecffb,_0x25e030){_0x25e030(null,util[_0x5c87('0x41')](_0x5c87('0x42'),Date[_0x5c87('0x43')](),_0x2ecffb[_0x5c87('0x44')]));}})});router['post'](_0x5c87('0x11'),upload[_0x5c87('0x45')]('file'),controller[_0x5c87('0x46')]);router[_0x5c87('0x39')](_0x5c87('0x47'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x48')]);router[_0x5c87('0x39')]('/:id/logout',auth[_0x5c87('0xb')](),controller[_0x5c87('0x49')]);router[_0x5c87('0x39')](_0x5c87('0x4a'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x4b')]);router['post']('/:id/unpause',auth[_0x5c87('0xb')](),controller[_0x5c87('0x4c')]);router['post'](_0x5c87('0x4d'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x4e')]);router[_0x5c87('0x39')](_0x5c87('0x4f'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x50')]);router[_0x5c87('0x39')](_0x5c87('0x51'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x52')]);router[_0x5c87('0x39')](_0x5c87('0x53'),auth[_0x5c87('0xb')](),controller['addFaxInteractions']);router['post'](_0x5c87('0x54'),auth['isAuthenticated'](),controller[_0x5c87('0x55')]);router[_0x5c87('0x39')](_0x5c87('0x56'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x57')]);router[_0x5c87('0x39')]('/:id/whatsapp_interactions',auth[_0x5c87('0xb')](),controller['addWhatsappInteractions']);router[_0x5c87('0x39')](_0x5c87('0x2a'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x58')]);router[_0x5c87('0x39')](_0x5c87('0x2c'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x59')]);router[_0x5c87('0x39')](_0x5c87('0x5a'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x5b')]);router[_0x5c87('0x39')](_0x5c87('0x2e'),auth[_0x5c87('0xb')](),controller['addSmsAccounts']);router[_0x5c87('0x39')](_0x5c87('0x30'),auth['isAuthenticated'](),controller[_0x5c87('0x5c')]);router[_0x5c87('0x39')](_0x5c87('0x32'),auth[_0x5c87('0xb')](),controller['addWhatsappAccounts']);router[_0x5c87('0x39')](_0x5c87('0x33'),auth['isAuthenticated'](),controller[_0x5c87('0x5d')]);router[_0x5c87('0x39')](_0x5c87('0x37'),auth[_0x5c87('0xb')](),controller['createApiKey']);router[_0x5c87('0x5e')](_0x5c87('0xf'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x5f')]);router[_0x5c87('0x5e')](_0x5c87('0x60'),auth[_0x5c87('0xb')](),controller['changePassword']);router['delete']('/:id/queues',auth[_0x5c87('0xb')](),controller[_0x5c87('0x61')]);router[_0x5c87('0x62')](_0x5c87('0x4d'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x63')]);router[_0x5c87('0x62')]('/:id',auth[_0x5c87('0xb')](),controller[_0x5c87('0x64')]);router[_0x5c87('0x62')](_0x5c87('0x4f'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x65')]);router['delete'](_0x5c87('0x51'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x66')]);router[_0x5c87('0x62')]('/:id/fax_interactions',auth[_0x5c87('0xb')](),controller['removeFaxInteractions']);router[_0x5c87('0x62')](_0x5c87('0x54'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x67')]);router['delete'](_0x5c87('0x56'),auth[_0x5c87('0xb')](),controller['removeOpenchannelInteractions']);router['delete']('/:id/whatsapp_interactions',auth[_0x5c87('0xb')](),controller[_0x5c87('0x68')]);router[_0x5c87('0x62')](_0x5c87('0x2a'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x69')]);router[_0x5c87('0x62')](_0x5c87('0x2c'),auth[_0x5c87('0xb')](),controller['removeMailAccounts']);router[_0x5c87('0x62')](_0x5c87('0x5a'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x6a')]);router['delete'](_0x5c87('0x2e'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x6b')]);router[_0x5c87('0x62')](_0x5c87('0x30'),auth[_0x5c87('0xb')](),controller['removeChatWebsites']);router[_0x5c87('0x62')](_0x5c87('0x32'),auth[_0x5c87('0xb')](),controller['removeWhatsappAccounts']);router[_0x5c87('0x62')](_0x5c87('0x33'),auth[_0x5c87('0xb')](),controller[_0x5c87('0x6c')]);router[_0x5c87('0x62')](_0x5c87('0x37'),auth['isAuthenticated'](),controller[_0x5c87('0x6d')]);module['exports']=router; \ No newline at end of file +var _0xaefc=['getLists','/:id/agents','getAgents','/:id/prefixes','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/:id/contacts','addContacts','create','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','join','root','format','%s-%s','now','single','file','addAvatar','login','/:id/logout','/:id/pause','/:id/unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/square_projects','addSquareProjects','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeFaxInteractions','/:id/sms_interactions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeChatWebsites','removeSquareProjects','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','describe','/whoami','whoami','/:id','/:id/avatar','getAvatar','getContacts','getQueues','getVoiceQueuesRt','getGroups','/:id/recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions'];(function(_0x3b8bf5,_0x5e1267){var _0x5b18f9=function(_0x489b84){while(--_0x489b84){_0x3b8bf5['push'](_0x3b8bf5['shift']());}};_0x5b18f9(++_0x5e1267);}(_0xaefc,0x184));var _0xcaef=function(_0x198a55,_0x32317c){_0x198a55=_0x198a55-0x0;var _0x49368f=_0xaefc[_0x198a55];return _0x49368f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xcaef('0x0'));var express=require(_0xcaef('0x1'));var router=express[_0xcaef('0x2')]();var auth=require(_0xcaef('0x3'));var interaction=require(_0xcaef('0x4'));var config=require(_0xcaef('0x5'));var controller=require(_0xcaef('0x6'));router[_0xcaef('0x7')]('/',auth['isAuthenticated'](),controller[_0xcaef('0x8')]);router[_0xcaef('0x7')](_0xcaef('0x9'),auth[_0xcaef('0xa')](),controller[_0xcaef('0xb')]);router[_0xcaef('0x7')](_0xcaef('0xc'),auth[_0xcaef('0xa')](),controller[_0xcaef('0xd')]);router[_0xcaef('0x7')](_0xcaef('0xe'),auth[_0xcaef('0xa')](),controller['show']);router['get'](_0xcaef('0xf'),controller[_0xcaef('0x10')]);router['get']('/:id/contacts',auth[_0xcaef('0xa')](),controller[_0xcaef('0x11')]);router[_0xcaef('0x7')]('/:id/queues',auth[_0xcaef('0xa')](),controller[_0xcaef('0x12')]);router[_0xcaef('0x7')]('/:id/queues_rt',auth[_0xcaef('0xa')](),controller[_0xcaef('0x13')]);router[_0xcaef('0x7')]('/:id/groups',auth[_0xcaef('0xa')](),controller[_0xcaef('0x14')]);router[_0xcaef('0x7')](_0xcaef('0x15'),auth[_0xcaef('0xa')](),controller['getRecordings']);router[_0xcaef('0x7')]('/:id/screen_recordings',auth[_0xcaef('0xa')](),controller[_0xcaef('0x16')]);router[_0xcaef('0x7')](_0xcaef('0x17'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x18')]);router[_0xcaef('0x7')]('/:id/openchannel/interactions',auth[_0xcaef('0xa')](),controller[_0xcaef('0x19')]);router[_0xcaef('0x7')](_0xcaef('0x1a'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x1b')]);router['get']('/:id/sms/interactions',auth[_0xcaef('0xa')](),controller['getSmsInteractions']);router[_0xcaef('0x7')](_0xcaef('0x1c'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x1d')]);router['get'](_0xcaef('0x1e'),auth['isAuthenticated'](),controller[_0xcaef('0x1f')]);router[_0xcaef('0x7')]('/:id/teams',auth[_0xcaef('0xa')](),controller['getTeams']);router[_0xcaef('0x7')]('/:id/lists',auth[_0xcaef('0xa')](),controller[_0xcaef('0x20')]);router[_0xcaef('0x7')](_0xcaef('0x21'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x22')]);router[_0xcaef('0x7')](_0xcaef('0x23'),auth[_0xcaef('0xa')](),controller['getVoicePrefixes']);router[_0xcaef('0x7')]('/:id/fax_accounts',auth[_0xcaef('0xa')](),controller['getFaxAccounts']);router['get'](_0xcaef('0x24'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x25')]);router[_0xcaef('0x7')](_0xcaef('0x26'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x27')]);router[_0xcaef('0x7')](_0xcaef('0x28'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x29')]);router[_0xcaef('0x7')](_0xcaef('0x2a'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x2b')]);router['get'](_0xcaef('0x2c'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x2d')]);router[_0xcaef('0x7')]('/:id/square_projects',auth[_0xcaef('0xa')](),controller[_0xcaef('0x2e')]);router['get'](_0xcaef('0x2f'),auth['isAuthenticated'](),controller[_0xcaef('0x30')]);router['get'](_0xcaef('0x31'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x32')]);router[_0xcaef('0x33')](_0xcaef('0x34'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x35')]);router[_0xcaef('0x33')]('/',auth[_0xcaef('0xa')](),controller[_0xcaef('0x36')]);router[_0xcaef('0x33')](_0xcaef('0x37'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x38')]);router[_0xcaef('0x33')](_0xcaef('0x39'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x3a')]);var upload=multer({'storage':multer[_0xcaef('0x3b')]({'destination':function(_0x35eabc,_0x3474da,_0x3c33f5){_0x3c33f5(null,path[_0xcaef('0x3c')](config[_0xcaef('0x3d')],'server/files/images/'));},'filename':function(_0x4df5d7,_0x4f74f7,_0x43adc2){_0x43adc2(null,util[_0xcaef('0x3e')](_0xcaef('0x3f'),Date[_0xcaef('0x40')](),_0x4f74f7['originalname']));}})});router[_0xcaef('0x33')](_0xcaef('0xf'),upload[_0xcaef('0x41')](_0xcaef('0x42')),controller[_0xcaef('0x43')]);router['post']('/:id/login',auth['isAuthenticated'](),controller[_0xcaef('0x44')]);router[_0xcaef('0x33')](_0xcaef('0x45'),auth['isAuthenticated'](),controller['logout']);router[_0xcaef('0x33')](_0xcaef('0x46'),auth[_0xcaef('0xa')](),controller['pause']);router[_0xcaef('0x33')](_0xcaef('0x47'),auth[_0xcaef('0xa')](),controller['unpause']);router[_0xcaef('0x33')](_0xcaef('0x48'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x49')]);router[_0xcaef('0x33')](_0xcaef('0x4a'),auth['isAuthenticated'](),controller[_0xcaef('0x4b')]);router[_0xcaef('0x33')](_0xcaef('0x4c'),auth['isAuthenticated'](),controller['addMailInteractions']);router[_0xcaef('0x33')]('/:id/fax_interactions',auth[_0xcaef('0xa')](),controller[_0xcaef('0x4d')]);router['post']('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xcaef('0x4e')]);router[_0xcaef('0x33')](_0xcaef('0x4f'),auth[_0xcaef('0xa')](),controller['addOpenchannelInteractions']);router[_0xcaef('0x33')](_0xcaef('0x50'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x51')]);router[_0xcaef('0x33')](_0xcaef('0x52'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x53')]);router['post'](_0xcaef('0x24'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x54')]);router[_0xcaef('0x33')]('/:id/openchannel_accounts',auth[_0xcaef('0xa')](),controller[_0xcaef('0x55')]);router[_0xcaef('0x33')](_0xcaef('0x28'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x56')]);router['post'](_0xcaef('0x2a'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x57')]);router[_0xcaef('0x33')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['addWhatsappAccounts']);router['post'](_0xcaef('0x58'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x59')]);router[_0xcaef('0x33')](_0xcaef('0x31'),auth[_0xcaef('0xa')](),controller['createApiKey']);router[_0xcaef('0x5a')](_0xcaef('0xe'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x5b')]);router[_0xcaef('0x5a')](_0xcaef('0x5c'),auth['isAuthenticated'](),controller[_0xcaef('0x5d')]);router[_0xcaef('0x5e')](_0xcaef('0x39'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x5f')]);router[_0xcaef('0x5e')](_0xcaef('0x48'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x60')]);router[_0xcaef('0x5e')](_0xcaef('0xe'),auth[_0xcaef('0xa')](),controller['destroy']);router[_0xcaef('0x5e')](_0xcaef('0x4a'),auth['isAuthenticated'](),controller[_0xcaef('0x61')]);router[_0xcaef('0x5e')]('/:id/mail_interactions',auth[_0xcaef('0xa')](),controller['removeMailInteractions']);router[_0xcaef('0x5e')]('/:id/fax_interactions',auth[_0xcaef('0xa')](),controller[_0xcaef('0x62')]);router[_0xcaef('0x5e')](_0xcaef('0x63'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router['delete'](_0xcaef('0x4f'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x64')]);router[_0xcaef('0x5e')](_0xcaef('0x50'),auth[_0xcaef('0xa')](),controller['removeWhatsappInteractions']);router[_0xcaef('0x5e')](_0xcaef('0x52'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x65')]);router[_0xcaef('0x5e')](_0xcaef('0x24'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x66')]);router[_0xcaef('0x5e')]('/:id/openchannel_accounts',auth[_0xcaef('0xa')](),controller['removeOpenchannelAccounts']);router[_0xcaef('0x5e')]('/:id/sms_accounts',auth[_0xcaef('0xa')](),controller['removeSmsAccounts']);router[_0xcaef('0x5e')](_0xcaef('0x2a'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x67')]);router[_0xcaef('0x5e')](_0xcaef('0x2c'),auth[_0xcaef('0xa')](),controller['removeWhatsappAccounts']);router['delete'](_0xcaef('0x58'),auth[_0xcaef('0xa')](),controller[_0xcaef('0x68')]);router[_0xcaef('0x5e')](_0xcaef('0x31'),auth[_0xcaef('0xa')](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index c08345d..385bb67 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 _0xe5ce=['friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','split','rfc2833','info','shortinfo','auto','yes','nonat','update','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','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','actpass','update,nonat','DATE','showWebBar','get','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','dtlsprivatekey','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','getDataValue','fullname','BOOLEAN','DEFAULT\x20PAUSE','dynamic'];(function(_0x58a875,_0x6717ed){var _0x58a561=function(_0x81d51){while(--_0x81d51){_0x58a875['push'](_0x58a875['shift']());}};_0x58a561(++_0x6717ed);}(_0xe5ce,0x14d));var _0xee5c=function(_0x2d7ff8,_0x3a3868){_0x2d7ff8=_0x2d7ff8-0x0;var _0x303872=_0xe5ce[_0x2d7ff8];return _0x303872;};'use strict';var Sequelize=require(_0xee5c('0x0'));var moment=require(_0xee5c('0x1'));var util=require(_0xee5c('0x2'));var _=require(_0xee5c('0x3'));module[_0xee5c('0x4')]={'name':{'type':Sequelize[_0xee5c('0x5')],'allowNull':![],'unique':_0xee5c('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x462e84){this['setDataValue'](_0xee5c('0x6'),_0x462e84);this[_0xee5c('0x7')]('defaultuser',_0x462e84);},'comment':_0xee5c('0x8')},'fullname':{'type':Sequelize[_0xee5c('0x5')],'allowNull':![],'set':function(_0x2ac9b0){this[_0xee5c('0x7')]('fullname',_0x2ac9b0);this[_0xee5c('0x7')](_0xee5c('0x9'),util[_0xee5c('0xa')](_0xee5c('0xb'),_0x2ac9b0,this['getDataValue'](_0xee5c('0xc'))));}},'alias':{'type':Sequelize[_0xee5c('0x5')]},'email':{'type':Sequelize[_0xee5c('0x5')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x29e806){if(_0x29e806){this[_0xee5c('0x7')](_0xee5c('0xd'),_0x29e806[_0xee5c('0xe')]());}}},'role':{'type':Sequelize[_0xee5c('0xf')](_0xee5c('0x10'),'user',_0xee5c('0x11'),_0xee5c('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0xee5c('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xee5c('0x5')],'defaultValue':_0xee5c('0x13')},'internal':{'type':Sequelize[_0xee5c('0x14')](0xb),'allowNull':![],'unique':_0xee5c('0xc'),'set':function(_0x17d121){this['setDataValue']('internal',_0x17d121);this['setDataValue'](_0xee5c('0x15'),_0x17d121);this[_0xee5c('0x7')](_0xee5c('0x9'),util[_0xee5c('0xa')](_0xee5c('0xb'),this[_0xee5c('0x16')](_0xee5c('0x17')),_0x17d121));}},'salt':{'type':Sequelize[_0xee5c('0x5')]},'phone':{'type':Sequelize[_0xee5c('0x5')]},'mobile':{'type':Sequelize[_0xee5c('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xee5c('0x5')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xee5c('0x5')],'defaultValue':_0xee5c('0x19')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xee5c('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xee5c('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xee5c('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xee5c('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xee5c('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xee5c('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xee5c('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xee5c('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![],'defaultValue':_0xee5c('0x1a')},'ipaddr':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xee5c('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xee5c('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xee5c('0xf')](_0xee5c('0x1b'),'user',_0xee5c('0x1c')),'allowNull':!![],'defaultValue':_0xee5c('0x1b')},'context':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![],'defaultValue':_0xee5c('0x1d')},'callingpres':{'type':Sequelize[_0xee5c('0xf')](_0xee5c('0x1e'),_0xee5c('0x1f'),'ALLOWED_FAILED_SCREEN',_0xee5c('0x20'),'PROHIB_NOT_SCREENED',_0xee5c('0x21'),'PROHIB_FAILED_SCREEN',_0xee5c('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xee5c('0x23'),'set':function(_0x515c99){this[_0xee5c('0x7')](_0xee5c('0x24'),_0x515c99?_0x515c99[_0xee5c('0x25')](','):null);},'get':function(){return this[_0xee5c('0x16')]('transport')?this[_0xee5c('0x16')](_0xee5c('0x24'))[_0xee5c('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0xee5c('0x27'),_0xee5c('0x28'),_0xee5c('0x29'),'inband',_0xee5c('0x2a')),'allowNull':!![],'defaultValue':_0xee5c('0x27')},'directmedia':{'type':Sequelize[_0xee5c('0xf')](_0xee5c('0x2b'),'no',_0xee5c('0x2c'),_0xee5c('0x2d'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xee5c('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![],'defaultValue':_0xee5c('0x2e'),'set':function(_0xe20f84){this[_0xee5c('0x7')](_0xee5c('0x2f'),_0xe20f84?_0xe20f84[_0xee5c('0x25')](','):null);},'get':function(){return this[_0xee5c('0x16')](_0xee5c('0x2f'))?this[_0xee5c('0x16')](_0xee5c('0x2f'))[_0xee5c('0x26')](','):null;},'comment':_0xee5c('0x30')},'callgroup':{'type':Sequelize[_0xee5c('0x5')]},'namedcallgroup':{'type':Sequelize[_0xee5c('0x5')]},'pickupgroup':{'type':Sequelize[_0xee5c('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xee5c('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xee5c('0x5')]},'disallow':{'type':Sequelize[_0xee5c('0x5')],'allowNull':![],'defaultValue':_0xee5c('0x31')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x24ac67){this[_0xee5c('0x7')](_0xee5c('0x32'),_0x24ac67?_0x24ac67['join'](';'):_0xee5c('0x33'));},'get':function(){return this[_0xee5c('0x16')](_0xee5c('0x32'))?this[_0xee5c('0x16')](_0xee5c('0x32'))[_0xee5c('0x26')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xee5c('0xf')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![],'set':function(_0x10c34d){this[_0xee5c('0x7')](_0xee5c('0x34'),_0x10c34d?_0x10c34d['join'](','):null);},'get':function(){return this[_0xee5c('0x16')](_0xee5c('0x34'))?this[_0xee5c('0x16')](_0xee5c('0x34'))[_0xee5c('0x26')](','):null;},'comment':_0xee5c('0x35')},'trustrpid':{'type':Sequelize[_0xee5c('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xee5c('0xf')](_0xee5c('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xee5c('0xf')](_0xee5c('0x2b'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xee5c('0xf')](_0xee5c('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xee5c('0xf')](_0xee5c('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xee5c('0x36')},'amaflags':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xee5c('0x2b'),'no'),'allowNull':!![],'defaultValue':_0xee5c('0x2b')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xee5c('0xf')](_0xee5c('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xee5c('0xf')](_0xee5c('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xee5c('0xf')](_0xee5c('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xee5c('0xf')](_0xee5c('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xee5c('0xf')](_0xee5c('0x2b'),'no',_0xee5c('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xee5c('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xee5c('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xee5c('0x38'),_0xee5c('0x39'),_0xee5c('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xee5c('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xee5c('0xf')](_0xee5c('0x3b'),_0xee5c('0x3c')),'allowNull':!![],'defaultValue':_0xee5c('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xee5c('0x2b'),'no'),'allowNull':!![],'defaultValue':_0xee5c('0x2b')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xee5c('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xee5c('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xee5c('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xee5c('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xee5c('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xee5c('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xee5c('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xee5c('0xf')](_0xee5c('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xee5c('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xee5c('0xf')](_0xee5c('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xee5c('0xf')](_0xee5c('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xee5c('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xee5c('0xf')]('yes','no',_0xee5c('0x3d'),_0xee5c('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xee5c('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xee5c('0xf')]('active',_0xee5c('0x3f'),_0xee5c('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xee5c('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xee5c('0xf')](_0xee5c('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xee5c('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xee5c('0xf')](_0xee5c('0x2b'),'no',_0xee5c('0x2c'),_0xee5c('0x2d'),_0xee5c('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xee5c('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xee5c('0x42')]},'passwordResetAt':{'type':Sequelize[_0xee5c('0x42')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xee5c('0x5')]},'showWebBar':{'type':Sequelize[_0xee5c('0x14')],'defaultValue':0x0,'set':function(_0x56c4e2){this[_0xee5c('0x7')](_0xee5c('0x43'),_0x56c4e2);var _0xf32c4d=this[_0xee5c('0x44')]({'plain':!![]});switch(_0x56c4e2){case 0x0:case 0x1:var _0x4557c6=_0xf32c4d[_0xee5c('0x24')]?_['isArray'](_0xf32c4d[_0xee5c('0x24')])?_0xf32c4d[_0xee5c('0x24')][_0xee5c('0x25')]():_0xf32c4d['transport']:'udp';if(_0x4557c6===_0xee5c('0x45')){_0x4557c6=_0xee5c('0x23');}this['setDataValue'](_0xee5c('0x24'),_0x4557c6);this['setDataValue'](_0xee5c('0x46'),'no');this[_0xee5c('0x7')](_0xee5c('0x47'),null);this[_0xee5c('0x7')](_0xee5c('0x48'),null);this['setDataValue'](_0xee5c('0x49'),null);this[_0xee5c('0x7')](_0xee5c('0x4a'),null);this[_0xee5c('0x7')]('dtlsverify',null);this[_0xee5c('0x7')](_0xee5c('0x4b'),null);this[_0xee5c('0x7')](_0xee5c('0x4c'),null);this[_0xee5c('0x7')]('dtlsprivatekey',null);this[_0xee5c('0x7')](_0xee5c('0x4d'),'no');break;case 0x2:this[_0xee5c('0x7')]('transport',_0xee5c('0x45'));this[_0xee5c('0x7')](_0xee5c('0x46'),_0xee5c('0x2b'));this['setDataValue'](_0xee5c('0x47'),'yes');this[_0xee5c('0x7')](_0xee5c('0x48'),_0xee5c('0x2b'));this[_0xee5c('0x7')]('icesupport',_0xee5c('0x2b'));this['setDataValue']('dtlsenable',_0xee5c('0x2b'));this[_0xee5c('0x7')]('dtlsverify','no');this[_0xee5c('0x7')](_0xee5c('0x4b'),'actpass');this['setDataValue'](_0xee5c('0x4c'),_0xf32c4d['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this[_0xee5c('0x7')](_0xee5c('0x4e'),_0xf32c4d[_0xee5c('0x4e')]||'/etc/pki/tls/private/motion.key');this[_0xee5c('0x7')](_0xee5c('0x4d'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xee5c('0x4f')],'set':function(_0x58ce26){this['setDataValue'](_0xee5c('0x50'),_0x58ce26?_0x58ce26[_0xee5c('0x25')](','):[]);},'get':function(){return this[_0xee5c('0x16')](_0xee5c('0x50'))?_[_0xee5c('0x51')](this[_0xee5c('0x16')]('permissions')[_0xee5c('0x26')](','),function(_0xb8c708){return parseInt(_0xb8c708,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xee5c('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xee5c('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xee5c('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xee5c('0xf')](_0xee5c('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xee5c('0x52')],'get':function(){return this[_0xee5c('0x16')](_0xee5c('0x53'))?this[_0xee5c('0x16')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':![]},'interface':{'type':Sequelize[_0xee5c('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xee5c('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x253b13){if(typeof _0x253b13===_0xee5c('0x54')){var _0x4756c3=_0x253b13==='1'?!![]:_0x253b13==='0'?![]:_0x253b13===_0xee5c('0x55')?!![]:_0x253b13===_0xee5c('0x56')?![]:![];this[_0xee5c('0x7')](_0xee5c('0x57'),_0x4756c3);}else{this[_0xee5c('0x7')](_0xee5c('0x57'),_0x253b13);}}},'blocked':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':![],'set':function(_0x7389e8){this['setDataValue'](_0xee5c('0x58'),_0x7389e8);if(_0x7389e8===!![]){this[_0xee5c('0x7')](_0xee5c('0x59'),moment());this[_0xee5c('0x7')]('loginAttempts',0x0);}else{this[_0xee5c('0x7')](_0xee5c('0x59'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xee5c('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xee5c('0x18')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8bf0=['yes','force_rport,comedia','nat','join','all','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','certificate','active','passive','update,nonat','showWebBar','isArray','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','wss','avpf','actpass','dtlscertfile','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','user','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB','udp','transport','split','rfc2833','info','shortinfo','auto','nonat','update'];(function(_0x1b6ce4,_0x9068d7){var _0xa54fd7=function(_0x644628){while(--_0x644628){_0x1b6ce4['push'](_0x1b6ce4['shift']());}};_0xa54fd7(++_0x9068d7);}(_0x8bf0,0x86));var _0x08bf=function(_0x35005f,_0x4dad9f){_0x35005f=_0x35005f-0x0;var _0x1f0270=_0x8bf0[_0x35005f];return _0x1f0270;};'use strict';var Sequelize=require(_0x08bf('0x0'));var moment=require(_0x08bf('0x1'));var util=require(_0x08bf('0x2'));var _=require(_0x08bf('0x3'));module[_0x08bf('0x4')]={'name':{'type':Sequelize[_0x08bf('0x5')],'allowNull':![],'unique':_0x08bf('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2977a3){this[_0x08bf('0x7')](_0x08bf('0x6'),_0x2977a3);this[_0x08bf('0x7')](_0x08bf('0x8'),_0x2977a3);},'comment':_0x08bf('0x9')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x31cb88){this[_0x08bf('0x7')](_0x08bf('0xa'),_0x31cb88);this['setDataValue'](_0x08bf('0xb'),util[_0x08bf('0xc')](_0x08bf('0xd'),_0x31cb88,this[_0x08bf('0xe')](_0x08bf('0xf'))));}},'alias':{'type':Sequelize[_0x08bf('0x5')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x08bf('0x10'),'validate':{'isEmail':!![]},'set':function(_0x401e90){if(_0x401e90){this[_0x08bf('0x7')](_0x08bf('0x10'),_0x401e90[_0x08bf('0x11')]());}}},'role':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x13'),'user',_0x08bf('0x14'),_0x08bf('0x15')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x08bf('0x5')],'defaultValue':_0x08bf('0x16')},'internal':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':![],'unique':_0x08bf('0xf'),'set':function(_0x2b1786){this['setDataValue']('internal',_0x2b1786);this[_0x08bf('0x7')](_0x08bf('0x18'),_0x2b1786);this[_0x08bf('0x7')]('callerid',util[_0x08bf('0xc')](_0x08bf('0xd'),this[_0x08bf('0xe')](_0x08bf('0xa')),_0x2b1786));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x08bf('0x5')]},'address':{'type':Sequelize[_0x08bf('0x5')]},'zipcode':{'type':Sequelize[_0x08bf('0x5')]},'userpic':{'type':Sequelize[_0x08bf('0x5')]},'city':{'type':Sequelize[_0x08bf('0x5')]},'country':{'type':Sequelize[_0x08bf('0x5')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x08bf('0x19')]},'voicePause':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x08bf('0x5')],'defaultValue':_0x08bf('0x1b')},'lastPauseAt':{'type':Sequelize[_0x08bf('0x19')]},'chatCapacity':{'type':Sequelize[_0x08bf('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x08bf('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x08bf('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x08bf('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x08bf('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x08bf('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x08bf('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x08bf('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'description':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![],'defaultValue':_0x08bf('0x1c')},'ipaddr':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x08bf('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x1d'),_0x08bf('0x1e'),_0x08bf('0x1f')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x08bf('0x20')},'callingpres':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x21'),'ALLOWED_PASSED_SCREEN',_0x08bf('0x22'),'ALLOWED',_0x08bf('0x23'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0x08bf('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x08bf('0x25'),'set':function(_0xb75fd0){this[_0x08bf('0x7')](_0x08bf('0x26'),_0xb75fd0?_0xb75fd0['join'](','):null);},'get':function(){return this[_0x08bf('0xe')](_0x08bf('0x26'))?this[_0x08bf('0xe')]('transport')[_0x08bf('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x28'),_0x08bf('0x29'),_0x08bf('0x2a'),'inband',_0x08bf('0x2b')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x08bf('0x2c'),_0x08bf('0x2d'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![],'defaultValue':_0x08bf('0x2f'),'set':function(_0x23a78c){this[_0x08bf('0x7')](_0x08bf('0x30'),_0x23a78c?_0x23a78c[_0x08bf('0x31')](','):null);},'get':function(){return this[_0x08bf('0xe')]('nat')?this['getDataValue'](_0x08bf('0x30'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x08bf('0x5')]},'namedcallgroup':{'type':Sequelize[_0x08bf('0x5')]},'pickupgroup':{'type':Sequelize[_0x08bf('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x08bf('0x5')]},'language':{'type':Sequelize[_0x08bf('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x08bf('0x5')]},'disallow':{'type':Sequelize[_0x08bf('0x5')],'allowNull':![],'defaultValue':_0x08bf('0x32')},'allow':{'type':Sequelize[_0x08bf('0x5')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2806da){this[_0x08bf('0x7')]('allow',_0x2806da?_0x2806da[_0x08bf('0x31')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x08bf('0xe')](_0x08bf('0x33'))?this[_0x08bf('0xe')](_0x08bf('0x33'))[_0x08bf('0x27')](';'):null;},'comment':_0x08bf('0x34')},'autoframing':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x4e3407){this['setDataValue']('insecure',_0x4e3407?_0x4e3407[_0x08bf('0x31')](','):null);},'get':function(){return this[_0x08bf('0xe')](_0x08bf('0x35'))?this[_0x08bf('0xe')](_0x08bf('0x35'))[_0x08bf('0x27')](','):null;},'comment':_0x08bf('0x36')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x08bf('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x08bf('0x37')},'amaflags':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![],'defaultValue':_0x08bf('0x2e')},'busylevel':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x08bf('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x08bf('0x12')]('yes','no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x08bf('0x2e'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x38'),_0x08bf('0x39'),_0x08bf('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x3b'),'uas'),'allowNull':!![],'defaultValue':_0x08bf('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x08bf('0x12')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x08bf('0x12')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no','fingerprint',_0x08bf('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x3e'),_0x08bf('0x3f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x08bf('0x17')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x08bf('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no',_0x08bf('0x2c'),_0x08bf('0x2d'),_0x08bf('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x08bf('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0x08bf('0x19')]},'passwordResetAt':{'type':Sequelize[_0x08bf('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x08bf('0x5')]},'showWebBar':{'type':Sequelize[_0x08bf('0x17')],'defaultValue':0x0,'set':function(_0xbae37f){this['setDataValue'](_0x08bf('0x41'),_0xbae37f);var _0x5771fd=this['get']({'plain':!![]});switch(_0xbae37f){case 0x0:case 0x1:var _0x4d1210=_0x5771fd[_0x08bf('0x26')]?_[_0x08bf('0x42')](_0x5771fd[_0x08bf('0x26')])?_0x5771fd[_0x08bf('0x26')]['join']():_0x5771fd[_0x08bf('0x26')]:'udp';if(_0x4d1210==='wss'){_0x4d1210='udp';}this[_0x08bf('0x7')]('transport',_0x4d1210);this[_0x08bf('0x7')](_0x08bf('0x43'),'no');this[_0x08bf('0x7')]('avpf',null);this[_0x08bf('0x7')](_0x08bf('0x44'),null);this[_0x08bf('0x7')](_0x08bf('0x45'),null);this[_0x08bf('0x7')](_0x08bf('0x46'),null);this[_0x08bf('0x7')](_0x08bf('0x47'),null);this[_0x08bf('0x7')](_0x08bf('0x48'),null);this[_0x08bf('0x7')]('dtlscertfile',null);this['setDataValue'](_0x08bf('0x49'),null);this[_0x08bf('0x7')]('rtcp_mux','no');break;case 0x2:this[_0x08bf('0x7')](_0x08bf('0x26'),_0x08bf('0x4a'));this[_0x08bf('0x7')](_0x08bf('0x43'),'yes');this[_0x08bf('0x7')](_0x08bf('0x4b'),_0x08bf('0x2e'));this[_0x08bf('0x7')](_0x08bf('0x44'),'yes');this[_0x08bf('0x7')](_0x08bf('0x45'),_0x08bf('0x2e'));this['setDataValue'](_0x08bf('0x46'),_0x08bf('0x2e'));this[_0x08bf('0x7')](_0x08bf('0x47'),'no');this[_0x08bf('0x7')](_0x08bf('0x48'),_0x08bf('0x4c'));this[_0x08bf('0x7')](_0x08bf('0x4d'),_0x5771fd['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this[_0x08bf('0x7')](_0x08bf('0x49'),_0x5771fd[_0x08bf('0x49')]||_0x08bf('0x4e'));this[_0x08bf('0x7')](_0x08bf('0x4f'),_0x08bf('0x2e'));break;default:}}},'permissions':{'type':Sequelize[_0x08bf('0x50')],'set':function(_0x48c199){this[_0x08bf('0x7')](_0x08bf('0x51'),_0x48c199?_0x48c199[_0x08bf('0x31')](','):[]);},'get':function(){return this[_0x08bf('0xe')]('permissions')?_[_0x08bf('0x52')](this['getDataValue'](_0x08bf('0x51'))[_0x08bf('0x27')](','),function(_0x532e5b){return parseInt(_0x532e5b,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x08bf('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x08bf('0x5')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x08bf('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x08bf('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x08bf('0x12')](_0x08bf('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x08bf('0xe')](_0x08bf('0x53'))?this[_0x08bf('0xe')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'interface':{'type':Sequelize[_0x08bf('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x08bf('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![],'set':function(_0x417da5){if(typeof _0x417da5===_0x08bf('0x54')){var _0x228ca8=_0x417da5==='1'?!![]:_0x417da5==='0'?![]:_0x417da5===_0x08bf('0x55')?!![]:_0x417da5===_0x08bf('0x56')?![]:![];this[_0x08bf('0x7')](_0x08bf('0x57'),_0x228ca8);}else{this[_0x08bf('0x7')]('screenrecording',_0x417da5);}}},'blocked':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':![],'set':function(_0x132f60){this[_0x08bf('0x7')](_0x08bf('0x58'),_0x132f60);if(_0x132f60===!![]){this[_0x08bf('0x7')]('blockedAt',moment());this[_0x08bf('0x7')]('loginAttempts',0x0);}else{this['setDataValue'](_0x08bf('0x59'),null);}}},'blockedAt':{'type':Sequelize[_0x08bf('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x08bf('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x08bf('0x1a')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index e60a359..006e1ba 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 _0x860f=['UserProfileSection','agent','Agents','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','push','all','each','compact','changePassword','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','updatePasswordsHistory','addQueues','channel','loginInPause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','spread','QueueId','emit','Queue:save','voice','VoiceQueue','format','SIP/%s','voicePause','penalty','UserVoiceQueueRt','upsert','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getContacts','pick','Tag','Tags','tag','Queue','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','UserId','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','device','PAUSE','LOGININPAUSE','bulkCreate','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','getChannels','DEFAULT\x20PAUSE','faxPause','openchannelPause','smsPause','whatsapppause','lastPauseAt','unpause','manual','mail','chat','fax','whatsapp','openchannel','%s%s','Pause','getTeams','Team','addTeams','omit','Voice','getChatQueues','setDataValue','Chat','getMailQueues','Mail','getSmsQueues','Sms','Whatsapp','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','online','getDataValue','removeTeams','getWhatsappQueues','getFaxQueues','getLists','CmList','getAgents','values','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','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','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','concat','$and','$or','$gt','$lt','$lte','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$notILike','$overlap','$contains','firstName','lastName','CmContact','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','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','localhost','socket.io-emitter','register','jayson/promise','http','request','then','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','end','json','status','set','apply','reject','save','get','role','admin','Users','user','Telephones','filter','value','includes','find','name','destroy','send','index','map','User','rawAttributes','fieldName','type','key','model','password','salt','keys','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','limit','offset','order','sort','filters','where','merge','VIRTUAL','sequelize','col','lower','options','count','includeAll','include','findAll','rows','show','params','update','body','describe','addContacts','ids','internal','Setting','findById','securePassword','validatePasswordPattern','max','min_internal','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)','SELECT','isNil','from','voicemail','VoiceMail','fullname','email','permissions','101','103','110','106','107','108','109','100','111','114','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId'];(function(_0x34c917,_0x2a0b49){var _0x1e931e=function(_0x250108){while(--_0x250108){_0x34c917['push'](_0x34c917['shift']());}};_0x1e931e(++_0x2a0b49);}(_0x860f,0xee));var _0xf860=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x860f[_0x1fc122];return _0xa2cb13;};'use strict';var pdf=require(_0xf860('0x0'));var emlformat=require(_0xf860('0x1'));var rimraf=require(_0xf860('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf860('0x3'));var moment=require(_0xf860('0x4'));var BPromise=require(_0xf860('0x5'));var Mustache=require(_0xf860('0x6'));var util=require(_0xf860('0x7'));var path=require(_0xf860('0x8'));var sox=require(_0xf860('0x9'));var csv=require(_0xf860('0xa'));var ejs=require(_0xf860('0xb'));var fs=require('fs');var _=require(_0xf860('0xc'));var squel=require(_0xf860('0xd'));var crypto=require('crypto');var jsforce=require(_0xf860('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf860('0xa'));var querystring=require(_0xf860('0xf'));var Papa=require(_0xf860('0x10'));var Redis=require(_0xf860('0x11'));var authService=require(_0xf860('0x12'));var qs=require(_0xf860('0x13'));var as=require(_0xf860('0x14'));var hardwareService=require(_0xf860('0x15'));var logger=require(_0xf860('0x16'))(_0xf860('0x17'));var utils=require(_0xf860('0x18'));var config=require(_0xf860('0x19'));var licenseUtil=require(_0xf860('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf860('0x1b')](config['redis'],{'host':_0xf860('0x1c'),'port':0x18eb});var socket=require(_0xf860('0x1d'))(new Redis(config['redis']));require('./user.socket')[_0xf860('0x1e')](socket);var jayson=require(_0xf860('0x1f'));var client=jayson['client'][_0xf860('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x46656e,_0x4cab5b,_0x590bed,_0x3165ac){return new BPromise(function(_0x4474df,_0x4e911d){var _0x111025=_0x3165ac||client;return _0x111025[_0xf860('0x21')](_0x46656e,_0x590bed)[_0xf860('0x22')](function(_0x1478c9){logger['info'](_0xf860('0x23'),_0x4cab5b,_0xf860('0x24'));logger['debug'](_0xf860('0x25'),_0x4cab5b,_0xf860('0x24'),JSON[_0xf860('0x26')](_0x1478c9));if(_0x1478c9[_0xf860('0x27')]){if(_0x1478c9[_0xf860('0x27')][_0xf860('0x28')]===0x1f4){logger[_0xf860('0x27')]('User,\x20%s,\x20%s',_0x4cab5b,_0x1478c9[_0xf860('0x27')]['message']);return _0x4e911d(_0x1478c9[_0xf860('0x27')][_0xf860('0x29')]);}logger[_0xf860('0x27')](_0xf860('0x23'),_0x4cab5b,_0x1478c9[_0xf860('0x27')][_0xf860('0x29')]);return _0x4474df(_0x1478c9[_0xf860('0x27')][_0xf860('0x29')]);}else{logger[_0xf860('0x2a')](_0xf860('0x23'),_0x4cab5b,_0xf860('0x24'));_0x4474df(_0x1478c9[_0xf860('0x2b')][_0xf860('0x29')]);}})[_0xf860('0x2c')](function(_0x4624dd){logger['error']('User,\x20%s,\x20%s',_0x4cab5b,_0x4624dd);_0x4e911d(_0x4624dd);});});}function respondWithStatusCode(_0x366376,_0x4fb4c3){_0x4fb4c3=_0x4fb4c3||0xcc;return function(_0x4ca290){if(_0x4ca290){return _0x366376[_0xf860('0x2d')](_0x4fb4c3);}return _0x366376['status'](_0x4fb4c3)[_0xf860('0x2e')]();};}function respondWithResult(_0x23f991,_0x139d29){_0x139d29=_0x139d29||0xc8;return function(_0x3d2d66){if(_0x3d2d66){return _0x23f991['status'](_0x139d29)[_0xf860('0x2f')](_0x3d2d66);}};}function respondWithFilteredResult(_0x4c8721,_0x37eaaa){return function(_0x502c11){if(_0x502c11){var _0x5390c0=_0x502c11['count'],_0x22a507=_0x37eaaa['offset'],_0x10a86c=_0x37eaaa['offset']+_0x37eaaa['limit'],_0x50f921;if(_0x10a86c>=_0x5390c0){_0x10a86c=_0x5390c0;_0x50f921=0xc8;}else{_0x50f921=0xce;}_0x4c8721[_0xf860('0x30')](_0x50f921);return _0x4c8721[_0xf860('0x31')]('Content-Range',_0x22a507+'-'+_0x10a86c+'/'+_0x5390c0)[_0xf860('0x2f')](_0x502c11);}return null;};}function patchUpdates(_0xf3311b){return function(_0xb4af5d){try{jsonpatch[_0xf860('0x32')](_0xb4af5d,_0xf3311b,!![]);}catch(_0x41de9f){return BPromise[_0xf860('0x33')](_0x41de9f);}return _0xb4af5d[_0xf860('0x34')]();};}function saveUpdates(_0x4b7a5d,_0x232b9b){return function(_0x1b7cce){if(_0x1b7cce){return _0x1b7cce['update'](_0x4b7a5d)[_0xf860('0x22')](function(_0x3a1bf1){return _0x3a1bf1;});}return null;};}function removeEntity(_0x4b3bd4,_0x262c35){return function(_0x122afa){if(_0x122afa){return _0x122afa['destroy']()[_0xf860('0x22')](function(){var _0x46ec32=_0x122afa[_0xf860('0x35')]({'plain':!![]});if(_0x46ec32[_0xf860('0x36')]===_0xf860('0x37'))return;var _0x176c9c=[{'name':_0xf860('0x38'),'value':_0xf860('0x39'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0xf860('0x3a'),'value':'telephone','ignore':![]}];var _0x4e3bf0=_(_0x176c9c)[_0xf860('0x3b')]('ignore')['map'](_0xf860('0x3c'))[_0xf860('0x3c')]();if(_[_0xf860('0x3d')](_0x4e3bf0,_0x46ec32[_0xf860('0x36')])){return;}var _0x3d5910=_[_0xf860('0x3e')](_0x176c9c,[_0xf860('0x3c'),_0x46ec32[_0xf860('0x36')]])[_0xf860('0x3f')];return db['UserProfileResource'][_0xf860('0x40')]({'where':{'type':_0x3d5910,'resourceId':_0x46ec32['id']}})[_0xf860('0x22')](function(){return _0x122afa;});})[_0xf860('0x22')](function(){_0x4b3bd4[_0xf860('0x30')](0xcc)[_0xf860('0x2e')]();});}};}function handleEntityNotFound(_0x2c0941,_0x18e73f){return function(_0x2a5e69){if(!_0x2a5e69){_0x2c0941[_0xf860('0x2d')](0x194);}return _0x2a5e69;};}function handleError(_0x514b80,_0x954901){_0x954901=_0x954901||0x1f4;return function(_0x37bab1){logger[_0xf860('0x27')](_0x37bab1['stack']);if(_0x37bab1['name']){delete _0x37bab1[_0xf860('0x3f')];}_0x514b80['status'](_0x954901)[_0xf860('0x41')](_0x37bab1);};}exports[_0xf860('0x42')]=function(_0x28ee8d,_0x55100e){var _0x127544={},_0x118cf7={},_0x4f00b6={'count':0x0,'rows':[]};var _0x54f179=_[_0xf860('0x43')](db[_0xf860('0x44')][_0xf860('0x45')],function(_0x459051){return{'name':_0x459051[_0xf860('0x46')],'type':_0x459051[_0xf860('0x47')][_0xf860('0x48')]};});_0x118cf7[_0xf860('0x49')]=_['differenceBy'](_[_0xf860('0x43')](_0x54f179,'name'),[_0xf860('0x4a'),_0xf860('0x4b')]);_0x118cf7['query']=_[_0xf860('0x4c')](_0x28ee8d['query']);_0x118cf7['filters']=_[_0xf860('0x4d')](_0x118cf7[_0xf860('0x49')],_0x118cf7['query']);_0x127544[_0xf860('0x4e')]=_[_0xf860('0x4d')](_0x118cf7[_0xf860('0x49')],qs[_0xf860('0x4f')](_0x28ee8d[_0xf860('0x50')]['fields']));_0x127544['attributes']=_0x127544[_0xf860('0x4e')][_0xf860('0x51')]?_0x127544[_0xf860('0x4e')]:_0x118cf7['model'];if(!_0x28ee8d['query'][_0xf860('0x52')](_0xf860('0x53'))){_0x127544[_0xf860('0x54')]=qs[_0xf860('0x54')](_0x28ee8d[_0xf860('0x50')][_0xf860('0x54')]);_0x127544[_0xf860('0x55')]=qs[_0xf860('0x55')](_0x28ee8d[_0xf860('0x50')][_0xf860('0x55')]);}_0x127544[_0xf860('0x56')]=qs[_0xf860('0x57')](_0x28ee8d[_0xf860('0x50')][_0xf860('0x57')]);_0x127544['where']=qs['filters'](_['pick'](_0x28ee8d[_0xf860('0x50')],_0x118cf7[_0xf860('0x58')]),_0x54f179);if(_0x28ee8d['query'][_0xf860('0x3b')]){_0x127544[_0xf860('0x59')]=_[_0xf860('0x5a')](_0x127544['where'],{'$or':_[_0xf860('0x43')](_0x54f179,function(_0x5c6d34){if(_0x5c6d34[_0xf860('0x47')]!==_0xf860('0x5b')){return db[_0xf860('0x5c')]['where'](db[_0xf860('0x5c')]['fn']('lower',db[_0xf860('0x5c')][_0xf860('0x5d')](_0x5c6d34[_0xf860('0x3f')])),{'$like':db[_0xf860('0x5c')]['fn'](_0xf860('0x5e'),'%'+_0x28ee8d[_0xf860('0x50')]['filter']+'%')});}})});}_0x127544=_['merge']({},_0x127544,_0x28ee8d[_0xf860('0x5f')]);var _0x379761={'where':_0x127544['where']};return db[_0xf860('0x44')][_0xf860('0x60')](_0x379761)[_0xf860('0x22')](function(_0x3f96ae){_0x4f00b6[_0xf860('0x60')]=_0x3f96ae;if(_0x28ee8d['query'][_0xf860('0x61')]){_0x127544[_0xf860('0x62')]=[{'all':!![]}];}return db[_0xf860('0x44')][_0xf860('0x63')](_0x127544);})['then'](function(_0xeb7528){_0x4f00b6[_0xf860('0x64')]=_0xeb7528;return _0x4f00b6;})[_0xf860('0x22')](respondWithFilteredResult(_0x55100e,_0x127544))[_0xf860('0x2c')](handleError(_0x55100e,null));};exports[_0xf860('0x65')]=function(_0x3e01c5,_0x3ea783){var _0x5ba5e2={'raw':![],'where':{'id':_0x3e01c5[_0xf860('0x66')]['id']}},_0x1153ff={};_0x1153ff[_0xf860('0x49')]=_['differenceBy'](_['keys'](db[_0xf860('0x44')][_0xf860('0x45')]),[_0xf860('0x4a'),_0xf860('0x4b')]);_0x1153ff[_0xf860('0x50')]=_[_0xf860('0x4c')](_0x3e01c5[_0xf860('0x50')]);_0x1153ff[_0xf860('0x58')]=_[_0xf860('0x4d')](_0x1153ff[_0xf860('0x49')],_0x1153ff[_0xf860('0x50')]);_0x5ba5e2[_0xf860('0x4e')]=_[_0xf860('0x4d')](_0x1153ff[_0xf860('0x49')],qs['fields'](_0x3e01c5['query'][_0xf860('0x4f')]));_0x5ba5e2[_0xf860('0x4e')]=_0x5ba5e2[_0xf860('0x4e')][_0xf860('0x51')]?_0x5ba5e2[_0xf860('0x4e')]:_0x1153ff['model'];if(_0x3e01c5[_0xf860('0x50')][_0xf860('0x61')]){_0x5ba5e2[_0xf860('0x62')]=[{'all':!![]}];}_0x5ba5e2=_[_0xf860('0x5a')]({},_0x5ba5e2,_0x3e01c5[_0xf860('0x5f')]);return db[_0xf860('0x44')][_0xf860('0x3e')](_0x5ba5e2)[_0xf860('0x22')](handleEntityNotFound(_0x3ea783,null))['then'](respondWithResult(_0x3ea783,null))[_0xf860('0x2c')](handleError(_0x3ea783,null));};exports[_0xf860('0x67')]=function(_0x319d8d,_0x141118){if(_0x319d8d[_0xf860('0x68')]['id']){delete _0x319d8d['body']['id'];}delete _0x319d8d[_0xf860('0x68')]['role'];return db['User'][_0xf860('0x3e')]({'where':{'id':_0x319d8d[_0xf860('0x66')]['id']}})['then'](handleEntityNotFound(_0x141118,null))[_0xf860('0x22')](saveUpdates(_0x319d8d[_0xf860('0x68')],null))['then'](respondWithResult(_0x141118,null))[_0xf860('0x2c')](handleError(_0x141118,null));};exports['describe']=function(_0x4e2e96,_0x36d9c2){return db['User'][_0xf860('0x69')]()[_0xf860('0x22')](respondWithResult(_0x36d9c2,null))['catch'](handleError(_0x36d9c2,null));};exports[_0xf860('0x6a')]=function(_0x366177,_0x145b07,_0x356898){return db['User'][_0xf860('0x3e')]({'where':{'id':_0x366177[_0xf860('0x66')]['id']}})['then'](handleEntityNotFound(_0x145b07,null))['then'](function(_0xf26b93){if(_0xf26b93){return _0xf26b93[_0xf860('0x6a')](_0x366177['body'][_0xf860('0x6b')],_['omit'](_0x366177[_0xf860('0x68')],[_0xf860('0x6b'),'id'])||{});}})[_0xf860('0x22')](respondWithResult(_0x145b07,null))[_0xf860('0x2c')](handleError(_0x145b07,null));};function validateUser(_0x4b755f){return new BPromise(function(_0x5a04da,_0x402957){if(_0x4b755f[_0xf860('0x6c')])return _0x5a04da(_0x4b755f);return db[_0xf860('0x6d')][_0xf860('0x6e')](0x1)['then'](function(_0x48ba05){if(_0x48ba05[_0xf860('0x6f')])authService[_0xf860('0x70')](_0x4b755f['password']);db[_0xf860('0x44')][_0xf860('0x71')](_0xf860('0x6c'))[_0xf860('0x22')](function(_0x32c985){if(_['isNil'](_0x32c985)){_0x4b755f[_0xf860('0x6c')]=_0x48ba05[_0xf860('0x72')]||0x1;return;}if(_['isNil'](_0x48ba05['min_internal'])||_0x48ba05[_0xf860('0x72')]===_0x32c985){_0x4b755f[_0xf860('0x6c')]=_0x32c985+0x1;return;}if(_0x48ba05['min_internal']>_0x32c985){_0x4b755f[_0xf860('0x6c')]=_0x48ba05['min_internal'];return;}return db[_0xf860('0x5c')][_0xf860('0x50')](_0xf860('0x73'),{'type':db[_0xf860('0x5c')]['QueryTypes'][_0xf860('0x74')]})['then'](function(_0x3a8ecb){if(_0x3a8ecb&&_0x3a8ecb['length']){for(var _0x5b5ba9=0x0,_0x2fc0fd=_0x3a8ecb[_0xf860('0x51')];_0x5b5ba9<_0x2fc0fd&&_[_0xf860('0x75')](_0x4b755f[_0xf860('0x6c')]);_0x5b5ba9++){if(_0x48ba05[_0xf860('0x72')]<=_0x3a8ecb[_0x5b5ba9][_0xf860('0x76')]){_0x4b755f[_0xf860('0x6c')]=_0x3a8ecb[_0x5b5ba9][_0xf860('0x76')];}else if(_0x48ba05[_0xf860('0x72')]>_0x3a8ecb[_0x5b5ba9][_0xf860('0x76')]&&_0x48ba05[_0xf860('0x72')]<=_0x3a8ecb[_0x5b5ba9]['to']){_0x4b755f[_0xf860('0x6c')]=_0x48ba05[_0xf860('0x72')];}}}if(_[_0xf860('0x75')](_0x4b755f[_0xf860('0x6c')])){_0x4b755f[_0xf860('0x6c')]=_0x32c985+0x1;}return _0x5a04da(_0x4b755f);});});})['catch'](function(_0x43fc3c){_0x402957(_0x43fc3c);});});}function updateUser(_0x2ead1a){return new BPromise(function(_0x587f7d,_0x32cba8){try{if(_0x2ead1a[_0xf860('0x77')]){_0x2ead1a['mailbox']=_0x2ead1a[_0xf860('0x6c')];_0x2ead1a[_0xf860('0x78')]={'mailbox':_0x2ead1a[_0xf860('0x6c')],'password':_0x2ead1a[_0xf860('0x4a')],'fullname':_0x2ead1a[_0xf860('0x79')],'email':_0x2ead1a[_0xf860('0x7a')]};}if(_0x2ead1a['role']==='agent'){if(!_0x2ead1a['permissions'])_0x2ead1a[_0xf860('0x7b')]=[_0xf860('0x7c'),'102',_0xf860('0x7d'),'113',_0xf860('0x7e'),'104','105',_0xf860('0x7f'),_0xf860('0x80'),_0xf860('0x81'),_0xf860('0x82'),_0xf860('0x83'),_0xf860('0x84'),_0xf860('0x85')];}_0x587f7d(_0x2ead1a);}catch(_0x164a68){_0x32cba8(_0x164a68);}});}exports[_0xf860('0x86')]=function(_0x2f44f6,_0x231c5f){if(_0x2f44f6[_0xf860('0x39')][_0xf860('0x36')]==='agent')throw new Error(_0xf860('0x87'));if(_0x2f44f6[_0xf860('0x68')][_0xf860('0x36')]===_0xf860('0x39')&&_0x2f44f6[_0xf860('0x39')][_0xf860('0x36')]!==_0xf860('0x37')){throw new Error(_0xf860('0x88'));}if(_0x2f44f6[_0xf860('0x68')]['role']==='admin'&&_0x2f44f6[_0xf860('0x39')][_0xf860('0x36')]!==_0xf860('0x37')){throw new Error(_0xf860('0x89'));}return licenseUtil['checkUserLimits']([_0x2f44f6['body']])[_0xf860('0x22')](function(){return validateUser(_0x2f44f6[_0xf860('0x68')]);})[_0xf860('0x22')](function(_0x4d4d36){return updateUser(_0x4d4d36)['then'](function(_0x301d0b){if(_0x301d0b[_0xf860('0x36')]===_0xf860('0x37')){_0x301d0b[_0xf860('0x8a')]=_0x2f44f6[_0xf860('0x39')][_0xf860('0x8a')];delete _0x301d0b[_0xf860('0x8b')];}return _0x301d0b;});})[_0xf860('0x22')](function(_0x266311){return db[_0xf860('0x44')][_0xf860('0x86')](_0x266311,{'include':[{'model':db['VoiceMail'],'as':_0xf860('0x78')}]});})[_0xf860('0x22')](function(_0x4ccc29){if(_0x2f44f6[_0xf860('0x68')]['role']==='user')return _0x4ccc29;if(_0x2f44f6['user'][_0xf860('0x36')]!==_0xf860('0x39'))return _0x4ccc29;return db[_0xf860('0x8c')]['find']({'where':{'name':_0x4ccc29['role']===_0xf860('0x8d')?_0xf860('0x8e'):_0xf860('0x3a'),'userProfileId':_0x2f44f6[_0xf860('0x39')][_0xf860('0x8b')]},'raw':!![]})[_0xf860('0x22')](function(_0x45e525){if(!_0x45e525||_0x45e525[_0xf860('0x8f')]!=0x0)return _0x4ccc29;return db[_0xf860('0x90')]['create']({'name':_0x4ccc29[_0xf860('0x3f')],'resourceId':_0x4ccc29['id'],'type':_0x45e525['name'],'sectionId':_0x45e525['id']},{})['then'](function(){return _0x4ccc29;});})[_0xf860('0x2c')](function(_0x4a759f){logger[_0xf860('0x27')](_0xf860('0x91'),_0x4a759f);throw _0x4a759f;});})[_0xf860('0x22')](respondWithResult(_0x231c5f,0xc9))[_0xf860('0x2c')](handleError(_0x231c5f,null));};exports['bulkCreate']=function(_0x1b9a14,_0x1ffafe){var _0x2572ca=_0x1b9a14[_0xf860('0x68')];var _0x26fab5=[];if(_0x1b9a14[_0xf860('0x39')][_0xf860('0x36')]==='agent')throw new Error(_0xf860('0x87'));if(_[_0xf860('0x92')](_0x2572ca,[_0xf860('0x36'),_0xf860('0x39')])&&_0x1b9a14[_0xf860('0x39')][_0xf860('0x36')]!==_0xf860('0x37')){throw new Error(_0xf860('0x88'));}if(_[_0xf860('0x92')](_0x2572ca,[_0xf860('0x36'),_0xf860('0x37')])&&_0x1b9a14[_0xf860('0x39')][_0xf860('0x36')]!==_0xf860('0x37')){throw new Error(_0xf860('0x93'));}return licenseUtil[_0xf860('0x94')](_0x2572ca)['then'](function(){return validateUser(_0x2572ca[0x0]);})[_0xf860('0x22')](function(){for(var _0x2e6566=0x1;_0x2e6566<_0x2572ca['length'];_0x2e6566++){var _0xf4a2b2=_0x2572ca[_0x2e6566-0x1][_0xf860('0x6c')];if(!_0x2572ca[_0x2e6566][_0xf860('0x6c')])_0x2572ca[_0x2e6566][_0xf860('0x6c')]=_0xf4a2b2+0x1;_0x26fab5[_0xf860('0x95')](validateUser(_0x2572ca[_0x2e6566]));}return BPromise['all'](_0x26fab5);})[_0xf860('0x22')](function(){_0x26fab5=[];for(var _0x51637c=0x0;_0x51637c<_0x2572ca[_0xf860('0x51')];_0x51637c++){_0x26fab5[_0xf860('0x95')](updateUser(_0x2572ca[_0x51637c]));}return BPromise[_0xf860('0x96')](_0x26fab5);})[_0xf860('0x22')](function(){return BPromise[_0xf860('0x97')](_0x2572ca,function(_0x3e6e5d){return db[_0xf860('0x44')][_0xf860('0x86')](_0x3e6e5d,{'include':[{'model':db[_0xf860('0x78')],'as':_0xf860('0x78')}]})[_0xf860('0x22')](function(_0x265a7b){_0x3e6e5d['id']=_0x265a7b['id'];return _0x3e6e5d;});});})['then'](function(_0xd29370){if(_0x1b9a14['body'][_0xf860('0x36')]===_0xf860('0x39'))return _0xd29370;if(_0x1b9a14[_0xf860('0x39')][_0xf860('0x36')]!==_0xf860('0x39'))return _0xd29370;var _0x5e2f4c=_[_0xf860('0x92')](_0xd29370,function(_0x1d8217){return _0x1d8217[_0xf860('0x36')]===_0xf860('0x8d')||_0x1d8217[_0xf860('0x36')]==='telephone';});if(!_0x5e2f4c)return _0xd29370;return db[_0xf860('0x8c')][_0xf860('0x63')]({'where':{'name':{'$or':['Agents',_0xf860('0x3a')]},'userProfileId':_0x1b9a14[_0xf860('0x39')][_0xf860('0x8b')]},'raw':!![]})['then'](function(_0x380700){if(_['isEmpty'](_0x380700)||!_[_0xf860('0x92')](_0x380700,[_0xf860('0x8f'),0x0]))return _0xd29370;_0x26fab5=[];var _0x5f00d5=_(_0x380700)[_0xf860('0x43')](function(_0x192ddd){if(_0x192ddd[_0xf860('0x8f')]===0x1)return;return _0x192ddd[_0xf860('0x3f')]===_0xf860('0x8e')?_0xf860('0x8d'):'telephone';})[_0xf860('0x98')]()[_0xf860('0x3c')]();for(var _0x561f99=0x0;_0x561f99<_0xd29370[_0xf860('0x51')];_0x561f99++){if(!_[_0xf860('0x3d')](_0x5f00d5,_0xd29370[_0x561f99]['role']))return;var _0x55b3c3=_0xd29370[_0x561f99][_0xf860('0x36')]===_0xf860('0x8d')?_0xf860('0x8e'):_0xf860('0x3a');_0x26fab5[_0xf860('0x95')](db['UserProfileResource']['create']({'name':_0xd29370[_0x561f99][_0xf860('0x3f')],'resourceId':_0xd29370[_0x561f99]['id'],'type':_0x55b3c3,'sectionId':_[_0xf860('0x3e')](_0x380700,[_0xf860('0x3f'),_0x55b3c3])['id']},{}));}return BPromise[_0xf860('0x96')](_0x26fab5);})[_0xf860('0x22')](respondWithResult(_0x1ffafe,0xc9))[_0xf860('0x2c')](handleError(_0x1ffafe,null));});};exports[_0xf860('0x99')]=function(_0x6e9b23,_0x777d0b,_0x2149b0){if(_0x6e9b23[_0xf860('0x68')]['id']){delete _0x6e9b23[_0xf860('0x68')]['id'];}return db[_0xf860('0x44')][_0xf860('0x3e')]({'where':{'id':_0x6e9b23[_0xf860('0x66')]['id']}})['then'](function(_0x5aec74){if(!_0x5aec74)return null;if(_0x5aec74['id']===_0x6e9b23[_0xf860('0x39')]['id']){if(!_0x6e9b23[_0xf860('0x68')][_0xf860('0x9a')]||!_0x6e9b23['body'][_0xf860('0x9b')]){throw new db['Sequelize'][(_0xf860('0x9c'))](_0xf860('0x9d'));}if(!_0x5aec74[_0xf860('0x9e')](_0x6e9b23['body'][_0xf860('0x9a')])){throw new db[(_0xf860('0x9f'))][(_0xf860('0x9c'))](_0xf860('0xa0'));}if(_0x6e9b23[_0xf860('0x68')][_0xf860('0x9a')]===_0x6e9b23['body'][_0xf860('0x9b')]){throw new db[(_0xf860('0x9f'))][(_0xf860('0x9c'))](_0xf860('0xa1'));}}else if(_0x6e9b23[_0xf860('0x39')][_0xf860('0x36')]==='admin'){if(!_0x6e9b23[_0xf860('0x68')][_0xf860('0x9b')]){throw new db[(_0xf860('0x9f'))][(_0xf860('0x9c'))](_0xf860('0xa2'));}}else if(_0x6e9b23['user']['role']===_0xf860('0x39')){if(!_0x6e9b23[_0xf860('0x68')]['newPassword']){throw new db['Sequelize'][(_0xf860('0x9c'))](_0xf860('0xa2'));}if(_0x5aec74['role']!==_0xf860('0x8d')){throw new db[(_0xf860('0x9f'))][(_0xf860('0x9c'))](_0xf860('0x87'));}}else{throw new db[(_0xf860('0x9f'))]['ValidationError'](_0xf860('0x87'));}return _0x5aec74;})[_0xf860('0x22')](handleEntityNotFound(_0x777d0b,null))['then'](function(_0xe48807){return db[_0xf860('0x6d')][_0xf860('0xa3')]({'attributes':['id',_0xf860('0x6f'),_0xf860('0xa4'),_0xf860('0xa5')]})[_0xf860('0x22')](function(_0x5af7bd){if(_0x5af7bd[_0xf860('0x6f')])authService[_0xf860('0x70')](_0x6e9b23['body'][_0xf860('0x9b')]);if(!_0x5af7bd[_0xf860('0xa4')]||!_0xe48807[_0xf860('0xa6')])return _0xe48807;authService['validatePasswordHistory'](_0x6e9b23[_0xf860('0x68')]['newPassword'],_0xe48807[_0xf860('0xa6')],_0x5af7bd[_0xf860('0xa5')]);return _0xe48807;})[_0xf860('0x22')](saveUpdates({'password':_0x6e9b23[_0xf860('0x68')]['newPassword'],'passwordResetAt':_0x6e9b23[_0xf860('0x39')]['id']==_0x6e9b23[_0xf860('0x66')]['id']?moment():null,'previousPasswords':authService[_0xf860('0xa7')](_0x6e9b23['body'][_0xf860('0x9b')],_0xe48807[_0xf860('0xa6')])},null));})['then'](respondWithResult(_0x777d0b,null))[_0xf860('0x2c')](handleError(_0x777d0b,null));};exports[_0xf860('0xa8')]=function(_0x31bb8c,_0x1cf194,_0x4737ac){var _0x464042=_0x31bb8c['body'][_0xf860('0xa9')];return db['User'][_0xf860('0x3e')]({'where':{'id':_0x31bb8c[_0xf860('0x66')]['id']},'attributes':['id',_0xf860('0x3f'),_0xf860('0x36'),'online',_0xf860('0xaa'),'voicePause',_0xf860('0xab')]})[_0xf860('0x22')](handleEntityNotFound(_0x1cf194,null))[_0xf860('0x22')](function(_0x4ba949){if(_0x4ba949){if(!utils[_0xf860('0xac')](_0x464042)){throw new db[(_0xf860('0x9f'))]['ValidationError'](_0xf860('0xad'));}return _0x4ba949[_0xf860('0xae')+_[_0xf860('0xaf')](_0x464042[_0xf860('0xb0')]())+_0xf860('0xb1')](_0x31bb8c[_0xf860('0x68')][_0xf860('0x6b')],{'penalty':_0x31bb8c[_0xf860('0x68')]['penalty']||0x0})[_0xf860('0xb2')](function(_0x3c92d9){for(var _0x165172=0x0;_0x165172<_0x31bb8c['body'][_0xf860('0x6b')][_0xf860('0x51')];_0x165172+=0x1){var _0x2c745b={'UserId':_0x31bb8c[_0xf860('0x66')]['id']};_0x2c745b[_[_0xf860('0xaf')](_0x464042['toLowerCase']())+_0xf860('0xb3')]=_0x31bb8c[_0xf860('0x68')][_0xf860('0x6b')][_0x165172];socket[_0xf860('0xb4')](_0xf860('0x39')+_[_0xf860('0xaf')](_0x464042[_0xf860('0xb0')]())+_0xf860('0xb5'),_0x2c745b);}return _0x3c92d9;})[_0xf860('0x22')](function(){if(_0x464042===_0xf860('0xb6')){return db[_0xf860('0xb7')][_0xf860('0x63')]({'where':{'id':_0x31bb8c[_0xf860('0x68')]['ids']||[]},'raw':!![],'attributes':['id',_0xf860('0x3f')]});}})[_0xf860('0x22')](function(_0x1fad4f){var _0x4c5668=_0x4ba949['get']({'plain':!![]});var _0x5f83a8=[];if(_0x464042===_0xf860('0xb6')&&_0x4c5668[_0xf860('0x36')]===_0xf860('0x8d')&&_0x4c5668['online']){for(var _0x12a53e=0x0;_0x12a53e<_0x1fad4f[_0xf860('0x51')];_0x12a53e+=0x1){_0x5f83a8['push']({'membername':_0x4c5668[_0xf860('0x3f')],'UserId':_0x4c5668['id'],'queue_name':_0x1fad4f[_0x12a53e][_0xf860('0x3f')],'VoiceQueueId':_0x1fad4f[_0x12a53e]['id'],'interface':_[_0xf860('0x75')](_0x4c5668[_0xf860('0xab')])?util[_0xf860('0xb8')](_0xf860('0xb9'),_0x4c5668['name']):_0x4c5668['interface'],'paused':_0x4c5668[_0xf860('0xba')]||![],'penalty':_0x31bb8c[_0xf860('0x68')][_0xf860('0xbb')]||0x0});}return BPromise[_0xf860('0x97')](_0x5f83a8,function(_0x343478){return db[_0xf860('0xbc')][_0xf860('0xbd')](_0x343478);});}return _0x4ba949;});}})[_0xf860('0x22')](respondWithStatusCode(_0x1cf194,null))[_0xf860('0x2c')](handleError(_0x1cf194,null));};exports['removeQueues']=function(_0x4a1233,_0x5eb324,_0x3da175){var _0x3cbc7a;return db[_0xf860('0x44')]['find']({'where':{'id':_0x4a1233['params']['id']},'attributes':['id','name',_0xf860('0x36')]})['then'](handleEntityNotFound(_0x5eb324,null))['then'](function(_0x2a7792){if(_0x2a7792){_0x3cbc7a=_0x2a7792;if(!_0x4a1233[_0xf860('0x50')][_0xf860('0xa9')]||!utils[_0xf860('0xac')](_0x4a1233[_0xf860('0x50')]['channel'])){throw new db[(_0xf860('0x9f'))]['ValidationError']('Unknown\x20channel');}return _0x2a7792['remove'+_[_0xf860('0xaf')](_0x4a1233[_0xf860('0x50')][_0xf860('0xa9')][_0xf860('0xb0')]())+'Queues'](_0x4a1233['query'][_0xf860('0x6b')]);}})[_0xf860('0x22')](function(_0x2c5a52){for(var _0x371d74=0x0;_0x371d74<_0x4a1233[_0xf860('0x50')][_0xf860('0x6b')][_0xf860('0x51')];_0x371d74+=0x1){var _0x60aa61={'UserId':_0x4a1233[_0xf860('0x66')]['id']};_0x60aa61[_[_0xf860('0xaf')](_0x4a1233[_0xf860('0x50')][_0xf860('0xa9')]['toLowerCase']())+_0xf860('0xb3')]=_0x4a1233['query'][_0xf860('0x6b')][_0x371d74];socket['emit'](_0xf860('0x39')+_[_0xf860('0xaf')](_0x4a1233['query'][_0xf860('0xa9')]['toLowerCase']())+_0xf860('0xbe'),_0x60aa61);}return _0x2c5a52;})[_0xf860('0x22')](function(){if(_0x4a1233['query'][_0xf860('0xa9')]==='voice'){return db[_0xf860('0xbc')][_0xf860('0x40')]({'where':{'UserId':_0x4a1233[_0xf860('0x66')]['id'],'VoiceQueueId':_0x4a1233[_0xf860('0x50')][_0xf860('0x6b')]},'individualHooks':!![]})['then'](function(){return _0x3cbc7a;});}return _0x3cbc7a;})[_0xf860('0x22')](respondWithStatusCode(_0x5eb324,null))[_0xf860('0x2c')](handleError(_0x5eb324,null));};exports[_0xf860('0xbf')]=function(_0x2248cd,_0x1561e9,_0x1c891e){_0x2248cd['body'][_0xf860('0xc0')]=_0x2248cd[_0xf860('0xc1')][_0xf860('0xc2')];return db[_0xf860('0x44')]['find']({'where':{'id':_0x2248cd['params']['id']}})[_0xf860('0x22')](handleEntityNotFound(_0x1561e9,null))['then'](saveUpdates(_0x2248cd['body'],null))['then'](respondWithResult(_0x1561e9,null))['catch'](handleError(_0x1561e9,null));};exports[_0xf860('0xc3')]=function(_0x22a6f6,_0x11c876,_0x545844){var _0x375ab4=path[_0xf860('0xc4')](config[_0xf860('0xc5')],_0xf860('0xc6'));return db['User'][_0xf860('0x3e')]({'where':{'id':_0x22a6f6[_0xf860('0x66')]['id']},'attributes':['id',_0xf860('0xc0')],'raw':!![]})[_0xf860('0x22')](handleEntityNotFound(_0x11c876,null))[_0xf860('0x22')](function(_0x30e4e4){if(_0x30e4e4){if(_[_0xf860('0x75')](_0x30e4e4[_0xf860('0xc0')])){return _0x11c876[_0xf860('0xc7')](_0x375ab4);}else{if(!fs[_0xf860('0xc8')](path['join'](config[_0xf860('0xc5')],_0xf860('0xc9'),_0x30e4e4[_0xf860('0xc0')]))){return _0x11c876['download'](_0x375ab4);}return _0x11c876[_0xf860('0xc7')](path['join'](config[_0xf860('0xc5')],_0xf860('0xc9'),_0x30e4e4['userpic']));}}})[_0xf860('0x2c')](handleError(_0x11c876,null));};exports[_0xf860('0xca')]=function(_0x32fe74,_0x2e4125,_0x380f7a){var _0x5b8fc5={};var _0x49a719={};var _0x558241;var _0x78ad8c;return db['User'][_0xf860('0xa3')]({'where':{'id':_0x32fe74[_0xf860('0x66')]['id']}})[_0xf860('0x22')](handleEntityNotFound(_0x2e4125,null))[_0xf860('0x22')](function(_0x56a5fc){if(_0x56a5fc){_0x558241=_0x56a5fc;_0x49a719[_0xf860('0x49')]=_[_0xf860('0x4c')](db['CmContact'][_0xf860('0x45')]);_0x49a719[_0xf860('0x50')]=_[_0xf860('0x4c')](_0x32fe74[_0xf860('0x50')]);_0x49a719[_0xf860('0x58')]=_[_0xf860('0x4d')](_0x49a719['model'],_0x49a719[_0xf860('0x50')]);_0x5b8fc5[_0xf860('0x4e')]=_[_0xf860('0x4d')](_0x49a719[_0xf860('0x49')],qs[_0xf860('0x4f')](_0x32fe74[_0xf860('0x50')][_0xf860('0x4f')]));_0x5b8fc5[_0xf860('0x4e')]=_0x5b8fc5[_0xf860('0x4e')][_0xf860('0x51')]?_0x5b8fc5[_0xf860('0x4e')]:_0x49a719[_0xf860('0x49')];_0x5b8fc5['order']=qs['sort'](_0x32fe74['query'][_0xf860('0x57')]);_0x5b8fc5[_0xf860('0x59')]=qs[_0xf860('0x58')](_[_0xf860('0xcb')](_0x32fe74[_0xf860('0x50')],_0x49a719[_0xf860('0x58')]));if(_0x32fe74['query'][_0xf860('0x3b')]){_0x5b8fc5[_0xf860('0x59')]=_[_0xf860('0x5a')](_0x5b8fc5['where'],{'$or':_[_0xf860('0x43')](_0x5b8fc5[_0xf860('0x4e')],function(_0x46ba34){var _0x25abb8={};_0x25abb8[_0x46ba34]={'$like':'%'+_0x32fe74[_0xf860('0x50')][_0xf860('0x3b')]+'%'};return _0x25abb8;})});}_0x5b8fc5=_[_0xf860('0x5a')]({},_0x5b8fc5,_0x32fe74[_0xf860('0x5f')]);return _0x558241[_0xf860('0xca')](_0x5b8fc5);}})[_0xf860('0x22')](function(_0x5201cf){if(_0x5201cf){_0x78ad8c=_0x5201cf['length'];if(_0x32fe74[_0xf860('0x50')][_0xf860('0x52')](_0xf860('0x61'))){_0x5b8fc5['include']=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0xf860('0xcc')],'as':_0xf860('0xcd'),'attributes':['id',_0xf860('0x3f'),'color'],'where':_0x32fe74[_0xf860('0x50')]['tag']?{'id':_0x32fe74[_0xf860('0x50')][_0xf860('0xce')]}:undefined,'required':_0x32fe74['query'][_0xf860('0xce')]?!![]:![]}];}if(!_0x32fe74[_0xf860('0x50')][_0xf860('0x52')](_0xf860('0x53'))){_0x5b8fc5[_0xf860('0x54')]=qs[_0xf860('0x54')](_0x32fe74[_0xf860('0x50')]['limit']);_0x5b8fc5[_0xf860('0x55')]=qs['offset'](_0x32fe74['query']['offset']);}return _0x558241[_0xf860('0xca')](_0x5b8fc5);}})[_0xf860('0x22')](function(_0x14cb79){if(_0x14cb79){return _0x14cb79?{'count':_0x78ad8c,'rows':_0x14cb79}:null;}})[_0xf860('0x22')](respondWithResult(_0x2e4125,null))[_0xf860('0x2c')](handleError(_0x2e4125,null));};exports['getQueues']=function(_0x4ee8bc,_0x387835,_0x41085c){var _0x4150a5;var _0x39fe62;var _0x207222={};var _0x37eab5;return db[_0xf860('0x44')][_0xf860('0xa3')]({'where':{'id':_0x4ee8bc[_0xf860('0x66')]['id']},'attributes':['id',_0xf860('0x3f'),_0xf860('0x36')]})[_0xf860('0x22')](handleEntityNotFound(_0x387835,null))[_0xf860('0x22')](function(_0x56de3d){if(!utils[_0xf860('0xac')](_0x4ee8bc[_0xf860('0x50')][_0xf860('0xa9')])){throw new db[(_0xf860('0x9f'))]['ValidationError']('Unknown\x20channel');}_0x4150a5=_0x56de3d;var _0x2881e4={};_0x2881e4[_0xf860('0x49')]=_[_0xf860('0x4c')](db[_[_0xf860('0xaf')](_0x4ee8bc[_0xf860('0x50')]['channel'])+_0xf860('0xcf')]['rawAttributes']);_0x2881e4[_0xf860('0x50')]=_[_0xf860('0x4c')](_0x4ee8bc[_0xf860('0x50')]);_0x2881e4['filters']=_[_0xf860('0x4d')](_0x2881e4[_0xf860('0x49')],_0x2881e4[_0xf860('0x50')]);_0x207222[_0xf860('0x4e')]=_[_0xf860('0x4d')](_0x2881e4[_0xf860('0x49')],qs[_0xf860('0x4f')](_0x4ee8bc[_0xf860('0x50')][_0xf860('0x4f')]));_0x207222[_0xf860('0x4e')]=_0x207222[_0xf860('0x4e')]['length']?_0x207222[_0xf860('0x4e')]:_0x2881e4[_0xf860('0x49')];_0x207222[_0xf860('0x56')]=qs[_0xf860('0x57')](_0x4ee8bc[_0xf860('0x50')]['sort']);_0x207222[_0xf860('0x59')]=qs[_0xf860('0x58')](_[_0xf860('0xcb')](_0x4ee8bc[_0xf860('0x50')],_0x2881e4[_0xf860('0x58')]));if(_0x4ee8bc[_0xf860('0x50')][_0xf860('0x3b')]){_0x207222['where']=_[_0xf860('0x5a')](_0x207222[_0xf860('0x59')],{'$or':_[_0xf860('0x43')](_0x207222['attributes'],function(_0x5777bc){var _0x499972={};_0x499972[_0x5777bc]={'$like':'%'+_0x4ee8bc[_0xf860('0x50')][_0xf860('0x3b')]+'%'};return _0x499972;})});}_0x207222=_[_0xf860('0x5a')]({},_0x207222,_0x4ee8bc[_0xf860('0x5f')]);switch(_0x4150a5[_0xf860('0x36')]){case _0xf860('0x37'):return db[_[_0xf860('0xaf')](_0x4ee8bc[_0xf860('0x50')][_0xf860('0xa9')])+_0xf860('0xcf')]['findAll'](_0x207222);case _0xf860('0x39'):case _0xf860('0x8d'):return _0x4150a5[_0xf860('0x35')+_['capitalize'](_0x4ee8bc[_0xf860('0x50')][_0xf860('0xa9')])+'Queues'](_0x207222);default:throw new db[(_0xf860('0x9f'))][(_0xf860('0x9c'))]('Unknown\x20role');}})[_0xf860('0x22')](function(_0x212b45){_0x37eab5=_0x212b45[_0xf860('0x51')];if(!_0x4ee8bc[_0xf860('0x50')][_0xf860('0x52')](_0xf860('0x53'))){_0x207222[_0xf860('0x54')]=qs['limit'](_0x4ee8bc['query'][_0xf860('0x54')]);_0x207222[_0xf860('0x55')]=qs[_0xf860('0x55')](_0x4ee8bc[_0xf860('0x50')][_0xf860('0x55')]);}switch(_0x4150a5['role']){case _0xf860('0x37'):return db[_['capitalize'](_0x4ee8bc[_0xf860('0x50')][_0xf860('0xa9')])+_0xf860('0xcf')][_0xf860('0x63')](_0x207222);case _0xf860('0x39'):case _0xf860('0x8d'):return _0x4150a5['get'+_[_0xf860('0xaf')](_0x4ee8bc['query'][_0xf860('0xa9')])+_0xf860('0xb1')](_0x207222);}})[_0xf860('0x22')](function(_0x50b7d8){return{'count':_0x37eab5,'rows':_0x50b7d8};})[_0xf860('0x22')](respondWithResult(_0x387835,null))[_0xf860('0x2c')](handleError(_0x387835,null));};exports[_0xf860('0xd0')]=function(_0x39bc5c,_0x44b638,_0x254765){var _0x2a1294={};var _0x3a28c6={};var _0x140b05;var _0x3b207e;return db[_0xf860('0x44')][_0xf860('0xa3')]({'where':{'id':_0x39bc5c[_0xf860('0x66')]['id']}})[_0xf860('0x22')](handleEntityNotFound(_0x44b638,null))['then'](function(_0x14fe56){if(_0x14fe56){_0x140b05=_0x14fe56;_0x3a28c6['model']=_[_0xf860('0x4c')](db[_0xf860('0xbc')][_0xf860('0x45')]);_0x3a28c6[_0xf860('0x50')]=_['keys'](_0x39bc5c[_0xf860('0x50')]);_0x3a28c6[_0xf860('0x58')]=_[_0xf860('0x4d')](_0x3a28c6[_0xf860('0x49')],_0x3a28c6[_0xf860('0x50')]);_0x2a1294[_0xf860('0x4e')]=_[_0xf860('0x4d')](_0x3a28c6[_0xf860('0x49')],qs[_0xf860('0x4f')](_0x39bc5c[_0xf860('0x50')][_0xf860('0x4f')]));_0x2a1294['attributes']=_0x2a1294[_0xf860('0x4e')]['length']?_0x2a1294['attributes']:_0x3a28c6['model'];_0x2a1294[_0xf860('0x56')]=qs[_0xf860('0x57')](_0x39bc5c[_0xf860('0x50')][_0xf860('0x57')]);_0x2a1294['where']=qs['filters'](_[_0xf860('0xcb')](_0x39bc5c['query'],_0x3a28c6[_0xf860('0x58')]));if(_0x39bc5c[_0xf860('0x50')][_0xf860('0x3b')]){_0x2a1294[_0xf860('0x59')]=_['merge'](_0x2a1294[_0xf860('0x59')],{'$or':_['map'](_0x2a1294[_0xf860('0x4e')],function(_0x5e00b2){var _0x4860cb={};_0x4860cb[_0x5e00b2]={'$like':'%'+_0x39bc5c[_0xf860('0x50')][_0xf860('0x3b')]+'%'};return _0x4860cb;})});}_0x2a1294=_['merge']({},_0x2a1294,_0x39bc5c[_0xf860('0x5f')]);return _0x140b05[_0xf860('0xd0')](_0x2a1294);}})[_0xf860('0x22')](function(_0x2a0745){if(_0x2a0745){_0x3b207e=_0x2a0745[_0xf860('0x51')];if(!_0x39bc5c[_0xf860('0x50')][_0xf860('0x52')]('nolimit')){_0x2a1294['limit']=qs[_0xf860('0x54')](_0x39bc5c[_0xf860('0x50')][_0xf860('0x54')]);_0x2a1294['offset']=qs[_0xf860('0x55')](_0x39bc5c[_0xf860('0x50')][_0xf860('0x55')]);}return _0x140b05['getVoiceQueuesRt'](_0x2a1294);}})[_0xf860('0x22')](function(_0x20715d){if(_0x20715d){return _0x20715d?{'count':_0x3b207e,'rows':_0x20715d}:null;}})[_0xf860('0x22')](respondWithResult(_0x44b638,null))[_0xf860('0x2c')](handleError(_0x44b638,null));};exports[_0xf860('0xd1')]=function(_0x18963d,_0xbf30ba,_0x4278d0){var _0x3e1ef2={};var _0x3733f9={};var _0x37984a;var _0x16e0ce;return db['User'][_0xf860('0xa3')]({'where':{'id':_0x18963d['params']['id']}})['then'](handleEntityNotFound(_0xbf30ba,null))[_0xf860('0x22')](function(_0xf4f134){if(_0xf4f134){_0x37984a=_0xf4f134;_0x3733f9[_0xf860('0x49')]=_[_0xf860('0x4c')](db[_0xf860('0xd2')][_0xf860('0x45')]);_0x3733f9[_0xf860('0x50')]=_[_0xf860('0x4c')](_0x18963d['query']);_0x3733f9[_0xf860('0x58')]=_[_0xf860('0x4d')](_0x3733f9['model'],_0x3733f9[_0xf860('0x50')]);_0x3e1ef2[_0xf860('0x4e')]=_[_0xf860('0x4d')](_0x3733f9[_0xf860('0x49')],qs['fields'](_0x18963d['query']['fields']));_0x3e1ef2[_0xf860('0x4e')]=_0x3e1ef2[_0xf860('0x4e')][_0xf860('0x51')]?_0x3e1ef2[_0xf860('0x4e')]:_0x3733f9[_0xf860('0x49')];_0x3e1ef2[_0xf860('0x56')]=qs[_0xf860('0x57')](_0x18963d['query'][_0xf860('0x57')]);_0x3e1ef2[_0xf860('0x59')]=qs[_0xf860('0x58')](_[_0xf860('0xcb')](_0x18963d[_0xf860('0x50')],_0x3733f9[_0xf860('0x58')]));if(_0x18963d[_0xf860('0x50')][_0xf860('0x3b')]){_0x3e1ef2['where']=_['merge'](_0x3e1ef2[_0xf860('0x59')],{'$or':_[_0xf860('0x43')](_0x3e1ef2[_0xf860('0x4e')],function(_0x191163){var _0x19b54d={};_0x19b54d[_0x191163]={'$like':'%'+_0x18963d['query']['filter']+'%'};return _0x19b54d;})});}_0x3e1ef2=_['merge']({},_0x3e1ef2,_0x18963d['options']);return _0x37984a[_0xf860('0xd1')](_0x3e1ef2);}})[_0xf860('0x22')](function(_0x15a9b5){if(_0x15a9b5){_0x16e0ce=_0x15a9b5[_0xf860('0x51')];if(!_0x18963d[_0xf860('0x50')][_0xf860('0x52')](_0xf860('0x53'))){_0x3e1ef2[_0xf860('0x54')]=qs[_0xf860('0x54')](_0x18963d['query'][_0xf860('0x54')]);_0x3e1ef2[_0xf860('0x55')]=qs[_0xf860('0x55')](_0x18963d[_0xf860('0x50')][_0xf860('0x55')]);}return _0x37984a['getGroups'](_0x3e1ef2);}})['then'](function(_0x50aacb){if(_0x50aacb){return _0x50aacb?{'count':_0x16e0ce,'rows':_0x50aacb}:null;}})[_0xf860('0x22')](respondWithResult(_0xbf30ba,null))['catch'](handleError(_0xbf30ba,null));};exports[_0xf860('0xd3')]=function(_0x274a28,_0xd16bd,_0x19aeb4){var _0x5a678d={'raw':!![],'where':{}};var _0x47027d={};var _0x68ee45={'count':0x0,'rows':[]};return db[_0xf860('0x44')][_0xf860('0xa3')]({'where':{'id':_0x274a28[_0xf860('0x66')]['id']}})[_0xf860('0x22')](handleEntityNotFound(_0xd16bd,null))[_0xf860('0x22')](function(_0x354c5b){if(_0x354c5b){_0x47027d[_0xf860('0x49')]=_[_0xf860('0x4c')](db[_0xf860('0xd4')][_0xf860('0x45')]);_0x47027d[_0xf860('0x50')]=_[_0xf860('0x4c')](_0x274a28[_0xf860('0x50')]);_0x47027d[_0xf860('0x58')]=_[_0xf860('0x4d')](_0x47027d[_0xf860('0x49')],_0x47027d[_0xf860('0x50')]);_0x5a678d[_0xf860('0x4e')]=_['intersection'](_0x47027d[_0xf860('0x49')],qs['fields'](_0x274a28[_0xf860('0x50')][_0xf860('0x4f')]));_0x5a678d[_0xf860('0x4e')]=_0x5a678d[_0xf860('0x4e')][_0xf860('0x51')]?_0x5a678d[_0xf860('0x4e')]:_0x47027d[_0xf860('0x49')];if(!_0x274a28[_0xf860('0x50')]['hasOwnProperty'](_0xf860('0x53'))){_0x5a678d[_0xf860('0x54')]=qs['limit'](_0x274a28[_0xf860('0x50')]['limit']);_0x5a678d['offset']=qs[_0xf860('0x55')](_0x274a28[_0xf860('0x50')][_0xf860('0x55')]);}_0x5a678d['order']=qs['sort'](_0x274a28[_0xf860('0x50')][_0xf860('0x57')]);_0x5a678d[_0xf860('0x59')]=qs[_0xf860('0x58')](_[_0xf860('0xcb')](_0x274a28[_0xf860('0x50')],_0x47027d[_0xf860('0x58')]));_0x5a678d[_0xf860('0x59')]['UserId']=_0x354c5b['id'];if(_0x274a28[_0xf860('0x50')][_0xf860('0x3b')]){_0x5a678d['where']=_[_0xf860('0x5a')](_0x5a678d[_0xf860('0x59')],{'$or':_['map'](_0x5a678d[_0xf860('0x4e')],function(_0x15ad8f){var _0x277b76={};_0x277b76[_0x15ad8f]={'$like':'%'+_0x274a28[_0xf860('0x50')][_0xf860('0x3b')]+'%'};return _0x277b76;})});}_0x5a678d=_[_0xf860('0x5a')]({},_0x5a678d,_0x274a28[_0xf860('0x5f')]);return db[_0xf860('0xd4')]['count']({'where':_0x5a678d[_0xf860('0x59')]})['then'](function(_0x2b1870){_0x68ee45[_0xf860('0x60')]=_0x2b1870;if(_0x274a28['query']['includeAll']){_0x5a678d[_0xf860('0x62')]=[{'all':!![]}];}return db[_0xf860('0xd4')][_0xf860('0x63')](_0x5a678d);})[_0xf860('0x22')](function(_0x3ffb5c){_0x68ee45['rows']=_0x3ffb5c;return _0x68ee45;});}})[_0xf860('0x22')](respondWithFilteredResult(_0xd16bd,_0x5a678d))[_0xf860('0x2c')](handleError(_0xd16bd,null));};exports[_0xf860('0xd5')]=function(_0x1a5196,_0x257bef,_0x358651){var _0x3e70f8={'raw':!![],'where':{}};var _0x248e4a={};var _0x2305ab={'count':0x0,'rows':[]};return db[_0xf860('0x44')][_0xf860('0xa3')]({'where':{'id':_0x1a5196[_0xf860('0x66')]['id']}})[_0xf860('0x22')](handleEntityNotFound(_0x257bef,null))[_0xf860('0x22')](function(_0x32b2dc){if(_0x32b2dc){_0x248e4a[_0xf860('0x49')]=_[_0xf860('0x4c')](db['ScreenRecording']['rawAttributes']);_0x248e4a[_0xf860('0x50')]=_[_0xf860('0x4c')](_0x1a5196[_0xf860('0x50')]);_0x248e4a[_0xf860('0x58')]=_[_0xf860('0x4d')](_0x248e4a[_0xf860('0x49')],_0x248e4a[_0xf860('0x50')]);_0x3e70f8[_0xf860('0x4e')]=_[_0xf860('0x4d')](_0x248e4a['model'],qs['fields'](_0x1a5196[_0xf860('0x50')][_0xf860('0x4f')]));_0x3e70f8[_0xf860('0x4e')]=_0x3e70f8[_0xf860('0x4e')]['length']?_0x3e70f8[_0xf860('0x4e')]:_0x248e4a[_0xf860('0x49')];if(!_0x1a5196[_0xf860('0x50')][_0xf860('0x52')]('nolimit')){_0x3e70f8[_0xf860('0x54')]=qs['limit'](_0x1a5196['query'][_0xf860('0x54')]);_0x3e70f8[_0xf860('0x55')]=qs[_0xf860('0x55')](_0x1a5196[_0xf860('0x50')][_0xf860('0x55')]);}_0x3e70f8[_0xf860('0x56')]=qs[_0xf860('0x57')](_0x1a5196[_0xf860('0x50')][_0xf860('0x57')]);_0x3e70f8['where']=qs[_0xf860('0x58')](_[_0xf860('0xcb')](_0x1a5196[_0xf860('0x50')],_0x248e4a['filters']));_0x3e70f8['where']['UserId']=_0x32b2dc['id'];if(_0x1a5196[_0xf860('0x50')]['filter']){_0x3e70f8['where']=_[_0xf860('0x5a')](_0x3e70f8['where'],{'$or':_['map'](_0x3e70f8[_0xf860('0x4e')],function(_0x196d11){var _0x3f80e6={};_0x3f80e6[_0x196d11]={'$like':'%'+_0x1a5196['query'][_0xf860('0x3b')]+'%'};return _0x3f80e6;})});}_0x3e70f8=_['merge']({},_0x3e70f8,_0x1a5196[_0xf860('0x5f')]);return db['ScreenRecording'][_0xf860('0x60')]({'where':_0x3e70f8[_0xf860('0x59')]})[_0xf860('0x22')](function(_0x218c00){_0x2305ab['count']=_0x218c00;if(_0x1a5196[_0xf860('0x50')][_0xf860('0x61')]){_0x3e70f8[_0xf860('0x62')]=[{'all':!![]}];}return db[_0xf860('0xd6')][_0xf860('0x63')](_0x3e70f8);})[_0xf860('0x22')](function(_0x154657){_0x2305ab[_0xf860('0x64')]=_0x154657;return _0x2305ab;});}})[_0xf860('0x22')](respondWithFilteredResult(_0x257bef,_0x3e70f8))['catch'](handleError(_0x257bef,null));};exports['getChatInteractions']=function(_0xda4918,_0xe25112,_0x5167cc){var _0x732302={};var _0x458a8e={};var _0x4a47c4;var _0x1e3807;return db[_0xf860('0x44')][_0xf860('0xa3')]({'where':{'id':_0xda4918['params']['id']}})[_0xf860('0x22')](handleEntityNotFound(_0xe25112,null))['then'](function(_0x2365cb){if(_0x2365cb){_0x4a47c4=_0x2365cb;_0x458a8e[_0xf860('0x49')]=_['keys'](db[_0xf860('0xd7')][_0xf860('0x45')]);_0x458a8e[_0xf860('0x50')]=_[_0xf860('0x4c')](_0xda4918[_0xf860('0x50')]);_0x458a8e[_0xf860('0x58')]=_[_0xf860('0x4d')](_0x458a8e[_0xf860('0x49')],_0x458a8e['query']);_0x732302[_0xf860('0x4e')]=_[_0xf860('0x4d')](_0x458a8e[_0xf860('0x49')],qs[_0xf860('0x4f')](_0xda4918[_0xf860('0x50')][_0xf860('0x4f')]));_0x732302['attributes']=_0x732302['attributes'][_0xf860('0x51')]?_0x732302['attributes']:_0x458a8e['model'];_0x732302[_0xf860('0x56')]=qs['sort'](_0xda4918[_0xf860('0x50')]['sort']);_0x732302['where']=qs['filters'](_[_0xf860('0xcb')](_0xda4918[_0xf860('0x50')],_0x458a8e[_0xf860('0x58')]));if(_0xda4918[_0xf860('0x50')][_0xf860('0x3b')]){_0x732302['where']=_[_0xf860('0x5a')](_0x732302[_0xf860('0x59')],{'$or':_['map'](_0x732302[_0xf860('0x4e')],function(_0x519c3d){var _0xe65c09={};_0xe65c09[_0x519c3d]={'$like':'%'+_0xda4918[_0xf860('0x50')][_0xf860('0x3b')]+'%'};return _0xe65c09;})});}_0x732302=_['merge']({},_0x732302,_0xda4918[_0xf860('0x5f')]);return _0x4a47c4[_0xf860('0xd8')](_0x732302);}})[_0xf860('0x22')](function(_0x141c41){if(_0x141c41){_0x1e3807=_0x141c41[_0xf860('0x51')];if(!_0xda4918['query'][_0xf860('0x52')](_0xf860('0x53'))){_0x732302[_0xf860('0x54')]=qs['limit'](_0xda4918[_0xf860('0x50')][_0xf860('0x54')]);_0x732302[_0xf860('0x55')]=qs[_0xf860('0x55')](_0xda4918[_0xf860('0x50')][_0xf860('0x55')]);}return _0x4a47c4[_0xf860('0xd8')](_0x732302);}})[_0xf860('0x22')](function(_0x33ccce){if(_0x33ccce){return _0x33ccce?{'count':_0x1e3807,'rows':_0x33ccce}:null;}})[_0xf860('0x22')](respondWithResult(_0xe25112,null))[_0xf860('0x2c')](handleError(_0xe25112,null));};exports[_0xf860('0xd9')]=function(_0x50c0b4,_0x38a6a5,_0x26fa2d){var _0x458f56={};var _0x52a337={};var _0x48c9dc;var _0x3ab6eb;return db[_0xf860('0x44')][_0xf860('0xa3')]({'where':{'id':_0x50c0b4[_0xf860('0x66')]['id']}})[_0xf860('0x22')](handleEntityNotFound(_0x38a6a5,null))[_0xf860('0x22')](function(_0x3cfb0d){if(_0x3cfb0d){_0x48c9dc=_0x3cfb0d;_0x52a337[_0xf860('0x49')]=_[_0xf860('0x4c')](db[_0xf860('0xda')][_0xf860('0x45')]);_0x52a337[_0xf860('0x50')]=_[_0xf860('0x4c')](_0x50c0b4[_0xf860('0x50')]);_0x52a337[_0xf860('0x58')]=_[_0xf860('0x4d')](_0x52a337[_0xf860('0x49')],_0x52a337[_0xf860('0x50')]);_0x458f56[_0xf860('0x4e')]=_[_0xf860('0x4d')](_0x52a337[_0xf860('0x49')],qs[_0xf860('0x4f')](_0x50c0b4[_0xf860('0x50')]['fields']));_0x458f56['attributes']=_0x458f56[_0xf860('0x4e')][_0xf860('0x51')]?_0x458f56[_0xf860('0x4e')]:_0x52a337[_0xf860('0x49')];_0x458f56['order']=qs[_0xf860('0x57')](_0x50c0b4['query'][_0xf860('0x57')]);_0x458f56[_0xf860('0x59')]=qs[_0xf860('0x58')](_[_0xf860('0xcb')](_0x50c0b4[_0xf860('0x50')],_0x52a337[_0xf860('0x58')]));if(_0x50c0b4[_0xf860('0x50')]['filter']){_0x458f56[_0xf860('0x59')]=_[_0xf860('0x5a')](_0x458f56[_0xf860('0x59')],{'$or':_[_0xf860('0x43')](_0x458f56[_0xf860('0x4e')],function(_0x4bbe14){var _0x4fced7={};_0x4fced7[_0x4bbe14]={'$like':'%'+_0x50c0b4[_0xf860('0x50')][_0xf860('0x3b')]+'%'};return _0x4fced7;})});}_0x458f56=_[_0xf860('0x5a')]({},_0x458f56,_0x50c0b4[_0xf860('0x5f')]);return _0x48c9dc[_0xf860('0xd9')](_0x458f56);}})['then'](function(_0xd024a6){if(_0xd024a6){_0x3ab6eb=_0xd024a6['length'];if(!_0x50c0b4[_0xf860('0x50')]['hasOwnProperty']('nolimit')){_0x458f56['limit']=qs[_0xf860('0x54')](_0x50c0b4[_0xf860('0x50')][_0xf860('0x54')]);_0x458f56[_0xf860('0x55')]=qs[_0xf860('0x55')](_0x50c0b4['query'][_0xf860('0x55')]);}return _0x48c9dc[_0xf860('0xd9')](_0x458f56);}})[_0xf860('0x22')](function(_0x40e6a9){if(_0x40e6a9){return _0x40e6a9?{'count':_0x3ab6eb,'rows':_0x40e6a9}:null;}})['then'](respondWithResult(_0x38a6a5,null))['catch'](handleError(_0x38a6a5,null));};exports[_0xf860('0xdb')]=function(_0x401eec,_0x3b60a9,_0x28eab4){var _0x1e17a9={'raw':!![],'where':{}};var _0x3f5b86={};var _0x20e8d7={'count':0x0,'rows':[]};return db[_0xf860('0x44')]['findOne']({'where':{'id':_0x401eec[_0xf860('0x66')]['id']}})[_0xf860('0x22')](handleEntityNotFound(_0x3b60a9,null))[_0xf860('0x22')](function(_0x2f05a0){if(_0x2f05a0){_0x3f5b86['model']=_[_0xf860('0x4c')](db[_0xf860('0xdc')][_0xf860('0x45')]);_0x3f5b86[_0xf860('0x50')]=_[_0xf860('0x4c')](_0x401eec['query']);_0x3f5b86['filters']=_['intersection'](_0x3f5b86['model'],_0x3f5b86[_0xf860('0x50')]);_0x1e17a9[_0xf860('0x4e')]=_['intersection'](_0x3f5b86['model'],qs['fields'](_0x401eec[_0xf860('0x50')][_0xf860('0x4f')]));_0x1e17a9[_0xf860('0x4e')]=_0x1e17a9[_0xf860('0x4e')]['length']?_0x1e17a9[_0xf860('0x4e')]:_0x3f5b86[_0xf860('0x49')];if(!_0x401eec['query'][_0xf860('0x52')](_0xf860('0x53'))){_0x1e17a9[_0xf860('0x54')]=qs[_0xf860('0x54')](_0x401eec[_0xf860('0x50')][_0xf860('0x54')]);_0x1e17a9[_0xf860('0x55')]=qs['offset'](_0x401eec['query'][_0xf860('0x55')]);}_0x1e17a9['order']=qs[_0xf860('0x57')](_0x401eec['query'][_0xf860('0x57')]);_0x1e17a9['where']=qs[_0xf860('0x58')](_[_0xf860('0xcb')](_0x401eec[_0xf860('0x50')],_0x3f5b86[_0xf860('0x58')]));_0x1e17a9['where'][_0xf860('0xdd')]=_0x2f05a0['id'];if(_0x401eec[_0xf860('0x50')]['filter']){_0x1e17a9[_0xf860('0x59')]=_[_0xf860('0x5a')](_0x1e17a9[_0xf860('0x59')],{'$or':_[_0xf860('0x43')](_0x1e17a9[_0xf860('0x4e')],function(_0x4284ed){var _0x28ff8a={};_0x28ff8a[_0x4284ed]={'$like':'%'+_0x401eec[_0xf860('0x50')][_0xf860('0x3b')]+'%'};return _0x28ff8a;})});}_0x1e17a9=_[_0xf860('0x5a')]({},_0x1e17a9,_0x401eec[_0xf860('0x5f')]);return db['MailInteraction'][_0xf860('0x60')]({'where':_0x1e17a9['where']})['then'](function(_0x25a9e7){_0x20e8d7['count']=_0x25a9e7;if(_0x401eec['query']['includeAll']){_0x1e17a9['include']=[{'all':!![]}];}return db[_0xf860('0xdc')][_0xf860('0x63')](_0x1e17a9);})[_0xf860('0x22')](function(_0x4c5e74){_0x20e8d7[_0xf860('0x64')]=_0x4c5e74;return _0x20e8d7;});}})[_0xf860('0x22')](respondWithFilteredResult(_0x3b60a9,_0x1e17a9))[_0xf860('0x2c')](handleError(_0x3b60a9,null));};exports['getSmsInteractions']=function(_0x98a33a,_0x52fc43,_0x286c4e){var _0xe363c9={};var _0x3028b9={};var _0x4195b0;var _0x572702;return db[_0xf860('0x44')][_0xf860('0xa3')]({'where':{'id':_0x98a33a[_0xf860('0x66')]['id']}})['then'](handleEntityNotFound(_0x52fc43,null))[_0xf860('0x22')](function(_0x419789){if(_0x419789){_0x4195b0=_0x419789;_0x3028b9['model']=_[_0xf860('0x4c')](db[_0xf860('0xde')][_0xf860('0x45')]);_0x3028b9['query']=_[_0xf860('0x4c')](_0x98a33a[_0xf860('0x50')]);_0x3028b9[_0xf860('0x58')]=_['intersection'](_0x3028b9['model'],_0x3028b9[_0xf860('0x50')]);_0xe363c9[_0xf860('0x4e')]=_['intersection'](_0x3028b9[_0xf860('0x49')],qs[_0xf860('0x4f')](_0x98a33a[_0xf860('0x50')][_0xf860('0x4f')]));_0xe363c9[_0xf860('0x4e')]=_0xe363c9['attributes'][_0xf860('0x51')]?_0xe363c9[_0xf860('0x4e')]:_0x3028b9['model'];_0xe363c9[_0xf860('0x56')]=qs['sort'](_0x98a33a[_0xf860('0x50')]['sort']);_0xe363c9[_0xf860('0x59')]=qs[_0xf860('0x58')](_[_0xf860('0xcb')](_0x98a33a[_0xf860('0x50')],_0x3028b9[_0xf860('0x58')]));if(_0x98a33a['query']['filter']){_0xe363c9[_0xf860('0x59')]=_['merge'](_0xe363c9[_0xf860('0x59')],{'$or':_[_0xf860('0x43')](_0xe363c9[_0xf860('0x4e')],function(_0x49b42e){var _0x1d037d={};_0x1d037d[_0x49b42e]={'$like':'%'+_0x98a33a['query'][_0xf860('0x3b')]+'%'};return _0x1d037d;})});}_0xe363c9=_[_0xf860('0x5a')]({},_0xe363c9,_0x98a33a[_0xf860('0x5f')]);return _0x4195b0['getSmsInteractions'](_0xe363c9);}})[_0xf860('0x22')](function(_0x4ee3d9){if(_0x4ee3d9){_0x572702=_0x4ee3d9['length'];if(!_0x98a33a[_0xf860('0x50')][_0xf860('0x52')](_0xf860('0x53'))){_0xe363c9[_0xf860('0x54')]=qs[_0xf860('0x54')](_0x98a33a[_0xf860('0x50')]['limit']);_0xe363c9[_0xf860('0x55')]=qs['offset'](_0x98a33a[_0xf860('0x50')][_0xf860('0x55')]);}return _0x4195b0[_0xf860('0xdf')](_0xe363c9);}})[_0xf860('0x22')](function(_0x4121b8){if(_0x4121b8){return _0x4121b8?{'count':_0x572702,'rows':_0x4121b8}:null;}})[_0xf860('0x22')](respondWithResult(_0x52fc43,null))[_0xf860('0x2c')](handleError(_0x52fc43,null));};exports[_0xf860('0xe0')]=function(_0x128584,_0x1d98ca,_0x232ce4){var _0x1fe797={};var _0x1d6f87={};var _0x3d5237;var _0x58a0e7;return db['User'][_0xf860('0xa3')]({'where':{'id':_0x128584[_0xf860('0x66')]['id']}})['then'](handleEntityNotFound(_0x1d98ca,null))['then'](function(_0x1b01f0){if(_0x1b01f0){_0x3d5237=_0x1b01f0;_0x1d6f87[_0xf860('0x49')]=_[_0xf860('0x4c')](db[_0xf860('0xe1')]['rawAttributes']);_0x1d6f87[_0xf860('0x50')]=_[_0xf860('0x4c')](_0x128584[_0xf860('0x50')]);_0x1d6f87[_0xf860('0x58')]=_[_0xf860('0x4d')](_0x1d6f87[_0xf860('0x49')],_0x1d6f87[_0xf860('0x50')]);_0x1fe797[_0xf860('0x4e')]=_[_0xf860('0x4d')](_0x1d6f87[_0xf860('0x49')],qs['fields'](_0x128584['query'][_0xf860('0x4f')]));_0x1fe797[_0xf860('0x4e')]=_0x1fe797[_0xf860('0x4e')]['length']?_0x1fe797[_0xf860('0x4e')]:_0x1d6f87[_0xf860('0x49')];_0x1fe797[_0xf860('0x56')]=qs[_0xf860('0x57')](_0x128584[_0xf860('0x50')][_0xf860('0x57')]);_0x1fe797[_0xf860('0x59')]=qs[_0xf860('0x58')](_[_0xf860('0xcb')](_0x128584[_0xf860('0x50')],_0x1d6f87[_0xf860('0x58')]));if(_0x128584[_0xf860('0x50')]['filter']){_0x1fe797[_0xf860('0x59')]=_[_0xf860('0x5a')](_0x1fe797[_0xf860('0x59')],{'$or':_['map'](_0x1fe797[_0xf860('0x4e')],function(_0x4eedcf){var _0x100803={};_0x100803[_0x4eedcf]={'$like':'%'+_0x128584[_0xf860('0x50')][_0xf860('0x3b')]+'%'};return _0x100803;})});}_0x1fe797=_[_0xf860('0x5a')]({},_0x1fe797,_0x128584[_0xf860('0x5f')]);return _0x3d5237[_0xf860('0xe0')](_0x1fe797);}})[_0xf860('0x22')](function(_0x374346){if(_0x374346){_0x58a0e7=_0x374346[_0xf860('0x51')];if(!_0x128584[_0xf860('0x50')][_0xf860('0x52')]('nolimit')){_0x1fe797[_0xf860('0x54')]=qs['limit'](_0x128584[_0xf860('0x50')][_0xf860('0x54')]);_0x1fe797[_0xf860('0x55')]=qs['offset'](_0x128584[_0xf860('0x50')][_0xf860('0x55')]);}return _0x3d5237[_0xf860('0xe0')](_0x1fe797);}})[_0xf860('0x22')](function(_0x46120c){if(_0x46120c){return _0x46120c?{'count':_0x58a0e7,'rows':_0x46120c}:null;}})['then'](respondWithResult(_0x1d98ca,null))[_0xf860('0x2c')](handleError(_0x1d98ca,null));};exports[_0xf860('0xe2')]=function(_0x3ec134,_0x4e0a25,_0x54006c){var _0x244568={};var _0x408cae={};var _0x30e1ca;var _0x2b9911;return db[_0xf860('0x44')][_0xf860('0xa3')]({'where':{'id':_0x3ec134['params']['id']}})[_0xf860('0x22')](handleEntityNotFound(_0x4e0a25,null))['then'](function(_0x5572a4){if(_0x5572a4){_0x30e1ca=_0x5572a4;_0x408cae[_0xf860('0x49')]=_[_0xf860('0x4c')](db[_0xf860('0xe3')]['rawAttributes']);_0x408cae[_0xf860('0x50')]=_[_0xf860('0x4c')](_0x3ec134[_0xf860('0x50')]);_0x408cae[_0xf860('0x58')]=_[_0xf860('0x4d')](_0x408cae[_0xf860('0x49')],_0x408cae[_0xf860('0x50')]);_0x244568[_0xf860('0x4e')]=_[_0xf860('0x4d')](_0x408cae['model'],qs[_0xf860('0x4f')](_0x3ec134[_0xf860('0x50')]['fields']));_0x244568['attributes']=_0x244568[_0xf860('0x4e')][_0xf860('0x51')]?_0x244568['attributes']:_0x408cae[_0xf860('0x49')];_0x244568['order']=qs[_0xf860('0x57')](_0x3ec134[_0xf860('0x50')][_0xf860('0x57')]);_0x244568['where']=qs[_0xf860('0x58')](_['pick'](_0x3ec134[_0xf860('0x50')],_0x408cae['filters']));if(_0x3ec134[_0xf860('0x50')][_0xf860('0x3b')]){_0x244568['where']=_[_0xf860('0x5a')](_0x244568[_0xf860('0x59')],{'$or':_[_0xf860('0x43')](_0x244568[_0xf860('0x4e')],function(_0xdd0b84){var _0x20abaf={};_0x20abaf[_0xdd0b84]={'$like':'%'+_0x3ec134['query']['filter']+'%'};return _0x20abaf;})});}_0x244568=_['merge']({},_0x244568,_0x3ec134[_0xf860('0x5f')]);return _0x30e1ca['getWhatsappInteractions'](_0x244568);}})['then'](function(_0x2415c9){if(_0x2415c9){_0x2b9911=_0x2415c9['length'];if(!_0x3ec134[_0xf860('0x50')][_0xf860('0x52')]('nolimit')){_0x244568['limit']=qs['limit'](_0x3ec134[_0xf860('0x50')][_0xf860('0x54')]);_0x244568[_0xf860('0x55')]=qs['offset'](_0x3ec134[_0xf860('0x50')][_0xf860('0x55')]);}return _0x30e1ca[_0xf860('0xe2')](_0x244568);}})[_0xf860('0x22')](function(_0x1aa987){if(_0x1aa987){return _0x1aa987?{'count':_0x2b9911,'rows':_0x1aa987}:null;}})[_0xf860('0x22')](respondWithResult(_0x4e0a25,null))[_0xf860('0x2c')](handleError(_0x4e0a25,null));};exports[_0xf860('0xe4')]=function(_0x21be47,_0x313296,_0x5b16f8){var _0x4a7e63;var _0x1cf74b;var _0x5b04ee;var _0x1d2d04=!_[_0xf860('0x75')](_0x21be47[_0xf860('0x66')]['id'])?_0x21be47[_0xf860('0x66')]['id']:!_[_0xf860('0x75')](_0x21be47[_0xf860('0x39')]['id'])?_0x21be47[_0xf860('0x39')]['id']:null;return db['User'][_0xf860('0x3e')]({'where':{'id':_0x1d2d04,'role':{'$or':[_0xf860('0x37'),_0xf860('0x39'),_0xf860('0x8d')]}},'attributes':['id',_0xf860('0x3f'),'phone','mobile',_0xf860('0x36'),_0xf860('0x6c'),_0xf860('0xaa')]})[_0xf860('0x22')](function(_0x551207){if(_0x551207){if(_0x551207[_0xf860('0x36')]==='agent'){_0x4a7e63=_0x551207;if(_0x21be47[_0xf860('0x68')]['interface']){_0x5b04ee=util[_0xf860('0xb8')]('LOCAL/%s@from-sip/n',_0x4a7e63[_0x21be47[_0xf860('0x68')][_0xf860('0xab')]]);}else if(_0x21be47[_0xf860('0x68')][_0xf860('0xe5')]){_0x5b04ee=util[_0xf860('0xb8')](_0xf860('0xb9'),_0x21be47[_0xf860('0x68')][_0xf860('0xe5')]);}else{_0x5b04ee=util['format'](_0xf860('0xb9'),_0x4a7e63[_0xf860('0x3f')]);}socket['to'](util[_0xf860('0xb8')](_0xf860('0xe6'),_0x4a7e63['name']))[_0xf860('0xb4')](_0xf860('0xe7'),{'ip':_0x21be47[_0xf860('0xe8')][_0xf860('0xe9')]||_0x21be47[_0xf860('0xea')][_0xf860('0xeb')]||_0x21be47[_0xf860('0xec')][_0xf860('0xeb')]||_0x21be47[_0xf860('0xea')][_0xf860('0xec')][_0xf860('0xeb')]});return db['UserVoiceQueueRt'][_0xf860('0x40')]({'where':{'membername':_0x4a7e63[_0xf860('0x3f')]},'individualHooks':!![]});}}else{throw new db[(_0xf860('0x9f'))][(_0xf860('0x9c'))](_0xf860('0xed'));}})['then'](function(){if(_0x4a7e63){return _0x4a7e63[_0xf860('0xee')]({'raw':!![]});}})[_0xf860('0x22')](function(_0x186c6f){if(_0x4a7e63){var _0x5d6ccb=[];if(_0x186c6f){_0x1cf74b=_0x186c6f;if(_0x1cf74b[_0xf860('0x51')]){for(var _0x3c7744=0x0;_0x3c7744<_0x1cf74b[_0xf860('0x51')];_0x3c7744++){_0x5d6ccb[_0xf860('0x95')]({'membername':_0x4a7e63[_0xf860('0x3f')],'UserId':_0x4a7e63['id'],'queue_name':_0x1cf74b[_0x3c7744][_0xf860('0x3f')],'VoiceQueueId':_0x1cf74b[_0x3c7744]['id'],'interface':_0x5b04ee,'paused':_0x4a7e63[_0xf860('0xaa')]||![],'penalty':_0x1cf74b[_0x3c7744]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0xf860('0x97')](_0x5d6ccb,function(_0x2f95bc){return db[_0xf860('0xbc')][_0xf860('0xbd')](_0x2f95bc);});}}}})[_0xf860('0x22')](function(){if(_0x4a7e63){return db[_0xf860('0xef')][_0xf860('0x63')]({'where':{'membername':_0x4a7e63['name'],'exitAt':null}});}})[_0xf860('0x22')](function(_0x52e620){if(_0x4a7e63){var _0x53b450=[];_0x52e620[_0xf860('0xf0')](function(_0x36b1be){_0x53b450[_0xf860('0x95')](_0x36b1be[_0xf860('0x67')]({'exitAt':moment()[_0xf860('0xb8')](_0xf860('0xf1'))}));});return BPromise[_0xf860('0x96')](_0x53b450);}})[_0xf860('0x22')](function(){if(_0x4a7e63){var _0x21821a=[];var _0x3dc522=[];var _0x337270=utils['getChannels']();var _0x5dd76b={'membername':_0x4a7e63[_0xf860('0x3f')],'interface':_0x5b04ee,'enterAt':moment()[_0xf860('0xb8')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x4a7e63[_0xf860('0x36')],'internal':_0x4a7e63['internal']};_0x337270[_0xf860('0xf0')](function(_0xdc9cb7){_0x21821a['push'](_[_0xf860('0x5a')]({'channel':_0xdc9cb7,'type':'LOGIN','data1':_0x21be47[_0xf860('0x68')][_0xf860('0xf2')],'data2':_0x5b04ee},_0x5dd76b));if(_0x4a7e63['loginInPause']){_0x3dc522[_0xf860('0x95')](_[_0xf860('0x5a')]({'channel':_0xdc9cb7,'type':_0xf860('0xf3'),'data1':_0xf860('0xf4')},_0x5dd76b));}});return db[_0xf860('0xef')][_0xf860('0xf5')](_0x21821a['concat'](_0x3dc522),{'individualHooks':!![]});}})['then'](function(){if(_0x4a7e63){return _0x4a7e63[_0xf860('0x67')]({'online':!![],'lastLoginAt':moment()['format'](_0xf860('0xf1')),'voicePause':_0x4a7e63[_0xf860('0xaa')]||![],'mailPause':_0x4a7e63[_0xf860('0xaa')]||![],'chatPause':_0x4a7e63[_0xf860('0xaa')]||![],'faxPause':_0x4a7e63[_0xf860('0xaa')]||![],'smsPause':_0x4a7e63['loginInPause']||![],'openchannelPause':_0x4a7e63[_0xf860('0xaa')]||![],'whatsappPause':_0x4a7e63['loginInPause']||![],'pauseType':_0x4a7e63[_0xf860('0xaa')]?'LOGININPAUSE':null,'interface':_0x5b04ee,'lastPauseAt':moment()[_0xf860('0xb8')](_0xf860('0xf1'))});}})['then'](function(_0x30ff5d){if(_0x21be47[_0xf860('0xf6')]){return _0x5b16f8();}else{return BPromise[_0xf860('0xf7')](_0x30ff5d)['then'](respondWithResult(_0x313296,null));}})[_0xf860('0x2c')](handleError(_0x313296,null));};exports[_0xf860('0xf8')]=function(_0x21d904,_0x63b118,_0x5d6e9a){var _0x5c720e;return db[_0xf860('0x44')][_0xf860('0x3e')]({'where':{'id':_0x21d904[_0xf860('0x66')]['id'],'role':_0xf860('0x8d')},'attributes':['id',_0xf860('0x3f'),_0xf860('0x36')]})[_0xf860('0x22')](handleEntityNotFound(_0x63b118,null))['then'](function(_0xd71ff1){if(_0xd71ff1){_0x5c720e=_0xd71ff1;return db[_0xf860('0xbc')][_0xf860('0x40')]({'where':{'membername':_0x5c720e[_0xf860('0x3f')]},'individualHooks':!![]});}})[_0xf860('0x22')](function(){return db[_0xf860('0xef')][_0xf860('0x63')]({'where':{'membername':_0x5c720e['name'],'exitAt':null}});})[_0xf860('0x22')](function(_0x233d14){var _0x54318b=[];_0x233d14['forEach'](function(_0x491989){_0x54318b[_0xf860('0x95')](_0x491989[_0xf860('0x67')]({'exitAt':moment()[_0xf860('0xb8')](_0xf860('0xf1'))}));});return BPromise[_0xf860('0x96')](_0x54318b);})['then'](function(){return _0x5c720e[_0xf860('0x67')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x63b118,null))[_0xf860('0x2c')](handleError(_0x63b118,null));};exports[_0xf860('0xf9')]=function(_0xf470df,_0x48e98b,_0x3e539c){var _0x1ca1f5;return db[_0xf860('0xbc')]['update']({'paused':0x1},{'where':{'UserId':_0xf470df[_0xf860('0x66')]['id']},'individualHooks':!![]})[_0xf860('0x22')](function(){return db[_0xf860('0x44')]['find']({'where':{'id':_0xf470df[_0xf860('0x66')]['id'],'role':_0xf860('0x8d')},'attributes':['id',_0xf860('0x3f'),_0xf860('0x36'),_0xf860('0x6c'),_0xf860('0xab')]});})[_0xf860('0x22')](handleEntityNotFound(_0x48e98b,null))[_0xf860('0x22')](function(_0x132574){if(_0x132574){_0x1ca1f5=_0x132574;return respondWithRpcPromise(_0xf860('0xfa'),_0xf860('0xf9'),{'id':_0x1ca1f5['id'],'name':_0x1ca1f5['name'],'pause':!![]});}})['then'](function(){if(_0x1ca1f5){return db[_0xf860('0xef')][_0xf860('0x63')]({'where':{'membername':_0x1ca1f5[_0xf860('0x3f')],'type':_0xf860('0xf3'),'exitAt':null}});}})[_0xf860('0x22')](function(_0x24e8b8){if(_0x24e8b8[_0xf860('0x51')]){var _0x575f1a=moment()[_0xf860('0xb8')](_0xf860('0xf1'));for(var _0x337c5f=0x0,_0x3a0399=_0x24e8b8[_0xf860('0x51')];_0x337c5f<_0x3a0399;_0x337c5f++){_0x24e8b8[_0x337c5f][_0xf860('0xfb')]({'exitAt':_0x575f1a});}}})[_0xf860('0x22')](function(){var _0x2193ca=[];var _0x3ced41=utils[_0xf860('0xfc')]();_0x3ced41[_0xf860('0xf0')](function(_0x3c5367){_0x2193ca[_0xf860('0x95')]({'channel':_0x3c5367,'membername':_0x1ca1f5[_0xf860('0x3f')],'interface':_[_0xf860('0x75')](_0x1ca1f5[_0xf860('0xab')])?util[_0xf860('0xb8')](_0xf860('0xb9'),_0x1ca1f5[_0xf860('0x3f')]):_0x1ca1f5[_0xf860('0xab')],'type':_0xf860('0xf3'),'enterAt':moment()[_0xf860('0xb8')](_0xf860('0xf1')),'data1':_0xf470df['body'][_0xf860('0x47')]||_0xf860('0xfd'),'role':_0x1ca1f5[_0xf860('0x36')],'internal':_0x1ca1f5[_0xf860('0x6c')]});});return db[_0xf860('0xef')][_0xf860('0xf5')](_0x2193ca,{'individualHooks':!![]});})[_0xf860('0x22')](function(){return _0x1ca1f5['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xf470df['body'][_0xf860('0x47')]||_0xf860('0xfd'),'lastPauseAt':moment()[_0xf860('0xb8')](_0xf860('0xf1'))});})[_0xf860('0x22')](respondWithResult(_0x48e98b,null))['catch'](handleError(_0x48e98b,null));};exports['unpause']=function(_0x3a39e3,_0x48390b,_0x9aa20d){var _0x33b7ed;return db[_0xf860('0x44')][_0xf860('0x3e')]({'where':{'id':_0x3a39e3[_0xf860('0x66')]['id']},'attributes':['id',_0xf860('0x3f'),'role',_0xf860('0xba'),'mailPause','chatPause',_0xf860('0xfe'),_0xf860('0xff'),_0xf860('0x100'),_0xf860('0x101'),'pauseType',_0xf860('0x102')]})[_0xf860('0x22')](handleEntityNotFound(_0x48390b,null))[_0xf860('0x22')](function(_0x15d3ac){if(_0x15d3ac){_0x33b7ed=_0x15d3ac;if(_0x3a39e3[_0xf860('0x68')][_0xf860('0xa9')]&&!utils[_0xf860('0xac')](_0x3a39e3[_0xf860('0x68')][_0xf860('0xa9')])){throw new db[(_0xf860('0x9f'))]['ValidationError'](_0xf860('0xad'));}switch(_0x3a39e3[_0xf860('0x68')][_0xf860('0xa9')]){case'voice':return respondWithRpcPromise(_0xf860('0xfa'),_0xf860('0x103'),{'id':_0x33b7ed['id'],'name':_0x33b7ed[_0xf860('0x3f')],'pause':![]})[_0xf860('0x22')](function(){return db[_0xf860('0xbc')][_0xf860('0x67')]({'paused':0x0},{'where':{'UserId':_0x33b7ed['id']},'individualHooks':!![]});})['then'](function(){return db['MemberReport']['find']({'where':{'channel':_0x3a39e3[_0xf860('0x68')][_0xf860('0xa9')],'membername':_0x33b7ed[_0xf860('0x3f')],'type':_0xf860('0xf3'),'exitAt':null}});})['then'](function(_0x41b15e){if(_0x41b15e){return _0x41b15e[_0xf860('0x67')]({'exitAt':moment()[_0xf860('0xb8')](_0xf860('0xf1')),'data2':_0xf860('0x104')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x33b7ed[_0xf860('0x67')]({'voicePause':![]});});case _0xf860('0x105'):case _0xf860('0x106'):case _0xf860('0x107'):case'sms':case _0xf860('0x108'):case _0xf860('0x109'):return db[_0xf860('0xef')][_0xf860('0x3e')]({'where':{'channel':_0x3a39e3[_0xf860('0x68')]['channel'],'membername':_0x33b7ed[_0xf860('0x3f')],'type':'PAUSE','exitAt':null}})[_0xf860('0x22')](function(_0x227de5){if(_0x227de5){return _0x227de5[_0xf860('0x67')]({'exitAt':moment()['format'](_0xf860('0xf1')),'data2':_0xf860('0x104')},{'individualHooks':!![]});}return null;})[_0xf860('0x22')](function(){var _0x15892e={};_[_0xf860('0x31')](_0x15892e,util[_0xf860('0xb8')](_0xf860('0x10a'),_0x3a39e3[_0xf860('0x68')][_0xf860('0xa9')],_0xf860('0x10b')),![]);return _0x33b7ed[_0xf860('0x67')](_0x15892e);});default:return respondWithRpcPromise('QueuePause',_0xf860('0x103'),{'id':_0x33b7ed['id'],'name':_0x33b7ed['name'],'pause':![]})[_0xf860('0x22')](function(){return db[_0xf860('0xbc')]['update']({'paused':0x0},{'where':{'UserId':_0x33b7ed['id']}});})[_0xf860('0x22')](function(){return db[_0xf860('0xef')][_0xf860('0x63')]({'where':{'membername':_0x33b7ed[_0xf860('0x3f')],'type':_0xf860('0xf3'),'exitAt':null}});})[_0xf860('0x22')](function(_0xbffa60){var _0x8b61f8=[];_0xbffa60['forEach'](function(_0x1493df){_0x8b61f8['push'](_0x1493df[_0xf860('0x67')]({'exitAt':moment()[_0xf860('0xb8')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'}));});return BPromise['all'](_0x8b61f8);})['then'](function(){return _0x33b7ed[_0xf860('0x67')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xf860('0x22')](respondWithResult(_0x48390b,null))[_0xf860('0x2c')](handleError(_0x48390b,null));};exports[_0xf860('0x10c')]=function(_0x12f893,_0x56bd9d,_0x4f591c){var _0x16fe89={};var _0x459df8={};var _0x1d9c10;var _0x28631c;return db[_0xf860('0x44')][_0xf860('0xa3')]({'where':{'id':_0x12f893['params']['id']}})[_0xf860('0x22')](handleEntityNotFound(_0x56bd9d,null))[_0xf860('0x22')](function(_0x414899){if(_0x414899){_0x1d9c10=_0x414899;_0x459df8[_0xf860('0x49')]=_['keys'](db[_0xf860('0x10d')][_0xf860('0x45')]);_0x459df8['query']=_[_0xf860('0x4c')](_0x12f893[_0xf860('0x50')]);_0x459df8[_0xf860('0x58')]=_[_0xf860('0x4d')](_0x459df8[_0xf860('0x49')],_0x459df8['query']);_0x16fe89[_0xf860('0x4e')]=_[_0xf860('0x4d')](_0x459df8['model'],qs['fields'](_0x12f893[_0xf860('0x50')][_0xf860('0x4f')]));_0x16fe89['attributes']=_0x16fe89['attributes']['length']?_0x16fe89['attributes']:_0x459df8[_0xf860('0x49')];_0x16fe89[_0xf860('0x56')]=qs[_0xf860('0x57')](_0x12f893['query']['sort']);_0x16fe89['where']=qs['filters'](_[_0xf860('0xcb')](_0x12f893[_0xf860('0x50')],_0x459df8['filters']));if(_0x12f893[_0xf860('0x50')]['filter']){_0x16fe89[_0xf860('0x59')]=_['merge'](_0x16fe89[_0xf860('0x59')],{'$or':_[_0xf860('0x43')](_0x16fe89[_0xf860('0x4e')],function(_0x47ca1d){var _0x263c2a={};_0x263c2a[_0x47ca1d]={'$like':'%'+_0x12f893['query'][_0xf860('0x3b')]+'%'};return _0x263c2a;})});}_0x16fe89=_[_0xf860('0x5a')]({},_0x16fe89,_0x12f893[_0xf860('0x5f')]);return _0x1d9c10[_0xf860('0x10c')](_0x16fe89);}})[_0xf860('0x22')](function(_0x25e59e){if(_0x25e59e){_0x28631c=_0x25e59e['length'];if(!_0x12f893['query'][_0xf860('0x52')](_0xf860('0x53'))){_0x16fe89[_0xf860('0x54')]=qs[_0xf860('0x54')](_0x12f893[_0xf860('0x50')][_0xf860('0x54')]);_0x16fe89['offset']=qs[_0xf860('0x55')](_0x12f893[_0xf860('0x50')][_0xf860('0x55')]);}return _0x1d9c10['getTeams'](_0x16fe89);}})[_0xf860('0x22')](function(_0x33113a){if(_0x33113a){return _0x33113a?{'count':_0x28631c,'rows':_0x33113a}:null;}})[_0xf860('0x22')](respondWithResult(_0x56bd9d,null))[_0xf860('0x2c')](handleError(_0x56bd9d,null));};exports[_0xf860('0x10e')]=function(_0x2d8bd7,_0x35038f){return db[_0xf860('0x44')][_0xf860('0x3e')]({'where':{'id':_0x2d8bd7[_0xf860('0x66')]['id']}})['then'](handleEntityNotFound(_0x35038f,null))[_0xf860('0x22')](function(_0x9125a4){if(_0x9125a4){var _0x2202a4=_0x9125a4['get']({'plain':!![]});return _0x9125a4['addTeams'](_0x2d8bd7[_0xf860('0x68')][_0xf860('0x6b')],_[_0xf860('0x10f')](_0x2d8bd7[_0xf860('0x68')],[_0xf860('0x6b'),'id'])||{})[_0xf860('0x22')](function(){for(var _0x31d5f8=0x0;_0x31d5f8<_0x2d8bd7['body'][_0xf860('0x6b')][_0xf860('0x51')];_0x31d5f8++){var _0xdf0f6f=[];db[_0xf860('0x10d')][_0xf860('0xa3')]({'where':{'id':_0x2d8bd7[_0xf860('0x68')]['ids'][_0x31d5f8]}})[_0xf860('0x22')](function(_0x244ad2){_0xdf0f6f[_0xf860('0x95')](_0x244ad2['getVoiceQueues']()['then'](function(_0x281e54){for(var _0x1929bb=0x0;_0x1929bb<_0x281e54[_0xf860('0x51')];_0x1929bb++){_0x281e54[_0x1929bb]['setDataValue'](_0xf860('0xa9'),_0xf860('0x110'));}return _0x281e54;}));_0xdf0f6f['push'](_0x244ad2[_0xf860('0x111')]()[_0xf860('0x22')](function(_0x1d47ec){for(var _0x372510=0x0;_0x372510<_0x1d47ec['length'];_0x372510++){_0x1d47ec[_0x372510][_0xf860('0x112')](_0xf860('0xa9'),_0xf860('0x113'));}return _0x1d47ec;}));_0xdf0f6f[_0xf860('0x95')](_0x244ad2[_0xf860('0x114')]()['then'](function(_0x340c23){for(var _0x4c27f5=0x0;_0x4c27f5<_0x340c23[_0xf860('0x51')];_0x4c27f5++){_0x340c23[_0x4c27f5][_0xf860('0x112')]('channel',_0xf860('0x115'));}return _0x340c23;}));_0xdf0f6f[_0xf860('0x95')](_0x244ad2[_0xf860('0x116')]()[_0xf860('0x22')](function(_0x2b926e){for(var _0x40e36c=0x0;_0x40e36c<_0x2b926e[_0xf860('0x51')];_0x40e36c++){_0x2b926e[_0x40e36c][_0xf860('0x112')](_0xf860('0xa9'),_0xf860('0x117'));}return _0x2b926e;}));_0xdf0f6f[_0xf860('0x95')](_0x244ad2['getWhatsappQueues']()[_0xf860('0x22')](function(_0x86e335){for(var _0xc8af2b=0x0;_0xc8af2b<_0x86e335[_0xf860('0x51')];_0xc8af2b++){_0x86e335[_0xc8af2b][_0xf860('0x112')](_0xf860('0xa9'),_0xf860('0x118'));}return _0x86e335;}));_0xdf0f6f[_0xf860('0x95')](_0x244ad2['getFaxQueues']()['then'](function(_0x14f1b8){for(var _0x1ecf85=0x0;_0x1ecf85<_0x14f1b8[_0xf860('0x51')];_0x1ecf85++){_0x14f1b8[_0x1ecf85]['setDataValue'](_0xf860('0xa9'),_0xf860('0x119'));}return _0x14f1b8;}));_0xdf0f6f[_0xf860('0x95')](_0x244ad2[_0xf860('0x11a')]()[_0xf860('0x22')](function(_0x411b8b){for(var _0x60d619=0x0;_0x60d619<_0x411b8b['length'];_0x60d619++){_0x411b8b[_0x60d619][_0xf860('0x112')](_0xf860('0xa9'),_0xf860('0x11b'));}return _0x411b8b;}));return BPromise[_0xf860('0x96')](_0xdf0f6f);})[_0xf860('0x22')](function(_0x563e04){var _0x4f5308=_[_0xf860('0x11c')](_0x563e04);_0xdf0f6f=[];return db[_0xf860('0x5c')][_0xf860('0x11d')](function(_0x5196cf){for(var _0x3051d0=0x0;_0x3051d0<_0x4f5308['length'];_0x3051d0++){_0xdf0f6f[_0xf860('0x95')](_0x4f5308[_0x3051d0][_0xf860('0x11e')](_0x2202a4['id']),{'transaction':_0x5196cf});}return BPromise['all'](_0xdf0f6f)[_0xf860('0x22')](function(){if(_0x2202a4[_0xf860('0x11f')]){return BPromise['each'](_['filter'](_0x4f5308,function(_0x24f6b4){return _0x24f6b4['getDataValue']('channel')===_0xf860('0x110');}),function(_0x5d4983){return db[_0xf860('0xbc')]['upsert']({'membername':_0x2202a4[_0xf860('0x3f')],'UserId':_0x2202a4['id'],'queue_name':_0x5d4983[_0xf860('0x3f')],'VoiceQueueId':_0x5d4983['id'],'interface':_[_0xf860('0x75')](_0x2202a4[_0xf860('0xab')])?util[_0xf860('0xb8')](_0xf860('0xb9'),_0x2202a4[_0xf860('0x3f')]):_0x2202a4['interface'],'paused':_0x2202a4[_0xf860('0xba')]||![],'penalty':_0x2202a4[_0xf860('0xbb')]},{'transaction':_0x5196cf});});}else{return;}})[_0xf860('0x22')](function(){for(var _0x27af3a=0x0;_0x27af3a<_0x4f5308[_0xf860('0x51')];_0x27af3a++){var _0x3b7644=_0x4f5308[_0x27af3a][_0xf860('0x120')](_0xf860('0xa9'));var _0x419cb7=_0x3b7644+_0xf860('0xb3');socket['emit'](_0xf860('0x39')+_0x3b7644+_0xf860('0xb5'),{'UserId':_0x2202a4['id'],['queueField']:_0x4f5308[_0x27af3a]['id']});}});});});}});}})[_0xf860('0x22')](respondWithStatusCode(_0x35038f,null))[_0xf860('0x2c')](handleError(_0x35038f,null));};exports[_0xf860('0x121')]=function(_0x35e77c,_0x148dab){return db[_0xf860('0x44')][_0xf860('0xa3')]({'where':{'id':_0x35e77c[_0xf860('0x66')]['id']}})[_0xf860('0x22')](handleEntityNotFound(_0x148dab,null))['then'](function(_0x18f797){if(_0x18f797){var _0x3dd500=_0x18f797[_0xf860('0x35')]({'plain':!![]});var _0x382721=_0x35e77c[_0xf860('0x50')][_0xf860('0x6b')];return _0x18f797[_0xf860('0x121')](_0x382721)[_0xf860('0x22')](function(){for(var _0x1e0a0a=0x0;_0x1e0a0a<_0x382721[_0xf860('0x51')];_0x1e0a0a++){var _0x2d7dd3=[];db['Team'][_0xf860('0xa3')]({'where':{'id':_0x382721[_0x1e0a0a]}})[_0xf860('0x22')](function(_0x2d50e4){_0x2d7dd3[_0xf860('0x95')](_0x2d50e4[_0xf860('0xee')]()[_0xf860('0x22')](function(_0x5d03a5){for(var _0x511c23=0x0;_0x511c23<_0x5d03a5[_0xf860('0x51')];_0x511c23++){_0x5d03a5[_0x511c23]['setDataValue'](_0xf860('0xa9'),_0xf860('0x110'));}return _0x5d03a5;}));_0x2d7dd3['push'](_0x2d50e4[_0xf860('0x111')]()[_0xf860('0x22')](function(_0xf9fcf3){for(var _0x528b8d=0x0;_0x528b8d<_0xf9fcf3[_0xf860('0x51')];_0x528b8d++){_0xf9fcf3[_0x528b8d][_0xf860('0x112')](_0xf860('0xa9'),_0xf860('0x113'));}return _0xf9fcf3;}));_0x2d7dd3[_0xf860('0x95')](_0x2d50e4[_0xf860('0x114')]()['then'](function(_0x26374b){for(var _0x18418c=0x0;_0x18418c<_0x26374b[_0xf860('0x51')];_0x18418c++){_0x26374b[_0x18418c]['setDataValue']('channel','Mail');}return _0x26374b;}));_0x2d7dd3[_0xf860('0x95')](_0x2d50e4['getSmsQueues']()[_0xf860('0x22')](function(_0x405844){for(var _0x544121=0x0;_0x544121<_0x405844['length'];_0x544121++){_0x405844[_0x544121]['setDataValue'](_0xf860('0xa9'),'Sms');}return _0x405844;}));_0x2d7dd3[_0xf860('0x95')](_0x2d50e4[_0xf860('0x122')]()[_0xf860('0x22')](function(_0x420afa){for(var _0x19a05b=0x0;_0x19a05b<_0x420afa[_0xf860('0x51')];_0x19a05b++){_0x420afa[_0x19a05b][_0xf860('0x112')](_0xf860('0xa9'),_0xf860('0x118'));}return _0x420afa;}));_0x2d7dd3[_0xf860('0x95')](_0x2d50e4[_0xf860('0x123')]()[_0xf860('0x22')](function(_0x2d134b){for(var _0x2a5b93=0x0;_0x2a5b93<_0x2d134b['length'];_0x2a5b93++){_0x2d134b[_0x2a5b93][_0xf860('0x112')]('channel',_0xf860('0x119'));}return _0x2d134b;}));_0x2d7dd3[_0xf860('0x95')](_0x2d50e4['getOpenchannelQueues']()[_0xf860('0x22')](function(_0x1236ea){for(var _0x15da59=0x0;_0x15da59<_0x1236ea[_0xf860('0x51')];_0x15da59++){_0x1236ea[_0x15da59][_0xf860('0x112')](_0xf860('0xa9'),_0xf860('0x11b'));}return _0x1236ea;}));return BPromise[_0xf860('0x96')](_0x2d7dd3);})[_0xf860('0x22')](function(_0x596f38){var _0x29a31a=_[_0xf860('0x11c')](_0x596f38);_0x2d7dd3=[];return db[_0xf860('0x5c')][_0xf860('0x11d')](function(_0x1d0b6f){for(var _0x2808f4=0x0;_0x2808f4<_0x29a31a[_0xf860('0x51')];_0x2808f4++){_0x2d7dd3[_0xf860('0x95')](_0x29a31a[_0x2808f4]['removeAgent'](_0x3dd500['id']),{'transaction':_0x1d0b6f});}return BPromise[_0xf860('0x96')](_0x2d7dd3)[_0xf860('0x22')](function(){if(_0x3dd500[_0xf860('0x11f')]){return BPromise[_0xf860('0x97')](_[_0xf860('0x3b')](_0x29a31a,function(_0x364931){return _0x364931[_0xf860('0x120')](_0xf860('0xa9'))===_0xf860('0x110');}),function(_0x42037a){return db['UserVoiceQueueRt'][_0xf860('0x40')]({'where':{'VoiceQueueId':_0x42037a['id'],'UserId':_0x3dd500['id']},'transaction':_0x1d0b6f});});}else{return;}})['then'](function(){for(var _0x530226=0x0;_0x530226<_0x29a31a[_0xf860('0x51')];_0x530226++){var _0x507088=_0x29a31a[_0x530226]['getDataValue'](_0xf860('0xa9'));var _0x5561e2=_0x507088+_0xf860('0xb3');socket[_0xf860('0xb4')](_0xf860('0x39')+_0x507088+_0xf860('0xbe'),{'UserId':_0x3dd500['id'],['queueField']:_0x29a31a[_0x530226]['id']});}});});});}});}})[_0xf860('0x22')](respondWithStatusCode(_0x148dab,null))[_0xf860('0x2c')](handleError(_0x148dab,null));};exports[_0xf860('0x124')]=function(_0x10ff56,_0x45c6d9,_0x4aae9f){var _0x3a86f9={};var _0x26ce7a={};var _0x4b1859;var _0x3c74e2;return db[_0xf860('0x44')]['findOne']({'where':{'id':_0x10ff56['params']['id']}})[_0xf860('0x22')](handleEntityNotFound(_0x45c6d9,null))[_0xf860('0x22')](function(_0x29940c){if(_0x29940c){_0x4b1859=_0x29940c;_0x26ce7a[_0xf860('0x49')]=_[_0xf860('0x4c')](db[_0xf860('0x125')][_0xf860('0x45')]);_0x26ce7a[_0xf860('0x50')]=_['keys'](_0x10ff56[_0xf860('0x50')]);_0x26ce7a[_0xf860('0x58')]=_[_0xf860('0x4d')](_0x26ce7a[_0xf860('0x49')],_0x26ce7a[_0xf860('0x50')]);_0x3a86f9['attributes']=_[_0xf860('0x4d')](_0x26ce7a[_0xf860('0x49')],qs['fields'](_0x10ff56[_0xf860('0x50')]['fields']));_0x3a86f9[_0xf860('0x4e')]=_0x3a86f9['attributes'][_0xf860('0x51')]?_0x3a86f9['attributes']:_0x26ce7a[_0xf860('0x49')];_0x3a86f9[_0xf860('0x56')]=qs[_0xf860('0x57')](_0x10ff56['query'][_0xf860('0x57')]);_0x3a86f9['where']=qs[_0xf860('0x58')](_[_0xf860('0xcb')](_0x10ff56['query'],_0x26ce7a['filters']));if(_0x10ff56['query'][_0xf860('0x3b')]){_0x3a86f9[_0xf860('0x59')]=_[_0xf860('0x5a')](_0x3a86f9['where'],{'$or':_[_0xf860('0x43')](_0x3a86f9[_0xf860('0x4e')],function(_0x403850){var _0x59e5d8={};_0x59e5d8[_0x403850]={'$like':'%'+_0x10ff56[_0xf860('0x50')][_0xf860('0x3b')]+'%'};return _0x59e5d8;})});}_0x3a86f9=_[_0xf860('0x5a')]({},_0x3a86f9,_0x10ff56[_0xf860('0x5f')]);return _0x4b1859[_0xf860('0x124')](_0x3a86f9);}})[_0xf860('0x22')](function(_0x2100b8){if(_0x2100b8){_0x3c74e2=_0x2100b8[_0xf860('0x51')];if(!_0x10ff56[_0xf860('0x50')][_0xf860('0x52')](_0xf860('0x53'))){_0x3a86f9[_0xf860('0x54')]=qs[_0xf860('0x54')](_0x10ff56[_0xf860('0x50')][_0xf860('0x54')]);_0x3a86f9['offset']=qs[_0xf860('0x55')](_0x10ff56[_0xf860('0x50')][_0xf860('0x55')]);}return _0x4b1859[_0xf860('0x124')](_0x3a86f9);}})[_0xf860('0x22')](function(_0x20f542){if(_0x20f542){return _0x20f542?{'count':_0x3c74e2,'rows':_0x20f542}:null;}})[_0xf860('0x22')](respondWithResult(_0x45c6d9,null))[_0xf860('0x2c')](handleError(_0x45c6d9,null));};exports[_0xf860('0x126')]=function(_0x2ca2f4,_0x21fae6,_0x5e6da6){var _0x46d052={};var _0x1e7c77={};var _0x434f5c;var _0x5d630a;return db[_0xf860('0x44')][_0xf860('0xa3')]({'where':{'id':_0x2ca2f4['params']['id']}})[_0xf860('0x22')](handleEntityNotFound(_0x21fae6,null))['then'](function(_0x5d3263){if(_0x5d3263){_0x434f5c=_0x5d3263;_0x1e7c77['model']=_['keys'](db[_0xf860('0x44')][_0xf860('0x45')]);_0x1e7c77['query']=_['keys'](_0x2ca2f4[_0xf860('0x50')]);_0x1e7c77[_0xf860('0x58')]=_[_0xf860('0x4d')](_0x1e7c77[_0xf860('0x49')],_0x1e7c77['query']);_0x46d052[_0xf860('0x4e')]=_[_0xf860('0x4d')](_0x1e7c77[_0xf860('0x49')],qs[_0xf860('0x4f')](_0x2ca2f4[_0xf860('0x50')][_0xf860('0x4f')]));_0x46d052[_0xf860('0x4e')]=_0x46d052[_0xf860('0x4e')][_0xf860('0x51')]?_0x46d052[_0xf860('0x4e')]:_0x1e7c77['model'];_0x46d052[_0xf860('0x56')]=qs[_0xf860('0x57')](_0x2ca2f4[_0xf860('0x50')]['sort']);_0x46d052[_0xf860('0x59')]=qs[_0xf860('0x58')](_[_0xf860('0xcb')](_0x2ca2f4[_0xf860('0x50')],_0x1e7c77['filters']));if(_0x2ca2f4[_0xf860('0x50')][_0xf860('0x3b')]){_0x46d052['where']=_[_0xf860('0x5a')](_0x46d052[_0xf860('0x59')],{'$or':_[_0xf860('0x43')](_0x46d052[_0xf860('0x4e')],function(_0xcd7fc2){var _0x3cfcd0={};_0x3cfcd0[_0xcd7fc2]={'$like':'%'+_0x2ca2f4[_0xf860('0x50')][_0xf860('0x3b')]+'%'};return _0x3cfcd0;})});}_0x46d052['model']=db[_0xf860('0x44')];_0x46d052['as']=_0xf860('0x8e');_0x46d052=_[_0xf860('0x5a')]({},_0x46d052,_0x2ca2f4[_0xf860('0x5f')]);return _0x434f5c['getVoiceQueues']({'include':[_0x46d052]});}})[_0xf860('0x22')](function(_0x49d655){if(_0x49d655){var _0x2bcf2f={},_0x3df2e8=[],_0x352c2a=0x0;for(var _0x13a3ef=0x0;_0x13a3ef<_0x49d655['length'];_0x13a3ef+=0x1){for(var _0x5e958c=0x0,_0x5b4ef8;_0x5e958c<_0x49d655[_0x13a3ef][_0xf860('0x8e')]['length'];_0x5e958c+=0x1){_0x5b4ef8=_0x49d655[_0x13a3ef][_0xf860('0x8e')][_0x5e958c][_0xf860('0x35')]({'plain':!![]});_0x2bcf2f[_0x5b4ef8['id']]=_0x5b4ef8;}}_0x2bcf2f=_[_0xf860('0x127')](_0x2bcf2f);for(var _0x1edb86=qs['offset'](_0x2ca2f4[_0xf860('0x50')]['offset']);_0x1edb86<_0x2bcf2f[_0xf860('0x51')]&&_0x3df2e8[_0xf860('0x51')]=_0x30ab9e){_0x72c957=_0x30ab9e;_0xe319fa=0xc8;}else{_0xe319fa=0xce;}_0xf1dcd4[_0x363e('0x26')](_0xe319fa);return _0xf1dcd4[_0x363e('0x2c')](_0x363e('0x2d'),_0x57b949+'-'+_0x72c957+'/'+_0x30ab9e)[_0x363e('0x28')](_0x3904bd);}return null;};}function patchUpdates(_0x15fc46){return function(_0x18c2a1){try{jsonpatch['apply'](_0x18c2a1,_0x15fc46,!![]);}catch(_0x302166){return BPromise[_0x363e('0x2e')](_0x302166);}return _0x18c2a1[_0x363e('0x2f')]();};}function saveUpdates(_0x29931a,_0x2b4116){return function(_0x56b0f2){if(_0x56b0f2){return _0x56b0f2[_0x363e('0x30')](_0x29931a)[_0x363e('0x31')](function(_0x18a8be){return _0x18a8be;});}return null;};}function removeEntity(_0x336216,_0x51a3b3){return function(_0x49953f){if(_0x49953f){return _0x49953f['destroy']()[_0x363e('0x31')](function(){var _0x289895=_0x49953f['get']({'plain':!![]});if(_0x289895[_0x363e('0x32')]===_0x363e('0x33'))return;var _0x125d57=[{'name':_0x363e('0x34'),'value':_0x363e('0x35'),'ignore':!![]},{'name':_0x363e('0x36'),'value':'agent','ignore':![]},{'name':_0x363e('0x37'),'value':'telephone','ignore':![]}];var _0x1a4731=_(_0x125d57)[_0x363e('0x38')]('ignore')[_0x363e('0x39')](_0x363e('0x3a'))['value']();if(_[_0x363e('0x3b')](_0x1a4731,_0x289895[_0x363e('0x32')])){return;}var _0x4ddad3=_[_0x363e('0x3c')](_0x125d57,[_0x363e('0x3a'),_0x289895[_0x363e('0x32')]])[_0x363e('0x3d')];return db[_0x363e('0x3e')][_0x363e('0x3f')]({'where':{'type':_0x4ddad3,'resourceId':_0x289895['id']}})['then'](function(){return _0x49953f;});})[_0x363e('0x31')](function(){_0x336216[_0x363e('0x26')](0xcc)[_0x363e('0x27')]();});}};}function handleEntityNotFound(_0x5236f8,_0x584d4a){return function(_0xdd73b6){if(!_0xdd73b6){_0x5236f8[_0x363e('0x25')](0x194);}return _0xdd73b6;};}function handleError(_0x3844af,_0x4ca257){_0x4ca257=_0x4ca257||0x1f4;return function(_0x2b87d8){logger[_0x363e('0x21')](_0x2b87d8['stack']);if(_0x2b87d8[_0x363e('0x3d')]){delete _0x2b87d8[_0x363e('0x3d')];}_0x3844af[_0x363e('0x26')](_0x4ca257)[_0x363e('0x40')](_0x2b87d8);};}exports[_0x363e('0x41')]=function(_0x222269,_0x6a9855){var _0x52d037={},_0x2b0b42={},_0xd53cb={'count':0x0,'rows':[]};var _0x4d0a0f=_[_0x363e('0x39')](db['User'][_0x363e('0x42')],function(_0x355a83){return{'name':_0x355a83[_0x363e('0x43')],'type':_0x355a83[_0x363e('0x44')][_0x363e('0x45')]};});_0x2b0b42[_0x363e('0x46')]=_[_0x363e('0x47')](_[_0x363e('0x39')](_0x4d0a0f,_0x363e('0x3d')),[_0x363e('0x48'),_0x363e('0x49')]);_0x2b0b42['query']=_[_0x363e('0x4a')](_0x222269[_0x363e('0x4b')]);_0x2b0b42[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x2b0b42[_0x363e('0x46')],_0x2b0b42['query']);_0x52d037['attributes']=_[_0x363e('0x4d')](_0x2b0b42[_0x363e('0x46')],qs['fields'](_0x222269['query'][_0x363e('0x4e')]));_0x52d037[_0x363e('0x4f')]=_0x52d037[_0x363e('0x4f')][_0x363e('0x50')]?_0x52d037[_0x363e('0x4f')]:_0x2b0b42['model'];if(!_0x222269[_0x363e('0x4b')]['hasOwnProperty'](_0x363e('0x51'))){_0x52d037['limit']=qs[_0x363e('0x2b')](_0x222269[_0x363e('0x4b')][_0x363e('0x2b')]);_0x52d037['offset']=qs[_0x363e('0x2a')](_0x222269[_0x363e('0x4b')][_0x363e('0x2a')]);}_0x52d037[_0x363e('0x52')]=qs[_0x363e('0x53')](_0x222269[_0x363e('0x4b')][_0x363e('0x53')]);_0x52d037[_0x363e('0x54')]=qs['filters'](_[_0x363e('0x55')](_0x222269[_0x363e('0x4b')],_0x2b0b42['filters']),_0x4d0a0f);if(_0x222269['query'][_0x363e('0x38')]){_0x52d037[_0x363e('0x54')]=_[_0x363e('0x56')](_0x52d037[_0x363e('0x54')],{'$or':_['map'](_0x4d0a0f,function(_0x27a5e9){if(_0x27a5e9[_0x363e('0x44')]!=='VIRTUAL'){return db[_0x363e('0x57')][_0x363e('0x54')](db[_0x363e('0x57')]['fn'](_0x363e('0x58'),db['sequelize'][_0x363e('0x59')](_0x27a5e9['name'])),{'$like':db[_0x363e('0x57')]['fn']('lower','%'+_0x222269['query'][_0x363e('0x38')]+'%')});}})});}_0x52d037=_[_0x363e('0x56')]({},_0x52d037,_0x222269['options']);var _0x4878fe={'where':_0x52d037['where']};return db[_0x363e('0x5a')][_0x363e('0x29')](_0x4878fe)[_0x363e('0x31')](function(_0xda95c6){_0xd53cb['count']=_0xda95c6;if(_0x222269[_0x363e('0x4b')]['includeAll']){_0x52d037[_0x363e('0x5b')]=[{'all':!![]}];}return db[_0x363e('0x5a')][_0x363e('0x5c')](_0x52d037);})[_0x363e('0x31')](function(_0x3a3fd8){_0xd53cb[_0x363e('0x5d')]=_0x3a3fd8;return _0xd53cb;})[_0x363e('0x31')](respondWithFilteredResult(_0x6a9855,_0x52d037))[_0x363e('0x24')](handleError(_0x6a9855,null));};exports['show']=function(_0x4bf8be,_0x594c43){var _0x2981ef={'raw':![],'where':{'id':_0x4bf8be[_0x363e('0x5e')]['id']}},_0x42fc13={};_0x42fc13['model']=_['differenceBy'](_['keys'](db[_0x363e('0x5a')][_0x363e('0x42')]),[_0x363e('0x48'),_0x363e('0x49')]);_0x42fc13['query']=_[_0x363e('0x4a')](_0x4bf8be[_0x363e('0x4b')]);_0x42fc13[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x42fc13[_0x363e('0x46')],_0x42fc13[_0x363e('0x4b')]);_0x2981ef[_0x363e('0x4f')]=_[_0x363e('0x4d')](_0x42fc13[_0x363e('0x46')],qs[_0x363e('0x4e')](_0x4bf8be['query'][_0x363e('0x4e')]));_0x2981ef['attributes']=_0x2981ef[_0x363e('0x4f')][_0x363e('0x50')]?_0x2981ef[_0x363e('0x4f')]:_0x42fc13[_0x363e('0x46')];if(_0x4bf8be[_0x363e('0x4b')][_0x363e('0x5f')]){_0x2981ef[_0x363e('0x5b')]=[{'all':!![]}];}_0x2981ef=_[_0x363e('0x56')]({},_0x2981ef,_0x4bf8be[_0x363e('0x60')]);return db[_0x363e('0x5a')][_0x363e('0x3c')](_0x2981ef)[_0x363e('0x31')](handleEntityNotFound(_0x594c43,null))['then'](respondWithResult(_0x594c43,null))['catch'](handleError(_0x594c43,null));};exports[_0x363e('0x30')]=function(_0x1dd5c4,_0x205718){if(_0x1dd5c4[_0x363e('0x61')]['id']){delete _0x1dd5c4[_0x363e('0x61')]['id'];}delete _0x1dd5c4['body'][_0x363e('0x32')];return db[_0x363e('0x5a')]['find']({'where':{'id':_0x1dd5c4[_0x363e('0x5e')]['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x205718,null))['then'](saveUpdates(_0x1dd5c4['body'],null))[_0x363e('0x31')](respondWithResult(_0x205718,null))[_0x363e('0x24')](handleError(_0x205718,null));};exports['describe']=function(_0x598335,_0x446de5){return db[_0x363e('0x5a')][_0x363e('0x62')]()[_0x363e('0x31')](respondWithResult(_0x446de5,null))[_0x363e('0x24')](handleError(_0x446de5,null));};exports[_0x363e('0x63')]=function(_0x5e3ec1,_0x232bef,_0x1b4e0c){return db[_0x363e('0x5a')][_0x363e('0x3c')]({'where':{'id':_0x5e3ec1['params']['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x232bef,null))[_0x363e('0x31')](function(_0x51859f){if(_0x51859f){return _0x51859f[_0x363e('0x63')](_0x5e3ec1[_0x363e('0x61')][_0x363e('0x64')],_[_0x363e('0x65')](_0x5e3ec1[_0x363e('0x61')],[_0x363e('0x64'),'id'])||{});}})[_0x363e('0x31')](respondWithResult(_0x232bef,null))['catch'](handleError(_0x232bef,null));};function validateUser(_0x21b114){return new BPromise(function(_0x4a100d,_0x2e69dd){if(_0x21b114[_0x363e('0x66')])return _0x4a100d(_0x21b114);return db[_0x363e('0x67')]['findById'](0x1)['then'](function(_0x7f198e){if(_0x7f198e[_0x363e('0x68')])authService[_0x363e('0x69')](_0x21b114[_0x363e('0x48')]);db['User'][_0x363e('0x6a')](_0x363e('0x66'))[_0x363e('0x31')](function(_0x18598f){if(_[_0x363e('0x6b')](_0x18598f)){_0x21b114['internal']=_0x7f198e[_0x363e('0x6c')]||0x1;return;}if(_[_0x363e('0x6b')](_0x7f198e[_0x363e('0x6c')])||_0x7f198e[_0x363e('0x6c')]===_0x18598f){_0x21b114[_0x363e('0x66')]=_0x18598f+0x1;return;}if(_0x7f198e[_0x363e('0x6c')]>_0x18598f){_0x21b114['internal']=_0x7f198e[_0x363e('0x6c')];return;}return db['sequelize'][_0x363e('0x4b')](_0x363e('0x6d'),{'type':db['sequelize'][_0x363e('0x6e')][_0x363e('0x6f')]})[_0x363e('0x31')](function(_0x59cc6e){if(_0x59cc6e&&_0x59cc6e[_0x363e('0x50')]){for(var _0x233b66=0x0,_0x2c1951=_0x59cc6e['length'];_0x233b66<_0x2c1951&&_[_0x363e('0x6b')](_0x21b114[_0x363e('0x66')]);_0x233b66++){if(_0x7f198e[_0x363e('0x6c')]<=_0x59cc6e[_0x233b66]['from']){_0x21b114[_0x363e('0x66')]=_0x59cc6e[_0x233b66][_0x363e('0x70')];}else if(_0x7f198e['min_internal']>_0x59cc6e[_0x233b66][_0x363e('0x70')]&&_0x7f198e[_0x363e('0x6c')]<=_0x59cc6e[_0x233b66]['to']){_0x21b114[_0x363e('0x66')]=_0x7f198e[_0x363e('0x6c')];}}}if(_['isNil'](_0x21b114[_0x363e('0x66')])){_0x21b114[_0x363e('0x66')]=_0x18598f+0x1;}return _0x4a100d(_0x21b114);});});})[_0x363e('0x24')](function(_0x54bb94){_0x2e69dd(_0x54bb94);});});}function updateUser(_0xfcfc3a){return new BPromise(function(_0x10a867,_0x34e5cd){try{if(_0xfcfc3a[_0x363e('0x71')]){_0xfcfc3a[_0x363e('0x72')]=_0xfcfc3a['internal'];_0xfcfc3a[_0x363e('0x73')]={'mailbox':_0xfcfc3a[_0x363e('0x66')],'password':_0xfcfc3a['password'],'fullname':_0xfcfc3a[_0x363e('0x74')],'email':_0xfcfc3a[_0x363e('0x75')]};}if(_0xfcfc3a['role']==='agent'){if(!_0xfcfc3a[_0x363e('0x76')])_0xfcfc3a[_0x363e('0x76')]=[_0x363e('0x77'),_0x363e('0x78'),'103',_0x363e('0x79'),_0x363e('0x7a'),'104',_0x363e('0x7b'),_0x363e('0x7c'),_0x363e('0x7d'),_0x363e('0x7e'),_0x363e('0x7f'),_0x363e('0x80'),_0x363e('0x81'),_0x363e('0x82')];}_0x10a867(_0xfcfc3a);}catch(_0x290b62){_0x34e5cd(_0x290b62);}});}exports[_0x363e('0x83')]=function(_0x3ccd74,_0x29c765){if(_0x3ccd74[_0x363e('0x35')][_0x363e('0x32')]===_0x363e('0x84'))throw new Error(_0x363e('0x85'));if(_0x3ccd74[_0x363e('0x61')][_0x363e('0x32')]===_0x363e('0x35')&&_0x3ccd74['user'][_0x363e('0x32')]!==_0x363e('0x33')){throw new Error(_0x363e('0x86'));}if(_0x3ccd74[_0x363e('0x61')][_0x363e('0x32')]===_0x363e('0x33')&&_0x3ccd74[_0x363e('0x35')][_0x363e('0x32')]!==_0x363e('0x33')){throw new Error(_0x363e('0x87'));}return licenseUtil[_0x363e('0x88')]([_0x3ccd74['body']])[_0x363e('0x31')](function(){return validateUser(_0x3ccd74[_0x363e('0x61')]);})[_0x363e('0x31')](function(_0x4b3c97){return updateUser(_0x4b3c97)[_0x363e('0x31')](function(_0x387afe){if(_0x387afe[_0x363e('0x32')]===_0x363e('0x33')){_0x387afe[_0x363e('0x89')]=_0x3ccd74[_0x363e('0x35')][_0x363e('0x89')];delete _0x387afe[_0x363e('0x8a')];}return _0x387afe;});})[_0x363e('0x31')](function(_0x1c13f3){return db[_0x363e('0x5a')][_0x363e('0x83')](_0x1c13f3,{'include':[{'model':db[_0x363e('0x73')],'as':_0x363e('0x73')}]});})[_0x363e('0x31')](function(_0x4a2130){if(_0x3ccd74[_0x363e('0x61')][_0x363e('0x32')]==='user')return _0x4a2130;if(_0x3ccd74[_0x363e('0x35')][_0x363e('0x32')]!==_0x363e('0x35'))return _0x4a2130;return db['UserProfileSection']['find']({'where':{'name':_0x4a2130['role']===_0x363e('0x84')?_0x363e('0x36'):_0x363e('0x37'),'userProfileId':_0x3ccd74[_0x363e('0x35')][_0x363e('0x8a')]},'raw':!![]})[_0x363e('0x31')](function(_0x155d20){if(!_0x155d20||_0x155d20[_0x363e('0x8b')]!=0x0)return _0x4a2130;return db[_0x363e('0x3e')]['create']({'name':_0x4a2130['name'],'resourceId':_0x4a2130['id'],'type':_0x155d20[_0x363e('0x3d')],'sectionId':_0x155d20['id']},{})[_0x363e('0x31')](function(){return _0x4a2130;});})[_0x363e('0x24')](function(_0x498e4a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x498e4a);throw _0x498e4a;});})[_0x363e('0x31')](respondWithResult(_0x29c765,0xc9))[_0x363e('0x24')](handleError(_0x29c765,null));};exports['bulkCreate']=function(_0x13defe,_0x5db113){var _0x3d408e=_0x13defe['body'];var _0x1b3d25=[];if(_0x13defe['user'][_0x363e('0x32')]==='agent')throw new Error(_0x363e('0x85'));if(_['some'](_0x3d408e,[_0x363e('0x32'),_0x363e('0x35')])&&_0x13defe[_0x363e('0x35')][_0x363e('0x32')]!==_0x363e('0x33')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x363e('0x8c')](_0x3d408e,[_0x363e('0x32'),_0x363e('0x33')])&&_0x13defe[_0x363e('0x35')][_0x363e('0x32')]!==_0x363e('0x33')){throw new Error(_0x363e('0x8d'));}return licenseUtil[_0x363e('0x88')](_0x3d408e)[_0x363e('0x31')](function(){return validateUser(_0x3d408e[0x0]);})[_0x363e('0x31')](function(){for(var _0x21f37b=0x1;_0x21f37b<_0x3d408e['length'];_0x21f37b++){var _0xf52c22=_0x3d408e[_0x21f37b-0x1]['internal'];if(!_0x3d408e[_0x21f37b][_0x363e('0x66')])_0x3d408e[_0x21f37b][_0x363e('0x66')]=_0xf52c22+0x1;_0x1b3d25[_0x363e('0x8e')](validateUser(_0x3d408e[_0x21f37b]));}return BPromise['all'](_0x1b3d25);})[_0x363e('0x31')](function(){_0x1b3d25=[];for(var _0x3cb732=0x0;_0x3cb732<_0x3d408e['length'];_0x3cb732++){_0x1b3d25[_0x363e('0x8e')](updateUser(_0x3d408e[_0x3cb732]));}return BPromise['all'](_0x1b3d25);})[_0x363e('0x31')](function(){return BPromise[_0x363e('0x8f')](_0x3d408e,function(_0x51c99d){return db[_0x363e('0x5a')]['create'](_0x51c99d,{'include':[{'model':db[_0x363e('0x73')],'as':_0x363e('0x73')}]})[_0x363e('0x31')](function(_0x45724c){_0x51c99d['id']=_0x45724c['id'];return _0x51c99d;});});})[_0x363e('0x31')](function(_0x3e6ae5){if(_0x13defe[_0x363e('0x61')]['role']===_0x363e('0x35'))return _0x3e6ae5;if(_0x13defe['user'][_0x363e('0x32')]!==_0x363e('0x35'))return _0x3e6ae5;var _0x5d57fd=_[_0x363e('0x8c')](_0x3e6ae5,function(_0x281517){return _0x281517[_0x363e('0x32')]===_0x363e('0x84')||_0x281517[_0x363e('0x32')]==='telephone';});if(!_0x5d57fd)return _0x3e6ae5;return db[_0x363e('0x90')][_0x363e('0x5c')]({'where':{'name':{'$or':[_0x363e('0x36'),'Telephones']},'userProfileId':_0x13defe[_0x363e('0x35')]['userProfileId']},'raw':!![]})[_0x363e('0x31')](function(_0x189b68){if(_[_0x363e('0x91')](_0x189b68)||!_[_0x363e('0x8c')](_0x189b68,['autoAssociation',0x0]))return _0x3e6ae5;_0x1b3d25=[];var _0x3cfe0c=_(_0x189b68)[_0x363e('0x39')](function(_0x8a78ba){if(_0x8a78ba[_0x363e('0x8b')]===0x1)return;return _0x8a78ba[_0x363e('0x3d')]===_0x363e('0x36')?_0x363e('0x84'):_0x363e('0x92');})['compact']()[_0x363e('0x3a')]();for(var _0x2cc98b=0x0;_0x2cc98b<_0x3e6ae5[_0x363e('0x50')];_0x2cc98b++){if(!_[_0x363e('0x3b')](_0x3cfe0c,_0x3e6ae5[_0x2cc98b][_0x363e('0x32')]))return;var _0x1029da=_0x3e6ae5[_0x2cc98b][_0x363e('0x32')]==='agent'?_0x363e('0x36'):'Telephones';_0x1b3d25[_0x363e('0x8e')](db[_0x363e('0x3e')]['create']({'name':_0x3e6ae5[_0x2cc98b][_0x363e('0x3d')],'resourceId':_0x3e6ae5[_0x2cc98b]['id'],'type':_0x1029da,'sectionId':_[_0x363e('0x3c')](_0x189b68,[_0x363e('0x3d'),_0x1029da])['id']},{}));}return BPromise[_0x363e('0x93')](_0x1b3d25);})['then'](respondWithResult(_0x5db113,0xc9))[_0x363e('0x24')](handleError(_0x5db113,null));});};exports['changePassword']=function(_0x511394,_0xbceacd,_0x7e5d25){if(_0x511394[_0x363e('0x61')]['id']){delete _0x511394[_0x363e('0x61')]['id'];}return db[_0x363e('0x5a')][_0x363e('0x3c')]({'where':{'id':_0x511394[_0x363e('0x5e')]['id']}})['then'](function(_0x4c5241){if(!_0x4c5241)return null;if(_0x4c5241['id']===_0x511394[_0x363e('0x35')]['id']){if(!_0x511394[_0x363e('0x61')][_0x363e('0x94')]||!_0x511394['body'][_0x363e('0x95')]){throw new db[(_0x363e('0x96'))][(_0x363e('0x97'))](_0x363e('0x98'));}if(!_0x4c5241[_0x363e('0x99')](_0x511394[_0x363e('0x61')][_0x363e('0x94')])){throw new db[(_0x363e('0x96'))][(_0x363e('0x97'))]('Wrong\x20credentials');}if(_0x511394[_0x363e('0x61')][_0x363e('0x94')]===_0x511394[_0x363e('0x61')][_0x363e('0x95')]){throw new db[(_0x363e('0x96'))][(_0x363e('0x97'))](_0x363e('0x9a'));}}else if(_0x511394[_0x363e('0x35')]['role']===_0x363e('0x33')){if(!_0x511394['body'][_0x363e('0x95')]){throw new db['Sequelize']['ValidationError'](_0x363e('0x9b'));}}else if(_0x511394[_0x363e('0x35')][_0x363e('0x32')]===_0x363e('0x35')){if(!_0x511394[_0x363e('0x61')][_0x363e('0x95')]){throw new db[(_0x363e('0x96'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x4c5241[_0x363e('0x32')]!==_0x363e('0x84')){throw new db[(_0x363e('0x96'))][(_0x363e('0x97'))](_0x363e('0x85'));}}else{throw new db[(_0x363e('0x96'))]['ValidationError'](_0x363e('0x85'));}return _0x4c5241;})[_0x363e('0x31')](handleEntityNotFound(_0xbceacd,null))[_0x363e('0x31')](function(_0x11f437){return db[_0x363e('0x67')]['findOne']({'attributes':['id','securePassword',_0x363e('0x9c'),_0x363e('0x9d')]})[_0x363e('0x31')](function(_0x55bdb4){if(_0x55bdb4[_0x363e('0x68')])authService[_0x363e('0x69')](_0x511394[_0x363e('0x61')][_0x363e('0x95')]);if(!_0x55bdb4[_0x363e('0x9c')]||!_0x11f437[_0x363e('0x9e')])return _0x11f437;authService['validatePasswordHistory'](_0x511394[_0x363e('0x61')][_0x363e('0x95')],_0x11f437['previousPasswords'],_0x55bdb4[_0x363e('0x9d')]);return _0x11f437;})['then'](saveUpdates({'password':_0x511394['body'][_0x363e('0x95')],'passwordResetAt':_0x511394[_0x363e('0x35')]['id']==_0x511394['params']['id']?moment():null,'previousPasswords':authService[_0x363e('0x9f')](_0x511394['body'][_0x363e('0x95')],_0x11f437[_0x363e('0x9e')])},null));})['then'](respondWithResult(_0xbceacd,null))[_0x363e('0x24')](handleError(_0xbceacd,null));};exports[_0x363e('0xa0')]=function(_0x1e419c,_0x39488d,_0x2b3b2b){var _0x4507d7=_0x1e419c[_0x363e('0x61')][_0x363e('0xa1')];return db[_0x363e('0x5a')][_0x363e('0x3c')]({'where':{'id':_0x1e419c[_0x363e('0x5e')]['id']},'attributes':['id',_0x363e('0x3d'),'role',_0x363e('0xa2'),_0x363e('0xa3'),_0x363e('0xa4'),_0x363e('0xa5')]})['then'](handleEntityNotFound(_0x39488d,null))['then'](function(_0x5c2ac7){if(_0x5c2ac7){if(!utils[_0x363e('0xa6')](_0x4507d7)){throw new db[(_0x363e('0x96'))][(_0x363e('0x97'))](_0x363e('0xa7'));}return _0x5c2ac7[_0x363e('0xa8')+_[_0x363e('0xa9')](_0x4507d7[_0x363e('0xaa')]())+_0x363e('0xab')](_0x1e419c[_0x363e('0x61')][_0x363e('0x64')],{'penalty':_0x1e419c[_0x363e('0x61')][_0x363e('0xac')]||0x0})['spread'](function(_0x18168e){for(var _0x24638f=0x0;_0x24638f<_0x1e419c['body'][_0x363e('0x64')][_0x363e('0x50')];_0x24638f+=0x1){var _0x33d982={'UserId':_0x1e419c['params']['id']};_0x33d982[_[_0x363e('0xa9')](_0x4507d7['toLowerCase']())+_0x363e('0xad')]=_0x1e419c['body'][_0x363e('0x64')][_0x24638f];socket[_0x363e('0xae')](_0x363e('0x35')+_[_0x363e('0xa9')](_0x4507d7[_0x363e('0xaa')]())+'Queue:save',_0x33d982);}return _0x18168e;})['then'](function(){if(_0x4507d7==='voice'){return db[_0x363e('0xaf')][_0x363e('0x5c')]({'where':{'id':_0x1e419c[_0x363e('0x61')]['ids']||[]},'raw':!![],'attributes':['id',_0x363e('0x3d')]});}})['then'](function(_0x4340d1){var _0x424929=_0x5c2ac7['get']({'plain':!![]});var _0x2041cb=[];if(_0x4507d7===_0x363e('0xb0')&&_0x424929['role']==='agent'&&_0x424929['online']){for(var _0x522e9b=0x0;_0x522e9b<_0x4340d1[_0x363e('0x50')];_0x522e9b+=0x1){_0x2041cb[_0x363e('0x8e')]({'membername':_0x424929[_0x363e('0x3d')],'UserId':_0x424929['id'],'queue_name':_0x4340d1[_0x522e9b][_0x363e('0x3d')],'VoiceQueueId':_0x4340d1[_0x522e9b]['id'],'interface':_[_0x363e('0x6b')](_0x424929[_0x363e('0xa5')])?util[_0x363e('0xb1')]('SIP/%s',_0x424929[_0x363e('0x3d')]):_0x424929[_0x363e('0xa5')],'paused':_0x424929[_0x363e('0xa4')]||![],'penalty':_0x1e419c[_0x363e('0x61')]['penalty']||0x0});}return BPromise[_0x363e('0x8f')](_0x2041cb,function(_0x387170){return db[_0x363e('0xb2')][_0x363e('0xb3')](_0x387170);});}return _0x5c2ac7;});}})[_0x363e('0x31')](respondWithStatusCode(_0x39488d,null))[_0x363e('0x24')](handleError(_0x39488d,null));};exports[_0x363e('0xb4')]=function(_0x13fd90,_0x205466,_0xf50479){var _0x25313f;return db[_0x363e('0x5a')][_0x363e('0x3c')]({'where':{'id':_0x13fd90['params']['id']},'attributes':['id',_0x363e('0x3d'),'role']})[_0x363e('0x31')](handleEntityNotFound(_0x205466,null))['then'](function(_0x508762){if(_0x508762){_0x25313f=_0x508762;if(!_0x13fd90[_0x363e('0x4b')][_0x363e('0xa1')]||!utils[_0x363e('0xa6')](_0x13fd90[_0x363e('0x4b')][_0x363e('0xa1')])){throw new db[(_0x363e('0x96'))][(_0x363e('0x97'))](_0x363e('0xa7'));}return _0x508762[_0x363e('0xb5')+_[_0x363e('0xa9')](_0x13fd90[_0x363e('0x4b')][_0x363e('0xa1')][_0x363e('0xaa')]())+'Queues'](_0x13fd90[_0x363e('0x4b')]['ids']);}})[_0x363e('0x31')](function(_0x24ccac){for(var _0x55431d=0x0;_0x55431d<_0x13fd90[_0x363e('0x4b')]['ids'][_0x363e('0x50')];_0x55431d+=0x1){var _0x34e278={'UserId':_0x13fd90[_0x363e('0x5e')]['id']};_0x34e278[_[_0x363e('0xa9')](_0x13fd90['query'][_0x363e('0xa1')][_0x363e('0xaa')]())+'QueueId']=_0x13fd90['query'][_0x363e('0x64')][_0x55431d];socket['emit'](_0x363e('0x35')+_[_0x363e('0xa9')](_0x13fd90[_0x363e('0x4b')][_0x363e('0xa1')]['toLowerCase']())+_0x363e('0xb6'),_0x34e278);}return _0x24ccac;})['then'](function(){if(_0x13fd90[_0x363e('0x4b')][_0x363e('0xa1')]===_0x363e('0xb0')){return db[_0x363e('0xb2')][_0x363e('0x3f')]({'where':{'UserId':_0x13fd90['params']['id'],'VoiceQueueId':_0x13fd90[_0x363e('0x4b')][_0x363e('0x64')]},'individualHooks':!![]})[_0x363e('0x31')](function(){return _0x25313f;});}return _0x25313f;})[_0x363e('0x31')](respondWithStatusCode(_0x205466,null))[_0x363e('0x24')](handleError(_0x205466,null));};exports['addAvatar']=function(_0x3c7b50,_0x20236b,_0x577262){_0x3c7b50[_0x363e('0x61')]['userpic']=_0x3c7b50[_0x363e('0xb7')]['filename'];return db['User'][_0x363e('0x3c')]({'where':{'id':_0x3c7b50['params']['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x20236b,null))[_0x363e('0x31')](saveUpdates(_0x3c7b50[_0x363e('0x61')],null))[_0x363e('0x31')](respondWithResult(_0x20236b,null))['catch'](handleError(_0x20236b,null));};exports[_0x363e('0xb8')]=function(_0x4f7384,_0x3c245b,_0x25eda7){var _0x2f6184=path[_0x363e('0xb9')](config['root'],_0x363e('0xba'));return db['User'][_0x363e('0x3c')]({'where':{'id':_0x4f7384[_0x363e('0x5e')]['id']},'attributes':['id',_0x363e('0xbb')],'raw':!![]})['then'](handleEntityNotFound(_0x3c245b,null))[_0x363e('0x31')](function(_0x542c3a){if(_0x542c3a){if(_['isNil'](_0x542c3a[_0x363e('0xbb')])){return _0x3c245b[_0x363e('0xbc')](_0x2f6184);}else{if(!fs['existsSync'](path['join'](config[_0x363e('0xbd')],_0x363e('0xbe'),_0x542c3a[_0x363e('0xbb')]))){return _0x3c245b['download'](_0x2f6184);}return _0x3c245b[_0x363e('0xbc')](path['join'](config[_0x363e('0xbd')],_0x363e('0xbe'),_0x542c3a[_0x363e('0xbb')]));}}})[_0x363e('0x24')](handleError(_0x3c245b,null));};exports[_0x363e('0xbf')]=function(_0x51f824,_0x5a9236,_0x3353f9){var _0xa08ab7={};var _0x355e3f={};var _0x3ee10b;var _0x2709f7;return db[_0x363e('0x5a')][_0x363e('0xc0')]({'where':{'id':_0x51f824['params']['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x5a9236,null))['then'](function(_0x4bd9be){if(_0x4bd9be){_0x3ee10b=_0x4bd9be;_0x355e3f[_0x363e('0x46')]=_['keys'](db[_0x363e('0xc1')][_0x363e('0x42')]);_0x355e3f['query']=_[_0x363e('0x4a')](_0x51f824[_0x363e('0x4b')]);_0x355e3f[_0x363e('0x4c')]=_['intersection'](_0x355e3f[_0x363e('0x46')],_0x355e3f[_0x363e('0x4b')]);_0xa08ab7[_0x363e('0x4f')]=_[_0x363e('0x4d')](_0x355e3f[_0x363e('0x46')],qs['fields'](_0x51f824[_0x363e('0x4b')][_0x363e('0x4e')]));_0xa08ab7[_0x363e('0x4f')]=_0xa08ab7[_0x363e('0x4f')]['length']?_0xa08ab7[_0x363e('0x4f')]:_0x355e3f[_0x363e('0x46')];_0xa08ab7[_0x363e('0x52')]=qs[_0x363e('0x53')](_0x51f824['query'][_0x363e('0x53')]);_0xa08ab7[_0x363e('0x54')]=qs['filters'](_[_0x363e('0x55')](_0x51f824[_0x363e('0x4b')],_0x355e3f[_0x363e('0x4c')]));if(_0x51f824[_0x363e('0x4b')][_0x363e('0x38')]){_0xa08ab7[_0x363e('0x54')]=_[_0x363e('0x56')](_0xa08ab7['where'],{'$or':_[_0x363e('0x39')](_0xa08ab7[_0x363e('0x4f')],function(_0x9c8a55){var _0x8c8e44={};_0x8c8e44[_0x9c8a55]={'$like':'%'+_0x51f824[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x8c8e44;})});}_0xa08ab7=_[_0x363e('0x56')]({},_0xa08ab7,_0x51f824[_0x363e('0x60')]);return _0x3ee10b[_0x363e('0xbf')](_0xa08ab7);}})[_0x363e('0x31')](function(_0x480322){if(_0x480322){_0x2709f7=_0x480322[_0x363e('0x50')];if(_0x51f824[_0x363e('0x4b')][_0x363e('0xc2')](_0x363e('0x5f'))){_0xa08ab7['include']=[{'model':db[_0x363e('0xc3')],'as':'List','required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x363e('0x3d'),_0x363e('0xc4')],'where':_0x51f824[_0x363e('0x4b')][_0x363e('0xc5')]?{'id':_0x51f824[_0x363e('0x4b')][_0x363e('0xc5')]}:undefined,'required':_0x51f824['query'][_0x363e('0xc5')]?!![]:![]}];}if(!_0x51f824[_0x363e('0x4b')][_0x363e('0xc2')]('nolimit')){_0xa08ab7[_0x363e('0x2b')]=qs[_0x363e('0x2b')](_0x51f824['query']['limit']);_0xa08ab7[_0x363e('0x2a')]=qs[_0x363e('0x2a')](_0x51f824[_0x363e('0x4b')][_0x363e('0x2a')]);}return _0x3ee10b[_0x363e('0xbf')](_0xa08ab7);}})['then'](function(_0x2209e8){if(_0x2209e8){return _0x2209e8?{'count':_0x2709f7,'rows':_0x2209e8}:null;}})[_0x363e('0x31')](respondWithResult(_0x5a9236,null))[_0x363e('0x24')](handleError(_0x5a9236,null));};exports[_0x363e('0xc6')]=function(_0x241be2,_0x350589,_0x48e5ff){var _0x501c37;var _0x4efaed;var _0x464a7c={};var _0x24d03c;return db[_0x363e('0x5a')][_0x363e('0xc0')]({'where':{'id':_0x241be2['params']['id']},'attributes':['id',_0x363e('0x3d'),_0x363e('0x32')]})[_0x363e('0x31')](handleEntityNotFound(_0x350589,null))['then'](function(_0x266927){if(!utils['isValidChannel'](_0x241be2[_0x363e('0x4b')][_0x363e('0xa1')])){throw new db[(_0x363e('0x96'))][(_0x363e('0x97'))](_0x363e('0xa7'));}_0x501c37=_0x266927;var _0x12baff={};_0x12baff[_0x363e('0x46')]=_['keys'](db[_[_0x363e('0xa9')](_0x241be2['query'][_0x363e('0xa1')])+_0x363e('0xc7')][_0x363e('0x42')]);_0x12baff[_0x363e('0x4b')]=_['keys'](_0x241be2[_0x363e('0x4b')]);_0x12baff[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x12baff['model'],_0x12baff[_0x363e('0x4b')]);_0x464a7c[_0x363e('0x4f')]=_[_0x363e('0x4d')](_0x12baff[_0x363e('0x46')],qs[_0x363e('0x4e')](_0x241be2[_0x363e('0x4b')][_0x363e('0x4e')]));_0x464a7c[_0x363e('0x4f')]=_0x464a7c[_0x363e('0x4f')][_0x363e('0x50')]?_0x464a7c[_0x363e('0x4f')]:_0x12baff['model'];_0x464a7c[_0x363e('0x52')]=qs[_0x363e('0x53')](_0x241be2[_0x363e('0x4b')][_0x363e('0x53')]);_0x464a7c[_0x363e('0x54')]=qs[_0x363e('0x4c')](_[_0x363e('0x55')](_0x241be2[_0x363e('0x4b')],_0x12baff[_0x363e('0x4c')]));if(_0x241be2[_0x363e('0x4b')]['filter']){_0x464a7c[_0x363e('0x54')]=_['merge'](_0x464a7c[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0x464a7c['attributes'],function(_0x2a63bd){var _0x3b53b7={};_0x3b53b7[_0x2a63bd]={'$like':'%'+_0x241be2[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x3b53b7;})});}_0x464a7c=_[_0x363e('0x56')]({},_0x464a7c,_0x241be2[_0x363e('0x60')]);switch(_0x501c37[_0x363e('0x32')]){case _0x363e('0x33'):return db[_[_0x363e('0xa9')](_0x241be2[_0x363e('0x4b')][_0x363e('0xa1')])+_0x363e('0xc7')][_0x363e('0x5c')](_0x464a7c);case _0x363e('0x35'):case'agent':return _0x501c37[_0x363e('0xc8')+_[_0x363e('0xa9')](_0x241be2[_0x363e('0x4b')][_0x363e('0xa1')])+_0x363e('0xab')](_0x464a7c);default:throw new db['Sequelize']['ValidationError'](_0x363e('0xc9'));}})[_0x363e('0x31')](function(_0x55bdaf){_0x24d03c=_0x55bdaf[_0x363e('0x50')];if(!_0x241be2[_0x363e('0x4b')]['hasOwnProperty'](_0x363e('0x51'))){_0x464a7c[_0x363e('0x2b')]=qs['limit'](_0x241be2[_0x363e('0x4b')][_0x363e('0x2b')]);_0x464a7c[_0x363e('0x2a')]=qs['offset'](_0x241be2[_0x363e('0x4b')]['offset']);}switch(_0x501c37['role']){case _0x363e('0x33'):return db[_[_0x363e('0xa9')](_0x241be2[_0x363e('0x4b')]['channel'])+_0x363e('0xc7')][_0x363e('0x5c')](_0x464a7c);case _0x363e('0x35'):case _0x363e('0x84'):return _0x501c37[_0x363e('0xc8')+_['capitalize'](_0x241be2[_0x363e('0x4b')][_0x363e('0xa1')])+_0x363e('0xab')](_0x464a7c);}})[_0x363e('0x31')](function(_0x43eedf){return{'count':_0x24d03c,'rows':_0x43eedf};})[_0x363e('0x31')](respondWithResult(_0x350589,null))[_0x363e('0x24')](handleError(_0x350589,null));};exports['getVoiceQueuesRt']=function(_0x54cdc4,_0x2f485e,_0xc08a1c){var _0x18847f={};var _0x33c8e5={};var _0x2a322e;var _0x233803;return db[_0x363e('0x5a')][_0x363e('0xc0')]({'where':{'id':_0x54cdc4['params']['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x2f485e,null))[_0x363e('0x31')](function(_0x4de3bb){if(_0x4de3bb){_0x2a322e=_0x4de3bb;_0x33c8e5['model']=_[_0x363e('0x4a')](db[_0x363e('0xb2')]['rawAttributes']);_0x33c8e5[_0x363e('0x4b')]=_[_0x363e('0x4a')](_0x54cdc4[_0x363e('0x4b')]);_0x33c8e5[_0x363e('0x4c')]=_['intersection'](_0x33c8e5[_0x363e('0x46')],_0x33c8e5[_0x363e('0x4b')]);_0x18847f['attributes']=_['intersection'](_0x33c8e5['model'],qs[_0x363e('0x4e')](_0x54cdc4[_0x363e('0x4b')][_0x363e('0x4e')]));_0x18847f['attributes']=_0x18847f[_0x363e('0x4f')][_0x363e('0x50')]?_0x18847f[_0x363e('0x4f')]:_0x33c8e5[_0x363e('0x46')];_0x18847f[_0x363e('0x52')]=qs[_0x363e('0x53')](_0x54cdc4['query']['sort']);_0x18847f[_0x363e('0x54')]=qs[_0x363e('0x4c')](_['pick'](_0x54cdc4[_0x363e('0x4b')],_0x33c8e5[_0x363e('0x4c')]));if(_0x54cdc4[_0x363e('0x4b')][_0x363e('0x38')]){_0x18847f[_0x363e('0x54')]=_['merge'](_0x18847f[_0x363e('0x54')],{'$or':_['map'](_0x18847f[_0x363e('0x4f')],function(_0x554988){var _0x3e3db5={};_0x3e3db5[_0x554988]={'$like':'%'+_0x54cdc4[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x3e3db5;})});}_0x18847f=_['merge']({},_0x18847f,_0x54cdc4[_0x363e('0x60')]);return _0x2a322e['getVoiceQueuesRt'](_0x18847f);}})['then'](function(_0x2eae5d){if(_0x2eae5d){_0x233803=_0x2eae5d['length'];if(!_0x54cdc4['query'][_0x363e('0xc2')](_0x363e('0x51'))){_0x18847f[_0x363e('0x2b')]=qs[_0x363e('0x2b')](_0x54cdc4['query'][_0x363e('0x2b')]);_0x18847f[_0x363e('0x2a')]=qs[_0x363e('0x2a')](_0x54cdc4['query']['offset']);}return _0x2a322e[_0x363e('0xca')](_0x18847f);}})[_0x363e('0x31')](function(_0xb037eb){if(_0xb037eb){return _0xb037eb?{'count':_0x233803,'rows':_0xb037eb}:null;}})[_0x363e('0x31')](respondWithResult(_0x2f485e,null))[_0x363e('0x24')](handleError(_0x2f485e,null));};exports[_0x363e('0xcb')]=function(_0x839ff8,_0xe9d989,_0x211cb5){var _0x2ec27e={};var _0x333a85={};var _0xb2a3c6;var _0xf62a1;return db['User'][_0x363e('0xc0')]({'where':{'id':_0x839ff8['params']['id']}})[_0x363e('0x31')](handleEntityNotFound(_0xe9d989,null))[_0x363e('0x31')](function(_0x14c1a8){if(_0x14c1a8){_0xb2a3c6=_0x14c1a8;_0x333a85['model']=_[_0x363e('0x4a')](db[_0x363e('0xcc')][_0x363e('0x42')]);_0x333a85[_0x363e('0x4b')]=_['keys'](_0x839ff8[_0x363e('0x4b')]);_0x333a85[_0x363e('0x4c')]=_['intersection'](_0x333a85['model'],_0x333a85[_0x363e('0x4b')]);_0x2ec27e[_0x363e('0x4f')]=_[_0x363e('0x4d')](_0x333a85['model'],qs['fields'](_0x839ff8['query'][_0x363e('0x4e')]));_0x2ec27e[_0x363e('0x4f')]=_0x2ec27e['attributes'][_0x363e('0x50')]?_0x2ec27e[_0x363e('0x4f')]:_0x333a85['model'];_0x2ec27e['order']=qs[_0x363e('0x53')](_0x839ff8[_0x363e('0x4b')][_0x363e('0x53')]);_0x2ec27e[_0x363e('0x54')]=qs['filters'](_[_0x363e('0x55')](_0x839ff8[_0x363e('0x4b')],_0x333a85['filters']));if(_0x839ff8[_0x363e('0x4b')][_0x363e('0x38')]){_0x2ec27e[_0x363e('0x54')]=_[_0x363e('0x56')](_0x2ec27e[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0x2ec27e[_0x363e('0x4f')],function(_0x312833){var _0x32282a={};_0x32282a[_0x312833]={'$like':'%'+_0x839ff8[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x32282a;})});}_0x2ec27e=_[_0x363e('0x56')]({},_0x2ec27e,_0x839ff8[_0x363e('0x60')]);return _0xb2a3c6[_0x363e('0xcb')](_0x2ec27e);}})['then'](function(_0x31065e){if(_0x31065e){_0xf62a1=_0x31065e['length'];if(!_0x839ff8[_0x363e('0x4b')][_0x363e('0xc2')](_0x363e('0x51'))){_0x2ec27e[_0x363e('0x2b')]=qs['limit'](_0x839ff8['query'][_0x363e('0x2b')]);_0x2ec27e[_0x363e('0x2a')]=qs[_0x363e('0x2a')](_0x839ff8[_0x363e('0x4b')]['offset']);}return _0xb2a3c6[_0x363e('0xcb')](_0x2ec27e);}})[_0x363e('0x31')](function(_0x3c7ef2){if(_0x3c7ef2){return _0x3c7ef2?{'count':_0xf62a1,'rows':_0x3c7ef2}:null;}})['then'](respondWithResult(_0xe9d989,null))['catch'](handleError(_0xe9d989,null));};exports[_0x363e('0xcd')]=function(_0x1be762,_0x4feb7d,_0x195e67){var _0x5b6ba5={'raw':!![],'where':{}};var _0x5f34e1={};var _0x1ce145={'count':0x0,'rows':[]};return db[_0x363e('0x5a')]['findOne']({'where':{'id':_0x1be762[_0x363e('0x5e')]['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x4feb7d,null))[_0x363e('0x31')](function(_0x5f06de){if(_0x5f06de){_0x5f34e1[_0x363e('0x46')]=_[_0x363e('0x4a')](db[_0x363e('0xce')]['rawAttributes']);_0x5f34e1[_0x363e('0x4b')]=_[_0x363e('0x4a')](_0x1be762[_0x363e('0x4b')]);_0x5f34e1[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x5f34e1[_0x363e('0x46')],_0x5f34e1[_0x363e('0x4b')]);_0x5b6ba5[_0x363e('0x4f')]=_['intersection'](_0x5f34e1[_0x363e('0x46')],qs[_0x363e('0x4e')](_0x1be762['query']['fields']));_0x5b6ba5[_0x363e('0x4f')]=_0x5b6ba5['attributes']['length']?_0x5b6ba5[_0x363e('0x4f')]:_0x5f34e1['model'];if(!_0x1be762[_0x363e('0x4b')][_0x363e('0xc2')](_0x363e('0x51'))){_0x5b6ba5['limit']=qs[_0x363e('0x2b')](_0x1be762['query']['limit']);_0x5b6ba5[_0x363e('0x2a')]=qs[_0x363e('0x2a')](_0x1be762[_0x363e('0x4b')][_0x363e('0x2a')]);}_0x5b6ba5[_0x363e('0x52')]=qs[_0x363e('0x53')](_0x1be762['query'][_0x363e('0x53')]);_0x5b6ba5['where']=qs[_0x363e('0x4c')](_[_0x363e('0x55')](_0x1be762[_0x363e('0x4b')],_0x5f34e1[_0x363e('0x4c')]));_0x5b6ba5[_0x363e('0x54')][_0x363e('0xcf')]=_0x5f06de['id'];if(_0x1be762[_0x363e('0x4b')][_0x363e('0x38')]){_0x5b6ba5[_0x363e('0x54')]=_[_0x363e('0x56')](_0x5b6ba5[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0x5b6ba5[_0x363e('0x4f')],function(_0x14a642){var _0x15e261={};_0x15e261[_0x14a642]={'$like':'%'+_0x1be762['query']['filter']+'%'};return _0x15e261;})});}_0x5b6ba5=_['merge']({},_0x5b6ba5,_0x1be762[_0x363e('0x60')]);return db[_0x363e('0xce')]['count']({'where':_0x5b6ba5[_0x363e('0x54')]})[_0x363e('0x31')](function(_0x2d190d){_0x1ce145['count']=_0x2d190d;if(_0x1be762[_0x363e('0x4b')][_0x363e('0x5f')]){_0x5b6ba5['include']=[{'all':!![]}];}return db[_0x363e('0xce')][_0x363e('0x5c')](_0x5b6ba5);})[_0x363e('0x31')](function(_0x18fa51){_0x1ce145['rows']=_0x18fa51;return _0x1ce145;});}})['then'](respondWithFilteredResult(_0x4feb7d,_0x5b6ba5))[_0x363e('0x24')](handleError(_0x4feb7d,null));};exports[_0x363e('0xd0')]=function(_0x244fbb,_0x485a69,_0x4d1ffd){var _0x11316d={'raw':!![],'where':{}};var _0x4d57c2={};var _0x3cf326={'count':0x0,'rows':[]};return db[_0x363e('0x5a')][_0x363e('0xc0')]({'where':{'id':_0x244fbb[_0x363e('0x5e')]['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x485a69,null))[_0x363e('0x31')](function(_0x25371a){if(_0x25371a){_0x4d57c2[_0x363e('0x46')]=_[_0x363e('0x4a')](db[_0x363e('0xd1')][_0x363e('0x42')]);_0x4d57c2[_0x363e('0x4b')]=_['keys'](_0x244fbb[_0x363e('0x4b')]);_0x4d57c2[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x4d57c2['model'],_0x4d57c2[_0x363e('0x4b')]);_0x11316d[_0x363e('0x4f')]=_[_0x363e('0x4d')](_0x4d57c2[_0x363e('0x46')],qs[_0x363e('0x4e')](_0x244fbb[_0x363e('0x4b')]['fields']));_0x11316d[_0x363e('0x4f')]=_0x11316d[_0x363e('0x4f')][_0x363e('0x50')]?_0x11316d[_0x363e('0x4f')]:_0x4d57c2[_0x363e('0x46')];if(!_0x244fbb[_0x363e('0x4b')][_0x363e('0xc2')](_0x363e('0x51'))){_0x11316d[_0x363e('0x2b')]=qs[_0x363e('0x2b')](_0x244fbb[_0x363e('0x4b')][_0x363e('0x2b')]);_0x11316d[_0x363e('0x2a')]=qs['offset'](_0x244fbb[_0x363e('0x4b')][_0x363e('0x2a')]);}_0x11316d[_0x363e('0x52')]=qs[_0x363e('0x53')](_0x244fbb[_0x363e('0x4b')]['sort']);_0x11316d[_0x363e('0x54')]=qs[_0x363e('0x4c')](_[_0x363e('0x55')](_0x244fbb['query'],_0x4d57c2[_0x363e('0x4c')]));_0x11316d[_0x363e('0x54')][_0x363e('0xcf')]=_0x25371a['id'];if(_0x244fbb[_0x363e('0x4b')][_0x363e('0x38')]){_0x11316d['where']=_[_0x363e('0x56')](_0x11316d[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0x11316d[_0x363e('0x4f')],function(_0x18efeb){var _0x2f25b6={};_0x2f25b6[_0x18efeb]={'$like':'%'+_0x244fbb['query'][_0x363e('0x38')]+'%'};return _0x2f25b6;})});}_0x11316d=_['merge']({},_0x11316d,_0x244fbb[_0x363e('0x60')]);return db[_0x363e('0xd1')][_0x363e('0x29')]({'where':_0x11316d[_0x363e('0x54')]})[_0x363e('0x31')](function(_0x5a5565){_0x3cf326[_0x363e('0x29')]=_0x5a5565;if(_0x244fbb[_0x363e('0x4b')][_0x363e('0x5f')]){_0x11316d['include']=[{'all':!![]}];}return db[_0x363e('0xd1')][_0x363e('0x5c')](_0x11316d);})[_0x363e('0x31')](function(_0x377a90){_0x3cf326['rows']=_0x377a90;return _0x3cf326;});}})[_0x363e('0x31')](respondWithFilteredResult(_0x485a69,_0x11316d))[_0x363e('0x24')](handleError(_0x485a69,null));};exports[_0x363e('0xd2')]=function(_0x288c54,_0x428f28,_0x9fd7bd){var _0x57ba96={};var _0x2be95c={};var _0x94e270;var _0x5cf399;return db[_0x363e('0x5a')]['findOne']({'where':{'id':_0x288c54['params']['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x428f28,null))[_0x363e('0x31')](function(_0x2977b3){if(_0x2977b3){_0x94e270=_0x2977b3;_0x2be95c[_0x363e('0x46')]=_[_0x363e('0x4a')](db[_0x363e('0xd3')]['rawAttributes']);_0x2be95c[_0x363e('0x4b')]=_[_0x363e('0x4a')](_0x288c54['query']);_0x2be95c[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x2be95c[_0x363e('0x46')],_0x2be95c['query']);_0x57ba96[_0x363e('0x4f')]=_[_0x363e('0x4d')](_0x2be95c['model'],qs[_0x363e('0x4e')](_0x288c54['query'][_0x363e('0x4e')]));_0x57ba96[_0x363e('0x4f')]=_0x57ba96['attributes'][_0x363e('0x50')]?_0x57ba96[_0x363e('0x4f')]:_0x2be95c['model'];_0x57ba96[_0x363e('0x52')]=qs[_0x363e('0x53')](_0x288c54[_0x363e('0x4b')][_0x363e('0x53')]);_0x57ba96['where']=qs[_0x363e('0x4c')](_[_0x363e('0x55')](_0x288c54['query'],_0x2be95c['filters']));if(_0x288c54['query'][_0x363e('0x38')]){_0x57ba96[_0x363e('0x54')]=_[_0x363e('0x56')](_0x57ba96['where'],{'$or':_[_0x363e('0x39')](_0x57ba96[_0x363e('0x4f')],function(_0x1b388e){var _0x3f3bc6={};_0x3f3bc6[_0x1b388e]={'$like':'%'+_0x288c54[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x3f3bc6;})});}_0x57ba96=_[_0x363e('0x56')]({},_0x57ba96,_0x288c54['options']);return _0x94e270[_0x363e('0xd2')](_0x57ba96);}})['then'](function(_0x3388de){if(_0x3388de){_0x5cf399=_0x3388de['length'];if(!_0x288c54[_0x363e('0x4b')][_0x363e('0xc2')](_0x363e('0x51'))){_0x57ba96[_0x363e('0x2b')]=qs[_0x363e('0x2b')](_0x288c54[_0x363e('0x4b')][_0x363e('0x2b')]);_0x57ba96[_0x363e('0x2a')]=qs[_0x363e('0x2a')](_0x288c54[_0x363e('0x4b')][_0x363e('0x2a')]);}return _0x94e270[_0x363e('0xd2')](_0x57ba96);}})[_0x363e('0x31')](function(_0x3a7873){if(_0x3a7873){return _0x3a7873?{'count':_0x5cf399,'rows':_0x3a7873}:null;}})['then'](respondWithResult(_0x428f28,null))['catch'](handleError(_0x428f28,null));};exports[_0x363e('0xd4')]=function(_0x3fb7b5,_0x5b3b0c,_0x411124){var _0x19a85c={};var _0x488426={};var _0x1f57f1;var _0x21ef50;return db['User'][_0x363e('0xc0')]({'where':{'id':_0x3fb7b5['params']['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x5b3b0c,null))[_0x363e('0x31')](function(_0x2331bf){if(_0x2331bf){_0x1f57f1=_0x2331bf;_0x488426[_0x363e('0x46')]=_[_0x363e('0x4a')](db['OpenchannelInteraction'][_0x363e('0x42')]);_0x488426[_0x363e('0x4b')]=_[_0x363e('0x4a')](_0x3fb7b5[_0x363e('0x4b')]);_0x488426[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x488426[_0x363e('0x46')],_0x488426['query']);_0x19a85c[_0x363e('0x4f')]=_[_0x363e('0x4d')](_0x488426[_0x363e('0x46')],qs[_0x363e('0x4e')](_0x3fb7b5[_0x363e('0x4b')][_0x363e('0x4e')]));_0x19a85c[_0x363e('0x4f')]=_0x19a85c['attributes'][_0x363e('0x50')]?_0x19a85c[_0x363e('0x4f')]:_0x488426[_0x363e('0x46')];_0x19a85c['order']=qs[_0x363e('0x53')](_0x3fb7b5[_0x363e('0x4b')][_0x363e('0x53')]);_0x19a85c['where']=qs['filters'](_[_0x363e('0x55')](_0x3fb7b5[_0x363e('0x4b')],_0x488426[_0x363e('0x4c')]));if(_0x3fb7b5[_0x363e('0x4b')][_0x363e('0x38')]){_0x19a85c[_0x363e('0x54')]=_[_0x363e('0x56')](_0x19a85c[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0x19a85c[_0x363e('0x4f')],function(_0x20b615){var _0x3d3184={};_0x3d3184[_0x20b615]={'$like':'%'+_0x3fb7b5[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x3d3184;})});}_0x19a85c=_[_0x363e('0x56')]({},_0x19a85c,_0x3fb7b5[_0x363e('0x60')]);return _0x1f57f1[_0x363e('0xd4')](_0x19a85c);}})[_0x363e('0x31')](function(_0x25a7f9){if(_0x25a7f9){_0x21ef50=_0x25a7f9[_0x363e('0x50')];if(!_0x3fb7b5[_0x363e('0x4b')][_0x363e('0xc2')](_0x363e('0x51'))){_0x19a85c[_0x363e('0x2b')]=qs['limit'](_0x3fb7b5['query'][_0x363e('0x2b')]);_0x19a85c[_0x363e('0x2a')]=qs[_0x363e('0x2a')](_0x3fb7b5['query'][_0x363e('0x2a')]);}return _0x1f57f1[_0x363e('0xd4')](_0x19a85c);}})['then'](function(_0x518785){if(_0x518785){return _0x518785?{'count':_0x21ef50,'rows':_0x518785}:null;}})[_0x363e('0x31')](respondWithResult(_0x5b3b0c,null))[_0x363e('0x24')](handleError(_0x5b3b0c,null));};exports[_0x363e('0xd5')]=function(_0x578e4a,_0x3da394,_0x55a13f){var _0x408e15={'raw':!![],'where':{}};var _0x33cd1c={};var _0x7e363e={'count':0x0,'rows':[]};return db[_0x363e('0x5a')][_0x363e('0xc0')]({'where':{'id':_0x578e4a[_0x363e('0x5e')]['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x3da394,null))['then'](function(_0x261bfb){if(_0x261bfb){_0x33cd1c[_0x363e('0x46')]=_['keys'](db[_0x363e('0xd6')][_0x363e('0x42')]);_0x33cd1c[_0x363e('0x4b')]=_[_0x363e('0x4a')](_0x578e4a[_0x363e('0x4b')]);_0x33cd1c[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x33cd1c[_0x363e('0x46')],_0x33cd1c['query']);_0x408e15[_0x363e('0x4f')]=_['intersection'](_0x33cd1c['model'],qs[_0x363e('0x4e')](_0x578e4a[_0x363e('0x4b')]['fields']));_0x408e15[_0x363e('0x4f')]=_0x408e15[_0x363e('0x4f')][_0x363e('0x50')]?_0x408e15[_0x363e('0x4f')]:_0x33cd1c[_0x363e('0x46')];if(!_0x578e4a[_0x363e('0x4b')][_0x363e('0xc2')](_0x363e('0x51'))){_0x408e15[_0x363e('0x2b')]=qs[_0x363e('0x2b')](_0x578e4a[_0x363e('0x4b')][_0x363e('0x2b')]);_0x408e15[_0x363e('0x2a')]=qs['offset'](_0x578e4a[_0x363e('0x4b')][_0x363e('0x2a')]);}_0x408e15[_0x363e('0x52')]=qs[_0x363e('0x53')](_0x578e4a[_0x363e('0x4b')][_0x363e('0x53')]);_0x408e15[_0x363e('0x54')]=qs[_0x363e('0x4c')](_['pick'](_0x578e4a[_0x363e('0x4b')],_0x33cd1c[_0x363e('0x4c')]));_0x408e15[_0x363e('0x54')][_0x363e('0xcf')]=_0x261bfb['id'];if(_0x578e4a['query'][_0x363e('0x38')]){_0x408e15[_0x363e('0x54')]=_[_0x363e('0x56')](_0x408e15[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0x408e15[_0x363e('0x4f')],function(_0x59efca){var _0x6e9b16={};_0x6e9b16[_0x59efca]={'$like':'%'+_0x578e4a[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x6e9b16;})});}_0x408e15=_['merge']({},_0x408e15,_0x578e4a[_0x363e('0x60')]);return db[_0x363e('0xd6')][_0x363e('0x29')]({'where':_0x408e15[_0x363e('0x54')]})[_0x363e('0x31')](function(_0x4997ff){_0x7e363e[_0x363e('0x29')]=_0x4997ff;if(_0x578e4a[_0x363e('0x4b')]['includeAll']){_0x408e15['include']=[{'all':!![]}];}return db[_0x363e('0xd6')]['findAll'](_0x408e15);})[_0x363e('0x31')](function(_0x3af24a){_0x7e363e[_0x363e('0x5d')]=_0x3af24a;return _0x7e363e;});}})[_0x363e('0x31')](respondWithFilteredResult(_0x3da394,_0x408e15))['catch'](handleError(_0x3da394,null));};exports[_0x363e('0xd7')]=function(_0x5c723b,_0x1b08ab,_0x2c089d){var _0x5c8923={};var _0x590c96={};var _0x56fe39;var _0x5eee97;return db[_0x363e('0x5a')][_0x363e('0xc0')]({'where':{'id':_0x5c723b[_0x363e('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1b08ab,null))[_0x363e('0x31')](function(_0x5ce676){if(_0x5ce676){_0x56fe39=_0x5ce676;_0x590c96[_0x363e('0x46')]=_['keys'](db[_0x363e('0xd8')][_0x363e('0x42')]);_0x590c96[_0x363e('0x4b')]=_[_0x363e('0x4a')](_0x5c723b[_0x363e('0x4b')]);_0x590c96[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x590c96['model'],_0x590c96['query']);_0x5c8923[_0x363e('0x4f')]=_[_0x363e('0x4d')](_0x590c96[_0x363e('0x46')],qs[_0x363e('0x4e')](_0x5c723b[_0x363e('0x4b')][_0x363e('0x4e')]));_0x5c8923[_0x363e('0x4f')]=_0x5c8923[_0x363e('0x4f')][_0x363e('0x50')]?_0x5c8923[_0x363e('0x4f')]:_0x590c96[_0x363e('0x46')];_0x5c8923['order']=qs[_0x363e('0x53')](_0x5c723b[_0x363e('0x4b')][_0x363e('0x53')]);_0x5c8923[_0x363e('0x54')]=qs[_0x363e('0x4c')](_[_0x363e('0x55')](_0x5c723b[_0x363e('0x4b')],_0x590c96[_0x363e('0x4c')]));if(_0x5c723b['query'][_0x363e('0x38')]){_0x5c8923['where']=_[_0x363e('0x56')](_0x5c8923[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0x5c8923[_0x363e('0x4f')],function(_0x4ecf8f){var _0x2fb1c9={};_0x2fb1c9[_0x4ecf8f]={'$like':'%'+_0x5c723b[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x2fb1c9;})});}_0x5c8923=_[_0x363e('0x56')]({},_0x5c8923,_0x5c723b[_0x363e('0x60')]);return _0x56fe39['getSmsInteractions'](_0x5c8923);}})[_0x363e('0x31')](function(_0x5c9611){if(_0x5c9611){_0x5eee97=_0x5c9611['length'];if(!_0x5c723b[_0x363e('0x4b')][_0x363e('0xc2')]('nolimit')){_0x5c8923[_0x363e('0x2b')]=qs['limit'](_0x5c723b[_0x363e('0x4b')]['limit']);_0x5c8923['offset']=qs[_0x363e('0x2a')](_0x5c723b[_0x363e('0x4b')]['offset']);}return _0x56fe39[_0x363e('0xd7')](_0x5c8923);}})['then'](function(_0x62ff7e){if(_0x62ff7e){return _0x62ff7e?{'count':_0x5eee97,'rows':_0x62ff7e}:null;}})[_0x363e('0x31')](respondWithResult(_0x1b08ab,null))[_0x363e('0x24')](handleError(_0x1b08ab,null));};exports['getFaxInteractions']=function(_0x797a71,_0x2ef0ec,_0x1effb2){var _0x12030a={};var _0x2e7e6b={};var _0x244865;var _0x19fb19;return db[_0x363e('0x5a')][_0x363e('0xc0')]({'where':{'id':_0x797a71[_0x363e('0x5e')]['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x2ef0ec,null))['then'](function(_0x4cf746){if(_0x4cf746){_0x244865=_0x4cf746;_0x2e7e6b[_0x363e('0x46')]=_['keys'](db['FaxInteraction']['rawAttributes']);_0x2e7e6b[_0x363e('0x4b')]=_[_0x363e('0x4a')](_0x797a71[_0x363e('0x4b')]);_0x2e7e6b[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x2e7e6b[_0x363e('0x46')],_0x2e7e6b[_0x363e('0x4b')]);_0x12030a[_0x363e('0x4f')]=_[_0x363e('0x4d')](_0x2e7e6b[_0x363e('0x46')],qs[_0x363e('0x4e')](_0x797a71[_0x363e('0x4b')][_0x363e('0x4e')]));_0x12030a[_0x363e('0x4f')]=_0x12030a[_0x363e('0x4f')][_0x363e('0x50')]?_0x12030a[_0x363e('0x4f')]:_0x2e7e6b[_0x363e('0x46')];_0x12030a['order']=qs[_0x363e('0x53')](_0x797a71[_0x363e('0x4b')][_0x363e('0x53')]);_0x12030a[_0x363e('0x54')]=qs['filters'](_[_0x363e('0x55')](_0x797a71['query'],_0x2e7e6b[_0x363e('0x4c')]));if(_0x797a71[_0x363e('0x4b')]['filter']){_0x12030a['where']=_['merge'](_0x12030a['where'],{'$or':_[_0x363e('0x39')](_0x12030a[_0x363e('0x4f')],function(_0x5ad075){var _0x3aaed5={};_0x3aaed5[_0x5ad075]={'$like':'%'+_0x797a71[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x3aaed5;})});}_0x12030a=_[_0x363e('0x56')]({},_0x12030a,_0x797a71[_0x363e('0x60')]);return _0x244865[_0x363e('0xd9')](_0x12030a);}})[_0x363e('0x31')](function(_0x52307e){if(_0x52307e){_0x19fb19=_0x52307e[_0x363e('0x50')];if(!_0x797a71[_0x363e('0x4b')][_0x363e('0xc2')]('nolimit')){_0x12030a[_0x363e('0x2b')]=qs['limit'](_0x797a71['query'][_0x363e('0x2b')]);_0x12030a['offset']=qs['offset'](_0x797a71['query'][_0x363e('0x2a')]);}return _0x244865[_0x363e('0xd9')](_0x12030a);}})[_0x363e('0x31')](function(_0x14415c){if(_0x14415c){return _0x14415c?{'count':_0x19fb19,'rows':_0x14415c}:null;}})[_0x363e('0x31')](respondWithResult(_0x2ef0ec,null))[_0x363e('0x24')](handleError(_0x2ef0ec,null));};exports[_0x363e('0xda')]=function(_0x526c5b,_0x44d79c,_0xc66955){var _0xe17d66={};var _0x3f2167={};var _0x5ef698;var _0x141bc9;return db['User']['findOne']({'where':{'id':_0x526c5b[_0x363e('0x5e')]['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x44d79c,null))[_0x363e('0x31')](function(_0x3bd61e){if(_0x3bd61e){_0x5ef698=_0x3bd61e;_0x3f2167[_0x363e('0x46')]=_[_0x363e('0x4a')](db['WhatsappInteraction'][_0x363e('0x42')]);_0x3f2167[_0x363e('0x4b')]=_[_0x363e('0x4a')](_0x526c5b['query']);_0x3f2167[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0x3f2167['model'],_0x3f2167[_0x363e('0x4b')]);_0xe17d66['attributes']=_[_0x363e('0x4d')](_0x3f2167[_0x363e('0x46')],qs['fields'](_0x526c5b[_0x363e('0x4b')][_0x363e('0x4e')]));_0xe17d66[_0x363e('0x4f')]=_0xe17d66[_0x363e('0x4f')]['length']?_0xe17d66['attributes']:_0x3f2167['model'];_0xe17d66[_0x363e('0x52')]=qs[_0x363e('0x53')](_0x526c5b['query']['sort']);_0xe17d66[_0x363e('0x54')]=qs['filters'](_['pick'](_0x526c5b['query'],_0x3f2167[_0x363e('0x4c')]));if(_0x526c5b[_0x363e('0x4b')][_0x363e('0x38')]){_0xe17d66[_0x363e('0x54')]=_[_0x363e('0x56')](_0xe17d66[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0xe17d66['attributes'],function(_0x51b084){var _0x3af31c={};_0x3af31c[_0x51b084]={'$like':'%'+_0x526c5b['query'][_0x363e('0x38')]+'%'};return _0x3af31c;})});}_0xe17d66=_[_0x363e('0x56')]({},_0xe17d66,_0x526c5b[_0x363e('0x60')]);return _0x5ef698['getWhatsappInteractions'](_0xe17d66);}})['then'](function(_0x558d40){if(_0x558d40){_0x141bc9=_0x558d40[_0x363e('0x50')];if(!_0x526c5b['query'][_0x363e('0xc2')]('nolimit')){_0xe17d66[_0x363e('0x2b')]=qs['limit'](_0x526c5b[_0x363e('0x4b')][_0x363e('0x2b')]);_0xe17d66['offset']=qs[_0x363e('0x2a')](_0x526c5b[_0x363e('0x4b')][_0x363e('0x2a')]);}return _0x5ef698[_0x363e('0xda')](_0xe17d66);}})['then'](function(_0x510a0d){if(_0x510a0d){return _0x510a0d?{'count':_0x141bc9,'rows':_0x510a0d}:null;}})[_0x363e('0x31')](respondWithResult(_0x44d79c,null))[_0x363e('0x24')](handleError(_0x44d79c,null));};exports[_0x363e('0xdb')]=function(_0x5e0ba5,_0x5c0904,_0x196a1d){var _0x477e79;var _0x5d29fe;var _0xeef910;var _0x584683=!_['isNil'](_0x5e0ba5[_0x363e('0x5e')]['id'])?_0x5e0ba5[_0x363e('0x5e')]['id']:!_[_0x363e('0x6b')](_0x5e0ba5[_0x363e('0x35')]['id'])?_0x5e0ba5[_0x363e('0x35')]['id']:null;return db[_0x363e('0x5a')]['find']({'where':{'id':_0x584683,'role':{'$or':[_0x363e('0x33'),'user','agent']}},'attributes':['id',_0x363e('0x3d'),'phone',_0x363e('0xdc'),_0x363e('0x32'),_0x363e('0x66'),_0x363e('0xa3')]})['then'](function(_0x1f99b9){if(_0x1f99b9){if(_0x1f99b9['role']==='agent'){_0x477e79=_0x1f99b9;if(_0x5e0ba5['body'][_0x363e('0xa5')]){_0xeef910=util[_0x363e('0xb1')]('LOCAL/%s@from-sip/n',_0x477e79[_0x5e0ba5[_0x363e('0x61')][_0x363e('0xa5')]]);}else if(_0x5e0ba5['body'][_0x363e('0xdd')]){_0xeef910=util['format'](_0x363e('0xde'),_0x5e0ba5[_0x363e('0x61')][_0x363e('0xdd')]);}else{_0xeef910=util[_0x363e('0xb1')]('SIP/%s',_0x477e79[_0x363e('0x3d')]);}socket['to'](util[_0x363e('0xb1')](_0x363e('0xdf'),_0x477e79[_0x363e('0x3d')]))[_0x363e('0xae')](_0x363e('0xe0'),{'ip':_0x5e0ba5['headers'][_0x363e('0xe1')]||_0x5e0ba5[_0x363e('0xe2')][_0x363e('0xe3')]||_0x5e0ba5[_0x363e('0xe4')][_0x363e('0xe3')]||_0x5e0ba5[_0x363e('0xe2')][_0x363e('0xe4')][_0x363e('0xe3')]});return db[_0x363e('0xb2')][_0x363e('0x3f')]({'where':{'membername':_0x477e79['name']},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x363e('0x97'))](_0x363e('0xe5'));}})[_0x363e('0x31')](function(){if(_0x477e79){return _0x477e79[_0x363e('0xe6')]({'raw':!![]});}})[_0x363e('0x31')](function(_0x132783){if(_0x477e79){var _0xce5eca=[];if(_0x132783){_0x5d29fe=_0x132783;if(_0x5d29fe['length']){for(var _0x49e5ca=0x0;_0x49e5ca<_0x5d29fe[_0x363e('0x50')];_0x49e5ca++){_0xce5eca[_0x363e('0x8e')]({'membername':_0x477e79[_0x363e('0x3d')],'UserId':_0x477e79['id'],'queue_name':_0x5d29fe[_0x49e5ca][_0x363e('0x3d')],'VoiceQueueId':_0x5d29fe[_0x49e5ca]['id'],'interface':_0xeef910,'paused':_0x477e79[_0x363e('0xa3')]||![],'penalty':_0x5d29fe[_0x49e5ca][_0x363e('0xe7')]||0x0});}return BPromise[_0x363e('0x8f')](_0xce5eca,function(_0x3d0a39){return db[_0x363e('0xb2')][_0x363e('0xb3')](_0x3d0a39);});}}}})[_0x363e('0x31')](function(){if(_0x477e79){return db['MemberReport'][_0x363e('0x5c')]({'where':{'membername':_0x477e79[_0x363e('0x3d')],'exitAt':null}});}})[_0x363e('0x31')](function(_0x39f096){if(_0x477e79){var _0x27139a=[];_0x39f096['forEach'](function(_0x2f9651){_0x27139a['push'](_0x2f9651[_0x363e('0x30')]({'exitAt':moment()[_0x363e('0xb1')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x363e('0x93')](_0x27139a);}})[_0x363e('0x31')](function(){if(_0x477e79){var _0x220c42=[];var _0x58bb28=[];var _0x40b34a=utils['getChannels']();var _0xf1880f={'membername':_0x477e79[_0x363e('0x3d')],'interface':_0xeef910,'enterAt':moment()[_0x363e('0xb1')](_0x363e('0xe8')),'role':_0x477e79[_0x363e('0x32')],'internal':_0x477e79[_0x363e('0x66')]};_0x40b34a[_0x363e('0xe9')](function(_0x5b1000){_0x220c42[_0x363e('0x8e')](_['merge']({'channel':_0x5b1000,'type':'LOGIN','data1':_0x5e0ba5[_0x363e('0x61')]['device'],'data2':_0xeef910},_0xf1880f));if(_0x477e79[_0x363e('0xa3')]){_0x58bb28[_0x363e('0x8e')](_['merge']({'channel':_0x5b1000,'type':_0x363e('0xea'),'data1':_0x363e('0xeb')},_0xf1880f));}});return db[_0x363e('0xec')][_0x363e('0xed')](_0x220c42[_0x363e('0xee')](_0x58bb28),{'individualHooks':!![]});}})['then'](function(){if(_0x477e79){return _0x477e79['update']({'online':!![],'lastLoginAt':moment()['format'](_0x363e('0xe8')),'voicePause':_0x477e79[_0x363e('0xa3')]||![],'mailPause':_0x477e79[_0x363e('0xa3')]||![],'chatPause':_0x477e79[_0x363e('0xa3')]||![],'faxPause':_0x477e79[_0x363e('0xa3')]||![],'smsPause':_0x477e79[_0x363e('0xa3')]||![],'openchannelPause':_0x477e79[_0x363e('0xa3')]||![],'whatsappPause':_0x477e79[_0x363e('0xa3')]||![],'pauseType':_0x477e79['loginInPause']?'LOGININPAUSE':null,'interface':_0xeef910,'lastPauseAt':moment()[_0x363e('0xb1')](_0x363e('0xe8'))});}})[_0x363e('0x31')](function(_0x1aa01f){if(_0x5e0ba5[_0x363e('0xef')]){return _0x196a1d();}else{return BPromise['resolve'](_0x1aa01f)[_0x363e('0x31')](respondWithResult(_0x5c0904,null));}})['catch'](handleError(_0x5c0904,null));};exports[_0x363e('0xf0')]=function(_0x42eb78,_0x1213fb,_0xfd66fb){var _0x3994ab;return db[_0x363e('0x5a')][_0x363e('0x3c')]({'where':{'id':_0x42eb78['params']['id'],'role':_0x363e('0x84')},'attributes':['id',_0x363e('0x3d'),_0x363e('0x32')]})[_0x363e('0x31')](handleEntityNotFound(_0x1213fb,null))['then'](function(_0x252e93){if(_0x252e93){_0x3994ab=_0x252e93;return db[_0x363e('0xb2')]['destroy']({'where':{'membername':_0x3994ab['name']},'individualHooks':!![]});}})[_0x363e('0x31')](function(){return db[_0x363e('0xec')][_0x363e('0x5c')]({'where':{'membername':_0x3994ab[_0x363e('0x3d')],'exitAt':null}});})['then'](function(_0x16fe3a){var _0x4dbe79=[];_0x16fe3a[_0x363e('0xe9')](function(_0x1067ac){_0x4dbe79[_0x363e('0x8e')](_0x1067ac['update']({'exitAt':moment()[_0x363e('0xb1')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x4dbe79);})['then'](function(){return _0x3994ab[_0x363e('0x30')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x363e('0x31')](respondWithResult(_0x1213fb,null))[_0x363e('0x24')](handleError(_0x1213fb,null));};exports[_0x363e('0xf1')]=function(_0x334da3,_0x20bd26,_0x3081e0){var _0x2c0e91;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x334da3[_0x363e('0x5e')]['id']},'individualHooks':!![]})[_0x363e('0x31')](function(){return db['User'][_0x363e('0x3c')]({'where':{'id':_0x334da3[_0x363e('0x5e')]['id'],'role':'agent'},'attributes':['id','name',_0x363e('0x32'),_0x363e('0x66'),'interface']});})[_0x363e('0x31')](handleEntityNotFound(_0x20bd26,null))[_0x363e('0x31')](function(_0x1507a7){if(_0x1507a7){_0x2c0e91=_0x1507a7;return respondWithRpcPromise(_0x363e('0xf2'),_0x363e('0xf1'),{'id':_0x2c0e91['id'],'name':_0x2c0e91[_0x363e('0x3d')],'pause':!![]});}})['then'](function(){if(_0x2c0e91){return db[_0x363e('0xec')][_0x363e('0x5c')]({'where':{'membername':_0x2c0e91[_0x363e('0x3d')],'type':'PAUSE','exitAt':null}});}})[_0x363e('0x31')](function(_0x464883){if(_0x464883['length']){var _0x5bc01a=moment()[_0x363e('0xb1')](_0x363e('0xe8'));for(var _0x357e22=0x0,_0x1d7dd1=_0x464883['length'];_0x357e22<_0x1d7dd1;_0x357e22++){_0x464883[_0x357e22]['updateAttributes']({'exitAt':_0x5bc01a});}}})[_0x363e('0x31')](function(){var _0x2a5294=[];var _0x502a9a=utils[_0x363e('0xf3')]();_0x502a9a[_0x363e('0xe9')](function(_0x41dabd){_0x2a5294[_0x363e('0x8e')]({'channel':_0x41dabd,'membername':_0x2c0e91['name'],'interface':_[_0x363e('0x6b')](_0x2c0e91[_0x363e('0xa5')])?util[_0x363e('0xb1')](_0x363e('0xde'),_0x2c0e91[_0x363e('0x3d')]):_0x2c0e91[_0x363e('0xa5')],'type':'PAUSE','enterAt':moment()[_0x363e('0xb1')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x334da3[_0x363e('0x61')]['type']||'DEFAULT\x20PAUSE','role':_0x2c0e91[_0x363e('0x32')],'internal':_0x2c0e91[_0x363e('0x66')]});});return db['MemberReport'][_0x363e('0xed')](_0x2a5294,{'individualHooks':!![]});})[_0x363e('0x31')](function(){return _0x2c0e91[_0x363e('0x30')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x334da3[_0x363e('0x61')]['type']||_0x363e('0xf4'),'lastPauseAt':moment()[_0x363e('0xb1')](_0x363e('0xe8'))});})['then'](respondWithResult(_0x20bd26,null))[_0x363e('0x24')](handleError(_0x20bd26,null));};exports[_0x363e('0xf5')]=function(_0x55ff21,_0x14d717,_0x509d03){var _0x53a345;return db[_0x363e('0x5a')]['find']({'where':{'id':_0x55ff21['params']['id']},'attributes':['id','name',_0x363e('0x32'),_0x363e('0xa4'),_0x363e('0xf6'),_0x363e('0xf7'),_0x363e('0xf8'),_0x363e('0xf9'),'smsPause','whatsapppause','pauseType',_0x363e('0xfa')]})[_0x363e('0x31')](handleEntityNotFound(_0x14d717,null))[_0x363e('0x31')](function(_0xad81b9){if(_0xad81b9){_0x53a345=_0xad81b9;if(_0x55ff21['body'][_0x363e('0xa1')]&&!utils[_0x363e('0xa6')](_0x55ff21[_0x363e('0x61')]['channel'])){throw new db[(_0x363e('0x96'))][(_0x363e('0x97'))]('Unknown\x20channel');}switch(_0x55ff21[_0x363e('0x61')]['channel']){case _0x363e('0xb0'):return respondWithRpcPromise('QueuePause',_0x363e('0xf5'),{'id':_0x53a345['id'],'name':_0x53a345[_0x363e('0x3d')],'pause':![]})[_0x363e('0x31')](function(){return db[_0x363e('0xb2')][_0x363e('0x30')]({'paused':0x0},{'where':{'UserId':_0x53a345['id']},'individualHooks':!![]});})[_0x363e('0x31')](function(){return db[_0x363e('0xec')][_0x363e('0x3c')]({'where':{'channel':_0x55ff21[_0x363e('0x61')]['channel'],'membername':_0x53a345[_0x363e('0x3d')],'type':'PAUSE','exitAt':null}});})[_0x363e('0x31')](function(_0x244bbe){if(_0x244bbe){return _0x244bbe[_0x363e('0x30')]({'exitAt':moment()[_0x363e('0xb1')](_0x363e('0xe8')),'data2':_0x363e('0xfb')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x53a345['update']({'voicePause':![]});});case'mail':case'chat':case _0x363e('0xfc'):case _0x363e('0xfd'):case _0x363e('0xfe'):case _0x363e('0xff'):return db[_0x363e('0xec')][_0x363e('0x3c')]({'where':{'channel':_0x55ff21['body']['channel'],'membername':_0x53a345[_0x363e('0x3d')],'type':_0x363e('0xea'),'exitAt':null}})[_0x363e('0x31')](function(_0x21816c){if(_0x21816c){return _0x21816c['update']({'exitAt':moment()[_0x363e('0xb1')](_0x363e('0xe8')),'data2':_0x363e('0xfb')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x33f7ed={};_['set'](_0x33f7ed,util[_0x363e('0xb1')](_0x363e('0x100'),_0x55ff21[_0x363e('0x61')][_0x363e('0xa1')],_0x363e('0x101')),![]);return _0x53a345[_0x363e('0x30')](_0x33f7ed);});default:return respondWithRpcPromise('QueuePause',_0x363e('0xf5'),{'id':_0x53a345['id'],'name':_0x53a345[_0x363e('0x3d')],'pause':![]})[_0x363e('0x31')](function(){return db[_0x363e('0xb2')][_0x363e('0x30')]({'paused':0x0},{'where':{'UserId':_0x53a345['id']}});})[_0x363e('0x31')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x53a345['name'],'type':_0x363e('0xea'),'exitAt':null}});})[_0x363e('0x31')](function(_0x2c3401){var _0x265463=[];_0x2c3401[_0x363e('0xe9')](function(_0x2fa375){_0x265463[_0x363e('0x8e')](_0x2fa375[_0x363e('0x30')]({'exitAt':moment()[_0x363e('0xb1')](_0x363e('0xe8')),'data2':'manual'}));});return BPromise[_0x363e('0x93')](_0x265463);})['then'](function(){return _0x53a345[_0x363e('0x30')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x14d717,null))[_0x363e('0x24')](handleError(_0x14d717,null));};exports['getTeams']=function(_0x1a7501,_0xc62843,_0x333f40){var _0x3b4ad4={};var _0x5ad453={};var _0x1d7400;var _0x41cd2e;return db[_0x363e('0x5a')][_0x363e('0xc0')]({'where':{'id':_0x1a7501[_0x363e('0x5e')]['id']}})[_0x363e('0x31')](handleEntityNotFound(_0xc62843,null))['then'](function(_0x137099){if(_0x137099){_0x1d7400=_0x137099;_0x5ad453['model']=_[_0x363e('0x4a')](db[_0x363e('0x102')]['rawAttributes']);_0x5ad453['query']=_['keys'](_0x1a7501[_0x363e('0x4b')]);_0x5ad453[_0x363e('0x4c')]=_['intersection'](_0x5ad453['model'],_0x5ad453['query']);_0x3b4ad4['attributes']=_[_0x363e('0x4d')](_0x5ad453[_0x363e('0x46')],qs[_0x363e('0x4e')](_0x1a7501[_0x363e('0x4b')]['fields']));_0x3b4ad4[_0x363e('0x4f')]=_0x3b4ad4[_0x363e('0x4f')][_0x363e('0x50')]?_0x3b4ad4['attributes']:_0x5ad453['model'];_0x3b4ad4[_0x363e('0x52')]=qs['sort'](_0x1a7501[_0x363e('0x4b')]['sort']);_0x3b4ad4[_0x363e('0x54')]=qs[_0x363e('0x4c')](_[_0x363e('0x55')](_0x1a7501[_0x363e('0x4b')],_0x5ad453[_0x363e('0x4c')]));if(_0x1a7501[_0x363e('0x4b')][_0x363e('0x38')]){_0x3b4ad4[_0x363e('0x54')]=_[_0x363e('0x56')](_0x3b4ad4[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0x3b4ad4['attributes'],function(_0x6512bf){var _0x2b0127={};_0x2b0127[_0x6512bf]={'$like':'%'+_0x1a7501[_0x363e('0x4b')]['filter']+'%'};return _0x2b0127;})});}_0x3b4ad4=_['merge']({},_0x3b4ad4,_0x1a7501[_0x363e('0x60')]);return _0x1d7400['getTeams'](_0x3b4ad4);}})[_0x363e('0x31')](function(_0x4e7d59){if(_0x4e7d59){_0x41cd2e=_0x4e7d59['length'];if(!_0x1a7501[_0x363e('0x4b')]['hasOwnProperty']('nolimit')){_0x3b4ad4[_0x363e('0x2b')]=qs[_0x363e('0x2b')](_0x1a7501[_0x363e('0x4b')]['limit']);_0x3b4ad4['offset']=qs[_0x363e('0x2a')](_0x1a7501[_0x363e('0x4b')][_0x363e('0x2a')]);}return _0x1d7400[_0x363e('0x103')](_0x3b4ad4);}})[_0x363e('0x31')](function(_0x2f2a9a){if(_0x2f2a9a){return _0x2f2a9a?{'count':_0x41cd2e,'rows':_0x2f2a9a}:null;}})['then'](respondWithResult(_0xc62843,null))['catch'](handleError(_0xc62843,null));};exports['addTeams']=function(_0x5e0ca3,_0x3d4bd0){return db['User'][_0x363e('0x3c')]({'where':{'id':_0x5e0ca3[_0x363e('0x5e')]['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x3d4bd0,null))[_0x363e('0x31')](function(_0x370a90){if(_0x370a90){var _0x57808f=_0x370a90[_0x363e('0xc8')]({'plain':!![]});return _0x370a90[_0x363e('0x104')](_0x5e0ca3[_0x363e('0x61')]['ids'],_[_0x363e('0x65')](_0x5e0ca3[_0x363e('0x61')],[_0x363e('0x64'),'id'])||{})[_0x363e('0x31')](function(){for(var _0x20a6f4=0x0;_0x20a6f4<_0x5e0ca3['body'][_0x363e('0x64')][_0x363e('0x50')];_0x20a6f4++){var _0x452261=[];db[_0x363e('0x102')]['findOne']({'where':{'id':_0x5e0ca3['body'][_0x363e('0x64')][_0x20a6f4]}})[_0x363e('0x31')](function(_0x25f5d3){_0x452261[_0x363e('0x8e')](_0x25f5d3[_0x363e('0xe6')]()[_0x363e('0x31')](function(_0x3531ec){for(var _0x1f8282=0x0;_0x1f8282<_0x3531ec[_0x363e('0x50')];_0x1f8282++){_0x3531ec[_0x1f8282][_0x363e('0x105')](_0x363e('0xa1'),'Voice');}return _0x3531ec;}));_0x452261[_0x363e('0x8e')](_0x25f5d3[_0x363e('0x106')]()[_0x363e('0x31')](function(_0x1fd630){for(var _0x56d5c8=0x0;_0x56d5c8<_0x1fd630[_0x363e('0x50')];_0x56d5c8++){_0x1fd630[_0x56d5c8][_0x363e('0x105')]('channel',_0x363e('0x107'));}return _0x1fd630;}));_0x452261[_0x363e('0x8e')](_0x25f5d3[_0x363e('0x108')]()[_0x363e('0x31')](function(_0x493c33){for(var _0x47b29f=0x0;_0x47b29f<_0x493c33[_0x363e('0x50')];_0x47b29f++){_0x493c33[_0x47b29f][_0x363e('0x105')](_0x363e('0xa1'),'Mail');}return _0x493c33;}));_0x452261[_0x363e('0x8e')](_0x25f5d3['getSmsQueues']()['then'](function(_0x3d0b8d){for(var _0x383c42=0x0;_0x383c42<_0x3d0b8d['length'];_0x383c42++){_0x3d0b8d[_0x383c42][_0x363e('0x105')](_0x363e('0xa1'),_0x363e('0x109'));}return _0x3d0b8d;}));_0x452261[_0x363e('0x8e')](_0x25f5d3[_0x363e('0x10a')]()[_0x363e('0x31')](function(_0x4ed175){for(var _0x4dcd3f=0x0;_0x4dcd3f<_0x4ed175[_0x363e('0x50')];_0x4dcd3f++){_0x4ed175[_0x4dcd3f][_0x363e('0x105')](_0x363e('0xa1'),_0x363e('0x10b'));}return _0x4ed175;}));_0x452261[_0x363e('0x8e')](_0x25f5d3[_0x363e('0x10c')]()[_0x363e('0x31')](function(_0x449751){for(var _0x3b41b=0x0;_0x3b41b<_0x449751['length'];_0x3b41b++){_0x449751[_0x3b41b][_0x363e('0x105')](_0x363e('0xa1'),_0x363e('0x10d'));}return _0x449751;}));_0x452261[_0x363e('0x8e')](_0x25f5d3[_0x363e('0x10e')]()[_0x363e('0x31')](function(_0x1325bd){for(var _0x3c80e9=0x0;_0x3c80e9<_0x1325bd[_0x363e('0x50')];_0x3c80e9++){_0x1325bd[_0x3c80e9][_0x363e('0x105')](_0x363e('0xa1'),_0x363e('0x10f'));}return _0x1325bd;}));return BPromise[_0x363e('0x93')](_0x452261);})[_0x363e('0x31')](function(_0x568f22){var _0x46b63e=_[_0x363e('0x110')](_0x568f22);_0x452261=[];return db[_0x363e('0x57')]['transaction'](function(_0x4a2649){for(var _0x143e54=0x0;_0x143e54<_0x46b63e[_0x363e('0x50')];_0x143e54++){_0x452261[_0x363e('0x8e')](_0x46b63e[_0x143e54]['addAgent'](_0x57808f['id']),{'transaction':_0x4a2649});}return BPromise[_0x363e('0x93')](_0x452261)[_0x363e('0x31')](function(){if(_0x57808f[_0x363e('0xa2')]){return BPromise[_0x363e('0x8f')](_[_0x363e('0x38')](_0x46b63e,function(_0x359188){return _0x359188['getDataValue'](_0x363e('0xa1'))===_0x363e('0x111');}),function(_0x18df83){return db[_0x363e('0xb2')]['upsert']({'membername':_0x57808f[_0x363e('0x3d')],'UserId':_0x57808f['id'],'queue_name':_0x18df83[_0x363e('0x3d')],'VoiceQueueId':_0x18df83['id'],'interface':_[_0x363e('0x6b')](_0x57808f[_0x363e('0xa5')])?util[_0x363e('0xb1')](_0x363e('0xde'),_0x57808f[_0x363e('0x3d')]):_0x57808f['interface'],'paused':_0x57808f[_0x363e('0xa4')]||![],'penalty':_0x57808f[_0x363e('0xac')]},{'transaction':_0x4a2649});});}else{return;}})[_0x363e('0x31')](function(){for(var _0x290aad=0x0;_0x290aad<_0x46b63e[_0x363e('0x50')];_0x290aad++){var _0x593f6b=_0x46b63e[_0x290aad][_0x363e('0x112')]('channel');var _0x4b8aa8=_0x593f6b+_0x363e('0xad');socket[_0x363e('0xae')](_0x363e('0x35')+_0x593f6b+_0x363e('0x113'),{'UserId':_0x57808f['id'],['queueField']:_0x46b63e[_0x290aad]['id']});}});});});}});}})[_0x363e('0x31')](respondWithStatusCode(_0x3d4bd0,null))[_0x363e('0x24')](handleError(_0x3d4bd0,null));};exports[_0x363e('0x114')]=function(_0x594404,_0x5881b3){return db[_0x363e('0x5a')][_0x363e('0xc0')]({'where':{'id':_0x594404[_0x363e('0x5e')]['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x5881b3,null))[_0x363e('0x31')](function(_0x16930b){if(_0x16930b){var _0x3e73f8=_0x16930b[_0x363e('0xc8')]({'plain':!![]});var _0x1266da=_0x594404[_0x363e('0x4b')][_0x363e('0x64')];return _0x16930b[_0x363e('0x114')](_0x1266da)[_0x363e('0x31')](function(){for(var _0x2a955a=0x0;_0x2a955a<_0x1266da[_0x363e('0x50')];_0x2a955a++){var _0x3eb5dc=[];db[_0x363e('0x102')][_0x363e('0xc0')]({'where':{'id':_0x1266da[_0x2a955a]}})[_0x363e('0x31')](function(_0x1f8271){_0x3eb5dc[_0x363e('0x8e')](_0x1f8271[_0x363e('0xe6')]()[_0x363e('0x31')](function(_0x422232){for(var _0x227e5c=0x0;_0x227e5c<_0x422232['length'];_0x227e5c++){_0x422232[_0x227e5c][_0x363e('0x105')](_0x363e('0xa1'),_0x363e('0x111'));}return _0x422232;}));_0x3eb5dc[_0x363e('0x8e')](_0x1f8271[_0x363e('0x106')]()[_0x363e('0x31')](function(_0x46d433){for(var _0x385425=0x0;_0x385425<_0x46d433[_0x363e('0x50')];_0x385425++){_0x46d433[_0x385425][_0x363e('0x105')](_0x363e('0xa1'),_0x363e('0x107'));}return _0x46d433;}));_0x3eb5dc[_0x363e('0x8e')](_0x1f8271[_0x363e('0x108')]()['then'](function(_0x3a9e9d){for(var _0x59fc8c=0x0;_0x59fc8c<_0x3a9e9d[_0x363e('0x50')];_0x59fc8c++){_0x3a9e9d[_0x59fc8c][_0x363e('0x105')](_0x363e('0xa1'),_0x363e('0x115'));}return _0x3a9e9d;}));_0x3eb5dc[_0x363e('0x8e')](_0x1f8271[_0x363e('0x116')]()[_0x363e('0x31')](function(_0x27db72){for(var _0x5e0f07=0x0;_0x5e0f07<_0x27db72[_0x363e('0x50')];_0x5e0f07++){_0x27db72[_0x5e0f07][_0x363e('0x105')](_0x363e('0xa1'),'Sms');}return _0x27db72;}));_0x3eb5dc['push'](_0x1f8271[_0x363e('0x10a')]()[_0x363e('0x31')](function(_0x5c1777){for(var _0x371031=0x0;_0x371031<_0x5c1777[_0x363e('0x50')];_0x371031++){_0x5c1777[_0x371031][_0x363e('0x105')](_0x363e('0xa1'),_0x363e('0x10b'));}return _0x5c1777;}));_0x3eb5dc[_0x363e('0x8e')](_0x1f8271['getFaxQueues']()['then'](function(_0x535cbb){for(var _0x356c00=0x0;_0x356c00<_0x535cbb[_0x363e('0x50')];_0x356c00++){_0x535cbb[_0x356c00][_0x363e('0x105')](_0x363e('0xa1'),_0x363e('0x10d'));}return _0x535cbb;}));_0x3eb5dc[_0x363e('0x8e')](_0x1f8271['getOpenchannelQueues']()['then'](function(_0xbcb2a0){for(var _0x4304c4=0x0;_0x4304c4<_0xbcb2a0[_0x363e('0x50')];_0x4304c4++){_0xbcb2a0[_0x4304c4][_0x363e('0x105')](_0x363e('0xa1'),_0x363e('0x10f'));}return _0xbcb2a0;}));return BPromise[_0x363e('0x93')](_0x3eb5dc);})[_0x363e('0x31')](function(_0x3cabbb){var _0x5f39eb=_[_0x363e('0x110')](_0x3cabbb);_0x3eb5dc=[];return db['sequelize'][_0x363e('0x117')](function(_0x15eb0f){for(var _0x196142=0x0;_0x196142<_0x5f39eb[_0x363e('0x50')];_0x196142++){_0x3eb5dc[_0x363e('0x8e')](_0x5f39eb[_0x196142][_0x363e('0x118')](_0x3e73f8['id']),{'transaction':_0x15eb0f});}return BPromise[_0x363e('0x93')](_0x3eb5dc)['then'](function(){if(_0x3e73f8['online']){return BPromise[_0x363e('0x8f')](_['filter'](_0x5f39eb,function(_0x55ab73){return _0x55ab73[_0x363e('0x112')]('channel')===_0x363e('0x111');}),function(_0x3b17ea){return db[_0x363e('0xb2')][_0x363e('0x3f')]({'where':{'VoiceQueueId':_0x3b17ea['id'],'UserId':_0x3e73f8['id']},'transaction':_0x15eb0f});});}else{return;}})[_0x363e('0x31')](function(){for(var _0x289ffe=0x0;_0x289ffe<_0x5f39eb[_0x363e('0x50')];_0x289ffe++){var _0x9bf0e6=_0x5f39eb[_0x289ffe]['getDataValue'](_0x363e('0xa1'));var _0x4c3d80=_0x9bf0e6+_0x363e('0xad');socket[_0x363e('0xae')](_0x363e('0x35')+_0x9bf0e6+_0x363e('0xb6'),{'UserId':_0x3e73f8['id'],['queueField']:_0x5f39eb[_0x289ffe]['id']});}});});});}});}})[_0x363e('0x31')](respondWithStatusCode(_0x5881b3,null))[_0x363e('0x24')](handleError(_0x5881b3,null));};exports[_0x363e('0x119')]=function(_0x22234a,_0x33e187,_0x2f58f8){var _0x2f2bfb={};var _0x4fc500={};var _0x383de7;var _0x54b5fa;return db['User'][_0x363e('0xc0')]({'where':{'id':_0x22234a['params']['id']}})['then'](handleEntityNotFound(_0x33e187,null))[_0x363e('0x31')](function(_0x19fbd5){if(_0x19fbd5){_0x383de7=_0x19fbd5;_0x4fc500[_0x363e('0x46')]=_['keys'](db[_0x363e('0xc3')][_0x363e('0x42')]);_0x4fc500[_0x363e('0x4b')]=_[_0x363e('0x4a')](_0x22234a[_0x363e('0x4b')]);_0x4fc500['filters']=_[_0x363e('0x4d')](_0x4fc500[_0x363e('0x46')],_0x4fc500[_0x363e('0x4b')]);_0x2f2bfb['attributes']=_[_0x363e('0x4d')](_0x4fc500[_0x363e('0x46')],qs[_0x363e('0x4e')](_0x22234a[_0x363e('0x4b')][_0x363e('0x4e')]));_0x2f2bfb['attributes']=_0x2f2bfb[_0x363e('0x4f')][_0x363e('0x50')]?_0x2f2bfb[_0x363e('0x4f')]:_0x4fc500[_0x363e('0x46')];_0x2f2bfb['order']=qs[_0x363e('0x53')](_0x22234a[_0x363e('0x4b')][_0x363e('0x53')]);_0x2f2bfb[_0x363e('0x54')]=qs[_0x363e('0x4c')](_['pick'](_0x22234a[_0x363e('0x4b')],_0x4fc500[_0x363e('0x4c')]));if(_0x22234a[_0x363e('0x4b')][_0x363e('0x38')]){_0x2f2bfb[_0x363e('0x54')]=_[_0x363e('0x56')](_0x2f2bfb[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0x2f2bfb[_0x363e('0x4f')],function(_0x28aeb6){var _0x3a918c={};_0x3a918c[_0x28aeb6]={'$like':'%'+_0x22234a[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x3a918c;})});}_0x2f2bfb=_[_0x363e('0x56')]({},_0x2f2bfb,_0x22234a['options']);return _0x383de7[_0x363e('0x119')](_0x2f2bfb);}})['then'](function(_0x4af360){if(_0x4af360){_0x54b5fa=_0x4af360[_0x363e('0x50')];if(!_0x22234a[_0x363e('0x4b')][_0x363e('0xc2')](_0x363e('0x51'))){_0x2f2bfb['limit']=qs['limit'](_0x22234a[_0x363e('0x4b')][_0x363e('0x2b')]);_0x2f2bfb[_0x363e('0x2a')]=qs['offset'](_0x22234a[_0x363e('0x4b')][_0x363e('0x2a')]);}return _0x383de7[_0x363e('0x119')](_0x2f2bfb);}})[_0x363e('0x31')](function(_0x249c23){if(_0x249c23){return _0x249c23?{'count':_0x54b5fa,'rows':_0x249c23}:null;}})[_0x363e('0x31')](respondWithResult(_0x33e187,null))['catch'](handleError(_0x33e187,null));};exports[_0x363e('0x11a')]=function(_0x19cb8e,_0x1a6553,_0x3b32b6){var _0x58845d={};var _0xda1212={};var _0x41163b;var _0xc619bf;return db[_0x363e('0x5a')][_0x363e('0xc0')]({'where':{'id':_0x19cb8e[_0x363e('0x5e')]['id']}})[_0x363e('0x31')](handleEntityNotFound(_0x1a6553,null))[_0x363e('0x31')](function(_0x2fe243){if(_0x2fe243){_0x41163b=_0x2fe243;_0xda1212[_0x363e('0x46')]=_[_0x363e('0x4a')](db[_0x363e('0x5a')]['rawAttributes']);_0xda1212[_0x363e('0x4b')]=_[_0x363e('0x4a')](_0x19cb8e[_0x363e('0x4b')]);_0xda1212[_0x363e('0x4c')]=_[_0x363e('0x4d')](_0xda1212['model'],_0xda1212[_0x363e('0x4b')]);_0x58845d[_0x363e('0x4f')]=_['intersection'](_0xda1212[_0x363e('0x46')],qs[_0x363e('0x4e')](_0x19cb8e[_0x363e('0x4b')][_0x363e('0x4e')]));_0x58845d[_0x363e('0x4f')]=_0x58845d[_0x363e('0x4f')]['length']?_0x58845d['attributes']:_0xda1212[_0x363e('0x46')];_0x58845d[_0x363e('0x52')]=qs['sort'](_0x19cb8e[_0x363e('0x4b')]['sort']);_0x58845d['where']=qs['filters'](_[_0x363e('0x55')](_0x19cb8e[_0x363e('0x4b')],_0xda1212[_0x363e('0x4c')]));if(_0x19cb8e['query'][_0x363e('0x38')]){_0x58845d['where']=_[_0x363e('0x56')](_0x58845d[_0x363e('0x54')],{'$or':_[_0x363e('0x39')](_0x58845d[_0x363e('0x4f')],function(_0x43d3f4){var _0x569f17={};_0x569f17[_0x43d3f4]={'$like':'%'+_0x19cb8e[_0x363e('0x4b')][_0x363e('0x38')]+'%'};return _0x569f17;})});}_0x58845d[_0x363e('0x46')]=db[_0x363e('0x5a')];_0x58845d['as']=_0x363e('0x36');_0x58845d=_[_0x363e('0x56')]({},_0x58845d,_0x19cb8e[_0x363e('0x60')]);return _0x41163b['getVoiceQueues']({'include':[_0x58845d]});}})[_0x363e('0x31')](function(_0x1007f9){if(_0x1007f9){var _0x44d21b={},_0x26cd2e=[],_0x5611ad=0x0;for(var _0x28910e=0x0;_0x28910e<_0x1007f9['length'];_0x28910e+=0x1){for(var _0x3c9492=0x0,_0x3d973a;_0x3c9492<_0x1007f9[_0x28910e][_0x363e('0x36')][_0x363e('0x50')];_0x3c9492+=0x1){_0x3d973a=_0x1007f9[_0x28910e][_0x363e('0x36')][_0x3c9492][_0x363e('0xc8')]({'plain':!![]});_0x44d21b[_0x3d973a['id']]=_0x3d973a;}}_0x44d21b=_[_0x363e('0x11b')](_0x44d21b);for(var _0x1024ea=qs[_0x363e('0x2a')](_0x19cb8e[_0x363e('0x4b')][_0x363e('0x2a')]);_0x1024ea<_0x44d21b[_0x363e('0x50')]&&_0x26cd2e[_0x363e('0x50')]=_0x3c7117[_0xcdac('0x55')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x454f11){return db[_0xcdac('0x2e')][_0xcdac('0x4c')]({'where':{'membername':_0x454f11[_0xcdac('0x2b')]},'individualHooks':!![]});}})[_0xcdac('0x27')](function(){if(_0x454f11){return _0x454f11['getVoiceQueues']({'raw':!![]});}})[_0xcdac('0x27')](function(_0x5186d0){if(_0x454f11){if(_0x5186d0){var _0x4cacc6=[];_0x412745=_0x5186d0;if(_0x412745[_0xcdac('0x32')]){for(var _0x4e521d=0x0;_0x4e521d<_0x412745['length'];_0x4e521d++){_0x4cacc6[_0xcdac('0x36')](db[_0xcdac('0x2e')][_0xcdac('0x56')]({'membername':_0x454f11['name'],'UserId':_0x454f11['id'],'queue_name':_0x412745[_0x4e521d][_0xcdac('0x2b')],'VoiceQueueId':_0x412745[_0x4e521d]['id'],'interface':_0x130185,'paused':_0x454f11['loginInPause']||![],'penalty':_0x412745[_0x4e521d][_0xcdac('0x57')]||0x0}));}return BPromise[_0xcdac('0x4a')](_0x4cacc6);}}}})[_0xcdac('0x27')](function(){if(_0x454f11){return db[_0xcdac('0x30')][_0xcdac('0x1e')]({'where':{'membername':_0x454f11[_0xcdac('0x2b')],'exitAt':null}});}})[_0xcdac('0x27')](function(_0x2e3c6f){if(_0x454f11){if(_0x2e3c6f&&_0x2e3c6f[_0xcdac('0x32')]){var _0x23cbcc=[];_0x2e3c6f['forEach'](function(_0xedaddf){_0x23cbcc[_0xcdac('0x36')](_0xedaddf[_0xcdac('0x2f')]({'exitAt':moment()['format'](_0xcdac('0x38'))}));});return BPromise[_0xcdac('0x4a')](_0x23cbcc);}}})['then'](function(_0x2746ea){if(_0x454f11){var _0x3080ed=[];var _0xd3f3a9=[];var _0x10eae9=utils['getChannels']();var _0x34d16b={'membername':_0x454f11['name'],'interface':_0x130185,'enterAt':moment()[_0xcdac('0x31')](_0xcdac('0x38')),'role':_0x454f11[_0xcdac('0x2c')],'internal':_0x454f11[_0xcdac('0x3c')]};_0x10eae9['forEach'](function(_0x2ceaa8){_0x3080ed[_0xcdac('0x36')](_[_0xcdac('0x58')]({'channel':_0x2ceaa8,'type':_0xcdac('0x59'),'data1':_0xcdac('0x5a'),'data2':_0x130185},_0x34d16b));if(_0x454f11[_0xcdac('0x5b')]){_0xd3f3a9[_0xcdac('0x36')](_[_0xcdac('0x58')]({'channel':_0x2ceaa8,'type':_0xcdac('0x42'),'data1':_0xcdac('0x5c')},_0x34d16b));}});return db['MemberReport']['bulkCreate'](_0x3080ed[_0xcdac('0x5d')](_0xd3f3a9),{'individualHooks':!![]});}})['then'](function(){if(_0x454f11){return _0x454f11[_0xcdac('0x2f')]({'online':!![],'lastLoginAt':moment()[_0xcdac('0x31')](_0xcdac('0x38')),'voicePause':_0x454f11[_0xcdac('0x5b')]||![],'mailPause':_0x454f11[_0xcdac('0x5b')]||![],'chatPause':_0x454f11['loginInPause']||![],'faxPause':_0x454f11[_0xcdac('0x5b')]||![],'smsPause':_0x454f11['loginInPause']||![],'openchannelPause':_0x454f11[_0xcdac('0x5b')]||![],'pauseType':_0x454f11['loginInPause']?_0xcdac('0x5c'):null,'lastPauseAt':moment()[_0xcdac('0x31')](_0xcdac('0x38')),'interface':_0x130185});}})['then'](function(_0x2bb673){_0x47b616(_0x2bb673);})[_0xcdac('0x1b')](function(_0x325266){_0x1d8de5(_0x3ac35c['error'](0x1f4,_0x325266[_0xcdac('0x19')]));});});}; \ No newline at end of file +var _0x0570=['bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./user.socket','register','request','then','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetUser','User','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowUser','PauseUser','name','role','internal','UserVoiceQueueRt','update','MemberReport','PAUSE','format','length','getChannels','forEach','push','isNil','interface','YYYY-MM-DD\x20HH:mm:ss','body','DEFAULT\x20PAUSE','uniqueid','bulkCreate','type','UnpauseUser','findOne','isValidChannel','channel','Unknown\x20channel','voice','system','mail','chat','fax','sms','openchannel','whatsapp','set','Pause','all','LogoutUser','destroy','LoginUser','mobile','phone','loginInPause','count','../../config/license/util','getLicense','agents','getVoiceQueues','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','concat','util','moment'];(function(_0x401d9c,_0x5191cb){var _0x932c99=function(_0x4981ef){while(--_0x4981ef){_0x401d9c['push'](_0x401d9c['shift']());}};_0x932c99(++_0x5191cb);}(_0x0570,0x172));var _0x0057=function(_0x45dfdf,_0x1dfcbf){_0x45dfdf=_0x45dfdf-0x0;var _0x37de8b=_0x0570[_0x45dfdf];return _0x37de8b;};'use strict';var _=require('lodash');var util=require(_0x0057('0x0'));var moment=require(_0x0057('0x1'));var BPromise=require(_0x0057('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0057('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0057('0x4'));var logger=require('../../config/logger')(_0x0057('0x5'));var config=require(_0x0057('0x6'));var jayson=require(_0x0057('0x7'));var client=jayson[_0x0057('0x8')][_0x0057('0x9')]({'port':0x232a});config['redis']=_[_0x0057('0xa')](config['redis'],{'host':_0x0057('0xb'),'port':0x18eb});var socket=require(_0x0057('0xc'))(new Redis(config[_0x0057('0xd')]));require(_0x0057('0xe'))[_0x0057('0xf')](socket);function respondWithRpcPromise(_0x54f384,_0x3dd577,_0x2fd05d){return new BPromise(function(_0xb56a5c,_0x5d493f){return client[_0x0057('0x10')](_0x54f384,_0x2fd05d)[_0x0057('0x11')](function(_0x48805a){logger['info'](_0x0057('0x12'),_0x3dd577,_0x0057('0x13'));logger[_0x0057('0x14')]('User,\x20%s,\x20%s,\x20%s',_0x3dd577,_0x0057('0x13'),JSON[_0x0057('0x15')](_0x48805a));if(_0x48805a[_0x0057('0x16')]){if(_0x48805a[_0x0057('0x16')]['code']===0x1f4){logger[_0x0057('0x16')](_0x0057('0x12'),_0x3dd577,_0x48805a['error'][_0x0057('0x17')]);return _0x5d493f(_0x48805a[_0x0057('0x16')]['message']);}logger[_0x0057('0x16')]('User,\x20%s,\x20%s',_0x3dd577,_0x48805a[_0x0057('0x16')]['message']);return _0xb56a5c(_0x48805a[_0x0057('0x16')][_0x0057('0x17')]);}else{logger['info']('User,\x20%s,\x20%s',_0x3dd577,_0x0057('0x13'));_0xb56a5c(_0x48805a[_0x0057('0x18')]['message']);}})[_0x0057('0x19')](function(_0x5b5a4b){logger[_0x0057('0x16')](_0x0057('0x12'),_0x3dd577,_0x5b5a4b);_0x5d493f(_0x5b5a4b);});});}exports[_0x0057('0x1a')]=function(_0x157982){var _0x309297=this;return new Promise(function(_0x26a524,_0xdea279){return db[_0x0057('0x1b')][_0x0057('0x1c')]({'raw':_0x157982[_0x0057('0x1d')]?_0x157982[_0x0057('0x1d')][_0x0057('0x1e')]===undefined?!![]:![]:!![],'where':_0x157982[_0x0057('0x1d')]?_0x157982[_0x0057('0x1d')][_0x0057('0x1f')]||null:null,'attributes':_0x157982['options']?_0x157982[_0x0057('0x1d')][_0x0057('0x20')]||null:null,'limit':_0x157982['options']?_0x157982[_0x0057('0x1d')][_0x0057('0x21')]||null:null,'include':_0x157982['options']?_0x157982[_0x0057('0x1d')][_0x0057('0x22')]?_[_0x0057('0x23')](_0x157982['options']['include'],function(_0x30c0a8){return{'model':db[_0x30c0a8[_0x0057('0x24')]],'as':_0x30c0a8['as'],'attributes':_0x30c0a8[_0x0057('0x20')],'include':_0x30c0a8[_0x0057('0x22')]?_[_0x0057('0x23')](_0x30c0a8[_0x0057('0x22')],function(_0x491ef3){return{'model':db[_0x491ef3['model']],'as':_0x491ef3['as'],'attributes':_0x491ef3['attributes'],'include':_0x491ef3[_0x0057('0x22')]?_[_0x0057('0x23')](_0x491ef3[_0x0057('0x22')],function(_0x5dfc14){return{'model':db[_0x5dfc14[_0x0057('0x24')]],'as':_0x5dfc14['as'],'attributes':_0x5dfc14[_0x0057('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0057('0x11')](function(_0x1fffe4){logger['info']('GetUser',_0x157982);logger[_0x0057('0x14')]('GetUser',_0x157982,JSON[_0x0057('0x15')](_0x1fffe4));_0x26a524(_0x1fffe4);})[_0x0057('0x19')](function(_0x3475a5){logger[_0x0057('0x16')](_0x0057('0x1a'),_0x3475a5[_0x0057('0x17')],_0x157982);_0xdea279(_0x309297[_0x0057('0x16')](0x1f4,_0x3475a5[_0x0057('0x17')]));});});};exports['ShowUser']=function(_0x1e4bb2){var _0x58240b=this;return new Promise(function(_0x12d7f5,_0x57cb53){return db['User'][_0x0057('0x25')]({'raw':_0x1e4bb2[_0x0057('0x1d')]?_0x1e4bb2[_0x0057('0x1d')][_0x0057('0x1e')]===undefined?!![]:![]:!![],'where':_0x1e4bb2['options']?_0x1e4bb2[_0x0057('0x1d')][_0x0057('0x1f')]||null:null,'attributes':_0x1e4bb2[_0x0057('0x1d')]?_0x1e4bb2[_0x0057('0x1d')][_0x0057('0x20')]||null:null,'include':_0x1e4bb2[_0x0057('0x1d')]?_0x1e4bb2['options'][_0x0057('0x22')]?_['map'](_0x1e4bb2[_0x0057('0x1d')][_0x0057('0x22')],function(_0x420321){return{'model':db[_0x420321['model']],'as':_0x420321['as'],'attributes':_0x420321[_0x0057('0x20')],'include':_0x420321['include']?_['map'](_0x420321[_0x0057('0x22')],function(_0x5c1ffb){return{'model':db[_0x5c1ffb[_0x0057('0x24')]],'as':_0x5c1ffb['as'],'attributes':_0x5c1ffb[_0x0057('0x20')],'include':_0x5c1ffb['include']?_[_0x0057('0x23')](_0x5c1ffb['include'],function(_0x447396){return{'model':db[_0x447396[_0x0057('0x24')]],'as':_0x447396['as'],'attributes':_0x447396[_0x0057('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0057('0x11')](function(_0x39181d){logger['info'](_0x0057('0x26'),_0x1e4bb2);logger[_0x0057('0x14')](_0x0057('0x26'),_0x1e4bb2,JSON[_0x0057('0x15')](_0x39181d));_0x12d7f5(_0x39181d);})[_0x0057('0x19')](function(_0x48b875){logger[_0x0057('0x16')](_0x0057('0x26'),_0x48b875['message'],_0x1e4bb2);_0x57cb53(_0x58240b['error'](0x1f4,_0x48b875['message']));});});};exports[_0x0057('0x27')]=function(_0x26b13a){var _0x2b0a22=this;return new Promise(function(_0x27828b,_0x21a720){var _0x56fa13;return db[_0x0057('0x1b')]['find']({'where':_0x26b13a[_0x0057('0x1d')]['where']||{},'attributes':['id',_0x0057('0x28'),_0x0057('0x29'),_0x0057('0x2a'),'interface']})[_0x0057('0x11')](function(_0x419f26){if(_0x419f26){_0x56fa13=_0x419f26;return db[_0x0057('0x2b')][_0x0057('0x2c')]({'paused':0x1},{'where':{'UserId':_0x56fa13['id']},'individualHooks':!![]});}})[_0x0057('0x11')](function(){if(_0x56fa13){return db[_0x0057('0x2d')][_0x0057('0x1c')]({'where':{'membername':_0x56fa13[_0x0057('0x28')],'type':_0x0057('0x2e'),'exitAt':null}});}})[_0x0057('0x11')](function(_0x52a398){if(_0x56fa13){if(_0x52a398&&_0x52a398['length']){var _0x13a2c2=moment()[_0x0057('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x747af4=0x0,_0x465950=_0x52a398[_0x0057('0x30')];_0x747af4<_0x465950;_0x747af4++){_0x52a398[_0x747af4]['updateAttributes']({'exitAt':_0x13a2c2});}}}})[_0x0057('0x11')](function(){if(_0x56fa13){var _0xe76eac=[];var _0x52bf6d=utils[_0x0057('0x31')]();_0x52bf6d[_0x0057('0x32')](function(_0x4ed465){_0xe76eac[_0x0057('0x33')]({'channel':_0x4ed465,'membername':_0x56fa13[_0x0057('0x28')],'interface':_[_0x0057('0x34')](_0x56fa13['interface'])?util[_0x0057('0x2f')]('SIP/%s',_0x56fa13[_0x0057('0x28')]):_0x56fa13[_0x0057('0x35')],'type':'PAUSE','enterAt':moment()[_0x0057('0x2f')](_0x0057('0x36')),'data1':_0x26b13a[_0x0057('0x37')]['type']||_0x0057('0x38'),'role':_0x56fa13['role'],'internal':_0x56fa13[_0x0057('0x2a')],'uniqueid':_0x26b13a[_0x0057('0x37')][_0x0057('0x39')]||null});});return db[_0x0057('0x2d')][_0x0057('0x3a')](_0xe76eac,{'individualHooks':!![]});}})['then'](function(){if(_0x56fa13){return _0x56fa13[_0x0057('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x26b13a[_0x0057('0x37')][_0x0057('0x3b')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x0057('0x2f')](_0x0057('0x36'))});}})['then'](function(_0x3b5625){_0x27828b(_0x3b5625);})[_0x0057('0x19')](function(_0x221c7a){_0x21a720(_0x2b0a22['error'](0x1f4,_0x221c7a[_0x0057('0x17')]));});});};exports[_0x0057('0x3c')]=function(_0x5cfce3){var _0x1ef8f3=this;return new Promise(function(_0x53bb4b,_0x2fbef9){var _0x590365;return db[_0x0057('0x1b')][_0x0057('0x3d')]({'where':_0x5cfce3[_0x0057('0x1d')][_0x0057('0x1f')]||{},'attributes':['id',_0x0057('0x28')]})[_0x0057('0x11')](function(_0xf9fe64){if(_0xf9fe64){_0x590365=_0xf9fe64;if(_0x5cfce3[_0x0057('0x37')]['channel']&&!utils[_0x0057('0x3e')](_0x5cfce3['body'][_0x0057('0x3f')])){throw new Error(_0x0057('0x40'));}switch(_0x5cfce3[_0x0057('0x37')][_0x0057('0x3f')]){case _0x0057('0x41'):return db['UserVoiceQueueRt'][_0x0057('0x2c')]({'paused':0x0},{'where':{'UserId':_0x590365['id']}})[_0x0057('0x11')](function(){return db['MemberReport'][_0x0057('0x25')]({'where':{'channel':_0x5cfce3['body'][_0x0057('0x3f')],'membername':_0x590365[_0x0057('0x28')],'type':_0x0057('0x2e'),'exitAt':null}});})[_0x0057('0x11')](function(_0x55a67c){if(_0x55a67c){return _0x55a67c[_0x0057('0x2c')]({'exitAt':moment()['format'](_0x0057('0x36')),'data2':_0x0057('0x42')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x590365['update']({'voicePause':![]});});case _0x0057('0x43'):case _0x0057('0x44'):case _0x0057('0x45'):case _0x0057('0x46'):case _0x0057('0x47'):case _0x0057('0x48'):return db[_0x0057('0x2d')][_0x0057('0x25')]({'where':{'channel':_0x5cfce3[_0x0057('0x37')]['channel'],'membername':_0x590365['name'],'type':_0x0057('0x2e'),'exitAt':null}})[_0x0057('0x11')](function(_0x1d589d){return _0x1d589d[_0x0057('0x2c')]({'exitAt':moment()[_0x0057('0x2f')](_0x0057('0x36')),'data2':_0x0057('0x42')},{'individualHooks':!![]});})[_0x0057('0x11')](function(){var _0x11b725={};_[_0x0057('0x49')](_0x11b725,util[_0x0057('0x2f')]('%s%s',_0x5cfce3['body'][_0x0057('0x3f')],_0x0057('0x4a')),![]);return _0x590365[_0x0057('0x2c')](_0x11b725);});default:return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x590365['id']}})[_0x0057('0x11')](function(){return db['MemberReport'][_0x0057('0x1c')]({'where':{'membername':_0x590365[_0x0057('0x28')],'type':_0x0057('0x2e'),'exitAt':null}});})[_0x0057('0x11')](function(_0x57a99f){var _0xf4cc0a=[];_0x57a99f['forEach'](function(_0x6bb6b){_0xf4cc0a[_0x0057('0x33')](_0x6bb6b[_0x0057('0x2c')]({'exitAt':moment()[_0x0057('0x2f')](_0x0057('0x36')),'data2':_0x0057('0x42')}));});return BPromise[_0x0057('0x4b')](_0xf4cc0a);})['then'](function(){return _0x590365[_0x0057('0x2c')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x0057('0x11')](function(_0x5ab0b3){_0x53bb4b(_0x5ab0b3);})[_0x0057('0x19')](function(_0x4f05e5){_0x2fbef9(_0x1ef8f3['error'](0x1f4,_0x4f05e5[_0x0057('0x17')]));});});};exports[_0x0057('0x4c')]=function(_0xaf68db){var _0x367907=this;return new Promise(function(_0x48c55d,_0x385d4a){var _0x43718c;return db[_0x0057('0x1b')][_0x0057('0x3d')]({'where':_0xaf68db[_0x0057('0x1d')][_0x0057('0x1f')]||{},'attributes':['id','name']})[_0x0057('0x11')](function(_0x4fe6de){if(_0x4fe6de){_0x43718c=_0x4fe6de;return db['UserVoiceQueueRt'][_0x0057('0x4d')]({'where':{'membername':_0x43718c['name']},'individualHooks':!![]});}})['then'](function(){if(_0x43718c){return db[_0x0057('0x2d')][_0x0057('0x1c')]({'where':{'membername':_0x43718c[_0x0057('0x28')],'exitAt':null}});}})[_0x0057('0x11')](function(_0x48beaa){if(_0x43718c){if(_0x48beaa&&_0x48beaa['length']){var _0x33b60f=[];_0x48beaa['forEach'](function(_0x22d54f){_0x33b60f['push'](_0x22d54f[_0x0057('0x2c')]({'exitAt':moment()[_0x0057('0x2f')](_0x0057('0x36'))}));});return BPromise[_0x0057('0x4b')](_0x33b60f);}}})[_0x0057('0x11')](function(){if(_0x43718c){return _0x43718c[_0x0057('0x2c')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x340cc2){_0x48c55d(_0x340cc2);})[_0x0057('0x19')](function(_0xf757a9){_0x385d4a(_0x367907[_0x0057('0x16')](0x1f4,_0xf757a9[_0x0057('0x17')]));});});};exports[_0x0057('0x4e')]=function(_0x2757f2){var _0x1321f9=this;return new Promise(function(_0x336649,_0x178392){var _0x586333;var _0x2eec69;var _0x4f1d2b;var _0xda34f5;return db[_0x0057('0x1b')]['findOne']({'where':_0x2757f2[_0x0057('0x1d')][_0x0057('0x1f')]||{},'attributes':['id',_0x0057('0x28'),'role',_0x0057('0x4f'),_0x0057('0x50'),_0x0057('0x2a'),_0x0057('0x51'),_0x0057('0x35')]})[_0x0057('0x11')](function(_0x1520a9){if(_0x1520a9){_0x586333=_0x1520a9;_0xda34f5=_0x2757f2['body'][_0x0057('0x35')]?_0x2757f2[_0x0057('0x37')][_0x0057('0x35')]:util[_0x0057('0x2f')]('SIP/%s',_0x586333[_0x0057('0x28')]);return db['User'][_0x0057('0x52')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x586333['id']}}});}})[_0x0057('0x11')](function(_0x4b7a9e){if(_0x4b7a9e){_0x4f1d2b=_0x4b7a9e;return require(_0x0057('0x53'))[_0x0057('0x54')]();}})[_0x0057('0x11')](function(_0x3de186){if(_0x3de186&&_0x3de186[_0x0057('0x55')]&&_0x4f1d2b>=_0x3de186[_0x0057('0x55')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x0057('0x11')](function(){if(_0x586333){return db[_0x0057('0x2b')]['destroy']({'where':{'membername':_0x586333['name']},'individualHooks':!![]});}})[_0x0057('0x11')](function(){if(_0x586333){return _0x586333[_0x0057('0x56')]({'raw':!![]});}})['then'](function(_0xa30f3){if(_0x586333){if(_0xa30f3){var _0x1608fa=[];_0x2eec69=_0xa30f3;if(_0x2eec69['length']){for(var _0x47bc12=0x0;_0x47bc12<_0x2eec69[_0x0057('0x30')];_0x47bc12++){_0x1608fa['push'](db[_0x0057('0x2b')]['upsert']({'membername':_0x586333[_0x0057('0x28')],'UserId':_0x586333['id'],'queue_name':_0x2eec69[_0x47bc12]['name'],'VoiceQueueId':_0x2eec69[_0x47bc12]['id'],'interface':_0xda34f5,'paused':_0x586333[_0x0057('0x51')]||![],'penalty':_0x2eec69[_0x47bc12][_0x0057('0x57')]||0x0}));}return BPromise['all'](_0x1608fa);}}}})['then'](function(){if(_0x586333){return db['MemberReport']['findAll']({'where':{'membername':_0x586333[_0x0057('0x28')],'exitAt':null}});}})[_0x0057('0x11')](function(_0x19e0e0){if(_0x586333){if(_0x19e0e0&&_0x19e0e0[_0x0057('0x30')]){var _0x398eab=[];_0x19e0e0[_0x0057('0x32')](function(_0x8d6d58){_0x398eab['push'](_0x8d6d58[_0x0057('0x2c')]({'exitAt':moment()['format'](_0x0057('0x36'))}));});return BPromise[_0x0057('0x4b')](_0x398eab);}}})['then'](function(_0xd8d2be){if(_0x586333){var _0x626282=[];var _0x2b5f6e=[];var _0x1cfa99=utils['getChannels']();var _0x40a5ec={'membername':_0x586333[_0x0057('0x28')],'interface':_0xda34f5,'enterAt':moment()[_0x0057('0x2f')](_0x0057('0x36')),'role':_0x586333[_0x0057('0x29')],'internal':_0x586333[_0x0057('0x2a')]};_0x1cfa99[_0x0057('0x32')](function(_0x3a8bf6){_0x626282['push'](_[_0x0057('0x58')]({'channel':_0x3a8bf6,'type':_0x0057('0x59'),'data1':_0x0057('0x5a'),'data2':_0xda34f5},_0x40a5ec));if(_0x586333[_0x0057('0x51')]){_0x2b5f6e[_0x0057('0x33')](_[_0x0057('0x58')]({'channel':_0x3a8bf6,'type':_0x0057('0x2e'),'data1':_0x0057('0x5b')},_0x40a5ec));}});return db[_0x0057('0x2d')]['bulkCreate'](_0x626282[_0x0057('0x5c')](_0x2b5f6e),{'individualHooks':!![]});}})['then'](function(){if(_0x586333){return _0x586333[_0x0057('0x2c')]({'online':!![],'lastLoginAt':moment()[_0x0057('0x2f')](_0x0057('0x36')),'voicePause':_0x586333[_0x0057('0x51')]||![],'mailPause':_0x586333['loginInPause']||![],'chatPause':_0x586333[_0x0057('0x51')]||![],'faxPause':_0x586333[_0x0057('0x51')]||![],'smsPause':_0x586333[_0x0057('0x51')]||![],'openchannelPause':_0x586333['loginInPause']||![],'pauseType':_0x586333['loginInPause']?_0x0057('0x5b'):null,'lastPauseAt':moment()[_0x0057('0x2f')](_0x0057('0x36')),'interface':_0xda34f5});}})[_0x0057('0x11')](function(_0x58adf8){_0x336649(_0x58adf8);})['catch'](function(_0x45612b){_0x178392(_0x1321f9[_0x0057('0x16')](0x1f4,_0x45612b[_0x0057('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 458954e..f6e03db 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 _0x87cd=['register','length','user:','./user.events','save','remove','update','emit','removeListener'];(function(_0x218cae,_0x259604){var _0x1a26f4=function(_0x234f53){while(--_0x234f53){_0x218cae['push'](_0x218cae['shift']());}};_0x1a26f4(++_0x259604);}(_0x87cd,0x1aa));var _0xd87c=function(_0x338762,_0x296dbf){_0x338762=_0x338762-0x0;var _0x5960d2=_0x87cd[_0x338762];return _0x5960d2;};'use strict';var UserEvents=require(_0xd87c('0x0'));var events=[_0xd87c('0x1'),_0xd87c('0x2'),_0xd87c('0x3')];function createListener(_0x44c8d5,_0x1ae3dc){return function(_0x595579){_0x1ae3dc[_0xd87c('0x4')](_0x44c8d5,_0x595579);};}function removeListener(_0x25cd16,_0x4e84cf){return function(){UserEvents[_0xd87c('0x5')](_0x25cd16,_0x4e84cf);};}exports[_0xd87c('0x6')]=function(_0x5df8fc){for(var _0x2d5f1c=0x0,_0x175eb4=events[_0xd87c('0x7')];_0x2d5f1c<_0x175eb4;_0x2d5f1c++){var _0x36e47d=events[_0x2d5f1c];var _0x59bf91=createListener(_0xd87c('0x8')+_0x36e47d,_0x5df8fc);UserEvents['on'](_0x36e47d,_0x59bf91);}}; \ No newline at end of file +var _0x605e=['emit','removeListener','register','length','user:','./user.events','save','remove','update'];(function(_0x5ecfce,_0x3f2740){var _0x18e4ca=function(_0x1b5e0f){while(--_0x1b5e0f){_0x5ecfce['push'](_0x5ecfce['shift']());}};_0x18e4ca(++_0x3f2740);}(_0x605e,0x19a));var _0xe605=function(_0x32ba82,_0x15b38e){_0x32ba82=_0x32ba82-0x0;var _0x244688=_0x605e[_0x32ba82];return _0x244688;};'use strict';var UserEvents=require(_0xe605('0x0'));var events=[_0xe605('0x1'),_0xe605('0x2'),_0xe605('0x3')];function createListener(_0x1534db,_0x47d0d8){return function(_0x304f57){_0x47d0d8[_0xe605('0x4')](_0x1534db,_0x304f57);};}function removeListener(_0x11dd93,_0x32e016){return function(){UserEvents[_0xe605('0x5')](_0x11dd93,_0x32e016);};}exports[_0xe605('0x6')]=function(_0x2d66ff){for(var _0x5bea95=0x0,_0x391198=events[_0xe605('0x7')];_0x5bea95<_0x391198;_0x5bea95++){var _0x45b535=events[_0x5bea95];var _0x3cf365=createListener(_0xe605('0x8')+_0x45b535,_0x2d66ff);UserEvents['on'](_0x45b535,_0x3cf365);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 04a8dae..e617435 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 _0xf388=['../../config/environment','exports','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf388,0x128));var _0x8f38=function(_0x56bf8b,_0x3121ec){_0x56bf8b=_0x56bf8b-0x0;var _0x55f89b=_0xf388[_0x56bf8b];return _0x55f89b;};'use strict';var multer=require('multer');var util=require(_0x8f38('0x0'));var path=require('path');var timeout=require(_0x8f38('0x1'));var express=require(_0x8f38('0x2'));var router=express[_0x8f38('0x3')]();var auth=require(_0x8f38('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8f38('0x5'));module[_0x8f38('0x6')]=router; \ No newline at end of file +var _0x5902=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5902,0x187));var _0x2590=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5902[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x2590('0x0'));var util=require('util');var path=require(_0x2590('0x1'));var timeout=require(_0x2590('0x2'));var express=require('express');var router=express[_0x2590('0x3')]();var auth=require(_0x2590('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2590('0x5'));module[_0x2590('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index c1dfe9c..e6549af 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x3220b5,_0x589222){var _0x56f180=function(_0x55d184){while(--_0x55d184){_0x3220b5['push'](_0x3220b5['shift']());}};_0x56f180(++_0x589222);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0xf4fee8,_0x5951ce){var _0x1303d7=function(_0x56e749){while(--_0x56e749){_0xf4fee8['push'](_0xf4fee8['shift']());}};_0x1303d7(++_0x5951ce);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 f7798fc..678201d 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 _0x547e=['exports','define','user_has_chat_queues','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2ad1b6,_0x4ecf4b){var _0x1b0b6=function(_0xb6cf2a){while(--_0xb6cf2a){_0x2ad1b6['push'](_0x2ad1b6['shift']());}};_0x1b0b6(++_0x4ecf4b);}(_0x547e,0xfd));var _0xe547=function(_0x25b810,_0x1ecc5c){_0x25b810=_0x25b810-0x0;var _0xf7bfd7=_0x547e[_0x25b810];return _0xf7bfd7;};'use strict';var _=require(_0xe547('0x0'));var util=require('util');var logger=require(_0xe547('0x1'))(_0xe547('0x2'));var moment=require('moment');var BPromise=require(_0xe547('0x3'));var rp=require(_0xe547('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe547('0x5'));var config=require(_0xe547('0x6'));var attributes=require('./userChatQueue.attributes');module[_0xe547('0x7')]=function(_0x509e25,_0x230ce4){return _0x509e25[_0xe547('0x8')]('UserChatQueue',attributes,{'tableName':_0xe547('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbddb=['api','moment','bluebird','request-promise','path','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','util'];(function(_0x666c12,_0x34353e){var _0x42be36=function(_0x21a9f6){while(--_0x21a9f6){_0x666c12['push'](_0x666c12['shift']());}};_0x42be36(++_0x34353e);}(_0xbddb,0x11d));var _0xbbdd=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xbddb[_0x3ab51d];return _0x29a04e;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 2df630e..2994a72 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 _0xb8ca=['request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s'];(function(_0x5eb702,_0xae7299){var _0x2fc2c6=function(_0x2a0d45){while(--_0x2a0d45){_0x5eb702['push'](_0x5eb702['shift']());}};_0x2fc2c6(++_0xae7299);}(_0xb8ca,0x1d0));var _0xab8c=function(_0x83ab1a,_0x206fd1){_0x83ab1a=_0x83ab1a-0x0;var _0x269739=_0xb8ca[_0x83ab1a];return _0x269739;};'use strict';var _=require(_0xab8c('0x0'));var util=require(_0xab8c('0x1'));var moment=require('moment');var BPromise=require(_0xab8c('0x2'));var rs=require(_0xab8c('0x3'));var fs=require('fs');var Redis=require(_0xab8c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xab8c('0x5'));var logger=require(_0xab8c('0x6'))(_0xab8c('0x7'));var config=require(_0xab8c('0x8'));var jayson=require(_0xab8c('0x9'));var client=jayson[_0xab8c('0xa')][_0xab8c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6f8266,_0x333af1,_0x3c30fe){return new BPromise(function(_0x5fdb28,_0x426e00){return client[_0xab8c('0xc')](_0x6f8266,_0x3c30fe)[_0xab8c('0xd')](function(_0x13eb06){logger[_0xab8c('0xe')](_0xab8c('0xf'),_0x333af1,_0xab8c('0x10'));logger[_0xab8c('0x11')](_0xab8c('0x12'),_0x333af1,_0xab8c('0x10'),JSON[_0xab8c('0x13')](_0x13eb06));if(_0x13eb06['error']){if(_0x13eb06[_0xab8c('0x14')][_0xab8c('0x15')]===0x1f4){logger[_0xab8c('0x14')]('UserChatQueue,\x20%s,\x20%s',_0x333af1,_0x13eb06[_0xab8c('0x14')][_0xab8c('0x16')]);return _0x426e00(_0x13eb06[_0xab8c('0x14')][_0xab8c('0x16')]);}logger[_0xab8c('0x14')]('UserChatQueue,\x20%s,\x20%s',_0x333af1,_0x13eb06[_0xab8c('0x14')][_0xab8c('0x16')]);return _0x5fdb28(_0x13eb06[_0xab8c('0x14')][_0xab8c('0x16')]);}else{logger[_0xab8c('0xe')](_0xab8c('0xf'),_0x333af1,'request\x20sent');_0x5fdb28(_0x13eb06[_0xab8c('0x17')]['message']);}})['catch'](function(_0x4fc8d9){logger[_0xab8c('0x14')](_0xab8c('0xf'),_0x333af1,_0x4fc8d9);_0x426e00(_0x4fc8d9);});});} \ No newline at end of file +var _0x87d0=['error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1b8e60,_0x21b885){var _0x363363=function(_0x5987c7){while(--_0x5987c7){_0x1b8e60['push'](_0x1b8e60['shift']());}};_0x363363(++_0x21b885);}(_0x87d0,0x1a7));var _0x087d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x87d0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x087d('0x0'));var util=require(_0x087d('0x1'));var moment=require(_0x087d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x087d('0x3'));var db=require(_0x087d('0x4'))['db'];var utils=require(_0x087d('0x5'));var logger=require(_0x087d('0x6'))(_0x087d('0x7'));var config=require('../../config/environment');var jayson=require(_0x087d('0x8'));var client=jayson['client'][_0x087d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4967ce,_0x1a9b78,_0x286bf1){return new BPromise(function(_0x295086,_0x112eaf){return client['request'](_0x4967ce,_0x286bf1)[_0x087d('0xa')](function(_0x290817){logger[_0x087d('0xb')](_0x087d('0xc'),_0x1a9b78,_0x087d('0xd'));logger[_0x087d('0xe')](_0x087d('0xf'),_0x1a9b78,'request\x20sent',JSON[_0x087d('0x10')](_0x290817));if(_0x290817[_0x087d('0x11')]){if(_0x290817[_0x087d('0x11')][_0x087d('0x12')]===0x1f4){logger[_0x087d('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x1a9b78,_0x290817['error']['message']);return _0x112eaf(_0x290817[_0x087d('0x11')]['message']);}logger[_0x087d('0x11')](_0x087d('0xc'),_0x1a9b78,_0x290817['error'][_0x087d('0x13')]);return _0x295086(_0x290817[_0x087d('0x11')][_0x087d('0x13')]);}else{logger[_0x087d('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x1a9b78,_0x087d('0xd'));_0x295086(_0x290817[_0x087d('0x14')]['message']);}})[_0x087d('0x15')](function(_0x2abeca){logger[_0x087d('0x11')](_0x087d('0xc'),_0x1a9b78,_0x2abeca);_0x112eaf(_0x2abeca);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 31e8b1c..4384d05 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 _0x08e8=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports','multer','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x08e8,0x166));var _0x808e=function(_0x1bc8ce,_0x3f9584){_0x1bc8ce=_0x1bc8ce-0x0;var _0x3cdc20=_0x08e8[_0x1bc8ce];return _0x3cdc20;};'use strict';var multer=require(_0x808e('0x0'));var util=require('util');var path=require(_0x808e('0x1'));var timeout=require(_0x808e('0x2'));var express=require(_0x808e('0x3'));var router=express[_0x808e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x808e('0x5'));var config=require(_0x808e('0x6'));module[_0x808e('0x7')]=router; \ No newline at end of file +var _0x3bac=['express','Router','../../config/environment','exports','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3bac,0xa4));var _0xc3ba=function(_0x3060e3,_0x14f2c6){_0x3060e3=_0x3060e3-0x0;var _0x497d2c=_0x3bac[_0x3060e3];return _0x497d2c;};'use strict';var multer=require('multer');var util=require(_0xc3ba('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc3ba('0x1'));var router=express[_0xc3ba('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc3ba('0x3'));module[_0xc3ba('0x4')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index e61b57d..dac111f 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 _0x087b=['sequelize','exports','STRING'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x087b,0x11a));var _0xb087=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0x087b[_0x22b68a];return _0x1ac67a;};'use strict';var Sequelize=require(_0xb087('0x0'));module[_0xb087('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xb087('0x2')]}}; \ No newline at end of file +var _0x9c00=['exports','STRING','sequelize'];(function(_0x561854,_0x414a2d){var _0x157589=function(_0x4a7c87){while(--_0x4a7c87){_0x561854['push'](_0x561854['shift']());}};_0x157589(++_0x414a2d);}(_0x9c00,0x1a0));var _0x09c0=function(_0x35fb56,_0x5dadff){_0x35fb56=_0x35fb56-0x0;var _0x2fd52c=_0x9c00[_0x35fb56];return _0x2fd52c;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x09c0('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index b64a9fb..5805018 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 _0xcc8f=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','lodash'];(function(_0x2d947d,_0x1ecde4){var _0x385604=function(_0x76f735){while(--_0x76f735){_0x2d947d['push'](_0x2d947d['shift']());}};_0x385604(++_0x1ecde4);}(_0xcc8f,0x10d));var _0xfcc8=function(_0x21c9a4,_0x55f70c){_0x21c9a4=_0x21c9a4-0x0;var _0x34818a=_0xcc8f[_0x21c9a4];return _0x34818a;};'use strict';var _=require(_0xfcc8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfcc8('0x1'));var moment=require(_0xfcc8('0x2'));var BPromise=require('bluebird');var rp=require(_0xfcc8('0x3'));var fs=require('fs');var path=require(_0xfcc8('0x4'));var rimraf=require(_0xfcc8('0x5'));var config=require(_0xfcc8('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0xfcc8('0x7')]=function(_0x133f37,_0x338be0){return _0x133f37[_0xfcc8('0x8')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2138=['../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x564b7f,_0x162734){var _0x194ae6=function(_0x25fe6b){while(--_0x25fe6b){_0x564b7f['push'](_0x564b7f['shift']());}};_0x194ae6(++_0x162734);}(_0x2138,0x18b));var _0x8213=function(_0x659112,_0x226301){_0x659112=_0x659112-0x0;var _0xb3aaa2=_0x2138[_0x659112];return _0xb3aaa2;};'use strict';var _=require('lodash');var util=require(_0x8213('0x0'));var logger=require(_0x8213('0x1'))(_0x8213('0x2'));var moment=require(_0x8213('0x3'));var BPromise=require(_0x8213('0x4'));var rp=require(_0x8213('0x5'));var fs=require('fs');var path=require(_0x8213('0x6'));var rimraf=require(_0x8213('0x7'));var config=require(_0x8213('0x8'));var attributes=require(_0x8213('0x9'));module[_0x8213('0xa')]=function(_0x1c35c0,_0x39cfcd){return _0x1c35c0[_0x8213('0xb')]('UserFaxQueue',attributes,{'tableName':_0x8213('0xc'),'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 cec4333..51ab080 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 _0x605a=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x38435a,_0x4ba3fe){var _0x39f2dc=function(_0x5e46c3){while(--_0x5e46c3){_0x38435a['push'](_0x38435a['shift']());}};_0x39f2dc(++_0x4ba3fe);}(_0x605a,0x1d7));var _0xa605=function(_0x119865,_0x2f09b3){_0x119865=_0x119865-0x0;var _0x588022=_0x605a[_0x119865];return _0x588022;};'use strict';var _=require(_0xa605('0x0'));var util=require('util');var moment=require(_0xa605('0x1'));var BPromise=require(_0xa605('0x2'));var rs=require(_0xa605('0x3'));var fs=require('fs');var Redis=require(_0xa605('0x4'));var db=require(_0xa605('0x5'))['db'];var utils=require(_0xa605('0x6'));var logger=require(_0xa605('0x7'))(_0xa605('0x8'));var config=require(_0xa605('0x9'));var jayson=require(_0xa605('0xa'));var client=jayson[_0xa605('0xb')][_0xa605('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5bf362,_0x4c300e,_0x3573f5){return new BPromise(function(_0xe23170,_0x243d8d){return client[_0xa605('0xd')](_0x5bf362,_0x3573f5)[_0xa605('0xe')](function(_0x15f775){logger[_0xa605('0xf')](_0xa605('0x10'),_0x4c300e,_0xa605('0x11'));logger[_0xa605('0x12')](_0xa605('0x13'),_0x4c300e,_0xa605('0x11'),JSON[_0xa605('0x14')](_0x15f775));if(_0x15f775[_0xa605('0x15')]){if(_0x15f775[_0xa605('0x15')][_0xa605('0x16')]===0x1f4){logger[_0xa605('0x15')](_0xa605('0x10'),_0x4c300e,_0x15f775[_0xa605('0x15')]['message']);return _0x243d8d(_0x15f775[_0xa605('0x15')][_0xa605('0x17')]);}logger['error'](_0xa605('0x10'),_0x4c300e,_0x15f775[_0xa605('0x15')][_0xa605('0x17')]);return _0xe23170(_0x15f775[_0xa605('0x15')][_0xa605('0x17')]);}else{logger[_0xa605('0xf')](_0xa605('0x10'),_0x4c300e,_0xa605('0x11'));_0xe23170(_0x15f775[_0xa605('0x18')]['message']);}})[_0xa605('0x19')](function(_0x32c75e){logger[_0xa605('0x15')](_0xa605('0x10'),_0x4c300e,_0x32c75e);_0x243d8d(_0x32c75e);});});} \ No newline at end of file +var _0x6f12=['../../config/utils','../../config/logger','rpc','../../config/environment','client','info','UserFaxQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6f12,0x86));var _0x26f1=function(_0x4bbc76,_0x9401ed){_0x4bbc76=_0x4bbc76-0x0;var _0x228f3b=_0x6f12[_0x4bbc76];return _0x228f3b;};'use strict';var _=require(_0x26f1('0x0'));var util=require('util');var moment=require(_0x26f1('0x1'));var BPromise=require(_0x26f1('0x2'));var rs=require(_0x26f1('0x3'));var fs=require('fs');var Redis=require(_0x26f1('0x4'));var db=require(_0x26f1('0x5'))['db'];var utils=require(_0x26f1('0x6'));var logger=require(_0x26f1('0x7'))(_0x26f1('0x8'));var config=require(_0x26f1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x26f1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa5c21d,_0x2da597,_0x5047d8){return new BPromise(function(_0x43f47d,_0x4883ad){return client['request'](_0xa5c21d,_0x5047d8)['then'](function(_0x245122){logger[_0x26f1('0xb')](_0x26f1('0xc'),_0x2da597,'request\x20sent');logger[_0x26f1('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x2da597,_0x26f1('0xe'),JSON[_0x26f1('0xf')](_0x245122));if(_0x245122['error']){if(_0x245122[_0x26f1('0x10')]['code']===0x1f4){logger[_0x26f1('0x10')](_0x26f1('0xc'),_0x2da597,_0x245122[_0x26f1('0x10')][_0x26f1('0x11')]);return _0x4883ad(_0x245122['error'][_0x26f1('0x11')]);}logger[_0x26f1('0x10')](_0x26f1('0xc'),_0x2da597,_0x245122[_0x26f1('0x10')][_0x26f1('0x11')]);return _0x43f47d(_0x245122[_0x26f1('0x10')]['message']);}else{logger['info'](_0x26f1('0xc'),_0x2da597,_0x26f1('0xe'));_0x43f47d(_0x245122[_0x26f1('0x12')][_0x26f1('0x11')]);}})[_0x26f1('0x13')](function(_0x16989){logger[_0x26f1('0x10')](_0x26f1('0xc'),_0x2da597,_0x16989);_0x4883ad(_0x16989);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 7d5a6ed..c8d7d82 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 _0xc497=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports','multer'];(function(_0x34ebc6,_0x201e65){var _0x16f800=function(_0x2c72fc){while(--_0x2c72fc){_0x34ebc6['push'](_0x34ebc6['shift']());}};_0x16f800(++_0x201e65);}(_0xc497,0xa7));var _0x7c49=function(_0x457e36,_0xc54fe7){_0x457e36=_0x457e36-0x0;var _0x374968=_0xc497[_0x457e36];return _0x374968;};'use strict';var multer=require(_0x7c49('0x0'));var util=require(_0x7c49('0x1'));var path=require('path');var timeout=require(_0x7c49('0x2'));var express=require(_0x7c49('0x3'));var router=express[_0x7c49('0x4')]();var auth=require(_0x7c49('0x5'));var interaction=require(_0x7c49('0x6'));var config=require('../../config/environment');module[_0x7c49('0x7')]=router; \ No newline at end of file +var _0xd028=['../../config/environment','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x25b4a4,_0x2e081b){var _0x707267=function(_0x440123){while(--_0x440123){_0x25b4a4['push'](_0x25b4a4['shift']());}};_0x707267(++_0x2e081b);}(_0xd028,0x105));var _0x8d02=function(_0x579f9a,_0x49758b){_0x579f9a=_0x579f9a-0x0;var _0x1fc3ed=_0xd028[_0x579f9a];return _0x1fc3ed;};'use strict';var multer=require('multer');var util=require(_0x8d02('0x0'));var path=require(_0x8d02('0x1'));var timeout=require(_0x8d02('0x2'));var express=require('express');var router=express[_0x8d02('0x3')]();var auth=require(_0x8d02('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8d02('0x5'));module[_0x8d02('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index bc6d2e0..b978d3b 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x25e084,_0x74a28){var _0x54e3de=function(_0x5ba075){while(--_0x5ba075){_0x25e084['push'](_0x25e084['shift']());}};_0x54e3de(++_0x74a28);}(_0xe706,0xa3));var _0x6e70=function(_0x25948f,_0x4ac7e4){_0x25948f=_0x25948f-0x0;var _0x2b1976=_0xe706[_0x25948f];return _0x2b1976;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x3a21c0,_0x348451){var _0x411e84=function(_0xdd7b02){while(--_0xdd7b02){_0x3a21c0['push'](_0x3a21c0['shift']());}};_0x411e84(++_0x348451);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'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 3e655d9..ec92de0 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 _0x2032=['user_has_mail_queues','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0x54f9b5,_0x14e644){var _0x15dcf2=function(_0x5cea38){while(--_0x5cea38){_0x54f9b5['push'](_0x54f9b5['shift']());}};_0x15dcf2(++_0x14e644);}(_0x2032,0xd9));var _0x2203=function(_0x41bf92,_0xdd2fc0){_0x41bf92=_0x41bf92-0x0;var _0xbab9a6=_0x2032[_0x41bf92];return _0xbab9a6;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','user_has_mail_queues','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5d0183,_0xeeed3e){var _0x488220=function(_0x4ba252){while(--_0x4ba252){_0x5d0183['push'](_0x5d0183['shift']());}};_0x488220(++_0xeeed3e);}(_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('./userMailQueue.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('UserMailQueue',attributes,{'tableName':_0x0d8b('0x8'),'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 18c9da2..29f9850 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 _0x4540=['catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','UserMailQueue,\x20%s,\x20%s','message'];(function(_0xfe5b9d,_0x2fcc61){var _0x55d39a=function(_0x30dc78){while(--_0x30dc78){_0xfe5b9d['push'](_0xfe5b9d['shift']());}};_0x55d39a(++_0x2fcc61);}(_0x4540,0x17b));var _0x0454=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4540[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0454('0x0'));var util=require(_0x0454('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0454('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0454('0x3'));var logger=require(_0x0454('0x4'))(_0x0454('0x5'));var config=require(_0x0454('0x6'));var jayson=require(_0x0454('0x7'));var client=jayson[_0x0454('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b4ecd,_0x4b8beb,_0x250036){return new BPromise(function(_0x546c14,_0x17cd35){return client['request'](_0x3b4ecd,_0x250036)[_0x0454('0x9')](function(_0xbc201a){logger[_0x0454('0xa')]('UserMailQueue,\x20%s,\x20%s',_0x4b8beb,_0x0454('0xb'));logger[_0x0454('0xc')](_0x0454('0xd'),_0x4b8beb,_0x0454('0xb'),JSON['stringify'](_0xbc201a));if(_0xbc201a[_0x0454('0xe')]){if(_0xbc201a[_0x0454('0xe')]['code']===0x1f4){logger['error'](_0x0454('0xf'),_0x4b8beb,_0xbc201a[_0x0454('0xe')]['message']);return _0x17cd35(_0xbc201a[_0x0454('0xe')]['message']);}logger[_0x0454('0xe')](_0x0454('0xf'),_0x4b8beb,_0xbc201a[_0x0454('0xe')][_0x0454('0x10')]);return _0x546c14(_0xbc201a[_0x0454('0xe')][_0x0454('0x10')]);}else{logger[_0x0454('0xa')](_0x0454('0xf'),_0x4b8beb,_0x0454('0xb'));_0x546c14(_0xbc201a['result'][_0x0454('0x10')]);}})[_0x0454('0x11')](function(_0x3d97ec){logger[_0x0454('0xe')](_0x0454('0xf'),_0x4b8beb,_0x3d97ec);_0x17cd35(_0x3d97ec);});});} \ No newline at end of file +var _0x6dac=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6dac,0x16e));var _0xc6da=function(_0x38361b,_0x35fdee){_0x38361b=_0x38361b-0x0;var _0x117b1d=_0x6dac[_0x38361b];return _0x117b1d;};'use strict';var _=require(_0xc6da('0x0'));var util=require(_0xc6da('0x1'));var moment=require(_0xc6da('0x2'));var BPromise=require(_0xc6da('0x3'));var rs=require(_0xc6da('0x4'));var fs=require('fs');var Redis=require(_0xc6da('0x5'));var db=require(_0xc6da('0x6'))['db'];var utils=require(_0xc6da('0x7'));var logger=require(_0xc6da('0x8'))(_0xc6da('0x9'));var config=require(_0xc6da('0xa'));var jayson=require(_0xc6da('0xb'));var client=jayson[_0xc6da('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ebd11,_0x1abd90,_0x5a0d8d){return new BPromise(function(_0x3047d3,_0x2bfaa6){return client[_0xc6da('0xd')](_0x1ebd11,_0x5a0d8d)[_0xc6da('0xe')](function(_0x39a8d8){logger[_0xc6da('0xf')]('UserMailQueue,\x20%s,\x20%s',_0x1abd90,_0xc6da('0x10'));logger[_0xc6da('0x11')](_0xc6da('0x12'),_0x1abd90,_0xc6da('0x10'),JSON[_0xc6da('0x13')](_0x39a8d8));if(_0x39a8d8[_0xc6da('0x14')]){if(_0x39a8d8[_0xc6da('0x14')][_0xc6da('0x15')]===0x1f4){logger[_0xc6da('0x14')](_0xc6da('0x16'),_0x1abd90,_0x39a8d8[_0xc6da('0x14')][_0xc6da('0x17')]);return _0x2bfaa6(_0x39a8d8[_0xc6da('0x14')]['message']);}logger[_0xc6da('0x14')](_0xc6da('0x16'),_0x1abd90,_0x39a8d8[_0xc6da('0x14')][_0xc6da('0x17')]);return _0x3047d3(_0x39a8d8[_0xc6da('0x14')][_0xc6da('0x17')]);}else{logger['info'](_0xc6da('0x16'),_0x1abd90,_0xc6da('0x10'));_0x3047d3(_0x39a8d8[_0xc6da('0x18')][_0xc6da('0x17')]);}})[_0xc6da('0x19')](function(_0x5463a1){logger[_0xc6da('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x1abd90,_0x5463a1);_0x2bfaa6(_0x5463a1);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 0757480..ffb772f 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 _0x8642=['../../components/auth/service','../../components/interaction/service','../../config/environment','post','sendUserNotification','exports','path'];(function(_0x4ed360,_0x42fd38){var _0x49918b=function(_0x40e60e){while(--_0x40e60e){_0x4ed360['push'](_0x4ed360['shift']());}};_0x49918b(++_0x42fd38);}(_0x8642,0x179));var _0x2864=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0x8642[_0x492535];return _0x256620;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2864('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x2864('0x1'));var interaction=require(_0x2864('0x2'));var config=require(_0x2864('0x3'));var controller=require('./userNotification.controller');router[_0x2864('0x4')]('/',auth['isAuthenticated'](),controller[_0x2864('0x5')]);module[_0x2864('0x6')]=router; \ No newline at end of file +var _0x9188=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports','util','path','connect-timeout','express'];(function(_0x2b63a0,_0x14fc48){var _0x4f0434=function(_0x8cba9e){while(--_0x8cba9e){_0x2b63a0['push'](_0x2b63a0['shift']());}};_0x4f0434(++_0x14fc48);}(_0x9188,0x8c));var _0x8918=function(_0x58f23d,_0x269aad){_0x58f23d=_0x58f23d-0x0;var _0x11045a=_0x9188[_0x58f23d];return _0x11045a;};'use strict';var multer=require('multer');var util=require(_0x8918('0x0'));var path=require(_0x8918('0x1'));var timeout=require(_0x8918('0x2'));var express=require(_0x8918('0x3'));var router=express[_0x8918('0x4')]();var auth=require(_0x8918('0x5'));var interaction=require(_0x8918('0x6'));var config=require(_0x8918('0x7'));var controller=require('./userNotification.controller');router[_0x8918('0x8')]('/',auth[_0x8918('0x9')](),controller[_0x8918('0xa')]);module[_0x8918('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 57b9b59..8360c12 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 _0xd2f5=['exports','TEXT','STRING','sequelize'];(function(_0x291023,_0x412e96){var _0xd5fcda=function(_0x4fd7e2){while(--_0x4fd7e2){_0x291023['push'](_0x291023['shift']());}};_0xd5fcda(++_0x412e96);}(_0xd2f5,0x17f));var _0x5d2f=function(_0x53f9df,_0x43449a){_0x53f9df=_0x53f9df-0x0;var _0x3d9705=_0xd2f5[_0x53f9df];return _0x3d9705;};'use strict';var Sequelize=require(_0x5d2f('0x0'));module[_0x5d2f('0x1')]={'body':{'type':Sequelize[_0x5d2f('0x2')]},'senderName':{'type':Sequelize[_0x5d2f('0x3')]},'recipientsId':{'type':Sequelize[_0x5d2f('0x2')]},'recipientsDescription':{'type':Sequelize[_0x5d2f('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x770e=['TEXT','STRING','BOOLEAN','exports'];(function(_0x362eab,_0x1dcf02){var _0x1e1e32=function(_0x341ecc){while(--_0x341ecc){_0x362eab['push'](_0x362eab['shift']());}};_0x1e1e32(++_0x1dcf02);}(_0x770e,0xf7));var _0xe770=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x770e[_0x125ff8];return _0x2d9ef;};'use strict';var Sequelize=require('sequelize');module[_0xe770('0x0')]={'body':{'type':Sequelize[_0xe770('0x1')]},'senderName':{'type':Sequelize[_0xe770('0x2')]},'recipientsId':{'type':Sequelize[_0xe770('0x1')]},'recipientsDescription':{'type':Sequelize[_0xe770('0x2')]},'beep':{'type':Sequelize[_0xe770('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 34e1faa..9842aad 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 _0x9024=['Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','recipientsId','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','User','union','queue','ids','push','all','flatten','map','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','error','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError'];(function(_0x16b574,_0x1386b9){var _0x206f82=function(_0x73de42){while(--_0x73de42){_0x16b574['push'](_0x16b574['shift']());}};_0x206f82(++_0x1386b9);}(_0x9024,0x159));var _0x4902=function(_0x4ec072,_0x43eb7a){_0x4ec072=_0x4ec072-0x0;var _0x25a1a5=_0x9024[_0x4ec072];return _0x25a1a5;};'use strict';var pdf=require(_0x4902('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4902('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4902('0x2'));var rp=require(_0x4902('0x3'));var moment=require(_0x4902('0x4'));var BPromise=require(_0x4902('0x5'));var Mustache=require(_0x4902('0x6'));var util=require(_0x4902('0x7'));var path=require(_0x4902('0x8'));var sox=require(_0x4902('0x9'));var csv=require(_0x4902('0xa'));var ejs=require(_0x4902('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4902('0xc'));var crypto=require(_0x4902('0xd'));var jsforce=require(_0x4902('0xe'));var deskjs=require(_0x4902('0xf'));var toCsv=require(_0x4902('0xa'));var querystring=require(_0x4902('0x10'));var Papa=require(_0x4902('0x11'));var Redis=require('ioredis');var authService=require(_0x4902('0x12'));var qs=require(_0x4902('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4902('0x14'));var logger=require(_0x4902('0x15'))('api');var utils=require(_0x4902('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4902('0x17'))['db'];config['redis']=_[_0x4902('0x18')](config[_0x4902('0x19')],{'host':_0x4902('0x1a'),'port':0x18eb});var socket=require(_0x4902('0x1b'))(new Redis(config['redis']));require(_0x4902('0x1c'))[_0x4902('0x1d')](socket);function respondWithStatusCode(_0xaa98b5,_0x8f76cb){_0x8f76cb=_0x8f76cb||0xcc;return function(_0x3c65aa){if(_0x3c65aa){return _0xaa98b5[_0x4902('0x1e')](_0x8f76cb);}return _0xaa98b5[_0x4902('0x1f')](_0x8f76cb)[_0x4902('0x20')]();};}function respondWithResult(_0x4984ac,_0x3c5def){_0x3c5def=_0x3c5def||0xc8;return function(_0x39d050){if(_0x39d050){return _0x4984ac[_0x4902('0x1f')](_0x3c5def)[_0x4902('0x21')](_0x39d050);}};}function respondWithFilteredResult(_0x520726,_0x4aefff){return function(_0x3d6fc7){if(_0x3d6fc7){var _0x3f7d9d=_0x3d6fc7[_0x4902('0x22')],_0x2a6e93=_0x4aefff['offset'],_0x32069=_0x4aefff[_0x4902('0x23')]+_0x4aefff[_0x4902('0x24')],_0x2252cf;if(_0x32069>=_0x3f7d9d){_0x32069=_0x3f7d9d;_0x2252cf=0xc8;}else{_0x2252cf=0xce;}_0x520726[_0x4902('0x1f')](_0x2252cf);return _0x520726[_0x4902('0x25')]('Content-Range',_0x2a6e93+'-'+_0x32069+'/'+_0x3f7d9d)[_0x4902('0x21')](_0x3d6fc7);}return null;};}function patchUpdates(_0x29e74d){return function(_0x4acd24){try{jsonpatch[_0x4902('0x26')](_0x4acd24,_0x29e74d,!![]);}catch(_0x5dae49){return BPromise[_0x4902('0x27')](_0x5dae49);}return _0x4acd24['save']();};}function saveUpdates(_0x5f3f08,_0x506b05){return function(_0x166250){if(_0x166250){return _0x166250[_0x4902('0x28')](_0x5f3f08)[_0x4902('0x29')](function(_0x209cdc){return _0x209cdc;});}return null;};}function removeEntity(_0x1edf21,_0x37f1de){return function(_0x48b31f){if(_0x48b31f){return _0x48b31f[_0x4902('0x2a')]()[_0x4902('0x29')](function(){_0x1edf21['status'](0xcc)[_0x4902('0x20')]();});}};}function handleEntityNotFound(_0x46b6de,_0xc705f0){return function(_0x4cf57c){if(!_0x4cf57c){_0x46b6de[_0x4902('0x1e')](0x194);}return _0x4cf57c;};}function handleError(_0xdccde2,_0x5a2914){_0x5a2914=_0x5a2914||0x1f4;return function(_0x312352){logger[_0x4902('0x2b')](_0x312352['stack']);if(_0x312352[_0x4902('0x2c')]){delete _0x312352['name'];}_0xdccde2['status'](_0x5a2914)[_0x4902('0x2d')](_0x312352);};}exports[_0x4902('0x2e')]=function(_0x2b43ab,_0xada5ea,_0x380f5c){if(!_0x2b43ab[_0x4902('0x2f')][_0x4902('0x30')](_0x4902('0x31'))&&!_0x2b43ab[_0x4902('0x2f')][_0x4902('0x30')](_0x4902('0x32'))){throw new db[(_0x4902('0x33'))]['ValidationError'](_0x4902('0x34'));}else{if(_0x2b43ab[_0x4902('0x2f')]['hasOwnProperty'](_0x4902('0x32'))&&!_0x2b43ab[_0x4902('0x2f')][_0x4902('0x30')](_0x4902('0x35'))){throw new db[(_0x4902('0x33'))][(_0x4902('0x36'))](_0x4902('0x37'));}if(!_0x2b43ab[_0x4902('0x2f')][_0x4902('0x30')](_0x4902('0x38'))){throw new db[(_0x4902('0x33'))]['ValidationError'](_0x4902('0x39'));}else{try{var _0x2435bb=JSON[_0x4902('0x3a')](_0x2b43ab[_0x4902('0x2f')]['recipients']);}catch(_0x43911e){logger[_0x4902('0x2b')](_0x43911e);throw new db['Sequelize'][(_0x4902('0x36'))](_0x4902('0x3b'));}var _0x30b5cd=[_0x4902('0x3c'),'faxqueue',_0x4902('0x3d'),'openchannelqueue',_0x4902('0x3e'),_0x4902('0x3f'),_0x4902('0x40'),'team',_0x4902('0x41')];if(_[_0x4902('0x42')](_0x2435bb,function(_0x26d4dd){return!_[_0x4902('0x43')](_0x30b5cd,_0x26d4dd[_0x4902('0x44')][_0x4902('0x45')]());})){throw new db[(_0x4902('0x33'))]['ValidationError'](_0x4902('0x46'));}}}var _0x141cc2={};_0x141cc2[_0x4902('0x47')]=_0x2b43ab['body'][_0x4902('0x30')](_0x4902('0x47'))?_0x2b43ab['body'][_0x4902('0x47')]:_0x2b43ab[_0x4902('0x41')][_0x4902('0x48')];_0x141cc2['recipientsDescription']=_[_0x4902('0x49')](_0x2b43ab[_0x4902('0x2f')]['recipientsDescription'])?null:_0x2b43ab[_0x4902('0x2f')][_0x4902('0x4a')];_0x141cc2['beep']=_0x2b43ab[_0x4902('0x2f')][_0x4902('0x4b')]||![];_0x141cc2['SenderId']=_0x2b43ab[_0x4902('0x41')]['id'];return getContent(_0x2b43ab[_0x4902('0x2f')])[_0x4902('0x29')](function(_0x4e60ba){_0x141cc2[_0x4902('0x2f')]=_0x4e60ba;return getRecipients(_0x2435bb);})[_0x4902('0x29')](function(_0x5b54e4){_0x141cc2[_0x4902('0x4c')]=_['sortBy'](_0x5b54e4)[_0x4902('0x4d')](',');return db[_0x4902('0x4e')][_0x4902('0x4f')](function(_0x2c48d3){return db[_0x4902('0x50')][_0x4902('0x51')](_0x141cc2,{'raw':!![],'transaction':_0x2c48d3})[_0x4902('0x29')](function(_0x1acac5){var _0x346a0c={'sender':_0x141cc2[_0x4902('0x47')],'description':_0x141cc2['recipientsDescription'],'content':_0x141cc2[_0x4902('0x2f')],'beep':_0x141cc2[_0x4902('0x4b')]};_0x5b54e4[_0x4902('0x52')](function(_0x10c1b4){_0x346a0c[_0x4902('0x53')]=_0x10c1b4;socket[_0x4902('0x54')](_0x4902('0x55'),_0x346a0c);});return _0x1acac5;});});})[_0x4902('0x29')](respondWithResult(_0xada5ea,0xc9))[_0x4902('0x56')](handleError(_0xada5ea,null));};function getContent(_0x5b736f){return new BPromise(function(_0x40b4dc,_0x26c26f){if(_0x5b736f[_0x4902('0x31')]){_0x40b4dc(_0x5b736f['text']);return;}return db['Template'][_0x4902('0x57')]({'attributes':['html'],'where':{'id':_0x5b736f[_0x4902('0x32')]},'raw':!![]})[_0x4902('0x29')](function(_0x3eb6c3){if(!_0x3eb6c3)throw new db['Sequelize']['ValidationError'](_0x4902('0x58'));var _0x46fe9a=Mustache[_0x4902('0x59')](_0x3eb6c3[_0x4902('0x5a')],_0x5b736f[_0x4902('0x35')]);_0x40b4dc(_0x46fe9a);})[_0x4902('0x56')](function(_0x22350b){_0x26c26f(_0x22350b);});});}function getRecipients(_0x188c80){return new BPromise(function(_0x50f5a3,_0x55d5cc){var _0x1cb502=[];var _0x4c2404=[];_0x188c80[_0x4902('0x52')](function(_0x3e1e93){var _0x5a86c3=_[_0x4902('0x5b')](_0x3e1e93['model'][_0x4902('0x45')]());if(_0x5a86c3===_0x4902('0x5c')){_0x1cb502=_[_0x4902('0x5d')](_0x1cb502,_0x3e1e93['ids']);}else{if(_[_0x4902('0x43')](_0x5a86c3,_0x4902('0x5e')))_0x5a86c3=_0x5a86c3['replace'](_0x4902('0x5e'),'Queue');_0x3e1e93[_0x4902('0x5f')][_0x4902('0x52')](function(_0x20a502){_0x4c2404[_0x4902('0x60')](getAgents(_0x5a86c3,_0x20a502));});}});return BPromise[_0x4902('0x61')](_0x4c2404)[_0x4902('0x29')](function(_0x26428a){_0x1cb502=_[_0x4902('0x5d')](_0x1cb502,_[_0x4902('0x62')](_0x26428a));_0x50f5a3(_0x1cb502);})[_0x4902('0x56')](function(_0x2c9abf){_0x55d5cc(_0x2c9abf);});});}function getAgents(_0x40dfad,_0x11dcaa){return new BPromise(function(_0x3160a8,_0x1c6cc0){return db[_0x40dfad][_0x4902('0x57')]({'where':{'id':_0x11dcaa}})[_0x4902('0x29')](function(_0x1d5cd6){return _0x1d5cd6['getAgents']({'attributes':['id'],'raw':!![]})[_0x4902('0x29')](function(_0x225b97){var _0x4ac987=_[_0x4902('0x63')](_0x225b97,'id');_0x3160a8(_0x4ac987);});})[_0x4902('0x56')](function(_0x4d2ef8){_0x1c6cc0(_0x4d2ef8);});});} \ No newline at end of file +var _0xacfa=['transaction','UserNotification','create','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','union','queue','ids','push','all','flatten','map','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','then','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','model','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xacfa,0x6e));var _0xaacf=function(_0xd5ea18,_0x44e0d8){_0xd5ea18=_0xd5ea18-0x0;var _0x447951=_0xacfa[_0xd5ea18];return _0x447951;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xaacf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaacf('0x1'));var rp=require(_0xaacf('0x2'));var moment=require('moment');var BPromise=require(_0xaacf('0x3'));var Mustache=require(_0xaacf('0x4'));var util=require('util');var path=require(_0xaacf('0x5'));var sox=require('sox');var csv=require(_0xaacf('0x6'));var ejs=require(_0xaacf('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xaacf('0x8'));var crypto=require(_0xaacf('0x9'));var jsforce=require(_0xaacf('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xaacf('0x6'));var querystring=require(_0xaacf('0xb'));var Papa=require('papaparse');var Redis=require(_0xaacf('0xc'));var authService=require(_0xaacf('0xd'));var qs=require(_0xaacf('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaacf('0xf'));var logger=require('../../config/logger')(_0xaacf('0x10'));var utils=require(_0xaacf('0x11'));var config=require(_0xaacf('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xaacf('0x13'))['db'];config['redis']=_[_0xaacf('0x14')](config[_0xaacf('0x15')],{'host':_0xaacf('0x16'),'port':0x18eb});var socket=require(_0xaacf('0x17'))(new Redis(config[_0xaacf('0x15')]));require(_0xaacf('0x18'))[_0xaacf('0x19')](socket);function respondWithStatusCode(_0x146b03,_0xbe4b4a){_0xbe4b4a=_0xbe4b4a||0xcc;return function(_0x3e3071){if(_0x3e3071){return _0x146b03[_0xaacf('0x1a')](_0xbe4b4a);}return _0x146b03[_0xaacf('0x1b')](_0xbe4b4a)[_0xaacf('0x1c')]();};}function respondWithResult(_0x25162a,_0x2bc648){_0x2bc648=_0x2bc648||0xc8;return function(_0x223b0b){if(_0x223b0b){return _0x25162a['status'](_0x2bc648)[_0xaacf('0x1d')](_0x223b0b);}};}function respondWithFilteredResult(_0x4cc967,_0x48ac07){return function(_0x72afb9){if(_0x72afb9){var _0x3b7782=_0x72afb9[_0xaacf('0x1e')],_0x4ac341=_0x48ac07[_0xaacf('0x1f')],_0x4a24dc=_0x48ac07['offset']+_0x48ac07[_0xaacf('0x20')],_0x41aa21;if(_0x4a24dc>=_0x3b7782){_0x4a24dc=_0x3b7782;_0x41aa21=0xc8;}else{_0x41aa21=0xce;}_0x4cc967[_0xaacf('0x1b')](_0x41aa21);return _0x4cc967[_0xaacf('0x21')](_0xaacf('0x22'),_0x4ac341+'-'+_0x4a24dc+'/'+_0x3b7782)[_0xaacf('0x1d')](_0x72afb9);}return null;};}function patchUpdates(_0x2355b1){return function(_0x53901a){try{jsonpatch['apply'](_0x53901a,_0x2355b1,!![]);}catch(_0x5479f8){return BPromise['reject'](_0x5479f8);}return _0x53901a[_0xaacf('0x23')]();};}function saveUpdates(_0x2c3bab,_0x4e7210){return function(_0x36e3ab){if(_0x36e3ab){return _0x36e3ab['update'](_0x2c3bab)[_0xaacf('0x24')](function(_0x40c50d){return _0x40c50d;});}return null;};}function removeEntity(_0x36ddab,_0x505878){return function(_0x481839){if(_0x481839){return _0x481839['destroy']()[_0xaacf('0x24')](function(){_0x36ddab[_0xaacf('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a256e,_0x4d4ab1){return function(_0x306e47){if(!_0x306e47){_0x3a256e[_0xaacf('0x1a')](0x194);}return _0x306e47;};}function handleError(_0x55eb66,_0x116148){_0x116148=_0x116148||0x1f4;return function(_0x537821){logger['error'](_0x537821['stack']);if(_0x537821[_0xaacf('0x25')]){delete _0x537821[_0xaacf('0x25')];}_0x55eb66['status'](_0x116148)['send'](_0x537821);};}exports[_0xaacf('0x26')]=function(_0xa4fc53,_0xa127a0,_0x5abca2){if(!_0xa4fc53[_0xaacf('0x27')][_0xaacf('0x28')](_0xaacf('0x29'))&&!_0xa4fc53[_0xaacf('0x27')][_0xaacf('0x28')](_0xaacf('0x2a'))){throw new db['Sequelize'][(_0xaacf('0x2b'))](_0xaacf('0x2c'));}else{if(_0xa4fc53[_0xaacf('0x27')][_0xaacf('0x28')](_0xaacf('0x2a'))&&!_0xa4fc53[_0xaacf('0x27')][_0xaacf('0x28')](_0xaacf('0x2d'))){throw new db[(_0xaacf('0x2e'))][(_0xaacf('0x2b'))](_0xaacf('0x2f'));}if(!_0xa4fc53['body']['hasOwnProperty'](_0xaacf('0x30'))){throw new db['Sequelize'][(_0xaacf('0x2b'))](_0xaacf('0x31'));}else{try{var _0x4a8786=JSON[_0xaacf('0x32')](_0xa4fc53[_0xaacf('0x27')][_0xaacf('0x30')]);}catch(_0x33821f){logger['error'](_0x33821f);throw new db['Sequelize'][(_0xaacf('0x2b'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x8b9fef=[_0xaacf('0x33'),_0xaacf('0x34'),'mailqueue',_0xaacf('0x35'),'smsqueue',_0xaacf('0x36'),_0xaacf('0x37'),_0xaacf('0x38'),_0xaacf('0x39')];if(_[_0xaacf('0x3a')](_0x4a8786,function(_0x17e4e9){return!_[_0xaacf('0x3b')](_0x8b9fef,_0x17e4e9[_0xaacf('0x3c')]['toLowerCase']());})){throw new db[(_0xaacf('0x2e'))][(_0xaacf('0x2b'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0xef8d66={};_0xef8d66[_0xaacf('0x3d')]=_0xa4fc53['body'][_0xaacf('0x28')]('senderName')?_0xa4fc53[_0xaacf('0x27')][_0xaacf('0x3d')]:_0xa4fc53[_0xaacf('0x39')]['fullname'];_0xef8d66[_0xaacf('0x3e')]=_[_0xaacf('0x3f')](_0xa4fc53['body'][_0xaacf('0x3e')])?null:_0xa4fc53['body']['recipientsDescription'];_0xef8d66[_0xaacf('0x40')]=_0xa4fc53[_0xaacf('0x27')][_0xaacf('0x40')]||![];_0xef8d66[_0xaacf('0x41')]=_0xa4fc53[_0xaacf('0x39')]['id'];return getContent(_0xa4fc53[_0xaacf('0x27')])[_0xaacf('0x24')](function(_0x540b66){_0xef8d66[_0xaacf('0x27')]=_0x540b66;return getRecipients(_0x4a8786);})[_0xaacf('0x24')](function(_0x3c05f0){_0xef8d66[_0xaacf('0x42')]=_[_0xaacf('0x43')](_0x3c05f0)['join'](',');return db['sequelize'][_0xaacf('0x44')](function(_0x323738){return db[_0xaacf('0x45')][_0xaacf('0x46')](_0xef8d66,{'raw':!![],'transaction':_0x323738})['then'](function(_0x434d6c){var _0x534110={'sender':_0xef8d66['senderName'],'description':_0xef8d66['recipientsDescription'],'content':_0xef8d66['body'],'beep':_0xef8d66['beep']};_0x3c05f0['forEach'](function(_0xec98ae){_0x534110[_0xaacf('0x47')]=_0xec98ae;socket[_0xaacf('0x48')](_0xaacf('0x49'),_0x534110);});return _0x434d6c;});});})[_0xaacf('0x24')](respondWithResult(_0xa127a0,0xc9))[_0xaacf('0x4a')](handleError(_0xa127a0,null));};function getContent(_0xca2bdb){return new BPromise(function(_0x588171,_0x237b07){if(_0xca2bdb[_0xaacf('0x29')]){_0x588171(_0xca2bdb[_0xaacf('0x29')]);return;}return db[_0xaacf('0x4b')][_0xaacf('0x4c')]({'attributes':[_0xaacf('0x4d')],'where':{'id':_0xca2bdb[_0xaacf('0x2a')]},'raw':!![]})['then'](function(_0x5cd429){if(!_0x5cd429)throw new db[(_0xaacf('0x2e'))][(_0xaacf('0x2b'))](_0xaacf('0x4e'));var _0x2ab8b7=Mustache[_0xaacf('0x4f')](_0x5cd429[_0xaacf('0x4d')],_0xca2bdb[_0xaacf('0x2d')]);_0x588171(_0x2ab8b7);})['catch'](function(_0x2dbd76){_0x237b07(_0x2dbd76);});});}function getRecipients(_0x292d5f){return new BPromise(function(_0x15c964,_0x41f5da){var _0x434538=[];var _0xc01865=[];_0x292d5f['forEach'](function(_0x21feb7){var _0x2dfd4d=_[_0xaacf('0x50')](_0x21feb7['model'][_0xaacf('0x51')]());if(_0x2dfd4d==='User'){_0x434538=_[_0xaacf('0x52')](_0x434538,_0x21feb7['ids']);}else{if(_[_0xaacf('0x3b')](_0x2dfd4d,_0xaacf('0x53')))_0x2dfd4d=_0x2dfd4d['replace']('queue','Queue');_0x21feb7[_0xaacf('0x54')]['forEach'](function(_0x2ff114){_0xc01865[_0xaacf('0x55')](getAgents(_0x2dfd4d,_0x2ff114));});}});return BPromise[_0xaacf('0x56')](_0xc01865)[_0xaacf('0x24')](function(_0x2a4a2e){_0x434538=_[_0xaacf('0x52')](_0x434538,_[_0xaacf('0x57')](_0x2a4a2e));_0x15c964(_0x434538);})[_0xaacf('0x4a')](function(_0x564538){_0x41f5da(_0x564538);});});}function getAgents(_0x417e5c,_0x2639cd){return new BPromise(function(_0x1efea2,_0x1533f2){return db[_0x417e5c]['findOne']({'where':{'id':_0x2639cd}})[_0xaacf('0x24')](function(_0x3a36cb){return _0x3a36cb['getAgents']({'attributes':['id'],'raw':!![]})[_0xaacf('0x24')](function(_0x5eb305){var _0x1c5519=_[_0xaacf('0x58')](_0x5eb305,'id');_0x1efea2(_0x1c5519);});})['catch'](function(_0x3a005a){_0x1533f2(_0x3a005a);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index a6ccbfb..a7bdb8f 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 _0x54ef=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','save','update'];(function(_0x1af974,_0x1409c9){var _0x1b6fd9=function(_0x202d66){while(--_0x202d66){_0x1af974['push'](_0x1af974['shift']());}};_0x1b6fd9(++_0x1409c9);}(_0x54ef,0x112));var _0xf54e=function(_0x4aa42b,_0x486c60){_0x4aa42b=_0x4aa42b-0x0;var _0x37d007=_0x54ef[_0x4aa42b];return _0x37d007;};'use strict';var EventEmitter=require(_0xf54e('0x0'));var UserNotification=require(_0xf54e('0x1'))['db'][_0xf54e('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf54e('0x3'),'afterUpdate':_0xf54e('0x4'),'afterDestroy':_0xf54e('0x5')};function emitEvent(_0x42b9b2){return function(_0x8b6bb6,_0x431e36,_0x12d43f){UserNotificationEvents['emit'](_0x42b9b2+':'+_0x8b6bb6['id'],_0x8b6bb6);UserNotificationEvents['emit'](_0x42b9b2,_0x8b6bb6);_0x12d43f(null);};}for(var e in events){if(events[_0xf54e('0x6')](e)){var event=events[e];UserNotification[_0xf54e('0x7')](e,emitEvent(event));}}module[_0xf54e('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xfd28=['UserNotification','save','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x5d50c8,_0x2cfa52){var _0x19a9d4=function(_0x530d65){while(--_0x530d65){_0x5d50c8['push'](_0x5d50c8['shift']());}};_0x19a9d4(++_0x2cfa52);}(_0xfd28,0x148));var _0x8fd2=function(_0xcfeff4,_0x3f2e19){_0xcfeff4=_0xcfeff4-0x0;var _0xb2fadc=_0xfd28[_0xcfeff4];return _0xb2fadc;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x8fd2('0x0'))['db'][_0x8fd2('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8fd2('0x2'),'afterUpdate':'update','afterDestroy':_0x8fd2('0x3')};function emitEvent(_0xf7417d){return function(_0x4e2108,_0x4b22ae,_0x155f46){UserNotificationEvents[_0x8fd2('0x4')](_0xf7417d+':'+_0x4e2108['id'],_0x4e2108);UserNotificationEvents[_0x8fd2('0x4')](_0xf7417d,_0x4e2108);_0x155f46(null);};}for(var e in events){if(events[_0x8fd2('0x5')](e)){var event=events[e];UserNotification[_0x8fd2('0x6')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index f784212..4eaf364 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 _0x60a5=['rimraf','./userNotification.attributes','exports','utf8mb4','utf8mb4_unicode_ci','lodash','api','request-promise','path'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x60a5,0x83));var _0x560a=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x60a5[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x560a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x560a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x560a('0x2'));var fs=require('fs');var path=require(_0x560a('0x3'));var rimraf=require(_0x560a('0x4'));var config=require('../../config/environment');var attributes=require(_0x560a('0x5'));module[_0x560a('0x6')]=function(_0x3856ae,_0x5aaec6){return _0x3856ae['define']('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x560a('0x7'),'collate':_0x560a('0x8')});}; \ No newline at end of file +var _0x7d80=['api','moment','bluebird','request-promise','rimraf','./userNotification.attributes','exports','UserNotification','util','../../config/logger'];(function(_0x368726,_0x4a651d){var _0x3fc2e7=function(_0x484a0b){while(--_0x484a0b){_0x368726['push'](_0x368726['shift']());}};_0x3fc2e7(++_0x4a651d);}(_0x7d80,0x17a));var _0x07d8=function(_0x76a463,_0x406998){_0x76a463=_0x76a463-0x0;var _0xd5eafb=_0x7d80[_0x76a463];return _0xd5eafb;};'use strict';var _=require('lodash');var util=require(_0x07d8('0x0'));var logger=require(_0x07d8('0x1'))(_0x07d8('0x2'));var moment=require(_0x07d8('0x3'));var BPromise=require(_0x07d8('0x4'));var rp=require(_0x07d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x07d8('0x6'));var config=require('../../config/environment');var attributes=require(_0x07d8('0x7'));module[_0x07d8('0x8')]=function(_0x3e7308,_0x53231b){return _0x3e7308['define'](_0x07d8('0x9'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 fe3a1fb..8f1089f 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 _0xfaec=['error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x45b401,_0x4b35a8){var _0x54297f=function(_0x4a0634){while(--_0x4a0634){_0x45b401['push'](_0x45b401['shift']());}};_0x54297f(++_0x4b35a8);}(_0xfaec,0xc8));var _0xcfae=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xfaec[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xcfae('0x0'));var moment=require(_0xcfae('0x1'));var BPromise=require(_0xcfae('0x2'));var rs=require(_0xcfae('0x3'));var fs=require('fs');var Redis=require(_0xcfae('0x4'));var db=require(_0xcfae('0x5'))['db'];var utils=require(_0xcfae('0x6'));var logger=require('../../config/logger')(_0xcfae('0x7'));var config=require(_0xcfae('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcfae('0x9')][_0xcfae('0xa')]({'port':0x232a});config[_0xcfae('0xb')]=_['defaults'](config[_0xcfae('0xb')],{'host':_0xcfae('0xc'),'port':0x18eb});var socket=require(_0xcfae('0xd'))(new Redis(config[_0xcfae('0xb')]));require(_0xcfae('0xe'))[_0xcfae('0xf')](socket);function respondWithRpcPromise(_0x3147b4,_0x42840b,_0x22857e){return new BPromise(function(_0x5e8e35,_0x4a43e1){return client[_0xcfae('0x10')](_0x3147b4,_0x22857e)[_0xcfae('0x11')](function(_0x29ccb9){logger[_0xcfae('0x12')](_0xcfae('0x13'),_0x42840b,_0xcfae('0x14'));logger[_0xcfae('0x15')](_0xcfae('0x16'),_0x42840b,_0xcfae('0x14'),JSON[_0xcfae('0x17')](_0x29ccb9));if(_0x29ccb9[_0xcfae('0x18')]){if(_0x29ccb9[_0xcfae('0x18')]['code']===0x1f4){logger[_0xcfae('0x18')](_0xcfae('0x13'),_0x42840b,_0x29ccb9[_0xcfae('0x18')][_0xcfae('0x19')]);return _0x4a43e1(_0x29ccb9['error']['message']);}logger[_0xcfae('0x18')](_0xcfae('0x13'),_0x42840b,_0x29ccb9['error'][_0xcfae('0x19')]);return _0x5e8e35(_0x29ccb9['error']['message']);}else{logger[_0xcfae('0x12')](_0xcfae('0x13'),_0x42840b,_0xcfae('0x14'));_0x5e8e35(_0x29ccb9[_0xcfae('0x1a')][_0xcfae('0x19')]);}})[_0xcfae('0x1b')](function(_0x121cc3){logger[_0xcfae('0x18')](_0xcfae('0x13'),_0x42840b,_0x121cc3);_0x4a43e1(_0x121cc3);});});} \ No newline at end of file +var _0xb74d=['request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./userNotification.socket','register'];(function(_0x326f38,_0x417aef){var _0x34c233=function(_0x313a9b){while(--_0x313a9b){_0x326f38['push'](_0x326f38['shift']());}};_0x34c233(++_0x417aef);}(_0xb74d,0x1b4));var _0xdb74=function(_0x3186aa,_0x34c21e){_0x3186aa=_0x3186aa-0x0;var _0x2d8c36=_0xb74d[_0x3186aa];return _0x2d8c36;};'use strict';var _=require(_0xdb74('0x0'));var util=require(_0xdb74('0x1'));var moment=require(_0xdb74('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb74('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdb74('0x4'))(_0xdb74('0x5'));var config=require(_0xdb74('0x6'));var jayson=require(_0xdb74('0x7'));var client=jayson['client'][_0xdb74('0x8')]({'port':0x232a});config[_0xdb74('0x9')]=_['defaults'](config['redis'],{'host':_0xdb74('0xa'),'port':0x18eb});var socket=require(_0xdb74('0xb'))(new Redis(config[_0xdb74('0x9')]));require(_0xdb74('0xc'))[_0xdb74('0xd')](socket);function respondWithRpcPromise(_0x52b033,_0x22a19c,_0x5a2d88){return new BPromise(function(_0x2ffe35,_0x5541f0){return client[_0xdb74('0xe')](_0x52b033,_0x5a2d88)[_0xdb74('0xf')](function(_0x35be3b){logger[_0xdb74('0x10')](_0xdb74('0x11'),_0x22a19c,'request\x20sent');logger[_0xdb74('0x12')](_0xdb74('0x13'),_0x22a19c,_0xdb74('0x14'),JSON['stringify'](_0x35be3b));if(_0x35be3b[_0xdb74('0x15')]){if(_0x35be3b[_0xdb74('0x15')][_0xdb74('0x16')]===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x22a19c,_0x35be3b['error'][_0xdb74('0x17')]);return _0x5541f0(_0x35be3b[_0xdb74('0x15')][_0xdb74('0x17')]);}logger['error'](_0xdb74('0x11'),_0x22a19c,_0x35be3b[_0xdb74('0x15')]['message']);return _0x2ffe35(_0x35be3b['error'][_0xdb74('0x17')]);}else{logger[_0xdb74('0x10')](_0xdb74('0x11'),_0x22a19c,_0xdb74('0x14'));_0x2ffe35(_0x35be3b['result'][_0xdb74('0x17')]);}})[_0xdb74('0x18')](function(_0x3e7ebc){logger[_0xdb74('0x15')](_0xdb74('0x11'),_0x22a19c,_0x3e7ebc);_0x5541f0(_0x3e7ebc);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index be83bac..f9e1fda 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 _0x600f=['remove','emit','removeListener','register','length','./userNotification.events','save'];(function(_0x40a44b,_0x2b8785){var _0x2b656d=function(_0x7570d6){while(--_0x7570d6){_0x40a44b['push'](_0x40a44b['shift']());}};_0x2b656d(++_0x2b8785);}(_0x600f,0xb4));var _0xf600=function(_0x2dee2f,_0x19572f){_0x2dee2f=_0x2dee2f-0x0;var _0x327c18=_0x600f[_0x2dee2f];return _0x327c18;};'use strict';var UserNotificationEvents=require(_0xf600('0x0'));var events=[_0xf600('0x1'),_0xf600('0x2'),'update'];function createListener(_0x248cfa,_0x52544a){return function(_0x6a56f5){_0x52544a[_0xf600('0x3')](_0x248cfa,_0x6a56f5);};}function removeListener(_0x1b8de0,_0x181497){return function(){UserNotificationEvents[_0xf600('0x4')](_0x1b8de0,_0x181497);};}exports[_0xf600('0x5')]=function(_0x304fdf){for(var _0xba580a=0x0,_0x5a6457=events[_0xf600('0x6')];_0xba580a<_0x5a6457;_0xba580a++){var _0x56f333=events[_0xba580a];var _0x489c42=createListener('userNotification:'+_0x56f333,_0x304fdf);UserNotificationEvents['on'](_0x56f333,_0x489c42);}}; \ No newline at end of file +var _0x0738=['update','emit','removeListener','register','length','userNotification:','./userNotification.events','remove'];(function(_0x5eeb5c,_0x7f0265){var _0x2c1901=function(_0x40e7be){while(--_0x40e7be){_0x5eeb5c['push'](_0x5eeb5c['shift']());}};_0x2c1901(++_0x7f0265);}(_0x0738,0x6e));var _0x8073=function(_0x38ae4f,_0x1d3180){_0x38ae4f=_0x38ae4f-0x0;var _0x1e92db=_0x0738[_0x38ae4f];return _0x1e92db;};'use strict';var UserNotificationEvents=require(_0x8073('0x0'));var events=['save',_0x8073('0x1'),_0x8073('0x2')];function createListener(_0x46b716,_0xf6179e){return function(_0x8e2e35){_0xf6179e[_0x8073('0x3')](_0x46b716,_0x8e2e35);};}function removeListener(_0x176f52,_0x38b47d){return function(){UserNotificationEvents[_0x8073('0x4')](_0x176f52,_0x38b47d);};}exports[_0x8073('0x5')]=function(_0x2f90b9){for(var _0x588057=0x0,_0x1aad61=events[_0x8073('0x6')];_0x588057<_0x1aad61;_0x588057++){var _0x2899ce=events[_0x588057];var _0x310f3a=createListener(_0x8073('0x7')+_0x2899ce,_0x2f90b9);UserNotificationEvents['on'](_0x2899ce,_0x310f3a);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index c9bdc03..dffeec0 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 _0x1512=['../../components/interaction/service','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x1512,0x1a9));var _0x2151=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1512[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x2151('0x0'));var util=require(_0x2151('0x1'));var path=require(_0x2151('0x2'));var timeout=require(_0x2151('0x3'));var express=require(_0x2151('0x4'));var router=express[_0x2151('0x5')]();var auth=require(_0x2151('0x6'));var interaction=require(_0x2151('0x7'));var config=require('../../config/environment');module[_0x2151('0x8')]=router; \ No newline at end of file +var _0x9c63=['util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports'];(function(_0x2d92bd,_0x416726){var _0x51a00f=function(_0x12f323){while(--_0x12f323){_0x2d92bd['push'](_0x2d92bd['shift']());}};_0x51a00f(++_0x416726);}(_0x9c63,0x7e));var _0x39c6=function(_0x50c8ee,_0x196ffe){_0x50c8ee=_0x50c8ee-0x0;var _0x4d0941=_0x9c63[_0x50c8ee];return _0x4d0941;};'use strict';var multer=require('multer');var util=require(_0x39c6('0x0'));var path=require('path');var timeout=require(_0x39c6('0x1'));var express=require(_0x39c6('0x2'));var router=express[_0x39c6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x39c6('0x4'));var config=require(_0x39c6('0x5'));module[_0x39c6('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 579556a..715d08d 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x4e92bb,_0x6c1f02){var _0x183bd5=function(_0x1983c0){while(--_0x1983c0){_0x4e92bb['push'](_0x4e92bb['shift']());}};_0x183bd5(++_0x6c1f02);}(_0xe706,0xa3));var _0x6e70=function(_0x3705f7,_0x2553c4){_0x3705f7=_0x3705f7-0x0;var _0x2a1cf2=_0xe706[_0x3705f7];return _0x2a1cf2;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x2074db,_0x10b81b){var _0x27324c=function(_0x5c3d5c){while(--_0x5c3d5c){_0x2074db['push'](_0x2074db['shift']());}};_0x27324c(++_0x10b81b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'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 25c0a1b..b336774 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 _0x7f04=['moment','bluebird','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger'];(function(_0x3bb452,_0x53a01e){var _0x10c180=function(_0x463cc5){while(--_0x463cc5){_0x3bb452['push'](_0x3bb452['shift']());}};_0x10c180(++_0x53a01e);}(_0x7f04,0xda));var _0x47f0=function(_0x26cab7,_0x1ccfca){_0x26cab7=_0x26cab7-0x0;var _0x31ba06=_0x7f04[_0x26cab7];return _0x31ba06;};'use strict';var _=require('lodash');var util=require(_0x47f0('0x0'));var logger=require(_0x47f0('0x1'))('api');var moment=require(_0x47f0('0x2'));var BPromise=require(_0x47f0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47f0('0x4'));var rimraf=require(_0x47f0('0x5'));var config=require(_0x47f0('0x6'));var attributes=require(_0x47f0('0x7'));module[_0x47f0('0x8')]=function(_0x3e368a,_0x8eebd5){return _0x3e368a['define'](_0x47f0('0x9'),attributes,{'tableName':_0x47f0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb73a=['./userOpenchannelQueue.attributes','define','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x280ad6,_0x3dd146){var _0x5d7286=function(_0x2ff287){while(--_0x2ff287){_0x280ad6['push'](_0x280ad6['shift']());}};_0x5d7286(++_0x3dd146);}(_0xb73a,0xab));var _0xab73=function(_0x102b2b,_0x45d45e){_0x102b2b=_0x102b2b-0x0;var _0x55db93=_0xb73a[_0x102b2b];return _0x55db93;};'use strict';var _=require(_0xab73('0x0'));var util=require(_0xab73('0x1'));var logger=require(_0xab73('0x2'))(_0xab73('0x3'));var moment=require(_0xab73('0x4'));var BPromise=require(_0xab73('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab73('0x6'));var rimraf=require(_0xab73('0x7'));var config=require(_0xab73('0x8'));var attributes=require(_0xab73('0x9'));module['exports']=function(_0x274b49,_0xd97193){return _0x274b49[_0xab73('0xa')]('UserOpenchannelQueue',attributes,{'tableName':_0xab73('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 c1021f7..dcd0490 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 _0xaf07=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x566956,_0x110bd3){var _0x587b5a=function(_0x2ebaf4){while(--_0x2ebaf4){_0x566956['push'](_0x566956['shift']());}};_0x587b5a(++_0x110bd3);}(_0xaf07,0x1cf));var _0x7af0=function(_0x32f8cb,_0x9634ce){_0x32f8cb=_0x32f8cb-0x0;var _0xfd0cc2=_0xaf07[_0x32f8cb];return _0xfd0cc2;};'use strict';var _=require(_0x7af0('0x0'));var util=require(_0x7af0('0x1'));var moment=require(_0x7af0('0x2'));var BPromise=require(_0x7af0('0x3'));var rs=require(_0x7af0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7af0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7af0('0x6'))(_0x7af0('0x7'));var config=require(_0x7af0('0x8'));var jayson=require(_0x7af0('0x9'));var client=jayson['client'][_0x7af0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x512381,_0x310b47,_0x5905f0){return new BPromise(function(_0x165fa0,_0x32bffd){return client[_0x7af0('0xb')](_0x512381,_0x5905f0)[_0x7af0('0xc')](function(_0x4ffdfd){logger[_0x7af0('0xd')](_0x7af0('0xe'),_0x310b47,_0x7af0('0xf'));logger[_0x7af0('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x310b47,_0x7af0('0xf'),JSON[_0x7af0('0x11')](_0x4ffdfd));if(_0x4ffdfd['error']){if(_0x4ffdfd[_0x7af0('0x12')][_0x7af0('0x13')]===0x1f4){logger['error'](_0x7af0('0xe'),_0x310b47,_0x4ffdfd[_0x7af0('0x12')][_0x7af0('0x14')]);return _0x32bffd(_0x4ffdfd[_0x7af0('0x12')][_0x7af0('0x14')]);}logger[_0x7af0('0x12')](_0x7af0('0xe'),_0x310b47,_0x4ffdfd[_0x7af0('0x12')][_0x7af0('0x14')]);return _0x165fa0(_0x4ffdfd[_0x7af0('0x12')][_0x7af0('0x14')]);}else{logger[_0x7af0('0xd')](_0x7af0('0xe'),_0x310b47,_0x7af0('0xf'));_0x165fa0(_0x4ffdfd[_0x7af0('0x15')][_0x7af0('0x14')]);}})[_0x7af0('0x16')](function(_0x48767d){logger[_0x7af0('0x12')](_0x7af0('0xe'),_0x310b47,_0x48767d);_0x32bffd(_0x48767d);});});} \ No newline at end of file +var _0x1557=['bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x3fcc20,_0x57c31b){var _0x15d3ce=function(_0x575619){while(--_0x575619){_0x3fcc20['push'](_0x3fcc20['shift']());}};_0x15d3ce(++_0x57c31b);}(_0x1557,0x70));var _0x7155=function(_0x422f14,_0x27e379){_0x422f14=_0x422f14-0x0;var _0x91850c=_0x1557[_0x422f14];return _0x91850c;};'use strict';var _=require(_0x7155('0x0'));var util=require(_0x7155('0x1'));var moment=require(_0x7155('0x2'));var BPromise=require(_0x7155('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7155('0x4'))['db'];var utils=require(_0x7155('0x5'));var logger=require('../../config/logger')(_0x7155('0x6'));var config=require(_0x7155('0x7'));var jayson=require(_0x7155('0x8'));var client=jayson[_0x7155('0x9')][_0x7155('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3826d2,_0x338728,_0x5e9dac){return new BPromise(function(_0x240a91,_0x192b4d){return client[_0x7155('0xb')](_0x3826d2,_0x5e9dac)['then'](function(_0x46c27b){logger[_0x7155('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x338728,'request\x20sent');logger[_0x7155('0xd')](_0x7155('0xe'),_0x338728,_0x7155('0xf'),JSON[_0x7155('0x10')](_0x46c27b));if(_0x46c27b[_0x7155('0x11')]){if(_0x46c27b['error'][_0x7155('0x12')]===0x1f4){logger[_0x7155('0x11')](_0x7155('0x13'),_0x338728,_0x46c27b[_0x7155('0x11')][_0x7155('0x14')]);return _0x192b4d(_0x46c27b[_0x7155('0x11')][_0x7155('0x14')]);}logger[_0x7155('0x11')](_0x7155('0x13'),_0x338728,_0x46c27b[_0x7155('0x11')][_0x7155('0x14')]);return _0x240a91(_0x46c27b[_0x7155('0x11')][_0x7155('0x14')]);}else{logger['info'](_0x7155('0x13'),_0x338728,_0x7155('0xf'));_0x240a91(_0x46c27b[_0x7155('0x15')][_0x7155('0x14')]);}})[_0x7155('0x16')](function(_0x2dd789){logger['error'](_0x7155('0x13'),_0x338728,_0x2dd789);_0x192b4d(_0x2dd789);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index c865ac3..1c6b175 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 _0x3479=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','index','/describe','isAuthenticated','/:id','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','/:id/sections','addSections','addResources','put','update','delete','removeResources'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3479,0x119));var _0x9347=function(_0x301efe,_0x338d14){_0x301efe=_0x301efe-0x0;var _0x5d44c3=_0x3479[_0x301efe];return _0x5d44c3;};'use strict';var multer=require(_0x9347('0x0'));var util=require(_0x9347('0x1'));var path=require(_0x9347('0x2'));var timeout=require('connect-timeout');var express=require(_0x9347('0x3'));var router=express[_0x9347('0x4')]();var auth=require(_0x9347('0x5'));var interaction=require(_0x9347('0x6'));var config=require('../../config/environment');var controller=require(_0x9347('0x7'));router[_0x9347('0x8')]('/',auth['isAuthenticated'](),controller[_0x9347('0x9')]);router['get'](_0x9347('0xa'),auth[_0x9347('0xb')](),controller['describe']);router[_0x9347('0x8')](_0x9347('0xc'),auth[_0x9347('0xb')](),controller['show']);router['get']('/:id/sections',auth[_0x9347('0xb')](),controller[_0x9347('0xd')]);router[_0x9347('0x8')](_0x9347('0xe'),auth[_0x9347('0xb')](),controller[_0x9347('0xf')]);router[_0x9347('0x10')]('/',auth[_0x9347('0xb')](),controller[_0x9347('0x11')]);router[_0x9347('0x10')](_0x9347('0x12'),auth['isAuthenticated'](),controller[_0x9347('0x13')]);router[_0x9347('0x10')](_0x9347('0x14'),auth[_0x9347('0xb')](),controller[_0x9347('0x15')]);router[_0x9347('0x10')](_0x9347('0xe'),auth[_0x9347('0xb')](),controller[_0x9347('0x16')]);router[_0x9347('0x17')](_0x9347('0xc'),auth[_0x9347('0xb')](),controller[_0x9347('0x18')]);router[_0x9347('0x19')]('/:id',auth[_0x9347('0xb')](),controller['destroy']);router[_0x9347('0x19')](_0x9347('0x14'),auth[_0x9347('0xb')](),controller['removeSections']);router[_0x9347('0x19')](_0x9347('0xe'),auth[_0x9347('0xb')](),controller[_0x9347('0x1a')]);module[_0x9347('0x1b')]=router; \ No newline at end of file +var _0x87d0=['addSections','put','update','delete','destroy','removeSections','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create'];(function(_0x148c09,_0x4fd39f){var _0x18e613=function(_0xfaa810){while(--_0xfaa810){_0x148c09['push'](_0x148c09['shift']());}};_0x18e613(++_0x4fd39f);}(_0x87d0,0xbd));var _0x087d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x87d0[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x087d('0x0'));var util=require(_0x087d('0x1'));var path=require(_0x087d('0x2'));var timeout=require('connect-timeout');var express=require(_0x087d('0x3'));var router=express['Router']();var auth=require(_0x087d('0x4'));var interaction=require(_0x087d('0x5'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router['get']('/',auth[_0x087d('0x6')](),controller[_0x087d('0x7')]);router[_0x087d('0x8')](_0x087d('0x9'),auth['isAuthenticated'](),controller[_0x087d('0xa')]);router['get'](_0x087d('0xb'),auth['isAuthenticated'](),controller[_0x087d('0xc')]);router[_0x087d('0x8')](_0x087d('0xd'),auth[_0x087d('0x6')](),controller[_0x087d('0xe')]);router[_0x087d('0x8')](_0x087d('0xf'),auth[_0x087d('0x6')](),controller[_0x087d('0x10')]);router[_0x087d('0x11')]('/',auth['isAuthenticated'](),controller[_0x087d('0x12')]);router[_0x087d('0x11')]('/:id/clone',auth[_0x087d('0x6')](),controller['clone']);router[_0x087d('0x11')](_0x087d('0xd'),auth[_0x087d('0x6')](),controller[_0x087d('0x13')]);router[_0x087d('0x11')](_0x087d('0xf'),auth['isAuthenticated'](),controller['addResources']);router[_0x087d('0x14')](_0x087d('0xb'),auth[_0x087d('0x6')](),controller[_0x087d('0x15')]);router[_0x087d('0x16')]('/:id',auth[_0x087d('0x6')](),controller[_0x087d('0x17')]);router['delete'](_0x087d('0xd'),auth[_0x087d('0x6')](),controller[_0x087d('0x18')]);router['delete']('/:id/resources',auth[_0x087d('0x6')](),controller['removeResources']);module[_0x087d('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 7e125ea..89652fb 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 _0xb6bd=['crudPermissions','getDataValue','sequelize','STRING','setDataValue','join'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb6bd,0xd4));var _0xdb6b=function(_0x241941,_0x56d1b0){_0x241941=_0x241941-0x0;var _0x1d6282=_0xb6bd[_0x241941];return _0x1d6282;};'use strict';var Sequelize=require(_0xdb6b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xdb6b('0x1')],'set':function(_0xef59a3){this[_0xdb6b('0x2')]('crudPermissions',_0xef59a3?_0xef59a3[_0xdb6b('0x3')](''):[]);},'get':function(){return this['getDataValue'](_0xdb6b('0x4'))?this[_0xdb6b('0x5')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xc205=['STRING','name','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports'];(function(_0x10cec3,_0x3aa214){var _0x29116f=function(_0x402da6){while(--_0x402da6){_0x10cec3['push'](_0x10cec3['shift']());}};_0x29116f(++_0x3aa214);}(_0xc205,0x19c));var _0x5c20=function(_0x18f911,_0x16a1b6){_0x18f911=_0x18f911-0x0;var _0x16b199=_0xc205[_0x18f911];return _0x16b199;};'use strict';var Sequelize=require(_0x5c20('0x0'));module[_0x5c20('0x1')]={'name':{'type':Sequelize[_0x5c20('0x2')],'allowNull':![],'unique':_0x5c20('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x14484f){this[_0x5c20('0x4')](_0x5c20('0x5'),_0x14484f?_0x14484f[_0x5c20('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x5c20('0x5'))?this[_0x5c20('0x7')](_0x5c20('0x5'))[_0x5c20('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x5c20('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 275f8d7..ce6e1cd 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 _0x3351=['undefined','Sequelize','Unknown\x20section','mergeResources','childModel','ValidationError','Invalid\x20section\x20\x27','ignore','all','order','pick','key','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','Tags','color','ThroughTags','tag','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','SquareRecording','SquareProjects','projectName','projects','contacts','parentSections','Lists','lists','CmList','CmCompany','CmCustomField','chatqueues','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','membername','User','role','agent','Telephones','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','users','agents','telephones','Users','admin','user','zendeskaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','DeskAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','Pause','scheduler','Schedule','sounds','Sound','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','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','register','sendStatus','status','end','json','count','set','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','merge','find','create','body','clone','get','createdAt','updatedAt','crudPermissions','UserProfileSection','each','autoAssociation','UserProfileResource','omit','sectionId','userProfileId','Resources','describe','sequelize','push','removeSections','getSections','includes','isEmpty','subsections','enabled','findOne','resourceId','forEach','addResources','transaction','bulkCreate','removeResources','ids','section'];(function(_0x341c7d,_0x4ca460){var _0x5ab893=function(_0x364b68){while(--_0x364b68){_0x341c7d['push'](_0x341c7d['shift']());}};_0x5ab893(++_0x4ca460);}(_0x3351,0x175));var _0x1335=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x3351[_0xea8947];return _0x2455e9;};'use strict';var pdf=require(_0x1335('0x0'));var emlformat=require(_0x1335('0x1'));var rimraf=require(_0x1335('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1335('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1335('0x4'));var util=require(_0x1335('0x5'));var path=require(_0x1335('0x6'));var sox=require(_0x1335('0x7'));var csv=require(_0x1335('0x8'));var ejs=require(_0x1335('0x9'));var fs=require('fs');var _=require(_0x1335('0xa'));var squel=require(_0x1335('0xb'));var crypto=require(_0x1335('0xc'));var jsforce=require(_0x1335('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1335('0x8'));var querystring=require(_0x1335('0xe'));var Papa=require('papaparse');var Redis=require(_0x1335('0xf'));var authService=require(_0x1335('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1335('0x11'));var hardwareService=require(_0x1335('0x12'));var logger=require(_0x1335('0x13'))(_0x1335('0x14'));var utils=require(_0x1335('0x15'));var config=require(_0x1335('0x16'));var licenseUtil=require(_0x1335('0x17'));var db=require(_0x1335('0x18'))['db'];config[_0x1335('0x19')]=_[_0x1335('0x1a')](config[_0x1335('0x19')],{'host':_0x1335('0x1b'),'port':0x18eb});var socket=require(_0x1335('0x1c'))(new Redis(config[_0x1335('0x19')]));require('./userProfile.socket')[_0x1335('0x1d')](socket);function respondWithStatusCode(_0x3516da,_0x1c4fcf){_0x1c4fcf=_0x1c4fcf||0xcc;return function(_0x47f287){if(_0x47f287){return _0x3516da[_0x1335('0x1e')](_0x1c4fcf);}return _0x3516da[_0x1335('0x1f')](_0x1c4fcf)[_0x1335('0x20')]();};}function respondWithResult(_0x4249bf,_0x41bb9c){_0x41bb9c=_0x41bb9c||0xc8;return function(_0x33a7fd){if(_0x33a7fd){return _0x4249bf[_0x1335('0x1f')](_0x41bb9c)[_0x1335('0x21')](_0x33a7fd);}};}function respondWithFilteredResult(_0x59ee93,_0x438ee9){return function(_0x52651d){if(_0x52651d){var _0x1552c5=_0x52651d[_0x1335('0x22')],_0x25cc57=_0x438ee9['offset'],_0x1e3588=_0x438ee9['offset']+_0x438ee9['limit'],_0x1edd06;if(_0x1e3588>=_0x1552c5){_0x1e3588=_0x1552c5;_0x1edd06=0xc8;}else{_0x1edd06=0xce;}_0x59ee93[_0x1335('0x1f')](_0x1edd06);return _0x59ee93[_0x1335('0x23')]('Content-Range',_0x25cc57+'-'+_0x1e3588+'/'+_0x1552c5)[_0x1335('0x21')](_0x52651d);}return null;};}function patchUpdates(_0x215eef){return function(_0x4ebd6d){try{jsonpatch['apply'](_0x4ebd6d,_0x215eef,!![]);}catch(_0x37df48){return BPromise[_0x1335('0x24')](_0x37df48);}return _0x4ebd6d[_0x1335('0x25')]();};}function saveUpdates(_0x3c1d6e,_0x1b433a){return function(_0x45f2bf){if(_0x45f2bf){return _0x45f2bf[_0x1335('0x26')](_0x3c1d6e)[_0x1335('0x27')](function(_0x4c75b6){return _0x4c75b6;});}return null;};}function removeEntity(_0x28484f,_0x45510c){return function(_0xf07e1e){if(_0xf07e1e){return _0xf07e1e[_0x1335('0x28')]()[_0x1335('0x27')](function(){_0x28484f[_0x1335('0x1f')](0xcc)[_0x1335('0x20')]();});}};}function handleEntityNotFound(_0x38f624,_0x13d20d){return function(_0x1e1c21){if(!_0x1e1c21){_0x38f624[_0x1335('0x1e')](0x194);}return _0x1e1c21;};}function handleError(_0x5a7657,_0x2e612c){_0x2e612c=_0x2e612c||0x1f4;return function(_0x2725fd){logger[_0x1335('0x29')](_0x2725fd[_0x1335('0x2a')]);if(_0x2725fd[_0x1335('0x2b')]){delete _0x2725fd[_0x1335('0x2b')];}_0x5a7657[_0x1335('0x1f')](_0x2e612c)[_0x1335('0x2c')](_0x2725fd);};}exports[_0x1335('0x2d')]=function(_0x3a9c3c,_0x1d7aff){var _0x318a4e={},_0x29c452={},_0x177c37={'count':0x0,'rows':[]};var _0x83bfd5=_[_0x1335('0x2e')](db[_0x1335('0x2f')][_0x1335('0x30')],function(_0x3d4850){return{'name':_0x3d4850['fieldName'],'type':_0x3d4850[_0x1335('0x31')]['key']};});_0x29c452[_0x1335('0x32')]=_[_0x1335('0x2e')](_0x83bfd5,_0x1335('0x2b'));_0x29c452['query']=_[_0x1335('0x33')](_0x3a9c3c[_0x1335('0x34')]);_0x29c452[_0x1335('0x35')]=_[_0x1335('0x36')](_0x29c452['model'],_0x29c452[_0x1335('0x34')]);_0x318a4e[_0x1335('0x37')]=_['intersection'](_0x29c452[_0x1335('0x32')],qs[_0x1335('0x38')](_0x3a9c3c[_0x1335('0x34')][_0x1335('0x38')]));_0x318a4e['attributes']=_0x318a4e['attributes']['length']?_0x318a4e[_0x1335('0x37')]:_0x29c452['model'];if(!_0x3a9c3c[_0x1335('0x34')][_0x1335('0x39')](_0x1335('0x3a'))){_0x318a4e[_0x1335('0x3b')]=qs['limit'](_0x3a9c3c[_0x1335('0x34')][_0x1335('0x3b')]);_0x318a4e[_0x1335('0x3c')]=qs['offset'](_0x3a9c3c['query']['offset']);}_0x318a4e['order']=qs[_0x1335('0x3d')](_0x3a9c3c[_0x1335('0x34')][_0x1335('0x3d')]);_0x318a4e[_0x1335('0x3e')]=qs['filters'](_['pick'](_0x3a9c3c['query'],_0x29c452[_0x1335('0x35')]),_0x83bfd5);if(_0x3a9c3c['query'][_0x1335('0x3f')]){_0x318a4e[_0x1335('0x3e')]=_['merge'](_0x318a4e['where'],{'$or':_['map'](_0x83bfd5,function(_0xb6d43c){if(_0xb6d43c[_0x1335('0x31')]!==_0x1335('0x40')){var _0x2ac08b={};_0x2ac08b[_0xb6d43c['name']]={'$like':'%'+_0x3a9c3c[_0x1335('0x34')]['filter']+'%'};return _0x2ac08b;}})});}_0x318a4e=_['merge']({},_0x318a4e,_0x3a9c3c[_0x1335('0x41')]);var _0x393dc7={'where':_0x318a4e[_0x1335('0x3e')]};return db[_0x1335('0x2f')][_0x1335('0x22')](_0x393dc7)[_0x1335('0x27')](function(_0x5376d5){_0x177c37[_0x1335('0x22')]=_0x5376d5;if(_0x3a9c3c['query'][_0x1335('0x42')]){_0x318a4e[_0x1335('0x43')]=[{'all':!![]}];}return db[_0x1335('0x2f')][_0x1335('0x44')](_0x318a4e);})['then'](function(_0x518c28){_0x177c37[_0x1335('0x45')]=_0x518c28;return _0x177c37;})[_0x1335('0x27')](respondWithFilteredResult(_0x1d7aff,_0x318a4e))[_0x1335('0x46')](handleError(_0x1d7aff,null));};exports[_0x1335('0x47')]=function(_0xcd802c,_0x4417f8){var _0x1f1a51={'raw':![],'where':{'id':_0xcd802c[_0x1335('0x48')]['id']}},_0x2c50dc={};_0x2c50dc[_0x1335('0x32')]=_[_0x1335('0x33')](db[_0x1335('0x2f')]['rawAttributes']);_0x2c50dc['query']=_[_0x1335('0x33')](_0xcd802c[_0x1335('0x34')]);_0x2c50dc[_0x1335('0x35')]=_[_0x1335('0x36')](_0x2c50dc['model'],_0x2c50dc[_0x1335('0x34')]);_0x1f1a51[_0x1335('0x37')]=_[_0x1335('0x36')](_0x2c50dc['model'],qs[_0x1335('0x38')](_0xcd802c[_0x1335('0x34')][_0x1335('0x38')]));_0x1f1a51['attributes']=_0x1f1a51[_0x1335('0x37')][_0x1335('0x49')]?_0x1f1a51[_0x1335('0x37')]:_0x2c50dc[_0x1335('0x32')];if(_0xcd802c[_0x1335('0x34')]['includeAll']){_0x1f1a51[_0x1335('0x43')]=[{'all':!![]}];}_0x1f1a51=_[_0x1335('0x4a')]({},_0x1f1a51,_0xcd802c['options']);return db['UserProfile'][_0x1335('0x4b')](_0x1f1a51)[_0x1335('0x27')](handleEntityNotFound(_0x4417f8,null))['then'](respondWithResult(_0x4417f8,null))[_0x1335('0x46')](handleError(_0x4417f8,null));};exports[_0x1335('0x4c')]=function(_0x105c44,_0x28a6a7){return db[_0x1335('0x2f')][_0x1335('0x4c')](_0x105c44[_0x1335('0x4d')],{})[_0x1335('0x27')](respondWithResult(_0x28a6a7,0xc9))['catch'](handleError(_0x28a6a7,null));};exports[_0x1335('0x4e')]=function(_0x28d4a9,_0x1dbf58){var _0x5a718e={'where':{'id':_0x28d4a9[_0x1335('0x48')]['id']}},_0x1f0e7c={};_0x1f0e7c['model']=_[_0x1335('0x33')](db['UserProfile'][_0x1335('0x30')]);_0x5a718e[_0x1335('0x37')]=_[_0x1335('0x36')](_0x1f0e7c[_0x1335('0x32')],qs[_0x1335('0x38')](_0x28d4a9[_0x1335('0x34')]['fields']));_0x5a718e[_0x1335('0x37')]=_0x5a718e['attributes'][_0x1335('0x49')]?_0x5a718e[_0x1335('0x37')]:_0x1f0e7c[_0x1335('0x32')];if(_0x28d4a9[_0x1335('0x34')][_0x1335('0x42')]){_0x5a718e[_0x1335('0x43')]=[{'all':!![]}];}_0x5a718e=_[_0x1335('0x4a')]({},_0x5a718e,_0x28d4a9['options']);return db[_0x1335('0x2f')][_0x1335('0x4b')](_0x5a718e)[_0x1335('0x27')](handleEntityNotFound(_0x1dbf58,null))[_0x1335('0x27')](function(_0x351a6c){if(_0x351a6c){var _0x211f89=_0x351a6c[_0x1335('0x4f')]({'plain':!![]});_0x211f89=qs['omit'](_0x211f89,['id',_0x1335('0x50'),_0x1335('0x51'),_0x1335('0x52')]);_0x28d4a9[_0x1335('0x4d')]=_['omit'](_0x28d4a9[_0x1335('0x4d')],['id',_0x1335('0x50'),_0x1335('0x51')]);return db['sequelize']['transaction'](function(_0x18f2e6){return db[_0x1335('0x2f')][_0x1335('0x4c')](_[_0x1335('0x4a')](_0x211f89,_0x28d4a9[_0x1335('0x4d')]),{'include':_0x28d4a9[_0x1335('0x34')][_0x1335('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x18f2e6})[_0x1335('0x27')](function(_0x4ceb0a){var _0x45fee5=_0x4ceb0a[_0x1335('0x4f')]({'plain':!![]});return db[_0x1335('0x53')][_0x1335('0x44')]({'where':{'userProfileId':_0x28d4a9[_0x1335('0x48')]['id']},'raw':!![]})[_0x1335('0x27')](function(_0x418cfb){if(_0x418cfb){return BPromise[_0x1335('0x54')](_0x418cfb,function(_0x34d4da){return new BPromise(function(_0x1e7206,_0x237bbf){if(_0x34d4da['autoAssociation']===null||_0x34d4da[_0x1335('0x55')]===0x1)_0x1e7206(null);return db[_0x1335('0x56')][_0x1335('0x44')]({'where':{'sectionId':_0x34d4da['id']},'raw':!![]})[_0x1335('0x27')](function(_0x26d2e9){var _0x4ddfc4=_[_0x1335('0x2e')](_0x26d2e9,function(_0x59f639){return qs[_0x1335('0x57')](_0x59f639,['id',_0x1335('0x50'),_0x1335('0x51'),_0x1335('0x58')]);});_0x1e7206(_0x4ddfc4);})[_0x1335('0x46')](function(_0x477666){_0x237bbf(_0x477666);});})[_0x1335('0x27')](function(_0x48d0f3){var _0x54ddcb=qs['omit'](_0x34d4da,['id',_0x1335('0x50'),_0x1335('0x51')]);_0x54ddcb[_0x1335('0x59')]=_0x45fee5['id'];if(_0x48d0f3)_0x54ddcb[_0x1335('0x5a')]=_0x48d0f3;return _0x54ddcb;})[_0x1335('0x27')](function(_0x36e0ec){return db[_0x1335('0x53')][_0x1335('0x4c')](_0x36e0ec,{'include':[{'model':db[_0x1335('0x56')],'as':_0x1335('0x5a')}],'raw':!![],'transaction':_0x18f2e6});});})['then'](function(){return _0x45fee5;});}});});});}})['then'](respondWithResult(_0x1dbf58,0xc9))[_0x1335('0x46')](handleError(_0x1dbf58,null));};exports[_0x1335('0x26')]=function(_0x460d6d,_0x380246){if(_0x460d6d[_0x1335('0x4d')]['id']){delete _0x460d6d[_0x1335('0x4d')]['id'];}return db[_0x1335('0x2f')][_0x1335('0x4b')]({'where':{'id':_0x460d6d['params']['id']}})[_0x1335('0x27')](handleEntityNotFound(_0x380246,null))[_0x1335('0x27')](saveUpdates(_0x460d6d[_0x1335('0x4d')],null))['then'](respondWithResult(_0x380246,null))[_0x1335('0x46')](handleError(_0x380246,null));};exports[_0x1335('0x28')]=function(_0x287649,_0x1b0fb8){return db[_0x1335('0x2f')][_0x1335('0x4b')]({'where':{'id':_0x287649[_0x1335('0x48')]['id']}})['then'](handleEntityNotFound(_0x1b0fb8,null))[_0x1335('0x27')](removeEntity(_0x1b0fb8,null))[_0x1335('0x46')](handleError(_0x1b0fb8,null));};exports[_0x1335('0x5b')]=function(_0x217198,_0x2262dc){return db[_0x1335('0x2f')][_0x1335('0x5b')]()[_0x1335('0x27')](respondWithResult(_0x2262dc,null))[_0x1335('0x46')](handleError(_0x2262dc,null));};exports['addSections']=function(_0x2e75c8,_0x3a7d48){var _0x39fcd2=_0x2e75c8[_0x1335('0x4d')];return db[_0x1335('0x2f')][_0x1335('0x4b')]({'where':{'id':_0x2e75c8['params']['id']}})[_0x1335('0x27')](handleEntityNotFound(_0x3a7d48,null))[_0x1335('0x27')](function(_0x4b6b0b){if(_0x4b6b0b){return db[_0x1335('0x5c')]['transaction'](function(_0x4ae62d){return db[_0x1335('0x53')][_0x1335('0x28')]({'where':{'userProfileId':_0x2e75c8[_0x1335('0x48')]['id'],'sectionId':_[_0x1335('0x2e')](_0x39fcd2,function(_0xe60fe1){return _0xe60fe1['sectionId'];})},'transaction':_0x4ae62d})[_0x1335('0x27')](function(){var _0x1a5977=_[_0x1335('0x2e')](_0x39fcd2,function(_0x1f543b){_0x1f543b[_0x1335('0x59')]=_0x2e75c8[_0x1335('0x48')]['id'];return _0x1f543b;});var _0x1efa1d=[];return BPromise[_0x1335('0x54')](_0x1a5977,function(_0x2b13dd){return db[_0x1335('0x53')][_0x1335('0x4c')](_0x2b13dd,{'include':[{'model':db[_0x1335('0x56')],'as':_0x1335('0x5a')}],'raw':!![],'transaction':_0x4ae62d})[_0x1335('0x27')](function(_0x5a7b97){_0x1efa1d[_0x1335('0x5d')](_0x5a7b97[_0x1335('0x4f')]({'plain':!![]}));});})[_0x1335('0x27')](function(){return _0x1efa1d;});});});}})[_0x1335('0x27')](function(_0x2e78de){return _0x2e78de;})[_0x1335('0x27')](respondWithResult(_0x3a7d48,null))['catch'](handleError(_0x3a7d48,null));};exports[_0x1335('0x5e')]=function(_0x462643,_0x4ac962){var _0x4c5412;return db[_0x1335('0x2f')][_0x1335('0x4b')]({'where':{'id':_0x462643[_0x1335('0x48')]['id']},'attributes':['id',_0x1335('0x2b')]})[_0x1335('0x27')](handleEntityNotFound(_0x4ac962,null))['then'](function(_0x44315b){if(_0x44315b){_0x4c5412=_0x44315b;return db[_0x1335('0x53')]['destroy']({'where':{'userProfileId':_0x462643[_0x1335('0x48')]['id'],'sectionId':_0x462643['query']['ids']}});}})[_0x1335('0x27')](function(){return _0x4c5412;})['then'](respondWithStatusCode(_0x4ac962,null))[_0x1335('0x46')](handleError(_0x4ac962,null));};exports[_0x1335('0x5f')]=function(_0x2f0aa3,_0x3c9091){var _0x13d75f=[];var _0x1acaae=[];return db[_0x1335('0x53')][_0x1335('0x44')]({'where':{'userProfileId':_0x2f0aa3[_0x1335('0x48')]['id']},'raw':!![]})['then'](function(_0x2f2c59){_0x13d75f=_[_0x1335('0x3f')](_0x2f2c59,function(_0x6ed10f){return _0x6ed10f['enabled']===0x1||_[_0x1335('0x60')]([0x3eb,0x709],_0x6ed10f[_0x1335('0x58')]);});if(!_[_0x1335('0x61')](_0x13d75f)){return _[_0x1335('0x2e')](_0x13d75f,function(_0x92f840){return _0x92f840[_0x1335('0x58')];});}else{return;}})[_0x1335('0x27')](function(_0x5ed6c8){if(_0x5ed6c8)_0x1acaae=_0x5ed6c8;if(_[_0x1335('0x60')](_0x1acaae,0x64)){var _0x5a16c6=_[_0x1335('0x4b')](_0x13d75f,{'sectionId':0x64});return hasDefaultDashboard(_0x5a16c6)[_0x1335('0x27')](function(_0x429346){return _[_0x1335('0x2e')](_0x13d75f,function(_0x582be4){if(_0x582be4['sectionId']===0x64){_0x582be4[_0x1335('0x62')]=_0x429346;}return _0x582be4;});});}else{return;}})[_0x1335('0x27')](function(_0x14cfc0){if(_0x14cfc0)_0x13d75f=_0x14cfc0;if(_[_0x1335('0x60')](_0x1acaae,0x3eb)){var _0x3253d6=_[_0x1335('0x4b')](_0x13d75f,{'sectionId':0x3eb});return getCustomDashboards(_0x3253d6)[_0x1335('0x27')](function(_0x495122){return _[_0x1335('0x2e')](_0x13d75f,function(_0x2bbfc7){if(_0x3253d6[_0x1335('0x63')]){if(_0x2bbfc7[_0x1335('0x58')]===0x3eb){_0x2bbfc7[_0x1335('0x62')]=_0x495122;}}else{if(_0x2bbfc7[_0x1335('0x58')]===0x64){_0x2bbfc7[_0x1335('0x62')]=_0x495122;}}return _0x2bbfc7;});});}else{return;}})['then'](function(_0x2e502a){if(_0x2e502a)_0x13d75f=_0x2e502a;if(_[_0x1335('0x60')](_0x1acaae,0x709)){var _0x1724a6=_[_0x1335('0x4b')](_0x13d75f,{'sectionId':0x709});return getPlugins(_0x1724a6)[_0x1335('0x27')](function(_0x4f1dd2){if(_0x1724a6[_0x1335('0x63')]){return _[_0x1335('0x2e')](_0x13d75f,function(_0x46bc34){if(_0x46bc34[_0x1335('0x58')]===0x709){_0x46bc34[_0x1335('0x62')]=_0x4f1dd2;}return _0x46bc34;});}else{var _0x176a15={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4f1dd2};var _0x4d181c=_[_0x1335('0x2e')](_0x13d75f);_0x4d181c[_0x1335('0x5d')](_0x176a15);return _0x4d181c;}});}else{return;}})['then'](function(_0x5ef3b0){if(_0x5ef3b0)_0x13d75f=_0x5ef3b0;return _[_0x1335('0x3f')](_0x13d75f,[_0x1335('0x63'),0x1]);})[_0x1335('0x27')](respondWithResult(_0x3c9091,null))[_0x1335('0x46')](handleError(_0x3c9091,null));};function hasDefaultDashboard(_0x3cca8c){var _0x45dc5d=[0x65];return new BPromise(function(_0x463bc8,_0x26d36c){try{if(_0x3cca8c[_0x1335('0x55')]){_0x463bc8(_0x45dc5d);}else{return db['UserProfileResource'][_0x1335('0x64')]({'where':{'sectionId':_0x3cca8c['id']},'raw':!![]})[_0x1335('0x27')](function(_0x4eb40d){_0x4eb40d?_0x463bc8(_0x45dc5d):_0x463bc8();});}}catch(_0x5b07f0){_0x26d36c(_0x5b07f0);}});}function getCustomDashboards(_0x47a612){var _0x13cf3a=[];return new BPromise(function(_0x5b582f,_0x4c39fd){try{if(_0x47a612['autoAssociation']){return db['Dashboard']['findAll']({'raw':!![]})[_0x1335('0x27')](function(_0x382f06){_0x382f06['forEach'](function(_0x1822d9){_0x13cf3a[_0x1335('0x5d')](_0x1822d9['id']+0x1869f);});_0x5b582f(_0x13cf3a);});}else{return db['UserProfileResource'][_0x1335('0x44')]({'where':{'sectionId':_0x47a612['id']},'raw':!![]})[_0x1335('0x27')](function(_0xce28cc){_0xce28cc['forEach'](function(_0xa56b42){_0x13cf3a[_0x1335('0x5d')](_0xa56b42[_0x1335('0x65')]+0x1869f);});_0x5b582f(_0x13cf3a);});}}catch(_0x19a33e){_0x4c39fd(_0x19a33e);}});}function getPlugins(_0xf76b0d){var _0x2ffa99=[];return new BPromise(function(_0x53f90e,_0xd80cab){try{if(_0xf76b0d['autoAssociation']){return db['Plugin']['findAll']({'raw':!![]})[_0x1335('0x27')](function(_0x282b1a){_0x282b1a['forEach'](function(_0x78103d){_0x2ffa99[_0x1335('0x5d')](_0x78103d['id']+0x15b38);});_0x53f90e(_0x2ffa99);});}else{return db[_0x1335('0x56')][_0x1335('0x44')]({'where':{'sectionId':_0xf76b0d['id']},'raw':!![]})[_0x1335('0x27')](function(_0x193f17){_0x193f17[_0x1335('0x66')](function(_0x5bf108){_0x2ffa99[_0x1335('0x5d')](_0x5bf108[_0x1335('0x65')]+0x15b38);});_0x53f90e(_0x2ffa99);});}}catch(_0x2e8aea){_0xd80cab(_0x2e8aea);}});}exports[_0x1335('0x67')]=function(_0x430558,_0x507ae6){return db['UserProfile'][_0x1335('0x4b')]({'where':{'id':_0x430558[_0x1335('0x48')]['id']}})[_0x1335('0x27')](handleEntityNotFound(_0x507ae6,null))[_0x1335('0x27')](function(_0x59cb50){if(_0x59cb50){return db[_0x1335('0x5c')][_0x1335('0x68')](function(_0x20dd77){return db[_0x1335('0x53')]['findAll']({'where':{'userProfileId':_0x430558[_0x1335('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0x1335('0x27')](function(_0x16aeff){if(_0x16aeff){return db[_0x1335('0x53')][_0x1335('0x28')]({'where':{'userProfileId':_0x430558[_0x1335('0x48')]['id'],'id':_[_0x1335('0x2e')](_0x16aeff,function(_0x58a396){return _0x58a396['id'];})},'transaction':_0x20dd77});}})[_0x1335('0x27')](function(_0x47e610){var _0x2818c5=_['map'](_0x430558[_0x1335('0x4d')],function(_0x5772ac){_0x5772ac[_0x1335('0x59')]=_0x430558[_0x1335('0x48')]['id'];return _0x5772ac;});return db[_0x1335('0x53')]['bulkCreate'](_0x2818c5,{'raw':!![],'transaction':_0x20dd77});})[_0x1335('0x27')](function(_0x34595d){var _0x91cf7f=_[_0x1335('0x3f')](_[_0x1335('0x2e')](_0x34595d,function(_0x25584e){return _0x25584e[_0x1335('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x91cf7f){return db[_0x1335('0x53')][_0x1335('0x44')]({'where':{'userProfileId':_0x430558[_0x1335('0x48')]['id'],'sectionId':_[_0x1335('0x2e')](_0x91cf7f,function(_0x5c012d){return _0x5c012d[_0x1335('0x58')];})},'attributes':['id',_0x1335('0x58')],'raw':!![]})[_0x1335('0x27')](function(_0x15d0eb){var _0x2a7431=_['map'](_0x430558[_0x1335('0x4d')],function(_0x3bb77d){_0x3bb77d[_0x1335('0x59')]=_0x430558['params']['id'];return _0x3bb77d;});return db[_0x1335('0x56')][_0x1335('0x69')](_0x2a7431,{'raw':!![],'transaction':_0x20dd77});});}})['catch'](handleError(_0x507ae6,null));});}})[_0x1335('0x27')](function(_0xe34b8c){var _0x2d9ff3=_['map'](_0xe34b8c,function(_0x1eccf0){return _0x1eccf0[_0x1335('0x4f')]({'plain':!![]});});})[_0x1335('0x27')](respondWithResult(_0x507ae6,null))['catch'](handleError(_0x507ae6,null));};exports[_0x1335('0x6a')]=function(_0x4168d7,_0x20a9d2,_0x23ad9b){return db['UserProfile'][_0x1335('0x4b')]({'where':{'id':_0x4168d7[_0x1335('0x48')]['id']}})[_0x1335('0x27')](handleEntityNotFound(_0x20a9d2,null))[_0x1335('0x27')](function(_0x204f44){if(_0x204f44){return _0x204f44[_0x1335('0x6a')](_0x4168d7[_0x1335('0x34')][_0x1335('0x6b')]);}})[_0x1335('0x27')](respondWithStatusCode(_0x20a9d2,null))[_0x1335('0x46')](handleError(_0x20a9d2,null));};exports['getResources']=function(_0x46aa0f,_0x1096c6){var _0x16d4b9={'raw':![],'where':{}};var _0x565215={};var _0x4434e6={'count':0x0,'rows':[]};var _0x3e7771=_0x46aa0f['query'][_0x1335('0x6c')];if(typeof _0x3e7771===_0x1335('0x6d')){throw new db[(_0x1335('0x6e'))]['ValidationError'](_0x1335('0x6f'));}var _0x5c4162=_0x46aa0f[_0x1335('0x34')][_0x1335('0x70')]||![];var _0x47c8e4=getQueryModels(_0x3e7771,_0x5c4162);if(typeof _0x47c8e4[_0x1335('0x71')]==='undefined'){throw new db[(_0x1335('0x6e'))][(_0x1335('0x72'))](_0x1335('0x73')+_0x3e7771+'\x27');}var _0x1b498c=[];if(!_['isEmpty'](_0x47c8e4['parentSections'])){_0x1b498c=_0x47c8e4['parentSections'];}else{_0x1b498c=[{'name':_0x3e7771}];}return db[_0x1335('0x2f')]['findOne']({'where':{'id':_0x46aa0f['params']['id']}})['then'](handleEntityNotFound(_0x1096c6,null))[_0x1335('0x27')](function(_0x42f86d){if(_0x42f86d){var _0x1a7e68=[];for(var _0x2b4f3a=0x0;_0x2b4f3a<_0x1b498c[_0x1335('0x49')];_0x2b4f3a++){_0x1a7e68['push'](db[_0x1335('0x53')][_0x1335('0x64')]({'where':{'userProfileId':_0x42f86d['id'],'name':_0x1b498c[_0x2b4f3a]['name']},'raw':!![]}));}return BPromise['all'](_0x1a7e68);}})[_0x1335('0x27')](function(_0xfe9284){var _0x4715b1=_['filter'](_0xfe9284,function(_0x195da7){return _0x195da7?_0x195da7:undefined;});var _0x1af956=_[_0x1335('0x3f')](_0x1b498c,['ignore',!![]]);var _0x3a64d0=_[_0x1335('0x61')](_0x4715b1)&&_[_0x1335('0x61')](_0x1af956)?null:_['union'](_0x1af956,_0x4715b1);if(_0x3a64d0){var _0x69f943=[];for(var _0x7bcd0d=0x0;_0x7bcd0d<_0x3a64d0[_0x1335('0x49')];_0x7bcd0d++){var _0x2c9b24=_['find'](_0x1b498c,function(_0xb2bb02){return _0x3a64d0[_0x7bcd0d]?_0xb2bb02[_0x1335('0x2b')]===_0x3a64d0[_0x7bcd0d]['name']:null;});if(_0x2c9b24){if(_0x3a64d0[_0x7bcd0d][_0x1335('0x74')]){_0x69f943['push'](getAllResources(_0x47c8e4['childModel'],_0x3a64d0[_0x7bcd0d]));}else{if(!_0x3a64d0[_0x7bcd0d][_0x1335('0x55')]){_0x69f943['push'](getAllowedResources(_0x2c9b24,_0x3a64d0[_0x7bcd0d],_0x47c8e4['childModel']));}else{if(_0x2c9b24[_0x1335('0x32')]){_0x69f943[_0x1335('0x5d')](getAllFilteredResources(_0x2c9b24,_0x3a64d0[_0x7bcd0d]));}}}}}return BPromise[_0x1335('0x75')](_0x69f943);}else{return null;}})[_0x1335('0x27')](function(_0x330868){var _0x8e79a4=_0x330868;var _0x3906e8=null;if(_0x8e79a4){_0x3906e8=_0x8e79a4[_0x1335('0x49')]===0x1?_0x8e79a4[0x0]:null;}if(_0x3906e8||_0x8e79a4){var _0x133436=db[_0x47c8e4['childModel']]['rawAttributes'];_0x565215[_0x1335('0x32')]=_[_0x1335('0x33')](_0x133436);_0x565215[_0x1335('0x34')]=_['keys'](_0x46aa0f[_0x1335('0x34')]);_0x565215[_0x1335('0x35')]=_[_0x1335('0x36')](_0x565215[_0x1335('0x32')],_0x565215[_0x1335('0x34')]);_0x16d4b9[_0x1335('0x37')]=_[_0x1335('0x36')](_0x565215[_0x1335('0x32')],qs['fields'](_0x46aa0f[_0x1335('0x34')][_0x1335('0x38')]));_0x16d4b9[_0x1335('0x37')]=_0x16d4b9[_0x1335('0x37')][_0x1335('0x49')]?_0x16d4b9[_0x1335('0x37')]:_0x565215[_0x1335('0x32')];if(!_0x46aa0f[_0x1335('0x34')][_0x1335('0x39')](_0x1335('0x3a'))){_0x16d4b9['limit']=qs[_0x1335('0x3b')](_0x46aa0f[_0x1335('0x34')]['limit']);_0x16d4b9[_0x1335('0x3c')]=qs[_0x1335('0x3c')](_0x46aa0f['query'][_0x1335('0x3c')]);}_0x16d4b9[_0x1335('0x76')]=qs[_0x1335('0x3d')](_0x46aa0f['query'][_0x1335('0x3d')]);_0x16d4b9[_0x1335('0x3e')]=qs[_0x1335('0x35')](_[_0x1335('0x77')](_0x46aa0f[_0x1335('0x34')],_0x565215[_0x1335('0x35')]));if(_0x46aa0f[_0x1335('0x34')]['filter']){_0x16d4b9['where']=_['merge'](_0x16d4b9[_0x1335('0x3e')],{'$or':_['map'](_0x133436,function(_0x467661){if(_0x467661[_0x1335('0x31')][_0x1335('0x78')]!==_0x1335('0x40')){var _0x59d643={};_0x59d643[_0x467661[_0x1335('0x79')]]={'$like':'%'+_0x46aa0f[_0x1335('0x34')]['filter']+'%'};return _0x59d643;}})});}var _0x357151=[];if(_0x3906e8){var _0x904845=_['find'](_0x1b498c,[_0x1335('0x2b'),_0x3906e8[_0x1335('0x2b')]]);if(_0x904845[_0x1335('0x79')]){var _0x206c71={};if(_0x47c8e4[_0x1335('0x71')]===_0x1335('0x7a')){_0x206c71[_0x904845[_0x1335('0x7b')]]=_[_0x1335('0x2e')](_0x3906e8[_0x1335('0x7c')],'id');}else{_0x206c71[_0x904845[_0x1335('0x7b')]]=_0x3906e8[_0x1335('0x7c')];}_0x357151[_0x1335('0x5d')](_0x206c71);}else{_0x16d4b9[_0x1335('0x3e')]['id']=_0x3906e8[_0x1335('0x7c')];}}else{for(var _0x2d93d0=0x0;_0x2d93d0<_0x8e79a4[_0x1335('0x49')];_0x2d93d0++){var _0x904845=_['find'](_0x1b498c,[_0x1335('0x2b'),_0x8e79a4[_0x2d93d0]['name']]);if(_0x904845[_0x1335('0x79')]){var _0x206c71={};_0x206c71[_0x904845['foreignKey']]=_0x8e79a4[_0x2d93d0]['associatedResources'];_0x357151[_0x1335('0x5d')](_0x206c71);}else{if(!_0x16d4b9[_0x1335('0x3e')]['id'])_0x16d4b9[_0x1335('0x3e')]['id']=[];_0x8e79a4[_0x2d93d0]['associatedResources'][_0x1335('0x66')](function(_0xd7fba6){_0x16d4b9['where']['id'][_0x1335('0x5d')](_0xd7fba6);});}}}if(!_[_0x1335('0x61')](_0x357151)){_0x16d4b9[_0x1335('0x3e')]=_['merge'](_0x16d4b9[_0x1335('0x3e')],{'$and':{'$or':_0x357151}});}_0x16d4b9=_['merge']({},_0x16d4b9,_0x46aa0f[_0x1335('0x41')]);if(_0x3906e8&&!_0x3906e8[_0x1335('0x55')]&&_0x47c8e4[_0x1335('0x71')]===_0x1335('0x7a')){if(_0x46aa0f['query'][_0x1335('0x42')]){_0x16d4b9[_0x1335('0x43')]=[{'all':!![]}];}return db[_0x47c8e4[_0x1335('0x71')]]['findAll'](_0x16d4b9)[_0x1335('0x27')](function(_0x4b0696){var _0x549efd=[];_0x4b0696['forEach'](function(_0x54aa0b){var _0x577f7a;switch(_0x54aa0b[_0x1335('0x7d')]){case _0x1335('0x7e'):_0x577f7a=_['find'](_0x3906e8[_0x1335('0x7c')],function(_0x55bbf4){return _0x55bbf4['id']===_0x54aa0b[_0x1335('0x7f')]&&_0x55bbf4[_0x1335('0x31')]===_0x1335('0x80');});break;case _0x1335('0x81'):_0x577f7a=_['find'](_0x3906e8[_0x1335('0x7c')],function(_0x4ecc3b){return _0x4ecc3b['id']===_0x54aa0b[_0x1335('0x7f')]&&_0x4ecc3b[_0x1335('0x31')]===_0x1335('0x82');});break;}if(_0x577f7a)_0x549efd[_0x1335('0x5d')](_0x54aa0b);});_0x4434e6[_0x1335('0x22')]=_0x549efd[_0x1335('0x49')];_0x4434e6[_0x1335('0x45')]=_0x549efd;return _0x4434e6;});}else{return db[_0x47c8e4[_0x1335('0x71')]]['count']({'where':_0x16d4b9[_0x1335('0x3e')]})[_0x1335('0x27')](function(_0x1084da){_0x4434e6[_0x1335('0x22')]=_0x1084da;if(_0x46aa0f['query'][_0x1335('0x42')]){if(_0x47c8e4[_0x1335('0x71')]===_0x1335('0x83')){_0x16d4b9[_0x1335('0x43')]=[{'model':db[_0x1335('0x84')],'as':_0x1335('0x85'),'attributes':['id','name',_0x1335('0x86')],'required':_0x46aa0f[_0x1335('0x34')]['tag']?!![]:![]},{'model':db[_0x1335('0x84')],'as':_0x1335('0x87'),'attributes':['id','name',_0x1335('0x86')],'through':_0x46aa0f[_0x1335('0x34')][_0x1335('0x88')]?{'attributes':[],'where':{'TagId':_0x46aa0f[_0x1335('0x34')][_0x1335('0x88')]||undefined}}:{},'required':_0x46aa0f[_0x1335('0x34')]['tag']?!![]:![]}];}else{_0x16d4b9[_0x1335('0x43')]=[{'all':!![]}];}}return db[_0x47c8e4[_0x1335('0x71')]][_0x1335('0x44')](_0x16d4b9);})[_0x1335('0x27')](function(_0x330417){_0x4434e6[_0x1335('0x45')]=_0x330417;return _0x4434e6;});}}else{return _0x4434e6;}})[_0x1335('0x27')](respondWithFilteredResult(_0x1096c6,_0x16d4b9))[_0x1335('0x46')](handleError(_0x1096c6,null));};function getAllResources(_0x1ab56c,_0x299f15){return new BPromise(function(_0x593c29,_0x475038){if(_0x299f15){var _0x11703a=_0x299f15[_0x1335('0x3f')]?{[_0x299f15['filter'][_0x1335('0x79')]]:_0x299f15[_0x1335('0x3f')][_0x1335('0x89')]}:undefined;return db[_0x1ab56c][_0x1335('0x44')]({'where':_0x11703a,'raw':!![]})[_0x1335('0x27')](function(_0x5c74a4){_0x299f15[_0x1335('0x7c')]=_[_0x1335('0x2e')](_0x5c74a4,'id');_0x593c29(_0x299f15);})['catch'](function(_0xbe631f){_0x475038(_0xbe631f);});}else{_0x593c29(null);}});}function getAllFilteredResources(_0x32c61c,_0x3bd5dc){return new BPromise(function(_0x3c8b44,_0x5025fa){var _0x1c6a3e=_0x32c61c[_0x1335('0x3f')]?{[_0x32c61c['filter'][_0x1335('0x79')]]:_0x32c61c[_0x1335('0x3f')]['value']}:undefined;return db[_0x32c61c[_0x1335('0x32')]]['findAll']({'where':_0x1c6a3e,'raw':!![]})[_0x1335('0x27')](function(_0x3f939f){_0x3bd5dc[_0x1335('0x7c')]=_['map'](_0x3f939f,function(_0xda62f8){return _0xda62f8[_0x1335('0x2b')];});_0x3c8b44(_0x3bd5dc);})['catch'](function(_0x2883e7){_0x5025fa(_0x2883e7);});});}function getAllowedResources(_0x514768,_0x3e098d,_0x1e642d){return new BPromise(function(_0x486d85,_0x198f62){if(_0x3e098d){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x3e098d['id']},'raw':!![]})[_0x1335('0x27')](function(_0x2a3b43){if(_0x514768[_0x1335('0x79')]&&_0x514768[_0x1335('0x79')]!=='id'){_0x3e098d[_0x1335('0x7c')]=_[_0x1335('0x2e')](_0x2a3b43,function(_0x5c401f){return _0x5c401f[_0x514768[_0x1335('0x79')]];});}else{if(_0x1e642d===_0x1335('0x7a')){_0x3e098d[_0x1335('0x7c')]=_[_0x1335('0x2e')](_0x2a3b43,function(_0x14087d){return{'id':_0x14087d[_0x1335('0x65')],'type':_0x14087d[_0x1335('0x31')]};});}else{_0x3e098d[_0x1335('0x7c')]=_[_0x1335('0x2e')](_0x2a3b43,function(_0x55bb1e){return _0x55bb1e[_0x1335('0x65')];});}}_0x486d85(_0x3e098d);})[_0x1335('0x46')](function(_0x3ee76f){_0x198f62(_0x3ee76f);});}else{_0x486d85(null);}});}function getQueryModels(_0x318b40,_0x37a6cb){var _0x307105=_0x318b40[_0x1335('0x8a')]();var _0x4fc297={'childModel':undefined,'parentSections':[]};switch(_0x307105){case _0x1335('0x8b'):_0x4fc297[_0x1335('0x71')]=_0x1335('0x8c');break;case _0x1335('0x8d'):_0x4fc297[_0x1335('0x71')]=_0x1335('0x8e');break;case'squarerecordings':_0x4fc297[_0x1335('0x71')]=_0x1335('0x8f');_0x4fc297['parentSections']=[{'name':_0x1335('0x90'),'field':_0x1335('0x2b'),'foreignKey':_0x1335('0x91')}];break;case _0x1335('0x92'):_0x4fc297['childModel']='JscriptyProject';break;case _0x1335('0x93'):_0x4fc297[_0x1335('0x71')]='CmContact';_0x4fc297[_0x1335('0x94')]=[{'name':_0x1335('0x95'),'field':'id','foreignKey':'ListId'}];break;case _0x1335('0x96'):_0x4fc297[_0x1335('0x71')]=_0x1335('0x97');break;case'companies':_0x4fc297[_0x1335('0x71')]=_0x1335('0x98');break;case'globalcustomfields':_0x4fc297[_0x1335('0x71')]=_0x1335('0x99');break;case _0x1335('0x9a'):_0x4fc297[_0x1335('0x71')]='ChatQueue';break;case'chatwebsites':_0x4fc297[_0x1335('0x71')]=_0x1335('0x9b');break;case _0x1335('0x9c'):_0x4fc297['childModel']=_0x1335('0x9d');break;case _0x1335('0x9e'):_0x4fc297['childModel']=_0x1335('0x9f');break;case _0x1335('0xa0'):case _0x1335('0xa1'):case _0x1335('0xa2'):_0x4fc297['childModel']=_0x1335('0xa3');break;case _0x1335('0xa4'):_0x4fc297[_0x1335('0x71')]=_0x1335('0xa5');break;case _0x1335('0xa6'):_0x4fc297[_0x1335('0x71')]=_0x1335('0xa7');break;case'voicerecordings':_0x4fc297[_0x1335('0x71')]=_0x1335('0xa8');_0x4fc297[_0x1335('0x94')]=[{'name':_0x1335('0xa9'),'field':_0x1335('0x2b'),'foreignKey':_0x1335('0xaa'),'model':_0x1335('0xab'),'filter':{'field':_0x1335('0xac'),'value':[_0x1335('0xad')]}},{'name':_0x1335('0xae'),'field':_0x1335('0x2b'),'foreignKey':_0x1335('0xaa'),'model':_0x1335('0xab'),'filter':{'field':_0x1335('0xac'),'value':['telephone']}},{'name':_0x1335('0xaf'),'field':_0x1335('0x2b'),'foreignKey':_0x1335('0xb0'),'model':_0x1335('0xb1'),'filter':{'field':_0x1335('0x31'),'value':[_0x1335('0xb2')]}},{'name':_0x1335('0xb3'),'field':_0x1335('0x2b'),'foreignKey':_0x1335('0xb0'),'model':_0x1335('0xb1'),'filter':{'field':'type','value':[_0x1335('0xb4')]}}];break;case _0x1335('0xb5'):_0x4fc297[_0x1335('0x71')]=_0x1335('0xb6');break;case _0x1335('0xb7'):_0x4fc297[_0x1335('0x71')]=_0x1335('0xb8');break;case _0x1335('0xb9'):_0x4fc297['childModel']=_0x1335('0xba');break;case _0x1335('0xbb'):_0x4fc297[_0x1335('0x71')]='Campaign';break;case _0x1335('0xbc'):_0x4fc297[_0x1335('0x71')]=_0x1335('0xbd');break;case _0x1335('0xbe'):_0x4fc297[_0x1335('0x71')]=_0x1335('0xbf');break;case'mailsubstatuses':_0x4fc297['childModel']='MailSubstatus';break;case _0x1335('0xc0'):_0x4fc297[_0x1335('0x71')]=_0x1335('0xc1');break;case _0x1335('0xc2'):_0x4fc297[_0x1335('0x71')]=_0x1335('0xc3');break;case'smsqueues':_0x4fc297[_0x1335('0x71')]=_0x1335('0xc4');break;case _0x1335('0xc5'):_0x4fc297[_0x1335('0x71')]=_0x1335('0xc6');break;case _0x1335('0xc7'):_0x4fc297[_0x1335('0x71')]=_0x1335('0xc8');break;case _0x1335('0xc9'):_0x4fc297['childModel']=_0x1335('0xca');break;case _0x1335('0xcb'):_0x4fc297[_0x1335('0x71')]=_0x1335('0xcc');break;case _0x1335('0xcd'):case'queuecampaigns':_0x4fc297[_0x1335('0x71')]=_0x1335('0xb1');if(_0x37a6cb){_0x4fc297[_0x1335('0x94')]=[{'name':_0x1335('0xaf')},{'name':_0x1335('0xb3')}];}break;case _0x1335('0xce'):case _0x1335('0xcf'):case _0x1335('0xd0'):_0x4fc297[_0x1335('0x71')]=_0x1335('0xab');if(_0x37a6cb){_0x4fc297[_0x1335('0x94')]=[{'name':_0x1335('0xd1'),'filter':{'field':_0x1335('0xac'),'value':[_0x1335('0xd2'),_0x1335('0xd3')]},'ignore':!![]},{'name':_0x1335('0xa9')},{'name':_0x1335('0xae')}];}break;case _0x1335('0xd4'):_0x4fc297[_0x1335('0x71')]='ZendeskAccount';break;case'salesforceaccounts':_0x4fc297[_0x1335('0x71')]=_0x1335('0xd5');break;case _0x1335('0xd6'):_0x4fc297[_0x1335('0x71')]='FreshdeskAccount';break;case _0x1335('0xd7'):_0x4fc297[_0x1335('0x71')]='SugarcrmAccount';break;case'deskaccounts':_0x4fc297['childModel']=_0x1335('0xd8');break;case'zohoaccounts':_0x4fc297[_0x1335('0x71')]='ZohoAccount';break;case _0x1335('0xd9'):_0x4fc297[_0x1335('0x71')]=_0x1335('0xab');break;case'cannedanswers':_0x4fc297[_0x1335('0x71')]=_0x1335('0xda');break;case _0x1335('0xdb'):_0x4fc297[_0x1335('0x71')]=_0x1335('0xdc');break;case'customdashboards':_0x4fc297[_0x1335('0x71')]=_0x1335('0xdd');break;case _0x1335('0xde'):_0x4fc297[_0x1335('0x71')]=_0x1335('0xdf');break;case'pauses':_0x4fc297['childModel']=_0x1335('0xe0');break;case _0x1335('0xe1'):_0x4fc297[_0x1335('0x71')]=_0x1335('0xe2');break;case _0x1335('0xe3'):_0x4fc297[_0x1335('0x71')]=_0x1335('0xe4');break;case'tags':_0x4fc297[_0x1335('0x71')]='Tag';break;case _0x1335('0xe5'):_0x4fc297[_0x1335('0x71')]=_0x1335('0xe6');break;case _0x1335('0xe7'):_0x4fc297[_0x1335('0x71')]=_0x1335('0xe8');break;case _0x1335('0xe9'):_0x4fc297['childModel']=_0x1335('0xea');break;case _0x1335('0xeb'):_0x4fc297['childModel']=_0x1335('0xec');break;case _0x1335('0xed'):_0x4fc297[_0x1335('0x71')]=_0x1335('0xee');break;case'extractedreports':_0x4fc297[_0x1335('0x71')]=_0x1335('0x7a');_0x4fc297[_0x1335('0x94')]=[{'name':'Reports','field':'id','foreignKey':_0x1335('0x7f')}];break;case _0x1335('0xef'):_0x4fc297[_0x1335('0x71')]=_0x1335('0xf0');break;case _0x1335('0xc9'):_0x4fc297[_0x1335('0x71')]='WhatsappAccount';break;default:return _0x4fc297;}return _0x4fc297;} \ No newline at end of file +var _0x4c63=['sounds','Sound','Template','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','AnalyticMetric','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','catch','params','length','include','find','create','body','get','omit','createdAt','updatedAt','sequelize','transaction','UserProfileSection','findAll','autoAssociation','sectionId','userProfileId','Resources','describe','addSections','each','UserProfileResource','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','push','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','undefined','Sequelize','mergeResources','childModel','ValidationError','Invalid\x20section\x20\x27','parentSections','all','ignore','VIRTUAL','field','AnalyticExtractedReport','associatedResources','foreignKey','reportType','default','reportId','DefaultReports','custom','CustomReports','rows','CmContact','Tag','color','tag','ThroughTags','value','toLowerCase','squareprojects','SquareProject','odbc','squarerecordings','SquareRecording','projectName','projects','contacts','Lists','ListId','lists','companies','CmCompany','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','outboundroutes','VoiceContext','voicemails','VoiceRecording','membername','User','role','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','deskaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule'];(function(_0x3cc05d,_0x4b8f88){var _0x28b736=function(_0x369b0e){while(--_0x369b0e){_0x3cc05d['push'](_0x3cc05d['shift']());}};_0x28b736(++_0x4b8f88);}(_0x4c63,0xf2));var _0x34c6=function(_0x42c454,_0x4f96cd){_0x42c454=_0x42c454-0x0;var _0x8cbf0d=_0x4c63[_0x42c454];return _0x8cbf0d;};'use strict';var pdf=require(_0x34c6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x34c6('0x1'));var zipdir=require(_0x34c6('0x2'));var jsonpatch=require(_0x34c6('0x3'));var rp=require(_0x34c6('0x4'));var moment=require(_0x34c6('0x5'));var BPromise=require(_0x34c6('0x6'));var Mustache=require(_0x34c6('0x7'));var util=require(_0x34c6('0x8'));var path=require(_0x34c6('0x9'));var sox=require(_0x34c6('0xa'));var csv=require(_0x34c6('0xb'));var ejs=require(_0x34c6('0xc'));var fs=require('fs');var _=require(_0x34c6('0xd'));var squel=require(_0x34c6('0xe'));var crypto=require('crypto');var jsforce=require(_0x34c6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x34c6('0xb'));var querystring=require('querystring');var Papa=require(_0x34c6('0x10'));var Redis=require('ioredis');var authService=require(_0x34c6('0x11'));var qs=require(_0x34c6('0x12'));var as=require(_0x34c6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x34c6('0x14'));var licenseUtil=require(_0x34c6('0x15'));var db=require('../../mysqldb')['db'];config[_0x34c6('0x16')]=_[_0x34c6('0x17')](config['redis'],{'host':_0x34c6('0x18'),'port':0x18eb});var socket=require(_0x34c6('0x19'))(new Redis(config['redis']));require(_0x34c6('0x1a'))['register'](socket);function respondWithStatusCode(_0x5d539f,_0x474920){_0x474920=_0x474920||0xcc;return function(_0x18c7f0){if(_0x18c7f0){return _0x5d539f['sendStatus'](_0x474920);}return _0x5d539f['status'](_0x474920)['end']();};}function respondWithResult(_0x4d7118,_0x2b6aa4){_0x2b6aa4=_0x2b6aa4||0xc8;return function(_0x291277){if(_0x291277){return _0x4d7118[_0x34c6('0x1b')](_0x2b6aa4)[_0x34c6('0x1c')](_0x291277);}};}function respondWithFilteredResult(_0x4ca108,_0x41ca9e){return function(_0x4e21fc){if(_0x4e21fc){var _0x29781b=_0x4e21fc[_0x34c6('0x1d')],_0x39214c=_0x41ca9e[_0x34c6('0x1e')],_0x1425c6=_0x41ca9e[_0x34c6('0x1e')]+_0x41ca9e[_0x34c6('0x1f')],_0x1b0fdb;if(_0x1425c6>=_0x29781b){_0x1425c6=_0x29781b;_0x1b0fdb=0xc8;}else{_0x1b0fdb=0xce;}_0x4ca108[_0x34c6('0x1b')](_0x1b0fdb);return _0x4ca108['set'](_0x34c6('0x20'),_0x39214c+'-'+_0x1425c6+'/'+_0x29781b)[_0x34c6('0x1c')](_0x4e21fc);}return null;};}function patchUpdates(_0x108624){return function(_0x57ec7d){try{jsonpatch['apply'](_0x57ec7d,_0x108624,!![]);}catch(_0x3d90d1){return BPromise[_0x34c6('0x21')](_0x3d90d1);}return _0x57ec7d[_0x34c6('0x22')]();};}function saveUpdates(_0x3ec069,_0x4db037){return function(_0x248a53){if(_0x248a53){return _0x248a53[_0x34c6('0x23')](_0x3ec069)[_0x34c6('0x24')](function(_0x4192b2){return _0x4192b2;});}return null;};}function removeEntity(_0x2aa028,_0x43df7a){return function(_0x3988fd){if(_0x3988fd){return _0x3988fd[_0x34c6('0x25')]()[_0x34c6('0x24')](function(){_0x2aa028['status'](0xcc)[_0x34c6('0x26')]();});}};}function handleEntityNotFound(_0x338237,_0x34bc9b){return function(_0x5c1efa){if(!_0x5c1efa){_0x338237['sendStatus'](0x194);}return _0x5c1efa;};}function handleError(_0x109b9f,_0x31215b){_0x31215b=_0x31215b||0x1f4;return function(_0x2194aa){logger[_0x34c6('0x27')](_0x2194aa[_0x34c6('0x28')]);if(_0x2194aa['name']){delete _0x2194aa[_0x34c6('0x29')];}_0x109b9f[_0x34c6('0x1b')](_0x31215b)[_0x34c6('0x2a')](_0x2194aa);};}exports[_0x34c6('0x2b')]=function(_0x1dd57c,_0x4ecf64){var _0x5fd795={},_0x4d77fc={},_0x49d09f={'count':0x0,'rows':[]};var _0x5e4bce=_['map'](db[_0x34c6('0x2c')][_0x34c6('0x2d')],function(_0x16638c){return{'name':_0x16638c[_0x34c6('0x2e')],'type':_0x16638c[_0x34c6('0x2f')][_0x34c6('0x30')]};});_0x4d77fc[_0x34c6('0x31')]=_[_0x34c6('0x32')](_0x5e4bce,'name');_0x4d77fc[_0x34c6('0x33')]=_[_0x34c6('0x34')](_0x1dd57c[_0x34c6('0x33')]);_0x4d77fc[_0x34c6('0x35')]=_[_0x34c6('0x36')](_0x4d77fc[_0x34c6('0x31')],_0x4d77fc[_0x34c6('0x33')]);_0x5fd795['attributes']=_[_0x34c6('0x36')](_0x4d77fc[_0x34c6('0x31')],qs[_0x34c6('0x37')](_0x1dd57c[_0x34c6('0x33')][_0x34c6('0x37')]));_0x5fd795[_0x34c6('0x38')]=_0x5fd795[_0x34c6('0x38')]['length']?_0x5fd795[_0x34c6('0x38')]:_0x4d77fc['model'];if(!_0x1dd57c[_0x34c6('0x33')][_0x34c6('0x39')](_0x34c6('0x3a'))){_0x5fd795[_0x34c6('0x1f')]=qs[_0x34c6('0x1f')](_0x1dd57c['query']['limit']);_0x5fd795['offset']=qs[_0x34c6('0x1e')](_0x1dd57c[_0x34c6('0x33')]['offset']);}_0x5fd795[_0x34c6('0x3b')]=qs[_0x34c6('0x3c')](_0x1dd57c[_0x34c6('0x33')][_0x34c6('0x3c')]);_0x5fd795[_0x34c6('0x3d')]=qs[_0x34c6('0x35')](_[_0x34c6('0x3e')](_0x1dd57c[_0x34c6('0x33')],_0x4d77fc[_0x34c6('0x35')]),_0x5e4bce);if(_0x1dd57c[_0x34c6('0x33')][_0x34c6('0x3f')]){_0x5fd795[_0x34c6('0x3d')]=_[_0x34c6('0x40')](_0x5fd795['where'],{'$or':_[_0x34c6('0x32')](_0x5e4bce,function(_0x2ccca6){if(_0x2ccca6[_0x34c6('0x2f')]!=='VIRTUAL'){var _0xc46567={};_0xc46567[_0x2ccca6[_0x34c6('0x29')]]={'$like':'%'+_0x1dd57c['query'][_0x34c6('0x3f')]+'%'};return _0xc46567;}})});}_0x5fd795=_[_0x34c6('0x40')]({},_0x5fd795,_0x1dd57c[_0x34c6('0x41')]);var _0x52c007={'where':_0x5fd795[_0x34c6('0x3d')]};return db[_0x34c6('0x2c')]['count'](_0x52c007)[_0x34c6('0x24')](function(_0x190c76){_0x49d09f[_0x34c6('0x1d')]=_0x190c76;if(_0x1dd57c[_0x34c6('0x33')][_0x34c6('0x42')]){_0x5fd795['include']=[{'all':!![]}];}return db[_0x34c6('0x2c')]['findAll'](_0x5fd795);})[_0x34c6('0x24')](function(_0x52932f){_0x49d09f['rows']=_0x52932f;return _0x49d09f;})[_0x34c6('0x24')](respondWithFilteredResult(_0x4ecf64,_0x5fd795))[_0x34c6('0x43')](handleError(_0x4ecf64,null));};exports['show']=function(_0x475d1c,_0x45a641){var _0xd4bb6c={'raw':![],'where':{'id':_0x475d1c[_0x34c6('0x44')]['id']}},_0x1cef70={};_0x1cef70['model']=_[_0x34c6('0x34')](db[_0x34c6('0x2c')][_0x34c6('0x2d')]);_0x1cef70['query']=_[_0x34c6('0x34')](_0x475d1c[_0x34c6('0x33')]);_0x1cef70[_0x34c6('0x35')]=_[_0x34c6('0x36')](_0x1cef70['model'],_0x1cef70['query']);_0xd4bb6c['attributes']=_[_0x34c6('0x36')](_0x1cef70[_0x34c6('0x31')],qs[_0x34c6('0x37')](_0x475d1c[_0x34c6('0x33')][_0x34c6('0x37')]));_0xd4bb6c[_0x34c6('0x38')]=_0xd4bb6c[_0x34c6('0x38')][_0x34c6('0x45')]?_0xd4bb6c[_0x34c6('0x38')]:_0x1cef70[_0x34c6('0x31')];if(_0x475d1c[_0x34c6('0x33')][_0x34c6('0x42')]){_0xd4bb6c[_0x34c6('0x46')]=[{'all':!![]}];}_0xd4bb6c=_[_0x34c6('0x40')]({},_0xd4bb6c,_0x475d1c['options']);return db[_0x34c6('0x2c')][_0x34c6('0x47')](_0xd4bb6c)[_0x34c6('0x24')](handleEntityNotFound(_0x45a641,null))[_0x34c6('0x24')](respondWithResult(_0x45a641,null))[_0x34c6('0x43')](handleError(_0x45a641,null));};exports['create']=function(_0x2100a1,_0xb532d4){return db['UserProfile'][_0x34c6('0x48')](_0x2100a1[_0x34c6('0x49')],{})['then'](respondWithResult(_0xb532d4,0xc9))['catch'](handleError(_0xb532d4,null));};exports['clone']=function(_0x1d992f,_0x19eb9a){var _0x3d9dbe={'where':{'id':_0x1d992f[_0x34c6('0x44')]['id']}},_0x596886={};_0x596886[_0x34c6('0x31')]=_[_0x34c6('0x34')](db['UserProfile'][_0x34c6('0x2d')]);_0x3d9dbe[_0x34c6('0x38')]=_[_0x34c6('0x36')](_0x596886[_0x34c6('0x31')],qs[_0x34c6('0x37')](_0x1d992f[_0x34c6('0x33')]['fields']));_0x3d9dbe[_0x34c6('0x38')]=_0x3d9dbe[_0x34c6('0x38')][_0x34c6('0x45')]?_0x3d9dbe['attributes']:_0x596886[_0x34c6('0x31')];if(_0x1d992f[_0x34c6('0x33')]['includeAll']){_0x3d9dbe[_0x34c6('0x46')]=[{'all':!![]}];}_0x3d9dbe=_['merge']({},_0x3d9dbe,_0x1d992f['options']);return db['UserProfile'][_0x34c6('0x47')](_0x3d9dbe)['then'](handleEntityNotFound(_0x19eb9a,null))[_0x34c6('0x24')](function(_0x187cfc){if(_0x187cfc){var _0x4dc761=_0x187cfc[_0x34c6('0x4a')]({'plain':!![]});_0x4dc761=qs[_0x34c6('0x4b')](_0x4dc761,['id',_0x34c6('0x4c'),_0x34c6('0x4d'),'crudPermissions']);_0x1d992f[_0x34c6('0x49')]=_[_0x34c6('0x4b')](_0x1d992f[_0x34c6('0x49')],['id',_0x34c6('0x4c'),_0x34c6('0x4d')]);return db[_0x34c6('0x4e')][_0x34c6('0x4f')](function(_0x4acca4){return db[_0x34c6('0x2c')][_0x34c6('0x48')](_[_0x34c6('0x40')](_0x4dc761,_0x1d992f[_0x34c6('0x49')]),{'include':_0x1d992f[_0x34c6('0x33')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x4acca4})['then'](function(_0x5f31bb){var _0x457f0b=_0x5f31bb[_0x34c6('0x4a')]({'plain':!![]});return db[_0x34c6('0x50')][_0x34c6('0x51')]({'where':{'userProfileId':_0x1d992f[_0x34c6('0x44')]['id']},'raw':!![]})['then'](function(_0x29b4ab){if(_0x29b4ab){return BPromise['each'](_0x29b4ab,function(_0x26b201){return new BPromise(function(_0x2bcf6e,_0x422436){if(_0x26b201['autoAssociation']===null||_0x26b201[_0x34c6('0x52')]===0x1)_0x2bcf6e(null);return db['UserProfileResource'][_0x34c6('0x51')]({'where':{'sectionId':_0x26b201['id']},'raw':!![]})[_0x34c6('0x24')](function(_0x232fdf){var _0x3ee2dd=_[_0x34c6('0x32')](_0x232fdf,function(_0x25ea5b){return qs['omit'](_0x25ea5b,['id',_0x34c6('0x4c'),_0x34c6('0x4d'),_0x34c6('0x53')]);});_0x2bcf6e(_0x3ee2dd);})[_0x34c6('0x43')](function(_0x4e6e1d){_0x422436(_0x4e6e1d);});})['then'](function(_0x2edadb){var _0x41be7f=qs['omit'](_0x26b201,['id',_0x34c6('0x4c'),'updatedAt']);_0x41be7f[_0x34c6('0x54')]=_0x457f0b['id'];if(_0x2edadb)_0x41be7f[_0x34c6('0x55')]=_0x2edadb;return _0x41be7f;})[_0x34c6('0x24')](function(_0x422c06){return db[_0x34c6('0x50')][_0x34c6('0x48')](_0x422c06,{'include':[{'model':db['UserProfileResource'],'as':_0x34c6('0x55')}],'raw':!![],'transaction':_0x4acca4});});})[_0x34c6('0x24')](function(){return _0x457f0b;});}});});});}})[_0x34c6('0x24')](respondWithResult(_0x19eb9a,0xc9))[_0x34c6('0x43')](handleError(_0x19eb9a,null));};exports[_0x34c6('0x23')]=function(_0xba85f1,_0xf96f37){if(_0xba85f1['body']['id']){delete _0xba85f1[_0x34c6('0x49')]['id'];}return db['UserProfile'][_0x34c6('0x47')]({'where':{'id':_0xba85f1['params']['id']}})[_0x34c6('0x24')](handleEntityNotFound(_0xf96f37,null))[_0x34c6('0x24')](saveUpdates(_0xba85f1['body'],null))[_0x34c6('0x24')](respondWithResult(_0xf96f37,null))[_0x34c6('0x43')](handleError(_0xf96f37,null));};exports[_0x34c6('0x25')]=function(_0x4d6d4c,_0x8863e5){return db[_0x34c6('0x2c')][_0x34c6('0x47')]({'where':{'id':_0x4d6d4c[_0x34c6('0x44')]['id']}})[_0x34c6('0x24')](handleEntityNotFound(_0x8863e5,null))[_0x34c6('0x24')](removeEntity(_0x8863e5,null))[_0x34c6('0x43')](handleError(_0x8863e5,null));};exports[_0x34c6('0x56')]=function(_0x334cf1,_0x3b034c){return db[_0x34c6('0x2c')]['describe']()['then'](respondWithResult(_0x3b034c,null))[_0x34c6('0x43')](handleError(_0x3b034c,null));};exports[_0x34c6('0x57')]=function(_0x46b006,_0x201249){var _0x139699=_0x46b006['body'];return db[_0x34c6('0x2c')][_0x34c6('0x47')]({'where':{'id':_0x46b006['params']['id']}})[_0x34c6('0x24')](handleEntityNotFound(_0x201249,null))[_0x34c6('0x24')](function(_0x10e49f){if(_0x10e49f){return db['sequelize'][_0x34c6('0x4f')](function(_0x3aecaf){return db[_0x34c6('0x50')][_0x34c6('0x25')]({'where':{'userProfileId':_0x46b006['params']['id'],'sectionId':_[_0x34c6('0x32')](_0x139699,function(_0x4496c8){return _0x4496c8['sectionId'];})},'transaction':_0x3aecaf})['then'](function(){var _0x3408e1=_['map'](_0x139699,function(_0x553e57){_0x553e57['userProfileId']=_0x46b006[_0x34c6('0x44')]['id'];return _0x553e57;});var _0x50f044=[];return BPromise[_0x34c6('0x58')](_0x3408e1,function(_0x50aff4){return db[_0x34c6('0x50')][_0x34c6('0x48')](_0x50aff4,{'include':[{'model':db[_0x34c6('0x59')],'as':_0x34c6('0x55')}],'raw':!![],'transaction':_0x3aecaf})[_0x34c6('0x24')](function(_0x1c3dfb){_0x50f044['push'](_0x1c3dfb['get']({'plain':!![]}));});})[_0x34c6('0x24')](function(){return _0x50f044;});});});}})[_0x34c6('0x24')](function(_0x1179bc){return _0x1179bc;})['then'](respondWithResult(_0x201249,null))[_0x34c6('0x43')](handleError(_0x201249,null));};exports[_0x34c6('0x5a')]=function(_0x42971d,_0x47d75d){var _0x25d1f7;return db[_0x34c6('0x2c')][_0x34c6('0x47')]({'where':{'id':_0x42971d['params']['id']},'attributes':['id',_0x34c6('0x29')]})['then'](handleEntityNotFound(_0x47d75d,null))[_0x34c6('0x24')](function(_0x3af51d){if(_0x3af51d){_0x25d1f7=_0x3af51d;return db[_0x34c6('0x50')][_0x34c6('0x25')]({'where':{'userProfileId':_0x42971d[_0x34c6('0x44')]['id'],'sectionId':_0x42971d[_0x34c6('0x33')][_0x34c6('0x5b')]}});}})[_0x34c6('0x24')](function(){return _0x25d1f7;})[_0x34c6('0x24')](respondWithStatusCode(_0x47d75d,null))[_0x34c6('0x43')](handleError(_0x47d75d,null));};exports[_0x34c6('0x5c')]=function(_0x2edf82,_0x3c247a){var _0x125635=[];var _0xd483ba=[];return db[_0x34c6('0x50')]['findAll']({'where':{'userProfileId':_0x2edf82[_0x34c6('0x44')]['id']},'raw':!![]})[_0x34c6('0x24')](function(_0x20a162){_0x125635=_[_0x34c6('0x3f')](_0x20a162,function(_0x14e29d){return _0x14e29d[_0x34c6('0x5d')]===0x1||_[_0x34c6('0x5e')]([0x3eb,0x709],_0x14e29d[_0x34c6('0x53')]);});if(!_[_0x34c6('0x5f')](_0x125635)){return _[_0x34c6('0x32')](_0x125635,function(_0x236dea){return _0x236dea[_0x34c6('0x53')];});}else{return;}})['then'](function(_0x5b6ee5){if(_0x5b6ee5)_0xd483ba=_0x5b6ee5;if(_[_0x34c6('0x5e')](_0xd483ba,0x64)){var _0x25f416=_['find'](_0x125635,{'sectionId':0x64});return hasDefaultDashboard(_0x25f416)[_0x34c6('0x24')](function(_0x1266de){return _[_0x34c6('0x32')](_0x125635,function(_0x769d81){if(_0x769d81[_0x34c6('0x53')]===0x64){_0x769d81[_0x34c6('0x60')]=_0x1266de;}return _0x769d81;});});}else{return;}})['then'](function(_0x4d26b5){if(_0x4d26b5)_0x125635=_0x4d26b5;if(_['includes'](_0xd483ba,0x3eb)){var _0x114247=_[_0x34c6('0x47')](_0x125635,{'sectionId':0x3eb});return getCustomDashboards(_0x114247)[_0x34c6('0x24')](function(_0x1c53f7){return _[_0x34c6('0x32')](_0x125635,function(_0x52d48d){if(_0x114247[_0x34c6('0x5d')]){if(_0x52d48d[_0x34c6('0x53')]===0x3eb){_0x52d48d[_0x34c6('0x60')]=_0x1c53f7;}}else{if(_0x52d48d[_0x34c6('0x53')]===0x64){_0x52d48d['subsections']=_0x1c53f7;}}return _0x52d48d;});});}else{return;}})[_0x34c6('0x24')](function(_0x4c1c3d){if(_0x4c1c3d)_0x125635=_0x4c1c3d;if(_['includes'](_0xd483ba,0x709)){var _0x1ddc52=_[_0x34c6('0x47')](_0x125635,{'sectionId':0x709});return getPlugins(_0x1ddc52)[_0x34c6('0x24')](function(_0x31b44f){if(_0x1ddc52[_0x34c6('0x5d')]){return _[_0x34c6('0x32')](_0x125635,function(_0x215af6){if(_0x215af6[_0x34c6('0x53')]===0x709){_0x215af6[_0x34c6('0x60')]=_0x31b44f;}return _0x215af6;});}else{var _0x4bf92a={'sectionId':0x76c,'enabled':0x1,'subsections':_0x31b44f};var _0x457aa3=_[_0x34c6('0x32')](_0x125635);_0x457aa3[_0x34c6('0x61')](_0x4bf92a);return _0x457aa3;}});}else{return;}})[_0x34c6('0x24')](function(_0x12c159){if(_0x12c159)_0x125635=_0x12c159;return _[_0x34c6('0x3f')](_0x125635,[_0x34c6('0x5d'),0x1]);})['then'](respondWithResult(_0x3c247a,null))['catch'](handleError(_0x3c247a,null));};function hasDefaultDashboard(_0x54ac2b){var _0x2f6b6a=[0x65];return new BPromise(function(_0x279607,_0x2f51b1){try{if(_0x54ac2b[_0x34c6('0x52')]){_0x279607(_0x2f6b6a);}else{return db['UserProfileResource'][_0x34c6('0x62')]({'where':{'sectionId':_0x54ac2b['id']},'raw':!![]})[_0x34c6('0x24')](function(_0x215cdb){_0x215cdb?_0x279607(_0x2f6b6a):_0x279607();});}}catch(_0x3e8aa6){_0x2f51b1(_0x3e8aa6);}});}function getCustomDashboards(_0x328c9f){var _0x2c3122=[];return new BPromise(function(_0x5a79b7,_0x290cb7){try{if(_0x328c9f[_0x34c6('0x52')]){return db[_0x34c6('0x63')][_0x34c6('0x51')]({'raw':!![]})[_0x34c6('0x24')](function(_0x45d673){_0x45d673[_0x34c6('0x64')](function(_0x533e0d){_0x2c3122[_0x34c6('0x61')](_0x533e0d['id']+0x1869f);});_0x5a79b7(_0x2c3122);});}else{return db[_0x34c6('0x59')][_0x34c6('0x51')]({'where':{'sectionId':_0x328c9f['id']},'raw':!![]})[_0x34c6('0x24')](function(_0x4ec4c9){_0x4ec4c9[_0x34c6('0x64')](function(_0x311096){_0x2c3122[_0x34c6('0x61')](_0x311096[_0x34c6('0x65')]+0x1869f);});_0x5a79b7(_0x2c3122);});}}catch(_0x1de848){_0x290cb7(_0x1de848);}});}function getPlugins(_0x14cabf){var _0x4ba7c9=[];return new BPromise(function(_0xc1abe1,_0x2b85ef){try{if(_0x14cabf[_0x34c6('0x52')]){return db[_0x34c6('0x66')]['findAll']({'raw':!![]})[_0x34c6('0x24')](function(_0x48c9f8){_0x48c9f8['forEach'](function(_0x3f07a6){_0x4ba7c9[_0x34c6('0x61')](_0x3f07a6['id']+0x15b38);});_0xc1abe1(_0x4ba7c9);});}else{return db[_0x34c6('0x59')]['findAll']({'where':{'sectionId':_0x14cabf['id']},'raw':!![]})[_0x34c6('0x24')](function(_0x5930b3){_0x5930b3['forEach'](function(_0x5dde1c){_0x4ba7c9[_0x34c6('0x61')](_0x5dde1c[_0x34c6('0x65')]+0x15b38);});_0xc1abe1(_0x4ba7c9);});}}catch(_0x535074){_0x2b85ef(_0x535074);}});}exports[_0x34c6('0x67')]=function(_0x4eee8e,_0x459677){return db[_0x34c6('0x2c')]['find']({'where':{'id':_0x4eee8e[_0x34c6('0x44')]['id']}})['then'](handleEntityNotFound(_0x459677,null))[_0x34c6('0x24')](function(_0x438b05){if(_0x438b05){return db[_0x34c6('0x4e')][_0x34c6('0x4f')](function(_0x1f1e69){return db[_0x34c6('0x50')]['findAll']({'where':{'userProfileId':_0x4eee8e[_0x34c6('0x44')]['id']},'attributes':['id'],'raw':!![]})[_0x34c6('0x24')](function(_0xf8b020){if(_0xf8b020){return db[_0x34c6('0x50')][_0x34c6('0x25')]({'where':{'userProfileId':_0x4eee8e[_0x34c6('0x44')]['id'],'id':_[_0x34c6('0x32')](_0xf8b020,function(_0x4ab159){return _0x4ab159['id'];})},'transaction':_0x1f1e69});}})[_0x34c6('0x24')](function(_0x22bb5d){var _0x2eef90=_[_0x34c6('0x32')](_0x4eee8e[_0x34c6('0x49')],function(_0x5bafcc){_0x5bafcc[_0x34c6('0x54')]=_0x4eee8e[_0x34c6('0x44')]['id'];return _0x5bafcc;});return db[_0x34c6('0x50')][_0x34c6('0x68')](_0x2eef90,{'raw':!![],'transaction':_0x1f1e69});})[_0x34c6('0x24')](function(_0x4f3870){var _0x54beb3=_[_0x34c6('0x3f')](_[_0x34c6('0x32')](_0x4f3870,function(_0x357570){return _0x357570[_0x34c6('0x4a')]({'plain':!![]});}),{'includeAll':![]});if(_0x54beb3){return db[_0x34c6('0x50')][_0x34c6('0x51')]({'where':{'userProfileId':_0x4eee8e['params']['id'],'sectionId':_[_0x34c6('0x32')](_0x54beb3,function(_0x30f762){return _0x30f762[_0x34c6('0x53')];})},'attributes':['id',_0x34c6('0x53')],'raw':!![]})[_0x34c6('0x24')](function(_0x1043fa){var _0x173a7b=_[_0x34c6('0x32')](_0x4eee8e[_0x34c6('0x49')],function(_0x2b82df){_0x2b82df[_0x34c6('0x54')]=_0x4eee8e['params']['id'];return _0x2b82df;});return db[_0x34c6('0x59')][_0x34c6('0x68')](_0x173a7b,{'raw':!![],'transaction':_0x1f1e69});});}})['catch'](handleError(_0x459677,null));});}})[_0x34c6('0x24')](function(_0xf16067){var _0x29e3a9=_[_0x34c6('0x32')](_0xf16067,function(_0xe0d867){return _0xe0d867[_0x34c6('0x4a')]({'plain':!![]});});})[_0x34c6('0x24')](respondWithResult(_0x459677,null))['catch'](handleError(_0x459677,null));};exports[_0x34c6('0x69')]=function(_0x2b4f5b,_0x4a0925,_0x8629d2){return db[_0x34c6('0x2c')][_0x34c6('0x47')]({'where':{'id':_0x2b4f5b[_0x34c6('0x44')]['id']}})[_0x34c6('0x24')](handleEntityNotFound(_0x4a0925,null))[_0x34c6('0x24')](function(_0x2cd022){if(_0x2cd022){return _0x2cd022[_0x34c6('0x69')](_0x2b4f5b[_0x34c6('0x33')][_0x34c6('0x5b')]);}})[_0x34c6('0x24')](respondWithStatusCode(_0x4a0925,null))[_0x34c6('0x43')](handleError(_0x4a0925,null));};exports[_0x34c6('0x6a')]=function(_0x1727af,_0x52be21){var _0x279c51={'raw':![],'where':{}};var _0x8f0532={};var _0x4ce5ef={'count':0x0,'rows':[]};var _0x196ea6=_0x1727af[_0x34c6('0x33')][_0x34c6('0x6b')];if(typeof _0x196ea6===_0x34c6('0x6c')){throw new db[(_0x34c6('0x6d'))]['ValidationError']('Unknown\x20section');}var _0x5946e9=_0x1727af[_0x34c6('0x33')][_0x34c6('0x6e')]||![];var _0x1cb0f2=getQueryModels(_0x196ea6,_0x5946e9);if(typeof _0x1cb0f2[_0x34c6('0x6f')]===_0x34c6('0x6c')){throw new db['Sequelize'][(_0x34c6('0x70'))](_0x34c6('0x71')+_0x196ea6+'\x27');}var _0x5bbb4e=[];if(!_[_0x34c6('0x5f')](_0x1cb0f2[_0x34c6('0x72')])){_0x5bbb4e=_0x1cb0f2[_0x34c6('0x72')];}else{_0x5bbb4e=[{'name':_0x196ea6}];}return db[_0x34c6('0x2c')][_0x34c6('0x62')]({'where':{'id':_0x1727af[_0x34c6('0x44')]['id']}})[_0x34c6('0x24')](handleEntityNotFound(_0x52be21,null))[_0x34c6('0x24')](function(_0x410254){if(_0x410254){var _0x45c236=[];for(var _0x3cca33=0x0;_0x3cca33<_0x5bbb4e[_0x34c6('0x45')];_0x3cca33++){_0x45c236[_0x34c6('0x61')](db[_0x34c6('0x50')]['findOne']({'where':{'userProfileId':_0x410254['id'],'name':_0x5bbb4e[_0x3cca33][_0x34c6('0x29')]},'raw':!![]}));}return BPromise[_0x34c6('0x73')](_0x45c236);}})[_0x34c6('0x24')](function(_0x450a3d){var _0x349751=_[_0x34c6('0x3f')](_0x450a3d,function(_0x506a58){return _0x506a58?_0x506a58:undefined;});var _0x554768=_[_0x34c6('0x3f')](_0x5bbb4e,[_0x34c6('0x74'),!![]]);var _0x4eafed=_[_0x34c6('0x5f')](_0x349751)&&_[_0x34c6('0x5f')](_0x554768)?null:_['union'](_0x554768,_0x349751);if(_0x4eafed){var _0x20a4a5=[];for(var _0x2278fc=0x0;_0x2278fc<_0x4eafed[_0x34c6('0x45')];_0x2278fc++){var _0x4fc336=_[_0x34c6('0x47')](_0x5bbb4e,function(_0x20d0c7){return _0x4eafed[_0x2278fc]?_0x20d0c7[_0x34c6('0x29')]===_0x4eafed[_0x2278fc][_0x34c6('0x29')]:null;});if(_0x4fc336){if(_0x4eafed[_0x2278fc][_0x34c6('0x74')]){_0x20a4a5['push'](getAllResources(_0x1cb0f2[_0x34c6('0x6f')],_0x4eafed[_0x2278fc]));}else{if(!_0x4eafed[_0x2278fc]['autoAssociation']){_0x20a4a5[_0x34c6('0x61')](getAllowedResources(_0x4fc336,_0x4eafed[_0x2278fc],_0x1cb0f2[_0x34c6('0x6f')]));}else{if(_0x4fc336[_0x34c6('0x31')]){_0x20a4a5['push'](getAllFilteredResources(_0x4fc336,_0x4eafed[_0x2278fc]));}}}}}return BPromise['all'](_0x20a4a5);}else{return null;}})[_0x34c6('0x24')](function(_0x4a442a){var _0x3825b4=_0x4a442a;var _0x1c8433=null;if(_0x3825b4){_0x1c8433=_0x3825b4['length']===0x1?_0x3825b4[0x0]:null;}if(_0x1c8433||_0x3825b4){var _0x2c4bbb=db[_0x1cb0f2[_0x34c6('0x6f')]][_0x34c6('0x2d')];_0x8f0532[_0x34c6('0x31')]=_[_0x34c6('0x34')](_0x2c4bbb);_0x8f0532[_0x34c6('0x33')]=_[_0x34c6('0x34')](_0x1727af[_0x34c6('0x33')]);_0x8f0532[_0x34c6('0x35')]=_[_0x34c6('0x36')](_0x8f0532[_0x34c6('0x31')],_0x8f0532[_0x34c6('0x33')]);_0x279c51[_0x34c6('0x38')]=_[_0x34c6('0x36')](_0x8f0532['model'],qs[_0x34c6('0x37')](_0x1727af[_0x34c6('0x33')][_0x34c6('0x37')]));_0x279c51[_0x34c6('0x38')]=_0x279c51[_0x34c6('0x38')][_0x34c6('0x45')]?_0x279c51['attributes']:_0x8f0532[_0x34c6('0x31')];if(!_0x1727af[_0x34c6('0x33')][_0x34c6('0x39')]('nolimit')){_0x279c51[_0x34c6('0x1f')]=qs[_0x34c6('0x1f')](_0x1727af['query'][_0x34c6('0x1f')]);_0x279c51[_0x34c6('0x1e')]=qs[_0x34c6('0x1e')](_0x1727af['query'][_0x34c6('0x1e')]);}_0x279c51[_0x34c6('0x3b')]=qs[_0x34c6('0x3c')](_0x1727af['query'][_0x34c6('0x3c')]);_0x279c51[_0x34c6('0x3d')]=qs[_0x34c6('0x35')](_['pick'](_0x1727af['query'],_0x8f0532[_0x34c6('0x35')]));if(_0x1727af[_0x34c6('0x33')][_0x34c6('0x3f')]){_0x279c51[_0x34c6('0x3d')]=_[_0x34c6('0x40')](_0x279c51[_0x34c6('0x3d')],{'$or':_[_0x34c6('0x32')](_0x2c4bbb,function(_0x24a1bf){if(_0x24a1bf[_0x34c6('0x2f')][_0x34c6('0x30')]!==_0x34c6('0x75')){var _0x207f25={};_0x207f25[_0x24a1bf['field']]={'$like':'%'+_0x1727af[_0x34c6('0x33')][_0x34c6('0x3f')]+'%'};return _0x207f25;}})});}var _0x29f00e=[];if(_0x1c8433){var _0x199dd0=_[_0x34c6('0x47')](_0x5bbb4e,['name',_0x1c8433[_0x34c6('0x29')]]);if(_0x199dd0[_0x34c6('0x76')]){var _0x530d48={};if(_0x1cb0f2[_0x34c6('0x6f')]===_0x34c6('0x77')){_0x530d48[_0x199dd0['foreignKey']]=_[_0x34c6('0x32')](_0x1c8433[_0x34c6('0x78')],'id');}else{_0x530d48[_0x199dd0[_0x34c6('0x79')]]=_0x1c8433['associatedResources'];}_0x29f00e['push'](_0x530d48);}else{_0x279c51['where']['id']=_0x1c8433[_0x34c6('0x78')];}}else{for(var _0x32f22b=0x0;_0x32f22b<_0x3825b4[_0x34c6('0x45')];_0x32f22b++){var _0x199dd0=_['find'](_0x5bbb4e,[_0x34c6('0x29'),_0x3825b4[_0x32f22b][_0x34c6('0x29')]]);if(_0x199dd0['field']){var _0x530d48={};_0x530d48[_0x199dd0[_0x34c6('0x79')]]=_0x3825b4[_0x32f22b]['associatedResources'];_0x29f00e[_0x34c6('0x61')](_0x530d48);}else{if(!_0x279c51[_0x34c6('0x3d')]['id'])_0x279c51['where']['id']=[];_0x3825b4[_0x32f22b]['associatedResources'][_0x34c6('0x64')](function(_0x37548a){_0x279c51['where']['id']['push'](_0x37548a);});}}}if(!_[_0x34c6('0x5f')](_0x29f00e)){_0x279c51[_0x34c6('0x3d')]=_[_0x34c6('0x40')](_0x279c51[_0x34c6('0x3d')],{'$and':{'$or':_0x29f00e}});}_0x279c51=_[_0x34c6('0x40')]({},_0x279c51,_0x1727af[_0x34c6('0x41')]);if(_0x1c8433&&!_0x1c8433[_0x34c6('0x52')]&&_0x1cb0f2[_0x34c6('0x6f')]===_0x34c6('0x77')){if(_0x1727af[_0x34c6('0x33')][_0x34c6('0x42')]){_0x279c51[_0x34c6('0x46')]=[{'all':!![]}];}return db[_0x1cb0f2[_0x34c6('0x6f')]][_0x34c6('0x51')](_0x279c51)[_0x34c6('0x24')](function(_0x546327){var _0x563c0e=[];_0x546327[_0x34c6('0x64')](function(_0x5acbe7){var _0x3f086a;switch(_0x5acbe7[_0x34c6('0x7a')]){case _0x34c6('0x7b'):_0x3f086a=_[_0x34c6('0x47')](_0x1c8433[_0x34c6('0x78')],function(_0x46134c){return _0x46134c['id']===_0x5acbe7[_0x34c6('0x7c')]&&_0x46134c[_0x34c6('0x2f')]===_0x34c6('0x7d');});break;case _0x34c6('0x7e'):_0x3f086a=_['find'](_0x1c8433[_0x34c6('0x78')],function(_0x2121c3){return _0x2121c3['id']===_0x5acbe7['reportId']&&_0x2121c3[_0x34c6('0x2f')]===_0x34c6('0x7f');});break;}if(_0x3f086a)_0x563c0e[_0x34c6('0x61')](_0x5acbe7);});_0x4ce5ef['count']=_0x563c0e[_0x34c6('0x45')];_0x4ce5ef[_0x34c6('0x80')]=_0x563c0e;return _0x4ce5ef;});}else{return db[_0x1cb0f2[_0x34c6('0x6f')]][_0x34c6('0x1d')]({'where':_0x279c51[_0x34c6('0x3d')]})[_0x34c6('0x24')](function(_0x4363cb){_0x4ce5ef[_0x34c6('0x1d')]=_0x4363cb;if(_0x1727af[_0x34c6('0x33')][_0x34c6('0x42')]){if(_0x1cb0f2[_0x34c6('0x6f')]===_0x34c6('0x81')){_0x279c51['include']=[{'model':db[_0x34c6('0x82')],'as':'Tags','attributes':['id','name',_0x34c6('0x83')],'required':_0x1727af[_0x34c6('0x33')][_0x34c6('0x84')]?!![]:![]},{'model':db['Tag'],'as':_0x34c6('0x85'),'attributes':['id',_0x34c6('0x29'),_0x34c6('0x83')],'through':_0x1727af[_0x34c6('0x33')][_0x34c6('0x84')]?{'attributes':[],'where':{'TagId':_0x1727af[_0x34c6('0x33')]['tag']||undefined}}:{},'required':_0x1727af[_0x34c6('0x33')][_0x34c6('0x84')]?!![]:![]}];}else{_0x279c51['include']=[{'all':!![]}];}}return db[_0x1cb0f2[_0x34c6('0x6f')]]['findAll'](_0x279c51);})['then'](function(_0x39c8cf){_0x4ce5ef[_0x34c6('0x80')]=_0x39c8cf;return _0x4ce5ef;});}}else{return _0x4ce5ef;}})[_0x34c6('0x24')](respondWithFilteredResult(_0x52be21,_0x279c51))[_0x34c6('0x43')](handleError(_0x52be21,null));};function getAllResources(_0x4ab11b,_0x57a880){return new BPromise(function(_0x154e89,_0x36484e){if(_0x57a880){var _0x2cd23a=_0x57a880[_0x34c6('0x3f')]?{[_0x57a880['filter']['field']]:_0x57a880['filter'][_0x34c6('0x86')]}:undefined;return db[_0x4ab11b][_0x34c6('0x51')]({'where':_0x2cd23a,'raw':!![]})[_0x34c6('0x24')](function(_0x358f2e){_0x57a880[_0x34c6('0x78')]=_[_0x34c6('0x32')](_0x358f2e,'id');_0x154e89(_0x57a880);})[_0x34c6('0x43')](function(_0x3aa919){_0x36484e(_0x3aa919);});}else{_0x154e89(null);}});}function getAllFilteredResources(_0x2ef191,_0x53c7ff){return new BPromise(function(_0x16a058,_0x2c9701){var _0x18d1a8=_0x2ef191['filter']?{[_0x2ef191['filter']['field']]:_0x2ef191[_0x34c6('0x3f')][_0x34c6('0x86')]}:undefined;return db[_0x2ef191[_0x34c6('0x31')]][_0x34c6('0x51')]({'where':_0x18d1a8,'raw':!![]})[_0x34c6('0x24')](function(_0x1da9c0){_0x53c7ff['associatedResources']=_[_0x34c6('0x32')](_0x1da9c0,function(_0x4aca53){return _0x4aca53['name'];});_0x16a058(_0x53c7ff);})['catch'](function(_0xed3a4a){_0x2c9701(_0xed3a4a);});});}function getAllowedResources(_0x24d1ab,_0x182dda,_0x148cbb){return new BPromise(function(_0x4ea486,_0x2403e4){if(_0x182dda){return db[_0x34c6('0x59')][_0x34c6('0x51')]({'where':{'sectionId':_0x182dda['id']},'raw':!![]})[_0x34c6('0x24')](function(_0x1842df){if(_0x24d1ab[_0x34c6('0x76')]&&_0x24d1ab[_0x34c6('0x76')]!=='id'){_0x182dda[_0x34c6('0x78')]=_[_0x34c6('0x32')](_0x1842df,function(_0x3aa8db){return _0x3aa8db[_0x24d1ab[_0x34c6('0x76')]];});}else{if(_0x148cbb===_0x34c6('0x77')){_0x182dda[_0x34c6('0x78')]=_['map'](_0x1842df,function(_0x151a9d){return{'id':_0x151a9d[_0x34c6('0x65')],'type':_0x151a9d[_0x34c6('0x2f')]};});}else{_0x182dda[_0x34c6('0x78')]=_['map'](_0x1842df,function(_0x3ba2a3){return _0x3ba2a3['resourceId'];});}}_0x4ea486(_0x182dda);})[_0x34c6('0x43')](function(_0x1cee72){_0x2403e4(_0x1cee72);});}else{_0x4ea486(null);}});}function getQueryModels(_0x3870a5,_0xdc3863){var _0x3ac1ed=_0x3870a5[_0x34c6('0x87')]();var _0x105c50={'childModel':undefined,'parentSections':[]};switch(_0x3ac1ed){case _0x34c6('0x88'):_0x105c50['childModel']=_0x34c6('0x89');break;case _0x34c6('0x8a'):_0x105c50[_0x34c6('0x6f')]='SquareOdbc';break;case _0x34c6('0x8b'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0x8c');_0x105c50[_0x34c6('0x72')]=[{'name':'SquareProjects','field':_0x34c6('0x29'),'foreignKey':_0x34c6('0x8d')}];break;case _0x34c6('0x8e'):_0x105c50[_0x34c6('0x6f')]='JscriptyProject';break;case _0x34c6('0x8f'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0x81');_0x105c50['parentSections']=[{'name':_0x34c6('0x90'),'field':'id','foreignKey':_0x34c6('0x91')}];break;case _0x34c6('0x92'):_0x105c50[_0x34c6('0x6f')]='CmList';break;case _0x34c6('0x93'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0x94');break;case'globalcustomfields':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0x95');break;case _0x34c6('0x96'):_0x105c50[_0x34c6('0x6f')]='ChatQueue';break;case _0x34c6('0x97'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0x98');break;case _0x34c6('0x99'):_0x105c50['childModel']=_0x34c6('0x9a');break;case _0x34c6('0x9b'):_0x105c50[_0x34c6('0x6f')]='FaxAccount';break;case'inboundroutes':case'internalroutes':case _0x34c6('0x9c'):_0x105c50['childModel']='VoiceExtension';break;case'contexts':_0x105c50['childModel']=_0x34c6('0x9d');break;case _0x34c6('0x9e'):_0x105c50[_0x34c6('0x6f')]='VoiceMail';break;case'voicerecordings':_0x105c50['childModel']=_0x34c6('0x9f');_0x105c50[_0x34c6('0x72')]=[{'name':'Agents','field':_0x34c6('0x29'),'foreignKey':_0x34c6('0xa0'),'model':_0x34c6('0xa1'),'filter':{'field':_0x34c6('0xa2'),'value':['agent']}},{'name':_0x34c6('0xa3'),'field':_0x34c6('0x29'),'foreignKey':_0x34c6('0xa0'),'model':_0x34c6('0xa1'),'filter':{'field':_0x34c6('0xa2'),'value':[_0x34c6('0xa4')]}},{'name':_0x34c6('0xa5'),'field':'name','foreignKey':_0x34c6('0xa6'),'model':_0x34c6('0xa7'),'filter':{'field':'type','value':[_0x34c6('0xa8')]}},{'name':_0x34c6('0xa9'),'field':_0x34c6('0x29'),'foreignKey':_0x34c6('0xa6'),'model':_0x34c6('0xa7'),'filter':{'field':_0x34c6('0x2f'),'value':[_0x34c6('0xaa')]}}];break;case _0x34c6('0xab'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xac');break;case _0x34c6('0xad'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xae');break;case'voiceprefixes':_0x105c50['childModel']='VoicePrefix';break;case _0x34c6('0xaf'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xb0');break;case _0x34c6('0xb1'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xb2');break;case _0x34c6('0xb3'):_0x105c50[_0x34c6('0x6f')]='MailAccount';break;case _0x34c6('0xb4'):_0x105c50[_0x34c6('0x6f')]='MailSubstatus';break;case _0x34c6('0xb5'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xb6');break;case _0x34c6('0xb7'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xb8');break;case'smsqueues':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xb9');break;case _0x34c6('0xba'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xbb');break;case'whatsappqueues':_0x105c50['childModel']=_0x34c6('0xbc');break;case'whatsappaccounts':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xbd');break;case _0x34c6('0xbe'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xbf');break;case _0x34c6('0xc0'):case _0x34c6('0xc1'):_0x105c50['childModel']=_0x34c6('0xa7');if(_0xdc3863){_0x105c50[_0x34c6('0x72')]=[{'name':_0x34c6('0xa5')},{'name':_0x34c6('0xa9')}];}break;case _0x34c6('0xc2'):case'agents':case _0x34c6('0xc3'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xa1');if(_0xdc3863){_0x105c50[_0x34c6('0x72')]=[{'name':_0x34c6('0xc4'),'filter':{'field':_0x34c6('0xa2'),'value':[_0x34c6('0xc5'),_0x34c6('0xc6')]},'ignore':!![]},{'name':'Agents'},{'name':_0x34c6('0xa3')}];}break;case _0x34c6('0xc7'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xc8');break;case'salesforceaccounts':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xc9');break;case'freshdeskaccounts':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xca');break;case'sugarcrmaccounts':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xcb');break;case _0x34c6('0xcc'):_0x105c50[_0x34c6('0x6f')]='DeskAccount';break;case'zohoaccounts':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xcd');break;case _0x34c6('0xce'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xa1');break;case _0x34c6('0xcf'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xd0');break;case _0x34c6('0xd1'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xd2');break;case _0x34c6('0xd3'):_0x105c50[_0x34c6('0x6f')]='Dashboard';break;case _0x34c6('0xd4'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xd5');break;case _0x34c6('0xd6'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xd7');break;case _0x34c6('0xd8'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xd9');break;case _0x34c6('0xda'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xdb');break;case'tags':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0x82');break;case'templates':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xdc');break;case'triggers':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xdd');break;case _0x34c6('0xde'):_0x105c50['childModel']=_0x34c6('0xdf');break;case _0x34c6('0xe0'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xe1');break;case _0x34c6('0xe2'):_0x105c50[_0x34c6('0x6f')]=_0x34c6('0x66');break;case _0x34c6('0xe3'):_0x105c50[_0x34c6('0x6f')]='AnalyticExtractedReport';_0x105c50[_0x34c6('0x72')]=[{'name':_0x34c6('0xe4'),'field':'id','foreignKey':_0x34c6('0x7c')}];break;case'metrics':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xe5');break;case'whatsappaccounts':_0x105c50[_0x34c6('0x6f')]=_0x34c6('0xbd');break;default:return _0x105c50;}return _0x105c50;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index f3b9726..be326de 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 _0x4f78=['emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update'];(function(_0x2270bd,_0x127662){var _0x31f8f8=function(_0x53fa75){while(--_0x53fa75){_0x2270bd['push'](_0x2270bd['shift']());}};_0x31f8f8(++_0x127662);}(_0x4f78,0x108));var _0x84f7=function(_0xe05ae6,_0x2b82a7){_0xe05ae6=_0xe05ae6-0x0;var _0x4f3030=_0x4f78[_0xe05ae6];return _0x4f3030;};'use strict';var EventEmitter=require(_0x84f7('0x0'));var UserProfile=require(_0x84f7('0x1'))['db'][_0x84f7('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x84f7('0x3')](0x0);var events={'afterCreate':_0x84f7('0x4'),'afterUpdate':_0x84f7('0x5'),'afterDestroy':'remove'};function emitEvent(_0x564b63){return function(_0x368d7a,_0xf1f9ee,_0x320a85){UserProfileEvents[_0x84f7('0x6')](_0x564b63+':'+_0x368d7a['id'],_0x368d7a);UserProfileEvents[_0x84f7('0x6')](_0x564b63,_0x368d7a);_0x320a85(null);};}for(var e in events){if(events[_0x84f7('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x84f7('0x8')]=UserProfileEvents; \ No newline at end of file +var _0xce8b=['emit','hook','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0xce8b,0x1b2));var _0xbce8=function(_0x249e96,_0x3ea39d){_0x249e96=_0x249e96-0x0;var _0x17444c=_0xce8b[_0x249e96];return _0x17444c;};'use strict';var EventEmitter=require(_0xbce8('0x0'));var UserProfile=require(_0xbce8('0x1'))['db'][_0xbce8('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xbce8('0x3')](0x0);var events={'afterCreate':_0xbce8('0x4'),'afterUpdate':_0xbce8('0x5'),'afterDestroy':_0xbce8('0x6')};function emitEvent(_0x342a95){return function(_0x480399,_0xbb768d,_0x9c0b33){UserProfileEvents[_0xbce8('0x7')](_0x342a95+':'+_0x480399['id'],_0x480399);UserProfileEvents[_0xbce8('0x7')](_0x342a95,_0x480399);_0x9c0b33(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xbce8('0x8')](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 5219d8c..a09a82c 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 _0x2cee=['define','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./userProfile.attributes','exports'];(function(_0x42e4d7,_0x4bd202){var _0x346cd8=function(_0x36c0f6){while(--_0x36c0f6){_0x42e4d7['push'](_0x42e4d7['shift']());}};_0x346cd8(++_0x4bd202);}(_0x2cee,0xbf));var _0xe2ce=function(_0x388728,_0x34f822){_0x388728=_0x388728-0x0;var _0x43b4d6=_0x2cee[_0x388728];return _0x43b4d6;};'use strict';var _=require(_0xe2ce('0x0'));var util=require(_0xe2ce('0x1'));var logger=require('../../config/logger')(_0xe2ce('0x2'));var moment=require('moment');var BPromise=require(_0xe2ce('0x3'));var rp=require(_0xe2ce('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2ce('0x5'));var config=require(_0xe2ce('0x6'));var attributes=require(_0xe2ce('0x7'));module[_0xe2ce('0x8')]=function(_0x1a0faf,_0x24dc4d){return _0x1a0faf[_0xe2ce('0x9')]('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca0c=['exports','define','UserProfile','lodash','../../config/logger','api','moment','bluebird','../../config/environment','./userProfile.attributes'];(function(_0x4bae51,_0x31f7ce){var _0x2042bf=function(_0x265fb0){while(--_0x265fb0){_0x4bae51['push'](_0x4bae51['shift']());}};_0x2042bf(++_0x31f7ce);}(_0xca0c,0x1bb));var _0xcca0=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xca0c[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0xcca0('0x0'));var util=require('util');var logger=require(_0xcca0('0x1'))(_0xcca0('0x2'));var moment=require(_0xcca0('0x3'));var BPromise=require(_0xcca0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcca0('0x5'));var attributes=require(_0xcca0('0x6'));module[_0xcca0('0x7')]=function(_0x33d0b8,_0x292a96){return _0x33d0b8[_0xcca0('0x8')](_0xcca0('0x9'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index bc63a38..e2d42ec 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 _0x5d17=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x5d61b0,_0x4bcfd5){var _0x96e8db=function(_0xa7c8dc){while(--_0xa7c8dc){_0x5d61b0['push'](_0x5d61b0['shift']());}};_0x96e8db(++_0x4bcfd5);}(_0x5d17,0x114));var _0x75d1=function(_0x5005ba,_0x423ed1){_0x5005ba=_0x5005ba-0x0;var _0x21278c=_0x5d17[_0x5005ba];return _0x21278c;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x75d1('0x2'));var fs=require('fs');var Redis=require(_0x75d1('0x3'));var db=require(_0x75d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x75d1('0x5'))(_0x75d1('0x6'));var config=require(_0x75d1('0x7'));var jayson=require(_0x75d1('0x8'));var client=jayson['client'][_0x75d1('0x9')]({'port':0x232a});config[_0x75d1('0xa')]=_[_0x75d1('0xb')](config[_0x75d1('0xa')],{'host':_0x75d1('0xc'),'port':0x18eb});var socket=require(_0x75d1('0xd'))(new Redis(config[_0x75d1('0xa')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x40df40,_0x4a3bb3,_0x57be31){return new BPromise(function(_0x120b53,_0x2b75c6){return client['request'](_0x40df40,_0x57be31)[_0x75d1('0xe')](function(_0x3d7e39){logger[_0x75d1('0xf')](_0x75d1('0x10'),_0x4a3bb3,_0x75d1('0x11'));logger[_0x75d1('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x4a3bb3,_0x75d1('0x11'),JSON[_0x75d1('0x13')](_0x3d7e39));if(_0x3d7e39[_0x75d1('0x14')]){if(_0x3d7e39[_0x75d1('0x14')]['code']===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x4a3bb3,_0x3d7e39[_0x75d1('0x14')][_0x75d1('0x15')]);return _0x2b75c6(_0x3d7e39[_0x75d1('0x14')]['message']);}logger[_0x75d1('0x14')](_0x75d1('0x10'),_0x4a3bb3,_0x3d7e39[_0x75d1('0x14')][_0x75d1('0x15')]);return _0x120b53(_0x3d7e39[_0x75d1('0x14')][_0x75d1('0x15')]);}else{logger[_0x75d1('0xf')](_0x75d1('0x10'),_0x4a3bb3,_0x75d1('0x11'));_0x120b53(_0x3d7e39[_0x75d1('0x16')][_0x75d1('0x15')]);}})['catch'](function(_0x493fff){logger[_0x75d1('0x14')](_0x75d1('0x10'),_0x4a3bb3,_0x493fff);_0x2b75c6(_0x493fff);});});} \ No newline at end of file +var _0x2bd8=['../../config/environment','jayson/promise','client','redis','defaults','localhost','info','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x43b020,_0x51688f){var _0x4169b7=function(_0x419978){while(--_0x419978){_0x43b020['push'](_0x43b020['shift']());}};_0x4169b7(++_0x51688f);}(_0x2bd8,0x130));var _0x82bd=function(_0x2b6e01,_0x13c226){_0x2b6e01=_0x2b6e01-0x0;var _0x536172=_0x2bd8[_0x2b6e01];return _0x536172;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var moment=require(_0x82bd('0x1'));var BPromise=require(_0x82bd('0x2'));var rs=require(_0x82bd('0x3'));var fs=require('fs');var Redis=require(_0x82bd('0x4'));var db=require(_0x82bd('0x5'))['db'];var utils=require(_0x82bd('0x6'));var logger=require(_0x82bd('0x7'))('rpc');var config=require(_0x82bd('0x8'));var jayson=require(_0x82bd('0x9'));var client=jayson[_0x82bd('0xa')]['http']({'port':0x232a});config[_0x82bd('0xb')]=_[_0x82bd('0xc')](config[_0x82bd('0xb')],{'host':_0x82bd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x82bd('0xb')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x51c6ea,_0x5bb22c,_0x5f0434){return new BPromise(function(_0x4c9430,_0x36abe3){return client['request'](_0x51c6ea,_0x5f0434)['then'](function(_0x32821a){logger[_0x82bd('0xe')]('UserProfile,\x20%s,\x20%s',_0x5bb22c,_0x82bd('0xf'));logger['debug'](_0x82bd('0x10'),_0x5bb22c,'request\x20sent',JSON[_0x82bd('0x11')](_0x32821a));if(_0x32821a[_0x82bd('0x12')]){if(_0x32821a[_0x82bd('0x12')][_0x82bd('0x13')]===0x1f4){logger['error'](_0x82bd('0x14'),_0x5bb22c,_0x32821a[_0x82bd('0x12')]['message']);return _0x36abe3(_0x32821a[_0x82bd('0x12')]['message']);}logger[_0x82bd('0x12')](_0x82bd('0x14'),_0x5bb22c,_0x32821a[_0x82bd('0x12')][_0x82bd('0x15')]);return _0x4c9430(_0x32821a[_0x82bd('0x12')][_0x82bd('0x15')]);}else{logger[_0x82bd('0xe')](_0x82bd('0x14'),_0x5bb22c,_0x82bd('0xf'));_0x4c9430(_0x32821a[_0x82bd('0x16')][_0x82bd('0x15')]);}})[_0x82bd('0x17')](function(_0x1c3779){logger[_0x82bd('0x12')]('UserProfile,\x20%s,\x20%s',_0x5bb22c,_0x1c3779);_0x36abe3(_0x1c3779);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 1f07f35..70100eb 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 _0x46b8=['register','length','userProfile:','./userProfile.events','save','remove','update','emit'];(function(_0xa1419b,_0x3dfa31){var _0x48c1cf=function(_0x2a8444){while(--_0x2a8444){_0xa1419b['push'](_0xa1419b['shift']());}};_0x48c1cf(++_0x3dfa31);}(_0x46b8,0x1f3));var _0x846b=function(_0x564cbb,_0x476f51){_0x564cbb=_0x564cbb-0x0;var _0x475d18=_0x46b8[_0x564cbb];return _0x475d18;};'use strict';var UserProfileEvents=require(_0x846b('0x0'));var events=[_0x846b('0x1'),_0x846b('0x2'),_0x846b('0x3')];function createListener(_0x42d6ec,_0x1bac91){return function(_0x40bc60){_0x1bac91[_0x846b('0x4')](_0x42d6ec,_0x40bc60);};}function removeListener(_0x41608b,_0x234098){return function(){UserProfileEvents['removeListener'](_0x41608b,_0x234098);};}exports[_0x846b('0x5')]=function(_0x280a0d){for(var _0x4cf5a2=0x0,_0x4f9caf=events[_0x846b('0x6')];_0x4cf5a2<_0x4f9caf;_0x4cf5a2++){var _0x39f409=events[_0x4cf5a2];var _0x5c5690=createListener(_0x846b('0x7')+_0x39f409,_0x280a0d);UserProfileEvents['on'](_0x39f409,_0x5c5690);}}; \ No newline at end of file +var _0x21bf=['userProfile:','./userProfile.events','save','remove','update','removeListener','register','length'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x21bf,0x1c9));var _0xf21b=function(_0x53b939,_0x419a8c){_0x53b939=_0x53b939-0x0;var _0x2fdc06=_0x21bf[_0x53b939];return _0x2fdc06;};'use strict';var UserProfileEvents=require(_0xf21b('0x0'));var events=[_0xf21b('0x1'),_0xf21b('0x2'),_0xf21b('0x3')];function createListener(_0x274741,_0x1c2775){return function(_0x496ecf){_0x1c2775['emit'](_0x274741,_0x496ecf);};}function removeListener(_0x32850c,_0x52fba7){return function(){UserProfileEvents[_0xf21b('0x4')](_0x32850c,_0x52fba7);};}exports[_0xf21b('0x5')]=function(_0x14c328){for(var _0x28cca4=0x0,_0x5a19ca=events[_0xf21b('0x6')];_0x28cca4<_0x5a19ca;_0x28cca4++){var _0x5aaacd=events[_0x28cca4];var _0x52ffc4=createListener(_0xf21b('0x7')+_0x5aaacd,_0x14c328);UserProfileEvents['on'](_0x5aaacd,_0x52ffc4);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 786c945..cf17147 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 _0x1161=['isAuthenticated','/describe','get','post','create','/:id','update','delete','exports','express','Router','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x1161,0xf7));var _0x1116=function(_0x19ef5f,_0x128698){_0x19ef5f=_0x19ef5f-0x0;var _0x5b4a67=_0x1161[_0x19ef5f];return _0x5b4a67;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1116('0x0'));var router=express[_0x1116('0x1')]();var auth=require(_0x1116('0x2'));var interaction=require(_0x1116('0x3'));var config=require('../../config/environment');var controller=require(_0x1116('0x4'));router['get']('/',auth[_0x1116('0x5')](),controller['index']);router['get'](_0x1116('0x6'),auth[_0x1116('0x5')](),controller['describe']);router[_0x1116('0x7')]('/:id',auth[_0x1116('0x5')](),controller['show']);router[_0x1116('0x8')]('/',auth[_0x1116('0x5')](),controller[_0x1116('0x9')]);router['put'](_0x1116('0xa'),auth['isAuthenticated'](),controller[_0x1116('0xb')]);router[_0x1116('0xc')](_0x1116('0xa'),auth[_0x1116('0x5')](),controller['destroy']);module[_0x1116('0xd')]=router; \ No newline at end of file +var _0x832e=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update','delete','exports','path'];(function(_0xcde180,_0x2c7cb4){var _0x2adf0c=function(_0x31d24d){while(--_0x31d24d){_0xcde180['push'](_0xcde180['shift']());}};_0x2adf0c(++_0x2c7cb4);}(_0x832e,0x17b));var _0xe832=function(_0x161518,_0x338d35){_0x161518=_0x161518-0x0;var _0x5cc0b5=_0x832e[_0x161518];return _0x5cc0b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe832('0x0'));var timeout=require(_0xe832('0x1'));var express=require(_0xe832('0x2'));var router=express[_0xe832('0x3')]();var auth=require(_0xe832('0x4'));var interaction=require(_0xe832('0x5'));var config=require(_0xe832('0x6'));var controller=require('./userProfileResource.controller');router['get']('/',auth[_0xe832('0x7')](),controller[_0xe832('0x8')]);router[_0xe832('0x9')](_0xe832('0xa'),auth[_0xe832('0x7')](),controller[_0xe832('0xb')]);router[_0xe832('0x9')](_0xe832('0xc'),auth[_0xe832('0x7')](),controller['show']);router[_0xe832('0xd')]('/',auth['isAuthenticated'](),controller[_0xe832('0xe')]);router[_0xe832('0xf')](_0xe832('0xc'),auth['isAuthenticated'](),controller[_0xe832('0x10')]);router[_0xe832('0x11')](_0xe832('0xc'),auth[_0xe832('0x7')](),controller['destroy']);module[_0xe832('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 51bf82a..b6ed0e0 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 _0x4386=['exports','STRING','INTEGER','sequelize'];(function(_0x2d9191,_0x46c5bd){var _0x43713a=function(_0x5c32f9){while(--_0x5c32f9){_0x2d9191['push'](_0x2d9191['shift']());}};_0x43713a(++_0x46c5bd);}(_0x4386,0xd3));var _0x6438=function(_0x90a39a,_0x32020d){_0x90a39a=_0x90a39a-0x0;var _0x2b62f7=_0x4386[_0x90a39a];return _0x2b62f7;};'use strict';var Sequelize=require(_0x6438('0x0'));module[_0x6438('0x1')]={'name':{'type':Sequelize[_0x6438('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6438('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x4919=['exports','STRING','INTEGER'];(function(_0x478e2f,_0xcc2041){var _0x4b088d=function(_0x1d262b){while(--_0x1d262b){_0x478e2f['push'](_0x478e2f['shift']());}};_0x4b088d(++_0xcc2041);}(_0x4919,0x12f));var _0x9491=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x4919[_0x1573ea];return _0x51c0e2;};'use strict';var Sequelize=require('sequelize');module[_0x9491('0x0')]={'name':{'type':Sequelize[_0x9491('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x9491('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9491('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 c5429ad..931006b 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 _0x6aa7=['key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','filter','merge','VIRTUAL','options','UserProfileResource','findAll','catch','show','includeAll','find','create','update','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','lodash','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','sendStatus','status','end','count','offset','limit','set','apply','reject','save','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x5ca91e,_0x5ab959){var _0x5cd65c=function(_0x13cf29){while(--_0x13cf29){_0x5ca91e['push'](_0x5ca91e['shift']());}};_0x5cd65c(++_0x5ab959);}(_0x6aa7,0x178));var _0x76aa=function(_0x2059c5,_0x285164){_0x2059c5=_0x2059c5-0x0;var _0x11f4b5=_0x6aa7[_0x2059c5];return _0x11f4b5;};'use strict';var pdf=require(_0x76aa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x76aa('0x1'));var zipdir=require(_0x76aa('0x2'));var jsonpatch=require(_0x76aa('0x3'));var rp=require(_0x76aa('0x4'));var moment=require('moment');var BPromise=require(_0x76aa('0x5'));var Mustache=require(_0x76aa('0x6'));var util=require(_0x76aa('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x76aa('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0x8'));var querystring=require(_0x76aa('0xd'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xe'));var authService=require(_0x76aa('0xf'));var qs=require(_0x76aa('0x10'));var as=require(_0x76aa('0x11'));var hardwareService=require(_0x76aa('0x12'));var logger=require(_0x76aa('0x13'))(_0x76aa('0x14'));var utils=require(_0x76aa('0x15'));var config=require(_0x76aa('0x16'));var licenseUtil=require(_0x76aa('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x112c39,_0x5df49c){_0x5df49c=_0x5df49c||0xcc;return function(_0x226536){if(_0x226536){return _0x112c39[_0x76aa('0x18')](_0x5df49c);}return _0x112c39[_0x76aa('0x19')](_0x5df49c)[_0x76aa('0x1a')]();};}function respondWithResult(_0x10432c,_0x4e309f){_0x4e309f=_0x4e309f||0xc8;return function(_0x5f5b59){if(_0x5f5b59){return _0x10432c[_0x76aa('0x19')](_0x4e309f)['json'](_0x5f5b59);}};}function respondWithFilteredResult(_0x180d92,_0x319bf1){return function(_0x5cf594){if(_0x5cf594){var _0x2111c7=_0x5cf594[_0x76aa('0x1b')],_0x550d9a=_0x319bf1[_0x76aa('0x1c')],_0x328381=_0x319bf1[_0x76aa('0x1c')]+_0x319bf1[_0x76aa('0x1d')],_0x5181d2;if(_0x328381>=_0x2111c7){_0x328381=_0x2111c7;_0x5181d2=0xc8;}else{_0x5181d2=0xce;}_0x180d92[_0x76aa('0x19')](_0x5181d2);return _0x180d92[_0x76aa('0x1e')]('Content-Range',_0x550d9a+'-'+_0x328381+'/'+_0x2111c7)['json'](_0x5cf594);}return null;};}function patchUpdates(_0x256636){return function(_0x454dd3){try{jsonpatch[_0x76aa('0x1f')](_0x454dd3,_0x256636,!![]);}catch(_0x15b931){return BPromise[_0x76aa('0x20')](_0x15b931);}return _0x454dd3[_0x76aa('0x21')]();};}function saveUpdates(_0x19af92,_0x2eaf48){return function(_0x385157){if(_0x385157){return _0x385157['update'](_0x19af92)[_0x76aa('0x22')](function(_0x21064c){return _0x21064c;});}return null;};}function removeEntity(_0x338a6b,_0x5b3f55){return function(_0x41463a){if(_0x41463a){return _0x41463a[_0x76aa('0x23')]()[_0x76aa('0x22')](function(){_0x338a6b[_0x76aa('0x19')](0xcc)[_0x76aa('0x1a')]();});}};}function handleEntityNotFound(_0xc1044c,_0x3cd039){return function(_0x3363b3){if(!_0x3363b3){_0xc1044c[_0x76aa('0x18')](0x194);}return _0x3363b3;};}function handleError(_0x2cba6d,_0x37f1ab){_0x37f1ab=_0x37f1ab||0x1f4;return function(_0x26b75e){logger[_0x76aa('0x24')](_0x26b75e['stack']);if(_0x26b75e[_0x76aa('0x25')]){delete _0x26b75e[_0x76aa('0x25')];}_0x2cba6d[_0x76aa('0x19')](_0x37f1ab)[_0x76aa('0x26')](_0x26b75e);};}exports[_0x76aa('0x27')]=function(_0x2f9316,_0x25a803){var _0x282d0a={},_0xd12a99={},_0x1bdc3d={'count':0x0,'rows':[]};var _0x545b06=_[_0x76aa('0x28')](db['UserProfileResource'][_0x76aa('0x29')],function(_0x365ff8){return{'name':_0x365ff8[_0x76aa('0x2a')],'type':_0x365ff8[_0x76aa('0x2b')][_0x76aa('0x2c')]};});_0xd12a99[_0x76aa('0x2d')]=_[_0x76aa('0x28')](_0x545b06,_0x76aa('0x25'));_0xd12a99[_0x76aa('0x2e')]=_[_0x76aa('0x2f')](_0x2f9316['query']);_0xd12a99[_0x76aa('0x30')]=_[_0x76aa('0x31')](_0xd12a99[_0x76aa('0x2d')],_0xd12a99[_0x76aa('0x2e')]);_0x282d0a[_0x76aa('0x32')]=_[_0x76aa('0x31')](_0xd12a99[_0x76aa('0x2d')],qs['fields'](_0x2f9316[_0x76aa('0x2e')][_0x76aa('0x33')]));_0x282d0a['attributes']=_0x282d0a[_0x76aa('0x32')]['length']?_0x282d0a[_0x76aa('0x32')]:_0xd12a99['model'];if(!_0x2f9316[_0x76aa('0x2e')]['hasOwnProperty']('nolimit')){_0x282d0a[_0x76aa('0x1d')]=qs[_0x76aa('0x1d')](_0x2f9316[_0x76aa('0x2e')][_0x76aa('0x1d')]);_0x282d0a['offset']=qs['offset'](_0x2f9316[_0x76aa('0x2e')][_0x76aa('0x1c')]);}_0x282d0a[_0x76aa('0x34')]=qs[_0x76aa('0x35')](_0x2f9316[_0x76aa('0x2e')]['sort']);_0x282d0a[_0x76aa('0x36')]=qs['filters'](_['pick'](_0x2f9316[_0x76aa('0x2e')],_0xd12a99[_0x76aa('0x30')]),_0x545b06);if(_0x2f9316[_0x76aa('0x2e')][_0x76aa('0x37')]){_0x282d0a['where']=_[_0x76aa('0x38')](_0x282d0a[_0x76aa('0x36')],{'$or':_[_0x76aa('0x28')](_0x545b06,function(_0x4e131a){if(_0x4e131a[_0x76aa('0x2b')]!==_0x76aa('0x39')){var _0x2f7726={};_0x2f7726[_0x4e131a[_0x76aa('0x25')]]={'$like':'%'+_0x2f9316[_0x76aa('0x2e')][_0x76aa('0x37')]+'%'};return _0x2f7726;}})});}_0x282d0a=_[_0x76aa('0x38')]({},_0x282d0a,_0x2f9316[_0x76aa('0x3a')]);var _0x283179={'where':_0x282d0a['where']};return db[_0x76aa('0x3b')][_0x76aa('0x1b')](_0x283179)[_0x76aa('0x22')](function(_0xa824e8){_0x1bdc3d[_0x76aa('0x1b')]=_0xa824e8;if(_0x2f9316[_0x76aa('0x2e')]['includeAll']){_0x282d0a['include']=[{'all':!![]}];}return db[_0x76aa('0x3b')][_0x76aa('0x3c')](_0x282d0a);})[_0x76aa('0x22')](function(_0x365612){_0x1bdc3d['rows']=_0x365612;return _0x1bdc3d;})[_0x76aa('0x22')](respondWithFilteredResult(_0x25a803,_0x282d0a))[_0x76aa('0x3d')](handleError(_0x25a803,null));};exports[_0x76aa('0x3e')]=function(_0x30cdcb,_0x1138b5){var _0x4aa2f3={'raw':![],'where':{'id':_0x30cdcb['params']['id']}},_0x13dafe={};_0x13dafe[_0x76aa('0x2d')]=_['keys'](db['UserProfileResource']['rawAttributes']);_0x13dafe[_0x76aa('0x2e')]=_['keys'](_0x30cdcb['query']);_0x13dafe['filters']=_[_0x76aa('0x31')](_0x13dafe[_0x76aa('0x2d')],_0x13dafe[_0x76aa('0x2e')]);_0x4aa2f3[_0x76aa('0x32')]=_[_0x76aa('0x31')](_0x13dafe['model'],qs[_0x76aa('0x33')](_0x30cdcb[_0x76aa('0x2e')][_0x76aa('0x33')]));_0x4aa2f3[_0x76aa('0x32')]=_0x4aa2f3[_0x76aa('0x32')]['length']?_0x4aa2f3[_0x76aa('0x32')]:_0x13dafe[_0x76aa('0x2d')];if(_0x30cdcb['query'][_0x76aa('0x3f')]){_0x4aa2f3['include']=[{'all':!![]}];}_0x4aa2f3=_[_0x76aa('0x38')]({},_0x4aa2f3,_0x30cdcb[_0x76aa('0x3a')]);return db[_0x76aa('0x3b')][_0x76aa('0x40')](_0x4aa2f3)[_0x76aa('0x22')](handleEntityNotFound(_0x1138b5,null))[_0x76aa('0x22')](respondWithResult(_0x1138b5,null))[_0x76aa('0x3d')](handleError(_0x1138b5,null));};exports[_0x76aa('0x41')]=function(_0xb8d052,_0x3946bd){return db['UserProfileResource'][_0x76aa('0x41')](_0xb8d052['body'],{})[_0x76aa('0x22')](respondWithResult(_0x3946bd,0xc9))[_0x76aa('0x3d')](handleError(_0x3946bd,null));};exports[_0x76aa('0x42')]=function(_0x156d4e,_0x5ca721){if(_0x156d4e['body']['id']){delete _0x156d4e[_0x76aa('0x43')]['id'];}return db['UserProfileResource'][_0x76aa('0x40')]({'where':{'id':_0x156d4e[_0x76aa('0x44')]['id']}})[_0x76aa('0x22')](handleEntityNotFound(_0x5ca721,null))[_0x76aa('0x22')](saveUpdates(_0x156d4e[_0x76aa('0x43')],null))[_0x76aa('0x22')](respondWithResult(_0x5ca721,null))['catch'](handleError(_0x5ca721,null));};exports['destroy']=function(_0x2fcf8f,_0x1eafb2){return db[_0x76aa('0x3b')][_0x76aa('0x40')]({'where':{'id':_0x2fcf8f[_0x76aa('0x44')]['id']}})[_0x76aa('0x22')](handleEntityNotFound(_0x1eafb2,null))['then'](removeEntity(_0x1eafb2,null))[_0x76aa('0x3d')](handleError(_0x1eafb2,null));};exports[_0x76aa('0x45')]=function(_0x26db69,_0x4b3d2a){return db[_0x76aa('0x3b')]['describe']()[_0x76aa('0x22')](respondWithResult(_0x4b3d2a,null))['catch'](handleError(_0x4b3d2a,null));}; \ No newline at end of file +var _0xda19=['moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','json','apply','reject','save','update','then','destroy','end','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','UserProfileResource','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xda19,0xd5));var _0x9da1=function(_0x3e70a8,_0x21d6c1){_0x3e70a8=_0x3e70a8-0x0;var _0x2a415f=_0xda19[_0x3e70a8];return _0x2a415f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9da1('0x0'));var rimraf=require(_0x9da1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9da1('0x2'));var rp=require('request-promise');var moment=require(_0x9da1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9da1('0x4'));var util=require(_0x9da1('0x5'));var path=require(_0x9da1('0x6'));var sox=require(_0x9da1('0x7'));var csv=require(_0x9da1('0x8'));var ejs=require(_0x9da1('0x9'));var fs=require('fs');var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];function respondWithStatusCode(_0x596b6b,_0x4735c7){_0x4735c7=_0x4735c7||0xcc;return function(_0x1d93f8){if(_0x1d93f8){return _0x596b6b[_0x9da1('0x17')](_0x4735c7);}return _0x596b6b[_0x9da1('0x18')](_0x4735c7)['end']();};}function respondWithResult(_0x2837e3,_0x535a13){_0x535a13=_0x535a13||0xc8;return function(_0x4d17e1){if(_0x4d17e1){return _0x2837e3[_0x9da1('0x18')](_0x535a13)['json'](_0x4d17e1);}};}function respondWithFilteredResult(_0x433ff4,_0x43c093){return function(_0x37653d){if(_0x37653d){var _0x1a1a6b=_0x37653d[_0x9da1('0x19')],_0x7f1a64=_0x43c093[_0x9da1('0x1a')],_0x514d8e=_0x43c093[_0x9da1('0x1a')]+_0x43c093[_0x9da1('0x1b')],_0x16f75a;if(_0x514d8e>=_0x1a1a6b){_0x514d8e=_0x1a1a6b;_0x16f75a=0xc8;}else{_0x16f75a=0xce;}_0x433ff4[_0x9da1('0x18')](_0x16f75a);return _0x433ff4['set']('Content-Range',_0x7f1a64+'-'+_0x514d8e+'/'+_0x1a1a6b)[_0x9da1('0x1c')](_0x37653d);}return null;};}function patchUpdates(_0x8da712){return function(_0x1b0e7f){try{jsonpatch[_0x9da1('0x1d')](_0x1b0e7f,_0x8da712,!![]);}catch(_0x40a967){return BPromise[_0x9da1('0x1e')](_0x40a967);}return _0x1b0e7f[_0x9da1('0x1f')]();};}function saveUpdates(_0x47e5cf,_0x1a459c){return function(_0x554845){if(_0x554845){return _0x554845[_0x9da1('0x20')](_0x47e5cf)[_0x9da1('0x21')](function(_0x1fc065){return _0x1fc065;});}return null;};}function removeEntity(_0x4e9d7d,_0x5454d3){return function(_0x14793b){if(_0x14793b){return _0x14793b[_0x9da1('0x22')]()[_0x9da1('0x21')](function(){_0x4e9d7d[_0x9da1('0x18')](0xcc)[_0x9da1('0x23')]();});}};}function handleEntityNotFound(_0x165b73,_0x4c60aa){return function(_0x2413fe){if(!_0x2413fe){_0x165b73[_0x9da1('0x17')](0x194);}return _0x2413fe;};}function handleError(_0x4fd25a,_0x45fcce){_0x45fcce=_0x45fcce||0x1f4;return function(_0x3f5680){logger['error'](_0x3f5680[_0x9da1('0x24')]);if(_0x3f5680[_0x9da1('0x25')]){delete _0x3f5680['name'];}_0x4fd25a[_0x9da1('0x18')](_0x45fcce)[_0x9da1('0x26')](_0x3f5680);};}exports['index']=function(_0x5c09ed,_0x67dbc8){var _0x47055e={},_0x5eca5b={},_0x27c6e2={'count':0x0,'rows':[]};var _0x5db5c2=_['map'](db['UserProfileResource'][_0x9da1('0x27')],function(_0x404b86){return{'name':_0x404b86[_0x9da1('0x28')],'type':_0x404b86[_0x9da1('0x29')][_0x9da1('0x2a')]};});_0x5eca5b['model']=_[_0x9da1('0x2b')](_0x5db5c2,'name');_0x5eca5b[_0x9da1('0x2c')]=_[_0x9da1('0x2d')](_0x5c09ed['query']);_0x5eca5b[_0x9da1('0x2e')]=_[_0x9da1('0x2f')](_0x5eca5b['model'],_0x5eca5b[_0x9da1('0x2c')]);_0x47055e[_0x9da1('0x30')]=_[_0x9da1('0x2f')](_0x5eca5b[_0x9da1('0x31')],qs['fields'](_0x5c09ed['query'][_0x9da1('0x32')]));_0x47055e[_0x9da1('0x30')]=_0x47055e[_0x9da1('0x30')][_0x9da1('0x33')]?_0x47055e[_0x9da1('0x30')]:_0x5eca5b['model'];if(!_0x5c09ed[_0x9da1('0x2c')][_0x9da1('0x34')](_0x9da1('0x35'))){_0x47055e[_0x9da1('0x1b')]=qs[_0x9da1('0x1b')](_0x5c09ed[_0x9da1('0x2c')]['limit']);_0x47055e[_0x9da1('0x1a')]=qs['offset'](_0x5c09ed['query'][_0x9da1('0x1a')]);}_0x47055e['order']=qs[_0x9da1('0x36')](_0x5c09ed[_0x9da1('0x2c')][_0x9da1('0x36')]);_0x47055e[_0x9da1('0x37')]=qs[_0x9da1('0x2e')](_[_0x9da1('0x38')](_0x5c09ed[_0x9da1('0x2c')],_0x5eca5b[_0x9da1('0x2e')]),_0x5db5c2);if(_0x5c09ed['query'][_0x9da1('0x39')]){_0x47055e['where']=_[_0x9da1('0x3a')](_0x47055e['where'],{'$or':_['map'](_0x5db5c2,function(_0x1ce0f8){if(_0x1ce0f8['type']!==_0x9da1('0x3b')){var _0x227a1c={};_0x227a1c[_0x1ce0f8['name']]={'$like':'%'+_0x5c09ed[_0x9da1('0x2c')][_0x9da1('0x39')]+'%'};return _0x227a1c;}})});}_0x47055e=_[_0x9da1('0x3a')]({},_0x47055e,_0x5c09ed[_0x9da1('0x3c')]);var _0x56bd49={'where':_0x47055e[_0x9da1('0x37')]};return db['UserProfileResource'][_0x9da1('0x19')](_0x56bd49)['then'](function(_0x26e8d3){_0x27c6e2[_0x9da1('0x19')]=_0x26e8d3;if(_0x5c09ed['query'][_0x9da1('0x3d')]){_0x47055e[_0x9da1('0x3e')]=[{'all':!![]}];}return db[_0x9da1('0x3f')]['findAll'](_0x47055e);})['then'](function(_0x53fc15){_0x27c6e2[_0x9da1('0x40')]=_0x53fc15;return _0x27c6e2;})['then'](respondWithFilteredResult(_0x67dbc8,_0x47055e))[_0x9da1('0x41')](handleError(_0x67dbc8,null));};exports[_0x9da1('0x42')]=function(_0x118be7,_0x43c064){var _0x54f188={'raw':![],'where':{'id':_0x118be7[_0x9da1('0x43')]['id']}},_0x42dbd8={};_0x42dbd8[_0x9da1('0x31')]=_[_0x9da1('0x2d')](db[_0x9da1('0x3f')][_0x9da1('0x27')]);_0x42dbd8[_0x9da1('0x2c')]=_['keys'](_0x118be7[_0x9da1('0x2c')]);_0x42dbd8['filters']=_[_0x9da1('0x2f')](_0x42dbd8['model'],_0x42dbd8[_0x9da1('0x2c')]);_0x54f188[_0x9da1('0x30')]=_['intersection'](_0x42dbd8[_0x9da1('0x31')],qs[_0x9da1('0x32')](_0x118be7['query'][_0x9da1('0x32')]));_0x54f188['attributes']=_0x54f188[_0x9da1('0x30')][_0x9da1('0x33')]?_0x54f188['attributes']:_0x42dbd8['model'];if(_0x118be7[_0x9da1('0x2c')][_0x9da1('0x3d')]){_0x54f188[_0x9da1('0x3e')]=[{'all':!![]}];}_0x54f188=_[_0x9da1('0x3a')]({},_0x54f188,_0x118be7[_0x9da1('0x3c')]);return db[_0x9da1('0x3f')][_0x9da1('0x44')](_0x54f188)[_0x9da1('0x21')](handleEntityNotFound(_0x43c064,null))['then'](respondWithResult(_0x43c064,null))[_0x9da1('0x41')](handleError(_0x43c064,null));};exports[_0x9da1('0x45')]=function(_0x1eebc5,_0x5cf7ef){return db[_0x9da1('0x3f')][_0x9da1('0x45')](_0x1eebc5[_0x9da1('0x46')],{})['then'](respondWithResult(_0x5cf7ef,0xc9))[_0x9da1('0x41')](handleError(_0x5cf7ef,null));};exports[_0x9da1('0x20')]=function(_0x28b1b0,_0x516bdd){if(_0x28b1b0[_0x9da1('0x46')]['id']){delete _0x28b1b0['body']['id'];}return db['UserProfileResource'][_0x9da1('0x44')]({'where':{'id':_0x28b1b0[_0x9da1('0x43')]['id']}})['then'](handleEntityNotFound(_0x516bdd,null))[_0x9da1('0x21')](saveUpdates(_0x28b1b0[_0x9da1('0x46')],null))['then'](respondWithResult(_0x516bdd,null))[_0x9da1('0x41')](handleError(_0x516bdd,null));};exports[_0x9da1('0x22')]=function(_0x1984f7,_0x3a529d){return db[_0x9da1('0x3f')][_0x9da1('0x44')]({'where':{'id':_0x1984f7[_0x9da1('0x43')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x3a529d,null))[_0x9da1('0x21')](removeEntity(_0x3a529d,null))['catch'](handleError(_0x3a529d,null));};exports[_0x9da1('0x47')]=function(_0xe6c667,_0x34a203){return db[_0x9da1('0x3f')]['describe']()['then'](respondWithResult(_0x34a203,null))[_0x9da1('0x41')](handleError(_0x34a203,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 6a3cde8..c66e67e 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 _0x13ca=['moment','request-promise','path','../../config/environment','./userProfileResource.attributes','exports','user_profile_has_resources','util'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x13ca,0xa7));var _0xa13c=function(_0x2e3486,_0x1d2b49){_0x2e3486=_0x2e3486-0x0;var _0xf3437a=_0x13ca[_0x2e3486];return _0xf3437a;};'use strict';var _=require('lodash');var util=require(_0xa13c('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa13c('0x1'));var BPromise=require('bluebird');var rp=require(_0xa13c('0x2'));var fs=require('fs');var path=require(_0xa13c('0x3'));var rimraf=require('rimraf');var config=require(_0xa13c('0x4'));var attributes=require(_0xa13c('0x5'));module[_0xa13c('0x6')]=function(_0x4a36ee,_0x4564e2){return _0x4a36ee['define']('UserProfileResource',attributes,{'tableName':_0xa13c('0x7'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0274=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x0274,0x1cf));var _0x4027=function(_0x26907e,_0x5ce8a7){_0x26907e=_0x26907e-0x0;var _0x59091c=_0x0274[_0x26907e];return _0x59091c;};'use strict';var _=require(_0x4027('0x0'));var util=require(_0x4027('0x1'));var logger=require(_0x4027('0x2'))(_0x4027('0x3'));var moment=require(_0x4027('0x4'));var BPromise=require(_0x4027('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4027('0x6'));var rimraf=require(_0x4027('0x7'));var config=require(_0x4027('0x8'));var attributes=require(_0x4027('0x9'));module[_0x4027('0xa')]=function(_0x260747,_0x254736){return _0x260747['define'](_0x4027('0xb'),attributes,{'tableName':_0x4027('0xc'),'paranoid':![],'indexes':[{'name':_0x4027('0xd'),'fields':[_0x4027('0xe'),_0x4027('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 559a533..284f57c 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 _0x9616=['request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0x9616,0x1af));var _0x6961=function(_0xdeac17,_0x19ad66){_0xdeac17=_0xdeac17-0x0;var _0x33aabd=_0x9616[_0xdeac17];return _0x33aabd;};'use strict';var _=require(_0x6961('0x0'));var util=require(_0x6961('0x1'));var moment=require(_0x6961('0x2'));var BPromise=require(_0x6961('0x3'));var rs=require(_0x6961('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6961('0x5'));var config=require(_0x6961('0x6'));var jayson=require(_0x6961('0x7'));var client=jayson[_0x6961('0x8')][_0x6961('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37ef1f,_0x1a6ec6,_0x53d9a5){return new BPromise(function(_0x47a5b9,_0x584b89){return client[_0x6961('0xa')](_0x37ef1f,_0x53d9a5)['then'](function(_0x2d4a6f){logger[_0x6961('0xb')](_0x6961('0xc'),_0x1a6ec6,_0x6961('0xd'));logger[_0x6961('0xe')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x1a6ec6,_0x6961('0xd'),JSON[_0x6961('0xf')](_0x2d4a6f));if(_0x2d4a6f[_0x6961('0x10')]){if(_0x2d4a6f[_0x6961('0x10')][_0x6961('0x11')]===0x1f4){logger[_0x6961('0x10')](_0x6961('0xc'),_0x1a6ec6,_0x2d4a6f[_0x6961('0x10')]['message']);return _0x584b89(_0x2d4a6f['error']['message']);}logger[_0x6961('0x10')](_0x6961('0xc'),_0x1a6ec6,_0x2d4a6f['error'][_0x6961('0x12')]);return _0x47a5b9(_0x2d4a6f[_0x6961('0x10')][_0x6961('0x12')]);}else{logger[_0x6961('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x1a6ec6,'request\x20sent');_0x47a5b9(_0x2d4a6f[_0x6961('0x13')][_0x6961('0x12')]);}})[_0x6961('0x14')](function(_0x4749f1){logger[_0x6961('0x10')](_0x6961('0xc'),_0x1a6ec6,_0x4749f1);_0x584b89(_0x4749f1);});});} \ No newline at end of file +var _0x4022=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xc05d78,_0x300f27){var _0x2a493f=function(_0x5e632c){while(--_0x5e632c){_0xc05d78['push'](_0xc05d78['shift']());}};_0x2a493f(++_0x300f27);}(_0x4022,0x1c9));var _0x2402=function(_0x38585b,_0x5489a8){_0x38585b=_0x38585b-0x0;var _0x37dc69=_0x4022[_0x38585b];return _0x37dc69;};'use strict';var _=require(_0x2402('0x0'));var util=require(_0x2402('0x1'));var moment=require(_0x2402('0x2'));var BPromise=require(_0x2402('0x3'));var rs=require(_0x2402('0x4'));var fs=require('fs');var Redis=require(_0x2402('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2402('0x6'));var logger=require(_0x2402('0x7'))(_0x2402('0x8'));var config=require(_0x2402('0x9'));var jayson=require(_0x2402('0xa'));var client=jayson[_0x2402('0xb')][_0x2402('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41d880,_0x30c435,_0x5406ff){return new BPromise(function(_0x29d817,_0x5a8bf5){return client[_0x2402('0xd')](_0x41d880,_0x5406ff)['then'](function(_0x3974c9){logger[_0x2402('0xe')](_0x2402('0xf'),_0x30c435,_0x2402('0x10'));logger[_0x2402('0x11')](_0x2402('0x12'),_0x30c435,_0x2402('0x10'),JSON[_0x2402('0x13')](_0x3974c9));if(_0x3974c9[_0x2402('0x14')]){if(_0x3974c9[_0x2402('0x14')][_0x2402('0x15')]===0x1f4){logger[_0x2402('0x14')](_0x2402('0xf'),_0x30c435,_0x3974c9['error']['message']);return _0x5a8bf5(_0x3974c9[_0x2402('0x14')][_0x2402('0x16')]);}logger[_0x2402('0x14')](_0x2402('0xf'),_0x30c435,_0x3974c9['error'][_0x2402('0x16')]);return _0x29d817(_0x3974c9[_0x2402('0x14')][_0x2402('0x16')]);}else{logger['info'](_0x2402('0xf'),_0x30c435,_0x2402('0x10'));_0x29d817(_0x3974c9['result'][_0x2402('0x16')]);}})[_0x2402('0x17')](function(_0x5e2946){logger['error'](_0x2402('0xf'),_0x30c435,_0x5e2946);_0x5a8bf5(_0x5e2946);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index c822c5c..19f4004 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 _0xe50a=['multer','util','path','express','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','/:id','show','post','put','destroy','exports'];(function(_0x1bb4ac,_0x381c16){var _0x849483=function(_0x2a5799){while(--_0x2a5799){_0x1bb4ac['push'](_0x1bb4ac['shift']());}};_0x849483(++_0x381c16);}(_0xe50a,0xf0));var _0xae50=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0xe50a[_0x5d4f12];return _0x4eb577;};'use strict';var multer=require(_0xae50('0x0'));var util=require(_0xae50('0x1'));var path=require(_0xae50('0x2'));var timeout=require('connect-timeout');var express=require(_0xae50('0x3'));var router=express['Router']();var auth=require(_0xae50('0x4'));var interaction=require(_0xae50('0x5'));var config=require('../../config/environment');var controller=require(_0xae50('0x6'));router[_0xae50('0x7')]('/',auth[_0xae50('0x8')](),controller['index']);router[_0xae50('0x7')]('/describe',auth[_0xae50('0x8')](),controller['describe']);router[_0xae50('0x7')](_0xae50('0x9'),auth[_0xae50('0x8')](),controller[_0xae50('0xa')]);router[_0xae50('0xb')]('/',auth[_0xae50('0x8')](),controller['create']);router[_0xae50('0xc')](_0xae50('0x9'),auth[_0xae50('0x8')](),controller['update']);router['delete'](_0xae50('0x9'),auth[_0xae50('0x8')](),controller[_0xae50('0xd')]);module[_0xae50('0xe')]=router; \ No newline at end of file +var _0xad26=['/describe','describe','show','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated'];(function(_0x28f632,_0x19c6b5){var _0x1bbfa2=function(_0x403808){while(--_0x403808){_0x28f632['push'](_0x28f632['shift']());}};_0x1bbfa2(++_0x19c6b5);}(_0xad26,0x1ab));var _0x6ad2=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xad26[_0x42245d];return _0x4b211a;};'use strict';var multer=require(_0x6ad2('0x0'));var util=require('util');var path=require(_0x6ad2('0x1'));var timeout=require(_0x6ad2('0x2'));var express=require(_0x6ad2('0x3'));var router=express[_0x6ad2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6ad2('0x5'));var config=require(_0x6ad2('0x6'));var controller=require(_0x6ad2('0x7'));router[_0x6ad2('0x8')]('/',auth[_0x6ad2('0x9')](),controller['index']);router[_0x6ad2('0x8')](_0x6ad2('0xa'),auth[_0x6ad2('0x9')](),controller[_0x6ad2('0xb')]);router[_0x6ad2('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6ad2('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6ad2('0xd')](_0x6ad2('0xe'),auth['isAuthenticated'](),controller[_0x6ad2('0xf')]);router[_0x6ad2('0x10')](_0x6ad2('0xe'),auth[_0x6ad2('0x9')](),controller[_0x6ad2('0x11')]);module[_0x6ad2('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 2e40867..f4f4a08 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 _0xca2b=['sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','split'];(function(_0x55fe88,_0x41d639){var _0x13e1f6=function(_0x14cdc9){while(--_0x14cdc9){_0x55fe88['push'](_0x55fe88['shift']());}};_0x13e1f6(++_0x41d639);}(_0xca2b,0x156));var _0xbca2=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xca2b[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0xbca2('0x0'));module[_0xbca2('0x1')]={'name':{'type':Sequelize[_0xbca2('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xbca2('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xbca2('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xbca2('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xbca2('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xbca2('0x2')],'set':function(_0x48a06a){this[_0xbca2('0x5')](_0xbca2('0x6'),_0x48a06a?_0x48a06a['join'](''):[]);},'get':function(){return this[_0xbca2('0x7')]('crudPermissions')?this[_0xbca2('0x7')](_0xbca2('0x6'))[_0xbca2('0x8')](''):[];}}}; \ No newline at end of file +var _0x6364=['join','getDataValue','crudPermissions','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0x6364,0x8f));var _0x4636=function(_0x21d5b3,_0x2ff359){_0x21d5b3=_0x21d5b3-0x0;var _0x4f82c9=_0x6364[_0x21d5b3];return _0x4f82c9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4636('0x0')],'allowNull':![]},'category':{'type':Sequelize[_0x4636('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4636('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4636('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4636('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4636('0x0')],'set':function(_0x28d2a2){this[_0x4636('0x3')]('crudPermissions',_0x28d2a2?_0x28d2a2[_0x4636('0x4')](''):[]);},'get':function(){return this[_0x4636('0x5')](_0x4636('0x6'))?this[_0x4636('0x5')](_0x4636('0x6'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 766ee09..5a88f5d 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 _0xb525=['describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','keys','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','create','body','find','destroy'];(function(_0x59145a,_0x1f60f1){var _0xf04d7=function(_0x247581){while(--_0x247581){_0x59145a['push'](_0x59145a['shift']());}};_0xf04d7(++_0x1f60f1);}(_0xb525,0x18c));var _0x5b52=function(_0x1e8e8d,_0x577955){_0x1e8e8d=_0x1e8e8d-0x0;var _0x49f60d=_0xb525[_0x1e8e8d];return _0x49f60d;};'use strict';var pdf=require(_0x5b52('0x0'));var emlformat=require(_0x5b52('0x1'));var rimraf=require(_0x5b52('0x2'));var zipdir=require(_0x5b52('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5b52('0x4'));var BPromise=require(_0x5b52('0x5'));var Mustache=require(_0x5b52('0x6'));var util=require(_0x5b52('0x7'));var path=require(_0x5b52('0x8'));var sox=require(_0x5b52('0x9'));var csv=require(_0x5b52('0xa'));var ejs=require(_0x5b52('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5b52('0xc'));var crypto=require(_0x5b52('0xd'));var jsforce=require(_0x5b52('0xe'));var deskjs=require(_0x5b52('0xf'));var toCsv=require(_0x5b52('0xa'));var querystring=require(_0x5b52('0x10'));var Papa=require(_0x5b52('0x11'));var Redis=require(_0x5b52('0x12'));var authService=require(_0x5b52('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5b52('0x14'));var hardwareService=require(_0x5b52('0x15'));var logger=require(_0x5b52('0x16'))(_0x5b52('0x17'));var utils=require(_0x5b52('0x18'));var config=require(_0x5b52('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b52('0x1a'))['db'];function respondWithStatusCode(_0x3d99f2,_0x41058f){_0x41058f=_0x41058f||0xcc;return function(_0x52de2b){if(_0x52de2b){return _0x3d99f2[_0x5b52('0x1b')](_0x41058f);}return _0x3d99f2[_0x5b52('0x1c')](_0x41058f)['end']();};}function respondWithResult(_0x14073c,_0x3943ff){_0x3943ff=_0x3943ff||0xc8;return function(_0x4c1550){if(_0x4c1550){return _0x14073c[_0x5b52('0x1c')](_0x3943ff)[_0x5b52('0x1d')](_0x4c1550);}};}function respondWithFilteredResult(_0x4b99c3,_0x54e486){return function(_0x2a5380){if(_0x2a5380){var _0x53cfa2=_0x2a5380[_0x5b52('0x1e')],_0x5779b0=_0x54e486[_0x5b52('0x1f')],_0x360a14=_0x54e486[_0x5b52('0x1f')]+_0x54e486[_0x5b52('0x20')],_0x38aa7b;if(_0x360a14>=_0x53cfa2){_0x360a14=_0x53cfa2;_0x38aa7b=0xc8;}else{_0x38aa7b=0xce;}_0x4b99c3['status'](_0x38aa7b);return _0x4b99c3['set'](_0x5b52('0x21'),_0x5779b0+'-'+_0x360a14+'/'+_0x53cfa2)[_0x5b52('0x1d')](_0x2a5380);}return null;};}function patchUpdates(_0x36824f){return function(_0x13690f){try{jsonpatch[_0x5b52('0x22')](_0x13690f,_0x36824f,!![]);}catch(_0x217df5){return BPromise[_0x5b52('0x23')](_0x217df5);}return _0x13690f[_0x5b52('0x24')]();};}function saveUpdates(_0x3c00de,_0x592b84){return function(_0x4e1602){if(_0x4e1602){return _0x4e1602[_0x5b52('0x25')](_0x3c00de)[_0x5b52('0x26')](function(_0xe4d7e6){return _0xe4d7e6;});}return null;};}function removeEntity(_0x333c6f,_0x5d01ec){return function(_0x5a7b51){if(_0x5a7b51){return _0x5a7b51['destroy']()[_0x5b52('0x26')](function(){_0x333c6f[_0x5b52('0x1c')](0xcc)[_0x5b52('0x27')]();});}};}function handleEntityNotFound(_0x54c8b7,_0x5eff55){return function(_0x11df56){if(!_0x11df56){_0x54c8b7[_0x5b52('0x1b')](0x194);}return _0x11df56;};}function handleError(_0x21c175,_0x228a0f){_0x228a0f=_0x228a0f||0x1f4;return function(_0x56a9bb){logger[_0x5b52('0x28')](_0x56a9bb[_0x5b52('0x29')]);if(_0x56a9bb[_0x5b52('0x2a')]){delete _0x56a9bb[_0x5b52('0x2a')];}_0x21c175[_0x5b52('0x1c')](_0x228a0f)[_0x5b52('0x2b')](_0x56a9bb);};}exports[_0x5b52('0x2c')]=function(_0x4f047c,_0xff3364){var _0x2021ca={},_0x37661d={},_0x36a840={'count':0x0,'rows':[]};var _0x36b006=_[_0x5b52('0x2d')](db[_0x5b52('0x2e')][_0x5b52('0x2f')],function(_0x5bd3b6){return{'name':_0x5bd3b6[_0x5b52('0x30')],'type':_0x5bd3b6[_0x5b52('0x31')][_0x5b52('0x32')]};});_0x37661d['model']=_[_0x5b52('0x2d')](_0x36b006,_0x5b52('0x2a'));_0x37661d['query']=_[_0x5b52('0x33')](_0x4f047c[_0x5b52('0x34')]);_0x37661d['filters']=_[_0x5b52('0x35')](_0x37661d[_0x5b52('0x36')],_0x37661d[_0x5b52('0x34')]);_0x2021ca['attributes']=_[_0x5b52('0x35')](_0x37661d['model'],qs[_0x5b52('0x37')](_0x4f047c[_0x5b52('0x34')]['fields']));_0x2021ca[_0x5b52('0x38')]=_0x2021ca[_0x5b52('0x38')]['length']?_0x2021ca['attributes']:_0x37661d[_0x5b52('0x36')];if(!_0x4f047c[_0x5b52('0x34')][_0x5b52('0x39')](_0x5b52('0x3a'))){_0x2021ca[_0x5b52('0x20')]=qs[_0x5b52('0x20')](_0x4f047c[_0x5b52('0x34')][_0x5b52('0x20')]);_0x2021ca[_0x5b52('0x1f')]=qs[_0x5b52('0x1f')](_0x4f047c['query'][_0x5b52('0x1f')]);}_0x2021ca[_0x5b52('0x3b')]=qs[_0x5b52('0x3c')](_0x4f047c['query'][_0x5b52('0x3c')]);_0x2021ca[_0x5b52('0x3d')]=qs[_0x5b52('0x3e')](_[_0x5b52('0x3f')](_0x4f047c[_0x5b52('0x34')],_0x37661d[_0x5b52('0x3e')]),_0x36b006);if(_0x4f047c[_0x5b52('0x34')]['filter']){_0x2021ca['where']=_[_0x5b52('0x40')](_0x2021ca[_0x5b52('0x3d')],{'$or':_['map'](_0x36b006,function(_0x53030b){if(_0x53030b[_0x5b52('0x31')]!==_0x5b52('0x41')){var _0x46cb99={};_0x46cb99[_0x53030b[_0x5b52('0x2a')]]={'$like':'%'+_0x4f047c[_0x5b52('0x34')]['filter']+'%'};return _0x46cb99;}})});}_0x2021ca=_[_0x5b52('0x40')]({},_0x2021ca,_0x4f047c[_0x5b52('0x42')]);var _0x4653d0={'where':_0x2021ca[_0x5b52('0x3d')]};return db['UserProfileSection'][_0x5b52('0x1e')](_0x4653d0)[_0x5b52('0x26')](function(_0x53f647){_0x36a840[_0x5b52('0x1e')]=_0x53f647;if(_0x4f047c['query'][_0x5b52('0x43')]){_0x2021ca[_0x5b52('0x44')]=[{'all':!![]}];}return db['UserProfileSection'][_0x5b52('0x45')](_0x2021ca);})['then'](function(_0x5099f0){_0x36a840[_0x5b52('0x46')]=_0x5099f0;return _0x36a840;})[_0x5b52('0x26')](respondWithFilteredResult(_0xff3364,_0x2021ca))[_0x5b52('0x47')](handleError(_0xff3364,null));};exports[_0x5b52('0x48')]=function(_0x48c6da,_0x4de0aa){var _0x4d87db={'raw':![],'where':{'id':_0x48c6da['params']['id']}},_0x295f78={};_0x295f78[_0x5b52('0x36')]=_[_0x5b52('0x33')](db[_0x5b52('0x2e')][_0x5b52('0x2f')]);_0x295f78[_0x5b52('0x34')]=_[_0x5b52('0x33')](_0x48c6da[_0x5b52('0x34')]);_0x295f78[_0x5b52('0x3e')]=_['intersection'](_0x295f78[_0x5b52('0x36')],_0x295f78[_0x5b52('0x34')]);_0x4d87db[_0x5b52('0x38')]=_['intersection'](_0x295f78[_0x5b52('0x36')],qs['fields'](_0x48c6da['query'][_0x5b52('0x37')]));_0x4d87db[_0x5b52('0x38')]=_0x4d87db[_0x5b52('0x38')][_0x5b52('0x49')]?_0x4d87db[_0x5b52('0x38')]:_0x295f78[_0x5b52('0x36')];if(_0x48c6da['query'][_0x5b52('0x43')]){_0x4d87db[_0x5b52('0x44')]=[{'all':!![]}];}_0x4d87db=_[_0x5b52('0x40')]({},_0x4d87db,_0x48c6da['options']);return db[_0x5b52('0x2e')]['find'](_0x4d87db)[_0x5b52('0x26')](handleEntityNotFound(_0x4de0aa,null))[_0x5b52('0x26')](respondWithResult(_0x4de0aa,null))[_0x5b52('0x47')](handleError(_0x4de0aa,null));};exports['create']=function(_0xf4e42f,_0x972a53){return db[_0x5b52('0x2e')][_0x5b52('0x4a')](_0xf4e42f[_0x5b52('0x4b')],{})[_0x5b52('0x26')](respondWithResult(_0x972a53,0xc9))[_0x5b52('0x47')](handleError(_0x972a53,null));};exports[_0x5b52('0x25')]=function(_0x7e995f,_0x1fa939){if(_0x7e995f[_0x5b52('0x4b')]['id']){delete _0x7e995f[_0x5b52('0x4b')]['id'];}return db[_0x5b52('0x2e')][_0x5b52('0x4c')]({'where':{'id':_0x7e995f['params']['id']}})['then'](handleEntityNotFound(_0x1fa939,null))[_0x5b52('0x26')](saveUpdates(_0x7e995f[_0x5b52('0x4b')],null))[_0x5b52('0x26')](respondWithResult(_0x1fa939,null))[_0x5b52('0x47')](handleError(_0x1fa939,null));};exports[_0x5b52('0x4d')]=function(_0x28ac6e,_0x3872a4){return db['UserProfileSection'][_0x5b52('0x4c')]({'where':{'id':_0x28ac6e['params']['id']}})['then'](handleEntityNotFound(_0x3872a4,null))[_0x5b52('0x26')](removeEntity(_0x3872a4,null))['catch'](handleError(_0x3872a4,null));};exports[_0x5b52('0x4e')]=function(_0x3165e1,_0x499509){return db[_0x5b52('0x2e')][_0x5b52('0x4e')]()[_0x5b52('0x26')](respondWithResult(_0x499509,null))[_0x5b52('0x47')](handleError(_0x499509,null));}; \ No newline at end of file +var _0x16f8=['path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','Content-Range','apply','reject','save','error','stack','name','status','send','index','map','UserProfileSection','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','then','rows','show','keys','rawAttributes','length','find','catch','body','update','params','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0xc9b9f3,_0x4b96c4){var _0x2e4a9a=function(_0x3c6834){while(--_0x3c6834){_0xc9b9f3['push'](_0xc9b9f3['shift']());}};_0x2e4a9a(++_0x4b96c4);}(_0x16f8,0x91));var _0x816f=function(_0x4caff1,_0x4d7ce1){_0x4caff1=_0x4caff1-0x0;var _0x2e088f=_0x16f8[_0x4caff1];return _0x2e088f;};'use strict';var pdf=require(_0x816f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x816f('0x1'));var zipdir=require(_0x816f('0x2'));var jsonpatch=require(_0x816f('0x3'));var rp=require(_0x816f('0x4'));var moment=require(_0x816f('0x5'));var BPromise=require(_0x816f('0x6'));var Mustache=require(_0x816f('0x7'));var util=require(_0x816f('0x8'));var path=require(_0x816f('0x9'));var sox=require(_0x816f('0xa'));var csv=require('to-csv');var ejs=require(_0x816f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x816f('0xc'));var jsforce=require(_0x816f('0xd'));var deskjs=require(_0x816f('0xe'));var toCsv=require(_0x816f('0xf'));var querystring=require(_0x816f('0x10'));var Papa=require('papaparse');var Redis=require(_0x816f('0x11'));var authService=require(_0x816f('0x12'));var qs=require(_0x816f('0x13'));var as=require(_0x816f('0x14'));var hardwareService=require(_0x816f('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x816f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x816f('0x17'));var db=require(_0x816f('0x18'))['db'];function respondWithStatusCode(_0x50a8cd,_0x3d64fe){_0x3d64fe=_0x3d64fe||0xcc;return function(_0x42ccdf){if(_0x42ccdf){return _0x50a8cd[_0x816f('0x19')](_0x3d64fe);}return _0x50a8cd['status'](_0x3d64fe)[_0x816f('0x1a')]();};}function respondWithResult(_0x3b21b1,_0x3c6aff){_0x3c6aff=_0x3c6aff||0xc8;return function(_0x4c1fec){if(_0x4c1fec){return _0x3b21b1['status'](_0x3c6aff)[_0x816f('0x1b')](_0x4c1fec);}};}function respondWithFilteredResult(_0x22d535,_0x22fe81){return function(_0x3b4408){if(_0x3b4408){var _0x4dc52b=_0x3b4408['count'],_0x40313d=_0x22fe81['offset'],_0x3c7760=_0x22fe81[_0x816f('0x1c')]+_0x22fe81[_0x816f('0x1d')],_0x1ef437;if(_0x3c7760>=_0x4dc52b){_0x3c7760=_0x4dc52b;_0x1ef437=0xc8;}else{_0x1ef437=0xce;}_0x22d535['status'](_0x1ef437);return _0x22d535['set'](_0x816f('0x1e'),_0x40313d+'-'+_0x3c7760+'/'+_0x4dc52b)[_0x816f('0x1b')](_0x3b4408);}return null;};}function patchUpdates(_0x322e44){return function(_0x5d3a80){try{jsonpatch[_0x816f('0x1f')](_0x5d3a80,_0x322e44,!![]);}catch(_0x2a9dd0){return BPromise[_0x816f('0x20')](_0x2a9dd0);}return _0x5d3a80[_0x816f('0x21')]();};}function saveUpdates(_0x439c85,_0x5591c2){return function(_0x5a7cfb){if(_0x5a7cfb){return _0x5a7cfb['update'](_0x439c85)['then'](function(_0x344dd8){return _0x344dd8;});}return null;};}function removeEntity(_0x850218,_0x58b0a8){return function(_0xc3885a){if(_0xc3885a){return _0xc3885a['destroy']()['then'](function(){_0x850218['status'](0xcc)[_0x816f('0x1a')]();});}};}function handleEntityNotFound(_0x4b8694,_0x51be5d){return function(_0x375f37){if(!_0x375f37){_0x4b8694[_0x816f('0x19')](0x194);}return _0x375f37;};}function handleError(_0x646414,_0xd7d38e){_0xd7d38e=_0xd7d38e||0x1f4;return function(_0xd7470e){logger[_0x816f('0x22')](_0xd7470e[_0x816f('0x23')]);if(_0xd7470e[_0x816f('0x24')]){delete _0xd7470e[_0x816f('0x24')];}_0x646414[_0x816f('0x25')](_0xd7d38e)[_0x816f('0x26')](_0xd7470e);};}exports[_0x816f('0x27')]=function(_0x52d9e3,_0x200684){var _0x257b01={},_0x1fe05f={},_0xccc2ba={'count':0x0,'rows':[]};var _0x56aafd=_[_0x816f('0x28')](db[_0x816f('0x29')]['rawAttributes'],function(_0x34c688){return{'name':_0x34c688[_0x816f('0x2a')],'type':_0x34c688['type'][_0x816f('0x2b')]};});_0x1fe05f[_0x816f('0x2c')]=_[_0x816f('0x28')](_0x56aafd,_0x816f('0x24'));_0x1fe05f[_0x816f('0x2d')]=_['keys'](_0x52d9e3[_0x816f('0x2d')]);_0x1fe05f['filters']=_[_0x816f('0x2e')](_0x1fe05f[_0x816f('0x2c')],_0x1fe05f[_0x816f('0x2d')]);_0x257b01[_0x816f('0x2f')]=_[_0x816f('0x2e')](_0x1fe05f['model'],qs[_0x816f('0x30')](_0x52d9e3[_0x816f('0x2d')]['fields']));_0x257b01[_0x816f('0x2f')]=_0x257b01[_0x816f('0x2f')]['length']?_0x257b01['attributes']:_0x1fe05f['model'];if(!_0x52d9e3[_0x816f('0x2d')][_0x816f('0x31')](_0x816f('0x32'))){_0x257b01[_0x816f('0x1d')]=qs[_0x816f('0x1d')](_0x52d9e3[_0x816f('0x2d')][_0x816f('0x1d')]);_0x257b01[_0x816f('0x1c')]=qs[_0x816f('0x1c')](_0x52d9e3[_0x816f('0x2d')][_0x816f('0x1c')]);}_0x257b01[_0x816f('0x33')]=qs['sort'](_0x52d9e3['query'][_0x816f('0x34')]);_0x257b01[_0x816f('0x35')]=qs[_0x816f('0x36')](_[_0x816f('0x37')](_0x52d9e3['query'],_0x1fe05f[_0x816f('0x36')]),_0x56aafd);if(_0x52d9e3[_0x816f('0x2d')][_0x816f('0x38')]){_0x257b01[_0x816f('0x35')]=_[_0x816f('0x39')](_0x257b01[_0x816f('0x35')],{'$or':_['map'](_0x56aafd,function(_0x3cca3f){if(_0x3cca3f[_0x816f('0x3a')]!==_0x816f('0x3b')){var _0x2dc110={};_0x2dc110[_0x3cca3f[_0x816f('0x24')]]={'$like':'%'+_0x52d9e3[_0x816f('0x2d')]['filter']+'%'};return _0x2dc110;}})});}_0x257b01=_[_0x816f('0x39')]({},_0x257b01,_0x52d9e3[_0x816f('0x3c')]);var _0x3fda2a={'where':_0x257b01['where']};return db[_0x816f('0x29')][_0x816f('0x3d')](_0x3fda2a)['then'](function(_0x1c89db){_0xccc2ba[_0x816f('0x3d')]=_0x1c89db;if(_0x52d9e3[_0x816f('0x2d')][_0x816f('0x3e')]){_0x257b01['include']=[{'all':!![]}];}return db[_0x816f('0x29')][_0x816f('0x3f')](_0x257b01);})[_0x816f('0x40')](function(_0x3c36fb){_0xccc2ba[_0x816f('0x41')]=_0x3c36fb;return _0xccc2ba;})[_0x816f('0x40')](respondWithFilteredResult(_0x200684,_0x257b01))['catch'](handleError(_0x200684,null));};exports[_0x816f('0x42')]=function(_0x4da0fe,_0x4cf908){var _0x237798={'raw':![],'where':{'id':_0x4da0fe['params']['id']}},_0x4aa4a2={};_0x4aa4a2[_0x816f('0x2c')]=_[_0x816f('0x43')](db[_0x816f('0x29')][_0x816f('0x44')]);_0x4aa4a2['query']=_[_0x816f('0x43')](_0x4da0fe[_0x816f('0x2d')]);_0x4aa4a2['filters']=_[_0x816f('0x2e')](_0x4aa4a2[_0x816f('0x2c')],_0x4aa4a2[_0x816f('0x2d')]);_0x237798[_0x816f('0x2f')]=_[_0x816f('0x2e')](_0x4aa4a2[_0x816f('0x2c')],qs['fields'](_0x4da0fe[_0x816f('0x2d')][_0x816f('0x30')]));_0x237798['attributes']=_0x237798[_0x816f('0x2f')][_0x816f('0x45')]?_0x237798[_0x816f('0x2f')]:_0x4aa4a2['model'];if(_0x4da0fe[_0x816f('0x2d')][_0x816f('0x3e')]){_0x237798['include']=[{'all':!![]}];}_0x237798=_[_0x816f('0x39')]({},_0x237798,_0x4da0fe[_0x816f('0x3c')]);return db[_0x816f('0x29')][_0x816f('0x46')](_0x237798)[_0x816f('0x40')](handleEntityNotFound(_0x4cf908,null))[_0x816f('0x40')](respondWithResult(_0x4cf908,null))[_0x816f('0x47')](handleError(_0x4cf908,null));};exports['create']=function(_0x3fb819,_0x12c83b){return db[_0x816f('0x29')]['create'](_0x3fb819[_0x816f('0x48')],{})[_0x816f('0x40')](respondWithResult(_0x12c83b,0xc9))[_0x816f('0x47')](handleError(_0x12c83b,null));};exports[_0x816f('0x49')]=function(_0x1c56b7,_0x1f4e17){if(_0x1c56b7[_0x816f('0x48')]['id']){delete _0x1c56b7[_0x816f('0x48')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x1c56b7[_0x816f('0x4a')]['id']}})[_0x816f('0x40')](handleEntityNotFound(_0x1f4e17,null))['then'](saveUpdates(_0x1c56b7[_0x816f('0x48')],null))[_0x816f('0x40')](respondWithResult(_0x1f4e17,null))[_0x816f('0x47')](handleError(_0x1f4e17,null));};exports[_0x816f('0x4b')]=function(_0x3b6a0b,_0x495dc1){return db[_0x816f('0x29')][_0x816f('0x46')]({'where':{'id':_0x3b6a0b[_0x816f('0x4a')]['id']}})[_0x816f('0x40')](handleEntityNotFound(_0x495dc1,null))[_0x816f('0x40')](removeEntity(_0x495dc1,null))[_0x816f('0x47')](handleError(_0x495dc1,null));};exports['describe']=function(_0x5246b9,_0x2a04f9){return db[_0x816f('0x29')][_0x816f('0x4c')]()[_0x816f('0x40')](respondWithResult(_0x2a04f9,null))[_0x816f('0x47')](handleError(_0x2a04f9,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index dde62a0..f966739 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 _0x7782=['rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','userProfileId','util','api','moment','bluebird','request-promise','path'];(function(_0xc23904,_0x65e769){var _0x181835=function(_0x357d63){while(--_0x357d63){_0xc23904['push'](_0xc23904['shift']());}};_0x181835(++_0x65e769);}(_0x7782,0xa2));var _0x2778=function(_0xaddd82,_0x1d8733){_0xaddd82=_0xaddd82-0x0;var _0x1015a0=_0x7782[_0xaddd82];return _0x1015a0;};'use strict';var _=require('lodash');var util=require(_0x2778('0x0'));var logger=require('../../config/logger')(_0x2778('0x1'));var moment=require(_0x2778('0x2'));var BPromise=require(_0x2778('0x3'));var rp=require(_0x2778('0x4'));var fs=require('fs');var path=require(_0x2778('0x5'));var rimraf=require(_0x2778('0x6'));var config=require(_0x2778('0x7'));var attributes=require(_0x2778('0x8'));module[_0x2778('0x9')]=function(_0x5e5216,_0x420206){return _0x5e5216[_0x2778('0xa')](_0x2778('0xb'),attributes,{'tableName':_0x2778('0xc'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0x2778('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x175f=['rimraf','../../config/environment','./userProfileSection.attributes','exports','define','compositeIndex','userProfileId','util','api','moment','request-promise','path'];(function(_0x19c8d0,_0x17c993){var _0x1e70b9=function(_0x8bb85e){while(--_0x8bb85e){_0x19c8d0['push'](_0x19c8d0['shift']());}};_0x1e70b9(++_0x17c993);}(_0x175f,0x1ab));var _0xf175=function(_0x23a68f,_0x2e1edf){_0x23a68f=_0x23a68f-0x0;var _0x2d9a7c=_0x175f[_0x23a68f];return _0x2d9a7c;};'use strict';var _=require('lodash');var util=require(_0xf175('0x0'));var logger=require('../../config/logger')(_0xf175('0x1'));var moment=require(_0xf175('0x2'));var BPromise=require('bluebird');var rp=require(_0xf175('0x3'));var fs=require('fs');var path=require(_0xf175('0x4'));var rimraf=require(_0xf175('0x5'));var config=require(_0xf175('0x6'));var attributes=require(_0xf175('0x7'));module[_0xf175('0x8')]=function(_0x6641aa,_0x3c13f0){return _0x6641aa[_0xf175('0x9')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xf175('0xa'),'fields':['sectionId',_0xf175('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 1648053..d00235a 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 _0xb7f0=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0xb7f0,0x1c7));var _0x0b7f=function(_0x107e87,_0x20293b){_0x107e87=_0x107e87-0x0;var _0x267b1a=_0xb7f0[_0x107e87];return _0x267b1a;};'use strict';var _=require(_0x0b7f('0x0'));var util=require(_0x0b7f('0x1'));var moment=require(_0x0b7f('0x2'));var BPromise=require(_0x0b7f('0x3'));var rs=require(_0x0b7f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b7f('0x5'))['db'];var utils=require(_0x0b7f('0x6'));var logger=require(_0x0b7f('0x7'))(_0x0b7f('0x8'));var config=require(_0x0b7f('0x9'));var jayson=require(_0x0b7f('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x40ca13,_0x4913a5,_0x47f10c){return new BPromise(function(_0x5aea3e,_0x2203b9){return client[_0x0b7f('0xb')](_0x40ca13,_0x47f10c)[_0x0b7f('0xc')](function(_0x393680){logger[_0x0b7f('0xd')](_0x0b7f('0xe'),_0x4913a5,_0x0b7f('0xf'));logger[_0x0b7f('0x10')](_0x0b7f('0x11'),_0x4913a5,_0x0b7f('0xf'),JSON[_0x0b7f('0x12')](_0x393680));if(_0x393680['error']){if(_0x393680[_0x0b7f('0x13')][_0x0b7f('0x14')]===0x1f4){logger[_0x0b7f('0x13')](_0x0b7f('0xe'),_0x4913a5,_0x393680[_0x0b7f('0x13')]['message']);return _0x2203b9(_0x393680[_0x0b7f('0x13')][_0x0b7f('0x15')]);}logger[_0x0b7f('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x4913a5,_0x393680['error'][_0x0b7f('0x15')]);return _0x5aea3e(_0x393680[_0x0b7f('0x13')]['message']);}else{logger[_0x0b7f('0xd')](_0x0b7f('0xe'),_0x4913a5,_0x0b7f('0xf'));_0x5aea3e(_0x393680[_0x0b7f('0x16')][_0x0b7f('0x15')]);}})['catch'](function(_0x53260a){logger[_0x0b7f('0x13')](_0x0b7f('0xe'),_0x4913a5,_0x53260a);_0x2203b9(_0x53260a);});});} \ No newline at end of file +var _0x72df=['error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3396ae,_0x5eabaf){var _0x75ff62=function(_0x4ae31e){while(--_0x4ae31e){_0x3396ae['push'](_0x3396ae['shift']());}};_0x75ff62(++_0x5eabaf);}(_0x72df,0xea));var _0xf72d=function(_0x22a604,_0x245c92){_0x22a604=_0x22a604-0x0;var _0x301bdb=_0x72df[_0x22a604];return _0x301bdb;};'use strict';var _=require(_0xf72d('0x0'));var util=require(_0xf72d('0x1'));var moment=require(_0xf72d('0x2'));var BPromise=require(_0xf72d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf72d('0x4'));var db=require(_0xf72d('0x5'))['db'];var utils=require(_0xf72d('0x6'));var logger=require(_0xf72d('0x7'))(_0xf72d('0x8'));var config=require(_0xf72d('0x9'));var jayson=require(_0xf72d('0xa'));var client=jayson[_0xf72d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b74f,_0x558e5e,_0x57dd41){return new BPromise(function(_0x43496f,_0x12532a){return client['request'](_0x10b74f,_0x57dd41)[_0xf72d('0xc')](function(_0x64517a){logger[_0xf72d('0xd')](_0xf72d('0xe'),_0x558e5e,_0xf72d('0xf'));logger[_0xf72d('0x10')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x558e5e,_0xf72d('0xf'),JSON[_0xf72d('0x11')](_0x64517a));if(_0x64517a[_0xf72d('0x12')]){if(_0x64517a[_0xf72d('0x12')]['code']===0x1f4){logger[_0xf72d('0x12')](_0xf72d('0xe'),_0x558e5e,_0x64517a[_0xf72d('0x12')]['message']);return _0x12532a(_0x64517a[_0xf72d('0x12')][_0xf72d('0x13')]);}logger[_0xf72d('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x558e5e,_0x64517a[_0xf72d('0x12')][_0xf72d('0x13')]);return _0x43496f(_0x64517a[_0xf72d('0x12')][_0xf72d('0x13')]);}else{logger['info'](_0xf72d('0xe'),_0x558e5e,'request\x20sent');_0x43496f(_0x64517a[_0xf72d('0x14')][_0xf72d('0x13')]);}})['catch'](function(_0x50fc1a){logger[_0xf72d('0x12')](_0xf72d('0xe'),_0x558e5e,_0x50fc1a);_0x12532a(_0x50fc1a);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 179a219..73fc58a 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 _0xf143=['util','express','Router','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xf143,0x179));var _0x3f14=function(_0x29471c,_0x5d446f){_0x29471c=_0x29471c-0x0;var _0xa83112=_0xf143[_0x29471c];return _0xa83112;};'use strict';var multer=require(_0x3f14('0x0'));var util=require(_0x3f14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3f14('0x2'));var router=express[_0x3f14('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3f14('0x4'));var config=require(_0x3f14('0x5'));module[_0x3f14('0x6')]=router; \ No newline at end of file +var _0x9829=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout'];(function(_0x40061d,_0x28be99){var _0x44f50d=function(_0x39412e){while(--_0x39412e){_0x40061d['push'](_0x40061d['shift']());}};_0x44f50d(++_0x28be99);}(_0x9829,0xc4));var _0x9982=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9829[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0x9982('0x0'));var util=require(_0x9982('0x1'));var path=require(_0x9982('0x2'));var timeout=require(_0x9982('0x3'));var express=require(_0x9982('0x4'));var router=express['Router']();var auth=require(_0x9982('0x5'));var interaction=require(_0x9982('0x6'));var config=require(_0x9982('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index b99cff9..4b8e60f 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x5008ef,_0x328df6){var _0x1e2364=function(_0x213e9e){while(--_0x213e9e){_0x5008ef['push'](_0x5008ef['shift']());}};_0x1e2364(++_0x328df6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x31520d,_0x50046a){var _0x4d0d26=function(_0x187fe0){while(--_0x187fe0){_0x31520d['push'](_0x31520d['shift']());}};_0x4d0d26(++_0x50046a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 7ed01f1..e688ab0 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 _0xa3c1=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa3c1,0x114));var _0x1a3c=function(_0x1c0a64,_0x1ce719){_0x1c0a64=_0x1c0a64-0x0;var _0x31b37e=_0xa3c1[_0x1c0a64];return _0x31b37e;};'use strict';var _=require('lodash');var util=require(_0x1a3c('0x0'));var logger=require(_0x1a3c('0x1'))(_0x1a3c('0x2'));var moment=require(_0x1a3c('0x3'));var BPromise=require('bluebird');var rp=require(_0x1a3c('0x4'));var fs=require('fs');var path=require(_0x1a3c('0x5'));var rimraf=require(_0x1a3c('0x6'));var config=require(_0x1a3c('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0x1a3c('0x8')]=function(_0x2e7404,_0x176e31){return _0x2e7404[_0x1a3c('0x9')](_0x1a3c('0xa'),attributes,{'tableName':_0x1a3c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabf0=['./userSmsQueue.attributes','define','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x561f29,_0x465d8a){var _0x498c76=function(_0x556c30){while(--_0x556c30){_0x561f29['push'](_0x561f29['shift']());}};_0x498c76(++_0x465d8a);}(_0xabf0,0xda));var _0x0abf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xabf0[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0abf('0x0'));var util=require('util');var logger=require(_0x0abf('0x1'))(_0x0abf('0x2'));var moment=require(_0x0abf('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0abf('0x4'));var rimraf=require(_0x0abf('0x5'));var config=require(_0x0abf('0x6'));var attributes=require(_0x0abf('0x7'));module['exports']=function(_0x4fd72b,_0x53f65e){return _0x4fd72b[_0x0abf('0x8')]('UserSmsQueue',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 5f1c1f7..e2d7608 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 _0xe9fc=['http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe9fc,0x197));var _0xce9f=function(_0x273dc5,_0x268a81){_0x273dc5=_0x273dc5-0x0;var _0x46dae7=_0xe9fc[_0x273dc5];return _0x46dae7;};'use strict';var _=require(_0xce9f('0x0'));var util=require(_0xce9f('0x1'));var moment=require(_0xce9f('0x2'));var BPromise=require(_0xce9f('0x3'));var rs=require(_0xce9f('0x4'));var fs=require('fs');var Redis=require(_0xce9f('0x5'));var db=require(_0xce9f('0x6'))['db'];var utils=require(_0xce9f('0x7'));var logger=require(_0xce9f('0x8'))('rpc');var config=require(_0xce9f('0x9'));var jayson=require(_0xce9f('0xa'));var client=jayson['client'][_0xce9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x95551a,_0x439ef5,_0x1c58c1){return new BPromise(function(_0x33ef14,_0x2e6410){return client['request'](_0x95551a,_0x1c58c1)[_0xce9f('0xc')](function(_0x4ac711){logger[_0xce9f('0xd')](_0xce9f('0xe'),_0x439ef5,_0xce9f('0xf'));logger[_0xce9f('0x10')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x439ef5,'request\x20sent',JSON['stringify'](_0x4ac711));if(_0x4ac711[_0xce9f('0x11')]){if(_0x4ac711[_0xce9f('0x11')][_0xce9f('0x12')]===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x439ef5,_0x4ac711['error'][_0xce9f('0x13')]);return _0x2e6410(_0x4ac711[_0xce9f('0x11')]['message']);}logger[_0xce9f('0x11')](_0xce9f('0xe'),_0x439ef5,_0x4ac711[_0xce9f('0x11')]['message']);return _0x33ef14(_0x4ac711['error'][_0xce9f('0x13')]);}else{logger[_0xce9f('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x439ef5,_0xce9f('0xf'));_0x33ef14(_0x4ac711[_0xce9f('0x14')]['message']);}})[_0xce9f('0x15')](function(_0x5c0d94){logger[_0xce9f('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x439ef5,_0x5c0d94);_0x2e6410(_0x5c0d94);});});} \ No newline at end of file +var _0x617f=['http','info','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x120123,_0x4eff59){var _0x3bec4c=function(_0x182818){while(--_0x182818){_0x120123['push'](_0x120123['shift']());}};_0x3bec4c(++_0x4eff59);}(_0x617f,0x14d));var _0xf617=function(_0x2a8925,_0x7245af){_0x2a8925=_0x2a8925-0x0;var _0x38c067=_0x617f[_0x2a8925];return _0x38c067;};'use strict';var _=require('lodash');var util=require(_0xf617('0x0'));var moment=require(_0xf617('0x1'));var BPromise=require('bluebird');var rs=require(_0xf617('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf617('0x3'));var logger=require(_0xf617('0x4'))(_0xf617('0x5'));var config=require(_0xf617('0x6'));var jayson=require(_0xf617('0x7'));var client=jayson[_0xf617('0x8')][_0xf617('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58e230,_0x4b8050,_0xe50c72){return new BPromise(function(_0x15aba9,_0x5518f1){return client['request'](_0x58e230,_0xe50c72)['then'](function(_0x2035c1){logger[_0xf617('0xa')](_0xf617('0xb'),_0x4b8050,'request\x20sent');logger['debug'](_0xf617('0xc'),_0x4b8050,'request\x20sent',JSON[_0xf617('0xd')](_0x2035c1));if(_0x2035c1[_0xf617('0xe')]){if(_0x2035c1[_0xf617('0xe')][_0xf617('0xf')]===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x4b8050,_0x2035c1['error'][_0xf617('0x10')]);return _0x5518f1(_0x2035c1['error'][_0xf617('0x10')]);}logger[_0xf617('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x4b8050,_0x2035c1[_0xf617('0xe')][_0xf617('0x10')]);return _0x15aba9(_0x2035c1[_0xf617('0xe')][_0xf617('0x10')]);}else{logger[_0xf617('0xa')](_0xf617('0xb'),_0x4b8050,'request\x20sent');_0x15aba9(_0x2035c1[_0xf617('0x11')][_0xf617('0x10')]);}})['catch'](function(_0x245e9e){logger[_0xf617('0xe')](_0xf617('0xb'),_0x4b8050,_0x245e9e);_0x5518f1(_0x245e9e);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index f79f651..6bbe4cc 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 _0xe952=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x94916a,_0x191593){var _0x4563d2=function(_0x3db3a9){while(--_0x3db3a9){_0x94916a['push'](_0x94916a['shift']());}};_0x4563d2(++_0x191593);}(_0xe952,0x184));var _0x2e95=function(_0xc88a6e,_0x577f84){_0xc88a6e=_0xc88a6e-0x0;var _0x3f460d=_0xe952[_0xc88a6e];return _0x3f460d;};'use strict';var multer=require(_0x2e95('0x0'));var util=require(_0x2e95('0x1'));var path=require(_0x2e95('0x2'));var timeout=require(_0x2e95('0x3'));var express=require(_0x2e95('0x4'));var router=express['Router']();var auth=require(_0x2e95('0x5'));var interaction=require(_0x2e95('0x6'));var config=require(_0x2e95('0x7'));module[_0x2e95('0x8')]=router; \ No newline at end of file +var _0x7fc5=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x7fc5,0x10c));var _0x57fc=function(_0xb1d76d,_0x30f235){_0xb1d76d=_0xb1d76d-0x0;var _0x383a0b=_0x7fc5[_0xb1d76d];return _0x383a0b;};'use strict';var multer=require(_0x57fc('0x0'));var util=require(_0x57fc('0x1'));var path=require(_0x57fc('0x2'));var timeout=require(_0x57fc('0x3'));var express=require(_0x57fc('0x4'));var router=express[_0x57fc('0x5')]();var auth=require(_0x57fc('0x6'));var interaction=require(_0x57fc('0x7'));var config=require(_0x57fc('0x8'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index e0775e0..55051a6 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 _0xd8b0=['exports','sequelize'];(function(_0xce5632,_0x1f781b){var _0x31b279=function(_0x29f345){while(--_0x29f345){_0xce5632['push'](_0xce5632['shift']());}};_0x31b279(++_0x1f781b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x43f756,_0xae9f58){var _0x5ba710=function(_0x5205d4){while(--_0x5205d4){_0x43f756['push'](_0x43f756['shift']());}};_0x5ba710(++_0xae9f58);}(_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')]={'penalty':{'type':Sequelize['INTEGER'],'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 279eb34..64d4879 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 _0x7da7=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','user_has_voice_queues','lodash'];(function(_0x1d3aa1,_0x19262f){var _0x114b93=function(_0x41512a){while(--_0x41512a){_0x1d3aa1['push'](_0x1d3aa1['shift']());}};_0x114b93(++_0x19262f);}(_0x7da7,0x10d));var _0x77da=function(_0x20845e,_0x211e78){_0x20845e=_0x20845e-0x0;var _0x28cf2b=_0x7da7[_0x20845e];return _0x28cf2b;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var logger=require(_0x77da('0x2'))('api');var moment=require('moment');var BPromise=require(_0x77da('0x3'));var rp=require(_0x77da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var attributes=require('./userVoiceQueue.attributes');module[_0x77da('0x7')]=function(_0xc54a12,_0x47da81){return _0xc54a12[_0x77da('0x8')]('UserVoiceQueue',attributes,{'tableName':_0x77da('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed1f=['user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0xc63efa,_0x10a80e){var _0x984b27=function(_0xa129e3){while(--_0xa129e3){_0xc63efa['push'](_0xc63efa['shift']());}};_0x984b27(++_0x10a80e);}(_0xed1f,0x6a));var _0xfed1=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xed1f[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var logger=require(_0xfed1('0x2'))(_0xfed1('0x3'));var moment=require(_0xfed1('0x4'));var BPromise=require(_0xfed1('0x5'));var rp=require(_0xfed1('0x6'));var fs=require('fs');var path=require(_0xfed1('0x7'));var rimraf=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var attributes=require(_0xfed1('0xa'));module[_0xfed1('0xb')]=function(_0x3d6706,_0x42751d){return _0x3d6706[_0xfed1('0xc')](_0xfed1('0xd'),attributes,{'tableName':_0xfed1('0xe'),'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 67adea0..f75850f 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 _0x2d60=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','request\x20sent','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','catch','moment','randomstring'];(function(_0x59fd4c,_0x27bf8e){var _0x207c5c=function(_0x4219d9){while(--_0x4219d9){_0x59fd4c['push'](_0x59fd4c['shift']());}};_0x207c5c(++_0x27bf8e);}(_0x2d60,0x1ca));var _0x02d6=function(_0x4fc2bc,_0x21d917){_0x4fc2bc=_0x4fc2bc-0x0;var _0x3e1cbe=_0x2d60[_0x4fc2bc];return _0x3e1cbe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x02d6('0x0'));var BPromise=require('bluebird');var rs=require(_0x02d6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02d6('0x2'))['db'];var utils=require(_0x02d6('0x3'));var logger=require(_0x02d6('0x4'))(_0x02d6('0x5'));var config=require(_0x02d6('0x6'));var jayson=require(_0x02d6('0x7'));var client=jayson[_0x02d6('0x8')][_0x02d6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5aef51,_0x3b2cd5,_0x25ee1e){return new BPromise(function(_0x21fe93,_0x259128){return client['request'](_0x5aef51,_0x25ee1e)[_0x02d6('0xa')](function(_0xeb714f){logger[_0x02d6('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x3b2cd5,'request\x20sent');logger[_0x02d6('0xc')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3b2cd5,_0x02d6('0xd'),JSON[_0x02d6('0xe')](_0xeb714f));if(_0xeb714f[_0x02d6('0xf')]){if(_0xeb714f['error'][_0x02d6('0x10')]===0x1f4){logger[_0x02d6('0xf')](_0x02d6('0x11'),_0x3b2cd5,_0xeb714f[_0x02d6('0xf')][_0x02d6('0x12')]);return _0x259128(_0xeb714f[_0x02d6('0xf')][_0x02d6('0x12')]);}logger[_0x02d6('0xf')](_0x02d6('0x11'),_0x3b2cd5,_0xeb714f[_0x02d6('0xf')][_0x02d6('0x12')]);return _0x21fe93(_0xeb714f[_0x02d6('0xf')]['message']);}else{logger[_0x02d6('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x3b2cd5,'request\x20sent');_0x21fe93(_0xeb714f['result'][_0x02d6('0x12')]);}})[_0x02d6('0x13')](function(_0x3cf6bc){logger['error'](_0x02d6('0x11'),_0x3b2cd5,_0x3cf6bc);_0x259128(_0x3cf6bc);});});} \ No newline at end of file +var _0x1813=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s'];(function(_0x3f8421,_0x583880){var _0x10b087=function(_0x319d5a){while(--_0x319d5a){_0x3f8421['push'](_0x3f8421['shift']());}};_0x10b087(++_0x583880);}(_0x1813,0x1ec));var _0x3181=function(_0x3168cf,_0x132e93){_0x3168cf=_0x3168cf-0x0;var _0x751dac=_0x1813[_0x3168cf];return _0x751dac;};'use strict';var _=require(_0x3181('0x0'));var util=require(_0x3181('0x1'));var moment=require('moment');var BPromise=require(_0x3181('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3181('0x3'));var logger=require(_0x3181('0x4'))(_0x3181('0x5'));var config=require('../../config/environment');var jayson=require(_0x3181('0x6'));var client=jayson[_0x3181('0x7')][_0x3181('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x311a44,_0x2de7ac,_0x4b9a81){return new BPromise(function(_0x1ee21e,_0x5b6b4b){return client[_0x3181('0x9')](_0x311a44,_0x4b9a81)[_0x3181('0xa')](function(_0xba3e58){logger['info'](_0x3181('0xb'),_0x2de7ac,'request\x20sent');logger['debug'](_0x3181('0xc'),_0x2de7ac,_0x3181('0xd'),JSON[_0x3181('0xe')](_0xba3e58));if(_0xba3e58[_0x3181('0xf')]){if(_0xba3e58[_0x3181('0xf')][_0x3181('0x10')]===0x1f4){logger[_0x3181('0xf')](_0x3181('0xb'),_0x2de7ac,_0xba3e58[_0x3181('0xf')]['message']);return _0x5b6b4b(_0xba3e58[_0x3181('0xf')]['message']);}logger[_0x3181('0xf')](_0x3181('0xb'),_0x2de7ac,_0xba3e58[_0x3181('0xf')][_0x3181('0x11')]);return _0x1ee21e(_0xba3e58[_0x3181('0xf')][_0x3181('0x11')]);}else{logger[_0x3181('0x12')](_0x3181('0xb'),_0x2de7ac,'request\x20sent');_0x1ee21e(_0xba3e58[_0x3181('0x13')][_0x3181('0x11')]);}})[_0x3181('0x14')](function(_0x491b89){logger['error'](_0x3181('0xb'),_0x2de7ac,_0x491b89);_0x5b6b4b(_0x491b89);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index b912fb1..7df3339 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 _0x7c17=['multer','util','path','express','Router','../../components/auth/service','exports'];(function(_0x140752,_0x3cc756){var _0x24de5b=function(_0x55f963){while(--_0x55f963){_0x140752['push'](_0x140752['shift']());}};_0x24de5b(++_0x3cc756);}(_0x7c17,0x1d5));var _0x77c1=function(_0x20f150,_0x33cd60){_0x20f150=_0x20f150-0x0;var _0x28c53f=_0x7c17[_0x20f150];return _0x28c53f;};'use strict';var multer=require(_0x77c1('0x0'));var util=require(_0x77c1('0x1'));var path=require(_0x77c1('0x2'));var timeout=require('connect-timeout');var express=require(_0x77c1('0x3'));var router=express[_0x77c1('0x4')]();var auth=require(_0x77c1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x77c1('0x6')]=router; \ No newline at end of file +var _0xb7c2=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb7c2,0x1c6));var _0x2b7c=function(_0x343593,_0x4114e1){_0x343593=_0x343593-0x0;var _0x35fb17=_0xb7c2[_0x343593];return _0x35fb17;};'use strict';var multer=require('multer');var util=require(_0x2b7c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2b7c('0x1')]();var auth=require(_0x2b7c('0x2'));var interaction=require(_0x2b7c('0x3'));var config=require(_0x2b7c('0x4'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 23ef651..bcb5e48 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 _0x5f27=['Required\x20by\x20Asterisk','queue_interface','STRING','sequelize','INTEGER'];(function(_0x4e56ce,_0x4383a9){var _0x37e99e=function(_0x322a1b){while(--_0x322a1b){_0x4e56ce['push'](_0x4e56ce['shift']());}};_0x37e99e(++_0x4383a9);}(_0x5f27,0x189));var _0x75f2=function(_0x5ec7b1,_0xe12416){_0x5ec7b1=_0x5ec7b1-0x0;var _0x4934d3=_0x5f27[_0x5ec7b1];return _0x4934d3;};'use strict';var Sequelize=require(_0x75f2('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x75f2('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x75f2('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x75f2('0x2')},'UserId':{'type':Sequelize[_0x75f2('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x75f2('0x3'),'comment':_0x75f2('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x75f2('0x4')],'allowNull':![],'unique':_0x75f2('0x3'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x75f2('0x1')](0xb),'defaultValue':0x0,'comment':_0x75f2('0x2')},'paused':{'type':Sequelize[_0x75f2('0x1')](0xb),'defaultValue':0x0,'comment':_0x75f2('0x2')}}; \ No newline at end of file +var _0x9952=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x1c0781,_0x4a19f1){var _0x1f577e=function(_0x396577){while(--_0x396577){_0x1c0781['push'](_0x1c0781['shift']());}};_0x1f577e(++_0x4a19f1);}(_0x9952,0x12b));var _0x2995=function(_0x9a3e0f,_0x2f796d){_0x9a3e0f=_0x9a3e0f-0x0;var _0x3d2a9a=_0x9952[_0x9a3e0f];return _0x3d2a9a;};'use strict';var Sequelize=require(_0x2995('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x2995('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x2995('0x2')},'membername':{'type':Sequelize[_0x2995('0x3')],'allowNull':![],'comment':_0x2995('0x2')},'UserId':{'type':Sequelize[_0x2995('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2995('0x3')],'allowNull':![],'unique':_0x2995('0x4'),'comment':_0x2995('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x2995('0x3')],'allowNull':![],'unique':_0x2995('0x4'),'comment':_0x2995('0x2')},'penalty':{'type':Sequelize[_0x2995('0x1')](0xb),'defaultValue':0x0,'comment':_0x2995('0x2')},'paused':{'type':Sequelize[_0x2995('0x1')](0xb),'defaultValue':0x0,'comment':_0x2995('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 059bc02..abfb4b9 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 _0x9892=['setMaxListeners','save','update','emit','hasOwnProperty','hook','../../mysqldb','UserVoiceQueueRt'];(function(_0x5104b5,_0x1ad98d){var _0x57b2c1=function(_0x6c646e){while(--_0x6c646e){_0x5104b5['push'](_0x5104b5['shift']());}};_0x57b2c1(++_0x1ad98d);}(_0x9892,0x19e));var _0x2989=function(_0x1f81cb,_0x23ddc2){_0x1f81cb=_0x1f81cb-0x0;var _0x32653a=_0x9892[_0x1f81cb];return _0x32653a;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x2989('0x0'))['db'][_0x2989('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x2989('0x2')](0x0);var events={'afterCreate':_0x2989('0x3'),'afterUpdate':_0x2989('0x4'),'afterDestroy':'remove'};function emitEvent(_0x8b8a46){return function(_0x5f4034,_0x22b1a8,_0x30b57f){UserVoiceQueueRtEvents[_0x2989('0x5')](_0x8b8a46+':'+_0x5f4034['id'],_0x5f4034);UserVoiceQueueRtEvents[_0x2989('0x5')](_0x8b8a46,_0x5f4034);_0x30b57f(null);};}for(var e in events){if(events[_0x2989('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x2989('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xcd4b=['remove','emit','hasOwnProperty','hook','exports','events','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x3b76e2,_0x12dd4f){var _0x49e797=function(_0x3906d0){while(--_0x3906d0){_0x3b76e2['push'](_0x3b76e2['shift']());}};_0x49e797(++_0x12dd4f);}(_0xcd4b,0xb0));var _0xbcd4=function(_0x2b9981,_0x4f81b3){_0x2b9981=_0x2b9981-0x0;var _0x314ac1=_0xcd4b[_0x2b9981];return _0x314ac1;};'use strict';var EventEmitter=require(_0xbcd4('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xbcd4('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xbcd4('0x2')](0x0);var events={'afterCreate':_0xbcd4('0x3'),'afterUpdate':'update','afterDestroy':_0xbcd4('0x4')};function emitEvent(_0x8e2648){return function(_0x31729e,_0x50bf7b,_0x43a6ca){UserVoiceQueueRtEvents[_0xbcd4('0x5')](_0x8e2648+':'+_0x31729e['id'],_0x31729e);UserVoiceQueueRtEvents[_0xbcd4('0x5')](_0x8e2648,_0x31729e);_0x43a6ca(null);};}for(var e in events){if(events[_0xbcd4('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xbcd4('0x7')](e,emitEvent(event));}}module[_0xbcd4('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index aa40146..f4d8a6c 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 _0x4f35=['rimraf','exports','user_has_voice_queues_rt','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x51ab2d,_0x544941){var _0x3aee23=function(_0x539e56){while(--_0x539e56){_0x51ab2d['push'](_0x51ab2d['shift']());}};_0x3aee23(++_0x544941);}(_0x4f35,0x107));var _0x54f3=function(_0x495883,_0x4b89b3){_0x495883=_0x495883-0x0;var _0xf2c984=_0x4f35[_0x495883];return _0xf2c984;};'use strict';var _=require('lodash');var util=require(_0x54f3('0x0'));var logger=require(_0x54f3('0x1'))(_0x54f3('0x2'));var moment=require(_0x54f3('0x3'));var BPromise=require(_0x54f3('0x4'));var rp=require(_0x54f3('0x5'));var fs=require('fs');var path=require(_0x54f3('0x6'));var rimraf=require(_0x54f3('0x7'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0x54f3('0x8')]=function(_0xa9ee3b,_0x57cc07){return _0xa9ee3b['define']('UserVoiceQueueRt',attributes,{'tableName':_0x54f3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf432=['path','rimraf','define','UserVoiceQueueRt','user_has_voice_queues_rt','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x27ab8c,_0x42376a){var _0x1e65dc=function(_0x1604ba){while(--_0x1604ba){_0x27ab8c['push'](_0x27ab8c['shift']());}};_0x1e65dc(++_0x42376a);}(_0xf432,0xd6));var _0x2f43=function(_0x631577,_0x38e35d){_0x631577=_0x631577-0x0;var _0x517397=_0xf432[_0x631577];return _0x517397;};'use strict';var _=require('lodash');var util=require(_0x2f43('0x0'));var logger=require(_0x2f43('0x1'))(_0x2f43('0x2'));var moment=require(_0x2f43('0x3'));var BPromise=require(_0x2f43('0x4'));var rp=require(_0x2f43('0x5'));var fs=require('fs');var path=require(_0x2f43('0x6'));var rimraf=require(_0x2f43('0x7'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x395f4c,_0x2d4b79){return _0x395f4c[_0x2f43('0x8')](_0x2f43('0x9'),attributes,{'tableName':_0x2f43('0xa'),'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 0fb063e..51c0794 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 _0x3bcb=['../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetVoiceQueueRtPauses','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x191000,_0x487114){var _0x3fb125=function(_0x426175){while(--_0x426175){_0x191000['push'](_0x191000['shift']());}};_0x3fb125(++_0x487114);}(_0x3bcb,0x1bf));var _0xb3bc=function(_0x198d5f,_0x22871d){_0x198d5f=_0x198d5f-0x0;var _0x130679=_0x3bcb[_0x198d5f];return _0x130679;};'use strict';var _=require('lodash');var util=require(_0xb3bc('0x0'));var moment=require(_0xb3bc('0x1'));var BPromise=require(_0xb3bc('0x2'));var rs=require(_0xb3bc('0x3'));var fs=require('fs');var Redis=require(_0xb3bc('0x4'));var db=require(_0xb3bc('0x5'))['db'];var utils=require(_0xb3bc('0x6'));var logger=require(_0xb3bc('0x7'))('rpc');var config=require(_0xb3bc('0x8'));var jayson=require(_0xb3bc('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xb3bc('0xa')]=_['defaults'](config[_0xb3bc('0xa')],{'host':_0xb3bc('0xb'),'port':0x18eb});var socket=require(_0xb3bc('0xc'))(new Redis(config[_0xb3bc('0xa')]));require(_0xb3bc('0xd'))[_0xb3bc('0xe')](socket);function respondWithRpcPromise(_0x2e5e92,_0x183c27,_0x4419dc){return new BPromise(function(_0x47197d,_0x16d318){return client[_0xb3bc('0xf')](_0x2e5e92,_0x4419dc)[_0xb3bc('0x10')](function(_0x30da9d){logger['info'](_0xb3bc('0x11'),_0x183c27,_0xb3bc('0x12'));logger[_0xb3bc('0x13')](_0xb3bc('0x14'),_0x183c27,_0xb3bc('0x12'),JSON['stringify'](_0x30da9d));if(_0x30da9d[_0xb3bc('0x15')]){if(_0x30da9d[_0xb3bc('0x15')][_0xb3bc('0x16')]===0x1f4){logger[_0xb3bc('0x15')](_0xb3bc('0x11'),_0x183c27,_0x30da9d[_0xb3bc('0x15')][_0xb3bc('0x17')]);return _0x16d318(_0x30da9d[_0xb3bc('0x15')][_0xb3bc('0x17')]);}logger['error'](_0xb3bc('0x11'),_0x183c27,_0x30da9d[_0xb3bc('0x15')][_0xb3bc('0x17')]);return _0x47197d(_0x30da9d[_0xb3bc('0x15')][_0xb3bc('0x17')]);}else{logger[_0xb3bc('0x18')](_0xb3bc('0x11'),_0x183c27,_0xb3bc('0x12'));_0x47197d(_0x30da9d[_0xb3bc('0x19')][_0xb3bc('0x17')]);}})[_0xb3bc('0x1a')](function(_0x238442){logger[_0xb3bc('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x183c27,_0x238442);_0x16d318(_0x238442);});});}exports[_0xb3bc('0x1b')]=function(_0x4907de){var _0x17f9fa=this;return new Promise(function(_0x1be574,_0x2d6986){return db['UserVoiceQueueRt']['findAll']({'raw':_0x4907de[_0xb3bc('0x1c')]?_0x4907de[_0xb3bc('0x1c')][_0xb3bc('0x1d')]===undefined?!![]:![]:!![],'where':_0x4907de[_0xb3bc('0x1c')]?_0x4907de[_0xb3bc('0x1c')][_0xb3bc('0x1e')]||null:null,'attributes':[[db[_0xb3bc('0x1f')]['fn']('COUNT',db[_0xb3bc('0x1f')]['fn']('IF',db['sequelize'][_0xb3bc('0x20')](_0xb3bc('0x21')))),_0xb3bc('0x22')]]})[_0xb3bc('0x10')](function(_0x48373e){logger[_0xb3bc('0x18')](_0xb3bc('0x1b'),_0x4907de);logger[_0xb3bc('0x13')](_0xb3bc('0x1b'),_0x4907de,JSON['stringify'](_0x48373e));_0x1be574(_0x48373e);})[_0xb3bc('0x1a')](function(_0x441d7a){logger['error'](_0xb3bc('0x1b'),_0x441d7a['message'],_0x4907de);_0x2d6986(_0x17f9fa[_0xb3bc('0x15')](0x1f4,_0x441d7a[_0xb3bc('0x17')]));});});}; \ No newline at end of file +var _0xe7f2=['localhost','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','redis','defaults'];(function(_0x33a694,_0x9b6640){var _0x41ff01=function(_0x4c38b7){while(--_0x4c38b7){_0x33a694['push'](_0x33a694['shift']());}};_0x41ff01(++_0x9b6640);}(_0xe7f2,0x199));var _0x2e7f=function(_0x175556,_0x455a39){_0x175556=_0x175556-0x0;var _0x196d05=_0xe7f2[_0x175556];return _0x196d05;};'use strict';var _=require(_0x2e7f('0x0'));var util=require(_0x2e7f('0x1'));var moment=require(_0x2e7f('0x2'));var BPromise=require(_0x2e7f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e7f('0x4'));var db=require(_0x2e7f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e7f('0x6'))('rpc');var config=require(_0x2e7f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2e7f('0x8')]({'port':0x232a});config[_0x2e7f('0x9')]=_[_0x2e7f('0xa')](config[_0x2e7f('0x9')],{'host':_0x2e7f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2e7f('0x9')]));require(_0x2e7f('0xc'))[_0x2e7f('0xd')](socket);function respondWithRpcPromise(_0x1c5159,_0x177f1a,_0x452c55){return new BPromise(function(_0x54c01a,_0x54fd9e){return client['request'](_0x1c5159,_0x452c55)[_0x2e7f('0xe')](function(_0x5c560f){logger[_0x2e7f('0xf')](_0x2e7f('0x10'),_0x177f1a,_0x2e7f('0x11'));logger[_0x2e7f('0x12')](_0x2e7f('0x13'),_0x177f1a,'request\x20sent',JSON[_0x2e7f('0x14')](_0x5c560f));if(_0x5c560f[_0x2e7f('0x15')]){if(_0x5c560f[_0x2e7f('0x15')]['code']===0x1f4){logger[_0x2e7f('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x177f1a,_0x5c560f[_0x2e7f('0x15')]['message']);return _0x54fd9e(_0x5c560f['error'][_0x2e7f('0x16')]);}logger[_0x2e7f('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x177f1a,_0x5c560f[_0x2e7f('0x15')][_0x2e7f('0x16')]);return _0x54c01a(_0x5c560f[_0x2e7f('0x15')][_0x2e7f('0x16')]);}else{logger[_0x2e7f('0xf')](_0x2e7f('0x10'),_0x177f1a,'request\x20sent');_0x54c01a(_0x5c560f[_0x2e7f('0x17')][_0x2e7f('0x16')]);}})['catch'](function(_0x15d88c){logger[_0x2e7f('0x15')](_0x2e7f('0x10'),_0x177f1a,_0x15d88c);_0x54fd9e(_0x15d88c);});});}exports[_0x2e7f('0x18')]=function(_0x5f365a){var _0x42070f=this;return new Promise(function(_0x245f59,_0x3a44e1){return db['UserVoiceQueueRt'][_0x2e7f('0x19')]({'raw':_0x5f365a[_0x2e7f('0x1a')]?_0x5f365a[_0x2e7f('0x1a')][_0x2e7f('0x1b')]===undefined?!![]:![]:!![],'where':_0x5f365a[_0x2e7f('0x1a')]?_0x5f365a[_0x2e7f('0x1a')][_0x2e7f('0x1c')]||null:null,'attributes':[[db[_0x2e7f('0x1d')]['fn'](_0x2e7f('0x1e'),db[_0x2e7f('0x1d')]['fn']('IF',db[_0x2e7f('0x1d')][_0x2e7f('0x1f')](_0x2e7f('0x20')))),_0x2e7f('0x21')]]})[_0x2e7f('0xe')](function(_0x8b2ef2){logger[_0x2e7f('0xf')](_0x2e7f('0x18'),_0x5f365a);logger[_0x2e7f('0x12')](_0x2e7f('0x18'),_0x5f365a,JSON[_0x2e7f('0x14')](_0x8b2ef2));_0x245f59(_0x8b2ef2);})[_0x2e7f('0x22')](function(_0x3d6f10){logger['error'](_0x2e7f('0x18'),_0x3d6f10[_0x2e7f('0x16')],_0x5f365a);_0x3a44e1(_0x42070f[_0x2e7f('0x15')](0x1f4,_0x3d6f10[_0x2e7f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index e09b53e..55395ae 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 _0x01ce=['update','removeListener','length','userVoiceQueueRt:','save','remove'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x01ce,0x166));var _0xe01c=function(_0x598e12,_0x3aea87){_0x598e12=_0x598e12-0x0;var _0x4c343d=_0x01ce[_0x598e12];return _0x4c343d;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xe01c('0x0'),_0xe01c('0x1'),_0xe01c('0x2')];function createListener(_0x39c8fc,_0x398ce3){return function(_0x541b06){_0x398ce3['emit'](_0x39c8fc,_0x541b06);};}function removeListener(_0x169754,_0x534da5){return function(){UserVoiceQueueRtEvents[_0xe01c('0x3')](_0x169754,_0x534da5);};}exports['register']=function(_0x23516e){for(var _0x5cc177=0x0,_0x296f6d=events[_0xe01c('0x4')];_0x5cc177<_0x296f6d;_0x5cc177++){var _0x77153b=events[_0x5cc177];var _0x11e215=createListener(_0xe01c('0x5')+_0x77153b,_0x23516e);UserVoiceQueueRtEvents['on'](_0x77153b,_0x11e215);}}; \ No newline at end of file +var _0x2b94=['emit','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update'];(function(_0x3bbf56,_0x1bb2a7){var _0x35df57=function(_0x27523e){while(--_0x27523e){_0x3bbf56['push'](_0x3bbf56['shift']());}};_0x35df57(++_0x1bb2a7);}(_0x2b94,0x1dd));var _0x42b9=function(_0x28168f,_0x42519e){_0x28168f=_0x28168f-0x0;var _0x1bc951=_0x2b94[_0x28168f];return _0x1bc951;};'use strict';var UserVoiceQueueRtEvents=require(_0x42b9('0x0'));var events=[_0x42b9('0x1'),'remove',_0x42b9('0x2')];function createListener(_0x5dd5fd,_0x24f030){return function(_0x5bb1b6){_0x24f030[_0x42b9('0x3')](_0x5dd5fd,_0x5bb1b6);};}function removeListener(_0x3add9a,_0x3fb5cb){return function(){UserVoiceQueueRtEvents['removeListener'](_0x3add9a,_0x3fb5cb);};}exports['register']=function(_0x504202){for(var _0x527bf1=0x0,_0x45e426=events[_0x42b9('0x4')];_0x527bf1<_0x45e426;_0x527bf1++){var _0x5e5643=events[_0x527bf1];var _0x2608d2=createListener(_0x42b9('0x5')+_0x5e5643,_0x504202);UserVoiceQueueRtEvents['on'](_0x5e5643,_0x2608d2);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 92497bd..7a90cc0 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 _0x33b7=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x42b1ba,_0x3b9b75){var _0x4a3a28=function(_0x21b32e){while(--_0x21b32e){_0x42b1ba['push'](_0x42b1ba['shift']());}};_0x4a3a28(++_0x3b9b75);}(_0x33b7,0xf3));var _0x733b=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x33b7[_0x5037ab];return _0x512adb;};'use strict';var multer=require(_0x733b('0x0'));var util=require(_0x733b('0x1'));var path=require('path');var timeout=require(_0x733b('0x2'));var express=require(_0x733b('0x3'));var router=express[_0x733b('0x4')]();var auth=require(_0x733b('0x5'));var interaction=require(_0x733b('0x6'));var config=require(_0x733b('0x7'));module[_0x733b('0x8')]=router; \ No newline at end of file +var _0xd6e3=['path','Router','../../components/auth/service','multer'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xd6e3,0x18f));var _0x3d6e=function(_0x59a7f8,_0x12c04e){_0x59a7f8=_0x59a7f8-0x0;var _0x55fdae=_0xd6e3[_0x59a7f8];return _0x55fdae;};'use strict';var multer=require(_0x3d6e('0x0'));var util=require('util');var path=require(_0x3d6e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3d6e('0x2')]();var auth=require(_0x3d6e('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 421b17a..0a65bc1 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 _0xb10b=['sequelize','INTEGER'];(function(_0x1554f4,_0x38eabf){var _0x2ef281=function(_0x26e7be){while(--_0x26e7be){_0x1554f4['push'](_0x1554f4['shift']());}};_0x2ef281(++_0x38eabf);}(_0xb10b,0x12a));var _0xbb10=function(_0x33c1b7,_0x4cd7b0){_0x33c1b7=_0x33c1b7-0x0;var _0x41c206=_0xb10b[_0x33c1b7];return _0x41c206;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x154fac,_0x16058b){var _0x4087ad=function(_0x30d238){while(--_0x30d238){_0x154fac['push'](_0x154fac['shift']());}};_0x4087ad(++_0x16058b);}(_0xe706,0xa3));var _0x6e70=function(_0x40c402,_0x42ee7d){_0x40c402=_0x40c402-0x0;var _0x4e7680=_0xe706[_0x40c402];return _0x4e7680;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'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 f7b6959..90dec09 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 _0xdd4f=['exports','define','UserWhatsappQueue','lodash','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x5c7239,_0x1334cb){_0x5c7239=_0x5c7239-0x0;var _0x54a793=_0xdd4f[_0x5c7239];return _0x54a793;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfdd4('0x1'));var BPromise=require(_0xfdd4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdd4('0x3'));var rimraf=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var attributes=require('./userWhatsappQueue.attributes');module[_0xfdd4('0x6')]=function(_0x43cbcf,_0x30e080){return _0x43cbcf[_0xfdd4('0x7')](_0xfdd4('0x8'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb78e=['UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','define'];(function(_0x20fb3f,_0x4cc960){var _0x22ece8=function(_0x17c20c){while(--_0x17c20c){_0x20fb3f['push'](_0x20fb3f['shift']());}};_0x22ece8(++_0x4cc960);}(_0xb78e,0x1c9));var _0xeb78=function(_0x5e8bd0,_0x568922){_0x5e8bd0=_0x5e8bd0-0x0;var _0x1b0c99=_0xb78e[_0x5e8bd0];return _0x1b0c99;};'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/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 63a4b9d..7c142d3 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 _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\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(_0x2f3d2c,_0x53a904){var _0x4da4b4=function(_0x29f7a6){while(--_0x29f7a6){_0x2f3d2c['push'](_0x2f3d2c['shift']());}};_0x4da4b4(++_0x53a904);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\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(_0x2db9cd,_0x2ddb1a){var _0x543a6c=function(_0x423a87){while(--_0x423a87){_0x2db9cd['push'](_0x2db9cd['shift']());}};_0x543a6c(++_0x2ddb1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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/variable/index.js b/server/api/variable/index.js index 0ca5ced..8a6d888 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 _0xd96f=['/:id','show','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xd96f,0xe5));var _0xfd96=function(_0x2de293,_0x1ef120){_0x2de293=_0x2de293-0x0;var _0x348b4d=_0xd96f[_0x2de293];return _0x348b4d;};'use strict';var multer=require(_0xfd96('0x0'));var util=require('util');var path=require(_0xfd96('0x1'));var timeout=require(_0xfd96('0x2'));var express=require(_0xfd96('0x3'));var router=express[_0xfd96('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xfd96('0x5'));var config=require(_0xfd96('0x6'));var controller=require('./variable.controller');router[_0xfd96('0x7')]('/',auth[_0xfd96('0x8')](),controller['index']);router[_0xfd96('0x7')](_0xfd96('0x9'),auth[_0xfd96('0x8')](),controller[_0xfd96('0xa')]);router['post']('/',auth[_0xfd96('0x8')](),controller['create']);router['put'](_0xfd96('0x9'),auth[_0xfd96('0x8')](),controller['update']);router[_0xfd96('0xb')](_0xfd96('0x9'),auth['isAuthenticated'](),controller[_0xfd96('0xc')]);module[_0xfd96('0xd')]=router; \ No newline at end of file +var _0x5998=['./variable.controller','get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0xe74fbb,_0x49ed89){var _0x1005a6=function(_0x2d8bda){while(--_0x2d8bda){_0xe74fbb['push'](_0xe74fbb['shift']());}};_0x1005a6(++_0x49ed89);}(_0x5998,0x13c));var _0x8599=function(_0x22ce63,_0xbf84fa){_0x22ce63=_0x22ce63-0x0;var _0x50cc2c=_0x5998[_0x22ce63];return _0x50cc2c;};'use strict';var multer=require('multer');var util=require(_0x8599('0x0'));var path=require(_0x8599('0x1'));var timeout=require(_0x8599('0x2'));var express=require(_0x8599('0x3'));var router=express[_0x8599('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8599('0x5'));var config=require(_0x8599('0x6'));var controller=require(_0x8599('0x7'));router[_0x8599('0x8')]('/',auth[_0x8599('0x9')](),controller['index']);router['get'](_0x8599('0xa'),auth[_0x8599('0x9')](),controller[_0x8599('0xb')]);router[_0x8599('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8599('0xd')](_0x8599('0xa'),auth[_0x8599('0x9')](),controller['update']);router[_0x8599('0xe')](_0x8599('0xa'),auth[_0x8599('0x9')](),controller[_0x8599('0xf')]);module[_0x8599('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index f46ffc7..e0d9805 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 _0xc1c1=['STRING','sequelize'];(function(_0x55894c,_0x579ce1){var _0x342542=function(_0x4c810b){while(--_0x4c810b){_0x55894c['push'](_0x55894c['shift']());}};_0x342542(++_0x579ce1);}(_0xc1c1,0x1cf));var _0x1c1c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc1c1[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x1c1c('0x0'));module['exports']={'name':{'type':Sequelize[_0x1c1c('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1c1c('0x1')]}}; \ No newline at end of file +var _0xdb21=['exports','STRING','name','sequelize'];(function(_0x5732b2,_0x295ef9){var _0x3b58a7=function(_0x8e6deb){while(--_0x8e6deb){_0x5732b2['push'](_0x5732b2['shift']());}};_0x3b58a7(++_0x295ef9);}(_0xdb21,0x11f));var _0x1db2=function(_0x2c6810,_0x23c079){_0x2c6810=_0x2c6810-0x0;var _0x213881=_0xdb21[_0x2c6810];return _0x213881;};'use strict';var Sequelize=require(_0x1db2('0x0'));module[_0x1db2('0x1')]={'name':{'type':Sequelize[_0x1db2('0x2')],'unique':_0x1db2('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 fb2e1ef..96d6943 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 _0xc43f=['rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','Variables','UserProfileResource','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','options','Variable','includeAll','findAll','catch','show','params','length','include','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format'];(function(_0x1ad9a1,_0x3efb52){var _0x3216a1=function(_0x39db2a){while(--_0x39db2a){_0x1ad9a1['push'](_0x1ad9a1['shift']());}};_0x3216a1(++_0x3efb52);}(_0xc43f,0x147));var _0xfc43=function(_0x265375,_0x7f5f1){_0x265375=_0x265375-0x0;var _0x228fc6=_0xc43f[_0x265375];return _0x228fc6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfc43('0x0'));var rimraf=require(_0xfc43('0x1'));var zipdir=require(_0xfc43('0x2'));var jsonpatch=require(_0xfc43('0x3'));var rp=require(_0xfc43('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfc43('0x5'));var path=require('path');var sox=require(_0xfc43('0x6'));var csv=require(_0xfc43('0x7'));var ejs=require(_0xfc43('0x8'));var fs=require('fs');var _=require(_0xfc43('0x9'));var squel=require(_0xfc43('0xa'));var crypto=require(_0xfc43('0xb'));var jsforce=require(_0xfc43('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfc43('0x7'));var querystring=require(_0xfc43('0xd'));var Papa=require(_0xfc43('0xe'));var Redis=require(_0xfc43('0xf'));var authService=require(_0xfc43('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfc43('0x11'));var hardwareService=require(_0xfc43('0x12'));var logger=require(_0xfc43('0x13'))(_0xfc43('0x14'));var utils=require('../../config/utils');var config=require(_0xfc43('0x15'));var licenseUtil=require(_0xfc43('0x16'));var db=require(_0xfc43('0x17'))['db'];function respondWithStatusCode(_0x80d6de,_0x1e18a4){_0x1e18a4=_0x1e18a4||0xcc;return function(_0x311459){if(_0x311459){return _0x80d6de[_0xfc43('0x18')](_0x1e18a4);}return _0x80d6de[_0xfc43('0x19')](_0x1e18a4)[_0xfc43('0x1a')]();};}function respondWithResult(_0x475eb8,_0x59ca1e){_0x59ca1e=_0x59ca1e||0xc8;return function(_0x261095){if(_0x261095){return _0x475eb8['status'](_0x59ca1e)[_0xfc43('0x1b')](_0x261095);}};}function respondWithFilteredResult(_0x2eb695,_0x1df31f){return function(_0x11093e){if(_0x11093e){var _0x5bdb94=_0x11093e[_0xfc43('0x1c')],_0x38e97e=_0x1df31f['offset'],_0x5d7c99=_0x1df31f[_0xfc43('0x1d')]+_0x1df31f[_0xfc43('0x1e')],_0x1426dd;if(_0x5d7c99>=_0x5bdb94){_0x5d7c99=_0x5bdb94;_0x1426dd=0xc8;}else{_0x1426dd=0xce;}_0x2eb695['status'](_0x1426dd);return _0x2eb695[_0xfc43('0x1f')](_0xfc43('0x20'),_0x38e97e+'-'+_0x5d7c99+'/'+_0x5bdb94)[_0xfc43('0x1b')](_0x11093e);}return null;};}function patchUpdates(_0x2ff46b){return function(_0x35562a){try{jsonpatch['apply'](_0x35562a,_0x2ff46b,!![]);}catch(_0x14b0ae){return BPromise['reject'](_0x14b0ae);}return _0x35562a[_0xfc43('0x21')]();};}function saveUpdates(_0x3d3dd8,_0x256e03){return function(_0x2a9bf5){if(_0x2a9bf5){return _0x2a9bf5[_0xfc43('0x22')](_0x3d3dd8)[_0xfc43('0x23')](function(_0xc4f4f6){return _0xc4f4f6;});}return null;};}function removeEntity(_0x2ed359,_0x3e2188){return function(_0x3f25ca){if(_0x3f25ca){return _0x3f25ca['destroy']()[_0xfc43('0x23')](function(){var _0x4efa1f=_0x3f25ca['get']({'plain':!![]});var _0x314eaf=_0xfc43('0x24');return db[_0xfc43('0x25')][_0xfc43('0x26')]({'where':{'type':_0x314eaf,'resourceId':_0x4efa1f['id']}})[_0xfc43('0x23')](function(){return _0x3f25ca;});})['then'](function(){_0x2ed359['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2712a6,_0xc54654){return function(_0x3d5827){if(!_0x3d5827){_0x2712a6['sendStatus'](0x194);}return _0x3d5827;};}function handleError(_0x255409,_0x500666){_0x500666=_0x500666||0x1f4;return function(_0x9762ad){logger['error'](_0x9762ad[_0xfc43('0x27')]);if(_0x9762ad[_0xfc43('0x28')]){delete _0x9762ad['name'];}_0x255409['status'](_0x500666)[_0xfc43('0x29')](_0x9762ad);};}exports[_0xfc43('0x2a')]=function(_0x5b2f42,_0x5d1424){var _0x592e1c={},_0x5399f8={},_0x11e2e9={'count':0x0,'rows':[]};var _0xa91062=_[_0xfc43('0x2b')](db['Variable'][_0xfc43('0x2c')],function(_0x5443af){return{'name':_0x5443af[_0xfc43('0x2d')],'type':_0x5443af[_0xfc43('0x2e')][_0xfc43('0x2f')]};});_0x5399f8['model']=_[_0xfc43('0x2b')](_0xa91062,'name');_0x5399f8[_0xfc43('0x30')]=_[_0xfc43('0x31')](_0x5b2f42[_0xfc43('0x30')]);_0x5399f8[_0xfc43('0x32')]=_['intersection'](_0x5399f8[_0xfc43('0x33')],_0x5399f8[_0xfc43('0x30')]);_0x592e1c[_0xfc43('0x34')]=_[_0xfc43('0x35')](_0x5399f8[_0xfc43('0x33')],qs[_0xfc43('0x36')](_0x5b2f42[_0xfc43('0x30')][_0xfc43('0x36')]));_0x592e1c[_0xfc43('0x34')]=_0x592e1c['attributes']['length']?_0x592e1c[_0xfc43('0x34')]:_0x5399f8['model'];if(!_0x5b2f42['query']['hasOwnProperty'](_0xfc43('0x37'))){_0x592e1c[_0xfc43('0x1e')]=qs[_0xfc43('0x1e')](_0x5b2f42[_0xfc43('0x30')][_0xfc43('0x1e')]);_0x592e1c[_0xfc43('0x1d')]=qs[_0xfc43('0x1d')](_0x5b2f42[_0xfc43('0x30')][_0xfc43('0x1d')]);}_0x592e1c[_0xfc43('0x38')]=qs[_0xfc43('0x39')](_0x5b2f42[_0xfc43('0x30')][_0xfc43('0x39')]);_0x592e1c[_0xfc43('0x3a')]=qs[_0xfc43('0x32')](_[_0xfc43('0x3b')](_0x5b2f42[_0xfc43('0x30')],_0x5399f8[_0xfc43('0x32')]),_0xa91062);if(_0x5b2f42[_0xfc43('0x30')]['filter']){_0x592e1c[_0xfc43('0x3a')]=_[_0xfc43('0x3c')](_0x592e1c[_0xfc43('0x3a')],{'$or':_['map'](_0xa91062,function(_0x5658af){if(_0x5658af['type']!==_0xfc43('0x3d')){var _0x48307e={};_0x48307e[_0x5658af['name']]={'$like':'%'+_0x5b2f42['query']['filter']+'%'};return _0x48307e;}})});}_0x592e1c=_['merge']({},_0x592e1c,_0x5b2f42[_0xfc43('0x3e')]);var _0x100163={'where':_0x592e1c[_0xfc43('0x3a')]};return db[_0xfc43('0x3f')][_0xfc43('0x1c')](_0x100163)['then'](function(_0x459449){_0x11e2e9[_0xfc43('0x1c')]=_0x459449;if(_0x5b2f42[_0xfc43('0x30')][_0xfc43('0x40')]){_0x592e1c['include']=[{'all':!![]}];}return db[_0xfc43('0x3f')][_0xfc43('0x41')](_0x592e1c);})['then'](function(_0x5112d8){_0x11e2e9['rows']=_0x5112d8;return _0x11e2e9;})[_0xfc43('0x23')](respondWithFilteredResult(_0x5d1424,_0x592e1c))[_0xfc43('0x42')](handleError(_0x5d1424,null));};exports[_0xfc43('0x43')]=function(_0x124802,_0x4035de){var _0x18efbf={'raw':!![],'where':{'id':_0x124802[_0xfc43('0x44')]['id']}},_0x1d5e6a={};_0x1d5e6a[_0xfc43('0x33')]=_['keys'](db[_0xfc43('0x3f')][_0xfc43('0x2c')]);_0x1d5e6a[_0xfc43('0x30')]=_['keys'](_0x124802[_0xfc43('0x30')]);_0x1d5e6a[_0xfc43('0x32')]=_[_0xfc43('0x35')](_0x1d5e6a[_0xfc43('0x33')],_0x1d5e6a[_0xfc43('0x30')]);_0x18efbf[_0xfc43('0x34')]=_['intersection'](_0x1d5e6a[_0xfc43('0x33')],qs[_0xfc43('0x36')](_0x124802['query']['fields']));_0x18efbf[_0xfc43('0x34')]=_0x18efbf[_0xfc43('0x34')][_0xfc43('0x45')]?_0x18efbf[_0xfc43('0x34')]:_0x1d5e6a['model'];if(_0x124802[_0xfc43('0x30')][_0xfc43('0x40')]){_0x18efbf[_0xfc43('0x46')]=[{'all':!![]}];}_0x18efbf=_['merge']({},_0x18efbf,_0x124802['options']);return db[_0xfc43('0x3f')][_0xfc43('0x47')](_0x18efbf)['then'](handleEntityNotFound(_0x4035de,null))[_0xfc43('0x23')](respondWithResult(_0x4035de,null))[_0xfc43('0x42')](handleError(_0x4035de,null));};exports[_0xfc43('0x48')]=function(_0x477d09,_0x2a8578){return db[_0xfc43('0x3f')]['create'](_0x477d09[_0xfc43('0x49')],{})[_0xfc43('0x23')](function(_0x511614){var _0x1139c0=_0x477d09[_0xfc43('0x4a')][_0xfc43('0x4b')]({'plain':!![]});if(!_0x1139c0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1139c0[_0xfc43('0x4c')]===_0xfc43('0x4a')){var _0x2f6de6=_0x511614[_0xfc43('0x4b')]({'plain':!![]});var _0x122a4a=_0xfc43('0x24');return db[_0xfc43('0x4d')][_0xfc43('0x47')]({'where':{'name':_0x122a4a,'userProfileId':_0x1139c0[_0xfc43('0x4e')]},'raw':!![]})[_0xfc43('0x23')](function(_0x50a5eb){if(_0x50a5eb&&_0x50a5eb[_0xfc43('0x4f')]===0x0){return db[_0xfc43('0x25')]['create']({'name':_0x2f6de6['name'],'resourceId':_0x2f6de6['id'],'type':_0x50a5eb[_0xfc43('0x28')],'sectionId':_0x50a5eb['id']},{})['then'](function(){return _0x511614;});}else{return _0x511614;}})['catch'](function(_0x24d541){logger[_0xfc43('0x50')](_0xfc43('0x51'),_0x24d541);throw _0x24d541;});}return _0x511614;})['then'](respondWithResult(_0x2a8578,0xc9))[_0xfc43('0x42')](handleError(_0x2a8578,null));};exports['update']=function(_0x21c4b9,_0x396260){if(_0x21c4b9[_0xfc43('0x49')]['id']){delete _0x21c4b9[_0xfc43('0x49')]['id'];}return db[_0xfc43('0x3f')][_0xfc43('0x47')]({'where':{'id':_0x21c4b9['params']['id']}})[_0xfc43('0x23')](handleEntityNotFound(_0x396260,null))['then'](saveUpdates(_0x21c4b9[_0xfc43('0x49')],null))[_0xfc43('0x23')](respondWithResult(_0x396260,null))[_0xfc43('0x42')](handleError(_0x396260,null));};exports[_0xfc43('0x26')]=function(_0x50fede,_0x21a374){return db['Variable']['find']({'where':{'id':_0x50fede[_0xfc43('0x44')]['id']}})[_0xfc43('0x23')](handleEntityNotFound(_0x21a374,null))['then'](removeEntity(_0x21a374,null))['catch'](handleError(_0x21a374,null));}; \ No newline at end of file +var _0x06d6=['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','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Variables','UserProfileResource','name','send','index','Variable','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','hasOwnProperty','order','sort','where','filters','pick','map','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','params','fields','length','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','error','body','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x273efe,_0x1af253){var _0x163b9e=function(_0x59db63){while(--_0x59db63){_0x273efe['push'](_0x273efe['shift']());}};_0x163b9e(++_0x1af253);}(_0x06d6,0x196));var _0x606d=function(_0x46dbf1,_0x433756){_0x46dbf1=_0x46dbf1-0x0;var _0x180404=_0x06d6[_0x46dbf1];return _0x180404;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x606d('0x0'));var rp=require('request-promise');var moment=require(_0x606d('0x1'));var BPromise=require(_0x606d('0x2'));var Mustache=require(_0x606d('0x3'));var util=require(_0x606d('0x4'));var path=require('path');var sox=require(_0x606d('0x5'));var csv=require(_0x606d('0x6'));var ejs=require(_0x606d('0x7'));var fs=require('fs');var _=require(_0x606d('0x8'));var squel=require(_0x606d('0x9'));var crypto=require('crypto');var jsforce=require(_0x606d('0xa'));var deskjs=require(_0x606d('0xb'));var toCsv=require(_0x606d('0x6'));var querystring=require(_0x606d('0xc'));var Papa=require(_0x606d('0xd'));var Redis=require(_0x606d('0xe'));var authService=require(_0x606d('0xf'));var qs=require(_0x606d('0x10'));var as=require(_0x606d('0x11'));var hardwareService=require(_0x606d('0x12'));var logger=require('../../config/logger')(_0x606d('0x13'));var utils=require(_0x606d('0x14'));var config=require(_0x606d('0x15'));var licenseUtil=require(_0x606d('0x16'));var db=require(_0x606d('0x17'))['db'];function respondWithStatusCode(_0x48fff0,_0x334af4){_0x334af4=_0x334af4||0xcc;return function(_0x4de201){if(_0x4de201){return _0x48fff0[_0x606d('0x18')](_0x334af4);}return _0x48fff0[_0x606d('0x19')](_0x334af4)[_0x606d('0x1a')]();};}function respondWithResult(_0x1a0b9c,_0x186c4a){_0x186c4a=_0x186c4a||0xc8;return function(_0x3dbfd4){if(_0x3dbfd4){return _0x1a0b9c[_0x606d('0x19')](_0x186c4a)[_0x606d('0x1b')](_0x3dbfd4);}};}function respondWithFilteredResult(_0x553b22,_0x57045e){return function(_0x48abf1){if(_0x48abf1){var _0x1e0f67=_0x48abf1[_0x606d('0x1c')],_0x545a8a=_0x57045e[_0x606d('0x1d')],_0x486bbf=_0x57045e[_0x606d('0x1d')]+_0x57045e[_0x606d('0x1e')],_0x55c0ba;if(_0x486bbf>=_0x1e0f67){_0x486bbf=_0x1e0f67;_0x55c0ba=0xc8;}else{_0x55c0ba=0xce;}_0x553b22[_0x606d('0x19')](_0x55c0ba);return _0x553b22[_0x606d('0x1f')](_0x606d('0x20'),_0x545a8a+'-'+_0x486bbf+'/'+_0x1e0f67)[_0x606d('0x1b')](_0x48abf1);}return null;};}function patchUpdates(_0x204b27){return function(_0x2f1f2d){try{jsonpatch[_0x606d('0x21')](_0x2f1f2d,_0x204b27,!![]);}catch(_0x17174c){return BPromise[_0x606d('0x22')](_0x17174c);}return _0x2f1f2d[_0x606d('0x23')]();};}function saveUpdates(_0x50948a,_0x4ed6cf){return function(_0x2b588e){if(_0x2b588e){return _0x2b588e[_0x606d('0x24')](_0x50948a)['then'](function(_0xe1331a){return _0xe1331a;});}return null;};}function removeEntity(_0x5552cc,_0x2ec58c){return function(_0x5d10d2){if(_0x5d10d2){return _0x5d10d2[_0x606d('0x25')]()[_0x606d('0x26')](function(){var _0x2de8ca=_0x5d10d2[_0x606d('0x27')]({'plain':!![]});var _0x39903b=_0x606d('0x28');return db[_0x606d('0x29')][_0x606d('0x25')]({'where':{'type':_0x39903b,'resourceId':_0x2de8ca['id']}})[_0x606d('0x26')](function(){return _0x5d10d2;});})['then'](function(){_0x5552cc['status'](0xcc)[_0x606d('0x1a')]();});}};}function handleEntityNotFound(_0x317743,_0x5839fa){return function(_0x2f123e){if(!_0x2f123e){_0x317743['sendStatus'](0x194);}return _0x2f123e;};}function handleError(_0x1ec9cd,_0x2f19a6){_0x2f19a6=_0x2f19a6||0x1f4;return function(_0x561555){logger['error'](_0x561555['stack']);if(_0x561555[_0x606d('0x2a')]){delete _0x561555[_0x606d('0x2a')];}_0x1ec9cd['status'](_0x2f19a6)[_0x606d('0x2b')](_0x561555);};}exports[_0x606d('0x2c')]=function(_0x2e49f5,_0x59edd5){var _0x5c07d5={},_0x4ec9c9={},_0x21da67={'count':0x0,'rows':[]};var _0x17fcf7=_['map'](db[_0x606d('0x2d')][_0x606d('0x2e')],function(_0x24137a){return{'name':_0x24137a[_0x606d('0x2f')],'type':_0x24137a[_0x606d('0x30')][_0x606d('0x31')]};});_0x4ec9c9['model']=_['map'](_0x17fcf7,_0x606d('0x2a'));_0x4ec9c9[_0x606d('0x32')]=_[_0x606d('0x33')](_0x2e49f5[_0x606d('0x32')]);_0x4ec9c9['filters']=_['intersection'](_0x4ec9c9[_0x606d('0x34')],_0x4ec9c9[_0x606d('0x32')]);_0x5c07d5[_0x606d('0x35')]=_[_0x606d('0x36')](_0x4ec9c9[_0x606d('0x34')],qs['fields'](_0x2e49f5['query']['fields']));_0x5c07d5[_0x606d('0x35')]=_0x5c07d5[_0x606d('0x35')]['length']?_0x5c07d5[_0x606d('0x35')]:_0x4ec9c9['model'];if(!_0x2e49f5[_0x606d('0x32')][_0x606d('0x37')]('nolimit')){_0x5c07d5['limit']=qs['limit'](_0x2e49f5['query']['limit']);_0x5c07d5[_0x606d('0x1d')]=qs['offset'](_0x2e49f5['query'][_0x606d('0x1d')]);}_0x5c07d5[_0x606d('0x38')]=qs[_0x606d('0x39')](_0x2e49f5[_0x606d('0x32')][_0x606d('0x39')]);_0x5c07d5[_0x606d('0x3a')]=qs[_0x606d('0x3b')](_[_0x606d('0x3c')](_0x2e49f5[_0x606d('0x32')],_0x4ec9c9[_0x606d('0x3b')]),_0x17fcf7);if(_0x2e49f5[_0x606d('0x32')]['filter']){_0x5c07d5[_0x606d('0x3a')]=_['merge'](_0x5c07d5[_0x606d('0x3a')],{'$or':_[_0x606d('0x3d')](_0x17fcf7,function(_0x546a49){if(_0x546a49['type']!==_0x606d('0x3e')){var _0x527ce8={};_0x527ce8[_0x546a49[_0x606d('0x2a')]]={'$like':'%'+_0x2e49f5[_0x606d('0x32')][_0x606d('0x3f')]+'%'};return _0x527ce8;}})});}_0x5c07d5=_[_0x606d('0x40')]({},_0x5c07d5,_0x2e49f5[_0x606d('0x41')]);var _0x36a43b={'where':_0x5c07d5['where']};return db[_0x606d('0x2d')]['count'](_0x36a43b)[_0x606d('0x26')](function(_0x2c4611){_0x21da67[_0x606d('0x1c')]=_0x2c4611;if(_0x2e49f5[_0x606d('0x32')][_0x606d('0x42')]){_0x5c07d5[_0x606d('0x43')]=[{'all':!![]}];}return db[_0x606d('0x2d')][_0x606d('0x44')](_0x5c07d5);})['then'](function(_0x847cb9){_0x21da67[_0x606d('0x45')]=_0x847cb9;return _0x21da67;})[_0x606d('0x26')](respondWithFilteredResult(_0x59edd5,_0x5c07d5))[_0x606d('0x46')](handleError(_0x59edd5,null));};exports['show']=function(_0x351402,_0x52e00d){var _0x343472={'raw':!![],'where':{'id':_0x351402[_0x606d('0x47')]['id']}},_0x4c3657={};_0x4c3657[_0x606d('0x34')]=_[_0x606d('0x33')](db['Variable'][_0x606d('0x2e')]);_0x4c3657[_0x606d('0x32')]=_[_0x606d('0x33')](_0x351402[_0x606d('0x32')]);_0x4c3657['filters']=_['intersection'](_0x4c3657[_0x606d('0x34')],_0x4c3657[_0x606d('0x32')]);_0x343472['attributes']=_[_0x606d('0x36')](_0x4c3657[_0x606d('0x34')],qs[_0x606d('0x48')](_0x351402[_0x606d('0x32')][_0x606d('0x48')]));_0x343472[_0x606d('0x35')]=_0x343472[_0x606d('0x35')][_0x606d('0x49')]?_0x343472[_0x606d('0x35')]:_0x4c3657[_0x606d('0x34')];if(_0x351402['query']['includeAll']){_0x343472['include']=[{'all':!![]}];}_0x343472=_['merge']({},_0x343472,_0x351402[_0x606d('0x41')]);return db[_0x606d('0x2d')]['find'](_0x343472)[_0x606d('0x26')](handleEntityNotFound(_0x52e00d,null))[_0x606d('0x26')](respondWithResult(_0x52e00d,null))[_0x606d('0x46')](handleError(_0x52e00d,null));};exports[_0x606d('0x4a')]=function(_0x1a009d,_0x5c559d){return db['Variable'][_0x606d('0x4a')](_0x1a009d['body'],{})[_0x606d('0x26')](function(_0x517590){var _0x123d83=_0x1a009d['user'][_0x606d('0x27')]({'plain':!![]});if(!_0x123d83)throw new Error(_0x606d('0x4b'));if(_0x123d83[_0x606d('0x4c')]===_0x606d('0x4d')){var _0x5d8079=_0x517590[_0x606d('0x27')]({'plain':!![]});var _0x2f9f25=_0x606d('0x28');return db[_0x606d('0x4e')][_0x606d('0x4f')]({'where':{'name':_0x2f9f25,'userProfileId':_0x123d83[_0x606d('0x50')]},'raw':!![]})[_0x606d('0x26')](function(_0x52164c){if(_0x52164c&&_0x52164c[_0x606d('0x51')]===0x0){return db[_0x606d('0x29')][_0x606d('0x4a')]({'name':_0x5d8079['name'],'resourceId':_0x5d8079['id'],'type':_0x52164c[_0x606d('0x2a')],'sectionId':_0x52164c['id']},{})[_0x606d('0x26')](function(){return _0x517590;});}else{return _0x517590;}})[_0x606d('0x46')](function(_0x547d8b){logger[_0x606d('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x547d8b);throw _0x547d8b;});}return _0x517590;})['then'](respondWithResult(_0x5c559d,0xc9))[_0x606d('0x46')](handleError(_0x5c559d,null));};exports[_0x606d('0x24')]=function(_0x4bc94d,_0x46bc59){if(_0x4bc94d[_0x606d('0x53')]['id']){delete _0x4bc94d['body']['id'];}return db[_0x606d('0x2d')][_0x606d('0x4f')]({'where':{'id':_0x4bc94d[_0x606d('0x47')]['id']}})[_0x606d('0x26')](handleEntityNotFound(_0x46bc59,null))[_0x606d('0x26')](saveUpdates(_0x4bc94d['body'],null))[_0x606d('0x26')](respondWithResult(_0x46bc59,null))[_0x606d('0x46')](handleError(_0x46bc59,null));};exports[_0x606d('0x25')]=function(_0x57c6db,_0x21871c){return db[_0x606d('0x2d')]['find']({'where':{'id':_0x57c6db['params']['id']}})['then'](handleEntityNotFound(_0x21871c,null))[_0x606d('0x26')](removeEntity(_0x21871c,null))[_0x606d('0x46')](handleError(_0x21871c,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index a0f1ca0..4c68363 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 _0xc181=['request-promise','path','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','api','moment','bluebird'];(function(_0x33b463,_0x21885e){var _0x4711fb=function(_0x5cb96e){while(--_0x5cb96e){_0x33b463['push'](_0x33b463['shift']());}};_0x4711fb(++_0x21885e);}(_0xc181,0x126));var _0x1c18=function(_0x48a836,_0xa1d010){_0x48a836=_0x48a836-0x0;var _0x249dc8=_0xc181[_0x48a836];return _0x249dc8;};'use strict';var _=require(_0x1c18('0x0'));var util=require(_0x1c18('0x1'));var logger=require('../../config/logger')(_0x1c18('0x2'));var moment=require(_0x1c18('0x3'));var BPromise=require(_0x1c18('0x4'));var rp=require(_0x1c18('0x5'));var fs=require('fs');var path=require(_0x1c18('0x6'));var rimraf=require('rimraf');var config=require(_0x1c18('0x7'));var attributes=require(_0x1c18('0x8'));module[_0x1c18('0x9')]=function(_0x1af123,_0x2f3f3a){return _0x1af123[_0x1c18('0xa')](_0x1c18('0xb'),attributes,{'tableName':_0x1c18('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc831=['request-promise','path','rimraf','../../config/environment','./variable.attributes','Variable','tools_variables','util','../../config/logger','api','moment','bluebird'];(function(_0x55bb28,_0x1869ef){var _0x2edb9a=function(_0xb6275f){while(--_0xb6275f){_0x55bb28['push'](_0x55bb28['shift']());}};_0x2edb9a(++_0x1869ef);}(_0xc831,0x103));var _0x1c83=function(_0x32460c,_0x1716a9){_0x32460c=_0x32460c-0x0;var _0x48ab15=_0xc831[_0x32460c];return _0x48ab15;};'use strict';var _=require('lodash');var util=require(_0x1c83('0x0'));var logger=require(_0x1c83('0x1'))(_0x1c83('0x2'));var moment=require(_0x1c83('0x3'));var BPromise=require(_0x1c83('0x4'));var rp=require(_0x1c83('0x5'));var fs=require('fs');var path=require(_0x1c83('0x6'));var rimraf=require(_0x1c83('0x7'));var config=require(_0x1c83('0x8'));var attributes=require(_0x1c83('0x9'));module['exports']=function(_0x5682fb,_0x2f52ea){return _0x5682fb['define'](_0x1c83('0xa'),attributes,{'tableName':_0x1c83('0xb'),'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 d6a7adf..e023277 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 _0x84f2=['message','info','result','catch','find','raw','options','attributes','include','map','model','ShowVariable','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84f2,0x7d));var _0x284f=function(_0x4f6c26,_0x5c2c54){_0x4f6c26=_0x4f6c26-0x0;var _0x4809a0=_0x84f2[_0x4f6c26];return _0x4809a0;};'use strict';var _=require(_0x284f('0x0'));var util=require('util');var moment=require(_0x284f('0x1'));var BPromise=require(_0x284f('0x2'));var rs=require(_0x284f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x284f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x284f('0x5'))(_0x284f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x284f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x53a4ea,_0x1b2c3b,_0x55d42a){return new BPromise(function(_0x3bce06,_0x5947ee){return client['request'](_0x53a4ea,_0x55d42a)[_0x284f('0x8')](function(_0x4f5738){logger['info'](_0x284f('0x9'),_0x1b2c3b,_0x284f('0xa'));logger[_0x284f('0xb')](_0x284f('0xc'),_0x1b2c3b,_0x284f('0xa'),JSON['stringify'](_0x4f5738));if(_0x4f5738['error']){if(_0x4f5738['error'][_0x284f('0xd')]===0x1f4){logger[_0x284f('0xe')](_0x284f('0x9'),_0x1b2c3b,_0x4f5738[_0x284f('0xe')][_0x284f('0xf')]);return _0x5947ee(_0x4f5738[_0x284f('0xe')][_0x284f('0xf')]);}logger[_0x284f('0xe')](_0x284f('0x9'),_0x1b2c3b,_0x4f5738[_0x284f('0xe')]['message']);return _0x3bce06(_0x4f5738[_0x284f('0xe')][_0x284f('0xf')]);}else{logger[_0x284f('0x10')](_0x284f('0x9'),_0x1b2c3b,_0x284f('0xa'));_0x3bce06(_0x4f5738[_0x284f('0x11')][_0x284f('0xf')]);}})[_0x284f('0x12')](function(_0xaed23b){logger['error']('Variable,\x20%s,\x20%s',_0x1b2c3b,_0xaed23b);_0x5947ee(_0xaed23b);});});}exports['ShowVariable']=function(_0x5f1a85){var _0x530d5a=this;return new Promise(function(_0x83bf76,_0xee67ff){return db['Variable'][_0x284f('0x13')]({'raw':_0x5f1a85['options']?_0x5f1a85['options'][_0x284f('0x14')]===undefined?!![]:![]:!![],'where':_0x5f1a85['options']?_0x5f1a85['options']['where']||null:null,'attributes':_0x5f1a85[_0x284f('0x15')]?_0x5f1a85[_0x284f('0x15')][_0x284f('0x16')]||null:null,'include':_0x5f1a85['options']?_0x5f1a85['options'][_0x284f('0x17')]?_['map'](_0x5f1a85['options'][_0x284f('0x17')],function(_0x390b79){return{'model':db[_0x390b79['model']],'as':_0x390b79['as'],'attributes':_0x390b79[_0x284f('0x16')],'include':_0x390b79[_0x284f('0x17')]?_[_0x284f('0x18')](_0x390b79[_0x284f('0x17')],function(_0x55f507){return{'model':db[_0x55f507[_0x284f('0x19')]],'as':_0x55f507['as'],'attributes':_0x55f507[_0x284f('0x16')],'include':_0x55f507['include']?_[_0x284f('0x18')](_0x55f507[_0x284f('0x17')],function(_0x584001){return{'model':db[_0x584001[_0x284f('0x19')]],'as':_0x584001['as'],'attributes':_0x584001['attributes']};}):[]};}):[]};}):[]:[]})[_0x284f('0x8')](function(_0x16d59f){logger[_0x284f('0x10')](_0x284f('0x1a'),_0x5f1a85);logger[_0x284f('0xb')](_0x284f('0x1a'),_0x5f1a85,JSON[_0x284f('0x1b')](_0x16d59f));_0x83bf76(_0x16d59f);})[_0x284f('0x12')](function(_0x5cfc11){logger[_0x284f('0xe')](_0x284f('0x1a'),_0x5cfc11[_0x284f('0xf')],_0x5f1a85);_0xee67ff(_0x530d5a[_0x284f('0xe')](0x1f4,_0x5cfc11[_0x284f('0xf')]));});});}; \ No newline at end of file +var _0x6a6b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','Variable','find','options','raw','where','include','map','attributes','model','ShowVariable','debug','catch','util','moment','bluebird'];(function(_0x165584,_0x278531){var _0x324dc7=function(_0x569a52){while(--_0x569a52){_0x165584['push'](_0x165584['shift']());}};_0x324dc7(++_0x278531);}(_0x6a6b,0x147));var _0xb6a6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6a6b[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xb6a6('0x0'));var moment=require(_0xb6a6('0x1'));var BPromise=require(_0xb6a6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb6a6('0x3'))['db'];var utils=require(_0xb6a6('0x4'));var logger=require(_0xb6a6('0x5'))(_0xb6a6('0x6'));var config=require(_0xb6a6('0x7'));var jayson=require(_0xb6a6('0x8'));var client=jayson[_0xb6a6('0x9')][_0xb6a6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5270f6,_0x17340f,_0x80dd55){return new BPromise(function(_0x415381,_0x58246a){return client['request'](_0x5270f6,_0x80dd55)[_0xb6a6('0xb')](function(_0x5c802e){logger[_0xb6a6('0xc')](_0xb6a6('0xd'),_0x17340f,'request\x20sent');logger['debug'](_0xb6a6('0xe'),_0x17340f,_0xb6a6('0xf'),JSON[_0xb6a6('0x10')](_0x5c802e));if(_0x5c802e[_0xb6a6('0x11')]){if(_0x5c802e[_0xb6a6('0x11')][_0xb6a6('0x12')]===0x1f4){logger[_0xb6a6('0x11')]('Variable,\x20%s,\x20%s',_0x17340f,_0x5c802e[_0xb6a6('0x11')]['message']);return _0x58246a(_0x5c802e['error'][_0xb6a6('0x13')]);}logger[_0xb6a6('0x11')](_0xb6a6('0xd'),_0x17340f,_0x5c802e[_0xb6a6('0x11')][_0xb6a6('0x13')]);return _0x415381(_0x5c802e[_0xb6a6('0x11')][_0xb6a6('0x13')]);}else{logger[_0xb6a6('0xc')]('Variable,\x20%s,\x20%s',_0x17340f,_0xb6a6('0xf'));_0x415381(_0x5c802e[_0xb6a6('0x14')]['message']);}})['catch'](function(_0x46c885){logger[_0xb6a6('0x11')]('Variable,\x20%s,\x20%s',_0x17340f,_0x46c885);_0x58246a(_0x46c885);});});}exports['ShowVariable']=function(_0x466075){var _0x2f027c=this;return new Promise(function(_0x1617fd,_0x5e0748){return db[_0xb6a6('0x15')][_0xb6a6('0x16')]({'raw':_0x466075[_0xb6a6('0x17')]?_0x466075[_0xb6a6('0x17')][_0xb6a6('0x18')]===undefined?!![]:![]:!![],'where':_0x466075[_0xb6a6('0x17')]?_0x466075['options'][_0xb6a6('0x19')]||null:null,'attributes':_0x466075['options']?_0x466075['options']['attributes']||null:null,'include':_0x466075['options']?_0x466075[_0xb6a6('0x17')][_0xb6a6('0x1a')]?_[_0xb6a6('0x1b')](_0x466075['options'][_0xb6a6('0x1a')],function(_0x329216){return{'model':db[_0x329216['model']],'as':_0x329216['as'],'attributes':_0x329216[_0xb6a6('0x1c')],'include':_0x329216[_0xb6a6('0x1a')]?_['map'](_0x329216[_0xb6a6('0x1a')],function(_0x53a0ee){return{'model':db[_0x53a0ee[_0xb6a6('0x1d')]],'as':_0x53a0ee['as'],'attributes':_0x53a0ee['attributes'],'include':_0x53a0ee[_0xb6a6('0x1a')]?_[_0xb6a6('0x1b')](_0x53a0ee[_0xb6a6('0x1a')],function(_0x5458dd){return{'model':db[_0x5458dd[_0xb6a6('0x1d')]],'as':_0x5458dd['as'],'attributes':_0x5458dd[_0xb6a6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb6a6('0xb')](function(_0x52222b){logger[_0xb6a6('0xc')](_0xb6a6('0x1e'),_0x466075);logger[_0xb6a6('0x1f')](_0xb6a6('0x1e'),_0x466075,JSON[_0xb6a6('0x10')](_0x52222b));_0x1617fd(_0x52222b);})[_0xb6a6('0x20')](function(_0x4e9ab3){logger[_0xb6a6('0x11')](_0xb6a6('0x1e'),_0x4e9ab3['message'],_0x466075);_0x5e0748(_0x2f027c[_0xb6a6('0x11')](0x1f4,_0x4e9ab3['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index dd84872..efe8d0b 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 _0x301a=['/fetch','isAuthenticated','canUpdate','/reset','reset','/pull','pull','/restart','restart','migrations','express','../../components/auth/service','./version.controller','get','index'];(function(_0xa087f5,_0x34fd10){var _0x4c8806=function(_0x4b1cfe){while(--_0x4b1cfe){_0xa087f5['push'](_0xa087f5['shift']());}};_0x4c8806(++_0x34fd10);}(_0x301a,0xeb));var _0xa301=function(_0x3fbcb8,_0x2cbd28){_0x3fbcb8=_0x3fbcb8-0x0;var _0x2f7103=_0x301a[_0x3fbcb8];return _0x2f7103;};'use strict';var express=require(_0xa301('0x0'));var router=express['Router']();var auth=require(_0xa301('0x1'));var controller=require(_0xa301('0x2'));router[_0xa301('0x3')]('/',controller[_0xa301('0x4')]);router[_0xa301('0x3')](_0xa301('0x5'),auth[_0xa301('0x6')](),auth[_0xa301('0x7')](),controller['fetch']);router['get'](_0xa301('0x8'),auth[_0xa301('0x6')](),auth[_0xa301('0x7')](),controller[_0xa301('0x9')]);router[_0xa301('0x3')](_0xa301('0xa'),auth[_0xa301('0x6')](),auth[_0xa301('0x7')](),controller[_0xa301('0xb')]);router[_0xa301('0x3')](_0xa301('0xc'),auth[_0xa301('0x6')](),controller[_0xa301('0xd')]);router['get']('/migrations',controller[_0xa301('0xe')]);module['exports']=router; \ No newline at end of file +var _0x9dec=['/restart','migrations','express','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','/pull','pull'];(function(_0x4d8b8e,_0x12fb10){var _0x3103ba=function(_0x361cae){while(--_0x361cae){_0x4d8b8e['push'](_0x4d8b8e['shift']());}};_0x3103ba(++_0x12fb10);}(_0x9dec,0x1d3));var _0xc9de=function(_0x12c0aa,_0x5ac6fe){_0x12c0aa=_0x12c0aa-0x0;var _0x1e045b=_0x9dec[_0x12c0aa];return _0x1e045b;};'use strict';var express=require(_0xc9de('0x0'));var router=express['Router']();var auth=require(_0xc9de('0x1'));var controller=require(_0xc9de('0x2'));router[_0xc9de('0x3')]('/',controller[_0xc9de('0x4')]);router[_0xc9de('0x3')](_0xc9de('0x5'),auth[_0xc9de('0x6')](),auth['canUpdate'](),controller[_0xc9de('0x7')]);router[_0xc9de('0x3')](_0xc9de('0x8'),auth[_0xc9de('0x6')](),auth[_0xc9de('0x9')](),controller[_0xc9de('0xa')]);router['get'](_0xc9de('0xb'),auth[_0xc9de('0x6')](),auth['canUpdate'](),controller[_0xc9de('0xc')]);router[_0xc9de('0x3')](_0xc9de('0xd'),auth['isAuthenticated'](),controller['restart']);router[_0xc9de('0x3')]('/migrations',controller[_0xc9de('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 245e02e..69c407d 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 _0x2272=['version','child_process','exec','../../mysqldb','../../config/logger','update','simple-git','root','index','exports','query','fetch','tags','latest','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','server','length','.js','push','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','\x20to\x20','catch','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo'];(function(_0x43d6b8,_0x15d2a7){var _0x45673c=function(_0x4aa501){while(--_0x4aa501){_0x43d6b8['push'](_0x43d6b8['shift']());}};_0x45673c(++_0x15d2a7);}(_0x2272,0xd8));var _0x2227=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2272[_0xa464c9];return _0x3d73c4;};'use strict';var Umzug=require(_0x2227('0x0'));var path=require(_0x2227('0x1'));var fs=require('fs');var _=require(_0x2227('0x2'));var pkginfo=require(_0x2227('0x3'))(module,_0x2227('0x4'));var compareVersions=require('compare-versions');var exec=require(_0x2227('0x5'))[_0x2227('0x6')];var db=require(_0x2227('0x7'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require(_0x2227('0x8'))(_0x2227('0x9'));var git=require(_0x2227('0xa'))(config[_0x2227('0xb')]);exports[_0x2227('0xc')]=function(_0x1413d2,_0x41fc3f){var _0x34bdd0={'current':module[_0x2227('0xd')][_0x2227('0x4')],'phonebar':0x2};if(_0x1413d2['query']&&_0x1413d2[_0x2227('0xe')]['latest']){return git[_0x2227('0xf')]()[_0x2227('0x10')](function(_0x164735,_0x194df6){_0x34bdd0[_0x2227('0x11')]=(_0x164735?module['exports'][_0x2227('0x4')]:_0x194df6[_0x2227('0x11')])||_0x2227('0x12');return _0x41fc3f[_0x2227('0x13')](0xc8)[_0x2227('0x14')](_0x34bdd0);});}else{return _0x41fc3f[_0x2227('0x13')](0xc8)['json'](_0x34bdd0);}};exports['fetch']=function(_0x5152ef,_0x136f6b){return git['fetch']([_0x2227('0x15'),_0x2227('0x16')],function(_0x510b09){if(_0x510b09){logger[_0x2227('0x17')](_0x510b09);return _0x136f6b[_0x2227('0x13')](0x1f4)[_0x2227('0x14')](_0x510b09);}logger[_0x2227('0x18')](_0x2227('0x19'));return _0x136f6b[_0x2227('0x13')](0xc8)['json']({'output':_0x2227('0x1a')});});};exports[_0x2227('0x1b')]=function(_0x162723,_0x531f75){return git[_0x2227('0x1b')]([_0x2227('0x1c'),_0x2227('0x1d')],function(_0x2482ba){if(_0x2482ba){logger[_0x2227('0x17')](_0x2482ba);return _0x531f75[_0x2227('0x13')](0x1f4)[_0x2227('0x14')](_0x2482ba);}logger['info'](_0x2227('0x1e'));return _0x531f75['status'](0xc8)[_0x2227('0x14')]({'output':_0x2227('0x1f')});});};exports[_0x2227('0x20')]=function(_0x1f28ef,_0x3663ae){exec(_0x2227('0x21'),function(_0x19ab59,_0x10d9ca,_0x3299fd){logger[_0x2227('0x18')](_0x10d9ca);logger[_0x2227('0x18')](_0x3299fd);if(_0x19ab59){logger['error'](_0x19ab59);return _0x3663ae[_0x2227('0x13')](0x1f4)[_0x2227('0x14')](_0x19ab59);}return _0x3663ae['status'](0xc8)[_0x2227('0x14')]({'output':_0x10d9ca});});};exports[_0x2227('0x22')]=function(_0x5ea1c3,_0x4cc85f){return pm2[_0x2227('0x22')](_0x2227('0x23'))[_0x2227('0x24')](function(_0x1f30c3){logger['info'](_0x2227('0x25'),_0x1f30c3);return _0x4cc85f[_0x2227('0x13')](0xc8)[_0x2227('0x14')]({'output':_0x2227('0x26')});})['catch'](function(_0x204def){logger[_0x2227('0x17')](_0x204def);return _0x4cc85f[_0x2227('0x13')](0x1f4)[_0x2227('0x14')](_0x204def);});};exports[_0x2227('0x27')]=function(_0x4789eb,_0x55015e){var _0x5d1d56=fs[_0x2227('0x28')](path['join'](config[_0x2227('0xb')],_0x2227('0x29'),'migrations'));var _0x5916d4=[];for(var _0x1f1ba7=0x0;_0x1f1ba7<_0x5d1d56[_0x2227('0x2a')];_0x1f1ba7++){var _0x21838a=_0x5d1d56[_0x1f1ba7]['replace'](_0x2227('0x2b'),'');if(compareVersions(module['exports'][_0x2227('0x4')],_0x21838a)===-0x1){_0x5916d4[_0x2227('0x2c')](_0x21838a);}}if(_0x5916d4[_0x2227('0x2a')]){var _0xfa2140=_0x5916d4[_0x2227('0x2d')](compareVersions);var _0x256b7b=new Umzug({'storage':_0x2227('0x2e'),'storageOptions':{'model':db[_0x2227('0x2f')],'modelName':_0x2227('0x2f'),'columnName':_0x2227('0x4')},'migrations':{'params':[db[_0x2227('0x2e')]['getQueryInterface'](),db[_0x2227('0x2e')][_0x2227('0x30')],function(){throw new Error(_0x2227('0x31'));}],'path':path[_0x2227('0x32')](config['root'],_0x2227('0x29'),_0x2227('0x27')),'pattern':/\.js$/}});_0x256b7b['up']({'migrations':_[_0x2227('0x33')](_0xfa2140,function(_0x263a3c){return _0x263a3c+'.js';})})[_0x2227('0x24')](function(){return _0x55015e[_0x2227('0x13')](0xc8)[_0x2227('0x14')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x2227('0x4')]+_0x2227('0x34')+_['last'](_0xfa2140),'migrations':_[_0x2227('0x32')](_0xfa2140)});})[_0x2227('0x35')](function(_0x5dac69){if(_0x5dac69 instanceof db[_0x2227('0x2e')]['UniqueConstraintError']){return _0x55015e[_0x2227('0x13')](0xc8)[_0x2227('0x14')]({'output':_0x2227('0x36')});}else{return _0x55015e[_0x2227('0x13')](0x1f4)['json'](_0x5dac69);}});}else{return _0x55015e[_0x2227('0x13')](0xc8)['json']({'output':_0x2227('0x36')});}}; \ No newline at end of file +var _0xee2c=['compare-versions','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','status','master','error','json','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','replace','push','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','\x20to\x20','last','join','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xee2c,0x1c7));var _0xcee2=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xee2c[_0x1589dd];return _0x1bddd1;};'use strict';var Umzug=require(_0xcee2('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xcee2('0x1'));var pkginfo=require(_0xcee2('0x2'))(module,_0xcee2('0x3'));var compareVersions=require(_0xcee2('0x4'));var exec=require('child_process')['exec'];var db=require(_0xcee2('0x5'))['db'];var config=require(_0xcee2('0x6'));var pm2=require('../../config/pm2');var logger=require(_0xcee2('0x7'))(_0xcee2('0x8'));var git=require(_0xcee2('0x9'))(config[_0xcee2('0xa')]);exports[_0xcee2('0xb')]=function(_0x5a8219,_0x52a4ac){var _0xea6c3c={'current':module[_0xcee2('0xc')][_0xcee2('0x3')],'phonebar':0x2};if(_0x5a8219[_0xcee2('0xd')]&&_0x5a8219[_0xcee2('0xd')][_0xcee2('0xe')]){return git[_0xcee2('0xf')]()[_0xcee2('0x10')](function(_0x4ded22,_0xca2c64){_0xea6c3c[_0xcee2('0xe')]=(_0x4ded22?module[_0xcee2('0xc')][_0xcee2('0x3')]:_0xca2c64[_0xcee2('0xe')])||'2.0.0';return _0x52a4ac[_0xcee2('0x11')](0xc8)['json'](_0xea6c3c);});}else{return _0x52a4ac['status'](0xc8)['json'](_0xea6c3c);}};exports[_0xcee2('0xf')]=function(_0x34cc92,_0x2afc56){return git[_0xcee2('0xf')](['origin',_0xcee2('0x12')],function(_0x818e13){if(_0x818e13){logger[_0xcee2('0x13')](_0x818e13);return _0x2afc56[_0xcee2('0x11')](0x1f4)[_0xcee2('0x14')](_0x818e13);}logger[_0xcee2('0x15')](_0xcee2('0x16'));return _0x2afc56[_0xcee2('0x11')](0xc8)[_0xcee2('0x14')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xcee2('0x17')]=function(_0x548e47,_0x221d75){return git[_0xcee2('0x17')]([_0xcee2('0x18'),_0xcee2('0x19')],function(_0x5bb46f){if(_0x5bb46f){logger[_0xcee2('0x13')](_0x5bb46f);return _0x221d75[_0xcee2('0x11')](0x1f4)[_0xcee2('0x14')](_0x5bb46f);}logger[_0xcee2('0x15')](_0xcee2('0x1a'));return _0x221d75[_0xcee2('0x11')](0xc8)[_0xcee2('0x14')]({'output':_0xcee2('0x1b')});});};exports[_0xcee2('0x1c')]=function(_0x148023,_0x3e3f75){exec('npm\x20install\x20--production',function(_0x3f4f92,_0x4864d7,_0x4fdb88){logger['info'](_0x4864d7);logger[_0xcee2('0x15')](_0x4fdb88);if(_0x3f4f92){logger['error'](_0x3f4f92);return _0x3e3f75[_0xcee2('0x11')](0x1f4)[_0xcee2('0x14')](_0x3f4f92);}return _0x3e3f75[_0xcee2('0x11')](0xc8)['json']({'output':_0x4864d7});});};exports['restart']=function(_0x20a6de,_0x2ccc9c){return pm2[_0xcee2('0x1d')]('motion2')[_0xcee2('0x1e')](function(_0x538c04){logger[_0xcee2('0x15')](_0xcee2('0x1f'),_0x538c04);return _0x2ccc9c[_0xcee2('0x11')](0xc8)[_0xcee2('0x14')]({'output':_0xcee2('0x20')});})[_0xcee2('0x21')](function(_0xbc2b2e){logger[_0xcee2('0x13')](_0xbc2b2e);return _0x2ccc9c[_0xcee2('0x11')](0x1f4)[_0xcee2('0x14')](_0xbc2b2e);});};exports[_0xcee2('0x22')]=function(_0x483d22,_0x19a99b){var _0x3ccff6=fs[_0xcee2('0x23')](path['join'](config[_0xcee2('0xa')],_0xcee2('0x24'),'migrations'));var _0x1e0dfc=[];for(var _0x25ead9=0x0;_0x25ead9<_0x3ccff6['length'];_0x25ead9++){var _0x5ee5a5=_0x3ccff6[_0x25ead9][_0xcee2('0x25')]('.js','');if(compareVersions(module['exports'][_0xcee2('0x3')],_0x5ee5a5)===-0x1){_0x1e0dfc[_0xcee2('0x26')](_0x5ee5a5);}}if(_0x1e0dfc['length']){var _0x2563bf=_0x1e0dfc[_0xcee2('0x27')](compareVersions);var _0x21635f=new Umzug({'storage':_0xcee2('0x28'),'storageOptions':{'model':db[_0xcee2('0x29')],'modelName':_0xcee2('0x29'),'columnName':_0xcee2('0x3')},'migrations':{'params':[db[_0xcee2('0x28')][_0xcee2('0x2a')](),db[_0xcee2('0x28')][_0xcee2('0x2b')],function(){throw new Error(_0xcee2('0x2c'));}],'path':path['join'](config[_0xcee2('0xa')],_0xcee2('0x24'),'migrations'),'pattern':/\.js$/}});_0x21635f['up']({'migrations':_[_0xcee2('0x2d')](_0x2563bf,function(_0xecdf2c){return _0xecdf2c+'.js';})})[_0xcee2('0x1e')](function(){return _0x19a99b[_0xcee2('0x11')](0xc8)[_0xcee2('0x14')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xcee2('0xc')][_0xcee2('0x3')]+_0xcee2('0x2e')+_[_0xcee2('0x2f')](_0x2563bf),'migrations':_[_0xcee2('0x30')](_0x2563bf)});})[_0xcee2('0x21')](function(_0x538984){if(_0x538984 instanceof db[_0xcee2('0x28')][_0xcee2('0x31')]){return _0x19a99b[_0xcee2('0x11')](0xc8)['json']({'output':_0xcee2('0x32')});}else{return _0x19a99b['status'](0x1f4)['json'](_0x538984);}});}else{return _0x19a99b[_0xcee2('0x11')](0xc8)[_0xcee2('0x14')]({'output':_0xcee2('0x32')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 0a29120..bb699c8 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 _0x1f4d=['/describe','describe','/:id','show','post','isAuthenticated','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','index'];(function(_0x56348a,_0x2593cb){var _0x492d0b=function(_0x385369){while(--_0x385369){_0x56348a['push'](_0x56348a['shift']());}};_0x492d0b(++_0x2593cb);}(_0x1f4d,0x1c9));var _0xd1f4=function(_0x5bcb5f,_0x165a76){_0x5bcb5f=_0x5bcb5f-0x0;var _0xb5aab8=_0x1f4d[_0x5bcb5f];return _0xb5aab8;};'use strict';var multer=require(_0xd1f4('0x0'));var util=require(_0xd1f4('0x1'));var path=require(_0xd1f4('0x2'));var timeout=require(_0xd1f4('0x3'));var express=require('express');var router=express[_0xd1f4('0x4')]();var auth=require(_0xd1f4('0x5'));var interaction=require(_0xd1f4('0x6'));var config=require(_0xd1f4('0x7'));var controller=require(_0xd1f4('0x8'));router[_0xd1f4('0x9')]('/',auth['isAuthenticated'](),controller[_0xd1f4('0xa')]);router[_0xd1f4('0x9')](_0xd1f4('0xb'),auth['isAuthenticated'](),controller[_0xd1f4('0xc')]);router[_0xd1f4('0x9')](_0xd1f4('0xd'),auth['isAuthenticated'](),controller[_0xd1f4('0xe')]);router[_0xd1f4('0xf')]('/',auth[_0xd1f4('0x10')](),controller['create']);router['put'](_0xd1f4('0xd'),auth[_0xd1f4('0x10')](),controller['update']);router['delete'](_0xd1f4('0xd'),auth[_0xd1f4('0x10')](),controller[_0xd1f4('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2756=['create','put','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','post'];(function(_0xc84622,_0xf623a6){var _0x504c81=function(_0x3fc07a){while(--_0x3fc07a){_0xc84622['push'](_0xc84622['shift']());}};_0x504c81(++_0xf623a6);}(_0x2756,0x124));var _0x6275=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x2756[_0x4eafed];return _0x159c85;};'use strict';var multer=require('multer');var util=require(_0x6275('0x0'));var path=require(_0x6275('0x1'));var timeout=require(_0x6275('0x2'));var express=require(_0x6275('0x3'));var router=express[_0x6275('0x4')]();var auth=require(_0x6275('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6275('0x6'));var controller=require(_0x6275('0x7'));router[_0x6275('0x8')]('/',auth[_0x6275('0x9')](),controller['index']);router['get'](_0x6275('0xa'),auth[_0x6275('0x9')](),controller[_0x6275('0xb')]);router['get'](_0x6275('0xc'),auth[_0x6275('0x9')](),controller['show']);router[_0x6275('0xd')]('/',auth[_0x6275('0x9')](),controller[_0x6275('0xe')]);router[_0x6275('0xf')]('/:id',auth[_0x6275('0x9')](),controller['update']);router[_0x6275('0x10')](_0x6275('0xc'),auth[_0x6275('0x9')](),controller['destroy']);module[_0x6275('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 3f773af..4a5f7ef 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 _0xb138=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x293312,_0x33a5be){var _0x31a0cc=function(_0x1c5b67){while(--_0x1c5b67){_0x293312['push'](_0x293312['shift']());}};_0x31a0cc(++_0x33a5be);}(_0xb138,0x1dd));var _0x8b13=function(_0xa63325,_0x1bc1b4){_0xa63325=_0xa63325-0x0;var _0x2204d3=_0xb138[_0xa63325];return _0x2204d3;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'type':{'type':Sequelize[_0x8b13('0x2')]},'uniqueid':{'type':Sequelize[_0x8b13('0x2')]},'calleridnum':{'type':Sequelize[_0x8b13('0x2')]},'calleridname':{'type':Sequelize[_0x8b13('0x2')]},'queue':{'type':Sequelize[_0x8b13('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8b13('0x2')]},'agentcalledAt':{'type':Sequelize[_0x8b13('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8b13('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x8b13('0x3')]},'agentdumpAt':{'type':Sequelize[_0x8b13('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x8b13('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x8b13('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8b13('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x8b13('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8b13('0x5')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8b13('0x2')]},'channelstate':{'type':Sequelize[_0x8b13('0x5')]},'channelstatedesc':{'type':Sequelize[_0x8b13('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8b13('0x2')]},'connectedlinename':{'type':Sequelize[_0x8b13('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8b13('0x2')]},'context':{'type':Sequelize[_0x8b13('0x2')]},'exten':{'type':Sequelize[_0x8b13('0x2')]},'priority':{'type':Sequelize[_0x8b13('0x2')]},'destchannel':{'type':Sequelize[_0x8b13('0x2')]},'destchannelstate':{'type':Sequelize[_0x8b13('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x8b13('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x8b13('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x8b13('0x2')]},'destexten':{'type':Sequelize[_0x8b13('0x2')]},'destpriority':{'type':Sequelize[_0x8b13('0x2')]},'destuniqueid':{'type':Sequelize[_0x8b13('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x8b13('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x8b13('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8b13('0x2')],'comment':_0x8b13('0x6')},'transferexten':{'type':Sequelize[_0x8b13('0x2')]},'transferuniqueid':{'type':Sequelize[_0x8b13('0x2')]},'agententerreason':{'type':Sequelize[_0x8b13('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdc97=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x3fa6eb,_0x139e0b){var _0x587da5=function(_0x39c8ca){while(--_0x39c8ca){_0x3fa6eb['push'](_0x3fa6eb['shift']());}};_0x587da5(++_0x139e0b);}(_0xdc97,0x13b));var _0x7dc9=function(_0x546764,_0x97e034){_0x546764=_0x546764-0x0;var _0x31134a=_0xdc97[_0x546764];return _0x31134a;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'type':{'type':Sequelize[_0x7dc9('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7dc9('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7dc9('0x2')]},'interface':{'type':Sequelize[_0x7dc9('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x7dc9('0x3')]},'agentconnectAt':{'type':Sequelize[_0x7dc9('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x7dc9('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x7dc9('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x7dc9('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x7dc9('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x7dc9('0x4')]},'agentacw':{'type':Sequelize[_0x7dc9('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7dc9('0x4')]},'reason':{'type':Sequelize[_0x7dc9('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7dc9('0x2')]},'channelstate':{'type':Sequelize[_0x7dc9('0x4')]},'channelstatedesc':{'type':Sequelize[_0x7dc9('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7dc9('0x2')]},'connectedlinename':{'type':Sequelize[_0x7dc9('0x2')]},'language':{'type':Sequelize[_0x7dc9('0x2')]},'accountcode':{'type':Sequelize[_0x7dc9('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x7dc9('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x7dc9('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x7dc9('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7dc9('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7dc9('0x2')]},'destlanguage':{'type':Sequelize[_0x7dc9('0x2')]},'destaccountcode':{'type':Sequelize[_0x7dc9('0x2')]},'destcontext':{'type':Sequelize[_0x7dc9('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7dc9('0x2')]},'destuniqueid':{'type':Sequelize[_0x7dc9('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7dc9('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x7dc9('0x2')]},'transfer':{'type':Sequelize[_0x7dc9('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7dc9('0x2')],'comment':_0x7dc9('0x6')},'transferexten':{'type':Sequelize[_0x7dc9('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7dc9('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'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 8f1dc9a..c7f83b5 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 _0x79cf=['zip-dir','fast-json-patch','moment','bluebird','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','end','status','json','count','offset','limit','set','reject','update','destroy','then','error','name','rawAttributes','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','options','VoiceAgentReport','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','describe','html-pdf','eml-format','rimraf'];(function(_0x3e9574,_0x2fec1a){var _0x428c9b=function(_0x546d0f){while(--_0x546d0f){_0x3e9574['push'](_0x3e9574['shift']());}};_0x428c9b(++_0x2fec1a);}(_0x79cf,0x142));var _0xf79c=function(_0x2cf76c,_0x1ffb2c){_0x2cf76c=_0x2cf76c-0x0;var _0x51a4fd=_0x79cf[_0x2cf76c];return _0x51a4fd;};'use strict';var pdf=require(_0xf79c('0x0'));var emlformat=require(_0xf79c('0x1'));var rimraf=require(_0xf79c('0x2'));var zipdir=require(_0xf79c('0x3'));var jsonpatch=require(_0xf79c('0x4'));var rp=require('request-promise');var moment=require(_0xf79c('0x5'));var BPromise=require(_0xf79c('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf79c('0x7'));var ejs=require(_0xf79c('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf79c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xf79c('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf79c('0xb'));var Papa=require(_0xf79c('0xc'));var Redis=require(_0xf79c('0xd'));var authService=require(_0xf79c('0xe'));var qs=require(_0xf79c('0xf'));var as=require(_0xf79c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf79c('0x11'))(_0xf79c('0x12'));var utils=require(_0xf79c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf79c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b6b93,_0xcf7e3a){_0xcf7e3a=_0xcf7e3a||0xcc;return function(_0x2924df){if(_0x2924df){return _0x4b6b93['sendStatus'](_0xcf7e3a);}return _0x4b6b93['status'](_0xcf7e3a)[_0xf79c('0x15')]();};}function respondWithResult(_0x33f528,_0x3d1a87){_0x3d1a87=_0x3d1a87||0xc8;return function(_0x4160df){if(_0x4160df){return _0x33f528[_0xf79c('0x16')](_0x3d1a87)[_0xf79c('0x17')](_0x4160df);}};}function respondWithFilteredResult(_0x1b37a0,_0x547293){return function(_0x9ae966){if(_0x9ae966){var _0x3004c2=_0x9ae966[_0xf79c('0x18')],_0x4e0750=_0x547293['offset'],_0x4f6acb=_0x547293[_0xf79c('0x19')]+_0x547293[_0xf79c('0x1a')],_0x491472;if(_0x4f6acb>=_0x3004c2){_0x4f6acb=_0x3004c2;_0x491472=0xc8;}else{_0x491472=0xce;}_0x1b37a0['status'](_0x491472);return _0x1b37a0[_0xf79c('0x1b')]('Content-Range',_0x4e0750+'-'+_0x4f6acb+'/'+_0x3004c2)['json'](_0x9ae966);}return null;};}function patchUpdates(_0x4606d0){return function(_0x80c1c7){try{jsonpatch['apply'](_0x80c1c7,_0x4606d0,!![]);}catch(_0x1f08b0){return BPromise[_0xf79c('0x1c')](_0x1f08b0);}return _0x80c1c7['save']();};}function saveUpdates(_0x1b8def,_0x22ea61){return function(_0x183bc1){if(_0x183bc1){return _0x183bc1[_0xf79c('0x1d')](_0x1b8def)['then'](function(_0x4407b8){return _0x4407b8;});}return null;};}function removeEntity(_0x1047e2,_0x38e33a){return function(_0x111da5){if(_0x111da5){return _0x111da5[_0xf79c('0x1e')]()[_0xf79c('0x1f')](function(){_0x1047e2['status'](0xcc)[_0xf79c('0x15')]();});}};}function handleEntityNotFound(_0x408f6f,_0x5a164c){return function(_0x4cf7cf){if(!_0x4cf7cf){_0x408f6f['sendStatus'](0x194);}return _0x4cf7cf;};}function handleError(_0x1a3773,_0x1709db){_0x1709db=_0x1709db||0x1f4;return function(_0x33b35f){logger[_0xf79c('0x20')](_0x33b35f['stack']);if(_0x33b35f['name']){delete _0x33b35f[_0xf79c('0x21')];}_0x1a3773[_0xf79c('0x16')](_0x1709db)['send'](_0x33b35f);};}exports['index']=function(_0x1b3d9e,_0x542190){var _0x3f3e9d={},_0x1900a1={},_0x3de9c6={'count':0x0,'rows':[]};var _0x3f26f3=_['map'](db['VoiceAgentReport'][_0xf79c('0x22')],function(_0x1383db){return{'name':_0x1383db['fieldName'],'type':_0x1383db[_0xf79c('0x23')][_0xf79c('0x24')]};});_0x1900a1['model']=_[_0xf79c('0x25')](_0x3f26f3,_0xf79c('0x21'));_0x1900a1[_0xf79c('0x26')]=_['keys'](_0x1b3d9e['query']);_0x1900a1[_0xf79c('0x27')]=_[_0xf79c('0x28')](_0x1900a1[_0xf79c('0x29')],_0x1900a1[_0xf79c('0x26')]);_0x3f3e9d[_0xf79c('0x2a')]=_[_0xf79c('0x28')](_0x1900a1['model'],qs['fields'](_0x1b3d9e[_0xf79c('0x26')][_0xf79c('0x2b')]));_0x3f3e9d[_0xf79c('0x2a')]=_0x3f3e9d[_0xf79c('0x2a')][_0xf79c('0x2c')]?_0x3f3e9d[_0xf79c('0x2a')]:_0x1900a1['model'];if(!_0x1b3d9e[_0xf79c('0x26')][_0xf79c('0x2d')](_0xf79c('0x2e'))){_0x3f3e9d[_0xf79c('0x1a')]=qs[_0xf79c('0x1a')](_0x1b3d9e[_0xf79c('0x26')][_0xf79c('0x1a')]);_0x3f3e9d[_0xf79c('0x19')]=qs[_0xf79c('0x19')](_0x1b3d9e['query'][_0xf79c('0x19')]);}_0x3f3e9d[_0xf79c('0x2f')]=qs['sort'](_0x1b3d9e[_0xf79c('0x26')]['sort']);_0x3f3e9d[_0xf79c('0x30')]=qs[_0xf79c('0x27')](_['pick'](_0x1b3d9e[_0xf79c('0x26')],_0x1900a1[_0xf79c('0x27')]),_0x3f26f3);if(_0x1b3d9e[_0xf79c('0x26')]['filter']){_0x3f3e9d[_0xf79c('0x30')]=_[_0xf79c('0x31')](_0x3f3e9d['where'],{'$or':_[_0xf79c('0x25')](_0x3f26f3,function(_0x46c60e){if(_0x46c60e[_0xf79c('0x23')]!==_0xf79c('0x32')){var _0xda949d={};_0xda949d[_0x46c60e[_0xf79c('0x21')]]={'$like':'%'+_0x1b3d9e[_0xf79c('0x26')]['filter']+'%'};return _0xda949d;}})});}_0x3f3e9d=_['merge']({},_0x3f3e9d,_0x1b3d9e[_0xf79c('0x33')]);var _0x5a0355={'where':_0x3f3e9d[_0xf79c('0x30')]};return db[_0xf79c('0x34')]['count'](_0x5a0355)['then'](function(_0x3a2ba3){_0x3de9c6[_0xf79c('0x18')]=_0x3a2ba3;if(_0x1b3d9e[_0xf79c('0x26')]['includeAll']){_0x3f3e9d['include']=[{'all':!![]}];}return db[_0xf79c('0x34')][_0xf79c('0x35')](_0x3f3e9d);})[_0xf79c('0x1f')](function(_0x3cd27f){_0x3de9c6[_0xf79c('0x36')]=_0x3cd27f;return _0x3de9c6;})['then'](respondWithFilteredResult(_0x542190,_0x3f3e9d))[_0xf79c('0x37')](handleError(_0x542190,null));};exports[_0xf79c('0x38')]=function(_0x55bb86,_0x318bea){var _0x3014f5={'raw':![],'where':{'id':_0x55bb86[_0xf79c('0x39')]['id']}},_0x16d63d={};_0x16d63d[_0xf79c('0x29')]=_[_0xf79c('0x3a')](db[_0xf79c('0x34')][_0xf79c('0x22')]);_0x16d63d[_0xf79c('0x26')]=_[_0xf79c('0x3a')](_0x55bb86[_0xf79c('0x26')]);_0x16d63d['filters']=_[_0xf79c('0x28')](_0x16d63d['model'],_0x16d63d[_0xf79c('0x26')]);_0x3014f5['attributes']=_['intersection'](_0x16d63d['model'],qs[_0xf79c('0x2b')](_0x55bb86['query'][_0xf79c('0x2b')]));_0x3014f5[_0xf79c('0x2a')]=_0x3014f5['attributes'][_0xf79c('0x2c')]?_0x3014f5['attributes']:_0x16d63d[_0xf79c('0x29')];if(_0x55bb86[_0xf79c('0x26')][_0xf79c('0x3b')]){_0x3014f5[_0xf79c('0x3c')]=[{'all':!![]}];}_0x3014f5=_[_0xf79c('0x31')]({},_0x3014f5,_0x55bb86[_0xf79c('0x33')]);return db[_0xf79c('0x34')][_0xf79c('0x3d')](_0x3014f5)['then'](handleEntityNotFound(_0x318bea,null))[_0xf79c('0x1f')](respondWithResult(_0x318bea,null))['catch'](handleError(_0x318bea,null));};exports[_0xf79c('0x3e')]=function(_0x5c46a3,_0x58c2dd){return db[_0xf79c('0x34')][_0xf79c('0x3e')](_0x5c46a3[_0xf79c('0x3f')],{})[_0xf79c('0x1f')](respondWithResult(_0x58c2dd,0xc9))['catch'](handleError(_0x58c2dd,null));};exports['update']=function(_0x1a2e09,_0x337e5b){if(_0x1a2e09[_0xf79c('0x3f')]['id']){delete _0x1a2e09[_0xf79c('0x3f')]['id'];}return db['VoiceAgentReport'][_0xf79c('0x3d')]({'where':{'id':_0x1a2e09[_0xf79c('0x39')]['id']}})['then'](handleEntityNotFound(_0x337e5b,null))['then'](saveUpdates(_0x1a2e09['body'],null))['then'](respondWithResult(_0x337e5b,null))[_0xf79c('0x37')](handleError(_0x337e5b,null));};exports['destroy']=function(_0x297999,_0x266ee5){return db[_0xf79c('0x34')][_0xf79c('0x3d')]({'where':{'id':_0x297999[_0xf79c('0x39')]['id']}})['then'](handleEntityNotFound(_0x266ee5,null))['then'](removeEntity(_0x266ee5,null))[_0xf79c('0x37')](handleError(_0x266ee5,null));};exports['describe']=function(_0xcf476,_0x3e982b){return db[_0xf79c('0x34')][_0xf79c('0x40')]()['then'](respondWithResult(_0x3e982b,null))[_0xf79c('0x37')](handleError(_0x3e982b,null));}; \ No newline at end of file +var _0xd66d=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','include','rows','show','params','keys','options','find','catch','create','body','describe','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','apply','reject','save','update','then','destroy','error','name','send','index','map','VoiceAgentReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes'];(function(_0x5a7aea,_0x40eb3f){var _0x19237f=function(_0x3876f7){while(--_0x3876f7){_0x5a7aea['push'](_0x5a7aea['shift']());}};_0x19237f(++_0x40eb3f);}(_0xd66d,0x18f));var _0xdd66=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xd66d[_0x2d2c16];return _0x53f2fb;};'use strict';var pdf=require(_0xdd66('0x0'));var emlformat=require(_0xdd66('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdd66('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdd66('0x3'));var BPromise=require(_0xdd66('0x4'));var Mustache=require(_0xdd66('0x5'));var util=require(_0xdd66('0x6'));var path=require(_0xdd66('0x7'));var sox=require(_0xdd66('0x8'));var csv=require(_0xdd66('0x9'));var ejs=require(_0xdd66('0xa'));var fs=require('fs');var _=require(_0xdd66('0xb'));var squel=require('squel');var crypto=require(_0xdd66('0xc'));var jsforce=require(_0xdd66('0xd'));var deskjs=require(_0xdd66('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdd66('0xf'));var Papa=require(_0xdd66('0x10'));var Redis=require(_0xdd66('0x11'));var authService=require(_0xdd66('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdd66('0x13'));var hardwareService=require(_0xdd66('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xdd66('0x15'));var config=require(_0xdd66('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd66('0x17'))['db'];function respondWithStatusCode(_0x1c5f7c,_0x58e31a){_0x58e31a=_0x58e31a||0xcc;return function(_0x5e62a8){if(_0x5e62a8){return _0x1c5f7c[_0xdd66('0x18')](_0x58e31a);}return _0x1c5f7c['status'](_0x58e31a)[_0xdd66('0x19')]();};}function respondWithResult(_0x270798,_0x2d5224){_0x2d5224=_0x2d5224||0xc8;return function(_0x5d147d){if(_0x5d147d){return _0x270798[_0xdd66('0x1a')](_0x2d5224)[_0xdd66('0x1b')](_0x5d147d);}};}function respondWithFilteredResult(_0xf697bc,_0x5cffc3){return function(_0x25d227){if(_0x25d227){var _0x2a0839=_0x25d227['count'],_0x44a95b=_0x5cffc3[_0xdd66('0x1c')],_0x3754f4=_0x5cffc3['offset']+_0x5cffc3[_0xdd66('0x1d')],_0xc4d5c7;if(_0x3754f4>=_0x2a0839){_0x3754f4=_0x2a0839;_0xc4d5c7=0xc8;}else{_0xc4d5c7=0xce;}_0xf697bc[_0xdd66('0x1a')](_0xc4d5c7);return _0xf697bc['set']('Content-Range',_0x44a95b+'-'+_0x3754f4+'/'+_0x2a0839)[_0xdd66('0x1b')](_0x25d227);}return null;};}function patchUpdates(_0x35eeb8){return function(_0x1c7f70){try{jsonpatch[_0xdd66('0x1e')](_0x1c7f70,_0x35eeb8,!![]);}catch(_0x594024){return BPromise[_0xdd66('0x1f')](_0x594024);}return _0x1c7f70[_0xdd66('0x20')]();};}function saveUpdates(_0x5dd7a0,_0x25c66a){return function(_0x246e58){if(_0x246e58){return _0x246e58[_0xdd66('0x21')](_0x5dd7a0)[_0xdd66('0x22')](function(_0x2a2571){return _0x2a2571;});}return null;};}function removeEntity(_0x37323e,_0x1a905d){return function(_0x1bb8fd){if(_0x1bb8fd){return _0x1bb8fd[_0xdd66('0x23')]()['then'](function(){_0x37323e['status'](0xcc)[_0xdd66('0x19')]();});}};}function handleEntityNotFound(_0x348fb4,_0x3b621b){return function(_0x36d402){if(!_0x36d402){_0x348fb4['sendStatus'](0x194);}return _0x36d402;};}function handleError(_0x3d92a8,_0xfa723c){_0xfa723c=_0xfa723c||0x1f4;return function(_0x471125){logger[_0xdd66('0x24')](_0x471125['stack']);if(_0x471125['name']){delete _0x471125[_0xdd66('0x25')];}_0x3d92a8[_0xdd66('0x1a')](_0xfa723c)[_0xdd66('0x26')](_0x471125);};}exports[_0xdd66('0x27')]=function(_0x2d0931,_0x4088e5){var _0x2ddb88={},_0x434ea2={},_0x446dc6={'count':0x0,'rows':[]};var _0x4f2f5c=_[_0xdd66('0x28')](db[_0xdd66('0x29')][_0xdd66('0x2a')],function(_0x26f4b3){return{'name':_0x26f4b3[_0xdd66('0x2b')],'type':_0x26f4b3[_0xdd66('0x2c')][_0xdd66('0x2d')]};});_0x434ea2[_0xdd66('0x2e')]=_['map'](_0x4f2f5c,_0xdd66('0x25'));_0x434ea2['query']=_['keys'](_0x2d0931[_0xdd66('0x2f')]);_0x434ea2[_0xdd66('0x30')]=_[_0xdd66('0x31')](_0x434ea2[_0xdd66('0x2e')],_0x434ea2[_0xdd66('0x2f')]);_0x2ddb88[_0xdd66('0x32')]=_[_0xdd66('0x31')](_0x434ea2['model'],qs[_0xdd66('0x33')](_0x2d0931[_0xdd66('0x2f')][_0xdd66('0x33')]));_0x2ddb88[_0xdd66('0x32')]=_0x2ddb88[_0xdd66('0x32')][_0xdd66('0x34')]?_0x2ddb88[_0xdd66('0x32')]:_0x434ea2[_0xdd66('0x2e')];if(!_0x2d0931[_0xdd66('0x2f')][_0xdd66('0x35')](_0xdd66('0x36'))){_0x2ddb88[_0xdd66('0x1d')]=qs[_0xdd66('0x1d')](_0x2d0931[_0xdd66('0x2f')]['limit']);_0x2ddb88['offset']=qs[_0xdd66('0x1c')](_0x2d0931[_0xdd66('0x2f')][_0xdd66('0x1c')]);}_0x2ddb88[_0xdd66('0x37')]=qs[_0xdd66('0x38')](_0x2d0931[_0xdd66('0x2f')][_0xdd66('0x38')]);_0x2ddb88[_0xdd66('0x39')]=qs['filters'](_[_0xdd66('0x3a')](_0x2d0931[_0xdd66('0x2f')],_0x434ea2['filters']),_0x4f2f5c);if(_0x2d0931[_0xdd66('0x2f')][_0xdd66('0x3b')]){_0x2ddb88[_0xdd66('0x39')]=_['merge'](_0x2ddb88[_0xdd66('0x39')],{'$or':_[_0xdd66('0x28')](_0x4f2f5c,function(_0x43e6df){if(_0x43e6df[_0xdd66('0x2c')]!==_0xdd66('0x3c')){var _0x987d22={};_0x987d22[_0x43e6df[_0xdd66('0x25')]]={'$like':'%'+_0x2d0931[_0xdd66('0x2f')][_0xdd66('0x3b')]+'%'};return _0x987d22;}})});}_0x2ddb88=_[_0xdd66('0x3d')]({},_0x2ddb88,_0x2d0931['options']);var _0x20c805={'where':_0x2ddb88[_0xdd66('0x39')]};return db[_0xdd66('0x29')][_0xdd66('0x3e')](_0x20c805)[_0xdd66('0x22')](function(_0x1b07c5){_0x446dc6[_0xdd66('0x3e')]=_0x1b07c5;if(_0x2d0931['query'][_0xdd66('0x3f')]){_0x2ddb88[_0xdd66('0x40')]=[{'all':!![]}];}return db[_0xdd66('0x29')]['findAll'](_0x2ddb88);})[_0xdd66('0x22')](function(_0x532572){_0x446dc6[_0xdd66('0x41')]=_0x532572;return _0x446dc6;})[_0xdd66('0x22')](respondWithFilteredResult(_0x4088e5,_0x2ddb88))['catch'](handleError(_0x4088e5,null));};exports[_0xdd66('0x42')]=function(_0x3526c2,_0x52a680){var _0x4021ed={'raw':![],'where':{'id':_0x3526c2[_0xdd66('0x43')]['id']}},_0x4ed9d6={};_0x4ed9d6[_0xdd66('0x2e')]=_[_0xdd66('0x44')](db[_0xdd66('0x29')][_0xdd66('0x2a')]);_0x4ed9d6[_0xdd66('0x2f')]=_[_0xdd66('0x44')](_0x3526c2['query']);_0x4ed9d6[_0xdd66('0x30')]=_[_0xdd66('0x31')](_0x4ed9d6[_0xdd66('0x2e')],_0x4ed9d6[_0xdd66('0x2f')]);_0x4021ed[_0xdd66('0x32')]=_[_0xdd66('0x31')](_0x4ed9d6[_0xdd66('0x2e')],qs[_0xdd66('0x33')](_0x3526c2[_0xdd66('0x2f')][_0xdd66('0x33')]));_0x4021ed['attributes']=_0x4021ed[_0xdd66('0x32')]['length']?_0x4021ed[_0xdd66('0x32')]:_0x4ed9d6[_0xdd66('0x2e')];if(_0x3526c2['query'][_0xdd66('0x3f')]){_0x4021ed[_0xdd66('0x40')]=[{'all':!![]}];}_0x4021ed=_['merge']({},_0x4021ed,_0x3526c2[_0xdd66('0x45')]);return db['VoiceAgentReport'][_0xdd66('0x46')](_0x4021ed)[_0xdd66('0x22')](handleEntityNotFound(_0x52a680,null))['then'](respondWithResult(_0x52a680,null))[_0xdd66('0x47')](handleError(_0x52a680,null));};exports[_0xdd66('0x48')]=function(_0x5c97d8,_0x3b0cd6){return db[_0xdd66('0x29')][_0xdd66('0x48')](_0x5c97d8[_0xdd66('0x49')],{})[_0xdd66('0x22')](respondWithResult(_0x3b0cd6,0xc9))[_0xdd66('0x47')](handleError(_0x3b0cd6,null));};exports[_0xdd66('0x21')]=function(_0x100011,_0x6581bd){if(_0x100011['body']['id']){delete _0x100011['body']['id'];}return db[_0xdd66('0x29')][_0xdd66('0x46')]({'where':{'id':_0x100011[_0xdd66('0x43')]['id']}})[_0xdd66('0x22')](handleEntityNotFound(_0x6581bd,null))[_0xdd66('0x22')](saveUpdates(_0x100011['body'],null))['then'](respondWithResult(_0x6581bd,null))[_0xdd66('0x47')](handleError(_0x6581bd,null));};exports[_0xdd66('0x23')]=function(_0xa1df31,_0xe19e00){return db[_0xdd66('0x29')][_0xdd66('0x46')]({'where':{'id':_0xa1df31['params']['id']}})['then'](handleEntityNotFound(_0xe19e00,null))['then'](removeEntity(_0xe19e00,null))[_0xdd66('0x47')](handleError(_0xe19e00,null));};exports[_0xdd66('0x4a')]=function(_0x2f2cb9,_0x2a0ac2){return db['VoiceAgentReport'][_0xdd66('0x4a')]()[_0xdd66('0x22')](respondWithResult(_0x2a0ac2,null))[_0xdd66('0x47')](handleError(_0x2a0ac2,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 6542960..10b8fa8 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 _0xf3b1=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport','uniqueid','lodash'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xf3b1,0x137));var _0x1f3b=function(_0x46db10,_0x291253){_0x46db10=_0x46db10-0x0;var _0x5253f3=_0xf3b1[_0x46db10];return _0x5253f3;};'use strict';var _=require(_0x1f3b('0x0'));var util=require(_0x1f3b('0x1'));var logger=require(_0x1f3b('0x2'))(_0x1f3b('0x3'));var moment=require(_0x1f3b('0x4'));var BPromise=require('bluebird');var rp=require(_0x1f3b('0x5'));var fs=require('fs');var path=require(_0x1f3b('0x6'));var rimraf=require(_0x1f3b('0x7'));var config=require(_0x1f3b('0x8'));var attributes=require(_0x1f3b('0x9'));module['exports']=function(_0x5f0f80,_0x1c2f19){return _0x5f0f80[_0x1f3b('0xa')](_0x1f3b('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x1f3b('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfc38=['path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','destuniqueid','util','api','moment','bluebird'];(function(_0x412fd7,_0x8c1287){var _0x2077fd=function(_0x425811){while(--_0x425811){_0x412fd7['push'](_0x412fd7['shift']());}};_0x2077fd(++_0x8c1287);}(_0xfc38,0x98));var _0x8fc3=function(_0x375cb5,_0x4a06a0){_0x375cb5=_0x375cb5-0x0;var _0x49ad42=_0xfc38[_0x375cb5];return _0x49ad42;};'use strict';var _=require('lodash');var util=require(_0x8fc3('0x0'));var logger=require('../../config/logger')(_0x8fc3('0x1'));var moment=require(_0x8fc3('0x2'));var BPromise=require(_0x8fc3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8fc3('0x4'));var rimraf=require(_0x8fc3('0x5'));var config=require(_0x8fc3('0x6'));var attributes=require(_0x8fc3('0x7'));module[_0x8fc3('0x8')]=function(_0x4cdb8c,_0x5e0f12){return _0x4cdb8c[_0x8fc3('0x9')]('VoiceAgentReport',attributes,{'tableName':_0x8fc3('0xa'),'paranoid':![],'indexes':[{'fields':[_0x8fc3('0xb'),_0x8fc3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 3cdfdbf..882a388 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 _0xc107=['update','where','attributes','limit','UpdateVoiceAgentReport','debug','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc107,0x19e));var _0x7c10=function(_0x34bb7b,_0x21efb6){_0x34bb7b=_0x34bb7b-0x0;var _0x1432a2=_0xc107[_0x34bb7b];return _0x1432a2;};'use strict';var _=require('lodash');var util=require(_0x7c10('0x0'));var moment=require('moment');var BPromise=require(_0x7c10('0x1'));var rs=require(_0x7c10('0x2'));var fs=require('fs');var Redis=require(_0x7c10('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7c10('0x4'));var logger=require(_0x7c10('0x5'))(_0x7c10('0x6'));var config=require(_0x7c10('0x7'));var jayson=require(_0x7c10('0x8'));var client=jayson[_0x7c10('0x9')][_0x7c10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46ba19,_0x787f69,_0x23ff28){return new BPromise(function(_0x5d535a,_0x256ae1){return client[_0x7c10('0xb')](_0x46ba19,_0x23ff28)[_0x7c10('0xc')](function(_0x529d2d){logger[_0x7c10('0xd')](_0x7c10('0xe'),_0x787f69,'request\x20sent');logger['debug'](_0x7c10('0xf'),_0x787f69,'request\x20sent',JSON[_0x7c10('0x10')](_0x529d2d));if(_0x529d2d[_0x7c10('0x11')]){if(_0x529d2d['error'][_0x7c10('0x12')]===0x1f4){logger['error'](_0x7c10('0xe'),_0x787f69,_0x529d2d['error'][_0x7c10('0x13')]);return _0x256ae1(_0x529d2d[_0x7c10('0x11')][_0x7c10('0x13')]);}logger[_0x7c10('0x11')](_0x7c10('0xe'),_0x787f69,_0x529d2d[_0x7c10('0x11')][_0x7c10('0x13')]);return _0x5d535a(_0x529d2d['error'][_0x7c10('0x13')]);}else{logger[_0x7c10('0xd')](_0x7c10('0xe'),_0x787f69,_0x7c10('0x14'));_0x5d535a(_0x529d2d['result']['message']);}})[_0x7c10('0x15')](function(_0x22b1b6){logger[_0x7c10('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x787f69,_0x22b1b6);_0x256ae1(_0x22b1b6);});});}exports[_0x7c10('0x16')]=function(_0x25bcce){var _0x3c60b7=this;return new Promise(function(_0xc12dec,_0x3377fe){return db[_0x7c10('0x17')][_0x7c10('0x18')](_0x25bcce[_0x7c10('0x19')],{'raw':_0x25bcce[_0x7c10('0x1a')]?_0x25bcce[_0x7c10('0x1a')][_0x7c10('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3335b0){logger[_0x7c10('0xd')](_0x7c10('0x16'),_0x25bcce);logger['debug'](_0x7c10('0x16'),_0x25bcce,JSON['stringify'](_0x3335b0));_0xc12dec(_0x3335b0);})[_0x7c10('0x15')](function(_0x2c0269){logger['error'](_0x7c10('0x16'),_0x2c0269['message'],_0x25bcce);_0x3377fe(_0x3c60b7['error'](0x1f4,_0x2c0269[_0x7c10('0x13')]));});});};exports['UpdateVoiceAgentReport']=function(_0x3327e4){var _0x8dad61=this;return new Promise(function(_0x277b32,_0x31d444){return db['VoiceAgentReport'][_0x7c10('0x1c')](_0x3327e4['body'],{'raw':_0x3327e4[_0x7c10('0x1a')]?_0x3327e4[_0x7c10('0x1a')][_0x7c10('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3327e4['options']?_0x3327e4[_0x7c10('0x1a')][_0x7c10('0x1d')]||null:null,'attributes':_0x3327e4[_0x7c10('0x1a')]?_0x3327e4[_0x7c10('0x1a')][_0x7c10('0x1e')]||null:null,'limit':_0x3327e4[_0x7c10('0x1a')]?_0x3327e4['options'][_0x7c10('0x1f')]||null:null})['then'](function(_0x52d5f9){logger[_0x7c10('0xd')](_0x7c10('0x20'),_0x3327e4);logger[_0x7c10('0x21')](_0x7c10('0x20'),_0x3327e4,JSON['stringify'](_0x52d5f9));_0x277b32(_0x52d5f9);})[_0x7c10('0x15')](function(_0x203e83){logger['error'](_0x7c10('0x20'),_0x203e83['message'],_0x3327e4);_0x31d444(_0x8dad61[_0x7c10('0x11')](0x1f4,_0x203e83[_0x7c10('0x13')]));});});}; \ No newline at end of file +var _0x03be=['info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateVoiceAgentReport','create','body','options','raw','catch','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x16f6e4,_0x288b61){var _0x275354=function(_0x43865e){while(--_0x43865e){_0x16f6e4['push'](_0x16f6e4['shift']());}};_0x275354(++_0x288b61);}(_0x03be,0x150));var _0xe03b=function(_0x291436,_0x9dd541){_0x291436=_0x291436-0x0;var _0x3fa0fa=_0x03be[_0x291436];return _0x3fa0fa;};'use strict';var _=require(_0xe03b('0x0'));var util=require(_0xe03b('0x1'));var moment=require(_0xe03b('0x2'));var BPromise=require(_0xe03b('0x3'));var rs=require(_0xe03b('0x4'));var fs=require('fs');var Redis=require(_0xe03b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe03b('0x6'));var logger=require(_0xe03b('0x7'))(_0xe03b('0x8'));var config=require(_0xe03b('0x9'));var jayson=require(_0xe03b('0xa'));var client=jayson[_0xe03b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d4381,_0x1f5713,_0x3dffb3){return new BPromise(function(_0x165d97,_0x2baa38){return client[_0xe03b('0xc')](_0x3d4381,_0x3dffb3)[_0xe03b('0xd')](function(_0x2810b4){logger[_0xe03b('0xe')](_0xe03b('0xf'),_0x1f5713,_0xe03b('0x10'));logger[_0xe03b('0x11')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x1f5713,_0xe03b('0x10'),JSON[_0xe03b('0x12')](_0x2810b4));if(_0x2810b4[_0xe03b('0x13')]){if(_0x2810b4[_0xe03b('0x13')][_0xe03b('0x14')]===0x1f4){logger['error'](_0xe03b('0xf'),_0x1f5713,_0x2810b4[_0xe03b('0x13')]['message']);return _0x2baa38(_0x2810b4[_0xe03b('0x13')][_0xe03b('0x15')]);}logger[_0xe03b('0x13')](_0xe03b('0xf'),_0x1f5713,_0x2810b4['error'][_0xe03b('0x15')]);return _0x165d97(_0x2810b4['error'][_0xe03b('0x15')]);}else{logger[_0xe03b('0xe')](_0xe03b('0xf'),_0x1f5713,'request\x20sent');_0x165d97(_0x2810b4[_0xe03b('0x16')][_0xe03b('0x15')]);}})['catch'](function(_0x179918){logger[_0xe03b('0x13')](_0xe03b('0xf'),_0x1f5713,_0x179918);_0x2baa38(_0x179918);});});}exports[_0xe03b('0x17')]=function(_0xaf5f4b){var _0x32ca9c=this;return new Promise(function(_0x132684,_0x2b698b){return db['VoiceAgentReport'][_0xe03b('0x18')](_0xaf5f4b[_0xe03b('0x19')],{'raw':_0xaf5f4b[_0xe03b('0x1a')]?_0xaf5f4b[_0xe03b('0x1a')][_0xe03b('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x7e59cd){logger[_0xe03b('0xe')]('CreateVoiceAgentReport',_0xaf5f4b);logger[_0xe03b('0x11')](_0xe03b('0x17'),_0xaf5f4b,JSON[_0xe03b('0x12')](_0x7e59cd));_0x132684(_0x7e59cd);})[_0xe03b('0x1c')](function(_0x4287cf){logger['error']('CreateVoiceAgentReport',_0x4287cf[_0xe03b('0x15')],_0xaf5f4b);_0x2b698b(_0x32ca9c[_0xe03b('0x13')](0x1f4,_0x4287cf[_0xe03b('0x15')]));});});};exports[_0xe03b('0x1d')]=function(_0x12e9fc){var _0x5e0a51=this;return new Promise(function(_0x43d425,_0x446a64){return db[_0xe03b('0x1e')][_0xe03b('0x1f')](_0x12e9fc['body'],{'raw':_0x12e9fc[_0xe03b('0x1a')]?_0x12e9fc[_0xe03b('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12e9fc[_0xe03b('0x1a')]?_0x12e9fc[_0xe03b('0x1a')][_0xe03b('0x20')]||null:null,'attributes':_0x12e9fc[_0xe03b('0x1a')]?_0x12e9fc[_0xe03b('0x1a')][_0xe03b('0x21')]||null:null,'limit':_0x12e9fc[_0xe03b('0x1a')]?_0x12e9fc['options'][_0xe03b('0x22')]||null:null})['then'](function(_0x45d78d){logger[_0xe03b('0xe')](_0xe03b('0x1d'),_0x12e9fc);logger['debug'](_0xe03b('0x1d'),_0x12e9fc,JSON[_0xe03b('0x12')](_0x45d78d));_0x43d425(_0x45d78d);})['catch'](function(_0x47295c){logger[_0xe03b('0x13')](_0xe03b('0x1d'),_0x47295c[_0xe03b('0x15')],_0x12e9fc);_0x446a64(_0x5e0a51[_0xe03b('0x13')](0x1f4,_0x47295c[_0xe03b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index fc5eef5..76fe4c0 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 _0x5a2f=['update','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put'];(function(_0x42511a,_0x1571e1){var _0x5c8adb=function(_0x210083){while(--_0x210083){_0x42511a['push'](_0x42511a['shift']());}};_0x5c8adb(++_0x1571e1);}(_0x5a2f,0x17f));var _0xf5a2=function(_0x38366c,_0x277bcc){_0x38366c=_0x38366c-0x0;var _0x2566b2=_0x5a2f[_0x38366c];return _0x2566b2;};'use strict';var multer=require(_0xf5a2('0x0'));var util=require('util');var path=require(_0xf5a2('0x1'));var timeout=require('connect-timeout');var express=require(_0xf5a2('0x2'));var router=express[_0xf5a2('0x3')]();var auth=require(_0xf5a2('0x4'));var interaction=require(_0xf5a2('0x5'));var config=require(_0xf5a2('0x6'));var controller=require(_0xf5a2('0x7'));router['get']('/',auth[_0xf5a2('0x8')](),controller[_0xf5a2('0x9')]);router[_0xf5a2('0xa')](_0xf5a2('0xb'),auth['isAuthenticated'](),controller[_0xf5a2('0xc')]);router[_0xf5a2('0xa')](_0xf5a2('0xd'),auth['isAuthenticated'](),controller[_0xf5a2('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf5a2('0xf')]);router[_0xf5a2('0x10')](_0xf5a2('0xd'),auth[_0xf5a2('0x8')](),controller[_0xf5a2('0x11')]);router[_0xf5a2('0x12')](_0xf5a2('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xf5a2('0x13')]=router; \ No newline at end of file +var _0xb9e4=['../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','update','delete','/:id','destroy','path','connect-timeout','Router'];(function(_0x3507b5,_0x1ee543){var _0x2ab7f8=function(_0x1024a7){while(--_0x1024a7){_0x3507b5['push'](_0x3507b5['shift']());}};_0x2ab7f8(++_0x1ee543);}(_0xb9e4,0x141));var _0x4b9e=function(_0x3a96c5,_0xf7eee3){_0x3a96c5=_0x3a96c5-0x0;var _0x42da29=_0xb9e4[_0x3a96c5];return _0x42da29;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4b9e('0x0'));var timeout=require(_0x4b9e('0x1'));var express=require('express');var router=express[_0x4b9e('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x4b9e('0x3'));var config=require(_0x4b9e('0x4'));var controller=require(_0x4b9e('0x5'));router['get']('/',auth[_0x4b9e('0x6')](),controller[_0x4b9e('0x7')]);router[_0x4b9e('0x8')](_0x4b9e('0x9'),auth['isAuthenticated'](),controller[_0x4b9e('0xa')]);router[_0x4b9e('0x8')]('/:id',auth[_0x4b9e('0x6')](),controller[_0x4b9e('0xb')]);router[_0x4b9e('0xc')]('/',auth[_0x4b9e('0x6')](),controller[_0x4b9e('0xd')]);router['put']('/:id',auth[_0x4b9e('0x6')](),controller[_0x4b9e('0xe')]);router[_0x4b9e('0xf')](_0x4b9e('0x10'),auth['isAuthenticated'](),controller[_0x4b9e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 8b79f1a..c833cc1 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 _0x326f=['sequelize','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','STRING','DATE','INTEGER'];(function(_0xc95857,_0x376912){var _0x5d00a4=function(_0x41cc21){while(--_0x41cc21){_0xc95857['push'](_0xc95857['shift']());}};_0x5d00a4(++_0x376912);}(_0x326f,0xd1));var _0xf326=function(_0x53ef91,_0x336e61){_0x53ef91=_0x53ef91-0x0;var _0x5ee4d2=_0x326f[_0x53ef91];return _0x5ee4d2;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf326('0x1')](_0xf326('0x2'),_0xf326('0x3'),_0xf326('0x4'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x7'))},'tag':{'type':Sequelize[_0xf326('0x8')]},'accountcode':{'type':Sequelize[_0xf326('0x8')]},'source':{'type':Sequelize[_0xf326('0x8')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xf326('0x8')]},'callerid':{'type':Sequelize[_0xf326('0x8')]},'channel':{'type':Sequelize[_0xf326('0x8')]},'destinationchannel':{'type':Sequelize[_0xf326('0x8')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xf326('0x9')]},'answertime':{'type':Sequelize[_0xf326('0x9')]},'endtime':{'type':Sequelize[_0xf326('0x9')]},'duration':{'type':Sequelize[_0xf326('0xa')]},'billableseconds':{'type':Sequelize[_0xf326('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf326('0x8')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xf326('0x8')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xf326('0x8')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf326('0x8')]},'prefix':{'type':Sequelize[_0xf326('0x8')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xf326('0x8')]}}; \ No newline at end of file +var _0xf873=['ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','exports','STRING'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xf873,0xb2));var _0x3f87=function(_0x82b8a7,_0x4f6afe){_0x82b8a7=_0x82b8a7-0x0;var _0x293fe4=_0xf873[_0x82b8a7];return _0x293fe4;};'use strict';var Sequelize=require('sequelize');module[_0x3f87('0x0')]={'uniqueid':{'type':Sequelize[_0x3f87('0x1')]},'type':{'type':Sequelize[_0x3f87('0x2')](_0x3f87('0x3'),_0x3f87('0x4'),_0x3f87('0x5'),_0x3f87('0x6'),_0x3f87('0x7'),_0x3f87('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3f87('0x1')]},'source':{'type':Sequelize[_0x3f87('0x1')]},'destination':{'type':Sequelize[_0x3f87('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x3f87('0x1')]},'channel':{'type':Sequelize[_0x3f87('0x1')]},'destinationchannel':{'type':Sequelize[_0x3f87('0x1')]},'lastapplication':{'type':Sequelize[_0x3f87('0x1')]},'lastdata':{'type':Sequelize[_0x3f87('0x9')]},'starttime':{'type':Sequelize[_0x3f87('0xa')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x3f87('0xa')]},'endtime':{'type':Sequelize[_0x3f87('0xa')]},'duration':{'type':Sequelize[_0x3f87('0xb')]},'billableseconds':{'type':Sequelize[_0x3f87('0xb')]},'mohtime':{'type':Sequelize[_0x3f87('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3f87('0x1')]},'amaflags':{'type':Sequelize[_0x3f87('0x1')]},'userfield':{'type':Sequelize[_0x3f87('0x1')]},'userDisposition':{'type':Sequelize[_0x3f87('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x3f87('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x3f87('0x1')]},'note':{'type':Sequelize[_0x3f87('0x1')]},'prefix':{'type':Sequelize[_0x3f87('0x1')]},'routeid':{'type':Sequelize[_0x3f87('0xb')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 644672a..fe3bb5a 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 _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'attributes':['id',_0x0a9e('0x23'),_0x0a9e('0x3b'),'alias'],'model':db['User'],'as':_0x0a9e('0x3c')}];}return db[_0x0a9e('0x26')]['findAll'](_0x45a1e7);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x1dc186[_0x0a9e('0x3d')]=_0x1dec2e;return _0x1dc186;})['then'](respondWithFilteredResult(_0x479bc4,_0x45a1e7))[_0x0a9e('0x3e')](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3f')]=function(_0x274e8e,_0x43dd5b){var _0x13cb1f={'raw':!![],'where':{'id':_0x274e8e[_0x0a9e('0x40')]['id']}},_0xeaa5e5={};_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x41')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0xeaa5e5[_0x0a9e('0x2b')]=_[_0x0a9e('0x41')](_0x274e8e[_0x0a9e('0x2b')]);_0xeaa5e5[_0x0a9e('0x2c')]=_['intersection'](_0xeaa5e5['model'],_0xeaa5e5[_0x0a9e('0x2b')]);_0x13cb1f[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xeaa5e5[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x274e8e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x13cb1f[_0x0a9e('0x2e')]=_0x13cb1f[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x13cb1f[_0x0a9e('0x2e')]:_0xeaa5e5[_0x0a9e('0x2a')];if(_0x274e8e['query'][_0x0a9e('0x39')]){_0x13cb1f[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x13cb1f=_[_0x0a9e('0x37')]({},_0x13cb1f,_0x274e8e[_0x0a9e('0x42')]);return db[_0x0a9e('0x26')][_0x0a9e('0x43')](_0x13cb1f)[_0x0a9e('0x22')](handleEntityNotFound(_0x43dd5b,null))[_0x0a9e('0x22')](respondWithResult(_0x43dd5b,null))['catch'](handleError(_0x43dd5b,null));};exports[_0x0a9e('0x44')]=function(_0x48fd45,_0x473dc8){return db[_0x0a9e('0x26')][_0x0a9e('0x44')](_0x48fd45['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x473dc8,0xc9))[_0x0a9e('0x3e')](handleError(_0x473dc8,null));};exports[_0x0a9e('0x21')]=function(_0x34aa5a,_0x45c845){return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'id':_0x34aa5a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45c845,null))[_0x0a9e('0x22')](removeEntity(_0x45c845,null))[_0x0a9e('0x3e')](handleError(_0x45c845,null));};exports[_0x0a9e('0x45')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x26')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x992c77,null))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x20')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']['uniqueid']){delete _0x3fe430[_0x0a9e('0x46')][_0x0a9e('0x47')];}return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'uniqueid':_0x3fe430[_0x0a9e('0x40')]['id'],'UserId':{'$or':[null,_0x3fe430[_0x0a9e('0x48')]['id']]}}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](saveUpdates(_0x3fe430['body'],null))['then'](respondWithResult(_0x4f7240,null))['catch'](handleError(_0x4f7240,null));}; \ No newline at end of file +var _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'attributes':['id',_0x0a9e('0x23'),_0x0a9e('0x3b'),'alias'],'model':db['User'],'as':_0x0a9e('0x3c')}];}return db[_0x0a9e('0x26')]['findAll'](_0x45a1e7);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x1dc186[_0x0a9e('0x3d')]=_0x1dec2e;return _0x1dc186;})['then'](respondWithFilteredResult(_0x479bc4,_0x45a1e7))[_0x0a9e('0x3e')](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3f')]=function(_0x274e8e,_0x43dd5b){var _0x13cb1f={'raw':!![],'where':{'id':_0x274e8e[_0x0a9e('0x40')]['id']}},_0xeaa5e5={};_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x41')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0xeaa5e5[_0x0a9e('0x2b')]=_[_0x0a9e('0x41')](_0x274e8e[_0x0a9e('0x2b')]);_0xeaa5e5[_0x0a9e('0x2c')]=_['intersection'](_0xeaa5e5['model'],_0xeaa5e5[_0x0a9e('0x2b')]);_0x13cb1f[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xeaa5e5[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x274e8e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x13cb1f[_0x0a9e('0x2e')]=_0x13cb1f[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x13cb1f[_0x0a9e('0x2e')]:_0xeaa5e5[_0x0a9e('0x2a')];if(_0x274e8e['query'][_0x0a9e('0x39')]){_0x13cb1f[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x13cb1f=_[_0x0a9e('0x37')]({},_0x13cb1f,_0x274e8e[_0x0a9e('0x42')]);return db[_0x0a9e('0x26')][_0x0a9e('0x43')](_0x13cb1f)[_0x0a9e('0x22')](handleEntityNotFound(_0x43dd5b,null))[_0x0a9e('0x22')](respondWithResult(_0x43dd5b,null))['catch'](handleError(_0x43dd5b,null));};exports[_0x0a9e('0x44')]=function(_0x48fd45,_0x473dc8){return db[_0x0a9e('0x26')][_0x0a9e('0x44')](_0x48fd45['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x473dc8,0xc9))[_0x0a9e('0x3e')](handleError(_0x473dc8,null));};exports[_0x0a9e('0x21')]=function(_0x34aa5a,_0x45c845){return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'id':_0x34aa5a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45c845,null))[_0x0a9e('0x22')](removeEntity(_0x45c845,null))[_0x0a9e('0x3e')](handleError(_0x45c845,null));};exports[_0x0a9e('0x45')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x26')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x992c77,null))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x20')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']['uniqueid']){delete _0x3fe430[_0x0a9e('0x46')][_0x0a9e('0x47')];}return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'uniqueid':_0x3fe430[_0x0a9e('0x40')]['id'],'UserId':{'$or':[null,_0x3fe430[_0x0a9e('0x48')]['id']]}}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](saveUpdates(_0x3fe430['body'],null))['then'](respondWithResult(_0x4f7240,null))['catch'](handleError(_0x4f7240,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 0c9050c..67516fa 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 _0xc472=['report_call','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','define','VoiceCallReport'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xc472,0x19b));var _0x2c47=function(_0x11ce46,_0x7a1715){_0x11ce46=_0x11ce46-0x0;var _0x272001=_0xc472[_0x11ce46];return _0x272001;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2c47('0x0'))('api');var moment=require(_0x2c47('0x1'));var BPromise=require(_0x2c47('0x2'));var rp=require(_0x2c47('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c47('0x4'));var config=require(_0x2c47('0x5'));var attributes=require(_0x2c47('0x6'));module['exports']=function(_0x50c017,_0x5d60f3){return _0x50c017[_0x2c47('0x7')](_0x2c47('0x8'),attributes,{'tableName':_0x2c47('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e78=['../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xb39c1e,_0x625d47){var _0x13e257=function(_0x350580){while(--_0x350580){_0xb39c1e['push'](_0xb39c1e['shift']());}};_0x13e257(++_0x625d47);}(_0x0e78,0x1f4));var _0x80e7=function(_0x1cbcdf,_0x237b40){_0x1cbcdf=_0x1cbcdf-0x0;var _0x513b1f=_0x0e78[_0x1cbcdf];return _0x513b1f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x80e7('0x0'))(_0x80e7('0x1'));var moment=require(_0x80e7('0x2'));var BPromise=require(_0x80e7('0x3'));var rp=require(_0x80e7('0x4'));var fs=require('fs');var path=require(_0x80e7('0x5'));var rimraf=require(_0x80e7('0x6'));var config=require(_0x80e7('0x7'));var attributes=require(_0x80e7('0x8'));module[_0x80e7('0x9')]=function(_0x4d4b35,_0x57d7b1){return _0x4d4b35[_0x80e7('0xa')](_0x80e7('0xb'),attributes,{'tableName':_0x80e7('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 69876e3..425a1ef 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 _0x6180=['then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','include','model','attributes','map','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request'];(function(_0x1fccb7,_0x4e5b63){var _0x106e9b=function(_0x326d1d){while(--_0x326d1d){_0x1fccb7['push'](_0x1fccb7['shift']());}};_0x106e9b(++_0x4e5b63);}(_0x6180,0x125));var _0x0618=function(_0xa6e9fa,_0x33372a){_0xa6e9fa=_0xa6e9fa-0x0;var _0x44592c=_0x6180[_0xa6e9fa];return _0x44592c;};'use strict';var _=require('lodash');var util=require(_0x0618('0x0'));var moment=require(_0x0618('0x1'));var BPromise=require(_0x0618('0x2'));var rs=require(_0x0618('0x3'));var fs=require('fs');var Redis=require(_0x0618('0x4'));var db=require(_0x0618('0x5'))['db'];var utils=require(_0x0618('0x6'));var logger=require(_0x0618('0x7'))('rpc');var config=require(_0x0618('0x8'));var jayson=require(_0x0618('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x343907,_0x4786cf,_0x3bd7f6){return new BPromise(function(_0x3e021f,_0x65358d){return client[_0x0618('0xa')](_0x343907,_0x3bd7f6)[_0x0618('0xb')](function(_0x12781d){logger[_0x0618('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x4786cf,_0x0618('0xd'));logger[_0x0618('0xe')](_0x0618('0xf'),_0x4786cf,_0x0618('0xd'),JSON[_0x0618('0x10')](_0x12781d));if(_0x12781d[_0x0618('0x11')]){if(_0x12781d[_0x0618('0x11')][_0x0618('0x12')]===0x1f4){logger[_0x0618('0x11')](_0x0618('0x13'),_0x4786cf,_0x12781d[_0x0618('0x11')]['message']);return _0x65358d(_0x12781d['error'][_0x0618('0x14')]);}logger[_0x0618('0x11')](_0x0618('0x13'),_0x4786cf,_0x12781d[_0x0618('0x11')][_0x0618('0x14')]);return _0x3e021f(_0x12781d[_0x0618('0x11')][_0x0618('0x14')]);}else{logger[_0x0618('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x4786cf,_0x0618('0xd'));_0x3e021f(_0x12781d[_0x0618('0x15')][_0x0618('0x14')]);}})[_0x0618('0x16')](function(_0x1694ab){logger[_0x0618('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x4786cf,_0x1694ab);_0x65358d(_0x1694ab);});});}exports[_0x0618('0x17')]=function(_0x2a5570){var _0x572e10=this;return new Promise(function(_0x348431,_0x3bf16a){return db[_0x0618('0x18')][_0x0618('0x19')]({'raw':_0x2a5570[_0x0618('0x1a')]?_0x2a5570[_0x0618('0x1a')][_0x0618('0x1b')]===undefined?!![]:![]:!![],'where':_0x2a5570[_0x0618('0x1a')]?_0x2a5570['options']['where']||null:null,'attributes':_0x2a5570[_0x0618('0x1a')]?_0x2a5570['options']['attributes']||null:null,'limit':_0x2a5570[_0x0618('0x1a')]?_0x2a5570['options']['limit']||null:null,'include':_0x2a5570[_0x0618('0x1a')]?_0x2a5570[_0x0618('0x1a')]['include']?_['map'](_0x2a5570['options'][_0x0618('0x1c')],function(_0x149348){return{'model':db[_0x149348[_0x0618('0x1d')]],'as':_0x149348['as'],'attributes':_0x149348['attributes'],'include':_0x149348[_0x0618('0x1c')]?_['map'](_0x149348[_0x0618('0x1c')],function(_0x2801aa){return{'model':db[_0x2801aa[_0x0618('0x1d')]],'as':_0x2801aa['as'],'attributes':_0x2801aa[_0x0618('0x1e')],'include':_0x2801aa[_0x0618('0x1c')]?_[_0x0618('0x1f')](_0x2801aa[_0x0618('0x1c')],function(_0x56b614){return{'model':db[_0x56b614[_0x0618('0x1d')]],'as':_0x56b614['as'],'attributes':_0x56b614[_0x0618('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0618('0xb')](function(_0x374618){logger['info'](_0x0618('0x17'),_0x2a5570);logger['debug'](_0x0618('0x17'),_0x2a5570,JSON[_0x0618('0x10')](_0x374618));_0x348431(_0x374618);})[_0x0618('0x16')](function(_0xc1fea5){logger[_0x0618('0x11')](_0x0618('0x17'),_0xc1fea5[_0x0618('0x14')],_0x2a5570);_0x3bf16a(_0x572e10[_0x0618('0x11')](0x1f4,_0xc1fea5[_0x0618('0x14')]));});});};exports[_0x0618('0x20')]=function(_0x2bd2a0){var _0x18c21c=this;return new Promise(function(_0x7d9129,_0x4af29c){return db[_0x0618('0x18')][_0x0618('0x21')](_0x2bd2a0[_0x0618('0x22')],{'raw':_0x2bd2a0['options']?_0x2bd2a0[_0x0618('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x0618('0xb')](function(_0x520305){logger['info'](_0x0618('0x20'),_0x2bd2a0);logger['debug'](_0x0618('0x20'),_0x2bd2a0,JSON[_0x0618('0x10')](_0x520305));_0x7d9129(_0x520305);})['catch'](function(_0x8b966d){logger[_0x0618('0x11')](_0x0618('0x20'),_0x8b966d[_0x0618('0x14')],_0x2bd2a0);_0x4af29c(_0x18c21c[_0x0618('0x11')](0x1f4,_0x8b966d['message']));});});};exports[_0x0618('0x23')]=function(_0x1a4260){var _0x35f6a6=this;return new Promise(function(_0x4ffbe1,_0x3d7792){return db[_0x0618('0x18')][_0x0618('0x24')](_0x1a4260['body'],{'raw':_0x1a4260[_0x0618('0x1a')]?_0x1a4260[_0x0618('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a4260['options']?_0x1a4260[_0x0618('0x1a')][_0x0618('0x25')]||null:null,'attributes':_0x1a4260[_0x0618('0x1a')]?_0x1a4260[_0x0618('0x1a')][_0x0618('0x1e')]||null:null,'limit':_0x1a4260[_0x0618('0x1a')]?_0x1a4260[_0x0618('0x1a')]['limit']||null:null})[_0x0618('0xb')](function(_0x1ec0de){logger[_0x0618('0xc')](_0x0618('0x23'),_0x1a4260);logger[_0x0618('0xe')]('UpdateVoiceCallReport',_0x1a4260,JSON[_0x0618('0x10')](_0x1ec0de));_0x4ffbe1(_0x1ec0de);})[_0x0618('0x16')](function(_0x50475f){logger[_0x0618('0x11')](_0x0618('0x23'),_0x50475f[_0x0618('0x14')],_0x1a4260);_0x3d7792(_0x35f6a6[_0x0618('0x11')](0x1f4,_0x50475f[_0x0618('0x14')]));});});}; \ No newline at end of file +var _0xa2e3=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','stringify','CreateVoiceCallReport','create','body','update','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x2da402,_0x14a691){var _0x31a57d=function(_0x3cfb60){while(--_0x3cfb60){_0x2da402['push'](_0x2da402['shift']());}};_0x31a57d(++_0x14a691);}(_0xa2e3,0x1a7));var _0x3a2e=function(_0x3626b3,_0x1bfc0e){_0x3626b3=_0x3626b3-0x0;var _0x20dd81=_0xa2e3[_0x3626b3];return _0x20dd81;};'use strict';var _=require(_0x3a2e('0x0'));var util=require(_0x3a2e('0x1'));var moment=require(_0x3a2e('0x2'));var BPromise=require(_0x3a2e('0x3'));var rs=require(_0x3a2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3a2e('0x5'));var logger=require('../../config/logger')(_0x3a2e('0x6'));var config=require(_0x3a2e('0x7'));var jayson=require(_0x3a2e('0x8'));var client=jayson[_0x3a2e('0x9')][_0x3a2e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5764dd,_0x39027b,_0x226759){return new BPromise(function(_0x12ab23,_0x56251a){return client[_0x3a2e('0xb')](_0x5764dd,_0x226759)[_0x3a2e('0xc')](function(_0x5ce9ae){logger[_0x3a2e('0xd')](_0x3a2e('0xe'),_0x39027b,_0x3a2e('0xf'));logger[_0x3a2e('0x10')](_0x3a2e('0x11'),_0x39027b,_0x3a2e('0xf'),JSON['stringify'](_0x5ce9ae));if(_0x5ce9ae[_0x3a2e('0x12')]){if(_0x5ce9ae['error'][_0x3a2e('0x13')]===0x1f4){logger[_0x3a2e('0x12')](_0x3a2e('0xe'),_0x39027b,_0x5ce9ae[_0x3a2e('0x12')]['message']);return _0x56251a(_0x5ce9ae[_0x3a2e('0x12')][_0x3a2e('0x14')]);}logger[_0x3a2e('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x39027b,_0x5ce9ae[_0x3a2e('0x12')][_0x3a2e('0x14')]);return _0x12ab23(_0x5ce9ae[_0x3a2e('0x12')][_0x3a2e('0x14')]);}else{logger[_0x3a2e('0xd')](_0x3a2e('0xe'),_0x39027b,_0x3a2e('0xf'));_0x12ab23(_0x5ce9ae['result'][_0x3a2e('0x14')]);}})[_0x3a2e('0x15')](function(_0x1dd6f6){logger['error'](_0x3a2e('0xe'),_0x39027b,_0x1dd6f6);_0x56251a(_0x1dd6f6);});});}exports[_0x3a2e('0x16')]=function(_0x2f4d11){var _0x2188bc=this;return new Promise(function(_0x25d786,_0xe9e9c3){return db[_0x3a2e('0x17')][_0x3a2e('0x18')]({'raw':_0x2f4d11[_0x3a2e('0x19')]?_0x2f4d11['options'][_0x3a2e('0x1a')]===undefined?!![]:![]:!![],'where':_0x2f4d11['options']?_0x2f4d11['options'][_0x3a2e('0x1b')]||null:null,'attributes':_0x2f4d11[_0x3a2e('0x19')]?_0x2f4d11[_0x3a2e('0x19')][_0x3a2e('0x1c')]||null:null,'limit':_0x2f4d11[_0x3a2e('0x19')]?_0x2f4d11[_0x3a2e('0x19')][_0x3a2e('0x1d')]||null:null,'include':_0x2f4d11[_0x3a2e('0x19')]?_0x2f4d11['options'][_0x3a2e('0x1e')]?_[_0x3a2e('0x1f')](_0x2f4d11[_0x3a2e('0x19')]['include'],function(_0x3d4431){return{'model':db[_0x3d4431[_0x3a2e('0x20')]],'as':_0x3d4431['as'],'attributes':_0x3d4431[_0x3a2e('0x1c')],'include':_0x3d4431['include']?_[_0x3a2e('0x1f')](_0x3d4431[_0x3a2e('0x1e')],function(_0x5f0cb4){return{'model':db[_0x5f0cb4[_0x3a2e('0x20')]],'as':_0x5f0cb4['as'],'attributes':_0x5f0cb4[_0x3a2e('0x1c')],'include':_0x5f0cb4[_0x3a2e('0x1e')]?_[_0x3a2e('0x1f')](_0x5f0cb4[_0x3a2e('0x1e')],function(_0x32eda2){return{'model':db[_0x32eda2['model']],'as':_0x32eda2['as'],'attributes':_0x32eda2[_0x3a2e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3a2e('0xc')](function(_0x4a5ff4){logger[_0x3a2e('0xd')]('GetVoiceCallReport',_0x2f4d11);logger['debug'](_0x3a2e('0x16'),_0x2f4d11,JSON[_0x3a2e('0x21')](_0x4a5ff4));_0x25d786(_0x4a5ff4);})[_0x3a2e('0x15')](function(_0x33f5ce){logger['error'](_0x3a2e('0x16'),_0x33f5ce[_0x3a2e('0x14')],_0x2f4d11);_0xe9e9c3(_0x2188bc[_0x3a2e('0x12')](0x1f4,_0x33f5ce[_0x3a2e('0x14')]));});});};exports[_0x3a2e('0x22')]=function(_0x11ef6a){var _0x5818a4=this;return new Promise(function(_0x90f434,_0x19e111){return db[_0x3a2e('0x17')][_0x3a2e('0x23')](_0x11ef6a[_0x3a2e('0x24')],{'raw':_0x11ef6a['options']?_0x11ef6a[_0x3a2e('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x3a2e('0xc')](function(_0x26ea66){logger[_0x3a2e('0xd')](_0x3a2e('0x22'),_0x11ef6a);logger[_0x3a2e('0x10')](_0x3a2e('0x22'),_0x11ef6a,JSON['stringify'](_0x26ea66));_0x90f434(_0x26ea66);})[_0x3a2e('0x15')](function(_0x33bbd1){logger[_0x3a2e('0x12')](_0x3a2e('0x22'),_0x33bbd1[_0x3a2e('0x14')],_0x11ef6a);_0x19e111(_0x5818a4['error'](0x1f4,_0x33bbd1[_0x3a2e('0x14')]));});});};exports['UpdateVoiceCallReport']=function(_0x494db4){var _0x3940b2=this;return new Promise(function(_0x1ae0bf,_0xe8c687){return db['VoiceCallReport'][_0x3a2e('0x25')](_0x494db4['body'],{'raw':_0x494db4['options']?_0x494db4[_0x3a2e('0x19')][_0x3a2e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x494db4[_0x3a2e('0x19')]?_0x494db4[_0x3a2e('0x19')][_0x3a2e('0x1b')]||null:null,'attributes':_0x494db4[_0x3a2e('0x19')]?_0x494db4['options'][_0x3a2e('0x1c')]||null:null,'limit':_0x494db4[_0x3a2e('0x19')]?_0x494db4['options']['limit']||null:null})['then'](function(_0x22399b){logger[_0x3a2e('0xd')](_0x3a2e('0x26'),_0x494db4);logger['debug'](_0x3a2e('0x26'),_0x494db4,JSON[_0x3a2e('0x21')](_0x22399b));_0x1ae0bf(_0x22399b);})[_0x3a2e('0x15')](function(_0x447a67){logger[_0x3a2e('0x12')](_0x3a2e('0x26'),_0x447a67[_0x3a2e('0x14')],_0x494db4);_0xe8c687(_0x3940b2['error'](0x1f4,_0x447a67['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 537fb4e..8696ff1 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 _0xd9c6=['/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x42336d,_0x52728f){var _0x414428=function(_0x2a553f){while(--_0x2a553f){_0x42336d['push'](_0x42336d['shift']());}};_0x414428(++_0x52728f);}(_0xd9c6,0x99));var _0x6d9c=function(_0x2cee57,_0x2055d1){_0x2cee57=_0x2cee57-0x0;var _0x1d6132=_0xd9c6[_0x2cee57];return _0x1d6132;};'use strict';var multer=require(_0x6d9c('0x0'));var util=require(_0x6d9c('0x1'));var path=require(_0x6d9c('0x2'));var timeout=require(_0x6d9c('0x3'));var express=require('express');var router=express[_0x6d9c('0x4')]();var auth=require(_0x6d9c('0x5'));var interaction=require(_0x6d9c('0x6'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0x6d9c('0x7')]('/',auth['isAuthenticated'](),controller[_0x6d9c('0x8')]);router['get'](_0x6d9c('0x9'),auth[_0x6d9c('0xa')](),controller[_0x6d9c('0xb')]);router[_0x6d9c('0xc')]('/',auth[_0x6d9c('0xa')](),controller[_0x6d9c('0xd')]);router[_0x6d9c('0xe')](_0x6d9c('0x9'),auth[_0x6d9c('0xa')](),controller[_0x6d9c('0xf')]);router['delete'](_0x6d9c('0x9'),auth['isAuthenticated'](),controller[_0x6d9c('0x10')]);module[_0x6d9c('0x11')]=router; \ No newline at end of file +var _0x8b17=['update','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','show','post','isAuthenticated'];(function(_0x2449f9,_0x21c743){var _0x1972a9=function(_0x4e1068){while(--_0x4e1068){_0x2449f9['push'](_0x2449f9['shift']());}};_0x1972a9(++_0x21c743);}(_0x8b17,0xbe));var _0x78b1=function(_0x423887,_0x36a5d3){_0x423887=_0x423887-0x0;var _0x25062f=_0x8b17[_0x423887];return _0x25062f;};'use strict';var multer=require('multer');var util=require(_0x78b1('0x0'));var path=require(_0x78b1('0x1'));var timeout=require(_0x78b1('0x2'));var express=require(_0x78b1('0x3'));var router=express['Router']();var auth=require(_0x78b1('0x4'));var interaction=require(_0x78b1('0x5'));var config=require(_0x78b1('0x6'));var controller=require(_0x78b1('0x7'));router[_0x78b1('0x8')]('/',auth['isAuthenticated'](),controller[_0x78b1('0x9')]);router[_0x78b1('0x8')](_0x78b1('0xa'),auth['isAuthenticated'](),controller[_0x78b1('0xb')]);router[_0x78b1('0xc')]('/',auth[_0x78b1('0xd')](),controller['create']);router['put'](_0x78b1('0xa'),auth['isAuthenticated'](),controller[_0x78b1('0xe')]);router[_0x78b1('0xf')](_0x78b1('0xa'),auth[_0x78b1('0xd')](),controller[_0x78b1('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 9446c2d..777c6ac 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 _0x7bb4=['setDataValue','options','getDataValue','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x11f226,_0x491e30){var _0x30be77=function(_0x2049bd){while(--_0x2049bd){_0x11f226['push'](_0x11f226['shift']());}};_0x30be77(++_0x491e30);}(_0x7bb4,0x1dc));var _0x47bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bb4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x47bb('0x0'));module[_0x47bb('0x1')]={'name':{'type':Sequelize[_0x47bb('0x2')]},'prefix':{'type':Sequelize[_0x47bb('0x2')],'unique':_0x47bb('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x47bb('0x2')],'set':function(_0x5c406b){this[_0x47bb('0x4')](_0x47bb('0x5'),_0x5c406b?_0x5c406b['join'](''):[]);},'get':function(){return this[_0x47bb('0x6')](_0x47bb('0x5'))?this[_0x47bb('0x6')](_0x47bb('0x5'))['split'](''):[];}},'auth':{'type':Sequelize[_0x47bb('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x47bb('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x47bb('0x2')]},'description':{'type':Sequelize[_0x47bb('0x2')]}}; \ No newline at end of file +var _0xbd56=['name','setDataValue','options','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x3c76b1,_0x47e8b7){var _0x136ae0=function(_0x1f6984){while(--_0x1f6984){_0x3c76b1['push'](_0x3c76b1['shift']());}};_0x136ae0(++_0x47e8b7);}(_0xbd56,0x8d));var _0x6bd5=function(_0x225721,_0x3f26d2){_0x225721=_0x225721-0x0;var _0x160053=_0xbd56[_0x225721];return _0x160053;};'use strict';var Sequelize=require(_0x6bd5('0x0'));module[_0x6bd5('0x1')]={'name':{'type':Sequelize[_0x6bd5('0x2')]},'prefix':{'type':Sequelize[_0x6bd5('0x2')],'unique':_0x6bd5('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x6bd5('0x2')],'set':function(_0xc85532){this[_0x6bd5('0x4')](_0x6bd5('0x5'),_0xc85532?_0xc85532['join'](''):[]);},'get':function(){return this[_0x6bd5('0x6')](_0x6bd5('0x5'))?this[_0x6bd5('0x6')](_0x6bd5('0x5'))[_0x6bd5('0x7')](''):[];}},'auth':{'type':Sequelize[_0x6bd5('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x6bd5('0x2')]},'record':{'type':Sequelize[_0x6bd5('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x6bd5('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 3fa31fd..8be1344 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 _0xefb9=['to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','offset','limit','status','Content-Range','json','apply','reject','save','update','destroy','then','ChanSpies','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','options','count','includeAll','include','findAll','catch','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js'];(function(_0x307bf6,_0x55bdd5){var _0x2878fc=function(_0x4fa44f){while(--_0x4fa44f){_0x307bf6['push'](_0x307bf6['shift']());}};_0x2878fc(++_0x55bdd5);}(_0xefb9,0x191));var _0x9efb=function(_0x568a61,_0x2124f8){_0x568a61=_0x568a61-0x0;var _0x334c3b=_0xefb9[_0x568a61];return _0x334c3b;};'use strict';var pdf=require(_0x9efb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9efb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9efb('0x2'));var moment=require(_0x9efb('0x3'));var BPromise=require(_0x9efb('0x4'));var Mustache=require(_0x9efb('0x5'));var util=require(_0x9efb('0x6'));var path=require(_0x9efb('0x7'));var sox=require(_0x9efb('0x8'));var csv=require('to-csv');var ejs=require(_0x9efb('0x9'));var fs=require('fs');var _=require(_0x9efb('0xa'));var squel=require(_0x9efb('0xb'));var crypto=require('crypto');var jsforce=require(_0x9efb('0xc'));var deskjs=require(_0x9efb('0xd'));var toCsv=require(_0x9efb('0xe'));var querystring=require(_0x9efb('0xf'));var Papa=require(_0x9efb('0x10'));var Redis=require('ioredis');var authService=require(_0x9efb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9efb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9efb('0x13'))('api');var utils=require(_0x9efb('0x14'));var config=require(_0x9efb('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe1efed,_0x55e139){_0x55e139=_0x55e139||0xcc;return function(_0x443e75){if(_0x443e75){return _0xe1efed[_0x9efb('0x16')](_0x55e139);}return _0xe1efed['status'](_0x55e139)[_0x9efb('0x17')]();};}function respondWithResult(_0x155efa,_0x1f29e3){_0x1f29e3=_0x1f29e3||0xc8;return function(_0x2df92c){if(_0x2df92c){return _0x155efa['status'](_0x1f29e3)['json'](_0x2df92c);}};}function respondWithFilteredResult(_0x4d1d28,_0x1c6977){return function(_0x3a1fd1){if(_0x3a1fd1){var _0x40f24b=_0x3a1fd1['count'],_0x56e95b=_0x1c6977[_0x9efb('0x18')],_0x3e1867=_0x1c6977[_0x9efb('0x18')]+_0x1c6977[_0x9efb('0x19')],_0x3f006b;if(_0x3e1867>=_0x40f24b){_0x3e1867=_0x40f24b;_0x3f006b=0xc8;}else{_0x3f006b=0xce;}_0x4d1d28[_0x9efb('0x1a')](_0x3f006b);return _0x4d1d28['set'](_0x9efb('0x1b'),_0x56e95b+'-'+_0x3e1867+'/'+_0x40f24b)[_0x9efb('0x1c')](_0x3a1fd1);}return null;};}function patchUpdates(_0x509c48){return function(_0x1f35cf){try{jsonpatch[_0x9efb('0x1d')](_0x1f35cf,_0x509c48,!![]);}catch(_0x43e4cf){return BPromise[_0x9efb('0x1e')](_0x43e4cf);}return _0x1f35cf[_0x9efb('0x1f')]();};}function saveUpdates(_0x3225d7,_0x120805){return function(_0x133c29){if(_0x133c29){return _0x133c29[_0x9efb('0x20')](_0x3225d7)['then'](function(_0x52adfb){return _0x52adfb;});}return null;};}function removeEntity(_0x30ac5e,_0x1d2d03){return function(_0x54b1b7){if(_0x54b1b7){return _0x54b1b7[_0x9efb('0x21')]()[_0x9efb('0x22')](function(){var _0x5733ef=_0x54b1b7['get']({'plain':!![]});var _0x28f40a=_0x9efb('0x23');return db[_0x9efb('0x24')][_0x9efb('0x21')]({'where':{'type':_0x28f40a,'resourceId':_0x5733ef['id']}})['then'](function(){return _0x54b1b7;});})['then'](function(){_0x30ac5e[_0x9efb('0x1a')](0xcc)[_0x9efb('0x17')]();});}};}function handleEntityNotFound(_0xaffc5,_0x5d0254){return function(_0x189982){if(!_0x189982){_0xaffc5['sendStatus'](0x194);}return _0x189982;};}function handleError(_0x38b2a8,_0x506a3f){_0x506a3f=_0x506a3f||0x1f4;return function(_0x56aada){logger[_0x9efb('0x25')](_0x56aada[_0x9efb('0x26')]);if(_0x56aada[_0x9efb('0x27')]){delete _0x56aada[_0x9efb('0x27')];}_0x38b2a8['status'](_0x506a3f)[_0x9efb('0x28')](_0x56aada);};}exports[_0x9efb('0x29')]=function(_0x136a7b,_0x18d8c5){var _0x313f2f={},_0x2d2af4={},_0x2c06ea={'count':0x0,'rows':[]};var _0xc242e3=_[_0x9efb('0x2a')](db[_0x9efb('0x2b')][_0x9efb('0x2c')],function(_0x1b60ab){return{'name':_0x1b60ab[_0x9efb('0x2d')],'type':_0x1b60ab[_0x9efb('0x2e')][_0x9efb('0x2f')]};});_0x2d2af4[_0x9efb('0x30')]=_[_0x9efb('0x2a')](_0xc242e3,'name');_0x2d2af4[_0x9efb('0x31')]=_[_0x9efb('0x32')](_0x136a7b['query']);_0x2d2af4['filters']=_[_0x9efb('0x33')](_0x2d2af4[_0x9efb('0x30')],_0x2d2af4[_0x9efb('0x31')]);_0x313f2f[_0x9efb('0x34')]=_[_0x9efb('0x33')](_0x2d2af4[_0x9efb('0x30')],qs['fields'](_0x136a7b[_0x9efb('0x31')][_0x9efb('0x35')]));_0x313f2f[_0x9efb('0x34')]=_0x313f2f[_0x9efb('0x34')][_0x9efb('0x36')]?_0x313f2f[_0x9efb('0x34')]:_0x2d2af4['model'];if(!_0x136a7b[_0x9efb('0x31')][_0x9efb('0x37')](_0x9efb('0x38'))){_0x313f2f['limit']=qs[_0x9efb('0x19')](_0x136a7b[_0x9efb('0x31')][_0x9efb('0x19')]);_0x313f2f[_0x9efb('0x18')]=qs[_0x9efb('0x18')](_0x136a7b['query']['offset']);}_0x313f2f[_0x9efb('0x39')]=qs[_0x9efb('0x3a')](_0x136a7b[_0x9efb('0x31')][_0x9efb('0x3a')]);_0x313f2f[_0x9efb('0x3b')]=qs[_0x9efb('0x3c')](_[_0x9efb('0x3d')](_0x136a7b[_0x9efb('0x31')],_0x2d2af4[_0x9efb('0x3c')]),_0xc242e3);if(_0x136a7b[_0x9efb('0x31')]['filter']){_0x313f2f[_0x9efb('0x3b')]=_['merge'](_0x313f2f[_0x9efb('0x3b')],{'$or':_['map'](_0xc242e3,function(_0x1ed576){if(_0x1ed576[_0x9efb('0x2e')]!==_0x9efb('0x3e')){var _0x19e419={};_0x19e419[_0x1ed576[_0x9efb('0x27')]]={'$like':'%'+_0x136a7b[_0x9efb('0x31')]['filter']+'%'};return _0x19e419;}})});}_0x313f2f=_[_0x9efb('0x3f')]({},_0x313f2f,_0x136a7b[_0x9efb('0x40')]);var _0x241808={'where':_0x313f2f[_0x9efb('0x3b')]};return db[_0x9efb('0x2b')]['count'](_0x241808)['then'](function(_0x4b949e){_0x2c06ea[_0x9efb('0x41')]=_0x4b949e;if(_0x136a7b[_0x9efb('0x31')][_0x9efb('0x42')]){_0x313f2f[_0x9efb('0x43')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x9efb('0x44')](_0x313f2f);})[_0x9efb('0x22')](function(_0x4269de){_0x2c06ea['rows']=_0x4269de;return _0x2c06ea;})[_0x9efb('0x22')](respondWithFilteredResult(_0x18d8c5,_0x313f2f))[_0x9efb('0x45')](handleError(_0x18d8c5,null));};exports[_0x9efb('0x46')]=function(_0x22ec71,_0x2fa312){var _0x36e545={'raw':![],'where':{'id':_0x22ec71[_0x9efb('0x47')]['id']}},_0x408f58={};_0x408f58[_0x9efb('0x30')]=_[_0x9efb('0x32')](db[_0x9efb('0x2b')][_0x9efb('0x2c')]);_0x408f58[_0x9efb('0x31')]=_[_0x9efb('0x32')](_0x22ec71[_0x9efb('0x31')]);_0x408f58[_0x9efb('0x3c')]=_['intersection'](_0x408f58['model'],_0x408f58[_0x9efb('0x31')]);_0x36e545[_0x9efb('0x34')]=_['intersection'](_0x408f58[_0x9efb('0x30')],qs[_0x9efb('0x35')](_0x22ec71[_0x9efb('0x31')]['fields']));_0x36e545[_0x9efb('0x34')]=_0x36e545[_0x9efb('0x34')]['length']?_0x36e545[_0x9efb('0x34')]:_0x408f58['model'];if(_0x22ec71['query'][_0x9efb('0x42')]){_0x36e545[_0x9efb('0x43')]=[{'all':!![]}];}_0x36e545=_[_0x9efb('0x3f')]({},_0x36e545,_0x22ec71['options']);return db['VoiceChanSpy'][_0x9efb('0x48')](_0x36e545)['then'](handleEntityNotFound(_0x2fa312,null))[_0x9efb('0x22')](respondWithResult(_0x2fa312,null))[_0x9efb('0x45')](handleError(_0x2fa312,null));};exports[_0x9efb('0x49')]=function(_0x25e5df,_0x4b6db7){return db[_0x9efb('0x2b')][_0x9efb('0x49')](_0x25e5df[_0x9efb('0x4a')],{})[_0x9efb('0x22')](function(_0x5b32b5){var _0x524ad1=_0x25e5df['user'][_0x9efb('0x4b')]({'plain':!![]});if(!_0x524ad1)throw new Error(_0x9efb('0x4c'));if(_0x524ad1[_0x9efb('0x4d')]===_0x9efb('0x4e')){var _0x5138fb=_0x5b32b5[_0x9efb('0x4b')]({'plain':!![]});var _0x790749=_0x9efb('0x23');return db[_0x9efb('0x4f')]['find']({'where':{'name':_0x790749,'userProfileId':_0x524ad1[_0x9efb('0x50')]},'raw':!![]})[_0x9efb('0x22')](function(_0x36b134){if(_0x36b134&&_0x36b134[_0x9efb('0x51')]===0x0){return db[_0x9efb('0x24')][_0x9efb('0x49')]({'name':_0x5138fb[_0x9efb('0x27')],'resourceId':_0x5138fb['id'],'type':_0x36b134[_0x9efb('0x27')],'sectionId':_0x36b134['id']},{})[_0x9efb('0x22')](function(){return _0x5b32b5;});}else{return _0x5b32b5;}})[_0x9efb('0x45')](function(_0x2bdcfd){logger[_0x9efb('0x25')](_0x9efb('0x52'),_0x2bdcfd);throw _0x2bdcfd;});}return _0x5b32b5;})[_0x9efb('0x22')](respondWithResult(_0x4b6db7,0xc9))['catch'](handleError(_0x4b6db7,null));};exports[_0x9efb('0x20')]=function(_0x198035,_0x34512d){if(_0x198035['body']['id']){delete _0x198035[_0x9efb('0x4a')]['id'];}return db[_0x9efb('0x2b')][_0x9efb('0x48')]({'where':{'id':_0x198035[_0x9efb('0x47')]['id']}})[_0x9efb('0x22')](handleEntityNotFound(_0x34512d,null))['then'](saveUpdates(_0x198035['body'],null))['then'](respondWithResult(_0x34512d,null))[_0x9efb('0x45')](handleError(_0x34512d,null));};exports[_0x9efb('0x21')]=function(_0x17e73b,_0x5e5dc2){return db[_0x9efb('0x2b')][_0x9efb('0x48')]({'where':{'id':_0x17e73b[_0x9efb('0x47')]['id']}})['then'](handleEntityNotFound(_0x5e5dc2,null))[_0x9efb('0x22')](removeEntity(_0x5e5dc2,null))[_0x9efb('0x45')](handleError(_0x5e5dc2,null));}; \ No newline at end of file +var _0x7f4d=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','json','update','then','destroy','UserProfileResource','error','send','index','map','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filter','merge','options','where','VoiceChanSpy','includeAll','include','findAll','rows','catch','params','find','create','body','user','get','role','ChanSpies'];(function(_0x3ef4f1,_0x5f0f9b){var _0x69953c=function(_0xb4e621){while(--_0xb4e621){_0x3ef4f1['push'](_0x3ef4f1['shift']());}};_0x69953c(++_0x5f0f9b);}(_0x7f4d,0x9c));var _0xd7f4=function(_0x50b164,_0x26ef1){_0x50b164=_0x50b164-0x0;var _0xbf4bd0=_0x7f4d[_0x50b164];return _0xbf4bd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd7f4('0x0'));var rimraf=require(_0xd7f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd7f4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd7f4('0x3'));var util=require(_0xd7f4('0x4'));var path=require(_0xd7f4('0x5'));var sox=require('sox');var csv=require(_0xd7f4('0x6'));var ejs=require(_0xd7f4('0x7'));var fs=require('fs');var _=require(_0xd7f4('0x8'));var squel=require('squel');var crypto=require(_0xd7f4('0x9'));var jsforce=require(_0xd7f4('0xa'));var deskjs=require(_0xd7f4('0xb'));var toCsv=require(_0xd7f4('0x6'));var querystring=require(_0xd7f4('0xc'));var Papa=require(_0xd7f4('0xd'));var Redis=require(_0xd7f4('0xe'));var authService=require(_0xd7f4('0xf'));var qs=require(_0xd7f4('0x10'));var as=require(_0xd7f4('0x11'));var hardwareService=require(_0xd7f4('0x12'));var logger=require('../../config/logger')(_0xd7f4('0x13'));var utils=require('../../config/utils');var config=require(_0xd7f4('0x14'));var licenseUtil=require(_0xd7f4('0x15'));var db=require(_0xd7f4('0x16'))['db'];function respondWithStatusCode(_0x2614b8,_0xb7477b){_0xb7477b=_0xb7477b||0xcc;return function(_0x576e6a){if(_0x576e6a){return _0x2614b8[_0xd7f4('0x17')](_0xb7477b);}return _0x2614b8[_0xd7f4('0x18')](_0xb7477b)[_0xd7f4('0x19')]();};}function respondWithResult(_0x133350,_0xd0c359){_0xd0c359=_0xd0c359||0xc8;return function(_0x4fea2e){if(_0x4fea2e){return _0x133350[_0xd7f4('0x18')](_0xd0c359)['json'](_0x4fea2e);}};}function respondWithFilteredResult(_0x178f6c,_0x2a1b30){return function(_0x524bf9){if(_0x524bf9){var _0x30ebf6=_0x524bf9[_0xd7f4('0x1a')],_0x4f9de7=_0x2a1b30[_0xd7f4('0x1b')],_0x12f37f=_0x2a1b30[_0xd7f4('0x1b')]+_0x2a1b30['limit'],_0x70b87b;if(_0x12f37f>=_0x30ebf6){_0x12f37f=_0x30ebf6;_0x70b87b=0xc8;}else{_0x70b87b=0xce;}_0x178f6c[_0xd7f4('0x18')](_0x70b87b);return _0x178f6c['set'](_0xd7f4('0x1c'),_0x4f9de7+'-'+_0x12f37f+'/'+_0x30ebf6)[_0xd7f4('0x1d')](_0x524bf9);}return null;};}function patchUpdates(_0x2ffafa){return function(_0x328254){try{jsonpatch['apply'](_0x328254,_0x2ffafa,!![]);}catch(_0x546186){return BPromise['reject'](_0x546186);}return _0x328254['save']();};}function saveUpdates(_0x50ddc1,_0x3024e7){return function(_0x4e5e44){if(_0x4e5e44){return _0x4e5e44[_0xd7f4('0x1e')](_0x50ddc1)[_0xd7f4('0x1f')](function(_0x3a497d){return _0x3a497d;});}return null;};}function removeEntity(_0xba5bc,_0x271d7f){return function(_0x23d202){if(_0x23d202){return _0x23d202[_0xd7f4('0x20')]()['then'](function(){var _0x674ac1=_0x23d202['get']({'plain':!![]});var _0x19ce5d='ChanSpies';return db[_0xd7f4('0x21')][_0xd7f4('0x20')]({'where':{'type':_0x19ce5d,'resourceId':_0x674ac1['id']}})[_0xd7f4('0x1f')](function(){return _0x23d202;});})[_0xd7f4('0x1f')](function(){_0xba5bc['status'](0xcc)[_0xd7f4('0x19')]();});}};}function handleEntityNotFound(_0x38bec5,_0x4903d7){return function(_0x582472){if(!_0x582472){_0x38bec5[_0xd7f4('0x17')](0x194);}return _0x582472;};}function handleError(_0x4e7e61,_0x237833){_0x237833=_0x237833||0x1f4;return function(_0x37346a){logger[_0xd7f4('0x22')](_0x37346a['stack']);if(_0x37346a['name']){delete _0x37346a['name'];}_0x4e7e61['status'](_0x237833)[_0xd7f4('0x23')](_0x37346a);};}exports[_0xd7f4('0x24')]=function(_0x1bd587,_0x827fac){var _0xc5cd4={},_0x47db35={},_0x54c761={'count':0x0,'rows':[]};var _0x404f83=_[_0xd7f4('0x25')](db['VoiceChanSpy'][_0xd7f4('0x26')],function(_0xef315e){return{'name':_0xef315e['fieldName'],'type':_0xef315e[_0xd7f4('0x27')][_0xd7f4('0x28')]};});_0x47db35[_0xd7f4('0x29')]=_[_0xd7f4('0x25')](_0x404f83,_0xd7f4('0x2a'));_0x47db35[_0xd7f4('0x2b')]=_[_0xd7f4('0x2c')](_0x1bd587[_0xd7f4('0x2b')]);_0x47db35[_0xd7f4('0x2d')]=_[_0xd7f4('0x2e')](_0x47db35['model'],_0x47db35['query']);_0xc5cd4[_0xd7f4('0x2f')]=_[_0xd7f4('0x2e')](_0x47db35['model'],qs[_0xd7f4('0x30')](_0x1bd587[_0xd7f4('0x2b')][_0xd7f4('0x30')]));_0xc5cd4[_0xd7f4('0x2f')]=_0xc5cd4['attributes']['length']?_0xc5cd4['attributes']:_0x47db35[_0xd7f4('0x29')];if(!_0x1bd587[_0xd7f4('0x2b')][_0xd7f4('0x31')](_0xd7f4('0x32'))){_0xc5cd4[_0xd7f4('0x33')]=qs[_0xd7f4('0x33')](_0x1bd587[_0xd7f4('0x2b')][_0xd7f4('0x33')]);_0xc5cd4['offset']=qs[_0xd7f4('0x1b')](_0x1bd587[_0xd7f4('0x2b')]['offset']);}_0xc5cd4[_0xd7f4('0x34')]=qs[_0xd7f4('0x35')](_0x1bd587['query'][_0xd7f4('0x35')]);_0xc5cd4['where']=qs[_0xd7f4('0x2d')](_['pick'](_0x1bd587[_0xd7f4('0x2b')],_0x47db35[_0xd7f4('0x2d')]),_0x404f83);if(_0x1bd587['query'][_0xd7f4('0x36')]){_0xc5cd4['where']=_[_0xd7f4('0x37')](_0xc5cd4['where'],{'$or':_['map'](_0x404f83,function(_0x3abb56){if(_0x3abb56[_0xd7f4('0x27')]!=='VIRTUAL'){var _0x554b1f={};_0x554b1f[_0x3abb56[_0xd7f4('0x2a')]]={'$like':'%'+_0x1bd587[_0xd7f4('0x2b')][_0xd7f4('0x36')]+'%'};return _0x554b1f;}})});}_0xc5cd4=_[_0xd7f4('0x37')]({},_0xc5cd4,_0x1bd587[_0xd7f4('0x38')]);var _0x9777f6={'where':_0xc5cd4[_0xd7f4('0x39')]};return db[_0xd7f4('0x3a')][_0xd7f4('0x1a')](_0x9777f6)['then'](function(_0x571f99){_0x54c761[_0xd7f4('0x1a')]=_0x571f99;if(_0x1bd587[_0xd7f4('0x2b')][_0xd7f4('0x3b')]){_0xc5cd4[_0xd7f4('0x3c')]=[{'all':!![]}];}return db[_0xd7f4('0x3a')][_0xd7f4('0x3d')](_0xc5cd4);})[_0xd7f4('0x1f')](function(_0x2bfac8){_0x54c761[_0xd7f4('0x3e')]=_0x2bfac8;return _0x54c761;})['then'](respondWithFilteredResult(_0x827fac,_0xc5cd4))[_0xd7f4('0x3f')](handleError(_0x827fac,null));};exports['show']=function(_0x4b403e,_0x3a3248){var _0x15c851={'raw':![],'where':{'id':_0x4b403e[_0xd7f4('0x40')]['id']}},_0x1b48cd={};_0x1b48cd[_0xd7f4('0x29')]=_[_0xd7f4('0x2c')](db[_0xd7f4('0x3a')]['rawAttributes']);_0x1b48cd['query']=_[_0xd7f4('0x2c')](_0x4b403e[_0xd7f4('0x2b')]);_0x1b48cd[_0xd7f4('0x2d')]=_['intersection'](_0x1b48cd[_0xd7f4('0x29')],_0x1b48cd['query']);_0x15c851['attributes']=_[_0xd7f4('0x2e')](_0x1b48cd[_0xd7f4('0x29')],qs[_0xd7f4('0x30')](_0x4b403e[_0xd7f4('0x2b')][_0xd7f4('0x30')]));_0x15c851[_0xd7f4('0x2f')]=_0x15c851[_0xd7f4('0x2f')]['length']?_0x15c851[_0xd7f4('0x2f')]:_0x1b48cd['model'];if(_0x4b403e['query']['includeAll']){_0x15c851[_0xd7f4('0x3c')]=[{'all':!![]}];}_0x15c851=_[_0xd7f4('0x37')]({},_0x15c851,_0x4b403e[_0xd7f4('0x38')]);return db[_0xd7f4('0x3a')][_0xd7f4('0x41')](_0x15c851)[_0xd7f4('0x1f')](handleEntityNotFound(_0x3a3248,null))[_0xd7f4('0x1f')](respondWithResult(_0x3a3248,null))['catch'](handleError(_0x3a3248,null));};exports[_0xd7f4('0x42')]=function(_0x4c0875,_0x513988){return db[_0xd7f4('0x3a')][_0xd7f4('0x42')](_0x4c0875[_0xd7f4('0x43')],{})[_0xd7f4('0x1f')](function(_0x3067eb){var _0x45e9d3=_0x4c0875[_0xd7f4('0x44')][_0xd7f4('0x45')]({'plain':!![]});if(!_0x45e9d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45e9d3[_0xd7f4('0x46')]==='user'){var _0x484b0f=_0x3067eb[_0xd7f4('0x45')]({'plain':!![]});var _0x4c01e6=_0xd7f4('0x47');return db[_0xd7f4('0x48')][_0xd7f4('0x41')]({'where':{'name':_0x4c01e6,'userProfileId':_0x45e9d3[_0xd7f4('0x49')]},'raw':!![]})['then'](function(_0xcc8400){if(_0xcc8400&&_0xcc8400[_0xd7f4('0x4a')]===0x0){return db['UserProfileResource'][_0xd7f4('0x42')]({'name':_0x484b0f[_0xd7f4('0x2a')],'resourceId':_0x484b0f['id'],'type':_0xcc8400['name'],'sectionId':_0xcc8400['id']},{})[_0xd7f4('0x1f')](function(){return _0x3067eb;});}else{return _0x3067eb;}})[_0xd7f4('0x3f')](function(_0x9b5d9){logger[_0xd7f4('0x22')](_0xd7f4('0x4b'),_0x9b5d9);throw _0x9b5d9;});}return _0x3067eb;})[_0xd7f4('0x1f')](respondWithResult(_0x513988,0xc9))[_0xd7f4('0x3f')](handleError(_0x513988,null));};exports['update']=function(_0x3e5a33,_0x4b2e68){if(_0x3e5a33[_0xd7f4('0x43')]['id']){delete _0x3e5a33['body']['id'];}return db[_0xd7f4('0x3a')]['find']({'where':{'id':_0x3e5a33[_0xd7f4('0x40')]['id']}})[_0xd7f4('0x1f')](handleEntityNotFound(_0x4b2e68,null))[_0xd7f4('0x1f')](saveUpdates(_0x3e5a33['body'],null))['then'](respondWithResult(_0x4b2e68,null))[_0xd7f4('0x3f')](handleError(_0x4b2e68,null));};exports[_0xd7f4('0x20')]=function(_0x262bdd,_0x55309a){return db[_0xd7f4('0x3a')][_0xd7f4('0x41')]({'where':{'id':_0x262bdd[_0xd7f4('0x40')]['id']}})[_0xd7f4('0x1f')](handleEntityNotFound(_0x55309a,null))['then'](removeEntity(_0x55309a,null))[_0xd7f4('0x3f')](handleError(_0x55309a,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 68be3a8..c3e122e 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 _0x923c=['destroy','lodash','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','record','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','options','join','concat','internal','name','User','findAll','agent','then','catch','exports','models','define','voice_chanspy','length','VoiceExtension','bulkCreate'];(function(_0xdaf736,_0xd8c667){var _0x1090b3=function(_0x2eab2e){while(--_0x2eab2e){_0xdaf736['push'](_0xdaf736['shift']());}};_0x1090b3(++_0xd8c667);}(_0x923c,0x198));var _0xc923=function(_0x4042d2,_0x59eaab){_0x4042d2=_0x4042d2-0x0;var _0x4c1d22=_0x923c[_0x4042d2];return _0x4c1d22;};'use strict';var _=require(_0xc923('0x0'));var util=require('util');var BPromise=require(_0xc923('0x1'));var attributes=require(_0xc923('0x2'));var getUserApplications=function(_0x5e9cd8,_0x5aa456,_0x2adbf3){var _0x5d7572=0x1;var _0x5c3205=[];var _0x2274de={'context':_0x5aa456[_0xc923('0x3')]||'from-sip','exten':util[_0xc923('0x4')](_0xc923('0x5'),_0x5e9cd8[_0xc923('0x6')],_0x2adbf3),'type':_0xc923('0x7'),'isApp':![],'ChanSpyId':_0x5e9cd8['id'],'UserId':_0x5aa456['id']};_0x5c3205[_0xc923('0x8')](_[_0xc923('0x9')]({'app':_0xc923('0xa'),'appdata':util[_0xc923('0x4')](_0xc923('0xb'),'chanspy'),'priority':_0x5d7572++},_0x2274de));if(_0x5e9cd8[_0xc923('0xc')]){_0x5c3205[_0xc923('0x8')](_[_0xc923('0x9')]({'app':'MixMonitor','appdata':util[_0xc923('0x4')](_0xc923('0xd'),_0x5e9cd8[_0xc923('0xe')]),'priority':_0x5d7572++},_0x2274de));}if(_0x5e9cd8[_0xc923('0xf')]){_0x5c3205['push'](_[_0xc923('0x9')]({'app':_0xc923('0x10'),'appdata':_0x5e9cd8['password'],'priority':_0x5d7572++},_0x2274de));}_0x5c3205[_0xc923('0x8')](_[_0xc923('0x9')]({'app':_0xc923('0x11'),'appdata':util[_0xc923('0x4')](_0xc923('0x12'),_0x5aa456['name'],_0x5e9cd8[_0xc923('0x13')]?_0x5e9cd8[_0xc923('0x13')][_0xc923('0x14')](''):''),'priority':_0x5d7572++},_0x2274de));if(_0x5e9cd8[_0xc923('0xc')]){_0x5c3205[_0xc923('0x8')](_['merge']({'app':'StopMixMonitor','priority':_0x5d7572++},_0x2274de));}return _0x5c3205;};var getChanSpyApplications=function(_0x52ea65,_0x1055d9){var _0xbc1d98=[];for(var _0x16da76=0x0,_0x119e8d=0x1;_0x16da76<_0x1055d9['length'];_0x16da76++,_0x119e8d=0x1){_0xbc1d98=_0xbc1d98[_0xc923('0x15')](getUserApplications(_0x52ea65,_0x1055d9[_0x16da76],_0x1055d9[_0x16da76][_0xc923('0x16')]));if(_0x1055d9[_0x16da76][_0xc923('0x16')]!=_0x1055d9[_0x16da76][_0xc923('0x17')]){_0xbc1d98=_0xbc1d98[_0xc923('0x15')](getUserApplications(_0x52ea65,_0x1055d9[_0x16da76],_0x1055d9[_0x16da76][_0xc923('0x17')]));}}return _0xbc1d98;};var getChanSpyPromise=function(_0x2749a2,_0x497258){return new BPromise(function(_0x4401bd,_0x323d57){return _0x2749a2[_0xc923('0x18')][_0xc923('0x19')]({'attributes':['id',_0xc923('0x17'),_0xc923('0x16')],'where':{'role':_0xc923('0x1a'),'chanspy':!![]},'raw':!![]})[_0xc923('0x1b')](function(_0x375c3e){if(_0x375c3e){return _0x4401bd(getChanSpyApplications(_0x497258,_0x375c3e));}return _0x4401bd([]);})[_0xc923('0x1c')](function(_0x357247){_0x323d57(_0x357247);});});};module[_0xc923('0x1d')]=function(_0x2af037,_0x4b1409){var _0x13873f=_0x2af037[_0xc923('0x1e')];return _0x2af037[_0xc923('0x1f')]('VoiceChanSpy',attributes,{'tableName':_0xc923('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x22e878,_0x44c92b,_0xaabfb7){return getChanSpyPromise(_0x13873f,_0x22e878)['then'](function(_0x59323e){if(_0x59323e&&_0x59323e[_0xc923('0x21')]){return _0x13873f[_0xc923('0x22')][_0xc923('0x23')](_0x59323e);}})[_0xc923('0x1b')](function(){_0xaabfb7();})[_0xc923('0x1c')](function(_0x5e7156){_0xaabfb7(_0x5e7156);});},'afterUpdate':function(_0x22884c,_0x4e3c90,_0x4224e8){return _0x13873f['VoiceExtension'][_0xc923('0x24')]({'where':{'ChanSpyId':_0x22884c['id']}})[_0xc923('0x1b')](function(){return getChanSpyPromise(_0x13873f,_0x22884c);})[_0xc923('0x1b')](function(_0x362fdd){if(_0x362fdd&&_0x362fdd[_0xc923('0x21')]){return _0x13873f[_0xc923('0x22')][_0xc923('0x23')](_0x362fdd);}})['then'](function(){_0x4224e8();})[_0xc923('0x1c')](function(_0x2d5435){_0x4224e8(_0x2d5435);});},'afterDestroy':function(_0x4eb21d,_0x14f109,_0x47fe4f){return _0x13873f[_0xc923('0x22')][_0xc923('0x24')]({'where':{'ChanSpyId':_0x4eb21d['id']}})[_0xc923('0x1b')](function(){_0x47fe4f();})[_0xc923('0x1c')](function(_0x539b4f){_0x47fe4f(_0x539b4f);});}}});}; \ No newline at end of file +var _0xd4a0=['User','findAll','agent','then','models','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','catch','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','Set','CDR(type)=%s','chanspy','record','push','MixMonitor','recordingFormat','merge','Authenticate','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name'];(function(_0x2472a5,_0x454f43){var _0x367aa1=function(_0x521556){while(--_0x521556){_0x2472a5['push'](_0x2472a5['shift']());}};_0x367aa1(++_0x454f43);}(_0xd4a0,0x187));var _0x0d4a=function(_0x23a2ac,_0x406981){_0x23a2ac=_0x23a2ac-0x0;var _0x4da53a=_0xd4a0[_0x23a2ac];return _0x4da53a;};'use strict';var _=require(_0x0d4a('0x0'));var util=require(_0x0d4a('0x1'));var BPromise=require(_0x0d4a('0x2'));var attributes=require(_0x0d4a('0x3'));var getUserApplications=function(_0x511eb3,_0x40c2f1,_0x4ccb74){var _0x618b11=0x1;var _0x4d6aea=[];var _0xb3bee2={'context':_0x40c2f1['context']||_0x0d4a('0x4'),'exten':util[_0x0d4a('0x5')](_0x0d4a('0x6'),_0x511eb3[_0x0d4a('0x7')],_0x4ccb74),'type':_0x0d4a('0x8'),'isApp':![],'ChanSpyId':_0x511eb3['id'],'UserId':_0x40c2f1['id']};_0x4d6aea['push'](_['merge']({'app':_0x0d4a('0x9'),'appdata':util[_0x0d4a('0x5')](_0x0d4a('0xa'),_0x0d4a('0xb')),'priority':_0x618b11++},_0xb3bee2));if(_0x511eb3[_0x0d4a('0xc')]){_0x4d6aea[_0x0d4a('0xd')](_['merge']({'app':_0x0d4a('0xe'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x511eb3[_0x0d4a('0xf')]),'priority':_0x618b11++},_0xb3bee2));}if(_0x511eb3['auth']){_0x4d6aea['push'](_[_0x0d4a('0x10')]({'app':_0x0d4a('0x11'),'appdata':_0x511eb3['password'],'priority':_0x618b11++},_0xb3bee2));}_0x4d6aea[_0x0d4a('0xd')](_['merge']({'app':_0x0d4a('0x12'),'appdata':util['format'](_0x0d4a('0x13'),_0x40c2f1['name'],_0x511eb3[_0x0d4a('0x14')]?_0x511eb3[_0x0d4a('0x14')][_0x0d4a('0x15')](''):''),'priority':_0x618b11++},_0xb3bee2));if(_0x511eb3[_0x0d4a('0xc')]){_0x4d6aea[_0x0d4a('0xd')](_[_0x0d4a('0x10')]({'app':_0x0d4a('0x16'),'priority':_0x618b11++},_0xb3bee2));}return _0x4d6aea;};var getChanSpyApplications=function(_0x137255,_0x24e42f){var _0x341a27=[];for(var _0x379041=0x0,_0x59f897=0x1;_0x379041<_0x24e42f[_0x0d4a('0x17')];_0x379041++,_0x59f897=0x1){_0x341a27=_0x341a27[_0x0d4a('0x18')](getUserApplications(_0x137255,_0x24e42f[_0x379041],_0x24e42f[_0x379041][_0x0d4a('0x19')]));if(_0x24e42f[_0x379041][_0x0d4a('0x19')]!=_0x24e42f[_0x379041][_0x0d4a('0x1a')]){_0x341a27=_0x341a27[_0x0d4a('0x18')](getUserApplications(_0x137255,_0x24e42f[_0x379041],_0x24e42f[_0x379041][_0x0d4a('0x1a')]));}}return _0x341a27;};var getChanSpyPromise=function(_0x1c3cb7,_0x5e11ad){return new BPromise(function(_0x48d74c,_0x14dac9){return _0x1c3cb7[_0x0d4a('0x1b')][_0x0d4a('0x1c')]({'attributes':['id','name',_0x0d4a('0x19')],'where':{'role':_0x0d4a('0x1d'),'chanspy':!![]},'raw':!![]})[_0x0d4a('0x1e')](function(_0x2cf093){if(_0x2cf093){return _0x48d74c(getChanSpyApplications(_0x5e11ad,_0x2cf093));}return _0x48d74c([]);})['catch'](function(_0x43c009){_0x14dac9(_0x43c009);});});};module['exports']=function(_0x2257ac,_0x148e72){var _0x25efaa=_0x2257ac[_0x0d4a('0x1f')];return _0x2257ac['define'](_0x0d4a('0x20'),attributes,{'tableName':_0x0d4a('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x596651,_0x1e3d43,_0x5f5591){return getChanSpyPromise(_0x25efaa,_0x596651)[_0x0d4a('0x1e')](function(_0x4385dd){if(_0x4385dd&&_0x4385dd[_0x0d4a('0x17')]){return _0x25efaa[_0x0d4a('0x22')][_0x0d4a('0x23')](_0x4385dd);}})[_0x0d4a('0x1e')](function(){_0x5f5591();})['catch'](function(_0x5b9c37){_0x5f5591(_0x5b9c37);});},'afterUpdate':function(_0x1a1d06,_0x562eeb,_0x57a70d){return _0x25efaa['VoiceExtension'][_0x0d4a('0x24')]({'where':{'ChanSpyId':_0x1a1d06['id']}})['then'](function(){return getChanSpyPromise(_0x25efaa,_0x1a1d06);})[_0x0d4a('0x1e')](function(_0x2d607e){if(_0x2d607e&&_0x2d607e[_0x0d4a('0x17')]){return _0x25efaa[_0x0d4a('0x22')][_0x0d4a('0x23')](_0x2d607e);}})['then'](function(){_0x57a70d();})[_0x0d4a('0x25')](function(_0x328715){_0x57a70d(_0x328715);});},'afterDestroy':function(_0x249276,_0x29c396,_0x47d9e4){return _0x25efaa[_0x0d4a('0x22')][_0x0d4a('0x24')]({'where':{'ChanSpyId':_0x249276['id']}})[_0x0d4a('0x1e')](function(){_0x47d9e4();})['catch'](function(_0x26fefb){_0x47d9e4(_0x26fefb);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 3376592..f723bb7 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 _0x22cc=['VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x258df6,_0x3b376e){var _0x3e37d2=function(_0x10405d){while(--_0x10405d){_0x258df6['push'](_0x258df6['shift']());}};_0x3e37d2(++_0x3b376e);}(_0x22cc,0xbe));var _0xc22c=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x22cc[_0x469a3c];return _0x968f4;};'use strict';var _=require(_0xc22c('0x0'));var util=require(_0xc22c('0x1'));var moment=require(_0xc22c('0x2'));var BPromise=require(_0xc22c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc22c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc22c('0x5'));var logger=require(_0xc22c('0x6'))(_0xc22c('0x7'));var config=require('../../config/environment');var jayson=require(_0xc22c('0x8'));var client=jayson[_0xc22c('0x9')][_0xc22c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32e71e,_0xde0daa,_0x5eaa31){return new BPromise(function(_0x5a772e,_0x5316c8){return client[_0xc22c('0xb')](_0x32e71e,_0x5eaa31)[_0xc22c('0xc')](function(_0x5ccfe0){logger[_0xc22c('0xd')](_0xc22c('0xe'),_0xde0daa,_0xc22c('0xf'));logger[_0xc22c('0x10')](_0xc22c('0x11'),_0xde0daa,_0xc22c('0xf'),JSON[_0xc22c('0x12')](_0x5ccfe0));if(_0x5ccfe0[_0xc22c('0x13')]){if(_0x5ccfe0[_0xc22c('0x13')][_0xc22c('0x14')]===0x1f4){logger[_0xc22c('0x13')](_0xc22c('0xe'),_0xde0daa,_0x5ccfe0[_0xc22c('0x13')][_0xc22c('0x15')]);return _0x5316c8(_0x5ccfe0['error']['message']);}logger['error'](_0xc22c('0xe'),_0xde0daa,_0x5ccfe0[_0xc22c('0x13')][_0xc22c('0x15')]);return _0x5a772e(_0x5ccfe0[_0xc22c('0x13')][_0xc22c('0x15')]);}else{logger[_0xc22c('0xd')](_0xc22c('0xe'),_0xde0daa,_0xc22c('0xf'));_0x5a772e(_0x5ccfe0[_0xc22c('0x16')][_0xc22c('0x15')]);}})['catch'](function(_0x33603e){logger[_0xc22c('0x13')](_0xc22c('0xe'),_0xde0daa,_0x33603e);_0x5316c8(_0x33603e);});});} \ No newline at end of file +var _0x052a=['request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2f5172,_0x17b4c3){var _0x1c846d=function(_0x4b45dc){while(--_0x4b45dc){_0x2f5172['push'](_0x2f5172['shift']());}};_0x1c846d(++_0x17b4c3);}(_0x052a,0x1d4));var _0xa052=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0x052a[_0x555b2f];return _0x81c0a6;};'use strict';var _=require('lodash');var util=require(_0xa052('0x0'));var moment=require('moment');var BPromise=require(_0xa052('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa052('0x2'))['db'];var utils=require(_0xa052('0x3'));var logger=require('../../config/logger')(_0xa052('0x4'));var config=require(_0xa052('0x5'));var jayson=require(_0xa052('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49b4d0,_0x329eaa,_0x184f86){return new BPromise(function(_0x5db4df,_0x1d8871){return client[_0xa052('0x7')](_0x49b4d0,_0x184f86)[_0xa052('0x8')](function(_0x1c05f2){logger['info'](_0xa052('0x9'),_0x329eaa,_0xa052('0xa'));logger[_0xa052('0xb')](_0xa052('0xc'),_0x329eaa,_0xa052('0xa'),JSON[_0xa052('0xd')](_0x1c05f2));if(_0x1c05f2[_0xa052('0xe')]){if(_0x1c05f2[_0xa052('0xe')][_0xa052('0xf')]===0x1f4){logger[_0xa052('0xe')](_0xa052('0x9'),_0x329eaa,_0x1c05f2[_0xa052('0xe')][_0xa052('0x10')]);return _0x1d8871(_0x1c05f2['error']['message']);}logger[_0xa052('0xe')](_0xa052('0x9'),_0x329eaa,_0x1c05f2[_0xa052('0xe')][_0xa052('0x10')]);return _0x5db4df(_0x1c05f2[_0xa052('0xe')][_0xa052('0x10')]);}else{logger['info'](_0xa052('0x9'),_0x329eaa,'request\x20sent');_0x5db4df(_0x1c05f2[_0xa052('0x11')][_0xa052('0x10')]);}})[_0xa052('0x12')](function(_0x24bf80){logger[_0xa052('0xe')](_0xa052('0x9'),_0x329eaa,_0x24bf80);_0x1d8871(_0x24bf80);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 54127bd..b97dedc 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 _0xebac=['create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','show','post'];(function(_0x48bce6,_0x39cd70){var _0x522537=function(_0x574f99){while(--_0x574f99){_0x48bce6['push'](_0x48bce6['shift']());}};_0x522537(++_0x39cd70);}(_0xebac,0xd6));var _0xceba=function(_0x514969,_0x568fb0){_0x514969=_0x514969-0x0;var _0x326d9f=_0xebac[_0x514969];return _0x326d9f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xceba('0x0'));var timeout=require(_0xceba('0x1'));var express=require(_0xceba('0x2'));var router=express[_0xceba('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xceba('0x4'));var config=require(_0xceba('0x5'));var controller=require('./voiceContext.controller');router['get']('/',auth[_0xceba('0x6')](),controller['index']);router['get'](_0xceba('0x7'),auth[_0xceba('0x6')](),controller[_0xceba('0x8')]);router[_0xceba('0x9')]('/',auth['isAuthenticated'](),controller[_0xceba('0xa')]);router[_0xceba('0xb')](_0xceba('0x7'),auth[_0xceba('0x6')](),controller[_0xceba('0xc')]);router[_0xceba('0xd')]('/:id',auth[_0xceba('0x6')](),controller[_0xceba('0xe')]);module[_0xceba('0xf')]=router; \ No newline at end of file +var _0x0b85=['index','show','create','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','./voiceContext.controller','get'];(function(_0x148b18,_0x4647ae){var _0x367064=function(_0x23d7b6){while(--_0x23d7b6){_0x148b18['push'](_0x148b18['shift']());}};_0x367064(++_0x4647ae);}(_0x0b85,0x1a1));var _0x50b8=function(_0x4cd86e,_0x5a1225){_0x4cd86e=_0x4cd86e-0x0;var _0x46d50b=_0x0b85[_0x4cd86e];return _0x46d50b;};'use strict';var multer=require(_0x50b8('0x0'));var util=require(_0x50b8('0x1'));var path=require(_0x50b8('0x2'));var timeout=require('connect-timeout');var express=require(_0x50b8('0x3'));var router=express[_0x50b8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x50b8('0x5'));var config=require('../../config/environment');var controller=require(_0x50b8('0x6'));router[_0x50b8('0x7')]('/',auth['isAuthenticated'](),controller[_0x50b8('0x8')]);router[_0x50b8('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x50b8('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x50b8('0xa')]);router[_0x50b8('0xb')](_0x50b8('0xc'),auth[_0x50b8('0xd')](),controller[_0x50b8('0xe')]);router[_0x50b8('0xf')]('/:id',auth[_0x50b8('0xd')](),controller[_0x50b8('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 573fd1d..299a8f3 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 _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0xaf4bc1,_0x25891f){var _0x16fa6=function(_0x19d784){while(--_0x19d784){_0xaf4bc1['push'](_0xaf4bc1['shift']());}};_0x16fa6(++_0x25891f);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x18df30,_0x34a297){var _0x436b61=function(_0x20a3a3){while(--_0x20a3a3){_0x18df30['push'](_0x18df30['shift']());}};_0x436b61(++_0x34a297);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'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 1917e70..d67273c 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 _0x24a6=['VIRTUAL','filter','options','includeAll','rows','catch','show','merge','create','body','findAll','readFileSync','join','root','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','UserProfileSection','Contexts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','utf8','render','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','set','Content-Range','save','then','destroy','get','UserProfileResource','name','send','index','map','VoiceContext','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','offset','order','sort','where'];(function(_0x12d562,_0x2d2322){var _0x5c7799=function(_0x58e809){while(--_0x58e809){_0x12d562['push'](_0x12d562['shift']());}};_0x5c7799(++_0x2d2322);}(_0x24a6,0x14f));var _0x624a=function(_0x27fe20,_0x35c673){_0x27fe20=_0x27fe20-0x0;var _0x3c0ea6=_0x24a6[_0x27fe20];return _0x3c0ea6;};'use strict';var pdf=require(_0x624a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x624a('0x1'));var zipdir=require(_0x624a('0x2'));var jsonpatch=require(_0x624a('0x3'));var rp=require(_0x624a('0x4'));var moment=require(_0x624a('0x5'));var BPromise=require(_0x624a('0x6'));var Mustache=require(_0x624a('0x7'));var util=require(_0x624a('0x8'));var path=require(_0x624a('0x9'));var sox=require(_0x624a('0xa'));var csv=require(_0x624a('0xb'));var ejs=require(_0x624a('0xc'));var fs=require('fs');var _=require(_0x624a('0xd'));var squel=require(_0x624a('0xe'));var crypto=require(_0x624a('0xf'));var jsforce=require(_0x624a('0x10'));var deskjs=require(_0x624a('0x11'));var toCsv=require(_0x624a('0xb'));var querystring=require(_0x624a('0x12'));var Papa=require(_0x624a('0x13'));var Redis=require(_0x624a('0x14'));var authService=require(_0x624a('0x15'));var qs=require(_0x624a('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x624a('0x17'))(_0x624a('0x18'));var utils=require(_0x624a('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x624a('0x1a'));var db=require(_0x624a('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10080e,_0x5ee753,_0x26d337,_0x89e2fd){return new BPromise(function(_0xe310b4,_0x1e6ffd){var _0x547e4f=_0x89e2fd||client;return _0x547e4f[_0x624a('0x1c')](_0x10080e,_0x26d337)['then'](function(_0x424200){logger[_0x624a('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x5ee753,_0x624a('0x1e'));logger[_0x624a('0x1f')](_0x624a('0x20'),_0x5ee753,_0x624a('0x1e'),JSON[_0x624a('0x21')](_0x424200));if(_0x424200[_0x624a('0x22')]){if(_0x424200[_0x624a('0x22')][_0x624a('0x23')]===0x1f4){logger[_0x624a('0x22')](_0x624a('0x24'),_0x5ee753,_0x424200['error'][_0x624a('0x25')]);return _0x1e6ffd(_0x424200['error'][_0x624a('0x25')]);}logger['error'](_0x624a('0x24'),_0x5ee753,_0x424200[_0x624a('0x22')][_0x624a('0x25')]);return _0xe310b4(_0x424200[_0x624a('0x22')][_0x624a('0x25')]);}else{logger['info'](_0x624a('0x24'),_0x5ee753,_0x624a('0x1e'));_0xe310b4(_0x424200[_0x624a('0x26')][_0x624a('0x25')]);}})['catch'](function(_0x1a673b){logger[_0x624a('0x22')](_0x624a('0x24'),_0x5ee753,_0x1a673b);_0x1e6ffd(_0x1a673b);});});}function respondWithStatusCode(_0x4ba881,_0x4aee03){_0x4aee03=_0x4aee03||0xcc;return function(_0x56834b){if(_0x56834b){return _0x4ba881[_0x624a('0x27')](_0x4aee03);}return _0x4ba881[_0x624a('0x28')](_0x4aee03)[_0x624a('0x29')]();};}function respondWithResult(_0x26b075,_0x51a817){_0x51a817=_0x51a817||0xc8;return function(_0x5ca99b){if(_0x5ca99b){return _0x26b075[_0x624a('0x28')](_0x51a817)[_0x624a('0x2a')](_0x5ca99b);}};}function respondWithFilteredResult(_0x57eb2e,_0xd0730c){return function(_0x19b8a6){if(_0x19b8a6){var _0x534c41=_0x19b8a6[_0x624a('0x2b')],_0x5366c4=_0xd0730c['offset'],_0x585126=_0xd0730c['offset']+_0xd0730c['limit'],_0x41993c;if(_0x585126>=_0x534c41){_0x585126=_0x534c41;_0x41993c=0xc8;}else{_0x41993c=0xce;}_0x57eb2e[_0x624a('0x28')](_0x41993c);return _0x57eb2e[_0x624a('0x2c')](_0x624a('0x2d'),_0x5366c4+'-'+_0x585126+'/'+_0x534c41)['json'](_0x19b8a6);}return null;};}function patchUpdates(_0x16178d){return function(_0x1ba339){try{jsonpatch['apply'](_0x1ba339,_0x16178d,!![]);}catch(_0x466af4){return BPromise['reject'](_0x466af4);}return _0x1ba339[_0x624a('0x2e')]();};}function saveUpdates(_0x1e775b,_0x22140a){return function(_0x4619a8){if(_0x4619a8){return _0x4619a8['update'](_0x1e775b)[_0x624a('0x2f')](function(_0x16dc8a){return _0x16dc8a;});}return null;};}function removeEntity(_0x5e8983,_0x1310a3){return function(_0x11dcf4){if(_0x11dcf4){return _0x11dcf4[_0x624a('0x30')]()[_0x624a('0x2f')](function(){var _0x3b91ec=_0x11dcf4[_0x624a('0x31')]({'plain':!![]});var _0x4c359c='Contexts';return db[_0x624a('0x32')][_0x624a('0x30')]({'where':{'type':_0x4c359c,'resourceId':_0x3b91ec['id']}})[_0x624a('0x2f')](function(){return _0x11dcf4;});})['then'](function(){_0x5e8983[_0x624a('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54b4f7,_0x5aa5ce){return function(_0x405d29){if(!_0x405d29){_0x54b4f7['sendStatus'](0x194);}return _0x405d29;};}function handleError(_0x190a2b,_0x5e1b54){_0x5e1b54=_0x5e1b54||0x1f4;return function(_0x21df69){logger['error'](_0x21df69['stack']);if(_0x21df69[_0x624a('0x33')]){delete _0x21df69[_0x624a('0x33')];}_0x190a2b[_0x624a('0x28')](_0x5e1b54)[_0x624a('0x34')](_0x21df69);};}exports[_0x624a('0x35')]=function(_0xe4ae90,_0x2128b9){var _0x2016ba={},_0x245ba4={},_0x120b34={'count':0x0,'rows':[]};var _0x5647a8=_[_0x624a('0x36')](db[_0x624a('0x37')][_0x624a('0x38')],function(_0x4e44bb){return{'name':_0x4e44bb[_0x624a('0x39')],'type':_0x4e44bb['type'][_0x624a('0x3a')]};});_0x245ba4[_0x624a('0x3b')]=_[_0x624a('0x36')](_0x5647a8,_0x624a('0x33'));_0x245ba4[_0x624a('0x3c')]=_[_0x624a('0x3d')](_0xe4ae90['query']);_0x245ba4[_0x624a('0x3e')]=_[_0x624a('0x3f')](_0x245ba4[_0x624a('0x3b')],_0x245ba4['query']);_0x2016ba[_0x624a('0x40')]=_['intersection'](_0x245ba4['model'],qs[_0x624a('0x41')](_0xe4ae90[_0x624a('0x3c')][_0x624a('0x41')]));_0x2016ba['attributes']=_0x2016ba['attributes'][_0x624a('0x42')]?_0x2016ba[_0x624a('0x40')]:_0x245ba4['model'];if(!_0xe4ae90[_0x624a('0x3c')][_0x624a('0x43')]('nolimit')){_0x2016ba[_0x624a('0x44')]=qs[_0x624a('0x44')](_0xe4ae90[_0x624a('0x3c')][_0x624a('0x44')]);_0x2016ba['offset']=qs['offset'](_0xe4ae90['query'][_0x624a('0x45')]);}_0x2016ba[_0x624a('0x46')]=qs[_0x624a('0x47')](_0xe4ae90[_0x624a('0x3c')][_0x624a('0x47')]);_0x2016ba[_0x624a('0x48')]=qs[_0x624a('0x3e')](_['pick'](_0xe4ae90[_0x624a('0x3c')],_0x245ba4[_0x624a('0x3e')]),_0x5647a8);if(_0xe4ae90['query']['filter']){_0x2016ba[_0x624a('0x48')]=_['merge'](_0x2016ba[_0x624a('0x48')],{'$or':_[_0x624a('0x36')](_0x5647a8,function(_0x935e19){if(_0x935e19['type']!==_0x624a('0x49')){var _0x34c334={};_0x34c334[_0x935e19[_0x624a('0x33')]]={'$like':'%'+_0xe4ae90[_0x624a('0x3c')][_0x624a('0x4a')]+'%'};return _0x34c334;}})});}_0x2016ba=_['merge']({},_0x2016ba,_0xe4ae90[_0x624a('0x4b')]);var _0x295834={'where':_0x2016ba[_0x624a('0x48')]};return db['VoiceContext'][_0x624a('0x2b')](_0x295834)[_0x624a('0x2f')](function(_0x1fd2ef){_0x120b34[_0x624a('0x2b')]=_0x1fd2ef;if(_0xe4ae90[_0x624a('0x3c')][_0x624a('0x4c')]){_0x2016ba['include']=[{'all':!![]}];}return db[_0x624a('0x37')]['findAll'](_0x2016ba);})['then'](function(_0x4b5e3a){_0x120b34[_0x624a('0x4d')]=_0x4b5e3a;return _0x120b34;})[_0x624a('0x2f')](respondWithFilteredResult(_0x2128b9,_0x2016ba))[_0x624a('0x4e')](handleError(_0x2128b9,null));};exports[_0x624a('0x4f')]=function(_0x5312ec,_0x18c318){var _0x4283ff={'raw':![],'where':{'id':_0x5312ec['params']['id']}},_0x6528a0={};_0x6528a0['model']=_[_0x624a('0x3d')](db[_0x624a('0x37')][_0x624a('0x38')]);_0x6528a0[_0x624a('0x3c')]=_[_0x624a('0x3d')](_0x5312ec[_0x624a('0x3c')]);_0x6528a0['filters']=_[_0x624a('0x3f')](_0x6528a0[_0x624a('0x3b')],_0x6528a0['query']);_0x4283ff[_0x624a('0x40')]=_[_0x624a('0x3f')](_0x6528a0[_0x624a('0x3b')],qs[_0x624a('0x41')](_0x5312ec[_0x624a('0x3c')][_0x624a('0x41')]));_0x4283ff['attributes']=_0x4283ff[_0x624a('0x40')][_0x624a('0x42')]?_0x4283ff['attributes']:_0x6528a0[_0x624a('0x3b')];if(_0x5312ec[_0x624a('0x3c')][_0x624a('0x4c')]){_0x4283ff['include']=[{'all':!![]}];}_0x4283ff=_[_0x624a('0x50')]({},_0x4283ff,_0x5312ec[_0x624a('0x4b')]);return db[_0x624a('0x37')]['find'](_0x4283ff)['then'](handleEntityNotFound(_0x18c318,null))['then'](respondWithResult(_0x18c318,null))[_0x624a('0x4e')](handleError(_0x18c318,null));};exports[_0x624a('0x51')]=function(_0x208a9d,_0x3c116f,_0x1f7c86){var _0x5cb149;return db[_0x624a('0x37')][_0x624a('0x51')](_0x208a9d[_0x624a('0x52')],{'raw':!![]})[_0x624a('0x2f')](function(_0x579dd0){_0x5cb149=_0x579dd0;return db['VoiceContext'][_0x624a('0x53')]({'raw':!![]});})[_0x624a('0x2f')](function(_0x507e14){var _0x524874=fs[_0x624a('0x54')](path[_0x624a('0x55')](config[_0x624a('0x56')],'server/files/templates/context.ejs'),'utf8');var _0x381cf1=ejs['render'](_0x524874,{'contexts':_0x507e14||[]});fs[_0x624a('0x57')](_0x624a('0x58'),_0x381cf1);})[_0x624a('0x2f')](function(){return respondWithRpcPromise(_0x624a('0x59'),'create',{'module':_0x624a('0x5a')});})[_0x624a('0x2f')](function(){var _0x2e65fd=_0x208a9d[_0x624a('0x5b')][_0x624a('0x31')]({'plain':!![]});if(!_0x2e65fd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e65fd[_0x624a('0x5c')]===_0x624a('0x5b')){var _0x466078=_0x5cb149[_0x624a('0x31')]({'plain':!![]});return db[_0x624a('0x5d')]['find']({'where':{'name':_0x624a('0x5e'),'userProfileId':_0x2e65fd['userProfileId']},'raw':!![]})[_0x624a('0x2f')](function(_0xbe911d){if(_0xbe911d&&_0xbe911d[_0x624a('0x5f')]===0x0){return db[_0x624a('0x32')][_0x624a('0x51')]({'name':_0x466078[_0x624a('0x33')],'resourceId':_0x466078['id'],'type':_0xbe911d[_0x624a('0x33')],'sectionId':_0xbe911d['id']},{})[_0x624a('0x2f')](function(){return _0x5cb149;});}else{return _0x5cb149;}})[_0x624a('0x4e')](function(_0x4983da){logger[_0x624a('0x22')](_0x624a('0x60'),_0x4983da);throw _0x4983da;});}return _0x5cb149;})[_0x624a('0x2f')](respondWithResult(_0x3c116f,0xc9))[_0x624a('0x4e')](handleError(_0x3c116f,null));};exports[_0x624a('0x61')]=function(_0x4b0f4a,_0x593b08,_0x48b3b5){var _0x3d3e3b;return db['VoiceContext'][_0x624a('0x62')]({'where':{'id':_0x4b0f4a['params']['id']}})['then'](handleEntityNotFound(_0x593b08,null))[_0x624a('0x2f')](saveUpdates(_0x4b0f4a[_0x624a('0x52')],null))[_0x624a('0x2f')](function(_0x563621){if(_0x563621){_0x3d3e3b=_0x563621;return db[_0x624a('0x37')][_0x624a('0x53')]({'raw':!![]});}})['then'](function(_0x53541f){var _0x3a2286=fs[_0x624a('0x54')](path[_0x624a('0x55')](config[_0x624a('0x56')],'server/files/templates/context.ejs'),_0x624a('0x63'));var _0x435ec7=ejs[_0x624a('0x64')](_0x3a2286,{'contexts':_0x53541f||[]});fs['writeFileSync'](_0x624a('0x58'),_0x435ec7);})[_0x624a('0x2f')](function(){return respondWithRpcPromise(_0x624a('0x59'),_0x624a('0x61'),{'module':_0x624a('0x5a')});})['then'](function(){return _0x3d3e3b;})[_0x624a('0x2f')](respondWithResult(_0x593b08,null))[_0x624a('0x4e')](handleError(_0x593b08,null));};exports[_0x624a('0x30')]=function(_0xbc7733,_0x266c56,_0x321a7c){var _0x45cf4d;return db['VoiceContext'][_0x624a('0x62')]({'where':{'id':_0xbc7733[_0x624a('0x65')]['id']}})[_0x624a('0x2f')](handleEntityNotFound(_0x266c56,null))[_0x624a('0x2f')](removeEntity(_0x266c56,null))[_0x624a('0x2f')](function(){return db[_0x624a('0x37')][_0x624a('0x53')]({'raw':!![]});})[_0x624a('0x2f')](function(_0x5eae90){var _0x2de6d6=fs[_0x624a('0x54')](path[_0x624a('0x55')](config[_0x624a('0x56')],'server/files/templates/context.ejs'),'utf8');var _0x29d61c=ejs[_0x624a('0x64')](_0x2de6d6,{'contexts':_0x5eae90});fs['writeFileSync'](_0x624a('0x58'),_0x29d61c);return respondWithRpcPromise(_0x624a('0x59'),_0x624a('0x30'),{'module':_0x624a('0x5a')});})[_0x624a('0x4e')](handleError(_0x266c56,null));}; \ No newline at end of file +var _0x2bd6=['stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','get','Contexts','destroy','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','VoiceContext','includeAll','include','findAll','rows','show','keys','find','create','body','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','utf8','chan_sip.so','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../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'];(function(_0x511e84,_0x4b7808){var _0x374900=function(_0x18bc73){while(--_0x18bc73){_0x511e84['push'](_0x511e84['shift']());}};_0x374900(++_0x4b7808);}(_0x2bd6,0x1f4));var _0x62bd=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x2bd6[_0x45e98e];return _0x374dba;};'use strict';var pdf=require(_0x62bd('0x0'));var emlformat=require(_0x62bd('0x1'));var rimraf=require(_0x62bd('0x2'));var zipdir=require(_0x62bd('0x3'));var jsonpatch=require(_0x62bd('0x4'));var rp=require('request-promise');var moment=require(_0x62bd('0x5'));var BPromise=require(_0x62bd('0x6'));var Mustache=require(_0x62bd('0x7'));var util=require('util');var path=require(_0x62bd('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x62bd('0x9'));var fs=require('fs');var _=require(_0x62bd('0xa'));var squel=require('squel');var crypto=require(_0x62bd('0xb'));var jsforce=require(_0x62bd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x62bd('0xd'));var querystring=require(_0x62bd('0xe'));var Papa=require(_0x62bd('0xf'));var Redis=require(_0x62bd('0x10'));var authService=require(_0x62bd('0x11'));var qs=require(_0x62bd('0x12'));var as=require(_0x62bd('0x13'));var hardwareService=require(_0x62bd('0x14'));var logger=require(_0x62bd('0x15'))(_0x62bd('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x62bd('0x17'));var db=require(_0x62bd('0x18'))['db'];var jayson=require(_0x62bd('0x19'));var client=jayson[_0x62bd('0x1a')][_0x62bd('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xb46500,_0x549520,_0x12815e,_0x5d42f8){return new BPromise(function(_0x1b751c,_0x5dc408){var _0x4bc2d9=_0x5d42f8||client;return _0x4bc2d9[_0x62bd('0x1c')](_0xb46500,_0x12815e)[_0x62bd('0x1d')](function(_0x5260f9){logger[_0x62bd('0x1e')](_0x62bd('0x1f'),_0x549520,_0x62bd('0x20'));logger[_0x62bd('0x21')](_0x62bd('0x22'),_0x549520,'request\x20sent',JSON[_0x62bd('0x23')](_0x5260f9));if(_0x5260f9[_0x62bd('0x24')]){if(_0x5260f9[_0x62bd('0x24')][_0x62bd('0x25')]===0x1f4){logger['error'](_0x62bd('0x1f'),_0x549520,_0x5260f9[_0x62bd('0x24')][_0x62bd('0x26')]);return _0x5dc408(_0x5260f9[_0x62bd('0x24')]['message']);}logger[_0x62bd('0x24')](_0x62bd('0x1f'),_0x549520,_0x5260f9[_0x62bd('0x24')][_0x62bd('0x26')]);return _0x1b751c(_0x5260f9['error'][_0x62bd('0x26')]);}else{logger[_0x62bd('0x1e')](_0x62bd('0x1f'),_0x549520,_0x62bd('0x20'));_0x1b751c(_0x5260f9['result'][_0x62bd('0x26')]);}})[_0x62bd('0x27')](function(_0xc1c37){logger[_0x62bd('0x24')](_0x62bd('0x1f'),_0x549520,_0xc1c37);_0x5dc408(_0xc1c37);});});}function respondWithStatusCode(_0x10fad2,_0x245628){_0x245628=_0x245628||0xcc;return function(_0x304cf0){if(_0x304cf0){return _0x10fad2[_0x62bd('0x28')](_0x245628);}return _0x10fad2[_0x62bd('0x29')](_0x245628)[_0x62bd('0x2a')]();};}function respondWithResult(_0x2f5c03,_0x45e4f2){_0x45e4f2=_0x45e4f2||0xc8;return function(_0x528b43){if(_0x528b43){return _0x2f5c03[_0x62bd('0x29')](_0x45e4f2)[_0x62bd('0x2b')](_0x528b43);}};}function respondWithFilteredResult(_0x5bce54,_0x2f1d83){return function(_0x3c6761){if(_0x3c6761){var _0x1f6339=_0x3c6761[_0x62bd('0x2c')],_0x56890f=_0x2f1d83[_0x62bd('0x2d')],_0x191063=_0x2f1d83[_0x62bd('0x2d')]+_0x2f1d83[_0x62bd('0x2e')],_0x205d78;if(_0x191063>=_0x1f6339){_0x191063=_0x1f6339;_0x205d78=0xc8;}else{_0x205d78=0xce;}_0x5bce54[_0x62bd('0x29')](_0x205d78);return _0x5bce54[_0x62bd('0x2f')](_0x62bd('0x30'),_0x56890f+'-'+_0x191063+'/'+_0x1f6339)['json'](_0x3c6761);}return null;};}function patchUpdates(_0x31ad61){return function(_0x2e689b){try{jsonpatch[_0x62bd('0x31')](_0x2e689b,_0x31ad61,!![]);}catch(_0x380193){return BPromise[_0x62bd('0x32')](_0x380193);}return _0x2e689b[_0x62bd('0x33')]();};}function saveUpdates(_0x52ed97,_0x310254){return function(_0x2ea583){if(_0x2ea583){return _0x2ea583[_0x62bd('0x34')](_0x52ed97)[_0x62bd('0x1d')](function(_0x1e81f1){return _0x1e81f1;});}return null;};}function removeEntity(_0x578ed4,_0x2d64e7){return function(_0x4ec3b3){if(_0x4ec3b3){return _0x4ec3b3['destroy']()[_0x62bd('0x1d')](function(){var _0x203b53=_0x4ec3b3[_0x62bd('0x35')]({'plain':!![]});var _0xb4e444=_0x62bd('0x36');return db['UserProfileResource'][_0x62bd('0x37')]({'where':{'type':_0xb4e444,'resourceId':_0x203b53['id']}})[_0x62bd('0x1d')](function(){return _0x4ec3b3;});})[_0x62bd('0x1d')](function(){_0x578ed4[_0x62bd('0x29')](0xcc)[_0x62bd('0x2a')]();});}};}function handleEntityNotFound(_0x2cb56a,_0x1f8c9d){return function(_0x171901){if(!_0x171901){_0x2cb56a[_0x62bd('0x28')](0x194);}return _0x171901;};}function handleError(_0x58d484,_0x193a5e){_0x193a5e=_0x193a5e||0x1f4;return function(_0x5e1f7a){logger[_0x62bd('0x24')](_0x5e1f7a['stack']);if(_0x5e1f7a[_0x62bd('0x38')]){delete _0x5e1f7a[_0x62bd('0x38')];}_0x58d484['status'](_0x193a5e)[_0x62bd('0x39')](_0x5e1f7a);};}exports[_0x62bd('0x3a')]=function(_0x2a0382,_0x1e25f5){var _0x3cffd0={},_0x317f7e={},_0x1aed2e={'count':0x0,'rows':[]};var _0x24f756=_['map'](db['VoiceContext'][_0x62bd('0x3b')],function(_0x341fca){return{'name':_0x341fca[_0x62bd('0x3c')],'type':_0x341fca[_0x62bd('0x3d')][_0x62bd('0x3e')]};});_0x317f7e[_0x62bd('0x3f')]=_[_0x62bd('0x40')](_0x24f756,'name');_0x317f7e[_0x62bd('0x41')]=_['keys'](_0x2a0382[_0x62bd('0x41')]);_0x317f7e[_0x62bd('0x42')]=_[_0x62bd('0x43')](_0x317f7e[_0x62bd('0x3f')],_0x317f7e[_0x62bd('0x41')]);_0x3cffd0['attributes']=_[_0x62bd('0x43')](_0x317f7e[_0x62bd('0x3f')],qs[_0x62bd('0x44')](_0x2a0382['query'][_0x62bd('0x44')]));_0x3cffd0['attributes']=_0x3cffd0[_0x62bd('0x45')][_0x62bd('0x46')]?_0x3cffd0[_0x62bd('0x45')]:_0x317f7e[_0x62bd('0x3f')];if(!_0x2a0382[_0x62bd('0x41')][_0x62bd('0x47')](_0x62bd('0x48'))){_0x3cffd0[_0x62bd('0x2e')]=qs[_0x62bd('0x2e')](_0x2a0382[_0x62bd('0x41')][_0x62bd('0x2e')]);_0x3cffd0['offset']=qs[_0x62bd('0x2d')](_0x2a0382[_0x62bd('0x41')][_0x62bd('0x2d')]);}_0x3cffd0[_0x62bd('0x49')]=qs[_0x62bd('0x4a')](_0x2a0382[_0x62bd('0x41')][_0x62bd('0x4a')]);_0x3cffd0[_0x62bd('0x4b')]=qs[_0x62bd('0x42')](_[_0x62bd('0x4c')](_0x2a0382[_0x62bd('0x41')],_0x317f7e[_0x62bd('0x42')]),_0x24f756);if(_0x2a0382[_0x62bd('0x41')][_0x62bd('0x4d')]){_0x3cffd0[_0x62bd('0x4b')]=_['merge'](_0x3cffd0['where'],{'$or':_[_0x62bd('0x40')](_0x24f756,function(_0x5694e7){if(_0x5694e7[_0x62bd('0x3d')]!==_0x62bd('0x4e')){var _0x39202e={};_0x39202e[_0x5694e7[_0x62bd('0x38')]]={'$like':'%'+_0x2a0382[_0x62bd('0x41')][_0x62bd('0x4d')]+'%'};return _0x39202e;}})});}_0x3cffd0=_[_0x62bd('0x4f')]({},_0x3cffd0,_0x2a0382[_0x62bd('0x50')]);var _0x4b7590={'where':_0x3cffd0['where']};return db[_0x62bd('0x51')][_0x62bd('0x2c')](_0x4b7590)[_0x62bd('0x1d')](function(_0x3d0d52){_0x1aed2e['count']=_0x3d0d52;if(_0x2a0382[_0x62bd('0x41')][_0x62bd('0x52')]){_0x3cffd0[_0x62bd('0x53')]=[{'all':!![]}];}return db[_0x62bd('0x51')][_0x62bd('0x54')](_0x3cffd0);})[_0x62bd('0x1d')](function(_0x51ce41){_0x1aed2e[_0x62bd('0x55')]=_0x51ce41;return _0x1aed2e;})[_0x62bd('0x1d')](respondWithFilteredResult(_0x1e25f5,_0x3cffd0))[_0x62bd('0x27')](handleError(_0x1e25f5,null));};exports[_0x62bd('0x56')]=function(_0x30660a,_0x3c4f05){var _0x50a908={'raw':![],'where':{'id':_0x30660a['params']['id']}},_0x4dc05f={};_0x4dc05f[_0x62bd('0x3f')]=_[_0x62bd('0x57')](db['VoiceContext'][_0x62bd('0x3b')]);_0x4dc05f[_0x62bd('0x41')]=_[_0x62bd('0x57')](_0x30660a['query']);_0x4dc05f['filters']=_[_0x62bd('0x43')](_0x4dc05f[_0x62bd('0x3f')],_0x4dc05f[_0x62bd('0x41')]);_0x50a908[_0x62bd('0x45')]=_['intersection'](_0x4dc05f['model'],qs[_0x62bd('0x44')](_0x30660a[_0x62bd('0x41')]['fields']));_0x50a908[_0x62bd('0x45')]=_0x50a908[_0x62bd('0x45')][_0x62bd('0x46')]?_0x50a908['attributes']:_0x4dc05f[_0x62bd('0x3f')];if(_0x30660a[_0x62bd('0x41')][_0x62bd('0x52')]){_0x50a908[_0x62bd('0x53')]=[{'all':!![]}];}_0x50a908=_['merge']({},_0x50a908,_0x30660a[_0x62bd('0x50')]);return db[_0x62bd('0x51')][_0x62bd('0x58')](_0x50a908)[_0x62bd('0x1d')](handleEntityNotFound(_0x3c4f05,null))[_0x62bd('0x1d')](respondWithResult(_0x3c4f05,null))['catch'](handleError(_0x3c4f05,null));};exports[_0x62bd('0x59')]=function(_0xf5e0b5,_0x3ed61c,_0x245546){var _0x82f4c7;return db[_0x62bd('0x51')][_0x62bd('0x59')](_0xf5e0b5[_0x62bd('0x5a')],{'raw':!![]})[_0x62bd('0x1d')](function(_0x2ce213){_0x82f4c7=_0x2ce213;return db['VoiceContext'][_0x62bd('0x54')]({'raw':!![]});})[_0x62bd('0x1d')](function(_0x28768c){var _0x7f9fff=fs['readFileSync'](path['join'](config[_0x62bd('0x5b')],_0x62bd('0x5c')),'utf8');var _0x180cf9=ejs[_0x62bd('0x5d')](_0x7f9fff,{'contexts':_0x28768c||[]});fs[_0x62bd('0x5e')](_0x62bd('0x5f'),_0x180cf9);})[_0x62bd('0x1d')](function(){return respondWithRpcPromise(_0x62bd('0x60'),'create',{'module':'chan_sip.so'});})[_0x62bd('0x1d')](function(){var _0x21fa83=_0xf5e0b5[_0x62bd('0x61')][_0x62bd('0x35')]({'plain':!![]});if(!_0x21fa83)throw new Error(_0x62bd('0x62'));if(_0x21fa83['role']==='user'){var _0x9cddf1=_0x82f4c7[_0x62bd('0x35')]({'plain':!![]});return db[_0x62bd('0x63')]['find']({'where':{'name':_0x62bd('0x36'),'userProfileId':_0x21fa83[_0x62bd('0x64')]},'raw':!![]})['then'](function(_0x409b6d){if(_0x409b6d&&_0x409b6d['autoAssociation']===0x0){return db['UserProfileResource'][_0x62bd('0x59')]({'name':_0x9cddf1[_0x62bd('0x38')],'resourceId':_0x9cddf1['id'],'type':_0x409b6d['name'],'sectionId':_0x409b6d['id']},{})['then'](function(){return _0x82f4c7;});}else{return _0x82f4c7;}})[_0x62bd('0x27')](function(_0x20663e){logger[_0x62bd('0x24')](_0x62bd('0x65'),_0x20663e);throw _0x20663e;});}return _0x82f4c7;})['then'](respondWithResult(_0x3ed61c,0xc9))[_0x62bd('0x27')](handleError(_0x3ed61c,null));};exports[_0x62bd('0x34')]=function(_0x95ab4,_0x21e489,_0x180e39){var _0x2501bd;return db['VoiceContext']['find']({'where':{'id':_0x95ab4['params']['id']}})[_0x62bd('0x1d')](handleEntityNotFound(_0x21e489,null))[_0x62bd('0x1d')](saveUpdates(_0x95ab4[_0x62bd('0x5a')],null))[_0x62bd('0x1d')](function(_0x2e053b){if(_0x2e053b){_0x2501bd=_0x2e053b;return db[_0x62bd('0x51')][_0x62bd('0x54')]({'raw':!![]});}})['then'](function(_0x265de5){var _0xaec62d=fs[_0x62bd('0x66')](path[_0x62bd('0x67')](config['root'],_0x62bd('0x5c')),_0x62bd('0x68'));var _0x3ce91c=ejs[_0x62bd('0x5d')](_0xaec62d,{'contexts':_0x265de5||[]});fs[_0x62bd('0x5e')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3ce91c);})['then'](function(){return respondWithRpcPromise(_0x62bd('0x60'),_0x62bd('0x34'),{'module':_0x62bd('0x69')});})[_0x62bd('0x1d')](function(){return _0x2501bd;})['then'](respondWithResult(_0x21e489,null))['catch'](handleError(_0x21e489,null));};exports['destroy']=function(_0x123843,_0x93a9e1,_0x2b7875){var _0x5887c3;return db['VoiceContext']['find']({'where':{'id':_0x123843[_0x62bd('0x6a')]['id']}})[_0x62bd('0x1d')](handleEntityNotFound(_0x93a9e1,null))[_0x62bd('0x1d')](removeEntity(_0x93a9e1,null))['then'](function(){return db[_0x62bd('0x51')]['findAll']({'raw':!![]});})[_0x62bd('0x1d')](function(_0x36b5a0){var _0x5004a1=fs['readFileSync'](path[_0x62bd('0x67')](config[_0x62bd('0x5b')],_0x62bd('0x5c')),_0x62bd('0x68'));var _0x3f9762=ejs[_0x62bd('0x5d')](_0x5004a1,{'contexts':_0x36b5a0});fs[_0x62bd('0x5e')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3f9762);return respondWithRpcPromise(_0x62bd('0x60'),_0x62bd('0x37'),{'module':_0x62bd('0x69')});})[_0x62bd('0x27')](handleError(_0x93a9e1,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 0fb7411..46037f7 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 _0x3024=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','util','api'];(function(_0xa301ed,_0x1344ed){var _0x28d6d9=function(_0x21c110){while(--_0x21c110){_0xa301ed['push'](_0xa301ed['shift']());}};_0x28d6d9(++_0x1344ed);}(_0x3024,0xcf));var _0x4302=function(_0x17ce1b,_0x12cee5){_0x17ce1b=_0x17ce1b-0x0;var _0x383b16=_0x3024[_0x17ce1b];return _0x383b16;};'use strict';var _=require('lodash');var util=require(_0x4302('0x0'));var logger=require('../../config/logger')(_0x4302('0x1'));var moment=require(_0x4302('0x2'));var BPromise=require(_0x4302('0x3'));var rp=require(_0x4302('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4302('0x5'));var config=require(_0x4302('0x6'));var attributes=require(_0x4302('0x7'));module[_0x4302('0x8')]=function(_0x53cf91,_0x1918ac){return _0x53cf91[_0x4302('0x9')](_0x4302('0xa'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x711a=['exports','define','VoiceContext','voice_contexts','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x711a,0xca));var _0xa711=function(_0x51bd72,_0x1bf44b){_0x51bd72=_0x51bd72-0x0;var _0x46c7cb=_0x711a[_0x51bd72];return _0x46c7cb;};'use strict';var _=require(_0xa711('0x0'));var util=require('util');var logger=require(_0xa711('0x1'))(_0xa711('0x2'));var moment=require(_0xa711('0x3'));var BPromise=require(_0xa711('0x4'));var rp=require(_0xa711('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa711('0x6'));var attributes=require('./voiceContext.attributes');module[_0xa711('0x7')]=function(_0x1fe489,_0xdffa9e){return _0x1fe489[_0xa711('0x8')](_0xa711('0x9'),attributes,{'tableName':_0xa711('0xa'),'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 50f8a64..dd5dab7 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 _0xa747=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x176d96,_0x5aba0c){var _0x4b1651=function(_0x136732){while(--_0x136732){_0x176d96['push'](_0x176d96['shift']());}};_0x4b1651(++_0x5aba0c);}(_0xa747,0x12f));var _0x7a74=function(_0xf8f381,_0x34bbb2){_0xf8f381=_0xf8f381-0x0;var _0x1bbfc3=_0xa747[_0xf8f381];return _0x1bbfc3;};'use strict';var _=require(_0x7a74('0x0'));var util=require(_0x7a74('0x1'));var moment=require('moment');var BPromise=require(_0x7a74('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a74('0x3'))['db'];var utils=require(_0x7a74('0x4'));var logger=require(_0x7a74('0x5'))(_0x7a74('0x6'));var config=require(_0x7a74('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7a74('0x8')][_0x7a74('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c0bb0,_0x340909,_0x831e09){return new BPromise(function(_0x44da05,_0x39f476){return client[_0x7a74('0xa')](_0x3c0bb0,_0x831e09)[_0x7a74('0xb')](function(_0x432ba0){logger[_0x7a74('0xc')](_0x7a74('0xd'),_0x340909,'request\x20sent');logger[_0x7a74('0xe')](_0x7a74('0xf'),_0x340909,_0x7a74('0x10'),JSON[_0x7a74('0x11')](_0x432ba0));if(_0x432ba0['error']){if(_0x432ba0[_0x7a74('0x12')][_0x7a74('0x13')]===0x1f4){logger[_0x7a74('0x12')](_0x7a74('0xd'),_0x340909,_0x432ba0[_0x7a74('0x12')][_0x7a74('0x14')]);return _0x39f476(_0x432ba0['error']['message']);}logger[_0x7a74('0x12')](_0x7a74('0xd'),_0x340909,_0x432ba0['error'][_0x7a74('0x14')]);return _0x44da05(_0x432ba0[_0x7a74('0x12')][_0x7a74('0x14')]);}else{logger[_0x7a74('0xc')]('VoiceContext,\x20%s,\x20%s',_0x340909,_0x7a74('0x10'));_0x44da05(_0x432ba0[_0x7a74('0x15')][_0x7a74('0x14')]);}})['catch'](function(_0x12a645){logger['error'](_0x7a74('0xd'),_0x340909,_0x12a645);_0x39f476(_0x12a645);});});} \ No newline at end of file +var _0x23c7=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','lodash','util','bluebird','randomstring'];(function(_0x3d8785,_0x2e9180){var _0x2627d9=function(_0x30ba8d){while(--_0x30ba8d){_0x3d8785['push'](_0x3d8785['shift']());}};_0x2627d9(++_0x2e9180);}(_0x23c7,0x1e0));var _0x723c=function(_0x64382c,_0x2cda49){_0x64382c=_0x64382c-0x0;var _0x2efdc2=_0x23c7[_0x64382c];return _0x2efdc2;};'use strict';var _=require(_0x723c('0x0'));var util=require(_0x723c('0x1'));var moment=require('moment');var BPromise=require(_0x723c('0x2'));var rs=require(_0x723c('0x3'));var fs=require('fs');var Redis=require(_0x723c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x723c('0x5'));var logger=require(_0x723c('0x6'))(_0x723c('0x7'));var config=require('../../config/environment');var jayson=require(_0x723c('0x8'));var client=jayson[_0x723c('0x9')][_0x723c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfdbd25,_0x1e7268,_0x571b79){return new BPromise(function(_0x2747b9,_0x158cb6){return client[_0x723c('0xb')](_0xfdbd25,_0x571b79)[_0x723c('0xc')](function(_0x1ed087){logger['info'](_0x723c('0xd'),_0x1e7268,'request\x20sent');logger[_0x723c('0xe')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1e7268,_0x723c('0xf'),JSON['stringify'](_0x1ed087));if(_0x1ed087['error']){if(_0x1ed087[_0x723c('0x10')][_0x723c('0x11')]===0x1f4){logger[_0x723c('0x10')](_0x723c('0xd'),_0x1e7268,_0x1ed087[_0x723c('0x10')][_0x723c('0x12')]);return _0x158cb6(_0x1ed087[_0x723c('0x10')][_0x723c('0x12')]);}logger[_0x723c('0x10')]('VoiceContext,\x20%s,\x20%s',_0x1e7268,_0x1ed087[_0x723c('0x10')]['message']);return _0x2747b9(_0x1ed087['error'][_0x723c('0x12')]);}else{logger[_0x723c('0x13')]('VoiceContext,\x20%s,\x20%s',_0x1e7268,_0x723c('0xf'));_0x2747b9(_0x1ed087[_0x723c('0x14')]['message']);}})[_0x723c('0x15')](function(_0x5afddd){logger[_0x723c('0x10')](_0x723c('0xd'),_0x1e7268,_0x5afddd);_0x158cb6(_0x5afddd);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 8b11fea..1eb75df 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 _0x24d3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','describe','/:id','post','create','update','exports','multer','util','path'];(function(_0x207235,_0x13d6aa){var _0x50a8c0=function(_0xd8b0a2){while(--_0xd8b0a2){_0x207235['push'](_0x207235['shift']());}};_0x50a8c0(++_0x13d6aa);}(_0x24d3,0xe7));var _0x324d=function(_0x5c8440,_0x262351){_0x5c8440=_0x5c8440-0x0;var _0x301008=_0x24d3[_0x5c8440];return _0x301008;};'use strict';var multer=require(_0x324d('0x0'));var util=require(_0x324d('0x1'));var path=require(_0x324d('0x2'));var timeout=require(_0x324d('0x3'));var express=require(_0x324d('0x4'));var router=express[_0x324d('0x5')]();var auth=require(_0x324d('0x6'));var interaction=require(_0x324d('0x7'));var config=require(_0x324d('0x8'));var controller=require(_0x324d('0x9'));router[_0x324d('0xa')]('/',auth[_0x324d('0xb')](),controller['index']);router[_0x324d('0xa')]('/describe',auth[_0x324d('0xb')](),controller[_0x324d('0xc')]);router['get'](_0x324d('0xd'),auth[_0x324d('0xb')](),controller['show']);router[_0x324d('0xe')]('/',auth['isAuthenticated'](),controller[_0x324d('0xf')]);router['put'](_0x324d('0xd'),auth['isAuthenticated'](),controller[_0x324d('0x10')]);router['delete'](_0x324d('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x324d('0x11')]=router; \ No newline at end of file +var _0xe424=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','destroy','util','path'];(function(_0x55c722,_0x1dc795){var _0x230588=function(_0x3ae35a){while(--_0x3ae35a){_0x55c722['push'](_0x55c722['shift']());}};_0x230588(++_0x1dc795);}(_0xe424,0x167));var _0x4e42=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xe424[_0x3054be];return _0x3df150;};'use strict';var multer=require('multer');var util=require(_0x4e42('0x0'));var path=require(_0x4e42('0x1'));var timeout=require(_0x4e42('0x2'));var express=require(_0x4e42('0x3'));var router=express[_0x4e42('0x4')]();var auth=require(_0x4e42('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4e42('0x6'));var controller=require(_0x4e42('0x7'));router[_0x4e42('0x8')]('/',auth[_0x4e42('0x9')](),controller[_0x4e42('0xa')]);router[_0x4e42('0x8')]('/describe',auth[_0x4e42('0x9')](),controller[_0x4e42('0xb')]);router[_0x4e42('0x8')](_0x4e42('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4e42('0xd')]('/',auth[_0x4e42('0x9')](),controller[_0x4e42('0xe')]);router[_0x4e42('0xf')](_0x4e42('0xc'),auth[_0x4e42('0x9')](),controller[_0x4e42('0x10')]);router[_0x4e42('0x11')](_0x4e42('0xc'),auth[_0x4e42('0x9')](),controller[_0x4e42('0x12')]);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 0f68fc2..81c20f9 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 _0xe41b=['STRING','INTEGER','DATE','sequelize','exports'];(function(_0x15fed2,_0x8bdbc6){var _0x14ff55=function(_0x1c1ff6){while(--_0x1c1ff6){_0x15fed2['push'](_0x15fed2['shift']());}};_0x14ff55(++_0x8bdbc6);}(_0xe41b,0x116));var _0xbe41=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xe41b[_0xd09668];return _0x68726;};'use strict';var Sequelize=require(_0xbe41('0x0'));module[_0xbe41('0x1')]={'privilege':{'type':Sequelize[_0xbe41('0x2')]},'channel':{'type':Sequelize[_0xbe41('0x2')]},'channelstate':{'type':Sequelize[_0xbe41('0x3')]},'channelstatedesc':{'type':Sequelize[_0xbe41('0x2')]},'calleridnum':{'type':Sequelize[_0xbe41('0x2')]},'calleridname':{'type':Sequelize[_0xbe41('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbe41('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbe41('0x3')]},'uniqueid':{'type':Sequelize[_0xbe41('0x2')]},'linkedid':{'type':Sequelize[_0xbe41('0x2')]},'destchannel':{'type':Sequelize[_0xbe41('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xbe41('0x2')]},'destcalleridname':{'type':Sequelize[_0xbe41('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xbe41('0x2')]},'destlanguage':{'type':Sequelize[_0xbe41('0x2')]},'destaccountcode':{'type':Sequelize[_0xbe41('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xbe41('0x3')]},'destuniqueid':{'type':Sequelize[_0xbe41('0x2')]},'destlinkedid':{'type':Sequelize[_0xbe41('0x2')]},'dialstring':{'type':Sequelize[_0xbe41('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xbe41('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xbe41('0x4')]},'lastevent':{'type':Sequelize[_0xbe41('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xbe41('0x3')]},'duration':{'type':Sequelize[_0xbe41('0x3')]},'holdtime':{'type':Sequelize[_0xbe41('0x3')]},'billableseconds':{'type':Sequelize[_0xbe41('0x3')]}}; \ No newline at end of file +var _0xb13f=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x12d7e1,_0x3a4395){var _0xfbe6ba=function(_0x8274a){while(--_0x8274a){_0x12d7e1['push'](_0x12d7e1['shift']());}};_0xfbe6ba(++_0x3a4395);}(_0xb13f,0x112));var _0xfb13=function(_0x4f9f92,_0x1d6eac){_0x4f9f92=_0x4f9f92-0x0;var _0x173b70=_0xb13f[_0x4f9f92];return _0x173b70;};'use strict';var Sequelize=require(_0xfb13('0x0'));module[_0xfb13('0x1')]={'privilege':{'type':Sequelize[_0xfb13('0x2')]},'channel':{'type':Sequelize[_0xfb13('0x2')]},'channelstate':{'type':Sequelize[_0xfb13('0x3')]},'channelstatedesc':{'type':Sequelize[_0xfb13('0x2')]},'calleridnum':{'type':Sequelize[_0xfb13('0x2')]},'calleridname':{'type':Sequelize[_0xfb13('0x2')]},'connectedlinenum':{'type':Sequelize[_0xfb13('0x2')]},'connectedlinename':{'type':Sequelize[_0xfb13('0x2')]},'language':{'type':Sequelize[_0xfb13('0x2')]},'accountcode':{'type':Sequelize[_0xfb13('0x2')]},'context':{'type':Sequelize[_0xfb13('0x2')]},'exten':{'type':Sequelize[_0xfb13('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xfb13('0x2')]},'destchannel':{'type':Sequelize[_0xfb13('0x2')]},'destchannelstate':{'type':Sequelize[_0xfb13('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xfb13('0x2')]},'destcalleridnum':{'type':Sequelize[_0xfb13('0x2')]},'destcalleridname':{'type':Sequelize[_0xfb13('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xfb13('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xfb13('0x2')]},'destlanguage':{'type':Sequelize[_0xfb13('0x2')]},'destaccountcode':{'type':Sequelize[_0xfb13('0x2')]},'destcontext':{'type':Sequelize[_0xfb13('0x2')]},'destexten':{'type':Sequelize[_0xfb13('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xfb13('0x2')]},'destlinkedid':{'type':Sequelize[_0xfb13('0x2')]},'dialstring':{'type':Sequelize[_0xfb13('0x2')]},'dialstatus':{'type':Sequelize[_0xfb13('0x2')]},'starttime':{'type':Sequelize[_0xfb13('0x4')]},'answertime':{'type':Sequelize[_0xfb13('0x4')]},'endtime':{'type':Sequelize[_0xfb13('0x4')]},'lastevent':{'type':Sequelize[_0xfb13('0x2')],'comment':_0xfb13('0x5')},'routeId':{'type':Sequelize[_0xfb13('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xfb13('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 46a1728..23ae180 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 _0x1c38=['type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','find','catch','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','map','VoiceDialReport','rawAttributes','fieldName'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x1c38,0x1dd));var _0x81c3=function(_0x34ed48,_0x2cc995){_0x34ed48=_0x34ed48-0x0;var _0x37da5c=_0x1c38[_0x34ed48];return _0x37da5c;};'use strict';var pdf=require(_0x81c3('0x0'));var emlformat=require(_0x81c3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x81c3('0x2'));var jsonpatch=require(_0x81c3('0x3'));var rp=require('request-promise');var moment=require(_0x81c3('0x4'));var BPromise=require(_0x81c3('0x5'));var Mustache=require(_0x81c3('0x6'));var util=require(_0x81c3('0x7'));var path=require(_0x81c3('0x8'));var sox=require(_0x81c3('0x9'));var csv=require(_0x81c3('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x81c3('0xb'));var squel=require('squel');var crypto=require(_0x81c3('0xc'));var jsforce=require(_0x81c3('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x81c3('0xe'));var Papa=require(_0x81c3('0xf'));var Redis=require(_0x81c3('0x10'));var authService=require(_0x81c3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x81c3('0x12'));var hardwareService=require(_0x81c3('0x13'));var logger=require(_0x81c3('0x14'))(_0x81c3('0x15'));var utils=require(_0x81c3('0x16'));var config=require(_0x81c3('0x17'));var licenseUtil=require(_0x81c3('0x18'));var db=require(_0x81c3('0x19'))['db'];function respondWithStatusCode(_0x53611e,_0xd98581){_0xd98581=_0xd98581||0xcc;return function(_0x1d2e6e){if(_0x1d2e6e){return _0x53611e['sendStatus'](_0xd98581);}return _0x53611e[_0x81c3('0x1a')](_0xd98581)['end']();};}function respondWithResult(_0x11e69a,_0x5387f2){_0x5387f2=_0x5387f2||0xc8;return function(_0x2f2f3d){if(_0x2f2f3d){return _0x11e69a[_0x81c3('0x1a')](_0x5387f2)[_0x81c3('0x1b')](_0x2f2f3d);}};}function respondWithFilteredResult(_0x27978d,_0x2d5340){return function(_0x33453c){if(_0x33453c){var _0xeb100f=_0x33453c[_0x81c3('0x1c')],_0x434797=_0x2d5340[_0x81c3('0x1d')],_0x29338c=_0x2d5340[_0x81c3('0x1d')]+_0x2d5340[_0x81c3('0x1e')],_0x109bab;if(_0x29338c>=_0xeb100f){_0x29338c=_0xeb100f;_0x109bab=0xc8;}else{_0x109bab=0xce;}_0x27978d[_0x81c3('0x1a')](_0x109bab);return _0x27978d[_0x81c3('0x1f')](_0x81c3('0x20'),_0x434797+'-'+_0x29338c+'/'+_0xeb100f)[_0x81c3('0x1b')](_0x33453c);}return null;};}function patchUpdates(_0x1c828f){return function(_0x45b658){try{jsonpatch[_0x81c3('0x21')](_0x45b658,_0x1c828f,!![]);}catch(_0x7b3aa7){return BPromise[_0x81c3('0x22')](_0x7b3aa7);}return _0x45b658[_0x81c3('0x23')]();};}function saveUpdates(_0x2caa36,_0x3b0384){return function(_0x420eeb){if(_0x420eeb){return _0x420eeb[_0x81c3('0x24')](_0x2caa36)['then'](function(_0x188233){return _0x188233;});}return null;};}function removeEntity(_0x515a7d,_0x5b4a2d){return function(_0x146ac2){if(_0x146ac2){return _0x146ac2[_0x81c3('0x25')]()[_0x81c3('0x26')](function(){_0x515a7d[_0x81c3('0x1a')](0xcc)[_0x81c3('0x27')]();});}};}function handleEntityNotFound(_0x5c1158,_0x3ee718){return function(_0x1b62e3){if(!_0x1b62e3){_0x5c1158[_0x81c3('0x28')](0x194);}return _0x1b62e3;};}function handleError(_0x46c340,_0x3cc860){_0x3cc860=_0x3cc860||0x1f4;return function(_0x114ae9){logger[_0x81c3('0x29')](_0x114ae9['stack']);if(_0x114ae9[_0x81c3('0x2a')]){delete _0x114ae9[_0x81c3('0x2a')];}_0x46c340[_0x81c3('0x1a')](_0x3cc860)[_0x81c3('0x2b')](_0x114ae9);};}exports['index']=function(_0x3ce5ed,_0x9c3b45){var _0x59ea43={},_0xf5c85={},_0x363279={'count':0x0,'rows':[]};var _0x4d6da0=_[_0x81c3('0x2c')](db[_0x81c3('0x2d')][_0x81c3('0x2e')],function(_0x21c96c){return{'name':_0x21c96c[_0x81c3('0x2f')],'type':_0x21c96c[_0x81c3('0x30')]['key']};});_0xf5c85[_0x81c3('0x31')]=_[_0x81c3('0x2c')](_0x4d6da0,_0x81c3('0x2a'));_0xf5c85[_0x81c3('0x32')]=_[_0x81c3('0x33')](_0x3ce5ed[_0x81c3('0x32')]);_0xf5c85[_0x81c3('0x34')]=_['intersection'](_0xf5c85[_0x81c3('0x31')],_0xf5c85[_0x81c3('0x32')]);_0x59ea43[_0x81c3('0x35')]=_[_0x81c3('0x36')](_0xf5c85['model'],qs['fields'](_0x3ce5ed[_0x81c3('0x32')][_0x81c3('0x37')]));_0x59ea43[_0x81c3('0x35')]=_0x59ea43['attributes'][_0x81c3('0x38')]?_0x59ea43[_0x81c3('0x35')]:_0xf5c85[_0x81c3('0x31')];if(!_0x3ce5ed[_0x81c3('0x32')][_0x81c3('0x39')](_0x81c3('0x3a'))){_0x59ea43[_0x81c3('0x1e')]=qs[_0x81c3('0x1e')](_0x3ce5ed['query']['limit']);_0x59ea43['offset']=qs[_0x81c3('0x1d')](_0x3ce5ed[_0x81c3('0x32')][_0x81c3('0x1d')]);}_0x59ea43['order']=qs['sort'](_0x3ce5ed[_0x81c3('0x32')][_0x81c3('0x3b')]);_0x59ea43[_0x81c3('0x3c')]=qs[_0x81c3('0x34')](_[_0x81c3('0x3d')](_0x3ce5ed[_0x81c3('0x32')],_0xf5c85['filters']),_0x4d6da0);if(_0x3ce5ed[_0x81c3('0x32')][_0x81c3('0x3e')]){_0x59ea43[_0x81c3('0x3c')]=_['merge'](_0x59ea43['where'],{'$or':_['map'](_0x4d6da0,function(_0x45471e){if(_0x45471e[_0x81c3('0x30')]!==_0x81c3('0x3f')){var _0x2665cc={};_0x2665cc[_0x45471e[_0x81c3('0x2a')]]={'$like':'%'+_0x3ce5ed[_0x81c3('0x32')][_0x81c3('0x3e')]+'%'};return _0x2665cc;}})});}_0x59ea43=_[_0x81c3('0x40')]({},_0x59ea43,_0x3ce5ed[_0x81c3('0x41')]);var _0x38e0ae={'where':_0x59ea43[_0x81c3('0x3c')]};return db[_0x81c3('0x2d')]['count'](_0x38e0ae)[_0x81c3('0x26')](function(_0x3293e3){_0x363279['count']=_0x3293e3;if(_0x3ce5ed[_0x81c3('0x32')][_0x81c3('0x42')]){_0x59ea43[_0x81c3('0x43')]=[{'all':!![]}];}return db[_0x81c3('0x2d')][_0x81c3('0x44')](_0x59ea43);})['then'](function(_0x43456e){_0x363279['rows']=_0x43456e;return _0x363279;})[_0x81c3('0x26')](respondWithFilteredResult(_0x9c3b45,_0x59ea43))['catch'](handleError(_0x9c3b45,null));};exports[_0x81c3('0x45')]=function(_0x418042,_0x137d73){var _0x344c38={'raw':!![],'where':{'id':_0x418042['params']['id']}},_0x5abdf1={};_0x5abdf1[_0x81c3('0x31')]=_[_0x81c3('0x33')](db[_0x81c3('0x2d')]['rawAttributes']);_0x5abdf1[_0x81c3('0x32')]=_[_0x81c3('0x33')](_0x418042[_0x81c3('0x32')]);_0x5abdf1[_0x81c3('0x34')]=_[_0x81c3('0x36')](_0x5abdf1[_0x81c3('0x31')],_0x5abdf1['query']);_0x344c38[_0x81c3('0x35')]=_[_0x81c3('0x36')](_0x5abdf1['model'],qs[_0x81c3('0x37')](_0x418042[_0x81c3('0x32')]['fields']));_0x344c38['attributes']=_0x344c38[_0x81c3('0x35')][_0x81c3('0x38')]?_0x344c38['attributes']:_0x5abdf1[_0x81c3('0x31')];if(_0x418042[_0x81c3('0x32')][_0x81c3('0x42')]){_0x344c38[_0x81c3('0x43')]=[{'all':!![]}];}_0x344c38=_['merge']({},_0x344c38,_0x418042[_0x81c3('0x41')]);return db[_0x81c3('0x2d')][_0x81c3('0x46')](_0x344c38)[_0x81c3('0x26')](handleEntityNotFound(_0x137d73,null))[_0x81c3('0x26')](respondWithResult(_0x137d73,null))[_0x81c3('0x47')](handleError(_0x137d73,null));};exports[_0x81c3('0x48')]=function(_0x506c9e,_0x4958e0){return db[_0x81c3('0x2d')][_0x81c3('0x48')](_0x506c9e[_0x81c3('0x49')],{})[_0x81c3('0x26')](respondWithResult(_0x4958e0,0xc9))[_0x81c3('0x47')](handleError(_0x4958e0,null));};exports[_0x81c3('0x24')]=function(_0x3e9d11,_0x4ec915){if(_0x3e9d11[_0x81c3('0x49')]['id']){delete _0x3e9d11['body']['id'];}return db[_0x81c3('0x2d')][_0x81c3('0x46')]({'where':{'id':_0x3e9d11['params']['id']}})[_0x81c3('0x26')](handleEntityNotFound(_0x4ec915,null))[_0x81c3('0x26')](saveUpdates(_0x3e9d11[_0x81c3('0x49')],null))['then'](respondWithResult(_0x4ec915,null))[_0x81c3('0x47')](handleError(_0x4ec915,null));};exports['destroy']=function(_0x2b5ef9,_0x4f9ffb){return db[_0x81c3('0x2d')][_0x81c3('0x46')]({'where':{'id':_0x2b5ef9['params']['id']}})[_0x81c3('0x26')](handleEntityNotFound(_0x4f9ffb,null))[_0x81c3('0x26')](removeEntity(_0x4f9ffb,null))['catch'](handleError(_0x4f9ffb,null));};exports[_0x81c3('0x4a')]=function(_0x33121a,_0xf0d1f){return db[_0x81c3('0x2d')]['describe']()[_0x81c3('0x26')](respondWithResult(_0xf0d1f,null))[_0x81c3('0x47')](handleError(_0xf0d1f,null));}; \ No newline at end of file +var _0x1505=['../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','length','hasOwnProperty','nolimit','offset','sort','where','filter','merge','options','count','includeAll','VoiceDialReport','findAll','catch','show','params','intersection','fields','include','find','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','lodash','squel','to-csv','querystring','../../components/auth/service'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x1505,0x7e));var _0x5150=function(_0x481c28,_0x19280a){_0x481c28=_0x481c28-0x0;var _0x39b5e9=_0x1505[_0x481c28];return _0x39b5e9;};'use strict';var pdf=require(_0x5150('0x0'));var emlformat=require(_0x5150('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5150('0x2'));var jsonpatch=require(_0x5150('0x3'));var rp=require('request-promise');var moment=require(_0x5150('0x4'));var BPromise=require(_0x5150('0x5'));var Mustache=require(_0x5150('0x6'));var util=require(_0x5150('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5150('0x8'));var fs=require('fs');var _=require(_0x5150('0x9'));var squel=require(_0x5150('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5150('0xb'));var querystring=require(_0x5150('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5150('0xd'));var qs=require(_0x5150('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5150('0xf'));var logger=require('../../config/logger')(_0x5150('0x10'));var utils=require(_0x5150('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x5150('0x12'));var db=require(_0x5150('0x13'))['db'];function respondWithStatusCode(_0xd80582,_0x21d340){_0x21d340=_0x21d340||0xcc;return function(_0x375054){if(_0x375054){return _0xd80582[_0x5150('0x14')](_0x21d340);}return _0xd80582[_0x5150('0x15')](_0x21d340)[_0x5150('0x16')]();};}function respondWithResult(_0x53b738,_0x5a254a){_0x5a254a=_0x5a254a||0xc8;return function(_0x1dd56c){if(_0x1dd56c){return _0x53b738['status'](_0x5a254a)[_0x5150('0x17')](_0x1dd56c);}};}function respondWithFilteredResult(_0xc11740,_0x4e445f){return function(_0x2821d3){if(_0x2821d3){var _0x47bfca=_0x2821d3['count'],_0x3c3e42=_0x4e445f['offset'],_0x1fb8fd=_0x4e445f['offset']+_0x4e445f[_0x5150('0x18')],_0x4a9f7e;if(_0x1fb8fd>=_0x47bfca){_0x1fb8fd=_0x47bfca;_0x4a9f7e=0xc8;}else{_0x4a9f7e=0xce;}_0xc11740[_0x5150('0x15')](_0x4a9f7e);return _0xc11740[_0x5150('0x19')](_0x5150('0x1a'),_0x3c3e42+'-'+_0x1fb8fd+'/'+_0x47bfca)[_0x5150('0x17')](_0x2821d3);}return null;};}function patchUpdates(_0x4a063c){return function(_0x1de32a){try{jsonpatch[_0x5150('0x1b')](_0x1de32a,_0x4a063c,!![]);}catch(_0x3253e9){return BPromise[_0x5150('0x1c')](_0x3253e9);}return _0x1de32a[_0x5150('0x1d')]();};}function saveUpdates(_0x151a24,_0x4de0e1){return function(_0x71cb52){if(_0x71cb52){return _0x71cb52[_0x5150('0x1e')](_0x151a24)[_0x5150('0x1f')](function(_0x64cdd6){return _0x64cdd6;});}return null;};}function removeEntity(_0xafc6a6,_0x48144c){return function(_0x1e1012){if(_0x1e1012){return _0x1e1012[_0x5150('0x20')]()[_0x5150('0x1f')](function(){_0xafc6a6[_0x5150('0x15')](0xcc)[_0x5150('0x16')]();});}};}function handleEntityNotFound(_0x4ee0d2,_0x45031d){return function(_0x3633ca){if(!_0x3633ca){_0x4ee0d2[_0x5150('0x14')](0x194);}return _0x3633ca;};}function handleError(_0x20f7ad,_0x463850){_0x463850=_0x463850||0x1f4;return function(_0x330bc0){logger[_0x5150('0x21')](_0x330bc0[_0x5150('0x22')]);if(_0x330bc0[_0x5150('0x23')]){delete _0x330bc0[_0x5150('0x23')];}_0x20f7ad[_0x5150('0x15')](_0x463850)[_0x5150('0x24')](_0x330bc0);};}exports[_0x5150('0x25')]=function(_0x555b94,_0x1ff17c){var _0x32ec7b={},_0x2352d7={},_0x4da7dc={'count':0x0,'rows':[]};var _0x205a76=_[_0x5150('0x26')](db['VoiceDialReport'][_0x5150('0x27')],function(_0x17244e){return{'name':_0x17244e[_0x5150('0x28')],'type':_0x17244e[_0x5150('0x29')][_0x5150('0x2a')]};});_0x2352d7[_0x5150('0x2b')]=_[_0x5150('0x26')](_0x205a76,_0x5150('0x23'));_0x2352d7['query']=_[_0x5150('0x2c')](_0x555b94[_0x5150('0x2d')]);_0x2352d7[_0x5150('0x2e')]=_['intersection'](_0x2352d7[_0x5150('0x2b')],_0x2352d7[_0x5150('0x2d')]);_0x32ec7b[_0x5150('0x2f')]=_['intersection'](_0x2352d7['model'],qs['fields'](_0x555b94['query']['fields']));_0x32ec7b['attributes']=_0x32ec7b[_0x5150('0x2f')][_0x5150('0x30')]?_0x32ec7b[_0x5150('0x2f')]:_0x2352d7[_0x5150('0x2b')];if(!_0x555b94[_0x5150('0x2d')][_0x5150('0x31')](_0x5150('0x32'))){_0x32ec7b[_0x5150('0x18')]=qs['limit'](_0x555b94[_0x5150('0x2d')][_0x5150('0x18')]);_0x32ec7b[_0x5150('0x33')]=qs[_0x5150('0x33')](_0x555b94['query'][_0x5150('0x33')]);}_0x32ec7b['order']=qs[_0x5150('0x34')](_0x555b94[_0x5150('0x2d')][_0x5150('0x34')]);_0x32ec7b[_0x5150('0x35')]=qs[_0x5150('0x2e')](_['pick'](_0x555b94[_0x5150('0x2d')],_0x2352d7[_0x5150('0x2e')]),_0x205a76);if(_0x555b94[_0x5150('0x2d')][_0x5150('0x36')]){_0x32ec7b[_0x5150('0x35')]=_[_0x5150('0x37')](_0x32ec7b['where'],{'$or':_[_0x5150('0x26')](_0x205a76,function(_0x5a0e1c){if(_0x5a0e1c[_0x5150('0x29')]!=='VIRTUAL'){var _0x4bd1e5={};_0x4bd1e5[_0x5a0e1c[_0x5150('0x23')]]={'$like':'%'+_0x555b94[_0x5150('0x2d')][_0x5150('0x36')]+'%'};return _0x4bd1e5;}})});}_0x32ec7b=_[_0x5150('0x37')]({},_0x32ec7b,_0x555b94[_0x5150('0x38')]);var _0x484d66={'where':_0x32ec7b[_0x5150('0x35')]};return db['VoiceDialReport'][_0x5150('0x39')](_0x484d66)[_0x5150('0x1f')](function(_0x4f509b){_0x4da7dc[_0x5150('0x39')]=_0x4f509b;if(_0x555b94[_0x5150('0x2d')][_0x5150('0x3a')]){_0x32ec7b['include']=[{'all':!![]}];}return db[_0x5150('0x3b')][_0x5150('0x3c')](_0x32ec7b);})['then'](function(_0x26b6d9){_0x4da7dc['rows']=_0x26b6d9;return _0x4da7dc;})[_0x5150('0x1f')](respondWithFilteredResult(_0x1ff17c,_0x32ec7b))[_0x5150('0x3d')](handleError(_0x1ff17c,null));};exports[_0x5150('0x3e')]=function(_0x30a6bb,_0x2efd8a){var _0x1164fb={'raw':!![],'where':{'id':_0x30a6bb[_0x5150('0x3f')]['id']}},_0x1d3451={};_0x1d3451['model']=_[_0x5150('0x2c')](db['VoiceDialReport']['rawAttributes']);_0x1d3451['query']=_[_0x5150('0x2c')](_0x30a6bb[_0x5150('0x2d')]);_0x1d3451[_0x5150('0x2e')]=_[_0x5150('0x40')](_0x1d3451[_0x5150('0x2b')],_0x1d3451[_0x5150('0x2d')]);_0x1164fb[_0x5150('0x2f')]=_['intersection'](_0x1d3451['model'],qs['fields'](_0x30a6bb['query'][_0x5150('0x41')]));_0x1164fb[_0x5150('0x2f')]=_0x1164fb['attributes'][_0x5150('0x30')]?_0x1164fb[_0x5150('0x2f')]:_0x1d3451[_0x5150('0x2b')];if(_0x30a6bb['query'][_0x5150('0x3a')]){_0x1164fb[_0x5150('0x42')]=[{'all':!![]}];}_0x1164fb=_[_0x5150('0x37')]({},_0x1164fb,_0x30a6bb[_0x5150('0x38')]);return db[_0x5150('0x3b')][_0x5150('0x43')](_0x1164fb)[_0x5150('0x1f')](handleEntityNotFound(_0x2efd8a,null))[_0x5150('0x1f')](respondWithResult(_0x2efd8a,null))[_0x5150('0x3d')](handleError(_0x2efd8a,null));};exports['create']=function(_0x455d87,_0x1d8187){return db[_0x5150('0x3b')]['create'](_0x455d87['body'],{})[_0x5150('0x1f')](respondWithResult(_0x1d8187,0xc9))['catch'](handleError(_0x1d8187,null));};exports[_0x5150('0x1e')]=function(_0x22cc43,_0x167ab0){if(_0x22cc43[_0x5150('0x44')]['id']){delete _0x22cc43['body']['id'];}return db[_0x5150('0x3b')][_0x5150('0x43')]({'where':{'id':_0x22cc43[_0x5150('0x3f')]['id']}})[_0x5150('0x1f')](handleEntityNotFound(_0x167ab0,null))[_0x5150('0x1f')](saveUpdates(_0x22cc43[_0x5150('0x44')],null))[_0x5150('0x1f')](respondWithResult(_0x167ab0,null))[_0x5150('0x3d')](handleError(_0x167ab0,null));};exports[_0x5150('0x20')]=function(_0x365fd3,_0x4d4a8f){return db[_0x5150('0x3b')][_0x5150('0x43')]({'where':{'id':_0x365fd3[_0x5150('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4d4a8f,null))['then'](removeEntity(_0x4d4a8f,null))['catch'](handleError(_0x4d4a8f,null));};exports[_0x5150('0x45')]=function(_0x2fbcc8,_0x10d1cf){return db['VoiceDialReport']['describe']()[_0x5150('0x1f')](respondWithResult(_0x10d1cf,null))[_0x5150('0x3d')](handleError(_0x10d1cf,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 165ebae..f5bd8f8 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 _0xb321=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial'];(function(_0xdd6a57,_0x23a72b){var _0x54864f=function(_0x1c117f){while(--_0x1c117f){_0xdd6a57['push'](_0xdd6a57['shift']());}};_0x54864f(++_0x23a72b);}(_0xb321,0x12b));var _0x1b32=function(_0x29c15b,_0x57f43a){_0x29c15b=_0x29c15b-0x0;var _0x1d77b2=_0xb321[_0x29c15b];return _0x1d77b2;};'use strict';var _=require(_0x1b32('0x0'));var util=require(_0x1b32('0x1'));var logger=require('../../config/logger')(_0x1b32('0x2'));var moment=require(_0x1b32('0x3'));var BPromise=require(_0x1b32('0x4'));var rp=require(_0x1b32('0x5'));var fs=require('fs');var path=require(_0x1b32('0x6'));var rimraf=require(_0x1b32('0x7'));var config=require('../../config/environment');var attributes=require(_0x1b32('0x8'));module[_0x1b32('0x9')]=function(_0x459b7b,_0xd71a){return _0x459b7b[_0x1b32('0xa')](_0x1b32('0xb'),attributes,{'tableName':_0x1b32('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d18=['request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash','../../config/logger','api','moment','bluebird'];(function(_0x56ffde,_0x389999){var _0x39623a=function(_0x27c1c3){while(--_0x27c1c3){_0x56ffde['push'](_0x56ffde['shift']());}};_0x39623a(++_0x389999);}(_0x6d18,0x13d));var _0x86d1=function(_0x339c7d,_0x29054e){_0x339c7d=_0x339c7d-0x0;var _0x5ec80a=_0x6d18[_0x339c7d];return _0x5ec80a;};'use strict';var _=require(_0x86d1('0x0'));var util=require('util');var logger=require(_0x86d1('0x1'))(_0x86d1('0x2'));var moment=require(_0x86d1('0x3'));var BPromise=require(_0x86d1('0x4'));var rp=require(_0x86d1('0x5'));var fs=require('fs');var path=require(_0x86d1('0x6'));var rimraf=require(_0x86d1('0x7'));var config=require(_0x86d1('0x8'));var attributes=require(_0x86d1('0x9'));module[_0x86d1('0xa')]=function(_0x4775a9,_0x4e716c){return _0x4775a9[_0x86d1('0xb')](_0x86d1('0xc'),attributes,{'tableName':_0x86d1('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 6be708a..b7c63d6 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 _0xd59f=['client','http','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','VoiceDialReport','create','options','then','CreateVoiceDialReport','catch','UpdateVoiceDialReport','body','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x500aee,_0x5ee198){var _0x39ff33=function(_0x2dc2bc){while(--_0x2dc2bc){_0x500aee['push'](_0x500aee['shift']());}};_0x39ff33(++_0x5ee198);}(_0xd59f,0x95));var _0xfd59=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0xd59f[_0x1265ed];return _0x5ac459;};'use strict';var _=require(_0xfd59('0x0'));var util=require(_0xfd59('0x1'));var moment=require(_0xfd59('0x2'));var BPromise=require(_0xfd59('0x3'));var rs=require(_0xfd59('0x4'));var fs=require('fs');var Redis=require(_0xfd59('0x5'));var db=require(_0xfd59('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd59('0x7'))(_0xfd59('0x8'));var config=require(_0xfd59('0x9'));var jayson=require(_0xfd59('0xa'));var client=jayson[_0xfd59('0xb')][_0xfd59('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c3394,_0x16b02f,_0x321e39){return new BPromise(function(_0x2c1afc,_0x3c72d3){return client['request'](_0x3c3394,_0x321e39)['then'](function(_0xb3b684){logger[_0xfd59('0xd')](_0xfd59('0xe'),_0x16b02f,'request\x20sent');logger[_0xfd59('0xf')](_0xfd59('0x10'),_0x16b02f,_0xfd59('0x11'),JSON[_0xfd59('0x12')](_0xb3b684));if(_0xb3b684[_0xfd59('0x13')]){if(_0xb3b684[_0xfd59('0x13')][_0xfd59('0x14')]===0x1f4){logger[_0xfd59('0x13')](_0xfd59('0xe'),_0x16b02f,_0xb3b684[_0xfd59('0x13')][_0xfd59('0x15')]);return _0x3c72d3(_0xb3b684[_0xfd59('0x13')][_0xfd59('0x15')]);}logger['error'](_0xfd59('0xe'),_0x16b02f,_0xb3b684['error'][_0xfd59('0x15')]);return _0x2c1afc(_0xb3b684[_0xfd59('0x13')][_0xfd59('0x15')]);}else{logger[_0xfd59('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x16b02f,_0xfd59('0x11'));_0x2c1afc(_0xb3b684[_0xfd59('0x16')][_0xfd59('0x15')]);}})['catch'](function(_0x2b8248){logger[_0xfd59('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x16b02f,_0x2b8248);_0x3c72d3(_0x2b8248);});});}exports['CreateVoiceDialReport']=function(_0x156094){var _0x2e2dbe=this;return new Promise(function(_0x5dcc0c,_0x4f351d){return db[_0xfd59('0x17')][_0xfd59('0x18')](_0x156094['body'],{'raw':_0x156094[_0xfd59('0x19')]?_0x156094[_0xfd59('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xfd59('0x1a')](function(_0x442558){logger[_0xfd59('0xd')](_0xfd59('0x1b'),_0x156094);logger[_0xfd59('0xf')](_0xfd59('0x1b'),_0x156094,JSON[_0xfd59('0x12')](_0x442558));_0x5dcc0c(_0x442558);})[_0xfd59('0x1c')](function(_0x475814){logger[_0xfd59('0x13')](_0xfd59('0x1b'),_0x475814[_0xfd59('0x15')],_0x156094);_0x4f351d(_0x2e2dbe[_0xfd59('0x13')](0x1f4,_0x475814[_0xfd59('0x15')]));});});};exports[_0xfd59('0x1d')]=function(_0x510a46){var _0x46c754=this;return new Promise(function(_0x1756e1,_0x4a9a75){return db['VoiceDialReport']['update'](_0x510a46[_0xfd59('0x1e')],{'raw':_0x510a46['options']?_0x510a46[_0xfd59('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x510a46['options']?_0x510a46[_0xfd59('0x19')]['where']||null:null,'attributes':_0x510a46[_0xfd59('0x19')]?_0x510a46[_0xfd59('0x19')][_0xfd59('0x1f')]||null:null,'limit':_0x510a46[_0xfd59('0x19')]?_0x510a46[_0xfd59('0x19')]['limit']||null:null})[_0xfd59('0x1a')](function(_0x403691){logger['info'](_0xfd59('0x1d'),_0x510a46);logger[_0xfd59('0xf')](_0xfd59('0x1d'),_0x510a46,JSON[_0xfd59('0x12')](_0x403691));_0x1756e1(_0x403691);})[_0xfd59('0x1c')](function(_0x3fc659){logger['error'](_0xfd59('0x1d'),_0x3fc659[_0xfd59('0x15')],_0x510a46);_0x4a9a75(_0x46c754[_0xfd59('0x13')](0x1f4,_0x3fc659['message']));});});}; \ No newline at end of file +var _0xfdf9=['CreateVoiceDialReport','VoiceDialReport','create','options','UpdateVoiceDialReport','update','body','attributes','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch'];(function(_0x6da129,_0x40948d){var _0x1349d6=function(_0x3b1bc){while(--_0x3b1bc){_0x6da129['push'](_0x6da129['shift']());}};_0x1349d6(++_0x40948d);}(_0xfdf9,0xa3));var _0x9fdf=function(_0x4057ec,_0x425f09){_0x4057ec=_0x4057ec-0x0;var _0xe062c=_0xfdf9[_0x4057ec];return _0xe062c;};'use strict';var _=require(_0x9fdf('0x0'));var util=require(_0x9fdf('0x1'));var moment=require(_0x9fdf('0x2'));var BPromise=require(_0x9fdf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9fdf('0x4'));var logger=require(_0x9fdf('0x5'))(_0x9fdf('0x6'));var config=require('../../config/environment');var jayson=require(_0x9fdf('0x7'));var client=jayson[_0x9fdf('0x8')][_0x9fdf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c8502,_0x7a73ec,_0x3a448d){return new BPromise(function(_0x5d2e23,_0x1b20d9){return client[_0x9fdf('0xa')](_0x3c8502,_0x3a448d)[_0x9fdf('0xb')](function(_0x4d4b34){logger[_0x9fdf('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x7a73ec,'request\x20sent');logger[_0x9fdf('0xd')](_0x9fdf('0xe'),_0x7a73ec,_0x9fdf('0xf'),JSON[_0x9fdf('0x10')](_0x4d4b34));if(_0x4d4b34['error']){if(_0x4d4b34[_0x9fdf('0x11')][_0x9fdf('0x12')]===0x1f4){logger['error'](_0x9fdf('0x13'),_0x7a73ec,_0x4d4b34[_0x9fdf('0x11')][_0x9fdf('0x14')]);return _0x1b20d9(_0x4d4b34[_0x9fdf('0x11')][_0x9fdf('0x14')]);}logger[_0x9fdf('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x7a73ec,_0x4d4b34[_0x9fdf('0x11')][_0x9fdf('0x14')]);return _0x5d2e23(_0x4d4b34[_0x9fdf('0x11')][_0x9fdf('0x14')]);}else{logger[_0x9fdf('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x7a73ec,_0x9fdf('0xf'));_0x5d2e23(_0x4d4b34[_0x9fdf('0x15')][_0x9fdf('0x14')]);}})[_0x9fdf('0x16')](function(_0xaad817){logger[_0x9fdf('0x11')](_0x9fdf('0x13'),_0x7a73ec,_0xaad817);_0x1b20d9(_0xaad817);});});}exports[_0x9fdf('0x17')]=function(_0x57c91d){var _0x3948b1=this;return new Promise(function(_0x5f9ef5,_0x2e1bee){return db[_0x9fdf('0x18')][_0x9fdf('0x19')](_0x57c91d['body'],{'raw':_0x57c91d[_0x9fdf('0x1a')]?_0x57c91d[_0x9fdf('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x9fdf('0xb')](function(_0xa5bc89){logger[_0x9fdf('0xc')](_0x9fdf('0x17'),_0x57c91d);logger['debug'](_0x9fdf('0x17'),_0x57c91d,JSON[_0x9fdf('0x10')](_0xa5bc89));_0x5f9ef5(_0xa5bc89);})[_0x9fdf('0x16')](function(_0xce8c2c){logger[_0x9fdf('0x11')](_0x9fdf('0x17'),_0xce8c2c[_0x9fdf('0x14')],_0x57c91d);_0x2e1bee(_0x3948b1['error'](0x1f4,_0xce8c2c[_0x9fdf('0x14')]));});});};exports[_0x9fdf('0x1b')]=function(_0x1475a8){var _0x189df3=this;return new Promise(function(_0x59bd13,_0x52b755){return db[_0x9fdf('0x18')][_0x9fdf('0x1c')](_0x1475a8[_0x9fdf('0x1d')],{'raw':_0x1475a8[_0x9fdf('0x1a')]?_0x1475a8[_0x9fdf('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1475a8[_0x9fdf('0x1a')]?_0x1475a8[_0x9fdf('0x1a')]['where']||null:null,'attributes':_0x1475a8[_0x9fdf('0x1a')]?_0x1475a8[_0x9fdf('0x1a')][_0x9fdf('0x1e')]||null:null,'limit':_0x1475a8[_0x9fdf('0x1a')]?_0x1475a8[_0x9fdf('0x1a')]['limit']||null:null})[_0x9fdf('0xb')](function(_0x3f7187){logger[_0x9fdf('0xc')](_0x9fdf('0x1b'),_0x1475a8);logger['debug']('UpdateVoiceDialReport',_0x1475a8,JSON['stringify'](_0x3f7187));_0x59bd13(_0x3f7187);})['catch'](function(_0x125398){logger['error']('UpdateVoiceDialReport',_0x125398[_0x9fdf('0x14')],_0x1475a8);_0x52b755(_0x189df3[_0x9fdf('0x11')](0x1f4,_0x125398[_0x9fdf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 5fcae9e..f9289c9 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 _0xaafc=['get','index','/:id','isAuthenticated','show','post','create','/:id/applications','addApplications','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xaafc,0x176));var _0xcaaf=function(_0x105c20,_0x5868e9){_0x105c20=_0x105c20-0x0;var _0x31ff5e=_0xaafc[_0x105c20];return _0x31ff5e;};'use strict';var multer=require('multer');var util=require(_0xcaaf('0x0'));var path=require(_0xcaaf('0x1'));var timeout=require(_0xcaaf('0x2'));var express=require(_0xcaaf('0x3'));var router=express['Router']();var auth=require(_0xcaaf('0x4'));var interaction=require(_0xcaaf('0x5'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0xcaaf('0x6')]('/',auth['isAuthenticated'](),controller[_0xcaaf('0x7')]);router['get'](_0xcaaf('0x8'),auth[_0xcaaf('0x9')](),controller[_0xcaaf('0xa')]);router[_0xcaaf('0xb')]('/',auth['isAuthenticated'](),controller[_0xcaaf('0xc')]);router['post'](_0xcaaf('0xd'),auth['isAuthenticated'](),controller[_0xcaaf('0xe')]);router['put'](_0xcaaf('0x8'),auth[_0xcaaf('0x9')](),controller[_0xcaaf('0xf')]);router[_0xcaaf('0x10')](_0xcaaf('0x8'),auth[_0xcaaf('0x9')](),controller[_0xcaaf('0x11')]);module[_0xcaaf('0x12')]=router; \ No newline at end of file +var _0x3aae=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','create','/:id/applications','addApplications','put','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3aae,0x102));var _0xe3aa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3aae[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xe3aa('0x0'));var util=require(_0xe3aa('0x1'));var path=require(_0xe3aa('0x2'));var timeout=require(_0xe3aa('0x3'));var express=require(_0xe3aa('0x4'));var router=express[_0xe3aa('0x5')]();var auth=require(_0xe3aa('0x6'));var interaction=require(_0xe3aa('0x7'));var config=require(_0xe3aa('0x8'));var controller=require(_0xe3aa('0x9'));router[_0xe3aa('0xa')]('/',auth[_0xe3aa('0xb')](),controller['index']);router[_0xe3aa('0xa')](_0xe3aa('0xc'),auth[_0xe3aa('0xb')](),controller[_0xe3aa('0xd')]);router[_0xe3aa('0xe')]('/',auth[_0xe3aa('0xb')](),controller[_0xe3aa('0xf')]);router[_0xe3aa('0xe')](_0xe3aa('0x10'),auth[_0xe3aa('0xb')](),controller[_0xe3aa('0x11')]);router[_0xe3aa('0x12')](_0xe3aa('0xc'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe3aa('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index d11aefb..bda289a 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 _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x99a485,_0x5c5638){var _0x50ff45=function(_0x166520){while(--_0x166520){_0x99a485['push'](_0x99a485['shift']());}};_0x50ff45(++_0x5c5638);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x40a909,_0x2d887e){var _0x488189=function(_0x24189c){while(--_0x24189c){_0x40a909['push'](_0x40a909['shift']());}};_0x488189(++_0x2d887e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index b20c2ae..c6d2c21 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 _0x59f5=['cutdigits','context','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','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','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','ignore','map','value','type','name','UserProfileResource','error','stack','send','index','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','filter','merge','options','count','includeAll','include','VoiceExtension','catch','show','params','rawAttributes','find','create','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','outbound','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','description','recordingFormat'];(function(_0x3a8a3f,_0x5afedd){var _0x21aa2e=function(_0x51689d){while(--_0x51689d){_0x3a8a3f['push'](_0x3a8a3f['shift']());}};_0x21aa2e(++_0x5afedd);}(_0x59f5,0x1b9));var _0x559f=function(_0x5c0679,_0x143c02){_0x5c0679=_0x5c0679-0x0;var _0x5ac366=_0x59f5[_0x5c0679];return _0x5ac366;};'use strict';var pdf=require(_0x559f('0x0'));var emlformat=require(_0x559f('0x1'));var rimraf=require(_0x559f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x559f('0x3'));var rp=require(_0x559f('0x4'));var moment=require(_0x559f('0x5'));var BPromise=require(_0x559f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x559f('0x7'));var sox=require(_0x559f('0x8'));var csv=require(_0x559f('0x9'));var ejs=require(_0x559f('0xa'));var fs=require('fs');var _=require(_0x559f('0xb'));var squel=require('squel');var crypto=require(_0x559f('0xc'));var jsforce=require(_0x559f('0xd'));var deskjs=require(_0x559f('0xe'));var toCsv=require(_0x559f('0x9'));var querystring=require(_0x559f('0xf'));var Papa=require(_0x559f('0x10'));var Redis=require(_0x559f('0x11'));var authService=require(_0x559f('0x12'));var qs=require(_0x559f('0x13'));var as=require(_0x559f('0x14'));var hardwareService=require(_0x559f('0x15'));var logger=require(_0x559f('0x16'))(_0x559f('0x17'));var utils=require(_0x559f('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x559f('0x19'))['db'];config[_0x559f('0x1a')]=_[_0x559f('0x1b')](config[_0x559f('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x559f('0x1c'))(new Redis(config[_0x559f('0x1a')]));require(_0x559f('0x1d'))[_0x559f('0x1e')](socket);function respondWithStatusCode(_0x38cba1,_0x32137d){_0x32137d=_0x32137d||0xcc;return function(_0x316457){if(_0x316457){return _0x38cba1[_0x559f('0x1f')](_0x32137d);}return _0x38cba1[_0x559f('0x20')](_0x32137d)['end']();};}function respondWithResult(_0x539a8b,_0x5bbddc){_0x5bbddc=_0x5bbddc||0xc8;return function(_0x1379f8){if(_0x1379f8){return _0x539a8b[_0x559f('0x20')](_0x5bbddc)['json'](_0x1379f8);}};}function respondWithFilteredResult(_0x1a7b51,_0x1e232c){return function(_0x1a7dd3){if(_0x1a7dd3){var _0x497840=_0x1a7dd3['count'],_0x335bf6=_0x1e232c[_0x559f('0x21')],_0x36c175=_0x1e232c[_0x559f('0x21')]+_0x1e232c[_0x559f('0x22')],_0x2156f2;if(_0x36c175>=_0x497840){_0x36c175=_0x497840;_0x2156f2=0xc8;}else{_0x2156f2=0xce;}_0x1a7b51[_0x559f('0x20')](_0x2156f2);return _0x1a7b51[_0x559f('0x23')](_0x559f('0x24'),_0x335bf6+'-'+_0x36c175+'/'+_0x497840)[_0x559f('0x25')](_0x1a7dd3);}return null;};}function patchUpdates(_0x291345){return function(_0x253662){try{jsonpatch[_0x559f('0x26')](_0x253662,_0x291345,!![]);}catch(_0x5b4fc5){return BPromise[_0x559f('0x27')](_0x5b4fc5);}return _0x253662[_0x559f('0x28')]();};}function saveUpdates(_0x58e404,_0x178a1a){return function(_0xe69401){if(_0xe69401){return _0xe69401['update'](_0x58e404)[_0x559f('0x29')](function(_0x5d0e4e){return _0x5d0e4e;});}return null;};}function removeEntity(_0x53eaa9,_0x8e4158){return function(_0x56209b){if(_0x56209b){return _0x56209b[_0x559f('0x2a')]()['then'](function(){var _0x2fedcd=_0x56209b[_0x559f('0x2b')]({'plain':!![]});var _0x1fa0e3=[{'name':_0x559f('0x2c'),'value':_0x559f('0x2d'),'ignore':![]},{'name':_0x559f('0x2e'),'value':'outbound','ignore':![]},{'name':_0x559f('0x2f'),'value':_0x559f('0x30'),'ignore':![]}];var _0x12a45f=_(_0x1fa0e3)['filter'](_0x559f('0x31'))[_0x559f('0x32')]('value')[_0x559f('0x33')]();if(_['includes'](_0x12a45f,_0x2fedcd[_0x559f('0x34')])){return;}var _0x196605=_['find'](_0x1fa0e3,[_0x559f('0x33'),_0x2fedcd[_0x559f('0x34')]])[_0x559f('0x35')];return db[_0x559f('0x36')][_0x559f('0x2a')]({'where':{'type':_0x196605,'resourceId':_0x2fedcd['id']}})[_0x559f('0x29')](function(){return _0x56209b;});})[_0x559f('0x29')](function(){_0x53eaa9[_0x559f('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b78d6,_0x2c48c8){return function(_0x58b93d){if(!_0x58b93d){_0x2b78d6[_0x559f('0x1f')](0x194);}return _0x58b93d;};}function handleError(_0x180dbe,_0x578769){_0x578769=_0x578769||0x1f4;return function(_0x1d8d3c){logger[_0x559f('0x37')](_0x1d8d3c[_0x559f('0x38')]);if(_0x1d8d3c['name']){delete _0x1d8d3c[_0x559f('0x35')];}_0x180dbe['status'](_0x578769)[_0x559f('0x39')](_0x1d8d3c);};}exports[_0x559f('0x3a')]=function(_0x3e12e6,_0x9a5c39){var _0x3ef959={},_0x1e7b45={},_0x38dd49={'count':0x0,'rows':[]};var _0x32c7ba=_[_0x559f('0x32')](db['VoiceExtension']['rawAttributes'],function(_0xd5eed9){return{'name':_0xd5eed9[_0x559f('0x3b')],'type':_0xd5eed9['type'][_0x559f('0x3c')]};});_0x1e7b45[_0x559f('0x3d')]=_[_0x559f('0x32')](_0x32c7ba,_0x559f('0x35'));_0x1e7b45[_0x559f('0x3e')]=_[_0x559f('0x3f')](_0x3e12e6['query']);_0x1e7b45[_0x559f('0x40')]=_['intersection'](_0x1e7b45['model'],_0x1e7b45[_0x559f('0x3e')]);_0x3ef959['attributes']=_[_0x559f('0x41')](_0x1e7b45[_0x559f('0x3d')],qs[_0x559f('0x42')](_0x3e12e6[_0x559f('0x3e')][_0x559f('0x42')]));_0x3ef959[_0x559f('0x43')]=_0x3ef959[_0x559f('0x43')][_0x559f('0x44')]?_0x3ef959['attributes']:_0x1e7b45[_0x559f('0x3d')];if(!_0x3e12e6['query'][_0x559f('0x45')](_0x559f('0x46'))){_0x3ef959[_0x559f('0x22')]=qs['limit'](_0x3e12e6[_0x559f('0x3e')]['limit']);_0x3ef959['offset']=qs[_0x559f('0x21')](_0x3e12e6[_0x559f('0x3e')][_0x559f('0x21')]);}_0x3ef959['order']=qs['sort'](_0x3e12e6[_0x559f('0x3e')]['sort']);_0x3ef959[_0x559f('0x47')]=qs[_0x559f('0x40')](_['pick'](_0x3e12e6[_0x559f('0x3e')],_0x1e7b45[_0x559f('0x40')]),_0x32c7ba);if(_0x3e12e6[_0x559f('0x3e')][_0x559f('0x48')]){_0x3ef959['where']=_[_0x559f('0x49')](_0x3ef959[_0x559f('0x47')],{'$or':_[_0x559f('0x32')](_0x32c7ba,function(_0x10b6fd){if(_0x10b6fd[_0x559f('0x34')]!=='VIRTUAL'){var _0x3d7ac7={};_0x3d7ac7[_0x10b6fd[_0x559f('0x35')]]={'$like':'%'+_0x3e12e6[_0x559f('0x3e')][_0x559f('0x48')]+'%'};return _0x3d7ac7;}})});}_0x3ef959=_['merge']({},_0x3ef959,_0x3e12e6[_0x559f('0x4a')]);var _0x56216f={'where':_0x3ef959['where']};return db['VoiceExtension'][_0x559f('0x4b')](_0x56216f)[_0x559f('0x29')](function(_0x4cf134){_0x38dd49[_0x559f('0x4b')]=_0x4cf134;if(_0x3e12e6[_0x559f('0x3e')][_0x559f('0x4c')]){_0x3ef959[_0x559f('0x4d')]=[{'all':!![]}];}return db[_0x559f('0x4e')]['findAll'](_0x3ef959);})[_0x559f('0x29')](function(_0x7c8de){_0x38dd49['rows']=_0x7c8de;return _0x38dd49;})[_0x559f('0x29')](respondWithFilteredResult(_0x9a5c39,_0x3ef959))[_0x559f('0x4f')](handleError(_0x9a5c39,null));};exports[_0x559f('0x50')]=function(_0x286fe2,_0x294e55){var _0x432b2c={'raw':![],'where':{'id':_0x286fe2[_0x559f('0x51')]['id']}},_0xc56483={};_0xc56483['model']=_[_0x559f('0x3f')](db[_0x559f('0x4e')][_0x559f('0x52')]);_0xc56483['query']=_['keys'](_0x286fe2[_0x559f('0x3e')]);_0xc56483['filters']=_[_0x559f('0x41')](_0xc56483[_0x559f('0x3d')],_0xc56483['query']);_0x432b2c[_0x559f('0x43')]=_[_0x559f('0x41')](_0xc56483[_0x559f('0x3d')],qs['fields'](_0x286fe2[_0x559f('0x3e')][_0x559f('0x42')]));_0x432b2c[_0x559f('0x43')]=_0x432b2c[_0x559f('0x43')][_0x559f('0x44')]?_0x432b2c['attributes']:_0xc56483[_0x559f('0x3d')];if(_0x286fe2[_0x559f('0x3e')][_0x559f('0x4c')]){_0x432b2c[_0x559f('0x4d')]=[{'all':!![]}];}_0x432b2c=_['merge']({},_0x432b2c,_0x286fe2[_0x559f('0x4a')]);return db[_0x559f('0x4e')][_0x559f('0x53')](_0x432b2c)[_0x559f('0x29')](handleEntityNotFound(_0x294e55,null))['then'](respondWithResult(_0x294e55,null))[_0x559f('0x4f')](handleError(_0x294e55,null));};exports[_0x559f('0x2a')]=function(_0x33c701,_0xd205be){return db[_0x559f('0x4e')][_0x559f('0x53')]({'where':{'id':_0x33c701[_0x559f('0x51')]['id']}})[_0x559f('0x29')](handleEntityNotFound(_0xd205be,null))['then'](removeEntity(_0xd205be,null))[_0x559f('0x4f')](handleError(_0xd205be,null));};exports[_0x559f('0x54')]=function(_0x190464,_0x11217f){if(_0x190464['body'][_0x559f('0x34')]==='outbound'&&!_['startsWith'](_0x190464[_0x559f('0x55')][_0x559f('0x56')],'_')){_0x190464['body'][_0x559f('0x56')]='_'[_0x559f('0x57')](_0x190464[_0x559f('0x55')][_0x559f('0x56')]);}return db[_0x559f('0x4e')][_0x559f('0x54')](_0x190464[_0x559f('0x55')],{'raw':![]})[_0x559f('0x29')](function(_0xc35aad){var _0x3e83f7=_0x190464[_0x559f('0x58')]['get']({'plain':!![]});if(!_0x3e83f7)throw new Error(_0x559f('0x59'));if(_0x3e83f7[_0x559f('0x5a')]===_0x559f('0x58')){var _0x14256d=_0xc35aad['get']({'plain':!![]});var _0x303dce=[{'name':_0x559f('0x2c'),'value':'inbound'},{'name':_0x559f('0x2e'),'value':_0x559f('0x5b')},{'name':_0x559f('0x2f'),'value':_0x559f('0x30')}];var _0x479ec6=_[_0x559f('0x53')](_0x303dce,['value',_0x14256d['type']])[_0x559f('0x35')];return db[_0x559f('0x5c')][_0x559f('0x53')]({'where':{'name':_0x479ec6,'userProfileId':_0x3e83f7['userProfileId']},'raw':!![]})[_0x559f('0x29')](function(_0x48770c){if(_0x48770c&&_0x48770c[_0x559f('0x5d')]===0x0){return db[_0x559f('0x36')]['create']({'name':_0x14256d[_0x559f('0x35')],'resourceId':_0x14256d['id'],'type':_0x48770c[_0x559f('0x35')],'sectionId':_0x48770c['id']},{})[_0x559f('0x29')](function(){return _0xc35aad;});}else{return _0xc35aad;}})[_0x559f('0x4f')](function(_0xcc5559){logger['error'](_0x559f('0x5e'),_0xcc5559);throw _0xcc5559;});}return _0xc35aad;})['then'](respondWithResult(_0x11217f,0xc9))[_0x559f('0x4f')](handleError(_0x11217f,null));};exports[_0x559f('0x5f')]=function(_0x50a5ef,_0x3c11a6){if(_0x50a5ef[_0x559f('0x55')]['id']){delete _0x50a5ef[_0x559f('0x55')]['id'];}return db[_0x559f('0x4e')][_0x559f('0x53')]({'where':{'id':_0x50a5ef[_0x559f('0x51')]['id']}})[_0x559f('0x29')](handleEntityNotFound(_0x3c11a6,null))[_0x559f('0x29')](function(_0xf2432e){if(_0xf2432e){return db['VoiceExtension']['update'](_[_0x559f('0x60')](_0x50a5ef[_0x559f('0x55')],[_0x559f('0x56'),'context',_0x559f('0x61'),_0x559f('0x62'),_0x559f('0x63'),'mandatoryDisposition']),{'where':{'context':_0xf2432e[_0x559f('0x64')],'exten':_0xf2432e['exten']},'individualHooks':!![]})[_0x559f('0x29')](function(_0x14c4ad){return _0x14c4ad;});}return null;})[_0x559f('0x29')](respondWithStatusCode(_0x3c11a6,null))[_0x559f('0x4f')](handleError(_0x3c11a6,null));};exports['addApplications']=function(_0x500a9f,_0x3dfe82,_0x398000){return db[_0x559f('0x4e')][_0x559f('0x65')]({'where':{'id':_0x500a9f['params']['id']}})[_0x559f('0x29')](handleEntityNotFound(_0x3dfe82,null))[_0x559f('0x29')](function(_0x1d5622){if(_0x1d5622){return db[_0x559f('0x66')][_0x559f('0x67')](function(_0xc5e2b5){return db[_0x559f('0x4e')]['destroy']({'where':{'VoiceExtensionId':_0x500a9f['params']['id']},'transaction':_0xc5e2b5})[_0x559f('0x29')](function(_0x326bea){var _0x51473e=_['map'](_0x500a9f[_0x559f('0x55')],function(_0x34925b){_0x34925b[_0x559f('0x68')]=_0x500a9f[_0x559f('0x51')]['id'];return _0x34925b;});return db[_0x559f('0x4e')][_0x559f('0x69')](_0x51473e,{'transaction':_0xc5e2b5});});})[_0x559f('0x29')](function(){return db[_0x559f('0x4e')][_0x559f('0x6a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x500a9f[_0x559f('0x51')]['id']},'order':_0x559f('0x6b')});});}})['then'](respondWithResult(_0x3dfe82,null))[_0x559f('0x4f')](handleError(_0x3dfe82,null));}; \ No newline at end of file +var _0x1ca9=['findAll','catch','show','rawAttributes','fields','destroy','params','create','startsWith','body','concat','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','description','recordingFormat','mandatoryDisposition','addApplications','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','internal','filter','ignore','map','value','type','find','end','stack','name','send','index','VoiceExtension','key','query','keys','filters','intersection','attributes','length','model','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x114362,_0x16952e){var _0xb73a14=function(_0x10dbbf){while(--_0x10dbbf){_0x114362['push'](_0x114362['shift']());}};_0xb73a14(++_0x16952e);}(_0x1ca9,0x16d));var _0x91ca=function(_0x4a441d,_0x585115){_0x4a441d=_0x4a441d-0x0;var _0x1c07fd=_0x1ca9[_0x4a441d];return _0x1c07fd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x91ca('0x0'));var rimraf=require(_0x91ca('0x1'));var zipdir=require(_0x91ca('0x2'));var jsonpatch=require(_0x91ca('0x3'));var rp=require(_0x91ca('0x4'));var moment=require(_0x91ca('0x5'));var BPromise=require(_0x91ca('0x6'));var Mustache=require(_0x91ca('0x7'));var util=require(_0x91ca('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x91ca('0x9'));var ejs=require(_0x91ca('0xa'));var fs=require('fs');var _=require(_0x91ca('0xb'));var squel=require('squel');var crypto=require(_0x91ca('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x91ca('0xd'));var toCsv=require('to-csv');var querystring=require(_0x91ca('0xe'));var Papa=require(_0x91ca('0xf'));var Redis=require(_0x91ca('0x10'));var authService=require(_0x91ca('0x11'));var qs=require(_0x91ca('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91ca('0x13'));var logger=require(_0x91ca('0x14'))(_0x91ca('0x15'));var utils=require(_0x91ca('0x16'));var config=require(_0x91ca('0x17'));var licenseUtil=require(_0x91ca('0x18'));var db=require(_0x91ca('0x19'))['db'];config['redis']=_['defaults'](config[_0x91ca('0x1a')],{'host':_0x91ca('0x1b'),'port':0x18eb});var socket=require(_0x91ca('0x1c'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x91ca('0x1d')](socket);function respondWithStatusCode(_0x5a8db3,_0x57c303){_0x57c303=_0x57c303||0xcc;return function(_0x26c0af){if(_0x26c0af){return _0x5a8db3[_0x91ca('0x1e')](_0x57c303);}return _0x5a8db3[_0x91ca('0x1f')](_0x57c303)['end']();};}function respondWithResult(_0xf6d84f,_0x2f0414){_0x2f0414=_0x2f0414||0xc8;return function(_0x2b875d){if(_0x2b875d){return _0xf6d84f['status'](_0x2f0414)['json'](_0x2b875d);}};}function respondWithFilteredResult(_0x53e3fe,_0x48804a){return function(_0x23d205){if(_0x23d205){var _0x40ca50=_0x23d205[_0x91ca('0x20')],_0x4a6e9f=_0x48804a[_0x91ca('0x21')],_0x480bfc=_0x48804a['offset']+_0x48804a['limit'],_0x139f10;if(_0x480bfc>=_0x40ca50){_0x480bfc=_0x40ca50;_0x139f10=0xc8;}else{_0x139f10=0xce;}_0x53e3fe[_0x91ca('0x1f')](_0x139f10);return _0x53e3fe[_0x91ca('0x22')](_0x91ca('0x23'),_0x4a6e9f+'-'+_0x480bfc+'/'+_0x40ca50)[_0x91ca('0x24')](_0x23d205);}return null;};}function patchUpdates(_0x1bca73){return function(_0x5a3d9e){try{jsonpatch[_0x91ca('0x25')](_0x5a3d9e,_0x1bca73,!![]);}catch(_0x3c3600){return BPromise[_0x91ca('0x26')](_0x3c3600);}return _0x5a3d9e[_0x91ca('0x27')]();};}function saveUpdates(_0x595e16,_0x17523f){return function(_0x22863a){if(_0x22863a){return _0x22863a[_0x91ca('0x28')](_0x595e16)['then'](function(_0x32650c){return _0x32650c;});}return null;};}function removeEntity(_0x191309,_0x5c9af6){return function(_0x2c0340){if(_0x2c0340){return _0x2c0340['destroy']()[_0x91ca('0x29')](function(){var _0xfeb105=_0x2c0340[_0x91ca('0x2a')]({'plain':!![]});var _0x5c80b0=[{'name':_0x91ca('0x2b'),'value':_0x91ca('0x2c'),'ignore':![]},{'name':_0x91ca('0x2d'),'value':_0x91ca('0x2e'),'ignore':![]},{'name':'InternalRoutes','value':_0x91ca('0x2f'),'ignore':![]}];var _0xfe579c=_(_0x5c80b0)[_0x91ca('0x30')](_0x91ca('0x31'))[_0x91ca('0x32')](_0x91ca('0x33'))[_0x91ca('0x33')]();if(_['includes'](_0xfe579c,_0xfeb105[_0x91ca('0x34')])){return;}var _0x15f8b3=_[_0x91ca('0x35')](_0x5c80b0,[_0x91ca('0x33'),_0xfeb105[_0x91ca('0x34')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x15f8b3,'resourceId':_0xfeb105['id']}})[_0x91ca('0x29')](function(){return _0x2c0340;});})[_0x91ca('0x29')](function(){_0x191309[_0x91ca('0x1f')](0xcc)[_0x91ca('0x36')]();});}};}function handleEntityNotFound(_0x2645a9,_0x5eb425){return function(_0x2dc6b2){if(!_0x2dc6b2){_0x2645a9[_0x91ca('0x1e')](0x194);}return _0x2dc6b2;};}function handleError(_0x393bb2,_0x5d95ff){_0x5d95ff=_0x5d95ff||0x1f4;return function(_0x2c437e){logger['error'](_0x2c437e[_0x91ca('0x37')]);if(_0x2c437e[_0x91ca('0x38')]){delete _0x2c437e[_0x91ca('0x38')];}_0x393bb2[_0x91ca('0x1f')](_0x5d95ff)[_0x91ca('0x39')](_0x2c437e);};}exports[_0x91ca('0x3a')]=function(_0x5ab853,_0x393522){var _0x372729={},_0x4eb26a={},_0x53511c={'count':0x0,'rows':[]};var _0x374a67=_[_0x91ca('0x32')](db[_0x91ca('0x3b')]['rawAttributes'],function(_0xaab301){return{'name':_0xaab301['fieldName'],'type':_0xaab301[_0x91ca('0x34')][_0x91ca('0x3c')]};});_0x4eb26a['model']=_[_0x91ca('0x32')](_0x374a67,_0x91ca('0x38'));_0x4eb26a[_0x91ca('0x3d')]=_[_0x91ca('0x3e')](_0x5ab853[_0x91ca('0x3d')]);_0x4eb26a[_0x91ca('0x3f')]=_[_0x91ca('0x40')](_0x4eb26a['model'],_0x4eb26a[_0x91ca('0x3d')]);_0x372729[_0x91ca('0x41')]=_['intersection'](_0x4eb26a['model'],qs['fields'](_0x5ab853[_0x91ca('0x3d')]['fields']));_0x372729[_0x91ca('0x41')]=_0x372729['attributes'][_0x91ca('0x42')]?_0x372729[_0x91ca('0x41')]:_0x4eb26a[_0x91ca('0x43')];if(!_0x5ab853[_0x91ca('0x3d')][_0x91ca('0x44')](_0x91ca('0x45'))){_0x372729[_0x91ca('0x46')]=qs[_0x91ca('0x46')](_0x5ab853[_0x91ca('0x3d')][_0x91ca('0x46')]);_0x372729[_0x91ca('0x21')]=qs[_0x91ca('0x21')](_0x5ab853[_0x91ca('0x3d')][_0x91ca('0x21')]);}_0x372729[_0x91ca('0x47')]=qs['sort'](_0x5ab853['query'][_0x91ca('0x48')]);_0x372729[_0x91ca('0x49')]=qs[_0x91ca('0x3f')](_['pick'](_0x5ab853[_0x91ca('0x3d')],_0x4eb26a[_0x91ca('0x3f')]),_0x374a67);if(_0x5ab853[_0x91ca('0x3d')][_0x91ca('0x30')]){_0x372729[_0x91ca('0x49')]=_[_0x91ca('0x4a')](_0x372729[_0x91ca('0x49')],{'$or':_['map'](_0x374a67,function(_0x2b30da){if(_0x2b30da['type']!==_0x91ca('0x4b')){var _0x4ebd8c={};_0x4ebd8c[_0x2b30da[_0x91ca('0x38')]]={'$like':'%'+_0x5ab853[_0x91ca('0x3d')][_0x91ca('0x30')]+'%'};return _0x4ebd8c;}})});}_0x372729=_[_0x91ca('0x4a')]({},_0x372729,_0x5ab853[_0x91ca('0x4c')]);var _0x50569c={'where':_0x372729[_0x91ca('0x49')]};return db[_0x91ca('0x3b')][_0x91ca('0x20')](_0x50569c)['then'](function(_0x4d3104){_0x53511c[_0x91ca('0x20')]=_0x4d3104;if(_0x5ab853[_0x91ca('0x3d')][_0x91ca('0x4d')]){_0x372729[_0x91ca('0x4e')]=[{'all':!![]}];}return db[_0x91ca('0x3b')][_0x91ca('0x4f')](_0x372729);})['then'](function(_0x3d67d6){_0x53511c['rows']=_0x3d67d6;return _0x53511c;})[_0x91ca('0x29')](respondWithFilteredResult(_0x393522,_0x372729))[_0x91ca('0x50')](handleError(_0x393522,null));};exports[_0x91ca('0x51')]=function(_0xff4a7b,_0x5ee40d){var _0x19e76b={'raw':![],'where':{'id':_0xff4a7b['params']['id']}},_0x2253dd={};_0x2253dd['model']=_['keys'](db[_0x91ca('0x3b')][_0x91ca('0x52')]);_0x2253dd[_0x91ca('0x3d')]=_[_0x91ca('0x3e')](_0xff4a7b['query']);_0x2253dd[_0x91ca('0x3f')]=_[_0x91ca('0x40')](_0x2253dd[_0x91ca('0x43')],_0x2253dd[_0x91ca('0x3d')]);_0x19e76b[_0x91ca('0x41')]=_['intersection'](_0x2253dd[_0x91ca('0x43')],qs[_0x91ca('0x53')](_0xff4a7b[_0x91ca('0x3d')][_0x91ca('0x53')]));_0x19e76b['attributes']=_0x19e76b[_0x91ca('0x41')][_0x91ca('0x42')]?_0x19e76b[_0x91ca('0x41')]:_0x2253dd[_0x91ca('0x43')];if(_0xff4a7b[_0x91ca('0x3d')][_0x91ca('0x4d')]){_0x19e76b[_0x91ca('0x4e')]=[{'all':!![]}];}_0x19e76b=_[_0x91ca('0x4a')]({},_0x19e76b,_0xff4a7b[_0x91ca('0x4c')]);return db[_0x91ca('0x3b')][_0x91ca('0x35')](_0x19e76b)['then'](handleEntityNotFound(_0x5ee40d,null))[_0x91ca('0x29')](respondWithResult(_0x5ee40d,null))['catch'](handleError(_0x5ee40d,null));};exports[_0x91ca('0x54')]=function(_0x31e6a3,_0x2463b4){return db[_0x91ca('0x3b')][_0x91ca('0x35')]({'where':{'id':_0x31e6a3[_0x91ca('0x55')]['id']}})[_0x91ca('0x29')](handleEntityNotFound(_0x2463b4,null))['then'](removeEntity(_0x2463b4,null))[_0x91ca('0x50')](handleError(_0x2463b4,null));};exports[_0x91ca('0x56')]=function(_0x41f3ef,_0x2ac13b){if(_0x41f3ef['body'][_0x91ca('0x34')]===_0x91ca('0x2e')&&!_[_0x91ca('0x57')](_0x41f3ef[_0x91ca('0x58')]['exten'],'_')){_0x41f3ef['body']['exten']='_'[_0x91ca('0x59')](_0x41f3ef[_0x91ca('0x58')][_0x91ca('0x5a')]);}return db[_0x91ca('0x3b')]['create'](_0x41f3ef[_0x91ca('0x58')],{'raw':![]})[_0x91ca('0x29')](function(_0x528d0d){var _0x1af8ae=_0x41f3ef[_0x91ca('0x5b')]['get']({'plain':!![]});if(!_0x1af8ae)throw new Error(_0x91ca('0x5c'));if(_0x1af8ae[_0x91ca('0x5d')]===_0x91ca('0x5b')){var _0x12ef26=_0x528d0d['get']({'plain':!![]});var _0x23868e=[{'name':_0x91ca('0x2b'),'value':'inbound'},{'name':'OutboundRoutes','value':_0x91ca('0x2e')},{'name':'InternalRoutes','value':_0x91ca('0x2f')}];var _0x34ffb0=_[_0x91ca('0x35')](_0x23868e,['value',_0x12ef26[_0x91ca('0x34')]])[_0x91ca('0x38')];return db[_0x91ca('0x5e')][_0x91ca('0x35')]({'where':{'name':_0x34ffb0,'userProfileId':_0x1af8ae[_0x91ca('0x5f')]},'raw':!![]})[_0x91ca('0x29')](function(_0x4ca8a8){if(_0x4ca8a8&&_0x4ca8a8[_0x91ca('0x60')]===0x0){return db[_0x91ca('0x61')]['create']({'name':_0x12ef26[_0x91ca('0x38')],'resourceId':_0x12ef26['id'],'type':_0x4ca8a8[_0x91ca('0x38')],'sectionId':_0x4ca8a8['id']},{})[_0x91ca('0x29')](function(){return _0x528d0d;});}else{return _0x528d0d;}})[_0x91ca('0x50')](function(_0xb90d10){logger[_0x91ca('0x62')](_0x91ca('0x63'),_0xb90d10);throw _0xb90d10;});}return _0x528d0d;})[_0x91ca('0x29')](respondWithResult(_0x2ac13b,0xc9))['catch'](handleError(_0x2ac13b,null));};exports[_0x91ca('0x28')]=function(_0x5d35e6,_0x599c06){if(_0x5d35e6[_0x91ca('0x58')]['id']){delete _0x5d35e6['body']['id'];}return db['VoiceExtension'][_0x91ca('0x35')]({'where':{'id':_0x5d35e6[_0x91ca('0x55')]['id']}})[_0x91ca('0x29')](handleEntityNotFound(_0x599c06,null))[_0x91ca('0x29')](function(_0x52cd0b){if(_0x52cd0b){return db[_0x91ca('0x3b')][_0x91ca('0x28')](_[_0x91ca('0x64')](_0x5d35e6[_0x91ca('0x58')],[_0x91ca('0x5a'),'context',_0x91ca('0x65'),_0x91ca('0x66'),'cutdigits',_0x91ca('0x67')]),{'where':{'context':_0x52cd0b['context'],'exten':_0x52cd0b[_0x91ca('0x5a')]},'individualHooks':!![]})[_0x91ca('0x29')](function(_0x50cce0){return _0x50cce0;});}return null;})[_0x91ca('0x29')](respondWithStatusCode(_0x599c06,null))[_0x91ca('0x50')](handleError(_0x599c06,null));};exports[_0x91ca('0x68')]=function(_0x283c5f,_0x1c6f07,_0x5207f5){return db[_0x91ca('0x3b')]['findOne']({'where':{'id':_0x283c5f[_0x91ca('0x55')]['id']}})[_0x91ca('0x29')](handleEntityNotFound(_0x1c6f07,null))[_0x91ca('0x29')](function(_0x446d1e){if(_0x446d1e){return db[_0x91ca('0x69')][_0x91ca('0x6a')](function(_0x3e73b5){return db[_0x91ca('0x3b')][_0x91ca('0x54')]({'where':{'VoiceExtensionId':_0x283c5f['params']['id']},'transaction':_0x3e73b5})['then'](function(_0xf77101){var _0x4e3d52=_['map'](_0x283c5f['body'],function(_0x32dac){_0x32dac[_0x91ca('0x6b')]=_0x283c5f[_0x91ca('0x55')]['id'];return _0x32dac;});return db[_0x91ca('0x3b')][_0x91ca('0x6c')](_0x4e3d52,{'transaction':_0x3e73b5});});})[_0x91ca('0x29')](function(){return db[_0x91ca('0x3b')][_0x91ca('0x6d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x283c5f[_0x91ca('0x55')]['id']},'order':_0x91ca('0x6e')});});}})['then'](respondWithResult(_0x1c6f07,null))[_0x91ca('0x50')](handleError(_0x1c6f07,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index bf6a75a..6bb9ecf 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 _0x30fc=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x30fc,0x64));var _0xc30f=function(_0x43de86,_0x34edd7){_0x43de86=_0x43de86-0x0;var _0x1bc154=_0x30fc[_0x43de86];return _0x1bc154;};'use strict';var EventEmitter=require(_0xc30f('0x0'));var VoiceExtension=require(_0xc30f('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xc30f('0x2')](0x0);var events={'afterCreate':_0xc30f('0x3'),'afterUpdate':_0xc30f('0x4'),'afterDestroy':_0xc30f('0x5')};function emitEvent(_0x4a99fd){return function(_0xa8299e,_0x16c57d,_0x342b94){VoiceExtensionEvents[_0xc30f('0x6')](_0x4a99fd+':'+_0xa8299e['id'],_0xa8299e);VoiceExtensionEvents[_0xc30f('0x6')](_0x4a99fd,_0xa8299e);_0x342b94(null);};}for(var e in events){if(events[_0xc30f('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xc30f('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x32e7=['emit','hook','exports','events','VoiceExtension','setMaxListeners','save','remove'];(function(_0xafc64f,_0x15be35){var _0x1b4bf4=function(_0x57a415){while(--_0x57a415){_0xafc64f['push'](_0xafc64f['shift']());}};_0x1b4bf4(++_0x15be35);}(_0x32e7,0xc3));var _0x732e=function(_0x52b4d6,_0x4240ce){_0x52b4d6=_0x52b4d6-0x0;var _0x518d80=_0x32e7[_0x52b4d6];return _0x518d80;};'use strict';var EventEmitter=require(_0x732e('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x732e('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x732e('0x2')](0x0);var events={'afterCreate':_0x732e('0x3'),'afterUpdate':'update','afterDestroy':_0x732e('0x4')};function emitEvent(_0x40f199){return function(_0x853cce,_0x122e38,_0x538b2d){VoiceExtensionEvents['emit'](_0x40f199+':'+_0x853cce['id'],_0x853cce);VoiceExtensionEvents[_0x732e('0x5')](_0x40f199,_0x853cce);_0x538b2d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x732e('0x6')](e,emitEvent(event));}}module[_0x732e('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index c238410..5337c4a 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 _0x790e=['VoiceExtension','voice_extensions','lodash','util','api','moment','request-promise','path','define'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x790e,0xe3));var _0xe790=function(_0x282eac,_0x35c354){_0x282eac=_0x282eac-0x0;var _0x34a7a8=_0x790e[_0x282eac];return _0x34a7a8;};'use strict';var _=require(_0xe790('0x0'));var util=require(_0xe790('0x1'));var logger=require('../../config/logger')(_0xe790('0x2'));var moment=require(_0xe790('0x3'));var BPromise=require('bluebird');var rp=require(_0xe790('0x4'));var fs=require('fs');var path=require(_0xe790('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x6bd048,_0x525e8b){return _0x6bd048[_0xe790('0x6')](_0xe790('0x7'),attributes,{'tableName':_0xe790('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ce4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceExtension.attributes','exports','define','VoiceExtension','voice_extensions'];(function(_0x4cb445,_0x2973a9){var _0x5ae691=function(_0x5f1898){while(--_0x5f1898){_0x4cb445['push'](_0x4cb445['shift']());}};_0x5ae691(++_0x2973a9);}(_0x9ce4,0x1dc));var _0x49ce=function(_0x33aceb,_0x426921){_0x33aceb=_0x33aceb-0x0;var _0x571c82=_0x9ce4[_0x33aceb];return _0x571c82;};'use strict';var _=require(_0x49ce('0x0'));var util=require(_0x49ce('0x1'));var logger=require(_0x49ce('0x2'))(_0x49ce('0x3'));var moment=require(_0x49ce('0x4'));var BPromise=require(_0x49ce('0x5'));var rp=require(_0x49ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x49ce('0x7'));var config=require(_0x49ce('0x8'));var attributes=require(_0x49ce('0x9'));module[_0x49ce('0xa')]=function(_0x142a3d,_0x4ccc48){return _0x142a3d[_0x49ce('0xb')](_0x49ce('0xc'),attributes,{'tableName':_0x49ce('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index fcce3c0..14b2acc 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 _0x37f0=['stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','register','request','info','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','code','message','error','result','catch','GetVoiceExtension','findAll','raw','options','attributes','limit','include','map','model','then','debug'];(function(_0x3e0098,_0x5cadec){var _0x204bbd=function(_0x86f997){while(--_0x86f997){_0x3e0098['push'](_0x3e0098['shift']());}};_0x204bbd(++_0x5cadec);}(_0x37f0,0x1e2));var _0x037f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x37f0[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x037f('0x0'));var moment=require(_0x037f('0x1'));var BPromise=require(_0x037f('0x2'));var rs=require(_0x037f('0x3'));var fs=require('fs');var Redis=require(_0x037f('0x4'));var db=require(_0x037f('0x5'))['db'];var utils=require(_0x037f('0x6'));var logger=require('../../config/logger')(_0x037f('0x7'));var config=require(_0x037f('0x8'));var jayson=require(_0x037f('0x9'));var client=jayson[_0x037f('0xa')]['http']({'port':0x232a});config['redis']=_[_0x037f('0xb')](config[_0x037f('0xc')],{'host':_0x037f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x037f('0xc')]));require('./voiceExtension.socket')[_0x037f('0xe')](socket);function respondWithRpcPromise(_0x333738,_0x2761a0,_0x3dc0ac){return new BPromise(function(_0x242493,_0x56e55a){return client[_0x037f('0xf')](_0x333738,_0x3dc0ac)['then'](function(_0x1778b9){logger[_0x037f('0x10')](_0x037f('0x11'),_0x2761a0,'request\x20sent');logger['debug'](_0x037f('0x12'),_0x2761a0,_0x037f('0x13'),JSON['stringify'](_0x1778b9));if(_0x1778b9['error']){if(_0x1778b9['error'][_0x037f('0x14')]===0x1f4){logger['error'](_0x037f('0x11'),_0x2761a0,_0x1778b9['error'][_0x037f('0x15')]);return _0x56e55a(_0x1778b9['error'][_0x037f('0x15')]);}logger[_0x037f('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x2761a0,_0x1778b9[_0x037f('0x16')]['message']);return _0x242493(_0x1778b9[_0x037f('0x16')][_0x037f('0x15')]);}else{logger[_0x037f('0x10')](_0x037f('0x11'),_0x2761a0,_0x037f('0x13'));_0x242493(_0x1778b9[_0x037f('0x17')]['message']);}})[_0x037f('0x18')](function(_0xcc0465){logger['error'](_0x037f('0x11'),_0x2761a0,_0xcc0465);_0x56e55a(_0xcc0465);});});}exports[_0x037f('0x19')]=function(_0x425d7b){var _0x1ae4b7=this;return new Promise(function(_0x3cecdc,_0x3a3a3b){return db['VoiceExtension'][_0x037f('0x1a')]({'raw':_0x425d7b['options']?_0x425d7b['options'][_0x037f('0x1b')]===undefined?!![]:![]:!![],'where':_0x425d7b[_0x037f('0x1c')]?_0x425d7b[_0x037f('0x1c')]['where']||null:null,'attributes':_0x425d7b[_0x037f('0x1c')]?_0x425d7b[_0x037f('0x1c')][_0x037f('0x1d')]||null:null,'limit':_0x425d7b[_0x037f('0x1c')]?_0x425d7b[_0x037f('0x1c')][_0x037f('0x1e')]||null:null,'include':_0x425d7b['options']?_0x425d7b[_0x037f('0x1c')][_0x037f('0x1f')]?_[_0x037f('0x20')](_0x425d7b[_0x037f('0x1c')][_0x037f('0x1f')],function(_0x1863c7){return{'model':db[_0x1863c7['model']],'as':_0x1863c7['as'],'attributes':_0x1863c7[_0x037f('0x1d')],'include':_0x1863c7['include']?_[_0x037f('0x20')](_0x1863c7[_0x037f('0x1f')],function(_0x2dda64){return{'model':db[_0x2dda64[_0x037f('0x21')]],'as':_0x2dda64['as'],'attributes':_0x2dda64[_0x037f('0x1d')],'include':_0x2dda64[_0x037f('0x1f')]?_['map'](_0x2dda64[_0x037f('0x1f')],function(_0xbce829){return{'model':db[_0xbce829[_0x037f('0x21')]],'as':_0xbce829['as'],'attributes':_0xbce829[_0x037f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x037f('0x22')](function(_0x5eedd9){logger[_0x037f('0x10')](_0x037f('0x19'),_0x425d7b);logger[_0x037f('0x23')](_0x037f('0x19'),_0x425d7b,JSON[_0x037f('0x24')](_0x5eedd9));_0x3cecdc(_0x5eedd9);})[_0x037f('0x18')](function(_0x5375a9){logger[_0x037f('0x16')](_0x037f('0x19'),_0x5375a9['message'],_0x425d7b);_0x3a3a3b(_0x1ae4b7['error'](0x1f4,_0x5375a9[_0x037f('0x15')]));});});}; \ No newline at end of file +var _0x25e8=['info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceExtension','findAll','raw','options','where','attributes','limit','include','model','map','GetVoiceExtension','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then'];(function(_0x47dabf,_0x468106){var _0x2baaa5=function(_0x1bf373){while(--_0x1bf373){_0x47dabf['push'](_0x47dabf['shift']());}};_0x2baaa5(++_0x468106);}(_0x25e8,0xae));var _0x825e=function(_0x275f22,_0x3bfdf6){_0x275f22=_0x275f22-0x0;var _0x52f7ef=_0x25e8[_0x275f22];return _0x52f7ef;};'use strict';var _=require(_0x825e('0x0'));var util=require(_0x825e('0x1'));var moment=require(_0x825e('0x2'));var BPromise=require(_0x825e('0x3'));var rs=require(_0x825e('0x4'));var fs=require('fs');var Redis=require(_0x825e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x825e('0x6'))(_0x825e('0x7'));var config=require(_0x825e('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x825e('0x9')],{'host':_0x825e('0xa'),'port':0x18eb});var socket=require(_0x825e('0xb'))(new Redis(config[_0x825e('0x9')]));require(_0x825e('0xc'))[_0x825e('0xd')](socket);function respondWithRpcPromise(_0x3c860c,_0x50816b,_0x4f0ac7){return new BPromise(function(_0x25ea19,_0x51e7ad){return client[_0x825e('0xe')](_0x3c860c,_0x4f0ac7)[_0x825e('0xf')](function(_0x1717d7){logger[_0x825e('0x10')](_0x825e('0x11'),_0x50816b,_0x825e('0x12'));logger['debug'](_0x825e('0x13'),_0x50816b,_0x825e('0x12'),JSON[_0x825e('0x14')](_0x1717d7));if(_0x1717d7[_0x825e('0x15')]){if(_0x1717d7[_0x825e('0x15')][_0x825e('0x16')]===0x1f4){logger[_0x825e('0x15')](_0x825e('0x11'),_0x50816b,_0x1717d7[_0x825e('0x15')][_0x825e('0x17')]);return _0x51e7ad(_0x1717d7[_0x825e('0x15')][_0x825e('0x17')]);}logger[_0x825e('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x50816b,_0x1717d7[_0x825e('0x15')][_0x825e('0x17')]);return _0x25ea19(_0x1717d7['error'][_0x825e('0x17')]);}else{logger[_0x825e('0x10')](_0x825e('0x11'),_0x50816b,_0x825e('0x12'));_0x25ea19(_0x1717d7[_0x825e('0x18')][_0x825e('0x17')]);}})[_0x825e('0x19')](function(_0x3818b7){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x50816b,_0x3818b7);_0x51e7ad(_0x3818b7);});});}exports['GetVoiceExtension']=function(_0x573eec){var _0x39ea5d=this;return new Promise(function(_0x3f6296,_0x6e9483){return db[_0x825e('0x1a')][_0x825e('0x1b')]({'raw':_0x573eec['options']?_0x573eec['options'][_0x825e('0x1c')]===undefined?!![]:![]:!![],'where':_0x573eec[_0x825e('0x1d')]?_0x573eec[_0x825e('0x1d')][_0x825e('0x1e')]||null:null,'attributes':_0x573eec[_0x825e('0x1d')]?_0x573eec[_0x825e('0x1d')][_0x825e('0x1f')]||null:null,'limit':_0x573eec['options']?_0x573eec[_0x825e('0x1d')][_0x825e('0x20')]||null:null,'include':_0x573eec[_0x825e('0x1d')]?_0x573eec[_0x825e('0x1d')][_0x825e('0x21')]?_['map'](_0x573eec[_0x825e('0x1d')][_0x825e('0x21')],function(_0x508de9){return{'model':db[_0x508de9[_0x825e('0x22')]],'as':_0x508de9['as'],'attributes':_0x508de9[_0x825e('0x1f')],'include':_0x508de9[_0x825e('0x21')]?_[_0x825e('0x23')](_0x508de9[_0x825e('0x21')],function(_0x57c234){return{'model':db[_0x57c234[_0x825e('0x22')]],'as':_0x57c234['as'],'attributes':_0x57c234[_0x825e('0x1f')],'include':_0x57c234[_0x825e('0x21')]?_[_0x825e('0x23')](_0x57c234[_0x825e('0x21')],function(_0x512153){return{'model':db[_0x512153[_0x825e('0x22')]],'as':_0x512153['as'],'attributes':_0x512153[_0x825e('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ce258){logger[_0x825e('0x10')](_0x825e('0x24'),_0x573eec);logger[_0x825e('0x25')]('GetVoiceExtension',_0x573eec,JSON['stringify'](_0x2ce258));_0x3f6296(_0x2ce258);})[_0x825e('0x19')](function(_0x4b076d){logger['error'](_0x825e('0x24'),_0x4b076d[_0x825e('0x17')],_0x573eec);_0x6e9483(_0x39ea5d[_0x825e('0x15')](0x1f4,_0x4b076d['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 5264466..cc8faaf 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 _0x764a=['remove','update','emit','register','voiceExtension:','./voiceExtension.events','save'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x764a,0xde));var _0xa764=function(_0x3500ca,_0x2de9b2){_0x3500ca=_0x3500ca-0x0;var _0x5cd2a8=_0x764a[_0x3500ca];return _0x5cd2a8;};'use strict';var VoiceExtensionEvents=require(_0xa764('0x0'));var events=[_0xa764('0x1'),_0xa764('0x2'),_0xa764('0x3')];function createListener(_0x2f7177,_0x21da66){return function(_0x52aa95){_0x21da66[_0xa764('0x4')](_0x2f7177,_0x52aa95);};}function removeListener(_0x34e9f3,_0x2aa846){return function(){VoiceExtensionEvents['removeListener'](_0x34e9f3,_0x2aa846);};}exports[_0xa764('0x5')]=function(_0x506ca2){for(var _0x55e41a=0x0,_0x7c2441=events['length'];_0x55e41a<_0x7c2441;_0x55e41a++){var _0x10f84d=events[_0x55e41a];var _0x574cbf=createListener(_0xa764('0x6')+_0x10f84d,_0x506ca2);VoiceExtensionEvents['on'](_0x10f84d,_0x574cbf);}}; \ No newline at end of file +var _0x1117=['register','length','voiceExtension:','./voiceExtension.events','save','remove','update'];(function(_0x24d8db,_0x2392c6){var _0x13d20d=function(_0x568f80){while(--_0x568f80){_0x24d8db['push'](_0x24d8db['shift']());}};_0x13d20d(++_0x2392c6);}(_0x1117,0x153));var _0x7111=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x1117[_0xfae23b];return _0x200640;};'use strict';var VoiceExtensionEvents=require(_0x7111('0x0'));var events=[_0x7111('0x1'),_0x7111('0x2'),_0x7111('0x3')];function createListener(_0x530399,_0x1cfc6a){return function(_0x5a4cac){_0x1cfc6a['emit'](_0x530399,_0x5a4cac);};}function removeListener(_0x1a3b7d,_0x50db48){return function(){VoiceExtensionEvents['removeListener'](_0x1a3b7d,_0x50db48);};}exports[_0x7111('0x4')]=function(_0x3bf2bc){for(var _0xd391a7=0x0,_0x3d45dd=events[_0x7111('0x5')];_0xd391a7<_0x3d45dd;_0xd391a7++){var _0x14fcc2=events[_0xd391a7];var _0x589651=createListener(_0x7111('0x6')+_0x14fcc2,_0x3bf2bc);VoiceExtensionEvents['on'](_0x14fcc2,_0x589651);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index d5278ff..6e853d0 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 _0xe186=['update','/:id','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','getMessages','post','create','put'];(function(_0x2d91c6,_0x10ae0e){var _0x3a8d19=function(_0x27a3ce){while(--_0x27a3ce){_0x2d91c6['push'](_0x2d91c6['shift']());}};_0x3a8d19(++_0x10ae0e);}(_0xe186,0x1df));var _0x6e18=function(_0x46813f,_0x21e2f2){_0x46813f=_0x46813f-0x0;var _0x6d6f66=_0xe186[_0x46813f];return _0x6d6f66;};'use strict';var multer=require(_0x6e18('0x0'));var util=require(_0x6e18('0x1'));var path=require('path');var timeout=require(_0x6e18('0x2'));var express=require(_0x6e18('0x3'));var router=express['Router']();var auth=require(_0x6e18('0x4'));var interaction=require(_0x6e18('0x5'));var config=require('../../config/environment');var controller=require(_0x6e18('0x6'));router[_0x6e18('0x7')]('/',auth[_0x6e18('0x8')](),controller[_0x6e18('0x9')]);router['get']('/:id',auth[_0x6e18('0x8')](),controller['show']);router[_0x6e18('0x7')]('/:id/messages',auth[_0x6e18('0x8')](),controller[_0x6e18('0xa')]);router[_0x6e18('0xb')]('/',auth[_0x6e18('0x8')](),controller[_0x6e18('0xc')]);router[_0x6e18('0xd')]('/:id',auth[_0x6e18('0x8')](),controller[_0x6e18('0xe')]);router['delete'](_0x6e18('0xf'),auth[_0x6e18('0x8')](),controller['destroy']);module[_0x6e18('0x10')]=router; \ No newline at end of file +var _0xb784=['destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','delete'];(function(_0x4510f8,_0x4a6198){var _0x139364=function(_0x50fcbf){while(--_0x50fcbf){_0x4510f8['push'](_0x4510f8['shift']());}};_0x139364(++_0x4a6198);}(_0xb784,0x74));var _0x4b78=function(_0x27bc9b,_0x55b1f6){_0x27bc9b=_0x27bc9b-0x0;var _0x14abf7=_0xb784[_0x27bc9b];return _0x14abf7;};'use strict';var multer=require('multer');var util=require(_0x4b78('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4b78('0x1'));var router=express[_0x4b78('0x2')]();var auth=require(_0x4b78('0x3'));var interaction=require(_0x4b78('0x4'));var config=require(_0x4b78('0x5'));var controller=require(_0x4b78('0x6'));router[_0x4b78('0x7')]('/',auth[_0x4b78('0x8')](),controller[_0x4b78('0x9')]);router[_0x4b78('0x7')](_0x4b78('0xa'),auth[_0x4b78('0x8')](),controller[_0x4b78('0xb')]);router['get']('/:id/messages',auth[_0x4b78('0x8')](),controller[_0x4b78('0xc')]);router[_0x4b78('0xd')]('/',auth[_0x4b78('0x8')](),controller[_0x4b78('0xe')]);router[_0x4b78('0xf')](_0x4b78('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x4b78('0x10')](_0x4b78('0xa'),auth[_0x4b78('0x8')](),controller[_0x4b78('0x11')]);module[_0x4b78('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index eb0039e..344ec6d 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 _0xb10b=['ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','email','string','trim','central'];(function(_0x3a77ce,_0x486ee8){var _0xe885c7=function(_0x5a8ae0){while(--_0x5a8ae0){_0x3a77ce['push'](_0x3a77ce['shift']());}};_0xe885c7(++_0x486ee8);}(_0xb10b,0x12a));var _0xbb10=function(_0x36f641,_0x1a3063){_0x36f641=_0x36f641-0x0;var _0x39b299=_0xb10b[_0x36f641];return _0x39b299;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xbb10('0x1')]},'context':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':_0xbb10('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':'','allowNull':![],'unique':_0xbb10('0x3')},'password':{'type':Sequelize[_0xbb10('0x1')]},'fullname':{'type':Sequelize[_0xbb10('0x1')]},'email':{'type':Sequelize[_0xbb10('0x1')],'validate':{'isEmail':!![]},'set':function(_0x312b72){this['setDataValue'](_0xbb10('0x4'),typeof _0x312b72===_0xbb10('0x5')&&_0x312b72['trim']()?_0x312b72[_0xbb10('0x6')]():null);}},'pager':{'type':Sequelize[_0xbb10('0x1')]},'tz':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':_0xbb10('0x7')},'attach':{'type':Sequelize[_0xbb10('0x8')](_0xbb10('0x9'),'no'),'defaultValue':_0xbb10('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xbb10('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xbb10('0x1')]},'callback':{'type':Sequelize[_0xbb10('0x1')]},'review':{'type':Sequelize[_0xbb10('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xbb10('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xbb10('0x8')](_0xbb10('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xbb10('0x8')](_0xbb10('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xbb10('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xbb10('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xbb10('0x8')](_0xbb10('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xbb10('0x8')](_0xbb10('0x9'),'no'),'defaultValue':_0xbb10('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xbb10('0x8')](_0xbb10('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xbb10('0x8')](_0xbb10('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xbb10('0x8')]('yes','no'),'defaultValue':_0xbb10('0x9'),'allowNull':![]},'stamp':{'type':_0xbb10('0xb')},'emailsubject':{'type':Sequelize[_0xbb10('0x1')]},'emailbody':{'type':Sequelize[_0xbb10('0x1')]},'maxsecs':{'type':Sequelize[_0xbb10('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xbb10('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xbb10('0xd')],'get':function(){return this[_0xbb10('0xe')](_0xbb10('0xf'))+_0xbb10('0x10')+this['getDataValue'](_0xbb10('0x11'));}}}; \ No newline at end of file +var _0x2032=['yes','ENUM','INTEGER','VIRTUAL','fullname','getDataValue','mailbox','exports','STRING','contest_mailbox','setDataValue','email','string','trim'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x2032,0xd9));var _0x2203=function(_0x7a8bf,_0x3ef6bc){_0x7a8bf=_0x7a8bf-0x0;var _0x268d37=_0x2032[_0x7a8bf];return _0x268d37;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'customer_id':{'type':Sequelize[_0x2203('0x1')]},'context':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'from-voicemail','unique':_0x2203('0x2')},'mailbox':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x2203('0x1')]},'fullname':{'type':Sequelize[_0x2203('0x1')]},'email':{'type':Sequelize[_0x2203('0x1')],'validate':{'isEmail':!![]},'set':function(_0x201796){this[_0x2203('0x3')](_0x2203('0x4'),typeof _0x201796===_0x2203('0x5')&&_0x201796[_0x2203('0x6')]()?_0x201796[_0x2203('0x6')]():null);}},'pager':{'type':Sequelize[_0x2203('0x1')]},'tz':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x2203('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x2203('0x8')](_0x2203('0x7'),'no'),'defaultValue':_0x2203('0x7'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x2203('0x1')]},'review':{'type':Sequelize['ENUM'](_0x2203('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x2203('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x2203('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x2203('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x2203('0x8')](_0x2203('0x7'),'no'),'defaultValue':_0x2203('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x2203('0x8')](_0x2203('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x2203('0x8')](_0x2203('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x2203('0x8')](_0x2203('0x7'),'no'),'defaultValue':_0x2203('0x7'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x2203('0x1')]},'emailbody':{'type':Sequelize[_0x2203('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x2203('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x2203('0xa')],'get':function(){return this['getDataValue'](_0x2203('0xb'))+'\x20-\x20'+this[_0x2203('0xc')](_0x2203('0xd'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index a10e70d..40c49e9 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 _0x17a7=['rows','show','params','rawAttributes','length','catch','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','nolimit','order','pick','mailbox','options','VoiceMailMessage','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','get','Voicemails','UserProfileResource','sendStatus','error','stack','name','send','map','VoiceMail','fieldName','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','sort','filters','where','type','VIRTUAL','filter','merge','count','includeAll','include'];(function(_0x57d18f,_0x373cc2){var _0x43b7e6=function(_0x4004b3){while(--_0x4004b3){_0x57d18f['push'](_0x57d18f['shift']());}};_0x43b7e6(++_0x373cc2);}(_0x17a7,0xc2));var _0x717a=function(_0x2c4d88,_0x3c3827){_0x2c4d88=_0x2c4d88-0x0;var _0x13b020=_0x17a7[_0x2c4d88];return _0x13b020;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x717a('0x0'));var jsonpatch=require(_0x717a('0x1'));var rp=require(_0x717a('0x2'));var moment=require(_0x717a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x717a('0x4'));var util=require('util');var path=require(_0x717a('0x5'));var sox=require(_0x717a('0x6'));var csv=require('to-csv');var ejs=require(_0x717a('0x7'));var fs=require('fs');var _=require(_0x717a('0x8'));var squel=require(_0x717a('0x9'));var crypto=require(_0x717a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x717a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x717a('0xc'));var Papa=require('papaparse');var Redis=require(_0x717a('0xd'));var authService=require(_0x717a('0xe'));var qs=require(_0x717a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x717a('0x10'))(_0x717a('0x11'));var utils=require(_0x717a('0x12'));var config=require(_0x717a('0x13'));var licenseUtil=require(_0x717a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45eb68,_0x588baf){_0x588baf=_0x588baf||0xcc;return function(_0x2e2e95){if(_0x2e2e95){return _0x45eb68['sendStatus'](_0x588baf);}return _0x45eb68['status'](_0x588baf)['end']();};}function respondWithResult(_0x4a11bb,_0x295862){_0x295862=_0x295862||0xc8;return function(_0x546495){if(_0x546495){return _0x4a11bb[_0x717a('0x15')](_0x295862)['json'](_0x546495);}};}function respondWithFilteredResult(_0x1eca09,_0x58e33a){return function(_0xb85066){if(_0xb85066){var _0x6ae1be=_0xb85066['count'],_0x11c7fa=_0x58e33a[_0x717a('0x16')],_0x5c396d=_0x58e33a[_0x717a('0x16')]+_0x58e33a[_0x717a('0x17')],_0x186b4d;if(_0x5c396d>=_0x6ae1be){_0x5c396d=_0x6ae1be;_0x186b4d=0xc8;}else{_0x186b4d=0xce;}_0x1eca09[_0x717a('0x15')](_0x186b4d);return _0x1eca09[_0x717a('0x18')](_0x717a('0x19'),_0x11c7fa+'-'+_0x5c396d+'/'+_0x6ae1be)[_0x717a('0x1a')](_0xb85066);}return null;};}function patchUpdates(_0x3e8649){return function(_0x1e798f){try{jsonpatch[_0x717a('0x1b')](_0x1e798f,_0x3e8649,!![]);}catch(_0x5e60f7){return BPromise['reject'](_0x5e60f7);}return _0x1e798f[_0x717a('0x1c')]();};}function saveUpdates(_0x1d7ebd,_0x3ac808){return function(_0xd271f6){if(_0xd271f6){return _0xd271f6[_0x717a('0x1d')](_0x1d7ebd)[_0x717a('0x1e')](function(_0x24e052){return _0x24e052;});}return null;};}function removeEntity(_0x50847f,_0x4e95dc){return function(_0x3fc2be){if(_0x3fc2be){return _0x3fc2be[_0x717a('0x1f')]()[_0x717a('0x1e')](function(){var _0x33947c=_0x3fc2be[_0x717a('0x20')]({'plain':!![]});var _0x594e9c=_0x717a('0x21');return db[_0x717a('0x22')][_0x717a('0x1f')]({'where':{'type':_0x594e9c,'resourceId':_0x33947c['id']}})['then'](function(){return _0x3fc2be;});})[_0x717a('0x1e')](function(){_0x50847f[_0x717a('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f443a,_0x329999){return function(_0x3eb06d){if(!_0x3eb06d){_0x3f443a[_0x717a('0x23')](0x194);}return _0x3eb06d;};}function handleError(_0x2c0cb3,_0x5c3a3a){_0x5c3a3a=_0x5c3a3a||0x1f4;return function(_0x1654dd){logger[_0x717a('0x24')](_0x1654dd[_0x717a('0x25')]);if(_0x1654dd[_0x717a('0x26')]){delete _0x1654dd[_0x717a('0x26')];}_0x2c0cb3[_0x717a('0x15')](_0x5c3a3a)[_0x717a('0x27')](_0x1654dd);};}exports['index']=function(_0x3621dc,_0x292cfe){var _0xc189b={},_0x47e24b={},_0x5b8c01={'count':0x0,'rows':[]};var _0x2b8b19=_[_0x717a('0x28')](db[_0x717a('0x29')]['rawAttributes'],function(_0x2719ab){return{'name':_0x2719ab[_0x717a('0x2a')],'type':_0x2719ab['type'][_0x717a('0x2b')]};});_0x47e24b['model']=_[_0x717a('0x28')](_0x2b8b19,_0x717a('0x26'));_0x47e24b[_0x717a('0x2c')]=_[_0x717a('0x2d')](_0x3621dc['query']);_0x47e24b['filters']=_['intersection'](_0x47e24b[_0x717a('0x2e')],_0x47e24b['query']);_0xc189b[_0x717a('0x2f')]=_[_0x717a('0x30')](_0x47e24b[_0x717a('0x2e')],qs[_0x717a('0x31')](_0x3621dc['query']['fields']));_0xc189b[_0x717a('0x2f')]=_0xc189b[_0x717a('0x2f')]['length']?_0xc189b[_0x717a('0x2f')]:_0x47e24b[_0x717a('0x2e')];if(!_0x3621dc[_0x717a('0x2c')][_0x717a('0x32')]('nolimit')){_0xc189b[_0x717a('0x17')]=qs[_0x717a('0x17')](_0x3621dc[_0x717a('0x2c')][_0x717a('0x17')]);_0xc189b['offset']=qs[_0x717a('0x16')](_0x3621dc['query']['offset']);}_0xc189b['order']=qs['sort'](_0x3621dc[_0x717a('0x2c')][_0x717a('0x33')]);_0xc189b['where']=qs['filters'](_['pick'](_0x3621dc[_0x717a('0x2c')],_0x47e24b[_0x717a('0x34')]),_0x2b8b19);if(_0x3621dc[_0x717a('0x2c')]['filter']){_0xc189b[_0x717a('0x35')]=_['merge'](_0xc189b['where'],{'$or':_[_0x717a('0x28')](_0x2b8b19,function(_0x150d38){if(_0x150d38[_0x717a('0x36')]!==_0x717a('0x37')){var _0x42b330={};_0x42b330[_0x150d38[_0x717a('0x26')]]={'$like':'%'+_0x3621dc[_0x717a('0x2c')][_0x717a('0x38')]+'%'};return _0x42b330;}})});}_0xc189b=_[_0x717a('0x39')]({},_0xc189b,_0x3621dc['options']);var _0x7dfb98={'where':_0xc189b[_0x717a('0x35')]};return db[_0x717a('0x29')][_0x717a('0x3a')](_0x7dfb98)['then'](function(_0x5cd8d3){_0x5b8c01[_0x717a('0x3a')]=_0x5cd8d3;if(_0x3621dc[_0x717a('0x2c')][_0x717a('0x3b')]){_0xc189b[_0x717a('0x3c')]=[{'all':!![]}];}return db[_0x717a('0x29')]['findAll'](_0xc189b);})[_0x717a('0x1e')](function(_0x5cb5b6){_0x5b8c01[_0x717a('0x3d')]=_0x5cb5b6;return _0x5b8c01;})[_0x717a('0x1e')](respondWithFilteredResult(_0x292cfe,_0xc189b))['catch'](handleError(_0x292cfe,null));};exports[_0x717a('0x3e')]=function(_0x34edd5,_0x684c41){var _0x2a3c53={'raw':!![],'where':{'id':_0x34edd5[_0x717a('0x3f')]['id']}},_0x3ec510={};_0x3ec510[_0x717a('0x2e')]=_[_0x717a('0x2d')](db[_0x717a('0x29')][_0x717a('0x40')]);_0x3ec510[_0x717a('0x2c')]=_[_0x717a('0x2d')](_0x34edd5[_0x717a('0x2c')]);_0x3ec510['filters']=_['intersection'](_0x3ec510[_0x717a('0x2e')],_0x3ec510[_0x717a('0x2c')]);_0x2a3c53[_0x717a('0x2f')]=_[_0x717a('0x30')](_0x3ec510[_0x717a('0x2e')],qs[_0x717a('0x31')](_0x34edd5[_0x717a('0x2c')][_0x717a('0x31')]));_0x2a3c53[_0x717a('0x2f')]=_0x2a3c53[_0x717a('0x2f')][_0x717a('0x41')]?_0x2a3c53[_0x717a('0x2f')]:_0x3ec510[_0x717a('0x2e')];if(_0x34edd5[_0x717a('0x2c')][_0x717a('0x3b')]){_0x2a3c53['include']=[{'all':!![]}];}_0x2a3c53=_[_0x717a('0x39')]({},_0x2a3c53,_0x34edd5['options']);return db[_0x717a('0x29')]['find'](_0x2a3c53)[_0x717a('0x1e')](handleEntityNotFound(_0x684c41,null))[_0x717a('0x1e')](respondWithResult(_0x684c41,null))[_0x717a('0x42')](handleError(_0x684c41,null));};exports[_0x717a('0x43')]=function(_0x41de28,_0x53d084){return db[_0x717a('0x29')][_0x717a('0x43')](_0x41de28[_0x717a('0x44')],{})[_0x717a('0x1e')](function(_0x3914f4){var _0x20c865=_0x41de28[_0x717a('0x45')][_0x717a('0x20')]({'plain':!![]});if(!_0x20c865)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20c865[_0x717a('0x46')]==='user'){var _0x425142=_0x3914f4[_0x717a('0x20')]({'plain':!![]});var _0x4426e7=_0x717a('0x21');return db[_0x717a('0x47')][_0x717a('0x48')]({'where':{'name':_0x4426e7,'userProfileId':_0x20c865[_0x717a('0x49')]},'raw':!![]})[_0x717a('0x1e')](function(_0x2c8751){if(_0x2c8751&&_0x2c8751[_0x717a('0x4a')]===0x0){return db['UserProfileResource'][_0x717a('0x43')]({'name':_0x425142[_0x717a('0x26')],'resourceId':_0x425142['id'],'type':_0x2c8751[_0x717a('0x26')],'sectionId':_0x2c8751['id']},{})['then'](function(){return _0x3914f4;});}else{return _0x3914f4;}})['catch'](function(_0x312445){logger[_0x717a('0x24')](_0x717a('0x4b'),_0x312445);throw _0x312445;});}return _0x3914f4;})[_0x717a('0x1e')](respondWithResult(_0x53d084,0xc9))['catch'](handleError(_0x53d084,null));};exports[_0x717a('0x1d')]=function(_0x43a320,_0x5f3fff){if(_0x43a320[_0x717a('0x44')]['id']){delete _0x43a320[_0x717a('0x44')]['id'];}return db[_0x717a('0x29')][_0x717a('0x48')]({'where':{'id':_0x43a320[_0x717a('0x3f')]['id']}})[_0x717a('0x1e')](handleEntityNotFound(_0x5f3fff,null))[_0x717a('0x1e')](saveUpdates(_0x43a320['body'],null))['then'](respondWithResult(_0x5f3fff,null))[_0x717a('0x42')](handleError(_0x5f3fff,null));};exports[_0x717a('0x1f')]=function(_0x100ea5,_0x4ae13e){return db['VoiceMail'][_0x717a('0x48')]({'where':{'id':_0x100ea5[_0x717a('0x3f')]['id']}})[_0x717a('0x1e')](handleEntityNotFound(_0x4ae13e,null))[_0x717a('0x1e')](removeEntity(_0x4ae13e,null))[_0x717a('0x42')](handleError(_0x4ae13e,null));};exports[_0x717a('0x4c')]=function(_0x2b4235,_0x3d2468,_0x875fae){return db[_0x717a('0x29')][_0x717a('0x4d')]({'where':{'id':_0x2b4235[_0x717a('0x3f')]['id']}})[_0x717a('0x1e')](handleEntityNotFound(_0x3d2468,null))['then'](function(_0x29b350){var _0x568b15;var _0x58ff62={},_0x506f5e={};_0x506f5e[_0x717a('0x2e')]=_['keys'](db['VoiceMailMessage'][_0x717a('0x40')]);_0x506f5e['query']=_['keys'](_0x2b4235[_0x717a('0x2c')]);_0x506f5e['filters']=_['intersection'](_0x506f5e[_0x717a('0x2e')],_0x506f5e[_0x717a('0x2c')]);_0x58ff62[_0x717a('0x2f')]=_['intersection'](_0x506f5e[_0x717a('0x2e')],qs['fields'](_0x2b4235[_0x717a('0x2c')][_0x717a('0x31')]));_0x58ff62['attributes']=_0x58ff62[_0x717a('0x2f')][_0x717a('0x41')]?_0x58ff62[_0x717a('0x2f')]:_0x506f5e[_0x717a('0x2e')];if(!_0x2b4235['query'][_0x717a('0x32')](_0x717a('0x4e'))){_0x58ff62['limit']=qs[_0x717a('0x17')](_0x2b4235[_0x717a('0x2c')][_0x717a('0x17')]);_0x58ff62[_0x717a('0x16')]=qs[_0x717a('0x16')](_0x2b4235[_0x717a('0x2c')][_0x717a('0x16')]);}_0x58ff62[_0x717a('0x4f')]=qs[_0x717a('0x33')](_0x2b4235['query'][_0x717a('0x33')]);_0x58ff62[_0x717a('0x35')]=qs[_0x717a('0x34')](_[_0x717a('0x50')](_0x2b4235[_0x717a('0x2c')],_0x506f5e['filters']));if(_0x2b4235['query'][_0x717a('0x38')]){_0x58ff62[_0x717a('0x35')]=_[_0x717a('0x39')](_0x58ff62[_0x717a('0x35')],{'$or':_[_0x717a('0x28')](_0x58ff62['attributes'],function(_0x4688db){var _0x10c3ee={};_0x10c3ee[_0x4688db]={'$like':'%'+_0x2b4235[_0x717a('0x2c')][_0x717a('0x38')]+'%'};return _0x10c3ee;})});}_0x58ff62[_0x717a('0x35')]=_['merge'](_0x58ff62[_0x717a('0x35')],{'mailboxuser':_0x29b350[_0x717a('0x51')]});_0x58ff62=_[_0x717a('0x39')]({},_0x58ff62,_0x2b4235[_0x717a('0x52')]);return db[_0x717a('0x53')][_0x717a('0x54')](_0x58ff62)[_0x717a('0x1e')](respondWithFilteredResult(_0x3d2468,_0x58ff62));})[_0x717a('0x42')](handleError(_0x3d2468,null));}; \ No newline at end of file +var _0xf567=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','mailbox','findAndCountAll','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','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','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','VoiceMail','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filters','type','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','params','rawAttributes','catch'];(function(_0x20f08b,_0x5ad154){var _0x3aca7d=function(_0x41544d){while(--_0x41544d){_0x20f08b['push'](_0x20f08b['shift']());}};_0x3aca7d(++_0x5ad154);}(_0xf567,0x118));var _0x7f56=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf567[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0x7f56('0x0'));var emlformat=require(_0x7f56('0x1'));var rimraf=require(_0x7f56('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f56('0x3'));var rp=require(_0x7f56('0x4'));var moment=require('moment');var BPromise=require(_0x7f56('0x5'));var Mustache=require(_0x7f56('0x6'));var util=require(_0x7f56('0x7'));var path=require(_0x7f56('0x8'));var sox=require('sox');var csv=require(_0x7f56('0x9'));var ejs=require(_0x7f56('0xa'));var fs=require('fs');var _=require(_0x7f56('0xb'));var squel=require('squel');var crypto=require(_0x7f56('0xc'));var jsforce=require(_0x7f56('0xd'));var deskjs=require(_0x7f56('0xe'));var toCsv=require(_0x7f56('0x9'));var querystring=require(_0x7f56('0xf'));var Papa=require(_0x7f56('0x10'));var Redis=require(_0x7f56('0x11'));var authService=require(_0x7f56('0x12'));var qs=require(_0x7f56('0x13'));var as=require(_0x7f56('0x14'));var hardwareService=require(_0x7f56('0x15'));var logger=require(_0x7f56('0x16'))(_0x7f56('0x17'));var utils=require(_0x7f56('0x18'));var config=require(_0x7f56('0x19'));var licenseUtil=require(_0x7f56('0x1a'));var db=require(_0x7f56('0x1b'))['db'];function respondWithStatusCode(_0x12557f,_0x3677af){_0x3677af=_0x3677af||0xcc;return function(_0x13b663){if(_0x13b663){return _0x12557f[_0x7f56('0x1c')](_0x3677af);}return _0x12557f[_0x7f56('0x1d')](_0x3677af)['end']();};}function respondWithResult(_0x3cc92b,_0x32119f){_0x32119f=_0x32119f||0xc8;return function(_0x11d663){if(_0x11d663){return _0x3cc92b['status'](_0x32119f)[_0x7f56('0x1e')](_0x11d663);}};}function respondWithFilteredResult(_0x211be1,_0x52e072){return function(_0x5f9e3c){if(_0x5f9e3c){var _0x441459=_0x5f9e3c['count'],_0x4ad41a=_0x52e072[_0x7f56('0x1f')],_0x5b2b27=_0x52e072[_0x7f56('0x1f')]+_0x52e072['limit'],_0x1dee75;if(_0x5b2b27>=_0x441459){_0x5b2b27=_0x441459;_0x1dee75=0xc8;}else{_0x1dee75=0xce;}_0x211be1[_0x7f56('0x1d')](_0x1dee75);return _0x211be1[_0x7f56('0x20')](_0x7f56('0x21'),_0x4ad41a+'-'+_0x5b2b27+'/'+_0x441459)[_0x7f56('0x1e')](_0x5f9e3c);}return null;};}function patchUpdates(_0x3f609e){return function(_0x24fe45){try{jsonpatch['apply'](_0x24fe45,_0x3f609e,!![]);}catch(_0x32aa49){return BPromise['reject'](_0x32aa49);}return _0x24fe45[_0x7f56('0x22')]();};}function saveUpdates(_0x56ba40,_0x38e7d5){return function(_0x36407f){if(_0x36407f){return _0x36407f[_0x7f56('0x23')](_0x56ba40)[_0x7f56('0x24')](function(_0x4706e4){return _0x4706e4;});}return null;};}function removeEntity(_0x4480b1,_0x9b7f15){return function(_0x3f54f8){if(_0x3f54f8){return _0x3f54f8[_0x7f56('0x25')]()[_0x7f56('0x24')](function(){var _0x52a902=_0x3f54f8[_0x7f56('0x26')]({'plain':!![]});var _0xe8f270=_0x7f56('0x27');return db[_0x7f56('0x28')][_0x7f56('0x25')]({'where':{'type':_0xe8f270,'resourceId':_0x52a902['id']}})[_0x7f56('0x24')](function(){return _0x3f54f8;});})[_0x7f56('0x24')](function(){_0x4480b1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a1f1b,_0x29de7c){return function(_0x5d2c39){if(!_0x5d2c39){_0x4a1f1b[_0x7f56('0x1c')](0x194);}return _0x5d2c39;};}function handleError(_0xc53c00,_0x1daeff){_0x1daeff=_0x1daeff||0x1f4;return function(_0x5bb367){logger[_0x7f56('0x29')](_0x5bb367[_0x7f56('0x2a')]);if(_0x5bb367[_0x7f56('0x2b')]){delete _0x5bb367[_0x7f56('0x2b')];}_0xc53c00['status'](_0x1daeff)[_0x7f56('0x2c')](_0x5bb367);};}exports[_0x7f56('0x2d')]=function(_0x20335a,_0x57d1db){var _0x10372d={},_0x1f247e={},_0x5f1de2={'count':0x0,'rows':[]};var _0x5823bb=_['map'](db[_0x7f56('0x2e')]['rawAttributes'],function(_0x4d92c0){return{'name':_0x4d92c0[_0x7f56('0x2f')],'type':_0x4d92c0['type'][_0x7f56('0x30')]};});_0x1f247e[_0x7f56('0x31')]=_[_0x7f56('0x32')](_0x5823bb,'name');_0x1f247e[_0x7f56('0x33')]=_[_0x7f56('0x34')](_0x20335a[_0x7f56('0x33')]);_0x1f247e['filters']=_[_0x7f56('0x35')](_0x1f247e[_0x7f56('0x31')],_0x1f247e[_0x7f56('0x33')]);_0x10372d[_0x7f56('0x36')]=_[_0x7f56('0x35')](_0x1f247e[_0x7f56('0x31')],qs[_0x7f56('0x37')](_0x20335a[_0x7f56('0x33')][_0x7f56('0x37')]));_0x10372d[_0x7f56('0x36')]=_0x10372d[_0x7f56('0x36')][_0x7f56('0x38')]?_0x10372d['attributes']:_0x1f247e['model'];if(!_0x20335a[_0x7f56('0x33')]['hasOwnProperty'](_0x7f56('0x39'))){_0x10372d[_0x7f56('0x3a')]=qs['limit'](_0x20335a[_0x7f56('0x33')][_0x7f56('0x3a')]);_0x10372d['offset']=qs[_0x7f56('0x1f')](_0x20335a[_0x7f56('0x33')]['offset']);}_0x10372d[_0x7f56('0x3b')]=qs[_0x7f56('0x3c')](_0x20335a[_0x7f56('0x33')]['sort']);_0x10372d[_0x7f56('0x3d')]=qs['filters'](_[_0x7f56('0x3e')](_0x20335a['query'],_0x1f247e[_0x7f56('0x3f')]),_0x5823bb);if(_0x20335a[_0x7f56('0x33')]['filter']){_0x10372d['where']=_['merge'](_0x10372d[_0x7f56('0x3d')],{'$or':_[_0x7f56('0x32')](_0x5823bb,function(_0x5b4b47){if(_0x5b4b47[_0x7f56('0x40')]!==_0x7f56('0x41')){var _0x3af75a={};_0x3af75a[_0x5b4b47[_0x7f56('0x2b')]]={'$like':'%'+_0x20335a[_0x7f56('0x33')][_0x7f56('0x42')]+'%'};return _0x3af75a;}})});}_0x10372d=_[_0x7f56('0x43')]({},_0x10372d,_0x20335a[_0x7f56('0x44')]);var _0x453741={'where':_0x10372d[_0x7f56('0x3d')]};return db[_0x7f56('0x2e')][_0x7f56('0x45')](_0x453741)[_0x7f56('0x24')](function(_0x20571d){_0x5f1de2[_0x7f56('0x45')]=_0x20571d;if(_0x20335a[_0x7f56('0x33')][_0x7f56('0x46')]){_0x10372d[_0x7f56('0x47')]=[{'all':!![]}];}return db[_0x7f56('0x2e')][_0x7f56('0x48')](_0x10372d);})[_0x7f56('0x24')](function(_0x404576){_0x5f1de2['rows']=_0x404576;return _0x5f1de2;})[_0x7f56('0x24')](respondWithFilteredResult(_0x57d1db,_0x10372d))['catch'](handleError(_0x57d1db,null));};exports['show']=function(_0x2ab999,_0x438a30){var _0x1f0d55={'raw':!![],'where':{'id':_0x2ab999[_0x7f56('0x49')]['id']}},_0x2e4751={};_0x2e4751[_0x7f56('0x31')]=_['keys'](db[_0x7f56('0x2e')][_0x7f56('0x4a')]);_0x2e4751['query']=_[_0x7f56('0x34')](_0x2ab999[_0x7f56('0x33')]);_0x2e4751[_0x7f56('0x3f')]=_[_0x7f56('0x35')](_0x2e4751[_0x7f56('0x31')],_0x2e4751[_0x7f56('0x33')]);_0x1f0d55[_0x7f56('0x36')]=_[_0x7f56('0x35')](_0x2e4751[_0x7f56('0x31')],qs[_0x7f56('0x37')](_0x2ab999[_0x7f56('0x33')]['fields']));_0x1f0d55['attributes']=_0x1f0d55[_0x7f56('0x36')][_0x7f56('0x38')]?_0x1f0d55['attributes']:_0x2e4751[_0x7f56('0x31')];if(_0x2ab999['query'][_0x7f56('0x46')]){_0x1f0d55[_0x7f56('0x47')]=[{'all':!![]}];}_0x1f0d55=_[_0x7f56('0x43')]({},_0x1f0d55,_0x2ab999['options']);return db[_0x7f56('0x2e')]['find'](_0x1f0d55)['then'](handleEntityNotFound(_0x438a30,null))[_0x7f56('0x24')](respondWithResult(_0x438a30,null))[_0x7f56('0x4b')](handleError(_0x438a30,null));};exports['create']=function(_0x12124c,_0x5e4805){return db[_0x7f56('0x2e')][_0x7f56('0x4c')](_0x12124c[_0x7f56('0x4d')],{})[_0x7f56('0x24')](function(_0x5cc708){var _0x25704f=_0x12124c[_0x7f56('0x4e')][_0x7f56('0x26')]({'plain':!![]});if(!_0x25704f)throw new Error(_0x7f56('0x4f'));if(_0x25704f[_0x7f56('0x50')]===_0x7f56('0x4e')){var _0x3abdd3=_0x5cc708[_0x7f56('0x26')]({'plain':!![]});var _0x725760='Voicemails';return db['UserProfileSection'][_0x7f56('0x51')]({'where':{'name':_0x725760,'userProfileId':_0x25704f['userProfileId']},'raw':!![]})[_0x7f56('0x24')](function(_0x3c623b){if(_0x3c623b&&_0x3c623b['autoAssociation']===0x0){return db[_0x7f56('0x28')][_0x7f56('0x4c')]({'name':_0x3abdd3['name'],'resourceId':_0x3abdd3['id'],'type':_0x3c623b[_0x7f56('0x2b')],'sectionId':_0x3c623b['id']},{})[_0x7f56('0x24')](function(){return _0x5cc708;});}else{return _0x5cc708;}})[_0x7f56('0x4b')](function(_0x530898){logger[_0x7f56('0x29')](_0x7f56('0x52'),_0x530898);throw _0x530898;});}return _0x5cc708;})[_0x7f56('0x24')](respondWithResult(_0x5e4805,0xc9))[_0x7f56('0x4b')](handleError(_0x5e4805,null));};exports['update']=function(_0x25f2ca,_0x47b14a){if(_0x25f2ca[_0x7f56('0x4d')]['id']){delete _0x25f2ca[_0x7f56('0x4d')]['id'];}return db[_0x7f56('0x2e')][_0x7f56('0x51')]({'where':{'id':_0x25f2ca[_0x7f56('0x49')]['id']}})[_0x7f56('0x24')](handleEntityNotFound(_0x47b14a,null))[_0x7f56('0x24')](saveUpdates(_0x25f2ca[_0x7f56('0x4d')],null))[_0x7f56('0x24')](respondWithResult(_0x47b14a,null))[_0x7f56('0x4b')](handleError(_0x47b14a,null));};exports[_0x7f56('0x25')]=function(_0x1ad8e5,_0x36bf14){return db[_0x7f56('0x2e')][_0x7f56('0x51')]({'where':{'id':_0x1ad8e5[_0x7f56('0x49')]['id']}})[_0x7f56('0x24')](handleEntityNotFound(_0x36bf14,null))[_0x7f56('0x24')](removeEntity(_0x36bf14,null))['catch'](handleError(_0x36bf14,null));};exports[_0x7f56('0x53')]=function(_0x1e8914,_0x4e948c,_0x36a534){return db['VoiceMail'][_0x7f56('0x54')]({'where':{'id':_0x1e8914['params']['id']}})[_0x7f56('0x24')](handleEntityNotFound(_0x4e948c,null))['then'](function(_0x36d8a0){var _0x20dbda;var _0x23dc1d={},_0x5cae81={};_0x5cae81[_0x7f56('0x31')]=_[_0x7f56('0x34')](db[_0x7f56('0x55')][_0x7f56('0x4a')]);_0x5cae81[_0x7f56('0x33')]=_[_0x7f56('0x34')](_0x1e8914[_0x7f56('0x33')]);_0x5cae81[_0x7f56('0x3f')]=_[_0x7f56('0x35')](_0x5cae81[_0x7f56('0x31')],_0x5cae81[_0x7f56('0x33')]);_0x23dc1d[_0x7f56('0x36')]=_[_0x7f56('0x35')](_0x5cae81[_0x7f56('0x31')],qs[_0x7f56('0x37')](_0x1e8914[_0x7f56('0x33')][_0x7f56('0x37')]));_0x23dc1d[_0x7f56('0x36')]=_0x23dc1d[_0x7f56('0x36')][_0x7f56('0x38')]?_0x23dc1d[_0x7f56('0x36')]:_0x5cae81[_0x7f56('0x31')];if(!_0x1e8914[_0x7f56('0x33')][_0x7f56('0x56')](_0x7f56('0x39'))){_0x23dc1d[_0x7f56('0x3a')]=qs[_0x7f56('0x3a')](_0x1e8914[_0x7f56('0x33')][_0x7f56('0x3a')]);_0x23dc1d[_0x7f56('0x1f')]=qs['offset'](_0x1e8914['query'][_0x7f56('0x1f')]);}_0x23dc1d[_0x7f56('0x3b')]=qs[_0x7f56('0x3c')](_0x1e8914[_0x7f56('0x33')][_0x7f56('0x3c')]);_0x23dc1d[_0x7f56('0x3d')]=qs[_0x7f56('0x3f')](_[_0x7f56('0x3e')](_0x1e8914['query'],_0x5cae81[_0x7f56('0x3f')]));if(_0x1e8914[_0x7f56('0x33')]['filter']){_0x23dc1d[_0x7f56('0x3d')]=_[_0x7f56('0x43')](_0x23dc1d[_0x7f56('0x3d')],{'$or':_[_0x7f56('0x32')](_0x23dc1d[_0x7f56('0x36')],function(_0x1cc07d){var _0x391962={};_0x391962[_0x1cc07d]={'$like':'%'+_0x1e8914[_0x7f56('0x33')]['filter']+'%'};return _0x391962;})});}_0x23dc1d[_0x7f56('0x3d')]=_['merge'](_0x23dc1d[_0x7f56('0x3d')],{'mailboxuser':_0x36d8a0[_0x7f56('0x57')]});_0x23dc1d=_[_0x7f56('0x43')]({},_0x23dc1d,_0x1e8914[_0x7f56('0x44')]);return db[_0x7f56('0x55')][_0x7f56('0x58')](_0x23dc1d)['then'](respondWithFilteredResult(_0x4e948c,_0x23dc1d));})['catch'](handleError(_0x4e948c,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 2880e1d..9cbe378 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 _0x8f45=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context'];(function(_0x395b47,_0x3f8e1a){var _0x573f3a=function(_0x8b65e4){while(--_0x8b65e4){_0x395b47['push'](_0x395b47['shift']());}};_0x573f3a(++_0x3f8e1a);}(_0x8f45,0x150));var _0x58f4=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x8f45[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x58f4('0x0'));var util=require(_0x58f4('0x1'));var logger=require(_0x58f4('0x2'))('api');var moment=require(_0x58f4('0x3'));var BPromise=require('bluebird');var rp=require(_0x58f4('0x4'));var fs=require('fs');var path=require(_0x58f4('0x5'));var rimraf=require(_0x58f4('0x6'));var config=require(_0x58f4('0x7'));var attributes=require(_0x58f4('0x8'));module[_0x58f4('0x9')]=function(_0x48adcc,_0x25d5c2){return _0x48adcc[_0x58f4('0xa')](_0x58f4('0xb'),attributes,{'tableName':_0x58f4('0xc'),'paranoid':![],'indexes':[{'name':_0x58f4('0xd'),'fields':[_0x58f4('0xe'),_0x58f4('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd11c=['voice_voicemail','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./voiceMail.attributes','exports','VoiceMail'];(function(_0x38e345,_0x269d73){var _0x2271a4=function(_0x49946a){while(--_0x49946a){_0x38e345['push'](_0x38e345['shift']());}};_0x2271a4(++_0x269d73);}(_0xd11c,0x64));var _0xcd11=function(_0x120c68,_0x5cf7a1){_0x120c68=_0x120c68-0x0;var _0x2b43a8=_0xd11c[_0x120c68];return _0x2b43a8;};'use strict';var _=require(_0xcd11('0x0'));var util=require(_0xcd11('0x1'));var logger=require(_0xcd11('0x2'))(_0xcd11('0x3'));var moment=require('moment');var BPromise=require(_0xcd11('0x4'));var rp=require(_0xcd11('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd11('0x6'));var config=require('../../config/environment');var attributes=require(_0xcd11('0x7'));module[_0xcd11('0x8')]=function(_0x16441c,_0x34ecb8){return _0x16441c['define'](_0xcd11('0x9'),attributes,{'tableName':_0xcd11('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 49206d5..cbde6ab 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 _0x7ca1=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash'];(function(_0x4f153b,_0x39818f){var _0x4e0cf8=function(_0x5a2236){while(--_0x5a2236){_0x4f153b['push'](_0x4f153b['shift']());}};_0x4e0cf8(++_0x39818f);}(_0x7ca1,0x18b));var _0x17ca=function(_0x1ba3c6,_0x2dcea2){_0x1ba3c6=_0x1ba3c6-0x0;var _0x4a8c85=_0x7ca1[_0x1ba3c6];return _0x4a8c85;};'use strict';var _=require(_0x17ca('0x0'));var util=require(_0x17ca('0x1'));var moment=require(_0x17ca('0x2'));var BPromise=require(_0x17ca('0x3'));var rs=require(_0x17ca('0x4'));var fs=require('fs');var Redis=require(_0x17ca('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x17ca('0x6'))(_0x17ca('0x7'));var config=require(_0x17ca('0x8'));var jayson=require(_0x17ca('0x9'));var client=jayson[_0x17ca('0xa')][_0x17ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cac7b,_0x527d36,_0x1380e9){return new BPromise(function(_0x2cda3f,_0xe5173f){return client[_0x17ca('0xc')](_0x4cac7b,_0x1380e9)['then'](function(_0x165c22){logger[_0x17ca('0xd')](_0x17ca('0xe'),_0x527d36,_0x17ca('0xf'));logger[_0x17ca('0x10')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x527d36,_0x17ca('0xf'),JSON[_0x17ca('0x11')](_0x165c22));if(_0x165c22[_0x17ca('0x12')]){if(_0x165c22[_0x17ca('0x12')][_0x17ca('0x13')]===0x1f4){logger['error'](_0x17ca('0xe'),_0x527d36,_0x165c22[_0x17ca('0x12')][_0x17ca('0x14')]);return _0xe5173f(_0x165c22[_0x17ca('0x12')]['message']);}logger[_0x17ca('0x12')](_0x17ca('0xe'),_0x527d36,_0x165c22[_0x17ca('0x12')][_0x17ca('0x14')]);return _0x2cda3f(_0x165c22['error'][_0x17ca('0x14')]);}else{logger[_0x17ca('0xd')](_0x17ca('0xe'),_0x527d36,'request\x20sent');_0x2cda3f(_0x165c22[_0x17ca('0x15')][_0x17ca('0x14')]);}})['catch'](function(_0x1059a3){logger[_0x17ca('0x12')](_0x17ca('0xe'),_0x527d36,_0x1059a3);_0xe5173f(_0x1059a3);});});} \ No newline at end of file +var _0x28f4=['VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','request\x20sent'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x28f4,0x139));var _0x428f=function(_0x12d1c1,_0x338b36){_0x12d1c1=_0x12d1c1-0x0;var _0x56db84=_0x28f4[_0x12d1c1];return _0x56db84;};'use strict';var _=require('lodash');var util=require(_0x428f('0x0'));var moment=require('moment');var BPromise=require(_0x428f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x428f('0x2'));var db=require(_0x428f('0x3'))['db'];var utils=require(_0x428f('0x4'));var logger=require(_0x428f('0x5'))('rpc');var config=require(_0x428f('0x6'));var jayson=require(_0x428f('0x7'));var client=jayson[_0x428f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13da4f,_0x21c6b,_0x3e6b29){return new BPromise(function(_0x5bcb8e,_0x261109){return client['request'](_0x13da4f,_0x3e6b29)['then'](function(_0x412114){logger[_0x428f('0x9')]('VoiceMail,\x20%s,\x20%s',_0x21c6b,_0x428f('0xa'));logger['debug'](_0x428f('0xb'),_0x21c6b,_0x428f('0xa'),JSON[_0x428f('0xc')](_0x412114));if(_0x412114[_0x428f('0xd')]){if(_0x412114[_0x428f('0xd')][_0x428f('0xe')]===0x1f4){logger[_0x428f('0xd')](_0x428f('0xf'),_0x21c6b,_0x412114['error'][_0x428f('0x10')]);return _0x261109(_0x412114['error'][_0x428f('0x10')]);}logger[_0x428f('0xd')](_0x428f('0xf'),_0x21c6b,_0x412114[_0x428f('0xd')]['message']);return _0x5bcb8e(_0x412114[_0x428f('0xd')]['message']);}else{logger[_0x428f('0x9')](_0x428f('0xf'),_0x21c6b,_0x428f('0xa'));_0x5bcb8e(_0x412114[_0x428f('0x11')]['message']);}})['catch'](function(_0xf0cc03){logger['error']('VoiceMail,\x20%s,\x20%s',_0x21c6b,_0xf0cc03);_0x261109(_0xf0cc03);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 5fb6957..f909ad8 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 _0xdbf5=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','delete','destroy'];(function(_0x34922e,_0xed54aa){var _0x3099ec=function(_0x168580){while(--_0x168580){_0x34922e['push'](_0x34922e['shift']());}};_0x3099ec(++_0xed54aa);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x42f9c6,_0x5cdd66){_0x42f9c6=_0x42f9c6-0x0;var _0x948351=_0xdbf5[_0x42f9c6];return _0x948351;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var auth=require(_0x5dbf('0x3'));var interaction=require(_0x5dbf('0x4'));var config=require(_0x5dbf('0x5'));var controller=require(_0x5dbf('0x6'));router[_0x5dbf('0x7')]('/',auth[_0x5dbf('0x8')](),controller[_0x5dbf('0x9')]);router[_0x5dbf('0x7')](_0x5dbf('0xa'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xb')]);router['get'](_0x5dbf('0xc'),auth['isAuthenticated'](),controller[_0x5dbf('0xd')]);router[_0x5dbf('0xe')]('/',auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xf')]);router['put'](_0x5dbf('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5dbf('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5dbf('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1261=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','/:id','show','/:id/download','isAuthenticated','download','create','put','destroy'];(function(_0x54daf5,_0x528643){var _0xf70158=function(_0x4902d6){while(--_0x4902d6){_0x54daf5['push'](_0x54daf5['shift']());}};_0xf70158(++_0x528643);}(_0x1261,0x144));var _0x1126=function(_0x28e0f1,_0xd1bfa0){_0x28e0f1=_0x28e0f1-0x0;var _0x13aedc=_0x1261[_0x28e0f1];return _0x13aedc;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var auth=require(_0x1126('0x5'));var interaction=require(_0x1126('0x6'));var config=require(_0x1126('0x7'));var controller=require(_0x1126('0x8'));router[_0x1126('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1126('0x9')](_0x1126('0xa'),auth['isAuthenticated'](),controller[_0x1126('0xb')]);router[_0x1126('0x9')](_0x1126('0xc'),auth[_0x1126('0xd')](),controller[_0x1126('0xe')]);router['post']('/',auth[_0x1126('0xd')](),controller[_0x1126('0xf')]);router[_0x1126('0x10')]('/:id',auth[_0x1126('0xd')](),controller['update']);router['delete'](_0x1126('0xa'),auth['isAuthenticated'](),controller[_0x1126('0x11')]);module[_0x1126('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 9d284c0..14a3ae4 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 _0x3e4e=['getDataValue','INTEGER','STRING','BLOB','long','sequelize','VIRTUAL'];(function(_0x2bddfd,_0x1c2a54){var _0x42fb52=function(_0x41b9cd){while(--_0x41b9cd){_0x2bddfd['push'](_0x2bddfd['shift']());}};_0x42fb52(++_0x1c2a54);}(_0x3e4e,0x12b));var _0xe3e4=function(_0x480dfd,_0x3ee591){_0x480dfd=_0x480dfd-0x0;var _0x139f47=_0x3e4e[_0x480dfd];return _0x139f47;};'use strict';var Sequelize=require(_0xe3e4('0x0'));module['exports']={'name':{'type':Sequelize[_0xe3e4('0x1')],'get':function(_0x137fbb){return this[_0xe3e4('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xe3e4('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xe3e4('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xe3e4('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xe3e4('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xe3e4('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xe3e4('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xe3e4('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xe3e4('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xe3e4('0x5')](_0xe3e4('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xe3e4('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xe3e4('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file +var _0xa083=['BLOB','long','TIMESTAMP','sequelize','getDataValue','INTEGER','STRING'];(function(_0x507148,_0x26ff54){var _0x18673c=function(_0x3abb7c){while(--_0x3abb7c){_0x507148['push'](_0x507148['shift']());}};_0x18673c(++_0x26ff54);}(_0xa083,0x1a7));var _0x3a08=function(_0x69da38,_0x44ad2e){_0x69da38=_0x69da38-0x0;var _0x51d097=_0xa083[_0x69da38];return _0x51d097;};'use strict';var Sequelize=require(_0x3a08('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xad0ada){return this[_0x3a08('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x3a08('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x3a08('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x3a08('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x3a08('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x3a08('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x3a08('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x3a08('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x3a08('0x4')](_0x3a08('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x3a08('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x3a08('0x6'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 6373635..504dcf5 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 _0x2f95=['squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','VoiceMailMessage','fieldName','type','model','differenceBy','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','options','includeAll','include','show','length','find','catch','create','body','params','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash'];(function(_0x27ee58,_0x28794a){var _0xb048f4=function(_0x164796){while(--_0x164796){_0x27ee58['push'](_0x27ee58['shift']());}};_0xb048f4(++_0x28794a);}(_0x2f95,0x140));var _0x52f9=function(_0x396e54,_0x42cd60){_0x396e54=_0x396e54-0x0;var _0x3a1bd0=_0x2f95[_0x396e54];return _0x3a1bd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x52f9('0x0'));var rimraf=require(_0x52f9('0x1'));var zipdir=require(_0x52f9('0x2'));var jsonpatch=require(_0x52f9('0x3'));var rp=require(_0x52f9('0x4'));var moment=require(_0x52f9('0x5'));var BPromise=require(_0x52f9('0x6'));var Mustache=require(_0x52f9('0x7'));var util=require(_0x52f9('0x8'));var path=require(_0x52f9('0x9'));var sox=require(_0x52f9('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x52f9('0xb'));var squel=require(_0x52f9('0xc'));var crypto=require('crypto');var jsforce=require(_0x52f9('0xd'));var deskjs=require(_0x52f9('0xe'));var toCsv=require(_0x52f9('0xf'));var querystring=require('querystring');var Papa=require(_0x52f9('0x10'));var Redis=require(_0x52f9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x52f9('0x12'));var as=require(_0x52f9('0x13'));var hardwareService=require(_0x52f9('0x14'));var logger=require(_0x52f9('0x15'))(_0x52f9('0x16'));var utils=require('../../config/utils');var config=require(_0x52f9('0x17'));var licenseUtil=require(_0x52f9('0x18'));var db=require(_0x52f9('0x19'))['db'];function respondWithStatusCode(_0x2036f0,_0x1bdaa0){_0x1bdaa0=_0x1bdaa0||0xcc;return function(_0x23a2fd){if(_0x23a2fd){return _0x2036f0['sendStatus'](_0x1bdaa0);}return _0x2036f0[_0x52f9('0x1a')](_0x1bdaa0)[_0x52f9('0x1b')]();};}function respondWithResult(_0x14d658,_0x2bbb30){_0x2bbb30=_0x2bbb30||0xc8;return function(_0x2b2b0c){if(_0x2b2b0c){return _0x14d658[_0x52f9('0x1a')](_0x2bbb30)[_0x52f9('0x1c')](_0x2b2b0c);}};}function respondWithFilteredResult(_0x562f56,_0x276846){return function(_0x60e61d){if(_0x60e61d){var _0x15f188=_0x60e61d[_0x52f9('0x1d')],_0x173fdc=_0x276846['offset'],_0x36b334=_0x276846['offset']+_0x276846[_0x52f9('0x1e')],_0x4bb752;if(_0x36b334>=_0x15f188){_0x36b334=_0x15f188;_0x4bb752=0xc8;}else{_0x4bb752=0xce;}_0x562f56[_0x52f9('0x1a')](_0x4bb752);return _0x562f56[_0x52f9('0x1f')](_0x52f9('0x20'),_0x173fdc+'-'+_0x36b334+'/'+_0x15f188)['json'](_0x60e61d);}return null;};}function patchUpdates(_0x5a6445){return function(_0x43574){try{jsonpatch[_0x52f9('0x21')](_0x43574,_0x5a6445,!![]);}catch(_0x284799){return BPromise[_0x52f9('0x22')](_0x284799);}return _0x43574[_0x52f9('0x23')]();};}function saveUpdates(_0x390913,_0xffe07){return function(_0x228798){if(_0x228798){return _0x228798[_0x52f9('0x24')](_0x390913)[_0x52f9('0x25')](function(_0x1e0425){return _0x1e0425;});}return null;};}function removeEntity(_0x41be45,_0x19e0b8){return function(_0x443985){if(_0x443985){return _0x443985[_0x52f9('0x26')]()[_0x52f9('0x25')](function(){_0x41be45[_0x52f9('0x1a')](0xcc)[_0x52f9('0x1b')]();});}};}function handleEntityNotFound(_0x529c3d,_0x4a5b73){return function(_0x565a6d){if(!_0x565a6d){_0x529c3d['sendStatus'](0x194);}return _0x565a6d;};}function handleError(_0x1e77e1,_0x43587f){_0x43587f=_0x43587f||0x1f4;return function(_0x312f52){logger[_0x52f9('0x27')](_0x312f52[_0x52f9('0x28')]);if(_0x312f52[_0x52f9('0x29')]){delete _0x312f52[_0x52f9('0x29')];}_0x1e77e1[_0x52f9('0x1a')](_0x43587f)['send'](_0x312f52);};}exports[_0x52f9('0x2a')]=function(_0x151fa5,_0x26d2b2){var _0x41cea3={},_0x3779fe={},_0x14a197={'count':0x0,'rows':[]};var _0x3b1194=_[_0x52f9('0x2b')](db[_0x52f9('0x2c')]['rawAttributes'],function(_0x47ac33){return{'name':_0x47ac33[_0x52f9('0x2d')],'type':_0x47ac33[_0x52f9('0x2e')]['key']};});_0x3779fe[_0x52f9('0x2f')]=_[_0x52f9('0x30')](_[_0x52f9('0x2b')](_0x3b1194,_0x52f9('0x29')),[_0x52f9('0x29')]);_0x3779fe[_0x52f9('0x31')]=_[_0x52f9('0x32')](_0x151fa5[_0x52f9('0x31')]);_0x3779fe['filters']=_[_0x52f9('0x33')](_0x3779fe[_0x52f9('0x2f')],_0x3779fe[_0x52f9('0x31')]);_0x41cea3[_0x52f9('0x34')]=_[_0x52f9('0x33')](_0x3779fe['model'],qs[_0x52f9('0x35')](_0x151fa5[_0x52f9('0x31')][_0x52f9('0x35')]));_0x41cea3[_0x52f9('0x34')]=_0x41cea3[_0x52f9('0x34')]['length']?_0x41cea3['attributes']:_0x3779fe[_0x52f9('0x2f')];if(!_0x151fa5[_0x52f9('0x31')][_0x52f9('0x36')](_0x52f9('0x37'))){_0x41cea3[_0x52f9('0x1e')]=qs[_0x52f9('0x1e')](_0x151fa5[_0x52f9('0x31')][_0x52f9('0x1e')]);_0x41cea3[_0x52f9('0x38')]=qs['offset'](_0x151fa5['query']['offset']);}_0x41cea3[_0x52f9('0x39')]=qs[_0x52f9('0x3a')](_0x151fa5['query']['sort']);_0x41cea3[_0x52f9('0x3b')]=qs[_0x52f9('0x3c')](_[_0x52f9('0x3d')](_0x151fa5[_0x52f9('0x31')],_0x3779fe[_0x52f9('0x3c')]),_0x3b1194);if(_0x151fa5[_0x52f9('0x31')][_0x52f9('0x3e')]){_0x41cea3[_0x52f9('0x3b')]=_[_0x52f9('0x3f')](_0x41cea3['where'],{'$or':_[_0x52f9('0x2b')](_0x3b1194,function(_0x106338){if(_0x106338[_0x52f9('0x2e')]!=='VIRTUAL'){var _0x5b2a15={};_0x5b2a15[_0x106338[_0x52f9('0x29')]]={'$like':'%'+_0x151fa5['query'][_0x52f9('0x3e')]+'%'};return _0x5b2a15;}})});}_0x41cea3=_[_0x52f9('0x3f')]({},_0x41cea3,_0x151fa5[_0x52f9('0x40')]);var _0x5e65c3={'where':_0x41cea3[_0x52f9('0x3b')]};return db[_0x52f9('0x2c')][_0x52f9('0x1d')](_0x5e65c3)[_0x52f9('0x25')](function(_0x181b0a){_0x14a197[_0x52f9('0x1d')]=_0x181b0a;if(_0x151fa5[_0x52f9('0x31')][_0x52f9('0x41')]){_0x41cea3[_0x52f9('0x42')]=[{'all':!![]}];}return db[_0x52f9('0x2c')]['findAll'](_0x41cea3);})['then'](function(_0x6d4b1b){_0x14a197['rows']=_0x6d4b1b;return _0x14a197;})[_0x52f9('0x25')](respondWithFilteredResult(_0x26d2b2,_0x41cea3))['catch'](handleError(_0x26d2b2,null));};exports[_0x52f9('0x43')]=function(_0x3de70b,_0x4ff67f){var _0x23fc00={'raw':!![],'where':{'id':_0x3de70b['params']['id']}},_0x1db6dd={};_0x1db6dd[_0x52f9('0x2f')]=_[_0x52f9('0x32')](db['VoiceMailMessage']['rawAttributes']);_0x1db6dd[_0x52f9('0x31')]=_[_0x52f9('0x32')](_0x3de70b[_0x52f9('0x31')]);_0x1db6dd[_0x52f9('0x3c')]=_['intersection'](_0x1db6dd[_0x52f9('0x2f')],_0x1db6dd[_0x52f9('0x31')]);_0x23fc00[_0x52f9('0x34')]=_[_0x52f9('0x33')](_0x1db6dd[_0x52f9('0x2f')],qs[_0x52f9('0x35')](_0x3de70b[_0x52f9('0x31')][_0x52f9('0x35')]));_0x23fc00[_0x52f9('0x34')]=_0x23fc00['attributes'][_0x52f9('0x44')]?_0x23fc00['attributes']:_0x1db6dd[_0x52f9('0x2f')];if(_0x3de70b[_0x52f9('0x31')][_0x52f9('0x41')]){_0x23fc00[_0x52f9('0x42')]=[{'all':!![]}];}_0x23fc00=_['merge']({},_0x23fc00,_0x3de70b[_0x52f9('0x40')]);return db[_0x52f9('0x2c')][_0x52f9('0x45')](_0x23fc00)[_0x52f9('0x25')](handleEntityNotFound(_0x4ff67f,null))[_0x52f9('0x25')](respondWithResult(_0x4ff67f,null))[_0x52f9('0x46')](handleError(_0x4ff67f,null));};exports['create']=function(_0x582d8a,_0x5ba0bc){return db['VoiceMailMessage'][_0x52f9('0x47')](_0x582d8a[_0x52f9('0x48')],{})[_0x52f9('0x25')](respondWithResult(_0x5ba0bc,0xc9))[_0x52f9('0x46')](handleError(_0x5ba0bc,null));};exports[_0x52f9('0x24')]=function(_0x253369,_0x1be01b){if(_0x253369[_0x52f9('0x48')]['id']){delete _0x253369[_0x52f9('0x48')]['id'];}return db[_0x52f9('0x2c')]['find']({'where':{'id':_0x253369[_0x52f9('0x49')]['id']}})[_0x52f9('0x25')](handleEntityNotFound(_0x1be01b,null))[_0x52f9('0x25')](saveUpdates(_0x253369['body'],null))[_0x52f9('0x25')](respondWithResult(_0x1be01b,null))[_0x52f9('0x46')](handleError(_0x1be01b,null));};exports['destroy']=function(_0x5066da,_0x3d7ffc){return db[_0x52f9('0x2c')][_0x52f9('0x45')]({'where':{'id':_0x5066da['params']['id']}})['then'](handleEntityNotFound(_0x3d7ffc,null))['then'](removeEntity(_0x3d7ffc,null))[_0x52f9('0x46')](handleError(_0x3d7ffc,null));};exports[_0x52f9('0x4a')]=function(_0x3c4714,_0x3b6f1f,_0x2d7cfd){return db[_0x52f9('0x2c')][_0x52f9('0x45')]({'where':{'id':_0x3c4714[_0x52f9('0x49')]['id']},'attributes':['id',_0x52f9('0x4b'),_0x52f9('0x4c')]})['then'](handleEntityNotFound(_0x3b6f1f,null))[_0x52f9('0x25')](function(_0x718c2b){if(_0x718c2b){if(!_0x718c2b[_0x52f9('0x4b')]){throw new db['Sequelize'][(_0x52f9('0x4d'))](_0x52f9('0x4e'));}var _0x2bc687={'Content-Type':_0x52f9('0x4f'),'Content-Disposition':_0x52f9('0x50')};if(_0x718c2b[_0x52f9('0x4c')]){_0x2bc687['Content-Disposition']=_0x52f9('0x51')+_0x718c2b['msg_id']+_0x52f9('0x52');}_0x3b6f1f[_0x52f9('0x1f')](_0x2bc687);return _0x3b6f1f['send'](new Buffer(_0x718c2b[_0x52f9('0x4b')]));}})['catch'](handleError(_0x3b6f1f,null));}; \ No newline at end of file +var _0x9374=['length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','create','body','find','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','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/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','then','destroy','error','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9374,0x169));var _0x4937=function(_0x1da289,_0x417651){_0x1da289=_0x1da289-0x0;var _0x41c889=_0x9374[_0x1da289];return _0x41c889;};'use strict';var pdf=require(_0x4937('0x0'));var emlformat=require(_0x4937('0x1'));var rimraf=require(_0x4937('0x2'));var zipdir=require(_0x4937('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4937('0x4'));var moment=require(_0x4937('0x5'));var BPromise=require(_0x4937('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4937('0x7'));var sox=require(_0x4937('0x8'));var csv=require(_0x4937('0x9'));var ejs=require(_0x4937('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4937('0xb'));var crypto=require(_0x4937('0xc'));var jsforce=require(_0x4937('0xd'));var deskjs=require(_0x4937('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4937('0xf'));var Redis=require(_0x4937('0x10'));var authService=require(_0x4937('0x11'));var qs=require(_0x4937('0x12'));var as=require(_0x4937('0x13'));var hardwareService=require(_0x4937('0x14'));var logger=require(_0x4937('0x15'))(_0x4937('0x16'));var utils=require(_0x4937('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4937('0x18'));var db=require(_0x4937('0x19'))['db'];function respondWithStatusCode(_0x564b05,_0x9866b2){_0x9866b2=_0x9866b2||0xcc;return function(_0x2badd2){if(_0x2badd2){return _0x564b05[_0x4937('0x1a')](_0x9866b2);}return _0x564b05[_0x4937('0x1b')](_0x9866b2)[_0x4937('0x1c')]();};}function respondWithResult(_0x3accb3,_0x191d5e){_0x191d5e=_0x191d5e||0xc8;return function(_0x4d9a1a){if(_0x4d9a1a){return _0x3accb3[_0x4937('0x1b')](_0x191d5e)[_0x4937('0x1d')](_0x4d9a1a);}};}function respondWithFilteredResult(_0x25c103,_0x1ebba6){return function(_0x187dfb){if(_0x187dfb){var _0x453639=_0x187dfb[_0x4937('0x1e')],_0x919e7f=_0x1ebba6[_0x4937('0x1f')],_0x589365=_0x1ebba6[_0x4937('0x1f')]+_0x1ebba6['limit'],_0x25c075;if(_0x589365>=_0x453639){_0x589365=_0x453639;_0x25c075=0xc8;}else{_0x25c075=0xce;}_0x25c103['status'](_0x25c075);return _0x25c103[_0x4937('0x20')](_0x4937('0x21'),_0x919e7f+'-'+_0x589365+'/'+_0x453639)[_0x4937('0x1d')](_0x187dfb);}return null;};}function patchUpdates(_0x26edee){return function(_0xddbce0){try{jsonpatch[_0x4937('0x22')](_0xddbce0,_0x26edee,!![]);}catch(_0x5ebd4e){return BPromise['reject'](_0x5ebd4e);}return _0xddbce0[_0x4937('0x23')]();};}function saveUpdates(_0x517ff6,_0x15e274){return function(_0x2db4f3){if(_0x2db4f3){return _0x2db4f3['update'](_0x517ff6)[_0x4937('0x24')](function(_0x3aacd0){return _0x3aacd0;});}return null;};}function removeEntity(_0x12568f,_0x1009c8){return function(_0x216e0e){if(_0x216e0e){return _0x216e0e[_0x4937('0x25')]()[_0x4937('0x24')](function(){_0x12568f[_0x4937('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f83b7,_0x195304){return function(_0x5ea2bb){if(!_0x5ea2bb){_0x3f83b7[_0x4937('0x1a')](0x194);}return _0x5ea2bb;};}function handleError(_0x52c308,_0x2bbbf6){_0x2bbbf6=_0x2bbbf6||0x1f4;return function(_0x2cd2f1){logger[_0x4937('0x26')](_0x2cd2f1[_0x4937('0x27')]);if(_0x2cd2f1[_0x4937('0x28')]){delete _0x2cd2f1['name'];}_0x52c308[_0x4937('0x1b')](_0x2bbbf6)[_0x4937('0x29')](_0x2cd2f1);};}exports['index']=function(_0x454418,_0x4627e3){var _0x1aad42={},_0x52bd87={},_0x226ec2={'count':0x0,'rows':[]};var _0x116dd5=_[_0x4937('0x2a')](db[_0x4937('0x2b')][_0x4937('0x2c')],function(_0x277315){return{'name':_0x277315[_0x4937('0x2d')],'type':_0x277315['type'][_0x4937('0x2e')]};});_0x52bd87[_0x4937('0x2f')]=_['differenceBy'](_[_0x4937('0x2a')](_0x116dd5,_0x4937('0x28')),[_0x4937('0x28')]);_0x52bd87[_0x4937('0x30')]=_[_0x4937('0x31')](_0x454418[_0x4937('0x30')]);_0x52bd87[_0x4937('0x32')]=_[_0x4937('0x33')](_0x52bd87[_0x4937('0x2f')],_0x52bd87[_0x4937('0x30')]);_0x1aad42['attributes']=_[_0x4937('0x33')](_0x52bd87[_0x4937('0x2f')],qs['fields'](_0x454418[_0x4937('0x30')][_0x4937('0x34')]));_0x1aad42[_0x4937('0x35')]=_0x1aad42['attributes'][_0x4937('0x36')]?_0x1aad42[_0x4937('0x35')]:_0x52bd87[_0x4937('0x2f')];if(!_0x454418[_0x4937('0x30')][_0x4937('0x37')](_0x4937('0x38'))){_0x1aad42[_0x4937('0x39')]=qs['limit'](_0x454418[_0x4937('0x30')][_0x4937('0x39')]);_0x1aad42[_0x4937('0x1f')]=qs[_0x4937('0x1f')](_0x454418[_0x4937('0x30')][_0x4937('0x1f')]);}_0x1aad42['order']=qs[_0x4937('0x3a')](_0x454418[_0x4937('0x30')][_0x4937('0x3a')]);_0x1aad42[_0x4937('0x3b')]=qs[_0x4937('0x32')](_[_0x4937('0x3c')](_0x454418[_0x4937('0x30')],_0x52bd87[_0x4937('0x32')]),_0x116dd5);if(_0x454418[_0x4937('0x30')]['filter']){_0x1aad42['where']=_[_0x4937('0x3d')](_0x1aad42[_0x4937('0x3b')],{'$or':_[_0x4937('0x2a')](_0x116dd5,function(_0x50df26){if(_0x50df26['type']!==_0x4937('0x3e')){var _0x1a3661={};_0x1a3661[_0x50df26[_0x4937('0x28')]]={'$like':'%'+_0x454418['query'][_0x4937('0x3f')]+'%'};return _0x1a3661;}})});}_0x1aad42=_['merge']({},_0x1aad42,_0x454418[_0x4937('0x40')]);var _0x5057e3={'where':_0x1aad42[_0x4937('0x3b')]};return db[_0x4937('0x2b')][_0x4937('0x1e')](_0x5057e3)['then'](function(_0x50730b){_0x226ec2['count']=_0x50730b;if(_0x454418[_0x4937('0x30')][_0x4937('0x41')]){_0x1aad42[_0x4937('0x42')]=[{'all':!![]}];}return db[_0x4937('0x2b')]['findAll'](_0x1aad42);})['then'](function(_0x35dab7){_0x226ec2[_0x4937('0x43')]=_0x35dab7;return _0x226ec2;})[_0x4937('0x24')](respondWithFilteredResult(_0x4627e3,_0x1aad42))[_0x4937('0x44')](handleError(_0x4627e3,null));};exports[_0x4937('0x45')]=function(_0x2bdd58,_0x4c6a8c){var _0x407bc1={'raw':!![],'where':{'id':_0x2bdd58[_0x4937('0x46')]['id']}},_0x4bd7b6={};_0x4bd7b6[_0x4937('0x2f')]=_[_0x4937('0x31')](db[_0x4937('0x2b')][_0x4937('0x2c')]);_0x4bd7b6[_0x4937('0x30')]=_[_0x4937('0x31')](_0x2bdd58['query']);_0x4bd7b6[_0x4937('0x32')]=_[_0x4937('0x33')](_0x4bd7b6[_0x4937('0x2f')],_0x4bd7b6['query']);_0x407bc1[_0x4937('0x35')]=_[_0x4937('0x33')](_0x4bd7b6[_0x4937('0x2f')],qs[_0x4937('0x34')](_0x2bdd58[_0x4937('0x30')][_0x4937('0x34')]));_0x407bc1[_0x4937('0x35')]=_0x407bc1[_0x4937('0x35')][_0x4937('0x36')]?_0x407bc1['attributes']:_0x4bd7b6[_0x4937('0x2f')];if(_0x2bdd58[_0x4937('0x30')][_0x4937('0x41')]){_0x407bc1[_0x4937('0x42')]=[{'all':!![]}];}_0x407bc1=_[_0x4937('0x3d')]({},_0x407bc1,_0x2bdd58[_0x4937('0x40')]);return db['VoiceMailMessage']['find'](_0x407bc1)['then'](handleEntityNotFound(_0x4c6a8c,null))['then'](respondWithResult(_0x4c6a8c,null))['catch'](handleError(_0x4c6a8c,null));};exports[_0x4937('0x47')]=function(_0x1c41b5,_0x29bdc4){return db['VoiceMailMessage'][_0x4937('0x47')](_0x1c41b5[_0x4937('0x48')],{})[_0x4937('0x24')](respondWithResult(_0x29bdc4,0xc9))[_0x4937('0x44')](handleError(_0x29bdc4,null));};exports['update']=function(_0x2b0701,_0x600fe7){if(_0x2b0701[_0x4937('0x48')]['id']){delete _0x2b0701[_0x4937('0x48')]['id'];}return db['VoiceMailMessage'][_0x4937('0x49')]({'where':{'id':_0x2b0701[_0x4937('0x46')]['id']}})['then'](handleEntityNotFound(_0x600fe7,null))['then'](saveUpdates(_0x2b0701['body'],null))['then'](respondWithResult(_0x600fe7,null))['catch'](handleError(_0x600fe7,null));};exports[_0x4937('0x25')]=function(_0x34c35d,_0x5383b3){return db[_0x4937('0x2b')][_0x4937('0x49')]({'where':{'id':_0x34c35d['params']['id']}})[_0x4937('0x24')](handleEntityNotFound(_0x5383b3,null))[_0x4937('0x24')](removeEntity(_0x5383b3,null))['catch'](handleError(_0x5383b3,null));};exports['download']=function(_0x316d52,_0x1d3b6e,_0x371366){return db['VoiceMailMessage'][_0x4937('0x49')]({'where':{'id':_0x316d52[_0x4937('0x46')]['id']},'attributes':['id',_0x4937('0x4a'),_0x4937('0x4b')]})[_0x4937('0x24')](handleEntityNotFound(_0x1d3b6e,null))['then'](function(_0x4131e4){if(_0x4131e4){if(!_0x4131e4[_0x4937('0x4a')]){throw new db[(_0x4937('0x4c'))][(_0x4937('0x4d'))](_0x4937('0x4e'));}var _0x4a6593={'Content-Type':'audio/wav','Content-Disposition':_0x4937('0x4f')};if(_0x4131e4[_0x4937('0x4b')]){_0x4a6593[_0x4937('0x50')]=_0x4937('0x51')+_0x4131e4[_0x4937('0x4b')]+_0x4937('0x52');}_0x1d3b6e[_0x4937('0x20')](_0x4a6593);return _0x1d3b6e[_0x4937('0x29')](new Buffer(_0x4131e4['recording']));}})[_0x4937('0x44')](handleError(_0x1d3b6e,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index c4c983a..25eadff 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 _0xdfd9=['./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','moment','request-promise','path','../../config/environment'];(function(_0x562faa,_0x23adc7){var _0xc70f59=function(_0x2d7dec){while(--_0x2d7dec){_0x562faa['push'](_0x562faa['shift']());}};_0xc70f59(++_0x23adc7);}(_0xdfd9,0x155));var _0x9dfd=function(_0x5d7559,_0x24a4ff){_0x5d7559=_0x5d7559-0x0;var _0x3057c9=_0xdfd9[_0x5d7559];return _0x3057c9;};'use strict';var _=require(_0x9dfd('0x0'));var util=require(_0x9dfd('0x1'));var logger=require('../../config/logger')(_0x9dfd('0x2'));var moment=require(_0x9dfd('0x3'));var BPromise=require('bluebird');var rp=require(_0x9dfd('0x4'));var fs=require('fs');var path=require(_0x9dfd('0x5'));var rimraf=require('rimraf');var config=require(_0x9dfd('0x6'));var attributes=require(_0x9dfd('0x7'));module[_0x9dfd('0x8')]=function(_0x4c62fd,_0x475e70){return _0x4c62fd['define'](_0x9dfd('0x9'),attributes,{'tableName':_0x9dfd('0xa'),'paranoid':![],'indexes':[{'name':_0x9dfd('0xb'),'fields':[_0x9dfd('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x188b=['rimraf','../../config/environment','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','bluebird','request-promise'];(function(_0x5c660a,_0x4b5262){var _0x3a77a4=function(_0x479c95){while(--_0x479c95){_0x5c660a['push'](_0x5c660a['shift']());}};_0x3a77a4(++_0x4b5262);}(_0x188b,0x1dc));var _0xb188=function(_0x5e78e0,_0x184cb0){_0x5e78e0=_0x5e78e0-0x0;var _0x391d1f=_0x188b[_0x5e78e0];return _0x391d1f;};'use strict';var _=require(_0xb188('0x0'));var util=require('util');var logger=require(_0xb188('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb188('0x2'));var rp=require(_0xb188('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb188('0x4'));var config=require(_0xb188('0x5'));var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x580883,_0xb9c8df){return _0x580883[_0xb188('0x6')](_0xb188('0x7'),attributes,{'tableName':_0xb188('0x8'),'paranoid':![],'indexes':[{'name':_0xb188('0x9'),'fields':[_0xb188('0x9')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 2692879..392b90a 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 _0x1967=['then','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0x1967,0x173));var _0x7196=function(_0x29e83e,_0x508c33){_0x29e83e=_0x29e83e-0x0;var _0x3cdebe=_0x1967[_0x29e83e];return _0x3cdebe;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file +var _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceMailMessage,\x20%s,\x20%s','message','catch','lodash'];(function(_0x1cd363,_0x12c2b7){var _0x2e92cd=function(_0x26f726){while(--_0x26f726){_0x1cd363['push'](_0x1cd363['shift']());}};_0x2e92cd(++_0x12c2b7);}(_0x66fa,0x117));var _0xa66f=function(_0x15cd5b,_0xd5cc4d){_0x15cd5b=_0x15cd5b-0x0;var _0x1121f5=_0x66fa[_0x15cd5b];return _0x1121f5;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index e805776..d37220e 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 _0x7305=['index','get','/:id','show','getSounds','post','create','/:id/sounds','addSound','put','update','delete','/:id/sounds/:id2','removeSound','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','isAuthenticated'];(function(_0x497361,_0x5ca5ce){var _0x366662=function(_0x1b9f66){while(--_0x1b9f66){_0x497361['push'](_0x497361['shift']());}};_0x366662(++_0x5ca5ce);}(_0x7305,0x1b0));var _0x5730=function(_0x276e7e,_0x58b275){_0x276e7e=_0x276e7e-0x0;var _0x3df216=_0x7305[_0x276e7e];return _0x3df216;};'use strict';var multer=require('multer');var util=require(_0x5730('0x0'));var path=require(_0x5730('0x1'));var timeout=require('connect-timeout');var express=require(_0x5730('0x2'));var router=express[_0x5730('0x3')]();var auth=require(_0x5730('0x4'));var interaction=require(_0x5730('0x5'));var config=require('../../config/environment');var controller=require(_0x5730('0x6'));router['get']('/',auth[_0x5730('0x7')](),controller[_0x5730('0x8')]);router[_0x5730('0x9')](_0x5730('0xa'),auth[_0x5730('0x7')](),controller[_0x5730('0xb')]);router[_0x5730('0x9')]('/:id/sounds',auth[_0x5730('0x7')](),controller[_0x5730('0xc')]);router[_0x5730('0xd')]('/',auth[_0x5730('0x7')](),controller[_0x5730('0xe')]);router[_0x5730('0xd')](_0x5730('0xf'),auth[_0x5730('0x7')](),controller[_0x5730('0x10')]);router[_0x5730('0x11')](_0x5730('0xa'),auth[_0x5730('0x7')](),controller[_0x5730('0x12')]);router[_0x5730('0x13')](_0x5730('0xa'),auth[_0x5730('0x7')](),controller['destroy']);router[_0x5730('0x13')](_0x5730('0x14'),auth[_0x5730('0x7')](),controller[_0x5730('0x15')]);module['exports']=router; \ No newline at end of file +var _0x7397=['/:id','isAuthenticated','show','/:id/sounds','getSounds','post','create','addSound','put','destroy','/:id/sounds/:id2','removeSound','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceMusicOnHold.controller','get','index'];(function(_0x21c6b8,_0x16d6f6){var _0x39d474=function(_0x27dbf5){while(--_0x27dbf5){_0x21c6b8['push'](_0x21c6b8['shift']());}};_0x39d474(++_0x16d6f6);}(_0x7397,0x132));var _0x7739=function(_0x435e3c,_0x59c6c9){_0x435e3c=_0x435e3c-0x0;var _0x230cf8=_0x7397[_0x435e3c];return _0x230cf8;};'use strict';var multer=require('multer');var util=require(_0x7739('0x0'));var path=require(_0x7739('0x1'));var timeout=require(_0x7739('0x2'));var express=require(_0x7739('0x3'));var router=express[_0x7739('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7739('0x5'));var config=require('../../config/environment');var controller=require(_0x7739('0x6'));router[_0x7739('0x7')]('/',auth['isAuthenticated'](),controller[_0x7739('0x8')]);router['get'](_0x7739('0x9'),auth[_0x7739('0xa')](),controller[_0x7739('0xb')]);router[_0x7739('0x7')](_0x7739('0xc'),auth[_0x7739('0xa')](),controller[_0x7739('0xd')]);router[_0x7739('0xe')]('/',auth[_0x7739('0xa')](),controller[_0x7739('0xf')]);router[_0x7739('0xe')](_0x7739('0xc'),auth[_0x7739('0xa')](),controller[_0x7739('0x10')]);router[_0x7739('0x11')](_0x7739('0x9'),auth[_0x7739('0xa')](),controller['update']);router['delete']('/:id',auth[_0x7739('0xa')](),controller[_0x7739('0x12')]);router['delete'](_0x7739('0x13'),auth[_0x7739('0xa')](),controller[_0x7739('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index fddacab..2fe959f 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 _0x62e5=['mp3','alpha','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3'];(function(_0x177d8d,_0x36b07){var _0xf9c8f7=function(_0x59b022){while(--_0x59b022){_0x177d8d['push'](_0x177d8d['shift']());}};_0xf9c8f7(++_0x36b07);}(_0x62e5,0x1db));var _0x562e=function(_0x264dd8,_0x3786a6){_0x264dd8=_0x264dd8-0x0;var _0xffea48=_0x62e5[_0x264dd8];return _0xffea48;};'use strict';var Sequelize=require(_0x562e('0x0'));module[_0x562e('0x1')]={'name':{'type':Sequelize[_0x562e('0x2')],'allowNull':![],'unique':_0x562e('0x3')},'mode':{'type':Sequelize[_0x562e('0x4')](_0x562e('0x5'),_0x562e('0x6'),_0x562e('0x7'),'quietmp3nb',_0x562e('0x8'),_0x562e('0x9')),'allowNull':!![],'defaultValue':_0x562e('0x6')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x562e('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x562e('0x2')],'allowNull':!![],'defaultValue':_0x562e('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5c54=['alpha','TIMESTAMP','BOOLEAN','sequelize','name','custom','quietmp3nb','quietmp3','mp3','STRING'];(function(_0x3b3c2f,_0x35ff72){var _0x1f1123=function(_0x48fffa){while(--_0x48fffa){_0x3b3c2f['push'](_0x3b3c2f['shift']());}};_0x1f1123(++_0x35ff72);}(_0x5c54,0x139));var _0x45c5=function(_0x5dcfb9,_0x494864){_0x5dcfb9=_0x5dcfb9-0x0;var _0x119f69=_0x5c54[_0x5dcfb9];return _0x119f69;};'use strict';var Sequelize=require(_0x45c5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x45c5('0x1')},'mode':{'type':Sequelize['ENUM'](_0x45c5('0x2'),'files','mp3nb',_0x45c5('0x3'),_0x45c5('0x4'),_0x45c5('0x5')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x45c5('0x6')],'allowNull':!![]},'application':{'type':Sequelize[_0x45c5('0x6')],'allowNull':!![]},'digit':{'type':Sequelize[_0x45c5('0x6')],'allowNull':!![]},'sort':{'type':Sequelize[_0x45c5('0x6')],'allowNull':!![],'defaultValue':_0x45c5('0x7')},'format':{'type':Sequelize[_0x45c5('0x6')],'allowNull':!![]},'stamp':{'type':_0x45c5('0x8')},'defaultEntry':{'type':Sequelize[_0x45c5('0x9')],'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 1ecd454..049fba2 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 _0x8d69=['to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','status','end','count','offset','set','Content-Range','reject','save','update','then','destroy','get','MusicOnHolds','sendStatus','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','limit','order','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','intersection','options','find','body','create','sequelize','mode','files','directory','root','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','transaction','readdirSync','unlinkSync','join','rmdirSync','Sequelize','message','addSound','findOne','save_name','converted_format','createdAt','format','%s.%s','extname','server/files/moh','ValidationError','removeSound','id2','Sound','nolimit','getSounds','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d69,0x139));var _0x98d6=function(_0x55e0ee,_0x26d540){_0x55e0ee=_0x55e0ee-0x0;var _0xf73fe4=_0x8d69[_0x55e0ee];return _0xf73fe4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x98d6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x98d6('0x1'));var jsonpatch=require(_0x98d6('0x2'));var rp=require(_0x98d6('0x3'));var moment=require(_0x98d6('0x4'));var BPromise=require(_0x98d6('0x5'));var Mustache=require(_0x98d6('0x6'));var util=require(_0x98d6('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x98d6('0x8'));var ejs=require(_0x98d6('0x9'));var fs=require('fs');var _=require(_0x98d6('0xa'));var squel=require('squel');var crypto=require(_0x98d6('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x98d6('0x8'));var querystring=require(_0x98d6('0xc'));var Papa=require(_0x98d6('0xd'));var Redis=require('ioredis');var authService=require(_0x98d6('0xe'));var qs=require(_0x98d6('0xf'));var as=require(_0x98d6('0x10'));var hardwareService=require(_0x98d6('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x98d6('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x98d6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdffc2b,_0x321c4e){_0x321c4e=_0x321c4e||0xcc;return function(_0x4a4ecf){if(_0x4a4ecf){return _0xdffc2b['sendStatus'](_0x321c4e);}return _0xdffc2b[_0x98d6('0x14')](_0x321c4e)[_0x98d6('0x15')]();};}function respondWithResult(_0x218bd3,_0x41ab0e){_0x41ab0e=_0x41ab0e||0xc8;return function(_0x300fab){if(_0x300fab){return _0x218bd3['status'](_0x41ab0e)['json'](_0x300fab);}};}function respondWithFilteredResult(_0x390cf0,_0x3d8ec7){return function(_0x3e26e0){if(_0x3e26e0){var _0x238920=_0x3e26e0[_0x98d6('0x16')],_0x198fe0=_0x3d8ec7[_0x98d6('0x17')],_0x495e73=_0x3d8ec7[_0x98d6('0x17')]+_0x3d8ec7['limit'],_0x1b15fc;if(_0x495e73>=_0x238920){_0x495e73=_0x238920;_0x1b15fc=0xc8;}else{_0x1b15fc=0xce;}_0x390cf0[_0x98d6('0x14')](_0x1b15fc);return _0x390cf0[_0x98d6('0x18')](_0x98d6('0x19'),_0x198fe0+'-'+_0x495e73+'/'+_0x238920)['json'](_0x3e26e0);}return null;};}function patchUpdates(_0x5a4d04){return function(_0x519949){try{jsonpatch['apply'](_0x519949,_0x5a4d04,!![]);}catch(_0x570079){return BPromise[_0x98d6('0x1a')](_0x570079);}return _0x519949[_0x98d6('0x1b')]();};}function saveUpdates(_0x5133ad,_0x17759c){return function(_0x295faa){if(_0x295faa){return _0x295faa[_0x98d6('0x1c')](_0x5133ad)[_0x98d6('0x1d')](function(_0x180529){return _0x180529;});}return null;};}function removeEntity(_0x3d2d52,_0x4f4f58){return function(_0x506867){if(_0x506867){return _0x506867[_0x98d6('0x1e')]()[_0x98d6('0x1d')](function(){var _0xf20de3=_0x506867[_0x98d6('0x1f')]({'plain':!![]});var _0x6773b0=_0x98d6('0x20');return db['UserProfileResource'][_0x98d6('0x1e')]({'where':{'type':_0x6773b0,'resourceId':_0xf20de3['id']}})['then'](function(){return _0x506867;});})[_0x98d6('0x1d')](function(){_0x3d2d52[_0x98d6('0x14')](0xcc)[_0x98d6('0x15')]();});}};}function handleEntityNotFound(_0x19d82d,_0x17ad1c){return function(_0x5e0df4){if(!_0x5e0df4){_0x19d82d[_0x98d6('0x21')](0x194);}return _0x5e0df4;};}function handleError(_0xb75a9a,_0x206b1e){_0x206b1e=_0x206b1e||0x1f4;return function(_0x44e32c){logger[_0x98d6('0x22')](_0x44e32c[_0x98d6('0x23')]);if(_0x44e32c[_0x98d6('0x24')]){delete _0x44e32c[_0x98d6('0x24')];}_0xb75a9a['status'](_0x206b1e)[_0x98d6('0x25')](_0x44e32c);};}exports[_0x98d6('0x26')]=function(_0x59d992,_0x361396){var _0x4a789e={},_0x3ff45d={},_0x4f753a={'count':0x0,'rows':[]};var _0x73217c=_['map'](db[_0x98d6('0x27')][_0x98d6('0x28')],function(_0x518eb4){return{'name':_0x518eb4[_0x98d6('0x29')],'type':_0x518eb4['type'][_0x98d6('0x2a')]};});_0x3ff45d[_0x98d6('0x2b')]=_[_0x98d6('0x2c')](_0x73217c,'name');_0x3ff45d[_0x98d6('0x2d')]=_['keys'](_0x59d992[_0x98d6('0x2d')]);_0x3ff45d[_0x98d6('0x2e')]=_['intersection'](_0x3ff45d[_0x98d6('0x2b')],_0x3ff45d[_0x98d6('0x2d')]);_0x4a789e[_0x98d6('0x2f')]=_['intersection'](_0x3ff45d[_0x98d6('0x2b')],qs[_0x98d6('0x30')](_0x59d992[_0x98d6('0x2d')][_0x98d6('0x30')]));_0x4a789e[_0x98d6('0x2f')]=_0x4a789e[_0x98d6('0x2f')][_0x98d6('0x31')]?_0x4a789e[_0x98d6('0x2f')]:_0x3ff45d['model'];if(!_0x59d992[_0x98d6('0x2d')][_0x98d6('0x32')]('nolimit')){_0x4a789e[_0x98d6('0x33')]=qs[_0x98d6('0x33')](_0x59d992[_0x98d6('0x2d')][_0x98d6('0x33')]);_0x4a789e[_0x98d6('0x17')]=qs['offset'](_0x59d992[_0x98d6('0x2d')][_0x98d6('0x17')]);}_0x4a789e[_0x98d6('0x34')]=qs['sort'](_0x59d992[_0x98d6('0x2d')]['sort']);_0x4a789e[_0x98d6('0x35')]=qs[_0x98d6('0x2e')](_[_0x98d6('0x36')](_0x59d992['query'],_0x3ff45d[_0x98d6('0x2e')]),_0x73217c);if(_0x59d992['query'][_0x98d6('0x37')]){_0x4a789e[_0x98d6('0x35')]=_[_0x98d6('0x38')](_0x4a789e['where'],{'$or':_[_0x98d6('0x2c')](_0x73217c,function(_0x43f34f){if(_0x43f34f[_0x98d6('0x39')]!==_0x98d6('0x3a')){var _0x235e95={};_0x235e95[_0x43f34f[_0x98d6('0x24')]]={'$like':'%'+_0x59d992['query'][_0x98d6('0x37')]+'%'};return _0x235e95;}})});}_0x4a789e=_[_0x98d6('0x38')]({},_0x4a789e,_0x59d992['options']);var _0xb02855={'where':_0x4a789e[_0x98d6('0x35')]};return db[_0x98d6('0x27')][_0x98d6('0x16')](_0xb02855)[_0x98d6('0x1d')](function(_0x1b0793){_0x4f753a['count']=_0x1b0793;if(_0x59d992['query'][_0x98d6('0x3b')]){_0x4a789e[_0x98d6('0x3c')]=[{'all':!![]}];}return db[_0x98d6('0x27')][_0x98d6('0x3d')](_0x4a789e);})[_0x98d6('0x1d')](function(_0xf991bc){_0x4f753a[_0x98d6('0x3e')]=_0xf991bc;return _0x4f753a;})[_0x98d6('0x1d')](respondWithFilteredResult(_0x361396,_0x4a789e))[_0x98d6('0x3f')](handleError(_0x361396,null));};exports[_0x98d6('0x40')]=function(_0x4123ff,_0x4b2365){var _0x628e04={'raw':![],'where':{'id':_0x4123ff[_0x98d6('0x41')]['id']}},_0x505cc1={};_0x505cc1[_0x98d6('0x2b')]=_[_0x98d6('0x42')](db[_0x98d6('0x27')]['rawAttributes']);_0x505cc1[_0x98d6('0x2d')]=_[_0x98d6('0x42')](_0x4123ff[_0x98d6('0x2d')]);_0x505cc1[_0x98d6('0x2e')]=_['intersection'](_0x505cc1[_0x98d6('0x2b')],_0x505cc1[_0x98d6('0x2d')]);_0x628e04[_0x98d6('0x2f')]=_[_0x98d6('0x43')](_0x505cc1['model'],qs[_0x98d6('0x30')](_0x4123ff['query'][_0x98d6('0x30')]));_0x628e04[_0x98d6('0x2f')]=_0x628e04['attributes']['length']?_0x628e04['attributes']:_0x505cc1[_0x98d6('0x2b')];if(_0x4123ff[_0x98d6('0x2d')][_0x98d6('0x3b')]){_0x628e04[_0x98d6('0x3c')]=[{'all':!![]}];}_0x628e04=_[_0x98d6('0x38')]({},_0x628e04,_0x4123ff[_0x98d6('0x44')]);return db['VoiceMusicOnHold'][_0x98d6('0x45')](_0x628e04)['then'](handleEntityNotFound(_0x4b2365,null))[_0x98d6('0x1d')](respondWithResult(_0x4b2365,null))[_0x98d6('0x3f')](handleError(_0x4b2365,null));};exports[_0x98d6('0x1c')]=function(_0x1af7b2,_0x5f2497){if(_0x1af7b2[_0x98d6('0x46')]['id']){delete _0x1af7b2[_0x98d6('0x46')]['id'];}return db[_0x98d6('0x27')][_0x98d6('0x45')]({'where':{'id':_0x1af7b2['params']['id']}})['then'](handleEntityNotFound(_0x5f2497,null))[_0x98d6('0x1d')](saveUpdates(_0x1af7b2['body'],null))[_0x98d6('0x1d')](respondWithResult(_0x5f2497,null))[_0x98d6('0x3f')](handleError(_0x5f2497,null));};exports[_0x98d6('0x47')]=function(_0x12c886,_0x4a327d,_0x3394db){return db[_0x98d6('0x48')]['transaction'](function(_0x8b49e4){if(_0x12c886['body'][_0x98d6('0x49')]===_0x98d6('0x4a')){_0x12c886['body'][_0x98d6('0x4b')]=path['join'](config[_0x98d6('0x4c')],'server/files/moh',_0x12c886[_0x98d6('0x46')][_0x98d6('0x24')]);}return db[_0x98d6('0x27')][_0x98d6('0x47')](_0x12c886[_0x98d6('0x46')],{'transaction':_0x8b49e4})[_0x98d6('0x1d')](function(_0x3ddeae){if(_0x12c886[_0x98d6('0x46')][_0x98d6('0x49')]===_0x98d6('0x4a')){fs[_0x98d6('0x4d')](_0x3ddeae[_0x98d6('0x4b')],parseInt(_0x98d6('0x4e'),0x8));}var _0x37e525=_0x12c886[_0x98d6('0x4f')][_0x98d6('0x1f')]({'plain':!![]});if(!_0x37e525)throw new Error(_0x98d6('0x50'));if(_0x37e525[_0x98d6('0x51')]===_0x98d6('0x4f')){var _0x40f237=_0x3ddeae[_0x98d6('0x1f')]({'plain':!![]});return db[_0x98d6('0x52')][_0x98d6('0x45')]({'where':{'name':'MusicOnHolds','userProfileId':_0x37e525['userProfileId']},'raw':!![]})[_0x98d6('0x1d')](function(_0x114450){if(_0x114450&&_0x114450[_0x98d6('0x53')]===0x0){return db[_0x98d6('0x54')][_0x98d6('0x47')]({'name':_0x40f237[_0x98d6('0x24')],'resourceId':_0x40f237['id'],'type':_0x114450[_0x98d6('0x24')],'sectionId':_0x114450['id']},{})[_0x98d6('0x1d')](function(){return _0x3ddeae;});}else{return _0x3ddeae;}})[_0x98d6('0x3f')](function(_0x409d1f){logger[_0x98d6('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x409d1f);});}return _0x3ddeae;});})[_0x98d6('0x1d')](respondWithResult(_0x4a327d,0xc9))[_0x98d6('0x3f')](handleError(_0x4a327d,null));};exports[_0x98d6('0x1e')]=function(_0x5105b9,_0x30d4fd,_0xa20de4){var _0x49ce54;return db['VoiceMusicOnHold'][_0x98d6('0x45')]({'where':{'id':_0x5105b9[_0x98d6('0x41')]['id']}})[_0x98d6('0x1d')](function(_0x35ffa3){if(_0x35ffa3){return db[_0x98d6('0x48')][_0x98d6('0x55')](function(_0x3b489b){return _0x35ffa3[_0x98d6('0x1e')]({'transaction':_0x3b489b,'raw':!![]})[_0x98d6('0x1d')](function(_0x4b3045){if(_0x4b3045[_0x98d6('0x4b')]){fs[_0x98d6('0x56')](_0x4b3045[_0x98d6('0x4b')])['forEach'](function(_0x376e40){fs[_0x98d6('0x57')](path[_0x98d6('0x58')](_0x4b3045[_0x98d6('0x4b')],_0x376e40));});fs[_0x98d6('0x59')](_0x4b3045[_0x98d6('0x4b')]);}return _0x4b3045;});})['catch'](function(_0x2725d0){throw new db[(_0x98d6('0x5a'))]['ValidationError'](_0x2725d0[_0x98d6('0x5b')]);});}})['then'](handleEntityNotFound(_0x30d4fd,null))['then'](removeEntity(_0x30d4fd,null))['catch'](handleError(_0x30d4fd,null));};exports[_0x98d6('0x5c')]=function(_0x4d32f8,_0x2703a0,_0x431fdc){return db['sequelize'][_0x98d6('0x55')](function(_0x377e81){var _0x237fc9;return db[_0x98d6('0x27')][_0x98d6('0x45')]({'where':{'id':_0x4d32f8[_0x98d6('0x41')]['id']}})[_0x98d6('0x1d')](function(_0x1d350a){if(_0x1d350a){_0x237fc9=_0x1d350a;return _0x1d350a[_0x98d6('0x5c')](_0x4d32f8[_0x98d6('0x46')]['id'],{'transaction':_0x377e81});}})['then'](function(_0x33010b){if(_0x33010b){return db['Sound'][_0x98d6('0x5d')]({'where':{'id':_0x4d32f8['body']['id']},'attributes':['id','name',_0x98d6('0x5e'),_0x98d6('0x5f'),_0x98d6('0x60')],'raw':!![]});}})['then'](function(_0x407ffd){if(_0x407ffd){var _0x241494=path[_0x98d6('0x58')](config[_0x98d6('0x4c')],'server/files/sounds/converted',util[_0x98d6('0x61')](_0x98d6('0x62'),path['basename'](_0x407ffd[_0x98d6('0x5e')],path[_0x98d6('0x63')](_0x407ffd['save_name'])),_0x407ffd[_0x98d6('0x5f')]));var _0x43caca=path[_0x98d6('0x58')](config[_0x98d6('0x4c')],_0x98d6('0x64'),_0x237fc9[_0x98d6('0x24')],util[_0x98d6('0x61')](_0x98d6('0x62'),_0x407ffd[_0x98d6('0x24')],_0x407ffd['converted_format']));fs['symlinkSync'](_0x241494,_0x43caca);return _0x407ffd;}})[_0x98d6('0x3f')](function(_0x78d1d9){throw new db[(_0x98d6('0x5a'))][(_0x98d6('0x65'))](_0x78d1d9[_0x98d6('0x5b')]);});})[_0x98d6('0x1d')](handleEntityNotFound(_0x2703a0,null))[_0x98d6('0x1d')](respondWithResult(_0x2703a0,0xc9))['catch'](handleError(_0x2703a0,null));};exports[_0x98d6('0x66')]=function(_0x42f0f0,_0x299006,_0x1ec1a1){return db[_0x98d6('0x48')][_0x98d6('0x55')](function(_0x596a76){var _0x2cc458;return db[_0x98d6('0x27')][_0x98d6('0x5d')]({'where':{'id':_0x42f0f0[_0x98d6('0x41')]['id']}})[_0x98d6('0x1d')](handleEntityNotFound(_0x299006,null))['then'](function(_0x3392e7){if(_0x3392e7){_0x2cc458=_0x3392e7;return _0x3392e7[_0x98d6('0x66')](_0x42f0f0[_0x98d6('0x41')][_0x98d6('0x67')]);}})[_0x98d6('0x1d')](function(_0x49e8da){if(_0x49e8da){return db[_0x98d6('0x68')][_0x98d6('0x5d')]({'where':{'id':_0x42f0f0[_0x98d6('0x41')][_0x98d6('0x67')]},'attributes':['id',_0x98d6('0x24'),_0x98d6('0x5e'),_0x98d6('0x5f'),_0x98d6('0x60')],'raw':!![]});}})[_0x98d6('0x1d')](function(_0x3f7c02){if(_0x3f7c02){fs[_0x98d6('0x57')](path[_0x98d6('0x58')](_0x2cc458['directory'],util[_0x98d6('0x61')](_0x98d6('0x62'),_0x3f7c02[_0x98d6('0x24')],_0x3f7c02[_0x98d6('0x5f')])));return _0x3f7c02;}})['catch'](function(_0x335f0a){throw new db['Sequelize'][(_0x98d6('0x65'))](_0x335f0a[_0x98d6('0x5b')]);});})[_0x98d6('0x1d')](handleEntityNotFound(_0x299006,null))[_0x98d6('0x1d')](respondWithStatusCode(_0x299006,0xcc))[_0x98d6('0x3f')](handleError(_0x299006,null));};exports['getSounds']=function(_0x2214cb,_0x346d33,_0x3dff37){var _0x579dda={};var _0x4c9372={};var _0x4461bf;var _0x3f2445;return db[_0x98d6('0x27')]['findOne']({'where':{'id':_0x2214cb['params']['id']}})[_0x98d6('0x1d')](handleEntityNotFound(_0x346d33,null))[_0x98d6('0x1d')](function(_0x3e7782){if(_0x3e7782){_0x4461bf=_0x3e7782;_0x4c9372[_0x98d6('0x2b')]=_[_0x98d6('0x42')](db[_0x98d6('0x68')]['rawAttributes']);_0x4c9372[_0x98d6('0x2d')]=_[_0x98d6('0x42')](_0x2214cb[_0x98d6('0x2d')]);_0x4c9372['filters']=_[_0x98d6('0x43')](_0x4c9372[_0x98d6('0x2b')],_0x4c9372[_0x98d6('0x2d')]);_0x579dda['attributes']=_[_0x98d6('0x43')](_0x4c9372[_0x98d6('0x2b')],qs[_0x98d6('0x30')](_0x2214cb['query'][_0x98d6('0x30')]));_0x579dda[_0x98d6('0x2f')]=_0x579dda[_0x98d6('0x2f')][_0x98d6('0x31')]?_0x579dda[_0x98d6('0x2f')]:_0x4c9372[_0x98d6('0x2b')];_0x579dda[_0x98d6('0x34')]=qs['sort'](_0x2214cb['query']['sort']);_0x579dda[_0x98d6('0x35')]=qs['filters'](_[_0x98d6('0x36')](_0x2214cb[_0x98d6('0x2d')],_0x4c9372['filters']));if(_0x2214cb['query'][_0x98d6('0x37')]){_0x579dda[_0x98d6('0x35')]=_['merge'](_0x579dda['where'],{'$or':_[_0x98d6('0x2c')](_0x579dda[_0x98d6('0x2f')],function(_0x3a2f62){var _0x132e12={};_0x132e12[_0x3a2f62]={'$like':'%'+_0x2214cb[_0x98d6('0x2d')][_0x98d6('0x37')]+'%'};return _0x132e12;})});}_0x579dda=_[_0x98d6('0x38')]({},_0x579dda,_0x2214cb[_0x98d6('0x44')]);return _0x4461bf['getSounds'](_0x579dda);}})[_0x98d6('0x1d')](function(_0x328f62){if(_0x328f62){_0x3f2445=_0x328f62[_0x98d6('0x31')];if(!_0x2214cb[_0x98d6('0x2d')][_0x98d6('0x32')](_0x98d6('0x69'))){_0x579dda[_0x98d6('0x33')]=qs[_0x98d6('0x33')](_0x2214cb[_0x98d6('0x2d')][_0x98d6('0x33')]);_0x579dda[_0x98d6('0x17')]=qs['offset'](_0x2214cb[_0x98d6('0x2d')][_0x98d6('0x17')]);}return _0x4461bf[_0x98d6('0x6a')](_0x579dda);}})['then'](function(_0xf4d17){if(_0xf4d17){return _0xf4d17?{'count':_0x3f2445,'rows':_0xf4d17}:null;}})[_0x98d6('0x1d')](respondWithResult(_0x346d33,null))[_0x98d6('0x3f')](handleError(_0x346d33,null));}; \ No newline at end of file +var _0xf0da=['UserProfileResource','readdirSync','unlinkSync','rmdirSync','Sequelize','message','addSound','Sound','converted_format','createdAt','root','format','%s.%s','basename','save_name','symlinkSync','ValidationError','findOne','removeSound','id2','getSounds','order','pick','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','MusicOnHolds','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','keys','find','body','params','create','sequelize','transaction','mode','files','directory','join','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId'];(function(_0x544a26,_0x383869){var _0x449357=function(_0x5e5a33){while(--_0x5e5a33){_0x544a26['push'](_0x544a26['shift']());}};_0x449357(++_0x383869);}(_0xf0da,0xff));var _0xaf0d=function(_0x4ac3a4,_0x5e623d){_0x4ac3a4=_0x4ac3a4-0x0;var _0x64d096=_0xf0da[_0x4ac3a4];return _0x64d096;};'use strict';var pdf=require(_0xaf0d('0x0'));var emlformat=require(_0xaf0d('0x1'));var rimraf=require(_0xaf0d('0x2'));var zipdir=require(_0xaf0d('0x3'));var jsonpatch=require(_0xaf0d('0x4'));var rp=require('request-promise');var moment=require(_0xaf0d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xaf0d('0x6'));var util=require('util');var path=require(_0xaf0d('0x7'));var sox=require(_0xaf0d('0x8'));var csv=require(_0xaf0d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xaf0d('0xa'));var squel=require(_0xaf0d('0xb'));var crypto=require(_0xaf0d('0xc'));var jsforce=require(_0xaf0d('0xd'));var deskjs=require(_0xaf0d('0xe'));var toCsv=require(_0xaf0d('0x9'));var querystring=require(_0xaf0d('0xf'));var Papa=require(_0xaf0d('0x10'));var Redis=require(_0xaf0d('0x11'));var authService=require(_0xaf0d('0x12'));var qs=require(_0xaf0d('0x13'));var as=require(_0xaf0d('0x14'));var hardwareService=require(_0xaf0d('0x15'));var logger=require(_0xaf0d('0x16'))(_0xaf0d('0x17'));var utils=require(_0xaf0d('0x18'));var config=require(_0xaf0d('0x19'));var licenseUtil=require(_0xaf0d('0x1a'));var db=require(_0xaf0d('0x1b'))['db'];function respondWithStatusCode(_0x3a60ef,_0x4813df){_0x4813df=_0x4813df||0xcc;return function(_0x303629){if(_0x303629){return _0x3a60ef[_0xaf0d('0x1c')](_0x4813df);}return _0x3a60ef[_0xaf0d('0x1d')](_0x4813df)[_0xaf0d('0x1e')]();};}function respondWithResult(_0x5f3426,_0x4643e0){_0x4643e0=_0x4643e0||0xc8;return function(_0x2fb7fa){if(_0x2fb7fa){return _0x5f3426[_0xaf0d('0x1d')](_0x4643e0)[_0xaf0d('0x1f')](_0x2fb7fa);}};}function respondWithFilteredResult(_0x272423,_0x400581){return function(_0x490892){if(_0x490892){var _0xfb2ed9=_0x490892[_0xaf0d('0x20')],_0x18141e=_0x400581[_0xaf0d('0x21')],_0x2778b6=_0x400581[_0xaf0d('0x21')]+_0x400581[_0xaf0d('0x22')],_0x2fb66e;if(_0x2778b6>=_0xfb2ed9){_0x2778b6=_0xfb2ed9;_0x2fb66e=0xc8;}else{_0x2fb66e=0xce;}_0x272423[_0xaf0d('0x1d')](_0x2fb66e);return _0x272423[_0xaf0d('0x23')](_0xaf0d('0x24'),_0x18141e+'-'+_0x2778b6+'/'+_0xfb2ed9)[_0xaf0d('0x1f')](_0x490892);}return null;};}function patchUpdates(_0x28252d){return function(_0x28be7c){try{jsonpatch[_0xaf0d('0x25')](_0x28be7c,_0x28252d,!![]);}catch(_0x3ee9a8){return BPromise['reject'](_0x3ee9a8);}return _0x28be7c[_0xaf0d('0x26')]();};}function saveUpdates(_0x459a3d,_0x3c218a){return function(_0x6500ff){if(_0x6500ff){return _0x6500ff[_0xaf0d('0x27')](_0x459a3d)[_0xaf0d('0x28')](function(_0xc50a81){return _0xc50a81;});}return null;};}function removeEntity(_0x3342cd,_0xe0d1d4){return function(_0x5d50e3){if(_0x5d50e3){return _0x5d50e3[_0xaf0d('0x29')]()[_0xaf0d('0x28')](function(){var _0x34047b=_0x5d50e3[_0xaf0d('0x2a')]({'plain':!![]});var _0x1c77f4=_0xaf0d('0x2b');return db['UserProfileResource'][_0xaf0d('0x29')]({'where':{'type':_0x1c77f4,'resourceId':_0x34047b['id']}})[_0xaf0d('0x28')](function(){return _0x5d50e3;});})[_0xaf0d('0x28')](function(){_0x3342cd[_0xaf0d('0x1d')](0xcc)[_0xaf0d('0x1e')]();});}};}function handleEntityNotFound(_0x45ec1b,_0x18b53d){return function(_0x553e52){if(!_0x553e52){_0x45ec1b['sendStatus'](0x194);}return _0x553e52;};}function handleError(_0x175ccb,_0x5a8c3){_0x5a8c3=_0x5a8c3||0x1f4;return function(_0x1c4c7c){logger[_0xaf0d('0x2c')](_0x1c4c7c[_0xaf0d('0x2d')]);if(_0x1c4c7c[_0xaf0d('0x2e')]){delete _0x1c4c7c['name'];}_0x175ccb[_0xaf0d('0x1d')](_0x5a8c3)[_0xaf0d('0x2f')](_0x1c4c7c);};}exports[_0xaf0d('0x30')]=function(_0x479395,_0x241368){var _0x44b65c={},_0x49c2ae={},_0x23c30a={'count':0x0,'rows':[]};var _0x128d22=_[_0xaf0d('0x31')](db[_0xaf0d('0x32')][_0xaf0d('0x33')],function(_0x6b6cda){return{'name':_0x6b6cda[_0xaf0d('0x34')],'type':_0x6b6cda['type'][_0xaf0d('0x35')]};});_0x49c2ae[_0xaf0d('0x36')]=_[_0xaf0d('0x31')](_0x128d22,_0xaf0d('0x2e'));_0x49c2ae[_0xaf0d('0x37')]=_['keys'](_0x479395[_0xaf0d('0x37')]);_0x49c2ae[_0xaf0d('0x38')]=_[_0xaf0d('0x39')](_0x49c2ae[_0xaf0d('0x36')],_0x49c2ae[_0xaf0d('0x37')]);_0x44b65c['attributes']=_[_0xaf0d('0x39')](_0x49c2ae[_0xaf0d('0x36')],qs[_0xaf0d('0x3a')](_0x479395[_0xaf0d('0x37')][_0xaf0d('0x3a')]));_0x44b65c['attributes']=_0x44b65c[_0xaf0d('0x3b')][_0xaf0d('0x3c')]?_0x44b65c[_0xaf0d('0x3b')]:_0x49c2ae[_0xaf0d('0x36')];if(!_0x479395[_0xaf0d('0x37')][_0xaf0d('0x3d')](_0xaf0d('0x3e'))){_0x44b65c['limit']=qs['limit'](_0x479395[_0xaf0d('0x37')][_0xaf0d('0x22')]);_0x44b65c['offset']=qs['offset'](_0x479395[_0xaf0d('0x37')][_0xaf0d('0x21')]);}_0x44b65c['order']=qs[_0xaf0d('0x3f')](_0x479395['query'][_0xaf0d('0x3f')]);_0x44b65c['where']=qs['filters'](_['pick'](_0x479395[_0xaf0d('0x37')],_0x49c2ae[_0xaf0d('0x38')]),_0x128d22);if(_0x479395[_0xaf0d('0x37')]['filter']){_0x44b65c[_0xaf0d('0x40')]=_[_0xaf0d('0x41')](_0x44b65c[_0xaf0d('0x40')],{'$or':_['map'](_0x128d22,function(_0x5906dd){if(_0x5906dd[_0xaf0d('0x42')]!==_0xaf0d('0x43')){var _0x1e5147={};_0x1e5147[_0x5906dd[_0xaf0d('0x2e')]]={'$like':'%'+_0x479395[_0xaf0d('0x37')][_0xaf0d('0x44')]+'%'};return _0x1e5147;}})});}_0x44b65c=_[_0xaf0d('0x41')]({},_0x44b65c,_0x479395[_0xaf0d('0x45')]);var _0x1bae6a={'where':_0x44b65c[_0xaf0d('0x40')]};return db['VoiceMusicOnHold'][_0xaf0d('0x20')](_0x1bae6a)[_0xaf0d('0x28')](function(_0x4edd04){_0x23c30a[_0xaf0d('0x20')]=_0x4edd04;if(_0x479395[_0xaf0d('0x37')][_0xaf0d('0x46')]){_0x44b65c[_0xaf0d('0x47')]=[{'all':!![]}];}return db[_0xaf0d('0x32')][_0xaf0d('0x48')](_0x44b65c);})[_0xaf0d('0x28')](function(_0x3c0851){_0x23c30a['rows']=_0x3c0851;return _0x23c30a;})[_0xaf0d('0x28')](respondWithFilteredResult(_0x241368,_0x44b65c))[_0xaf0d('0x49')](handleError(_0x241368,null));};exports[_0xaf0d('0x4a')]=function(_0x392238,_0x569f50){var _0x3922ae={'raw':![],'where':{'id':_0x392238['params']['id']}},_0x237a8f={};_0x237a8f[_0xaf0d('0x36')]=_['keys'](db[_0xaf0d('0x32')][_0xaf0d('0x33')]);_0x237a8f[_0xaf0d('0x37')]=_[_0xaf0d('0x4b')](_0x392238[_0xaf0d('0x37')]);_0x237a8f[_0xaf0d('0x38')]=_[_0xaf0d('0x39')](_0x237a8f[_0xaf0d('0x36')],_0x237a8f[_0xaf0d('0x37')]);_0x3922ae[_0xaf0d('0x3b')]=_[_0xaf0d('0x39')](_0x237a8f[_0xaf0d('0x36')],qs['fields'](_0x392238['query'][_0xaf0d('0x3a')]));_0x3922ae[_0xaf0d('0x3b')]=_0x3922ae['attributes']['length']?_0x3922ae['attributes']:_0x237a8f['model'];if(_0x392238['query']['includeAll']){_0x3922ae[_0xaf0d('0x47')]=[{'all':!![]}];}_0x3922ae=_['merge']({},_0x3922ae,_0x392238[_0xaf0d('0x45')]);return db[_0xaf0d('0x32')][_0xaf0d('0x4c')](_0x3922ae)[_0xaf0d('0x28')](handleEntityNotFound(_0x569f50,null))[_0xaf0d('0x28')](respondWithResult(_0x569f50,null))[_0xaf0d('0x49')](handleError(_0x569f50,null));};exports[_0xaf0d('0x27')]=function(_0x4e8536,_0x4cdffc){if(_0x4e8536[_0xaf0d('0x4d')]['id']){delete _0x4e8536['body']['id'];}return db[_0xaf0d('0x32')][_0xaf0d('0x4c')]({'where':{'id':_0x4e8536[_0xaf0d('0x4e')]['id']}})[_0xaf0d('0x28')](handleEntityNotFound(_0x4cdffc,null))[_0xaf0d('0x28')](saveUpdates(_0x4e8536['body'],null))['then'](respondWithResult(_0x4cdffc,null))['catch'](handleError(_0x4cdffc,null));};exports[_0xaf0d('0x4f')]=function(_0x2010c8,_0x59e5f8,_0x30c07a){return db[_0xaf0d('0x50')][_0xaf0d('0x51')](function(_0x2d14ef){if(_0x2010c8[_0xaf0d('0x4d')][_0xaf0d('0x52')]===_0xaf0d('0x53')){_0x2010c8['body'][_0xaf0d('0x54')]=path[_0xaf0d('0x55')](config['root'],_0xaf0d('0x56'),_0x2010c8[_0xaf0d('0x4d')][_0xaf0d('0x2e')]);}return db[_0xaf0d('0x32')][_0xaf0d('0x4f')](_0x2010c8['body'],{'transaction':_0x2d14ef})[_0xaf0d('0x28')](function(_0x535e01){if(_0x2010c8[_0xaf0d('0x4d')][_0xaf0d('0x52')]==='files'){fs[_0xaf0d('0x57')](_0x535e01[_0xaf0d('0x54')],parseInt(_0xaf0d('0x58'),0x8));}var _0x460a4e=_0x2010c8[_0xaf0d('0x59')][_0xaf0d('0x2a')]({'plain':!![]});if(!_0x460a4e)throw new Error(_0xaf0d('0x5a'));if(_0x460a4e[_0xaf0d('0x5b')]===_0xaf0d('0x59')){var _0x59267f=_0x535e01[_0xaf0d('0x2a')]({'plain':!![]});return db['UserProfileSection'][_0xaf0d('0x4c')]({'where':{'name':'MusicOnHolds','userProfileId':_0x460a4e[_0xaf0d('0x5c')]},'raw':!![]})[_0xaf0d('0x28')](function(_0x57c991){if(_0x57c991&&_0x57c991['autoAssociation']===0x0){return db[_0xaf0d('0x5d')][_0xaf0d('0x4f')]({'name':_0x59267f[_0xaf0d('0x2e')],'resourceId':_0x59267f['id'],'type':_0x57c991[_0xaf0d('0x2e')],'sectionId':_0x57c991['id']},{})[_0xaf0d('0x28')](function(){return _0x535e01;});}else{return _0x535e01;}})['catch'](function(_0x21ddab){logger[_0xaf0d('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21ddab);});}return _0x535e01;});})[_0xaf0d('0x28')](respondWithResult(_0x59e5f8,0xc9))[_0xaf0d('0x49')](handleError(_0x59e5f8,null));};exports[_0xaf0d('0x29')]=function(_0x15112e,_0x50e4e6,_0x3d5585){var _0x50f239;return db['VoiceMusicOnHold'][_0xaf0d('0x4c')]({'where':{'id':_0x15112e[_0xaf0d('0x4e')]['id']}})[_0xaf0d('0x28')](function(_0x567faa){if(_0x567faa){return db[_0xaf0d('0x50')][_0xaf0d('0x51')](function(_0x1db59d){return _0x567faa[_0xaf0d('0x29')]({'transaction':_0x1db59d,'raw':!![]})['then'](function(_0x545847){if(_0x545847[_0xaf0d('0x54')]){fs[_0xaf0d('0x5e')](_0x545847[_0xaf0d('0x54')])['forEach'](function(_0x5081db){fs[_0xaf0d('0x5f')](path[_0xaf0d('0x55')](_0x545847[_0xaf0d('0x54')],_0x5081db));});fs[_0xaf0d('0x60')](_0x545847[_0xaf0d('0x54')]);}return _0x545847;});})[_0xaf0d('0x49')](function(_0x2aa26d){throw new db[(_0xaf0d('0x61'))]['ValidationError'](_0x2aa26d[_0xaf0d('0x62')]);});}})[_0xaf0d('0x28')](handleEntityNotFound(_0x50e4e6,null))[_0xaf0d('0x28')](removeEntity(_0x50e4e6,null))['catch'](handleError(_0x50e4e6,null));};exports[_0xaf0d('0x63')]=function(_0x4bf25a,_0x2ae265,_0x75f27){return db['sequelize'][_0xaf0d('0x51')](function(_0x416047){var _0x2897af;return db[_0xaf0d('0x32')][_0xaf0d('0x4c')]({'where':{'id':_0x4bf25a[_0xaf0d('0x4e')]['id']}})[_0xaf0d('0x28')](function(_0x1da659){if(_0x1da659){_0x2897af=_0x1da659;return _0x1da659[_0xaf0d('0x63')](_0x4bf25a[_0xaf0d('0x4d')]['id'],{'transaction':_0x416047});}})[_0xaf0d('0x28')](function(_0x16a484){if(_0x16a484){return db[_0xaf0d('0x64')]['findOne']({'where':{'id':_0x4bf25a[_0xaf0d('0x4d')]['id']},'attributes':['id',_0xaf0d('0x2e'),'save_name',_0xaf0d('0x65'),_0xaf0d('0x66')],'raw':!![]});}})['then'](function(_0x561141){if(_0x561141){var _0x4db8fb=path[_0xaf0d('0x55')](config[_0xaf0d('0x67')],'server/files/sounds/converted',util[_0xaf0d('0x68')](_0xaf0d('0x69'),path[_0xaf0d('0x6a')](_0x561141[_0xaf0d('0x6b')],path['extname'](_0x561141[_0xaf0d('0x6b')])),_0x561141[_0xaf0d('0x65')]));var _0x412c44=path[_0xaf0d('0x55')](config[_0xaf0d('0x67')],_0xaf0d('0x56'),_0x2897af[_0xaf0d('0x2e')],util['format'](_0xaf0d('0x69'),_0x561141[_0xaf0d('0x2e')],_0x561141[_0xaf0d('0x65')]));fs[_0xaf0d('0x6c')](_0x4db8fb,_0x412c44);return _0x561141;}})['catch'](function(_0x2e26f5){throw new db[(_0xaf0d('0x61'))][(_0xaf0d('0x6d'))](_0x2e26f5[_0xaf0d('0x62')]);});})['then'](handleEntityNotFound(_0x2ae265,null))[_0xaf0d('0x28')](respondWithResult(_0x2ae265,0xc9))[_0xaf0d('0x49')](handleError(_0x2ae265,null));};exports['removeSound']=function(_0x477d65,_0x3e0bfc,_0xf8f4e5){return db[_0xaf0d('0x50')][_0xaf0d('0x51')](function(_0x15c607){var _0x204052;return db['VoiceMusicOnHold'][_0xaf0d('0x6e')]({'where':{'id':_0x477d65[_0xaf0d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3e0bfc,null))[_0xaf0d('0x28')](function(_0x4d6a6a){if(_0x4d6a6a){_0x204052=_0x4d6a6a;return _0x4d6a6a[_0xaf0d('0x6f')](_0x477d65[_0xaf0d('0x4e')][_0xaf0d('0x70')]);}})[_0xaf0d('0x28')](function(_0x13dfde){if(_0x13dfde){return db[_0xaf0d('0x64')][_0xaf0d('0x6e')]({'where':{'id':_0x477d65['params']['id2']},'attributes':['id',_0xaf0d('0x2e'),_0xaf0d('0x6b'),_0xaf0d('0x65'),_0xaf0d('0x66')],'raw':!![]});}})[_0xaf0d('0x28')](function(_0x6d5181){if(_0x6d5181){fs['unlinkSync'](path[_0xaf0d('0x55')](_0x204052[_0xaf0d('0x54')],util[_0xaf0d('0x68')](_0xaf0d('0x69'),_0x6d5181[_0xaf0d('0x2e')],_0x6d5181[_0xaf0d('0x65')])));return _0x6d5181;}})['catch'](function(_0x58af82){throw new db[(_0xaf0d('0x61'))][(_0xaf0d('0x6d'))](_0x58af82['message']);});})[_0xaf0d('0x28')](handleEntityNotFound(_0x3e0bfc,null))[_0xaf0d('0x28')](respondWithStatusCode(_0x3e0bfc,0xcc))[_0xaf0d('0x49')](handleError(_0x3e0bfc,null));};exports[_0xaf0d('0x71')]=function(_0x4888e7,_0x2cd904,_0x2c757c){var _0x2971de={};var _0x334ddb={};var _0x21c348;var _0x79fb25;return db[_0xaf0d('0x32')][_0xaf0d('0x6e')]({'where':{'id':_0x4888e7[_0xaf0d('0x4e')]['id']}})[_0xaf0d('0x28')](handleEntityNotFound(_0x2cd904,null))['then'](function(_0x5cdcd5){if(_0x5cdcd5){_0x21c348=_0x5cdcd5;_0x334ddb[_0xaf0d('0x36')]=_[_0xaf0d('0x4b')](db[_0xaf0d('0x64')][_0xaf0d('0x33')]);_0x334ddb[_0xaf0d('0x37')]=_['keys'](_0x4888e7[_0xaf0d('0x37')]);_0x334ddb[_0xaf0d('0x38')]=_[_0xaf0d('0x39')](_0x334ddb[_0xaf0d('0x36')],_0x334ddb['query']);_0x2971de['attributes']=_[_0xaf0d('0x39')](_0x334ddb[_0xaf0d('0x36')],qs[_0xaf0d('0x3a')](_0x4888e7[_0xaf0d('0x37')][_0xaf0d('0x3a')]));_0x2971de[_0xaf0d('0x3b')]=_0x2971de[_0xaf0d('0x3b')][_0xaf0d('0x3c')]?_0x2971de[_0xaf0d('0x3b')]:_0x334ddb[_0xaf0d('0x36')];_0x2971de[_0xaf0d('0x72')]=qs[_0xaf0d('0x3f')](_0x4888e7[_0xaf0d('0x37')][_0xaf0d('0x3f')]);_0x2971de[_0xaf0d('0x40')]=qs[_0xaf0d('0x38')](_[_0xaf0d('0x73')](_0x4888e7[_0xaf0d('0x37')],_0x334ddb[_0xaf0d('0x38')]));if(_0x4888e7['query'][_0xaf0d('0x44')]){_0x2971de[_0xaf0d('0x40')]=_[_0xaf0d('0x41')](_0x2971de[_0xaf0d('0x40')],{'$or':_[_0xaf0d('0x31')](_0x2971de[_0xaf0d('0x3b')],function(_0x4fbc5c){var _0x5ef27b={};_0x5ef27b[_0x4fbc5c]={'$like':'%'+_0x4888e7['query'][_0xaf0d('0x44')]+'%'};return _0x5ef27b;})});}_0x2971de=_[_0xaf0d('0x41')]({},_0x2971de,_0x4888e7[_0xaf0d('0x45')]);return _0x21c348[_0xaf0d('0x71')](_0x2971de);}})[_0xaf0d('0x28')](function(_0x3af2d2){if(_0x3af2d2){_0x79fb25=_0x3af2d2[_0xaf0d('0x3c')];if(!_0x4888e7[_0xaf0d('0x37')][_0xaf0d('0x3d')](_0xaf0d('0x3e'))){_0x2971de['limit']=qs[_0xaf0d('0x22')](_0x4888e7[_0xaf0d('0x37')][_0xaf0d('0x22')]);_0x2971de[_0xaf0d('0x21')]=qs[_0xaf0d('0x21')](_0x4888e7['query']['offset']);}return _0x21c348[_0xaf0d('0x71')](_0x2971de);}})[_0xaf0d('0x28')](function(_0x10ee68){if(_0x10ee68){return _0x10ee68?{'count':_0x79fb25,'rows':_0x10ee68}:null;}})[_0xaf0d('0x28')](respondWithResult(_0x2cd904,null))[_0xaf0d('0x49')](handleError(_0x2cd904,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index c9381f7..fe41ddf 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 _0x0d12=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash','util'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x0d12,0x11c));var _0x20d1=function(_0x2b9748,_0x2dc946){_0x2b9748=_0x2b9748-0x0;var _0x415395=_0x0d12[_0x2b9748];return _0x415395;};'use strict';var _=require(_0x20d1('0x0'));var util=require(_0x20d1('0x1'));var logger=require(_0x20d1('0x2'))('api');var moment=require(_0x20d1('0x3'));var BPromise=require(_0x20d1('0x4'));var rp=require(_0x20d1('0x5'));var fs=require('fs');var path=require(_0x20d1('0x6'));var rimraf=require(_0x20d1('0x7'));var config=require(_0x20d1('0x8'));var attributes=require(_0x20d1('0x9'));module[_0x20d1('0xa')]=function(_0x44fbdf,_0x352f14){return _0x44fbdf[_0x20d1('0xb')](_0x20d1('0xc'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x709b=['path','rimraf','../../config/environment','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','moment'];(function(_0x334825,_0x1aaf12){var _0x17554b=function(_0x1a10c7){while(--_0x1a10c7){_0x334825['push'](_0x334825['shift']());}};_0x17554b(++_0x1aaf12);}(_0x709b,0xc3));var _0xb709=function(_0x41f603,_0x3835fb){_0x41f603=_0x41f603-0x0;var _0x1e6281=_0x709b[_0x41f603];return _0x1e6281;};'use strict';var _=require(_0xb709('0x0'));var util=require(_0xb709('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb709('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb709('0x3'));var rimraf=require(_0xb709('0x4'));var config=require(_0xb709('0x5'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x4765b5,_0x512dd0){return _0x4765b5[_0xb709('0x6')](_0xb709('0x7'),attributes,{'tableName':_0xb709('0x8'),'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 8eb1b00..2a94231 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 _0x14cb=['VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1758f1,_0x35446f){var _0x173003=function(_0x315aec){while(--_0x315aec){_0x1758f1['push'](_0x1758f1['shift']());}};_0x173003(++_0x35446f);}(_0x14cb,0x13a));var _0xb14c=function(_0x312487,_0x492ecc){_0x312487=_0x312487-0x0;var _0x327767=_0x14cb[_0x312487];return _0x327767;};'use strict';var _=require(_0xb14c('0x0'));var util=require('util');var moment=require(_0xb14c('0x1'));var BPromise=require(_0xb14c('0x2'));var rs=require(_0xb14c('0x3'));var fs=require('fs');var Redis=require(_0xb14c('0x4'));var db=require(_0xb14c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb14c('0x6'))(_0xb14c('0x7'));var config=require(_0xb14c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb14c('0x9')][_0xb14c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47a013,_0x1a9f87,_0x1dcd35){return new BPromise(function(_0x3dcc77,_0x37e85d){return client['request'](_0x47a013,_0x1dcd35)[_0xb14c('0xb')](function(_0xa3f616){logger[_0xb14c('0xc')](_0xb14c('0xd'),_0x1a9f87,_0xb14c('0xe'));logger[_0xb14c('0xf')](_0xb14c('0x10'),_0x1a9f87,_0xb14c('0xe'),JSON['stringify'](_0xa3f616));if(_0xa3f616['error']){if(_0xa3f616[_0xb14c('0x11')][_0xb14c('0x12')]===0x1f4){logger[_0xb14c('0x11')](_0xb14c('0xd'),_0x1a9f87,_0xa3f616['error'][_0xb14c('0x13')]);return _0x37e85d(_0xa3f616[_0xb14c('0x11')]['message']);}logger[_0xb14c('0x11')](_0xb14c('0xd'),_0x1a9f87,_0xa3f616[_0xb14c('0x11')][_0xb14c('0x13')]);return _0x3dcc77(_0xa3f616['error'][_0xb14c('0x13')]);}else{logger[_0xb14c('0xc')](_0xb14c('0xd'),_0x1a9f87,_0xb14c('0xe'));_0x3dcc77(_0xa3f616[_0xb14c('0x14')][_0xb14c('0x13')]);}})[_0xb14c('0x15')](function(_0x5d7f04){logger[_0xb14c('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x1a9f87,_0x5d7f04);_0x37e85d(_0x5d7f04);});});} \ No newline at end of file +var _0x56a1=['../../mysqldb','rpc','jayson/promise','client','http','request','then','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','util','moment','randomstring','ioredis'];(function(_0x133c5a,_0xc74e31){var _0x6f7cae=function(_0x87ae01){while(--_0x87ae01){_0x133c5a['push'](_0x133c5a['shift']());}};_0x6f7cae(++_0xc74e31);}(_0x56a1,0x1f4));var _0x156a=function(_0x264e1e,_0x3af804){_0x264e1e=_0x264e1e-0x0;var _0x4b1840=_0x56a1[_0x264e1e];return _0x4b1840;};'use strict';var _=require('lodash');var util=require(_0x156a('0x0'));var moment=require(_0x156a('0x1'));var BPromise=require('bluebird');var rs=require(_0x156a('0x2'));var fs=require('fs');var Redis=require(_0x156a('0x3'));var db=require(_0x156a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x156a('0x5'));var config=require('../../config/environment');var jayson=require(_0x156a('0x6'));var client=jayson[_0x156a('0x7')][_0x156a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x464269,_0x6a9298,_0x1646b1){return new BPromise(function(_0x56c384,_0x5e0198){return client[_0x156a('0x9')](_0x464269,_0x1646b1)[_0x156a('0xa')](function(_0x4b7abe){logger['info'](_0x156a('0xb'),_0x6a9298,_0x156a('0xc'));logger[_0x156a('0xd')](_0x156a('0xe'),_0x6a9298,_0x156a('0xc'),JSON['stringify'](_0x4b7abe));if(_0x4b7abe['error']){if(_0x4b7abe['error'][_0x156a('0xf')]===0x1f4){logger[_0x156a('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x6a9298,_0x4b7abe[_0x156a('0x10')][_0x156a('0x11')]);return _0x5e0198(_0x4b7abe[_0x156a('0x10')][_0x156a('0x11')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x6a9298,_0x4b7abe[_0x156a('0x10')][_0x156a('0x11')]);return _0x56c384(_0x4b7abe['error'][_0x156a('0x11')]);}else{logger[_0x156a('0x12')](_0x156a('0xb'),_0x6a9298,_0x156a('0xc'));_0x56c384(_0x4b7abe[_0x156a('0x13')][_0x156a('0x11')]);}})[_0x156a('0x14')](function(_0x281a3b){logger[_0x156a('0x10')](_0x156a('0xb'),_0x6a9298,_0x281a3b);_0x5e0198(_0x281a3b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index fd87a39..ce04663 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 _0xa110=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/users','post','create','put','update','delete','removeAgents','exports','multer','util','connect-timeout'];(function(_0x2e68ec,_0x57544e){var _0xe9284d=function(_0x474680){while(--_0x474680){_0x2e68ec['push'](_0x2e68ec['shift']());}};_0xe9284d(++_0x57544e);}(_0xa110,0x111));var _0x0a11=function(_0x30fc1c,_0x41c717){_0x30fc1c=_0x30fc1c-0x0;var _0x53094a=_0xa110[_0x30fc1c];return _0x53094a;};'use strict';var multer=require(_0x0a11('0x0'));var util=require(_0x0a11('0x1'));var path=require('path');var timeout=require(_0x0a11('0x2'));var express=require(_0x0a11('0x3'));var router=express[_0x0a11('0x4')]();var auth=require(_0x0a11('0x5'));var interaction=require(_0x0a11('0x6'));var config=require(_0x0a11('0x7'));var controller=require(_0x0a11('0x8'));router[_0x0a11('0x9')]('/',auth[_0x0a11('0xa')](),controller[_0x0a11('0xb')]);router[_0x0a11('0x9')](_0x0a11('0xc'),auth[_0x0a11('0xa')](),controller['describe']);router['get'](_0x0a11('0xd'),auth['isAuthenticated'](),controller[_0x0a11('0xe')]);router[_0x0a11('0x9')](_0x0a11('0xf'),auth[_0x0a11('0xa')](),controller['getAgents']);router[_0x0a11('0x10')]('/',auth['isAuthenticated'](),controller[_0x0a11('0x11')]);router[_0x0a11('0x10')]('/:id/users',auth[_0x0a11('0xa')](),controller['addAgents']);router[_0x0a11('0x12')](_0x0a11('0xd'),auth[_0x0a11('0xa')](),controller[_0x0a11('0x13')]);router[_0x0a11('0x14')](_0x0a11('0xd'),auth[_0x0a11('0xa')](),controller['destroy']);router[_0x0a11('0x14')](_0x0a11('0xf'),auth[_0x0a11('0xa')](),controller[_0x0a11('0x15')]);module[_0x0a11('0x16')]=router; \ No newline at end of file +var _0xa45c=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','describe','/:id','show','getAgents','create','addAgents','put','delete','destroy','/:id/users','removeAgents'];(function(_0x2f1089,_0x1ac63a){var _0x4f3a8b=function(_0x2e7380){while(--_0x2e7380){_0x2f1089['push'](_0x2f1089['shift']());}};_0x4f3a8b(++_0x1ac63a);}(_0xa45c,0x171));var _0xca45=function(_0x54bfd7,_0x4f8b0b){_0x54bfd7=_0x54bfd7-0x0;var _0x4cffeb=_0xa45c[_0x54bfd7];return _0x4cffeb;};'use strict';var multer=require('multer');var util=require(_0xca45('0x0'));var path=require(_0xca45('0x1'));var timeout=require(_0xca45('0x2'));var express=require('express');var router=express[_0xca45('0x3')]();var auth=require(_0xca45('0x4'));var interaction=require(_0xca45('0x5'));var config=require(_0xca45('0x6'));var controller=require(_0xca45('0x7'));router[_0xca45('0x8')]('/',auth[_0xca45('0x9')](),controller['index']);router[_0xca45('0x8')](_0xca45('0xa'),auth[_0xca45('0x9')](),controller[_0xca45('0xb')]);router[_0xca45('0x8')](_0xca45('0xc'),auth[_0xca45('0x9')](),controller[_0xca45('0xd')]);router[_0xca45('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0xca45('0xe')]);router['post']('/',auth[_0xca45('0x9')](),controller[_0xca45('0xf')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xca45('0x10')]);router[_0xca45('0x11')](_0xca45('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xca45('0x12')](_0xca45('0xc'),auth['isAuthenticated'](),controller[_0xca45('0x13')]);router[_0xca45('0x12')](_0xca45('0x14'),auth[_0xca45('0x9')](),controller[_0xca45('0x15')]);module[_0xca45('0x16')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index f3d872c..d259c6d 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 _0x9004=['system-','getDataValue','INTEGER','sequelize','exports','STRING','name','VIRTUAL'];(function(_0x5c51bf,_0x11c26d){var _0x235315=function(_0x39ba1b){while(--_0x39ba1b){_0x5c51bf['push'](_0x5c51bf['shift']());}};_0x235315(++_0x11c26d);}(_0x9004,0x1eb));var _0x4900=function(_0x561f19,_0x2f0d7c){_0x561f19=_0x561f19-0x0;var _0x269cab=_0x9004[_0x561f19];return _0x269cab;};'use strict';var Sequelize=require(_0x4900('0x0'));module[_0x4900('0x1')]={'name':{'type':Sequelize[_0x4900('0x2')],'allowNull':![],'unique':_0x4900('0x3')},'prefix':{'type':Sequelize[_0x4900('0x4')],'get':function(_0x373537){return _0x4900('0x5')+this[_0x4900('0x6')](_0x4900('0x3'))+'-';}},'description':{'type':Sequelize[_0x4900('0x2')]},'callerIdAll':{'type':Sequelize[_0x4900('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x4900('0x7')]}}; \ No newline at end of file +var _0xf7e7=['getDataValue','INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x36558f,_0x1a4f6f){var _0x5d888d=function(_0x16bbe3){while(--_0x16bbe3){_0x36558f['push'](_0x36558f['shift']());}};_0x5d888d(++_0x1a4f6f);}(_0xf7e7,0x182));var _0x7f7e=function(_0x437572,_0x25f10a){_0x437572=_0x437572-0x0;var _0x1f1851=_0xf7e7[_0x437572];return _0x1f1851;};'use strict';var Sequelize=require(_0x7f7e('0x0'));module[_0x7f7e('0x1')]={'name':{'type':Sequelize[_0x7f7e('0x2')],'allowNull':![],'unique':_0x7f7e('0x3')},'prefix':{'type':Sequelize[_0x7f7e('0x4')],'get':function(_0x41ff4f){return _0x7f7e('0x5')+this[_0x7f7e('0x6')](_0x7f7e('0x3'))+'-';}},'description':{'type':Sequelize[_0x7f7e('0x2')]},'callerIdAll':{'type':Sequelize[_0x7f7e('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x7f7e('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 9e69e85..77ea22a 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 _0x965d=['get','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','map','VoicePrefix','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','keys','catch','describe','create','sequelize','transaction','body','VoiceExtension','find','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','priority','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','charAt','prefix','system-','update','findById','addAgents','ids','omit','spread','removeAgents','emit','userVoicePrefix:remove','findOne','User','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','end','json','offset','limit','Content-Range','reject','then','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x965d,0x1be));var _0xd965=function(_0x1073b2,_0x523eb6){_0x1073b2=_0x1073b2-0x0;var _0x3876f4=_0x965d[_0x1073b2];return _0x3876f4;};'use strict';var pdf=require(_0xd965('0x0'));var emlformat=require(_0xd965('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd965('0x2'));var jsonpatch=require(_0xd965('0x3'));var rp=require(_0xd965('0x4'));var moment=require('moment');var BPromise=require(_0xd965('0x5'));var Mustache=require(_0xd965('0x6'));var util=require(_0xd965('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd965('0x8'));var squel=require(_0xd965('0x9'));var crypto=require('crypto');var jsforce=require(_0xd965('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd965('0xb'));var querystring=require(_0xd965('0xc'));var Papa=require(_0xd965('0xd'));var Redis=require(_0xd965('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd965('0xf'));var as=require(_0xd965('0x10'));var hardwareService=require(_0xd965('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd965('0x12'));var db=require(_0xd965('0x13'))['db'];config['redis']=_[_0xd965('0x14')](config[_0xd965('0x15')],{'host':_0xd965('0x16'),'port':0x18eb});var socket=require(_0xd965('0x17'))(new Redis(config[_0xd965('0x15')]));require('./voicePrefix.socket')[_0xd965('0x18')](socket);function respondWithStatusCode(_0x419d38,_0x4ef970){_0x4ef970=_0x4ef970||0xcc;return function(_0x58bfb4){if(_0x58bfb4){return _0x419d38['sendStatus'](_0x4ef970);}return _0x419d38[_0xd965('0x19')](_0x4ef970)[_0xd965('0x1a')]();};}function respondWithResult(_0x13feed,_0x5f96c0){_0x5f96c0=_0x5f96c0||0xc8;return function(_0x4f1960){if(_0x4f1960){return _0x13feed[_0xd965('0x19')](_0x5f96c0)[_0xd965('0x1b')](_0x4f1960);}};}function respondWithFilteredResult(_0x340467,_0x233506){return function(_0x45f930){if(_0x45f930){var _0x5dbaff=_0x45f930['count'],_0x1321c1=_0x233506[_0xd965('0x1c')],_0x5e4659=_0x233506[_0xd965('0x1c')]+_0x233506[_0xd965('0x1d')],_0x47b63a;if(_0x5e4659>=_0x5dbaff){_0x5e4659=_0x5dbaff;_0x47b63a=0xc8;}else{_0x47b63a=0xce;}_0x340467[_0xd965('0x19')](_0x47b63a);return _0x340467['set'](_0xd965('0x1e'),_0x1321c1+'-'+_0x5e4659+'/'+_0x5dbaff)[_0xd965('0x1b')](_0x45f930);}return null;};}function patchUpdates(_0x323169){return function(_0x5121f4){try{jsonpatch['apply'](_0x5121f4,_0x323169,!![]);}catch(_0x5afd43){return BPromise[_0xd965('0x1f')](_0x5afd43);}return _0x5121f4['save']();};}function saveUpdates(_0x26acc5,_0xef392d){return function(_0x57c5d4){if(_0x57c5d4){return _0x57c5d4['update'](_0x26acc5)[_0xd965('0x20')](function(_0x140000){return _0x140000;});}return null;};}function removeEntity(_0x1730bf,_0x34eb21){return function(_0x448642){if(_0x448642){return _0x448642[_0xd965('0x21')]()[_0xd965('0x20')](function(){var _0x1a7367=_0x448642[_0xd965('0x22')]({'plain':!![]});var _0xc30f4d=_0xd965('0x23');return db[_0xd965('0x24')]['destroy']({'where':{'type':_0xc30f4d,'resourceId':_0x1a7367['id']}})[_0xd965('0x20')](function(){return _0x448642;});})[_0xd965('0x20')](function(){_0x1730bf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6a07,_0x4d5fe8){return function(_0x4fc59f){if(!_0x4fc59f){_0x4d6a07[_0xd965('0x25')](0x194);}return _0x4fc59f;};}function handleError(_0x182b87,_0x36fc2c){_0x36fc2c=_0x36fc2c||0x1f4;return function(_0x5894fc){logger[_0xd965('0x26')](_0x5894fc[_0xd965('0x27')]);if(_0x5894fc[_0xd965('0x28')]){delete _0x5894fc['name'];}_0x182b87[_0xd965('0x19')](_0x36fc2c)['send'](_0x5894fc);};}exports['index']=function(_0x5ac01e,_0x26379d){var _0x5d2d32={},_0x29b600={},_0x5be7a6={'count':0x0,'rows':[]};var _0xec5851=_[_0xd965('0x29')](db[_0xd965('0x2a')][_0xd965('0x2b')],function(_0x52202a){return{'name':_0x52202a[_0xd965('0x2c')],'type':_0x52202a[_0xd965('0x2d')]['key']};});_0x29b600[_0xd965('0x2e')]=_[_0xd965('0x29')](_0xec5851,'name');_0x29b600[_0xd965('0x2f')]=_['keys'](_0x5ac01e[_0xd965('0x2f')]);_0x29b600[_0xd965('0x30')]=_[_0xd965('0x31')](_0x29b600[_0xd965('0x2e')],_0x29b600['query']);_0x5d2d32[_0xd965('0x32')]=_[_0xd965('0x31')](_0x29b600['model'],qs[_0xd965('0x33')](_0x5ac01e[_0xd965('0x2f')][_0xd965('0x33')]));_0x5d2d32[_0xd965('0x32')]=_0x5d2d32[_0xd965('0x32')][_0xd965('0x34')]?_0x5d2d32['attributes']:_0x29b600[_0xd965('0x2e')];if(!_0x5ac01e['query'][_0xd965('0x35')](_0xd965('0x36'))){_0x5d2d32['limit']=qs[_0xd965('0x1d')](_0x5ac01e[_0xd965('0x2f')][_0xd965('0x1d')]);_0x5d2d32[_0xd965('0x1c')]=qs[_0xd965('0x1c')](_0x5ac01e[_0xd965('0x2f')][_0xd965('0x1c')]);}_0x5d2d32[_0xd965('0x37')]=qs[_0xd965('0x38')](_0x5ac01e[_0xd965('0x2f')]['sort']);_0x5d2d32[_0xd965('0x39')]=qs[_0xd965('0x30')](_[_0xd965('0x3a')](_0x5ac01e['query'],_0x29b600['filters']),_0xec5851);if(_0x5ac01e['query'][_0xd965('0x3b')]){_0x5d2d32[_0xd965('0x39')]=_[_0xd965('0x3c')](_0x5d2d32[_0xd965('0x39')],{'$or':_[_0xd965('0x29')](_0xec5851,function(_0x30c007){if(_0x30c007[_0xd965('0x2d')]!==_0xd965('0x3d')){var _0x40c504={};_0x40c504[_0x30c007['name']]={'$like':'%'+_0x5ac01e['query']['filter']+'%'};return _0x40c504;}})});}_0x5d2d32=_[_0xd965('0x3c')]({},_0x5d2d32,_0x5ac01e[_0xd965('0x3e')]);var _0x357656={'where':_0x5d2d32[_0xd965('0x39')]};return db[_0xd965('0x2a')][_0xd965('0x3f')](_0x357656)[_0xd965('0x20')](function(_0x19da2d){_0x5be7a6['count']=_0x19da2d;if(_0x5ac01e[_0xd965('0x2f')][_0xd965('0x40')]){_0x5d2d32[_0xd965('0x41')]=[{'all':!![]}];}return db[_0xd965('0x2a')]['findAll'](_0x5d2d32);})['then'](function(_0x131aaf){_0x5be7a6[_0xd965('0x42')]=_0x131aaf;return _0x5be7a6;})['then'](respondWithFilteredResult(_0x26379d,_0x5d2d32))['catch'](handleError(_0x26379d,null));};exports[_0xd965('0x43')]=function(_0x1f7a87,_0x9a6cc9){var _0x564826={'raw':![],'where':{'id':_0x1f7a87[_0xd965('0x44')]['id']}},_0x136f25={};_0x136f25[_0xd965('0x2e')]=_[_0xd965('0x45')](db['VoicePrefix'][_0xd965('0x2b')]);_0x136f25['query']=_[_0xd965('0x45')](_0x1f7a87[_0xd965('0x2f')]);_0x136f25[_0xd965('0x30')]=_[_0xd965('0x31')](_0x136f25[_0xd965('0x2e')],_0x136f25[_0xd965('0x2f')]);_0x564826[_0xd965('0x32')]=_[_0xd965('0x31')](_0x136f25[_0xd965('0x2e')],qs['fields'](_0x1f7a87[_0xd965('0x2f')]['fields']));_0x564826[_0xd965('0x32')]=_0x564826['attributes']['length']?_0x564826['attributes']:_0x136f25[_0xd965('0x2e')];if(_0x1f7a87[_0xd965('0x2f')]['includeAll']){_0x564826[_0xd965('0x41')]=[{'all':!![]}];}_0x564826=_['merge']({},_0x564826,_0x1f7a87[_0xd965('0x3e')]);return db[_0xd965('0x2a')]['find'](_0x564826)[_0xd965('0x20')](handleEntityNotFound(_0x9a6cc9,null))[_0xd965('0x20')](respondWithResult(_0x9a6cc9,null))[_0xd965('0x46')](handleError(_0x9a6cc9,null));};exports['destroy']=function(_0x57ef85,_0x3928db){return db[_0xd965('0x2a')]['find']({'where':{'id':_0x57ef85[_0xd965('0x44')]['id']}})[_0xd965('0x20')](handleEntityNotFound(_0x3928db,null))[_0xd965('0x20')](removeEntity(_0x3928db,null))[_0xd965('0x46')](handleError(_0x3928db,null));};exports['describe']=function(_0x1e4ac1,_0x4a657c){return db['VoicePrefix'][_0xd965('0x47')]()['then'](respondWithResult(_0x4a657c,null))[_0xd965('0x46')](handleError(_0x4a657c,null));};exports[_0xd965('0x48')]=function(_0x32b9fb,_0xe40865){var _0x3f8286;return db[_0xd965('0x49')][_0xd965('0x4a')](function(_0x17c215){return db['VoicePrefix']['create'](_0x32b9fb[_0xd965('0x4b')],{'transaction':_0x17c215})[_0xd965('0x20')](function(_0x160009){_0x3f8286=_0x160009[_0xd965('0x22')]({'plain':!![]});return db[_0xd965('0x4c')][_0xd965('0x4d')]({'where':{'id':_0x3f8286[_0xd965('0x4e')]},'raw':!![]})['then'](function(_0x331791){return createVoicePrefixExtensions(_0x3f8286,_0x331791,_0x17c215);});});})[_0xd965('0x20')](function(){var _0x525ab9=_0x32b9fb[_0xd965('0x4f')][_0xd965('0x22')]({'plain':!![]});if(!_0x525ab9)throw new Error(_0xd965('0x50'));if(_0x525ab9[_0xd965('0x51')]===_0xd965('0x4f')){var _0x134a1e=_0x3f8286;return db[_0xd965('0x52')][_0xd965('0x4d')]({'where':{'name':'VoicePrefixes','userProfileId':_0x525ab9[_0xd965('0x53')]},'raw':!![]})['then'](function(_0x583c8f){if(_0x583c8f&&_0x583c8f[_0xd965('0x54')]===0x0){return db['UserProfileResource'][_0xd965('0x48')]({'name':_0x134a1e[_0xd965('0x28')],'resourceId':_0x134a1e['id'],'type':_0x583c8f[_0xd965('0x28')],'sectionId':_0x583c8f['id']},{})[_0xd965('0x20')](function(){return _0x3f8286;});}else{return _0x3f8286;}})[_0xd965('0x46')](function(_0x3a18c7){logger[_0xd965('0x26')](_0xd965('0x55'),_0x3a18c7);throw _0x3a18c7;});}return _0x3f8286;})[_0xd965('0x20')](respondWithResult(_0xe40865,null))[_0xd965('0x46')](handleError(_0xe40865,null));};function Extension(_0x9f9890,_0x2047da,_0xdc9bba,_0x2aeb91){this[_0xd965('0x56')]=_0xd965('0x57');this[_0xd965('0x58')]=_0x9f9890;this[_0xd965('0x59')]=_0xdc9bba;this[_0xd965('0x2d')]=_0xd965('0x5a');this[_0xd965('0x5b')]='Voice\x20Prefix\x20Extension';this[_0xd965('0x5c')]=_0x2047da;this['appdata']=_0x2aeb91;}function createVoicePrefixExtensions(_0x17bdd9,_0x26a69d,_0x47d362){return new BPromise(function(_0x3ff3b7,_0x544970){var _0x3954fa=new Extension(formatPrefixName(_0x17bdd9['prefix']),0x1,_0xd965('0x5d'),_0xd965('0x5e'));_0x3954fa[_0xd965('0x5f')]=_0x17bdd9['id'];return db[_0xd965('0x4c')]['create'](_0x3954fa,{'transaction':_0x47d362})[_0xd965('0x20')](function(_0x2cf826){var _0x3c20bb=_0x2cf826[_0xd965('0x22')]({'plain':!![]});var _0x2362df=_[_0xd965('0x29')](addVoicePrefixExtensions(_0x17bdd9,_0x26a69d),function(_0x513a7d){_0x513a7d[_0xd965('0x4e')]=_0x3c20bb['id'];_0x513a7d[_0xd965('0x5f')]=_0x17bdd9['id'];return _0x513a7d;});return db[_0xd965('0x4c')][_0xd965('0x60')](_0x2362df,{'transaction':_0x47d362})[_0xd965('0x20')](function(_0x3a6a4c){if(!_0x3a6a4c){return _0x544970(_0xd965('0x61'));}else{return _0x3ff3b7(_0x3a6a4c);}})['catch'](function(_0x1fde94){return _0x544970(_0x1fde94);});});;});};function addVoicePrefixExtensions(_0x305c4e,_0x36b1c8){var _0xc81c6=[];var _0x188009=formatPrefixName(_0x305c4e['prefix']);_0xc81c6[_0xd965('0x62')](new Extension(_0x188009,0x2,_0xd965('0x63'),_0xd965('0x64')+_0x305c4e[_0xd965('0x28')]));if(_0x305c4e[_0xd965('0x65')]){_0xc81c6[_0xd965('0x62')](new Extension(_0x188009,0x3,'Set',_0xd965('0x66')+_0x305c4e[_0xd965('0x65')]));}else{_0xc81c6[_0xd965('0x62')](new Extension(_0x188009,0x3,'NoOp',_0xd965('0x67')));}_0xc81c6[_0xd965('0x62')](new Extension(_0x188009,0x4,_0xd965('0x68'),_0x36b1c8[_0xd965('0x56')]+','+'${EXTEN:'+(0x8+_0x305c4e['name'][_0xd965('0x34')])+'}'+','+0x1));return _0xc81c6;}function formatPrefixName(_0x17d12e){var _0x369270='_';for(var _0x4cb8d9=0x0;_0x4cb8d9<_0x17d12e[_0xd965('0x34')];_0x4cb8d9++){if(_0x17d12e['charAt'](_0x4cb8d9)=='-'){_0x369270+=_0x17d12e[_0xd965('0x69')](_0x4cb8d9);}else{_0x369270+='['+_0x17d12e[_0xd965('0x69')](_0x4cb8d9)+']';}}_0x369270+='.';return _0x369270;}exports['update']=function(_0x33efda,_0x24303c,_0x2939e9){var _0x24225e=_0x33efda[_0xd965('0x4b')];_0x24225e[_0xd965('0x6a')]=_0xd965('0x6b')+_0x24225e[_0xd965('0x28')]+'-';return db[_0xd965('0x49')][_0xd965('0x4a')](function(_0x347c5f){return db[_0xd965('0x2a')][_0xd965('0x6c')](_0x24225e,{'where':{'id':_0x24225e['id']},'transaction':_0x347c5f})[_0xd965('0x20')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x24225e['id']},'transaction':_0x347c5f})[_0xd965('0x20')](function(){return db[_0xd965('0x4c')]['find']({'where':{'id':_0x24225e[_0xd965('0x4e')]},'raw':!![]})[_0xd965('0x20')](function(_0x5c256e){return createVoicePrefixExtensions(_0x24225e,_0x5c256e,_0x347c5f);});});});})['then'](function(){return db['VoicePrefix'][_0xd965('0x6d')](_0x24225e['id']);})[_0xd965('0x20')](respondWithResult(_0x24303c,null))[_0xd965('0x46')](handleError(_0x24303c,null));};exports['addAgents']=function(_0x5426a6,_0x5d2f8d,_0xd8f7d9){return db[_0xd965('0x2a')]['find']({'where':{'id':_0x5426a6['params']['id']}})['then'](handleEntityNotFound(_0x5d2f8d,null))[_0xd965('0x20')](function(_0x106f8d){if(_0x106f8d){return _0x106f8d[_0xd965('0x6e')](_0x5426a6['body'][_0xd965('0x6f')],_[_0xd965('0x70')](_0x5426a6[_0xd965('0x4b')],[_0xd965('0x6f'),'id'])||{})[_0xd965('0x71')](function(_0x3371da){for(var _0x537928=0x0;_0x537928<_0x5426a6['body'][_0xd965('0x6f')][_0xd965('0x34')];_0x537928+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':_0x5426a6['body'][_0xd965('0x6f')][_0x537928],'VoicePrefixId':_0x5426a6[_0xd965('0x44')]['id']});}return _0x3371da;});}})['then'](respondWithResult(_0x5d2f8d,null))[_0xd965('0x46')](handleError(_0x5d2f8d,null));};exports[_0xd965('0x72')]=function(_0x4da65e,_0x468d90,_0x262198){return db['VoicePrefix'][_0xd965('0x4d')]({'where':{'id':_0x4da65e[_0xd965('0x44')]['id']}})['then'](handleEntityNotFound(_0x468d90,null))[_0xd965('0x20')](function(_0x444aa3){if(_0x444aa3){return _0x444aa3[_0xd965('0x72')](_0x4da65e[_0xd965('0x2f')][_0xd965('0x6f')])['then'](function(){if(_['isArray'](_0x4da65e[_0xd965('0x2f')]['ids'])){for(var _0x2abb12=0x0;_0x2abb12<_0x4da65e[_0xd965('0x2f')][_0xd965('0x6f')]['length'];_0x2abb12+=0x1){socket[_0xd965('0x73')](_0xd965('0x74'),{'UserId':Number(_0x4da65e[_0xd965('0x2f')][_0xd965('0x6f')][_0x2abb12]),'VoicePrefixId':Number(_0x4da65e['params']['id'])});}}else{socket[_0xd965('0x73')](_0xd965('0x74'),{'UserId':Number(_0x4da65e[_0xd965('0x2f')][_0xd965('0x6f')]),'VoicePrefixId':Number(_0x4da65e['params']['id'])});}});}})['then'](respondWithStatusCode(_0x468d90,null))[_0xd965('0x46')](handleError(_0x468d90,null));};exports['getAgents']=function(_0x14a740,_0x285113,_0x5ad9d9){var _0x184b00={};var _0xf2edf6={};var _0x3f7841;var _0x4927a7;return db[_0xd965('0x2a')][_0xd965('0x75')]({'where':{'id':_0x14a740[_0xd965('0x44')]['id']}})[_0xd965('0x20')](handleEntityNotFound(_0x285113,null))[_0xd965('0x20')](function(_0x28b01d){if(_0x28b01d){_0x3f7841=_0x28b01d;_0xf2edf6[_0xd965('0x2e')]=_['keys'](db[_0xd965('0x76')][_0xd965('0x2b')]);_0xf2edf6[_0xd965('0x2f')]=_[_0xd965('0x45')](_0x14a740['query']);_0xf2edf6[_0xd965('0x30')]=_[_0xd965('0x31')](_0xf2edf6[_0xd965('0x2e')],_0xf2edf6['query']);_0x184b00[_0xd965('0x32')]=_['intersection'](_0xf2edf6[_0xd965('0x2e')],qs[_0xd965('0x33')](_0x14a740[_0xd965('0x2f')][_0xd965('0x33')]));_0x184b00['attributes']=_0x184b00[_0xd965('0x32')]['length']?_0x184b00[_0xd965('0x32')]:_0xf2edf6[_0xd965('0x2e')];_0x184b00[_0xd965('0x37')]=qs[_0xd965('0x38')](_0x14a740[_0xd965('0x2f')][_0xd965('0x38')]);_0x184b00[_0xd965('0x39')]=qs[_0xd965('0x30')](_[_0xd965('0x3a')](_0x14a740['query'],_0xf2edf6['filters']));if(_0x14a740['query']['filter']){_0x184b00['where']=_['merge'](_0x184b00['where'],{'$or':_['map'](_0x184b00[_0xd965('0x32')],function(_0x407e00){var _0x266d0d={};_0x266d0d[_0x407e00]={'$like':'%'+_0x14a740[_0xd965('0x2f')]['filter']+'%'};return _0x266d0d;})});}_0x184b00=_[_0xd965('0x3c')]({},_0x184b00,_0x14a740['options']);return _0x3f7841[_0xd965('0x77')](_0x184b00);}})['then'](function(_0x32bb69){if(_0x32bb69){_0x4927a7=_0x32bb69[_0xd965('0x34')];if(!_0x14a740[_0xd965('0x2f')][_0xd965('0x35')](_0xd965('0x36'))){_0x184b00[_0xd965('0x1d')]=qs[_0xd965('0x1d')](_0x14a740[_0xd965('0x2f')]['limit']);_0x184b00['offset']=qs[_0xd965('0x1c')](_0x14a740[_0xd965('0x2f')][_0xd965('0x1c')]);}return _0x3f7841[_0xd965('0x77')](_0x184b00);}})[_0xd965('0x20')](function(_0x42b2f3){if(_0x42b2f3){return _0x42b2f3?{'count':_0x4927a7,'rows':_0x42b2f3}:null;}})[_0xd965('0x20')](respondWithResult(_0x285113,null))[_0xd965('0x46')](handleError(_0x285113,null));}; \ No newline at end of file +var _0xe626=['app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoiceExtensionId','VoicePrefixId','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','${EXTEN:','charAt','update','system-','sequelize','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','stack','index','rawAttributes','model','name','query','keys','filters','attributes','intersection','fields','nolimit','limit','order','sort','where','pick','filter','map','type','merge','options','VoicePrefix','includeAll','include','findAll','rows','catch','show','params','length','find','describe','create','transaction','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten'];(function(_0x24257,_0x42ae94){var _0x570f0b=function(_0x20493f){while(--_0x20493f){_0x24257['push'](_0x24257['shift']());}};_0x570f0b(++_0x42ae94);}(_0xe626,0x9d));var _0x6e62=function(_0x2f56db,_0x2ba32a){_0x2f56db=_0x2f56db-0x0;var _0x56f271=_0xe626[_0x2f56db];return _0x56f271;};'use strict';var pdf=require(_0x6e62('0x0'));var emlformat=require(_0x6e62('0x1'));var rimraf=require(_0x6e62('0x2'));var zipdir=require(_0x6e62('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e62('0x4'));var moment=require(_0x6e62('0x5'));var BPromise=require(_0x6e62('0x6'));var Mustache=require(_0x6e62('0x7'));var util=require(_0x6e62('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6e62('0x9'));var fs=require('fs');var _=require(_0x6e62('0xa'));var squel=require('squel');var crypto=require(_0x6e62('0xb'));var jsforce=require(_0x6e62('0xc'));var deskjs=require(_0x6e62('0xd'));var toCsv=require(_0x6e62('0xe'));var querystring=require('querystring');var Papa=require(_0x6e62('0xf'));var Redis=require(_0x6e62('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6e62('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e62('0x12'));var logger=require('../../config/logger')(_0x6e62('0x13'));var utils=require('../../config/utils');var config=require(_0x6e62('0x14'));var licenseUtil=require(_0x6e62('0x15'));var db=require(_0x6e62('0x16'))['db'];config[_0x6e62('0x17')]=_[_0x6e62('0x18')](config[_0x6e62('0x17')],{'host':_0x6e62('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6e62('0x1a'))[_0x6e62('0x1b')](socket);function respondWithStatusCode(_0x5328fe,_0x91facd){_0x91facd=_0x91facd||0xcc;return function(_0x40ec9d){if(_0x40ec9d){return _0x5328fe[_0x6e62('0x1c')](_0x91facd);}return _0x5328fe[_0x6e62('0x1d')](_0x91facd)['end']();};}function respondWithResult(_0x416158,_0x19deb1){_0x19deb1=_0x19deb1||0xc8;return function(_0x8aef1b){if(_0x8aef1b){return _0x416158[_0x6e62('0x1d')](_0x19deb1)[_0x6e62('0x1e')](_0x8aef1b);}};}function respondWithFilteredResult(_0x31b304,_0x42c2ea){return function(_0x45d7ee){if(_0x45d7ee){var _0x474e58=_0x45d7ee[_0x6e62('0x1f')],_0x15bce5=_0x42c2ea['offset'],_0x50c535=_0x42c2ea[_0x6e62('0x20')]+_0x42c2ea['limit'],_0x1f5ee7;if(_0x50c535>=_0x474e58){_0x50c535=_0x474e58;_0x1f5ee7=0xc8;}else{_0x1f5ee7=0xce;}_0x31b304[_0x6e62('0x1d')](_0x1f5ee7);return _0x31b304[_0x6e62('0x21')](_0x6e62('0x22'),_0x15bce5+'-'+_0x50c535+'/'+_0x474e58)[_0x6e62('0x1e')](_0x45d7ee);}return null;};}function patchUpdates(_0x2b6741){return function(_0x77c5f9){try{jsonpatch[_0x6e62('0x23')](_0x77c5f9,_0x2b6741,!![]);}catch(_0x263c47){return BPromise[_0x6e62('0x24')](_0x263c47);}return _0x77c5f9[_0x6e62('0x25')]();};}function saveUpdates(_0x1954dc,_0x4dc760){return function(_0x41821a){if(_0x41821a){return _0x41821a['update'](_0x1954dc)[_0x6e62('0x26')](function(_0x3dad96){return _0x3dad96;});}return null;};}function removeEntity(_0x345af8,_0x40d498){return function(_0x461eae){if(_0x461eae){return _0x461eae[_0x6e62('0x27')]()[_0x6e62('0x26')](function(){var _0x3a1683=_0x461eae[_0x6e62('0x28')]({'plain':!![]});var _0x448691='VoicePrefixes';return db[_0x6e62('0x29')]['destroy']({'where':{'type':_0x448691,'resourceId':_0x3a1683['id']}})[_0x6e62('0x26')](function(){return _0x461eae;});})[_0x6e62('0x26')](function(){_0x345af8[_0x6e62('0x1d')](0xcc)[_0x6e62('0x2a')]();});}};}function handleEntityNotFound(_0x3b7dfa,_0x3e7c90){return function(_0x4ecc45){if(!_0x4ecc45){_0x3b7dfa[_0x6e62('0x1c')](0x194);}return _0x4ecc45;};}function handleError(_0x26c991,_0x14cd51){_0x14cd51=_0x14cd51||0x1f4;return function(_0x50ba00){logger['error'](_0x50ba00[_0x6e62('0x2b')]);if(_0x50ba00['name']){delete _0x50ba00['name'];}_0x26c991['status'](_0x14cd51)['send'](_0x50ba00);};}exports[_0x6e62('0x2c')]=function(_0x4c6af1,_0x2d9172){var _0x5a8516={},_0x1dc29e={},_0x2fb5ce={'count':0x0,'rows':[]};var _0x2905d7=_['map'](db['VoicePrefix'][_0x6e62('0x2d')],function(_0xb8d42e){return{'name':_0xb8d42e['fieldName'],'type':_0xb8d42e['type']['key']};});_0x1dc29e[_0x6e62('0x2e')]=_['map'](_0x2905d7,_0x6e62('0x2f'));_0x1dc29e[_0x6e62('0x30')]=_[_0x6e62('0x31')](_0x4c6af1[_0x6e62('0x30')]);_0x1dc29e[_0x6e62('0x32')]=_['intersection'](_0x1dc29e['model'],_0x1dc29e[_0x6e62('0x30')]);_0x5a8516[_0x6e62('0x33')]=_[_0x6e62('0x34')](_0x1dc29e[_0x6e62('0x2e')],qs[_0x6e62('0x35')](_0x4c6af1[_0x6e62('0x30')][_0x6e62('0x35')]));_0x5a8516[_0x6e62('0x33')]=_0x5a8516[_0x6e62('0x33')]['length']?_0x5a8516[_0x6e62('0x33')]:_0x1dc29e[_0x6e62('0x2e')];if(!_0x4c6af1[_0x6e62('0x30')]['hasOwnProperty'](_0x6e62('0x36'))){_0x5a8516[_0x6e62('0x37')]=qs['limit'](_0x4c6af1[_0x6e62('0x30')][_0x6e62('0x37')]);_0x5a8516[_0x6e62('0x20')]=qs[_0x6e62('0x20')](_0x4c6af1[_0x6e62('0x30')]['offset']);}_0x5a8516[_0x6e62('0x38')]=qs[_0x6e62('0x39')](_0x4c6af1[_0x6e62('0x30')][_0x6e62('0x39')]);_0x5a8516[_0x6e62('0x3a')]=qs['filters'](_[_0x6e62('0x3b')](_0x4c6af1[_0x6e62('0x30')],_0x1dc29e[_0x6e62('0x32')]),_0x2905d7);if(_0x4c6af1['query'][_0x6e62('0x3c')]){_0x5a8516[_0x6e62('0x3a')]=_['merge'](_0x5a8516['where'],{'$or':_[_0x6e62('0x3d')](_0x2905d7,function(_0x1c2ee1){if(_0x1c2ee1[_0x6e62('0x3e')]!=='VIRTUAL'){var _0x5133a2={};_0x5133a2[_0x1c2ee1[_0x6e62('0x2f')]]={'$like':'%'+_0x4c6af1['query']['filter']+'%'};return _0x5133a2;}})});}_0x5a8516=_[_0x6e62('0x3f')]({},_0x5a8516,_0x4c6af1[_0x6e62('0x40')]);var _0xd07973={'where':_0x5a8516[_0x6e62('0x3a')]};return db[_0x6e62('0x41')]['count'](_0xd07973)[_0x6e62('0x26')](function(_0x4c5431){_0x2fb5ce['count']=_0x4c5431;if(_0x4c6af1[_0x6e62('0x30')][_0x6e62('0x42')]){_0x5a8516[_0x6e62('0x43')]=[{'all':!![]}];}return db['VoicePrefix'][_0x6e62('0x44')](_0x5a8516);})['then'](function(_0x28bf71){_0x2fb5ce[_0x6e62('0x45')]=_0x28bf71;return _0x2fb5ce;})[_0x6e62('0x26')](respondWithFilteredResult(_0x2d9172,_0x5a8516))[_0x6e62('0x46')](handleError(_0x2d9172,null));};exports[_0x6e62('0x47')]=function(_0x10c524,_0x228519){var _0x77b70={'raw':![],'where':{'id':_0x10c524[_0x6e62('0x48')]['id']}},_0x3888bf={};_0x3888bf['model']=_['keys'](db['VoicePrefix'][_0x6e62('0x2d')]);_0x3888bf['query']=_[_0x6e62('0x31')](_0x10c524[_0x6e62('0x30')]);_0x3888bf['filters']=_[_0x6e62('0x34')](_0x3888bf[_0x6e62('0x2e')],_0x3888bf[_0x6e62('0x30')]);_0x77b70[_0x6e62('0x33')]=_[_0x6e62('0x34')](_0x3888bf[_0x6e62('0x2e')],qs[_0x6e62('0x35')](_0x10c524[_0x6e62('0x30')][_0x6e62('0x35')]));_0x77b70[_0x6e62('0x33')]=_0x77b70[_0x6e62('0x33')][_0x6e62('0x49')]?_0x77b70[_0x6e62('0x33')]:_0x3888bf['model'];if(_0x10c524[_0x6e62('0x30')][_0x6e62('0x42')]){_0x77b70['include']=[{'all':!![]}];}_0x77b70=_[_0x6e62('0x3f')]({},_0x77b70,_0x10c524['options']);return db[_0x6e62('0x41')][_0x6e62('0x4a')](_0x77b70)[_0x6e62('0x26')](handleEntityNotFound(_0x228519,null))['then'](respondWithResult(_0x228519,null))[_0x6e62('0x46')](handleError(_0x228519,null));};exports[_0x6e62('0x27')]=function(_0x2d32f8,_0x212290){return db[_0x6e62('0x41')][_0x6e62('0x4a')]({'where':{'id':_0x2d32f8[_0x6e62('0x48')]['id']}})[_0x6e62('0x26')](handleEntityNotFound(_0x212290,null))[_0x6e62('0x26')](removeEntity(_0x212290,null))[_0x6e62('0x46')](handleError(_0x212290,null));};exports[_0x6e62('0x4b')]=function(_0x5613a0,_0x4a009d){return db[_0x6e62('0x41')][_0x6e62('0x4b')]()[_0x6e62('0x26')](respondWithResult(_0x4a009d,null))[_0x6e62('0x46')](handleError(_0x4a009d,null));};exports[_0x6e62('0x4c')]=function(_0x34108f,_0x5b474f){var _0x19a7e9;return db['sequelize'][_0x6e62('0x4d')](function(_0xead50c){return db[_0x6e62('0x41')][_0x6e62('0x4c')](_0x34108f[_0x6e62('0x4e')],{'transaction':_0xead50c})['then'](function(_0x353346){_0x19a7e9=_0x353346[_0x6e62('0x28')]({'plain':!![]});return db[_0x6e62('0x4f')][_0x6e62('0x4a')]({'where':{'id':_0x19a7e9['VoiceExtensionId']},'raw':!![]})[_0x6e62('0x26')](function(_0x479728){return createVoicePrefixExtensions(_0x19a7e9,_0x479728,_0xead50c);});});})[_0x6e62('0x26')](function(){var _0x213bf3=_0x34108f[_0x6e62('0x50')][_0x6e62('0x28')]({'plain':!![]});if(!_0x213bf3)throw new Error(_0x6e62('0x51'));if(_0x213bf3[_0x6e62('0x52')]===_0x6e62('0x50')){var _0x520ca5=_0x19a7e9;return db[_0x6e62('0x53')]['find']({'where':{'name':_0x6e62('0x54'),'userProfileId':_0x213bf3[_0x6e62('0x55')]},'raw':!![]})[_0x6e62('0x26')](function(_0x3d5b60){if(_0x3d5b60&&_0x3d5b60[_0x6e62('0x56')]===0x0){return db['UserProfileResource'][_0x6e62('0x4c')]({'name':_0x520ca5['name'],'resourceId':_0x520ca5['id'],'type':_0x3d5b60[_0x6e62('0x2f')],'sectionId':_0x3d5b60['id']},{})[_0x6e62('0x26')](function(){return _0x19a7e9;});}else{return _0x19a7e9;}})[_0x6e62('0x46')](function(_0x4e03e4){logger[_0x6e62('0x57')](_0x6e62('0x58'),_0x4e03e4);throw _0x4e03e4;});}return _0x19a7e9;})['then'](respondWithResult(_0x5b474f,null))[_0x6e62('0x46')](handleError(_0x5b474f,null));};function Extension(_0x56be92,_0x3de583,_0x5bf3ef,_0x1da279){this[_0x6e62('0x59')]='from-sip';this[_0x6e62('0x5a')]=_0x56be92;this[_0x6e62('0x5b')]=_0x5bf3ef;this['type']='system';this[_0x6e62('0x5c')]=_0x6e62('0x5d');this[_0x6e62('0x5e')]=_0x3de583;this[_0x6e62('0x5f')]=_0x1da279;}function createVoicePrefixExtensions(_0x171686,_0x1eb6e8,_0x21b99c){return new BPromise(function(_0x50bd9c,_0x932d39){var _0x10e546=new Extension(formatPrefixName(_0x171686[_0x6e62('0x60')]),0x1,_0x6e62('0x61'),_0x6e62('0x62'));_0x10e546['VoicePrefixId']=_0x171686['id'];return db[_0x6e62('0x4f')][_0x6e62('0x4c')](_0x10e546,{'transaction':_0x21b99c})['then'](function(_0x5aeefe){var _0x52803c=_0x5aeefe[_0x6e62('0x28')]({'plain':!![]});var _0x2656cd=_[_0x6e62('0x3d')](addVoicePrefixExtensions(_0x171686,_0x1eb6e8),function(_0x4d62d8){_0x4d62d8[_0x6e62('0x63')]=_0x52803c['id'];_0x4d62d8[_0x6e62('0x64')]=_0x171686['id'];return _0x4d62d8;});return db[_0x6e62('0x4f')]['bulkCreate'](_0x2656cd,{'transaction':_0x21b99c})[_0x6e62('0x26')](function(_0x2dc0a7){if(!_0x2dc0a7){return _0x932d39('Extensions\x20creation\x20failed');}else{return _0x50bd9c(_0x2dc0a7);}})[_0x6e62('0x46')](function(_0x5b5b66){return _0x932d39(_0x5b5b66);});});;});};function addVoicePrefixExtensions(_0x29b290,_0xb22e54){var _0xb465=[];var _0x5db78e=formatPrefixName(_0x29b290['prefix']);_0xb465[_0x6e62('0x65')](new Extension(_0x5db78e,0x2,_0x6e62('0x66'),_0x6e62('0x67')+_0x29b290[_0x6e62('0x2f')]));if(_0x29b290[_0x6e62('0x68')]){_0xb465[_0x6e62('0x65')](new Extension(_0x5db78e,0x3,_0x6e62('0x66'),_0x6e62('0x69')+_0x29b290['callerIdAll']));}else{_0xb465[_0x6e62('0x65')](new Extension(_0x5db78e,0x3,_0x6e62('0x61'),'No\x20callerid\x20available'));}_0xb465[_0x6e62('0x65')](new Extension(_0x5db78e,0x4,'goto',_0xb22e54[_0x6e62('0x59')]+','+_0x6e62('0x6a')+(0x8+_0x29b290[_0x6e62('0x2f')][_0x6e62('0x49')])+'}'+','+0x1));return _0xb465;}function formatPrefixName(_0x5bbea0){var _0x597a20='_';for(var _0x1c4c3c=0x0;_0x1c4c3c<_0x5bbea0[_0x6e62('0x49')];_0x1c4c3c++){if(_0x5bbea0[_0x6e62('0x6b')](_0x1c4c3c)=='-'){_0x597a20+=_0x5bbea0[_0x6e62('0x6b')](_0x1c4c3c);}else{_0x597a20+='['+_0x5bbea0[_0x6e62('0x6b')](_0x1c4c3c)+']';}}_0x597a20+='.';return _0x597a20;}exports[_0x6e62('0x6c')]=function(_0x46bbff,_0x3b5d98,_0x5dfadc){var _0x1785bc=_0x46bbff[_0x6e62('0x4e')];_0x1785bc[_0x6e62('0x60')]=_0x6e62('0x6d')+_0x1785bc[_0x6e62('0x2f')]+'-';return db[_0x6e62('0x6e')][_0x6e62('0x4d')](function(_0x37816e){return db[_0x6e62('0x41')]['update'](_0x1785bc,{'where':{'id':_0x1785bc['id']},'transaction':_0x37816e})[_0x6e62('0x26')](function(){return db[_0x6e62('0x4f')][_0x6e62('0x27')]({'where':{'VoicePrefixId':_0x1785bc['id']},'transaction':_0x37816e})[_0x6e62('0x26')](function(){return db[_0x6e62('0x4f')][_0x6e62('0x4a')]({'where':{'id':_0x1785bc[_0x6e62('0x63')]},'raw':!![]})[_0x6e62('0x26')](function(_0x10ffe9){return createVoicePrefixExtensions(_0x1785bc,_0x10ffe9,_0x37816e);});});});})[_0x6e62('0x26')](function(){return db[_0x6e62('0x41')][_0x6e62('0x6f')](_0x1785bc['id']);})[_0x6e62('0x26')](respondWithResult(_0x3b5d98,null))[_0x6e62('0x46')](handleError(_0x3b5d98,null));};exports[_0x6e62('0x70')]=function(_0x242a62,_0x416ab1,_0x502eca){return db[_0x6e62('0x41')][_0x6e62('0x4a')]({'where':{'id':_0x242a62[_0x6e62('0x48')]['id']}})[_0x6e62('0x26')](handleEntityNotFound(_0x416ab1,null))['then'](function(_0x66aa19){if(_0x66aa19){return _0x66aa19[_0x6e62('0x70')](_0x242a62[_0x6e62('0x4e')]['ids'],_[_0x6e62('0x71')](_0x242a62[_0x6e62('0x4e')],[_0x6e62('0x72'),'id'])||{})[_0x6e62('0x73')](function(_0x5944e4){for(var _0x6a2c3a=0x0;_0x6a2c3a<_0x242a62[_0x6e62('0x4e')][_0x6e62('0x72')][_0x6e62('0x49')];_0x6a2c3a+=0x1){socket[_0x6e62('0x74')](_0x6e62('0x75'),{'UserId':_0x242a62[_0x6e62('0x4e')][_0x6e62('0x72')][_0x6a2c3a],'VoicePrefixId':_0x242a62[_0x6e62('0x48')]['id']});}return _0x5944e4;});}})[_0x6e62('0x26')](respondWithResult(_0x416ab1,null))[_0x6e62('0x46')](handleError(_0x416ab1,null));};exports[_0x6e62('0x76')]=function(_0x1cd07e,_0x1c65ff,_0x5132be){return db[_0x6e62('0x41')][_0x6e62('0x4a')]({'where':{'id':_0x1cd07e[_0x6e62('0x48')]['id']}})[_0x6e62('0x26')](handleEntityNotFound(_0x1c65ff,null))[_0x6e62('0x26')](function(_0x26a242){if(_0x26a242){return _0x26a242[_0x6e62('0x76')](_0x1cd07e[_0x6e62('0x30')]['ids'])[_0x6e62('0x26')](function(){if(_[_0x6e62('0x77')](_0x1cd07e[_0x6e62('0x30')][_0x6e62('0x72')])){for(var _0x1f91fe=0x0;_0x1f91fe<_0x1cd07e[_0x6e62('0x30')][_0x6e62('0x72')]['length'];_0x1f91fe+=0x1){socket[_0x6e62('0x74')](_0x6e62('0x78'),{'UserId':Number(_0x1cd07e[_0x6e62('0x30')][_0x6e62('0x72')][_0x1f91fe]),'VoicePrefixId':Number(_0x1cd07e[_0x6e62('0x48')]['id'])});}}else{socket[_0x6e62('0x74')](_0x6e62('0x78'),{'UserId':Number(_0x1cd07e[_0x6e62('0x30')][_0x6e62('0x72')]),'VoicePrefixId':Number(_0x1cd07e[_0x6e62('0x48')]['id'])});}});}})[_0x6e62('0x26')](respondWithStatusCode(_0x1c65ff,null))[_0x6e62('0x46')](handleError(_0x1c65ff,null));};exports[_0x6e62('0x79')]=function(_0xa7fd55,_0x3b5371,_0x318ffa){var _0x4577c0={};var _0x46f419={};var _0x4cfd7b;var _0x349d64;return db[_0x6e62('0x41')][_0x6e62('0x7a')]({'where':{'id':_0xa7fd55[_0x6e62('0x48')]['id']}})[_0x6e62('0x26')](handleEntityNotFound(_0x3b5371,null))[_0x6e62('0x26')](function(_0x494bb4){if(_0x494bb4){_0x4cfd7b=_0x494bb4;_0x46f419[_0x6e62('0x2e')]=_[_0x6e62('0x31')](db['User'][_0x6e62('0x2d')]);_0x46f419['query']=_['keys'](_0xa7fd55[_0x6e62('0x30')]);_0x46f419[_0x6e62('0x32')]=_[_0x6e62('0x34')](_0x46f419[_0x6e62('0x2e')],_0x46f419['query']);_0x4577c0[_0x6e62('0x33')]=_[_0x6e62('0x34')](_0x46f419[_0x6e62('0x2e')],qs[_0x6e62('0x35')](_0xa7fd55['query'][_0x6e62('0x35')]));_0x4577c0[_0x6e62('0x33')]=_0x4577c0[_0x6e62('0x33')]['length']?_0x4577c0[_0x6e62('0x33')]:_0x46f419['model'];_0x4577c0['order']=qs[_0x6e62('0x39')](_0xa7fd55[_0x6e62('0x30')][_0x6e62('0x39')]);_0x4577c0['where']=qs['filters'](_[_0x6e62('0x3b')](_0xa7fd55[_0x6e62('0x30')],_0x46f419[_0x6e62('0x32')]));if(_0xa7fd55[_0x6e62('0x30')][_0x6e62('0x3c')]){_0x4577c0['where']=_[_0x6e62('0x3f')](_0x4577c0[_0x6e62('0x3a')],{'$or':_[_0x6e62('0x3d')](_0x4577c0[_0x6e62('0x33')],function(_0x5cc806){var _0x48e7b7={};_0x48e7b7[_0x5cc806]={'$like':'%'+_0xa7fd55[_0x6e62('0x30')][_0x6e62('0x3c')]+'%'};return _0x48e7b7;})});}_0x4577c0=_['merge']({},_0x4577c0,_0xa7fd55['options']);return _0x4cfd7b[_0x6e62('0x79')](_0x4577c0);}})[_0x6e62('0x26')](function(_0x346cd6){if(_0x346cd6){_0x349d64=_0x346cd6[_0x6e62('0x49')];if(!_0xa7fd55[_0x6e62('0x30')][_0x6e62('0x7b')](_0x6e62('0x36'))){_0x4577c0[_0x6e62('0x37')]=qs[_0x6e62('0x37')](_0xa7fd55['query'][_0x6e62('0x37')]);_0x4577c0[_0x6e62('0x20')]=qs[_0x6e62('0x20')](_0xa7fd55['query'][_0x6e62('0x20')]);}return _0x4cfd7b['getAgents'](_0x4577c0);}})[_0x6e62('0x26')](function(_0x258314){if(_0x258314){return _0x258314?{'count':_0x349d64,'rows':_0x258314}:null;}})['then'](respondWithResult(_0x3b5371,null))[_0x6e62('0x46')](handleError(_0x3b5371,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 26d7eca..f8c8e05 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 _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','VoicePrefix','setMaxListeners'];(function(_0x9c4706,_0x170f3f){var _0x5f534e=function(_0x2b060c){while(--_0x2b060c){_0x9c4706['push'](_0x9c4706['shift']());}};_0x5f534e(++_0x170f3f);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x49c4('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){VoicePrefixEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);VoicePrefixEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];VoicePrefix[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','VoicePrefix','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x2ca8c5,_0x4520fc){_0x2ca8c5=_0x2ca8c5-0x0;var _0x4d5513=_0x3e74[_0x2ca8c5];return _0x4d5513;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x43e7('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){VoicePrefixEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);VoicePrefixEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index cdcf6b3..d50af3a 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 _0x49a8=['./voicePrefix.attributes','exports','define','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5f519b,_0x5b606f){var _0x2461e2=function(_0x510241){while(--_0x510241){_0x5f519b['push'](_0x5f519b['shift']());}};_0x2461e2(++_0x5b606f);}(_0x49a8,0xfb));var _0x849a=function(_0x12ea76,_0x22200d){_0x12ea76=_0x12ea76-0x0;var _0x106615=_0x49a8[_0x12ea76];return _0x106615;};'use strict';var _=require(_0x849a('0x0'));var util=require(_0x849a('0x1'));var logger=require(_0x849a('0x2'))(_0x849a('0x3'));var moment=require(_0x849a('0x4'));var BPromise=require(_0x849a('0x5'));var rp=require(_0x849a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x849a('0x7'));var config=require(_0x849a('0x8'));var attributes=require(_0x849a('0x9'));module[_0x849a('0xa')]=function(_0x43f518,_0x54ae10){return _0x43f518[_0x849a('0xb')]('VoicePrefix',attributes,{'tableName':_0x849a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbebf=['moment','bluebird','request-promise','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','lodash','util','../../config/logger','api'];(function(_0x568a06,_0x173c72){var _0x4346a4=function(_0x535eed){while(--_0x535eed){_0x568a06['push'](_0x568a06['shift']());}};_0x4346a4(++_0x173c72);}(_0xbebf,0xa4));var _0xfbeb=function(_0x4d353b,_0x57e42b){_0x4d353b=_0x4d353b-0x0;var _0x3bf754=_0xbebf[_0x4d353b];return _0x3bf754;};'use strict';var _=require(_0xfbeb('0x0'));var util=require(_0xfbeb('0x1'));var logger=require(_0xfbeb('0x2'))(_0xfbeb('0x3'));var moment=require(_0xfbeb('0x4'));var BPromise=require(_0xfbeb('0x5'));var rp=require(_0xfbeb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfbeb('0x7'));var attributes=require(_0xfbeb('0x8'));module[_0xfbeb('0x9')]=function(_0x10e42a,_0x32627b){return _0x10e42a[_0xfbeb('0xa')](_0xfbeb('0xb'),attributes,{'tableName':'voice_prefixes','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 cf8186b..4a126df 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 _0xe3ac=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x419eac,_0x17ca10){var _0x55dda6=function(_0x2d9fd1){while(--_0x2d9fd1){_0x419eac['push'](_0x419eac['shift']());}};_0x55dda6(++_0x17ca10);}(_0xe3ac,0x1ec));var _0xce3a=function(_0x1c6a3a,_0x17a2e5){_0x1c6a3a=_0x1c6a3a-0x0;var _0x92c944=_0xe3ac[_0x1c6a3a];return _0x92c944;};'use strict';var _=require(_0xce3a('0x0'));var util=require(_0xce3a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xce3a('0x2'));var fs=require('fs');var Redis=require(_0xce3a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xce3a('0x4'));var logger=require(_0xce3a('0x5'))(_0xce3a('0x6'));var config=require(_0xce3a('0x7'));var jayson=require(_0xce3a('0x8'));var client=jayson[_0xce3a('0x9')][_0xce3a('0xa')]({'port':0x232a});config[_0xce3a('0xb')]=_[_0xce3a('0xc')](config[_0xce3a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xce3a('0xd'))(new Redis(config[_0xce3a('0xb')]));require('./voicePrefix.socket')[_0xce3a('0xe')](socket);function respondWithRpcPromise(_0x599c2b,_0x2ae333,_0xa02c65){return new BPromise(function(_0x4687c5,_0x69fbba){return client['request'](_0x599c2b,_0xa02c65)[_0xce3a('0xf')](function(_0x283b26){logger[_0xce3a('0x10')](_0xce3a('0x11'),_0x2ae333,_0xce3a('0x12'));logger[_0xce3a('0x13')](_0xce3a('0x14'),_0x2ae333,_0xce3a('0x12'),JSON[_0xce3a('0x15')](_0x283b26));if(_0x283b26['error']){if(_0x283b26[_0xce3a('0x16')][_0xce3a('0x17')]===0x1f4){logger[_0xce3a('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x2ae333,_0x283b26['error'][_0xce3a('0x18')]);return _0x69fbba(_0x283b26[_0xce3a('0x16')][_0xce3a('0x18')]);}logger['error'](_0xce3a('0x11'),_0x2ae333,_0x283b26[_0xce3a('0x16')]['message']);return _0x4687c5(_0x283b26['error'][_0xce3a('0x18')]);}else{logger[_0xce3a('0x10')](_0xce3a('0x11'),_0x2ae333,_0xce3a('0x12'));_0x4687c5(_0x283b26[_0xce3a('0x19')][_0xce3a('0x18')]);}})['catch'](function(_0x107c48){logger[_0xce3a('0x16')](_0xce3a('0x11'),_0x2ae333,_0x107c48);_0x69fbba(_0x107c48);});});} \ No newline at end of file +var _0x8c47=['request\x20sent','debug','stringify','error','code','message','info','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x8c47,0xc5));var _0x78c4=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x8c47[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0x78c4('0x0'));var util=require('util');var moment=require(_0x78c4('0x1'));var BPromise=require('bluebird');var rs=require(_0x78c4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78c4('0x3'))['db'];var utils=require(_0x78c4('0x4'));var logger=require(_0x78c4('0x5'))(_0x78c4('0x6'));var config=require(_0x78c4('0x7'));var jayson=require(_0x78c4('0x8'));var client=jayson[_0x78c4('0x9')]['http']({'port':0x232a});config['redis']=_[_0x78c4('0xa')](config[_0x78c4('0xb')],{'host':_0x78c4('0xc'),'port':0x18eb});var socket=require(_0x78c4('0xd'))(new Redis(config[_0x78c4('0xb')]));require(_0x78c4('0xe'))[_0x78c4('0xf')](socket);function respondWithRpcPromise(_0x2f466f,_0xe6a8b4,_0x431595){return new BPromise(function(_0x51fe54,_0x20b705){return client[_0x78c4('0x10')](_0x2f466f,_0x431595)[_0x78c4('0x11')](function(_0x1c498c){logger['info'](_0x78c4('0x12'),_0xe6a8b4,_0x78c4('0x13'));logger[_0x78c4('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0xe6a8b4,_0x78c4('0x13'),JSON[_0x78c4('0x15')](_0x1c498c));if(_0x1c498c[_0x78c4('0x16')]){if(_0x1c498c[_0x78c4('0x16')][_0x78c4('0x17')]===0x1f4){logger[_0x78c4('0x16')]('VoicePrefix,\x20%s,\x20%s',_0xe6a8b4,_0x1c498c['error'][_0x78c4('0x18')]);return _0x20b705(_0x1c498c['error']['message']);}logger[_0x78c4('0x16')](_0x78c4('0x12'),_0xe6a8b4,_0x1c498c[_0x78c4('0x16')][_0x78c4('0x18')]);return _0x51fe54(_0x1c498c[_0x78c4('0x16')][_0x78c4('0x18')]);}else{logger[_0x78c4('0x19')](_0x78c4('0x12'),_0xe6a8b4,_0x78c4('0x13'));_0x51fe54(_0x1c498c[_0x78c4('0x1a')][_0x78c4('0x18')]);}})['catch'](function(_0x533ad1){logger[_0x78c4('0x16')](_0x78c4('0x12'),_0xe6a8b4,_0x533ad1);_0x20b705(_0x533ad1);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index a1179bd..7fa4736 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 _0x16c2=['./voicePrefix.events','remove','emit','register','length'];(function(_0x323b0c,_0x28bb28){var _0x3b5b8b=function(_0x55069c){while(--_0x55069c){_0x323b0c['push'](_0x323b0c['shift']());}};_0x3b5b8b(++_0x28bb28);}(_0x16c2,0xeb));var _0x216c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x16c2[_0x14add3];return _0x4a174f;};'use strict';var VoicePrefixEvents=require(_0x216c('0x0'));var events=['save',_0x216c('0x1'),'update'];function createListener(_0x68518f,_0x37d112){return function(_0x2e0e08){_0x37d112[_0x216c('0x2')](_0x68518f,_0x2e0e08);};}function removeListener(_0x4571dd,_0x3c7973){return function(){VoicePrefixEvents['removeListener'](_0x4571dd,_0x3c7973);};}exports[_0x216c('0x3')]=function(_0x5ed94d){for(var _0xf37767=0x0,_0x1817ff=events[_0x216c('0x4')];_0xf37767<_0x1817ff;_0xf37767++){var _0x4f8360=events[_0xf37767];var _0x4d64ba=createListener('voicePrefix:'+_0x4f8360,_0x5ed94d);VoicePrefixEvents['on'](_0x4f8360,_0x4d64ba);}}; \ No newline at end of file +var _0xf5e8=['update','removeListener','register','length','voicePrefix:','./voicePrefix.events','save'];(function(_0x5e8d3e,_0x18ed2e){var _0x1348c0=function(_0x5a889f){while(--_0x5a889f){_0x5e8d3e['push'](_0x5e8d3e['shift']());}};_0x1348c0(++_0x18ed2e);}(_0xf5e8,0xd0));var _0x8f5e=function(_0x310d10,_0x3fe887){_0x310d10=_0x310d10-0x0;var _0x1fb8af=_0xf5e8[_0x310d10];return _0x1fb8af;};'use strict';var VoicePrefixEvents=require(_0x8f5e('0x0'));var events=[_0x8f5e('0x1'),'remove',_0x8f5e('0x2')];function createListener(_0x8d7e4e,_0x13a381){return function(_0xede87c){_0x13a381['emit'](_0x8d7e4e,_0xede87c);};}function removeListener(_0x53951d,_0xec1d5a){return function(){VoicePrefixEvents[_0x8f5e('0x3')](_0x53951d,_0xec1d5a);};}exports[_0x8f5e('0x4')]=function(_0x1abdcb){for(var _0x454386=0x0,_0x4a9bbb=events[_0x8f5e('0x5')];_0x454386<_0x4a9bbb;_0x454386++){var _0x3b204e=events[_0x454386];var _0x3ffe36=createListener(_0x8f5e('0x6')+_0x3b204e,_0x1abdcb);VoicePrefixEvents['on'](_0x3b204e,_0x3ffe36);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 87332b6..bff259d 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 _0xb9bf=['getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','delete','destroy','removeTeams','/:id/lists','removeLists','removeBlackLists','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get','isAuthenticated','/:id','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','/:id/members','getMembers','getLists'];(function(_0x351d10,_0x3329e4){var _0x2b2c3e=function(_0x15b32){while(--_0x15b32){_0x351d10['push'](_0x351d10['shift']());}};_0x2b2c3e(++_0x3329e4);}(_0xb9bf,0x163));var _0xfb9b=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xb9bf[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require(_0xfb9b('0x0'));var path=require(_0xfb9b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfb9b('0x2')]();var auth=require(_0xfb9b('0x3'));var interaction=require(_0xfb9b('0x4'));var config=require('../../config/environment');var controller=require(_0xfb9b('0x5'));router[_0xfb9b('0x6')]('/',auth[_0xfb9b('0x7')](),controller['index']);router[_0xfb9b('0x6')](_0xfb9b('0x8'),auth[_0xfb9b('0x7')](),controller['show']);router[_0xfb9b('0x6')]('/:id/hoppers',auth[_0xfb9b('0x7')](),controller['getHoppers']);router[_0xfb9b('0x6')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0xfb9b('0x9')]);router[_0xfb9b('0x6')](_0xfb9b('0xa'),auth[_0xfb9b('0x7')](),controller[_0xfb9b('0xb')]);router[_0xfb9b('0x6')](_0xfb9b('0xc'),auth[_0xfb9b('0x7')](),controller[_0xfb9b('0xd')]);router[_0xfb9b('0x6')](_0xfb9b('0xe'),auth[_0xfb9b('0x7')](),controller['getTeams']);router[_0xfb9b('0x6')](_0xfb9b('0xf'),auth[_0xfb9b('0x7')](),controller['getAgents']);router[_0xfb9b('0x6')](_0xfb9b('0x10'),auth[_0xfb9b('0x7')](),controller[_0xfb9b('0x11')]);router[_0xfb9b('0x6')]('/:id/lists',auth[_0xfb9b('0x7')](),controller[_0xfb9b('0x12')]);router['get']('/:id/blacklists',auth[_0xfb9b('0x7')](),controller[_0xfb9b('0x13')]);router[_0xfb9b('0x14')]('/',auth[_0xfb9b('0x7')](),controller[_0xfb9b('0x15')]);router[_0xfb9b('0x14')](_0xfb9b('0x16'),auth['isAuthenticated'](),controller[_0xfb9b('0x17')]);router[_0xfb9b('0x14')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0xfb9b('0x14')](_0xfb9b('0xf'),auth[_0xfb9b('0x7')](),controller['addAgents']);router[_0xfb9b('0x14')]('/:id/lists',auth[_0xfb9b('0x7')](),controller[_0xfb9b('0x18')]);router[_0xfb9b('0x14')](_0xfb9b('0x19'),auth[_0xfb9b('0x7')](),controller[_0xfb9b('0x1a')]);router['put'](_0xfb9b('0x8'),auth[_0xfb9b('0x7')](),controller['update']);router[_0xfb9b('0x1b')](_0xfb9b('0x8'),auth[_0xfb9b('0x7')](),controller[_0xfb9b('0x1c')]);router[_0xfb9b('0x1b')](_0xfb9b('0xe'),auth[_0xfb9b('0x7')](),controller[_0xfb9b('0x1d')]);router[_0xfb9b('0x1b')](_0xfb9b('0xf'),auth[_0xfb9b('0x7')](),controller['removeAgents']);router['delete'](_0xfb9b('0x1e'),auth[_0xfb9b('0x7')](),controller[_0xfb9b('0x1f')]);router[_0xfb9b('0x1b')](_0xfb9b('0x19'),auth[_0xfb9b('0x7')](),controller[_0xfb9b('0x20')]);module[_0xfb9b('0x21')]=router; \ No newline at end of file +var _0x4eb9=['/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','getMembers','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','update','delete','destroy','removeTeams','removeLists','removeBlackLists','exports','multer','util','express','Router','../../components/auth/service','isAuthenticated','index','/:id','show','get'];(function(_0x3dff4c,_0x15805c){var _0x480e99=function(_0x4e8bbc){while(--_0x4e8bbc){_0x3dff4c['push'](_0x3dff4c['shift']());}};_0x480e99(++_0x15805c);}(_0x4eb9,0x14c));var _0x94eb=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x4eb9[_0x16d10f];return _0x50c823;};'use strict';var multer=require(_0x94eb('0x0'));var util=require(_0x94eb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x94eb('0x2'));var router=express[_0x94eb('0x3')]();var auth=require(_0x94eb('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceQueue.controller');router['get']('/',auth[_0x94eb('0x5')](),controller[_0x94eb('0x6')]);router['get'](_0x94eb('0x7'),auth['isAuthenticated'](),controller[_0x94eb('0x8')]);router[_0x94eb('0x9')](_0x94eb('0xa'),auth[_0x94eb('0x5')](),controller[_0x94eb('0xb')]);router[_0x94eb('0x9')](_0x94eb('0xc'),auth[_0x94eb('0x5')](),controller[_0x94eb('0xd')]);router['get'](_0x94eb('0xe'),auth[_0x94eb('0x5')](),controller['getHopperFinals']);router['get'](_0x94eb('0xf'),auth[_0x94eb('0x5')](),controller[_0x94eb('0x10')]);router[_0x94eb('0x9')](_0x94eb('0x11'),auth[_0x94eb('0x5')](),controller[_0x94eb('0x12')]);router[_0x94eb('0x9')](_0x94eb('0x13'),auth[_0x94eb('0x5')](),controller[_0x94eb('0x14')]);router[_0x94eb('0x9')]('/:id/members',auth[_0x94eb('0x5')](),controller[_0x94eb('0x15')]);router['get'](_0x94eb('0x16'),auth[_0x94eb('0x5')](),controller[_0x94eb('0x17')]);router[_0x94eb('0x9')]('/:id/blacklists',auth[_0x94eb('0x5')](),controller[_0x94eb('0x18')]);router[_0x94eb('0x19')]('/',auth[_0x94eb('0x5')](),controller[_0x94eb('0x1a')]);router[_0x94eb('0x19')](_0x94eb('0x1b'),auth[_0x94eb('0x5')](),controller[_0x94eb('0x1c')]);router[_0x94eb('0x19')](_0x94eb('0x11'),auth[_0x94eb('0x5')](),controller['addTeams']);router[_0x94eb('0x19')](_0x94eb('0x13'),auth[_0x94eb('0x5')](),controller['addAgents']);router[_0x94eb('0x19')](_0x94eb('0x16'),auth[_0x94eb('0x5')](),controller[_0x94eb('0x1d')]);router[_0x94eb('0x19')](_0x94eb('0x1e'),auth[_0x94eb('0x5')](),controller['addBlackLists']);router['put'](_0x94eb('0x7'),auth[_0x94eb('0x5')](),controller[_0x94eb('0x1f')]);router[_0x94eb('0x20')](_0x94eb('0x7'),auth[_0x94eb('0x5')](),controller[_0x94eb('0x21')]);router[_0x94eb('0x20')](_0x94eb('0x11'),auth[_0x94eb('0x5')](),controller[_0x94eb('0x22')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);router[_0x94eb('0x20')](_0x94eb('0x16'),auth['isAuthenticated'](),controller[_0x94eb('0x23')]);router[_0x94eb('0x20')](_0x94eb('0x1e'),auth['isAuthenticated'](),controller[_0x94eb('0x24')]);module[_0x94eb('0x25')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index da40c7b..66c4f94 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 _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','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\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)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','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)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x1ba57f,_0xb81938){var _0x5a7f02=function(_0x32b234){while(--_0x32b234){_0x1ba57f['push'](_0x1ba57f['shift']());}};_0x5a7f02(++_0xb81938);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','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\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)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','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)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x1401e1,_0xabb499){var _0x1aab56=function(_0x1071fd){while(--_0x1071fd){_0x1401e1['push'](_0x1401e1['shift']());}};_0x1aab56(++_0xabb499);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 07949ef..79e418e 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 _0xcb91=['field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','every','all','union','compact','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','omit','spread','userVoiceQueue:save','push','isArray','getAgents','getMembers','getLists','CmList','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','sendStatus','status','json','count','offset','limit','apply','save','update','then','destroy','get','inbound','QueueCampaigns','filter','ignore','map','value','includes','type','find','UserProfileResource','end','error','name','send','index','VoiceQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','rows','catch','show','params','length','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','outbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','role','UserProfileSection','getHoppers','findOne','VoiceQueueId','CmHopper','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','removeTeams','ids','select'];(function(_0x5709ba,_0x3351cd){var _0x5ae8a2=function(_0x3b9c8d){while(--_0x3b9c8d){_0x5709ba['push'](_0x5709ba['shift']());}};_0x5ae8a2(++_0x3351cd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0xcb91[_0x4c7935];return _0x30651d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');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('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var licenseUtil=require(_0x1cb9('0x15'));var db=require(_0x1cb9('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x1cb9('0x17'),'port':0x18eb});var socket=require(_0x1cb9('0x18'))(new Redis(config[_0x1cb9('0x19')]));require(_0x1cb9('0x1a'))['register'](socket);function respondWithStatusCode(_0x397727,_0x6ef389){_0x6ef389=_0x6ef389||0xcc;return function(_0x1b3cd7){if(_0x1b3cd7){return _0x397727[_0x1cb9('0x1b')](_0x6ef389);}return _0x397727[_0x1cb9('0x1c')](_0x6ef389)['end']();};}function respondWithResult(_0x5572cb,_0xd446a3){_0xd446a3=_0xd446a3||0xc8;return function(_0x3cc765){if(_0x3cc765){return _0x5572cb[_0x1cb9('0x1c')](_0xd446a3)[_0x1cb9('0x1d')](_0x3cc765);}};}function respondWithFilteredResult(_0x3e21e0,_0xf22920){return function(_0x23d3a9){if(_0x23d3a9){var _0x4e1340=_0x23d3a9[_0x1cb9('0x1e')],_0x479d43=_0xf22920[_0x1cb9('0x1f')],_0x1b2fa6=_0xf22920[_0x1cb9('0x1f')]+_0xf22920[_0x1cb9('0x20')],_0x41ac41;if(_0x1b2fa6>=_0x4e1340){_0x1b2fa6=_0x4e1340;_0x41ac41=0xc8;}else{_0x41ac41=0xce;}_0x3e21e0[_0x1cb9('0x1c')](_0x41ac41);return _0x3e21e0['set']('Content-Range',_0x479d43+'-'+_0x1b2fa6+'/'+_0x4e1340)[_0x1cb9('0x1d')](_0x23d3a9);}return null;};}function patchUpdates(_0x5dbfae){return function(_0x4750b1){try{jsonpatch[_0x1cb9('0x21')](_0x4750b1,_0x5dbfae,!![]);}catch(_0x523b26){return BPromise['reject'](_0x523b26);}return _0x4750b1[_0x1cb9('0x22')]();};}function saveUpdates(_0x325637,_0x103a63){return function(_0x4601b8){if(_0x4601b8){return _0x4601b8[_0x1cb9('0x23')](_0x325637)[_0x1cb9('0x24')](function(_0x59ebea){return _0x59ebea;});}return null;};}function removeEntity(_0x55b232,_0x6c6f61){return function(_0x557199){if(_0x557199){return _0x557199[_0x1cb9('0x25')]()[_0x1cb9('0x24')](function(){var _0x69b4c8=_0x557199[_0x1cb9('0x26')]({'plain':!![]});var _0x43a100=[{'name':'VoiceQueues','value':_0x1cb9('0x27'),'ignore':![]},{'name':_0x1cb9('0x28'),'value':'outbound','ignore':![]}];var _0xd6891c=_(_0x43a100)[_0x1cb9('0x29')](_0x1cb9('0x2a'))[_0x1cb9('0x2b')](_0x1cb9('0x2c'))[_0x1cb9('0x2c')]();if(_[_0x1cb9('0x2d')](_0xd6891c,_0x69b4c8[_0x1cb9('0x2e')])){return;}var _0x41e5c2=_[_0x1cb9('0x2f')](_0x43a100,['value',_0x69b4c8[_0x1cb9('0x2e')]])['name'];return db[_0x1cb9('0x30')]['destroy']({'where':{'type':_0x41e5c2,'resourceId':_0x69b4c8['id']}})[_0x1cb9('0x24')](function(){return _0x557199;});})[_0x1cb9('0x24')](function(){_0x55b232[_0x1cb9('0x1c')](0xcc)[_0x1cb9('0x31')]();});}};}function handleEntityNotFound(_0x561d89,_0x1c701f){return function(_0x4eba82){if(!_0x4eba82){_0x561d89[_0x1cb9('0x1b')](0x194);}return _0x4eba82;};}function handleError(_0x336a98,_0x4220d7){_0x4220d7=_0x4220d7||0x1f4;return function(_0x5d8793){logger[_0x1cb9('0x32')](_0x5d8793['stack']);if(_0x5d8793[_0x1cb9('0x33')]){delete _0x5d8793['name'];}_0x336a98[_0x1cb9('0x1c')](_0x4220d7)[_0x1cb9('0x34')](_0x5d8793);};}exports[_0x1cb9('0x35')]=function(_0xae910,_0x56c3e0){var _0x2114a4={},_0xf71b9a={},_0x3467d5={'count':0x0,'rows':[]};var _0x91a1db=_[_0x1cb9('0x2b')](db[_0x1cb9('0x36')][_0x1cb9('0x37')],function(_0x1ed5ad){return{'name':_0x1ed5ad[_0x1cb9('0x38')],'type':_0x1ed5ad[_0x1cb9('0x2e')][_0x1cb9('0x39')]};});_0xf71b9a[_0x1cb9('0x3a')]=_[_0x1cb9('0x2b')](_0x91a1db,'name');_0xf71b9a['query']=_[_0x1cb9('0x3b')](_0xae910[_0x1cb9('0x3c')]);_0xf71b9a[_0x1cb9('0x3d')]=_[_0x1cb9('0x3e')](_0xf71b9a[_0x1cb9('0x3a')],_0xf71b9a[_0x1cb9('0x3c')]);_0x2114a4[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0xf71b9a['model'],qs[_0x1cb9('0x40')](_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x40')]));_0x2114a4['attributes']=_0x2114a4[_0x1cb9('0x3f')]['length']?_0x2114a4[_0x1cb9('0x3f')]:_0xf71b9a['model'];if(!_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x41')](_0x1cb9('0x42'))){_0x2114a4[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x2114a4['offset']=qs['offset'](_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}_0x2114a4[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x44')]);_0x2114a4[_0x1cb9('0x45')]=qs['filters'](_[_0x1cb9('0x46')](_0xae910['query'],_0xf71b9a['filters']),_0x91a1db);if(_0xae910['query'][_0x1cb9('0x29')]){_0x2114a4[_0x1cb9('0x45')]=_[_0x1cb9('0x47')](_0x2114a4[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0x91a1db,function(_0x4f551f){if(_0x4f551f[_0x1cb9('0x2e')]!=='VIRTUAL'){var _0x91121={};_0x91121[_0x4f551f[_0x1cb9('0x33')]]={'$like':'%'+_0xae910[_0x1cb9('0x3c')]['filter']+'%'};return _0x91121;}})});}_0x2114a4=_[_0x1cb9('0x47')]({},_0x2114a4,_0xae910['options']);var _0xda1a44={'where':_0x2114a4[_0x1cb9('0x45')]};return db['VoiceQueue']['count'](_0xda1a44)[_0x1cb9('0x24')](function(_0x339829){_0x3467d5[_0x1cb9('0x1e')]=_0x339829;if(_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x48')]){_0x2114a4['include']=[{'all':!![]}];}return db[_0x1cb9('0x36')]['findAll'](_0x2114a4);})['then'](function(_0x495335){_0x3467d5[_0x1cb9('0x49')]=_0x495335;return _0x3467d5;})[_0x1cb9('0x24')](respondWithFilteredResult(_0x56c3e0,_0x2114a4))[_0x1cb9('0x4a')](handleError(_0x56c3e0,null));};exports[_0x1cb9('0x4b')]=function(_0x116c05,_0x2a8b7f){var _0x40ca68={'raw':![],'where':{'id':_0x116c05[_0x1cb9('0x4c')]['id']}},_0x409b89={};_0x409b89[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](db['VoiceQueue'][_0x1cb9('0x37')]);_0x409b89[_0x1cb9('0x3c')]=_[_0x1cb9('0x3b')](_0x116c05['query']);_0x409b89[_0x1cb9('0x3d')]=_[_0x1cb9('0x3e')](_0x409b89[_0x1cb9('0x3a')],_0x409b89[_0x1cb9('0x3c')]);_0x40ca68[_0x1cb9('0x3f')]=_['intersection'](_0x409b89[_0x1cb9('0x3a')],qs['fields'](_0x116c05[_0x1cb9('0x3c')]['fields']));_0x40ca68[_0x1cb9('0x3f')]=_0x40ca68[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x40ca68[_0x1cb9('0x3f')]:_0x409b89['model'];if(_0x116c05[_0x1cb9('0x3c')][_0x1cb9('0x48')]){_0x40ca68[_0x1cb9('0x4e')]=[{'all':!![]}];}_0x40ca68=_[_0x1cb9('0x47')]({},_0x40ca68,_0x116c05[_0x1cb9('0x4f')]);return db[_0x1cb9('0x36')][_0x1cb9('0x2f')](_0x40ca68)[_0x1cb9('0x24')](handleEntityNotFound(_0x2a8b7f,null))[_0x1cb9('0x24')](respondWithResult(_0x2a8b7f,null))[_0x1cb9('0x4a')](handleError(_0x2a8b7f,null));};exports['create']=function(_0x5092a6,_0x28c65d){return db[_0x1cb9('0x36')][_0x1cb9('0x50')](_0x5092a6[_0x1cb9('0x51')],{})[_0x1cb9('0x24')](function(_0x2d076b){var _0x367dd7=_0x5092a6[_0x1cb9('0x52')][_0x1cb9('0x26')]({'plain':!![]});if(!_0x367dd7)throw new Error(_0x1cb9('0x53'));if(_0x367dd7['role']===_0x1cb9('0x52')){var _0x5e773d=_0x2d076b[_0x1cb9('0x26')]({'plain':!![]});var _0x5201e8=[{'name':_0x1cb9('0x54'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x1cb9('0x55')}];var _0x3b0c2e=_[_0x1cb9('0x2f')](_0x5201e8,['value',_0x5e773d[_0x1cb9('0x2e')]])[_0x1cb9('0x33')];return db['UserProfileSection']['find']({'where':{'name':_0x3b0c2e,'userProfileId':_0x367dd7[_0x1cb9('0x56')]},'raw':!![]})[_0x1cb9('0x24')](function(_0x3e70fc){if(_0x3e70fc&&_0x3e70fc[_0x1cb9('0x57')]===0x0){return db[_0x1cb9('0x30')][_0x1cb9('0x50')]({'name':_0x5e773d[_0x1cb9('0x33')],'resourceId':_0x5e773d['id'],'type':_0x3e70fc['name'],'sectionId':_0x3e70fc['id']},{})[_0x1cb9('0x24')](function(){return _0x2d076b;});}else{return _0x2d076b;}})[_0x1cb9('0x4a')](function(_0x108551){logger['error'](_0x1cb9('0x58'),_0x108551);throw _0x108551;});}return _0x2d076b;})[_0x1cb9('0x24')](respondWithResult(_0x28c65d,0xc9))[_0x1cb9('0x4a')](handleError(_0x28c65d,null));};exports[_0x1cb9('0x59')]=function(_0x12d283,_0x3c4681){var _0x5ae762={'where':{'id':_0x12d283[_0x1cb9('0x4c')]['id']}},_0x37ceb5={};_0x37ceb5[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](db[_0x1cb9('0x36')][_0x1cb9('0x37')]);_0x5ae762[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x37ceb5[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x12d283[_0x1cb9('0x3c')]['fields']));_0x5ae762[_0x1cb9('0x3f')]=_0x5ae762[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x5ae762[_0x1cb9('0x3f')]:_0x37ceb5['model'];if(_0x12d283['query'][_0x1cb9('0x48')]){_0x5ae762[_0x1cb9('0x4e')]=[{'all':!![]}];}_0x5ae762=_[_0x1cb9('0x47')]({},_0x5ae762,_0x12d283[_0x1cb9('0x4f')]);return db[_0x1cb9('0x36')][_0x1cb9('0x2f')](_0x5ae762)[_0x1cb9('0x24')](handleEntityNotFound(_0x3c4681,null))[_0x1cb9('0x24')](function(_0x478bba){if(_0x478bba){var _0x49f74c=_0x478bba[_0x1cb9('0x26')]({'plain':!![]});_0x49f74c=qs['omit'](_0x49f74c,['id','createdAt','updatedAt']);_0x12d283['body']=_['omit'](_0x12d283[_0x1cb9('0x51')],['id',_0x1cb9('0x5a'),_0x1cb9('0x5b')]);return db[_0x1cb9('0x36')][_0x1cb9('0x50')](_[_0x1cb9('0x47')](_0x49f74c,_0x12d283['body']),{'include':_0x12d283[_0x1cb9('0x3c')][_0x1cb9('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x58c7ed){var _0x150441=_0x12d283[_0x1cb9('0x52')][_0x1cb9('0x26')]({'plain':!![]});if(!_0x150441)throw new Error(_0x1cb9('0x53'));if(_0x150441[_0x1cb9('0x5c')]==='user'){var _0x538ff0=_0x58c7ed['get']({'plain':!![]});var _0x270282=[{'name':_0x1cb9('0x54'),'value':_0x1cb9('0x27')},{'name':_0x1cb9('0x28'),'value':_0x1cb9('0x55')}];var _0x59bad0=_[_0x1cb9('0x2f')](_0x270282,[_0x1cb9('0x2c'),_0x538ff0['type']])['name'];return db[_0x1cb9('0x5d')]['find']({'where':{'name':_0x59bad0,'userProfileId':_0x150441[_0x1cb9('0x56')]},'raw':!![]})[_0x1cb9('0x24')](function(_0x2c54ea){if(_0x2c54ea&&_0x2c54ea[_0x1cb9('0x57')]===0x0){return db[_0x1cb9('0x30')][_0x1cb9('0x50')]({'name':_0x538ff0['name'],'resourceId':_0x538ff0['id'],'type':_0x2c54ea[_0x1cb9('0x33')],'sectionId':_0x2c54ea['id']},{})[_0x1cb9('0x24')](function(){return _0x58c7ed;});}else{return _0x58c7ed;}})[_0x1cb9('0x4a')](function(_0x17c361){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17c361);throw _0x17c361;});}return _0x58c7ed;});}})[_0x1cb9('0x24')](respondWithResult(_0x3c4681,0xc9))[_0x1cb9('0x4a')](handleError(_0x3c4681,null));};exports[_0x1cb9('0x23')]=function(_0x1ee140,_0x210b0b){if(_0x1ee140[_0x1cb9('0x51')]['id']){delete _0x1ee140['body']['id'];}return db[_0x1cb9('0x36')]['find']({'where':{'id':_0x1ee140[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x210b0b,null))['then'](saveUpdates(_0x1ee140[_0x1cb9('0x51')],null))[_0x1cb9('0x24')](respondWithResult(_0x210b0b,null))[_0x1cb9('0x4a')](handleError(_0x210b0b,null));};exports['destroy']=function(_0x1b4878,_0x95be29){return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x1b4878[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x95be29,null))['then'](removeEntity(_0x95be29,null))[_0x1cb9('0x4a')](handleError(_0x95be29,null));};exports[_0x1cb9('0x5e')]=function(_0x38d6a7,_0x4398dc,_0x3d3c1a){var _0x1da41c={'raw':![],'where':{}};var _0x128a41={};var _0x37bcd9={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x1cb9('0x5f')]({'where':{'id':_0x38d6a7[_0x1cb9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4398dc,null))[_0x1cb9('0x24')](function(_0x5415fa){if(_0x5415fa){_0x128a41[_0x1cb9('0x3a')]=_['keys'](db['CmHopper'][_0x1cb9('0x37')]);_0x128a41[_0x1cb9('0x3c')]=_['keys'](_0x38d6a7[_0x1cb9('0x3c')]);_0x128a41['filters']=_[_0x1cb9('0x3e')](_0x128a41[_0x1cb9('0x3a')],_0x128a41[_0x1cb9('0x3c')]);_0x1da41c[_0x1cb9('0x3f')]=_['intersection'](_0x128a41[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x40')]));_0x1da41c[_0x1cb9('0x3f')]=_0x1da41c[_0x1cb9('0x3f')]['length']?_0x1da41c[_0x1cb9('0x3f')]:_0x128a41[_0x1cb9('0x3a')];if(!_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x41')](_0x1cb9('0x42'))){_0x1da41c[_0x1cb9('0x20')]=qs['limit'](_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x1da41c['offset']=qs[_0x1cb9('0x1f')](_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}_0x1da41c[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x44')]);_0x1da41c['where']=qs[_0x1cb9('0x3d')](_['pick'](_0x38d6a7[_0x1cb9('0x3c')],_0x128a41[_0x1cb9('0x3d')]));_0x1da41c['where'][_0x1cb9('0x60')]=_0x5415fa['id'];if(_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x29')]){_0x1da41c[_0x1cb9('0x45')]=_['merge'](_0x1da41c[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0x1da41c[_0x1cb9('0x3f')],function(_0x5d0e8c){var _0x10f13e={};_0x10f13e[_0x5d0e8c]={'$like':'%'+_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x29')]+'%'};return _0x10f13e;})});}_0x1da41c=_[_0x1cb9('0x47')]({},_0x1da41c,_0x38d6a7[_0x1cb9('0x4f')]);return db[_0x1cb9('0x61')][_0x1cb9('0x1e')]({'where':_0x1da41c['where']})[_0x1cb9('0x24')](function(_0x4b15a4){_0x37bcd9[_0x1cb9('0x1e')]=_0x4b15a4;if(_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x48')]){_0x1da41c[_0x1cb9('0x4e')]=[{'all':!![]}];}return db['CmHopper'][_0x1cb9('0x62')](_0x1da41c);})[_0x1cb9('0x24')](function(_0x5e68a1){_0x37bcd9[_0x1cb9('0x49')]=_0x5e68a1;return _0x37bcd9;});}})[_0x1cb9('0x24')](respondWithFilteredResult(_0x4398dc,_0x1da41c))[_0x1cb9('0x4a')](handleError(_0x4398dc,null));};exports[_0x1cb9('0x63')]=function(_0x453fa3,_0x52a3f1,_0x5e0e56){var _0x544d2d={'raw':!![],'where':{}};var _0x5ad853={};var _0x19daa1={'count':0x0,'rows':[]};return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x453fa3[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x52a3f1,null))[_0x1cb9('0x24')](function(_0x1e6402){if(_0x1e6402){_0x5ad853[_0x1cb9('0x3a')]=_['keys'](db[_0x1cb9('0x64')][_0x1cb9('0x37')]);_0x5ad853[_0x1cb9('0x3c')]=_['keys'](_0x453fa3[_0x1cb9('0x3c')]);_0x5ad853[_0x1cb9('0x3d')]=_['intersection'](_0x5ad853[_0x1cb9('0x3a')],_0x5ad853[_0x1cb9('0x3c')]);_0x544d2d[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x5ad853['model'],qs[_0x1cb9('0x40')](_0x453fa3[_0x1cb9('0x3c')]['fields']));_0x544d2d['attributes']=_0x544d2d[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x544d2d['attributes']:_0x5ad853['model'];if(!_0x453fa3[_0x1cb9('0x3c')][_0x1cb9('0x41')]('nolimit')){_0x544d2d['limit']=qs[_0x1cb9('0x20')](_0x453fa3['query']['limit']);_0x544d2d['offset']=qs[_0x1cb9('0x1f')](_0x453fa3['query'][_0x1cb9('0x1f')]);}_0x544d2d[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0x453fa3['query'][_0x1cb9('0x44')]);_0x544d2d[_0x1cb9('0x45')]=qs[_0x1cb9('0x3d')](_['pick'](_0x453fa3[_0x1cb9('0x3c')],_0x5ad853[_0x1cb9('0x3d')]));_0x544d2d[_0x1cb9('0x45')][_0x1cb9('0x60')]=_0x1e6402['id'];if(_0x453fa3[_0x1cb9('0x3c')]['filter']){_0x544d2d[_0x1cb9('0x45')]=_[_0x1cb9('0x47')](_0x544d2d[_0x1cb9('0x45')],{'$or':_['map'](_0x544d2d[_0x1cb9('0x3f')],function(_0x81962d){var _0x534378={};_0x534378[_0x81962d]={'$like':'%'+_0x453fa3[_0x1cb9('0x3c')][_0x1cb9('0x29')]+'%'};return _0x534378;})});}_0x544d2d=_['merge']({},_0x544d2d,_0x453fa3[_0x1cb9('0x4f')]);return db[_0x1cb9('0x64')][_0x1cb9('0x1e')]({'where':_0x544d2d[_0x1cb9('0x45')]})[_0x1cb9('0x24')](function(_0x1768b8){_0x19daa1[_0x1cb9('0x1e')]=_0x1768b8;if(_0x453fa3[_0x1cb9('0x3c')][_0x1cb9('0x48')]){_0x544d2d[_0x1cb9('0x4e')]=[{'all':!![]}];}return db[_0x1cb9('0x64')][_0x1cb9('0x62')](_0x544d2d);})[_0x1cb9('0x24')](function(_0x1b2b1c){_0x19daa1[_0x1cb9('0x49')]=_0x1b2b1c;return _0x19daa1;});}})[_0x1cb9('0x24')](respondWithFilteredResult(_0x52a3f1,_0x544d2d))[_0x1cb9('0x4a')](handleError(_0x52a3f1,null));};exports[_0x1cb9('0x65')]=function(_0x48e879,_0x508a75,_0x13ba32){var _0x94d2c2={'raw':!![],'where':{}};var _0x20af42={};var _0x35f64f={'count':0x0,'rows':[]};return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x48e879[_0x1cb9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x508a75,null))['then'](function(_0x1d14a4){if(_0x1d14a4){_0x20af42[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](db[_0x1cb9('0x66')][_0x1cb9('0x37')]);_0x20af42['query']=_[_0x1cb9('0x3b')](_0x48e879[_0x1cb9('0x3c')]);_0x20af42[_0x1cb9('0x3d')]=_['intersection'](_0x20af42[_0x1cb9('0x3a')],_0x20af42[_0x1cb9('0x3c')]);_0x94d2c2[_0x1cb9('0x3f')]=_['intersection'](_0x20af42[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x48e879[_0x1cb9('0x3c')]['fields']));_0x94d2c2['attributes']=_0x94d2c2['attributes'][_0x1cb9('0x4d')]?_0x94d2c2[_0x1cb9('0x3f')]:_0x20af42[_0x1cb9('0x3a')];if(!_0x48e879['query'][_0x1cb9('0x41')]('nolimit')){_0x94d2c2['limit']=qs[_0x1cb9('0x20')](_0x48e879[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x94d2c2[_0x1cb9('0x1f')]=qs[_0x1cb9('0x1f')](_0x48e879[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}_0x94d2c2[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0x48e879[_0x1cb9('0x3c')]['sort']);_0x94d2c2['where']=qs[_0x1cb9('0x3d')](_[_0x1cb9('0x46')](_0x48e879['query'],_0x20af42['filters']));_0x94d2c2['where']['VoiceQueueId']=_0x1d14a4['id'];if(_0x48e879[_0x1cb9('0x3c')][_0x1cb9('0x29')]){_0x94d2c2['where']=_[_0x1cb9('0x47')](_0x94d2c2[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0x94d2c2[_0x1cb9('0x3f')],function(_0x169b0f){var _0x5218ea={};_0x5218ea[_0x169b0f]={'$like':'%'+_0x48e879[_0x1cb9('0x3c')][_0x1cb9('0x29')]+'%'};return _0x5218ea;})});}_0x94d2c2=_[_0x1cb9('0x47')]({},_0x94d2c2,_0x48e879[_0x1cb9('0x4f')]);return db['CmHopperFinal'][_0x1cb9('0x1e')]({'where':_0x94d2c2[_0x1cb9('0x45')]})['then'](function(_0x5ee95a){_0x35f64f['count']=_0x5ee95a;if(_0x48e879[_0x1cb9('0x3c')]['includeAll']){_0x94d2c2[_0x1cb9('0x4e')]=[{'all':!![]}];}return db[_0x1cb9('0x66')][_0x1cb9('0x62')](_0x94d2c2);})[_0x1cb9('0x24')](function(_0x31d1e5){_0x35f64f[_0x1cb9('0x49')]=_0x31d1e5;return _0x35f64f;});}})['then'](respondWithFilteredResult(_0x508a75,_0x94d2c2))[_0x1cb9('0x4a')](handleError(_0x508a75,null));};exports[_0x1cb9('0x67')]=function(_0x3726ba,_0x242cad,_0x699d37){var _0xf8e83f={'raw':!![],'where':{}};var _0x237e3b={};var _0x21e3fb={'count':0x0,'rows':[]};return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x3726ba[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x242cad,null))[_0x1cb9('0x24')](function(_0x1022d8){if(_0x1022d8){_0x237e3b[_0x1cb9('0x3a')]=_['keys'](db['CmHopperBlack']['rawAttributes']);_0x237e3b[_0x1cb9('0x3c')]=_[_0x1cb9('0x3b')](_0x3726ba['query']);_0x237e3b[_0x1cb9('0x3d')]=_[_0x1cb9('0x3e')](_0x237e3b[_0x1cb9('0x3a')],_0x237e3b['query']);_0xf8e83f[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x237e3b[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x3726ba[_0x1cb9('0x3c')]['fields']));_0xf8e83f[_0x1cb9('0x3f')]=_0xf8e83f['attributes']['length']?_0xf8e83f[_0x1cb9('0x3f')]:_0x237e3b[_0x1cb9('0x3a')];if(!_0x3726ba[_0x1cb9('0x3c')][_0x1cb9('0x41')](_0x1cb9('0x42'))){_0xf8e83f[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x3726ba[_0x1cb9('0x3c')]['limit']);_0xf8e83f[_0x1cb9('0x1f')]=qs[_0x1cb9('0x1f')](_0x3726ba[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}_0xf8e83f[_0x1cb9('0x43')]=qs['sort'](_0x3726ba[_0x1cb9('0x3c')][_0x1cb9('0x44')]);_0xf8e83f[_0x1cb9('0x45')]=qs[_0x1cb9('0x3d')](_[_0x1cb9('0x46')](_0x3726ba['query'],_0x237e3b[_0x1cb9('0x3d')]));_0xf8e83f[_0x1cb9('0x45')][_0x1cb9('0x60')]=_0x1022d8['id'];if(_0x3726ba['query'][_0x1cb9('0x29')]){_0xf8e83f[_0x1cb9('0x45')]=_[_0x1cb9('0x47')](_0xf8e83f[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0xf8e83f[_0x1cb9('0x3f')],function(_0x4e3ad0){var _0x45dc8c={};_0x45dc8c[_0x4e3ad0]={'$like':'%'+_0x3726ba[_0x1cb9('0x3c')][_0x1cb9('0x29')]+'%'};return _0x45dc8c;})});}_0xf8e83f=_['merge']({},_0xf8e83f,_0x3726ba[_0x1cb9('0x4f')]);return db[_0x1cb9('0x68')]['count']({'where':_0xf8e83f['where']})[_0x1cb9('0x24')](function(_0x3fc823){_0x21e3fb[_0x1cb9('0x1e')]=_0x3fc823;if(_0x3726ba[_0x1cb9('0x3c')][_0x1cb9('0x48')]){_0xf8e83f['include']=[{'all':!![]}];}return db[_0x1cb9('0x68')][_0x1cb9('0x62')](_0xf8e83f);})[_0x1cb9('0x24')](function(_0x3180dd){_0x21e3fb[_0x1cb9('0x49')]=_0x3180dd;return _0x21e3fb;});}})['then'](respondWithFilteredResult(_0x242cad,_0xf8e83f))['catch'](handleError(_0x242cad,null));};exports[_0x1cb9('0x69')]=function(_0x35383b,_0x9f2cb1,_0x4f7cc8){var _0x53c35a={};var _0x40d403={};var _0x3c4b2b;var _0x33d06a;return db['VoiceQueue']['findOne']({'where':{'id':_0x35383b['params']['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x9f2cb1,null))[_0x1cb9('0x24')](function(_0x27995f){if(_0x27995f){_0x3c4b2b=_0x27995f;_0x40d403['model']=_[_0x1cb9('0x3b')](db['Team'][_0x1cb9('0x37')]);_0x40d403[_0x1cb9('0x3c')]=_[_0x1cb9('0x3b')](_0x35383b[_0x1cb9('0x3c')]);_0x40d403[_0x1cb9('0x3d')]=_['intersection'](_0x40d403[_0x1cb9('0x3a')],_0x40d403['query']);_0x53c35a[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x40d403[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x35383b[_0x1cb9('0x3c')]['fields']));_0x53c35a[_0x1cb9('0x3f')]=_0x53c35a[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x53c35a[_0x1cb9('0x3f')]:_0x40d403[_0x1cb9('0x3a')];_0x53c35a[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0x35383b['query']['sort']);_0x53c35a[_0x1cb9('0x45')]=qs[_0x1cb9('0x3d')](_[_0x1cb9('0x46')](_0x35383b[_0x1cb9('0x3c')],_0x40d403[_0x1cb9('0x3d')]));if(_0x35383b['query'][_0x1cb9('0x29')]){_0x53c35a[_0x1cb9('0x45')]=_['merge'](_0x53c35a['where'],{'$or':_[_0x1cb9('0x2b')](_0x53c35a['attributes'],function(_0x2f5a5f){var _0x4af9bb={};_0x4af9bb[_0x2f5a5f]={'$like':'%'+_0x35383b[_0x1cb9('0x3c')][_0x1cb9('0x29')]+'%'};return _0x4af9bb;})});}_0x53c35a=_[_0x1cb9('0x47')]({},_0x53c35a,_0x35383b[_0x1cb9('0x4f')]);return _0x3c4b2b[_0x1cb9('0x69')](_0x53c35a);}})[_0x1cb9('0x24')](function(_0x2c7326){if(_0x2c7326){_0x33d06a=_0x2c7326[_0x1cb9('0x4d')];if(!_0x35383b[_0x1cb9('0x3c')][_0x1cb9('0x41')](_0x1cb9('0x42'))){_0x53c35a[_0x1cb9('0x20')]=qs['limit'](_0x35383b['query']['limit']);_0x53c35a['offset']=qs[_0x1cb9('0x1f')](_0x35383b[_0x1cb9('0x3c')]['offset']);}return _0x3c4b2b['getTeams'](_0x53c35a);}})['then'](function(_0x3cf4ff){if(_0x3cf4ff){return _0x3cf4ff?{'count':_0x33d06a,'rows':_0x3cf4ff}:null;}})[_0x1cb9('0x24')](respondWithResult(_0x9f2cb1,null))[_0x1cb9('0x4a')](handleError(_0x9f2cb1,null));};exports[_0x1cb9('0x6a')]=function(_0x4d66d3,_0x178cba,_0x2492a0){var _0x436364=_0x4d66d3['body'][_0x1cb9('0x6b')];var _0x2d9fcb=_['map'](_0x436364,'id');return db[_0x1cb9('0x6c')]['findAll']({'where':{'id':_0x2d9fcb},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x6d')],'as':_0x1cb9('0x6e'),'attributes':['id',_0x1cb9('0x33'),_0x1cb9('0x6f'),_0x1cb9('0x70'),_0x1cb9('0x71')],'raw':!![]}]})[_0x1cb9('0x24')](function(_0x4ea5ae){if(_0x4ea5ae){var _0x183bdb=_[_0x1cb9('0x72')](_0x4ea5ae,function(_0x21c0ab){var _0x384183=_0x21c0ab[_0x1cb9('0x26')]({'plain':!![]});_0x384183[_0x1cb9('0x6e')][_0x1cb9('0x73')](function(_0xd171b9){_0xd171b9[_0x1cb9('0x74')]=_[_0x1cb9('0x2f')](_0x436364,{'id':_0x384183['id']})['penalty'];});return _0x384183[_0x1cb9('0x6e')];});return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x4d66d3[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](function(_0x523fdb){return db[_0x1cb9('0x75')]['transaction'](function(_0x51770e){return _0x523fdb[_0x1cb9('0x6a')](_0x2d9fcb,{'transaction':_0x51770e})[_0x1cb9('0x24')](function(){return BPromise[_0x1cb9('0x76')](_0x183bdb,function(_0x182e0d){return db[_0x1cb9('0x77')][_0x1cb9('0x78')]({'where':{'UserId':_0x182e0d['id'],'VoiceQueueId':_0x4d66d3[_0x1cb9('0x4c')]['id']},'defaults':{'penalty':_0x182e0d[_0x1cb9('0x74')]},'transaction':_0x51770e});});})[_0x1cb9('0x24')](function(){return BPromise['each'](_['filter'](_0x183bdb,{'online':!![]}),function(_0x98f5cf){return db[_0x1cb9('0x79')][_0x1cb9('0x7a')]({'membername':_0x98f5cf[_0x1cb9('0x33')],'UserId':_0x98f5cf['id'],'queue_name':_0x523fdb[_0x1cb9('0x33')],'VoiceQueueId':_0x523fdb['id'],'interface':_[_0x1cb9('0x7b')](_0x98f5cf[_0x1cb9('0x71')])?util[_0x1cb9('0x7c')](_0x1cb9('0x7d'),_0x98f5cf[_0x1cb9('0x33')]):_0x98f5cf['interface'],'paused':_0x98f5cf[_0x1cb9('0x70')]||![],'penalty':_0x98f5cf[_0x1cb9('0x74')]},{'transaction':_0x51770e});});})[_0x1cb9('0x24')](function(){_0x183bdb[_0x1cb9('0x73')](function(_0xd38514){socket[_0x1cb9('0x7e')]('userVoiceQueue:save',{'UserId':_0xd38514['id'],'VoiceQueueId':_0x523fdb['id']});});});});});}})[_0x1cb9('0x24')](respondWithStatusCode(_0x178cba,null))[_0x1cb9('0x4a')](handleError(_0x178cba,null));};exports[_0x1cb9('0x7f')]=function(_0x40f1e3,_0x3d72d7,_0x1bf6a4){return db[_0x1cb9('0x6c')]['findAll']({'where':{'id':_0x40f1e3[_0x1cb9('0x3c')][_0x1cb9('0x80')]},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x6d')],'as':_0x1cb9('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x1cb9('0x24')](handleEntityNotFound(_0x3d72d7,null))[_0x1cb9('0x24')](function(_0x399537){var _0x1ad996=_[_0x1cb9('0x2b')](_0x399537,'id');var _0x42622e=[];var _0x27390a=[];var _0x36761a=squel[_0x1cb9('0x81')]();_0x36761a[_0x1cb9('0x82')](_0x1cb9('0x83'))[_0x1cb9('0x84')](_0x1cb9('0x85'),'tq')[_0x1cb9('0x86')](_0x1cb9('0x87'),'ut',_0x1cb9('0x88'))[_0x1cb9('0x45')](_0x1cb9('0x89'),_0x40f1e3['params']['id']);for(var _0x11a83c=0x0;_0x11a83c<_0x399537[_0x1cb9('0x4d')];_0x11a83c+=0x1){let _0x16ec06=_0x399537[_0x11a83c];for(var _0x9ab004=0x0;_0x9ab004<_0x16ec06[_0x1cb9('0x6e')][_0x1cb9('0x4d')];_0x9ab004+=0x1){let _0x4cd6fc=_0x16ec06[_0x1cb9('0x6e')][_0x9ab004];var _0x56e26b=_0x36761a[_0x1cb9('0x59')]();_0x56e26b[_0x1cb9('0x45')](_0x1cb9('0x8a'),_0x4cd6fc['id']);_0x27390a['push'](db[_0x1cb9('0x75')][_0x1cb9('0x3c')](_0x56e26b[_0x1cb9('0x8b')](),{'type':db[_0x1cb9('0x75')]['QueryTypes'][_0x1cb9('0x8c')]})[_0x1cb9('0x24')](function(_0x3557bd){if(_0x3557bd[_0x1cb9('0x4d')]===0x1){return _0x4cd6fc['id'];}else{var _0x4f0c63=_[_0x1cb9('0x8d')](_[_0x1cb9('0x2b')](_0x3557bd,'TeamId'),function(_0x21d844){return _[_0x1cb9('0x2d')](_0x1ad996,_0x21d844);});if(_0x4f0c63){return _0x4cd6fc['id'];}}}));}}return BPromise[_0x1cb9('0x8e')](_0x27390a)[_0x1cb9('0x24')](function(_0x196350){_0x42622e=_(_0x42622e)[_0x1cb9('0x8f')](_0x196350)[_0x1cb9('0x90')]()[_0x1cb9('0x2c')]();return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x40f1e3[_0x1cb9('0x4c')]['id']}})['then'](function(_0x2d2180){return db['sequelize'][_0x1cb9('0x91')](function(_0x328e5a){return _0x2d2180[_0x1cb9('0x7f')](_0x40f1e3[_0x1cb9('0x3c')][_0x1cb9('0x80')],{'transaction':_0x328e5a})[_0x1cb9('0x24')](function(){if(!_[_0x1cb9('0x92')](_0x42622e)){return _0x2d2180[_0x1cb9('0x93')](_0x42622e,{'transaction':_0x328e5a})[_0x1cb9('0x24')](function(){return db[_0x1cb9('0x79')][_0x1cb9('0x25')]({'where':{'VoiceQueueId':_0x40f1e3[_0x1cb9('0x4c')]['id'],'UserId':_0x42622e},'transaction':_0x328e5a});});}})[_0x1cb9('0x24')](function(){_0x42622e['forEach'](function(_0x44b50d){socket[_0x1cb9('0x7e')](_0x1cb9('0x94'),{'UserId':_0x44b50d,'VoiceQueueId':_0x2d2180['id']});});});});});});})['then'](respondWithStatusCode(_0x3d72d7,null))['catch'](handleError(_0x3d72d7,null));};exports['addAgents']=function(_0x46e35d,_0x2dd501,_0x5018c5){var _0x47d696,_0x31627f;return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x46e35d[_0x1cb9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2dd501,null))[_0x1cb9('0x24')](function(_0x149b0c){if(_0x149b0c){_0x31627f=_0x149b0c;return _0x149b0c[_0x1cb9('0x95')](_0x46e35d[_0x1cb9('0x51')]['ids'],_[_0x1cb9('0x96')](_0x46e35d[_0x1cb9('0x51')],[_0x1cb9('0x80'),'id'])||{})[_0x1cb9('0x97')](function(_0x463d1c){for(var _0x3908a8=0x0;_0x3908a8<_0x46e35d['body'][_0x1cb9('0x80')][_0x1cb9('0x4d')];_0x3908a8+=0x1){socket[_0x1cb9('0x7e')](_0x1cb9('0x98'),{'UserId':_0x46e35d[_0x1cb9('0x51')][_0x1cb9('0x80')][_0x3908a8],'VoiceQueueId':_0x46e35d[_0x1cb9('0x4c')]['id']});}return _0x463d1c;});}})[_0x1cb9('0x24')](function(_0xa43246){_0x47d696=_0xa43246||[];if(_0x31627f){return db[_0x1cb9('0x6d')][_0x1cb9('0x62')]({'where':{'id':_0x46e35d['body'][_0x1cb9('0x80')]},'attributes':['id',_0x1cb9('0x33'),'online',_0x1cb9('0x70'),'interface'],'raw':!![]});}})[_0x1cb9('0x24')](function(_0x28f70a){if(!_[_0x1cb9('0x92')](_0x28f70a)){var _0x46fb97=[];for(var _0x193c14=0x0;_0x193c14<_0x28f70a[_0x1cb9('0x4d')];_0x193c14++){if(_0x28f70a[_0x193c14][_0x1cb9('0x6f')]){_0x46fb97[_0x1cb9('0x99')](db[_0x1cb9('0x79')]['upsert']({'membername':_0x28f70a[_0x193c14]['name'],'UserId':_0x28f70a[_0x193c14]['id'],'queue_name':_0x31627f['name'],'VoiceQueueId':_0x31627f['id'],'interface':_[_0x1cb9('0x7b')](_0x28f70a[_0x193c14][_0x1cb9('0x71')])?util[_0x1cb9('0x7c')]('SIP/%s',_0x28f70a[_0x193c14][_0x1cb9('0x33')]):_0x28f70a[_0x193c14][_0x1cb9('0x71')],'paused':_0x28f70a[_0x193c14][_0x1cb9('0x70')]||![],'penalty':_0x46e35d[_0x1cb9('0x51')]['penalty']||0x0}));}}return BPromise['all'](_0x46fb97);}})[_0x1cb9('0x24')](function(){return _0x47d696;})[_0x1cb9('0x24')](respondWithResult(_0x2dd501,null))['catch'](handleError(_0x2dd501,null));};exports[_0x1cb9('0x93')]=function(_0x3b7e24,_0x5c58a7,_0x18132b){return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x3b7e24['params']['id']}})['then'](handleEntityNotFound(_0x5c58a7,null))[_0x1cb9('0x24')](function(_0x73fc01){if(_0x73fc01){return _0x73fc01['removeAgents'](_0x3b7e24[_0x1cb9('0x3c')][_0x1cb9('0x80')])[_0x1cb9('0x24')](function(){if(_[_0x1cb9('0x9a')](_0x3b7e24['query'][_0x1cb9('0x80')])){for(var _0xb76fc2=0x0;_0xb76fc2<_0x3b7e24[_0x1cb9('0x3c')][_0x1cb9('0x80')][_0x1cb9('0x4d')];_0xb76fc2+=0x1){socket['emit'](_0x1cb9('0x94'),{'UserId':Number(_0x3b7e24['query'][_0x1cb9('0x80')][_0xb76fc2]),'VoiceQueueId':Number(_0x3b7e24['params']['id'])});}}else{socket[_0x1cb9('0x7e')]('userVoiceQueue:remove',{'UserId':Number(_0x3b7e24[_0x1cb9('0x3c')][_0x1cb9('0x80')]),'VoiceQueueId':Number(_0x3b7e24[_0x1cb9('0x4c')]['id'])});}});}})[_0x1cb9('0x24')](function(_0x3f54a8){return db[_0x1cb9('0x79')][_0x1cb9('0x25')]({'where':{'VoiceQueueId':_0x3b7e24[_0x1cb9('0x4c')]['id'],'UserId':_0x3b7e24['query'][_0x1cb9('0x80')]}})[_0x1cb9('0x24')](function(){return _0x3f54a8;});})[_0x1cb9('0x24')](respondWithStatusCode(_0x5c58a7,null))[_0x1cb9('0x4a')](handleError(_0x5c58a7,null));};exports[_0x1cb9('0x9b')]=function(_0x42f11b,_0x55fa4a,_0x4e85b0){var _0x335df3={};var _0x155ee5={};var _0x40ad48;var _0x17a6a2;return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x42f11b['params']['id']}})['then'](handleEntityNotFound(_0x55fa4a,null))[_0x1cb9('0x24')](function(_0x416300){if(_0x416300){_0x40ad48=_0x416300;_0x155ee5[_0x1cb9('0x3a')]=_['keys'](db[_0x1cb9('0x6d')][_0x1cb9('0x37')]);_0x155ee5[_0x1cb9('0x3c')]=_['keys'](_0x42f11b[_0x1cb9('0x3c')]);_0x155ee5[_0x1cb9('0x3d')]=_[_0x1cb9('0x3e')](_0x155ee5[_0x1cb9('0x3a')],_0x155ee5[_0x1cb9('0x3c')]);_0x335df3[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x155ee5[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x42f11b[_0x1cb9('0x3c')][_0x1cb9('0x40')]));_0x335df3[_0x1cb9('0x3f')]=_0x335df3['attributes'][_0x1cb9('0x4d')]?_0x335df3['attributes']:_0x155ee5['model'];_0x335df3['order']=qs['sort'](_0x42f11b[_0x1cb9('0x3c')][_0x1cb9('0x44')]);_0x335df3['where']=qs[_0x1cb9('0x3d')](_['pick'](_0x42f11b[_0x1cb9('0x3c')],_0x155ee5[_0x1cb9('0x3d')]));if(_0x42f11b[_0x1cb9('0x3c')]['filter']){_0x335df3[_0x1cb9('0x45')]=_[_0x1cb9('0x47')](_0x335df3[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0x335df3[_0x1cb9('0x3f')],function(_0x27064d){var _0x2ddb5f={};_0x2ddb5f[_0x27064d]={'$like':'%'+_0x42f11b[_0x1cb9('0x3c')]['filter']+'%'};return _0x2ddb5f;})});}_0x335df3=_[_0x1cb9('0x47')]({},_0x335df3,_0x42f11b['options']);return _0x40ad48[_0x1cb9('0x9b')](_0x335df3);}})['then'](function(_0xb75f4d){if(_0xb75f4d){_0x17a6a2=_0xb75f4d[_0x1cb9('0x4d')];if(!_0x42f11b[_0x1cb9('0x3c')]['hasOwnProperty'](_0x1cb9('0x42'))){_0x335df3[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x42f11b[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x335df3['offset']=qs[_0x1cb9('0x1f')](_0x42f11b[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}return _0x40ad48['getAgents'](_0x335df3);}})[_0x1cb9('0x24')](function(_0x1978d3){if(_0x1978d3){return _0x1978d3?{'count':_0x17a6a2,'rows':_0x1978d3}:null;}})[_0x1cb9('0x24')](respondWithResult(_0x55fa4a,null))[_0x1cb9('0x4a')](handleError(_0x55fa4a,null));};exports['getMembers']=function(_0x25486c,_0x4ee661,_0x4e7706){var _0x327071={};var _0x48afe4={};var _0x209ba0;var _0x57685a;return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x25486c['params']['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x4ee661,null))[_0x1cb9('0x24')](function(_0x14cfb9){if(_0x14cfb9){_0x209ba0=_0x14cfb9;_0x48afe4[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](db[_0x1cb9('0x79')]['rawAttributes']);_0x48afe4[_0x1cb9('0x3c')]=_[_0x1cb9('0x3b')](_0x25486c[_0x1cb9('0x3c')]);_0x48afe4[_0x1cb9('0x3d')]=_[_0x1cb9('0x3e')](_0x48afe4[_0x1cb9('0x3a')],_0x48afe4['query']);_0x327071['attributes']=_[_0x1cb9('0x3e')](_0x48afe4[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x25486c[_0x1cb9('0x3c')]['fields']));_0x327071[_0x1cb9('0x3f')]=_0x327071[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x327071['attributes']:_0x48afe4[_0x1cb9('0x3a')];_0x327071[_0x1cb9('0x43')]=qs['sort'](_0x25486c[_0x1cb9('0x3c')][_0x1cb9('0x44')]);_0x327071['where']=qs[_0x1cb9('0x3d')](_[_0x1cb9('0x46')](_0x25486c[_0x1cb9('0x3c')],_0x48afe4[_0x1cb9('0x3d')]));if(_0x25486c[_0x1cb9('0x3c')][_0x1cb9('0x29')]){_0x327071[_0x1cb9('0x45')]=_['merge'](_0x327071[_0x1cb9('0x45')],{'$or':_['map'](_0x327071[_0x1cb9('0x3f')],function(_0x1bb6e2){var _0x11869b={};_0x11869b[_0x1bb6e2]={'$like':'%'+_0x25486c[_0x1cb9('0x3c')]['filter']+'%'};return _0x11869b;})});}_0x327071=_[_0x1cb9('0x47')]({},_0x327071,_0x25486c[_0x1cb9('0x4f')]);return _0x209ba0[_0x1cb9('0x9c')](_0x327071);}})['then'](function(_0x3acaf7){if(_0x3acaf7){_0x57685a=_0x3acaf7['length'];if(!_0x25486c['query'][_0x1cb9('0x41')]('nolimit')){_0x327071[_0x1cb9('0x20')]=qs['limit'](_0x25486c[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x327071[_0x1cb9('0x1f')]=qs[_0x1cb9('0x1f')](_0x25486c[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}return _0x209ba0[_0x1cb9('0x9c')](_0x327071);}})[_0x1cb9('0x24')](function(_0x1a4b8c){return _0x1a4b8c?{'count':_0x57685a,'rows':_0x1a4b8c}:null;})[_0x1cb9('0x24')](respondWithResult(_0x4ee661,null))[_0x1cb9('0x4a')](handleError(_0x4ee661,null));};exports[_0x1cb9('0x9d')]=function(_0x1b40ed,_0x50c592,_0x362ccf){var _0x183798={};var _0x572f51={};var _0x530922;var _0xc2f0cc;return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x1b40ed['params']['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x50c592,null))[_0x1cb9('0x24')](function(_0x55d14f){if(_0x55d14f){_0x530922=_0x55d14f;_0x572f51[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](db[_0x1cb9('0x9e')][_0x1cb9('0x37')]);_0x572f51[_0x1cb9('0x3c')]=_[_0x1cb9('0x3b')](_0x1b40ed['query']);_0x572f51[_0x1cb9('0x3d')]=_['intersection'](_0x572f51[_0x1cb9('0x3a')],_0x572f51['query']);_0x183798[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x572f51[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x1b40ed[_0x1cb9('0x3c')][_0x1cb9('0x40')]));_0x183798['attributes']=_0x183798[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x183798[_0x1cb9('0x3f')]:_0x572f51['model'];_0x183798['order']=qs[_0x1cb9('0x44')](_0x1b40ed['query'][_0x1cb9('0x44')]);_0x183798[_0x1cb9('0x45')]=qs['filters'](_[_0x1cb9('0x46')](_0x1b40ed[_0x1cb9('0x3c')],_0x572f51[_0x1cb9('0x3d')]));if(_0x1b40ed[_0x1cb9('0x3c')][_0x1cb9('0x29')]){_0x183798[_0x1cb9('0x45')]=_[_0x1cb9('0x47')](_0x183798[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0x183798[_0x1cb9('0x3f')],function(_0x31f74e){var _0x209a74={};_0x209a74[_0x31f74e]={'$like':'%'+_0x1b40ed['query'][_0x1cb9('0x29')]+'%'};return _0x209a74;})});}_0x183798=_[_0x1cb9('0x47')]({},_0x183798,_0x1b40ed[_0x1cb9('0x4f')]);return _0x530922[_0x1cb9('0x9d')](_0x183798);}})[_0x1cb9('0x24')](function(_0x5d0cd8){if(_0x5d0cd8){_0xc2f0cc=_0x5d0cd8[_0x1cb9('0x4d')];if(!_0x1b40ed[_0x1cb9('0x3c')]['hasOwnProperty'](_0x1cb9('0x42'))){_0x183798[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x1b40ed[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x183798[_0x1cb9('0x1f')]=qs['offset'](_0x1b40ed[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}return _0x530922['getLists'](_0x183798);}})[_0x1cb9('0x24')](function(_0x16aaad){if(_0x16aaad){return _0x16aaad?{'count':_0xc2f0cc,'rows':_0x16aaad}:null;}})[_0x1cb9('0x24')](respondWithResult(_0x50c592,null))['catch'](handleError(_0x50c592,null));};exports['addLists']=function(_0x465b41,_0x1ee133,_0x1c4e81){var _0x43b7b1,_0x26368f;return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x465b41['params']['id']}})['then'](handleEntityNotFound(_0x1ee133,null))['then'](function(_0x272cbc){if(_0x272cbc){_0x26368f=_0x272cbc;return _0x272cbc['addLists'](_0x465b41[_0x1cb9('0x51')][_0x1cb9('0x80')],_[_0x1cb9('0x96')](_0x465b41[_0x1cb9('0x51')],[_0x1cb9('0x80'),'id'])||{});}return null;})['spread'](function(_0x46ae55){var _0x590374;_0x43b7b1=_0x46ae55||[];var _0x4ecf13=[];if(_0x46ae55){for(var _0x2a4878=0x0;_0x2a4878<_0x46ae55[_0x1cb9('0x4d')];_0x2a4878+=0x1){var _0x267b06=_0x46ae55[_0x2a4878]['get']({'plain':!![]});_0x26368f[_0x1cb9('0x9f')]=_0x465b41[_0x1cb9('0x51')][_0x1cb9('0x9f')]?_0x465b41[_0x1cb9('0x51')][_0x1cb9('0x9f')]:_0x26368f[_0x1cb9('0x9f')];switch(_0x26368f[_0x1cb9('0x9f')]){case _0x1cb9('0xa0'):_0x590374=squel[_0x1cb9('0xa1')]()[_0x1cb9('0xa2')](_0x1cb9('0xa3'))[_0x1cb9('0xa4')]([_0x1cb9('0xa5'),_0x1cb9('0xa6'),_0x1cb9('0xa7'),'ListId',_0x1cb9('0x60'),'createdAt','updatedAt'],squel[_0x1cb9('0x81')]()[_0x1cb9('0x82')](_0x1cb9('0xa5'),_0x1cb9('0xa5'))[_0x1cb9('0x82')](_0x1cb9('0xa8'),_0x1cb9('0xa6'))['field']('id','ContactId')['field'](_0x267b06[_0x1cb9('0xa9')][_0x1cb9('0x8b')](),'ListId')['field'](_0x465b41[_0x1cb9('0x4c')]['id'][_0x1cb9('0x8b')](),_0x1cb9('0x60'))['field'](_0x1cb9('0xa8'),_0x1cb9('0x5a'))['field'](_0x1cb9('0xa8'),_0x1cb9('0x5b'))[_0x1cb9('0x84')](_0x1cb9('0xaa'))[_0x1cb9('0x45')](_0x1cb9('0xab'))['where']('ListId\x20=\x20?',_0x267b06['CmListId'][_0x1cb9('0x8b')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x1cb9('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x81')]()['field'](_0x1cb9('0xac'))['from'](_0x1cb9('0xad'))['where'](_0x1cb9('0x89'),_0x465b41[_0x1cb9('0x4c')]['id']['toString']()))[_0x1cb9('0x45')](_0x1cb9('0xae'),squel[_0x1cb9('0x81')]()[_0x1cb9('0x82')](_0x1cb9('0xaf'))['from'](_0x1cb9('0xa3'))['where'](_0x1cb9('0x89'),_0x465b41[_0x1cb9('0x4c')]['id'][_0x1cb9('0x8b')]())))[_0x1cb9('0x8b')]();break;case _0x1cb9('0xb0'):_0x590374=squel[_0x1cb9('0xa1')]()[_0x1cb9('0xa2')](_0x1cb9('0xa3'))['fromQuery'](['phone','scheduledAt',_0x1cb9('0xa7'),_0x1cb9('0xb1'),_0x1cb9('0x60'),_0x1cb9('0x5a'),_0x1cb9('0x5b')],squel[_0x1cb9('0x81')]()[_0x1cb9('0x82')](_0x1cb9('0xa5'),_0x1cb9('0xa5'))['field']('NOW()',_0x1cb9('0xa6'))[_0x1cb9('0x82')]('id',_0x1cb9('0xa7'))[_0x1cb9('0x82')](_0x267b06[_0x1cb9('0xa9')][_0x1cb9('0x8b')](),_0x1cb9('0xb1'))[_0x1cb9('0x82')](_0x465b41[_0x1cb9('0x4c')]['id'][_0x1cb9('0x8b')](),'VoiceQueueId')[_0x1cb9('0x82')](_0x1cb9('0xa8'),_0x1cb9('0x5a'))[_0x1cb9('0x82')]('NOW()',_0x1cb9('0x5b'))[_0x1cb9('0x84')](_0x1cb9('0xaa'))[_0x1cb9('0x45')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x45')](_0x1cb9('0xb2'),_0x267b06[_0x1cb9('0xa9')][_0x1cb9('0x8b')]())[_0x1cb9('0x45')](_0x1cb9('0xb3'))[_0x1cb9('0x45')](_0x1cb9('0xae'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0x1cb9('0x84')]('cm_hopper')['where'](_0x1cb9('0x89'),_0x465b41[_0x1cb9('0x4c')]['id']['toString']())))[_0x1cb9('0x8b')]();break;default:_0x590374=squel[_0x1cb9('0xa1')]()['into'](_0x1cb9('0xa3'))[_0x1cb9('0xa4')](['phone',_0x1cb9('0xa6'),_0x1cb9('0xa7'),_0x1cb9('0xb1'),_0x1cb9('0x60'),_0x1cb9('0x5a'),_0x1cb9('0x5b')],squel['select']()['field'](_0x1cb9('0xa5'),_0x1cb9('0xa5'))['field'](_0x1cb9('0xa8'),_0x1cb9('0xa6'))[_0x1cb9('0x82')]('id','ContactId')['field'](_0x267b06[_0x1cb9('0xa9')][_0x1cb9('0x8b')](),'ListId')[_0x1cb9('0x82')](_0x465b41[_0x1cb9('0x4c')]['id'][_0x1cb9('0x8b')](),'VoiceQueueId')['field'](_0x1cb9('0xa8'),_0x1cb9('0x5a'))[_0x1cb9('0x82')](_0x1cb9('0xa8'),'updatedAt')[_0x1cb9('0x84')](_0x1cb9('0xaa'))[_0x1cb9('0x45')](_0x1cb9('0xab'))[_0x1cb9('0x45')]('ListId\x20=\x20?',_0x267b06['CmListId'][_0x1cb9('0x8b')]())[_0x1cb9('0x45')](_0x1cb9('0xb3')))[_0x1cb9('0x8b')]();}_0x4ecf13[_0x1cb9('0x99')](db[_0x1cb9('0x75')]['query'](_0x590374));}return BPromise[_0x1cb9('0x8e')](_0x4ecf13);}})['then'](function(){return _0x43b7b1;})[_0x1cb9('0x24')](respondWithResult(_0x1ee133,null))[_0x1cb9('0x4a')](handleError(_0x1ee133,null));};exports['removeLists']=function(_0x49444a,_0x1f3976,_0x3fb70a){return db['VoiceQueue'][_0x1cb9('0x2f')]({'where':{'id':_0x49444a[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x1f3976,null))[_0x1cb9('0x24')](function(_0x3ea026){if(_0x3ea026){return _0x3ea026[_0x1cb9('0xb4')](_0x49444a[_0x1cb9('0x3c')][_0x1cb9('0x80')]);}})[_0x1cb9('0x24')](function(_0x2db8b9){if(_0x2db8b9){return db[_0x1cb9('0x61')][_0x1cb9('0x25')]({'where':{'ListId':_0x49444a[_0x1cb9('0x3c')]['ids'],'VoiceQueueId':_0x49444a[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](function(){return _0x2db8b9;});}})[_0x1cb9('0x24')](respondWithStatusCode(_0x1f3976,null))[_0x1cb9('0x4a')](handleError(_0x1f3976,null));};exports[_0x1cb9('0xb5')]=function(_0x355c3a,_0x5c9814,_0xd4ba25){var _0x1a6c4c={};var _0x4f4e04={};var _0x209197;var _0x35e3f4;return db['VoiceQueue'][_0x1cb9('0x5f')]({'where':{'id':_0x355c3a[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x5c9814,null))[_0x1cb9('0x24')](function(_0x2a799f){if(_0x2a799f){_0x209197=_0x2a799f;_0x4f4e04[_0x1cb9('0x3a')]=_['keys'](db[_0x1cb9('0x9e')][_0x1cb9('0x37')]);_0x4f4e04[_0x1cb9('0x3c')]=_['keys'](_0x355c3a[_0x1cb9('0x3c')]);_0x4f4e04['filters']=_['intersection'](_0x4f4e04[_0x1cb9('0x3a')],_0x4f4e04[_0x1cb9('0x3c')]);_0x1a6c4c[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x4f4e04['model'],qs[_0x1cb9('0x40')](_0x355c3a[_0x1cb9('0x3c')][_0x1cb9('0x40')]));_0x1a6c4c[_0x1cb9('0x3f')]=_0x1a6c4c[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x1a6c4c[_0x1cb9('0x3f')]:_0x4f4e04['model'];_0x1a6c4c[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0x355c3a[_0x1cb9('0x3c')]['sort']);_0x1a6c4c[_0x1cb9('0x45')]=qs['filters'](_[_0x1cb9('0x46')](_0x355c3a[_0x1cb9('0x3c')],_0x4f4e04[_0x1cb9('0x3d')]));if(_0x355c3a[_0x1cb9('0x3c')][_0x1cb9('0x29')]){_0x1a6c4c['where']=_['merge'](_0x1a6c4c['where'],{'$or':_['map'](_0x1a6c4c[_0x1cb9('0x3f')],function(_0x48fa02){var _0x35302e={};_0x35302e[_0x48fa02]={'$like':'%'+_0x355c3a['query'][_0x1cb9('0x29')]+'%'};return _0x35302e;})});}_0x1a6c4c=_[_0x1cb9('0x47')]({},_0x1a6c4c,_0x355c3a[_0x1cb9('0x4f')]);return _0x209197[_0x1cb9('0xb5')](_0x1a6c4c);}})[_0x1cb9('0x24')](function(_0x138763){if(_0x138763){_0x35e3f4=_0x138763[_0x1cb9('0x4d')];if(!_0x355c3a[_0x1cb9('0x3c')]['hasOwnProperty'](_0x1cb9('0x42'))){_0x1a6c4c[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x355c3a[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x1a6c4c['offset']=qs['offset'](_0x355c3a[_0x1cb9('0x3c')]['offset']);}return _0x209197['getBlackLists'](_0x1a6c4c);}})['then'](function(_0x331c18){if(_0x331c18){return _0x331c18?{'count':_0x35e3f4,'rows':_0x331c18}:null;}})[_0x1cb9('0x24')](respondWithResult(_0x5c9814,null))[_0x1cb9('0x4a')](handleError(_0x5c9814,null));};exports[_0x1cb9('0xb6')]=function(_0x836ef4,_0x5a407f,_0x19ac33){var _0x12e221,_0x5cd228;return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x836ef4[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x5a407f,null))[_0x1cb9('0x24')](function(_0x74cb14){if(_0x74cb14){_0x5cd228=_0x74cb14;return _0x74cb14[_0x1cb9('0xb6')](_0x836ef4['body'][_0x1cb9('0x80')],_['omit'](_0x836ef4['body'],[_0x1cb9('0x80'),'id'])||{});}return null;})['spread'](function(_0x2c9609){var _0x169e38;_0x12e221=_0x2c9609||[];var _0x2b4f5c=[];if(_0x2c9609){for(var _0x50bed6=0x0;_0x50bed6<_0x2c9609[_0x1cb9('0x4d')];_0x50bed6+=0x1){var _0x290bb3=_0x2c9609[_0x50bed6][_0x1cb9('0x26')]({'plain':!![]});_0x169e38=squel[_0x1cb9('0xa1')]()[_0x1cb9('0xa2')](_0x1cb9('0xb7'))['fromQuery']([_0x1cb9('0xa5'),_0x1cb9('0xa7'),'ListId','VoiceQueueId',_0x1cb9('0x5a'),_0x1cb9('0x5b')],squel[_0x1cb9('0x81')]()[_0x1cb9('0x82')](_0x1cb9('0xa5'),'phone')[_0x1cb9('0x82')]('id','ContactId')[_0x1cb9('0x82')](_0x290bb3[_0x1cb9('0xa9')][_0x1cb9('0x8b')](),_0x1cb9('0xb1'))[_0x1cb9('0x82')](_0x836ef4['params']['id'][_0x1cb9('0x8b')](),'VoiceQueueId')[_0x1cb9('0x82')]('NOW()',_0x1cb9('0x5a'))[_0x1cb9('0x82')]('NOW()',_0x1cb9('0x5b'))['from'](_0x1cb9('0xaa'))[_0x1cb9('0x45')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x45')](_0x1cb9('0xb2'),_0x290bb3[_0x1cb9('0xa9')][_0x1cb9('0x8b')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cb9('0x8b')]();_0x2b4f5c[_0x1cb9('0x99')](db[_0x1cb9('0x75')][_0x1cb9('0x3c')](_0x169e38));}return BPromise['all'](_0x2b4f5c);}})[_0x1cb9('0x24')](function(){return _0x12e221;})[_0x1cb9('0x24')](respondWithResult(_0x5a407f,null))['catch'](handleError(_0x5a407f,null));};exports[_0x1cb9('0xb8')]=function(_0x18a18f,_0x202c3a,_0x5b39f7){return db[_0x1cb9('0x36')]['find']({'where':{'id':_0x18a18f[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x202c3a,null))['then'](function(_0x10f6f6){if(_0x10f6f6){return _0x10f6f6[_0x1cb9('0xb8')](_0x18a18f[_0x1cb9('0x3c')]['ids']);}})[_0x1cb9('0x24')](function(_0x3d4a83){if(_0x3d4a83){return db['CmHopperBlack'][_0x1cb9('0x25')]({'where':{'ListId':_0x18a18f[_0x1cb9('0x3c')][_0x1cb9('0x80')],'VoiceQueueId':_0x18a18f[_0x1cb9('0x4c')]['id']}})['then'](function(){return _0x3d4a83;});}})[_0x1cb9('0x24')](respondWithStatusCode(_0x202c3a,null))['catch'](handleError(_0x202c3a,null));}; \ No newline at end of file +var _0x0713=['updatedAt','role','getHoppers','findOne','CmHopper','nolimit','order','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','userVoiceQueue:save','removeTeams','Team','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','all','union','compact','ids','removeAgents','emit','addAgents','spread','isEmpty','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','fromQuery','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','destroy','then','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','error','name','send','VoiceQueue','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','options','findAll','rows','catch','rawAttributes','includeAll','include','create','body','user','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt'];(function(_0x5eb43c,_0x382085){var _0x4a0c6f=function(_0x132ed2){while(--_0x132ed2){_0x5eb43c['push'](_0x5eb43c['shift']());}};_0x4a0c6f(++_0x382085);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];config['redis']=_['defaults'](config[_0x3071('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x3071('0x1c'))(new Redis(config[_0x3071('0x1b')]));require('./voiceQueue.socket')[_0x3071('0x1d')](socket);function respondWithStatusCode(_0x4e1219,_0x2fc15d){_0x2fc15d=_0x2fc15d||0xcc;return function(_0x45c93b){if(_0x45c93b){return _0x4e1219[_0x3071('0x1e')](_0x2fc15d);}return _0x4e1219[_0x3071('0x1f')](_0x2fc15d)[_0x3071('0x20')]();};}function respondWithResult(_0x2a6a4b,_0x157a47){_0x157a47=_0x157a47||0xc8;return function(_0x11bdc9){if(_0x11bdc9){return _0x2a6a4b[_0x3071('0x1f')](_0x157a47)[_0x3071('0x21')](_0x11bdc9);}};}function respondWithFilteredResult(_0x5f3c22,_0x224996){return function(_0x17dbda){if(_0x17dbda){var _0x1068d9=_0x17dbda[_0x3071('0x22')],_0x108a83=_0x224996[_0x3071('0x23')],_0x3acf0e=_0x224996['offset']+_0x224996[_0x3071('0x24')],_0x17aee2;if(_0x3acf0e>=_0x1068d9){_0x3acf0e=_0x1068d9;_0x17aee2=0xc8;}else{_0x17aee2=0xce;}_0x5f3c22[_0x3071('0x1f')](_0x17aee2);return _0x5f3c22[_0x3071('0x25')]('Content-Range',_0x108a83+'-'+_0x3acf0e+'/'+_0x1068d9)[_0x3071('0x21')](_0x17dbda);}return null;};}function patchUpdates(_0x5cd80d){return function(_0x833074){try{jsonpatch[_0x3071('0x26')](_0x833074,_0x5cd80d,!![]);}catch(_0x3762d8){return BPromise[_0x3071('0x27')](_0x3762d8);}return _0x833074[_0x3071('0x28')]();};}function saveUpdates(_0x34c50e,_0x3c5cef){return function(_0x211b4f){if(_0x211b4f){return _0x211b4f['update'](_0x34c50e)['then'](function(_0x2ce48a){return _0x2ce48a;});}return null;};}function removeEntity(_0xb05b1d,_0x412652){return function(_0x13df9f){if(_0x13df9f){return _0x13df9f[_0x3071('0x29')]()[_0x3071('0x2a')](function(){var _0x7a4cb4=_0x13df9f[_0x3071('0x2b')]({'plain':!![]});var _0x1de5fb=[{'name':'VoiceQueues','value':_0x3071('0x2c'),'ignore':![]},{'name':_0x3071('0x2d'),'value':_0x3071('0x2e'),'ignore':![]}];var _0x4d5c4b=_(_0x1de5fb)[_0x3071('0x2f')](_0x3071('0x30'))[_0x3071('0x31')](_0x3071('0x32'))[_0x3071('0x32')]();if(_[_0x3071('0x33')](_0x4d5c4b,_0x7a4cb4[_0x3071('0x34')])){return;}var _0x3921a1=_[_0x3071('0x35')](_0x1de5fb,[_0x3071('0x32'),_0x7a4cb4[_0x3071('0x34')]])['name'];return db['UserProfileResource'][_0x3071('0x29')]({'where':{'type':_0x3921a1,'resourceId':_0x7a4cb4['id']}})[_0x3071('0x2a')](function(){return _0x13df9f;});})[_0x3071('0x2a')](function(){_0xb05b1d[_0x3071('0x1f')](0xcc)[_0x3071('0x20')]();});}};}function handleEntityNotFound(_0x29538c,_0x32b6b1){return function(_0x1ccc41){if(!_0x1ccc41){_0x29538c['sendStatus'](0x194);}return _0x1ccc41;};}function handleError(_0x55d230,_0x4ab983){_0x4ab983=_0x4ab983||0x1f4;return function(_0x1b0aaf){logger[_0x3071('0x36')](_0x1b0aaf['stack']);if(_0x1b0aaf[_0x3071('0x37')]){delete _0x1b0aaf[_0x3071('0x37')];}_0x55d230[_0x3071('0x1f')](_0x4ab983)[_0x3071('0x38')](_0x1b0aaf);};}exports['index']=function(_0x218a82,_0x1525df){var _0x602719={},_0x240443={},_0x148096={'count':0x0,'rows':[]};var _0x2068ce=_[_0x3071('0x31')](db[_0x3071('0x39')]['rawAttributes'],function(_0x3988eb){return{'name':_0x3988eb['fieldName'],'type':_0x3988eb['type'][_0x3071('0x3a')]};});_0x240443[_0x3071('0x3b')]=_['map'](_0x2068ce,_0x3071('0x37'));_0x240443[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x218a82[_0x3071('0x3c')]);_0x240443[_0x3071('0x3e')]=_[_0x3071('0x3f')](_0x240443['model'],_0x240443[_0x3071('0x3c')]);_0x602719[_0x3071('0x40')]=_['intersection'](_0x240443[_0x3071('0x3b')],qs['fields'](_0x218a82[_0x3071('0x3c')][_0x3071('0x41')]));_0x602719['attributes']=_0x602719['attributes'][_0x3071('0x42')]?_0x602719[_0x3071('0x40')]:_0x240443[_0x3071('0x3b')];if(!_0x218a82['query'][_0x3071('0x43')]('nolimit')){_0x602719[_0x3071('0x24')]=qs['limit'](_0x218a82[_0x3071('0x3c')][_0x3071('0x24')]);_0x602719[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x218a82[_0x3071('0x3c')]['offset']);}_0x602719['order']=qs[_0x3071('0x44')](_0x218a82[_0x3071('0x3c')][_0x3071('0x44')]);_0x602719[_0x3071('0x45')]=qs['filters'](_[_0x3071('0x46')](_0x218a82[_0x3071('0x3c')],_0x240443[_0x3071('0x3e')]),_0x2068ce);if(_0x218a82[_0x3071('0x3c')][_0x3071('0x2f')]){_0x602719[_0x3071('0x45')]=_['merge'](_0x602719[_0x3071('0x45')],{'$or':_['map'](_0x2068ce,function(_0x4c8b1f){if(_0x4c8b1f['type']!=='VIRTUAL'){var _0x2992e6={};_0x2992e6[_0x4c8b1f[_0x3071('0x37')]]={'$like':'%'+_0x218a82[_0x3071('0x3c')][_0x3071('0x2f')]+'%'};return _0x2992e6;}})});}_0x602719=_[_0x3071('0x47')]({},_0x602719,_0x218a82[_0x3071('0x48')]);var _0xa711b5={'where':_0x602719[_0x3071('0x45')]};return db['VoiceQueue'][_0x3071('0x22')](_0xa711b5)[_0x3071('0x2a')](function(_0x44a879){_0x148096[_0x3071('0x22')]=_0x44a879;if(_0x218a82[_0x3071('0x3c')]['includeAll']){_0x602719['include']=[{'all':!![]}];}return db[_0x3071('0x39')][_0x3071('0x49')](_0x602719);})[_0x3071('0x2a')](function(_0x5c5865){_0x148096[_0x3071('0x4a')]=_0x5c5865;return _0x148096;})['then'](respondWithFilteredResult(_0x1525df,_0x602719))[_0x3071('0x4b')](handleError(_0x1525df,null));};exports['show']=function(_0x18a773,_0x509178){var _0x5a3db7={'raw':![],'where':{'id':_0x18a773['params']['id']}},_0x874522={};_0x874522[_0x3071('0x3b')]=_['keys'](db[_0x3071('0x39')][_0x3071('0x4c')]);_0x874522[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x18a773['query']);_0x874522[_0x3071('0x3e')]=_['intersection'](_0x874522[_0x3071('0x3b')],_0x874522['query']);_0x5a3db7[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x874522['model'],qs[_0x3071('0x41')](_0x18a773[_0x3071('0x3c')][_0x3071('0x41')]));_0x5a3db7[_0x3071('0x40')]=_0x5a3db7[_0x3071('0x40')][_0x3071('0x42')]?_0x5a3db7[_0x3071('0x40')]:_0x874522['model'];if(_0x18a773[_0x3071('0x3c')][_0x3071('0x4d')]){_0x5a3db7[_0x3071('0x4e')]=[{'all':!![]}];}_0x5a3db7=_[_0x3071('0x47')]({},_0x5a3db7,_0x18a773['options']);return db[_0x3071('0x39')][_0x3071('0x35')](_0x5a3db7)[_0x3071('0x2a')](handleEntityNotFound(_0x509178,null))[_0x3071('0x2a')](respondWithResult(_0x509178,null))[_0x3071('0x4b')](handleError(_0x509178,null));};exports[_0x3071('0x4f')]=function(_0x3ab6d4,_0x390944){return db[_0x3071('0x39')][_0x3071('0x4f')](_0x3ab6d4[_0x3071('0x50')],{})[_0x3071('0x2a')](function(_0x24977b){var _0x114f1f=_0x3ab6d4[_0x3071('0x51')][_0x3071('0x2b')]({'plain':!![]});if(!_0x114f1f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x114f1f['role']===_0x3071('0x51')){var _0x580c04=_0x24977b[_0x3071('0x2b')]({'plain':!![]});var _0x198168=[{'name':_0x3071('0x52'),'value':'inbound'},{'name':_0x3071('0x2d'),'value':_0x3071('0x2e')}];var _0x5bc69e=_['find'](_0x198168,[_0x3071('0x32'),_0x580c04[_0x3071('0x34')]])[_0x3071('0x37')];return db[_0x3071('0x53')]['find']({'where':{'name':_0x5bc69e,'userProfileId':_0x114f1f[_0x3071('0x54')]},'raw':!![]})[_0x3071('0x2a')](function(_0x3f2edc){if(_0x3f2edc&&_0x3f2edc[_0x3071('0x55')]===0x0){return db[_0x3071('0x56')]['create']({'name':_0x580c04[_0x3071('0x37')],'resourceId':_0x580c04['id'],'type':_0x3f2edc[_0x3071('0x37')],'sectionId':_0x3f2edc['id']},{})[_0x3071('0x2a')](function(){return _0x24977b;});}else{return _0x24977b;}})[_0x3071('0x4b')](function(_0x12d6be){logger[_0x3071('0x36')](_0x3071('0x57'),_0x12d6be);throw _0x12d6be;});}return _0x24977b;})['then'](respondWithResult(_0x390944,0xc9))['catch'](handleError(_0x390944,null));};exports[_0x3071('0x58')]=function(_0x4de4f3,_0xe96994){var _0x26ba8a={'where':{'id':_0x4de4f3[_0x3071('0x59')]['id']}},_0x499b6a={};_0x499b6a[_0x3071('0x3b')]=_['keys'](db[_0x3071('0x39')][_0x3071('0x4c')]);_0x26ba8a[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x499b6a[_0x3071('0x3b')],qs['fields'](_0x4de4f3[_0x3071('0x3c')][_0x3071('0x41')]));_0x26ba8a[_0x3071('0x40')]=_0x26ba8a['attributes'][_0x3071('0x42')]?_0x26ba8a[_0x3071('0x40')]:_0x499b6a[_0x3071('0x3b')];if(_0x4de4f3[_0x3071('0x3c')][_0x3071('0x4d')]){_0x26ba8a[_0x3071('0x4e')]=[{'all':!![]}];}_0x26ba8a=_[_0x3071('0x47')]({},_0x26ba8a,_0x4de4f3[_0x3071('0x48')]);return db[_0x3071('0x39')]['find'](_0x26ba8a)[_0x3071('0x2a')](handleEntityNotFound(_0xe96994,null))[_0x3071('0x2a')](function(_0x3bcf28){if(_0x3bcf28){var _0x26ecb2=_0x3bcf28[_0x3071('0x2b')]({'plain':!![]});_0x26ecb2=qs[_0x3071('0x5a')](_0x26ecb2,['id',_0x3071('0x5b'),_0x3071('0x5c')]);_0x4de4f3[_0x3071('0x50')]=_[_0x3071('0x5a')](_0x4de4f3[_0x3071('0x50')],['id','createdAt',_0x3071('0x5c')]);return db[_0x3071('0x39')][_0x3071('0x4f')](_[_0x3071('0x47')](_0x26ecb2,_0x4de4f3[_0x3071('0x50')]),{'include':_0x4de4f3[_0x3071('0x3c')][_0x3071('0x4d')]?[{'all':!![]}]:undefined})[_0x3071('0x2a')](function(_0x52fddc){var _0x352d6f=_0x4de4f3[_0x3071('0x51')]['get']({'plain':!![]});if(!_0x352d6f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x352d6f[_0x3071('0x5d')]===_0x3071('0x51')){var _0x3469c1=_0x52fddc[_0x3071('0x2b')]({'plain':!![]});var _0x5278ea=[{'name':'VoiceQueues','value':_0x3071('0x2c')},{'name':'QueueCampaigns','value':'outbound'}];var _0x5113fc=_['find'](_0x5278ea,[_0x3071('0x32'),_0x3469c1[_0x3071('0x34')]])[_0x3071('0x37')];return db['UserProfileSection'][_0x3071('0x35')]({'where':{'name':_0x5113fc,'userProfileId':_0x352d6f[_0x3071('0x54')]},'raw':!![]})[_0x3071('0x2a')](function(_0x19a03d){if(_0x19a03d&&_0x19a03d['autoAssociation']===0x0){return db[_0x3071('0x56')][_0x3071('0x4f')]({'name':_0x3469c1['name'],'resourceId':_0x3469c1['id'],'type':_0x19a03d[_0x3071('0x37')],'sectionId':_0x19a03d['id']},{})[_0x3071('0x2a')](function(){return _0x52fddc;});}else{return _0x52fddc;}})[_0x3071('0x4b')](function(_0x40c258){logger[_0x3071('0x36')](_0x3071('0x57'),_0x40c258);throw _0x40c258;});}return _0x52fddc;});}})[_0x3071('0x2a')](respondWithResult(_0xe96994,0xc9))['catch'](handleError(_0xe96994,null));};exports['update']=function(_0x21c1e3,_0x168025){if(_0x21c1e3[_0x3071('0x50')]['id']){delete _0x21c1e3['body']['id'];}return db['VoiceQueue'][_0x3071('0x35')]({'where':{'id':_0x21c1e3[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x168025,null))[_0x3071('0x2a')](saveUpdates(_0x21c1e3[_0x3071('0x50')],null))[_0x3071('0x2a')](respondWithResult(_0x168025,null))[_0x3071('0x4b')](handleError(_0x168025,null));};exports[_0x3071('0x29')]=function(_0x5eed64,_0x4ce89b){return db['VoiceQueue'][_0x3071('0x35')]({'where':{'id':_0x5eed64[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x4ce89b,null))[_0x3071('0x2a')](removeEntity(_0x4ce89b,null))[_0x3071('0x4b')](handleError(_0x4ce89b,null));};exports[_0x3071('0x5e')]=function(_0x155542,_0x2ae053,_0x4fa372){var _0x20dff9={'raw':![],'where':{}};var _0x138a94={};var _0x1da477={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x3071('0x5f')]({'where':{'id':_0x155542[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x2ae053,null))['then'](function(_0x521ee6){if(_0x521ee6){_0x138a94[_0x3071('0x3b')]=_['keys'](db[_0x3071('0x60')][_0x3071('0x4c')]);_0x138a94[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x155542[_0x3071('0x3c')]);_0x138a94[_0x3071('0x3e')]=_[_0x3071('0x3f')](_0x138a94['model'],_0x138a94[_0x3071('0x3c')]);_0x20dff9[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x138a94[_0x3071('0x3b')],qs[_0x3071('0x41')](_0x155542[_0x3071('0x3c')][_0x3071('0x41')]));_0x20dff9[_0x3071('0x40')]=_0x20dff9['attributes'][_0x3071('0x42')]?_0x20dff9['attributes']:_0x138a94[_0x3071('0x3b')];if(!_0x155542[_0x3071('0x3c')][_0x3071('0x43')](_0x3071('0x61'))){_0x20dff9[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x155542[_0x3071('0x3c')][_0x3071('0x24')]);_0x20dff9[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x155542['query'][_0x3071('0x23')]);}_0x20dff9[_0x3071('0x62')]=qs['sort'](_0x155542[_0x3071('0x3c')][_0x3071('0x44')]);_0x20dff9[_0x3071('0x45')]=qs[_0x3071('0x3e')](_[_0x3071('0x46')](_0x155542['query'],_0x138a94['filters']));_0x20dff9[_0x3071('0x45')]['VoiceQueueId']=_0x521ee6['id'];if(_0x155542[_0x3071('0x3c')][_0x3071('0x2f')]){_0x20dff9[_0x3071('0x45')]=_[_0x3071('0x47')](_0x20dff9[_0x3071('0x45')],{'$or':_[_0x3071('0x31')](_0x20dff9['attributes'],function(_0x290d1c){var _0xa732ea={};_0xa732ea[_0x290d1c]={'$like':'%'+_0x155542[_0x3071('0x3c')][_0x3071('0x2f')]+'%'};return _0xa732ea;})});}_0x20dff9=_['merge']({},_0x20dff9,_0x155542[_0x3071('0x48')]);return db[_0x3071('0x60')]['count']({'where':_0x20dff9[_0x3071('0x45')]})[_0x3071('0x2a')](function(_0x391887){_0x1da477[_0x3071('0x22')]=_0x391887;if(_0x155542[_0x3071('0x3c')]['includeAll']){_0x20dff9[_0x3071('0x4e')]=[{'all':!![]}];}return db['CmHopper'][_0x3071('0x49')](_0x20dff9);})[_0x3071('0x2a')](function(_0x39060f){_0x1da477[_0x3071('0x4a')]=_0x39060f;return _0x1da477;});}})[_0x3071('0x2a')](respondWithFilteredResult(_0x2ae053,_0x20dff9))[_0x3071('0x4b')](handleError(_0x2ae053,null));};exports[_0x3071('0x63')]=function(_0x32b2e2,_0x4ed248,_0x2868c2){var _0x3efa3c={'raw':!![],'where':{}};var _0x459653={};var _0x4dfb45={'count':0x0,'rows':[]};return db[_0x3071('0x39')]['findOne']({'where':{'id':_0x32b2e2[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x4ed248,null))[_0x3071('0x2a')](function(_0x5e0cbd){if(_0x5e0cbd){_0x459653[_0x3071('0x3b')]=_[_0x3071('0x3d')](db[_0x3071('0x64')][_0x3071('0x4c')]);_0x459653[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x32b2e2[_0x3071('0x3c')]);_0x459653[_0x3071('0x3e')]=_[_0x3071('0x3f')](_0x459653['model'],_0x459653[_0x3071('0x3c')]);_0x3efa3c[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x459653['model'],qs['fields'](_0x32b2e2['query']['fields']));_0x3efa3c['attributes']=_0x3efa3c[_0x3071('0x40')][_0x3071('0x42')]?_0x3efa3c['attributes']:_0x459653[_0x3071('0x3b')];if(!_0x32b2e2[_0x3071('0x3c')][_0x3071('0x43')]('nolimit')){_0x3efa3c['limit']=qs[_0x3071('0x24')](_0x32b2e2[_0x3071('0x3c')][_0x3071('0x24')]);_0x3efa3c[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x32b2e2[_0x3071('0x3c')][_0x3071('0x23')]);}_0x3efa3c['order']=qs['sort'](_0x32b2e2[_0x3071('0x3c')][_0x3071('0x44')]);_0x3efa3c[_0x3071('0x45')]=qs[_0x3071('0x3e')](_['pick'](_0x32b2e2[_0x3071('0x3c')],_0x459653[_0x3071('0x3e')]));_0x3efa3c[_0x3071('0x45')][_0x3071('0x65')]=_0x5e0cbd['id'];if(_0x32b2e2[_0x3071('0x3c')][_0x3071('0x2f')]){_0x3efa3c[_0x3071('0x45')]=_[_0x3071('0x47')](_0x3efa3c['where'],{'$or':_[_0x3071('0x31')](_0x3efa3c[_0x3071('0x40')],function(_0x118268){var _0x9dba3={};_0x9dba3[_0x118268]={'$like':'%'+_0x32b2e2[_0x3071('0x3c')]['filter']+'%'};return _0x9dba3;})});}_0x3efa3c=_[_0x3071('0x47')]({},_0x3efa3c,_0x32b2e2['options']);return db['CmHopperHistory'][_0x3071('0x22')]({'where':_0x3efa3c[_0x3071('0x45')]})[_0x3071('0x2a')](function(_0x48fdd2){_0x4dfb45[_0x3071('0x22')]=_0x48fdd2;if(_0x32b2e2[_0x3071('0x3c')][_0x3071('0x4d')]){_0x3efa3c[_0x3071('0x4e')]=[{'all':!![]}];}return db[_0x3071('0x64')]['findAll'](_0x3efa3c);})['then'](function(_0x39dc23){_0x4dfb45[_0x3071('0x4a')]=_0x39dc23;return _0x4dfb45;});}})['then'](respondWithFilteredResult(_0x4ed248,_0x3efa3c))[_0x3071('0x4b')](handleError(_0x4ed248,null));};exports[_0x3071('0x66')]=function(_0x22e484,_0x2d559a,_0xa7fb55){var _0x4df9dd={'raw':!![],'where':{}};var _0x4194dd={};var _0x5b1ff8={'count':0x0,'rows':[]};return db[_0x3071('0x39')][_0x3071('0x5f')]({'where':{'id':_0x22e484['params']['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x2d559a,null))['then'](function(_0x1322eb){if(_0x1322eb){_0x4194dd[_0x3071('0x3b')]=_[_0x3071('0x3d')](db[_0x3071('0x67')]['rawAttributes']);_0x4194dd[_0x3071('0x3c')]=_['keys'](_0x22e484[_0x3071('0x3c')]);_0x4194dd['filters']=_[_0x3071('0x3f')](_0x4194dd[_0x3071('0x3b')],_0x4194dd['query']);_0x4df9dd[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x4194dd['model'],qs[_0x3071('0x41')](_0x22e484[_0x3071('0x3c')][_0x3071('0x41')]));_0x4df9dd[_0x3071('0x40')]=_0x4df9dd[_0x3071('0x40')][_0x3071('0x42')]?_0x4df9dd[_0x3071('0x40')]:_0x4194dd[_0x3071('0x3b')];if(!_0x22e484[_0x3071('0x3c')][_0x3071('0x43')](_0x3071('0x61'))){_0x4df9dd[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x22e484[_0x3071('0x3c')][_0x3071('0x24')]);_0x4df9dd['offset']=qs[_0x3071('0x23')](_0x22e484[_0x3071('0x3c')][_0x3071('0x23')]);}_0x4df9dd[_0x3071('0x62')]=qs[_0x3071('0x44')](_0x22e484['query']['sort']);_0x4df9dd[_0x3071('0x45')]=qs[_0x3071('0x3e')](_['pick'](_0x22e484[_0x3071('0x3c')],_0x4194dd[_0x3071('0x3e')]));_0x4df9dd['where'][_0x3071('0x65')]=_0x1322eb['id'];if(_0x22e484[_0x3071('0x3c')][_0x3071('0x2f')]){_0x4df9dd[_0x3071('0x45')]=_[_0x3071('0x47')](_0x4df9dd[_0x3071('0x45')],{'$or':_[_0x3071('0x31')](_0x4df9dd[_0x3071('0x40')],function(_0xbee265){var _0x199bb0={};_0x199bb0[_0xbee265]={'$like':'%'+_0x22e484['query'][_0x3071('0x2f')]+'%'};return _0x199bb0;})});}_0x4df9dd=_['merge']({},_0x4df9dd,_0x22e484[_0x3071('0x48')]);return db[_0x3071('0x67')][_0x3071('0x22')]({'where':_0x4df9dd[_0x3071('0x45')]})['then'](function(_0x4f83d2){_0x5b1ff8['count']=_0x4f83d2;if(_0x22e484[_0x3071('0x3c')][_0x3071('0x4d')]){_0x4df9dd[_0x3071('0x4e')]=[{'all':!![]}];}return db[_0x3071('0x67')]['findAll'](_0x4df9dd);})[_0x3071('0x2a')](function(_0x7c3473){_0x5b1ff8[_0x3071('0x4a')]=_0x7c3473;return _0x5b1ff8;});}})['then'](respondWithFilteredResult(_0x2d559a,_0x4df9dd))['catch'](handleError(_0x2d559a,null));};exports['getHopperBlacks']=function(_0x4afc58,_0x18d792,_0x46efeb){var _0x5795ea={'raw':!![],'where':{}};var _0x2750c5={};var _0x2a2b9d={'count':0x0,'rows':[]};return db[_0x3071('0x39')][_0x3071('0x5f')]({'where':{'id':_0x4afc58[_0x3071('0x59')]['id']}})['then'](handleEntityNotFound(_0x18d792,null))[_0x3071('0x2a')](function(_0x3d83cd){if(_0x3d83cd){_0x2750c5[_0x3071('0x3b')]=_[_0x3071('0x3d')](db['CmHopperBlack'][_0x3071('0x4c')]);_0x2750c5['query']=_[_0x3071('0x3d')](_0x4afc58[_0x3071('0x3c')]);_0x2750c5[_0x3071('0x3e')]=_['intersection'](_0x2750c5[_0x3071('0x3b')],_0x2750c5[_0x3071('0x3c')]);_0x5795ea[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x2750c5['model'],qs[_0x3071('0x41')](_0x4afc58[_0x3071('0x3c')][_0x3071('0x41')]));_0x5795ea[_0x3071('0x40')]=_0x5795ea[_0x3071('0x40')]['length']?_0x5795ea['attributes']:_0x2750c5[_0x3071('0x3b')];if(!_0x4afc58[_0x3071('0x3c')][_0x3071('0x43')](_0x3071('0x61'))){_0x5795ea['limit']=qs['limit'](_0x4afc58[_0x3071('0x3c')][_0x3071('0x24')]);_0x5795ea['offset']=qs[_0x3071('0x23')](_0x4afc58[_0x3071('0x3c')][_0x3071('0x23')]);}_0x5795ea['order']=qs['sort'](_0x4afc58['query'][_0x3071('0x44')]);_0x5795ea[_0x3071('0x45')]=qs[_0x3071('0x3e')](_['pick'](_0x4afc58['query'],_0x2750c5[_0x3071('0x3e')]));_0x5795ea[_0x3071('0x45')][_0x3071('0x65')]=_0x3d83cd['id'];if(_0x4afc58[_0x3071('0x3c')][_0x3071('0x2f')]){_0x5795ea['where']=_[_0x3071('0x47')](_0x5795ea['where'],{'$or':_[_0x3071('0x31')](_0x5795ea[_0x3071('0x40')],function(_0x294316){var _0xc1632={};_0xc1632[_0x294316]={'$like':'%'+_0x4afc58[_0x3071('0x3c')]['filter']+'%'};return _0xc1632;})});}_0x5795ea=_[_0x3071('0x47')]({},_0x5795ea,_0x4afc58[_0x3071('0x48')]);return db[_0x3071('0x68')][_0x3071('0x22')]({'where':_0x5795ea[_0x3071('0x45')]})[_0x3071('0x2a')](function(_0x58d53b){_0x2a2b9d[_0x3071('0x22')]=_0x58d53b;if(_0x4afc58[_0x3071('0x3c')][_0x3071('0x4d')]){_0x5795ea[_0x3071('0x4e')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x3071('0x49')](_0x5795ea);})[_0x3071('0x2a')](function(_0x330cfb){_0x2a2b9d[_0x3071('0x4a')]=_0x330cfb;return _0x2a2b9d;});}})['then'](respondWithFilteredResult(_0x18d792,_0x5795ea))[_0x3071('0x4b')](handleError(_0x18d792,null));};exports['getTeams']=function(_0x17a9f5,_0x2fcecd,_0x148924){var _0xfe896c={};var _0x3aa03f={};var _0x44c0e5;var _0x31c8bd;return db['VoiceQueue'][_0x3071('0x5f')]({'where':{'id':_0x17a9f5['params']['id']}})['then'](handleEntityNotFound(_0x2fcecd,null))[_0x3071('0x2a')](function(_0x2b0a2d){if(_0x2b0a2d){_0x44c0e5=_0x2b0a2d;_0x3aa03f['model']=_[_0x3071('0x3d')](db['Team'][_0x3071('0x4c')]);_0x3aa03f[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x17a9f5[_0x3071('0x3c')]);_0x3aa03f[_0x3071('0x3e')]=_[_0x3071('0x3f')](_0x3aa03f[_0x3071('0x3b')],_0x3aa03f[_0x3071('0x3c')]);_0xfe896c[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x3aa03f[_0x3071('0x3b')],qs['fields'](_0x17a9f5[_0x3071('0x3c')][_0x3071('0x41')]));_0xfe896c[_0x3071('0x40')]=_0xfe896c['attributes'][_0x3071('0x42')]?_0xfe896c['attributes']:_0x3aa03f[_0x3071('0x3b')];_0xfe896c[_0x3071('0x62')]=qs[_0x3071('0x44')](_0x17a9f5[_0x3071('0x3c')]['sort']);_0xfe896c['where']=qs['filters'](_[_0x3071('0x46')](_0x17a9f5['query'],_0x3aa03f['filters']));if(_0x17a9f5[_0x3071('0x3c')]['filter']){_0xfe896c[_0x3071('0x45')]=_[_0x3071('0x47')](_0xfe896c[_0x3071('0x45')],{'$or':_['map'](_0xfe896c[_0x3071('0x40')],function(_0x5a10af){var _0x587e6b={};_0x587e6b[_0x5a10af]={'$like':'%'+_0x17a9f5[_0x3071('0x3c')][_0x3071('0x2f')]+'%'};return _0x587e6b;})});}_0xfe896c=_[_0x3071('0x47')]({},_0xfe896c,_0x17a9f5[_0x3071('0x48')]);return _0x44c0e5[_0x3071('0x69')](_0xfe896c);}})[_0x3071('0x2a')](function(_0x3d396d){if(_0x3d396d){_0x31c8bd=_0x3d396d['length'];if(!_0x17a9f5[_0x3071('0x3c')][_0x3071('0x43')](_0x3071('0x61'))){_0xfe896c[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x17a9f5[_0x3071('0x3c')][_0x3071('0x24')]);_0xfe896c[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x17a9f5['query'][_0x3071('0x23')]);}return _0x44c0e5[_0x3071('0x69')](_0xfe896c);}})[_0x3071('0x2a')](function(_0x28e880){if(_0x28e880){return _0x28e880?{'count':_0x31c8bd,'rows':_0x28e880}:null;}})[_0x3071('0x2a')](respondWithResult(_0x2fcecd,null))[_0x3071('0x4b')](handleError(_0x2fcecd,null));};exports[_0x3071('0x6a')]=function(_0x4ec86a,_0x2b6fca,_0x5b2cbc){var _0x32575c=_0x4ec86a[_0x3071('0x50')][_0x3071('0x6b')];var _0x5411b4=_['map'](_0x32575c,'id');return db['Team'][_0x3071('0x49')]({'where':{'id':_0x5411b4},'attributes':['id'],'include':[{'model':db[_0x3071('0x6c')],'as':_0x3071('0x6d'),'attributes':['id','name',_0x3071('0x6e'),_0x3071('0x6f'),_0x3071('0x70')],'raw':!![]}]})[_0x3071('0x2a')](function(_0x3e788f){if(_0x3e788f){var _0x25b492=_[_0x3071('0x71')](_0x3e788f,function(_0x1befe3){var _0x381eb=_0x1befe3['get']({'plain':!![]});_0x381eb[_0x3071('0x6d')][_0x3071('0x72')](function(_0x345f90){_0x345f90['penalty']=_[_0x3071('0x35')](_0x32575c,{'id':_0x381eb['id']})[_0x3071('0x73')];});return _0x381eb[_0x3071('0x6d')];});return db[_0x3071('0x39')][_0x3071('0x35')]({'where':{'id':_0x4ec86a[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](function(_0x10a0c3){return db[_0x3071('0x74')][_0x3071('0x75')](function(_0x242313){return _0x10a0c3[_0x3071('0x6a')](_0x5411b4,{'transaction':_0x242313})['then'](function(){return BPromise[_0x3071('0x76')](_0x25b492,function(_0x3e9573){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x3e9573['id'],'VoiceQueueId':_0x4ec86a['params']['id']},'defaults':{'penalty':_0x3e9573['penalty']},'transaction':_0x242313});});})[_0x3071('0x2a')](function(){return BPromise[_0x3071('0x76')](_['filter'](_0x25b492,{'online':!![]}),function(_0x1b0bb7){return db[_0x3071('0x77')][_0x3071('0x78')]({'membername':_0x1b0bb7[_0x3071('0x37')],'UserId':_0x1b0bb7['id'],'queue_name':_0x10a0c3[_0x3071('0x37')],'VoiceQueueId':_0x10a0c3['id'],'interface':_[_0x3071('0x79')](_0x1b0bb7[_0x3071('0x70')])?util[_0x3071('0x7a')](_0x3071('0x7b'),_0x1b0bb7[_0x3071('0x37')]):_0x1b0bb7[_0x3071('0x70')],'paused':_0x1b0bb7[_0x3071('0x6f')]||![],'penalty':_0x1b0bb7[_0x3071('0x73')]},{'transaction':_0x242313});});})['then'](function(){_0x25b492[_0x3071('0x72')](function(_0x9eb8e2){socket['emit'](_0x3071('0x7c'),{'UserId':_0x9eb8e2['id'],'VoiceQueueId':_0x10a0c3['id']});});});});});}})[_0x3071('0x2a')](respondWithStatusCode(_0x2b6fca,null))[_0x3071('0x4b')](handleError(_0x2b6fca,null));};exports[_0x3071('0x7d')]=function(_0x4e6536,_0x2bfae8,_0x363418){return db[_0x3071('0x7e')][_0x3071('0x49')]({'where':{'id':_0x4e6536['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x3071('0x6c')],'as':_0x3071('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x3071('0x2a')](handleEntityNotFound(_0x2bfae8,null))[_0x3071('0x2a')](function(_0x406ffe){var _0x2e4180=_[_0x3071('0x31')](_0x406ffe,'id');var _0x2fc3d5=[];var _0x4d2992=[];var _0x15f9b1=squel['select']();_0x15f9b1['field'](_0x3071('0x7f'))[_0x3071('0x80')]('team_has_voice_queues','tq')['join'](_0x3071('0x81'),'ut',_0x3071('0x82'))[_0x3071('0x45')](_0x3071('0x83'),_0x4e6536['params']['id']);for(var _0x6ad3d9=0x0;_0x6ad3d9<_0x406ffe[_0x3071('0x42')];_0x6ad3d9+=0x1){let _0x2bb0eb=_0x406ffe[_0x6ad3d9];for(var _0x15a2b6=0x0;_0x15a2b6<_0x2bb0eb[_0x3071('0x6d')]['length'];_0x15a2b6+=0x1){let _0x2bf807=_0x2bb0eb[_0x3071('0x6d')][_0x15a2b6];var _0x52b7a8=_0x15f9b1['clone']();_0x52b7a8['where'](_0x3071('0x84'),_0x2bf807['id']);_0x4d2992[_0x3071('0x85')](db[_0x3071('0x74')]['query'](_0x52b7a8[_0x3071('0x86')](),{'type':db[_0x3071('0x74')]['QueryTypes'][_0x3071('0x87')]})[_0x3071('0x2a')](function(_0x33efb9){if(_0x33efb9[_0x3071('0x42')]===0x1){return _0x2bf807['id'];}else{var _0x2a995c=_['every'](_['map'](_0x33efb9,_0x3071('0x88')),function(_0x20230c){return _[_0x3071('0x33')](_0x2e4180,_0x20230c);});if(_0x2a995c){return _0x2bf807['id'];}}}));}}return BPromise[_0x3071('0x89')](_0x4d2992)['then'](function(_0x5ed84d){_0x2fc3d5=_(_0x2fc3d5)[_0x3071('0x8a')](_0x5ed84d)[_0x3071('0x8b')]()['value']();return db[_0x3071('0x39')][_0x3071('0x35')]({'where':{'id':_0x4e6536[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](function(_0x4e1cfa){return db[_0x3071('0x74')][_0x3071('0x75')](function(_0x6f189a){return _0x4e1cfa[_0x3071('0x7d')](_0x4e6536['query'][_0x3071('0x8c')],{'transaction':_0x6f189a})[_0x3071('0x2a')](function(){if(!_['isEmpty'](_0x2fc3d5)){return _0x4e1cfa[_0x3071('0x8d')](_0x2fc3d5,{'transaction':_0x6f189a})[_0x3071('0x2a')](function(){return db[_0x3071('0x77')][_0x3071('0x29')]({'where':{'VoiceQueueId':_0x4e6536[_0x3071('0x59')]['id'],'UserId':_0x2fc3d5},'transaction':_0x6f189a});});}})['then'](function(){_0x2fc3d5[_0x3071('0x72')](function(_0x5ece4a){socket[_0x3071('0x8e')]('userVoiceQueue:remove',{'UserId':_0x5ece4a,'VoiceQueueId':_0x4e1cfa['id']});});});});});});})[_0x3071('0x2a')](respondWithStatusCode(_0x2bfae8,null))[_0x3071('0x4b')](handleError(_0x2bfae8,null));};exports[_0x3071('0x8f')]=function(_0x29746e,_0x4826a0,_0x2ba6c3){var _0xacb4a3,_0x21d250;return db['VoiceQueue'][_0x3071('0x35')]({'where':{'id':_0x29746e[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x4826a0,null))['then'](function(_0x25eca6){if(_0x25eca6){_0x21d250=_0x25eca6;return _0x25eca6[_0x3071('0x8f')](_0x29746e[_0x3071('0x50')][_0x3071('0x8c')],_[_0x3071('0x5a')](_0x29746e['body'],[_0x3071('0x8c'),'id'])||{})[_0x3071('0x90')](function(_0x1179ff){for(var _0xceab08=0x0;_0xceab08<_0x29746e['body'][_0x3071('0x8c')][_0x3071('0x42')];_0xceab08+=0x1){socket[_0x3071('0x8e')](_0x3071('0x7c'),{'UserId':_0x29746e[_0x3071('0x50')][_0x3071('0x8c')][_0xceab08],'VoiceQueueId':_0x29746e[_0x3071('0x59')]['id']});}return _0x1179ff;});}})[_0x3071('0x2a')](function(_0x4c7b0d){_0xacb4a3=_0x4c7b0d||[];if(_0x21d250){return db['User'][_0x3071('0x49')]({'where':{'id':_0x29746e[_0x3071('0x50')]['ids']},'attributes':['id',_0x3071('0x37'),_0x3071('0x6e'),_0x3071('0x6f'),_0x3071('0x70')],'raw':!![]});}})[_0x3071('0x2a')](function(_0x1a769a){if(!_[_0x3071('0x91')](_0x1a769a)){var _0x55f5c4=[];for(var _0x1c85bc=0x0;_0x1c85bc<_0x1a769a[_0x3071('0x42')];_0x1c85bc++){if(_0x1a769a[_0x1c85bc]['online']){_0x55f5c4[_0x3071('0x85')](db[_0x3071('0x77')][_0x3071('0x78')]({'membername':_0x1a769a[_0x1c85bc]['name'],'UserId':_0x1a769a[_0x1c85bc]['id'],'queue_name':_0x21d250[_0x3071('0x37')],'VoiceQueueId':_0x21d250['id'],'interface':_[_0x3071('0x79')](_0x1a769a[_0x1c85bc][_0x3071('0x70')])?util[_0x3071('0x7a')](_0x3071('0x7b'),_0x1a769a[_0x1c85bc][_0x3071('0x37')]):_0x1a769a[_0x1c85bc][_0x3071('0x70')],'paused':_0x1a769a[_0x1c85bc][_0x3071('0x6f')]||![],'penalty':_0x29746e['body'][_0x3071('0x73')]||0x0}));}}return BPromise[_0x3071('0x89')](_0x55f5c4);}})['then'](function(){return _0xacb4a3;})['then'](respondWithResult(_0x4826a0,null))[_0x3071('0x4b')](handleError(_0x4826a0,null));};exports['removeAgents']=function(_0x11d7b9,_0x589333,_0x5be17d){return db[_0x3071('0x39')][_0x3071('0x35')]({'where':{'id':_0x11d7b9[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x589333,null))[_0x3071('0x2a')](function(_0x6dc24d){if(_0x6dc24d){return _0x6dc24d['removeAgents'](_0x11d7b9[_0x3071('0x3c')][_0x3071('0x8c')])['then'](function(){if(_[_0x3071('0x92')](_0x11d7b9[_0x3071('0x3c')]['ids'])){for(var _0x17b3fd=0x0;_0x17b3fd<_0x11d7b9[_0x3071('0x3c')][_0x3071('0x8c')][_0x3071('0x42')];_0x17b3fd+=0x1){socket[_0x3071('0x8e')]('userVoiceQueue:remove',{'UserId':Number(_0x11d7b9[_0x3071('0x3c')][_0x3071('0x8c')][_0x17b3fd]),'VoiceQueueId':Number(_0x11d7b9[_0x3071('0x59')]['id'])});}}else{socket[_0x3071('0x8e')]('userVoiceQueue:remove',{'UserId':Number(_0x11d7b9['query'][_0x3071('0x8c')]),'VoiceQueueId':Number(_0x11d7b9[_0x3071('0x59')]['id'])});}});}})[_0x3071('0x2a')](function(_0x3a1bd3){return db[_0x3071('0x77')][_0x3071('0x29')]({'where':{'VoiceQueueId':_0x11d7b9[_0x3071('0x59')]['id'],'UserId':_0x11d7b9[_0x3071('0x3c')][_0x3071('0x8c')]}})[_0x3071('0x2a')](function(){return _0x3a1bd3;});})[_0x3071('0x2a')](respondWithStatusCode(_0x589333,null))[_0x3071('0x4b')](handleError(_0x589333,null));};exports['getAgents']=function(_0xce1615,_0x5a6594,_0x1dc10a){var _0x2acf72={};var _0x41a30d={};var _0x305958;var _0x393279;return db[_0x3071('0x39')][_0x3071('0x5f')]({'where':{'id':_0xce1615['params']['id']}})['then'](handleEntityNotFound(_0x5a6594,null))[_0x3071('0x2a')](function(_0x4f5f82){if(_0x4f5f82){_0x305958=_0x4f5f82;_0x41a30d['model']=_[_0x3071('0x3d')](db['User']['rawAttributes']);_0x41a30d[_0x3071('0x3c')]=_['keys'](_0xce1615[_0x3071('0x3c')]);_0x41a30d['filters']=_[_0x3071('0x3f')](_0x41a30d[_0x3071('0x3b')],_0x41a30d[_0x3071('0x3c')]);_0x2acf72[_0x3071('0x40')]=_['intersection'](_0x41a30d['model'],qs['fields'](_0xce1615[_0x3071('0x3c')][_0x3071('0x41')]));_0x2acf72[_0x3071('0x40')]=_0x2acf72['attributes'][_0x3071('0x42')]?_0x2acf72[_0x3071('0x40')]:_0x41a30d[_0x3071('0x3b')];_0x2acf72[_0x3071('0x62')]=qs['sort'](_0xce1615[_0x3071('0x3c')][_0x3071('0x44')]);_0x2acf72[_0x3071('0x45')]=qs[_0x3071('0x3e')](_[_0x3071('0x46')](_0xce1615[_0x3071('0x3c')],_0x41a30d[_0x3071('0x3e')]));if(_0xce1615['query'][_0x3071('0x2f')]){_0x2acf72[_0x3071('0x45')]=_[_0x3071('0x47')](_0x2acf72[_0x3071('0x45')],{'$or':_[_0x3071('0x31')](_0x2acf72[_0x3071('0x40')],function(_0x397892){var _0x4666fc={};_0x4666fc[_0x397892]={'$like':'%'+_0xce1615['query']['filter']+'%'};return _0x4666fc;})});}_0x2acf72=_[_0x3071('0x47')]({},_0x2acf72,_0xce1615[_0x3071('0x48')]);return _0x305958[_0x3071('0x93')](_0x2acf72);}})[_0x3071('0x2a')](function(_0x23e6b6){if(_0x23e6b6){_0x393279=_0x23e6b6['length'];if(!_0xce1615[_0x3071('0x3c')][_0x3071('0x43')]('nolimit')){_0x2acf72[_0x3071('0x24')]=qs['limit'](_0xce1615['query'][_0x3071('0x24')]);_0x2acf72[_0x3071('0x23')]=qs[_0x3071('0x23')](_0xce1615[_0x3071('0x3c')][_0x3071('0x23')]);}return _0x305958[_0x3071('0x93')](_0x2acf72);}})[_0x3071('0x2a')](function(_0x49b48e){if(_0x49b48e){return _0x49b48e?{'count':_0x393279,'rows':_0x49b48e}:null;}})[_0x3071('0x2a')](respondWithResult(_0x5a6594,null))[_0x3071('0x4b')](handleError(_0x5a6594,null));};exports['getMembers']=function(_0x16588c,_0x191207,_0x1ae9f5){var _0x1c78d8={};var _0x14e6bf={};var _0x46cb83;var _0x4d092a;return db[_0x3071('0x39')][_0x3071('0x5f')]({'where':{'id':_0x16588c[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x191207,null))[_0x3071('0x2a')](function(_0x2edcad){if(_0x2edcad){_0x46cb83=_0x2edcad;_0x14e6bf['model']=_[_0x3071('0x3d')](db['UserVoiceQueueRt'][_0x3071('0x4c')]);_0x14e6bf[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x16588c[_0x3071('0x3c')]);_0x14e6bf[_0x3071('0x3e')]=_['intersection'](_0x14e6bf[_0x3071('0x3b')],_0x14e6bf[_0x3071('0x3c')]);_0x1c78d8['attributes']=_['intersection'](_0x14e6bf[_0x3071('0x3b')],qs['fields'](_0x16588c[_0x3071('0x3c')]['fields']));_0x1c78d8[_0x3071('0x40')]=_0x1c78d8['attributes'][_0x3071('0x42')]?_0x1c78d8[_0x3071('0x40')]:_0x14e6bf[_0x3071('0x3b')];_0x1c78d8[_0x3071('0x62')]=qs[_0x3071('0x44')](_0x16588c[_0x3071('0x3c')]['sort']);_0x1c78d8[_0x3071('0x45')]=qs[_0x3071('0x3e')](_['pick'](_0x16588c[_0x3071('0x3c')],_0x14e6bf['filters']));if(_0x16588c['query'][_0x3071('0x2f')]){_0x1c78d8[_0x3071('0x45')]=_[_0x3071('0x47')](_0x1c78d8[_0x3071('0x45')],{'$or':_[_0x3071('0x31')](_0x1c78d8['attributes'],function(_0xa7c24b){var _0x3612fa={};_0x3612fa[_0xa7c24b]={'$like':'%'+_0x16588c[_0x3071('0x3c')][_0x3071('0x2f')]+'%'};return _0x3612fa;})});}_0x1c78d8=_[_0x3071('0x47')]({},_0x1c78d8,_0x16588c[_0x3071('0x48')]);return _0x46cb83[_0x3071('0x94')](_0x1c78d8);}})[_0x3071('0x2a')](function(_0x5b0ec5){if(_0x5b0ec5){_0x4d092a=_0x5b0ec5['length'];if(!_0x16588c[_0x3071('0x3c')]['hasOwnProperty'](_0x3071('0x61'))){_0x1c78d8[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x16588c['query']['limit']);_0x1c78d8[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x16588c[_0x3071('0x3c')][_0x3071('0x23')]);}return _0x46cb83['getMembers'](_0x1c78d8);}})[_0x3071('0x2a')](function(_0x290db0){return _0x290db0?{'count':_0x4d092a,'rows':_0x290db0}:null;})[_0x3071('0x2a')](respondWithResult(_0x191207,null))[_0x3071('0x4b')](handleError(_0x191207,null));};exports[_0x3071('0x95')]=function(_0x5deca4,_0x33583a,_0x390b60){var _0x4c63ee={};var _0x476765={};var _0x1bb3d7;var _0x59bb52;return db['VoiceQueue'][_0x3071('0x5f')]({'where':{'id':_0x5deca4[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x33583a,null))[_0x3071('0x2a')](function(_0x241c34){if(_0x241c34){_0x1bb3d7=_0x241c34;_0x476765[_0x3071('0x3b')]=_[_0x3071('0x3d')](db['CmList'][_0x3071('0x4c')]);_0x476765[_0x3071('0x3c')]=_['keys'](_0x5deca4[_0x3071('0x3c')]);_0x476765['filters']=_[_0x3071('0x3f')](_0x476765['model'],_0x476765[_0x3071('0x3c')]);_0x4c63ee[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x476765[_0x3071('0x3b')],qs[_0x3071('0x41')](_0x5deca4[_0x3071('0x3c')][_0x3071('0x41')]));_0x4c63ee[_0x3071('0x40')]=_0x4c63ee[_0x3071('0x40')][_0x3071('0x42')]?_0x4c63ee[_0x3071('0x40')]:_0x476765['model'];_0x4c63ee[_0x3071('0x62')]=qs[_0x3071('0x44')](_0x5deca4[_0x3071('0x3c')][_0x3071('0x44')]);_0x4c63ee['where']=qs['filters'](_[_0x3071('0x46')](_0x5deca4['query'],_0x476765['filters']));if(_0x5deca4[_0x3071('0x3c')][_0x3071('0x2f')]){_0x4c63ee['where']=_[_0x3071('0x47')](_0x4c63ee['where'],{'$or':_[_0x3071('0x31')](_0x4c63ee[_0x3071('0x40')],function(_0x3762a4){var _0x4285a2={};_0x4285a2[_0x3762a4]={'$like':'%'+_0x5deca4[_0x3071('0x3c')]['filter']+'%'};return _0x4285a2;})});}_0x4c63ee=_[_0x3071('0x47')]({},_0x4c63ee,_0x5deca4[_0x3071('0x48')]);return _0x1bb3d7[_0x3071('0x95')](_0x4c63ee);}})[_0x3071('0x2a')](function(_0x10b3f1){if(_0x10b3f1){_0x59bb52=_0x10b3f1[_0x3071('0x42')];if(!_0x5deca4[_0x3071('0x3c')]['hasOwnProperty'](_0x3071('0x61'))){_0x4c63ee[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x5deca4[_0x3071('0x3c')]['limit']);_0x4c63ee[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x5deca4['query'][_0x3071('0x23')]);}return _0x1bb3d7[_0x3071('0x95')](_0x4c63ee);}})[_0x3071('0x2a')](function(_0x430c53){if(_0x430c53){return _0x430c53?{'count':_0x59bb52,'rows':_0x430c53}:null;}})[_0x3071('0x2a')](respondWithResult(_0x33583a,null))[_0x3071('0x4b')](handleError(_0x33583a,null));};exports[_0x3071('0x96')]=function(_0x50cb8c,_0x13d977,_0x2973b7){var _0x4d0f2a,_0x19b73d;return db['VoiceQueue'][_0x3071('0x35')]({'where':{'id':_0x50cb8c[_0x3071('0x59')]['id']}})['then'](handleEntityNotFound(_0x13d977,null))[_0x3071('0x2a')](function(_0x4957b4){if(_0x4957b4){_0x19b73d=_0x4957b4;return _0x4957b4[_0x3071('0x96')](_0x50cb8c[_0x3071('0x50')][_0x3071('0x8c')],_[_0x3071('0x5a')](_0x50cb8c[_0x3071('0x50')],[_0x3071('0x8c'),'id'])||{});}return null;})[_0x3071('0x90')](function(_0x5db057){var _0x4eb2f0;_0x4d0f2a=_0x5db057||[];var _0x51e4b1=[];if(_0x5db057){for(var _0x4b9aad=0x0;_0x4b9aad<_0x5db057[_0x3071('0x42')];_0x4b9aad+=0x1){var _0x35bf60=_0x5db057[_0x4b9aad][_0x3071('0x2b')]({'plain':!![]});_0x19b73d[_0x3071('0x97')]=_0x50cb8c[_0x3071('0x50')][_0x3071('0x97')]?_0x50cb8c[_0x3071('0x50')][_0x3071('0x97')]:_0x19b73d[_0x3071('0x97')];switch(_0x19b73d[_0x3071('0x97')]){case _0x3071('0x98'):_0x4eb2f0=squel[_0x3071('0x99')]()[_0x3071('0x9a')]('cm_hopper')['fromQuery']([_0x3071('0x9b'),_0x3071('0x9c'),_0x3071('0x9d'),_0x3071('0x9e'),_0x3071('0x65'),_0x3071('0x5b'),'updatedAt'],squel[_0x3071('0x9f')]()[_0x3071('0xa0')](_0x3071('0x9b'),_0x3071('0x9b'))[_0x3071('0xa0')](_0x3071('0xa1'),'scheduledAt')[_0x3071('0xa0')]('id',_0x3071('0x9d'))[_0x3071('0xa0')](_0x35bf60[_0x3071('0xa2')][_0x3071('0x86')](),_0x3071('0x9e'))['field'](_0x50cb8c['params']['id'][_0x3071('0x86')](),_0x3071('0x65'))['field'](_0x3071('0xa1'),_0x3071('0x5b'))[_0x3071('0xa0')](_0x3071('0xa1'),_0x3071('0x5c'))[_0x3071('0x80')](_0x3071('0xa3'))[_0x3071('0x45')](_0x3071('0xa4'))[_0x3071('0x45')](_0x3071('0xa5'),_0x35bf60[_0x3071('0xa2')][_0x3071('0x86')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x3071('0x45')](_0x3071('0xa6'),squel[_0x3071('0x9f')]()[_0x3071('0xa0')]('COALESCE(calleridnum,\x27\x27)')['from'](_0x3071('0xa7'))[_0x3071('0x45')](_0x3071('0x83'),_0x50cb8c[_0x3071('0x59')]['id']['toString']()))['where'](_0x3071('0xa6'),squel['select']()[_0x3071('0xa0')](_0x3071('0xa8'))[_0x3071('0x80')](_0x3071('0xa9'))[_0x3071('0x45')](_0x3071('0x83'),_0x50cb8c[_0x3071('0x59')]['id'][_0x3071('0x86')]())))[_0x3071('0x86')]();break;case _0x3071('0xaa'):_0x4eb2f0=squel[_0x3071('0x99')]()[_0x3071('0x9a')](_0x3071('0xa9'))[_0x3071('0xab')](['phone',_0x3071('0x9c'),_0x3071('0x9d'),_0x3071('0x9e'),_0x3071('0x65'),_0x3071('0x5b'),_0x3071('0x5c')],squel['select']()[_0x3071('0xa0')]('phone',_0x3071('0x9b'))[_0x3071('0xa0')](_0x3071('0xa1'),_0x3071('0x9c'))['field']('id',_0x3071('0x9d'))[_0x3071('0xa0')](_0x35bf60[_0x3071('0xa2')][_0x3071('0x86')](),_0x3071('0x9e'))[_0x3071('0xa0')](_0x50cb8c[_0x3071('0x59')]['id'][_0x3071('0x86')](),'VoiceQueueId')[_0x3071('0xa0')](_0x3071('0xa1'),_0x3071('0x5b'))['field'](_0x3071('0xa1'),'updatedAt')[_0x3071('0x80')](_0x3071('0xa3'))[_0x3071('0x45')]('deletedAt\x20IS\x20NULL')['where'](_0x3071('0xa5'),_0x35bf60[_0x3071('0xa2')][_0x3071('0x86')]())[_0x3071('0x45')](_0x3071('0xac'))[_0x3071('0x45')](_0x3071('0xa6'),squel[_0x3071('0x9f')]()[_0x3071('0xa0')](_0x3071('0xa8'))[_0x3071('0x80')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x50cb8c[_0x3071('0x59')]['id'][_0x3071('0x86')]())))['toString']();break;default:_0x4eb2f0=squel[_0x3071('0x99')]()[_0x3071('0x9a')](_0x3071('0xa9'))[_0x3071('0xab')]([_0x3071('0x9b'),_0x3071('0x9c'),_0x3071('0x9d'),_0x3071('0x9e'),'VoiceQueueId',_0x3071('0x5b'),_0x3071('0x5c')],squel[_0x3071('0x9f')]()['field'](_0x3071('0x9b'),_0x3071('0x9b'))[_0x3071('0xa0')](_0x3071('0xa1'),_0x3071('0x9c'))['field']('id',_0x3071('0x9d'))[_0x3071('0xa0')](_0x35bf60[_0x3071('0xa2')][_0x3071('0x86')](),'ListId')[_0x3071('0xa0')](_0x50cb8c[_0x3071('0x59')]['id'][_0x3071('0x86')](),_0x3071('0x65'))[_0x3071('0xa0')]('NOW()',_0x3071('0x5b'))['field']('NOW()',_0x3071('0x5c'))[_0x3071('0x80')](_0x3071('0xa3'))['where'](_0x3071('0xa4'))['where'](_0x3071('0xa5'),_0x35bf60[_0x3071('0xa2')]['toString']())[_0x3071('0x45')](_0x3071('0xac')))[_0x3071('0x86')]();}_0x51e4b1['push'](db[_0x3071('0x74')][_0x3071('0x3c')](_0x4eb2f0));}return BPromise[_0x3071('0x89')](_0x51e4b1);}})[_0x3071('0x2a')](function(){return _0x4d0f2a;})[_0x3071('0x2a')](respondWithResult(_0x13d977,null))[_0x3071('0x4b')](handleError(_0x13d977,null));};exports[_0x3071('0xad')]=function(_0x41f46a,_0x453fa6,_0x80af16){return db['VoiceQueue'][_0x3071('0x35')]({'where':{'id':_0x41f46a[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x453fa6,null))[_0x3071('0x2a')](function(_0x18fbc3){if(_0x18fbc3){return _0x18fbc3[_0x3071('0xad')](_0x41f46a[_0x3071('0x3c')][_0x3071('0x8c')]);}})[_0x3071('0x2a')](function(_0x2673a5){if(_0x2673a5){return db['CmHopper'][_0x3071('0x29')]({'where':{'ListId':_0x41f46a[_0x3071('0x3c')]['ids'],'VoiceQueueId':_0x41f46a['params']['id']}})[_0x3071('0x2a')](function(){return _0x2673a5;});}})[_0x3071('0x2a')](respondWithStatusCode(_0x453fa6,null))[_0x3071('0x4b')](handleError(_0x453fa6,null));};exports[_0x3071('0xae')]=function(_0x3d957e,_0x401cc5,_0xb08066){var _0x2f5966={};var _0x58557e={};var _0xc3f6f9;var _0x21f445;return db[_0x3071('0x39')]['findOne']({'where':{'id':_0x3d957e[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x401cc5,null))['then'](function(_0x46f138){if(_0x46f138){_0xc3f6f9=_0x46f138;_0x58557e[_0x3071('0x3b')]=_[_0x3071('0x3d')](db[_0x3071('0xaf')][_0x3071('0x4c')]);_0x58557e[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x3d957e[_0x3071('0x3c')]);_0x58557e[_0x3071('0x3e')]=_['intersection'](_0x58557e['model'],_0x58557e[_0x3071('0x3c')]);_0x2f5966['attributes']=_['intersection'](_0x58557e[_0x3071('0x3b')],qs[_0x3071('0x41')](_0x3d957e[_0x3071('0x3c')][_0x3071('0x41')]));_0x2f5966['attributes']=_0x2f5966['attributes']['length']?_0x2f5966[_0x3071('0x40')]:_0x58557e[_0x3071('0x3b')];_0x2f5966[_0x3071('0x62')]=qs[_0x3071('0x44')](_0x3d957e['query'][_0x3071('0x44')]);_0x2f5966[_0x3071('0x45')]=qs['filters'](_[_0x3071('0x46')](_0x3d957e['query'],_0x58557e['filters']));if(_0x3d957e[_0x3071('0x3c')][_0x3071('0x2f')]){_0x2f5966[_0x3071('0x45')]=_[_0x3071('0x47')](_0x2f5966[_0x3071('0x45')],{'$or':_[_0x3071('0x31')](_0x2f5966['attributes'],function(_0x39bf1d){var _0x1e703b={};_0x1e703b[_0x39bf1d]={'$like':'%'+_0x3d957e[_0x3071('0x3c')][_0x3071('0x2f')]+'%'};return _0x1e703b;})});}_0x2f5966=_[_0x3071('0x47')]({},_0x2f5966,_0x3d957e[_0x3071('0x48')]);return _0xc3f6f9[_0x3071('0xae')](_0x2f5966);}})[_0x3071('0x2a')](function(_0x56642a){if(_0x56642a){_0x21f445=_0x56642a[_0x3071('0x42')];if(!_0x3d957e['query'][_0x3071('0x43')](_0x3071('0x61'))){_0x2f5966[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x3d957e['query'][_0x3071('0x24')]);_0x2f5966[_0x3071('0x23')]=qs['offset'](_0x3d957e[_0x3071('0x3c')][_0x3071('0x23')]);}return _0xc3f6f9[_0x3071('0xae')](_0x2f5966);}})[_0x3071('0x2a')](function(_0x46f8cf){if(_0x46f8cf){return _0x46f8cf?{'count':_0x21f445,'rows':_0x46f8cf}:null;}})[_0x3071('0x2a')](respondWithResult(_0x401cc5,null))[_0x3071('0x4b')](handleError(_0x401cc5,null));};exports[_0x3071('0xb0')]=function(_0x2b92f5,_0x369200,_0x4287b4){var _0x43860c,_0x185fef;return db[_0x3071('0x39')]['find']({'where':{'id':_0x2b92f5[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x369200,null))['then'](function(_0x3543bb){if(_0x3543bb){_0x185fef=_0x3543bb;return _0x3543bb[_0x3071('0xb0')](_0x2b92f5['body'][_0x3071('0x8c')],_[_0x3071('0x5a')](_0x2b92f5[_0x3071('0x50')],[_0x3071('0x8c'),'id'])||{});}return null;})[_0x3071('0x90')](function(_0x27a834){var _0x624078;_0x43860c=_0x27a834||[];var _0x911c8c=[];if(_0x27a834){for(var _0x32776b=0x0;_0x32776b<_0x27a834[_0x3071('0x42')];_0x32776b+=0x1){var _0x5a98c7=_0x27a834[_0x32776b]['get']({'plain':!![]});_0x624078=squel[_0x3071('0x99')]()[_0x3071('0x9a')]('cm_hopper_black')[_0x3071('0xab')]([_0x3071('0x9b'),_0x3071('0x9d'),'ListId','VoiceQueueId',_0x3071('0x5b'),_0x3071('0x5c')],squel[_0x3071('0x9f')]()[_0x3071('0xa0')]('phone',_0x3071('0x9b'))['field']('id',_0x3071('0x9d'))[_0x3071('0xa0')](_0x5a98c7[_0x3071('0xa2')][_0x3071('0x86')](),'ListId')['field'](_0x2b92f5[_0x3071('0x59')]['id'][_0x3071('0x86')](),_0x3071('0x65'))[_0x3071('0xa0')]('NOW()','createdAt')['field']('NOW()',_0x3071('0x5c'))[_0x3071('0x80')](_0x3071('0xa3'))[_0x3071('0x45')](_0x3071('0xa4'))[_0x3071('0x45')]('ListId\x20=\x20?',_0x5a98c7[_0x3071('0xa2')][_0x3071('0x86')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x3071('0x86')]();_0x911c8c[_0x3071('0x85')](db[_0x3071('0x74')][_0x3071('0x3c')](_0x624078));}return BPromise[_0x3071('0x89')](_0x911c8c);}})['then'](function(){return _0x43860c;})[_0x3071('0x2a')](respondWithResult(_0x369200,null))[_0x3071('0x4b')](handleError(_0x369200,null));};exports['removeBlackLists']=function(_0x2c9ebe,_0x16f73b,_0xb628a){return db[_0x3071('0x39')]['find']({'where':{'id':_0x2c9ebe[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x16f73b,null))[_0x3071('0x2a')](function(_0x57dc29){if(_0x57dc29){return _0x57dc29[_0x3071('0xb1')](_0x2c9ebe[_0x3071('0x3c')][_0x3071('0x8c')]);}})[_0x3071('0x2a')](function(_0x41fb16){if(_0x41fb16){return db[_0x3071('0x68')]['destroy']({'where':{'ListId':_0x2c9ebe[_0x3071('0x3c')]['ids'],'VoiceQueueId':_0x2c9ebe[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](function(){return _0x41fb16;});}})[_0x3071('0x2a')](respondWithStatusCode(_0x16f73b,null))[_0x3071('0x4b')](handleError(_0x16f73b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 469d891..c5f0dae 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 _0x8e05=['hook','exports','events','../../mysqldb','VoiceQueue','save','update','remove','emit','hasOwnProperty'];(function(_0x3c23da,_0x5a89fb){var _0x38b280=function(_0x3a30ff){while(--_0x3a30ff){_0x3c23da['push'](_0x3c23da['shift']());}};_0x38b280(++_0x5a89fb);}(_0x8e05,0x70));var _0x58e0=function(_0x5a1cc9,_0x28f54d){_0x5a1cc9=_0x5a1cc9-0x0;var _0x471761=_0x8e05[_0x5a1cc9];return _0x471761;};'use strict';var EventEmitter=require(_0x58e0('0x0'));var VoiceQueue=require(_0x58e0('0x1'))['db'][_0x58e0('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x58e0('0x3'),'afterUpdate':_0x58e0('0x4'),'afterDestroy':_0x58e0('0x5')};function emitEvent(_0xf4c911){return function(_0x3dd6cf,_0x5d2244,_0x464045){VoiceQueueEvents[_0x58e0('0x6')](_0xf4c911+':'+_0x3dd6cf['id'],_0x3dd6cf);VoiceQueueEvents[_0x58e0('0x6')](_0xf4c911,_0x3dd6cf);_0x464045(null);};}for(var e in events){if(events[_0x58e0('0x7')](e)){var event=events[e];VoiceQueue[_0x58e0('0x8')](e,emitEvent(event));}}module[_0x58e0('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x34de=['../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0xaec50c,_0x11cfd1){var _0x15b23d=function(_0x3da97c){while(--_0x3da97c){_0xaec50c['push'](_0xaec50c['shift']());}};_0x15b23d(++_0x11cfd1);}(_0x34de,0x120));var _0xe34d=function(_0x2f0e03,_0x238418){_0x2f0e03=_0x2f0e03-0x0;var _0x1b5588=_0x34de[_0x2f0e03];return _0x1b5588;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xe34d('0x0'))['db'][_0xe34d('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xe34d('0x2')](0x0);var events={'afterCreate':_0xe34d('0x3'),'afterUpdate':_0xe34d('0x4'),'afterDestroy':_0xe34d('0x5')};function emitEvent(_0x308e1a){return function(_0x336f0b,_0x42502a,_0x18a0d5){VoiceQueueEvents[_0xe34d('0x6')](_0x308e1a+':'+_0x336f0b['id'],_0x336f0b);VoiceQueueEvents[_0xe34d('0x6')](_0x308e1a,_0x336f0b);_0x18a0d5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xe34d('0x7')](e,emitEvent(event));}}module[_0xe34d('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 1a87011..6fbc642 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 _0xeeba=['path','rimraf','../../config/environment','./voiceQueue.attributes','define','voice_queues','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x56f2d2,_0x39ad70){var _0x52628d=function(_0x135f1b){while(--_0x135f1b){_0x56f2d2['push'](_0x56f2d2['shift']());}};_0x52628d(++_0x39ad70);}(_0xeeba,0x13a));var _0xaeeb=function(_0x12fdb0,_0x2af26c){_0x12fdb0=_0x12fdb0-0x0;var _0x4f868f=_0xeeba[_0x12fdb0];return _0x4f868f;};'use strict';var _=require('lodash');var util=require(_0xaeeb('0x0'));var logger=require(_0xaeeb('0x1'))('api');var moment=require(_0xaeeb('0x2'));var BPromise=require(_0xaeeb('0x3'));var rp=require(_0xaeeb('0x4'));var fs=require('fs');var path=require(_0xaeeb('0x5'));var rimraf=require(_0xaeeb('0x6'));var config=require(_0xaeeb('0x7'));var attributes=require(_0xaeeb('0x8'));module['exports']=function(_0x3e5c99,_0x5e8866){return _0x3e5c99[_0xaeeb('0x9')]('VoiceQueue',attributes,{'tableName':_0xaeeb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x640e=['define','VoiceQueue','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0xe5ebae,_0x3d64f4){var _0x1188bd=function(_0x25df0e){while(--_0x25df0e){_0xe5ebae['push'](_0xe5ebae['shift']());}};_0x1188bd(++_0x3d64f4);}(_0x640e,0xd4));var _0xe640=function(_0x3a04ab,_0x31b9fd){_0x3a04ab=_0x3a04ab-0x0;var _0x4bff6d=_0x640e[_0x3a04ab];return _0x4bff6d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe640('0x0'));var moment=require(_0xe640('0x1'));var BPromise=require(_0xe640('0x2'));var rp=require(_0xe640('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe640('0x4'));var config=require(_0xe640('0x5'));var attributes=require(_0xe640('0x6'));module[_0xe640('0x7')]=function(_0x316130,_0x45abe8){return _0x316130[_0xe640('0x8')](_0xe640('0x9'),attributes,{'tableName':'voice_queues','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 923b337..b53001c 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 _0x6065=['../../config/utils','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','limit','include','map','model','debug','catch','ShowVoiceQueue','raw','then','util','moment','bluebird'];(function(_0x4715d2,_0x3371b2){var _0x141811=function(_0x520bc6){while(--_0x520bc6){_0x4715d2['push'](_0x4715d2['shift']());}};_0x141811(++_0x3371b2);}(_0x6065,0x125));var _0x5606=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x6065[_0x5bd426];return _0x23a7eb;};'use strict';var _=require('lodash');var util=require(_0x5606('0x0'));var moment=require(_0x5606('0x1'));var BPromise=require(_0x5606('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5606('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5606('0x4'));var client=jayson[_0x5606('0x5')][_0x5606('0x6')]({'port':0x232a});config[_0x5606('0x7')]=_[_0x5606('0x8')](config[_0x5606('0x7')],{'host':_0x5606('0x9'),'port':0x18eb});var socket=require(_0x5606('0xa'))(new Redis(config[_0x5606('0x7')]));require(_0x5606('0xb'))[_0x5606('0xc')](socket);function respondWithRpcPromise(_0x736fbd,_0x337a44,_0x323380){return new BPromise(function(_0x5188b3,_0x4d0013){return client[_0x5606('0xd')](_0x736fbd,_0x323380)['then'](function(_0x2e196b){logger[_0x5606('0xe')](_0x5606('0xf'),_0x337a44,_0x5606('0x10'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x337a44,_0x5606('0x10'),JSON[_0x5606('0x11')](_0x2e196b));if(_0x2e196b[_0x5606('0x12')]){if(_0x2e196b[_0x5606('0x12')][_0x5606('0x13')]===0x1f4){logger[_0x5606('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x337a44,_0x2e196b[_0x5606('0x12')][_0x5606('0x14')]);return _0x4d0013(_0x2e196b[_0x5606('0x12')]['message']);}logger['error'](_0x5606('0xf'),_0x337a44,_0x2e196b[_0x5606('0x12')][_0x5606('0x14')]);return _0x5188b3(_0x2e196b[_0x5606('0x12')][_0x5606('0x14')]);}else{logger[_0x5606('0xe')](_0x5606('0xf'),_0x337a44,_0x5606('0x10'));_0x5188b3(_0x2e196b[_0x5606('0x15')]['message']);}})['catch'](function(_0xc3011d){logger[_0x5606('0x12')](_0x5606('0xf'),_0x337a44,_0xc3011d);_0x4d0013(_0xc3011d);});});}exports[_0x5606('0x16')]=function(_0x1f613b){var _0x2b8e47=this;return new Promise(function(_0x6fa80b,_0x221eb2){return db[_0x5606('0x17')][_0x5606('0x18')]({'raw':_0x1f613b['options']?_0x1f613b[_0x5606('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1f613b[_0x5606('0x19')]?_0x1f613b[_0x5606('0x19')][_0x5606('0x1a')]||null:null,'attributes':_0x1f613b[_0x5606('0x19')]?_0x1f613b[_0x5606('0x19')][_0x5606('0x1b')]||null:null,'limit':_0x1f613b[_0x5606('0x19')]?_0x1f613b[_0x5606('0x19')][_0x5606('0x1c')]||null:null,'include':_0x1f613b[_0x5606('0x19')]?_0x1f613b[_0x5606('0x19')][_0x5606('0x1d')]?_[_0x5606('0x1e')](_0x1f613b[_0x5606('0x19')][_0x5606('0x1d')],function(_0x314c6f){return{'model':db[_0x314c6f[_0x5606('0x1f')]],'as':_0x314c6f['as'],'attributes':_0x314c6f['attributes'],'include':_0x314c6f[_0x5606('0x1d')]?_[_0x5606('0x1e')](_0x314c6f[_0x5606('0x1d')],function(_0x992662){return{'model':db[_0x992662[_0x5606('0x1f')]],'as':_0x992662['as'],'attributes':_0x992662[_0x5606('0x1b')],'include':_0x992662[_0x5606('0x1d')]?_[_0x5606('0x1e')](_0x992662[_0x5606('0x1d')],function(_0x2f6239){return{'model':db[_0x2f6239['model']],'as':_0x2f6239['as'],'attributes':_0x2f6239[_0x5606('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18d492){logger['info'](_0x5606('0x16'),_0x1f613b);logger[_0x5606('0x20')](_0x5606('0x16'),_0x1f613b,JSON[_0x5606('0x11')](_0x18d492));_0x6fa80b(_0x18d492);})[_0x5606('0x21')](function(_0x27c0e0){logger['error']('GetVoiceQueue',_0x27c0e0[_0x5606('0x14')],_0x1f613b);_0x221eb2(_0x2b8e47[_0x5606('0x12')](0x1f4,_0x27c0e0[_0x5606('0x14')]));});});};exports[_0x5606('0x22')]=function(_0x5cd461){var _0x2e4c21=this;return new Promise(function(_0x3d98af,_0x4a374f){return db[_0x5606('0x17')]['find']({'raw':_0x5cd461['options']?_0x5cd461[_0x5606('0x19')][_0x5606('0x23')]===undefined?!![]:![]:!![],'where':_0x5cd461[_0x5606('0x19')]?_0x5cd461[_0x5606('0x19')][_0x5606('0x1a')]||null:null,'attributes':_0x5cd461[_0x5606('0x19')]?_0x5cd461['options'][_0x5606('0x1b')]||null:null,'include':_0x5cd461[_0x5606('0x19')]?_0x5cd461[_0x5606('0x19')][_0x5606('0x1d')]?_[_0x5606('0x1e')](_0x5cd461[_0x5606('0x19')][_0x5606('0x1d')],function(_0x1b0368){return{'model':db[_0x1b0368['model']],'as':_0x1b0368['as'],'attributes':_0x1b0368[_0x5606('0x1b')],'include':_0x1b0368['include']?_[_0x5606('0x1e')](_0x1b0368[_0x5606('0x1d')],function(_0x398a33){return{'model':db[_0x398a33[_0x5606('0x1f')]],'as':_0x398a33['as'],'attributes':_0x398a33[_0x5606('0x1b')],'include':_0x398a33[_0x5606('0x1d')]?_['map'](_0x398a33[_0x5606('0x1d')],function(_0x155fa5){return{'model':db[_0x155fa5[_0x5606('0x1f')]],'as':_0x155fa5['as'],'attributes':_0x155fa5[_0x5606('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5606('0x24')](function(_0x5c670d){logger[_0x5606('0xe')](_0x5606('0x22'),_0x5cd461);logger[_0x5606('0x20')]('ShowVoiceQueue',_0x5cd461,JSON[_0x5606('0x11')](_0x5c670d));_0x3d98af(_0x5c670d);})[_0x5606('0x21')](function(_0x521e8b){logger[_0x5606('0x12')]('ShowVoiceQueue',_0x521e8b[_0x5606('0x14')],_0x5cd461);_0x4a374f(_0x2e4c21[_0x5606('0x12')](0x1f4,_0x521e8b['message']));});});}; \ No newline at end of file +var _0xd603=['then','GetVoiceQueue','debug','catch','ShowVoiceQueue','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','request','info','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueue,\x20%s,\x20%s','message','findAll','options','where','attributes','limit','map','include','model'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xd603,0x1e7));var _0x3d60=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0xd603[_0x54edc9];return _0x2ae7a9;};'use strict';var _=require(_0x3d60('0x0'));var util=require(_0x3d60('0x1'));var moment=require(_0x3d60('0x2'));var BPromise=require(_0x3d60('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d60('0x4'));var db=require(_0x3d60('0x5'))['db'];var utils=require(_0x3d60('0x6'));var logger=require(_0x3d60('0x7'))(_0x3d60('0x8'));var config=require(_0x3d60('0x9'));var jayson=require(_0x3d60('0xa'));var client=jayson['client'][_0x3d60('0xb')]({'port':0x232a});config[_0x3d60('0xc')]=_[_0x3d60('0xd')](config[_0x3d60('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d60('0xe'))(new Redis(config[_0x3d60('0xc')]));require(_0x3d60('0xf'))[_0x3d60('0x10')](socket);function respondWithRpcPromise(_0x22679e,_0x57c02b,_0x1b22a9){return new BPromise(function(_0x45f234,_0x2220ca){return client[_0x3d60('0x11')](_0x22679e,_0x1b22a9)['then'](function(_0x29479d){logger[_0x3d60('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x57c02b,_0x3d60('0x13'));logger['debug'](_0x3d60('0x14'),_0x57c02b,_0x3d60('0x13'),JSON[_0x3d60('0x15')](_0x29479d));if(_0x29479d[_0x3d60('0x16')]){if(_0x29479d[_0x3d60('0x16')]['code']===0x1f4){logger[_0x3d60('0x16')](_0x3d60('0x17'),_0x57c02b,_0x29479d['error'][_0x3d60('0x18')]);return _0x2220ca(_0x29479d[_0x3d60('0x16')][_0x3d60('0x18')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x57c02b,_0x29479d['error'][_0x3d60('0x18')]);return _0x45f234(_0x29479d['error'][_0x3d60('0x18')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x57c02b,_0x3d60('0x13'));_0x45f234(_0x29479d['result'][_0x3d60('0x18')]);}})['catch'](function(_0x46264e){logger[_0x3d60('0x16')](_0x3d60('0x17'),_0x57c02b,_0x46264e);_0x2220ca(_0x46264e);});});}exports['GetVoiceQueue']=function(_0x191b27){var _0x4d4244=this;return new Promise(function(_0x457c94,_0x1f4358){return db['VoiceQueue'][_0x3d60('0x19')]({'raw':_0x191b27[_0x3d60('0x1a')]?_0x191b27['options']['raw']===undefined?!![]:![]:!![],'where':_0x191b27[_0x3d60('0x1a')]?_0x191b27[_0x3d60('0x1a')][_0x3d60('0x1b')]||null:null,'attributes':_0x191b27[_0x3d60('0x1a')]?_0x191b27[_0x3d60('0x1a')][_0x3d60('0x1c')]||null:null,'limit':_0x191b27['options']?_0x191b27[_0x3d60('0x1a')][_0x3d60('0x1d')]||null:null,'include':_0x191b27[_0x3d60('0x1a')]?_0x191b27[_0x3d60('0x1a')]['include']?_[_0x3d60('0x1e')](_0x191b27[_0x3d60('0x1a')][_0x3d60('0x1f')],function(_0x220873){return{'model':db[_0x220873['model']],'as':_0x220873['as'],'attributes':_0x220873[_0x3d60('0x1c')],'include':_0x220873[_0x3d60('0x1f')]?_[_0x3d60('0x1e')](_0x220873['include'],function(_0x4b864e){return{'model':db[_0x4b864e[_0x3d60('0x20')]],'as':_0x4b864e['as'],'attributes':_0x4b864e[_0x3d60('0x1c')],'include':_0x4b864e[_0x3d60('0x1f')]?_[_0x3d60('0x1e')](_0x4b864e[_0x3d60('0x1f')],function(_0x40b4ac){return{'model':db[_0x40b4ac[_0x3d60('0x20')]],'as':_0x40b4ac['as'],'attributes':_0x40b4ac['attributes']};}):[]};}):[]};}):[]:[]})[_0x3d60('0x21')](function(_0x316494){logger[_0x3d60('0x12')](_0x3d60('0x22'),_0x191b27);logger[_0x3d60('0x23')](_0x3d60('0x22'),_0x191b27,JSON[_0x3d60('0x15')](_0x316494));_0x457c94(_0x316494);})[_0x3d60('0x24')](function(_0x420d3b){logger[_0x3d60('0x16')](_0x3d60('0x22'),_0x420d3b[_0x3d60('0x18')],_0x191b27);_0x1f4358(_0x4d4244['error'](0x1f4,_0x420d3b[_0x3d60('0x18')]));});});};exports[_0x3d60('0x25')]=function(_0x4b8ad5){var _0x1579bd=this;return new Promise(function(_0x5bd9fa,_0x14e3c8){return db['VoiceQueue'][_0x3d60('0x26')]({'raw':_0x4b8ad5[_0x3d60('0x1a')]?_0x4b8ad5[_0x3d60('0x1a')][_0x3d60('0x27')]===undefined?!![]:![]:!![],'where':_0x4b8ad5[_0x3d60('0x1a')]?_0x4b8ad5[_0x3d60('0x1a')]['where']||null:null,'attributes':_0x4b8ad5[_0x3d60('0x1a')]?_0x4b8ad5[_0x3d60('0x1a')][_0x3d60('0x1c')]||null:null,'include':_0x4b8ad5['options']?_0x4b8ad5[_0x3d60('0x1a')]['include']?_[_0x3d60('0x1e')](_0x4b8ad5['options']['include'],function(_0x2b409d){return{'model':db[_0x2b409d[_0x3d60('0x20')]],'as':_0x2b409d['as'],'attributes':_0x2b409d[_0x3d60('0x1c')],'include':_0x2b409d[_0x3d60('0x1f')]?_['map'](_0x2b409d[_0x3d60('0x1f')],function(_0x58136c){return{'model':db[_0x58136c[_0x3d60('0x20')]],'as':_0x58136c['as'],'attributes':_0x58136c[_0x3d60('0x1c')],'include':_0x58136c[_0x3d60('0x1f')]?_[_0x3d60('0x1e')](_0x58136c[_0x3d60('0x1f')],function(_0x48a2ae){return{'model':db[_0x48a2ae['model']],'as':_0x48a2ae['as'],'attributes':_0x48a2ae[_0x3d60('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47afc0){logger[_0x3d60('0x12')]('ShowVoiceQueue',_0x4b8ad5);logger['debug'](_0x3d60('0x25'),_0x4b8ad5,JSON[_0x3d60('0x15')](_0x47afc0));_0x5bd9fa(_0x47afc0);})[_0x3d60('0x24')](function(_0x315ca3){logger[_0x3d60('0x16')](_0x3d60('0x25'),_0x315ca3[_0x3d60('0x18')],_0x4b8ad5);_0x14e3c8(_0x1579bd['error'](0x1f4,_0x315ca3[_0x3d60('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 8f15d9d..be23264 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 _0xdceb=['length','voiceQueue:','save','update','emit','removeListener','register'];(function(_0x333683,_0x2e51dc){var _0x570c76=function(_0x2b51a2){while(--_0x2b51a2){_0x333683['push'](_0x333683['shift']());}};_0x570c76(++_0x2e51dc);}(_0xdceb,0x160));var _0xbdce=function(_0x11640f,_0x418b70){_0x11640f=_0x11640f-0x0;var _0x5ce380=_0xdceb[_0x11640f];return _0x5ce380;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xbdce('0x0'),'remove',_0xbdce('0x1')];function createListener(_0x26eefe,_0x2f6fc1){return function(_0x5e946a){_0x2f6fc1[_0xbdce('0x2')](_0x26eefe,_0x5e946a);};}function removeListener(_0x1ea360,_0x5d5527){return function(){VoiceQueueEvents[_0xbdce('0x3')](_0x1ea360,_0x5d5527);};}exports[_0xbdce('0x4')]=function(_0x140e28){for(var _0x524881=0x0,_0x155cc6=events[_0xbdce('0x5')];_0x524881<_0x155cc6;_0x524881++){var _0x3c7791=events[_0x524881];var _0x2af993=createListener(_0xbdce('0x6')+_0x3c7791,_0x140e28);VoiceQueueEvents['on'](_0x3c7791,_0x2af993);}}; \ No newline at end of file +var _0x5d2a=['removeListener','length','voiceQueue:','save','emit'];(function(_0x17553a,_0x462896){var _0x6ebe9e=function(_0x11c33f){while(--_0x11c33f){_0x17553a['push'](_0x17553a['shift']());}};_0x6ebe9e(++_0x462896);}(_0x5d2a,0x139));var _0xa5d2=function(_0x376987,_0x105cdd){_0x376987=_0x376987-0x0;var _0x2e6fa6=_0x5d2a[_0x376987];return _0x2e6fa6;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xa5d2('0x0'),'remove','update'];function createListener(_0x362e9b,_0x159a89){return function(_0xb4fd84){_0x159a89[_0xa5d2('0x1')](_0x362e9b,_0xb4fd84);};}function removeListener(_0x178c5f,_0x11c611){return function(){VoiceQueueEvents[_0xa5d2('0x2')](_0x178c5f,_0x11c611);};}exports['register']=function(_0x373397){for(var _0x43b112=0x0,_0xdafecb=events[_0xa5d2('0x3')];_0x43b112<_0xdafecb;_0x43b112++){var _0x378732=events[_0x43b112];var _0x4d9ded=createListener(_0xa5d2('0x4')+_0x378732,_0x373397);VoiceQueueEvents['on'](_0x378732,_0x4d9ded);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 9542276..69d6041 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 _0x9b0d=['put','update','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','describe','getVoiceQueuesReport','/:id','show','create'];(function(_0x1c8b72,_0x2ca4ed){var _0x4235d5=function(_0x317119){while(--_0x317119){_0x1c8b72['push'](_0x1c8b72['shift']());}};_0x4235d5(++_0x2ca4ed);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x61e612,_0x15a37a){_0x61e612=_0x61e612-0x0;var _0x1c6b54=_0x9b0d[_0x61e612];return _0x1c6b54;};'use strict';var multer=require('multer');var util=require(_0xd9b0('0x0'));var path=require(_0xd9b0('0x1'));var timeout=require(_0xd9b0('0x2'));var express=require(_0xd9b0('0x3'));var router=express['Router']();var auth=require(_0xd9b0('0x4'));var interaction=require(_0xd9b0('0x5'));var config=require(_0xd9b0('0x6'));var controller=require(_0xd9b0('0x7'));router['get']('/',auth[_0xd9b0('0x8')](),controller[_0xd9b0('0x9')]);router[_0xd9b0('0xa')](_0xd9b0('0xb'),auth[_0xd9b0('0x8')](),controller[_0xd9b0('0xc')]);router[_0xd9b0('0xa')]('/index',auth[_0xd9b0('0x8')](),controller[_0xd9b0('0xd')]);router['get'](_0xd9b0('0xe'),auth['isAuthenticated'](),controller[_0xd9b0('0xf')]);router['post']('/',auth[_0xd9b0('0x8')](),controller[_0xd9b0('0x10')]);router[_0xd9b0('0x11')](_0xd9b0('0xe'),auth[_0xd9b0('0x8')](),controller[_0xd9b0('0x12')]);router['delete'](_0xd9b0('0xe'),auth[_0xd9b0('0x8')](),controller['destroy']);module[_0xd9b0('0x13')]=router; \ No newline at end of file +var _0x33af=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','put','update','delete','destroy','util','connect-timeout','express','Router'];(function(_0x47df72,_0x4fea97){var _0xf7803=function(_0x4248ab){while(--_0x4248ab){_0x47df72['push'](_0x47df72['shift']());}};_0xf7803(++_0x4fea97);}(_0x33af,0xec));var _0xf33a=function(_0x470f24,_0x2436a9){_0x470f24=_0x470f24-0x0;var _0x2c6fc8=_0x33af[_0x470f24];return _0x2c6fc8;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var auth=require(_0xf33a('0x4'));var interaction=require(_0xf33a('0x5'));var config=require(_0xf33a('0x6'));var controller=require('./voiceQueueReport.controller');router[_0xf33a('0x7')]('/',auth[_0xf33a('0x8')](),controller['index']);router[_0xf33a('0x7')](_0xf33a('0x9'),auth[_0xf33a('0x8')](),controller[_0xf33a('0xa')]);router[_0xf33a('0x7')](_0xf33a('0xb'),auth['isAuthenticated'](),controller[_0xf33a('0xc')]);router[_0xf33a('0x7')](_0xf33a('0xd'),auth[_0xf33a('0x8')](),controller[_0xf33a('0xe')]);router[_0xf33a('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf33a('0x10')](_0xf33a('0xd'),auth[_0xf33a('0x8')](),controller[_0xf33a('0x11')]);router[_0xf33a('0x12')]('/:id',auth[_0xf33a('0x8')](),controller[_0xf33a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 1e30aee..93e27e1 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 _0xa9e0=['queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff'];(function(_0x54998c,_0x5861ca){var _0x1aa233=function(_0x2cb99a){while(--_0x2cb99a){_0x54998c['push'](_0x54998c['shift']());}};_0x1aa233(++_0x5861ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0a9e('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0a9e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x0a9e('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x0a9e('0x4')],'set':function(_0x991246){var _0x981158=moment(_0x991246);var _0x57b080=moment(this[_0x0a9e('0x5')](_0x0a9e('0x6')))[_0x0a9e('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x503809=_0x981158[_0x0a9e('0x8')](_0x57b080,'seconds');this['setDataValue'](_0x0a9e('0x9'),_0x991246);this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x503809||null);}},'position':{'type':Sequelize[_0x0a9e('0xc')]},'count':{'type':Sequelize[_0x0a9e('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x0a9e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0a9e('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x0a9e('0x3')],'comment':_0x0a9e('0xe')},'originalposition':{'type':Sequelize[_0x0a9e('0xc')]},'channel':{'type':Sequelize[_0x0a9e('0x3')]},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0a9e('0x3')]},'context':{'type':Sequelize[_0x0a9e('0x3')]},'exten':{'type':Sequelize[_0x0a9e('0x3')]},'priority':{'type':Sequelize[_0x0a9e('0x3')]},'holdtime':{'type':Sequelize[_0x0a9e('0xc')]},'mohtime':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0a9e('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0a9e('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x0a9e('0x3')]},'transferuniqueid':{'type':Sequelize[_0x0a9e('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0a9e('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0713=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0x3b7976,_0x540132){var _0x51fc0f=function(_0x5df4aa){while(--_0x5df4aa){_0x3b7976['push'](_0x3b7976['shift']());}};_0x51fc0f(++_0x540132);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3071('0x0')]={'type':{'type':Sequelize[_0x3071('0x1')]},'uniqueid':{'type':Sequelize[_0x3071('0x1')]},'calleridnum':{'type':Sequelize[_0x3071('0x1')]},'calleridname':{'type':Sequelize[_0x3071('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x3071('0x2')],'set':function(_0x33a70c){var _0x3137c8=moment(_0x33a70c);var _0xabd7b6=moment(this[_0x3071('0x3')](_0x3071('0x4')))[_0x3071('0x5')](_0x3071('0x6'));var _0x22274c=_0x3137c8[_0x3071('0x7')](_0xabd7b6,_0x3071('0x8'));this[_0x3071('0x9')]('queuecallerleaveAt',_0x33a70c);this[_0x3071('0x9')](_0x3071('0xa'),_0x22274c||null);}},'position':{'type':Sequelize[_0x3071('0xb')]},'count':{'type':Sequelize[_0x3071('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexit':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x3071('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x3071('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3071('0x1')]},'accountcode':{'type':Sequelize[_0x3071('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3071('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x3071('0xb')]},'mohtime':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3071('0x1')]},'transfer':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3071('0x1')],'comment':_0x3071('0xd')},'transferexten':{'type':Sequelize[_0x3071('0x1')]},'transferuniqueid':{'type':Sequelize[_0x3071('0x1')]},'disposition':{'type':Sequelize[_0x3071('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3071('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x3071('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 a32725c..08973c7 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 _0xa9e0=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','getVoiceQueuesReport','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox'];(function(_0x129d52,_0x1beadf){var _0x79ef89=function(_0x4913bb){while(--_0x4913bb){_0x129d52['push'](_0x129d52['shift']());}};_0x79ef89(++_0x1beadf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file +var _0xa9e0=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','getVoiceQueuesReport','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox'];(function(_0x2128b3,_0x11917d){var _0x4a17be=function(_0x560f27){while(--_0x560f27){_0x2128b3['push'](_0x2128b3['shift']());}};_0x4a17be(++_0x11917d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 9fb4024..d016d1e 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 _0x2af3=['emit','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove'];(function(_0x5f3730,_0x968294){var _0x387506=function(_0x350861){while(--_0x350861){_0x5f3730['push'](_0x5f3730['shift']());}};_0x387506(++_0x968294);}(_0x2af3,0xf1));var _0x32af=function(_0x9ab282,_0x224526){_0x9ab282=_0x9ab282-0x0;var _0x3ae406=_0x2af3[_0x9ab282];return _0x3ae406;};'use strict';var EventEmitter=require(_0x32af('0x0'));var VoiceQueueReport=require(_0x32af('0x1'))['db'][_0x32af('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x32af('0x3')](0x0);var events={'afterCreate':_0x32af('0x4'),'afterUpdate':_0x32af('0x5'),'afterDestroy':_0x32af('0x6')};function emitEvent(_0x3f2c39){return function(_0x306d4e,_0x3a9e77,_0x1c9f37){VoiceQueueReportEvents[_0x32af('0x7')](_0x3f2c39+':'+_0x306d4e['id'],_0x306d4e);VoiceQueueReportEvents[_0x32af('0x7')](_0x3f2c39,_0x306d4e);_0x1c9f37(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x6b29=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0x1e4e40,_0x151130){var _0x3fd329=function(_0xf55396){while(--_0xf55396){_0x1e4e40['push'](_0x1e4e40['shift']());}};_0x3fd329(++_0x151130);}(_0x6b29,0xc3));var _0x96b2=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0x6b29[_0x2f4c1c];return _0x25e0f2;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x96b2('0x0'))['db'][_0x96b2('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x96b2('0x2')](0x0);var events={'afterCreate':_0x96b2('0x3'),'afterUpdate':_0x96b2('0x4'),'afterDestroy':_0x96b2('0x5')};function emitEvent(_0x52e836){return function(_0x126aa2,_0x185042,_0x53d148){VoiceQueueReportEvents[_0x96b2('0x6')](_0x52e836+':'+_0x126aa2['id'],_0x126aa2);VoiceQueueReportEvents[_0x96b2('0x6')](_0x52e836,_0x126aa2);_0x53d148(null);};}for(var e in events){if(events[_0x96b2('0x7')](e)){var event=events[e];VoiceQueueReport[_0x96b2('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 134b962..abdf437 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 _0x5f2f=['VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceQueueReport.attributes','exports','define'];(function(_0x4e9310,_0x5296e4){var _0x346b79=function(_0x2b0d41){while(--_0x2b0d41){_0x4e9310['push'](_0x4e9310['shift']());}};_0x346b79(++_0x5296e4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x25fed3,_0x10699d){_0x25fed3=_0x25fed3-0x0;var _0x30ab7b=_0x5f2f[_0x25fed3];return _0x30ab7b;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xf5f2('0xc')]},{'fields':[_0xf5f2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2032=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0x2032,0xd9));var _0x2203=function(_0x5ec7de,_0x2c22e7){_0x5ec7de=_0x5ec7de-0x0;var _0x46320c=_0x2032[_0x5ec7de];return _0x46320c;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[{'fields':[_0x2203('0xc')]},{'fields':[_0x2203('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 6bc81a6..8684b99 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 _0x7d91=['defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','result','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','map','include','model','then','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis'];(function(_0x1f67c6,_0xb8e155){var _0x5ef17d=function(_0x2712ae){while(--_0x2712ae){_0x1f67c6['push'](_0x1f67c6['shift']());}};_0x5ef17d(++_0xb8e155);}(_0x7d91,0x10f));var _0x17d9=function(_0x4b8e63,_0x5cb5a9){_0x4b8e63=_0x4b8e63-0x0;var _0x28e347=_0x7d91[_0x4b8e63];return _0x28e347;};'use strict';var _=require('lodash');var util=require(_0x17d9('0x0'));var moment=require('moment');var BPromise=require(_0x17d9('0x1'));var rs=require(_0x17d9('0x2'));var fs=require('fs');var Redis=require(_0x17d9('0x3'));var db=require(_0x17d9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x17d9('0x5'))(_0x17d9('0x6'));var config=require(_0x17d9('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x17d9('0x8')]=_[_0x17d9('0x9')](config[_0x17d9('0x8')],{'host':_0x17d9('0xa'),'port':0x18eb});var socket=require(_0x17d9('0xb'))(new Redis(config['redis']));require(_0x17d9('0xc'))['register'](socket);function respondWithRpcPromise(_0x1e2fda,_0x1d1831,_0x107f8a){return new BPromise(function(_0x1ae114,_0x7b886b){return client['request'](_0x1e2fda,_0x107f8a)['then'](function(_0x5917b5){logger[_0x17d9('0xd')](_0x17d9('0xe'),_0x1d1831,'request\x20sent');logger[_0x17d9('0xf')](_0x17d9('0x10'),_0x1d1831,_0x17d9('0x11'),JSON[_0x17d9('0x12')](_0x5917b5));if(_0x5917b5[_0x17d9('0x13')]){if(_0x5917b5[_0x17d9('0x13')]['code']===0x1f4){logger[_0x17d9('0x13')](_0x17d9('0xe'),_0x1d1831,_0x5917b5[_0x17d9('0x13')]['message']);return _0x7b886b(_0x5917b5['error']['message']);}logger[_0x17d9('0x13')](_0x17d9('0xe'),_0x1d1831,_0x5917b5[_0x17d9('0x13')]['message']);return _0x1ae114(_0x5917b5[_0x17d9('0x13')]['message']);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x1d1831,_0x17d9('0x11'));_0x1ae114(_0x5917b5[_0x17d9('0x14')][_0x17d9('0x15')]);}})[_0x17d9('0x16')](function(_0x5e3c66){logger[_0x17d9('0x13')](_0x17d9('0xe'),_0x1d1831,_0x5e3c66);_0x7b886b(_0x5e3c66);});});}exports[_0x17d9('0x17')]=function(_0x3f54c6){var _0xfcc570=this;return new Promise(function(_0x464f76,_0x3531e0){return db[_0x17d9('0x18')][_0x17d9('0x19')]({'raw':_0x3f54c6[_0x17d9('0x1a')]?_0x3f54c6['options'][_0x17d9('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f54c6[_0x17d9('0x1a')]?_0x3f54c6[_0x17d9('0x1a')][_0x17d9('0x1c')]||null:null,'attributes':_0x3f54c6['options']?_0x3f54c6[_0x17d9('0x1a')][_0x17d9('0x1d')]||null:null,'limit':_0x3f54c6[_0x17d9('0x1a')]?_0x3f54c6['options'][_0x17d9('0x1e')]||null:null,'include':_0x3f54c6[_0x17d9('0x1a')]?_0x3f54c6['options']['include']?_[_0x17d9('0x1f')](_0x3f54c6[_0x17d9('0x1a')][_0x17d9('0x20')],function(_0x1766dc){return{'model':db[_0x1766dc['model']],'as':_0x1766dc['as'],'attributes':_0x1766dc[_0x17d9('0x1d')],'include':_0x1766dc[_0x17d9('0x20')]?_[_0x17d9('0x1f')](_0x1766dc[_0x17d9('0x20')],function(_0x53fe8d){return{'model':db[_0x53fe8d[_0x17d9('0x21')]],'as':_0x53fe8d['as'],'attributes':_0x53fe8d['attributes'],'include':_0x53fe8d[_0x17d9('0x20')]?_[_0x17d9('0x1f')](_0x53fe8d[_0x17d9('0x20')],function(_0x5b9c99){return{'model':db[_0x5b9c99[_0x17d9('0x21')]],'as':_0x5b9c99['as'],'attributes':_0x5b9c99['attributes']};}):[]};}):[]};}):[]:[]})[_0x17d9('0x22')](function(_0xfc9590){logger[_0x17d9('0xd')](_0x17d9('0x17'),_0x3f54c6);logger[_0x17d9('0xf')](_0x17d9('0x17'),_0x3f54c6,JSON[_0x17d9('0x12')](_0xfc9590));_0x464f76(_0xfc9590);})[_0x17d9('0x16')](function(_0x138abf){logger[_0x17d9('0x13')](_0x17d9('0x17'),_0x138abf['message'],_0x3f54c6);_0x3531e0(_0xfcc570[_0x17d9('0x13')](0x1f4,_0x138abf['message']));});});};exports[_0x17d9('0x23')]=function(_0x1356ba){var _0x3c2535=this;return new Promise(function(_0x4d06ce,_0x4ef3f6){return db[_0x17d9('0x18')][_0x17d9('0x24')](_0x1356ba[_0x17d9('0x25')],{'raw':_0x1356ba[_0x17d9('0x1a')]?_0x1356ba['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x268722){logger[_0x17d9('0xd')](_0x17d9('0x23'),_0x1356ba);logger[_0x17d9('0xf')](_0x17d9('0x23'),_0x1356ba,JSON[_0x17d9('0x12')](_0x268722));_0x4d06ce(_0x268722);})[_0x17d9('0x16')](function(_0x5d2a76){logger[_0x17d9('0x13')](_0x17d9('0x23'),_0x5d2a76[_0x17d9('0x15')],_0x1356ba);_0x4ef3f6(_0x3c2535[_0x17d9('0x13')](0x1f4,_0x5d2a76[_0x17d9('0x15')]));});});};exports[_0x17d9('0x26')]=function(_0x3ff2a7){var _0x37e8cf=this;return new Promise(function(_0x4f8b7d,_0x4e5fe5){return db[_0x17d9('0x18')][_0x17d9('0x27')](_0x3ff2a7[_0x17d9('0x25')],{'raw':_0x3ff2a7[_0x17d9('0x1a')]?_0x3ff2a7['options'][_0x17d9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ff2a7[_0x17d9('0x1a')]?_0x3ff2a7[_0x17d9('0x1a')][_0x17d9('0x1c')]||null:null,'attributes':_0x3ff2a7[_0x17d9('0x1a')]?_0x3ff2a7[_0x17d9('0x1a')][_0x17d9('0x1d')]||null:null,'limit':_0x3ff2a7[_0x17d9('0x1a')]?_0x3ff2a7[_0x17d9('0x1a')][_0x17d9('0x1e')]||null:null})['then'](function(_0x39d725){logger['info'](_0x17d9('0x26'),_0x3ff2a7);logger[_0x17d9('0xf')](_0x17d9('0x26'),_0x3ff2a7,JSON[_0x17d9('0x12')](_0x39d725));_0x4f8b7d(_0x39d725);})['catch'](function(_0x476e72){logger[_0x17d9('0x13')](_0x17d9('0x26'),_0x476e72[_0x17d9('0x15')],_0x3ff2a7);_0x4e5fe5(_0x37e8cf[_0x17d9('0x13')](0x1f4,_0x476e72['message']));});});}; \ No newline at end of file +var _0x4af2=['register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetVoiceQueueReport','findAll','options','raw','where','include','model','map','attributes','CreateVoiceQueueReport','VoiceQueueReport','create','body','debug','UpdateVoiceQueueReport','update','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket'];(function(_0x50f37a,_0x3916de){var _0x35d7a9=function(_0x390260){while(--_0x390260){_0x50f37a['push'](_0x50f37a['shift']());}};_0x35d7a9(++_0x3916de);}(_0x4af2,0x1ca));var _0x24af=function(_0x4e97c0,_0x1c1c6b){_0x4e97c0=_0x4e97c0-0x0;var _0x280e84=_0x4af2[_0x4e97c0];return _0x280e84;};'use strict';var _=require('lodash');var util=require(_0x24af('0x0'));var moment=require(_0x24af('0x1'));var BPromise=require(_0x24af('0x2'));var rs=require(_0x24af('0x3'));var fs=require('fs');var Redis=require(_0x24af('0x4'));var db=require(_0x24af('0x5'))['db'];var utils=require(_0x24af('0x6'));var logger=require('../../config/logger')(_0x24af('0x7'));var config=require('../../config/environment');var jayson=require(_0x24af('0x8'));var client=jayson[_0x24af('0x9')]['http']({'port':0x232a});config[_0x24af('0xa')]=_[_0x24af('0xb')](config[_0x24af('0xa')],{'host':_0x24af('0xc'),'port':0x18eb});var socket=require(_0x24af('0xd'))(new Redis(config[_0x24af('0xa')]));require(_0x24af('0xe'))[_0x24af('0xf')](socket);function respondWithRpcPromise(_0x48d306,_0x488456,_0x231502){return new BPromise(function(_0x5d186c,_0x5b5d2b){return client[_0x24af('0x10')](_0x48d306,_0x231502)[_0x24af('0x11')](function(_0x258b4b){logger[_0x24af('0x12')](_0x24af('0x13'),_0x488456,'request\x20sent');logger['debug'](_0x24af('0x14'),_0x488456,_0x24af('0x15'),JSON[_0x24af('0x16')](_0x258b4b));if(_0x258b4b[_0x24af('0x17')]){if(_0x258b4b[_0x24af('0x17')]['code']===0x1f4){logger['error'](_0x24af('0x13'),_0x488456,_0x258b4b[_0x24af('0x17')][_0x24af('0x18')]);return _0x5b5d2b(_0x258b4b[_0x24af('0x17')]['message']);}logger[_0x24af('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x488456,_0x258b4b[_0x24af('0x17')][_0x24af('0x18')]);return _0x5d186c(_0x258b4b['error']['message']);}else{logger['info'](_0x24af('0x13'),_0x488456,_0x24af('0x15'));_0x5d186c(_0x258b4b['result'][_0x24af('0x18')]);}})[_0x24af('0x19')](function(_0x3c15bc){logger['error'](_0x24af('0x13'),_0x488456,_0x3c15bc);_0x5b5d2b(_0x3c15bc);});});}exports[_0x24af('0x1a')]=function(_0x375e58){var _0xabeb08=this;return new Promise(function(_0x35b6d6,_0x56c945){return db['VoiceQueueReport'][_0x24af('0x1b')]({'raw':_0x375e58[_0x24af('0x1c')]?_0x375e58['options'][_0x24af('0x1d')]===undefined?!![]:![]:!![],'where':_0x375e58['options']?_0x375e58[_0x24af('0x1c')][_0x24af('0x1e')]||null:null,'attributes':_0x375e58[_0x24af('0x1c')]?_0x375e58[_0x24af('0x1c')]['attributes']||null:null,'limit':_0x375e58[_0x24af('0x1c')]?_0x375e58[_0x24af('0x1c')]['limit']||null:null,'include':_0x375e58['options']?_0x375e58[_0x24af('0x1c')][_0x24af('0x1f')]?_['map'](_0x375e58[_0x24af('0x1c')]['include'],function(_0x51090e){return{'model':db[_0x51090e[_0x24af('0x20')]],'as':_0x51090e['as'],'attributes':_0x51090e['attributes'],'include':_0x51090e[_0x24af('0x1f')]?_[_0x24af('0x21')](_0x51090e['include'],function(_0x4f05e7){return{'model':db[_0x4f05e7[_0x24af('0x20')]],'as':_0x4f05e7['as'],'attributes':_0x4f05e7[_0x24af('0x22')],'include':_0x4f05e7[_0x24af('0x1f')]?_[_0x24af('0x21')](_0x4f05e7[_0x24af('0x1f')],function(_0x3b00a8){return{'model':db[_0x3b00a8[_0x24af('0x20')]],'as':_0x3b00a8['as'],'attributes':_0x3b00a8[_0x24af('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32ddf8){logger['info'](_0x24af('0x1a'),_0x375e58);logger['debug']('GetVoiceQueueReport',_0x375e58,JSON[_0x24af('0x16')](_0x32ddf8));_0x35b6d6(_0x32ddf8);})[_0x24af('0x19')](function(_0x28d5a8){logger[_0x24af('0x17')](_0x24af('0x1a'),_0x28d5a8[_0x24af('0x18')],_0x375e58);_0x56c945(_0xabeb08[_0x24af('0x17')](0x1f4,_0x28d5a8['message']));});});};exports[_0x24af('0x23')]=function(_0x1a9a53){var _0xab639=this;return new Promise(function(_0x3675ea,_0x1005a2){return db[_0x24af('0x24')][_0x24af('0x25')](_0x1a9a53[_0x24af('0x26')],{'raw':_0x1a9a53['options']?_0x1a9a53['options'][_0x24af('0x1d')]===undefined?!![]:![]:!![]})[_0x24af('0x11')](function(_0x2b1f13){logger['info'](_0x24af('0x23'),_0x1a9a53);logger[_0x24af('0x27')](_0x24af('0x23'),_0x1a9a53,JSON[_0x24af('0x16')](_0x2b1f13));_0x3675ea(_0x2b1f13);})[_0x24af('0x19')](function(_0x5d69e6){logger[_0x24af('0x17')]('CreateVoiceQueueReport',_0x5d69e6[_0x24af('0x18')],_0x1a9a53);_0x1005a2(_0xab639[_0x24af('0x17')](0x1f4,_0x5d69e6[_0x24af('0x18')]));});});};exports[_0x24af('0x28')]=function(_0x48a039){var _0x4294d8=this;return new Promise(function(_0x332506,_0x5ccc01){return db[_0x24af('0x24')][_0x24af('0x29')](_0x48a039[_0x24af('0x26')],{'raw':_0x48a039[_0x24af('0x1c')]?_0x48a039[_0x24af('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48a039['options']?_0x48a039[_0x24af('0x1c')][_0x24af('0x1e')]||null:null,'attributes':_0x48a039[_0x24af('0x1c')]?_0x48a039[_0x24af('0x1c')][_0x24af('0x22')]||null:null,'limit':_0x48a039[_0x24af('0x1c')]?_0x48a039[_0x24af('0x1c')][_0x24af('0x2a')]||null:null})[_0x24af('0x11')](function(_0x5298ea){logger[_0x24af('0x12')](_0x24af('0x28'),_0x48a039);logger[_0x24af('0x27')](_0x24af('0x28'),_0x48a039,JSON[_0x24af('0x16')](_0x5298ea));_0x332506(_0x5298ea);})[_0x24af('0x19')](function(_0x4a2cc0){logger[_0x24af('0x17')](_0x24af('0x28'),_0x4a2cc0[_0x24af('0x18')],_0x48a039);_0x5ccc01(_0x4294d8[_0x24af('0x17')](0x1f4,_0x4a2cc0[_0x24af('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index c63a1e4..8005127 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 _0xfedb=['removeListener','register','voiceQueueReport:','./voiceQueueReport.events','save','update','emit'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xfedb,0x81));var _0xbfed=function(_0x3b00da,_0x59dd9e){_0x3b00da=_0x3b00da-0x0;var _0x2dae8e=_0xfedb[_0x3b00da];return _0x2dae8e;};'use strict';var VoiceQueueReportEvents=require(_0xbfed('0x0'));var events=[_0xbfed('0x1'),'remove',_0xbfed('0x2')];function createListener(_0x124e93,_0x884d31){return function(_0x57bfda){_0x884d31[_0xbfed('0x3')](_0x124e93,_0x57bfda);};}function removeListener(_0x335503,_0x282052){return function(){VoiceQueueReportEvents[_0xbfed('0x4')](_0x335503,_0x282052);};}exports[_0xbfed('0x5')]=function(_0x354885){for(var _0x16eb5f=0x0,_0x3b0a8a=events['length'];_0x16eb5f<_0x3b0a8a;_0x16eb5f++){var _0x49c88e=events[_0x16eb5f];var _0x544864=createListener(_0xbfed('0x6')+_0x49c88e,_0x354885);VoiceQueueReportEvents['on'](_0x49c88e,_0x544864);}}; \ No newline at end of file +var _0x3f32=['voiceQueueReport:','./voiceQueueReport.events','save','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3f32,0x1e5));var _0x23f3=function(_0x487524,_0x292ba6){_0x487524=_0x487524-0x0;var _0x3f3543=_0x3f32[_0x487524];return _0x3f3543;};'use strict';var VoiceQueueReportEvents=require(_0x23f3('0x0'));var events=[_0x23f3('0x1'),'remove','update'];function createListener(_0x832e75,_0x5c87a5){return function(_0x5087b4){_0x5c87a5['emit'](_0x832e75,_0x5087b4);};}function removeListener(_0xf83a80,_0x850fb3){return function(){VoiceQueueReportEvents['removeListener'](_0xf83a80,_0x850fb3);};}exports['register']=function(_0x1684ec){for(var _0x1180b2=0x0,_0x4a3e2c=events[_0x23f3('0x2')];_0x1180b2<_0x4a3e2c;_0x1180b2++){var _0x553e6c=events[_0x1180b2];var _0x111d29=createListener(_0x23f3('0x3')+_0x553e6c,_0x1684ec);VoiceQueueReportEvents['on'](_0x553e6c,_0x111d29);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index c1f94cb..2c7df35 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 _0x5396=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x460970,_0x505278){var _0x5e3f34=function(_0x4d03e8){while(--_0x4d03e8){_0x460970['push'](_0x460970['shift']());}};_0x5e3f34(++_0x505278);}(_0x5396,0x134));var _0x6539=function(_0x2dc8f1,_0xbeddcd){_0x2dc8f1=_0x2dc8f1-0x0;var _0x105224=_0x5396[_0x2dc8f1];return _0x105224;};'use strict';var multer=require(_0x6539('0x0'));var util=require(_0x6539('0x1'));var path=require(_0x6539('0x2'));var timeout=require(_0x6539('0x3'));var express=require(_0x6539('0x4'));var router=express[_0x6539('0x5')]();var auth=require(_0x6539('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceQueuesLog.controller');router[_0x6539('0x7')]('/',auth[_0x6539('0x8')](),controller[_0x6539('0x9')]);router[_0x6539('0x7')](_0x6539('0xa'),auth[_0x6539('0x8')](),controller[_0x6539('0xb')]);router[_0x6539('0xc')]('/',auth[_0x6539('0x8')](),controller[_0x6539('0xd')]);router[_0x6539('0xe')](_0x6539('0xa'),auth[_0x6539('0x8')](),controller[_0x6539('0xf')]);router[_0x6539('0x10')]('/:id',auth[_0x6539('0x8')](),controller[_0x6539('0x11')]);module[_0x6539('0x12')]=router; \ No newline at end of file +var _0xa97a=['/:id','show','create','update','delete','destroy','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get'];(function(_0x2590f2,_0x54ecb1){var _0x2c6f89=function(_0x1d948b){while(--_0x1d948b){_0x2590f2['push'](_0x2590f2['shift']());}};_0x2c6f89(++_0x54ecb1);}(_0xa97a,0x166));var _0xaa97=function(_0x5c22a0,_0x392a95){_0x5c22a0=_0x5c22a0-0x0;var _0x12d21b=_0xa97a[_0x5c22a0];return _0x12d21b;};'use strict';var multer=require(_0xaa97('0x0'));var util=require(_0xaa97('0x1'));var path=require('path');var timeout=require(_0xaa97('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xaa97('0x3'));var interaction=require(_0xaa97('0x4'));var config=require(_0xaa97('0x5'));var controller=require(_0xaa97('0x6'));router['get']('/',auth[_0xaa97('0x7')](),controller[_0xaa97('0x8')]);router[_0xaa97('0x9')](_0xaa97('0xa'),auth[_0xaa97('0x7')](),controller[_0xaa97('0xb')]);router['post']('/',auth[_0xaa97('0x7')](),controller[_0xaa97('0xc')]);router['put'](_0xaa97('0xa'),auth[_0xaa97('0x7')](),controller[_0xaa97('0xd')]);router[_0xaa97('0xe')](_0xaa97('0xa'),auth['isAuthenticated'](),controller[_0xaa97('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 630632a..c98f9d5 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 _0x0feb=['exports','STRING','format','sequelize','moment'];(function(_0xb20eea,_0x5e6f4d){var _0x575ced=function(_0x3ad7d0){while(--_0x3ad7d0){_0xb20eea['push'](_0xb20eea['shift']());}};_0x575ced(++_0x5e6f4d);}(_0x0feb,0x6c));var _0xb0fe=function(_0x3dc2ae,_0x49859e){_0x3dc2ae=_0x3dc2ae-0x0;var _0x21cca8=_0x0feb[_0x3dc2ae];return _0x21cca8;};'use strict';var Sequelize=require(_0xb0fe('0x0'));var moment=require(_0xb0fe('0x1'));module[_0xb0fe('0x2')]={'time':{'type':Sequelize[_0xb0fe('0x3')]},'callid':{'type':Sequelize[_0xb0fe('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xb0fe('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xb0fe('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xb0fe('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xb0fe('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xb0fe('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xb0fe('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0xb0fe('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x3ca4=['YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING','DATE','format'];(function(_0x4f04e8,_0x5e3c43){var _0x20c11d=function(_0x1bb27d){while(--_0x1bb27d){_0x4f04e8['push'](_0x4f04e8['shift']());}};_0x20c11d(++_0x5e3c43);}(_0x3ca4,0x73));var _0x43ca=function(_0x420297,_0x57337c){_0x420297=_0x420297-0x0;var _0x2f76a8=_0x3ca4[_0x420297];return _0x2f76a8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x43ca('0x0'));module[_0x43ca('0x1')]={'time':{'type':Sequelize[_0x43ca('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x43ca('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x43ca('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x43ca('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x43ca('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x43ca('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x43ca('0x3')],'allowNull':![],'defaultValue':moment()[_0x43ca('0x4')](_0x43ca('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 87fb585..144943f 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 _0xde5e=['rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','catch','show','params','find','create','update','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','then','destroy','end','name','index','map','VoiceQueuesLog'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xde5e,0x171));var _0xede5=function(_0x18923b,_0x54f870){_0x18923b=_0x18923b-0x0;var _0x4b38b1=_0xde5e[_0x18923b];return _0x4b38b1;};'use strict';var pdf=require(_0xede5('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xede5('0x1'));var jsonpatch=require(_0xede5('0x2'));var rp=require(_0xede5('0x3'));var moment=require(_0xede5('0x4'));var BPromise=require(_0xede5('0x5'));var Mustache=require('mustache');var util=require(_0xede5('0x6'));var path=require(_0xede5('0x7'));var sox=require(_0xede5('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xede5('0x9'));var squel=require(_0xede5('0xa'));var crypto=require(_0xede5('0xb'));var jsforce=require(_0xede5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xede5('0xd'));var querystring=require(_0xede5('0xe'));var Papa=require(_0xede5('0xf'));var Redis=require('ioredis');var authService=require(_0xede5('0x10'));var qs=require(_0xede5('0x11'));var as=require(_0xede5('0x12'));var hardwareService=require(_0xede5('0x13'));var logger=require(_0xede5('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xede5('0x15'));var db=require(_0xede5('0x16'))['db'];function respondWithStatusCode(_0x2c451a,_0x4db4f9){_0x4db4f9=_0x4db4f9||0xcc;return function(_0x4ce248){if(_0x4ce248){return _0x2c451a[_0xede5('0x17')](_0x4db4f9);}return _0x2c451a[_0xede5('0x18')](_0x4db4f9)['end']();};}function respondWithResult(_0x256ad8,_0x546b84){_0x546b84=_0x546b84||0xc8;return function(_0x423b23){if(_0x423b23){return _0x256ad8[_0xede5('0x18')](_0x546b84)[_0xede5('0x19')](_0x423b23);}};}function respondWithFilteredResult(_0x3ea455,_0x1d5f95){return function(_0x26f434){if(_0x26f434){var _0xa7df91=_0x26f434['count'],_0x327375=_0x1d5f95[_0xede5('0x1a')],_0x230d8c=_0x1d5f95[_0xede5('0x1a')]+_0x1d5f95[_0xede5('0x1b')],_0x3604dc;if(_0x230d8c>=_0xa7df91){_0x230d8c=_0xa7df91;_0x3604dc=0xc8;}else{_0x3604dc=0xce;}_0x3ea455['status'](_0x3604dc);return _0x3ea455[_0xede5('0x1c')](_0xede5('0x1d'),_0x327375+'-'+_0x230d8c+'/'+_0xa7df91)[_0xede5('0x19')](_0x26f434);}return null;};}function patchUpdates(_0x5c4856){return function(_0x51d713){try{jsonpatch['apply'](_0x51d713,_0x5c4856,!![]);}catch(_0x291f81){return BPromise[_0xede5('0x1e')](_0x291f81);}return _0x51d713[_0xede5('0x1f')]();};}function saveUpdates(_0x3fea27,_0x4842a9){return function(_0x41bd0e){if(_0x41bd0e){return _0x41bd0e['update'](_0x3fea27)[_0xede5('0x20')](function(_0x2688f3){return _0x2688f3;});}return null;};}function removeEntity(_0x2eecd2,_0x1abaa0){return function(_0x4cbc82){if(_0x4cbc82){return _0x4cbc82[_0xede5('0x21')]()[_0xede5('0x20')](function(){_0x2eecd2[_0xede5('0x18')](0xcc)[_0xede5('0x22')]();});}};}function handleEntityNotFound(_0x40c6da,_0x5cf965){return function(_0x9f108){if(!_0x9f108){_0x40c6da[_0xede5('0x17')](0x194);}return _0x9f108;};}function handleError(_0x20a993,_0x472304){_0x472304=_0x472304||0x1f4;return function(_0x180af1){logger['error'](_0x180af1['stack']);if(_0x180af1[_0xede5('0x23')]){delete _0x180af1[_0xede5('0x23')];}_0x20a993[_0xede5('0x18')](_0x472304)['send'](_0x180af1);};}exports[_0xede5('0x24')]=function(_0x2c31fb,_0x56d379){var _0x1dae9c={},_0xe41d4b={},_0x3b614a={'count':0x0,'rows':[]};var _0x47ca3e=_[_0xede5('0x25')](db[_0xede5('0x26')][_0xede5('0x27')],function(_0x1ea3ab){return{'name':_0x1ea3ab[_0xede5('0x28')],'type':_0x1ea3ab[_0xede5('0x29')][_0xede5('0x2a')]};});_0xe41d4b['model']=_[_0xede5('0x25')](_0x47ca3e,'name');_0xe41d4b[_0xede5('0x2b')]=_[_0xede5('0x2c')](_0x2c31fb['query']);_0xe41d4b[_0xede5('0x2d')]=_['intersection'](_0xe41d4b[_0xede5('0x2e')],_0xe41d4b[_0xede5('0x2b')]);_0x1dae9c[_0xede5('0x2f')]=_[_0xede5('0x30')](_0xe41d4b[_0xede5('0x2e')],qs[_0xede5('0x31')](_0x2c31fb['query'][_0xede5('0x31')]));_0x1dae9c[_0xede5('0x2f')]=_0x1dae9c[_0xede5('0x2f')][_0xede5('0x32')]?_0x1dae9c[_0xede5('0x2f')]:_0xe41d4b[_0xede5('0x2e')];if(!_0x2c31fb['query']['hasOwnProperty']('nolimit')){_0x1dae9c[_0xede5('0x1b')]=qs[_0xede5('0x1b')](_0x2c31fb[_0xede5('0x2b')][_0xede5('0x1b')]);_0x1dae9c[_0xede5('0x1a')]=qs[_0xede5('0x1a')](_0x2c31fb['query'][_0xede5('0x1a')]);}_0x1dae9c['order']=qs['sort'](_0x2c31fb[_0xede5('0x2b')][_0xede5('0x33')]);_0x1dae9c[_0xede5('0x34')]=qs[_0xede5('0x2d')](_[_0xede5('0x35')](_0x2c31fb[_0xede5('0x2b')],_0xe41d4b['filters']),_0x47ca3e);if(_0x2c31fb['query'][_0xede5('0x36')]){_0x1dae9c[_0xede5('0x34')]=_[_0xede5('0x37')](_0x1dae9c[_0xede5('0x34')],{'$or':_[_0xede5('0x25')](_0x47ca3e,function(_0x24d92f){if(_0x24d92f['type']!==_0xede5('0x38')){var _0xf9d241={};_0xf9d241[_0x24d92f[_0xede5('0x23')]]={'$like':'%'+_0x2c31fb[_0xede5('0x2b')]['filter']+'%'};return _0xf9d241;}})});}_0x1dae9c=_[_0xede5('0x37')]({},_0x1dae9c,_0x2c31fb[_0xede5('0x39')]);var _0x3266b9={'where':_0x1dae9c['where']};return db[_0xede5('0x26')]['count'](_0x3266b9)[_0xede5('0x20')](function(_0x863ba2){_0x3b614a[_0xede5('0x3a')]=_0x863ba2;if(_0x2c31fb['query'][_0xede5('0x3b')]){_0x1dae9c[_0xede5('0x3c')]=[{'all':!![]}];}return db[_0xede5('0x26')]['findAll'](_0x1dae9c);})[_0xede5('0x20')](function(_0x24e780){_0x3b614a['rows']=_0x24e780;return _0x3b614a;})[_0xede5('0x20')](respondWithFilteredResult(_0x56d379,_0x1dae9c))[_0xede5('0x3d')](handleError(_0x56d379,null));};exports[_0xede5('0x3e')]=function(_0x556175,_0x963eb8){var _0x3d9ebc={'raw':!![],'where':{'id':_0x556175[_0xede5('0x3f')]['id']}},_0x5007dc={};_0x5007dc['model']=_[_0xede5('0x2c')](db[_0xede5('0x26')]['rawAttributes']);_0x5007dc[_0xede5('0x2b')]=_[_0xede5('0x2c')](_0x556175[_0xede5('0x2b')]);_0x5007dc['filters']=_[_0xede5('0x30')](_0x5007dc['model'],_0x5007dc[_0xede5('0x2b')]);_0x3d9ebc[_0xede5('0x2f')]=_['intersection'](_0x5007dc['model'],qs[_0xede5('0x31')](_0x556175[_0xede5('0x2b')]['fields']));_0x3d9ebc[_0xede5('0x2f')]=_0x3d9ebc[_0xede5('0x2f')][_0xede5('0x32')]?_0x3d9ebc[_0xede5('0x2f')]:_0x5007dc['model'];if(_0x556175[_0xede5('0x2b')][_0xede5('0x3b')]){_0x3d9ebc[_0xede5('0x3c')]=[{'all':!![]}];}_0x3d9ebc=_[_0xede5('0x37')]({},_0x3d9ebc,_0x556175[_0xede5('0x39')]);return db['VoiceQueuesLog'][_0xede5('0x40')](_0x3d9ebc)[_0xede5('0x20')](handleEntityNotFound(_0x963eb8,null))[_0xede5('0x20')](respondWithResult(_0x963eb8,null))[_0xede5('0x3d')](handleError(_0x963eb8,null));};exports[_0xede5('0x41')]=function(_0x4348ce,_0x545ba1){return db['VoiceQueuesLog']['create'](_0x4348ce['body'],{})[_0xede5('0x20')](respondWithResult(_0x545ba1,0xc9))[_0xede5('0x3d')](handleError(_0x545ba1,null));};exports[_0xede5('0x42')]=function(_0x230cd5,_0x3e7bb4){if(_0x230cd5[_0xede5('0x43')]['id']){delete _0x230cd5[_0xede5('0x43')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x230cd5[_0xede5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3e7bb4,null))[_0xede5('0x20')](saveUpdates(_0x230cd5['body'],null))[_0xede5('0x20')](respondWithResult(_0x3e7bb4,null))[_0xede5('0x3d')](handleError(_0x3e7bb4,null));};exports[_0xede5('0x21')]=function(_0x45c081,_0x50990e){return db[_0xede5('0x26')]['find']({'where':{'id':_0x45c081[_0xede5('0x3f')]['id']}})[_0xede5('0x20')](handleEntityNotFound(_0x50990e,null))[_0xede5('0x20')](removeEntity(_0x50990e,null))[_0xede5('0x3d')](handleError(_0x50990e,null));}; \ No newline at end of file +var _0x9d5d=['apply','reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceQueuesLog','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','findAll','rows','catch','show','params','includeAll','include','create','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range'];(function(_0x3861e5,_0x1b9277){var _0x143e24=function(_0x101917){while(--_0x101917){_0x3861e5['push'](_0x3861e5['shift']());}};_0x143e24(++_0x1b9277);}(_0x9d5d,0xb9));var _0xd9d5=function(_0x45db74,_0x51c68a){_0x45db74=_0x45db74-0x0;var _0x4bc2f2=_0x9d5d[_0x45db74];return _0x4bc2f2;};'use strict';var pdf=require(_0xd9d5('0x0'));var emlformat=require(_0xd9d5('0x1'));var rimraf=require(_0xd9d5('0x2'));var zipdir=require(_0xd9d5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9d5('0x4'));var moment=require('moment');var BPromise=require(_0xd9d5('0x5'));var Mustache=require('mustache');var util=require(_0xd9d5('0x6'));var path=require('path');var sox=require(_0xd9d5('0x7'));var csv=require(_0xd9d5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd9d5('0x9'));var squel=require('squel');var crypto=require(_0xd9d5('0xa'));var jsforce=require(_0xd9d5('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd9d5('0xc'));var Papa=require('papaparse');var Redis=require(_0xd9d5('0xd'));var authService=require(_0xd9d5('0xe'));var qs=require(_0xd9d5('0xf'));var as=require(_0xd9d5('0x10'));var hardwareService=require(_0xd9d5('0x11'));var logger=require(_0xd9d5('0x12'))('api');var utils=require(_0xd9d5('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd9d5('0x14'));var db=require(_0xd9d5('0x15'))['db'];function respondWithStatusCode(_0x4417b1,_0x14f84e){_0x14f84e=_0x14f84e||0xcc;return function(_0x58ee60){if(_0x58ee60){return _0x4417b1[_0xd9d5('0x16')](_0x14f84e);}return _0x4417b1['status'](_0x14f84e)[_0xd9d5('0x17')]();};}function respondWithResult(_0x454ca8,_0x45e08c){_0x45e08c=_0x45e08c||0xc8;return function(_0x10cb68){if(_0x10cb68){return _0x454ca8[_0xd9d5('0x18')](_0x45e08c)[_0xd9d5('0x19')](_0x10cb68);}};}function respondWithFilteredResult(_0x3de690,_0x442a14){return function(_0x8f4f1c){if(_0x8f4f1c){var _0x7d0d87=_0x8f4f1c[_0xd9d5('0x1a')],_0x3316e7=_0x442a14[_0xd9d5('0x1b')],_0x1cb90d=_0x442a14['offset']+_0x442a14[_0xd9d5('0x1c')],_0x838222;if(_0x1cb90d>=_0x7d0d87){_0x1cb90d=_0x7d0d87;_0x838222=0xc8;}else{_0x838222=0xce;}_0x3de690['status'](_0x838222);return _0x3de690[_0xd9d5('0x1d')](_0xd9d5('0x1e'),_0x3316e7+'-'+_0x1cb90d+'/'+_0x7d0d87)[_0xd9d5('0x19')](_0x8f4f1c);}return null;};}function patchUpdates(_0x1b6503){return function(_0x51f577){try{jsonpatch[_0xd9d5('0x1f')](_0x51f577,_0x1b6503,!![]);}catch(_0x5cce22){return BPromise[_0xd9d5('0x20')](_0x5cce22);}return _0x51f577[_0xd9d5('0x21')]();};}function saveUpdates(_0x640b22,_0xd29fa5){return function(_0x5a3d0d){if(_0x5a3d0d){return _0x5a3d0d[_0xd9d5('0x22')](_0x640b22)['then'](function(_0x113034){return _0x113034;});}return null;};}function removeEntity(_0x58436c,_0xc46504){return function(_0xdb64b6){if(_0xdb64b6){return _0xdb64b6[_0xd9d5('0x23')]()[_0xd9d5('0x24')](function(){_0x58436c[_0xd9d5('0x18')](0xcc)[_0xd9d5('0x17')]();});}};}function handleEntityNotFound(_0xe14362,_0x336c5e){return function(_0x49e238){if(!_0x49e238){_0xe14362[_0xd9d5('0x16')](0x194);}return _0x49e238;};}function handleError(_0x41d54a,_0x5441c3){_0x5441c3=_0x5441c3||0x1f4;return function(_0x544572){logger[_0xd9d5('0x25')](_0x544572[_0xd9d5('0x26')]);if(_0x544572[_0xd9d5('0x27')]){delete _0x544572[_0xd9d5('0x27')];}_0x41d54a['status'](_0x5441c3)[_0xd9d5('0x28')](_0x544572);};}exports[_0xd9d5('0x29')]=function(_0x13b6d5,_0x11c7ba){var _0x9d7ec9={},_0xfae0a2={},_0x4ea949={'count':0x0,'rows':[]};var _0x54d326=_[_0xd9d5('0x2a')](db[_0xd9d5('0x2b')]['rawAttributes'],function(_0x339ca8){return{'name':_0x339ca8[_0xd9d5('0x2c')],'type':_0x339ca8[_0xd9d5('0x2d')]['key']};});_0xfae0a2[_0xd9d5('0x2e')]=_['map'](_0x54d326,_0xd9d5('0x27'));_0xfae0a2[_0xd9d5('0x2f')]=_[_0xd9d5('0x30')](_0x13b6d5[_0xd9d5('0x2f')]);_0xfae0a2[_0xd9d5('0x31')]=_[_0xd9d5('0x32')](_0xfae0a2[_0xd9d5('0x2e')],_0xfae0a2['query']);_0x9d7ec9[_0xd9d5('0x33')]=_['intersection'](_0xfae0a2[_0xd9d5('0x2e')],qs['fields'](_0x13b6d5[_0xd9d5('0x2f')][_0xd9d5('0x34')]));_0x9d7ec9[_0xd9d5('0x33')]=_0x9d7ec9[_0xd9d5('0x33')][_0xd9d5('0x35')]?_0x9d7ec9[_0xd9d5('0x33')]:_0xfae0a2['model'];if(!_0x13b6d5['query'][_0xd9d5('0x36')](_0xd9d5('0x37'))){_0x9d7ec9['limit']=qs[_0xd9d5('0x1c')](_0x13b6d5['query'][_0xd9d5('0x1c')]);_0x9d7ec9[_0xd9d5('0x1b')]=qs[_0xd9d5('0x1b')](_0x13b6d5['query'][_0xd9d5('0x1b')]);}_0x9d7ec9[_0xd9d5('0x38')]=qs[_0xd9d5('0x39')](_0x13b6d5[_0xd9d5('0x2f')][_0xd9d5('0x39')]);_0x9d7ec9[_0xd9d5('0x3a')]=qs[_0xd9d5('0x31')](_['pick'](_0x13b6d5[_0xd9d5('0x2f')],_0xfae0a2[_0xd9d5('0x31')]),_0x54d326);if(_0x13b6d5[_0xd9d5('0x2f')][_0xd9d5('0x3b')]){_0x9d7ec9[_0xd9d5('0x3a')]=_[_0xd9d5('0x3c')](_0x9d7ec9[_0xd9d5('0x3a')],{'$or':_[_0xd9d5('0x2a')](_0x54d326,function(_0x42e418){if(_0x42e418[_0xd9d5('0x2d')]!=='VIRTUAL'){var _0x45e1ed={};_0x45e1ed[_0x42e418[_0xd9d5('0x27')]]={'$like':'%'+_0x13b6d5[_0xd9d5('0x2f')]['filter']+'%'};return _0x45e1ed;}})});}_0x9d7ec9=_['merge']({},_0x9d7ec9,_0x13b6d5[_0xd9d5('0x3d')]);var _0x295978={'where':_0x9d7ec9['where']};return db[_0xd9d5('0x2b')][_0xd9d5('0x1a')](_0x295978)['then'](function(_0x216365){_0x4ea949[_0xd9d5('0x1a')]=_0x216365;if(_0x13b6d5[_0xd9d5('0x2f')]['includeAll']){_0x9d7ec9['include']=[{'all':!![]}];}return db[_0xd9d5('0x2b')][_0xd9d5('0x3e')](_0x9d7ec9);})[_0xd9d5('0x24')](function(_0x16c75d){_0x4ea949[_0xd9d5('0x3f')]=_0x16c75d;return _0x4ea949;})[_0xd9d5('0x24')](respondWithFilteredResult(_0x11c7ba,_0x9d7ec9))[_0xd9d5('0x40')](handleError(_0x11c7ba,null));};exports[_0xd9d5('0x41')]=function(_0x3cf4b7,_0x5a6009){var _0x5f78df={'raw':!![],'where':{'id':_0x3cf4b7[_0xd9d5('0x42')]['id']}},_0x412841={};_0x412841['model']=_[_0xd9d5('0x30')](db[_0xd9d5('0x2b')]['rawAttributes']);_0x412841[_0xd9d5('0x2f')]=_[_0xd9d5('0x30')](_0x3cf4b7[_0xd9d5('0x2f')]);_0x412841[_0xd9d5('0x31')]=_[_0xd9d5('0x32')](_0x412841[_0xd9d5('0x2e')],_0x412841['query']);_0x5f78df[_0xd9d5('0x33')]=_[_0xd9d5('0x32')](_0x412841[_0xd9d5('0x2e')],qs[_0xd9d5('0x34')](_0x3cf4b7['query'][_0xd9d5('0x34')]));_0x5f78df[_0xd9d5('0x33')]=_0x5f78df['attributes']['length']?_0x5f78df['attributes']:_0x412841['model'];if(_0x3cf4b7[_0xd9d5('0x2f')][_0xd9d5('0x43')]){_0x5f78df[_0xd9d5('0x44')]=[{'all':!![]}];}_0x5f78df=_[_0xd9d5('0x3c')]({},_0x5f78df,_0x3cf4b7['options']);return db[_0xd9d5('0x2b')]['find'](_0x5f78df)[_0xd9d5('0x24')](handleEntityNotFound(_0x5a6009,null))[_0xd9d5('0x24')](respondWithResult(_0x5a6009,null))[_0xd9d5('0x40')](handleError(_0x5a6009,null));};exports['create']=function(_0x3defb6,_0x5b66aa){return db[_0xd9d5('0x2b')][_0xd9d5('0x45')](_0x3defb6[_0xd9d5('0x46')],{})[_0xd9d5('0x24')](respondWithResult(_0x5b66aa,0xc9))[_0xd9d5('0x40')](handleError(_0x5b66aa,null));};exports[_0xd9d5('0x22')]=function(_0x3a29ea,_0x54b897){if(_0x3a29ea['body']['id']){delete _0x3a29ea[_0xd9d5('0x46')]['id'];}return db[_0xd9d5('0x2b')][_0xd9d5('0x47')]({'where':{'id':_0x3a29ea[_0xd9d5('0x42')]['id']}})['then'](handleEntityNotFound(_0x54b897,null))[_0xd9d5('0x24')](saveUpdates(_0x3a29ea[_0xd9d5('0x46')],null))['then'](respondWithResult(_0x54b897,null))[_0xd9d5('0x40')](handleError(_0x54b897,null));};exports[_0xd9d5('0x23')]=function(_0x5277e7,_0x5ca956){return db['VoiceQueuesLog']['find']({'where':{'id':_0x5277e7['params']['id']}})[_0xd9d5('0x24')](handleEntityNotFound(_0x5ca956,null))['then'](removeEntity(_0x5ca956,null))[_0xd9d5('0x40')](handleError(_0x5ca956,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 0c88c6e..f266e38 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 _0x667f=['request-promise','rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event','dtm','lodash','util','../../config/logger','api','bluebird'];(function(_0x545700,_0x126865){var _0x402570=function(_0x26df9d){while(--_0x26df9d){_0x545700['push'](_0x545700['shift']());}};_0x402570(++_0x126865);}(_0x667f,0x13d));var _0xf667=function(_0x1b60ab,_0x5bae0e){_0x1b60ab=_0x1b60ab-0x0;var _0x2521d0=_0x667f[_0x1b60ab];return _0x2521d0;};'use strict';var _=require(_0xf667('0x0'));var util=require(_0xf667('0x1'));var logger=require(_0xf667('0x2'))(_0xf667('0x3'));var moment=require('moment');var BPromise=require(_0xf667('0x4'));var rp=require(_0xf667('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf667('0x6'));var config=require(_0xf667('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0xf667('0x8')]=function(_0x31c3a9,_0x44b491){return _0x31c3a9[_0xf667('0x9')](_0xf667('0xa'),attributes,{'tableName':_0xf667('0xb'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xf667('0xc'),_0xf667('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7d63=['path','rimraf','./voiceQueuesLog.attributes','exports','define','event','dtm','lodash','util','moment','bluebird','request-promise'];(function(_0x183792,_0x3efec2){var _0x51fe4e=function(_0x14ea3c){while(--_0x14ea3c){_0x183792['push'](_0x183792['shift']());}};_0x51fe4e(++_0x3efec2);}(_0x7d63,0x16f));var _0x37d6=function(_0x2aefb6,_0x1bd384){_0x2aefb6=_0x2aefb6-0x0;var _0x202772=_0x7d63[_0x2aefb6];return _0x202772;};'use strict';var _=require(_0x37d6('0x0'));var util=require(_0x37d6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x37d6('0x2'));var BPromise=require(_0x37d6('0x3'));var rp=require(_0x37d6('0x4'));var fs=require('fs');var path=require(_0x37d6('0x5'));var rimraf=require(_0x37d6('0x6'));var config=require('../../config/environment');var attributes=require(_0x37d6('0x7'));module[_0x37d6('0x8')]=function(_0x92bd9c,_0x16c683){return _0x92bd9c[_0x37d6('0x9')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x37d6('0xa'),_0x37d6('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 4b5d3ed..65915e1 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 _0x1752=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','bluebird'];(function(_0x1827fd,_0x4e62a5){var _0x3f346f=function(_0x37b849){while(--_0x37b849){_0x1827fd['push'](_0x1827fd['shift']());}};_0x3f346f(++_0x4e62a5);}(_0x1752,0xa5));var _0x2175=function(_0x4c4d9f,_0x52960e){_0x4c4d9f=_0x4c4d9f-0x0;var _0xc62d12=_0x1752[_0x4c4d9f];return _0xc62d12;};'use strict';var _=require('lodash');var util=require(_0x2175('0x0'));var moment=require(_0x2175('0x1'));var BPromise=require(_0x2175('0x2'));var rs=require(_0x2175('0x3'));var fs=require('fs');var Redis=require(_0x2175('0x4'));var db=require(_0x2175('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2175('0x6'))(_0x2175('0x7'));var config=require(_0x2175('0x8'));var jayson=require(_0x2175('0x9'));var client=jayson[_0x2175('0xa')][_0x2175('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19ca87,_0x1bd937,_0x339e4d){return new BPromise(function(_0x672ff1,_0x516ccc){return client[_0x2175('0xc')](_0x19ca87,_0x339e4d)[_0x2175('0xd')](function(_0x407a71){logger[_0x2175('0xe')](_0x2175('0xf'),_0x1bd937,'request\x20sent');logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x1bd937,_0x2175('0x10'),JSON['stringify'](_0x407a71));if(_0x407a71['error']){if(_0x407a71['error']['code']===0x1f4){logger[_0x2175('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1bd937,_0x407a71[_0x2175('0x11')][_0x2175('0x12')]);return _0x516ccc(_0x407a71['error'][_0x2175('0x12')]);}logger[_0x2175('0x11')](_0x2175('0xf'),_0x1bd937,_0x407a71[_0x2175('0x11')][_0x2175('0x12')]);return _0x672ff1(_0x407a71[_0x2175('0x11')][_0x2175('0x12')]);}else{logger[_0x2175('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1bd937,'request\x20sent');_0x672ff1(_0x407a71[_0x2175('0x13')][_0x2175('0x12')]);}})[_0x2175('0x14')](function(_0x4e7cf1){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x1bd937,_0x4e7cf1);_0x516ccc(_0x4e7cf1);});});} \ No newline at end of file +var _0x422f=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceQueuesLog,\x20%s,\x20%s','result','catch','util'];(function(_0x6620b8,_0x8b3d5e){var _0x33de50=function(_0x2f1f07){while(--_0x2f1f07){_0x6620b8['push'](_0x6620b8['shift']());}};_0x33de50(++_0x8b3d5e);}(_0x422f,0x1c7));var _0xf422=function(_0x52d59e,_0x3c546d){_0x52d59e=_0x52d59e-0x0;var _0x364739=_0x422f[_0x52d59e];return _0x364739;};'use strict';var _=require('lodash');var util=require(_0xf422('0x0'));var moment=require('moment');var BPromise=require(_0xf422('0x1'));var rs=require(_0xf422('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf422('0x3'))['db'];var utils=require(_0xf422('0x4'));var logger=require(_0xf422('0x5'))(_0xf422('0x6'));var config=require(_0xf422('0x7'));var jayson=require(_0xf422('0x8'));var client=jayson[_0xf422('0x9')][_0xf422('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x350b2d,_0x583283,_0x3f4801){return new BPromise(function(_0x1037fa,_0xc2c9f5){return client[_0xf422('0xb')](_0x350b2d,_0x3f4801)[_0xf422('0xc')](function(_0x5f02da){logger[_0xf422('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x583283,'request\x20sent');logger[_0xf422('0xe')](_0xf422('0xf'),_0x583283,_0xf422('0x10'),JSON[_0xf422('0x11')](_0x5f02da));if(_0x5f02da[_0xf422('0x12')]){if(_0x5f02da['error'][_0xf422('0x13')]===0x1f4){logger[_0xf422('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x583283,_0x5f02da[_0xf422('0x12')][_0xf422('0x14')]);return _0xc2c9f5(_0x5f02da[_0xf422('0x12')][_0xf422('0x14')]);}logger[_0xf422('0x12')](_0xf422('0x15'),_0x583283,_0x5f02da[_0xf422('0x12')][_0xf422('0x14')]);return _0x1037fa(_0x5f02da[_0xf422('0x12')]['message']);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x583283,_0xf422('0x10'));_0x1037fa(_0x5f02da[_0xf422('0x16')][_0xf422('0x14')]);}})[_0xf422('0x17')](function(_0x5f3de5){logger[_0xf422('0x12')](_0xf422('0x15'),_0x583283,_0x5f3de5);_0xc2c9f5(_0x5f3de5);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 90cd81a..b62eece 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 _0xbfd0=['downloads','/:id/transcribe','post','runTranscribe','put','update','delete','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','/:id','show','download','/:id/downloads'];(function(_0x89de9,_0x20ab14){var _0x2312d4=function(_0x3304cb){while(--_0x3304cb){_0x89de9['push'](_0x89de9['shift']());}};_0x2312d4(++_0x20ab14);}(_0xbfd0,0x134));var _0x0bfd=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xbfd0[_0x1d9aa0];return _0x226868;};'use strict';var multer=require('multer');var util=require(_0x0bfd('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0bfd('0x1')]();var auth=require(_0x0bfd('0x2'));var interaction=require(_0x0bfd('0x3'));var config=require(_0x0bfd('0x4'));var controller=require(_0x0bfd('0x5'));router[_0x0bfd('0x6')]('/',auth[_0x0bfd('0x7')](),controller[_0x0bfd('0x8')]);router[_0x0bfd('0x6')](_0x0bfd('0x9'),auth[_0x0bfd('0x7')](),controller['describe']);router[_0x0bfd('0x6')](_0x0bfd('0xa'),auth['isAuthenticated'](),controller[_0x0bfd('0xb')]);router['get']('/:id/download',auth[_0x0bfd('0x7')](),controller[_0x0bfd('0xc')]);router[_0x0bfd('0x6')](_0x0bfd('0xd'),controller[_0x0bfd('0xe')]);router[_0x0bfd('0x6')](_0x0bfd('0xf'),auth[_0x0bfd('0x7')](),controller['downloadTranscribe']);router[_0x0bfd('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0bfd('0x10')](_0x0bfd('0xf'),auth['isAuthenticated'](),controller[_0x0bfd('0x11')]);router[_0x0bfd('0x12')](_0x0bfd('0xa'),auth['isAuthenticated'](),controller[_0x0bfd('0x13')]);router[_0x0bfd('0x14')](_0x0bfd('0xa'),auth[_0x0bfd('0x7')](),controller[_0x0bfd('0x15')]);module[_0x0bfd('0x16')]=router; \ No newline at end of file +var _0x637a=['create','post','runTranscribe','put','update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x637a,0x68));var _0xa637=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x637a[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xa637('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa637('0x1'));var express=require(_0xa637('0x2'));var router=express['Router']();var auth=require(_0xa637('0x3'));var interaction=require(_0xa637('0x4'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0xa637('0x5')]('/',auth[_0xa637('0x6')](),controller[_0xa637('0x7')]);router[_0xa637('0x5')]('/describe',auth[_0xa637('0x6')](),controller[_0xa637('0x8')]);router['get'](_0xa637('0x9'),auth[_0xa637('0x6')](),controller['show']);router[_0xa637('0x5')](_0xa637('0xa'),auth['isAuthenticated'](),controller[_0xa637('0xb')]);router[_0xa637('0x5')](_0xa637('0xc'),controller[_0xa637('0xd')]);router[_0xa637('0x5')](_0xa637('0xe'),auth['isAuthenticated'](),controller[_0xa637('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa637('0x10')]);router[_0xa637('0x11')](_0xa637('0xe'),auth[_0xa637('0x6')](),controller[_0xa637('0x12')]);router[_0xa637('0x13')](_0xa637('0x9'),auth[_0xa637('0x6')](),controller[_0xa637('0x14')]);router[_0xa637('0x15')](_0xa637('0x9'),auth[_0xa637('0x6')](),controller[_0xa637('0x16')]);module[_0xa637('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index e569b2a..a6ae0a9 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 _0x1e36=['format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','STRING','setDataValue','channel','membername','INTEGER','TEXT','NEW','FLOAT','DATE','createdAt'];(function(_0x23b72e,_0x251bfa){var _0x416a86=function(_0x39e30d){while(--_0x39e30d){_0x23b72e['push'](_0x23b72e['shift']());}};_0x416a86(++_0x251bfa);}(_0x1e36,0x90));var _0x61e3=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0x1e36[_0x1ad926];return _0x1b81dc;};'use strict';var Sequelize=require(_0x61e3('0x0'));var moment=require(_0x61e3('0x1'));var path=require(_0x61e3('0x2'));module[_0x61e3('0x3')]={'format':{'type':Sequelize[_0x61e3('0x4')],'get':function(){return this['getDataValue']('value')?path['extname'](this[_0x61e3('0x5')]('value')):undefined;}},'uniqueid':{'type':Sequelize[_0x61e3('0x6')]},'channel':{'type':Sequelize[_0x61e3('0x6')],'set':function(_0x54fa0b){if(_0x54fa0b){this[_0x61e3('0x7')](_0x61e3('0x8'),_0x54fa0b);this[_0x61e3('0x7')](_0x61e3('0x9'),_0x54fa0b['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x61e3('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x61e3('0x6')]},'connectedlinenum':{'type':Sequelize[_0x61e3('0x6')]},'connectedlinename':{'type':Sequelize[_0x61e3('0x6')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x61e3('0x6')]},'exten':{'type':Sequelize[_0x61e3('0x6')]},'value':{'type':Sequelize[_0x61e3('0x6')]},'type':{'type':Sequelize[_0x61e3('0x6')]},'rating':{'type':Sequelize[_0x61e3('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x61e3('0x6')]},'userDisposition':{'type':Sequelize[_0x61e3('0x6')]},'userSecondDisposition':{'type':Sequelize[_0x61e3('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x61e3('0x6')]},'location':{'type':Sequelize[_0x61e3('0xb')]},'transcribeName':{'type':Sequelize[_0x61e3('0x6')]},'transcribeStatus':{'type':Sequelize[_0x61e3('0x6')],'defaultValue':_0x61e3('0xc')},'fileUri':{'type':Sequelize[_0x61e3('0xb')]},'fileText':{'type':Sequelize[_0x61e3('0xb')]},'failureReason':{'type':Sequelize[_0x61e3('0xb')]},'sentiment':{'type':Sequelize[_0x61e3('0x6')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize['FLOAT']},'sNeutral':{'type':Sequelize[_0x61e3('0xd')]},'sMixed':{'type':Sequelize[_0x61e3('0xd')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x61e3('0xe')],'get':function(){return moment(this[_0x61e3('0x5')](_0x61e3('0xf')))[_0x61e3('0x10')](_0x61e3('0x11'))[_0x61e3('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x61e3('0x13')))[_0x61e3('0x10')](_0x61e3('0x11'))[_0x61e3('0x12')]();}}}; \ No newline at end of file +var _0x72b7=['moment','path','exports','value','extname','getDataValue','STRING','channel','setDataValue','membername','split','INTEGER','TEXT','FLOAT','BOOLEAN','format','toString','DATE','updatedAt','sequelize'];(function(_0x86f399,_0x5cc477){var _0x3b8b2e=function(_0xbe80a){while(--_0xbe80a){_0x86f399['push'](_0x86f399['shift']());}};_0x3b8b2e(++_0x5cc477);}(_0x72b7,0x1a3));var _0x772b=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x72b7[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x772b('0x0'));var moment=require(_0x772b('0x1'));var path=require(_0x772b('0x2'));module[_0x772b('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x772b('0x4'))?path[_0x772b('0x5')](this[_0x772b('0x6')](_0x772b('0x4'))):undefined;}},'uniqueid':{'type':Sequelize[_0x772b('0x7')]},'channel':{'type':Sequelize[_0x772b('0x7')],'set':function(_0xfe6888){if(_0xfe6888){this['setDataValue'](_0x772b('0x8'),_0xfe6888);this[_0x772b('0x9')](_0x772b('0xa'),_0xfe6888[_0x772b('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x772b('0x7')]},'calleridnum':{'type':Sequelize[_0x772b('0x7')]},'calleridname':{'type':Sequelize[_0x772b('0x7')]},'connectedlinenum':{'type':Sequelize[_0x772b('0x7')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x772b('0x7')]},'value':{'type':Sequelize[_0x772b('0x7')]},'type':{'type':Sequelize[_0x772b('0x7')]},'rating':{'type':Sequelize[_0x772b('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x772b('0x7')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x772b('0x7')]},'userThirdDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0x772b('0xd')]},'transcribeName':{'type':Sequelize[_0x772b('0x7')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0x772b('0xd')]},'fileText':{'type':Sequelize[_0x772b('0xd')]},'failureReason':{'type':Sequelize[_0x772b('0xd')]},'sentiment':{'type':Sequelize[_0x772b('0x7')]},'sPositive':{'type':Sequelize[_0x772b('0xe')]},'sNegative':{'type':Sequelize[_0x772b('0xe')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x772b('0xe')]},'tempSentiment':{'type':Sequelize[_0x772b('0xf')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x772b('0x6')]('createdAt'))[_0x772b('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x772b('0x11')]();}},'updatedAt':{'type':Sequelize[_0x772b('0x12')],'get':function(){return moment(this[_0x772b('0x6')](_0x772b('0x13')))[_0x772b('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 4514334..7401b55 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 _0x01e3=['status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','map','format','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','catch','create','body','find','download','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','downloads','sequelize','MD5','col','token','$and','push','destroy','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x14df69,_0x2da4be){var _0x506a8e=function(_0x3e2c15){while(--_0x3e2c15){_0x14df69['push'](_0x14df69['shift']());}};_0x506a8e(++_0x2da4be);}(_0x01e3,0x116));var _0x301e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x01e3[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x301e('0x0'));var emlformat=require(_0x301e('0x1'));var rimraf=require(_0x301e('0x2'));var zipdir=require(_0x301e('0x3'));var jsonpatch=require(_0x301e('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x301e('0x5'));var Mustache=require('mustache');var util=require(_0x301e('0x6'));var path=require(_0x301e('0x7'));var sox=require(_0x301e('0x8'));var csv=require(_0x301e('0x9'));var ejs=require(_0x301e('0xa'));var fs=require('fs');var _=require(_0x301e('0xb'));var squel=require(_0x301e('0xc'));var crypto=require('crypto');var jsforce=require(_0x301e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x301e('0x9'));var querystring=require(_0x301e('0xe'));var Papa=require(_0x301e('0xf'));var AWS=require(_0x301e('0x10'));var uuidv4=require(_0x301e('0x11'));var Redis=require('ioredis');var authService=require(_0x301e('0x12'));var qs=require(_0x301e('0x13'));var as=require(_0x301e('0x14'));var hardwareService=require(_0x301e('0x15'));var logger=require('../../config/logger')(_0x301e('0x16'));var utils=require(_0x301e('0x17'));var config=require(_0x301e('0x18'));var licenseUtil=require(_0x301e('0x19'));var db=require(_0x301e('0x1a'))['db'];function respondWithStatusCode(_0x28047a,_0x1257af){_0x1257af=_0x1257af||0xcc;return function(_0x2d53d3){if(_0x2d53d3){return _0x28047a[_0x301e('0x1b')](_0x1257af);}return _0x28047a[_0x301e('0x1c')](_0x1257af)[_0x301e('0x1d')]();};}function respondWithResult(_0x36661f,_0x3e70f1){_0x3e70f1=_0x3e70f1||0xc8;return function(_0x26a1cc){if(_0x26a1cc){return _0x36661f['status'](_0x3e70f1)[_0x301e('0x1e')](_0x26a1cc);}};}function respondWithFilteredResult(_0xb251ca,_0xbf006c){return function(_0x5ee426){if(_0x5ee426){var _0x55782d=_0x5ee426[_0x301e('0x1f')],_0x54f3a6=_0xbf006c[_0x301e('0x20')],_0x3a3059=_0xbf006c['offset']+_0xbf006c[_0x301e('0x21')],_0x12ebc7;if(_0x3a3059>=_0x55782d){_0x3a3059=_0x55782d;_0x12ebc7=0xc8;}else{_0x12ebc7=0xce;}_0xb251ca[_0x301e('0x1c')](_0x12ebc7);return _0xb251ca[_0x301e('0x22')](_0x301e('0x23'),_0x54f3a6+'-'+_0x3a3059+'/'+_0x55782d)[_0x301e('0x1e')](_0x5ee426);}return null;};}function patchUpdates(_0xd4e95a){return function(_0x2f7186){try{jsonpatch[_0x301e('0x24')](_0x2f7186,_0xd4e95a,!![]);}catch(_0x250e4b){return BPromise[_0x301e('0x25')](_0x250e4b);}return _0x2f7186['save']();};}function saveUpdates(_0x3babc0,_0x5c0459){return function(_0x4de49f){if(_0x4de49f){return _0x4de49f[_0x301e('0x26')](_0x3babc0)[_0x301e('0x27')](function(_0xc81323){return _0xc81323;});}return null;};}function removeEntity(_0x1aa71a,_0x18d847){return function(_0x2e67c2){if(_0x2e67c2){return _0x2e67c2['destroy']()[_0x301e('0x27')](function(){_0x1aa71a[_0x301e('0x1c')](0xcc)[_0x301e('0x1d')]();});}};}function handleEntityNotFound(_0x3d2eb9,_0x436217){return function(_0x430303){if(!_0x430303){_0x3d2eb9[_0x301e('0x1b')](0x194);}return _0x430303;};}function handleError(_0x5e9607,_0x15475){_0x15475=_0x15475||0x1f4;return function(_0x539010){logger[_0x301e('0x28')](_0x539010[_0x301e('0x29')]);if(_0x539010[_0x301e('0x2a')]){delete _0x539010[_0x301e('0x2a')];}_0x5e9607[_0x301e('0x1c')](_0x15475)[_0x301e('0x2b')](_0x539010);};}exports['index']=function(_0x47d578,_0x1c93f2){var _0xbb8dce={},_0x3d65fa={},_0xae2340={'count':0x0,'rows':[]};var _0xe1ed90=_['map'](db[_0x301e('0x2c')][_0x301e('0x2d')],function(_0x33c7fc){return{'name':_0x33c7fc[_0x301e('0x2e')],'type':_0x33c7fc[_0x301e('0x2f')][_0x301e('0x30')]};});_0x3d65fa[_0x301e('0x31')]=_[_0x301e('0x32')](_[_0x301e('0x33')](_0xe1ed90,_0x301e('0x2a')),[_0x301e('0x34')]);_0x3d65fa[_0x301e('0x35')]=_[_0x301e('0x36')](_0x47d578['query']);_0x3d65fa[_0x301e('0x37')]=_['intersection'](_0x3d65fa['model'],_0x3d65fa[_0x301e('0x35')]);_0xbb8dce['attributes']=_[_0x301e('0x38')](_0x3d65fa[_0x301e('0x31')],qs[_0x301e('0x39')](_0x47d578[_0x301e('0x35')]['fields']));_0xbb8dce['attributes']=_0xbb8dce[_0x301e('0x3a')][_0x301e('0x3b')]?_0xbb8dce[_0x301e('0x3a')]:_0x3d65fa[_0x301e('0x31')];if(!_0x47d578[_0x301e('0x35')]['hasOwnProperty'](_0x301e('0x3c'))){_0xbb8dce[_0x301e('0x21')]=qs[_0x301e('0x21')](_0x47d578[_0x301e('0x35')]['limit']);_0xbb8dce['offset']=qs['offset'](_0x47d578['query']['offset']);}_0xbb8dce['order']=qs[_0x301e('0x3d')](_0x47d578['query'][_0x301e('0x3d')]);_0xbb8dce[_0x301e('0x3e')]=qs[_0x301e('0x37')](_[_0x301e('0x3f')](_0x47d578[_0x301e('0x35')],_0x3d65fa[_0x301e('0x37')]),_0xe1ed90);if(_0x47d578[_0x301e('0x35')][_0x301e('0x40')]){_0xbb8dce[_0x301e('0x3e')]=_[_0x301e('0x41')](_0xbb8dce[_0x301e('0x3e')],{'$or':_[_0x301e('0x33')](_0xe1ed90,function(_0x4ac31d){if(_0x4ac31d[_0x301e('0x2f')]!==_0x301e('0x42')){var _0x257b26={};_0x257b26[_0x4ac31d[_0x301e('0x2a')]]={'$like':'%'+_0x47d578[_0x301e('0x35')][_0x301e('0x40')]+'%'};return _0x257b26;}})});}_0xbb8dce=_[_0x301e('0x41')]({},_0xbb8dce,_0x47d578[_0x301e('0x43')]);var _0xc1a2ab={'where':_0xbb8dce[_0x301e('0x3e')]};return db[_0x301e('0x2c')]['count'](_0xc1a2ab)[_0x301e('0x27')](function(_0x5861c3){_0xae2340['count']=_0x5861c3;if(_0x47d578[_0x301e('0x35')]['includeAll']){_0xbb8dce[_0x301e('0x44')]=[{'all':!![]}];}return db[_0x301e('0x2c')][_0x301e('0x45')](_0xbb8dce);})[_0x301e('0x27')](function(_0x414496){_0xae2340[_0x301e('0x46')]=_0x414496;return _0xae2340;})[_0x301e('0x27')](respondWithFilteredResult(_0x1c93f2,_0xbb8dce))['catch'](handleError(_0x1c93f2,null));};exports[_0x301e('0x47')]=function(_0x19c4d8,_0xe32bc3){var _0x2cc63e={'raw':![],'where':{'id':_0x19c4d8[_0x301e('0x48')]['id']}},_0x5c0664={};_0x5c0664[_0x301e('0x31')]=_[_0x301e('0x36')](db[_0x301e('0x2c')][_0x301e('0x2d')]);_0x5c0664[_0x301e('0x35')]=_[_0x301e('0x36')](_0x19c4d8[_0x301e('0x35')]);_0x5c0664['filters']=_[_0x301e('0x38')](_0x5c0664[_0x301e('0x31')],_0x5c0664[_0x301e('0x35')]);_0x2cc63e['attributes']=_[_0x301e('0x38')](_0x5c0664[_0x301e('0x31')],qs[_0x301e('0x39')](_0x19c4d8[_0x301e('0x35')]['fields']));_0x2cc63e[_0x301e('0x3a')]=_0x2cc63e[_0x301e('0x3a')][_0x301e('0x3b')]?_0x2cc63e[_0x301e('0x3a')]:_0x5c0664[_0x301e('0x31')];if(_0x19c4d8[_0x301e('0x35')][_0x301e('0x49')]){_0x2cc63e[_0x301e('0x44')]=[{'all':!![]}];}_0x2cc63e=_['merge']({},_0x2cc63e,_0x19c4d8[_0x301e('0x43')]);return db['VoiceRecording']['find'](_0x2cc63e)[_0x301e('0x27')](handleEntityNotFound(_0xe32bc3,null))['then'](respondWithResult(_0xe32bc3,null))[_0x301e('0x4a')](handleError(_0xe32bc3,null));};exports[_0x301e('0x4b')]=function(_0x6e6914,_0x236126){return db['VoiceRecording']['create'](_0x6e6914[_0x301e('0x4c')],{})[_0x301e('0x27')](respondWithResult(_0x236126,0xc9))[_0x301e('0x4a')](handleError(_0x236126,null));};exports[_0x301e('0x26')]=function(_0x101318,_0x4e1441){if(_0x101318[_0x301e('0x4c')]['id']){delete _0x101318['body']['id'];}return db[_0x301e('0x2c')][_0x301e('0x4d')]({'where':{'id':_0x101318[_0x301e('0x48')]['id']}})[_0x301e('0x27')](handleEntityNotFound(_0x4e1441,null))[_0x301e('0x27')](saveUpdates(_0x101318[_0x301e('0x4c')],null))[_0x301e('0x27')](respondWithResult(_0x4e1441,null))[_0x301e('0x4a')](handleError(_0x4e1441,null));};exports['describe']=function(_0x123f67,_0x12a957){return db[_0x301e('0x2c')]['describe']()[_0x301e('0x27')](respondWithResult(_0x12a957,null))[_0x301e('0x4a')](handleError(_0x12a957,null));};exports[_0x301e('0x4e')]=function(_0x23e463,_0x742398,_0x5e530e){var _0x1f5e1b=require('../../components/encryptor');var _0x8576d0=![];var _0x2ef7a0={};if(_0x23e463[_0x301e('0x35')]['type']&&_0x23e463[_0x301e('0x35')]['type']===_0x301e('0x4f')){_0x2ef7a0['uniqueid']=_0x23e463[_0x301e('0x48')]['id'];}else{_0x2ef7a0['id']=_0x23e463[_0x301e('0x48')]['id'];}return db['VoiceRecording'][_0x301e('0x4d')]({'where':_0x2ef7a0,'attributes':['id',_0x301e('0x50')],'raw':!![]})[_0x301e('0x27')](handleEntityNotFound(_0x742398,null))[_0x301e('0x27')](function(_0x57eceb){if(_0x57eceb){var _0xaf1ff9=_0x57eceb[_0x301e('0x50')];var _0x34ba14=util[_0x301e('0x34')](_0x301e('0x51'),_0xaf1ff9);if(fs['existsSync'](_0x34ba14)){_0x8576d0=!![];return _0x1f5e1b[_0x301e('0x52')](_0x34ba14,_0xaf1ff9,config[_0x301e('0x53')][_0x301e('0x54')])[_0x301e('0x27')](function(){return _0x57eceb;});}return _0x57eceb;}})[_0x301e('0x27')](function(_0x1fe2b7){if(_0x1fe2b7){var _0x401215=_0x1fe2b7[_0x301e('0x50')];if(!fs[_0x301e('0x55')](_0x401215)){throw new db[(_0x301e('0x56'))][(_0x301e('0x57'))]('VoiceRecording\x20not\x20found');}if(_0x1fe2b7[_0x301e('0x58')]){return _0x742398[_0x301e('0x4e')](_0x401215,_0x1fe2b7[_0x301e('0x58')]+path[_0x301e('0x59')](_0x401215),function(){if(_0x8576d0){fs[_0x301e('0x5a')](_0x401215);}});}else{return _0x742398[_0x301e('0x4e')](_0x401215,function(_0x559c30){if(_0x8576d0){fs[_0x301e('0x5a')](_0x401215);}});}}})['catch'](function(_0x20a0cc){if(_0x20a0cc[_0x301e('0x5b')]===_0x301e('0x5c')){_0x742398[_0x301e('0x1c')](0x194)[_0x301e('0x2b')]('Not\x20found');}else{return handleError(_0x742398,null);}});};exports[_0x301e('0x5d')]=function(_0x1323e1,_0x26e971,_0x4917f3){var _0x52900a=require('../../components/encryptor');var _0x3e6a2d=![];var _0xeb6eb7={'$and':[db[_0x301e('0x5e')][_0x301e('0x3e')](db[_0x301e('0x5e')]['fn'](_0x301e('0x5f'),db[_0x301e('0x5e')][_0x301e('0x60')]('uniqueid')),_0x1323e1[_0x301e('0x35')][_0x301e('0x61')])]};if(_0x1323e1['query'][_0x301e('0x2f')]&&_0x1323e1[_0x301e('0x35')][_0x301e('0x2f')]===_0x301e('0x4f')){_0xeb6eb7[_0x301e('0x62')][_0x301e('0x63')]({'uniqueid':_0x1323e1[_0x301e('0x48')]['id']});}else{_0xeb6eb7[_0x301e('0x62')][_0x301e('0x63')]({'id':_0x1323e1[_0x301e('0x48')]['id']});}return db['VoiceRecording'][_0x301e('0x4d')]({'where':_0xeb6eb7,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x26e971,null))[_0x301e('0x27')](function(_0x2add42){if(_0x2add42){var _0x58d98b=util['format'](_0x301e('0x51'),_0x2add42['value']);if(fs[_0x301e('0x55')](_0x58d98b)){_0x3e6a2d=!![];return _0x52900a[_0x301e('0x52')](_0x58d98b,_0x2add42[_0x301e('0x50')],config[_0x301e('0x53')][_0x301e('0x54')])[_0x301e('0x27')](function(){return _0x2add42;});}return _0x2add42;}})[_0x301e('0x27')](function(_0x13e49c){if(_0x13e49c){if(!fs[_0x301e('0x55')](_0x13e49c[_0x301e('0x50')])){throw new db[(_0x301e('0x56'))]['ValidationError'](_0x301e('0x5c'));}if(_0x13e49c[_0x301e('0x58')]){return _0x26e971['download'](_0x13e49c[_0x301e('0x50')],_0x13e49c[_0x301e('0x58')]+path[_0x301e('0x59')](_0x13e49c[_0x301e('0x50')]),function(){if(_0x3e6a2d){fs['unlink'](_0x13e49c[_0x301e('0x50')]);}});}else{return _0x26e971[_0x301e('0x4e')](_0x13e49c['value'],function(_0xd53616){if(_0x3e6a2d){fs[_0x301e('0x5a')](_0x13e49c[_0x301e('0x50')]);}});}}})['catch'](handleError(_0x26e971,null));};exports[_0x301e('0x64')]=function(_0x640d5,_0x3059ec){return db[_0x301e('0x2c')][_0x301e('0x4d')]({'where':{'id':_0x640d5['params']['id']}})[_0x301e('0x27')](function(_0x1d40a9){if(!_0x1d40a9)throw new ReferenceError('Entity\x20not\x20found');return _0x1d40a9;})['then'](function(_0x53c0fe){var _0x4801df=_0x53c0fe['value'];logger[_0x301e('0x65')](_0x301e('0x66'),_0x4801df);if(!_['isNil'](_0x53c0fe[_0x301e('0x50')])&&fs[_0x301e('0x55')](_0x4801df)){logger['info'](_0x301e('0x67')+_0x4801df+_0x301e('0x68'));fs[_0x301e('0x69')](_0x4801df);}_0x4801df=_0x4801df+_0x301e('0x6a');if(!_['isNil'](_0x53c0fe[_0x301e('0x50')])&&fs[_0x301e('0x55')](_0x4801df)){logger[_0x301e('0x65')](_0x301e('0x67')+_0x4801df+_0x301e('0x68'));fs['unlinkSync'](_0x4801df);}return _0x53c0fe;})[_0x301e('0x27')](function(_0x159081){if(!_0x159081)throw new InternalError();return _0x159081['destroy']();})[_0x301e('0x27')](function(){_0x3059ec['status'](0xcc)[_0x301e('0x1d')]();})[_0x301e('0x4a')](handleError(_0x3059ec,null));};function getBucketslist(_0x4a693a,_0x55f112,_0x3e3d11){return new Promise(function(_0x2da834,_0x1f0a33){var _0x45111b=new AWS['S3']({'accessKeyId':_0x55f112,'secretAccessKey':_0x4a693a,'region':_0x3e3d11});_0x45111b[_0x301e('0x6b')]({},function(_0x57704e,_0x24460c){if(_0x57704e){return _0x1f0a33(_0x57704e);}else{return _0x2da834(_0x24460c);}});});}function createBucket(_0x142f89,_0x36071a,_0x2d2d07,_0x3d52dc){return new Promise(function(_0x26cf3d,_0x5983e4){var _0x2f2712=new AWS['S3']({'accessKeyId':_0x36071a,'secretAccessKey':_0x142f89,'region':_0x2d2d07});_0x2f2712['createBucket']({'Bucket':_0x3d52dc},function(_0x244d23,_0xda7c9){if(_0x244d23){return _0x5983e4(_0x244d23);}else{return _0x26cf3d(_0xda7c9);}});});}function uploadFile(_0x355d05,_0x490ef9,_0x5ca89e,_0x32a631,_0x3ec64d,_0x3828f6){return new Promise(function(_0x34006d,_0x5733c7){var _0x33d8c2=new AWS['S3']({'accessKeyId':_0x490ef9,'secretAccessKey':_0x355d05,'region':_0x5ca89e});_0x33d8c2[_0x301e('0x6c')]({'Bucket':_0x32a631,'Key':_0x3ec64d,'Body':_0x3828f6},function(_0x7ce344,_0x27cde0){if(_0x7ce344){return _0x5733c7(_0x7ce344);}else{return _0x34006d(_0x27cde0);}});});}function startTranscribe(_0x242478,_0x231d75,_0x51c311,_0x2ae18f,_0x51aad6,_0x227f4e){return new Promise(function(_0x51155b,_0x28fbc7){var _0x43c505=new AWS[(_0x301e('0x6d'))]({'accessKeyId':_0x231d75,'secretAccessKey':_0x242478,'region':_0x51c311});_0x43c505[_0x301e('0x6e')]({'TranscriptionJobName':_0x2ae18f,'LanguageCode':_0x51aad6,'Media':{'MediaFileUri':_0x227f4e}},function(_0x3302c7,_0x53dc6f){if(_0x3302c7){return _0x28fbc7(_0x3302c7);}else{return _0x51155b(_0x53dc6f);}});});}function transcribe(_0x52b6b4,_0x2b1936,_0x51c583,_0x3c12cd,_0x3d0cd9,_0x58eab5,_0xf6f7b9){return new Promise(function(_0x33d555,_0x2a44ff){var _0x412d72={};logger['info'](util['format'](_0x301e('0x6f'),_0x52b6b4,_0x3d0cd9));return uploadFile(_0x2b1936,_0x51c583,_0x3c12cd,_0x3d0cd9,path[_0x301e('0x70')](_0x58eab5),fs['readFileSync'](_0x58eab5))['then'](function(_0x2f427f){logger[_0x301e('0x65')](util['format'](_0x301e('0x71'),_0x52b6b4,_0x3d0cd9,_0x2f427f[_0x301e('0x72')]));_0x412d72[_0x301e('0x73')]=_0x2f427f['Bucket'];_0x412d72[_0x301e('0x74')]=_0x2f427f['Location'];logger[_0x301e('0x65')](util[_0x301e('0x34')](_0x301e('0x75'),_0x52b6b4));return startTranscribe(_0x2b1936,_0x51c583,_0x3c12cd,uuidv4(),_0xf6f7b9,_0x2f427f[_0x301e('0x72')]);})[_0x301e('0x27')](function(_0x44e21b){logger[_0x301e('0x65')](util[_0x301e('0x34')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x52b6b4,_0x44e21b[_0x301e('0x76')][_0x301e('0x77')]));_0x412d72[_0x301e('0x78')]=_0x44e21b[_0x301e('0x76')]['TranscriptionJobName'];_0x412d72[_0x301e('0x79')]=_0x44e21b['TranscriptionJob'][_0x301e('0x7a')];return _0x33d555(_0x412d72);})['catch'](function(_0x4ce5ef){return _0x2a44ff(_0x4ce5ef);});});}exports[_0x301e('0x7b')]=function(_0x8213f2,_0x3b5424,_0x449130){var _0x72f61c;var _0x482262;var _0x18d2df;var _0x3260cb=require('../../components/encryptor');return db[_0x301e('0x2c')][_0x301e('0x7c')]({'where':{'id':_0x8213f2['params']['id']}})[_0x301e('0x27')](function(_0x5dcfad){if(_0x5dcfad){var _0x15b78a=util[_0x301e('0x34')](_0x301e('0x51'),_0x5dcfad[_0x301e('0x50')]);if(fs[_0x301e('0x55')](_0x15b78a)){cypher=!![];return _0x3260cb[_0x301e('0x52')](_0x15b78a,_0x5dcfad[_0x301e('0x50')],config[_0x301e('0x53')][_0x301e('0x54')])[_0x301e('0x27')](function(){return _0x5dcfad;});}return _0x5dcfad;}})[_0x301e('0x27')](function(_0x5e7ed7){if(!_0x5e7ed7){throw new db['Sequelize'][(_0x301e('0x57'))](_0x301e('0x7d'));}_0x482262=_0x5e7ed7;return db[_0x301e('0x7e')]['findOne']({'where':{'id':0x1}});})[_0x301e('0x27')](handleEntityNotFound(_0x3b5424,null))[_0x301e('0x27')](function(_0xeeade3){if(_0xeeade3){_0x72f61c=_0xeeade3;if(!_0x72f61c[_0x301e('0x7f')]||!_0x72f61c[_0x301e('0x80')]||!_0x72f61c[_0x301e('0x81')]||!_0x72f61c[_0x301e('0x82')]||!_0x72f61c[_0x301e('0x73')]){throw new db[(_0x301e('0x56'))]['ValidationError'](_0x301e('0x83'));}if(_0x8213f2[_0x301e('0x4c')]['runSentiment']&&(!_0x72f61c[_0x301e('0x84')]||!_0x72f61c[_0x301e('0x85')]||!_0x72f61c[_0x301e('0x86')]||!_0x72f61c[_0x301e('0x82')]||!_0x72f61c[_0x301e('0x73')])){throw new db['Sequelize'][(_0x301e('0x57'))](_0x301e('0x87'));}return db[_0x301e('0x88')]['findOne']({'where':{'id':_0x72f61c['transcribeAccountId']}});}})[_0x301e('0x27')](function(_0x4a80dc){if(!_0x4a80dc){throw new db[(_0x301e('0x56'))][(_0x301e('0x57'))](_0x301e('0x89'));}if(!_0x4a80dc[_0x301e('0x8a')]||!_0x4a80dc[_0x301e('0x8b')]){throw new db['Sequelize'][(_0x301e('0x57'))]('Cloud\x20Provider\x20not\x20configured');}_0x18d2df=_0x4a80dc;return getBucketslist(_0x18d2df[_0x301e('0x8a')],_0x18d2df[_0x301e('0x8b')],_0x72f61c[_0x301e('0x81')]);})[_0x301e('0x27')](function(_0x435f60){if(_0x435f60&&_0x435f60[_0x301e('0x8c')]){var _0x3e967b=_[_0x301e('0x4d')](_0x435f60['Buckets'],function(_0x5c1a72){return _0x5c1a72[_0x301e('0x8d')]===_0x72f61c[_0x301e('0x73')];});if(!_0x3e967b){logger[_0x301e('0x65')](util[_0x301e('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x8213f2['params']['id'],_0x72f61c['bucket']));return createBucket(_0x18d2df['data1'],_0x18d2df[_0x301e('0x8b')],_0x72f61c['transcribeRegion'],_0x72f61c[_0x301e('0x73')]);}logger['info'](util[_0x301e('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x8213f2[_0x301e('0x48')]['id'],_0x72f61c[_0x301e('0x73')]));return;}})[_0x301e('0x27')](function(_0x33589c){if(_0x482262['transcribeStatus']==='NEW'){return transcribe(_0x8213f2[_0x301e('0x48')]['id'],_0x18d2df[_0x301e('0x8a')],_0x18d2df[_0x301e('0x8b')],_0x72f61c[_0x301e('0x81')],_0x72f61c[_0x301e('0x73')],_0x482262[_0x301e('0x50')],_0x72f61c[_0x301e('0x82')]);}else{logger[_0x301e('0x65')](util[_0x301e('0x34')](_0x301e('0x8e'),_0x8213f2[_0x301e('0x48')]['id']));return{'transcribeStatus':_0x301e('0x8f')};}})[_0x301e('0x27')](function(_0x61b646){if(_0x61b646){_0x61b646[_0x301e('0x90')]=_0x8213f2[_0x301e('0x4c')][_0x301e('0x91')];return _0x482262[_0x301e('0x92')](_0x61b646);}})[_0x301e('0x27')](respondWithResult(_0x3b5424,null))[_0x301e('0x4a')](handleError(_0x3b5424,null));};function writeFile(_0x156ec2,_0x16b0b0){return new Promise(function(_0x3be4f0,_0x35ebb4){fs[_0x301e('0x93')](_0x16b0b0,_0x156ec2,function(_0xdcfda4,_0x12679e){if(_0xdcfda4){return _0x35ebb4(_0xdcfda4);}else{return _0x3be4f0(_0x12679e);}});});}exports[_0x301e('0x94')]=function(_0x41674d,_0x3aff2f,_0x4e3d17){return db[_0x301e('0x2c')][_0x301e('0x7c')]({'where':{'id':_0x41674d[_0x301e('0x48')]['id']}})[_0x301e('0x27')](handleEntityNotFound(_0x3aff2f))[_0x301e('0x27')](function(_0x55a047){if(_0x55a047&&_0x55a047[_0x301e('0x95')]){var _0x1a9c49=_0x55a047[_0x301e('0x95')];var _0x2db853=config['root']+_0x301e('0x96')+_0x55a047['id']+_0x301e('0x97');if(fs[_0x301e('0x55')](_0x2db853)){return _0x2db853;}return writeFile(_0x1a9c49,_0x2db853)[_0x301e('0x27')](function(){return _0x2db853;});}else{throw new db[(_0x301e('0x56'))][(_0x301e('0x57'))](_0x301e('0x98'));}})['then'](function(_0x878395){return _0x3aff2f['download'](_0x878395);})['catch'](handleError(_0x3aff2f));}; \ No newline at end of file +var _0x48d7=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','body','describe','download','../../components/encryptor','value','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','MD5','uniqueid','token','push','$and','recording','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','language','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','uuid/v4'];(function(_0x2f6fcf,_0x3d44af){var _0x180fc1=function(_0x505fa7){while(--_0x505fa7){_0x2f6fcf['push'](_0x2f6fcf['shift']());}};_0x180fc1(++_0x3d44af);}(_0x48d7,0x11f));var _0x748d=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x48d7[_0x47aa64];return _0x549c7a;};'use strict';var pdf=require(_0x748d('0x0'));var emlformat=require(_0x748d('0x1'));var rimraf=require(_0x748d('0x2'));var zipdir=require(_0x748d('0x3'));var jsonpatch=require(_0x748d('0x4'));var rp=require(_0x748d('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x748d('0x6'));var util=require(_0x748d('0x7'));var path=require('path');var sox=require(_0x748d('0x8'));var csv=require(_0x748d('0x9'));var ejs=require(_0x748d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x748d('0xb'));var crypto=require('crypto');var jsforce=require(_0x748d('0xc'));var deskjs=require(_0x748d('0xd'));var toCsv=require(_0x748d('0x9'));var querystring=require(_0x748d('0xe'));var Papa=require(_0x748d('0xf'));var AWS=require('aws-sdk');var uuidv4=require(_0x748d('0x10'));var Redis=require(_0x748d('0x11'));var authService=require(_0x748d('0x12'));var qs=require(_0x748d('0x13'));var as=require(_0x748d('0x14'));var hardwareService=require(_0x748d('0x15'));var logger=require('../../config/logger')(_0x748d('0x16'));var utils=require(_0x748d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x748d('0x18'));var db=require(_0x748d('0x19'))['db'];function respondWithStatusCode(_0x9079d6,_0x47581f){_0x47581f=_0x47581f||0xcc;return function(_0x19e607){if(_0x19e607){return _0x9079d6[_0x748d('0x1a')](_0x47581f);}return _0x9079d6['status'](_0x47581f)[_0x748d('0x1b')]();};}function respondWithResult(_0x399768,_0x327213){_0x327213=_0x327213||0xc8;return function(_0x52ae5c){if(_0x52ae5c){return _0x399768[_0x748d('0x1c')](_0x327213)[_0x748d('0x1d')](_0x52ae5c);}};}function respondWithFilteredResult(_0x118fb2,_0x138a59){return function(_0x487f35){if(_0x487f35){var _0xea8717=_0x487f35[_0x748d('0x1e')],_0x12ed98=_0x138a59[_0x748d('0x1f')],_0x4ed3da=_0x138a59[_0x748d('0x1f')]+_0x138a59['limit'],_0x2b79cd;if(_0x4ed3da>=_0xea8717){_0x4ed3da=_0xea8717;_0x2b79cd=0xc8;}else{_0x2b79cd=0xce;}_0x118fb2[_0x748d('0x1c')](_0x2b79cd);return _0x118fb2[_0x748d('0x20')](_0x748d('0x21'),_0x12ed98+'-'+_0x4ed3da+'/'+_0xea8717)[_0x748d('0x1d')](_0x487f35);}return null;};}function patchUpdates(_0x543710){return function(_0x5c0a33){try{jsonpatch[_0x748d('0x22')](_0x5c0a33,_0x543710,!![]);}catch(_0x5e2549){return BPromise[_0x748d('0x23')](_0x5e2549);}return _0x5c0a33['save']();};}function saveUpdates(_0x1c8909,_0x145228){return function(_0x4e625a){if(_0x4e625a){return _0x4e625a[_0x748d('0x24')](_0x1c8909)[_0x748d('0x25')](function(_0x423a17){return _0x423a17;});}return null;};}function removeEntity(_0x2c73a3,_0x51457d){return function(_0x10efd0){if(_0x10efd0){return _0x10efd0[_0x748d('0x26')]()[_0x748d('0x25')](function(){_0x2c73a3[_0x748d('0x1c')](0xcc)[_0x748d('0x1b')]();});}};}function handleEntityNotFound(_0x355f0e,_0x246e04){return function(_0x91155c){if(!_0x91155c){_0x355f0e[_0x748d('0x1a')](0x194);}return _0x91155c;};}function handleError(_0x42d364,_0x3d2466){_0x3d2466=_0x3d2466||0x1f4;return function(_0x21c98d){logger['error'](_0x21c98d[_0x748d('0x27')]);if(_0x21c98d[_0x748d('0x28')]){delete _0x21c98d['name'];}_0x42d364[_0x748d('0x1c')](_0x3d2466)[_0x748d('0x29')](_0x21c98d);};}exports[_0x748d('0x2a')]=function(_0xff0c05,_0x1f6f20){var _0xd8d80e={},_0x41a7dd={},_0x49ade4={'count':0x0,'rows':[]};var _0x1e054b=_[_0x748d('0x2b')](db[_0x748d('0x2c')][_0x748d('0x2d')],function(_0x17c0d0){return{'name':_0x17c0d0[_0x748d('0x2e')],'type':_0x17c0d0[_0x748d('0x2f')][_0x748d('0x30')]};});_0x41a7dd[_0x748d('0x31')]=_[_0x748d('0x32')](_[_0x748d('0x2b')](_0x1e054b,_0x748d('0x28')),['format']);_0x41a7dd[_0x748d('0x33')]=_[_0x748d('0x34')](_0xff0c05['query']);_0x41a7dd['filters']=_[_0x748d('0x35')](_0x41a7dd[_0x748d('0x31')],_0x41a7dd[_0x748d('0x33')]);_0xd8d80e[_0x748d('0x36')]=_[_0x748d('0x35')](_0x41a7dd[_0x748d('0x31')],qs[_0x748d('0x37')](_0xff0c05[_0x748d('0x33')][_0x748d('0x37')]));_0xd8d80e[_0x748d('0x36')]=_0xd8d80e['attributes']['length']?_0xd8d80e['attributes']:_0x41a7dd[_0x748d('0x31')];if(!_0xff0c05['query'][_0x748d('0x38')](_0x748d('0x39'))){_0xd8d80e['limit']=qs[_0x748d('0x3a')](_0xff0c05[_0x748d('0x33')]['limit']);_0xd8d80e[_0x748d('0x1f')]=qs[_0x748d('0x1f')](_0xff0c05['query'][_0x748d('0x1f')]);}_0xd8d80e[_0x748d('0x3b')]=qs[_0x748d('0x3c')](_0xff0c05[_0x748d('0x33')][_0x748d('0x3c')]);_0xd8d80e[_0x748d('0x3d')]=qs['filters'](_[_0x748d('0x3e')](_0xff0c05[_0x748d('0x33')],_0x41a7dd['filters']),_0x1e054b);if(_0xff0c05[_0x748d('0x33')]['filter']){_0xd8d80e[_0x748d('0x3d')]=_['merge'](_0xd8d80e[_0x748d('0x3d')],{'$or':_[_0x748d('0x2b')](_0x1e054b,function(_0x4453c1){if(_0x4453c1['type']!==_0x748d('0x3f')){var _0x5009a7={};_0x5009a7[_0x4453c1[_0x748d('0x28')]]={'$like':'%'+_0xff0c05['query'][_0x748d('0x40')]+'%'};return _0x5009a7;}})});}_0xd8d80e=_[_0x748d('0x41')]({},_0xd8d80e,_0xff0c05[_0x748d('0x42')]);var _0x1893d0={'where':_0xd8d80e[_0x748d('0x3d')]};return db[_0x748d('0x2c')][_0x748d('0x1e')](_0x1893d0)[_0x748d('0x25')](function(_0x51f52f){_0x49ade4['count']=_0x51f52f;if(_0xff0c05[_0x748d('0x33')][_0x748d('0x43')]){_0xd8d80e[_0x748d('0x44')]=[{'all':!![]}];}return db[_0x748d('0x2c')][_0x748d('0x45')](_0xd8d80e);})[_0x748d('0x25')](function(_0x375ae4){_0x49ade4['rows']=_0x375ae4;return _0x49ade4;})[_0x748d('0x25')](respondWithFilteredResult(_0x1f6f20,_0xd8d80e))[_0x748d('0x46')](handleError(_0x1f6f20,null));};exports[_0x748d('0x47')]=function(_0x58c4fc,_0x55eaf3){var _0x506549={'raw':![],'where':{'id':_0x58c4fc[_0x748d('0x48')]['id']}},_0x3d6e05={};_0x3d6e05[_0x748d('0x31')]=_[_0x748d('0x34')](db[_0x748d('0x2c')][_0x748d('0x2d')]);_0x3d6e05[_0x748d('0x33')]=_[_0x748d('0x34')](_0x58c4fc[_0x748d('0x33')]);_0x3d6e05['filters']=_[_0x748d('0x35')](_0x3d6e05['model'],_0x3d6e05[_0x748d('0x33')]);_0x506549[_0x748d('0x36')]=_[_0x748d('0x35')](_0x3d6e05['model'],qs[_0x748d('0x37')](_0x58c4fc[_0x748d('0x33')][_0x748d('0x37')]));_0x506549[_0x748d('0x36')]=_0x506549[_0x748d('0x36')][_0x748d('0x49')]?_0x506549[_0x748d('0x36')]:_0x3d6e05[_0x748d('0x31')];if(_0x58c4fc[_0x748d('0x33')][_0x748d('0x43')]){_0x506549['include']=[{'all':!![]}];}_0x506549=_[_0x748d('0x41')]({},_0x506549,_0x58c4fc[_0x748d('0x42')]);return db['VoiceRecording'][_0x748d('0x4a')](_0x506549)['then'](handleEntityNotFound(_0x55eaf3,null))['then'](respondWithResult(_0x55eaf3,null))['catch'](handleError(_0x55eaf3,null));};exports[_0x748d('0x4b')]=function(_0x5f4f3a,_0xe6b421){return db['VoiceRecording'][_0x748d('0x4b')](_0x5f4f3a[_0x748d('0x4c')],{})[_0x748d('0x25')](respondWithResult(_0xe6b421,0xc9))[_0x748d('0x46')](handleError(_0xe6b421,null));};exports[_0x748d('0x24')]=function(_0x16f2c1,_0x298233){if(_0x16f2c1['body']['id']){delete _0x16f2c1[_0x748d('0x4c')]['id'];}return db[_0x748d('0x2c')][_0x748d('0x4a')]({'where':{'id':_0x16f2c1['params']['id']}})[_0x748d('0x25')](handleEntityNotFound(_0x298233,null))[_0x748d('0x25')](saveUpdates(_0x16f2c1[_0x748d('0x4c')],null))['then'](respondWithResult(_0x298233,null))[_0x748d('0x46')](handleError(_0x298233,null));};exports[_0x748d('0x4d')]=function(_0x5a713c,_0x35f61b){return db['VoiceRecording'][_0x748d('0x4d')]()[_0x748d('0x25')](respondWithResult(_0x35f61b,null))[_0x748d('0x46')](handleError(_0x35f61b,null));};exports[_0x748d('0x4e')]=function(_0x3a12d6,_0x3433cf,_0x209060){var _0x388340=require(_0x748d('0x4f'));var _0x376fea=![];var _0x59f63c={};if(_0x3a12d6['query'][_0x748d('0x2f')]&&_0x3a12d6[_0x748d('0x33')][_0x748d('0x2f')]==='uniqueid'){_0x59f63c['uniqueid']=_0x3a12d6[_0x748d('0x48')]['id'];}else{_0x59f63c['id']=_0x3a12d6[_0x748d('0x48')]['id'];}return db['VoiceRecording']['find']({'where':_0x59f63c,'attributes':['id',_0x748d('0x50')],'raw':!![]})[_0x748d('0x25')](handleEntityNotFound(_0x3433cf,null))['then'](function(_0x357ac9){if(_0x357ac9){var _0x2fe7a0=_0x357ac9[_0x748d('0x50')];var _0x2c5730=util[_0x748d('0x51')](_0x748d('0x52'),_0x2fe7a0);if(fs[_0x748d('0x53')](_0x2c5730)){_0x376fea=!![];return _0x388340[_0x748d('0x54')](_0x2c5730,_0x2fe7a0,config[_0x748d('0x55')]['recording'])[_0x748d('0x25')](function(){return _0x357ac9;});}return _0x357ac9;}})['then'](function(_0x16265a){if(_0x16265a){var _0x43dba8=_0x16265a[_0x748d('0x50')];if(!fs[_0x748d('0x53')](_0x43dba8)){throw new db[(_0x748d('0x56'))][(_0x748d('0x57'))](_0x748d('0x58'));}if(_0x16265a[_0x748d('0x59')]){return _0x3433cf['download'](_0x43dba8,_0x16265a[_0x748d('0x59')]+path[_0x748d('0x5a')](_0x43dba8),function(){if(_0x376fea){fs['unlink'](_0x43dba8);}});}else{return _0x3433cf[_0x748d('0x4e')](_0x43dba8,function(_0x3b432a){if(_0x376fea){fs[_0x748d('0x5b')](_0x43dba8);}});}}})[_0x748d('0x46')](function(_0x588a99){if(_0x588a99['message']==='VoiceRecording\x20not\x20found'){_0x3433cf[_0x748d('0x1c')](0x194)['send'](_0x748d('0x5c'));}else{return handleError(_0x3433cf,null);}});};exports[_0x748d('0x5d')]=function(_0x332411,_0x2c7f41,_0x1b4159){var _0x1848ad=require(_0x748d('0x4f'));var _0x5e8227=![];var _0x1f169={'$and':[db[_0x748d('0x5e')][_0x748d('0x3d')](db['sequelize']['fn'](_0x748d('0x5f'),db['sequelize']['col'](_0x748d('0x60'))),_0x332411['query'][_0x748d('0x61')])]};if(_0x332411[_0x748d('0x33')][_0x748d('0x2f')]&&_0x332411[_0x748d('0x33')]['type']===_0x748d('0x60')){_0x1f169['$and'][_0x748d('0x62')]({'uniqueid':_0x332411[_0x748d('0x48')]['id']});}else{_0x1f169[_0x748d('0x63')]['push']({'id':_0x332411[_0x748d('0x48')]['id']});}return db['VoiceRecording'][_0x748d('0x4a')]({'where':_0x1f169,'attributes':['id','value'],'raw':!![]})[_0x748d('0x25')](handleEntityNotFound(_0x2c7f41,null))['then'](function(_0x17b6ca){if(_0x17b6ca){var _0xa30d8d=util[_0x748d('0x51')](_0x748d('0x52'),_0x17b6ca[_0x748d('0x50')]);if(fs[_0x748d('0x53')](_0xa30d8d)){_0x5e8227=!![];return _0x1848ad[_0x748d('0x54')](_0xa30d8d,_0x17b6ca[_0x748d('0x50')],config[_0x748d('0x55')][_0x748d('0x64')])[_0x748d('0x25')](function(){return _0x17b6ca;});}return _0x17b6ca;}})['then'](function(_0x5b0c5d){if(_0x5b0c5d){if(!fs[_0x748d('0x53')](_0x5b0c5d[_0x748d('0x50')])){throw new db['Sequelize'][(_0x748d('0x57'))]('VoiceRecording\x20not\x20found');}if(_0x5b0c5d[_0x748d('0x59')]){return _0x2c7f41[_0x748d('0x4e')](_0x5b0c5d[_0x748d('0x50')],_0x5b0c5d[_0x748d('0x59')]+path['extname'](_0x5b0c5d[_0x748d('0x50')]),function(){if(_0x5e8227){fs[_0x748d('0x5b')](_0x5b0c5d[_0x748d('0x50')]);}});}else{return _0x2c7f41['download'](_0x5b0c5d[_0x748d('0x50')],function(_0x55a89a){if(_0x5e8227){fs[_0x748d('0x5b')](_0x5b0c5d[_0x748d('0x50')]);}});}}})[_0x748d('0x46')](handleError(_0x2c7f41,null));};exports[_0x748d('0x26')]=function(_0x428abe,_0x5b495c){return db[_0x748d('0x2c')]['find']({'where':{'id':_0x428abe[_0x748d('0x48')]['id']}})[_0x748d('0x25')](function(_0x8506d5){if(!_0x8506d5)throw new ReferenceError(_0x748d('0x65'));return _0x8506d5;})[_0x748d('0x25')](function(_0x22dd49){var _0x49e0ed=_0x22dd49[_0x748d('0x50')];logger[_0x748d('0x66')](_0x748d('0x67'),_0x49e0ed);if(!_['isNil'](_0x22dd49['value'])&&fs[_0x748d('0x53')](_0x49e0ed)){logger[_0x748d('0x66')](_0x748d('0x68')+_0x49e0ed+_0x748d('0x69'));fs[_0x748d('0x6a')](_0x49e0ed);}_0x49e0ed=_0x49e0ed+_0x748d('0x6b');if(!_[_0x748d('0x6c')](_0x22dd49['value'])&&fs[_0x748d('0x53')](_0x49e0ed)){logger[_0x748d('0x66')]('File:\x20\x22'+_0x49e0ed+_0x748d('0x69'));fs[_0x748d('0x6a')](_0x49e0ed);}return _0x22dd49;})[_0x748d('0x25')](function(_0x5be97d){if(!_0x5be97d)throw new InternalError();return _0x5be97d[_0x748d('0x26')]();})['then'](function(){_0x5b495c['status'](0xcc)[_0x748d('0x1b')]();})[_0x748d('0x46')](handleError(_0x5b495c,null));};function getBucketslist(_0x5228d8,_0x173703,_0x5ba64d){return new Promise(function(_0x45924a,_0x19782e){var _0x2b8219=new AWS['S3']({'accessKeyId':_0x173703,'secretAccessKey':_0x5228d8,'region':_0x5ba64d});_0x2b8219[_0x748d('0x6d')]({},function(_0x18c126,_0x5c1eb9){if(_0x18c126){return _0x19782e(_0x18c126);}else{return _0x45924a(_0x5c1eb9);}});});}function createBucket(_0x3852f8,_0x4b337f,_0x16745a,_0x1e22b9){return new Promise(function(_0x1e7a0d,_0x2e1df9){var _0x2ce7d9=new AWS['S3']({'accessKeyId':_0x4b337f,'secretAccessKey':_0x3852f8,'region':_0x16745a});_0x2ce7d9[_0x748d('0x6e')]({'Bucket':_0x1e22b9},function(_0x2a0fdb,_0x3c6165){if(_0x2a0fdb){return _0x2e1df9(_0x2a0fdb);}else{return _0x1e7a0d(_0x3c6165);}});});}function uploadFile(_0x23a8c1,_0x37d7b5,_0x1e3272,_0x312820,_0x26128c,_0x3bebb4){return new Promise(function(_0x5eecae,_0x188b24){var _0x28b7a3=new AWS['S3']({'accessKeyId':_0x37d7b5,'secretAccessKey':_0x23a8c1,'region':_0x1e3272});_0x28b7a3[_0x748d('0x6f')]({'Bucket':_0x312820,'Key':_0x26128c,'Body':_0x3bebb4},function(_0x1d0145,_0x2ba400){if(_0x1d0145){return _0x188b24(_0x1d0145);}else{return _0x5eecae(_0x2ba400);}});});}function startTranscribe(_0x208c75,_0x344672,_0x50b8d5,_0x3207dc,_0x3a50dc,_0x13849a){return new Promise(function(_0x42561e,_0x45e9b9){var _0x15b4ab=new AWS['TranscribeService']({'accessKeyId':_0x344672,'secretAccessKey':_0x208c75,'region':_0x50b8d5});_0x15b4ab[_0x748d('0x70')]({'TranscriptionJobName':_0x3207dc,'LanguageCode':_0x3a50dc,'Media':{'MediaFileUri':_0x13849a}},function(_0x568c79,_0x403c6e){if(_0x568c79){return _0x45e9b9(_0x568c79);}else{return _0x42561e(_0x403c6e);}});});}function transcribe(_0x302701,_0x541443,_0x295a76,_0x34b0c7,_0x454171,_0x1de6c1,_0x2c9055){return new Promise(function(_0xb1f522,_0x3f23f9){var _0x341a16={};logger[_0x748d('0x66')](util[_0x748d('0x51')](_0x748d('0x71'),_0x302701,_0x454171));return uploadFile(_0x541443,_0x295a76,_0x34b0c7,_0x454171,path['basename'](_0x1de6c1),fs['readFileSync'](_0x1de6c1))[_0x748d('0x25')](function(_0x393d21){logger[_0x748d('0x66')](util[_0x748d('0x51')](_0x748d('0x72'),_0x302701,_0x454171,_0x393d21[_0x748d('0x73')]));_0x341a16[_0x748d('0x74')]=_0x393d21[_0x748d('0x75')];_0x341a16[_0x748d('0x76')]=_0x393d21[_0x748d('0x73')];logger['info'](util[_0x748d('0x51')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x302701));return startTranscribe(_0x541443,_0x295a76,_0x34b0c7,uuidv4(),_0x2c9055,_0x393d21[_0x748d('0x73')]);})[_0x748d('0x25')](function(_0x559761){logger[_0x748d('0x66')](util[_0x748d('0x51')](_0x748d('0x77'),_0x302701,_0x559761[_0x748d('0x78')][_0x748d('0x79')]));_0x341a16[_0x748d('0x7a')]=_0x559761[_0x748d('0x78')][_0x748d('0x79')];_0x341a16[_0x748d('0x7b')]=_0x559761['TranscriptionJob'][_0x748d('0x7c')];return _0xb1f522(_0x341a16);})[_0x748d('0x46')](function(_0x4e37e5){return _0x3f23f9(_0x4e37e5);});});}exports[_0x748d('0x7d')]=function(_0x33f1c2,_0x122778,_0xc379e0){var _0x3c76e7;var _0x5af6be;var _0x31043e;var _0x4cecce=require('../../components/encryptor');return db[_0x748d('0x2c')][_0x748d('0x7e')]({'where':{'id':_0x33f1c2[_0x748d('0x48')]['id']}})[_0x748d('0x25')](function(_0x1f5285){if(_0x1f5285){var _0x15467c=util[_0x748d('0x51')](_0x748d('0x52'),_0x1f5285[_0x748d('0x50')]);if(fs[_0x748d('0x53')](_0x15467c)){cypher=!![];return _0x4cecce['decryptFile'](_0x15467c,_0x1f5285[_0x748d('0x50')],config[_0x748d('0x55')][_0x748d('0x64')])[_0x748d('0x25')](function(){return _0x1f5285;});}return _0x1f5285;}})[_0x748d('0x25')](function(_0xb528ff){if(!_0xb528ff){throw new db['Sequelize'][(_0x748d('0x57'))](_0x748d('0x7f'));}_0x5af6be=_0xb528ff;return db['Setting'][_0x748d('0x7e')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x122778,null))['then'](function(_0x2edd3b){if(_0x2edd3b){_0x3c76e7=_0x2edd3b;if(!_0x3c76e7[_0x748d('0x80')]||!_0x3c76e7[_0x748d('0x81')]||!_0x3c76e7[_0x748d('0x82')]||!_0x3c76e7[_0x748d('0x83')]||!_0x3c76e7[_0x748d('0x74')]){throw new db['Sequelize'][(_0x748d('0x57'))]('Transcribe\x20not\x20configured');}if(_0x33f1c2[_0x748d('0x4c')]['runSentiment']&&(!_0x3c76e7['sentiment']||!_0x3c76e7[_0x748d('0x84')]||!_0x3c76e7[_0x748d('0x85')]||!_0x3c76e7[_0x748d('0x83')]||!_0x3c76e7[_0x748d('0x74')])){throw new db['Sequelize'][(_0x748d('0x57'))](_0x748d('0x86'));}return db['CloudProvider'][_0x748d('0x7e')]({'where':{'id':_0x3c76e7['transcribeAccountId']}});}})['then'](function(_0x40ebea){if(!_0x40ebea){throw new db['Sequelize']['ValidationError'](_0x748d('0x87'));}if(!_0x40ebea[_0x748d('0x88')]||!_0x40ebea[_0x748d('0x89')]){throw new db[(_0x748d('0x56'))][(_0x748d('0x57'))](_0x748d('0x8a'));}_0x31043e=_0x40ebea;return getBucketslist(_0x31043e['data1'],_0x31043e[_0x748d('0x89')],_0x3c76e7[_0x748d('0x82')]);})[_0x748d('0x25')](function(_0x42153c){if(_0x42153c&&_0x42153c[_0x748d('0x8b')]){var _0x53501f=_['find'](_0x42153c[_0x748d('0x8b')],function(_0x45530c){return _0x45530c[_0x748d('0x8c')]===_0x3c76e7[_0x748d('0x74')];});if(!_0x53501f){logger[_0x748d('0x66')](util[_0x748d('0x51')](_0x748d('0x8d'),_0x33f1c2[_0x748d('0x48')]['id'],_0x3c76e7[_0x748d('0x74')]));return createBucket(_0x31043e[_0x748d('0x88')],_0x31043e[_0x748d('0x89')],_0x3c76e7[_0x748d('0x82')],_0x3c76e7[_0x748d('0x74')]);}logger[_0x748d('0x66')](util[_0x748d('0x51')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x33f1c2[_0x748d('0x48')]['id'],_0x3c76e7[_0x748d('0x74')]));return;}})[_0x748d('0x25')](function(_0x1f1857){if(_0x5af6be[_0x748d('0x7b')]==='NEW'){return transcribe(_0x33f1c2[_0x748d('0x48')]['id'],_0x31043e[_0x748d('0x88')],_0x31043e[_0x748d('0x89')],_0x3c76e7[_0x748d('0x82')],_0x3c76e7['bucket'],_0x5af6be[_0x748d('0x50')],_0x3c76e7[_0x748d('0x83')]);}else{logger[_0x748d('0x66')](util[_0x748d('0x51')](_0x748d('0x8e'),_0x33f1c2[_0x748d('0x48')]['id']));return{'transcribeStatus':_0x748d('0x8f')};}})['then'](function(_0x17152c){if(_0x17152c){_0x17152c['tempSentiment']=_0x33f1c2['body'][_0x748d('0x90')];return _0x5af6be[_0x748d('0x91')](_0x17152c);}})[_0x748d('0x25')](respondWithResult(_0x122778,null))[_0x748d('0x46')](handleError(_0x122778,null));};function writeFile(_0xec5b52,_0x343185){return new Promise(function(_0x2f1579,_0x431dea){fs[_0x748d('0x92')](_0x343185,_0xec5b52,function(_0x3281e4,_0xd3b981){if(_0x3281e4){return _0x431dea(_0x3281e4);}else{return _0x2f1579(_0xd3b981);}});});}exports[_0x748d('0x93')]=function(_0x15c066,_0xaad121,_0x404762){return db[_0x748d('0x2c')][_0x748d('0x7e')]({'where':{'id':_0x15c066[_0x748d('0x48')]['id']}})[_0x748d('0x25')](handleEntityNotFound(_0xaad121))[_0x748d('0x25')](function(_0x582327){if(_0x582327&&_0x582327[_0x748d('0x94')]){var _0x53f925=_0x582327[_0x748d('0x94')];var _0x161393=config[_0x748d('0x95')]+_0x748d('0x96')+_0x582327['id']+_0x748d('0x97');if(fs[_0x748d('0x53')](_0x161393)){return _0x161393;}return writeFile(_0x53f925,_0x161393)[_0x748d('0x25')](function(){return _0x161393;});}else{throw new db[(_0x748d('0x56'))][(_0x748d('0x57'))]('Transcript\x20not\x20available');}})[_0x748d('0x25')](function(_0x4e11cb){return _0xaad121['download'](_0x4e11cb);})[_0x748d('0x46')](handleError(_0xaad121));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 3e38f57..d0d359f 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 _0x275c=['uniqueid','util','../../config/logger','api','request-promise','rimraf','../../config/environment','exports','define','VoiceRecording'];(function(_0x26739f,_0x236082){var _0x1eae28=function(_0x4b9250){while(--_0x4b9250){_0x26739f['push'](_0x26739f['shift']());}};_0x1eae28(++_0x236082);}(_0x275c,0x8d));var _0xc275=function(_0x504bab,_0x3e2fcb){_0x504bab=_0x504bab-0x0;var _0x574fd2=_0x275c[_0x504bab];return _0x574fd2;};'use strict';var _=require('lodash');var util=require(_0xc275('0x0'));var logger=require(_0xc275('0x1'))(_0xc275('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc275('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc275('0x4'));var config=require(_0xc275('0x5'));var attributes=require('./voiceRecording.attributes');module[_0xc275('0x6')]=function(_0x51acc2,_0x37d2fe){return _0x51acc2[_0xc275('0x7')](_0xc275('0x8'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xc275('0x9'),'fields':[_0xc275('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4ff4=['define','VoiceRecording','uniqueid','lodash','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x3aa671,_0x392e38){var _0xb2faba=function(_0x16fd9d){while(--_0x16fd9d){_0x3aa671['push'](_0x3aa671['shift']());}};_0xb2faba(++_0x392e38);}(_0x4ff4,0x1c5));var _0x44ff=function(_0x5179a5,_0x419746){_0x5179a5=_0x5179a5-0x0;var _0x15c8ce=_0x4ff4[_0x5179a5];return _0x15c8ce;};'use strict';var _=require(_0x44ff('0x0'));var util=require(_0x44ff('0x1'));var logger=require(_0x44ff('0x2'))(_0x44ff('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x44ff('0x4'));var fs=require('fs');var path=require(_0x44ff('0x5'));var rimraf=require('rimraf');var config=require(_0x44ff('0x6'));var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x10f66e,_0xbe0c5f){return _0x10f66e[_0x44ff('0x7')](_0x44ff('0x8'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x44ff('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 030bd54..2adf20a 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 _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x573f20,_0x1c35d3){var _0x41868a=function(_0x40b92c){while(--_0x40b92c){_0x573f20['push'](_0x573f20['shift']());}};_0x41868a(++_0x1c35d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x306106,_0x7dc50d){var _0x4d6083=function(_0x2a5b5a){while(--_0x2a5b5a){_0x306106['push'](_0x306106['shift']());}};_0x4d6083(++_0x7dc50d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index f427ed1..e6f2a01 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 _0x2924=['describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0x2924,0xb1));var _0x4292=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x2924[_0x279d37];return _0x530173;};'use strict';var multer=require(_0x4292('0x0'));var util=require(_0x4292('0x1'));var path=require(_0x4292('0x2'));var timeout=require(_0x4292('0x3'));var express=require('express');var router=express[_0x4292('0x4')]();var auth=require(_0x4292('0x5'));var interaction=require(_0x4292('0x6'));var config=require(_0x4292('0x7'));var controller=require(_0x4292('0x8'));router[_0x4292('0x9')]('/',auth[_0x4292('0xa')](),controller['index']);router[_0x4292('0x9')](_0x4292('0xb'),auth['isAuthenticated'](),controller[_0x4292('0xc')]);router['get'](_0x4292('0xd'),auth[_0x4292('0xa')](),controller[_0x4292('0xe')]);router[_0x4292('0xf')]('/',auth['isAuthenticated'](),controller[_0x4292('0x10')]);router[_0x4292('0x11')]('/:id',auth[_0x4292('0xa')](),controller[_0x4292('0x12')]);router['delete'](_0x4292('0xd'),auth['isAuthenticated'](),controller[_0x4292('0x13')]);module[_0x4292('0x14')]=router; \ No newline at end of file +var _0xaf71=['put','update','delete','destroy','multer','util','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','post','create'];(function(_0x5a90f0,_0x1a6754){var _0x592c57=function(_0xc34577){while(--_0xc34577){_0x5a90f0['push'](_0x5a90f0['shift']());}};_0x592c57(++_0x1a6754);}(_0xaf71,0x19c));var _0x1af7=function(_0x58978d,_0x1d93a6){_0x58978d=_0x58978d-0x0;var _0x36460b=_0xaf71[_0x58978d];return _0x36460b;};'use strict';var multer=require(_0x1af7('0x0'));var util=require(_0x1af7('0x1'));var path=require('path');var timeout=require(_0x1af7('0x2'));var express=require('express');var router=express[_0x1af7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1af7('0x4'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0x1af7('0x5')]('/',auth[_0x1af7('0x6')](),controller[_0x1af7('0x7')]);router[_0x1af7('0x5')](_0x1af7('0x8'),auth['isAuthenticated'](),controller[_0x1af7('0x9')]);router[_0x1af7('0x5')](_0x1af7('0xa'),auth[_0x1af7('0x6')](),controller['show']);router[_0x1af7('0xb')]('/',auth[_0x1af7('0x6')](),controller[_0x1af7('0xc')]);router[_0x1af7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x1af7('0xe')]);router[_0x1af7('0xf')](_0x1af7('0xa'),auth[_0x1af7('0x6')](),controller[_0x1af7('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index cdaa0dd..970563c 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 _0x9b84=['moment','exports','blind','attended','STRING','ENUM'];(function(_0x1e5598,_0x218ad7){var _0x539878=function(_0x4bb993){while(--_0x4bb993){_0x1e5598['push'](_0x1e5598['shift']());}};_0x539878(++_0x218ad7);}(_0x9b84,0x17a));var _0x49b8=function(_0x146484,_0x27a7f0){_0x146484=_0x146484-0x0;var _0x4c7aa3=_0x9b84[_0x146484];return _0x4c7aa3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x49b8('0x0'));module[_0x49b8('0x1')]={'type':{'type':Sequelize['ENUM'](_0x49b8('0x2'),_0x49b8('0x3'))},'result':{'type':Sequelize[_0x49b8('0x4')]},'transfererchannel':{'type':Sequelize[_0x49b8('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x49b8('0x4')]},'transferercalleridname':{'type':Sequelize[_0x49b8('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x49b8('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x49b8('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x49b8('0x4')]},'transferercontext':{'type':Sequelize[_0x49b8('0x4')]},'transfererexten':{'type':Sequelize[_0x49b8('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x49b8('0x4')]},'transfereechannel':{'type':Sequelize[_0x49b8('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x49b8('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x49b8('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x49b8('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x49b8('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x49b8('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x49b8('0x4')]},'isexternal':{'type':Sequelize[_0x49b8('0x5')]('Yes','No')},'context':{'type':Sequelize[_0x49b8('0x4')]},'extension':{'type':Sequelize[_0x49b8('0x4')]}}; \ No newline at end of file +var _0xf126=['moment','exports','ENUM','attended','STRING','sequelize'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xf126,0x6b));var _0x6f12=function(_0xf915a7,_0x3c5104){_0xf915a7=_0xf915a7-0x0;var _0x714195=_0xf126[_0xf915a7];return _0x714195;};'use strict';var Sequelize=require(_0x6f12('0x0'));var moment=require(_0x6f12('0x1'));module[_0x6f12('0x2')]={'type':{'type':Sequelize[_0x6f12('0x3')]('blind',_0x6f12('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x6f12('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x6f12('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x6f12('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x6f12('0x5')]},'transferercontext':{'type':Sequelize[_0x6f12('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x6f12('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x6f12('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x6f12('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x6f12('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x6f12('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x6f12('0x5')]},'transfereecontext':{'type':Sequelize[_0x6f12('0x5')]},'transfereeexten':{'type':Sequelize[_0x6f12('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x6f12('0x5')]},'isexternal':{'type':Sequelize[_0x6f12('0x3')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x6f12('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 8b6f93c..3e5e6ce 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 _0xe700=['offset','limit','status','Content-Range','apply','reject','then','destroy','error','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','includeAll','find','catch','create','body','update','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','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','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','count'];(function(_0x3bd87c,_0x5af492){var _0x3466e8=function(_0x455666){while(--_0x455666){_0x3bd87c['push'](_0x3bd87c['shift']());}};_0x3466e8(++_0x5af492);}(_0xe700,0x75));var _0x0e70=function(_0x21833c,_0x5d199a){_0x21833c=_0x21833c-0x0;var _0x4c7afc=_0xe700[_0x21833c];return _0x4c7afc;};'use strict';var pdf=require(_0x0e70('0x0'));var emlformat=require(_0x0e70('0x1'));var rimraf=require(_0x0e70('0x2'));var zipdir=require(_0x0e70('0x3'));var jsonpatch=require(_0x0e70('0x4'));var rp=require(_0x0e70('0x5'));var moment=require(_0x0e70('0x6'));var BPromise=require(_0x0e70('0x7'));var Mustache=require(_0x0e70('0x8'));var util=require(_0x0e70('0x9'));var path=require('path');var sox=require(_0x0e70('0xa'));var csv=require('to-csv');var ejs=require(_0x0e70('0xb'));var fs=require('fs');var _=require(_0x0e70('0xc'));var squel=require(_0x0e70('0xd'));var crypto=require(_0x0e70('0xe'));var jsforce=require(_0x0e70('0xf'));var deskjs=require(_0x0e70('0x10'));var toCsv=require(_0x0e70('0x11'));var querystring=require(_0x0e70('0x12'));var Papa=require(_0x0e70('0x13'));var Redis=require(_0x0e70('0x14'));var authService=require(_0x0e70('0x15'));var qs=require(_0x0e70('0x16'));var as=require(_0x0e70('0x17'));var hardwareService=require(_0x0e70('0x18'));var logger=require(_0x0e70('0x19'))('api');var utils=require(_0x0e70('0x1a'));var config=require(_0x0e70('0x1b'));var licenseUtil=require(_0x0e70('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x154a94,_0x23191d){_0x23191d=_0x23191d||0xcc;return function(_0x36a5d3){if(_0x36a5d3){return _0x154a94[_0x0e70('0x1d')](_0x23191d);}return _0x154a94['status'](_0x23191d)[_0x0e70('0x1e')]();};}function respondWithResult(_0x175bca,_0x30660e){_0x30660e=_0x30660e||0xc8;return function(_0x58a533){if(_0x58a533){return _0x175bca['status'](_0x30660e)[_0x0e70('0x1f')](_0x58a533);}};}function respondWithFilteredResult(_0x4b3e5f,_0x47446b){return function(_0x11af6e){if(_0x11af6e){var _0x41cb06=_0x11af6e[_0x0e70('0x20')],_0xbf1ff9=_0x47446b[_0x0e70('0x21')],_0x4bc3a4=_0x47446b[_0x0e70('0x21')]+_0x47446b[_0x0e70('0x22')],_0x2993f2;if(_0x4bc3a4>=_0x41cb06){_0x4bc3a4=_0x41cb06;_0x2993f2=0xc8;}else{_0x2993f2=0xce;}_0x4b3e5f[_0x0e70('0x23')](_0x2993f2);return _0x4b3e5f['set'](_0x0e70('0x24'),_0xbf1ff9+'-'+_0x4bc3a4+'/'+_0x41cb06)[_0x0e70('0x1f')](_0x11af6e);}return null;};}function patchUpdates(_0x4ce43f){return function(_0x11d879){try{jsonpatch[_0x0e70('0x25')](_0x11d879,_0x4ce43f,!![]);}catch(_0x17e18c){return BPromise[_0x0e70('0x26')](_0x17e18c);}return _0x11d879['save']();};}function saveUpdates(_0x43062e,_0x368216){return function(_0x288c4c){if(_0x288c4c){return _0x288c4c['update'](_0x43062e)[_0x0e70('0x27')](function(_0x24fda5){return _0x24fda5;});}return null;};}function removeEntity(_0x4c9c9b,_0x3b2d2a){return function(_0x22ee57){if(_0x22ee57){return _0x22ee57[_0x0e70('0x28')]()[_0x0e70('0x27')](function(){_0x4c9c9b[_0x0e70('0x23')](0xcc)[_0x0e70('0x1e')]();});}};}function handleEntityNotFound(_0x102289,_0x350afc){return function(_0x806e3f){if(!_0x806e3f){_0x102289[_0x0e70('0x1d')](0x194);}return _0x806e3f;};}function handleError(_0x400179,_0x51d4e1){_0x51d4e1=_0x51d4e1||0x1f4;return function(_0x4c15fe){logger[_0x0e70('0x29')](_0x4c15fe['stack']);if(_0x4c15fe[_0x0e70('0x2a')]){delete _0x4c15fe['name'];}_0x400179[_0x0e70('0x23')](_0x51d4e1)[_0x0e70('0x2b')](_0x4c15fe);};}exports[_0x0e70('0x2c')]=function(_0x2b6bdf,_0x3efbb5){var _0xe9f3d0={},_0xe3418f={},_0x2cac5c={'count':0x0,'rows':[]};var _0x3aac80=_[_0x0e70('0x2d')](db[_0x0e70('0x2e')][_0x0e70('0x2f')],function(_0xa59504){return{'name':_0xa59504[_0x0e70('0x30')],'type':_0xa59504['type']['key']};});_0xe3418f[_0x0e70('0x31')]=_[_0x0e70('0x2d')](_0x3aac80,'name');_0xe3418f['query']=_[_0x0e70('0x32')](_0x2b6bdf[_0x0e70('0x33')]);_0xe3418f[_0x0e70('0x34')]=_[_0x0e70('0x35')](_0xe3418f[_0x0e70('0x31')],_0xe3418f[_0x0e70('0x33')]);_0xe9f3d0[_0x0e70('0x36')]=_[_0x0e70('0x35')](_0xe3418f[_0x0e70('0x31')],qs[_0x0e70('0x37')](_0x2b6bdf[_0x0e70('0x33')][_0x0e70('0x37')]));_0xe9f3d0['attributes']=_0xe9f3d0['attributes'][_0x0e70('0x38')]?_0xe9f3d0[_0x0e70('0x36')]:_0xe3418f[_0x0e70('0x31')];if(!_0x2b6bdf[_0x0e70('0x33')]['hasOwnProperty'](_0x0e70('0x39'))){_0xe9f3d0['limit']=qs[_0x0e70('0x22')](_0x2b6bdf[_0x0e70('0x33')]['limit']);_0xe9f3d0[_0x0e70('0x21')]=qs[_0x0e70('0x21')](_0x2b6bdf['query'][_0x0e70('0x21')]);}_0xe9f3d0[_0x0e70('0x3a')]=qs[_0x0e70('0x3b')](_0x2b6bdf[_0x0e70('0x33')][_0x0e70('0x3b')]);_0xe9f3d0[_0x0e70('0x3c')]=qs[_0x0e70('0x34')](_['pick'](_0x2b6bdf[_0x0e70('0x33')],_0xe3418f[_0x0e70('0x34')]),_0x3aac80);if(_0x2b6bdf[_0x0e70('0x33')]['filter']){_0xe9f3d0[_0x0e70('0x3c')]=_[_0x0e70('0x3d')](_0xe9f3d0['where'],{'$or':_[_0x0e70('0x2d')](_0x3aac80,function(_0x5a45b8){if(_0x5a45b8['type']!==_0x0e70('0x3e')){var _0x528fa6={};_0x528fa6[_0x5a45b8[_0x0e70('0x2a')]]={'$like':'%'+_0x2b6bdf['query'][_0x0e70('0x3f')]+'%'};return _0x528fa6;}})});}_0xe9f3d0=_[_0x0e70('0x3d')]({},_0xe9f3d0,_0x2b6bdf[_0x0e70('0x40')]);var _0x2a6ec6={'where':_0xe9f3d0[_0x0e70('0x3c')]};return db['VoiceTransferReport'][_0x0e70('0x20')](_0x2a6ec6)[_0x0e70('0x27')](function(_0x35a329){_0x2cac5c['count']=_0x35a329;if(_0x2b6bdf['query']['includeAll']){_0xe9f3d0['include']=[{'all':!![]}];}return db[_0x0e70('0x2e')][_0x0e70('0x41')](_0xe9f3d0);})[_0x0e70('0x27')](function(_0x3f477c){_0x2cac5c[_0x0e70('0x42')]=_0x3f477c;return _0x2cac5c;})[_0x0e70('0x27')](respondWithFilteredResult(_0x3efbb5,_0xe9f3d0))['catch'](handleError(_0x3efbb5,null));};exports['show']=function(_0x4e6993,_0x4041b0){var _0x13f774={'raw':!![],'where':{'id':_0x4e6993['params']['id']}},_0x11897f={};_0x11897f[_0x0e70('0x31')]=_[_0x0e70('0x32')](db[_0x0e70('0x2e')][_0x0e70('0x2f')]);_0x11897f[_0x0e70('0x33')]=_[_0x0e70('0x32')](_0x4e6993[_0x0e70('0x33')]);_0x11897f['filters']=_[_0x0e70('0x35')](_0x11897f[_0x0e70('0x31')],_0x11897f['query']);_0x13f774[_0x0e70('0x36')]=_[_0x0e70('0x35')](_0x11897f[_0x0e70('0x31')],qs[_0x0e70('0x37')](_0x4e6993[_0x0e70('0x33')][_0x0e70('0x37')]));_0x13f774['attributes']=_0x13f774[_0x0e70('0x36')][_0x0e70('0x38')]?_0x13f774[_0x0e70('0x36')]:_0x11897f['model'];if(_0x4e6993[_0x0e70('0x33')][_0x0e70('0x43')]){_0x13f774['include']=[{'all':!![]}];}_0x13f774=_[_0x0e70('0x3d')]({},_0x13f774,_0x4e6993[_0x0e70('0x40')]);return db[_0x0e70('0x2e')][_0x0e70('0x44')](_0x13f774)[_0x0e70('0x27')](handleEntityNotFound(_0x4041b0,null))[_0x0e70('0x27')](respondWithResult(_0x4041b0,null))[_0x0e70('0x45')](handleError(_0x4041b0,null));};exports[_0x0e70('0x46')]=function(_0x3475b6,_0x3761de){return db['VoiceTransferReport']['create'](_0x3475b6[_0x0e70('0x47')],{})[_0x0e70('0x27')](respondWithResult(_0x3761de,0xc9))[_0x0e70('0x45')](handleError(_0x3761de,null));};exports[_0x0e70('0x48')]=function(_0x116b80,_0x174650){if(_0x116b80['body']['id']){delete _0x116b80[_0x0e70('0x47')]['id'];}return db[_0x0e70('0x2e')]['find']({'where':{'id':_0x116b80[_0x0e70('0x49')]['id']}})[_0x0e70('0x27')](handleEntityNotFound(_0x174650,null))[_0x0e70('0x27')](saveUpdates(_0x116b80[_0x0e70('0x47')],null))[_0x0e70('0x27')](respondWithResult(_0x174650,null))[_0x0e70('0x45')](handleError(_0x174650,null));};exports['destroy']=function(_0x4c4405,_0x14beef){return db[_0x0e70('0x2e')]['find']({'where':{'id':_0x4c4405[_0x0e70('0x49')]['id']}})[_0x0e70('0x27')](handleEntityNotFound(_0x14beef,null))['then'](removeEntity(_0x14beef,null))[_0x0e70('0x45')](handleError(_0x14beef,null));};exports[_0x0e70('0x4a')]=function(_0x3b6fbe,_0x193eea){return db[_0x0e70('0x2e')][_0x0e70('0x4a')]()['then'](respondWithResult(_0x193eea,null))[_0x0e70('0x45')](handleError(_0x193eea,null));}; \ No newline at end of file +var _0x4ec4=['fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','update','then','destroy','error','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','catch','params','keys','include','find','create','body','describe','html-pdf','eml-format','rimraf'];(function(_0xcaa1bc,_0x4a8314){var _0x11a3b1=function(_0x2fdb50){while(--_0x2fdb50){_0xcaa1bc['push'](_0xcaa1bc['shift']());}};_0x11a3b1(++_0x4a8314);}(_0x4ec4,0x125));var _0x44ec=function(_0x2616cd,_0x6b2d90){_0x2616cd=_0x2616cd-0x0;var _0x4e1fcb=_0x4ec4[_0x2616cd];return _0x4e1fcb;};'use strict';var pdf=require(_0x44ec('0x0'));var emlformat=require(_0x44ec('0x1'));var rimraf=require(_0x44ec('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x44ec('0x3'));var rp=require(_0x44ec('0x4'));var moment=require(_0x44ec('0x5'));var BPromise=require(_0x44ec('0x6'));var Mustache=require(_0x44ec('0x7'));var util=require(_0x44ec('0x8'));var path=require('path');var sox=require(_0x44ec('0x9'));var csv=require(_0x44ec('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x44ec('0xb'));var squel=require(_0x44ec('0xc'));var crypto=require(_0x44ec('0xd'));var jsforce=require(_0x44ec('0xe'));var deskjs=require(_0x44ec('0xf'));var toCsv=require(_0x44ec('0xa'));var querystring=require(_0x44ec('0x10'));var Papa=require('papaparse');var Redis=require(_0x44ec('0x11'));var authService=require(_0x44ec('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x44ec('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x44ec('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x44ec('0x15'));var licenseUtil=require(_0x44ec('0x16'));var db=require(_0x44ec('0x17'))['db'];function respondWithStatusCode(_0x37ef19,_0x4cdf0c){_0x4cdf0c=_0x4cdf0c||0xcc;return function(_0x26a6eb){if(_0x26a6eb){return _0x37ef19[_0x44ec('0x18')](_0x4cdf0c);}return _0x37ef19[_0x44ec('0x19')](_0x4cdf0c)[_0x44ec('0x1a')]();};}function respondWithResult(_0x2dbd5e,_0x3bbf64){_0x3bbf64=_0x3bbf64||0xc8;return function(_0x3ee949){if(_0x3ee949){return _0x2dbd5e[_0x44ec('0x19')](_0x3bbf64)[_0x44ec('0x1b')](_0x3ee949);}};}function respondWithFilteredResult(_0x57fb32,_0x4beca6){return function(_0x348c9d){if(_0x348c9d){var _0x22fa25=_0x348c9d['count'],_0xca7f51=_0x4beca6[_0x44ec('0x1c')],_0x5a45f4=_0x4beca6[_0x44ec('0x1c')]+_0x4beca6[_0x44ec('0x1d')],_0x468921;if(_0x5a45f4>=_0x22fa25){_0x5a45f4=_0x22fa25;_0x468921=0xc8;}else{_0x468921=0xce;}_0x57fb32[_0x44ec('0x19')](_0x468921);return _0x57fb32[_0x44ec('0x1e')]('Content-Range',_0xca7f51+'-'+_0x5a45f4+'/'+_0x22fa25)[_0x44ec('0x1b')](_0x348c9d);}return null;};}function patchUpdates(_0x5cf050){return function(_0x3f2565){try{jsonpatch[_0x44ec('0x1f')](_0x3f2565,_0x5cf050,!![]);}catch(_0x51877b){return BPromise[_0x44ec('0x20')](_0x51877b);}return _0x3f2565['save']();};}function saveUpdates(_0x20cb5e,_0x52aa71){return function(_0x36d2bc){if(_0x36d2bc){return _0x36d2bc[_0x44ec('0x21')](_0x20cb5e)[_0x44ec('0x22')](function(_0x4e160d){return _0x4e160d;});}return null;};}function removeEntity(_0x48fede,_0x1968ba){return function(_0x142f73){if(_0x142f73){return _0x142f73[_0x44ec('0x23')]()['then'](function(){_0x48fede[_0x44ec('0x19')](0xcc)[_0x44ec('0x1a')]();});}};}function handleEntityNotFound(_0x48be86,_0x2e8a28){return function(_0xd1055c){if(!_0xd1055c){_0x48be86[_0x44ec('0x18')](0x194);}return _0xd1055c;};}function handleError(_0x3acc81,_0x5898b7){_0x5898b7=_0x5898b7||0x1f4;return function(_0x30a812){logger[_0x44ec('0x24')](_0x30a812['stack']);if(_0x30a812[_0x44ec('0x25')]){delete _0x30a812[_0x44ec('0x25')];}_0x3acc81[_0x44ec('0x19')](_0x5898b7)[_0x44ec('0x26')](_0x30a812);};}exports['index']=function(_0x384d50,_0x3fa437){var _0x1beb81={},_0xcb9a42={},_0x5f5805={'count':0x0,'rows':[]};var _0x22f2c9=_[_0x44ec('0x27')](db[_0x44ec('0x28')][_0x44ec('0x29')],function(_0x291805){return{'name':_0x291805[_0x44ec('0x2a')],'type':_0x291805[_0x44ec('0x2b')][_0x44ec('0x2c')]};});_0xcb9a42[_0x44ec('0x2d')]=_[_0x44ec('0x27')](_0x22f2c9,_0x44ec('0x25'));_0xcb9a42['query']=_['keys'](_0x384d50['query']);_0xcb9a42[_0x44ec('0x2e')]=_[_0x44ec('0x2f')](_0xcb9a42['model'],_0xcb9a42[_0x44ec('0x30')]);_0x1beb81[_0x44ec('0x31')]=_[_0x44ec('0x2f')](_0xcb9a42[_0x44ec('0x2d')],qs[_0x44ec('0x32')](_0x384d50[_0x44ec('0x30')][_0x44ec('0x32')]));_0x1beb81['attributes']=_0x1beb81[_0x44ec('0x31')][_0x44ec('0x33')]?_0x1beb81[_0x44ec('0x31')]:_0xcb9a42['model'];if(!_0x384d50[_0x44ec('0x30')][_0x44ec('0x34')](_0x44ec('0x35'))){_0x1beb81[_0x44ec('0x1d')]=qs[_0x44ec('0x1d')](_0x384d50[_0x44ec('0x30')][_0x44ec('0x1d')]);_0x1beb81[_0x44ec('0x1c')]=qs[_0x44ec('0x1c')](_0x384d50['query']['offset']);}_0x1beb81[_0x44ec('0x36')]=qs[_0x44ec('0x37')](_0x384d50[_0x44ec('0x30')][_0x44ec('0x37')]);_0x1beb81[_0x44ec('0x38')]=qs[_0x44ec('0x2e')](_[_0x44ec('0x39')](_0x384d50['query'],_0xcb9a42['filters']),_0x22f2c9);if(_0x384d50[_0x44ec('0x30')]['filter']){_0x1beb81[_0x44ec('0x38')]=_[_0x44ec('0x3a')](_0x1beb81['where'],{'$or':_['map'](_0x22f2c9,function(_0x5e8a68){if(_0x5e8a68[_0x44ec('0x2b')]!==_0x44ec('0x3b')){var _0x22e4de={};_0x22e4de[_0x5e8a68[_0x44ec('0x25')]]={'$like':'%'+_0x384d50[_0x44ec('0x30')][_0x44ec('0x3c')]+'%'};return _0x22e4de;}})});}_0x1beb81=_['merge']({},_0x1beb81,_0x384d50[_0x44ec('0x3d')]);var _0x3445ca={'where':_0x1beb81['where']};return db[_0x44ec('0x28')][_0x44ec('0x3e')](_0x3445ca)['then'](function(_0x4e6595){_0x5f5805[_0x44ec('0x3e')]=_0x4e6595;if(_0x384d50['query'][_0x44ec('0x3f')]){_0x1beb81['include']=[{'all':!![]}];}return db[_0x44ec('0x28')][_0x44ec('0x40')](_0x1beb81);})[_0x44ec('0x22')](function(_0x37e316){_0x5f5805[_0x44ec('0x41')]=_0x37e316;return _0x5f5805;})[_0x44ec('0x22')](respondWithFilteredResult(_0x3fa437,_0x1beb81))[_0x44ec('0x42')](handleError(_0x3fa437,null));};exports['show']=function(_0x4a6abe,_0x46e845){var _0x8184c5={'raw':!![],'where':{'id':_0x4a6abe[_0x44ec('0x43')]['id']}},_0x1e3c02={};_0x1e3c02[_0x44ec('0x2d')]=_[_0x44ec('0x44')](db[_0x44ec('0x28')][_0x44ec('0x29')]);_0x1e3c02['query']=_[_0x44ec('0x44')](_0x4a6abe['query']);_0x1e3c02[_0x44ec('0x2e')]=_[_0x44ec('0x2f')](_0x1e3c02[_0x44ec('0x2d')],_0x1e3c02[_0x44ec('0x30')]);_0x8184c5[_0x44ec('0x31')]=_[_0x44ec('0x2f')](_0x1e3c02['model'],qs[_0x44ec('0x32')](_0x4a6abe[_0x44ec('0x30')][_0x44ec('0x32')]));_0x8184c5[_0x44ec('0x31')]=_0x8184c5[_0x44ec('0x31')][_0x44ec('0x33')]?_0x8184c5[_0x44ec('0x31')]:_0x1e3c02['model'];if(_0x4a6abe[_0x44ec('0x30')][_0x44ec('0x3f')]){_0x8184c5[_0x44ec('0x45')]=[{'all':!![]}];}_0x8184c5=_[_0x44ec('0x3a')]({},_0x8184c5,_0x4a6abe[_0x44ec('0x3d')]);return db[_0x44ec('0x28')][_0x44ec('0x46')](_0x8184c5)[_0x44ec('0x22')](handleEntityNotFound(_0x46e845,null))[_0x44ec('0x22')](respondWithResult(_0x46e845,null))[_0x44ec('0x42')](handleError(_0x46e845,null));};exports[_0x44ec('0x47')]=function(_0x33eafb,_0x3e5e61){return db['VoiceTransferReport'][_0x44ec('0x47')](_0x33eafb[_0x44ec('0x48')],{})['then'](respondWithResult(_0x3e5e61,0xc9))[_0x44ec('0x42')](handleError(_0x3e5e61,null));};exports['update']=function(_0x565c43,_0x376762){if(_0x565c43['body']['id']){delete _0x565c43[_0x44ec('0x48')]['id'];}return db['VoiceTransferReport'][_0x44ec('0x46')]({'where':{'id':_0x565c43[_0x44ec('0x43')]['id']}})[_0x44ec('0x22')](handleEntityNotFound(_0x376762,null))[_0x44ec('0x22')](saveUpdates(_0x565c43[_0x44ec('0x48')],null))[_0x44ec('0x22')](respondWithResult(_0x376762,null))[_0x44ec('0x42')](handleError(_0x376762,null));};exports[_0x44ec('0x23')]=function(_0x450606,_0x3b7450){return db[_0x44ec('0x28')][_0x44ec('0x46')]({'where':{'id':_0x450606[_0x44ec('0x43')]['id']}})[_0x44ec('0x22')](handleEntityNotFound(_0x3b7450,null))[_0x44ec('0x22')](removeEntity(_0x3b7450,null))['catch'](handleError(_0x3b7450,null));};exports[_0x44ec('0x49')]=function(_0x3a976f,_0x58330c){return db[_0x44ec('0x28')][_0x44ec('0x49')]()[_0x44ec('0x22')](respondWithResult(_0x58330c,null))[_0x44ec('0x42')](handleError(_0x58330c,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index e6bd693..1ee9c44 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 _0x73f5=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','VoiceTransferReport','report_call_transfer'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x73f5,0x181));var _0x573f=function(_0x26dd05,_0x135f80){_0x26dd05=_0x26dd05-0x0;var _0x5da547=_0x73f5[_0x26dd05];return _0x5da547;};'use strict';var _=require(_0x573f('0x0'));var util=require('util');var logger=require(_0x573f('0x1'))(_0x573f('0x2'));var moment=require(_0x573f('0x3'));var BPromise=require('bluebird');var rp=require(_0x573f('0x4'));var fs=require('fs');var path=require(_0x573f('0x5'));var rimraf=require(_0x573f('0x6'));var config=require(_0x573f('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0x573f('0x8')]=function(_0x5b85ac,_0x4d7c1b){return _0x5b85ac['define'](_0x573f('0x9'),attributes,{'tableName':_0x573f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2a9=['VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x291d57,_0x30557b){var _0x4eb3a7=function(_0x51d697){while(--_0x51d697){_0x291d57['push'](_0x291d57['shift']());}};_0x4eb3a7(++_0x30557b);}(_0xb2a9,0x84));var _0x9b2a=function(_0x4ac8f3,_0x450bef){_0x4ac8f3=_0x4ac8f3-0x0;var _0x3c64a3=_0xb2a9[_0x4ac8f3];return _0x3c64a3;};'use strict';var _=require(_0x9b2a('0x0'));var util=require(_0x9b2a('0x1'));var logger=require(_0x9b2a('0x2'))(_0x9b2a('0x3'));var moment=require(_0x9b2a('0x4'));var BPromise=require(_0x9b2a('0x5'));var rp=require(_0x9b2a('0x6'));var fs=require('fs');var path=require(_0x9b2a('0x7'));var rimraf=require('rimraf');var config=require(_0x9b2a('0x8'));var attributes=require('./voiceTransferReport.attributes');module[_0x9b2a('0x9')]=function(_0x2eafb0,_0x31a9a3){return _0x2eafb0[_0x9b2a('0xa')](_0x9b2a('0xb'),attributes,{'tableName':_0x9b2a('0xc'),'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 1c21c0f..ed95eef 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 _0x324f=['VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x324f,0x94));var _0xf324=function(_0x23340b,_0x54ce94){_0x23340b=_0x23340b-0x0;var _0x10237a=_0x324f[_0x23340b];return _0x10237a;};'use strict';var _=require(_0xf324('0x0'));var util=require(_0xf324('0x1'));var moment=require(_0xf324('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf324('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf324('0x4'));var logger=require(_0xf324('0x5'))('rpc');var config=require(_0xf324('0x6'));var jayson=require(_0xf324('0x7'));var client=jayson['client'][_0xf324('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x390f7d,_0x1e3722,_0x2290b7){return new BPromise(function(_0x408b34,_0x3906da){return client[_0xf324('0x9')](_0x390f7d,_0x2290b7)[_0xf324('0xa')](function(_0x42fe29){logger['info'](_0xf324('0xb'),_0x1e3722,_0xf324('0xc'));logger[_0xf324('0xd')](_0xf324('0xe'),_0x1e3722,'request\x20sent',JSON[_0xf324('0xf')](_0x42fe29));if(_0x42fe29[_0xf324('0x10')]){if(_0x42fe29[_0xf324('0x10')][_0xf324('0x11')]===0x1f4){logger[_0xf324('0x10')](_0xf324('0xb'),_0x1e3722,_0x42fe29[_0xf324('0x10')][_0xf324('0x12')]);return _0x3906da(_0x42fe29[_0xf324('0x10')][_0xf324('0x12')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x1e3722,_0x42fe29['error']['message']);return _0x408b34(_0x42fe29[_0xf324('0x10')]['message']);}else{logger[_0xf324('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x1e3722,_0xf324('0xc'));_0x408b34(_0x42fe29['result'][_0xf324('0x12')]);}})[_0xf324('0x14')](function(_0x1121bc){logger['error'](_0xf324('0xb'),_0x1e3722,_0x1121bc);_0x3906da(_0x1121bc);});});}exports[_0xf324('0x15')]=function(_0x39ca8e){var _0x347cba=this;return new Promise(function(_0x28d986,_0x89bcbd){return db[_0xf324('0x16')][_0xf324('0x17')](_0x39ca8e[_0xf324('0x18')],{'raw':_0x39ca8e[_0xf324('0x19')]?_0x39ca8e[_0xf324('0x19')][_0xf324('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x10e157){logger[_0xf324('0x13')]('CreateVoiceTransferReport',_0x39ca8e);logger['debug'](_0xf324('0x15'),_0x39ca8e,JSON[_0xf324('0xf')](_0x10e157));_0x28d986(_0x10e157);})[_0xf324('0x14')](function(_0x407cb7){logger[_0xf324('0x10')](_0xf324('0x15'),_0x407cb7[_0xf324('0x12')],_0x39ca8e);_0x89bcbd(_0x347cba[_0xf324('0x10')](0x1f4,_0x407cb7['message']));});});}; \ No newline at end of file +var _0x40b5=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','VoiceTransferReport,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x40b5,0x1d7));var _0x540b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x40b5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x540b('0x0'));var util=require(_0x540b('0x1'));var moment=require(_0x540b('0x2'));var BPromise=require(_0x540b('0x3'));var rs=require(_0x540b('0x4'));var fs=require('fs');var Redis=require(_0x540b('0x5'));var db=require(_0x540b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x540b('0x7'))(_0x540b('0x8'));var config=require(_0x540b('0x9'));var jayson=require(_0x540b('0xa'));var client=jayson[_0x540b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22e1da,_0x448b68,_0x316ab7){return new BPromise(function(_0x5aeb5f,_0x5a9a78){return client[_0x540b('0xc')](_0x22e1da,_0x316ab7)['then'](function(_0x5c4ca0){logger['info'](_0x540b('0xd'),_0x448b68,'request\x20sent');logger[_0x540b('0xe')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x448b68,'request\x20sent',JSON[_0x540b('0xf')](_0x5c4ca0));if(_0x5c4ca0[_0x540b('0x10')]){if(_0x5c4ca0['error'][_0x540b('0x11')]===0x1f4){logger[_0x540b('0x10')](_0x540b('0xd'),_0x448b68,_0x5c4ca0[_0x540b('0x10')]['message']);return _0x5a9a78(_0x5c4ca0[_0x540b('0x10')][_0x540b('0x12')]);}logger[_0x540b('0x10')](_0x540b('0xd'),_0x448b68,_0x5c4ca0['error'][_0x540b('0x12')]);return _0x5aeb5f(_0x5c4ca0['error']['message']);}else{logger[_0x540b('0x13')](_0x540b('0xd'),_0x448b68,_0x540b('0x14'));_0x5aeb5f(_0x5c4ca0[_0x540b('0x15')][_0x540b('0x12')]);}})['catch'](function(_0x26bbf6){logger[_0x540b('0x10')](_0x540b('0xd'),_0x448b68,_0x26bbf6);_0x5a9a78(_0x26bbf6);});});}exports[_0x540b('0x16')]=function(_0x44dff4){var _0xd61e60=this;return new Promise(function(_0x2a3265,_0x2db521){return db[_0x540b('0x17')]['create'](_0x44dff4[_0x540b('0x18')],{'raw':_0x44dff4[_0x540b('0x19')]?_0x44dff4['options'][_0x540b('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x342cbd){logger['info']('CreateVoiceTransferReport',_0x44dff4);logger[_0x540b('0xe')]('CreateVoiceTransferReport',_0x44dff4,JSON[_0x540b('0xf')](_0x342cbd));_0x2a3265(_0x342cbd);})[_0x540b('0x1b')](function(_0x1069f3){logger['error'](_0x540b('0x16'),_0x1069f3[_0x540b('0x12')],_0x44dff4);_0x2db521(_0xd61e60[_0x540b('0x10')](0x1f4,_0x1069f3[_0x540b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index bf99df7..1d01723 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 _0xcf1c=['./webbar.controller','post','/originate','isAuthenticated','/hangup','canUpdate','hangup','/answer','answer','/hold','hold','/unhold','unhold','calls','/transfer','transfer','exports','express','Router'];(function(_0x2d9a8c,_0x402e39){var _0x512e2b=function(_0xfeb6c2){while(--_0xfeb6c2){_0x2d9a8c['push'](_0x2d9a8c['shift']());}};_0x512e2b(++_0x402e39);}(_0xcf1c,0x18d));var _0xccf1=function(_0x5b6a86,_0x59489c){_0x5b6a86=_0x5b6a86-0x0;var _0x425888=_0xcf1c[_0x5b6a86];return _0x425888;};'use strict';var express=require(_0xccf1('0x0'));var router=express[_0xccf1('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xccf1('0x2'));router[_0xccf1('0x3')](_0xccf1('0x4'),auth[_0xccf1('0x5')](),auth['canUpdate'](),controller['originate']);router['post'](_0xccf1('0x6'),auth['isAuthenticated'](),auth[_0xccf1('0x7')](),controller[_0xccf1('0x8')]);router[_0xccf1('0x3')](_0xccf1('0x9'),auth[_0xccf1('0x5')](),auth[_0xccf1('0x7')](),controller[_0xccf1('0xa')]);router[_0xccf1('0x3')](_0xccf1('0xb'),auth[_0xccf1('0x5')](),auth[_0xccf1('0x7')](),controller[_0xccf1('0xc')]);router[_0xccf1('0x3')](_0xccf1('0xd'),auth[_0xccf1('0x5')](),auth[_0xccf1('0x7')](),controller[_0xccf1('0xe')]);router['post']('/calls',auth[_0xccf1('0x5')](),auth[_0xccf1('0x7')](),controller[_0xccf1('0xf')]);router[_0xccf1('0x3')](_0xccf1('0x10'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xccf1('0x11')]);module[_0xccf1('0x12')]=router; \ No newline at end of file +var _0xd4b6=['/calls','calls','transfer','exports','express','Router','./webbar.controller','post','isAuthenticated','/hangup','canUpdate','/answer','/hold','/unhold','unhold'];(function(_0x4ddf27,_0x92cefa){var _0x46754f=function(_0x2913cf){while(--_0x2913cf){_0x4ddf27['push'](_0x4ddf27['shift']());}};_0x46754f(++_0x92cefa);}(_0xd4b6,0x13f));var _0x6d4b=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xd4b6[_0x1f9f37];return _0x21c080;};'use strict';var express=require(_0x6d4b('0x0'));var router=express[_0x6d4b('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x6d4b('0x2'));router[_0x6d4b('0x3')]('/originate',auth[_0x6d4b('0x4')](),auth['canUpdate'](),controller['originate']);router['post'](_0x6d4b('0x5'),auth[_0x6d4b('0x4')](),auth[_0x6d4b('0x6')](),controller['hangup']);router[_0x6d4b('0x3')](_0x6d4b('0x7'),auth[_0x6d4b('0x4')](),auth[_0x6d4b('0x6')](),controller['answer']);router[_0x6d4b('0x3')](_0x6d4b('0x8'),auth[_0x6d4b('0x4')](),auth[_0x6d4b('0x6')](),controller['hold']);router[_0x6d4b('0x3')](_0x6d4b('0x9'),auth[_0x6d4b('0x4')](),auth[_0x6d4b('0x6')](),controller[_0x6d4b('0xa')]);router[_0x6d4b('0x3')](_0x6d4b('0xb'),auth['isAuthenticated'](),auth[_0x6d4b('0x6')](),controller[_0x6d4b('0xc')]);router[_0x6d4b('0x3')]('/transfer',auth[_0x6d4b('0x4')](),auth[_0x6d4b('0x6')](),controller[_0x6d4b('0xd')]);module[_0x6d4b('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 1c4d9be..7b5f8b8 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 _0xd3b4=['rows','sessionId','sessionId\x20','\x20not\x20found!','originate','body','length','json','userId','callbackUrl','info','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','webbar:hangup','answer','answer\x20fired:','hold','hold\x20fired:','webbar:hold','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','UserId','conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../config/environment','util','bluebird','jayson/promise','http','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','then','code','message','result','User','findOne','agent','all'];(function(_0x2130f1,_0x4dbcba){var _0x3e4b16=function(_0x435e50){while(--_0x435e50){_0x2130f1['push'](_0x2130f1['shift']());}};_0x3e4b16(++_0x4dbcba);}(_0xd3b4,0x1e9));var _0x4d3b=function(_0x56188a,_0x421cd8){_0x56188a=_0x56188a-0x0;var _0xdf1e9f=_0xd3b4[_0x56188a];return _0xdf1e9f;};'use strict';var path=require(_0x4d3b('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0x4d3b('0x1'));var util=require(_0x4d3b('0x2'));var BPromise=require(_0x4d3b('0x3'));var jayson=require(_0x4d3b('0x4'));var amiClient=jayson['client'][_0x4d3b('0x5')]({'port':0x232a});var logger=require('../../config/logger')(_0x4d3b('0x6'));var Redis=require(_0x4d3b('0x7'));config[_0x4d3b('0x8')]=_[_0x4d3b('0x9')](config[_0x4d3b('0x8')],{'host':_0x4d3b('0xa'),'port':0x18eb});var io=require(_0x4d3b('0xb'))(new Redis(config[_0x4d3b('0x8')]));var Schema=require(_0x4d3b('0xc'));var originateValidation=new Schema({'userId':{'type':_0x4d3b('0xd'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x4d3b('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x4d3b('0xe')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x4d3b('0xd'),'required':[!![],_0x4d3b('0xf')]},'sessionId':{'type':_0x4d3b('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x4d3b('0xd'),'required':[!![],_0x4d3b('0xf')]},'sessionId':{'type':_0x4d3b('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x4d3b('0xd'),'required':[!![],_0x4d3b('0xf')]},'sessionId':{'type':_0x4d3b('0xe'),'required':[!![],_0x4d3b('0x10')]},'transferNumber':{'type':_0x4d3b('0xe'),'required':[!![],_0x4d3b('0x11')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4d3b('0xf')]},'sessionId':{'type':_0x4d3b('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x4d3b('0xd'),'required':[!![],_0x4d3b('0xf')]},'sessionId':{'type':_0x4d3b('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x4d3b('0xd'),'required':[!![],_0x4d3b('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x4d3b('0xd'),'required':[!![],_0x4d3b('0xf')]}});function emit(_0x43a9a2,_0x531d57,_0xfbb52a){logger['info'](_0x43a9a2,_0x531d57,JSON[_0x4d3b('0x12')](_0xfbb52a));io['to'](_0x43a9a2)[_0x4d3b('0x13')](_0x531d57,_0xfbb52a);}function handleError(_0x15cc17){return function(_0x408b9b){console[_0x4d3b('0x14')](_0x4d3b('0x15'),_0x408b9b,_0x408b9b instanceof RangeError);logger[_0x4d3b('0x16')](_0x408b9b[_0x4d3b('0x17')]);if(_0x408b9b instanceof RangeError){if(_0x408b9b[_0x4d3b('0x18')]){delete _0x408b9b[_0x4d3b('0x18')];}_0x15cc17[_0x4d3b('0x19')](0x194)[_0x4d3b('0x1a')](_0x408b9b);}else{if(_0x408b9b[_0x4d3b('0x18')]){delete _0x408b9b['name'];}_0x15cc17[_0x4d3b('0x19')](0x1f4)[_0x4d3b('0x1a')](_0x408b9b);}};}function checkError(){return function(_0x122169){if(!_0x122169){throw new RangeError(_0x4d3b('0x1b'));}return _0x122169;};}function respondWithRpcPromise(_0x40ede6,_0x59d04c){return new BPromise(function(_0x2133d7,_0x19c4c0){var _0x335bd8=amiClient;return _0x335bd8['request'](_0x40ede6,_0x59d04c)[_0x4d3b('0x1c')](function(_0x508335){if(_0x508335[_0x4d3b('0x16')]){if(_0x508335[_0x4d3b('0x16')][_0x4d3b('0x1d')]===0x1f4){return _0x19c4c0(_0x508335['error'][_0x4d3b('0x1e')]);}return _0x2133d7(_0x508335[_0x4d3b('0x16')][_0x4d3b('0x1e')]);}else{_0x2133d7(_0x508335[_0x4d3b('0x1f')]);}})['catch'](function(_0x260cd3){_0x19c4c0(_0x260cd3);});});}function getAgent(_0x7ac21c){return db[_0x4d3b('0x20')][_0x4d3b('0x21')]({'where':{'id':_0x7ac21c,'role':_0x4d3b('0x22')}})[_0x4d3b('0x1c')](checkError());}function getAgentCheckSession(_0x1223c7,_0x37fc9d){return new BPromise(function(_0x1b7c1b,_0x5d375c){var _0x3b62a7=respondWithRpcPromise('VoiceChannels');var _0x26209a=getAgent(_0x1223c7);Promise[_0x4d3b('0x23')]([_0x3b62a7,_0x26209a])[_0x4d3b('0x1c')](function(_0x3239bf){var _0x147799=_0x3239bf[0x0];var _0x2a57d4=_0x3239bf[0x1];var _0x491116=_['filter'](_0x147799[_0x4d3b('0x24')],function(_0x599e10){return _0x599e10['UserId']==_0x2a57d4['id']&&_0x599e10[_0x4d3b('0x25')]==_0x37fc9d;});if(_0x491116['length']==0x1){_0x1b7c1b(_0x2a57d4);}else{_0x5d375c(new RangeError(_0x4d3b('0x26')+_0x37fc9d+_0x4d3b('0x27')));}});});}exports[_0x4d3b('0x28')]=function(_0x175bc9,_0x5cbafd){logger['info']('originate\x20fired:',_0x175bc9[_0x4d3b('0x29')]);var _0x5eabef=originateValidation[_0x4d3b('0xc')](_0x175bc9[_0x4d3b('0x29')]);if(_0x5eabef[_0x4d3b('0x2a')]>0x0){return _0x5cbafd[_0x4d3b('0x19')](0x190)[_0x4d3b('0x2b')](_0x5eabef);}var _0xd61d5e=_0x175bc9[_0x4d3b('0x29')][_0x4d3b('0x2c')];var _0x16a95d=_0x175bc9[_0x4d3b('0x29')]['callNumber'];var _0x14d9fb=_0x175bc9['body']['callerId'];var _0x2bbe70=_0x175bc9[_0x4d3b('0x29')][_0x4d3b('0x2d')];return getAgent(_0xd61d5e)[_0x4d3b('0x1c')](function(_0x44fea7){logger[_0x4d3b('0x2e')](_0x4d3b('0x2f'),_0x44fea7[_0x4d3b('0x18')]);emit(util[_0x4d3b('0x30')](_0x4d3b('0x31'),_0x44fea7['name']),_0x4d3b('0x32'),{'callNumber':_0x16a95d,'callerId':_0x14d9fb,'callbackUrl':_0x2bbe70});return _0x5cbafd['status'](0xc8)['json']({'error':![],'message':_0x4d3b('0x33')});})[_0x4d3b('0x34')](handleError(_0x5cbafd));};exports[_0x4d3b('0x35')]=function(_0x3620cf,_0x5e5a0c){logger['info'](_0x4d3b('0x36'),_0x3620cf[_0x4d3b('0x29')]);var _0x2bc6a3=hangupValidation['validate'](_0x3620cf[_0x4d3b('0x29')]);if(_0x2bc6a3[_0x4d3b('0x2a')]>0x0){return _0x5e5a0c[_0x4d3b('0x19')](0x190)['json'](_0x2bc6a3);}var _0x10a3fc=_0x3620cf[_0x4d3b('0x29')][_0x4d3b('0x2c')];var _0x4ea4c5=_0x3620cf[_0x4d3b('0x29')][_0x4d3b('0x25')];return getAgent(_0x10a3fc)[_0x4d3b('0x1c')](function(_0x4651c2){logger[_0x4d3b('0x2e')](_0x4d3b('0x2f'),_0x4651c2['name']);emit(util[_0x4d3b('0x30')](_0x4d3b('0x31'),_0x4651c2['name']),_0x4d3b('0x37'),{'sessionId':_0x4ea4c5});return _0x5e5a0c[_0x4d3b('0x19')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})[_0x4d3b('0x34')](handleError(_0x5e5a0c));};exports[_0x4d3b('0x38')]=function(_0x24b61e,_0x26d84a){logger[_0x4d3b('0x2e')](_0x4d3b('0x39'),_0x24b61e[_0x4d3b('0x29')]);var _0x372858=answerValidation[_0x4d3b('0xc')](_0x24b61e[_0x4d3b('0x29')]);if(_0x372858[_0x4d3b('0x2a')]>0x0){return _0x26d84a['status'](0x190)[_0x4d3b('0x2b')](_0x372858);}var _0x29556c=_0x24b61e['body'][_0x4d3b('0x2c')];var _0x435add=_0x24b61e['body'][_0x4d3b('0x25')];return getAgent(_0x29556c)[_0x4d3b('0x1c')](function(_0x5f81fd){logger['info']('entityFound:',_0x5f81fd[_0x4d3b('0x18')]);emit(util[_0x4d3b('0x30')](_0x4d3b('0x31'),_0x5f81fd[_0x4d3b('0x18')]),'webbar:answer',{'sessionId':_0x435add});return _0x26d84a[_0x4d3b('0x19')](0xc8)[_0x4d3b('0x2b')]({'error':![],'message':'answer\x20executed!'});})[_0x4d3b('0x34')](handleError(_0x26d84a));};exports[_0x4d3b('0x3a')]=function(_0x4c46db,_0xd8a004){logger[_0x4d3b('0x2e')](_0x4d3b('0x3b'),_0x4c46db[_0x4d3b('0x29')]);var _0x1df1a5=holdValidation[_0x4d3b('0xc')](_0x4c46db[_0x4d3b('0x29')]);if(_0x1df1a5['length']>0x0){return _0xd8a004[_0x4d3b('0x19')](0x190)[_0x4d3b('0x2b')](_0x1df1a5);}var _0xf80cb4=_0x4c46db[_0x4d3b('0x29')][_0x4d3b('0x2c')];var _0x293eaa=_0x4c46db['body'][_0x4d3b('0x25')];return getAgent(_0xf80cb4)[_0x4d3b('0x1c')](function(_0x257289){logger[_0x4d3b('0x2e')](_0x4d3b('0x2f'),_0x257289[_0x4d3b('0x18')]);emit(util[_0x4d3b('0x30')](_0x4d3b('0x31'),_0x257289[_0x4d3b('0x18')]),_0x4d3b('0x3c'),{'sessionId':_0x293eaa});return _0xd8a004[_0x4d3b('0x19')](0xc8)[_0x4d3b('0x2b')]({'error':![],'message':'hold\x20executed!'});})[_0x4d3b('0x34')](handleError(_0xd8a004));};exports[_0x4d3b('0x3d')]=function(_0x1f7fd3,_0x1127c5){logger[_0x4d3b('0x2e')]('unhold\x20fired:',_0x1f7fd3[_0x4d3b('0x29')]);var _0x4ee963=unholdValidation[_0x4d3b('0xc')](_0x1f7fd3['body']);if(_0x4ee963[_0x4d3b('0x2a')]>0x0){return _0x1127c5['status'](0x190)[_0x4d3b('0x2b')](_0x4ee963);}var _0x2f7791=_0x1f7fd3[_0x4d3b('0x29')][_0x4d3b('0x2c')];var _0x1beff9=_0x1f7fd3[_0x4d3b('0x29')][_0x4d3b('0x25')];return getAgent(_0x2f7791)[_0x4d3b('0x1c')](function(_0x230b97){logger[_0x4d3b('0x2e')](_0x4d3b('0x2f'),_0x230b97[_0x4d3b('0x18')]);emit(util['format'](_0x4d3b('0x31'),_0x230b97[_0x4d3b('0x18')]),_0x4d3b('0x3e'),{'sessionId':_0x1beff9});return _0x1127c5[_0x4d3b('0x19')](0xc8)['json']({'error':![],'message':_0x4d3b('0x3f')});})['catch'](handleError(_0x1127c5));};exports[_0x4d3b('0x40')]=function(_0xe32799,_0x292b2f){logger['info'](_0x4d3b('0x41'),_0x292b2f[_0x4d3b('0x29')]);var _0x237a1f=callsValidation[_0x4d3b('0xc')](_0xe32799[_0x4d3b('0x29')]);if(_0x237a1f['length']>0x0){return _0x292b2f[_0x4d3b('0x19')](0x190)[_0x4d3b('0x2b')](_0x237a1f);}var _0x26c051=_0xe32799[_0x4d3b('0x29')][_0x4d3b('0x2c')];var _0x4e1466=respondWithRpcPromise(_0x4d3b('0x42'));var _0x5e6903=getAgent(_0x26c051);return Promise[_0x4d3b('0x23')]([_0x4e1466,_0x5e6903])['then'](function(_0xae4f67){var _0x26faa5=_0xae4f67[0x0];var _0x5e0b6f=_0xae4f67[0x1];var _0x1b7894=_['filter'](_0x26faa5[_0x4d3b('0x24')],function(_0x18066f){return _0x18066f[_0x4d3b('0x43')]==_0x5e0b6f['id'];});return _0x292b2f[_0x4d3b('0x19')](0xc8)['json']({'count':_0x1b7894[_0x4d3b('0x2a')],'rows':_0x1b7894});})[_0x4d3b('0x34')](handleError(_0x292b2f));};exports[_0x4d3b('0x44')]=function(_0x4747dc,_0x41f647){logger[_0x4d3b('0x2e')]('conference\x20fired:',_0x4747dc[_0x4d3b('0x29')]);var _0x1894f4=conferenceValidation['validate'](_0x4747dc[_0x4d3b('0x29')]);if(_0x1894f4[_0x4d3b('0x2a')]>0x0){return _0x41f647[_0x4d3b('0x19')](0x190)['json'](_0x1894f4);}var _0xbb40a5=_0x4747dc[_0x4d3b('0x29')][_0x4d3b('0x2c')];return getAgent(_0xbb40a5)['then'](function(_0x31ddcd){logger[_0x4d3b('0x2e')](_0x4d3b('0x2f'),_0x31ddcd[_0x4d3b('0x18')]);emit(util['format'](_0x4d3b('0x31'),_0x31ddcd[_0x4d3b('0x18')]),'webbar:conference');return _0x41f647[_0x4d3b('0x19')](0xc8)['json']({'error':![],'message':_0x4d3b('0x45')});})[_0x4d3b('0x34')](handleError(_0x41f647));};exports[_0x4d3b('0x46')]=function(_0x4b8434,_0x494126){logger[_0x4d3b('0x2e')](_0x4d3b('0x47'),_0x4b8434['body']);var _0x7d8d64=transferValidation[_0x4d3b('0xc')](_0x4b8434['body']);if(_0x7d8d64[_0x4d3b('0x2a')]>0x0){return _0x494126[_0x4d3b('0x19')](0x190)[_0x4d3b('0x2b')](_0x7d8d64);}var _0x11997f=_0x4b8434[_0x4d3b('0x29')][_0x4d3b('0x2c')];var _0x219d41=_0x4b8434[_0x4d3b('0x29')]['sessionId'];var _0x3d7256=_0x4b8434[_0x4d3b('0x29')][_0x4d3b('0x48')];return getAgent(_0x11997f)[_0x4d3b('0x1c')](function(_0x2ccc78){logger[_0x4d3b('0x2e')](_0x4d3b('0x2f'),_0x2ccc78[_0x4d3b('0x18')]);emit(util[_0x4d3b('0x30')](_0x4d3b('0x31'),_0x2ccc78[_0x4d3b('0x18')]),_0x4d3b('0x49'),{'sessionId':_0x219d41,'transferNumber':_0x3d7256});return _0x494126[_0x4d3b('0x19')](0xc8)[_0x4d3b('0x2b')]({'error':![],'message':_0x4d3b('0x4a')});})[_0x4d3b('0x34')](handleError(_0x494126));}; \ No newline at end of file +var _0x634d=['validate','userId\x20is\x20required','string','number','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','message','result','catch','User','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate\x20fired:','body','userId','callNumber','entityFound:','format','user:%s','json','originate\x20executed!','hangup','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','jayson/promise','client','http','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter'];(function(_0x178f52,_0x5d9675){var _0x556f99=function(_0x4a7b17){while(--_0x4a7b17){_0x178f52['push'](_0x178f52['shift']());}};_0x556f99(++_0x5d9675);}(_0x634d,0x120));var _0xd634=function(_0x3c596f,_0x50a156){_0x3c596f=_0x3c596f-0x0;var _0x2b3e02=_0x634d[_0x3c596f];return _0x2b3e02;};'use strict';var path=require(_0xd634('0x0'));var fs=require('fs');var _=require(_0xd634('0x1'));var db=require(_0xd634('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require('bluebird');var jayson=require(_0xd634('0x3'));var amiClient=jayson[_0xd634('0x4')][_0xd634('0x5')]({'port':0x232a});var logger=require('../../config/logger')(_0xd634('0x6'));var Redis=require(_0xd634('0x7'));config['redis']=_[_0xd634('0x8')](config[_0xd634('0x9')],{'host':_0xd634('0xa'),'port':0x18eb});var io=require(_0xd634('0xb'))(new Redis(config[_0xd634('0x9')]));var Schema=require(_0xd634('0xc'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xd634('0xd')]},'callNumber':{'type':_0xd634('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xd634('0xe')},'callbackUrl':{'type':_0xd634('0xe')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xd634('0xd')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xd634('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xd634('0xf'),'required':[!![],_0xd634('0xd')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xd634('0xe'),'required':[!![],_0xd634('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0xd634('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xd634('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xd634('0xf'),'required':[!![],_0xd634('0xd')]},'sessionId':{'type':_0xd634('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xd634('0xf'),'required':[!![],_0xd634('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0xd634('0xf'),'required':[!![],_0xd634('0xd')]}});function emit(_0x3a5fdd,_0x4bf557,_0x46d41d){logger[_0xd634('0x11')](_0x3a5fdd,_0x4bf557,JSON[_0xd634('0x12')](_0x46d41d));io['to'](_0x3a5fdd)[_0xd634('0x13')](_0x4bf557,_0x46d41d);}function handleError(_0x21acb4){return function(_0x271fa2){console[_0xd634('0x14')](_0xd634('0x15'),_0x271fa2,_0x271fa2 instanceof RangeError);logger[_0xd634('0x16')](_0x271fa2[_0xd634('0x17')]);if(_0x271fa2 instanceof RangeError){if(_0x271fa2['name']){delete _0x271fa2[_0xd634('0x18')];}_0x21acb4[_0xd634('0x19')](0x194)[_0xd634('0x1a')](_0x271fa2);}else{if(_0x271fa2[_0xd634('0x18')]){delete _0x271fa2[_0xd634('0x18')];}_0x21acb4[_0xd634('0x19')](0x1f4)[_0xd634('0x1a')](_0x271fa2);}};}function checkError(){return function(_0x2738bd){if(!_0x2738bd){throw new RangeError(_0xd634('0x1b'));}return _0x2738bd;};}function respondWithRpcPromise(_0x36f903,_0x561b74){return new BPromise(function(_0x5c34d1,_0x2c1bf2){var _0x350725=amiClient;return _0x350725[_0xd634('0x1c')](_0x36f903,_0x561b74)['then'](function(_0x140e50){if(_0x140e50[_0xd634('0x16')]){if(_0x140e50['error']['code']===0x1f4){return _0x2c1bf2(_0x140e50[_0xd634('0x16')]['message']);}return _0x5c34d1(_0x140e50['error'][_0xd634('0x1d')]);}else{_0x5c34d1(_0x140e50[_0xd634('0x1e')]);}})[_0xd634('0x1f')](function(_0x548f5b){_0x2c1bf2(_0x548f5b);});});}function getAgent(_0x5012b8){return db[_0xd634('0x20')]['findOne']({'where':{'id':_0x5012b8,'role':_0xd634('0x21')}})[_0xd634('0x22')](checkError());}function getAgentCheckSession(_0x262d2f,_0x2a3b86){return new BPromise(function(_0x29182d,_0x232b0c){var _0x16b84e=respondWithRpcPromise(_0xd634('0x23'));var _0x427c03=getAgent(_0x262d2f);Promise[_0xd634('0x24')]([_0x16b84e,_0x427c03])[_0xd634('0x22')](function(_0x36311f){var _0x37783f=_0x36311f[0x0];var _0x28b9b4=_0x36311f[0x1];var _0x2dd5ed=_[_0xd634('0x25')](_0x37783f[_0xd634('0x26')],function(_0x11c2a5){return _0x11c2a5[_0xd634('0x27')]==_0x28b9b4['id']&&_0x11c2a5[_0xd634('0x28')]==_0x2a3b86;});if(_0x2dd5ed[_0xd634('0x29')]==0x1){_0x29182d(_0x28b9b4);}else{_0x232b0c(new RangeError('sessionId\x20'+_0x2a3b86+_0xd634('0x2a')));}});});}exports['originate']=function(_0x3ca340,_0x5dbb76){logger[_0xd634('0x11')](_0xd634('0x2b'),_0x3ca340[_0xd634('0x2c')]);var _0x4af19e=originateValidation[_0xd634('0xc')](_0x3ca340[_0xd634('0x2c')]);if(_0x4af19e[_0xd634('0x29')]>0x0){return _0x5dbb76[_0xd634('0x19')](0x190)['json'](_0x4af19e);}var _0xec9fb2=_0x3ca340[_0xd634('0x2c')][_0xd634('0x2d')];var _0x367e4b=_0x3ca340[_0xd634('0x2c')][_0xd634('0x2e')];var _0x457c0f=_0x3ca340[_0xd634('0x2c')]['callerId'];var _0x368f3e=_0x3ca340[_0xd634('0x2c')]['callbackUrl'];return getAgent(_0xec9fb2)['then'](function(_0x5093f7){logger[_0xd634('0x11')](_0xd634('0x2f'),_0x5093f7[_0xd634('0x18')]);emit(util[_0xd634('0x30')](_0xd634('0x31'),_0x5093f7[_0xd634('0x18')]),'webbar:originate',{'callNumber':_0x367e4b,'callerId':_0x457c0f,'callbackUrl':_0x368f3e});return _0x5dbb76[_0xd634('0x19')](0xc8)[_0xd634('0x32')]({'error':![],'message':_0xd634('0x33')});})[_0xd634('0x1f')](handleError(_0x5dbb76));};exports[_0xd634('0x34')]=function(_0x1c153e,_0x342360){logger[_0xd634('0x11')]('hangup\x20fired:',_0x1c153e[_0xd634('0x2c')]);var _0x47b5de=hangupValidation[_0xd634('0xc')](_0x1c153e[_0xd634('0x2c')]);if(_0x47b5de[_0xd634('0x29')]>0x0){return _0x342360[_0xd634('0x19')](0x190)[_0xd634('0x32')](_0x47b5de);}var _0x37ee6c=_0x1c153e[_0xd634('0x2c')]['userId'];var _0x1f9af7=_0x1c153e['body'][_0xd634('0x28')];return getAgent(_0x37ee6c)[_0xd634('0x22')](function(_0x1c6adc){logger[_0xd634('0x11')](_0xd634('0x2f'),_0x1c6adc[_0xd634('0x18')]);emit(util['format'](_0xd634('0x31'),_0x1c6adc[_0xd634('0x18')]),_0xd634('0x35'),{'sessionId':_0x1f9af7});return _0x342360[_0xd634('0x19')](0xc8)[_0xd634('0x32')]({'error':![],'message':_0xd634('0x36')});})['catch'](handleError(_0x342360));};exports[_0xd634('0x37')]=function(_0x32e167,_0x2b060b){logger[_0xd634('0x11')](_0xd634('0x38'),_0x32e167[_0xd634('0x2c')]);var _0x2a9118=answerValidation[_0xd634('0xc')](_0x32e167[_0xd634('0x2c')]);if(_0x2a9118[_0xd634('0x29')]>0x0){return _0x2b060b[_0xd634('0x19')](0x190)['json'](_0x2a9118);}var _0x4e3388=_0x32e167['body']['userId'];var _0x19e5d2=_0x32e167[_0xd634('0x2c')][_0xd634('0x28')];return getAgent(_0x4e3388)['then'](function(_0x2f2b8d){logger[_0xd634('0x11')](_0xd634('0x2f'),_0x2f2b8d[_0xd634('0x18')]);emit(util[_0xd634('0x30')](_0xd634('0x31'),_0x2f2b8d[_0xd634('0x18')]),_0xd634('0x39'),{'sessionId':_0x19e5d2});return _0x2b060b[_0xd634('0x19')](0xc8)[_0xd634('0x32')]({'error':![],'message':_0xd634('0x3a')});})[_0xd634('0x1f')](handleError(_0x2b060b));};exports[_0xd634('0x3b')]=function(_0x682119,_0x17cb1f){logger[_0xd634('0x11')]('hold\x20fired:',_0x682119[_0xd634('0x2c')]);var _0x5d572d=holdValidation[_0xd634('0xc')](_0x682119[_0xd634('0x2c')]);if(_0x5d572d[_0xd634('0x29')]>0x0){return _0x17cb1f[_0xd634('0x19')](0x190)[_0xd634('0x32')](_0x5d572d);}var _0x2e9600=_0x682119[_0xd634('0x2c')][_0xd634('0x2d')];var _0x29f96d=_0x682119[_0xd634('0x2c')][_0xd634('0x28')];return getAgent(_0x2e9600)[_0xd634('0x22')](function(_0x27ee8c){logger[_0xd634('0x11')](_0xd634('0x2f'),_0x27ee8c[_0xd634('0x18')]);emit(util[_0xd634('0x30')](_0xd634('0x31'),_0x27ee8c[_0xd634('0x18')]),_0xd634('0x3c'),{'sessionId':_0x29f96d});return _0x17cb1f[_0xd634('0x19')](0xc8)[_0xd634('0x32')]({'error':![],'message':_0xd634('0x3d')});})[_0xd634('0x1f')](handleError(_0x17cb1f));};exports['unhold']=function(_0x1f6adf,_0x56cf2){logger[_0xd634('0x11')](_0xd634('0x3e'),_0x1f6adf[_0xd634('0x2c')]);var _0x517b3c=unholdValidation[_0xd634('0xc')](_0x1f6adf[_0xd634('0x2c')]);if(_0x517b3c[_0xd634('0x29')]>0x0){return _0x56cf2[_0xd634('0x19')](0x190)['json'](_0x517b3c);}var _0x4ca2f3=_0x1f6adf['body'][_0xd634('0x2d')];var _0xcb738c=_0x1f6adf[_0xd634('0x2c')]['sessionId'];return getAgent(_0x4ca2f3)[_0xd634('0x22')](function(_0x304bfa){logger[_0xd634('0x11')](_0xd634('0x2f'),_0x304bfa['name']);emit(util['format'](_0xd634('0x31'),_0x304bfa[_0xd634('0x18')]),_0xd634('0x3f'),{'sessionId':_0xcb738c});return _0x56cf2[_0xd634('0x19')](0xc8)[_0xd634('0x32')]({'error':![],'message':'unhold\x20executed!'});})[_0xd634('0x1f')](handleError(_0x56cf2));};exports[_0xd634('0x40')]=function(_0xc503e6,_0x50a387){logger[_0xd634('0x11')](_0xd634('0x41'),_0x50a387[_0xd634('0x2c')]);var _0x5f51a1=callsValidation['validate'](_0xc503e6[_0xd634('0x2c')]);if(_0x5f51a1[_0xd634('0x29')]>0x0){return _0x50a387[_0xd634('0x19')](0x190)[_0xd634('0x32')](_0x5f51a1);}var _0x274225=_0xc503e6[_0xd634('0x2c')][_0xd634('0x2d')];var _0x2384bb=respondWithRpcPromise(_0xd634('0x23'));var _0xcb136f=getAgent(_0x274225);return Promise['all']([_0x2384bb,_0xcb136f])['then'](function(_0x1035eb){var _0x334611=_0x1035eb[0x0];var _0x1af022=_0x1035eb[0x1];var _0x233987=_['filter'](_0x334611['rows'],function(_0x511ed1){return _0x511ed1[_0xd634('0x27')]==_0x1af022['id'];});return _0x50a387[_0xd634('0x19')](0xc8)['json']({'count':_0x233987[_0xd634('0x29')],'rows':_0x233987});})['catch'](handleError(_0x50a387));};exports[_0xd634('0x42')]=function(_0x5eed9e,_0x10f572){logger['info'](_0xd634('0x43'),_0x5eed9e[_0xd634('0x2c')]);var _0x411dda=conferenceValidation[_0xd634('0xc')](_0x5eed9e[_0xd634('0x2c')]);if(_0x411dda[_0xd634('0x29')]>0x0){return _0x10f572[_0xd634('0x19')](0x190)[_0xd634('0x32')](_0x411dda);}var _0x3dc6f0=_0x5eed9e[_0xd634('0x2c')]['userId'];return getAgent(_0x3dc6f0)[_0xd634('0x22')](function(_0x53de41){logger[_0xd634('0x11')](_0xd634('0x2f'),_0x53de41['name']);emit(util[_0xd634('0x30')](_0xd634('0x31'),_0x53de41[_0xd634('0x18')]),_0xd634('0x44'));return _0x10f572[_0xd634('0x19')](0xc8)['json']({'error':![],'message':_0xd634('0x45')});})[_0xd634('0x1f')](handleError(_0x10f572));};exports[_0xd634('0x46')]=function(_0x23b7f6,_0x156879){logger[_0xd634('0x11')](_0xd634('0x47'),_0x23b7f6['body']);var _0x1df458=transferValidation['validate'](_0x23b7f6['body']);if(_0x1df458['length']>0x0){return _0x156879[_0xd634('0x19')](0x190)[_0xd634('0x32')](_0x1df458);}var _0x40669d=_0x23b7f6['body'][_0xd634('0x2d')];var _0x3672e0=_0x23b7f6[_0xd634('0x2c')][_0xd634('0x28')];var _0x463764=_0x23b7f6[_0xd634('0x2c')][_0xd634('0x48')];return getAgent(_0x40669d)[_0xd634('0x22')](function(_0x538585){logger[_0xd634('0x11')](_0xd634('0x2f'),_0x538585[_0xd634('0x18')]);emit(util[_0xd634('0x30')]('user:%s',_0x538585['name']),_0xd634('0x49'),{'sessionId':_0x3672e0,'transferNumber':_0x463764});return _0x156879[_0xd634('0x19')](0xc8)[_0xd634('0x32')]({'error':![],'message':_0xd634('0x4a')});})['catch'](handleError(_0x156879));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index b3b1a39..47d2071 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 _0x1c9a=['post','create','addDisposition','addAnswer','/:id/applications','notify','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','getApplications'];(function(_0x111ee6,_0xd8a3ea){var _0x8bbb51=function(_0x273011){while(--_0x273011){_0x111ee6['push'](_0x111ee6['shift']());}};_0x8bbb51(++_0xd8a3ea);}(_0x1c9a,0x98));var _0xa1c9=function(_0x16255a,_0x2fc2e9){_0x16255a=_0x16255a-0x0;var _0x3dfbc0=_0x1c9a[_0x16255a];return _0x3dfbc0;};'use strict';var multer=require(_0xa1c9('0x0'));var util=require('util');var path=require(_0xa1c9('0x1'));var timeout=require('connect-timeout');var express=require(_0xa1c9('0x2'));var router=express[_0xa1c9('0x3')]();var auth=require(_0xa1c9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa1c9('0x5'));var controller=require(_0xa1c9('0x6'));router[_0xa1c9('0x7')]('/',auth[_0xa1c9('0x8')](),controller['index']);router[_0xa1c9('0x7')]('/describe',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x9')]);router[_0xa1c9('0x7')]('/:id',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0xa')]);router[_0xa1c9('0x7')](_0xa1c9('0xb'),auth['isAuthenticated'](),controller[_0xa1c9('0xc')]);router[_0xa1c9('0x7')](_0xa1c9('0xd'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0xe')]);router[_0xa1c9('0x7')](_0xa1c9('0xf'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x10')]);router[_0xa1c9('0x7')]('/:id/applications',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x11')]);router[_0xa1c9('0x12')]('/',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x13')]);router['post'](_0xa1c9('0xb'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x14')]);router[_0xa1c9('0x12')](_0xa1c9('0xd'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x15')]);router[_0xa1c9('0x12')](_0xa1c9('0xf'),auth[_0xa1c9('0x8')](),controller['addAgents']);router[_0xa1c9('0x12')](_0xa1c9('0x16'),auth[_0xa1c9('0x8')](),controller['addApplications']);router[_0xa1c9('0x12')]('/:id/notify',controller[_0xa1c9('0x17')]);router[_0xa1c9('0x12')](_0xa1c9('0x18'),auth['isAuthenticated'](),controller[_0xa1c9('0x19')]);router[_0xa1c9('0x1a')](_0xa1c9('0x1b'),auth['isAuthenticated'](),controller[_0xa1c9('0x1c')]);router[_0xa1c9('0x1d')]('/:id',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x1e')]);router[_0xa1c9('0x1d')]('/:id/dispositions',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x1f')]);router[_0xa1c9('0x1d')](_0xa1c9('0xd'),auth[_0xa1c9('0x8')](),controller['removeAnswers']);router['delete'](_0xa1c9('0xf'),auth['isAuthenticated'](),controller[_0xa1c9('0x20')]);module[_0xa1c9('0x21')]=router; \ No newline at end of file +var _0x5464=['show','/:id/dispositions','/:id/canned_answers','/:id/users','getAgents','post','addAgents','/:id/applications','/:id/notify','notify','/:id/send','send','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','describe','/:id'];(function(_0x3bbe24,_0x381385){var _0x209387=function(_0x8cf0e8){while(--_0x8cf0e8){_0x3bbe24['push'](_0x3bbe24['shift']());}};_0x209387(++_0x381385);}(_0x5464,0x15d));var _0x4546=function(_0x344556,_0xd096f3){_0x344556=_0x344556-0x0;var _0x524e19=_0x5464[_0x344556];return _0x524e19;};'use strict';var multer=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var path=require(_0x4546('0x2'));var timeout=require('connect-timeout');var express=require(_0x4546('0x3'));var router=express['Router']();var auth=require(_0x4546('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4546('0x5'));var controller=require(_0x4546('0x6'));router[_0x4546('0x7')]('/',auth[_0x4546('0x8')](),controller['index']);router['get']('/describe',auth[_0x4546('0x8')](),controller[_0x4546('0x9')]);router[_0x4546('0x7')](_0x4546('0xa'),auth[_0x4546('0x8')](),controller[_0x4546('0xb')]);router[_0x4546('0x7')](_0x4546('0xc'),auth[_0x4546('0x8')](),controller['getDispositions']);router[_0x4546('0x7')](_0x4546('0xd'),auth[_0x4546('0x8')](),controller['getAnswers']);router[_0x4546('0x7')](_0x4546('0xe'),auth[_0x4546('0x8')](),controller[_0x4546('0xf')]);router['get']('/:id/applications',auth[_0x4546('0x8')](),controller['getApplications']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/dispositions',auth[_0x4546('0x8')](),controller['addDisposition']);router[_0x4546('0x10')]('/:id/canned_answers',auth[_0x4546('0x8')](),controller['addAnswer']);router[_0x4546('0x10')](_0x4546('0xe'),auth[_0x4546('0x8')](),controller[_0x4546('0x11')]);router[_0x4546('0x10')](_0x4546('0x12'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x4546('0x13'),controller[_0x4546('0x14')]);router[_0x4546('0x10')](_0x4546('0x15'),auth[_0x4546('0x8')](),controller[_0x4546('0x16')]);router[_0x4546('0x17')](_0x4546('0xa'),auth[_0x4546('0x8')](),controller[_0x4546('0x18')]);router['delete'](_0x4546('0xa'),auth[_0x4546('0x8')](),controller['destroy']);router[_0x4546('0x19')](_0x4546('0xc'),auth[_0x4546('0x8')](),controller[_0x4546('0x1a')]);router[_0x4546('0x19')](_0x4546('0xd'),auth['isAuthenticated'](),controller[_0x4546('0x1b')]);router[_0x4546('0x19')]('/:id/users',auth[_0x4546('0x8')](),controller[_0x4546('0x1c')]);module[_0x4546('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index dd26bbc..8ec2080 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 _0x106a=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','randomstring','exports','name','STRING','generate','twilio','TEXT','BOOLEAN'];(function(_0x1237b5,_0x4786ad){var _0x5a2b68=function(_0x369986){while(--_0x369986){_0x1237b5['push'](_0x1237b5['shift']());}};_0x5a2b68(++_0x4786ad);}(_0x106a,0x1b2));var _0xa106=function(_0x184d73,_0x5869de){_0x184d73=_0x184d73-0x0;var _0x275f11=_0x106a[_0x184d73];return _0x275f11;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xa106('0x0'));module[_0xa106('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa106('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xa106('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xa106('0x3')],'defaultValue':function(){return rs[_0xa106('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xa106('0x5'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xa106('0x3')]},'notificationTemplate':{'type':Sequelize[_0xa106('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xa106('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xa106('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa106('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa106('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa106('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa106('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xa106('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xa106('0xa'),'set':function(_0x38a3b2){if(!_0x38a3b2){this[_0xa106('0xb')]('mandatoryDispositionPauseId',null);}this[_0xa106('0xb')](_0xa106('0xc'),_0x38a3b2);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3b5f=['mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','name','STRING','generate','twilio','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x3b5f,0x17c));var _0xf3b5=function(_0x16e8c2,_0x4518cb){_0x16e8c2=_0x16e8c2-0x0;var _0x1091e1=_0x3b5f[_0x16e8c2];return _0x1091e1;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xf3b5('0x0'));module[_0xf3b5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf3b5('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xf3b5('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xf3b5('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xf3b5('0x3')],'defaultValue':function(){return rs[_0xf3b5('0x4')]();}},'phone':{'type':Sequelize[_0xf3b5('0x3')]},'type':{'type':Sequelize['ENUM'](_0xf3b5('0x5'))},'accountSid':{'type':Sequelize[_0xf3b5('0x3')]},'authToken':{'type':Sequelize[_0xf3b5('0x3')]},'notificationTemplate':{'type':Sequelize[_0xf3b5('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xf3b5('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xf3b5('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf3b5('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf3b5('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf3b5('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf3b5('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf3b5('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf3b5('0x8')],'comment':_0xf3b5('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xf3b5('0x7')],'defaultValue':![],'comment':_0xf3b5('0xa'),'set':function(_0xdd6f04){if(!_0xdd6f04){this[_0xf3b5('0xb')](_0xf3b5('0xc'),null);}this[_0xf3b5('0xb')](_0xf3b5('0xd'),_0xdd6f04);}},'description':{'type':Sequelize[_0xf3b5('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 98bcf4c..0417497 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 _0x73e9=['createdAt','updatedAt','ListId','twilio','from','From','whatsapp:','MessageSid','isNil','Sequelize','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','CmContact','list','WhatsappInteraction','interaction','created','autoclose','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','json','to\x20is\x20mandatory','Contacts','List','dataValues','Messages','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','count','offset','set','Content-Range','apply','save','update','destroy','get','UserProfileResource','name','send','index','mandatoryDispositionPause','WhatsappAccount','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','include','findAll','rows','show','params','Pause','rawAttributes','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','order','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','WhatsappApplication','findAndCountAll','priority','getApplications','whatsapp','account','applications','orderBy','asc','Applications','ValidationError','no\x20available\x20attributes','difference'];(function(_0x3fc56e,_0x358942){var _0x73f9b7=function(_0x3e7868){while(--_0x3e7868){_0x3fc56e['push'](_0x3fc56e['shift']());}};_0x73f9b7(++_0x358942);}(_0x73e9,0x1a8));var _0x973e=function(_0x31506e,_0x1412b2){_0x31506e=_0x31506e-0x0;var _0x316c44=_0x73e9[_0x31506e];return _0x316c44;};'use strict';var pdf=require(_0x973e('0x0'));var emlformat=require(_0x973e('0x1'));var rimraf=require(_0x973e('0x2'));var zipdir=require(_0x973e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x973e('0x4'));var moment=require(_0x973e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x973e('0x6'));var util=require(_0x973e('0x7'));var path=require('path');var sox=require(_0x973e('0x8'));var csv=require(_0x973e('0x9'));var ejs=require(_0x973e('0xa'));var fs=require('fs');var _=require(_0x973e('0xb'));var squel=require(_0x973e('0xc'));var crypto=require(_0x973e('0xd'));var jsforce=require(_0x973e('0xe'));var deskjs=require(_0x973e('0xf'));var toCsv=require(_0x973e('0x9'));var querystring=require(_0x973e('0x10'));var Papa=require(_0x973e('0x11'));var Redis=require(_0x973e('0x12'));var authService=require(_0x973e('0x13'));var qs=require(_0x973e('0x14'));var as=require(_0x973e('0x15'));var hardwareService=require(_0x973e('0x16'));var logger=require('../../config/logger')(_0x973e('0x17'));var utils=require(_0x973e('0x18'));var config=require(_0x973e('0x19'));var licenseUtil=require(_0x973e('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x973e('0x1b')](config[_0x973e('0x1c')],{'host':_0x973e('0x1d'),'port':0x18eb});var socket=require(_0x973e('0x1e'))(new Redis(config[_0x973e('0x1c')]));require(_0x973e('0x1f'))[_0x973e('0x20')](socket);var jayson=require(_0x973e('0x21'));var client=jayson[_0x973e('0x22')][_0x973e('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x3c4cec,_0x7fe997,_0x297165,_0x57c7bc){return new BPromise(function(_0x46ad1a,_0x4fb0dc){var _0x58fce3=_0x57c7bc||client;return _0x58fce3[_0x973e('0x24')](_0x3c4cec,_0x297165)[_0x973e('0x25')](function(_0x3812cd){logger['info'](_0x973e('0x26'),_0x7fe997,_0x973e('0x27'));logger[_0x973e('0x28')](_0x973e('0x29'),_0x7fe997,_0x973e('0x27'),JSON[_0x973e('0x2a')](_0x3812cd));if(_0x3812cd['error']){if(_0x3812cd[_0x973e('0x2b')][_0x973e('0x2c')]===0x1f4){logger[_0x973e('0x2b')]('WhatsappAccount,\x20%s,\x20%s',_0x7fe997,_0x3812cd['error'][_0x973e('0x2d')]);return _0x4fb0dc(_0x3812cd[_0x973e('0x2b')][_0x973e('0x2d')]);}logger[_0x973e('0x2b')](_0x973e('0x26'),_0x7fe997,_0x3812cd[_0x973e('0x2b')][_0x973e('0x2d')]);return _0x46ad1a(_0x3812cd[_0x973e('0x2b')]['message']);}else{logger[_0x973e('0x2e')]('WhatsappAccount,\x20%s,\x20%s',_0x7fe997,'request\x20sent');_0x46ad1a(_0x3812cd['result'][_0x973e('0x2d')]);}})[_0x973e('0x2f')](function(_0x5a6531){logger['error'](_0x973e('0x26'),_0x7fe997,_0x5a6531);_0x4fb0dc(_0x5a6531);});});}function respondWithStatusCode(_0x330de8,_0x3ca2be){_0x3ca2be=_0x3ca2be||0xcc;return function(_0x584f29){if(_0x584f29){return _0x330de8[_0x973e('0x30')](_0x3ca2be);}return _0x330de8[_0x973e('0x31')](_0x3ca2be)[_0x973e('0x32')]();};}function respondWithResult(_0x502e80,_0x498e4f){_0x498e4f=_0x498e4f||0xc8;return function(_0xc16e13){if(_0xc16e13){return _0x502e80['status'](_0x498e4f)['json'](_0xc16e13);}};}function respondWithFilteredResult(_0x5abad7,_0x199941){return function(_0x5e8e07){if(_0x5e8e07){var _0x2101b1=_0x5e8e07[_0x973e('0x33')],_0x250b9d=_0x199941[_0x973e('0x34')],_0x44828c=_0x199941[_0x973e('0x34')]+_0x199941['limit'],_0x3ee866;if(_0x44828c>=_0x2101b1){_0x44828c=_0x2101b1;_0x3ee866=0xc8;}else{_0x3ee866=0xce;}_0x5abad7['status'](_0x3ee866);return _0x5abad7[_0x973e('0x35')](_0x973e('0x36'),_0x250b9d+'-'+_0x44828c+'/'+_0x2101b1)['json'](_0x5e8e07);}return null;};}function patchUpdates(_0x43b62a){return function(_0x5b782c){try{jsonpatch[_0x973e('0x37')](_0x5b782c,_0x43b62a,!![]);}catch(_0x2bcdfd){return BPromise['reject'](_0x2bcdfd);}return _0x5b782c[_0x973e('0x38')]();};}function saveUpdates(_0x417a1c,_0x1dc1b0){return function(_0x48a33a){if(_0x48a33a){return _0x48a33a[_0x973e('0x39')](_0x417a1c)[_0x973e('0x25')](function(_0x592b86){return _0x592b86;});}return null;};}function removeEntity(_0x6d873e,_0x4e3f6e){return function(_0x5ae812){if(_0x5ae812){return _0x5ae812[_0x973e('0x3a')]()['then'](function(){var _0x31589b=_0x5ae812[_0x973e('0x3b')]({'plain':!![]});var _0x4af3cf='WhatsappAccounts';return db[_0x973e('0x3c')]['destroy']({'where':{'type':_0x4af3cf,'resourceId':_0x31589b['id']}})['then'](function(){return _0x5ae812;});})[_0x973e('0x25')](function(){_0x6d873e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47e200,_0x312347){return function(_0x58e04f){if(!_0x58e04f){_0x47e200[_0x973e('0x30')](0x194);}return _0x58e04f;};}function handleError(_0x5ae8a8,_0x4ef677){_0x4ef677=_0x4ef677||0x1f4;return function(_0x30d5f5){logger[_0x973e('0x2b')](_0x30d5f5['stack']);if(_0x30d5f5[_0x973e('0x3d')]){delete _0x30d5f5[_0x973e('0x3d')];}_0x5ae8a8[_0x973e('0x31')](_0x4ef677)[_0x973e('0x3e')](_0x30d5f5);};}exports[_0x973e('0x3f')]=function(_0x324f15,_0x5a181f){var _0x4a3c65={'include':[{'model':db['Pause'],'as':_0x973e('0x40')}]},_0x156064={},_0xc39fa2={'count':0x0,'rows':[]};var _0xfde356=_['map'](db[_0x973e('0x41')]['rawAttributes'],function(_0x3593a2){return{'name':_0x3593a2[_0x973e('0x42')],'type':_0x3593a2[_0x973e('0x43')]['key']};});_0x156064[_0x973e('0x44')]=_[_0x973e('0x45')](_0xfde356,'name');_0x156064['query']=_[_0x973e('0x46')](_0x324f15[_0x973e('0x47')]);_0x156064[_0x973e('0x48')]=_[_0x973e('0x49')](_0x156064[_0x973e('0x44')],_0x156064[_0x973e('0x47')]);_0x4a3c65[_0x973e('0x4a')]=_['intersection'](_0x156064[_0x973e('0x44')],qs[_0x973e('0x4b')](_0x324f15[_0x973e('0x47')][_0x973e('0x4b')]));_0x4a3c65[_0x973e('0x4a')]=_0x4a3c65[_0x973e('0x4a')][_0x973e('0x4c')]?_0x4a3c65[_0x973e('0x4a')]:_0x156064[_0x973e('0x44')];if(!_0x324f15[_0x973e('0x47')][_0x973e('0x4d')](_0x973e('0x4e'))){_0x4a3c65['limit']=qs[_0x973e('0x4f')](_0x324f15['query'][_0x973e('0x4f')]);_0x4a3c65[_0x973e('0x34')]=qs[_0x973e('0x34')](_0x324f15[_0x973e('0x47')][_0x973e('0x34')]);}_0x4a3c65['order']=qs[_0x973e('0x50')](_0x324f15[_0x973e('0x47')][_0x973e('0x50')]);_0x4a3c65[_0x973e('0x51')]=qs['filters'](_[_0x973e('0x52')](_0x324f15[_0x973e('0x47')],_0x156064[_0x973e('0x48')]),_0xfde356);if(_0x324f15[_0x973e('0x47')][_0x973e('0x53')]){_0x4a3c65[_0x973e('0x51')]=_['merge'](_0x4a3c65[_0x973e('0x51')],{'$or':_['map'](_0xfde356,function(_0x388857){if(_0x388857[_0x973e('0x43')]!==_0x973e('0x54')){var _0x2afe76={};_0x2afe76[_0x388857[_0x973e('0x3d')]]={'$like':'%'+_0x324f15[_0x973e('0x47')][_0x973e('0x53')]+'%'};return _0x2afe76;}})});}_0x4a3c65=_['merge']({},_0x4a3c65,_0x324f15['options']);var _0xe1f479={'where':_0x4a3c65['where']};return db[_0x973e('0x41')][_0x973e('0x33')](_0xe1f479)[_0x973e('0x25')](function(_0x35e8bf){_0xc39fa2[_0x973e('0x33')]=_0x35e8bf;if(_0x324f15[_0x973e('0x47')]['includeAll']){_0x4a3c65[_0x973e('0x55')]=[{'all':!![]}];}return db[_0x973e('0x41')][_0x973e('0x56')](_0x4a3c65);})['then'](function(_0x3025ea){_0xc39fa2[_0x973e('0x57')]=_0x3025ea;return _0xc39fa2;})['then'](respondWithFilteredResult(_0x5a181f,_0x4a3c65))[_0x973e('0x2f')](handleError(_0x5a181f,null));};exports[_0x973e('0x58')]=function(_0x1a178d,_0x4a6575){var _0x269af0={'raw':![],'where':{'id':_0x1a178d[_0x973e('0x59')]['id']},'include':[{'model':db[_0x973e('0x5a')],'as':_0x973e('0x40')}]},_0x59b422={};_0x59b422[_0x973e('0x44')]=_['keys'](db['WhatsappAccount'][_0x973e('0x5b')]);_0x59b422[_0x973e('0x47')]=_[_0x973e('0x46')](_0x1a178d[_0x973e('0x47')]);_0x59b422['filters']=_[_0x973e('0x49')](_0x59b422[_0x973e('0x44')],_0x59b422[_0x973e('0x47')]);_0x269af0[_0x973e('0x4a')]=_[_0x973e('0x49')](_0x59b422['model'],qs[_0x973e('0x4b')](_0x1a178d['query'][_0x973e('0x4b')]));_0x269af0[_0x973e('0x4a')]=_0x269af0['attributes'][_0x973e('0x4c')]?_0x269af0['attributes']:_0x59b422[_0x973e('0x44')];if(_0x1a178d['query'][_0x973e('0x5c')]){_0x269af0[_0x973e('0x55')]=[{'all':!![]}];}_0x269af0=_[_0x973e('0x5d')]({},_0x269af0,_0x1a178d[_0x973e('0x5e')]);return db[_0x973e('0x41')][_0x973e('0x5f')](_0x269af0)[_0x973e('0x25')](handleEntityNotFound(_0x4a6575,null))['then'](respondWithResult(_0x4a6575,null))['catch'](handleError(_0x4a6575,null));};exports[_0x973e('0x60')]=function(_0xd3f863,_0xf26efb){return db[_0x973e('0x41')][_0x973e('0x60')](_0xd3f863[_0x973e('0x61')],{})[_0x973e('0x25')](function(_0xb5b89d){var _0x149d00=_0xd3f863[_0x973e('0x62')]['get']({'plain':!![]});if(!_0x149d00)throw new Error(_0x973e('0x63'));if(_0x149d00[_0x973e('0x64')]===_0x973e('0x62')){var _0x32d543=_0xb5b89d['get']({'plain':!![]});var _0x319a11=_0x973e('0x65');return db[_0x973e('0x66')]['find']({'where':{'name':_0x319a11,'userProfileId':_0x149d00['userProfileId']},'raw':!![]})[_0x973e('0x25')](function(_0x366122){if(_0x366122&&_0x366122['autoAssociation']===0x0){return db[_0x973e('0x3c')][_0x973e('0x60')]({'name':_0x32d543[_0x973e('0x3d')],'resourceId':_0x32d543['id'],'type':_0x366122[_0x973e('0x3d')],'sectionId':_0x366122['id']},{})['then'](function(){return _0xb5b89d;});}else{return _0xb5b89d;}})['catch'](function(_0x162b84){logger[_0x973e('0x2b')](_0x973e('0x67'),_0x162b84);throw _0x162b84;});}return _0xb5b89d;})['then'](respondWithResult(_0xf26efb,0xc9))[_0x973e('0x2f')](handleError(_0xf26efb,null));};exports[_0x973e('0x39')]=function(_0x4d63b5,_0x2a80db){if(_0x4d63b5[_0x973e('0x61')]['id']){delete _0x4d63b5[_0x973e('0x61')]['id'];}return db[_0x973e('0x41')][_0x973e('0x5f')]({'where':{'id':_0x4d63b5[_0x973e('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x973e('0x40')}]})[_0x973e('0x25')](handleEntityNotFound(_0x2a80db,null))[_0x973e('0x25')](saveUpdates(_0x4d63b5[_0x973e('0x61')],null))[_0x973e('0x25')](respondWithResult(_0x2a80db,null))[_0x973e('0x2f')](handleError(_0x2a80db,null));};exports[_0x973e('0x3a')]=function(_0x47b969,_0x26ef1d){return db['WhatsappAccount']['find']({'where':{'id':_0x47b969['params']['id']}})[_0x973e('0x25')](handleEntityNotFound(_0x26ef1d,null))[_0x973e('0x25')](removeEntity(_0x26ef1d,null))[_0x973e('0x2f')](handleError(_0x26ef1d,null));};exports['describe']=function(_0x48be16,_0x38eb4b){return db['WhatsappAccount'][_0x973e('0x68')]()[_0x973e('0x25')](respondWithResult(_0x38eb4b,null))['catch'](handleError(_0x38eb4b,null));};exports[_0x973e('0x69')]=function(_0x11c5d2,_0x333d64,_0x358876){if(_0x11c5d2[_0x973e('0x61')]['id']){delete _0x11c5d2[_0x973e('0x61')]['id'];}return db[_0x973e('0x41')]['find']({'where':{'id':_0x11c5d2[_0x973e('0x59')]['id']}})[_0x973e('0x25')](handleEntityNotFound(_0x333d64,null))['then'](function(_0x44ee4b){if(_0x44ee4b){_0x11c5d2[_0x973e('0x61')][_0x973e('0x6a')]=_0x44ee4b['id'];return db[_0x973e('0x6b')]['create'](_0x11c5d2[_0x973e('0x61')]);}})[_0x973e('0x25')](respondWithResult(_0x333d64,null))[_0x973e('0x2f')](handleError(_0x333d64,null));};exports[_0x973e('0x6c')]=function(_0x45245c,_0x8b987b,_0x1eb62d){var _0x20f525={'raw':![],'where':{}};var _0x12d5dc={};var _0x59eece={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x973e('0x6d')]({'where':{'id':_0x45245c['params']['id']}})[_0x973e('0x25')](handleEntityNotFound(_0x8b987b,null))[_0x973e('0x25')](function(_0x32c00d){if(_0x32c00d){_0x12d5dc[_0x973e('0x44')]=_[_0x973e('0x46')](db[_0x973e('0x6b')][_0x973e('0x5b')]);_0x12d5dc[_0x973e('0x47')]=_[_0x973e('0x46')](_0x45245c['query']);_0x12d5dc['filters']=_[_0x973e('0x49')](_0x12d5dc[_0x973e('0x44')],_0x12d5dc['query']);_0x20f525[_0x973e('0x4a')]=_[_0x973e('0x49')](_0x12d5dc[_0x973e('0x44')],qs['fields'](_0x45245c['query'][_0x973e('0x4b')]));_0x20f525['attributes']=_0x20f525[_0x973e('0x4a')][_0x973e('0x4c')]?_0x20f525['attributes']:_0x12d5dc[_0x973e('0x44')];if(!_0x45245c['query'][_0x973e('0x4d')]('nolimit')){_0x20f525[_0x973e('0x4f')]=qs[_0x973e('0x4f')](_0x45245c['query'][_0x973e('0x4f')]);_0x20f525[_0x973e('0x34')]=qs[_0x973e('0x34')](_0x45245c['query'][_0x973e('0x34')]);}_0x20f525['order']=qs[_0x973e('0x50')](_0x45245c['query']['sort']);_0x20f525[_0x973e('0x51')]=qs['filters'](_[_0x973e('0x52')](_0x45245c[_0x973e('0x47')],_0x12d5dc[_0x973e('0x48')]));_0x20f525[_0x973e('0x51')][_0x973e('0x6a')]=_0x32c00d['id'];if(_0x45245c[_0x973e('0x47')][_0x973e('0x53')]){_0x20f525[_0x973e('0x51')]=_['merge'](_0x20f525[_0x973e('0x51')],{'$or':_[_0x973e('0x45')](_0x20f525[_0x973e('0x4a')],function(_0xc59435){var _0x54426a={};_0x54426a[_0xc59435]={'$like':'%'+_0x45245c[_0x973e('0x47')]['filter']+'%'};return _0x54426a;})});}_0x20f525=_[_0x973e('0x5d')]({},_0x20f525,_0x45245c[_0x973e('0x5e')]);return db[_0x973e('0x6b')][_0x973e('0x33')]({'where':_0x20f525[_0x973e('0x51')]})[_0x973e('0x25')](function(_0x53a2b3){_0x59eece[_0x973e('0x33')]=_0x53a2b3;if(_0x45245c[_0x973e('0x47')][_0x973e('0x5c')]){_0x20f525[_0x973e('0x55')]=[{'all':!![]}];}return db[_0x973e('0x6b')]['findAll'](_0x20f525);})[_0x973e('0x25')](function(_0x41921b){_0x59eece[_0x973e('0x57')]=_0x41921b;return _0x59eece;});}})[_0x973e('0x25')](respondWithFilteredResult(_0x8b987b,_0x20f525))[_0x973e('0x2f')](handleError(_0x8b987b,null));};exports[_0x973e('0x6e')]=function(_0x78de08,_0x1eba1e,_0x4e4a92){return db[_0x973e('0x41')]['find']({'where':{'id':_0x78de08[_0x973e('0x59')]['id']}})[_0x973e('0x25')](handleEntityNotFound(_0x1eba1e,null))[_0x973e('0x25')](function(_0xdbbe90){if(_0xdbbe90){return _0xdbbe90[_0x973e('0x6e')](_0x78de08[_0x973e('0x47')][_0x973e('0x6f')]);}})[_0x973e('0x25')](respondWithStatusCode(_0x1eba1e,null))[_0x973e('0x2f')](handleError(_0x1eba1e,null));};exports[_0x973e('0x70')]=function(_0x1becca,_0x3bb8cf,_0x3db054){if(_0x1becca['body']['id']){delete _0x1becca[_0x973e('0x61')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x1becca[_0x973e('0x59')]['id']}})[_0x973e('0x25')](handleEntityNotFound(_0x3bb8cf,null))['then'](function(_0x2ee8a5){if(_0x2ee8a5){_0x1becca[_0x973e('0x61')]['WhatsappAccountId']=_0x2ee8a5['id'];return db['CannedAnswer'][_0x973e('0x60')](_0x1becca[_0x973e('0x61')]);}})[_0x973e('0x25')](respondWithResult(_0x3bb8cf,null))['catch'](handleError(_0x3bb8cf,null));};exports[_0x973e('0x71')]=function(_0x36f626,_0x2c71a2,_0x14cd28){var _0x2bd217={'raw':![],'where':{}};var _0x292130={};var _0x425282={'count':0x0,'rows':[]};return db[_0x973e('0x41')]['findOne']({'where':{'id':_0x36f626['params']['id']}})[_0x973e('0x25')](handleEntityNotFound(_0x2c71a2,null))[_0x973e('0x25')](function(_0x117cb9){if(_0x117cb9){_0x292130[_0x973e('0x44')]=_['keys'](db[_0x973e('0x72')][_0x973e('0x5b')]);_0x292130['query']=_['keys'](_0x36f626['query']);_0x292130[_0x973e('0x48')]=_[_0x973e('0x49')](_0x292130[_0x973e('0x44')],_0x292130[_0x973e('0x47')]);_0x2bd217[_0x973e('0x4a')]=_[_0x973e('0x49')](_0x292130['model'],qs['fields'](_0x36f626[_0x973e('0x47')]['fields']));_0x2bd217['attributes']=_0x2bd217['attributes'][_0x973e('0x4c')]?_0x2bd217['attributes']:_0x292130[_0x973e('0x44')];if(!_0x36f626[_0x973e('0x47')]['hasOwnProperty'](_0x973e('0x4e'))){_0x2bd217[_0x973e('0x4f')]=qs[_0x973e('0x4f')](_0x36f626[_0x973e('0x47')][_0x973e('0x4f')]);_0x2bd217[_0x973e('0x34')]=qs[_0x973e('0x34')](_0x36f626[_0x973e('0x47')][_0x973e('0x34')]);}_0x2bd217[_0x973e('0x73')]=qs['sort'](_0x36f626['query'][_0x973e('0x50')]);_0x2bd217[_0x973e('0x51')]=qs[_0x973e('0x48')](_[_0x973e('0x52')](_0x36f626[_0x973e('0x47')],_0x292130[_0x973e('0x48')]));_0x2bd217[_0x973e('0x51')][_0x973e('0x6a')]=_0x117cb9['id'];if(_0x36f626[_0x973e('0x47')]['filter']){_0x2bd217[_0x973e('0x51')]=_['merge'](_0x2bd217[_0x973e('0x51')],{'$or':_[_0x973e('0x45')](_0x2bd217[_0x973e('0x4a')],function(_0x17e7e7){var _0x1f071a={};_0x1f071a[_0x17e7e7]={'$like':'%'+_0x36f626[_0x973e('0x47')][_0x973e('0x53')]+'%'};return _0x1f071a;})});}_0x2bd217=_[_0x973e('0x5d')]({},_0x2bd217,_0x36f626[_0x973e('0x5e')]);return db['CannedAnswer'][_0x973e('0x33')]({'where':_0x2bd217[_0x973e('0x51')]})[_0x973e('0x25')](function(_0x17fab6){_0x425282[_0x973e('0x33')]=_0x17fab6;if(_0x36f626['query']['includeAll']){_0x2bd217[_0x973e('0x55')]=[{'all':!![]}];}return db[_0x973e('0x72')][_0x973e('0x56')](_0x2bd217);})[_0x973e('0x25')](function(_0x2f220c){_0x425282['rows']=_0x2f220c;return _0x425282;});}})['then'](respondWithFilteredResult(_0x2c71a2,_0x2bd217))[_0x973e('0x2f')](handleError(_0x2c71a2,null));};exports[_0x973e('0x74')]=function(_0x36ba25,_0x3f9a4d,_0x29d97d){return db[_0x973e('0x41')][_0x973e('0x5f')]({'where':{'id':_0x36ba25[_0x973e('0x59')]['id']}})['then'](handleEntityNotFound(_0x3f9a4d,null))[_0x973e('0x25')](function(_0x79aa2b){if(_0x79aa2b){return _0x79aa2b['removeAnswers'](_0x36ba25[_0x973e('0x47')][_0x973e('0x6f')]);}})[_0x973e('0x25')](respondWithStatusCode(_0x3f9a4d,null))[_0x973e('0x2f')](handleError(_0x3f9a4d,null));};exports[_0x973e('0x75')]=function(_0x126fab,_0x4d9050,_0x5abaa4){return db[_0x973e('0x41')][_0x973e('0x5f')]({'where':{'id':_0x126fab['params']['id']}})[_0x973e('0x25')](handleEntityNotFound(_0x4d9050,null))[_0x973e('0x25')](function(_0x58425a){if(_0x58425a){return _0x58425a[_0x973e('0x75')](_0x126fab[_0x973e('0x61')][_0x973e('0x6f')],_[_0x973e('0x76')](_0x126fab[_0x973e('0x61')],[_0x973e('0x6f'),'id'])||{})[_0x973e('0x77')](function(_0x145ebc){for(var _0x2285b7=0x0;_0x2285b7<_0x126fab['body'][_0x973e('0x6f')]['length'];_0x2285b7+=0x1){socket[_0x973e('0x78')]('userWhatsappAccount:save',{'UserId':_0x126fab[_0x973e('0x61')][_0x973e('0x6f')][_0x2285b7],'WhatsappAccountId':_0x126fab[_0x973e('0x59')]['id']});}return _0x145ebc;});}})[_0x973e('0x25')](respondWithResult(_0x4d9050,null))['catch'](handleError(_0x4d9050,null));};exports[_0x973e('0x79')]=function(_0x46a454,_0xdac7ba,_0x455b05){return db['WhatsappAccount'][_0x973e('0x5f')]({'where':{'id':_0x46a454[_0x973e('0x59')]['id']}})[_0x973e('0x25')](handleEntityNotFound(_0xdac7ba,null))['then'](function(_0x72b709){if(_0x72b709){return _0x72b709[_0x973e('0x79')](_0x46a454['query'][_0x973e('0x6f')])[_0x973e('0x25')](function(){if(_[_0x973e('0x7a')](_0x46a454[_0x973e('0x47')][_0x973e('0x6f')])){for(var _0x38e2a3=0x0;_0x38e2a3<_0x46a454[_0x973e('0x47')][_0x973e('0x6f')][_0x973e('0x4c')];_0x38e2a3+=0x1){socket['emit'](_0x973e('0x7b'),{'UserId':Number(_0x46a454[_0x973e('0x47')][_0x973e('0x6f')][_0x38e2a3]),'WhatsappAccountId':Number(_0x46a454[_0x973e('0x59')]['id'])});}}else{socket[_0x973e('0x78')]('userWhatsappAccount:remove',{'UserId':Number(_0x46a454[_0x973e('0x47')][_0x973e('0x6f')]),'WhatsappAccountId':Number(_0x46a454[_0x973e('0x59')]['id'])});}});}})[_0x973e('0x25')](respondWithStatusCode(_0xdac7ba,null))[_0x973e('0x2f')](handleError(_0xdac7ba,null));};exports[_0x973e('0x7c')]=function(_0x38328,_0x166a10,_0x4c19c9){var _0x23a71b={};var _0x45dbc5={};var _0x32769b;var _0x99e1dd;return db['WhatsappAccount'][_0x973e('0x6d')]({'where':{'id':_0x38328[_0x973e('0x59')]['id']}})['then'](handleEntityNotFound(_0x166a10,null))[_0x973e('0x25')](function(_0x1fe47d){if(_0x1fe47d){_0x32769b=_0x1fe47d;_0x45dbc5[_0x973e('0x44')]=_[_0x973e('0x46')](db['User'][_0x973e('0x5b')]);_0x45dbc5[_0x973e('0x47')]=_['keys'](_0x38328[_0x973e('0x47')]);_0x45dbc5[_0x973e('0x48')]=_['intersection'](_0x45dbc5[_0x973e('0x44')],_0x45dbc5['query']);_0x23a71b[_0x973e('0x4a')]=_[_0x973e('0x49')](_0x45dbc5[_0x973e('0x44')],qs[_0x973e('0x4b')](_0x38328['query'][_0x973e('0x4b')]));_0x23a71b['attributes']=_0x23a71b[_0x973e('0x4a')][_0x973e('0x4c')]?_0x23a71b['attributes']:_0x45dbc5[_0x973e('0x44')];_0x23a71b[_0x973e('0x73')]=qs[_0x973e('0x50')](_0x38328[_0x973e('0x47')][_0x973e('0x50')]);_0x23a71b[_0x973e('0x51')]=qs[_0x973e('0x48')](_[_0x973e('0x52')](_0x38328[_0x973e('0x47')],_0x45dbc5[_0x973e('0x48')]));if(_0x38328[_0x973e('0x47')][_0x973e('0x53')]){_0x23a71b[_0x973e('0x51')]=_[_0x973e('0x5d')](_0x23a71b[_0x973e('0x51')],{'$or':_[_0x973e('0x45')](_0x23a71b[_0x973e('0x4a')],function(_0x3d7cc5){var _0x412f9d={};_0x412f9d[_0x3d7cc5]={'$like':'%'+_0x38328[_0x973e('0x47')]['filter']+'%'};return _0x412f9d;})});}_0x23a71b=_[_0x973e('0x5d')]({},_0x23a71b,_0x38328[_0x973e('0x5e')]);return _0x32769b[_0x973e('0x7c')](_0x23a71b);}})[_0x973e('0x25')](function(_0x14dccd){if(_0x14dccd){_0x99e1dd=_0x14dccd['length'];if(!_0x38328[_0x973e('0x47')]['hasOwnProperty'](_0x973e('0x4e'))){_0x23a71b[_0x973e('0x4f')]=qs[_0x973e('0x4f')](_0x38328[_0x973e('0x47')]['limit']);_0x23a71b[_0x973e('0x34')]=qs['offset'](_0x38328[_0x973e('0x47')][_0x973e('0x34')]);}return _0x32769b['getAgents'](_0x23a71b);}})['then'](function(_0x17ae60){if(_0x17ae60){return _0x17ae60?{'count':_0x99e1dd,'rows':_0x17ae60}:null;}})[_0x973e('0x25')](respondWithResult(_0x166a10,null))[_0x973e('0x2f')](handleError(_0x166a10,null));};exports[_0x973e('0x7d')]=function(_0xba7bfa,_0x50dfaa,_0x2b744e){return db['WhatsappAccount'][_0x973e('0x6d')]({'where':{'id':_0xba7bfa[_0x973e('0x59')]['id']}})[_0x973e('0x25')](handleEntityNotFound(_0x50dfaa,null))[_0x973e('0x25')](function(_0x400702){if(_0x400702){return db[_0x973e('0x7e')]['transaction'](function(_0x5964bd){return db['WhatsappApplication'][_0x973e('0x3a')]({'where':{'WhatsappAccountId':_0xba7bfa['params']['id']},'transaction':_0x5964bd})['then'](function(_0x1e6ac0){var _0x548888=_[_0x973e('0x45')](_0xba7bfa[_0x973e('0x61')],function(_0x3e038e){_0x3e038e['WhatsappAccountId']=_0xba7bfa['params']['id'];return _0x3e038e;});return db[_0x973e('0x7f')]['bulkCreate'](_0x548888,{'transaction':_0x5964bd});});})[_0x973e('0x25')](function(){return db[_0x973e('0x7f')][_0x973e('0x80')]({'where':{'WhatsappAccountId':_0xba7bfa[_0x973e('0x59')]['id']},'order':_0x973e('0x81')});});}})[_0x973e('0x25')](respondWithResult(_0x50dfaa,null))[_0x973e('0x2f')](handleError(_0x50dfaa,null));};exports[_0x973e('0x82')]=function(_0x1c5fd8,_0x47bdeb,_0x4e262b){var _0x5a59f9={};var _0x5a3f02={};var _0x2f5909;var _0x58444b;return db['WhatsappAccount'][_0x973e('0x6d')]({'where':{'id':_0x1c5fd8['params']['id']}})[_0x973e('0x25')](handleEntityNotFound(_0x47bdeb,null))[_0x973e('0x25')](function(_0x11029c){if(_0x11029c){_0x2f5909=_0x11029c;_0x5a3f02[_0x973e('0x44')]=_[_0x973e('0x46')](db[_0x973e('0x7f')]['rawAttributes']);_0x5a3f02['query']=_[_0x973e('0x46')](_0x1c5fd8[_0x973e('0x47')]);_0x5a3f02[_0x973e('0x48')]=_[_0x973e('0x49')](_0x5a3f02['model'],_0x5a3f02['query']);_0x5a59f9[_0x973e('0x4a')]=_['intersection'](_0x5a3f02[_0x973e('0x44')],qs['fields'](_0x1c5fd8['query']['fields']));_0x5a59f9[_0x973e('0x4a')]=_0x5a59f9['attributes'][_0x973e('0x4c')]?_0x5a59f9[_0x973e('0x4a')]:_0x5a3f02[_0x973e('0x44')];_0x5a59f9[_0x973e('0x73')]=qs['sort'](_0x1c5fd8[_0x973e('0x47')][_0x973e('0x50')]);_0x5a59f9[_0x973e('0x51')]=qs[_0x973e('0x48')](_['pick'](_0x1c5fd8['query'],_0x5a3f02['filters']));if(_0x1c5fd8[_0x973e('0x47')]['filter']){_0x5a59f9[_0x973e('0x51')]=_[_0x973e('0x5d')](_0x5a59f9[_0x973e('0x51')],{'$or':_['map'](_0x5a59f9[_0x973e('0x4a')],function(_0x214fac){var _0x143295={};_0x143295[_0x214fac]={'$like':'%'+_0x1c5fd8[_0x973e('0x47')]['filter']+'%'};return _0x143295;})});}_0x5a59f9=_['merge']({},_0x5a59f9,_0x1c5fd8[_0x973e('0x5e')]);return _0x2f5909[_0x973e('0x82')](_0x5a59f9);}})[_0x973e('0x25')](function(_0x2b3b5c){if(_0x2b3b5c){_0x58444b=_0x2b3b5c['length'];if(!_0x1c5fd8[_0x973e('0x47')][_0x973e('0x4d')](_0x973e('0x4e'))){_0x5a59f9['limit']=qs[_0x973e('0x4f')](_0x1c5fd8[_0x973e('0x47')]['limit']);_0x5a59f9[_0x973e('0x34')]=qs[_0x973e('0x34')](_0x1c5fd8['query'][_0x973e('0x34')]);}return _0x2f5909[_0x973e('0x82')](_0x5a59f9);}})[_0x973e('0x25')](function(_0x39e4e9){if(_0x39e4e9){return _0x39e4e9?{'count':_0x58444b,'rows':_0x39e4e9}:null;}})[_0x973e('0x25')](respondWithResult(_0x47bdeb,null))[_0x973e('0x2f')](handleError(_0x47bdeb,null));};exports['notify']=function(_0x55c8ee,_0x281992,_0x2fec30){var _0x5bb265={'channel':_0x973e('0x83')};var _0x50be5a=[];var _0xeb96e4=[];var _0x45336c={};return db[_0x973e('0x41')]['find']({'where':{'id':_0x55c8ee[_0x973e('0x59')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0x973e('0x25')](handleEntityNotFound(_0x281992,null))['then'](function(_0x26dfa3){_0x5bb265[_0x973e('0x84')]=_0x26dfa3;_0x5bb265[_0x973e('0x85')]=_[_0x973e('0x86')](_0x26dfa3['Applications'],[_0x973e('0x81')],[_0x973e('0x87')]);if(_0x5bb265['account'][_0x973e('0x88')]){delete _0x5bb265[_0x973e('0x84')][_0x973e('0x88')];}return db['CmContact'][_0x973e('0x68')]();})[_0x973e('0x25')](function(_0x3e0870){if(!_0x3e0870){throw new db['Sequelize'][(_0x973e('0x89'))](_0x973e('0x8a'));}_0x50be5a=_[_0x973e('0x8b')](_[_0x973e('0x46')](_0x3e0870),[_0x973e('0x8c'),_0x973e('0x8d')]);_0xeb96e4=_['difference'](_[_0x973e('0x46')](_0x3e0870),[_0x973e('0x8c'),_0x973e('0x8d'),'CompanyId',_0x973e('0x8e')]);_0x5bb265[_0x973e('0x61')]={'mapKey':'mobile'};if(_0x5bb265[_0x973e('0x84')][_0x973e('0x43')]&&_0x5bb265['account']['type']===_0x973e('0x8f')){_0x5bb265[_0x973e('0x61')][_0x973e('0x90')]=_0x55c8ee[_0x973e('0x61')][_0x973e('0x91')]['replace'](_0x973e('0x92'),'');_0x5bb265[_0x973e('0x61')][_0x973e('0x61')]=_0x55c8ee[_0x973e('0x61')]['Body'];_0x5bb265[_0x973e('0x61')]['messageId']=_0x55c8ee[_0x973e('0x61')][_0x973e('0x93')];}if(_0x5bb265['body']['id']){delete _0x5bb265['body']['id'];}if(_[_0x973e('0x94')](_0x5bb265[_0x973e('0x61')][_0x973e('0x90')])){throw new db[(_0x973e('0x95'))][(_0x973e('0x89'))](_0x973e('0x96'));}if(_[_0x973e('0x94')](_0x5bb265[_0x973e('0x61')]['body'])||_0x5bb265['body'][_0x973e('0x61')]===''){throw new db[(_0x973e('0x95'))][(_0x973e('0x89'))](_0x973e('0x97'));}if(_[_0x973e('0x94')](_0x5bb265[_0x973e('0x61')]['mapKey'])){throw new db[(_0x973e('0x95'))][(_0x973e('0x89'))](_0x973e('0x98')+_0xeb96e4);}if(!_[_0x973e('0x99')](_0xeb96e4,_0x5bb265['body'][_0x973e('0x9a')])){throw new db[(_0x973e('0x95'))][(_0x973e('0x89'))](_0x973e('0x9b')+_0xeb96e4);}_0x45336c[_0x5bb265[_0x973e('0x61')][_0x973e('0x9a')]]=_0x5bb265[_0x973e('0x61')][_0x973e('0x90')];return db[_0x973e('0x9c')][_0x973e('0x5f')]({'where':{'id':_0x5bb265['account'][_0x973e('0x8e')]},'include':[{'model':db[_0x973e('0x9d')],'as':'Contacts','where':_0x45336c,'limit':0x1,'order':[['updatedAt','DESC']]}]});})['then'](handleEntityNotFound(_0x281992,null))[_0x973e('0x25')](function(_0x1dd1cf){if(_0x1dd1cf){_0x5bb265[_0x973e('0x9e')]=_[_0x973e('0x76')](_0x1dd1cf,['Contacts']);if(_0x1dd1cf['Contacts'][_0x973e('0x4c')]){return _0x1dd1cf['Contacts'][0x0];}var _0x4e902e=_[_0x973e('0x1b')](_0x5bb265[_0x973e('0x61')],{'firstName':_0x5bb265[_0x973e('0x61')][_0x973e('0x90')],'ListId':_0x1dd1cf['id']});_0x4e902e[_0x5bb265['body'][_0x973e('0x9a')]]=_0x5bb265[_0x973e('0x61')][_0x973e('0x90')];return db[_0x973e('0x9d')][_0x973e('0x60')](_0x4e902e,{'fields':_0x50be5a,'raw':!![]});}})['then'](handleEntityNotFound(_0x281992,null))[_0x973e('0x25')](function(_0xf08fc4){if(_0xf08fc4){_0x5bb265['contact']=_0xf08fc4;var _0x1a6aff={'ContactId':_0xf08fc4['id'],'phone':_0x5bb265[_0x973e('0x61')][_0x973e('0x90')],'WhatsappAccountId':_0x55c8ee[_0x973e('0x59')]['id']};var _0x4ece70={'ContactId':_0xf08fc4['id'],'WhatsappAccountId':_0x55c8ee[_0x973e('0x59')]['id'],'closed':![]};return db[_0x973e('0x9f')]['find']({'where':_0x4ece70})[_0x973e('0x25')](function(_0x5bdef4){if(_0x5bdef4){return[_0x5bdef4,![]];}return db['WhatsappInteraction'][_0x973e('0x60')](_0x1a6aff)[_0x973e('0x25')](function(_0x5ebed1){return[_0x5ebed1,!![]];});});}})[_0x973e('0x77')](function(_0x1b891c,_0x47f740){_0x5bb265[_0x973e('0xa0')]=_0x1b891c[_0x973e('0x3b')]({'plain':!![]});_0x5bb265[_0x973e('0xa0')][_0x973e('0xa1')]=![];if(_0x47f740){if(_0x5bb265['account'][_0x973e('0xa2')]){_0x5bb265[_0x973e('0x85')]['push']({'id':0x0,'priority':_0x5bb265[_0x973e('0x85')][_0x973e('0x4c')]+0x1,'app':_0x973e('0xa3'),'appdata':_0x973e('0xa4'),'interval':_0x973e('0xa5')});}_0x5bb265[_0x973e('0xa0')][_0x973e('0xa1')]=!![];}return db[_0x973e('0xa6')]['create']({'phone':_0x5bb265[_0x973e('0x61')][_0x973e('0x90')],'messageId':_0x5bb265[_0x973e('0x61')]['messageId'],'body':_0x5bb265[_0x973e('0x61')]['body'],'WhatsappAccountId':_0x55c8ee[_0x973e('0x59')]['id'],'WhatsappInteractionId':_0x1b891c['id'],'direction':'in','ContactId':_0x1b891c[_0x973e('0xa7')],'AttachmentId':_0x5bb265[_0x973e('0x61')][_0x973e('0xa8')]});})[_0x973e('0x25')](function(_0x13ecaf){_0x5bb265['message']=_0x13ecaf;if(_0x5bb265['interaction'][_0x973e('0xa9')]){return db[_0x973e('0xaa')][_0x973e('0x5f')]({'attributes':['id',_0x973e('0x3d')],'where':{'id':_0x5bb265['interaction'][_0x973e('0xa9')]}})[_0x973e('0x25')](function(_0x41b5f0){if(_0x41b5f0){_0x5bb265[_0x973e('0x85')][_0x973e('0xab')]({'id':0x0,'priority':0x0,'app':_0x973e('0xac'),'appdata':_0x41b5f0[_0x973e('0x3d')]+','+(_0x5bb265[_0x973e('0x84')][_0x973e('0xad')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x973e('0xae'),_0x5bb265);});}return respondWithRpcPromise(_0x973e('0xaf'),_0x973e('0xae'),_0x5bb265);})[_0x973e('0x25')](function(_0x2696f7){if(_0x2696f7){var _0x399594=0xc8;var _0x39ff02=_0x973e('0xb0');logger[_0x973e('0x2e')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x39ff02,_0x399594,_0x973e('0xb1'));logger[_0x973e('0x28')](_0x973e('0xb2'),_0x39ff02,_0x399594,'entity\x20found',JSON[_0x973e('0x2a')](_0x2696f7));if(_0x5bb265[_0x973e('0x84')][_0x973e('0x43')]==='twilio'){return _0x281992[_0x973e('0x31')](_0x399594)['set'](_0x973e('0xb3'),_0x973e('0xb4'))['send'](_0x973e('0xb5'));}else{return _0x281992[_0x973e('0x31')](_0x399594)[_0x973e('0xb6')](_0x2696f7);}}})[_0x973e('0x2f')](handleError(_0x281992,null));};exports[_0x973e('0x3e')]=function(_0x27c2ee,_0xc94d58,_0x3eeee0){var _0x14858c,_0x2a104b,_0x1b7fc7;if(_[_0x973e('0x94')](_0x27c2ee['body']['body'])||_0x27c2ee[_0x973e('0x61')][_0x973e('0x61')]===''){throw new db[(_0x973e('0x95'))][(_0x973e('0x89'))](_0x973e('0x97'));}if(_[_0x973e('0x94')](_0x27c2ee[_0x973e('0x61')]['to'])){throw new db[(_0x973e('0x95'))][(_0x973e('0x89'))](_0x973e('0xb7'));}_0x14858c=_0x27c2ee[_0x973e('0x61')]['to'];return db['WhatsappAccount'][_0x973e('0x5f')]({'where':{'id':_0x27c2ee[_0x973e('0x59')]['id']},'include':[{'model':db[_0x973e('0x9c')],'as':'List','include':[{'model':db[_0x973e('0x9d')],'as':_0x973e('0xb8'),'where':{'mobile':_0x14858c},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x973e('0x25')](handleEntityNotFound(_0xc94d58,null))[_0x973e('0x25')](function(_0x35702b){if(_0x35702b&&_0x35702b[_0x973e('0xb9')]){_0x2a104b=_0x35702b[_0x973e('0x3b')]({'plain':!![]});if(_0x2a104b[_0x973e('0xb9')]&&_0x2a104b[_0x973e('0xb9')][_0x973e('0xb8')][_0x973e('0x4c')]){return _0x2a104b['List'][_0x973e('0xb8')][0x0];}return db[_0x973e('0x9d')][_0x973e('0x60')](_['defaults'](_0x27c2ee[_0x973e('0x61')],{'firstName':_0x14858c,'mobile':_0x14858c,'phone':_0x14858c,'ListId':_0x2a104b[_0x973e('0x8e')]}));}})[_0x973e('0x25')](handleEntityNotFound(_0xc94d58,null))[_0x973e('0x25')](function(_0x3a4bf2){if(_0x3a4bf2){_0x1b7fc7=_0x3a4bf2;return db[_0x973e('0x9f')][_0x973e('0x5f')]({'where':{'ContactId':_0x1b7fc7['id'],'closed':![],'WhatsappAccountId':_0x2a104b['id']}})[_0x973e('0x25')](function(_0x54a784){if(_0x54a784){return[_0x54a784,![]];}return db[_0x973e('0x9f')]['create']({'UserId':_0x27c2ee[_0x973e('0x62')]['id'],'ContactId':_0x1b7fc7['id'],'WhatsappAccountId':_0x2a104b['id'],'phone':_0x14858c,'firstMsgDirection':'out','Messages':[_[_0x973e('0x5d')](_0x27c2ee[_0x973e('0x61')],{'read':![],'body':_0x27c2ee['body']['body'],'phone':_0x14858c,'WhatsappAccountId':_0x2a104b['id'],'UserId':_0x27c2ee[_0x973e('0x62')]['id'],'ContactId':_0x1b7fc7['id']})]},{'include':[{'model':db[_0x973e('0xa6')],'as':'Messages'}]})['then'](function(_0x4e40db){return[_0x4e40db,!![]];});});}})['spread'](function(_0x2f7358,_0x5012ea){if(_0x5012ea){return _0x2f7358;}return db[_0x973e('0xa6')][_0x973e('0x60')](_[_0x973e('0x5d')](_0x27c2ee[_0x973e('0x61')],{'read':![],'body':_0x27c2ee[_0x973e('0x61')][_0x973e('0x61')],'phone':_0x14858c,'WhatsappAccountId':_0x2a104b['id'],'WhatsappInteractionId':_0x2f7358['id'],'UserId':_0x27c2ee[_0x973e('0x62')]['id'],'ContactId':_0x1b7fc7['id']}))['then'](function(_0x569ef5){_0x2f7358[_0x973e('0xba')][_0x973e('0xbb')]=[];_0x2f7358[_0x973e('0xba')][_0x973e('0xbb')]['push'](_0x569ef5['dataValues']);return _0x2f7358;});})['then'](respondWithResult(_0xc94d58,null))[_0x973e('0x2f')](handleError(_0xc94d58,null));}; \ No newline at end of file +var _0x4af5=['addDisposition','WhatsappAccountId','Disposition','findOne','options','includeAll','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','orderBy','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','replace','whatsapp:','Body','MessageSid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','Contacts','list','WhatsappInteraction','spread','interaction','created','applications','push','close','unmanaged','*,*,*,*','WhatsappMessage','messageId','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','set','Content-Type','text/xml','\x0a','json','to\x20is\x20mandatory','CmList','List','DESC','out','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','jayson/promise','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','count','offset','Content-Range','apply','reject','then','get','WhatsappAccounts','destroy','end','stack','name','send','index','Pause','WhatsappAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','map','VIRTUAL','include','findAll','catch','show','params','mandatoryDispositionPause','rawAttributes','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe'];(function(_0x4de752,_0x48e4dc){var _0x56792d=function(_0x379a09){while(--_0x379a09){_0x4de752['push'](_0x4de752['shift']());}};_0x56792d(++_0x48e4dc);}(_0x4af5,0x1c3));var _0x54af=function(_0x55b6ba,_0x305cd6){_0x55b6ba=_0x55b6ba-0x0;var _0x494dfd=_0x4af5[_0x55b6ba];return _0x494dfd;};'use strict';var pdf=require(_0x54af('0x0'));var emlformat=require(_0x54af('0x1'));var rimraf=require(_0x54af('0x2'));var zipdir=require(_0x54af('0x3'));var jsonpatch=require(_0x54af('0x4'));var rp=require(_0x54af('0x5'));var moment=require('moment');var BPromise=require(_0x54af('0x6'));var Mustache=require(_0x54af('0x7'));var util=require('util');var path=require('path');var sox=require(_0x54af('0x8'));var csv=require(_0x54af('0x9'));var ejs=require(_0x54af('0xa'));var fs=require('fs');var _=require(_0x54af('0xb'));var squel=require('squel');var crypto=require(_0x54af('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x54af('0xd'));var Redis=require(_0x54af('0xe'));var authService=require(_0x54af('0xf'));var qs=require(_0x54af('0x10'));var as=require(_0x54af('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x54af('0x12'))(_0x54af('0x13'));var utils=require('../../config/utils');var config=require(_0x54af('0x14'));var licenseUtil=require(_0x54af('0x15'));var db=require(_0x54af('0x16'))['db'];config['redis']=_[_0x54af('0x17')](config[_0x54af('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x54af('0x18')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x54af('0x19'));var client=jayson['client'][_0x54af('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x2d05c3,_0x3ffc0a,_0x284f5b,_0x521b12){return new BPromise(function(_0x54576b,_0x549547){var _0x318a2a=_0x521b12||client;return _0x318a2a[_0x54af('0x1b')](_0x2d05c3,_0x284f5b)['then'](function(_0x2ab56e){logger[_0x54af('0x1c')](_0x54af('0x1d'),_0x3ffc0a,_0x54af('0x1e'));logger[_0x54af('0x1f')](_0x54af('0x20'),_0x3ffc0a,_0x54af('0x1e'),JSON['stringify'](_0x2ab56e));if(_0x2ab56e[_0x54af('0x21')]){if(_0x2ab56e[_0x54af('0x21')]['code']===0x1f4){logger[_0x54af('0x21')](_0x54af('0x1d'),_0x3ffc0a,_0x2ab56e[_0x54af('0x21')][_0x54af('0x22')]);return _0x549547(_0x2ab56e[_0x54af('0x21')][_0x54af('0x22')]);}logger[_0x54af('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x3ffc0a,_0x2ab56e[_0x54af('0x21')]['message']);return _0x54576b(_0x2ab56e[_0x54af('0x21')][_0x54af('0x22')]);}else{logger[_0x54af('0x1c')](_0x54af('0x1d'),_0x3ffc0a,_0x54af('0x1e'));_0x54576b(_0x2ab56e[_0x54af('0x23')][_0x54af('0x22')]);}})['catch'](function(_0x812aa){logger[_0x54af('0x21')](_0x54af('0x1d'),_0x3ffc0a,_0x812aa);_0x549547(_0x812aa);});});}function respondWithStatusCode(_0x32011b,_0x3d2a80){_0x3d2a80=_0x3d2a80||0xcc;return function(_0x1419e2){if(_0x1419e2){return _0x32011b[_0x54af('0x24')](_0x3d2a80);}return _0x32011b[_0x54af('0x25')](_0x3d2a80)['end']();};}function respondWithResult(_0xb92f39,_0x5425df){_0x5425df=_0x5425df||0xc8;return function(_0x2f5448){if(_0x2f5448){return _0xb92f39[_0x54af('0x25')](_0x5425df)['json'](_0x2f5448);}};}function respondWithFilteredResult(_0x342a23,_0x5b8fb8){return function(_0xf9b19c){if(_0xf9b19c){var _0x316966=_0xf9b19c[_0x54af('0x26')],_0x4901c7=_0x5b8fb8[_0x54af('0x27')],_0x56b09d=_0x5b8fb8[_0x54af('0x27')]+_0x5b8fb8['limit'],_0x3ae54f;if(_0x56b09d>=_0x316966){_0x56b09d=_0x316966;_0x3ae54f=0xc8;}else{_0x3ae54f=0xce;}_0x342a23[_0x54af('0x25')](_0x3ae54f);return _0x342a23['set'](_0x54af('0x28'),_0x4901c7+'-'+_0x56b09d+'/'+_0x316966)['json'](_0xf9b19c);}return null;};}function patchUpdates(_0x229079){return function(_0x1bce33){try{jsonpatch[_0x54af('0x29')](_0x1bce33,_0x229079,!![]);}catch(_0x3d3748){return BPromise[_0x54af('0x2a')](_0x3d3748);}return _0x1bce33['save']();};}function saveUpdates(_0x39def0,_0xdfc564){return function(_0x1dd43f){if(_0x1dd43f){return _0x1dd43f['update'](_0x39def0)['then'](function(_0x574622){return _0x574622;});}return null;};}function removeEntity(_0x53ea70,_0x4beabc){return function(_0x371320){if(_0x371320){return _0x371320['destroy']()[_0x54af('0x2b')](function(){var _0x59ab08=_0x371320[_0x54af('0x2c')]({'plain':!![]});var _0x5f01b5=_0x54af('0x2d');return db['UserProfileResource'][_0x54af('0x2e')]({'where':{'type':_0x5f01b5,'resourceId':_0x59ab08['id']}})[_0x54af('0x2b')](function(){return _0x371320;});})[_0x54af('0x2b')](function(){_0x53ea70[_0x54af('0x25')](0xcc)[_0x54af('0x2f')]();});}};}function handleEntityNotFound(_0x167a2e,_0x4aa688){return function(_0x432368){if(!_0x432368){_0x167a2e[_0x54af('0x24')](0x194);}return _0x432368;};}function handleError(_0x58000b,_0x26699d){_0x26699d=_0x26699d||0x1f4;return function(_0x20e9fc){logger['error'](_0x20e9fc[_0x54af('0x30')]);if(_0x20e9fc[_0x54af('0x31')]){delete _0x20e9fc[_0x54af('0x31')];}_0x58000b[_0x54af('0x25')](_0x26699d)[_0x54af('0x32')](_0x20e9fc);};}exports[_0x54af('0x33')]=function(_0x2df123,_0x597dab){var _0x7febac={'include':[{'model':db[_0x54af('0x34')],'as':'mandatoryDispositionPause'}]},_0x425cb2={},_0x12d892={'count':0x0,'rows':[]};var _0x150fc3=_['map'](db[_0x54af('0x35')]['rawAttributes'],function(_0xd8f10f){return{'name':_0xd8f10f[_0x54af('0x36')],'type':_0xd8f10f[_0x54af('0x37')][_0x54af('0x38')]};});_0x425cb2[_0x54af('0x39')]=_['map'](_0x150fc3,_0x54af('0x31'));_0x425cb2[_0x54af('0x3a')]=_[_0x54af('0x3b')](_0x2df123[_0x54af('0x3a')]);_0x425cb2[_0x54af('0x3c')]=_['intersection'](_0x425cb2['model'],_0x425cb2[_0x54af('0x3a')]);_0x7febac[_0x54af('0x3d')]=_[_0x54af('0x3e')](_0x425cb2['model'],qs['fields'](_0x2df123[_0x54af('0x3a')][_0x54af('0x3f')]));_0x7febac[_0x54af('0x3d')]=_0x7febac[_0x54af('0x3d')]['length']?_0x7febac[_0x54af('0x3d')]:_0x425cb2[_0x54af('0x39')];if(!_0x2df123[_0x54af('0x3a')][_0x54af('0x40')](_0x54af('0x41'))){_0x7febac[_0x54af('0x42')]=qs[_0x54af('0x42')](_0x2df123[_0x54af('0x3a')][_0x54af('0x42')]);_0x7febac[_0x54af('0x27')]=qs[_0x54af('0x27')](_0x2df123['query'][_0x54af('0x27')]);}_0x7febac[_0x54af('0x43')]=qs[_0x54af('0x44')](_0x2df123[_0x54af('0x3a')][_0x54af('0x44')]);_0x7febac['where']=qs[_0x54af('0x3c')](_[_0x54af('0x45')](_0x2df123[_0x54af('0x3a')],_0x425cb2[_0x54af('0x3c')]),_0x150fc3);if(_0x2df123[_0x54af('0x3a')][_0x54af('0x46')]){_0x7febac[_0x54af('0x47')]=_[_0x54af('0x48')](_0x7febac[_0x54af('0x47')],{'$or':_[_0x54af('0x49')](_0x150fc3,function(_0x4e78c0){if(_0x4e78c0[_0x54af('0x37')]!==_0x54af('0x4a')){var _0x2a19f8={};_0x2a19f8[_0x4e78c0['name']]={'$like':'%'+_0x2df123['query'][_0x54af('0x46')]+'%'};return _0x2a19f8;}})});}_0x7febac=_[_0x54af('0x48')]({},_0x7febac,_0x2df123['options']);var _0x565047={'where':_0x7febac[_0x54af('0x47')]};return db['WhatsappAccount'][_0x54af('0x26')](_0x565047)[_0x54af('0x2b')](function(_0x4b35c0){_0x12d892['count']=_0x4b35c0;if(_0x2df123['query']['includeAll']){_0x7febac[_0x54af('0x4b')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x54af('0x4c')](_0x7febac);})[_0x54af('0x2b')](function(_0x5c5399){_0x12d892['rows']=_0x5c5399;return _0x12d892;})[_0x54af('0x2b')](respondWithFilteredResult(_0x597dab,_0x7febac))[_0x54af('0x4d')](handleError(_0x597dab,null));};exports[_0x54af('0x4e')]=function(_0x4db0dd,_0x227092){var _0x1a5799={'raw':![],'where':{'id':_0x4db0dd[_0x54af('0x4f')]['id']},'include':[{'model':db[_0x54af('0x34')],'as':_0x54af('0x50')}]},_0x51cdfb={};_0x51cdfb[_0x54af('0x39')]=_[_0x54af('0x3b')](db[_0x54af('0x35')][_0x54af('0x51')]);_0x51cdfb[_0x54af('0x3a')]=_['keys'](_0x4db0dd['query']);_0x51cdfb['filters']=_[_0x54af('0x3e')](_0x51cdfb[_0x54af('0x39')],_0x51cdfb[_0x54af('0x3a')]);_0x1a5799['attributes']=_[_0x54af('0x3e')](_0x51cdfb[_0x54af('0x39')],qs[_0x54af('0x3f')](_0x4db0dd[_0x54af('0x3a')][_0x54af('0x3f')]));_0x1a5799[_0x54af('0x3d')]=_0x1a5799[_0x54af('0x3d')][_0x54af('0x52')]?_0x1a5799[_0x54af('0x3d')]:_0x51cdfb[_0x54af('0x39')];if(_0x4db0dd[_0x54af('0x3a')]['includeAll']){_0x1a5799[_0x54af('0x4b')]=[{'all':!![]}];}_0x1a5799=_[_0x54af('0x48')]({},_0x1a5799,_0x4db0dd['options']);return db[_0x54af('0x35')][_0x54af('0x53')](_0x1a5799)[_0x54af('0x2b')](handleEntityNotFound(_0x227092,null))['then'](respondWithResult(_0x227092,null))['catch'](handleError(_0x227092,null));};exports[_0x54af('0x54')]=function(_0x50c416,_0x737850){return db['WhatsappAccount'][_0x54af('0x54')](_0x50c416[_0x54af('0x55')],{})[_0x54af('0x2b')](function(_0x4abee5){var _0x4484bd=_0x50c416['user'][_0x54af('0x2c')]({'plain':!![]});if(!_0x4484bd)throw new Error(_0x54af('0x56'));if(_0x4484bd[_0x54af('0x57')]===_0x54af('0x58')){var _0x4ffebd=_0x4abee5['get']({'plain':!![]});var _0x582a21=_0x54af('0x2d');return db[_0x54af('0x59')][_0x54af('0x53')]({'where':{'name':_0x582a21,'userProfileId':_0x4484bd[_0x54af('0x5a')]},'raw':!![]})[_0x54af('0x2b')](function(_0x5034a7){if(_0x5034a7&&_0x5034a7['autoAssociation']===0x0){return db[_0x54af('0x5b')]['create']({'name':_0x4ffebd['name'],'resourceId':_0x4ffebd['id'],'type':_0x5034a7[_0x54af('0x31')],'sectionId':_0x5034a7['id']},{})[_0x54af('0x2b')](function(){return _0x4abee5;});}else{return _0x4abee5;}})[_0x54af('0x4d')](function(_0x4ca2d2){logger[_0x54af('0x21')](_0x54af('0x5c'),_0x4ca2d2);throw _0x4ca2d2;});}return _0x4abee5;})[_0x54af('0x2b')](respondWithResult(_0x737850,0xc9))[_0x54af('0x4d')](handleError(_0x737850,null));};exports[_0x54af('0x5d')]=function(_0x373120,_0x168306){if(_0x373120[_0x54af('0x55')]['id']){delete _0x373120[_0x54af('0x55')]['id'];}return db[_0x54af('0x35')][_0x54af('0x53')]({'where':{'id':_0x373120['params']['id']},'include':[{'model':db[_0x54af('0x34')],'as':_0x54af('0x50')}]})[_0x54af('0x2b')](handleEntityNotFound(_0x168306,null))[_0x54af('0x2b')](saveUpdates(_0x373120['body'],null))[_0x54af('0x2b')](respondWithResult(_0x168306,null))['catch'](handleError(_0x168306,null));};exports[_0x54af('0x2e')]=function(_0x20f723,_0x40fff1){return db[_0x54af('0x35')][_0x54af('0x53')]({'where':{'id':_0x20f723['params']['id']}})['then'](handleEntityNotFound(_0x40fff1,null))['then'](removeEntity(_0x40fff1,null))['catch'](handleError(_0x40fff1,null));};exports['describe']=function(_0x596124,_0x595423){return db[_0x54af('0x35')][_0x54af('0x5e')]()[_0x54af('0x2b')](respondWithResult(_0x595423,null))[_0x54af('0x4d')](handleError(_0x595423,null));};exports[_0x54af('0x5f')]=function(_0x557292,_0x3a5c74,_0xf441b5){if(_0x557292[_0x54af('0x55')]['id']){delete _0x557292['body']['id'];}return db['WhatsappAccount'][_0x54af('0x53')]({'where':{'id':_0x557292['params']['id']}})[_0x54af('0x2b')](handleEntityNotFound(_0x3a5c74,null))[_0x54af('0x2b')](function(_0xd559b4){if(_0xd559b4){_0x557292[_0x54af('0x55')][_0x54af('0x60')]=_0xd559b4['id'];return db[_0x54af('0x61')][_0x54af('0x54')](_0x557292[_0x54af('0x55')]);}})[_0x54af('0x2b')](respondWithResult(_0x3a5c74,null))[_0x54af('0x4d')](handleError(_0x3a5c74,null));};exports['getDispositions']=function(_0x1343bb,_0x32719a,_0x7bb997){var _0x40b09a={'raw':![],'where':{}};var _0x2a9119={};var _0x48281b={'count':0x0,'rows':[]};return db[_0x54af('0x35')][_0x54af('0x62')]({'where':{'id':_0x1343bb[_0x54af('0x4f')]['id']}})[_0x54af('0x2b')](handleEntityNotFound(_0x32719a,null))[_0x54af('0x2b')](function(_0x350df3){if(_0x350df3){_0x2a9119['model']=_[_0x54af('0x3b')](db[_0x54af('0x61')][_0x54af('0x51')]);_0x2a9119['query']=_[_0x54af('0x3b')](_0x1343bb[_0x54af('0x3a')]);_0x2a9119[_0x54af('0x3c')]=_[_0x54af('0x3e')](_0x2a9119['model'],_0x2a9119[_0x54af('0x3a')]);_0x40b09a[_0x54af('0x3d')]=_[_0x54af('0x3e')](_0x2a9119[_0x54af('0x39')],qs[_0x54af('0x3f')](_0x1343bb[_0x54af('0x3a')][_0x54af('0x3f')]));_0x40b09a[_0x54af('0x3d')]=_0x40b09a[_0x54af('0x3d')][_0x54af('0x52')]?_0x40b09a[_0x54af('0x3d')]:_0x2a9119['model'];if(!_0x1343bb[_0x54af('0x3a')]['hasOwnProperty'](_0x54af('0x41'))){_0x40b09a[_0x54af('0x42')]=qs[_0x54af('0x42')](_0x1343bb[_0x54af('0x3a')][_0x54af('0x42')]);_0x40b09a[_0x54af('0x27')]=qs[_0x54af('0x27')](_0x1343bb[_0x54af('0x3a')]['offset']);}_0x40b09a['order']=qs[_0x54af('0x44')](_0x1343bb[_0x54af('0x3a')][_0x54af('0x44')]);_0x40b09a[_0x54af('0x47')]=qs[_0x54af('0x3c')](_[_0x54af('0x45')](_0x1343bb['query'],_0x2a9119[_0x54af('0x3c')]));_0x40b09a[_0x54af('0x47')][_0x54af('0x60')]=_0x350df3['id'];if(_0x1343bb[_0x54af('0x3a')][_0x54af('0x46')]){_0x40b09a[_0x54af('0x47')]=_[_0x54af('0x48')](_0x40b09a[_0x54af('0x47')],{'$or':_['map'](_0x40b09a[_0x54af('0x3d')],function(_0x592d22){var _0x3c2a12={};_0x3c2a12[_0x592d22]={'$like':'%'+_0x1343bb[_0x54af('0x3a')][_0x54af('0x46')]+'%'};return _0x3c2a12;})});}_0x40b09a=_[_0x54af('0x48')]({},_0x40b09a,_0x1343bb[_0x54af('0x63')]);return db[_0x54af('0x61')]['count']({'where':_0x40b09a['where']})[_0x54af('0x2b')](function(_0x50236a){_0x48281b[_0x54af('0x26')]=_0x50236a;if(_0x1343bb[_0x54af('0x3a')][_0x54af('0x64')]){_0x40b09a[_0x54af('0x4b')]=[{'all':!![]}];}return db[_0x54af('0x61')][_0x54af('0x4c')](_0x40b09a);})[_0x54af('0x2b')](function(_0x11bd45){_0x48281b[_0x54af('0x65')]=_0x11bd45;return _0x48281b;});}})[_0x54af('0x2b')](respondWithFilteredResult(_0x32719a,_0x40b09a))['catch'](handleError(_0x32719a,null));};exports['removeDispositions']=function(_0x59329e,_0x460976,_0x3b03e0){return db['WhatsappAccount']['find']({'where':{'id':_0x59329e['params']['id']}})[_0x54af('0x2b')](handleEntityNotFound(_0x460976,null))[_0x54af('0x2b')](function(_0x3db747){if(_0x3db747){return _0x3db747[_0x54af('0x66')](_0x59329e['query'][_0x54af('0x67')]);}})[_0x54af('0x2b')](respondWithStatusCode(_0x460976,null))[_0x54af('0x4d')](handleError(_0x460976,null));};exports['addAnswer']=function(_0x144c71,_0x20aac0,_0x53ec5a){if(_0x144c71['body']['id']){delete _0x144c71[_0x54af('0x55')]['id'];}return db[_0x54af('0x35')]['find']({'where':{'id':_0x144c71[_0x54af('0x4f')]['id']}})['then'](handleEntityNotFound(_0x20aac0,null))[_0x54af('0x2b')](function(_0x483073){if(_0x483073){_0x144c71[_0x54af('0x55')]['WhatsappAccountId']=_0x483073['id'];return db[_0x54af('0x68')][_0x54af('0x54')](_0x144c71[_0x54af('0x55')]);}})[_0x54af('0x2b')](respondWithResult(_0x20aac0,null))[_0x54af('0x4d')](handleError(_0x20aac0,null));};exports[_0x54af('0x69')]=function(_0x3b1de1,_0x16a383,_0x19fd58){var _0xda72f0={'raw':![],'where':{}};var _0x1a37da={};var _0x29584d={'count':0x0,'rows':[]};return db[_0x54af('0x35')][_0x54af('0x62')]({'where':{'id':_0x3b1de1[_0x54af('0x4f')]['id']}})[_0x54af('0x2b')](handleEntityNotFound(_0x16a383,null))[_0x54af('0x2b')](function(_0x27b1cb){if(_0x27b1cb){_0x1a37da[_0x54af('0x39')]=_[_0x54af('0x3b')](db[_0x54af('0x68')][_0x54af('0x51')]);_0x1a37da['query']=_[_0x54af('0x3b')](_0x3b1de1[_0x54af('0x3a')]);_0x1a37da[_0x54af('0x3c')]=_[_0x54af('0x3e')](_0x1a37da['model'],_0x1a37da[_0x54af('0x3a')]);_0xda72f0[_0x54af('0x3d')]=_[_0x54af('0x3e')](_0x1a37da['model'],qs[_0x54af('0x3f')](_0x3b1de1[_0x54af('0x3a')]['fields']));_0xda72f0[_0x54af('0x3d')]=_0xda72f0[_0x54af('0x3d')][_0x54af('0x52')]?_0xda72f0['attributes']:_0x1a37da[_0x54af('0x39')];if(!_0x3b1de1[_0x54af('0x3a')][_0x54af('0x40')](_0x54af('0x41'))){_0xda72f0['limit']=qs[_0x54af('0x42')](_0x3b1de1[_0x54af('0x3a')][_0x54af('0x42')]);_0xda72f0[_0x54af('0x27')]=qs[_0x54af('0x27')](_0x3b1de1[_0x54af('0x3a')][_0x54af('0x27')]);}_0xda72f0[_0x54af('0x43')]=qs[_0x54af('0x44')](_0x3b1de1[_0x54af('0x3a')]['sort']);_0xda72f0[_0x54af('0x47')]=qs[_0x54af('0x3c')](_['pick'](_0x3b1de1['query'],_0x1a37da[_0x54af('0x3c')]));_0xda72f0['where']['WhatsappAccountId']=_0x27b1cb['id'];if(_0x3b1de1[_0x54af('0x3a')]['filter']){_0xda72f0['where']=_['merge'](_0xda72f0['where'],{'$or':_['map'](_0xda72f0[_0x54af('0x3d')],function(_0x3676cc){var _0x36bc01={};_0x36bc01[_0x3676cc]={'$like':'%'+_0x3b1de1['query'][_0x54af('0x46')]+'%'};return _0x36bc01;})});}_0xda72f0=_[_0x54af('0x48')]({},_0xda72f0,_0x3b1de1[_0x54af('0x63')]);return db[_0x54af('0x68')][_0x54af('0x26')]({'where':_0xda72f0['where']})['then'](function(_0x6129e4){_0x29584d[_0x54af('0x26')]=_0x6129e4;if(_0x3b1de1[_0x54af('0x3a')][_0x54af('0x64')]){_0xda72f0[_0x54af('0x4b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x54af('0x4c')](_0xda72f0);})[_0x54af('0x2b')](function(_0x1771a0){_0x29584d[_0x54af('0x65')]=_0x1771a0;return _0x29584d;});}})[_0x54af('0x2b')](respondWithFilteredResult(_0x16a383,_0xda72f0))[_0x54af('0x4d')](handleError(_0x16a383,null));};exports[_0x54af('0x6a')]=function(_0x3f7b59,_0x52d786,_0x75999){return db[_0x54af('0x35')][_0x54af('0x53')]({'where':{'id':_0x3f7b59[_0x54af('0x4f')]['id']}})['then'](handleEntityNotFound(_0x52d786,null))[_0x54af('0x2b')](function(_0x3d4990){if(_0x3d4990){return _0x3d4990[_0x54af('0x6a')](_0x3f7b59[_0x54af('0x3a')]['ids']);}})[_0x54af('0x2b')](respondWithStatusCode(_0x52d786,null))[_0x54af('0x4d')](handleError(_0x52d786,null));};exports[_0x54af('0x6b')]=function(_0x542010,_0x42dc16,_0x120c1e){return db[_0x54af('0x35')]['find']({'where':{'id':_0x542010[_0x54af('0x4f')]['id']}})[_0x54af('0x2b')](handleEntityNotFound(_0x42dc16,null))[_0x54af('0x2b')](function(_0x3c2345){if(_0x3c2345){return _0x3c2345['addAgents'](_0x542010['body'][_0x54af('0x67')],_[_0x54af('0x6c')](_0x542010[_0x54af('0x55')],['ids','id'])||{})['spread'](function(_0x37ab4e){for(var _0x25ef55=0x0;_0x25ef55<_0x542010[_0x54af('0x55')][_0x54af('0x67')][_0x54af('0x52')];_0x25ef55+=0x1){socket[_0x54af('0x6d')](_0x54af('0x6e'),{'UserId':_0x542010[_0x54af('0x55')][_0x54af('0x67')][_0x25ef55],'WhatsappAccountId':_0x542010[_0x54af('0x4f')]['id']});}return _0x37ab4e;});}})['then'](respondWithResult(_0x42dc16,null))[_0x54af('0x4d')](handleError(_0x42dc16,null));};exports[_0x54af('0x6f')]=function(_0x5d8db4,_0x483b9b,_0x216d2d){return db[_0x54af('0x35')]['find']({'where':{'id':_0x5d8db4[_0x54af('0x4f')]['id']}})[_0x54af('0x2b')](handleEntityNotFound(_0x483b9b,null))[_0x54af('0x2b')](function(_0x55f146){if(_0x55f146){return _0x55f146[_0x54af('0x6f')](_0x5d8db4[_0x54af('0x3a')][_0x54af('0x67')])[_0x54af('0x2b')](function(){if(_[_0x54af('0x70')](_0x5d8db4[_0x54af('0x3a')]['ids'])){for(var _0x41876e=0x0;_0x41876e<_0x5d8db4[_0x54af('0x3a')][_0x54af('0x67')][_0x54af('0x52')];_0x41876e+=0x1){socket[_0x54af('0x6d')](_0x54af('0x71'),{'UserId':Number(_0x5d8db4[_0x54af('0x3a')][_0x54af('0x67')][_0x41876e]),'WhatsappAccountId':Number(_0x5d8db4[_0x54af('0x4f')]['id'])});}}else{socket[_0x54af('0x6d')](_0x54af('0x71'),{'UserId':Number(_0x5d8db4['query'][_0x54af('0x67')]),'WhatsappAccountId':Number(_0x5d8db4[_0x54af('0x4f')]['id'])});}});}})[_0x54af('0x2b')](respondWithStatusCode(_0x483b9b,null))['catch'](handleError(_0x483b9b,null));};exports['getAgents']=function(_0xc354bc,_0x82229e,_0x4f03f9){var _0x461074={};var _0x29354b={};var _0x45301a;var _0x24e052;return db[_0x54af('0x35')][_0x54af('0x62')]({'where':{'id':_0xc354bc[_0x54af('0x4f')]['id']}})['then'](handleEntityNotFound(_0x82229e,null))[_0x54af('0x2b')](function(_0x35ddad){if(_0x35ddad){_0x45301a=_0x35ddad;_0x29354b[_0x54af('0x39')]=_[_0x54af('0x3b')](db[_0x54af('0x72')][_0x54af('0x51')]);_0x29354b[_0x54af('0x3a')]=_[_0x54af('0x3b')](_0xc354bc[_0x54af('0x3a')]);_0x29354b[_0x54af('0x3c')]=_[_0x54af('0x3e')](_0x29354b[_0x54af('0x39')],_0x29354b['query']);_0x461074[_0x54af('0x3d')]=_[_0x54af('0x3e')](_0x29354b['model'],qs[_0x54af('0x3f')](_0xc354bc[_0x54af('0x3a')][_0x54af('0x3f')]));_0x461074[_0x54af('0x3d')]=_0x461074[_0x54af('0x3d')][_0x54af('0x52')]?_0x461074[_0x54af('0x3d')]:_0x29354b['model'];_0x461074[_0x54af('0x43')]=qs['sort'](_0xc354bc[_0x54af('0x3a')][_0x54af('0x44')]);_0x461074[_0x54af('0x47')]=qs[_0x54af('0x3c')](_[_0x54af('0x45')](_0xc354bc['query'],_0x29354b[_0x54af('0x3c')]));if(_0xc354bc[_0x54af('0x3a')]['filter']){_0x461074[_0x54af('0x47')]=_[_0x54af('0x48')](_0x461074[_0x54af('0x47')],{'$or':_[_0x54af('0x49')](_0x461074['attributes'],function(_0x5dc70a){var _0x3bd983={};_0x3bd983[_0x5dc70a]={'$like':'%'+_0xc354bc[_0x54af('0x3a')]['filter']+'%'};return _0x3bd983;})});}_0x461074=_[_0x54af('0x48')]({},_0x461074,_0xc354bc['options']);return _0x45301a[_0x54af('0x73')](_0x461074);}})[_0x54af('0x2b')](function(_0xcd01ec){if(_0xcd01ec){_0x24e052=_0xcd01ec[_0x54af('0x52')];if(!_0xc354bc['query']['hasOwnProperty'](_0x54af('0x41'))){_0x461074[_0x54af('0x42')]=qs[_0x54af('0x42')](_0xc354bc[_0x54af('0x3a')]['limit']);_0x461074[_0x54af('0x27')]=qs[_0x54af('0x27')](_0xc354bc['query']['offset']);}return _0x45301a[_0x54af('0x73')](_0x461074);}})[_0x54af('0x2b')](function(_0x31d4cf){if(_0x31d4cf){return _0x31d4cf?{'count':_0x24e052,'rows':_0x31d4cf}:null;}})[_0x54af('0x2b')](respondWithResult(_0x82229e,null))[_0x54af('0x4d')](handleError(_0x82229e,null));};exports['addApplications']=function(_0x1b5be5,_0x2f5d97,_0x13a72e){return db[_0x54af('0x35')][_0x54af('0x62')]({'where':{'id':_0x1b5be5[_0x54af('0x4f')]['id']}})[_0x54af('0x2b')](handleEntityNotFound(_0x2f5d97,null))['then'](function(_0x55a838){if(_0x55a838){return db['sequelize'][_0x54af('0x74')](function(_0x5d1634){return db[_0x54af('0x75')]['destroy']({'where':{'WhatsappAccountId':_0x1b5be5[_0x54af('0x4f')]['id']},'transaction':_0x5d1634})[_0x54af('0x2b')](function(_0x4af682){var _0x4823dc=_[_0x54af('0x49')](_0x1b5be5[_0x54af('0x55')],function(_0x504969){_0x504969[_0x54af('0x60')]=_0x1b5be5[_0x54af('0x4f')]['id'];return _0x504969;});return db[_0x54af('0x75')][_0x54af('0x76')](_0x4823dc,{'transaction':_0x5d1634});});})[_0x54af('0x2b')](function(){return db[_0x54af('0x75')][_0x54af('0x77')]({'where':{'WhatsappAccountId':_0x1b5be5[_0x54af('0x4f')]['id']},'order':_0x54af('0x78')});});}})[_0x54af('0x2b')](respondWithResult(_0x2f5d97,null))['catch'](handleError(_0x2f5d97,null));};exports[_0x54af('0x79')]=function(_0x3bd697,_0x2bfb18,_0x2ae497){var _0x31e35c={};var _0x424c09={};var _0x28c863;var _0x9ea083;return db[_0x54af('0x35')][_0x54af('0x62')]({'where':{'id':_0x3bd697[_0x54af('0x4f')]['id']}})[_0x54af('0x2b')](handleEntityNotFound(_0x2bfb18,null))['then'](function(_0x29ece5){if(_0x29ece5){_0x28c863=_0x29ece5;_0x424c09['model']=_[_0x54af('0x3b')](db[_0x54af('0x75')][_0x54af('0x51')]);_0x424c09[_0x54af('0x3a')]=_['keys'](_0x3bd697[_0x54af('0x3a')]);_0x424c09[_0x54af('0x3c')]=_['intersection'](_0x424c09[_0x54af('0x39')],_0x424c09[_0x54af('0x3a')]);_0x31e35c[_0x54af('0x3d')]=_['intersection'](_0x424c09[_0x54af('0x39')],qs[_0x54af('0x3f')](_0x3bd697[_0x54af('0x3a')][_0x54af('0x3f')]));_0x31e35c['attributes']=_0x31e35c[_0x54af('0x3d')]['length']?_0x31e35c['attributes']:_0x424c09['model'];_0x31e35c[_0x54af('0x43')]=qs[_0x54af('0x44')](_0x3bd697[_0x54af('0x3a')][_0x54af('0x44')]);_0x31e35c[_0x54af('0x47')]=qs[_0x54af('0x3c')](_['pick'](_0x3bd697['query'],_0x424c09[_0x54af('0x3c')]));if(_0x3bd697[_0x54af('0x3a')][_0x54af('0x46')]){_0x31e35c['where']=_['merge'](_0x31e35c[_0x54af('0x47')],{'$or':_[_0x54af('0x49')](_0x31e35c[_0x54af('0x3d')],function(_0x3f8a73){var _0x2c71e4={};_0x2c71e4[_0x3f8a73]={'$like':'%'+_0x3bd697[_0x54af('0x3a')][_0x54af('0x46')]+'%'};return _0x2c71e4;})});}_0x31e35c=_[_0x54af('0x48')]({},_0x31e35c,_0x3bd697['options']);return _0x28c863[_0x54af('0x79')](_0x31e35c);}})[_0x54af('0x2b')](function(_0x353a91){if(_0x353a91){_0x9ea083=_0x353a91[_0x54af('0x52')];if(!_0x3bd697['query'][_0x54af('0x40')](_0x54af('0x41'))){_0x31e35c['limit']=qs['limit'](_0x3bd697[_0x54af('0x3a')]['limit']);_0x31e35c[_0x54af('0x27')]=qs[_0x54af('0x27')](_0x3bd697[_0x54af('0x3a')][_0x54af('0x27')]);}return _0x28c863[_0x54af('0x79')](_0x31e35c);}})[_0x54af('0x2b')](function(_0xe88c51){if(_0xe88c51){return _0xe88c51?{'count':_0x9ea083,'rows':_0xe88c51}:null;}})['then'](respondWithResult(_0x2bfb18,null))[_0x54af('0x4d')](handleError(_0x2bfb18,null));};exports[_0x54af('0x7a')]=function(_0x470c4e,_0x120152,_0x22ace7){var _0x7b436f={'channel':_0x54af('0x7b')};var _0x283313=[];var _0x59f346=[];var _0x396d5c={};return db[_0x54af('0x35')][_0x54af('0x53')]({'where':{'id':_0x470c4e[_0x54af('0x4f')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x54af('0x7c')}]})[_0x54af('0x2b')](handleEntityNotFound(_0x120152,null))['then'](function(_0x2bfd96){_0x7b436f[_0x54af('0x7d')]=_0x2bfd96;_0x7b436f['applications']=_[_0x54af('0x7e')](_0x2bfd96[_0x54af('0x7c')],[_0x54af('0x78')],['asc']);if(_0x7b436f[_0x54af('0x7d')]['Applications']){delete _0x7b436f[_0x54af('0x7d')][_0x54af('0x7c')];}return db[_0x54af('0x7f')][_0x54af('0x5e')]();})[_0x54af('0x2b')](function(_0x382e5){if(!_0x382e5){throw new db[(_0x54af('0x80'))][(_0x54af('0x81'))](_0x54af('0x82'));}_0x283313=_[_0x54af('0x83')](_[_0x54af('0x3b')](_0x382e5),[_0x54af('0x84'),'updatedAt']);_0x59f346=_[_0x54af('0x83')](_[_0x54af('0x3b')](_0x382e5),[_0x54af('0x84'),_0x54af('0x85'),_0x54af('0x86'),_0x54af('0x87')]);_0x7b436f['body']={'mapKey':'mobile'};if(_0x7b436f[_0x54af('0x7d')][_0x54af('0x37')]&&_0x7b436f[_0x54af('0x7d')][_0x54af('0x37')]===_0x54af('0x88')){_0x7b436f[_0x54af('0x55')][_0x54af('0x89')]=_0x470c4e[_0x54af('0x55')][_0x54af('0x8a')][_0x54af('0x8b')](_0x54af('0x8c'),'');_0x7b436f[_0x54af('0x55')]['body']=_0x470c4e[_0x54af('0x55')][_0x54af('0x8d')];_0x7b436f['body']['messageId']=_0x470c4e[_0x54af('0x55')][_0x54af('0x8e')];}if(_0x7b436f[_0x54af('0x55')]['id']){delete _0x7b436f['body']['id'];}if(_[_0x54af('0x8f')](_0x7b436f[_0x54af('0x55')][_0x54af('0x89')])){throw new db[(_0x54af('0x80'))][(_0x54af('0x81'))]('from\x20is\x20mandatory');}if(_[_0x54af('0x8f')](_0x7b436f[_0x54af('0x55')][_0x54af('0x55')])||_0x7b436f[_0x54af('0x55')]['body']===''){throw new db['Sequelize']['ValidationError'](_0x54af('0x90'));}if(_[_0x54af('0x8f')](_0x7b436f[_0x54af('0x55')][_0x54af('0x91')])){throw new db[(_0x54af('0x80'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x59f346);}if(!_[_0x54af('0x92')](_0x59f346,_0x7b436f[_0x54af('0x55')][_0x54af('0x91')])){throw new db[(_0x54af('0x80'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x59f346);}_0x396d5c[_0x7b436f['body']['mapKey']]=_0x7b436f[_0x54af('0x55')]['from'];return db['CmList'][_0x54af('0x53')]({'where':{'id':_0x7b436f['account'][_0x54af('0x87')]},'include':[{'model':db[_0x54af('0x7f')],'as':_0x54af('0x93'),'where':_0x396d5c,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x54af('0x2b')](handleEntityNotFound(_0x120152,null))[_0x54af('0x2b')](function(_0x1edfb4){if(_0x1edfb4){_0x7b436f[_0x54af('0x94')]=_[_0x54af('0x6c')](_0x1edfb4,[_0x54af('0x93')]);if(_0x1edfb4[_0x54af('0x93')][_0x54af('0x52')]){return _0x1edfb4[_0x54af('0x93')][0x0];}var _0x267573=_[_0x54af('0x17')](_0x7b436f[_0x54af('0x55')],{'firstName':_0x7b436f[_0x54af('0x55')][_0x54af('0x89')],'ListId':_0x1edfb4['id']});_0x267573[_0x7b436f[_0x54af('0x55')][_0x54af('0x91')]]=_0x7b436f['body'][_0x54af('0x89')];return db[_0x54af('0x7f')][_0x54af('0x54')](_0x267573,{'fields':_0x283313,'raw':!![]});}})[_0x54af('0x2b')](handleEntityNotFound(_0x120152,null))[_0x54af('0x2b')](function(_0x381aa1){if(_0x381aa1){_0x7b436f['contact']=_0x381aa1;var _0x51248f={'ContactId':_0x381aa1['id'],'phone':_0x7b436f[_0x54af('0x55')][_0x54af('0x89')],'WhatsappAccountId':_0x470c4e['params']['id']};var _0x3dcad7={'ContactId':_0x381aa1['id'],'WhatsappAccountId':_0x470c4e[_0x54af('0x4f')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x54af('0x53')]({'where':_0x3dcad7})[_0x54af('0x2b')](function(_0x208894){if(_0x208894){return[_0x208894,![]];}return db[_0x54af('0x95')][_0x54af('0x54')](_0x51248f)[_0x54af('0x2b')](function(_0x181a7c){return[_0x181a7c,!![]];});});}})[_0x54af('0x96')](function(_0x15c9f5,_0xfc5b44){_0x7b436f[_0x54af('0x97')]=_0x15c9f5['get']({'plain':!![]});_0x7b436f['interaction'][_0x54af('0x98')]=![];if(_0xfc5b44){if(_0x7b436f[_0x54af('0x7d')]['autoclose']){_0x7b436f[_0x54af('0x99')][_0x54af('0x9a')]({'id':0x0,'priority':_0x7b436f['applications'][_0x54af('0x52')]+0x1,'app':_0x54af('0x9b'),'appdata':_0x54af('0x9c'),'interval':_0x54af('0x9d')});}_0x7b436f[_0x54af('0x97')][_0x54af('0x98')]=!![];}return db[_0x54af('0x9e')]['create']({'phone':_0x7b436f[_0x54af('0x55')][_0x54af('0x89')],'messageId':_0x7b436f[_0x54af('0x55')][_0x54af('0x9f')],'body':_0x7b436f[_0x54af('0x55')][_0x54af('0x55')],'WhatsappAccountId':_0x470c4e['params']['id'],'WhatsappInteractionId':_0x15c9f5['id'],'direction':'in','ContactId':_0x15c9f5[_0x54af('0xa0')],'AttachmentId':_0x7b436f[_0x54af('0x55')][_0x54af('0xa1')]});})['then'](function(_0x206dbb){_0x7b436f[_0x54af('0x22')]=_0x206dbb;if(_0x7b436f[_0x54af('0x97')][_0x54af('0xa2')]){return db['User'][_0x54af('0x53')]({'attributes':['id',_0x54af('0x31')],'where':{'id':_0x7b436f[_0x54af('0x97')][_0x54af('0xa2')]}})[_0x54af('0x2b')](function(_0x459919){if(_0x459919){_0x7b436f['applications'][_0x54af('0xa3')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x459919[_0x54af('0x31')]+','+(_0x7b436f[_0x54af('0x7d')][_0x54af('0xa4')]||0xa),'interval':_0x54af('0x9d')});}return respondWithRpcPromise(_0x54af('0xa5'),'startRouting',_0x7b436f);});}return respondWithRpcPromise('Start',_0x54af('0xa6'),_0x7b436f);})['then'](function(_0x181c79){if(_0x181c79){var _0xf4c1a2=0xc8;var _0x1fec5e=_0x54af('0xa7');logger['info'](_0x54af('0x20'),_0x1fec5e,_0xf4c1a2,_0x54af('0xa8'));logger[_0x54af('0x1f')](_0x54af('0xa9'),_0x1fec5e,_0xf4c1a2,_0x54af('0xa8'),JSON[_0x54af('0xaa')](_0x181c79));if(_0x7b436f['account'][_0x54af('0x37')]==='twilio'){return _0x120152['status'](_0xf4c1a2)[_0x54af('0xab')](_0x54af('0xac'),_0x54af('0xad'))[_0x54af('0x32')](_0x54af('0xae'));}else{return _0x120152['status'](_0xf4c1a2)[_0x54af('0xaf')](_0x181c79);}}})[_0x54af('0x4d')](handleError(_0x120152,null));};exports[_0x54af('0x32')]=function(_0x2e1ca6,_0x4756b8,_0x2afdb3){var _0xa34d39,_0x3a1636,_0x1c038c;if(_[_0x54af('0x8f')](_0x2e1ca6[_0x54af('0x55')][_0x54af('0x55')])||_0x2e1ca6['body']['body']===''){throw new db[(_0x54af('0x80'))][(_0x54af('0x81'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x54af('0x8f')](_0x2e1ca6[_0x54af('0x55')]['to'])){throw new db[(_0x54af('0x80'))]['ValidationError'](_0x54af('0xb0'));}_0xa34d39=_0x2e1ca6[_0x54af('0x55')]['to'];return db[_0x54af('0x35')][_0x54af('0x53')]({'where':{'id':_0x2e1ca6['params']['id']},'include':[{'model':db[_0x54af('0xb1')],'as':_0x54af('0xb2'),'include':[{'model':db['CmContact'],'as':_0x54af('0x93'),'where':{'mobile':_0xa34d39},'limit':0x1,'order':[[_0x54af('0x85'),_0x54af('0xb3')]]}]}]})[_0x54af('0x2b')](handleEntityNotFound(_0x4756b8,null))[_0x54af('0x2b')](function(_0xb4cad0){if(_0xb4cad0&&_0xb4cad0[_0x54af('0xb2')]){_0x3a1636=_0xb4cad0[_0x54af('0x2c')]({'plain':!![]});if(_0x3a1636[_0x54af('0xb2')]&&_0x3a1636[_0x54af('0xb2')][_0x54af('0x93')][_0x54af('0x52')]){return _0x3a1636[_0x54af('0xb2')][_0x54af('0x93')][0x0];}return db[_0x54af('0x7f')]['create'](_[_0x54af('0x17')](_0x2e1ca6[_0x54af('0x55')],{'firstName':_0xa34d39,'mobile':_0xa34d39,'phone':_0xa34d39,'ListId':_0x3a1636[_0x54af('0x87')]}));}})[_0x54af('0x2b')](handleEntityNotFound(_0x4756b8,null))['then'](function(_0x70a3bb){if(_0x70a3bb){_0x1c038c=_0x70a3bb;return db[_0x54af('0x95')][_0x54af('0x53')]({'where':{'ContactId':_0x1c038c['id'],'closed':![],'WhatsappAccountId':_0x3a1636['id']}})[_0x54af('0x2b')](function(_0x2cd03e){if(_0x2cd03e){return[_0x2cd03e,![]];}return db['WhatsappInteraction'][_0x54af('0x54')]({'UserId':_0x2e1ca6[_0x54af('0x58')]['id'],'ContactId':_0x1c038c['id'],'WhatsappAccountId':_0x3a1636['id'],'phone':_0xa34d39,'firstMsgDirection':_0x54af('0xb4'),'Messages':[_[_0x54af('0x48')](_0x2e1ca6[_0x54af('0x55')],{'read':![],'body':_0x2e1ca6[_0x54af('0x55')][_0x54af('0x55')],'phone':_0xa34d39,'WhatsappAccountId':_0x3a1636['id'],'UserId':_0x2e1ca6['user']['id'],'ContactId':_0x1c038c['id']})]},{'include':[{'model':db[_0x54af('0x9e')],'as':'Messages'}]})[_0x54af('0x2b')](function(_0x457c82){return[_0x457c82,!![]];});});}})[_0x54af('0x96')](function(_0x38ae3e,_0x128a1d){if(_0x128a1d){return _0x38ae3e;}return db[_0x54af('0x9e')][_0x54af('0x54')](_[_0x54af('0x48')](_0x2e1ca6[_0x54af('0x55')],{'read':![],'body':_0x2e1ca6[_0x54af('0x55')][_0x54af('0x55')],'phone':_0xa34d39,'WhatsappAccountId':_0x3a1636['id'],'WhatsappInteractionId':_0x38ae3e['id'],'UserId':_0x2e1ca6[_0x54af('0x58')]['id'],'ContactId':_0x1c038c['id']}))[_0x54af('0x2b')](function(_0x5d5028){_0x38ae3e['dataValues']['Messages']=[];_0x38ae3e['dataValues']['Messages']['push'](_0x5d5028[_0x54af('0xb5')]);return _0x38ae3e;});})[_0x54af('0x2b')](respondWithResult(_0x4756b8,null))[_0x54af('0x4d')](handleError(_0x4756b8,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 70aa84a..7013e45 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 _0x83d0=['emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update'];(function(_0x16d24f,_0x4686a5){var _0x3beec6=function(_0x552ae0){while(--_0x552ae0){_0x16d24f['push'](_0x16d24f['shift']());}};_0x3beec6(++_0x4686a5);}(_0x83d0,0xb7));var _0x083d=function(_0x3a4fa8,_0x2e03d8){_0x3a4fa8=_0x3a4fa8-0x0;var _0x4d78b4=_0x83d0[_0x3a4fa8];return _0x4d78b4;};'use strict';var EventEmitter=require(_0x083d('0x0'));var WhatsappAccount=require(_0x083d('0x1'))['db'][_0x083d('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x083d('0x3')](0x0);var events={'afterCreate':_0x083d('0x4'),'afterUpdate':_0x083d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1f31e){return function(_0x4ff4cb,_0x5625dc,_0x404d77){WhatsappAccountEvents[_0x083d('0x6')](_0x1f31e+':'+_0x4ff4cb['id'],_0x4ff4cb);WhatsappAccountEvents[_0x083d('0x6')](_0x1f31e,_0x4ff4cb);_0x404d77(null);};}for(var e in events){if(events[_0x083d('0x7')](e)){var event=events[e];WhatsappAccount[_0x083d('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x3f8a=['../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5a9597,_0x48e55b){var _0x5b1e40=function(_0x33a42c){while(--_0x33a42c){_0x5a9597['push'](_0x5a9597['shift']());}};_0x5b1e40(++_0x48e55b);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x309a5e,_0x1ec246){_0x309a5e=_0x309a5e-0x0;var _0x1d21f1=_0x3f8a[_0x309a5e];return _0x1d21f1;};'use strict';var EventEmitter=require(_0xa3f8('0x0'));var WhatsappAccount=require(_0xa3f8('0x1'))['db'][_0xa3f8('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xa3f8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa3f8('0x4'),'afterDestroy':_0xa3f8('0x5')};function emitEvent(_0x928738){return function(_0x15b6aa,_0x2553fd,_0x2847b4){WhatsappAccountEvents[_0xa3f8('0x6')](_0x928738+':'+_0x15b6aa['id'],_0x15b6aa);WhatsappAccountEvents[_0xa3f8('0x6')](_0x928738,_0x15b6aa);_0x2847b4(null);};}for(var e in events){if(events[_0xa3f8('0x7')](e)){var event=events[e];WhatsappAccount[_0xa3f8('0x8')](e,emitEvent(event));}}module[_0xa3f8('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index e10cedc..e98674a 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 _0x5e9e=['exports','define','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x271f14,_0x55d96a){var _0x3a2bb5=function(_0x126651){while(--_0x126651){_0x271f14['push'](_0x271f14['shift']());}};_0x3a2bb5(++_0x55d96a);}(_0x5e9e,0xf6));var _0xe5e9=function(_0x1c92d9,_0x3ae205){_0x1c92d9=_0x1c92d9-0x0;var _0x183705=_0x5e9e[_0x1c92d9];return _0x183705;};'use strict';var _=require(_0xe5e9('0x0'));var util=require('util');var logger=require(_0xe5e9('0x1'))(_0xe5e9('0x2'));var moment=require(_0xe5e9('0x3'));var BPromise=require(_0xe5e9('0x4'));var rp=require(_0xe5e9('0x5'));var fs=require('fs');var path=require(_0xe5e9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module[_0xe5e9('0x7')]=function(_0x40121e,_0x5d7f50){return _0x40121e[_0xe5e9('0x8')](_0xe5e9('0x9'),attributes,{'tableName':_0xe5e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9577=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api'];(function(_0x156b03,_0x238b09){var _0x302cc5=function(_0x5ef22e){while(--_0x5ef22e){_0x156b03['push'](_0x156b03['shift']());}};_0x302cc5(++_0x238b09);}(_0x9577,0x6c));var _0x7957=function(_0x3e0591,_0x2ad477){_0x3e0591=_0x3e0591-0x0;var _0x5712b3=_0x9577[_0x3e0591];return _0x5712b3;};'use strict';var _=require(_0x7957('0x0'));var util=require(_0x7957('0x1'));var logger=require(_0x7957('0x2'))(_0x7957('0x3'));var moment=require('moment');var BPromise=require(_0x7957('0x4'));var rp=require(_0x7957('0x5'));var fs=require('fs');var path=require(_0x7957('0x6'));var rimraf=require(_0x7957('0x7'));var config=require(_0x7957('0x8'));var attributes=require(_0x7957('0x9'));module[_0x7957('0xa')]=function(_0x11cfd7,_0x1dffda){return _0x11cfd7[_0x7957('0xb')](_0x7957('0xc'),attributes,{'tableName':_0x7957('0xd'),'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 d5d6f48..0a9cc58 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 _0xa203=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowWhatsappAccount','options','raw','attributes','include','model','map','lodash','util','moment'];(function(_0x1ba41f,_0x130b58){var _0xda37fb=function(_0x2e8ba6){while(--_0x2e8ba6){_0x1ba41f['push'](_0x1ba41f['shift']());}};_0xda37fb(++_0x130b58);}(_0xa203,0xdb));var _0x3a20=function(_0x478cf9,_0x3d99f2){_0x478cf9=_0x478cf9-0x0;var _0x34e354=_0xa203[_0x478cf9];return _0x34e354;};'use strict';var _=require(_0x3a20('0x0'));var util=require(_0x3a20('0x1'));var moment=require(_0x3a20('0x2'));var BPromise=require(_0x3a20('0x3'));var rs=require(_0x3a20('0x4'));var fs=require('fs');var Redis=require(_0x3a20('0x5'));var db=require(_0x3a20('0x6'))['db'];var utils=require(_0x3a20('0x7'));var logger=require('../../config/logger')(_0x3a20('0x8'));var config=require(_0x3a20('0x9'));var jayson=require(_0x3a20('0xa'));var client=jayson[_0x3a20('0xb')][_0x3a20('0xc')]({'port':0x232a});config[_0x3a20('0xd')]=_[_0x3a20('0xe')](config[_0x3a20('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x3a20('0xf'))(new Redis(config['redis']));require(_0x3a20('0x10'))[_0x3a20('0x11')](socket);function respondWithRpcPromise(_0x3db885,_0x919e21,_0x3072ad){return new BPromise(function(_0x182004,_0x25dfe4){return client[_0x3a20('0x12')](_0x3db885,_0x3072ad)[_0x3a20('0x13')](function(_0x441983){logger[_0x3a20('0x14')](_0x3a20('0x15'),_0x919e21,_0x3a20('0x16'));logger[_0x3a20('0x17')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x919e21,'request\x20sent',JSON[_0x3a20('0x18')](_0x441983));if(_0x441983[_0x3a20('0x19')]){if(_0x441983['error'][_0x3a20('0x1a')]===0x1f4){logger[_0x3a20('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x919e21,_0x441983['error'][_0x3a20('0x1b')]);return _0x25dfe4(_0x441983[_0x3a20('0x19')]['message']);}logger['error'](_0x3a20('0x15'),_0x919e21,_0x441983[_0x3a20('0x19')][_0x3a20('0x1b')]);return _0x182004(_0x441983['error']['message']);}else{logger[_0x3a20('0x14')](_0x3a20('0x15'),_0x919e21,'request\x20sent');_0x182004(_0x441983[_0x3a20('0x1c')]['message']);}})[_0x3a20('0x1d')](function(_0x2ab0c6){logger[_0x3a20('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x919e21,_0x2ab0c6);_0x25dfe4(_0x2ab0c6);});});}exports[_0x3a20('0x1e')]=function(_0x360bfa){var _0x5c9443=this;return new Promise(function(_0x52ed95,_0x2641c0){return db['WhatsappAccount']['find']({'raw':_0x360bfa[_0x3a20('0x1f')]?_0x360bfa[_0x3a20('0x1f')][_0x3a20('0x20')]===undefined?!![]:![]:!![],'where':_0x360bfa['options']?_0x360bfa[_0x3a20('0x1f')]['where']||null:null,'attributes':_0x360bfa[_0x3a20('0x1f')]?_0x360bfa[_0x3a20('0x1f')][_0x3a20('0x21')]||null:null,'include':_0x360bfa[_0x3a20('0x1f')]?_0x360bfa[_0x3a20('0x1f')]['include']?_['map'](_0x360bfa[_0x3a20('0x1f')][_0x3a20('0x22')],function(_0x20157a){return{'model':db[_0x20157a[_0x3a20('0x23')]],'as':_0x20157a['as'],'attributes':_0x20157a[_0x3a20('0x21')],'include':_0x20157a['include']?_['map'](_0x20157a['include'],function(_0x4891b1){return{'model':db[_0x4891b1[_0x3a20('0x23')]],'as':_0x4891b1['as'],'attributes':_0x4891b1[_0x3a20('0x21')],'include':_0x4891b1['include']?_[_0x3a20('0x24')](_0x4891b1[_0x3a20('0x22')],function(_0x5dc4bb){return{'model':db[_0x5dc4bb[_0x3a20('0x23')]],'as':_0x5dc4bb['as'],'attributes':_0x5dc4bb[_0x3a20('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3a20('0x13')](function(_0x148381){logger['info'](_0x3a20('0x1e'),_0x360bfa);logger[_0x3a20('0x17')](_0x3a20('0x1e'),_0x360bfa,JSON[_0x3a20('0x18')](_0x148381));_0x52ed95(_0x148381);})[_0x3a20('0x1d')](function(_0x32d726){logger[_0x3a20('0x19')](_0x3a20('0x1e'),_0x32d726['message'],_0x360bfa);_0x2641c0(_0x5c9443[_0x3a20('0x19')](0x1f4,_0x32d726[_0x3a20('0x1b')]));});});}; \ No newline at end of file +var _0x60a5=['../../config/environment','jayson/promise','client','localhost','socket.io-emitter','redis','./whatsappAccount.socket','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','model','map','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x60a5,0x83));var _0x560a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x60a5[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x560a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x560a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x560a('0x2'))['db'];var utils=require(_0x560a('0x3'));var logger=require(_0x560a('0x4'))('rpc');var config=require(_0x560a('0x5'));var jayson=require(_0x560a('0x6'));var client=jayson[_0x560a('0x7')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x560a('0x8'),'port':0x18eb});var socket=require(_0x560a('0x9'))(new Redis(config[_0x560a('0xa')]));require(_0x560a('0xb'))['register'](socket);function respondWithRpcPromise(_0x4c7a7a,_0x359da4,_0x5d95ee){return new BPromise(function(_0x2e3b88,_0x13c6a3){return client['request'](_0x4c7a7a,_0x5d95ee)[_0x560a('0xc')](function(_0x36e345){logger[_0x560a('0xd')](_0x560a('0xe'),_0x359da4,_0x560a('0xf'));logger[_0x560a('0x10')](_0x560a('0x11'),_0x359da4,_0x560a('0xf'),JSON[_0x560a('0x12')](_0x36e345));if(_0x36e345['error']){if(_0x36e345[_0x560a('0x13')][_0x560a('0x14')]===0x1f4){logger[_0x560a('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x359da4,_0x36e345[_0x560a('0x13')][_0x560a('0x15')]);return _0x13c6a3(_0x36e345[_0x560a('0x13')][_0x560a('0x15')]);}logger['error'](_0x560a('0xe'),_0x359da4,_0x36e345[_0x560a('0x13')][_0x560a('0x15')]);return _0x2e3b88(_0x36e345[_0x560a('0x13')]['message']);}else{logger['info'](_0x560a('0xe'),_0x359da4,_0x560a('0xf'));_0x2e3b88(_0x36e345[_0x560a('0x16')][_0x560a('0x15')]);}})['catch'](function(_0x96deb7){logger[_0x560a('0x13')](_0x560a('0xe'),_0x359da4,_0x96deb7);_0x13c6a3(_0x96deb7);});});}exports[_0x560a('0x17')]=function(_0xe9be04){var _0x4807f2=this;return new Promise(function(_0x32ff83,_0x155c2b){return db[_0x560a('0x18')][_0x560a('0x19')]({'raw':_0xe9be04[_0x560a('0x1a')]?_0xe9be04[_0x560a('0x1a')][_0x560a('0x1b')]===undefined?!![]:![]:!![],'where':_0xe9be04['options']?_0xe9be04[_0x560a('0x1a')][_0x560a('0x1c')]||null:null,'attributes':_0xe9be04[_0x560a('0x1a')]?_0xe9be04[_0x560a('0x1a')][_0x560a('0x1d')]||null:null,'include':_0xe9be04[_0x560a('0x1a')]?_0xe9be04[_0x560a('0x1a')][_0x560a('0x1e')]?_['map'](_0xe9be04['options']['include'],function(_0x306510){return{'model':db[_0x306510[_0x560a('0x1f')]],'as':_0x306510['as'],'attributes':_0x306510['attributes'],'include':_0x306510['include']?_[_0x560a('0x20')](_0x306510['include'],function(_0x405eeb){return{'model':db[_0x405eeb[_0x560a('0x1f')]],'as':_0x405eeb['as'],'attributes':_0x405eeb['attributes'],'include':_0x405eeb[_0x560a('0x1e')]?_[_0x560a('0x20')](_0x405eeb['include'],function(_0x1ddcf6){return{'model':db[_0x1ddcf6[_0x560a('0x1f')]],'as':_0x1ddcf6['as'],'attributes':_0x1ddcf6[_0x560a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x560a('0xc')](function(_0x40a668){logger['info'](_0x560a('0x17'),_0xe9be04);logger[_0x560a('0x10')]('ShowWhatsappAccount',_0xe9be04,JSON[_0x560a('0x12')](_0x40a668));_0x32ff83(_0x40a668);})[_0x560a('0x21')](function(_0xf4a166){logger[_0x560a('0x13')](_0x560a('0x17'),_0xf4a166[_0x560a('0x15')],_0xe9be04);_0x155c2b(_0x4807f2[_0x560a('0x13')](0x1f4,_0xf4a166['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index d12efad..efdde1a 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 _0x1aff=['register','length','whatsappAccount:','./whatsappAccount.events','remove','emit'];(function(_0x3e3da5,_0x4de4eb){var _0x363860=function(_0x436645){while(--_0x436645){_0x3e3da5['push'](_0x3e3da5['shift']());}};_0x363860(++_0x4de4eb);}(_0x1aff,0x189));var _0xf1af=function(_0x5a80bf,_0x229a79){_0x5a80bf=_0x5a80bf-0x0;var _0x5d1f28=_0x1aff[_0x5a80bf];return _0x5d1f28;};'use strict';var WhatsappAccountEvents=require(_0xf1af('0x0'));var events=['save',_0xf1af('0x1'),'update'];function createListener(_0x4a8dba,_0x1d2d17){return function(_0x573978){_0x1d2d17[_0xf1af('0x2')](_0x4a8dba,_0x573978);};}function removeListener(_0x3f7747,_0x2b483c){return function(){WhatsappAccountEvents['removeListener'](_0x3f7747,_0x2b483c);};}exports[_0xf1af('0x3')]=function(_0x1c7607){for(var _0x309826=0x0,_0x349762=events[_0xf1af('0x4')];_0x309826<_0x349762;_0x309826++){var _0x11de3d=events[_0x309826];var _0x2ebc7a=createListener(_0xf1af('0x5')+_0x11de3d,_0x1c7607);WhatsappAccountEvents['on'](_0x11de3d,_0x2ebc7a);}}; \ No newline at end of file +var _0xb3cf=['save','remove','update','emit','register','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x4beaca,_0x92d420){var _0x2febe4=function(_0x349e97){while(--_0x349e97){_0x4beaca['push'](_0x4beaca['shift']());}};_0x2febe4(++_0x92d420);}(_0xb3cf,0x12f));var _0xfb3c=function(_0x5a2abe,_0x8638a3){_0x5a2abe=_0x5a2abe-0x0;var _0x4b4439=_0xb3cf[_0x5a2abe];return _0x4b4439;};'use strict';var WhatsappAccountEvents=require(_0xfb3c('0x0'));var events=[_0xfb3c('0x1'),_0xfb3c('0x2'),_0xfb3c('0x3')];function createListener(_0x1cbd50,_0x73ffef){return function(_0x444fb6){_0x73ffef[_0xfb3c('0x4')](_0x1cbd50,_0x444fb6);};}function removeListener(_0x3b1a79,_0x561ac9){return function(){WhatsappAccountEvents['removeListener'](_0x3b1a79,_0x561ac9);};}exports[_0xfb3c('0x5')]=function(_0x2aea50){for(var _0x1e4eb9=0x0,_0x26da87=events[_0xfb3c('0x6')];_0x1e4eb9<_0x26da87;_0x1e4eb9++){var _0x629ba0=events[_0x1e4eb9];var _0x440b6f=createListener(_0xfb3c('0x7')+_0x629ba0,_0x2aea50);WhatsappAccountEvents['on'](_0x629ba0,_0x440b6f);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index cea2bfe..db9a842 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 _0x63be=['get','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','index'];(function(_0x23d595,_0x52a325){var _0x35f1ab=function(_0x23b024){while(--_0x23b024){_0x23d595['push'](_0x23d595['shift']());}};_0x35f1ab(++_0x52a325);}(_0x63be,0x139));var _0xe63b=function(_0x32c541,_0x158646){_0x32c541=_0x32c541-0x0;var _0x11b9a1=_0x63be[_0x32c541];return _0x11b9a1;};'use strict';var multer=require('multer');var util=require(_0xe63b('0x0'));var path=require(_0xe63b('0x1'));var timeout=require(_0xe63b('0x2'));var express=require(_0xe63b('0x3'));var router=express[_0xe63b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe63b('0x5'));var config=require(_0xe63b('0x6'));var controller=require(_0xe63b('0x7'));router['get']('/',auth[_0xe63b('0x8')](),controller[_0xe63b('0x9')]);router[_0xe63b('0xa')](_0xe63b('0xb'),auth[_0xe63b('0x8')](),controller[_0xe63b('0xc')]);router['post']('/',auth[_0xe63b('0x8')](),controller[_0xe63b('0xd')]);router[_0xe63b('0xe')](_0xe63b('0xb'),auth['isAuthenticated'](),controller[_0xe63b('0xf')]);router[_0xe63b('0x10')](_0xe63b('0xb'),auth['isAuthenticated'](),controller[_0xe63b('0x11')]);module[_0xe63b('0x12')]=router; \ No newline at end of file +var _0xbb63=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','path','express'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0xbb63,0xcf));var _0x3bb6=function(_0x4847bd,_0x2b322d){_0x4847bd=_0x4847bd-0x0;var _0x1ac4f9=_0xbb63[_0x4847bd];return _0x1ac4f9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3bb6('0x0'));var timeout=require('connect-timeout');var express=require(_0x3bb6('0x1'));var router=express[_0x3bb6('0x2')]();var auth=require(_0x3bb6('0x3'));var interaction=require(_0x3bb6('0x4'));var config=require(_0x3bb6('0x5'));var controller=require(_0x3bb6('0x6'));router[_0x3bb6('0x7')]('/',auth[_0x3bb6('0x8')](),controller[_0x3bb6('0x9')]);router[_0x3bb6('0x7')](_0x3bb6('0xa'),auth[_0x3bb6('0x8')](),controller[_0x3bb6('0xb')]);router[_0x3bb6('0xc')]('/',auth[_0x3bb6('0x8')](),controller[_0x3bb6('0xd')]);router[_0x3bb6('0xe')](_0x3bb6('0xa'),auth[_0x3bb6('0x8')](),controller[_0x3bb6('0xf')]);router[_0x3bb6('0x10')](_0x3bb6('0xa'),auth[_0x3bb6('0x8')](),controller[_0x3bb6('0x11')]);module[_0x3bb6('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index e55e758..d75d965 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 _0x6bd7=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x166501,_0x1e0bf7){var _0x50eaff=function(_0x20f80a){while(--_0x20f80a){_0x166501['push'](_0x166501['shift']());}};_0x50eaff(++_0x1e0bf7);}(_0x6bd7,0x112));var _0x76bd=function(_0x21065c,_0x23839c){_0x21065c=_0x21065c-0x0;var _0x3500c0=_0x6bd7[_0x21065c];return _0x3500c0;};'use strict';var Sequelize=require('sequelize');module[_0x76bd('0x0')]={'priority':{'type':Sequelize[_0x76bd('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x76bd('0x2')],'allowNull':![],'defaultValue':_0x76bd('0x3')},'appdata':{'type':Sequelize[_0x76bd('0x4')]()},'description':{'type':Sequelize[_0x76bd('0x2')]},'interval':{'type':Sequelize[_0x76bd('0x2')],'defaultValue':_0x76bd('0x5')}}; \ No newline at end of file +var _0xc246=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x2ddb6d,_0x25d45b){var _0x56c103=function(_0x4f73c4){while(--_0x4f73c4){_0x2ddb6d['push'](_0x2ddb6d['shift']());}};_0x56c103(++_0x25d45b);}(_0xc246,0xb2));var _0x6c24=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc246[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6c24('0x0'));module[_0x6c24('0x1')]={'priority':{'type':Sequelize[_0x6c24('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6c24('0x3')],'allowNull':![],'defaultValue':_0x6c24('0x4')},'appdata':{'type':Sequelize[_0x6c24('0x5')]()},'description':{'type':Sequelize[_0x6c24('0x3')]},'interval':{'type':Sequelize[_0x6c24('0x3')],'defaultValue':_0x6c24('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index f3761dc..72d3368 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 _0x2280=['fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','limit','offset','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','create','body','html-pdf','rimraf','zip-dir'];(function(_0x254ec4,_0x515ba6){var _0x1e81b6=function(_0x508149){while(--_0x508149){_0x254ec4['push'](_0x254ec4['shift']());}};_0x1e81b6(++_0x515ba6);}(_0x2280,0xd8));var _0x0228=function(_0x1f7ee3,_0x3096e0){_0x1f7ee3=_0x1f7ee3-0x0;var _0x1da90b=_0x2280[_0x1f7ee3];return _0x1da90b;};'use strict';var pdf=require(_0x0228('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0228('0x1'));var zipdir=require(_0x0228('0x2'));var jsonpatch=require(_0x0228('0x3'));var rp=require('request-promise');var moment=require(_0x0228('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0228('0x5'));var util=require(_0x0228('0x6'));var path=require(_0x0228('0x7'));var sox=require('sox');var csv=require(_0x0228('0x8'));var ejs=require(_0x0228('0x9'));var fs=require('fs');var _=require(_0x0228('0xa'));var squel=require(_0x0228('0xb'));var crypto=require(_0x0228('0xc'));var jsforce=require(_0x0228('0xd'));var deskjs=require(_0x0228('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0228('0xf'));var Redis=require(_0x0228('0x10'));var authService=require(_0x0228('0x11'));var qs=require(_0x0228('0x12'));var as=require(_0x0228('0x13'));var hardwareService=require(_0x0228('0x14'));var logger=require(_0x0228('0x15'))('api');var utils=require(_0x0228('0x16'));var config=require(_0x0228('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0228('0x18'))['db'];function respondWithStatusCode(_0x4bac1d,_0x3d9b83){_0x3d9b83=_0x3d9b83||0xcc;return function(_0x33587c){if(_0x33587c){return _0x4bac1d['sendStatus'](_0x3d9b83);}return _0x4bac1d[_0x0228('0x19')](_0x3d9b83)[_0x0228('0x1a')]();};}function respondWithResult(_0x463853,_0x430e5f){_0x430e5f=_0x430e5f||0xc8;return function(_0x582115){if(_0x582115){return _0x463853[_0x0228('0x19')](_0x430e5f)[_0x0228('0x1b')](_0x582115);}};}function respondWithFilteredResult(_0x287882,_0x250efa){return function(_0x1857ee){if(_0x1857ee){var _0x45ea46=_0x1857ee[_0x0228('0x1c')],_0x19879a=_0x250efa['offset'],_0x2fdd2a=_0x250efa['offset']+_0x250efa['limit'],_0x2f65ac;if(_0x2fdd2a>=_0x45ea46){_0x2fdd2a=_0x45ea46;_0x2f65ac=0xc8;}else{_0x2f65ac=0xce;}_0x287882[_0x0228('0x19')](_0x2f65ac);return _0x287882[_0x0228('0x1d')](_0x0228('0x1e'),_0x19879a+'-'+_0x2fdd2a+'/'+_0x45ea46)['json'](_0x1857ee);}return null;};}function patchUpdates(_0x35ac1f){return function(_0x41af32){try{jsonpatch['apply'](_0x41af32,_0x35ac1f,!![]);}catch(_0x1381cd){return BPromise[_0x0228('0x1f')](_0x1381cd);}return _0x41af32[_0x0228('0x20')]();};}function saveUpdates(_0x8c9210,_0x5d68f0){return function(_0x37179b){if(_0x37179b){return _0x37179b[_0x0228('0x21')](_0x8c9210)['then'](function(_0x3e938d){return _0x3e938d;});}return null;};}function removeEntity(_0x37222a,_0x19de3e){return function(_0x1eebe2){if(_0x1eebe2){return _0x1eebe2[_0x0228('0x22')]()[_0x0228('0x23')](function(){_0x37222a['status'](0xcc)[_0x0228('0x1a')]();});}};}function handleEntityNotFound(_0x4049de,_0x10872d){return function(_0x223c08){if(!_0x223c08){_0x4049de['sendStatus'](0x194);}return _0x223c08;};}function handleError(_0x21e0d5,_0x3db3ef){_0x3db3ef=_0x3db3ef||0x1f4;return function(_0x3d61b8){logger[_0x0228('0x24')](_0x3d61b8['stack']);if(_0x3d61b8[_0x0228('0x25')]){delete _0x3d61b8[_0x0228('0x25')];}_0x21e0d5[_0x0228('0x19')](_0x3db3ef)[_0x0228('0x26')](_0x3d61b8);};}exports[_0x0228('0x27')]=function(_0x4f65ef,_0x4f2f94){var _0x3a47e0={},_0x21d726={},_0x525a98={'count':0x0,'rows':[]};var _0x4057b9=_[_0x0228('0x28')](db[_0x0228('0x29')][_0x0228('0x2a')],function(_0x586bfc){return{'name':_0x586bfc[_0x0228('0x2b')],'type':_0x586bfc[_0x0228('0x2c')]['key']};});_0x21d726['model']=_[_0x0228('0x28')](_0x4057b9,_0x0228('0x25'));_0x21d726[_0x0228('0x2d')]=_[_0x0228('0x2e')](_0x4f65ef[_0x0228('0x2d')]);_0x21d726[_0x0228('0x2f')]=_[_0x0228('0x30')](_0x21d726['model'],_0x21d726[_0x0228('0x2d')]);_0x3a47e0['attributes']=_[_0x0228('0x30')](_0x21d726[_0x0228('0x31')],qs['fields'](_0x4f65ef['query']['fields']));_0x3a47e0[_0x0228('0x32')]=_0x3a47e0[_0x0228('0x32')]['length']?_0x3a47e0[_0x0228('0x32')]:_0x21d726[_0x0228('0x31')];if(!_0x4f65ef['query'][_0x0228('0x33')](_0x0228('0x34'))){_0x3a47e0['limit']=qs[_0x0228('0x35')](_0x4f65ef[_0x0228('0x2d')][_0x0228('0x35')]);_0x3a47e0['offset']=qs[_0x0228('0x36')](_0x4f65ef[_0x0228('0x2d')][_0x0228('0x36')]);}_0x3a47e0['order']=qs[_0x0228('0x37')](_0x4f65ef[_0x0228('0x2d')][_0x0228('0x37')]);_0x3a47e0[_0x0228('0x38')]=qs[_0x0228('0x2f')](_[_0x0228('0x39')](_0x4f65ef[_0x0228('0x2d')],_0x21d726[_0x0228('0x2f')]),_0x4057b9);if(_0x4f65ef[_0x0228('0x2d')][_0x0228('0x3a')]){_0x3a47e0['where']=_[_0x0228('0x3b')](_0x3a47e0[_0x0228('0x38')],{'$or':_[_0x0228('0x28')](_0x4057b9,function(_0x563112){if(_0x563112[_0x0228('0x2c')]!=='VIRTUAL'){var _0x12e333={};_0x12e333[_0x563112[_0x0228('0x25')]]={'$like':'%'+_0x4f65ef['query'][_0x0228('0x3a')]+'%'};return _0x12e333;}})});}_0x3a47e0=_[_0x0228('0x3b')]({},_0x3a47e0,_0x4f65ef[_0x0228('0x3c')]);var _0x55fab1={'where':_0x3a47e0[_0x0228('0x38')]};return db[_0x0228('0x29')][_0x0228('0x1c')](_0x55fab1)['then'](function(_0x2e8bb7){_0x525a98[_0x0228('0x1c')]=_0x2e8bb7;if(_0x4f65ef[_0x0228('0x2d')][_0x0228('0x3d')]){_0x3a47e0[_0x0228('0x3e')]=[{'all':!![]}];}return db[_0x0228('0x29')][_0x0228('0x3f')](_0x3a47e0);})[_0x0228('0x23')](function(_0x17320e){_0x525a98[_0x0228('0x40')]=_0x17320e;return _0x525a98;})[_0x0228('0x23')](respondWithFilteredResult(_0x4f2f94,_0x3a47e0))[_0x0228('0x41')](handleError(_0x4f2f94,null));};exports[_0x0228('0x42')]=function(_0xcec007,_0x326f21){var _0x11936c={'raw':!![],'where':{'id':_0xcec007[_0x0228('0x43')]['id']}},_0x1b23ca={};_0x1b23ca['model']=_[_0x0228('0x2e')](db[_0x0228('0x29')][_0x0228('0x2a')]);_0x1b23ca[_0x0228('0x2d')]=_['keys'](_0xcec007[_0x0228('0x2d')]);_0x1b23ca['filters']=_[_0x0228('0x30')](_0x1b23ca[_0x0228('0x31')],_0x1b23ca[_0x0228('0x2d')]);_0x11936c[_0x0228('0x32')]=_[_0x0228('0x30')](_0x1b23ca[_0x0228('0x31')],qs[_0x0228('0x44')](_0xcec007[_0x0228('0x2d')][_0x0228('0x44')]));_0x11936c['attributes']=_0x11936c[_0x0228('0x32')][_0x0228('0x45')]?_0x11936c[_0x0228('0x32')]:_0x1b23ca[_0x0228('0x31')];if(_0xcec007[_0x0228('0x2d')][_0x0228('0x3d')]){_0x11936c[_0x0228('0x3e')]=[{'all':!![]}];}_0x11936c=_[_0x0228('0x3b')]({},_0x11936c,_0xcec007['options']);return db['WhatsappApplication'][_0x0228('0x46')](_0x11936c)[_0x0228('0x23')](handleEntityNotFound(_0x326f21,null))[_0x0228('0x23')](respondWithResult(_0x326f21,null))[_0x0228('0x41')](handleError(_0x326f21,null));};exports[_0x0228('0x47')]=function(_0x3852aa,_0x3dd67c){return db['WhatsappApplication'][_0x0228('0x47')](_0x3852aa[_0x0228('0x48')],{})[_0x0228('0x23')](respondWithResult(_0x3dd67c,0xc9))['catch'](handleError(_0x3dd67c,null));};exports[_0x0228('0x21')]=function(_0x5998dd,_0x43aec1){if(_0x5998dd['body']['id']){delete _0x5998dd[_0x0228('0x48')]['id'];}return db[_0x0228('0x29')]['find']({'where':{'id':_0x5998dd[_0x0228('0x43')]['id']}})[_0x0228('0x23')](handleEntityNotFound(_0x43aec1,null))[_0x0228('0x23')](saveUpdates(_0x5998dd[_0x0228('0x48')],null))[_0x0228('0x23')](respondWithResult(_0x43aec1,null))[_0x0228('0x41')](handleError(_0x43aec1,null));};exports[_0x0228('0x22')]=function(_0x4a7a8e,_0x247e22){return db[_0x0228('0x29')][_0x0228('0x46')]({'where':{'id':_0x4a7a8e[_0x0228('0x43')]['id']}})['then'](handleEntityNotFound(_0x247e22,null))[_0x0228('0x23')](removeEntity(_0x247e22,null))[_0x0228('0x41')](handleError(_0x247e22,null));}; \ No newline at end of file +var _0xda91=['json','offset','limit','set','Content-Range','apply','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','length','attributes','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','count','then','includeAll','include','WhatsappApplication','findAll','rows','catch','show','params','find','create','body','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','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'];(function(_0x5421cc,_0x104e78){var _0x2250dc=function(_0x4b2020){while(--_0x4b2020){_0x5421cc['push'](_0x5421cc['shift']());}};_0x2250dc(++_0x104e78);}(_0xda91,0x164));var _0x1da9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xda91[_0x17d9e3];return _0x14192d;};'use strict';var pdf=require(_0x1da9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1da9('0x1'));var zipdir=require(_0x1da9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1da9('0x3'));var moment=require(_0x1da9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1da9('0x5'));var util=require(_0x1da9('0x6'));var path=require(_0x1da9('0x7'));var sox=require(_0x1da9('0x8'));var csv=require(_0x1da9('0x9'));var ejs=require(_0x1da9('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1da9('0xb'));var crypto=require(_0x1da9('0xc'));var jsforce=require(_0x1da9('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1da9('0xe'));var Papa=require('papaparse');var Redis=require(_0x1da9('0xf'));var authService=require(_0x1da9('0x10'));var qs=require(_0x1da9('0x11'));var as=require(_0x1da9('0x12'));var hardwareService=require(_0x1da9('0x13'));var logger=require(_0x1da9('0x14'))(_0x1da9('0x15'));var utils=require(_0x1da9('0x16'));var config=require(_0x1da9('0x17'));var licenseUtil=require(_0x1da9('0x18'));var db=require(_0x1da9('0x19'))['db'];function respondWithStatusCode(_0x1fae71,_0x2febdc){_0x2febdc=_0x2febdc||0xcc;return function(_0x59a59d){if(_0x59a59d){return _0x1fae71[_0x1da9('0x1a')](_0x2febdc);}return _0x1fae71[_0x1da9('0x1b')](_0x2febdc)[_0x1da9('0x1c')]();};}function respondWithResult(_0x576cd9,_0x5bc1a3){_0x5bc1a3=_0x5bc1a3||0xc8;return function(_0xdd2991){if(_0xdd2991){return _0x576cd9['status'](_0x5bc1a3)[_0x1da9('0x1d')](_0xdd2991);}};}function respondWithFilteredResult(_0x2cb8f1,_0x503e39){return function(_0x39418c){if(_0x39418c){var _0x399617=_0x39418c['count'],_0x5b7601=_0x503e39[_0x1da9('0x1e')],_0x35bf83=_0x503e39['offset']+_0x503e39[_0x1da9('0x1f')],_0x2d50a5;if(_0x35bf83>=_0x399617){_0x35bf83=_0x399617;_0x2d50a5=0xc8;}else{_0x2d50a5=0xce;}_0x2cb8f1[_0x1da9('0x1b')](_0x2d50a5);return _0x2cb8f1[_0x1da9('0x20')](_0x1da9('0x21'),_0x5b7601+'-'+_0x35bf83+'/'+_0x399617)[_0x1da9('0x1d')](_0x39418c);}return null;};}function patchUpdates(_0x1c4b19){return function(_0x354323){try{jsonpatch[_0x1da9('0x22')](_0x354323,_0x1c4b19,!![]);}catch(_0x146195){return BPromise['reject'](_0x146195);}return _0x354323['save']();};}function saveUpdates(_0x84362e,_0x5f8888){return function(_0x33a09c){if(_0x33a09c){return _0x33a09c[_0x1da9('0x23')](_0x84362e)['then'](function(_0x379bea){return _0x379bea;});}return null;};}function removeEntity(_0x7be7e7,_0x4279ee){return function(_0x3a845d){if(_0x3a845d){return _0x3a845d[_0x1da9('0x24')]()['then'](function(){_0x7be7e7[_0x1da9('0x1b')](0xcc)[_0x1da9('0x1c')]();});}};}function handleEntityNotFound(_0x290d71,_0x3cf207){return function(_0x28e541){if(!_0x28e541){_0x290d71[_0x1da9('0x1a')](0x194);}return _0x28e541;};}function handleError(_0x392f19,_0x5196e9){_0x5196e9=_0x5196e9||0x1f4;return function(_0x5050a5){logger[_0x1da9('0x25')](_0x5050a5[_0x1da9('0x26')]);if(_0x5050a5[_0x1da9('0x27')]){delete _0x5050a5[_0x1da9('0x27')];}_0x392f19[_0x1da9('0x1b')](_0x5196e9)[_0x1da9('0x28')](_0x5050a5);};}exports[_0x1da9('0x29')]=function(_0x34907b,_0x293b65){var _0x18f2b3={},_0x36644c={},_0xb7a28f={'count':0x0,'rows':[]};var _0xda788e=_[_0x1da9('0x2a')](db['WhatsappApplication'][_0x1da9('0x2b')],function(_0xed4c36){return{'name':_0xed4c36[_0x1da9('0x2c')],'type':_0xed4c36['type'][_0x1da9('0x2d')]};});_0x36644c[_0x1da9('0x2e')]=_[_0x1da9('0x2a')](_0xda788e,_0x1da9('0x27'));_0x36644c[_0x1da9('0x2f')]=_[_0x1da9('0x30')](_0x34907b['query']);_0x36644c[_0x1da9('0x31')]=_['intersection'](_0x36644c[_0x1da9('0x2e')],_0x36644c[_0x1da9('0x2f')]);_0x18f2b3['attributes']=_[_0x1da9('0x32')](_0x36644c[_0x1da9('0x2e')],qs[_0x1da9('0x33')](_0x34907b[_0x1da9('0x2f')][_0x1da9('0x33')]));_0x18f2b3['attributes']=_0x18f2b3['attributes'][_0x1da9('0x34')]?_0x18f2b3[_0x1da9('0x35')]:_0x36644c['model'];if(!_0x34907b[_0x1da9('0x2f')]['hasOwnProperty'](_0x1da9('0x36'))){_0x18f2b3[_0x1da9('0x1f')]=qs[_0x1da9('0x1f')](_0x34907b['query'][_0x1da9('0x1f')]);_0x18f2b3[_0x1da9('0x1e')]=qs['offset'](_0x34907b[_0x1da9('0x2f')][_0x1da9('0x1e')]);}_0x18f2b3[_0x1da9('0x37')]=qs[_0x1da9('0x38')](_0x34907b[_0x1da9('0x2f')][_0x1da9('0x38')]);_0x18f2b3[_0x1da9('0x39')]=qs[_0x1da9('0x31')](_[_0x1da9('0x3a')](_0x34907b['query'],_0x36644c[_0x1da9('0x31')]),_0xda788e);if(_0x34907b[_0x1da9('0x2f')][_0x1da9('0x3b')]){_0x18f2b3['where']=_['merge'](_0x18f2b3[_0x1da9('0x39')],{'$or':_['map'](_0xda788e,function(_0x343790){if(_0x343790[_0x1da9('0x3c')]!==_0x1da9('0x3d')){var _0x8b4a70={};_0x8b4a70[_0x343790[_0x1da9('0x27')]]={'$like':'%'+_0x34907b[_0x1da9('0x2f')][_0x1da9('0x3b')]+'%'};return _0x8b4a70;}})});}_0x18f2b3=_[_0x1da9('0x3e')]({},_0x18f2b3,_0x34907b[_0x1da9('0x3f')]);var _0x1f8bd0={'where':_0x18f2b3[_0x1da9('0x39')]};return db['WhatsappApplication'][_0x1da9('0x40')](_0x1f8bd0)[_0x1da9('0x41')](function(_0x45f7c7){_0xb7a28f[_0x1da9('0x40')]=_0x45f7c7;if(_0x34907b[_0x1da9('0x2f')][_0x1da9('0x42')]){_0x18f2b3[_0x1da9('0x43')]=[{'all':!![]}];}return db[_0x1da9('0x44')][_0x1da9('0x45')](_0x18f2b3);})[_0x1da9('0x41')](function(_0x5c97dd){_0xb7a28f[_0x1da9('0x46')]=_0x5c97dd;return _0xb7a28f;})[_0x1da9('0x41')](respondWithFilteredResult(_0x293b65,_0x18f2b3))[_0x1da9('0x47')](handleError(_0x293b65,null));};exports[_0x1da9('0x48')]=function(_0x16ed78,_0x556df3){var _0x5a565c={'raw':!![],'where':{'id':_0x16ed78[_0x1da9('0x49')]['id']}},_0x239d01={};_0x239d01[_0x1da9('0x2e')]=_[_0x1da9('0x30')](db['WhatsappApplication'][_0x1da9('0x2b')]);_0x239d01['query']=_['keys'](_0x16ed78['query']);_0x239d01['filters']=_[_0x1da9('0x32')](_0x239d01[_0x1da9('0x2e')],_0x239d01['query']);_0x5a565c['attributes']=_[_0x1da9('0x32')](_0x239d01[_0x1da9('0x2e')],qs[_0x1da9('0x33')](_0x16ed78[_0x1da9('0x2f')][_0x1da9('0x33')]));_0x5a565c[_0x1da9('0x35')]=_0x5a565c[_0x1da9('0x35')][_0x1da9('0x34')]?_0x5a565c[_0x1da9('0x35')]:_0x239d01['model'];if(_0x16ed78[_0x1da9('0x2f')][_0x1da9('0x42')]){_0x5a565c['include']=[{'all':!![]}];}_0x5a565c=_[_0x1da9('0x3e')]({},_0x5a565c,_0x16ed78[_0x1da9('0x3f')]);return db[_0x1da9('0x44')][_0x1da9('0x4a')](_0x5a565c)[_0x1da9('0x41')](handleEntityNotFound(_0x556df3,null))[_0x1da9('0x41')](respondWithResult(_0x556df3,null))[_0x1da9('0x47')](handleError(_0x556df3,null));};exports[_0x1da9('0x4b')]=function(_0x55c0fc,_0x8b56a6){return db[_0x1da9('0x44')][_0x1da9('0x4b')](_0x55c0fc[_0x1da9('0x4c')],{})[_0x1da9('0x41')](respondWithResult(_0x8b56a6,0xc9))[_0x1da9('0x47')](handleError(_0x8b56a6,null));};exports['update']=function(_0x7f0f62,_0x47f60c){if(_0x7f0f62['body']['id']){delete _0x7f0f62[_0x1da9('0x4c')]['id'];}return db[_0x1da9('0x44')][_0x1da9('0x4a')]({'where':{'id':_0x7f0f62[_0x1da9('0x49')]['id']}})[_0x1da9('0x41')](handleEntityNotFound(_0x47f60c,null))[_0x1da9('0x41')](saveUpdates(_0x7f0f62[_0x1da9('0x4c')],null))['then'](respondWithResult(_0x47f60c,null))[_0x1da9('0x47')](handleError(_0x47f60c,null));};exports['destroy']=function(_0x17262c,_0x2203c7){return db[_0x1da9('0x44')]['find']({'where':{'id':_0x17262c['params']['id']}})[_0x1da9('0x41')](handleEntityNotFound(_0x2203c7,null))[_0x1da9('0x41')](removeEntity(_0x2203c7,null))['catch'](handleError(_0x2203c7,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 1d273eb..f928937 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 _0x29ec=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4'];(function(_0x45ffad,_0x1c09f0){var _0x7c936e=function(_0xae7e55){while(--_0xae7e55){_0x45ffad['push'](_0x45ffad['shift']());}};_0x7c936e(++_0x1c09f0);}(_0x29ec,0xe2));var _0xc29e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29ec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc29e('0x0'));var util=require(_0xc29e('0x1'));var logger=require('../../config/logger')(_0xc29e('0x2'));var moment=require(_0xc29e('0x3'));var BPromise=require(_0xc29e('0x4'));var rp=require(_0xc29e('0x5'));var fs=require('fs');var path=require(_0xc29e('0x6'));var rimraf=require('rimraf');var config=require(_0xc29e('0x7'));var attributes=require(_0xc29e('0x8'));module[_0xc29e('0x9')]=function(_0x6771ab,_0x37e294){return _0x6771ab[_0xc29e('0xa')](_0xc29e('0xb'),attributes,{'tableName':_0xc29e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc29e('0xd'),'collate':_0xc29e('0xe')});}; \ No newline at end of file +var _0x7ab1=['bluebird','request-promise','path','rimraf','../../config/environment','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x3d6bd9,_0x577251){var _0x43f2f8=function(_0x451870){while(--_0x451870){_0x3d6bd9['push'](_0x3d6bd9['shift']());}};_0x43f2f8(++_0x577251);}(_0x7ab1,0x15d));var _0x17ab=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x7ab1[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x17ab('0x0'));var util=require(_0x17ab('0x1'));var logger=require(_0x17ab('0x2'))('api');var moment=require('moment');var BPromise=require(_0x17ab('0x3'));var rp=require(_0x17ab('0x4'));var fs=require('fs');var path=require(_0x17ab('0x5'));var rimraf=require(_0x17ab('0x6'));var config=require(_0x17ab('0x7'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x3d6401,_0x1e45a3){return _0x3d6401['define'](_0x17ab('0x8'),attributes,{'tableName':_0x17ab('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x17ab('0xa')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index e7f3afc..34b7a6b 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 _0x979e=['info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x979e,0x195));var _0xe979=function(_0x2645c8,_0xdc8a07){_0x2645c8=_0x2645c8-0x0;var _0x4fa68f=_0x979e[_0x2645c8];return _0x4fa68f;};'use strict';var _=require(_0xe979('0x0'));var util=require(_0xe979('0x1'));var moment=require(_0xe979('0x2'));var BPromise=require(_0xe979('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe979('0x4'));var db=require(_0xe979('0x5'))['db'];var utils=require(_0xe979('0x6'));var logger=require(_0xe979('0x7'))(_0xe979('0x8'));var config=require('../../config/environment');var jayson=require(_0xe979('0x9'));var client=jayson['client'][_0xe979('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13a9ee,_0x441ffe,_0xc63524){return new BPromise(function(_0xc79c06,_0x3bbc32){return client[_0xe979('0xb')](_0x13a9ee,_0xc63524)[_0xe979('0xc')](function(_0x431a91){logger[_0xe979('0xd')](_0xe979('0xe'),_0x441ffe,'request\x20sent');logger[_0xe979('0xf')](_0xe979('0x10'),_0x441ffe,_0xe979('0x11'),JSON['stringify'](_0x431a91));if(_0x431a91[_0xe979('0x12')]){if(_0x431a91[_0xe979('0x12')][_0xe979('0x13')]===0x1f4){logger[_0xe979('0x12')](_0xe979('0xe'),_0x441ffe,_0x431a91[_0xe979('0x12')][_0xe979('0x14')]);return _0x3bbc32(_0x431a91[_0xe979('0x12')]['message']);}logger[_0xe979('0x12')](_0xe979('0xe'),_0x441ffe,_0x431a91[_0xe979('0x12')]['message']);return _0xc79c06(_0x431a91['error'][_0xe979('0x14')]);}else{logger[_0xe979('0xd')](_0xe979('0xe'),_0x441ffe,_0xe979('0x11'));_0xc79c06(_0x431a91['result'][_0xe979('0x14')]);}})[_0xe979('0x15')](function(_0xcb7fa1){logger[_0xe979('0x12')](_0xe979('0xe'),_0x441ffe,_0xcb7fa1);_0x3bbc32(_0xcb7fa1);});});} \ No newline at end of file +var _0xe6e9=['WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x38acb7,_0x249695){var _0x306cbd=function(_0x320157){while(--_0x320157){_0x38acb7['push'](_0x38acb7['shift']());}};_0x306cbd(++_0x249695);}(_0xe6e9,0x182));var _0x9e6e=function(_0x46aa3d,_0x5a170a){_0x46aa3d=_0x46aa3d-0x0;var _0x371ff=_0xe6e9[_0x46aa3d];return _0x371ff;};'use strict';var _=require(_0x9e6e('0x0'));var util=require(_0x9e6e('0x1'));var moment=require(_0x9e6e('0x2'));var BPromise=require('bluebird');var rs=require(_0x9e6e('0x3'));var fs=require('fs');var Redis=require(_0x9e6e('0x4'));var db=require(_0x9e6e('0x5'))['db'];var utils=require(_0x9e6e('0x6'));var logger=require(_0x9e6e('0x7'))('rpc');var config=require(_0x9e6e('0x8'));var jayson=require(_0x9e6e('0x9'));var client=jayson[_0x9e6e('0xa')][_0x9e6e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x174aaa,_0x5eda3e,_0x165666){return new BPromise(function(_0x2bf742,_0x2b8c88){return client[_0x9e6e('0xc')](_0x174aaa,_0x165666)[_0x9e6e('0xd')](function(_0x42b7ed){logger['info'](_0x9e6e('0xe'),_0x5eda3e,_0x9e6e('0xf'));logger[_0x9e6e('0x10')](_0x9e6e('0x11'),_0x5eda3e,'request\x20sent',JSON[_0x9e6e('0x12')](_0x42b7ed));if(_0x42b7ed[_0x9e6e('0x13')]){if(_0x42b7ed['error'][_0x9e6e('0x14')]===0x1f4){logger[_0x9e6e('0x13')](_0x9e6e('0xe'),_0x5eda3e,_0x42b7ed[_0x9e6e('0x13')]['message']);return _0x2b8c88(_0x42b7ed[_0x9e6e('0x13')][_0x9e6e('0x15')]);}logger[_0x9e6e('0x13')](_0x9e6e('0xe'),_0x5eda3e,_0x42b7ed[_0x9e6e('0x13')][_0x9e6e('0x15')]);return _0x2bf742(_0x42b7ed[_0x9e6e('0x13')][_0x9e6e('0x15')]);}else{logger[_0x9e6e('0x16')](_0x9e6e('0xe'),_0x5eda3e,_0x9e6e('0xf'));_0x2bf742(_0x42b7ed[_0x9e6e('0x17')][_0x9e6e('0x15')]);}})[_0x9e6e('0x18')](function(_0x452bc3){logger[_0x9e6e('0x13')](_0x9e6e('0xe'),_0x5eda3e,_0x452bc3);_0x2b8c88(_0x452bc3);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 338a02b..87a9fdc 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 _0x14b7=['path','connect-timeout','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','describe','show','getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','tracked','whatsappinteraction:addtags','put','/:id','whatsapp','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','multer','util'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x14b7,0x1c0));var _0x714b=function(_0x1e6db1,_0xb90700){_0x1e6db1=_0x1e6db1-0x0;var _0x55e924=_0x14b7[_0x1e6db1];return _0x55e924;};'use strict';var multer=require(_0x714b('0x0'));var util=require(_0x714b('0x1'));var path=require(_0x714b('0x2'));var timeout=require(_0x714b('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x714b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x714b('0x5'));var controller=require(_0x714b('0x6'));router['get']('/',auth[_0x714b('0x7')](),controller[_0x714b('0x8')]);router[_0x714b('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x714b('0xa')]);router[_0x714b('0x9')]('/:id',auth[_0x714b('0x7')](),controller[_0x714b('0xb')]);router[_0x714b('0x9')]('/:id/messages',auth[_0x714b('0x7')](),controller[_0x714b('0xc')]);router[_0x714b('0x9')](_0x714b('0xd'),auth[_0x714b('0x7')](),controller[_0x714b('0xe')]);router[_0x714b('0xf')]('/',auth['isAuthenticated'](),controller[_0x714b('0x10')]);router[_0x714b('0xf')](_0x714b('0x11'),auth['isAuthenticated'](),controller['addMessage']);router[_0x714b('0xf')](_0x714b('0x12'),auth[_0x714b('0x7')](),interaction[_0x714b('0x13')]('whatsapp',_0x714b('0x14')),controller['addTags']);router[_0x714b('0x15')](_0x714b('0x16'),auth[_0x714b('0x7')](),interaction[_0x714b('0x13')](_0x714b('0x17'),_0x714b('0x18')),controller[_0x714b('0x19')]);router[_0x714b('0x1a')](_0x714b('0x16'),auth[_0x714b('0x7')](),interaction[_0x714b('0x13')](_0x714b('0x17'),_0x714b('0x1b')),controller[_0x714b('0x1c')]);router['delete'](_0x714b('0x12'),auth['isAuthenticated'](),controller[_0x714b('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x90a2=['isAuthenticated','get','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','removeTags','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller'];(function(_0x211e36,_0x380138){var _0x34bf8d=function(_0x252ae0){while(--_0x252ae0){_0x211e36['push'](_0x211e36['shift']());}};_0x34bf8d(++_0x380138);}(_0x90a2,0x7c));var _0x290a=function(_0xd2fc1b,_0x4df384){_0xd2fc1b=_0xd2fc1b-0x0;var _0x47ede7=_0x90a2[_0xd2fc1b];return _0x47ede7;};'use strict';var multer=require('multer');var util=require(_0x290a('0x0'));var path=require('path');var timeout=require(_0x290a('0x1'));var express=require(_0x290a('0x2'));var router=express[_0x290a('0x3')]();var auth=require(_0x290a('0x4'));var interaction=require(_0x290a('0x5'));var config=require(_0x290a('0x6'));var controller=require(_0x290a('0x7'));router['get']('/',auth[_0x290a('0x8')](),controller['index']);router[_0x290a('0x9')](_0x290a('0xa'),auth[_0x290a('0x8')](),controller['describe']);router[_0x290a('0x9')](_0x290a('0xb'),auth[_0x290a('0x8')](),controller[_0x290a('0xc')]);router[_0x290a('0x9')](_0x290a('0xd'),auth['isAuthenticated'](),controller[_0x290a('0xe')]);router['get'](_0x290a('0xf'),auth[_0x290a('0x8')](),controller[_0x290a('0x10')]);router['post']('/',auth[_0x290a('0x8')](),controller[_0x290a('0x11')]);router[_0x290a('0x12')](_0x290a('0xd'),auth[_0x290a('0x8')](),controller[_0x290a('0x13')]);router[_0x290a('0x12')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x290a('0x14')]('whatsapp',_0x290a('0x15')),controller[_0x290a('0x16')]);router[_0x290a('0x17')](_0x290a('0xb'),auth[_0x290a('0x8')](),interaction[_0x290a('0x14')](_0x290a('0x18'),_0x290a('0x19')),controller[_0x290a('0x1a')]);router[_0x290a('0x1b')](_0x290a('0xb'),auth[_0x290a('0x8')](),interaction[_0x290a('0x14')](_0x290a('0x18'),_0x290a('0x1c')),controller[_0x290a('0x1d')]);router[_0x290a('0x1b')](_0x290a('0x1e'),auth[_0x290a('0x8')](),controller[_0x290a('0x1f')]);module[_0x290a('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 53aabc4..797b168 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 _0x1aa8=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x3a6eba,_0x7db8ac){var _0x531c0a=function(_0x349132){while(--_0x349132){_0x3a6eba['push'](_0x3a6eba['shift']());}};_0x531c0a(++_0x7db8ac);}(_0x1aa8,0x197));var _0x81aa=function(_0x33465e,_0x4ce490){_0x33465e=_0x33465e-0x0;var _0x379c57=_0x1aa8[_0x33465e];return _0x379c57;};'use strict';var Sequelize=require(_0x81aa('0x0'));var moment=require('moment');module[_0x81aa('0x1')]={'closed':{'type':Sequelize[_0x81aa('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x81aa('0x3')]},'disposition':{'type':Sequelize[_0x81aa('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x81aa('0x4')]},'phone':{'type':Sequelize[_0x81aa('0x4')]},'read1stAt':{'type':Sequelize[_0x81aa('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x81aa('0x5')]('in',_0x81aa('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x81aa('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x3306=['moment','exports','BOOLEAN','STRING','ENUM','out','DATE','sequelize'];(function(_0x5a950d,_0x41fc9b){var _0x31c239=function(_0x277509){while(--_0x277509){_0x5a950d['push'](_0x5a950d['shift']());}};_0x31c239(++_0x41fc9b);}(_0x3306,0x107));var _0x6330=function(_0x5a7414,_0x11fda7){_0x5a7414=_0x5a7414-0x0;var _0x192640=_0x3306[_0x5a7414];return _0x192640;};'use strict';var Sequelize=require(_0x6330('0x0'));var moment=require(_0x6330('0x1'));module[_0x6330('0x2')]={'closed':{'type':Sequelize[_0x6330('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x6330('0x4')]},'secondDisposition':{'type':Sequelize[_0x6330('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6330('0x4')]},'note':{'type':Sequelize[_0x6330('0x4')]},'phone':{'type':Sequelize[_0x6330('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x6330('0x5')]('in',_0x6330('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6330('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x6330('0x5')]('in',_0x6330('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 2163c58..ebff123 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 _0x955f=['pipe','createWriteStream','basename','out','System','secret','renderFile','views','downloadInteraction.html','transcript-','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./whatsappInteraction.socket','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','index','WhatsappInteraction','rawAttributes','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','u.id\x20=\x20ui.UserId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','unreadMessages','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','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','start','Tag','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','keys','some','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$lte','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','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?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.email','Contact.email','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','catch','intersection','includeAll','include','merge','options','create','update','params','describe','addMessage','omit','ids','getMessages','findOne','WhatsappMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','color','whatsappInteractionTags:save','removeTags','unix','join','root','server','tmp','files','transcript-%d-%s.zip','CmContact','firstName','Messages','direction','WhatsappAccount','Account','Owner','get','mkdirSync','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','YYYY-MM-DD','Whatsapp','closed','closedAt','disposition','Attachment','existsSync','createReadStream'];(function(_0x5317b8,_0xb94935){var _0x4d8b60=function(_0x5cc0ea){while(--_0x5cc0ea){_0x5317b8['push'](_0x5317b8['shift']());}};_0x4d8b60(++_0xb94935);}(_0x955f,0x1eb));var _0xf955=function(_0x153c17,_0x168ffc){_0x153c17=_0x153c17-0x0;var _0x1c7cf3=_0x955f[_0x153c17];return _0x1c7cf3;};'use strict';var pdf=require(_0xf955('0x0'));var emlformat=require(_0xf955('0x1'));var rimraf=require(_0xf955('0x2'));var zipdir=require(_0xf955('0x3'));var jsonpatch=require(_0xf955('0x4'));var rp=require('request-promise');var moment=require(_0xf955('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf955('0x6'));var path=require('path');var sox=require(_0xf955('0x7'));var csv=require(_0xf955('0x8'));var ejs=require(_0xf955('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf955('0xa'));var crypto=require(_0xf955('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf955('0xc'));var toCsv=require(_0xf955('0x8'));var querystring=require(_0xf955('0xd'));var Papa=require(_0xf955('0xe'));var Redis=require(_0xf955('0xf'));var authService=require(_0xf955('0x10'));var qs=require(_0xf955('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf955('0x12'));var logger=require('../../config/logger')(_0xf955('0x13'));var utils=require(_0xf955('0x14'));var config=require(_0xf955('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf955('0x16'))['db'];config['redis']=_[_0xf955('0x17')](config['redis'],{'host':_0xf955('0x18'),'port':0x18eb});var socket=require(_0xf955('0x19'))(new Redis(config[_0xf955('0x1a')]));require(_0xf955('0x1b'))[_0xf955('0x1c')](socket);function respondWithStatusCode(_0x341b8c,_0x1c3235){_0x1c3235=_0x1c3235||0xcc;return function(_0x2783f2){if(_0x2783f2){return _0x341b8c[_0xf955('0x1d')](_0x1c3235);}return _0x341b8c[_0xf955('0x1e')](_0x1c3235)['end']();};}function respondWithResult(_0xc29b35,_0x54e60b){_0x54e60b=_0x54e60b||0xc8;return function(_0x3139d5){if(_0x3139d5){return _0xc29b35[_0xf955('0x1e')](_0x54e60b)[_0xf955('0x1f')](_0x3139d5);}};}function respondWithFilteredResult(_0x15c07c,_0x50930d){return function(_0x5ac6cb){if(_0x5ac6cb){var _0x1e20d1=_0x5ac6cb[_0xf955('0x20')],_0xe6de5c=_0x50930d[_0xf955('0x21')],_0x3c49c0=_0x50930d[_0xf955('0x21')]+_0x50930d[_0xf955('0x22')],_0x4d7b5b;if(_0x3c49c0>=_0x1e20d1){_0x3c49c0=_0x1e20d1;_0x4d7b5b=0xc8;}else{_0x4d7b5b=0xce;}_0x15c07c[_0xf955('0x1e')](_0x4d7b5b);return _0x15c07c['set'](_0xf955('0x23'),_0xe6de5c+'-'+_0x3c49c0+'/'+_0x1e20d1)[_0xf955('0x1f')](_0x5ac6cb);}return null;};}function patchUpdates(_0xfb8102){return function(_0x488d04){try{jsonpatch[_0xf955('0x24')](_0x488d04,_0xfb8102,!![]);}catch(_0x5daa73){return BPromise[_0xf955('0x25')](_0x5daa73);}return _0x488d04[_0xf955('0x26')]();};}function saveUpdates(_0x37143d,_0xa4ebb4){return function(_0x160071){if(_0x160071){return _0x160071['update'](_0x37143d)[_0xf955('0x27')](function(_0x5fab1c){return _0x5fab1c;});}return null;};}function removeEntity(_0x3585c7,_0x13a1a7){return function(_0x17dec2){if(_0x17dec2){return _0x17dec2[_0xf955('0x28')]()[_0xf955('0x27')](function(){_0x3585c7['status'](0xcc)[_0xf955('0x29')]();});}};}function handleEntityNotFound(_0x1acf33,_0xba8a22){return function(_0x406632){if(!_0x406632){_0x1acf33[_0xf955('0x1d')](0x194);}return _0x406632;};}function handleError(_0x13a86d,_0x3796f7){_0x3796f7=_0x3796f7||0x1f4;return function(_0x51f3ab){logger[_0xf955('0x2a')](_0x51f3ab[_0xf955('0x2b')]);if(_0x51f3ab[_0xf955('0x2c')]){delete _0x51f3ab[_0xf955('0x2c')];}_0x13a86d[_0xf955('0x1e')](_0x3796f7)[_0xf955('0x2d')](_0x51f3ab);};}function getInteractionUsers(_0x4d4af0,_0x2232a7){return new BPromise(function(_0x1e5d37,_0x4ec3e8){try{if(_0x2232a7[_0x4d4af0['id']]){_0x4d4af0[_0xf955('0x2e')]=_[_0xf955('0x2f')](_0x2232a7[_0x4d4af0['id']],function(_0xf3c870){return{'id':_0xf3c870['id'],'fullname':_0xf3c870[_0xf955('0x30')]};});}}catch(_0x59bfb5){_0x4ec3e8(_0x59bfb5);}_0x1e5d37(_0x4d4af0);});}function getInteractionTags(_0x3a951c,_0x518fb3){return new BPromise(function(_0x227104,_0x2c222a){try{if(_0x3a951c[_0xf955('0x31')]){_0x3a951c[_0xf955('0x32')]=[];_0x3a951c[_0xf955('0x31')][_0xf955('0x33')](',')[_0xf955('0x34')](function(_0x366b6d){_0x3a951c['Tags'][_0xf955('0x35')](_0x518fb3[_0x366b6d]);});}delete _0x3a951c[_0xf955('0x31')];}catch(_0x3964d3){_0x2c222a(_0x3964d3);}_0x227104(_0x3a951c);});}function updateWhatsappInteraction(_0x2046c8,_0x4fea0c,_0x23c848){return new BPromise(function(_0x31dad5,_0x3c81bc){return getInteractionUsers(_0x2046c8,_0x23c848)[_0xf955('0x27')](function(_0xdbc53e){return getInteractionTags(_0xdbc53e,_0x4fea0c);})['then'](function(_0x4d7155){_0x31dad5(_0x4d7155);})['catch'](function(_0x2626cb){_0x3c81bc(_0x2626cb);});});}exports[_0xf955('0x36')]=function(_0x374e95,_0x6d564c){var _0x467447={},_0x39de9c={},_0x5acb00={'count':0x0,'rows':[]};var _0x3acc4b=_['map'](db[_0xf955('0x37')][_0xf955('0x38')],function(_0xe33ef2){return{'name':_0xe33ef2['fieldName'],'type':_0xe33ef2[_0xf955('0x39')]['key']};});_0x39de9c[_0xf955('0x3a')]=_[_0xf955('0x2f')](_0x3acc4b,_0xf955('0x2c'));_0x39de9c[_0xf955('0x3b')]=_['keys'](_0x374e95[_0xf955('0x3b')]);_0x39de9c[_0xf955('0x3c')]=_['intersection'](_0x39de9c[_0xf955('0x3a')],_0x39de9c[_0xf955('0x3b')]);_0x467447[_0xf955('0x3d')]=_['intersection'](_0x39de9c[_0xf955('0x3a')],qs[_0xf955('0x3e')](_0x374e95[_0xf955('0x3b')]['fields']));_0x467447[_0xf955('0x3d')]=_0x467447[_0xf955('0x3d')][_0xf955('0x3f')]?_0x467447[_0xf955('0x3d')]:_0x39de9c[_0xf955('0x3a')];if(!_0x374e95[_0xf955('0x3b')][_0xf955('0x40')](_0xf955('0x41'))){_0x467447['limit']=qs[_0xf955('0x22')](_0x374e95[_0xf955('0x3b')][_0xf955('0x22')]);_0x467447[_0xf955('0x21')]=qs[_0xf955('0x21')](_0x374e95[_0xf955('0x3b')][_0xf955('0x21')]);}_0x467447[_0xf955('0x42')]=qs[_0xf955('0x43')](_0x374e95[_0xf955('0x3b')][_0xf955('0x43')]);_0x467447[_0xf955('0x44')]=qs[_0xf955('0x3c')](_[_0xf955('0x45')](_0x374e95[_0xf955('0x3b')],_0x39de9c[_0xf955('0x3c')]),_0x3acc4b);var _0x356ec2=[];var _0x34f0f1=squel[_0xf955('0x46')]()['field']('id')[_0xf955('0x47')](_0xf955('0x2c'))[_0xf955('0x47')]('color')[_0xf955('0x48')]('tools_tags');var _0x398224=squel['select']()[_0xf955('0x47')](_0xf955('0x49'))[_0xf955('0x47')](_0xf955('0x4a'))['field'](_0xf955('0x4b'))[_0xf955('0x48')](_0xf955('0x4c'),'ui')['left_join']('users','u',_0xf955('0x4d'));var _0x314281=squel[_0xf955('0x46')]()[_0xf955('0x48')]('whatsapp_interactions','i')[_0xf955('0x4e')](_0xf955('0x4f'),'c',_0xf955('0x50'))['left_join'](_0xf955('0x51'),'o','o.id\x20=\x20i.UserId')[_0xf955('0x4e')](_0xf955('0x52'),'a',_0xf955('0x53'))['left_join'](_0xf955('0x54'),'me',_0xf955('0x55'))[_0xf955('0x4e')](_0xf955('0x56'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0xf955('0x4e')](_0xf955('0x57'),'t',_0xf955('0x58'));var _0x17e687=squel[_0xf955('0x59')]();var _0x4f5a95=[];var _0x29126c=squel['expr']();var _0x35c23c;if(_0x374e95['query'][_0xf955('0x5a')]){_0x35c23c=as['parseSearch'](_0x374e95['query'][_0xf955('0x5a')]);var _0x45c7fe=_0x35c23c['sqlOperator'];for(var _0x142e8f=0x0;_0x142e8f<_0x35c23c['conditions']['length'];_0x142e8f++){var _0x4c2977=_0x35c23c['conditions'][_0x142e8f];var _0x3c37e2='i';var _0x1abe1c=_['find'](_0x3acc4b,['name',_0x4c2977[_0xf955('0x47')]]);if(!_0x1abe1c){switch(_0x4c2977[_0xf955('0x47')]){case _0xf955('0x5b'):if(_0x4c2977[_0xf955('0x5c')]==0x1){_0x314281[_0xf955('0x5d')]('`'+_0x4c2977[_0xf955('0x47')]+_0xf955('0x5e'));}else{_0x314281[_0xf955('0x5d')]('`'+_0x4c2977[_0xf955('0x47')]+_0xf955('0x5f'));}break;case _0xf955('0x60'):if(_0x4c2977[_0xf955('0x61')]==='$substring'){if(_0x4c2977[_0xf955('0x5c')][_0xf955('0x33')]('\x20')[_0xf955('0x3f')]>0x1){_0x17e687[_0x45c7fe](_0xf955('0x62'),qs[_0xf955('0x63')](_0x4c2977['value']),null);}else{var _0xf5d575='%'+_0x4c2977[_0xf955('0x5c')]+'%';_0x17e687[_0x45c7fe](_0xf955('0x64'),_0xf5d575,_0xf5d575,_0xf5d575);}}else{_0x1abe1c=_[_0xf955('0x65')](_0x3acc4b,[_0xf955('0x2c'),_0xf955('0x66')]);_0x4c2977[_0xf955('0x47')]=_0xf955('0x66');_0x545c1f=as[_0xf955('0x67')](_0x3c37e2,_0x1abe1c[_0xf955('0x39')],_0x4c2977);_0x17e687[_0x45c7fe](_0x545c1f['text'],_0x545c1f[_0xf955('0x5c')][_0xf955('0x68')],_0x545c1f[_0xf955('0x5c')][_0xf955('0x29')]);}break;case _0xf955('0x69'):var _0x3b0e91=_0x4c2977[_0xf955('0x5c')][_0xf955('0x33')](',')[_0xf955('0x2f')](function(_0x26e837){return Number(_0x26e837);});_0x3b0e91[_0xf955('0x34')](function(_0x2b8173){_0x29126c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2b8173+',%');});_0x4f5a95=_[_0xf955('0x6a')](_0x4f5a95,_0x3b0e91);break;case _0xf955('0x6b'):if(_0x4c2977[_0xf955('0x61')]===_0xf955('0x6c')){_0x17e687[_0x45c7fe](_0xf955('0x6d'),'%'+_0x4c2977[_0xf955('0x5c')]+'%',null);}else{_0x1abe1c=_[_0xf955('0x65')](_0x3acc4b,['name','UserId']);_0x4c2977['field']=_0xf955('0x6e');_0x545c1f=as['buildExpression'](_0x3c37e2,_0x1abe1c['type'],_0x4c2977);_0x17e687[_0x45c7fe](_0x545c1f[_0xf955('0x6f')],_0x545c1f['value'][_0xf955('0x68')],_0x545c1f[_0xf955('0x5c')][_0xf955('0x29')]);}break;case _0xf955('0x70'):_0x545c1f=as['buildExpression']('me',null,_0x4c2977);_0x17e687[_0x45c7fe](_0x545c1f[_0xf955('0x6f')],_0x545c1f[_0xf955('0x5c')][_0xf955('0x68')],_0x545c1f[_0xf955('0x5c')][_0xf955('0x29')]);break;}}else{var _0x545c1f=as[_0xf955('0x67')](_0x3c37e2,_0x1abe1c['type'],_0x4c2977);_0x17e687[_0x45c7fe](_0x545c1f[_0xf955('0x6f')],_0x545c1f[_0xf955('0x5c')][_0xf955('0x68')],_0x545c1f['value'][_0xf955('0x29')]);}}}else{var _0x40ca54=_(_0x374e95[_0xf955('0x3b')])[_0xf955('0x71')]()[_0xf955('0x2f')](function(_0x339661){return _[_0xf955('0x72')](_0x3acc4b,['name',_0x339661])?_0x339661:undefined;})['compact']()[_0xf955('0x5c')]();if(!_[_0xf955('0x73')](_0x40ca54)){_0x40ca54[_0xf955('0x34')](function(_0x3f0873){if(_0x3f0873===_0xf955('0x74')){_0x314281[_0xf955('0x44')](_0xf955('0x75'),[][_0xf955('0x76')](_0x374e95[_0xf955('0x3b')][_0x3f0873]));}else if(_0x3f0873===_0xf955('0x77')){var _0x71ee3a=JSON['parse'](_0x374e95[_0xf955('0x3b')][_0x3f0873])['$gte'];var _0x431729=JSON['parse'](_0x374e95['query'][_0x3f0873])[_0xf955('0x78')];_0x314281[_0xf955('0x44')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x71ee3a,_0x431729);}else{if(_0x374e95[_0xf955('0x3b')][_0x3f0873]===_0xf955('0x79')){_0x314281['where']('i.'+_0x3f0873+'\x20IS\x20NULL');}else{_0x314281[_0xf955('0x44')]('i.'+_0x3f0873+_0xf955('0x7a'),_0x374e95[_0xf955('0x3b')][_0x3f0873]);}}});}if(_0x374e95['query'][_0xf955('0x7b')]){if(_0x374e95[_0xf955('0x3b')][_0xf955('0x7b')]==0x1){_0x314281[_0xf955('0x5d')](_0xf955('0x7c'));}else{_0x314281[_0xf955('0x5d')](_0xf955('0x7d'));}}if(_0x374e95[_0xf955('0x3b')]['tag']){_0x4f5a95=_[_0xf955('0x7e')](_0x374e95[_0xf955('0x3b')]['tag'])?_0x374e95[_0xf955('0x3b')][_0xf955('0x7f')]:new Array(_0x374e95[_0xf955('0x3b')][_0xf955('0x7f')]);_0x4f5a95['forEach'](function(_0x2e0d12){_0x29126c['or'](_0xf955('0x80'),'%,'+_0x2e0d12+',%');});}if(_0x374e95['query']['filter']){var _0x2fe31b=_0x374e95[_0xf955('0x3b')][_0xf955('0x81')][_0xf955('0x82')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xf955('0x83')](_0x2fe31b)){_0x17e687['or'](_0xf955('0x84'),_0x2fe31b+'%')['or'](_0xf955('0x85'),_0x2fe31b+'%');}else{_0x17e687['or'](_0xf955('0x86'),qs[_0xf955('0x63')](_0x2fe31b))['or'](_0xf955('0x87'),_0x2fe31b+'%');}}}_0x314281[_0xf955('0x44')](_0x17e687);_0x314281[_0xf955('0x88')](_0xf955('0x89'));var _0x12d8d1={'type':db[_0xf955('0x8a')][_0xf955('0x8b')][_0xf955('0x8c')],'raw':!![]};var _0x5c92ed=_0x314281[_0xf955('0x8d')]();_0x5c92ed[_0xf955('0x47')](_0xf955('0x89'));_0x5c92ed[_0xf955('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf955('0x5b'));if(_0x467447[_0xf955('0x42')]){_0x467447[_0xf955('0x42')][_0xf955('0x34')](function(_0x2b266d){var _0x30df2a=_0x2b266d[0x0]===_0xf955('0x8e')?_0x2b266d[0x0]:'i.'+_0x2b266d[0x0];_0x314281[_0xf955('0x42')](_0x30df2a,_0x2b266d[0x1]===_0xf955('0x8f')?![]:!![]);});}if(!_[_0xf955('0x73')](_0x4f5a95)){_0x314281[_0xf955('0x5d')](_0x29126c);_0x5c92ed['where'](_0xf955('0x90'),_0x4f5a95);}BPromise[_0xf955('0x91')]()[_0xf955('0x27')](function(){if(!_0x35c23c){if(_0x374e95[_0xf955('0x3b')][_0xf955('0x74')])return;_0x5c92ed[_0xf955('0x44')](_0xf955('0x92'));_0x314281['where'](_0xf955('0x92'));return;}if(_0x374e95['user'][_0xf955('0x93')]!=='agent')return;return _0x374e95[_0xf955('0x94')][_0xf955('0x95')]({'attributes':['id'],'raw':!![]})[_0xf955('0x27')](function(_0x147b5c){if(_[_0xf955('0x73')](_0x147b5c)){_0x5c92ed[_0xf955('0x44')]('i.WhatsappAccountId\x20IS\x20NULL');_0x314281[_0xf955('0x44')](_0xf955('0x96'));}else{_0x5c92ed[_0xf955('0x44')]('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x147b5c,'id'));_0x314281[_0xf955('0x44')](_0xf955('0x75'),_[_0xf955('0x2f')](_0x147b5c,'id'));}});})['then'](function(){if(_0x374e95[_0xf955('0x94')]['role']===_0xf955('0x97')&&!_0x35c23c&&!_0x374e95['query'][_0xf955('0x74')])return[];return db[_0xf955('0x98')][_0xf955('0x3b')](_0x5c92ed['toString'](),_0x12d8d1);})[_0xf955('0x27')](function(_0x397f7e){_0x5acb00[_0xf955('0x20')]=_0x397f7e['length'];if(_0x5acb00[_0xf955('0x20')]===0x0)return[];return db[_0xf955('0x98')][_0xf955('0x3b')](_0x34f0f1[_0xf955('0x99')](),_0x12d8d1)[_0xf955('0x27')](function(_0x130e1a){_0x356ec2=_[_0xf955('0x9a')](_0x130e1a,'id');_0x12d8d1=_['merge'](_0x12d8d1,{'model':db[_0xf955('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x374e95[_0xf955('0x3b')][_0xf955('0x3e')]){_0x467447[_0xf955('0x3d')][_0xf955('0x34')](function(_0x585a62){_0x314281[_0xf955('0x47')]('i.'+_0x585a62);});}else{_0x314281[_0xf955('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x314281[_0xf955('0x47')](_0xf955('0x9b'),_0xf955('0x9c'));_0x314281[_0xf955('0x47')]('a.mandatoryDisposition',_0xf955('0x9d'));_0x314281['field']('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',_0xf955('0x8e'));_0x314281[_0xf955('0x47')]('i.*');_0x314281['field'](_0xf955('0x9e'),_0xf955('0x9f'));_0x314281[_0xf955('0x47')]('c.lastName','Contact.lastName');_0x314281[_0xf955('0x47')](_0xf955('0xa0'),_0xf955('0xa1'));_0x314281['field']('c.phone','Contact.phone');_0x314281['field'](_0xf955('0xa2'),'Contact.mobile');_0x314281[_0xf955('0x47')](_0xf955('0xa3'),_0xf955('0xa4'));_0x314281[_0xf955('0x47')](_0xf955('0xa5'),'Owner.fullname');_0x314281[_0xf955('0x47')](_0xf955('0xa6'),_0xf955('0xa7'));_0x314281[_0xf955('0x47')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xf955('0x31'));}if(_0x467447[_0xf955('0x22')])_0x314281['limit'](_0x467447[_0xf955('0x22')]);if(_0x467447[_0xf955('0x21')])_0x314281[_0xf955('0x21')](_0x467447[_0xf955('0x21')]);return db[_0xf955('0x98')][_0xf955('0x3b')](_0x314281['toString'](),_0x12d8d1);})['then'](function(_0x230e2e){_0x398224['where'](_0xf955('0xa8'),_[_0xf955('0x2f')](_0x230e2e,'id'));return db[_0xf955('0x98')][_0xf955('0x3b')](_0x398224['toString'](),_0x12d8d1)['then'](function(_0x7a6712){var _0x12b9f8=_[_0xf955('0xa9')](_0x7a6712,_0xf955('0xaa'));var _0xee52ad=[];_0x230e2e['forEach'](function(_0x21f45e){_0xee52ad[_0xf955('0x35')](updateWhatsappInteraction(_0x21f45e,_0x356ec2,_0x12b9f8));});return BPromise[_0xf955('0xab')](_0xee52ad);});});})[_0xf955('0x27')](function(_0x5ce8b7){_0x5acb00['rows']=_0x5ce8b7;return _0x5acb00;})[_0xf955('0x27')](respondWithFilteredResult(_0x6d564c,_0x467447))[_0xf955('0xac')](handleError(_0x6d564c,null));};exports['show']=function(_0x379f35,_0x41a96e){var _0x395e56={'raw':![],'where':{'id':_0x379f35['params']['id']}},_0x3d7a6={};_0x3d7a6[_0xf955('0x3a')]=_[_0xf955('0x71')](db[_0xf955('0x37')][_0xf955('0x38')]);_0x3d7a6[_0xf955('0x3b')]=_[_0xf955('0x71')](_0x379f35[_0xf955('0x3b')]);_0x3d7a6['filters']=_['intersection'](_0x3d7a6['model'],_0x3d7a6[_0xf955('0x3b')]);_0x395e56[_0xf955('0x3d')]=_[_0xf955('0xad')](_0x3d7a6[_0xf955('0x3a')],qs[_0xf955('0x3e')](_0x379f35[_0xf955('0x3b')][_0xf955('0x3e')]));_0x395e56['attributes']=_0x395e56[_0xf955('0x3d')][_0xf955('0x3f')]?_0x395e56['attributes']:_0x3d7a6[_0xf955('0x3a')];if(_0x379f35[_0xf955('0x3b')][_0xf955('0xae')]){_0x395e56[_0xf955('0xaf')]=[{'all':!![]}];}_0x395e56=_[_0xf955('0xb0')]({},_0x395e56,_0x379f35[_0xf955('0xb1')]);return db[_0xf955('0x37')][_0xf955('0x65')](_0x395e56)['then'](handleEntityNotFound(_0x41a96e,null))['then'](respondWithResult(_0x41a96e,null))['catch'](handleError(_0x41a96e,null));};exports[_0xf955('0xb2')]=function(_0x3945f5,_0x210666){return db[_0xf955('0x37')][_0xf955('0xb2')](_0x3945f5['body'],{})[_0xf955('0x27')](respondWithResult(_0x210666,0xc9))[_0xf955('0xac')](handleError(_0x210666,null));};exports[_0xf955('0xb3')]=function(_0x1e7024,_0x43e078){if(_0x1e7024[_0xf955('0x70')]['id']){delete _0x1e7024[_0xf955('0x70')]['id'];}return db[_0xf955('0x37')][_0xf955('0x65')]({'where':{'id':_0x1e7024['params']['id']}})[_0xf955('0x27')](handleEntityNotFound(_0x43e078,null))['then'](saveUpdates(_0x1e7024[_0xf955('0x70')],null))[_0xf955('0x27')](respondWithResult(_0x43e078,null))[_0xf955('0xac')](handleError(_0x43e078,null));};exports[_0xf955('0x28')]=function(_0x35968b,_0x187fb0){return db[_0xf955('0x37')]['find']({'where':{'id':_0x35968b[_0xf955('0xb4')]['id']}})['then'](handleEntityNotFound(_0x187fb0,null))[_0xf955('0x27')](removeEntity(_0x187fb0,null))[_0xf955('0xac')](handleError(_0x187fb0,null));};exports['describe']=function(_0x3503c6,_0x264576){return db[_0xf955('0x37')][_0xf955('0xb5')]()[_0xf955('0x27')](respondWithResult(_0x264576,null))[_0xf955('0xac')](handleError(_0x264576,null));};exports[_0xf955('0xb6')]=function(_0x5e3870,_0x11fd9e,_0x431c0c){return db['WhatsappMessage'][_0xf955('0x65')]({'where':{'id':_0x5e3870[_0xf955('0xb4')]['id']}})['then'](handleEntityNotFound(_0x11fd9e,null))['then'](function(_0x356eb0){if(_0x356eb0){return _0x356eb0[_0xf955('0xb6')](_0x5e3870[_0xf955('0x70')]['ids'],_[_0xf955('0xb7')](_0x5e3870[_0xf955('0x70')],[_0xf955('0xb8'),'id'])||{});}})[_0xf955('0x27')](respondWithResult(_0x11fd9e,null))[_0xf955('0xac')](handleError(_0x11fd9e,null));};exports[_0xf955('0xb9')]=function(_0x1a2ecc,_0x8d0c5b,_0x2ab571){var _0x210cfb={'raw':![],'where':{}};var _0x42939b={};var _0x41fde7={'count':0x0,'rows':[]};return db[_0xf955('0x37')][_0xf955('0xba')]({'where':{'id':_0x1a2ecc['params']['id']}})['then'](handleEntityNotFound(_0x8d0c5b,null))[_0xf955('0x27')](function(_0xc7cc7b){if(_0xc7cc7b){_0x42939b[_0xf955('0x3a')]=_[_0xf955('0x71')](db[_0xf955('0xbb')]['rawAttributes']);_0x42939b[_0xf955('0x3b')]=_[_0xf955('0x71')](_0x1a2ecc['query']);_0x42939b[_0xf955('0x3c')]=_[_0xf955('0xad')](_0x42939b[_0xf955('0x3a')],_0x42939b[_0xf955('0x3b')]);_0x210cfb['attributes']=_[_0xf955('0xad')](_0x42939b['model'],qs[_0xf955('0x3e')](_0x1a2ecc[_0xf955('0x3b')][_0xf955('0x3e')]));_0x210cfb[_0xf955('0x3d')]=_0x210cfb['attributes'][_0xf955('0x3f')]?_0x210cfb[_0xf955('0x3d')]:_0x42939b[_0xf955('0x3a')];if(!_0x1a2ecc[_0xf955('0x3b')][_0xf955('0x40')]('nolimit')){_0x210cfb[_0xf955('0x22')]=qs[_0xf955('0x22')](_0x1a2ecc[_0xf955('0x3b')]['limit']);_0x210cfb[_0xf955('0x21')]=qs[_0xf955('0x21')](_0x1a2ecc[_0xf955('0x3b')][_0xf955('0x21')]);}_0x210cfb[_0xf955('0x42')]=qs[_0xf955('0x43')](_0x1a2ecc[_0xf955('0x3b')]['sort']);_0x210cfb['where']=qs['filters'](_[_0xf955('0x45')](_0x1a2ecc[_0xf955('0x3b')],_0x42939b['filters']));_0x210cfb[_0xf955('0x44')][_0xf955('0xaa')]=_0xc7cc7b['id'];if(_0x1a2ecc[_0xf955('0x3b')]['filter']){_0x210cfb[_0xf955('0x44')]=_[_0xf955('0xb0')](_0x210cfb['where'],{'$or':_['map'](_0x210cfb[_0xf955('0x3d')],function(_0x8eae44){var _0x184581={};_0x184581[_0x8eae44]={'$like':'%'+_0x1a2ecc[_0xf955('0x3b')][_0xf955('0x81')]+'%'};return _0x184581;})});}if(_0x1a2ecc['query'][_0xf955('0xbc')]){var _0x250a78=_0x1a2ecc[_0xf955('0x3b')][_0xf955('0xbc')][_0xf955('0x33')](',');var _0x480d95={};_0x480d95[_0x250a78[0x0]]={'$gte':moment(_0x250a78[0x1])[_0xf955('0xbd')](_0xf955('0xbe'))};_0x210cfb[_0xf955('0x44')]=_[_0xf955('0xb0')](_0x210cfb['where'],_0x480d95);}_0x210cfb=_[_0xf955('0xb0')]({},_0x210cfb,_0x1a2ecc[_0xf955('0xb1')]);return db[_0xf955('0xbb')][_0xf955('0x20')]({'where':_0x210cfb[_0xf955('0x44')]})['then'](function(_0x702587){_0x41fde7[_0xf955('0x20')]=_0x702587;if(_0x1a2ecc['query'][_0xf955('0xae')]){_0x210cfb[_0xf955('0xaf')]=[{'all':!![]}];}return db[_0xf955('0xbb')][_0xf955('0xbf')](_0x210cfb);})[_0xf955('0x27')](function(_0x38e031){_0x41fde7[_0xf955('0xc0')]=_0x38e031;return _0x41fde7;});}})[_0xf955('0x27')](respondWithFilteredResult(_0x8d0c5b,_0x210cfb))[_0xf955('0xac')](handleError(_0x8d0c5b,null));};exports[_0xf955('0xc1')]=function(_0x478d05,_0x5395aa,_0x3bec17){return db[_0xf955('0x37')][_0xf955('0x65')]({'where':{'id':_0x478d05[_0xf955('0xb4')]['id']}})['then'](handleEntityNotFound(_0x5395aa,null))[_0xf955('0x27')](function(_0x1d4389){if(_0x1d4389){return _0x1d4389['setTags'](_0x478d05['body'][_0xf955('0xb8')],_[_0xf955('0xb7')](_0x478d05[_0xf955('0x70')],[_0xf955('0xb8'),'id'])||{})['spread'](function(){return db[_0xf955('0x69')][_0xf955('0xbf')]({'attributes':['id',_0xf955('0x2c'),_0xf955('0xc2')],'where':{'id':_0x478d05[_0xf955('0x70')][_0xf955('0xb8')]}});})[_0xf955('0x27')](function(_0x3602e8){socket['emit'](_0xf955('0xc3'),{'id':Number(_0x478d05[_0xf955('0xb4')]['id']),'tags':_0x3602e8||[]});return{'id':Number(_0x478d05[_0xf955('0xb4')]['id']),'tags':_0x3602e8||[]};});}})[_0xf955('0x27')](respondWithResult(_0x5395aa,null))[_0xf955('0xac')](handleError(_0x5395aa,null));};exports[_0xf955('0xc4')]=function(_0x2a3339,_0x313107,_0x1f17fb){return db[_0xf955('0x37')]['find']({'where':{'id':_0x2a3339[_0xf955('0xb4')]['id']}})[_0xf955('0x27')](handleEntityNotFound(_0x313107,null))[_0xf955('0x27')](function(_0x27391f){if(_0x27391f){return _0x27391f[_0xf955('0xc4')](_0x2a3339[_0xf955('0x3b')][_0xf955('0xb8')]);}})['then'](respondWithStatusCode(_0x313107,null))[_0xf955('0xac')](handleError(_0x313107,null));};exports['download']=function(_0x2d1e51,_0x2734bd){var _0x14cde9=moment()[_0xf955('0xc5')]()[_0xf955('0x99')]();var _0x621a28=path[_0xf955('0xc6')](config[_0xf955('0xc7')],_0xf955('0xc8'),'files',_0xf955('0xc9'));var _0x2d79a0=path[_0xf955('0xc6')](config[_0xf955('0xc7')],_0xf955('0xc8'),_0xf955('0xca'),'attachments');var _0x23aff1=path[_0xf955('0xc6')](_0x621a28,_0x14cde9);var _0x378c6e=util['format'](_0xf955('0xcb'),_0x2d1e51[_0xf955('0xb4')]['id'],_0x14cde9);var _0x2e5554=path[_0xf955('0xc6')](_0x621a28,_0x378c6e);var _0x3b3c0e=[];_0x3b3c0e[_0xf955('0x35')]({'model':db['User'],'as':_0xf955('0x6b'),'attributes':['id',_0xf955('0x30')],'raw':!![]});_0x3b3c0e[_0xf955('0x35')]({'model':db[_0xf955('0xcc')],'as':_0xf955('0x60'),'attributes':['id',_0xf955('0xcd'),'lastName'],'raw':!![]});if(_0x2d1e51[_0xf955('0x3b')]['attachments']){_0x3b3c0e['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x45c516=[{'model':db['WhatsappMessage'],'as':_0xf955('0xce'),'attributes':['id',_0xf955('0x70'),'createdAt',_0xf955('0xcf'),'secret',_0xf955('0x7b')],'include':_0x3b3c0e}];_0x45c516['push']({'model':db[_0xf955('0xd0')],'as':_0xf955('0xd1'),'attributes':['id',_0xf955('0x2c')]});_0x45c516[_0xf955('0x35')]({'model':db['User'],'as':_0xf955('0xd2'),'attributes':['id','fullname']});return db[_0xf955('0x37')][_0xf955('0x65')]({'where':{'id':_0x2d1e51[_0xf955('0xb4')]['id']},'include':_0x45c516})[_0xf955('0x27')](handleEntityNotFound(_0x2734bd,null))[_0xf955('0x27')](function(_0x3b5869){if(_0x3b5869){var _0x1cc042=_0x3b5869[_0xf955('0xd3')]({'plain':!![]});fs[_0xf955('0xd4')](_0x23aff1);var _0x226161={'format':'A4','border':'10px','header':{'height':_0xf955('0xd5'),'contents':{'first':_0xf955('0xd6')}},'footer':{'height':_0xf955('0xd7'),'contents':{'default':util[_0xf955('0xbd')](_0xf955('0xd8'),util[_0xf955('0xbd')](_0xf955('0xd9'),'Whatsapp',_0x1cc042['id']),moment()[_0xf955('0xbd')](_0xf955('0xda'))[_0xf955('0x99')]())}}};var _0x1e35d7={'channel':_0xf955('0xdb'),'account':_0x1cc042[_0xf955('0xd1')][_0xf955('0x2c')],'agent':_0x1cc042[_0xf955('0xd2')]?_0x1cc042[_0xf955('0xd2')][_0xf955('0x30')]:'N.A.','createdAt':moment(_0x1cc042[_0xf955('0x77')])[_0xf955('0xbd')](_0xf955('0xbe'))[_0xf955('0x99')](),'closedAt':_0x1cc042[_0xf955('0xdc')]?moment(_0x1cc042[_0xf955('0xdd')])[_0xf955('0xbd')](_0xf955('0xbe'))['toString']():'','disposition':_0x1cc042[_0xf955('0xde')],'messages':_(_0x1cc042[_0xf955('0xce')])[_0xf955('0x81')]({'secret':![]})[_0xf955('0x2f')](function(_0x2148f0){if(_0x2148f0[_0xf955('0xdf')]){var _0x206b42=path[_0xf955('0xc6')](_0x2d79a0,_0x2148f0['Attachment']['basename']);if(fs[_0xf955('0xe0')](_0x206b42)){fs[_0xf955('0xe1')](_0x206b42)[_0xf955('0xe2')](fs[_0xf955('0xe3')](path['join'](_0x23aff1,_0x2148f0['Attachment'][_0xf955('0xe4')])));}}return{'date':moment(_0x2148f0[_0xf955('0x77')])['format'](_0xf955('0xbe'))[_0xf955('0x99')](),'sender':_0x2148f0[_0xf955('0xcf')]===_0xf955('0xe5')?_0x2148f0[_0xf955('0x6b')]?_0x2148f0['User'][_0xf955('0x30')]:_0xf955('0xe6'):_0x2148f0[_0xf955('0x60')][_0xf955('0xcd')]+(_0x2148f0[_0xf955('0x60')]['lastName']?'\x20'+_0x2148f0[_0xf955('0x60')]['lastName']:''),'body':_0x2148f0[_0xf955('0xdf')]?_0x2148f0['Attachment'][_0xf955('0xe4')]:_0x2148f0[_0xf955('0x70')],'direction':_0x2148f0[_0xf955('0xcf')]===_0xf955('0xe5')?'A':'C','secret':_0x2148f0[_0xf955('0xe7')],'read':_0x2148f0[_0xf955('0x7b')],'attachment':_0x2148f0[_0xf955('0xdf')]};})[_0xf955('0x5c')]()};return ejs[_0xf955('0xe8')](path[_0xf955('0xc6')](config['root'],'server',_0xf955('0xe9'),_0xf955('0xea')),{'interaction':_0x1e35d7})[_0xf955('0x27')](function(_0x522403){return new BPromise(function(_0x5e6e24,_0x494dda){pdf[_0xf955('0xb2')](_0x522403,_0x226161)['toFile'](path['join'](_0x23aff1,_0xf955('0xeb')+_0x1cc042['id']+'-'+_0x14cde9+'.pdf'),function(_0x2f8e43,_0x1ed1e1){if(_0x2f8e43)return _0x494dda(_0x2f8e43);_0x5e6e24(_0x1ed1e1);});});})['then'](function(){return new BPromise(function(_0x4f7329,_0x161004){zipdir(_0x23aff1,{'saveTo':_0x2e5554},function(_0x2a01fa,_0x1b4ace){if(_0x2a01fa)return _0x161004(_0x2a01fa);return _0x4f7329(_0x1b4ace);});})[_0xf955('0x27')](function(){return new BPromise(function(_0x30e0a1,_0x5cbf1e){rimraf(_0x23aff1,function(_0x143bfd){if(_0x143bfd)_0x5cbf1e(_0x143bfd);return _0x30e0a1();});});})['then'](function(){return _0x2734bd['download'](_0x2e5554,_0x378c6e,function(_0x591585){if(_0x591585){console[_0xf955('0xec')](_0xf955('0xed'),_0x591585);}else{fs[_0xf955('0xee')](_0x2e5554);}});});});}else{return _0x2734bd['sendStatus'](0xc8);}})['catch'](handleError(_0x2734bd,null));}; \ No newline at end of file +var _0x6d38=['root','tmp','join','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','direction','read','WhatsappAccount','Account','get','mkdirSync','10px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Whatsapp','YYYY-MM-DD','Owner','N.A.','closed','closedAt','Messages','existsSync','createReadStream','pipe','out','secret','renderFile','views','toFile','err','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','json','offset','limit','Content-Range','save','update','then','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','catch','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','pick','select','field','color','tools_tags','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','body','keys','some','compact','isEmpty','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`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?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','i.WhatsappAccountId\x20IS\x20NULL','role','sequelize','toString','merge','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','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','params','include','options','create','describe','addMessage','WhatsappMessage','ids','omit','getMessages','sort','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','addTags','setTags','spread','whatsappInteractionTags:save','removeTags','download','unix'];(function(_0x56d7f7,_0x1afa6e){var _0x5a9735=function(_0x43c262){while(--_0x43c262){_0x56d7f7['push'](_0x56d7f7['shift']());}};_0x5a9735(++_0x1afa6e);}(_0x6d38,0x1ef));var _0x86d3=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x6d38[_0x580576];return _0x3f55a0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x86d3('0x0'));var rimraf=require(_0x86d3('0x1'));var zipdir=require(_0x86d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x86d3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x86d3('0x4'));var util=require(_0x86d3('0x5'));var path=require(_0x86d3('0x6'));var sox=require('sox');var csv=require(_0x86d3('0x7'));var ejs=require(_0x86d3('0x8'));var fs=require('fs');var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0x7'));var querystring=require(_0x86d3('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xd'));var qs=require(_0x86d3('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0xf'))(_0x86d3('0x10'));var utils=require('../../config/utils');var config=require(_0x86d3('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x12'))['db'];config[_0x86d3('0x13')]=_[_0x86d3('0x14')](config[_0x86d3('0x13')],{'host':_0x86d3('0x15'),'port':0x18eb});var socket=require(_0x86d3('0x16'))(new Redis(config[_0x86d3('0x13')]));require(_0x86d3('0x17'))['register'](socket);function respondWithStatusCode(_0x1c1ba8,_0x1f35cf){_0x1f35cf=_0x1f35cf||0xcc;return function(_0x356e7d){if(_0x356e7d){return _0x1c1ba8[_0x86d3('0x18')](_0x1f35cf);}return _0x1c1ba8[_0x86d3('0x19')](_0x1f35cf)[_0x86d3('0x1a')]();};}function respondWithResult(_0x1ff008,_0x44436d){_0x44436d=_0x44436d||0xc8;return function(_0x53b437){if(_0x53b437){return _0x1ff008[_0x86d3('0x19')](_0x44436d)[_0x86d3('0x1b')](_0x53b437);}};}function respondWithFilteredResult(_0x431b3f,_0xa26ea2){return function(_0x46feec){if(_0x46feec){var _0x120ef3=_0x46feec['count'],_0x33e459=_0xa26ea2[_0x86d3('0x1c')],_0x32dee7=_0xa26ea2['offset']+_0xa26ea2[_0x86d3('0x1d')],_0x9b76f2;if(_0x32dee7>=_0x120ef3){_0x32dee7=_0x120ef3;_0x9b76f2=0xc8;}else{_0x9b76f2=0xce;}_0x431b3f['status'](_0x9b76f2);return _0x431b3f['set'](_0x86d3('0x1e'),_0x33e459+'-'+_0x32dee7+'/'+_0x120ef3)[_0x86d3('0x1b')](_0x46feec);}return null;};}function patchUpdates(_0x988066){return function(_0x1720ae){try{jsonpatch['apply'](_0x1720ae,_0x988066,!![]);}catch(_0x2901de){return BPromise['reject'](_0x2901de);}return _0x1720ae[_0x86d3('0x1f')]();};}function saveUpdates(_0x3fdf67,_0x1ce849){return function(_0x5b990d){if(_0x5b990d){return _0x5b990d[_0x86d3('0x20')](_0x3fdf67)[_0x86d3('0x21')](function(_0x1fa4ac){return _0x1fa4ac;});}return null;};}function removeEntity(_0x4bf5b8,_0x58ba51){return function(_0x26262a){if(_0x26262a){return _0x26262a['destroy']()[_0x86d3('0x21')](function(){_0x4bf5b8[_0x86d3('0x19')](0xcc)[_0x86d3('0x1a')]();});}};}function handleEntityNotFound(_0x3c5fe4,_0x48b3ff){return function(_0x481077){if(!_0x481077){_0x3c5fe4[_0x86d3('0x18')](0x194);}return _0x481077;};}function handleError(_0x611764,_0x50291c){_0x50291c=_0x50291c||0x1f4;return function(_0x14e325){logger['error'](_0x14e325[_0x86d3('0x22')]);if(_0x14e325[_0x86d3('0x23')]){delete _0x14e325[_0x86d3('0x23')];}_0x611764[_0x86d3('0x19')](_0x50291c)[_0x86d3('0x24')](_0x14e325);};}function getInteractionUsers(_0x14c9ff,_0x1f203e){return new BPromise(function(_0x35d708,_0x303f13){try{if(_0x1f203e[_0x14c9ff['id']]){_0x14c9ff[_0x86d3('0x25')]=_[_0x86d3('0x26')](_0x1f203e[_0x14c9ff['id']],function(_0x1666af){return{'id':_0x1666af['id'],'fullname':_0x1666af[_0x86d3('0x27')]};});}}catch(_0x28c25e){_0x303f13(_0x28c25e);}_0x35d708(_0x14c9ff);});}function getInteractionTags(_0x5b09f6,_0x120a0c){return new BPromise(function(_0x403be3,_0x2bda35){try{if(_0x5b09f6[_0x86d3('0x28')]){_0x5b09f6[_0x86d3('0x29')]=[];_0x5b09f6[_0x86d3('0x28')]['split'](',')[_0x86d3('0x2a')](function(_0x5c71df){_0x5b09f6['Tags'][_0x86d3('0x2b')](_0x120a0c[_0x5c71df]);});}delete _0x5b09f6[_0x86d3('0x28')];}catch(_0x32012a){_0x2bda35(_0x32012a);}_0x403be3(_0x5b09f6);});}function updateWhatsappInteraction(_0x4ca4fc,_0x3866b8,_0x458802){return new BPromise(function(_0x5b8fdd,_0x5505b6){return getInteractionUsers(_0x4ca4fc,_0x458802)[_0x86d3('0x21')](function(_0x414f34){return getInteractionTags(_0x414f34,_0x3866b8);})[_0x86d3('0x21')](function(_0x1196b6){_0x5b8fdd(_0x1196b6);})[_0x86d3('0x2c')](function(_0x2c5ecf){_0x5505b6(_0x2c5ecf);});});}exports[_0x86d3('0x2d')]=function(_0x541309,_0x4cdf45){var _0x536b98={},_0x19cabb={},_0x5990eb={'count':0x0,'rows':[]};var _0x15926f=_['map'](db[_0x86d3('0x2e')][_0x86d3('0x2f')],function(_0x452d49){return{'name':_0x452d49[_0x86d3('0x30')],'type':_0x452d49[_0x86d3('0x31')][_0x86d3('0x32')]};});_0x19cabb[_0x86d3('0x33')]=_['map'](_0x15926f,_0x86d3('0x23'));_0x19cabb[_0x86d3('0x34')]=_['keys'](_0x541309[_0x86d3('0x34')]);_0x19cabb[_0x86d3('0x35')]=_[_0x86d3('0x36')](_0x19cabb[_0x86d3('0x33')],_0x19cabb['query']);_0x536b98[_0x86d3('0x37')]=_[_0x86d3('0x36')](_0x19cabb[_0x86d3('0x33')],qs['fields'](_0x541309[_0x86d3('0x34')][_0x86d3('0x38')]));_0x536b98[_0x86d3('0x37')]=_0x536b98[_0x86d3('0x37')][_0x86d3('0x39')]?_0x536b98[_0x86d3('0x37')]:_0x19cabb[_0x86d3('0x33')];if(!_0x541309[_0x86d3('0x34')]['hasOwnProperty'](_0x86d3('0x3a'))){_0x536b98[_0x86d3('0x1d')]=qs[_0x86d3('0x1d')](_0x541309[_0x86d3('0x34')]['limit']);_0x536b98[_0x86d3('0x1c')]=qs[_0x86d3('0x1c')](_0x541309[_0x86d3('0x34')][_0x86d3('0x1c')]);}_0x536b98['order']=qs['sort'](_0x541309[_0x86d3('0x34')]['sort']);_0x536b98['where']=qs[_0x86d3('0x35')](_[_0x86d3('0x3b')](_0x541309[_0x86d3('0x34')],_0x19cabb[_0x86d3('0x35')]),_0x15926f);var _0x23ef72=[];var _0x581eac=squel[_0x86d3('0x3c')]()[_0x86d3('0x3d')]('id')[_0x86d3('0x3d')]('name')[_0x86d3('0x3d')](_0x86d3('0x3e'))['from'](_0x86d3('0x3f'));var _0xcf6c9e=squel['select']()['field']('u.id')[_0x86d3('0x3d')](_0x86d3('0x40'))[_0x86d3('0x3d')](_0x86d3('0x41'))[_0x86d3('0x42')](_0x86d3('0x43'),'ui')['left_join'](_0x86d3('0x44'),'u',_0x86d3('0x45'));var _0x5d9dad=squel[_0x86d3('0x3c')]()[_0x86d3('0x42')](_0x86d3('0x46'),'i')[_0x86d3('0x47')](_0x86d3('0x48'),'c',_0x86d3('0x49'))['left_join'](_0x86d3('0x44'),'o',_0x86d3('0x4a'))['left_join'](_0x86d3('0x4b'),'a',_0x86d3('0x4c'))[_0x86d3('0x47')](_0x86d3('0x4d'),'me',_0x86d3('0x4e'))['left_join'](_0x86d3('0x4f'),'it',_0x86d3('0x50'))[_0x86d3('0x47')](_0x86d3('0x3f'),'t',_0x86d3('0x51'));var _0x7af7b3=squel[_0x86d3('0x52')]();var _0x734d8e=[];var _0x28054a=squel[_0x86d3('0x52')]();var _0x118552;if(_0x541309[_0x86d3('0x34')]['search']){_0x118552=as[_0x86d3('0x53')](_0x541309[_0x86d3('0x34')]['search']);var _0x43290d=_0x118552[_0x86d3('0x54')];for(var _0x197047=0x0;_0x197047<_0x118552[_0x86d3('0x55')][_0x86d3('0x39')];_0x197047++){var _0x2c0648=_0x118552['conditions'][_0x197047];var _0x4cd179='i';var _0x5b872f=_['find'](_0x15926f,[_0x86d3('0x23'),_0x2c0648[_0x86d3('0x3d')]]);if(!_0x5b872f){switch(_0x2c0648[_0x86d3('0x3d')]){case _0x86d3('0x56'):if(_0x2c0648[_0x86d3('0x57')]==0x1){_0x5d9dad[_0x86d3('0x58')]('`'+_0x2c0648[_0x86d3('0x3d')]+'`\x20=\x200');}else{_0x5d9dad[_0x86d3('0x58')]('`'+_0x2c0648[_0x86d3('0x3d')]+_0x86d3('0x59'));}break;case _0x86d3('0x5a'):if(_0x2c0648[_0x86d3('0x5b')]===_0x86d3('0x5c')){if(_0x2c0648[_0x86d3('0x57')]['split']('\x20')[_0x86d3('0x39')]>0x1){_0x7af7b3[_0x43290d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x86d3('0x5d')](_0x2c0648[_0x86d3('0x57')]),null);}else{var _0xd072f2='%'+_0x2c0648[_0x86d3('0x57')]+'%';_0x7af7b3[_0x43290d](_0x86d3('0x5e'),_0xd072f2,_0xd072f2,_0xd072f2);}}else{_0x5b872f=_['find'](_0x15926f,[_0x86d3('0x23'),_0x86d3('0x5f')]);_0x2c0648[_0x86d3('0x3d')]='ContactId';_0x156960=as['buildExpression'](_0x4cd179,_0x5b872f['type'],_0x2c0648);_0x7af7b3[_0x43290d](_0x156960[_0x86d3('0x60')],_0x156960['value'][_0x86d3('0x61')],_0x156960[_0x86d3('0x57')][_0x86d3('0x1a')]);}break;case _0x86d3('0x62'):var _0x5963bb=_0x2c0648['value']['split'](',')[_0x86d3('0x26')](function(_0x100588){return Number(_0x100588);});_0x5963bb['forEach'](function(_0x3561c5){_0x28054a['or'](_0x86d3('0x63'),'%,'+_0x3561c5+',%');});_0x734d8e=_[_0x86d3('0x64')](_0x734d8e,_0x5963bb);break;case _0x86d3('0x65'):if(_0x2c0648[_0x86d3('0x5b')]==='$substring'){_0x7af7b3[_0x43290d](_0x86d3('0x66'),'%'+_0x2c0648[_0x86d3('0x57')]+'%',null);}else{_0x5b872f=_[_0x86d3('0x67')](_0x15926f,[_0x86d3('0x23'),'UserId']);_0x2c0648[_0x86d3('0x3d')]=_0x86d3('0x68');_0x156960=as['buildExpression'](_0x4cd179,_0x5b872f[_0x86d3('0x31')],_0x2c0648);_0x7af7b3[_0x43290d](_0x156960[_0x86d3('0x60')],_0x156960[_0x86d3('0x57')][_0x86d3('0x61')],_0x156960[_0x86d3('0x57')][_0x86d3('0x1a')]);}break;case _0x86d3('0x69'):_0x156960=as['buildExpression']('me',null,_0x2c0648);_0x7af7b3[_0x43290d](_0x156960['text'],_0x156960[_0x86d3('0x57')]['start'],_0x156960['value']['end']);break;}}else{var _0x156960=as['buildExpression'](_0x4cd179,_0x5b872f[_0x86d3('0x31')],_0x2c0648);_0x7af7b3[_0x43290d](_0x156960['text'],_0x156960[_0x86d3('0x57')][_0x86d3('0x61')],_0x156960[_0x86d3('0x57')]['end']);}}}else{var _0x4c3e66=_(_0x541309[_0x86d3('0x34')])[_0x86d3('0x6a')]()[_0x86d3('0x26')](function(_0x202c2a){return _[_0x86d3('0x6b')](_0x15926f,[_0x86d3('0x23'),_0x202c2a])?_0x202c2a:undefined;})[_0x86d3('0x6c')]()[_0x86d3('0x57')]();if(!_[_0x86d3('0x6d')](_0x4c3e66)){_0x4c3e66[_0x86d3('0x2a')](function(_0x1e3479){if(_0x1e3479===_0x86d3('0x6e')){_0x5d9dad[_0x86d3('0x6f')](_0x86d3('0x70'),[][_0x86d3('0x71')](_0x541309[_0x86d3('0x34')][_0x1e3479]));}else if(_0x1e3479===_0x86d3('0x72')){var _0x301643=JSON['parse'](_0x541309[_0x86d3('0x34')][_0x1e3479])[_0x86d3('0x73')];var _0x42a09b=JSON['parse'](_0x541309[_0x86d3('0x34')][_0x1e3479])[_0x86d3('0x74')];_0x5d9dad[_0x86d3('0x6f')](_0x86d3('0x75'),_0x301643,_0x42a09b);}else{if(_0x541309['query'][_0x1e3479]===_0x86d3('0x76')){_0x5d9dad['where']('i.'+_0x1e3479+_0x86d3('0x77'));}else{_0x5d9dad[_0x86d3('0x6f')]('i.'+_0x1e3479+_0x86d3('0x78'),_0x541309[_0x86d3('0x34')][_0x1e3479]);}}});}if(_0x541309[_0x86d3('0x34')]['read']){if(_0x541309[_0x86d3('0x34')]['read']==0x1){_0x5d9dad[_0x86d3('0x58')](_0x86d3('0x79'));}else{_0x5d9dad['having'](_0x86d3('0x7a'));}}if(_0x541309[_0x86d3('0x34')][_0x86d3('0x7b')]){_0x734d8e=_[_0x86d3('0x7c')](_0x541309[_0x86d3('0x34')][_0x86d3('0x7b')])?_0x541309[_0x86d3('0x34')]['tag']:new Array(_0x541309[_0x86d3('0x34')][_0x86d3('0x7b')]);_0x734d8e[_0x86d3('0x2a')](function(_0x10dfc2){_0x28054a['or'](_0x86d3('0x63'),'%,'+_0x10dfc2+',%');});}if(_0x541309['query'][_0x86d3('0x7d')]){var _0x9444e5=_0x541309['query'][_0x86d3('0x7d')][_0x86d3('0x7e')]('\x5c','\x5c\x5c')[_0x86d3('0x7e')](/'/g,'\x27\x27');if(qs[_0x86d3('0x7f')](_0x9444e5)){_0x7af7b3['or'](_0x86d3('0x80'),_0x9444e5+'%')['or'](_0x86d3('0x81'),_0x9444e5+'%');}else{_0x7af7b3['or'](_0x86d3('0x82'),qs[_0x86d3('0x5d')](_0x9444e5))['or'](_0x86d3('0x83'),_0x9444e5+'%');}}}_0x5d9dad[_0x86d3('0x6f')](_0x7af7b3);_0x5d9dad[_0x86d3('0x84')](_0x86d3('0x85'));var _0x334760={'type':db[_0x86d3('0x86')]['QueryTypes'][_0x86d3('0x87')],'raw':!![]};var _0x3fa37c=_0x5d9dad[_0x86d3('0x88')]();_0x3fa37c[_0x86d3('0x3d')]('i.id');_0x3fa37c[_0x86d3('0x3d')](_0x86d3('0x89'),_0x86d3('0x56'));if(_0x536b98[_0x86d3('0x8a')]){_0x536b98['order']['forEach'](function(_0x234497){var _0x5d09a2=_0x234497[0x0]===_0x86d3('0x8b')?_0x234497[0x0]:'i.'+_0x234497[0x0];_0x5d9dad['order'](_0x5d09a2,_0x234497[0x1]==='DESC'?![]:!![]);});}if(!_[_0x86d3('0x6d')](_0x734d8e)){_0x5d9dad[_0x86d3('0x58')](_0x28054a);_0x3fa37c[_0x86d3('0x6f')](_0x86d3('0x8c'),_0x734d8e);}BPromise[_0x86d3('0x8d')]()['then'](function(){if(!_0x118552){if(_0x541309[_0x86d3('0x34')][_0x86d3('0x6e')])return;_0x3fa37c['where'](_0x86d3('0x8e'));_0x5d9dad[_0x86d3('0x6f')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x541309[_0x86d3('0x8f')]['role']!==_0x86d3('0x90'))return;return _0x541309['user']['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x86d3('0x21')](function(_0x555d95){if(_[_0x86d3('0x6d')](_0x555d95)){_0x3fa37c[_0x86d3('0x6f')](_0x86d3('0x91'));_0x5d9dad[_0x86d3('0x6f')](_0x86d3('0x91'));}else{_0x3fa37c[_0x86d3('0x6f')](_0x86d3('0x70'),_[_0x86d3('0x26')](_0x555d95,'id'));_0x5d9dad['where'](_0x86d3('0x70'),_[_0x86d3('0x26')](_0x555d95,'id'));}});})[_0x86d3('0x21')](function(){if(_0x541309[_0x86d3('0x8f')][_0x86d3('0x92')]==='agent'&&!_0x118552&&!_0x541309[_0x86d3('0x34')][_0x86d3('0x6e')])return[];return db[_0x86d3('0x93')][_0x86d3('0x34')](_0x3fa37c[_0x86d3('0x94')](),_0x334760);})[_0x86d3('0x21')](function(_0x345c22){_0x5990eb['count']=_0x345c22[_0x86d3('0x39')];if(_0x5990eb['count']===0x0)return[];return db[_0x86d3('0x93')]['query'](_0x581eac['toString'](),_0x334760)[_0x86d3('0x21')](function(_0x3e998f){_0x23ef72=_['keyBy'](_0x3e998f,'id');_0x334760=_[_0x86d3('0x95')](_0x334760,{'model':db[_0x86d3('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x541309[_0x86d3('0x34')][_0x86d3('0x38')]){_0x536b98[_0x86d3('0x37')][_0x86d3('0x2a')](function(_0x15635a){_0x5d9dad['field']('i.'+_0x15635a);});}else{_0x5d9dad['field'](_0x86d3('0x89'),_0x86d3('0x56'));_0x5d9dad[_0x86d3('0x3d')](_0x86d3('0x96'),_0x86d3('0x97'));_0x5d9dad[_0x86d3('0x3d')]('a.mandatoryDisposition',_0x86d3('0x98'));_0x5d9dad[_0x86d3('0x3d')](_0x86d3('0x99'),_0x86d3('0x8b'));_0x5d9dad[_0x86d3('0x3d')](_0x86d3('0x9a'));_0x5d9dad[_0x86d3('0x3d')](_0x86d3('0x9b'),_0x86d3('0x9c'));_0x5d9dad['field'](_0x86d3('0x9d'),_0x86d3('0x9e'));_0x5d9dad['field']('c.email',_0x86d3('0x9f'));_0x5d9dad[_0x86d3('0x3d')](_0x86d3('0xa0'),'Contact.phone');_0x5d9dad[_0x86d3('0x3d')](_0x86d3('0xa1'),_0x86d3('0xa2'));_0x5d9dad[_0x86d3('0x3d')](_0x86d3('0xa3'),'Contact.fax');_0x5d9dad[_0x86d3('0x3d')](_0x86d3('0xa4'),'Owner.fullname');_0x5d9dad[_0x86d3('0x3d')](_0x86d3('0xa5'),_0x86d3('0xa6'));_0x5d9dad[_0x86d3('0x3d')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x86d3('0x28'));}if(_0x536b98[_0x86d3('0x1d')])_0x5d9dad[_0x86d3('0x1d')](_0x536b98[_0x86d3('0x1d')]);if(_0x536b98[_0x86d3('0x1c')])_0x5d9dad['offset'](_0x536b98[_0x86d3('0x1c')]);return db[_0x86d3('0x93')][_0x86d3('0x34')](_0x5d9dad[_0x86d3('0x94')](),_0x334760);})[_0x86d3('0x21')](function(_0x2215fc){_0xcf6c9e[_0x86d3('0x6f')](_0x86d3('0xa7'),_[_0x86d3('0x26')](_0x2215fc,'id'));return db[_0x86d3('0x93')]['query'](_0xcf6c9e['toString'](),_0x334760)[_0x86d3('0x21')](function(_0x22b67b){var _0x4ac7b3=_[_0x86d3('0xa8')](_0x22b67b,_0x86d3('0xa9'));var _0x166646=[];_0x2215fc[_0x86d3('0x2a')](function(_0x359c82){_0x166646[_0x86d3('0x2b')](updateWhatsappInteraction(_0x359c82,_0x23ef72,_0x4ac7b3));});return BPromise[_0x86d3('0xaa')](_0x166646);});});})[_0x86d3('0x21')](function(_0x3d7e6f){_0x5990eb['rows']=_0x3d7e6f;return _0x5990eb;})['then'](respondWithFilteredResult(_0x4cdf45,_0x536b98))['catch'](handleError(_0x4cdf45,null));};exports['show']=function(_0xad83bf,_0x2514c1){var _0x28a509={'raw':![],'where':{'id':_0xad83bf[_0x86d3('0xab')]['id']}},_0x3d2b13={};_0x3d2b13[_0x86d3('0x33')]=_[_0x86d3('0x6a')](db['WhatsappInteraction'][_0x86d3('0x2f')]);_0x3d2b13[_0x86d3('0x34')]=_[_0x86d3('0x6a')](_0xad83bf[_0x86d3('0x34')]);_0x3d2b13['filters']=_[_0x86d3('0x36')](_0x3d2b13['model'],_0x3d2b13[_0x86d3('0x34')]);_0x28a509[_0x86d3('0x37')]=_[_0x86d3('0x36')](_0x3d2b13[_0x86d3('0x33')],qs[_0x86d3('0x38')](_0xad83bf['query']['fields']));_0x28a509[_0x86d3('0x37')]=_0x28a509['attributes'][_0x86d3('0x39')]?_0x28a509['attributes']:_0x3d2b13[_0x86d3('0x33')];if(_0xad83bf['query']['includeAll']){_0x28a509[_0x86d3('0xac')]=[{'all':!![]}];}_0x28a509=_[_0x86d3('0x95')]({},_0x28a509,_0xad83bf[_0x86d3('0xad')]);return db[_0x86d3('0x2e')][_0x86d3('0x67')](_0x28a509)[_0x86d3('0x21')](handleEntityNotFound(_0x2514c1,null))[_0x86d3('0x21')](respondWithResult(_0x2514c1,null))[_0x86d3('0x2c')](handleError(_0x2514c1,null));};exports[_0x86d3('0xae')]=function(_0x120a85,_0x25f4c1){return db[_0x86d3('0x2e')][_0x86d3('0xae')](_0x120a85[_0x86d3('0x69')],{})[_0x86d3('0x21')](respondWithResult(_0x25f4c1,0xc9))['catch'](handleError(_0x25f4c1,null));};exports['update']=function(_0x4f79b7,_0xbd8ee7){if(_0x4f79b7[_0x86d3('0x69')]['id']){delete _0x4f79b7[_0x86d3('0x69')]['id'];}return db[_0x86d3('0x2e')][_0x86d3('0x67')]({'where':{'id':_0x4f79b7[_0x86d3('0xab')]['id']}})[_0x86d3('0x21')](handleEntityNotFound(_0xbd8ee7,null))[_0x86d3('0x21')](saveUpdates(_0x4f79b7[_0x86d3('0x69')],null))[_0x86d3('0x21')](respondWithResult(_0xbd8ee7,null))[_0x86d3('0x2c')](handleError(_0xbd8ee7,null));};exports['destroy']=function(_0x4672af,_0x48abbe){return db[_0x86d3('0x2e')][_0x86d3('0x67')]({'where':{'id':_0x4672af[_0x86d3('0xab')]['id']}})[_0x86d3('0x21')](handleEntityNotFound(_0x48abbe,null))['then'](removeEntity(_0x48abbe,null))[_0x86d3('0x2c')](handleError(_0x48abbe,null));};exports[_0x86d3('0xaf')]=function(_0x4d4f9f,_0x909c3){return db[_0x86d3('0x2e')][_0x86d3('0xaf')]()[_0x86d3('0x21')](respondWithResult(_0x909c3,null))[_0x86d3('0x2c')](handleError(_0x909c3,null));};exports[_0x86d3('0xb0')]=function(_0x69cef7,_0x44f26a,_0xfa2fea){return db[_0x86d3('0xb1')][_0x86d3('0x67')]({'where':{'id':_0x69cef7[_0x86d3('0xab')]['id']}})[_0x86d3('0x21')](handleEntityNotFound(_0x44f26a,null))[_0x86d3('0x21')](function(_0x515ebf){if(_0x515ebf){return _0x515ebf[_0x86d3('0xb0')](_0x69cef7[_0x86d3('0x69')][_0x86d3('0xb2')],_[_0x86d3('0xb3')](_0x69cef7['body'],[_0x86d3('0xb2'),'id'])||{});}})['then'](respondWithResult(_0x44f26a,null))['catch'](handleError(_0x44f26a,null));};exports[_0x86d3('0xb4')]=function(_0x2bcabc,_0x44ae59,_0x4246df){var _0x337401={'raw':![],'where':{}};var _0x348c8b={};var _0x34fc17={'count':0x0,'rows':[]};return db[_0x86d3('0x2e')]['findOne']({'where':{'id':_0x2bcabc['params']['id']}})['then'](handleEntityNotFound(_0x44ae59,null))[_0x86d3('0x21')](function(_0x14c617){if(_0x14c617){_0x348c8b[_0x86d3('0x33')]=_['keys'](db[_0x86d3('0xb1')]['rawAttributes']);_0x348c8b[_0x86d3('0x34')]=_[_0x86d3('0x6a')](_0x2bcabc[_0x86d3('0x34')]);_0x348c8b[_0x86d3('0x35')]=_['intersection'](_0x348c8b[_0x86d3('0x33')],_0x348c8b[_0x86d3('0x34')]);_0x337401[_0x86d3('0x37')]=_['intersection'](_0x348c8b['model'],qs['fields'](_0x2bcabc[_0x86d3('0x34')][_0x86d3('0x38')]));_0x337401['attributes']=_0x337401[_0x86d3('0x37')]['length']?_0x337401[_0x86d3('0x37')]:_0x348c8b[_0x86d3('0x33')];if(!_0x2bcabc[_0x86d3('0x34')]['hasOwnProperty'](_0x86d3('0x3a'))){_0x337401[_0x86d3('0x1d')]=qs[_0x86d3('0x1d')](_0x2bcabc[_0x86d3('0x34')][_0x86d3('0x1d')]);_0x337401['offset']=qs[_0x86d3('0x1c')](_0x2bcabc[_0x86d3('0x34')]['offset']);}_0x337401[_0x86d3('0x8a')]=qs[_0x86d3('0xb5')](_0x2bcabc['query'][_0x86d3('0xb5')]);_0x337401['where']=qs['filters'](_[_0x86d3('0x3b')](_0x2bcabc[_0x86d3('0x34')],_0x348c8b[_0x86d3('0x35')]));_0x337401[_0x86d3('0x6f')][_0x86d3('0xa9')]=_0x14c617['id'];if(_0x2bcabc[_0x86d3('0x34')][_0x86d3('0x7d')]){_0x337401[_0x86d3('0x6f')]=_[_0x86d3('0x95')](_0x337401[_0x86d3('0x6f')],{'$or':_[_0x86d3('0x26')](_0x337401[_0x86d3('0x37')],function(_0x25339c){var _0x5564a7={};_0x5564a7[_0x25339c]={'$like':'%'+_0x2bcabc[_0x86d3('0x34')][_0x86d3('0x7d')]+'%'};return _0x5564a7;})});}if(_0x2bcabc[_0x86d3('0x34')][_0x86d3('0x73')]){var _0x3c46aa=_0x2bcabc[_0x86d3('0x34')]['$gte'][_0x86d3('0xb6')](',');var _0x4f2359={};_0x4f2359[_0x3c46aa[0x0]]={'$gte':moment(_0x3c46aa[0x1])[_0x86d3('0xb7')](_0x86d3('0xb8'))};_0x337401['where']=_['merge'](_0x337401[_0x86d3('0x6f')],_0x4f2359);}_0x337401=_[_0x86d3('0x95')]({},_0x337401,_0x2bcabc[_0x86d3('0xad')]);return db['WhatsappMessage']['count']({'where':_0x337401[_0x86d3('0x6f')]})[_0x86d3('0x21')](function(_0x9ee5af){_0x34fc17['count']=_0x9ee5af;if(_0x2bcabc[_0x86d3('0x34')][_0x86d3('0xb9')]){_0x337401[_0x86d3('0xac')]=[{'all':!![]}];}return db[_0x86d3('0xb1')][_0x86d3('0xba')](_0x337401);})[_0x86d3('0x21')](function(_0x12a1f8){_0x34fc17[_0x86d3('0xbb')]=_0x12a1f8;return _0x34fc17;});}})[_0x86d3('0x21')](respondWithFilteredResult(_0x44ae59,_0x337401))[_0x86d3('0x2c')](handleError(_0x44ae59,null));};exports[_0x86d3('0xbc')]=function(_0x490e3c,_0x2c8568,_0x4f639f){return db['WhatsappInteraction'][_0x86d3('0x67')]({'where':{'id':_0x490e3c[_0x86d3('0xab')]['id']}})['then'](handleEntityNotFound(_0x2c8568,null))['then'](function(_0x97a33d){if(_0x97a33d){return _0x97a33d[_0x86d3('0xbd')](_0x490e3c[_0x86d3('0x69')][_0x86d3('0xb2')],_['omit'](_0x490e3c[_0x86d3('0x69')],[_0x86d3('0xb2'),'id'])||{})[_0x86d3('0xbe')](function(){return db[_0x86d3('0x62')][_0x86d3('0xba')]({'attributes':['id','name',_0x86d3('0x3e')],'where':{'id':_0x490e3c[_0x86d3('0x69')][_0x86d3('0xb2')]}});})['then'](function(_0x88a97d){socket['emit'](_0x86d3('0xbf'),{'id':Number(_0x490e3c[_0x86d3('0xab')]['id']),'tags':_0x88a97d||[]});return{'id':Number(_0x490e3c['params']['id']),'tags':_0x88a97d||[]};});}})[_0x86d3('0x21')](respondWithResult(_0x2c8568,null))[_0x86d3('0x2c')](handleError(_0x2c8568,null));};exports[_0x86d3('0xc0')]=function(_0x427ffc,_0x3b9be8,_0x179095){return db['WhatsappInteraction'][_0x86d3('0x67')]({'where':{'id':_0x427ffc['params']['id']}})[_0x86d3('0x21')](handleEntityNotFound(_0x3b9be8,null))[_0x86d3('0x21')](function(_0x2f3fde){if(_0x2f3fde){return _0x2f3fde[_0x86d3('0xc0')](_0x427ffc['query'][_0x86d3('0xb2')]);}})[_0x86d3('0x21')](respondWithStatusCode(_0x3b9be8,null))[_0x86d3('0x2c')](handleError(_0x3b9be8,null));};exports[_0x86d3('0xc1')]=function(_0x2c8911,_0x259a9f){var _0x538dfb=moment()[_0x86d3('0xc2')]()[_0x86d3('0x94')]();var _0x565a8e=path['join'](config[_0x86d3('0xc3')],'server','files',_0x86d3('0xc4'));var _0x983367=path[_0x86d3('0xc5')](config['root'],_0x86d3('0xc6'),_0x86d3('0xc7'),_0x86d3('0xc8'));var _0x313600=path[_0x86d3('0xc5')](_0x565a8e,_0x538dfb);var _0x56d68e=util[_0x86d3('0xb7')](_0x86d3('0xc9'),_0x2c8911['params']['id'],_0x538dfb);var _0x5af513=path['join'](_0x565a8e,_0x56d68e);var _0x434d60=[];_0x434d60['push']({'model':db['User'],'as':_0x86d3('0x65'),'attributes':['id',_0x86d3('0x27')],'raw':!![]});_0x434d60['push']({'model':db['CmContact'],'as':_0x86d3('0x5a'),'attributes':['id',_0x86d3('0xca'),_0x86d3('0xcb')],'raw':!![]});if(_0x2c8911['query'][_0x86d3('0xc8')]){_0x434d60[_0x86d3('0x2b')]({'model':db[_0x86d3('0xcc')],'as':_0x86d3('0xcc'),'raw':!![]});}var _0x245272=[{'model':db[_0x86d3('0xb1')],'as':'Messages','attributes':['id',_0x86d3('0x69'),_0x86d3('0x72'),_0x86d3('0xcd'),'secret',_0x86d3('0xce')],'include':_0x434d60}];_0x245272['push']({'model':db[_0x86d3('0xcf')],'as':_0x86d3('0xd0'),'attributes':['id',_0x86d3('0x23')]});_0x245272[_0x86d3('0x2b')]({'model':db['User'],'as':'Owner','attributes':['id',_0x86d3('0x27')]});return db[_0x86d3('0x2e')][_0x86d3('0x67')]({'where':{'id':_0x2c8911[_0x86d3('0xab')]['id']},'include':_0x245272})[_0x86d3('0x21')](handleEntityNotFound(_0x259a9f,null))[_0x86d3('0x21')](function(_0x10d623){if(_0x10d623){var _0x533c3d=_0x10d623[_0x86d3('0xd1')]({'plain':!![]});fs[_0x86d3('0xd2')](_0x313600);var _0x303176={'format':'A4','border':_0x86d3('0xd3'),'header':{'height':'40px','contents':{'first':_0x86d3('0xd4')}},'footer':{'height':'30px','contents':{'default':util[_0x86d3('0xb7')](_0x86d3('0xd5'),util[_0x86d3('0xb7')]('%s\x20#%d',_0x86d3('0xd6'),_0x533c3d['id']),moment()[_0x86d3('0xb7')](_0x86d3('0xd7'))['toString']())}}};var _0x536628={'channel':_0x86d3('0xd6'),'account':_0x533c3d['Account'][_0x86d3('0x23')],'agent':_0x533c3d[_0x86d3('0xd8')]?_0x533c3d['Owner'][_0x86d3('0x27')]:_0x86d3('0xd9'),'createdAt':moment(_0x533c3d[_0x86d3('0x72')])['format'](_0x86d3('0xb8'))[_0x86d3('0x94')](),'closedAt':_0x533c3d[_0x86d3('0xda')]?moment(_0x533c3d[_0x86d3('0xdb')])['format'](_0x86d3('0xb8'))[_0x86d3('0x94')]():'','disposition':_0x533c3d['disposition'],'messages':_(_0x533c3d[_0x86d3('0xdc')])[_0x86d3('0x7d')]({'secret':![]})[_0x86d3('0x26')](function(_0x3bef59){if(_0x3bef59[_0x86d3('0xcc')]){var _0x1b4b8e=path[_0x86d3('0xc5')](_0x983367,_0x3bef59[_0x86d3('0xcc')]['basename']);if(fs[_0x86d3('0xdd')](_0x1b4b8e)){fs[_0x86d3('0xde')](_0x1b4b8e)[_0x86d3('0xdf')](fs['createWriteStream'](path[_0x86d3('0xc5')](_0x313600,_0x3bef59[_0x86d3('0xcc')]['basename'])));}}return{'date':moment(_0x3bef59[_0x86d3('0x72')])[_0x86d3('0xb7')](_0x86d3('0xb8'))[_0x86d3('0x94')](),'sender':_0x3bef59[_0x86d3('0xcd')]==='out'?_0x3bef59['User']?_0x3bef59['User']['fullname']:'System':_0x3bef59[_0x86d3('0x5a')][_0x86d3('0xca')]+(_0x3bef59[_0x86d3('0x5a')]['lastName']?'\x20'+_0x3bef59[_0x86d3('0x5a')][_0x86d3('0xcb')]:''),'body':_0x3bef59[_0x86d3('0xcc')]?_0x3bef59[_0x86d3('0xcc')]['basename']:_0x3bef59[_0x86d3('0x69')],'direction':_0x3bef59['direction']===_0x86d3('0xe0')?'A':'C','secret':_0x3bef59[_0x86d3('0xe1')],'read':_0x3bef59[_0x86d3('0xce')],'attachment':_0x3bef59['Attachment']};})['value']()};return ejs[_0x86d3('0xe2')](path['join'](config[_0x86d3('0xc3')],_0x86d3('0xc6'),_0x86d3('0xe3'),'downloadInteraction.html'),{'interaction':_0x536628})[_0x86d3('0x21')](function(_0x58168a){return new BPromise(function(_0x1aedcc,_0x37d1a3){pdf[_0x86d3('0xae')](_0x58168a,_0x303176)[_0x86d3('0xe4')](path['join'](_0x313600,'transcript-'+_0x533c3d['id']+'-'+_0x538dfb+'.pdf'),function(_0x2261f2,_0x5dd421){if(_0x2261f2)return _0x37d1a3(_0x2261f2);_0x1aedcc(_0x5dd421);});});})['then'](function(){return new BPromise(function(_0x457ed0,_0x1bbf44){zipdir(_0x313600,{'saveTo':_0x5af513},function(_0x5097e3,_0x163ad6){if(_0x5097e3)return _0x1bbf44(_0x5097e3);return _0x457ed0(_0x163ad6);});})[_0x86d3('0x21')](function(){return new BPromise(function(_0x4993a2,_0x2b5fa1){rimraf(_0x313600,function(_0x22e51a){if(_0x22e51a)_0x2b5fa1(_0x22e51a);return _0x4993a2();});});})[_0x86d3('0x21')](function(){return _0x259a9f[_0x86d3('0xc1')](_0x5af513,_0x56d68e,function(_0x456e72){if(_0x456e72){console['log'](_0x86d3('0xe5'),_0x456e72);}else{fs['unlinkSync'](_0x5af513);}});});});}else{return _0x259a9f[_0x86d3('0x18')](0xc8);}})['catch'](handleError(_0x259a9f,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 5145bd9..d3c06ec 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 _0xa061=['findAll','setDataValue','unreadMessages','length','catch','hook','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','update','remove','then','Users','map'];(function(_0x799914,_0x5bf140){var _0x4a853b=function(_0x4ac45d){while(--_0x4ac45d){_0x799914['push'](_0x799914['shift']());}};_0x4a853b(++_0x5bf140);}(_0xa061,0x76));var _0x1a06=function(_0x3c7ae2,_0x5504e3){_0x3c7ae2=_0x3c7ae2-0x0;var _0x39f0d7=_0xa061[_0x3c7ae2];return _0x39f0d7;};'use strict';var EventEmitter=require(_0x1a06('0x0'));var WhatsappInteraction=require(_0x1a06('0x1'))['db'][_0x1a06('0x2')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x1a06('0x3')](0x0);var events={'afterCreate':_0x1a06('0x4'),'afterUpdate':_0x1a06('0x5'),'afterDestroy':_0x1a06('0x6')};function emitEvent(_0x4208c7){return function(_0x2bf1fb,_0x2b73dc,_0x50eac0){_0x2bf1fb['getUsers']({'attributes':['id'],'raw':!![]})[_0x1a06('0x7')](function(_0x37036b){_0x2bf1fb['setDataValue'](_0x1a06('0x8'),_0x37036b[_0x1a06('0x9')](function(_0x5a7469){return{'id':_0x5a7469['id']};}));return WhatsappMessage[_0x1a06('0xa')]({'where':{'WhatsappInteractionId':_0x2bf1fb['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2a42ff){_0x2bf1fb[_0x1a06('0xb')](_0x1a06('0xc'),_0x2a42ff[_0x1a06('0xd')]);WhatsappInteractionEvents['emit'](_0x4208c7+':'+_0x2bf1fb['id'],_0x2bf1fb);WhatsappInteractionEvents['emit'](_0x4208c7,_0x2bf1fb);_0x50eac0(null);})[_0x1a06('0xe')](_0x50eac0(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x1a06('0xf')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x718a=['emit','catch','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','getUsers','setDataValue','Users','findAll','unreadMessages'];(function(_0x1892aa,_0x333158){var _0x1d02a2=function(_0x18a790){while(--_0x18a790){_0x1892aa['push'](_0x1892aa['shift']());}};_0x1d02a2(++_0x333158);}(_0x718a,0x114));var _0xa718=function(_0x29a09d,_0x424b73){_0x29a09d=_0x29a09d-0x0;var _0x484938=_0x718a[_0x29a09d];return _0x484938;};'use strict';var EventEmitter=require(_0xa718('0x0'));var WhatsappInteraction=require(_0xa718('0x1'))['db'][_0xa718('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0xa718('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xa718('0x4')](0x0);var events={'afterCreate':_0xa718('0x5'),'afterUpdate':'update','afterDestroy':_0xa718('0x6')};function emitEvent(_0x21e58e){return function(_0x9f1d2,_0x1f9e77,_0x1e1866){_0x9f1d2[_0xa718('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4174bc){_0x9f1d2[_0xa718('0x8')](_0xa718('0x9'),_0x4174bc['map'](function(_0x1077fb){return{'id':_0x1077fb['id']};}));return WhatsappMessage[_0xa718('0xa')]({'where':{'WhatsappInteractionId':_0x9f1d2['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x24d2f7){_0x9f1d2[_0xa718('0x8')](_0xa718('0xb'),_0x24d2f7['length']);WhatsappInteractionEvents[_0xa718('0xc')](_0x21e58e+':'+_0x9f1d2['id'],_0x9f1d2);WhatsappInteractionEvents[_0xa718('0xc')](_0x21e58e,_0x9f1d2);_0x1e1866(null);})[_0xa718('0xd')](_0x1e1866(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xa718('0xe')](e,emitEvent(event));}}module[_0xa718('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index e2ff946..466099e 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 _0x5237=['request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird'];(function(_0x499e56,_0xdd277d){var _0x415458=function(_0x3c57e6){while(--_0x3c57e6){_0x499e56['push'](_0x499e56['shift']());}};_0x415458(++_0xdd277d);}(_0x5237,0x1b5));var _0x7523=function(_0x4b5f52,_0x272a2a){_0x4b5f52=_0x4b5f52-0x0;var _0x2b30c6=_0x5237[_0x4b5f52];return _0x2b30c6;};'use strict';var _=require(_0x7523('0x0'));var util=require(_0x7523('0x1'));var logger=require('../../config/logger')(_0x7523('0x2'));var moment=require(_0x7523('0x3'));var BPromise=require(_0x7523('0x4'));var rp=require(_0x7523('0x5'));var fs=require('fs');var path=require(_0x7523('0x6'));var rimraf=require(_0x7523('0x7'));var config=require(_0x7523('0x8'));var attributes=require(_0x7523('0x9'));module[_0x7523('0xa')]=function(_0xbc92e8,_0x1a3260){return _0xbc92e8[_0x7523('0xb')]('WhatsappInteraction',attributes,{'tableName':_0x7523('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x728398,_0x12c1b7,_0x23bfc6){if(_0x728398[_0x7523('0xd')]('closed')){_0x728398[_0x7523('0xe')]=moment()[_0x7523('0xf')](_0x7523('0x10'));}_0x23bfc6(null,_0x728398);}}});}; \ No newline at end of file +var _0x023a=['path','rimraf','../../config/environment','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0x023a,0xe8));var _0xa023=function(_0x127989,_0x4e3e64){_0x127989=_0x127989-0x0;var _0x42ee03=_0x023a[_0x127989];return _0x42ee03;};'use strict';var _=require(_0xa023('0x0'));var util=require(_0xa023('0x1'));var logger=require(_0xa023('0x2'))(_0xa023('0x3'));var moment=require(_0xa023('0x4'));var BPromise=require('bluebird');var rp=require(_0xa023('0x5'));var fs=require('fs');var path=require(_0xa023('0x6'));var rimraf=require(_0xa023('0x7'));var config=require(_0xa023('0x8'));var attributes=require('./whatsappInteraction.attributes');module[_0xa023('0x9')]=function(_0x44a05e,_0xa8ef5c){return _0x44a05e[_0xa023('0xa')](_0xa023('0xb'),attributes,{'tableName':_0xa023('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a24c1,_0x51a10f,_0x4298f6){if(_0x5a24c1[_0xa023('0xd')](_0xa023('0xe'))){_0x5a24c1['closedAt']=moment()[_0xa023('0xf')](_0xa023('0x10'));}_0x4298f6(null,_0x5a24c1);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index b02c56b..dd5a91a 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 _0xf3a3=['AddTagsToWhatsappInteraction','find','addTags','ids','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','where','attributes','stringify'];(function(_0x567445,_0x215324){var _0xd57b79=function(_0x3b55b1){while(--_0x3b55b1){_0x567445['push'](_0x567445['shift']());}};_0xd57b79(++_0x215324);}(_0xf3a3,0x116));var _0x3f3a=function(_0x1d46e1,_0x179121){_0x1d46e1=_0x1d46e1-0x0;var _0x53fc44=_0xf3a3[_0x1d46e1];return _0x53fc44;};'use strict';var _=require(_0x3f3a('0x0'));var util=require(_0x3f3a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3f3a('0x2'));var fs=require('fs');var Redis=require(_0x3f3a('0x3'));var db=require(_0x3f3a('0x4'))['db'];var utils=require(_0x3f3a('0x5'));var logger=require('../../config/logger')(_0x3f3a('0x6'));var config=require('../../config/environment');var jayson=require(_0x3f3a('0x7'));var client=jayson[_0x3f3a('0x8')][_0x3f3a('0x9')]({'port':0x232a});config[_0x3f3a('0xa')]=_[_0x3f3a('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3f3a('0xc'))(new Redis(config[_0x3f3a('0xa')]));require(_0x3f3a('0xd'))[_0x3f3a('0xe')](socket);function respondWithRpcPromise(_0x50cb37,_0x5caccc,_0x511354){return new BPromise(function(_0x4f95ee,_0x4b8b3e){return client[_0x3f3a('0xf')](_0x50cb37,_0x511354)[_0x3f3a('0x10')](function(_0xa30a0b){logger[_0x3f3a('0x11')](_0x3f3a('0x12'),_0x5caccc,_0x3f3a('0x13'));logger[_0x3f3a('0x14')](_0x3f3a('0x15'),_0x5caccc,'request\x20sent',JSON['stringify'](_0xa30a0b));if(_0xa30a0b[_0x3f3a('0x16')]){if(_0xa30a0b[_0x3f3a('0x16')]['code']===0x1f4){logger[_0x3f3a('0x16')](_0x3f3a('0x12'),_0x5caccc,_0xa30a0b[_0x3f3a('0x16')][_0x3f3a('0x17')]);return _0x4b8b3e(_0xa30a0b['error'][_0x3f3a('0x17')]);}logger[_0x3f3a('0x16')](_0x3f3a('0x12'),_0x5caccc,_0xa30a0b[_0x3f3a('0x16')][_0x3f3a('0x17')]);return _0x4f95ee(_0xa30a0b[_0x3f3a('0x16')][_0x3f3a('0x17')]);}else{logger[_0x3f3a('0x11')](_0x3f3a('0x12'),_0x5caccc,_0x3f3a('0x13'));_0x4f95ee(_0xa30a0b[_0x3f3a('0x18')][_0x3f3a('0x17')]);}})[_0x3f3a('0x19')](function(_0x140221){logger[_0x3f3a('0x16')](_0x3f3a('0x12'),_0x5caccc,_0x140221);_0x4b8b3e(_0x140221);});});}exports[_0x3f3a('0x1a')]=function(_0x54d9d4){var _0x507676=this;return new Promise(function(_0x1a0c5b,_0x5c0c6b){return db[_0x3f3a('0x1b')]['update'](_0x54d9d4[_0x3f3a('0x1c')],{'raw':_0x54d9d4['options']?_0x54d9d4[_0x3f3a('0x1d')][_0x3f3a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54d9d4[_0x3f3a('0x1d')]?_0x54d9d4[_0x3f3a('0x1d')][_0x3f3a('0x1f')]||null:null,'attributes':_0x54d9d4[_0x3f3a('0x1d')]?_0x54d9d4[_0x3f3a('0x1d')][_0x3f3a('0x20')]||null:null,'limit':_0x54d9d4['options']?_0x54d9d4['options']['limit']||null:null})['then'](function(_0x41df46){logger[_0x3f3a('0x11')](_0x3f3a('0x1a'),_0x54d9d4);logger[_0x3f3a('0x14')](_0x3f3a('0x1a'),_0x54d9d4,JSON[_0x3f3a('0x21')](_0x41df46));_0x1a0c5b(_0x41df46);})[_0x3f3a('0x19')](function(_0x25b117){logger[_0x3f3a('0x16')](_0x3f3a('0x1a'),_0x25b117[_0x3f3a('0x17')],_0x54d9d4);_0x5c0c6b(_0x507676['error'](0x1f4,_0x25b117[_0x3f3a('0x17')]));});});};exports[_0x3f3a('0x22')]=function(_0x7c9371){return new Promise(function(_0x3972ed,_0x478860){return db[_0x3f3a('0x1b')][_0x3f3a('0x23')]({'where':_0x7c9371['options']?_0x7c9371[_0x3f3a('0x1d')][_0x3f3a('0x1f')]||null:null})[_0x3f3a('0x10')](function(_0x3be13c){if(_0x3be13c){return _0x3be13c[_0x3f3a('0x24')](_0x7c9371[_0x3f3a('0x1c')]['ids'],_['omit'](_0x7c9371[_0x3f3a('0x1c')],[_0x3f3a('0x25'),'id'])||{});}})['spread'](function(_0x28727c){logger[_0x3f3a('0x11')](_0x3f3a('0x26'),_0x7c9371);logger[_0x3f3a('0x14')](_0x3f3a('0x26'),_0x7c9371,JSON[_0x3f3a('0x21')](_0x28727c));_0x3972ed(_0x28727c);})['catch'](function(_0x202b08){logger[_0x3f3a('0x16')](_0x3f3a('0x26'),_0x202b08['message'],_0x7c9371);_0x478860(_this[_0x3f3a('0x16')](0x1f4,_0x202b08[_0x3f3a('0x17')]));});});}; \ No newline at end of file +var _0xdfb3=['http','defaults','redis','localhost','./whatsappInteraction.socket','request','WhatsappInteraction,\x20%s,\x20%s','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','stringify','AddTagsToWhatsappInteraction','find','then','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x575934,_0x4a6760){var _0x109a3d=function(_0x1c20a1){while(--_0x1c20a1){_0x575934['push'](_0x575934['shift']());}};_0x109a3d(++_0x4a6760);}(_0xdfb3,0x1b9));var _0x3dfb=function(_0x510508,_0x30b4d2){_0x510508=_0x510508-0x0;var _0x486a65=_0xdfb3[_0x510508];return _0x486a65;};'use strict';var _=require(_0x3dfb('0x0'));var util=require(_0x3dfb('0x1'));var moment=require(_0x3dfb('0x2'));var BPromise=require(_0x3dfb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3dfb('0x4'));var db=require(_0x3dfb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3dfb('0x6'))('rpc');var config=require(_0x3dfb('0x7'));var jayson=require(_0x3dfb('0x8'));var client=jayson[_0x3dfb('0x9')][_0x3dfb('0xa')]({'port':0x232a});config['redis']=_[_0x3dfb('0xb')](config[_0x3dfb('0xc')],{'host':_0x3dfb('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3dfb('0xc')]));require(_0x3dfb('0xe'))['register'](socket);function respondWithRpcPromise(_0x31e0e5,_0x188dc8,_0x5693c1){return new BPromise(function(_0x2fcf72,_0xf495b6){return client[_0x3dfb('0xf')](_0x31e0e5,_0x5693c1)['then'](function(_0x3b2e87){logger['info'](_0x3dfb('0x10'),_0x188dc8,'request\x20sent');logger['debug'](_0x3dfb('0x11'),_0x188dc8,_0x3dfb('0x12'),JSON['stringify'](_0x3b2e87));if(_0x3b2e87[_0x3dfb('0x13')]){if(_0x3b2e87[_0x3dfb('0x13')][_0x3dfb('0x14')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x188dc8,_0x3b2e87[_0x3dfb('0x13')][_0x3dfb('0x15')]);return _0xf495b6(_0x3b2e87[_0x3dfb('0x13')]['message']);}logger['error'](_0x3dfb('0x10'),_0x188dc8,_0x3b2e87[_0x3dfb('0x13')][_0x3dfb('0x15')]);return _0x2fcf72(_0x3b2e87[_0x3dfb('0x13')][_0x3dfb('0x15')]);}else{logger[_0x3dfb('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x188dc8,_0x3dfb('0x12'));_0x2fcf72(_0x3b2e87[_0x3dfb('0x17')][_0x3dfb('0x15')]);}})[_0x3dfb('0x18')](function(_0x4246fd){logger[_0x3dfb('0x13')](_0x3dfb('0x10'),_0x188dc8,_0x4246fd);_0xf495b6(_0x4246fd);});});}exports[_0x3dfb('0x19')]=function(_0x4bd7a1){var _0x1c1ee1=this;return new Promise(function(_0x99271d,_0x975244){return db[_0x3dfb('0x1a')][_0x3dfb('0x1b')](_0x4bd7a1['body'],{'raw':_0x4bd7a1['options']?_0x4bd7a1[_0x3dfb('0x1c')][_0x3dfb('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bd7a1[_0x3dfb('0x1c')]?_0x4bd7a1['options'][_0x3dfb('0x1e')]||null:null,'attributes':_0x4bd7a1[_0x3dfb('0x1c')]?_0x4bd7a1['options']['attributes']||null:null,'limit':_0x4bd7a1[_0x3dfb('0x1c')]?_0x4bd7a1[_0x3dfb('0x1c')]['limit']||null:null})['then'](function(_0x53262f){logger[_0x3dfb('0x16')](_0x3dfb('0x19'),_0x4bd7a1);logger['debug'](_0x3dfb('0x19'),_0x4bd7a1,JSON[_0x3dfb('0x1f')](_0x53262f));_0x99271d(_0x53262f);})[_0x3dfb('0x18')](function(_0x2e2d9c){logger[_0x3dfb('0x13')]('UpdateWhatsappInteraction',_0x2e2d9c[_0x3dfb('0x15')],_0x4bd7a1);_0x975244(_0x1c1ee1[_0x3dfb('0x13')](0x1f4,_0x2e2d9c[_0x3dfb('0x15')]));});});};exports[_0x3dfb('0x20')]=function(_0x858fb7){return new Promise(function(_0x58d541,_0x4042f1){return db[_0x3dfb('0x1a')][_0x3dfb('0x21')]({'where':_0x858fb7[_0x3dfb('0x1c')]?_0x858fb7[_0x3dfb('0x1c')][_0x3dfb('0x1e')]||null:null})[_0x3dfb('0x22')](function(_0x1b0ada){if(_0x1b0ada){return _0x1b0ada[_0x3dfb('0x23')](_0x858fb7[_0x3dfb('0x24')][_0x3dfb('0x25')],_[_0x3dfb('0x26')](_0x858fb7[_0x3dfb('0x24')],[_0x3dfb('0x25'),'id'])||{});}})[_0x3dfb('0x27')](function(_0x541cd9){logger[_0x3dfb('0x16')](_0x3dfb('0x28'),_0x858fb7);logger['debug'](_0x3dfb('0x28'),_0x858fb7,JSON[_0x3dfb('0x1f')](_0x541cd9));_0x58d541(_0x541cd9);})['catch'](function(_0x157358){logger[_0x3dfb('0x13')]('AddTags',_0x157358['message'],_0x858fb7);_0x4042f1(_this[_0x3dfb('0x13')](0x1f4,_0x157358[_0x3dfb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 7349614..b5c7fb5 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 _0x246f=['update','removeListener','length','whatsappInteraction:','remove'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0x246f,0x15d));var _0xf246=function(_0x2f8d94,_0x3606b4){_0x2f8d94=_0x2f8d94-0x0;var _0x3a3643=_0x246f[_0x2f8d94];return _0x3a3643;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0xf246('0x0'),_0xf246('0x1')];function createListener(_0xfa03fb,_0xee6dea){return function(_0x3fd7d2){_0xee6dea['emit'](_0xfa03fb,_0x3fd7d2);};}function removeListener(_0x221a0b,_0x2e4436){return function(){WhatsappInteractionEvents[_0xf246('0x2')](_0x221a0b,_0x2e4436);};}exports['register']=function(_0x33ce43){for(var _0x440ffd=0x0,_0x3a13b0=events[_0xf246('0x3')];_0x440ffd<_0x3a13b0;_0x440ffd++){var _0x2e203f=events[_0x440ffd];var _0x5b82df=createListener(_0xf246('0x4')+_0x2e203f,_0x33ce43);WhatsappInteractionEvents['on'](_0x2e203f,_0x5b82df);}}; \ No newline at end of file +var _0x5f5e=['removeListener','register','whatsappInteraction:','./whatsappInteraction.events','save','emit'];(function(_0x53bdf1,_0x279555){var _0x19839a=function(_0x20b61b){while(--_0x20b61b){_0x53bdf1['push'](_0x53bdf1['shift']());}};_0x19839a(++_0x279555);}(_0x5f5e,0x17d));var _0xe5f5=function(_0x3ae605,_0x38eadc){_0x3ae605=_0x3ae605-0x0;var _0x44750b=_0x5f5e[_0x3ae605];return _0x44750b;};'use strict';var WhatsappInteractionEvents=require(_0xe5f5('0x0'));var events=[_0xe5f5('0x1'),'remove','update'];function createListener(_0x3469e9,_0x1eb492){return function(_0x18aee7){_0x1eb492[_0xe5f5('0x2')](_0x3469e9,_0x18aee7);};}function removeListener(_0x488c21,_0x489724){return function(){WhatsappInteractionEvents[_0xe5f5('0x3')](_0x488c21,_0x489724);};}exports[_0xe5f5('0x4')]=function(_0x1b1530){for(var _0x554c41=0x0,_0x3fd516=events['length'];_0x554c41<_0x3fd516;_0x554c41++){var _0x3fb8b7=events[_0x554c41];var _0x283455=createListener(_0xe5f5('0x5')+_0x3fb8b7,_0x1b1530);WhatsappInteractionEvents['on'](_0x3fb8b7,_0x283455);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 36b23bc..c15da4d 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 _0xadf4=['isAuthenticated','describe','get','/:id','whatsappmessage:create','create','post','/:id/status','status','put','update','accept','/:id/reject','reject','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe'];(function(_0x1ebd88,_0xa36159){var _0x27189e=function(_0x9e24d0){while(--_0x9e24d0){_0x1ebd88['push'](_0x1ebd88['shift']());}};_0x27189e(++_0xa36159);}(_0xadf4,0x8d));var _0x4adf=function(_0x5a7e3c,_0xdc9219){_0x5a7e3c=_0x5a7e3c-0x0;var _0x59252b=_0xadf4[_0x5a7e3c];return _0x59252b;};'use strict';var multer=require('multer');var util=require(_0x4adf('0x0'));var path=require(_0x4adf('0x1'));var timeout=require(_0x4adf('0x2'));var express=require('express');var router=express[_0x4adf('0x3')]();var auth=require(_0x4adf('0x4'));var interaction=require(_0x4adf('0x5'));var config=require(_0x4adf('0x6'));var controller=require('./whatsappMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4adf('0x7')]);router['get'](_0x4adf('0x8'),auth[_0x4adf('0x9')](),controller[_0x4adf('0xa')]);router[_0x4adf('0xb')](_0x4adf('0xc'),auth[_0x4adf('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0x4adf('0xd')),controller[_0x4adf('0xe')]);router[_0x4adf('0xf')](_0x4adf('0x10'),controller[_0x4adf('0x11')]);router[_0x4adf('0x12')]('/:id',auth[_0x4adf('0x9')](),controller[_0x4adf('0x13')]);router[_0x4adf('0x12')]('/:id/accept',auth[_0x4adf('0x9')](),controller[_0x4adf('0x14')]);router[_0x4adf('0x12')](_0x4adf('0x15'),auth[_0x4adf('0x9')](),controller[_0x4adf('0x16')]);router['delete'](_0x4adf('0xc'),auth[_0x4adf('0x9')](),controller[_0x4adf('0x17')]);module[_0x4adf('0x18')]=router; \ No newline at end of file +var _0x71fa=['get','describe','/:id','post','whatsapp','whatsappmessage:create','create','put','update','accept','reject','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x2d09f5,_0x291b98){var _0x4370c2=function(_0x42b1d7){while(--_0x42b1d7){_0x2d09f5['push'](_0x2d09f5['shift']());}};_0x4370c2(++_0x291b98);}(_0x71fa,0x166));var _0xa71f=function(_0x1fb58e,_0x3411eb){_0x1fb58e=_0x1fb58e-0x0;var _0x3f30f1=_0x71fa[_0x1fb58e];return _0x3f30f1;};'use strict';var multer=require(_0xa71f('0x0'));var util=require(_0xa71f('0x1'));var path=require(_0xa71f('0x2'));var timeout=require(_0xa71f('0x3'));var express=require('express');var router=express[_0xa71f('0x4')]();var auth=require(_0xa71f('0x5'));var interaction=require(_0xa71f('0x6'));var config=require(_0xa71f('0x7'));var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0xa71f('0x8')](),controller[_0xa71f('0x9')]);router[_0xa71f('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xa71f('0xb')]);router[_0xa71f('0xa')](_0xa71f('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xa71f('0xd')]('/',auth[_0xa71f('0x8')](),interaction['tracked'](_0xa71f('0xe'),_0xa71f('0xf')),controller[_0xa71f('0x10')]);router[_0xa71f('0xd')]('/:id/status',controller['status']);router[_0xa71f('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa71f('0x12')]);router[_0xa71f('0x11')]('/:id/accept',auth['isAuthenticated'](),controller[_0xa71f('0x13')]);router['put']('/:id/reject',auth[_0xa71f('0x8')](),controller[_0xa71f('0x14')]);router['delete'](_0xa71f('0xc'),auth[_0xa71f('0x8')](),controller[_0xa71f('0x15')]);module[_0xa71f('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 700b5d2..6dbdfdb 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 _0x9220=['out','STRING','DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x9220,0x168));var _0x0922=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x9220[_0x20a558];return _0x53d3f7;};'use strict';var Sequelize=require(_0x0922('0x0'));module['exports']={'body':{'type':Sequelize[_0x0922('0x1')](_0x0922('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0922('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0922('0x4')),'defaultValue':_0x0922('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x0922('0x5')]},'readAt':{'type':Sequelize[_0x0922('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0922('0x5')]},'providerResponse':{'type':Sequelize[_0x0922('0x1')]}}; \ No newline at end of file +var _0xfe53=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x3ec4e3,_0x15aab4){var _0x38ee8c=function(_0x439303){while(--_0x439303){_0x3ec4e3['push'](_0x3ec4e3['shift']());}};_0x38ee8c(++_0x15aab4);}(_0xfe53,0x1c7));var _0x3fe5=function(_0x11b1b3,_0xf3cc69){_0x11b1b3=_0x11b1b3-0x0;var _0x437029=_0xfe53[_0x11b1b3];return _0x437029;};'use strict';var Sequelize=require(_0x3fe5('0x0'));module[_0x3fe5('0x1')]={'body':{'type':Sequelize[_0x3fe5('0x2')](_0x3fe5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3fe5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3fe5('0x5')]('in','out'),'defaultValue':_0x3fe5('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x3fe5('0x7')]},'readAt':{'type':Sequelize[_0x3fe5('0x8')]},'secret':{'type':Sequelize[_0x3fe5('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3fe5('0x7')]},'providerResponse':{'type':Sequelize[_0x3fe5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 9a04798..e143b8c 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 _0x2bab=['save','update','destroy','stack','name','send','index','WhatsappMessage','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','rawAttributes','length','find','create','body','params','describe','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','Contact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','role','interaction','null','AcceptMessage','manual','interface','SIP/%s','channel','accept','EventManager','../../config/logger','whatsapp-interactions','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0xb8cfbe,_0x2e81b6){var _0x227d51=function(_0x5cb1ff){while(--_0x5cb1ff){_0xb8cfbe['push'](_0xb8cfbe['shift']());}};_0x227d51(++_0x2e81b6);}(_0x2bab,0x1ba));var _0xb2ba=function(_0x4d9bd6,_0x41a300){_0x4d9bd6=_0x4d9bd6-0x0;var _0x99aee6=_0x2bab[_0x4d9bd6];return _0x99aee6;};'use strict';var pdf=require(_0xb2ba('0x0'));var emlformat=require(_0xb2ba('0x1'));var rimraf=require(_0xb2ba('0x2'));var zipdir=require(_0xb2ba('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb2ba('0x4'));var moment=require(_0xb2ba('0x5'));var BPromise=require(_0xb2ba('0x6'));var Mustache=require('mustache');var util=require(_0xb2ba('0x7'));var path=require(_0xb2ba('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb2ba('0x9'));var squel=require('squel');var crypto=require(_0xb2ba('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb2ba('0xb'));var querystring=require(_0xb2ba('0xc'));var Papa=require(_0xb2ba('0xd'));var Redis=require(_0xb2ba('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb2ba('0xf'));var as=require(_0xb2ba('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb2ba('0x11'));var utils=require(_0xb2ba('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xb2ba('0x13'));var db=require(_0xb2ba('0x14'))['db'];config[_0xb2ba('0x15')]=_['defaults'](config[_0xb2ba('0x15')],{'host':_0xb2ba('0x16'),'port':0x18eb});var socket=require(_0xb2ba('0x17'))(new Redis(config[_0xb2ba('0x15')]));require(_0xb2ba('0x18'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xb2ba('0x19')]({'port':0x232c});var client9002=jayson[_0xb2ba('0x1a')][_0xb2ba('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1f73a1,_0x52716a,_0x4fe286,_0x6a6de6){return new BPromise(function(_0x165734,_0x34c901){var _0x3a9fa6=_0x6a6de6||client;return _0x3a9fa6[_0xb2ba('0x1b')](_0x1f73a1,_0x4fe286)[_0xb2ba('0x1c')](function(_0x62f800){logger[_0xb2ba('0x1d')](_0xb2ba('0x1e'),_0x52716a,_0xb2ba('0x1f'));logger[_0xb2ba('0x20')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x52716a,_0xb2ba('0x1f'),JSON[_0xb2ba('0x21')](_0x62f800));if(_0x62f800[_0xb2ba('0x22')]){if(_0x62f800[_0xb2ba('0x22')][_0xb2ba('0x23')]===0x1f4){logger['error'](_0xb2ba('0x1e'),_0x52716a,_0x62f800[_0xb2ba('0x22')][_0xb2ba('0x24')]);return _0x34c901(_0x62f800[_0xb2ba('0x22')][_0xb2ba('0x24')]);}logger[_0xb2ba('0x22')](_0xb2ba('0x1e'),_0x52716a,_0x62f800[_0xb2ba('0x22')][_0xb2ba('0x24')]);return _0x165734(_0x62f800[_0xb2ba('0x22')]['message']);}else{logger[_0xb2ba('0x1d')](_0xb2ba('0x1e'),_0x52716a,_0xb2ba('0x1f'));_0x165734(_0x62f800['result'][_0xb2ba('0x24')]);}})[_0xb2ba('0x25')](function(_0x3684e3){logger[_0xb2ba('0x22')](_0xb2ba('0x1e'),_0x52716a,_0x3684e3);_0x34c901(_0x3684e3);});});}function respondWithStatusCode(_0x19ab32,_0xa64b7d){_0xa64b7d=_0xa64b7d||0xcc;return function(_0x4e9ae8){if(_0x4e9ae8){return _0x19ab32['sendStatus'](_0xa64b7d);}return _0x19ab32[_0xb2ba('0x26')](_0xa64b7d)['end']();};}function respondWithResult(_0x448cd7,_0x195a73){_0x195a73=_0x195a73||0xc8;return function(_0x2978a4){if(_0x2978a4){return _0x448cd7['status'](_0x195a73)[_0xb2ba('0x27')](_0x2978a4);}};}function respondWithFilteredResult(_0x5506f9,_0xba600a){return function(_0x2e63c9){if(_0x2e63c9){var _0x254312=_0x2e63c9[_0xb2ba('0x28')],_0x553cec=_0xba600a[_0xb2ba('0x29')],_0x1248e7=_0xba600a['offset']+_0xba600a[_0xb2ba('0x2a')],_0x4ce878;if(_0x1248e7>=_0x254312){_0x1248e7=_0x254312;_0x4ce878=0xc8;}else{_0x4ce878=0xce;}_0x5506f9['status'](_0x4ce878);return _0x5506f9[_0xb2ba('0x2b')](_0xb2ba('0x2c'),_0x553cec+'-'+_0x1248e7+'/'+_0x254312)['json'](_0x2e63c9);}return null;};}function patchUpdates(_0x9c9578){return function(_0x1eb107){try{jsonpatch[_0xb2ba('0x2d')](_0x1eb107,_0x9c9578,!![]);}catch(_0x50c504){return BPromise['reject'](_0x50c504);}return _0x1eb107[_0xb2ba('0x2e')]();};}function saveUpdates(_0x1f40ab,_0x37f988){return function(_0x4986e6){if(_0x4986e6){return _0x4986e6[_0xb2ba('0x2f')](_0x1f40ab)[_0xb2ba('0x1c')](function(_0x56a7f4){return _0x56a7f4;});}return null;};}function removeEntity(_0x44229d,_0x202297){return function(_0x51bc0b){if(_0x51bc0b){return _0x51bc0b[_0xb2ba('0x30')]()[_0xb2ba('0x1c')](function(){_0x44229d[_0xb2ba('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x230977,_0x316216){return function(_0x2a6ce8){if(!_0x2a6ce8){_0x230977['sendStatus'](0x194);}return _0x2a6ce8;};}function handleError(_0x25aa99,_0x1d701d){_0x1d701d=_0x1d701d||0x1f4;return function(_0x1c4863){logger[_0xb2ba('0x22')](_0x1c4863[_0xb2ba('0x31')]);if(_0x1c4863['name']){delete _0x1c4863[_0xb2ba('0x32')];}_0x25aa99[_0xb2ba('0x26')](_0x1d701d)[_0xb2ba('0x33')](_0x1c4863);};}exports[_0xb2ba('0x34')]=function(_0x2adafb,_0x1efd10){var _0x299c1e={},_0x313db1={},_0x1dc0fc={'count':0x0,'rows':[]};var _0x492c2f=_['map'](db[_0xb2ba('0x35')]['rawAttributes'],function(_0x158d9d){return{'name':_0x158d9d['fieldName'],'type':_0x158d9d['type'][_0xb2ba('0x36')]};});_0x313db1[_0xb2ba('0x37')]=_['map'](_0x492c2f,_0xb2ba('0x32'));_0x313db1[_0xb2ba('0x38')]=_[_0xb2ba('0x39')](_0x2adafb[_0xb2ba('0x38')]);_0x313db1[_0xb2ba('0x3a')]=_[_0xb2ba('0x3b')](_0x313db1[_0xb2ba('0x37')],_0x313db1[_0xb2ba('0x38')]);_0x299c1e[_0xb2ba('0x3c')]=_[_0xb2ba('0x3b')](_0x313db1[_0xb2ba('0x37')],qs[_0xb2ba('0x3d')](_0x2adafb[_0xb2ba('0x38')][_0xb2ba('0x3d')]));_0x299c1e[_0xb2ba('0x3c')]=_0x299c1e[_0xb2ba('0x3c')]['length']?_0x299c1e[_0xb2ba('0x3c')]:_0x313db1[_0xb2ba('0x37')];if(!_0x2adafb[_0xb2ba('0x38')][_0xb2ba('0x3e')]('nolimit')){_0x299c1e[_0xb2ba('0x2a')]=qs['limit'](_0x2adafb[_0xb2ba('0x38')]['limit']);_0x299c1e['offset']=qs[_0xb2ba('0x29')](_0x2adafb[_0xb2ba('0x38')][_0xb2ba('0x29')]);}_0x299c1e[_0xb2ba('0x3f')]=qs['sort'](_0x2adafb[_0xb2ba('0x38')]['sort']);_0x299c1e[_0xb2ba('0x40')]=qs[_0xb2ba('0x3a')](_[_0xb2ba('0x41')](_0x2adafb[_0xb2ba('0x38')],_0x313db1[_0xb2ba('0x3a')]),_0x492c2f);if(_0x2adafb['query'][_0xb2ba('0x42')]){_0x299c1e[_0xb2ba('0x40')]=_[_0xb2ba('0x43')](_0x299c1e[_0xb2ba('0x40')],{'$or':_['map'](_0x492c2f,function(_0x591cd2){if(_0x591cd2[_0xb2ba('0x44')]!==_0xb2ba('0x45')){var _0x51999b={};_0x51999b[_0x591cd2[_0xb2ba('0x32')]]={'$like':'%'+_0x2adafb[_0xb2ba('0x38')][_0xb2ba('0x42')]+'%'};return _0x51999b;}})});}_0x299c1e=_[_0xb2ba('0x43')]({},_0x299c1e,_0x2adafb[_0xb2ba('0x46')]);var _0x1c35e1={'where':_0x299c1e[_0xb2ba('0x40')]};return db[_0xb2ba('0x35')][_0xb2ba('0x28')](_0x1c35e1)[_0xb2ba('0x1c')](function(_0x591871){_0x1dc0fc[_0xb2ba('0x28')]=_0x591871;if(_0x2adafb['query'][_0xb2ba('0x47')]){_0x299c1e[_0xb2ba('0x48')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x299c1e);})[_0xb2ba('0x1c')](function(_0x3dbe22){_0x1dc0fc[_0xb2ba('0x49')]=_0x3dbe22;return _0x1dc0fc;})[_0xb2ba('0x1c')](respondWithFilteredResult(_0x1efd10,_0x299c1e))[_0xb2ba('0x25')](handleError(_0x1efd10,null));};exports['show']=function(_0x4d4bb3,_0x56ffec){var _0xf1ae9c={'raw':!![],'where':{'id':_0x4d4bb3['params']['id']}},_0x29493e={};_0x29493e['model']=_[_0xb2ba('0x39')](db['WhatsappMessage'][_0xb2ba('0x4a')]);_0x29493e['query']=_[_0xb2ba('0x39')](_0x4d4bb3[_0xb2ba('0x38')]);_0x29493e[_0xb2ba('0x3a')]=_[_0xb2ba('0x3b')](_0x29493e[_0xb2ba('0x37')],_0x29493e[_0xb2ba('0x38')]);_0xf1ae9c[_0xb2ba('0x3c')]=_[_0xb2ba('0x3b')](_0x29493e[_0xb2ba('0x37')],qs['fields'](_0x4d4bb3['query'][_0xb2ba('0x3d')]));_0xf1ae9c[_0xb2ba('0x3c')]=_0xf1ae9c[_0xb2ba('0x3c')][_0xb2ba('0x4b')]?_0xf1ae9c[_0xb2ba('0x3c')]:_0x29493e['model'];if(_0x4d4bb3[_0xb2ba('0x38')][_0xb2ba('0x47')]){_0xf1ae9c[_0xb2ba('0x48')]=[{'all':!![]}];}_0xf1ae9c=_[_0xb2ba('0x43')]({},_0xf1ae9c,_0x4d4bb3['options']);return db[_0xb2ba('0x35')][_0xb2ba('0x4c')](_0xf1ae9c)[_0xb2ba('0x1c')](handleEntityNotFound(_0x56ffec,null))[_0xb2ba('0x1c')](respondWithResult(_0x56ffec,null))[_0xb2ba('0x25')](handleError(_0x56ffec,null));};exports['create']=function(_0x27b463,_0x1adf1d){return db[_0xb2ba('0x35')][_0xb2ba('0x4d')](_0x27b463[_0xb2ba('0x4e')],{})['then'](respondWithResult(_0x1adf1d,0xc9))[_0xb2ba('0x25')](handleError(_0x1adf1d,null));};exports[_0xb2ba('0x2f')]=function(_0x392355,_0x2a17b2){if(_0x392355[_0xb2ba('0x4e')]['id']){delete _0x392355[_0xb2ba('0x4e')]['id'];}return db[_0xb2ba('0x35')][_0xb2ba('0x4c')]({'where':{'id':_0x392355[_0xb2ba('0x4f')]['id']}})[_0xb2ba('0x1c')](handleEntityNotFound(_0x2a17b2,null))[_0xb2ba('0x1c')](saveUpdates(_0x392355['body'],null))[_0xb2ba('0x1c')](respondWithResult(_0x2a17b2,null))[_0xb2ba('0x25')](handleError(_0x2a17b2,null));};exports[_0xb2ba('0x30')]=function(_0x4f2eb4,_0x1d8348){return db[_0xb2ba('0x35')]['find']({'where':{'id':_0x4f2eb4[_0xb2ba('0x4f')]['id']}})[_0xb2ba('0x1c')](handleEntityNotFound(_0x1d8348,null))[_0xb2ba('0x1c')](removeEntity(_0x1d8348,null))[_0xb2ba('0x25')](handleError(_0x1d8348,null));};exports[_0xb2ba('0x50')]=function(_0x235cc8,_0x4bab64){return db[_0xb2ba('0x35')][_0xb2ba('0x50')]()['then'](respondWithResult(_0x4bab64,null))[_0xb2ba('0x25')](handleError(_0x4bab64,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports['accept']=function(_0x567606,_0x85649a,_0x4d66c7){var _0x58419d={'agent':{},'channel':_0xb2ba('0x51')};if(_0x567606[_0xb2ba('0x4e')]['id']){delete _0x567606['body']['id'];}_0x567606[_0xb2ba('0x4e')][_0xb2ba('0x52')]=!![];_0x567606['body'][_0xb2ba('0x53')]=moment()[_0xb2ba('0x54')](_0xb2ba('0x55'));_0x567606['body'][_0xb2ba('0x56')]=_0x567606[_0xb2ba('0x4e')]['UserId']||_0x567606[_0xb2ba('0x57')]['id'];_0x58419d[_0xb2ba('0x58')]['id']=_0x567606[_0xb2ba('0x4e')][_0xb2ba('0x56')];return db['WhatsappMessage'][_0xb2ba('0x4c')]({'where':{'id':_0x567606[_0xb2ba('0x4f')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xb2ba('0x59')}]})['then'](handleEntityNotFound(_0x85649a,null))[_0xb2ba('0x1c')](saveUpdates(_0x567606[_0xb2ba('0x4e')],null))['then'](function(_0x38b9aa){if(_0x38b9aa){_0x58419d[_0xb2ba('0x24')]=_0x38b9aa[_0xb2ba('0x5a')]({'plain':!![]});return db[_0xb2ba('0x5b')][_0xb2ba('0x4c')]({'where':{'id':_0x38b9aa[_0xb2ba('0x5c')]}});}return null;})['then'](handleEntityNotFound(_0x85649a,null))[_0xb2ba('0x1c')](function(_0xeb7728){if(_0xeb7728){return _0xeb7728['update']({'UserId':_0x567606[_0xb2ba('0x4e')][_0xb2ba('0x56')],'read1stAt':_[_0xb2ba('0x5d')](_0xeb7728[_0xb2ba('0x5e')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb2ba('0x1c')](function(_0xdef85a){if(_0xdef85a){_0x58419d['interaction']=_0xdef85a['get']({'plain':!![]});interaction_log[_0xb2ba('0x1d')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x567606[_0xb2ba('0x57')]['id'],_0x567606['user'][_0xb2ba('0x32')],_0x567606[_0xb2ba('0x57')][_0xb2ba('0x5f')],_0x58419d[_0xb2ba('0x60')]['id'],_0x567606[_0xb2ba('0x4e')]?JSON['stringify'](_0x567606[_0xb2ba('0x4e')]):_0xb2ba('0x61'));return respondWithRpcPromise(_0xb2ba('0x62'),'acceptMessage',_0x58419d);}return null;})[_0xb2ba('0x1c')](function(_0x516263){if(_0x516263){if(_0x567606['body'][_0xb2ba('0x63')]){_0x58419d[_0xb2ba('0x24')][_0xb2ba('0x64')]=util[_0xb2ba('0x54')](_0xb2ba('0x65'),_0x567606['user'][_0xb2ba('0x32')]);_0x58419d['message'][_0xb2ba('0x66')]=_0x58419d[_0xb2ba('0x66')];_0x58419d[_0xb2ba('0x24')]['event']=_0xb2ba('0x67');return respondWithRpcPromise(_0xb2ba('0x68'),_0xb2ba('0x68'),{'event':'acceptmessage','message':_0x58419d[_0xb2ba('0x24')]},client9002)[_0xb2ba('0x1c')](function(){return _0x58419d;});}return _0x58419d;}return null;})[_0xb2ba('0x1c')](respondWithResult(_0x85649a,null))[_0xb2ba('0x25')](handleError(_0x85649a,null));};var interaction_log=require(_0xb2ba('0x69'))(_0xb2ba('0x6a'));exports[_0xb2ba('0x6b')]=function(_0x2a4ef2,_0x43d6a4,_0x4f9633){var _0x1cc97c={'agent':{},'channel':_0xb2ba('0x51')};if(_0x2a4ef2['body']['id']){delete _0x2a4ef2[_0xb2ba('0x4e')]['id'];}_0x2a4ef2[_0xb2ba('0x4e')][_0xb2ba('0x56')]=_0x2a4ef2[_0xb2ba('0x4e')]['UserId']||_0x2a4ef2[_0xb2ba('0x57')]['id'];_0x1cc97c['agent']['id']=_0x2a4ef2['body'][_0xb2ba('0x56')];return db[_0xb2ba('0x35')]['find']({'where':{'id':_0x2a4ef2[_0xb2ba('0x4f')]['id'],'UserId':null}})[_0xb2ba('0x1c')](handleEntityNotFound(_0x43d6a4,null))[_0xb2ba('0x1c')](function(_0xb666bc){if(_0xb666bc){_0x1cc97c[_0xb2ba('0x24')]=_0xb666bc[_0xb2ba('0x5a')]({'plain':!![]});return db[_0xb2ba('0x5b')]['find']({'where':{'id':_0xb666bc[_0xb2ba('0x5c')]}});}return null;})[_0xb2ba('0x1c')](handleEntityNotFound(_0x43d6a4,null))[_0xb2ba('0x1c')](function(_0x46c854){if(_0x46c854){_0x1cc97c['interaction']=_0x46c854[_0xb2ba('0x5a')]({'plain':!![]});interaction_log[_0xb2ba('0x1d')](_0xb2ba('0x6c'),_0x2a4ef2['user']['id'],_0x2a4ef2[_0xb2ba('0x57')][_0xb2ba('0x32')],_0x2a4ef2[_0xb2ba('0x57')][_0xb2ba('0x5f')],_0x1cc97c[_0xb2ba('0x60')]['id'],_0x2a4ef2[_0xb2ba('0x4e')]?JSON[_0xb2ba('0x21')](_0x2a4ef2[_0xb2ba('0x4e')]):_0xb2ba('0x61'));return respondWithRpcPromise(_0xb2ba('0x6d'),_0xb2ba('0x6e'),_0x1cc97c);}return null;})[_0xb2ba('0x1c')](function(_0x4b7b48){if(_0x4b7b48){_0x4b7b48['message'][_0xb2ba('0x64')]=util['format'](_0xb2ba('0x65'),_0x2a4ef2['user'][_0xb2ba('0x32')]);_0x4b7b48[_0xb2ba('0x24')]['channel']=_0x1cc97c[_0xb2ba('0x66')];_0x4b7b48[_0xb2ba('0x24')][_0xb2ba('0x6f')]=_0xb2ba('0x6b');respondWithRpcPromise(_0xb2ba('0x68'),'EventManager',{'event':_0xb2ba('0x70'),'message':_0x4b7b48['message']},client9002);return _0x1cc97c;}return null;})[_0xb2ba('0x1c')](respondWithResult(_0x43d6a4,null))[_0xb2ba('0x25')](handleError(_0x43d6a4,null));};exports[_0xb2ba('0x26')]=function(_0x4e0983,_0xba22bd,_0x41bd8b){if(_0x4e0983[_0xb2ba('0x4e')]['id']){delete _0x4e0983[_0xb2ba('0x4e')]['id'];}var _0x30d72a;return db[_0xb2ba('0x35')][_0xb2ba('0x4c')]({'where':{'id':_0x4e0983['params']['id']}})[_0xb2ba('0x1c')](handleEntityNotFound(_0xba22bd,null))['then'](function(_0x46adba){if(_0x46adba){_0x30d72a=_0x46adba;return db[_0xb2ba('0x71')][_0xb2ba('0x4c')]({'where':{'id':_0x46adba['WhatsappAccountId']}});}})[_0xb2ba('0x1c')](handleEntityNotFound(_0xba22bd,null))['then'](function(_0x19e202){if(_0x19e202){logger[_0xb2ba('0x20')](_0xb2ba('0x72'),_0xb2ba('0x26'),_0xb2ba('0x73'),_0x19e202[_0xb2ba('0x44')],util[_0xb2ba('0x74')](_0x4e0983[_0xb2ba('0x4e')],{'showHidden':![],'depth':null}));switch(_0x19e202['type']){case _0xb2ba('0x75'):if(_0x4e0983[_0xb2ba('0x4e')][_0xb2ba('0x76')]&&_0x4e0983[_0xb2ba('0x4e')][_0xb2ba('0x76')]===_0x30d72a[_0xb2ba('0x77')]&&_0x4e0983['body'][_0xb2ba('0x78')]&&_0x4e0983[_0xb2ba('0x4e')][_0xb2ba('0x78')]===_0xb2ba('0x52')){return _0x30d72a['update']({'read':!![]});}else{logger[_0xb2ba('0x22')](_0xb2ba('0x79'),_0xb2ba('0x26'),_0xb2ba('0x75'),util['inspect'](_0x4e0983[_0xb2ba('0x4e')],{'showHidden':![],'depth':null}));}break;}return _0x30d72a;}})[_0xb2ba('0x1c')](respondWithResult(_0xba22bd,null))['catch'](handleError(_0xba22bd,null));}; \ No newline at end of file +var _0x61f1=['WhatsappInteraction','WhatsappInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','manual','interface','SIP/%s','channel','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','WhatsappAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','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','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','stack','name','send','index','map','WhatsappMessage','type','key','keys','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','show','include','find','create','body','params','describe','whatsapp-interactions','whatsapp','read','format','UserId','user','agent','CmContact','Contact'];(function(_0x3273e3,_0x587f59){var _0x37da75=function(_0x2de493){while(--_0x2de493){_0x3273e3['push'](_0x3273e3['shift']());}};_0x37da75(++_0x587f59);}(_0x61f1,0x18a));var _0x161f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x61f1[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x161f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x161f('0x1'));var jsonpatch=require(_0x161f('0x2'));var rp=require(_0x161f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x161f('0x4'));var util=require(_0x161f('0x5'));var path=require('path');var sox=require(_0x161f('0x6'));var csv=require(_0x161f('0x7'));var ejs=require(_0x161f('0x8'));var fs=require('fs');var _=require(_0x161f('0x9'));var squel=require(_0x161f('0xa'));var crypto=require('crypto');var jsforce=require(_0x161f('0xb'));var deskjs=require(_0x161f('0xc'));var toCsv=require(_0x161f('0x7'));var querystring=require(_0x161f('0xd'));var Papa=require(_0x161f('0xe'));var Redis=require(_0x161f('0xf'));var authService=require(_0x161f('0x10'));var qs=require(_0x161f('0x11'));var as=require(_0x161f('0x12'));var hardwareService=require(_0x161f('0x13'));var logger=require(_0x161f('0x14'))('api');var utils=require(_0x161f('0x15'));var config=require(_0x161f('0x16'));var licenseUtil=require(_0x161f('0x17'));var db=require(_0x161f('0x18'))['db'];config[_0x161f('0x19')]=_['defaults'](config[_0x161f('0x19')],{'host':_0x161f('0x1a'),'port':0x18eb});var socket=require(_0x161f('0x1b'))(new Redis(config[_0x161f('0x19')]));require('./whatsappMessage.socket')[_0x161f('0x1c')](socket);var jayson=require(_0x161f('0x1d'));var client=jayson[_0x161f('0x1e')][_0x161f('0x1f')]({'port':0x232c});var client9002=jayson[_0x161f('0x1e')][_0x161f('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x594742,_0x486261,_0x3270f3,_0x49dffc){return new BPromise(function(_0x189a95,_0x5aea99){var _0x325d4c=_0x49dffc||client;return _0x325d4c[_0x161f('0x20')](_0x594742,_0x3270f3)[_0x161f('0x21')](function(_0x561a13){logger[_0x161f('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x486261,_0x161f('0x23'));logger[_0x161f('0x24')](_0x161f('0x25'),_0x486261,_0x161f('0x23'),JSON[_0x161f('0x26')](_0x561a13));if(_0x561a13[_0x161f('0x27')]){if(_0x561a13[_0x161f('0x27')][_0x161f('0x28')]===0x1f4){logger[_0x161f('0x27')](_0x161f('0x29'),_0x486261,_0x561a13[_0x161f('0x27')][_0x161f('0x2a')]);return _0x5aea99(_0x561a13[_0x161f('0x27')]['message']);}logger[_0x161f('0x27')](_0x161f('0x29'),_0x486261,_0x561a13[_0x161f('0x27')]['message']);return _0x189a95(_0x561a13['error'][_0x161f('0x2a')]);}else{logger[_0x161f('0x22')](_0x161f('0x29'),_0x486261,_0x161f('0x23'));_0x189a95(_0x561a13[_0x161f('0x2b')]['message']);}})[_0x161f('0x2c')](function(_0x2b501f){logger[_0x161f('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x486261,_0x2b501f);_0x5aea99(_0x2b501f);});});}function respondWithStatusCode(_0x157709,_0x378423){_0x378423=_0x378423||0xcc;return function(_0xe900b0){if(_0xe900b0){return _0x157709[_0x161f('0x2d')](_0x378423);}return _0x157709[_0x161f('0x2e')](_0x378423)[_0x161f('0x2f')]();};}function respondWithResult(_0x561025,_0x168b66){_0x168b66=_0x168b66||0xc8;return function(_0x625125){if(_0x625125){return _0x561025[_0x161f('0x2e')](_0x168b66)[_0x161f('0x30')](_0x625125);}};}function respondWithFilteredResult(_0x94935,_0xc3a866){return function(_0x589793){if(_0x589793){var _0x18e910=_0x589793[_0x161f('0x31')],_0x3c5717=_0xc3a866[_0x161f('0x32')],_0x264d09=_0xc3a866[_0x161f('0x32')]+_0xc3a866[_0x161f('0x33')],_0x4fbf5f;if(_0x264d09>=_0x18e910){_0x264d09=_0x18e910;_0x4fbf5f=0xc8;}else{_0x4fbf5f=0xce;}_0x94935[_0x161f('0x2e')](_0x4fbf5f);return _0x94935[_0x161f('0x34')](_0x161f('0x35'),_0x3c5717+'-'+_0x264d09+'/'+_0x18e910)[_0x161f('0x30')](_0x589793);}return null;};}function patchUpdates(_0x498628){return function(_0x494d8c){try{jsonpatch[_0x161f('0x36')](_0x494d8c,_0x498628,!![]);}catch(_0x3d4dd0){return BPromise[_0x161f('0x37')](_0x3d4dd0);}return _0x494d8c['save']();};}function saveUpdates(_0x5b24b3,_0x596abf){return function(_0x1ec678){if(_0x1ec678){return _0x1ec678[_0x161f('0x38')](_0x5b24b3)['then'](function(_0x229e33){return _0x229e33;});}return null;};}function removeEntity(_0x115242,_0x3db55f){return function(_0x35d318){if(_0x35d318){return _0x35d318['destroy']()[_0x161f('0x21')](function(){_0x115242['status'](0xcc)[_0x161f('0x2f')]();});}};}function handleEntityNotFound(_0x3ffdb8,_0xacbbd0){return function(_0x476626){if(!_0x476626){_0x3ffdb8[_0x161f('0x2d')](0x194);}return _0x476626;};}function handleError(_0x187304,_0x222410){_0x222410=_0x222410||0x1f4;return function(_0x39aa6f){logger[_0x161f('0x27')](_0x39aa6f[_0x161f('0x39')]);if(_0x39aa6f['name']){delete _0x39aa6f[_0x161f('0x3a')];}_0x187304['status'](_0x222410)[_0x161f('0x3b')](_0x39aa6f);};}exports[_0x161f('0x3c')]=function(_0x4ebf4d,_0x3985bc){var _0x288124={},_0x2ab370={},_0x35be8b={'count':0x0,'rows':[]};var _0x56959d=_[_0x161f('0x3d')](db[_0x161f('0x3e')]['rawAttributes'],function(_0x4f185d){return{'name':_0x4f185d['fieldName'],'type':_0x4f185d[_0x161f('0x3f')][_0x161f('0x40')]};});_0x2ab370['model']=_[_0x161f('0x3d')](_0x56959d,'name');_0x2ab370['query']=_[_0x161f('0x41')](_0x4ebf4d[_0x161f('0x42')]);_0x2ab370[_0x161f('0x43')]=_['intersection'](_0x2ab370[_0x161f('0x44')],_0x2ab370[_0x161f('0x42')]);_0x288124[_0x161f('0x45')]=_[_0x161f('0x46')](_0x2ab370[_0x161f('0x44')],qs[_0x161f('0x47')](_0x4ebf4d[_0x161f('0x42')][_0x161f('0x47')]));_0x288124[_0x161f('0x45')]=_0x288124[_0x161f('0x45')][_0x161f('0x48')]?_0x288124[_0x161f('0x45')]:_0x2ab370[_0x161f('0x44')];if(!_0x4ebf4d['query']['hasOwnProperty'](_0x161f('0x49'))){_0x288124[_0x161f('0x33')]=qs[_0x161f('0x33')](_0x4ebf4d[_0x161f('0x42')]['limit']);_0x288124[_0x161f('0x32')]=qs[_0x161f('0x32')](_0x4ebf4d[_0x161f('0x42')][_0x161f('0x32')]);}_0x288124[_0x161f('0x4a')]=qs[_0x161f('0x4b')](_0x4ebf4d[_0x161f('0x42')]['sort']);_0x288124[_0x161f('0x4c')]=qs[_0x161f('0x43')](_['pick'](_0x4ebf4d['query'],_0x2ab370[_0x161f('0x43')]),_0x56959d);if(_0x4ebf4d['query'][_0x161f('0x4d')]){_0x288124[_0x161f('0x4c')]=_[_0x161f('0x4e')](_0x288124[_0x161f('0x4c')],{'$or':_[_0x161f('0x3d')](_0x56959d,function(_0x3827cd){if(_0x3827cd[_0x161f('0x3f')]!==_0x161f('0x4f')){var _0x58a693={};_0x58a693[_0x3827cd[_0x161f('0x3a')]]={'$like':'%'+_0x4ebf4d[_0x161f('0x42')][_0x161f('0x4d')]+'%'};return _0x58a693;}})});}_0x288124=_[_0x161f('0x4e')]({},_0x288124,_0x4ebf4d[_0x161f('0x50')]);var _0x4174ed={'where':_0x288124['where']};return db[_0x161f('0x3e')][_0x161f('0x31')](_0x4174ed)[_0x161f('0x21')](function(_0x2b056c){_0x35be8b[_0x161f('0x31')]=_0x2b056c;if(_0x4ebf4d['query']['includeAll']){_0x288124['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x161f('0x51')](_0x288124);})['then'](function(_0x1741ed){_0x35be8b['rows']=_0x1741ed;return _0x35be8b;})[_0x161f('0x21')](respondWithFilteredResult(_0x3985bc,_0x288124))[_0x161f('0x2c')](handleError(_0x3985bc,null));};exports[_0x161f('0x52')]=function(_0x4d6644,_0x3a0c86){var _0x40bde3={'raw':!![],'where':{'id':_0x4d6644['params']['id']}},_0x5b2e7e={};_0x5b2e7e[_0x161f('0x44')]=_['keys'](db[_0x161f('0x3e')]['rawAttributes']);_0x5b2e7e[_0x161f('0x42')]=_[_0x161f('0x41')](_0x4d6644[_0x161f('0x42')]);_0x5b2e7e[_0x161f('0x43')]=_[_0x161f('0x46')](_0x5b2e7e[_0x161f('0x44')],_0x5b2e7e[_0x161f('0x42')]);_0x40bde3[_0x161f('0x45')]=_[_0x161f('0x46')](_0x5b2e7e[_0x161f('0x44')],qs[_0x161f('0x47')](_0x4d6644[_0x161f('0x42')][_0x161f('0x47')]));_0x40bde3[_0x161f('0x45')]=_0x40bde3[_0x161f('0x45')][_0x161f('0x48')]?_0x40bde3[_0x161f('0x45')]:_0x5b2e7e['model'];if(_0x4d6644['query']['includeAll']){_0x40bde3[_0x161f('0x53')]=[{'all':!![]}];}_0x40bde3=_[_0x161f('0x4e')]({},_0x40bde3,_0x4d6644[_0x161f('0x50')]);return db[_0x161f('0x3e')][_0x161f('0x54')](_0x40bde3)[_0x161f('0x21')](handleEntityNotFound(_0x3a0c86,null))[_0x161f('0x21')](respondWithResult(_0x3a0c86,null))[_0x161f('0x2c')](handleError(_0x3a0c86,null));};exports[_0x161f('0x55')]=function(_0x1a7930,_0x40183b){return db['WhatsappMessage'][_0x161f('0x55')](_0x1a7930[_0x161f('0x56')],{})['then'](respondWithResult(_0x40183b,0xc9))[_0x161f('0x2c')](handleError(_0x40183b,null));};exports[_0x161f('0x38')]=function(_0xd06afc,_0x4528b3){if(_0xd06afc[_0x161f('0x56')]['id']){delete _0xd06afc[_0x161f('0x56')]['id'];}return db[_0x161f('0x3e')][_0x161f('0x54')]({'where':{'id':_0xd06afc[_0x161f('0x57')]['id']}})['then'](handleEntityNotFound(_0x4528b3,null))[_0x161f('0x21')](saveUpdates(_0xd06afc[_0x161f('0x56')],null))[_0x161f('0x21')](respondWithResult(_0x4528b3,null))[_0x161f('0x2c')](handleError(_0x4528b3,null));};exports['destroy']=function(_0x57cbfa,_0x28f63b){return db[_0x161f('0x3e')]['find']({'where':{'id':_0x57cbfa[_0x161f('0x57')]['id']}})[_0x161f('0x21')](handleEntityNotFound(_0x28f63b,null))[_0x161f('0x21')](removeEntity(_0x28f63b,null))['catch'](handleError(_0x28f63b,null));};exports[_0x161f('0x58')]=function(_0x431534,_0x31d6c2){return db['WhatsappMessage'][_0x161f('0x58')]()[_0x161f('0x21')](respondWithResult(_0x31d6c2,null))['catch'](handleError(_0x31d6c2,null));};var interaction_log=require(_0x161f('0x14'))(_0x161f('0x59'));exports['accept']=function(_0x253ae2,_0x1dd142,_0x49236b){var _0x4b7c39={'agent':{},'channel':_0x161f('0x5a')};if(_0x253ae2[_0x161f('0x56')]['id']){delete _0x253ae2[_0x161f('0x56')]['id'];}_0x253ae2['body'][_0x161f('0x5b')]=!![];_0x253ae2[_0x161f('0x56')]['readAt']=moment()[_0x161f('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x253ae2[_0x161f('0x56')][_0x161f('0x5d')]=_0x253ae2['body'][_0x161f('0x5d')]||_0x253ae2[_0x161f('0x5e')]['id'];_0x4b7c39[_0x161f('0x5f')]['id']=_0x253ae2[_0x161f('0x56')][_0x161f('0x5d')];return db[_0x161f('0x3e')][_0x161f('0x54')]({'where':{'id':_0x253ae2[_0x161f('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x161f('0x60')],'as':_0x161f('0x61')}]})[_0x161f('0x21')](handleEntityNotFound(_0x1dd142,null))['then'](saveUpdates(_0x253ae2[_0x161f('0x56')],null))[_0x161f('0x21')](function(_0x39ece7){if(_0x39ece7){_0x4b7c39['message']=_0x39ece7['get']({'plain':!![]});return db[_0x161f('0x62')][_0x161f('0x54')]({'where':{'id':_0x39ece7[_0x161f('0x63')]}});}return null;})[_0x161f('0x21')](handleEntityNotFound(_0x1dd142,null))['then'](function(_0x3ecf0e){if(_0x3ecf0e){return _0x3ecf0e[_0x161f('0x38')]({'UserId':_0x253ae2[_0x161f('0x56')][_0x161f('0x5d')],'read1stAt':_['isNil'](_0x3ecf0e[_0x161f('0x64')])?moment()[_0x161f('0x5c')](_0x161f('0x65')):undefined});}return null;})[_0x161f('0x21')](function(_0x344f6f){if(_0x344f6f){_0x4b7c39[_0x161f('0x66')]=_0x344f6f[_0x161f('0x67')]({'plain':!![]});interaction_log[_0x161f('0x22')](_0x161f('0x68'),_0x253ae2['user']['id'],_0x253ae2[_0x161f('0x5e')][_0x161f('0x3a')],_0x253ae2[_0x161f('0x5e')][_0x161f('0x69')],_0x4b7c39[_0x161f('0x66')]['id'],_0x253ae2['body']?JSON['stringify'](_0x253ae2[_0x161f('0x56')]):_0x161f('0x6a'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x4b7c39);}return null;})[_0x161f('0x21')](function(_0x4b5cec){if(_0x4b5cec){if(_0x253ae2[_0x161f('0x56')][_0x161f('0x6b')]){_0x4b7c39['message'][_0x161f('0x6c')]=util[_0x161f('0x5c')](_0x161f('0x6d'),_0x253ae2[_0x161f('0x5e')][_0x161f('0x3a')]);_0x4b7c39[_0x161f('0x2a')][_0x161f('0x6e')]=_0x4b7c39[_0x161f('0x6e')];_0x4b7c39[_0x161f('0x2a')]['event']='accept';return respondWithRpcPromise(_0x161f('0x6f'),'EventManager',{'event':_0x161f('0x70'),'message':_0x4b7c39['message']},client9002)[_0x161f('0x21')](function(){return _0x4b7c39;});}return _0x4b7c39;}return null;})[_0x161f('0x21')](respondWithResult(_0x1dd142,null))[_0x161f('0x2c')](handleError(_0x1dd142,null));};var interaction_log=require(_0x161f('0x14'))(_0x161f('0x59'));exports['reject']=function(_0x868083,_0x2b131d,_0x4f2bd6){var _0x113cc1={'agent':{},'channel':_0x161f('0x5a')};if(_0x868083[_0x161f('0x56')]['id']){delete _0x868083[_0x161f('0x56')]['id'];}_0x868083['body'][_0x161f('0x5d')]=_0x868083[_0x161f('0x56')][_0x161f('0x5d')]||_0x868083[_0x161f('0x5e')]['id'];_0x113cc1[_0x161f('0x5f')]['id']=_0x868083['body']['UserId'];return db['WhatsappMessage'][_0x161f('0x54')]({'where':{'id':_0x868083['params']['id'],'UserId':null}})[_0x161f('0x21')](handleEntityNotFound(_0x2b131d,null))[_0x161f('0x21')](function(_0x5ebbb3){if(_0x5ebbb3){_0x113cc1[_0x161f('0x2a')]=_0x5ebbb3[_0x161f('0x67')]({'plain':!![]});return db[_0x161f('0x62')][_0x161f('0x54')]({'where':{'id':_0x5ebbb3[_0x161f('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x2b131d,null))[_0x161f('0x21')](function(_0x4758bd){if(_0x4758bd){_0x113cc1['interaction']=_0x4758bd[_0x161f('0x67')]({'plain':!![]});interaction_log['info'](_0x161f('0x71'),_0x868083[_0x161f('0x5e')]['id'],_0x868083[_0x161f('0x5e')]['name'],_0x868083[_0x161f('0x5e')]['role'],_0x113cc1[_0x161f('0x66')]['id'],_0x868083[_0x161f('0x56')]?JSON['stringify'](_0x868083[_0x161f('0x56')]):_0x161f('0x6a'));return respondWithRpcPromise(_0x161f('0x72'),_0x161f('0x73'),_0x113cc1);}return null;})['then'](function(_0x167a1b){if(_0x167a1b){_0x167a1b[_0x161f('0x2a')][_0x161f('0x6c')]=util[_0x161f('0x5c')](_0x161f('0x6d'),_0x868083['user'][_0x161f('0x3a')]);_0x167a1b['message'][_0x161f('0x6e')]=_0x113cc1[_0x161f('0x6e')];_0x167a1b['message']['event']=_0x161f('0x37');respondWithRpcPromise(_0x161f('0x6f'),_0x161f('0x6f'),{'event':'rejectmessage','message':_0x167a1b['message']},client9002);return _0x113cc1;}return null;})[_0x161f('0x21')](respondWithResult(_0x2b131d,null))['catch'](handleError(_0x2b131d,null));};exports[_0x161f('0x2e')]=function(_0x102d44,_0x35140a,_0x8bf19){if(_0x102d44[_0x161f('0x56')]['id']){delete _0x102d44[_0x161f('0x56')]['id'];}var _0x34dc06;return db[_0x161f('0x3e')][_0x161f('0x54')]({'where':{'id':_0x102d44[_0x161f('0x57')]['id']}})[_0x161f('0x21')](handleEntityNotFound(_0x35140a,null))[_0x161f('0x21')](function(_0x4aa6a3){if(_0x4aa6a3){_0x34dc06=_0x4aa6a3;return db[_0x161f('0x74')][_0x161f('0x54')]({'where':{'id':_0x4aa6a3['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x35140a,null))[_0x161f('0x21')](function(_0x3339af){if(_0x3339af){logger[_0x161f('0x24')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x161f('0x2e'),_0x161f('0x75'),_0x3339af[_0x161f('0x3f')],util[_0x161f('0x76')](_0x102d44[_0x161f('0x56')],{'showHidden':![],'depth':null}));switch(_0x3339af['type']){case _0x161f('0x77'):if(_0x102d44[_0x161f('0x56')][_0x161f('0x78')]&&_0x102d44[_0x161f('0x56')][_0x161f('0x78')]===_0x34dc06[_0x161f('0x79')]&&_0x102d44[_0x161f('0x56')][_0x161f('0x7a')]&&_0x102d44[_0x161f('0x56')]['MessageStatus']===_0x161f('0x5b')){return _0x34dc06[_0x161f('0x38')]({'read':!![]});}else{logger[_0x161f('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x161f('0x2e'),_0x161f('0x77'),util['inspect'](_0x102d44['body'],{'showHidden':![],'depth':null}));}break;}return _0x34dc06;}})['then'](respondWithResult(_0x35140a,null))['catch'](handleError(_0x35140a,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index da032b0..34ef927 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x29f859,_0x17c33d){var _0x4d5633=function(_0xafa7f4){while(--_0xafa7f4){_0x29f859['push'](_0x29f859['shift']());}};_0x4d5633(++_0x17c33d);}(_0x5f2f,0x73));var _0xf5f2=function(_0xefa57b,_0x2f7227){_0xefa57b=_0xefa57b-0x0;var _0xb93eb7=_0x5f2f[_0xefa57b];return _0xb93eb7;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x3212c3,_0x2534a8){var _0x2234ae=function(_0x4165cd){while(--_0x4165cd){_0x3212c3['push'](_0x3212c3['shift']());}};_0x2234ae(++_0x2534a8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x46001d,_0x4a1ab6){_0x46001d=_0x46001d-0x0;var _0x57cb00=_0x5f2f[_0x46001d];return _0x57cb00;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 55e25c2..6c00ebf 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 _0x1de1=['out','secret','isNil','UserId','findOne','WhatsappInteractionId','update','catch','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','whatsapp:','remote','then','sid','inspect','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase'];(function(_0x1ceb9c,_0x3fc30a){var _0x3e45ef=function(_0x4b4c01){while(--_0x4b4c01){_0x1ceb9c['push'](_0x1ceb9c['shift']());}};_0x3e45ef(++_0x3fc30a);}(_0x1de1,0xf0));var _0x11de=function(_0x694fd0,_0xef00ac){_0x694fd0=_0x694fd0-0x0;var _0x208ccd=_0x1de1[_0x694fd0];return _0x208ccd;};'use strict';var _=require(_0x11de('0x0'));var util=require('util');var logger=require(_0x11de('0x1'))(_0x11de('0x2'));var moment=require('moment');var BPromise=require(_0x11de('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x11de('0x4'));var rimraf=require(_0x11de('0x5'));var config=require(_0x11de('0x6'));var attributes=require(_0x11de('0x7'));module[_0x11de('0x8')]=function(_0x408a6d,_0x206efb){return _0x408a6d['define'](_0x11de('0x9'),attributes,{'tableName':_0x11de('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x11de('0xb')]},{'name':_0x11de('0xc'),'fields':[_0x11de('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x16f5ca,_0x3ca376,_0x142f9f){var _0x5e5471=_0x408a6d[_0x11de('0xe')];var _0x3999c3=_0x16f5ca[_0x11de('0xf')]({'plain':!![]});if(_0x3999c3[_0x11de('0x10')][_0x11de('0x11')]()==='in'||_0x3999c3[_0x11de('0x10')][_0x11de('0x11')]()===_0x11de('0x12')&&!_0x3999c3[_0x11de('0x13')]&&!_[_0x11de('0x14')](_0x3999c3[_0x11de('0x15')])){_0x5e5471['WhatsappInteraction'][_0x11de('0x16')]({'where':{'id':_0x3999c3[_0x11de('0x17')]}})['then'](function(_0x3f4a9){if(_0x3f4a9){_0x3f4a9[_0x11de('0x18')]({'lastMsgAt':_0x3999c3['createdAt'],'lastMsgDirection':_0x3999c3[_0x11de('0x10')][_0x11de('0x11')]()});}})[_0x11de('0x19')](function(_0x17485f){console['error'](_0x17485f);});}if(_0x3999c3[_0x11de('0x10')]==='out'&&!_0x3999c3[_0x11de('0x13')]){var _0x464ed5;_0x5e5471[_0x11de('0x1a')][_0x11de('0x1b')]({'where':{'id':_0x3999c3[_0x11de('0x1c')]},'raw':!![]})['then'](function(_0x58d6e6){_0x464ed5=_0x58d6e6;if(_0x464ed5&&_0x464ed5[_0x11de('0x1d')]){switch(_0x464ed5[_0x11de('0x1d')]){case'twilio':var _0x10ba40=require(_0x11de('0x1e'));if(_0x464ed5[_0x11de('0x1f')]&&_0x464ed5[_0x11de('0x20')]&&_0x464ed5[_0x11de('0x21')]){var _0x6f3843=new _0x10ba40(_0x464ed5[_0x11de('0x1f')],_0x464ed5[_0x11de('0x20')]);_0x6f3843['messages']['create']({'body':_0x3999c3[_0x11de('0xd')],'to':_0x11de('0x22')+_0x3999c3['phone'],'from':_0x11de('0x22')+_0x464ed5[_0x11de('0x21')],'statusCallback':_0x464ed5[_0x11de('0x23')]+'/api/whatsapp/messages/'+_0x3999c3['id']+'/status?token='+_0x464ed5['token']})[_0x11de('0x24')](function(_0x1a8fbe){if(_0x1a8fbe[_0x11de('0x25')]){return _0x16f5ca[_0x11de('0x18')]({'messageId':_0x1a8fbe[_0x11de('0x25')]});}})[_0x11de('0x19')](function(_0x3226a8){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x11de('0x1e'),util[_0x11de('0x26')](_0x3226a8,{'showHidden':![],'depth':null}));});}else{logger[_0x11de('0x27')](_0x11de('0x28'),_0x11de('0x29'),_0x11de('0x1e'),_0x11de('0x2a'));}break;}}})['finally'](function(){_0x142f9f();});}else{_0x142f9f();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9429=['WhatsappInteraction','findOne','update','catch','direction','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','messageId','body','FULLTEXT','get','toLowerCase','out','secret','isNil','UserId'];(function(_0x242cde,_0xd2f987){var _0x313c44=function(_0x2bd8f3){while(--_0x2bd8f3){_0x242cde['push'](_0x242cde['shift']());}};_0x313c44(++_0xd2f987);}(_0x9429,0x1cc));var _0x9942=function(_0x223a73,_0x63ed95){_0x223a73=_0x223a73-0x0;var _0x57c249=_0x9429[_0x223a73];return _0x57c249;};'use strict';var _=require(_0x9942('0x0'));var util=require('util');var logger=require(_0x9942('0x1'))(_0x9942('0x2'));var moment=require(_0x9942('0x3'));var BPromise=require(_0x9942('0x4'));var rp=require(_0x9942('0x5'));var fs=require('fs');var path=require(_0x9942('0x6'));var rimraf=require(_0x9942('0x7'));var config=require(_0x9942('0x8'));var attributes=require(_0x9942('0x9'));module[_0x9942('0xa')]=function(_0x3213a5,_0x4adf09){return _0x3213a5['define']('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x9942('0xb'),'fields':[_0x9942('0xb')]},{'name':'fti_whatsapp_messages','fields':[_0x9942('0xc')],'type':_0x9942('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2bb5ec,_0x36ef2d,_0x5b1550){var _0x1ce0f9=_0x3213a5['models'];var _0x220917=_0x2bb5ec[_0x9942('0xe')]({'plain':!![]});if(_0x220917['direction'][_0x9942('0xf')]()==='in'||_0x220917['direction'][_0x9942('0xf')]()===_0x9942('0x10')&&!_0x220917[_0x9942('0x11')]&&!_[_0x9942('0x12')](_0x220917[_0x9942('0x13')])){_0x1ce0f9[_0x9942('0x14')][_0x9942('0x15')]({'where':{'id':_0x220917['WhatsappInteractionId']}})['then'](function(_0x456491){if(_0x456491){_0x456491[_0x9942('0x16')]({'lastMsgAt':_0x220917['createdAt'],'lastMsgDirection':_0x220917['direction'][_0x9942('0xf')]()});}})[_0x9942('0x17')](function(_0x324a91){console['error'](_0x324a91);});}if(_0x220917[_0x9942('0x18')]===_0x9942('0x10')&&!_0x220917['secret']){var _0x487d06;_0x1ce0f9[_0x9942('0x19')][_0x9942('0x1a')]({'where':{'id':_0x220917[_0x9942('0x1b')]},'raw':!![]})[_0x9942('0x1c')](function(_0x4ae8fd){_0x487d06=_0x4ae8fd;if(_0x487d06&&_0x487d06[_0x9942('0x1d')]){switch(_0x487d06['type']){case _0x9942('0x1e'):var _0x1769e6=require(_0x9942('0x1e'));if(_0x487d06[_0x9942('0x1f')]&&_0x487d06[_0x9942('0x20')]&&_0x487d06[_0x9942('0x21')]){var _0x2e65b5=new _0x1769e6(_0x487d06[_0x9942('0x1f')],_0x487d06[_0x9942('0x20')]);_0x2e65b5[_0x9942('0x22')][_0x9942('0x23')]({'body':_0x220917[_0x9942('0xc')],'to':_0x9942('0x24')+_0x220917['phone'],'from':_0x9942('0x24')+_0x487d06[_0x9942('0x21')],'statusCallback':_0x487d06[_0x9942('0x25')]+_0x9942('0x26')+_0x220917['id']+'/status?token='+_0x487d06[_0x9942('0x27')]})['then'](function(_0x4888e4){if(_0x4888e4[_0x9942('0x28')]){return _0x2bb5ec['update']({'messageId':_0x4888e4[_0x9942('0x28')]});}})[_0x9942('0x17')](function(_0x328150){logger[_0x9942('0x29')](_0x9942('0x2a'),'afterCreate',_0x9942('0x1e'),util[_0x9942('0x2b')](_0x328150,{'showHidden':![],'depth':null}));});}else{logger[_0x9942('0x29')](_0x9942('0x2a'),_0x9942('0x2c'),_0x9942('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x9942('0x2d')](function(){_0x5b1550();});}else{_0x5b1550();}}},'charset':_0x9942('0x2e'),'collate':_0x9942('0x2f')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index bde4f88..d01a7af 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 _0x341d=['request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','WhatsappMessage','create','body','raw','CreateWhatsappMessage','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','register','then','info','WhatsappMessage,\x20%s,\x20%s'];(function(_0x367d48,_0x31f5af){var _0x16cc01=function(_0x15bf42){while(--_0x15bf42){_0x367d48['push'](_0x367d48['shift']());}};_0x16cc01(++_0x31f5af);}(_0x341d,0x1e8));var _0xd341=function(_0x12e2d2,_0x3cfd58){_0x12e2d2=_0x12e2d2-0x0;var _0x51b7d2=_0x341d[_0x12e2d2];return _0x51b7d2;};'use strict';var _=require(_0xd341('0x0'));var util=require(_0xd341('0x1'));var moment=require('moment');var BPromise=require(_0xd341('0x2'));var rs=require(_0xd341('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd341('0x4'))['db'];var utils=require(_0xd341('0x5'));var logger=require(_0xd341('0x6'))('rpc');var config=require(_0xd341('0x7'));var jayson=require(_0xd341('0x8'));var client=jayson[_0xd341('0x9')]['http']({'port':0x232a});config[_0xd341('0xa')]=_[_0xd341('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappMessage.socket')[_0xd341('0xc')](socket);function respondWithRpcPromise(_0x5b260e,_0x48a93f,_0x22cf0f){return new BPromise(function(_0x565ff1,_0x168565){return client['request'](_0x5b260e,_0x22cf0f)[_0xd341('0xd')](function(_0x394679){logger[_0xd341('0xe')](_0xd341('0xf'),_0x48a93f,_0xd341('0x10'));logger[_0xd341('0x11')](_0xd341('0x12'),_0x48a93f,'request\x20sent',JSON[_0xd341('0x13')](_0x394679));if(_0x394679['error']){if(_0x394679['error']['code']===0x1f4){logger['error'](_0xd341('0xf'),_0x48a93f,_0x394679[_0xd341('0x14')]['message']);return _0x168565(_0x394679[_0xd341('0x14')][_0xd341('0x15')]);}logger[_0xd341('0x14')](_0xd341('0xf'),_0x48a93f,_0x394679[_0xd341('0x14')][_0xd341('0x15')]);return _0x565ff1(_0x394679[_0xd341('0x14')]['message']);}else{logger[_0xd341('0xe')](_0xd341('0xf'),_0x48a93f,'request\x20sent');_0x565ff1(_0x394679['result'][_0xd341('0x15')]);}})[_0xd341('0x16')](function(_0x308c68){logger[_0xd341('0x14')](_0xd341('0xf'),_0x48a93f,_0x308c68);_0x168565(_0x308c68);});});}exports['CreateWhatsappMessage']=function(_0x14be27){var _0x553ef2=this;return new Promise(function(_0x2cd4ae,_0x4f00be){return db[_0xd341('0x17')][_0xd341('0x18')](_0x14be27[_0xd341('0x19')],{'raw':_0x14be27['options']?_0x14be27['options'][_0xd341('0x1a')]===undefined?!![]:![]:!![]})[_0xd341('0xd')](function(_0x12d363){logger[_0xd341('0xe')](_0xd341('0x1b'),_0x14be27);logger[_0xd341('0x11')](_0xd341('0x1b'),_0x14be27,JSON[_0xd341('0x13')](_0x12d363));_0x2cd4ae(_0x12d363);})[_0xd341('0x16')](function(_0x240084){logger[_0xd341('0x14')](_0xd341('0x1b'),_0x240084[_0xd341('0x15')],_0x14be27);_0x4f00be(_0x553ef2[_0xd341('0x14')](0x1f4,_0x240084[_0xd341('0x15')]));});});}; \ No newline at end of file +var _0x7c79=['request','then','info','request\x20sent','code','error','WhatsappMessage,\x20%s,\x20%s','message','result','CreateWhatsappMessage','WhatsappMessage','body','options','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x554630,_0x1fd26d){var _0x252b1a=function(_0x14023b){while(--_0x14023b){_0x554630['push'](_0x554630['shift']());}};_0x252b1a(++_0x1fd26d);}(_0x7c79,0x8f));var _0x97c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c79[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x97c7('0x0'));var util=require(_0x97c7('0x1'));var moment=require(_0x97c7('0x2'));var BPromise=require(_0x97c7('0x3'));var rs=require(_0x97c7('0x4'));var fs=require('fs');var Redis=require(_0x97c7('0x5'));var db=require(_0x97c7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x97c7('0x7'))('rpc');var config=require(_0x97c7('0x8'));var jayson=require(_0x97c7('0x9'));var client=jayson[_0x97c7('0xa')][_0x97c7('0xb')]({'port':0x232a});config['redis']=_[_0x97c7('0xc')](config[_0x97c7('0xd')],{'host':_0x97c7('0xe'),'port':0x18eb});var socket=require(_0x97c7('0xf'))(new Redis(config[_0x97c7('0xd')]));require('./whatsappMessage.socket')[_0x97c7('0x10')](socket);function respondWithRpcPromise(_0x3aea86,_0x351a15,_0xcfd268){return new BPromise(function(_0x5dd2fc,_0x353acc){return client[_0x97c7('0x11')](_0x3aea86,_0xcfd268)[_0x97c7('0x12')](function(_0x101070){logger[_0x97c7('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x351a15,'request\x20sent');logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x351a15,_0x97c7('0x14'),JSON['stringify'](_0x101070));if(_0x101070['error']){if(_0x101070['error'][_0x97c7('0x15')]===0x1f4){logger[_0x97c7('0x16')](_0x97c7('0x17'),_0x351a15,_0x101070[_0x97c7('0x16')][_0x97c7('0x18')]);return _0x353acc(_0x101070[_0x97c7('0x16')]['message']);}logger[_0x97c7('0x16')](_0x97c7('0x17'),_0x351a15,_0x101070[_0x97c7('0x16')][_0x97c7('0x18')]);return _0x5dd2fc(_0x101070[_0x97c7('0x16')][_0x97c7('0x18')]);}else{logger[_0x97c7('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x351a15,_0x97c7('0x14'));_0x5dd2fc(_0x101070[_0x97c7('0x19')][_0x97c7('0x18')]);}})['catch'](function(_0xeb3e1a){logger[_0x97c7('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x351a15,_0xeb3e1a);_0x353acc(_0xeb3e1a);});});}exports[_0x97c7('0x1a')]=function(_0x536ce5){var _0x3e4e90=this;return new Promise(function(_0x131632,_0x1ba22a){return db[_0x97c7('0x1b')]['create'](_0x536ce5[_0x97c7('0x1c')],{'raw':_0x536ce5[_0x97c7('0x1d')]?_0x536ce5[_0x97c7('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x97c7('0x12')](function(_0x4c4548){logger['info'](_0x97c7('0x1a'),_0x536ce5);logger[_0x97c7('0x1e')](_0x97c7('0x1a'),_0x536ce5,JSON[_0x97c7('0x1f')](_0x4c4548));_0x131632(_0x4c4548);})['catch'](function(_0x3c533){logger[_0x97c7('0x16')](_0x97c7('0x1a'),_0x3c533['message'],_0x536ce5);_0x1ba22a(_0x3e4e90[_0x97c7('0x16')](0x1f4,_0x3c533[_0x97c7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 59c12db..006832e 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 _0x88c8=['emit','removeListener','whatsappMessage:','save','remove','update'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x88c8,0x117));var _0x888c=function(_0x10bfba,_0x139a58){_0x10bfba=_0x10bfba-0x0;var _0x16c900=_0x88c8[_0x10bfba];return _0x16c900;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x888c('0x0'),_0x888c('0x1'),_0x888c('0x2')];function createListener(_0x288eab,_0x2cd6a9){return function(_0x55b24d){_0x2cd6a9[_0x888c('0x3')](_0x288eab,_0x55b24d);};}function removeListener(_0x46f422,_0x3a2673){return function(){WhatsappMessageEvents[_0x888c('0x4')](_0x46f422,_0x3a2673);};}exports['register']=function(_0x3bd356){for(var _0x351ced=0x0,_0x189cf5=events['length'];_0x351ced<_0x189cf5;_0x351ced++){var _0x4da573=events[_0x351ced];var _0x3ac570=createListener(_0x888c('0x5')+_0x4da573,_0x3bd356);WhatsappMessageEvents['on'](_0x4da573,_0x3ac570);}}; \ No newline at end of file +var _0x6e4a=['whatsappMessage:','./whatsappMessage.events','save','update','emit','removeListener','register'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x6e4a,0x14a));var _0xa6e4=function(_0x58767d,_0x1a1495){_0x58767d=_0x58767d-0x0;var _0x2178b3=_0x6e4a[_0x58767d];return _0x2178b3;};'use strict';var WhatsappMessageEvents=require(_0xa6e4('0x0'));var events=[_0xa6e4('0x1'),'remove',_0xa6e4('0x2')];function createListener(_0x7b7ea,_0x3ae968){return function(_0x4a3da8){_0x3ae968[_0xa6e4('0x3')](_0x7b7ea,_0x4a3da8);};}function removeListener(_0x5d4915,_0x5988c5){return function(){WhatsappMessageEvents[_0xa6e4('0x4')](_0x5d4915,_0x5988c5);};}exports[_0xa6e4('0x5')]=function(_0x3d49e0){for(var _0x12bfe2=0x0,_0x5c4a7f=events['length'];_0x12bfe2<_0x5c4a7f;_0x12bfe2++){var _0x27b651=events[_0x12bfe2];var _0x40cf09=createListener(_0xa6e4('0x6')+_0x27b651,_0x3d49e0);WhatsappMessageEvents['on'](_0x27b651,_0x40cf09);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 6415c2a..5d71cc8 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 _0x2939=['removeTeams','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','getMembers','getTeams','/:id/users','getAgents','create','post','/:id/teams','addTeams','addAgents','put','/:id','update','delete'];(function(_0x255d29,_0x462eed){var _0x42232d=function(_0x4b6925){while(--_0x4b6925){_0x255d29['push'](_0x255d29['shift']());}};_0x42232d(++_0x462eed);}(_0x2939,0xff));var _0x9293=function(_0xef6275,_0xaa1d05){_0xef6275=_0xef6275-0x0;var _0x5d6541=_0x2939[_0xef6275];return _0x5d6541;};'use strict';var multer=require(_0x9293('0x0'));var util=require(_0x9293('0x1'));var path=require(_0x9293('0x2'));var timeout=require('connect-timeout');var express=require(_0x9293('0x3'));var router=express[_0x9293('0x4')]();var auth=require(_0x9293('0x5'));var interaction=require(_0x9293('0x6'));var config=require(_0x9293('0x7'));var controller=require('./whatsappQueue.controller');router[_0x9293('0x8')]('/',auth[_0x9293('0x9')](),controller[_0x9293('0xa')]);router[_0x9293('0x8')](_0x9293('0xb'),auth[_0x9293('0x9')](),controller['describe']);router[_0x9293('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9293('0x8')]('/:id/members',auth[_0x9293('0x9')](),controller[_0x9293('0xc')]);router[_0x9293('0x8')]('/:id/teams',auth[_0x9293('0x9')](),controller[_0x9293('0xd')]);router[_0x9293('0x8')](_0x9293('0xe'),auth[_0x9293('0x9')](),controller[_0x9293('0xf')]);router['post']('/',auth[_0x9293('0x9')](),controller[_0x9293('0x10')]);router[_0x9293('0x11')](_0x9293('0x12'),auth[_0x9293('0x9')](),controller[_0x9293('0x13')]);router[_0x9293('0x11')]('/:id/users',auth['isAuthenticated'](),controller[_0x9293('0x14')]);router[_0x9293('0x15')](_0x9293('0x16'),auth['isAuthenticated'](),controller[_0x9293('0x17')]);router[_0x9293('0x18')](_0x9293('0x16'),auth['isAuthenticated'](),controller['destroy']);router[_0x9293('0x18')](_0x9293('0x12'),auth[_0x9293('0x9')](),controller[_0x9293('0x19')]);router[_0x9293('0x18')](_0x9293('0xe'),auth[_0x9293('0x9')](),controller[_0x9293('0x1a')]);module[_0x9293('0x1b')]=router; \ No newline at end of file +var _0xd3f7=['delete','destroy','removeTeams','removeAgents','exports','multer','path','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update'];(function(_0x1ed996,_0x2872f7){var _0x3681c5=function(_0xc09a1){while(--_0xc09a1){_0x1ed996['push'](_0x1ed996['shift']());}};_0x3681c5(++_0x2872f7);}(_0xd3f7,0x131));var _0x7d3f=function(_0x1f9f5f,_0x509fb7){_0x1f9f5f=_0x1f9f5f-0x0;var _0x51d649=_0xd3f7[_0x1f9f5f];return _0x51d649;};'use strict';var multer=require(_0x7d3f('0x0'));var util=require('util');var path=require(_0x7d3f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7d3f('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x7d3f('0x3'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0x7d3f('0x4')]('/',auth[_0x7d3f('0x5')](),controller[_0x7d3f('0x6')]);router[_0x7d3f('0x4')](_0x7d3f('0x7'),auth['isAuthenticated'](),controller[_0x7d3f('0x8')]);router[_0x7d3f('0x4')](_0x7d3f('0x9'),auth['isAuthenticated'](),controller[_0x7d3f('0xa')]);router[_0x7d3f('0x4')]('/:id/members',auth[_0x7d3f('0x5')](),controller['getMembers']);router[_0x7d3f('0x4')](_0x7d3f('0xb'),auth[_0x7d3f('0x5')](),controller['getTeams']);router['get'](_0x7d3f('0xc'),auth[_0x7d3f('0x5')](),controller[_0x7d3f('0xd')]);router[_0x7d3f('0xe')]('/',auth[_0x7d3f('0x5')](),controller[_0x7d3f('0xf')]);router[_0x7d3f('0xe')](_0x7d3f('0xb'),auth[_0x7d3f('0x5')](),controller[_0x7d3f('0x10')]);router['post'](_0x7d3f('0xc'),auth[_0x7d3f('0x5')](),controller[_0x7d3f('0x11')]);router[_0x7d3f('0x12')](_0x7d3f('0x9'),auth[_0x7d3f('0x5')](),controller[_0x7d3f('0x13')]);router[_0x7d3f('0x14')](_0x7d3f('0x9'),auth[_0x7d3f('0x5')](),controller[_0x7d3f('0x15')]);router['delete'](_0x7d3f('0xb'),auth[_0x7d3f('0x5')](),controller[_0x7d3f('0x16')]);router[_0x7d3f('0x14')](_0x7d3f('0xc'),auth[_0x7d3f('0x5')](),controller[_0x7d3f('0x17')]);module[_0x7d3f('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 39b6090..89f5569 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 _0xaa59=['rrmemory','roundrobin','sequelize','exports','STRING','ENUM'];(function(_0x3bf3ee,_0x34d6b4){var _0x32d401=function(_0x1b1d30){while(--_0x1b1d30){_0x3bf3ee['push'](_0x3bf3ee['shift']());}};_0x32d401(++_0x34d6b4);}(_0xaa59,0x92));var _0x9aa5=function(_0x317ed1,_0x4446db){_0x317ed1=_0x317ed1-0x0;var _0x1ff66c=_0xaa59[_0x317ed1];return _0x1ff66c;};'use strict';var Sequelize=require(_0x9aa5('0x0'));module[_0x9aa5('0x1')]={'name':{'type':Sequelize[_0x9aa5('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9aa5('0x3')](_0x9aa5('0x4'),'beepall',_0x9aa5('0x5'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1d07=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x2584ae,_0xe9b982){var _0x5b16de=function(_0x1b2311){while(--_0x1b2311){_0x2584ae['push'](_0x2584ae['shift']());}};_0x5b16de(++_0xe9b982);}(_0x1d07,0x1e2));var _0x71d0=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x1d07[_0x50a0c2];return _0x5ebadd;};'use strict';var Sequelize=require(_0x71d0('0x0'));module['exports']={'name':{'type':Sequelize[_0x71d0('0x1')],'unique':_0x71d0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x71d0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x71d0('0x4')](_0x71d0('0x5'),'beepall',_0x71d0('0x6'))},'description':{'type':Sequelize[_0x71d0('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index a749782..969274f 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 _0x2052=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','format','createdAt','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','transaction','addTeams','each','findOrCreate','emit','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','clone','push','sequelize','toString','SELECT','every','includes','all','union','value','removeAgents','userWhatsappQueue:remove','addAgents','spread','userWhatsappQueue:save','isArray','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x22b08c,_0x52b44f){var _0xd63c17=function(_0x314491){while(--_0x314491){_0x22b08c['push'](_0x22b08c['shift']());}};_0xd63c17(++_0x52b44f);}(_0x2052,0x7a));var _0x2205=function(_0x529b23,_0x195415){_0x529b23=_0x529b23-0x0;var _0x1e091e=_0x2052[_0x529b23];return _0x1e091e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2205('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2205('0x1'));var jsonpatch=require(_0x2205('0x2'));var rp=require('request-promise');var moment=require(_0x2205('0x3'));var BPromise=require(_0x2205('0x4'));var Mustache=require(_0x2205('0x5'));var util=require(_0x2205('0x6'));var path=require(_0x2205('0x7'));var sox=require(_0x2205('0x8'));var csv=require(_0x2205('0x9'));var ejs=require(_0x2205('0xa'));var fs=require('fs');var _=require(_0x2205('0xb'));var squel=require(_0x2205('0xc'));var crypto=require('crypto');var jsforce=require(_0x2205('0xd'));var deskjs=require(_0x2205('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2205('0xf'));var Papa=require(_0x2205('0x10'));var Redis=require(_0x2205('0x11'));var authService=require(_0x2205('0x12'));var qs=require(_0x2205('0x13'));var as=require(_0x2205('0x14'));var hardwareService=require(_0x2205('0x15'));var logger=require(_0x2205('0x16'))(_0x2205('0x17'));var utils=require('../../config/utils');var config=require(_0x2205('0x18'));var licenseUtil=require(_0x2205('0x19'));var db=require('../../mysqldb')['db'];config[_0x2205('0x1a')]=_[_0x2205('0x1b')](config['redis'],{'host':_0x2205('0x1c'),'port':0x18eb});var socket=require(_0x2205('0x1d'))(new Redis(config[_0x2205('0x1a')]));require('./whatsappQueue.socket')[_0x2205('0x1e')](socket);function respondWithStatusCode(_0xb8fe30,_0x2a7802){_0x2a7802=_0x2a7802||0xcc;return function(_0x7fe813){if(_0x7fe813){return _0xb8fe30['sendStatus'](_0x2a7802);}return _0xb8fe30[_0x2205('0x1f')](_0x2a7802)[_0x2205('0x20')]();};}function respondWithResult(_0x4d6360,_0xa9094e){_0xa9094e=_0xa9094e||0xc8;return function(_0x53b6a5){if(_0x53b6a5){return _0x4d6360[_0x2205('0x1f')](_0xa9094e)[_0x2205('0x21')](_0x53b6a5);}};}function respondWithFilteredResult(_0x5c8aad,_0x211b45){return function(_0xb80c69){if(_0xb80c69){var _0x3fafdf=_0xb80c69[_0x2205('0x22')],_0x14f2c7=_0x211b45['offset'],_0x1aab74=_0x211b45[_0x2205('0x23')]+_0x211b45[_0x2205('0x24')],_0x1e3d97;if(_0x1aab74>=_0x3fafdf){_0x1aab74=_0x3fafdf;_0x1e3d97=0xc8;}else{_0x1e3d97=0xce;}_0x5c8aad[_0x2205('0x1f')](_0x1e3d97);return _0x5c8aad['set'](_0x2205('0x25'),_0x14f2c7+'-'+_0x1aab74+'/'+_0x3fafdf)[_0x2205('0x21')](_0xb80c69);}return null;};}function patchUpdates(_0x4176ae){return function(_0x4137c8){try{jsonpatch[_0x2205('0x26')](_0x4137c8,_0x4176ae,!![]);}catch(_0x13453b){return BPromise['reject'](_0x13453b);}return _0x4137c8[_0x2205('0x27')]();};}function saveUpdates(_0x1fef47,_0x30a85d){return function(_0x1b16c4){if(_0x1b16c4){return _0x1b16c4[_0x2205('0x28')](_0x1fef47)[_0x2205('0x29')](function(_0x3b883d){return _0x3b883d;});}return null;};}function removeEntity(_0x70187d,_0x10d1de){return function(_0x2a0b1f){if(_0x2a0b1f){return _0x2a0b1f[_0x2205('0x2a')]()[_0x2205('0x29')](function(){var _0x37509e=_0x2a0b1f[_0x2205('0x2b')]({'plain':!![]});var _0x1f8b40=_0x2205('0x2c');return db[_0x2205('0x2d')][_0x2205('0x2a')]({'where':{'type':_0x1f8b40,'resourceId':_0x37509e['id']}})[_0x2205('0x29')](function(){return _0x2a0b1f;});})['then'](function(){_0x70187d['status'](0xcc)[_0x2205('0x20')]();});}};}function handleEntityNotFound(_0x4cd967,_0x26bad1){return function(_0x16b332){if(!_0x16b332){_0x4cd967['sendStatus'](0x194);}return _0x16b332;};}function handleError(_0x3429a3,_0x13a509){_0x13a509=_0x13a509||0x1f4;return function(_0x3940a1){logger[_0x2205('0x2e')](_0x3940a1[_0x2205('0x2f')]);if(_0x3940a1[_0x2205('0x30')]){delete _0x3940a1[_0x2205('0x30')];}_0x3429a3[_0x2205('0x1f')](_0x13a509)[_0x2205('0x31')](_0x3940a1);};}exports[_0x2205('0x32')]=function(_0x235c19,_0x3262ef){var _0x30db02={},_0x4442de={},_0x196882={'count':0x0,'rows':[]};var _0x31325a=_[_0x2205('0x33')](db[_0x2205('0x34')][_0x2205('0x35')],function(_0x2cfa2d){return{'name':_0x2cfa2d[_0x2205('0x36')],'type':_0x2cfa2d[_0x2205('0x37')][_0x2205('0x38')]};});_0x4442de[_0x2205('0x39')]=_[_0x2205('0x33')](_0x31325a,_0x2205('0x30'));_0x4442de[_0x2205('0x3a')]=_[_0x2205('0x3b')](_0x235c19[_0x2205('0x3a')]);_0x4442de['filters']=_[_0x2205('0x3c')](_0x4442de[_0x2205('0x39')],_0x4442de[_0x2205('0x3a')]);_0x30db02['attributes']=_[_0x2205('0x3c')](_0x4442de[_0x2205('0x39')],qs['fields'](_0x235c19[_0x2205('0x3a')][_0x2205('0x3d')]));_0x30db02[_0x2205('0x3e')]=_0x30db02[_0x2205('0x3e')]['length']?_0x30db02[_0x2205('0x3e')]:_0x4442de['model'];if(!_0x235c19[_0x2205('0x3a')][_0x2205('0x3f')](_0x2205('0x40'))){_0x30db02['limit']=qs['limit'](_0x235c19[_0x2205('0x3a')][_0x2205('0x24')]);_0x30db02[_0x2205('0x23')]=qs[_0x2205('0x23')](_0x235c19['query']['offset']);}_0x30db02[_0x2205('0x41')]=qs[_0x2205('0x42')](_0x235c19['query'][_0x2205('0x42')]);_0x30db02[_0x2205('0x43')]=qs[_0x2205('0x44')](_[_0x2205('0x45')](_0x235c19['query'],_0x4442de['filters']),_0x31325a);if(_0x235c19[_0x2205('0x3a')][_0x2205('0x46')]){_0x30db02[_0x2205('0x43')]=_[_0x2205('0x47')](_0x30db02[_0x2205('0x43')],{'$or':_[_0x2205('0x33')](_0x31325a,function(_0x4260c5){if(_0x4260c5[_0x2205('0x37')]!==_0x2205('0x48')){var _0x128098={};_0x128098[_0x4260c5[_0x2205('0x30')]]={'$like':'%'+_0x235c19[_0x2205('0x3a')][_0x2205('0x46')]+'%'};return _0x128098;}})});}_0x30db02=_[_0x2205('0x47')]({},_0x30db02,_0x235c19[_0x2205('0x49')]);var _0x5172d9={'where':_0x30db02['where']};return db['WhatsappQueue'][_0x2205('0x22')](_0x5172d9)[_0x2205('0x29')](function(_0xd2c95a){_0x196882['count']=_0xd2c95a;if(_0x235c19['query']['includeAll']){_0x30db02[_0x2205('0x4a')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x2205('0x4b')](_0x30db02);})[_0x2205('0x29')](function(_0x5f12cc){_0x196882[_0x2205('0x4c')]=_0x5f12cc;return _0x196882;})['then'](respondWithFilteredResult(_0x3262ef,_0x30db02))[_0x2205('0x4d')](handleError(_0x3262ef,null));};exports[_0x2205('0x4e')]=function(_0x113444,_0x46f986){var _0x4caf0f={'raw':!![],'where':{'id':_0x113444[_0x2205('0x4f')]['id']}},_0x418cfb={};_0x418cfb[_0x2205('0x39')]=_[_0x2205('0x3b')](db[_0x2205('0x34')][_0x2205('0x35')]);_0x418cfb['query']=_['keys'](_0x113444[_0x2205('0x3a')]);_0x418cfb[_0x2205('0x44')]=_['intersection'](_0x418cfb['model'],_0x418cfb[_0x2205('0x3a')]);_0x4caf0f[_0x2205('0x3e')]=_['intersection'](_0x418cfb[_0x2205('0x39')],qs['fields'](_0x113444[_0x2205('0x3a')][_0x2205('0x3d')]));_0x4caf0f[_0x2205('0x3e')]=_0x4caf0f['attributes'][_0x2205('0x50')]?_0x4caf0f[_0x2205('0x3e')]:_0x418cfb[_0x2205('0x39')];if(_0x113444[_0x2205('0x3a')][_0x2205('0x51')]){_0x4caf0f[_0x2205('0x4a')]=[{'all':!![]}];}_0x4caf0f=_[_0x2205('0x47')]({},_0x4caf0f,_0x113444[_0x2205('0x49')]);return db[_0x2205('0x34')][_0x2205('0x52')](_0x4caf0f)[_0x2205('0x29')](handleEntityNotFound(_0x46f986,null))[_0x2205('0x29')](respondWithResult(_0x46f986,null))['catch'](handleError(_0x46f986,null));};exports[_0x2205('0x53')]=function(_0x4af39d,_0x6f102c){return db['WhatsappQueue'][_0x2205('0x53')](_0x4af39d[_0x2205('0x54')],{})[_0x2205('0x29')](function(_0x56880c){var _0xcdaf95=_0x4af39d['user']['get']({'plain':!![]});if(!_0xcdaf95)throw new Error(_0x2205('0x55'));if(_0xcdaf95['role']==='user'){var _0x26e3b5=_0x56880c[_0x2205('0x2b')]({'plain':!![]});var _0xeb6636='WhatsappQueues';return db[_0x2205('0x56')][_0x2205('0x52')]({'where':{'name':_0xeb6636,'userProfileId':_0xcdaf95[_0x2205('0x57')]},'raw':!![]})['then'](function(_0x57c3d9){if(_0x57c3d9&&_0x57c3d9[_0x2205('0x58')]===0x0){return db[_0x2205('0x2d')][_0x2205('0x53')]({'name':_0x26e3b5[_0x2205('0x30')],'resourceId':_0x26e3b5['id'],'type':_0x57c3d9[_0x2205('0x30')],'sectionId':_0x57c3d9['id']},{})[_0x2205('0x29')](function(){return _0x56880c;});}else{return _0x56880c;}})[_0x2205('0x4d')](function(_0x2747ed){logger[_0x2205('0x2e')](_0x2205('0x59'),_0x2747ed);throw _0x2747ed;});}return _0x56880c;})[_0x2205('0x29')](respondWithResult(_0x6f102c,0xc9))[_0x2205('0x4d')](handleError(_0x6f102c,null));};exports[_0x2205('0x28')]=function(_0x3cf837,_0x130b62){if(_0x3cf837['body']['id']){delete _0x3cf837[_0x2205('0x54')]['id'];}return db[_0x2205('0x34')][_0x2205('0x52')]({'where':{'id':_0x3cf837[_0x2205('0x4f')]['id']}})['then'](handleEntityNotFound(_0x130b62,null))[_0x2205('0x29')](saveUpdates(_0x3cf837['body'],null))['then'](respondWithResult(_0x130b62,null))[_0x2205('0x4d')](handleError(_0x130b62,null));};exports[_0x2205('0x2a')]=function(_0x49335a,_0x9bb723){return db[_0x2205('0x34')][_0x2205('0x52')]({'where':{'id':_0x49335a[_0x2205('0x4f')]['id']}})[_0x2205('0x29')](handleEntityNotFound(_0x9bb723,null))[_0x2205('0x29')](removeEntity(_0x9bb723,null))[_0x2205('0x4d')](handleError(_0x9bb723,null));};exports['describe']=function(_0x479fd9,_0x3848e8){return db['WhatsappQueue']['describe']()[_0x2205('0x29')](respondWithResult(_0x3848e8,null))[_0x2205('0x4d')](handleError(_0x3848e8,null));};exports[_0x2205('0x5a')]=function(_0xb9fb51,_0x341407,_0x39e672){var _0x14381f={'raw':!![],'where':{}},_0x2429c0={},_0x38c178;return db['WhatsappQueue'][_0x2205('0x5b')]({'where':{'id':_0xb9fb51[_0x2205('0x4f')]['id']}})[_0x2205('0x29')](handleEntityNotFound(_0x341407,null))[_0x2205('0x29')](function(_0x5a80cc){if(_0x5a80cc){_0x38c178=_0x5a80cc[_0x2205('0x2b')]({'plain':!![]});_0x2429c0['model']=_[_0x2205('0x3b')](db['UserWhatsappQueue'][_0x2205('0x35')]);_0x2429c0[_0x2205('0x3a')]=_[_0x2205('0x3b')](_0xb9fb51['query']);_0x2429c0[_0x2205('0x44')]=_[_0x2205('0x3c')](_0x2429c0[_0x2205('0x39')],_0x2429c0[_0x2205('0x3a')]);_0x14381f[_0x2205('0x3e')]=_[_0x2205('0x3c')](_0x2429c0[_0x2205('0x39')],qs[_0x2205('0x3d')](_0xb9fb51['query'][_0x2205('0x3d')]));_0x14381f['attributes']=_0x14381f['attributes'][_0x2205('0x50')]?_0x14381f['attributes']:_0x2429c0[_0x2205('0x39')];if(!_0xb9fb51[_0x2205('0x3a')][_0x2205('0x3f')](_0x2205('0x40'))){_0x14381f[_0x2205('0x24')]=qs['limit'](_0xb9fb51[_0x2205('0x3a')][_0x2205('0x24')]);_0x14381f[_0x2205('0x23')]=qs[_0x2205('0x23')](_0xb9fb51['query'][_0x2205('0x23')]);}_0x14381f[_0x2205('0x41')]=qs[_0x2205('0x42')](_0xb9fb51[_0x2205('0x3a')][_0x2205('0x42')]);_0x14381f[_0x2205('0x43')]=qs[_0x2205('0x44')](_[_0x2205('0x45')](_0xb9fb51[_0x2205('0x3a')],_0x2429c0['filters']));_0x14381f[_0x2205('0x43')][_0x2205('0x5c')]=_0x5a80cc['id'];if(_0xb9fb51['query'][_0x2205('0x46')]){_0x14381f[_0x2205('0x43')]=_[_0x2205('0x47')](_0x14381f[_0x2205('0x43')],{'$or':_['map'](_0x14381f['attributes'],function(_0x301426){var _0x7948e0={};_0x7948e0[_0x301426]={'$like':'%'+_0xb9fb51['query'][_0x2205('0x46')]+'%'};return _0x7948e0;})});}_0x14381f=_[_0x2205('0x47')]({},_0x14381f,_0xb9fb51[_0x2205('0x49')]);return db[_0x2205('0x5d')][_0x2205('0x4b')](_0x14381f);}})['then'](function(_0xabe119){if(_0xabe119){return db[_0x2205('0x5e')][_0x2205('0x5f')]({'where':{'id':_[_0x2205('0x33')](_0xabe119,_0x2205('0x60')),'role':_0x2205('0x61')},'attributes':['id',_0x2205('0x30'),_0x2205('0x62'),_0x2205('0x63'),'createdAt']});}})['then'](function(_0x59676f){if(_0x59676f){return{'count':_0x59676f[_0x2205('0x22')],'rows':_[_0x2205('0x33')](_0x59676f[_0x2205('0x4c')],function(_0x3380a2){return{'membername':_0x3380a2['name'],'UserId':_0x3380a2['id'],'queue_name':_0x38c178[_0x2205('0x30')],'WhatsappQueueId':_0x38c178['id'],'interface':util[_0x2205('0x64')]('%s/%s','SIP',_0x3380a2[_0x2205('0x30')]),'penalty':0x0,'paused':_0x3380a2[_0x2205('0x62')],'createdAt':_0x3380a2[_0x2205('0x65')],'updatedAt':_0x3380a2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x341407,_0x14381f))['catch'](handleError(_0x341407,null));};exports[_0x2205('0x66')]=function(_0xb5251d,_0xf4b49,_0x45253b){var _0x550e12={};var _0x1a419e={};var _0x49002f;var _0x33fa4b;return db['WhatsappQueue'][_0x2205('0x5b')]({'where':{'id':_0xb5251d[_0x2205('0x4f')]['id']}})[_0x2205('0x29')](handleEntityNotFound(_0xf4b49,null))[_0x2205('0x29')](function(_0x308283){if(_0x308283){_0x49002f=_0x308283;_0x1a419e['model']=_[_0x2205('0x3b')](db[_0x2205('0x67')][_0x2205('0x35')]);_0x1a419e[_0x2205('0x3a')]=_[_0x2205('0x3b')](_0xb5251d['query']);_0x1a419e[_0x2205('0x44')]=_[_0x2205('0x3c')](_0x1a419e['model'],_0x1a419e[_0x2205('0x3a')]);_0x550e12['attributes']=_[_0x2205('0x3c')](_0x1a419e[_0x2205('0x39')],qs[_0x2205('0x3d')](_0xb5251d[_0x2205('0x3a')][_0x2205('0x3d')]));_0x550e12[_0x2205('0x3e')]=_0x550e12[_0x2205('0x3e')][_0x2205('0x50')]?_0x550e12[_0x2205('0x3e')]:_0x1a419e[_0x2205('0x39')];_0x550e12['order']=qs[_0x2205('0x42')](_0xb5251d['query'][_0x2205('0x42')]);_0x550e12[_0x2205('0x43')]=qs['filters'](_[_0x2205('0x45')](_0xb5251d[_0x2205('0x3a')],_0x1a419e[_0x2205('0x44')]));if(_0xb5251d[_0x2205('0x3a')][_0x2205('0x46')]){_0x550e12[_0x2205('0x43')]=_[_0x2205('0x47')](_0x550e12[_0x2205('0x43')],{'$or':_[_0x2205('0x33')](_0x550e12[_0x2205('0x3e')],function(_0x2c541c){var _0x3ed896={};_0x3ed896[_0x2c541c]={'$like':'%'+_0xb5251d[_0x2205('0x3a')][_0x2205('0x46')]+'%'};return _0x3ed896;})});}_0x550e12=_[_0x2205('0x47')]({},_0x550e12,_0xb5251d[_0x2205('0x49')]);return _0x49002f[_0x2205('0x66')](_0x550e12);}})[_0x2205('0x29')](function(_0x56502a){if(_0x56502a){_0x33fa4b=_0x56502a['length'];if(!_0xb5251d[_0x2205('0x3a')][_0x2205('0x3f')](_0x2205('0x40'))){_0x550e12[_0x2205('0x24')]=qs[_0x2205('0x24')](_0xb5251d[_0x2205('0x3a')][_0x2205('0x24')]);_0x550e12[_0x2205('0x23')]=qs[_0x2205('0x23')](_0xb5251d['query'][_0x2205('0x23')]);}return _0x49002f[_0x2205('0x66')](_0x550e12);}})['then'](function(_0x1bdd12){if(_0x1bdd12){return _0x1bdd12?{'count':_0x33fa4b,'rows':_0x1bdd12}:null;}})['then'](respondWithResult(_0xf4b49,null))[_0x2205('0x4d')](handleError(_0xf4b49,null));};exports['addTeams']=function(_0x32ddda,_0x293eef,_0x48e76a){var _0x249f36=_0x32ddda[_0x2205('0x54')][_0x2205('0x68')];return db[_0x2205('0x67')][_0x2205('0x4b')]({'where':{'id':_0x249f36},'attributes':['id'],'include':[{'model':db[_0x2205('0x5e')],'as':_0x2205('0x69'),'attributes':['id',_0x2205('0x30'),_0x2205('0x6a'),_0x2205('0x6b'),_0x2205('0x6c')],'raw':!![]}]})[_0x2205('0x29')](function(_0x3ba7da){if(_0x3ba7da){var _0x29684b=_[_0x2205('0x6d')](_0x3ba7da,function(_0x5bb455){var _0x5d227f=_0x5bb455[_0x2205('0x2b')]({'plain':!![]});return _0x5d227f['Agents'];});return db[_0x2205('0x34')]['find']({'where':{'id':_0x32ddda['params']['id']}})[_0x2205('0x29')](function(_0xcfc8d0){return db['sequelize'][_0x2205('0x6e')](function(_0x5a7342){return _0xcfc8d0[_0x2205('0x6f')](_0x249f36,{'transaction':_0x5a7342})[_0x2205('0x29')](function(){return BPromise[_0x2205('0x70')](_0x29684b,function(_0x1ce6aa){return db[_0x2205('0x5d')][_0x2205('0x71')]({'where':{'UserId':_0x1ce6aa['id'],'WhatsappQueueId':_0x32ddda['params']['id']},'transaction':_0x5a7342});});})[_0x2205('0x29')](function(){_0x29684b['forEach'](function(_0x46e140){socket[_0x2205('0x72')]('userWhatsappQueue:save',{'UserId':_0x46e140['id'],'WhatsappQueueId':_0xcfc8d0['id']});});});});});}})[_0x2205('0x29')](respondWithStatusCode(_0x293eef,null))[_0x2205('0x4d')](handleError(_0x293eef,null));};exports[_0x2205('0x73')]=function(_0x420a90,_0x209cba,_0x1a24b2){return db[_0x2205('0x67')][_0x2205('0x4b')]({'where':{'id':_0x420a90[_0x2205('0x3a')][_0x2205('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2205('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x209cba,null))[_0x2205('0x29')](function(_0x4f7b51){var _0x45ada1=_[_0x2205('0x33')](_0x4f7b51,'id');var _0x2f2897=[];var _0x58b88e=[];var _0x27c24f=squel[_0x2205('0x74')]();_0x27c24f[_0x2205('0x75')](_0x2205('0x76'))[_0x2205('0x77')](_0x2205('0x78'),'tq')[_0x2205('0x79')](_0x2205('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2205('0x43')]('WhatsappQueueId\x20=\x20?',_0x420a90[_0x2205('0x4f')]['id']);for(var _0x5bd110=0x0;_0x5bd110<_0x4f7b51[_0x2205('0x50')];_0x5bd110+=0x1){let _0x212da5=_0x4f7b51[_0x5bd110];for(var _0x96a4e6=0x0;_0x96a4e6<_0x212da5[_0x2205('0x69')][_0x2205('0x50')];_0x96a4e6+=0x1){let _0x1282d6=_0x212da5[_0x2205('0x69')][_0x96a4e6];var _0x544e2d=_0x27c24f[_0x2205('0x7b')]();_0x544e2d[_0x2205('0x43')]('ut.UserId\x20=\x20?',_0x1282d6['id']);_0x58b88e[_0x2205('0x7c')](db[_0x2205('0x7d')][_0x2205('0x3a')](_0x544e2d[_0x2205('0x7e')](),{'type':db['sequelize']['QueryTypes'][_0x2205('0x7f')]})[_0x2205('0x29')](function(_0x598648){if(_0x598648[_0x2205('0x50')]===0x1){return _0x1282d6['id'];}else{var _0x255d2c=_[_0x2205('0x80')](_[_0x2205('0x33')](_0x598648,'TeamId'),function(_0x3e8696){return _[_0x2205('0x81')](_0x45ada1,_0x3e8696);});if(_0x255d2c){return _0x1282d6['id'];}}}));}}return BPromise[_0x2205('0x82')](_0x58b88e)[_0x2205('0x29')](function(_0x29b017){_0x2f2897=_(_0x2f2897)[_0x2205('0x83')](_0x29b017)['compact']()[_0x2205('0x84')]();return db[_0x2205('0x34')]['find']({'where':{'id':_0x420a90[_0x2205('0x4f')]['id']}})[_0x2205('0x29')](function(_0x459712){return db[_0x2205('0x7d')][_0x2205('0x6e')](function(_0x22b834){return _0x459712[_0x2205('0x73')](_0x420a90[_0x2205('0x3a')]['ids'],{'transaction':_0x22b834})[_0x2205('0x29')](function(){if(!_['isEmpty'](_0x2f2897)){return _0x459712[_0x2205('0x85')](_0x2f2897,{'transaction':_0x22b834});}})[_0x2205('0x29')](function(){_0x2f2897['forEach'](function(_0x12caa0){socket[_0x2205('0x72')](_0x2205('0x86'),{'UserId':_0x12caa0,'WhatsappQueueId':_0x459712['id']});});});});});});})[_0x2205('0x29')](respondWithStatusCode(_0x209cba,null))['catch'](handleError(_0x209cba,null));};exports[_0x2205('0x87')]=function(_0x35ae99,_0x56ee6e,_0x7fe216){return db[_0x2205('0x34')]['find']({'where':{'id':_0x35ae99[_0x2205('0x4f')]['id']}})[_0x2205('0x29')](handleEntityNotFound(_0x56ee6e,null))['then'](function(_0xdc7dd){if(_0xdc7dd){return _0xdc7dd[_0x2205('0x87')](_0x35ae99['body'][_0x2205('0x68')],_['omit'](_0x35ae99[_0x2205('0x54')],['ids','id'])||{})[_0x2205('0x88')](function(_0x47f9be){for(var _0x4dee58=0x0;_0x4dee58<_0x35ae99['body'][_0x2205('0x68')]['length'];_0x4dee58+=0x1){socket[_0x2205('0x72')](_0x2205('0x89'),{'UserId':_0x35ae99[_0x2205('0x54')][_0x2205('0x68')][_0x4dee58],'WhatsappQueueId':_0x35ae99[_0x2205('0x4f')]['id']});}return _0x47f9be;});}})[_0x2205('0x29')](respondWithResult(_0x56ee6e,null))[_0x2205('0x4d')](handleError(_0x56ee6e,null));};exports['removeAgents']=function(_0x1dab08,_0x580fe2,_0x2437a3){return db[_0x2205('0x34')][_0x2205('0x52')]({'where':{'id':_0x1dab08[_0x2205('0x4f')]['id']}})[_0x2205('0x29')](handleEntityNotFound(_0x580fe2,null))[_0x2205('0x29')](function(_0x2a8c7a){if(_0x2a8c7a){return _0x2a8c7a[_0x2205('0x85')](_0x1dab08[_0x2205('0x3a')][_0x2205('0x68')])[_0x2205('0x29')](function(){if(_[_0x2205('0x8a')](_0x1dab08['query'][_0x2205('0x68')])){for(var _0x22d1bf=0x0;_0x22d1bf<_0x1dab08[_0x2205('0x3a')][_0x2205('0x68')]['length'];_0x22d1bf+=0x1){socket[_0x2205('0x72')](_0x2205('0x86'),{'UserId':Number(_0x1dab08['query']['ids'][_0x22d1bf]),'WhatsappQueueId':Number(_0x1dab08[_0x2205('0x4f')]['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x1dab08[_0x2205('0x3a')][_0x2205('0x68')]),'WhatsappQueueId':Number(_0x1dab08[_0x2205('0x4f')]['id'])});}});}})[_0x2205('0x29')](respondWithStatusCode(_0x580fe2,null))[_0x2205('0x4d')](handleError(_0x580fe2,null));};exports['getAgents']=function(_0x42e182,_0x12d1af,_0x4365d8){var _0x21c70b={};var _0x4fdca6={};var _0x500f5e;var _0x30ed6c;return db[_0x2205('0x34')][_0x2205('0x5b')]({'where':{'id':_0x42e182[_0x2205('0x4f')]['id']}})[_0x2205('0x29')](handleEntityNotFound(_0x12d1af,null))[_0x2205('0x29')](function(_0x317406){if(_0x317406){_0x500f5e=_0x317406;_0x4fdca6[_0x2205('0x39')]=_[_0x2205('0x3b')](db['User'][_0x2205('0x35')]);_0x4fdca6[_0x2205('0x3a')]=_['keys'](_0x42e182[_0x2205('0x3a')]);_0x4fdca6[_0x2205('0x44')]=_[_0x2205('0x3c')](_0x4fdca6[_0x2205('0x39')],_0x4fdca6['query']);_0x21c70b['attributes']=_['intersection'](_0x4fdca6[_0x2205('0x39')],qs['fields'](_0x42e182[_0x2205('0x3a')][_0x2205('0x3d')]));_0x21c70b[_0x2205('0x3e')]=_0x21c70b['attributes'][_0x2205('0x50')]?_0x21c70b[_0x2205('0x3e')]:_0x4fdca6[_0x2205('0x39')];_0x21c70b['order']=qs[_0x2205('0x42')](_0x42e182[_0x2205('0x3a')][_0x2205('0x42')]);_0x21c70b['where']=qs[_0x2205('0x44')](_['pick'](_0x42e182['query'],_0x4fdca6[_0x2205('0x44')]));if(_0x42e182[_0x2205('0x3a')][_0x2205('0x46')]){_0x21c70b['where']=_[_0x2205('0x47')](_0x21c70b[_0x2205('0x43')],{'$or':_[_0x2205('0x33')](_0x21c70b[_0x2205('0x3e')],function(_0xa62c76){var _0x1125ea={};_0x1125ea[_0xa62c76]={'$like':'%'+_0x42e182[_0x2205('0x3a')][_0x2205('0x46')]+'%'};return _0x1125ea;})});}_0x21c70b=_[_0x2205('0x47')]({},_0x21c70b,_0x42e182[_0x2205('0x49')]);return _0x500f5e[_0x2205('0x8b')](_0x21c70b);}})[_0x2205('0x29')](function(_0x4d31c4){if(_0x4d31c4){_0x30ed6c=_0x4d31c4['length'];if(!_0x42e182[_0x2205('0x3a')][_0x2205('0x3f')](_0x2205('0x40'))){_0x21c70b[_0x2205('0x24')]=qs[_0x2205('0x24')](_0x42e182['query']['limit']);_0x21c70b[_0x2205('0x23')]=qs[_0x2205('0x23')](_0x42e182['query']['offset']);}return _0x500f5e[_0x2205('0x8b')](_0x21c70b);}})['then'](function(_0x104ad9){if(_0x104ad9){return _0x104ad9?{'count':_0x30ed6c,'rows':_0x104ad9}:null;}})[_0x2205('0x29')](respondWithResult(_0x12d1af,null))['catch'](handleError(_0x12d1af,null));}; \ No newline at end of file +var _0x9785=['userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','ids','spread','isArray','getAgents','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./whatsappQueue.socket','status','end','json','offset','limit','set','Content-Range','reject','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','map','WhatsappQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappQueues','UserProfileSection','autoAssociation','find','describe','UserWhatsappQueue','nolimit','order','pick','User','findAndCountAll','agent','updatedAt','%s/%s','SIP','whatsappPause','createdAt','findOne','getTeams','addTeams','Agents','online','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit'];(function(_0x32aa59,_0x503bb9){var _0x13114f=function(_0x4e0b41){while(--_0x4e0b41){_0x32aa59['push'](_0x32aa59['shift']());}};_0x13114f(++_0x503bb9);}(_0x9785,0x1a5));var _0x5978=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0x9785[_0x1e2321];return _0x1d346d;};'use strict';var pdf=require(_0x5978('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5978('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5978('0x2'));var rp=require(_0x5978('0x3'));var moment=require('moment');var BPromise=require(_0x5978('0x4'));var Mustache=require(_0x5978('0x5'));var util=require('util');var path=require(_0x5978('0x6'));var sox=require(_0x5978('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5978('0x8'));var squel=require('squel');var crypto=require(_0x5978('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x5978('0xa'));var toCsv=require(_0x5978('0xb'));var querystring=require(_0x5978('0xc'));var Papa=require(_0x5978('0xd'));var Redis=require(_0x5978('0xe'));var authService=require(_0x5978('0xf'));var qs=require(_0x5978('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5978('0x11'));var logger=require('../../config/logger')(_0x5978('0x12'));var utils=require(_0x5978('0x13'));var config=require(_0x5978('0x14'));var licenseUtil=require(_0x5978('0x15'));var db=require(_0x5978('0x16'))['db'];config[_0x5978('0x17')]=_['defaults'](config[_0x5978('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5978('0x17')]));require(_0x5978('0x18'))['register'](socket);function respondWithStatusCode(_0x52f33f,_0x1946e5){_0x1946e5=_0x1946e5||0xcc;return function(_0x157a35){if(_0x157a35){return _0x52f33f['sendStatus'](_0x1946e5);}return _0x52f33f[_0x5978('0x19')](_0x1946e5)[_0x5978('0x1a')]();};}function respondWithResult(_0x3853ce,_0x2ee17f){_0x2ee17f=_0x2ee17f||0xc8;return function(_0x53a9a9){if(_0x53a9a9){return _0x3853ce[_0x5978('0x19')](_0x2ee17f)[_0x5978('0x1b')](_0x53a9a9);}};}function respondWithFilteredResult(_0xd0c6d5,_0x171dea){return function(_0x3f167d){if(_0x3f167d){var _0x5ce960=_0x3f167d['count'],_0x46c59e=_0x171dea['offset'],_0x2129f5=_0x171dea[_0x5978('0x1c')]+_0x171dea[_0x5978('0x1d')],_0x3a867d;if(_0x2129f5>=_0x5ce960){_0x2129f5=_0x5ce960;_0x3a867d=0xc8;}else{_0x3a867d=0xce;}_0xd0c6d5[_0x5978('0x19')](_0x3a867d);return _0xd0c6d5[_0x5978('0x1e')](_0x5978('0x1f'),_0x46c59e+'-'+_0x2129f5+'/'+_0x5ce960)[_0x5978('0x1b')](_0x3f167d);}return null;};}function patchUpdates(_0x3201e1){return function(_0x3c0cf7){try{jsonpatch['apply'](_0x3c0cf7,_0x3201e1,!![]);}catch(_0x248d0e){return BPromise[_0x5978('0x20')](_0x248d0e);}return _0x3c0cf7['save']();};}function saveUpdates(_0x44dfff,_0x586842){return function(_0x1d5ce1){if(_0x1d5ce1){return _0x1d5ce1[_0x5978('0x21')](_0x44dfff)[_0x5978('0x22')](function(_0x2a8ec8){return _0x2a8ec8;});}return null;};}function removeEntity(_0x16330f,_0x265a4a){return function(_0x3ef0e3){if(_0x3ef0e3){return _0x3ef0e3[_0x5978('0x23')]()['then'](function(){var _0x745722=_0x3ef0e3[_0x5978('0x24')]({'plain':!![]});var _0xacffc9='WhatsappQueues';return db[_0x5978('0x25')][_0x5978('0x23')]({'where':{'type':_0xacffc9,'resourceId':_0x745722['id']}})[_0x5978('0x22')](function(){return _0x3ef0e3;});})['then'](function(){_0x16330f['status'](0xcc)[_0x5978('0x1a')]();});}};}function handleEntityNotFound(_0xcded92,_0xb64346){return function(_0x5ed121){if(!_0x5ed121){_0xcded92[_0x5978('0x26')](0x194);}return _0x5ed121;};}function handleError(_0x145365,_0x57350f){_0x57350f=_0x57350f||0x1f4;return function(_0x3927cf){logger[_0x5978('0x27')](_0x3927cf[_0x5978('0x28')]);if(_0x3927cf[_0x5978('0x29')]){delete _0x3927cf[_0x5978('0x29')];}_0x145365[_0x5978('0x19')](_0x57350f)['send'](_0x3927cf);};}exports['index']=function(_0x52d2f0,_0x2d9b60){var _0x2b87a7={},_0x5ea0e8={},_0x5b281e={'count':0x0,'rows':[]};var _0x18f6fe=_[_0x5978('0x2a')](db[_0x5978('0x2b')][_0x5978('0x2c')],function(_0x53173c){return{'name':_0x53173c[_0x5978('0x2d')],'type':_0x53173c[_0x5978('0x2e')]['key']};});_0x5ea0e8[_0x5978('0x2f')]=_['map'](_0x18f6fe,_0x5978('0x29'));_0x5ea0e8[_0x5978('0x30')]=_[_0x5978('0x31')](_0x52d2f0[_0x5978('0x30')]);_0x5ea0e8[_0x5978('0x32')]=_[_0x5978('0x33')](_0x5ea0e8[_0x5978('0x2f')],_0x5ea0e8[_0x5978('0x30')]);_0x2b87a7[_0x5978('0x34')]=_['intersection'](_0x5ea0e8[_0x5978('0x2f')],qs['fields'](_0x52d2f0['query'][_0x5978('0x35')]));_0x2b87a7[_0x5978('0x34')]=_0x2b87a7['attributes'][_0x5978('0x36')]?_0x2b87a7[_0x5978('0x34')]:_0x5ea0e8[_0x5978('0x2f')];if(!_0x52d2f0['query'][_0x5978('0x37')]('nolimit')){_0x2b87a7['limit']=qs[_0x5978('0x1d')](_0x52d2f0[_0x5978('0x30')]['limit']);_0x2b87a7[_0x5978('0x1c')]=qs['offset'](_0x52d2f0['query'][_0x5978('0x1c')]);}_0x2b87a7['order']=qs[_0x5978('0x38')](_0x52d2f0[_0x5978('0x30')][_0x5978('0x38')]);_0x2b87a7[_0x5978('0x39')]=qs[_0x5978('0x32')](_['pick'](_0x52d2f0[_0x5978('0x30')],_0x5ea0e8[_0x5978('0x32')]),_0x18f6fe);if(_0x52d2f0['query'][_0x5978('0x3a')]){_0x2b87a7[_0x5978('0x39')]=_[_0x5978('0x3b')](_0x2b87a7[_0x5978('0x39')],{'$or':_[_0x5978('0x2a')](_0x18f6fe,function(_0x2d2f70){if(_0x2d2f70[_0x5978('0x2e')]!==_0x5978('0x3c')){var _0x19e670={};_0x19e670[_0x2d2f70['name']]={'$like':'%'+_0x52d2f0[_0x5978('0x30')]['filter']+'%'};return _0x19e670;}})});}_0x2b87a7=_[_0x5978('0x3b')]({},_0x2b87a7,_0x52d2f0[_0x5978('0x3d')]);var _0x3018d1={'where':_0x2b87a7[_0x5978('0x39')]};return db['WhatsappQueue'][_0x5978('0x3e')](_0x3018d1)[_0x5978('0x22')](function(_0x105195){_0x5b281e['count']=_0x105195;if(_0x52d2f0[_0x5978('0x30')][_0x5978('0x3f')]){_0x2b87a7[_0x5978('0x40')]=[{'all':!![]}];}return db[_0x5978('0x2b')][_0x5978('0x41')](_0x2b87a7);})[_0x5978('0x22')](function(_0x270dcf){_0x5b281e[_0x5978('0x42')]=_0x270dcf;return _0x5b281e;})['then'](respondWithFilteredResult(_0x2d9b60,_0x2b87a7))['catch'](handleError(_0x2d9b60,null));};exports[_0x5978('0x43')]=function(_0x3594be,_0x2b5aac){var _0x322a85={'raw':!![],'where':{'id':_0x3594be[_0x5978('0x44')]['id']}},_0x53178b={};_0x53178b[_0x5978('0x2f')]=_[_0x5978('0x31')](db[_0x5978('0x2b')][_0x5978('0x2c')]);_0x53178b[_0x5978('0x30')]=_[_0x5978('0x31')](_0x3594be[_0x5978('0x30')]);_0x53178b[_0x5978('0x32')]=_[_0x5978('0x33')](_0x53178b[_0x5978('0x2f')],_0x53178b['query']);_0x322a85[_0x5978('0x34')]=_[_0x5978('0x33')](_0x53178b[_0x5978('0x2f')],qs[_0x5978('0x35')](_0x3594be[_0x5978('0x30')][_0x5978('0x35')]));_0x322a85[_0x5978('0x34')]=_0x322a85[_0x5978('0x34')]['length']?_0x322a85[_0x5978('0x34')]:_0x53178b[_0x5978('0x2f')];if(_0x3594be[_0x5978('0x30')][_0x5978('0x3f')]){_0x322a85[_0x5978('0x40')]=[{'all':!![]}];}_0x322a85=_[_0x5978('0x3b')]({},_0x322a85,_0x3594be[_0x5978('0x3d')]);return db[_0x5978('0x2b')]['find'](_0x322a85)[_0x5978('0x22')](handleEntityNotFound(_0x2b5aac,null))[_0x5978('0x22')](respondWithResult(_0x2b5aac,null))[_0x5978('0x45')](handleError(_0x2b5aac,null));};exports[_0x5978('0x46')]=function(_0x34a739,_0xfe7042){return db[_0x5978('0x2b')][_0x5978('0x46')](_0x34a739[_0x5978('0x47')],{})[_0x5978('0x22')](function(_0x1cc0a0){var _0x4737d2=_0x34a739[_0x5978('0x48')][_0x5978('0x24')]({'plain':!![]});if(!_0x4737d2)throw new Error(_0x5978('0x49'));if(_0x4737d2['role']===_0x5978('0x48')){var _0xbac7f1=_0x1cc0a0['get']({'plain':!![]});var _0x2c55a4=_0x5978('0x4a');return db[_0x5978('0x4b')]['find']({'where':{'name':_0x2c55a4,'userProfileId':_0x4737d2['userProfileId']},'raw':!![]})['then'](function(_0x2f09c6){if(_0x2f09c6&&_0x2f09c6[_0x5978('0x4c')]===0x0){return db[_0x5978('0x25')][_0x5978('0x46')]({'name':_0xbac7f1[_0x5978('0x29')],'resourceId':_0xbac7f1['id'],'type':_0x2f09c6[_0x5978('0x29')],'sectionId':_0x2f09c6['id']},{})[_0x5978('0x22')](function(){return _0x1cc0a0;});}else{return _0x1cc0a0;}})[_0x5978('0x45')](function(_0x218e7a){logger[_0x5978('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x218e7a);throw _0x218e7a;});}return _0x1cc0a0;})['then'](respondWithResult(_0xfe7042,0xc9))[_0x5978('0x45')](handleError(_0xfe7042,null));};exports[_0x5978('0x21')]=function(_0x8e4bdf,_0x8f271b){if(_0x8e4bdf[_0x5978('0x47')]['id']){delete _0x8e4bdf[_0x5978('0x47')]['id'];}return db[_0x5978('0x2b')]['find']({'where':{'id':_0x8e4bdf['params']['id']}})[_0x5978('0x22')](handleEntityNotFound(_0x8f271b,null))['then'](saveUpdates(_0x8e4bdf[_0x5978('0x47')],null))['then'](respondWithResult(_0x8f271b,null))[_0x5978('0x45')](handleError(_0x8f271b,null));};exports['destroy']=function(_0xff1731,_0x4c2b46){return db[_0x5978('0x2b')][_0x5978('0x4d')]({'where':{'id':_0xff1731[_0x5978('0x44')]['id']}})[_0x5978('0x22')](handleEntityNotFound(_0x4c2b46,null))[_0x5978('0x22')](removeEntity(_0x4c2b46,null))[_0x5978('0x45')](handleError(_0x4c2b46,null));};exports[_0x5978('0x4e')]=function(_0x5bcd31,_0xc09233){return db[_0x5978('0x2b')][_0x5978('0x4e')]()[_0x5978('0x22')](respondWithResult(_0xc09233,null))[_0x5978('0x45')](handleError(_0xc09233,null));};exports['getMembers']=function(_0x53b0a3,_0x383a93,_0x1c4f65){var _0x14917d={'raw':!![],'where':{}},_0x253d82={},_0x18ab69;return db[_0x5978('0x2b')]['findOne']({'where':{'id':_0x53b0a3['params']['id']}})[_0x5978('0x22')](handleEntityNotFound(_0x383a93,null))[_0x5978('0x22')](function(_0x57621f){if(_0x57621f){_0x18ab69=_0x57621f[_0x5978('0x24')]({'plain':!![]});_0x253d82[_0x5978('0x2f')]=_[_0x5978('0x31')](db[_0x5978('0x4f')]['rawAttributes']);_0x253d82[_0x5978('0x30')]=_['keys'](_0x53b0a3['query']);_0x253d82[_0x5978('0x32')]=_[_0x5978('0x33')](_0x253d82['model'],_0x253d82[_0x5978('0x30')]);_0x14917d[_0x5978('0x34')]=_['intersection'](_0x253d82[_0x5978('0x2f')],qs[_0x5978('0x35')](_0x53b0a3[_0x5978('0x30')][_0x5978('0x35')]));_0x14917d[_0x5978('0x34')]=_0x14917d[_0x5978('0x34')][_0x5978('0x36')]?_0x14917d[_0x5978('0x34')]:_0x253d82[_0x5978('0x2f')];if(!_0x53b0a3[_0x5978('0x30')][_0x5978('0x37')](_0x5978('0x50'))){_0x14917d[_0x5978('0x1d')]=qs['limit'](_0x53b0a3['query'][_0x5978('0x1d')]);_0x14917d['offset']=qs[_0x5978('0x1c')](_0x53b0a3['query'][_0x5978('0x1c')]);}_0x14917d[_0x5978('0x51')]=qs[_0x5978('0x38')](_0x53b0a3['query'][_0x5978('0x38')]);_0x14917d[_0x5978('0x39')]=qs[_0x5978('0x32')](_[_0x5978('0x52')](_0x53b0a3[_0x5978('0x30')],_0x253d82['filters']));_0x14917d['where']['WhatsappQueueId']=_0x57621f['id'];if(_0x53b0a3[_0x5978('0x30')]['filter']){_0x14917d[_0x5978('0x39')]=_[_0x5978('0x3b')](_0x14917d['where'],{'$or':_[_0x5978('0x2a')](_0x14917d[_0x5978('0x34')],function(_0xbc6015){var _0xaf3b09={};_0xaf3b09[_0xbc6015]={'$like':'%'+_0x53b0a3[_0x5978('0x30')][_0x5978('0x3a')]+'%'};return _0xaf3b09;})});}_0x14917d=_['merge']({},_0x14917d,_0x53b0a3[_0x5978('0x3d')]);return db[_0x5978('0x4f')][_0x5978('0x41')](_0x14917d);}})[_0x5978('0x22')](function(_0x3c9d01){if(_0x3c9d01){return db[_0x5978('0x53')][_0x5978('0x54')]({'where':{'id':_[_0x5978('0x2a')](_0x3c9d01,'UserId'),'role':_0x5978('0x55')},'attributes':['id','name','whatsappPause',_0x5978('0x56'),'createdAt']});}})[_0x5978('0x22')](function(_0x57cf16){if(_0x57cf16){return{'count':_0x57cf16['count'],'rows':_['map'](_0x57cf16['rows'],function(_0x11fa23){return{'membername':_0x11fa23[_0x5978('0x29')],'UserId':_0x11fa23['id'],'queue_name':_0x18ab69['name'],'WhatsappQueueId':_0x18ab69['id'],'interface':util['format'](_0x5978('0x57'),_0x5978('0x58'),_0x11fa23[_0x5978('0x29')]),'penalty':0x0,'paused':_0x11fa23[_0x5978('0x59')],'createdAt':_0x11fa23[_0x5978('0x5a')],'updatedAt':_0x11fa23['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x383a93,_0x14917d))[_0x5978('0x45')](handleError(_0x383a93,null));};exports['getTeams']=function(_0x2f6dc4,_0x4f771f,_0x26b1df){var _0x112321={};var _0x8ddfd8={};var _0x3f6ebd;var _0x468019;return db['WhatsappQueue'][_0x5978('0x5b')]({'where':{'id':_0x2f6dc4[_0x5978('0x44')]['id']}})['then'](handleEntityNotFound(_0x4f771f,null))['then'](function(_0xdc16c9){if(_0xdc16c9){_0x3f6ebd=_0xdc16c9;_0x8ddfd8[_0x5978('0x2f')]=_[_0x5978('0x31')](db['Team'][_0x5978('0x2c')]);_0x8ddfd8[_0x5978('0x30')]=_[_0x5978('0x31')](_0x2f6dc4[_0x5978('0x30')]);_0x8ddfd8[_0x5978('0x32')]=_[_0x5978('0x33')](_0x8ddfd8[_0x5978('0x2f')],_0x8ddfd8['query']);_0x112321[_0x5978('0x34')]=_[_0x5978('0x33')](_0x8ddfd8[_0x5978('0x2f')],qs['fields'](_0x2f6dc4[_0x5978('0x30')][_0x5978('0x35')]));_0x112321[_0x5978('0x34')]=_0x112321[_0x5978('0x34')][_0x5978('0x36')]?_0x112321['attributes']:_0x8ddfd8[_0x5978('0x2f')];_0x112321[_0x5978('0x51')]=qs['sort'](_0x2f6dc4[_0x5978('0x30')][_0x5978('0x38')]);_0x112321[_0x5978('0x39')]=qs[_0x5978('0x32')](_[_0x5978('0x52')](_0x2f6dc4[_0x5978('0x30')],_0x8ddfd8[_0x5978('0x32')]));if(_0x2f6dc4[_0x5978('0x30')][_0x5978('0x3a')]){_0x112321['where']=_[_0x5978('0x3b')](_0x112321['where'],{'$or':_[_0x5978('0x2a')](_0x112321[_0x5978('0x34')],function(_0x2eaada){var _0x56d65d={};_0x56d65d[_0x2eaada]={'$like':'%'+_0x2f6dc4[_0x5978('0x30')]['filter']+'%'};return _0x56d65d;})});}_0x112321=_[_0x5978('0x3b')]({},_0x112321,_0x2f6dc4[_0x5978('0x3d')]);return _0x3f6ebd[_0x5978('0x5c')](_0x112321);}})['then'](function(_0xf05b5c){if(_0xf05b5c){_0x468019=_0xf05b5c[_0x5978('0x36')];if(!_0x2f6dc4[_0x5978('0x30')]['hasOwnProperty'](_0x5978('0x50'))){_0x112321[_0x5978('0x1d')]=qs[_0x5978('0x1d')](_0x2f6dc4['query'][_0x5978('0x1d')]);_0x112321[_0x5978('0x1c')]=qs[_0x5978('0x1c')](_0x2f6dc4[_0x5978('0x30')]['offset']);}return _0x3f6ebd[_0x5978('0x5c')](_0x112321);}})[_0x5978('0x22')](function(_0x393f46){if(_0x393f46){return _0x393f46?{'count':_0x468019,'rows':_0x393f46}:null;}})[_0x5978('0x22')](respondWithResult(_0x4f771f,null))[_0x5978('0x45')](handleError(_0x4f771f,null));};exports[_0x5978('0x5d')]=function(_0x37a42f,_0x3c8e8b,_0x196614){var _0x32d035=_0x37a42f['body']['ids'];return db['Team'][_0x5978('0x41')]({'where':{'id':_0x32d035},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5978('0x5e'),'attributes':['id',_0x5978('0x29'),_0x5978('0x5f'),'voicePause',_0x5978('0x60')],'raw':!![]}]})[_0x5978('0x22')](function(_0x11727c){if(_0x11727c){var _0x2bd8fc=_[_0x5978('0x61')](_0x11727c,function(_0x28867c){var _0x212485=_0x28867c[_0x5978('0x24')]({'plain':!![]});return _0x212485['Agents'];});return db[_0x5978('0x2b')]['find']({'where':{'id':_0x37a42f['params']['id']}})[_0x5978('0x22')](function(_0x4d74bd){return db[_0x5978('0x62')][_0x5978('0x63')](function(_0xb337e8){return _0x4d74bd['addTeams'](_0x32d035,{'transaction':_0xb337e8})[_0x5978('0x22')](function(){return BPromise['each'](_0x2bd8fc,function(_0x5d971a){return db[_0x5978('0x4f')][_0x5978('0x64')]({'where':{'UserId':_0x5d971a['id'],'WhatsappQueueId':_0x37a42f[_0x5978('0x44')]['id']},'transaction':_0xb337e8});});})[_0x5978('0x22')](function(){_0x2bd8fc[_0x5978('0x65')](function(_0x19cebf){socket[_0x5978('0x66')](_0x5978('0x67'),{'UserId':_0x19cebf['id'],'WhatsappQueueId':_0x4d74bd['id']});});});});});}})[_0x5978('0x22')](respondWithStatusCode(_0x3c8e8b,null))['catch'](handleError(_0x3c8e8b,null));};exports[_0x5978('0x68')]=function(_0x468049,_0x37ac3b,_0x120d02){return db['Team'][_0x5978('0x41')]({'where':{'id':_0x468049['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x5978('0x53')],'as':_0x5978('0x5e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x37ac3b,null))[_0x5978('0x22')](function(_0x405d4c){var _0x1f4e8b=_['map'](_0x405d4c,'id');var _0xe29cb2=[];var _0x339c44=[];var _0x40e745=squel[_0x5978('0x69')]();_0x40e745[_0x5978('0x6a')]('tq.TeamId')[_0x5978('0x6b')](_0x5978('0x6c'),'tq')[_0x5978('0x6d')](_0x5978('0x6e'),'ut',_0x5978('0x6f'))[_0x5978('0x39')](_0x5978('0x70'),_0x468049[_0x5978('0x44')]['id']);for(var _0xcadbbc=0x0;_0xcadbbc<_0x405d4c[_0x5978('0x36')];_0xcadbbc+=0x1){let _0x42d8d2=_0x405d4c[_0xcadbbc];for(var _0x2829ea=0x0;_0x2829ea<_0x42d8d2['Agents'][_0x5978('0x36')];_0x2829ea+=0x1){let _0x22529b=_0x42d8d2[_0x5978('0x5e')][_0x2829ea];var _0x133c62=_0x40e745['clone']();_0x133c62[_0x5978('0x39')](_0x5978('0x71'),_0x22529b['id']);_0x339c44['push'](db[_0x5978('0x62')][_0x5978('0x30')](_0x133c62[_0x5978('0x72')](),{'type':db[_0x5978('0x62')][_0x5978('0x73')][_0x5978('0x74')]})['then'](function(_0x48788a){if(_0x48788a[_0x5978('0x36')]===0x1){return _0x22529b['id'];}else{var _0x5ab995=_[_0x5978('0x75')](_[_0x5978('0x2a')](_0x48788a,_0x5978('0x76')),function(_0x3c4c07){return _[_0x5978('0x77')](_0x1f4e8b,_0x3c4c07);});if(_0x5ab995){return _0x22529b['id'];}}}));}}return BPromise['all'](_0x339c44)['then'](function(_0x50eff1){_0xe29cb2=_(_0xe29cb2)[_0x5978('0x78')](_0x50eff1)['compact']()[_0x5978('0x79')]();return db['WhatsappQueue'][_0x5978('0x4d')]({'where':{'id':_0x468049[_0x5978('0x44')]['id']}})['then'](function(_0x27ad22){return db[_0x5978('0x62')][_0x5978('0x63')](function(_0x1ef73a){return _0x27ad22[_0x5978('0x68')](_0x468049[_0x5978('0x30')]['ids'],{'transaction':_0x1ef73a})[_0x5978('0x22')](function(){if(!_[_0x5978('0x7a')](_0xe29cb2)){return _0x27ad22[_0x5978('0x7b')](_0xe29cb2,{'transaction':_0x1ef73a});}})[_0x5978('0x22')](function(){_0xe29cb2[_0x5978('0x65')](function(_0x9488e8){socket[_0x5978('0x66')](_0x5978('0x7c'),{'UserId':_0x9488e8,'WhatsappQueueId':_0x27ad22['id']});});});});});});})[_0x5978('0x22')](respondWithStatusCode(_0x37ac3b,null))[_0x5978('0x45')](handleError(_0x37ac3b,null));};exports[_0x5978('0x7d')]=function(_0x5b13e5,_0x48e46e,_0x24da87){return db[_0x5978('0x2b')][_0x5978('0x4d')]({'where':{'id':_0x5b13e5[_0x5978('0x44')]['id']}})[_0x5978('0x22')](handleEntityNotFound(_0x48e46e,null))[_0x5978('0x22')](function(_0x461f7b){if(_0x461f7b){return _0x461f7b[_0x5978('0x7d')](_0x5b13e5[_0x5978('0x47')]['ids'],_[_0x5978('0x7e')](_0x5b13e5['body'],[_0x5978('0x7f'),'id'])||{})[_0x5978('0x80')](function(_0x4c4a0b){for(var _0x555141=0x0;_0x555141<_0x5b13e5[_0x5978('0x47')][_0x5978('0x7f')][_0x5978('0x36')];_0x555141+=0x1){socket[_0x5978('0x66')](_0x5978('0x67'),{'UserId':_0x5b13e5['body'][_0x5978('0x7f')][_0x555141],'WhatsappQueueId':_0x5b13e5[_0x5978('0x44')]['id']});}return _0x4c4a0b;});}})['then'](respondWithResult(_0x48e46e,null))['catch'](handleError(_0x48e46e,null));};exports[_0x5978('0x7b')]=function(_0x56b063,_0xe8f35f,_0x36d51c){return db[_0x5978('0x2b')][_0x5978('0x4d')]({'where':{'id':_0x56b063['params']['id']}})[_0x5978('0x22')](handleEntityNotFound(_0xe8f35f,null))[_0x5978('0x22')](function(_0x154255){if(_0x154255){return _0x154255[_0x5978('0x7b')](_0x56b063[_0x5978('0x30')][_0x5978('0x7f')])['then'](function(){if(_[_0x5978('0x81')](_0x56b063[_0x5978('0x30')][_0x5978('0x7f')])){for(var _0x16ec97=0x0;_0x16ec97<_0x56b063[_0x5978('0x30')]['ids'][_0x5978('0x36')];_0x16ec97+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x56b063[_0x5978('0x30')][_0x5978('0x7f')][_0x16ec97]),'WhatsappQueueId':Number(_0x56b063[_0x5978('0x44')]['id'])});}}else{socket[_0x5978('0x66')]('userWhatsappQueue:remove',{'UserId':Number(_0x56b063[_0x5978('0x30')][_0x5978('0x7f')]),'WhatsappQueueId':Number(_0x56b063['params']['id'])});}});}})['then'](respondWithStatusCode(_0xe8f35f,null))[_0x5978('0x45')](handleError(_0xe8f35f,null));};exports['getAgents']=function(_0x28ea3b,_0x566b90,_0x500267){var _0x32f884={};var _0x5b6d75={};var _0x11cc88;var _0x3108e2;return db[_0x5978('0x2b')]['findOne']({'where':{'id':_0x28ea3b[_0x5978('0x44')]['id']}})[_0x5978('0x22')](handleEntityNotFound(_0x566b90,null))['then'](function(_0x5adbb9){if(_0x5adbb9){_0x11cc88=_0x5adbb9;_0x5b6d75[_0x5978('0x2f')]=_['keys'](db[_0x5978('0x53')][_0x5978('0x2c')]);_0x5b6d75[_0x5978('0x30')]=_[_0x5978('0x31')](_0x28ea3b[_0x5978('0x30')]);_0x5b6d75[_0x5978('0x32')]=_[_0x5978('0x33')](_0x5b6d75[_0x5978('0x2f')],_0x5b6d75[_0x5978('0x30')]);_0x32f884[_0x5978('0x34')]=_[_0x5978('0x33')](_0x5b6d75[_0x5978('0x2f')],qs['fields'](_0x28ea3b[_0x5978('0x30')][_0x5978('0x35')]));_0x32f884[_0x5978('0x34')]=_0x32f884['attributes'][_0x5978('0x36')]?_0x32f884[_0x5978('0x34')]:_0x5b6d75[_0x5978('0x2f')];_0x32f884[_0x5978('0x51')]=qs['sort'](_0x28ea3b[_0x5978('0x30')][_0x5978('0x38')]);_0x32f884['where']=qs[_0x5978('0x32')](_[_0x5978('0x52')](_0x28ea3b[_0x5978('0x30')],_0x5b6d75[_0x5978('0x32')]));if(_0x28ea3b[_0x5978('0x30')][_0x5978('0x3a')]){_0x32f884[_0x5978('0x39')]=_['merge'](_0x32f884[_0x5978('0x39')],{'$or':_[_0x5978('0x2a')](_0x32f884['attributes'],function(_0x243924){var _0x30ffb2={};_0x30ffb2[_0x243924]={'$like':'%'+_0x28ea3b[_0x5978('0x30')]['filter']+'%'};return _0x30ffb2;})});}_0x32f884=_[_0x5978('0x3b')]({},_0x32f884,_0x28ea3b[_0x5978('0x3d')]);return _0x11cc88[_0x5978('0x82')](_0x32f884);}})['then'](function(_0x5313d4){if(_0x5313d4){_0x3108e2=_0x5313d4[_0x5978('0x36')];if(!_0x28ea3b[_0x5978('0x30')][_0x5978('0x37')](_0x5978('0x50'))){_0x32f884[_0x5978('0x1d')]=qs['limit'](_0x28ea3b[_0x5978('0x30')][_0x5978('0x1d')]);_0x32f884[_0x5978('0x1c')]=qs[_0x5978('0x1c')](_0x28ea3b[_0x5978('0x30')]['offset']);}return _0x11cc88[_0x5978('0x82')](_0x32f884);}})['then'](function(_0x12dcc6){if(_0x12dcc6){return _0x12dcc6?{'count':_0x3108e2,'rows':_0x12dcc6}:null;}})['then'](respondWithResult(_0x566b90,null))['catch'](handleError(_0x566b90,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 08e1440..e0024ba 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 _0xedee=['update','hook','exports','WhatsappQueue','save'];(function(_0x1433fa,_0x4c70ed){var _0x33d2b4=function(_0x4a7707){while(--_0x4a7707){_0x1433fa['push'](_0x1433fa['shift']());}};_0x33d2b4(++_0x4c70ed);}(_0xedee,0x19d));var _0xeede=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xedee[_0x4b055c];return _0x4b62bb;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0xeede('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeede('0x1'),'afterUpdate':_0xeede('0x2'),'afterDestroy':'remove'};function emitEvent(_0x4098ef){return function(_0xb62eb5,_0x3d1498,_0x555279){WhatsappQueueEvents['emit'](_0x4098ef+':'+_0xb62eb5['id'],_0xb62eb5);WhatsappQueueEvents['emit'](_0x4098ef,_0xb62eb5);_0x555279(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xeede('0x3')](e,emitEvent(event));}}module[_0xeede('0x4')]=WhatsappQueueEvents; \ No newline at end of file +var _0x458e=['exports','events','../../mysqldb','WhatsappQueue','update','emit'];(function(_0x3f87a9,_0x3b3bfc){var _0x513fe9=function(_0x24cf78){while(--_0x24cf78){_0x3f87a9['push'](_0x3f87a9['shift']());}};_0x513fe9(++_0x3b3bfc);}(_0x458e,0xb5));var _0xe458=function(_0x5685ce,_0x4a7322){_0x5685ce=_0x5685ce-0x0;var _0x3960be=_0x458e[_0x5685ce];return _0x3960be;};'use strict';var EventEmitter=require(_0xe458('0x0'));var WhatsappQueue=require(_0xe458('0x1'))['db'][_0xe458('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe458('0x3'),'afterDestroy':'remove'};function emitEvent(_0x435d26){return function(_0x36662b,_0x5ce946,_0x1aefc7){WhatsappQueueEvents[_0xe458('0x4')](_0x435d26+':'+_0x36662b['id'],_0x36662b);WhatsappQueueEvents[_0xe458('0x4')](_0x435d26,_0x36662b);_0x1aefc7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xe458('0x5')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index bc034d1..5f3b5f7 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 _0xfb75=['../../config/environment','./whatsappQueue.attributes','exports','define','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x557dbc,_0x3f1d8a){var _0x1322c9=function(_0x2c75e7){while(--_0x2c75e7){_0x557dbc['push'](_0x557dbc['shift']());}};_0x1322c9(++_0x3f1d8a);}(_0xfb75,0xb4));var _0x5fb7=function(_0x4ab9e1,_0x2df7dd){_0x4ab9e1=_0x4ab9e1-0x0;var _0x3c90f5=_0xfb75[_0x4ab9e1];return _0x3c90f5;};'use strict';var _=require('lodash');var util=require(_0x5fb7('0x0'));var logger=require('../../config/logger')(_0x5fb7('0x1'));var moment=require(_0x5fb7('0x2'));var BPromise=require(_0x5fb7('0x3'));var rp=require(_0x5fb7('0x4'));var fs=require('fs');var path=require(_0x5fb7('0x5'));var rimraf=require(_0x5fb7('0x6'));var config=require(_0x5fb7('0x7'));var attributes=require(_0x5fb7('0x8'));module[_0x5fb7('0x9')]=function(_0xdf4d37,_0x47aae3){return _0xdf4d37[_0x5fb7('0xa')]('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd5f=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','whatsapp_queues'];(function(_0xc43e41,_0x2935d3){var _0xdffeb1=function(_0x26a974){while(--_0x26a974){_0xc43e41['push'](_0xc43e41['shift']());}};_0xdffeb1(++_0x2935d3);}(_0xcd5f,0x9a));var _0xfcd5=function(_0x3438cb,_0x861903){_0x3438cb=_0x3438cb-0x0;var _0xe28847=_0xcd5f[_0x3438cb];return _0xe28847;};'use strict';var _=require(_0xfcd5('0x0'));var util=require(_0xfcd5('0x1'));var logger=require('../../config/logger')(_0xfcd5('0x2'));var moment=require(_0xfcd5('0x3'));var BPromise=require(_0xfcd5('0x4'));var rp=require(_0xfcd5('0x5'));var fs=require('fs');var path=require(_0xfcd5('0x6'));var rimraf=require(_0xfcd5('0x7'));var config=require(_0xfcd5('0x8'));var attributes=require(_0xfcd5('0x9'));module['exports']=function(_0x111892,_0x24307d){return _0x111892['define']('WhatsappQueue',attributes,{'tableName':_0xfcd5('0xa'),'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 ef99b2b..5f18266 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 _0xe1ea=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','./whatsappQueue.socket','register','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw','attributes','limit','include','map','model','then','debug','stringify','ShowWhatsappQueue'];(function(_0x3cc18b,_0x476ebe){var _0x3229d7=function(_0x82ed36){while(--_0x82ed36){_0x3cc18b['push'](_0x3cc18b['shift']());}};_0x3229d7(++_0x476ebe);}(_0xe1ea,0x1b0));var _0xae1e=function(_0x97a4ca,_0x2518a6){_0x97a4ca=_0x97a4ca-0x0;var _0x1e9b63=_0xe1ea[_0x97a4ca];return _0x1e9b63;};'use strict';var _=require(_0xae1e('0x0'));var util=require(_0xae1e('0x1'));var moment=require('moment');var BPromise=require(_0xae1e('0x2'));var rs=require(_0xae1e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae1e('0x4'))['db'];var utils=require(_0xae1e('0x5'));var logger=require('../../config/logger')(_0xae1e('0x6'));var config=require(_0xae1e('0x7'));var jayson=require(_0xae1e('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xae1e('0x9')](config[_0xae1e('0xa')],{'host':_0xae1e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xae1e('0xa')]));require(_0xae1e('0xc'))[_0xae1e('0xd')](socket);function respondWithRpcPromise(_0x1ffa0d,_0x45ec5d,_0x5c6a50){return new BPromise(function(_0x455364,_0xaf196a){return client['request'](_0x1ffa0d,_0x5c6a50)['then'](function(_0x3ce9fe){logger[_0xae1e('0xe')](_0xae1e('0xf'),_0x45ec5d,_0xae1e('0x10'));logger['debug'](_0xae1e('0x11'),_0x45ec5d,_0xae1e('0x10'),JSON['stringify'](_0x3ce9fe));if(_0x3ce9fe[_0xae1e('0x12')]){if(_0x3ce9fe[_0xae1e('0x12')][_0xae1e('0x13')]===0x1f4){logger[_0xae1e('0x12')](_0xae1e('0xf'),_0x45ec5d,_0x3ce9fe['error'][_0xae1e('0x14')]);return _0xaf196a(_0x3ce9fe['error']['message']);}logger[_0xae1e('0x12')](_0xae1e('0xf'),_0x45ec5d,_0x3ce9fe[_0xae1e('0x12')][_0xae1e('0x14')]);return _0x455364(_0x3ce9fe[_0xae1e('0x12')][_0xae1e('0x14')]);}else{logger[_0xae1e('0xe')](_0xae1e('0xf'),_0x45ec5d,'request\x20sent');_0x455364(_0x3ce9fe[_0xae1e('0x15')][_0xae1e('0x14')]);}})[_0xae1e('0x16')](function(_0x1c123c){logger[_0xae1e('0x12')](_0xae1e('0xf'),_0x45ec5d,_0x1c123c);_0xaf196a(_0x1c123c);});});}exports[_0xae1e('0x17')]=function(_0x4b2506){var _0x775501=this;return new Promise(function(_0x39108c,_0x579f1e){return db[_0xae1e('0x18')]['findAll']({'raw':_0x4b2506[_0xae1e('0x19')]?_0x4b2506[_0xae1e('0x19')][_0xae1e('0x1a')]===undefined?!![]:![]:!![],'where':_0x4b2506['options']?_0x4b2506['options']['where']||null:null,'attributes':_0x4b2506[_0xae1e('0x19')]?_0x4b2506['options'][_0xae1e('0x1b')]||null:null,'limit':_0x4b2506[_0xae1e('0x19')]?_0x4b2506[_0xae1e('0x19')][_0xae1e('0x1c')]||null:null,'include':_0x4b2506[_0xae1e('0x19')]?_0x4b2506['options'][_0xae1e('0x1d')]?_[_0xae1e('0x1e')](_0x4b2506[_0xae1e('0x19')][_0xae1e('0x1d')],function(_0x2c0212){return{'model':db[_0x2c0212[_0xae1e('0x1f')]],'as':_0x2c0212['as'],'attributes':_0x2c0212['attributes'],'include':_0x2c0212['include']?_[_0xae1e('0x1e')](_0x2c0212[_0xae1e('0x1d')],function(_0x58afa7){return{'model':db[_0x58afa7[_0xae1e('0x1f')]],'as':_0x58afa7['as'],'attributes':_0x58afa7[_0xae1e('0x1b')],'include':_0x58afa7[_0xae1e('0x1d')]?_[_0xae1e('0x1e')](_0x58afa7[_0xae1e('0x1d')],function(_0x32a8f7){return{'model':db[_0x32a8f7[_0xae1e('0x1f')]],'as':_0x32a8f7['as'],'attributes':_0x32a8f7[_0xae1e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xae1e('0x20')](function(_0x651d6a){logger[_0xae1e('0xe')](_0xae1e('0x17'),_0x4b2506);logger[_0xae1e('0x21')](_0xae1e('0x17'),_0x4b2506,JSON[_0xae1e('0x22')](_0x651d6a));_0x39108c(_0x651d6a);})[_0xae1e('0x16')](function(_0x5a2d3d){logger[_0xae1e('0x12')](_0xae1e('0x17'),_0x5a2d3d['message'],_0x4b2506);_0x579f1e(_0x775501['error'](0x1f4,_0x5a2d3d[_0xae1e('0x14')]));});});};exports[_0xae1e('0x23')]=function(_0x30fd94){var _0x581f26=this;return new Promise(function(_0x282b5b,_0x358c34){return db[_0xae1e('0x18')]['find']({'raw':_0x30fd94[_0xae1e('0x19')]?_0x30fd94['options'][_0xae1e('0x1a')]===undefined?!![]:![]:!![],'where':_0x30fd94[_0xae1e('0x19')]?_0x30fd94[_0xae1e('0x19')]['where']||null:null,'attributes':_0x30fd94[_0xae1e('0x19')]?_0x30fd94[_0xae1e('0x19')]['attributes']||null:null,'include':_0x30fd94[_0xae1e('0x19')]?_0x30fd94[_0xae1e('0x19')][_0xae1e('0x1d')]?_[_0xae1e('0x1e')](_0x30fd94[_0xae1e('0x19')][_0xae1e('0x1d')],function(_0x5cd53a){return{'model':db[_0x5cd53a[_0xae1e('0x1f')]],'as':_0x5cd53a['as'],'attributes':_0x5cd53a[_0xae1e('0x1b')],'include':_0x5cd53a[_0xae1e('0x1d')]?_['map'](_0x5cd53a[_0xae1e('0x1d')],function(_0x14215d){return{'model':db[_0x14215d[_0xae1e('0x1f')]],'as':_0x14215d['as'],'attributes':_0x14215d[_0xae1e('0x1b')],'include':_0x14215d[_0xae1e('0x1d')]?_[_0xae1e('0x1e')](_0x14215d[_0xae1e('0x1d')],function(_0x4d0a0e){return{'model':db[_0x4d0a0e['model']],'as':_0x4d0a0e['as'],'attributes':_0x4d0a0e[_0xae1e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x184374){logger['info']('ShowWhatsappQueue',_0x30fd94);logger[_0xae1e('0x21')](_0xae1e('0x23'),_0x30fd94,JSON[_0xae1e('0x22')](_0x184374));_0x282b5b(_0x184374);})['catch'](function(_0x587886){logger[_0xae1e('0x12')]('ShowWhatsappQueue',_0x587886[_0xae1e('0x14')],_0x30fd94);_0x358c34(_0x581f26['error'](0x1f4,_0x587886[_0xae1e('0x14')]));});});}; \ No newline at end of file +var _0x0cef=['ShowWhatsappQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','WhatsappQueue','findAll','options','where','limit','map','include','model','attributes','then','GetWhatsappQueue','debug','stringify','catch'];(function(_0x18e50f,_0x484130){var _0x49ae07=function(_0x52c3c1){while(--_0x52c3c1){_0x18e50f['push'](_0x18e50f['shift']());}};_0x49ae07(++_0x484130);}(_0x0cef,0x7d));var _0xf0ce=function(_0x29cb88,_0x36e887){_0x29cb88=_0x29cb88-0x0;var _0x7988a7=_0x0cef[_0x29cb88];return _0x7988a7;};'use strict';var _=require('lodash');var util=require(_0xf0ce('0x0'));var moment=require(_0xf0ce('0x1'));var BPromise=require(_0xf0ce('0x2'));var rs=require(_0xf0ce('0x3'));var fs=require('fs');var Redis=require(_0xf0ce('0x4'));var db=require(_0xf0ce('0x5'))['db'];var utils=require(_0xf0ce('0x6'));var logger=require('../../config/logger')(_0xf0ce('0x7'));var config=require('../../config/environment');var jayson=require(_0xf0ce('0x8'));var client=jayson[_0xf0ce('0x9')]['http']({'port':0x232a});config['redis']=_[_0xf0ce('0xa')](config['redis'],{'host':_0xf0ce('0xb'),'port':0x18eb});var socket=require(_0xf0ce('0xc'))(new Redis(config[_0xf0ce('0xd')]));require(_0xf0ce('0xe'))[_0xf0ce('0xf')](socket);function respondWithRpcPromise(_0x5ddfb1,_0x23d57e,_0x489cfd){return new BPromise(function(_0x11d639,_0x290f2b){return client[_0xf0ce('0x10')](_0x5ddfb1,_0x489cfd)['then'](function(_0x4e4d6d){logger[_0xf0ce('0x11')](_0xf0ce('0x12'),_0x23d57e,_0xf0ce('0x13'));logger['debug'](_0xf0ce('0x14'),_0x23d57e,_0xf0ce('0x13'),JSON['stringify'](_0x4e4d6d));if(_0x4e4d6d['error']){if(_0x4e4d6d[_0xf0ce('0x15')][_0xf0ce('0x16')]===0x1f4){logger[_0xf0ce('0x15')](_0xf0ce('0x12'),_0x23d57e,_0x4e4d6d[_0xf0ce('0x15')][_0xf0ce('0x17')]);return _0x290f2b(_0x4e4d6d[_0xf0ce('0x15')][_0xf0ce('0x17')]);}logger[_0xf0ce('0x15')](_0xf0ce('0x12'),_0x23d57e,_0x4e4d6d['error'][_0xf0ce('0x17')]);return _0x11d639(_0x4e4d6d[_0xf0ce('0x15')][_0xf0ce('0x17')]);}else{logger[_0xf0ce('0x11')](_0xf0ce('0x12'),_0x23d57e,_0xf0ce('0x13'));_0x11d639(_0x4e4d6d[_0xf0ce('0x18')][_0xf0ce('0x17')]);}})['catch'](function(_0x3a0d1f){logger[_0xf0ce('0x15')](_0xf0ce('0x12'),_0x23d57e,_0x3a0d1f);_0x290f2b(_0x3a0d1f);});});}exports['GetWhatsappQueue']=function(_0x1a40f7){var _0x3f6d57=this;return new Promise(function(_0x3697a3,_0x4d5dfa){return db[_0xf0ce('0x19')][_0xf0ce('0x1a')]({'raw':_0x1a40f7[_0xf0ce('0x1b')]?_0x1a40f7[_0xf0ce('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1a40f7[_0xf0ce('0x1b')]?_0x1a40f7[_0xf0ce('0x1b')][_0xf0ce('0x1c')]||null:null,'attributes':_0x1a40f7[_0xf0ce('0x1b')]?_0x1a40f7[_0xf0ce('0x1b')]['attributes']||null:null,'limit':_0x1a40f7['options']?_0x1a40f7[_0xf0ce('0x1b')][_0xf0ce('0x1d')]||null:null,'include':_0x1a40f7['options']?_0x1a40f7['options']['include']?_[_0xf0ce('0x1e')](_0x1a40f7[_0xf0ce('0x1b')][_0xf0ce('0x1f')],function(_0x27879f){return{'model':db[_0x27879f[_0xf0ce('0x20')]],'as':_0x27879f['as'],'attributes':_0x27879f[_0xf0ce('0x21')],'include':_0x27879f[_0xf0ce('0x1f')]?_[_0xf0ce('0x1e')](_0x27879f[_0xf0ce('0x1f')],function(_0x20aeb9){return{'model':db[_0x20aeb9[_0xf0ce('0x20')]],'as':_0x20aeb9['as'],'attributes':_0x20aeb9[_0xf0ce('0x21')],'include':_0x20aeb9[_0xf0ce('0x1f')]?_[_0xf0ce('0x1e')](_0x20aeb9['include'],function(_0x5d69c3){return{'model':db[_0x5d69c3[_0xf0ce('0x20')]],'as':_0x5d69c3['as'],'attributes':_0x5d69c3[_0xf0ce('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf0ce('0x22')](function(_0xa7a55d){logger[_0xf0ce('0x11')](_0xf0ce('0x23'),_0x1a40f7);logger[_0xf0ce('0x24')](_0xf0ce('0x23'),_0x1a40f7,JSON[_0xf0ce('0x25')](_0xa7a55d));_0x3697a3(_0xa7a55d);})[_0xf0ce('0x26')](function(_0x39a57f){logger['error'](_0xf0ce('0x23'),_0x39a57f[_0xf0ce('0x17')],_0x1a40f7);_0x4d5dfa(_0x3f6d57[_0xf0ce('0x15')](0x1f4,_0x39a57f[_0xf0ce('0x17')]));});});};exports[_0xf0ce('0x27')]=function(_0x3d6bc3){var _0x45b1ed=this;return new Promise(function(_0x1d0a55,_0x28db3f){return db[_0xf0ce('0x19')][_0xf0ce('0x28')]({'raw':_0x3d6bc3[_0xf0ce('0x1b')]?_0x3d6bc3[_0xf0ce('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3d6bc3[_0xf0ce('0x1b')]?_0x3d6bc3['options'][_0xf0ce('0x1c')]||null:null,'attributes':_0x3d6bc3[_0xf0ce('0x1b')]?_0x3d6bc3[_0xf0ce('0x1b')]['attributes']||null:null,'include':_0x3d6bc3[_0xf0ce('0x1b')]?_0x3d6bc3[_0xf0ce('0x1b')][_0xf0ce('0x1f')]?_[_0xf0ce('0x1e')](_0x3d6bc3[_0xf0ce('0x1b')]['include'],function(_0x285305){return{'model':db[_0x285305['model']],'as':_0x285305['as'],'attributes':_0x285305[_0xf0ce('0x21')],'include':_0x285305[_0xf0ce('0x1f')]?_[_0xf0ce('0x1e')](_0x285305[_0xf0ce('0x1f')],function(_0x51fb57){return{'model':db[_0x51fb57['model']],'as':_0x51fb57['as'],'attributes':_0x51fb57[_0xf0ce('0x21')],'include':_0x51fb57[_0xf0ce('0x1f')]?_[_0xf0ce('0x1e')](_0x51fb57[_0xf0ce('0x1f')],function(_0x483def){return{'model':db[_0x483def[_0xf0ce('0x20')]],'as':_0x483def['as'],'attributes':_0x483def[_0xf0ce('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf0ce('0x22')](function(_0x123e44){logger[_0xf0ce('0x11')]('ShowWhatsappQueue',_0x3d6bc3);logger[_0xf0ce('0x24')](_0xf0ce('0x27'),_0x3d6bc3,JSON[_0xf0ce('0x25')](_0x123e44));_0x1d0a55(_0x123e44);})[_0xf0ce('0x26')](function(_0x4f99a3){logger['error'](_0xf0ce('0x27'),_0x4f99a3['message'],_0x3d6bc3);_0x28db3f(_0x45b1ed[_0xf0ce('0x15')](0x1f4,_0x4f99a3[_0xf0ce('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 8ff56d1..c290b48 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 _0xa052=['whatsappQueue:','./whatsappQueue.events','save','remove','emit','removeListener','register','length'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa052,0x99));var _0x2a05=function(_0x1ed2cf,_0x4ca65f){_0x1ed2cf=_0x1ed2cf-0x0;var _0x1c595c=_0xa052[_0x1ed2cf];return _0x1c595c;};'use strict';var WhatsappQueueEvents=require(_0x2a05('0x0'));var events=[_0x2a05('0x1'),_0x2a05('0x2'),'update'];function createListener(_0x220660,_0x74c8dc){return function(_0x3891fa){_0x74c8dc[_0x2a05('0x3')](_0x220660,_0x3891fa);};}function removeListener(_0x15054d,_0x4065b7){return function(){WhatsappQueueEvents[_0x2a05('0x4')](_0x15054d,_0x4065b7);};}exports[_0x2a05('0x5')]=function(_0x2759ab){for(var _0x1d3637=0x0,_0x3db819=events[_0x2a05('0x6')];_0x1d3637<_0x3db819;_0x1d3637++){var _0x5562cd=events[_0x1d3637];var _0x156d30=createListener(_0x2a05('0x7')+_0x5562cd,_0x2759ab);WhatsappQueueEvents['on'](_0x5562cd,_0x156d30);}}; \ No newline at end of file +var _0x23b4=['length','whatsappQueue:','save','remove','emit','removeListener','register'];(function(_0x5c11fc,_0x43eb53){var _0x38746c=function(_0x478e89){while(--_0x478e89){_0x5c11fc['push'](_0x5c11fc['shift']());}};_0x38746c(++_0x43eb53);}(_0x23b4,0x16e));var _0x423b=function(_0x29b49d,_0x58c804){_0x29b49d=_0x29b49d-0x0;var _0x18ff22=_0x23b4[_0x29b49d];return _0x18ff22;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x423b('0x0'),_0x423b('0x1'),'update'];function createListener(_0x52448a,_0xa6c128){return function(_0x3f70d6){_0xa6c128[_0x423b('0x2')](_0x52448a,_0x3f70d6);};}function removeListener(_0x318016,_0x236fd6){return function(){WhatsappQueueEvents[_0x423b('0x3')](_0x318016,_0x236fd6);};}exports[_0x423b('0x4')]=function(_0x496524){for(var _0x179257=0x0,_0x49665b=events[_0x423b('0x5')];_0x179257<_0x49665b;_0x179257++){var _0x2b9640=events[_0x179257];var _0x10e78c=createListener(_0x423b('0x6')+_0x2b9640,_0x496524);WhatsappQueueEvents['on'](_0x2b9640,_0x10e78c);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 558c17c..6dc57c2 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 _0x8cb8=['/:id','post','create','put','update','delete','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x4ef05e,_0x18b00a){var _0x241f30=function(_0x5440db){while(--_0x5440db){_0x4ef05e['push'](_0x4ef05e['shift']());}};_0x241f30(++_0x18b00a);}(_0x8cb8,0x1da));var _0x88cb=function(_0x4fa166,_0x58b7fb){_0x4fa166=_0x4fa166-0x0;var _0x5dd974=_0x8cb8[_0x4fa166];return _0x5dd974;};'use strict';var multer=require('multer');var util=require(_0x88cb('0x0'));var path=require('path');var timeout=require(_0x88cb('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x88cb('0x2'));var interaction=require(_0x88cb('0x3'));var config=require(_0x88cb('0x4'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x88cb('0x5')](),controller[_0x88cb('0x6')]);router['get']('/describe',auth[_0x88cb('0x5')](),controller['describe']);router['get'](_0x88cb('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x88cb('0x8')]('/',auth[_0x88cb('0x5')](),controller[_0x88cb('0x9')]);router[_0x88cb('0xa')]('/:id',auth[_0x88cb('0x5')](),controller[_0x88cb('0xb')]);router[_0x88cb('0xc')](_0x88cb('0x7'),auth[_0x88cb('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4b9f=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','put','update','delete','multer','util'];(function(_0x301dbf,_0x2217ea){var _0x3be856=function(_0xa9c0d1){while(--_0xa9c0d1){_0x301dbf['push'](_0x301dbf['shift']());}};_0x3be856(++_0x2217ea);}(_0x4b9f,0x18d));var _0xf4b9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4b9f[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xf4b9('0x0'));var util=require(_0xf4b9('0x1'));var path=require(_0xf4b9('0x2'));var timeout=require(_0xf4b9('0x3'));var express=require(_0xf4b9('0x4'));var router=express[_0xf4b9('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf4b9('0x6'));var config=require(_0xf4b9('0x7'));var controller=require(_0xf4b9('0x8'));router[_0xf4b9('0x9')]('/',auth[_0xf4b9('0xa')](),controller[_0xf4b9('0xb')]);router[_0xf4b9('0x9')]('/describe',auth[_0xf4b9('0xa')](),controller[_0xf4b9('0xc')]);router[_0xf4b9('0x9')](_0xf4b9('0xd'),auth[_0xf4b9('0xa')](),controller[_0xf4b9('0xe')]);router[_0xf4b9('0xf')]('/',auth[_0xf4b9('0xa')](),controller['create']);router[_0xf4b9('0x10')](_0xf4b9('0xd'),auth[_0xf4b9('0xa')](),controller[_0xf4b9('0x11')]);router[_0xf4b9('0x12')](_0xf4b9('0xd'),auth[_0xf4b9('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index f73a031..b49c6f8 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 _0x6aa7=['DATE','sequelize','STRING'];(function(_0x5eb07c,_0x5a3c8e){var _0x2e505e=function(_0x42cb38){while(--_0x42cb38){_0x5eb07c['push'](_0x5eb07c['shift']());}};_0x2e505e(++_0x5a3c8e);}(_0x6aa7,0x178));var _0x76aa=function(_0x168e24,_0x100014){_0x168e24=_0x168e24-0x0;var _0x347066=_0x6aa7[_0x168e24];return _0x347066;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x76aa('0x1')]},'joinAt':{'type':Sequelize[_0x76aa('0x2')]},'leaveAt':{'type':Sequelize[_0x76aa('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x76aa('0x2')]},'reason':{'type':Sequelize[_0x76aa('0x1')]}}; \ No newline at end of file +var _0x55ca=['DATE','STRING','sequelize','exports'];(function(_0xb4c15b,_0x338632){var _0x517058=function(_0x190d49){while(--_0x190d49){_0xb4c15b['push'](_0xb4c15b['shift']());}};_0x517058(++_0x338632);}(_0x55ca,0x126));var _0xa55c=function(_0xd3e16a,_0x28517e){_0xd3e16a=_0xd3e16a-0x0;var _0x449538=_0x55ca[_0xd3e16a];return _0x449538;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa55c('0x2')]},'acceptAt':{'type':Sequelize[_0xa55c('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 92f2e37..e0ad480 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 _0x016f=['then','sendStatus','error','stack','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','length','catch','create','body','find','params','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','status','json','count','limit','set','Content-Range','reject','save','update','destroy'];(function(_0x5e65b3,_0x32b7f4){var _0x117cc0=function(_0x1ce844){while(--_0x1ce844){_0x5e65b3['push'](_0x5e65b3['shift']());}};_0x117cc0(++_0x32b7f4);}(_0x016f,0x14c));var _0xf016=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x016f[_0x580576];return _0x3f55a0;};'use strict';var pdf=require(_0xf016('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf016('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf016('0x2'));var rp=require(_0xf016('0x3'));var moment=require(_0xf016('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf016('0x5'));var path=require('path');var sox=require(_0xf016('0x6'));var csv=require(_0xf016('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf016('0x8'));var squel=require(_0xf016('0x9'));var crypto=require(_0xf016('0xa'));var jsforce=require(_0xf016('0xb'));var deskjs=require(_0xf016('0xc'));var toCsv=require(_0xf016('0x7'));var querystring=require('querystring');var Papa=require(_0xf016('0xd'));var Redis=require(_0xf016('0xe'));var authService=require(_0xf016('0xf'));var qs=require(_0xf016('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf016('0x11'));var logger=require(_0xf016('0x12'))(_0xf016('0x13'));var utils=require('../../config/utils');var config=require(_0xf016('0x14'));var licenseUtil=require(_0xf016('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x257a36,_0x1bec7a){_0x1bec7a=_0x1bec7a||0xcc;return function(_0x1f866b){if(_0x1f866b){return _0x257a36['sendStatus'](_0x1bec7a);}return _0x257a36['status'](_0x1bec7a)[_0xf016('0x16')]();};}function respondWithResult(_0x50022d,_0x4567a6){_0x4567a6=_0x4567a6||0xc8;return function(_0x4ba59f){if(_0x4ba59f){return _0x50022d[_0xf016('0x17')](_0x4567a6)[_0xf016('0x18')](_0x4ba59f);}};}function respondWithFilteredResult(_0x480460,_0x452714){return function(_0x352313){if(_0x352313){var _0x4273c0=_0x352313[_0xf016('0x19')],_0x3e41d0=_0x452714['offset'],_0x43c812=_0x452714['offset']+_0x452714[_0xf016('0x1a')],_0x3b2d7b;if(_0x43c812>=_0x4273c0){_0x43c812=_0x4273c0;_0x3b2d7b=0xc8;}else{_0x3b2d7b=0xce;}_0x480460[_0xf016('0x17')](_0x3b2d7b);return _0x480460[_0xf016('0x1b')](_0xf016('0x1c'),_0x3e41d0+'-'+_0x43c812+'/'+_0x4273c0)[_0xf016('0x18')](_0x352313);}return null;};}function patchUpdates(_0x2ce43e){return function(_0x31f48d){try{jsonpatch['apply'](_0x31f48d,_0x2ce43e,!![]);}catch(_0x388e78){return BPromise[_0xf016('0x1d')](_0x388e78);}return _0x31f48d[_0xf016('0x1e')]();};}function saveUpdates(_0x4fe901,_0x3e31a1){return function(_0x2ad69d){if(_0x2ad69d){return _0x2ad69d[_0xf016('0x1f')](_0x4fe901)['then'](function(_0x532f36){return _0x532f36;});}return null;};}function removeEntity(_0x4d7474,_0x3e2e15){return function(_0x199adf){if(_0x199adf){return _0x199adf[_0xf016('0x20')]()[_0xf016('0x21')](function(){_0x4d7474[_0xf016('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1adf9f,_0x544dd4){return function(_0x20af07){if(!_0x20af07){_0x1adf9f[_0xf016('0x22')](0x194);}return _0x20af07;};}function handleError(_0x20f343,_0x2f63ff){_0x2f63ff=_0x2f63ff||0x1f4;return function(_0x21f6ca){logger[_0xf016('0x23')](_0x21f6ca[_0xf016('0x24')]);if(_0x21f6ca[_0xf016('0x25')]){delete _0x21f6ca['name'];}_0x20f343[_0xf016('0x17')](_0x2f63ff)[_0xf016('0x26')](_0x21f6ca);};}exports[_0xf016('0x27')]=function(_0x23652a,_0x1eb348){var _0x47a20a={},_0x384a97={},_0x916dca={'count':0x0,'rows':[]};var _0x5344d4=_['map'](db[_0xf016('0x28')][_0xf016('0x29')],function(_0x43cf19){return{'name':_0x43cf19[_0xf016('0x2a')],'type':_0x43cf19['type']['key']};});_0x384a97[_0xf016('0x2b')]=_[_0xf016('0x2c')](_0x5344d4,_0xf016('0x25'));_0x384a97[_0xf016('0x2d')]=_[_0xf016('0x2e')](_0x23652a['query']);_0x384a97[_0xf016('0x2f')]=_[_0xf016('0x30')](_0x384a97[_0xf016('0x2b')],_0x384a97[_0xf016('0x2d')]);_0x47a20a[_0xf016('0x31')]=_['intersection'](_0x384a97[_0xf016('0x2b')],qs[_0xf016('0x32')](_0x23652a[_0xf016('0x2d')][_0xf016('0x32')]));_0x47a20a['attributes']=_0x47a20a['attributes']['length']?_0x47a20a['attributes']:_0x384a97[_0xf016('0x2b')];if(!_0x23652a['query'][_0xf016('0x33')](_0xf016('0x34'))){_0x47a20a[_0xf016('0x1a')]=qs['limit'](_0x23652a[_0xf016('0x2d')]['limit']);_0x47a20a[_0xf016('0x35')]=qs[_0xf016('0x35')](_0x23652a[_0xf016('0x2d')][_0xf016('0x35')]);}_0x47a20a[_0xf016('0x36')]=qs[_0xf016('0x37')](_0x23652a['query']['sort']);_0x47a20a[_0xf016('0x38')]=qs['filters'](_[_0xf016('0x39')](_0x23652a['query'],_0x384a97[_0xf016('0x2f')]),_0x5344d4);if(_0x23652a[_0xf016('0x2d')][_0xf016('0x3a')]){_0x47a20a['where']=_[_0xf016('0x3b')](_0x47a20a['where'],{'$or':_[_0xf016('0x2c')](_0x5344d4,function(_0x37052f){if(_0x37052f['type']!=='VIRTUAL'){var _0xe0f2bb={};_0xe0f2bb[_0x37052f[_0xf016('0x25')]]={'$like':'%'+_0x23652a[_0xf016('0x2d')][_0xf016('0x3a')]+'%'};return _0xe0f2bb;}})});}_0x47a20a=_[_0xf016('0x3b')]({},_0x47a20a,_0x23652a[_0xf016('0x3c')]);var _0x96c646={'where':_0x47a20a[_0xf016('0x38')]};return db[_0xf016('0x28')][_0xf016('0x19')](_0x96c646)[_0xf016('0x21')](function(_0x53688c){_0x916dca[_0xf016('0x19')]=_0x53688c;if(_0x23652a[_0xf016('0x2d')][_0xf016('0x3d')]){_0x47a20a[_0xf016('0x3e')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xf016('0x3f')](_0x47a20a);})[_0xf016('0x21')](function(_0x2876c1){_0x916dca[_0xf016('0x40')]=_0x2876c1;return _0x916dca;})['then'](respondWithFilteredResult(_0x1eb348,_0x47a20a))['catch'](handleError(_0x1eb348,null));};exports[_0xf016('0x41')]=function(_0x394045,_0x47722f){var _0x13fc34={'raw':!![],'where':{'id':_0x394045['params']['id']}},_0x5b1454={};_0x5b1454['model']=_['keys'](db[_0xf016('0x28')][_0xf016('0x29')]);_0x5b1454[_0xf016('0x2d')]=_[_0xf016('0x2e')](_0x394045['query']);_0x5b1454['filters']=_[_0xf016('0x30')](_0x5b1454[_0xf016('0x2b')],_0x5b1454['query']);_0x13fc34[_0xf016('0x31')]=_['intersection'](_0x5b1454[_0xf016('0x2b')],qs['fields'](_0x394045[_0xf016('0x2d')][_0xf016('0x32')]));_0x13fc34[_0xf016('0x31')]=_0x13fc34[_0xf016('0x31')][_0xf016('0x42')]?_0x13fc34[_0xf016('0x31')]:_0x5b1454['model'];if(_0x394045[_0xf016('0x2d')][_0xf016('0x3d')]){_0x13fc34[_0xf016('0x3e')]=[{'all':!![]}];}_0x13fc34=_[_0xf016('0x3b')]({},_0x13fc34,_0x394045[_0xf016('0x3c')]);return db[_0xf016('0x28')]['find'](_0x13fc34)[_0xf016('0x21')](handleEntityNotFound(_0x47722f,null))['then'](respondWithResult(_0x47722f,null))[_0xf016('0x43')](handleError(_0x47722f,null));};exports[_0xf016('0x44')]=function(_0x27e1b,_0x195b29){return db['WhatsappQueueReport']['create'](_0x27e1b[_0xf016('0x45')],{})['then'](respondWithResult(_0x195b29,0xc9))[_0xf016('0x43')](handleError(_0x195b29,null));};exports['update']=function(_0x7c8e0e,_0x472fd8){if(_0x7c8e0e[_0xf016('0x45')]['id']){delete _0x7c8e0e[_0xf016('0x45')]['id'];}return db[_0xf016('0x28')][_0xf016('0x46')]({'where':{'id':_0x7c8e0e[_0xf016('0x47')]['id']}})[_0xf016('0x21')](handleEntityNotFound(_0x472fd8,null))['then'](saveUpdates(_0x7c8e0e[_0xf016('0x45')],null))[_0xf016('0x21')](respondWithResult(_0x472fd8,null))[_0xf016('0x43')](handleError(_0x472fd8,null));};exports[_0xf016('0x20')]=function(_0x8f08ce,_0x1d5fe2){return db['WhatsappQueueReport'][_0xf016('0x46')]({'where':{'id':_0x8f08ce[_0xf016('0x47')]['id']}})[_0xf016('0x21')](handleEntityNotFound(_0x1d5fe2,null))[_0xf016('0x21')](removeEntity(_0x1d5fe2,null))[_0xf016('0x43')](handleError(_0x1d5fe2,null));};exports['describe']=function(_0x18f0ea,_0x5e1641){return db[_0xf016('0x28')][_0xf016('0x48')]()[_0xf016('0x21')](respondWithResult(_0x5e1641,null))[_0xf016('0x43')](handleError(_0x5e1641,null));}; \ No newline at end of file +var _0x2fda=['filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','squel','crypto','jsforce','to-csv','../../components/auth/service','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','update','then','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort'];(function(_0x35a56a,_0x2bf0b8){var _0x204184=function(_0x507720){while(--_0x507720){_0x35a56a['push'](_0x35a56a['shift']());}};_0x204184(++_0x2bf0b8);}(_0x2fda,0xdd));var _0xa2fd=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2fda[_0x1ac595];return _0x455fff;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa2fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa2fd('0x1'));var jsonpatch=require(_0xa2fd('0x2'));var rp=require(_0xa2fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa2fd('0x4'));var util=require(_0xa2fd('0x5'));var path=require(_0xa2fd('0x6'));var sox=require(_0xa2fd('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa2fd('0x8'));var crypto=require(_0xa2fd('0x9'));var jsforce=require(_0xa2fd('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa2fd('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa2fd('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2fd('0xd'))('api');var utils=require(_0xa2fd('0xe'));var config=require('../../config/environment');var licenseUtil=require(_0xa2fd('0xf'));var db=require(_0xa2fd('0x10'))['db'];function respondWithStatusCode(_0x4978d7,_0x5454bb){_0x5454bb=_0x5454bb||0xcc;return function(_0x3f56e1){if(_0x3f56e1){return _0x4978d7[_0xa2fd('0x11')](_0x5454bb);}return _0x4978d7['status'](_0x5454bb)[_0xa2fd('0x12')]();};}function respondWithResult(_0x3f72c7,_0x30bea9){_0x30bea9=_0x30bea9||0xc8;return function(_0x5d75c4){if(_0x5d75c4){return _0x3f72c7[_0xa2fd('0x13')](_0x30bea9)[_0xa2fd('0x14')](_0x5d75c4);}};}function respondWithFilteredResult(_0x35da12,_0x27bfd7){return function(_0x515052){if(_0x515052){var _0x3f1050=_0x515052[_0xa2fd('0x15')],_0x4c7062=_0x27bfd7[_0xa2fd('0x16')],_0xd648b8=_0x27bfd7[_0xa2fd('0x16')]+_0x27bfd7[_0xa2fd('0x17')],_0x568052;if(_0xd648b8>=_0x3f1050){_0xd648b8=_0x3f1050;_0x568052=0xc8;}else{_0x568052=0xce;}_0x35da12[_0xa2fd('0x13')](_0x568052);return _0x35da12['set'](_0xa2fd('0x18'),_0x4c7062+'-'+_0xd648b8+'/'+_0x3f1050)['json'](_0x515052);}return null;};}function patchUpdates(_0x77ee4a){return function(_0x3b8c2a){try{jsonpatch['apply'](_0x3b8c2a,_0x77ee4a,!![]);}catch(_0x49e2bf){return BPromise[_0xa2fd('0x19')](_0x49e2bf);}return _0x3b8c2a['save']();};}function saveUpdates(_0x126111,_0x2fd949){return function(_0x2a351f){if(_0x2a351f){return _0x2a351f[_0xa2fd('0x1a')](_0x126111)[_0xa2fd('0x1b')](function(_0x586789){return _0x586789;});}return null;};}function removeEntity(_0x1fff84,_0x121f94){return function(_0x12056a){if(_0x12056a){return _0x12056a['destroy']()[_0xa2fd('0x1b')](function(){_0x1fff84['status'](0xcc)[_0xa2fd('0x12')]();});}};}function handleEntityNotFound(_0x33d60d,_0x1a07e6){return function(_0x5e6aec){if(!_0x5e6aec){_0x33d60d[_0xa2fd('0x11')](0x194);}return _0x5e6aec;};}function handleError(_0x22a52f,_0x112df6){_0x112df6=_0x112df6||0x1f4;return function(_0x4cf820){logger['error'](_0x4cf820[_0xa2fd('0x1c')]);if(_0x4cf820['name']){delete _0x4cf820[_0xa2fd('0x1d')];}_0x22a52f[_0xa2fd('0x13')](_0x112df6)[_0xa2fd('0x1e')](_0x4cf820);};}exports[_0xa2fd('0x1f')]=function(_0x15fcab,_0x588019){var _0x287237={},_0x19f3e0={},_0x1b1de2={'count':0x0,'rows':[]};var _0x56dc2c=_[_0xa2fd('0x20')](db[_0xa2fd('0x21')][_0xa2fd('0x22')],function(_0x54e713){return{'name':_0x54e713[_0xa2fd('0x23')],'type':_0x54e713['type'][_0xa2fd('0x24')]};});_0x19f3e0[_0xa2fd('0x25')]=_['map'](_0x56dc2c,_0xa2fd('0x1d'));_0x19f3e0[_0xa2fd('0x26')]=_[_0xa2fd('0x27')](_0x15fcab[_0xa2fd('0x26')]);_0x19f3e0['filters']=_[_0xa2fd('0x28')](_0x19f3e0[_0xa2fd('0x25')],_0x19f3e0['query']);_0x287237['attributes']=_['intersection'](_0x19f3e0[_0xa2fd('0x25')],qs['fields'](_0x15fcab['query'][_0xa2fd('0x29')]));_0x287237[_0xa2fd('0x2a')]=_0x287237[_0xa2fd('0x2a')][_0xa2fd('0x2b')]?_0x287237[_0xa2fd('0x2a')]:_0x19f3e0[_0xa2fd('0x25')];if(!_0x15fcab[_0xa2fd('0x26')]['hasOwnProperty'](_0xa2fd('0x2c'))){_0x287237[_0xa2fd('0x17')]=qs[_0xa2fd('0x17')](_0x15fcab[_0xa2fd('0x26')]['limit']);_0x287237[_0xa2fd('0x16')]=qs[_0xa2fd('0x16')](_0x15fcab[_0xa2fd('0x26')]['offset']);}_0x287237[_0xa2fd('0x2d')]=qs[_0xa2fd('0x2e')](_0x15fcab[_0xa2fd('0x26')][_0xa2fd('0x2e')]);_0x287237['where']=qs[_0xa2fd('0x2f')](_[_0xa2fd('0x30')](_0x15fcab[_0xa2fd('0x26')],_0x19f3e0[_0xa2fd('0x2f')]),_0x56dc2c);if(_0x15fcab[_0xa2fd('0x26')][_0xa2fd('0x31')]){_0x287237[_0xa2fd('0x32')]=_[_0xa2fd('0x33')](_0x287237[_0xa2fd('0x32')],{'$or':_[_0xa2fd('0x20')](_0x56dc2c,function(_0x560e3d){if(_0x560e3d[_0xa2fd('0x34')]!==_0xa2fd('0x35')){var _0x436d7f={};_0x436d7f[_0x560e3d[_0xa2fd('0x1d')]]={'$like':'%'+_0x15fcab[_0xa2fd('0x26')][_0xa2fd('0x31')]+'%'};return _0x436d7f;}})});}_0x287237=_[_0xa2fd('0x33')]({},_0x287237,_0x15fcab[_0xa2fd('0x36')]);var _0x470c98={'where':_0x287237[_0xa2fd('0x32')]};return db['WhatsappQueueReport'][_0xa2fd('0x15')](_0x470c98)[_0xa2fd('0x1b')](function(_0x228638){_0x1b1de2[_0xa2fd('0x15')]=_0x228638;if(_0x15fcab[_0xa2fd('0x26')][_0xa2fd('0x37')]){_0x287237[_0xa2fd('0x38')]=[{'all':!![]}];}return db[_0xa2fd('0x21')][_0xa2fd('0x39')](_0x287237);})[_0xa2fd('0x1b')](function(_0x1b0819){_0x1b1de2[_0xa2fd('0x3a')]=_0x1b0819;return _0x1b1de2;})[_0xa2fd('0x1b')](respondWithFilteredResult(_0x588019,_0x287237))[_0xa2fd('0x3b')](handleError(_0x588019,null));};exports[_0xa2fd('0x3c')]=function(_0x2290c5,_0x1e522e){var _0x2dfab0={'raw':!![],'where':{'id':_0x2290c5[_0xa2fd('0x3d')]['id']}},_0x318aa4={};_0x318aa4['model']=_[_0xa2fd('0x27')](db[_0xa2fd('0x21')][_0xa2fd('0x22')]);_0x318aa4[_0xa2fd('0x26')]=_[_0xa2fd('0x27')](_0x2290c5[_0xa2fd('0x26')]);_0x318aa4[_0xa2fd('0x2f')]=_[_0xa2fd('0x28')](_0x318aa4[_0xa2fd('0x25')],_0x318aa4[_0xa2fd('0x26')]);_0x2dfab0[_0xa2fd('0x2a')]=_[_0xa2fd('0x28')](_0x318aa4['model'],qs['fields'](_0x2290c5['query'][_0xa2fd('0x29')]));_0x2dfab0[_0xa2fd('0x2a')]=_0x2dfab0[_0xa2fd('0x2a')][_0xa2fd('0x2b')]?_0x2dfab0[_0xa2fd('0x2a')]:_0x318aa4[_0xa2fd('0x25')];if(_0x2290c5[_0xa2fd('0x26')][_0xa2fd('0x37')]){_0x2dfab0[_0xa2fd('0x38')]=[{'all':!![]}];}_0x2dfab0=_[_0xa2fd('0x33')]({},_0x2dfab0,_0x2290c5['options']);return db[_0xa2fd('0x21')][_0xa2fd('0x3e')](_0x2dfab0)[_0xa2fd('0x1b')](handleEntityNotFound(_0x1e522e,null))[_0xa2fd('0x1b')](respondWithResult(_0x1e522e,null))['catch'](handleError(_0x1e522e,null));};exports[_0xa2fd('0x3f')]=function(_0x507044,_0x1906a4){return db[_0xa2fd('0x21')][_0xa2fd('0x3f')](_0x507044['body'],{})['then'](respondWithResult(_0x1906a4,0xc9))[_0xa2fd('0x3b')](handleError(_0x1906a4,null));};exports['update']=function(_0x2fd1c9,_0x53cd2f){if(_0x2fd1c9[_0xa2fd('0x40')]['id']){delete _0x2fd1c9[_0xa2fd('0x40')]['id'];}return db[_0xa2fd('0x21')]['find']({'where':{'id':_0x2fd1c9['params']['id']}})[_0xa2fd('0x1b')](handleEntityNotFound(_0x53cd2f,null))[_0xa2fd('0x1b')](saveUpdates(_0x2fd1c9['body'],null))[_0xa2fd('0x1b')](respondWithResult(_0x53cd2f,null))[_0xa2fd('0x3b')](handleError(_0x53cd2f,null));};exports[_0xa2fd('0x41')]=function(_0x5761dc,_0x43b0d6){return db[_0xa2fd('0x21')][_0xa2fd('0x3e')]({'where':{'id':_0x5761dc[_0xa2fd('0x3d')]['id']}})[_0xa2fd('0x1b')](handleEntityNotFound(_0x43b0d6,null))[_0xa2fd('0x1b')](removeEntity(_0x43b0d6,null))[_0xa2fd('0x3b')](handleError(_0x43b0d6,null));};exports['describe']=function(_0x3b64a7,_0x34548d){return db[_0xa2fd('0x21')][_0xa2fd('0x42')]()[_0xa2fd('0x1b')](respondWithResult(_0x34548d,null))[_0xa2fd('0x3b')](handleError(_0x34548d,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 33da458..5b3b323 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 _0x218f=['request-promise','path','rimraf','../../config/environment','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x150b7f,_0x51b5c5){var _0x50ddbf=function(_0x3626e4){while(--_0x3626e4){_0x150b7f['push'](_0x150b7f['shift']());}};_0x50ddbf(++_0x51b5c5);}(_0x218f,0x191));var _0xf218=function(_0x4f6cd6,_0x14457f){_0x4f6cd6=_0x4f6cd6-0x0;var _0x59c9b0=_0x218f[_0x4f6cd6];return _0x59c9b0;};'use strict';var _=require(_0xf218('0x0'));var util=require(_0xf218('0x1'));var logger=require(_0xf218('0x2'))(_0xf218('0x3'));var moment=require('moment');var BPromise=require(_0xf218('0x4'));var rp=require(_0xf218('0x5'));var fs=require('fs');var path=require(_0xf218('0x6'));var rimraf=require(_0xf218('0x7'));var config=require(_0xf218('0x8'));var attributes=require('./whatsappQueueReport.attributes');module[_0xf218('0x9')]=function(_0x45dd06,_0x24ca52){return _0x45dd06[_0xf218('0xa')](_0xf218('0xb'),attributes,{'tableName':_0xf218('0xc'),'paranoid':![],'indexes':[{'name':_0xf218('0xd'),'fields':[_0xf218('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xad94=['path','rimraf','../../config/environment','exports','define','report_whatsapp_queue','uniqueid','lodash','util','moment','bluebird','request-promise'];(function(_0x3c1fc8,_0x3517b9){var _0x2990a9=function(_0x38b5fd){while(--_0x38b5fd){_0x3c1fc8['push'](_0x3c1fc8['shift']());}};_0x2990a9(++_0x3517b9);}(_0xad94,0xbb));var _0x4ad9=function(_0x554b09,_0xcc781a){_0x554b09=_0x554b09-0x0;var _0x4d3676=_0xad94[_0x554b09];return _0x4d3676;};'use strict';var _=require(_0x4ad9('0x0'));var util=require(_0x4ad9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4ad9('0x2'));var BPromise=require(_0x4ad9('0x3'));var rp=require(_0x4ad9('0x4'));var fs=require('fs');var path=require(_0x4ad9('0x5'));var rimraf=require(_0x4ad9('0x6'));var config=require(_0x4ad9('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0x4ad9('0x8')]=function(_0x4e38b0,_0x4d5795){return _0x4e38b0[_0x4ad9('0x9')]('WhatsappQueueReport',attributes,{'tableName':_0x4ad9('0xa'),'paranoid':![],'indexes':[{'name':_0x4ad9('0xb'),'fields':[_0x4ad9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 93df6ee..33fc9f3 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 _0x52b4=['jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','WhatsappQueueReport','create','body','options','raw','then','debug','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','attributes','limit','stringify','lodash','bluebird','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x4f55a9,_0x35d9c0){var _0x37bcb3=function(_0x286fb2){while(--_0x286fb2){_0x4f55a9['push'](_0x4f55a9['shift']());}};_0x37bcb3(++_0x35d9c0);}(_0x52b4,0x15a));var _0x452b=function(_0x54d81e,_0x218c2b){_0x54d81e=_0x54d81e-0x0;var _0x2d4d2c=_0x52b4[_0x54d81e];return _0x2d4d2c;};'use strict';var _=require(_0x452b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x452b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x452b('0x2'));var db=require(_0x452b('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x452b('0x4'));var config=require(_0x452b('0x5'));var jayson=require(_0x452b('0x6'));var client=jayson[_0x452b('0x7')][_0x452b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a0e22,_0x5465a5,_0x22ff61){return new BPromise(function(_0x5ba28b,_0x1e5d92){return client[_0x452b('0x9')](_0x4a0e22,_0x22ff61)['then'](function(_0x5ddbf1){logger[_0x452b('0xa')](_0x452b('0xb'),_0x5465a5,_0x452b('0xc'));logger['debug'](_0x452b('0xd'),_0x5465a5,_0x452b('0xc'),JSON['stringify'](_0x5ddbf1));if(_0x5ddbf1[_0x452b('0xe')]){if(_0x5ddbf1[_0x452b('0xe')][_0x452b('0xf')]===0x1f4){logger[_0x452b('0xe')](_0x452b('0xb'),_0x5465a5,_0x5ddbf1['error'][_0x452b('0x10')]);return _0x1e5d92(_0x5ddbf1[_0x452b('0xe')][_0x452b('0x10')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x5465a5,_0x5ddbf1[_0x452b('0xe')][_0x452b('0x10')]);return _0x5ba28b(_0x5ddbf1[_0x452b('0xe')][_0x452b('0x10')]);}else{logger[_0x452b('0xa')](_0x452b('0xb'),_0x5465a5,_0x452b('0xc'));_0x5ba28b(_0x5ddbf1[_0x452b('0x11')][_0x452b('0x10')]);}})[_0x452b('0x12')](function(_0x54d0ad){logger[_0x452b('0xe')](_0x452b('0xb'),_0x5465a5,_0x54d0ad);_0x1e5d92(_0x54d0ad);});});}exports['CreateWhatsappQueueReport']=function(_0x411c64){var _0xac3705=this;return new Promise(function(_0x58722c,_0x12b114){return db[_0x452b('0x13')][_0x452b('0x14')](_0x411c64[_0x452b('0x15')],{'raw':_0x411c64[_0x452b('0x16')]?_0x411c64[_0x452b('0x16')][_0x452b('0x17')]===undefined?!![]:![]:!![]})[_0x452b('0x18')](function(_0x214fd9){logger[_0x452b('0xa')]('CreateWhatsappQueueReport',_0x411c64);logger[_0x452b('0x19')](_0x452b('0x1a'),_0x411c64,JSON['stringify'](_0x214fd9));_0x58722c(_0x214fd9);})[_0x452b('0x12')](function(_0x3a30f4){logger[_0x452b('0xe')](_0x452b('0x1a'),_0x3a30f4[_0x452b('0x10')],_0x411c64);_0x12b114(_0xac3705[_0x452b('0xe')](0x1f4,_0x3a30f4[_0x452b('0x10')]));});});};exports[_0x452b('0x1b')]=function(_0x3ac601){var _0x35c0c2=this;return new Promise(function(_0x39816e,_0x5b6fe0){return db['WhatsappQueueReport'][_0x452b('0x1c')](_0x3ac601[_0x452b('0x15')],{'raw':_0x3ac601[_0x452b('0x16')]?_0x3ac601[_0x452b('0x16')][_0x452b('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ac601['options']?_0x3ac601[_0x452b('0x16')]['where']||null:null,'attributes':_0x3ac601[_0x452b('0x16')]?_0x3ac601['options'][_0x452b('0x1d')]||null:null,'limit':_0x3ac601['options']?_0x3ac601['options'][_0x452b('0x1e')]||null:null})['then'](function(_0x1b1831){logger[_0x452b('0xa')](_0x452b('0x1b'),_0x3ac601);logger['debug'](_0x452b('0x1b'),_0x3ac601,JSON[_0x452b('0x1f')](_0x1b1831));_0x39816e(_0x1b1831);})[_0x452b('0x12')](function(_0x13d700){logger[_0x452b('0xe')](_0x452b('0x1b'),_0x13d700[_0x452b('0x10')],_0x3ac601);_0x5b6fe0(_0x35c0c2[_0x452b('0xe')](0x1f4,_0x13d700[_0x452b('0x10')]));});});}; \ No newline at end of file +var _0x74af=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','stringify','UpdateWhatsappQueueReport','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x4c452f,_0xa9b308){var _0x20ba8d=function(_0x506094){while(--_0x506094){_0x4c452f['push'](_0x4c452f['shift']());}};_0x20ba8d(++_0xa9b308);}(_0x74af,0x140));var _0xf74a=function(_0x3df1a7,_0x268ed1){_0x3df1a7=_0x3df1a7-0x0;var _0x34b0ba=_0x74af[_0x3df1a7];return _0x34b0ba;};'use strict';var _=require(_0xf74a('0x0'));var util=require(_0xf74a('0x1'));var moment=require(_0xf74a('0x2'));var BPromise=require(_0xf74a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf74a('0x4'));var logger=require(_0xf74a('0x5'))('rpc');var config=require(_0xf74a('0x6'));var jayson=require(_0xf74a('0x7'));var client=jayson['client'][_0xf74a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xbc9f84,_0x1b116d,_0x21f2b3){return new BPromise(function(_0x10adeb,_0x390588){return client['request'](_0xbc9f84,_0x21f2b3)[_0xf74a('0x9')](function(_0x4b4c4b){logger['info'](_0xf74a('0xa'),_0x1b116d,_0xf74a('0xb'));logger[_0xf74a('0xc')](_0xf74a('0xd'),_0x1b116d,_0xf74a('0xb'),JSON['stringify'](_0x4b4c4b));if(_0x4b4c4b[_0xf74a('0xe')]){if(_0x4b4c4b[_0xf74a('0xe')][_0xf74a('0xf')]===0x1f4){logger['error'](_0xf74a('0xa'),_0x1b116d,_0x4b4c4b[_0xf74a('0xe')][_0xf74a('0x10')]);return _0x390588(_0x4b4c4b[_0xf74a('0xe')][_0xf74a('0x10')]);}logger['error'](_0xf74a('0xa'),_0x1b116d,_0x4b4c4b[_0xf74a('0xe')][_0xf74a('0x10')]);return _0x10adeb(_0x4b4c4b['error']['message']);}else{logger[_0xf74a('0x11')](_0xf74a('0xa'),_0x1b116d,'request\x20sent');_0x10adeb(_0x4b4c4b['result'][_0xf74a('0x10')]);}})['catch'](function(_0xe8b8c8){logger[_0xf74a('0xe')](_0xf74a('0xa'),_0x1b116d,_0xe8b8c8);_0x390588(_0xe8b8c8);});});}exports[_0xf74a('0x12')]=function(_0x4fa33e){var _0x3a74b1=this;return new Promise(function(_0x2bbada,_0x32d6f8){return db[_0xf74a('0x13')]['create'](_0x4fa33e[_0xf74a('0x14')],{'raw':_0x4fa33e[_0xf74a('0x15')]?_0x4fa33e[_0xf74a('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xf74a('0x9')](function(_0x5caead){logger[_0xf74a('0x11')](_0xf74a('0x12'),_0x4fa33e);logger[_0xf74a('0xc')](_0xf74a('0x12'),_0x4fa33e,JSON[_0xf74a('0x16')](_0x5caead));_0x2bbada(_0x5caead);})['catch'](function(_0x4d45e2){logger[_0xf74a('0xe')]('CreateWhatsappQueueReport',_0x4d45e2[_0xf74a('0x10')],_0x4fa33e);_0x32d6f8(_0x3a74b1[_0xf74a('0xe')](0x1f4,_0x4d45e2[_0xf74a('0x10')]));});});};exports[_0xf74a('0x17')]=function(_0x1b7e32){var _0x1eff40=this;return new Promise(function(_0x50db2f,_0x50b8ca){return db[_0xf74a('0x13')]['update'](_0x1b7e32['body'],{'raw':_0x1b7e32[_0xf74a('0x15')]?_0x1b7e32[_0xf74a('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7e32[_0xf74a('0x15')]?_0x1b7e32['options'][_0xf74a('0x18')]||null:null,'attributes':_0x1b7e32[_0xf74a('0x15')]?_0x1b7e32[_0xf74a('0x15')][_0xf74a('0x19')]||null:null,'limit':_0x1b7e32[_0xf74a('0x15')]?_0x1b7e32['options'][_0xf74a('0x1a')]||null:null})[_0xf74a('0x9')](function(_0xda7694){logger[_0xf74a('0x11')](_0xf74a('0x17'),_0x1b7e32);logger[_0xf74a('0xc')](_0xf74a('0x17'),_0x1b7e32,JSON[_0xf74a('0x16')](_0xda7694));_0x50db2f(_0xda7694);})['catch'](function(_0x5990ce){logger[_0xf74a('0xe')](_0xf74a('0x17'),_0x5990ce[_0xf74a('0x10')],_0x1b7e32);_0x50b8ca(_0x1eff40[_0xf74a('0xe')](0x1f4,_0x5990ce['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 4e31c76..4a57f48 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 _0x6ee7=['show','post','update','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x231277,_0x284ac3){var _0x1bb525=function(_0x3c86f6){while(--_0x3c86f6){_0x231277['push'](_0x231277['shift']());}};_0x1bb525(++_0x284ac3);}(_0x6ee7,0x1e1));var _0x76ee=function(_0x342678,_0x50b625){_0x342678=_0x342678-0x0;var _0x144b07=_0x6ee7[_0x342678];return _0x144b07;};'use strict';var multer=require(_0x76ee('0x0'));var util=require(_0x76ee('0x1'));var path=require(_0x76ee('0x2'));var timeout=require(_0x76ee('0x3'));var express=require('express');var router=express[_0x76ee('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x76ee('0x5'));var controller=require(_0x76ee('0x6'));router[_0x76ee('0x7')]('/',auth[_0x76ee('0x8')](),controller[_0x76ee('0x9')]);router[_0x76ee('0x7')](_0x76ee('0xa'),auth[_0x76ee('0x8')](),controller['describe']);router[_0x76ee('0x7')](_0x76ee('0xb'),auth[_0x76ee('0x8')](),controller[_0x76ee('0xc')]);router[_0x76ee('0xd')]('/',auth[_0x76ee('0x8')](),controller['create']);router['put'](_0x76ee('0xb'),auth[_0x76ee('0x8')](),controller[_0x76ee('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x76ee('0xf')]);module[_0x76ee('0x10')]=router; \ No newline at end of file +var _0x3f18=['update','delete','destroy','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','/describe','describe','/:id','isAuthenticated','show','post','create'];(function(_0x86337d,_0x2b57c3){var _0x22b2c6=function(_0x180d16){while(--_0x180d16){_0x86337d['push'](_0x86337d['shift']());}};_0x22b2c6(++_0x2b57c3);}(_0x3f18,0xc9));var _0x83f1=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3f18[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x83f1('0x0'));var express=require(_0x83f1('0x1'));var router=express[_0x83f1('0x2')]();var auth=require(_0x83f1('0x3'));var interaction=require(_0x83f1('0x4'));var config=require(_0x83f1('0x5'));var controller=require(_0x83f1('0x6'));router[_0x83f1('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x83f1('0x7')](_0x83f1('0x8'),auth['isAuthenticated'](),controller[_0x83f1('0x9')]);router['get'](_0x83f1('0xa'),auth[_0x83f1('0xb')](),controller[_0x83f1('0xc')]);router[_0x83f1('0xd')]('/',auth[_0x83f1('0xb')](),controller[_0x83f1('0xe')]);router['put'](_0x83f1('0xa'),auth['isAuthenticated'](),controller[_0x83f1('0xf')]);router[_0x83f1('0x10')](_0x83f1('0xa'),auth[_0x83f1('0xb')](),controller[_0x83f1('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 6b9613d..8520f9d 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 _0xb7e7=['queue','sequelize','STRING','account'];(function(_0x43bdf8,_0x15b56f){var _0x3886cf=function(_0x427c7e){while(--_0x427c7e){_0x43bdf8['push'](_0x43bdf8['shift']());}};_0x3886cf(++_0x15b56f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xb7e7[_0x34bf97];return _0x292719;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x2'),'agent',_0x7b7e('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xb7e7=['queue','sequelize','STRING','account'];(function(_0x579b42,_0x399716){var _0x52c0ff=function(_0x8c8235){while(--_0x8c8235){_0x579b42['push'](_0x579b42['shift']());}};_0x52c0ff(++_0x399716);}(_0xb7e7,0x121));var _0x7b7e=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xb7e7[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x2'),'agent',_0x7b7e('0x3')),'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 f733b85..ad79947 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 _0xd20e=['name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','WhatsappTransferReport','includeAll','include','rows','catch','show','find','create','body','update','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','count','offset','status','set','json','apply','reject','save','then','stack'];(function(_0x5e26ed,_0x4542a2){var _0x3968ee=function(_0x245df4){while(--_0x245df4){_0x5e26ed['push'](_0x5e26ed['shift']());}};_0x3968ee(++_0x4542a2);}(_0xd20e,0xbb));var _0xed20=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xd20e[_0x17b6e3];return _0x3906f3;};'use strict';var pdf=require(_0xed20('0x0'));var emlformat=require(_0xed20('0x1'));var rimraf=require(_0xed20('0x2'));var zipdir=require(_0xed20('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed20('0x4'));var moment=require(_0xed20('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xed20('0x6'));var util=require(_0xed20('0x7'));var path=require('path');var sox=require(_0xed20('0x8'));var csv=require(_0xed20('0x9'));var ejs=require(_0xed20('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xed20('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xed20('0xc'));var toCsv=require(_0xed20('0x9'));var querystring=require(_0xed20('0xd'));var Papa=require('papaparse');var Redis=require(_0xed20('0xe'));var authService=require(_0xed20('0xf'));var qs=require(_0xed20('0x10'));var as=require(_0xed20('0x11'));var hardwareService=require(_0xed20('0x12'));var logger=require('../../config/logger')(_0xed20('0x13'));var utils=require('../../config/utils');var config=require(_0xed20('0x14'));var licenseUtil=require(_0xed20('0x15'));var db=require(_0xed20('0x16'))['db'];function respondWithStatusCode(_0x12687f,_0x366f1a){_0x366f1a=_0x366f1a||0xcc;return function(_0x2a2c80){if(_0x2a2c80){return _0x12687f[_0xed20('0x17')](_0x366f1a);}return _0x12687f['status'](_0x366f1a)[_0xed20('0x18')]();};}function respondWithResult(_0x39c627,_0x116057){_0x116057=_0x116057||0xc8;return function(_0x112767){if(_0x112767){return _0x39c627['status'](_0x116057)['json'](_0x112767);}};}function respondWithFilteredResult(_0x586779,_0x1eb1bc){return function(_0x263982){if(_0x263982){var _0x240beb=_0x263982[_0xed20('0x19')],_0x2f60a0=_0x1eb1bc[_0xed20('0x1a')],_0xa03b21=_0x1eb1bc['offset']+_0x1eb1bc['limit'],_0x520990;if(_0xa03b21>=_0x240beb){_0xa03b21=_0x240beb;_0x520990=0xc8;}else{_0x520990=0xce;}_0x586779[_0xed20('0x1b')](_0x520990);return _0x586779[_0xed20('0x1c')]('Content-Range',_0x2f60a0+'-'+_0xa03b21+'/'+_0x240beb)[_0xed20('0x1d')](_0x263982);}return null;};}function patchUpdates(_0x42a837){return function(_0x30e086){try{jsonpatch[_0xed20('0x1e')](_0x30e086,_0x42a837,!![]);}catch(_0x12dd38){return BPromise[_0xed20('0x1f')](_0x12dd38);}return _0x30e086[_0xed20('0x20')]();};}function saveUpdates(_0x5431f9,_0x490fc8){return function(_0x55a233){if(_0x55a233){return _0x55a233['update'](_0x5431f9)[_0xed20('0x21')](function(_0x53ce09){return _0x53ce09;});}return null;};}function removeEntity(_0x334b82,_0xe1aee4){return function(_0x3cf063){if(_0x3cf063){return _0x3cf063['destroy']()['then'](function(){_0x334b82['status'](0xcc)[_0xed20('0x18')]();});}};}function handleEntityNotFound(_0x178de2,_0x228af3){return function(_0x2d7e4b){if(!_0x2d7e4b){_0x178de2['sendStatus'](0x194);}return _0x2d7e4b;};}function handleError(_0x4b21af,_0x43ba23){_0x43ba23=_0x43ba23||0x1f4;return function(_0x5756f4){logger['error'](_0x5756f4[_0xed20('0x22')]);if(_0x5756f4[_0xed20('0x23')]){delete _0x5756f4[_0xed20('0x23')];}_0x4b21af[_0xed20('0x1b')](_0x43ba23)[_0xed20('0x24')](_0x5756f4);};}exports[_0xed20('0x25')]=function(_0x41d4f6,_0x5582ef){var _0x47ef5e={},_0x1779dd={},_0x19db81={'count':0x0,'rows':[]};var _0xaf93b4=_['map'](db['WhatsappTransferReport'][_0xed20('0x26')],function(_0x183fa3){return{'name':_0x183fa3[_0xed20('0x27')],'type':_0x183fa3[_0xed20('0x28')]['key']};});_0x1779dd[_0xed20('0x29')]=_[_0xed20('0x2a')](_0xaf93b4,_0xed20('0x23'));_0x1779dd[_0xed20('0x2b')]=_[_0xed20('0x2c')](_0x41d4f6['query']);_0x1779dd[_0xed20('0x2d')]=_[_0xed20('0x2e')](_0x1779dd[_0xed20('0x29')],_0x1779dd[_0xed20('0x2b')]);_0x47ef5e['attributes']=_[_0xed20('0x2e')](_0x1779dd[_0xed20('0x29')],qs[_0xed20('0x2f')](_0x41d4f6[_0xed20('0x2b')][_0xed20('0x2f')]));_0x47ef5e['attributes']=_0x47ef5e[_0xed20('0x30')][_0xed20('0x31')]?_0x47ef5e[_0xed20('0x30')]:_0x1779dd[_0xed20('0x29')];if(!_0x41d4f6[_0xed20('0x2b')][_0xed20('0x32')](_0xed20('0x33'))){_0x47ef5e[_0xed20('0x34')]=qs[_0xed20('0x34')](_0x41d4f6['query'][_0xed20('0x34')]);_0x47ef5e[_0xed20('0x1a')]=qs[_0xed20('0x1a')](_0x41d4f6['query'][_0xed20('0x1a')]);}_0x47ef5e[_0xed20('0x35')]=qs[_0xed20('0x36')](_0x41d4f6['query']['sort']);_0x47ef5e['where']=qs[_0xed20('0x2d')](_[_0xed20('0x37')](_0x41d4f6[_0xed20('0x2b')],_0x1779dd[_0xed20('0x2d')]),_0xaf93b4);if(_0x41d4f6[_0xed20('0x2b')][_0xed20('0x38')]){_0x47ef5e[_0xed20('0x39')]=_[_0xed20('0x3a')](_0x47ef5e['where'],{'$or':_[_0xed20('0x2a')](_0xaf93b4,function(_0x59c637){if(_0x59c637[_0xed20('0x28')]!==_0xed20('0x3b')){var _0x5e0b18={};_0x5e0b18[_0x59c637['name']]={'$like':'%'+_0x41d4f6[_0xed20('0x2b')][_0xed20('0x38')]+'%'};return _0x5e0b18;}})});}_0x47ef5e=_['merge']({},_0x47ef5e,_0x41d4f6[_0xed20('0x3c')]);var _0x52988f={'where':_0x47ef5e[_0xed20('0x39')]};return db[_0xed20('0x3d')][_0xed20('0x19')](_0x52988f)[_0xed20('0x21')](function(_0x2a01e2){_0x19db81[_0xed20('0x19')]=_0x2a01e2;if(_0x41d4f6[_0xed20('0x2b')][_0xed20('0x3e')]){_0x47ef5e[_0xed20('0x3f')]=[{'all':!![]}];}return db[_0xed20('0x3d')]['findAll'](_0x47ef5e);})[_0xed20('0x21')](function(_0x2547ee){_0x19db81[_0xed20('0x40')]=_0x2547ee;return _0x19db81;})[_0xed20('0x21')](respondWithFilteredResult(_0x5582ef,_0x47ef5e))[_0xed20('0x41')](handleError(_0x5582ef,null));};exports[_0xed20('0x42')]=function(_0xcc7418,_0x3deae9){var _0x5919b2={'raw':!![],'where':{'id':_0xcc7418['params']['id']}},_0x5301c0={};_0x5301c0[_0xed20('0x29')]=_[_0xed20('0x2c')](db[_0xed20('0x3d')]['rawAttributes']);_0x5301c0[_0xed20('0x2b')]=_[_0xed20('0x2c')](_0xcc7418['query']);_0x5301c0[_0xed20('0x2d')]=_[_0xed20('0x2e')](_0x5301c0['model'],_0x5301c0[_0xed20('0x2b')]);_0x5919b2[_0xed20('0x30')]=_[_0xed20('0x2e')](_0x5301c0['model'],qs['fields'](_0xcc7418['query'][_0xed20('0x2f')]));_0x5919b2['attributes']=_0x5919b2[_0xed20('0x30')][_0xed20('0x31')]?_0x5919b2[_0xed20('0x30')]:_0x5301c0[_0xed20('0x29')];if(_0xcc7418[_0xed20('0x2b')][_0xed20('0x3e')]){_0x5919b2[_0xed20('0x3f')]=[{'all':!![]}];}_0x5919b2=_[_0xed20('0x3a')]({},_0x5919b2,_0xcc7418['options']);return db[_0xed20('0x3d')][_0xed20('0x43')](_0x5919b2)['then'](handleEntityNotFound(_0x3deae9,null))[_0xed20('0x21')](respondWithResult(_0x3deae9,null))[_0xed20('0x41')](handleError(_0x3deae9,null));};exports[_0xed20('0x44')]=function(_0x24e727,_0x3ff4d2){return db[_0xed20('0x3d')][_0xed20('0x44')](_0x24e727[_0xed20('0x45')],{})[_0xed20('0x21')](respondWithResult(_0x3ff4d2,0xc9))[_0xed20('0x41')](handleError(_0x3ff4d2,null));};exports[_0xed20('0x46')]=function(_0x8a7d19,_0x105d7a){if(_0x8a7d19['body']['id']){delete _0x8a7d19[_0xed20('0x45')]['id'];}return db[_0xed20('0x3d')]['find']({'where':{'id':_0x8a7d19[_0xed20('0x47')]['id']}})[_0xed20('0x21')](handleEntityNotFound(_0x105d7a,null))[_0xed20('0x21')](saveUpdates(_0x8a7d19[_0xed20('0x45')],null))['then'](respondWithResult(_0x105d7a,null))['catch'](handleError(_0x105d7a,null));};exports[_0xed20('0x48')]=function(_0x4978f3,_0x31a533){return db['WhatsappTransferReport'][_0xed20('0x43')]({'where':{'id':_0x4978f3[_0xed20('0x47')]['id']}})[_0xed20('0x21')](handleEntityNotFound(_0x31a533,null))[_0xed20('0x21')](removeEntity(_0x31a533,null))[_0xed20('0x41')](handleError(_0x31a533,null));};exports[_0xed20('0x49')]=function(_0x27baef,_0x415a66){return db['WhatsappTransferReport'][_0xed20('0x49')]()[_0xed20('0x21')](respondWithResult(_0x415a66,null))[_0xed20('0x41')](handleError(_0x415a66,null));}; \ No newline at end of file +var _0xa5be=['Content-Range','json','apply','reject','destroy','error','stack','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','then','include','findAll','rows','show','params','includeAll','options','find','create','body','catch','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','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','end','status','count','offset','limit'];(function(_0x282ff9,_0x268bfe){var _0x542612=function(_0x4ad95c){while(--_0x4ad95c){_0x282ff9['push'](_0x282ff9['shift']());}};_0x542612(++_0x268bfe);}(_0xa5be,0x10e));var _0xea5b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa5be[_0x1ac595];return _0x455fff;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xea5b('0x0'));var zipdir=require(_0xea5b('0x1'));var jsonpatch=require(_0xea5b('0x2'));var rp=require(_0xea5b('0x3'));var moment=require(_0xea5b('0x4'));var BPromise=require(_0xea5b('0x5'));var Mustache=require('mustache');var util=require(_0xea5b('0x6'));var path=require('path');var sox=require(_0xea5b('0x7'));var csv=require(_0xea5b('0x8'));var ejs=require(_0xea5b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xea5b('0xa'));var crypto=require('crypto');var jsforce=require(_0xea5b('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xea5b('0xc'));var Papa=require('papaparse');var Redis=require(_0xea5b('0xd'));var authService=require(_0xea5b('0xe'));var qs=require(_0xea5b('0xf'));var as=require(_0xea5b('0x10'));var hardwareService=require(_0xea5b('0x11'));var logger=require(_0xea5b('0x12'))(_0xea5b('0x13'));var utils=require(_0xea5b('0x14'));var config=require(_0xea5b('0x15'));var licenseUtil=require(_0xea5b('0x16'));var db=require(_0xea5b('0x17'))['db'];function respondWithStatusCode(_0x591361,_0x4ddcb5){_0x4ddcb5=_0x4ddcb5||0xcc;return function(_0x550218){if(_0x550218){return _0x591361[_0xea5b('0x18')](_0x4ddcb5);}return _0x591361['status'](_0x4ddcb5)[_0xea5b('0x19')]();};}function respondWithResult(_0x41306b,_0x10abb5){_0x10abb5=_0x10abb5||0xc8;return function(_0x1f0c5f){if(_0x1f0c5f){return _0x41306b[_0xea5b('0x1a')](_0x10abb5)['json'](_0x1f0c5f);}};}function respondWithFilteredResult(_0x3809b0,_0x23bc97){return function(_0x8c4cf){if(_0x8c4cf){var _0x3c4ab2=_0x8c4cf[_0xea5b('0x1b')],_0x402ed0=_0x23bc97[_0xea5b('0x1c')],_0x430976=_0x23bc97[_0xea5b('0x1c')]+_0x23bc97[_0xea5b('0x1d')],_0x2aa97f;if(_0x430976>=_0x3c4ab2){_0x430976=_0x3c4ab2;_0x2aa97f=0xc8;}else{_0x2aa97f=0xce;}_0x3809b0[_0xea5b('0x1a')](_0x2aa97f);return _0x3809b0['set'](_0xea5b('0x1e'),_0x402ed0+'-'+_0x430976+'/'+_0x3c4ab2)[_0xea5b('0x1f')](_0x8c4cf);}return null;};}function patchUpdates(_0x2b7f33){return function(_0x1323af){try{jsonpatch[_0xea5b('0x20')](_0x1323af,_0x2b7f33,!![]);}catch(_0x11095d){return BPromise[_0xea5b('0x21')](_0x11095d);}return _0x1323af['save']();};}function saveUpdates(_0x564f66,_0x2e4acd){return function(_0x18791d){if(_0x18791d){return _0x18791d['update'](_0x564f66)['then'](function(_0x992b32){return _0x992b32;});}return null;};}function removeEntity(_0xa0dfe2,_0xed987b){return function(_0x4f12b9){if(_0x4f12b9){return _0x4f12b9[_0xea5b('0x22')]()['then'](function(){_0xa0dfe2[_0xea5b('0x1a')](0xcc)[_0xea5b('0x19')]();});}};}function handleEntityNotFound(_0x440214,_0x3e44cb){return function(_0x45f82a){if(!_0x45f82a){_0x440214[_0xea5b('0x18')](0x194);}return _0x45f82a;};}function handleError(_0x51727b,_0x3def97){_0x3def97=_0x3def97||0x1f4;return function(_0x259c12){logger[_0xea5b('0x23')](_0x259c12[_0xea5b('0x24')]);if(_0x259c12['name']){delete _0x259c12[_0xea5b('0x25')];}_0x51727b[_0xea5b('0x1a')](_0x3def97)[_0xea5b('0x26')](_0x259c12);};}exports['index']=function(_0xf95967,_0x24e9a9){var _0xf98ba3={},_0x8353c={},_0x4fcb53={'count':0x0,'rows':[]};var _0x6703ac=_[_0xea5b('0x27')](db[_0xea5b('0x28')][_0xea5b('0x29')],function(_0x307839){return{'name':_0x307839[_0xea5b('0x2a')],'type':_0x307839[_0xea5b('0x2b')][_0xea5b('0x2c')]};});_0x8353c[_0xea5b('0x2d')]=_['map'](_0x6703ac,'name');_0x8353c[_0xea5b('0x2e')]=_[_0xea5b('0x2f')](_0xf95967[_0xea5b('0x2e')]);_0x8353c[_0xea5b('0x30')]=_[_0xea5b('0x31')](_0x8353c[_0xea5b('0x2d')],_0x8353c[_0xea5b('0x2e')]);_0xf98ba3[_0xea5b('0x32')]=_[_0xea5b('0x31')](_0x8353c[_0xea5b('0x2d')],qs[_0xea5b('0x33')](_0xf95967[_0xea5b('0x2e')][_0xea5b('0x33')]));_0xf98ba3['attributes']=_0xf98ba3[_0xea5b('0x32')][_0xea5b('0x34')]?_0xf98ba3[_0xea5b('0x32')]:_0x8353c[_0xea5b('0x2d')];if(!_0xf95967['query'][_0xea5b('0x35')](_0xea5b('0x36'))){_0xf98ba3[_0xea5b('0x1d')]=qs['limit'](_0xf95967['query'][_0xea5b('0x1d')]);_0xf98ba3['offset']=qs[_0xea5b('0x1c')](_0xf95967[_0xea5b('0x2e')][_0xea5b('0x1c')]);}_0xf98ba3[_0xea5b('0x37')]=qs['sort'](_0xf95967[_0xea5b('0x2e')][_0xea5b('0x38')]);_0xf98ba3[_0xea5b('0x39')]=qs[_0xea5b('0x30')](_[_0xea5b('0x3a')](_0xf95967[_0xea5b('0x2e')],_0x8353c[_0xea5b('0x30')]),_0x6703ac);if(_0xf95967[_0xea5b('0x2e')][_0xea5b('0x3b')]){_0xf98ba3['where']=_['merge'](_0xf98ba3[_0xea5b('0x39')],{'$or':_['map'](_0x6703ac,function(_0x6a916f){if(_0x6a916f[_0xea5b('0x2b')]!==_0xea5b('0x3c')){var _0x39b3a5={};_0x39b3a5[_0x6a916f[_0xea5b('0x25')]]={'$like':'%'+_0xf95967[_0xea5b('0x2e')][_0xea5b('0x3b')]+'%'};return _0x39b3a5;}})});}_0xf98ba3=_['merge']({},_0xf98ba3,_0xf95967['options']);var _0x1e338b={'where':_0xf98ba3[_0xea5b('0x39')]};return db[_0xea5b('0x28')][_0xea5b('0x1b')](_0x1e338b)[_0xea5b('0x3d')](function(_0x3c277f){_0x4fcb53[_0xea5b('0x1b')]=_0x3c277f;if(_0xf95967[_0xea5b('0x2e')]['includeAll']){_0xf98ba3[_0xea5b('0x3e')]=[{'all':!![]}];}return db[_0xea5b('0x28')][_0xea5b('0x3f')](_0xf98ba3);})[_0xea5b('0x3d')](function(_0x343842){_0x4fcb53[_0xea5b('0x40')]=_0x343842;return _0x4fcb53;})[_0xea5b('0x3d')](respondWithFilteredResult(_0x24e9a9,_0xf98ba3))['catch'](handleError(_0x24e9a9,null));};exports[_0xea5b('0x41')]=function(_0xf9ca5b,_0x276499){var _0x301fca={'raw':!![],'where':{'id':_0xf9ca5b[_0xea5b('0x42')]['id']}},_0x1fd23b={};_0x1fd23b[_0xea5b('0x2d')]=_[_0xea5b('0x2f')](db[_0xea5b('0x28')][_0xea5b('0x29')]);_0x1fd23b[_0xea5b('0x2e')]=_[_0xea5b('0x2f')](_0xf9ca5b[_0xea5b('0x2e')]);_0x1fd23b[_0xea5b('0x30')]=_['intersection'](_0x1fd23b[_0xea5b('0x2d')],_0x1fd23b[_0xea5b('0x2e')]);_0x301fca[_0xea5b('0x32')]=_[_0xea5b('0x31')](_0x1fd23b[_0xea5b('0x2d')],qs[_0xea5b('0x33')](_0xf9ca5b[_0xea5b('0x2e')]['fields']));_0x301fca['attributes']=_0x301fca[_0xea5b('0x32')][_0xea5b('0x34')]?_0x301fca[_0xea5b('0x32')]:_0x1fd23b[_0xea5b('0x2d')];if(_0xf9ca5b[_0xea5b('0x2e')][_0xea5b('0x43')]){_0x301fca['include']=[{'all':!![]}];}_0x301fca=_['merge']({},_0x301fca,_0xf9ca5b[_0xea5b('0x44')]);return db[_0xea5b('0x28')][_0xea5b('0x45')](_0x301fca)[_0xea5b('0x3d')](handleEntityNotFound(_0x276499,null))[_0xea5b('0x3d')](respondWithResult(_0x276499,null))['catch'](handleError(_0x276499,null));};exports[_0xea5b('0x46')]=function(_0x4f5007,_0x4cc55a){return db[_0xea5b('0x28')]['create'](_0x4f5007[_0xea5b('0x47')],{})[_0xea5b('0x3d')](respondWithResult(_0x4cc55a,0xc9))[_0xea5b('0x48')](handleError(_0x4cc55a,null));};exports[_0xea5b('0x49')]=function(_0x4cbbf7,_0x91afb5){if(_0x4cbbf7[_0xea5b('0x47')]['id']){delete _0x4cbbf7[_0xea5b('0x47')]['id'];}return db[_0xea5b('0x28')][_0xea5b('0x45')]({'where':{'id':_0x4cbbf7[_0xea5b('0x42')]['id']}})[_0xea5b('0x3d')](handleEntityNotFound(_0x91afb5,null))[_0xea5b('0x3d')](saveUpdates(_0x4cbbf7['body'],null))['then'](respondWithResult(_0x91afb5,null))[_0xea5b('0x48')](handleError(_0x91afb5,null));};exports[_0xea5b('0x22')]=function(_0x26d6f1,_0x25faf6){return db[_0xea5b('0x28')]['find']({'where':{'id':_0x26d6f1['params']['id']}})[_0xea5b('0x3d')](handleEntityNotFound(_0x25faf6,null))[_0xea5b('0x3d')](removeEntity(_0x25faf6,null))[_0xea5b('0x48')](handleError(_0x25faf6,null));};exports['describe']=function(_0xd1c9cd,_0x3fbab8){return db[_0xea5b('0x28')][_0xea5b('0x4a')]()[_0xea5b('0x3d')](respondWithResult(_0x3fbab8,null))[_0xea5b('0x48')](handleError(_0x3fbab8,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 5a856eb..ebe8c00 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 _0x3527=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x3527,0x8f));var _0x7352=function(_0x5948dd,_0x1f6ac8){_0x5948dd=_0x5948dd-0x0;var _0xb1f8be=_0x3527[_0x5948dd];return _0xb1f8be;};'use strict';var _=require(_0x7352('0x0'));var util=require(_0x7352('0x1'));var logger=require(_0x7352('0x2'))(_0x7352('0x3'));var moment=require(_0x7352('0x4'));var BPromise=require(_0x7352('0x5'));var rp=require(_0x7352('0x6'));var fs=require('fs');var path=require(_0x7352('0x7'));var rimraf=require(_0x7352('0x8'));var config=require(_0x7352('0x9'));var attributes=require(_0x7352('0xa'));module[_0x7352('0xb')]=function(_0x23d02b,_0x55d4ee){return _0x23d02b[_0x7352('0xc')](_0x7352('0xd'),attributes,{'tableName':_0x7352('0xe'),'paranoid':![],'indexes':[{'name':_0x7352('0xf'),'fields':[_0x7352('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x64af=['define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','moment','bluebird','path','rimraf','./whatsappTransferReport.attributes'];(function(_0x3ed666,_0x3345f9){var _0x1587f5=function(_0x304fd0){while(--_0x304fd0){_0x3ed666['push'](_0x3ed666['shift']());}};_0x1587f5(++_0x3345f9);}(_0x64af,0xe0));var _0xf64a=function(_0x546f45,_0x3a0b48){_0x546f45=_0x546f45-0x0;var _0x3058cc=_0x64af[_0x546f45];return _0x3058cc;};'use strict';var _=require('lodash');var util=require(_0xf64a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf64a('0x1'));var BPromise=require(_0xf64a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf64a('0x3'));var rimraf=require(_0xf64a('0x4'));var config=require('../../config/environment');var attributes=require(_0xf64a('0x5'));module['exports']=function(_0x329338,_0x360bea){return _0x329338[_0xf64a('0x6')](_0xf64a('0x7'),attributes,{'tableName':_0xf64a('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf64a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index ab436cc..1ab6d50 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 _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\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(_0x314f1d,_0x1763b3){var _0x4988d4=function(_0x9808cc){while(--_0x9808cc){_0x314f1d['push'](_0x314f1d['shift']());}};_0x4988d4(++_0x1763b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\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(_0xe3a2d8,_0x4d32a6){var _0xfff85f=function(_0x3118c2){while(--_0x3118c2){_0xe3a2d8['push'](_0xe3a2d8['shift']());}};_0xfff85f(++_0x4d32a6);}(_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 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/app.js b/server/app.js index 317a980..92bf809 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8276=['filter','online','join','status','name','seedDB','./config/seedDB','default','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','map'];(function(_0x55f346,_0x448779){var _0x47653f=function(_0x36b9c9){while(--_0x36b9c9){_0x55f346['push'](_0x55f346['shift']());}};_0x47653f(++_0x448779);}(_0x8276,0xa7));var _0x6827=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8276[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6827('0x0'));var mysqldb=require(_0x6827('0x1'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0x6827('0x2'))(_0x6827('0x3'));var pm2=require('./config/pm2');var pm2Config=require(_0x6827('0x4'));var schedule=require(_0x6827('0x5'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x6827('0x6'));var transcribe=require(_0x6827('0x7'));function main(){return mysqldb['db'][_0x6827('0x8')][_0x6827('0x9')]()[_0x6827('0xa')](function(){return rpc[_0x6827('0xb')]();})[_0x6827('0xa')](function(_0x2d8f3f){logger[_0x6827('0xc')](_0x2d8f3f);return chat['start']();})[_0x6827('0xa')](function(){return whatsapp[_0x6827('0xd')]();})[_0x6827('0xa')](function(){return schedule['start']();})[_0x6827('0xa')](function(){return transcribe[_0x6827('0xd')]();})[_0x6827('0xa')](function(_0x5d5d3d){logger[_0x6827('0xc')](_0x5d5d3d);return pm2[_0x6827('0xd')](pm2Config);})[_0x6827('0xa')](function(_0x525a75){logger['info']('Online\x20apps:',_[_0x6827('0xe')](_[_0x6827('0xf')](_0x525a75,{'status':_0x6827('0x10')}),'name')[_0x6827('0x11')]());logger[_0x6827('0xc')]('Offline\x20apps:',_['map'](_[_0x6827('0xf')](_0x525a75,function(_0x2ba38d){return _0x2ba38d[_0x6827('0x12')]!==_0x6827('0x10');}),_0x6827('0x13'))['join']()||'None');config[_0x6827('0x14')]&&require(_0x6827('0x15'))['default']();require('./config/license')[_0x6827('0x16')]();})['catch'](function(_0x41a029){logger[_0x6827('0x17')](_0x6827('0x18'),_0x41a029);process[_0x6827('0x19')](0x1);});}main(); \ No newline at end of file +var _0x1b64=['sequelize','sync','info','start','then','Online\x20apps:','map','filter','name','join','Offline\x20apps:','status','online','None','./config/seedDB','default','./config/license','catch','lodash','./mysqldb','./config/environment','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp'];(function(_0x26e3c3,_0x3030b4){var _0x71d019=function(_0x12e3f7){while(--_0x12e3f7){_0x26e3c3['push'](_0x26e3c3['shift']());}};_0x71d019(++_0x3030b4);}(_0x1b64,0x76));var _0x41b6=function(_0xd53b56,_0x19820c){_0xd53b56=_0xd53b56-0x0;var _0x1faaac=_0x1b64[_0xd53b56];return _0x1faaac;};'use strict';var _=require(_0x41b6('0x0'));var mysqldb=require(_0x41b6('0x1'));var rpc=require('./rpc');var config=require(_0x41b6('0x2'));var logger=require('./config/logger')('app');var pm2=require('./config/pm2');var pm2Config=require(_0x41b6('0x3'));var schedule=require(_0x41b6('0x4'));var chat=require(_0x41b6('0x5'));var whatsapp=require(_0x41b6('0x6'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x41b6('0x7')][_0x41b6('0x8')]()['then'](function(){return rpc['listen']();})['then'](function(_0x7763c3){logger[_0x41b6('0x9')](_0x7763c3);return chat[_0x41b6('0xa')]();})[_0x41b6('0xb')](function(){return whatsapp[_0x41b6('0xa')]();})[_0x41b6('0xb')](function(){return schedule['start']();})[_0x41b6('0xb')](function(){return transcribe[_0x41b6('0xa')]();})[_0x41b6('0xb')](function(_0x1e0256){logger[_0x41b6('0x9')](_0x1e0256);return pm2[_0x41b6('0xa')](pm2Config);})[_0x41b6('0xb')](function(_0xd7866){logger[_0x41b6('0x9')](_0x41b6('0xc'),_[_0x41b6('0xd')](_[_0x41b6('0xe')](_0xd7866,{'status':'online'}),_0x41b6('0xf'))[_0x41b6('0x10')]());logger[_0x41b6('0x9')](_0x41b6('0x11'),_['map'](_[_0x41b6('0xe')](_0xd7866,function(_0xed7e7f){return _0xed7e7f[_0x41b6('0x12')]!==_0x41b6('0x13');}),_0x41b6('0xf'))[_0x41b6('0x10')]()||_0x41b6('0x14'));config['seedDB']&&require(_0x41b6('0x15'))[_0x41b6('0x16')]();require(_0x41b6('0x17'))[_0x41b6('0x16')]();})[_0x41b6('0x18')](function(_0x47feb9){logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x47feb9);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index a60a180..15453f8 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 _0x3601=['/dashboards/general','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','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~!@#$%^&-_=+[{]}.','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.','updatePasswordsHistory','length','splice','unshift','encryptString','join','sign','secret','promisify','verify','randomBytes','toString','hex','now','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','fullname','name','internal','userpic','md5secret','chatPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControlPort','hotdesk','userProfileId','settingsEnabled','use','user','ChatInteraction','closed','disposition','then','status','json','unmanaged','Unmanaged.','Forbidden.','isAuthenticated','headers','authorization','startsWith','Basic','pass','catch','Unknown\x20authorization\x20format','query','apikey','getUuid','User','find','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','motion.token','redirect'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x3601,0x9c));var _0x1360=function(_0x17b082,_0x54a938){_0x17b082=_0x17b082-0x0;var _0x208fc6=_0x3601[_0x17b082];return _0x208fc6;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x1360('0x0'));var hardwareConf=require(_0x1360('0x1'));var licenseUtil=require(_0x1360('0x2'));var encryptor=require(_0x1360('0x3'));var _=require(_0x1360('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x1360('0x5'));var compose=require(_0x1360('0x6'));var basicAuth=require(_0x1360('0x7'));var crypto=require(_0x1360('0x8'));var BPromise=require(_0x1360('0x9'));var util=require(_0x1360('0xa'));var moment=require(_0x1360('0xb'));var validateJwt=expressJwt({'secret':config[_0x1360('0xc')][_0x1360('0xd')]});var userAttributes=['id','role',_0x1360('0xe'),_0x1360('0xf'),_0x1360('0x10'),'email',_0x1360('0x11'),'permissions',_0x1360('0x12'),'voicePause',_0x1360('0x13'),'mailPause','faxPause',_0x1360('0x14'),_0x1360('0x15'),_0x1360('0x16'),_0x1360('0x17'),_0x1360('0x18'),_0x1360('0x19'),_0x1360('0x1a'),'allowmessenger',_0x1360('0x1b'),_0x1360('0x1c'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0x1360('0x1d'),_0x1360('0x1e'),_0x1360('0x1f'),'phoneBarEnableSettings',_0x1360('0x20'),'phoneBarPrefixRequired','phoneBarRemoteControl',_0x1360('0x21'),_0x1360('0x22'),'interface',_0x1360('0x23'),_0x1360('0x24')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0x1360('0x25')](function(_0x221971,_0x5b8399,_0x30e86f){if(_0x221971[_0x1360('0x26')]){_0x30e86f();}else{return db[_0x1360('0x27')]['findOne']({'where':{'id':_0x221971['params']['id']},'attributes':['id',_0x1360('0x28'),_0x1360('0x29')],'raw':!![]})[_0x1360('0x2a')](function(_0x552677){if(_0x552677&&_0x552677[_0x1360('0x28')]){return _0x5b8399[_0x1360('0x2b')](_0x552677[_0x1360('0x29')]==='unmanaged'?0x195:0x193)[_0x1360('0x2c')]({'message':_0x552677[_0x1360('0x29')]===_0x1360('0x2d')?_0x1360('0x2e'):_0x1360('0x2f')});}else{_0x30e86f();}})['catch'](function(_0x3203f5){_0x30e86f(_0x3203f5);});}});};exports[_0x1360('0x30')]=function isAuthenticated(_0x5bba4f){return compose()[_0x1360('0x25')](function(_0x1041f8,_0x33b753,_0x560d44){var _0x3d781e;if(_0x1041f8[_0x1360('0x31')][_0x1360('0x32')]){if(_[_0x1360('0x33')](_0x1041f8[_0x1360('0x31')][_0x1360('0x32')],_0x1360('0x34'))){var _0x376a45=basicAuth(_0x1041f8);db['User']['find']({'where':{'name':_0x376a45['name']}})[_0x1360('0x2a')](function(_0x4bb2e5){if(!_0x4bb2e5||!_0x4bb2e5['authenticate'](_0x376a45[_0x1360('0x35')])){return _0x33b753['status'](0x191)[_0x1360('0x2c')]({'message':'Wrong\x20credentials.'});}_0x1041f8[_0x1360('0x26')]={'id':_0x4bb2e5['id']};_0x560d44();})[_0x1360('0x36')](function(_0x1475c2){_0x560d44(_0x1475c2);});}else if(_[_0x1360('0x33')](_0x1041f8[_0x1360('0x31')]['authorization'],'Bearer')){validateJwt(_0x1041f8,_0x33b753,_0x560d44);}else{if(_0x5bba4f){_0x560d44();}else{return _0x33b753[_0x1360('0x2b')](0x193)['json']({'message':_0x1360('0x37')});}}}else if(_0x1041f8[_0x1360('0x38')][_0x1360('0x39')]){try{var _0x21d965={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x1360('0x3a')]()};verifyJwt(_0x1041f8['query'][_0x1360('0x39')],_0x21d965)[_0x1360('0x2a')](function(_0x3b6287){return db[_0x1360('0x3b')][_0x1360('0x3c')]({'where':{'id':_0x3b6287['sub']}})[_0x1360('0x2a')](function(_0x229f12){_0x3d781e=_0x229f12;return db[_0x1360('0x3d')]['findOne']({'where':{'id':0x1},'attributes':[_0x1360('0x3e'),_0x1360('0x3f')],'raw':!![]});})['then'](function(_0x1f38cb){if(!_0x3d781e||!_[_0x1360('0x40')](_0x3d781e['apiKeyNonce'],_0x3b6287[_0x1360('0x41')])){return _0x33b753[_0x1360('0x2b')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x3d781e[_0x1360('0x42')]){return _0x33b753[_0x1360('0x2b')](0x191)[_0x1360('0x2c')]({'message':_0x1360('0x43')});}if(_0x3d781e[_0x1360('0x44')]){if(_0x1f38cb[_0x1360('0x3f')]>0x0){if(moment(_0x3d781e[_0x1360('0x45')])['add'](_0x1f38cb[_0x1360('0x3f')],_0x1360('0x46'))>moment()){return _0x33b753[_0x1360('0x2b')](0x191)[_0x1360('0x2c')]({'message':_0x1360('0x43')});}}else{return _0x33b753[_0x1360('0x2b')](0x191)[_0x1360('0x2c')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x1041f8['user']={'id':_0x3d781e['id']};_0x560d44();});})[_0x1360('0x36')](function(){return _0x33b753['status'](0x191)['json']({'message':_0x1360('0x43')});});}catch(_0x3e6dec){_0x560d44(_0x3e6dec);}}else if(_0x5bba4f){_0x560d44();}else{return _0x33b753[_0x1360('0x2b')](0x193)[_0x1360('0x2c')]({'message':_0x1360('0x37')});}})[_0x1360('0x25')](function(_0x28c3ce,_0x3acd98,_0x13cf4a){if(_0x28c3ce[_0x1360('0x26')]){db[_0x1360('0x3b')][_0x1360('0x3c')]({'where':{'id':_0x28c3ce[_0x1360('0x26')]['id']},'attributes':userAttributes})[_0x1360('0x2a')](function(_0x2c241d){if(!_0x2c241d){return _0x3acd98[_0x1360('0x2b')](0x194)['json']({'message':_0x1360('0x47')});}_0x28c3ce['user']=_0x2c241d;_0x13cf4a();})[_0x1360('0x36')](function(_0x5e8e12){_0x13cf4a(_0x5e8e12);});}else if(_0x5bba4f){_0x13cf4a();}else{return _0x3acd98['status'](0x194)[_0x1360('0x2c')]({'message':_0x1360('0x48')});}});};exports[_0x1360('0x49')]=function canUpdate(){return compose()[_0x1360('0x25')](function(_0x319172,_0x3a1806,_0x1e72b2){return licenseUtil[_0x1360('0x4a')]()['then'](function(_0x3ef46){if(_0x3ef46[_0x1360('0x4b')]){_0x1e72b2();}else{return _0x3a1806['status'](0x193)[_0x1360('0x2c')]({'message':_0x1360('0x4c')});}})[_0x1360('0x36')](function(_0x5748b9){_0x1e72b2(_0x5748b9);});});};exports[_0x1360('0x4d')]=function(_0x2f3670,_0xe5ac74,_0x1964a6){_0x2f3670[_0x1360('0x4d')]=!![];return _0x1964a6();};exports[_0x1360('0x4e')]=function signToken(_0x23fdaa){return signJwt(_0x23fdaa);};exports[_0x1360('0x4f')]=function(_0x4b6de4,_0x566614){if(!_0x4b6de4[_0x1360('0x26')]){return _0x566614[_0x1360('0x2b')](0x194)[_0x1360('0x2c')]({'message':_0x1360('0x50')});}var _0x352a3d={'payload':{'id':_0x4b6de4[_0x1360('0x26')]['id'],'role':_0x4b6de4[_0x1360('0x26')][_0x1360('0x51')]},'options':{'expiresIn':0x15180}};return signJwt(_0x352a3d)[_0x1360('0x2a')](function(_0x1aac53){_0x566614['cookie'](_0x1360('0x52'),_0x1aac53);_0x566614[_0x1360('0x53')](_0x1360('0x54'));})[_0x1360('0x36')](function(_0x4333f9){return _0x566614[_0x1360('0x2b')](0x1f4)[_0x1360('0x55')](_0x4333f9);});};exports[_0x1360('0x56')]=function(_0x50b53a){if(_[_0x1360('0x57')](_0x50b53a[_0x1360('0x58')])||_[_0x1360('0x57')](_0x50b53a[_0x1360('0x59')])){return null;}else{return createJwt(_0x50b53a);}};exports[_0x1360('0x5a')]=function(_0x23a46b){_0x23a46b[_0x1360('0x58')]=generateNonce();_0x23a46b[_0x1360('0x59')]=generateIssuedAt();return createJwt(_0x23a46b);};exports[_0x1360('0x5b')]=function(_0x312cf8,_0x294b0b){var _0xa785f5=_0x312cf8['query'][_0x1360('0x39')];if(_0xa785f5){var _0x57bbe8={'nonce':_0x294b0b[_0x1360('0x58')],'iat':_0x294b0b[_0x1360('0x59')],'audience':hardwareConf[_0x1360('0x3a')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0xa785f5,_0x57bbe8)[_0x1360('0x2a')](function(){return generateApiKey(_0x294b0b);});}else{throw{'message':_0x1360('0x5c')};}};exports[_0x1360('0x5d')]=function(_0x1a7594){var _0x5a6e00=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5a6e00[_0x1360('0x5e')](_0x1a7594))throw new db[(_0x1360('0x5f'))][(_0x1360('0x60'))](_0x1360('0x61'));return;};exports[_0x1360('0x62')]=function(_0x479c7c,_0x5092fb,_0x31bc42){var _0x2be7ca=encryptor[_0x1360('0x63')](_0x5092fb)[_0x1360('0x64')](',');for(var _0x23885b=0x0;_0x23885b<_0x31bc42;_0x23885b++){if(!_0x2be7ca[_0x23885b])break;if(_0x479c7c['toLowerCase']()===_0x2be7ca[_0x23885b][_0x1360('0x65')]()){var _0x397c88=util[_0x1360('0x66')](_0x1360('0x67'),_0x31bc42);if(_0x31bc42===0x1){_0x397c88=_0x1360('0x68');}throw new db[(_0x1360('0x5f'))][(_0x1360('0x60'))](_0x397c88);}}return;};exports[_0x1360('0x69')]=function(_0x578824,_0x49854f){var _0x5081b3=_0x49854f?encryptor[_0x1360('0x63')](_0x49854f)[_0x1360('0x64')](','):[];if(_0x5081b3[_0x1360('0x6a')]===0x5){_0x5081b3[_0x1360('0x6b')](-0x1,0x1);}_0x5081b3[_0x1360('0x6c')](_0x578824);return encryptor[_0x1360('0x6d')](_0x5081b3[_0x1360('0x6e')](','));};function signJwt(_0x2f9185){var _0xcf9687=BPromise['promisify'](jwt[_0x1360('0x6f')],{'context':jwt});var _0x1ba380=_0x2f9185[_0x1360('0x70')]||config[_0x1360('0xc')][_0x1360('0xd')];return new BPromise(function(_0xecc716,_0x495aa0){_0xcf9687(_0x2f9185['payload'],_0x1ba380,_0x2f9185['options'])[_0x1360('0x2a')](function(_0x14e7e2){_0xecc716(_0x14e7e2);})[_0x1360('0x36')](function(_0x2164dc){_0x495aa0(_0x2164dc);});});}function verifyJwt(_0x265b91,_0x70c9d5,_0x3f5935){var _0x585029=BPromise[_0x1360('0x71')](jwt[_0x1360('0x72')],{'context':jwt});var _0x5601c8=_0x3f5935||config[_0x1360('0xc')]['session'];return new BPromise(function(_0x404dc0,_0x20df1f){_0x585029(_0x265b91,_0x5601c8,_0x70c9d5)[_0x1360('0x2a')](function(_0x29a2db){_0x404dc0(_0x29a2db);})[_0x1360('0x36')](function(_0x578d81){_0x20df1f(_0x578d81);});});}function generateNonce(){return crypto[_0x1360('0x73')](0x10)[_0x1360('0x74')](_0x1360('0x75'));}function generateIssuedAt(){return Math['floor'](Date[_0x1360('0x76')]()/0x3e8)[_0x1360('0x74')]();}function createJwt(_0xae8337){var _0x2c5304={'payload':{'iat':_0xae8337[_0x1360('0x59')],'nonce':_0xae8337[_0x1360('0x58')]},'options':{'algorithm':_0x1360('0x77'),'subject':_0xae8337['id']['toString'](),'issuer':hardwareConf[_0x1360('0x3a')](),'audience':hardwareConf[_0x1360('0x3a')]()}};return signJwt(_0x2c5304)['then'](function(_0x3cf8ca){return{'iat':_0xae8337[_0x1360('0x59')],'nonce':_0xae8337[_0x1360('0x58')],'token':_0x3cf8ca};});} \ No newline at end of file +var _0x3e17=['internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','pauseType','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','settingsEnabled','isChatInteractionAuthorized','use','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','Basic','User','find','name','authenticate','pass','Wrong\x20credentials.','user','startsWith','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','allowedLoginAttempts','blockDuration','nonce','disabled','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','apiKeyNonce','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','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.','ValidationError','splice','join','promisify','sign','session','options','randomBytes','toString','floor','now','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','util','secrets','role','fullname'];(function(_0x4b2331,_0x3dcd93){var _0x3005df=function(_0x47f6a7){while(--_0x47f6a7){_0x4b2331['push'](_0x4b2331['shift']());}};_0x3005df(++_0x3dcd93);}(_0x3e17,0xe7));var _0x73e1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x3e17[_0x57b54c];return _0x59cc19;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x73e1('0x0'));var hardwareConf=require(_0x73e1('0x1'));var licenseUtil=require(_0x73e1('0x2'));var encryptor=require(_0x73e1('0x3'));var _=require(_0x73e1('0x4'));var jwt=require(_0x73e1('0x5'));var expressJwt=require('express-jwt');var compose=require(_0x73e1('0x6'));var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0x73e1('0x7'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x73e1('0x8')]['session']});var userAttributes=['id',_0x73e1('0x9'),_0x73e1('0xa'),'name',_0x73e1('0xb'),_0x73e1('0xc'),_0x73e1('0xd'),_0x73e1('0xe'),_0x73e1('0xf'),_0x73e1('0x10'),_0x73e1('0x11'),_0x73e1('0x12'),_0x73e1('0x13'),_0x73e1('0x14'),'openchannelPause',_0x73e1('0x15'),'showWebBar',_0x73e1('0x16'),_0x73e1('0x17'),'crudPermissions',_0x73e1('0x18'),_0x73e1('0x19'),_0x73e1('0x1a'),'phoneBarAutoAnswer',_0x73e1('0x1b'),_0x73e1('0x1c'),_0x73e1('0x1d'),_0x73e1('0x1e'),'phoneBarEnableSettings',_0x73e1('0x1f'),_0x73e1('0x20'),_0x73e1('0x21'),_0x73e1('0x22'),_0x73e1('0x23'),'interface',_0x73e1('0x24'),_0x73e1('0x25')];exports[_0x73e1('0x26')]=function(){return this['isAuthenticated'](!![])[_0x73e1('0x27')](function(_0x470342,_0x29c259,_0x10762d){if(_0x470342['user']){_0x10762d();}else{return db[_0x73e1('0x28')][_0x73e1('0x29')]({'where':{'id':_0x470342[_0x73e1('0x2a')]['id']},'attributes':['id',_0x73e1('0x2b'),_0x73e1('0x2c')],'raw':!![]})[_0x73e1('0x2d')](function(_0x4f2803){if(_0x4f2803&&_0x4f2803['closed']){return _0x29c259[_0x73e1('0x2e')](_0x4f2803['disposition']===_0x73e1('0x2f')?0x195:0x193)[_0x73e1('0x30')]({'message':_0x4f2803[_0x73e1('0x2c')]===_0x73e1('0x2f')?_0x73e1('0x31'):_0x73e1('0x32')});}else{_0x10762d();}})[_0x73e1('0x33')](function(_0x2e4e97){_0x10762d(_0x2e4e97);});}});};exports['isAuthenticated']=function isAuthenticated(_0x60c857){return compose()[_0x73e1('0x27')](function(_0x57cb24,_0x11c69c,_0x33f57a){var _0xb0e742;if(_0x57cb24[_0x73e1('0x34')][_0x73e1('0x35')]){if(_['startsWith'](_0x57cb24[_0x73e1('0x34')][_0x73e1('0x35')],_0x73e1('0x36'))){var _0x3ca350=basicAuth(_0x57cb24);db[_0x73e1('0x37')][_0x73e1('0x38')]({'where':{'name':_0x3ca350[_0x73e1('0x39')]}})[_0x73e1('0x2d')](function(_0x4ab24c){if(!_0x4ab24c||!_0x4ab24c[_0x73e1('0x3a')](_0x3ca350[_0x73e1('0x3b')])){return _0x11c69c[_0x73e1('0x2e')](0x191)[_0x73e1('0x30')]({'message':_0x73e1('0x3c')});}_0x57cb24[_0x73e1('0x3d')]={'id':_0x4ab24c['id']};_0x33f57a();})[_0x73e1('0x33')](function(_0x37af45){_0x33f57a(_0x37af45);});}else if(_[_0x73e1('0x3e')](_0x57cb24[_0x73e1('0x34')][_0x73e1('0x35')],_0x73e1('0x3f'))){validateJwt(_0x57cb24,_0x11c69c,_0x33f57a);}else{if(_0x60c857){_0x33f57a();}else{return _0x11c69c[_0x73e1('0x2e')](0x193)[_0x73e1('0x30')]({'message':_0x73e1('0x40')});}}}else if(_0x57cb24[_0x73e1('0x41')][_0x73e1('0x42')]){try{var _0x53618c={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x73e1('0x43')]()};verifyJwt(_0x57cb24[_0x73e1('0x41')][_0x73e1('0x42')],_0x53618c)[_0x73e1('0x2d')](function(_0x57887b){return db['User']['find']({'where':{'id':_0x57887b[_0x73e1('0x44')]}})[_0x73e1('0x2d')](function(_0x40b567){_0xb0e742=_0x40b567;return db['Setting'][_0x73e1('0x29')]({'where':{'id':0x1},'attributes':[_0x73e1('0x45'),_0x73e1('0x46')],'raw':!![]});})['then'](function(_0x4fad9a){if(!_0xb0e742||!_['isEqual'](_0xb0e742['apiKeyNonce'],_0x57887b[_0x73e1('0x47')])){return _0x11c69c[_0x73e1('0x2e')](0x191)[_0x73e1('0x30')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0xb0e742[_0x73e1('0x48')]){return _0x11c69c[_0x73e1('0x2e')](0x191)[_0x73e1('0x30')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0xb0e742[_0x73e1('0x49')]){if(_0x4fad9a[_0x73e1('0x46')]>0x0){if(moment(_0xb0e742[_0x73e1('0x4a')])[_0x73e1('0x4b')](_0x4fad9a[_0x73e1('0x46')],_0x73e1('0x4c'))>moment()){return _0x11c69c[_0x73e1('0x2e')](0x191)[_0x73e1('0x30')]({'message':_0x73e1('0x4d')});}}else{return _0x11c69c['status'](0x191)[_0x73e1('0x30')]({'message':_0x73e1('0x4d')});}}_0x57cb24['user']={'id':_0xb0e742['id']};_0x33f57a();});})['catch'](function(){return _0x11c69c[_0x73e1('0x2e')](0x191)[_0x73e1('0x30')]({'message':_0x73e1('0x4d')});});}catch(_0x16fcb7){_0x33f57a(_0x16fcb7);}}else if(_0x60c857){_0x33f57a();}else{return _0x11c69c[_0x73e1('0x2e')](0x193)[_0x73e1('0x30')]({'message':_0x73e1('0x40')});}})[_0x73e1('0x27')](function(_0x4a1ec3,_0x3391ad,_0x561152){if(_0x4a1ec3['user']){db[_0x73e1('0x37')]['find']({'where':{'id':_0x4a1ec3[_0x73e1('0x3d')]['id']},'attributes':userAttributes})[_0x73e1('0x2d')](function(_0x595768){if(!_0x595768){return _0x3391ad[_0x73e1('0x2e')](0x194)[_0x73e1('0x30')]({'message':_0x73e1('0x4e')});}_0x4a1ec3[_0x73e1('0x3d')]=_0x595768;_0x561152();})[_0x73e1('0x33')](function(_0x1b712d){_0x561152(_0x1b712d);});}else if(_0x60c857){_0x561152();}else{return _0x3391ad[_0x73e1('0x2e')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x73e1('0x4f')]=function canUpdate(){return compose()[_0x73e1('0x27')](function(_0x4fbb0e,_0x15a924,_0xebc320){return licenseUtil[_0x73e1('0x50')]()[_0x73e1('0x2d')](function(_0xa3845f){if(_0xa3845f[_0x73e1('0x51')]){_0xebc320();}else{return _0x15a924[_0x73e1('0x2e')](0x193)[_0x73e1('0x30')]({'message':_0x73e1('0x52')});}})[_0x73e1('0x33')](function(_0x24e7d2){_0xebc320(_0x24e7d2);});});};exports[_0x73e1('0x53')]=function(_0x916aa,_0x58f3eb,_0x12de39){_0x916aa['isMiddleware']=!![];return _0x12de39();};exports[_0x73e1('0x54')]=function signToken(_0x1b29d7){return signJwt(_0x1b29d7);};exports[_0x73e1('0x55')]=function(_0xfda807,_0x4cc6ca){if(!_0xfda807['user']){return _0x4cc6ca[_0x73e1('0x2e')](0x194)[_0x73e1('0x30')]({'message':_0x73e1('0x56')});}var _0x35b1ef={'payload':{'id':_0xfda807[_0x73e1('0x3d')]['id'],'role':_0xfda807[_0x73e1('0x3d')][_0x73e1('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x35b1ef)['then'](function(_0x233393){_0x4cc6ca[_0x73e1('0x57')](_0x73e1('0x58'),_0x233393);_0x4cc6ca[_0x73e1('0x59')](_0x73e1('0x5a'));})[_0x73e1('0x33')](function(_0x1a2a1b){return _0x4cc6ca[_0x73e1('0x2e')](0x1f4)[_0x73e1('0x5b')](_0x1a2a1b);});};exports[_0x73e1('0x5c')]=function(_0x3c7625){if(_[_0x73e1('0x5d')](_0x3c7625['apiKeyNonce'])||_['isNil'](_0x3c7625[_0x73e1('0x5e')])){return null;}else{return createJwt(_0x3c7625);}};exports[_0x73e1('0x5f')]=function(_0x17bbab){_0x17bbab[_0x73e1('0x60')]=generateNonce();_0x17bbab[_0x73e1('0x5e')]=generateIssuedAt();return createJwt(_0x17bbab);};exports[_0x73e1('0x61')]=function(_0x1136ef,_0x4a8b3e){var _0x2f3e56=_0x1136ef['query']['apikey'];if(_0x2f3e56){var _0xe3cf1b={'nonce':_0x4a8b3e[_0x73e1('0x60')],'iat':_0x4a8b3e[_0x73e1('0x5e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x73e1('0x43')]()};return verifyJwt(_0x2f3e56,_0xe3cf1b)['then'](function(){return generateApiKey(_0x4a8b3e);});}else{throw{'message':_0x73e1('0x62')};}};exports[_0x73e1('0x63')]=function(_0x3879da){var _0x3e7feb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3e7feb[_0x73e1('0x64')](_0x3879da))throw new db[(_0x73e1('0x65'))]['ValidationError'](_0x73e1('0x66'));return;};exports[_0x73e1('0x67')]=function(_0x12a6f9,_0x1a2f2c,_0x4fb5bb){var _0x41936f=encryptor[_0x73e1('0x68')](_0x1a2f2c)[_0x73e1('0x69')](',');for(var _0x588612=0x0;_0x588612<_0x4fb5bb;_0x588612++){if(!_0x41936f[_0x588612])break;if(_0x12a6f9['toLowerCase']()===_0x41936f[_0x588612]['toLowerCase']()){var _0x5dea61=util[_0x73e1('0x6a')](_0x73e1('0x6b'),_0x4fb5bb);if(_0x4fb5bb===0x1){_0x5dea61=_0x73e1('0x6c');}throw new db[(_0x73e1('0x65'))][(_0x73e1('0x6d'))](_0x5dea61);}}return;};exports['updatePasswordsHistory']=function(_0x334b7a,_0x3a3d74){var _0x3acc9c=_0x3a3d74?encryptor[_0x73e1('0x68')](_0x3a3d74)[_0x73e1('0x69')](','):[];if(_0x3acc9c['length']===0x5){_0x3acc9c[_0x73e1('0x6e')](-0x1,0x1);}_0x3acc9c['unshift'](_0x334b7a);return encryptor['encryptString'](_0x3acc9c[_0x73e1('0x6f')](','));};function signJwt(_0x2c67cd){var _0x4a755a=BPromise[_0x73e1('0x70')](jwt[_0x73e1('0x71')],{'context':jwt});var _0x4d9dac=_0x2c67cd['secret']||config[_0x73e1('0x8')][_0x73e1('0x72')];return new BPromise(function(_0x34ff6d,_0x7f49d6){_0x4a755a(_0x2c67cd['payload'],_0x4d9dac,_0x2c67cd[_0x73e1('0x73')])[_0x73e1('0x2d')](function(_0x17c97b){_0x34ff6d(_0x17c97b);})[_0x73e1('0x33')](function(_0x255020){_0x7f49d6(_0x255020);});});}function verifyJwt(_0x2d9ce2,_0x47cadd,_0x52cedb){var _0x3493f6=BPromise[_0x73e1('0x70')](jwt['verify'],{'context':jwt});var _0x45862f=_0x52cedb||config[_0x73e1('0x8')][_0x73e1('0x72')];return new BPromise(function(_0x57cf6f,_0x3ebe30){_0x3493f6(_0x2d9ce2,_0x45862f,_0x47cadd)[_0x73e1('0x2d')](function(_0x2399c3){_0x57cf6f(_0x2399c3);})[_0x73e1('0x33')](function(_0x5762a1){_0x3ebe30(_0x5762a1);});});}function generateNonce(){return crypto[_0x73e1('0x74')](0x10)[_0x73e1('0x75')]('hex');}function generateIssuedAt(){return Math[_0x73e1('0x76')](Date[_0x73e1('0x77')]()/0x3e8)[_0x73e1('0x75')]();}function createJwt(_0x34fdf4){var _0x11e8e1={'payload':{'iat':_0x34fdf4['apiKeyIat'],'nonce':_0x34fdf4['apiKeyNonce']},'options':{'algorithm':_0x73e1('0x78'),'subject':_0x34fdf4['id'][_0x73e1('0x75')](),'issuer':hardwareConf[_0x73e1('0x43')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x11e8e1)['then'](function(_0x35f27d){return{'iat':_0x34fdf4[_0x73e1('0x5e')],'nonce':_0x34fdf4[_0x73e1('0x60')],'token':_0x35f27d};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index ada33a8..7233b3f 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 _0x3f8a=['decryptString','crypto','bluebird','../../config/environment','secrets','aes-256-ctr','aes192','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','update','binary','write','end','final','close','unlink','decryptFile','createReadStream','createDecipher','algorithm','secret','utf8','base64'];(function(_0x22da4f,_0x4ae3ca){var _0x5d207e=function(_0x3adc50){while(--_0x3adc50){_0x22da4f['push'](_0x22da4f['shift']());}};_0x5d207e(++_0x4ae3ca);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x42790d,_0x12bf0f){_0x42790d=_0x42790d-0x0;var _0x482f2c=_0x3f8a[_0x42790d];return _0x482f2c;};'use strict';var crypto=require(_0xa3f8('0x0'));var fs=require('fs');var BPromise=require(_0xa3f8('0x1'));var config=require(_0xa3f8('0x2'));const stringOptions={'secret':config[_0xa3f8('0x3')]['session'],'algorithm':_0xa3f8('0x4')};const fileOptions={'algorithm':_0xa3f8('0x5')};function combineOptions(_0x928738){var _0x15b6aa={};for(var _0x2553fd in fileOptions){if(fileOptions[_0xa3f8('0x6')](_0x2553fd)){_0x15b6aa[_0x2553fd]=fileOptions[_0x2553fd];}}if(_0x928738){for(var _0x39d2e4 in _0x928738){if(_0x928738[_0xa3f8('0x6')](_0x39d2e4)){_0x15b6aa[_0x39d2e4]=_0x928738[_0x39d2e4];}}}return _0x15b6aa;}exports[_0xa3f8('0x7')]=function(_0xf895d9,_0xcfea5,_0x268332,_0x2faf2e){return new BPromise(function(_0x2448de,_0x2c89bb){_0x2faf2e=combineOptions(_0x2faf2e);var _0x350935=new Buffer(_0x268332);var _0xcdb0d4=fs['createReadStream'](_0xf895d9);var _0x47496a=fs[_0xa3f8('0x8')](_0xcfea5);var _0x3c1833=crypto[_0xa3f8('0x9')](_0x2faf2e['algorithm'],_0x350935);_0xcdb0d4['on'](_0xa3f8('0xa'),function(_0x26f0a0){var _0x414bd7=new Buffer(_0x3c1833[_0xa3f8('0xb')](_0x26f0a0),_0xa3f8('0xc'));_0x47496a[_0xa3f8('0xd')](_0x414bd7);});_0xcdb0d4['on'](_0xa3f8('0xe'),function(){try{var _0x63de8b=new Buffer(_0x3c1833[_0xa3f8('0xf')](_0xa3f8('0xc')),_0xa3f8('0xc'));_0x47496a[_0xa3f8('0xd')](_0x63de8b);_0x47496a['end']();_0x47496a['on'](_0xa3f8('0x10'),function(){return _0x2448de(_0xcfea5);});}catch(_0xe55848){fs[_0xa3f8('0x11')](_0xcfea5);return _0x2c89bb(_0xe55848);}});});};exports[_0xa3f8('0x12')]=function(_0x5caebf,_0x39c450,_0x33b98e,_0x46a8d9){return new BPromise(function(_0x8cd130,_0x45ef64){_0x46a8d9=combineOptions(_0x46a8d9);var _0x259efe=new Buffer(_0x33b98e);var _0x2f0659=fs[_0xa3f8('0x13')](_0x5caebf);var _0x2cb49f=fs[_0xa3f8('0x8')](_0x39c450);var _0x54b870=crypto[_0xa3f8('0x14')](_0x46a8d9['algorithm'],_0x259efe);_0x2f0659['on'](_0xa3f8('0xa'),function(_0x3dc3e5){var _0x191f99=new Buffer(_0x54b870[_0xa3f8('0xb')](_0x3dc3e5),'binary');_0x2cb49f[_0xa3f8('0xd')](_0x191f99);});_0x2f0659['on']('end',function(){try{var _0x43c393=new Buffer(_0x54b870['final'](_0xa3f8('0xc')),_0xa3f8('0xc'));_0x2cb49f[_0xa3f8('0xd')](_0x43c393);_0x2cb49f[_0xa3f8('0xe')]();_0x2cb49f['on'](_0xa3f8('0x10'),function(){return _0x8cd130(_0x39c450);});}catch(_0x1e5f30){fs[_0xa3f8('0x11')](_0x39c450);return _0x45ef64(_0x1e5f30);}});});};exports['encryptString']=function(_0xae76ec,_0x4d0e72,_0x3ce57b){var _0xa5a697=_0x3ce57b||stringOptions[_0xa3f8('0x15')];var _0x37b290=_0x4d0e72||stringOptions[_0xa3f8('0x16')];var _0x2c5d10=crypto[_0xa3f8('0x9')](_0xa5a697,_0x37b290);var _0x34884d=_0x2c5d10[_0xa3f8('0xb')](_0xae76ec,_0xa3f8('0x17'),'base64');_0x34884d+=_0x2c5d10[_0xa3f8('0xf')](_0xa3f8('0x18'));return _0x34884d;};exports[_0xa3f8('0x19')]=function(_0x5a8fcf,_0x40f5cc,_0x57f6be){var _0xbad6a6=_0x57f6be||stringOptions[_0xa3f8('0x15')];var _0x3c1128=_0x40f5cc||stringOptions['secret'];var _0x458824=crypto['createDecipher'](_0xbad6a6,_0x3c1128);var _0x21c57e=_0x458824[_0xa3f8('0xb')](_0x5a8fcf,_0xa3f8('0x18'),_0xa3f8('0x17'));_0x21c57e+=_0x458824[_0xa3f8('0xf')](_0xa3f8('0x17'));return _0x21c57e;}; \ No newline at end of file +var _0xae24=['update','write','end','final','binary','close','createDecipher','unlink','encryptString','secret','utf8','base64','crypto','../../config/environment','session','aes-256-ctr','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm'];(function(_0x5779dc,_0x46b82b){var _0x226637=function(_0x597f09){while(--_0x597f09){_0x5779dc['push'](_0x5779dc['shift']());}};_0x226637(++_0x46b82b);}(_0xae24,0x182));var _0x4ae2=function(_0x3d8db3,_0x4a533d){_0x3d8db3=_0x3d8db3-0x0;var _0x21de3a=_0xae24[_0x3d8db3];return _0x21de3a;};'use strict';var crypto=require(_0x4ae2('0x0'));var fs=require('fs');var BPromise=require('bluebird');var config=require(_0x4ae2('0x1'));const stringOptions={'secret':config['secrets'][_0x4ae2('0x2')],'algorithm':_0x4ae2('0x3')};const fileOptions={'algorithm':'aes192'};function combineOptions(_0x5b6f4d){var _0x1afc7a={};for(var _0x5b25b5 in fileOptions){if(fileOptions[_0x4ae2('0x4')](_0x5b25b5)){_0x1afc7a[_0x5b25b5]=fileOptions[_0x5b25b5];}}if(_0x5b6f4d){for(var _0xf26f45 in _0x5b6f4d){if(_0x5b6f4d[_0x4ae2('0x4')](_0xf26f45)){_0x1afc7a[_0xf26f45]=_0x5b6f4d[_0xf26f45];}}}return _0x1afc7a;}exports[_0x4ae2('0x5')]=function(_0x428054,_0x307247,_0x4f2e84,_0x5f589a){return new BPromise(function(_0x41cdf1,_0x4d3d8a){_0x5f589a=combineOptions(_0x5f589a);var _0x564ef9=new Buffer(_0x4f2e84);var _0xb5587a=fs[_0x4ae2('0x6')](_0x428054);var _0x5c32b7=fs[_0x4ae2('0x7')](_0x307247);var _0x449e1a=crypto[_0x4ae2('0x8')](_0x5f589a[_0x4ae2('0x9')],_0x564ef9);_0xb5587a['on']('data',function(_0x19b222){var _0xcbd76d=new Buffer(_0x449e1a[_0x4ae2('0xa')](_0x19b222),'binary');_0x5c32b7[_0x4ae2('0xb')](_0xcbd76d);});_0xb5587a['on'](_0x4ae2('0xc'),function(){try{var _0x30d6c4=new Buffer(_0x449e1a[_0x4ae2('0xd')](_0x4ae2('0xe')),_0x4ae2('0xe'));_0x5c32b7[_0x4ae2('0xb')](_0x30d6c4);_0x5c32b7[_0x4ae2('0xc')]();_0x5c32b7['on'](_0x4ae2('0xf'),function(){return _0x41cdf1(_0x307247);});}catch(_0x5e2bfd){fs['unlink'](_0x307247);return _0x4d3d8a(_0x5e2bfd);}});});};exports['decryptFile']=function(_0x2f3936,_0xf834a1,_0x5f447a,_0x463765){return new BPromise(function(_0x9fb8db,_0x1fde63){_0x463765=combineOptions(_0x463765);var _0x1d5a78=new Buffer(_0x5f447a);var _0x428d24=fs[_0x4ae2('0x6')](_0x2f3936);var _0x3d4259=fs[_0x4ae2('0x7')](_0xf834a1);var _0x41b672=crypto[_0x4ae2('0x10')](_0x463765['algorithm'],_0x1d5a78);_0x428d24['on']('data',function(_0x44a2d3){var _0x2d910c=new Buffer(_0x41b672['update'](_0x44a2d3),_0x4ae2('0xe'));_0x3d4259[_0x4ae2('0xb')](_0x2d910c);});_0x428d24['on'](_0x4ae2('0xc'),function(){try{var _0x2ad222=new Buffer(_0x41b672[_0x4ae2('0xd')]('binary'),_0x4ae2('0xe'));_0x3d4259['write'](_0x2ad222);_0x3d4259['end']();_0x3d4259['on'](_0x4ae2('0xf'),function(){return _0x9fb8db(_0xf834a1);});}catch(_0x151b70){fs[_0x4ae2('0x11')](_0xf834a1);return _0x1fde63(_0x151b70);}});});};exports[_0x4ae2('0x12')]=function(_0xca16bf,_0x526768,_0x1005e0){var _0x4a0ddb=_0x1005e0||stringOptions[_0x4ae2('0x9')];var _0x12b5d2=_0x526768||stringOptions[_0x4ae2('0x13')];var _0x57933b=crypto[_0x4ae2('0x8')](_0x4a0ddb,_0x12b5d2);var _0x6f0cc6=_0x57933b[_0x4ae2('0xa')](_0xca16bf,_0x4ae2('0x14'),_0x4ae2('0x15'));_0x6f0cc6+=_0x57933b[_0x4ae2('0xd')]('base64');return _0x6f0cc6;};exports['decryptString']=function(_0x9508d7,_0x3030f8,_0x3fa514){var _0x329588=_0x3fa514||stringOptions[_0x4ae2('0x9')];var _0x20ef44=_0x3030f8||stringOptions['secret'];var _0x5ec1fd=crypto[_0x4ae2('0x10')](_0x329588,_0x20ef44);var _0x4e7741=_0x5ec1fd['update'](_0x9508d7,'base64',_0x4ae2('0x14'));_0x4e7741+=_0x5ec1fd[_0x4ae2('0xd')]('utf8');return _0x4e7741;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 54f91d2..eff8ba0 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 _0xf4eb=['query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','dirname','basename','existsSync','join','mkdirSync','then','%s%d.%s','csv','writeFileSync','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Setting','split','splitSizeCsv','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1ae361,_0xb11828){_0x1ae361=_0x1ae361-0x0;var _0x13c889=_0xf4eb[_0x1ae361];return _0x13c889;};'use strict';var util=require(_0xbf4e('0x0'));var path=require('path');var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xbf4e('0x1'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0xbf4e('0x2'))[_0xbf4e('0x3')];var logger=require(_0xbf4e('0x4'))(_0xbf4e('0x5'));var EXTRACTED_REPORT_ID=Number(process[_0xbf4e('0x6')][0x2]);var QUERY=process[_0xbf4e('0x6')][0x3];var PATH=process[_0xbf4e('0x6')][0x4];function analyticExtractedReport(_0x540736,_0x449d55){var _0x5013c2={'status':_0x540736};var _0x5e23d4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x449d55){_0x5013c2[_0xbf4e('0x7')]=_0x449d55;}return db[_0xbf4e('0x8')][_0xbf4e('0x9')](_0x5013c2,_0x5e23d4);}function main(){var _0xc86f04=0x1388;var _0x5da823;logger[_0xbf4e('0xa')](util[_0xbf4e('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0xbf4e('0xc')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbf4e('0xd'),_0xbf4e('0xe')]})['then'](function(_0x17fd01){if(_0x17fd01){_0x5da823=_0x17fd01;_0xc86f04=_0x5da823['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0xbf4e('0xf')][_0xbf4e('0x10')](util[_0xbf4e('0xb')](_0xbf4e('0x11'),QUERY),{'type':dbH[_0xbf4e('0xf')][_0xbf4e('0x12')]['SELECT']});})['then'](function(_0x180432){if(!_0x180432[0x0][_0xbf4e('0x13')]){return analyticExtractedReport(_0xbf4e('0x14'));}var _0x542909=[];var _0x14110b=0x0;var _0x2c292c=!![];if(_0x180432&&_0x180432[_0xbf4e('0x15')]){var _0x320e7d=_0x180432[0x0]['num']%(_0x14110b+_0xc86f04);if(_0x5da823[_0xbf4e('0xd')]){for(;_0x2c292c;_0x14110b+=_0xc86f04,_0x320e7d=_0x180432[0x0]['num']%(_0x14110b+_0xc86f04)){if(_0x320e7d==0x0||_0x320e7d==_0x180432[0x0]['num']){_0x2c292c=![];}_0x542909['push'](dbH['sequelize'][_0xbf4e('0x10')](util[_0xbf4e('0xb')](_0xbf4e('0x16'),QUERY,_0xc86f04,_0x14110b),{'type':dbH['sequelize']['QueryTypes'][_0xbf4e('0x17')]}));}}else{_0x542909[_0xbf4e('0x18')](dbH[_0xbf4e('0xf')][_0xbf4e('0x10')](QUERY,{'type':dbH[_0xbf4e('0xf')][_0xbf4e('0x12')][_0xbf4e('0x17')]}));}}var _0x3d642a=path[_0xbf4e('0x19')](PATH);var _0x376832=path[_0xbf4e('0x1a')](PATH,'.csv');var _0x1ff2ec=_0x5da823[_0xbf4e('0xd')]&&_0x542909['length']>0x1;var _0x31e3f5=[];if(!fs[_0xbf4e('0x1b')](path[_0xbf4e('0x1c')](_0x3d642a,_0x376832))&&_0x1ff2ec){fs[_0xbf4e('0x1d')](path[_0xbf4e('0x1c')](_0x3d642a,_0x376832));}return BPromise['each'](_0x542909,function(_0x90635e){_0x31e3f5[_0xbf4e('0x18')](_0x90635e);})[_0xbf4e('0x1e')](function(){for(var _0x5766d4=0x0;_0x5766d4<_0x31e3f5[_0xbf4e('0x15')];_0x5766d4+=0x1){var _0x5e08b1;var _0x5bcf71=_0x31e3f5[_0x5766d4];if(_0x1ff2ec){_0x5e08b1=path[_0xbf4e('0x1c')](_0x3d642a,_0x376832,util['format'](_0xbf4e('0x1f'),_0x376832,_0x5766d4,_0xbf4e('0x20')));}else{_0x5e08b1=path[_0xbf4e('0x1c')](_0x3d642a,util[_0xbf4e('0xb')]('%s.%s',_0x376832,_0xbf4e('0x20')));}fs[_0xbf4e('0x21')](_0x5e08b1,csv(_0x5bcf71));}})[_0xbf4e('0x1e')](function(){if(_0x1ff2ec){zipdir(path['join'](_0x3d642a,_0x376832),{'saveTo':path[_0xbf4e('0x1c')](_0x3d642a,util['format'](_0xbf4e('0x22'),_0x376832,_0xbf4e('0x23')))},function(_0xb8b58e,_0x498dbd){});rimraf(path[_0xbf4e('0x1c')](_0x3d642a,_0x376832),function(){});}})[_0xbf4e('0x1e')](function(){logger[_0xbf4e('0xa')](util[_0xbf4e('0xb')](_0xbf4e('0x24'),EXTRACTED_REPORT_ID,_0xbf4e('0x25')));return analyticExtractedReport('Completed',_0x1ff2ec?util[_0xbf4e('0xb')](_0xbf4e('0x22'),_0x376832,_0x1ff2ec?'zip':_0xbf4e('0x20')):null);});})[_0xbf4e('0x26')](function(_0x5473ed){logger[_0xbf4e('0xa')](util['format'](_0xbf4e('0x27'),EXTRACTED_REPORT_ID,'CSV'),util[_0xbf4e('0x28')](_0x5473ed,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbf4e('0x29'));});}main(); \ No newline at end of file +var _0x6c76=['argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','join','mkdirSync','each','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','bluebird','zip-dir','../../mysqldb','dbH','analytics'];(function(_0x2340e2,_0x1627f9){var _0x5ced10=function(_0x3c5250){while(--_0x3c5250){_0x2340e2['push'](_0x2340e2['shift']());}};_0x5ced10(++_0x1627f9);}(_0x6c76,0x184));var _0x66c7=function(_0x2cc20d,_0x3a2f1b){_0x2cc20d=_0x2cc20d-0x0;var _0x1db55b=_0x6c76[_0x2cc20d];return _0x1db55b;};'use strict';var util=require(_0x66c7('0x0'));var path=require(_0x66c7('0x1'));var _=require(_0x66c7('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x66c7('0x3'));var zipdir=require(_0x66c7('0x4'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x66c7('0x5'))[_0x66c7('0x6')];var logger=require('../../config/logger')(_0x66c7('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x66c7('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x66c7('0x8')][0x4];function analyticExtractedReport(_0x4dffcd,_0x4fa6ce){var _0x208d06={'status':_0x4dffcd};var _0x2b0065={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4fa6ce){_0x208d06[_0x66c7('0x9')]=_0x4fa6ce;}return db['AnalyticExtractedReport'][_0x66c7('0xa')](_0x208d06,_0x2b0065);}function main(){var _0xbc35d9=0x1388;var _0xf44e2;logger[_0x66c7('0xb')](util['format'](_0x66c7('0xc'),EXTRACTED_REPORT_ID,_0x66c7('0xd')));return db[_0x66c7('0xe')][_0x66c7('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x66c7('0x10'),_0x66c7('0x11')]})[_0x66c7('0x12')](function(_0x5176a3){if(_0x5176a3){_0xf44e2=_0x5176a3;_0xbc35d9=_0xf44e2[_0x66c7('0x11')]||0x1388;}})[_0x66c7('0x12')](function(){return dbH[_0x66c7('0x13')][_0x66c7('0x14')](util[_0x66c7('0x15')](_0x66c7('0x16'),QUERY),{'type':dbH[_0x66c7('0x13')][_0x66c7('0x17')][_0x66c7('0x18')]});})['then'](function(_0x110f6d){if(!_0x110f6d[0x0]['num']){return analyticExtractedReport(_0x66c7('0x19'));}var _0x39f951=[];var _0x3c81c0=0x0;var _0x42e930=!![];if(_0x110f6d&&_0x110f6d[_0x66c7('0x1a')]){var _0x4e229a=_0x110f6d[0x0]['num']%(_0x3c81c0+_0xbc35d9);if(_0xf44e2['split']){for(;_0x42e930;_0x3c81c0+=_0xbc35d9,_0x4e229a=_0x110f6d[0x0]['num']%(_0x3c81c0+_0xbc35d9)){if(_0x4e229a==0x0||_0x4e229a==_0x110f6d[0x0][_0x66c7('0x1b')]){_0x42e930=![];}_0x39f951[_0x66c7('0x1c')](dbH['sequelize']['query'](util[_0x66c7('0x15')](_0x66c7('0x1d'),QUERY,_0xbc35d9,_0x3c81c0),{'type':dbH[_0x66c7('0x13')][_0x66c7('0x17')]['SELECT']}));}}else{_0x39f951['push'](dbH[_0x66c7('0x13')][_0x66c7('0x14')](QUERY,{'type':dbH[_0x66c7('0x13')][_0x66c7('0x17')][_0x66c7('0x18')]}));}}var _0x75f118=path['dirname'](PATH);var _0x4ddbd2=path[_0x66c7('0x1e')](PATH,'.csv');var _0x7462f1=_0xf44e2[_0x66c7('0x10')]&&_0x39f951[_0x66c7('0x1a')]>0x1;var _0x1fc9d3=[];if(!fs['existsSync'](path[_0x66c7('0x1f')](_0x75f118,_0x4ddbd2))&&_0x7462f1){fs[_0x66c7('0x20')](path['join'](_0x75f118,_0x4ddbd2));}return BPromise[_0x66c7('0x21')](_0x39f951,function(_0x11a6b9){_0x1fc9d3[_0x66c7('0x1c')](_0x11a6b9);})[_0x66c7('0x12')](function(){for(var _0x2af0a3=0x0;_0x2af0a3<_0x1fc9d3['length'];_0x2af0a3+=0x1){var _0x5bc4e6;var _0x4e514a=_0x1fc9d3[_0x2af0a3];if(_0x7462f1){_0x5bc4e6=path[_0x66c7('0x1f')](_0x75f118,_0x4ddbd2,util[_0x66c7('0x15')]('%s%d.%s',_0x4ddbd2,_0x2af0a3,_0x66c7('0x22')));}else{_0x5bc4e6=path[_0x66c7('0x1f')](_0x75f118,util[_0x66c7('0x15')](_0x66c7('0x23'),_0x4ddbd2,_0x66c7('0x22')));}fs[_0x66c7('0x24')](_0x5bc4e6,csv(_0x4e514a));}})['then'](function(){if(_0x7462f1){zipdir(path[_0x66c7('0x1f')](_0x75f118,_0x4ddbd2),{'saveTo':path[_0x66c7('0x1f')](_0x75f118,util[_0x66c7('0x15')](_0x66c7('0x23'),_0x4ddbd2,_0x66c7('0x25')))},function(_0x592f0e,_0x263b48){});rimraf(path['join'](_0x75f118,_0x4ddbd2),function(){});}})[_0x66c7('0x12')](function(){logger['info'](util[_0x66c7('0x15')](_0x66c7('0x26'),EXTRACTED_REPORT_ID,_0x66c7('0xd')));return analyticExtractedReport(_0x66c7('0x27'),_0x7462f1?util[_0x66c7('0x15')](_0x66c7('0x23'),_0x4ddbd2,_0x7462f1?'zip':'csv'):null);});})[_0x66c7('0x28')](function(_0x12e7c6){logger[_0x66c7('0xb')](util[_0x66c7('0x15')](_0x66c7('0x29'),EXTRACTED_REPORT_ID,_0x66c7('0xd')),util[_0x66c7('0x2a')](_0x12e7c6,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x66c7('0x2b'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index cac5707..8e359e3 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 _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x29b8cc,_0x5d7e1a){var _0x45be59=function(_0x4b39c1){while(--_0x4b39c1){_0x29b8cc['push'](_0x29b8cc['shift']());}};_0x45be59(++_0x5d7e1a);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e9155,_0x38e9d2){_0x3e9155=_0x3e9155-0x0;var _0x5de67a=_0xb10b[_0x3e9155];return _0x5de67a;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x35aef1,_0x10d15f){var _0x4236cd=function(_0xd5781){while(--_0xd5781){_0x35aef1['push'](_0x35aef1['shift']());}};_0x4236cd(++_0x10d15f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 81b3042..5ef51e9 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 _0x20d6=['mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','QueryTypes','num','Empty','length','push','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.xlsx','existsSync','join'];(function(_0x29fd4f,_0x279bfd){var _0x14573a=function(_0x1134d3){while(--_0x1134d3){_0x29fd4f['push'](_0x29fd4f['shift']());}};_0x14573a(++_0x279bfd);}(_0x20d6,0x140));var _0x620d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x20d6[_0x501510];return _0x1e6ee5;};'use strict';var util=require(_0x620d('0x0'));var path=require(_0x620d('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x620d('0x2'));var BPromise=require('bluebird');var zipdir=require(_0x620d('0x3'));var rimraf=require(_0x620d('0x4'));var db=require(_0x620d('0x5'))['db'];var dbH=require(_0x620d('0x5'))[_0x620d('0x6')];var logger=require(_0x620d('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x620d('0x8')][0x2]);var QUERY=process[_0x620d('0x8')][0x3];var PATH=process[_0x620d('0x8')][0x4];function analyticExtractedReport(_0xf7ef0b,_0x1a74d7){var _0x1bc901={'status':_0xf7ef0b};var _0xde67e6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1a74d7){_0x1bc901[_0x620d('0x9')]=_0x1a74d7;}return db['AnalyticExtractedReport']['update'](_0x1bc901,_0xde67e6);}function main(){var _0xde1573=0x1388;var _0x49c3b8;logger[_0x620d('0xa')](util[_0x620d('0xb')](_0x620d('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x620d('0xd')][_0x620d('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x620d('0xf'),_0x620d('0x10')]})[_0x620d('0x11')](function(_0x52def9){if(_0x52def9){_0x49c3b8=_0x52def9;_0xde1573=_0x49c3b8[_0x620d('0x10')]||0x1388;}})[_0x620d('0x11')](function(){return dbH['sequelize']['query'](util[_0x620d('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x620d('0x12')]['SELECT']});})[_0x620d('0x11')](function(_0x1b9e2c){if(!_0x1b9e2c[0x0][_0x620d('0x13')]){return analyticExtractedReport(_0x620d('0x14'));}var _0x29bc84=[];var _0x3faa18=0x0;var _0x271b2f=!![];if(_0x49c3b8['split']){if(_0x1b9e2c&&_0x1b9e2c[_0x620d('0x15')]){var _0x3516a2=_0x1b9e2c[0x0][_0x620d('0x13')]%(_0x3faa18+_0xde1573);for(;_0x271b2f;_0x3faa18+=_0xde1573,_0x3516a2=_0x1b9e2c[0x0][_0x620d('0x13')]%(_0x3faa18+_0xde1573)){if(_0x3516a2==0x0||_0x3516a2==_0x1b9e2c[0x0][_0x620d('0x13')]){_0x271b2f=![];}_0x29bc84[_0x620d('0x16')](dbH[_0x620d('0x17')][_0x620d('0x18')](util[_0x620d('0xb')](_0x620d('0x19'),QUERY,_0xde1573,_0x3faa18),{'type':dbH[_0x620d('0x17')][_0x620d('0x12')]['SELECT']}));}}}else{_0x29bc84[_0x620d('0x16')](dbH[_0x620d('0x17')][_0x620d('0x18')](QUERY,{'type':dbH[_0x620d('0x17')][_0x620d('0x12')][_0x620d('0x1a')]}));}var _0x4a31dc=path[_0x620d('0x1b')](PATH);var _0x10ee7=path[_0x620d('0x1c')](PATH,_0x620d('0x1d'));var _0x3ce9c0=_0x49c3b8[_0x620d('0xf')]&&_0x29bc84[_0x620d('0x15')]>0x1;var _0x3a8779=[];if(!fs[_0x620d('0x1e')](path[_0x620d('0x1f')](_0x4a31dc,_0x10ee7))&&_0x3ce9c0){fs[_0x620d('0x20')](path[_0x620d('0x1f')](_0x4a31dc,_0x10ee7));}return BPromise[_0x620d('0x21')](_0x29bc84,function(_0xc889a4){_0x3a8779[_0x620d('0x16')](_0xc889a4);})['then'](function(){for(var _0x5c3832=0x0;_0x5c3832<_0x3a8779[_0x620d('0x15')];_0x5c3832+=0x1){var _0x36ca66;var _0x1800d5=_0x3a8779[_0x5c3832];if(_0x3ce9c0){_0x36ca66=path[_0x620d('0x1f')](_0x4a31dc,_0x10ee7,util[_0x620d('0xb')](_0x620d('0x22'),_0x10ee7,_0x5c3832,_0x620d('0x23')));}else{_0x36ca66=path[_0x620d('0x1f')](_0x4a31dc,util[_0x620d('0xb')](_0x620d('0x24'),_0x10ee7,_0x620d('0x23')));}fs[_0x620d('0x25')](_0x36ca66,json2xls(_0x1800d5),'binary');}})[_0x620d('0x11')](function(){if(_0x3ce9c0){zipdir(path[_0x620d('0x1f')](_0x4a31dc,_0x10ee7),{'saveTo':path[_0x620d('0x1f')](_0x4a31dc,util[_0x620d('0xb')](_0x620d('0x24'),_0x10ee7,_0x620d('0x26')))},function(_0x3240a4,_0x14b0ee){});rimraf(path['join'](_0x4a31dc,_0x10ee7),function(){});}})[_0x620d('0x11')](function(){logger['info'](util['format'](_0x620d('0x27'),EXTRACTED_REPORT_ID,_0x620d('0x28')));return analyticExtractedReport(_0x620d('0x29'),_0x3ce9c0?util[_0x620d('0xb')](_0x620d('0x24'),_0x10ee7,_0x3ce9c0?_0x620d('0x26'):_0x620d('0x23')):null);});})['catch'](function(_0x586ded){logger[_0x620d('0xa')](util[_0x620d('0xb')](_0x620d('0x2a'),EXTRACTED_REPORT_ID,_0x620d('0x28')),util['inspect'](_0x586ded,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x620d('0x2b'));});}main(); \ No newline at end of file +var _0xc2b4=['format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','split','length','push','SELECT','dirname','.xlsx','existsSync','join','mkdirSync','xlsx','writeFileSync','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Failed','util','path','lodash','json2xls','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info'];(function(_0x2ab3d9,_0x50e716){var _0x210a54=function(_0x24c479){while(--_0x24c479){_0x2ab3d9['push'](_0x2ab3d9['shift']());}};_0x210a54(++_0x50e716);}(_0xc2b4,0xc5));var _0x4c2b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc2b4[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x4c2b('0x0'));var path=require(_0x4c2b('0x1'));var _=require(_0x4c2b('0x2'));var fs=require('fs');var json2xls=require(_0x4c2b('0x3'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x4c2b('0x4'));var db=require(_0x4c2b('0x5'))['db'];var dbH=require(_0x4c2b('0x5'))['dbH'];var logger=require(_0x4c2b('0x6'))(_0x4c2b('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x4c2b('0x8')][0x3];var PATH=process[_0x4c2b('0x8')][0x4];function analyticExtractedReport(_0x12c96e,_0xa5c76b){var _0x427f07={'status':_0x12c96e};var _0x9a40c8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xa5c76b){_0x427f07[_0x4c2b('0x9')]=_0xa5c76b;}return db[_0x4c2b('0xa')][_0x4c2b('0xb')](_0x427f07,_0x9a40c8);}function main(){var _0x557445=0x1388;var _0x28ecd8;logger[_0x4c2b('0xc')](util[_0x4c2b('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4c2b('0xe')));return db[_0x4c2b('0xf')][_0x4c2b('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})['then'](function(_0x11cc06){if(_0x11cc06){_0x28ecd8=_0x11cc06;_0x557445=_0x28ecd8[_0x4c2b('0x11')]||0x1388;}})[_0x4c2b('0x12')](function(){return dbH[_0x4c2b('0x13')][_0x4c2b('0x14')](util[_0x4c2b('0xd')](_0x4c2b('0x15'),QUERY),{'type':dbH[_0x4c2b('0x13')][_0x4c2b('0x16')]['SELECT']});})['then'](function(_0x52a7bc){if(!_0x52a7bc[0x0][_0x4c2b('0x17')]){return analyticExtractedReport(_0x4c2b('0x18'));}var _0xbfa649=[];var _0x12c72d=0x0;var _0x153958=!![];if(_0x28ecd8[_0x4c2b('0x19')]){if(_0x52a7bc&&_0x52a7bc[_0x4c2b('0x1a')]){var _0x3dd7d3=_0x52a7bc[0x0][_0x4c2b('0x17')]%(_0x12c72d+_0x557445);for(;_0x153958;_0x12c72d+=_0x557445,_0x3dd7d3=_0x52a7bc[0x0]['num']%(_0x12c72d+_0x557445)){if(_0x3dd7d3==0x0||_0x3dd7d3==_0x52a7bc[0x0][_0x4c2b('0x17')]){_0x153958=![];}_0xbfa649[_0x4c2b('0x1b')](dbH[_0x4c2b('0x13')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x557445,_0x12c72d),{'type':dbH[_0x4c2b('0x13')][_0x4c2b('0x16')][_0x4c2b('0x1c')]}));}}}else{_0xbfa649[_0x4c2b('0x1b')](dbH[_0x4c2b('0x13')][_0x4c2b('0x14')](QUERY,{'type':dbH[_0x4c2b('0x13')]['QueryTypes']['SELECT']}));}var _0x2c72ec=path[_0x4c2b('0x1d')](PATH);var _0x305d84=path['basename'](PATH,_0x4c2b('0x1e'));var _0x21016a=_0x28ecd8['split']&&_0xbfa649[_0x4c2b('0x1a')]>0x1;var _0x3eb4fb=[];if(!fs[_0x4c2b('0x1f')](path[_0x4c2b('0x20')](_0x2c72ec,_0x305d84))&&_0x21016a){fs[_0x4c2b('0x21')](path[_0x4c2b('0x20')](_0x2c72ec,_0x305d84));}return BPromise['each'](_0xbfa649,function(_0x393428){_0x3eb4fb['push'](_0x393428);})[_0x4c2b('0x12')](function(){for(var _0x791e55=0x0;_0x791e55<_0x3eb4fb[_0x4c2b('0x1a')];_0x791e55+=0x1){var _0x2d3646;var _0x38773e=_0x3eb4fb[_0x791e55];if(_0x21016a){_0x2d3646=path[_0x4c2b('0x20')](_0x2c72ec,_0x305d84,util[_0x4c2b('0xd')]('%s%d.%s',_0x305d84,_0x791e55,_0x4c2b('0x22')));}else{_0x2d3646=path[_0x4c2b('0x20')](_0x2c72ec,util['format']('%s.%s',_0x305d84,_0x4c2b('0x22')));}fs[_0x4c2b('0x23')](_0x2d3646,json2xls(_0x38773e),'binary');}})[_0x4c2b('0x12')](function(){if(_0x21016a){zipdir(path['join'](_0x2c72ec,_0x305d84),{'saveTo':path[_0x4c2b('0x20')](_0x2c72ec,util['format'](_0x4c2b('0x24'),_0x305d84,_0x4c2b('0x25')))},function(_0x37b7b4,_0x46bc2d){});rimraf(path['join'](_0x2c72ec,_0x305d84),function(){});}})[_0x4c2b('0x12')](function(){logger[_0x4c2b('0xc')](util[_0x4c2b('0xd')](_0x4c2b('0x26'),EXTRACTED_REPORT_ID,_0x4c2b('0xe')));return analyticExtractedReport(_0x4c2b('0x27'),_0x21016a?util[_0x4c2b('0xd')]('%s.%s',_0x305d84,_0x21016a?_0x4c2b('0x25'):_0x4c2b('0x22')):null);});})[_0x4c2b('0x28')](function(_0x35c20a){logger['info'](util[_0x4c2b('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x35c20a,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x4c2b('0x29'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 1f66d1c..7ce165a 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 _0xb3b8=['playback','hasOwnProperty','priority','extensions','find','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','outbound','extension','cutdigits','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','IntervalId','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','indexOf','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch','error','rewrite','util','Interval','findAll','intervals','models','VoiceExtension','then','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy'];(function(_0x54de43,_0xfb2a03){var _0x22cb02=function(_0x246cce){while(--_0x246cce){_0x54de43['push'](_0x54de43['shift']());}};_0x22cb02(++_0xfb2a03);}(_0xb3b8,0x108));var _0x8b3b=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0xb3b8[_0x136619];return _0x38c4a5;};'use strict';var _=require('lodash');var util=require(_0x8b3b('0x0'));function rewrite(_0x13a732,_0x5effe9){var _0x4ad387=this;return _0x13a732['models'][_0x8b3b('0x1')][_0x8b3b('0x2')]({'raw':!![]})['then'](function(_0xe83da4){_0x4ad387[_0x8b3b('0x3')]=_0xe83da4;return _0x13a732[_0x8b3b('0x4')][_0x8b3b('0x5')][_0x8b3b('0x2')]({'where':{'IntervalId':_0x5effe9['IntervalId']},'raw':!![]});})[_0x8b3b('0x6')](function(_0x10f5b9){return _0x13a732[_0x8b3b('0x4')][_0x8b3b('0x5')]['findAll']({'where':{'exten':{'$in':_[_0x8b3b('0x7')](_['map'](_0x10f5b9,_0x8b3b('0x8')))}},'order':[{'raw':_0x8b3b('0x9')}],'raw':!![]});})[_0x8b3b('0x6')](function(_0x9ba7dc){var _0x17d4ad=_['filter'](_0x9ba7dc,{'priority':'1'});var _0x23aa25=_[_0x8b3b('0xa')](_0x9ba7dc,{'isApp':0x1});var _0x55e09e=_[_0x8b3b('0xb')](_0x23aa25,_0x8b3b('0x8'));var _0x530b76=['queue',_0x8b3b('0xc')];var _0x46b12b=[];var _0x4d34a2=[];for(var _0x514703 in _0x55e09e){if(_0x55e09e[_0x8b3b('0xd')](_0x514703)){_0x4ad387[_0x8b3b('0xe')]=0x2;_0x4ad387[_0x8b3b('0xf')]=[];_0x4ad387['extension']=_[_0x8b3b('0x10')](_0x17d4ad,{'exten':_0x55e09e[_0x514703][0x0][_0x8b3b('0x8')]});_0x4ad387[_0x8b3b('0xf')][_0x8b3b('0x11')]({'type':_0x55e09e[_0x514703][0x0][_0x8b3b('0x12')],'app':_0x8b3b('0x13'),'appdata':util[_0x8b3b('0x14')](_0x8b3b('0x15'),_0x55e09e[_0x514703][0x0][_0x8b3b('0x12')]),'context':_0x55e09e[_0x514703][0x0][_0x8b3b('0x16')],'exten':_0x55e09e[_0x514703][0x0][_0x8b3b('0x8')],'priority':_0x4ad387[_0x8b3b('0xe')]++,'VoiceExtensionId':_0x55e09e[_0x514703][0x0][_0x8b3b('0x17')]});if(_0x55e09e[_0x514703][0x0]['type']===_0x8b3b('0x18')){if(_0x4ad387[_0x8b3b('0x19')]){_0x4ad387[_0x8b3b('0xf')][_0x8b3b('0x11')]({'type':_0x55e09e[_0x514703][0x0][_0x8b3b('0x12')],'app':_0x8b3b('0x13'),'appdata':'CDR(destination)='+(_0x4ad387[_0x8b3b('0x19')][_0x8b3b('0x1a')]?'${EXTEN:'+_0x4ad387[_0x8b3b('0x19')][_0x8b3b('0x1a')]+'}':'${EXTEN}'),'context':_0x55e09e[_0x514703][0x0][_0x8b3b('0x16')],'exten':_0x55e09e[_0x514703][0x0][_0x8b3b('0x8')],'priority':_0x4ad387[_0x8b3b('0xe')]++,'VoiceExtensionId':_0x55e09e[_0x514703][0x0][_0x8b3b('0x17')]});}_0x4ad387['extensions'][_0x8b3b('0x11')]({'type':_0x55e09e[_0x514703][0x0][_0x8b3b('0x12')],'app':'Set','appdata':_0x8b3b('0x1b')+_0x55e09e[_0x514703][0x0]['VoiceExtensionId'],'context':_0x55e09e[_0x514703][0x0]['context'],'exten':_0x55e09e[_0x514703][0x0][_0x8b3b('0x8')],'priority':_0x4ad387[_0x8b3b('0xe')]++,'VoiceExtensionId':_0x55e09e[_0x514703][0x0][_0x8b3b('0x17')]});var _0x2c1dd9=_0x4ad387['priority']++;_0x4ad387['extensions'][_0x8b3b('0x11')]({'type':_0x55e09e[_0x514703][0x0]['type'],'app':_0x8b3b('0x1c'),'appdata':_0x8b3b('0x1d')+(_0x2c1dd9+0x2)+_0x8b3b('0x1e')+(_0x2c1dd9+0x1)+')','context':_0x55e09e[_0x514703][0x0]['context'],'exten':_0x55e09e[_0x514703][0x0][_0x8b3b('0x8')],'priority':_0x2c1dd9,'VoiceExtensionId':_0x55e09e[_0x514703][0x0][_0x8b3b('0x17')]});if(_0x4ad387[_0x8b3b('0x19')]){_0x4ad387['extensions'][_0x8b3b('0x11')]({'type':_0x55e09e[_0x514703][0x0][_0x8b3b('0x12')],'app':_0x8b3b('0x13'),'appdata':_0x4ad387[_0x8b3b('0x19')][_0x8b3b('0x1a')]?_0x8b3b('0x1f')+_0x4ad387[_0x8b3b('0x19')][_0x8b3b('0x1a')]+'}':_0x8b3b('0x20'),'context':_0x55e09e[_0x514703][0x0][_0x8b3b('0x16')],'exten':_0x55e09e[_0x514703][0x0][_0x8b3b('0x8')],'priority':_0x4ad387['priority']++,'VoiceExtensionId':_0x55e09e[_0x514703][0x0]['VoiceExtensionId']});}_0x4ad387[_0x8b3b('0xf')]['push']({'type':_0x55e09e[_0x514703][0x0][_0x8b3b('0x12')],'app':'Set','appdata':'outboundrouteid='+_0x55e09e[_0x514703][0x0][_0x8b3b('0x17')],'context':_0x55e09e[_0x514703][0x0][_0x8b3b('0x16')],'exten':_0x55e09e[_0x514703][0x0][_0x8b3b('0x8')],'priority':_0x4ad387['priority']++,'VoiceExtensionId':_0x55e09e[_0x514703][0x0]['VoiceExtensionId']});if(_0x4ad387[_0x8b3b('0x19')]&&_0x4ad387[_0x8b3b('0x19')]['hasOwnProperty'](_0x8b3b('0x21'))&&_0x4ad387[_0x8b3b('0x19')][_0x8b3b('0x21')]!=='none'){_0x4ad387['extensions'][_0x8b3b('0x11')]({'type':_0x55e09e[_0x514703][0x0][_0x8b3b('0x12')],'app':_0x8b3b('0x13'),'appdata':_0x8b3b('0x22'),'context':_0x55e09e[_0x514703][0x0][_0x8b3b('0x16')],'exten':_0x55e09e[_0x514703][0x0][_0x8b3b('0x8')],'priority':_0x4ad387[_0x8b3b('0xe')]++,'VoiceExtensionId':_0x55e09e[_0x514703][0x0][_0x8b3b('0x17')]});_0x4ad387[_0x8b3b('0xf')]['push']({'type':_0x55e09e[_0x514703][0x0][_0x8b3b('0x12')],'app':_0x8b3b('0x13'),'appdata':_0x8b3b('0x23')+_0x4ad387['extension'][_0x8b3b('0x21')]||_0x8b3b('0x24'),'context':_0x55e09e[_0x514703][0x0][_0x8b3b('0x16')],'exten':_0x55e09e[_0x514703][0x0][_0x8b3b('0x8')],'priority':_0x4ad387[_0x8b3b('0xe')]++,'VoiceExtensionId':_0x55e09e[_0x514703][0x0][_0x8b3b('0x17')]});}}_0x4ad387['extensions'][_0x8b3b('0x11')]({'type':_0x55e09e[_0x514703][0x0][_0x8b3b('0x12')],'app':'Set','appdata':_0x8b3b('0x25'),'context':_0x55e09e[_0x514703][0x0][_0x8b3b('0x16')],'exten':_0x55e09e[_0x514703][0x0][_0x8b3b('0x8')],'priority':_0x4ad387[_0x8b3b('0xe')]++,'VoiceExtensionId':_0x55e09e[_0x514703][0x0][_0x8b3b('0x17')]});_0x4ad387['extensions']['push']({'type':_0x55e09e[_0x514703][0x0][_0x8b3b('0x12')],'app':_0x8b3b('0x13'),'appdata':_0x8b3b('0x26'),'context':_0x55e09e[_0x514703][0x0][_0x8b3b('0x16')],'exten':_0x55e09e[_0x514703][0x0][_0x8b3b('0x8')],'priority':_0x4ad387[_0x8b3b('0xe')]++,'VoiceExtensionId':_0x55e09e[_0x514703][0x0][_0x8b3b('0x17')]});_0x4ad387[_0x8b3b('0xf')]['push']({'type':_0x55e09e[_0x514703][0x0][_0x8b3b('0x12')],'app':_0x8b3b('0x13'),'appdata':_0x8b3b('0x27'),'context':_0x55e09e[_0x514703][0x0][_0x8b3b('0x16')],'exten':_0x55e09e[_0x514703][0x0][_0x8b3b('0x8')],'priority':_0x4ad387[_0x8b3b('0xe')]++,'VoiceExtensionId':_0x55e09e[_0x514703][0x0]['VoiceExtensionId']});for(var _0x5b1561=0x0,_0xbf6987=0x0;_0x5b1561<_0x55e09e[_0x514703][_0x8b3b('0x28')];_0x5b1561+=0x1,_0xbf6987=0x0){var _0x40146c=_0x55e09e[_0x514703][_0x5b1561];if(_0x40146c[_0x8b3b('0x12')]){_0x40146c[_0x8b3b('0x12')]=_0x40146c[_0x8b3b('0x12')][_0x8b3b('0x29')]();}var _0x42e019=[];var _0x4e7a4e=[];delete _0x40146c['id'];delete _0x40146c[_0x8b3b('0x2a')];delete _0x40146c['updatedAt'];var _0x17eded=_0x40146c[_0x8b3b('0x2b')]!==_0x8b3b('0x2c')?[_0x40146c['interval']]:_0x40146c[_0x8b3b('0x2d')]?_[_0x8b3b('0x2e')](_['filter'](_0x4ad387[_0x8b3b('0x3')],{'IntervalId':_0x40146c['IntervalId']}),_0x8b3b('0x2b')):[];if(_0x40146c['hasOwnProperty'](_0x8b3b('0x2f'))){if(_0x40146c['tag']&&_0x40146c[_0x8b3b('0x2f')]!=='--'){_0x42e019['push']({'type':_0x40146c[_0x8b3b('0x12')],'app':_0x8b3b('0x13'),'appdata':_0x8b3b('0x30')+_0x40146c[_0x8b3b('0x2f')],'context':_0x40146c[_0x8b3b('0x16')],'exten':_0x40146c[_0x8b3b('0x8')],'priority':_0x17eded['length']+_0x4ad387['priority']+_0xbf6987++,'VoiceExtensionId':_0x40146c['VoiceExtensionId']});}}if(_0x40146c[_0x8b3b('0x12')]===_0x8b3b('0x18')&&_0x40146c['hasOwnProperty'](_0x8b3b('0x31'))){if(_0x40146c['callerID']){_0x42e019[_0x8b3b('0x11')]({'type':_0x40146c[_0x8b3b('0x12')],'app':_0x8b3b('0x1c'),'appdata':_0x8b3b('0x32')+_0x40146c[_0x8b3b('0x31')]+')','context':_0x40146c[_0x8b3b('0x16')],'exten':_0x40146c['exten'],'priority':_0x17eded[_0x8b3b('0x28')]+_0x4ad387[_0x8b3b('0xe')]+_0xbf6987++,'VoiceExtensionId':_0x40146c[_0x8b3b('0x17')]});}else{_0x42e019[_0x8b3b('0x11')]({'type':_0x40146c[_0x8b3b('0x12')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x40146c['context'],'exten':_0x40146c[_0x8b3b('0x8')],'priority':_0x17eded[_0x8b3b('0x28')]+_0x4ad387['priority']+_0xbf6987++,'VoiceExtensionId':_0x40146c[_0x8b3b('0x17')]});}}if(_0x40146c['hasOwnProperty']('answer')){if(_0x530b76[_0x8b3b('0x33')](_0x40146c[_0x8b3b('0x34')][_0x8b3b('0x29')]())>=0x0&&_0x40146c['appType']!==_0x8b3b('0x35')){if(_0x40146c[_0x8b3b('0x36')]){_0x42e019[_0x8b3b('0x11')]({'type':_0x40146c[_0x8b3b('0x12')],'app':'ExecIf','appdata':_0x8b3b('0x37'),'context':_0x40146c[_0x8b3b('0x16')],'exten':_0x40146c['exten'],'priority':_0x17eded[_0x8b3b('0x28')]+_0x4ad387[_0x8b3b('0xe')]+_0xbf6987++,'VoiceExtensionId':_0x40146c[_0x8b3b('0x17')]});_0x42e019['push']({'type':_0x40146c['type'],'app':'Set','appdata':_0x8b3b('0x38'),'context':_0x40146c['context'],'exten':_0x40146c['exten'],'priority':_0x17eded[_0x8b3b('0x28')]+_0x4ad387['priority']+_0xbf6987++,'VoiceExtensionId':_0x40146c['VoiceExtensionId']});}else{_0x42e019[_0x8b3b('0x11')]({'type':_0x40146c[_0x8b3b('0x12')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x40146c[_0x8b3b('0x16')],'exten':_0x40146c[_0x8b3b('0x8')],'priority':_0x17eded[_0x8b3b('0x28')]+_0x4ad387['priority']+_0xbf6987++,'VoiceExtensionId':_0x40146c['VoiceExtensionId']});_0x42e019[_0x8b3b('0x11')]({'type':_0x40146c[_0x8b3b('0x12')],'app':_0x8b3b('0x13'),'appdata':_0x8b3b('0x39'),'context':_0x40146c['context'],'exten':_0x40146c[_0x8b3b('0x8')],'priority':_0x17eded[_0x8b3b('0x28')]+_0x4ad387[_0x8b3b('0xe')]+_0xbf6987++,'VoiceExtensionId':_0x40146c[_0x8b3b('0x17')]});}}}for(var _0x3a0914=0x0;_0x3a0914<_0x17eded[_0x8b3b('0x28')];_0x3a0914+=0x1){var _0x28568d=_0x4ad387[_0x8b3b('0xe')]+_0x17eded[_0x8b3b('0x28')];var _0x12707d=_0x3a0914===_0x17eded[_0x8b3b('0x28')]-0x1?_0x4ad387['priority']+_0x42e019[_0x8b3b('0x28')]+_0x4e7a4e['length']+0x2:_0x4ad387[_0x8b3b('0xe')]+_0x3a0914+0x1;_0x42e019['splice'](_0x3a0914,0x0,{'type':_0x40146c[_0x8b3b('0x12')],'app':_0x8b3b('0x3a'),'appdata':_0x17eded[_0x3a0914]+'?'+_0x40146c['context']+',${EXTEN},'+_0x28568d+':'+_0x40146c['context']+_0x8b3b('0x3b')+_0x12707d,'exten':_0x40146c[_0x8b3b('0x8')],'context':_0x40146c[_0x8b3b('0x16')],'priority':_0x4ad387['priority']+_0x3a0914,'VoiceExtensionId':_0x55e09e[_0x514703][0x0][_0x8b3b('0x17')]});}_0x40146c[_0x8b3b('0xe')]=_0x42e019[_0x8b3b('0x28')]?_['last'](_0x42e019)['priority']+0x1:_0x4ad387[_0x8b3b('0xe')];_0x4ad387['priority']=(_0x4e7a4e[_0x8b3b('0x28')]?_[_0x8b3b('0x3c')](_0x4e7a4e)[_0x8b3b('0xe')]:_0x40146c['priority'])+0x1;_0x4ad387[_0x8b3b('0xf')]=_[_0x8b3b('0x3d')](_0x4ad387[_0x8b3b('0xf')],_0x42e019,[_0x40146c],_0x4e7a4e);}_0x4ad387[_0x8b3b('0xf')][_0x8b3b('0x11')]({'type':_0x55e09e[_0x514703][0x0][_0x8b3b('0x12')],'app':_0x8b3b('0x3e'),'exten':_0x55e09e[_0x514703][0x0][_0x8b3b('0x8')],'context':_0x55e09e[_0x514703][0x0][_0x8b3b('0x16')],'priority':_0x4ad387[_0x8b3b('0xe')],'VoiceExtensionId':_0x55e09e[_0x514703][0x0][_0x8b3b('0x17')]});_0x46b12b['push'](_0x55e09e[_0x514703][0x0]['VoiceExtensionId']);_0x4d34a2=_[_0x8b3b('0x3d')](_0x4d34a2,_0x4ad387['extensions']);}}return _0x13a732[_0x8b3b('0x3f')](function(_0x1bd9b3){return _0x13a732[_0x8b3b('0x4')]['VoiceExtension'][_0x8b3b('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x46b12b}},'transaction':_0x1bd9b3})[_0x8b3b('0x6')](function(_0x105f13){return _0x13a732[_0x8b3b('0x4')][_0x8b3b('0x5')]['bulkCreate'](_[_0x8b3b('0x41')](_0x4d34a2,_0x8b3b('0xe')),{'transaction':_0x1bd9b3});});});})[_0x8b3b('0x42')](function(_0x3851e7){console[_0x8b3b('0x43')](_0x3851e7);});}exports[_0x8b3b('0x44')]=rewrite; \ No newline at end of file +var _0x50c1=['context','CDR(routeid)=','ExecIf','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','*,*,*,*','tag','outbound','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','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','error','rewrite','lodash','models','Interval','findAll','then','intervals','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','hasOwnProperty','priority','extensions','extension','find','push','Set','CDR(type)=%s','VoiceExtensionId','type','CDR(destination)=','cutdigits','${EXTEN:'];(function(_0x243d52,_0x2d5634){var _0xbbf923=function(_0x1a9466){while(--_0x1a9466){_0x243d52['push'](_0x243d52['shift']());}};_0xbbf923(++_0x2d5634);}(_0x50c1,0x1a5));var _0x150c=function(_0x31db51,_0x2958a7){_0x31db51=_0x31db51-0x0;var _0x58d60d=_0x50c1[_0x31db51];return _0x58d60d;};'use strict';var _=require(_0x150c('0x0'));var util=require('util');function rewrite(_0x47d48d,_0x33d11f){var _0x292ace=this;return _0x47d48d[_0x150c('0x1')][_0x150c('0x2')][_0x150c('0x3')]({'raw':!![]})[_0x150c('0x4')](function(_0x37cd57){_0x292ace[_0x150c('0x5')]=_0x37cd57;return _0x47d48d[_0x150c('0x1')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x33d11f[_0x150c('0x6')]},'raw':!![]});})['then'](function(_0x5b10b4){return _0x47d48d[_0x150c('0x1')][_0x150c('0x7')][_0x150c('0x3')]({'where':{'exten':{'$in':_[_0x150c('0x8')](_[_0x150c('0x9')](_0x5b10b4,_0x150c('0xa')))}},'order':[{'raw':_0x150c('0xb')}],'raw':!![]});})[_0x150c('0x4')](function(_0x29ae40){var _0x2fc78e=_['filter'](_0x29ae40,{'priority':'1'});var _0xa0cbab=_[_0x150c('0xc')](_0x29ae40,{'isApp':0x1});var _0x194f58=_['groupBy'](_0xa0cbab,_0x150c('0xa'));var _0x4e2f73=['queue',_0x150c('0xd')];var _0x1d2ec7=[];var _0x1c7670=[];for(var _0x2971fc in _0x194f58){if(_0x194f58[_0x150c('0xe')](_0x2971fc)){_0x292ace[_0x150c('0xf')]=0x2;_0x292ace[_0x150c('0x10')]=[];_0x292ace[_0x150c('0x11')]=_[_0x150c('0x12')](_0x2fc78e,{'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')]});_0x292ace[_0x150c('0x10')][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0]['type'],'app':_0x150c('0x14'),'appdata':util['format'](_0x150c('0x15'),_0x194f58[_0x2971fc][0x0]['type']),'context':_0x194f58[_0x2971fc][0x0]['context'],'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'priority':_0x292ace[_0x150c('0xf')]++,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0][_0x150c('0x16')]});if(_0x194f58[_0x2971fc][0x0][_0x150c('0x17')]==='outbound'){if(_0x292ace[_0x150c('0x11')]){_0x292ace[_0x150c('0x10')][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0][_0x150c('0x17')],'app':_0x150c('0x14'),'appdata':_0x150c('0x18')+(_0x292ace['extension'][_0x150c('0x19')]?_0x150c('0x1a')+_0x292ace['extension'][_0x150c('0x19')]+'}':'${EXTEN}'),'context':_0x194f58[_0x2971fc][0x0][_0x150c('0x1b')],'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'priority':_0x292ace[_0x150c('0xf')]++,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0][_0x150c('0x16')]});}_0x292ace[_0x150c('0x10')]['push']({'type':_0x194f58[_0x2971fc][0x0][_0x150c('0x17')],'app':_0x150c('0x14'),'appdata':_0x150c('0x1c')+_0x194f58[_0x2971fc][0x0][_0x150c('0x16')],'context':_0x194f58[_0x2971fc][0x0][_0x150c('0x1b')],'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'priority':_0x292ace[_0x150c('0xf')]++,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0][_0x150c('0x16')]});var _0x3b1ce6=_0x292ace['priority']++;_0x292ace['extensions'][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0][_0x150c('0x17')],'app':_0x150c('0x1d'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3b1ce6+0x2)+'):Goto('+(_0x3b1ce6+0x1)+')','context':_0x194f58[_0x2971fc][0x0][_0x150c('0x1b')],'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'priority':_0x3b1ce6,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0][_0x150c('0x16')]});if(_0x292ace[_0x150c('0x11')]){_0x292ace[_0x150c('0x10')][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0][_0x150c('0x17')],'app':'Set','appdata':_0x292ace['extension'][_0x150c('0x19')]?_0x150c('0x1e')+_0x292ace[_0x150c('0x11')][_0x150c('0x19')]+'}':'CDR(prefix)=noprefix','context':_0x194f58[_0x2971fc][0x0]['context'],'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'priority':_0x292ace[_0x150c('0xf')]++,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0][_0x150c('0x16')]});}_0x292ace['extensions'][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0]['type'],'app':_0x150c('0x14'),'appdata':_0x150c('0x1f')+_0x194f58[_0x2971fc][0x0][_0x150c('0x16')],'context':_0x194f58[_0x2971fc][0x0]['context'],'exten':_0x194f58[_0x2971fc][0x0]['exten'],'priority':_0x292ace[_0x150c('0xf')]++,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0]['VoiceExtensionId']});if(_0x292ace[_0x150c('0x11')]&&_0x292ace[_0x150c('0x11')][_0x150c('0xe')](_0x150c('0x20'))&&_0x292ace[_0x150c('0x11')][_0x150c('0x20')]!==_0x150c('0x21')){_0x292ace['extensions'][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0][_0x150c('0x17')],'app':'Set','appdata':_0x150c('0x22'),'context':_0x194f58[_0x2971fc][0x0][_0x150c('0x1b')],'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'priority':_0x292ace['priority']++,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0][_0x150c('0x16')]});_0x292ace[_0x150c('0x10')][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0]['type'],'app':_0x150c('0x14'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x292ace['extension'][_0x150c('0x20')]||'wav','context':_0x194f58[_0x2971fc][0x0]['context'],'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'priority':_0x292ace[_0x150c('0xf')]++,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0][_0x150c('0x16')]});}}_0x292ace[_0x150c('0x10')][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0][_0x150c('0x17')],'app':_0x150c('0x14'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x194f58[_0x2971fc][0x0][_0x150c('0x1b')],'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'priority':_0x292ace[_0x150c('0xf')]++,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0]['VoiceExtensionId']});_0x292ace[_0x150c('0x10')][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0][_0x150c('0x17')],'app':_0x150c('0x14'),'appdata':_0x150c('0x23'),'context':_0x194f58[_0x2971fc][0x0]['context'],'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'priority':_0x292ace[_0x150c('0xf')]++,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0][_0x150c('0x16')]});_0x292ace['extensions'][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0][_0x150c('0x17')],'app':_0x150c('0x14'),'appdata':_0x150c('0x24'),'context':_0x194f58[_0x2971fc][0x0][_0x150c('0x1b')],'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'priority':_0x292ace[_0x150c('0xf')]++,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0]['VoiceExtensionId']});for(var _0x510ab6=0x0,_0x55e78c=0x0;_0x510ab6<_0x194f58[_0x2971fc][_0x150c('0x25')];_0x510ab6+=0x1,_0x55e78c=0x0){var _0x14aab3=_0x194f58[_0x2971fc][_0x510ab6];if(_0x14aab3[_0x150c('0x17')]){_0x14aab3[_0x150c('0x17')]=_0x14aab3[_0x150c('0x17')][_0x150c('0x26')]();}var _0x4f86bb=[];var _0x3f7a57=[];delete _0x14aab3['id'];delete _0x14aab3['createdAt'];delete _0x14aab3[_0x150c('0x27')];var _0x16bc55=_0x14aab3[_0x150c('0x28')]!==_0x150c('0x29')?[_0x14aab3[_0x150c('0x28')]]:_0x14aab3[_0x150c('0x6')]?_[_0x150c('0x9')](_[_0x150c('0xc')](_0x292ace[_0x150c('0x5')],{'IntervalId':_0x14aab3[_0x150c('0x6')]}),'interval'):[];if(_0x14aab3['hasOwnProperty']('tag')){if(_0x14aab3['tag']&&_0x14aab3['tag']!=='--'){_0x4f86bb[_0x150c('0x13')]({'type':_0x14aab3[_0x150c('0x17')],'app':_0x150c('0x14'),'appdata':'CDR(tag)='+_0x14aab3[_0x150c('0x2a')],'context':_0x14aab3['context'],'exten':_0x14aab3[_0x150c('0xa')],'priority':_0x16bc55[_0x150c('0x25')]+_0x292ace[_0x150c('0xf')]+_0x55e78c++,'VoiceExtensionId':_0x14aab3[_0x150c('0x16')]});}}if(_0x14aab3[_0x150c('0x17')]===_0x150c('0x2b')&&_0x14aab3[_0x150c('0xe')](_0x150c('0x2c'))){if(_0x14aab3[_0x150c('0x2c')]){_0x4f86bb[_0x150c('0x13')]({'type':_0x14aab3[_0x150c('0x17')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x14aab3['callerID']+')','context':_0x14aab3[_0x150c('0x1b')],'exten':_0x14aab3[_0x150c('0xa')],'priority':_0x16bc55[_0x150c('0x25')]+_0x292ace[_0x150c('0xf')]+_0x55e78c++,'VoiceExtensionId':_0x14aab3[_0x150c('0x16')]});}else{_0x4f86bb[_0x150c('0x13')]({'type':_0x14aab3[_0x150c('0x17')],'app':_0x150c('0x1d'),'appdata':_0x150c('0x2d'),'context':_0x14aab3['context'],'exten':_0x14aab3[_0x150c('0xa')],'priority':_0x16bc55['length']+_0x292ace[_0x150c('0xf')]+_0x55e78c++,'VoiceExtensionId':_0x14aab3['VoiceExtensionId']});}}if(_0x14aab3[_0x150c('0xe')](_0x150c('0x2e'))){if(_0x4e2f73[_0x150c('0x2f')](_0x14aab3[_0x150c('0x30')]['toLowerCase']())>=0x0&&_0x14aab3[_0x150c('0x31')]!==_0x150c('0x32')){if(_0x14aab3[_0x150c('0x2e')]){_0x4f86bb[_0x150c('0x13')]({'type':_0x14aab3[_0x150c('0x17')],'app':_0x150c('0x1d'),'appdata':_0x150c('0x33'),'context':_0x14aab3[_0x150c('0x1b')],'exten':_0x14aab3[_0x150c('0xa')],'priority':_0x16bc55[_0x150c('0x25')]+_0x292ace[_0x150c('0xf')]+_0x55e78c++,'VoiceExtensionId':_0x14aab3[_0x150c('0x16')]});_0x4f86bb[_0x150c('0x13')]({'type':_0x14aab3['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x14aab3[_0x150c('0x1b')],'exten':_0x14aab3[_0x150c('0xa')],'priority':_0x16bc55['length']+_0x292ace[_0x150c('0xf')]+_0x55e78c++,'VoiceExtensionId':_0x14aab3[_0x150c('0x16')]});}else{_0x4f86bb['push']({'type':_0x14aab3[_0x150c('0x17')],'app':_0x150c('0x1d'),'appdata':_0x150c('0x34'),'context':_0x14aab3['context'],'exten':_0x14aab3[_0x150c('0xa')],'priority':_0x16bc55[_0x150c('0x25')]+_0x292ace[_0x150c('0xf')]+_0x55e78c++,'VoiceExtensionId':_0x14aab3[_0x150c('0x16')]});_0x4f86bb[_0x150c('0x13')]({'type':_0x14aab3[_0x150c('0x17')],'app':_0x150c('0x14'),'appdata':_0x150c('0x35'),'context':_0x14aab3[_0x150c('0x1b')],'exten':_0x14aab3['exten'],'priority':_0x16bc55[_0x150c('0x25')]+_0x292ace[_0x150c('0xf')]+_0x55e78c++,'VoiceExtensionId':_0x14aab3[_0x150c('0x16')]});}}}for(var _0x2b89ee=0x0;_0x2b89ee<_0x16bc55[_0x150c('0x25')];_0x2b89ee+=0x1){var _0x22ade2=_0x292ace[_0x150c('0xf')]+_0x16bc55[_0x150c('0x25')];var _0x1cb0c8=_0x2b89ee===_0x16bc55[_0x150c('0x25')]-0x1?_0x292ace[_0x150c('0xf')]+_0x4f86bb[_0x150c('0x25')]+_0x3f7a57['length']+0x2:_0x292ace[_0x150c('0xf')]+_0x2b89ee+0x1;_0x4f86bb[_0x150c('0x36')](_0x2b89ee,0x0,{'type':_0x14aab3[_0x150c('0x17')],'app':'GotoIfTime','appdata':_0x16bc55[_0x2b89ee]+'?'+_0x14aab3[_0x150c('0x1b')]+_0x150c('0x37')+_0x22ade2+':'+_0x14aab3[_0x150c('0x1b')]+',${EXTEN},'+_0x1cb0c8,'exten':_0x14aab3[_0x150c('0xa')],'context':_0x14aab3[_0x150c('0x1b')],'priority':_0x292ace['priority']+_0x2b89ee,'VoiceExtensionId':_0x194f58[_0x2971fc][0x0][_0x150c('0x16')]});}_0x14aab3[_0x150c('0xf')]=_0x4f86bb['length']?_[_0x150c('0x38')](_0x4f86bb)[_0x150c('0xf')]+0x1:_0x292ace[_0x150c('0xf')];_0x292ace[_0x150c('0xf')]=(_0x3f7a57[_0x150c('0x25')]?_[_0x150c('0x38')](_0x3f7a57)[_0x150c('0xf')]:_0x14aab3['priority'])+0x1;_0x292ace[_0x150c('0x10')]=_[_0x150c('0x39')](_0x292ace['extensions'],_0x4f86bb,[_0x14aab3],_0x3f7a57);}_0x292ace[_0x150c('0x10')][_0x150c('0x13')]({'type':_0x194f58[_0x2971fc][0x0][_0x150c('0x17')],'app':_0x150c('0x3a'),'exten':_0x194f58[_0x2971fc][0x0][_0x150c('0xa')],'context':_0x194f58[_0x2971fc][0x0][_0x150c('0x1b')],'priority':_0x292ace[_0x150c('0xf')],'VoiceExtensionId':_0x194f58[_0x2971fc][0x0]['VoiceExtensionId']});_0x1d2ec7[_0x150c('0x13')](_0x194f58[_0x2971fc][0x0][_0x150c('0x16')]);_0x1c7670=_[_0x150c('0x39')](_0x1c7670,_0x292ace[_0x150c('0x10')]);}}return _0x47d48d[_0x150c('0x3b')](function(_0x3ec441){return _0x47d48d[_0x150c('0x1')][_0x150c('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x1d2ec7}},'transaction':_0x3ec441})[_0x150c('0x4')](function(_0x5836ff){return _0x47d48d['models'][_0x150c('0x7')][_0x150c('0x3c')](_[_0x150c('0x3d')](_0x1c7670,'priority'),{'transaction':_0x3ec441});});});})['catch'](function(_0x46fdc9){console[_0x150c('0x3e')](_0x46fdc9);});}exports[_0x150c('0x3f')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 0e86360..d2fb63b 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 _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x5c5d17,_0x2c1c8e){var _0x478d06=function(_0x4ccdce){while(--_0x4ccdce){_0x5c5d17['push'](_0x5c5d17['shift']());}};_0x478d06(++_0x2c1c8e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);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(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){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))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file +var _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate'];(function(_0x2f84bd,_0x428332){var _0xb5d99=function(_0x26157e){while(--_0x26157e){_0x2f84bd['push'](_0x2f84bd['shift']());}};_0xb5d99(++_0x428332);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];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 socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);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(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){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'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 4087ba5..c41991d 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 _0xde00=['map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','cm_hopper','fromQuery','phone','scheduledat','ListId','priority','UserId','recallme','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','into','cm_hopper_black','ContactId','createdAt','updatedAt','fields','ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','Received\x20SIGINT','error','exit','errors','push','code','info','sequelize','catch','message','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','length','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','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','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','campaigns_has_cm_blacklists','CampaignId','each','finish','affectedRows','emit','contact:import:','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory'];(function(_0x3974b4,_0x23424c){var _0x3bab3b=function(_0x1f86a1){while(--_0x1f86a1){_0x3974b4['push'](_0x3974b4['shift']());}};_0x3bab3b(++_0x23424c);}(_0xde00,0x19b));var _0x0de0=function(_0x2cf7dd,_0x26172a){_0x2cf7dd=_0x2cf7dd-0x0;var _0x20450a=_0xde00[_0x2cf7dd];return _0x20450a;};'use strict';var fs=require('fs');var path=require(_0x0de0('0x0'));var _=require(_0x0de0('0x1'));var Papa=require(_0x0de0('0x2'));var util=require(_0x0de0('0x3'));var BPromise=require(_0x0de0('0x4'));var moment=require(_0x0de0('0x5'));var squel=require(_0x0de0('0x6'));var Redis=require(_0x0de0('0x7'));var db=require(_0x0de0('0x8'))['db'];var config=require(_0x0de0('0x9'));var logger=require(_0x0de0('0xa'))(_0x0de0('0xb'));config[_0x0de0('0xc')]=_[_0x0de0('0xd')](config[_0x0de0('0xc')],{'host':_0x0de0('0xe'),'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 NOW=moment()[_0x0de0('0xf')](_0x0de0('0x10'));function isEmail(_0x2f552b){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))*$/[_0x0de0('0x11')](_0x2f552b);}function selectNotIn(_0x1270c2,_0x311ff4,_0x5dbb9b,_0x2b03ae,_0x1f06ab){return squel[_0x0de0('0x12')]()[_0x0de0('0x13')]('phone')['from'](_0x2b03ae)[_0x0de0('0x14')](_0x311ff4,null,_0x311ff4+_0x0de0('0x15')+_0x2b03ae+'.'+_0x5dbb9b)[_0x0de0('0x16')](_0x2b03ae+'.'+_0x5dbb9b+'\x20=\x20'+_0x1270c2+'.'+_0x5dbb9b)[_0x0de0('0x16')](_0x311ff4+_0x0de0('0x17')+_0x1f06ab[_0x0de0('0x14')]()+')');}function insertCmHopper(_0x31e379,_0xc7eb69,_0x4ea650,_0x273379,_0x1875a1){var _0xe94212=[_0x0de0('0x18'),_0x0de0('0x19'),_0x0de0('0x1a'),_0x0de0('0x1b'),_0xc7eb69+'.'+_0x273379,_0x0de0('0x1c'),_0x0de0('0x1d'),'cm_contacts.priority',_0x0de0('0x1e'),'\x22'+_0x1875a1+'\x22'];return squel[_0x0de0('0x1f')]()['into'](_0x0de0('0x20'))[_0x0de0('0x21')]([_0x0de0('0x22'),_0x0de0('0x23'),'ContactId',_0x0de0('0x24'),_0x273379,'createdAt','updatedAt',_0x0de0('0x25'),_0x0de0('0x26'),_0x0de0('0x27')],squel['select']()['fields'](_0xe94212)[_0x0de0('0x28')](_0xc7eb69)[_0x0de0('0x14')](_0x0de0('0x29'),null,_0x0de0('0x2a')+_0xc7eb69+_0x0de0('0x2b'))['join'](_0x4ea650,null,_0x4ea650+_0x0de0('0x15')+_0xc7eb69+'.'+_0x273379)[_0x0de0('0x16')](_0xc7eb69+'.CmListId\x20=\x20?',_0x31e379)[_0x0de0('0x16')](_0x0de0('0x2c'),NOW)['where'](_0x0de0('0x2d'),selectNotIn(_0xc7eb69,_0x4ea650,_0x273379,'cm_hopper',['\x22always\x22','\x22onlyIfOpen\x22']))[_0x0de0('0x16')](_0x0de0('0x2d'),selectNotIn(_0xc7eb69,_0x4ea650,_0x273379,'cm_hopper',['\x22always\x22'])))[_0x0de0('0x2e')]();}function insertCmHopperBlack(_0x5cf4d8,_0x5d38db,_0x1dc118,_0x250c12){var _0x2ebae8=['cm_contacts.phone','cm_contacts.id',_0x0de0('0x1b'),_0x5d38db+'.'+_0x250c12,_0x0de0('0x1c'),_0x0de0('0x1d')];return squel['insert']()[_0x0de0('0x2f')](_0x0de0('0x30'))[_0x0de0('0x21')](['phone',_0x0de0('0x31'),_0x0de0('0x24'),_0x250c12,_0x0de0('0x32'),_0x0de0('0x33')],squel[_0x0de0('0x12')]()[_0x0de0('0x34')](_0x2ebae8)[_0x0de0('0x28')](_0x5d38db)['join'](_0x0de0('0x29'),null,_0x0de0('0x2a')+_0x5d38db+_0x0de0('0x2b'))[_0x0de0('0x14')](_0x1dc118,null,_0x1dc118+_0x0de0('0x15')+_0x5d38db+'.'+_0x250c12)[_0x0de0('0x16')](_0x5d38db+'.CmListId\x20=\x20?',_0x5cf4d8)[_0x0de0('0x16')](_0x0de0('0x2c'),NOW)['where'](_0x0de0('0x2d'),squel[_0x0de0('0x12')]()['field'](_0x0de0('0x22'))['from'](_0x0de0('0x30'))['where'](_0x0de0('0x35'),_0x5cf4d8)['where'](_0x250c12+'\x20=\x20?',_0x5d38db+'.'+_0x250c12)))[_0x0de0('0x2e')]();}function insertCmContact(_0x54cbdd,_0x19c7fc,_0x18a765,_0x15398c){var _0x16a44b=_[_0x0de0('0x36')](_[_0x0de0('0x37')](_0x15398c),[_0x0de0('0x24'),_0x0de0('0x38'),_0x0de0('0x32'),_0x0de0('0x33')]);return squel[_0x0de0('0x1f')]()[_0x0de0('0x2f')]('cm_contacts')[_0x0de0('0x21')](_0x16a44b,squel[_0x0de0('0x12')]()[_0x0de0('0x34')](_0x16a44b)[_0x0de0('0x28')](_0x19c7fc)[_0x0de0('0x16')]('('+_0x18a765['join'](',')+_0x0de0('0x39'),squel[_0x0de0('0x12')]()[_0x0de0('0x34')](_0x18a765)[_0x0de0('0x28')]('cm_contacts')[_0x0de0('0x16')](_0x0de0('0x35'),_0x54cbdd)[_0x0de0('0x16')]('deletedAt\x20IS\x20NULL'))[_0x0de0('0x16')](_0x0de0('0x3a'),squel['select']()[_0x0de0('0x13')](_0x0de0('0x3b'),_0x0de0('0x3c'))[_0x0de0('0x28')](_0x19c7fc)['group'](_0x18a765['join'](','))))[_0x0de0('0x2e')]();}function handleStop(){logger['info'](_0x0de0('0x3d'));stopped=!![];}function handleUncaughtException(_0x3b780d){logger[_0x0de0('0x3e')](_0x3b780d['message']);process[_0x0de0('0x3f')](0x1);}function handleError(_0x213611,_0x55e4ef){stats[_0x0de0('0x40')][_0x0de0('0x41')]({'name':_0x55e4ef[_0x0de0('0x42')],'message':_0x55e4ef['message'],'row':_0x213611});}function handleQuery(_0x49982c){logger[_0x0de0('0x43')](_0x49982c);return db[_0x0de0('0x44')]['query'](_0x49982c)['spread'](function(_0x5161ea){results[_0x0de0('0x41')](_0x5161ea);})[_0x0de0('0x45')](function(_0x4fb9bf){logger[_0x0de0('0x3e')](_0x4fb9bf[_0x0de0('0x46')]);});}function main(_0x2a6ced,_0x3a1b55,_0x4dc3f3,_0x5aa4ae){logger[_0x0de0('0x43')]('main',_0x2a6ced,JSON[_0x0de0('0x47')](_0x3a1b55));process[_0x0de0('0x48')](_0x0de0('0x49'));var _0x44c1be=_0x3a1b55[_0x0de0('0x4a')];var _0x46f495=_0x3a1b55[_0x0de0('0x4b')];var _0x51f9c5=path[_0x0de0('0x14')](config[_0x0de0('0x4c')],_0x0de0('0x4d'),_0x46f495+_0x0de0('0x4e'));var _0x558669=_[_0x0de0('0x37')](_0x44c1be)['join']();logger[_0x0de0('0x43')](_0x0de0('0x4f'),_0x558669);fs[_0x0de0('0x50')](_0x51f9c5,_0x558669+'\x0a');Papa[_0x0de0('0x51')](fs[_0x0de0('0x52')](_0x2a6ced),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3662aa,_0x5de22c){try{for(var _0x2c6917=0x0,_0x845df5=[];_0x2c6917<_0x3662aa[_0x0de0('0x53')][_0x0de0('0x54')];_0x2c6917++){stats['rows']+=0x1;if(_0x3662aa[_0x0de0('0x40')][_0x2c6917]){handleError(_0x3662aa['data'][_0x2c6917],_0x3662aa[_0x0de0('0x40')][_0x2c6917]);}else{var _0x5db789=[];for(var _0x4119a8 in _0x44c1be){if(_0x44c1be[_0x0de0('0x55')](_0x4119a8)){if(_0x3662aa['data'][_0x2c6917][_0x44c1be[_0x4119a8]]){var _0x4944a2=_[_0x0de0('0x56')](_0x3662aa[_0x0de0('0x53')][_0x2c6917][_0x44c1be[_0x4119a8]][_0x0de0('0x57')](/"/g,'\x27'));switch(_0x4119a8){case _0x0de0('0x23'):var _0x50d3cd=moment(_0x4944a2,_0x0de0('0x10'),!![]);if(_0x50d3cd[_0x0de0('0x58')]()){_0x845df5[_0x0de0('0x41')]('\x22'+_0x4944a2+'\x22');}else{_0x5db789[_0x0de0('0x41')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x0de0('0x25'):var _0x4e360e=parseInt(_0x4944a2);_0x4944a2=_[_0x0de0('0x59')](_0x4e360e)||_0x4e360e<0x0||_0x4e360e>0x4?_0x5aa4ae?0x3:0x2:_0x4e360e;_0x845df5[_0x0de0('0x41')]('\x22'+_0x4944a2+'\x22');break;case _0x0de0('0x26'):var _0x383681=parseInt(_0x4944a2);if(_[_0x0de0('0x5a')](_0x383681)&&_[_0x0de0('0x5b')](_0x4dc3f3,_0x383681)){_0x845df5['push']('\x22'+_0x383681+'\x22');}else{_0x5db789[_0x0de0('0x41')](_0x0de0('0x5c'));}break;case'email':if(isEmail(_0x4944a2)){_0x845df5['push']('\x22'+_0x4944a2+'\x22');}else{_0x5db789['push'](_0x0de0('0x5d'));}break;case _0x0de0('0x5e'):var _0x13ae23=moment(_0x4944a2,_0x0de0('0x5f'),!![]);if(_0x13ae23['isValid']()){_0x845df5[_0x0de0('0x41')]('\x22'+_0x4944a2+'\x22');}else{_0x5db789['push'](_0x0de0('0x60'));}break;default:_0x845df5['push']('\x22'+_0x4944a2+'\x22');}}else{switch(_0x4119a8){case _0x0de0('0x61'):case _0x0de0('0x22'):_0x5db789[_0x0de0('0x41')](_0x4119a8+_0x0de0('0x62'));break;default:_0x845df5[_0x0de0('0x41')]('\x22\x22');}}}}if(_0x5db789[_0x0de0('0x54')]){handleError(_0x3662aa[_0x0de0('0x53')][_0x2c6917],{'code':_0x0de0('0x63'),'message':_0x5db789[_0x0de0('0x14')]()});}else{fs[_0x0de0('0x64')](_0x51f9c5,_0x845df5[_0x0de0('0x14')]()+'\x0a');}_0x845df5=[];}if(!(stats[_0x0de0('0x65')]%0xc8)){socket['emit']('contact:import:'+_0x46f495,stats);stats[_0x0de0('0x40')]=[];}}if(stopped){logger[_0x0de0('0x43')](_0x0de0('0x66'));_0x5de22c[_0x0de0('0x67')]();}}catch(_0x5b0869){handleError(_0x3662aa[_0x0de0('0x53')][_0x2c6917],{'code':_0x0de0('0x68'),'message':_0x5b0869['message']});logger[_0x0de0('0x3e')]('step',_0x5b0869[_0x0de0('0x46')]);}},'complete':function(){try{var _0x263d26=[];var _0xd77e1e=_0x0de0('0x29');if(_0x3a1b55[_0x0de0('0x69')]&&_0x3a1b55[_0x0de0('0x69')][_0x0de0('0x54')]){_0xd77e1e=_0x0de0('0x6a')+_0x46f495;_0x263d26['push'](_0x0de0('0x6b')+_0xd77e1e+_0x0de0('0x6c'));}var _0x41649d=util[_0x0de0('0xf')](_0x0de0('0x6d'),_0x51f9c5,_0xd77e1e,_0x558669,_0x3a1b55['ListId'],_0x3a1b55[_0x0de0('0x38')]||null,NOW,NOW);if(_[_0x0de0('0x6e')](_0x44c1be[_0x0de0('0x23')])){_0x41649d+=_0x0de0('0x6f');}_0x263d26['push'](_0x41649d);if(_0x3a1b55[_0x0de0('0x69')]&&_0x3a1b55[_0x0de0('0x69')]['length']){_0x263d26['push'](insertCmContact(_0x3a1b55['ListId'],_0xd77e1e,_0x3a1b55['duplicates'],_0x44c1be));_0x263d26[_0x0de0('0x41')](_0x0de0('0x70')+_0xd77e1e+';');}_0x263d26['push'](insertCmHopper(_0x3a1b55[_0x0de0('0x24')],'voice_queues_has_cm_lists',_0x0de0('0x71'),_0x0de0('0x72'),_0x5aa4ae));_0x263d26[_0x0de0('0x41')](insertCmHopperBlack(_0x3a1b55['ListId'],_0x0de0('0x73'),_0x0de0('0x71'),_0x0de0('0x72')));_0x263d26[_0x0de0('0x41')](insertCmHopper(_0x3a1b55[_0x0de0('0x24')],'campaigns_has_cm_lists',_0x0de0('0x74'),'CampaignId',_0x5aa4ae));_0x263d26['push'](insertCmHopperBlack(_0x3a1b55['ListId'],_0x0de0('0x75'),_0x0de0('0x74'),_0x0de0('0x76')));BPromise[_0x0de0('0x77')](_0x263d26,handleQuery)['then'](function(_0x554e42){stats[_0x0de0('0x78')]=!![];stats[_0x0de0('0x79')]=_0x3a1b55[_0x0de0('0x69')]&&_0x3a1b55['duplicates'][_0x0de0('0x54')]?results[0x2]['affectedRows']:results[0x0][_0x0de0('0x79')];socket[_0x0de0('0x7a')](_0x0de0('0x7b')+_0x46f495,stats);fs[_0x0de0('0x7c')](_0x2a6ced);fs[_0x0de0('0x7c')](_0x51f9c5);process[_0x0de0('0x3f')](0x0);})[_0x0de0('0x45')](function(_0x18311e){logger[_0x0de0('0x3e')](_0x18311e['message']);process[_0x0de0('0x3f')](0x1);});}catch(_0x340b39){logger[_0x0de0('0x3e')](_0x0de0('0x7d'),_0x340b39['message']);process['exit'](0x1);}},'error':function(_0x23d389,_0x5bb61c,_0x3338c5,_0x5ccbd3){throw new Error(_0x5ccbd3);}});}function validate(){if(process[_0x0de0('0x7e')]&&process[_0x0de0('0x7e')][_0x0de0('0x54')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x55ccdd=path[_0x0de0('0x14')](config['root'],'server/files/tmp',process[_0x0de0('0x7e')][0x2]);if(!fs[_0x0de0('0x7f')](_0x55ccdd)){throw new Error(_0x0de0('0x80'));}var _0x5983e8={};try{_0x5983e8=JSON[_0x0de0('0x51')](process[_0x0de0('0x7e')][0x3]);if(!_0x5983e8[_0x0de0('0x4a')]){throw new Error(_0x0de0('0x81'));}if(!_0x5983e8['binding'][_0x0de0('0x22')]){throw new Error(_0x0de0('0x82'));}if(!_0x5983e8[_0x0de0('0x4a')][_0x0de0('0x61')]){throw new Error('firstName\x20is\x20mandatory');}var _0x25917e=0x0;if(_0x5983e8['binding']['UserId']){_0x25917e=0x1;}if(!_0x5983e8[_0x0de0('0x24')]){throw new Error(_0x0de0('0x83'));}}catch(_0x5352a3){throw new Error(_0x0de0('0x84'));}var _0x48027c=[];try{_0x48027c=_[_0x0de0('0x85')](JSON[_0x0de0('0x51')](process['argv'][0x4]),'id');}catch(_0x3fe1ab){logger[_0x0de0('0x43')](_0x0de0('0x86'));}main(_0x55ccdd,_0x5983e8,_0x48027c,_0x25917e);}validate();process['on']('SIGINT',handleStop);process['on'](_0x0de0('0x87'),handleUncaughtException); \ No newline at end of file +var _0xd08a=['hasOwnProperty','trim','replace','scheduledat','YYYY-MM-DD\x20HH:mm:ss','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','Abort\x20parser','abort','duplicates','\x20LIKE\x20cm_contacts;','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()','voice_queues_has_cm_lists','voice_queues','CampaignId','campaigns_has_cm_blacklists','campaigns','then','finish','unlink','arguments\x20\x20\x20','argv','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','body\x20id\x20mandatory','map','parse','No\x20agent\x20available','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','test','select','field','phone','from','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','join','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','into','cm_hopper_black','cm_contacts.ListId\x20=\x20','\x20=\x20?','toString','concat','keys','CompanyId','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','error','exit','errors','push','code','message','sequelize','query','spread','catch','main','stringify','send','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','createReadStream','data','length','rows'];(function(_0x5219ec,_0x582356){var _0x388c0e=function(_0xaee0c1){while(--_0xaee0c1){_0x5219ec['push'](_0x5219ec['shift']());}};_0x388c0e(++_0x582356);}(_0xd08a,0x134));var _0xad08=function(_0x50591a,_0x3e0f25){_0x50591a=_0x50591a-0x0;var _0x5d5dd2=_0xd08a[_0x50591a];return _0x5d5dd2;};'use strict';var fs=require('fs');var path=require(_0xad08('0x0'));var _=require(_0xad08('0x1'));var Papa=require(_0xad08('0x2'));var util=require(_0xad08('0x3'));var BPromise=require(_0xad08('0x4'));var moment=require(_0xad08('0x5'));var squel=require('squel');var Redis=require(_0xad08('0x6'));var db=require(_0xad08('0x7'))['db'];var config=require(_0xad08('0x8'));var logger=require(_0xad08('0x9'))(_0xad08('0xa'));config['redis']=_['defaults'](config[_0xad08('0xb')],{'host':_0xad08('0xc'),'port':0x18eb});var socket=require(_0xad08('0xd'))(new Redis(config[_0xad08('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x54d193){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))*$/[_0xad08('0xe')](_0x54d193);}function selectNotIn(_0x25031f,_0x2cd47f,_0x465a57,_0x2733a4,_0x48ad37){return squel[_0xad08('0xf')]()[_0xad08('0x10')](_0xad08('0x11'))[_0xad08('0x12')](_0x2733a4)['join'](_0x2cd47f,null,_0x2cd47f+_0xad08('0x13')+_0x2733a4+'.'+_0x465a57)['where'](_0x2733a4+'.'+_0x465a57+_0xad08('0x14')+_0x25031f+'.'+_0x465a57)[_0xad08('0x15')](_0x2cd47f+_0xad08('0x16')+_0x48ad37['join']()+')');}function insertCmHopper(_0x3364ca,_0x39261d,_0x12efe1,_0x27207a,_0x3715c9){var _0x5b36a9=[_0xad08('0x17'),_0xad08('0x18'),_0xad08('0x19'),'cm_contacts.ListId',_0x39261d+'.'+_0x27207a,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xad08('0x1a'),_0xad08('0x1b'),'\x22'+_0x3715c9+'\x22'];return squel[_0xad08('0x1c')]()['into'](_0xad08('0x1d'))[_0xad08('0x1e')](['phone','scheduledat',_0xad08('0x1f'),_0xad08('0x20'),_0x27207a,_0xad08('0x21'),_0xad08('0x22'),_0xad08('0x23'),_0xad08('0x24'),_0xad08('0x25')],squel[_0xad08('0xf')]()[_0xad08('0x26')](_0x5b36a9)[_0xad08('0x12')](_0x39261d)[_0xad08('0x27')](_0xad08('0x28'),null,'cm_contacts.ListId\x20=\x20'+_0x39261d+_0xad08('0x29'))[_0xad08('0x27')](_0x12efe1,null,_0x12efe1+_0xad08('0x13')+_0x39261d+'.'+_0x27207a)[_0xad08('0x15')](_0x39261d+_0xad08('0x2a'),_0x3364ca)['where'](_0xad08('0x2b'),NOW)[_0xad08('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x39261d,_0x12efe1,_0x27207a,_0xad08('0x1d'),[_0xad08('0x2c'),_0xad08('0x2d')]))[_0xad08('0x15')](_0xad08('0x2e'),selectNotIn(_0x39261d,_0x12efe1,_0x27207a,_0xad08('0x1d'),[_0xad08('0x2c')])))['toString']();}function insertCmHopperBlack(_0x1af979,_0x11c9ed,_0xb5894e,_0x2f869a){var _0x3b0b01=['cm_contacts.phone',_0xad08('0x19'),_0xad08('0x2f'),_0x11c9ed+'.'+_0x2f869a,_0xad08('0x30'),_0xad08('0x31')];return squel[_0xad08('0x1c')]()[_0xad08('0x32')](_0xad08('0x33'))['fromQuery']([_0xad08('0x11'),_0xad08('0x1f'),_0xad08('0x20'),_0x2f869a,_0xad08('0x21'),_0xad08('0x22')],squel['select']()['fields'](_0x3b0b01)['from'](_0x11c9ed)[_0xad08('0x27')](_0xad08('0x28'),null,_0xad08('0x34')+_0x11c9ed+_0xad08('0x29'))[_0xad08('0x27')](_0xb5894e,null,_0xb5894e+_0xad08('0x13')+_0x11c9ed+'.'+_0x2f869a)[_0xad08('0x15')](_0x11c9ed+_0xad08('0x2a'),_0x1af979)[_0xad08('0x15')](_0xad08('0x2b'),NOW)[_0xad08('0x15')](_0xad08('0x2e'),squel[_0xad08('0xf')]()[_0xad08('0x10')](_0xad08('0x11'))[_0xad08('0x12')](_0xad08('0x33'))['where']('ListId\x20=\x20?',_0x1af979)[_0xad08('0x15')](_0x2f869a+_0xad08('0x35'),_0x11c9ed+'.'+_0x2f869a)))[_0xad08('0x36')]();}function insertCmContact(_0x5c5c4b,_0x24bacd,_0x28be29,_0x58170f){var _0x14152a=_[_0xad08('0x37')](_[_0xad08('0x38')](_0x58170f),[_0xad08('0x20'),_0xad08('0x39'),_0xad08('0x21'),_0xad08('0x22')]);return squel[_0xad08('0x1c')]()[_0xad08('0x32')](_0xad08('0x28'))['fromQuery'](_0x14152a,squel[_0xad08('0xf')]()[_0xad08('0x26')](_0x14152a)[_0xad08('0x12')](_0x24bacd)[_0xad08('0x15')]('('+_0x28be29['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xad08('0xf')]()[_0xad08('0x26')](_0x28be29)[_0xad08('0x12')](_0xad08('0x28'))[_0xad08('0x15')](_0xad08('0x3a'),_0x5c5c4b)['where'](_0xad08('0x3b')))[_0xad08('0x15')](_0xad08('0x3c'),squel[_0xad08('0xf')]()[_0xad08('0x10')](_0xad08('0x3d'),_0xad08('0x3e'))['from'](_0x24bacd)[_0xad08('0x3f')](_0x28be29['join'](','))))['toString']();}function handleStop(){logger[_0xad08('0x40')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x513277){logger[_0xad08('0x41')](_0x513277['message']);process[_0xad08('0x42')](0x1);}function handleError(_0x30a604,_0x1861dc){stats[_0xad08('0x43')][_0xad08('0x44')]({'name':_0x1861dc[_0xad08('0x45')],'message':_0x1861dc[_0xad08('0x46')],'row':_0x30a604});}function handleQuery(_0x2983cf){logger[_0xad08('0x40')](_0x2983cf);return db[_0xad08('0x47')][_0xad08('0x48')](_0x2983cf)[_0xad08('0x49')](function(_0x243c84){results[_0xad08('0x44')](_0x243c84);})[_0xad08('0x4a')](function(_0x1a56e0){logger[_0xad08('0x41')](_0x1a56e0[_0xad08('0x46')]);});}function main(_0x54828c,_0x3f8618,_0x221019,_0x31c784){logger['info'](_0xad08('0x4b'),_0x54828c,JSON[_0xad08('0x4c')](_0x3f8618));process[_0xad08('0x4d')]('start');var _0x51a751=_0x3f8618['binding'];var _0x20434e=_0x3f8618[_0xad08('0x4e')];var _0x2fefb5=path[_0xad08('0x27')](config[_0xad08('0x4f')],_0xad08('0x50'),_0x20434e+_0xad08('0x51'));var _0x3cbd21=_[_0xad08('0x38')](_0x51a751)[_0xad08('0x27')]();logger[_0xad08('0x40')](_0xad08('0x52'),_0x3cbd21);fs[_0xad08('0x53')](_0x2fefb5,_0x3cbd21+'\x0a');Papa['parse'](fs[_0xad08('0x54')](_0x54828c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3a9949,_0xa4dcd5){try{for(var _0x9119a3=0x0,_0x498c45=[];_0x9119a3<_0x3a9949[_0xad08('0x55')][_0xad08('0x56')];_0x9119a3++){stats[_0xad08('0x57')]+=0x1;if(_0x3a9949['errors'][_0x9119a3]){handleError(_0x3a9949[_0xad08('0x55')][_0x9119a3],_0x3a9949[_0xad08('0x43')][_0x9119a3]);}else{var _0x5eb597=[];for(var _0xd3f20b in _0x51a751){if(_0x51a751[_0xad08('0x58')](_0xd3f20b)){if(_0x3a9949[_0xad08('0x55')][_0x9119a3][_0x51a751[_0xd3f20b]]){var _0x2af371=_[_0xad08('0x59')](_0x3a9949['data'][_0x9119a3][_0x51a751[_0xd3f20b]][_0xad08('0x5a')](/"/g,'\x27'));switch(_0xd3f20b){case _0xad08('0x5b'):var _0x5068a2=moment(_0x2af371,_0xad08('0x5c'),!![]);if(_0x5068a2['isValid']()){_0x498c45[_0xad08('0x44')]('\x22'+_0x2af371+'\x22');}else{_0x5eb597[_0xad08('0x44')](_0xad08('0x5d'));}break;case'priority':var _0x50ba97=parseInt(_0x2af371);_0x2af371=_[_0xad08('0x5e')](_0x50ba97)||_0x50ba97<0x0||_0x50ba97>0x4?_0x31c784?0x3:0x2:_0x50ba97;_0x498c45[_0xad08('0x44')]('\x22'+_0x2af371+'\x22');break;case'UserId':var _0x28074b=parseInt(_0x2af371);if(_[_0xad08('0x5f')](_0x28074b)&&_['includes'](_0x221019,_0x28074b)){_0x498c45[_0xad08('0x44')]('\x22'+_0x28074b+'\x22');}else{_0x5eb597[_0xad08('0x44')](_0xad08('0x60'));}break;case _0xad08('0x61'):if(isEmail(_0x2af371)){_0x498c45[_0xad08('0x44')]('\x22'+_0x2af371+'\x22');}else{_0x5eb597[_0xad08('0x44')](_0xad08('0x62'));}break;case _0xad08('0x63'):var _0x29aea2=moment(_0x2af371,_0xad08('0x64'),!![]);if(_0x29aea2['isValid']()){_0x498c45[_0xad08('0x44')]('\x22'+_0x2af371+'\x22');}else{_0x5eb597['push'](_0xad08('0x65'));}break;default:_0x498c45[_0xad08('0x44')]('\x22'+_0x2af371+'\x22');}}else{switch(_0xd3f20b){case _0xad08('0x66'):case'phone':_0x5eb597[_0xad08('0x44')](_0xd3f20b+_0xad08('0x67'));break;default:_0x498c45[_0xad08('0x44')]('\x22\x22');}}}}if(_0x5eb597['length']){handleError(_0x3a9949[_0xad08('0x55')][_0x9119a3],{'code':_0xad08('0x68'),'message':_0x5eb597[_0xad08('0x27')]()});}else{fs[_0xad08('0x69')](_0x2fefb5,_0x498c45[_0xad08('0x27')]()+'\x0a');}_0x498c45=[];}if(!(stats[_0xad08('0x57')]%0xc8)){socket[_0xad08('0x6a')]('contact:import:'+_0x20434e,stats);stats[_0xad08('0x43')]=[];}}if(stopped){logger[_0xad08('0x40')](_0xad08('0x6b'));_0xa4dcd5[_0xad08('0x6c')]();}}catch(_0x17687e){handleError(_0x3a9949[_0xad08('0x55')][_0x9119a3],{'code':'SystemError','message':_0x17687e[_0xad08('0x46')]});logger['error']('step',_0x17687e[_0xad08('0x46')]);}},'complete':function(){try{var _0x38bfcd=[];var _0x23400a=_0xad08('0x28');if(_0x3f8618[_0xad08('0x6d')]&&_0x3f8618[_0xad08('0x6d')]['length']){_0x23400a='cm_contacts_'+_0x20434e;_0x38bfcd['push']('CREATE\x20TABLE\x20'+_0x23400a+_0xad08('0x6e'));}var _0x1f91c4=util['format'](_0xad08('0x6f'),_0x2fefb5,_0x23400a,_0x3cbd21,_0x3f8618[_0xad08('0x20')],_0x3f8618[_0xad08('0x39')]||null,NOW,NOW);if(_['isNil'](_0x51a751[_0xad08('0x5b')])){_0x1f91c4+=_0xad08('0x70');}_0x38bfcd[_0xad08('0x44')](_0x1f91c4);if(_0x3f8618['duplicates']&&_0x3f8618[_0xad08('0x6d')][_0xad08('0x56')]){_0x38bfcd[_0xad08('0x44')](insertCmContact(_0x3f8618[_0xad08('0x20')],_0x23400a,_0x3f8618[_0xad08('0x6d')],_0x51a751));_0x38bfcd[_0xad08('0x44')]('DROP\x20TABLE\x20'+_0x23400a+';');}_0x38bfcd[_0xad08('0x44')](insertCmHopper(_0x3f8618[_0xad08('0x20')],_0xad08('0x71'),_0xad08('0x72'),'VoiceQueueId',_0x31c784));_0x38bfcd[_0xad08('0x44')](insertCmHopperBlack(_0x3f8618[_0xad08('0x20')],'voice_queues_has_cm_blacklists',_0xad08('0x72'),'VoiceQueueId'));_0x38bfcd[_0xad08('0x44')](insertCmHopper(_0x3f8618[_0xad08('0x20')],'campaigns_has_cm_lists','campaigns',_0xad08('0x73'),_0x31c784));_0x38bfcd[_0xad08('0x44')](insertCmHopperBlack(_0x3f8618[_0xad08('0x20')],_0xad08('0x74'),_0xad08('0x75'),_0xad08('0x73')));BPromise['each'](_0x38bfcd,handleQuery)[_0xad08('0x76')](function(_0x391155){stats[_0xad08('0x77')]=!![];stats['affectedRows']=_0x3f8618[_0xad08('0x6d')]&&_0x3f8618['duplicates'][_0xad08('0x56')]?results[0x2]['affectedRows']:results[0x0]['affectedRows'];socket[_0xad08('0x6a')]('contact:import:'+_0x20434e,stats);fs['unlink'](_0x54828c);fs[_0xad08('0x78')](_0x2fefb5);process[_0xad08('0x42')](0x0);})[_0xad08('0x4a')](function(_0x510351){logger[_0xad08('0x41')](_0x510351['message']);process[_0xad08('0x42')](0x1);});}catch(_0x44c30f){logger[_0xad08('0x41')]('complete',_0x44c30f[_0xad08('0x46')]);process[_0xad08('0x42')](0x1);}},'error':function(_0x4de540,_0x3612b3,_0x5dce24,_0x5740e8){throw new Error(_0x5740e8);}});}function validate(){if(process['argv']&&process['argv'][_0xad08('0x56')]<0x4){throw new Error(_0xad08('0x79'));}var _0x52f695=path[_0xad08('0x27')](config[_0xad08('0x4f')],'server/files/tmp',process[_0xad08('0x7a')][0x2]);if(!fs[_0xad08('0x7b')](_0x52f695)){throw new Error(_0xad08('0x7c'));}var _0x562ca9={};try{_0x562ca9=JSON['parse'](process[_0xad08('0x7a')][0x3]);if(!_0x562ca9[_0xad08('0x7d')]){throw new Error(_0xad08('0x7e'));}if(!_0x562ca9[_0xad08('0x7d')][_0xad08('0x11')]){throw new Error(_0xad08('0x7f'));}if(!_0x562ca9[_0xad08('0x7d')][_0xad08('0x66')]){throw new Error('firstName\x20is\x20mandatory');}var _0xe7336f=0x0;if(_0x562ca9['binding'][_0xad08('0x24')]){_0xe7336f=0x1;}if(!_0x562ca9[_0xad08('0x20')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x12519e){throw new Error(_0xad08('0x80'));}var _0x2af1aa=[];try{_0x2af1aa=_[_0xad08('0x81')](JSON[_0xad08('0x82')](process[_0xad08('0x7a')][0x4]),'id');}catch(_0x1dfe48){logger['info'](_0xad08('0x83'));}main(_0x52f695,_0x562ca9,_0x2af1aa,_0xe7336f);}validate();process['on']('SIGINT',handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 1779191..7b034d3 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa710=['.dialCheckDuplicateType\x20IN\x20(','join','sequelize','query','select\x20*\x20from\x20','spread','isNil','phone','AdditionalPhones','push','all','catch','error','message','split','length','filter','CmContactHasItem','then','updated','create','inserted','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ListId','createdAt','updatedAt','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_contacts.updatedAt','fields','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','min_id','info','Received\x20SIGINT','exit','errors','code','main','send','start','clone','root','.csv','body','ContactItemType','findAll','name','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','appendFileSync','emit','Abort\x20parser','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','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\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','DROP\x20TABLE\x20','finish','contact:import:','unlink','argv','arguments\x20\x20\x20','server/files/tmp','file\x20doesn\x27t\x20exists','binding','map','path','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','defaults','localhost','redis','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','from','.id\x20=\x20','where','\x20=\x20'];(function(_0x3190d5,_0x252709){var _0x3d679c=function(_0x5418a7){while(--_0x5418a7){_0x3190d5['push'](_0x3190d5['shift']());}};_0x3d679c(++_0x252709);}(_0xa710,0x117));var _0x0a71=function(_0xdc356f,_0x3003d0){_0xdc356f=_0xdc356f-0x0;var _0x339eaa=_0xa710[_0xdc356f];return _0x339eaa;};'use strict';var fs=require('fs');var path=require(_0x0a71('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0x0a71('0x1'));var BPromise=require('bluebird');var moment=require(_0x0a71('0x2'));var squel=require(_0x0a71('0x3'));var Redis=require(_0x0a71('0x4'));var db=require(_0x0a71('0x5'))['db'];var config=require(_0x0a71('0x6'));var logger=require(_0x0a71('0x7'))('import');config['redis']=_[_0x0a71('0x8')](config['redis'],{'host':_0x0a71('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a71('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x0a71('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x0a71('0xc')+moment()['format'](_0x0a71('0xd'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x4ae3ac){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))*$/[_0x0a71('0xe')](_0x4ae3ac);}function selectNotIn(_0x23da8e,_0x2c47ac,_0x58c49f,_0x3bf387,_0x5ce29a){return squel[_0x0a71('0xf')]()[_0x0a71('0x10')]('phone')[_0x0a71('0x11')](_0x3bf387)['join'](_0x2c47ac,null,_0x2c47ac+_0x0a71('0x12')+_0x3bf387+'.'+_0x58c49f)[_0x0a71('0x13')](_0x3bf387+'.'+_0x58c49f+_0x0a71('0x14')+_0x23da8e+'.'+_0x58c49f)[_0x0a71('0x13')](_0x2c47ac+_0x0a71('0x15')+_0x5ce29a[_0x0a71('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4b6d50,_0x22a792){promisesAdditionalPhones=[];promisesContact=[];return db[_0x0a71('0x17')][_0x0a71('0x18')](_0x0a71('0x19')+tempTableName)[_0x0a71('0x1a')](function(_0x342812){if(_0x342812!==null){var _0x1f6cb7=[];for(var _0x2f6631=0x0;_0x2f6631<_0x342812['length'];_0x2f6631++){var _0x1b44c2=_0x342812[_0x2f6631];if(!_[_0x0a71('0x1b')](_0x1b44c2[_0x0a71('0x1c')])){if(!_[_0x0a71('0x1b')](_0x1b44c2[_0x0a71('0x1d')]))_0x1f6cb7[_0x0a71('0x1e')](insertAdditionalPhones(_0x1b44c2));promisesContact['push']({'contact':_0x1b44c2});}}}Promise[_0x0a71('0x1f')](_0x1f6cb7)['then'](function(){_0x4b6d50({'val':0x1});});})[_0x0a71('0x20')](function(_0x51ab4e){logger[_0x0a71('0x21')](_0x51ab4e[_0x0a71('0x22')]);});});}function insertAdditionalPhones(_0x5867e7){return new Promise(function(_0x39670f,_0x1fd34b){var _0x164c21=_0x5867e7[_0x0a71('0x1d')];if(_[_0x0a71('0x1b')](_0x164c21))_0x1fd34b({'val':0x0});else{var _0x136671=_0x164c21[_0x0a71('0x23')](';');var _0x5891e5=[];orderBy=0x0;for(var _0x4d7a0a=0x0;_0x4d7a0a<_0x136671[_0x0a71('0x24')];_0x4d7a0a++){_0x5891e5[_0x0a71('0x1e')](splitAdditionalPhone(_0x5867e7['id'],_0x136671[_0x4d7a0a]));}Promise[_0x0a71('0x1f')](_0x5891e5)['then'](function(){_0x39670f({'val':_0x136671[_0x0a71('0x24')]});});}});}function splitAdditionalPhone(_0xd3620e,_0xc58334){return new Promise(function(_0x5d44b3,_0x428713){var _0x390634=_0xc58334[_0x0a71('0x23')](':');var _0x579cca=_0x390634[0x0];var _0x2c8e6f=_0x390634[0x1];if(_0x2c8e6f!==''){var _0x5406dd=_0x2c8e6f[_0x0a71('0x23')]('|');var _0x4869a0=[];for(var _0x29e6a8=0x0;_0x29e6a8<_0x5406dd[_0x0a71('0x24')];_0x29e6a8++){if(_0x5406dd[_0x29e6a8]!==''){var _0x65c264=_[_0x0a71('0x25')](promisesAdditionalPhones,{'contactId':_0xd3620e,'phone':_0x5406dd[_0x29e6a8]});if(_0x65c264[_0x0a71('0x24')]==0x0){orderBy++;promisesAdditionalPhones[_0x0a71('0x1e')]({'contactId':_0xd3620e,'contactTypeId':_0x579cca,'phone':_0x5406dd[_0x29e6a8],'orderBy':orderBy});}}}_0x5d44b3({'ok':0x1});}else _0x5d44b3({'res':0x0});});}function createAdditionalPhone(_0x4ebc05,_0x166e9a,_0x33e19c,_0x2c67b1){return new Promise(function(_0x1487d3,_0x351612){return db[_0x0a71('0x26')]['findOne']({'where':{'CmContactId':_0x4ebc05,'item':_0x33e19c}})[_0x0a71('0x27')](function(_0x39a0f3){if(_0x39a0f3){return db[_0x0a71('0x26')]['update']({'ItemTypeId':_0x166e9a,'OrderBy':_0x2c67b1},{'where':{'CmContactId':_0x4ebc05,'item':_0x33e19c}})['then'](function(_0x35e20a){_0x1487d3({'res':_0x0a71('0x28')});});}else{return db[_0x0a71('0x26')][_0x0a71('0x29')]({'CmContactId':_0x4ebc05,'item':_0x33e19c,'ItemTypeId':_0x166e9a,'OrderBy':_0x2c67b1,'ItemClass':'PHONE'})[_0x0a71('0x27')](function(_0x281e51){_0x1487d3({'res':_0x0a71('0x2a')});});}});});}function updateContact(_0x51ecc4){return new Promise(function(_0x3bc590,_0x24b974){var _0xb4637=_0x51ecc4['id'];delete _0x51ecc4['id'];return db[_0x0a71('0x2b')][_0x0a71('0x2c')](_0x51ecc4,{'where':{'id':_0xb4637}})['then'](function(_0x495df6){updatedRows+=0x1;return db[_0x0a71('0x2d')][_0x0a71('0x2c')]({'phone':_0x51ecc4[_0x0a71('0x1c')]},{'where':{'ContactId':_0xb4637}})[_0x0a71('0x27')](function(_0x22e989){_0x3bc590({'ret':'OK'});});});});}function insertCmHopper(_0x285bdd,_0x6ed709,_0x14d986,_0x869a09,_0x29f456){var _0x9f523=[_0x0a71('0x2e'),_0x0a71('0x2f'),_0x0a71('0x30'),_0x0a71('0x31'),_0x6ed709+'.'+_0x869a09,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x0a71('0x32'),_0x0a71('0x33'),'\x22'+_0x29f456+'\x22'];return squel[_0x0a71('0x34')]()[_0x0a71('0x35')](_0x0a71('0x36'))[_0x0a71('0x37')](['phone','scheduledat','ContactId',_0x0a71('0x38'),_0x869a09,_0x0a71('0x39'),_0x0a71('0x3a'),'priority',_0x0a71('0x3b'),_0x0a71('0x3c')],squel[_0x0a71('0xf')]()['fields'](_0x9f523)[_0x0a71('0x11')](_0x6ed709)[_0x0a71('0x16')](_0x0a71('0x3d'),null,_0x0a71('0x3e')+_0x6ed709+_0x0a71('0x3f'))[_0x0a71('0x16')](_0x14d986,null,_0x14d986+_0x0a71('0x12')+_0x6ed709+'.'+_0x869a09)[_0x0a71('0x13')](_0x6ed709+_0x0a71('0x40'),_0x285bdd)[_0x0a71('0x13')](_0x0a71('0x41'),NOW)[_0x0a71('0x13')](_0x0a71('0x42'),selectNotIn(_0x6ed709,_0x14d986,_0x869a09,_0x0a71('0x36'),[_0x0a71('0x43'),_0x0a71('0x44')]))[_0x0a71('0x13')](_0x0a71('0x42'),selectNotIn(_0x6ed709,_0x14d986,_0x869a09,_0x0a71('0x36'),[_0x0a71('0x43')])))[_0x0a71('0x45')]();}function insertCmHopperBlack(_0x3c4591,_0x1d4dac,_0x33dd2a,_0x123b84){var _0x1c7dab=[_0x0a71('0x2e'),_0x0a71('0x30'),_0x0a71('0x31'),_0x1d4dac+'.'+_0x123b84,_0x0a71('0x46'),_0x0a71('0x47')];return squel[_0x0a71('0x34')]()[_0x0a71('0x35')]('cm_hopper_black')[_0x0a71('0x37')]([_0x0a71('0x1c'),'ContactId',_0x0a71('0x38'),_0x123b84,_0x0a71('0x39'),'updatedAt'],squel['select']()[_0x0a71('0x48')](_0x1c7dab)[_0x0a71('0x11')](_0x1d4dac)[_0x0a71('0x16')](_0x0a71('0x3d'),null,_0x0a71('0x3e')+_0x1d4dac+_0x0a71('0x3f'))[_0x0a71('0x16')](_0x33dd2a,null,_0x33dd2a+_0x0a71('0x12')+_0x1d4dac+'.'+_0x123b84)[_0x0a71('0x13')](_0x1d4dac+'.CmListId\x20=\x20?',_0x3c4591)[_0x0a71('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a71('0x10')](_0x0a71('0x1c'))['from']('cm_hopper_black')[_0x0a71('0x13')](_0x0a71('0x49'),_0x3c4591)[_0x0a71('0x13')](_0x123b84+_0x0a71('0x4a'),_0x1d4dac+'.'+_0x123b84)))[_0x0a71('0x45')]();}function insertCmHopperAdditionalPhones(_0x18af50){var _0x2739f4=[_0x0a71('0x4b'),'cm_contact_has_items.item',_0x0a71('0x4c'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0x0a71('0x34')]()[_0x0a71('0x35')](_0x0a71('0x4d'))[_0x0a71('0x37')]([_0x0a71('0x4e'),_0x0a71('0x1c'),'OrderBy',_0x0a71('0x39'),_0x0a71('0x3a')],squel[_0x0a71('0xf')]()[_0x0a71('0x48')](_0x2739f4)['from'](_0x0a71('0x36'))[_0x0a71('0x16')](_0x0a71('0x3d'),null,_0x0a71('0x4f'))['join'](_0x0a71('0x50'),null,_0x0a71('0x51'))[_0x0a71('0x13')](_0x0a71('0x52'),_0x18af50)['where'](_0x0a71('0x41'),NOW))[_0x0a71('0x45')]();}function insertCmContact(_0x16ae0,_0x28c4e6,_0x7140fe,_0x35010e){var _0x4a8ccd=_[_0x0a71('0x53')](_[_0x0a71('0x54')](_0x35010e),[_0x0a71('0x38'),'CompanyId','createdAt',_0x0a71('0x3a')]);return squel[_0x0a71('0x34')]()['into'](_0x0a71('0x3d'))['fromQuery'](_0x4a8ccd,squel[_0x0a71('0xf')]()[_0x0a71('0x48')](_0x4a8ccd)['from'](_0x28c4e6)[_0x0a71('0x13')]('('+_0x7140fe['join'](',')+_0x0a71('0x55'),squel[_0x0a71('0xf')]()['fields'](_0x7140fe)[_0x0a71('0x11')](_0x0a71('0x3d'))[_0x0a71('0x13')](_0x0a71('0x49'),_0x16ae0))[_0x0a71('0x13')]('id\x20IN\x20?',squel[_0x0a71('0xf')]()[_0x0a71('0x10')]('MIN(id)',_0x0a71('0x56'))['from'](_0x28c4e6)['group'](_0x7140fe['join'](','))))[_0x0a71('0x45')]();}function handleStop(){logger[_0x0a71('0x57')](_0x0a71('0x58'));stopped=!![];}function handleUncaughtException(_0x6342e2){logger[_0x0a71('0x21')](_0x6342e2['message']);process[_0x0a71('0x59')](0x1);}function handleError(_0x507107,_0x2ab9d5){stats[_0x0a71('0x5a')][_0x0a71('0x1e')]({'name':_0x2ab9d5[_0x0a71('0x5b')],'message':_0x2ab9d5[_0x0a71('0x22')],'row':_0x507107});}function handleQuery(_0x355228){logger[_0x0a71('0x57')](_0x355228);return db[_0x0a71('0x17')]['query'](_0x355228)[_0x0a71('0x1a')](function(_0x5d7363){results[_0x0a71('0x1e')](_0x5d7363);})[_0x0a71('0x20')](function(_0x5a6243){logger[_0x0a71('0x21')](_0x5a6243['message']);});}function main(_0x5d3f12,_0x275004,_0x1a17bf,_0x7c4915){logger[_0x0a71('0x57')](_0x0a71('0x5c'),_0x5d3f12,JSON['stringify'](_0x275004));process[_0x0a71('0x5d')](_0x0a71('0x5e'));var _0x3db77c=_0x275004['binding'];var _0x399205=_[_0x0a71('0x5f')](_0x3db77c);var _0x33e020=_0x275004['socket_timestamp'];var _0x5442d1=path[_0x0a71('0x16')](config[_0x0a71('0x60')],'server/files/tmp',_0x33e020+_0x0a71('0x61'));logger[_0x0a71('0x57')](_0x0a71('0x62'),_0x275004);db[_0x0a71('0x63')][_0x0a71('0x64')]({'raw':!![],'attributes':['id',_0x0a71('0x65')]})[_0x0a71('0x27')](function(_0x4cd95c){for(var _0x49d429=0x0;_0x49d429<_0x4cd95c[_0x0a71('0x24')];_0x49d429++){if(_0x4cd95c[_0x49d429][_0x0a71('0x65')]in _0x3db77c){contactItemTypes[_0x0a71('0x1e')](_0x4cd95c[_0x49d429]);delete _0x399205[_0x4cd95c[_0x49d429]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x399205['AdditionalPhones']='';var _0x123e99=_['keys'](_0x399205)[_0x0a71('0x16')]();logger['info'](_0x0a71('0x66'),_0x123e99);fs[_0x0a71('0x67')](_0x5442d1,_0x123e99+'\x0a');Papa[_0x0a71('0x68')](fs[_0x0a71('0x69')](_0x5d3f12),{'header':!![],'skipEmptyLines':!![],'step':function(_0x473172,_0x345a3e){try{for(var _0x26b263=0x0,_0x259527=[];_0x26b263<_0x473172[_0x0a71('0x6a')][_0x0a71('0x24')];_0x26b263++){stats[_0x0a71('0x6b')]+=0x1;if(_0x473172[_0x0a71('0x5a')][_0x26b263]){handleError(_0x473172[_0x0a71('0x6a')][_0x26b263],_0x473172[_0x0a71('0x5a')][_0x26b263]);}else{var _0x3a0448=[];var _0x12b31a=[];for(var _0xa5eb17 in _0x3db77c){let _0x46fa47=contactItemTypes[_0x0a71('0x6c')](_0x273fd1=>_0x273fd1[_0x0a71('0x65')]===_0xa5eb17);if(_[_0x0a71('0x1b')](_0x46fa47)){if(_0x3db77c[_0x0a71('0x6d')](_0xa5eb17)){if(_0x473172[_0x0a71('0x6a')][_0x26b263][_0x3db77c[_0xa5eb17]]){var _0x24348d=_[_0x0a71('0x6e')](_0x473172['data'][_0x26b263][_0x3db77c[_0xa5eb17]][_0x0a71('0x6f')](/"/g,'\x27'));switch(_0xa5eb17){case _0x0a71('0x70'):var _0x2062fb=moment(_0x24348d,_0x0a71('0x71'),!![]);if(_0x2062fb[_0x0a71('0x72')]()){_0x259527[_0x0a71('0x1e')]('\x22'+_0x24348d+'\x22');}else{_0x3a0448[_0x0a71('0x1e')](_0x0a71('0x73'));}break;case'priority':var _0x209808=parseInt(_0x24348d);_0x24348d=_['isNaN'](_0x209808)||_0x209808<0x0||_0x209808>0x4?_0x7c4915?0x3:0x2:_0x209808;_0x259527[_0x0a71('0x1e')]('\x22'+_0x24348d+'\x22');break;case _0x0a71('0x3b'):var _0x20e834=parseInt(_0x24348d);if(_['isNumber'](_0x20e834)&&_[_0x0a71('0x74')](_0x1a17bf,_0x20e834)){_0x259527[_0x0a71('0x1e')]('\x22'+_0x20e834+'\x22');}else{_0x3a0448[_0x0a71('0x1e')](_0x0a71('0x75'));}break;case _0x0a71('0x76'):if(isEmail(_0x24348d)){_0x259527[_0x0a71('0x1e')]('\x22'+_0x24348d+'\x22');}else{_0x3a0448[_0x0a71('0x1e')](_0x0a71('0x77'));}break;case _0x0a71('0x78'):var _0x4faed6=moment(_0x24348d,_0x0a71('0x79'),!![]);if(_0x4faed6[_0x0a71('0x72')]()){_0x259527[_0x0a71('0x1e')]('\x22'+_0x24348d+'\x22');}else{_0x3a0448[_0x0a71('0x1e')](_0x0a71('0x7a'));}break;default:_0x259527[_0x0a71('0x1e')]('\x22'+_0x24348d+'\x22');}}else{switch(_0xa5eb17){case _0x0a71('0x7b'):case _0x0a71('0x1c'):_0x3a0448[_0x0a71('0x1e')](_0xa5eb17+'\x20not\x20specified');break;default:_0x259527[_0x0a71('0x1e')]('\x22\x22');}}}}else{var _0x3c351c='';for(var _0x22d7d8=0x0;_0x22d7d8<_0x3db77c[_0xa5eb17]['length'];_0x22d7d8++){var _0x24348d=_[_0x0a71('0x6e')](_0x473172['data'][_0x26b263][_0x3db77c[_0xa5eb17][_0x22d7d8]][_0x0a71('0x6f')](/"/g,'\x27'));if(_0x3c351c=='')_0x3c351c=_0x24348d;else _0x3c351c+='|'+_0x24348d;}_0x12b31a['push'](_0x46fa47['id']+':'+_0x3c351c);}}if(hasAdditionalPhones){_0x259527[_0x0a71('0x1e')]('\x22'+_0x12b31a[_0x0a71('0x16')](';')+'\x22');}if(_0x3a0448[_0x0a71('0x24')]){handleError(_0x473172['data'][_0x26b263],{'code':_0x0a71('0x7c'),'message':_0x3a0448[_0x0a71('0x16')]()});}else{fs[_0x0a71('0x7d')](_0x5442d1,_0x259527[_0x0a71('0x16')]()+'\x0a');}_0x259527=[];}if(!(stats[_0x0a71('0x6b')]%0xc8)){socket[_0x0a71('0x7e')]('contact:import:'+_0x33e020,stats);stats[_0x0a71('0x5a')]=[];}}if(stopped){logger[_0x0a71('0x57')](_0x0a71('0x7f'));_0x345a3e['abort']();}}catch(_0x1206c8){handleError(_0x473172['data'][_0x26b263],{'code':_0x0a71('0x80'),'message':_0x1206c8[_0x0a71('0x22')]});logger['error'](_0x0a71('0x81'),_0x1206c8[_0x0a71('0x22')]);}},'complete':function(){try{var _0x2b1ff2=[];var _0x225519=tempTableName;_0x2b1ff2[_0x0a71('0x1e')](_0x0a71('0x82')+_0x225519+_0x0a71('0x83'));logger[_0x0a71('0x57')](_0x0a71('0x84'),contactItemTypes[_0x0a71('0x24')]);var _0x59ec33=util[_0x0a71('0xb')](_0x0a71('0x85'),_0x5442d1,_0x225519,_0x123e99,_0x275004[_0x0a71('0x38')],_0x275004[_0x0a71('0x86')]||null,NOW,NOW);if(_[_0x0a71('0x1b')](_0x3db77c[_0x0a71('0x70')])){_0x59ec33+=_0x0a71('0x87');}_0x2b1ff2[_0x0a71('0x1e')](_0x59ec33);BPromise[_0x0a71('0x88')](_0x2b1ff2,handleQuery)[_0x0a71('0x27')](function(_0x3ce3e0){BPromise[_0x0a71('0x1f')]([handleAdditionalPhones()])[_0x0a71('0x27')](function(){_0x2b1ff2=[];for(var _0x1aaad8=0x0;_0x1aaad8\x20\x20','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/logger','redis','defaults','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','query','select\x20*\x20from\x20','spread','isNil','AdditionalPhones','push','all','then','catch','error','message','split','length','filter','CmContactHasItem','findOne','update','updated','create','PHONE','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','toString','insert','cm_hopper_black','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','min_id','group','info','Received\x20SIGINT','exit','sequelize','stringify','send','start','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','header','writeFileSync','data','rows','errors','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','isNaN','UserId','includes','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','SystemRow','emit'];(function(_0x301831,_0x2af7c7){var _0x416dbe=function(_0x4f7ded){while(--_0x4f7ded){_0x301831['push'](_0x301831['shift']());}};_0x416dbe(++_0x2af7c7);}(_0x45bd,0xb5));var _0xd45b=function(_0x4a28b0,_0xfc2f61){_0x4a28b0=_0x4a28b0-0x0;var _0x5fe21=_0x45bd[_0x4a28b0];return _0x5fe21;};'use strict';var fs=require('fs');var path=require(_0xd45b('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0xd45b('0x1'));var BPromise=require(_0xd45b('0x2'));var moment=require(_0xd45b('0x3'));var squel=require('squel');var Redis=require(_0xd45b('0x4'));var db=require(_0xd45b('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0xd45b('0x6'))('import');config[_0xd45b('0x7')]=_[_0xd45b('0x8')](config[_0xd45b('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd45b('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xd45b('0x9')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xd45b('0xa')+moment()[_0xd45b('0x9')](_0xd45b('0xb'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x2d41b9){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))*$/[_0xd45b('0xc')](_0x2d41b9);}function selectNotIn(_0x21aa80,_0x2d3600,_0x553158,_0x558267,_0x36da4f){return squel[_0xd45b('0xd')]()[_0xd45b('0xe')](_0xd45b('0xf'))[_0xd45b('0x10')](_0x558267)[_0xd45b('0x11')](_0x2d3600,null,_0x2d3600+'.id\x20=\x20'+_0x558267+'.'+_0x553158)['where'](_0x558267+'.'+_0x553158+_0xd45b('0x12')+_0x21aa80+'.'+_0x553158)['where'](_0x2d3600+_0xd45b('0x13')+_0x36da4f[_0xd45b('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4bb69d,_0x17b90d){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0xd45b('0x14')](_0xd45b('0x15')+tempTableName)[_0xd45b('0x16')](function(_0x18a610){if(_0x18a610!==null){var _0x16e8fe=[];for(var _0x2158bf=0x0;_0x2158bf<_0x18a610['length'];_0x2158bf++){var _0x368f94=_0x18a610[_0x2158bf];if(!_['isNil'](_0x368f94['phone'])){if(!_[_0xd45b('0x17')](_0x368f94[_0xd45b('0x18')]))_0x16e8fe[_0xd45b('0x19')](insertAdditionalPhones(_0x368f94));promisesContact[_0xd45b('0x19')]({'contact':_0x368f94});}}}Promise[_0xd45b('0x1a')](_0x16e8fe)[_0xd45b('0x1b')](function(){_0x4bb69d({'val':0x1});});})[_0xd45b('0x1c')](function(_0x5cbf0e){logger[_0xd45b('0x1d')](_0x5cbf0e[_0xd45b('0x1e')]);});});}function insertAdditionalPhones(_0x468117){return new Promise(function(_0xe7b234,_0x5f07c7){var _0x143e0f=_0x468117[_0xd45b('0x18')];if(_['isNil'](_0x143e0f))_0x5f07c7({'val':0x0});else{var _0x213017=_0x143e0f[_0xd45b('0x1f')](';');var _0xfc6b6a=[];orderBy=0x0;for(var _0x434c0a=0x0;_0x434c0a<_0x213017['length'];_0x434c0a++){_0xfc6b6a['push'](splitAdditionalPhone(_0x468117['id'],_0x213017[_0x434c0a]));}Promise['all'](_0xfc6b6a)[_0xd45b('0x1b')](function(){_0xe7b234({'val':_0x213017[_0xd45b('0x20')]});});}});}function splitAdditionalPhone(_0x373f30,_0x8fb7b6){return new Promise(function(_0x17be3a,_0x102222){var _0x312548=_0x8fb7b6['split'](':');var _0x168f5d=_0x312548[0x0];var _0x2c7b0d=_0x312548[0x1];if(_0x2c7b0d!==''){var _0x18cf94=_0x2c7b0d[_0xd45b('0x1f')]('|');var _0x5c81ad=[];for(var _0x364871=0x0;_0x364871<_0x18cf94[_0xd45b('0x20')];_0x364871++){if(_0x18cf94[_0x364871]!==''){var _0x10a962=_[_0xd45b('0x21')](promisesAdditionalPhones,{'contactId':_0x373f30,'phone':_0x18cf94[_0x364871]});if(_0x10a962['length']==0x0){orderBy++;promisesAdditionalPhones[_0xd45b('0x19')]({'contactId':_0x373f30,'contactTypeId':_0x168f5d,'phone':_0x18cf94[_0x364871],'orderBy':orderBy});}}}_0x17be3a({'ok':0x1});}else _0x17be3a({'res':0x0});});}function createAdditionalPhone(_0x3e9a84,_0x2d6cbe,_0x27e77e,_0x380c62){return new Promise(function(_0x523982,_0x473e4e){return db[_0xd45b('0x22')][_0xd45b('0x23')]({'where':{'CmContactId':_0x3e9a84,'item':_0x27e77e}})[_0xd45b('0x1b')](function(_0x1033d9){if(_0x1033d9){return db[_0xd45b('0x22')][_0xd45b('0x24')]({'ItemTypeId':_0x2d6cbe,'OrderBy':_0x380c62},{'where':{'CmContactId':_0x3e9a84,'item':_0x27e77e}})[_0xd45b('0x1b')](function(_0x424405){_0x523982({'res':_0xd45b('0x25')});});}else{return db['CmContactHasItem'][_0xd45b('0x26')]({'CmContactId':_0x3e9a84,'item':_0x27e77e,'ItemTypeId':_0x2d6cbe,'OrderBy':_0x380c62,'ItemClass':_0xd45b('0x27')})[_0xd45b('0x1b')](function(_0x1969e2){_0x523982({'res':'inserted'});});}});});}function updateContact(_0x2a1aff){return new Promise(function(_0xb9ec4b,_0x4af44e){var _0x4d4034=_0x2a1aff['id'];delete _0x2a1aff['id'];return db['CmContact'][_0xd45b('0x24')](_0x2a1aff,{'where':{'id':_0x4d4034}})[_0xd45b('0x1b')](function(_0x4f66af){updatedRows+=0x1;return db[_0xd45b('0x28')][_0xd45b('0x24')]({'phone':_0x2a1aff[_0xd45b('0xf')]},{'where':{'ContactId':_0x4d4034}})[_0xd45b('0x1b')](function(_0x5b7156){_0xb9ec4b({'ret':'OK'});});});});}function insertCmHopper(_0x3f410c,_0x178991,_0x399eef,_0x4ea734,_0x579c67){var _0x4aee8f=[_0xd45b('0x29'),_0xd45b('0x2a'),_0xd45b('0x2b'),_0xd45b('0x2c'),_0x178991+'.'+_0x4ea734,_0xd45b('0x2d'),_0xd45b('0x2e'),_0xd45b('0x2f'),_0xd45b('0x30'),'\x22'+_0x579c67+'\x22'];return squel['insert']()[_0xd45b('0x31')](_0xd45b('0x32'))[_0xd45b('0x33')]([_0xd45b('0xf'),_0xd45b('0x34'),_0xd45b('0x35'),_0xd45b('0x36'),_0x4ea734,_0xd45b('0x37'),_0xd45b('0x38'),_0xd45b('0x39'),'UserId',_0xd45b('0x3a')],squel[_0xd45b('0xd')]()[_0xd45b('0x3b')](_0x4aee8f)[_0xd45b('0x10')](_0x178991)['join'](_0xd45b('0x3c'),null,_0xd45b('0x3d')+_0x178991+_0xd45b('0x3e'))['join'](_0x399eef,null,_0x399eef+_0xd45b('0x3f')+_0x178991+'.'+_0x4ea734)[_0xd45b('0x40')](_0x178991+_0xd45b('0x41'),_0x3f410c)[_0xd45b('0x40')](_0xd45b('0x42'),NOW)[_0xd45b('0x40')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x178991,_0x399eef,_0x4ea734,'cm_hopper',[_0xd45b('0x43'),_0xd45b('0x44')]))[_0xd45b('0x40')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x178991,_0x399eef,_0x4ea734,'cm_hopper',[_0xd45b('0x43')])))[_0xd45b('0x45')]();}function insertCmHopperBlack(_0x29b9e5,_0x2647b9,_0x3cdb68,_0x4d29e8){var _0x44d8fa=[_0xd45b('0x29'),_0xd45b('0x2b'),_0xd45b('0x2c'),_0x2647b9+'.'+_0x4d29e8,_0xd45b('0x2d'),'cm_contacts.updatedAt'];return squel[_0xd45b('0x46')]()[_0xd45b('0x31')](_0xd45b('0x47'))['fromQuery']([_0xd45b('0xf'),_0xd45b('0x35'),'ListId',_0x4d29e8,_0xd45b('0x37'),_0xd45b('0x38')],squel['select']()[_0xd45b('0x3b')](_0x44d8fa)['from'](_0x2647b9)['join']('cm_contacts',null,_0xd45b('0x3d')+_0x2647b9+_0xd45b('0x3e'))[_0xd45b('0x11')](_0x3cdb68,null,_0x3cdb68+_0xd45b('0x3f')+_0x2647b9+'.'+_0x4d29e8)['where'](_0x2647b9+'.CmListId\x20=\x20?',_0x29b9e5)[_0xd45b('0x40')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xd45b('0x40')](_0xd45b('0x48'),squel[_0xd45b('0xd')]()[_0xd45b('0xe')](_0xd45b('0xf'))['from'](_0xd45b('0x47'))[_0xd45b('0x40')]('ListId\x20=\x20?',_0x29b9e5)[_0xd45b('0x40')](_0x4d29e8+_0xd45b('0x49'),_0x2647b9+'.'+_0x4d29e8)))['toString']();}function insertCmHopperAdditionalPhones(_0x15eeed){var _0x49b65c=[_0xd45b('0x4a'),_0xd45b('0x4b'),'cm_contact_has_items.OrderBy',_0xd45b('0x4c'),_0xd45b('0x4d')];return squel[_0xd45b('0x46')]()[_0xd45b('0x31')](_0xd45b('0x4e'))[_0xd45b('0x33')](['CmHopperId',_0xd45b('0xf'),_0xd45b('0x4f'),_0xd45b('0x37'),_0xd45b('0x38')],squel[_0xd45b('0xd')]()[_0xd45b('0x3b')](_0x49b65c)['from']('cm_hopper')[_0xd45b('0x11')](_0xd45b('0x3c'),null,_0xd45b('0x50'))[_0xd45b('0x11')]('cm_contact_has_items',null,_0xd45b('0x51'))[_0xd45b('0x40')](_0xd45b('0x52'),_0x15eeed)[_0xd45b('0x40')](_0xd45b('0x42'),NOW))[_0xd45b('0x45')]();}function insertCmContact(_0x2959d1,_0x1aafc2,_0xe2f64e,_0x3fc95f){var _0x5110f0=_[_0xd45b('0x53')](_[_0xd45b('0x54')](_0x3fc95f),[_0xd45b('0x36'),_0xd45b('0x55'),_0xd45b('0x37'),_0xd45b('0x38')]);return squel[_0xd45b('0x46')]()['into'](_0xd45b('0x3c'))[_0xd45b('0x33')](_0x5110f0,squel[_0xd45b('0xd')]()[_0xd45b('0x3b')](_0x5110f0)[_0xd45b('0x10')](_0x1aafc2)['where']('('+_0xe2f64e[_0xd45b('0x11')](',')+_0xd45b('0x56'),squel['select']()[_0xd45b('0x3b')](_0xe2f64e)[_0xd45b('0x10')](_0xd45b('0x3c'))[_0xd45b('0x40')](_0xd45b('0x57'),_0x2959d1))[_0xd45b('0x40')]('id\x20IN\x20?',squel[_0xd45b('0xd')]()[_0xd45b('0xe')]('MIN(id)',_0xd45b('0x58'))[_0xd45b('0x10')](_0x1aafc2)[_0xd45b('0x59')](_0xe2f64e[_0xd45b('0x11')](','))))[_0xd45b('0x45')]();}function handleStop(){logger[_0xd45b('0x5a')](_0xd45b('0x5b'));stopped=!![];}function handleUncaughtException(_0x3f947d){logger[_0xd45b('0x1d')](_0x3f947d[_0xd45b('0x1e')]);process[_0xd45b('0x5c')](0x1);}function handleError(_0x577f7a,_0x4cd651){stats['errors'][_0xd45b('0x19')]({'name':_0x4cd651['code'],'message':_0x4cd651['message'],'row':_0x577f7a});}function handleQuery(_0x5175c3){logger[_0xd45b('0x5a')](_0x5175c3);return db[_0xd45b('0x5d')][_0xd45b('0x14')](_0x5175c3)[_0xd45b('0x16')](function(_0x13ba52){results['push'](_0x13ba52);})['catch'](function(_0x3a5864){logger[_0xd45b('0x1d')](_0x3a5864[_0xd45b('0x1e')]);});}function main(_0xc83421,_0xb6a893,_0x25a8f5,_0xc812cf){logger[_0xd45b('0x5a')]('main',_0xc83421,JSON[_0xd45b('0x5e')](_0xb6a893));process[_0xd45b('0x5f')](_0xd45b('0x60'));var _0x4ab136=_0xb6a893['binding'];var _0x87f497=_[_0xd45b('0x61')](_0x4ab136);var _0x218d74=_0xb6a893[_0xd45b('0x62')];var _0x54ae40=path[_0xd45b('0x11')](config[_0xd45b('0x63')],_0xd45b('0x64'),_0x218d74+_0xd45b('0x65'));logger[_0xd45b('0x5a')](_0xd45b('0x66'),_0xb6a893);db[_0xd45b('0x67')][_0xd45b('0x68')]({'raw':!![],'attributes':['id','name']})[_0xd45b('0x1b')](function(_0x58d7d1){for(var _0x45218e=0x0;_0x45218e<_0x58d7d1['length'];_0x45218e++){if(_0x58d7d1[_0x45218e][_0xd45b('0x69')]in _0x4ab136){contactItemTypes['push'](_0x58d7d1[_0x45218e]);delete _0x87f497[_0x58d7d1[_0x45218e][_0xd45b('0x69')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x87f497['AdditionalPhones']='';var _0x3d4b39=_[_0xd45b('0x54')](_0x87f497)[_0xd45b('0x11')]();logger['info'](_0xd45b('0x6a'),_0x3d4b39);fs[_0xd45b('0x6b')](_0x54ae40,_0x3d4b39+'\x0a');Papa['parse'](fs['createReadStream'](_0xc83421),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1df1d7,_0x1b2c6c){try{for(var _0x26ef01=0x0,_0x4efd79=[];_0x26ef01<_0x1df1d7[_0xd45b('0x6c')][_0xd45b('0x20')];_0x26ef01++){stats[_0xd45b('0x6d')]+=0x1;if(_0x1df1d7[_0xd45b('0x6e')][_0x26ef01]){handleError(_0x1df1d7['data'][_0x26ef01],_0x1df1d7[_0xd45b('0x6e')][_0x26ef01]);}else{var _0x3364bf=[];var _0x156004=[];for(var _0x59e0bf in _0x4ab136){let _0x194508=contactItemTypes['find'](_0x2bef02=>_0x2bef02[_0xd45b('0x69')]===_0x59e0bf);if(_['isNil'](_0x194508)){if(_0x4ab136[_0xd45b('0x6f')](_0x59e0bf)){if(_0x1df1d7['data'][_0x26ef01][_0x4ab136[_0x59e0bf]]){var _0x3c6120=_[_0xd45b('0x70')](_0x1df1d7[_0xd45b('0x6c')][_0x26ef01][_0x4ab136[_0x59e0bf]][_0xd45b('0x71')](/"/g,'\x27'));switch(_0x59e0bf){case'scheduledat':var _0x24a6b4=moment(_0x3c6120,_0xd45b('0x72'),!![]);if(_0x24a6b4[_0xd45b('0x73')]()){_0x4efd79[_0xd45b('0x19')]('\x22'+_0x3c6120+'\x22');}else{_0x3364bf[_0xd45b('0x19')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x362552=parseInt(_0x3c6120);_0x3c6120=_[_0xd45b('0x74')](_0x362552)||_0x362552<0x0||_0x362552>0x4?_0xc812cf?0x3:0x2:_0x362552;_0x4efd79['push']('\x22'+_0x3c6120+'\x22');break;case _0xd45b('0x75'):var _0x3e403a=parseInt(_0x3c6120);if(_['isNumber'](_0x3e403a)&&_[_0xd45b('0x76')](_0x25a8f5,_0x3e403a)){_0x4efd79[_0xd45b('0x19')]('\x22'+_0x3e403a+'\x22');}else{_0x3364bf['push']('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x3c6120)){_0x4efd79[_0xd45b('0x19')]('\x22'+_0x3c6120+'\x22');}else{_0x3364bf['push'](_0xd45b('0x77'));}break;case _0xd45b('0x78'):var _0x2b8347=moment(_0x3c6120,_0xd45b('0x79'),!![]);if(_0x2b8347[_0xd45b('0x73')]()){_0x4efd79[_0xd45b('0x19')]('\x22'+_0x3c6120+'\x22');}else{_0x3364bf[_0xd45b('0x19')](_0xd45b('0x7a'));}break;default:_0x4efd79[_0xd45b('0x19')]('\x22'+_0x3c6120+'\x22');}}else{switch(_0x59e0bf){case'firstName':case _0xd45b('0xf'):_0x3364bf[_0xd45b('0x19')](_0x59e0bf+'\x20not\x20specified');break;default:_0x4efd79[_0xd45b('0x19')]('\x22\x22');}}}}else{var _0x32b9d6='';for(var _0x1dd35a=0x0;_0x1dd35a<_0x4ab136[_0x59e0bf][_0xd45b('0x20')];_0x1dd35a++){var _0x3c6120=_[_0xd45b('0x70')](_0x1df1d7[_0xd45b('0x6c')][_0x26ef01][_0x4ab136[_0x59e0bf][_0x1dd35a]][_0xd45b('0x71')](/"/g,'\x27'));if(_0x32b9d6=='')_0x32b9d6=_0x3c6120;else _0x32b9d6+='|'+_0x3c6120;}_0x156004[_0xd45b('0x19')](_0x194508['id']+':'+_0x32b9d6);}}if(hasAdditionalPhones){_0x4efd79[_0xd45b('0x19')]('\x22'+_0x156004[_0xd45b('0x11')](';')+'\x22');}if(_0x3364bf[_0xd45b('0x20')]){handleError(_0x1df1d7[_0xd45b('0x6c')][_0x26ef01],{'code':_0xd45b('0x7b'),'message':_0x3364bf[_0xd45b('0x11')]()});}else{fs['appendFileSync'](_0x54ae40,_0x4efd79[_0xd45b('0x11')]()+'\x0a');}_0x4efd79=[];}if(!(stats[_0xd45b('0x6d')]%0xc8)){socket[_0xd45b('0x7c')](_0xd45b('0x7d')+_0x218d74,stats);stats[_0xd45b('0x6e')]=[];}}if(stopped){logger[_0xd45b('0x5a')](_0xd45b('0x7e'));_0x1b2c6c[_0xd45b('0x7f')]();}}catch(_0x5bbe99){handleError(_0x1df1d7[_0xd45b('0x6c')][_0x26ef01],{'code':_0xd45b('0x80'),'message':_0x5bbe99[_0xd45b('0x1e')]});logger[_0xd45b('0x1d')](_0xd45b('0x81'),_0x5bbe99['message']);}},'complete':function(){try{var _0x7a1e40=[];var _0xc3e77d=tempTableName;_0x7a1e40[_0xd45b('0x19')](_0xd45b('0x82')+_0xc3e77d+_0xd45b('0x83'));logger[_0xd45b('0x5a')](_0xd45b('0x84'),contactItemTypes[_0xd45b('0x20')]);var _0x6bee5=util[_0xd45b('0x9')](_0xd45b('0x85'),_0x54ae40,_0xc3e77d,_0x3d4b39,_0xb6a893[_0xd45b('0x36')],_0xb6a893[_0xd45b('0x55')]||null,NOW,NOW);if(_[_0xd45b('0x17')](_0x4ab136[_0xd45b('0x34')])){_0x6bee5+=_0xd45b('0x86');}_0x7a1e40[_0xd45b('0x19')](_0x6bee5);BPromise[_0xd45b('0x87')](_0x7a1e40,handleQuery)[_0xd45b('0x1b')](function(_0x375df7){BPromise[_0xd45b('0x1a')]([handleAdditionalPhones()])['then'](function(){_0x7a1e40=[];for(var _0x54fb4d=0x0;_0x54fb4d=_0x4ebad5){return _0x385957[_0xf01c('0xf')](0x193)[_0xf01c('0x10')]({'message':util[_0xf01c('0x11')](_0xf01c('0x12'),_0x2c6dd6)});}_0x4cf73a();})[_0xf01c('0x13')](function(_0xca0039){_0x4cf73a(_0xca0039);});});}function isUserLimit(){return isLimit(_0xf01c('0x14'),0x1,db['User'],{'where':{'$or':[{'role':_0xf01c('0x15')},{'role':_0xf01c('0x16')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x71b1=['base64','utf8','final','parse','use','License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','crypto','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x71b1,0x154));var _0x171b=function(_0xac68c8,_0x263953){_0xac68c8=_0xac68c8-0x0;var _0x5721cb=_0x71b1[_0xac68c8];return _0x5721cb;};'use strict';var crypto=require(_0x171b('0x0'));var util=require(_0x171b('0x1'));var compose=require('composable-middleware');var db=require(_0x171b('0x2'))['db'];var config=require(_0x171b('0x3'));function getValueFromLicense(_0x356261,_0x3c60d1){if(_0x356261&&_0x3c60d1){if(_0x3c60d1[_0x171b('0x4')]&&_0x3c60d1[_0x171b('0x5')]){var _0x291c09=_0x3c60d1[_0x171b('0x4')];var _0x270dd8=_0x3c60d1[_0x171b('0x5')];var _0xbe7c19=_0x291c09[_0x171b('0x6')]('-')[0x4];var _0x9dee18=_0x291c09[_0x171b('0x6')]('-')[0x0];var _0x257f35=crypto[_0x171b('0x7')](_0x171b('0x8'),util[_0x171b('0x9')]('%s:%s:%s',_0xbe7c19,_0x291c09,_0x9dee18));var _0x2ea79d=_0x257f35[_0x171b('0xa')](_0x270dd8,_0x171b('0xb'),_0x171b('0xc'));_0x2ea79d+=_0x257f35[_0x171b('0xd')](_0x171b('0xc'));var _0x2c9219=JSON[_0x171b('0xe')](_0x2ea79d);return _0x2c9219['hasOwnProperty'](_0x356261)?_0x2c9219[_0x356261]:null;}}return null;}function isLimit(_0x3717d9,_0x865b54,_0x1d8d86,_0x166ff5){var _0x4014b3=_0x865b54;return compose()[_0x171b('0xf')](function(_0x2d3aeb,_0x79ef60,_0xe4a24f){return db[_0x171b('0x10')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x171b('0x11')](function(_0x45823b){var _0x4c7384=getValueFromLicense(_0x3717d9,_0x45823b);return _0x4c7384?_0x4c7384:_0x4014b3;})[_0x171b('0x11')](function(_0x1073f8){_0x4014b3=_0x1073f8;return _0x1d8d86[_0x171b('0x12')](_0x166ff5);})['then'](function(_0x3bee7f){if(_0x3bee7f>=_0x4014b3){return _0x79ef60[_0x171b('0x13')](0x193)[_0x171b('0x14')]({'message':util[_0x171b('0x9')](_0x171b('0x15'),_0x3717d9)});}_0xe4a24f();})[_0x171b('0x16')](function(_0x1e0771){_0xe4a24f(_0x1e0771);});});}function isUserLimit(){return isLimit(_0x171b('0x17'),0x1,db[_0x171b('0x18')],{'where':{'$or':[{'role':_0x171b('0x19')},{'role':_0x171b('0x1a')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index b377a45..bc026ae 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 _0x188b=['[$and]','[$or]','split','length','slice','forEach','shift','indexOf','map','push','buildExpression','DATE','operator','$eq','value','$gt','$lte','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','$between','utcOffset','add','hours','seconds','moment','parseSearch','sqlOperator','startsWith','and','replace'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x188b,0xa2));var _0xb188=function(_0x55a50c,_0x5dad80){_0x55a50c=_0x55a50c-0x0;var _0x16eb7c=_0x188b[_0x55a50c];return _0x16eb7c;};'use strict';var _=require('lodash');var moment=require(_0xb188('0x0'));exports[_0xb188('0x1')]=function(_0x455ce2){var _0x140906={'conditions':[]};_0x140906[_0xb188('0x2')]=_[_0xb188('0x3')](_0x455ce2,'[$or]')?'or':_0xb188('0x4');var _0x35bb14=_0x455ce2[_0xb188('0x5')](_0xb188('0x6'),'')['replace'](_0xb188('0x7'),'')[_0xb188('0x8')]('||');for(var _0x56b3b4=0x0;_0x56b3b4<_0x35bb14[_0xb188('0x9')];_0x56b3b4++){var _0x4f5348=_0x35bb14[_0x56b3b4][_0xb188('0x8')](':=');var _0x2f8cb5=_0x4f5348[0x0];var _0x5025f3=_0x4f5348[_0xb188('0xa')](0x1);_0x5025f3[_0xb188('0xb')](function(_0x50f971){var _0x4c67ab=_0x50f971['split']('[')[_0xb188('0xc')]();var _0x50c7dc=_0x50f971['match'](/\[(.*?)\]/g);_0x50c7dc[_0xb188('0xb')](function(_0x2fc59e){var _0x3ca4fd=_0x2fc59e[_0xb188('0x8')]('[')['filter'](function(_0x3881ef){return _0x3881ef[_0xb188('0xd')](']')>-0x1;})[_0xb188('0xe')](function(_0x1cfcc2){return _0x1cfcc2[_0xb188('0x8')](']')[0x0];})[0x0];_0x140906['conditions'][_0xb188('0xf')]({'field':_0x2f8cb5,'operator':_0x4c67ab,'value':_0x3ca4fd});});});}return _0x140906;};exports[_0xb188('0x10')]=function(_0x410084,_0x3eaec9,_0x545bab){var _0x786b6d={};if(_0x3eaec9===_0xb188('0x11')){if(_0x545bab[_0xb188('0x12')]===_0xb188('0x13')){_0x545bab['operator']='$between';_0x545bab[_0xb188('0x14')]+=','+_0x545bab['value'];}else if(_['includes']([_0xb188('0x15'),_0xb188('0x16')],_0x545bab[_0xb188('0x12')])){_0x545bab[_0xb188('0x14')]=moment(_0x545bab[_0xb188('0x14')])['add'](0x1,_0xb188('0x17'))[_0xb188('0x18')](_0xb188('0x19'));}}if(_0x545bab[_0xb188('0x1a')]){_0x3eaec9=_0x545bab[_0xb188('0x1a')];_0x786b6d[_0xb188('0x1b')]=_0xb188('0x1c')+_0x410084+'.'+_0x545bab[_0xb188('0x1d')]+_0xb188('0x1e')+_0x545bab[_0xb188('0x1a')]+')\x20'+parseOperator(_0x545bab[_0xb188('0x12')]);}else{_0x786b6d[_0xb188('0x1b')]=_0x410084+'.'+_0x545bab[_0xb188('0x1d')]+'\x20'+parseOperator(_0x545bab['operator']);}if(_[_0xb188('0x1f')]([_0xb188('0x20'),_0xb188('0x21')],_0x545bab[_0xb188('0x12')]))_0x786b6d[_0xb188('0x1b')]='('+_0x786b6d['text']+'\x20OR\x20'+_0x410084+'.'+_0x545bab[_0xb188('0x1d')]+_0xb188('0x22');_0x786b6d[_0xb188('0x14')]=parseValue(_0x3eaec9,_0x545bab[_0xb188('0x12')],_0x545bab[_0xb188('0x14')]);return _0x786b6d;};function parseOperator(_0x26eaff){var _0x1c12c2;switch(_0x26eaff){case _0xb188('0x23'):_0x1c12c2=_0xb188('0x24');break;case _0xb188('0x21'):_0x1c12c2=_0xb188('0x25');break;case _0xb188('0x13'):_0x1c12c2='=\x20?';break;case _0xb188('0x20'):_0x1c12c2=_0xb188('0x26');break;case _0xb188('0x27'):case _0xb188('0x28'):case'$endsWith':_0x1c12c2=_0xb188('0x29');break;case _0xb188('0x2a'):_0x1c12c2=_0xb188('0x2b');break;case _0xb188('0x15'):_0x1c12c2=_0xb188('0x2c');break;case'$lte':_0x1c12c2=_0xb188('0x2d');break;case _0xb188('0x2e'):_0x1c12c2=_0xb188('0x2f');break;case'$between':_0x1c12c2=_0xb188('0x30');break;}return _0x1c12c2;}function parseValue(_0x218f92,_0x36530d,_0x2f709b){var _0x111f3e={'start':undefined,'end':undefined};switch(_0x36530d){case _0xb188('0x23'):case'$notIn':_0x111f3e[_0xb188('0x31')]=_0x2f709b[_0xb188('0x8')](',');break;case _0xb188('0x27'):_0x111f3e[_0xb188('0x31')]='%'+_0x2f709b+'%';break;case _0xb188('0x28'):_0x111f3e[_0xb188('0x31')]=_0x2f709b+'%';break;case _0xb188('0x32'):_0x111f3e[_0xb188('0x31')]='%'+_0x2f709b;break;case _0xb188('0x33'):var _0x11909d=_0x2f709b[_0xb188('0x8')](',');var _0x2f709b=_0x11909d['shift']();var _0x2f828f=_0x11909d['pop']();if(_0x218f92===_0xb188('0x11')){_0x2f709b=moment(_0x2f709b)['utcOffset'](0x0,!![])[_0xb188('0x18')]();_0x2f828f=moment(_0x2f828f)[_0xb188('0x34')](0x0,!![])[_0xb188('0x35')](0x17,_0xb188('0x36'))[_0xb188('0x35')](0x3b,'minutes')[_0xb188('0x35')](0x3b,_0xb188('0x37'))[_0xb188('0x18')]();}_0x111f3e={'start':_0x2f709b,'end':_0x2f828f};break;default:_0x111f3e[_0xb188('0x31')]=_0x2f709b;break;}return _0x111f3e;} \ No newline at end of file +var _0xaef4=['castTo','field','text','$ne','$in','IN\x20?','$notIn','$eq','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$gt','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','split','forEach','shift','match','filter','indexOf','conditions','push','operator','$between','value','includes','$lte','add','days','format','YYYY-MM-DD'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0xaef4,0x158));var _0x4aef=function(_0x350fd2,_0x46c2ee){_0x350fd2=_0x350fd2-0x0;var _0xa5ea08=_0xaef4[_0x350fd2];return _0xa5ea08;};'use strict';var _=require('lodash');var moment=require(_0x4aef('0x0'));exports[_0x4aef('0x1')]=function(_0x5de1c0){var _0xdeab16={'conditions':[]};_0xdeab16[_0x4aef('0x2')]=_[_0x4aef('0x3')](_0x5de1c0,_0x4aef('0x4'))?'or':_0x4aef('0x5');var _0x5b9c70=_0x5de1c0[_0x4aef('0x6')]('[$and]','')['replace'](_0x4aef('0x4'),'')['split']('||');for(var _0x2747e6=0x0;_0x2747e6<_0x5b9c70['length'];_0x2747e6++){var _0x3a1af2=_0x5b9c70[_0x2747e6][_0x4aef('0x7')](':=');var _0x30586e=_0x3a1af2[0x0];var _0x19e60c=_0x3a1af2['slice'](0x1);_0x19e60c[_0x4aef('0x8')](function(_0x20b322){var _0x394f88=_0x20b322[_0x4aef('0x7')]('[')[_0x4aef('0x9')]();var _0x409d81=_0x20b322[_0x4aef('0xa')](/\[(.*?)\]/g);_0x409d81[_0x4aef('0x8')](function(_0x11d4d0){var _0x411fa3=_0x11d4d0[_0x4aef('0x7')]('[')[_0x4aef('0xb')](function(_0x4de4b2){return _0x4de4b2[_0x4aef('0xc')](']')>-0x1;})['map'](function(_0x4e22ba){return _0x4e22ba[_0x4aef('0x7')](']')[0x0];})[0x0];_0xdeab16[_0x4aef('0xd')][_0x4aef('0xe')]({'field':_0x30586e,'operator':_0x394f88,'value':_0x411fa3});});});}return _0xdeab16;};exports['buildExpression']=function(_0xdb235f,_0x2a2b94,_0x2f3d8f){var _0x58281e={};if(_0x2a2b94==='DATE'){if(_0x2f3d8f[_0x4aef('0xf')]==='$eq'){_0x2f3d8f[_0x4aef('0xf')]=_0x4aef('0x10');_0x2f3d8f['value']+=','+_0x2f3d8f[_0x4aef('0x11')];}else if(_[_0x4aef('0x12')](['$gt',_0x4aef('0x13')],_0x2f3d8f[_0x4aef('0xf')])){_0x2f3d8f['value']=moment(_0x2f3d8f[_0x4aef('0x11')])[_0x4aef('0x14')](0x1,_0x4aef('0x15'))[_0x4aef('0x16')](_0x4aef('0x17'));}}if(_0x2f3d8f[_0x4aef('0x18')]){_0x2a2b94=_0x2f3d8f[_0x4aef('0x18')];_0x58281e['text']='CAST('+_0xdb235f+'.'+_0x2f3d8f[_0x4aef('0x19')]+'\x20AS\x20'+_0x2f3d8f[_0x4aef('0x18')]+')\x20'+parseOperator(_0x2f3d8f[_0x4aef('0xf')]);}else{_0x58281e[_0x4aef('0x1a')]=_0xdb235f+'.'+_0x2f3d8f[_0x4aef('0x19')]+'\x20'+parseOperator(_0x2f3d8f[_0x4aef('0xf')]);}if(_[_0x4aef('0x12')]([_0x4aef('0x1b'),'$notIn'],_0x2f3d8f[_0x4aef('0xf')]))_0x58281e[_0x4aef('0x1a')]='('+_0x58281e['text']+'\x20OR\x20'+_0xdb235f+'.'+_0x2f3d8f[_0x4aef('0x19')]+'\x20IS\x20NULL)';_0x58281e[_0x4aef('0x11')]=parseValue(_0x2a2b94,_0x2f3d8f['operator'],_0x2f3d8f[_0x4aef('0x11')]);return _0x58281e;};function parseOperator(_0x105e40){var _0x29116e;switch(_0x105e40){case _0x4aef('0x1c'):_0x29116e=_0x4aef('0x1d');break;case _0x4aef('0x1e'):_0x29116e='NOT\x20IN\x20?';break;case _0x4aef('0x1f'):_0x29116e=_0x4aef('0x20');break;case _0x4aef('0x1b'):_0x29116e='<>\x20?';break;case _0x4aef('0x21'):case _0x4aef('0x22'):case _0x4aef('0x23'):_0x29116e=_0x4aef('0x24');break;case'$lt':_0x29116e='<\x20?';break;case _0x4aef('0x25'):_0x29116e='>\x20?';break;case _0x4aef('0x13'):_0x29116e=_0x4aef('0x26');break;case'$gte':_0x29116e=_0x4aef('0x27');break;case'$between':_0x29116e=_0x4aef('0x28');break;}return _0x29116e;}function parseValue(_0x56ed4f,_0x101701,_0x3ad595){var _0x4039e7={'start':undefined,'end':undefined};switch(_0x101701){case _0x4aef('0x1c'):case _0x4aef('0x1e'):_0x4039e7[_0x4aef('0x29')]=_0x3ad595[_0x4aef('0x7')](',');break;case _0x4aef('0x21'):_0x4039e7['start']='%'+_0x3ad595+'%';break;case _0x4aef('0x22'):_0x4039e7[_0x4aef('0x29')]=_0x3ad595+'%';break;case _0x4aef('0x23'):_0x4039e7[_0x4aef('0x29')]='%'+_0x3ad595;break;case'$between':var _0x531b1a=_0x3ad595['split'](',');var _0x3ad595=_0x531b1a[_0x4aef('0x9')]();var _0x51be3c=_0x531b1a[_0x4aef('0x2a')]();if(_0x56ed4f===_0x4aef('0x2b')){_0x3ad595=moment(_0x3ad595)[_0x4aef('0x2c')](0x0,!![])['format']();_0x51be3c=moment(_0x51be3c)['utcOffset'](0x0,!![])[_0x4aef('0x14')](0x17,'hours')[_0x4aef('0x14')](0x3b,'minutes')['add'](0x3b,_0x4aef('0x2d'))[_0x4aef('0x16')]();}_0x4039e7={'start':_0x3ad595,'end':_0x51be3c};break;default:_0x4039e7['start']=_0x3ad595;break;}return _0x4039e7;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 448729b..2fcbc81 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 _0xf0c4=['ASC','omit','length','isObject','isString','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach','replace','push','join','lodash','sequelize','moment','fields','split','filters','isEmpty','forOwn','find','DATE','$gte','format','YYYY-MM-DD','utc','$lte','subtract','parse','isArray','offset','sort','indexOf','cast','col','unsigned','substr','DESC','priority'];(function(_0x36c6a0,_0x54f983){var _0x12f848=function(_0x5b8b8b){while(--_0x5b8b8b){_0x36c6a0['push'](_0x36c6a0['shift']());}};_0x12f848(++_0x54f983);}(_0xf0c4,0x89));var _0x4f0c=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0xf0c4[_0x45346d];return _0x5ce7ca;};'use strict';var _=require(_0x4f0c('0x0'));var sequelize=require(_0x4f0c('0x1'));var moment=require(_0x4f0c('0x2'));var LIMIT_VALUE=0xfa;exports[_0x4f0c('0x3')]=function(_0x33f545){var _0x1ca584=null;if(_0x33f545){_0x1ca584=_0x33f545[_0x4f0c('0x4')](',');}return _0x1ca584;};exports[_0x4f0c('0x5')]=function(_0xbe9ba4,_0x3fb9da){var _0x956e4d={};if(!_[_0x4f0c('0x6')](_0xbe9ba4)){_[_0x4f0c('0x7')](_0xbe9ba4,function(_0x2ee7d4,_0x4eabb4){try{if(_0x3fb9da){var _0xcf5235=_[_0x4f0c('0x8')](_0x3fb9da,{'name':_0x4eabb4})||{};if(_0xcf5235['type']===_0x4f0c('0x9')&&_['isPlainObject'](_0x2ee7d4)){var _0x4a6a39=JSON['parse'](_0x2ee7d4);var _0x34cc36={'$gte':moment(moment(_0x4a6a39[_0x4f0c('0xa')])[_0x4f0c('0xb')](_0x4f0c('0xc')))[_0x4f0c('0xd')]()['format'](),'$lte':moment(moment(_0x4a6a39[_0x4f0c('0xe')])[_0x4f0c('0xb')](_0x4f0c('0xc')))['utc']()[_0x4f0c('0xf')](0x1,'s')[_0x4f0c('0xb')]()};_0x956e4d[_0x4eabb4]=_0x34cc36;}else{_0x956e4d[_0x4eabb4]=_['isArray'](_0x2ee7d4)?_0x2ee7d4:JSON[_0x4f0c('0x10')](_0x2ee7d4);}}else{_0x956e4d[_0x4eabb4]=_[_0x4f0c('0x11')](_0x2ee7d4)?_0x2ee7d4:JSON[_0x4f0c('0x10')](_0x2ee7d4);}}catch(_0x5c4758){_0x956e4d[_0x4eabb4]=_0x2ee7d4['split'](',');}});}return _0x956e4d;};exports['limit']=function(_0xbd07ee){_0xbd07ee=parseInt(_0xbd07ee,0xa);if(!_0xbd07ee||_0xbd07ee<0x0){_0xbd07ee=LIMIT_VALUE;}return _0xbd07ee;};exports[_0x4f0c('0x12')]=function(_0x1a6a4b){_0x1a6a4b=parseInt(_0x1a6a4b,0xa);if(!_0x1a6a4b||_0x1a6a4b<0x0){_0x1a6a4b=0x0;}return _0x1a6a4b;};exports[_0x4f0c('0x13')]=function(_0x2f7ab5){var _0x32d17b,_0x3154a8=null;if(_0x2f7ab5){_0x32d17b=_0x2f7ab5[_0x4f0c('0x4')](',');_0x3154a8=_['map'](_0x32d17b,function(_0x408f0c){if(_0x408f0c[_0x4f0c('0x14')]('-')===0x0){return[_0x408f0c==='priority'?sequelize[_0x4f0c('0x15')](sequelize[_0x4f0c('0x16')]('priority'),_0x4f0c('0x17')):_0x408f0c[_0x4f0c('0x18')](0x1),_0x4f0c('0x19')];}else{return[_0x408f0c===_0x4f0c('0x1a')?sequelize[_0x4f0c('0x15')](sequelize[_0x4f0c('0x16')](_0x4f0c('0x1a')),'unsigned'):_0x408f0c,_0x4f0c('0x1b')];}});}return _0x3154a8;};exports[_0x4f0c('0x1c')]=function(_0x3d9db3,_0x514589){if(_[_0x4f0c('0x6')](_0x3d9db3)){return _0x3d9db3;}if(_['isArray'](_0x3d9db3)){for(var _0x315c97=0x0;_0x315c97<_0x3d9db3[_0x4f0c('0x1d')];_0x315c97+=0x1){_0x3d9db3[_0x315c97]=this[_0x4f0c('0x1c')](_0x3d9db3[_0x315c97],_0x514589);}return _0x3d9db3;}if(!_[_0x4f0c('0x1e')](_0x3d9db3)){return _0x3d9db3;}if(_[_0x4f0c('0x1f')](_0x514589)){_0x514589=[_0x514589];}if(!_['isArray'](_0x514589)){return _0x3d9db3;}for(var _0x11aa8b=0x0;_0x11aa8b<_0x514589[_0x4f0c('0x1d')];_0x11aa8b+=0x1){_['unset'](_0x3d9db3,_0x514589[_0x11aa8b]);}for(var _0x238c9a in _0x3d9db3){if(_0x3d9db3['hasOwnProperty'](_0x238c9a)){_0x3d9db3[_0x238c9a]=this['omit'](_0x3d9db3[_0x238c9a],_0x514589);}}return _0x3d9db3;};exports[_0x4f0c('0x20')]=function(_0x3fc8f0){return _0x3fc8f0['match'](RegExp(_0x4f0c('0x21')))?!![]:![];};exports[_0x4f0c('0x22')]=function(_0x95e5da){return _0x95e5da[_0x4f0c('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0x4f0c('0x24')]=function(_0x5af66a){var _0x1c9af9=[];_0x5af66a[_0x4f0c('0x4')](/[ ,]+/)[_0x4f0c('0x25')](function(_0x12565c){_0x12565c=_0x12565c[_0x4f0c('0x26')](/([^:]")"+/g,'$1');_0x12565c='+'+_0x12565c+'*';if(_0x12565c['includes']('@'))_0x12565c='\x22'+_0x12565c+'\x22';_0x1c9af9[_0x4f0c('0x27')](_0x12565c);});return _0x1c9af9[_0x4f0c('0x28')]('\x20');}; \ No newline at end of file +var _0x5cba=['hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','includes','push','join','lodash','sequelize','moment','split','isEmpty','forOwn','find','type','DATE','isPlainObject','parse','format','YYYY-MM-DD','utc','$lte','subtract','isArray','limit','offset','sort','priority','cast','col','unsigned','substr','ASC','omit','isObject','length'];(function(_0x62a56f,_0x4cedeb){var _0x156be0=function(_0x1bd40f){while(--_0x1bd40f){_0x62a56f['push'](_0x62a56f['shift']());}};_0x156be0(++_0x4cedeb);}(_0x5cba,0xab));var _0xa5cb=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x5cba[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xa5cb('0x0'));var sequelize=require(_0xa5cb('0x1'));var moment=require(_0xa5cb('0x2'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x190d2b){var _0x406d2e=null;if(_0x190d2b){_0x406d2e=_0x190d2b[_0xa5cb('0x3')](',');}return _0x406d2e;};exports['filters']=function(_0x423176,_0x2ed1cb){var _0x8283cd={};if(!_[_0xa5cb('0x4')](_0x423176)){_[_0xa5cb('0x5')](_0x423176,function(_0x476d5d,_0x9640ae){try{if(_0x2ed1cb){var _0x1fe581=_[_0xa5cb('0x6')](_0x2ed1cb,{'name':_0x9640ae})||{};if(_0x1fe581[_0xa5cb('0x7')]===_0xa5cb('0x8')&&_[_0xa5cb('0x9')](_0x476d5d)){var _0x4c32f1=JSON[_0xa5cb('0xa')](_0x476d5d);var _0x498725={'$gte':moment(moment(_0x4c32f1['$gte'])[_0xa5cb('0xb')](_0xa5cb('0xc')))[_0xa5cb('0xd')]()[_0xa5cb('0xb')](),'$lte':moment(moment(_0x4c32f1[_0xa5cb('0xe')])[_0xa5cb('0xb')]('YYYY-MM-DD'))[_0xa5cb('0xd')]()[_0xa5cb('0xf')](0x1,'s')['format']()};_0x8283cd[_0x9640ae]=_0x498725;}else{_0x8283cd[_0x9640ae]=_[_0xa5cb('0x10')](_0x476d5d)?_0x476d5d:JSON['parse'](_0x476d5d);}}else{_0x8283cd[_0x9640ae]=_['isArray'](_0x476d5d)?_0x476d5d:JSON[_0xa5cb('0xa')](_0x476d5d);}}catch(_0x58fe3f){_0x8283cd[_0x9640ae]=_0x476d5d[_0xa5cb('0x3')](',');}});}return _0x8283cd;};exports[_0xa5cb('0x11')]=function(_0x3eaefc){_0x3eaefc=parseInt(_0x3eaefc,0xa);if(!_0x3eaefc||_0x3eaefc<0x0){_0x3eaefc=LIMIT_VALUE;}return _0x3eaefc;};exports[_0xa5cb('0x12')]=function(_0x2a5123){_0x2a5123=parseInt(_0x2a5123,0xa);if(!_0x2a5123||_0x2a5123<0x0){_0x2a5123=0x0;}return _0x2a5123;};exports[_0xa5cb('0x13')]=function(_0x58492a){var _0xd5440f,_0x2a139a=null;if(_0x58492a){_0xd5440f=_0x58492a[_0xa5cb('0x3')](',');_0x2a139a=_['map'](_0xd5440f,function(_0x540f8e){if(_0x540f8e['indexOf']('-')===0x0){return[_0x540f8e===_0xa5cb('0x14')?sequelize[_0xa5cb('0x15')](sequelize[_0xa5cb('0x16')]('priority'),_0xa5cb('0x17')):_0x540f8e[_0xa5cb('0x18')](0x1),'DESC'];}else{return[_0x540f8e===_0xa5cb('0x14')?sequelize[_0xa5cb('0x15')](sequelize[_0xa5cb('0x16')]('priority'),_0xa5cb('0x17')):_0x540f8e,_0xa5cb('0x19')];}});}return _0x2a139a;};exports[_0xa5cb('0x1a')]=function(_0x4e847d,_0x407a62){if(_[_0xa5cb('0x4')](_0x4e847d)){return _0x4e847d;}if(_[_0xa5cb('0x10')](_0x4e847d)){for(var _0x5b6d63=0x0;_0x5b6d63<_0x4e847d['length'];_0x5b6d63+=0x1){_0x4e847d[_0x5b6d63]=this[_0xa5cb('0x1a')](_0x4e847d[_0x5b6d63],_0x407a62);}return _0x4e847d;}if(!_[_0xa5cb('0x1b')](_0x4e847d)){return _0x4e847d;}if(_['isString'](_0x407a62)){_0x407a62=[_0x407a62];}if(!_['isArray'](_0x407a62)){return _0x4e847d;}for(var _0x39d13e=0x0;_0x39d13e<_0x407a62[_0xa5cb('0x1c')];_0x39d13e+=0x1){_['unset'](_0x4e847d,_0x407a62[_0x39d13e]);}for(var _0x5526ae in _0x4e847d){if(_0x4e847d[_0xa5cb('0x1d')](_0x5526ae)){_0x4e847d[_0x5526ae]=this['omit'](_0x4e847d[_0x5526ae],_0x407a62);}}return _0x4e847d;};exports[_0xa5cb('0x1e')]=function(_0x28c911){return _0x28c911[_0xa5cb('0x1f')](RegExp(_0xa5cb('0x20')))?!![]:![];};exports[_0xa5cb('0x21')]=function(_0x20a13d){return _0x20a13d['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xa5cb('0x22')]=function(_0x59b789){var _0x19e172=[];_0x59b789[_0xa5cb('0x3')](/[ ,]+/)[_0xa5cb('0x23')](function(_0x5ce31f){_0x5ce31f=_0x5ce31f[_0xa5cb('0x24')](/([^:]")"+/g,'$1');_0x5ce31f='+'+_0x5ce31f+'*';if(_0x5ce31f[_0xa5cb('0x25')]('@'))_0x5ce31f='\x22'+_0x5ce31f+'\x22';_0x19e172[_0xa5cb('0x26')](_0x5ce31f);});return _0x19e172[_0xa5cb('0x27')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index df2214b..f23a798 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb051=['toISOString','split','views','engine','html','ejs','renderFile','50mb','json','initialize','express','cookie-parser','errorhandler','path','./environment','default','get','production','set','appPath','join','public','development','root','client','use'];(function(_0x32883b,_0x3ac9a9){var _0x63b162=function(_0xf8b7a){while(--_0xf8b7a){_0x32883b['push'](_0x32883b['shift']());}};_0x63b162(++_0x3ac9a9);}(_0xb051,0x142));var _0x1b05=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0xb051[_0x419e17];return _0x1f2044;};'use strict';var express=require(_0x1b05('0x0'));var favicon=require('serve-favicon');var bodyParser=require('body-parser');var methodOverride=require('method-override');var cookieParser=require(_0x1b05('0x1'));var errorHandler=require(_0x1b05('0x2'));var path=require(_0x1b05('0x3'));var passport=require('passport');var cors=require('cors');var moment=require('moment');var config=require(_0x1b05('0x4'));var db=require('../mysqldb')['db'];exports[_0x1b05('0x5')]=function(_0xe1bec6){var _0x155369=_0xe1bec6[_0x1b05('0x6')]('env');if(_0x155369===_0x1b05('0x7')){_0xe1bec6[_0x1b05('0x8')](_0x1b05('0x9'),path[_0x1b05('0xa')](config['root'],_0x1b05('0xb')));}if(_0x155369===_0x1b05('0xc')||_0x155369==='test'){_0xe1bec6[_0x1b05('0x8')](_0x1b05('0x9'),path['join'](config[_0x1b05('0xd')],_0x1b05('0xe')));_0xe1bec6[_0x1b05('0xf')](errorHandler());}_0xe1bec6[_0x1b05('0x8')]('json\x20replacer',function(_0x2c810f,_0x3072c6){if(this[_0x2c810f]instanceof Date){_0x3072c6=this[_0x2c810f][_0x1b05('0x10')]()[_0x1b05('0x11')]('.')[0x0]+'Z';}return _0x3072c6;});_0xe1bec6[_0x1b05('0xf')](express['static'](_0xe1bec6[_0x1b05('0x6')]('appPath')));_0xe1bec6[_0x1b05('0x8')](_0x1b05('0x12'),config[_0x1b05('0xd')]+'/server/views');_0xe1bec6[_0x1b05('0x13')](_0x1b05('0x14'),require(_0x1b05('0x15'))[_0x1b05('0x16')]);_0xe1bec6[_0x1b05('0x8')]('view\x20engine',_0x1b05('0x14'));_0xe1bec6[_0x1b05('0xf')](bodyParser['urlencoded']({'limit':_0x1b05('0x17'),'extended':!![]}));_0xe1bec6[_0x1b05('0xf')](bodyParser[_0x1b05('0x18')]({'limit':_0x1b05('0x17')}));_0xe1bec6[_0x1b05('0xf')](cors());_0xe1bec6[_0x1b05('0xf')](methodOverride());_0xe1bec6[_0x1b05('0xf')](cookieParser());_0xe1bec6[_0x1b05('0xf')](passport[_0x1b05('0x19')]());}; \ No newline at end of file +var _0x33c6=['use','json\x20replacer','toISOString','static','/server/views','engine','html','renderFile','view\x20engine','urlencoded','50mb','json','initialize','body-parser','method-override','errorhandler','path','passport','cors','moment','./environment','../mysqldb','get','env','appPath','root','public','development','set','join','client'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x33c6,0x143));var _0x633c=function(_0x32185a,_0x140afb){_0x32185a=_0x32185a-0x0;var _0x750fdf=_0x33c6[_0x32185a];return _0x750fdf;};'use strict';var express=require('express');var favicon=require('serve-favicon');var bodyParser=require(_0x633c('0x0'));var methodOverride=require(_0x633c('0x1'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x633c('0x2'));var path=require(_0x633c('0x3'));var passport=require(_0x633c('0x4'));var cors=require(_0x633c('0x5'));var moment=require(_0x633c('0x6'));var config=require(_0x633c('0x7'));var db=require(_0x633c('0x8'))['db'];exports['default']=function(_0xe192f7){var _0x2a6965=_0xe192f7[_0x633c('0x9')](_0x633c('0xa'));if(_0x2a6965==='production'){_0xe192f7['set'](_0x633c('0xb'),path['join'](config[_0x633c('0xc')],_0x633c('0xd')));}if(_0x2a6965===_0x633c('0xe')||_0x2a6965==='test'){_0xe192f7[_0x633c('0xf')](_0x633c('0xb'),path[_0x633c('0x10')](config[_0x633c('0xc')],_0x633c('0x11')));_0xe192f7[_0x633c('0x12')](errorHandler());}_0xe192f7['set'](_0x633c('0x13'),function(_0x183cb7,_0xbc6b5c){if(this[_0x183cb7]instanceof Date){_0xbc6b5c=this[_0x183cb7][_0x633c('0x14')]()['split']('.')[0x0]+'Z';}return _0xbc6b5c;});_0xe192f7[_0x633c('0x12')](express[_0x633c('0x15')](_0xe192f7[_0x633c('0x9')]('appPath')));_0xe192f7[_0x633c('0xf')]('views',config[_0x633c('0xc')]+_0x633c('0x16'));_0xe192f7[_0x633c('0x17')](_0x633c('0x18'),require('ejs')[_0x633c('0x19')]);_0xe192f7[_0x633c('0xf')](_0x633c('0x1a'),_0x633c('0x18'));_0xe192f7[_0x633c('0x12')](bodyParser[_0x633c('0x1b')]({'limit':_0x633c('0x1c'),'extended':!![]}));_0xe192f7[_0x633c('0x12')](bodyParser[_0x633c('0x1d')]({'limit':_0x633c('0x1c')}));_0xe192f7['use'](cors());_0xe192f7[_0x633c('0x12')](methodOverride());_0xe192f7['use'](cookieParser());_0xe192f7[_0x633c('0x12')](passport[_0x633c('0x1e')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 0dbb8f7..2876f70 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 _0x71ab=['ipAddress','digest','hex','substring','crypto','child_process','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','join','createHash','md5','update','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname'];(function(_0x3e86d8,_0xaf6e5c){var _0x52daf1=function(_0xa867aa){while(--_0xa867aa){_0x3e86d8['push'](_0x3e86d8['shift']());}};_0x52daf1(++_0xaf6e5c);}(_0x71ab,0x64));var _0xb71a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x71ab[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xb71a('0x0'));var machine=require('bimedia-machine-uuid');var exec=require(_0xb71a('0x1'))['execSync'];function getInterfaces(){var _0x3e985a=[];var _0x3f0529=os[_0xb71a('0x2')]();var _0x4094b2=_[_0xb71a('0x3')](_[_0xb71a('0x4')](_0x3f0529));for(var _0x2192e8=0x0;_0x2192e8<_0x4094b2[_0xb71a('0x5')];_0x2192e8++){var _0x22c072=_0x3f0529[_0x4094b2[_0x2192e8]][_0xb71a('0x6')](function(_0x4358ce){return _0x4358ce[_0xb71a('0x7')]===_0xb71a('0x8')&&_0x4358ce[_0xb71a('0x9')]===![];});_0x3e985a=_0x3e985a[_0xb71a('0xa')](_0x22c072);}return _0x3e985a;}function getFirstInterface(){var _0xbfef18=_[_0xb71a('0xb')](getInterfaces());return{'macAddress':_0xbfef18&&_0xbfef18[_0xb71a('0xc')]?_0xbfef18['mac']:_0xb71a('0xd'),'ipAddress':_0xbfef18&&_0xbfef18['address']?_0xbfef18[_0xb71a('0xe')]:_0xb71a('0xf')};}exports[_0xb71a('0x10')]=getFirstInterface;function getCPUhash(){var _0x591311=_[_0xb71a('0x3')](os['cpus']()[_0xb71a('0x11')](function(_0x50030d){return _0x50030d['model'];}))[_0xb71a('0x12')](':');return crypto[_0xb71a('0x13')](_0xb71a('0x14'))[_0xb71a('0x15')](_0x591311)['digest']('hex');}exports['getUuid']=function(){switch(os[_0xb71a('0x16')]()){case _0xb71a('0x17'):return exec(_0xb71a('0x18'),{'encoding':_0xb71a('0x19')})[_0xb71a('0x1a')]('\x0d\x0a','');default:var _0x1e9363=getFirstInterface();var _0x31def2=getCPUhash();var _0x2ec64a=_0x31def2+'|'+os[_0xb71a('0x1b')]()+'|'+_0x1e9363['macAddress']+'|'+_0x1e9363[_0xb71a('0x1c')];var _0x2d6369=crypto[_0xb71a('0x13')](_0xb71a('0x14'))[_0xb71a('0x15')](_0x2ec64a)[_0xb71a('0x1d')](_0xb71a('0x1e'));return _0x2d6369[_0xb71a('0x1f')](0x0,0x8)+'-'+_0x2d6369[_0xb71a('0x1f')](0x8,0xc)+'-'+_0x2d6369[_0xb71a('0x1f')](0xc,0x10)+'-'+_0x2d6369[_0xb71a('0x1f')](0x10,0x14)+'-'+_0x2d6369['substring'](0x14);}}; \ No newline at end of file +var _0x5577=['hostname','substring','lodash','bimedia-machine-uuid','child_process','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','cpus','map','model','join','createHash','md5','update','hex','getUuid','platform','dmidecode\x20--string\x20system-uuid','utf8','replace'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5577,0x1b4));var _0x7557=function(_0x1ebd67,_0x408823){_0x1ebd67=_0x1ebd67-0x0;var _0x26fbce=_0x5577[_0x1ebd67];return _0x26fbce;};'use strict';var _=require(_0x7557('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x7557('0x1'));var exec=require(_0x7557('0x2'))['execSync'];function getInterfaces(){var _0x34636a=[];var _0x289758=os[_0x7557('0x3')]();var _0x3c4697=_[_0x7557('0x4')](_[_0x7557('0x5')](_0x289758));for(var _0x5862e6=0x0;_0x5862e6<_0x3c4697[_0x7557('0x6')];_0x5862e6++){var _0x41a4a5=_0x289758[_0x3c4697[_0x5862e6]][_0x7557('0x7')](function(_0x1446fd){return _0x1446fd[_0x7557('0x8')]===_0x7557('0x9')&&_0x1446fd[_0x7557('0xa')]===![];});_0x34636a=_0x34636a[_0x7557('0xb')](_0x41a4a5);}return _0x34636a;}function getFirstInterface(){var _0x166f43=_[_0x7557('0xc')](getInterfaces());return{'macAddress':_0x166f43&&_0x166f43[_0x7557('0xd')]?_0x166f43[_0x7557('0xd')]:_0x7557('0xe'),'ipAddress':_0x166f43&&_0x166f43[_0x7557('0xf')]?_0x166f43[_0x7557('0xf')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x1941a7=_[_0x7557('0x4')](os[_0x7557('0x10')]()[_0x7557('0x11')](function(_0xb6ed30){return _0xb6ed30[_0x7557('0x12')];}))[_0x7557('0x13')](':');return crypto[_0x7557('0x14')](_0x7557('0x15'))[_0x7557('0x16')](_0x1941a7)['digest'](_0x7557('0x17'));}exports[_0x7557('0x18')]=function(){switch(os[_0x7557('0x19')]()){case'win32':return exec(_0x7557('0x1a'),{'encoding':_0x7557('0x1b')})[_0x7557('0x1c')]('\x0d\x0a','');default:var _0x325849=getFirstInterface();var _0x54295b=getCPUhash();var _0x28ecd5=_0x54295b+'|'+os[_0x7557('0x1d')]()+'|'+_0x325849['macAddress']+'|'+_0x325849['ipAddress'];var _0x41b3db=crypto[_0x7557('0x14')](_0x7557('0x15'))[_0x7557('0x16')](_0x28ecd5)['digest'](_0x7557('0x17'));return _0x41b3db['substring'](0x0,0x8)+'-'+_0x41b3db[_0x7557('0x1e')](0x8,0xc)+'-'+_0x41b3db[_0x7557('0x1e')](0xc,0x10)+'-'+_0x41b3db[_0x7557('0x1e')](0x10,0x14)+'-'+_0x41b3db[_0x7557('0x1e')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 2213b36..b1dbe23 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 _0x0cc4=['util','moment','request-promise','../../mysqldb','../../components/encryptor','./hardware','../logger','../../api/jira/jira.controller','process','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','version','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','||FIELD||VALUE||\x0a','User','email','|reason|','|uuid|','|machineUuid|','fullname','getFirstInterface','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','Changed','data1','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','update','error','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default'];(function(_0x5d6ef6,_0xbf2a7){var _0x774a55=function(_0x203875){while(--_0x203875){_0x5d6ef6['push'](_0x5d6ef6['shift']());}};_0x774a55(++_0xbf2a7);}(_0x0cc4,0x72));var _0x40cc=function(_0x2980de,_0x1426a4){_0x2980de=_0x2980de-0x0;var _0x81a4ca=_0x0cc4[_0x2980de];return _0x81a4ca;};'use strict';var util=require(_0x40cc('0x0'));var moment=require(_0x40cc('0x1'));var rp=require(_0x40cc('0x2'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,'version');var db=require(_0x40cc('0x3'))['db'];var encryptor=require(_0x40cc('0x4'));var hardware=require(_0x40cc('0x5'));var logger=require(_0x40cc('0x6'))('license');var jira=require(_0x40cc('0x7'));const {config}=require(_0x40cc('0x8'));var HOST=_0x40cc('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x2751df){return new BPromise(function(_0x49fee8,_0x2589e1){var _0xef1657=util['format'](_0x40cc('0xa'),HOST,_0x2751df,module[_0x40cc('0xb')][_0x40cc('0xc')]);if(oldToken){_0xef1657=util[_0x40cc('0xd')](_0x40cc('0xe'),HOST,_0x2751df,module[_0x40cc('0xb')][_0x40cc('0xc')],oldToken);}var _0x1c2125={'uri':_0xef1657,'method':_0x40cc('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x1c2125)[_0x40cc('0x10')](function(_0xa495e0){_0x49fee8(_0xa495e0);})[_0x40cc('0x11')](function(_0xd8649c){_0x2589e1(_0xd8649c);});});}function sendJiraAlert(_0x21ec06,_0x5de780,_0x2160dc){var _0x122e9c=_0x40cc('0x12');return db[_0x40cc('0x13')]['findOne']({'where':{'role':'admin'},'attributes':['fullname',_0x40cc('0x14')],'raw':!![]})[_0x40cc('0x10')](function(_0xa2eec4){ADMIN=_0xa2eec4;_0x122e9c+=_0x40cc('0x15')+_0x2160dc+'|\x0a';_0x122e9c+=_0x40cc('0x16')+_0x21ec06+'|\x0a';_0x122e9c+=_0x40cc('0x17')+_0x5de780+'|\x0a';_0x122e9c+='|name|'+ADMIN[_0x40cc('0x18')]+'|\x0a';_0x122e9c+='|email|'+ADMIN['email']+'|\x0a';return _0x122e9c;})[_0x40cc('0x10')](function(_0x447fd5){var _0x4da7b3=hardware[_0x40cc('0x19')]()['ipAddress'];return jira[_0x40cc('0x1a')]({'key':_0x40cc('0x1b'),'summary':_0x40cc('0x1c'),'description':_0x447fd5,'issuetype':_0x40cc('0x1d'),'oldToken':_0x21ec06,'newToken':_0x5de780,'email':ADMIN['email'],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x4da7b3});});}function manageLicense(_0x3d57b0,_0x3a69aa){var _0x1db148=_0x3a69aa[_0x40cc('0x1e')]({'plain':!![]});httpRequest(_0x3d57b0)[_0x40cc('0x10')](function(_0x1137ac){if(oldToken){oldToken=undefined;}if(_0x1137ac[_0x40cc('0x1f')]){if(!_0x1db148[_0x40cc('0x20')]&&_0x1db148['license']!=_0x1137ac[_0x40cc('0x20')]||_0x1db148[_0x40cc('0x20')]&&_0x1db148[_0x40cc('0x21')]){logger[_0x40cc('0x22')](_0x40cc('0x23'));}if(_0x1db148[_0x40cc('0x20')]&&!_0x1db148['data2']&&_0x1db148['license']!=_0x1137ac[_0x40cc('0x20')]){logger[_0x40cc('0x22')](_0x40cc('0x24'));}if(_0x1db148[_0x40cc('0x20')]&&!_0x1db148['data2']&&_0x1db148[_0x40cc('0x20')]==_0x1137ac['license']){return _0x3a69aa;}return _0x3a69aa['update']({'data1':_0x3d57b0,'data2':null,'license':_0x1137ac[_0x40cc('0x20')]});}else{if(_0x1137ac['license']||_0x1db148[_0x40cc('0x20')]){if(!_0x1db148['data2']){if(_0x1db148['data1']==_0x3d57b0){GRAY_PERIOD_REASON=_0x40cc('0x25');logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x40cc('0x26');oldToken=_0x1db148[_0x40cc('0x27')];logger['info'](_0x40cc('0x28'),_0x1db148[_0x40cc('0x27')],_0x3d57b0);}sendJiraAlert(_0x1db148[_0x40cc('0x27')],_0x1137ac[_0x40cc('0x29')],GRAY_PERIOD_REASON);logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x40cc('0x2a')](),moment()[_0x40cc('0xd')](_0x40cc('0x2b')));return _0x3a69aa['update']({'data2':encryptor['encryptString'](moment()[_0x40cc('0xd')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x40cc('0x2c')](encryptor[_0x40cc('0x2d')](_0x1db148[_0x40cc('0x21')]),_0x40cc('0x2e'))>DAYS){logger[_0x40cc('0x22')](_0x40cc('0x2f'),moment()[_0x40cc('0xd')](_0x40cc('0x2b')));return _0x3a69aa[_0x40cc('0x30')]({'data1':_0x3d57b0,'data2':null,'license':null});}}}else{if(_0x1db148[_0x40cc('0x27')]!=_0x3d57b0){logger[_0x40cc('0x22')](_0x40cc('0x28'),_0x1db148['data1'],_0x3d57b0);return _0x3a69aa[_0x40cc('0x30')]({'data1':_0x3d57b0,'data2':null,'license':null});}}}return _0x3a69aa;})[_0x40cc('0x10')](function(_0x1b107b){_0x3a69aa=_0x1b107b;})[_0x40cc('0x11')](function(_0x3e0832){logger[_0x40cc('0x31')](_0x3e0832['message']);})[_0x40cc('0x32')](function(){setTimeout(function(){manageLicense(hardware[_0x40cc('0x33')](),_0x3a69aa);},TIME);});}function defaultLicense(){var _0x4a8251=hardware['getUuid']();if(_0x4a8251){return db[_0x40cc('0x34')][_0x40cc('0x35')]({'where':{'id':0x1},'defaults':{'data1':_0x4a8251}})['spread'](function(_0x41e527,_0x4a27c0){logger[_0x40cc('0x22')](_0x40cc('0x36'),_0x4a8251);manageLicense(_0x4a8251,_0x41e527);})['catch'](function(_0x36184a){logger[_0x40cc('0x31')](_0x36184a[_0x40cc('0x37')]);});}}exports[_0x40cc('0x38')]=defaultLicense; \ No newline at end of file +var _0x609b=['admin','fullname','email','|reason|','|uuid|','|machineUuid|','|name|','|email|','getFirstInterface','MOTLICENSE','Motion\x20License\x20Alert','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','data1','Disabled','Changed','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','catch','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','request-promise','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','../../api/jira/jira.controller','process','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','User','findOne'];(function(_0x4f05c2,_0x2cb4a8){var _0x9aa554=function(_0x463708){while(--_0x463708){_0x4f05c2['push'](_0x4f05c2['shift']());}};_0x9aa554(++_0x2cb4a8);}(_0x609b,0x8f));var _0xb609=function(_0x9bf944,_0x4a2c03){_0x9bf944=_0x9bf944-0x0;var _0x2f80cf=_0x609b[_0x9bf944];return _0x2f80cf;};'use strict';var util=require(_0xb609('0x0'));var moment=require(_0xb609('0x1'));var rp=require(_0xb609('0x2'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0xb609('0x3'));var db=require(_0xb609('0x4'))['db'];var encryptor=require(_0xb609('0x5'));var hardware=require(_0xb609('0x6'));var logger=require(_0xb609('0x7'))(_0xb609('0x8'));var jira=require(_0xb609('0x9'));const {config}=require(_0xb609('0xa'));var HOST=_0xb609('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x3a4dac){return new BPromise(function(_0x5dabef,_0x4cc808){var _0x4c588c=util[_0xb609('0xc')]('%s/api/servers/%s/check?version=%s',HOST,_0x3a4dac,module[_0xb609('0xd')][_0xb609('0x3')]);if(oldToken){_0x4c588c=util[_0xb609('0xc')](_0xb609('0xe'),HOST,_0x3a4dac,module[_0xb609('0xd')][_0xb609('0x3')],oldToken);}var _0x1b452a={'uri':_0x4c588c,'method':_0xb609('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x1b452a)[_0xb609('0x10')](function(_0x2e56ae){_0x5dabef(_0x2e56ae);})['catch'](function(_0x2096ea){_0x4cc808(_0x2096ea);});});}function sendJiraAlert(_0x420da8,_0x42efe3,_0x58a1a5){var _0x324c15='||FIELD||VALUE||\x0a';return db[_0xb609('0x11')][_0xb609('0x12')]({'where':{'role':_0xb609('0x13')},'attributes':[_0xb609('0x14'),_0xb609('0x15')],'raw':!![]})['then'](function(_0x3976ea){ADMIN=_0x3976ea;_0x324c15+=_0xb609('0x16')+_0x58a1a5+'|\x0a';_0x324c15+=_0xb609('0x17')+_0x420da8+'|\x0a';_0x324c15+=_0xb609('0x18')+_0x42efe3+'|\x0a';_0x324c15+=_0xb609('0x19')+ADMIN[_0xb609('0x14')]+'|\x0a';_0x324c15+=_0xb609('0x1a')+ADMIN[_0xb609('0x15')]+'|\x0a';return _0x324c15;})[_0xb609('0x10')](function(_0xed9ac6){var _0x58fd95=hardware[_0xb609('0x1b')]()['ipAddress'];return jira['openIssue']({'key':_0xb609('0x1c'),'summary':_0xb609('0x1d'),'description':_0xed9ac6,'issuetype':'Alert','oldToken':_0x420da8,'newToken':_0x42efe3,'email':ADMIN[_0xb609('0x15')],'name':ADMIN[_0xb609('0x14')],'reason':GRAY_PERIOD_REASON,'ip':_0x58fd95});});}function manageLicense(_0x544bec,_0x11889e){var _0x57c32c=_0x11889e['get']({'plain':!![]});httpRequest(_0x544bec)[_0xb609('0x10')](function(_0x36db6c){if(oldToken){oldToken=undefined;}if(_0x36db6c[_0xb609('0x1e')]){if(!_0x57c32c[_0xb609('0x8')]&&_0x57c32c['license']!=_0x36db6c[_0xb609('0x8')]||_0x57c32c[_0xb609('0x8')]&&_0x57c32c[_0xb609('0x1f')]){logger[_0xb609('0x20')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x57c32c['license']&&!_0x57c32c[_0xb609('0x1f')]&&_0x57c32c[_0xb609('0x8')]!=_0x36db6c[_0xb609('0x8')]){logger['info'](_0xb609('0x21'));}if(_0x57c32c[_0xb609('0x8')]&&!_0x57c32c[_0xb609('0x1f')]&&_0x57c32c[_0xb609('0x8')]==_0x36db6c[_0xb609('0x8')]){return _0x11889e;}return _0x11889e[_0xb609('0x22')]({'data1':_0x544bec,'data2':null,'license':_0x36db6c['license']});}else{if(_0x36db6c['license']||_0x57c32c['license']){if(!_0x57c32c['data2']){if(_0x57c32c[_0xb609('0x23')]==_0x544bec){GRAY_PERIOD_REASON=_0xb609('0x24');logger[_0xb609('0x20')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xb609('0x25');oldToken=_0x57c32c[_0xb609('0x23')];logger[_0xb609('0x20')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x57c32c[_0xb609('0x23')],_0x544bec);}sendJiraAlert(_0x57c32c[_0xb609('0x23')],_0x36db6c[_0xb609('0x26')],GRAY_PERIOD_REASON);logger[_0xb609('0x20')](_0xb609('0x27'),GRAY_PERIOD_REASON[_0xb609('0x28')](),moment()[_0xb609('0xc')](_0xb609('0x29')));return _0x11889e['update']({'data2':encryptor['encryptString'](moment()[_0xb609('0xc')](_0xb609('0x29')))});}else{if(moment()[_0xb609('0x2a')](encryptor[_0xb609('0x2b')](_0x57c32c['data2']),'days')>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0xb609('0xc')](_0xb609('0x29')));return _0x11889e[_0xb609('0x22')]({'data1':_0x544bec,'data2':null,'license':null});}}}else{if(_0x57c32c['data1']!=_0x544bec){logger[_0xb609('0x20')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x57c32c['data1'],_0x544bec);return _0x11889e[_0xb609('0x22')]({'data1':_0x544bec,'data2':null,'license':null});}}}return _0x11889e;})[_0xb609('0x10')](function(_0x59ea9c){_0x11889e=_0x59ea9c;})[_0xb609('0x2c')](function(_0xf67f9){logger['error'](_0xf67f9[_0xb609('0x2d')]);})[_0xb609('0x2e')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x11889e);},TIME);});}function defaultLicense(){var _0xe2d3c9=hardware[_0xb609('0x2f')]();if(_0xe2d3c9){return db[_0xb609('0x30')][_0xb609('0x31')]({'where':{'id':0x1},'defaults':{'data1':_0xe2d3c9}})[_0xb609('0x32')](function(_0x3e41c5,_0x4374f8){logger[_0xb609('0x20')](_0xb609('0x33'),_0xe2d3c9);manageLicense(_0xe2d3c9,_0x3e41c5);})[_0xb609('0x2c')](function(_0x19d01b){logger[_0xb609('0x34')](_0x19d01b[_0xb609('0x2d')]);});}}exports[_0xb609('0x35')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index e6fbb53..0bfee57 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 _0xef65=['Breaking\x20license','find','then','catch','data1','license','License\x20key\x20value\x20not\x20found','split','decryptString','%s:%s:%s','demo','uuid','gray','deadline','days','format','grayReason','changed','disabled','message','role','sequelize','col','count','user','telephone','users','telephones','forEach','admin','exports','util','lodash','moment','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid'];(function(_0xfcbf57,_0x4b05fd){var _0x1078fa=function(_0xb65856){while(--_0xb65856){_0xfcbf57['push'](_0xfcbf57['shift']());}};_0x1078fa(++_0x4b05fd);}(_0xef65,0xbb));var _0x5ef6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xef65[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x5ef6('0x0'));var _=require(_0x5ef6('0x1'));var moment=require(_0x5ef6('0x2'));var BPromise=require('bluebird');var hardware=require(_0x5ef6('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0x5ef6('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5ef6('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x5ef6('0x6'),'machineUuid':hardware[_0x5ef6('0x7')](),'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':_0x5ef6('0x8'),'machineUuid':hardware[_0x5ef6('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2acb12){return new BPromise(function(_0x30cb2a,_0x4409bd){return db['License'][_0x5ef6('0x9')](_['defaults'](_0x2acb12,{'raw':!![],'where':{'id':0x1}}))[_0x5ef6('0xa')](function(_0x2e7746){return checkLicense(_0x2e7746,null);})[_0x5ef6('0xa')](function(_0xe52e25){_0x30cb2a(_0xe52e25);return;})[_0x5ef6('0xb')](function(_0x469483){_0x4409bd(_0x469483);});});}function checkLicense(_0xeefac1,_0x50b02c){if(!_0xeefac1){demoLicense['uuid']=_0xeefac1[_0x5ef6('0xc')];return demoLicense;}try{var _0x2c44aa=_0x50b02c||_0xeefac1[_0x5ef6('0xd')];if(_['isEmpty'](_0x2c44aa)){throw new Error(_0x5ef6('0xe'));}var _0xfc14d4=_0xeefac1['data1'];var _0xdbd54e=_0xeefac1['data2'];var _0x361bec=_0xfc14d4[_0x5ef6('0xf')]('-')[0x4];var _0x39255d=_0xfc14d4[_0x5ef6('0xf')]('-')[0x0];var _0x1625a4=encryptor[_0x5ef6('0x10')](_0x2c44aa,util['format'](_0x5ef6('0x11'),_0x361bec,_0xfc14d4,_0x39255d));var _0x4dd074=JSON['parse'](_0x1625a4);_0x4dd074[_0x5ef6('0x12')]=![];_0x4dd074[_0x5ef6('0x13')]=_0xfc14d4;_0x4dd074['machineUuid']=hardware[_0x5ef6('0x7')]();if(_0xdbd54e){var _0x467f19=encryptor[_0x5ef6('0x10')](_0xdbd54e);_0x4dd074[_0x5ef6('0x14')]=_0x467f19;_0x4dd074[_0x5ef6('0x15')]=moment(_0x467f19)['add'](0x7,_0x5ef6('0x16'))[_0x5ef6('0x17')]();_0x4dd074[_0x5ef6('0x18')]=_0x4dd074[_0x5ef6('0x13')]!=_0x4dd074['machineUuid']?_0x5ef6('0x19'):_0x5ef6('0x1a');}return _0x4dd074;}catch(_0x1c0b5b){breakingLicense[_0x5ef6('0x13')]=_0xeefac1[_0x5ef6('0xc')];breakingLicense[_0x5ef6('0x1b')]=_0x1c0b5b['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5407b6,_0x2cfe0f){getLicense()[_0x5ef6('0xa')](function(_0x5de696){return db['User']['findAll']({'attributes':[_0x5ef6('0x1c'),[db[_0x5ef6('0x1d')]['fn']('COUNT',db[_0x5ef6('0x1d')][_0x5ef6('0x1e')](_0x5ef6('0x1c'))),_0x5ef6('0x1f')]],'group':_0x5ef6('0x1c'),'where':{'role':{'$or':['admin',_0x5ef6('0x20'),_0x5ef6('0x21')]}},'raw':!![]})[_0x5ef6('0xa')](function(_0x4529ca){var _0x299747={'user':_0x5de696[_0x5ef6('0x22')]||0x0,'telephone':_0x5de696[_0x5ef6('0x23')]||0x0};_0x4529ca[_0x5ef6('0x24')](function(_0x7ff2d0){var _0x12d812=_0x7ff2d0['role']==='admin'?_0x5ef6('0x20'):_0x7ff2d0[_0x5ef6('0x1c')];_0x299747[_0x12d812]-=_0x7ff2d0['count'];if(_0x299747[_0x12d812]<0x0)_0x299747[_0x12d812]=0x0;});_0x5407b6(_0x299747);return;});})[_0x5ef6('0xb')](function(_0x557fd7){_0x2cfe0f(_0x557fd7);});});}function checkUserLimits(_0x181be7){return new BPromise(function(_0x2e695b,_0x517a49){getLimits()[_0x5ef6('0xa')](function(_0x118981){var _0x1c485a=_['pick'](_['countBy'](_0x181be7,'role'),[_0x5ef6('0x25'),_0x5ef6('0x20'),_0x5ef6('0x21')]);var _0x4d9e4e=(_0x1c485a[_0x5ef6('0x25')]||0x0)+(_0x1c485a['user']||0x0);var _0x520026=_0x1c485a[_0x5ef6('0x21')]||0x0;if(_0x4d9e4e>_0x118981[_0x5ef6('0x20')])return _0x517a49('License\x20limit\x20reached\x20for\x20users');if(_0x520026>_0x118981['telephone'])return _0x517a49('License\x20limit\x20reached\x20for\x20telephones');return _0x2e695b();})[_0x5ef6('0xb')](function(_0x29ec7d){_0x517a49(_0x29ec7d);});});}module[_0x5ef6('0x26')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xfd1c=['gray','deadline','days','grayReason','machineUuid','changed','message','User','role','sequelize','COUNT','col','count','user','telephones','forEach','admin','countBy','telephone','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse'];(function(_0x23fb8b,_0x5ad627){var _0x9c821b=function(_0x8e5345){while(--_0x8e5345){_0x23fb8b['push'](_0x23fb8b['shift']());}};_0x9c821b(++_0x5ad627);}(_0xfd1c,0x197));var _0xcfd1=function(_0x143cfd,_0x1a336e){_0x143cfd=_0x143cfd-0x0;var _0x2cb5f5=_0xfd1c[_0x143cfd];return _0x2cb5f5;};'use strict';var util=require(_0xcfd1('0x0'));var _=require(_0xcfd1('0x1'));var moment=require(_0xcfd1('0x2'));var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require(_0xcfd1('0x3'));var db=require(_0xcfd1('0x4'))['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':_0xcfd1('0x5'),'machineUuid':hardware[_0xcfd1('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcfd1('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xcfd1('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x24d4bc){return new BPromise(function(_0x54b2e4,_0x393d98){return db[_0xcfd1('0x8')][_0xcfd1('0x9')](_[_0xcfd1('0xa')](_0x24d4bc,{'raw':!![],'where':{'id':0x1}}))[_0xcfd1('0xb')](function(_0xf260ca){return checkLicense(_0xf260ca,null);})[_0xcfd1('0xb')](function(_0x5d6bcf){_0x54b2e4(_0x5d6bcf);return;})[_0xcfd1('0xc')](function(_0x2c18e6){_0x393d98(_0x2c18e6);});});}function checkLicense(_0x563b59,_0x4dae83){if(!_0x563b59){demoLicense[_0xcfd1('0xd')]=_0x563b59[_0xcfd1('0xe')];return demoLicense;}try{var _0x4d7509=_0x4dae83||_0x563b59[_0xcfd1('0xf')];if(_[_0xcfd1('0x10')](_0x4d7509)){throw new Error(_0xcfd1('0x11'));}var _0x169093=_0x563b59[_0xcfd1('0xe')];var _0x56e035=_0x563b59[_0xcfd1('0x12')];var _0x3201d6=_0x169093[_0xcfd1('0x13')]('-')[0x4];var _0x49fc4c=_0x169093[_0xcfd1('0x13')]('-')[0x0];var _0x3d5fff=encryptor[_0xcfd1('0x14')](_0x4d7509,util[_0xcfd1('0x15')]('%s:%s:%s',_0x3201d6,_0x169093,_0x49fc4c));var _0xc2f08e=JSON[_0xcfd1('0x16')](_0x3d5fff);_0xc2f08e['demo']=![];_0xc2f08e['uuid']=_0x169093;_0xc2f08e['machineUuid']=hardware[_0xcfd1('0x6')]();if(_0x56e035){var _0x30ce00=encryptor[_0xcfd1('0x14')](_0x56e035);_0xc2f08e[_0xcfd1('0x17')]=_0x30ce00;_0xc2f08e[_0xcfd1('0x18')]=moment(_0x30ce00)['add'](0x7,_0xcfd1('0x19'))[_0xcfd1('0x15')]();_0xc2f08e[_0xcfd1('0x1a')]=_0xc2f08e[_0xcfd1('0xd')]!=_0xc2f08e[_0xcfd1('0x1b')]?_0xcfd1('0x1c'):'disabled';}return _0xc2f08e;}catch(_0x6be2de){breakingLicense[_0xcfd1('0xd')]=_0x563b59[_0xcfd1('0xe')];breakingLicense['message']=_0x6be2de[_0xcfd1('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2076d9,_0x262371){getLicense()['then'](function(_0x4be7ad){return db[_0xcfd1('0x1e')]['findAll']({'attributes':[_0xcfd1('0x1f'),[db[_0xcfd1('0x20')]['fn'](_0xcfd1('0x21'),db[_0xcfd1('0x20')][_0xcfd1('0x22')]('role')),_0xcfd1('0x23')]],'group':_0xcfd1('0x1f'),'where':{'role':{'$or':['admin',_0xcfd1('0x24'),'telephone']}},'raw':!![]})[_0xcfd1('0xb')](function(_0x56e742){var _0x5332c1={'user':_0x4be7ad['users']||0x0,'telephone':_0x4be7ad[_0xcfd1('0x25')]||0x0};_0x56e742[_0xcfd1('0x26')](function(_0x130740){var _0x198723=_0x130740[_0xcfd1('0x1f')]===_0xcfd1('0x27')?_0xcfd1('0x24'):_0x130740['role'];_0x5332c1[_0x198723]-=_0x130740[_0xcfd1('0x23')];if(_0x5332c1[_0x198723]<0x0)_0x5332c1[_0x198723]=0x0;});_0x2076d9(_0x5332c1);return;});})['catch'](function(_0x258110){_0x262371(_0x258110);});});}function checkUserLimits(_0x2db3c0){return new BPromise(function(_0x2dc808,_0x1c50e0){getLimits()[_0xcfd1('0xb')](function(_0x309357){var _0x67354f=_['pick'](_[_0xcfd1('0x28')](_0x2db3c0,_0xcfd1('0x1f')),[_0xcfd1('0x27'),_0xcfd1('0x24'),_0xcfd1('0x29')]);var _0x97a34f=(_0x67354f[_0xcfd1('0x27')]||0x0)+(_0x67354f[_0xcfd1('0x24')]||0x0);var _0x1b4247=_0x67354f['telephone']||0x0;if(_0x97a34f>_0x309357['user'])return _0x1c50e0('License\x20limit\x20reached\x20for\x20users');if(_0x1b4247>_0x309357[_0xcfd1('0x29')])return _0x1c50e0(_0xcfd1('0x2a'));return _0x2dc808();})[_0xcfd1('0xc')](function(_0x2d01cb){_0x1c50e0(_0x2d01cb);});});}module['exports']={'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 2ab2efd..7eb13e6 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 _0x2357=['secret','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x578ec9,_0x3ec1f3){var _0x5e4fbc=function(_0x2cb592){while(--_0x2cb592){_0x578ec9['push'](_0x578ec9['shift']());}};_0x5e4fbc(++_0x3ec1f3);}(_0x2357,0xa9));var _0x7235=function(_0x527aab,_0x1bb5d8){_0x527aab=_0x527aab-0x0;var _0x549ef1=_0x2357[_0x527aab];return _0x549ef1;};'use strict';module['exports']={'DOMAIN':_0x7235('0x0'),'SESSION_SECRET':_0x7235('0x1'),'GOOGLE_ID':_0x7235('0x2'),'GOOGLE_SECRET':_0x7235('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x5689=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x18b572,_0x843724){var _0x1018c3=function(_0x5d5c76){while(--_0x5d5c76){_0x18b572['push'](_0x18b572['shift']());}};_0x1018c3(++_0x843724);}(_0x5689,0x100));var _0x9568=function(_0x26e25c,_0x316ece){_0x26e25c=_0x26e25c-0x0;var _0x1714f5=_0x5689[_0x26e25c];return _0x1714f5;};'use strict';module[_0x9568('0x0')]={'DOMAIN':_0x9568('0x1'),'SESSION_SECRET':_0x9568('0x2'),'GOOGLE_ID':_0x9568('0x3'),'GOOGLE_SECRET':_0x9568('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 87f0d6f..ae3e405 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8303=['moment','winston','util','path','join','log','format','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','File','%s-%s','error','transports','info','Console','debugLevel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8303,0x150));var _0x3830=function(_0x299560,_0xe15e80){_0x299560=_0x299560-0x0;var _0x214a2b=_0x8303[_0x299560];return _0x214a2b;};'use strict';var moment=require(_0x3830('0x0'));var winston=require(_0x3830('0x1'));var util=require(_0x3830('0x2'));var path=require(_0x3830('0x3'));var debugLevel='INFO';function filename(_0x316d3e,_0x24e9a9){return path[_0x3830('0x4')]('/var',_0x3830('0x5'),'xcally',util[_0x3830('0x6')]('%s-%s.log',_0x316d3e,_0x24e9a9));}function formatter(_0x37b600,_0x3b2155){_0x3b2155[_0x3830('0x7')]=_0x3b2155['message']['replace'](/@@{/g,_0x3830('0x8'))[_0x3830('0x9')](/}@@/g,_0x3830('0xa'))[_0x3830('0x9')](/@{/g,'{{')[_0x3830('0x9')](/}@/g,'}}');return util[_0x3830('0x6')](_0x3830('0xb'),moment()[_0x3830('0x6')](_0x3830('0xc')),_0x3b2155[_0x3830('0xd')][_0x3830('0xe')](),_0x37b600,_0x3b2155[_0x3830('0x7')]);}module[_0x3830('0xf')]=function(_0x5afa90){return new winston[(_0x3830('0x10'))]({'transports':[new winston['transports'][(_0x3830('0x11'))]({'name':util[_0x3830('0x6')](_0x3830('0x12'),_0x5afa90,_0x3830('0x13')),'filename':filename(_0x5afa90,_0x3830('0x13')),'level':_0x3830('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2ad81e){return formatter(_0x5afa90,_0x2ad81e);}}),new winston[(_0x3830('0x14'))]['File']({'name':util['format'](_0x3830('0x12'),_0x5afa90,'info'),'filename':filename(_0x5afa90,_0x3830('0x15')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5d091c){return formatter(_0x5afa90,_0x5d091c);}}),new winston[(_0x3830('0x14'))][(_0x3830('0x16'))]({'level':process['env'][_0x3830('0x17')]||debugLevel,'json':![],'formatter':function(_0x1820d8){return formatter(_0x5afa90,_0x1820d8);}})]});}; \ No newline at end of file +var _0x9d3f=['format','message','replace','}}}','level','toUpperCase','exports','Logger','transports','File','error','info','Console','env','moment','winston','util','path','INFO','/var','log','xcally'];(function(_0x280238,_0x5bae70){var _0x13855f=function(_0x112657){while(--_0x112657){_0x280238['push'](_0x280238['shift']());}};_0x13855f(++_0x5bae70);}(_0x9d3f,0x66));var _0xf9d3=function(_0x3a7a97,_0x5a7b7e){_0x3a7a97=_0x3a7a97-0x0;var _0x399c66=_0x9d3f[_0x3a7a97];return _0x399c66;};'use strict';var moment=require(_0xf9d3('0x0'));var winston=require(_0xf9d3('0x1'));var util=require(_0xf9d3('0x2'));var path=require(_0xf9d3('0x3'));var debugLevel=_0xf9d3('0x4');function filename(_0x7ec1e1,_0x4f04ef){return path['join'](_0xf9d3('0x5'),_0xf9d3('0x6'),_0xf9d3('0x7'),util[_0xf9d3('0x8')]('%s-%s.log',_0x7ec1e1,_0x4f04ef));}function formatter(_0x2dc78b,_0x4a0152){_0x4a0152['message']=_0x4a0152[_0xf9d3('0x9')][_0xf9d3('0xa')](/@@{/g,'{{{')[_0xf9d3('0xa')](/}@@/g,_0xf9d3('0xb'))[_0xf9d3('0xa')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xf9d3('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),_0x4a0152[_0xf9d3('0xc')][_0xf9d3('0xd')](),_0x2dc78b,_0x4a0152[_0xf9d3('0x9')]);}module[_0xf9d3('0xe')]=function(_0xefbd01){return new winston[(_0xf9d3('0xf'))]({'transports':[new winston[(_0xf9d3('0x10'))][(_0xf9d3('0x11'))]({'name':util[_0xf9d3('0x8')]('%s-%s',_0xefbd01,'error'),'filename':filename(_0xefbd01,_0xf9d3('0x12')),'level':_0xf9d3('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x470972){return formatter(_0xefbd01,_0x470972);}}),new winston[(_0xf9d3('0x10'))][(_0xf9d3('0x11'))]({'name':util[_0xf9d3('0x8')]('%s-%s',_0xefbd01,_0xf9d3('0x13')),'filename':filename(_0xefbd01,'info'),'level':_0xf9d3('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3d6d17){return formatter(_0xefbd01,_0x3d6d17);}}),new winston[(_0xf9d3('0x10'))][(_0xf9d3('0x14'))]({'level':process[_0xf9d3('0x15')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x27e894){return formatter(_0xefbd01,_0x27e894);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 25d4a25..f78380c 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 _0xf2ae=['path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','exports'];(function(_0x3eb955,_0x744e76){var _0x3122d2=function(_0x3a6356){while(--_0x3a6356){_0x3eb955['push'](_0x3eb955['shift']());}};_0x3122d2(++_0x744e76);}(_0xf2ae,0xe4));var _0xef2a=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xf2ae[_0x255d5b];return _0x3e141a;};'use strict';var path=require(_0xef2a('0x0'));var os=require('os');var config={'apps':[{'name':_0xef2a('0x1'),'script':path[_0xef2a('0x2')](__dirname,_0xef2a('0x3'))},{'name':_0xef2a('0x4'),'script':path[_0xef2a('0x2')](__dirname,_0xef2a('0x5'))},{'name':'agi','script':path[_0xef2a('0x2')](__dirname,_0xef2a('0x6'))},{'name':'email','script':path[_0xef2a('0x2')](__dirname,_0xef2a('0x7'))},{'name':_0xef2a('0x8'),'script':path[_0xef2a('0x2')](__dirname,_0xef2a('0x9'))},{'name':'xdr','script':path['join'](__dirname,_0xef2a('0xa'))}]};module[_0xef2a('0xb')]=config; \ No newline at end of file +var _0xdf0a=['routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdf0a,0x1a9));var _0xadf0=function(_0x4452f1,_0x321d0d){_0x4452f1=_0x4452f1-0x0;var _0x36e290=_0xdf0a[_0x4452f1];return _0x36e290;};'use strict';var path=require(_0xadf0('0x0'));var os=require('os');var config={'apps':[{'name':_0xadf0('0x1'),'script':path[_0xadf0('0x2')](__dirname,_0xadf0('0x3'))},{'name':_0xadf0('0x4'),'script':path['join'](__dirname,_0xadf0('0x5'))},{'name':'agi','script':path['join'](__dirname,_0xadf0('0x6'))},{'name':_0xadf0('0x7'),'script':path['join'](__dirname,_0xadf0('0x8'))},{'name':_0xadf0('0x9'),'script':path[_0xadf0('0x2')](__dirname,_0xadf0('0xa'))},{'name':_0xadf0('0xb'),'script':path[_0xadf0('0x2')](__dirname,_0xadf0('0xc'))}]};module[_0xadf0('0xd')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 36e9c39..386bb21 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 _0xe700=['connect','connected','start','disconnect','stop','then','restart','list','describe','delete','dump','saved','pm2','bluebird','./config'];(function(_0x44c62a,_0x39cc48){var _0x520984=function(_0x46e2f3){while(--_0x46e2f3){_0x44c62a['push'](_0x44c62a['shift']());}};_0x520984(++_0x39cc48);}(_0xe700,0x75));var _0x0e70=function(_0x3ccd37,_0x397616){_0x3ccd37=_0x3ccd37-0x0;var _0x226fb4=_0xe700[_0x3ccd37];return _0x226fb4;};'use strict';var pm2=require(_0x0e70('0x0'));var BPromise=require(_0x0e70('0x1'));var config=require(_0x0e70('0x2'));function connect(){return new BPromise(function(_0x349855,_0x22ef20){return pm2[_0x0e70('0x3')](function(_0x3f212c){if(_0x3f212c){return _0x22ef20(_0x3f212c);}return _0x349855(_0x0e70('0x4'));});});};exports[_0x0e70('0x5')]=function(_0xb9349a){return connect()['then'](function(){return new BPromise(function(_0x4be34a,_0x5e1b28){return pm2[_0x0e70('0x5')](_0xb9349a,function(_0x30303a,_0x1ea6ad){if(_0x30303a){return _0x5e1b28(_0x30303a);}pm2[_0x0e70('0x6')]();return _0x4be34a(_0x1ea6ad);});});});};exports[_0x0e70('0x7')]=function(_0x348326){return connect()[_0x0e70('0x8')](function(){return new BPromise(function(_0x32d16c,_0x46f046){return pm2[_0x0e70('0x7')](_0x348326,function(_0x1332a2,_0x32a108){if(_0x1332a2){return _0x46f046(_0x1332a2);}pm2[_0x0e70('0x6')]();return _0x32d16c(_0x32a108);});});});};exports[_0x0e70('0x9')]=function(_0x8a3776){return connect()['then'](function(){return new BPromise(function(_0x39eb74,_0x145ae6){return pm2[_0x0e70('0x9')](_0x8a3776,function(_0x50924a,_0x154a94){if(_0x50924a){return _0x145ae6(_0x50924a);}pm2[_0x0e70('0x6')]();return _0x39eb74(_0x154a94);});});});};exports[_0x0e70('0xa')]=function(){return connect()[_0x0e70('0x8')](function(){return new BPromise(function(_0x4de2df,_0x1051ce){return pm2[_0x0e70('0xa')](function(_0x30660e,_0x58a533){if(_0x30660e){return _0x1051ce(_0x30660e);}pm2['disconnect']();return _0x4de2df(_0x58a533);});});});};exports[_0x0e70('0xb')]=function(_0x4b3e5f){return connect()[_0x0e70('0x8')](function(){return new BPromise(function(_0x11af6e,_0x41cb06){return pm2[_0x0e70('0xb')](_0x4b3e5f,function(_0x4bc3a4,_0x2993f2){if(_0x4bc3a4){return _0x41cb06(_0x4bc3a4);}pm2[_0x0e70('0x6')]();return _0x11af6e(_0x2993f2);});});});};exports[_0x0e70('0xc')]=function(_0x690fae){return connect()[_0x0e70('0x8')](function(){return new BPromise(function(_0x26d7fe,_0x5a6206){return pm2[_0x0e70('0xc')](_0x690fae,function(_0x332148,_0x4ce43f){if(_0x332148){return _0x5a6206(_0x332148);}pm2[_0x0e70('0x6')]();return _0x26d7fe(_0x4ce43f);});});});};exports[_0x0e70('0xd')]=function(){return connect()[_0x0e70('0x8')](function(){return new BPromise(function(_0x32fba8,_0x5004ba){return pm2[_0x0e70('0xd')](function(_0x368216){if(_0x368216){return _0x5004ba(_0x368216);}return _0x32fba8(_0x0e70('0xe'));});});});}; \ No newline at end of file +var _0xcd0d=['dump','saved','pm2','bluebird','./config','start','then','disconnect','restart','list','describe','delete'];(function(_0x260394,_0x2e0334){var _0x1e0c0e=function(_0x1ee1e0){while(--_0x1ee1e0){_0x260394['push'](_0x260394['shift']());}};_0x1e0c0e(++_0x2e0334);}(_0xcd0d,0x10a));var _0xdcd0=function(_0x3b8a26,_0x168cc4){_0x3b8a26=_0x3b8a26-0x0;var _0x31bafd=_0xcd0d[_0x3b8a26];return _0x31bafd;};'use strict';var pm2=require(_0xdcd0('0x0'));var BPromise=require(_0xdcd0('0x1'));var config=require(_0xdcd0('0x2'));function connect(){return new BPromise(function(_0x27becf,_0x415646){return pm2['connect'](function(_0x5c7f7b){if(_0x5c7f7b){return _0x415646(_0x5c7f7b);}return _0x27becf('connected');});});};exports[_0xdcd0('0x3')]=function(_0x5f431f){return connect()[_0xdcd0('0x4')](function(){return new BPromise(function(_0x70ea2e,_0x782b28){return pm2[_0xdcd0('0x3')](_0x5f431f,function(_0x3534a0,_0x45b67a){if(_0x3534a0){return _0x782b28(_0x3534a0);}pm2['disconnect']();return _0x70ea2e(_0x45b67a);});});});};exports['stop']=function(_0x5717d9){return connect()[_0xdcd0('0x4')](function(){return new BPromise(function(_0xe64966,_0x5d898d){return pm2['stop'](_0x5717d9,function(_0xbda5f7,_0x3e848d){if(_0xbda5f7){return _0x5d898d(_0xbda5f7);}pm2[_0xdcd0('0x5')]();return _0xe64966(_0x3e848d);});});});};exports[_0xdcd0('0x6')]=function(_0x10ba0d){return connect()[_0xdcd0('0x4')](function(){return new BPromise(function(_0x37ea49,_0x2fda6a){return pm2['restart'](_0x10ba0d,function(_0x30c702,_0x30cbff){if(_0x30c702){return _0x2fda6a(_0x30c702);}pm2[_0xdcd0('0x5')]();return _0x37ea49(_0x30cbff);});});});};exports[_0xdcd0('0x7')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3a6920,_0x59dc4f){return pm2[_0xdcd0('0x7')](function(_0x5c1640,_0x2a4bf1){if(_0x5c1640){return _0x59dc4f(_0x5c1640);}pm2['disconnect']();return _0x3a6920(_0x2a4bf1);});});});};exports[_0xdcd0('0x8')]=function(_0x3ec4f7){return connect()[_0xdcd0('0x4')](function(){return new BPromise(function(_0x5a4584,_0x488387){return pm2['describe'](_0x3ec4f7,function(_0x5557c4,_0x55d72b){if(_0x5557c4){return _0x488387(_0x5557c4);}pm2['disconnect']();return _0x5a4584(_0x55d72b);});});});};exports[_0xdcd0('0x9')]=function(_0x4da58f){return connect()[_0xdcd0('0x4')](function(){return new BPromise(function(_0x1172bc,_0x10bf00){return pm2[_0xdcd0('0x9')](_0x4da58f,function(_0x18e9d5,_0x2d8e5d){if(_0x18e9d5){return _0x10bf00(_0x18e9d5);}pm2['disconnect']();return _0x1172bc(_0x2d8e5d);});});});};exports[_0xdcd0('0xa')]=function(){return connect()[_0xdcd0('0x4')](function(){return new BPromise(function(_0x121dc6,_0x251513){return pm2[_0xdcd0('0xa')](function(_0x3b2262){if(_0x3b2262){return _0x251513(_0x3b2262);}return _0x121dc6(_0xdcd0('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 1a12d24..21efcbc 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 _0xc946=['join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','../../config/environment','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','length','info','[CHAT]\x20Interactions\x20to\x20close:'];(function(_0x5e59b3,_0x307395){var _0x12da4c=function(_0x141c1a){while(--_0x141c1a){_0x5e59b3['push'](_0x5e59b3['shift']());}};_0x12da4c(++_0x307395);}(_0xc946,0xc1));var _0x6c94=function(_0x5c7534,_0x401153){_0x5c7534=_0x5c7534-0x0;var _0x5e574a=_0xc946[_0x5c7534];return _0x5e574a;};'use strict';var _=require('lodash');var moment=require(_0x6c94('0x0'));var Redis=require('ioredis');var util=require('util');var config=require(_0x6c94('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../logger')('schedule');config[_0x6c94('0x2')]=_['defaults'](config[_0x6c94('0x2')],{'host':_0x6c94('0x3'),'port':0x18eb});var io=require(_0x6c94('0x4'))(new Redis(config[_0x6c94('0x2')]));function closeInteractions(){var _0x47b65c=0x0;var _0x1732a6=[];return db[_0x6c94('0x5')][_0x6c94('0x6')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x43f6c8){_0x47b65c=_0x43f6c8[_0x6c94('0x7')];if(_0x47b65c){return db[_0x6c94('0x8')][_0x6c94('0x9')]({'raw':!![],'attributes':['id',_0x6c94('0xa')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6c94('0xb')](_0x43f6c8['chatTimeout'],_0x6c94('0xc'))}}});}else{return[];}})[_0x6c94('0xd')](function(_0x17ddc5){if(_0x17ddc5&&_0x17ddc5[_0x6c94('0xe')]){_0x1732a6=_['map'](_0x17ddc5||[],'id');logger[_0x6c94('0xf')](_0x6c94('0x10'),_0x1732a6[_0x6c94('0x11')]());return db[_0x6c94('0x8')][_0x6c94('0x12')]({'closeReason':_0x6c94('0x13'),'disposition':_0x6c94('0x14'),'closed':!![],'closedAt':moment()[_0x6c94('0x15')](_0x6c94('0x16'))},{'where':{'id':_0x1732a6}});}})[_0x6c94('0xd')](function(){if(_0x1732a6&&_0x1732a6['length']){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x1732a6[_0x6c94('0x11')]());for(var _0x1ad023=0x0;_0x1ad023<_0x1732a6[_0x6c94('0xe')];_0x1ad023++){io[_0x6c94('0x17')](_0x6c94('0x18'),{'id':_0x1732a6[_0x1ad023],'closed':!![]});}}})[_0x6c94('0x19')](function(_0x309752){logger[_0x6c94('0x1a')](_0x6c94('0x1b'),_0x309752?util[_0x6c94('0x1c')](_0x309752,{'showHidden':![],'depth':null}):'');});}exports[_0x6c94('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xf53c=['chatTimeout','ChatInteraction','findAll','lastMsgAt','then','map','info','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','find'];(function(_0x10803d,_0x12bd47){var _0x4de8e1=function(_0x4e1ae7){while(--_0x4e1ae7){_0x10803d['push'](_0x10803d['shift']());}};_0x4de8e1(++_0x12bd47);}(_0xf53c,0x1c2));var _0xcf53=function(_0x37d2ae,_0x5bf623){_0x37d2ae=_0x37d2ae-0x0;var _0x1616cd=_0xf53c[_0x37d2ae];return _0x1616cd;};'use strict';var _=require(_0xcf53('0x0'));var moment=require(_0xcf53('0x1'));var Redis=require(_0xcf53('0x2'));var util=require(_0xcf53('0x3'));var config=require(_0xcf53('0x4'));var db=require(_0xcf53('0x5'))['db'];var logger=require(_0xcf53('0x6'))(_0xcf53('0x7'));config[_0xcf53('0x8')]=_['defaults'](config['redis'],{'host':_0xcf53('0x9'),'port':0x18eb});var io=require(_0xcf53('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x7f231b=0x0;var _0x488f86=[];return db['Setting'][_0xcf53('0xb')]({'raw':!![],'attributes':['id',_0xcf53('0xc')],'where':{'id':0x1}})['then'](function(_0x599c62){_0x7f231b=_0x599c62[_0xcf53('0xc')];if(_0x7f231b){return db[_0xcf53('0xd')][_0xcf53('0xe')]({'raw':!![],'attributes':['id',_0xcf53('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x599c62[_0xcf53('0xc')],'minutes')}}});}else{return[];}})[_0xcf53('0x10')](function(_0x2139cd){if(_0x2139cd&&_0x2139cd['length']){_0x488f86=_[_0xcf53('0x11')](_0x2139cd||[],'id');logger[_0xcf53('0x12')]('[CHAT]\x20Interactions\x20to\x20close:',_0x488f86['join']());return db[_0xcf53('0xd')][_0xcf53('0x13')]({'closeReason':_0xcf53('0x14'),'disposition':_0xcf53('0x15'),'closed':!![],'closedAt':moment()[_0xcf53('0x16')](_0xcf53('0x17'))},{'where':{'id':_0x488f86}});}})['then'](function(){if(_0x488f86&&_0x488f86[_0xcf53('0x18')]){logger[_0xcf53('0x12')](_0xcf53('0x19'),_0x488f86[_0xcf53('0x1a')]());for(var _0x46b86a=0x0;_0x46b86a<_0x488f86[_0xcf53('0x18')];_0x46b86a++){io[_0xcf53('0x1b')](_0xcf53('0x1c'),{'id':_0x488f86[_0x46b86a],'closed':!![]});}}})[_0xcf53('0x1d')](function(_0x5160f8){logger[_0xcf53('0x1e')](_0xcf53('0x1f'),_0x5160f8?util[_0xcf53('0x20')](_0x5160f8,{'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/schedule/index.js b/server/config/schedule/index.js index 4e7d703..a0ec794 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 _0xee53=['run\x20job','cron','active','isBetween','startAt','endAt','add','start','stop','update','update\x20cron','stop\x20cron','run','util','lodash','moment','cron-job-manager','bluebird','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','name','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','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','Sent','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','data','isNil','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','catch','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','keyBy','toString','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','index','resolve'];(function(_0x447f7e,_0x37e2fb){var _0x71dc45=function(_0x4fc47a){while(--_0x4fc47a){_0x447f7e['push'](_0x447f7e['shift']());}};_0x71dc45(++_0x37e2fb);}(_0xee53,0x67));var _0x3ee5=function(_0x26721d,_0x448ba5){_0x26721d=_0x26721d-0x0;var _0x1035c5=_0xee53[_0x26721d];return _0x1035c5;};'use strict';var fs=require('fs');var util=require(_0x3ee5('0x0'));var path=require('path');var _=require(_0x3ee5('0x1'));var moment=require(_0x3ee5('0x2'));var CronJobManager=require(_0x3ee5('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x3ee5('0x4'));var logger=require('../logger')(_0x3ee5('0x5'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x3ee5('0x6'));var analyticDefaultReportController=require(_0x3ee5('0x7'));var client=jayson[_0x3ee5('0x8')][_0x3ee5('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2d3f7c,_0x2000cb){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x2d3f7c['email']);var _0x708c72=!![];var _0x230482={'tls':{'rejectUnauthorized':![]}};if(_0x2d3f7c[_0x3ee5('0xa')][_0x3ee5('0xb')][_0x3ee5('0xc')]){_0x230482[_0x3ee5('0xc')]=_0x2d3f7c[_0x3ee5('0xa')][_0x3ee5('0xb')][_0x3ee5('0xc')];}else{_0x230482[_0x3ee5('0xd')]=_0x2d3f7c[_0x3ee5('0xa')][_0x3ee5('0xb')][_0x3ee5('0xd')];_0x230482[_0x3ee5('0xe')]=_0x2d3f7c[_0x3ee5('0xa')][_0x3ee5('0xb')][_0x3ee5('0xe')];_0x230482[_0x3ee5('0xf')]=_0x2d3f7c[_0x3ee5('0xa')][_0x3ee5('0xb')][_0x3ee5('0xf')];}if(_0x2d3f7c[_0x3ee5('0xa')][_0x3ee5('0xb')][_0x3ee5('0x10')]){_0x230482[_0x3ee5('0x11')]={'user':_0x2d3f7c[_0x3ee5('0xa')][_0x3ee5('0xb')][_0x3ee5('0x12')],'pass':_0x2d3f7c[_0x3ee5('0xa')][_0x3ee5('0xb')][_0x3ee5('0x13')]};}var _0x592ee4={'account':_0x230482,'message':{'from':util[_0x3ee5('0x14')]('\x22%s\x22\x20<%s>',_0x2d3f7c[_0x3ee5('0xa')][_0x3ee5('0x15')],_0x2d3f7c[_0x3ee5('0xa')]['email']||_0x2d3f7c['MailAccount']['Smtp'][_0x3ee5('0x12')]),'to':_0x2d3f7c[_0x3ee5('0x16')],'cc':_0x2d3f7c['cc'],'bcc':_0x2d3f7c[_0x3ee5('0x17')],'subject':util['format'](_0x3ee5('0x18'),_0x2000cb[_0x3ee5('0x15')],_0x2d3f7c[_0x3ee5('0x19')],_0x2d3f7c[_0x3ee5('0x1a')])}};var _0x1b81b4=path[_0x3ee5('0x1b')](__dirname,_0x3ee5('0x1c'));var _0x5d65a4=_0x2000cb[_0x3ee5('0x1d')];var _0x5a41cf=util['format'](_0x3ee5('0x1e'),path[_0x3ee5('0x1f')](_0x2000cb[_0x3ee5('0x1d')],path[_0x3ee5('0x20')](_0x2000cb['savename'])),_0x3ee5('0x21'));var _0x58cdc7=path[_0x3ee5('0x1b')](_0x1b81b4,_0x5d65a4);var _0x39b727=path[_0x3ee5('0x1b')](_0x1b81b4,_0x5a41cf);if(fs[_0x3ee5('0x22')](_0x58cdc7)){_0x2000cb[_0x3ee5('0x23')]='Sent';_0x592ee4[_0x3ee5('0x24')]['attachments']=[{'filename':_0x5d65a4,'path':_0x58cdc7}];_0x592ee4[_0x3ee5('0x24')][_0x3ee5('0x25')]=util[_0x3ee5('0x14')](_0x3ee5('0x26'),JSON[_0x3ee5('0x27')](_0x2000cb,null,0x2));}else if(fs[_0x3ee5('0x22')](_0x39b727)){_0x2000cb['status']=_0x3ee5('0x28');_0x592ee4[_0x3ee5('0x24')][_0x3ee5('0x29')]=[{'filename':_0x5a41cf,'path':_0x39b727}];}else{_0x592ee4['message'][_0x3ee5('0x25')]=_0x3ee5('0x2a');if(!_0x2d3f7c['sendIfEmpty']){_0x708c72=![];logger[_0x3ee5('0x2b')](_0x3ee5('0x2c'));}}if(_0x708c72){return client[_0x3ee5('0x2d')](_0x3ee5('0x2e'),_0x592ee4)[_0x3ee5('0x2f')](function(_0x202e51){if(_0x202e51['error']){return logger[_0x3ee5('0x30')](_0x3ee5('0x31'),JSON[_0x3ee5('0x27')](_0x202e51));}return logger[_0x3ee5('0x2b')]('email\x20sent');})['catch'](function(_0xbe9ef3){return logger[_0x3ee5('0x30')](_0x3ee5('0x31'),JSON[_0x3ee5('0x27')](_0xbe9ef3));});}};}function handleError(){return function(_0x1102dc){return logger['error'](JSON[_0x3ee5('0x27')](_0x1102dc));};}function handleResult(_0x4ae1d0){return function(_0x5ce1ff){logger[_0x3ee5('0x2b')](_0x3ee5('0x32'),JSON['stringify'](_0x5ce1ff));if(_0x4ae1d0[_0x3ee5('0xa')]&&_0x4ae1d0[_0x3ee5('0xa')][_0x3ee5('0xb')]&&!_[_0x3ee5('0x33')](_0x4ae1d0[_0x3ee5('0x16')])){setTimeout(handleSendEmail(_0x4ae1d0,_0x5ce1ff),0x3c*0x3e8);}};}function handleJob(_0x925381){return function(){try{if(_[_0x3ee5('0x33')](_0x925381[_0x3ee5('0x19')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x925381[_0x3ee5('0x1a')])){return logger['info'](_0x3ee5('0x34'));}var _0x1235a1={'startDate':moment()['subtract'](_0x925381[_0x3ee5('0x19')],_0x925381[_0x3ee5('0x1a')])[_0x3ee5('0x14')](_0x3ee5('0x35')),'endDate':moment()[_0x3ee5('0x14')](_0x3ee5('0x35')),'type':'scheduled','output':_0x925381['output'],'name':_0x925381[_0x3ee5('0x15')]};if(!_[_0x3ee5('0x33')](_0x925381[_0x3ee5('0x36')])){logger[_0x3ee5('0x2b')](_0x3ee5('0x37'),_0x925381[_0x3ee5('0x36')]);return analyticDefaultReportController[_0x3ee5('0x38')]({'id':_0x925381[_0x3ee5('0x36')]},_0x1235a1)[_0x3ee5('0x2f')](handleResult(_0x925381))['catch'](handleError());}if(!_[_0x3ee5('0x33')](_0x925381['CustomReportId'])){logger[_0x3ee5('0x2b')](_0x3ee5('0x39'),_0x925381[_0x3ee5('0x3a')]);return analyticCustomReportController[_0x3ee5('0x38')]({'id':_0x925381['CustomReportId']},_0x1235a1)[_0x3ee5('0x2f')](handleResult(_0x925381))[_0x3ee5('0x3b')](handleError());}}catch(_0x1c0db3){logger[_0x3ee5('0x30')](JSON[_0x3ee5('0x27')](_0x1c0db3));}return logger['info'](_0x3ee5('0x3c'));};}function getJobs(_0x5c94fd){var _0x3f6f3d={};if(_0x5c94fd){_0x3f6f3d['id']=_0x5c94fd;}return db[_0x3ee5('0x3d')][_0x3ee5('0x3e')]({'where':_0x3f6f3d,'include':[{'model':db[_0x3ee5('0xa')],'attributes':['id',_0x3ee5('0x15'),_0x3ee5('0x16')],'include':[{'model':db[_0x3ee5('0x3f')],'as':_0x3ee5('0xb')}]}]})[_0x3ee5('0x2f')](function(_0x307c87){var _0x57699c=_[_0x3ee5('0x40')](manager[_0x3ee5('0x41')]);var _0x2ec620=_['map'](_0x307c87,function(_0x15326f){return _0x15326f['id']['toString']();});var _0x384782=_[_0x3ee5('0x42')](_0x307c87,function(_0x14d6d6){return _0x14d6d6['id'][_0x3ee5('0x43')]();});var _0x3bd44a=_0x5c94fd?_0x2ec620:_[_0x3ee5('0x44')](_0x2ec620,_0x57699c);var _0x205678=_[_0x3ee5('0x45')](_0x2ec620,_0x57699c);var _0x30eda0=_[_0x3ee5('0x44')](_0x57699c,_0x2ec620);var _0x44dd2d;var _0x25e5c9;for(_0x44dd2d=0x0;_0x44dd2d<_0x30eda0[_0x3ee5('0x46')]&&!_0x5c94fd;_0x44dd2d+=0x1){_0x25e5c9=_0x30eda0[_0x44dd2d]['toString']();if(manager[_0x3ee5('0x47')](_0x25e5c9)){manager['stop'](_0x25e5c9);manager[_0x3ee5('0x48')](_0x25e5c9);logger[_0x3ee5('0x2b')](_0x3ee5('0x49'),_0x25e5c9);}}logger[_0x3ee5('0x2b')](_0x3ee5('0x4a'),JSON[_0x3ee5('0x27')](_0x3bd44a));for(_0x44dd2d=0x0;_0x44dd2d<_0x3bd44a[_0x3ee5('0x46')];_0x44dd2d+=0x1){_0x25e5c9=_0x3bd44a[_0x44dd2d][_0x3ee5('0x43')]();logger[_0x3ee5('0x2b')](_0x3ee5('0x4b'),_0x25e5c9);if(_0x5c94fd){logger['info']('my\x20id',_0x5c94fd);logger[_0x3ee5('0x2b')](JSON[_0x3ee5('0x27')](_0x384782[_0x25e5c9]));BPromise[_0x3ee5('0x4c')]()['then'](handleJob(_0x384782[_0x25e5c9]));logger['info'](_0x3ee5('0x4d'),_0x384782[_0x25e5c9]['name'],_0x384782[_0x25e5c9][_0x3ee5('0x4e')]);}else if(_0x384782[_0x25e5c9]['cron']&&_0x384782[_0x25e5c9][_0x3ee5('0x4f')]&&moment()[_0x3ee5('0x50')](_0x384782[_0x25e5c9][_0x3ee5('0x51')],_0x384782[_0x25e5c9][_0x3ee5('0x52')])){manager[_0x3ee5('0x53')](_0x25e5c9,_0x384782[_0x25e5c9][_0x3ee5('0x4e')],handleJob(_0x384782[_0x25e5c9]));manager[_0x3ee5('0x54')](_0x25e5c9);logger['info']('add\x20cron',_0x384782[_0x25e5c9][_0x3ee5('0x15')],_0x384782[_0x25e5c9][_0x3ee5('0x4e')]);}else if(manager[_0x3ee5('0x47')](_0x25e5c9)){manager[_0x3ee5('0x55')](_0x25e5c9);manager[_0x3ee5('0x48')](_0x25e5c9);logger[_0x3ee5('0x2b')]('stop\x20cron',_0x384782[_0x25e5c9][_0x3ee5('0x15')],_0x384782[_0x25e5c9][_0x3ee5('0x4e')]);}}for(_0x44dd2d=0x0,_0x25e5c9;_0x44dd2d<_0x205678[_0x3ee5('0x46')]&&!_0x5c94fd;_0x44dd2d+=0x1){_0x25e5c9=_0x205678[_0x44dd2d][_0x3ee5('0x43')]();if(manager['exists'](_0x25e5c9)){if(_0x384782[_0x25e5c9][_0x3ee5('0x4e')]&&_0x384782[_0x25e5c9][_0x3ee5('0x4f')]&&moment()[_0x3ee5('0x50')](_0x384782[_0x25e5c9][_0x3ee5('0x51')],_0x384782[_0x25e5c9][_0x3ee5('0x52')])){manager[_0x3ee5('0x56')](_0x25e5c9,_0x384782[_0x25e5c9]['cron'],handleJob(_0x384782[_0x25e5c9]));logger[_0x3ee5('0x2b')](_0x3ee5('0x57'),_0x384782[_0x25e5c9][_0x3ee5('0x15')],_0x384782[_0x25e5c9][_0x3ee5('0x4e')]);}else{manager['stop'](_0x25e5c9);manager[_0x3ee5('0x48')](_0x25e5c9);logger[_0x3ee5('0x2b')](_0x3ee5('0x58'),_0x384782[_0x25e5c9][_0x3ee5('0x15')],_0x384782[_0x25e5c9][_0x3ee5('0x4e')]);}}}})[_0x3ee5('0x3b')](function(_0x4defa7){logger['error'](JSON[_0x3ee5('0x27')](_0x4defa7));});}exports[_0x3ee5('0x59')]=function(_0x470441){return getJobs(_0x470441);};exports[_0x3ee5('0x54')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xe0c6=['runReport','DefaultReportId','then','CustomReportId','Schedule','findAll','MailServerOut','keys','map','keyBy','toString','difference','intersection','length','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','add','start','exists','update','update\x20cron','run','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','host','port','MailAccount','secure','auth','user','pass','format','\x22%s\x22\x20<%s>','name','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','basename','savename','extname','zip','existsSync','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','status','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output'];(function(_0x1e767b,_0x356fb4){var _0x847c05=function(_0x1aa115){while(--_0x1aa115){_0x1e767b['push'](_0x1e767b['shift']());}};_0x847c05(++_0x356fb4);}(_0xe0c6,0x188));var _0x6e0c=function(_0x16a24f,_0xb211c3){_0x16a24f=_0x16a24f-0x0;var _0x53de27=_0xe0c6[_0x16a24f];return _0x53de27;};'use strict';var fs=require('fs');var util=require(_0x6e0c('0x0'));var path=require('path');var _=require(_0x6e0c('0x1'));var moment=require(_0x6e0c('0x2'));var CronJobManager=require(_0x6e0c('0x3'));var jayson=require(_0x6e0c('0x4'));var BPromise=require(_0x6e0c('0x5'));var logger=require(_0x6e0c('0x6'))(_0x6e0c('0x7'));var db=require(_0x6e0c('0x8'))['db'];var analyticCustomReportController=require(_0x6e0c('0x9'));var analyticDefaultReportController=require(_0x6e0c('0xa'));var client=jayson[_0x6e0c('0xb')][_0x6e0c('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x11028c,_0x7d9def){return function(){logger[_0x6e0c('0xd')](_0x6e0c('0xe'),_0x11028c[_0x6e0c('0xf')]);var _0x3c2c74=!![];var _0x5ad36a={'tls':{'rejectUnauthorized':![]}};if(_0x11028c['MailAccount'][_0x6e0c('0x10')]['service']){_0x5ad36a[_0x6e0c('0x11')]=_0x11028c['MailAccount'][_0x6e0c('0x10')][_0x6e0c('0x11')];}else{_0x5ad36a[_0x6e0c('0x12')]=_0x11028c['MailAccount'][_0x6e0c('0x10')]['host'];_0x5ad36a[_0x6e0c('0x13')]=_0x11028c[_0x6e0c('0x14')]['Smtp'][_0x6e0c('0x13')];_0x5ad36a[_0x6e0c('0x15')]=_0x11028c[_0x6e0c('0x14')][_0x6e0c('0x10')][_0x6e0c('0x15')];}if(_0x11028c[_0x6e0c('0x14')][_0x6e0c('0x10')]['authentication']){_0x5ad36a[_0x6e0c('0x16')]={'user':_0x11028c[_0x6e0c('0x14')][_0x6e0c('0x10')][_0x6e0c('0x17')],'pass':_0x11028c[_0x6e0c('0x14')][_0x6e0c('0x10')][_0x6e0c('0x18')]};}var _0x29cddf={'account':_0x5ad36a,'message':{'from':util[_0x6e0c('0x19')](_0x6e0c('0x1a'),_0x11028c[_0x6e0c('0x14')]['name'],_0x11028c[_0x6e0c('0x14')][_0x6e0c('0xf')]||_0x11028c['MailAccount']['Smtp'][_0x6e0c('0x17')]),'to':_0x11028c[_0x6e0c('0xf')],'cc':_0x11028c['cc'],'bcc':_0x11028c['bcc'],'subject':util[_0x6e0c('0x19')]('Report\x20%s\x20last\x20%s\x20%s',_0x7d9def[_0x6e0c('0x1b')],_0x11028c[_0x6e0c('0x1c')],_0x11028c[_0x6e0c('0x1d')])}};var _0x5b8062=path[_0x6e0c('0x1e')](__dirname,_0x6e0c('0x1f'));var _0x314d39=_0x7d9def['savename'];var _0x5b613b=util[_0x6e0c('0x19')](_0x6e0c('0x20'),path[_0x6e0c('0x21')](_0x7d9def[_0x6e0c('0x22')],path[_0x6e0c('0x23')](_0x7d9def[_0x6e0c('0x22')])),_0x6e0c('0x24'));var _0x9f5fb1=path[_0x6e0c('0x1e')](_0x5b8062,_0x314d39);var _0x1bee2f=path[_0x6e0c('0x1e')](_0x5b8062,_0x5b613b);if(fs[_0x6e0c('0x25')](_0x9f5fb1)){_0x7d9def['status']=_0x6e0c('0x26');_0x29cddf[_0x6e0c('0x27')]['attachments']=[{'filename':_0x314d39,'path':_0x9f5fb1}];_0x29cddf[_0x6e0c('0x27')][_0x6e0c('0x28')]=util[_0x6e0c('0x19')](_0x6e0c('0x29'),JSON[_0x6e0c('0x2a')](_0x7d9def,null,0x2));}else if(fs[_0x6e0c('0x25')](_0x1bee2f)){_0x7d9def[_0x6e0c('0x2b')]=_0x6e0c('0x26');_0x29cddf[_0x6e0c('0x27')][_0x6e0c('0x2c')]=[{'filename':_0x5b613b,'path':_0x1bee2f}];}else{_0x29cddf[_0x6e0c('0x27')]['text']=_0x6e0c('0x2d');if(!_0x11028c['sendIfEmpty']){_0x3c2c74=![];logger[_0x6e0c('0xd')](_0x6e0c('0x2e'));}}if(_0x3c2c74){return client[_0x6e0c('0x2f')](_0x6e0c('0x30'),_0x29cddf)['then'](function(_0x50e4c7){if(_0x50e4c7[_0x6e0c('0x31')]){return logger[_0x6e0c('0x31')](_0x6e0c('0x32'),JSON['stringify'](_0x50e4c7));}return logger[_0x6e0c('0xd')]('email\x20sent');})[_0x6e0c('0x33')](function(_0x5f18ba){return logger[_0x6e0c('0x31')](_0x6e0c('0x32'),JSON['stringify'](_0x5f18ba));});}};}function handleError(){return function(_0x35491f){return logger[_0x6e0c('0x31')](JSON[_0x6e0c('0x2a')](_0x35491f));};}function handleResult(_0x5f7537){return function(_0x1ee5d8){logger['info'](_0x6e0c('0x34'),JSON[_0x6e0c('0x2a')](_0x1ee5d8));if(_0x5f7537[_0x6e0c('0x14')]&&_0x5f7537[_0x6e0c('0x14')][_0x6e0c('0x10')]&&!_[_0x6e0c('0x35')](_0x5f7537[_0x6e0c('0xf')])){setTimeout(handleSendEmail(_0x5f7537,_0x1ee5d8),0x3c*0x3e8);}};}function handleJob(_0x254da1){return function(){try{if(_[_0x6e0c('0x35')](_0x254da1[_0x6e0c('0x1c')])){return logger[_0x6e0c('0xd')](_0x6e0c('0x36'));}if(_['isNil'](_0x254da1[_0x6e0c('0x1d')])){return logger[_0x6e0c('0xd')]('subtractUnit\x20null\x20or\x20undefined');}var _0x10587e={'startDate':moment()[_0x6e0c('0x37')](_0x254da1[_0x6e0c('0x1c')],_0x254da1[_0x6e0c('0x1d')])[_0x6e0c('0x19')](_0x6e0c('0x38')),'endDate':moment()[_0x6e0c('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x254da1[_0x6e0c('0x39')],'name':_0x254da1[_0x6e0c('0x1b')]};if(!_['isNil'](_0x254da1['DefaultReportId'])){logger[_0x6e0c('0xd')]('exec\x20defaul\x20report\x20id:%s',_0x254da1['DefaultReportId']);return analyticDefaultReportController[_0x6e0c('0x3a')]({'id':_0x254da1[_0x6e0c('0x3b')]},_0x10587e)[_0x6e0c('0x3c')](handleResult(_0x254da1))['catch'](handleError());}if(!_[_0x6e0c('0x35')](_0x254da1[_0x6e0c('0x3d')])){logger[_0x6e0c('0xd')]('exec\x20custom\x20report\x20id:%s',_0x254da1[_0x6e0c('0x3d')]);return analyticCustomReportController[_0x6e0c('0x3a')]({'id':_0x254da1[_0x6e0c('0x3d')]},_0x10587e)[_0x6e0c('0x3c')](handleResult(_0x254da1))['catch'](handleError());}}catch(_0x250401){logger[_0x6e0c('0x31')](JSON[_0x6e0c('0x2a')](_0x250401));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x16ec2e){var _0x14ebbd={};if(_0x16ec2e){_0x14ebbd['id']=_0x16ec2e;}return db[_0x6e0c('0x3e')][_0x6e0c('0x3f')]({'where':_0x14ebbd,'include':[{'model':db['MailAccount'],'attributes':['id',_0x6e0c('0x1b'),'email'],'include':[{'model':db[_0x6e0c('0x40')],'as':_0x6e0c('0x10')}]}]})[_0x6e0c('0x3c')](function(_0xd3ac43){var _0x3b43e6=_[_0x6e0c('0x41')](manager['jobs']);var _0x1284f8=_[_0x6e0c('0x42')](_0xd3ac43,function(_0x2fe297){return _0x2fe297['id']['toString']();});var _0x2925a2=_[_0x6e0c('0x43')](_0xd3ac43,function(_0x59ebef){return _0x59ebef['id'][_0x6e0c('0x44')]();});var _0x3581fd=_0x16ec2e?_0x1284f8:_[_0x6e0c('0x45')](_0x1284f8,_0x3b43e6);var _0xfbf1c4=_[_0x6e0c('0x46')](_0x1284f8,_0x3b43e6);var _0x4d32a2=_[_0x6e0c('0x45')](_0x3b43e6,_0x1284f8);var _0x1f43a7;var _0x360e50;for(_0x1f43a7=0x0;_0x1f43a7<_0x4d32a2[_0x6e0c('0x47')]&&!_0x16ec2e;_0x1f43a7+=0x1){_0x360e50=_0x4d32a2[_0x1f43a7][_0x6e0c('0x44')]();if(manager['exists'](_0x360e50)){manager[_0x6e0c('0x48')](_0x360e50);manager[_0x6e0c('0x49')](_0x360e50);logger[_0x6e0c('0xd')](_0x6e0c('0x4a'),_0x360e50);}}logger[_0x6e0c('0xd')](_0x6e0c('0x4b'),JSON['stringify'](_0x3581fd));for(_0x1f43a7=0x0;_0x1f43a7<_0x3581fd[_0x6e0c('0x47')];_0x1f43a7+=0x1){_0x360e50=_0x3581fd[_0x1f43a7]['toString']();logger['info'](_0x6e0c('0x4c'),_0x360e50);if(_0x16ec2e){logger['info'](_0x6e0c('0x4d'),_0x16ec2e);logger[_0x6e0c('0xd')](JSON[_0x6e0c('0x2a')](_0x2925a2[_0x360e50]));BPromise[_0x6e0c('0x4e')]()[_0x6e0c('0x3c')](handleJob(_0x2925a2[_0x360e50]));logger[_0x6e0c('0xd')](_0x6e0c('0x4f'),_0x2925a2[_0x360e50][_0x6e0c('0x1b')],_0x2925a2[_0x360e50][_0x6e0c('0x50')]);}else if(_0x2925a2[_0x360e50][_0x6e0c('0x50')]&&_0x2925a2[_0x360e50][_0x6e0c('0x51')]&&moment()[_0x6e0c('0x52')](_0x2925a2[_0x360e50][_0x6e0c('0x53')],_0x2925a2[_0x360e50]['endAt'])){manager[_0x6e0c('0x54')](_0x360e50,_0x2925a2[_0x360e50][_0x6e0c('0x50')],handleJob(_0x2925a2[_0x360e50]));manager[_0x6e0c('0x55')](_0x360e50);logger[_0x6e0c('0xd')]('add\x20cron',_0x2925a2[_0x360e50][_0x6e0c('0x1b')],_0x2925a2[_0x360e50][_0x6e0c('0x50')]);}else if(manager[_0x6e0c('0x56')](_0x360e50)){manager[_0x6e0c('0x48')](_0x360e50);manager[_0x6e0c('0x49')](_0x360e50);logger['info']('stop\x20cron',_0x2925a2[_0x360e50][_0x6e0c('0x1b')],_0x2925a2[_0x360e50][_0x6e0c('0x50')]);}}for(_0x1f43a7=0x0,_0x360e50;_0x1f43a7<_0xfbf1c4[_0x6e0c('0x47')]&&!_0x16ec2e;_0x1f43a7+=0x1){_0x360e50=_0xfbf1c4[_0x1f43a7][_0x6e0c('0x44')]();if(manager['exists'](_0x360e50)){if(_0x2925a2[_0x360e50]['cron']&&_0x2925a2[_0x360e50][_0x6e0c('0x51')]&&moment()[_0x6e0c('0x52')](_0x2925a2[_0x360e50]['startAt'],_0x2925a2[_0x360e50]['endAt'])){manager[_0x6e0c('0x57')](_0x360e50,_0x2925a2[_0x360e50]['cron'],handleJob(_0x2925a2[_0x360e50]));logger[_0x6e0c('0xd')](_0x6e0c('0x58'),_0x2925a2[_0x360e50][_0x6e0c('0x1b')],_0x2925a2[_0x360e50]['cron']);}else{manager[_0x6e0c('0x48')](_0x360e50);manager[_0x6e0c('0x49')](_0x360e50);logger[_0x6e0c('0xd')]('stop\x20cron',_0x2925a2[_0x360e50][_0x6e0c('0x1b')],_0x2925a2[_0x360e50][_0x6e0c('0x50')]);}}}})[_0x6e0c('0x33')](function(_0xd43e6b){logger[_0x6e0c('0x31')](JSON[_0x6e0c('0x2a')](_0xd43e6b));});}exports[_0x6e0c('0x59')]=function(_0x22d58c){return getJobs(_0x22d58c);};exports[_0x6e0c('0x55')]=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 3322de3..e7e617d 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 _0xf9b6=['error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeRegion','bucket','Transcribe\x20not\x20configured','forEach','push','all','catch','inspect','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','format','TranscriptionJobStatus','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','results','transcripts','length','fileText','transcript','update','then','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','SentimentScore','Positive','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','resolve','tempSentiment','sentiment','Transcript\x20not\x20available','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Negative','Mixed','name','SequelizeValidationError'];(function(_0x4e1a7c,_0x1c3999){var _0x5ed5c1=function(_0x5f5813){while(--_0x5f5813){_0x4e1a7c['push'](_0x4e1a7c['shift']());}};_0x5ed5c1(++_0x1c3999);}(_0xf9b6,0x1d2));var _0x6f9b=function(_0x4583d0,_0x24551f){_0x4583d0=_0x4583d0-0x0;var _0x7b3c5a=_0xf9b6[_0x4583d0];return _0x7b3c5a;};var _=require(_0x6f9b('0x0'));var AWS=require(_0x6f9b('0x1'));var rp=require(_0x6f9b('0x2'));var util=require(_0x6f9b('0x3'));var BPromise=require(_0x6f9b('0x4'));var db=require(_0x6f9b('0x5'))['db'];var logger=require(_0x6f9b('0x6'))(_0x6f9b('0x7'));function getTranscriptionJob(_0x42293d,_0x191729,_0x1381de,_0x51268d){return new Promise(function(_0x2c04ea,_0x4bb113){var _0x34146c=new AWS[(_0x6f9b('0x8'))]({'accessKeyId':_0x191729,'secretAccessKey':_0x42293d,'region':_0x1381de});_0x34146c[_0x6f9b('0x9')]({'TranscriptionJobName':_0x51268d},function(_0x55d410,_0x301753){if(_0x55d410){return _0x4bb113(_0x55d410);}else{return _0x2c04ea(_0x301753);}});});}function sentiment(_0x51a4e2,_0x4b0a5f,_0x515830,_0x3651e3,_0x4c9183){return new Promise(function(_0x5af547,_0x2e88ce){var _0x5b0080=new AWS[(_0x6f9b('0xa'))]({'accessKeyId':_0x4b0a5f,'secretAccessKey':_0x51a4e2,'region':_0x515830});_0x5b0080[_0x6f9b('0xb')]({'Text':_0x3651e3,'LanguageCode':_0x4c9183[_0x6f9b('0xc')](0x0,0x2)},function(_0x52617a,_0x236934){if(_0x52617a){return _0x2e88ce(_0x52617a);}else{return _0x5af547(_0x236934);}});});}function checkTranscribeJob(_0x587c87,_0x4f0b3d,_0x2c6c49){var _0x88c394;return new BPromise(function(_0x2f20aa,_0x4d11d9){logger[_0x6f9b('0xd')](util['format'](_0x6f9b('0xe'),_0x587c87['id'],_0x587c87[_0x6f9b('0xf')]));return getTranscriptionJob(_0x2c6c49[_0x6f9b('0x10')],_0x2c6c49[_0x6f9b('0x11')],_0x4f0b3d['transcribeRegion'],_0x587c87[_0x6f9b('0xf')])['then'](function(_0x58d168){logger[_0x6f9b('0xd')](util[_0x6f9b('0x12')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x587c87['id'],_0x587c87['transcribeName'],_0x58d168['TranscriptionJob'][_0x6f9b('0x13')]));if(!_0x587c87['fileText']){switch(_0x58d168[_0x6f9b('0x14')][_0x6f9b('0x13')]){case _0x6f9b('0x15'):var _0x21fd38={'transcribeStatus':_0x58d168[_0x6f9b('0x14')][_0x6f9b('0x13')],'fileUri':_0x58d168[_0x6f9b('0x14')][_0x6f9b('0x16')]['TranscriptFileUri']};logger[_0x6f9b('0xd')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x587c87['id']));return rp({'uri':_0x58d168['TranscriptionJob'][_0x6f9b('0x16')][_0x6f9b('0x17')],'json':!![]})['then'](function(_0x2b3f59){logger[_0x6f9b('0xd')](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x587c87['id']));if(_0x2b3f59&&_0x2b3f59[_0x6f9b('0x18')]&&_0x2b3f59[_0x6f9b('0x18')][_0x6f9b('0x19')]&&_0x2b3f59[_0x6f9b('0x18')][_0x6f9b('0x19')][_0x6f9b('0x1a')]){_0x21fd38[_0x6f9b('0x1b')]='';for(var _0x15fad5=0x0;_0x15fad5<_0x2b3f59[_0x6f9b('0x18')][_0x6f9b('0x19')][_0x6f9b('0x1a')];_0x15fad5++){_0x21fd38[_0x6f9b('0x1b')]+=_0x2b3f59['results'][_0x6f9b('0x19')][_0x15fad5][_0x6f9b('0x1c')]+'';}}return _0x587c87[_0x6f9b('0x1d')](_0x21fd38);})[_0x6f9b('0x1e')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x587c87['id']));if(!_0x587c87['tempSentiment']){throw new db[(_0x6f9b('0x1f'))][(_0x6f9b('0x20'))](_0x6f9b('0x21'));}if(!_0x4f0b3d['sentiment']||!_0x4f0b3d[_0x6f9b('0x22')]||!_0x4f0b3d[_0x6f9b('0x23')]||!_0x4f0b3d[_0x6f9b('0x24')]||!_0x4f0b3d['bucket']){throw new db[(_0x6f9b('0x1f'))][(_0x6f9b('0x20'))](_0x6f9b('0x25'));}if(!_0x21fd38['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x4f0b3d[_0x6f9b('0x22')]===_0x2c6c49['id']){return _0x2c6c49;}else{return db[_0x6f9b('0x26')][_0x6f9b('0x27')]({'where':{'id':_settings[_0x6f9b('0x22')]}});}})[_0x6f9b('0x1e')](function(_0x2997b8){if(!_0x2997b8){throw new db[(_0x6f9b('0x1f'))][(_0x6f9b('0x20'))](_0x6f9b('0x28'));}if(!_0x2997b8['data1']||!_0x2997b8[_0x6f9b('0x11')]){throw new db[(_0x6f9b('0x1f'))][(_0x6f9b('0x20'))](_0x6f9b('0x29'));}_0x88c394=_0x2997b8;logger[_0x6f9b('0xd')](util[_0x6f9b('0x12')](_0x6f9b('0x2a'),_0x587c87['id']));return sentiment(_0x88c394[_0x6f9b('0x10')],_0x88c394[_0x6f9b('0x11')],_0x4f0b3d[_0x6f9b('0x23')],_0x21fd38[_0x6f9b('0x1b')],_0x4f0b3d[_0x6f9b('0x24')]);})['then'](function(_0x40accc){logger[_0x6f9b('0xd')](util[_0x6f9b('0x12')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x587c87['id']));return _0x587c87['update']({'sentiment':_0x40accc[_0x6f9b('0x2b')],'sPositive':_0x40accc[_0x6f9b('0x2c')][_0x6f9b('0x2d')],'sNegative':_0x40accc[_0x6f9b('0x2c')]['Negative'],'sMixed':_0x40accc[_0x6f9b('0x2c')]['Mixed'],'sNeutral':_0x40accc[_0x6f9b('0x2c')][_0x6f9b('0x2e')]});})[_0x6f9b('0x1e')](function(){logger['info'](util['format'](_0x6f9b('0x2f'),_0x587c87['id']));_0x2f20aa();});case _0x6f9b('0x30'):return _0x587c87[_0x6f9b('0x1d')]({'transcribeStatus':_0x6f9b('0x30'),'failureReason':_0x58d168[_0x6f9b('0x14')][_0x6f9b('0x31')]})['then'](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x587c87['id']));_0x2f20aa();});default:logger[_0x6f9b('0xd')](util[_0x6f9b('0x12')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x587c87['id']));break;}}else{return BPromise[_0x6f9b('0x32')]()[_0x6f9b('0x1e')](function(){if(!_0x587c87[_0x6f9b('0x33')]){throw new db[(_0x6f9b('0x1f'))][(_0x6f9b('0x20'))](_0x6f9b('0x21'));}if(!_0x4f0b3d[_0x6f9b('0x34')]||!_0x4f0b3d[_0x6f9b('0x22')]||!_0x4f0b3d[_0x6f9b('0x23')]||!_0x4f0b3d[_0x6f9b('0x24')]||!_0x4f0b3d['bucket']){throw new db[(_0x6f9b('0x1f'))][(_0x6f9b('0x20'))](_0x6f9b('0x25'));}if(!_0x587c87[_0x6f9b('0x1b')]){throw new Error(_0x6f9b('0x35'));}if(_0x4f0b3d[_0x6f9b('0x22')]===_0x2c6c49['id']){return _0x2c6c49;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x6f9b('0x1e')](function(_0x188140){if(!_0x188140){throw new db[(_0x6f9b('0x1f'))][(_0x6f9b('0x20'))](_0x6f9b('0x28'));}if(!_0x188140[_0x6f9b('0x10')]||!_0x188140[_0x6f9b('0x11')]){throw new db[(_0x6f9b('0x1f'))][(_0x6f9b('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x88c394=_0x188140;logger['info'](util[_0x6f9b('0x12')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x587c87['id']));return sentiment(_0x88c394[_0x6f9b('0x10')],_0x88c394[_0x6f9b('0x11')],_0x4f0b3d[_0x6f9b('0x23')],_0x587c87[_0x6f9b('0x1b')],_0x4f0b3d['language']);})[_0x6f9b('0x1e')](function(_0x1f7277){logger['info'](util[_0x6f9b('0x12')](_0x6f9b('0x36'),_0x587c87['id']));return _0x587c87[_0x6f9b('0x1d')]({'sentiment':_0x1f7277['Sentiment'],'sPositive':_0x1f7277[_0x6f9b('0x2c')]['Positive'],'sNegative':_0x1f7277[_0x6f9b('0x2c')][_0x6f9b('0x37')],'sMixed':_0x1f7277['SentimentScore'][_0x6f9b('0x38')],'sNeutral':_0x1f7277[_0x6f9b('0x2c')]['Neutral'],'transcribeStatus':_0x6f9b('0x15')});})[_0x6f9b('0x1e')](function(){logger[_0x6f9b('0xd')](util[_0x6f9b('0x12')](_0x6f9b('0x2f'),_0x587c87['id']));_0x2f20aa();});}})['catch'](function(_0x2af320){if(_0x2af320){if(!_0x2af320['name']||_0x2af320[_0x6f9b('0x39')]!==_0x6f9b('0x3a')){logger[_0x6f9b('0x3b')](util['format'](_0x6f9b('0x3c'),_0x587c87['id']),util['inspect'](_0x2af320,{'showHidden':![],'depth':null}));}}_0x2f20aa();});});}function checkTranscribe(){var _0x1b6e5b;var _0x198407;var _0x52d358;return db[_0x6f9b('0x3d')]['findAll']({'where':{'transcribeStatus':_0x6f9b('0x3e')}})[_0x6f9b('0x1e')](function(_0x37c00b){if(!_0x37c00b||!_0x37c00b[_0x6f9b('0x1a')]){throw new db[(_0x6f9b('0x1f'))][(_0x6f9b('0x20'))](_0x6f9b('0x3f'));}_0x1b6e5b=_0x37c00b;return db[_0x6f9b('0x40')]['findOne']({'where':{'id':0x1}});})[_0x6f9b('0x1e')](function(_0x21a187){if(!_0x21a187){throw new db[(_0x6f9b('0x1f'))]['ValidationError'](_0x6f9b('0x41'));}_0x198407=_0x21a187;if(!_0x198407[_0x6f9b('0x7')]||!_0x198407['transcribeAccountId']||!_0x198407[_0x6f9b('0x42')]||!_0x198407[_0x6f9b('0x24')]||!_0x198407[_0x6f9b('0x43')]){throw new db[(_0x6f9b('0x1f'))][(_0x6f9b('0x20'))](_0x6f9b('0x44'));}return db['CloudProvider'][_0x6f9b('0x27')]({'where':{'id':_0x198407['transcribeAccountId']}});})[_0x6f9b('0x1e')](function(_0x3d846c){if(!_0x3d846c){throw new db[(_0x6f9b('0x1f'))][(_0x6f9b('0x20'))](_0x6f9b('0x28'));}if(!_0x3d846c[_0x6f9b('0x10')]||!_0x3d846c[_0x6f9b('0x11')]){throw new db[(_0x6f9b('0x1f'))][(_0x6f9b('0x20'))](_0x6f9b('0x29'));}_0x52d358=_0x3d846c;var _0x5c545a=[];_0x1b6e5b[_0x6f9b('0x45')](function(_0x21377a){_0x5c545a[_0x6f9b('0x46')](checkTranscribeJob(_0x21377a,_0x198407,_0x52d358));});return BPromise[_0x6f9b('0x47')](_0x5c545a);})[_0x6f9b('0x48')](function(_0x2e7776){if(_0x2e7776){if(!_0x2e7776[_0x6f9b('0x39')]||_0x2e7776['name']!==_0x6f9b('0x3a')){logger['error'](util[_0x6f9b('0x49')](_0x2e7776,{'showHidden':![],'depth':null}));}}});}exports[_0x6f9b('0x4a')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x1b4b=['No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','error','start','lodash','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','ValidationError','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','language','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Mixed','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1b4b,0x9f));var _0xb1b4=function(_0x5b76ee,_0x27e336){_0x5b76ee=_0x5b76ee-0x0;var _0x200d85=_0x1b4b[_0x5b76ee];return _0x200d85;};var _=require(_0xb1b4('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0xb1b4('0x1'));var BPromise=require('bluebird');var db=require(_0xb1b4('0x2'))['db'];var logger=require(_0xb1b4('0x3'))(_0xb1b4('0x4'));function getTranscriptionJob(_0x3fe33c,_0x45f667,_0x56689f,_0x30340f){return new Promise(function(_0x5aada6,_0x20d845){var _0x391b4d=new AWS[(_0xb1b4('0x5'))]({'accessKeyId':_0x45f667,'secretAccessKey':_0x3fe33c,'region':_0x56689f});_0x391b4d[_0xb1b4('0x6')]({'TranscriptionJobName':_0x30340f},function(_0x3cf5d8,_0xc8ec9f){if(_0x3cf5d8){return _0x20d845(_0x3cf5d8);}else{return _0x5aada6(_0xc8ec9f);}});});}function sentiment(_0xf055fe,_0xfe6c1d,_0x864680,_0x3d5129,_0x4259cd){return new Promise(function(_0x843f96,_0x584781){var _0x5a6ce1=new AWS[(_0xb1b4('0x7'))]({'accessKeyId':_0xfe6c1d,'secretAccessKey':_0xf055fe,'region':_0x864680});_0x5a6ce1[_0xb1b4('0x8')]({'Text':_0x3d5129,'LanguageCode':_0x4259cd[_0xb1b4('0x9')](0x0,0x2)},function(_0xb051f7,_0xa3659c){if(_0xb051f7){return _0x584781(_0xb051f7);}else{return _0x843f96(_0xa3659c);}});});}function checkTranscribeJob(_0x5ae1b3,_0x363126,_0x673d81){var _0x2a1ef1;return new BPromise(function(_0x2cc7c2,_0x3e5914){logger[_0xb1b4('0xa')](util[_0xb1b4('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x5ae1b3['id'],_0x5ae1b3[_0xb1b4('0xc')]));return getTranscriptionJob(_0x673d81['data1'],_0x673d81['data2'],_0x363126['transcribeRegion'],_0x5ae1b3[_0xb1b4('0xc')])[_0xb1b4('0xd')](function(_0x2b611e){logger[_0xb1b4('0xa')](util[_0xb1b4('0xb')](_0xb1b4('0xe'),_0x5ae1b3['id'],_0x5ae1b3[_0xb1b4('0xc')],_0x2b611e[_0xb1b4('0xf')]['TranscriptionJobStatus']));if(!_0x5ae1b3[_0xb1b4('0x10')]){switch(_0x2b611e[_0xb1b4('0xf')][_0xb1b4('0x11')]){case _0xb1b4('0x12'):var _0x416a77={'transcribeStatus':_0x2b611e[_0xb1b4('0xf')][_0xb1b4('0x11')],'fileUri':_0x2b611e[_0xb1b4('0xf')][_0xb1b4('0x13')][_0xb1b4('0x14')]};logger[_0xb1b4('0xa')](util[_0xb1b4('0xb')](_0xb1b4('0x15'),_0x5ae1b3['id']));return rp({'uri':_0x2b611e[_0xb1b4('0xf')][_0xb1b4('0x13')][_0xb1b4('0x14')],'json':!![]})[_0xb1b4('0xd')](function(_0x47fc49){logger[_0xb1b4('0xa')](util[_0xb1b4('0xb')](_0xb1b4('0x16'),_0x5ae1b3['id']));if(_0x47fc49&&_0x47fc49[_0xb1b4('0x17')]&&_0x47fc49[_0xb1b4('0x17')]['transcripts']&&_0x47fc49[_0xb1b4('0x17')][_0xb1b4('0x18')][_0xb1b4('0x19')]){_0x416a77['fileText']='';for(var _0x285203=0x0;_0x285203<_0x47fc49[_0xb1b4('0x17')][_0xb1b4('0x18')]['length'];_0x285203++){_0x416a77[_0xb1b4('0x10')]+=_0x47fc49[_0xb1b4('0x17')][_0xb1b4('0x18')][_0x285203][_0xb1b4('0x1a')]+'';}}return _0x5ae1b3[_0xb1b4('0x1b')](_0x416a77);})['then'](function(){logger[_0xb1b4('0xa')](util[_0xb1b4('0xb')](_0xb1b4('0x1c'),_0x5ae1b3['id']));if(!_0x5ae1b3[_0xb1b4('0x1d')]){throw new db[(_0xb1b4('0x1e'))]['ValidationError'](_0xb1b4('0x1f'));}if(!_0x363126[_0xb1b4('0x20')]||!_0x363126[_0xb1b4('0x21')]||!_0x363126[_0xb1b4('0x22')]||!_0x363126['language']||!_0x363126[_0xb1b4('0x23')]){throw new db[(_0xb1b4('0x1e'))]['ValidationError'](_0xb1b4('0x24'));}if(!_0x416a77[_0xb1b4('0x10')]){throw new Error(_0xb1b4('0x25'));}if(_0x363126[_0xb1b4('0x21')]===_0x673d81['id']){return _0x673d81;}else{return db[_0xb1b4('0x26')]['findOne']({'where':{'id':_settings[_0xb1b4('0x21')]}});}})[_0xb1b4('0xd')](function(_0x1286fd){if(!_0x1286fd){throw new db[(_0xb1b4('0x1e'))][(_0xb1b4('0x27'))](_0xb1b4('0x28'));}if(!_0x1286fd[_0xb1b4('0x29')]||!_0x1286fd[_0xb1b4('0x2a')]){throw new db[(_0xb1b4('0x1e'))][(_0xb1b4('0x27'))](_0xb1b4('0x2b'));}_0x2a1ef1=_0x1286fd;logger['info'](util[_0xb1b4('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5ae1b3['id']));return sentiment(_0x2a1ef1[_0xb1b4('0x29')],_0x2a1ef1[_0xb1b4('0x2a')],_0x363126[_0xb1b4('0x22')],_0x416a77[_0xb1b4('0x10')],_0x363126[_0xb1b4('0x2c')]);})[_0xb1b4('0xd')](function(_0x52c8f2){logger['info'](util[_0xb1b4('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5ae1b3['id']));return _0x5ae1b3[_0xb1b4('0x1b')]({'sentiment':_0x52c8f2[_0xb1b4('0x2d')],'sPositive':_0x52c8f2[_0xb1b4('0x2e')][_0xb1b4('0x2f')],'sNegative':_0x52c8f2[_0xb1b4('0x2e')][_0xb1b4('0x30')],'sMixed':_0x52c8f2[_0xb1b4('0x2e')]['Mixed'],'sNeutral':_0x52c8f2[_0xb1b4('0x2e')][_0xb1b4('0x31')]});})[_0xb1b4('0xd')](function(){logger[_0xb1b4('0xa')](util[_0xb1b4('0xb')](_0xb1b4('0x1c'),_0x5ae1b3['id']));_0x2cc7c2();});case'FAILED':return _0x5ae1b3[_0xb1b4('0x1b')]({'transcribeStatus':_0xb1b4('0x32'),'failureReason':_0x2b611e['TranscriptionJob'][_0xb1b4('0x33')]})[_0xb1b4('0xd')](function(){logger[_0xb1b4('0xa')](util[_0xb1b4('0xb')](_0xb1b4('0x1c'),_0x5ae1b3['id']));_0x2cc7c2();});default:logger[_0xb1b4('0xa')](util[_0xb1b4('0xb')](_0xb1b4('0x34'),_0x5ae1b3['id']));break;}}else{return BPromise[_0xb1b4('0x35')]()[_0xb1b4('0xd')](function(){if(!_0x5ae1b3[_0xb1b4('0x1d')]){throw new db['Sequelize'][(_0xb1b4('0x27'))](_0xb1b4('0x1f'));}if(!_0x363126[_0xb1b4('0x20')]||!_0x363126['sentimentAccountId']||!_0x363126[_0xb1b4('0x22')]||!_0x363126[_0xb1b4('0x2c')]||!_0x363126['bucket']){throw new db['Sequelize'][(_0xb1b4('0x27'))](_0xb1b4('0x24'));}if(!_0x5ae1b3[_0xb1b4('0x10')]){throw new Error(_0xb1b4('0x25'));}if(_0x363126[_0xb1b4('0x21')]===_0x673d81['id']){return _0x673d81;}else{return db[_0xb1b4('0x26')][_0xb1b4('0x36')]({'where':{'id':_settings[_0xb1b4('0x21')]}});}})[_0xb1b4('0xd')](function(_0xd89ba){if(!_0xd89ba){throw new db['Sequelize']['ValidationError'](_0xb1b4('0x28'));}if(!_0xd89ba[_0xb1b4('0x29')]||!_0xd89ba[_0xb1b4('0x2a')]){throw new db[(_0xb1b4('0x1e'))][(_0xb1b4('0x27'))](_0xb1b4('0x2b'));}_0x2a1ef1=_0xd89ba;logger[_0xb1b4('0xa')](util[_0xb1b4('0xb')](_0xb1b4('0x37'),_0x5ae1b3['id']));return sentiment(_0x2a1ef1[_0xb1b4('0x29')],_0x2a1ef1[_0xb1b4('0x2a')],_0x363126['sentimentRegion'],_0x5ae1b3[_0xb1b4('0x10')],_0x363126['language']);})[_0xb1b4('0xd')](function(_0x4c176f){logger[_0xb1b4('0xa')](util['format'](_0xb1b4('0x38'),_0x5ae1b3['id']));return _0x5ae1b3[_0xb1b4('0x1b')]({'sentiment':_0x4c176f[_0xb1b4('0x2d')],'sPositive':_0x4c176f['SentimentScore'][_0xb1b4('0x2f')],'sNegative':_0x4c176f['SentimentScore'][_0xb1b4('0x30')],'sMixed':_0x4c176f[_0xb1b4('0x2e')][_0xb1b4('0x39')],'sNeutral':_0x4c176f[_0xb1b4('0x2e')][_0xb1b4('0x31')],'transcribeStatus':_0xb1b4('0x12')});})[_0xb1b4('0xd')](function(){logger[_0xb1b4('0xa')](util[_0xb1b4('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5ae1b3['id']));_0x2cc7c2();});}})[_0xb1b4('0x3a')](function(_0x5316c6){if(_0x5316c6){if(!_0x5316c6[_0xb1b4('0x3b')]||_0x5316c6[_0xb1b4('0x3b')]!==_0xb1b4('0x3c')){logger['error'](util['format'](_0xb1b4('0x3d'),_0x5ae1b3['id']),util[_0xb1b4('0x3e')](_0x5316c6,{'showHidden':![],'depth':null}));}}_0x2cc7c2();});});}function checkTranscribe(){var _0x5f3808;var _0x3e2a7b;var _0x164db3;return db[_0xb1b4('0x3f')][_0xb1b4('0x40')]({'where':{'transcribeStatus':_0xb1b4('0x41')}})[_0xb1b4('0xd')](function(_0x2900b9){if(!_0x2900b9||!_0x2900b9[_0xb1b4('0x19')]){throw new db[(_0xb1b4('0x1e'))]['ValidationError'](_0xb1b4('0x42'));}_0x5f3808=_0x2900b9;return db['Setting'][_0xb1b4('0x36')]({'where':{'id':0x1}});})[_0xb1b4('0xd')](function(_0x313b58){if(!_0x313b58){throw new db[(_0xb1b4('0x1e'))]['ValidationError'](_0xb1b4('0x43'));}_0x3e2a7b=_0x313b58;if(!_0x3e2a7b['transcribe']||!_0x3e2a7b[_0xb1b4('0x44')]||!_0x3e2a7b[_0xb1b4('0x45')]||!_0x3e2a7b[_0xb1b4('0x2c')]||!_0x3e2a7b[_0xb1b4('0x23')]){throw new db['Sequelize'][(_0xb1b4('0x27'))](_0xb1b4('0x46'));}return db[_0xb1b4('0x26')][_0xb1b4('0x36')]({'where':{'id':_0x3e2a7b[_0xb1b4('0x44')]}});})[_0xb1b4('0xd')](function(_0x253317){if(!_0x253317){throw new db[(_0xb1b4('0x1e'))][(_0xb1b4('0x27'))](_0xb1b4('0x28'));}if(!_0x253317[_0xb1b4('0x29')]||!_0x253317[_0xb1b4('0x2a')]){throw new db['Sequelize'][(_0xb1b4('0x27'))](_0xb1b4('0x2b'));}_0x164db3=_0x253317;var _0x2868be=[];_0x5f3808[_0xb1b4('0x47')](function(_0x3305c2){_0x2868be[_0xb1b4('0x48')](checkTranscribeJob(_0x3305c2,_0x3e2a7b,_0x164db3));});return BPromise['all'](_0x2868be);})['catch'](function(_0x5cadd0){if(_0x5cadd0){if(!_0x5cadd0[_0xb1b4('0x3b')]||_0x5cadd0['name']!==_0xb1b4('0x3c')){logger[_0xb1b4('0x49')](util[_0xb1b4('0x3e')](_0x5cadd0,{'showHidden':![],'depth':null}));}}});}exports[_0xb1b4('0x4a')]=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 bae9b26..196554d 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 _0xb224=['redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','hours','then','map','join','update','system','timeout','format','length','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','util','../../config/environment','../../mysqldb','../logger','schedule'];(function(_0x27ec74,_0xf8f27d){var _0x524a09=function(_0x39e36a){while(--_0x39e36a){_0x27ec74['push'](_0x27ec74['shift']());}};_0x524a09(++_0xf8f27d);}(_0xb224,0x72));var _0x4b22=function(_0x4e3f9d,_0x44c902){_0x4e3f9d=_0x4e3f9d-0x0;var _0x2d38e1=_0xb224[_0x4e3f9d];return _0x2d38e1;};'use strict';var _=require(_0x4b22('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0x4b22('0x1'));var config=require(_0x4b22('0x2'));var db=require(_0x4b22('0x3'))['db'];var logger=require(_0x4b22('0x4'))(_0x4b22('0x5'));config[_0x4b22('0x6')]=_[_0x4b22('0x7')](config['redis'],{'host':_0x4b22('0x8'),'port':0x18eb});var io=require(_0x4b22('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0xe13b1e=[];return db[_0x4b22('0xa')][_0x4b22('0xb')]({'raw':!![],'attributes':['id',_0x4b22('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x4b22('0xd'))}}})[_0x4b22('0xe')](function(_0x1abb3c){if(_0x1abb3c&&_0x1abb3c['length']){_0xe13b1e=_[_0x4b22('0xf')](_0x1abb3c||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0xe13b1e[_0x4b22('0x10')]());return db[_0x4b22('0xa')][_0x4b22('0x11')]({'closeReason':_0x4b22('0x12'),'disposition':_0x4b22('0x13'),'closed':!![],'closedAt':moment()[_0x4b22('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xe13b1e}});}})[_0x4b22('0xe')](function(){if(_0xe13b1e&&_0xe13b1e[_0x4b22('0x15')]){logger[_0x4b22('0x16')](_0x4b22('0x17'),_0xe13b1e['join']());for(var _0x1a9133=0x0;_0x1a9133<_0xe13b1e[_0x4b22('0x15')];_0x1a9133++){io[_0x4b22('0x18')](_0x4b22('0x19'),{'id':_0xe13b1e[_0x1a9133],'closed':!![]});}}})[_0x4b22('0x1a')](function(_0xb56096){logger['error'](_0x4b22('0x1b'),_0xb56096?util[_0x4b22('0x1c')](_0xb56096,{'showHidden':![],'depth':null}):'');});}exports[_0x4b22('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xed59=['../logger','defaults','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','YYYY-MM-DD\x20HH:mm:ss','then','emit','catch','error','start','lodash','ioredis','../../config/environment','../../mysqldb'];(function(_0x3a5fe0,_0x13fcd5){var _0x2a33b5=function(_0x3fb717){while(--_0x3fb717){_0x3a5fe0['push'](_0x3a5fe0['shift']());}};_0x2a33b5(++_0x13fcd5);}(_0xed59,0x182));var _0x9ed5=function(_0x23880b,_0x2f5b5a){_0x23880b=_0x23880b-0x0;var _0x1ee016=_0xed59[_0x23880b];return _0x1ee016;};'use strict';var _=require(_0x9ed5('0x0'));var moment=require('moment');var Redis=require(_0x9ed5('0x1'));var util=require('util');var config=require(_0x9ed5('0x2'));var db=require(_0x9ed5('0x3'))['db'];var logger=require(_0x9ed5('0x4'))('schedule');config['redis']=_[_0x9ed5('0x5')](config[_0x9ed5('0x6')],{'host':_0x9ed5('0x7'),'port':0x18eb});var io=require(_0x9ed5('0x8'))(new Redis(config[_0x9ed5('0x6')]));function closeInteractions(){var _0x225eb4=[];return db[_0x9ed5('0x9')][_0x9ed5('0xa')]({'raw':!![],'attributes':['id',_0x9ed5('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x9ed5('0xc')](0x18,'hours')}}})['then'](function(_0x2a746d){if(_0x2a746d&&_0x2a746d[_0x9ed5('0xd')]){_0x225eb4=_[_0x9ed5('0xe')](_0x2a746d||[],'id');logger[_0x9ed5('0xf')](_0x9ed5('0x10'),_0x225eb4[_0x9ed5('0x11')]());return db[_0x9ed5('0x9')][_0x9ed5('0x12')]({'closeReason':_0x9ed5('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x9ed5('0x14'))},{'where':{'id':_0x225eb4}});}})[_0x9ed5('0x15')](function(){if(_0x225eb4&&_0x225eb4[_0x9ed5('0xd')]){logger[_0x9ed5('0xf')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x225eb4['join']());for(var _0x5914c2=0x0;_0x5914c2<_0x225eb4[_0x9ed5('0xd')];_0x5914c2++){io[_0x9ed5('0x16')]('whatsappInteraction:update',{'id':_0x225eb4[_0x5914c2],'closed':!![]});}}})[_0x9ed5('0x17')](function(_0x58dfb1){logger[_0x9ed5('0x18')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x58dfb1?util['inspect'](_0x58dfb1,{'showHidden':![],'depth':null}):'');});}exports[_0x9ed5('0x19')]=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 29ff2fd..e188a28 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5ce=['util','../mysqldb','push','Innocenzo','Biondo','@xcally.com','now','innocenzo.biondo','CmContact','then','bulkCreate','log','finished\x20populating','CmHopper','destroy','contacts2','hopper2'];(function(_0x2e57f2,_0x492131){var _0x61c56c=function(_0x419001){while(--_0x419001){_0x2e57f2['push'](_0x2e57f2['shift']());}};_0x61c56c(++_0x492131);}(_0xc5ce,0x1cb));var _0xec5c=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc5ce[_0x4a747d];return _0x3a5b5c;};'use strict';var util=require(_0xec5c('0x0'));var db=require(_0xec5c('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xec5c('0x2')]({'id':i,'firstName':_0xec5c('0x3')+i,'lastName':_0xec5c('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xec5c('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xec5c('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xec5c('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xec5c('0x6')](),'updatedAt':Date[_0xec5c('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xec5c('0x3')+i,'lastName':_0xec5c('0x4')+i,'phone':0xf879fb460+i,'email':_0xec5c('0x7')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xec5c('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xec5c('0x6')]()});}db[_0xec5c('0x8')]['destroy']({'where':{}})[_0xec5c('0x9')](function(){return db[_0xec5c('0x8')][_0xec5c('0xa')](contacts);})[_0xec5c('0x9')](function(){console[_0xec5c('0xb')](_0xec5c('0xc'),'contacts1');return db[_0xec5c('0xd')][_0xec5c('0xe')]({'where':{}});})[_0xec5c('0x9')](function(){return db[_0xec5c('0xd')][_0xec5c('0xa')](hopper);})['then'](function(){console[_0xec5c('0xb')](_0xec5c('0xc'),'hopper1');return db[_0xec5c('0x8')][_0xec5c('0xa')](contacts2);})[_0xec5c('0x9')](function(){console[_0xec5c('0xb')]('finished\x20populating',_0xec5c('0xf'));return db[_0xec5c('0xd')][_0xec5c('0xa')](hopper2);})[_0xec5c('0x9')](function(){console[_0xec5c('0xb')](_0xec5c('0xc'),_0xec5c('0x10'));})['catch'](function(_0x5894b2){console[_0xec5c('0xb')](_0x5894b2);}); \ No newline at end of file +var _0xa8ee=['destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','log','catch','util','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now','CmContact'];(function(_0x5a187b,_0x1f64fe){var _0x14d601=function(_0x45fd29){while(--_0x45fd29){_0x5a187b['push'](_0x5a187b['shift']());}};_0x14d601(++_0x1f64fe);}(_0xa8ee,0x184));var _0xea8e=function(_0x4f06d6,_0x58b83d){_0x4f06d6=_0x4f06d6-0x0;var _0x4da6e7=_0xa8ee[_0x4f06d6];return _0x4da6e7;};'use strict';var util=require(_0xea8e('0x0'));var db=require(_0xea8e('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xea8e('0x2')]({'id':i,'firstName':_0xea8e('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xea8e('0x4')+i+_0xea8e('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xea8e('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xea8e('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xea8e('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xea8e('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xea8e('0x6')]()});}db[_0xea8e('0x7')][_0xea8e('0x8')]({'where':{}})[_0xea8e('0x9')](function(){return db[_0xea8e('0x7')][_0xea8e('0xa')](contacts);})[_0xea8e('0x9')](function(){console['log'](_0xea8e('0xb'),_0xea8e('0xc'));return db['CmHopper'][_0xea8e('0x8')]({'where':{}});})[_0xea8e('0x9')](function(){return db[_0xea8e('0xd')][_0xea8e('0xa')](hopper);})[_0xea8e('0x9')](function(){console['log'](_0xea8e('0xb'),_0xea8e('0xe'));return db['CmContact'][_0xea8e('0xa')](contacts2);})[_0xea8e('0x9')](function(){console['log']('finished\x20populating',_0xea8e('0xf'));return db[_0xea8e('0xd')][_0xea8e('0xa')](hopper2);})[_0xea8e('0x9')](function(){console[_0xea8e('0x10')]('finished\x20populating','hopper2');})[_0xea8e('0x11')](function(_0x1d144b){console[_0xea8e('0x10')](_0x1d144b);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index ce8edbb..dc3d760 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33a9=['util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','then','log','add\x20user','catch'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x33a9,0x1a4));var _0x933a=function(_0x556a99,_0x3d0574){_0x556a99=_0x556a99-0x0;var _0x45a65a=_0x33a9[_0x556a99];return _0x45a65a;};'use strict';var util=require(_0x933a('0x0'));var db=require(_0x933a('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x933a('0x2')]({'name':util[_0x933a('0x3')](_0x933a('0x4'),_0x933a('0x5'),i),'fullname':util[_0x933a('0x3')](_0x933a('0x4'),_0x933a('0x5'),i),'email':util[_0x933a('0x3')](_0x933a('0x6'),_0x933a('0x5'),i),'role':_0x933a('0x5'),'password':_0x933a('0x7'),'internal':0xfa0+i,'type':'friend','transport':[_0x933a('0x8'),'ws',_0x933a('0x9')],'disallow':[_0x933a('0xa')],'allow':[_0x933a('0xb')],'defaultuser':util[_0x933a('0x3')]('%s%s',_0x933a('0x5'),i),'encryption':_0x933a('0xc'),'avpf':_0x933a('0xc'),'force_avp':_0x933a('0xc'),'icesupport':_0x933a('0xc'),'dtlsenable':_0x933a('0xc'),'dtlsverify':'no','dtlscertfile':_0x933a('0xd'),'dtlsprivatekey':_0x933a('0xe'),'dtlssetup':_0x933a('0xf'),'callerid':util['format']('\x22%s\x22\x20<%s>',util['format']('%s%s',_0x933a('0x5'),i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0x933a('0x10')](function(){console[_0x933a('0x11')](_0x933a('0x12'));})[_0x933a('0x13')](function(_0x4e67a8){console[_0x933a('0x11')](_0x4e67a8);}); \ No newline at end of file +var _0xcf77=['actpass','User','bulkCreate','then','log','util','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x36c32f,_0x27090a){var _0x1282a2=function(_0x377097){while(--_0x377097){_0x36c32f['push'](_0x36c32f['shift']());}};_0x1282a2(++_0x27090a);}(_0xcf77,0x113));var _0x7cf7=function(_0x362fe6,_0xb731ac){_0x362fe6=_0x362fe6-0x0;var _0x27cb29=_0xcf77[_0x362fe6];return _0x27cb29;};'use strict';var util=require(_0x7cf7('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x7cf7('0x1')]({'name':util[_0x7cf7('0x2')](_0x7cf7('0x3'),'agent',i),'fullname':util['format'](_0x7cf7('0x3'),_0x7cf7('0x4'),i),'email':util[_0x7cf7('0x2')](_0x7cf7('0x5'),_0x7cf7('0x4'),i),'role':_0x7cf7('0x4'),'password':_0x7cf7('0x6'),'internal':0xfa0+i,'type':_0x7cf7('0x7'),'transport':[_0x7cf7('0x8'),'ws',_0x7cf7('0x9')],'disallow':['all'],'allow':[_0x7cf7('0xa')],'defaultuser':util[_0x7cf7('0x2')]('%s%s','agent',i),'encryption':'yes','avpf':_0x7cf7('0xb'),'force_avp':_0x7cf7('0xb'),'icesupport':_0x7cf7('0xb'),'dtlsenable':_0x7cf7('0xb'),'dtlsverify':'no','dtlscertfile':_0x7cf7('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x7cf7('0xd'),'callerid':util['format']('\x22%s\x22\x20<%s>',util[_0x7cf7('0x2')]('%s%s',_0x7cf7('0x4'),i),0xfa0+i)});}db[_0x7cf7('0xe')][_0x7cf7('0xf')](users)[_0x7cf7('0x10')](function(){console['log']('add\x20user');})['catch'](function(_0x238525){console[_0x7cf7('0x11')](_0x238525);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 66e0e68..637f868 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x052e=['query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','ChatQueues','SmsQueues','WhatsappQueues','agent','getChatQueues','getFaxQueues','getMailQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','FaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','request','remoteAddress','remotePort','address','DISCONNECTED','CONNECTED','bluebird','../mysqldb','name','Agents','role','telephone','type','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','FaxQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','map','User','where','format','%s:queue:%s','user:%s','userProfileId','handshake'];(function(_0x5b4052,_0x1e8e50){var _0x5a4080=function(_0x44d432){while(--_0x44d432){_0x5b4052['push'](_0x5b4052['shift']());}};_0x5a4080(++_0x1e8e50);}(_0x052e,0x101));var _0xe052=function(_0xb73ba0,_0x159f3d){_0xb73ba0=_0xb73ba0-0x0;var _0x32e0b7=_0x052e[_0xb73ba0];return _0x32e0b7;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xe052('0x0'));var db=require(_0xe052('0x1'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xe052('0x2')],'include':[{'as':_0xe052('0x3'),'model':db['User'],'attributes':['id','name',_0xe052('0x4')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xe052('0x5')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xe052('0x2'),_0xe052('0x6')],'where':{'type':_0xe052('0x7')}};function getAssociatedResources(_0x29c92e,_0x2f7afe,_0xd97e1e){return db[_0xe052('0x8')]['findOne']({'where':{'name':_0x29c92e,'userProfileId':_0x2f7afe},'raw':!![]})[_0xe052('0x9')](function(_0x3b6a3b){if(_0x3b6a3b){if(_0x3b6a3b[_0xe052('0xa')]){switch(_0x29c92e){case _0xe052('0xb'):case'ChatQueues':case _0xe052('0xc'):case'SmsQueues':case _0xe052('0xd'):case _0xe052('0xe'):case'WhatsappQueues':return db[_0xd97e1e][_0xe052('0xf')](queryQueues);case _0xe052('0x10'):return db[_0xd97e1e][_0xe052('0xf')](queryTelephones);case _0xe052('0x11'):return db[_0xd97e1e][_0xe052('0xf')](queryTrunks);case _0xe052('0x12'):return db[_0xd97e1e]['findAll'](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0xe052('0x13')],'where':{'sectionId':_0x3b6a3b['id']},'raw':!![]})[_0xe052('0x9')](function(_0x5633a7){if(_0x5633a7){var _0x23cae8={'where':{'id':_[_0xe052('0x14')](_0x5633a7,'resourceId')},'raw':!![]};switch(_0xd97e1e){case _0xe052('0x15'):_0x23cae8[_0xe052('0x16')][_0xe052('0x4')]=_0xe052('0x5');break;case'Campaign':_0x23cae8['where']['type']='ivr';break;}return db[_0xd97e1e][_0xe052('0xf')](_0x23cae8);}else{return[];}});}}else{return[];}})[_0xe052('0x9')](function(_0x5546c4){return _0x5546c4;});}function joinOrLeaveQueues(_0x1c1820,_0x3959ee,_0x56e39f,_0x2cd2a2){_0x1c1820[_0x3959ee](util[_0xe052('0x17')](_0xe052('0x18'),_0x56e39f,_0x2cd2a2[_0xe052('0x2')]));if(_0x2cd2a2[_0xe052('0x3')]){for(var _0x5483fd=0x0;_0x5483fd<_0x2cd2a2[_0xe052('0x3')]['length'];_0x5483fd+=0x1){_0x1c1820[_0x3959ee](util[_0xe052('0x17')](_0xe052('0x19'),_0x2cd2a2[_0xe052('0x3')][_0x5483fd]['name']));}}}function joinOrLeave(_0x24fd4b,_0x4ba2e8,_0x35a7bd){var _0x3ccde4;if(_0x24fd4b['handshake']['query']['id']){db[_0xe052('0x15')]['find']({'attributes':['id',_0xe052('0x2'),_0xe052('0x4'),_0xe052('0x1a')],'where':{'id':_0x24fd4b[_0xe052('0x1b')][_0xe052('0x1c')]['id']},'include':[{'model':db[_0xe052('0x1d')],'as':_0xe052('0x1e'),'attributes':['id'],'raw':!![]},{'model':db[_0xe052('0x1f')],'as':_0xe052('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0xe052('0x21')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xe052('0x22')],'as':_0xe052('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xe052('0x24')],'as':_0xe052('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xe052('0x26')],'as':_0xe052('0x27'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x37608d){if(_0x37608d){_0x3ccde4=_0x37608d;_0x24fd4b[_0x4ba2e8](util[_0xe052('0x17')](_0xe052('0x19'),_0x37608d[_0xe052('0x2')]));var _0x426845=[];switch(_0x37608d[_0xe052('0x4')]){case _0xe052('0x28'):_0x24fd4b[_0x4ba2e8](_0xe052('0x29'));_0x24fd4b[_0x4ba2e8](_0xe052('0x2a'));if(queryQueues['hasOwnProperty'](_0xe052('0x2b'))){delete queryQueues[_0xe052('0x2b')];}_0x426845[_0xe052('0x2c')](db['VoiceQueue'][_0xe052('0xf')](queryQueues));_0x426845['push'](db[_0xe052('0x2d')][_0xe052('0xf')](queryQueues));_0x426845[_0xe052('0x2c')](db[_0xe052('0x2e')]['findAll'](queryQueues));_0x426845['push'](db[_0xe052('0x2f')][_0xe052('0xf')](queryQueues));_0x426845['push'](db[_0xe052('0x30')][_0xe052('0xf')](queryQueues));_0x426845[_0xe052('0x2c')](db[_0xe052('0x31')][_0xe052('0xf')](queryQueues));_0x426845[_0xe052('0x2c')](db[_0xe052('0x32')][_0xe052('0xf')](queryQueues));_0x426845[_0xe052('0x2c')](db[_0xe052('0x15')][_0xe052('0xf')](queryTelephones));_0x426845[_0xe052('0x2c')](db[_0xe052('0x33')]['findAll'](queryTrunks));_0x426845['push'](db[_0xe052('0x34')]['findAll'](queryCampaigns));_0x426845['push'](db['User'][_0xe052('0xf')](queryAgents));break;case'user':_0x24fd4b[_0x4ba2e8]('voice:inbound');_0x24fd4b[_0x4ba2e8](_0xe052('0x2a'));_0x426845['push'](getAssociatedResources(_0xe052('0xb'),_0x37608d[_0xe052('0x1a')],'VoiceQueue'));_0x426845[_0xe052('0x2c')](getAssociatedResources(_0xe052('0x35'),_0x37608d[_0xe052('0x1a')],_0xe052('0x2d')));_0x426845[_0xe052('0x2c')](getAssociatedResources(_0xe052('0xc'),_0x37608d[_0xe052('0x1a')],_0xe052('0x2e')));_0x426845[_0xe052('0x2c')](getAssociatedResources(_0xe052('0x36'),_0x37608d[_0xe052('0x1a')],_0xe052('0x2f')));_0x426845[_0xe052('0x2c')](getAssociatedResources(_0xe052('0xd'),_0x37608d[_0xe052('0x1a')],'MailQueue'));_0x426845[_0xe052('0x2c')](getAssociatedResources(_0xe052('0xe'),_0x37608d[_0xe052('0x1a')],_0xe052('0x31')));_0x426845[_0xe052('0x2c')](getAssociatedResources(_0xe052('0x37'),_0x37608d[_0xe052('0x1a')],'WhatsappQueue'));_0x426845[_0xe052('0x2c')](getAssociatedResources(_0xe052('0x10'),_0x37608d[_0xe052('0x1a')],_0xe052('0x15')));_0x426845[_0xe052('0x2c')](getAssociatedResources(_0xe052('0x11'),_0x37608d[_0xe052('0x1a')],_0xe052('0x33')));_0x426845[_0xe052('0x2c')](getAssociatedResources(_0xe052('0x12'),_0x37608d[_0xe052('0x1a')],_0xe052('0x34')));_0x426845[_0xe052('0x2c')](db[_0xe052('0x15')][_0xe052('0xf')](queryAgents));break;case _0xe052('0x38'):_0x24fd4b[_0x4ba2e8](_0xe052('0x29'));_0x24fd4b[_0x4ba2e8](_0xe052('0x2a'));_0x426845[_0xe052('0x2c')](_0x37608d['getVoiceQueues']({'attributes':['id',_0xe052('0x2')]}));_0x426845[_0xe052('0x2c')](_0x37608d[_0xe052('0x39')]({'attributes':['id',_0xe052('0x2')]}));_0x426845['push'](_0x37608d[_0xe052('0x3a')]({'attributes':['id',_0xe052('0x2')]}));_0x426845[_0xe052('0x2c')](_0x37608d['getSmsQueues']({'attributes':['id',_0xe052('0x2')]}));_0x426845[_0xe052('0x2c')](_0x37608d[_0xe052('0x3b')]({'attributes':['id',_0xe052('0x2')]}));_0x426845[_0xe052('0x2c')](_0x37608d['getOpenchannelQueues']({'attributes':['id',_0xe052('0x2')]}));_0x426845['push'](_0x37608d[_0xe052('0x3c')]({'attributes':['id',_0xe052('0x2')]}));break;}return BPromise[_0xe052('0x3d')](_0x426845);}})[_0xe052('0x9')](function(_0x455a6b){if(_0x455a6b&&_0x455a6b['length']){for(var _0x333e2d=0x0;_0x333e2d<_0x455a6b[_0xe052('0x3e')];_0x333e2d+=0x1){for(var _0xc7a124=0x0;_0xc7a124<_0x455a6b[_0x333e2d][_0xe052('0x3e')];_0xc7a124+=0x1){switch(_0x333e2d){case 0x0:joinOrLeaveQueues(_0x24fd4b,_0x4ba2e8,_0xe052('0x3f'),_0x455a6b[_0x333e2d][_0xc7a124]);break;case 0x1:joinOrLeaveQueues(_0x24fd4b,_0x4ba2e8,_0xe052('0x40'),_0x455a6b[_0x333e2d][_0xc7a124]);break;case 0x2:joinOrLeaveQueues(_0x24fd4b,_0x4ba2e8,_0xe052('0x41'),_0x455a6b[_0x333e2d][_0xc7a124]);break;case 0x3:joinOrLeaveQueues(_0x24fd4b,_0x4ba2e8,_0xe052('0x42'),_0x455a6b[_0x333e2d][_0xc7a124]);break;case 0x4:joinOrLeaveQueues(_0x24fd4b,_0x4ba2e8,_0xe052('0x43'),_0x455a6b[_0x333e2d][_0xc7a124]);break;case 0x5:joinOrLeaveQueues(_0x24fd4b,_0x4ba2e8,_0xe052('0x44'),_0x455a6b[_0x333e2d][_0xc7a124]);break;case 0x6:joinOrLeaveQueues(_0x24fd4b,_0x4ba2e8,_0xe052('0x45'),_0x455a6b[_0x333e2d][_0xc7a124]);break;case 0x7:_0x24fd4b[_0x4ba2e8](util[_0xe052('0x17')](_0xe052('0x46'),_0x455a6b[_0x333e2d][_0xc7a124][_0xe052('0x2')]));break;case 0x8:_0x24fd4b[_0x4ba2e8](util[_0xe052('0x17')](_0xe052('0x47'),_0x455a6b[_0x333e2d][_0xc7a124][_0xe052('0x2')]));break;case 0x9:_0x24fd4b[_0x4ba2e8](util[_0xe052('0x17')]('campaign:%s:%s',_0x455a6b[_0x333e2d][_0xc7a124][_0xe052('0x6')],_0x455a6b[_0x333e2d][_0xc7a124][_0xe052('0x2')]));break;case 0xa:_0x24fd4b[_0x4ba2e8](util[_0xe052('0x17')]('user:%s',_0x455a6b[_0x333e2d][_0xc7a124][_0xe052('0x2')]));break;}}}}})[_0xe052('0x9')](function(){if(_0x4ba2e8===_0xe052('0x48')){var _0x4450ac=_[_0xe052('0x14')](_0x3ccde4[_0xe052('0x1e')],'id');return _0x3ccde4[_0xe052('0x49')](_0x4450ac)[_0xe052('0x9')](function(){for(var _0xb7d761=0x0;_0xb7d761<_0x4450ac['length'];_0xb7d761+=0x1){_0x35a7bd[_0xe052('0x4a')](_0xe052('0x4b'),{'ChatInteractionId':Number(_0x4450ac[_0xb7d761]),'UserId':Number(_0x3ccde4['id'])});}});}})[_0xe052('0x9')](function(){if(_0x4ba2e8===_0xe052('0x48')){var _0xa31a5b=_['map'](_0x3ccde4[_0xe052('0x20')],'id');return _0x3ccde4[_0xe052('0x4c')](_0xa31a5b)['then'](function(){for(var _0x992c89=0x0;_0x992c89<_0xa31a5b['length'];_0x992c89+=0x1){_0x35a7bd[_0xe052('0x4a')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0xa31a5b[_0x992c89]),'UserId':Number(_0x3ccde4['id'])});}});}})['then'](function(){if(_0x4ba2e8===_0xe052('0x48')){var _0x55205f=_[_0xe052('0x14')](_0x3ccde4[_0xe052('0x4d')],'id');return _0x3ccde4['removeFaxInteractions'](_0x55205f)[_0xe052('0x9')](function(){for(var _0x579bbf=0x0;_0x579bbf<_0x55205f['length'];_0x579bbf+=0x1){_0x35a7bd[_0xe052('0x4a')](_0xe052('0x4e'),{'FaxInteractionId':Number(_0x55205f[_0x579bbf]),'UserId':Number(_0x3ccde4['id'])});}});}})[_0xe052('0x9')](function(){if(_0x4ba2e8===_0xe052('0x48')){var _0x5cd26b=_[_0xe052('0x14')](_0x3ccde4['SmsInteractions'],'id');return _0x3ccde4[_0xe052('0x4f')](_0x5cd26b)[_0xe052('0x9')](function(){for(var _0x4a082a=0x0;_0x4a082a<_0x5cd26b['length'];_0x4a082a+=0x1){_0x35a7bd['emit'](_0xe052('0x50'),{'SmsInteractionId':Number(_0x5cd26b[_0x4a082a]),'UserId':Number(_0x3ccde4['id'])});}});}})[_0xe052('0x9')](function(){if(_0x4ba2e8===_0xe052('0x48')){var _0x116179=_[_0xe052('0x14')](_0x3ccde4['OpenchannelInteractions'],'id');return _0x3ccde4['removeOpenchannelInteractions'](_0x116179)['then'](function(){for(var _0x20a7bb=0x0;_0x20a7bb<_0x116179['length'];_0x20a7bb+=0x1){_0x35a7bd['emit'](_0xe052('0x51'),{'OpenchannelInteractionId':Number(_0x116179[_0x20a7bb]),'UserId':Number(_0x3ccde4['id'])});}});}})['then'](function(){if(_0x4ba2e8==='leave'){var _0x4215cf=_['map'](_0x3ccde4['WhatsappInteractions'],'id');return _0x3ccde4[_0xe052('0x52')](_0x4215cf)['then'](function(){for(var _0x28535b=0x0;_0x28535b<_0x4215cf[_0xe052('0x3e')];_0x28535b+=0x1){_0x35a7bd[_0xe052('0x4a')](_0xe052('0x53'),{'WhatsappInteractionId':Number(_0x4215cf[_0x28535b]),'UserId':Number(_0x3ccde4['id'])});}});}})['catch'](function(_0x587c24){_0x24fd4b[_0xe052('0x54')](_0x587c24);});}}function onDisconnect(_0x34f32f,_0x9d9ac2){joinOrLeave(_0x34f32f,'leave',_0x9d9ac2);}function onConnect(_0x590926){joinOrLeave(_0x590926,_0xe052('0x55'));}exports[_0xe052('0x56')]=function(_0x4be2fe){_0x4be2fe['on'](_0xe052('0x57'),function(_0x538479){_0x538479[_0xe052('0x58')](0x0);_0x538479['address']=_0x538479[_0xe052('0x59')][_0xe052('0x57')][_0xe052('0x5a')]+':'+_0x538479[_0xe052('0x59')][_0xe052('0x57')][_0xe052('0x5b')];_0x538479['connectedAt']=new Date();_0x538479[_0xe052('0x54')]=function(_0x206d48){console['log']('SocketIO\x20'+_0x538479['nsp']['name']+'['+_0x538479[_0xe052('0x5c')]+']',_0x206d48);};_0x538479['on']('disconnect',function(){onDisconnect(_0x538479,_0x4be2fe);_0x538479[_0xe052('0x54')](_0xe052('0x5d'));});onConnect(_0x538479);_0x538479[_0xe052('0x54')](_0xe052('0x5e'));});}; \ No newline at end of file +var _0xc575=['OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','ChatQueues','IvrCampaigns','getVoiceQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','mail','openchannel','telephone:%s','trunk:%s','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','leave','removeSmsInteractions','OpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','Agents','User','name','agent','telephone','type','ivr','UserProfileSection','findOne','then','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','map','resourceId','where','role','Campaign','format','length','user:%s','handshake','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions'];(function(_0x59f7a7,_0xce39b2){var _0x15da0d=function(_0x1e0e64){while(--_0x1e0e64){_0x59f7a7['push'](_0x59f7a7['shift']());}};_0x15da0d(++_0xce39b2);}(_0xc575,0x9d));var _0x5c57=function(_0x261fc3,_0x93ec46){_0x261fc3=_0x261fc3-0x0;var _0x83da99=_0xc575[_0x261fc3];return _0x83da99;};'use strict';var _=require(_0x5c57('0x0'));var util=require(_0x5c57('0x1'));var BPromise=require(_0x5c57('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x5c57('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x5c57('0x4'),'model':db[_0x5c57('0x5')],'attributes':['id',_0x5c57('0x6'),'role'],'raw':!![],'where':{'role':_0x5c57('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x5c57('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x5c57('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0x5c57('0x6')],'where':{'role':_0x5c57('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x5c57('0x6'),_0x5c57('0x9')],'where':{'type':_0x5c57('0xa')}};function getAssociatedResources(_0x50223d,_0x462152,_0x2f57d3){return db[_0x5c57('0xb')][_0x5c57('0xc')]({'where':{'name':_0x50223d,'userProfileId':_0x462152},'raw':!![]})[_0x5c57('0xd')](function(_0x39d09a){if(_0x39d09a){if(_0x39d09a['autoAssociation']){switch(_0x50223d){case _0x5c57('0xe'):case'ChatQueues':case _0x5c57('0xf'):case _0x5c57('0x10'):case _0x5c57('0x11'):case _0x5c57('0x12'):case _0x5c57('0x13'):return db[_0x2f57d3][_0x5c57('0x14')](queryQueues);case _0x5c57('0x15'):return db[_0x2f57d3][_0x5c57('0x14')](queryTelephones);case _0x5c57('0x16'):return db[_0x2f57d3][_0x5c57('0x14')](queryTrunks);case'IvrCampaigns':return db[_0x2f57d3][_0x5c57('0x14')](queryCampaigns);}}else{return db[_0x5c57('0x17')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x39d09a['id']},'raw':!![]})['then'](function(_0x331a6a){if(_0x331a6a){var _0x36a3e1={'where':{'id':_[_0x5c57('0x18')](_0x331a6a,_0x5c57('0x19'))},'raw':!![]};switch(_0x2f57d3){case _0x5c57('0x5'):_0x36a3e1[_0x5c57('0x1a')][_0x5c57('0x1b')]='telephone';break;case _0x5c57('0x1c'):_0x36a3e1['where'][_0x5c57('0x9')]=_0x5c57('0xa');break;}return db[_0x2f57d3]['findAll'](_0x36a3e1);}else{return[];}});}}else{return[];}})[_0x5c57('0xd')](function(_0x35116e){return _0x35116e;});}function joinOrLeaveQueues(_0x1c52e7,_0x35ca68,_0x123d2f,_0x227ed3){_0x1c52e7[_0x35ca68](util[_0x5c57('0x1d')]('%s:queue:%s',_0x123d2f,_0x227ed3[_0x5c57('0x6')]));if(_0x227ed3[_0x5c57('0x4')]){for(var _0x50581b=0x0;_0x50581b<_0x227ed3[_0x5c57('0x4')][_0x5c57('0x1e')];_0x50581b+=0x1){_0x1c52e7[_0x35ca68](util[_0x5c57('0x1d')](_0x5c57('0x1f'),_0x227ed3[_0x5c57('0x4')][_0x50581b]['name']));}}}function joinOrLeave(_0x482c76,_0x2669f8,_0x466350){var _0x2ffdb7;if(_0x482c76[_0x5c57('0x20')]['query']['id']){db[_0x5c57('0x5')]['find']({'attributes':['id','name',_0x5c57('0x1b'),_0x5c57('0x21')],'where':{'id':_0x482c76[_0x5c57('0x20')][_0x5c57('0x22')]['id']},'include':[{'model':db[_0x5c57('0x23')],'as':_0x5c57('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x5c57('0x25')],'as':_0x5c57('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x5c57('0x27')],'as':_0x5c57('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x5c57('0x29')],'as':_0x5c57('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x5c57('0x2b')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x5c57('0x2c')],'as':_0x5c57('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x5c57('0xd')](function(_0x1008fe){if(_0x1008fe){_0x2ffdb7=_0x1008fe;_0x482c76[_0x2669f8](util[_0x5c57('0x1d')](_0x5c57('0x1f'),_0x1008fe['name']));var _0x32f93f=[];switch(_0x1008fe[_0x5c57('0x1b')]){case _0x5c57('0x2e'):_0x482c76[_0x2669f8](_0x5c57('0x2f'));_0x482c76[_0x2669f8](_0x5c57('0x30'));if(queryQueues[_0x5c57('0x31')](_0x5c57('0x32'))){delete queryQueues[_0x5c57('0x32')];}_0x32f93f[_0x5c57('0x33')](db[_0x5c57('0x34')][_0x5c57('0x14')](queryQueues));_0x32f93f[_0x5c57('0x33')](db[_0x5c57('0x35')][_0x5c57('0x14')](queryQueues));_0x32f93f[_0x5c57('0x33')](db[_0x5c57('0x36')][_0x5c57('0x14')](queryQueues));_0x32f93f[_0x5c57('0x33')](db['SmsQueue'][_0x5c57('0x14')](queryQueues));_0x32f93f[_0x5c57('0x33')](db[_0x5c57('0x37')][_0x5c57('0x14')](queryQueues));_0x32f93f[_0x5c57('0x33')](db[_0x5c57('0x38')][_0x5c57('0x14')](queryQueues));_0x32f93f[_0x5c57('0x33')](db[_0x5c57('0x39')][_0x5c57('0x14')](queryQueues));_0x32f93f['push'](db[_0x5c57('0x5')]['findAll'](queryTelephones));_0x32f93f[_0x5c57('0x33')](db[_0x5c57('0x3a')]['findAll'](queryTrunks));_0x32f93f[_0x5c57('0x33')](db[_0x5c57('0x1c')][_0x5c57('0x14')](queryCampaigns));_0x32f93f[_0x5c57('0x33')](db[_0x5c57('0x5')][_0x5c57('0x14')](queryAgents));break;case _0x5c57('0x3b'):_0x482c76[_0x2669f8](_0x5c57('0x2f'));_0x482c76[_0x2669f8]('voice:outbound');_0x32f93f[_0x5c57('0x33')](getAssociatedResources(_0x5c57('0xe'),_0x1008fe[_0x5c57('0x21')],'VoiceQueue'));_0x32f93f['push'](getAssociatedResources(_0x5c57('0x3c'),_0x1008fe[_0x5c57('0x21')],'ChatQueue'));_0x32f93f['push'](getAssociatedResources(_0x5c57('0xf'),_0x1008fe[_0x5c57('0x21')],'FaxQueue'));_0x32f93f['push'](getAssociatedResources(_0x5c57('0x10'),_0x1008fe[_0x5c57('0x21')],'SmsQueue'));_0x32f93f['push'](getAssociatedResources(_0x5c57('0x11'),_0x1008fe[_0x5c57('0x21')],_0x5c57('0x37')));_0x32f93f[_0x5c57('0x33')](getAssociatedResources(_0x5c57('0x12'),_0x1008fe['userProfileId'],_0x5c57('0x38')));_0x32f93f[_0x5c57('0x33')](getAssociatedResources(_0x5c57('0x13'),_0x1008fe[_0x5c57('0x21')],_0x5c57('0x39')));_0x32f93f['push'](getAssociatedResources(_0x5c57('0x15'),_0x1008fe[_0x5c57('0x21')],_0x5c57('0x5')));_0x32f93f['push'](getAssociatedResources(_0x5c57('0x16'),_0x1008fe[_0x5c57('0x21')],_0x5c57('0x3a')));_0x32f93f[_0x5c57('0x33')](getAssociatedResources(_0x5c57('0x3d'),_0x1008fe[_0x5c57('0x21')],_0x5c57('0x1c')));_0x32f93f[_0x5c57('0x33')](db['User'][_0x5c57('0x14')](queryAgents));break;case _0x5c57('0x7'):_0x482c76[_0x2669f8]('voice:inbound');_0x482c76[_0x2669f8](_0x5c57('0x30'));_0x32f93f['push'](_0x1008fe[_0x5c57('0x3e')]({'attributes':['id',_0x5c57('0x6')]}));_0x32f93f['push'](_0x1008fe['getChatQueues']({'attributes':['id','name']}));_0x32f93f[_0x5c57('0x33')](_0x1008fe['getFaxQueues']({'attributes':['id',_0x5c57('0x6')]}));_0x32f93f['push'](_0x1008fe[_0x5c57('0x3f')]({'attributes':['id','name']}));_0x32f93f['push'](_0x1008fe[_0x5c57('0x40')]({'attributes':['id',_0x5c57('0x6')]}));_0x32f93f[_0x5c57('0x33')](_0x1008fe[_0x5c57('0x41')]({'attributes':['id',_0x5c57('0x6')]}));_0x32f93f[_0x5c57('0x33')](_0x1008fe[_0x5c57('0x42')]({'attributes':['id',_0x5c57('0x6')]}));break;}return BPromise[_0x5c57('0x43')](_0x32f93f);}})[_0x5c57('0xd')](function(_0x3a9710){if(_0x3a9710&&_0x3a9710[_0x5c57('0x1e')]){for(var _0x33fab9=0x0;_0x33fab9<_0x3a9710[_0x5c57('0x1e')];_0x33fab9+=0x1){for(var _0x36b770=0x0;_0x36b770<_0x3a9710[_0x33fab9][_0x5c57('0x1e')];_0x36b770+=0x1){switch(_0x33fab9){case 0x0:joinOrLeaveQueues(_0x482c76,_0x2669f8,_0x5c57('0x44'),_0x3a9710[_0x33fab9][_0x36b770]);break;case 0x1:joinOrLeaveQueues(_0x482c76,_0x2669f8,_0x5c57('0x45'),_0x3a9710[_0x33fab9][_0x36b770]);break;case 0x2:joinOrLeaveQueues(_0x482c76,_0x2669f8,_0x5c57('0x46'),_0x3a9710[_0x33fab9][_0x36b770]);break;case 0x3:joinOrLeaveQueues(_0x482c76,_0x2669f8,'sms',_0x3a9710[_0x33fab9][_0x36b770]);break;case 0x4:joinOrLeaveQueues(_0x482c76,_0x2669f8,_0x5c57('0x47'),_0x3a9710[_0x33fab9][_0x36b770]);break;case 0x5:joinOrLeaveQueues(_0x482c76,_0x2669f8,_0x5c57('0x48'),_0x3a9710[_0x33fab9][_0x36b770]);break;case 0x6:joinOrLeaveQueues(_0x482c76,_0x2669f8,'whatsapp',_0x3a9710[_0x33fab9][_0x36b770]);break;case 0x7:_0x482c76[_0x2669f8](util['format'](_0x5c57('0x49'),_0x3a9710[_0x33fab9][_0x36b770]['name']));break;case 0x8:_0x482c76[_0x2669f8](util[_0x5c57('0x1d')](_0x5c57('0x4a'),_0x3a9710[_0x33fab9][_0x36b770][_0x5c57('0x6')]));break;case 0x9:_0x482c76[_0x2669f8](util[_0x5c57('0x1d')]('campaign:%s:%s',_0x3a9710[_0x33fab9][_0x36b770][_0x5c57('0x9')],_0x3a9710[_0x33fab9][_0x36b770][_0x5c57('0x6')]));break;case 0xa:_0x482c76[_0x2669f8](util['format'](_0x5c57('0x1f'),_0x3a9710[_0x33fab9][_0x36b770][_0x5c57('0x6')]));break;}}}}})[_0x5c57('0xd')](function(){if(_0x2669f8==='leave'){var _0x3a83ce=_[_0x5c57('0x18')](_0x2ffdb7['ChatInteractions'],'id');return _0x2ffdb7[_0x5c57('0x4b')](_0x3a83ce)[_0x5c57('0xd')](function(){for(var _0x14f39d=0x0;_0x14f39d<_0x3a83ce['length'];_0x14f39d+=0x1){_0x466350[_0x5c57('0x4c')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x3a83ce[_0x14f39d]),'UserId':Number(_0x2ffdb7['id'])});}});}})['then'](function(){if(_0x2669f8==='leave'){var _0x23641d=_[_0x5c57('0x18')](_0x2ffdb7[_0x5c57('0x26')],'id');return _0x2ffdb7[_0x5c57('0x4d')](_0x23641d)[_0x5c57('0xd')](function(){for(var _0x5cfe34=0x0;_0x5cfe34<_0x23641d[_0x5c57('0x1e')];_0x5cfe34+=0x1){_0x466350[_0x5c57('0x4c')](_0x5c57('0x4e'),{'MailInteractionId':Number(_0x23641d[_0x5cfe34]),'UserId':Number(_0x2ffdb7['id'])});}});}})['then'](function(){if(_0x2669f8==='leave'){var _0x5a3cd6=_['map'](_0x2ffdb7[_0x5c57('0x28')],'id');return _0x2ffdb7['removeFaxInteractions'](_0x5a3cd6)[_0x5c57('0xd')](function(){for(var _0x59da69=0x0;_0x59da69<_0x5a3cd6[_0x5c57('0x1e')];_0x59da69+=0x1){_0x466350[_0x5c57('0x4c')](_0x5c57('0x4f'),{'FaxInteractionId':Number(_0x5a3cd6[_0x59da69]),'UserId':Number(_0x2ffdb7['id'])});}});}})[_0x5c57('0xd')](function(){if(_0x2669f8===_0x5c57('0x50')){var _0x11cf36=_[_0x5c57('0x18')](_0x2ffdb7['SmsInteractions'],'id');return _0x2ffdb7[_0x5c57('0x51')](_0x11cf36)[_0x5c57('0xd')](function(){for(var _0x2832e8=0x0;_0x2832e8<_0x11cf36[_0x5c57('0x1e')];_0x2832e8+=0x1){_0x466350[_0x5c57('0x4c')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x11cf36[_0x2832e8]),'UserId':Number(_0x2ffdb7['id'])});}});}})['then'](function(){if(_0x2669f8===_0x5c57('0x50')){var _0x4605a4=_['map'](_0x2ffdb7[_0x5c57('0x52')],'id');return _0x2ffdb7['removeOpenchannelInteractions'](_0x4605a4)[_0x5c57('0xd')](function(){for(var _0x2a9e35=0x0;_0x2a9e35<_0x4605a4[_0x5c57('0x1e')];_0x2a9e35+=0x1){_0x466350[_0x5c57('0x4c')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x4605a4[_0x2a9e35]),'UserId':Number(_0x2ffdb7['id'])});}});}})['then'](function(){if(_0x2669f8==='leave'){var _0xb4dabd=_[_0x5c57('0x18')](_0x2ffdb7[_0x5c57('0x2d')],'id');return _0x2ffdb7[_0x5c57('0x53')](_0xb4dabd)['then'](function(){for(var _0xb86f5f=0x0;_0xb86f5f<_0xb4dabd[_0x5c57('0x1e')];_0xb86f5f+=0x1){_0x466350[_0x5c57('0x4c')](_0x5c57('0x54'),{'WhatsappInteractionId':Number(_0xb4dabd[_0xb86f5f]),'UserId':Number(_0x2ffdb7['id'])});}});}})[_0x5c57('0x55')](function(_0xb6afad){_0x482c76[_0x5c57('0x56')](_0xb6afad);});}}function onDisconnect(_0x329935,_0x4ee42e){joinOrLeave(_0x329935,_0x5c57('0x50'),_0x4ee42e);}function onConnect(_0x24b8e6){joinOrLeave(_0x24b8e6,_0x5c57('0x57'));}exports[_0x5c57('0x58')]=function(_0x2134e3){_0x2134e3['on'](_0x5c57('0x59'),function(_0x598b9c){_0x598b9c[_0x5c57('0x5a')](0x0);_0x598b9c[_0x5c57('0x5b')]=_0x598b9c[_0x5c57('0x5c')][_0x5c57('0x59')]['remoteAddress']+':'+_0x598b9c[_0x5c57('0x5c')][_0x5c57('0x59')][_0x5c57('0x5d')];_0x598b9c[_0x5c57('0x5e')]=new Date();_0x598b9c[_0x5c57('0x56')]=function(_0x4ba426){console['log'](_0x5c57('0x5f')+_0x598b9c[_0x5c57('0x60')][_0x5c57('0x6')]+'['+_0x598b9c[_0x5c57('0x5b')]+']',_0x4ba426);};_0x598b9c['on'](_0x5c57('0x61'),function(){onDisconnect(_0x598b9c,_0x2134e3);_0x598b9c[_0x5c57('0x56')](_0x5c57('0x62'));});onConnect(_0x598b9c);_0x598b9c[_0x5c57('0x56')](_0x5c57('0x63'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 7265641..c757a09 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 _0xfc4e=['catch','get','channel','event','direction','UserId','name','format','SIP/%s','outgoingmessage','changed','closed','User','find','interface','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','Chat','newinteraction','ChatInteraction','afterUpdate','closedinteraction','ChatMessage','Sms','SmsInteraction','newmessage','WhatsappInteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','afterCreate','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code'];(function(_0x36c36b,_0x263578){var _0x215066=function(_0x391dff){while(--_0x391dff){_0x36c36b['push'](_0x36c36b['shift']());}};_0x215066(++_0x263578);}(_0xfc4e,0x86));var _0xefc4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xfc4e[_0x209941];return _0x1e8729;};'use strict';var util=require(_0xefc4('0x0'));var db=require(_0xefc4('0x1'))['db'];var jayson=require(_0xefc4('0x2'));var logger=require(_0xefc4('0x3'))(_0xefc4('0x4'));var client=jayson[_0xefc4('0x5')]['http']({'port':0x232a});var triggers=[{'channel':_0xefc4('0x6'),'model':'ChatInteraction','event':'afterCreate','condition':_0xefc4('0x7'),'callback':afterCreate},{'channel':_0xefc4('0x6'),'model':_0xefc4('0x8'),'event':_0xefc4('0x9'),'condition':_0xefc4('0xa'),'callback':afterUpdate},{'channel':'Chat','model':_0xefc4('0xb'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xefc4('0xc'),'model':_0xefc4('0xd'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0xefc4('0xc'),'model':_0xefc4('0xd'),'event':_0xefc4('0x9'),'condition':_0xefc4('0xa'),'callback':afterUpdate},{'channel':_0xefc4('0xc'),'model':'SmsMessage','event':'afterCreate','condition':_0xefc4('0xe'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0xefc4('0xf'),'event':'afterCreate','condition':_0xefc4('0x7'),'callback':afterCreate},{'channel':_0xefc4('0x10'),'model':_0xefc4('0xf'),'event':_0xefc4('0x9'),'condition':_0xefc4('0xa'),'callback':afterUpdate},{'channel':_0xefc4('0x10'),'model':_0xefc4('0x11'),'event':'afterCreate','condition':_0xefc4('0xe'),'callback':afterCreateMessage},{'channel':_0xefc4('0x12'),'model':_0xefc4('0x13'),'event':_0xefc4('0x14'),'condition':_0xefc4('0x7'),'callback':afterCreate},{'channel':_0xefc4('0x12'),'model':_0xefc4('0x13'),'event':'afterUpdate','condition':_0xefc4('0xa'),'callback':afterUpdate},{'channel':_0xefc4('0x12'),'model':_0xefc4('0x15'),'event':_0xefc4('0x14'),'condition':_0xefc4('0xe'),'callback':afterCreateMessage},{'channel':_0xefc4('0x16'),'model':_0xefc4('0x17'),'event':_0xefc4('0x14'),'condition':_0xefc4('0x7'),'callback':afterCreate},{'channel':_0xefc4('0x16'),'model':'MailInteraction','event':_0xefc4('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xefc4('0x16'),'model':'MailMessage','event':_0xefc4('0x14'),'condition':_0xefc4('0xe'),'callback':afterCreateMessage},{'channel':_0xefc4('0x18'),'model':_0xefc4('0x19'),'event':_0xefc4('0x14'),'condition':_0xefc4('0x7'),'callback':afterCreate},{'channel':_0xefc4('0x18'),'model':_0xefc4('0x19'),'event':_0xefc4('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Openchannel','model':_0xefc4('0x1a'),'event':_0xefc4('0x14'),'condition':_0xefc4('0xe'),'callback':afterCreateMessage}];function request(_0x512623){return client[_0xefc4('0x1b')](_0xefc4('0x1c'),_0x512623)[_0xefc4('0x1d')](function(_0x50da5a){logger[_0xefc4('0x1e')](_0xefc4('0x1f'),'EventManager',_0x50da5a);if(_0x50da5a['error']){if(_0x50da5a[_0xefc4('0x20')][_0xefc4('0x21')]===0x1f4){logger[_0xefc4('0x20')](_0xefc4('0x1f'),_0xefc4('0x1c'),_0x50da5a[_0xefc4('0x20')]);}}})[_0xefc4('0x22')](function(_0x291476){logger[_0xefc4('0x20')](_0xefc4('0x1f'),_0xefc4('0x1c'),_0x291476);});}function afterCreateMessage(_0x28d566,_0x4f94f2){return function(_0x448d5b,_0x49c94d){_0x448d5b=_0x448d5b[_0xefc4('0x23')]({'plain':!![]});_0x448d5b[_0xefc4('0x24')]=_0x28d566;_0x448d5b[_0xefc4('0x25')]=_0x448d5b[_0xefc4('0x26')];if(_0x448d5b[_0xefc4('0x27')]){return db['User']['find']({'where':{'id':_0x448d5b[_0xefc4('0x27')]},'attributes':['id',_0xefc4('0x28')],'raw':!![]})[_0xefc4('0x1d')](function(_0x1150d8){_0x448d5b['interface']=util[_0xefc4('0x29')](_0xefc4('0x2a'),_0x1150d8['name']);_0x448d5b[_0xefc4('0x24')]=_0x28d566;return request({'event':'incomingmessage','message':_0x448d5b});})[_0xefc4('0x22')](function(_0xd53113){console[_0xefc4('0x20')](_0xd53113);});}else{return request({'event':_0xefc4('0x2b'),'message':_0x448d5b});}};}function afterCreate(_0x820b7f,_0x1957e3){return function(_0x10472d,_0xa7d2cc){_0x10472d=_0x10472d[_0xefc4('0x23')]({'plain':!![]});_0x10472d['channel']=_0x820b7f;_0x10472d[_0xefc4('0x25')]='opened';return request({'event':_0x1957e3,'message':_0x10472d});};}function afterUpdate(_0x524c6e,_0x20ade6){return function(_0x5dd664,_0x3c3f4c){if(_0x5dd664[_0xefc4('0x2c')](_0xefc4('0x2d'))&&_0x5dd664[_0xefc4('0x2d')]){_0x5dd664=_0x5dd664[_0xefc4('0x23')]({'plain':!![]});_0x5dd664[_0xefc4('0x24')]=_0x524c6e;_0x5dd664['event']=_0xefc4('0x2d');if(_0x5dd664[_0xefc4('0x27')]){return db[_0xefc4('0x2e')][_0xefc4('0x2f')]({'where':{'id':_0x5dd664['UserId']},'attributes':['id',_0xefc4('0x28')],'raw':!![]})[_0xefc4('0x1d')](function(_0x4d2590){_0x5dd664[_0xefc4('0x30')]=util[_0xefc4('0x29')]('SIP/%s',_0x4d2590[_0xefc4('0x28')]);return request({'event':_0x20ade6,'message':_0x5dd664});})[_0xefc4('0x22')](function(_0x3a650a){console[_0xefc4('0x20')](_0x3a650a);});}else{return request({'event':_0x20ade6,'message':_0x5dd664});}}};}exports['default']=function(){for(var _0x15013c=0x0;_0x15013c=_0x475fdc[_0x4aa4('0x12')]){throw Error(_0x4aa4('0x13'));}_0x2bf1d8(_0x9c7283);})[_0x4aa4('0x14')](function(_0x38b2af){_0x5dc07b(_0x38b2af);});});}; \ No newline at end of file +var _0xf7ec=['then','agents','catch','lodash','bluebird','../mysqldb','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','isUndefined','blockedAt','getLicense','role','agent','User','count'];(function(_0x4c73f5,_0x5524bb){var _0x3489ef=function(_0x38d74e){while(--_0x38d74e){_0x4c73f5['push'](_0x4c73f5['shift']());}};_0x3489ef(++_0x5524bb);}(_0xf7ec,0xdb));var _0xcf7e=function(_0x287253,_0x380a6f){_0x287253=_0x287253-0x0;var _0x57c547=_0xf7ec[_0x287253];return _0x57c547;};'use strict';var _=require(_0xcf7e('0x0'));var BPromise=require(_0xcf7e('0x1'));var db=require(_0xcf7e('0x2'))['db'];var util=require('./license/util');var channels=[_0xcf7e('0x3'),_0xcf7e('0x4'),_0xcf7e('0x5'),_0xcf7e('0x6'),_0xcf7e('0x7'),_0xcf7e('0x8'),_0xcf7e('0x9')];exports[_0xcf7e('0xa')]=function(){return channels;};exports[_0xcf7e('0xb')]=function(_0x9a3a2f){_0x9a3a2f=_0x9a3a2f[_0xcf7e('0xc')]();return _[_0xcf7e('0xd')](channels,_0x9a3a2f);};exports['clearBlockUser']=function(_0x1809e7,_0x4087a9,_0x185f33,_0x5be0d0){var _0x6cf93f={'loginAttempts':_0x4087a9,'blocked':_0x185f33};if(!_[_0xcf7e('0xe')](_0x5be0d0)){_0x6cf93f[_0xcf7e('0xf')]=_0x5be0d0;}return _0x1809e7['updateAttributes'](_0x6cf93f);};exports[_0xcf7e('0x10')]=function(_0x305617){return new BPromise(function(_0x54dea7,_0xb5c913){var _0x1140bd=0x0;if(_0x305617[_0xcf7e('0x11')]!==_0xcf7e('0x12')){_0x54dea7(_0x305617);}db[_0xcf7e('0x13')][_0xcf7e('0x14')]({'where':{'role':_0xcf7e('0x12'),'online':!![],'id':{'$ne':_0x305617['id']}}})[_0xcf7e('0x15')](function(_0x363441){_0x1140bd=_0x363441;return util[_0xcf7e('0x10')]();})[_0xcf7e('0x15')](function(_0x52e8dc){if(_0x52e8dc&&_0x52e8dc[_0xcf7e('0x16')]&&_0x1140bd>=_0x52e8dc['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x54dea7(_0x305617);})[_0xcf7e('0x17')](function(_0x247931){_0xb5c913(_0x247931);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 60dc2b5..c2a8603 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53c5=['exports','404','status','render','json','send'];(function(_0xc8f7f7,_0x8de6f8){var _0x2b6293=function(_0x3a86f8){while(--_0x3a86f8){_0xc8f7f7['push'](_0xc8f7f7['shift']());}};_0x2b6293(++_0x8de6f8);}(_0x53c5,0x1c2));var _0x553c=function(_0x4b487e,_0x31d485){_0x4b487e=_0x4b487e-0x0;var _0xbce06b=_0x53c5[_0x4b487e];return _0xbce06b;};'use strict';module[_0x553c('0x0')][0x194]=function pageNotFound(_0x180d25,_0x545eae){var _0x14a3f6=_0x553c('0x1');var _0x1f259d=0x194;var _0x1a34ee={'status':_0x1f259d};_0x545eae[_0x553c('0x2')](_0x1a34ee['status']);_0x545eae[_0x553c('0x3')](_0x14a3f6,{},function(_0x272541,_0x3e94b2){if(_0x272541){return _0x545eae[_0x553c('0x2')](_0x1a34ee['status'])[_0x553c('0x4')](_0x1a34ee);}_0x545eae[_0x553c('0x5')](_0x3e94b2);});}; \ No newline at end of file +var _0x324d=['exports','404','status','render','send'];(function(_0x34ef2a,_0x41a2f8){var _0x2213f1=function(_0x898d38){while(--_0x898d38){_0x34ef2a['push'](_0x34ef2a['shift']());}};_0x2213f1(++_0x41a2f8);}(_0x324d,0x118));var _0xd324=function(_0xc2ea95,_0x99a101){_0xc2ea95=_0xc2ea95-0x0;var _0x3a1cb1=_0x324d[_0xc2ea95];return _0x3a1cb1;};'use strict';module[_0xd324('0x0')][0x194]=function pageNotFound(_0x8dc0d9,_0x20d7e0){var _0x59b215=_0xd324('0x1');var _0x193594=0x194;var _0x470574={'status':_0x193594};_0x20d7e0[_0xd324('0x2')](_0x470574[_0xd324('0x2')]);_0x20d7e0[_0xd324('0x3')](_0x59b215,{},function(_0x3e1133,_0x2196ec){if(_0x3e1133){return _0x20d7e0['status'](_0x470574[_0xd324('0x2')])['json'](_0x470574);}_0x20d7e0[_0xd324('0x4')](_0x2196ec);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 3c4bd1b..e2f0dfd 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1932=['VoiceMusicOnHold','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','TrunkId','TrunkBackup','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceMailMessage','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','ContactId','MailServerIn','MailAccountId','Imap','Disposition','Answers','Interactions','List','ListId','Template','TemplateId','user_has_mail_accounts','team_has_mail_queues','Account','Contact','Owner','Tag','mail_interaction_has_tags','Tags','Users','MailInteractionId','Attachments','MailApplication','restrict','IntervalId','TagId','Dashboard','Items','FaxAccountId','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','ThroughTags','Interaction','AttachmentId','team_has_fax_queues','Dispositions','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatMessage','user_has_chat_websites','Queue','Website','ChatInteractionId','ChatInteraction','chat_interaction_has_tags','ChatOfflineMessage','team_has_chat_queues','ChatInternalMessage','ChatGroupId','CompanyId','JscriptySessions','Company','cm_contact_has_tags','Agent','CampaignId','OwnerId','OneAll','AutomationAllId','Any','OneAny','Actions','ParentId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','AnalyticMetric','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Field','VariableId','Description','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerConfiguration','Dynamics365Account','FreshsalesField','FromId','ToId','SessionId','ProjectId','JscriptyAnswerReport','user_has_square_projects','team_has_voice_queues','team_has_whatsapp_queues','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ChatTransferReport','FromChatWebsiteId','FromAccount','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','ToFaxQueueId','ToAccount','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','userProfileId','UserProfileSections','UserProfileSection','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','sequelize','lodash','jstz','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','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','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/template/template.model','Trigger','Variable','Integration','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../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','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','../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','JscriptyProject','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','VoiceMail','UserId','hasMany','VoiceQueuesRt','cascade','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','belongsTo','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','VoiceQueues','MailQueues','ChatQueues','UserChatQueue','FaxQueues','SmsQueue','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','VoicePrefix','user_has_voice_prefixes','FaxAccounts','MailAccounts','OpenchannelAccounts','user_has_sms_accounts','WhatsappAccounts','SquareProjects','VoiceExtension','ChanSpyId','Applications'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x1932,0xbb));var _0x2193=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x1932[_0x24061a];return _0x82054e;};'use strict';var path=require(_0x2193('0x0'));var config=require(_0x2193('0x1'));var Sequelize=require(_0x2193('0x2'));var _=require(_0x2193('0x3'));var jstz=require(_0x2193('0x4'));var timezone=jstz['determine']();config[_0x2193('0x2')]=_[_0x2193('0x5')](config[_0x2193('0x2')],{'database':_0x2193('0x6'),'username':_0x2193('0x7'),'password':_0x2193('0x8'),'options':{'host':_0x2193('0x9'),'port':0xcea,'dialect':_0x2193('0xa'),'dialectOptions':{'charset':_0x2193('0xb')},'logging':![],'timezone':timezone[_0x2193('0xc')](),'define':{'charset':_0x2193('0xd'),'collate':_0x2193('0xe')}}});config[_0x2193('0xf')]=_[_0x2193('0x5')](config['sequelizeHistory'],{'database':_0x2193('0x6'),'username':_0x2193('0x7'),'password':_0x2193('0x8'),'options':{'host':_0x2193('0x9'),'port':0xcea,'dialect':_0x2193('0xa'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x2193('0xc')](),'define':{'charset':_0x2193('0xd'),'collate':_0x2193('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2193('0x2')][_0x2193('0x10')],config[_0x2193('0x2')][_0x2193('0x11')],config[_0x2193('0x2')][_0x2193('0x12')],config['sequelize'][_0x2193('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x2193('0x10')],config[_0x2193('0xf')][_0x2193('0x11')],config[_0x2193('0xf')]['password'],config[_0x2193('0xf')]['options'])};db[_0x2193('0x14')]=db['sequelize'][_0x2193('0x15')](_0x2193('0x16'));db[_0x2193('0x17')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x18'));db[_0x2193('0x19')]=db[_0x2193('0x2')][_0x2193('0x15')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0x2193('0x2')][_0x2193('0x15')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db['sequelize'][_0x2193('0x15')](_0x2193('0x1a'));db[_0x2193('0x1b')]=db[_0x2193('0x2')]['import']('../api/voiceQueue/voiceQueue.model');db[_0x2193('0x1c')]=db['sequelize'][_0x2193('0x15')](_0x2193('0x1d'));db[_0x2193('0x1e')]=db[_0x2193('0x2')]['import'](_0x2193('0x1f'));db['VoiceMail']=db['sequelize'][_0x2193('0x15')](_0x2193('0x20'));db['VoiceMailMessage']=db['sequelize'][_0x2193('0x15')](_0x2193('0x21'));db['VoiceCallReport']=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x22'));db[_0x2193('0x23')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x24'));db['VoiceAgentReport']=db['sequelize'][_0x2193('0x15')](_0x2193('0x25'));db[_0x2193('0x26')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x27'));db[_0x2193('0x28')]=db[_0x2193('0x2')][_0x2193('0x15')]('../api/memberReport/memberReport.model');db[_0x2193('0x29')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x2a'));db['VoiceTransferReport']=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x2b'));db[_0x2193('0x2c')]=db['sequelize'][_0x2193('0x15')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x2193('0x2d')]=db[_0x2193('0x2')]['import'](_0x2193('0x2e'));db['UserChatQueue']=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x2f'));db[_0x2193('0x30')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x31'));db[_0x2193('0x32')]=db[_0x2193('0x2')]['import'](_0x2193('0x33'));db[_0x2193('0x34')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x35'));db['UserOpenchannelQueue']=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x36'));db[_0x2193('0x37')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x38'));db['MailServerIn']=db[_0x2193('0x2')][_0x2193('0x15')]('../api/mailServerIn/mailServerIn.model');db[_0x2193('0x39')]=db[_0x2193('0x2')]['import'](_0x2193('0x3a'));db[_0x2193('0x3b')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x3c'));db[_0x2193('0x3d')]=db[_0x2193('0x2')]['import'](_0x2193('0x3e'));db['MailSubstatus']=db[_0x2193('0x2')]['import']('../api/mailSubstatus/mailSubstatus.model');db[_0x2193('0x3f')]=db[_0x2193('0x2')]['import'](_0x2193('0x40'));db[_0x2193('0x41')]=db[_0x2193('0x2')][_0x2193('0x15')]('../api/mailMessage/mailMessage.model');db['MailApplication']=db['sequelize']['import'](_0x2193('0x42'));db[_0x2193('0x43')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x44'));db['Dashboard']=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x45'));db[_0x2193('0x46')]=db[_0x2193('0x2')][_0x2193('0x15')]('../api/dashboardItem/dashboardItem.model');db[_0x2193('0x47')]=db[_0x2193('0x2')][_0x2193('0x15')]('../api/faxAccount/faxAccount.model');db[_0x2193('0x48')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x49'));db[_0x2193('0x4a')]=db[_0x2193('0x2')]['import'](_0x2193('0x4b'));db[_0x2193('0x4c')]=db['sequelize']['import'](_0x2193('0x4d'));db[_0x2193('0x4e')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x4f'));db[_0x2193('0x50')]=db[_0x2193('0x2')]['import'](_0x2193('0x51'));db[_0x2193('0x52')]=db[_0x2193('0x2')][_0x2193('0x15')]('../api/smsAccount/smsAccount.model');db[_0x2193('0x53')]=db['sequelize'][_0x2193('0x15')](_0x2193('0x54'));db['SmsInteraction']=db[_0x2193('0x2')]['import'](_0x2193('0x55'));db[_0x2193('0x56')]=db[_0x2193('0x2')]['import']('../api/smsMessage/smsMessage.model');db['SmsQueue']=db['sequelize'][_0x2193('0x15')](_0x2193('0x57'));db[_0x2193('0x58')]=db['sequelize'][_0x2193('0x15')](_0x2193('0x59'));db[_0x2193('0x5a')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x5b'));db[_0x2193('0x5c')]=db[_0x2193('0x2')]['import']('../api/openchannelInteraction/openchannelInteraction.model');db[_0x2193('0x5d')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x5e'));db[_0x2193('0x5f')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x60'));db[_0x2193('0x61')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x62'));db[_0x2193('0x63')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x2193('0x64')]=db[_0x2193('0x2')]['import'](_0x2193('0x65'));db['ChatInteraction']=db[_0x2193('0x2')]['import'](_0x2193('0x66'));db['ChatMessage']=db[_0x2193('0x2')][_0x2193('0x15')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db['sequelize']['import'](_0x2193('0x67'));db[_0x2193('0x68')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x69'));db[_0x2193('0x6a')]=db['sequelize'][_0x2193('0x15')]('../api/chatGroup/chatGroup.model');db[_0x2193('0x6b')]=db[_0x2193('0x2')]['import'](_0x2193('0x6c'));db[_0x2193('0x6d')]=db['sequelize'][_0x2193('0x15')]('../api/cmCompany/cmCompany.model');db[_0x2193('0x6e')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x6f'));db[_0x2193('0x70')]=db[_0x2193('0x2')][_0x2193('0x15')]('../api/cmHopper/cmHopper.model');db[_0x2193('0x71')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x72'));db[_0x2193('0x73')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x74'));db[_0x2193('0x75')]=db[_0x2193('0x2')][_0x2193('0x15')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db[_0x2193('0x2')]['import'](_0x2193('0x76'));db[_0x2193('0x77')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x78'));db[_0x2193('0x79')]=db['sequelize'][_0x2193('0x15')](_0x2193('0x7a'));db[_0x2193('0x7b')]=db[_0x2193('0x2')][_0x2193('0x15')]('../api/automation/automation.model');db[_0x2193('0x7c')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x7d'));db['Disposition']=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x7e'));db[_0x2193('0x7f')]=db['sequelize'][_0x2193('0x15')](_0x2193('0x80'));db[_0x2193('0x81')]=db[_0x2193('0x2')]['import'](_0x2193('0x82'));db[_0x2193('0x83')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x84'));db[_0x2193('0x85')]=db[_0x2193('0x2')]['import']('../api/cdr/cdr.model');db[_0x2193('0x86')]=db[_0x2193('0x2')][_0x2193('0x15')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x2193('0x87')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x88'));db[_0x2193('0x89')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x8a'));db['Tag']=db[_0x2193('0x2')]['import']('../api/tag/tag.model');db['Template']=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x8b'));db[_0x2193('0x8c')]=db[_0x2193('0x2')]['import']('../api/trigger/trigger.model');db[_0x2193('0x8d')]=db[_0x2193('0x2')][_0x2193('0x15')]('../api/variable/variable.model');db[_0x2193('0x8e')]=db['sequelize'][_0x2193('0x15')]('../api/integration/integration.model');db['IntegrationReport']=db[_0x2193('0x2')][_0x2193('0x15')]('../api/integrationReport/integrationReport.model');db[_0x2193('0x8f')]=db['sequelize']['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0x2193('0x90')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x91'));db[_0x2193('0x92')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x93'));db['AnalyticMetric']=db[_0x2193('0x2')][_0x2193('0x15')]('../api/analyticMetric/analyticMetric.model');db[_0x2193('0x94')]=db['sequelize']['import'](_0x2193('0x95'));db[_0x2193('0x96')]=db[_0x2193('0x2')]['import'](_0x2193('0x97'));db[_0x2193('0x98')]=db[_0x2193('0x2')]['import'](_0x2193('0x99'));db['SalesforceConfiguration']=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x9a'));db[_0x2193('0x9b')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x9c'));db[_0x2193('0x9d')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x9e'));db[_0x2193('0x9f')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xa0'));db[_0x2193('0xa1')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xa2'));db[_0x2193('0xa3')]=db[_0x2193('0x2')]['import'](_0x2193('0xa4'));db[_0x2193('0xa5')]=db[_0x2193('0x2')]['import'](_0x2193('0xa6'));db[_0x2193('0xa7')]=db['sequelize'][_0x2193('0x15')]('../api/intDeskField/intDeskField.model');db[_0x2193('0xa8')]=db['sequelize'][_0x2193('0x15')](_0x2193('0xa9'));db[_0x2193('0xaa')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xab'));db[_0x2193('0xac')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xad'));db[_0x2193('0xae')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xaf'));db[_0x2193('0xb0')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xb1'));db['ZendeskField']=db['sequelize'][_0x2193('0x15')]('../api/intZendeskField/intZendeskField.model');db[_0x2193('0xb2')]=db['sequelize'][_0x2193('0x15')](_0x2193('0xb3'));db[_0x2193('0xb4')]=db[_0x2193('0x2')]['import'](_0x2193('0xb5'));db[_0x2193('0xb6')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xb7'));db['VtigerAccount']=db['sequelize']['import']('../api/intVtigerAccount/intVtigerAccount.model');db['VtigerConfiguration']=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xb8'));db[_0x2193('0xb9')]=db['sequelize']['import']('../api/intVtigerField/intVtigerField.model');db[_0x2193('0xba')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xbb'));db[_0x2193('0xbc')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xbd'));db[_0x2193('0xbe')]=db['sequelize'][_0x2193('0x15')](_0x2193('0xbf'));db['Dynamics365Account']=db[_0x2193('0x2')][_0x2193('0x15')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x2193('0xc0')]=db[_0x2193('0x2')][_0x2193('0x15')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x2193('0xc1')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xc2'));db[_0x2193('0xc3')]=db['sequelize'][_0x2193('0x15')](_0x2193('0xc4'));db[_0x2193('0xc5')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xc6'));db['FreshsalesField']=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xc7'));db['Integration']=db[_0x2193('0x2')][_0x2193('0x15')]('../api/integration/integration.model');db[_0x2193('0xc8')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xc9'));db[_0x2193('0xca')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xcb'));db['ChatInternalMessage']=db['sequelize'][_0x2193('0x15')](_0x2193('0xcc'));db['JscriptyAnswerReport']=db[_0x2193('0x2')]['import'](_0x2193('0xcd'));db[_0x2193('0xce')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xcf'));db[_0x2193('0xd0')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xd1'));db[_0x2193('0xd2')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xd3'));db[_0x2193('0xd4')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xd5'));db[_0x2193('0xd6')]=db['sequelize'][_0x2193('0x15')]('../api/squareReportDetail/squareReportDetail.model');db[_0x2193('0xd7')]=db[_0x2193('0x2')][_0x2193('0x15')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xd8'));db[_0x2193('0xd9')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xda'));db[_0x2193('0xdb')]=db[_0x2193('0x2')]['import']('../api/squareProject/squareProject.model');db[_0x2193('0xdc')]=db['sequelize'][_0x2193('0x15')]('../api/squareRecording/squareRecording.model');db[_0x2193('0xdd')]=db[_0x2193('0x2')]['import'](_0x2193('0xde'));db[_0x2193('0xdf')]=db['sequelize'][_0x2193('0x15')](_0x2193('0xe0'));db[_0x2193('0xe1')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xe2'));db[_0x2193('0xe3')]=db['sequelize'][_0x2193('0x15')](_0x2193('0xe4'));db['Migration']=db[_0x2193('0x2')]['import']('../api/migration/migration.model');db[_0x2193('0xe5')]=db[_0x2193('0x2')]['import'](_0x2193('0xe6'));db['Plugin']=db[_0x2193('0x2')]['import'](_0x2193('0xe7'));db[_0x2193('0xe8')]=db[_0x2193('0x2')]['import'](_0x2193('0xe9'));db['ChatTransferReport']=db[_0x2193('0x2')]['import']('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db['sequelize'][_0x2193('0x15')]('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xea'));db[_0x2193('0xeb')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xec'));db['CmList']=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xed'));db['VoicePrefix']=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xee'));db[_0x2193('0xef')]=db[_0x2193('0x2')][_0x2193('0x15')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xf0'));db[_0x2193('0xf1')]=db['sequelize'][_0x2193('0x15')](_0x2193('0xf2'));db[_0x2193('0xf3')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xf4'));db[_0x2193('0xf5')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xf6'));db[_0x2193('0xf7')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xf8'));db[_0x2193('0xf9')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xfa'));db[_0x2193('0xfb')]=db[_0x2193('0x2')]['import'](_0x2193('0xfc'));db[_0x2193('0xfd')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xfe'));db['WhatsappQueueReport']=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0xff'));db[_0x2193('0x100')]=db[_0x2193('0x2')]['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x2193('0x101')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x102'));db[_0x2193('0x103')]=db[_0x2193('0x2')][_0x2193('0x15')](_0x2193('0x104'));db['User'][_0x2193('0x105')](db[_0x2193('0x106')],{'as':_0x2193('0x106'),'onDelete':'cascade','foreignKey':_0x2193('0x107')});db[_0x2193('0x14')][_0x2193('0x108')](db['VoiceRecording'],{'as':'Recordings','foreignKey':_0x2193('0x107')});db[_0x2193('0x14')][_0x2193('0x108')](db['UserVoiceQueueRt'],{'as':_0x2193('0x109'),'foreignKey':_0x2193('0x107')});db[_0x2193('0x14')][_0x2193('0x108')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x2193('0x10a'),'hooks':!![]});db['User'][_0x2193('0x108')](db[_0x2193('0x73')],{'as':_0x2193('0x10b'),'foreignKey':'UserId'});db[_0x2193('0x14')][_0x2193('0x108')](db[_0x2193('0x75')],{'as':_0x2193('0x10c'),'foreignKey':_0x2193('0x107')});db[_0x2193('0x14')][_0x2193('0x108')](db[_0x2193('0x10d')],{'as':_0x2193('0x10d'),'foreignKey':_0x2193('0x107')});db[_0x2193('0x14')][_0x2193('0x108')](db[_0x2193('0x5c')],{'as':_0x2193('0x10e'),'foreignKey':_0x2193('0x107')});db[_0x2193('0x14')]['hasMany'](db['ChatInteraction'],{'as':_0x2193('0x10f'),'foreignKey':'UserId'});db[_0x2193('0x14')][_0x2193('0x108')](db[_0x2193('0x110')],{'as':_0x2193('0x111'),'foreignKey':_0x2193('0x107')});db[_0x2193('0x14')]['hasMany'](db['FaxInteraction'],{'as':_0x2193('0x112'),'foreignKey':_0x2193('0x107')});db[_0x2193('0x14')]['hasMany'](db[_0x2193('0x3f')],{'as':_0x2193('0x113'),'foreignKey':_0x2193('0x107')});db['User']['hasMany'](db[_0x2193('0xfb')],{'as':_0x2193('0x114'),'foreignKey':'UserId'});db[_0x2193('0x14')][_0x2193('0x108')](db[_0x2193('0xf3')],{'as':_0x2193('0x115'),'foreignKey':'SenderId'});db[_0x2193('0x14')][_0x2193('0x108')](db[_0x2193('0xf5')],{'as':'UserNotifications','foreignKey':'SenderId'});db['User'][_0x2193('0x116')](db[_0x2193('0xef')],{'as':_0x2193('0xef'),'foreignKey':'userProfileId'});db[_0x2193('0x14')][_0x2193('0x117')](db['ChatGroup'],{'as':_0x2193('0x118'),'through':_0x2193('0x119')});db[_0x2193('0x14')][_0x2193('0x117')](db['CmContact'],{'as':_0x2193('0x11a'),'through':_0x2193('0x11b')});db['User'][_0x2193('0x117')](db[_0x2193('0x11c')],{'as':_0x2193('0x11d'),'through':_0x2193('0x11e')});db['User'][_0x2193('0x117')](db[_0x2193('0xdf')],{'through':_0x2193('0x11f')});db[_0x2193('0x14')][_0x2193('0x117')](db['MailInteraction'],{'as':_0x2193('0x113'),'through':_0x2193('0x120')});db['User'][_0x2193('0x117')](db['ChatInteraction'],{'as':_0x2193('0x10f'),'through':_0x2193('0x121')});db['User'][_0x2193('0x117')](db[_0x2193('0x4a')],{'as':_0x2193('0x112'),'through':_0x2193('0x122')});db[_0x2193('0x14')][_0x2193('0x117')](db[_0x2193('0x110')],{'as':_0x2193('0x111'),'through':'user_has_sms_interactions'});db[_0x2193('0x14')]['belongsToMany'](db[_0x2193('0x5c')],{'as':_0x2193('0x10e'),'through':_0x2193('0x123')});db[_0x2193('0x14')]['belongsToMany'](db[_0x2193('0xfb')],{'as':_0x2193('0x114'),'through':'user_has_whatsapp_interactions'});db[_0x2193('0x14')][_0x2193('0x117')](db[_0x2193('0x1b')],{'as':_0x2193('0x124'),'through':_0x2193('0x2d'),'required':![]});db[_0x2193('0x14')]['belongsToMany'](db[_0x2193('0x3d')],{'as':_0x2193('0x125'),'through':'UserMailQueue','required':![]});db['User'][_0x2193('0x117')](db[_0x2193('0x68')],{'as':_0x2193('0x126'),'through':_0x2193('0x127'),'required':![],'hooks':!![]});db[_0x2193('0x14')][_0x2193('0x117')](db[_0x2193('0x4e')],{'as':_0x2193('0x128'),'through':_0x2193('0x32'),'required':![]});db['User']['belongsToMany'](db[_0x2193('0x129')],{'as':_0x2193('0x12a'),'through':_0x2193('0x34'),'required':![]});db['User']['belongsToMany'](db[_0x2193('0x5f')],{'as':_0x2193('0x12b'),'through':_0x2193('0x12c'),'required':![]});db['User'][_0x2193('0x117')](db[_0x2193('0x101')],{'as':_0x2193('0x12d'),'through':_0x2193('0x37'),'required':![]});db[_0x2193('0x14')][_0x2193('0x117')](db['CmList'],{'through':_0x2193('0x11e')});db[_0x2193('0x14')]['belongsToMany'](db[_0x2193('0x12e')],{'as':'VoicePrefixes','through':_0x2193('0x12f'),'required':![]});db[_0x2193('0x14')][_0x2193('0x117')](db['ChatWebsite'],{'as':'ChatWebsites','through':'user_has_chat_websites'});db[_0x2193('0x14')]['belongsToMany'](db[_0x2193('0x47')],{'as':_0x2193('0x130'),'through':'user_has_fax_accounts'});db['User'][_0x2193('0x117')](db[_0x2193('0x3b')],{'as':_0x2193('0x131'),'through':'user_has_mail_accounts'});db[_0x2193('0x14')]['belongsToMany'](db[_0x2193('0x58')],{'as':_0x2193('0x132'),'through':'user_has_openchannel_accounts'});db['User']['belongsToMany'](db[_0x2193('0x52')],{'as':'SmsAccounts','through':_0x2193('0x133')});db['User'][_0x2193('0x117')](db[_0x2193('0xf7')],{'as':_0x2193('0x134'),'through':'user_has_whatsapp_accounts'});db[_0x2193('0x14')]['belongsToMany'](db[_0x2193('0xdb')],{'as':_0x2193('0x135'),'through':'user_has_square_projects'});db[_0x2193('0x17')]['hasMany'](db[_0x2193('0x136')],{'as':'SpiedAgents','onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x137')});db['VoiceContext'][_0x2193('0x108')](db['VoiceExtension'],{'onDelete':_0x2193('0x10a')});db[_0x2193('0x136')]['hasMany'](db[_0x2193('0x136')],{'as':_0x2193('0x138'),'onDelete':_0x2193('0x10a')});db[_0x2193('0x139')][_0x2193('0x117')](db[_0x2193('0x89')],{'as':_0x2193('0x13a'),'through':_0x2193('0x13b')});db[_0x2193('0x1b')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x2193('0x13c'),'foreignKey':'VoiceQueueId'});db[_0x2193('0x1b')][_0x2193('0x108')](db[_0x2193('0x70')],{'as':_0x2193('0x13d'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x2193('0x108')](db[_0x2193('0x73')],{'as':_0x2193('0x10b'),'foreignKey':_0x2193('0x13e')});db[_0x2193('0x1b')][_0x2193('0x108')](db['CmHopperHistory'],{'as':_0x2193('0x13f'),'foreignKey':_0x2193('0x13e')});db[_0x2193('0x1b')][_0x2193('0x108')](db[_0x2193('0x10d')],{'as':_0x2193('0x10d'),'foreignKey':_0x2193('0x13e')});db[_0x2193('0x1b')][_0x2193('0x108')](db[_0x2193('0x71')],{'as':_0x2193('0x140'),'foreignKey':_0x2193('0x13e')});db['VoiceQueue'][_0x2193('0x108')](db[_0x2193('0xd0')],{'as':'JscriptySessions','foreignKey':_0x2193('0x13e')});db[_0x2193('0x1b')][_0x2193('0x116')](db['Trunk'],{'as':_0x2193('0x29'),'foreignKey':_0x2193('0x141')});db[_0x2193('0x1b')][_0x2193('0x116')](db[_0x2193('0x29')],{'as':_0x2193('0x142'),'foreignKey':'TrunkBackupId'});db[_0x2193('0x1b')][_0x2193('0x116')](db[_0x2193('0x81')],{'as':_0x2193('0x81'),'foreignKey':'IntervalId'});db['VoiceQueue'][_0x2193('0x116')](db[_0x2193('0x83')],{'as':_0x2193('0x143'),'foreignKey':_0x2193('0x144')});db[_0x2193('0x1b')][_0x2193('0x117')](db[_0x2193('0x11c')],{'as':_0x2193('0x11d'),'through':_0x2193('0x145')});db['VoiceQueue'][_0x2193('0x117')](db[_0x2193('0x14')],{'as':_0x2193('0x146'),'through':_0x2193('0x2d')});db['VoiceQueue'][_0x2193('0x117')](db[_0x2193('0xdf')],{'as':_0x2193('0x147'),'through':'team_has_voice_queues'});db[_0x2193('0x1b')][_0x2193('0x117')](db[_0x2193('0x11c')],{'as':_0x2193('0x148'),'through':_0x2193('0x149')});db[_0x2193('0x1c')][_0x2193('0x116')](db['User'],{'as':_0x2193('0x14'),'foreignKey':_0x2193('0x107')});db['ScreenRecording']['belongsTo'](db[_0x2193('0x14')],{'as':_0x2193('0x14'),'foreignKey':'UserId'});db['VoiceMail'][_0x2193('0x108')](db['VoiceMailMessage'],{'as':_0x2193('0x14a'),'onDelete':'cascade','foreignKey':_0x2193('0x14b'),'sourceKey':_0x2193('0x14c')});db[_0x2193('0x14d')]['belongsTo'](db['VoiceMail'],{'foreignKey':_0x2193('0x14b'),'targetKey':_0x2193('0x14c')});db[_0x2193('0x14e')][_0x2193('0x108')](db['VoiceQueueReport'],{'as':_0x2193('0x14f'),'foreignKey':_0x2193('0x150'),'constraints':![]});db[_0x2193('0x14e')][_0x2193('0x108')](db[_0x2193('0x151')],{'as':_0x2193('0x152'),'foreignKey':_0x2193('0x150'),'constraints':![]});db['VoiceCallReport'][_0x2193('0x116')](db[_0x2193('0x14')],{'as':'User','foreignKey':_0x2193('0x107')});db['VoiceCallReport'][_0x2193('0x116')](db['CmContact'],{'as':'Contact','foreignKey':_0x2193('0x153')});db[_0x2193('0x154')][_0x2193('0x116')](db[_0x2193('0x3b')],{'as':_0x2193('0x3b'),'foreignKey':_0x2193('0x155')});db[_0x2193('0x39')][_0x2193('0x116')](db[_0x2193('0x3b')],{'as':_0x2193('0x3b'),'foreignKey':_0x2193('0x155')});db[_0x2193('0x3b')][_0x2193('0x105')](db[_0x2193('0x154')],{'as':_0x2193('0x156'),'onDelete':'cascade'});db[_0x2193('0x3b')][_0x2193('0x105')](db[_0x2193('0x39')],{'as':'Smtp','onDelete':_0x2193('0x10a')});db[_0x2193('0x3b')][_0x2193('0x108')](db[_0x2193('0x157')],{'as':'Dispositions','foreignKey':_0x2193('0x155')});db['MailAccount'][_0x2193('0x108')](db['CannedAnswer'],{'as':_0x2193('0x158'),'foreignKey':_0x2193('0x155')});db[_0x2193('0x3b')][_0x2193('0x108')](db['MailMessage'],{'as':_0x2193('0x14a'),'foreignKey':_0x2193('0x155')});db['MailAccount'][_0x2193('0x108')](db[_0x2193('0x3f')],{'as':_0x2193('0x159')});db[_0x2193('0x3b')][_0x2193('0x108')](db['MailApplication'],{'as':_0x2193('0x138')});db['MailAccount'][_0x2193('0x116')](db[_0x2193('0x11c')],{'as':_0x2193('0x15a'),'foreignKey':_0x2193('0x15b')});db[_0x2193('0x3b')][_0x2193('0x116')](db['Template'],{'as':_0x2193('0x15c'),'foreignKey':_0x2193('0x15d')});db['MailAccount'][_0x2193('0x116')](db['Pause'],{'as':_0x2193('0x143'),'foreignKey':_0x2193('0x144')});db[_0x2193('0x3b')][_0x2193('0x117')](db[_0x2193('0x14')],{'as':_0x2193('0x146'),'through':_0x2193('0x15e')});db[_0x2193('0x3d')][_0x2193('0x117')](db[_0x2193('0x14')],{'as':_0x2193('0x146'),'through':_0x2193('0x30')});db[_0x2193('0x3d')][_0x2193('0x117')](db[_0x2193('0xdf')],{'through':_0x2193('0x15f'),'as':_0x2193('0x147')});db[_0x2193('0x3f')][_0x2193('0x108')](db[_0x2193('0x41')],{'as':_0x2193('0x14a'),'onDelete':_0x2193('0x10a'),'foreignKey':'MailInteractionId'});db[_0x2193('0x3f')][_0x2193('0x116')](db['MailAccount'],{'as':_0x2193('0x160'),'foreignKey':'MailAccountId'});db[_0x2193('0x3f')]['belongsTo'](db[_0x2193('0x6e')],{'as':_0x2193('0x161'),'foreignKey':_0x2193('0x153')});db['MailInteraction'][_0x2193('0x116')](db[_0x2193('0x14')],{'as':_0x2193('0x162'),'foreignKey':_0x2193('0x107')});db[_0x2193('0x3f')][_0x2193('0x117')](db[_0x2193('0x163')],{'through':_0x2193('0x164'),'as':_0x2193('0x165')});db['MailInteraction'][_0x2193('0x117')](db['Tag'],{'through':_0x2193('0x164'),'as':'ThroughTags'});db[_0x2193('0x3f')][_0x2193('0x117')](db[_0x2193('0x14')],{'as':_0x2193('0x166'),'through':'user_has_mail_interactions','foreignKey':_0x2193('0x167')});db[_0x2193('0x41')][_0x2193('0x108')](db['Attachment'],{'as':_0x2193('0x168'),'onDelete':_0x2193('0x10a')});db[_0x2193('0x41')][_0x2193('0x116')](db[_0x2193('0x14')],{'as':_0x2193('0x14')});db['MailMessage'][_0x2193('0x116')](db[_0x2193('0x6e')],{'onDelete':_0x2193('0x10a'),'as':_0x2193('0x161')});db[_0x2193('0x41')][_0x2193('0x116')](db['MailInteraction'],{'as':'Interaction','foreignKey':_0x2193('0x167')});db[_0x2193('0x41')][_0x2193('0x116')](db[_0x2193('0x3b')],{'as':'Account','foreignKey':_0x2193('0x155')});db[_0x2193('0x169')][_0x2193('0x116')](db['User'],{'onDelete':'restrict'});db[_0x2193('0x169')]['belongsTo'](db[_0x2193('0x3d')],{'onDelete':'restrict'});db[_0x2193('0x169')][_0x2193('0x116')](db[_0x2193('0x3b')],{'onDelete':_0x2193('0x16a')});db[_0x2193('0x169')][_0x2193('0x116')](db[_0x2193('0x81')],{'onDelete':_0x2193('0x16a'),'foreignKey':_0x2193('0x16b')});db[_0x2193('0x169')][_0x2193('0x116')](db[_0x2193('0x163')],{'onDelete':'restrict','foreignKey':_0x2193('0x16c')});db[_0x2193('0x43')][_0x2193('0x116')](db[_0x2193('0x3b')],{});db[_0x2193('0x43')][_0x2193('0x116')](db[_0x2193('0x11c')],{'as':_0x2193('0x15a'),'foreignKey':'ListId'});db[_0x2193('0x43')][_0x2193('0x116')](db[_0x2193('0x6e')],{'as':_0x2193('0x161'),'foreignKey':_0x2193('0x153')});db[_0x2193('0x43')][_0x2193('0x116')](db[_0x2193('0x3f')],{});db[_0x2193('0x43')][_0x2193('0x116')](db['MailMessage'],{});db['MailQueueReport']['belongsTo'](db[_0x2193('0x14')],{});db[_0x2193('0x43')][_0x2193('0x116')](db[_0x2193('0x3d')],{});db[_0x2193('0x16d')]['hasMany'](db[_0x2193('0x46')],{'as':_0x2193('0x16e'),'onDelete':_0x2193('0x10a')});db[_0x2193('0x47')][_0x2193('0x108')](db[_0x2193('0x157')],{'as':'Dispositions','foreignKey':'FaxAccountId'});db['FaxAccount'][_0x2193('0x108')](db[_0x2193('0x7c')],{'as':_0x2193('0x158'),'foreignKey':_0x2193('0x16f')});db[_0x2193('0x47')][_0x2193('0x108')](db[_0x2193('0x4a')],{'as':_0x2193('0x159')});db[_0x2193('0x47')]['hasMany'](db[_0x2193('0x48')],{'as':'Applications'});db['FaxAccount']['hasMany'](db['VoiceExtension'],{'as':_0x2193('0x170'),'onDelete':_0x2193('0x10a')});db[_0x2193('0x47')][_0x2193('0x108')](db[_0x2193('0x4c')],{'as':_0x2193('0x14a')});db[_0x2193('0x47')][_0x2193('0x116')](db['Trunk'],{'as':_0x2193('0x29')});db[_0x2193('0x47')][_0x2193('0x116')](db[_0x2193('0x11c')],{'as':'List','foreignKey':_0x2193('0x15b')});db[_0x2193('0x47')][_0x2193('0x116')](db[_0x2193('0x83')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x2193('0x47')][_0x2193('0x117')](db[_0x2193('0x14')],{'as':_0x2193('0x146'),'through':_0x2193('0x171')});db[_0x2193('0x48')][_0x2193('0x116')](db[_0x2193('0x14')],{'onDelete':_0x2193('0x16a')});db[_0x2193('0x48')][_0x2193('0x116')](db[_0x2193('0x4e')],{'onDelete':_0x2193('0x16a')});db['FaxApplication'][_0x2193('0x116')](db[_0x2193('0x47')],{'onDelete':'restrict'});db[_0x2193('0x48')]['belongsTo'](db[_0x2193('0x163')],{'onDelete':'restrict','foreignKey':_0x2193('0x16c')});db['FaxInteraction']['hasMany'](db[_0x2193('0x4c')],{'as':_0x2193('0x14a'),'onDelete':'cascade','foreignKey':_0x2193('0x172')});db[_0x2193('0x4a')][_0x2193('0x116')](db['FaxAccount'],{'as':'Account','foreignKey':_0x2193('0x16f')});db[_0x2193('0x4a')][_0x2193('0x116')](db[_0x2193('0x6e')],{'as':_0x2193('0x161'),'foreignKey':_0x2193('0x153')});db['FaxInteraction'][_0x2193('0x116')](db[_0x2193('0x14')],{'as':'Owner','foreignKey':_0x2193('0x107')});db['FaxInteraction'][_0x2193('0x117')](db['Tag'],{'through':_0x2193('0x173'),'as':'Tags'});db[_0x2193('0x4a')][_0x2193('0x117')](db['Tag'],{'through':_0x2193('0x173'),'as':_0x2193('0x174')});db[_0x2193('0x4a')][_0x2193('0x117')](db[_0x2193('0x14')],{'as':_0x2193('0x166'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db[_0x2193('0x4c')][_0x2193('0x116')](db[_0x2193('0x14')],{'onDelete':_0x2193('0x10a'),'as':_0x2193('0x14')});db['FaxMessage'][_0x2193('0x116')](db['FaxInteraction'],{'as':_0x2193('0x175'),'foreignKey':_0x2193('0x172')});db[_0x2193('0x4c')][_0x2193('0x116')](db[_0x2193('0x6e')],{'onDelete':_0x2193('0x10a'),'as':_0x2193('0x161')});db[_0x2193('0x4c')]['belongsTo'](db[_0x2193('0xe5')],{'as':'Attachment','foreignKey':_0x2193('0x176')});db['FaxMessage'][_0x2193('0x116')](db[_0x2193('0x47')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x2193('0x4e')][_0x2193('0x117')](db[_0x2193('0x14')],{'as':'Agents','through':'UserFaxQueue'});db[_0x2193('0x4e')][_0x2193('0x117')](db[_0x2193('0xdf')],{'through':_0x2193('0x177'),'as':_0x2193('0x147')});db['FaxQueueReport']['belongsTo'](db[_0x2193('0x47')],{});db['FaxQueueReport'][_0x2193('0x116')](db[_0x2193('0x11c')],{'as':_0x2193('0x15a'),'foreignKey':_0x2193('0x15b')});db[_0x2193('0x50')][_0x2193('0x116')](db[_0x2193('0x6e')],{'as':'Contact','foreignKey':_0x2193('0x153')});db[_0x2193('0x50')][_0x2193('0x116')](db[_0x2193('0x4a')],{});db[_0x2193('0x50')]['belongsTo'](db[_0x2193('0x4c')],{});db['FaxQueueReport'][_0x2193('0x116')](db[_0x2193('0x14')],{});db[_0x2193('0x50')][_0x2193('0x116')](db[_0x2193('0x4e')],{});db[_0x2193('0x52')][_0x2193('0x108')](db[_0x2193('0x157')],{'as':_0x2193('0x178'),'foreignKey':_0x2193('0x179')});db[_0x2193('0x52')][_0x2193('0x108')](db[_0x2193('0x7c')],{'as':_0x2193('0x158'),'foreignKey':_0x2193('0x179')});db[_0x2193('0x52')][_0x2193('0x108')](db['SmsMessage'],{'as':_0x2193('0x14a'),'foreignKey':_0x2193('0x179')});db[_0x2193('0x52')]['hasMany'](db[_0x2193('0x110')],{'as':_0x2193('0x159')});db[_0x2193('0x52')][_0x2193('0x108')](db[_0x2193('0x53')],{'as':_0x2193('0x138')});db[_0x2193('0x52')][_0x2193('0x116')](db[_0x2193('0x11c')],{'as':_0x2193('0x15a'),'foreignKey':_0x2193('0x15b')});db[_0x2193('0x52')][_0x2193('0x116')](db[_0x2193('0x83')],{'as':_0x2193('0x143'),'foreignKey':_0x2193('0x144')});db[_0x2193('0x52')][_0x2193('0x117')](db[_0x2193('0x14')],{'as':_0x2193('0x146'),'through':_0x2193('0x133')});db[_0x2193('0x53')][_0x2193('0x116')](db['User'],{'onDelete':'restrict'});db[_0x2193('0x53')][_0x2193('0x116')](db[_0x2193('0x129')],{'onDelete':'restrict'});db['SmsApplication'][_0x2193('0x116')](db[_0x2193('0x52')],{'onDelete':'restrict'});db[_0x2193('0x53')][_0x2193('0x116')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x2193('0x16b')});db[_0x2193('0x53')]['belongsTo'](db[_0x2193('0x163')],{'onDelete':_0x2193('0x16a'),'foreignKey':'TagId'});db['SmsInteraction'][_0x2193('0x108')](db[_0x2193('0x56')],{'as':_0x2193('0x14a'),'onDelete':'cascade','foreignKey':_0x2193('0x17a')});db[_0x2193('0x110')][_0x2193('0x116')](db[_0x2193('0x52')],{'as':_0x2193('0x160'),'foreignKey':_0x2193('0x179')});db['SmsInteraction'][_0x2193('0x116')](db[_0x2193('0x6e')],{'as':_0x2193('0x161'),'foreignKey':_0x2193('0x153')});db[_0x2193('0x110')][_0x2193('0x116')](db[_0x2193('0x14')],{'as':'Owner','foreignKey':_0x2193('0x107')});db[_0x2193('0x110')]['belongsToMany'](db['Tag'],{'through':_0x2193('0x17b'),'as':_0x2193('0x165')});db[_0x2193('0x110')][_0x2193('0x117')](db[_0x2193('0x163')],{'through':_0x2193('0x17b'),'as':_0x2193('0x174')});db[_0x2193('0x110')]['belongsToMany'](db[_0x2193('0x14')],{'as':_0x2193('0x166'),'through':_0x2193('0x17c'),'foreignKey':_0x2193('0x17a')});db[_0x2193('0x56')]['belongsTo'](db[_0x2193('0x14')],{'as':_0x2193('0x14')});db[_0x2193('0x56')][_0x2193('0x116')](db[_0x2193('0x6e')],{'onDelete':_0x2193('0x10a'),'as':'Contact'});db[_0x2193('0x56')][_0x2193('0x116')](db[_0x2193('0x110')],{'onDelete':_0x2193('0x10a'),'as':_0x2193('0x175'),'foreignKey':_0x2193('0x17a')});db['SmsMessage'][_0x2193('0x116')](db[_0x2193('0x52')],{'as':_0x2193('0x160'),'foreignKey':_0x2193('0x179')});db['SmsQueue'][_0x2193('0x117')](db[_0x2193('0x14')],{'as':_0x2193('0x146'),'through':'UserSmsQueue','foreignKey':_0x2193('0x17d')});db[_0x2193('0x129')][_0x2193('0x117')](db[_0x2193('0xdf')],{'through':_0x2193('0x17e'),'as':_0x2193('0x147')});db[_0x2193('0x58')]['hasMany'](db[_0x2193('0x157')],{'as':'Dispositions','foreignKey':_0x2193('0x17f')});db[_0x2193('0x58')]['hasMany'](db[_0x2193('0x7c')],{'as':_0x2193('0x158'),'foreignKey':_0x2193('0x17f')});db[_0x2193('0x58')][_0x2193('0x108')](db[_0x2193('0x5c')],{'as':_0x2193('0x159'),'foreignKey':_0x2193('0x17f')});db['OpenchannelAccount'][_0x2193('0x108')](db[_0x2193('0x5d')],{'as':_0x2193('0x14a'),'foreignKey':_0x2193('0x17f')});db[_0x2193('0x58')][_0x2193('0x108')](db[_0x2193('0x5a')],{'as':'Applications','foreignKey':_0x2193('0x17f')});db['OpenchannelAccount'][_0x2193('0x116')](db[_0x2193('0x11c')],{'as':_0x2193('0x15a'),'foreignKey':_0x2193('0x15b')});db[_0x2193('0x58')][_0x2193('0x116')](db['Pause'],{'as':_0x2193('0x143'),'foreignKey':_0x2193('0x144')});db['OpenchannelAccount'][_0x2193('0x117')](db[_0x2193('0x14')],{'as':'Agents','through':_0x2193('0x180')});db['OpenchannelApplication'][_0x2193('0x116')](db[_0x2193('0x14')],{'onDelete':_0x2193('0x16a')});db[_0x2193('0x5a')][_0x2193('0x116')](db[_0x2193('0x5f')],{'onDelete':_0x2193('0x16a'),'foreignKey':'OpenchannelQueueId'});db[_0x2193('0x5a')][_0x2193('0x116')](db[_0x2193('0x58')],{'onDelete':_0x2193('0x16a'),'foreignKey':_0x2193('0x17f')});db[_0x2193('0x5a')][_0x2193('0x116')](db[_0x2193('0x81')],{'onDelete':_0x2193('0x16a'),'foreignKey':'IntervalId'});db['OpenchannelApplication']['belongsTo'](db['Tag'],{'onDelete':_0x2193('0x16a'),'foreignKey':_0x2193('0x16c')});db[_0x2193('0x5c')][_0x2193('0x108')](db[_0x2193('0x5d')],{'as':_0x2193('0x14a'),'onDelete':'cascade','foreignKey':_0x2193('0x181')});db['OpenchannelInteraction']['belongsTo'](db[_0x2193('0x58')],{'as':'Account','foreignKey':_0x2193('0x17f')});db[_0x2193('0x5c')][_0x2193('0x116')](db[_0x2193('0x6e')],{'as':_0x2193('0x161'),'foreignKey':_0x2193('0x153')});db[_0x2193('0x5c')][_0x2193('0x116')](db[_0x2193('0x14')],{'as':_0x2193('0x162'),'foreignKey':_0x2193('0x107')});db[_0x2193('0x5c')][_0x2193('0x117')](db['Tag'],{'through':_0x2193('0x182'),'as':_0x2193('0x165')});db[_0x2193('0x5c')]['belongsToMany'](db['Tag'],{'through':_0x2193('0x182'),'as':_0x2193('0x174')});db[_0x2193('0x5c')][_0x2193('0x117')](db[_0x2193('0x14')],{'as':_0x2193('0x166'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0x2193('0x5d')][_0x2193('0x116')](db[_0x2193('0x14')],{'onDelete':'cascade','as':_0x2193('0x14')});db['OpenchannelMessage'][_0x2193('0x116')](db[_0x2193('0x6e')],{'onDelete':_0x2193('0x10a'),'as':'Contact'});db['OpenchannelMessage'][_0x2193('0x116')](db[_0x2193('0x5c')],{'onDelete':_0x2193('0x10a'),'as':_0x2193('0x175'),'foreignKey':_0x2193('0x181')});db[_0x2193('0x5d')]['belongsTo'](db[_0x2193('0xe5')],{'as':_0x2193('0xe5'),'foreignKey':_0x2193('0x176')});db[_0x2193('0x5d')][_0x2193('0x116')](db[_0x2193('0x58')],{'as':_0x2193('0x160'),'foreignKey':_0x2193('0x17f')});db[_0x2193('0x5f')][_0x2193('0x117')](db['User'],{'as':_0x2193('0x146'),'through':'UserOpenchannelQueue','foreignKey':_0x2193('0x183')});db[_0x2193('0x5f')][_0x2193('0x117')](db[_0x2193('0xdf')],{'through':_0x2193('0x184'),'as':'Teams'});db[_0x2193('0x61')][_0x2193('0x108')](db[_0x2193('0x157')],{'as':_0x2193('0x178'),'foreignKey':_0x2193('0x185')});db[_0x2193('0x61')]['hasMany'](db[_0x2193('0x7c')],{'as':_0x2193('0x158'),'foreignKey':_0x2193('0x185')});db['ChatWebsite']['hasMany'](db[_0x2193('0x6b')],{'as':_0x2193('0x186')});db[_0x2193('0x61')][_0x2193('0x108')](db['ChatInteraction'],{'as':_0x2193('0x159')});db[_0x2193('0x61')][_0x2193('0x108')](db[_0x2193('0x64')],{'as':_0x2193('0x138')});db[_0x2193('0x61')][_0x2193('0x108')](db[_0x2193('0x187')],{'as':_0x2193('0x14a')});db[_0x2193('0x61')][_0x2193('0x116')](db[_0x2193('0x11c')],{'as':_0x2193('0x15a'),'foreignKey':_0x2193('0x15b')});db[_0x2193('0x61')]['belongsTo'](db[_0x2193('0x81')],{'as':'Interval','foreignKey':'IntervalId'});db['ChatWebsite'][_0x2193('0x116')](db[_0x2193('0x83')],{'as':_0x2193('0x143'),'foreignKey':_0x2193('0x144')});db[_0x2193('0x61')][_0x2193('0x117')](db[_0x2193('0x14')],{'as':_0x2193('0x146'),'through':_0x2193('0x188')});db[_0x2193('0x63')]['belongsTo'](db[_0x2193('0x58')],{});db['OpenchannelQueueReport'][_0x2193('0x116')](db[_0x2193('0x11c')],{'as':'List','foreignKey':_0x2193('0x15b')});db[_0x2193('0x63')][_0x2193('0x116')](db['CmContact'],{'as':_0x2193('0x161'),'foreignKey':_0x2193('0x153')});db[_0x2193('0x63')][_0x2193('0x116')](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport'][_0x2193('0x116')](db['OpenchannelMessage'],{});db[_0x2193('0x63')][_0x2193('0x116')](db[_0x2193('0x14')],{});db[_0x2193('0x63')]['belongsTo'](db[_0x2193('0x5f')],{});db[_0x2193('0x64')][_0x2193('0x116')](db[_0x2193('0x14')],{'as':'Agent','foreignKey':_0x2193('0x107'),'onDelete':_0x2193('0x16a')});db[_0x2193('0x64')]['belongsTo'](db[_0x2193('0x68')],{'as':_0x2193('0x189'),'foreignKey':'ChatQueueId','onDelete':_0x2193('0x16a')});db[_0x2193('0x64')]['belongsTo'](db[_0x2193('0x61')],{'as':_0x2193('0x18a'),'foreignKey':_0x2193('0x185'),'onDelete':_0x2193('0x16a')});db[_0x2193('0x64')][_0x2193('0x116')](db[_0x2193('0x163')],{'onDelete':_0x2193('0x16a'),'foreignKey':'TagId'});db['ChatInteraction'][_0x2193('0x108')](db[_0x2193('0x187')],{'as':_0x2193('0x14a'),'onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x18b')});db[_0x2193('0x18c')][_0x2193('0x116')](db[_0x2193('0x61')],{'as':_0x2193('0x160'),'foreignKey':_0x2193('0x185')});db[_0x2193('0x18c')][_0x2193('0x116')](db[_0x2193('0x6e')],{'as':_0x2193('0x161'),'foreignKey':_0x2193('0x153')});db['ChatInteraction']['belongsTo'](db[_0x2193('0x14')],{'as':_0x2193('0x162'),'foreignKey':_0x2193('0x107')});db[_0x2193('0x18c')][_0x2193('0x117')](db['Tag'],{'through':_0x2193('0x18d'),'as':_0x2193('0x165')});db[_0x2193('0x18c')][_0x2193('0x117')](db['Tag'],{'through':_0x2193('0x18d'),'as':'ThroughTags'});db[_0x2193('0x18c')][_0x2193('0x117')](db[_0x2193('0x14')],{'as':_0x2193('0x166'),'through':_0x2193('0x121'),'foreignKey':'ChatInteractionId'});db[_0x2193('0x187')][_0x2193('0x116')](db['User'],{'onDelete':_0x2193('0x10a'),'as':_0x2193('0x14')});db[_0x2193('0x187')]['belongsTo'](db[_0x2193('0x6e')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x2193('0x153')});db[_0x2193('0x187')][_0x2193('0x116')](db[_0x2193('0x18c')],{'onDelete':'cascade','as':_0x2193('0x175'),'foreignKey':_0x2193('0x18b')});db[_0x2193('0x187')][_0x2193('0x116')](db[_0x2193('0xe5')],{'as':_0x2193('0xe5'),'foreignKey':'AttachmentId'});db['ChatMessage'][_0x2193('0x116')](db[_0x2193('0x61')],{'as':_0x2193('0x160'),'foreignKey':'ChatWebsiteId'});db[_0x2193('0x18e')][_0x2193('0x116')](db[_0x2193('0x6e')],{'onDelete':_0x2193('0x10a'),'as':'Contact','foreignKey':_0x2193('0x153')});db['ChatOfflineMessage']['belongsTo'](db[_0x2193('0x61')],{'as':_0x2193('0x160'),'foreignKey':_0x2193('0x185')});db[_0x2193('0x68')]['belongsToMany'](db[_0x2193('0x14')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0x2193('0x68')][_0x2193('0x117')](db[_0x2193('0xdf')],{'through':_0x2193('0x18f'),'as':_0x2193('0x147')});db[_0x2193('0x6a')][_0x2193('0x108')](db[_0x2193('0x190')],{'as':_0x2193('0x14a'),'foreignKey':_0x2193('0x191'),'onDelete':_0x2193('0x10a')});db[_0x2193('0x6a')]['belongsToMany'](db[_0x2193('0x14')],{'as':'Members','through':_0x2193('0x119')});db[_0x2193('0x6b')][_0x2193('0x116')](db[_0x2193('0x61')],{'as':_0x2193('0x18a'),'foreignKey':_0x2193('0x185')});db[_0x2193('0x6d')][_0x2193('0x108')](db[_0x2193('0x6e')],{'as':_0x2193('0x11a'),'foreignKey':_0x2193('0x192')});db[_0x2193('0x6e')][_0x2193('0x108')](db[_0x2193('0x70')],{'as':_0x2193('0x13d'),'foreignKey':'ContactId'});db['CmContact'][_0x2193('0x108')](db['CmHopperFinal'],{'as':_0x2193('0x10b'),'foreignKey':_0x2193('0x153')});db[_0x2193('0x6e')][_0x2193('0x108')](db[_0x2193('0x75')],{'as':_0x2193('0x13f'),'foreignKey':_0x2193('0x153')});db[_0x2193('0x6e')][_0x2193('0x108')](db['ReportAgentPreview'],{'as':_0x2193('0x10d'),'foreignKey':_0x2193('0x153')});db[_0x2193('0x6e')][_0x2193('0x108')](db[_0x2193('0xd0')],{'as':_0x2193('0x193'),'foreignKey':_0x2193('0x153')});db['CmContact'][_0x2193('0x108')](db['OpenchannelInteraction'],{'as':_0x2193('0x10e'),'foreignKey':_0x2193('0x153'),'onDelete':_0x2193('0x16a')});db[_0x2193('0x6e')][_0x2193('0x108')](db[_0x2193('0x18c')],{'as':_0x2193('0x10f'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x2193('0x6e')]['hasMany'](db[_0x2193('0x110')],{'as':'SmsInteractions','foreignKey':_0x2193('0x153'),'onDelete':_0x2193('0x16a')});db[_0x2193('0x6e')][_0x2193('0x108')](db[_0x2193('0x4a')],{'as':_0x2193('0x112'),'foreignKey':_0x2193('0x153'),'onDelete':_0x2193('0x16a')});db[_0x2193('0x6e')]['hasMany'](db['MailInteraction'],{'as':_0x2193('0x113'),'foreignKey':_0x2193('0x153'),'onDelete':'restrict'});db[_0x2193('0x6e')][_0x2193('0x116')](db[_0x2193('0x6d')],{'as':_0x2193('0x194'),'foreignKey':'CompanyId'});db[_0x2193('0x6e')]['belongsTo'](db[_0x2193('0x11c')],{'as':_0x2193('0x15a'),'foreignKey':_0x2193('0x15b'),'onDelete':_0x2193('0x10a')});db[_0x2193('0x6e')][_0x2193('0x117')](db[_0x2193('0x14')],{'as':_0x2193('0x166'),'through':_0x2193('0x11b')});db[_0x2193('0x6e')][_0x2193('0x117')](db[_0x2193('0x163')],{'as':_0x2193('0x165'),'through':_0x2193('0x195')});db['CmContact'][_0x2193('0x117')](db['Tag'],{'through':_0x2193('0x195'),'as':_0x2193('0x174')});db['CmHopper'][_0x2193('0x116')](db[_0x2193('0x6e')],{'as':_0x2193('0x161'),'foreignKey':_0x2193('0x153'),'onDelete':_0x2193('0x10a')});db[_0x2193('0x70')][_0x2193('0x116')](db[_0x2193('0x11c')],{'as':_0x2193('0x15a'),'foreignKey':'ListId','onDelete':_0x2193('0x10a')});db[_0x2193('0x70')][_0x2193('0x116')](db[_0x2193('0x14')],{'as':_0x2193('0x196'),'foreignKey':_0x2193('0x107')});db[_0x2193('0x70')][_0x2193('0x116')](db[_0x2193('0x1b')],{'as':_0x2193('0x189'),'foreignKey':'VoiceQueueId','onDelete':_0x2193('0x10a')});db[_0x2193('0x70')][_0x2193('0x116')](db[_0x2193('0xe3')],{'as':'Campaign','foreignKey':_0x2193('0x197'),'onDelete':_0x2193('0x10a')});db[_0x2193('0x70')]['belongsTo'](db['User'],{'as':_0x2193('0x162'),'foreignKey':_0x2193('0x198')});db['CmHopperBlack'][_0x2193('0x116')](db[_0x2193('0x6e')],{'as':_0x2193('0x161'),'foreignKey':'ContactId','onDelete':_0x2193('0x10a')});db[_0x2193('0x71')][_0x2193('0x116')](db[_0x2193('0x11c')],{'as':_0x2193('0x15a'),'foreignKey':_0x2193('0x15b'),'onDelete':_0x2193('0x10a')});db[_0x2193('0x71')][_0x2193('0x116')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x2193('0x13e'),'onDelete':'cascade'});db[_0x2193('0x71')]['belongsTo'](db[_0x2193('0xe3')],{'as':'Campaign','foreignKey':_0x2193('0x197'),'onDelete':_0x2193('0x10a')});db[_0x2193('0x7b')]['hasMany'](db['Condition'],{'as':{'plural':'All','singular':_0x2193('0x199')},'foreignKey':_0x2193('0x19a'),'onDelete':'cascade','hooks':!![]});db[_0x2193('0x7b')]['hasMany'](db[_0x2193('0x7f')],{'as':{'plural':_0x2193('0x19b'),'singular':_0x2193('0x19c')},'foreignKey':'AutomationAnyId','onDelete':_0x2193('0x10a'),'hooks':!![]});db['Automation'][_0x2193('0x108')](db[_0x2193('0x79')],{'as':_0x2193('0x19d'),'foreignKey':'AutomationId','onDelete':_0x2193('0x10a'),'hooks':!![]});db[_0x2193('0x157')][_0x2193('0x108')](db[_0x2193('0x157')],{'as':_0x2193('0x178'),'foreignKey':_0x2193('0x19e'),'onDelete':'cascade'});db['Interval'][_0x2193('0x108')](db['Interval'],{'as':_0x2193('0x19f'),'foreignKey':_0x2193('0x16b'),'onDelete':_0x2193('0x10a'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db['VoiceExtension'],{'as':_0x2193('0x1a0'),'foreignKey':_0x2193('0x16b'),'onDelete':_0x2193('0x16a')});db[_0x2193('0x81')][_0x2193('0x108')](db[_0x2193('0x169')],{'as':_0x2193('0x1a1'),'foreignKey':_0x2193('0x16b')});db[_0x2193('0x81')][_0x2193('0x108')](db[_0x2193('0x64')],{'as':_0x2193('0x1a2'),'foreignKey':_0x2193('0x16b')});db[_0x2193('0x81')][_0x2193('0x108')](db[_0x2193('0x48')],{'as':_0x2193('0x1a3'),'foreignKey':_0x2193('0x16b')});db[_0x2193('0x81')][_0x2193('0x108')](db[_0x2193('0x53')],{'as':'SmsApplications','foreignKey':_0x2193('0x16b')});db['Schedule'][_0x2193('0x116')](db['MailAccount'],{});db['Schedule'][_0x2193('0x116')](db['AnalyticDefaultReport'],{'foreignKey':_0x2193('0x1a4')});db[_0x2193('0x87')][_0x2193('0x116')](db[_0x2193('0x8f')],{'foreignKey':_0x2193('0x1a5')});db['Sound'][_0x2193('0x117')](db['VoiceMusicOnHold'],{'as':_0x2193('0x1a6'),'through':_0x2193('0x13b'),'onDelete':'restrict'});db['Tag'][_0x2193('0x117')](db[_0x2193('0x6e')],{'through':_0x2193('0x195')});db[_0x2193('0x163')][_0x2193('0x117')](db['ChatInteraction'],{'through':_0x2193('0x18d')});db[_0x2193('0x163')][_0x2193('0x117')](db['MailInteraction'],{'through':_0x2193('0x164')});db[_0x2193('0x163')][_0x2193('0x117')](db[_0x2193('0x110')],{'through':_0x2193('0x17b')});db[_0x2193('0x163')]['belongsToMany'](db[_0x2193('0x4a')],{'through':_0x2193('0x173')});db[_0x2193('0x163')]['belongsToMany'](db[_0x2193('0x5c')],{'through':'openchannel_interaction_has_tags'});db[_0x2193('0x163')][_0x2193('0x117')](db[_0x2193('0xfb')],{'through':_0x2193('0x1a7')});db[_0x2193('0x8c')]['hasMany'](db[_0x2193('0x7f')],{'as':{'plural':'AllConditions','singular':_0x2193('0x1a8')},'foreignKey':_0x2193('0x1a9'),'onDelete':_0x2193('0x10a'),'hooks':!![]});db[_0x2193('0x8c')]['hasMany'](db[_0x2193('0x7f')],{'as':{'plural':_0x2193('0x1aa'),'singular':_0x2193('0x1ab')},'foreignKey':_0x2193('0x1ac'),'onDelete':'cascade','hooks':!![]});db[_0x2193('0x8c')][_0x2193('0x108')](db[_0x2193('0x79')],{'as':_0x2193('0x19d'),'foreignKey':_0x2193('0x1ad'),'onDelete':_0x2193('0x10a'),'hooks':!![]});db[_0x2193('0x8f')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x2193('0x1ae'),'onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x1a5'),'hooks':!![]});db[_0x2193('0x90')][_0x2193('0x108')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':'cascade','foreignKey':'DefaultReportId'});db['AnalyticMetric'][_0x2193('0x108')](db[_0x2193('0x94')],{'as':_0x2193('0x1ae'),'onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x1af')});db[_0x2193('0x94')][_0x2193('0x116')](db[_0x2193('0x1b0')],{'foreignKey':_0x2193('0x1af')});db[_0x2193('0x98')][_0x2193('0x108')](db[_0x2193('0x1b1')],{'as':_0x2193('0x1b2'),'onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x1b3')});db[_0x2193('0x1b1')]['hasMany'](db[_0x2193('0x9b')],{'as':_0x2193('0x1b4'),'onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x1b5')});db['SalesforceConfiguration'][_0x2193('0x108')](db[_0x2193('0x9b')],{'as':_0x2193('0x1b6'),'onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x1b7')});db['SalesforceConfiguration'][_0x2193('0x108')](db['SalesforceField'],{'as':_0x2193('0x1ae'),'onDelete':'cascade','foreignKey':_0x2193('0x1b8')});db[_0x2193('0x1b1')][_0x2193('0x116')](db[_0x2193('0x98')],{'as':_0x2193('0x160'),'foreignKey':_0x2193('0x1b3')});db[_0x2193('0x9b')][_0x2193('0x108')](db[_0x2193('0x9b')],{'as':_0x2193('0x1b9'),'foreignKey':_0x2193('0x1b5')});db[_0x2193('0x9b')][_0x2193('0x108')](db[_0x2193('0x9b')],{'as':'Description','foreignKey':_0x2193('0x1b7')});db[_0x2193('0x9b')]['hasMany'](db[_0x2193('0x9b')],{'as':_0x2193('0x1ba'),'foreignKey':_0x2193('0x1b8')});db[_0x2193('0x9b')][_0x2193('0x116')](db[_0x2193('0x8d')],{'as':'Variable','foreignKey':_0x2193('0x1bb')});db[_0x2193('0x9d')][_0x2193('0x108')](db['SugarcrmConfiguration'],{'as':_0x2193('0x1b2'),'onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x1b3')});db[_0x2193('0x9f')]['hasMany'](db[_0x2193('0xa1')],{'as':_0x2193('0x1b4'),'onDelete':'cascade','foreignKey':'SubjectId'});db['SugarcrmConfiguration'][_0x2193('0x108')](db[_0x2193('0xa1')],{'as':_0x2193('0x1b6'),'onDelete':'cascade','foreignKey':_0x2193('0x1b7')});db[_0x2193('0x9f')]['hasMany'](db[_0x2193('0xa1')],{'as':'Fields','onDelete':_0x2193('0x10a'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0x2193('0x116')](db['SugarcrmAccount'],{'as':_0x2193('0x160'),'foreignKey':_0x2193('0x1b3')});db[_0x2193('0xa1')][_0x2193('0x108')](db[_0x2193('0xa1')],{'as':_0x2193('0x1b9'),'foreignKey':_0x2193('0x1b5')});db[_0x2193('0xa1')][_0x2193('0x108')](db[_0x2193('0xa1')],{'as':'Description','foreignKey':_0x2193('0x1b7')});db[_0x2193('0xa1')][_0x2193('0x108')](db['SugarcrmField'],{'as':_0x2193('0x1ba'),'foreignKey':_0x2193('0x1b8')});db['SugarcrmField'][_0x2193('0x116')](db[_0x2193('0x8d')],{'as':_0x2193('0x8d'),'foreignKey':_0x2193('0x1bb')});db[_0x2193('0xa3')][_0x2193('0x108')](db[_0x2193('0xa5')],{'as':'Configurations','onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x1b3')});db['DeskConfiguration'][_0x2193('0x108')](db[_0x2193('0xa7')],{'as':_0x2193('0x1b4'),'onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x1b5')});db[_0x2193('0xa5')][_0x2193('0x108')](db[_0x2193('0xa7')],{'as':_0x2193('0x1b6'),'onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x1b7')});db['DeskConfiguration'][_0x2193('0x108')](db[_0x2193('0xa7')],{'as':_0x2193('0x1ae'),'onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x1b8')});db[_0x2193('0xa5')][_0x2193('0x116')](db[_0x2193('0xa3')],{'as':_0x2193('0x160'),'foreignKey':_0x2193('0x1b3')});db[_0x2193('0xa5')]['belongsToMany'](db[_0x2193('0x163')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x2193('0x108')](db[_0x2193('0xa7')],{'as':_0x2193('0x1b9'),'foreignKey':_0x2193('0x1b5')});db[_0x2193('0xa7')][_0x2193('0x108')](db[_0x2193('0xa7')],{'as':_0x2193('0x1bc'),'foreignKey':_0x2193('0x1b7')});db[_0x2193('0xa7')][_0x2193('0x108')](db[_0x2193('0xa7')],{'as':_0x2193('0x1ba'),'foreignKey':_0x2193('0x1b8')});db['DeskField'][_0x2193('0x116')](db['Variable'],{'as':_0x2193('0x8d'),'foreignKey':_0x2193('0x1bb')});db['ZohoAccount']['hasMany'](db['ZohoConfiguration'],{'as':_0x2193('0x1b2'),'onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x1b3')});db['ZohoConfiguration'][_0x2193('0x108')](db[_0x2193('0xac')],{'as':_0x2193('0x1b4'),'onDelete':_0x2193('0x10a'),'foreignKey':'SubjectId'});db[_0x2193('0xaa')][_0x2193('0x108')](db[_0x2193('0xac')],{'as':'Descriptions','onDelete':_0x2193('0x10a'),'foreignKey':'DescriptionId'});db[_0x2193('0xaa')][_0x2193('0x108')](db['ZohoField'],{'as':'Fields','onDelete':_0x2193('0x10a'),'foreignKey':'FieldId'});db['ZohoConfiguration'][_0x2193('0x116')](db[_0x2193('0xa8')],{'as':'Account','foreignKey':'AccountId'});db[_0x2193('0xac')][_0x2193('0x108')](db[_0x2193('0xac')],{'as':_0x2193('0x1b9'),'foreignKey':'SubjectId'});db[_0x2193('0xac')]['hasMany'](db[_0x2193('0xac')],{'as':_0x2193('0x1bc'),'foreignKey':_0x2193('0x1b7')});db[_0x2193('0xac')]['hasMany'](db[_0x2193('0xac')],{'as':_0x2193('0x1ba'),'foreignKey':_0x2193('0x1b8')});db[_0x2193('0xac')][_0x2193('0x116')](db[_0x2193('0x8d')],{'as':_0x2193('0x8d'),'foreignKey':_0x2193('0x1bb')});db[_0x2193('0xae')]['hasMany'](db[_0x2193('0xb0')],{'as':'Configurations','onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x1b3')});db[_0x2193('0xb0')][_0x2193('0x108')](db[_0x2193('0x1bd')],{'as':_0x2193('0x1b4'),'foreignKey':'SubjectId'});db[_0x2193('0xb0')][_0x2193('0x108')](db[_0x2193('0x1bd')],{'as':_0x2193('0x1b6'),'foreignKey':_0x2193('0x1b7')});db[_0x2193('0xb0')][_0x2193('0x108')](db[_0x2193('0x1bd')],{'as':_0x2193('0x1ae'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0x2193('0x116')](db[_0x2193('0xae')],{'as':_0x2193('0x160'),'foreignKey':_0x2193('0x1b3')});db[_0x2193('0xb0')]['belongsToMany'](db[_0x2193('0x163')],{'through':_0x2193('0x1be')});db['ZendeskField'][_0x2193('0x108')](db[_0x2193('0x1bd')],{'as':'Subject','foreignKey':_0x2193('0x1b5')});db[_0x2193('0x1bd')]['hasMany'](db[_0x2193('0x1bd')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x2193('0x1bd')]['hasMany'](db['ZendeskField'],{'as':_0x2193('0x1ba'),'foreignKey':_0x2193('0x1b8')});db[_0x2193('0x1bd')][_0x2193('0x116')](db[_0x2193('0x8d')],{'as':_0x2193('0x8d'),'foreignKey':'VariableId'});db['FreshdeskAccount']['hasMany'](db[_0x2193('0xb4')],{'as':_0x2193('0x1b2'),'onDelete':_0x2193('0x10a'),'foreignKey':'AccountId'});db[_0x2193('0xb4')][_0x2193('0x108')](db['FreshdeskField'],{'as':_0x2193('0x1b4'),'onDelete':'cascade','foreignKey':_0x2193('0x1b5')});db['FreshdeskConfiguration'][_0x2193('0x108')](db[_0x2193('0xb6')],{'as':_0x2193('0x1b6'),'onDelete':_0x2193('0x10a'),'foreignKey':'DescriptionId'});db[_0x2193('0xb4')][_0x2193('0x108')](db[_0x2193('0xb6')],{'as':_0x2193('0x1ae'),'onDelete':'cascade','foreignKey':_0x2193('0x1b8')});db[_0x2193('0xb4')][_0x2193('0x116')](db[_0x2193('0xb2')],{'as':'Account','foreignKey':_0x2193('0x1b3')});db[_0x2193('0xb4')][_0x2193('0x117')](db['Tag'],{'through':_0x2193('0x1bf')});db[_0x2193('0xb6')][_0x2193('0x108')](db[_0x2193('0xb6')],{'as':_0x2193('0x1b9'),'foreignKey':_0x2193('0x1b5')});db[_0x2193('0xb6')][_0x2193('0x108')](db['FreshdeskField'],{'as':_0x2193('0x1bc'),'foreignKey':_0x2193('0x1b7')});db[_0x2193('0xb6')][_0x2193('0x108')](db[_0x2193('0xb6')],{'as':_0x2193('0x1ba'),'foreignKey':_0x2193('0x1b8')});db[_0x2193('0xb6')][_0x2193('0x116')](db['Variable'],{'as':_0x2193('0x8d'),'foreignKey':'VariableId'});db[_0x2193('0x1c0')]['hasMany'](db[_0x2193('0x1c1')],{'as':_0x2193('0x1b2'),'onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x1b3')});db['VtigerConfiguration'][_0x2193('0x108')](db[_0x2193('0xb9')],{'as':_0x2193('0x1b4'),'foreignKey':_0x2193('0x1b5')});db[_0x2193('0x1c1')][_0x2193('0x108')](db[_0x2193('0xb9')],{'as':_0x2193('0x1b6'),'foreignKey':_0x2193('0x1b7')});db[_0x2193('0x1c1')][_0x2193('0x108')](db[_0x2193('0xb9')],{'as':_0x2193('0x1ae'),'foreignKey':'FieldId'});db[_0x2193('0x1c1')][_0x2193('0x116')](db['VtigerAccount'],{'as':'Account','foreignKey':_0x2193('0x1b3')});db[_0x2193('0xb9')]['hasMany'](db[_0x2193('0xb9')],{'as':_0x2193('0x1b9'),'foreignKey':_0x2193('0x1b5')});db[_0x2193('0xb9')][_0x2193('0x108')](db['VtigerField'],{'as':_0x2193('0x1bc'),'foreignKey':_0x2193('0x1b7')});db['VtigerField'][_0x2193('0x108')](db['VtigerField'],{'as':_0x2193('0x1ba'),'foreignKey':_0x2193('0x1b8')});db[_0x2193('0xb9')][_0x2193('0x116')](db[_0x2193('0x8d')],{'as':_0x2193('0x8d'),'foreignKey':_0x2193('0x1bb')});db[_0x2193('0xba')][_0x2193('0x108')](db[_0x2193('0xbc')],{'as':'Configurations','onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x1b3')});db[_0x2193('0xbc')][_0x2193('0x108')](db[_0x2193('0xbe')],{'as':_0x2193('0x1b4'),'foreignKey':_0x2193('0x1b5')});db[_0x2193('0xbc')]['hasMany'](db[_0x2193('0xbe')],{'as':_0x2193('0x1b6'),'foreignKey':_0x2193('0x1b7')});db[_0x2193('0xbc')][_0x2193('0x108')](db[_0x2193('0xbe')],{'as':_0x2193('0x1ae'),'foreignKey':_0x2193('0x1b8')});db['ServicenowConfiguration'][_0x2193('0x116')](db[_0x2193('0xba')],{'as':_0x2193('0x160'),'foreignKey':_0x2193('0x1b3')});db['ServicenowField'][_0x2193('0x108')](db[_0x2193('0xbe')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x2193('0xbe')][_0x2193('0x108')](db[_0x2193('0xbe')],{'as':_0x2193('0x1bc'),'foreignKey':_0x2193('0x1b7')});db[_0x2193('0xbe')][_0x2193('0x108')](db[_0x2193('0xbe')],{'as':_0x2193('0x1ba'),'foreignKey':'FieldId'});db[_0x2193('0xbe')][_0x2193('0x116')](db[_0x2193('0x8d')],{'as':_0x2193('0x8d'),'foreignKey':'VariableId'});db[_0x2193('0x1c2')][_0x2193('0x108')](db[_0x2193('0xc0')],{'as':_0x2193('0x1b2'),'onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x1b3')});db[_0x2193('0xc0')][_0x2193('0x108')](db[_0x2193('0xc1')],{'as':_0x2193('0x1b4'),'onDelete':'cascade','foreignKey':_0x2193('0x1b5')});db[_0x2193('0xc0')][_0x2193('0x108')](db[_0x2193('0xc1')],{'as':_0x2193('0x1b6'),'onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x1b7')});db['Dynamics365Configuration'][_0x2193('0x108')](db[_0x2193('0xc1')],{'as':_0x2193('0x1ae'),'onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x1b8')});db[_0x2193('0xc0')]['belongsTo'](db[_0x2193('0x1c2')],{'as':'Account','foreignKey':_0x2193('0x1b3')});db[_0x2193('0xc1')]['hasMany'](db[_0x2193('0xc1')],{'as':_0x2193('0x1b9'),'foreignKey':_0x2193('0x1b5')});db[_0x2193('0xc1')][_0x2193('0x108')](db['Dynamics365Field'],{'as':_0x2193('0x1bc'),'foreignKey':_0x2193('0x1b7')});db['Dynamics365Field'][_0x2193('0x108')](db['Dynamics365Field'],{'as':_0x2193('0x1ba'),'foreignKey':'FieldId'});db[_0x2193('0xc1')]['belongsTo'](db['Variable'],{'as':_0x2193('0x8d'),'foreignKey':'VariableId'});db[_0x2193('0xc3')]['hasMany'](db[_0x2193('0xc5')],{'as':_0x2193('0x1b2'),'onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x1b3')});db[_0x2193('0xc5')][_0x2193('0x108')](db[_0x2193('0x1c3')],{'as':'Subjects','foreignKey':_0x2193('0x1b5')});db['FreshsalesConfiguration'][_0x2193('0x108')](db['FreshsalesField'],{'as':_0x2193('0x1b6'),'foreignKey':_0x2193('0x1b7')});db[_0x2193('0xc5')]['hasMany'](db['FreshsalesField'],{'as':_0x2193('0x1ae'),'foreignKey':_0x2193('0x1b8')});db[_0x2193('0xc5')][_0x2193('0x116')](db[_0x2193('0xc3')],{'as':_0x2193('0x160'),'foreignKey':_0x2193('0x1b3')});db['FreshsalesField'][_0x2193('0x108')](db[_0x2193('0x1c3')],{'as':_0x2193('0x1b9'),'foreignKey':_0x2193('0x1b5')});db[_0x2193('0x1c3')][_0x2193('0x108')](db['FreshsalesField'],{'as':_0x2193('0x1bc'),'foreignKey':_0x2193('0x1b7')});db[_0x2193('0x1c3')][_0x2193('0x108')](db[_0x2193('0x1c3')],{'as':_0x2193('0x1ba'),'foreignKey':_0x2193('0x1b8')});db['FreshsalesField'][_0x2193('0x116')](db[_0x2193('0x8d')],{'as':_0x2193('0x8d'),'foreignKey':'VariableId'});db[_0x2193('0xca')][_0x2193('0x116')](db[_0x2193('0x61')],{});db[_0x2193('0xca')][_0x2193('0x116')](db[_0x2193('0x11c')],{'as':_0x2193('0x15a'),'foreignKey':_0x2193('0x15b')});db[_0x2193('0xca')][_0x2193('0x116')](db['CmContact'],{'as':_0x2193('0x161'),'foreignKey':'ContactId'});db[_0x2193('0xca')][_0x2193('0x116')](db[_0x2193('0x18c')],{});db[_0x2193('0xca')][_0x2193('0x116')](db[_0x2193('0x187')],{});db[_0x2193('0xca')][_0x2193('0x116')](db['User'],{});db[_0x2193('0xca')][_0x2193('0x116')](db['ChatQueue'],{});db[_0x2193('0x190')][_0x2193('0x116')](db['User'],{'onDelete':'cascade','foreignKey':_0x2193('0x1c4')});db[_0x2193('0x190')][_0x2193('0x116')](db[_0x2193('0x14')],{'onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x1c5')});db[_0x2193('0xd0')][_0x2193('0x108')](db[_0x2193('0xce')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x2193('0xd0')][_0x2193('0x108')](db['JscriptyAnswerReport'],{'foreignKey':_0x2193('0x1c6'),'onDelete':_0x2193('0x10a')});db[_0x2193('0xd2')][_0x2193('0x116')](db[_0x2193('0x52')],{});db[_0x2193('0xd2')][_0x2193('0x116')](db[_0x2193('0x11c')],{'as':_0x2193('0x15a'),'foreignKey':_0x2193('0x15b')});db[_0x2193('0xd2')][_0x2193('0x116')](db[_0x2193('0x6e')],{'as':_0x2193('0x161'),'foreignKey':_0x2193('0x153')});db[_0x2193('0xd2')][_0x2193('0x116')](db['SmsInteraction'],{});db[_0x2193('0xd2')][_0x2193('0x116')](db[_0x2193('0x56')],{});db[_0x2193('0xd2')][_0x2193('0x116')](db[_0x2193('0x14')],{});db['SmsQueueReport'][_0x2193('0x116')](db['SmsQueue'],{});db[_0x2193('0xd7')][_0x2193('0x108')](db[_0x2193('0xd0')],{'foreignKey':'ProjectId'});db[_0x2193('0xd7')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x2193('0x1c7')});db['JscriptyProject'][_0x2193('0x108')](db[_0x2193('0x1c8')],{'foreignKey':_0x2193('0x1c7')});db[_0x2193('0xdb')][_0x2193('0x117')](db['User'],{'as':_0x2193('0x166'),'through':_0x2193('0x1c9')});db[_0x2193('0xdf')][_0x2193('0x117')](db[_0x2193('0x14')],{'as':_0x2193('0x146'),'through':'user_has_teams'});db['Team'][_0x2193('0x117')](db['VoiceQueue'],{'through':_0x2193('0x1ca'),'as':_0x2193('0x124')});db['Team'][_0x2193('0x117')](db[_0x2193('0x3d')],{'through':_0x2193('0x15f'),'as':_0x2193('0x125')});db[_0x2193('0xdf')]['belongsToMany'](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0x2193('0x126')});db[_0x2193('0xdf')][_0x2193('0x117')](db[_0x2193('0x4e')],{'through':'team_has_fax_queues','as':_0x2193('0x128')});db[_0x2193('0xdf')][_0x2193('0x117')](db[_0x2193('0x129')],{'through':_0x2193('0x17e'),'as':_0x2193('0x12a')});db[_0x2193('0xdf')][_0x2193('0x117')](db['OpenchannelQueue'],{'through':_0x2193('0x184'),'as':_0x2193('0x12b')});db['Team']['belongsToMany'](db['WhatsappQueue'],{'through':_0x2193('0x1cb'),'as':_0x2193('0x12d')});db[_0x2193('0xe3')][_0x2193('0x108')](db[_0x2193('0x70')],{'as':_0x2193('0x13d'),'foreignKey':'CampaignId'});db[_0x2193('0xe3')][_0x2193('0x108')](db['CmHopperFinal'],{'as':_0x2193('0x10b'),'foreignKey':_0x2193('0x197')});db[_0x2193('0xe3')][_0x2193('0x108')](db[_0x2193('0x75')],{'as':_0x2193('0x13f'),'foreignKey':_0x2193('0x197')});db[_0x2193('0xe3')][_0x2193('0x108')](db[_0x2193('0x71')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x2193('0xe3')]['belongsTo'](db[_0x2193('0x29')],{'as':_0x2193('0x29'),'foreignKey':_0x2193('0x141')});db[_0x2193('0xe3')][_0x2193('0x116')](db[_0x2193('0x29')],{'as':_0x2193('0x142'),'foreignKey':_0x2193('0x1cc')});db[_0x2193('0xe3')][_0x2193('0x116')](db[_0x2193('0x81')],{'as':_0x2193('0x81'),'foreignKey':_0x2193('0x16b')});db[_0x2193('0xe3')][_0x2193('0x116')](db['SquareProject'],{'as':_0x2193('0xdb'),'foreignKey':_0x2193('0x1cd')});db[_0x2193('0xe3')]['belongsToMany'](db[_0x2193('0x11c')],{'as':_0x2193('0x11d'),'through':_0x2193('0x1ce')});db[_0x2193('0xe3')][_0x2193('0x117')](db[_0x2193('0x11c')],{'as':'BlackLists','through':_0x2193('0x1cf')});db[_0x2193('0xe8')]['belongsTo'](db['MailMessage'],{});db[_0x2193('0xe8')]['belongsTo'](db[_0x2193('0x3f')],{});db[_0x2193('0xe8')]['belongsTo'](db[_0x2193('0x3b')],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db[_0x2193('0xe8')]['belongsTo'](db[_0x2193('0x14')],{'foreignKey':_0x2193('0x1d0'),'as':_0x2193('0x1d1')});db[_0x2193('0xe8')][_0x2193('0x116')](db[_0x2193('0x14')],{'foreignKey':_0x2193('0x1d2'),'as':_0x2193('0x1d3')});db[_0x2193('0xe8')][_0x2193('0x116')](db[_0x2193('0x3d')],{'foreignKey':_0x2193('0x1d4'),'as':_0x2193('0x1d5')});db['MailTransferReport']['belongsTo'](db[_0x2193('0x3b')],{'foreignKey':_0x2193('0x1d6'),'as':'ToAccount'});db[_0x2193('0x1d7')][_0x2193('0x116')](db[_0x2193('0x187')],{});db[_0x2193('0x1d7')]['belongsTo'](db[_0x2193('0x18c')],{});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x2193('0x1d8'),'as':_0x2193('0x1d9')});db[_0x2193('0x1d7')][_0x2193('0x116')](db[_0x2193('0x14')],{'foreignKey':_0x2193('0x1d0'),'as':'FromAgent'});db['ChatTransferReport'][_0x2193('0x116')](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x2193('0x1d7')][_0x2193('0x116')](db[_0x2193('0x68')],{'foreignKey':_0x2193('0x1da'),'as':'ToQueue'});db['ChatTransferReport'][_0x2193('0x116')](db[_0x2193('0x61')],{'foreignKey':_0x2193('0x1db'),'as':'ToAccount'});db[_0x2193('0x1dc')][_0x2193('0x116')](db['FaxMessage'],{});db['FaxTransferReport'][_0x2193('0x116')](db['FaxInteraction'],{});db[_0x2193('0x1dc')][_0x2193('0x116')](db[_0x2193('0x47')],{'foreignKey':'FromFaxAccountId','as':_0x2193('0x1d9')});db[_0x2193('0x1dc')][_0x2193('0x116')](db['User'],{'foreignKey':'FromUserId','as':_0x2193('0x1d1')});db[_0x2193('0x1dc')][_0x2193('0x116')](db[_0x2193('0x14')],{'foreignKey':_0x2193('0x1d2'),'as':_0x2193('0x1d3')});db[_0x2193('0x1dc')][_0x2193('0x116')](db['FaxQueue'],{'foreignKey':_0x2193('0x1dd'),'as':_0x2193('0x1d5')});db[_0x2193('0x1dc')][_0x2193('0x116')](db[_0x2193('0x47')],{'foreignKey':'ToFaxAccountId','as':_0x2193('0x1de')});db[_0x2193('0x1df')][_0x2193('0x116')](db[_0x2193('0x5d')],{});db[_0x2193('0x1df')][_0x2193('0x116')](db[_0x2193('0x5c')],{});db[_0x2193('0x1df')][_0x2193('0x116')](db[_0x2193('0x58')],{'foreignKey':_0x2193('0x1e0'),'as':_0x2193('0x1d9')});db[_0x2193('0x1df')]['belongsTo'](db[_0x2193('0x14')],{'foreignKey':'FromUserId','as':'FromAgent'});db['OpenchannelTransferReport']['belongsTo'](db[_0x2193('0x14')],{'foreignKey':_0x2193('0x1d2'),'as':_0x2193('0x1d3')});db[_0x2193('0x1df')][_0x2193('0x116')](db[_0x2193('0x5f')],{'foreignKey':_0x2193('0x1e1'),'as':_0x2193('0x1d5')});db['OpenchannelTransferReport']['belongsTo'](db[_0x2193('0x58')],{'foreignKey':'ToOpenchannelAccountId','as':_0x2193('0x1de')});db[_0x2193('0xeb')][_0x2193('0x116')](db[_0x2193('0x56')],{});db['SmsTransferReport'][_0x2193('0x116')](db['SmsInteraction'],{});db[_0x2193('0xeb')][_0x2193('0x116')](db['SmsAccount'],{'foreignKey':_0x2193('0x1e2'),'as':_0x2193('0x1d9')});db[_0x2193('0xeb')][_0x2193('0x116')](db[_0x2193('0x14')],{'foreignKey':'FromUserId','as':_0x2193('0x1d1')});db['SmsTransferReport'][_0x2193('0x116')](db[_0x2193('0x14')],{'foreignKey':_0x2193('0x1d2'),'as':_0x2193('0x1d3')});db['SmsTransferReport'][_0x2193('0x116')](db['SmsQueue'],{'foreignKey':_0x2193('0x1e3'),'as':_0x2193('0x1d5')});db[_0x2193('0xeb')][_0x2193('0x116')](db[_0x2193('0x52')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0x2193('0x11c')][_0x2193('0x108')](db['Disposition'],{'as':_0x2193('0x178'),'foreignKey':_0x2193('0x15b')});db[_0x2193('0x11c')][_0x2193('0x108')](db[_0x2193('0x77')],{'as':_0x2193('0x1e4'),'foreignKey':_0x2193('0x15b')});db[_0x2193('0x11c')][_0x2193('0x108')](db[_0x2193('0x6e')],{'as':_0x2193('0x11a'),'onDelete':_0x2193('0x10a'),'foreignKey':_0x2193('0x15b')});db[_0x2193('0x11c')][_0x2193('0x108')](db[_0x2193('0x73')],{'as':'HopperFinals','foreignKey':_0x2193('0x15b')});db[_0x2193('0x11c')][_0x2193('0x108')](db['CmHopperHistory'],{'as':_0x2193('0x10c'),'foreignKey':_0x2193('0x15b')});db[_0x2193('0x11c')][_0x2193('0x108')](db[_0x2193('0x10d')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db['CmList'][_0x2193('0x117')](db[_0x2193('0x1b')],{'as':_0x2193('0x1e5'),'through':_0x2193('0x145')});db[_0x2193('0x11c')][_0x2193('0x117')](db[_0x2193('0x14')],{'as':_0x2193('0x146'),'through':_0x2193('0x11e')});db[_0x2193('0x12e')][_0x2193('0x108')](db[_0x2193('0x136')],{'as':_0x2193('0x1a0'),'onDelete':_0x2193('0x10a')});db[_0x2193('0x12e')][_0x2193('0x117')](db[_0x2193('0x14')],{'as':_0x2193('0x146'),'through':_0x2193('0x12f')});db[_0x2193('0xef')][_0x2193('0x108')](db[_0x2193('0x14')],{'as':_0x2193('0x166'),'foreignKey':_0x2193('0x1e6')});db[_0x2193('0xef')][_0x2193('0x108')](db['UserProfileSection'],{'as':_0x2193('0x1e7'),'foreignKey':'userProfileId','onDelete':_0x2193('0x10a')});db[_0x2193('0x1e8')]['hasMany'](db[_0x2193('0xf1')],{'as':_0x2193('0x1e9'),'foreignKey':_0x2193('0x1ea'),'onDelete':_0x2193('0x10a')});db[_0x2193('0xf7')][_0x2193('0x108')](db[_0x2193('0x157')],{'as':_0x2193('0x178'),'foreignKey':'WhatsappAccountId'});db[_0x2193('0xf7')][_0x2193('0x108')](db[_0x2193('0x7c')],{'as':_0x2193('0x158'),'foreignKey':_0x2193('0x1eb')});db[_0x2193('0xf7')][_0x2193('0x108')](db[_0x2193('0xfd')],{'as':_0x2193('0x14a'),'foreignKey':'WhatsappAccountId'});db[_0x2193('0xf7')][_0x2193('0x108')](db[_0x2193('0xfb')],{'as':_0x2193('0x159')});db[_0x2193('0xf7')][_0x2193('0x108')](db[_0x2193('0xf9')],{'as':_0x2193('0x138')});db['WhatsappAccount'][_0x2193('0x116')](db[_0x2193('0x11c')],{'as':_0x2193('0x15a'),'foreignKey':'ListId'});db['WhatsappAccount'][_0x2193('0x116')](db[_0x2193('0x83')],{'as':_0x2193('0x143'),'foreignKey':_0x2193('0x144')});db[_0x2193('0xf7')]['belongsToMany'](db['User'],{'as':_0x2193('0x146'),'through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0x2193('0x116')](db[_0x2193('0x14')],{'onDelete':'restrict'});db[_0x2193('0xf9')][_0x2193('0x116')](db[_0x2193('0x101')],{'onDelete':_0x2193('0x16a')});db[_0x2193('0xf9')]['belongsTo'](db[_0x2193('0xf7')],{'onDelete':_0x2193('0x16a')});db[_0x2193('0xf9')][_0x2193('0x116')](db[_0x2193('0x81')],{'onDelete':_0x2193('0x16a'),'foreignKey':_0x2193('0x16b')});db['WhatsappApplication'][_0x2193('0x116')](db['Tag'],{'onDelete':_0x2193('0x16a'),'foreignKey':_0x2193('0x16c')});db[_0x2193('0xfb')]['hasMany'](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x2193('0x1ec')});db[_0x2193('0xfb')]['belongsTo'](db[_0x2193('0xf7')],{'as':_0x2193('0x160'),'foreignKey':'WhatsappAccountId'});db[_0x2193('0xfb')][_0x2193('0x116')](db[_0x2193('0x6e')],{'as':_0x2193('0x161'),'foreignKey':_0x2193('0x153')});db[_0x2193('0xfb')][_0x2193('0x116')](db[_0x2193('0x14')],{'as':_0x2193('0x162'),'foreignKey':_0x2193('0x107')});db[_0x2193('0xfb')][_0x2193('0x117')](db[_0x2193('0x163')],{'through':_0x2193('0x1a7'),'as':_0x2193('0x165')});db[_0x2193('0xfb')][_0x2193('0x117')](db[_0x2193('0x163')],{'through':'whatsapp_interaction_has_tags','as':_0x2193('0x174')});db[_0x2193('0xfb')][_0x2193('0x117')](db['User'],{'as':'Users','through':_0x2193('0x1ed'),'foreignKey':_0x2193('0x1ec')});db[_0x2193('0xfd')][_0x2193('0x116')](db['User'],{'as':'User'});db[_0x2193('0xfd')]['belongsTo'](db[_0x2193('0x6e')],{'onDelete':_0x2193('0x10a'),'as':_0x2193('0x161')});db['WhatsappMessage']['belongsTo'](db[_0x2193('0xfb')],{'onDelete':_0x2193('0x10a'),'as':'Interaction','foreignKey':_0x2193('0x1ec')});db['WhatsappMessage']['belongsTo'](db[_0x2193('0xf7')],{'as':_0x2193('0x160'),'foreignKey':_0x2193('0x1eb')});db['WhatsappQueueReport'][_0x2193('0x116')](db[_0x2193('0xf7')],{});db[_0x2193('0x1ee')]['belongsTo'](db[_0x2193('0x11c')],{'as':'List','foreignKey':'ListId'});db[_0x2193('0x1ee')][_0x2193('0x116')](db['CmContact'],{'as':_0x2193('0x161'),'foreignKey':_0x2193('0x153')});db[_0x2193('0x1ee')][_0x2193('0x116')](db['WhatsappInteraction'],{});db[_0x2193('0x1ee')][_0x2193('0x116')](db[_0x2193('0x101')],{});db[_0x2193('0x1ee')][_0x2193('0x116')](db[_0x2193('0xfd')],{});db['WhatsappQueueReport'][_0x2193('0x116')](db[_0x2193('0x14')],{});db[_0x2193('0x100')][_0x2193('0x116')](db[_0x2193('0xfd')],{});db['WhatsappTransferReport'][_0x2193('0x116')](db[_0x2193('0xfb')],{});db[_0x2193('0x100')][_0x2193('0x116')](db[_0x2193('0xf7')],{'foreignKey':_0x2193('0x1ef'),'as':_0x2193('0x1d9')});db['WhatsappTransferReport'][_0x2193('0x116')](db[_0x2193('0xf7')],{'foreignKey':_0x2193('0x1f0'),'as':_0x2193('0x1de')});db[_0x2193('0x100')][_0x2193('0x116')](db[_0x2193('0x101')],{'foreignKey':_0x2193('0x1f1'),'as':_0x2193('0x1d5')});db[_0x2193('0x100')]['belongsTo'](db[_0x2193('0x14')],{'foreignKey':_0x2193('0x1d0'),'as':'FromAgent'});db[_0x2193('0x100')]['belongsTo'](db[_0x2193('0x14')],{'foreignKey':_0x2193('0x1d2'),'as':'ToAgent'});db['WhatsappQueue'][_0x2193('0x117')](db['User'],{'as':_0x2193('0x146'),'through':_0x2193('0x37'),'foreignKey':_0x2193('0x1f2')});db[_0x2193('0x101')][_0x2193('0x117')](db[_0x2193('0xdf')],{'through':_0x2193('0x1cb'),'as':'Teams'});module[_0x2193('0x1f3')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xf094=['exports','path','sequelize','lodash','determine','xcall','xC@LL1234','127.0.0.1','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','motion2','mysql','username','database','password','options','User','import','../api/user/user.model','VoiceChanSpy','../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','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsQueue','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/schedule/schedule.model','Tag','../api/tag/tag.model','../api/template/template.model','Trigger','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','AnalyticMetric','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','Plugin','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfileSection/userProfileSection.model','../api/notification/notification.model','UserNotification','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','VoiceMail','cascade','UserId','hasMany','Recordings','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','MailInteractions','WhatsappInteractions','Notification','Notifications','SenderId','belongsTo','ChatGroup','Groups','belongsToMany','Contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','SmsInteraction','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','UserVoiceQueue','MailQueues','ChatQueues','FaxQueues','UserFaxQueue','UserSmsQueue','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','user_has_openchannel_accounts','WhatsappAccount','WhatsappAccounts','SquareProjects','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','VoiceQueueReport','QueueCalls','AgentReports','Contact','ContactId','MailServerIn','MailAccountId','MailServerOut','Smtp','Answers','Interactions','MailApplication','List','ListId','Template','TemplateId','mandatoryDispositionPauseId','MailInteractionId','Account','Owner','Tags','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','restrict','Items','FaxAccountId','Exntensions','TagId','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','FaxQueueReport','Dispositions','SmsAccountId','user_has_sms_accounts','SmsMessage','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelMessage','OpenchannelInteractionId','openchannel_interaction_has_tags','ChatWebsiteId','ProactiveActions','ChatApplication','ChatMessage','OpenchannelQueueReport','Agent','ChatQueueId','Website','chat_interaction_has_tags','team_has_chat_queues','chat_group_has_users','CompanyId','JscriptySessions','Company','cm_user_has_contacts','cm_contact_has_tags','Queue','CampaignId','OwnerId','Automation','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','Schedule','DefaultReportId','Mohs','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','CustomReportId','SalesforceAccount','Configurations','AccountId','SubjectId','Descriptions','Field','Variable','Subjects','FieldId','Subject','Description','DescriptionId','VariableId','DeskConfiguration','ZohoAccount','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','FromId','ToId','JscriptyAnswerReport','SessionId','ProjectId','user_has_square_projects','team_has_voice_queues','VoiceQueues','SmsQueues','team_has_openchannel_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','MailTransferReport','FromMailAccountId','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','FromChatWebsiteId','FromAccount','FromAgent','ToChatQueueId','ToAccount','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToOpenchannelQueueId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','userProfileId','UserProfileSection','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappInteraction','user_has_whatsapp_accounts','WhatsappInteractionId','whatsapp_interaction_has_tags','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId'];(function(_0x43d2d3,_0x223055){var _0xed5830=function(_0x2e2cce){while(--_0x2e2cce){_0x43d2d3['push'](_0x43d2d3['shift']());}};_0xed5830(++_0x223055);}(_0xf094,0x1ee));var _0x4f09=function(_0x2e68db,_0x275d04){_0x2e68db=_0x2e68db-0x0;var _0x12df4c=_0xf094[_0x2e68db];return _0x12df4c;};'use strict';var path=require(_0x4f09('0x0'));var config=require('../config/environment');var Sequelize=require(_0x4f09('0x1'));var _=require(_0x4f09('0x2'));var jstz=require('jstz');var timezone=jstz[_0x4f09('0x3')]();config[_0x4f09('0x1')]=_['defaultsDeep'](config['sequelize'],{'database':'motion2','username':_0x4f09('0x4'),'password':_0x4f09('0x5'),'options':{'host':_0x4f09('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x4f09('0x7')](),'define':{'charset':_0x4f09('0x8'),'collate':_0x4f09('0x9')}}});config[_0x4f09('0xa')]=_[_0x4f09('0xb')](config[_0x4f09('0xa')],{'database':_0x4f09('0xc'),'username':_0x4f09('0x4'),'password':_0x4f09('0x5'),'options':{'host':_0x4f09('0x6'),'port':0xcea,'dialect':_0x4f09('0xd'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x4f09('0x7')](),'define':{'charset':_0x4f09('0x8'),'collate':_0x4f09('0x9')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x4f09('0x1')][_0x4f09('0xe')],config[_0x4f09('0x1')]['password'],config[_0x4f09('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x4f09('0xa')][_0x4f09('0xf')],config['sequelizeHistory'][_0x4f09('0xe')],config['sequelizeHistory'][_0x4f09('0x10')],config['sequelizeHistory'][_0x4f09('0x11')])};db[_0x4f09('0x12')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x14'));db[_0x4f09('0x15')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x16'));db[_0x4f09('0x17')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x18'));db[_0x4f09('0x19')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x1a'));db[_0x4f09('0x1b')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x1c'));db[_0x4f09('0x1d')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x1e'));db[_0x4f09('0x1f')]=db['sequelize']['import'](_0x4f09('0x20'));db[_0x4f09('0x21')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/voiceMail/voiceMail.model');db[_0x4f09('0x22')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x23'));db['VoiceCallReport']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x24'));db[_0x4f09('0x25')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x26'));db['VoiceAgentReport']=db['sequelize'][_0x4f09('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x27'));db['Trunk']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x28'));db[_0x4f09('0x29')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x2a'));db[_0x4f09('0x2b')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x2c'));db['UserVoiceQueue']=db['sequelize'][_0x4f09('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x4f09('0x2d')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x2e'));db[_0x4f09('0x2f')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x30'));db['UserSmsQueue']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x31'));db['UserOpenchannelQueue']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x32'));db[_0x4f09('0x33')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x34'));db['MailServerIn']=db[_0x4f09('0x1')]['import']('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x35'));db[_0x4f09('0x36')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x37'));db[_0x4f09('0x38')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/mailQueue/mailQueue.model');db[_0x4f09('0x39')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x3a'));db[_0x4f09('0x3b')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x3c'));db[_0x4f09('0x3d')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x3e'));db['MailApplication']=db[_0x4f09('0x1')]['import'](_0x4f09('0x3f'));db[_0x4f09('0x40')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x41'));db[_0x4f09('0x42')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/dashboard/dashboard.model');db[_0x4f09('0x43')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x44'));db[_0x4f09('0x45')]=db['sequelize']['import']('../api/faxAccount/faxAccount.model');db[_0x4f09('0x46')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/faxApplication/faxApplication.model');db[_0x4f09('0x47')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x48'));db[_0x4f09('0x49')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/faxMessage/faxMessage.model');db[_0x4f09('0x4a')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x4b'));db[_0x4f09('0x4c')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x4d'));db[_0x4f09('0x4e')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x4f'));db['SmsInteraction']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x50'));db['SmsMessage']=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/smsMessage/smsMessage.model');db[_0x4f09('0x51')]=db[_0x4f09('0x1')]['import']('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/openchannelAccount/openchannelAccount.model');db[_0x4f09('0x52')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x53'));db[_0x4f09('0x54')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x55'));db['OpenchannelMessage']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x56'));db[_0x4f09('0x57')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x58'));db[_0x4f09('0x59')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db[_0x4f09('0x1')]['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x4f09('0x1')]['import'](_0x4f09('0x5a'));db[_0x4f09('0x5b')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x5c'));db['ChatMessage']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x5d'));db[_0x4f09('0x5e')]=db['sequelize'][_0x4f09('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x4f09('0x5f')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x60'));db['ChatGroup']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x61'));db[_0x4f09('0x62')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x63'));db[_0x4f09('0x64')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x65'));db[_0x4f09('0x66')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x67'));db[_0x4f09('0x68')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/cmHopper/cmHopper.model');db[_0x4f09('0x69')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x6a'));db[_0x4f09('0x6b')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x6c'));db[_0x4f09('0x6d')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x6e'));db[_0x4f09('0x6f')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x70'));db[_0x4f09('0x71')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0x4f09('0x72')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x73'));db['Automation']=db[_0x4f09('0x1')]['import'](_0x4f09('0x74'));db[_0x4f09('0x75')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x76'));db[_0x4f09('0x77')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x78'));db[_0x4f09('0x79')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x7a'));db[_0x4f09('0x7b')]=db['sequelize']['import'](_0x4f09('0x7c'));db[_0x4f09('0x7d')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x7e'));db['Cdr']=db[_0x4f09('0x1')]['import'](_0x4f09('0x7f'));db[_0x4f09('0x80')]=db['sequelize'][_0x4f09('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x81'));db['Sound']=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/sound/sound.model');db[_0x4f09('0x82')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x83'));db['Template']=db['sequelize']['import'](_0x4f09('0x84'));db[_0x4f09('0x85')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/trigger/trigger.model');db['Variable']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x86'));db[_0x4f09('0x87')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x88'));db[_0x4f09('0x89')]=db['sequelize']['import'](_0x4f09('0x8a'));db[_0x4f09('0x8b')]=db['sequelize']['import'](_0x4f09('0x8c'));db[_0x4f09('0x8d')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x4f09('0x8e')]=db[_0x4f09('0x1')]['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x4f09('0x8f')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0x4f09('0x90')]=db['sequelize'][_0x4f09('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x4f09('0x91')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x92'));db['SalesforceAccount']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x93'));db[_0x4f09('0x94')]=db['sequelize'][_0x4f09('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x4f09('0x95')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x96'));db[_0x4f09('0x97')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x98'));db[_0x4f09('0x99')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x9a'));db[_0x4f09('0x9b')]=db[_0x4f09('0x1')]['import'](_0x4f09('0x9c'));db[_0x4f09('0x9d')]=db['sequelize']['import']('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x4f09('0x9e')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0x9f'));db['ZohoAccount']=db[_0x4f09('0x1')]['import'](_0x4f09('0xa0'));db[_0x4f09('0xa1')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xa2'));db[_0x4f09('0xa3')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xa4'));db[_0x4f09('0xa5')]=db[_0x4f09('0x1')]['import']('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xa6'));db['ZendeskField']=db[_0x4f09('0x1')]['import'](_0x4f09('0xa7'));db[_0x4f09('0xa8')]=db[_0x4f09('0x1')]['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x4f09('0xa9')]=db[_0x4f09('0x1')]['import'](_0x4f09('0xaa'));db[_0x4f09('0xab')]=db[_0x4f09('0x1')]['import'](_0x4f09('0xac'));db[_0x4f09('0xad')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0xae'));db[_0x4f09('0xaf')]=db[_0x4f09('0x1')]['import'](_0x4f09('0xb0'));db[_0x4f09('0xb1')]=db[_0x4f09('0x1')]['import'](_0x4f09('0xb2'));db[_0x4f09('0xb3')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x4f09('0xb4')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x4f09('0xb5')]=db[_0x4f09('0x1')]['import'](_0x4f09('0xb6'));db['Dynamics365Account']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xb7'));db[_0x4f09('0xb8')]=db[_0x4f09('0x1')]['import'](_0x4f09('0xb9'));db[_0x4f09('0xba')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x4f09('0xbb')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xbc'));db[_0x4f09('0xbd')]=db[_0x4f09('0x1')]['import'](_0x4f09('0xbe'));db[_0x4f09('0xbf')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0xc0'));db['Integration']=db['sequelize'][_0x4f09('0x13')](_0x4f09('0x88'));db['Network']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xc1'));db[_0x4f09('0xc2')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0x4f09('0xc3')]=db[_0x4f09('0x1')]['import'](_0x4f09('0xc4'));db['JscriptyAnswerReport']=db[_0x4f09('0x1')]['import'](_0x4f09('0xc5'));db[_0x4f09('0xc6')]=db['sequelize']['import'](_0x4f09('0xc7'));db[_0x4f09('0xc8')]=db['sequelize'][_0x4f09('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x4f09('0xc9')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xca'));db[_0x4f09('0xcb')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/squareReport/squareReport.model');db[_0x4f09('0xcc')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0xcd'));db['JscriptyProject']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xce'));db[_0x4f09('0xcf')]=db[_0x4f09('0x1')]['import'](_0x4f09('0xd0'));db[_0x4f09('0xd1')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xd2'));db[_0x4f09('0xd3')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0xd4'));db[_0x4f09('0xd5')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/squareRecording/squareRecording.model');db[_0x4f09('0xd6')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xd7'));db[_0x4f09('0xd8')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/team/team.model');db[_0x4f09('0xd9')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/license/license.model');db[_0x4f09('0xda')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xdb'));db['Migration']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xdc'));db[_0x4f09('0xdd')]=db[_0x4f09('0x1')]['import']('../api/attachment/attachment.model');db[_0x4f09('0xde')]=db[_0x4f09('0x1')][_0x4f09('0x13')]('../api/plugin/plugin.model');db['MailTransferReport']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xdf'));db[_0x4f09('0xe0')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xe1'));db['FaxTransferReport']=db[_0x4f09('0x1')]['import'](_0x4f09('0xe2'));db[_0x4f09('0xe3')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xe4'));db[_0x4f09('0xe5')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xe6'));db[_0x4f09('0xe7')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0xe8'));db[_0x4f09('0xe9')]=db['sequelize']['import'](_0x4f09('0xea'));db[_0x4f09('0xeb')]=db['sequelize'][_0x4f09('0x13')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db['sequelize'][_0x4f09('0x13')](_0x4f09('0xec'));db['UserProfileResource']=db['sequelize'][_0x4f09('0x13')]('../api/userProfileResource/userProfileResource.model');db['Notification']=db['sequelize']['import'](_0x4f09('0xed'));db[_0x4f09('0xee')]=db[_0x4f09('0x1')]['import']('../api/userNotification/userNotification.model');db['WhatsappAccount']=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xef'));db[_0x4f09('0xf0')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xf1'));db['WhatsappInteraction']=db[_0x4f09('0x1')]['import'](_0x4f09('0xf2'));db[_0x4f09('0xf3')]=db['sequelize'][_0x4f09('0x13')](_0x4f09('0xf4'));db[_0x4f09('0xf5')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xf6'));db[_0x4f09('0xf7')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xf8'));db[_0x4f09('0xf9')]=db[_0x4f09('0x1')]['import'](_0x4f09('0xfa'));db[_0x4f09('0xfb')]=db[_0x4f09('0x1')][_0x4f09('0x13')](_0x4f09('0xfc'));db[_0x4f09('0x12')][_0x4f09('0xfd')](db[_0x4f09('0xfe')],{'as':_0x4f09('0xfe'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x12')][_0x4f09('0x101')](db[_0x4f09('0x1f')],{'as':_0x4f09('0x102'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x12')][_0x4f09('0x101')](db[_0x4f09('0x2b')],{'as':'VoiceQueuesRt','foreignKey':_0x4f09('0x100')});db['User'][_0x4f09('0x101')](db[_0x4f09('0x19')],{'as':_0x4f09('0x103'),'onDelete':_0x4f09('0xff'),'hooks':!![]});db[_0x4f09('0x12')][_0x4f09('0x101')](db[_0x4f09('0x6b')],{'as':_0x4f09('0x104'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x12')][_0x4f09('0x101')](db['CmHopperHistory'],{'as':_0x4f09('0x105'),'foreignKey':_0x4f09('0x100')});db['User'][_0x4f09('0x101')](db[_0x4f09('0x6f')],{'as':_0x4f09('0x6f'),'foreignKey':_0x4f09('0x100')});db['User'][_0x4f09('0x101')](db[_0x4f09('0x54')],{'as':_0x4f09('0x106'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x12')][_0x4f09('0x101')](db[_0x4f09('0x5b')],{'as':_0x4f09('0x107'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x12')][_0x4f09('0x101')](db['SmsInteraction'],{'as':_0x4f09('0x108'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x12')][_0x4f09('0x101')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':'UserId'});db[_0x4f09('0x12')]['hasMany'](db[_0x4f09('0x3b')],{'as':_0x4f09('0x109'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x12')][_0x4f09('0x101')](db['WhatsappInteraction'],{'as':_0x4f09('0x10a'),'foreignKey':_0x4f09('0x100')});db['User'][_0x4f09('0x101')](db[_0x4f09('0x10b')],{'as':_0x4f09('0x10c'),'foreignKey':_0x4f09('0x10d')});db[_0x4f09('0x12')][_0x4f09('0x101')](db[_0x4f09('0xee')],{'as':'UserNotifications','foreignKey':_0x4f09('0x10d')});db[_0x4f09('0x12')][_0x4f09('0x10e')](db['UserProfile'],{'as':_0x4f09('0xeb'),'foreignKey':'userProfileId'});db[_0x4f09('0x12')]['belongsToMany'](db[_0x4f09('0x10f')],{'as':_0x4f09('0x110'),'through':'chat_group_has_users'});db[_0x4f09('0x12')][_0x4f09('0x111')](db[_0x4f09('0x66')],{'as':_0x4f09('0x112'),'through':'cm_user_has_contacts'});db['User'][_0x4f09('0x111')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x113'),'through':_0x4f09('0x114')});db['User']['belongsToMany'](db[_0x4f09('0xd8')],{'through':_0x4f09('0x115')});db[_0x4f09('0x12')][_0x4f09('0x111')](db[_0x4f09('0x3b')],{'as':_0x4f09('0x109'),'through':_0x4f09('0x116')});db[_0x4f09('0x12')][_0x4f09('0x111')](db[_0x4f09('0x5b')],{'as':_0x4f09('0x107'),'through':_0x4f09('0x117')});db[_0x4f09('0x12')][_0x4f09('0x111')](db['FaxInteraction'],{'as':_0x4f09('0x118'),'through':_0x4f09('0x119')});db[_0x4f09('0x12')]['belongsToMany'](db[_0x4f09('0x11a')],{'as':_0x4f09('0x108'),'through':_0x4f09('0x11b')});db[_0x4f09('0x12')]['belongsToMany'](db[_0x4f09('0x54')],{'as':_0x4f09('0x106'),'through':_0x4f09('0x11c')});db[_0x4f09('0x12')][_0x4f09('0x111')](db['WhatsappInteraction'],{'as':_0x4f09('0x10a'),'through':_0x4f09('0x11d')});db['User'][_0x4f09('0x111')](db[_0x4f09('0x1d')],{'as':'VoiceQueues','through':_0x4f09('0x11e'),'required':![]});db['User'][_0x4f09('0x111')](db[_0x4f09('0x38')],{'as':_0x4f09('0x11f'),'through':'UserMailQueue','required':![]});db[_0x4f09('0x12')][_0x4f09('0x111')](db[_0x4f09('0x5f')],{'as':_0x4f09('0x120'),'through':_0x4f09('0x2d'),'required':![],'hooks':!![]});db[_0x4f09('0x12')][_0x4f09('0x111')](db[_0x4f09('0x4a')],{'as':_0x4f09('0x121'),'through':_0x4f09('0x122'),'required':![]});db[_0x4f09('0x12')]['belongsToMany'](db[_0x4f09('0x51')],{'as':'SmsQueues','through':_0x4f09('0x123'),'required':![]});db[_0x4f09('0x12')][_0x4f09('0x111')](db[_0x4f09('0x57')],{'as':_0x4f09('0x124'),'through':_0x4f09('0x125'),'required':![]});db[_0x4f09('0x12')][_0x4f09('0x111')](db[_0x4f09('0xf9')],{'as':_0x4f09('0x126'),'through':_0x4f09('0x33'),'required':![]});db[_0x4f09('0x12')][_0x4f09('0x111')](db['CmList'],{'through':'cm_user_has_lists'});db['User']['belongsToMany'](db[_0x4f09('0xe9')],{'as':_0x4f09('0x127'),'through':_0x4f09('0x128'),'required':![]});db[_0x4f09('0x12')][_0x4f09('0x111')](db['ChatWebsite'],{'as':_0x4f09('0x129'),'through':_0x4f09('0x12a')});db[_0x4f09('0x12')][_0x4f09('0x111')](db[_0x4f09('0x45')],{'as':_0x4f09('0x12b'),'through':_0x4f09('0x12c')});db['User']['belongsToMany'](db[_0x4f09('0x36')],{'as':_0x4f09('0x12d'),'through':_0x4f09('0x12e')});db[_0x4f09('0x12')][_0x4f09('0x111')](db[_0x4f09('0x12f')],{'as':'OpenchannelAccounts','through':_0x4f09('0x130')});db['User']['belongsToMany'](db[_0x4f09('0x4c')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db[_0x4f09('0x12')]['belongsToMany'](db[_0x4f09('0x131')],{'as':_0x4f09('0x132'),'through':'user_has_whatsapp_accounts'});db[_0x4f09('0x12')]['belongsToMany'](db[_0x4f09('0xd3')],{'as':_0x4f09('0x133'),'through':'user_has_square_projects'});db[_0x4f09('0x15')][_0x4f09('0x101')](db['VoiceExtension'],{'as':_0x4f09('0x134'),'onDelete':'cascade','foreignKey':_0x4f09('0x135')});db[_0x4f09('0x17')][_0x4f09('0x101')](db[_0x4f09('0x19')],{'onDelete':'cascade'});db['VoiceExtension']['hasMany'](db[_0x4f09('0x19')],{'as':_0x4f09('0x136'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0x1b')][_0x4f09('0x111')](db[_0x4f09('0x137')],{'as':_0x4f09('0x138'),'through':'moh_has_sounds'});db[_0x4f09('0x1d')][_0x4f09('0x101')](db['UserVoiceQueueRt'],{'as':_0x4f09('0x139'),'foreignKey':_0x4f09('0x13a')});db[_0x4f09('0x1d')][_0x4f09('0x101')](db[_0x4f09('0x68')],{'as':_0x4f09('0x13b'),'foreignKey':_0x4f09('0x13a')});db[_0x4f09('0x1d')][_0x4f09('0x101')](db[_0x4f09('0x6b')],{'as':_0x4f09('0x104'),'foreignKey':_0x4f09('0x13a')});db[_0x4f09('0x1d')][_0x4f09('0x101')](db[_0x4f09('0x6d')],{'as':_0x4f09('0x13c'),'foreignKey':_0x4f09('0x13a')});db[_0x4f09('0x1d')]['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x4f09('0x13a')});db['VoiceQueue'][_0x4f09('0x101')](db[_0x4f09('0x69')],{'as':_0x4f09('0x13d'),'foreignKey':_0x4f09('0x13a')});db[_0x4f09('0x1d')][_0x4f09('0x101')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db[_0x4f09('0x1d')][_0x4f09('0x10e')](db['Trunk'],{'as':_0x4f09('0x13e'),'foreignKey':_0x4f09('0x13f')});db[_0x4f09('0x1d')]['belongsTo'](db[_0x4f09('0x13e')],{'as':_0x4f09('0x140'),'foreignKey':_0x4f09('0x141')});db[_0x4f09('0x1d')][_0x4f09('0x10e')](db[_0x4f09('0x7b')],{'as':_0x4f09('0x7b'),'foreignKey':_0x4f09('0x142')});db[_0x4f09('0x1d')][_0x4f09('0x10e')](db[_0x4f09('0x7d')],{'as':_0x4f09('0x143'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x4f09('0x1d')]['belongsToMany'](db[_0x4f09('0xe7')],{'as':_0x4f09('0x113'),'through':_0x4f09('0x144')});db[_0x4f09('0x1d')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':_0x4f09('0x11e')});db[_0x4f09('0x1d')]['belongsToMany'](db[_0x4f09('0xd8')],{'as':_0x4f09('0x146'),'through':'team_has_voice_queues'});db[_0x4f09('0x1d')][_0x4f09('0x111')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x147'),'through':_0x4f09('0x148')});db['VoiceRecording'][_0x4f09('0x10e')](db['User'],{'as':_0x4f09('0x12'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x21')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'as':_0x4f09('0x12'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0xfe')][_0x4f09('0x101')](db[_0x4f09('0x22')],{'as':_0x4f09('0x149'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0x4f09('0x14a')});db['VoiceMailMessage'][_0x4f09('0x10e')](db['VoiceMail'],{'foreignKey':_0x4f09('0x14b'),'targetKey':'mailbox'});db[_0x4f09('0x14c')][_0x4f09('0x101')](db[_0x4f09('0x14d')],{'as':_0x4f09('0x14e'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x4f09('0x101')](db['VoiceAgentReport'],{'as':_0x4f09('0x14f'),'foreignKey':'uniqueid','constraints':![]});db[_0x4f09('0x14c')]['belongsTo'](db[_0x4f09('0x12')],{'as':_0x4f09('0x12'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x14c')][_0x4f09('0x10e')](db['CmContact'],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x152')][_0x4f09('0x10e')](db[_0x4f09('0x36')],{'as':'MailAccount','foreignKey':_0x4f09('0x153')});db['MailServerOut'][_0x4f09('0x10e')](db[_0x4f09('0x36')],{'as':_0x4f09('0x36'),'foreignKey':'MailAccountId'});db[_0x4f09('0x36')][_0x4f09('0xfd')](db[_0x4f09('0x152')],{'as':'Imap','onDelete':_0x4f09('0xff')});db[_0x4f09('0x36')]['hasOne'](db[_0x4f09('0x154')],{'as':_0x4f09('0x155'),'onDelete':_0x4f09('0xff')});db['MailAccount'][_0x4f09('0x101')](db[_0x4f09('0x77')],{'as':'Dispositions','foreignKey':_0x4f09('0x153')});db[_0x4f09('0x36')][_0x4f09('0x101')](db['CannedAnswer'],{'as':_0x4f09('0x156'),'foreignKey':_0x4f09('0x153')});db['MailAccount'][_0x4f09('0x101')](db[_0x4f09('0x3d')],{'as':_0x4f09('0x149'),'foreignKey':_0x4f09('0x153')});db[_0x4f09('0x36')][_0x4f09('0x101')](db[_0x4f09('0x3b')],{'as':_0x4f09('0x157')});db[_0x4f09('0x36')][_0x4f09('0x101')](db[_0x4f09('0x158')],{'as':_0x4f09('0x136')});db['MailAccount'][_0x4f09('0x10e')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x159'),'foreignKey':_0x4f09('0x15a')});db[_0x4f09('0x36')][_0x4f09('0x10e')](db[_0x4f09('0x15b')],{'as':_0x4f09('0x15b'),'foreignKey':_0x4f09('0x15c')});db[_0x4f09('0x36')][_0x4f09('0x10e')](db[_0x4f09('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x4f09('0x15d')});db[_0x4f09('0x36')]['belongsToMany'](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':_0x4f09('0x12e')});db[_0x4f09('0x38')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':'Agents','through':'UserMailQueue'});db[_0x4f09('0x38')][_0x4f09('0x111')](db[_0x4f09('0xd8')],{'through':'team_has_mail_queues','as':'Teams'});db[_0x4f09('0x3b')][_0x4f09('0x101')](db[_0x4f09('0x3d')],{'as':_0x4f09('0x149'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x15e')});db[_0x4f09('0x3b')][_0x4f09('0x10e')](db['MailAccount'],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x153')});db[_0x4f09('0x3b')][_0x4f09('0x10e')](db['CmContact'],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x3b')]['belongsTo'](db[_0x4f09('0x12')],{'as':_0x4f09('0x160'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x3b')][_0x4f09('0x111')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x4f09('0x161')});db[_0x4f09('0x3b')][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':_0x4f09('0x162'),'as':_0x4f09('0x163')});db[_0x4f09('0x3b')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x164'),'through':_0x4f09('0x116'),'foreignKey':'MailInteractionId'});db[_0x4f09('0x3d')][_0x4f09('0x101')](db[_0x4f09('0xdd')],{'as':_0x4f09('0x165'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0x3d')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'as':_0x4f09('0x12')});db['MailMessage'][_0x4f09('0x10e')](db['CmContact'],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x150')});db[_0x4f09('0x3d')][_0x4f09('0x10e')](db[_0x4f09('0x3b')],{'as':_0x4f09('0x166'),'foreignKey':_0x4f09('0x15e')});db[_0x4f09('0x3d')][_0x4f09('0x10e')](db[_0x4f09('0x36')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x153')});db[_0x4f09('0x158')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'onDelete':_0x4f09('0x167')});db[_0x4f09('0x158')][_0x4f09('0x10e')](db[_0x4f09('0x38')],{'onDelete':_0x4f09('0x167')});db['MailApplication']['belongsTo'](db[_0x4f09('0x36')],{'onDelete':_0x4f09('0x167')});db['MailApplication'][_0x4f09('0x10e')](db[_0x4f09('0x7b')],{'onDelete':_0x4f09('0x167'),'foreignKey':'IntervalId'});db['MailApplication'][_0x4f09('0x10e')](db['Tag'],{'onDelete':_0x4f09('0x167'),'foreignKey':'TagId'});db[_0x4f09('0x40')]['belongsTo'](db[_0x4f09('0x36')],{});db[_0x4f09('0x40')][_0x4f09('0x10e')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x159'),'foreignKey':_0x4f09('0x15a')});db[_0x4f09('0x40')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db['MailQueueReport']['belongsTo'](db['MailInteraction'],{});db[_0x4f09('0x40')]['belongsTo'](db['MailMessage'],{});db[_0x4f09('0x40')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{});db[_0x4f09('0x40')]['belongsTo'](db['MailQueue'],{});db[_0x4f09('0x42')][_0x4f09('0x101')](db[_0x4f09('0x43')],{'as':_0x4f09('0x168'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0x45')][_0x4f09('0x101')](db[_0x4f09('0x77')],{'as':'Dispositions','foreignKey':_0x4f09('0x169')});db[_0x4f09('0x45')][_0x4f09('0x101')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x4f09('0x169')});db[_0x4f09('0x45')]['hasMany'](db[_0x4f09('0x47')],{'as':'Interactions'});db[_0x4f09('0x45')]['hasMany'](db[_0x4f09('0x46')],{'as':'Applications'});db[_0x4f09('0x45')][_0x4f09('0x101')](db[_0x4f09('0x19')],{'as':_0x4f09('0x16a'),'onDelete':'cascade'});db[_0x4f09('0x45')][_0x4f09('0x101')](db[_0x4f09('0x49')],{'as':'Messages'});db['FaxAccount'][_0x4f09('0x10e')](db[_0x4f09('0x13e')],{'as':'Trunk'});db[_0x4f09('0x45')][_0x4f09('0x10e')](db['CmList'],{'as':_0x4f09('0x159'),'foreignKey':_0x4f09('0x15a')});db[_0x4f09('0x45')][_0x4f09('0x10e')](db['Pause'],{'as':_0x4f09('0x143'),'foreignKey':_0x4f09('0x15d')});db[_0x4f09('0x45')][_0x4f09('0x111')](db['User'],{'as':_0x4f09('0x145'),'through':'user_has_fax_accounts'});db['FaxApplication']['belongsTo'](db[_0x4f09('0x12')],{'onDelete':_0x4f09('0x167')});db['FaxApplication']['belongsTo'](db[_0x4f09('0x4a')],{'onDelete':_0x4f09('0x167')});db[_0x4f09('0x46')][_0x4f09('0x10e')](db[_0x4f09('0x45')],{'onDelete':_0x4f09('0x167')});db[_0x4f09('0x46')][_0x4f09('0x10e')](db[_0x4f09('0x82')],{'onDelete':_0x4f09('0x167'),'foreignKey':_0x4f09('0x16b')});db['FaxInteraction'][_0x4f09('0x101')](db[_0x4f09('0x49')],{'as':_0x4f09('0x149'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x16c')});db[_0x4f09('0x47')][_0x4f09('0x10e')](db['FaxAccount'],{'as':_0x4f09('0x15f'),'foreignKey':'FaxAccountId'});db[_0x4f09('0x47')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':'ContactId'});db[_0x4f09('0x47')]['belongsTo'](db[_0x4f09('0x12')],{'as':_0x4f09('0x160'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x47')]['belongsToMany'](db[_0x4f09('0x82')],{'through':_0x4f09('0x16d'),'as':_0x4f09('0x161')});db['FaxInteraction'][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db['FaxInteraction'][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x164'),'through':_0x4f09('0x119'),'foreignKey':_0x4f09('0x16c')});db['FaxMessage']['belongsTo'](db[_0x4f09('0x12')],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x12')});db[_0x4f09('0x49')][_0x4f09('0x10e')](db['FaxInteraction'],{'as':_0x4f09('0x166'),'foreignKey':_0x4f09('0x16c')});db[_0x4f09('0x49')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'onDelete':_0x4f09('0xff'),'as':'Contact'});db[_0x4f09('0x49')][_0x4f09('0x10e')](db[_0x4f09('0xdd')],{'as':_0x4f09('0xdd'),'foreignKey':_0x4f09('0x16e')});db[_0x4f09('0x49')][_0x4f09('0x10e')](db[_0x4f09('0x45')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x169')});db['FaxQueue'][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':_0x4f09('0x122')});db['FaxQueue'][_0x4f09('0x111')](db[_0x4f09('0xd8')],{'through':_0x4f09('0x16f'),'as':_0x4f09('0x146')});db[_0x4f09('0x170')]['belongsTo'](db[_0x4f09('0x45')],{});db[_0x4f09('0x170')]['belongsTo'](db[_0x4f09('0xe7')],{'as':_0x4f09('0x159'),'foreignKey':_0x4f09('0x15a')});db[_0x4f09('0x170')]['belongsTo'](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x170')][_0x4f09('0x10e')](db[_0x4f09('0x47')],{});db[_0x4f09('0x170')]['belongsTo'](db['FaxMessage'],{});db[_0x4f09('0x170')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{});db[_0x4f09('0x170')][_0x4f09('0x10e')](db[_0x4f09('0x4a')],{});db['SmsAccount'][_0x4f09('0x101')](db['Disposition'],{'as':_0x4f09('0x171'),'foreignKey':_0x4f09('0x172')});db['SmsAccount']['hasMany'](db[_0x4f09('0x75')],{'as':_0x4f09('0x156'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x4f09('0x101')](db['SmsMessage'],{'as':'Messages','foreignKey':_0x4f09('0x172')});db[_0x4f09('0x4c')][_0x4f09('0x101')](db[_0x4f09('0x11a')],{'as':_0x4f09('0x157')});db['SmsAccount']['hasMany'](db[_0x4f09('0x4e')],{'as':_0x4f09('0x136')});db[_0x4f09('0x4c')][_0x4f09('0x10e')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x159'),'foreignKey':_0x4f09('0x15a')});db[_0x4f09('0x4c')][_0x4f09('0x10e')](db['Pause'],{'as':_0x4f09('0x143'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x4f09('0x4c')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':_0x4f09('0x173')});db['SmsApplication'][_0x4f09('0x10e')](db['User'],{'onDelete':_0x4f09('0x167')});db[_0x4f09('0x4e')][_0x4f09('0x10e')](db[_0x4f09('0x51')],{'onDelete':_0x4f09('0x167')});db[_0x4f09('0x4e')][_0x4f09('0x10e')](db[_0x4f09('0x4c')],{'onDelete':'restrict'});db[_0x4f09('0x4e')][_0x4f09('0x10e')](db[_0x4f09('0x7b')],{'onDelete':'restrict','foreignKey':_0x4f09('0x142')});db[_0x4f09('0x4e')][_0x4f09('0x10e')](db[_0x4f09('0x82')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x4f09('0x11a')]['hasMany'](db[_0x4f09('0x174')],{'as':_0x4f09('0x149'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0x4f09('0x11a')][_0x4f09('0x10e')](db[_0x4f09('0x4c')],{'as':_0x4f09('0x15f'),'foreignKey':'SmsAccountId'});db[_0x4f09('0x11a')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db['SmsInteraction'][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'as':_0x4f09('0x160'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x11a')]['belongsToMany'](db[_0x4f09('0x82')],{'through':'sms_interaction_has_tags','as':_0x4f09('0x161')});db[_0x4f09('0x11a')][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':_0x4f09('0x175'),'as':_0x4f09('0x163')});db[_0x4f09('0x11a')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x164'),'through':_0x4f09('0x11b'),'foreignKey':_0x4f09('0x176')});db['SmsMessage'][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'as':_0x4f09('0x12')});db[_0x4f09('0x174')][_0x4f09('0x10e')](db['CmContact'],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x150')});db[_0x4f09('0x174')][_0x4f09('0x10e')](db[_0x4f09('0x11a')],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x166'),'foreignKey':_0x4f09('0x176')});db['SmsMessage'][_0x4f09('0x10e')](db[_0x4f09('0x4c')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x172')});db['SmsQueue'][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':_0x4f09('0x123'),'foreignKey':_0x4f09('0x177')});db[_0x4f09('0x51')][_0x4f09('0x111')](db[_0x4f09('0xd8')],{'through':_0x4f09('0x178'),'as':_0x4f09('0x146')});db['OpenchannelAccount'][_0x4f09('0x101')](db['Disposition'],{'as':_0x4f09('0x171'),'foreignKey':'OpenchannelAccountId'});db[_0x4f09('0x12f')][_0x4f09('0x101')](db[_0x4f09('0x75')],{'as':_0x4f09('0x156'),'foreignKey':_0x4f09('0x179')});db[_0x4f09('0x12f')][_0x4f09('0x101')](db[_0x4f09('0x54')],{'as':_0x4f09('0x157'),'foreignKey':_0x4f09('0x179')});db['OpenchannelAccount'][_0x4f09('0x101')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0x4f09('0x179')});db[_0x4f09('0x12f')][_0x4f09('0x101')](db[_0x4f09('0x52')],{'as':_0x4f09('0x136'),'foreignKey':_0x4f09('0x179')});db[_0x4f09('0x12f')][_0x4f09('0x10e')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x159'),'foreignKey':_0x4f09('0x15a')});db['OpenchannelAccount'][_0x4f09('0x10e')](db[_0x4f09('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x4f09('0x15d')});db[_0x4f09('0x12f')][_0x4f09('0x111')](db['User'],{'as':'Agents','through':_0x4f09('0x130')});db['OpenchannelApplication'][_0x4f09('0x10e')](db['User'],{'onDelete':_0x4f09('0x167')});db[_0x4f09('0x52')][_0x4f09('0x10e')](db['OpenchannelQueue'],{'onDelete':_0x4f09('0x167'),'foreignKey':_0x4f09('0x17a')});db[_0x4f09('0x52')][_0x4f09('0x10e')](db[_0x4f09('0x12f')],{'onDelete':_0x4f09('0x167'),'foreignKey':_0x4f09('0x179')});db[_0x4f09('0x52')][_0x4f09('0x10e')](db[_0x4f09('0x7b')],{'onDelete':_0x4f09('0x167'),'foreignKey':_0x4f09('0x142')});db[_0x4f09('0x52')][_0x4f09('0x10e')](db['Tag'],{'onDelete':_0x4f09('0x167'),'foreignKey':'TagId'});db[_0x4f09('0x54')][_0x4f09('0x101')](db[_0x4f09('0x17b')],{'as':_0x4f09('0x149'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x17c')});db[_0x4f09('0x54')][_0x4f09('0x10e')](db[_0x4f09('0x12f')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x179')});db[_0x4f09('0x54')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x54')]['belongsTo'](db[_0x4f09('0x12')],{'as':'Owner','foreignKey':_0x4f09('0x100')});db[_0x4f09('0x54')][_0x4f09('0x111')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x4f09('0x161')});db['OpenchannelInteraction'][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':_0x4f09('0x17d'),'as':_0x4f09('0x163')});db['OpenchannelInteraction']['belongsToMany'](db[_0x4f09('0x12')],{'as':'Users','through':_0x4f09('0x11c'),'foreignKey':'OpenchannelInteractionId'});db[_0x4f09('0x17b')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x12')});db[_0x4f09('0x17b')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x150')});db[_0x4f09('0x17b')][_0x4f09('0x10e')](db['OpenchannelInteraction'],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x166'),'foreignKey':_0x4f09('0x17c')});db[_0x4f09('0x17b')][_0x4f09('0x10e')](db[_0x4f09('0xdd')],{'as':_0x4f09('0xdd'),'foreignKey':'AttachmentId'});db[_0x4f09('0x17b')]['belongsTo'](db[_0x4f09('0x12f')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x179')});db[_0x4f09('0x57')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db[_0x4f09('0x57')][_0x4f09('0x111')](db[_0x4f09('0xd8')],{'through':'team_has_openchannel_queues','as':_0x4f09('0x146')});db[_0x4f09('0x59')]['hasMany'](db[_0x4f09('0x77')],{'as':_0x4f09('0x171'),'foreignKey':_0x4f09('0x17e')});db[_0x4f09('0x59')]['hasMany'](db['CannedAnswer'],{'as':_0x4f09('0x156'),'foreignKey':_0x4f09('0x17e')});db[_0x4f09('0x59')][_0x4f09('0x101')](db[_0x4f09('0x62')],{'as':_0x4f09('0x17f')});db[_0x4f09('0x59')][_0x4f09('0x101')](db['ChatInteraction'],{'as':'Interactions'});db[_0x4f09('0x59')][_0x4f09('0x101')](db[_0x4f09('0x180')],{'as':_0x4f09('0x136')});db[_0x4f09('0x59')][_0x4f09('0x101')](db[_0x4f09('0x181')],{'as':_0x4f09('0x149')});db[_0x4f09('0x59')][_0x4f09('0x10e')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x159'),'foreignKey':'ListId'});db[_0x4f09('0x59')][_0x4f09('0x10e')](db[_0x4f09('0x7b')],{'as':'Interval','foreignKey':_0x4f09('0x142')});db[_0x4f09('0x59')][_0x4f09('0x10e')](db[_0x4f09('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x4f09('0x59')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':_0x4f09('0x12a')});db[_0x4f09('0x182')][_0x4f09('0x10e')](db[_0x4f09('0x12f')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x4f09('0xe7')],{'as':'List','foreignKey':_0x4f09('0x15a')});db['OpenchannelQueueReport'][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x182')][_0x4f09('0x10e')](db[_0x4f09('0x54')],{});db[_0x4f09('0x182')][_0x4f09('0x10e')](db[_0x4f09('0x17b')],{});db[_0x4f09('0x182')]['belongsTo'](db[_0x4f09('0x12')],{});db[_0x4f09('0x182')][_0x4f09('0x10e')](db[_0x4f09('0x57')],{});db['ChatApplication']['belongsTo'](db[_0x4f09('0x12')],{'as':_0x4f09('0x183'),'foreignKey':'UserId','onDelete':_0x4f09('0x167')});db[_0x4f09('0x180')][_0x4f09('0x10e')](db['ChatQueue'],{'as':'Queue','foreignKey':_0x4f09('0x184'),'onDelete':_0x4f09('0x167')});db['ChatApplication'][_0x4f09('0x10e')](db[_0x4f09('0x59')],{'as':_0x4f09('0x185'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0x4f09('0x180')][_0x4f09('0x10e')](db['Tag'],{'onDelete':_0x4f09('0x167'),'foreignKey':'TagId'});db[_0x4f09('0x5b')][_0x4f09('0x101')](db[_0x4f09('0x181')],{'as':_0x4f09('0x149'),'onDelete':'cascade','foreignKey':'ChatInteractionId'});db[_0x4f09('0x5b')][_0x4f09('0x10e')](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x4f09('0x5b')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x5b')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'as':_0x4f09('0x160'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x5b')][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':_0x4f09('0x186'),'as':'Tags'});db['ChatInteraction'][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':_0x4f09('0x186'),'as':'ThroughTags'});db[_0x4f09('0x5b')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':'Users','through':'user_has_chat_interactions','foreignKey':'ChatInteractionId'});db[_0x4f09('0x181')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x12')});db[_0x4f09('0x181')]['belongsTo'](db[_0x4f09('0x66')],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x150'),'foreignKey':'ContactId'});db['ChatMessage'][_0x4f09('0x10e')](db[_0x4f09('0x5b')],{'onDelete':'cascade','as':_0x4f09('0x166'),'foreignKey':'ChatInteractionId'});db[_0x4f09('0x181')][_0x4f09('0x10e')](db[_0x4f09('0xdd')],{'as':_0x4f09('0xdd'),'foreignKey':'AttachmentId'});db['ChatMessage'][_0x4f09('0x10e')](db[_0x4f09('0x59')],{'as':_0x4f09('0x15f'),'foreignKey':'ChatWebsiteId'});db[_0x4f09('0x5e')]['belongsTo'](db[_0x4f09('0x66')],{'onDelete':'cascade','as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x5e')][_0x4f09('0x10e')](db[_0x4f09('0x59')],{'as':'Account','foreignKey':_0x4f09('0x17e')});db[_0x4f09('0x5f')][_0x4f09('0x111')](db['User'],{'as':_0x4f09('0x145'),'through':_0x4f09('0x2d'),'hooks':!![]});db['ChatQueue'][_0x4f09('0x111')](db[_0x4f09('0xd8')],{'through':_0x4f09('0x187'),'as':'Teams'});db['ChatGroup'][_0x4f09('0x101')](db['ChatInternalMessage'],{'as':_0x4f09('0x149'),'foreignKey':'ChatGroupId','onDelete':_0x4f09('0xff')});db[_0x4f09('0x10f')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x139'),'through':_0x4f09('0x188')});db[_0x4f09('0x62')][_0x4f09('0x10e')](db[_0x4f09('0x59')],{'as':_0x4f09('0x185'),'foreignKey':_0x4f09('0x17e')});db['CmCompany'][_0x4f09('0x101')](db[_0x4f09('0x66')],{'as':_0x4f09('0x112'),'foreignKey':_0x4f09('0x189')});db[_0x4f09('0x66')][_0x4f09('0x101')](db[_0x4f09('0x68')],{'as':_0x4f09('0x13b'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x66')][_0x4f09('0x101')](db[_0x4f09('0x6b')],{'as':_0x4f09('0x104'),'foreignKey':_0x4f09('0x151')});db['CmContact']['hasMany'](db[_0x4f09('0x6d')],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0x4f09('0x66')][_0x4f09('0x101')](db[_0x4f09('0x6f')],{'as':_0x4f09('0x6f'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x66')][_0x4f09('0x101')](db[_0x4f09('0xc8')],{'as':_0x4f09('0x18a'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x66')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x4f09('0x106'),'foreignKey':_0x4f09('0x151'),'onDelete':_0x4f09('0x167')});db[_0x4f09('0x66')][_0x4f09('0x101')](db[_0x4f09('0x5b')],{'as':_0x4f09('0x107'),'foreignKey':_0x4f09('0x151'),'onDelete':_0x4f09('0x167')});db['CmContact'][_0x4f09('0x101')](db[_0x4f09('0x11a')],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x4f09('0x66')][_0x4f09('0x101')](db[_0x4f09('0x47')],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0x4f09('0x167')});db[_0x4f09('0x66')][_0x4f09('0x101')](db[_0x4f09('0x3b')],{'as':_0x4f09('0x109'),'foreignKey':_0x4f09('0x151'),'onDelete':_0x4f09('0x167')});db[_0x4f09('0x66')][_0x4f09('0x10e')](db['CmCompany'],{'as':_0x4f09('0x18b'),'foreignKey':'CompanyId'});db['CmContact'][_0x4f09('0x10e')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x159'),'foreignKey':'ListId','onDelete':_0x4f09('0xff')});db[_0x4f09('0x66')][_0x4f09('0x111')](db['User'],{'as':_0x4f09('0x164'),'through':_0x4f09('0x18c')});db['CmContact']['belongsToMany'](db['Tag'],{'as':_0x4f09('0x161'),'through':'cm_contact_has_tags'});db[_0x4f09('0x66')][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':_0x4f09('0x18d'),'as':'ThroughTags'});db[_0x4f09('0x68')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db['CmList'],{'as':_0x4f09('0x159'),'foreignKey':'ListId','onDelete':_0x4f09('0xff')});db['CmHopper'][_0x4f09('0x10e')](db['User'],{'as':_0x4f09('0x183'),'foreignKey':_0x4f09('0x100')});db[_0x4f09('0x68')]['belongsTo'](db[_0x4f09('0x1d')],{'as':_0x4f09('0x18e'),'foreignKey':_0x4f09('0x13a'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0x68')][_0x4f09('0x10e')](db[_0x4f09('0xda')],{'as':_0x4f09('0xda'),'foreignKey':_0x4f09('0x18f'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0x68')]['belongsTo'](db[_0x4f09('0x12')],{'as':_0x4f09('0x160'),'foreignKey':_0x4f09('0x190')});db[_0x4f09('0x69')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0x69')][_0x4f09('0x10e')](db[_0x4f09('0xe7')],{'as':'List','foreignKey':_0x4f09('0x15a'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0x69')]['belongsTo'](db[_0x4f09('0x1d')],{'as':_0x4f09('0x18e'),'foreignKey':_0x4f09('0x13a'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0x69')][_0x4f09('0x10e')](db[_0x4f09('0xda')],{'as':_0x4f09('0xda'),'foreignKey':_0x4f09('0x18f'),'onDelete':'cascade'});db[_0x4f09('0x191')][_0x4f09('0x101')](db[_0x4f09('0x79')],{'as':{'plural':_0x4f09('0x192'),'singular':_0x4f09('0x193')},'foreignKey':_0x4f09('0x194'),'onDelete':'cascade','hooks':!![]});db[_0x4f09('0x191')]['hasMany'](db[_0x4f09('0x79')],{'as':{'plural':'Any','singular':_0x4f09('0x195')},'foreignKey':_0x4f09('0x196'),'onDelete':_0x4f09('0xff'),'hooks':!![]});db[_0x4f09('0x191')]['hasMany'](db[_0x4f09('0x72')],{'as':_0x4f09('0x197'),'foreignKey':_0x4f09('0x198'),'onDelete':_0x4f09('0xff'),'hooks':!![]});db['Disposition']['hasMany'](db[_0x4f09('0x77')],{'as':_0x4f09('0x171'),'foreignKey':_0x4f09('0x199'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0x7b')][_0x4f09('0x101')](db[_0x4f09('0x7b')],{'as':_0x4f09('0x19a'),'foreignKey':_0x4f09('0x142'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x4f09('0x7b')][_0x4f09('0x101')](db['VoiceExtension'],{'as':_0x4f09('0x103'),'foreignKey':_0x4f09('0x142'),'onDelete':_0x4f09('0x167')});db[_0x4f09('0x7b')][_0x4f09('0x101')](db[_0x4f09('0x158')],{'as':_0x4f09('0x19b'),'foreignKey':_0x4f09('0x142')});db[_0x4f09('0x7b')][_0x4f09('0x101')](db[_0x4f09('0x180')],{'as':_0x4f09('0x19c'),'foreignKey':_0x4f09('0x142')});db[_0x4f09('0x7b')][_0x4f09('0x101')](db[_0x4f09('0x46')],{'as':'FaxApplications','foreignKey':'IntervalId'});db[_0x4f09('0x7b')][_0x4f09('0x101')](db[_0x4f09('0x4e')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0x4f09('0x19d')][_0x4f09('0x10e')](db['MailAccount'],{});db['Schedule'][_0x4f09('0x10e')](db['AnalyticDefaultReport'],{'foreignKey':_0x4f09('0x19e')});db['Schedule'][_0x4f09('0x10e')](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db[_0x4f09('0x137')][_0x4f09('0x111')](db[_0x4f09('0x1b')],{'as':_0x4f09('0x19f'),'through':'moh_has_sounds','onDelete':_0x4f09('0x167')});db[_0x4f09('0x82')][_0x4f09('0x111')](db[_0x4f09('0x66')],{'through':_0x4f09('0x18d')});db[_0x4f09('0x82')][_0x4f09('0x111')](db['ChatInteraction'],{'through':_0x4f09('0x186')});db[_0x4f09('0x82')][_0x4f09('0x111')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x4f09('0x82')]['belongsToMany'](db[_0x4f09('0x11a')],{'through':'sms_interaction_has_tags'});db[_0x4f09('0x82')][_0x4f09('0x111')](db[_0x4f09('0x47')],{'through':_0x4f09('0x16d')});db['Tag']['belongsToMany'](db[_0x4f09('0x54')],{'through':_0x4f09('0x17d')});db[_0x4f09('0x82')][_0x4f09('0x111')](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db[_0x4f09('0x85')][_0x4f09('0x101')](db[_0x4f09('0x79')],{'as':{'plural':_0x4f09('0x1a0'),'singular':_0x4f09('0x1a1')},'foreignKey':_0x4f09('0x1a2'),'onDelete':_0x4f09('0xff'),'hooks':!![]});db[_0x4f09('0x85')][_0x4f09('0x101')](db[_0x4f09('0x79')],{'as':{'plural':_0x4f09('0x1a3'),'singular':_0x4f09('0x1a4')},'foreignKey':_0x4f09('0x1a5'),'onDelete':_0x4f09('0xff'),'hooks':!![]});db['Trigger'][_0x4f09('0x101')](db['Action'],{'as':'Actions','foreignKey':_0x4f09('0x1a6'),'onDelete':_0x4f09('0xff'),'hooks':!![]});db['AnalyticCustomReport'][_0x4f09('0x101')](db[_0x4f09('0x90')],{'as':_0x4f09('0x1a7'),'onDelete':'cascade','foreignKey':_0x4f09('0x1a8'),'hooks':!![]});db[_0x4f09('0x8d')][_0x4f09('0x101')](db['AnalyticFieldReport'],{'as':_0x4f09('0x1a7'),'onDelete':'cascade','foreignKey':_0x4f09('0x19e')});db[_0x4f09('0x8f')][_0x4f09('0x101')](db[_0x4f09('0x90')],{'as':_0x4f09('0x1a7'),'onDelete':'cascade','foreignKey':'MetricId'});db['AnalyticFieldReport'][_0x4f09('0x10e')](db[_0x4f09('0x8f')],{'foreignKey':'MetricId'});db[_0x4f09('0x1a9')]['hasMany'](db['SalesforceConfiguration'],{'as':_0x4f09('0x1aa'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1ab')});db['SalesforceConfiguration'][_0x4f09('0x101')](db['SalesforceField'],{'as':'Subjects','onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0x94')][_0x4f09('0x101')](db[_0x4f09('0x95')],{'as':_0x4f09('0x1ad'),'onDelete':_0x4f09('0xff'),'foreignKey':'DescriptionId'});db['SalesforceConfiguration'][_0x4f09('0x101')](db[_0x4f09('0x95')],{'as':_0x4f09('0x1a7'),'onDelete':_0x4f09('0xff'),'foreignKey':'FieldId'});db[_0x4f09('0x94')][_0x4f09('0x10e')](db[_0x4f09('0x1a9')],{'as':'Account','foreignKey':'AccountId'});db[_0x4f09('0x95')][_0x4f09('0x101')](db[_0x4f09('0x95')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x4f09('0x95')]['hasMany'](db[_0x4f09('0x95')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x4f09('0x95')][_0x4f09('0x101')](db[_0x4f09('0x95')],{'as':_0x4f09('0x1ae'),'foreignKey':'FieldId'});db['SalesforceField'][_0x4f09('0x10e')](db[_0x4f09('0x1af')],{'as':_0x4f09('0x1af'),'foreignKey':'VariableId'});db[_0x4f09('0x97')]['hasMany'](db[_0x4f09('0x99')],{'as':_0x4f09('0x1aa'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0x99')]['hasMany'](db['SugarcrmField'],{'as':_0x4f09('0x1b0'),'onDelete':'cascade','foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0x99')][_0x4f09('0x101')](db[_0x4f09('0x9b')],{'as':_0x4f09('0x1ad'),'onDelete':_0x4f09('0xff'),'foreignKey':'DescriptionId'});db[_0x4f09('0x99')][_0x4f09('0x101')](db[_0x4f09('0x9b')],{'as':_0x4f09('0x1a7'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1b1')});db['SugarcrmConfiguration'][_0x4f09('0x10e')](db[_0x4f09('0x97')],{'as':'Account','foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0x9b')][_0x4f09('0x101')](db[_0x4f09('0x9b')],{'as':_0x4f09('0x1b2'),'foreignKey':'SubjectId'});db[_0x4f09('0x9b')][_0x4f09('0x101')](db[_0x4f09('0x9b')],{'as':_0x4f09('0x1b3'),'foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0x9b')][_0x4f09('0x101')](db[_0x4f09('0x9b')],{'as':_0x4f09('0x1ae'),'foreignKey':'FieldId'});db[_0x4f09('0x9b')][_0x4f09('0x10e')](db[_0x4f09('0x1af')],{'as':'Variable','foreignKey':_0x4f09('0x1b5')});db[_0x4f09('0x9d')]['hasMany'](db[_0x4f09('0x1b6')],{'as':_0x4f09('0x1aa'),'onDelete':_0x4f09('0xff'),'foreignKey':'AccountId'});db[_0x4f09('0x1b6')][_0x4f09('0x101')](db[_0x4f09('0x9e')],{'as':_0x4f09('0x1b0'),'onDelete':_0x4f09('0xff'),'foreignKey':'SubjectId'});db[_0x4f09('0x1b6')][_0x4f09('0x101')](db[_0x4f09('0x9e')],{'as':_0x4f09('0x1ad'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0x1b6')]['hasMany'](db[_0x4f09('0x9e')],{'as':_0x4f09('0x1a7'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1b1')});db[_0x4f09('0x1b6')][_0x4f09('0x10e')](db[_0x4f09('0x9d')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0x1b6')][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':'int_desk_configuration_has_tags'});db[_0x4f09('0x9e')][_0x4f09('0x101')](db[_0x4f09('0x9e')],{'as':_0x4f09('0x1b2'),'foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0x9e')][_0x4f09('0x101')](db[_0x4f09('0x9e')],{'as':_0x4f09('0x1b3'),'foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0x9e')]['hasMany'](db['DeskField'],{'as':_0x4f09('0x1ae'),'foreignKey':_0x4f09('0x1b1')});db[_0x4f09('0x9e')][_0x4f09('0x10e')](db[_0x4f09('0x1af')],{'as':_0x4f09('0x1af'),'foreignKey':_0x4f09('0x1b5')});db[_0x4f09('0x1b7')]['hasMany'](db[_0x4f09('0xa1')],{'as':_0x4f09('0x1aa'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0xa1')]['hasMany'](db[_0x4f09('0xa3')],{'as':_0x4f09('0x1b0'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x4f09('0xa1')][_0x4f09('0x101')](db['ZohoField'],{'as':_0x4f09('0x1ad'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0xa1')][_0x4f09('0x101')](db[_0x4f09('0xa3')],{'as':_0x4f09('0x1a7'),'onDelete':_0x4f09('0xff'),'foreignKey':'FieldId'});db[_0x4f09('0xa1')][_0x4f09('0x10e')](db[_0x4f09('0x1b7')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0xa3')]['hasMany'](db[_0x4f09('0xa3')],{'as':'Subject','foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0xa3')]['hasMany'](db['ZohoField'],{'as':_0x4f09('0x1b3'),'foreignKey':'DescriptionId'});db[_0x4f09('0xa3')][_0x4f09('0x101')](db[_0x4f09('0xa3')],{'as':_0x4f09('0x1ae'),'foreignKey':_0x4f09('0x1b1')});db[_0x4f09('0xa3')][_0x4f09('0x10e')](db['Variable'],{'as':'Variable','foreignKey':_0x4f09('0x1b5')});db[_0x4f09('0xa5')][_0x4f09('0x101')](db[_0x4f09('0x1b8')],{'as':_0x4f09('0x1aa'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1ab')});db['ZendeskConfiguration'][_0x4f09('0x101')](db[_0x4f09('0x1b9')],{'as':'Subjects','foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0x1b8')][_0x4f09('0x101')](db[_0x4f09('0x1b9')],{'as':_0x4f09('0x1ad'),'foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0x1b8')]['hasMany'](db[_0x4f09('0x1b9')],{'as':'Fields','foreignKey':_0x4f09('0x1b1')});db[_0x4f09('0x1b8')][_0x4f09('0x10e')](db[_0x4f09('0xa5')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0x1b8')][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':_0x4f09('0x1ba')});db[_0x4f09('0x1b9')][_0x4f09('0x101')](db[_0x4f09('0x1b9')],{'as':_0x4f09('0x1b2'),'foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0x1b9')][_0x4f09('0x101')](db[_0x4f09('0x1b9')],{'as':_0x4f09('0x1b3'),'foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0x1b9')][_0x4f09('0x101')](db[_0x4f09('0x1b9')],{'as':_0x4f09('0x1ae'),'foreignKey':'FieldId'});db[_0x4f09('0x1b9')]['belongsTo'](db[_0x4f09('0x1af')],{'as':'Variable','foreignKey':_0x4f09('0x1b5')});db[_0x4f09('0xa8')]['hasMany'](db[_0x4f09('0xa9')],{'as':'Configurations','onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1ab')});db['FreshdeskConfiguration']['hasMany'](db[_0x4f09('0xab')],{'as':_0x4f09('0x1b0'),'onDelete':_0x4f09('0xff'),'foreignKey':'SubjectId'});db[_0x4f09('0xa9')][_0x4f09('0x101')](db[_0x4f09('0xab')],{'as':_0x4f09('0x1ad'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0xa9')]['hasMany'](db[_0x4f09('0xab')],{'as':'Fields','onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1b1')});db[_0x4f09('0xa9')][_0x4f09('0x10e')](db[_0x4f09('0xa8')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0xa9')][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':_0x4f09('0x1bb')});db[_0x4f09('0xab')][_0x4f09('0x101')](db['FreshdeskField'],{'as':_0x4f09('0x1b2'),'foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0xab')][_0x4f09('0x101')](db[_0x4f09('0xab')],{'as':'Description','foreignKey':_0x4f09('0x1b4')});db['FreshdeskField'][_0x4f09('0x101')](db[_0x4f09('0xab')],{'as':'Field','foreignKey':_0x4f09('0x1b1')});db['FreshdeskField']['belongsTo'](db[_0x4f09('0x1af')],{'as':_0x4f09('0x1af'),'foreignKey':'VariableId'});db[_0x4f09('0xad')][_0x4f09('0x101')](db['VtigerConfiguration'],{'as':_0x4f09('0x1aa'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0xaf')][_0x4f09('0x101')](db[_0x4f09('0xb1')],{'as':'Subjects','foreignKey':_0x4f09('0x1ac')});db['VtigerConfiguration'][_0x4f09('0x101')](db[_0x4f09('0xb1')],{'as':_0x4f09('0x1ad'),'foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0xaf')][_0x4f09('0x101')](db[_0x4f09('0xb1')],{'as':_0x4f09('0x1a7'),'foreignKey':_0x4f09('0x1b1')});db[_0x4f09('0xaf')][_0x4f09('0x10e')](db[_0x4f09('0xad')],{'as':'Account','foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0xb1')][_0x4f09('0x101')](db[_0x4f09('0xb1')],{'as':_0x4f09('0x1b2'),'foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0xb1')]['hasMany'](db['VtigerField'],{'as':_0x4f09('0x1b3'),'foreignKey':'DescriptionId'});db[_0x4f09('0xb1')]['hasMany'](db['VtigerField'],{'as':_0x4f09('0x1ae'),'foreignKey':'FieldId'});db[_0x4f09('0xb1')][_0x4f09('0x10e')](db[_0x4f09('0x1af')],{'as':'Variable','foreignKey':_0x4f09('0x1b5')});db[_0x4f09('0xb3')][_0x4f09('0x101')](db[_0x4f09('0xb4')],{'as':'Configurations','onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1ab')});db['ServicenowConfiguration'][_0x4f09('0x101')](db[_0x4f09('0xb5')],{'as':_0x4f09('0x1b0'),'foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0xb4')]['hasMany'](db[_0x4f09('0xb5')],{'as':'Descriptions','foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0xb4')][_0x4f09('0x101')](db[_0x4f09('0xb5')],{'as':_0x4f09('0x1a7'),'foreignKey':_0x4f09('0x1b1')});db[_0x4f09('0xb4')][_0x4f09('0x10e')](db['ServicenowAccount'],{'as':_0x4f09('0x15f'),'foreignKey':'AccountId'});db[_0x4f09('0xb5')]['hasMany'](db[_0x4f09('0xb5')],{'as':_0x4f09('0x1b2'),'foreignKey':'SubjectId'});db['ServicenowField'][_0x4f09('0x101')](db[_0x4f09('0xb5')],{'as':_0x4f09('0x1b3'),'foreignKey':'DescriptionId'});db[_0x4f09('0xb5')][_0x4f09('0x101')](db[_0x4f09('0xb5')],{'as':_0x4f09('0x1ae'),'foreignKey':_0x4f09('0x1b1')});db['ServicenowField'][_0x4f09('0x10e')](db['Variable'],{'as':_0x4f09('0x1af'),'foreignKey':_0x4f09('0x1b5')});db['Dynamics365Account'][_0x4f09('0x101')](db['Dynamics365Configuration'],{'as':'Configurations','onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0xb8')][_0x4f09('0x101')](db['Dynamics365Field'],{'as':_0x4f09('0x1b0'),'onDelete':_0x4f09('0xff'),'foreignKey':'SubjectId'});db[_0x4f09('0xb8')]['hasMany'](db[_0x4f09('0xba')],{'as':_0x4f09('0x1ad'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0xb8')][_0x4f09('0x101')](db[_0x4f09('0xba')],{'as':'Fields','onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1b1')});db[_0x4f09('0xb8')][_0x4f09('0x10e')](db['Dynamics365Account'],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0xba')][_0x4f09('0x101')](db[_0x4f09('0xba')],{'as':_0x4f09('0x1b2'),'foreignKey':_0x4f09('0x1ac')});db['Dynamics365Field'][_0x4f09('0x101')](db[_0x4f09('0xba')],{'as':_0x4f09('0x1b3'),'foreignKey':_0x4f09('0x1b4')});db[_0x4f09('0xba')][_0x4f09('0x101')](db[_0x4f09('0xba')],{'as':'Field','foreignKey':_0x4f09('0x1b1')});db[_0x4f09('0xba')][_0x4f09('0x10e')](db['Variable'],{'as':'Variable','foreignKey':_0x4f09('0x1b5')});db[_0x4f09('0xbb')][_0x4f09('0x101')](db[_0x4f09('0xbd')],{'as':_0x4f09('0x1aa'),'onDelete':'cascade','foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0xbd')]['hasMany'](db[_0x4f09('0xbf')],{'as':_0x4f09('0x1b0'),'foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0xbd')]['hasMany'](db[_0x4f09('0xbf')],{'as':_0x4f09('0x1ad'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0x4f09('0x101')](db[_0x4f09('0xbf')],{'as':_0x4f09('0x1a7'),'foreignKey':_0x4f09('0x1b1')});db['FreshsalesConfiguration'][_0x4f09('0x10e')](db[_0x4f09('0xbb')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x1ab')});db[_0x4f09('0xbf')][_0x4f09('0x101')](db[_0x4f09('0xbf')],{'as':_0x4f09('0x1b2'),'foreignKey':_0x4f09('0x1ac')});db[_0x4f09('0xbf')][_0x4f09('0x101')](db['FreshsalesField'],{'as':'Description','foreignKey':_0x4f09('0x1b4')});db['FreshsalesField'][_0x4f09('0x101')](db[_0x4f09('0xbf')],{'as':'Field','foreignKey':_0x4f09('0x1b1')});db['FreshsalesField'][_0x4f09('0x10e')](db[_0x4f09('0x1af')],{'as':_0x4f09('0x1af'),'foreignKey':_0x4f09('0x1b5')});db['ChatQueueReport'][_0x4f09('0x10e')](db[_0x4f09('0x59')],{});db['ChatQueueReport'][_0x4f09('0x10e')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x159'),'foreignKey':_0x4f09('0x15a')});db[_0x4f09('0xc2')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0xc2')][_0x4f09('0x10e')](db[_0x4f09('0x5b')],{});db['ChatQueueReport'][_0x4f09('0x10e')](db[_0x4f09('0x181')],{});db[_0x4f09('0xc2')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{});db[_0x4f09('0xc2')][_0x4f09('0x10e')](db['ChatQueue'],{});db[_0x4f09('0xc3')]['belongsTo'](db[_0x4f09('0x12')],{'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1bc')});db[_0x4f09('0xc3')][_0x4f09('0x10e')](db['User'],{'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1bd')});db[_0x4f09('0xc8')][_0x4f09('0x101')](db[_0x4f09('0xc6')],{'foreignKey':'SessionId','onDelete':_0x4f09('0xff')});db[_0x4f09('0xc8')][_0x4f09('0x101')](db[_0x4f09('0x1be')],{'foreignKey':_0x4f09('0x1bf'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0xc9')][_0x4f09('0x10e')](db[_0x4f09('0x4c')],{});db[_0x4f09('0xc9')]['belongsTo'](db['CmList'],{'as':_0x4f09('0x159'),'foreignKey':_0x4f09('0x15a')});db[_0x4f09('0xc9')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':'ContactId'});db[_0x4f09('0xc9')][_0x4f09('0x10e')](db[_0x4f09('0x11a')],{});db['SmsQueueReport'][_0x4f09('0x10e')](db[_0x4f09('0x174')],{});db[_0x4f09('0xc9')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{});db[_0x4f09('0xc9')][_0x4f09('0x10e')](db[_0x4f09('0x51')],{});db['JscriptyProject'][_0x4f09('0x101')](db[_0x4f09('0xc8')],{'foreignKey':_0x4f09('0x1c0')});db['JscriptyProject'][_0x4f09('0x101')](db[_0x4f09('0xc6')],{'foreignKey':_0x4f09('0x1c0')});db['JscriptyProject'][_0x4f09('0x101')](db['JscriptyAnswerReport'],{'foreignKey':_0x4f09('0x1c0')});db['SquareProject'][_0x4f09('0x111')](db['User'],{'as':_0x4f09('0x164'),'through':_0x4f09('0x1c1')});db[_0x4f09('0xd8')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':'user_has_teams'});db[_0x4f09('0xd8')][_0x4f09('0x111')](db[_0x4f09('0x1d')],{'through':_0x4f09('0x1c2'),'as':_0x4f09('0x1c3')});db[_0x4f09('0xd8')][_0x4f09('0x111')](db[_0x4f09('0x38')],{'through':'team_has_mail_queues','as':_0x4f09('0x11f')});db[_0x4f09('0xd8')][_0x4f09('0x111')](db[_0x4f09('0x5f')],{'through':_0x4f09('0x187'),'as':_0x4f09('0x120')});db[_0x4f09('0xd8')][_0x4f09('0x111')](db[_0x4f09('0x4a')],{'through':_0x4f09('0x16f'),'as':_0x4f09('0x121')});db[_0x4f09('0xd8')][_0x4f09('0x111')](db[_0x4f09('0x51')],{'through':_0x4f09('0x178'),'as':_0x4f09('0x1c4')});db[_0x4f09('0xd8')]['belongsToMany'](db[_0x4f09('0x57')],{'through':_0x4f09('0x1c5'),'as':_0x4f09('0x124')});db[_0x4f09('0xd8')][_0x4f09('0x111')](db['WhatsappQueue'],{'through':_0x4f09('0x1c6'),'as':'WhatsappQueues'});db[_0x4f09('0xda')][_0x4f09('0x101')](db[_0x4f09('0x68')],{'as':_0x4f09('0x13b'),'foreignKey':_0x4f09('0x18f')});db[_0x4f09('0xda')][_0x4f09('0x101')](db[_0x4f09('0x6b')],{'as':_0x4f09('0x104'),'foreignKey':_0x4f09('0x18f')});db[_0x4f09('0xda')][_0x4f09('0x101')](db['CmHopperHistory'],{'as':_0x4f09('0x13c'),'foreignKey':_0x4f09('0x18f')});db[_0x4f09('0xda')][_0x4f09('0x101')](db[_0x4f09('0x69')],{'as':'HopperBlacks','foreignKey':_0x4f09('0x18f')});db['Campaign'][_0x4f09('0x10e')](db[_0x4f09('0x13e')],{'as':_0x4f09('0x13e'),'foreignKey':_0x4f09('0x13f')});db[_0x4f09('0xda')]['belongsTo'](db[_0x4f09('0x13e')],{'as':_0x4f09('0x140'),'foreignKey':'TrunkBackupId'});db[_0x4f09('0xda')][_0x4f09('0x10e')](db['Interval'],{'as':_0x4f09('0x7b'),'foreignKey':_0x4f09('0x142')});db[_0x4f09('0xda')][_0x4f09('0x10e')](db[_0x4f09('0xd3')],{'as':_0x4f09('0xd3'),'foreignKey':_0x4f09('0x1c7')});db['Campaign'][_0x4f09('0x111')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x113'),'through':_0x4f09('0x1c8')});db[_0x4f09('0xda')][_0x4f09('0x111')](db['CmList'],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db['MailTransferReport']['belongsTo'](db['MailMessage'],{});db[_0x4f09('0x1c9')][_0x4f09('0x10e')](db[_0x4f09('0x3b')],{});db[_0x4f09('0x1c9')]['belongsTo'](db[_0x4f09('0x36')],{'foreignKey':_0x4f09('0x1ca'),'as':'FromAccount'});db[_0x4f09('0x1c9')][_0x4f09('0x10e')](db['User'],{'foreignKey':_0x4f09('0x1cb'),'as':'FromAgent'});db[_0x4f09('0x1c9')][_0x4f09('0x10e')](db['User'],{'foreignKey':_0x4f09('0x1cc'),'as':_0x4f09('0x1cd')});db[_0x4f09('0x1c9')][_0x4f09('0x10e')](db[_0x4f09('0x38')],{'foreignKey':_0x4f09('0x1ce'),'as':_0x4f09('0x1cf')});db[_0x4f09('0x1c9')][_0x4f09('0x10e')](db[_0x4f09('0x36')],{'foreignKey':_0x4f09('0x1d0'),'as':'ToAccount'});db[_0x4f09('0xe0')][_0x4f09('0x10e')](db[_0x4f09('0x181')],{});db['ChatTransferReport'][_0x4f09('0x10e')](db[_0x4f09('0x5b')],{});db[_0x4f09('0xe0')][_0x4f09('0x10e')](db[_0x4f09('0x59')],{'foreignKey':_0x4f09('0x1d1'),'as':_0x4f09('0x1d2')});db[_0x4f09('0xe0')][_0x4f09('0x10e')](db['User'],{'foreignKey':_0x4f09('0x1cb'),'as':_0x4f09('0x1d3')});db[_0x4f09('0xe0')]['belongsTo'](db['User'],{'foreignKey':_0x4f09('0x1cc'),'as':_0x4f09('0x1cd')});db[_0x4f09('0xe0')][_0x4f09('0x10e')](db['ChatQueue'],{'foreignKey':_0x4f09('0x1d4'),'as':_0x4f09('0x1cf')});db[_0x4f09('0xe0')][_0x4f09('0x10e')](db[_0x4f09('0x59')],{'foreignKey':'ToChatWebsiteId','as':_0x4f09('0x1d5')});db['FaxTransferReport'][_0x4f09('0x10e')](db[_0x4f09('0x49')],{});db[_0x4f09('0x1d6')][_0x4f09('0x10e')](db[_0x4f09('0x47')],{});db['FaxTransferReport'][_0x4f09('0x10e')](db[_0x4f09('0x45')],{'foreignKey':_0x4f09('0x1d7'),'as':_0x4f09('0x1d2')});db[_0x4f09('0x1d6')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'foreignKey':_0x4f09('0x1cb'),'as':_0x4f09('0x1d3')});db[_0x4f09('0x1d6')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'foreignKey':_0x4f09('0x1cc'),'as':'ToAgent'});db['FaxTransferReport'][_0x4f09('0x10e')](db[_0x4f09('0x4a')],{'foreignKey':_0x4f09('0x1d8'),'as':_0x4f09('0x1cf')});db[_0x4f09('0x1d6')][_0x4f09('0x10e')](db[_0x4f09('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x4f09('0x1d5')});db[_0x4f09('0xe3')][_0x4f09('0x10e')](db[_0x4f09('0x17b')],{});db[_0x4f09('0xe3')][_0x4f09('0x10e')](db['OpenchannelInteraction'],{});db[_0x4f09('0xe3')][_0x4f09('0x10e')](db[_0x4f09('0x12f')],{'foreignKey':'FromOpenchannelAccountId','as':_0x4f09('0x1d2')});db[_0x4f09('0xe3')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'foreignKey':'FromUserId','as':_0x4f09('0x1d3')});db[_0x4f09('0xe3')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'foreignKey':_0x4f09('0x1cc'),'as':'ToAgent'});db['OpenchannelTransferReport']['belongsTo'](db[_0x4f09('0x57')],{'foreignKey':_0x4f09('0x1d9'),'as':_0x4f09('0x1cf')});db[_0x4f09('0xe3')][_0x4f09('0x10e')](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':_0x4f09('0x1d5')});db[_0x4f09('0xe5')][_0x4f09('0x10e')](db[_0x4f09('0x174')],{});db[_0x4f09('0xe5')][_0x4f09('0x10e')](db[_0x4f09('0x11a')],{});db[_0x4f09('0xe5')][_0x4f09('0x10e')](db[_0x4f09('0x4c')],{'foreignKey':'FromSmsAccountId','as':_0x4f09('0x1d2')});db[_0x4f09('0xe5')][_0x4f09('0x10e')](db['User'],{'foreignKey':_0x4f09('0x1cb'),'as':_0x4f09('0x1d3')});db[_0x4f09('0xe5')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'foreignKey':_0x4f09('0x1cc'),'as':_0x4f09('0x1cd')});db[_0x4f09('0xe5')][_0x4f09('0x10e')](db[_0x4f09('0x51')],{'foreignKey':_0x4f09('0x1da'),'as':'ToQueue'});db[_0x4f09('0xe5')][_0x4f09('0x10e')](db[_0x4f09('0x4c')],{'foreignKey':_0x4f09('0x1db'),'as':_0x4f09('0x1d5')});db['CmList']['hasMany'](db[_0x4f09('0x77')],{'as':_0x4f09('0x171'),'foreignKey':_0x4f09('0x15a')});db[_0x4f09('0xe7')][_0x4f09('0x101')](db[_0x4f09('0x71')],{'as':_0x4f09('0x1dc'),'foreignKey':_0x4f09('0x15a')});db['CmList'][_0x4f09('0x101')](db[_0x4f09('0x66')],{'as':_0x4f09('0x112'),'onDelete':_0x4f09('0xff'),'foreignKey':'ListId'});db[_0x4f09('0xe7')][_0x4f09('0x101')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'ListId'});db[_0x4f09('0xe7')][_0x4f09('0x101')](db[_0x4f09('0x6d')],{'as':_0x4f09('0x105'),'foreignKey':_0x4f09('0x15a')});db[_0x4f09('0xe7')]['hasMany'](db[_0x4f09('0x6f')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0x4f09('0xe7')][_0x4f09('0x111')](db[_0x4f09('0x1d')],{'as':_0x4f09('0x1dd'),'through':'voice_queues_has_cm_lists'});db[_0x4f09('0xe7')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':_0x4f09('0x114')});db['VoicePrefix'][_0x4f09('0x101')](db[_0x4f09('0x19')],{'as':_0x4f09('0x103'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0xe9')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':'user_has_voice_prefixes'});db[_0x4f09('0xeb')][_0x4f09('0x101')](db[_0x4f09('0x12')],{'as':_0x4f09('0x164'),'foreignKey':_0x4f09('0x1de')});db[_0x4f09('0xeb')]['hasMany'](db[_0x4f09('0x1df')],{'as':_0x4f09('0x1e0'),'foreignKey':_0x4f09('0x1de'),'onDelete':_0x4f09('0xff')});db['UserProfileSection']['hasMany'](db[_0x4f09('0x1e1')],{'as':_0x4f09('0x1e2'),'foreignKey':_0x4f09('0x1e3'),'onDelete':_0x4f09('0xff')});db[_0x4f09('0x131')][_0x4f09('0x101')](db[_0x4f09('0x77')],{'as':_0x4f09('0x171'),'foreignKey':_0x4f09('0x1e4')});db[_0x4f09('0x131')][_0x4f09('0x101')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x4f09('0x1e4')});db[_0x4f09('0x131')][_0x4f09('0x101')](db[_0x4f09('0xf3')],{'as':_0x4f09('0x149'),'foreignKey':_0x4f09('0x1e4')});db[_0x4f09('0x131')][_0x4f09('0x101')](db[_0x4f09('0x1e5')],{'as':_0x4f09('0x157')});db[_0x4f09('0x131')][_0x4f09('0x101')](db['WhatsappApplication'],{'as':_0x4f09('0x136')});db[_0x4f09('0x131')][_0x4f09('0x10e')](db[_0x4f09('0xe7')],{'as':_0x4f09('0x159'),'foreignKey':_0x4f09('0x15a')});db[_0x4f09('0x131')][_0x4f09('0x10e')](db[_0x4f09('0x7d')],{'as':_0x4f09('0x143'),'foreignKey':_0x4f09('0x15d')});db[_0x4f09('0x131')]['belongsToMany'](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':_0x4f09('0x1e6')});db[_0x4f09('0xf0')][_0x4f09('0x10e')](db['User'],{'onDelete':'restrict'});db[_0x4f09('0xf0')][_0x4f09('0x10e')](db[_0x4f09('0xf9')],{'onDelete':_0x4f09('0x167')});db[_0x4f09('0xf0')]['belongsTo'](db[_0x4f09('0x131')],{'onDelete':'restrict'});db[_0x4f09('0xf0')][_0x4f09('0x10e')](db[_0x4f09('0x7b')],{'onDelete':_0x4f09('0x167'),'foreignKey':'IntervalId'});db[_0x4f09('0xf0')]['belongsTo'](db['Tag'],{'onDelete':_0x4f09('0x167'),'foreignKey':_0x4f09('0x16b')});db[_0x4f09('0x1e5')][_0x4f09('0x101')](db[_0x4f09('0xf3')],{'as':_0x4f09('0x149'),'onDelete':_0x4f09('0xff'),'foreignKey':_0x4f09('0x1e7')});db['WhatsappInteraction'][_0x4f09('0x10e')](db[_0x4f09('0x131')],{'as':_0x4f09('0x15f'),'foreignKey':'WhatsappAccountId'});db[_0x4f09('0x1e5')][_0x4f09('0x10e')](db[_0x4f09('0x66')],{'as':_0x4f09('0x150'),'foreignKey':_0x4f09('0x151')});db[_0x4f09('0x1e5')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'as':'Owner','foreignKey':_0x4f09('0x100')});db[_0x4f09('0x1e5')][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':'whatsapp_interaction_has_tags','as':_0x4f09('0x161')});db[_0x4f09('0x1e5')][_0x4f09('0x111')](db[_0x4f09('0x82')],{'through':_0x4f09('0x1e8'),'as':'ThroughTags'});db[_0x4f09('0x1e5')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x164'),'through':_0x4f09('0x11d'),'foreignKey':_0x4f09('0x1e7')});db[_0x4f09('0xf3')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'as':_0x4f09('0x12')});db[_0x4f09('0xf3')][_0x4f09('0x10e')](db['CmContact'],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x150')});db[_0x4f09('0xf3')][_0x4f09('0x10e')](db[_0x4f09('0x1e5')],{'onDelete':_0x4f09('0xff'),'as':_0x4f09('0x166'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0x4f09('0x10e')](db[_0x4f09('0x131')],{'as':_0x4f09('0x15f'),'foreignKey':_0x4f09('0x1e4')});db[_0x4f09('0xf5')][_0x4f09('0x10e')](db[_0x4f09('0x131')],{});db[_0x4f09('0xf5')][_0x4f09('0x10e')](db['CmList'],{'as':_0x4f09('0x159'),'foreignKey':'ListId'});db[_0x4f09('0xf5')][_0x4f09('0x10e')](db['CmContact'],{'as':'Contact','foreignKey':_0x4f09('0x151')});db[_0x4f09('0xf5')][_0x4f09('0x10e')](db['WhatsappInteraction'],{});db['WhatsappQueueReport'][_0x4f09('0x10e')](db[_0x4f09('0xf9')],{});db[_0x4f09('0xf5')][_0x4f09('0x10e')](db[_0x4f09('0xf3')],{});db[_0x4f09('0xf5')][_0x4f09('0x10e')](db['User'],{});db['WhatsappTransferReport']['belongsTo'](db[_0x4f09('0xf3')],{});db[_0x4f09('0xf7')]['belongsTo'](db[_0x4f09('0x1e5')],{});db[_0x4f09('0xf7')][_0x4f09('0x10e')](db['WhatsappAccount'],{'foreignKey':_0x4f09('0x1e9'),'as':_0x4f09('0x1d2')});db['WhatsappTransferReport'][_0x4f09('0x10e')](db[_0x4f09('0x131')],{'foreignKey':_0x4f09('0x1ea'),'as':'ToAccount'});db[_0x4f09('0xf7')][_0x4f09('0x10e')](db[_0x4f09('0xf9')],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0x4f09('0xf7')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'foreignKey':_0x4f09('0x1cb'),'as':_0x4f09('0x1d3')});db[_0x4f09('0xf7')][_0x4f09('0x10e')](db[_0x4f09('0x12')],{'foreignKey':_0x4f09('0x1cc'),'as':'ToAgent'});db[_0x4f09('0xf9')][_0x4f09('0x111')](db[_0x4f09('0x12')],{'as':_0x4f09('0x145'),'through':_0x4f09('0x33'),'foreignKey':_0x4f09('0x1eb')});db[_0x4f09('0xf9')][_0x4f09('0x111')](db[_0x4f09('0xd8')],{'through':_0x4f09('0x1c6'),'as':_0x4f09('0x146')});module[_0x4f09('0x1ec')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 620eba3..b6b34a5 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x255f=['/api/pm2','./api/pm2','/api/webbar','./api/webbar','static','join','/apidoc','/www','root','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','password','apiKey','street','mobile','fax','email','clientId','clientSecret','code','accessKey','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace','}@@','includes','lodash','express','express-winston','util','./config/environment','./config/logger','api','auth','default','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','method','headers','x-forwarded-for','remoteAddress','url','statusCode','user','name','role','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','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','connection','responseTime','device','agent_name','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intServicenowAccount','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','./api/userNotification','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/authGoogle','/api/rpc','/api/version','./api/version','/api/system'];(function(_0xfbee3c,_0x3f0335){var _0xdfda61=function(_0x59c1cb){while(--_0x59c1cb){_0xfbee3c['push'](_0xfbee3c['shift']());}};_0xdfda61(++_0x3f0335);}(_0x255f,0x185));var _0xf255=function(_0x49c5d4,_0x26aba8){_0x49c5d4=_0x49c5d4-0x0;var _0x22143=_0x255f[_0x49c5d4];return _0x22143;};'use strict';var _=require(_0xf255('0x0'));var path=require('path');var express=require(_0xf255('0x1'));var ewinston=require(_0xf255('0x2'));var util=require(_0xf255('0x3'));var errors=require('./errors');var config=require(_0xf255('0x4'));var logger=require(_0xf255('0x5'))(_0xf255('0x6'));var authLogger=require(_0xf255('0x5'))(_0xf255('0x7'));exports[_0xf255('0x8')]=function(_0xc1d19f){_0xc1d19f['use'](ewinston[_0xf255('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x4b98fa,_0x481d8c){var _0x4a533f=_0xf255('0xa');if(!_['isEmpty'](_0x4b98fa[_0xf255('0xb')])){_0x4a533f+=_0xf255('0xc');var _0x4c6446=_0x4b98fa[_0xf255('0xb')];maskSensitiveData(_0x4c6446);}return util['format'](_0x4a533f,_0x4b98fa[_0xf255('0xd')],_0x4b98fa[_0xf255('0xe')][_0xf255('0xf')]?_0x4b98fa[_0xf255('0xe')][_0xf255('0xf')]:_0x4b98fa['connection'][_0xf255('0x10')]||_0x4b98fa['ip'],_0x4b98fa[_0xf255('0x11')],_0x481d8c[_0xf255('0x12')],_0x481d8c['responseTime'],_0x4b98fa[_0xf255('0x13')]?_0x4b98fa[_0xf255('0x13')]['id']:null,_0x4b98fa['user']?_0x4b98fa[_0xf255('0x13')][_0xf255('0x14')]:null,_0x4b98fa[_0xf255('0x13')]?_0x4b98fa['user'][_0xf255('0x15')]:null,_0x4c6446?util[_0xf255('0x16')](_0x4c6446,![],null):'');}}));_0xc1d19f[_0xf255('0x17')](ewinston[_0xf255('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x194e28,_0x4d9a07){var _0x4edad2=_0xf255('0x18');if(_0x194e28['body']&&_0x194e28[_0xf255('0xb')]['device']&&_0x194e28[_0xf255('0xb')][_0xf255('0x19')]){_0x4edad2=_0xf255('0x1a');}return util[_0xf255('0x1b')](_0x4edad2,_0x194e28[_0xf255('0xd')],_0x194e28[_0xf255('0xe')][_0xf255('0xf')]?_0x194e28[_0xf255('0xe')][_0xf255('0xf')]:_0x194e28[_0xf255('0x1c')][_0xf255('0x10')]||_0x194e28['ip'],_0x194e28['url'],_0x4d9a07[_0xf255('0x12')],_0x4d9a07[_0xf255('0x1d')],_0x194e28[_0xf255('0x13')]?_0x194e28[_0xf255('0x13')]['id']:null,_0x194e28[_0xf255('0x13')]?_0x194e28[_0xf255('0x13')][_0xf255('0x14')]:null,_0x194e28['user']?_0x194e28[_0xf255('0x13')][_0xf255('0x15')]:null,_0x194e28[_0xf255('0xb')]&&_0x194e28[_0xf255('0xb')][_0xf255('0x1e')]?_0x194e28[_0xf255('0xb')][_0xf255('0x1e')]:'other',_0x194e28[_0xf255('0xb')]&&_0x194e28['body']['agent_id']?_0x194e28[_0xf255('0xb')][_0xf255('0x19')]:'',_0x194e28[_0xf255('0xb')]&&_0x194e28[_0xf255('0xb')][_0xf255('0x1f')]?_0x194e28['body'][_0xf255('0x1f')]:'');},'ignoreRoute':function(_0x157397){var _0xdeaf7e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xdeaf7e['test'](_0x157397[_0xf255('0x11')]);}}));_0xc1d19f[_0xf255('0x17')](_0xf255('0x20'),require('./api/user'));_0xc1d19f[_0xf255('0x17')](_0xf255('0x21'),require(_0xf255('0x22')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x23'),require(_0xf255('0x24')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x25'),require(_0xf255('0x26')));_0xc1d19f[_0xf255('0x17')]('/api/voice/mohs',require(_0xf255('0x27')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x28'),require(_0xf255('0x29')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x2a'),require(_0xf255('0x2b')));_0xc1d19f[_0xf255('0x17')]('/api/screen/recordings',require(_0xf255('0x2c')));_0xc1d19f['use']('/api/voice/mails',require(_0xf255('0x2d')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x2e'),require(_0xf255('0x2f')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x30'),require(_0xf255('0x31')));_0xc1d19f['use'](_0xf255('0x32'),require(_0xf255('0x33')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x34'),require(_0xf255('0x35')));_0xc1d19f[_0xf255('0x17')]('/api/voice/queues/reports',require(_0xf255('0x36')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x37'),require(_0xf255('0x38')));_0xc1d19f[_0xf255('0x17')]('/api/trunks',require(_0xf255('0x39')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x3a'),require(_0xf255('0x3b')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x3c'),require('./api/mailServerOut'));_0xc1d19f[_0xf255('0x17')](_0xf255('0x3d'),require(_0xf255('0x3e')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x3f'),require('./api/mailQueue'));_0xc1d19f[_0xf255('0x17')](_0xf255('0x40'),require(_0xf255('0x41')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x42'),require(_0xf255('0x43')));_0xc1d19f[_0xf255('0x17')]('/api/mail/messages',require(_0xf255('0x44')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x45'),require('./api/mailApplication'));_0xc1d19f[_0xf255('0x17')]('/api/mail/reports/queue',require(_0xf255('0x46')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x47'),require(_0xf255('0x48')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x49'),require(_0xf255('0x4a')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x4b'),require(_0xf255('0x4c')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x4d'),require(_0xf255('0x4e')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x4f'),require(_0xf255('0x50')));_0xc1d19f[_0xf255('0x17')]('/api/fax/messages',require(_0xf255('0x51')));_0xc1d19f['use'](_0xf255('0x52'),require(_0xf255('0x53')));_0xc1d19f['use'](_0xf255('0x54'),require('./api/faxQueueReport'));_0xc1d19f[_0xf255('0x17')](_0xf255('0x55'),require('./api/smsAccount'));_0xc1d19f[_0xf255('0x17')]('/api/sms/applications',require('./api/smsApplication'));_0xc1d19f['use'](_0xf255('0x56'),require(_0xf255('0x57')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x58'),require('./api/smsMessage'));_0xc1d19f[_0xf255('0x17')](_0xf255('0x59'),require(_0xf255('0x5a')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x5b'),require('./api/openchannelAccount'));_0xc1d19f[_0xf255('0x17')](_0xf255('0x5c'),require(_0xf255('0x5d')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x5e'),require(_0xf255('0x5f')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x60'),require('./api/openchannelMessage'));_0xc1d19f['use']('/api/openchannel/queues',require(_0xf255('0x61')));_0xc1d19f['use']('/api/chat/websites',require(_0xf255('0x62')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x63'),require(_0xf255('0x64')));_0xc1d19f['use']('/api/chat/applications',require(_0xf255('0x65')));_0xc1d19f['use']('/api/chat/interactions',require(_0xf255('0x66')));_0xc1d19f['use'](_0xf255('0x67'),require(_0xf255('0x68')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x69'),require(_0xf255('0x6a')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x6b'),require(_0xf255('0x6c')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x6d'),require(_0xf255('0x6e')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x6f'),require(_0xf255('0x70')));_0xc1d19f[_0xf255('0x17')]('/api/cm/companies',require(_0xf255('0x71')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x72'),require(_0xf255('0x73')));_0xc1d19f[_0xf255('0x17')]('/api/cm/hopper',require('./api/cmHopper'));_0xc1d19f[_0xf255('0x17')](_0xf255('0x74'),require(_0xf255('0x75')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x76'),require(_0xf255('0x77')));_0xc1d19f[_0xf255('0x17')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0xc1d19f[_0xf255('0x17')](_0xf255('0x78'),require(_0xf255('0x79')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x7a'),require(_0xf255('0x7b')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x7c'),require(_0xf255('0x7d')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x7e'),require(_0xf255('0x7f')));_0xc1d19f[_0xf255('0x17')]('/api/dispositions',require(_0xf255('0x80')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x81'),require(_0xf255('0x82')));_0xc1d19f[_0xf255('0x17')]('/api/intervals',require(_0xf255('0x83')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x84'),require(_0xf255('0x85')));_0xc1d19f['use'](_0xf255('0x86'),require(_0xf255('0x87')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x88'),require(_0xf255('0x89')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x8a'),require(_0xf255('0x8b')));_0xc1d19f[_0xf255('0x17')]('/api/sounds',require(_0xf255('0x8c')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x8d'),require('./api/tag'));_0xc1d19f[_0xf255('0x17')]('/api/templates',require(_0xf255('0x8e')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x8f'),require(_0xf255('0x90')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x91'),require(_0xf255('0x92')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x93'),require('./api/integration'));_0xc1d19f['use'](_0xf255('0x94'),require(_0xf255('0x95')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x96'),require(_0xf255('0x97')));_0xc1d19f[_0xf255('0x17')]('/api/analytics/default_reports',require(_0xf255('0x98')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x99'),require(_0xf255('0x9a')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x9b'),require('./api/analyticMetric'));_0xc1d19f[_0xf255('0x17')](_0xf255('0x9c'),require(_0xf255('0x9d')));_0xc1d19f['use'](_0xf255('0x9e'),require('./api/analyticTreeReport'));_0xc1d19f['use']('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0xc1d19f[_0xf255('0x17')]('/api/integrations/salesforce/configurations',require(_0xf255('0x9f')));_0xc1d19f['use'](_0xf255('0xa0'),require(_0xf255('0xa1')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xa2'),require('./api/intSugarcrmAccount'));_0xc1d19f[_0xf255('0x17')](_0xf255('0xa3'),require(_0xf255('0xa4')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xa5'),require(_0xf255('0xa6')));_0xc1d19f[_0xf255('0x17')]('/api/integrations/desk/accounts',require(_0xf255('0xa7')));_0xc1d19f[_0xf255('0x17')]('/api/integrations/desk/configurations',require(_0xf255('0xa8')));_0xc1d19f['use'](_0xf255('0xa9'),require(_0xf255('0xaa')));_0xc1d19f[_0xf255('0x17')]('/api/integrations/zoho/accounts',require(_0xf255('0xab')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xac'),require(_0xf255('0xad')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xae'),require(_0xf255('0xaf')));_0xc1d19f['use'](_0xf255('0xb0'),require(_0xf255('0xb1')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xb2'),require(_0xf255('0xb3')));_0xc1d19f['use'](_0xf255('0xb4'),require('./api/intZendeskField'));_0xc1d19f[_0xf255('0x17')](_0xf255('0xb5'),require(_0xf255('0xb6')));_0xc1d19f['use'](_0xf255('0xb7'),require(_0xf255('0xb8')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xb9'),require(_0xf255('0xba')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xbb'),require(_0xf255('0xbc')));_0xc1d19f['use'](_0xf255('0xbd'),require(_0xf255('0xbe')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xbf'),require('./api/intVtigerField'));_0xc1d19f['use']('/api/integrations/servicenow/accounts',require(_0xf255('0xc0')));_0xc1d19f['use']('/api/integrations/servicenow/configurations',require(_0xf255('0xc1')));_0xc1d19f['use']('/api/integrations/servicenow/fields',require(_0xf255('0xc2')));_0xc1d19f['use'](_0xf255('0xc3'),require(_0xf255('0xc4')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xc5'),require('./api/intDynamics365Configuration'));_0xc1d19f['use']('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0xc1d19f[_0xf255('0x17')](_0xf255('0xc6'),require(_0xf255('0xc7')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xc8'),require('./api/intFreshsalesConfiguration'));_0xc1d19f['use'](_0xf255('0xc9'),require('./api/intFreshsalesField'));_0xc1d19f[_0xf255('0x17')](_0xf255('0xca'),require(_0xf255('0xcb')));_0xc1d19f['use'](_0xf255('0xcc'),require('./api/chatQueueReport'));_0xc1d19f['use'](_0xf255('0xcd'),require(_0xf255('0xce')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xcf'),require(_0xf255('0xd0')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xd1'),require(_0xf255('0xd2')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xd3'),require(_0xf255('0xd4')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xd5'),require(_0xf255('0xd6')));_0xc1d19f[_0xf255('0x17')]('/api/square/reports',require(_0xf255('0xd7')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xd8'),require(_0xf255('0xd9')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xda'),require('./api/jscriptyProject'));_0xc1d19f['use'](_0xf255('0xdb'),require(_0xf255('0xdc')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xdd'),require('./api/squareOdbc'));_0xc1d19f[_0xf255('0x17')](_0xf255('0xde'),require('./api/squareProject'));_0xc1d19f['use'](_0xf255('0xdf'),require(_0xf255('0xe0')));_0xc1d19f['use'](_0xf255('0xe1'),require(_0xf255('0xe2')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xe3'),require(_0xf255('0xe4')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xe5'),require('./api/license'));_0xc1d19f[_0xf255('0x17')](_0xf255('0xe6'),require(_0xf255('0xe7')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xe8'),require(_0xf255('0xe9')));_0xc1d19f[_0xf255('0x17')]('/api/attachments',require(_0xf255('0xea')));_0xc1d19f[_0xf255('0x17')]('/api/plugins',require('./api/plugin'));_0xc1d19f[_0xf255('0x17')](_0xf255('0xeb'),require('./api/mailTransferReport'));_0xc1d19f[_0xf255('0x17')](_0xf255('0xec'),require(_0xf255('0xed')));_0xc1d19f[_0xf255('0x17')]('/api/fax/reports/transfer',require(_0xf255('0xee')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xef'),require(_0xf255('0xf0')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xf1'),require('./api/smsTransferReport'));_0xc1d19f[_0xf255('0x17')](_0xf255('0xf2'),require(_0xf255('0xf3')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xf4'),require(_0xf255('0xf5')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xf6'),require('./api/userProfile'));_0xc1d19f['use']('/api/userProfile/sections',require(_0xf255('0xf7')));_0xc1d19f[_0xf255('0x17')](_0xf255('0xf8'),require(_0xf255('0xf9')));_0xc1d19f['use'](_0xf255('0xfa'),require(_0xf255('0xfb')));_0xc1d19f[_0xf255('0x17')]('/api/userNotifications',require(_0xf255('0xfc')));_0xc1d19f['use']('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0xc1d19f[_0xf255('0x17')](_0xf255('0xfd'),require(_0xf255('0xfe')));_0xc1d19f[_0xf255('0x17')]('/api/whatsapp/interactions',require(_0xf255('0xff')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x100'),require(_0xf255('0x101')));_0xc1d19f['use']('/api/whatsapp/reports/queue',require(_0xf255('0x102')));_0xc1d19f['use'](_0xf255('0x103'),require(_0xf255('0x104')));_0xc1d19f[_0xf255('0x17')]('/api/whatsapp/queues',require(_0xf255('0x105')));_0xc1d19f[_0xf255('0x17')](_0xf255('0x106'),require(_0xf255('0x107')));_0xc1d19f[_0xf255('0x17')]('/api/auth/local',require('./api/authLocal'));_0xc1d19f[_0xf255('0x17')]('/api/auth/google',require(_0xf255('0x108')));_0xc1d19f[_0xf255('0x17')]('/api/jira',require('./api/jira'));_0xc1d19f[_0xf255('0x17')](_0xf255('0x109'),require('./api/rpc'));_0xc1d19f[_0xf255('0x17')](_0xf255('0x10a'),require(_0xf255('0x10b')));_0xc1d19f['use'](_0xf255('0x10c'),require('./api/system'));_0xc1d19f[_0xf255('0x17')](_0xf255('0x10d'),require(_0xf255('0x10e')));_0xc1d19f['use'](_0xf255('0x10f'),require(_0xf255('0x110')));_0xc1d19f[_0xf255('0x17')]('/apidoc',express[_0xf255('0x111')](path[_0xf255('0x112')](config['root'],_0xf255('0x113'))));_0xc1d19f[_0xf255('0x17')](_0xf255('0x114'),express[_0xf255('0x111')](path[_0xf255('0x112')](config[_0xf255('0x115')],_0xf255('0x114'))));_0xc1d19f[_0xf255('0x17')](_0xf255('0x116'),express[_0xf255('0x111')](path['join'](config[_0xf255('0x115')],_0xf255('0x116'))));_0xc1d19f[_0xf255('0x17')](_0xf255('0x117'),express[_0xf255('0x111')](path[_0xf255('0x112')](config['root'],_0xf255('0x118'),_0xf255('0x119'))));_0xc1d19f['use'](_0xf255('0x11a'),express['static'](path[_0xf255('0x112')](config[_0xf255('0x115')],_0xf255('0x11b'))));_0xc1d19f[_0xf255('0x11c')](_0xf255('0x11d'))[_0xf255('0x11e')](errors[0x194]);_0xc1d19f[_0xf255('0x11c')]('/*')[_0xf255('0x11e')](function(_0x1de2eb,_0x218445){_0x218445[_0xf255('0x11f')](path[_0xf255('0x120')](_0xc1d19f['get'](_0xf255('0x121'))+_0xf255('0x122')));});};var sensitiveFields=['username',_0xf255('0x123'),'newPassword',_0xf255('0x124'),'firstName','lastName',_0xf255('0x125'),'phone',_0xf255('0x126'),_0xf255('0x127'),_0xf255('0x128'),_0xf255('0x129'),_0xf255('0x12a'),'securityToken',_0xf255('0x12b'),_0xf255('0x12c'),'tenantId','token',_0xf255('0x12d'),_0xf255('0x12e'),_0xf255('0x12f'),_0xf255('0x130'),_0xf255('0x131'),_0xf255('0x132'),_0xf255('0x133'),_0xf255('0x134'),_0xf255('0x135'),_0xf255('0x136'),_0xf255('0x137'),_0xf255('0x138'),_0xf255('0x139'),_0xf255('0x13a'),_0xf255('0x13b'),_0xf255('0x13c'),_0xf255('0x13'),'pass',_0xf255('0x13d'),_0xf255('0x13e'),_0xf255('0x13f'),_0xf255('0x140'),_0xf255('0x141'),_0xf255('0x142')];function maskSensitiveData(_0x46ceaf){var _0x5ca0ce=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x46ceaf))return;for(var _0x117eeb in _0x46ceaf){if(_[_0xf255('0x143')](_0x46ceaf[_0x117eeb])){for(var _0x41a5bb=0x0;_0x41a5bb<_0x46ceaf[_0x117eeb][_0xf255('0x144')];_0x41a5bb++){maskSensitiveData(_0x46ceaf[_0x117eeb][_0x41a5bb]);}}else if(_['isPlainObject'](_0x46ceaf[_0x117eeb])){maskSensitiveData(_0x46ceaf[_0x117eeb]);}else if(_[_0xf255('0x145')](_0x46ceaf[_0x117eeb])){_0x46ceaf[_0x117eeb]=_0x46ceaf[_0x117eeb]['replace'](/{{{/g,'@@{')[_0xf255('0x146')](/}}}/g,_0xf255('0x147'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0xf255('0x148')](sensitiveFields,_0x117eeb)){_0x46ceaf[_0x117eeb]=_0x46ceaf[_0x117eeb][_0xf255('0x146')](_0x5ca0ce,'*');}}}} \ No newline at end of file +var _0x9f3e=['./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReportDetail','/api/settings','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareMessage','/api/teams','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','./api/authGoogle','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','/www','root','/snippet','snippet','1.0.16','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','username','password','apiKey','lastName','street','phone','mobile','fax','email','clientId','clientSecret','code','accessKey','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','clientEmail','privateKey','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','isArray','length','isString','replace','@@{','}@@','includes','lodash','path','express','express-winston','util','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','user','inspect','device','agent_id','url','responseTime','role','agent_name','test','/api/users','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/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/fax/applications','/api/fax/interactions','/api/fax/messages','/api/fax/queues','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','/api/openchannel/queues','/api/chat/websites','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','./api/variable','./api/integration','/api/integrations/reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./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/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks'];(function(_0x570071,_0x17e08a){var _0x4f9196=function(_0x3d8473){while(--_0x3d8473){_0x570071['push'](_0x570071['shift']());}};_0x4f9196(++_0x17e08a);}(_0x9f3e,0x1c4));var _0xe9f3=function(_0x5c0d76,_0x293106){_0x5c0d76=_0x5c0d76-0x0;var _0x250a9b=_0x9f3e[_0x5c0d76];return _0x250a9b;};'use strict';var _=require(_0xe9f3('0x0'));var path=require(_0xe9f3('0x1'));var express=require(_0xe9f3('0x2'));var ewinston=require(_0xe9f3('0x3'));var util=require(_0xe9f3('0x4'));var errors=require('./errors');var config=require('./config/environment');var logger=require('./config/logger')(_0xe9f3('0x5'));var authLogger=require('./config/logger')(_0xe9f3('0x6'));exports[_0xe9f3('0x7')]=function(_0x46f926){_0x46f926[_0xe9f3('0x8')](ewinston[_0xe9f3('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1611eb,_0x407123){var _0x4014b1=_0xe9f3('0xa');if(!_[_0xe9f3('0xb')](_0x1611eb[_0xe9f3('0xc')])){_0x4014b1+=_0xe9f3('0xd');var _0x1f0989=_0x1611eb['body'];maskSensitiveData(_0x1f0989);}return util[_0xe9f3('0xe')](_0x4014b1,_0x1611eb[_0xe9f3('0xf')],_0x1611eb[_0xe9f3('0x10')][_0xe9f3('0x11')]?_0x1611eb[_0xe9f3('0x10')]['x-forwarded-for']:_0x1611eb[_0xe9f3('0x12')][_0xe9f3('0x13')]||_0x1611eb['ip'],_0x1611eb['url'],_0x407123[_0xe9f3('0x14')],_0x407123['responseTime'],_0x1611eb[_0xe9f3('0x15')]?_0x1611eb[_0xe9f3('0x15')]['id']:null,_0x1611eb[_0xe9f3('0x15')]?_0x1611eb['user']['name']:null,_0x1611eb[_0xe9f3('0x15')]?_0x1611eb[_0xe9f3('0x15')]['role']:null,_0x1f0989?util[_0xe9f3('0x16')](_0x1f0989,![],null):'');}}));_0x46f926[_0xe9f3('0x8')](ewinston[_0xe9f3('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x25abdc,_0x45cfd5){var _0x5a8ea2='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x25abdc[_0xe9f3('0xc')]&&_0x25abdc[_0xe9f3('0xc')][_0xe9f3('0x17')]&&_0x25abdc[_0xe9f3('0xc')][_0xe9f3('0x18')]){_0x5a8ea2='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xe9f3('0xe')](_0x5a8ea2,_0x25abdc[_0xe9f3('0xf')],_0x25abdc['headers'][_0xe9f3('0x11')]?_0x25abdc[_0xe9f3('0x10')][_0xe9f3('0x11')]:_0x25abdc[_0xe9f3('0x12')][_0xe9f3('0x13')]||_0x25abdc['ip'],_0x25abdc[_0xe9f3('0x19')],_0x45cfd5[_0xe9f3('0x14')],_0x45cfd5[_0xe9f3('0x1a')],_0x25abdc['user']?_0x25abdc[_0xe9f3('0x15')]['id']:null,_0x25abdc[_0xe9f3('0x15')]?_0x25abdc[_0xe9f3('0x15')]['name']:null,_0x25abdc[_0xe9f3('0x15')]?_0x25abdc[_0xe9f3('0x15')][_0xe9f3('0x1b')]:null,_0x25abdc['body']&&_0x25abdc['body'][_0xe9f3('0x17')]?_0x25abdc['body'][_0xe9f3('0x17')]:'other',_0x25abdc[_0xe9f3('0xc')]&&_0x25abdc[_0xe9f3('0xc')][_0xe9f3('0x18')]?_0x25abdc[_0xe9f3('0xc')][_0xe9f3('0x18')]:'',_0x25abdc[_0xe9f3('0xc')]&&_0x25abdc[_0xe9f3('0xc')]['agent_name']?_0x25abdc[_0xe9f3('0xc')][_0xe9f3('0x1c')]:'');},'ignoreRoute':function(_0x4f56de){var _0x1c13a6=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1c13a6[_0xe9f3('0x1d')](_0x4f56de[_0xe9f3('0x19')]);}}));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x1e'),require('./api/user'));_0x46f926['use'](_0xe9f3('0x1f'),require('./api/voiceChanSpy'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x20'),require(_0xe9f3('0x21')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x22'),require(_0xe9f3('0x23')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x24'),require(_0xe9f3('0x25')));_0x46f926[_0xe9f3('0x8')]('/api/voice/queues',require(_0xe9f3('0x26')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x27'),require(_0xe9f3('0x28')));_0x46f926['use'](_0xe9f3('0x29'),require(_0xe9f3('0x2a')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x2b'),require('./api/voiceMail'));_0x46f926['use'](_0xe9f3('0x2c'),require(_0xe9f3('0x2d')));_0x46f926['use'](_0xe9f3('0x2e'),require(_0xe9f3('0x2f')));_0x46f926['use'](_0xe9f3('0x30'),require('./api/voiceDialReport'));_0x46f926['use'](_0xe9f3('0x31'),require('./api/voiceAgentReport'));_0x46f926['use']('/api/voice/queues/reports',require(_0xe9f3('0x32')));_0x46f926[_0xe9f3('0x8')]('/api/members/reports',require(_0xe9f3('0x33')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x34'),require(_0xe9f3('0x35')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x36'),require('./api/voiceTransferReport'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x37'),require(_0xe9f3('0x38')));_0x46f926[_0xe9f3('0x8')]('/api/mail/accounts',require('./api/mailAccount'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x39'),require(_0xe9f3('0x3a')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x3b'),require(_0xe9f3('0x3c')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x3d'),require('./api/mailInteraction'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x3e'),require(_0xe9f3('0x3f')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x40'),require(_0xe9f3('0x41')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x42'),require(_0xe9f3('0x43')));_0x46f926['use'](_0xe9f3('0x44'),require(_0xe9f3('0x45')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x46'),require(_0xe9f3('0x47')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x48'),require(_0xe9f3('0x49')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x4a'),require('./api/faxApplication'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x4b'),require('./api/faxInteraction'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x4c'),require('./api/faxMessage'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x4d'),require('./api/faxQueue'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x4e'),require('./api/faxQueueReport'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x4f'),require(_0xe9f3('0x50')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x51'),require(_0xe9f3('0x52')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x53'),require('./api/smsInteraction'));_0x46f926['use']('/api/sms/messages',require(_0xe9f3('0x54')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x55'),require('./api/smsQueue'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x56'),require(_0xe9f3('0x57')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x58'),require(_0xe9f3('0x59')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x5a'),require('./api/openchannelInteraction'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x5b'),require('./api/openchannelMessage'));_0x46f926['use'](_0xe9f3('0x5c'),require('./api/openchannelQueue'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x5d'),require('./api/chatWebsite'));_0x46f926['use']('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x5e'),require(_0xe9f3('0x5f')));_0x46f926[_0xe9f3('0x8')]('/api/chat/interactions',require(_0xe9f3('0x60')));_0x46f926[_0xe9f3('0x8')]('/api/chat/messages',require('./api/chatMessage'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x61'),require(_0xe9f3('0x62')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x63'),require(_0xe9f3('0x64')));_0x46f926['use'](_0xe9f3('0x65'),require(_0xe9f3('0x66')));_0x46f926['use'](_0xe9f3('0x67'),require(_0xe9f3('0x68')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x69'),require(_0xe9f3('0x6a')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x6b'),require(_0xe9f3('0x6c')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x6d'),require('./api/cmHopper'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x6e'),require(_0xe9f3('0x6f')));_0x46f926['use'](_0xe9f3('0x70'),require(_0xe9f3('0x71')));_0x46f926[_0xe9f3('0x8')]('/api/cm/hopper_history',require(_0xe9f3('0x72')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x73'),require(_0xe9f3('0x74')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x75'),require(_0xe9f3('0x76')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x77'),require(_0xe9f3('0x78')));_0x46f926[_0xe9f3('0x8')]('/api/canned_answers',require(_0xe9f3('0x79')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x7a'),require(_0xe9f3('0x7b')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x7c'),require(_0xe9f3('0x7d')));_0x46f926['use'](_0xe9f3('0x7e'),require(_0xe9f3('0x7f')));_0x46f926[_0xe9f3('0x8')]('/api/pauses',require(_0xe9f3('0x80')));_0x46f926[_0xe9f3('0x8')]('/api/cdr',require('./api/cdr'));_0x46f926['use'](_0xe9f3('0x81'),require(_0xe9f3('0x82')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x83'),require(_0xe9f3('0x84')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x85'),require('./api/sound'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x86'),require(_0xe9f3('0x87')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x88'),require(_0xe9f3('0x89')));_0x46f926[_0xe9f3('0x8')]('/api/triggers',require(_0xe9f3('0x8a')));_0x46f926['use']('/api/variables',require(_0xe9f3('0x8b')));_0x46f926[_0xe9f3('0x8')]('/api/integrations',require(_0xe9f3('0x8c')));_0x46f926['use'](_0xe9f3('0x8d'),require('./api/integrationReport'));_0x46f926[_0xe9f3('0x8')]('/api/analytics/custom_reports',require(_0xe9f3('0x8e')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x8f'),require(_0xe9f3('0x90')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x91'),require(_0xe9f3('0x92')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x93'),require(_0xe9f3('0x94')));_0x46f926['use'](_0xe9f3('0x95'),require('./api/analyticFieldReport'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x96'),require(_0xe9f3('0x97')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x98'),require(_0xe9f3('0x99')));_0x46f926['use'](_0xe9f3('0x9a'),require(_0xe9f3('0x9b')));_0x46f926['use']('/api/integrations/salesforce/fields',require(_0xe9f3('0x9c')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x9d'),require(_0xe9f3('0x9e')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x9f'),require(_0xe9f3('0xa0')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xa1'),require(_0xe9f3('0xa2')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xa3'),require('./api/intDeskAccount'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xa4'),require(_0xe9f3('0xa5')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xa6'),require(_0xe9f3('0xa7')));_0x46f926[_0xe9f3('0x8')]('/api/integrations/zoho/accounts',require(_0xe9f3('0xa8')));_0x46f926[_0xe9f3('0x8')]('/api/integrations/zoho/configurations',require(_0xe9f3('0xa9')));_0x46f926[_0xe9f3('0x8')]('/api/integrations/zoho/fields',require(_0xe9f3('0xaa')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xab'),require(_0xe9f3('0xac')));_0x46f926['use'](_0xe9f3('0xad'),require(_0xe9f3('0xae')));_0x46f926[_0xe9f3('0x8')]('/api/integrations/zendesk/fields',require(_0xe9f3('0xaf')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xb0'),require(_0xe9f3('0xb1')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xb2'),require(_0xe9f3('0xb3')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xb4'),require('./api/intFreshdeskField'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xb5'),require(_0xe9f3('0xb6')));_0x46f926['use'](_0xe9f3('0xb7'),require(_0xe9f3('0xb8')));_0x46f926[_0xe9f3('0x8')]('/api/integrations/vtiger/fields',require(_0xe9f3('0xb9')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xba'),require(_0xe9f3('0xbb')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xbc'),require(_0xe9f3('0xbd')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xbe'),require(_0xe9f3('0xbf')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xc0'),require(_0xe9f3('0xc1')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xc2'),require(_0xe9f3('0xc3')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xc4'),require('./api/intDynamics365Field'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xc5'),require(_0xe9f3('0xc6')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xc7'),require(_0xe9f3('0xc8')));_0x46f926['use'](_0xe9f3('0xc9'),require(_0xe9f3('0xca')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xcb'),require(_0xe9f3('0xcc')));_0x46f926['use'](_0xe9f3('0xcd'),require(_0xe9f3('0xce')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xcf'),require(_0xe9f3('0xd0')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xd1'),require(_0xe9f3('0xd2')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xd3'),require(_0xe9f3('0xd4')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xd5'),require(_0xe9f3('0xd6')));_0x46f926['use'](_0xe9f3('0xd7'),require(_0xe9f3('0xd8')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xd9'),require('./api/squareReport'));_0x46f926['use']('/api/square/details/reports',require(_0xe9f3('0xda')));_0x46f926[_0xe9f3('0x8')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xdb'),require('./api/setting'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xdc'),require('./api/squareOdbc'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xdd'),require(_0xe9f3('0xde')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xdf'),require('./api/squareRecording'));_0x46f926[_0xe9f3('0x8')]('/api/square/messages',require(_0xe9f3('0xe0')));_0x46f926['use'](_0xe9f3('0xe1'),require('./api/team'));_0x46f926['use'](_0xe9f3('0xe2'),require(_0xe9f3('0xe3')));_0x46f926['use']('/api/campaigns',require(_0xe9f3('0xe4')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xe5'),require(_0xe9f3('0xe6')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xe7'),require(_0xe9f3('0xe8')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xe9'),require(_0xe9f3('0xea')));_0x46f926['use'](_0xe9f3('0xeb'),require(_0xe9f3('0xec')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xed'),require('./api/chatTransferReport'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xee'),require(_0xe9f3('0xef')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xf0'),require('./api/openchannelTransferReport'));_0x46f926['use']('/api/sms/reports/transfer',require(_0xe9f3('0xf1')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xf2'),require('./api/cmList'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xf3'),require(_0xe9f3('0xf4')));_0x46f926[_0xe9f3('0x8')]('/api/userProfiles',require('./api/userProfile'));_0x46f926[_0xe9f3('0x8')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x46f926[_0xe9f3('0x8')]('/api/userProfile/resources',require(_0xe9f3('0xf5')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xf6'),require(_0xe9f3('0xf7')));_0x46f926['use']('/api/userNotifications',require('./api/userNotification'));_0x46f926['use'](_0xe9f3('0xf8'),require(_0xe9f3('0xf9')));_0x46f926[_0xe9f3('0x8')]('/api/whatsapp/applications',require(_0xe9f3('0xfa')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xfb'),require('./api/whatsappInteraction'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xfc'),require('./api/whatsappMessage'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xfd'),require('./api/whatsappQueueReport'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0xfe'),require(_0xe9f3('0xff')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x100'),require(_0xe9f3('0x101')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x102'),require(_0xe9f3('0x103')));_0x46f926['use'](_0xe9f3('0x104'),require(_0xe9f3('0x105')));_0x46f926['use']('/api/auth/google',require(_0xe9f3('0x106')));_0x46f926['use']('/api/jira',require('./api/jira'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x107'),require(_0xe9f3('0x108')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x109'),require(_0xe9f3('0x10a')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x10b'),require(_0xe9f3('0x10c')));_0x46f926['use'](_0xe9f3('0x10d'),require('./api/pm2'));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x10e'),require(_0xe9f3('0x10f')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x110'),express[_0xe9f3('0x111')](path[_0xe9f3('0x112')](config['root'],'/apidoc')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x113'),express[_0xe9f3('0x111')](path[_0xe9f3('0x112')](config[_0xe9f3('0x114')],_0xe9f3('0x113'))));_0x46f926['use']('/demo',express[_0xe9f3('0x111')](path[_0xe9f3('0x112')](config['root'],'/demo')));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x115'),express[_0xe9f3('0x111')](path[_0xe9f3('0x112')](config[_0xe9f3('0x114')],_0xe9f3('0x116'),_0xe9f3('0x117'))));_0x46f926[_0xe9f3('0x8')](_0xe9f3('0x118'),express['static'](path[_0xe9f3('0x112')](config['root'],'/server/files/plugins')));_0x46f926[_0xe9f3('0x119')](_0xe9f3('0x11a'))[_0xe9f3('0x11b')](errors[0x194]);_0x46f926['route']('/*')[_0xe9f3('0x11b')](function(_0x2ec031,_0x52e7a9){_0x52e7a9[_0xe9f3('0x11c')](path[_0xe9f3('0x11d')](_0x46f926['get'](_0xe9f3('0x11e'))+_0xe9f3('0x11f')));});};var sensitiveFields=[_0xe9f3('0x120'),_0xe9f3('0x121'),'newPassword',_0xe9f3('0x122'),'firstName',_0xe9f3('0x123'),_0xe9f3('0x124'),_0xe9f3('0x125'),_0xe9f3('0x126'),_0xe9f3('0x127'),_0xe9f3('0x128'),_0xe9f3('0x129'),_0xe9f3('0x12a'),'securityToken',_0xe9f3('0x12b'),_0xe9f3('0x12c'),'tenantId',_0xe9f3('0x12d'),_0xe9f3('0x12e'),_0xe9f3('0x12f'),_0xe9f3('0x130'),_0xe9f3('0x131'),_0xe9f3('0x132'),_0xe9f3('0x133'),_0xe9f3('0x134'),_0xe9f3('0x135'),_0xe9f3('0x136'),_0xe9f3('0x137'),'vidaooApiKey',_0xe9f3('0x138'),_0xe9f3('0x139'),'accesskeyid',_0xe9f3('0x13a'),_0xe9f3('0x13b'),_0xe9f3('0x15'),_0xe9f3('0x13c'),_0xe9f3('0x13d'),_0xe9f3('0x13e'),_0xe9f3('0x13f'),_0xe9f3('0x140'),'registry','oldPassword'];function maskSensitiveData(_0x842e80){var _0x54950e=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x842e80))return;for(var _0x37c553 in _0x842e80){if(_[_0xe9f3('0x141')](_0x842e80[_0x37c553])){for(var _0x4024da=0x0;_0x4024da<_0x842e80[_0x37c553][_0xe9f3('0x142')];_0x4024da++){maskSensitiveData(_0x842e80[_0x37c553][_0x4024da]);}}else if(_['isPlainObject'](_0x842e80[_0x37c553])){maskSensitiveData(_0x842e80[_0x37c553]);}else if(_[_0xe9f3('0x143')](_0x842e80[_0x37c553])){_0x842e80[_0x37c553]=_0x842e80[_0x37c553][_0xe9f3('0x144')](/{{{/g,_0xe9f3('0x145'))[_0xe9f3('0x144')](/}}}/g,_0xe9f3('0x146'))[_0xe9f3('0x144')](/{{/g,'@{')[_0xe9f3('0x144')](/}}/g,'}@');if(_[_0xe9f3('0x147')](sensitiveFields,_0x37c553)){_0x842e80[_0x37c553]=_0x842e80[_0x37c553][_0xe9f3('0x144')](_0x54950e,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 6b75c0e..3781859 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x483b=['merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.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/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.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/cmHopper/cmHopper.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.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/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','server','http','rpc','port','error','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen'];(function(_0x4bf5f6,_0x44e324){var _0x21c97e=function(_0x4485a9){while(--_0x4485a9){_0x4bf5f6['push'](_0x4bf5f6['shift']());}};_0x21c97e(++_0x44e324);}(_0x483b,0x14c));var _0xb483=function(_0x53b8c2,_0x1bbec4){_0x53b8c2=_0x53b8c2-0x0;var _0x3ab260=_0x483b[_0x53b8c2];return _0x3ab260;};'use strict';var jayson=require(_0xb483('0x0'));var BPromise=require('bluebird');var _=require(_0xb483('0x1'));var config=require('../config/environment');exports[_0xb483('0x2')]=function(){return new BPromise(function(_0x2aadaf,_0x2d1401){var _0x1b6e6f={};_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require('../api/user/user.rpc'));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x4')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require('../api/voiceQueue/voiceQueue.rpc'));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x5')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x6')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x7')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x8')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x9')));_0x1b6e6f=_['merge'](_0x1b6e6f,require(_0xb483('0xa')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0xb')));_0x1b6e6f=_['merge'](_0x1b6e6f,require(_0xb483('0xc')));_0x1b6e6f=_['merge'](_0x1b6e6f,require(_0xb483('0xd')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0xe')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0xf')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x10')));_0x1b6e6f=_['merge'](_0x1b6e6f,require(_0xb483('0x11')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x12')));_0x1b6e6f=_['merge'](_0x1b6e6f,require(_0xb483('0x13')));_0x1b6e6f=_['merge'](_0x1b6e6f,require('../api/faxInteraction/faxInteraction.rpc'));_0x1b6e6f=_['merge'](_0x1b6e6f,require('../api/faxMessage/faxMessage.rpc'));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x14')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x15')));_0x1b6e6f=_['merge'](_0x1b6e6f,require(_0xb483('0x16')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require('../api/smsMessage/smsMessage.rpc'));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x17')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x18')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x19')));_0x1b6e6f=_['merge'](_0x1b6e6f,require(_0xb483('0x1a')));_0x1b6e6f=_['merge'](_0x1b6e6f,require(_0xb483('0x1b')));_0x1b6e6f=_['merge'](_0x1b6e6f,require(_0xb483('0x1c')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x1d')));_0x1b6e6f=_['merge'](_0x1b6e6f,require(_0xb483('0x1e')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x1f')));_0x1b6e6f=_['merge'](_0x1b6e6f,require('../api/cmContact/cmContact.rpc'));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x20')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x21')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x22')));_0x1b6e6f=_['merge'](_0x1b6e6f,require('../api/interval/interval.rpc'));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x23')));_0x1b6e6f=_['merge'](_0x1b6e6f,require(_0xb483('0x24')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x25')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x26')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x27')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x28')));_0x1b6e6f=_['merge'](_0x1b6e6f,require(_0xb483('0x29')));_0x1b6e6f=_['merge'](_0x1b6e6f,require(_0xb483('0x2a')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x2b')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x2c')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x2d')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x2e')));_0x1b6e6f=_['merge'](_0x1b6e6f,require(_0xb483('0x2f')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x30')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x31')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x32')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x33')));_0x1b6e6f=_['merge'](_0x1b6e6f,require(_0xb483('0x34')));_0x1b6e6f=_['merge'](_0x1b6e6f,require('../api/squareProject/squareProject.rpc'));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x35')));_0x1b6e6f=_['merge'](_0x1b6e6f,require(_0xb483('0x36')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x37')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require('../api/attachment/attachment.rpc'));_0x1b6e6f=_['merge'](_0x1b6e6f,require(_0xb483('0x38')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require(_0xb483('0x39')));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x1b6e6f=_['merge'](_0x1b6e6f,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x1b6e6f=_[_0xb483('0x3')](_0x1b6e6f,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x1b6e6f=_['merge'](_0x1b6e6f,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x3d7617=jayson[_0xb483('0x3a')](_0x1b6e6f)[_0xb483('0x3b')]();var _0xec3472=config[_0xb483('0x3c')][_0xb483('0x3d')]||config[_0xb483('0x3d')]+0x1;var _0x1d018e=config[_0xb483('0x3c')]['ip']||'localhost';_0x3d7617['on'](_0xb483('0x3e'),function(_0x5a0915){return _0x2d1401(_0x5a0915);});_0x3d7617[_0xb483('0x2')](_0xec3472,_0x1d018e,function(){console[_0xb483('0x3f')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x1d018e,_0xec3472);require(_0xb483('0x40'))[_0xb483('0x41')]();return _0x2aadaf(_0xb483('0x42')+_0x1d018e+':'+_0xec3472);});});}; \ No newline at end of file +var _0xcbaa=['Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.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/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.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/interval/interval.rpc','../api/pause/pause.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/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','log'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xcbaa,0x1a6));var _0xacba=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xcbaa[_0x3d42d8];return _0x27fc41;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xacba('0x0'));var _=require(_0xacba('0x1'));var config=require(_0xacba('0x2'));exports[_0xacba('0x3')]=function(){return new BPromise(function(_0x1f728b,_0x5dbe18){var _0x347b84={};_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x5')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x6')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x7')));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0x8')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x9')));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0xa')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0xb')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0xc')));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0xd')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0xe')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0xf')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x10')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x11')));_0x347b84=_['merge'](_0x347b84,require('../api/mailAccount/mailAccount.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x12')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x13')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x14')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x15')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x16')));_0x347b84=_['merge'](_0x347b84,require('../api/faxAccount/faxAccount.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x17')));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0x18')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x19')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x1a')));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0x1b')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/smsAccount/smsAccount.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x1c')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x1d')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/smsQueue/smsQueue.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x1e')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x1f')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x20')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x21')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x22')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x23')));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0x24')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x25')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x26')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x27')));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0x28')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x29')));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0x2a')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x2b')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/sound/sound.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/template/template.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/trigger/trigger.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x2c')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x2d')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x2e')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x2f')));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0x30')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x31')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x32')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x33')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0x34')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x35')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x36')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/squareOdbc/squareOdbc.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/squareProject/squareProject.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x37')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x38')));_0x347b84=_['merge'](_0x347b84,require('../api/campaign/campaign.rpc'));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0x39')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x3a')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x3b')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x347b84=_[_0xacba('0x4')](_0x347b84,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x347b84=_['merge'](_0x347b84,require(_0xacba('0x3c')));_0x347b84=_[_0xacba('0x4')](_0x347b84,require(_0xacba('0x3d')));var _0x1c5803=jayson[_0xacba('0x3e')](_0x347b84)[_0xacba('0x3f')]();var _0xf4346d=config[_0xacba('0x40')][_0xacba('0x41')]||config[_0xacba('0x41')]+0x1;var _0x16089f=config[_0xacba('0x40')]['ip']||'localhost';_0x1c5803['on'](_0xacba('0x42'),function(_0x5f090c){return _0x5dbe18(_0x5f090c);});_0x1c5803[_0xacba('0x3')](_0xf4346d,_0x16089f,function(){console[_0xacba('0x43')](_0xacba('0x44'),_0x16089f,_0xf4346d);require('../config/triggers')['default']();return _0x1f728b(_0xacba('0x45')+_0x16089f+':'+_0xf4346d);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index cb78327..4cde449 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 _0xe706=['wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','util','lodash','events','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','search','520\x20End\x20of\x20proper','function','substring','no\x20code','indexOf','startsWith','split','length','error','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','command','sync','answer','sendRequest','prototype','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile'];(function(_0x29d9d5,_0x5a1bd8){var _0x1be395=function(_0x54e84f){while(--_0x54e84f){_0x29d9d5['push'](_0x29d9d5['shift']());}};_0x1be395(++_0x5a1bd8);}(_0xe706,0xa3));var _0x6e70=function(_0x19dd8a,_0x449861){_0x19dd8a=_0x19dd8a-0x0;var _0x212ccc=_0xe706[_0x19dd8a];return _0x212ccc;};'use strict';var util=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIReply=require(_0x6e70('0x3'));var AGIError=require(_0x6e70('0x4'));function AGIChannel(_0x2ca810){var _0x7dfbc3=this,_0x142c27=new AGIReply(),_0x2164a4=![],_0x376a8d={};EventEmitter[_0x6e70('0x5')](_0x7dfbc3);_0x2ca810[_0x6e70('0x6')](_0x6e70('0x7'));_0x2ca810[_0x6e70('0x8')](0x8*0x3c*0x3c*0x3e8);_0x142c27[_0x6e70('0x6')](_0x6e70('0x7'));_0x142c27['on'](_0x6e70('0x9'),function(_0x3c4843){for(var _0x449b48 in _0x3c4843){_0x7dfbc3[_0x449b48]=_0x3c4843[_0x449b48];}_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0xb'));});_0x142c27['on'](_0x6e70('0xc'),function(_0x463853){if(_0x463853[_0x6e70('0xd')]()==_0x6e70('0xe')){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0xe'));return;}if(_0x463853['substring'](0x0,0xb)=='520-Invalid'){_0x2164a4=!![];}if(_0x2164a4){_0x376a8d['rx']+=_0x463853+'\x0a';if(_0x463853[_0x6e70('0xf')](_0x6e70('0x10'))!=-0x1){_0x2164a4=![];}}else{_0x376a8d['rx']=_0x463853;}if(_0x2164a4){return;}if(typeof _0x376a8d['cb']==_0x6e70('0x11')){var _0x27dd9b=_0x376a8d['rx'][_0x6e70('0x12')](0x0,0x3),_0x3b38f3=null,_0x310eb7=null;_0x27dd9b=parseInt(_0x27dd9b);if(isNaN(_0x27dd9b)){_0x376a8d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6e70('0x13')});return;}if(_0x27dd9b!=0xc8){_0x376a8d['cb'](null,{'code':_0x27dd9b,'result':-0x1,'extra':'KO'});return;}_0x3b38f3=_0x376a8d['rx']['substring'](0x4)['replace']('result=','');if(_0x3b38f3[_0x6e70('0x14')]('\x20')!=-0x1){_0x3b38f3=_0x3b38f3['substr'](0x0,_0x3b38f3['indexOf']('\x20'));}if(_[_0x6e70('0x15')](_0x3b38f3,'-1')){_0x3b38f3=parseInt(_0x3b38f3);}_0x310eb7=_0x376a8d['rx'][_0x6e70('0x16')]('\x20');if(_0x310eb7['length']==0x3){_0x310eb7=_0x310eb7[0x2][_0x6e70('0x12')](0x1,_0x310eb7[0x2]['length']-0x1);}else if(_0x310eb7[_0x6e70('0x17')]>0x3){var _0x161f23=/\((.+)\)/;var _0x4ca554=_0x376a8d['rx']['match'](_0x161f23);if(_0x4ca554){_0x310eb7=_0x4ca554[0x1];}else{_0x310eb7=null;}}else{_0x310eb7=null;}_0x376a8d['cb'](null,{'code':_0x27dd9b,'result':_0x3b38f3,'extra':_0x310eb7});}});_0x2ca810['on'](_0x6e70('0x18'),function(_0x5ea7a5){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x5ea7a5['code']));});_0x2ca810['on'](_0x6e70('0x19'),function(){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x19'),new AGIError(_0x6e70('0x1a')));});_0x2ca810['on'](_0x6e70('0x1b'),function(){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x1b'),new AGIError(_0x6e70('0x1c')));_0x2ca810[_0x6e70('0x1d')]();});_0x2ca810[_0x6e70('0x1e')](_0x142c27);this['command']=function(_0x228350,_0x344b65){var _0x228350=_0x228350||'',_0x344b65=typeof _0x344b65==_0x6e70('0x11')?_0x344b65:new Function();_0x376a8d={'tx':_0x228350,'rx':'','cb':_0x344b65};_0x2ca810[_0x6e70('0x1f')](_0x228350+'\x0a');},this[_0x6e70('0x19')]=function(){_0x2ca810['destroy']();};}util[_0x6e70('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x4e97c7){return this[_0x6e70('0x21')][_0x6e70('0x22')](this,_0x4e97c7);};AGIChannel['prototype'][_0x6e70('0x23')]=function(){return this[_0x6e70('0x24')]('ANSWER');};AGIChannel[_0x6e70('0x25')][_0x6e70('0x26')]=function(_0x2bb231,_0x4a67ac,_0x54a5fe){_0x2bb231=_0x2bb231===undefined?_0x6e70('0x27'):_0x2bb231;_0x4a67ac=_0x4a67ac===undefined?'5':_0x4a67ac;_0x54a5fe=_0x54a5fe===undefined?'1':_0x54a5fe;return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x29'),_0x2bb231,_0x4a67ac*0x3e8,_0x54a5fe));};AGIChannel[_0x6e70('0x25')]['noop']=function(_0x1952ea){_0x1952ea=_0x1952ea||_0x6e70('0x2a');return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x2b'),_0x1952ea));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x2c')]=function(_0x24114a,_0x3a0821){if(_[_0x6e70('0x2d')](_0x3a0821)){return this['sendRequest'](util[_0x6e70('0x28')]('EXEC\x20%s\x20%s',_0x24114a,_0x3a0821[_0x6e70('0x2e')](',')));}return this['sendRequest'](util[_0x6e70('0x28')](_0x6e70('0x2f'),_0x24114a,_0x3a0821));};AGIChannel[_0x6e70('0x25')]['setContext']=function(_0x38c40d){return this[_0x6e70('0x24')](util['format'](_0x6e70('0x30'),_0x38c40d));};AGIChannel[_0x6e70('0x25')]['setExtension']=function(_0x10d8f6){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x31'),_0x10d8f6));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x32')]=function(_0x44b19d){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x33'),_0x44b19d));};AGIChannel['prototype'][_0x6e70('0xe')]=function(){return this['sendRequest'](_0x6e70('0x34'));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x35')]=function(_0x32d12d,_0x233a83){var _0x989b80=_[_0x6e70('0x36')](_0x233a83)||_[_0x6e70('0x37')](_0x233a83)?_0x233a83[_0x6e70('0x38')]():_0x233a83;return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x39'),_0x32d12d,_0x989b80?_0x989b80[_0x6e70('0x38')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x155a46,_0x3841a0){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3a'),_0x155a46,_0x3841a0));};AGIChannel[_0x6e70('0x25')]['sayDigits']=function(_0x3b508c,_0x9e7ad2){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3b'),_0x3b508c,_0x9e7ad2));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x3c')]=function(_0x16fc7d,_0x5be100){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3d'),_0x16fc7d,_0x5be100));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x3e')]=function(_0x1de947,_0x21b0e7,_0x4a8adc){_0x21b0e7=_0x21b0e7||this['extension'];_0x4a8adc=_0x4a8adc||0x1;this['setContext'](_0x1de947);this[_0x6e70('0x3f')](_0x21b0e7);this[_0x6e70('0x32')](_0x4a8adc);return this[_0x6e70('0x40')](util[_0x6e70('0x28')](_0x6e70('0x41'),_0x1de947,_0x21b0e7,_0x4a8adc));};AGIChannel['prototype'][_0x6e70('0x42')]=function(_0x2a58d7){return this[_0x6e70('0x24')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x2a58d7));};AGIChannel['prototype'][_0x6e70('0x43')]=function(_0x5cca5b,_0x42f49a,_0x39913a,_0x3fed21,_0x75a90d,_0x59c87d){_0x42f49a=_0x42f49a||_0x6e70('0x44');_0x39913a=_0x39913a||'';_0x3fed21=_0x3fed21===undefined?-0x1:_0x3fed21==='-1'?-0x1:_0x3fed21*0x3e8;_0x75a90d=_0x75a90d===undefined?'':'s='+_0x75a90d;_0x59c87d=_0x59c87d?'BEEP':'';return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x45'),_0x5cca5b,_0x42f49a,_0x39913a,_0x3fed21,_0x59c87d,_0x75a90d));};AGIChannel[_0x6e70('0x25')]['streamFile']=function(_0x291de6,_0x44b637){_0x44b637=_0x44b637||'';return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x46'),_0x291de6,_0x44b637));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x47')]=function(_0x552e7e){return this[_0x6e70('0x2c')](_0x6e70('0x48'),_0x552e7e);};AGIChannel[_0x6e70('0x25')][_0x6e70('0x49')]=function(_0x3f86cf){return this[_0x6e70('0x2c')](_0x6e70('0x4a'),_0x3f86cf);};AGIChannel['prototype'][_0x6e70('0x18')]=function(_0x50cdf1,_0x11794e){this[_0x6e70('0x40')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x50cdf1['id'],_0x50cdf1[_0x6e70('0x4b')],_0x11794e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6e70('0x4c')]=AGIChannel; \ No newline at end of file +var _0x70e0=['format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./error','setEncoding','utf8','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','substr','indexOf','length','match','error','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','sendRequest'];(function(_0x15ba03,_0x1996a1){var _0x5ed191=function(_0x4bc2f5){while(--_0x4bc2f5){_0x15ba03['push'](_0x15ba03['shift']());}};_0x5ed191(++_0x1996a1);}(_0x70e0,0x17b));var _0x070e=function(_0x3184ae,_0x34e9ba){_0x3184ae=_0x3184ae-0x0;var _0x2a6fee=_0x70e0[_0x3184ae];return _0x2a6fee;};'use strict';var util=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));var EventEmitter=require(_0x070e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x070e('0x3'));function AGIChannel(_0xee173){var _0x277d32=this,_0x2593e5=new AGIReply(),_0x5c90fc=![],_0x7bce9b={};EventEmitter['call'](_0x277d32);_0xee173[_0x070e('0x4')]('utf8');_0xee173['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2593e5['setEncoding'](_0x070e('0x5'));_0x2593e5['on'](_0x070e('0x6'),function(_0x604664){for(var _0x2611e6 in _0x604664){_0x277d32[_0x2611e6]=_0x604664[_0x2611e6];}_0x277d32[_0x070e('0x7')](_0x070e('0x8'));});_0x2593e5['on'](_0x070e('0x9'),function(_0x4e99e6){if(_0x4e99e6['toLowerCase']()==_0x070e('0xa')){_0x277d32[_0x070e('0x7')](_0x070e('0xa'));return;}if(_0x4e99e6[_0x070e('0xb')](0x0,0xb)==_0x070e('0xc')){_0x5c90fc=!![];}if(_0x5c90fc){_0x7bce9b['rx']+=_0x4e99e6+'\x0a';if(_0x4e99e6[_0x070e('0xd')](_0x070e('0xe'))!=-0x1){_0x5c90fc=![];}}else{_0x7bce9b['rx']=_0x4e99e6;}if(_0x5c90fc){return;}if(typeof _0x7bce9b['cb']==_0x070e('0xf')){var _0x39d2b9=_0x7bce9b['rx']['substring'](0x0,0x3),_0x5bf079=null,_0x2930b8=null;_0x39d2b9=parseInt(_0x39d2b9);if(isNaN(_0x39d2b9)){_0x7bce9b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x39d2b9!=0xc8){_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':-0x1,'extra':'KO'});return;}_0x5bf079=_0x7bce9b['rx'][_0x070e('0xb')](0x4)['replace']('result=','');if(_0x5bf079['indexOf']('\x20')!=-0x1){_0x5bf079=_0x5bf079[_0x070e('0x10')](0x0,_0x5bf079[_0x070e('0x11')]('\x20'));}if(_['startsWith'](_0x5bf079,'-1')){_0x5bf079=parseInt(_0x5bf079);}_0x2930b8=_0x7bce9b['rx']['split']('\x20');if(_0x2930b8[_0x070e('0x12')]==0x3){_0x2930b8=_0x2930b8[0x2][_0x070e('0xb')](0x1,_0x2930b8[0x2][_0x070e('0x12')]-0x1);}else if(_0x2930b8[_0x070e('0x12')]>0x3){var _0x5bc71e=/\((.+)\)/;var _0x49861b=_0x7bce9b['rx'][_0x070e('0x13')](_0x5bc71e);if(_0x49861b){_0x2930b8=_0x49861b[0x1];}else{_0x2930b8=null;}}else{_0x2930b8=null;}_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':_0x5bf079,'extra':_0x2930b8});}});_0xee173['on'](_0x070e('0x14'),function(_0x38f6e6){_0x277d32[_0x070e('0x7')](_0x070e('0x14'),new AGIError('E_AGI_SOCKET_ERROR',_0x38f6e6[_0x070e('0x15')]));});_0xee173['on'](_0x070e('0x16'),function(){_0x277d32[_0x070e('0x7')](_0x070e('0x16'),new AGIError(_0x070e('0x17')));});_0xee173['on']('timeout',function(){_0x277d32['emit']('timeout',new AGIError(_0x070e('0x18')));_0xee173[_0x070e('0x19')]();});_0xee173[_0x070e('0x1a')](_0x2593e5);this['command']=function(_0x5b184,_0x5dc5d2){var _0x5b184=_0x5b184||'',_0x5dc5d2=typeof _0x5dc5d2==_0x070e('0xf')?_0x5dc5d2:new Function();_0x7bce9b={'tx':_0x5b184,'rx':'','cb':_0x5dc5d2};_0xee173[_0x070e('0x1b')](_0x5b184+'\x0a');},this[_0x070e('0x16')]=function(){_0xee173[_0x070e('0x19')]();};}util[_0x070e('0x1c')](AGIChannel,EventEmitter);AGIChannel[_0x070e('0x1d')]['sendRequest']=function(_0x2f8055){return this[_0x070e('0x1e')][_0x070e('0x1f')](this,_0x2f8055);};AGIChannel['prototype'][_0x070e('0x20')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x070e('0x1d')][_0x070e('0x21')]=function(_0x41deb1,_0x1743cc,_0x4763c6){_0x41deb1=_0x41deb1===undefined?'beep':_0x41deb1;_0x1743cc=_0x1743cc===undefined?'5':_0x1743cc;_0x4763c6=_0x4763c6===undefined?'1':_0x4763c6;return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x24'),_0x41deb1,_0x1743cc*0x3e8,_0x4763c6));};AGIChannel[_0x070e('0x1d')][_0x070e('0x25')]=function(_0x28d7f2){_0x28d7f2=_0x28d7f2||_0x070e('0x26');return this[_0x070e('0x22')](util['format'](_0x070e('0x27'),_0x28d7f2));};AGIChannel[_0x070e('0x1d')][_0x070e('0x28')]=function(_0x56fc12,_0x5c5f0d){if(_[_0x070e('0x29')](_0x5c5f0d)){return this[_0x070e('0x22')](util[_0x070e('0x23')]('EXEC\x20%s\x20%s',_0x56fc12,_0x5c5f0d[_0x070e('0x2a')](',')));}return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2b'),_0x56fc12,_0x5c5f0d));};AGIChannel['prototype']['setContext']=function(_0x523b75){return this['sendRequest'](util[_0x070e('0x23')]('SET\x20CONTEXT\x20%s',_0x523b75));};AGIChannel[_0x070e('0x1d')][_0x070e('0x2c')]=function(_0x4f8130){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x2d'),_0x4f8130));};AGIChannel['prototype']['setPriority']=function(_0x41ade4){return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2e'),_0x41ade4));};AGIChannel[_0x070e('0x1d')]['hangup']=function(){return this['sendRequest'](_0x070e('0x2f'));};AGIChannel[_0x070e('0x1d')][_0x070e('0x30')]=function(_0xf57ed,_0xf11439){var _0x4deaf8=_[_0x070e('0x31')](_0xf11439)||_[_0x070e('0x32')](_0xf11439)?_0xf11439['toString']():_0xf11439;return this[_0x070e('0x22')](util[_0x070e('0x23')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xf57ed,_0x4deaf8?_0x4deaf8['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x070e('0x1d')][_0x070e('0x33')]=function(_0x39dfaa,_0x334733){return this[_0x070e('0x22')](util['format'](_0x070e('0x34'),_0x39dfaa,_0x334733));};AGIChannel[_0x070e('0x1d')][_0x070e('0x35')]=function(_0x487276,_0x268c5d){return this[_0x070e('0x22')](util[_0x070e('0x23')]('SAY\x20DIGITS\x20%s\x20%s',_0x487276,_0x268c5d));};AGIChannel[_0x070e('0x1d')][_0x070e('0x36')]=function(_0x4800a9,_0x173602){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x37'),_0x4800a9,_0x173602));};AGIChannel[_0x070e('0x1d')][_0x070e('0x38')]=function(_0xd03404,_0x47b929,_0xd18220){_0x47b929=_0x47b929||this['extension'];_0xd18220=_0xd18220||0x1;this['setContext'](_0xd03404);this[_0x070e('0x2c')](_0x47b929);this[_0x070e('0x39')](_0xd18220);return this[_0x070e('0x25')](util['format'](_0x070e('0x3a'),_0xd03404,_0x47b929,_0xd18220));};AGIChannel[_0x070e('0x1d')][_0x070e('0x3b')]=function(_0x7dc240){return this['sendRequest'](util[_0x070e('0x23')]('GET\x20VARIABLE\x20\x22%s\x22',_0x7dc240));};AGIChannel['prototype']['recordFile']=function(_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x34f23e,_0x562aa4){_0x926533=_0x926533||_0x070e('0x3c');_0x26b3e2=_0x26b3e2||'';_0x29dccd=_0x29dccd===undefined?-0x1:_0x29dccd==='-1'?-0x1:_0x29dccd*0x3e8;_0x34f23e=_0x34f23e===undefined?'':'s='+_0x34f23e;_0x562aa4=_0x562aa4?'BEEP':'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3d'),_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x562aa4,_0x34f23e));};AGIChannel['prototype']['streamFile']=function(_0x261a27,_0x5ee4b8){_0x5ee4b8=_0x5ee4b8||'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3e'),_0x261a27,_0x5ee4b8));};AGIChannel['prototype'][_0x070e('0x3f')]=function(_0x20a1ee){return this['exec']('AGI',_0x20a1ee);};AGIChannel[_0x070e('0x1d')][_0x070e('0x40')]=function(_0x2d43ce){return this[_0x070e('0x28')](_0x070e('0x41'),_0x2d43ce);};AGIChannel['prototype'][_0x070e('0x14')]=function(_0x3f6c64,_0x427fa7){this[_0x070e('0x25')](util[_0x070e('0x23')](_0x070e('0x42'),_0x3f6c64['id'],_0x3f6c64[_0x070e('0x43')],_0x427fa7));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x070e('0x44')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index a49d454..f713cd8 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 _0x38ca=['util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name','exports'];(function(_0x2886e2,_0x95fe23){var _0x267ec6=function(_0x539da4){while(--_0x539da4){_0x2886e2['push'](_0x2886e2['shift']());}};_0x267ec6(++_0x95fe23);}(_0x38ca,0xb0));var _0xa38c=function(_0x592b99,_0x9dce93){_0x592b99=_0x592b99-0x0;var _0x282cd3=_0x38ca[_0x592b99];return _0x282cd3;};'use strict';var util=require(_0xa38c('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xa38c('0x1'),'E_AGI_SERVER_ERROR':_0xa38c('0x2'),'E_AGI_SERVER_CLOSE':_0xa38c('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xa38c('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xa38c('0x5'),'E_AGI_SOCKET_CLOSE':_0xa38c('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xa38c('0x7'),'E_AGI_COMMAND_EMPTY':_0xa38c('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xa38c('0x9')};function AGIError(_0x4487ef){var _0x4487ef=_0x4487ef||null,_0x5d9cb3=_0x5d9cb3||[],_0x36830c=0x1,_0x2b1a3e='';if(!error[_0x4487ef]){_0x4487ef=_0xa38c('0xa');}_0x5d9cb3['push'](error[_0x4487ef]);while(arguments[_0x36830c]){_0x5d9cb3[_0xa38c('0xb')](arguments[_0x36830c]);_0x36830c++;}_0x2b1a3e=util['format'][_0xa38c('0xc')](util,_0x5d9cb3);this[_0xa38c('0xd')]=_0x2b1a3e;this[_0xa38c('0xe')]=_0x4487ef;}module[_0xa38c('0xf')]=AGIError; \ No newline at end of file +var _0x95f7=['Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.'];(function(_0x50dcf3,_0x2b9138){var _0x486f98=function(_0x29c660){while(--_0x29c660){_0x50dcf3['push'](_0x50dcf3['shift']());}};_0x486f98(++_0x2b9138);}(_0x95f7,0x68));var _0x795f=function(_0x1d082e,_0xa116a1){_0x1d082e=_0x1d082e-0x0;var _0x27df12=_0x95f7[_0x1d082e];return _0x27df12;};'use strict';var util=require(_0x795f('0x0'));var error={'E_AGI_UNDEFINED':_0x795f('0x1'),'E_AGI_ARGUMENT_PORT':_0x795f('0x2'),'E_AGI_SERVER_ERROR':_0x795f('0x3'),'E_AGI_SERVER_CLOSE':_0x795f('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x795f('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x795f('0x6'),'E_AGI_SOCKET_CLOSE':_0x795f('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x795f('0x8'),'E_AGI_COMMAND_EMPTY':_0x795f('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x795f('0xa'),'E_AGI_IVR_ENTRY':_0x795f('0xb')};function AGIError(_0x1b4d8e){var _0x1b4d8e=_0x1b4d8e||null,_0x2749ec=_0x2749ec||[],_0x45371f=0x1,_0x547b6f='';if(!error[_0x1b4d8e]){_0x1b4d8e=_0x795f('0xc');}_0x2749ec[_0x795f('0xd')](error[_0x1b4d8e]);while(arguments[_0x45371f]){_0x2749ec[_0x795f('0xd')](arguments[_0x45371f]);_0x45371f++;}_0x547b6f=util[_0x795f('0xe')][_0x795f('0xf')](util,_0x2749ec);this[_0x795f('0x10')]=_0x547b6f;this[_0x795f('0x11')]=_0x1b4d8e;}module[_0x795f('0x12')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 5f9a440..78ac1f6 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 _0x705f=['no\x20vertex\x20found','info','length','no\x20edge/s\x20available','condition','agicommand','target','menu','invalid','vswitch','includes','max\x20retry\x20reach','condition\x20not\x20found','agi','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','push','size','relations','getVertex','traverseBFS'];(function(_0x149ec6,_0x2c04cc){var _0x11bfc4=function(_0x231f7f){while(--_0x231f7f){_0x149ec6['push'](_0x149ec6['shift']());}};_0x11bfc4(++_0x2c04cc);}(_0x705f,0x75));var _0xf705=function(_0x5dc927,_0x49f4a1){_0x5dc927=_0x5dc927-0x0;var _0x416440=_0x705f[_0x5dc927];return _0x416440;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0xf705('0x0'));var verticesWithRetry=['menu',_0xf705('0x1'),_0xf705('0x2')];var Graph=function(){this[_0xf705('0x3')]={};this[_0xf705('0x4')]={};this[_0xf705('0x5')]=0x0;};Graph[_0xf705('0x6')][_0xf705('0x7')]=function(_0x240742){this[_0xf705('0x3')][_0x240742['id']]=_0x240742;this[_0xf705('0x4')][_0x240742['id']]=[];};Graph[_0xf705('0x6')]['addEdge']=function(_0x51fda8,_0xc244e3,_0x58cae9){this[_0xf705('0x4')][_0x51fda8][_0xf705('0x8')]({'target':_0xc244e3,'condition':_0x58cae9});this['numberOfEdges']+=0x1;};Graph['prototype'][_0xf705('0x9')]=function(){return _[_0xf705('0x9')](this[_0xf705('0x3')]);};Graph[_0xf705('0x6')][_0xf705('0xa')]=function(){return this[_0xf705('0x5')];};Graph[_0xf705('0x6')][_0xf705('0xb')]=function(_0x4a92bb){return this[_0xf705('0x3')][_0x4a92bb];};Graph[_0xf705('0x6')][_0xf705('0xc')]=function(_0xf625da,_0x31e6f5){if(!this['vertices'][_0xf625da]){return logger['info'](_0xf705('0xd'));}var _0x10763f=_0x31e6f5(this[_0xf705('0x3')][_0xf625da]);if(!_0x10763f){return logger[_0xf705('0xe')]('stop\x20traverse');}if(this[_0xf705('0x4')][_0xf625da][_0xf705('0xf')]===0x0){return logger[_0xf705('0xe')](_0xf705('0x10'));}for(var _0x572efc=0x0,_0x11dcbc=[],_0x479b31=![];_0x572efc\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','calleridname','mxGraphModel','root','agicommand','hasOwnProperty','retry','omit','mxCell','isArray','length','source','target','addEdge','value','then','catch','createSquareReport','indexOf','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','evtHangup','hangup','sync','production','stringify','joinAt','[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','context','extension','priority','code','result','response','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','xml2json'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x24ca,0x1bc));var _0xa24c=function(_0x176317,_0x4897b3){_0x176317=_0x176317-0x0;var _0xef2759=_0x24ca[_0x176317];return _0xef2759;};'use strict';var parser=require(_0xa24c('0x0'));var _=require('lodash');var syncho=require(_0xa24c('0x1'));var util=require(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var config=require('../../config/environment');var logger=require(_0xa24c('0x4'))(_0xa24c('0x5'));var utilLicense=require(_0xa24c('0x6'));var rpc=require(_0xa24c('0x7'));var mailRpc=require(_0xa24c('0x8'));var Graph=require(_0xa24c('0x9'));var Vertices=require(_0xa24c('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xa24c('0x5')]=_[_0xa24c('0xb')](config[_0xa24c('0x5')],{'ip':_0xa24c('0xc'),'port':0x11dd});function connectionHandler(_0x481196){process[_0xa24c('0xd')](function(){syncho(function(){try{setChannelVariables(_0x481196);agiHandler(_0x481196);}catch(_0x3a5727){logger[_0xa24c('0xe')](_0x3a5727['stack']);}});});}function listeningHandler(){console[_0xa24c('0xf')](_0xa24c('0x10'),config[_0xa24c('0x5')][_0xa24c('0x11')]);logger[_0xa24c('0x12')](util[_0xa24c('0x13')](_0xa24c('0x14'),config[_0xa24c('0x5')]['ip'],config[_0xa24c('0x5')]['port']));}function errorHandler(_0x43bcd3){if(_0x43bcd3&&_0x43bcd3[_0xa24c('0x15')]&&_0x43bcd3[_0xa24c('0x16')]){logger[_0xa24c('0xe')](util['format'](_0xa24c('0x17'),_0x43bcd3[_0xa24c('0x15')],_0x43bcd3[_0xa24c('0x16')]));}else{logger[_0xa24c('0xe')](util[_0xa24c('0x13')](_0xa24c('0x18'),_0x43bcd3[_0xa24c('0x19')]));}}function closeHandler(){logger['info'](util['format'](_0xa24c('0x1a'),this[_0xa24c('0x1b')],this['calleridname'],this['callerid'],this[_0xa24c('0x1c')],this[_0xa24c('0x1d')]));try{createSquareReport(this);}catch(_0x5c479e){logger[_0xa24c('0xe')](_0x5c479e['stack']);}}function timeoutHandler(){logger[_0xa24c('0x12')](util[_0xa24c('0x13')](_0xa24c('0x1e'),this[_0xa24c('0x1b')],this['calleridname'],this[_0xa24c('0x1f')],this[_0xa24c('0x1c')],this[_0xa24c('0x1d')]));}function hangupHandler(){logger['info'](util['format']('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0xa24c('0x20')],this[_0xa24c('0x1f')],this[_0xa24c('0x1c')],this[_0xa24c('0x1d')]));this['evtHangup']=!![];}function getRoot(_0x30ec21){return parser['toJson'](_0x30ec21,{'object':!![]})[_0xa24c('0x21')][_0xa24c('0x22')];}function addVertex(_0x4a1cda,_0x346ee8,_0x363d52){_0x346ee8[_0xa24c('0x23')]=_0x363d52;if(_0x346ee8[_0xa24c('0x24')](_0xa24c('0x25'))){_0x346ee8['maxRetry']=parseInt(_0x346ee8[_0xa24c('0x25')],0xa);}_0x4a1cda['addVertex'](_[_0xa24c('0x26')](_0x346ee8,_0xa24c('0x27')));}function initGraph(_0x294685,_0x51dc3f){var _0x1beb55=new Graph();for(var _0x31c4d9 in _0x294685){if(_0x294685[_0xa24c('0x24')](_0x31c4d9)){if(_[_0xa24c('0x28')](_0x294685[_0x31c4d9])){for(var _0x11e4e0=0x0;_0x11e4e0<_0x294685[_0x31c4d9][_0xa24c('0x29')];_0x11e4e0+=0x1){addVertex(_0x1beb55,_0x294685[_0x31c4d9][_0x11e4e0],_0x31c4d9);}}else{addVertex(_0x1beb55,_0x294685[_0x31c4d9],_0x31c4d9);}}}for(var _0x39609a=0x0;_0x39609a<_0x51dc3f['length'];_0x39609a+=0x1){if(_0x51dc3f[_0x39609a][_0xa24c('0x2a')]&&_0x51dc3f[_0x39609a][_0xa24c('0x2b')]){_0x1beb55[_0xa24c('0x2c')](_0x51dc3f[_0x39609a][_0xa24c('0x2a')],_0x51dc3f[_0x39609a]['target'],_0x51dc3f[_0x39609a][_0xa24c('0x2d')]);}}return _0x1beb55;}function getSquareProject(_0xc96ce7,_0x97c08){rpc['getSquareProject'](_0xc96ce7)[_0xa24c('0x2e')](function(_0x3dcb1b){_0x97c08(null,_0x3dcb1b);})[_0xa24c('0x2f')](function(_0x4ae35c){_0x97c08(null,_0x4ae35c);});}function createSquareReport(_0x245fb2,_0x5e0226){rpc[_0xa24c('0x30')](_0x245fb2)[_0xa24c('0x2e')](function(_0x1a247b){if(_0x5e0226){_0x5e0226(null,_0x1a247b);}})['catch'](function(_0x1f52f8){if(_0x5e0226){_0x5e0226(null,_0x1f52f8);}});}function setChannelVariables(_0x53f90){for(var _0x1d0379 in _0x53f90){if(_0x53f90['hasOwnProperty'](_0x1d0379)){if(_0x1d0379[_0xa24c('0x31')]('agi_')===0x0){_0x53f90[_0x1d0379[_0xa24c('0x32')](0x4)]=_0x53f90[_0x1d0379];delete _0x53f90[_0x1d0379];}}}}function getLogFromObject(_0x42ba21){return util['inspect'](_0x42ba21,{'showHidden':![],'depth':null});}function agiHandler(_0x5680f5){var _0x20a276,_0x12670c,_0x182e86,_0x3c7522,_0x298dec;logger[_0xa24c('0x33')](_0xa24c('0x34'),JSON['stringify'](_0x5680f5,null,0x2));logger[_0xa24c('0x12')](util[_0xa24c('0x13')](_0xa24c('0x35'),_0x5680f5[_0xa24c('0x1b')],_0x5680f5[_0xa24c('0x20')],_0x5680f5[_0xa24c('0x1f')],_0x5680f5[_0xa24c('0x1c')],_0x5680f5[_0xa24c('0x1d')]));_0x5680f5['on'](_0xa24c('0xe'),errorHandler);_0x5680f5['on'](_0xa24c('0x36'),closeHandler);_0x5680f5['on']('timeout',timeoutHandler);_0x5680f5[_0xa24c('0x37')]=![];_0x5680f5['on'](_0xa24c('0x38'),hangupHandler);var _0x2b362d=getSquareProject[_0xa24c('0x39')](null,_0x5680f5['arg_1']);if(_0x2b362d){if(_0x2b362d['production']){_0x20a276=getRoot(_0x2b362d[_0xa24c('0x3a')]);if(_0x20a276&&_0x20a276['start']){logger[_0xa24c('0x33')](_0xa24c('0x22'),JSON[_0xa24c('0x3b')](_0x20a276,null,0x2));_0x5680f5[_0xa24c('0x3c')]=moment()[_0xa24c('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x12670c=initGraph(_['omit'](_0x20a276,_0xa24c('0x27')),_0x20a276[_0xa24c('0x27')]);_0x182e86=new Vertices(_0x5680f5,rpc,mailRpc);logger[_0xa24c('0x12')](util[_0xa24c('0x13')](_0xa24c('0x3d'),_0x5680f5[_0xa24c('0x1b')],_0x5680f5['calleridname'],_0x5680f5['callerid'],_0x5680f5[_0xa24c('0x1c')],_0x5680f5[_0xa24c('0x1d')]));_0x12670c[_0xa24c('0x3e')](_0x20a276[_0xa24c('0x3f')]['id'],function(_0x43beff){try{_0x43beff=_0x182e86['clear'](_0x43beff);logger[_0xa24c('0x33')](_0xa24c('0x40'),JSON['stringify'](_0x43beff,null,0x2));if(_0x43beff['agicommand']===_0xa24c('0x41')){logger[_0xa24c('0x12')](_0xa24c('0x42'));_0x5680f5['context']=_0x43beff['context']||_0x5680f5[_0xa24c('0x43')];_0x5680f5[_0xa24c('0x44')]=_0x43beff[_0xa24c('0x44')];_0x5680f5[_0xa24c('0x45')]=_0x43beff[_0xa24c('0x45')]?_0x43beff[_0xa24c('0x45')]-0x1:0x1;return null;}else if(_0x43beff&&_0x182e86[_0x43beff[_0xa24c('0x23')]]){_0x298dec=_0x182e86[_0x43beff[_0xa24c('0x23')]](_0x43beff);logger['info']('response',JSON[_0xa24c('0x3b')](_0x298dec,null,0x2));if(_0x298dec&&_0x298dec[_0xa24c('0x46')]===AGI_CODE_SUCCESS&&_0x298dec[_0xa24c('0x47')]!==AGI_RESULT_ERROR&&!_0x5680f5['evtHangup']){logger[_0xa24c('0x33')](_0xa24c('0x48'),getLogFromObject(_0x298dec));return _[_0xa24c('0x49')](_0x298dec[_0xa24c('0x47')])?null:_0x298dec[_0xa24c('0x47')][_0xa24c('0x4a')]();}else{logger[_0xa24c('0xe')](_0xa24c('0x48'),getLogFromObject(_0x298dec));return null;}}else{logger[_0xa24c('0xe')](_0xa24c('0x4b'));return null;}}catch(_0x4bbf93){logger[_0xa24c('0xe')](_0x4bbf93[_0xa24c('0x19')]);return null;}});if(_0x20a276[_0xa24c('0x4c')]){logger['info'](util[_0xa24c('0x13')](_0xa24c('0x4d'),_0x5680f5[_0xa24c('0x1b')],_0x5680f5[_0xa24c('0x20')],_0x5680f5[_0xa24c('0x1f')],_0x5680f5[_0xa24c('0x1c')],_0x5680f5[_0xa24c('0x1d')]));_0x12670c[_0xa24c('0x3e')](_0x20a276[_0xa24c('0x4c')]['id'],function(_0x10a15e){try{_0x10a15e=_0x182e86[_0xa24c('0x4e')](_0x10a15e);logger['debug'](_0xa24c('0x40'),JSON[_0xa24c('0x3b')](_0x10a15e,null,0x2));if(_0x10a15e&&_0x182e86[_0x10a15e[_0xa24c('0x23')]]){_0x298dec=_0x182e86[_0x10a15e[_0xa24c('0x23')]](_0x10a15e);if(_0x298dec){logger[_0xa24c('0x33')](_0xa24c('0x48'),getLogFromObject(_0x298dec));return _[_0xa24c('0x49')](_0x298dec[_0xa24c('0x47')])?null:_0x298dec[_0xa24c('0x47')]['toString']();}else{logger['error'](_0xa24c('0x48'),getLogFromObject(_0x298dec));return null;}}else{logger['error'](_0xa24c('0x4b'));return null;}}catch(_0x1f436c){logger['error'](_0x1f436c[_0xa24c('0x19')]);return null;}});}logger[_0xa24c('0x12')](util[_0xa24c('0x13')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5680f5['arg_1'],_0x5680f5[_0xa24c('0x20')],_0x5680f5['callerid'],_0x5680f5[_0xa24c('0x1c')],_0x5680f5[_0xa24c('0x1d')]));logger[_0xa24c('0x12')](util[_0xa24c('0x13')](_0xa24c('0x4f'),_0x5680f5[_0xa24c('0x43')],_0x5680f5[_0xa24c('0x44')],parseInt(_0x5680f5[_0xa24c('0x45')],0xa)+0x1));_0x5680f5[_0xa24c('0x50')](_0x5680f5[_0xa24c('0x43')],_0x5680f5['extension'],parseInt(_0x5680f5[_0xa24c('0x45')],0xa)+0x1);_0x5680f5[_0xa24c('0x36')]();}}else{logger[_0xa24c('0xe')](util['format']('Project\x20%s\x20not\x20published',_0x5680f5['arg_1']));_0x5680f5[_0xa24c('0x50')](_0x5680f5['context'],_0x5680f5[_0xa24c('0x44')],parseInt(_0x5680f5[_0xa24c('0x45')],0xa)+0x1);_0x5680f5['close']();}}else{logger[_0xa24c('0xe')](util[_0xa24c('0x13')](_0xa24c('0x51'),_0x5680f5[_0xa24c('0x1b')]));_0x5680f5[_0xa24c('0x50')](_0x5680f5[_0xa24c('0x43')],_0x5680f5[_0xa24c('0x44')],parseInt(_0x5680f5[_0xa24c('0x45')],0xa)+0x1);_0x5680f5['close']();}}function main(){var _0x172645;return utilLicense['getLicense']()['then'](function(_0x565f0a){if(_0x565f0a){if(_0x565f0a['voice']){if(_0x565f0a['callysquare']&&_0x565f0a[_0xa24c('0x52')]>0x0){logger['info'](util[_0xa24c('0x13')](_0xa24c('0x53'),_0x565f0a[_0xa24c('0x52')]));_0x172645=_0x565f0a[_0xa24c('0x52')];}else{logger[_0xa24c('0x12')](_0xa24c('0x54'));}}else{logger[_0xa24c('0x12')](_0xa24c('0x55'));_0x172645=-0x1;}}})[_0xa24c('0x2f')](function(_0x3de0e3){logger[_0xa24c('0xe')](_0xa24c('0x56'),_0x3de0e3[_0xa24c('0x19')]);})[_0xa24c('0x4c')](function(){var _0x136d6b=require('./server')(config[_0xa24c('0x5')][_0xa24c('0x11')],config['agi']['ip'],_0x172645);_0x136d6b['on'](_0xa24c('0xe'),errorHandler);_0x136d6b['on'](_0xa24c('0x57'),listeningHandler);_0x136d6b['on'](_0xa24c('0x58'),connectionHandler);_0x136d6b['on'](_0xa24c('0x36'),closeHandler);});}main(); \ No newline at end of file +var _0x4006=['catch','createSquareReport','indexOf','agi_','substring','variables','stringify','timeout','sync','production','start','debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','isUndefined','continueAt','close','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','lodash','syncho','util','moment','agi','./rpc','./vertices','defaults','127.0.0.1','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','root','agicommand','hasOwnProperty','retry','omit','isArray','length','source','addEdge','value','getSquareProject','then'];(function(_0x332a1b,_0x3744dd){var _0x2d1144=function(_0x24f4ad){while(--_0x24f4ad){_0x332a1b['push'](_0x332a1b['shift']());}};_0x2d1144(++_0x3744dd);}(_0x4006,0x1c7));var _0x6400=function(_0x654001,_0x4f073c){_0x654001=_0x654001-0x0;var _0x325731=_0x4006[_0x654001];return _0x325731;};'use strict';var parser=require('xml2json');var _=require(_0x6400('0x0'));var syncho=require(_0x6400('0x1'));var util=require(_0x6400('0x2'));var moment=require(_0x6400('0x3'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x6400('0x4'));var utilLicense=require('../../config/license/util');var rpc=require(_0x6400('0x5'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0x6400('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x6400('0x7')](config[_0x6400('0x4')],{'ip':_0x6400('0x8'),'port':0x11dd});function connectionHandler(_0x250dba){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x250dba);agiHandler(_0x250dba);}catch(_0x31cc99){logger[_0x6400('0x9')](_0x31cc99[_0x6400('0xa')]);}});});}function listeningHandler(){console[_0x6400('0xb')](_0x6400('0xc'),config[_0x6400('0x4')][_0x6400('0xd')]);logger[_0x6400('0xe')](util[_0x6400('0xf')](_0x6400('0x10'),config[_0x6400('0x4')]['ip'],config['agi'][_0x6400('0xd')]));}function errorHandler(_0x3a408e){if(_0x3a408e&&_0x3a408e[_0x6400('0x11')]&&_0x3a408e[_0x6400('0x12')]){logger['error'](util[_0x6400('0xf')](_0x6400('0x13'),_0x3a408e['name'],_0x3a408e['message']));}else{logger['error'](util[_0x6400('0xf')](_0x6400('0x14'),_0x3a408e['stack']));}}function closeHandler(){logger[_0x6400('0xe')](util['format'](_0x6400('0x15'),this['arg_1'],this[_0x6400('0x16')],this[_0x6400('0x17')],this[_0x6400('0x18')],this[_0x6400('0x19')]));try{createSquareReport(this);}catch(_0x49d412){logger[_0x6400('0x9')](_0x49d412[_0x6400('0xa')]);}}function timeoutHandler(){logger[_0x6400('0xe')](util['format'](_0x6400('0x1a'),this[_0x6400('0x1b')],this['calleridname'],this[_0x6400('0x17')],this[_0x6400('0x18')],this[_0x6400('0x19')]));}function hangupHandler(){logger['info'](util[_0x6400('0xf')](_0x6400('0x1c'),this[_0x6400('0x1b')],this[_0x6400('0x16')],this[_0x6400('0x17')],this[_0x6400('0x18')],this[_0x6400('0x19')]));this[_0x6400('0x1d')]=!![];}function getRoot(_0x22eb63){return parser[_0x6400('0x1e')](_0x22eb63,{'object':!![]})['mxGraphModel'][_0x6400('0x1f')];}function addVertex(_0x50c29e,_0x589b7c,_0x257d80){_0x589b7c[_0x6400('0x20')]=_0x257d80;if(_0x589b7c[_0x6400('0x21')](_0x6400('0x22'))){_0x589b7c['maxRetry']=parseInt(_0x589b7c[_0x6400('0x22')],0xa);}_0x50c29e['addVertex'](_[_0x6400('0x23')](_0x589b7c,'mxCell'));}function initGraph(_0x3bcb28,_0x246433){var _0x577156=new Graph();for(var _0x434550 in _0x3bcb28){if(_0x3bcb28[_0x6400('0x21')](_0x434550)){if(_[_0x6400('0x24')](_0x3bcb28[_0x434550])){for(var _0x56b285=0x0;_0x56b285<_0x3bcb28[_0x434550][_0x6400('0x25')];_0x56b285+=0x1){addVertex(_0x577156,_0x3bcb28[_0x434550][_0x56b285],_0x434550);}}else{addVertex(_0x577156,_0x3bcb28[_0x434550],_0x434550);}}}for(var _0x5116ea=0x0;_0x5116ea<_0x246433['length'];_0x5116ea+=0x1){if(_0x246433[_0x5116ea][_0x6400('0x26')]&&_0x246433[_0x5116ea]['target']){_0x577156[_0x6400('0x27')](_0x246433[_0x5116ea][_0x6400('0x26')],_0x246433[_0x5116ea]['target'],_0x246433[_0x5116ea][_0x6400('0x28')]);}}return _0x577156;}function getSquareProject(_0x52eba1,_0x498eaa){rpc[_0x6400('0x29')](_0x52eba1)[_0x6400('0x2a')](function(_0x10005a){_0x498eaa(null,_0x10005a);})[_0x6400('0x2b')](function(_0x1cf032){_0x498eaa(null,_0x1cf032);});}function createSquareReport(_0x54cf9f,_0x3bed65){rpc[_0x6400('0x2c')](_0x54cf9f)[_0x6400('0x2a')](function(_0x1f66c3){if(_0x3bed65){_0x3bed65(null,_0x1f66c3);}})['catch'](function(_0x437624){if(_0x3bed65){_0x3bed65(null,_0x437624);}});}function setChannelVariables(_0x356f4d){for(var _0x115aec in _0x356f4d){if(_0x356f4d['hasOwnProperty'](_0x115aec)){if(_0x115aec[_0x6400('0x2d')](_0x6400('0x2e'))===0x0){_0x356f4d[_0x115aec[_0x6400('0x2f')](0x4)]=_0x356f4d[_0x115aec];delete _0x356f4d[_0x115aec];}}}}function getLogFromObject(_0x3564ac){return util['inspect'](_0x3564ac,{'showHidden':![],'depth':null});}function agiHandler(_0x1aec8b){var _0x111676,_0x53e74c,_0x1e01c7,_0x37ab9a,_0x50ba26;logger['debug'](_0x6400('0x30'),JSON[_0x6400('0x31')](_0x1aec8b,null,0x2));logger[_0x6400('0xe')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1aec8b['arg_1'],_0x1aec8b[_0x6400('0x16')],_0x1aec8b[_0x6400('0x17')],_0x1aec8b[_0x6400('0x18')],_0x1aec8b[_0x6400('0x19')]));_0x1aec8b['on'](_0x6400('0x9'),errorHandler);_0x1aec8b['on']('close',closeHandler);_0x1aec8b['on'](_0x6400('0x32'),timeoutHandler);_0x1aec8b[_0x6400('0x1d')]=![];_0x1aec8b['on']('hangup',hangupHandler);var _0x51425c=getSquareProject[_0x6400('0x33')](null,_0x1aec8b[_0x6400('0x1b')]);if(_0x51425c){if(_0x51425c[_0x6400('0x34')]){_0x111676=getRoot(_0x51425c['production']);if(_0x111676&&_0x111676[_0x6400('0x35')]){logger[_0x6400('0x36')](_0x6400('0x1f'),JSON['stringify'](_0x111676,null,0x2));_0x1aec8b[_0x6400('0x37')]=moment()[_0x6400('0xf')](_0x6400('0x38'));_0x53e74c=initGraph(_['omit'](_0x111676,'mxCell'),_0x111676['mxCell']);_0x1e01c7=new Vertices(_0x1aec8b,rpc,mailRpc);logger[_0x6400('0xe')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1aec8b[_0x6400('0x1b')],_0x1aec8b[_0x6400('0x16')],_0x1aec8b['callerid'],_0x1aec8b[_0x6400('0x18')],_0x1aec8b[_0x6400('0x19')]));_0x53e74c[_0x6400('0x39')](_0x111676['start']['id'],function(_0x9536e5){try{_0x9536e5=_0x1e01c7[_0x6400('0x3a')](_0x9536e5);logger[_0x6400('0x36')](_0x6400('0x3b'),JSON['stringify'](_0x9536e5,null,0x2));if(_0x9536e5['agicommand']===_0x6400('0x3c')){logger[_0x6400('0xe')](_0x6400('0x3d'));_0x1aec8b['context']=_0x9536e5[_0x6400('0x3e')]||_0x1aec8b[_0x6400('0x3e')];_0x1aec8b[_0x6400('0x3f')]=_0x9536e5[_0x6400('0x3f')];_0x1aec8b[_0x6400('0x40')]=_0x9536e5['priority']?_0x9536e5[_0x6400('0x40')]-0x1:0x1;return null;}else if(_0x9536e5&&_0x1e01c7[_0x9536e5['agicommand']]){_0x50ba26=_0x1e01c7[_0x9536e5[_0x6400('0x20')]](_0x9536e5);logger[_0x6400('0xe')](_0x6400('0x41'),JSON[_0x6400('0x31')](_0x50ba26,null,0x2));if(_0x50ba26&&_0x50ba26['code']===AGI_CODE_SUCCESS&&_0x50ba26[_0x6400('0x42')]!==AGI_RESULT_ERROR&&!_0x1aec8b[_0x6400('0x1d')]){logger[_0x6400('0x36')](_0x6400('0x41'),getLogFromObject(_0x50ba26));return _['isUndefined'](_0x50ba26[_0x6400('0x42')])?null:_0x50ba26['result'][_0x6400('0x43')]();}else{logger['error'](_0x6400('0x41'),getLogFromObject(_0x50ba26));return null;}}else{logger[_0x6400('0x9')](_0x6400('0x44'));return null;}}catch(_0x5712f1){logger[_0x6400('0x9')](_0x5712f1['stack']);return null;}});if(_0x111676[_0x6400('0x45')]){logger[_0x6400('0xe')](util[_0x6400('0xf')](_0x6400('0x46'),_0x1aec8b[_0x6400('0x1b')],_0x1aec8b[_0x6400('0x16')],_0x1aec8b[_0x6400('0x17')],_0x1aec8b[_0x6400('0x18')],_0x1aec8b[_0x6400('0x19')]));_0x53e74c[_0x6400('0x39')](_0x111676[_0x6400('0x45')]['id'],function(_0x4b9e9e){try{_0x4b9e9e=_0x1e01c7[_0x6400('0x3a')](_0x4b9e9e);logger[_0x6400('0x36')](_0x6400('0x3b'),JSON['stringify'](_0x4b9e9e,null,0x2));if(_0x4b9e9e&&_0x1e01c7[_0x4b9e9e[_0x6400('0x20')]]){_0x50ba26=_0x1e01c7[_0x4b9e9e[_0x6400('0x20')]](_0x4b9e9e);if(_0x50ba26){logger[_0x6400('0x36')]('response',getLogFromObject(_0x50ba26));return _[_0x6400('0x47')](_0x50ba26['result'])?null:_0x50ba26['result']['toString']();}else{logger[_0x6400('0x9')](_0x6400('0x41'),getLogFromObject(_0x50ba26));return null;}}else{logger['error'](_0x6400('0x44'));return null;}}catch(_0x9737b3){logger['error'](_0x9737b3['stack']);return null;}});}logger[_0x6400('0xe')](util[_0x6400('0xf')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1aec8b[_0x6400('0x1b')],_0x1aec8b[_0x6400('0x16')],_0x1aec8b[_0x6400('0x17')],_0x1aec8b[_0x6400('0x18')],_0x1aec8b[_0x6400('0x19')]));logger[_0x6400('0xe')](util[_0x6400('0xf')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x1aec8b[_0x6400('0x3e')],_0x1aec8b[_0x6400('0x3f')],parseInt(_0x1aec8b[_0x6400('0x40')],0xa)+0x1));_0x1aec8b[_0x6400('0x48')](_0x1aec8b[_0x6400('0x3e')],_0x1aec8b[_0x6400('0x3f')],parseInt(_0x1aec8b[_0x6400('0x40')],0xa)+0x1);_0x1aec8b['close']();}}else{logger[_0x6400('0x9')](util['format']('Project\x20%s\x20not\x20published',_0x1aec8b[_0x6400('0x1b')]));_0x1aec8b[_0x6400('0x48')](_0x1aec8b[_0x6400('0x3e')],_0x1aec8b['extension'],parseInt(_0x1aec8b[_0x6400('0x40')],0xa)+0x1);_0x1aec8b[_0x6400('0x49')]();}}else{logger[_0x6400('0x9')](util[_0x6400('0xf')](_0x6400('0x4a'),_0x1aec8b['arg_1']));_0x1aec8b[_0x6400('0x48')](_0x1aec8b[_0x6400('0x3e')],_0x1aec8b['extension'],parseInt(_0x1aec8b[_0x6400('0x40')],0xa)+0x1);_0x1aec8b[_0x6400('0x49')]();}}function main(){var _0x85a5ac;return utilLicense['getLicense']()[_0x6400('0x2a')](function(_0x489042){if(_0x489042){if(_0x489042[_0x6400('0x4b')]){if(_0x489042[_0x6400('0x4c')]&&_0x489042[_0x6400('0x4c')]>0x0){logger[_0x6400('0xe')](util[_0x6400('0xf')](_0x6400('0x4d'),_0x489042['callysquare']));_0x85a5ac=_0x489042[_0x6400('0x4c')];}else{logger[_0x6400('0xe')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x6400('0xe')](_0x6400('0x4e'));_0x85a5ac=-0x1;}}})[_0x6400('0x2b')](function(_0x17f72d){logger['error'](_0x6400('0x4f'),_0x17f72d[_0x6400('0xa')]);})[_0x6400('0x45')](function(){var _0x3d68d9=require(_0x6400('0x50'))(config[_0x6400('0x4')][_0x6400('0xd')],config[_0x6400('0x4')]['ip'],_0x85a5ac);_0x3d68d9['on'](_0x6400('0x9'),errorHandler);_0x3d68d9['on'](_0x6400('0x51'),listeningHandler);_0x3d68d9['on'](_0x6400('0x52'),connectionHandler);_0x3d68d9['on'](_0x6400('0x49'),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 2446041..e125e80 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 _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x55418b,_0x4868fe){var _0x1b32e5=function(_0x24f01b){while(--_0x24f01b){_0x55418b['push'](_0x55418b['shift']());}};_0x1b32e5(++_0x4868fe);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x5c0ba5,_0x187ff3){var _0x101679=function(_0x1ff48e){while(--_0x1ff48e){_0x5c0ba5['push'](_0x5c0ba5['shift']());}};_0x101679(++_0x187ff3);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 72efc53..fd36c8d 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 _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x113a52,_0x2b94c5){var _0x4cb9b9=function(_0x414f8c){while(--_0x414f8c){_0x113a52['push'](_0x113a52['shift']());}};_0x4cb9b9(++_0x2b94c5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3a1ed6,_0x2184cd){_0x3a1ed6=_0x3a1ed6-0x0;var _0x28480b=_0x5f2f[_0x3a1ed6];return _0x28480b;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x46a634,_0x439b70){var _0x42007a=function(_0x2a9e29){while(--_0x2a9e29){_0x46a634['push'](_0x46a634['shift']());}};_0x42007a(++_0x439b70);}(_0xb10b,0x12a));var _0xbb10=function(_0x91e5da,_0x25ce34){_0x91e5da=_0x91e5da-0x0;var _0x5533f3=_0xb10b[_0x91e5da];return _0x5533f3;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index b2f35da..b81e12b 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 _0x0e27=['bluebird','moment','jayson/promise','http','request','error','message','getSquareProject','ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareReport','CreateSquareReport','arg_2','format','createSquareRecording','createSquareMessage','CreateSquareMessage','phone','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser'];(function(_0x26e4bf,_0xafca10){var _0x4b69da=function(_0x4a6cb3){while(--_0x4a6cb3){_0x26e4bf['push'](_0x26e4bf['shift']());}};_0x4b69da(++_0xafca10);}(_0x0e27,0x13e));var _0x70e2=function(_0x564ee4,_0x5f1547){_0x564ee4=_0x564ee4-0x0;var _0x2cd304=_0x0e27[_0x564ee4];return _0x2cd304;};'use strict';var BPromise=require(_0x70e2('0x0'));var moment=require(_0x70e2('0x1'));var _=require('lodash');var util=require('util');var jayson=require(_0x70e2('0x2'));var client=jayson['client'][_0x70e2('0x3')]({'port':0x2329});function request(_0x344cd9,_0x50ed91){return new BPromise(function(_0x42186e,_0x2e6a43){return client[_0x70e2('0x4')](_0x344cd9,_0x50ed91)['then'](function(_0x83b457){if(_0x83b457['error']){return _0x2e6a43(_0x83b457[_0x70e2('0x5')][_0x70e2('0x6')]);}else{return _0x42186e(_0x83b457['result']);}})['catch'](function(_0x2d28d5){return _0x2e6a43(_0x2d28d5);});});}exports[_0x70e2('0x7')]=function(_0x5d8162){return request(_0x70e2('0x8'),{'options':{'raw':![],'where':{'name':_0x5d8162},'attributes':[_0x70e2('0x9')]}});};exports[_0x70e2('0xa')]=function(_0x396a6d){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x396a6d},'include':[{'model':_0x70e2('0xb'),'as':_0x70e2('0xc')}],'attributes':['id',_0x70e2('0xd'),_0x70e2('0xe')]}});};exports[_0x70e2('0xf')]=function(_0x52ab84){return request(_0x70e2('0x8'),{'options':{'where':{'id':_0x52ab84},'attributes':['name']}});};exports[_0x70e2('0x10')]=function(_0x29525){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x29525},'attributes':[_0x70e2('0xd')]}});};exports[_0x70e2('0x11')]=function(_0x43f627){return request(_0x70e2('0x12'),{'options':{'where':{'id':_0x43f627},'attributes':[_0x70e2('0xd')]}});};exports[_0x70e2('0x13')]=function(_0x5b173d){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x5b173d},'attributes':[_0x70e2('0x14')]}});};exports[_0x70e2('0x15')]=function(_0x1849d5){return request(_0x70e2('0x16'),{'options':{'where':{'id':_0x1849d5},'attributes':[_0x70e2('0xd')]}});};exports[_0x70e2('0x17')]=function(_0x5d0da5){return request(_0x70e2('0x18'),{'options':{'where':{'id':_0x5d0da5},'attributes':[_0x70e2('0xd')]}});};exports[_0x70e2('0x19')]=function(_0x51a4bf){return request(_0x70e2('0x1a'),{'options':{'where':{'id':_0x51a4bf},'attributes':['save_name']}});};exports[_0x70e2('0x1b')]=function(_0xc6132e){return request(_0x70e2('0x1c'),{'options':{'raw':![],'where':{'id':_0xc6132e},'include':[{'model':'Interval','as':_0x70e2('0x1d')}]}});};exports[_0x70e2('0x1e')]=function(_0x5a6ebc){return request(_0x70e2('0x1f'),{'options':{'where':{'id':_0x5a6ebc},'attributes':['id',_0x70e2('0xd')]}});};exports[_0x70e2('0x20')]=function(_0x4a5d86){return request('CreateSmsMessage',{'body':_0x4a5d86});};exports['createSquareDetailsReport']=function(_0x6d3158){return request('CreateSquareDetailsReport',{'body':_0x6d3158});};exports[_0x70e2('0x21')]=function(_0x57f55d){return request(_0x70e2('0x22'),{'body':_['merge'](_0x57f55d,{'project_name':_0x57f55d['arg_1'],'prev_project_name':_0x57f55d[_0x70e2('0x23')]||'','is_subproject':_0x57f55d['arg_2']?!![]:![],'leaveAt':moment()[_0x70e2('0x24')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x70e2('0x25')]=function(_0x4e9dbc){return request('CreateSquareRecording',{'body':_0x4e9dbc});};exports[_0x70e2('0x26')]=function(_0x507f16){return request(_0x70e2('0x27'),{'body':_0x507f16});};exports['createCmContact']=function(_0x314244){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x314244[_0x70e2('0x28')],'ListId':_0x314244[_0x70e2('0x29')]}}})[_0x70e2('0x2a')](function(_0x20738f){if(_0x20738f){return _0x20738f;}return request(_0x70e2('0x2b'),{'body':_0x314244});});};exports[_0x70e2('0x2c')]=function(_0x5eed1d){return request(_0x70e2('0x2d'),{'options':{'where':{'id':_0x5eed1d},'attributes':['name']}});};exports[_0x70e2('0x2e')]=function(_0x485144,_0x25f0e1){return request(_0x70e2('0x2f'),{'body':{'interface':_0x25f0e1},'options':{'where':_0x485144}});};exports[_0x70e2('0x30')]=function(_0x48f858,_0x1bb156,_0x17941f){return request(_0x70e2('0x31'),{'body':{'type':_0x1bb156,'uniqueid':_0x17941f},'options':{'where':_0x48f858}});};exports['agentUnpause']=function(_0x355c2c){return request(_0x70e2('0x32'),{'body':{},'options':{'where':_0x355c2c}});};exports[_0x70e2('0x33')]=function(_0x2c76df){return request(_0x70e2('0x34'),{'body':{},'options':{'where':_0x2c76df}});}; \ No newline at end of file +var _0x9ab9=['CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','ShowPause','agentLogin','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','http','request','then','error','catch','ShowSquareProject','production','getMailAccountById','ShowMailAccount','Smtp','name','email','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','createSquareDetailsReport'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0x9ab9,0x19d));var _0x99ab=function(_0x54d47a,_0x435095){_0x54d47a=_0x54d47a-0x0;var _0x515c4f=_0x9ab9[_0x54d47a];return _0x515c4f;};'use strict';var BPromise=require(_0x99ab('0x0'));var moment=require(_0x99ab('0x1'));var _=require(_0x99ab('0x2'));var util=require(_0x99ab('0x3'));var jayson=require(_0x99ab('0x4'));var client=jayson['client'][_0x99ab('0x5')]({'port':0x2329});function request(_0x3a8ea9,_0x5f28e4){return new BPromise(function(_0x1b1c96,_0x49761a){return client[_0x99ab('0x6')](_0x3a8ea9,_0x5f28e4)[_0x99ab('0x7')](function(_0x390d41){if(_0x390d41[_0x99ab('0x8')]){return _0x49761a(_0x390d41[_0x99ab('0x8')]['message']);}else{return _0x1b1c96(_0x390d41['result']);}})[_0x99ab('0x9')](function(_0x18ca95){return _0x49761a(_0x18ca95);});});}exports['getSquareProject']=function(_0x14d083){return request(_0x99ab('0xa'),{'options':{'raw':![],'where':{'name':_0x14d083},'attributes':[_0x99ab('0xb')]}});};exports[_0x99ab('0xc')]=function(_0xe82b20){return request(_0x99ab('0xd'),{'options':{'raw':![],'where':{'id':_0xe82b20},'include':[{'model':'MailServerOut','as':_0x99ab('0xe')}],'attributes':['id',_0x99ab('0xf'),_0x99ab('0x10')]}});};exports['getSquareProjectById']=function(_0x4e7b4a){return request(_0x99ab('0xa'),{'options':{'where':{'id':_0x4e7b4a},'attributes':[_0x99ab('0xf')]}});};exports[_0x99ab('0x11')]=function(_0x3b3bba){return request(_0x99ab('0x12'),{'options':{'where':{'id':_0x3b3bba},'attributes':[_0x99ab('0xf')]}});};exports['getVariableById']=function(_0x97639f){return request(_0x99ab('0x13'),{'options':{'where':{'id':_0x97639f},'attributes':['name']}});};exports[_0x99ab('0x14')]=function(_0x36d89e){return request(_0x99ab('0x15'),{'options':{'where':{'id':_0x36d89e},'attributes':['dsn']}});};exports[_0x99ab('0x16')]=function(_0x13b9aa){return request(_0x99ab('0x17'),{'options':{'where':{'id':_0x13b9aa},'attributes':[_0x99ab('0xf')]}});};exports[_0x99ab('0x18')]=function(_0x2a5e0e){return request(_0x99ab('0x19'),{'options':{'where':{'id':_0x2a5e0e},'attributes':[_0x99ab('0xf')]}});};exports['getSoundById']=function(_0x14a515){return request(_0x99ab('0x1a'),{'options':{'where':{'id':_0x14a515},'attributes':[_0x99ab('0x1b')]}});};exports[_0x99ab('0x1c')]=function(_0x34e694){return request(_0x99ab('0x1d'),{'options':{'raw':![],'where':{'id':_0x34e694},'include':[{'model':_0x99ab('0x1e'),'as':_0x99ab('0x1f')}]}});};exports[_0x99ab('0x20')]=function(_0x51ded6){return request('ShowSmsAccount',{'options':{'where':{'id':_0x51ded6},'attributes':['id',_0x99ab('0xf')]}});};exports[_0x99ab('0x21')]=function(_0x194f39){return request('CreateSmsMessage',{'body':_0x194f39});};exports[_0x99ab('0x22')]=function(_0x3a0897){return request(_0x99ab('0x23'),{'body':_0x3a0897});};exports[_0x99ab('0x24')]=function(_0x624e9b){return request(_0x99ab('0x25'),{'body':_[_0x99ab('0x26')](_0x624e9b,{'project_name':_0x624e9b['arg_1'],'prev_project_name':_0x624e9b[_0x99ab('0x27')]||'','is_subproject':_0x624e9b['arg_2']?!![]:![],'leaveAt':moment()[_0x99ab('0x28')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x2d3281){return request(_0x99ab('0x29'),{'body':_0x2d3281});};exports[_0x99ab('0x2a')]=function(_0x570bed){return request(_0x99ab('0x2b'),{'body':_0x570bed});};exports[_0x99ab('0x2c')]=function(_0x447ef0){return request(_0x99ab('0x2d'),{'options':{'raw':![],'where':{'phone':_0x447ef0[_0x99ab('0x2e')],'ListId':_0x447ef0[_0x99ab('0x2f')]}}})[_0x99ab('0x7')](function(_0x2efec3){if(_0x2efec3){return _0x2efec3;}return request(_0x99ab('0x30'),{'body':_0x447ef0});});};exports['getPauseById']=function(_0x37182e){return request(_0x99ab('0x31'),{'options':{'where':{'id':_0x37182e},'attributes':['name']}});};exports[_0x99ab('0x32')]=function(_0x2c7333,_0x12c3e9){return request('LoginUser',{'body':{'interface':_0x12c3e9},'options':{'where':_0x2c7333}});};exports['agentPause']=function(_0x415276,_0x2cadac,_0x1aeca3){return request(_0x99ab('0x33'),{'body':{'type':_0x2cadac,'uniqueid':_0x1aeca3},'options':{'where':_0x415276}});};exports[_0x99ab('0x34')]=function(_0x36c0f1){return request(_0x99ab('0x35'),{'body':{},'options':{'where':_0x36c0f1}});};exports[_0x99ab('0x36')]=function(_0x5ba1ea){return request(_0x99ab('0x37'),{'body':{},'options':{'where':_0x5ba1ea}});}; \ 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 82b9f50..d6547f8 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 _0x0ba7=['exports','./polly'];(function(_0x4e01d3,_0x256d92){var _0x266b28=function(_0x100fbd){while(--_0x100fbd){_0x4e01d3['push'](_0x4e01d3['shift']());}};_0x266b28(++_0x256d92);}(_0x0ba7,0x16d));var _0x70ba=function(_0x4d37a9,_0x430ef2){_0x4d37a9=_0x4d37a9-0x0;var _0x35ae3d=_0x0ba7[_0x4d37a9];return _0x35ae3d;};var polly=require(_0x70ba('0x0'));var lex=require('./lex');module[_0x70ba('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x29d4=['exports','./polly'];(function(_0x3d1f79,_0x31040b){var _0x3e4708=function(_0x40a16c){while(--_0x40a16c){_0x3d1f79['push'](_0x3d1f79['shift']());}};_0x3e4708(++_0x31040b);}(_0x29d4,0x1a1));var _0x429d=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x29d4[_0x5bd426];return _0x23a7eb;};var polly=require(_0x429d('0x0'));var lex=require('./lex');module[_0x429d('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 3f25585..de2b3b5 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 _0xb0b9=['./lib/api'];(function(_0x2d0d97,_0x2d9560){var _0xfb96e9=function(_0x52a340){while(--_0x52a340){_0x2d0d97['push'](_0x2d0d97['shift']());}};_0xfb96e9(++_0x2d9560);}(_0xb0b9,0x1f3));var _0x9b0b=function(_0x215194,_0x1249a8){_0x215194=_0x215194-0x0;var _0x232dfa=_0xb0b9[_0x215194];return _0x232dfa;};'use strict';var lex=require(_0x9b0b('0x0'));module['exports']=function(_0x55227a,_0x1f310b,_0x24fa0c,_0x27a2dc,_0x76cbb2,_0x1888ce){return lex(_0x55227a,_0x1f310b,_0x24fa0c,_0x27a2dc,_0x76cbb2,_0x1888ce);}; \ No newline at end of file +var _0x430e=['exports'];(function(_0x29061d,_0x5bd197){var _0x378837=function(_0x4a7fa3){while(--_0x4a7fa3){_0x29061d['push'](_0x29061d['shift']());}};_0x378837(++_0x5bd197);}(_0x430e,0x105));var _0xe430=function(_0x1a6c7f,_0x5aee3f){_0x1a6c7f=_0x1a6c7f-0x0;var _0x1d378d=_0x430e[_0x1a6c7f];return _0x1d378d;};'use strict';var lex=require('./lib/api');module[_0xe430('0x0')]=function(_0x2984a5,_0x4eaa9b,_0x85af5b,_0x253dfe,_0x36942f,_0x1a9d61){return lex(_0x2984a5,_0x4eaa9b,_0x85af5b,_0x253dfe,_0x36942f,_0x1a9d61);}; \ 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 dc6b605..6ce453f 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 _0x364f=['exports','$LATEST','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x364f,0x1b8));var _0xf364=function(_0x2af009,_0x5432ee){_0x2af009=_0x2af009-0x0;var _0x46d15f=_0x364f[_0x2af009];return _0x46d15f;};'use strict';var BPromise=require(_0xf364('0x0'));var AWS=require(_0xf364('0x1'));function lexResult(_0x4fc035,_0x5ded3f){return new BPromise(function(_0x54ddee,_0x9d85ce){_0x4fc035['postText'](_0x5ded3f,function(_0x3cc132,_0x27918f){if(_0x3cc132){_0x9d85ce(_0x3cc132);}if(_0x27918f[_0xf364('0x2')]){for(const _0x53a0fe in _0x27918f['slots']){if(_0x27918f[_0xf364('0x2')][_0xf364('0x3')](_0x53a0fe)){var _0x2e8bb5=_0x27918f[_0xf364('0x2')][_0x53a0fe];_0x27918f['slot_'+_0x53a0fe]=_0x2e8bb5;}}}_0x54ddee(_0x27918f);});});}module[_0xf364('0x4')]=function(_0x295545,_0x1aa7b1,_0x3ea60e,_0x587697,_0x2e7dc3,_0xde8e6){var _0x585bb2=new AWS['LexRuntime']({'accessKeyId':_0x1aa7b1,'secretAccessKey':_0x3ea60e,'region':_0x587697});var _0x44e054={'botAlias':_0xf364('0x5'),'botName':_0xde8e6,'inputText':_0x2e7dc3,'userId':_0x295545};return lexResult(_0x585bb2,_0x44e054);}; \ No newline at end of file +var _0x022d=['slot_','LexRuntime','$LATEST','postText','slots'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0x022d,0xda));var _0xd022=function(_0x25c0ed,_0x5478de){_0x25c0ed=_0x25c0ed-0x0;var _0x3a6b6f=_0x022d[_0x25c0ed];return _0x3a6b6f;};'use strict';var BPromise=require('bluebird');var AWS=require('aws-sdk');function lexResult(_0x2eaee1,_0x6f9dbe){return new BPromise(function(_0x2e82a1,_0x274413){_0x2eaee1[_0xd022('0x0')](_0x6f9dbe,function(_0x16f80a,_0x3ba95e){if(_0x16f80a){_0x274413(_0x16f80a);}if(_0x3ba95e[_0xd022('0x1')]){for(const _0x512015 in _0x3ba95e[_0xd022('0x1')]){if(_0x3ba95e[_0xd022('0x1')]['hasOwnProperty'](_0x512015)){var _0x488ff4=_0x3ba95e[_0xd022('0x1')][_0x512015];_0x3ba95e[_0xd022('0x2')+_0x512015]=_0x488ff4;}}}_0x2e82a1(_0x3ba95e);});});}module['exports']=function(_0x4c6281,_0x2705e6,_0x473c19,_0x21b5e0,_0x639e4d,_0x4dfaa5){var _0x4bb44c=new AWS[(_0xd022('0x3'))]({'accessKeyId':_0x2705e6,'secretAccessKey':_0x473c19,'region':_0x21b5e0});var _0x31256e={'botAlias':_0xd022('0x4'),'botName':_0x4dfaa5,'inputText':_0x639e4d,'userId':_0x4c6281};return lexResult(_0x4bb44c,_0x31256e);}; \ 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 dc85913..280b34c 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 _0x43ba=['./lib/api','exports'];(function(_0x349a9e,_0x473cb8){var _0x24c207=function(_0x22f148){while(--_0x22f148){_0x349a9e['push'](_0x349a9e['shift']());}};_0x24c207(++_0x473cb8);}(_0x43ba,0x114));var _0xa43b=function(_0x3f0bab,_0x5df728){_0x3f0bab=_0x3f0bab-0x0;var _0x38966b=_0x43ba[_0x3f0bab];return _0x38966b;};'use strict';var polly=require(_0xa43b('0x0'));module[_0xa43b('0x1')]=function(_0xaa2761,_0x18549a,_0x799200,_0x277119,_0x5aeecf,_0x3ac02d,_0xaa0f87){return polly(_0xaa2761,_0x18549a,_0x799200,_0x277119,_0x5aeecf,_0x3ac02d,_0xaa0f87);}; \ No newline at end of file +var _0x3413=['./lib/api','exports'];(function(_0x58945f,_0x21e31b){var _0x26d3f7=function(_0x3b8e1b){while(--_0x3b8e1b){_0x58945f['push'](_0x58945f['shift']());}};_0x26d3f7(++_0x21e31b);}(_0x3413,0x1d6));var _0x3341=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3413[_0x14add3];return _0x4a174f;};'use strict';var polly=require(_0x3341('0x0'));module[_0x3341('0x1')]=function(_0x244f9e,_0x1cb371,_0x3a269b,_0x3276dc,_0x2642d5,_0x150e8d,_0x2c48c3){return polly(_0x244f9e,_0x1cb371,_0x3a269b,_0x3276dc,_0x2642d5,_0x150e8d,_0x2c48c3);}; \ 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 64fc30d..3bb74e7 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 _0x1551=['synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','randomstring','aws-sdk'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x1551,0x197));var _0x1155=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0x1551[_0x43f881];return _0x365c14;};'use strict';var fs=require('fs');var path=require(_0x1155('0x0'));var BPromise=require('bluebird');var rs=require(_0x1155('0x1'));var AWS=require(_0x1155('0x2'));function pollyResult(_0x1a8e7b,_0x56244e,_0x502a5f){return new BPromise(function(_0x1601ef,_0x2cea93){_0x1a8e7b[_0x1155('0x3')](_0x56244e,function(_0x44bf59,_0x212970){if(_0x44bf59){_0x2cea93(_0x44bf59);}else if(_0x212970){if(_0x212970[_0x1155('0x4')]instanceof Buffer){fs['writeFile'](_0x502a5f,_0x212970[_0x1155('0x4')],function(_0x32b06e){if(_0x32b06e){_0x2cea93(_0x32b06e);}else{_0x1601ef();}});}else{_0x2cea93(new Error(_0x1155('0x5')));}}else{_0x2cea93(new Error(_0x1155('0x6')));}});});}module['exports']=function(_0x14ed5d,_0x39cc51,_0x28b3ad,_0x22b2fc,_0xeea7f0,_0x3ce8f1,_0x3b87d1){var _0x1abe31=new AWS[(_0x1155('0x7'))]({'accessKeyId':_0x14ed5d,'secretAccessKey':_0x39cc51,'region':_0x28b3ad});var _0x5ed44d={'Text':_0xeea7f0,'TextType':_0x3ce8f1||_0x1155('0x8'),'OutputFormat':_0x1155('0x9'),'VoiceId':_0x22b2fc};return pollyResult(_0x1abe31,_0x5ed44d,_0x3b87d1);}; \ No newline at end of file +var _0x376d=['synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird'];(function(_0x52740d,_0x33db0d){var _0x45d0dd=function(_0xb94d17){while(--_0xb94d17){_0x52740d['push'](_0x52740d['shift']());}};_0x45d0dd(++_0x33db0d);}(_0x376d,0xe5));var _0xd376=function(_0x41e6c7,_0x6977ab){_0x41e6c7=_0x41e6c7-0x0;var _0x28f5aa=_0x376d[_0x41e6c7];return _0x28f5aa;};'use strict';var fs=require('fs');var path=require(_0xd376('0x0'));var BPromise=require(_0xd376('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x56079a,_0x41e735,_0x5990e1){return new BPromise(function(_0xe0d823,_0x50fbd7){_0x56079a[_0xd376('0x2')](_0x41e735,function(_0x3dd685,_0x31fe9c){if(_0x3dd685){_0x50fbd7(_0x3dd685);}else if(_0x31fe9c){if(_0x31fe9c[_0xd376('0x3')]instanceof Buffer){fs[_0xd376('0x4')](_0x5990e1,_0x31fe9c[_0xd376('0x3')],function(_0x2971fc){if(_0x2971fc){_0x50fbd7(_0x2971fc);}else{_0xe0d823();}});}else{_0x50fbd7(new Error(_0xd376('0x5')));}}else{_0x50fbd7(new Error(_0xd376('0x6')));}});});}module[_0xd376('0x7')]=function(_0x521c0e,_0x51a182,_0x382d0a,_0x593790,_0x5e1dce,_0x1ab3b3,_0x1b48a1){var _0x503b3b=new AWS[(_0xd376('0x8'))]({'accessKeyId':_0x521c0e,'secretAccessKey':_0x51a182,'region':_0x382d0a});var _0x40c3a9={'Text':_0x5e1dce,'TextType':_0x1ab3b3||_0xd376('0x9'),'OutputFormat':_0xd376('0xa'),'VoiceId':_0x593790};return pollyResult(_0x503b3b,_0x40c3a9,_0x1b48a1);}; \ 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 4a468a2..6829a58 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 _0xc082=['./lib/api','exports'];(function(_0x39a7b3,_0x9c5210){var _0x1e25e2=function(_0x530d86){while(--_0x530d86){_0x39a7b3['push'](_0x39a7b3['shift']());}};_0x1e25e2(++_0x9c5210);}(_0xc082,0x184));var _0x2c08=function(_0x421673,_0x364b94){_0x421673=_0x421673-0x0;var _0x100326=_0xc082[_0x421673];return _0x100326;};'use strict';var asr=require(_0x2c08('0x0'));module[_0x2c08('0x1')]=function(_0x164a24,_0x51fb8e,_0x2bb1c0,_0x3f8f20){return asr(_0x164a24,_0x51fb8e,_0x2bb1c0);}; \ No newline at end of file +var _0x6178=['exports'];(function(_0x298bc1,_0x4c1869){var _0x2a1d56=function(_0xf92ea3){while(--_0xf92ea3){_0x298bc1['push'](_0x298bc1['shift']());}};_0x2a1d56(++_0x4c1869);}(_0x6178,0x1e2));var _0x8617=function(_0x376830,_0x1adaca){_0x376830=_0x376830-0x0;var _0x51ead4=_0x6178[_0x376830];return _0x51ead4;};'use strict';var asr=require('./lib/api');module[_0x8617('0x0')]=function(_0xfebbee,_0x4f085c,_0x4d75cd,_0x4d097a){return asr(_0xfebbee,_0x4f085c,_0x4d75cd);}; \ 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 f8a5e9f..1c502f7 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 _0x8046=['key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','exports','string','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x53a0ff,_0x39493c){var _0x257a8b=function(_0x5a304e){while(--_0x5a304e){_0x53a0ff['push'](_0x53a0ff['shift']());}};_0x257a8b(++_0x39493c);}(_0x8046,0x112));var _0x6804=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x8046[_0x138adb];return _0x1b27f2;};'use strict';var url=require(_0x6804('0x0'));var BPromise=require(_0x6804('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x6804('0x2')]=function(_0x4553c7,_0xf4b1f4,_0x1fc41c){return new BPromise(function(_0xf6997,_0x38f8ba){var _0x1ec4a3;if(typeof _0x4553c7!==_0x6804('0x3')||_0x4553c7[_0x6804('0x4')]===0x0){return _0x38f8ba(_0x6804('0x5'));}if(typeof _0xf4b1f4!=='string'||_0xf4b1f4[_0x6804('0x4')]===0x0){return _0x38f8ba(_0x6804('0x6'));}if(typeof _0x1fc41c!==_0x6804('0x7')&&(typeof _0x1fc41c!==_0x6804('0x3')||_0x1fc41c[_0x6804('0x4')]===0x0)){return _0x38f8ba(_0x6804('0x8'));}try{_0x1ec4a3=fs[_0x6804('0x9')](_0x4553c7)['toString'](_0x6804('0xa'));}catch(_0x476313){return _0x38f8ba(_0x476313);}return _0xf6997({'method':'POST','uri':host+_0x6804('0xb')+_0xf4b1f4,'body':{'config':{'encoding':_0x6804('0xc'),'sampleRateHertz':_0x6804('0xd'),'languageCode':_0x1fc41c},'audio':{'content':_0x1ec4a3}},'json':!![]});});}; \ No newline at end of file +var _0xf9cf=['string','length','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','exports'];(function(_0xb0fe92,_0x147e42){var _0x41787f=function(_0x42ae35){while(--_0x42ae35){_0xb0fe92['push'](_0xb0fe92['shift']());}};_0x41787f(++_0x147e42);}(_0xf9cf,0x88));var _0xff9c=function(_0x39a86d,_0x10287a){_0x39a86d=_0x39a86d-0x0;var _0x960fdf=_0xf9cf[_0x39a86d];return _0x960fdf;};'use strict';var url=require(_0xff9c('0x0'));var BPromise=require(_0xff9c('0x1'));var fs=require('fs');var host=_0xff9c('0x2');module[_0xff9c('0x3')]=function(_0x17da22,_0x28b6b3,_0x132227){return new BPromise(function(_0x290be8,_0x127182){var _0x4239d1;if(typeof _0x17da22!==_0xff9c('0x4')||_0x17da22[_0xff9c('0x5')]===0x0){return _0x127182('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x28b6b3!==_0xff9c('0x4')||_0x28b6b3[_0xff9c('0x5')]===0x0){return _0x127182(_0xff9c('0x6'));}if(typeof _0x132227!==_0xff9c('0x7')&&(typeof _0x132227!==_0xff9c('0x4')||_0x132227[_0xff9c('0x5')]===0x0)){return _0x127182('lang\x20should\x20be\x20a\x20string');}try{_0x4239d1=fs[_0xff9c('0x8')](_0x17da22)[_0xff9c('0x9')](_0xff9c('0xa'));}catch(_0x191525){return _0x127182(_0x191525);}return _0x290be8({'method':_0xff9c('0xb'),'uri':host+_0xff9c('0xc')+_0x28b6b3,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xff9c('0xd'),'languageCode':_0x132227},'audio':{'content':_0x4239d1}},'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 e6d5fa4..5e5a806 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 _0x98f0=['exports'];(function(_0x46f572,_0x33c8d4){var _0x36ee00=function(_0x989ba4){while(--_0x989ba4){_0x46f572['push'](_0x46f572['shift']());}};_0x36ee00(++_0x33c8d4);}(_0x98f0,0xdd));var _0x098f=function(_0x2d04bc,_0x36583b){_0x2d04bc=_0x2d04bc-0x0;var _0xfe4eb3=_0x98f0[_0x2d04bc];return _0xfe4eb3;};var asr=require('./asr');module[_0x098f('0x0')]={'asr':asr}; \ No newline at end of file +var _0xba6f=['./asr'];(function(_0x31c19c,_0xbe4b70){var _0x1a87f7=function(_0x23cf92){while(--_0x23cf92){_0x31c19c['push'](_0x31c19c['shift']());}};_0x1a87f7(++_0xbe4b70);}(_0xba6f,0x1d0));var _0xfba6=function(_0x3ebb04,_0x1a63a6){_0x3ebb04=_0x3ebb04-0x0;var _0x535db0=_0xba6f[_0x3ebb04];return _0x535db0;};var asr=require(_0xfba6('0x0'));module['exports']={'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 75887a6..40d1ff0 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 _0xab11=['resolve','tmp','generate','.wav','writeFileSync','base64','then','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','chmodSync','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','name','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','ispeechASR','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','http','https','path','querystring','request-promise','randomstring','sox','url','parse','./aws','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','https:','host','statusCode','error','statusMessage','request\x20to\x20','createWriteStream','finish','info','close','unlink','download\x20error','pipe','protocol','get','\x20failed,\x20status\x20code\x20=\x20','data','end','wav','finish\x20to\x20convert','start'];(function(_0x373e27,_0x527f8d){var _0x4a336f=function(_0x2cf6c0){while(--_0x2cf6c0){_0x373e27['push'](_0x373e27['shift']());}};_0x4a336f(++_0x527f8d);}(_0xab11,0x17e));var _0x1ab1=function(_0x1a351b,_0x246fc9){_0x1a351b=_0x1a351b-0x0;var _0x8f4696=_0xab11[_0x1a351b];return _0x8f4696;};'use strict';var apiai=require(_0x1ab1('0x0'));var BPromise=require(_0x1ab1('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x1ab1('0x2'));var https=require(_0x1ab1('0x3'));var md5=require('md5');var path=require(_0x1ab1('0x4'));var querystring=require(_0x1ab1('0x5'));var rp=require(_0x1ab1('0x6'));var rs=require(_0x1ab1('0x7'));var sox=require(_0x1ab1('0x8'));var tts=require('google-tts-api');var urlParse=require(_0x1ab1('0x9'))[_0x1ab1('0xa')];var util=require('util');var aws=require(_0x1ab1('0xb'));var google=require(_0x1ab1('0xc'));var sestek=require(_0x1ab1('0xd'));var tilde=require(_0x1ab1('0xe'));var logger=require(_0x1ab1('0xf'))('agi');var ISPEECH_API=_0x1ab1('0x10');function downloadFile(_0x4ec15e,_0x37a061){return new BPromise(function(_0x52b54b,_0x14d444){var _0x5b79bd=urlParse(_0x4ec15e);var _0x5cb6b6=_0x5b79bd['protocol']===_0x1ab1('0x11')?https:http;var _0x2dde8e={'host':_0x5b79bd[_0x1ab1('0x12')],'path':_0x5b79bd['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x5cb6b6['get'](_0x2dde8e,function(_0x5cd02f){if(_0x5cd02f[_0x1ab1('0x13')]!==0xc8){logger[_0x1ab1('0x14')]('request\x20to\x20'+_0x4ec15e+'\x20failed,\x20status\x20code\x20=\x20'+_0x5cd02f[_0x1ab1('0x13')]+'\x20('+_0x5cd02f[_0x1ab1('0x15')]+')');_0x14d444(new Error(_0x1ab1('0x16')+_0x4ec15e+'\x20failed,\x20status\x20code\x20=\x20'+_0x5cd02f[_0x1ab1('0x13')]+'\x20('+_0x5cd02f['statusMessage']+')'));return;}var _0x156999=fs[_0x1ab1('0x17')](_0x37a061);_0x156999['on'](_0x1ab1('0x18'),function(){logger[_0x1ab1('0x19')]('finish\x20download\x20file');_0x156999[_0x1ab1('0x1a')](_0x52b54b);});_0x156999['on'](_0x1ab1('0x14'),function(_0x49802e){fs[_0x1ab1('0x1b')](_0x37a061);logger[_0x1ab1('0x14')](_0x1ab1('0x1c'),_0x49802e);_0x14d444(_0x49802e);});_0x5cd02f[_0x1ab1('0x1d')](_0x156999);})['on'](_0x1ab1('0x14'),function(_0x113899){logger[_0x1ab1('0x14')](_0x113899);_0x14d444(_0x113899);})['end']();});}function uploadFile(_0x1d13b7){return new BPromise(function(_0x4fe73d,_0x4c25ab){var _0x163e50=urlParse(_0x1d13b7);var _0x47c443=_0x163e50[_0x1ab1('0x1e')]===_0x1ab1('0x11')?https:http;var _0xb323d2={'host':_0x163e50[_0x1ab1('0x12')],'path':_0x163e50[_0x1ab1('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x47c443[_0x1ab1('0x1f')](_0xb323d2,function(_0x369c43){if(_0x369c43[_0x1ab1('0x13')]!==0xc8){_0x4c25ab(new Error(_0x1ab1('0x16')+_0x1d13b7+_0x1ab1('0x20')+_0x369c43[_0x1ab1('0x13')]+'\x20('+_0x369c43[_0x1ab1('0x15')]+')'));return;}var _0xa32a1a='';_0x369c43['on'](_0x1ab1('0x21'),function(_0x1801ba){_0xa32a1a+=_0x1801ba;});_0x369c43['on'](_0x1ab1('0x22'),function(){_0x4fe73d(_0xa32a1a);});})['on'](_0x1ab1('0x14'),function(_0x1b6b17){_0x4c25ab(_0x1b6b17);})[_0x1ab1('0x22')]();});}function convertFile(_0x21dba2,_0x3c5544){return new BPromise(function(_0x485b27,_0x4368a2){var _0x5e43b7=sox['transcode'](_0x21dba2,_0x3c5544,{'sampleRate':0x1f40,'format':_0x1ab1('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5e43b7['on'](_0x1ab1('0x14'),function(_0x4901c4){logger[_0x1ab1('0x14')]('error\x20convert',_0x4901c4);_0x4368a2(_0x4901c4);});_0x5e43b7['on'](_0x1ab1('0x22'),function(){logger[_0x1ab1('0x19')](_0x1ab1('0x24'));_0x485b27();});_0x5e43b7[_0x1ab1('0x25')]();});}function base64Decode(_0xcd27ab,_0x5d730c){var _0x1efa4d=path[_0x1ab1('0x26')](__dirname,_0x1ab1('0x27'),rs[_0x1ab1('0x28')](0x4)+_0x1ab1('0x29'));fs[_0x1ab1('0x2a')](_0x1efa4d,_0xcd27ab,_0x1ab1('0x2b'));return convertFile(_0x1efa4d,_0x5d730c)[_0x1ab1('0x2c')](function(){try{fs[_0x1ab1('0x1b')](_0x1efa4d);fs['chmodSync'](_0x5d730c,_0x1ab1('0x2d'));}catch(_0x355ddb){logger[_0x1ab1('0x14')](_0x355ddb);}return _0x5d730c[_0x1ab1('0x2e')]('.')[0x0];});}function base64Encode(_0x16bb3c){var _0x23de2b=fs[_0x1ab1('0x2f')](_0x16bb3c);return new Buffer(_0x23de2b)[_0x1ab1('0x30')](_0x1ab1('0x2b'));}exports[_0x1ab1('0x31')]=function(_0x5c2a51,_0x2ee4ee,_0x48c771,_0x3ad647,_0x57f6d2,_0x4ff6d2){var _0x45eb48,_0x5da94e;var _0x8d4762=_0x1ab1('0x32');var _0x52d90f=_0x1ab1('0x33')+_0x5c2a51;var _0xfbaac3={};if(_0x2ee4ee===_0x1ab1('0x34')){_0xfbaac3[_0x1ab1('0x35')]={'ssml':_0x48c771};}else{_0xfbaac3[_0x1ab1('0x35')]={'text':_0x48c771};};_0xfbaac3[_0x1ab1('0x36')]={'languageCode':_0x3ad647,'ssmlGender':_0x57f6d2};_0xfbaac3[_0x1ab1('0x37')]={'audioEncoding':_0x1ab1('0x38'),'sampleRateHertz':0x1f40};var _0x39737f={'url':_0x8d4762+_0x1ab1('0x39')+_0x52d90f,'method':_0x1ab1('0x3a'),'json':!![],'body':_0xfbaac3};return rp(_0x39737f)[_0x1ab1('0x2c')](function(_0x4796ca){return new BPromise(function(_0x3d1bc4,_0x228185){_0x45eb48=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x1ab1('0x3b'));var _0x4fc409=Buffer[_0x1ab1('0x3c')](_0x4796ca['audioContent'],_0x1ab1('0x2b'));return fs['writeFile'](_0x45eb48,_0x4fc409,function(_0x563457){_0x228185(_0x563457);},function(_0x180486){fs[_0x1ab1('0x3d')](_0x45eb48,_0x1ab1('0x2d'));_0x3d1bc4(_0x180486);});});})[_0x1ab1('0x2c')](function(_0x597d50){_0x5da94e=path[_0x1ab1('0x26')](__dirname,_0x1ab1('0x27'),rs[_0x1ab1('0x28')](0x4)+_0x1ab1('0x29'));return convertFile(_0x45eb48,_0x5da94e);})[_0x1ab1('0x2c')](function(){try{fs['unlink'](_0x45eb48);fs[_0x1ab1('0x3d')](_0x5da94e,_0x1ab1('0x2d'));}catch(_0x107b6c){logger['error'](_0x107b6c);}logger[_0x1ab1('0x19')](_0x1ab1('0x3e'),_0x5da94e[_0x1ab1('0x2e')]('.')[0x0]);return _0x5da94e[_0x1ab1('0x2e')]('.')[0x0];});};exports[_0x1ab1('0x3f')]=function(_0x3bcd9f,_0x176fe){var _0x734cee=_0x1ab1('0x40');var _0x30b931,_0x3cdae9;var _0x47cf18;var _0xb25c84={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x734cee,'headers':{'Content-Type':_0x1ab1('0x41')},'body':'f.req='+encodeURIComponent(JSON[_0x1ab1('0x42')]([[[_0x1ab1('0x43'),JSON[_0x1ab1('0x42')]([_0x3bcd9f,_0x176fe||'en',![],_0x1ab1('0x44')]),null,_0x1ab1('0x45')]]]))};return rp(_0xb25c84)[_0x1ab1('0x2c')](function(_0xd0ee33){try{_0x47cf18=eval(_0xd0ee33[_0x1ab1('0x46')](0x5))[0x0][0x2];}catch(_0x8147a9){throw new Error(_0x1ab1('0x47')+_0xd0ee33['data']);}if(!_0x47cf18){if(_0x3bcd9f[_0x1ab1('0x48')]>0xc8){throw new Error(_0x1ab1('0x49'));}else{throw new Error(_0x1ab1('0x4a')+_0x176fe+'\x22\x20might\x20not\x20exist');}}try{_0x47cf18=eval(_0x47cf18)[0x0];}catch(_0x9ea01d){throw new Error(_0x1ab1('0x47')+res['data']);}const _0x6cdf17=_0x47cf18;_0x30b931=path['resolve'](__dirname,_0x1ab1('0x27'),rs['generate'](0x4)+_0x1ab1('0x3b'));fs[_0x1ab1('0x2a')](_0x30b931,_0x47cf18,{'encoding':_0x1ab1('0x2b')});_0x3cdae9=path[_0x1ab1('0x26')](__dirname,_0x1ab1('0x27'),rs['generate'](0x4)+_0x1ab1('0x29'));return convertFile(_0x30b931,_0x3cdae9);})['then'](function(){try{fs[_0x1ab1('0x1b')](_0x30b931);fs['chmodSync'](_0x3cdae9,_0x1ab1('0x2d'));}catch(_0x2215c5){logger['error'](_0x2215c5);}logger[_0x1ab1('0x19')](_0x1ab1('0x4b'),_0x3cdae9[_0x1ab1('0x2e')]('.')[0x0]);return _0x3cdae9[_0x1ab1('0x2e')]('.')[0x0];});};exports[_0x1ab1('0x4c')]=function(_0xf7627f,_0xacd143,_0x1286a3){return google[_0x1ab1('0x4d')](_0xf7627f,_0xacd143,_0x1286a3)['then'](function(_0x47d464){logger[_0x1ab1('0x19')](_0x47d464[_0x1ab1('0x4e')]);return rp(_0x47d464);})[_0x1ab1('0x2c')](function(_0x486579){var _0x475aa6='';var _0x3accf3=0x0;try{fs[_0x1ab1('0x1b')](_0xf7627f);}catch(_0x8e90d3){logger[_0x1ab1('0x14')](_0x8e90d3);}if(_0x486579&&_0x486579['results']){_0x475aa6=_0x486579[_0x1ab1('0x4f')][_0x1ab1('0x50')](function(_0x3cc1b1){return _0x3cc1b1&&_0x3cc1b1[_0x1ab1('0x51')][0x0]&&_0x3cc1b1[_0x1ab1('0x51')][0x0][_0x1ab1('0x52')]?_0x3cc1b1[_0x1ab1('0x51')][0x0]['transcript']:'';})[_0x1ab1('0x53')]('\x0a');_0x3accf3=_0x486579['results'][_0x1ab1('0x50')](function(_0x241857){return _0x241857&&_0x241857['alternatives'][0x0]&&_0x241857['alternatives'][0x0][_0x1ab1('0x54')]?_0x241857[_0x1ab1('0x51')][0x0][_0x1ab1('0x54')]:0x0;})['join']('\x0a');}logger[_0x1ab1('0x19')](_0x1ab1('0x55'),_0x475aa6);logger[_0x1ab1('0x19')]('googleASR\x20confidence',_0x3accf3);return{'transcript':_0x475aa6,'confidence':_0x3accf3};})[_0x1ab1('0x56')](function(_0x58d060){logger[_0x1ab1('0x14')]('[%s]\x20%s:%s',_0x58d060[_0x1ab1('0x13')],_0x58d060[_0x1ab1('0x57')],_0x58d060['message']);});};exports['googleDialogflow']=function(_0x257d45,_0x4adb9c,_0x4e9c39,_0x3f9a4e){var _0xc06348=apiai(_0x4adb9c,{'language':_0x3f9a4e||'en'});return _0xc06348[_0x1ab1('0x58')](_0x4e9c39,{'sessionId':md5(_0x257d45)})[_0x1ab1('0x2c')](function(_0x267aff){logger[_0x1ab1('0x19')](JSON[_0x1ab1('0x42')](_0x267aff));return{'source':_0x267aff[_0x1ab1('0x59')][_0x1ab1('0x5a')],'resolvedQuery':_0x267aff[_0x1ab1('0x59')][_0x1ab1('0x5b')],'action':_0x267aff[_0x1ab1('0x59')][_0x1ab1('0x5c')],'actionIncomplete':_0x267aff[_0x1ab1('0x59')][_0x1ab1('0x5d')],'speech':_0x267aff[_0x1ab1('0x59')][_0x1ab1('0x5e')][_0x1ab1('0x5f')],'score':_0x267aff[_0x1ab1('0x59')][_0x1ab1('0x60')],'statusCode':_0x267aff[_0x1ab1('0x61')][_0x1ab1('0x62')],'endConversation':_0x267aff[_0x1ab1('0x59')][_0x1ab1('0x63')]['endConversation']||![],'isFallbackIntent':_0x267aff[_0x1ab1('0x59')]['metadata'][_0x1ab1('0x64')]};});};exports[_0x1ab1('0x65')]=function(_0x341c2c,_0x332cfd,_0x2991e4,_0x79667f,_0x26ca2e,_0x29e258){var _0x38ce23=_0x79667f[_0x1ab1('0x66')](/\\n/g,'\x0a');var _0x2babc7={'credentials':{'private_key':_0x38ce23,'client_email':_0x2991e4}};var _0x3d0c24=new dialogflow[(_0x1ab1('0x67'))](_0x2babc7);var _0x2fa7c7=_0x3d0c24[_0x1ab1('0x68')](_0x332cfd,md5(_0x341c2c));var _0xef690f={'session':_0x2fa7c7,'queryInput':{'text':{'text':_0x26ca2e,'languageCode':_0x29e258}}};return _0x3d0c24['detectIntent'](_0xef690f)['then'](function(_0x47d2f0){if(_0x47d2f0&&_0x47d2f0[_0x1ab1('0x48')]){logger[_0x1ab1('0x19')](_0x1ab1('0x69'),JSON[_0x1ab1('0x42')](_0x47d2f0));var _0x289431=_0x47d2f0[0x0];if(_0x289431){var _0x31534e={'action':_0x289431[_0x1ab1('0x6a')][_0x1ab1('0x5c')],'allRequiredParamsPresent':_0x289431['queryResult'][_0x1ab1('0x6b')],'endConversation':_0x289431[_0x1ab1('0x6a')][_0x1ab1('0x6c')]&&_0x289431['queryResult'][_0x1ab1('0x6c')][_0x1ab1('0x6d')]?_0x289431[_0x1ab1('0x6a')]['diagnosticInfo'][_0x1ab1('0x6d')][_0x1ab1('0x6e')][_0x1ab1('0x6f')]:![],'fulfillmentText':_0x289431[_0x1ab1('0x6a')][_0x1ab1('0x70')],'intentName':_0x289431['queryResult']['intent'][_0x1ab1('0x57')],'intentDisplayName':_0x289431[_0x1ab1('0x6a')][_0x1ab1('0x71')]['displayName'],'isFallbackIntent':_0x289431[_0x1ab1('0x6a')][_0x1ab1('0x71')][_0x1ab1('0x72')],'languageCode':_0x289431['queryResult'][_0x1ab1('0x73')],'queryText':_0x289431[_0x1ab1('0x6a')][_0x1ab1('0x74')],'responseId':_0x289431[_0x1ab1('0x75')],'score':_0x289431[_0x1ab1('0x6a')][_0x1ab1('0x76')],'speech':_0x289431[_0x1ab1('0x6a')]['fulfillmentText'],'providerResponse':JSON[_0x1ab1('0x42')](_0x47d2f0)};return _0x31534e;}}});};exports[_0x1ab1('0x77')]=function(_0x36f675,_0x357355,_0x2b7b7a,_0x5be41f){return tilde[_0x1ab1('0x4d')](_0x36f675,_0x357355,_0x2b7b7a,_0x5be41f)['then'](function(_0x17dda4){try{fs[_0x1ab1('0x1b')](_0x36f675);}catch(_0x19d541){logger[_0x1ab1('0x14')](_0x19d541);}logger[_0x1ab1('0x19')](_0x1ab1('0x78'),_0x17dda4[_0x1ab1('0x52')]);logger[_0x1ab1('0x19')](_0x1ab1('0x79'),_0x17dda4[_0x1ab1('0x54')]);return _0x17dda4;});};exports[_0x1ab1('0x7a')]=function(_0x33869a,_0x5e6ca6,_0x1f47ad,_0x25f821,_0x35f31b,_0x1c19dc){var _0x197652=path[_0x1ab1('0x26')](__dirname,_0x1ab1('0x27'),rs[_0x1ab1('0x28')](0x4)+'.mp3');var _0x47a19c;return aws[_0x1ab1('0x7b')](_0x33869a,_0x5e6ca6,_0x1f47ad,_0x25f821,_0x35f31b,_0x1c19dc,_0x197652)[_0x1ab1('0x2c')](function(){_0x47a19c=path[_0x1ab1('0x26')](__dirname,_0x1ab1('0x27'),rs['generate'](0x4)+'.wav');return convertFile(_0x197652,_0x47a19c);})[_0x1ab1('0x2c')](function(){try{fs[_0x1ab1('0x1b')](_0x197652);fs[_0x1ab1('0x3d')](_0x47a19c,_0x1ab1('0x2d'));}catch(_0x539ee8){logger[_0x1ab1('0x14')](_0x539ee8);}return _0x47a19c['split']('.')[0x0];});};exports[_0x1ab1('0x7c')]=function(_0xb6943,_0x969be9,_0x2e9615,_0x5d0dd8,_0x12b1e6,_0x1388e0){return aws[_0x1ab1('0x7d')](_0xb6943,_0x969be9,_0x2e9615,_0x5d0dd8,_0x12b1e6,_0x1388e0)['then'](function(_0x382fad){logger[_0x1ab1('0x19')](JSON[_0x1ab1('0x42')](_0x382fad));return _0x382fad;});};exports[_0x1ab1('0x7e')]=function(_0x281758,_0x3eba61,_0xc00e80,_0x53d28c){var _0x459d2a=util[_0x1ab1('0x7f')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x281758,encodeURIComponent(_0x3eba61),_0xc00e80,_0x53d28c);var _0x1ba0e9=path[_0x1ab1('0x26')](__dirname,_0x1ab1('0x27'),rs[_0x1ab1('0x28')](0x4)+'.mp3');var _0x19b92d;return downloadFile(_0x459d2a,_0x1ba0e9)[_0x1ab1('0x2c')](function(){_0x19b92d=path['resolve'](__dirname,_0x1ab1('0x27'),rs[_0x1ab1('0x28')](0x4)+_0x1ab1('0x29'));return convertFile(_0x1ba0e9,_0x19b92d);})['then'](function(){try{fs['unlink'](_0x1ba0e9);fs[_0x1ab1('0x3d')](_0x19b92d,_0x1ab1('0x2d'));}catch(_0x46ba6e){logger[_0x1ab1('0x14')](_0x46ba6e);}return _0x19b92d[_0x1ab1('0x2e')]('.')[0x0];});};exports[_0x1ab1('0x80')]=function(_0x4963c0,_0x8f9e9c,_0xc12a04,_0x382768){var _0x245aa8=util[_0x1ab1('0x7f')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x8f9e9c,_0xc12a04,base64Encode(_0x4963c0),_0x382768?util[_0x1ab1('0x7f')]('model=%s',encodeURIComponent(_0x382768)):_0x1ab1('0x81'));return uploadFile(_0x245aa8)[_0x1ab1('0x2c')](function(_0x58d8e8){return querystring[_0x1ab1('0xa')](_0x58d8e8);});};exports[_0x1ab1('0x82')]=function(_0x32cd71,_0x497e41){return sestek[_0x1ab1('0x83')](_0x32cd71,_0x497e41)[_0x1ab1('0x2c')](function(_0x2a7d23){logger[_0x1ab1('0x19')](JSON[_0x1ab1('0x42')](_0x2a7d23));var _0x2c9fae={'speech':_0x2a7d23[_0x1ab1('0x84')],'action':_0x2a7d23[_0x1ab1('0x85')]?_0x2a7d23[_0x1ab1('0x85')][_0x1ab1('0x86')]:undefined,'actiondata':_0x2a7d23[_0x1ab1('0x85')]?_0x2a7d23[_0x1ab1('0x85')][_0x1ab1('0x87')]:undefined};if(_0x2a7d23[_0x1ab1('0x85')]&&_0x2a7d23[_0x1ab1('0x85')][_0x1ab1('0x88')]){return base64Decode(_0x2a7d23[_0x1ab1('0x85')]['AudioFromTts'][_0x1ab1('0x89')],path[_0x1ab1('0x26')](__dirname,_0x1ab1('0x27'),rs[_0x1ab1('0x28')](0x4)+_0x1ab1('0x29')))[_0x1ab1('0x2c')](function(_0x1a13ca){_0x2c9fae[_0x1ab1('0x8a')]=_0x1a13ca;return _0x2c9fae;});}return _0x2c9fae;});};exports[_0x1ab1('0x8b')]=function(){return __dirname;}; \ No newline at end of file +var _0x129e=['error\x20convert','info','resolve','tmp','.wav','writeFileSync','base64','chmodSync','777','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','then','.mp3','audioContent','generate','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','jQ1olc','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','googleASR','uri','results','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','score','status','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','name','displayName','isFallback','languageCode','responseId','tildeASR','asr','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','format','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','https','querystring','request-promise','randomstring','google-tts-api','url','util','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','data','end','transcode'];(function(_0x58cb21,_0x4737cc){var _0x37e679=function(_0x154326){while(--_0x154326){_0x58cb21['push'](_0x58cb21['shift']());}};_0x37e679(++_0x4737cc);}(_0x129e,0xe9));var _0xe129=function(_0x4d2f07,_0x554643){_0x4d2f07=_0x4d2f07-0x0;var _0x1f518e=_0x129e[_0x4d2f07];return _0x1f518e;};'use strict';var apiai=require(_0xe129('0x0'));var BPromise=require(_0xe129('0x1'));var dialogflow=require(_0xe129('0x2'));var fs=require('fs');var http=require('http');var https=require(_0xe129('0x3'));var md5=require('md5');var path=require('path');var querystring=require(_0xe129('0x4'));var rp=require(_0xe129('0x5'));var rs=require(_0xe129('0x6'));var sox=require('sox');var tts=require(_0xe129('0x7'));var urlParse=require(_0xe129('0x8'))['parse'];var util=require(_0xe129('0x9'));var aws=require('./aws');var google=require(_0xe129('0xa'));var sestek=require(_0xe129('0xb'));var tilde=require(_0xe129('0xc'));var logger=require('../../../config/logger')(_0xe129('0xd'));var ISPEECH_API=_0xe129('0xe');function downloadFile(_0x48ea70,_0x15340d){return new BPromise(function(_0x4f8c14,_0xa809fe){var _0x34499d=urlParse(_0x48ea70);var _0x4448c6=_0x34499d[_0xe129('0xf')]===_0xe129('0x10')?https:http;var _0x5955f4={'host':_0x34499d[_0xe129('0x11')],'path':_0x34499d[_0xe129('0x12')],'headers':{'user-agent':_0xe129('0x13')}};_0x4448c6[_0xe129('0x14')](_0x5955f4,function(_0x52c79f){if(_0x52c79f[_0xe129('0x15')]!==0xc8){logger['error'](_0xe129('0x16')+_0x48ea70+_0xe129('0x17')+_0x52c79f['statusCode']+'\x20('+_0x52c79f[_0xe129('0x18')]+')');_0xa809fe(new Error('request\x20to\x20'+_0x48ea70+'\x20failed,\x20status\x20code\x20=\x20'+_0x52c79f['statusCode']+'\x20('+_0x52c79f[_0xe129('0x18')]+')'));return;}var _0x126a64=fs[_0xe129('0x19')](_0x15340d);_0x126a64['on']('finish',function(){logger['info'](_0xe129('0x1a'));_0x126a64[_0xe129('0x1b')](_0x4f8c14);});_0x126a64['on'](_0xe129('0x1c'),function(_0x36d0ed){fs[_0xe129('0x1d')](_0x15340d);logger[_0xe129('0x1c')](_0xe129('0x1e'),_0x36d0ed);_0xa809fe(_0x36d0ed);});_0x52c79f[_0xe129('0x1f')](_0x126a64);})['on'](_0xe129('0x1c'),function(_0x51e9b3){logger['error'](_0x51e9b3);_0xa809fe(_0x51e9b3);})['end']();});}function uploadFile(_0x5e63d5){return new BPromise(function(_0x18da3b,_0x323cce){var _0x472382=urlParse(_0x5e63d5);var _0x39f600=_0x472382[_0xe129('0xf')]==='https:'?https:http;var _0x540452={'host':_0x472382[_0xe129('0x11')],'path':_0x472382[_0xe129('0x12')],'headers':{'user-agent':_0xe129('0x13')}};_0x39f600[_0xe129('0x14')](_0x540452,function(_0x3fa38c){if(_0x3fa38c[_0xe129('0x15')]!==0xc8){_0x323cce(new Error(_0xe129('0x16')+_0x5e63d5+_0xe129('0x17')+_0x3fa38c[_0xe129('0x15')]+'\x20('+_0x3fa38c['statusMessage']+')'));return;}var _0x3ce3a2='';_0x3fa38c['on'](_0xe129('0x20'),function(_0x270f52){_0x3ce3a2+=_0x270f52;});_0x3fa38c['on']('end',function(){_0x18da3b(_0x3ce3a2);});})['on'](_0xe129('0x1c'),function(_0x323d6a){_0x323cce(_0x323d6a);})[_0xe129('0x21')]();});}function convertFile(_0x536ebd,_0x2f0cab){return new BPromise(function(_0x2539ff,_0x59c6e0){var _0x4d9742=sox[_0xe129('0x22')](_0x536ebd,_0x2f0cab,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4d9742['on'](_0xe129('0x1c'),function(_0x36c2d2){logger[_0xe129('0x1c')](_0xe129('0x23'),_0x36c2d2);_0x59c6e0(_0x36c2d2);});_0x4d9742['on'](_0xe129('0x21'),function(){logger[_0xe129('0x24')]('finish\x20to\x20convert');_0x2539ff();});_0x4d9742['start']();});}function base64Decode(_0x37a4e9,_0x49464f){var _0x57f719=path[_0xe129('0x25')](__dirname,_0xe129('0x26'),rs['generate'](0x4)+_0xe129('0x27'));fs[_0xe129('0x28')](_0x57f719,_0x37a4e9,_0xe129('0x29'));return convertFile(_0x57f719,_0x49464f)['then'](function(){try{fs['unlink'](_0x57f719);fs[_0xe129('0x2a')](_0x49464f,_0xe129('0x2b'));}catch(_0x50f38d){logger[_0xe129('0x1c')](_0x50f38d);}return _0x49464f['split']('.')[0x0];});}function base64Encode(_0x2220c2){var _0x25803c=fs['readFileSync'](_0x2220c2);return new Buffer(_0x25803c)[_0xe129('0x2c')]('base64');}exports[_0xe129('0x2d')]=function(_0x3fe74c,_0x213bce,_0x5b421b,_0x33c2d1,_0x3e0cff,_0x9bd25a){var _0x16bb32,_0x412f59;var _0x3fb1eb=_0xe129('0x2e');var _0x30e625=_0xe129('0x2f')+_0x3fe74c;var _0x2cf0d8={};if(_0x213bce==='ssml'){_0x2cf0d8[_0xe129('0x30')]={'ssml':_0x5b421b};}else{_0x2cf0d8[_0xe129('0x30')]={'text':_0x5b421b};};_0x2cf0d8[_0xe129('0x31')]={'languageCode':_0x33c2d1,'ssmlGender':_0x3e0cff};_0x2cf0d8[_0xe129('0x32')]={'audioEncoding':_0xe129('0x33'),'sampleRateHertz':0x1f40};var _0x5e7cd0={'url':_0x3fb1eb+_0xe129('0x34')+_0x30e625,'method':_0xe129('0x35'),'json':!![],'body':_0x2cf0d8};return rp(_0x5e7cd0)[_0xe129('0x36')](function(_0x1229a4){return new BPromise(function(_0x38c8e,_0xd7df2){_0x16bb32=path['resolve'](__dirname,_0xe129('0x26'),rs['generate'](0x4)+_0xe129('0x37'));var _0x4b1684=Buffer['from'](_0x1229a4[_0xe129('0x38')],_0xe129('0x29'));return fs['writeFile'](_0x16bb32,_0x4b1684,function(_0x2973d7){_0xd7df2(_0x2973d7);},function(_0x418184){fs[_0xe129('0x2a')](_0x16bb32,_0xe129('0x2b'));_0x38c8e(_0x418184);});});})['then'](function(_0x40eee8){_0x412f59=path[_0xe129('0x25')](__dirname,'tmp',rs[_0xe129('0x39')](0x4)+_0xe129('0x27'));return convertFile(_0x16bb32,_0x412f59);})[_0xe129('0x36')](function(){try{fs['unlink'](_0x16bb32);fs[_0xe129('0x2a')](_0x412f59,_0xe129('0x2b'));}catch(_0x3845bd){logger[_0xe129('0x1c')](_0x3845bd);}logger[_0xe129('0x24')](_0xe129('0x3a'),_0x412f59[_0xe129('0x3b')]('.')[0x0]);return _0x412f59[_0xe129('0x3b')]('.')[0x0];});};exports[_0xe129('0x3c')]=function(_0x548784,_0x3d0ea5){var _0x9a6a6=_0xe129('0x3d');var _0x14ba93,_0xf7471b;var _0xa3c2a3;var _0x177d0b={'encoding':_0xe129('0x3e'),'method':_0xe129('0x35'),'timeout':0x2710,'url':_0x9a6a6,'headers':{'Content-Type':_0xe129('0x3f')},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0xe129('0x40'),JSON[_0xe129('0x41')]([_0x548784,_0x3d0ea5||'en',![],_0xe129('0x42')]),null,_0xe129('0x43')]]]))};return rp(_0x177d0b)[_0xe129('0x36')](function(_0x1bcbf0){try{_0xa3c2a3=eval(_0x1bcbf0[_0xe129('0x44')](0x5))[0x0][0x2];}catch(_0x488643){throw new Error(_0xe129('0x45')+_0x1bcbf0[_0xe129('0x20')]);}if(!_0xa3c2a3){if(_0x548784[_0xe129('0x46')]>0xc8){throw new Error(_0xe129('0x47'));}else{throw new Error(_0xe129('0x48')+_0x3d0ea5+'\x22\x20might\x20not\x20exist');}}try{_0xa3c2a3=eval(_0xa3c2a3)[0x0];}catch(_0x3d1be5){throw new Error(_0xe129('0x45')+res['data']);}const _0x2dc912=_0xa3c2a3;_0x14ba93=path[_0xe129('0x25')](__dirname,_0xe129('0x26'),rs[_0xe129('0x39')](0x4)+_0xe129('0x37'));fs[_0xe129('0x28')](_0x14ba93,_0xa3c2a3,{'encoding':'base64'});_0xf7471b=path[_0xe129('0x25')](__dirname,_0xe129('0x26'),rs[_0xe129('0x39')](0x4)+'.wav');return convertFile(_0x14ba93,_0xf7471b);})[_0xe129('0x36')](function(){try{fs[_0xe129('0x1d')](_0x14ba93);fs[_0xe129('0x2a')](_0xf7471b,_0xe129('0x2b'));}catch(_0x553f88){logger[_0xe129('0x1c')](_0x553f88);}logger[_0xe129('0x24')](_0xe129('0x49'),_0xf7471b[_0xe129('0x3b')]('.')[0x0]);return _0xf7471b[_0xe129('0x3b')]('.')[0x0];});};exports[_0xe129('0x4a')]=function(_0x4e1954,_0x3d8ff5,_0x1c9c0c){return google['asr'](_0x4e1954,_0x3d8ff5,_0x1c9c0c)[_0xe129('0x36')](function(_0x438928){logger[_0xe129('0x24')](_0x438928[_0xe129('0x4b')]);return rp(_0x438928);})[_0xe129('0x36')](function(_0x4feb37){var _0x3f15fc='';var _0x589c09=0x0;try{fs[_0xe129('0x1d')](_0x4e1954);}catch(_0x420d68){logger[_0xe129('0x1c')](_0x420d68);}if(_0x4feb37&&_0x4feb37[_0xe129('0x4c')]){_0x3f15fc=_0x4feb37[_0xe129('0x4c')]['map'](function(_0xf58bfb){return _0xf58bfb&&_0xf58bfb[_0xe129('0x4d')][0x0]&&_0xf58bfb['alternatives'][0x0][_0xe129('0x4e')]?_0xf58bfb[_0xe129('0x4d')][0x0][_0xe129('0x4e')]:'';})[_0xe129('0x4f')]('\x0a');_0x589c09=_0x4feb37[_0xe129('0x4c')]['map'](function(_0x58fb68){return _0x58fb68&&_0x58fb68['alternatives'][0x0]&&_0x58fb68['alternatives'][0x0][_0xe129('0x50')]?_0x58fb68[_0xe129('0x4d')][0x0][_0xe129('0x50')]:0x0;})[_0xe129('0x4f')]('\x0a');}logger[_0xe129('0x24')](_0xe129('0x51'),_0x3f15fc);logger[_0xe129('0x24')]('googleASR\x20confidence',_0x589c09);return{'transcript':_0x3f15fc,'confidence':_0x589c09};})[_0xe129('0x52')](function(_0x4ca141){logger[_0xe129('0x1c')](_0xe129('0x53'),_0x4ca141[_0xe129('0x15')],_0x4ca141['name'],_0x4ca141[_0xe129('0x54')]);});};exports[_0xe129('0x55')]=function(_0x5f0e38,_0x26ee89,_0x5aecf0,_0x4ef207){var _0x470527=apiai(_0x26ee89,{'language':_0x4ef207||'en'});return _0x470527[_0xe129('0x56')](_0x5aecf0,{'sessionId':md5(_0x5f0e38)})[_0xe129('0x36')](function(_0x400280){logger[_0xe129('0x24')](JSON[_0xe129('0x41')](_0x400280));return{'source':_0x400280[_0xe129('0x57')][_0xe129('0x58')],'resolvedQuery':_0x400280['result'][_0xe129('0x59')],'action':_0x400280[_0xe129('0x57')][_0xe129('0x5a')],'actionIncomplete':_0x400280['result'][_0xe129('0x5b')],'speech':_0x400280[_0xe129('0x57')]['fulfillment']['speech'],'score':_0x400280[_0xe129('0x57')][_0xe129('0x5c')],'statusCode':_0x400280[_0xe129('0x5d')]['code'],'endConversation':_0x400280[_0xe129('0x57')][_0xe129('0x5e')][_0xe129('0x5f')]||![],'isFallbackIntent':_0x400280['result'][_0xe129('0x5e')][_0xe129('0x60')]};});};exports[_0xe129('0x61')]=function(_0x4c20aa,_0x283ff5,_0x32cca2,_0x50cb74,_0x52f57e,_0xf51d6f){var _0x165a85=_0x50cb74[_0xe129('0x62')](/\\n/g,'\x0a');var _0x26c67e={'credentials':{'private_key':_0x165a85,'client_email':_0x32cca2}};var _0x31635c=new dialogflow[(_0xe129('0x63'))](_0x26c67e);var _0x198ca6=_0x31635c['sessionPath'](_0x283ff5,md5(_0x4c20aa));var _0x1b6a54={'session':_0x198ca6,'queryInput':{'text':{'text':_0x52f57e,'languageCode':_0xf51d6f}}};return _0x31635c['detectIntent'](_0x1b6a54)[_0xe129('0x36')](function(_0x439069){if(_0x439069&&_0x439069[_0xe129('0x46')]){logger[_0xe129('0x24')]('Dialogflow\x20V2\x20response:',JSON[_0xe129('0x41')](_0x439069));var _0x390d82=_0x439069[0x0];if(_0x390d82){var _0x5d9456={'action':_0x390d82[_0xe129('0x64')]['action'],'allRequiredParamsPresent':_0x390d82[_0xe129('0x64')][_0xe129('0x65')],'endConversation':_0x390d82['queryResult'][_0xe129('0x66')]&&_0x390d82[_0xe129('0x64')][_0xe129('0x66')][_0xe129('0x67')]?_0x390d82[_0xe129('0x64')]['diagnosticInfo'][_0xe129('0x67')]['end_conversation'][_0xe129('0x68')]:![],'fulfillmentText':_0x390d82[_0xe129('0x64')][_0xe129('0x69')],'intentName':_0x390d82[_0xe129('0x64')][_0xe129('0x6a')][_0xe129('0x6b')],'intentDisplayName':_0x390d82[_0xe129('0x64')][_0xe129('0x6a')][_0xe129('0x6c')],'isFallbackIntent':_0x390d82[_0xe129('0x64')]['intent'][_0xe129('0x6d')],'languageCode':_0x390d82[_0xe129('0x64')][_0xe129('0x6e')],'queryText':_0x390d82[_0xe129('0x64')]['queryText'],'responseId':_0x390d82[_0xe129('0x6f')],'score':_0x390d82[_0xe129('0x64')]['intentDetectionConfidence'],'speech':_0x390d82[_0xe129('0x64')][_0xe129('0x69')],'providerResponse':JSON['stringify'](_0x439069)};return _0x5d9456;}}});};exports[_0xe129('0x70')]=function(_0x120585,_0x3a283b,_0x53a151,_0x4dbab7){return tilde[_0xe129('0x71')](_0x120585,_0x3a283b,_0x53a151,_0x4dbab7)[_0xe129('0x36')](function(_0x3a85b2){try{fs[_0xe129('0x1d')](_0x120585);}catch(_0x303d97){logger[_0xe129('0x1c')](_0x303d97);}logger[_0xe129('0x24')]('Tilde\x20ASR\x20transcription',_0x3a85b2[_0xe129('0x4e')]);logger[_0xe129('0x24')](_0xe129('0x72'),_0x3a85b2['confidence']);return _0x3a85b2;});};exports[_0xe129('0x73')]=function(_0x63ba4d,_0x436a00,_0x59ada9,_0x3abc9b,_0x2295e4,_0x3aa90d){var _0x4ffeba=path['resolve'](__dirname,_0xe129('0x26'),rs[_0xe129('0x39')](0x4)+'.mp3');var _0x116f44;return aws[_0xe129('0x74')](_0x63ba4d,_0x436a00,_0x59ada9,_0x3abc9b,_0x2295e4,_0x3aa90d,_0x4ffeba)['then'](function(){_0x116f44=path[_0xe129('0x25')](__dirname,_0xe129('0x26'),rs['generate'](0x4)+'.wav');return convertFile(_0x4ffeba,_0x116f44);})[_0xe129('0x36')](function(){try{fs['unlink'](_0x4ffeba);fs[_0xe129('0x2a')](_0x116f44,'777');}catch(_0x3a6a16){logger['error'](_0x3a6a16);}return _0x116f44[_0xe129('0x3b')]('.')[0x0];});};exports[_0xe129('0x75')]=function(_0x4351ef,_0x164f07,_0x23cc65,_0x203d9d,_0x5aac29,_0x3985a4){return aws['lex'](_0x4351ef,_0x164f07,_0x23cc65,_0x203d9d,_0x5aac29,_0x3985a4)['then'](function(_0x2edc44){logger[_0xe129('0x24')](JSON['stringify'](_0x2edc44));return _0x2edc44;});};exports[_0xe129('0x76')]=function(_0x365606,_0x5289f6,_0x450fac,_0x1be4a2){var _0x2dd4ae=util['format'](_0xe129('0x77'),ISPEECH_API,_0x365606,encodeURIComponent(_0x5289f6),_0x450fac,_0x1be4a2);var _0x1d9890=path[_0xe129('0x25')](__dirname,'tmp',rs[_0xe129('0x39')](0x4)+_0xe129('0x37'));var _0x5ce7de;return downloadFile(_0x2dd4ae,_0x1d9890)['then'](function(){_0x5ce7de=path['resolve'](__dirname,_0xe129('0x26'),rs[_0xe129('0x39')](0x4)+_0xe129('0x27'));return convertFile(_0x1d9890,_0x5ce7de);})[_0xe129('0x36')](function(){try{fs[_0xe129('0x1d')](_0x1d9890);fs[_0xe129('0x2a')](_0x5ce7de,'777');}catch(_0xe60c){logger[_0xe129('0x1c')](_0xe60c);}return _0x5ce7de[_0xe129('0x3b')]('.')[0x0];});};exports[_0xe129('0x78')]=function(_0x1f615d,_0x5f205a,_0x35335a,_0x349313){var _0x7e647f=util['format'](_0xe129('0x79'),ISPEECH_API,_0x5f205a,_0x35335a,base64Encode(_0x1f615d),_0x349313?util[_0xe129('0x7a')](_0xe129('0x7b'),encodeURIComponent(_0x349313)):_0xe129('0x7c'));return uploadFile(_0x7e647f)[_0xe129('0x36')](function(_0x17b29c){return querystring[_0xe129('0x7d')](_0x17b29c);});};exports[_0xe129('0x7e')]=function(_0x4c46d8,_0x54e436){return sestek[_0xe129('0x7f')](_0x4c46d8,_0x54e436)[_0xe129('0x36')](function(_0x1d4fcd){logger[_0xe129('0x24')](JSON[_0xe129('0x41')](_0x1d4fcd));var _0x5b5247={'speech':_0x1d4fcd[_0xe129('0x80')],'action':_0x1d4fcd[_0xe129('0x81')]?_0x1d4fcd[_0xe129('0x81')][_0xe129('0x82')]:undefined,'actiondata':_0x1d4fcd[_0xe129('0x81')]?_0x1d4fcd[_0xe129('0x81')]['CustomActionData']:undefined};if(_0x1d4fcd['channelData']&&_0x1d4fcd['channelData'][_0xe129('0x83')]){return base64Decode(_0x1d4fcd['channelData']['AudioFromTts'][_0xe129('0x84')],path[_0xe129('0x25')](__dirname,_0xe129('0x26'),rs['generate'](0x4)+_0xe129('0x27')))[_0xe129('0x36')](function(_0xffbd7e){_0x5b5247[_0xe129('0x85')]=_0xffbd7e;return _0x5b5247;});}return _0x5b5247;});};exports['dirName']=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 3e9a1bd..6e578ed 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 _0x8ace=['./nda','exports'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x8ace,0xfe));var _0xe8ac=function(_0x20e764,_0x19811d){_0x20e764=_0x20e764-0x0;var _0x4ebc22=_0x8ace[_0x20e764];return _0x4ebc22;};var nda=require(_0xe8ac('0x0'));module[_0xe8ac('0x1')]={'nda':nda}; \ No newline at end of file +var _0xc0ae=['exports'];(function(_0xfaea1a,_0x20bcb7){var _0x1eb6b3=function(_0x1c07c5){while(--_0x1c07c5){_0xfaea1a['push'](_0xfaea1a['shift']());}};_0x1eb6b3(++_0x20bcb7);}(_0xc0ae,0x192));var _0xec0a=function(_0x31e32b,_0x2fb1ee){_0x31e32b=_0x31e32b-0x0;var _0x3a6f2f=_0xc0ae[_0x31e32b];return _0x3a6f2f;};var nda=require('./nda');module[_0xec0a('0x0')]={'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 a2c0ced..dd4d9cd 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 _0x43dc=['stringify','url','../../../../../config/logger','agi','exports','resolve','ndauth_url','/token','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','calleridname','dnid','extension','text','access_token','project','body','ProjectName','ndagenerate_audio','audio/wav','custom_action','channelData','CustomAction','CustomActionData','custom_action_data','info'];(function(_0x5cca9f,_0x154684){var _0x55edda=function(_0x115aa2){while(--_0x115aa2){_0x5cca9f['push'](_0x5cca9f['shift']());}};_0x55edda(++_0x154684);}(_0x43dc,0xa9));var _0xc43d=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x43dc[_0x4a53d];return _0x27410e;};'use strict';var rp=require('request-promise');var url=require(_0xc43d('0x0'));var logger=require(_0xc43d('0x1'))(_0xc43d('0x2'));module[_0xc43d('0x3')]=function(_0x202d9b,_0x52f9c7){var _0x22b4fe={'method':'POST','uri':url[_0xc43d('0x4')](_0x52f9c7[_0xc43d('0x5')],_0xc43d('0x6')),'form':{'grant_type':'password','username':_0x52f9c7['username'],'password':_0x52f9c7['password']},'json':!![]};return rp(_0x22b4fe)['then'](function(_0x1e8732){var _0x563bf2={'method':_0xc43d('0x7'),'uri':url['resolve'](_0x52f9c7[_0xc43d('0x8')],_0xc43d('0x9')),'body':{'type':_0x52f9c7[_0xc43d('0xa')]||'message','channelId':'Nda','conversation':{'id':_0x202d9b['uniqueid']},'from':{'id':_0x202d9b['callerid'],'name':_0x202d9b[_0xc43d('0xb')]},'recipient':{'id':_0x202d9b[_0xc43d('0xc')],'name':_0x202d9b[_0xc43d('0xd')]},'text':_0x52f9c7[_0xc43d('0xe')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x1e8732[_0xc43d('0xf')]},'json':!![]};if(_0x52f9c7[_0xc43d('0x10')]){_0x563bf2[_0xc43d('0x11')]['channelData'][_0xc43d('0x12')]=_0x52f9c7['project'];}if(_0x52f9c7[_0xc43d('0x13')]=='1'){_0x563bf2['body']['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xc43d('0x14')};}if(_0x52f9c7[_0xc43d('0x15')]){_0x563bf2[_0xc43d('0x11')][_0xc43d('0x16')][_0xc43d('0x17')]=_0x52f9c7['custom_action'];if(_0x52f9c7['custom_action_data']){_0x563bf2['body'][_0xc43d('0x16')][_0xc43d('0x18')]=_0x52f9c7[_0xc43d('0x19')];}}logger[_0xc43d('0x1a')](JSON[_0xc43d('0x1b')](_0x563bf2));return rp(_0x563bf2);});}; \ No newline at end of file +var _0xa3b7=['exports','POST','resolve','ndauth_url','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','extension','Bearer\x20','access_token','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','stringify','request-promise','../../../../../config/logger'];(function(_0x3cd457,_0x39ee33){var _0x572caf=function(_0x3194a0){while(--_0x3194a0){_0x3cd457['push'](_0x3cd457['shift']());}};_0x572caf(++_0x39ee33);}(_0xa3b7,0xe6));var _0x7a3b=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0xa3b7[_0x54a761];return _0x37d1da;};'use strict';var rp=require(_0x7a3b('0x0'));var url=require('url');var logger=require(_0x7a3b('0x1'))('agi');module[_0x7a3b('0x2')]=function(_0x27902a,_0x348cb3){var _0x161431={'method':_0x7a3b('0x3'),'uri':url[_0x7a3b('0x4')](_0x348cb3[_0x7a3b('0x5')],'/token'),'form':{'grant_type':_0x7a3b('0x6'),'username':_0x348cb3[_0x7a3b('0x7')],'password':_0x348cb3[_0x7a3b('0x6')]},'json':!![]};return rp(_0x161431)[_0x7a3b('0x8')](function(_0x63f93d){var _0x560f45={'method':_0x7a3b('0x3'),'uri':url['resolve'](_0x348cb3[_0x7a3b('0x9')],_0x7a3b('0xa')),'body':{'type':_0x348cb3[_0x7a3b('0xb')]||_0x7a3b('0xc'),'channelId':_0x7a3b('0xd'),'conversation':{'id':_0x27902a[_0x7a3b('0xe')]},'from':{'id':_0x27902a['callerid'],'name':_0x27902a[_0x7a3b('0xf')]},'recipient':{'id':_0x27902a[_0x7a3b('0x10')],'name':_0x27902a[_0x7a3b('0x11')]},'text':_0x348cb3['text'],'channelData':{}},'headers':{'Authorization':_0x7a3b('0x12')+_0x63f93d[_0x7a3b('0x13')]},'json':!![]};if(_0x348cb3['project']){_0x560f45[_0x7a3b('0x14')][_0x7a3b('0x15')][_0x7a3b('0x16')]=_0x348cb3['project'];}if(_0x348cb3[_0x7a3b('0x17')]=='1'){_0x560f45[_0x7a3b('0x14')][_0x7a3b('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x7a3b('0x18')};}if(_0x348cb3[_0x7a3b('0x19')]){_0x560f45['body'][_0x7a3b('0x15')][_0x7a3b('0x1a')]=_0x348cb3[_0x7a3b('0x19')];if(_0x348cb3['custom_action_data']){_0x560f45[_0x7a3b('0x14')][_0x7a3b('0x15')]['CustomActionData']=_0x348cb3[_0x7a3b('0x1b')];}}logger['info'](JSON[_0x7a3b('0x1c')](_0x560f45));return rp(_0x560f45);});}; \ 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 14cd10d..fe54c33 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 _0x844d=['exports'];(function(_0x29250c,_0x1645ff){var _0x3364f5=function(_0x240811){while(--_0x240811){_0x29250c['push'](_0x29250c['shift']());}};_0x3364f5(++_0x1645ff);}(_0x844d,0x104));var _0xd844=function(_0x28d7b5,_0x1305a4){_0x28d7b5=_0x28d7b5-0x0;var _0x1ed035=_0x844d[_0x28d7b5];return _0x1ed035;};'use strict';var asr=require('./lib/api');module[_0xd844('0x0')]=function(_0xaee2aa,_0x284226,_0x1f4939,_0x185d01){return asr(_0xaee2aa,_0x284226,_0x1f4939,_0x185d01);}; \ No newline at end of file +var _0x2a4e=['./lib/api'];(function(_0x4bf9aa,_0xafa1ec){var _0x1db38a=function(_0x44540e){while(--_0x44540e){_0x4bf9aa['push'](_0x4bf9aa['shift']());}};_0x1db38a(++_0xafa1ec);}(_0x2a4e,0xf4));var _0xe2a4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2a4e[_0x321bb2];return _0x9c12ed;};'use strict';var asr=require(_0xe2a4('0x0'));module['exports']=function(_0x2d4c23,_0x2729a4,_0x56fac9,_0x45a4d6){return asr(_0x2d4c23,_0x2729a4,_0x56fac9,_0x45a4d6);}; \ 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 820d69f..f7a6957 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 _0xf96c=['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','createHash','sha1','update','digest','hex','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','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','bluebird','moment','crypto','../../../../../../config/logger','agi','exports'];(function(_0x527c87,_0x3ddd5b){var _0x530bd9=function(_0x267cea){while(--_0x267cea){_0x527c87['push'](_0x527c87['shift']());}};_0x530bd9(++_0x3ddd5b);}(_0xf96c,0x1e6));var _0xcf96=function(_0x330047,_0x379f70){_0x330047=_0x330047-0x0;var _0x2c72a1=_0xf96c[_0x330047];return _0x2c72a1;};'use strict';var BPromise=require(_0xcf96('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xcf96('0x1'));var crypto=require(_0xcf96('0x2'));var logger=require(_0xcf96('0x3'))(_0xcf96('0x4'));module[_0xcf96('0x5')]=function(_0xe4e434,_0x5b1974,_0x1f7e85,_0x161f3e){return new BPromise(function(_0x4b41f0,_0xde475){logger[_0xcf96('0x6')]('Tilde\x20URI',_0x161f3e||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x11c431=new WebSocket(_0x161f3e||_0xcf96('0x7'),{'perMessageDeflate':![]});var _0x14c5e5='';var _0x24de44='0';var _0xe63840='1';var _0x4b0d0a=_0xcf96('0x8');function _0x579881(_0x472379){var _0x19e80d=crypto[_0xcf96('0x9')](_0xcf96('0xa'));_0x19e80d[_0xcf96('0xb')](_0x472379);return _0x19e80d[_0xcf96('0xc')](_0xcf96('0xd'));}function _0x1003ba(){try{logger[_0xcf96('0x6')]('Open\x20Tilde\x20ASR\x20socket');var _0x1ebc16=moment()[_0xcf96('0xe')]();var _0x18f2ac=_0x579881(_0x1ebc16+_0x5b1974+_0x1f7e85);_0x11c431[_0xcf96('0xf')](JSON[_0xcf96('0x10')]({'appID':_0x5b1974,'timestamp':_0x1ebc16,'appKey':_0x18f2ac}));var _0x3bede5=fs[_0xcf96('0x11')](_0xe4e434);_0x3bede5['on'](_0xcf96('0x12'),function(_0x10b1cf){_0x11c431[_0xcf96('0xf')](_0x10b1cf);});_0x3bede5['on'](_0xcf96('0x13'),function(){_0x11c431['send'](_0xcf96('0x14'));});}catch(_0xe4902d){logger[_0xcf96('0x15')](_0xcf96('0x16'),JSON[_0xcf96('0x10')](_0xe4902d));_0x11c431[_0xcf96('0x17')]();}}function _0xcb7ab4(_0x37fee1){try{if(_0x37fee1){var _0x317ad5=JSON[_0xcf96('0x18')](_0x37fee1);switch(_0x317ad5[_0xcf96('0x19')]){case 0x0:if(_0x317ad5[_0xcf96('0x1a')]){if(_0x317ad5[_0xcf96('0x1a')][_0xcf96('0x1b')]){logger[_0xcf96('0x6')](_0xcf96('0x1c'),JSON['stringify'](_0x317ad5[_0xcf96('0x1a')][_0xcf96('0x1d')]));_0x14c5e5=_0x317ad5[_0xcf96('0x1a')]['hypotheses'][0x0][_0xcf96('0x1e')];_0x24de44=_0x317ad5[_0xcf96('0x1a')][_0xcf96('0x1d')][0x0][_0xcf96('0x1f')];_0xe63840='0';_0x4b0d0a='Success.';_0x11c431[_0xcf96('0x17')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0xe63840='1';_0x4b0d0a=_0xcf96('0x8');break;case 0x2:logger[_0xcf96('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0xe63840='2';_0x4b0d0a=_0xcf96('0x20');break;case 0x9:logger[_0xcf96('0x6')](_0xcf96('0x21'));_0xe63840='9';_0x4b0d0a=_0xcf96('0x21');break;case 0xa:logger[_0xcf96('0x6')](_0xcf96('0x22'));_0xe63840='10';_0x4b0d0a=_0xcf96('0x22');break;case 0xb:logger['info'](_0xcf96('0x23'));_0xe63840='11';_0x4b0d0a=_0xcf96('0x23');}}}catch(_0x2f64ae){logger[_0xcf96('0x15')](_0xcf96('0x24'),JSON[_0xcf96('0x10')](_0x2f64ae));_0x11c431['terminate']();}}function _0xeb7b97(){logger[_0xcf96('0x6')](_0xcf96('0x25'));_0x4b41f0({'transcript':_0x14c5e5,'confidence':_0x24de44,'status':_0xe63840,'status_message':_0x4b0d0a});}function _0x40e578(_0xffc133){logger['error'](_0xcf96('0x26'));if(!_[_0xcf96('0x27')](_0xffc133)){logger['error'](_[_0xcf96('0x28')](_0xffc133)?JSON[_0xcf96('0x10')](_0xffc133):_0xffc133);}}_0x11c431['on']('open',_0x1003ba);_0x11c431['on']('message',_0xcb7ab4);_0x11c431['on'](_0xcf96('0x13'),_0xeb7b97);_0x11c431['on']('error',_0x40e578);});}; \ No newline at end of file +var _0xee41=['bluebird','lodash','moment','crypto','../../../../../../config/logger','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','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','send','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','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','stringify','isNil','open','message'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xee41,0x7b));var _0x1ee4=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0xee41[_0x3f0b30];return _0x2748a5;};'use strict';var BPromise=require(_0x1ee4('0x0'));var _=require(_0x1ee4('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x1ee4('0x2'));var crypto=require(_0x1ee4('0x3'));var logger=require(_0x1ee4('0x4'))(_0x1ee4('0x5'));module[_0x1ee4('0x6')]=function(_0x5457ea,_0x5edc46,_0x13ad59,_0x47b377){return new BPromise(function(_0x200ed9,_0x2ff66c){logger[_0x1ee4('0x7')](_0x1ee4('0x8'),_0x47b377||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x242f2f=new WebSocket(_0x47b377||_0x1ee4('0x9'),{'perMessageDeflate':![]});var _0x4d10f5='';var _0x30285c='0';var _0x218523='1';var _0x1fa473=_0x1ee4('0xa');function _0x37dcd9(_0x3241ba){var _0x2c1ee4=crypto['createHash'](_0x1ee4('0xb'));_0x2c1ee4[_0x1ee4('0xc')](_0x3241ba);return _0x2c1ee4[_0x1ee4('0xd')](_0x1ee4('0xe'));}function _0xc46ab2(){try{logger['info'](_0x1ee4('0xf'));var _0x4424ac=moment()['unix']();var _0x1b2cd5=_0x37dcd9(_0x4424ac+_0x5edc46+_0x13ad59);_0x242f2f[_0x1ee4('0x10')](JSON['stringify']({'appID':_0x5edc46,'timestamp':_0x4424ac,'appKey':_0x1b2cd5}));var _0x2e53a9=fs[_0x1ee4('0x11')](_0x5457ea);_0x2e53a9['on'](_0x1ee4('0x12'),function(_0x5c968c){_0x242f2f[_0x1ee4('0x10')](_0x5c968c);});_0x2e53a9['on'](_0x1ee4('0x13'),function(){_0x242f2f[_0x1ee4('0x10')](_0x1ee4('0x14'));});}catch(_0x28fe3b){logger[_0x1ee4('0x15')](_0x1ee4('0x16'),JSON['stringify'](_0x28fe3b));_0x242f2f[_0x1ee4('0x17')]();}}function _0x4e380c(_0x2d3ad9){try{if(_0x2d3ad9){var _0x40314b=JSON[_0x1ee4('0x18')](_0x2d3ad9);switch(_0x40314b[_0x1ee4('0x19')]){case 0x0:if(_0x40314b[_0x1ee4('0x1a')]){if(_0x40314b[_0x1ee4('0x1a')]['final']){logger['info'](_0x1ee4('0x1b'),JSON['stringify'](_0x40314b['result']['hypotheses']));_0x4d10f5=_0x40314b[_0x1ee4('0x1a')][_0x1ee4('0x1c')][0x0][_0x1ee4('0x1d')];_0x30285c=_0x40314b[_0x1ee4('0x1a')][_0x1ee4('0x1c')][0x0][_0x1ee4('0x1e')];_0x218523='0';_0x1fa473=_0x1ee4('0x1f');_0x242f2f['terminate']();}}break;case 0x1:logger[_0x1ee4('0x7')](_0x1ee4('0xa'));_0x218523='1';_0x1fa473=_0x1ee4('0xa');break;case 0x2:logger[_0x1ee4('0x7')](_0x1ee4('0x20'));_0x218523='2';_0x1fa473=_0x1ee4('0x20');break;case 0x9:logger[_0x1ee4('0x7')](_0x1ee4('0x21'));_0x218523='9';_0x1fa473=_0x1ee4('0x21');break;case 0xa:logger['info'](_0x1ee4('0x22'));_0x218523='10';_0x1fa473=_0x1ee4('0x22');break;case 0xb:logger[_0x1ee4('0x7')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x218523='11';_0x1fa473=_0x1ee4('0x23');}}}catch(_0x2f52ce){logger['error'](_0x1ee4('0x24'),JSON[_0x1ee4('0x25')](_0x2f52ce));_0x242f2f['terminate']();}}function _0x520be2(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x200ed9({'transcript':_0x4d10f5,'confidence':_0x30285c,'status':_0x218523,'status_message':_0x1fa473});}function _0x5df5f8(_0x5cd228){logger[_0x1ee4('0x15')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x1ee4('0x26')](_0x5cd228)){logger['error'](_['isObject'](_0x5cd228)?JSON['stringify'](_0x5cd228):_0x5cd228);}}_0x242f2f['on'](_0x1ee4('0x27'),_0xc46ab2);_0x242f2f['on'](_0x1ee4('0x28'),_0x4e380c);_0x242f2f['on'](_0x1ee4('0x13'),_0x520be2);_0x242f2f['on'](_0x1ee4('0x15'),_0x5df5f8);});}; \ 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 c2e167a..8d63ba3 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 _0x1c45=['./asr','exports'];(function(_0x2cbf68,_0x30ff82){var _0x764f61=function(_0x43aa86){while(--_0x43aa86){_0x2cbf68['push'](_0x2cbf68['shift']());}};_0x764f61(++_0x30ff82);}(_0x1c45,0x1b0));var _0x51c4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1c45[_0xa464c9];return _0x3d73c4;};var asr=require(_0x51c4('0x0'));module[_0x51c4('0x1')]={'asr':asr}; \ No newline at end of file +var _0x3c7e=['exports','./asr'];(function(_0xc0c817,_0x3174a0){var _0x41947d=function(_0x4e50a2){while(--_0x4e50a2){_0xc0c817['push'](_0xc0c817['shift']());}};_0x41947d(++_0x3174a0);}(_0x3c7e,0xbf));var _0xe3c7=function(_0x3aaf97,_0x4fa2e8){_0x3aaf97=_0x3aaf97-0x0;var _0xeba75e=_0x3c7e[_0x3aaf97];return _0xeba75e;};var asr=require(_0xe3c7('0x0'));module[_0xe3c7('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 9b7fb6a..48c073b 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 _0x46fc=['getConnections','destroy','ready','E_AGI_SERVER_ERROR','close','nextTick','exports','util','net','events','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x4b0cc7,_0x38fdc4){var _0x48cfc5=function(_0x227f8f){while(--_0x227f8f){_0x4b0cc7['push'](_0x4b0cc7['shift']());}};_0x48cfc5(++_0x38fdc4);}(_0x46fc,0x103));var _0xc46f=function(_0xdd66e5,_0x579918){_0xdd66e5=_0xdd66e5-0x0;var _0x2146bc=_0x46fc[_0xdd66e5];return _0x2146bc;};'use strict';var util=require(_0xc46f('0x0'));var net=require(_0xc46f('0x1'));var EventEmitter=require(_0xc46f('0x2'))[_0xc46f('0x3')];var AGIError=require(_0xc46f('0x4'));var AGIChannel=require(_0xc46f('0x5'));var AGIServer=function(_0x2bf9ee,_0x24058a,_0x3a56db){var _0x5b0483=this,_0x2bf9ee=_0x2bf9ee||0x11dd,_0x24058a=_0x24058a||_0xc46f('0x6'),_0x176c6f=null,_0x30ca8d=0x0;EventEmitter[_0xc46f('0x7')](_0x5b0483);function _0x312101(){if(!_0x2bf9ee){_0x5b0483[_0xc46f('0x8')](_0xc46f('0x9'),new AGIError(_0xc46f('0xa')));return![];}_0x176c6f=net[_0xc46f('0xb')]();_0x176c6f[_0xc46f('0xc')](_0x2bf9ee,_0x24058a);_0x176c6f['on'](_0xc46f('0xd'),function(){_0x5b0483[_0xc46f('0x8')](_0xc46f('0xd'));});_0x176c6f['on']('connection',function(_0x3b438d){_0x176c6f[_0xc46f('0xe')](function(_0x32e9fe,_0x14e547){if(_0x32e9fe){_0x5b0483['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0x32e9fe));}else if(_0x3a56db&&_0x3a56db<0x0){_0x5b0483[_0xc46f('0x8')](_0xc46f('0x9'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x3b438d[_0xc46f('0xf')]();}else if(_0x3a56db&&_0x3a56db>0x0&&_0x3a56db<_0x14e547){_0x30ca8d+=0x1;_0x5b0483[_0xc46f('0x8')]('error',new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x30ca8d));_0x3b438d[_0xc46f('0xf')]();}else{var _0x3df6a8=new AGIChannel(_0x3b438d);_0x3df6a8['on'](_0xc46f('0x10'),function(){_0x5b0483[_0xc46f('0x8')]('connection',_0x3df6a8);});}});});_0x176c6f['on']('error',function(_0x47d923){_0x5b0483[_0xc46f('0x8')](_0xc46f('0x9'),new AGIError(_0xc46f('0x11'),_0x47d923['code']));});_0x176c6f['on'](_0xc46f('0x12'),function(){_0x5b0483[_0xc46f('0x8')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0xc46f('0x13')](function(){_0x312101();});};util['inherits'](AGIServer,EventEmitter);module[_0xc46f('0x14')]=function(_0x14d1f5,_0x37026a,_0x5d2b90){return new AGIServer(_0x14d1f5,_0x37026a,_0x5d2b90);}; \ No newline at end of file +var _0xed95=['./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','listening','connection','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','close','exports','util','net','events','EventEmitter','./error'];(function(_0x34457b,_0x202cf1){var _0x1dd5d5=function(_0x7c009b){while(--_0x7c009b){_0x34457b['push'](_0x34457b['shift']());}};_0x1dd5d5(++_0x202cf1);}(_0xed95,0xb9));var _0x5ed9=function(_0x33edc4,_0x23fc0f){_0x33edc4=_0x33edc4-0x0;var _0xbf6543=_0xed95[_0x33edc4];return _0xbf6543;};'use strict';var util=require(_0x5ed9('0x0'));var net=require(_0x5ed9('0x1'));var EventEmitter=require(_0x5ed9('0x2'))[_0x5ed9('0x3')];var AGIError=require(_0x5ed9('0x4'));var AGIChannel=require(_0x5ed9('0x5'));var AGIServer=function(_0x453f85,_0x3e2272,_0x2a28e9){var _0x7b84d6=this,_0x453f85=_0x453f85||0x11dd,_0x3e2272=_0x3e2272||_0x5ed9('0x6'),_0x52a57d=null,_0x48efa8=0x0;EventEmitter[_0x5ed9('0x7')](_0x7b84d6);function _0x2fe2dd(){if(!_0x453f85){_0x7b84d6[_0x5ed9('0x8')](_0x5ed9('0x9'),new AGIError(_0x5ed9('0xa')));return![];}_0x52a57d=net['createServer']();_0x52a57d['listen'](_0x453f85,_0x3e2272);_0x52a57d['on'](_0x5ed9('0xb'),function(){_0x7b84d6[_0x5ed9('0x8')](_0x5ed9('0xb'));});_0x52a57d['on'](_0x5ed9('0xc'),function(_0x526924){_0x52a57d['getConnections'](function(_0x28e087,_0x144e86){if(_0x28e087){_0x7b84d6[_0x5ed9('0x8')](_0x5ed9('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x28e087));}else if(_0x2a28e9&&_0x2a28e9<0x0){_0x7b84d6[_0x5ed9('0x8')](_0x5ed9('0x9'),new AGIError(_0x5ed9('0xd')));_0x526924['destroy']();}else if(_0x2a28e9&&_0x2a28e9>0x0&&_0x2a28e9<_0x144e86){_0x48efa8+=0x1;_0x7b84d6['emit'](_0x5ed9('0x9'),new AGIError(_0x5ed9('0xe'),_0x48efa8));_0x526924['destroy']();}else{var _0x2cfd87=new AGIChannel(_0x526924);_0x2cfd87['on'](_0x5ed9('0xf'),function(){_0x7b84d6['emit']('connection',_0x2cfd87);});}});});_0x52a57d['on'](_0x5ed9('0x9'),function(_0x37dcf2){_0x7b84d6['emit'](_0x5ed9('0x9'),new AGIError(_0x5ed9('0x10'),_0x37dcf2['code']));});_0x52a57d['on'](_0x5ed9('0x11'),function(){_0x7b84d6[_0x5ed9('0x8')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process['nextTick'](function(){_0x2fe2dd();});};util['inherits'](AGIServer,EventEmitter);module[_0x5ed9('0x12')]=function(_0x409a26,_0x3892d8,_0x44b8ca){return new AGIServer(_0x409a26,_0x3892d8,_0x44b8ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 7790857..7c3cf1b 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 _0xa65f=['ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeechTTS','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','getPause','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20selected','PLAYBACK','Executed\x20command\x20%s\x20%s','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','no\x20url\x20configured','restAPI','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','number','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','Smtp','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','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','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','path','shelljs','odbc','randomstring','moment','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','channel','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','rpc','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','interval','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','priority','file','createSquareMessage','uniqueid','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','timeout','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','url','stringify','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','Amy','aws_text_type','awsLex','googleASR','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','includes','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','toString','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','result','grammar','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','createCmContact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','Dialogflow\x20Result\x20%s','speech','dialogflowV2','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','DIALOGFLOW_%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','ndauth_url','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','sesteknda','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','getSound','no\x20file\x20audio\x20found','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','out','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s'];(function(_0xa8e822,_0x3288ce){var _0x5e1e13=function(_0x2a65b3){while(--_0x2a65b3){_0xa8e822['push'](_0xa8e822['shift']());}};_0x5e1e13(++_0x3288ce);}(_0xa65f,0x7c));var _0xfa65=function(_0x468c57,_0x2607bf){_0x468c57=_0x468c57-0x0;var _0x5ce052=_0xa65f[_0x468c57];return _0x5ce052;};'use strict';var fs=require('fs');var path=require(_0xfa65('0x0'));var util=require('util');var _=require('lodash');var sh=require(_0xfa65('0x1'));var odbc=require(_0xfa65('0x2'))();var rs=require(_0xfa65('0x3'));var moment=require(_0xfa65('0x4'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0xfa65('0x5'))(_0xfa65('0x6'));var config=require('../../config/environment');var scripts=require(_0xfa65('0x7'));var FILES_PATH=_0xfa65('0x8');var recursiveMapAttributes=[_0xfa65('0x9'),_0xfa65('0xa')];var verticesWithRetry=['menu','getdigits','getsecretdigits'];var AGIVertices=function(_0x4ff49d,_0xe39d22,_0x20a5eb){this[_0xfa65('0xb')]=_0x4ff49d;this['rpc']=_0xe39d22;this[_0xfa65('0xc')]=_0x20a5eb;};AGIVertices[_0xfa65('0xd')][_0xfa65('0xe')]=function(_0x3a3672,_0x28fb85){this['rpc'][_0xfa65('0xf')](_0x3a3672)[_0xfa65('0x10')](function(_0x3d2ca5){_0x28fb85(null,_0x3d2ca5?_0x3d2ca5['name']:![]);})[_0xfa65('0x11')](function(_0x4dba91){_0x28fb85(_0x4dba91);});};AGIVertices[_0xfa65('0xd')][_0xfa65('0x12')]=function(_0x50fe79,_0x128f6a){this['rpc'][_0xfa65('0x13')](_0x50fe79)[_0xfa65('0x10')](function(_0x18b31b){_0x128f6a(null,_0x18b31b?_0x18b31b[_0xfa65('0x14')]:![]);})['catch'](function(_0x3ca0d3){_0x128f6a(_0x3ca0d3);});};AGIVertices['prototype']['getSquareProject']=function(_0x298c1e,_0x5184aa){this[_0xfa65('0x15')][_0xfa65('0x16')](_0x298c1e)[_0xfa65('0x10')](function(_0x3f2900){_0x5184aa(null,_0x3f2900?_0x3f2900[_0xfa65('0x14')]:![]);})[_0xfa65('0x11')](function(_0x279844){_0x5184aa(_0x279844);});};AGIVertices[_0xfa65('0xd')][_0xfa65('0x17')]=function(_0x1019c4,_0x126063){this[_0xfa65('0x15')][_0xfa65('0x18')](_0x1019c4)[_0xfa65('0x10')](function(_0x2a127b){_0x126063(null,_0x2a127b?_0x2a127b[_0xfa65('0x19')]:![]);})[_0xfa65('0x11')](function(_0x2601fe){_0x126063(_0x2601fe);});};AGIVertices[_0xfa65('0xd')][_0xfa65('0x1a')]=function(_0x44fee7,_0x2c09e6){this[_0xfa65('0x15')][_0xfa65('0x1b')](_0x44fee7)['then'](function(_0x191cda){_0x2c09e6(null,_0x191cda?_0x191cda[_0xfa65('0x14')]:![]);})[_0xfa65('0x11')](function(_0x30fb1e){_0x2c09e6(_0x30fb1e);});};AGIVertices[_0xfa65('0xd')][_0xfa65('0x1c')]=function(_0x49770b,_0x5a6747){this['rpc']['getTrunkById'](_0x49770b)[_0xfa65('0x10')](function(_0x36a8d5){_0x5a6747(null,_0x36a8d5?_0x36a8d5['name']:![]);})['catch'](function(_0x4b9f32){_0x5a6747(_0x4b9f32);});};AGIVertices['prototype']['getSound']=function(_0x1f65a8,_0x51ce3b){var _0x5307c5=this;this['rpc'][_0xfa65('0x1d')](_0x1f65a8)[_0xfa65('0x10')](function(_0x12e281){_0x51ce3b(null,_0x12e281?_0x5307c5[_0xfa65('0x1e')](_0x12e281[_0xfa65('0x1f')]):![]);})[_0xfa65('0x11')](function(_0x574f81){_0x51ce3b(_0x574f81);});};AGIVertices[_0xfa65('0xd')][_0xfa65('0x20')]=function(_0x1a8151,_0x58adeb){this[_0xfa65('0x15')]['getMailAccountById'](_0x1a8151)[_0xfa65('0x10')](function(_0x173b60){_0x58adeb(null,_0x173b60?_0x173b60:![]);})[_0xfa65('0x11')](function(_0x431224){_0x58adeb(_0x431224);});};AGIVertices['prototype']['sendMailMessage']=function(_0x43a19f,_0x356b5a,_0x4a19fb){this[_0xfa65('0xc')][_0xfa65('0x21')](_0x43a19f,_0x356b5a)['then'](function(){_0x4a19fb(null);})['catch'](function(_0x5e5f4c){_0x4a19fb(_0x5e5f4c);});};AGIVertices['prototype'][_0xfa65('0x22')]=function(_0x2d0900,_0x5a085e){this[_0xfa65('0x15')][_0xfa65('0x23')](_0x2d0900)[_0xfa65('0x10')](function(_0x232047){if(_0x232047){if(_0x232047['IntervalId']){_0x5a085e(null,[_0x232047[_0xfa65('0x24')]]);}else{_0x5a085e(null,_['map'](_0x232047[_0xfa65('0x25')],'interval'));}}else{_0x5a085e(null,![]);}})[_0xfa65('0x11')](function(_0x23d7ad){_0x5a085e(_0x23d7ad);});};AGIVertices[_0xfa65('0xd')]['getSoundPath']=function(_0x21f953){return util[_0xfa65('0x26')](_0xfa65('0x27'),FILES_PATH,_0x21f953);};AGIVertices[_0xfa65('0xd')][_0xfa65('0x28')]=function(_0x343194,_0x575918,_0x222e5b){odbc[_0xfa65('0x29')](_0x343194,function(_0x1a7cf8){if(_0x1a7cf8){logger[_0xfa65('0x2a')](_0xfa65('0x2b'),_0x1a7cf8);_0x222e5b(_0x1a7cf8);}else{logger[_0xfa65('0x2c')](_0xfa65('0x2d'));odbc[_0xfa65('0x2e')](_0x575918,function(_0x157759,_0x24db38){if(_0x157759){logger[_0xfa65('0x2c')](_0xfa65('0x2f'),_0x575918);_0x222e5b(_0x157759);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x575918);odbc[_0xfa65('0x30')](function(_0x518b65){if(_0x518b65){logger['error'](_0xfa65('0x31'),_0x518b65);}_0x222e5b(null,_0x24db38);});}});}});};AGIVertices['prototype'][_0xfa65('0x32')]=function(_0x45c57f,_0x523a1c){this[_0xfa65('0x15')]['getSmsAccountById'](_0x45c57f)[_0xfa65('0x10')](function(_0x41e698){_0x523a1c(null,_0x41e698?_0x41e698:![]);})[_0xfa65('0x11')](function(_0x5cd6ee){_0x523a1c(_0x5cd6ee);});};AGIVertices[_0xfa65('0xd')][_0xfa65('0x33')]=function(_0x29ae18,_0x3052ff){this[_0xfa65('0x15')][_0xfa65('0x33')](_0x29ae18)['then'](function(_0x504460){_0x3052ff(null,_0x504460);})[_0xfa65('0x11')](function(_0x3f6b27){_0x3052ff(_0x3f6b27);});};AGIVertices[_0xfa65('0xd')][_0xfa65('0x34')]=function(_0x3e3418,_0x26dd87,_0x3f4428){this[_0xfa65('0x15')][_0xfa65('0x34')]({'uniqueid':this[_0xfa65('0xb')]['uniqueid'],'node':_0x3e3418[_0xfa65('0x35')],'application':_0x3e3418[_0xfa65('0x36')],'data':_0x26dd87||null,'project_name':this['channel'][_0xfa65('0x37')],'callerid':this['channel'][_0xfa65('0x38')]})[_0xfa65('0x10')](function(_0x5c986d){if(_0x3f4428){_0x3f4428(null,_0x5c986d);}})['catch'](function(_0x545032){if(_0x3f4428){_0x3f4428(_0x545032);}});};AGIVertices[_0xfa65('0xd')][_0xfa65('0x39')]=function(_0x1b34a5,_0x2c76a2,_0x7a2b5d,_0x5c17bb){this[_0xfa65('0x15')][_0xfa65('0x39')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0xfa65('0xb')][_0xfa65('0x38')],'calleridname':this[_0xfa65('0xb')][_0xfa65('0x3a')],'context':this[_0xfa65('0xb')]['context'],'extension':this[_0xfa65('0xb')][_0xfa65('0x3b')],'priority':this['channel'][_0xfa65('0x3c')],'accountcode':this[_0xfa65('0xb')]['accountcode'],'dnid':this[_0xfa65('0xb')]['dnid'],'projectName':this['channel'][_0xfa65('0x37')],'saveName':_0x2c76a2,'filename':_0x1b34a5[_0xfa65('0x3d')]||_0x2c76a2,'savePath':_0x7a2b5d})[_0xfa65('0x10')](function(_0x4b4dbd){_0x5c17bb(null,_0x4b4dbd);})[_0xfa65('0x11')](function(_0x4ada58){_0x5c17bb(_0x4ada58);});};AGIVertices['prototype'][_0xfa65('0x3e')]=function(_0x5cdfc9,_0x28c4d7,_0x35c981,_0x4dd969,_0x387b85){this[_0xfa65('0x15')][_0xfa65('0x3e')]({'uniqueid':this[_0xfa65('0xb')][_0xfa65('0x3f')],'body':_0x5cdfc9,'direction':_0x28c4d7,'providerName':_0x35c981,'providerResponse':_0x4dd969})['then'](function(_0x49014b){if(_0x387b85){_0x387b85(null,_0x49014b);}})['catch'](function(_0xe0b28b){if(_0x387b85){_0x387b85(_0xe0b28b);}});};AGIVertices[_0xfa65('0xd')]['createCmContact']=function(_0x2c1c62,_0x3de940){this[_0xfa65('0x15')]['createCmContact']({'firstName':_['isEmpty'](_0x2c1c62[_0xfa65('0x14')])||_[_0xfa65('0x40')](_0x2c1c62[_0xfa65('0x14')])?_0xfa65('0x41')+Math[_0xfa65('0x42')]():_0x2c1c62[_0xfa65('0x14')],'lastName':_[_0xfa65('0x43')](_0x2c1c62['lastName'])||_[_0xfa65('0x40')](_0x2c1c62[_0xfa65('0x44')])?null:_0x2c1c62[_0xfa65('0x44')],'phone':_0x2c1c62[_0xfa65('0x45')],'ListId':_0x2c1c62[_0xfa65('0x46')],'scheduledat':_0x2c1c62[_0xfa65('0x47')],'callbackUniqueid':this[_0xfa65('0xb')]['uniqueid'],'tags':_0xfa65('0x48'),'description':_0xfa65('0x49')+_0x2c1c62[_0xfa65('0x47')]['toString'](),'priority':_0x2c1c62['callback_priority']})[_0xfa65('0x10')](function(_0x4b3d2f){_0x3de940(null,_0x4b3d2f);})[_0xfa65('0x11')](function(_0x489f6e){_0x3de940(_0x489f6e);});};AGIVertices['prototype']['getPause']=function(_0x52a241,_0x2c5312){this[_0xfa65('0x15')][_0xfa65('0x4a')](_0x52a241)[_0xfa65('0x10')](function(_0x5c99fd){_0x2c5312(null,_0x5c99fd?_0x5c99fd[_0xfa65('0x14')]:![]);})[_0xfa65('0x11')](function(_0x88ba5b){_0x2c5312(_0x88ba5b);});};AGIVertices['prototype'][_0xfa65('0x4b')]=function(_0x322443,_0x6e232e,_0x189aea){var _0x162f2d={'role':_0xfa65('0x4c')};_0x162f2d[_0x322443]=this['channel']['callerid'];this[_0xfa65('0x15')]['agentPause'](_0x162f2d,_0x6e232e,this[_0xfa65('0xb')][_0xfa65('0x3f')])['then'](function(_0x288c0f){_0x189aea(null,_[_0xfa65('0x40')](_0x288c0f)?![]:!![]);})['catch'](function(_0x5780ce){logger[_0xfa65('0x2a')](_0x5780ce);_0x189aea(null,![]);});};AGIVertices['prototype'][_0xfa65('0x4d')]=function(_0x2b963d,_0x313f4d){var _0x2623c3={'role':'agent'};_0x2623c3[_0x2b963d]=this['channel'][_0xfa65('0x38')];this['rpc'][_0xfa65('0x4d')](_0x2623c3)['then'](function(_0x56f831){_0x313f4d(null,_[_0xfa65('0x40')](_0x56f831)?![]:!![]);})['catch'](function(_0x37591c){logger[_0xfa65('0x2a')](_0x37591c);_0x313f4d(null,![]);});};AGIVertices[_0xfa65('0xd')]['agentLogout']=function(_0x4d1044,_0x55b96d){var _0x1237a0={'role':'agent'};_0x1237a0[_0x4d1044]=this[_0xfa65('0xb')][_0xfa65('0x38')];this[_0xfa65('0x15')][_0xfa65('0x4e')](_0x1237a0)[_0xfa65('0x10')](function(_0x522ea3){_0x55b96d(null,_['isNil'](_0x522ea3)?![]:!![]);})[_0xfa65('0x11')](function(_0x3ec811){logger[_0xfa65('0x2a')](_0x3ec811);_0x55b96d(null,![]);});};AGIVertices['prototype'][_0xfa65('0x4f')]=function(_0x2a03f6,_0x557c53){var _0x5321a5={'role':_0xfa65('0x4c')};_0x5321a5[_0x2a03f6]=this[_0xfa65('0xb')][_0xfa65('0x38')];var _0x4e39b0=_0x2a03f6!='internal'?util[_0xfa65('0x26')](_0xfa65('0x50'),_0xfa65('0x51'),this['channel']['callerid']):undefined;this[_0xfa65('0x15')][_0xfa65('0x4f')](_0x5321a5,_0x4e39b0)[_0xfa65('0x10')](function(_0x1c40d7){_0x557c53(null,_[_0xfa65('0x40')](_0x1c40d7)?![]:!![]);})[_0xfa65('0x11')](function(_0x109347){logger[_0xfa65('0x2a')](_0x109347);_0x557c53(null,![]);});};AGIVertices[_0xfa65('0xd')][_0xfa65('0x52')]=function(_0x34cf2b,_0x58d730){sh['exec'](_[_0xfa65('0x53')](_0x34cf2b),function(_0x2cb447,_0x134f4f){var _0x599328=_0x134f4f[_0xfa65('0x54')](/(\r\n|\n|\r)/gm,'');_0x58d730(null,_0x599328);});};AGIVertices[_0xfa65('0xd')][_0xfa65('0x55')]=function(_0x15c747,_0x3b63c6){scripts[_0xfa65('0x55')](_0x15c747[_0xfa65('0x56')],_0x15c747[_0xfa65('0x57')]||'text',_0x15c747[_0xfa65('0x58')],_0x15c747[_0xfa65('0x59')]||_0xfa65('0x5a'),_0x15c747[_0xfa65('0x5b')]||_0xfa65('0x5c'),_0x15c747[_0xfa65('0x5d')]||_0xfa65('0x5e'))[_0xfa65('0x10')](function(_0x2b0ce4){_0x3b63c6(null,_0x2b0ce4);})['catch'](function(_0x312b2e){_0x3b63c6(_0x312b2e);});};AGIVertices[_0xfa65('0xd')][_0xfa65('0x5f')]=function(_0x5e4627,_0x30a242){scripts[_0xfa65('0x5f')](_0x5e4627[_0xfa65('0x58')],_0x5e4627[_0xfa65('0x60')]||'en',0x1)[_0xfa65('0x10')](function(_0x118641){_0x30a242(null,_0x118641);})['catch'](function(_0x366c84){_0x30a242(_0x366c84);});};AGIVertices[_0xfa65('0xd')]['restAPI']=function(_0x226a80,_0x2f6340){var _0x180f4b={'uri':_0x226a80['url'],'method':_0x226a80['method'],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x226a80['timeout'])==='number'&&parseInt(_0x226a80[_0xfa65('0x61')])>=0x1?parseInt(_0x226a80[_0xfa65('0x61')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0xfa65('0x62')],_0x180f4b['method'][_0xfa65('0x63')]())){try{_0x180f4b[_0xfa65('0x64')]=_0x226a80[_0xfa65('0xa')]?JSON[_0xfa65('0x65')](_0x226a80[_0xfa65('0xa')]):{};}catch(_0x46ba0d){logger['error'](_0xfa65('0x66'),_0x46ba0d);}}try{_0x180f4b[_0xfa65('0x67')]=_0x226a80[_0xfa65('0x9')]?JSON[_0xfa65('0x65')](_0x226a80[_0xfa65('0x9')]):{};}catch(_0x3975f0){logger['error'](_0xfa65('0x68'),_0x3975f0);}if(_0x226a80[_0xfa65('0x69')]){try{var _0x23a5c3=require(_0x226a80[_0xfa65('0x69')])['sync'](this,_0x180f4b);_0x180f4b[_0xfa65('0x6a')]=Mustache[_0xfa65('0x6b')](_0x226a80[_0xfa65('0x6c')],_0x23a5c3,{},['$$','$$']);if(_0x180f4b[_0xfa65('0x67')]){_0x180f4b[_0xfa65('0x67')]=JSON[_0xfa65('0x65')](Mustache[_0xfa65('0x6b')](JSON[_0xfa65('0x6d')](_0x180f4b[_0xfa65('0x67')]),_0x23a5c3,{},['$$','$$']));}if(_0x180f4b['body']){_0x180f4b['body']=JSON['parse'](Mustache[_0xfa65('0x6b')](JSON[_0xfa65('0x6d')](_0x180f4b[_0xfa65('0x64')]),_0x23a5c3,{},['$$','$$']));}}catch(_0x5b307c){logger[_0xfa65('0x2a')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5b307c);}}rp(_0x180f4b)['then'](function(_0x4fe6f1){var _0x2d7c3c={'statusCode':_0x4fe6f1[_0xfa65('0x6e')]||0xc8,'statusMessage':_0x4fe6f1[_0xfa65('0x6f')]||'OK','headers':_0x4fe6f1['headers']||{},'body':_0x4fe6f1[_0xfa65('0x64')]||{}};_0x2f6340(null,_0x2d7c3c);})[_0xfa65('0x11')](function(_0xc4fda5){var _0x16a01b={'statusCode':_0xc4fda5['statusCode']||0x1f4,'statusMessage':_0xc4fda5[_0xfa65('0x70')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0xc4fda5[_0xfa65('0x71')]['headers']||{},'body':_0xc4fda5[_0xfa65('0x71')][_0xfa65('0x64')]||{}};_0x2f6340(null,_0x16a01b);});};AGIVertices[_0xfa65('0xd')]['googleDialogflow']=function(_0x12d451,_0x4a5a5d){scripts[_0xfa65('0x72')](this[_0xfa65('0xb')][_0xfa65('0x3f')],_0x12d451[_0xfa65('0x73')],_0x12d451[_0xfa65('0x58')],_0x12d451[_0xfa65('0x74')]||'en')[_0xfa65('0x10')](function(_0x2b0628){_0x4a5a5d(null,_0x2b0628);})[_0xfa65('0x11')](function(_0x4539fe){_0x4a5a5d(_0x4539fe);});};AGIVertices[_0xfa65('0xd')][_0xfa65('0x75')]=function(_0x12c50c,_0x31c297){scripts[_0xfa65('0x75')](this[_0xfa65('0xb')][_0xfa65('0x3f')],_0x12c50c['dialogflowV2_project_id'],_0x12c50c[_0xfa65('0x76')],_0x12c50c[_0xfa65('0x77')],_0x12c50c['text'],_0x12c50c[_0xfa65('0x78')]||'en')[_0xfa65('0x10')](function(_0x4b135b){_0x31c297(null,_0x4b135b);})[_0xfa65('0x11')](function(_0x431c3e){_0x31c297(_0x431c3e);});};AGIVertices[_0xfa65('0xd')][_0xfa65('0x79')]=function(_0x4644b9,_0x56159e){scripts['sestekNDA'](this['channel'],_0x4644b9)[_0xfa65('0x10')](function(_0x4be997){_0x56159e(null,_0x4be997);})[_0xfa65('0x11')](function(_0x298f1f){_0x56159e(_0x298f1f);});};AGIVertices[_0xfa65('0xd')]['ispeechTTS']=function(_0x53cd4e,_0x45995d){scripts['ispeechTTS'](_0x53cd4e['key'],_0x53cd4e[_0xfa65('0x58')],_0x53cd4e[_0xfa65('0x7a')]||_0xfa65('0x5a'),_0x53cd4e[_0xfa65('0x7b')])[_0xfa65('0x10')](function(_0x4db250){_0x45995d(null,_0x4db250);})[_0xfa65('0x11')](function(_0x3d521d){_0x45995d(_0x3d521d);});};AGIVertices[_0xfa65('0xd')]['ispeechASR']=function(_0x452ad9,_0x5c81ae,_0xacd0d5){scripts[_0xfa65('0x7c')](_0x5c81ae,_0x452ad9[_0xfa65('0x73')],_0x452ad9[_0xfa65('0x7d')]||_0xfa65('0x5a'),this[_0xfa65('0x7e')](_0x452ad9[_0xfa65('0x7f')])?_0x452ad9[_0xfa65('0x7f')]:undefined)['then'](function(_0x3bbb30){_0xacd0d5(null,_0x3bbb30);})[_0xfa65('0x11')](function(_0x3589a6){_0xacd0d5(_0x3589a6);});};AGIVertices[_0xfa65('0xd')][_0xfa65('0x80')]=function(_0x3ff3eb,_0x29cfe4){scripts['awsPolly'](_0x3ff3eb[_0xfa65('0x81')],_0x3ff3eb[_0xfa65('0x82')],_0x3ff3eb['aws_polly_region'],_0x3ff3eb['aws_polly_voice']||_0xfa65('0x83'),_0x3ff3eb[_0xfa65('0x58')],_0x3ff3eb[_0xfa65('0x84')]||_0xfa65('0x58'))[_0xfa65('0x10')](function(_0x3af9b2){_0x29cfe4(null,_0x3af9b2);})[_0xfa65('0x11')](function(_0x5658f0){_0x29cfe4(_0x5658f0);});};AGIVertices[_0xfa65('0xd')][_0xfa65('0x85')]=function(_0x3e20c6,_0x1fb9bc){scripts[_0xfa65('0x85')](this['channel'][_0xfa65('0x3f')],_0x3e20c6[_0xfa65('0x81')],_0x3e20c6['aws_secret_access_key'],_0x3e20c6['aws_lex_region'],_0x3e20c6[_0xfa65('0x58')],_0x3e20c6['aws_bot_name'])[_0xfa65('0x10')](function(_0x57e056){_0x1fb9bc(null,_0x57e056);})[_0xfa65('0x11')](function(_0x113ddd){_0x1fb9bc(_0x113ddd);});};AGIVertices[_0xfa65('0xd')]['googleASR']=function(_0x50058c,_0x392d1f,_0x33cc26){scripts[_0xfa65('0x86')](_0x392d1f,_0x50058c[_0xfa65('0x73')],_0x50058c['google_asr_language']||_0xfa65('0x5a'))['then'](function(_0x4aa2c3){_0x33cc26(null,_0x4aa2c3);})[_0xfa65('0x11')](function(_0x41105c){_0x33cc26(_0x41105c);});};AGIVertices['prototype'][_0xfa65('0x87')]=function(_0x89cf,_0xa29b48,_0x1e46e1){scripts[_0xfa65('0x87')](_0xa29b48,_0x89cf['appid'],_0x89cf[_0xfa65('0x88')],_0x89cf['uri'])[_0xfa65('0x10')](function(_0x5d2e82){_0x1e46e1(null,_0x5d2e82);})['catch'](function(_0x4ec1e6){_0x1e46e1(_0x4ec1e6);});};AGIVertices[_0xfa65('0xd')][_0xfa65('0x89')]=function(_0x5aad4c){var _0x5d46b6=_['includes'](verticesWithRetry,_0x5aad4c[_0xfa65('0x36')])?_0x5aad4c:_[_0xfa65('0x8a')](_0x5aad4c);for(var _0x3cc575 in _0x5d46b6){if(_0x5d46b6[_0xfa65('0x8b')](_0x3cc575)){if(_0x5d46b6[_0x3cc575]&&_[_0xfa65('0x8c')](_0x5d46b6[_0x3cc575])){if(_[_0xfa65('0x8d')](recursiveMapAttributes,_0x3cc575)){_0x5d46b6[_0x3cc575]=this[_0xfa65('0x8e')](_0x5d46b6[_0x3cc575]);}else{_0x5d46b6[_0x3cc575]=this[_0xfa65('0x8f')](_0x5d46b6[_0x3cc575]);}}}}return _0x5d46b6;};AGIVertices['prototype'][_0xfa65('0x90')]=function(_0x48a9cc){for(var _0x10a35f in _0x48a9cc){if(_0x48a9cc['hasOwnProperty'](_0x10a35f)){if(_[_0xfa65('0x91')](_0x48a9cc[_0x10a35f])){this[_0xfa65('0x90')](_0x48a9cc[_0x10a35f]);}else if(_[_0xfa65('0x92')](_0x48a9cc[_0x10a35f])){for(var _0x158c6e=0x0;_0x158c6e<_0x48a9cc[_0x10a35f][_0xfa65('0x93')];_0x158c6e++){this[_0xfa65('0x90')](_0x48a9cc[_0x10a35f][_0x158c6e]);}}else if(_[_0xfa65('0x8c')](_0x48a9cc[_0x10a35f])){_0x48a9cc[_0x10a35f]=this[_0xfa65('0x8f')](_0x48a9cc[_0x10a35f]);}}}};AGIVertices[_0xfa65('0xd')][_0xfa65('0x94')]=function(_0x5371ed,_0x4a44aa){for(var _0x157c01 in _0x5371ed){if(_0x5371ed['hasOwnProperty'](_0x157c01)){if(_[_0xfa65('0x91')](_0x5371ed[_0x157c01])){if(!_['isEmpty'](_0x5371ed[_0x157c01])){this[_0xfa65('0x94')](_0x5371ed[_0x157c01],util['format'](_0xfa65('0x95'),_0x4a44aa,_0x157c01));}}else if(_[_0xfa65('0x92')](_0x5371ed[_0x157c01])){for(var _0x49af7c=0x0;_0x49af7c<_0x5371ed[_0x157c01][_0xfa65('0x93')];_0x49af7c++){this[_0xfa65('0x94')](_0x5371ed[_0x157c01][_0x49af7c],util[_0xfa65('0x26')](_0xfa65('0x95'),_0x4a44aa,_0x157c01+'['+_0x49af7c+']'));}}else{if(!_[_0xfa65('0x40')](_0x5371ed[_0x157c01])){this[_0xfa65('0xb')][_0xfa65('0x96')](util[_0xfa65('0x26')](_0xfa65('0x95'),_0x4a44aa,_0x157c01),_0x5371ed[_0x157c01]);}}}}};AGIVertices[_0xfa65('0xd')][_0xfa65('0x8e')]=function(_0x2cb425){try{var _0x37951f=JSON[_0xfa65('0x65')](_0x2cb425);this[_0xfa65('0x90')](_0x37951f);return JSON[_0xfa65('0x6d')](_0x37951f);}catch(_0x1c4fcc){return this[_0xfa65('0x8f')](_0x2cb425);}};AGIVertices['prototype'][_0xfa65('0x8f')]=function(_0x40cca8){var _0x23704e=_0x40cca8['split']('{');for(var _0x8272a9=0x1;_0x8272a9<_0x23704e['length'];_0x8272a9+=0x1){var _0xbfc889=_0x23704e[_0x8272a9][_0xfa65('0x97')]('}');if(_0xbfc889[_0xfa65('0x93')]>0x1){_0x40cca8=_0x40cca8[_0xfa65('0x98')]('{'+_0xbfc889[0x0]+'}',this[_0xfa65('0xb')][_0xfa65('0xe')](_0xbfc889[0x0])[_0xfa65('0x99')]||_0xbfc889[0x0]);}}if(_0x23704e[_0xfa65('0x93')]===0x1){return _0x40cca8[_0xfa65('0x9a')]();}return this[_0xfa65('0x8f')](_0x40cca8);};AGIVertices['prototype'][_0xfa65('0x9b')]=function(_0x50a1a6,_0x25c71e){var _0x236014=this[_0xfa65('0xb')]['getVariable'](_0x50a1a6);if(_0x236014['result']===-0x1){return _0x236014;}logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0x9c'),_0x25c71e,_0x236014[_0xfa65('0x99')]));return this[_0xfa65('0xb')][_0xfa65('0x96')](_0x25c71e,_0x236014[_0xfa65('0x99')]);};AGIVertices['prototype']['isConfigured']=function(_0x11f656){return _0x11f656&&_0x11f656!=='0'&&_0x11f656!=='-1'&&_0x11f656!=='';};AGIVertices[_0xfa65('0xd')][_0xfa65('0x9d')]=function(_0x5cbded){this[_0xfa65('0x34')][_0xfa65('0x9e')](this,_0x5cbded,'-');_0x5cbded['retry']=_0x5cbded[_0xfa65('0x9d')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xfa65('0xd')][_0xfa65('0x9f')]=function(_0x18dd1f){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0xa0'),_0x18dd1f[_0xfa65('0x35')]));if(!this['isConfigured'](_0x18dd1f[_0xfa65('0x58')])){return this[_0xfa65('0xb')][_0xfa65('0xa1')](_0xfa65('0xa2'));}var _0x5a2c46='\x22'+_0x18dd1f[_0xfa65('0x58')]+'\x22';if(this['isConfigured'](_0x18dd1f[_0xfa65('0x71')])){_0x5a2c46+=','+_0x18dd1f[_0xfa65('0x71')];}var _0x4b247d=this[_0xfa65('0xb')][_0xfa65('0xa3')](_0xfa65('0xa4'),_0x5a2c46);if(_0x4b247d[_0xfa65('0xa5')]===-0x1){return _0x4b247d;}return this['channel']['noop'](util[_0xfa65('0x26')]('Executed\x20command\x20MRCPSynth\x20%s',_0x5a2c46));};AGIVertices[_0xfa65('0xd')]['mrcprecog']=function(_0x398c21){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x398c21['label']));if(!this[_0xfa65('0x7e')](_0x398c21[_0xfa65('0xa6')])){return this[_0xfa65('0xb')][_0xfa65('0xa1')](_0xfa65('0xa7'));}var _0x3098ec=_0x398c21[_0xfa65('0xa6')];if(this[_0xfa65('0x7e')](_0x398c21['options'])){_0x3098ec+=','+_0x398c21[_0xfa65('0x71')];}var _0x3a6cd1=this[_0xfa65('0xb')]['exec'](_0xfa65('0xa8'),_0x3098ec);if(_0x3a6cd1[_0xfa65('0xa5')]===-0x1){return _0x3a6cd1;}var _0x4a1109=this[_0xfa65('0x9b')]('RECOG_CONFIDENCE()',_0xfa65('0xa9'));if(_0x4a1109[_0xfa65('0xa5')]===-0x1){return _0x4a1109;}var _0x1f076c=this['getAndSetVariable'](_0xfa65('0xaa'),_0xfa65('0xab'));if(_0x1f076c[_0xfa65('0xa5')]===-0x1){return _0x1f076c;}var _0x2f3006=this[_0xfa65('0x9b')](_0xfa65('0xac'),_0xfa65('0xad'));if(_0x2f3006[_0xfa65('0xa5')]===-0x1){return _0x2f3006;}return this[_0xfa65('0xb')][_0xfa65('0xa1')](util['format'](_0xfa65('0xae'),_0x3098ec));};AGIVertices[_0xfa65('0xd')][_0xfa65('0x6')]=function(_0x2130ec){logger['info'](util[_0xfa65('0x26')](_0xfa65('0xaf'),_0x2130ec[_0xfa65('0x35')]));return this[_0xfa65('0xb')][_0xfa65('0x6')]([_0x2130ec['command'],_0x2130ec[_0xfa65('0xb0')]]);};AGIVertices[_0xfa65('0xd')][_0xfa65('0xb1')]=function(_0x32188e){logger['info'](util['format'](_0xfa65('0xb2'),_0x32188e[_0xfa65('0x35')]));if(this[_0xfa65('0x7e')](_0x32188e[_0xfa65('0x61')])){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0xb3'),_0x32188e['timeout']));var _0x521169=this[_0xfa65('0xb')]['wait'](_0x32188e['timeout']);if(_0x521169[_0xfa65('0xa5')]===-0x1){return _0x521169;}}return this['channel'][_0xfa65('0xb1')]();};AGIVertices[_0xfa65('0xd')][_0xfa65('0x48')]=function(_0x4c4277){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0xb4'),_0x4c4277[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0x4c4277[_0xfa65('0x46')])){return this['channel'][_0xfa65('0x2a')](_0x4c4277,_0xfa65('0xb5'));}_0x4c4277[_0xfa65('0x47')]=moment();if(this[_0xfa65('0x7e')](_0x4c4277[_0xfa65('0xb6')])){_0x4c4277[_0xfa65('0x47')]=moment()[_0xfa65('0xb7')](_0x4c4277[_0xfa65('0xb6')],_0xfa65('0xb8'));}if(!this[_0xfa65('0x7e')](_0x4c4277['callback_priority'])){_0x4c4277['callback_priority']=0x2;}this[_0xfa65('0xb9')][_0xfa65('0x9e')](this,_0x4c4277);return this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0xba'),_0x4c4277[_0xfa65('0x45')],_0x4c4277[_0xfa65('0x46')],_0x4c4277[_0xfa65('0x47')]));};AGIVertices[_0xfa65('0xd')][_0xfa65('0xbb')]=function(_0x380148){logger[_0xfa65('0x2c')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x380148['label']));var _0x38d82d=this[_0xfa65('0xb')]['exec'](_0x380148[_0xfa65('0xbc')],_0x380148['options']);if(_0x38d82d[_0xfa65('0xa5')]===-0x1){return _0x38d82d;}return this['channel'][_0xfa65('0xa1')](util[_0xfa65('0x26')]('Executed\x20command\x20%s\x20%s',_0x380148[_0xfa65('0xbc')],_0x380148[_0xfa65('0x71')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x5b3376){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x5b3376[_0xfa65('0x35')]));if(!this['isConfigured'](_0x5b3376[_0xfa65('0x58')])){return this['channel'][_0xfa65('0xa1')]('no\x20text\x20configured');}var _0x57fa5a='\x22'+_0x5b3376[_0xfa65('0x58')]+'\x22';if(this[_0xfa65('0x7e')](_0x5b3376[_0xfa65('0x71')])){_0x57fa5a+=','+_0x5b3376[_0xfa65('0x71')];}var _0x13d030=this[_0xfa65('0xb')][_0xfa65('0xa3')](_0xfa65('0xa4'),_0x57fa5a);if(_0x13d030[_0xfa65('0xa5')]===-0x1){return _0x13d030;}return this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0xbd'),_0x57fa5a));};AGIVertices[_0xfa65('0xd')][_0xfa65('0xbe')]=function(_0x3d64ba){logger['info'](util[_0xfa65('0x26')](_0xfa65('0xbf'),_0x3d64ba[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0x3d64ba[_0xfa65('0x58')])){return this[_0xfa65('0xb')][_0xfa65('0xa1')]('no\x20text\x20configured');}var _0x37cd52='\x22'+_0x3d64ba['text']+'\x22';if(this[_0xfa65('0x7e')](_0x3d64ba[_0xfa65('0x71')])){_0x37cd52+=','+_0x3d64ba['options'];}var _0x50d39e=this[_0xfa65('0xb')][_0xfa65('0xa3')]('MRCPSynth',_0x37cd52);if(_0x50d39e[_0xfa65('0xa5')]===-0x1){return _0x50d39e;}return this['channel'][_0xfa65('0xa1')](util['format'](_0xfa65('0xbd'),_0x37cd52));};AGIVertices[_0xfa65('0xd')][_0xfa65('0xc0')]=function(_0x24906c){logger['info'](util[_0xfa65('0x26')](_0xfa65('0xc1'),_0x24906c[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0x24906c[_0xfa65('0xa6')])){return this[_0xfa65('0xb')][_0xfa65('0xa1')](_0xfa65('0xa7'));}var _0x5f23fd=_0x24906c[_0xfa65('0xa6')];if(this[_0xfa65('0x7e')](_0x24906c['options'])){_0x5f23fd+=','+_0x24906c[_0xfa65('0x71')];}var _0x54fb3d=this[_0xfa65('0xb')][_0xfa65('0xa3')]('MRCPRecog',_0x5f23fd);if(_0x54fb3d['result']===-0x1){return _0x54fb3d;}var _0x16cd0e=this[_0xfa65('0x9b')]('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x16cd0e[_0xfa65('0xa5')]===-0x1){return _0x16cd0e;}var _0x189359=this['getAndSetVariable'](_0xfa65('0xaa'),_0xfa65('0xc2'));if(_0x189359[_0xfa65('0xa5')]===-0x1){return _0x189359;}var _0x4e9ccc=this[_0xfa65('0x9b')](_0xfa65('0xac'),_0xfa65('0xc3'));if(_0x4e9ccc['result']===-0x1){return _0x4e9ccc;}return this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5f23fd));};AGIVertices['prototype'][_0xfa65('0xc4')]=function(_0x37c4ed){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x37c4ed['label']));if(!this[_0xfa65('0x7e')](_0x37c4ed['grammar'])){return this[_0xfa65('0xb')][_0xfa65('0xa1')]('no\x20grammar\x20configured');}var _0x3ca87c=_0x37c4ed[_0xfa65('0xa6')];if(this[_0xfa65('0x7e')](_0x37c4ed[_0xfa65('0x71')])){_0x3ca87c+=','+_0x37c4ed[_0xfa65('0x71')];}var _0x271abe=this[_0xfa65('0xb')][_0xfa65('0xa3')]('MRCPRecog',_0x3ca87c);if(_0x271abe[_0xfa65('0xa5')]===-0x1){return _0x271abe;}var _0x268e5b=this[_0xfa65('0x9b')](_0xfa65('0xc5'),_0xfa65('0xc6'));if(_0x268e5b[_0xfa65('0xa5')]===-0x1){return _0x268e5b;}var _0xf9cbda=this[_0xfa65('0x9b')](_0xfa65('0xaa'),'SESTEK_ASR_TRANSCRIPT');if(_0xf9cbda[_0xfa65('0xa5')]===-0x1){return _0xf9cbda;}var _0x5f42a3=this[_0xfa65('0x9b')](_0xfa65('0xac'),_0xfa65('0xc7'));if(_0x5f42a3[_0xfa65('0xa5')]===-0x1){return _0x5f42a3;}return this['channel'][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0xae'),_0x3ca87c));};AGIVertices[_0xfa65('0xd')][_0xfa65('0xc8')]=function(_0x12dd70){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0xc9'),_0x12dd70[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0x12dd70[_0xfa65('0xca')])){return this[_0xfa65('0xb')]['error'](_0x12dd70,_0xfa65('0xcb'));}var _0x4fbbbb=this[_0xfa65('0x17')][_0xfa65('0x9e')](this,_0x12dd70[_0xfa65('0xca')]);if(!_0x4fbbbb){return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x12dd70,_0xfa65('0xcc'));}if(!this['isConfigured'](_0x12dd70['query'])){return this['channel'][_0xfa65('0x2a')](_0x12dd70,_0xfa65('0xcd'));}var _0x537467=_0x12dd70[_0xfa65('0x2e')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xfa65('0xb')][_0xfa65('0xa1')](util['format']('query:\x20%s',_0x537467));var _0x23a8c7=this[_0xfa65('0x28')]['sync'](this,_0x4fbbbb,_0x537467);this[_0xfa65('0x34')][_0xfa65('0x9e')](this,_0x12dd70,_0x537467);if(!this['isConfigured'](_0x12dd70[_0xfa65('0xce')])){return this[_0xfa65('0xb')]['noop'](_0xfa65('0xcf'));}var _0x46b736=this[_0xfa65('0xe')]['sync'](this,_0x12dd70[_0xfa65('0xce')]);if(!_0x46b736){return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x12dd70,_0xfa65('0xd0'));}var _0x21696a=this;_0x23a8c7[_0xfa65('0xd1')](function(_0x422e53,_0x433a15){Object['keys'](_0x422e53)['forEach'](function(_0xa318f6){_0x21696a[_0xfa65('0xb')][_0xfa65('0x96')](util[_0xfa65('0x26')](_0xfa65('0xd2'),_0x46b736,_0x433a15,_0xa318f6),_0x422e53[_0xa318f6]);});});this['channel'][_0xfa65('0x96')](util['format'](_0xfa65('0xd3'),_0x46b736),_0x23a8c7[_0xfa65('0x93')]);return this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0xd4'),_0x46b736));};AGIVertices[_0xfa65('0xd')][_0xfa65('0xd5')]=function(_0x5a9878){logger[_0xfa65('0xd6')](util[_0xfa65('0x26')](_0xfa65('0xd7'),_0x5a9878[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0x5a9878['sip_id'])){return this[_0xfa65('0xb')]['error'](_0x5a9878,'no\x20user\x20selected');}var _0x44f2bc=this[_0xfa65('0x1a')]['sync'](this,_0x5a9878[_0xfa65('0xd8')]);if(!_0x44f2bc){return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x5a9878,_0xfa65('0xd9'));}var _0x347152=this[_0xfa65('0xb')][_0xfa65('0xa3')](_0xfa65('0xda'),[util['format'](_0xfa65('0xdb'),_0x44f2bc),_0x5a9878['timeout'],_0x5a9878[_0xfa65('0xdc')],_0x5a9878[_0xfa65('0x6c')]]);if(_0x347152[_0xfa65('0xa5')]===-0x1){return _0x347152;}return this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0xdd'),_0xfa65('0xda')));};AGIVertices[_0xfa65('0xd')][_0xfa65('0xde')]=function(_0x314db9){logger['info'](util['format'](_0xfa65('0xdf'),_0x314db9[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0x314db9[_0xfa65('0x73')])){return this[_0xfa65('0xb')][_0xfa65('0xa1')](_0xfa65('0xe0'));}if(!this[_0xfa65('0x7e')](_0x314db9['text'])){return this['channel']['noop'](_0xfa65('0xa2'));}this[_0xfa65('0xb')][_0xfa65('0xe1')]=!![];this[_0xfa65('0x34')](_0x314db9);this[_0xfa65('0x3e')](_0x314db9[_0xfa65('0x58')],'in','','');this['channel'][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0xe2'),_0x314db9[_0xfa65('0x58')]));var _0x3e5373=this[_0xfa65('0x72')][_0xfa65('0x9e')](this,_0x314db9);if(_0x3e5373){for(var _0x11cbff in _0x3e5373){if(_0x3e5373['hasOwnProperty'](_0x11cbff)){this[_0xfa65('0xb')][_0xfa65('0x96')](util[_0xfa65('0x26')]('DIALOGFLOW_%s',_0x11cbff['toUpperCase']()),_0x3e5373[_0x11cbff]);}}this['createSquareMessage'](_0x3e5373['speech'],'out','dialogflow','');return this[_0xfa65('0xb')][_0xfa65('0xa1')](util['format'](_0xfa65('0xe3'),_0x3e5373[_0xfa65('0xe4')]));}return this[_0xfa65('0xb')]['error'](_0x314db9,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0xfa65('0xe5')]=function(_0x366315){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x366315[_0xfa65('0x35')]));if(!this['isConfigured'](_0x366315[_0xfa65('0xe6')])){return this[_0xfa65('0xb')]['noop'](_0xfa65('0xe7'));}if(!this[_0xfa65('0x7e')](_0x366315['client_email'])){return this[_0xfa65('0xb')][_0xfa65('0xa1')](_0xfa65('0xe8'));}if(!this['isConfigured'](_0x366315[_0xfa65('0x77')])){return this[_0xfa65('0xb')]['noop']('no\x20private_key\x20configured');}if(!this[_0xfa65('0x7e')](_0x366315[_0xfa65('0x78')])){return this[_0xfa65('0xb')]['noop']('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x366315[_0xfa65('0x58')])){return this[_0xfa65('0xb')][_0xfa65('0xa1')](_0xfa65('0xa2'));}this[_0xfa65('0xb')]['bot']=!![];this[_0xfa65('0x34')](_0x366315);this[_0xfa65('0x3e')](_0x366315[_0xfa65('0x58')],'in','','');this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')]('Trying\x20DialogflowV2:\x20%s',_0x366315[_0xfa65('0x58')]));var _0xa05adf=this[_0xfa65('0x75')][_0xfa65('0x9e')](this,_0x366315);if(_0xa05adf){for(var _0x369505 in _0xa05adf){if(_0xa05adf[_0xfa65('0x8b')](_0x369505)){if(_0x369505!=='providerResponse'){this[_0xfa65('0xb')]['setVariable'](util[_0xfa65('0x26')](_0xfa65('0xe9'),_0x369505[_0xfa65('0x63')]()),_0xa05adf[_0x369505]);}}}this[_0xfa65('0x3e')](_0xa05adf[_0xfa65('0xe4')],'out',_0xfa65('0xe5'),_0xa05adf[_0xfa65('0xea')]);return this['channel']['noop'](util[_0xfa65('0x26')](_0xfa65('0xeb'),_0xa05adf[_0xfa65('0xe4')]));}return this[_0xfa65('0xb')]['error'](_0x366315,_0xfa65('0xec'));};AGIVertices[_0xfa65('0xd')]['sesteknda']=function(_0x468585){logger['info'](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x468585[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0x468585[_0xfa65('0xed')])){return this[_0xfa65('0xb')][_0xfa65('0xa1')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xfa65('0x7e')](_0x468585[_0xfa65('0xee')])){return this[_0xfa65('0xb')][_0xfa65('0xa1')](_0xfa65('0xef'));}if(!this[_0xfa65('0x7e')](_0x468585[_0xfa65('0xf0')])){return this[_0xfa65('0xb')][_0xfa65('0xa1')]('no\x20password\x20configured');}if(!this[_0xfa65('0x7e')](_0x468585[_0xfa65('0xf1')])){return this[_0xfa65('0xb')]['noop']('no\x20text\x20configured');}this['channel'][_0xfa65('0xe1')]=!![];this[_0xfa65('0x34')](_0x468585);this[_0xfa65('0x3e')](_0x468585[_0xfa65('0x58')],'in','','');this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0xf2'),_0x468585[_0xfa65('0x58')]));var _0x2ed040=this[_0xfa65('0x79')][_0xfa65('0x9e')](this,_0x468585);if(_0x2ed040){for(var _0x498cd7 in _0x2ed040){if(_0x2ed040[_0xfa65('0x8b')](_0x498cd7)){this[_0xfa65('0xb')]['setVariable'](util[_0xfa65('0x26')]('SESTEK_NDA_%s',_0x498cd7[_0xfa65('0x63')]()),_0x2ed040[_0x498cd7]);}}this[_0xfa65('0x3e')](_0x2ed040[_0xfa65('0xe4')],'out',_0xfa65('0xf3'),'');if(_0x2ed040[_0xfa65('0xf4')]){this['channel']['noop'](util[_0xfa65('0x26')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x2ed040['audiofile']));var _0x254308=this[_0xfa65('0xb')][_0xfa65('0xf5')](_0x2ed040[_0xfa65('0xf4')]);try{fs[_0xfa65('0xf6')](_0x2ed040[_0xfa65('0xf4')]+_0xfa65('0xf7'));}catch(_0x2dda52){logger[_0xfa65('0x2a')](_0x2dda52);}return _0x254308;}else{return this['channel'][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0xf8'),_0x2ed040['speech']));}}return this[_0xfa65('0xb')]['error'](_0x468585,_0xfa65('0xf9'));};AGIVertices[_0xfa65('0xd')][_0xfa65('0xfa')]=function(_0x5f13f2){logger['info'](util[_0xfa65('0x26')](_0xfa65('0xfb'),_0x5f13f2[_0xfa65('0x35')]));return this[_0xfa65('0xb')]['noop'](_0xfa65('0xfa'));};AGIVertices[_0xfa65('0xd')][_0xfa65('0xfc')]=function(_0xe0860a){logger['info'](util[_0xfa65('0x26')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xe0860a[_0xfa65('0x35')]));var _0x2698a0='';if(_0xe0860a[_0xfa65('0xfd')]){if(!this[_0xfa65('0x7e')](_0xe0860a['trunk_id'])){return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0xe0860a,'no\x20trunk\x20selected');}else{var _0x53f855=parseInt(_0xe0860a[_0xfa65('0xfd')],0xa);if(isNaN(_0x53f855)){_0x2698a0=_0xe0860a[_0xfa65('0xfd')];}else{_0x2698a0=this['getTrunk'][_0xfa65('0x9e')](this,_0xe0860a[_0xfa65('0xfd')]);if(!_0x2698a0){return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0xe0860a,_0xfa65('0xfe'));}}}}else if(_0xe0860a[_0xfa65('0xff')]){_0x2698a0=_0xe0860a['trunk_name'];}else{return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0xe0860a,_0xfa65('0x100'));}var _0x33df9a=this[_0xfa65('0xb')][_0xfa65('0xa3')](_0xfa65('0xda'),[util['format'](_0xfa65('0x101'),_0x2698a0,_0xe0860a['phone']),_0xe0860a[_0xfa65('0x61')],_0xe0860a['opts'],_0xe0860a[_0xfa65('0x6c')]]);if(_0x33df9a[_0xfa65('0xa5')]===-0x1){return _0x33df9a;}return this[_0xfa65('0xb')]['noop'](util[_0xfa65('0x26')](_0xfa65('0xdd'),_0xfa65('0xda')));};AGIVertices[_0xfa65('0xd')][_0xfa65('0x102')]=function(_0x428f42){logger[_0xfa65('0x2c')](util['format'](_0xfa65('0x103'),_0x428f42[_0xfa65('0x35')]));return this[_0xfa65('0xb')][_0xfa65('0xa1')](_0xfa65('0x102'));};AGIVertices['prototype'][_0xfa65('0x104')]=function(_0x573064){logger[_0xfa65('0x2c')](util['format'](_0xfa65('0x105'),_0x573064[_0xfa65('0x35')]));if(_0x573064[_0xfa65('0x106')]===0x0){return this['maxRetry'](_0x573064);}_0x573064[_0xfa65('0x106')]-=0x1;if(!this[_0xfa65('0x7e')](_0x573064[_0xfa65('0x107')])){return this['channel'][_0xfa65('0x2a')](_0x573064,'no\x20file\x20audio\x20selected');}var _0x1366f1=this[_0xfa65('0x108')]['sync'](this,_0x573064['file_id']);if(!_0x1366f1){return this['channel'][_0xfa65('0x2a')](_0x573064,_0xfa65('0x109'));}if(!this[_0xfa65('0x7e')](_0x573064[_0xfa65('0xce')])){return this[_0xfa65('0xb')]['error'](_0xfa65('0xcf'));}var _0x18113f=this[_0xfa65('0xb')]['getData'](_0x1366f1,_0x573064[_0xfa65('0x10a')],_0x573064[_0xfa65('0x10b')]);var _0x4bb555=_0x18113f[_0xfa65('0xa5')]?_0x18113f[_0xfa65('0xa5')]['toString']():'';logger[_0xfa65('0x2c')]('test',JSON[_0xfa65('0x6d')](_0x18113f));if(_0x18113f[_0xfa65('0xa5')]===-0x1){this[_0xfa65('0x34')][_0xfa65('0x9e')](this,_0x573064,_0x4bb555);return _0x18113f;}else if(_0x18113f['extra']===_0xfa65('0x61')){_0x18113f[_0xfa65('0xa5')]=_0x4bb555['length']>=parseInt(_0x573064['mindigit'])?'x':'i';}else{_0x18113f[_0xfa65('0xa5')]=_0x4bb555['length']>=parseInt(_0x573064[_0xfa65('0x10c')])&&_0x4bb555['length']<=parseInt(_0x573064[_0xfa65('0x10b')])?'x':'i';}var _0x34a6ec=this[_0xfa65('0xe')][_0xfa65('0x9e')](this,_0x573064['variable_id']);if(!_0x34a6ec){return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x573064,_0xfa65('0xd0'));}this[_0xfa65('0xb')][_0xfa65('0x96')](_0x34a6ec,_0x4bb555);if(this[_0xfa65('0x7e')](_0x573064[_0xfa65('0x10d')])){var _0x65fd5e=parseInt(_0x573064['hiddendigitsnum'],0xa);var _0x1b74c2=rs[_0xfa65('0x10e')]({'charset':'*','length':_0x65fd5e});var _0x4a8ed8=_0x4bb555[_0xfa65('0x93')];if(_0x4a8ed8>0x0){if(_0x4a8ed8>_0x65fd5e){this[_0xfa65('0x34')][_0xfa65('0x9e')](this,_0x573064,_0x573064[_0xfa65('0x10f')]===_0xfa65('0x110')?_0x1b74c2+_0x4bb555['substr'](_0x65fd5e):_0x4bb555[_0xfa65('0x111')](0x0,_0x4a8ed8-_0x65fd5e)+_0x1b74c2);}else{this[_0xfa65('0x34')][_0xfa65('0x9e')](this,_0x573064,rs[_0xfa65('0x10e')]({'charset':'*','length':_0x4a8ed8}));}}else{this[_0xfa65('0x34')][_0xfa65('0x9e')](this,_0x573064,'');}}else{this[_0xfa65('0x34')][_0xfa65('0x9e')](this,_0x573064,_0x4bb555);}return _0x18113f;};AGIVertices[_0xfa65('0xd')][_0xfa65('0x112')]=function(_0x1dd148){logger['info'](util[_0xfa65('0x26')](_0xfa65('0x113'),_0x1dd148[_0xfa65('0x35')]));return this[_0xfa65('0x104')](_0x1dd148);};AGIVertices[_0xfa65('0xd')]['goal']=function(_0x33468e){logger['info'](util[_0xfa65('0x26')](_0xfa65('0x114'),_0x33468e[_0xfa65('0x35')]));this['createSquareDetailsReport'][_0xfa65('0x9e')](this,_0x33468e,_0x33468e[_0xfa65('0x115')]);return this['channel']['noop'](util[_0xfa65('0x26')](_0xfa65('0x116'),_0x33468e['goalname']));};AGIVertices[_0xfa65('0xd')][_0xfa65('0x117')]=function(_0x4754cb){logger['info'](util[_0xfa65('0x26')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x4754cb[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0x4754cb['aws_access_key_id'])||!this['isConfigured'](_0x4754cb[_0xfa65('0x82')])){return this[_0xfa65('0xb')][_0xfa65('0xa1')](_0xfa65('0x118'));}if(!this[_0xfa65('0x7e')](_0x4754cb['text'])){return this[_0xfa65('0xb')][_0xfa65('0xa1')](_0xfa65('0xa2'));}this[_0xfa65('0xb')]['noop'](util['format'](_0xfa65('0x119'),_0x4754cb[_0xfa65('0x58')]));var _0x1b081b=this[_0xfa65('0x80')][_0xfa65('0x9e')](this,_0x4754cb);if(_0x1b081b){this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0x11a'),_0x1b081b));var _0x36b63a=this[_0xfa65('0xb')]['streamFile'](_0x1b081b);try{fs['unlink'](_0x1b081b+_0xfa65('0xf7'));}catch(_0x355c15){logger[_0xfa65('0x2a')](_0x355c15);}return _0x36b63a;}return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x4754cb,_0xfa65('0x11b'));};AGIVertices['prototype']['awslex']=function(_0x4c873c){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0x11c'),_0x4c873c['label']));if(!this['isConfigured'](_0x4c873c[_0xfa65('0x81')])||!this[_0xfa65('0x7e')](_0x4c873c[_0xfa65('0x82')])){return this[_0xfa65('0xb')][_0xfa65('0xa1')](_0xfa65('0x118'));}if(!this[_0xfa65('0x7e')](_0x4c873c['aws_bot_name'])){return this[_0xfa65('0xb')][_0xfa65('0xa1')]('no\x20bot\x20name\x20configured');}if(!this[_0xfa65('0x7e')](_0x4c873c['text'])){return this[_0xfa65('0xb')][_0xfa65('0xa1')](_0xfa65('0xa2'));}this['channel']['bot']=!![];this[_0xfa65('0x34')](_0x4c873c);this['createSquareMessage'](_0x4c873c['text'],'in','','');this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')]('Trying\x20Amazon\x20Lex:\x20%s',_0x4c873c['text']));var _0xbace49=this[_0xfa65('0x85')][_0xfa65('0x9e')](this,_0x4c873c);if(_0xbace49){for(var _0x3ad76a in _0xbace49){if(_0xbace49[_0xfa65('0x8b')](_0x3ad76a)&&_[_0xfa65('0x8c')](_0xbace49[_0x3ad76a])){this[_0xfa65('0xb')]['setVariable'](util[_0xfa65('0x26')](_0xfa65('0x11d'),_0x3ad76a[_0xfa65('0x63')]()),_0xbace49[_0x3ad76a]);}}if(_[_0xfa65('0x40')](_0xbace49[_0xfa65('0x70')])){return this[_0xfa65('0xb')][_0xfa65('0xa1')](_0xfa65('0x11e'));}else{this['createSquareMessage'](_0xbace49[_0xfa65('0x70')],_0xfa65('0x11f'),_0xfa65('0x120'),'');return this[_0xfa65('0xb')]['noop'](util[_0xfa65('0x26')](_0xfa65('0x121'),_0xbace49[_0xfa65('0x70')]));}}return this[_0xfa65('0xb')]['error'](_0x4c873c,_0xfa65('0x122'));};AGIVertices[_0xfa65('0xd')][_0xfa65('0x123')]=function(_0x52d10a){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0x124'),_0x52d10a[_0xfa65('0x35')],_0x52d10a[_0xfa65('0x61')]));if(!this[_0xfa65('0x7e')](_0x52d10a['key'])){return this[_0xfa65('0xb')][_0xfa65('0xa1')]('no\x20key\x20configured');}var _0x3cbe5a=_0xfa65('0x125');var _0x184080=util['format'](_0xfa65('0x126'),FILES_PATH,rs[_0xfa65('0x10e')](0x4));var _0x19b1fe=util['format'](_0xfa65('0x95'),_0x184080,_0x3cbe5a);var _0x2467b1=!![];if(_0x52d10a[_0xfa65('0x127')]==='NOBEEP'){_0x2467b1=![];}var _0x51517d=this[_0xfa65('0xb')]['recordFile'](_0x184080,_0x3cbe5a,_0x52d10a[_0xfa65('0x128')],_0x52d10a[_0xfa65('0x61')],undefined,_0x2467b1);if(_0x51517d['result']!==-0x1){this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0x129'),_0x19b1fe));var _0x808369=this[_0xfa65('0x86')][_0xfa65('0x9e')](this,_0x52d10a,_0x19b1fe);if(_0x808369){for(var _0x54a7f7 in _0x808369){if(_0x808369[_0xfa65('0x8b')](_0x54a7f7)){this[_0xfa65('0xb')][_0xfa65('0x96')](util[_0xfa65('0x26')](_0xfa65('0x12a'),_0x54a7f7['toUpperCase']()),_0x808369[_0x54a7f7]);}}return this[_0xfa65('0xb')]['noop'](util[_0xfa65('0x26')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x808369)));}}return _0x51517d;};AGIVertices[_0xfa65('0xd')]['tildeasr']=function(_0x28ba20){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0x12b'),_0x28ba20[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0x28ba20[_0xfa65('0x12c')])){return this['channel']['noop'](_0xfa65('0x12d'));}if(!this[_0xfa65('0x7e')](_0x28ba20[_0xfa65('0x88')])){return this[_0xfa65('0xb')][_0xfa65('0xa1')](_0xfa65('0x12e'));}var _0x1db680='wav';var _0x16aef0=util[_0xfa65('0x26')](_0xfa65('0x126'),FILES_PATH,rs['generate'](0x4));var _0x4b17fb=util['format'](_0xfa65('0x95'),_0x16aef0,_0x1db680);var _0x53086c=!![];if(_0x28ba20[_0xfa65('0x127')]===_0xfa65('0x12f')){_0x53086c=![];}var _0x1353df=this[_0xfa65('0xb')][_0xfa65('0x130')](_0x16aef0,_0x1db680,_0x28ba20[_0xfa65('0x128')],_0x28ba20['timeout'],undefined,_0x53086c);if(_0x1353df[_0xfa65('0xa5')]!==-0x1){this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0x131'),_0x4b17fb));var _0x36570e=this[_0xfa65('0x87')]['sync'](this,_0x28ba20,_0x4b17fb);if(_0x36570e){for(var _0x7a03dc in _0x36570e){if(_0x36570e['hasOwnProperty'](_0x7a03dc)){this['channel']['setVariable'](util[_0xfa65('0x26')](_0xfa65('0x132'),_0x7a03dc['toUpperCase']()),_0x36570e[_0x7a03dc]);}}return this[_0xfa65('0xb')][_0xfa65('0xa1')](util['format']('TildeASR\x20Result\x20%s',JSON[_0xfa65('0x6d')](_0x36570e)));}}return _0x1353df;};AGIVertices['prototype'][_0xfa65('0x133')]=function(_0x554849){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0x134'),_0x554849[_0xfa65('0x35')]));return this[_0xfa65('0xb')][_0xfa65('0x135')](_0x554849[_0xfa65('0x136')],_0x554849[_0xfa65('0x3b')],_0x554849[_0xfa65('0x3c')]);};AGIVertices[_0xfa65('0xd')][_0xfa65('0x137')]=function(_0x453373){logger['info'](util[_0xfa65('0x26')](_0xfa65('0x138'),_0x453373[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0x453373['condition'])){return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x453373,_0xfa65('0x139'));}try{var _0x4e62c2=eval(_0x453373[_0xfa65('0x13a')])?_0xfa65('0x13b'):_0xfa65('0x13c');this[_0xfa65('0xb')][_0xfa65('0xa1')](util['format'](_0xfa65('0x13d'),_0x453373[_0xfa65('0x13a')],_0x4e62c2));return{'code':0xc8,'result':_0x4e62c2};}catch(_0x21da05){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xfa65('0xd')][_0xfa65('0x13e')]=function(_0x3bb8aa){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x3bb8aa[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0x3bb8aa[_0xfa65('0x13f')])){return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x3bb8aa,'no\x20interval\x20configured');}var _0x161bb3=this[_0xfa65('0x22')][_0xfa65('0x9e')](this,_0x3bb8aa[_0xfa65('0x13f')]);if(!_0x161bb3){return this['channel'][_0xfa65('0x2a')](_0x3bb8aa,_0xfa65('0x140'));}for(var _0x4cfecf=0x0;_0x4cfecf<_0x161bb3[_0xfa65('0x93')];_0x4cfecf+=0x1){var _0x23fb46=this[_0xfa65('0xb')][_0xfa65('0xe')](util['format'](_0xfa65('0x141'),_0x161bb3[_0x4cfecf]));if(_0x23fb46[_0xfa65('0xa5')]===-0x1){return _0x23fb46;}logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0x142'),_0x161bb3[_0x4cfecf],_0x23fb46['extra']));if(_0x23fb46['extra']===_0xfa65('0x13b')){logger[_0xfa65('0x2c')](util['format']('IFTIME\x20%s\x20%s',_0x161bb3[_0x4cfecf],'true'));this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0x142'),_0x161bb3[_0x4cfecf],_0xfa65('0x13b')));return{'code':0xc8,'result':_0xfa65('0x13b')};}else{logger['info'](util[_0xfa65('0x26')](_0xfa65('0x142'),_0x161bb3[_0x4cfecf],_0xfa65('0x13c')));this[_0xfa65('0xb')]['noop'](util['format'](_0xfa65('0x142'),_0x161bb3[_0x4cfecf],_0xfa65('0x13c')));}}return{'code':0xc8,'result':_0xfa65('0x13c')};};AGIVertices['prototype'][_0xfa65('0x143')]=function(_0x3c98ea){logger['info'](util[_0xfa65('0x26')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x3c98ea[_0xfa65('0x35')]));return this[_0xfa65('0xb')][_0xfa65('0x143')]();};AGIVertices[_0xfa65('0xd')][_0xfa65('0x144')]=function(_0x3b4a28){logger['info'](util[_0xfa65('0x26')](_0xfa65('0x145'),_0x3b4a28[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0x3b4a28[_0xfa65('0x73')])){return this[_0xfa65('0xb')][_0xfa65('0xa1')](_0xfa65('0xe0'));}var _0x36e4f8=_0xfa65('0x125');var _0x36d329=util[_0xfa65('0x26')](_0xfa65('0x126'),FILES_PATH,rs[_0xfa65('0x10e')](0x4));var _0x5f1408=util[_0xfa65('0x26')](_0xfa65('0x95'),_0x36d329,_0x36e4f8);var _0x304570=!![];if(_0x3b4a28[_0xfa65('0x127')]===_0xfa65('0x12f')){_0x304570=![];}var _0x207604=this['channel'][_0xfa65('0x130')](_0x36d329,_0x36e4f8,_0x3b4a28[_0xfa65('0x128')],_0x3b4a28[_0xfa65('0x61')],undefined,_0x304570);if(_0x207604[_0xfa65('0xa5')]!==-0x1){this[_0xfa65('0xb')]['noop'](util[_0xfa65('0x26')](_0xfa65('0x146'),_0x5f1408));var _0x55d296=this['ispeechASR'][_0xfa65('0x9e')](this,_0x3b4a28,_0x5f1408);if(_0x55d296){for(var _0x432f16 in _0x55d296){if(_0x55d296['hasOwnProperty'](_0x432f16)){this[_0xfa65('0xb')][_0xfa65('0x96')](util[_0xfa65('0x26')](_0xfa65('0x147'),_0x432f16[_0xfa65('0x63')]()),_0x55d296[_0x432f16]);}}return this[_0xfa65('0xb')]['noop'](util['format'](_0xfa65('0x148'),JSON[_0xfa65('0x6d')](_0x55d296)));}}return _0x207604;};AGIVertices[_0xfa65('0xd')][_0xfa65('0x149')]=function(_0x3c14ae){logger[_0xfa65('0x2c')](util['format'](_0xfa65('0x14a'),_0x3c14ae[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0x3c14ae[_0xfa65('0x73')])){return this[_0xfa65('0xb')]['noop'](_0xfa65('0xe0'));}if(!this[_0xfa65('0x7e')](_0x3c14ae[_0xfa65('0x58')])){return this[_0xfa65('0xb')][_0xfa65('0xa1')](_0xfa65('0xa2'));}this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0x14b'),_0x3c14ae['text']));var _0x3d31f2=this[_0xfa65('0x14c')][_0xfa65('0x9e')](this,_0x3c14ae);if(_0x3d31f2){this['channel'][_0xfa65('0xa1')](util['format'](_0xfa65('0x146'),_0x3d31f2));var _0x531dce=this[_0xfa65('0xb')][_0xfa65('0xf5')](_0x3d31f2,_0x3c14ae[_0xfa65('0x128')]);try{fs[_0xfa65('0xf6')](_0x3d31f2+_0xfa65('0xf7'));}catch(_0x39ace1){logger['error'](_0x39ace1);}return _0x531dce;}return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x3c14ae,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xfa65('0xd')][_0xfa65('0x14d')]=function(_0x332c8a){logger['info'](util[_0xfa65('0x26')](_0xfa65('0x14e'),_0x332c8a['label']));if(!this[_0xfa65('0x7e')](_0x332c8a['findBy'])){return this[_0xfa65('0xb')]['error'](_0x332c8a,_0xfa65('0x14f'));}logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0x150'),this[_0xfa65('0xb')][_0xfa65('0x38')],_0x332c8a[_0xfa65('0x151')]));var _0xf6f9e7=this[_0xfa65('0x4f')]['sync'](this,_0x332c8a[_0xfa65('0x151')]);if(_0xf6f9e7){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xfa65('0xb')]['callerid'],_0x332c8a[_0xfa65('0x151')]));this[_0xfa65('0xb')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xfa65('0x38')],_0x332c8a[_0xfa65('0x151')]));return{'code':0xc8,'result':_0xfa65('0x152')};}else{logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0x153'),this['channel']['callerid'],_0x332c8a[_0xfa65('0x151')]));this[_0xfa65('0xb')]['noop'](util[_0xfa65('0x26')](_0xfa65('0x153'),this[_0xfa65('0xb')][_0xfa65('0x38')],_0x332c8a[_0xfa65('0x151')]));return{'code':0xc8,'result':_0xfa65('0x154')};}};AGIVertices['prototype']['logout']=function(_0x88986e){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0x155'),_0x88986e['label']));if(!this[_0xfa65('0x7e')](_0x88986e[_0xfa65('0x151')])){return this['channel'][_0xfa65('0x2a')](_0x88986e,_0xfa65('0x14f'));}logger['info'](util[_0xfa65('0x26')](_0xfa65('0x150'),this[_0xfa65('0xb')][_0xfa65('0x38')],_0x88986e['findBy']));var _0x2bb225=this['agentLogout'][_0xfa65('0x9e')](this,_0x88986e['findBy']);if(_0x2bb225){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0x156'),this[_0xfa65('0xb')][_0xfa65('0x38')],_0x88986e[_0xfa65('0x151')]));this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0x156'),this[_0xfa65('0xb')][_0xfa65('0x38')],_0x88986e[_0xfa65('0x151')]));return{'code':0xc8,'result':_0xfa65('0x152')};}else{logger[_0xfa65('0x2c')](util[_0xfa65('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xfa65('0xb')]['callerid'],_0x88986e['findBy']));this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0x153'),this[_0xfa65('0xb')][_0xfa65('0x38')],_0x88986e[_0xfa65('0x151')]));return{'code':0xc8,'result':_0xfa65('0x154')};}};AGIVertices['prototype'][_0xfa65('0x157')]=function(_0x2666f2){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0x158'),_0x2666f2[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0x2666f2[_0xfa65('0x159')])){return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x2666f2,_0xfa65('0x15a'));}this['channel'][_0xfa65('0xa1')](util[_0xfa65('0x26')]('math\x20%s',_0x2666f2[_0xfa65('0x159')]));var _0x354fd8=eval(_0x2666f2['operation']);if(!this['isConfigured'](_0x2666f2[_0xfa65('0xce')])){return this[_0xfa65('0xb')]['noop'](_0xfa65('0xcf'));}var _0x44e351=this['getVariable'][_0xfa65('0x9e')](this,_0x2666f2[_0xfa65('0xce')]);if(!_0x44e351){return this['channel'][_0xfa65('0x2a')](_0x2666f2,_0xfa65('0xd0'));}if(_[_0xfa65('0x92')](_0x354fd8)){var _0x43a4e3=this;_0x354fd8[_0xfa65('0xd1')](function(_0x33904c,_0x2acea9){_0x43a4e3[_0xfa65('0xb')][_0xfa65('0x96')](util[_0xfa65('0x26')](_0xfa65('0x15b'),_0x44e351,_0x2acea9),_0x33904c);});return this[_0xfa65('0xb')][_0xfa65('0xa1')](util['format'](_0xfa65('0x15c'),_0x44e351));}else{return this['channel'][_0xfa65('0x96')](_0x44e351,_0x354fd8);}};AGIVertices[_0xfa65('0xd')][_0xfa65('0x15d')]=function(_0x283d70){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0x15e'),_0x283d70['label']));if(_0x283d70[_0xfa65('0x106')]===0x0){return this[_0xfa65('0x9d')](_0x283d70);}_0x283d70[_0xfa65('0x106')]-=0x1;if(!this[_0xfa65('0x7e')](_0x283d70[_0xfa65('0x107')])){return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x283d70,'no\x20file\x20audio\x20selected');}var _0x30a1da=this[_0xfa65('0x108')][_0xfa65('0x9e')](this,_0x283d70[_0xfa65('0x107')]);if(!_0x30a1da){return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x283d70,_0xfa65('0x109'));}var _0xc72b1e=this[_0xfa65('0xb')][_0xfa65('0x15f')](_0x30a1da,_0x283d70['response'],_0x283d70[_0xfa65('0x160')]);var _0x22bd9b=_0xc72b1e[_0xfa65('0xa5')];if(_0xc72b1e[_0xfa65('0xa5')]===-0x1){this[_0xfa65('0x34')][_0xfa65('0x9e')](this,_0x283d70,'-1');return _0xc72b1e;}else if(_0xc72b1e[_0xfa65('0x99')]===_0xfa65('0x61')){_0xc72b1e[_0xfa65('0xa5')]=_0xc72b1e[_0xfa65('0xa5')]['length']>0x0?_0xc72b1e[_0xfa65('0xa5')]:'t';}else if(_['isEmpty'](_0xc72b1e[_0xfa65('0xa5')])){_0xc72b1e['result']='#';_0x22bd9b='#';}if(!this[_0xfa65('0x7e')](_0x283d70['variable_id'])){this['channel'][_0xfa65('0xa1')](_0xfa65('0xcf'));}else{var _0x28ba51=this['getVariable'][_0xfa65('0x9e')](this,_0x283d70[_0xfa65('0xce')]);if(!_0x28ba51){return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x283d70,'no\x20variable\x20found');}this[_0xfa65('0xb')][_0xfa65('0x96')](_0x28ba51,_0x22bd9b);}this['createSquareDetailsReport'][_0xfa65('0x9e')](this,_0x283d70,_0x22bd9b);return _0xc72b1e;};AGIVertices[_0xfa65('0xd')][_0xfa65('0xa1')]=function(_0x385026){logger[_0xfa65('0x2c')](util['format'](_0xfa65('0x161'),_0x385026['label']));return this[_0xfa65('0xb')][_0xfa65('0xa1')](_0x385026[_0xfa65('0x162')]||_0x385026[_0xfa65('0x35')]);};AGIVertices[_0xfa65('0xd')]['pause']=function(_0x581266){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x581266[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0x581266['findBy'])){return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x581266,_0xfa65('0x14f'));}logger[_0xfa65('0x2c')](util[_0xfa65('0x26')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xfa65('0xb')][_0xfa65('0x38')],_0x581266[_0xfa65('0x151')]));var _0x5ed844=this[_0xfa65('0x163')][_0xfa65('0x9e')](this,_0x581266[_0xfa65('0x164')]);var _0x47c4a0=this['agentPause']['sync'](this,_0x581266[_0xfa65('0x151')],_0x5ed844);if(_0x47c4a0){logger[_0xfa65('0x2c')](util['format'](_0xfa65('0x156'),this[_0xfa65('0xb')][_0xfa65('0x38')],_0x581266[_0xfa65('0x151')]));this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xfa65('0xb')][_0xfa65('0x38')],_0x581266[_0xfa65('0x151')]));return{'code':0xc8,'result':_0xfa65('0x152')};}else{logger[_0xfa65('0x2c')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xfa65('0xb')][_0xfa65('0x38')],_0x581266[_0xfa65('0x151')]));this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0x156'),this[_0xfa65('0xb')][_0xfa65('0x38')],_0x581266[_0xfa65('0x151')]));return{'code':0xc8,'result':_0xfa65('0x154')};}};AGIVertices[_0xfa65('0xd')]['playback']=function(_0xff4553){logger['info'](util[_0xfa65('0x26')](_0xfa65('0x165'),_0xff4553[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0xff4553[_0xfa65('0x107')])){return this[_0xfa65('0xb')]['error'](_0xff4553,_0xfa65('0x166'));}var _0x2c4cfa=this['getSound'][_0xfa65('0x9e')](this,_0xff4553[_0xfa65('0x107')]);if(!_0x2c4cfa){return this['channel']['error'](_0xff4553,_0xfa65('0x109'));}var _0x10a3d3=this[_0xfa65('0xb')][_0xfa65('0xa3')](_0xfa65('0x167'),[_0x2c4cfa,_0xff4553[_0xfa65('0xdc')]]);if(_0x10a3d3[_0xfa65('0xa5')]===-0x1){return _0x10a3d3;}return this[_0xfa65('0xb')]['noop'](util[_0xfa65('0x26')](_0xfa65('0x168'),_0xfa65('0x167'),_0x2c4cfa));};AGIVertices[_0xfa65('0xd')]['queue']=function(_0x599c58){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x599c58[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0x599c58[_0xfa65('0x169')])){return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x599c58,_0xfa65('0x16a'));}var _0x33165f='';var _0x7db928=parseInt(_0x599c58[_0xfa65('0x169')],0xa);if(isNaN(_0x7db928)){_0x33165f=_0x599c58['queue_id'];}else{_0x33165f=this[_0xfa65('0x12')][_0xfa65('0x9e')](this,_0x599c58['queue_id']);if(!_0x33165f){return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x599c58,_0xfa65('0x16b'));}}var _0x55607d='';if(this[_0xfa65('0x7e')](_0x599c58[_0xfa65('0x107')])){var _0x29d777=this['getSound'][_0xfa65('0x9e')](this,_0x599c58[_0xfa65('0x107')]);if(_0x29d777){_0x55607d=_0x29d777;}}this[_0xfa65('0x34')][_0xfa65('0x9e')](this,_0x599c58,_0x33165f);if(_0x599c58[_0xfa65('0xdc')]['indexOf']('x')<0x0){_0x599c58['opts']+='x';}if(_0x599c58[_0xfa65('0xdc')][_0xfa65('0x16c')]('X')<0x0){_0x599c58[_0xfa65('0xdc')]+='X';}this[_0xfa65('0xb')][_0xfa65('0x96')](_0xfa65('0x16d'),_0x33165f?_0x33165f[_0xfa65('0x16e')]():'');var _0x5c98b0=this['channel'][_0xfa65('0xa3')](_0xfa65('0x16f'),[_0x33165f,_0x599c58[_0xfa65('0xdc')],_0x599c58['url'],_0x55607d,_0x599c58[_0xfa65('0x61')],_0x599c58[_0xfa65('0x6')],_0x599c58[_0xfa65('0x170')],_0x599c58[_0xfa65('0x171')],'',_0x599c58[_0xfa65('0x172')]]);if(_0x5c98b0[_0xfa65('0xa5')]===-0x1){return _0x5c98b0;}return this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0x168'),'QUEUE',_0x33165f));};AGIVertices[_0xfa65('0xd')]['record']=function(_0x3f8859){logger[_0xfa65('0x2c')](util['format'](_0xfa65('0x173'),_0x3f8859[_0xfa65('0x35')]));var _0x1ccbe9=_0x3f8859[_0xfa65('0x174')]||_0xfa65('0x125');var _0x1bf2d8=util['format']('%s_%s',this[_0xfa65('0xb')][_0xfa65('0x3f')],rs['generate'](0x5));var _0x5b8d21=util['format'](_0xfa65('0x175'),FILES_PATH,_0x1bf2d8,_0x1ccbe9);var _0x9ced44=util[_0xfa65('0x26')]('%s/recordings/%s',FILES_PATH,_0x1bf2d8);this[_0xfa65('0x39')][_0xfa65('0x9e')](this,_0x3f8859,_0x1bf2d8,_0x5b8d21);this[_0xfa65('0xb')]['setVariable'](_0xfa65('0x176'),_0x1bf2d8);logger[_0xfa65('0x2c')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x9ced44,_0x1ccbe9,_0x3f8859[_0xfa65('0x177')],_0x3f8859[_0xfa65('0x61')]);return this['channel'][_0xfa65('0x130')](_0x9ced44,_0x1ccbe9,_0x3f8859['escape_digits'],_0x3f8859[_0xfa65('0x61')],undefined,!![]);};AGIVertices['prototype'][_0xfa65('0x178')]=function(_0x12b53e){logger['info'](util[_0xfa65('0x26')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x12b53e['label']));if(!this[_0xfa65('0x7e')](_0x12b53e[_0xfa65('0x6c')])){return this[_0xfa65('0xb')][_0xfa65('0xa1')](_0xfa65('0x179'));}var _0xec2328=this[_0xfa65('0x17a')][_0xfa65('0x9e')](this,_0x12b53e);logger[_0xfa65('0x2c')](util['format'](_0xfa65('0x17b'),util['inspect'](_0xec2328,{'showHidden':![],'depth':null})));if(!this[_0xfa65('0x7e')](_0x12b53e[_0xfa65('0xce')])){return this[_0xfa65('0xb')][_0xfa65('0xa1')](_0xfa65('0x17c'));}var _0x51458e=this[_0xfa65('0xe')][_0xfa65('0x9e')](this,_0x12b53e[_0xfa65('0xce')]);if(!_0x51458e){return this['channel'][_0xfa65('0x2a')](_0x12b53e,_0xfa65('0xd0'));}this[_0xfa65('0xb')][_0xfa65('0x96')](util[_0xfa65('0x26')](_0xfa65('0x17d'),_0x51458e),_0xec2328[_0xfa65('0x6e')]?_0xec2328[_0xfa65('0x6e')]:'200');this['channel']['setVariable'](util[_0xfa65('0x26')]('%s_STATUS_MESSAGE',_0x51458e),_0xec2328['statusMessage']?_0xec2328['statusMessage']:'OK');if(_0xec2328[_0xfa65('0x64')]){try{this[_0xfa65('0x94')](_0xec2328['body'],_0x51458e);}catch(_0x27fee2){logger['error'](util[_0xfa65('0x26')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x51458e));}}return this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0xd4'),_0x51458e));};AGIVertices[_0xfa65('0xd')][_0xfa65('0x17e')]=function(_0x185ebd){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0x17f'),_0x185ebd[_0xfa65('0x35')]));return this[_0xfa65('0xb')][_0xfa65('0x180')](_0x185ebd[_0xfa65('0x181')][_0xfa65('0x54')](/\s+/g,''),_0x185ebd['escape_digits']);};AGIVertices[_0xfa65('0xd')][_0xfa65('0x182')]=function(_0x5405d4){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0x183'),_0x5405d4[_0xfa65('0x35')]));return this[_0xfa65('0xb')]['sayNumber'](_0x5405d4[_0xfa65('0x184')][_0xfa65('0x54')](/\s+/g,''),_0x5405d4[_0xfa65('0x177')]);};AGIVertices['prototype']['sayphonetic']=function(_0x255a92){logger['info'](util[_0xfa65('0x26')](_0xfa65('0x185'),_0x255a92[_0xfa65('0x35')]));return this[_0xfa65('0xb')][_0xfa65('0x186')](_0x255a92['text'],_0x255a92['escape_digits']);};AGIVertices['prototype'][_0xfa65('0x187')]=function(_0x2262c7){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0x188'),_0x2262c7[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0x2262c7['account_id'])){return this['channel'][_0xfa65('0xa1')](_0xfa65('0x189'));}var _0x2a3361=this[_0xfa65('0x20')][_0xfa65('0x9e')](this,_0x2262c7[_0xfa65('0x18a')]);if(!_0x2a3361||!_0x2a3361['Smtp']){return this['channel'][_0xfa65('0x2a')](_0x2262c7,_0xfa65('0x18b'));}var _0x3e5151={'from':util[_0xfa65('0x26')](_0xfa65('0x18c'),_0x2a3361[_0xfa65('0x14')],_0x2a3361['email']||_0x2a3361['Smtp'][_0xfa65('0x18d')]),'to':_0x2262c7['to']||'','cc':_0x2262c7['cc']||'','bcc':_0x2262c7['bcc']||'','subject':_0x2262c7['subject'],'html':_0x2262c7[_0xfa65('0x58')],'text':_0x2262c7[_0xfa65('0x58')]};var _0x534e9b={'tls':{'rejectUnauthorized':![]}};if(_0x2a3361[_0xfa65('0x18e')][_0xfa65('0x18f')]){_0x534e9b[_0xfa65('0x18f')]=_0x2a3361[_0xfa65('0x18e')]['service'];}else{_0x534e9b[_0xfa65('0x190')]=_0x2a3361['Smtp'][_0xfa65('0x190')];_0x534e9b[_0xfa65('0x191')]=_0x2a3361[_0xfa65('0x18e')][_0xfa65('0x191')];_0x534e9b[_0xfa65('0x192')]=_0x2a3361[_0xfa65('0x18e')][_0xfa65('0x192')];}if(_0x2a3361[_0xfa65('0x18e')][_0xfa65('0x193')]){_0x534e9b[_0xfa65('0x194')]={'user':_0x2a3361[_0xfa65('0x18e')][_0xfa65('0x18d')],'pass':_0x2a3361[_0xfa65('0x18e')][_0xfa65('0x195')]};}if(this['isConfigured'](_0x2262c7[_0xfa65('0x196')])){}logger[_0xfa65('0xd6')](_0xfa65('0x197'),JSON[_0xfa65('0x6d')](_0x3e5151));this[_0xfa65('0x34')]['sync'](this,_0x2262c7,_0x2262c7[_0xfa65('0x18a')]);this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0x198'),_0x2a3361[_0xfa65('0x14')]));this['sendMailMessage']['sync'](this,_0x534e9b,_0x3e5151);return this['channel']['noop'](_0xfa65('0x199'));};AGIVertices['prototype'][_0xfa65('0x19a')]=function(_0x5c8d2a){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0x19b'),_0x5c8d2a[_0xfa65('0x35')]));return this[_0xfa65('0xb')][_0xfa65('0xa1')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype'][_0xfa65('0x19c')]=function(_0x43a6a5){logger[_0xfa65('0x2c')](util['format'](_0xfa65('0x19d'),_0x43a6a5[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0x43a6a5[_0xfa65('0x19e')])){return this[_0xfa65('0xb')][_0xfa65('0xa1')](_0xfa65('0x19f'));}var _0x5a67a8=this[_0xfa65('0x32')]['sync'](this,_0x43a6a5[_0xfa65('0x19e')]);if(!_0x5a67a8){return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x43a6a5,_0xfa65('0x1a0'));}var _0x412a8d={'body':_0x43a6a5[_0xfa65('0x1a1')],'phone':_0x43a6a5['to']||'','SmsAccountId':_0x5a67a8['id']};logger[_0xfa65('0xd6')](_0xfa65('0x1a2'),JSON['stringify'](_0x412a8d));this['createSquareDetailsReport'][_0xfa65('0x9e')](this,_0x43a6a5,_0x43a6a5[_0xfa65('0x19e')]);this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0x1a3'),_0x5a67a8['name']));this[_0xfa65('0x33')][_0xfa65('0x9e')](this,_0x412a8d);return this[_0xfa65('0xb')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xfa65('0xd')][_0xfa65('0x1a4')]=function(_0x580df6){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0x1a5'),_0x580df6[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0x580df6['variable_id'])){return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x580df6,_0xfa65('0x1a6'));}var _0x5be37e=this[_0xfa65('0xe')][_0xfa65('0x9e')](this,_0x580df6['variable_id']);if(!_0x5be37e){return this[_0xfa65('0xb')]['error'](_0x580df6,'no\x20variable\x20found');}return this[_0xfa65('0xb')][_0xfa65('0x96')](_0x5be37e,_0x580df6[_0xfa65('0x1a7')]);};AGIVertices['prototype'][_0xfa65('0x1a8')]=function(_0x320ae4){logger['info'](util[_0xfa65('0x26')]('Enter\x20in\x20START\x20(%s)\x20block',_0x320ae4[_0xfa65('0x35')]));this['channel'][_0xfa65('0xa1')]('START\x20CALLY\x20SQUARE');if(_0x320ae4[_0xfa65('0xb1')]===_0xfa65('0x1a9')){this[_0xfa65('0xb')]['noop']('Answer');return this[_0xfa65('0xb')][_0xfa65('0xb1')]();}return this['channel'][_0xfa65('0xa1')](_0xfa65('0x1aa'));};AGIVertices[_0xfa65('0xd')][_0xfa65('0x1ab')]=function(_0x28a898){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0x1ac'),_0x28a898[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0x28a898[_0xfa65('0x1ad')])){return this['channel']['error'](_0x28a898,_0xfa65('0x1ae'));}var _0x442146=this[_0xfa65('0x1af')]['sync'](this,_0x28a898[_0xfa65('0x1ad')]);if(!this[_0xfa65('0x7e')](_0x442146)){return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x28a898,util[_0xfa65('0x26')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x28a898[_0xfa65('0x1ad')]));}if(_0x442146===this[_0xfa65('0xb')][_0xfa65('0x37')]){return this[_0xfa65('0xb')]['error'](_0x28a898,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xfa65('0x34')]['sync'](this,_0x28a898,_0x442146);var _0x4c2ae6=this[_0xfa65('0xb')][_0xfa65('0xa3')](_0xfa65('0x1b0'),util[_0xfa65('0x26')](_0xfa65('0x1b1'),config[_0xfa65('0x6')][_0xfa65('0x190')]||'127.0.0.1',_0x442146,this[_0xfa65('0xb')]['arg_1']));if(_0x4c2ae6[_0xfa65('0xa5')]===-0x1){return _0x4c2ae6;}return this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0x168'),_0xfa65('0x1b0'),_0x442146));};AGIVertices['prototype'][_0xfa65('0x1b2')]=function(_0x3e59ba){logger['info'](util[_0xfa65('0x26')](_0xfa65('0x1b3'),_0x3e59ba['label']));var _0x4939c9=this[_0xfa65('0x52')]['sync'](this,_0x3e59ba['command']);this['createSquareDetailsReport'][_0xfa65('0x9e')](this,_0x3e59ba,_0x3e59ba[_0xfa65('0x1b4')]);if(this[_0xfa65('0x7e')](_0x3e59ba[_0xfa65('0xce')])){var _0x3b63d6=this[_0xfa65('0xe')]['sync'](this,_0x3e59ba['variable_id']);if(_0x3b63d6){this[_0xfa65('0xb')]['setVariable'](_0x3b63d6,_0x4939c9);return this[_0xfa65('0xb')]['noop'](util[_0xfa65('0x26')](_0xfa65('0x1b5'),_0x3e59ba[_0xfa65('0x1b4')],_0x3b63d6));}}return this[_0xfa65('0xb')]['noop'](util[_0xfa65('0x26')](_0xfa65('0x1b6'),_0x3e59ba[_0xfa65('0x1b4')]));};AGIVertices[_0xfa65('0xd')]['google_cloud_tts']=function(_0x41690f){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0x1b7'),_0x41690f[_0xfa65('0x35')]));_0x41690f[_0xfa65('0x58')]=_0x41690f[_0xfa65('0x58')][_0xfa65('0x54')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xfa65('0x7e')](_0x41690f[_0xfa65('0x56')])){return this[_0xfa65('0xb')][_0xfa65('0xa1')]('no\x20apiKey\x20configured');}if(!this[_0xfa65('0x7e')](_0x41690f['text'])){return this[_0xfa65('0xb')]['noop'](_0xfa65('0xa2'));}this[_0xfa65('0xb')][_0xfa65('0xa1')](util['format'](_0xfa65('0x1b8'),_0x41690f[_0xfa65('0x58')]));var _0x5a95b0=this[_0xfa65('0x55')]['sync'](this,_0x41690f);if(_0x5a95b0){this[_0xfa65('0xb')][_0xfa65('0xa1')](util['format'](_0xfa65('0x1b9'),_0x5a95b0));var _0x51ecc6=this[_0xfa65('0xb')]['streamFile'](_0x5a95b0);try{fs[_0xfa65('0xf6')](_0x5a95b0+_0xfa65('0xf7'));}catch(_0x27fab1){logger['error'](_0x27fab1);}return _0x51ecc6;}return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x41690f,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xfa65('0xd')][_0xfa65('0x1ba')]=function(_0x45ebbc){logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0x1bb'),_0x45ebbc['label']));_0x45ebbc[_0xfa65('0x58')]=_0x45ebbc[_0xfa65('0x58')][_0xfa65('0x54')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xfa65('0x7e')](_0x45ebbc[_0xfa65('0x58')])){return this['channel'][_0xfa65('0xa1')](_0xfa65('0xa2'));}this[_0xfa65('0xb')]['noop'](util[_0xfa65('0x26')]('Trying\x20Google\x20TTS\x20%s',_0x45ebbc[_0xfa65('0x58')]));var _0x3c58ac=this['googleTTS']['sync'](this,_0x45ebbc);if(_0x3c58ac){this[_0xfa65('0xb')][_0xfa65('0xa1')](util['format'](_0xfa65('0x1bc'),_0x3c58ac));var _0x28fc73=this[_0xfa65('0xb')][_0xfa65('0xf5')](_0x3c58ac);try{fs[_0xfa65('0xf6')](_0x3c58ac+_0xfa65('0xf7'));}catch(_0x4cf91b){logger[_0xfa65('0x2a')](_0x4cf91b);}return _0x28fc73;}return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x45ebbc,_0xfa65('0x1bd'));};AGIVertices[_0xfa65('0xd')][_0xfa65('0x1be')]=function(_0x1b43cb){logger['info'](util[_0xfa65('0x26')](_0xfa65('0x1bf'),_0x1b43cb['label']));if(!this[_0xfa65('0x7e')](_0x1b43cb[_0xfa65('0x151')])){return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x1b43cb,_0xfa65('0x14f'));}logger[_0xfa65('0x2c')](util['format'](_0xfa65('0x150'),this[_0xfa65('0xb')]['callerid'],_0x1b43cb['findBy']));var _0x26cb11=this['agentUnpause'][_0xfa65('0x9e')](this,_0x1b43cb[_0xfa65('0x151')]);if(_0x26cb11){logger[_0xfa65('0x2c')](util['format'](_0xfa65('0x156'),this[_0xfa65('0xb')][_0xfa65('0x38')],_0x1b43cb[_0xfa65('0x151')]));this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0x156'),this['channel'][_0xfa65('0x38')],_0x1b43cb['findBy']));return{'code':0xc8,'result':_0xfa65('0x152')};}else{logger[_0xfa65('0x2c')](util[_0xfa65('0x26')](_0xfa65('0x153'),this[_0xfa65('0xb')]['callerid'],_0x1b43cb[_0xfa65('0x151')]));this[_0xfa65('0xb')][_0xfa65('0xa1')](util[_0xfa65('0x26')](_0xfa65('0x153'),this['channel']['callerid'],_0x1b43cb[_0xfa65('0x151')]));return{'code':0xc8,'result':_0xfa65('0x154')};}};AGIVertices[_0xfa65('0xd')][_0xfa65('0x1c0')]=function(_0x453e1d){logger[_0xfa65('0x2c')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x453e1d['label']));var _0x29253b=this[_0xfa65('0xb')][_0xfa65('0xa3')](_0xfa65('0x1c1'),[_0x453e1d[_0xfa65('0x1c2')],_0x453e1d['options']]);if(_0x29253b[_0xfa65('0xa5')]===-0x1){return _0x29253b;}return this[_0xfa65('0xb')][_0xfa65('0xa1')](util['format']('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x453e1d[_0xfa65('0x1c2')]));};AGIVertices['prototype']['vswitch']=function(_0x36b953){logger['info'](util[_0xfa65('0x26')](_0xfa65('0x1c3'),_0x36b953[_0xfa65('0x35')]));if(!this[_0xfa65('0x7e')](_0x36b953[_0xfa65('0xce')])){return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x36b953,_0xfa65('0x1a6'));}var _0x16b0c7=this[_0xfa65('0xe')][_0xfa65('0x9e')](this,_0x36b953[_0xfa65('0xce')]);if(!_0x16b0c7){return this[_0xfa65('0xb')][_0xfa65('0x2a')](_0x36b953,_0xfa65('0xd0'));}var _0xc92f70=this[_0xfa65('0xb')][_0xfa65('0xe')](_0x16b0c7);return{'code':0xc8,'result':_0xc92f70['extra']?_0xc92f70['extra']:'-'};};String[_0xfa65('0xd')]['replaceAll']=function(_0x4d08d6,_0x7e7432){return this[_0xfa65('0x97')](_0x4d08d6)['join'](_0x7e7432);};module[_0xfa65('0x1c4')]=AGIVertices; \ No newline at end of file +var _0xb6e3=['file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','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','streamFile','.wav','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','googleasr','no\x20key\x20configured','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','beep','tilde\x20%s\x20file\x20created','tildeASR','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','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','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','no\x20file\x20audio\x20selected','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','RECORDING_SAVENAME','escape_digits','restapi','no\x20url\x20configured','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','email','user','bcc','subject','Smtp','service','host','port','secure','authentication','pass','template_id','sendMail\x20message','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','agi','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','rpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','IntervalId','interval','map','Intervals','format','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','getPause','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','restAPI','method','timeout','number','includes','POST','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','url','parse','stringify','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','appid','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','replaceAllVariables','split','replaceAll','extra','getAndSetVariable','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','wait','no\x20list\x20selected','delay','add','callback_priority','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','MRCPRecog','RECOG_INSTANCE()','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\x20database\x20selected','getSquareOdbc','no\x20query\x20configured','replace','query:\x20%s','getQueryOdbc','variable_id','forEach','keys','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block'];(function(_0x5874bd,_0x496481){var _0x174894=function(_0x1065d9){while(--_0x1065d9){_0x5874bd['push'](_0x5874bd['shift']());}};_0x174894(++_0x496481);}(_0xb6e3,0xbf));var _0x3b6e=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xb6e3[_0x2dea24];return _0x309d58;};'use strict';var fs=require('fs');var path=require(_0x3b6e('0x0'));var util=require(_0x3b6e('0x1'));var _=require(_0x3b6e('0x2'));var sh=require(_0x3b6e('0x3'));var odbc=require(_0x3b6e('0x4'))();var rs=require(_0x3b6e('0x5'));var moment=require(_0x3b6e('0x6'));var Mustache=require(_0x3b6e('0x7'));var rp=require('request-promise');var logger=require('../../config/logger')(_0x3b6e('0x8'));var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH=_0x3b6e('0x9');var recursiveMapAttributes=[_0x3b6e('0xa'),_0x3b6e('0xb')];var verticesWithRetry=[_0x3b6e('0xc'),_0x3b6e('0xd'),_0x3b6e('0xe')];var AGIVertices=function(_0x3164c4,_0x2c8caa,_0x57a395){this['channel']=_0x3164c4;this[_0x3b6e('0xf')]=_0x2c8caa;this['mailRpc']=_0x57a395;};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x11')]=function(_0x243576,_0xdd9256){this[_0x3b6e('0xf')][_0x3b6e('0x12')](_0x243576)[_0x3b6e('0x13')](function(_0x473fa5){_0xdd9256(null,_0x473fa5?_0x473fa5[_0x3b6e('0x14')]:![]);})[_0x3b6e('0x15')](function(_0x36869b){_0xdd9256(_0x36869b);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x16')]=function(_0x2b9368,_0xb9cc68){this[_0x3b6e('0xf')]['getVoiceQueueById'](_0x2b9368)['then'](function(_0x482d0e){_0xb9cc68(null,_0x482d0e?_0x482d0e[_0x3b6e('0x14')]:![]);})['catch'](function(_0x1be3fe){_0xb9cc68(_0x1be3fe);});};AGIVertices['prototype'][_0x3b6e('0x17')]=function(_0x8b00a2,_0xa48a22){this[_0x3b6e('0xf')][_0x3b6e('0x18')](_0x8b00a2)[_0x3b6e('0x13')](function(_0x3da222){_0xa48a22(null,_0x3da222?_0x3da222[_0x3b6e('0x14')]:![]);})[_0x3b6e('0x15')](function(_0x6a373e){_0xa48a22(_0x6a373e);});};AGIVertices[_0x3b6e('0x10')]['getSquareOdbc']=function(_0x5b771c,_0x4183ac){this['rpc'][_0x3b6e('0x19')](_0x5b771c)[_0x3b6e('0x13')](function(_0x3f244f){_0x4183ac(null,_0x3f244f?_0x3f244f[_0x3b6e('0x1a')]:![]);})[_0x3b6e('0x15')](function(_0x389ba4){_0x4183ac(_0x389ba4);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1b')]=function(_0x4b470e,_0xefcc5d){this[_0x3b6e('0xf')][_0x3b6e('0x1c')](_0x4b470e)[_0x3b6e('0x13')](function(_0x1ea312){_0xefcc5d(null,_0x1ea312?_0x1ea312[_0x3b6e('0x14')]:![]);})[_0x3b6e('0x15')](function(_0x2fc240){_0xefcc5d(_0x2fc240);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1d')]=function(_0x5b0536,_0x264278){this[_0x3b6e('0xf')][_0x3b6e('0x1e')](_0x5b0536)[_0x3b6e('0x13')](function(_0x54f8e5){_0x264278(null,_0x54f8e5?_0x54f8e5[_0x3b6e('0x14')]:![]);})[_0x3b6e('0x15')](function(_0xb0f906){_0x264278(_0xb0f906);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1f')]=function(_0x3073b8,_0x191730){var _0x1a9db9=this;this[_0x3b6e('0xf')]['getSoundById'](_0x3073b8)[_0x3b6e('0x13')](function(_0x143239){_0x191730(null,_0x143239?_0x1a9db9[_0x3b6e('0x20')](_0x143239[_0x3b6e('0x21')]):![]);})[_0x3b6e('0x15')](function(_0x577a07){_0x191730(_0x577a07);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x22')]=function(_0x1362b8,_0x5ad4a4){this[_0x3b6e('0xf')][_0x3b6e('0x23')](_0x1362b8)[_0x3b6e('0x13')](function(_0x1ddfe1){_0x5ad4a4(null,_0x1ddfe1?_0x1ddfe1:![]);})[_0x3b6e('0x15')](function(_0x2e30fb){_0x5ad4a4(_0x2e30fb);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x24')]=function(_0x156133,_0x21dc64,_0xc508df){this[_0x3b6e('0x25')][_0x3b6e('0x24')](_0x156133,_0x21dc64)[_0x3b6e('0x13')](function(){_0xc508df(null);})[_0x3b6e('0x15')](function(_0x213259){_0xc508df(_0x213259);});};AGIVertices['prototype']['getIntervals']=function(_0x132fa6,_0x1c2c6b){this['rpc']['getIntervalById'](_0x132fa6)[_0x3b6e('0x13')](function(_0x557de9){if(_0x557de9){if(_0x557de9[_0x3b6e('0x26')]){_0x1c2c6b(null,[_0x557de9[_0x3b6e('0x27')]]);}else{_0x1c2c6b(null,_[_0x3b6e('0x28')](_0x557de9[_0x3b6e('0x29')],_0x3b6e('0x27')));}}else{_0x1c2c6b(null,![]);}})[_0x3b6e('0x15')](function(_0x398755){_0x1c2c6b(_0x398755);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x20')]=function(_0x4cbdbc){return util[_0x3b6e('0x2a')]('%s/sounds/converted/%s',FILES_PATH,_0x4cbdbc);};AGIVertices[_0x3b6e('0x10')]['getQueryOdbc']=function(_0x41a4d5,_0x4a4ab2,_0x1b10b6){odbc[_0x3b6e('0x2b')](_0x41a4d5,function(_0x1135be){if(_0x1135be){logger[_0x3b6e('0x2c')](_0x3b6e('0x2d'),_0x1135be);_0x1b10b6(_0x1135be);}else{logger[_0x3b6e('0x2e')]('ODBC\x20connection\x20successfully');odbc[_0x3b6e('0x2f')](_0x4a4ab2,function(_0x2e8c6e,_0x584798){if(_0x2e8c6e){logger['info'](_0x3b6e('0x30'),_0x4a4ab2);_0x1b10b6(_0x2e8c6e);}else{logger[_0x3b6e('0x2e')]('Query\x20executed\x20correctly\x20%s',_0x4a4ab2);odbc[_0x3b6e('0x31')](function(_0x3d8d6c){if(_0x3d8d6c){logger['error'](_0x3b6e('0x32'),_0x3d8d6c);}_0x1b10b6(null,_0x584798);});}});}});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x33')]=function(_0x368aa7,_0x4fddd0){this[_0x3b6e('0xf')]['getSmsAccountById'](_0x368aa7)[_0x3b6e('0x13')](function(_0x55d8f3){_0x4fddd0(null,_0x55d8f3?_0x55d8f3:![]);})[_0x3b6e('0x15')](function(_0x17f464){_0x4fddd0(_0x17f464);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x34')]=function(_0x4aca69,_0x4c23af){this[_0x3b6e('0xf')][_0x3b6e('0x34')](_0x4aca69)[_0x3b6e('0x13')](function(_0x5ddc57){_0x4c23af(null,_0x5ddc57);})[_0x3b6e('0x15')](function(_0x4a171b){_0x4c23af(_0x4a171b);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x35')]=function(_0x58556c,_0x1fa898,_0x30d90d){this[_0x3b6e('0xf')][_0x3b6e('0x35')]({'uniqueid':this[_0x3b6e('0x36')][_0x3b6e('0x37')],'node':_0x58556c[_0x3b6e('0x38')],'application':_0x58556c[_0x3b6e('0x39')],'data':_0x1fa898||null,'project_name':this[_0x3b6e('0x36')][_0x3b6e('0x3a')],'callerid':this[_0x3b6e('0x36')]['callerid']})[_0x3b6e('0x13')](function(_0x32e085){if(_0x30d90d){_0x30d90d(null,_0x32e085);}})[_0x3b6e('0x15')](function(_0x18a28a){if(_0x30d90d){_0x30d90d(_0x18a28a);}});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x3b')]=function(_0x24313c,_0x5bfd13,_0x33b038,_0x39bc00){this[_0x3b6e('0xf')][_0x3b6e('0x3b')]({'uniqueid':this[_0x3b6e('0x36')][_0x3b6e('0x37')],'callerid':this[_0x3b6e('0x36')][_0x3b6e('0x3c')],'calleridname':this[_0x3b6e('0x36')][_0x3b6e('0x3d')],'context':this[_0x3b6e('0x36')][_0x3b6e('0x3e')],'extension':this[_0x3b6e('0x36')][_0x3b6e('0x3f')],'priority':this[_0x3b6e('0x36')]['priority'],'accountcode':this[_0x3b6e('0x36')][_0x3b6e('0x40')],'dnid':this[_0x3b6e('0x36')][_0x3b6e('0x41')],'projectName':this[_0x3b6e('0x36')][_0x3b6e('0x3a')],'saveName':_0x5bfd13,'filename':_0x24313c[_0x3b6e('0x42')]||_0x5bfd13,'savePath':_0x33b038})[_0x3b6e('0x13')](function(_0x20ac6f){_0x39bc00(null,_0x20ac6f);})[_0x3b6e('0x15')](function(_0x448e85){_0x39bc00(_0x448e85);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x43')]=function(_0x439449,_0x5135ac,_0x68564b,_0x311d78,_0x46ae84){this['rpc'][_0x3b6e('0x43')]({'uniqueid':this[_0x3b6e('0x36')]['uniqueid'],'body':_0x439449,'direction':_0x5135ac,'providerName':_0x68564b,'providerResponse':_0x311d78})[_0x3b6e('0x13')](function(_0x30ad92){if(_0x46ae84){_0x46ae84(null,_0x30ad92);}})[_0x3b6e('0x15')](function(_0x259d45){if(_0x46ae84){_0x46ae84(_0x259d45);}});};AGIVertices['prototype']['createCmContact']=function(_0x55b70a,_0x2831f6){this[_0x3b6e('0xf')][_0x3b6e('0x44')]({'firstName':_['isEmpty'](_0x55b70a[_0x3b6e('0x14')])||_[_0x3b6e('0x45')](_0x55b70a['name'])?_0x3b6e('0x46')+Math[_0x3b6e('0x47')]():_0x55b70a[_0x3b6e('0x14')],'lastName':_[_0x3b6e('0x48')](_0x55b70a['lastName'])||_[_0x3b6e('0x45')](_0x55b70a[_0x3b6e('0x49')])?null:_0x55b70a[_0x3b6e('0x49')],'phone':_0x55b70a[_0x3b6e('0x4a')],'ListId':_0x55b70a[_0x3b6e('0x4b')],'scheduledat':_0x55b70a['scheduledAt'],'callbackUniqueid':this[_0x3b6e('0x36')][_0x3b6e('0x37')],'tags':_0x3b6e('0x4c'),'description':_0x3b6e('0x4d')+_0x55b70a[_0x3b6e('0x4e')][_0x3b6e('0x4f')](),'priority':_0x55b70a['callback_priority']})[_0x3b6e('0x13')](function(_0x4a7e51){_0x2831f6(null,_0x4a7e51);})[_0x3b6e('0x15')](function(_0x2e57f8){_0x2831f6(_0x2e57f8);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x50')]=function(_0x30c435,_0x239a50){this[_0x3b6e('0xf')]['getPauseById'](_0x30c435)[_0x3b6e('0x13')](function(_0x49c2da){_0x239a50(null,_0x49c2da?_0x49c2da['name']:![]);})[_0x3b6e('0x15')](function(_0x5b1303){_0x239a50(_0x5b1303);});};AGIVertices[_0x3b6e('0x10')]['agentPause']=function(_0x575b86,_0x3000ea,_0x5e5eec){var _0x3220e0={'role':_0x3b6e('0x51')};_0x3220e0[_0x575b86]=this['channel'][_0x3b6e('0x3c')];this[_0x3b6e('0xf')][_0x3b6e('0x52')](_0x3220e0,_0x3000ea,this[_0x3b6e('0x36')][_0x3b6e('0x37')])[_0x3b6e('0x13')](function(_0x30d600){_0x5e5eec(null,_[_0x3b6e('0x45')](_0x30d600)?![]:!![]);})['catch'](function(_0x45524b){logger['error'](_0x45524b);_0x5e5eec(null,![]);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x53')]=function(_0x5a4f33,_0x171ae7){var _0x5b9e39={'role':'agent'};_0x5b9e39[_0x5a4f33]=this[_0x3b6e('0x36')][_0x3b6e('0x3c')];this[_0x3b6e('0xf')]['agentUnpause'](_0x5b9e39)[_0x3b6e('0x13')](function(_0x7be201){_0x171ae7(null,_[_0x3b6e('0x45')](_0x7be201)?![]:!![]);})['catch'](function(_0x34791e){logger[_0x3b6e('0x2c')](_0x34791e);_0x171ae7(null,![]);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x54')]=function(_0x2231b9,_0x170261){var _0x22065e={'role':_0x3b6e('0x51')};_0x22065e[_0x2231b9]=this['channel']['callerid'];this['rpc'][_0x3b6e('0x54')](_0x22065e)[_0x3b6e('0x13')](function(_0x3c8d61){_0x170261(null,_[_0x3b6e('0x45')](_0x3c8d61)?![]:!![]);})['catch'](function(_0x4cd9fa){logger[_0x3b6e('0x2c')](_0x4cd9fa);_0x170261(null,![]);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x55')]=function(_0x4a03be,_0x4d49b0){var _0x38b723={'role':_0x3b6e('0x51')};_0x38b723[_0x4a03be]=this[_0x3b6e('0x36')][_0x3b6e('0x3c')];var _0x1bf185=_0x4a03be!=_0x3b6e('0x56')?util[_0x3b6e('0x2a')](_0x3b6e('0x57'),'LOCAL',this[_0x3b6e('0x36')]['callerid']):undefined;this[_0x3b6e('0xf')]['agentLogin'](_0x38b723,_0x1bf185)[_0x3b6e('0x13')](function(_0x1e0764){_0x4d49b0(null,_['isNil'](_0x1e0764)?![]:!![]);})[_0x3b6e('0x15')](function(_0xc3a117){logger[_0x3b6e('0x2c')](_0xc3a117);_0x4d49b0(null,![]);});};AGIVertices[_0x3b6e('0x10')]['shellCommand']=function(_0x6e8e35,_0x53060d){sh['exec'](_[_0x3b6e('0x58')](_0x6e8e35),function(_0x4c598f,_0x3cdd58){var _0x1f1360=_0x3cdd58['replace'](/(\r\n|\n|\r)/gm,'');_0x53060d(null,_0x1f1360);});};AGIVertices[_0x3b6e('0x10')]['googleCloudTTS']=function(_0x1d5b89,_0x40f6de){scripts[_0x3b6e('0x59')](_0x1d5b89[_0x3b6e('0x5a')],_0x1d5b89[_0x3b6e('0x5b')]||'text',_0x1d5b89[_0x3b6e('0x5c')],_0x1d5b89[_0x3b6e('0x5d')]||_0x3b6e('0x5e'),_0x1d5b89[_0x3b6e('0x5f')]||_0x3b6e('0x60'),_0x1d5b89[_0x3b6e('0x61')]||'MP3')[_0x3b6e('0x13')](function(_0x302bc3){_0x40f6de(null,_0x302bc3);})[_0x3b6e('0x15')](function(_0x390664){_0x40f6de(_0x390664);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x62')]=function(_0x40675b,_0xd8fa08){scripts[_0x3b6e('0x62')](_0x40675b['text'],_0x40675b['google_tts_language']||'en',0x1)[_0x3b6e('0x13')](function(_0x424ca4){_0xd8fa08(null,_0x424ca4);})[_0x3b6e('0x15')](function(_0x169cb8){_0xd8fa08(_0x169cb8);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x63')]=function(_0x527bdc,_0x221c83){var _0x14527c={'uri':_0x527bdc['url'],'method':_0x527bdc[_0x3b6e('0x64')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x527bdc[_0x3b6e('0x65')])===_0x3b6e('0x66')&&parseInt(_0x527bdc[_0x3b6e('0x65')])>=0x1?parseInt(_0x527bdc[_0x3b6e('0x65')])*0x3e8:0x5*0x3e8};if(_[_0x3b6e('0x67')]([_0x3b6e('0x68'),'PUT'],_0x14527c[_0x3b6e('0x64')][_0x3b6e('0x69')]())){try{_0x14527c[_0x3b6e('0x6a')]=_0x527bdc['rawBody']?JSON['parse'](_0x527bdc[_0x3b6e('0xb')]):{};}catch(_0x199c61){logger[_0x3b6e('0x2c')](_0x3b6e('0x6b'),_0x199c61);}}try{_0x14527c[_0x3b6e('0x6c')]=_0x527bdc[_0x3b6e('0xa')]?JSON['parse'](_0x527bdc[_0x3b6e('0xa')]):{};}catch(_0x5cea41){logger[_0x3b6e('0x2c')](_0x3b6e('0x6d'),_0x5cea41);}if(_0x527bdc['computedVariables']){try{var _0x523d67=require(_0x527bdc[_0x3b6e('0x6e')])[_0x3b6e('0x6f')](this,_0x14527c);_0x14527c['uri']=Mustache[_0x3b6e('0x70')](_0x527bdc[_0x3b6e('0x71')],_0x523d67,{},['$$','$$']);if(_0x14527c[_0x3b6e('0x6c')]){_0x14527c['headers']=JSON[_0x3b6e('0x72')](Mustache[_0x3b6e('0x70')](JSON[_0x3b6e('0x73')](_0x14527c[_0x3b6e('0x6c')]),_0x523d67,{},['$$','$$']));}if(_0x14527c[_0x3b6e('0x6a')]){_0x14527c[_0x3b6e('0x6a')]=JSON[_0x3b6e('0x72')](Mustache[_0x3b6e('0x70')](JSON[_0x3b6e('0x73')](_0x14527c[_0x3b6e('0x6a')]),_0x523d67,{},['$$','$$']));}}catch(_0x1e107b){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1e107b);}}rp(_0x14527c)[_0x3b6e('0x13')](function(_0x1ce4d8){var _0x25b4b9={'statusCode':_0x1ce4d8[_0x3b6e('0x74')]||0xc8,'statusMessage':_0x1ce4d8['statusMessage']||'OK','headers':_0x1ce4d8[_0x3b6e('0x6c')]||{},'body':_0x1ce4d8[_0x3b6e('0x6a')]||{}};_0x221c83(null,_0x25b4b9);})[_0x3b6e('0x15')](function(_0x51545c){var _0x355d6d={'statusCode':_0x51545c[_0x3b6e('0x74')]||0x1f4,'statusMessage':_0x51545c[_0x3b6e('0x75')]||_0x3b6e('0x76'),'headers':_0x51545c['options'][_0x3b6e('0x6c')]||{},'body':_0x51545c[_0x3b6e('0x77')][_0x3b6e('0x6a')]||{}};_0x221c83(null,_0x355d6d);});};AGIVertices[_0x3b6e('0x10')]['googleDialogflow']=function(_0x13bd71,_0x57b46e){scripts['googleDialogflow'](this[_0x3b6e('0x36')][_0x3b6e('0x37')],_0x13bd71[_0x3b6e('0x78')],_0x13bd71[_0x3b6e('0x5c')],_0x13bd71[_0x3b6e('0x79')]||'en')[_0x3b6e('0x13')](function(_0x3a3952){_0x57b46e(null,_0x3a3952);})[_0x3b6e('0x15')](function(_0x89b57d){_0x57b46e(_0x89b57d);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x7a')]=function(_0x558fb4,_0x20f1a5){scripts['googleDialogflowV2'](this[_0x3b6e('0x36')][_0x3b6e('0x37')],_0x558fb4[_0x3b6e('0x7b')],_0x558fb4[_0x3b6e('0x7c')],_0x558fb4[_0x3b6e('0x7d')],_0x558fb4[_0x3b6e('0x5c')],_0x558fb4[_0x3b6e('0x7e')]||'en')['then'](function(_0x130706){_0x20f1a5(null,_0x130706);})[_0x3b6e('0x15')](function(_0x473eec){_0x20f1a5(_0x473eec);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x7f')]=function(_0x16f2b5,_0x1d2f8c){scripts[_0x3b6e('0x7f')](this[_0x3b6e('0x36')],_0x16f2b5)[_0x3b6e('0x13')](function(_0x1ec733){_0x1d2f8c(null,_0x1ec733);})['catch'](function(_0x1c19ab){_0x1d2f8c(_0x1c19ab);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x80')]=function(_0x54ff32,_0xb2d862){scripts[_0x3b6e('0x80')](_0x54ff32[_0x3b6e('0x78')],_0x54ff32[_0x3b6e('0x5c')],_0x54ff32[_0x3b6e('0x81')]||_0x3b6e('0x5e'),_0x54ff32['speed'])[_0x3b6e('0x13')](function(_0x3d4a2b){_0xb2d862(null,_0x3d4a2b);})[_0x3b6e('0x15')](function(_0x575aaf){_0xb2d862(_0x575aaf);});};AGIVertices['prototype'][_0x3b6e('0x82')]=function(_0x21cb3d,_0x50b57c,_0x45b9cb){scripts[_0x3b6e('0x82')](_0x50b57c,_0x21cb3d[_0x3b6e('0x78')],_0x21cb3d['ispeech_asr_language']||'en-US',this['isConfigured'](_0x21cb3d[_0x3b6e('0x83')])?_0x21cb3d['model']:undefined)['then'](function(_0x32d229){_0x45b9cb(null,_0x32d229);})['catch'](function(_0x24b753){_0x45b9cb(_0x24b753);});};AGIVertices['prototype'][_0x3b6e('0x84')]=function(_0x4dfe52,_0x2c0acf){scripts[_0x3b6e('0x84')](_0x4dfe52[_0x3b6e('0x85')],_0x4dfe52[_0x3b6e('0x86')],_0x4dfe52[_0x3b6e('0x87')],_0x4dfe52['aws_polly_voice']||_0x3b6e('0x88'),_0x4dfe52[_0x3b6e('0x5c')],_0x4dfe52['aws_text_type']||_0x3b6e('0x5c'))[_0x3b6e('0x13')](function(_0x2cf6e6){_0x2c0acf(null,_0x2cf6e6);})[_0x3b6e('0x15')](function(_0x4b859){_0x2c0acf(_0x4b859);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x89')]=function(_0x4bafae,_0x4ace83){scripts[_0x3b6e('0x89')](this[_0x3b6e('0x36')]['uniqueid'],_0x4bafae[_0x3b6e('0x85')],_0x4bafae[_0x3b6e('0x86')],_0x4bafae[_0x3b6e('0x8a')],_0x4bafae['text'],_0x4bafae[_0x3b6e('0x8b')])[_0x3b6e('0x13')](function(_0x2fa446){_0x4ace83(null,_0x2fa446);})[_0x3b6e('0x15')](function(_0x488dea){_0x4ace83(_0x488dea);});};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x8c')]=function(_0x4cce30,_0x1140da,_0x5297d4){scripts['googleASR'](_0x1140da,_0x4cce30['key'],_0x4cce30[_0x3b6e('0x8d')]||_0x3b6e('0x5e'))['then'](function(_0xfd6dec){_0x5297d4(null,_0xfd6dec);})[_0x3b6e('0x15')](function(_0xa68bdd){_0x5297d4(_0xa68bdd);});};AGIVertices['prototype']['tildeASR']=function(_0xc35a43,_0x477e82,_0xf48b91){scripts['tildeASR'](_0x477e82,_0xc35a43[_0x3b6e('0x8e')],_0xc35a43[_0x3b6e('0x8f')],_0xc35a43['uri'])['then'](function(_0x58ceee){_0xf48b91(null,_0x58ceee);})[_0x3b6e('0x15')](function(_0x4f1fb7){_0xf48b91(_0x4f1fb7);});};AGIVertices['prototype'][_0x3b6e('0x90')]=function(_0x5ab12e){var _0x32efd6=_[_0x3b6e('0x67')](verticesWithRetry,_0x5ab12e[_0x3b6e('0x39')])?_0x5ab12e:_[_0x3b6e('0x91')](_0x5ab12e);for(var _0x540b05 in _0x32efd6){if(_0x32efd6[_0x3b6e('0x92')](_0x540b05)){if(_0x32efd6[_0x540b05]&&_['isString'](_0x32efd6[_0x540b05])){if(_[_0x3b6e('0x67')](recursiveMapAttributes,_0x540b05)){_0x32efd6[_0x540b05]=this[_0x3b6e('0x93')](_0x32efd6[_0x540b05]);}else{_0x32efd6[_0x540b05]=this['replaceAllVariables'](_0x32efd6[_0x540b05]);}}}}return _0x32efd6;};AGIVertices['prototype'][_0x3b6e('0x94')]=function(_0x560310){for(var _0x360ebd in _0x560310){if(_0x560310[_0x3b6e('0x92')](_0x360ebd)){if(_[_0x3b6e('0x95')](_0x560310[_0x360ebd])){this[_0x3b6e('0x94')](_0x560310[_0x360ebd]);}else if(_[_0x3b6e('0x96')](_0x560310[_0x360ebd])){for(var _0x3e3676=0x0;_0x3e3676<_0x560310[_0x360ebd][_0x3b6e('0x97')];_0x3e3676++){this[_0x3b6e('0x94')](_0x560310[_0x360ebd][_0x3e3676]);}}else if(_[_0x3b6e('0x98')](_0x560310[_0x360ebd])){_0x560310[_0x360ebd]=this['replaceAllVariables'](_0x560310[_0x360ebd]);}}}};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x99')]=function(_0x1fac5b,_0x40ff0a){for(var _0x54f62d in _0x1fac5b){if(_0x1fac5b[_0x3b6e('0x92')](_0x54f62d)){if(_[_0x3b6e('0x95')](_0x1fac5b[_0x54f62d])){if(!_['isEmpty'](_0x1fac5b[_0x54f62d])){this['saveRestApiResult'](_0x1fac5b[_0x54f62d],util[_0x3b6e('0x2a')](_0x3b6e('0x9a'),_0x40ff0a,_0x54f62d));}}else if(_['isArray'](_0x1fac5b[_0x54f62d])){for(var _0x145ef3=0x0;_0x145ef3<_0x1fac5b[_0x54f62d][_0x3b6e('0x97')];_0x145ef3++){this[_0x3b6e('0x99')](_0x1fac5b[_0x54f62d][_0x145ef3],util[_0x3b6e('0x2a')]('%s.%s',_0x40ff0a,_0x54f62d+'['+_0x145ef3+']'));}}else{if(!_[_0x3b6e('0x45')](_0x1fac5b[_0x54f62d])){this[_0x3b6e('0x36')][_0x3b6e('0x9b')](util[_0x3b6e('0x2a')](_0x3b6e('0x9a'),_0x40ff0a,_0x54f62d),_0x1fac5b[_0x54f62d]);}}}}};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x93')]=function(_0xffe6fd){try{var _0x18cb6b=JSON[_0x3b6e('0x72')](_0xffe6fd);this[_0x3b6e('0x94')](_0x18cb6b);return JSON[_0x3b6e('0x73')](_0x18cb6b);}catch(_0x17e5c6){return this['replaceAllVariables'](_0xffe6fd);}};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x9c')]=function(_0x1e99c3){var _0x292165=_0x1e99c3['split']('{');for(var _0x436231=0x1;_0x436231<_0x292165['length'];_0x436231+=0x1){var _0x28d88e=_0x292165[_0x436231][_0x3b6e('0x9d')]('}');if(_0x28d88e[_0x3b6e('0x97')]>0x1){_0x1e99c3=_0x1e99c3[_0x3b6e('0x9e')]('{'+_0x28d88e[0x0]+'}',this[_0x3b6e('0x36')]['getVariable'](_0x28d88e[0x0])[_0x3b6e('0x9f')]||_0x28d88e[0x0]);}}if(_0x292165['length']===0x1){return _0x1e99c3[_0x3b6e('0x4f')]();}return this[_0x3b6e('0x9c')](_0x1e99c3);};AGIVertices['prototype'][_0x3b6e('0xa0')]=function(_0x25c675,_0x1f2dd8){var _0x570a74=this[_0x3b6e('0x36')][_0x3b6e('0x11')](_0x25c675);if(_0x570a74['result']===-0x1){return _0x570a74;}logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x1f2dd8,_0x570a74['extra']));return this[_0x3b6e('0x36')]['setVariable'](_0x1f2dd8,_0x570a74[_0x3b6e('0x9f')]);};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xa1')]=function(_0x5bb57f){return _0x5bb57f&&_0x5bb57f!=='0'&&_0x5bb57f!=='-1'&&_0x5bb57f!=='';};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xa2')]=function(_0x55e07a){this[_0x3b6e('0x35')][_0x3b6e('0x6f')](this,_0x55e07a,'-');_0x55e07a[_0x3b6e('0xa3')]=_0x55e07a['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xa4')]=function(_0x42d715){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0xa5'),_0x42d715[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x42d715[_0x3b6e('0x5c')])){return this['channel'][_0x3b6e('0xa6')](_0x3b6e('0xa7'));}var _0x2b14a0='\x22'+_0x42d715[_0x3b6e('0x5c')]+'\x22';if(this['isConfigured'](_0x42d715[_0x3b6e('0x77')])){_0x2b14a0+=','+_0x42d715['options'];}var _0xfe429d=this[_0x3b6e('0x36')][_0x3b6e('0xa8')](_0x3b6e('0xa9'),_0x2b14a0);if(_0xfe429d[_0x3b6e('0xaa')]===-0x1){return _0xfe429d;}return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xab'),_0x2b14a0));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xac')]=function(_0x183d67){logger[_0x3b6e('0x2e')](util['format'](_0x3b6e('0xad'),_0x183d67['label']));if(!this[_0x3b6e('0xa1')](_0x183d67[_0x3b6e('0xae')])){return this[_0x3b6e('0x36')]['noop'](_0x3b6e('0xaf'));}var _0x295153=_0x183d67[_0x3b6e('0xae')];if(this[_0x3b6e('0xa1')](_0x183d67[_0x3b6e('0x77')])){_0x295153+=','+_0x183d67[_0x3b6e('0x77')];}var _0xb12642=this['channel']['exec']('MRCPRecog',_0x295153);if(_0xb12642[_0x3b6e('0xaa')]===-0x1){return _0xb12642;}var _0xc65a46=this[_0x3b6e('0xa0')](_0x3b6e('0xb0'),_0x3b6e('0xb1'));if(_0xc65a46[_0x3b6e('0xaa')]===-0x1){return _0xc65a46;}var _0x3bced5=this[_0x3b6e('0xa0')](_0x3b6e('0xb2'),_0x3b6e('0xb3'));if(_0x3bced5[_0x3b6e('0xaa')]===-0x1){return _0x3bced5;}var _0x42d9c5=this[_0x3b6e('0xa0')]('RECOG_INSTANCE()',_0x3b6e('0xb4'));if(_0x42d9c5[_0x3b6e('0xaa')]===-0x1){return _0x42d9c5;}return this['channel']['noop'](util[_0x3b6e('0x2a')](_0x3b6e('0xb5'),_0x295153));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x8')]=function(_0x5834f7){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x5834f7[_0x3b6e('0x38')]));return this[_0x3b6e('0x36')][_0x3b6e('0x8')]([_0x5834f7[_0x3b6e('0xb6')],_0x5834f7[_0x3b6e('0xb7')]]);};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xb8')]=function(_0x31532c){logger[_0x3b6e('0x2e')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x31532c[_0x3b6e('0x38')]));if(this[_0x3b6e('0xa1')](_0x31532c[_0x3b6e('0x65')])){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x31532c['timeout']));var _0x4a66c1=this[_0x3b6e('0x36')][_0x3b6e('0xb9')](_0x31532c[_0x3b6e('0x65')]);if(_0x4a66c1[_0x3b6e('0xaa')]===-0x1){return _0x4a66c1;}}return this[_0x3b6e('0x36')][_0x3b6e('0xb8')]();};AGIVertices['prototype']['callback']=function(_0x3b3e61){logger[_0x3b6e('0x2e')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x3b3e61[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x3b3e61['list_id'])){return this[_0x3b6e('0x36')]['error'](_0x3b3e61,_0x3b6e('0xba'));}_0x3b3e61[_0x3b6e('0x4e')]=moment();if(this[_0x3b6e('0xa1')](_0x3b3e61[_0x3b6e('0xbb')])){_0x3b3e61[_0x3b6e('0x4e')]=moment()[_0x3b6e('0xbc')](_0x3b3e61['delay'],'minutes');}if(!this['isConfigured'](_0x3b3e61[_0x3b6e('0xbd')])){_0x3b3e61[_0x3b6e('0xbd')]=0x2;}this[_0x3b6e('0x44')]['sync'](this,_0x3b3e61);return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x3b3e61[_0x3b6e('0x4a')],_0x3b3e61[_0x3b6e('0x4b')],_0x3b3e61[_0x3b6e('0x4e')]));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xbe')]=function(_0xc2d56c){logger[_0x3b6e('0x2e')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0xc2d56c[_0x3b6e('0x38')]));var _0x275cf9=this[_0x3b6e('0x36')][_0x3b6e('0xa8')](_0xc2d56c[_0x3b6e('0xbf')],_0xc2d56c[_0x3b6e('0x77')]);if(_0x275cf9[_0x3b6e('0xaa')]===-0x1){return _0x275cf9;}return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xc0'),_0xc2d56c[_0x3b6e('0xbf')],_0xc2d56c[_0x3b6e('0x77')]));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xc1')]=function(_0x1d0207){logger['info'](util[_0x3b6e('0x2a')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x1d0207['label']));if(!this[_0x3b6e('0xa1')](_0x1d0207[_0x3b6e('0x5c')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')]('no\x20text\x20configured');}var _0x432930='\x22'+_0x1d0207[_0x3b6e('0x5c')]+'\x22';if(this[_0x3b6e('0xa1')](_0x1d0207[_0x3b6e('0x77')])){_0x432930+=','+_0x1d0207[_0x3b6e('0x77')];}var _0x1dc2ec=this[_0x3b6e('0x36')]['exec'](_0x3b6e('0xa9'),_0x432930);if(_0x1dc2ec[_0x3b6e('0xaa')]===-0x1){return _0x1dc2ec;}return this['channel'][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xab'),_0x432930));};AGIVertices[_0x3b6e('0x10')]['sestektts']=function(_0x34539e){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0xc2'),_0x34539e[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x34539e[_0x3b6e('0x5c')])){return this[_0x3b6e('0x36')]['noop'](_0x3b6e('0xa7'));}var _0x1f3379='\x22'+_0x34539e[_0x3b6e('0x5c')]+'\x22';if(this[_0x3b6e('0xa1')](_0x34539e[_0x3b6e('0x77')])){_0x1f3379+=','+_0x34539e[_0x3b6e('0x77')];}var _0x58928b=this[_0x3b6e('0x36')][_0x3b6e('0xa8')](_0x3b6e('0xa9'),_0x1f3379);if(_0x58928b[_0x3b6e('0xaa')]===-0x1){return _0x58928b;}return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xab'),_0x1f3379));};AGIVertices['prototype'][_0x3b6e('0xc3')]=function(_0xa3a972){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0xa3a972['label']));if(!this[_0x3b6e('0xa1')](_0xa3a972[_0x3b6e('0xae')])){return this['channel'][_0x3b6e('0xa6')](_0x3b6e('0xaf'));}var _0x55a704=_0xa3a972[_0x3b6e('0xae')];if(this[_0x3b6e('0xa1')](_0xa3a972[_0x3b6e('0x77')])){_0x55a704+=','+_0xa3a972[_0x3b6e('0x77')];}var _0x161c73=this[_0x3b6e('0x36')][_0x3b6e('0xa8')](_0x3b6e('0xc4'),_0x55a704);if(_0x161c73[_0x3b6e('0xaa')]===-0x1){return _0x161c73;}var _0x2c2ff6=this[_0x3b6e('0xa0')](_0x3b6e('0xb0'),'LUMENVOX_ASR_CONFIDENCE');if(_0x2c2ff6['result']===-0x1){return _0x2c2ff6;}var _0x2b7b0f=this[_0x3b6e('0xa0')](_0x3b6e('0xb2'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x2b7b0f['result']===-0x1){return _0x2b7b0f;}var _0x2e1430=this[_0x3b6e('0xa0')](_0x3b6e('0xc5'),_0x3b6e('0xc6'));if(_0x2e1430[_0x3b6e('0xaa')]===-0x1){return _0x2e1430;}return this['channel'][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xb5'),_0x55a704));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xc7')]=function(_0x415a06){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0xc8'),_0x415a06[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x415a06['grammar'])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0xaf'));}var _0x23e98d=_0x415a06[_0x3b6e('0xae')];if(this['isConfigured'](_0x415a06[_0x3b6e('0x77')])){_0x23e98d+=','+_0x415a06[_0x3b6e('0x77')];}var _0x4b781f=this['channel'][_0x3b6e('0xa8')]('MRCPRecog',_0x23e98d);if(_0x4b781f[_0x3b6e('0xaa')]===-0x1){return _0x4b781f;}var _0xb3c7db=this[_0x3b6e('0xa0')]('RECOG_CONFIDENCE()',_0x3b6e('0xc9'));if(_0xb3c7db['result']===-0x1){return _0xb3c7db;}var _0x7343e2=this[_0x3b6e('0xa0')]('RECOG_INPUT()',_0x3b6e('0xca'));if(_0x7343e2[_0x3b6e('0xaa')]===-0x1){return _0x7343e2;}var _0x330bda=this[_0x3b6e('0xa0')](_0x3b6e('0xc5'),_0x3b6e('0xcb'));if(_0x330bda['result']===-0x1){return _0x330bda;}return this['channel']['noop'](util[_0x3b6e('0x2a')](_0x3b6e('0xb5'),_0x23e98d));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xcc')]=function(_0x428abc){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0xcd'),_0x428abc['label']));if(!this[_0x3b6e('0xa1')](_0x428abc[_0x3b6e('0xce')])){return this['channel'][_0x3b6e('0x2c')](_0x428abc,_0x3b6e('0xcf'));}var _0x192d09=this[_0x3b6e('0xd0')][_0x3b6e('0x6f')](this,_0x428abc['odbc_id']);if(!_0x192d09){return this[_0x3b6e('0x36')]['error'](_0x428abc,'no\x20odbc\x20database\x20found');}if(!this[_0x3b6e('0xa1')](_0x428abc[_0x3b6e('0x2f')])){return this['channel']['error'](_0x428abc,_0x3b6e('0xd1'));}var _0x25c43d=_0x428abc[_0x3b6e('0x2f')][_0x3b6e('0xd2')](/(\r\n|\n|\r)/gm,'\x20');this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xd3'),_0x25c43d));var _0x3ed112=this[_0x3b6e('0xd4')][_0x3b6e('0x6f')](this,_0x192d09,_0x25c43d);this[_0x3b6e('0x35')][_0x3b6e('0x6f')](this,_0x428abc,_0x25c43d);if(!this[_0x3b6e('0xa1')](_0x428abc[_0x3b6e('0xd5')])){return this[_0x3b6e('0x36')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x690263=this['getVariable'][_0x3b6e('0x6f')](this,_0x428abc['variable_id']);if(!_0x690263){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x428abc,'no\x20variable\x20found');}var _0x57c7d4=this;_0x3ed112[_0x3b6e('0xd6')](function(_0x333752,_0x47f441){Object[_0x3b6e('0xd7')](_0x333752)[_0x3b6e('0xd6')](function(_0x12d29d){_0x57c7d4[_0x3b6e('0x36')][_0x3b6e('0x9b')](util['format']('%s[%s][%s]',_0x690263,_0x47f441,_0x12d29d),_0x333752[_0x12d29d]);});});this[_0x3b6e('0x36')]['setVariable'](util[_0x3b6e('0x2a')]('%s_ROWS_COUNT',_0x690263),_0x3ed112[_0x3b6e('0x97')]);return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xd8'),_0x690263));};AGIVertices['prototype']['dial']=function(_0x537718){logger[_0x3b6e('0xd9')](util[_0x3b6e('0x2a')](_0x3b6e('0xda'),_0x537718[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x537718[_0x3b6e('0xdb')])){return this[_0x3b6e('0x36')]['error'](_0x537718,_0x3b6e('0xdc'));}var _0x74cb81=this[_0x3b6e('0x1b')][_0x3b6e('0x6f')](this,_0x537718[_0x3b6e('0xdb')]);if(!_0x74cb81){return this['channel']['error'](_0x537718,_0x3b6e('0xdd'));}var _0x406abc=this['channel'][_0x3b6e('0xa8')](_0x3b6e('0xde'),[util[_0x3b6e('0x2a')](_0x3b6e('0xdf'),_0x74cb81),_0x537718[_0x3b6e('0x65')],_0x537718[_0x3b6e('0xe0')],_0x537718['url']]);if(_0x406abc[_0x3b6e('0xaa')]===-0x1){return _0x406abc;}return this['channel'][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xe1'),_0x3b6e('0xde')));};AGIVertices[_0x3b6e('0x10')]['dialogflow']=function(_0x287382){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0xe2'),_0x287382[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x287382[_0x3b6e('0x78')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')]('no\x20key\x20configured');}if(!this[_0x3b6e('0xa1')](_0x287382[_0x3b6e('0x5c')])){return this[_0x3b6e('0x36')]['noop']('no\x20text\x20configured');}this[_0x3b6e('0x36')][_0x3b6e('0xe3')]=!![];this[_0x3b6e('0x35')](_0x287382);this[_0x3b6e('0x43')](_0x287382['text'],'in','','');this['channel'][_0x3b6e('0xa6')](util['format'](_0x3b6e('0xe4'),_0x287382[_0x3b6e('0x5c')]));var _0xba0bad=this['googleDialogflow'][_0x3b6e('0x6f')](this,_0x287382);if(_0xba0bad){for(var _0x1c0f54 in _0xba0bad){if(_0xba0bad[_0x3b6e('0x92')](_0x1c0f54)){this[_0x3b6e('0x36')][_0x3b6e('0x9b')](util['format'](_0x3b6e('0xe5'),_0x1c0f54['toUpperCase']()),_0xba0bad[_0x1c0f54]);}}this['createSquareMessage'](_0xba0bad[_0x3b6e('0xe6')],_0x3b6e('0xe7'),_0x3b6e('0xe8'),'');return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')]('Dialogflow\x20Result\x20%s',_0xba0bad['speech']));}return this[_0x3b6e('0x36')]['error'](_0x287382,_0x3b6e('0xe9'));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xea')]=function(_0x22e942){logger[_0x3b6e('0x2e')](util['format'](_0x3b6e('0xeb'),_0x22e942[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x22e942[_0x3b6e('0x7b')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0xec'));}if(!this['isConfigured'](_0x22e942[_0x3b6e('0x7c')])){return this['channel'][_0x3b6e('0xa6')](_0x3b6e('0xed'));}if(!this[_0x3b6e('0xa1')](_0x22e942[_0x3b6e('0x7d')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0xee'));}if(!this[_0x3b6e('0xa1')](_0x22e942[_0x3b6e('0x7e')])){return this['channel'][_0x3b6e('0xa6')](_0x3b6e('0xef'));}if(!this[_0x3b6e('0xa1')](_0x22e942[_0x3b6e('0x5c')])){return this[_0x3b6e('0x36')]['noop'](_0x3b6e('0xa7'));}this['channel'][_0x3b6e('0xe3')]=!![];this[_0x3b6e('0x35')](_0x22e942);this[_0x3b6e('0x43')](_0x22e942[_0x3b6e('0x5c')],'in','','');this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')]('Trying\x20DialogflowV2:\x20%s',_0x22e942[_0x3b6e('0x5c')]));var _0x2ab7df=this[_0x3b6e('0x7a')][_0x3b6e('0x6f')](this,_0x22e942);if(_0x2ab7df){for(var _0x35e0b2 in _0x2ab7df){if(_0x2ab7df[_0x3b6e('0x92')](_0x35e0b2)){if(_0x35e0b2!==_0x3b6e('0xf0')){this[_0x3b6e('0x36')][_0x3b6e('0x9b')](util[_0x3b6e('0x2a')](_0x3b6e('0xe5'),_0x35e0b2[_0x3b6e('0x69')]()),_0x2ab7df[_0x35e0b2]);}}}this[_0x3b6e('0x43')](_0x2ab7df['speech'],_0x3b6e('0xe7'),_0x3b6e('0xea'),_0x2ab7df[_0x3b6e('0xf0')]);return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util['format'](_0x3b6e('0xf1'),_0x2ab7df[_0x3b6e('0xe6')]));}return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x22e942,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xf2')]=function(_0x29f344){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0xf3'),_0x29f344[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x29f344[_0x3b6e('0xf4')])){return this['channel'][_0x3b6e('0xa6')](_0x3b6e('0xf5'));}if(!this[_0x3b6e('0xa1')](_0x29f344['username'])){return this[_0x3b6e('0x36')]['noop'](_0x3b6e('0xf6'));}if(!this['isConfigured'](_0x29f344['password'])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0xf7'));}if(!this[_0x3b6e('0xa1')](_0x29f344['ndassistant_url'])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0xa7'));}this['channel'][_0x3b6e('0xe3')]=!![];this[_0x3b6e('0x35')](_0x29f344);this[_0x3b6e('0x43')](_0x29f344[_0x3b6e('0x5c')],'in','','');this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xf8'),_0x29f344[_0x3b6e('0x5c')]));var _0x36237a=this['sestekNDA'][_0x3b6e('0x6f')](this,_0x29f344);if(_0x36237a){for(var _0x5d897b in _0x36237a){if(_0x36237a[_0x3b6e('0x92')](_0x5d897b)){this[_0x3b6e('0x36')]['setVariable'](util[_0x3b6e('0x2a')](_0x3b6e('0xf9'),_0x5d897b[_0x3b6e('0x69')]()),_0x36237a[_0x5d897b]);}}this[_0x3b6e('0x43')](_0x36237a[_0x3b6e('0xe6')],_0x3b6e('0xe7'),_0x3b6e('0xf2'),'');if(_0x36237a[_0x3b6e('0xfa')]){this[_0x3b6e('0x36')]['noop'](util[_0x3b6e('0x2a')](_0x3b6e('0xfb'),_0x36237a['audiofile']));var _0x1d311e=this[_0x3b6e('0x36')]['streamFile'](_0x36237a[_0x3b6e('0xfa')]);try{fs[_0x3b6e('0xfc')](_0x36237a[_0x3b6e('0xfa')]+'.wav');}catch(_0x3b88c4){logger['error'](_0x3b88c4);}return _0x1d311e;}else{return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xfd'),_0x36237a['speech']));}}return this[_0x3b6e('0x36')]['error'](_0x29f344,_0x3b6e('0xfe'));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xff')]=function(_0x20d338){logger['info'](util[_0x3b6e('0x2a')](_0x3b6e('0x100'),_0x20d338[_0x3b6e('0x38')]));return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0xff'));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x101')]=function(_0x55ea86){logger[_0x3b6e('0x2e')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x55ea86[_0x3b6e('0x38')]));var _0x32b7bd='';if(_0x55ea86[_0x3b6e('0x102')]){if(!this['isConfigured'](_0x55ea86[_0x3b6e('0x102')])){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x55ea86,_0x3b6e('0x103'));}else{var _0x2c99fb=parseInt(_0x55ea86['trunk_id'],0xa);if(isNaN(_0x2c99fb)){_0x32b7bd=_0x55ea86[_0x3b6e('0x102')];}else{_0x32b7bd=this['getTrunk'][_0x3b6e('0x6f')](this,_0x55ea86[_0x3b6e('0x102')]);if(!_0x32b7bd){return this['channel']['error'](_0x55ea86,'no\x20trunk\x20found');}}}}else if(_0x55ea86[_0x3b6e('0x104')]){_0x32b7bd=_0x55ea86[_0x3b6e('0x104')];}else{return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x55ea86,_0x3b6e('0x103'));}var _0x1e4225=this[_0x3b6e('0x36')]['exec'](_0x3b6e('0xde'),[util[_0x3b6e('0x2a')](_0x3b6e('0x105'),_0x32b7bd,_0x55ea86[_0x3b6e('0x4a')]),_0x55ea86['timeout'],_0x55ea86[_0x3b6e('0xe0')],_0x55ea86[_0x3b6e('0x71')]]);if(_0x1e4225[_0x3b6e('0xaa')]===-0x1){return _0x1e4225;}return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0xe1'),'DIAL'));};AGIVertices[_0x3b6e('0x10')]['finally']=function(_0x45f391){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x45f391[_0x3b6e('0x38')]));return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x106'));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xd')]=function(_0x24a12f){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x107'),_0x24a12f[_0x3b6e('0x38')]));if(_0x24a12f[_0x3b6e('0xa3')]===0x0){return this[_0x3b6e('0xa2')](_0x24a12f);}_0x24a12f[_0x3b6e('0xa3')]-=0x1;if(!this[_0x3b6e('0xa1')](_0x24a12f[_0x3b6e('0x108')])){return this['channel'][_0x3b6e('0x2c')](_0x24a12f,'no\x20file\x20audio\x20selected');}var _0x5760a4=this[_0x3b6e('0x1f')][_0x3b6e('0x6f')](this,_0x24a12f[_0x3b6e('0x108')]);if(!_0x5760a4){return this['channel'][_0x3b6e('0x2c')](_0x24a12f,_0x3b6e('0x109'));}if(!this['isConfigured'](_0x24a12f[_0x3b6e('0xd5')])){return this['channel'][_0x3b6e('0x2c')](_0x3b6e('0x10a'));}var _0x1e26b0=this[_0x3b6e('0x36')][_0x3b6e('0x10b')](_0x5760a4,_0x24a12f[_0x3b6e('0x10c')],_0x24a12f[_0x3b6e('0x10d')]);var _0x48c8be=_0x1e26b0[_0x3b6e('0xaa')]?_0x1e26b0[_0x3b6e('0xaa')]['toString']():'';logger[_0x3b6e('0x2e')](_0x3b6e('0x10e'),JSON[_0x3b6e('0x73')](_0x1e26b0));if(_0x1e26b0[_0x3b6e('0xaa')]===-0x1){this[_0x3b6e('0x35')][_0x3b6e('0x6f')](this,_0x24a12f,_0x48c8be);return _0x1e26b0;}else if(_0x1e26b0['extra']===_0x3b6e('0x65')){_0x1e26b0[_0x3b6e('0xaa')]=_0x48c8be[_0x3b6e('0x97')]>=parseInt(_0x24a12f[_0x3b6e('0x10f')])?'x':'i';}else{_0x1e26b0[_0x3b6e('0xaa')]=_0x48c8be[_0x3b6e('0x97')]>=parseInt(_0x24a12f[_0x3b6e('0x10f')])&&_0x48c8be[_0x3b6e('0x97')]<=parseInt(_0x24a12f[_0x3b6e('0x10d')])?'x':'i';}var _0x1521ad=this[_0x3b6e('0x11')][_0x3b6e('0x6f')](this,_0x24a12f['variable_id']);if(!_0x1521ad){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x24a12f,_0x3b6e('0x110'));}this[_0x3b6e('0x36')][_0x3b6e('0x9b')](_0x1521ad,_0x48c8be);if(this[_0x3b6e('0xa1')](_0x24a12f[_0x3b6e('0x111')])){var _0x4daa91=parseInt(_0x24a12f[_0x3b6e('0x111')],0xa);var _0x2bfba9=rs[_0x3b6e('0x112')]({'charset':'*','length':_0x4daa91});var _0x11c293=_0x48c8be[_0x3b6e('0x97')];if(_0x11c293>0x0){if(_0x11c293>_0x4daa91){this['createSquareDetailsReport'][_0x3b6e('0x6f')](this,_0x24a12f,_0x24a12f[_0x3b6e('0x113')]===_0x3b6e('0x114')?_0x2bfba9+_0x48c8be[_0x3b6e('0x115')](_0x4daa91):_0x48c8be[_0x3b6e('0x115')](0x0,_0x11c293-_0x4daa91)+_0x2bfba9);}else{this[_0x3b6e('0x35')]['sync'](this,_0x24a12f,rs['generate']({'charset':'*','length':_0x11c293}));}}else{this['createSquareDetailsReport'][_0x3b6e('0x6f')](this,_0x24a12f,'');}}else{this[_0x3b6e('0x35')]['sync'](this,_0x24a12f,_0x48c8be);}return _0x1e26b0;};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xe')]=function(_0x5e876b){logger['info'](util[_0x3b6e('0x2a')](_0x3b6e('0x116'),_0x5e876b['label']));return this[_0x3b6e('0xd')](_0x5e876b);};AGIVertices['prototype'][_0x3b6e('0x117')]=function(_0x361384){logger['info'](util[_0x3b6e('0x2a')](_0x3b6e('0x118'),_0x361384[_0x3b6e('0x38')]));this[_0x3b6e('0x35')]['sync'](this,_0x361384,_0x361384[_0x3b6e('0x119')]);return this['channel'][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x11a'),_0x361384[_0x3b6e('0x119')]));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x11b')]=function(_0x4ecd86){logger[_0x3b6e('0x2e')](util['format'](_0x3b6e('0x11c'),_0x4ecd86[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x4ecd86['aws_access_key_id'])||!this[_0x3b6e('0xa1')](_0x4ecd86[_0x3b6e('0x86')])){return this[_0x3b6e('0x36')]['noop'](_0x3b6e('0x11d'));}if(!this[_0x3b6e('0xa1')](_0x4ecd86[_0x3b6e('0x5c')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0xa7'));}this['channel']['noop'](util[_0x3b6e('0x2a')](_0x3b6e('0x11e'),_0x4ecd86['text']));var _0x4a0ac9=this['awsPolly']['sync'](this,_0x4ecd86);if(_0x4a0ac9){this['channel'][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x11f'),_0x4a0ac9));var _0x185a19=this[_0x3b6e('0x36')][_0x3b6e('0x120')](_0x4a0ac9);try{fs[_0x3b6e('0xfc')](_0x4a0ac9+_0x3b6e('0x121'));}catch(_0x35d915){logger[_0x3b6e('0x2c')](_0x35d915);}return _0x185a19;}return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x4ecd86,_0x3b6e('0x122'));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x123')]=function(_0x583f91){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x583f91[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x583f91[_0x3b6e('0x85')])||!this[_0x3b6e('0xa1')](_0x583f91[_0x3b6e('0x86')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x11d'));}if(!this['isConfigured'](_0x583f91[_0x3b6e('0x8b')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x124'));}if(!this[_0x3b6e('0xa1')](_0x583f91['text'])){return this['channel']['noop'](_0x3b6e('0xa7'));}this[_0x3b6e('0x36')][_0x3b6e('0xe3')]=!![];this['createSquareDetailsReport'](_0x583f91);this[_0x3b6e('0x43')](_0x583f91[_0x3b6e('0x5c')],'in','','');this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')]('Trying\x20Amazon\x20Lex:\x20%s',_0x583f91[_0x3b6e('0x5c')]));var _0x3571af=this[_0x3b6e('0x89')][_0x3b6e('0x6f')](this,_0x583f91);if(_0x3571af){for(var _0x2b925a in _0x3571af){if(_0x3571af[_0x3b6e('0x92')](_0x2b925a)&&_[_0x3b6e('0x98')](_0x3571af[_0x2b925a])){this['channel'][_0x3b6e('0x9b')](util[_0x3b6e('0x2a')](_0x3b6e('0x125'),_0x2b925a[_0x3b6e('0x69')]()),_0x3571af[_0x2b925a]);}}if(_[_0x3b6e('0x45')](_0x3571af[_0x3b6e('0x75')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x126'));}else{this[_0x3b6e('0x43')](_0x3571af['message'],'out',_0x3b6e('0x127'),'');return this['channel'][_0x3b6e('0xa6')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x3571af[_0x3b6e('0x75')]));}}return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x583f91,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x128')]=function(_0x3a40a1){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x3a40a1['label'],_0x3a40a1['timeout']));if(!this[_0x3b6e('0xa1')](_0x3a40a1[_0x3b6e('0x78')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x129'));}var _0x302c66=_0x3b6e('0x12a');var _0x2c629f=util[_0x3b6e('0x2a')](_0x3b6e('0x12b'),FILES_PATH,rs[_0x3b6e('0x112')](0x4));var _0x3a7489=util[_0x3b6e('0x2a')]('%s.%s',_0x2c629f,_0x302c66);var _0x27afed=!![];if(_0x3a40a1['beep']===_0x3b6e('0x12c')){_0x27afed=![];}var _0x3d2bcd=this['channel'][_0x3b6e('0x12d')](_0x2c629f,_0x302c66,_0x3a40a1[_0x3b6e('0x12e')],_0x3a40a1[_0x3b6e('0x65')],undefined,_0x27afed);if(_0x3d2bcd[_0x3b6e('0xaa')]!==-0x1){this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x12f'),_0x3a7489));var _0x2001a6=this['googleASR']['sync'](this,_0x3a40a1,_0x3a7489);if(_0x2001a6){for(var _0x2a2cb9 in _0x2001a6){if(_0x2001a6[_0x3b6e('0x92')](_0x2a2cb9)){this[_0x3b6e('0x36')]['setVariable'](util[_0x3b6e('0x2a')](_0x3b6e('0x130'),_0x2a2cb9[_0x3b6e('0x69')]()),_0x2001a6[_0x2a2cb9]);}}return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x131'),JSON[_0x3b6e('0x73')](_0x2001a6)));}}return _0x3d2bcd;};AGIVertices['prototype'][_0x3b6e('0x132')]=function(_0x2c314e){logger[_0x3b6e('0x2e')](util['format'](_0x3b6e('0x133'),_0x2c314e[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x2c314e['appid'])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x134'));}if(!this['isConfigured'](_0x2c314e[_0x3b6e('0x8f')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')]('no\x20appsecret\x20configured');}var _0x1f0717='wav';var _0xd4c767=util['format'](_0x3b6e('0x12b'),FILES_PATH,rs[_0x3b6e('0x112')](0x4));var _0x1f50c8=util[_0x3b6e('0x2a')](_0x3b6e('0x9a'),_0xd4c767,_0x1f0717);var _0x24a059=!![];if(_0x2c314e[_0x3b6e('0x135')]===_0x3b6e('0x12c')){_0x24a059=![];}var _0x3063c6=this[_0x3b6e('0x36')]['recordFile'](_0xd4c767,_0x1f0717,_0x2c314e[_0x3b6e('0x12e')],_0x2c314e[_0x3b6e('0x65')],undefined,_0x24a059);if(_0x3063c6[_0x3b6e('0xaa')]!==-0x1){this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x136'),_0x1f50c8));var _0x12ea8f=this[_0x3b6e('0x137')]['sync'](this,_0x2c314e,_0x1f50c8);if(_0x12ea8f){for(var _0x11339e in _0x12ea8f){if(_0x12ea8f[_0x3b6e('0x92')](_0x11339e)){this[_0x3b6e('0x36')][_0x3b6e('0x9b')](util[_0x3b6e('0x2a')](_0x3b6e('0x138'),_0x11339e['toUpperCase']()),_0x12ea8f[_0x11339e]);}}return this['channel']['noop'](util[_0x3b6e('0x2a')](_0x3b6e('0x139'),JSON[_0x3b6e('0x73')](_0x12ea8f)));}}return _0x3063c6;};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x13a')]=function(_0x68173f){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x13b'),_0x68173f[_0x3b6e('0x38')]));return this[_0x3b6e('0x36')][_0x3b6e('0x13c')](_0x68173f[_0x3b6e('0x3e')],_0x68173f[_0x3b6e('0x3f')],_0x68173f[_0x3b6e('0x13d')]);};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x13e')]=function(_0x4cfa63){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x4cfa63[_0x3b6e('0x38')]));if(!this['isConfigured'](_0x4cfa63[_0x3b6e('0x13f')])){return this['channel']['error'](_0x4cfa63,'no\x20condition\x20configured');}try{var _0xe87050=eval(_0x4cfa63[_0x3b6e('0x13f')])?_0x3b6e('0x140'):_0x3b6e('0x141');this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x142'),_0x4cfa63[_0x3b6e('0x13f')],_0xe87050));return{'code':0xc8,'result':_0xe87050};}catch(_0x295b1b){return{'code':0xc8,'result':_0x3b6e('0x141')};}};AGIVertices['prototype'][_0x3b6e('0x143')]=function(_0x27af00){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x144'),_0x27af00['label']));if(!this[_0x3b6e('0xa1')](_0x27af00[_0x3b6e('0x145')])){return this['channel'][_0x3b6e('0x2c')](_0x27af00,'no\x20interval\x20configured');}var _0x588296=this[_0x3b6e('0x146')][_0x3b6e('0x6f')](this,_0x27af00[_0x3b6e('0x145')]);if(!_0x588296){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x27af00,_0x3b6e('0x147'));}for(var _0x406b54=0x0;_0x406b54<_0x588296['length'];_0x406b54+=0x1){var _0x13da1f=this[_0x3b6e('0x36')]['getVariable'](util[_0x3b6e('0x2a')](_0x3b6e('0x148'),_0x588296[_0x406b54]));if(_0x13da1f[_0x3b6e('0xaa')]===-0x1){return _0x13da1f;}logger['info'](util[_0x3b6e('0x2a')](_0x3b6e('0x149'),_0x588296[_0x406b54],_0x13da1f[_0x3b6e('0x9f')]));if(_0x13da1f[_0x3b6e('0x9f')]==='true'){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x149'),_0x588296[_0x406b54],_0x3b6e('0x140')));this[_0x3b6e('0x36')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x588296[_0x406b54],_0x3b6e('0x140')));return{'code':0xc8,'result':_0x3b6e('0x140')};}else{logger['info'](util[_0x3b6e('0x2a')]('IFTIME\x20%s\x20%s',_0x588296[_0x406b54],_0x3b6e('0x141')));this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util['format'](_0x3b6e('0x149'),_0x588296[_0x406b54],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x3b6e('0x10')]['hangup']=function(_0x510eb4){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x14a'),_0x510eb4[_0x3b6e('0x38')]));return this['channel'][_0x3b6e('0x14b')]();};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x14c')]=function(_0x3b96be){logger['info'](util[_0x3b6e('0x2a')](_0x3b6e('0x14d'),_0x3b96be[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x3b96be[_0x3b6e('0x78')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x129'));}var _0x4b3e23=_0x3b6e('0x12a');var _0x748137=util['format'](_0x3b6e('0x12b'),FILES_PATH,rs[_0x3b6e('0x112')](0x4));var _0x346f92=util[_0x3b6e('0x2a')](_0x3b6e('0x9a'),_0x748137,_0x4b3e23);var _0x3c6c94=!![];if(_0x3b96be[_0x3b6e('0x135')]===_0x3b6e('0x12c')){_0x3c6c94=![];}var _0x118bab=this[_0x3b6e('0x36')][_0x3b6e('0x12d')](_0x748137,_0x4b3e23,_0x3b96be[_0x3b6e('0x12e')],_0x3b96be['timeout'],undefined,_0x3c6c94);if(_0x118bab[_0x3b6e('0xaa')]!==-0x1){this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x14e'),_0x346f92));var _0x16b400=this[_0x3b6e('0x82')][_0x3b6e('0x6f')](this,_0x3b96be,_0x346f92);if(_0x16b400){for(var _0x32a811 in _0x16b400){if(_0x16b400['hasOwnProperty'](_0x32a811)){this[_0x3b6e('0x36')]['setVariable'](util[_0x3b6e('0x2a')](_0x3b6e('0x14f'),_0x32a811['toUpperCase']()),_0x16b400[_0x32a811]);}}return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x150'),JSON['stringify'](_0x16b400)));}}return _0x118bab;};AGIVertices[_0x3b6e('0x10')]['ispeechtts']=function(_0x357a){logger[_0x3b6e('0x2e')](util['format'](_0x3b6e('0x151'),_0x357a[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x357a[_0x3b6e('0x78')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x129'));}if(!this[_0x3b6e('0xa1')](_0x357a[_0x3b6e('0x5c')])){return this['channel'][_0x3b6e('0xa6')](_0x3b6e('0xa7'));}this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x152'),_0x357a[_0x3b6e('0x5c')]));var _0x52594d=this[_0x3b6e('0x80')][_0x3b6e('0x6f')](this,_0x357a);if(_0x52594d){this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util['format']('ispeech\x20%s\x20file\x20created',_0x52594d));var _0x42fdbb=this[_0x3b6e('0x36')][_0x3b6e('0x120')](_0x52594d,_0x357a[_0x3b6e('0x12e')]);try{fs['unlink'](_0x52594d+_0x3b6e('0x121'));}catch(_0x53c59c){logger[_0x3b6e('0x2c')](_0x53c59c);}return _0x42fdbb;}return this['channel'][_0x3b6e('0x2c')](_0x357a,_0x3b6e('0x153'));};AGIVertices['prototype']['login']=function(_0x4dd79c){logger[_0x3b6e('0x2e')](util['format'](_0x3b6e('0x154'),_0x4dd79c['label']));if(!this[_0x3b6e('0xa1')](_0x4dd79c[_0x3b6e('0x155')])){return this['channel'][_0x3b6e('0x2c')](_0x4dd79c,_0x3b6e('0x156'));}logger['info'](util[_0x3b6e('0x2a')](_0x3b6e('0x157'),this['channel'][_0x3b6e('0x3c')],_0x4dd79c[_0x3b6e('0x155')]));var _0x5d22a8=this[_0x3b6e('0x55')][_0x3b6e('0x6f')](this,_0x4dd79c['findBy']);if(_0x5d22a8){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x3b6e('0x3c')],_0x4dd79c[_0x3b6e('0x155')]));this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x158'),this['channel']['callerid'],_0x4dd79c[_0x3b6e('0x155')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x3b6e('0x159'),this['channel'][_0x3b6e('0x3c')],_0x4dd79c['findBy']));this['channel']['noop'](util[_0x3b6e('0x2a')](_0x3b6e('0x159'),this[_0x3b6e('0x36')][_0x3b6e('0x3c')],_0x4dd79c[_0x3b6e('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x15a')]=function(_0x43777e){logger['info'](util['format'](_0x3b6e('0x15b'),_0x43777e['label']));if(!this[_0x3b6e('0xa1')](_0x43777e['findBy'])){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x43777e,_0x3b6e('0x156'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x3b6e('0x36')][_0x3b6e('0x3c')],_0x43777e[_0x3b6e('0x155')]));var _0x57bfc4=this['agentLogout']['sync'](this,_0x43777e[_0x3b6e('0x155')]);if(_0x57bfc4){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x158'),this['channel'][_0x3b6e('0x3c')],_0x43777e[_0x3b6e('0x155')]));this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util['format'](_0x3b6e('0x158'),this[_0x3b6e('0x36')]['callerid'],_0x43777e['findBy']));return{'code':0xc8,'result':_0x3b6e('0x15c')};}else{logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x159'),this['channel'][_0x3b6e('0x3c')],_0x43777e[_0x3b6e('0x155')]));this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3b6e('0x36')]['callerid'],_0x43777e[_0x3b6e('0x155')]));return{'code':0xc8,'result':_0x3b6e('0x15d')};}};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x15e')]=function(_0x1d78ff){logger[_0x3b6e('0x2e')](util['format'](_0x3b6e('0x15f'),_0x1d78ff['label']));if(!this[_0x3b6e('0xa1')](_0x1d78ff[_0x3b6e('0x160')])){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x1d78ff,_0x3b6e('0x161'));}this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x162'),_0x1d78ff[_0x3b6e('0x160')]));var _0x4d05ef=eval(_0x1d78ff[_0x3b6e('0x160')]);if(!this[_0x3b6e('0xa1')](_0x1d78ff[_0x3b6e('0xd5')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x513e82=this[_0x3b6e('0x11')][_0x3b6e('0x6f')](this,_0x1d78ff[_0x3b6e('0xd5')]);if(!_0x513e82){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x1d78ff,'no\x20variable\x20found');}if(_[_0x3b6e('0x96')](_0x4d05ef)){var _0xfd25a8=this;_0x4d05ef['forEach'](function(_0x33e846,_0x1dd209){_0xfd25a8['channel'][_0x3b6e('0x9b')](util[_0x3b6e('0x2a')](_0x3b6e('0x163'),_0x513e82,_0x1dd209),_0x33e846);});return this['channel'][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x164'),_0x513e82));}else{return this['channel'][_0x3b6e('0x9b')](_0x513e82,_0x4d05ef);}};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xc')]=function(_0x140250){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x140250['label']));if(_0x140250['retry']===0x0){return this['maxRetry'](_0x140250);}_0x140250[_0x3b6e('0xa3')]-=0x1;if(!this[_0x3b6e('0xa1')](_0x140250[_0x3b6e('0x108')])){return this['channel'][_0x3b6e('0x2c')](_0x140250,_0x3b6e('0x165'));}var _0x4a7887=this[_0x3b6e('0x1f')][_0x3b6e('0x6f')](this,_0x140250[_0x3b6e('0x108')]);if(!_0x4a7887){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x140250,_0x3b6e('0x109'));}var _0x47a9ef=this['channel']['getData'](_0x4a7887,_0x140250[_0x3b6e('0x10c')],_0x140250['digit']);var _0x1bdeae=_0x47a9ef[_0x3b6e('0xaa')];if(_0x47a9ef[_0x3b6e('0xaa')]===-0x1){this['createSquareDetailsReport'][_0x3b6e('0x6f')](this,_0x140250,'-1');return _0x47a9ef;}else if(_0x47a9ef[_0x3b6e('0x9f')]===_0x3b6e('0x65')){_0x47a9ef['result']=_0x47a9ef[_0x3b6e('0xaa')][_0x3b6e('0x97')]>0x0?_0x47a9ef[_0x3b6e('0xaa')]:'t';}else if(_[_0x3b6e('0x48')](_0x47a9ef[_0x3b6e('0xaa')])){_0x47a9ef['result']='#';_0x1bdeae='#';}if(!this[_0x3b6e('0xa1')](_0x140250['variable_id'])){this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x10a'));}else{var _0x3b9d22=this[_0x3b6e('0x11')]['sync'](this,_0x140250[_0x3b6e('0xd5')]);if(!_0x3b9d22){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x140250,_0x3b6e('0x110'));}this['channel'][_0x3b6e('0x9b')](_0x3b9d22,_0x1bdeae);}this[_0x3b6e('0x35')][_0x3b6e('0x6f')](this,_0x140250,_0x1bdeae);return _0x47a9ef;};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0xa6')]=function(_0x235653){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x166'),_0x235653['label']));return this[_0x3b6e('0x36')]['noop'](_0x235653[_0x3b6e('0x167')]||_0x235653['label']);};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x168')]=function(_0x443db2){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x443db2[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x443db2[_0x3b6e('0x155')])){return this['channel'][_0x3b6e('0x2c')](_0x443db2,_0x3b6e('0x156'));}logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x157'),this[_0x3b6e('0x36')][_0x3b6e('0x3c')],_0x443db2['findBy']));var _0x106f2d=this['getPause']['sync'](this,_0x443db2[_0x3b6e('0x169')]);var _0x3c8399=this['agentPause'][_0x3b6e('0x6f')](this,_0x443db2[_0x3b6e('0x155')],_0x106f2d);if(_0x3c8399){logger['info'](util[_0x3b6e('0x2a')](_0x3b6e('0x158'),this[_0x3b6e('0x36')][_0x3b6e('0x3c')],_0x443db2[_0x3b6e('0x155')]));this[_0x3b6e('0x36')]['noop'](util[_0x3b6e('0x2a')](_0x3b6e('0x158'),this[_0x3b6e('0x36')][_0x3b6e('0x3c')],_0x443db2[_0x3b6e('0x155')]));return{'code':0xc8,'result':'success'};}else{logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x159'),this['channel']['callerid'],_0x443db2['findBy']));this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util['format'](_0x3b6e('0x158'),this[_0x3b6e('0x36')][_0x3b6e('0x3c')],_0x443db2[_0x3b6e('0x155')]));return{'code':0xc8,'result':_0x3b6e('0x15d')};}};AGIVertices['prototype'][_0x3b6e('0x16a')]=function(_0x5c4d8a){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x16b'),_0x5c4d8a[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x5c4d8a[_0x3b6e('0x108')])){return this['channel'][_0x3b6e('0x2c')](_0x5c4d8a,_0x3b6e('0x165'));}var _0x4c764c=this[_0x3b6e('0x1f')][_0x3b6e('0x6f')](this,_0x5c4d8a['file_id']);if(!_0x4c764c){return this['channel'][_0x3b6e('0x2c')](_0x5c4d8a,_0x3b6e('0x109'));}var _0x41e71b=this[_0x3b6e('0x36')][_0x3b6e('0xa8')](_0x3b6e('0x16c'),[_0x4c764c,_0x5c4d8a[_0x3b6e('0xe0')]]);if(_0x41e71b['result']===-0x1){return _0x41e71b;}return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util['format']('Executed\x20command\x20%s\x20%s',_0x3b6e('0x16c'),_0x4c764c));};AGIVertices['prototype'][_0x3b6e('0x16d')]=function(_0x1464ad){logger['info'](util[_0x3b6e('0x2a')](_0x3b6e('0x16e'),_0x1464ad[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x1464ad[_0x3b6e('0x16f')])){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x1464ad,_0x3b6e('0x170'));}var _0x5a361b='';var _0x340f21=parseInt(_0x1464ad[_0x3b6e('0x16f')],0xa);if(isNaN(_0x340f21)){_0x5a361b=_0x1464ad['queue_id'];}else{_0x5a361b=this[_0x3b6e('0x16')][_0x3b6e('0x6f')](this,_0x1464ad[_0x3b6e('0x16f')]);if(!_0x5a361b){return this['channel'][_0x3b6e('0x2c')](_0x1464ad,_0x3b6e('0x171'));}}var _0xe3814b='';if(this[_0x3b6e('0xa1')](_0x1464ad[_0x3b6e('0x108')])){var _0x4d3720=this['getSound'][_0x3b6e('0x6f')](this,_0x1464ad[_0x3b6e('0x108')]);if(_0x4d3720){_0xe3814b=_0x4d3720;}}this[_0x3b6e('0x35')]['sync'](this,_0x1464ad,_0x5a361b);if(_0x1464ad[_0x3b6e('0xe0')]['indexOf']('x')<0x0){_0x1464ad[_0x3b6e('0xe0')]+='x';}if(_0x1464ad[_0x3b6e('0xe0')][_0x3b6e('0x172')]('X')<0x0){_0x1464ad[_0x3b6e('0xe0')]+='X';}this['channel'][_0x3b6e('0x9b')](_0x3b6e('0x173'),_0x5a361b?_0x5a361b[_0x3b6e('0x174')]():'');var _0x51a1bd=this[_0x3b6e('0x36')][_0x3b6e('0xa8')]('QUEUE',[_0x5a361b,_0x1464ad[_0x3b6e('0xe0')],_0x1464ad[_0x3b6e('0x71')],_0xe3814b,_0x1464ad[_0x3b6e('0x65')],_0x1464ad[_0x3b6e('0x8')],_0x1464ad['macro'],_0x1464ad[_0x3b6e('0x175')],'',_0x1464ad[_0x3b6e('0x176')]]);if(_0x51a1bd[_0x3b6e('0xaa')]===-0x1){return _0x51a1bd;}return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util['format']('Executed\x20command\x20%s\x20%s','QUEUE',_0x5a361b));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x177')]=function(_0x2739f1){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x178'),_0x2739f1[_0x3b6e('0x38')]));var _0x3c5ff4=_0x2739f1[_0x3b6e('0x179')]||_0x3b6e('0x12a');var _0x51cca5=util[_0x3b6e('0x2a')]('%s_%s',this[_0x3b6e('0x36')][_0x3b6e('0x37')],rs[_0x3b6e('0x112')](0x5));var _0x564a10=util[_0x3b6e('0x2a')]('%s/recordings/%s.%s',FILES_PATH,_0x51cca5,_0x3c5ff4);var _0x5d3159=util['format'](_0x3b6e('0x12b'),FILES_PATH,_0x51cca5);this[_0x3b6e('0x3b')][_0x3b6e('0x6f')](this,_0x2739f1,_0x51cca5,_0x564a10);this[_0x3b6e('0x36')][_0x3b6e('0x9b')](_0x3b6e('0x17a'),_0x51cca5);logger[_0x3b6e('0x2e')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x5d3159,_0x3c5ff4,_0x2739f1[_0x3b6e('0x17b')],_0x2739f1[_0x3b6e('0x65')]);return this[_0x3b6e('0x36')][_0x3b6e('0x12d')](_0x5d3159,_0x3c5ff4,_0x2739f1[_0x3b6e('0x17b')],_0x2739f1['timeout'],undefined,!![]);};AGIVertices['prototype'][_0x3b6e('0x17c')]=function(_0x4384df){logger['info'](util[_0x3b6e('0x2a')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x4384df['label']));if(!this[_0x3b6e('0xa1')](_0x4384df[_0x3b6e('0x71')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x17d'));}var _0x2c3439=this['restAPI'][_0x3b6e('0x6f')](this,_0x4384df);logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Response:',util['inspect'](_0x2c3439,{'showHidden':![],'depth':null})));if(!this[_0x3b6e('0xa1')](_0x4384df[_0x3b6e('0xd5')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x17e'));}var _0x9b41a3=this[_0x3b6e('0x11')][_0x3b6e('0x6f')](this,_0x4384df['variable_id']);if(!_0x9b41a3){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x4384df,_0x3b6e('0x110'));}this['channel'][_0x3b6e('0x9b')](util['format'](_0x3b6e('0x17f'),_0x9b41a3),_0x2c3439['statusCode']?_0x2c3439[_0x3b6e('0x74')]:_0x3b6e('0x180'));this[_0x3b6e('0x36')][_0x3b6e('0x9b')](util['format'](_0x3b6e('0x181'),_0x9b41a3),_0x2c3439[_0x3b6e('0x182')]?_0x2c3439[_0x3b6e('0x182')]:'OK');if(_0x2c3439[_0x3b6e('0x6a')]){try{this['saveRestApiResult'](_0x2c3439[_0x3b6e('0x6a')],_0x9b41a3);}catch(_0x158d66){logger['error'](util[_0x3b6e('0x2a')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x9b41a3));}}return this[_0x3b6e('0x36')]['noop'](util[_0x3b6e('0x2a')]('variable\x20%s\x20set',_0x9b41a3));};AGIVertices['prototype'][_0x3b6e('0x183')]=function(_0x416de1){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x184'),_0x416de1[_0x3b6e('0x38')]));return this[_0x3b6e('0x36')]['sayDigits'](_0x416de1[_0x3b6e('0x185')][_0x3b6e('0xd2')](/\s+/g,''),_0x416de1[_0x3b6e('0x17b')]);};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x186')]=function(_0x279de5){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x279de5['label']));return this[_0x3b6e('0x36')][_0x3b6e('0x187')](_0x279de5[_0x3b6e('0x66')][_0x3b6e('0xd2')](/\s+/g,''),_0x279de5[_0x3b6e('0x17b')]);};AGIVertices['prototype'][_0x3b6e('0x188')]=function(_0x3e3295){logger['info'](util['format'](_0x3b6e('0x189'),_0x3e3295['label']));return this[_0x3b6e('0x36')][_0x3b6e('0x18a')](_0x3e3295[_0x3b6e('0x5c')],_0x3e3295[_0x3b6e('0x17b')]);};AGIVertices[_0x3b6e('0x10')]['sendMail']=function(_0x233277){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x18b'),_0x233277[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x233277[_0x3b6e('0x18c')])){return this[_0x3b6e('0x36')]['noop'](_0x3b6e('0x18d'));}var _0x9e424d=this[_0x3b6e('0x22')][_0x3b6e('0x6f')](this,_0x233277['account_id']);if(!_0x9e424d||!_0x9e424d['Smtp']){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x233277,_0x3b6e('0x18e'));}var _0x23d14c={'from':util[_0x3b6e('0x2a')]('\x22%s\x22\x20<%s>',_0x9e424d['name'],_0x9e424d[_0x3b6e('0x18f')]||_0x9e424d['Smtp'][_0x3b6e('0x190')]),'to':_0x233277['to']||'','cc':_0x233277['cc']||'','bcc':_0x233277[_0x3b6e('0x191')]||'','subject':_0x233277[_0x3b6e('0x192')],'html':_0x233277[_0x3b6e('0x5c')],'text':_0x233277[_0x3b6e('0x5c')]};var _0x182c87={'tls':{'rejectUnauthorized':![]}};if(_0x9e424d[_0x3b6e('0x193')][_0x3b6e('0x194')]){_0x182c87[_0x3b6e('0x194')]=_0x9e424d[_0x3b6e('0x193')][_0x3b6e('0x194')];}else{_0x182c87[_0x3b6e('0x195')]=_0x9e424d[_0x3b6e('0x193')][_0x3b6e('0x195')];_0x182c87['port']=_0x9e424d[_0x3b6e('0x193')][_0x3b6e('0x196')];_0x182c87[_0x3b6e('0x197')]=_0x9e424d[_0x3b6e('0x193')][_0x3b6e('0x197')];}if(_0x9e424d[_0x3b6e('0x193')][_0x3b6e('0x198')]){_0x182c87['auth']={'user':_0x9e424d[_0x3b6e('0x193')][_0x3b6e('0x190')],'pass':_0x9e424d['Smtp'][_0x3b6e('0x199')]};}if(this[_0x3b6e('0xa1')](_0x233277[_0x3b6e('0x19a')])){}logger[_0x3b6e('0xd9')](_0x3b6e('0x19b'),JSON[_0x3b6e('0x73')](_0x23d14c));this[_0x3b6e('0x35')]['sync'](this,_0x233277,_0x233277[_0x3b6e('0x18c')]);this[_0x3b6e('0x36')]['noop'](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x9e424d[_0x3b6e('0x14')]));this[_0x3b6e('0x24')]['sync'](this,_0x182c87,_0x23d14c);return this[_0x3b6e('0x36')]['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x19c')]=function(_0x5a664b){logger[_0x3b6e('0x2e')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x5a664b[_0x3b6e('0x38')]));return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x19d'));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x19e')]=function(_0x42b376){logger[_0x3b6e('0x2e')](util['format'](_0x3b6e('0x19f'),_0x42b376[_0x3b6e('0x38')]));if(!this['isConfigured'](_0x42b376[_0x3b6e('0x1a0')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')]('no\x20sms\x20account\x20configured');}var _0x4803b0=this[_0x3b6e('0x33')][_0x3b6e('0x6f')](this,_0x42b376['sms_account_id']);if(!_0x4803b0){return this['channel'][_0x3b6e('0x2c')](_0x42b376,_0x3b6e('0x1a1'));}var _0x2dcf69={'body':_0x42b376[_0x3b6e('0x1a2')],'phone':_0x42b376['to']||'','SmsAccountId':_0x4803b0['id']};logger['debug'](_0x3b6e('0x1a3'),JSON[_0x3b6e('0x73')](_0x2dcf69));this[_0x3b6e('0x35')][_0x3b6e('0x6f')](this,_0x42b376,_0x42b376[_0x3b6e('0x1a0')]);this['channel'][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x4803b0[_0x3b6e('0x14')]));this[_0x3b6e('0x34')][_0x3b6e('0x6f')](this,_0x2dcf69);return this['channel']['noop'](_0x3b6e('0x1a4'));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1a5')]=function(_0x5dc1f8){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x1a6'),_0x5dc1f8['label']));if(!this['isConfigured'](_0x5dc1f8['variable_id'])){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x5dc1f8,_0x3b6e('0x1a7'));}var _0x1ce4e1=this[_0x3b6e('0x11')][_0x3b6e('0x6f')](this,_0x5dc1f8[_0x3b6e('0xd5')]);if(!_0x1ce4e1){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x5dc1f8,'no\x20variable\x20found');}return this[_0x3b6e('0x36')]['setVariable'](_0x1ce4e1,_0x5dc1f8['variable_value']);};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1a8')]=function(_0xbb72e4){logger[_0x3b6e('0x2e')](util['format'](_0x3b6e('0x1a9'),_0xbb72e4[_0x3b6e('0x38')]));this['channel'][_0x3b6e('0xa6')](_0x3b6e('0x1aa'));if(_0xbb72e4[_0x3b6e('0xb8')]===_0x3b6e('0x1ab')){this['channel']['noop'](_0x3b6e('0x1ac'));return this['channel'][_0x3b6e('0xb8')]();}return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x1ad'));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1ae')]=function(_0x384a88){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x384a88[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x384a88[_0x3b6e('0x1af')])){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x384a88,'no\x20subproject\x20selected');}var _0x575ebe=this[_0x3b6e('0x17')]['sync'](this,_0x384a88[_0x3b6e('0x1af')]);if(!this['isConfigured'](_0x575ebe)){return this['channel'][_0x3b6e('0x2c')](_0x384a88,util[_0x3b6e('0x2a')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x384a88[_0x3b6e('0x1af')]));}if(_0x575ebe===this['channel'][_0x3b6e('0x3a')]){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x384a88,_0x3b6e('0x1b0'));}this[_0x3b6e('0x35')][_0x3b6e('0x6f')](this,_0x384a88,_0x575ebe);var _0x29fa51=this[_0x3b6e('0x36')][_0x3b6e('0xa8')](_0x3b6e('0x1b1'),util[_0x3b6e('0x2a')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x3b6e('0x8')][_0x3b6e('0x195')]||_0x3b6e('0x1b2'),_0x575ebe,this[_0x3b6e('0x36')][_0x3b6e('0x3a')]));if(_0x29fa51['result']===-0x1){return _0x29fa51;}return this['channel']['noop'](util[_0x3b6e('0x2a')]('Executed\x20command\x20%s\x20%s',_0x3b6e('0x1b1'),_0x575ebe));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1b3')]=function(_0x345dbf){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x1b4'),_0x345dbf[_0x3b6e('0x38')]));var _0xa89bbe=this[_0x3b6e('0x1b5')][_0x3b6e('0x6f')](this,_0x345dbf['command']);this[_0x3b6e('0x35')][_0x3b6e('0x6f')](this,_0x345dbf,_0x345dbf[_0x3b6e('0xb6')]);if(this[_0x3b6e('0xa1')](_0x345dbf[_0x3b6e('0xd5')])){var _0x22f571=this[_0x3b6e('0x11')]['sync'](this,_0x345dbf[_0x3b6e('0xd5')]);if(_0x22f571){this[_0x3b6e('0x36')][_0x3b6e('0x9b')](_0x22f571,_0xa89bbe);return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x345dbf[_0x3b6e('0xb6')],_0x22f571));}}return this[_0x3b6e('0x36')]['noop'](util[_0x3b6e('0x2a')](_0x3b6e('0x1b6'),_0x345dbf[_0x3b6e('0xb6')]));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1b7')]=function(_0x452a79){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x1b8'),_0x452a79[_0x3b6e('0x38')]));_0x452a79[_0x3b6e('0x5c')]=_0x452a79['text'][_0x3b6e('0xd2')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x452a79[_0x3b6e('0x5a')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0x1b9'));}if(!this['isConfigured'](_0x452a79[_0x3b6e('0x5c')])){return this['channel'][_0x3b6e('0xa6')](_0x3b6e('0xa7'));}this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x1ba'),_0x452a79[_0x3b6e('0x5c')]));var _0x1e303b=this[_0x3b6e('0x59')][_0x3b6e('0x6f')](this,_0x452a79);if(_0x1e303b){this[_0x3b6e('0x36')][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x1e303b));var _0x5e8a9f=this[_0x3b6e('0x36')][_0x3b6e('0x120')](_0x1e303b);try{fs[_0x3b6e('0xfc')](_0x1e303b+'.wav');}catch(_0x4122e5){logger[_0x3b6e('0x2c')](_0x4122e5);}return _0x5e8a9f;}return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x452a79,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1bb')]=function(_0x2d338c){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x1bc'),_0x2d338c[_0x3b6e('0x38')]));_0x2d338c[_0x3b6e('0x5c')]=_0x2d338c[_0x3b6e('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x2d338c[_0x3b6e('0x5c')])){return this[_0x3b6e('0x36')][_0x3b6e('0xa6')](_0x3b6e('0xa7'));}this[_0x3b6e('0x36')]['noop'](util['format']('Trying\x20Google\x20TTS\x20%s',_0x2d338c[_0x3b6e('0x5c')]));var _0x35afa5=this['googleTTS'][_0x3b6e('0x6f')](this,_0x2d338c);if(_0x35afa5){this[_0x3b6e('0x36')]['noop'](util[_0x3b6e('0x2a')](_0x3b6e('0x1bd'),_0x35afa5));var _0x4ad114=this['channel']['streamFile'](_0x35afa5);try{fs[_0x3b6e('0xfc')](_0x35afa5+'.wav');}catch(_0x2b6f06){logger[_0x3b6e('0x2c')](_0x2b6f06);}return _0x4ad114;}return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x2d338c,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x3b6e('0x1be')]=function(_0x3b7af3){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x1bf'),_0x3b7af3[_0x3b6e('0x38')]));if(!this[_0x3b6e('0xa1')](_0x3b7af3[_0x3b6e('0x155')])){return this['channel'][_0x3b6e('0x2c')](_0x3b7af3,_0x3b6e('0x156'));}logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x157'),this[_0x3b6e('0x36')][_0x3b6e('0x3c')],_0x3b7af3[_0x3b6e('0x155')]));var _0x659f86=this[_0x3b6e('0x53')][_0x3b6e('0x6f')](this,_0x3b7af3[_0x3b6e('0x155')]);if(_0x659f86){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x158'),this[_0x3b6e('0x36')][_0x3b6e('0x3c')],_0x3b7af3[_0x3b6e('0x155')]));this['channel'][_0x3b6e('0xa6')](util[_0x3b6e('0x2a')](_0x3b6e('0x158'),this[_0x3b6e('0x36')][_0x3b6e('0x3c')],_0x3b7af3['findBy']));return{'code':0xc8,'result':_0x3b6e('0x15c')};}else{logger['info'](util[_0x3b6e('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3b6e('0x36')]['callerid'],_0x3b7af3[_0x3b6e('0x155')]));this[_0x3b6e('0x36')]['noop'](util[_0x3b6e('0x2a')](_0x3b6e('0x159'),this[_0x3b6e('0x36')][_0x3b6e('0x3c')],_0x3b7af3[_0x3b6e('0x155')]));return{'code':0xc8,'result':_0x3b6e('0x15d')};}};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1c0')]=function(_0x30e988){logger['info'](util[_0x3b6e('0x2a')](_0x3b6e('0x1c1'),_0x30e988[_0x3b6e('0x38')]));var _0x24367d=this[_0x3b6e('0x36')][_0x3b6e('0xa8')](_0x3b6e('0x1c2'),[_0x30e988[_0x3b6e('0x1c3')],_0x30e988['options']]);if(_0x24367d[_0x3b6e('0xaa')]===-0x1){return _0x24367d;}return this['channel']['noop'](util['format'](_0x3b6e('0xc0'),_0x3b6e('0x1c2'),_0x30e988['mailbox']));};AGIVertices[_0x3b6e('0x10')][_0x3b6e('0x1c4')]=function(_0x9ca090){logger[_0x3b6e('0x2e')](util[_0x3b6e('0x2a')](_0x3b6e('0x1c5'),_0x9ca090['label']));if(!this[_0x3b6e('0xa1')](_0x9ca090[_0x3b6e('0xd5')])){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x9ca090,_0x3b6e('0x1a7'));}var _0x5bf8ce=this[_0x3b6e('0x11')]['sync'](this,_0x9ca090['variable_id']);if(!_0x5bf8ce){return this[_0x3b6e('0x36')][_0x3b6e('0x2c')](_0x9ca090,_0x3b6e('0x110'));}var _0x28f6bc=this[_0x3b6e('0x36')][_0x3b6e('0x11')](_0x5bf8ce);return{'code':0xc8,'result':_0x28f6bc[_0x3b6e('0x9f')]?_0x28f6bc[_0x3b6e('0x9f')]:'-'};};String[_0x3b6e('0x10')]['replaceAll']=function(_0x2ec40c,_0x1124b0){return this['split'](_0x2ec40c)['join'](_0x1124b0);};module[_0x3b6e('0x1c6')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 0a24852..52d708a 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 _0xb821=['[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','acw','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','diff','seconds','startAcw','interface','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','getAgent','then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[ACW][START]\x20%s','prototype','[TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid'];(function(_0x119629,_0x246787){var _0x49a771=function(_0x23624c){while(--_0x23624c){_0x119629['push'](_0x119629['shift']());}};_0x49a771(++_0x246787);}(_0xb821,0xa7));var _0x1b82=function(_0x2b01b5,_0x4b4678){_0x2b01b5=_0x2b01b5-0x0;var _0x368042=_0xb821[_0x2b01b5];return _0x368042;};'use strict';var util=require('util');var _=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var ami=require('../ami');var logger=require('../../../config/logger')(_0x1b82('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x3b1d14){this[_0x1b82('0x3')]=_0x3b1d14[_0x1b82('0x3')];this[_0x1b82('0x4')]=_0x3b1d14['agents'];this[_0x1b82('0x5')]=_0x3b1d14[_0x1b82('0x5')];this[_0x1b82('0x6')]={};ami['on'](_0x1b82('0x7'),this[_0x1b82('0x8')][_0x1b82('0x9')](this));ami['on'](_0x1b82('0xa'),this[_0x1b82('0xb')][_0x1b82('0x9')](this));ami['on']('hangup',this[_0x1b82('0xc')][_0x1b82('0x9')](this));ami['on'](_0x1b82('0xd'),this[_0x1b82('0xe')][_0x1b82('0x9')](this));ami['on'](_0x1b82('0xf'),this[_0x1b82('0x10')][_0x1b82('0x9')](this));ami['on']('blindtransfer',this[_0x1b82('0x11')][_0x1b82('0x9')](this));ami['on'](_0x1b82('0x12'),this[_0x1b82('0x13')]['bind'](this));}function getDiff(_0x1a6285){var _0x5767aa=moment()['milliseconds'](0x0);var _0x1e553a=moment(_0x1a6285)['milliseconds'](0x0);return _0x5767aa[_0x1b82('0x14')](_0x1e553a,_0x1b82('0x15'));}Acw['prototype'][_0x1b82('0x16')]=function(_0x5dab7d){try{var _0x563261=this;var _0x1b115b=this['channels'][_0x5dab7d][_0x1b82('0x17')];var _0x25228b=this[_0x1b82('0x6')][_0x5dab7d]['queue'];var _0x514082=this[_0x1b82('0x3')][_0x25228b];var _0x5d66c3=![];var _0x3def2d=_0x1b82('0x18');if(_0x514082[_0x1b82('0x19')]){if(_0x514082['mandatoryDispositionPause'][_0x1b82('0x1a')]){_0x5d66c3=!![];_0x3def2d=_0x514082[_0x1b82('0x1b')][_0x1b82('0x1a')];}}ami[_0x1b82('0x1c')]({'action':_0x1b82('0x1d'),'interface':_0x1b115b,'paused':!![],'reason':_0x3def2d})['then'](function(_0x35a2c8){if(_0x563261[_0x1b82('0x4')][_0x1b115b]){return RpcUser[_0x1b82('0x1e')](_0x563261[_0x1b82('0x4')][_0x1b115b]['id'])[_0x1b82('0x1f')](function(_0x31fd64){if(_0x31fd64&&!_0x31fd64[_0x1b82('0x20')]){logger['info'](_0x1b82('0x21'),_0x5dab7d,_0x1b115b,_0x25228b);var _0x233740=_0x563261['channels'][_0x5dab7d][_0x1b82('0x22')]&&_0x563261[_0x1b82('0x6')][_0x5dab7d][_0x1b82('0x23')]?_0x563261['channels'][_0x5dab7d][_0x1b82('0x23')]:_0x5dab7d;return RpcUser['savePause'](_0x563261['agents'][_0x1b115b],_0x3def2d,_0x233740)['then'](function(_0xf2e556){if(!_0x5d66c3){_0x563261[_0x1b82('0x5')][_0x1b115b]={};logger[_0x1b82('0x24')](_0x1b82('0x25'),_0x5dab7d,_0x563261['voiceQueues'][_0x25228b][_0x1b82('0x26')],_0x1b115b,_0x25228b);_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x27')]=setTimeout(_0x563261[_0x1b82('0x28')][_0x1b82('0x9')](_0x563261,_0x1b115b),_0x563261[_0x1b82('0x3')][_0x25228b][_0x1b82('0x26')]*0x3e8);_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x29')]=moment()[_0x1b82('0x2a')](_0x1b82('0x2b'));_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x2c')]=_0x5dab7d;_0x563261['timers'][_0x1b115b][_0x1b82('0x2d')]=_0x25228b;_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x2e')]=function(){var _0x457dbb=getDiff(_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x29')]);clearTimeout(_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x27')]);_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x27')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x457dbb},_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x2c')],_0x1b115b)[_0x1b82('0x1f')](function(_0xc98ee2){logger['info'](_0x1b82('0x2f'),_0x5dab7d,_0x457dbb,_0xc98ee2);})[_0x1b82('0x30')](function(_0x544bd5){logger[_0x1b82('0x31')](_0x1b82('0x32'),_0x5dab7d,_0x544bd5);});delete _0x563261[_0x1b82('0x5')][_0x1b115b];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x5dab7d,_0x1b115b,_0x25228b);}});}})[_0x1b82('0x30')](function(_0x4c98e0){logger['error'](_0x1b82('0x25'),_0x5dab7d,_0x563261[_0x1b82('0x3')][_0x25228b][_0x1b82('0x26')],_0x1b115b,_0x25228b);})['finally'](function(){delete _0x563261[_0x1b82('0x6')][_0x5dab7d];});}catch(_0x366db3){logger[_0x1b82('0x31')](_0x1b82('0x33'),_0x366db3['message']);}};Acw[_0x1b82('0x34')][_0x1b82('0x28')]=function(_0x2ee9ac){try{var _0x5ebf6c=this;if(_0x5ebf6c['timers'][_0x2ee9ac]){_0x5ebf6c[_0x1b82('0x5')][_0x2ee9ac]['timer']=![];var _0x1d3e68=_0x5ebf6c[_0x1b82('0x5')][_0x2ee9ac][_0x1b82('0x2c')];var _0x348880=_0x5ebf6c[_0x1b82('0x5')][_0x2ee9ac][_0x1b82('0x2d')];var _0x39fe4a=_0x5ebf6c[_0x1b82('0x3')][_0x348880]['acwTimeout'];logger['info'](_0x1b82('0x35'),_0x2ee9ac);RpcUser['saveUnpause'](this[_0x1b82('0x4')][_0x2ee9ac]);RpcVoiceAgentReport['update']({'acwtime':_0x39fe4a,'agentacw':!![]},_0x1d3e68,_0x2ee9ac)[_0x1b82('0x1f')](function(_0x331379){logger[_0x1b82('0x24')](_0x1b82('0x2f'),_0x1d3e68,_0x39fe4a,_0x331379);})[_0x1b82('0x30')](function(_0x202bb4){logger['error'](_0x1b82('0x32'),_0x1d3e68,_0x202bb4);});}else{logger['error'](_0x1b82('0x36'),_0x2ee9ac);if(_0x5ebf6c['timers']){logger[_0x1b82('0x24')]('[ACW][TIMERS]',JSON['stringify'](_0x5ebf6c[_0x1b82('0x5')]));}}}catch(_0x388d14){logger[_0x1b82('0x31')](_0x1b82('0x37'),_0x388d14[_0x1b82('0x38')]);}};Acw['prototype'][_0x1b82('0x8')]=function(_0x4ffa9e){try{if(this[_0x1b82('0x3')][_0x4ffa9e[_0x1b82('0x2d')]]&&(this[_0x1b82('0x3')][_0x4ffa9e[_0x1b82('0x2d')]][_0x1b82('0x2')]||this['voiceQueues'][_0x4ffa9e[_0x1b82('0x2d')]]['mandatoryDisposition'])){if(this[_0x1b82('0x4')][_0x4ffa9e[_0x1b82('0x17')]]){this['channels'][_0x4ffa9e[_0x1b82('0x2c')]]={'queue':_0x4ffa9e[_0x1b82('0x2d')],'interface':_0x4ffa9e[_0x1b82('0x17')],'destlinkedid':_0x4ffa9e[_0x1b82('0x23')]};}}}catch(_0x39f6ef){logger[_0x1b82('0x31')](_0x1b82('0x39'),_0x39f6ef['message']);}};Acw[_0x1b82('0x34')]['syncAgentConnectPreview']=function(_0xb02ec3){try{if(this[_0x1b82('0x3')][_0xb02ec3[_0x1b82('0x2d')]]&&(this[_0x1b82('0x3')][_0xb02ec3[_0x1b82('0x2d')]][_0x1b82('0x2')]||this[_0x1b82('0x3')][_0xb02ec3[_0x1b82('0x2d')]][_0x1b82('0x19')])){if(this[_0x1b82('0x4')][_0xb02ec3[_0x1b82('0x17')]]){this[_0x1b82('0x6')][_0xb02ec3[_0x1b82('0x2c')]]={'queue':_0xb02ec3[_0x1b82('0x2d')],'interface':_0xb02ec3['interface']};}}}catch(_0x59afed){logger[_0x1b82('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x59afed[_0x1b82('0x38')]);}};Acw[_0x1b82('0x34')][_0x1b82('0xb')]=function(_0x5710f4){try{if(this[_0x1b82('0x6')][_0x5710f4['uniqueid']]&&_['isUndefined'](this[_0x1b82('0x6')][_0x5710f4[_0x1b82('0x2c')]][_0x1b82('0x22')])){logger['info'](_0x1b82('0x3a'),_0x5710f4[_0x1b82('0x2c')]);this['startAcw'](_0x5710f4['uniqueid']);}else if(this[_0x1b82('0x6')][_0x5710f4[_0x1b82('0x3b')]]&&_[_0x1b82('0x3c')](this['channels'][_0x5710f4[_0x1b82('0x3b')]][_0x1b82('0x22')])){logger[_0x1b82('0x24')](_0x1b82('0x3d'),_0x5710f4[_0x1b82('0x3b')]);this[_0x1b82('0x16')](_0x5710f4['linkedid']);}}catch(_0x3914aa){logger['error'](_0x1b82('0x3e'),_0x3914aa[_0x1b82('0x38')]);}};Acw['prototype'][_0x1b82('0xc')]=function(_0x5de11b){try{if(this[_0x1b82('0x6')][_0x5de11b[_0x1b82('0x2c')]]&&this[_0x1b82('0x6')][_0x5de11b[_0x1b82('0x2c')]][_0x1b82('0x22')]){logger[_0x1b82('0x24')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5de11b['uniqueid']);this[_0x1b82('0x16')](_0x5de11b[_0x1b82('0x2c')]);}else if(this[_0x1b82('0x6')][_0x5de11b[_0x1b82('0x3b')]]&&this[_0x1b82('0x6')][_0x5de11b[_0x1b82('0x3b')]][_0x1b82('0x22')]){logger[_0x1b82('0x24')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x5de11b['linkedid']);this['startAcw'](_0x5de11b[_0x1b82('0x3b')]);}}catch(_0x2a95d2){logger[_0x1b82('0x31')](_0x1b82('0x3f'),_0x2a95d2[_0x1b82('0x38')]);}};Acw[_0x1b82('0x34')][_0x1b82('0x10')]=function(_0x53f7a4){try{if(!_[_0x1b82('0x40')](this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x41')]])){this[_0x1b82('0x16')](_0x53f7a4[_0x1b82('0x41')]);if(this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x42')]]){this[_0x1b82('0x6')][_0x53f7a4['secondtransfereruniqueid']][_0x1b82('0x22')]=!![];this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x43')]]=this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x42')]];delete this['channels'][_0x53f7a4['secondtransfereruniqueid']];}}else if(!_[_0x1b82('0x40')](this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x43')]])){this[_0x1b82('0x16')](_0x53f7a4['transfertargetuniqueid']);if(this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x44')]]){this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x44')]][_0x1b82('0x22')]=!![];this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x41')]]=this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x44')]];delete this[_0x1b82('0x6')][_0x53f7a4['origtransfereruniqueid']];}}}catch(_0xde1d73){logger[_0x1b82('0x31')]('[ACW][syncAttendedTransfer]\x20%s',_0xde1d73[_0x1b82('0x38')]);}};Acw[_0x1b82('0x34')][_0x1b82('0x11')]=function(_0x2a5435){try{if(this['channels'][_0x2a5435[_0x1b82('0x45')]]){logger[_0x1b82('0x24')](_0x1b82('0x46'),JSON[_0x1b82('0x47')](_0x2a5435[_0x1b82('0x45')]));this[_0x1b82('0x16')](_0x2a5435['transfereruniqueid']);}else if(this[_0x1b82('0x6')][_0x2a5435['transfererlinkedid']]){logger[_0x1b82('0x24')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x1b82('0x47')](_0x2a5435[_0x1b82('0x48')]));this[_0x1b82('0x16')](_0x2a5435[_0x1b82('0x48')]);}}catch(_0x412073){logger[_0x1b82('0x31')](_0x1b82('0x49'),_0x412073['message']);}};Acw[_0x1b82('0x34')][_0x1b82('0xe')]=function(_0x1435a2){try{if(this[_0x1b82('0x3')][_0x1435a2[_0x1b82('0x2d')]]&&this[_0x1b82('0x3')][_0x1435a2[_0x1b82('0x2d')]][_0x1b82('0x4a')]===_0x1b82('0x4b')){if(this[_0x1b82('0x4')][_0x1435a2[_0x1b82('0x17')]]){logger[_0x1b82('0x24')](_0x1b82('0x4c'),_0x1435a2['uniqueid'],_0x1435a2[_0x1b82('0x17')],_0x1435a2[_0x1b82('0x2d')]);return RpcUser[_0x1b82('0x4d')](this['agents'][_0x1435a2[_0x1b82('0x17')]],_0x1b82('0x4e'),_0x1435a2['uniqueid']);}}}catch(_0x3bf106){logger[_0x1b82('0x31')](_0x1b82('0x4f'),_0x3bf106['message']);}};module['exports']=Acw; \ No newline at end of file +var _0x17ba=['exports','util','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','diff','seconds','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','attended','destlinkedid','savePause','stopAcw','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','prototype','[TIMER][STOP][AGENT:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','autopause','all','[ACW][syncAgentRingNoAnswer]\x20%s'];(function(_0xb691c5,_0x56bd81){var _0x51b938=function(_0x25ea5a){while(--_0x25ea5a){_0xb691c5['push'](_0xb691c5['shift']());}};_0x51b938(++_0x56bd81);}(_0x17ba,0xab));var _0xa17b=function(_0x28f363,_0x390b93){_0x28f363=_0x28f363-0x0;var _0x2d681c=_0x17ba[_0x28f363];return _0x2d681c;};'use strict';var util=require(_0xa17b('0x0'));var _=require(_0xa17b('0x1'));var moment=require('moment');var ami=require(_0xa17b('0x2'));var logger=require(_0xa17b('0x3'))(_0xa17b('0x4'));var RpcUser=require(_0xa17b('0x5'));var RpcVoiceAgentReport=require(_0xa17b('0x6'));function Acw(_0x38c13c){this[_0xa17b('0x7')]=_0x38c13c[_0xa17b('0x7')];this[_0xa17b('0x8')]=_0x38c13c[_0xa17b('0x8')];this[_0xa17b('0x9')]=_0x38c13c[_0xa17b('0x9')];this[_0xa17b('0xa')]={};ami['on'](_0xa17b('0xb'),this[_0xa17b('0xc')][_0xa17b('0xd')](this));ami['on'](_0xa17b('0xe'),this[_0xa17b('0xf')][_0xa17b('0xd')](this));ami['on']('hangup',this[_0xa17b('0x10')][_0xa17b('0xd')](this));ami['on'](_0xa17b('0x11'),this[_0xa17b('0x12')][_0xa17b('0xd')](this));ami['on'](_0xa17b('0x13'),this[_0xa17b('0x14')]['bind'](this));ami['on'](_0xa17b('0x15'),this[_0xa17b('0x16')][_0xa17b('0xd')](this));ami['on']('custom:agentConnectPreview',this[_0xa17b('0x17')][_0xa17b('0xd')](this));}function getDiff(_0x30236c){var _0xeeacaa=moment()['milliseconds'](0x0);var _0x117ad9=moment(_0x30236c)['milliseconds'](0x0);return _0xeeacaa[_0xa17b('0x18')](_0x117ad9,_0xa17b('0x19'));}Acw['prototype'][_0xa17b('0x1a')]=function(_0x3c63e3){try{var _0x1c0578=this;var _0x1f8141=this['channels'][_0x3c63e3][_0xa17b('0x1b')];var _0x5e21c2=this['channels'][_0x3c63e3]['queue'];var _0x36f985=this[_0xa17b('0x7')][_0x5e21c2];var _0x53a0f7=![];var _0x2ceafa=_0xa17b('0x1c');if(_0x36f985[_0xa17b('0x1d')]){if(_0x36f985[_0xa17b('0x1e')][_0xa17b('0x1f')]){_0x53a0f7=!![];_0x2ceafa=_0x36f985[_0xa17b('0x1e')][_0xa17b('0x1f')];}}ami['Action']({'action':_0xa17b('0x20'),'interface':_0x1f8141,'paused':!![],'reason':_0x2ceafa})[_0xa17b('0x21')](function(_0x45bd0c){if(_0x1c0578['agents'][_0x1f8141]){return RpcUser[_0xa17b('0x22')](_0x1c0578[_0xa17b('0x8')][_0x1f8141]['id'])[_0xa17b('0x21')](function(_0xbbbb62){if(_0xbbbb62&&!_0xbbbb62[_0xa17b('0x23')]){logger[_0xa17b('0x24')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x3c63e3,_0x1f8141,_0x5e21c2);var _0x3df11f=_0x1c0578['channels'][_0x3c63e3][_0xa17b('0x25')]&&_0x1c0578[_0xa17b('0xa')][_0x3c63e3]['destlinkedid']?_0x1c0578['channels'][_0x3c63e3][_0xa17b('0x26')]:_0x3c63e3;return RpcUser[_0xa17b('0x27')](_0x1c0578[_0xa17b('0x8')][_0x1f8141],_0x2ceafa,_0x3df11f)[_0xa17b('0x21')](function(_0x3c32a5){if(!_0x53a0f7){_0x1c0578[_0xa17b('0x9')][_0x1f8141]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3c63e3,_0x1c0578['voiceQueues'][_0x5e21c2]['acwTimeout'],_0x1f8141,_0x5e21c2);_0x1c0578[_0xa17b('0x9')][_0x1f8141]['timer']=setTimeout(_0x1c0578[_0xa17b('0x28')]['bind'](_0x1c0578,_0x1f8141),_0x1c0578[_0xa17b('0x7')][_0x5e21c2][_0xa17b('0x29')]*0x3e8);_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2a')]=moment()[_0xa17b('0x2b')](_0xa17b('0x2c'));_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2d')]=_0x3c63e3;_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2e')]=_0x5e21c2;_0x1c0578[_0xa17b('0x9')][_0x1f8141]['updateAcw']=function(){var _0x57a2c4=getDiff(_0x1c0578['timers'][_0x1f8141][_0xa17b('0x2a')]);clearTimeout(_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2f')]);_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2f')]=![];RpcVoiceAgentReport[_0xa17b('0x30')]({'acwtime':_0x57a2c4},_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2d')],_0x1f8141)['then'](function(_0x1e33bf){logger['info'](_0xa17b('0x31'),_0x3c63e3,_0x57a2c4,_0x1e33bf);})[_0xa17b('0x32')](function(_0x198ceb){logger[_0xa17b('0x33')](_0xa17b('0x34'),_0x3c63e3,_0x198ceb);});delete _0x1c0578[_0xa17b('0x9')][_0x1f8141];};}});}else{logger['info'](_0xa17b('0x35'),_0x3c63e3,_0x1f8141,_0x5e21c2);}});}})[_0xa17b('0x32')](function(_0x323e0e){logger[_0xa17b('0x33')](_0xa17b('0x36'),_0x3c63e3,_0x1c0578['voiceQueues'][_0x5e21c2][_0xa17b('0x29')],_0x1f8141,_0x5e21c2);})['finally'](function(){delete _0x1c0578[_0xa17b('0xa')][_0x3c63e3];});}catch(_0x5a0b00){logger[_0xa17b('0x33')](_0xa17b('0x37'),_0x5a0b00['message']);}};Acw[_0xa17b('0x38')][_0xa17b('0x28')]=function(_0x487e9a){try{var _0x2fb380=this;if(_0x2fb380[_0xa17b('0x9')][_0x487e9a]){_0x2fb380[_0xa17b('0x9')][_0x487e9a][_0xa17b('0x2f')]=![];var _0xd71efd=_0x2fb380['timers'][_0x487e9a][_0xa17b('0x2d')];var _0x506488=_0x2fb380[_0xa17b('0x9')][_0x487e9a]['queue'];var _0x118ad9=_0x2fb380['voiceQueues'][_0x506488][_0xa17b('0x29')];logger['info'](_0xa17b('0x39'),_0x487e9a);RpcUser['saveUnpause'](this[_0xa17b('0x8')][_0x487e9a]);RpcVoiceAgentReport[_0xa17b('0x30')]({'acwtime':_0x118ad9,'agentacw':!![]},_0xd71efd,_0x487e9a)[_0xa17b('0x21')](function(_0x318b1c){logger[_0xa17b('0x24')](_0xa17b('0x31'),_0xd71efd,_0x118ad9,_0x318b1c);})[_0xa17b('0x32')](function(_0xe57f94){logger['error'](_0xa17b('0x34'),_0xd71efd,_0xe57f94);});}else{logger[_0xa17b('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x487e9a);if(_0x2fb380[_0xa17b('0x9')]){logger[_0xa17b('0x24')](_0xa17b('0x3a'),JSON[_0xa17b('0x3b')](_0x2fb380[_0xa17b('0x9')]));}}}catch(_0x2fe669){logger['error'](_0xa17b('0x3c'),_0x2fe669[_0xa17b('0x3d')]);}};Acw[_0xa17b('0x38')]['syncAgentConnect']=function(_0x54b65c){try{if(this['voiceQueues'][_0x54b65c[_0xa17b('0x2e')]]&&(this[_0xa17b('0x7')][_0x54b65c[_0xa17b('0x2e')]][_0xa17b('0x4')]||this[_0xa17b('0x7')][_0x54b65c[_0xa17b('0x2e')]][_0xa17b('0x1d')])){if(this[_0xa17b('0x8')][_0x54b65c[_0xa17b('0x1b')]]){this[_0xa17b('0xa')][_0x54b65c[_0xa17b('0x2d')]]={'queue':_0x54b65c[_0xa17b('0x2e')],'interface':_0x54b65c['interface'],'destlinkedid':_0x54b65c[_0xa17b('0x26')]};}}}catch(_0x16db4a){logger[_0xa17b('0x33')](_0xa17b('0x3e'),_0x16db4a[_0xa17b('0x3d')]);}};Acw[_0xa17b('0x38')]['syncAgentConnectPreview']=function(_0x43d6d6){try{if(this[_0xa17b('0x7')][_0x43d6d6[_0xa17b('0x2e')]]&&(this[_0xa17b('0x7')][_0x43d6d6[_0xa17b('0x2e')]]['acw']||this[_0xa17b('0x7')][_0x43d6d6[_0xa17b('0x2e')]][_0xa17b('0x1d')])){if(this[_0xa17b('0x8')][_0x43d6d6['interface']]){this[_0xa17b('0xa')][_0x43d6d6[_0xa17b('0x2d')]]={'queue':_0x43d6d6[_0xa17b('0x2e')],'interface':_0x43d6d6[_0xa17b('0x1b')]};}}}catch(_0x11b256){logger[_0xa17b('0x33')](_0xa17b('0x3f'),_0x11b256['message']);}};Acw[_0xa17b('0x38')][_0xa17b('0xf')]=function(_0x4ffe5a){try{if(this[_0xa17b('0xa')][_0x4ffe5a[_0xa17b('0x2d')]]&&_[_0xa17b('0x40')](this['channels'][_0x4ffe5a[_0xa17b('0x2d')]][_0xa17b('0x25')])){logger['info'](_0xa17b('0x41'),_0x4ffe5a[_0xa17b('0x2d')]);this['startAcw'](_0x4ffe5a[_0xa17b('0x2d')]);}else if(this[_0xa17b('0xa')][_0x4ffe5a['linkedid']]&&_[_0xa17b('0x40')](this[_0xa17b('0xa')][_0x4ffe5a[_0xa17b('0x42')]][_0xa17b('0x25')])){logger[_0xa17b('0x24')](_0xa17b('0x43'),_0x4ffe5a[_0xa17b('0x42')]);this['startAcw'](_0x4ffe5a[_0xa17b('0x42')]);}}catch(_0x3ff07a){logger[_0xa17b('0x33')](_0xa17b('0x44'),_0x3ff07a[_0xa17b('0x3d')]);}};Acw[_0xa17b('0x38')][_0xa17b('0x10')]=function(_0x100d14){try{if(this[_0xa17b('0xa')][_0x100d14[_0xa17b('0x2d')]]&&this[_0xa17b('0xa')][_0x100d14[_0xa17b('0x2d')]][_0xa17b('0x25')]){logger['info'](_0xa17b('0x45'),_0x100d14[_0xa17b('0x2d')]);this[_0xa17b('0x1a')](_0x100d14[_0xa17b('0x2d')]);}else if(this[_0xa17b('0xa')][_0x100d14[_0xa17b('0x42')]]&&this[_0xa17b('0xa')][_0x100d14[_0xa17b('0x42')]][_0xa17b('0x25')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x100d14[_0xa17b('0x42')]);this[_0xa17b('0x1a')](_0x100d14['linkedid']);}}catch(_0x568f27){logger['error'](_0xa17b('0x46'),_0x568f27[_0xa17b('0x3d')]);}};Acw[_0xa17b('0x38')][_0xa17b('0x14')]=function(_0x301019){try{if(!_[_0xa17b('0x47')](this['channels'][_0x301019['transfereeuniqueid']])){this['startAcw'](_0x301019['transfereeuniqueid']);if(this['channels'][_0x301019[_0xa17b('0x48')]]){this[_0xa17b('0xa')][_0x301019[_0xa17b('0x48')]][_0xa17b('0x25')]=!![];this[_0xa17b('0xa')][_0x301019[_0xa17b('0x49')]]=this[_0xa17b('0xa')][_0x301019['secondtransfereruniqueid']];delete this[_0xa17b('0xa')][_0x301019[_0xa17b('0x48')]];}}else if(!_[_0xa17b('0x47')](this[_0xa17b('0xa')][_0x301019[_0xa17b('0x49')]])){this[_0xa17b('0x1a')](_0x301019[_0xa17b('0x49')]);if(this[_0xa17b('0xa')][_0x301019[_0xa17b('0x4a')]]){this[_0xa17b('0xa')][_0x301019[_0xa17b('0x4a')]][_0xa17b('0x25')]=!![];this['channels'][_0x301019[_0xa17b('0x4b')]]=this['channels'][_0x301019[_0xa17b('0x4a')]];delete this[_0xa17b('0xa')][_0x301019[_0xa17b('0x4a')]];}}}catch(_0x2ac414){logger['error'](_0xa17b('0x4c'),_0x2ac414['message']);}};Acw[_0xa17b('0x38')]['syncBlindTransfer']=function(_0x5be3d1){try{if(this[_0xa17b('0xa')][_0x5be3d1[_0xa17b('0x4d')]]){logger['info'](_0xa17b('0x4e'),JSON[_0xa17b('0x3b')](_0x5be3d1['transfereruniqueid']));this['startAcw'](_0x5be3d1[_0xa17b('0x4d')]);}else if(this[_0xa17b('0xa')][_0x5be3d1['transfererlinkedid']]){logger[_0xa17b('0x24')](_0xa17b('0x4f'),JSON['stringify'](_0x5be3d1[_0xa17b('0x50')]));this[_0xa17b('0x1a')](_0x5be3d1[_0xa17b('0x50')]);}}catch(_0x7b5a5d){logger[_0xa17b('0x33')]('[ACW][syncBlindTransfer]\x20%s',_0x7b5a5d[_0xa17b('0x3d')]);}};Acw[_0xa17b('0x38')][_0xa17b('0x12')]=function(_0x29cdfc){try{if(this[_0xa17b('0x7')][_0x29cdfc[_0xa17b('0x2e')]]&&this[_0xa17b('0x7')][_0x29cdfc[_0xa17b('0x2e')]][_0xa17b('0x51')]===_0xa17b('0x52')){if(this['agents'][_0x29cdfc[_0xa17b('0x1b')]]){logger[_0xa17b('0x24')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x29cdfc['uniqueid'],_0x29cdfc[_0xa17b('0x1b')],_0x29cdfc[_0xa17b('0x2e')]);return RpcUser[_0xa17b('0x27')](this[_0xa17b('0x8')][_0x29cdfc[_0xa17b('0x1b')]],'Auto-Pause',_0x29cdfc[_0xa17b('0x2d')]);}}}catch(_0x469ecd){logger[_0xa17b('0x33')](_0xa17b('0x53'),_0x469ecd['message']);}};module[_0xa17b('0x54')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 75c08bc..6b7979a 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 _0xdf94=['resolve','then','actionQueueSummary','log','asterisk-manager','bluebird','moment','util','lodash','../../config/logger','ami','../../config/environment','asterisk','username','keepConnected','Action','promisify','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','error','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xdf94,0x10e));var _0x4df9=function(_0xb02ad,_0x4de34b){_0xb02ad=_0xb02ad-0x0;var _0x3eea66=_0xdf94[_0xb02ad];return _0x3eea66;};'use strict';var Manager=require(_0x4df9('0x0'));var BPromise=require(_0x4df9('0x1'));var moment=require(_0x4df9('0x2'));var util=require(_0x4df9('0x3'));var _=require(_0x4df9('0x4'));var logger=require(_0x4df9('0x5'))(_0x4df9('0x6'));var config=require(_0x4df9('0x7'));var ami=new Manager(config['asterisk']['port'],config['asterisk']['ip'],config[_0x4df9('0x8')][_0x4df9('0x9')],config[_0x4df9('0x8')]['password'],!![]);ami[_0x4df9('0xa')]();ami[_0x4df9('0xb')]=BPromise[_0x4df9('0xc')](ami['action']);function error(_0x326e99){logger['error'](util[_0x4df9('0xd')](_0x4df9('0xe'),config[_0x4df9('0x8')][_0x4df9('0x9')],config[_0x4df9('0x8')]['ip'],config[_0x4df9('0x8')][_0x4df9('0xf')],util[_0x4df9('0x10')](_0x326e99,![],null)));}function close(){logger['error'](util['format'](_0x4df9('0x11'),config[_0x4df9('0x8')][_0x4df9('0x9')],config[_0x4df9('0x8')]['ip'],config[_0x4df9('0x8')][_0x4df9('0xf')]));}ami[_0x4df9('0x12')]=function(){return function(){return ami[_0x4df9('0xb')]({'action':_0x4df9('0x13')});};};ami[_0x4df9('0x14')]=function(){return function(){return ami[_0x4df9('0xb')]({'action':_0x4df9('0x15')});};};ami[_0x4df9('0x16')]=function(){return function(){return ami[_0x4df9('0xb')]({'action':_0x4df9('0x17')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x4df9('0xb')]({'action':'queuesummary'});};};ami[_0x4df9('0x18')]=function(){return function(){return ami[_0x4df9('0xb')]({'action':'coreshowchannels'});};};function connect(_0x4b4451){logger[_0x4df9('0x19')](util[_0x4df9('0xd')](_0x4df9('0x1a'),config[_0x4df9('0x8')][_0x4df9('0x9')],config[_0x4df9('0x8')]['ip'],config[_0x4df9('0x8')][_0x4df9('0xf')]));ami['once'](_0x4df9('0x1b'),error);ami[_0x4df9('0x1c')](_0x4df9('0x1d'),close);}ami['on'](_0x4df9('0x1e'),connect);ami['on'](_0x4df9('0x1f'),function(_0xa6827c){logger[_0x4df9('0x19')](util[_0x4df9('0xd')](_0x4df9('0x20'),config['asterisk']['username'],config['asterisk']['ip'],config['asterisk']['port'],util[_0x4df9('0x10')](_0xa6827c,![],null)));});ami['on']('fullybooted',function(_0x41b9fa){logger['info'](util[_0x4df9('0xd')](_0x4df9('0x21'),config[_0x4df9('0x8')]['username'],config[_0x4df9('0x8')]['ip'],config[_0x4df9('0x8')][_0x4df9('0xf')]));return BPromise[_0x4df9('0x22')]()[_0x4df9('0x23')](ami[_0x4df9('0x12')]())['then'](ami['actionDeviceStateList']())[_0x4df9('0x23')](ami['actionSipPeerStatus']())[_0x4df9('0x23')](ami[_0x4df9('0x24')]())['then'](ami[_0x4df9('0x18')]())['catch'](function(_0xba02a1){console[_0x4df9('0x25')](_0xba02a1);});});ami[_0x4df9('0x1c')](_0x4df9('0x1b'),error);ami[_0x4df9('0x1c')](_0x4df9('0x1d'),close);module['exports']=ami; \ No newline at end of file +var _0xcffd=['asterisk','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','exports','asterisk-manager','bluebird','moment','lodash','../../config/logger','ami','../../config/environment','port'];(function(_0x8f9c12,_0x2a746d){var _0x3d44ca=function(_0x3e30d9){while(--_0x3e30d9){_0x8f9c12['push'](_0x8f9c12['shift']());}};_0x3d44ca(++_0x2a746d);}(_0xcffd,0x6a));var _0xdcff=function(_0x404c00,_0x37e094){_0x404c00=_0x404c00-0x0;var _0x892262=_0xcffd[_0x404c00];return _0x892262;};'use strict';var Manager=require(_0xdcff('0x0'));var BPromise=require(_0xdcff('0x1'));var moment=require(_0xdcff('0x2'));var util=require('util');var _=require(_0xdcff('0x3'));var logger=require(_0xdcff('0x4'))(_0xdcff('0x5'));var config=require(_0xdcff('0x6'));var ami=new Manager(config['asterisk'][_0xdcff('0x7')],config[_0xdcff('0x8')]['ip'],config[_0xdcff('0x8')]['username'],config[_0xdcff('0x8')][_0xdcff('0x9')],!![]);ami[_0xdcff('0xa')]();ami[_0xdcff('0xb')]=BPromise[_0xdcff('0xc')](ami[_0xdcff('0xd')]);function error(_0x5d13b6){logger[_0xdcff('0xe')](util[_0xdcff('0xf')](_0xdcff('0x10'),config[_0xdcff('0x8')]['username'],config[_0xdcff('0x8')]['ip'],config[_0xdcff('0x8')]['port'],util['inspect'](_0x5d13b6,![],null)));}function close(){logger[_0xdcff('0xe')](util[_0xdcff('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xdcff('0x8')][_0xdcff('0x11')],config[_0xdcff('0x8')]['ip'],config[_0xdcff('0x8')][_0xdcff('0x7')]));}ami[_0xdcff('0x12')]=function(){return function(){return ami[_0xdcff('0xb')]({'action':'sipshowregistry'});};};ami[_0xdcff('0x13')]=function(){return function(){return ami[_0xdcff('0xb')]({'action':_0xdcff('0x14')});};};ami[_0xdcff('0x15')]=function(){return function(){return ami[_0xdcff('0xb')]({'action':'sippeerstatus'});};};ami[_0xdcff('0x16')]=function(){return function(){return ami[_0xdcff('0xb')]({'action':_0xdcff('0x17')});};};ami[_0xdcff('0x18')]=function(){return function(){return ami[_0xdcff('0xb')]({'action':_0xdcff('0x19')});};};function connect(_0x27a3d8){logger[_0xdcff('0x1a')](util[_0xdcff('0xf')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xdcff('0x8')][_0xdcff('0x11')],config[_0xdcff('0x8')]['ip'],config[_0xdcff('0x8')][_0xdcff('0x7')]));ami[_0xdcff('0x1b')]('error',error);ami[_0xdcff('0x1b')](_0xdcff('0x1c'),close);}ami['on'](_0xdcff('0x1d'),connect);ami['on'](_0xdcff('0x1e'),function(_0x3ac56b){logger['info'](util['format'](_0xdcff('0x1f'),config[_0xdcff('0x8')]['username'],config[_0xdcff('0x8')]['ip'],config[_0xdcff('0x8')][_0xdcff('0x7')],util[_0xdcff('0x20')](_0x3ac56b,![],null)));});ami['on']('fullybooted',function(_0x403608){logger[_0xdcff('0x1a')](util['format'](_0xdcff('0x21'),config['asterisk'][_0xdcff('0x11')],config[_0xdcff('0x8')]['ip'],config[_0xdcff('0x8')]['port']));return BPromise[_0xdcff('0x22')]()['then'](ami['actionSipShowRegistry']())[_0xdcff('0x23')](ami['actionDeviceStateList']())[_0xdcff('0x23')](ami[_0xdcff('0x15')]())['then'](ami['actionQueueSummary']())['then'](ami[_0xdcff('0x18')]())[_0xdcff('0x24')](function(_0x2d6f6b){console['log'](_0x2d6f6b);});});ami['once'](_0xdcff('0xe'),error);ami['once'](_0xdcff('0x1c'),close);module[_0xdcff('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 613305b..29d66c6 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 _0xe98e=['bluebird','../../config/logger','ami','client','Request','debug','rpc','memberReport','error','message','result','catch','jayson/promise'];(function(_0x355494,_0x592917){var _0x59d215=function(_0x1c59f7){while(--_0x1c59f7){_0x355494['push'](_0x355494['shift']());}};_0x59d215(++_0x592917);}(_0xe98e,0xf6));var _0xee98=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xe98e[_0x13d07a];return _0x5ee0ee;};'use strict';var jayson=require(_0xee98('0x0'));var BPromise=require(_0xee98('0x1'));var logger=require(_0xee98('0x2'))(_0xee98('0x3'));var client=jayson[_0xee98('0x4')]['http']({'port':0x2329});client[_0xee98('0x5')]=function(_0x2164fd,_0x34de6c){return new BPromise(function(_0x226243,_0x37613b){return client['request'](_0x2164fd,_0x34de6c)['then'](function(_0x3fc2b2){logger[_0xee98('0x6')](_0xee98('0x7'),_0xee98('0x8'),_0x2164fd,_0x34de6c,_0x3fc2b2);if(_0x3fc2b2['error']){logger[_0xee98('0x9')]('rpc',_0xee98('0x8'),_0x2164fd,_0x3fc2b2[_0xee98('0x9')][_0xee98('0xa')],_0x34de6c);return _0x37613b(_0x3fc2b2[_0xee98('0x9')]['message']);}else{return _0x226243(_0x3fc2b2[_0xee98('0xb')]);}})[_0xee98('0xc')](function(_0x4dab08){logger[_0xee98('0x9')](_0xee98('0x7'),_0xee98('0x8'),_0x2164fd,_0x4dab08,_0x34de6c);return _0x37613b(_0x4dab08);});});};module['exports']=client; \ No newline at end of file +var _0x6a47=['ami','http','Request','request','then','debug','rpc','memberReport','error','message','result','catch','exports','jayson/promise'];(function(_0x2ee113,_0x21b2d3){var _0xd53df=function(_0x209830){while(--_0x209830){_0x2ee113['push'](_0x2ee113['shift']());}};_0xd53df(++_0x21b2d3);}(_0x6a47,0x6f));var _0x76a4=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x6a47[_0x46698a];return _0x356db0;};'use strict';var jayson=require(_0x76a4('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x76a4('0x1'));var client=jayson['client'][_0x76a4('0x2')]({'port':0x2329});client[_0x76a4('0x3')]=function(_0x597f2f,_0x387606){return new BPromise(function(_0x414ac9,_0x3c120c){return client[_0x76a4('0x4')](_0x597f2f,_0x387606)[_0x76a4('0x5')](function(_0x29cda4){logger[_0x76a4('0x6')](_0x76a4('0x7'),_0x76a4('0x8'),_0x597f2f,_0x387606,_0x29cda4);if(_0x29cda4[_0x76a4('0x9')]){logger[_0x76a4('0x9')]('rpc','memberReport',_0x597f2f,_0x29cda4[_0x76a4('0x9')][_0x76a4('0xa')],_0x387606);return _0x3c120c(_0x29cda4[_0x76a4('0x9')][_0x76a4('0xa')]);}else{return _0x414ac9(_0x29cda4[_0x76a4('0xb')]);}})[_0x76a4('0xc')](function(_0x9bafdf){logger['error']('rpc',_0x76a4('0x8'),_0x597f2f,_0x9bafdf,_0x387606);return _0x3c120c(_0x9bafdf);});});};module[_0x76a4('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 0297943..68a694d 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 _0x68b7=['originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','exports','util','moment','isNil','string','voiceQueue','uniqueid','name','phone','firstName','Contact','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x68b7,0x8c));var _0x768b=function(_0x1c544e,_0x6df2f8){_0x1c544e=_0x1c544e-0x0;var _0x5ea712=_0x68b7[_0x1c544e];return _0x5ea712;};'use strict';var util=require(_0x768b('0x0'));var _=require('lodash');var moment=require(_0x768b('0x1'));function checkNameSurname(_0x92a7b4,_0x1a3316,_0x5d4c23){var _0x355531='';if(!_[_0x768b('0x2')](_0x1a3316)&&_0x768b('0x3')===typeof _0x1a3316){_0x355531+=_0x1a3316;}if(!_['isNil'](_0x5d4c23)&&_0x768b('0x3')===typeof _0x5d4c23){_0x355531+='\x20'+_0x5d4c23;}if(_0x355531!==''){return _0x355531;}return _0x92a7b4;}function Action(_0x1dc0e1,_0x18aaaa,_0x31aba4){this[_0x768b('0x4')]=_0x1dc0e1;this[_0x768b('0x5')]=_0x31aba4||undefined;this[_0x768b('0x6')]=checkNameSurname(_0x18aaaa['Contact'][_0x768b('0x7')],_0x18aaaa['Contact'][_0x768b('0x8')],_0x18aaaa[_0x768b('0x9')][_0x768b('0xa')]);this[_0x768b('0xb')]=_0x18aaaa[_0x768b('0x9')][_0x768b('0x7')];this['queue']=_0x1dc0e1[_0x768b('0x6')];this[_0x768b('0xc')]=_0x18aaaa['active']||![];this['type']=_0x1dc0e1[_0x768b('0xd')];this[_0x768b('0xe')]=_0x1dc0e1[_0x768b('0xe')]||0x3;this[_0x768b('0xf')]=_0x18aaaa[_0x768b('0xf')];this[_0x768b('0x10')]=_0x18aaaa[_0x768b('0x10')];this[_0x768b('0x11')]=_0x18aaaa[_0x768b('0x11')];this['countnoanswerretry']=_0x18aaaa[_0x768b('0x12')];this[_0x768b('0x13')]=_0x18aaaa[_0x768b('0x13')];this[_0x768b('0x14')]=_0x18aaaa[_0x768b('0x14')];this['countabandonedretry']=_0x18aaaa[_0x768b('0x15')];this[_0x768b('0x16')]=_0x18aaaa[_0x768b('0x16')];this[_0x768b('0x17')]=_0x18aaaa[_0x768b('0x17')];this[_0x768b('0x18')]=_0x18aaaa[_0x768b('0x18')];this[_0x768b('0x19')]=_0x18aaaa[_0x768b('0x19')];this[_0x768b('0x1a')]=_0x18aaaa[_0x768b('0x1a')];this[_0x768b('0x1b')]=_0x18aaaa['VoiceQueueId'];this['CampaignId']=_0x18aaaa[_0x768b('0x1c')];this[_0x768b('0x1d')]=_0x18aaaa['id'];this['ContactFirstName']=_0x18aaaa[_0x768b('0x9')][_0x768b('0x8')]||'';this['starttime']=moment()[_0x768b('0x1e')](_0x768b('0x1f'));this[_0x768b('0x20')]=_0x18aaaa[_0x768b('0x20')];this[_0x768b('0x21')]=_0x18aaaa['callbackuniqueid'];this['callbackat']=_0x18aaaa[_0x768b('0x22')];this[_0x768b('0x23')]=_0x18aaaa[_0x768b('0x23')];this[_0x768b('0x24')]='';this[_0x768b('0x25')]='';}Action[_0x768b('0x26')][_0x768b('0x27')]=function(){return util[_0x768b('0x1e')](_0x768b('0x28'),this[_0x768b('0x6')],this[_0x768b('0x4')][_0x768b('0x29')]>0x0?this[_0x768b('0xb')][_0x768b('0x2a')](this['voiceQueue'][_0x768b('0x29')]):this['number']);};Action['prototype']['getQueue']=function(){return this['queue'];};module[_0x768b('0x2b')]=Action; \ No newline at end of file +var _0xe706=['lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','\x22%s\x22\x20<%s>','dialCutDigit','exports','util'];(function(_0xd0f4a5,_0xc6209d){var _0x2ba320=function(_0x142b88){while(--_0x142b88){_0xd0f4a5['push'](_0xd0f4a5['shift']());}};_0x2ba320(++_0xc6209d);}(_0xe706,0xa3));var _0x6e70=function(_0x468ac5,_0x2edfd5){_0x468ac5=_0x468ac5-0x0;var _0x33a807=_0xe706[_0x468ac5];return _0x33a807;};'use strict';var util=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));function checkNameSurname(_0x5e8446,_0x2cae77,_0x315629){var _0x2ca810='';if(!_[_0x6e70('0x3')](_0x2cae77)&&_0x6e70('0x4')===typeof _0x2cae77){_0x2ca810+=_0x2cae77;}if(!_[_0x6e70('0x3')](_0x315629)&&_0x6e70('0x4')===typeof _0x315629){_0x2ca810+='\x20'+_0x315629;}if(_0x2ca810!==''){return _0x2ca810;}return _0x5e8446;}function Action(_0x506db9,_0x1b0389,_0x4381d1){this[_0x6e70('0x5')]=_0x506db9;this[_0x6e70('0x6')]=_0x4381d1||undefined;this[_0x6e70('0x7')]=checkNameSurname(_0x1b0389[_0x6e70('0x8')][_0x6e70('0x9')],_0x1b0389[_0x6e70('0x8')][_0x6e70('0xa')],_0x1b0389[_0x6e70('0x8')][_0x6e70('0xb')]);this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0x8')][_0x6e70('0x9')];this[_0x6e70('0xd')]=_0x506db9[_0x6e70('0x7')];this['active']=_0x1b0389['active']||![];this[_0x6e70('0xe')]=_0x506db9[_0x6e70('0xe')];this[_0x6e70('0xf')]=_0x506db9[_0x6e70('0xf')]||0x3;this[_0x6e70('0x10')]=_0x1b0389[_0x6e70('0x10')];this[_0x6e70('0x11')]=_0x1b0389[_0x6e70('0x11')];this['countcongestionretry']=_0x1b0389['countcongestionretry'];this['countnoanswerretry']=_0x1b0389[_0x6e70('0x12')];this['countnosuchnumberretry']=_0x1b0389['countnosuchnumberretry'];this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')];this['countabandonedretry']=_0x1b0389[_0x6e70('0x14')];this['countmachineretry']=_0x1b0389[_0x6e70('0x15')];this[_0x6e70('0x16')]=_0x1b0389['countagentrejectretry'];this['ContactId']=_0x1b0389[_0x6e70('0x17')];this['ListId']=_0x1b0389[_0x6e70('0x18')];this[_0x6e70('0x19')]=_0x1b0389['UserId'];this['VoiceQueueId']=_0x1b0389[_0x6e70('0x1a')];this[_0x6e70('0x1b')]=_0x1b0389[_0x6e70('0x1b')];this[_0x6e70('0x1c')]=_0x1b0389['id'];this[_0x6e70('0x1d')]=_0x1b0389[_0x6e70('0x8')][_0x6e70('0xa')]||'';this[_0x6e70('0x1e')]=moment()[_0x6e70('0x1f')](_0x6e70('0x20'));this['callback']=_0x1b0389[_0x6e70('0x21')];this[_0x6e70('0x22')]=_0x1b0389[_0x6e70('0x22')];this['callbackat']=_0x1b0389[_0x6e70('0x23')];this[_0x6e70('0x24')]=_0x1b0389[_0x6e70('0x24')];this['originatecalleridnum']='';this[_0x6e70('0x25')]='';}Action['prototype']['getCaller']=function(){return util['format'](_0x6e70('0x26'),this[_0x6e70('0x7')],this['voiceQueue'][_0x6e70('0x27')]>0x0?this[_0x6e70('0xc')]['substring'](this[_0x6e70('0x5')][_0x6e70('0x27')]):this[_0x6e70('0xc')]);};Action['prototype']['getQueue']=function(){return this[_0x6e70('0xd')];};module[_0x6e70('0x28')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 2264013..037b5b1 100644 --- a/server/services/ami/dialer/additionalPhone.js +++ b/server/services/ami/dialer/additionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15c4=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','starttime','responsetime','endtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x1db8b6,_0x2b356f){var _0x3782a1=function(_0x3e36eb){while(--_0x3e36eb){_0x1db8b6['push'](_0x1db8b6['shift']());}};_0x3782a1(++_0x2b356f);}(_0x15c4,0x16e));var _0x415c=function(_0x37b497,_0x449233){_0x37b497=_0x37b497-0x0;var _0x2001a7=_0x15c4[_0x37b497];return _0x2001a7;};'use strict';var util=require('util');var _=require(_0x415c('0x0'));var moment=require(_0x415c('0x1'));function getSeconds(_0x4d13eb,_0x30ccac){var _0x3d5388=moment(_0x4d13eb)[_0x415c('0x2')](0x0);var _0x122372=moment(_0x30ccac)[_0x415c('0x2')](0x0);return _0x3d5388['diff'](_0x122372,_0x415c('0x3'));}function AdditionalPhone(_0x39adf8){this['uniqueid']=_0x39adf8[_0x415c('0x4')];this['scheduledat']=_0x39adf8[_0x415c('0x5')]||undefined;this[_0x415c('0x6')]=_0x39adf8[_0x415c('0x6')];this[_0x415c('0x7')]=_0x39adf8[_0x415c('0x6')]===_0x415c('0x8')?_0x415c('0x9'):_0x39adf8[_0x415c('0x6')];this[_0x415c('0xa')]=_0x39adf8[_0x415c('0xa')];this[_0x415c('0xb')]=_0x39adf8[_0x415c('0xb')];this['countnoanswerretry']=_0x39adf8[_0x415c('0xc')];this[_0x415c('0xd')]=_0x39adf8[_0x415c('0xa')]+_0x39adf8[_0x415c('0xb')]+_0x39adf8[_0x415c('0xc')]+_0x39adf8['countnosuchnumberretry']+_0x39adf8[_0x415c('0xe')]+_0x39adf8[_0x415c('0xf')]+_0x39adf8[_0x415c('0x10')]+_0x39adf8[_0x415c('0x11')];this[_0x415c('0x12')]=_0x39adf8['countnosuchnumberretry'];this[_0x415c('0xe')]=_0x39adf8[_0x415c('0xe')];this[_0x415c('0xf')]=_0x39adf8[_0x415c('0xf')];this['countmachineretry']=_0x39adf8[_0x415c('0x10')];this[_0x415c('0x11')]=_0x39adf8[_0x415c('0x11')];this['queue']=_0x39adf8[_0x415c('0x9')];this[_0x415c('0x13')]=_0x39adf8[_0x415c('0x14')];this['calleridnum']=_0x39adf8['number'];this[_0x415c('0x15')]=_0x39adf8[_0x415c('0x15')];this[_0x415c('0x16')]=_0x39adf8[_0x415c('0x16')];this[_0x415c('0x17')]=_0x39adf8[_0x415c('0x16')];this['ringtime']=getSeconds(_0x39adf8[_0x415c('0x16')],_0x39adf8[_0x415c('0x15')]);this['holdtime']=0x0;this[_0x415c('0x18')]=0x0;this['callback']=_0x39adf8[_0x415c('0x19')];this[_0x415c('0x1a')]=_0x39adf8[_0x415c('0x1a')];this[_0x415c('0x1b')]=_0x39adf8['callbackat'];this['recallme']=_0x39adf8[_0x415c('0x1c')];this[_0x415c('0x1d')]=_0x39adf8['ContactId'];this[_0x415c('0x1e')]=_0x39adf8['ListId'];this[_0x415c('0x1f')]=_0x39adf8[_0x415c('0x1f')];this[_0x415c('0x20')]=_0x39adf8[_0x415c('0x20')];this[_0x415c('0x21')]=_0x39adf8[_0x415c('0x21')];this[_0x415c('0x22')]=_0x39adf8[_0x415c('0x22')]||'';this['originatecalleridname']=_0x39adf8[_0x415c('0x23')]||'';}module['exports']=History; \ No newline at end of file +var _0xe8c2=['countmachineretry','countagentrejectretry','countdropretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0xe8c2,0x160));var _0x2e8c=function(_0x414020,_0x13e8ff){_0x414020=_0x414020-0x0;var _0x3b8c7a=_0xe8c2[_0x414020];return _0x3b8c7a;};'use strict';var util=require(_0x2e8c('0x0'));var _=require(_0x2e8c('0x1'));var moment=require(_0x2e8c('0x2'));function getSeconds(_0x57090a,_0x3c8f4f){var _0x708f0b=moment(_0x57090a)[_0x2e8c('0x3')](0x0);var _0x19e8b5=moment(_0x3c8f4f)[_0x2e8c('0x3')](0x0);return _0x708f0b[_0x2e8c('0x4')](_0x19e8b5,_0x2e8c('0x5'));}function AdditionalPhone(_0x2d02d8){this[_0x2e8c('0x6')]=_0x2d02d8['uniqueid'];this[_0x2e8c('0x7')]=_0x2d02d8[_0x2e8c('0x7')]||undefined;this['type']=_0x2d02d8[_0x2e8c('0x8')];this[_0x2e8c('0x9')]=_0x2d02d8[_0x2e8c('0x8')]===_0x2e8c('0xa')?_0x2e8c('0xb'):_0x2d02d8['type'];this[_0x2e8c('0xc')]=_0x2d02d8[_0x2e8c('0xc')];this[_0x2e8c('0xd')]=_0x2d02d8['countcongestionretry'];this['countnoanswerretry']=_0x2d02d8[_0x2e8c('0xe')];this['countglobal']=_0x2d02d8[_0x2e8c('0xc')]+_0x2d02d8[_0x2e8c('0xd')]+_0x2d02d8[_0x2e8c('0xe')]+_0x2d02d8[_0x2e8c('0xf')]+_0x2d02d8['countdropretry']+_0x2d02d8[_0x2e8c('0x10')]+_0x2d02d8[_0x2e8c('0x11')]+_0x2d02d8[_0x2e8c('0x12')];this[_0x2e8c('0xf')]=_0x2d02d8['countnosuchnumberretry'];this[_0x2e8c('0x13')]=_0x2d02d8[_0x2e8c('0x13')];this[_0x2e8c('0x10')]=_0x2d02d8[_0x2e8c('0x10')];this['countmachineretry']=_0x2d02d8[_0x2e8c('0x11')];this[_0x2e8c('0x12')]=_0x2d02d8[_0x2e8c('0x12')];this[_0x2e8c('0xb')]=_0x2d02d8[_0x2e8c('0xb')];this[_0x2e8c('0x14')]=_0x2d02d8[_0x2e8c('0x15')];this[_0x2e8c('0x16')]=_0x2d02d8[_0x2e8c('0x17')];this[_0x2e8c('0x18')]=_0x2d02d8[_0x2e8c('0x18')];this[_0x2e8c('0x19')]=_0x2d02d8[_0x2e8c('0x19')];this[_0x2e8c('0x1a')]=_0x2d02d8[_0x2e8c('0x19')];this[_0x2e8c('0x1b')]=getSeconds(_0x2d02d8['responsetime'],_0x2d02d8['starttime']);this[_0x2e8c('0x1c')]=0x0;this['talktime']=0x0;this[_0x2e8c('0x1d')]=_0x2d02d8[_0x2e8c('0x1d')];this[_0x2e8c('0x1e')]=_0x2d02d8[_0x2e8c('0x1e')];this[_0x2e8c('0x1f')]=_0x2d02d8['callbackat'];this[_0x2e8c('0x20')]=_0x2d02d8[_0x2e8c('0x20')];this['ContactId']=_0x2d02d8[_0x2e8c('0x21')];this[_0x2e8c('0x22')]=_0x2d02d8[_0x2e8c('0x22')];this[_0x2e8c('0x23')]=_0x2d02d8[_0x2e8c('0x23')];this[_0x2e8c('0x24')]=_0x2d02d8[_0x2e8c('0x24')];this[_0x2e8c('0x25')]=_0x2d02d8[_0x2e8c('0x25')];this[_0x2e8c('0x26')]=_0x2d02d8[_0x2e8c('0x26')]||'';this['originatecalleridname']=_0x2d02d8[_0x2e8c('0x27')]||'';}module[_0x2e8c('0x28')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index dc37ace..69b780a 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 _0x3c41=['type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat'];(function(_0x5adf4d,_0xdfd7ef){var _0x17b2db=function(_0x5a9a2f){while(--_0x5a9a2f){_0x5adf4d['push'](_0x5adf4d['shift']());}};_0x17b2db(++_0xdfd7ef);}(_0x3c41,0x18b));var _0x13c4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3c41[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x13c4('0x0'));var _=require(_0x13c4('0x1'));var moment=require(_0x13c4('0x2'));function getSeconds(_0x310ccf,_0x4e7228){var _0x28dbbf=moment(_0x310ccf)[_0x13c4('0x3')](0x0);var _0x46aa32=moment(_0x4e7228)[_0x13c4('0x3')](0x0);return _0x28dbbf[_0x13c4('0x4')](_0x46aa32,_0x13c4('0x5'));}function AgentComplete(_0x29ce38,_0x50f10a){this[_0x13c4('0x6')]=0x4;this[_0x13c4('0x7')]=_0x13c4('0x8');this['scheduledat']=_0x29ce38[_0x13c4('0x9')];this['type']=_0x29ce38[_0x13c4('0xa')];this[_0x13c4('0xb')]=_0x29ce38['type']===_0x13c4('0xc')?'queue':_0x29ce38[_0x13c4('0xa')];this[_0x13c4('0xd')]=_0x29ce38['countbusyretry'];this[_0x13c4('0xe')]=_0x29ce38[_0x13c4('0xe')];this['countnoanswerretry']=_0x29ce38[_0x13c4('0xf')];this['countglobal']=_0x29ce38[_0x13c4('0xd')]+_0x29ce38[_0x13c4('0xe')]+_0x29ce38['countnoanswerretry']+_0x29ce38[_0x13c4('0x10')]+_0x29ce38[_0x13c4('0x11')]+_0x29ce38[_0x13c4('0x12')]+_0x29ce38['countmachineretry']+_0x29ce38[_0x13c4('0x13')];this[_0x13c4('0x10')]=_0x29ce38[_0x13c4('0x10')];this[_0x13c4('0x11')]=_0x29ce38[_0x13c4('0x11')];this[_0x13c4('0x12')]=_0x29ce38[_0x13c4('0x12')];this[_0x13c4('0x14')]=_0x29ce38[_0x13c4('0x14')];this[_0x13c4('0x13')]=_0x29ce38[_0x13c4('0x13')];this[_0x13c4('0x15')]=_0x50f10a[_0x13c4('0x15')];this[_0x13c4('0x16')]=_0x29ce38[_0x13c4('0x17')];this[_0x13c4('0x18')]=_0x29ce38['number'];this[_0x13c4('0x19')]=_0x29ce38['starttime'];this[_0x13c4('0x1a')]=_0x29ce38[_0x13c4('0x1a')];this[_0x13c4('0x1b')]=_0x29ce38[_0x13c4('0x1b')];this[_0x13c4('0x1c')]=moment()[_0x13c4('0x1d')](_0x13c4('0x1e'));this['ringtime']=getSeconds(_0x29ce38[_0x13c4('0x1a')],_0x29ce38[_0x13c4('0x19')]);this[_0x13c4('0x1f')]=getSeconds(_0x29ce38[_0x13c4('0x1b')],_0x29ce38[_0x13c4('0x1a')]);this[_0x13c4('0x20')]=getSeconds(this['endtime'],_0x29ce38[_0x13c4('0x1b')]);this['queue']=_0x50f10a['queue'];this[_0x13c4('0x21')]=_0x50f10a['membername'];this[_0x13c4('0x22')]=_0x50f10a[_0x13c4('0x22')];this['callback']=_0x29ce38['callback'];this[_0x13c4('0x23')]=_0x29ce38[_0x13c4('0x23')];this[_0x13c4('0x24')]=_0x29ce38[_0x13c4('0x24')];this['recallme']=_0x29ce38[_0x13c4('0x25')];this[_0x13c4('0x26')]=_0x29ce38[_0x13c4('0x26')];this['ListId']=_0x29ce38[_0x13c4('0x27')];this[_0x13c4('0x28')]=_0x29ce38['UserId'];this[_0x13c4('0x29')]=_0x29ce38['VoiceQueueId'];this['CampaignId']=_0x29ce38['CampaignId'];this[_0x13c4('0x2a')]=_0x29ce38[_0x13c4('0x2a')]||'';this[_0x13c4('0x2b')]=_0x29ce38[_0x13c4('0x2b')]||'';}module[_0x13c4('0x2c')]=AgentComplete; \ No newline at end of file +var _0x9881=['starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','number'];(function(_0x401ed4,_0x77cf76){var _0x302d70=function(_0x2aa77e){while(--_0x2aa77e){_0x401ed4['push'](_0x401ed4['shift']());}};_0x302d70(++_0x77cf76);}(_0x9881,0x1b2));var _0x1988=function(_0x305693,_0x463bac){_0x305693=_0x305693-0x0;var _0x1f53dd=_0x9881[_0x305693];return _0x1f53dd;};'use strict';var util=require(_0x1988('0x0'));var _=require(_0x1988('0x1'));var moment=require(_0x1988('0x2'));function getSeconds(_0x3151e1,_0x25c8d9){var _0x24c901=moment(_0x3151e1)[_0x1988('0x3')](0x0);var _0x3ebc5c=moment(_0x25c8d9)[_0x1988('0x3')](0x0);return _0x24c901[_0x1988('0x4')](_0x3ebc5c,'seconds');}function AgentComplete(_0x330c48,_0x1bb152){this['state']=0x4;this[_0x1988('0x5')]=_0x1988('0x6');this['scheduledat']=_0x330c48[_0x1988('0x7')];this[_0x1988('0x8')]=_0x330c48['type'];this[_0x1988('0x9')]=_0x330c48[_0x1988('0x8')]===_0x1988('0xa')?_0x1988('0xb'):_0x330c48['type'];this[_0x1988('0xc')]=_0x330c48[_0x1988('0xc')];this[_0x1988('0xd')]=_0x330c48[_0x1988('0xd')];this[_0x1988('0xe')]=_0x330c48[_0x1988('0xe')];this[_0x1988('0xf')]=_0x330c48[_0x1988('0xc')]+_0x330c48['countcongestionretry']+_0x330c48[_0x1988('0xe')]+_0x330c48[_0x1988('0x10')]+_0x330c48['countdropretry']+_0x330c48[_0x1988('0x11')]+_0x330c48[_0x1988('0x12')]+_0x330c48[_0x1988('0x13')];this[_0x1988('0x10')]=_0x330c48[_0x1988('0x10')];this['countdropretry']=_0x330c48[_0x1988('0x14')];this['countabandonedretry']=_0x330c48[_0x1988('0x11')];this[_0x1988('0x12')]=_0x330c48['countmachineretry'];this[_0x1988('0x13')]=_0x330c48[_0x1988('0x13')];this[_0x1988('0x15')]=_0x1bb152[_0x1988('0x15')];this[_0x1988('0x16')]=_0x330c48[_0x1988('0x17')];this[_0x1988('0x18')]=_0x330c48[_0x1988('0x19')];this['starttime']=_0x330c48[_0x1988('0x1a')];this[_0x1988('0x1b')]=_0x330c48[_0x1988('0x1b')];this[_0x1988('0x1c')]=_0x330c48[_0x1988('0x1c')];this[_0x1988('0x1d')]=moment()[_0x1988('0x1e')](_0x1988('0x1f'));this[_0x1988('0x20')]=getSeconds(_0x330c48[_0x1988('0x1b')],_0x330c48[_0x1988('0x1a')]);this[_0x1988('0x21')]=getSeconds(_0x330c48[_0x1988('0x1c')],_0x330c48[_0x1988('0x1b')]);this['talktime']=getSeconds(this[_0x1988('0x1d')],_0x330c48['answertime']);this[_0x1988('0xb')]=_0x1bb152['queue'];this['membername']=_0x1bb152['membername'];this['reason']=_0x1bb152[_0x1988('0x22')];this[_0x1988('0x23')]=_0x330c48[_0x1988('0x23')];this[_0x1988('0x24')]=_0x330c48[_0x1988('0x24')];this[_0x1988('0x25')]=_0x330c48[_0x1988('0x25')];this[_0x1988('0x26')]=_0x330c48[_0x1988('0x26')];this[_0x1988('0x27')]=_0x330c48[_0x1988('0x27')];this[_0x1988('0x28')]=_0x330c48['ListId'];this[_0x1988('0x29')]=_0x330c48['UserId'];this[_0x1988('0x2a')]=_0x330c48['VoiceQueueId'];this['CampaignId']=_0x330c48[_0x1988('0x2b')];this[_0x1988('0x2c')]=_0x330c48[_0x1988('0x2c')]||'';this['originatecalleridname']=_0x330c48[_0x1988('0x2d')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 0d44b04..90ef844 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 _0xe0f1=['countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry'];(function(_0x5be7aa,_0x5de661){var _0x215408=function(_0x353715){while(--_0x353715){_0x5be7aa['push'](_0x5be7aa['shift']());}};_0x215408(++_0x5de661);}(_0xe0f1,0x190));var _0x1e0f=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xe0f1[_0x13d07a];return _0x5ee0ee;};'use strict';var util=require(_0x1e0f('0x0'));var _=require(_0x1e0f('0x1'));var moment=require(_0x1e0f('0x2'));function getSeconds(_0x66ec15,_0xeace89){var _0x490dbb=moment(_0x66ec15)[_0x1e0f('0x3')](0x0);var _0x52d477=moment(_0xeace89)[_0x1e0f('0x3')](0x0);return _0x490dbb[_0x1e0f('0x4')](_0x52d477,'seconds');}function Final(_0x3d1e85){this[_0x1e0f('0x5')]=_0x3d1e85[_0x1e0f('0x5')];this[_0x1e0f('0x6')]=_0x3d1e85[_0x1e0f('0x6')];this[_0x1e0f('0x7')]=_0x3d1e85[_0x1e0f('0x7')];this[_0x1e0f('0x8')]=_0x3d1e85[_0x1e0f('0x7')]===_0x1e0f('0x9')?_0x1e0f('0xa'):_0x3d1e85[_0x1e0f('0x7')];this[_0x1e0f('0xb')]=_0x3d1e85['countbusyretry'];this[_0x1e0f('0xc')]=_0x3d1e85[_0x1e0f('0xc')];this['countnoanswerretry']=_0x3d1e85['countnoanswerretry'];this[_0x1e0f('0xd')]=_0x3d1e85[_0x1e0f('0xb')]+_0x3d1e85[_0x1e0f('0xc')]+_0x3d1e85['countnoanswerretry']+_0x3d1e85[_0x1e0f('0xe')]+_0x3d1e85[_0x1e0f('0xf')]+_0x3d1e85[_0x1e0f('0x10')]+_0x3d1e85['countmachineretry']+_0x3d1e85[_0x1e0f('0x11')];this[_0x1e0f('0xe')]=_0x3d1e85[_0x1e0f('0xe')];this[_0x1e0f('0xf')]=_0x3d1e85[_0x1e0f('0xf')];this[_0x1e0f('0x10')]=_0x3d1e85[_0x1e0f('0x10')];this[_0x1e0f('0x12')]=_0x3d1e85['countmachineretry'];this[_0x1e0f('0x11')]=_0x3d1e85[_0x1e0f('0x11')];this['queue']=_0x3d1e85[_0x1e0f('0xa')];this['calleridname']=_0x3d1e85[_0x1e0f('0x13')];this[_0x1e0f('0x14')]=_0x3d1e85[_0x1e0f('0x14')];this[_0x1e0f('0x15')]=_0x3d1e85['starttime'];this[_0x1e0f('0x16')]=_0x3d1e85[_0x1e0f('0x16')];this[_0x1e0f('0x17')]=_0x3d1e85[_0x1e0f('0x16')];this['ringtime']=_0x3d1e85[_0x1e0f('0x18')]||0x0;this['holdtime']=_0x3d1e85[_0x1e0f('0x19')]||0x0;this[_0x1e0f('0x1a')]=_0x3d1e85[_0x1e0f('0x1a')]||0x0;this[_0x1e0f('0x1b')]=_0x3d1e85['callback'];this['callbackuniqueid']=_0x3d1e85[_0x1e0f('0x1c')];this[_0x1e0f('0x1d')]=_0x3d1e85[_0x1e0f('0x1d')];this[_0x1e0f('0x1e')]=_0x3d1e85['recallme'];this[_0x1e0f('0x1f')]=_0x3d1e85[_0x1e0f('0x1f')];this[_0x1e0f('0x20')]=_0x3d1e85[_0x1e0f('0x20')];this[_0x1e0f('0x21')]=_0x3d1e85[_0x1e0f('0x21')];this['VoiceQueueId']=_0x3d1e85[_0x1e0f('0x22')];this[_0x1e0f('0x23')]=_0x3d1e85[_0x1e0f('0x23')];this[_0x1e0f('0x24')]=_0x3d1e85[_0x1e0f('0x24')]||'';this[_0x1e0f('0x25')]=_0x3d1e85['originatecalleridname']||'';}module['exports']=Final; \ No newline at end of file +var _0x45f1=['originatecalleridname','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x45f1,0xbf));var _0x145f=function(_0x2d0bba,_0xfd1a86){_0x2d0bba=_0x2d0bba-0x0;var _0x5d7f1a=_0x45f1[_0x2d0bba];return _0x5d7f1a;};'use strict';var util=require('util');var _=require(_0x145f('0x0'));var moment=require(_0x145f('0x1'));function getSeconds(_0x138869,_0xb612f9){var _0x5e51ce=moment(_0x138869)[_0x145f('0x2')](0x0);var _0x2e23a2=moment(_0xb612f9)[_0x145f('0x2')](0x0);return _0x5e51ce['diff'](_0x2e23a2,_0x145f('0x3'));}function Final(_0x3ab198){this[_0x145f('0x4')]=_0x3ab198['uniqueid'];this[_0x145f('0x5')]=_0x3ab198[_0x145f('0x5')];this[_0x145f('0x6')]=_0x3ab198[_0x145f('0x6')];this[_0x145f('0x7')]=_0x3ab198['type']===_0x145f('0x8')?_0x145f('0x9'):_0x3ab198[_0x145f('0x6')];this['countbusyretry']=_0x3ab198[_0x145f('0xa')];this[_0x145f('0xb')]=_0x3ab198[_0x145f('0xb')];this[_0x145f('0xc')]=_0x3ab198['countnoanswerretry'];this[_0x145f('0xd')]=_0x3ab198['countbusyretry']+_0x3ab198['countcongestionretry']+_0x3ab198['countnoanswerretry']+_0x3ab198[_0x145f('0xe')]+_0x3ab198[_0x145f('0xf')]+_0x3ab198[_0x145f('0x10')]+_0x3ab198[_0x145f('0x11')]+_0x3ab198['countagentrejectretry'];this[_0x145f('0xe')]=_0x3ab198[_0x145f('0xe')];this['countdropretry']=_0x3ab198[_0x145f('0xf')];this['countabandonedretry']=_0x3ab198['countabandonedretry'];this[_0x145f('0x11')]=_0x3ab198[_0x145f('0x11')];this[_0x145f('0x12')]=_0x3ab198[_0x145f('0x12')];this[_0x145f('0x9')]=_0x3ab198[_0x145f('0x9')];this['calleridname']=_0x3ab198[_0x145f('0x13')];this[_0x145f('0x14')]=_0x3ab198['calleridnum'];this[_0x145f('0x15')]=_0x3ab198[_0x145f('0x15')];this[_0x145f('0x16')]=_0x3ab198[_0x145f('0x16')];this[_0x145f('0x17')]=_0x3ab198[_0x145f('0x16')];this[_0x145f('0x18')]=_0x3ab198[_0x145f('0x18')]||0x0;this[_0x145f('0x19')]=_0x3ab198['holdtime']||0x0;this[_0x145f('0x1a')]=_0x3ab198[_0x145f('0x1a')]||0x0;this[_0x145f('0x1b')]=_0x3ab198[_0x145f('0x1b')];this[_0x145f('0x1c')]=_0x3ab198['callbackuniqueid'];this[_0x145f('0x1d')]=_0x3ab198[_0x145f('0x1d')];this[_0x145f('0x1e')]=_0x3ab198[_0x145f('0x1e')];this[_0x145f('0x1f')]=_0x3ab198['ContactId'];this[_0x145f('0x20')]=_0x3ab198['ListId'];this[_0x145f('0x21')]=_0x3ab198[_0x145f('0x21')];this[_0x145f('0x22')]=_0x3ab198['VoiceQueueId'];this[_0x145f('0x23')]=_0x3ab198[_0x145f('0x23')];this[_0x145f('0x24')]=_0x3ab198[_0x145f('0x24')]||'';this['originatecalleridname']=_0x3ab198[_0x145f('0x25')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 03515c3..b0ccd68 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 _0x7927=['callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','IVR','reason','cause-txt'];(function(_0x53aed5,_0x4e7e3a){var _0x3fcc1a=function(_0x4036da){while(--_0x4036da){_0x53aed5['push'](_0x53aed5['shift']());}};_0x3fcc1a(++_0x4e7e3a);}(_0x7927,0xbd));var _0x7792=function(_0x3b95cd,_0x413ace){_0x3b95cd=_0x3b95cd-0x0;var _0x407eb3=_0x7927[_0x3b95cd];return _0x407eb3;};'use strict';var util=require(_0x7792('0x0'));var _=require(_0x7792('0x1'));var moment=require(_0x7792('0x2'));function getSeconds(_0x1c89a0,_0x47dd0c){var _0x5394fb=moment(_0x1c89a0)[_0x7792('0x3')](0x0);var _0x113ac6=moment(_0x47dd0c)[_0x7792('0x3')](0x0);return _0x5394fb[_0x7792('0x4')](_0x113ac6,'seconds');}function Hangup(_0x1d515f,_0x198444){this[_0x7792('0x5')]=0x4;this[_0x7792('0x6')]=_0x7792('0x7');this[_0x7792('0x8')]=_0x1d515f[_0x7792('0x8')];this[_0x7792('0x9')]=_0x1d515f[_0x7792('0x9')];this[_0x7792('0xa')]=_0x1d515f['type']===_0x7792('0xb')?_0x7792('0xc'):_0x1d515f[_0x7792('0x9')];this[_0x7792('0xd')]=_0x1d515f[_0x7792('0xd')];this['countcongestionretry']=_0x1d515f['countcongestionretry'];this[_0x7792('0xe')]=_0x1d515f['countnoanswerretry'];this['countglobal']=_0x1d515f[_0x7792('0xd')]+_0x1d515f['countcongestionretry']+_0x1d515f[_0x7792('0xe')]+_0x1d515f[_0x7792('0xf')]+_0x1d515f[_0x7792('0x10')]+_0x1d515f[_0x7792('0x11')]+_0x1d515f['countmachineretry']+_0x1d515f[_0x7792('0x12')];this['countnosuchnumberretry']=_0x1d515f[_0x7792('0xf')];this[_0x7792('0x10')]=_0x1d515f[_0x7792('0x10')];this['countabandonedretry']=_0x1d515f[_0x7792('0x11')];this[_0x7792('0x13')]=_0x1d515f[_0x7792('0x13')];this[_0x7792('0x12')]=_0x1d515f[_0x7792('0x12')];this[_0x7792('0x14')]=_0x198444[_0x7792('0x14')];this[_0x7792('0x15')]=_0x1d515f[_0x7792('0x16')];this[_0x7792('0x17')]=_0x1d515f[_0x7792('0x18')];this[_0x7792('0x19')]=_0x1d515f[_0x7792('0x19')];this[_0x7792('0x1a')]=_0x1d515f[_0x7792('0x1a')];this[_0x7792('0x1b')]=moment()[_0x7792('0x1c')](_0x7792('0x1d'));this[_0x7792('0x1e')]=getSeconds(_0x1d515f[_0x7792('0x1a')],_0x1d515f[_0x7792('0x19')]);this[_0x7792('0x1f')]=0x0;this[_0x7792('0x20')]=getSeconds(this[_0x7792('0x1b')],_0x1d515f[_0x7792('0x1a')]);this[_0x7792('0xc')]=_0x1d515f[_0x7792('0xc')];this['membername']=_0x7792('0x21');this[_0x7792('0x22')]=_0x198444[_0x7792('0x23')];this[_0x7792('0x24')]=_0x1d515f[_0x7792('0x24')];this[_0x7792('0x25')]=_0x1d515f['callbackuniqueid'];this[_0x7792('0x26')]=_0x1d515f[_0x7792('0x26')];this['recallme']=_0x1d515f[_0x7792('0x27')];this[_0x7792('0x28')]=_0x1d515f[_0x7792('0x28')];this['ListId']=_0x1d515f['ListId'];this['UserId']=_0x1d515f[_0x7792('0x29')];this[_0x7792('0x2a')]=_0x1d515f[_0x7792('0x2a')];this[_0x7792('0x2b')]=_0x1d515f[_0x7792('0x2b')];}module[_0x7792('0x2c')]=Hangup; \ No newline at end of file +var _0x6861=['responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','starttime'];(function(_0x54fdcb,_0x3b2045){var _0x5f1208=function(_0x1670b3){while(--_0x1670b3){_0x54fdcb['push'](_0x54fdcb['shift']());}};_0x5f1208(++_0x3b2045);}(_0x6861,0x18c));var _0x1686=function(_0x481d04,_0x499794){_0x481d04=_0x481d04-0x0;var _0xa35960=_0x6861[_0x481d04];return _0xa35960;};'use strict';var util=require(_0x1686('0x0'));var _=require(_0x1686('0x1'));var moment=require(_0x1686('0x2'));function getSeconds(_0x4a6b5c,_0x2f9670){var _0x3f8f3a=moment(_0x4a6b5c)[_0x1686('0x3')](0x0);var _0x431cc8=moment(_0x2f9670)[_0x1686('0x3')](0x0);return _0x3f8f3a[_0x1686('0x4')](_0x431cc8,_0x1686('0x5'));}function Hangup(_0x3eb24c,_0x245bb4){this[_0x1686('0x6')]=0x4;this[_0x1686('0x7')]=_0x1686('0x8');this[_0x1686('0x9')]=_0x3eb24c[_0x1686('0x9')];this[_0x1686('0xa')]=_0x3eb24c[_0x1686('0xa')];this['campaigntype']=_0x3eb24c['type']==='outbound'?'queue':_0x3eb24c['type'];this[_0x1686('0xb')]=_0x3eb24c[_0x1686('0xb')];this[_0x1686('0xc')]=_0x3eb24c['countcongestionretry'];this[_0x1686('0xd')]=_0x3eb24c[_0x1686('0xd')];this[_0x1686('0xe')]=_0x3eb24c[_0x1686('0xb')]+_0x3eb24c[_0x1686('0xc')]+_0x3eb24c[_0x1686('0xd')]+_0x3eb24c[_0x1686('0xf')]+_0x3eb24c[_0x1686('0x10')]+_0x3eb24c[_0x1686('0x11')]+_0x3eb24c['countmachineretry']+_0x3eb24c[_0x1686('0x12')];this[_0x1686('0xf')]=_0x3eb24c[_0x1686('0xf')];this['countdropretry']=_0x3eb24c[_0x1686('0x10')];this[_0x1686('0x11')]=_0x3eb24c[_0x1686('0x11')];this['countmachineretry']=_0x3eb24c[_0x1686('0x13')];this[_0x1686('0x12')]=_0x3eb24c[_0x1686('0x12')];this[_0x1686('0x14')]=_0x245bb4[_0x1686('0x14')];this[_0x1686('0x15')]=_0x3eb24c[_0x1686('0x16')];this['calleridnum']=_0x3eb24c['number'];this['starttime']=_0x3eb24c[_0x1686('0x17')];this[_0x1686('0x18')]=_0x3eb24c[_0x1686('0x18')];this[_0x1686('0x19')]=moment()['format'](_0x1686('0x1a'));this[_0x1686('0x1b')]=getSeconds(_0x3eb24c[_0x1686('0x18')],_0x3eb24c[_0x1686('0x17')]);this[_0x1686('0x1c')]=0x0;this[_0x1686('0x1d')]=getSeconds(this['endtime'],_0x3eb24c[_0x1686('0x18')]);this[_0x1686('0x1e')]=_0x3eb24c['queue'];this['membername']=_0x1686('0x1f');this['reason']=_0x245bb4[_0x1686('0x20')];this[_0x1686('0x21')]=_0x3eb24c['callback'];this[_0x1686('0x22')]=_0x3eb24c['callbackuniqueid'];this[_0x1686('0x23')]=_0x3eb24c[_0x1686('0x23')];this[_0x1686('0x24')]=_0x3eb24c['recallme'];this[_0x1686('0x25')]=_0x3eb24c[_0x1686('0x25')];this[_0x1686('0x26')]=_0x3eb24c[_0x1686('0x26')];this['UserId']=_0x3eb24c['UserId'];this['VoiceQueueId']=_0x3eb24c[_0x1686('0x27')];this[_0x1686('0x28')]=_0x3eb24c[_0x1686('0x28')];}module[_0x1686('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 9ae8364..28c5a79 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 _0xadae=['holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','endtime','ringtime'];(function(_0x82b2d6,_0x12b83e){var _0x47df09=function(_0x3520f1){while(--_0x3520f1){_0x82b2d6['push'](_0x82b2d6['shift']());}};_0x47df09(++_0x12b83e);}(_0xadae,0x134));var _0xeada=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xadae[_0x6c993a];return _0x27f547;};'use strict';var util=require(_0xeada('0x0'));var _=require(_0xeada('0x1'));var moment=require(_0xeada('0x2'));function getSeconds(_0x5eda3a,_0x4f062f){var _0x5a3a55=moment(_0x5eda3a)['milliseconds'](0x0);var _0x52e990=moment(_0x4f062f)['milliseconds'](0x0);return _0x5a3a55[_0xeada('0x3')](_0x52e990,'seconds');}function History(_0xfdc318){this[_0xeada('0x4')]=_0xfdc318['uniqueid'];this['scheduledat']=_0xfdc318[_0xeada('0x5')]||undefined;this[_0xeada('0x6')]=_0xfdc318[_0xeada('0x6')];this[_0xeada('0x7')]=_0xfdc318[_0xeada('0x6')]===_0xeada('0x8')?_0xeada('0x9'):_0xfdc318[_0xeada('0x6')];this[_0xeada('0xa')]=_0xfdc318[_0xeada('0xa')];this[_0xeada('0xb')]=_0xfdc318[_0xeada('0xb')];this[_0xeada('0xc')]=_0xfdc318['countnoanswerretry'];this['countglobal']=_0xfdc318[_0xeada('0xa')]+_0xfdc318[_0xeada('0xb')]+_0xfdc318[_0xeada('0xc')]+_0xfdc318[_0xeada('0xd')]+_0xfdc318[_0xeada('0xe')]+_0xfdc318['countabandonedretry']+_0xfdc318[_0xeada('0xf')]+_0xfdc318[_0xeada('0x10')];this[_0xeada('0xd')]=_0xfdc318[_0xeada('0xd')];this[_0xeada('0xe')]=_0xfdc318['countdropretry'];this[_0xeada('0x11')]=_0xfdc318['countabandonedretry'];this['countmachineretry']=_0xfdc318['countmachineretry'];this['countagentrejectretry']=_0xfdc318[_0xeada('0x10')];this[_0xeada('0x9')]=_0xfdc318[_0xeada('0x9')];this[_0xeada('0x12')]=_0xfdc318[_0xeada('0x13')];this[_0xeada('0x14')]=_0xfdc318[_0xeada('0x15')];this[_0xeada('0x16')]=_0xfdc318['starttime'];this['responsetime']=_0xfdc318['responsetime'];this[_0xeada('0x17')]=_0xfdc318['responsetime'];this[_0xeada('0x18')]=getSeconds(_0xfdc318['responsetime'],_0xfdc318[_0xeada('0x16')]);this[_0xeada('0x19')]=0x0;this[_0xeada('0x1a')]=0x0;this[_0xeada('0x1b')]=_0xfdc318[_0xeada('0x1b')];this[_0xeada('0x1c')]=_0xfdc318['callbackuniqueid'];this[_0xeada('0x1d')]=_0xfdc318[_0xeada('0x1d')];this['recallme']=_0xfdc318['recallme'];this[_0xeada('0x1e')]=_0xfdc318['ContactId'];this['ListId']=_0xfdc318[_0xeada('0x1f')];this[_0xeada('0x20')]=_0xfdc318[_0xeada('0x20')];this[_0xeada('0x21')]=_0xfdc318['VoiceQueueId'];this[_0xeada('0x22')]=_0xfdc318[_0xeada('0x22')];this[_0xeada('0x23')]=_0xfdc318[_0xeada('0x23')]||'';this[_0xeada('0x24')]=_0xfdc318[_0xeada('0x24')]||'';}module['exports']=History; \ No newline at end of file +var _0x654e=['name','calleridnum','number','responsetime','ringtime','starttime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname'];(function(_0x4c1ad8,_0x55e28d){var _0x2c617b=function(_0x5f80df){while(--_0x5f80df){_0x4c1ad8['push'](_0x4c1ad8['shift']());}};_0x2c617b(++_0x55e28d);}(_0x654e,0x1e8));var _0xe654=function(_0x133968,_0x5ca58b){_0x133968=_0x133968-0x0;var _0x14a75a=_0x654e[_0x133968];return _0x14a75a;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xe654('0x0'));function getSeconds(_0x5cfb70,_0xa910e4){var _0x28f7be=moment(_0x5cfb70)[_0xe654('0x1')](0x0);var _0x52e6f9=moment(_0xa910e4)[_0xe654('0x1')](0x0);return _0x28f7be['diff'](_0x52e6f9,_0xe654('0x2'));}function History(_0x2c218d){this[_0xe654('0x3')]=_0x2c218d[_0xe654('0x3')];this[_0xe654('0x4')]=_0x2c218d[_0xe654('0x4')]||undefined;this[_0xe654('0x5')]=_0x2c218d[_0xe654('0x5')];this[_0xe654('0x6')]=_0x2c218d[_0xe654('0x5')]===_0xe654('0x7')?_0xe654('0x8'):_0x2c218d['type'];this[_0xe654('0x9')]=_0x2c218d[_0xe654('0x9')];this['countcongestionretry']=_0x2c218d[_0xe654('0xa')];this[_0xe654('0xb')]=_0x2c218d[_0xe654('0xb')];this[_0xe654('0xc')]=_0x2c218d['countbusyretry']+_0x2c218d[_0xe654('0xa')]+_0x2c218d[_0xe654('0xb')]+_0x2c218d['countnosuchnumberretry']+_0x2c218d[_0xe654('0xd')]+_0x2c218d[_0xe654('0xe')]+_0x2c218d[_0xe654('0xf')]+_0x2c218d[_0xe654('0x10')];this[_0xe654('0x11')]=_0x2c218d['countnosuchnumberretry'];this[_0xe654('0xd')]=_0x2c218d['countdropretry'];this[_0xe654('0xe')]=_0x2c218d[_0xe654('0xe')];this[_0xe654('0xf')]=_0x2c218d[_0xe654('0xf')];this[_0xe654('0x10')]=_0x2c218d['countagentrejectretry'];this[_0xe654('0x8')]=_0x2c218d['queue'];this[_0xe654('0x12')]=_0x2c218d[_0xe654('0x13')];this[_0xe654('0x14')]=_0x2c218d[_0xe654('0x15')];this['starttime']=_0x2c218d['starttime'];this[_0xe654('0x16')]=_0x2c218d[_0xe654('0x16')];this['endtime']=_0x2c218d['responsetime'];this[_0xe654('0x17')]=getSeconds(_0x2c218d[_0xe654('0x16')],_0x2c218d[_0xe654('0x18')]);this[_0xe654('0x19')]=0x0;this[_0xe654('0x1a')]=0x0;this[_0xe654('0x1b')]=_0x2c218d[_0xe654('0x1b')];this[_0xe654('0x1c')]=_0x2c218d['callbackuniqueid'];this[_0xe654('0x1d')]=_0x2c218d[_0xe654('0x1d')];this[_0xe654('0x1e')]=_0x2c218d[_0xe654('0x1e')];this[_0xe654('0x1f')]=_0x2c218d[_0xe654('0x1f')];this[_0xe654('0x20')]=_0x2c218d['ListId'];this[_0xe654('0x21')]=_0x2c218d[_0xe654('0x21')];this[_0xe654('0x22')]=_0x2c218d[_0xe654('0x22')];this[_0xe654('0x23')]=_0x2c218d['CampaignId'];this[_0xe654('0x24')]=_0x2c218d['originatecalleridnum']||'';this[_0xe654('0x25')]=_0x2c218d[_0xe654('0x25')]||'';}module[_0xe654('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 241072a..618a06c 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 _0xc326=['statedesc','HangupInAMD','AMD','[syncHangupInAMD][createHistory]','MACHINE','outboundAnswerAgiCallsDay','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','membername','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','amd','countnosuchnumberretry','dialGlobalMaxRetry','createStateFinal','dialMachineRetryFrequency','[syncHangupIvr][createHistory]','dialQueueProject','AGI','[syncHangupIvr]','cause-txt','reason','agent','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','dropreason','TIMEOUT','agiafterat','dialDropMaxRetry','[rescheduleContact][Drop]','Drop','endtime','calleridname','calleridnum','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','command','iftime\x20%s,%s','interval','timezones','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','checkDialMethod','handlePower','power','dialPowerLevel','booked','method\x20not\x20recognized','dialActive','dialGlobalInterval','dialTimezone','syncCampaigns','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','substring','dialCutDigit','trim','xcally-motion-dialer','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','finally','originate\x20action\x20Error','getQueue','callProgressDetecting','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','emit','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','busyFactor','check\x20failure','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','Queue:\x20','scheduledat','Agent','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','not_inuse','reachable','dialOrderByScheduledAt','ACTIVE','Contact.phone','[getContactDialer2]','dialLimitQueue','tryOriginatePredictive','--------\x20Drop\x20Rate\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','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','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\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]','m\x20=\x20','Umin\x20=\x20','util','lodash','bluebird','moment','md5','ioredis','../preview/util/util','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./final','./queueCallerAbandon','rrmemory','roundrobin','tail','sequence','preview','voiceQueues','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','bind','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncHangup','syncNewExten','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','isEmpty','Intervals','[ifTime][Action]','Error','stringify','seconds','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','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','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Hold\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','erlangCalls','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','merge','milliseconds','diff','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','error','inspect','stack','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','starttime','prototype','clearZombieChannels','[actions]','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','campaigns','queue','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','SIP/%s','unmonitored','saveInDb','syncVarSet','uniqueid','variable','exten','dialAMDActive','value','HANGUP'];(function(_0x1a406a,_0xe1c38b){var _0x5b229a=function(_0x261b7d){while(--_0x261b7d){_0x1a406a['push'](_0x1a406a['shift']());}};_0x5b229a(++_0xe1c38b);}(_0xc326,0x138));var _0x6c32=function(_0x3ff008,_0x2d04a7){_0x3ff008=_0x3ff008-0x0;var _0x18718c=_0xc326[_0x3ff008];return _0x18718c;};'use strict';var util=require(_0x6c32('0x0'));var _=require(_0x6c32('0x1'));var BPromise=require(_0x6c32('0x2'));var uuid=require('uuid');var moment=require(_0x6c32('0x3'));var rr=require('rr');var md5=require(_0x6c32('0x4'));var Redis=require(_0x6c32('0x5'));var ut=require(_0x6c32('0x6'));var config=require('../../../config/environment/');var logger=require(_0x6c32('0x7'))(_0x6c32('0x8'));var loggerBooked=require(_0x6c32('0x7'))('booked');var loggerPredictive=require('../../../config/logger')(_0x6c32('0x9'));var loggerPredictiveCalls=require(_0x6c32('0x7'))(_0x6c32('0xa'));var loggerSyncQueueSummary=require(_0x6c32('0x7'))(_0x6c32('0xb'));var ami=require(_0x6c32('0xc'));config[_0x6c32('0xd')]=_[_0x6c32('0xe')](config[_0x6c32('0xd')],{'host':_0x6c32('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6c32('0xd')]));var cmHopper=require(_0x6c32('0x10'));var cmHopperHistory=require(_0x6c32('0x11'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x6c32('0x12'));var Action=require(_0x6c32('0x13'));var History=require(_0x6c32('0x14'));var Final=require(_0x6c32('0x15'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x6c32('0x16'));var Hangup=require('./hangup');var ipAgi=process['env']['XCALLY_IP_AGI']||'127.0.0.1';var strategy={'rrmemory':_0x6c32('0x17'),'roundrobin':_0x6c32('0x18')};var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x3d430f){this[_0x6c32('0x19')]=this[_0x6c32('0x19')]?this['tail']['finally'](_0x3d430f):_0x3d430f();};function Dialer(_0x1b3fa9,_0x131b10){this[_0x6c32('0x1a')]=new Sequence();this[_0x6c32('0x1b')]=_0x131b10;this[_0x6c32('0x1c')]=_0x1b3fa9[_0x6c32('0x1c')];this['campaigns']=_0x1b3fa9['campaigns'];this[_0x6c32('0x1d')]=_0x1b3fa9['agents'];this[_0x6c32('0x1e')]=_0x1b3fa9[_0x6c32('0x1e')];this[_0x6c32('0x1f')]=config[_0x6c32('0x1f')]||0x2;this[_0x6c32('0x20')]={};this[_0x6c32('0x21')]={};this['contactsId']={};this[_0x6c32('0x22')]={};this[_0x6c32('0x23')]={};this[_0x6c32('0x24')]={};this[_0x6c32('0x25')]={};this[_0x6c32('0x26')]={};this[_0x6c32('0x27')]={};this[_0x6c32('0x28')]={};ami['on']('agentconnect',this[_0x6c32('0x29')][_0x6c32('0x2a')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x6c32('0x2a')](this));ami['on'](_0x6c32('0x2b'),this['syncOriginateResponse']['bind'](this));ami['on'](_0x6c32('0x2c'),this[_0x6c32('0x2d')][_0x6c32('0x2a')](this));ami['on'](_0x6c32('0x2e'),this['syncQueueSummary'][_0x6c32('0x2a')](this));ami['on']('hangup',this[_0x6c32('0x2f')][_0x6c32('0x2a')](this));ami['on']('newexten',this[_0x6c32('0x30')][_0x6c32('0x2a')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on']('queuemember',this['syncQueueMember'][_0x6c32('0x2a')](this));ami['on'](_0x6c32('0x31'),this[_0x6c32('0x32')][_0x6c32('0x2a')](this));this[_0x6c32('0x33')]();this[_0x6c32('0x34')]();}function isNotNull(_0x662994){return _0x662994!==null&&!_[_0x6c32('0x35')](_0x662994);}function checkIsLoggedIn(_0x26340e,_0x538186){return function(){if(_0x538186<=0x0){_0x26340e[_0x6c32('0x36')]='AGENTS_NOT_LOGGED';throw _0x26340e[_0x6c32('0x37')]+_0x6c32('0x38');}};}function isActive(_0x4827c3){return _0x4827c3;}function checkIsActive(_0x135bd0,_0x396dfa){return function(){if(!isActive(_0x396dfa)){_0x135bd0['message']='NOT_ACTIVE';throw _0x135bd0[_0x6c32('0x37')]+'\x20NOT\x20Active';}};}function checkInterval(_0x1c09b3){return function(){if(!isNotNull(_0x1c09b3['Interval'])){_0x1c09b3[_0x6c32('0x36')]=_0x6c32('0x39');throw _0x1c09b3[_0x6c32('0x37')]+_0x6c32('0x3a');}if(!isNotNull(_0x1c09b3[_0x6c32('0x3b')]['Intervals'])){_0x1c09b3[_0x6c32('0x36')]='INTERVAL_IS_NULL';throw _0x1c09b3[_0x6c32('0x37')]+_0x6c32('0x3a');}if(!isNotNull(_[_0x6c32('0x3c')](_0x1c09b3[_0x6c32('0x3b')][_0x6c32('0x3d')]))){_0x1c09b3['message']=_0x6c32('0x39');throw _0x1c09b3[_0x6c32('0x37')]+_0x6c32('0x3a');}};}function msgResponse(_0x52db52,_0x36158f,_0x50c431){return{'action':_0x52db52,'response':_0x36158f,'message':_0x50c431,'stack':_0x50c431};}function myreject(_0x5898be){return function(_0x536faf){return _0x5898be(msgResponse(_0x6c32('0x3e'),_0x6c32('0x3f'),JSON[_0x6c32('0x40')](_0x536faf)));};}function getSeconds(_0x5e1a17,_0x324d0b){var _0x36f66c=moment(_0x5e1a17)['milliseconds'](0x0);var _0x1eb411=moment(_0x324d0b)['milliseconds'](0x0);return _0x36f66c['diff'](_0x1eb411,_0x6c32('0x41'));}function emit(_0x463bfc,_0x29bac2,_0x5290cc){io['to'](_0x463bfc)['emit'](_0x29bac2,_0x5290cc);}function emitVoiceQueueSummary(_0x2c473c){if(_0x2c473c[_0x6c32('0x42')]===_0x6c32('0x43')){var _0x5a2b85={'id':_0x2c473c['id'],'name':_0x2c473c[_0x6c32('0x37')],'strategy':_0x2c473c[_0x6c32('0x44')],'answered':_0x2c473c[_0x6c32('0x45')],'available':_0x2c473c[_0x6c32('0x46')],'loggedIn':_0x2c473c[_0x6c32('0x47')],'pTalking':_0x2c473c[_0x6c32('0x48')],'sumBillable':_0x2c473c[_0x6c32('0x49')],'sumDuration':_0x2c473c[_0x6c32('0x4a')],'sumHoldTime':_0x2c473c[_0x6c32('0x4b')]||0x0,'talking':_0x2c473c[_0x6c32('0x4c')],'total':_0x2c473c[_0x6c32('0x4d')],'type':_0x2c473c[_0x6c32('0x42')],'unmanaged':_0x2c473c[_0x6c32('0x4e')],'abandoned':_0x2c473c[_0x6c32('0x4f')],'waiting':_0x2c473c[_0x6c32('0x50')],'loggedInDb':_0x2c473c[_0x6c32('0x51')],'dialActive':_0x2c473c['dialActive'],'dialMethod':_0x2c473c[_0x6c32('0x52')],'dialOriginateCallerIdName':_0x2c473c[_0x6c32('0x53')],'dialOriginateCallerIdNumber':_0x2c473c[_0x6c32('0x54')],'dialOriginateTimeout':_0x2c473c[_0x6c32('0x55')],'dialPrefix':_0x2c473c[_0x6c32('0x56')],'outboundAnswerAgiCallsDay':_0x2c473c['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x2c473c[_0x6c32('0x57')],'outboundBlacklistCallsDay':_0x2c473c[_0x6c32('0x58')],'outboundBusyCallsDay':_0x2c473c[_0x6c32('0x59')],'outboundCongestionCallsDay':_0x2c473c[_0x6c32('0x5a')],'outboundDropCallsDayACS':_0x2c473c[_0x6c32('0x5b')],'outboundDropCallsDayCallersExit':_0x2c473c[_0x6c32('0x5c')],'outboundDropCallsDayTimeout':_0x2c473c['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x2c473c['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x2c473c[_0x6c32('0x5d')],'outboundOriginateFailureCallsDay':_0x2c473c['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x2c473c['outboundReCallsDay'],'outboundRejectCallsDay':_0x2c473c[_0x6c32('0x5e')],'outboundUnknownCallsDay':_0x2c473c[_0x6c32('0x5f')],'predictiveIntervalAnsweredCalls':_0x2c473c['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x2c473c['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x2c473c[_0x6c32('0x60')],'predictiveIntervalDroppedCallsCallersExit':_0x2c473c[_0x6c32('0x61')],'predictiveIntervalDroppedCallsTimeout':_0x2c473c[_0x6c32('0x62')],'predictiveIntervalErlangCalls':_0x2c473c[_0x6c32('0x63')],'predictiveIntervalErlangCallsDroppedCalls':_0x2c473c[_0x6c32('0x64')],'predictiveIntervalHitRate':_0x2c473c[_0x6c32('0x65')],'predictiveIntervalMultiplicativeFactor':_0x2c473c[_0x6c32('0x66')],'predictiveIntervalPauses':_0x2c473c[_0x6c32('0x67')],'predictiveIntervalAvailable':_0x2c473c['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x2c473c[_0x6c32('0x68')],'message':_0x2c473c[_0x6c32('0x36')],'originated':_0x2c473c[_0x6c32('0x69')],'erlangCalls':_0x2c473c['erlangCalls'],'erlangCallToSecond':_0x2c473c[_0x6c32('0x6a')],'erlangAbandonmentRate':_0x2c473c['erlangAbandonmentRate'],'erlangBusyFactor':_0x2c473c[_0x6c32('0x6b')],'startPredictive':_0x2c473c[_0x6c32('0x24')],'startProgressive':_0x2c473c[_0x6c32('0x25')]};if(_0x2c473c['Trunk']){_0x5a2b85[_0x6c32('0x6c')]={'id':_0x2c473c[_0x6c32('0x6c')]['id'],'name':_0x2c473c['Trunk'][_0x6c32('0x37')],'active':_0x2c473c['Trunk'][_0x6c32('0x6d')],'callerid':_0x2c473c[_0x6c32('0x6c')][_0x6c32('0x6e')]};}if(_0x2c473c[_0x6c32('0x3b')]){_0x5a2b85[_0x6c32('0x3b')]={'id':_0x2c473c['Interval']['id'],'name':_0x2c473c[_0x6c32('0x3b')][_0x6c32('0x37')]};}var _0x1023ba=md5(JSON['stringify'](_0x5a2b85));if(_0x2c473c[_0x6c32('0x4')]!==_0x1023ba){_0x2c473c['md5']=_0x1023ba;emit(util[_0x6c32('0x6f')](_0x6c32('0x70'),_0x5a2b85[_0x6c32('0x37')]),_0x6c32('0x71'),_0x5a2b85);}}}function emitCampaignSummary(_0x2426af){if(_0x2426af[_0x6c32('0x42')]==='ivr'){emit(util[_0x6c32('0x6f')](_0x6c32('0x72'),_0x2426af[_0x6c32('0x37')]),_0x6c32('0x73'),_0x2426af);}}function checkGetDataPredictive(_0xb04a45){if(isNotNull(_0xb04a45)&&!_[_0x6c32('0x3c')](_0xb04a45)){loggerPredictive[_0x6c32('0x74')](_0x6c32('0x75'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xb04a45[_0x6c32('0x68')]);loggerPredictive[_0x6c32('0x74')](_0x6c32('0x76'),_0xb04a45[_0x6c32('0x77')]);loggerPredictive[_0x6c32('0x74')](_0x6c32('0x78'),_0xb04a45['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x6c32('0x74')](_0x6c32('0x79'),_0xb04a45[_0x6c32('0x61')]);loggerPredictive[_0x6c32('0x74')](_0x6c32('0x7a'),_0xb04a45[_0x6c32('0x7b')]);loggerPredictive['info'](_0x6c32('0x7c'),_0xb04a45[_0x6c32('0x60')]);loggerPredictive[_0x6c32('0x74')](_0x6c32('0x7d'));if(_0xb04a45['predictiveIntervalTotalCalls']>0x0){if(!_[_0x6c32('0x35')](_0xb04a45[_0x6c32('0x60')])&&_0xb04a45[_0x6c32('0x60')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x6c32('0x35')](_0xb04a45['predictiveIntervalAvgHoldtime'])&&_0xb04a45[_0x6c32('0x7b')]>0x0){return!![];}loggerPredictive[_0x6c32('0x74')](_0x6c32('0x7e'));}else{loggerPredictive[_0x6c32('0x74')](_0x6c32('0x7f'));}}else{loggerPredictive['info'](_0x6c32('0x80'));}return![];}function mergeDataErlangB(_0x1db864){return function(_0x37554f){loggerPredictive[_0x6c32('0x74')](_0x6c32('0x81'));loggerPredictive[_0x6c32('0x74')](_0x6c32('0x82'),_0x37554f[_0x6c32('0x83')]);loggerPredictive[_0x6c32('0x74')](_0x6c32('0x84'),_0x37554f[_0x6c32('0x6a')]);loggerPredictive[_0x6c32('0x74')](_0x6c32('0x85'),_0x37554f[_0x6c32('0x86')]);loggerPredictive[_0x6c32('0x74')](_0x6c32('0x87'),_0x37554f[_0x6c32('0x6b')]);loggerPredictive[_0x6c32('0x74')](_0x6c32('0x85'),_0x37554f['erlangAbandonmentRate']);loggerPredictive[_0x6c32('0x74')](_0x6c32('0x7d'));_[_0x6c32('0x88')](_0x1db864,_0x37554f);};}function getDiff(_0x272a39){var _0x1bd743=moment()[_0x6c32('0x89')](0x0);var _0x6391e7=moment(_0x272a39)[_0x6c32('0x89')](0x0);return _0x1bd743[_0x6c32('0x8a')](_0x6391e7,_0x6c32('0x41'));}function ifInterval(_0x159ad0,_0x6297a2){if(_['isUndefined'](_0x6297a2)){return![];}return getDiff(_0x6297a2)<_0x159ad0*0x3c;}function freeVariablesPredictive(_0x5b4367){if(isNotNull(_0x5b4367)){if(!_[_0x6c32('0x35')](_0x5b4367[_0x6c32('0x25')])){_0x5b4367[_0x6c32('0x25')]=undefined;loggerPredictive['info'](_0x5b4367[_0x6c32('0x37')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x6c32('0x35')](_0x5b4367[_0x6c32('0x24')])){_0x5b4367[_0x6c32('0x24')]=undefined;loggerPredictive['info'](_0x5b4367[_0x6c32('0x37')],_0x6c32('0x8b'));}if(!_[_0x6c32('0x35')](_0x5b4367[_0x6c32('0x8c')])){clearInterval(_0x5b4367['handlePredictive']);_0x5b4367[_0x6c32('0x8c')]=undefined;loggerPredictive[_0x6c32('0x74')](_0x5b4367[_0x6c32('0x37')],_0x6c32('0x8d'));}}}function erlangb(_0x5d8cc6,_0x3b22b8){if(_0x3b22b8===0x0){return 0x0;}var _0xacca1c=0x1;for(var _0x2f5109=0x1;_0x2f5109<=_0x3b22b8;_0x2f5109+=0x1){_0xacca1c=0x1+_0xacca1c*_0x2f5109/_0x5d8cc6;}return 0x1/_0xacca1c;}function isVoiceQueueOutbound(_0x457dd9){return _0x457dd9==='outbound';}function isNotPreview(_0x119a48){return _0x119a48!==_0x6c32('0x1b');}function isCampaignIvr(_0x547fc9){return _0x547fc9===_0x6c32('0x8e');}function getCallerId(_0x3b57d7,_0x265125,_0x1bc6d6){if(!_[_0x6c32('0x35')](_0x1bc6d6)&&typeof _0x1bc6d6==='string'&&!_[_0x6c32('0x3c')](_0x1bc6d6)){if(!_[_0x6c32('0x35')](_0x265125)&&typeof _0x265125==='string'&&!_[_0x6c32('0x3c')](_0x265125)){return util[_0x6c32('0x6f')](_0x6c32('0x8f'),_0x265125,_0x1bc6d6);}return util['format'](_0x6c32('0x8f'),_0x1bc6d6,_0x1bc6d6);}if(!_['isUndefined'](_0x3b57d7)&&typeof _0x3b57d7===_0x6c32('0x90')&&!_[_0x6c32('0x3c')](_0x3b57d7)){return _0x3b57d7;}return _0x6c32('0x91');}function loggerCatchQueueSummary(_0x46c5e9,_0x199a5b){return function(_0x9e7c9a){freeVariablesPredictive(_0x199a5b);emitVoiceQueueSummary(_0x199a5b);emitCampaignSummary(_0x199a5b);loggerSyncQueueSummary[_0x6c32('0x92')](_0x46c5e9,util[_0x6c32('0x93')](_0x9e7c9a,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3797ce,_0x24a7df){return function(_0x5433a8){loggerPredictive[_0x6c32('0x92')](_0x24a7df[_0x6c32('0x37')],_0x3797ce);loggerPredictive[_0x6c32('0x92')](_0x5433a8[_0x6c32('0x94')]);freeVariablesPredictive(_0x24a7df);};}function loggerCatch(_0x459a2f){return function(_0x1d1d57){logger[_0x6c32('0x92')](_0x459a2f,util['inspect'](_0x1d1d57,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x14a383){return _0x14a383&&!_['isUndefined'](_0x14a383)&&_0x14a383['length']>0x0;}function decremetOriginate(_0x318e36){if(!_[_0x6c32('0x35')](_0x318e36)&&_0x318e36!==null){if(typeof _0x318e36[_0x6c32('0x69')]!==_0x6c32('0x95')){if(_0x318e36[_0x6c32('0x69')]>0x0){_0x318e36[_0x6c32('0x69')]-=0x1;}else{logger[_0x6c32('0x92')](_0x6c32('0x96'));}}}else{logger['error'](_0x6c32('0x97'));}}function checkContactLowerLimitOriginate(_0x541cb6,_0x41a7db,_0x1e561e){if(_0x41a7db>_0x1e561e){for(var _0x4165e7=0x0;_0x4165e7<_0x41a7db-_0x1e561e;_0x4165e7+=0x1){decremetOriginate(_0x541cb6);}}}function loggerGetContactDialer(_0x1b63ad,_0x41e7f8,_0x3d813e){return function(_0x1a53e9){checkContactLowerLimitOriginate(_0x41e7f8,_0x3d813e,0x0);logger[_0x6c32('0x92')](_0x1b63ad,util['inspect'](_0x1a53e9,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x36d05e){return function(_0xfa501a){if(isNotNull(_0xfa501a)&&isNotNull(_0xfa501a[0x0])){if(_0xfa501a[0x0]['contactsRescheduled']>0x0){_0x36d05e[_0x6c32('0x36')]='RESCHEDULED_CONTACTS';logger['info'](_0x6c32('0x98')+_0x36d05e[_0x6c32('0x37')],_0xfa501a[0x0][_0x6c32('0x99')],_0x6c32('0x9a'));}else{_0x36d05e[_0x6c32('0x36')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x6c32('0x74')](_0x6c32('0x9b')+_0x36d05e['name']);}}};}function notSendMessagesQueue(_0x4b19e2){if(_0x4b19e2[_0x6c32('0x9c')]){freeVariablesPredictive(_0x4b19e2);if(_0x4b19e2['originated']===0x0&&_0x4b19e2[_0x6c32('0x4c')]===0x0&&_0x4b19e2[_0x6c32('0x50')]===0x0&&(_0x4b19e2[_0x6c32('0x48')]||0x0)===0x0){_0x4b19e2[_0x6c32('0x9c')]=![];_0x4b19e2[_0x6c32('0x46')]=0x0;_0x4b19e2[_0x6c32('0x36')]=_0x6c32('0x9d');loggerSyncQueueSummary['error'](_0x6c32('0x9e'),_0x4b19e2['name'],_0x6c32('0x9f'));}else{_0x4b19e2[_0x6c32('0x36')]=_0x6c32('0xa0');loggerSyncQueueSummary[_0x6c32('0x92')](_0x6c32('0x9e'),_0x4b19e2[_0x6c32('0x37')],_0x6c32('0xa1'));}emitVoiceQueueSummary(_0x4b19e2);}}function notSendMessagesCampaign(_0x1035da){if(_0x1035da[_0x6c32('0x9c')]){if(_0x1035da[_0x6c32('0x69')]===0x0){_0x1035da[_0x6c32('0x9c')]=![];_0x1035da[_0x6c32('0x36')]=_0x6c32('0x9d');loggerSyncQueueSummary[_0x6c32('0x92')](_0x6c32('0xa2'),_0x1035da[_0x6c32('0x37')],'is\x20not\x20active');}else{_0x1035da[_0x6c32('0x36')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x6c32('0x92')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1035da[_0x6c32('0x37')],_0x6c32('0xa1'));}emitCampaignSummary(_0x1035da);}}function createObjHistory(_0x5a05ca,_0x29cc97,_0x5e831c,_0x34850c,_0x17928e){_0x5a05ca[_0x6c32('0x36')]=_0x5e831c;var _0x26ba6f=new Action(_0x5a05ca,_0x29cc97);var _0x1dffcd=new History(_0x26ba6f);_0x1dffcd[_0x6c32('0xa3')]=_0x34850c;_0x1dffcd['statedesc']=_0x17928e;_0x1dffcd['endtime']=_0x26ba6f[_0x6c32('0xa4')];return _0x1dffcd;}Dialer[_0x6c32('0xa5')][_0x6c32('0x34')]=function(){var _0x37ff64=this;setInterval(function(){_0x37ff64[_0x6c32('0xa6')](_0x37ff64[_0x6c32('0x22')],'[uniqueid]');_0x37ff64[_0x6c32('0xa6')](_0x37ff64[_0x6c32('0x21')],_0x6c32('0xa7'));},0x32c8);};Dialer[_0x6c32('0xa5')][_0x6c32('0xa6')]=function(_0x5306c5,_0x119f62){var _0x293565=this;for(var _0x5c51fb in _0x5306c5){if(typeof _0x5306c5[_0x5c51fb]!=='undefined'){this[_0x6c32('0x1a')]['enqueue'](function(){if(!_[_0x6c32('0xa8')](_0x5306c5[_0x5c51fb])){return ami[_0x6c32('0xa9')]({'action':_0x6c32('0xaa'),'channel':_0x5306c5[_0x5c51fb][_0x6c32('0xab')]})[_0x6c32('0xac')](function(_0x1aa9d1){if(_0x1aa9d1[_0x6c32('0x36')]===_0x6c32('0xad')){setTimeout(function(){if(_0x5306c5[_0x5c51fb]&&_0x5306c5[_0x5c51fb][_0x6c32('0x42')]!==_0x6c32('0x8e')){_0x293565[_0x6c32('0xae')](_0x293565[_0x6c32('0x1c')][_0x5306c5[_0x5c51fb]['queue']]);logger[_0x6c32('0x92')]('[Dialer][checkChannel]',_0x119f62,_0x5c51fb,_0x5306c5[_0x5c51fb]['queue']);delete _0x5306c5[_0x5c51fb];}if(_0x5306c5[_0x5c51fb]&&_0x5306c5[_0x5c51fb]['type']===_0x6c32('0x8e')){_0x293565[_0x6c32('0xae')](_0x293565[_0x6c32('0xaf')][_0x5306c5[_0x5c51fb][_0x6c32('0xb0')]]);logger[_0x6c32('0x92')]('[Dialer][checkChannel][ivr]',_0x119f62,_0x5c51fb,_0x5306c5[_0x5c51fb][_0x6c32('0xb0')]);delete _0x5306c5[_0x5c51fb];}},0x2328);}});}});}}};Dialer[_0x6c32('0xa5')][_0x6c32('0xb1')]=function(_0x56071a){return BPromise[_0x6c32('0xb2')]()[_0x6c32('0xb3')](cmHopper[_0x6c32('0xb1')](_0x56071a))[_0x6c32('0xac')](loggerCatch(_0x6c32('0xb4')));};Dialer[_0x6c32('0xa5')][_0x6c32('0xb5')]=function(_0x5864dc){return BPromise[_0x6c32('0xb2')]()[_0x6c32('0xb3')](cmHopperBlack[_0x6c32('0xb5')](_0x5864dc))[_0x6c32('0xac')](loggerCatch(_0x6c32('0xb6')));};Dialer[_0x6c32('0xa5')][_0x6c32('0xb7')]=function(_0x933ef1){return BPromise['resolve']()[_0x6c32('0xb3')](cmHopperBlack[_0x6c32('0xb7')](_0x933ef1))[_0x6c32('0xac')](loggerCatch(_0x6c32('0xb8')));};Dialer[_0x6c32('0xa5')][_0x6c32('0xb9')]=function(_0x14a9c4){return BPromise[_0x6c32('0xb2')]()[_0x6c32('0xb3')](cmHopperHistory[_0x6c32('0xba')](_0x14a9c4))[_0x6c32('0xac')](loggerCatch(_0x6c32('0xbb')));};Dialer[_0x6c32('0xa5')][_0x6c32('0xbc')]=function(_0x5ab88a){return BPromise['resolve']()['then'](cmHopper[_0x6c32('0xbc')](_0x5ab88a))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x6c32('0xa5')][_0x6c32('0xbd')]=function(_0x3c17f1,_0x4d8c89,_0xca86b9){return BPromise['resolve']()[_0x6c32('0xb3')](cmHopper['unlockContact'](_0x3c17f1,_0x4d8c89,_0xca86b9))[_0x6c32('0xac')](loggerCatch(_0x6c32('0xbe')));};Dialer['prototype'][_0x6c32('0xbf')]=function(_0x3bd2f0,_0x2b3c03,_0xafcdfc,_0x2858fc){return BPromise[_0x6c32('0xb2')]()[_0x6c32('0xb3')](cmHopper['getContactDialer'](_0x3bd2f0,_0x2b3c03,_0xafcdfc,_0x2858fc))['catch'](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x6c32('0xa5')][_0x6c32('0xc0')]=function(_0x1b7328,_0x249474,_0x3adcb9){return BPromise['resolve']()[_0x6c32('0xb3')](cmHopper['getContactDialerIvr'](_0x1b7328,_0x249474,_0x3adcb9))[_0x6c32('0xac')](loggerCatch('[getContactDialer]\x20'));};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x1359a2){return BPromise['resolve']()[_0x6c32('0xb3')](voiceQueueRt[_0x6c32('0xc1')](_0x1359a2))[_0x6c32('0xac')](loggerCatch(_0x6c32('0xc2')));};Dialer[_0x6c32('0xa5')][_0x6c32('0xc3')]=function(_0x1c603b){return BPromise[_0x6c32('0xb2')]()[_0x6c32('0xb3')](cmHopper['moveContactManagedDialer'](_0x1c603b))[_0x6c32('0xac')](loggerCatch(_0x6c32('0xc4')));};Dialer[_0x6c32('0xa5')][_0x6c32('0xc5')]=function(_0x2890d3){return BPromise[_0x6c32('0xb2')]()[_0x6c32('0xb3')](cmHopperHistory[_0x6c32('0xc5')](_0x2890d3))[_0x6c32('0xac')](loggerCatch(_0x6c32('0xc6')));};Dialer[_0x6c32('0xa5')][_0x6c32('0xae')]=function(_0x1a12f0){if(!_[_0x6c32('0x35')](_0x1a12f0)&&_0x1a12f0!==null){if(typeof _0x1a12f0[_0x6c32('0x69')]!==_0x6c32('0x95')){if(_0x1a12f0[_0x6c32('0x69')]>0x0){_0x1a12f0[_0x6c32('0x69')]-=0x1;}else{logger[_0x6c32('0x92')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x6c32('0x92')](_0x6c32('0xc7'));}};Dialer[_0x6c32('0xa5')][_0x6c32('0xc8')]=function(_0x4b720a,_0x4b641b){var _0x2a588e=this;return function(_0xd070d8){_0x2a588e['updateOriginated'](_0x4b641b);logger['error'](_0x4b720a,util['inspect'](_0xd070d8,{'showHidden':![],'depth':null}));};};Dialer[_0x6c32('0xa5')][_0x6c32('0xc9')]=function(_0x341323,_0x463bb8,_0x5f3fcf){var _0x4c0f92={'state':0x19,'statedesc':'notFound'};this[_0x6c32('0xae')](_0x463bb8);this['saveInDb'](_['merge'](_0x4c0f92,_[_0x6c32('0xca')](_0x5f3fcf,[_0x6c32('0xcb'),_0x6c32('0xcc'),_0x6c32('0xcd'),_0x6c32('0xce'),_0x6c32('0xcf')])),_0x6c32('0xd0'),'[emptyContact]');logger[_0x6c32('0x92')](_0x341323);};Dialer[_0x6c32('0xa5')][_0x6c32('0xd1')]=function(_0x53cd49){return _0x53cd49===_0x6c32('0xd2');};Dialer[_0x6c32('0xa5')][_0x6c32('0xd3')]=function(_0x5eb3b4){return!_['isUndefined'](_0x5eb3b4)&&_0x5eb3b4&&!_['isUndefined'](_0x5eb3b4['name'])&&!_[_0x6c32('0x35')](_0x5eb3b4[_0x6c32('0x6d')])&&_0x5eb3b4['active']&&(this['trunks'][util[_0x6c32('0x6f')](_0x6c32('0xd4'),_0x5eb3b4[_0x6c32('0x37')])]['status']==='reachable'||this[_0x6c32('0x1e')][util[_0x6c32('0x6f')](_0x6c32('0xd4'),_0x5eb3b4[_0x6c32('0x37')])][_0x6c32('0xaa')]===_0x6c32('0xd5'));};Dialer[_0x6c32('0xa5')][_0x6c32('0xd6')]=function(_0xe04bea,_0x52d4b1,_0x15cc89){this['createHistory'](_0xe04bea)[_0x6c32('0xac')](loggerCatch(_0x52d4b1));this[_0x6c32('0xc3')](_0xe04bea)[_0x6c32('0xac')](loggerCatch(_0x15cc89));};Dialer[_0x6c32('0xa5')][_0x6c32('0xd7')]=function(_0x233a6e){var _0x4543e4=this['uniqueId'][_0x233a6e[_0x6c32('0xd8')]];var _0x9fdd8d;if(!_['isNil'](_0x233a6e)&&!_[_0x6c32('0xa8')](_0x233a6e[_0x6c32('0xd9')])&&!_['isNil'](_0x233a6e[_0x6c32('0xd9')]['amdstatus'])&&_0x233a6e[_0x6c32('0xda')]==='xcally-motion-dialer'&&_0x4543e4){if(_0x4543e4[_0x6c32('0x42')]!==_0x6c32('0x8e')&&this[_0x6c32('0x1c')][_0x4543e4['queue']][_0x6c32('0xdb')]&&_0x233a6e[_0x6c32('0xdc')]===_0x6c32('0xdd')){delete this[_0x6c32('0x22')][_0x233a6e['uniqueid']];this[_0x6c32('0xae')](this[_0x6c32('0x1c')][_0x4543e4[_0x6c32('0xb0')]]);this[_0x6c32('0x1c')][_0x4543e4[_0x6c32('0xb0')]][_0x6c32('0x57')]+=0x1;this[_0x6c32('0x1c')][_0x4543e4[_0x6c32('0xb0')]]['outboundAnswerAgiCallsDay']+=0x1;_0x9fdd8d=new Hangup(_0x4543e4,_0x233a6e);_0x9fdd8d[_0x6c32('0xa3')]=0x12;_0x9fdd8d[_0x6c32('0xde')]=_0x6c32('0xdf');_0x9fdd8d['membername']=_0x6c32('0xe0');this[_0x6c32('0xd6')](_0x9fdd8d,_0x6c32('0xe1'),'[syncHangupInAMD]');}if(_0x4543e4[_0x6c32('0x42')]!==_0x6c32('0x8e')&&this[_0x6c32('0x1c')][_0x4543e4[_0x6c32('0xb0')]][_0x6c32('0xdb')]&&_0x233a6e[_0x6c32('0xdc')]===_0x6c32('0xe2')){var _0x6b2764=this;return new BPromise(function(_0x12085f,_0x153862){delete _0x6b2764[_0x6c32('0x22')][_0x233a6e[_0x6c32('0xd8')]];_0x6b2764[_0x6c32('0xae')](_0x6b2764[_0x6c32('0x1c')][_0x4543e4[_0x6c32('0xb0')]]);_0x6b2764['voiceQueues'][_0x4543e4[_0x6c32('0xb0')]][_0x6c32('0x57')]+=0x1;_0x6b2764[_0x6c32('0x1c')][_0x4543e4[_0x6c32('0xb0')]][_0x6c32('0xe3')]+=0x1;var _0x39df2a=_0x6b2764[_0x6c32('0x1c')][_0x4543e4[_0x6c32('0xb0')]];var _0x5b3f2e=new Hangup(_0x4543e4,_0x233a6e);_0x5b3f2e[_0x6c32('0xa3')]=0x13;_0x5b3f2e[_0x6c32('0xde')]='Machine';_0x5b3f2e['membername']=_0x6c32('0xe0');_0x5b3f2e['countmachineretry']+=0x1;_0x5b3f2e[_0x6c32('0xe4')]+=0x1;_0x5b3f2e['amd']=!![];_0x6b2764['createHistory'](_0x5b3f2e)[_0x6c32('0xac')](loggerCatch(_0x6c32('0xe5')));if(_0x5b3f2e[_0x6c32('0xe6')]+_0x5b3f2e[_0x6c32('0xe7')]+_0x5b3f2e[_0x6c32('0xe8')]+_0x5b3f2e['countnosuchnumberretry']+_0x5b3f2e[_0x6c32('0xe9')]+_0x5b3f2e[_0x6c32('0xea')]+_0x5b3f2e[_0x6c32('0xeb')]+_0x5b3f2e[_0x6c32('0xec')]>=_0x39df2a['dialGlobalMaxRetry']){_0x6b2764[_0x6c32('0xed')](_0x5b3f2e,_0x12085f,_0x153862,_0x6c32('0xee'));}else{if(_0x5b3f2e[_0x6c32('0xeb')]>=_0x39df2a[_0x6c32('0xef')]){_0x6b2764['createStateFinal'](_0x5b3f2e,_0x12085f,_0x153862,_0x6c32('0xf0'));}else{_0x6b2764['rescheduleContact']({'active':![],'countmachineretry':_0x5b3f2e[_0x6c32('0xeb')],'scheduledat':moment()[_0x6c32('0xf1')](_0x39df2a['dialMachineRetryFrequency'],_0x6c32('0xf2'))['format'](_0x6c32('0xf3')),'ContactId':_0x5b3f2e[_0x6c32('0xcb')],'ListId':_0x5b3f2e[_0x6c32('0xcc')],'VoiceQueueId':_0x5b3f2e['VoiceQueueId']||undefined,'CampaignId':_0x5b3f2e[_0x6c32('0xcf')]||undefined})[_0x6c32('0xac')](loggerCatch(_0x6c32('0xf4')));_0x12085f({'reschedule':0x1});}}});}if(_0x4543e4[_0x6c32('0x42')]===_0x6c32('0x8e')&&this[_0x6c32('0xaf')][_0x4543e4[_0x6c32('0xb0')]]['dialAMDActive']&&_0x233a6e['value']===_0x6c32('0xdd')){delete this[_0x6c32('0x22')][_0x233a6e['uniqueid']];this[_0x6c32('0xae')](this[_0x6c32('0xaf')][_0x4543e4[_0x6c32('0xb0')]]);_0x9fdd8d=new Hangup(_0x4543e4,_0x233a6e);_0x9fdd8d[_0x6c32('0xa3')]=0x12;_0x9fdd8d[_0x6c32('0xde')]=_0x6c32('0xdf');_0x9fdd8d[_0x6c32('0xf5')]='AMD';this['saveInDb'](_0x9fdd8d,_0x6c32('0xf6'),_0x6c32('0xf7'));}if(_0x4543e4[_0x6c32('0x42')]===_0x6c32('0x8e')&&this['campaigns'][_0x4543e4[_0x6c32('0xb0')]]['dialAMDActive']&&_0x233a6e[_0x6c32('0xdc')]==='MACHINE'){var _0x6b2764=this;return new BPromise(function(_0x3ffc94,_0x2c24db){delete _0x6b2764[_0x6c32('0x22')][_0x233a6e['uniqueid']];_0x6b2764[_0x6c32('0xae')](_0x6b2764[_0x6c32('0xaf')][_0x4543e4[_0x6c32('0xb0')]]);_0x6b2764[_0x6c32('0xaf')][_0x4543e4[_0x6c32('0xb0')]][_0x6c32('0x57')]+=0x1;_0x6b2764['campaigns'][_0x4543e4[_0x6c32('0xb0')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x2fe2ab=_0x6b2764[_0x6c32('0xaf')][_0x4543e4['queue']];var _0x3ce356=new Hangup(_0x4543e4,_0x233a6e);_0x3ce356[_0x6c32('0xa3')]=0x13;_0x3ce356['statedesc']=_0x6c32('0xf8');_0x3ce356[_0x6c32('0xf5')]=_0x6c32('0xe0');_0x3ce356['countmachineretry']+=0x1;_0x3ce356['countglobal']+=0x1;_0x3ce356[_0x6c32('0xf9')]=!![];_0x6b2764['createHistory'](_0x3ce356)[_0x6c32('0xac')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3ce356[_0x6c32('0xe6')]+_0x3ce356[_0x6c32('0xe7')]+_0x3ce356['countnoanswerretry']+_0x3ce356[_0x6c32('0xfa')]+_0x3ce356[_0x6c32('0xe9')]+_0x3ce356[_0x6c32('0xea')]+_0x3ce356[_0x6c32('0xeb')]+_0x3ce356[_0x6c32('0xec')]>=_0x2fe2ab[_0x6c32('0xfb')]){_0x6b2764['stateGlobal'](_0x3ce356,_0x3ffc94,_0x2c24db,_0x6c32('0xee'));}else{if(_0x3ce356['countmachineretry']>=_0x2fe2ab['dialMachineMaxRetry']){_0x6b2764[_0x6c32('0xfc')](_0x3ce356,_0x3ffc94,_0x2c24db,'reason\x2019\x20machine....');}else{_0x6b2764['rescheduleContact']({'active':![],'countmachineretry':_0x3ce356[_0x6c32('0xeb')],'scheduledat':moment()[_0x6c32('0xf1')](_0x2fe2ab[_0x6c32('0xfd')],_0x6c32('0xf2'))[_0x6c32('0x6f')](_0x6c32('0xf3')),'ContactId':_0x3ce356[_0x6c32('0xcb')],'ListId':_0x3ce356[_0x6c32('0xcc')],'VoiceQueueId':_0x3ce356['VoiceQueueId']||undefined,'CampaignId':_0x3ce356['CampaignId']||undefined})['catch'](loggerCatch(_0x6c32('0xf4')));_0x3ffc94({'reschedule':0x1});}}});}}};Dialer[_0x6c32('0xa5')][_0x6c32('0x2f')]=function(_0x53b282){var _0x1f6e78=this[_0x6c32('0x22')][_0x53b282['uniqueid']];var _0x116416=this;var _0x52c17a;if(_0x1f6e78&&_0x1f6e78['type']===_0x6c32('0x8e')){delete this[_0x6c32('0x22')][_0x53b282[_0x6c32('0xd8')]];this[_0x6c32('0xae')](this[_0x6c32('0xaf')][_0x1f6e78[_0x6c32('0xb0')]]);this[_0x6c32('0xaf')][_0x1f6e78['queue']]['ivrAnswerCallsDay']+=0x1;_0x52c17a=new Hangup(_0x1f6e78,_0x53b282);this[_0x6c32('0xc5')](_0x52c17a)['catch'](loggerCatch(_0x6c32('0xfe')));this[_0x6c32('0xc3')](_0x52c17a)[_0x6c32('0xac')](loggerCatch('[syncHangupIvr]'));}if(_0x1f6e78&&_0x1f6e78[_0x6c32('0x42')]!==_0x6c32('0x8e')&&isNotNull(this[_0x6c32('0x1c')][_0x1f6e78['queue']][_0x6c32('0xff')])){delete this[_0x6c32('0x22')][_0x53b282['uniqueid']];this['updateOriginated'](this[_0x6c32('0x1c')][_0x1f6e78[_0x6c32('0xb0')]]);this[_0x6c32('0x1c')][_0x1f6e78[_0x6c32('0xb0')]][_0x6c32('0x57')]+=0x1;this[_0x6c32('0x1c')][_0x1f6e78[_0x6c32('0xb0')]]['outboundAnswerAgiCallsDay']+=0x1;_0x52c17a=new Hangup(_0x1f6e78,_0x53b282);_0x52c17a[_0x6c32('0xa3')]=0x10;_0x52c17a[_0x6c32('0xde')]='AnswerAGI';_0x52c17a[_0x6c32('0xf5')]=_0x6c32('0x100');this[_0x6c32('0xc5')](_0x52c17a)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x6c32('0xc3')](_0x52c17a)[_0x6c32('0xac')](loggerCatch(_0x6c32('0x101')));}if(_0x1f6e78&&_0x1f6e78[_0x6c32('0x42')]!==_0x6c32('0x8e')&&!isNotNull(this[_0x6c32('0x1c')][_0x1f6e78[_0x6c32('0xb0')]]['dialQueueProject'])){delete this[_0x6c32('0x22')][_0x53b282[_0x6c32('0xd8')]];this[_0x6c32('0xae')](this[_0x6c32('0x1c')][_0x1f6e78[_0x6c32('0xb0')]]);this[_0x6c32('0x1c')][_0x1f6e78[_0x6c32('0xb0')]][_0x6c32('0x5f')]+=0x1;_0x52c17a=new Hangup(_0x1f6e78,_0x53b282);_0x52c17a[_0x6c32('0xa3')]=0xc;_0x52c17a['statedesc']=_0x53b282[_0x6c32('0x102')];_0x52c17a[_0x6c32('0xf5')]='Unknow';this[_0x6c32('0xc5')](_0x52c17a)[_0x6c32('0xac')](loggerCatch(_0x6c32('0xfe')));this['moveContactManagedDialer'](_0x52c17a)[_0x6c32('0xac')](loggerCatch(_0x6c32('0x101')));}};Dialer[_0x6c32('0xa5')][_0x6c32('0x2d')]=function(_0x4db81f){var _0x5f1b11=this['uniqueId'][_0x4db81f[_0x6c32('0xd8')]];var _0x363c7f=this;if(this['voiceQueues'][_0x4db81f[_0x6c32('0xb0')]]){if(_0x5f1b11&&_0x5f1b11[_0x6c32('0x42')]!==_0x6c32('0x8e')){delete this[_0x6c32('0x22')][_0x4db81f[_0x6c32('0xd8')]];this[_0x6c32('0x1c')][_0x4db81f['queue']][_0x6c32('0x57')]+=0x1;var _0x7713b4=new AgentComplete(_0x5f1b11,_0x4db81f);if(_0x4db81f[_0x6c32('0x103')]===_0x6c32('0x104')){_0x7713b4['agiafterat']=this[_0x6c32('0x1c')][_0x4db81f[_0x6c32('0xb0')]]['dialQueueProject2']&&this[_0x6c32('0x1c')][_0x4db81f[_0x6c32('0xb0')]][_0x6c32('0x105')]?moment()[_0x6c32('0x6f')](_0x6c32('0xf3')):undefined;}this[_0x6c32('0xc5')](_0x7713b4)[_0x6c32('0xac')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x6c32('0xc3')](_0x7713b4)[_0x6c32('0xac')](loggerCatch(_0x6c32('0x106')));}}};Dialer[_0x6c32('0xa5')][_0x6c32('0x29')]=function(_0x1bbd08){if(this['voiceQueues'][_0x1bbd08[_0x6c32('0xb0')]]){if(this['uniqueId'][_0x1bbd08['uniqueid']]&&this['uniqueId'][_0x1bbd08['uniqueid']][_0x6c32('0x42')]!=='ivr'){this[_0x6c32('0xae')](this[_0x6c32('0x1c')][_0x1bbd08[_0x6c32('0xb0')]]);this['uniqueId'][_0x1bbd08['uniqueid']][_0x6c32('0x107')]=moment()[_0x6c32('0x6f')](_0x6c32('0xf3'));}}};Dialer[_0x6c32('0xa5')][_0x6c32('0x108')]=function(_0x18e10a){this[_0x6c32('0xc5')](_0x18e10a)[_0x6c32('0xac')](loggerCatch(_0x6c32('0x109')));this[_0x6c32('0xc3')](_0x18e10a)[_0x6c32('0xac')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x6c32('0xa5')][_0x6c32('0x10a')]=function(_0x324bae){var _0x20df27=this[_0x6c32('0x22')][_0x324bae['uniqueid']];var _0x4304b1=this;if(this[_0x6c32('0x1c')][_0x324bae[_0x6c32('0xb0')]]){if(_0x20df27&&_0x20df27['type']!=='ivr'){delete this[_0x6c32('0x22')][_0x324bae[_0x6c32('0xd8')]];this[_0x6c32('0xae')](this['voiceQueues'][_0x324bae[_0x6c32('0xb0')]]);_0x20df27[_0x6c32('0x10b')]=moment()[_0x6c32('0x6f')]('YYYY-MM-DD\x20HH:mm:ss');var _0xe8c030=new QueueCallerAbandon(_0x20df27,_0x324bae);if(getSeconds(_0x20df27[_0x6c32('0x10b')],_0x20df27[_0x6c32('0x10c')])>=_0x20df27[_0x6c32('0x10d')]){this[_0x6c32('0x1c')][_0x324bae[_0x6c32('0xb0')]][_0x6c32('0x62')]+=0x1;this[_0x6c32('0x1c')][_0x324bae[_0x6c32('0xb0')]][_0x6c32('0x10e')]+=0x1;this[_0x6c32('0x1c')][_0x324bae['queue']][_0x6c32('0x64')]+=0x1;_0xe8c030['state']=0xa;_0xe8c030[_0x6c32('0xde')]='Drop';_0xe8c030[_0x6c32('0x10f')]=_0x6c32('0x110');_0xe8c030[_0x6c32('0x111')]=this[_0x6c32('0x1c')][_0x324bae[_0x6c32('0xb0')]]['dialQueueProject2']?moment()['format'](_0x6c32('0xf3')):undefined;_0xe8c030[_0x6c32('0xe9')]+=0x1;_0xe8c030['countglobal']+=0x1;if(_0xe8c030['countdropretry']>=this['voiceQueues'][_0x324bae[_0x6c32('0xb0')]][_0x6c32('0x112')]){this[_0x6c32('0x108')](_0xe8c030);}else{this[_0x6c32('0xbc')]({'active':![],'countdropretry':_0xe8c030[_0x6c32('0xe9')],'scheduledat':moment()[_0x6c32('0xf1')](this[_0x6c32('0x1c')][_0x324bae[_0x6c32('0xb0')]]['dialDropRetryFrequency'],'minutes')[_0x6c32('0x6f')](_0x6c32('0xf3')),'ContactId':_0x20df27[_0x6c32('0xcb')],'ListId':_0x20df27[_0x6c32('0xcc')],'VoiceQueueId':_0x20df27['VoiceQueueId']||undefined,'CampaignId':_0x20df27['CampaignId']||undefined})[_0x6c32('0xac')](loggerCatch(_0x6c32('0x113')));var _0x552d3c=new History(_0xe8c030);_0x552d3c['state']=0xa;_0x552d3c[_0x6c32('0xde')]=_0x6c32('0x114');_0x552d3c[_0x6c32('0xa4')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x552d3c[_0x6c32('0x115')]=_0x552d3c[_0x6c32('0xa4')];_0x552d3c[_0x6c32('0x116')]=_0xe8c030['calleridname'];_0x552d3c[_0x6c32('0x117')]=_0xe8c030[_0x6c32('0x117')];this[_0x6c32('0xc5')](_0x552d3c)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x6c32('0x1c')][_0x324bae['queue']][_0x6c32('0x61')]+=0x1;this['voiceQueues'][_0x324bae[_0x6c32('0xb0')]][_0x6c32('0x5c')]+=0x1;_0xe8c030[_0x6c32('0xa3')]=0xb;_0xe8c030['statedesc']=_0x6c32('0x118');_0xe8c030['dropreason']=_0x6c32('0x119');_0xe8c030[_0x6c32('0xea')]+=0x1;_0xe8c030[_0x6c32('0xe4')]+=0x1;if(_0xe8c030[_0x6c32('0xea')]>=this['voiceQueues'][_0x324bae['queue']][_0x6c32('0x11a')]){this[_0x6c32('0x108')](_0xe8c030);}else{this[_0x6c32('0xbc')]({'active':![],'countabandonedretry':_0xe8c030[_0x6c32('0xea')],'scheduledat':moment()[_0x6c32('0xf1')](this[_0x6c32('0x1c')][_0x324bae[_0x6c32('0xb0')]][_0x6c32('0x11b')],'minutes')[_0x6c32('0x6f')](_0x6c32('0xf3')),'ContactId':_0x20df27[_0x6c32('0xcb')],'ListId':_0x20df27[_0x6c32('0xcc')],'VoiceQueueId':_0x20df27[_0x6c32('0xce')]||undefined,'CampaignId':_0x20df27['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x552d3c=new History(_0xe8c030);_0x552d3c[_0x6c32('0xa3')]=0xb;_0x552d3c[_0x6c32('0xde')]=_0x6c32('0x118');_0x552d3c[_0x6c32('0xa4')]=moment()[_0x6c32('0x6f')](_0x6c32('0xf3'));_0x552d3c[_0x6c32('0x115')]=_0x552d3c[_0x6c32('0xa4')];_0x552d3c[_0x6c32('0x116')]=_0xe8c030[_0x6c32('0x116')];_0x552d3c[_0x6c32('0x117')]=_0xe8c030['calleridnum'];this[_0x6c32('0xc5')](_0x552d3c)[_0x6c32('0xac')](loggerCatch(_0x6c32('0x11c')));}}}}};Dialer['prototype'][_0x6c32('0x30')]=function(_0x3f1a36){if(this[_0x6c32('0x21')][_0x3f1a36[_0x6c32('0xd8')]]){this[_0x6c32('0x21')][_0x3f1a36['uniqueid']][_0x6c32('0xab')]=_0x3f1a36[_0x6c32('0xab')];}if(this[_0x6c32('0x22')][_0x3f1a36[_0x6c32('0xd8')]]){this[_0x6c32('0x22')][_0x3f1a36[_0x6c32('0xd8')]][_0x6c32('0xab')]=_0x3f1a36[_0x6c32('0xab')];}};Dialer['prototype']['syncQueueMember']=function(_0x4b46b2){if(strategy[this[_0x6c32('0x1c')][this[_0x6c32('0x21')][_0x4b46b2[_0x6c32('0x11d')]][_0x6c32('0xb0')]]['strategy']]===_0x6c32('0x18')){if(this[_0x6c32('0x21')][_0x4b46b2[_0x6c32('0x11d')]]&&_[_0x6c32('0xa8')](this[_0x6c32('0x21')][_0x4b46b2[_0x6c32('0x11d')]][_0x6c32('0x11e')])&&_0x4b46b2['status']==='1'&&_0x4b46b2[_0x6c32('0x11f')]==='0'){if(this[_0x6c32('0x1d')][_0x4b46b2[_0x6c32('0x120')]]){if(!this['agents'][_0x4b46b2[_0x6c32('0x120')]][_0x6c32('0x11e')]){this[_0x6c32('0x1d')][_0x4b46b2['stateinterface']][_0x6c32('0x11e')]=!![];this['actions'][_0x4b46b2[_0x6c32('0x11d')]][_0x6c32('0x11e')]=!![];this[_0x6c32('0x21')][_0x4b46b2['actionid']][_0x6c32('0x120')]=_0x4b46b2['stateinterface'];}}}}else if((strategy[this['voiceQueues'][this[_0x6c32('0x21')][_0x4b46b2[_0x6c32('0x11d')]][_0x6c32('0xb0')]][_0x6c32('0x44')]]||_0x6c32('0x17'))===_0x6c32('0x17')){if(this[_0x6c32('0x21')][_0x4b46b2[_0x6c32('0x11d')]]){if(this[_0x6c32('0x1d')][_0x4b46b2['stateinterface']]){this['actions'][_0x4b46b2[_0x6c32('0x11d')]][_0x6c32('0x120')]=_0x4b46b2[_0x6c32('0x120')];if(_[_0x6c32('0xa8')](this[_0x6c32('0x27')][this[_0x6c32('0x21')][_0x4b46b2[_0x6c32('0x11d')]][_0x6c32('0xb0')]])){this['queueBooked'][this[_0x6c32('0x21')][_0x4b46b2[_0x6c32('0x11d')]][_0x6c32('0xb0')]]=[];}this[_0x6c32('0x27')][this[_0x6c32('0x21')][_0x4b46b2[_0x6c32('0x11d')]][_0x6c32('0xb0')]]['push'](_[_0x6c32('0x88')](_[_0x6c32('0xca')](this[_0x6c32('0x21')][_0x4b46b2[_0x6c32('0x11d')]],[_0x6c32('0x121'),_0x6c32('0x120')]),{'status':_0x4b46b2[_0x6c32('0xaa')],'paused':_0x4b46b2[_0x6c32('0x11f')]}));}}}};function unlockQueueStatus(_0x445067,_0x44e6b4){setTimeout(function(){if(_[_0x6c32('0x35')](_0x445067[_0x6c32('0x122')])){loggerBooked[_0x6c32('0x92')]('[unlockQueueStatus][undefined]',_0x44e6b4);}_0x445067['queueStatusComplete']=!![];loggerBooked['info'](_0x6c32('0x123'),_0x44e6b4,JSON['stringify'](_[_0x6c32('0xca')](_0x445067,[_0x6c32('0x37'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x6c32('0xa5')][_0x6c32('0x32')]=function(_0x541bb8){var _0x3ebb73=this;var _0xc3cd75=_0x3ebb73['voiceQueues'][_0x3ebb73['actions'][_0x541bb8[_0x6c32('0x11d')]][_0x6c32('0xb0')]];if(strategy[this[_0x6c32('0x1c')][this[_0x6c32('0x21')][_0x541bb8[_0x6c32('0x11d')]][_0x6c32('0xb0')]][_0x6c32('0x44')]]==='roundrobin'){if(this[_0x6c32('0x21')][_0x541bb8['actionid']]&&this[_0x6c32('0x21')][_0x541bb8[_0x6c32('0x11d')]][_0x6c32('0x120')]){this[_0x6c32('0x1b')][_0x6c32('0x124')](this[_0x6c32('0x21')][_0x541bb8[_0x6c32('0x11d')]][_0x6c32('0x121')],this[_0x6c32('0x21')][_0x541bb8[_0x6c32('0x11d')]][_0x6c32('0x120')])[_0x6c32('0xac')](function(_0x420c25){logger['error'](_0x6c32('0x125'),util[_0x6c32('0x93')](_0x420c25,{'showHidden':![],'depth':null}));})['finally'](function(){_0x3ebb73[_0x6c32('0xae')](_0x3ebb73[_0x6c32('0x1c')][_0x3ebb73[_0x6c32('0x21')][_0x541bb8[_0x6c32('0x11d')]][_0x6c32('0xb0')]]);_0x3ebb73['agents'][_0x3ebb73[_0x6c32('0x21')][_0x541bb8[_0x6c32('0x11d')]]['stateinterface']][_0x6c32('0x11e')]=![];delete _0x3ebb73['actions'][_0x541bb8[_0x6c32('0x11d')]];unlockQueueStatus(_0xc3cd75);});}else{this[_0x6c32('0xae')](this['voiceQueues'][this[_0x6c32('0x21')][_0x541bb8['actionid']]['queue']]);this[_0x6c32('0xbc')]({'active':![],'ContactId':this[_0x6c32('0x21')][_0x541bb8[_0x6c32('0x11d')]][_0x6c32('0xcb')],'ListId':this['actions'][_0x541bb8[_0x6c32('0x11d')]][_0x6c32('0xcc')],'VoiceQueueId':this['actions'][_0x541bb8[_0x6c32('0x11d')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x6c32('0x21')][_0x541bb8[_0x6c32('0x11d')]][_0x6c32('0xcf')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x6c32('0x21')][_0x541bb8['actionid']];unlockQueueStatus(_0xc3cd75);}}else if((strategy[this[_0x6c32('0x1c')][this[_0x6c32('0x21')][_0x541bb8['actionid']][_0x6c32('0xb0')]]['strategy']]||_0x6c32('0x17'))==='rrmemory'){var _0x10b128;if(this[_0x6c32('0x21')][_0x541bb8[_0x6c32('0x11d')]]&&!_[_0x6c32('0x3c')](this[_0x6c32('0x27')][this['actions'][_0x541bb8[_0x6c32('0x11d')]]['queue']])){if(this[_0x6c32('0x28')][_0x3ebb73[_0x6c32('0x21')][_0x541bb8[_0x6c32('0x11d')]][_0x6c32('0xb0')]]){this[_0x6c32('0x28')][_0x3ebb73['actions'][_0x541bb8[_0x6c32('0x11d')]][_0x6c32('0xb0')]]=this[_0x6c32('0x28')][this[_0x6c32('0x21')][_0x541bb8[_0x6c32('0x11d')]][_0x6c32('0xb0')]]?this[_0x6c32('0x28')][this['actions'][_0x541bb8[_0x6c32('0x11d')]][_0x6c32('0xb0')]]:this[_0x6c32('0x27')][this[_0x6c32('0x21')][_0x541bb8[_0x6c32('0x11d')]][_0x6c32('0xb0')]]?this[_0x6c32('0x27')][this[_0x6c32('0x21')][_0x541bb8[_0x6c32('0x11d')]][_0x6c32('0xb0')]][_0x6c32('0x126')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x541bb8[_0x6c32('0x11d')]]['queue']][_0x6c32('0x126')]=this[_0x6c32('0x28')][this[_0x6c32('0x21')][_0x541bb8[_0x6c32('0x11d')]][_0x6c32('0xb0')]];for(var _0x37abd8=0x0;_0x37abd8=0x0;})[_0x6c32('0xac')](myreject(_0x3cf689)));}}else{_0x195fcc[_0x6c32('0x13f')](ami[_0x6c32('0xa9')]({'action':_0x6c32('0x140'),'command':util[_0x6c32('0x6f')](_0x6c32('0x141'),_0x12c4b0,!_[_0x6c32('0x35')](config['timezones'][_0x128ba8])?_0x128ba8:'')})[_0x6c32('0xb3')](function(_0x44aba2){return _0x44aba2[_0x6c32('0x144')]['indexOf']('true')>=0x0;})['catch'](myreject(_0x3cf689)));}BPromise[_0x6c32('0x147')](_0x195fcc)[_0x6c32('0xb3')](function(_0x539add){var _0x35d276=_[_0x6c32('0x148')](_0x539add);if(_0x35d276){return _0x27bf58(_0x35d276);}else{_0x23a132[_0x6c32('0x36')]=_0x467087?_0x6c32('0x149'):'INTERVAL_IS_OVERTIME';return _0x3cf689(msgResponse(_0x6c32('0x14a'),_0x6c32('0x138'),_0x6c32('0x14b')+_0x467087+'\x20'+_0x17b88b+'\x20Interval\x20is\x20overtime:\x20'+util[_0x6c32('0x93')](_0x12c4b0,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x128ba8));}})[_0x6c32('0xac')](function(_0x4c0914){return _0x3cf689(msgResponse('ifTime','Failure',JSON[_0x6c32('0x40')](_0x4c0914)));});});};Dialer[_0x6c32('0xa5')][_0x6c32('0x14c')]=function(_0x5698ff){var _0x49c8c5=this;return function(){switch(_0x5698ff[_0x6c32('0x52')]){case'progressive':freeVariablesPredictive(_0x5698ff);_0x49c8c5[_0x6c32('0x14d')](_0x5698ff,0x1);break;case _0x6c32('0x14e'):freeVariablesPredictive(_0x5698ff);_0x49c8c5[_0x6c32('0x14d')](_0x5698ff,_0x5698ff[_0x6c32('0x14f')]);break;case _0x6c32('0x9'):_0x49c8c5[_0x6c32('0x9')](_0x5698ff);break;case _0x6c32('0x150'):freeVariablesPredictive(_0x5698ff);_0x49c8c5[_0x6c32('0x14d')](_0x5698ff,0x1);break;default:freeVariablesPredictive(_0x5698ff);logger[_0x6c32('0x92')]('Queue',_0x5698ff[_0x6c32('0x37')],_0x6c32('0x151'));}};};Dialer[_0x6c32('0xa5')]['launchHandleIvr']=function(_0x5c7318){var _0x51c596=this;return function(){_0x51c596['handleIvr'](_0x5c7318);};};Dialer['prototype'][_0x6c32('0xb')]=function(_0x3f4b4d){var _0x480e4e=this;if(isNotPreview(_0x3f4b4d[_0x6c32('0x52')])){if(isVoiceQueueOutbound(_0x3f4b4d[_0x6c32('0x42')])&&isActive(_0x3f4b4d[_0x6c32('0x152')])){_0x3f4b4d['sendMessageOneNotActive']=!![];BPromise[_0x6c32('0xb2')]()[_0x6c32('0xb3')](checkIsLoggedIn(_0x3f4b4d,_0x3f4b4d[_0x6c32('0x47')]))[_0x6c32('0xb3')](checkIsActive(_0x3f4b4d,_0x3f4b4d[_0x6c32('0x152')]))[_0x6c32('0xb3')](checkInterval(_0x3f4b4d))['then'](_0x480e4e[_0x6c32('0x131')](_0x3f4b4d))[_0x6c32('0xb3')](_0x480e4e[_0x6c32('0x135')](_0x3f4b4d[_0x6c32('0x153')],_0x3f4b4d['dialTimezone'],_0x3f4b4d[_0x6c32('0x37')],_0x3f4b4d))['then'](_0x480e4e[_0x6c32('0x137')](_0x3f4b4d[_0x6c32('0x3b')],_0x3f4b4d[_0x6c32('0x154')],_0x3f4b4d[_0x6c32('0x37')],_0x3f4b4d))[_0x6c32('0xb3')](_0x480e4e[_0x6c32('0x14c')](_0x3f4b4d))[_0x6c32('0xac')](loggerCatchQueueSummary('[syncQueueSummary]',_0x3f4b4d));}else{notSendMessagesQueue(_0x3f4b4d);}}else{freeVariablesPredictive(_0x3f4b4d);}};Dialer['prototype'][_0x6c32('0x155')]=function(){var _0x4f8a82=this;var _0x2ca0bf;for(var _0x5bcd2b in this[_0x6c32('0xaf')]){if(typeof this['campaigns'][_0x5bcd2b]!==_0x6c32('0x95')){_0x2ca0bf=this[_0x6c32('0xaf')][_0x5bcd2b];if(isCampaignIvr(_0x2ca0bf[_0x6c32('0x42')])&&isActive(_0x2ca0bf[_0x6c32('0x6d')])){_0x2ca0bf[_0x6c32('0x9c')]=!![];BPromise[_0x6c32('0xb2')]()[_0x6c32('0xb3')](checkIsActive(_0x2ca0bf,_0x2ca0bf['active']))[_0x6c32('0xb3')](checkInterval(_0x2ca0bf))[_0x6c32('0xb3')](_0x4f8a82[_0x6c32('0x131')](_0x2ca0bf))[_0x6c32('0xb3')](_0x4f8a82[_0x6c32('0x135')](_0x2ca0bf[_0x6c32('0x153')],_0x2ca0bf[_0x6c32('0x154')],_0x2ca0bf[_0x6c32('0x37')],_0x2ca0bf))[_0x6c32('0xb3')](_0x4f8a82[_0x6c32('0x137')](_0x2ca0bf[_0x6c32('0x3b')],_0x2ca0bf[_0x6c32('0x154')],_0x2ca0bf['name'],_0x2ca0bf))[_0x6c32('0xb3')](_0x4f8a82[_0x6c32('0x156')](_0x2ca0bf))[_0x6c32('0xac')](loggerCatchQueueSummary(_0x6c32('0x157'),_0x2ca0bf));}else{notSendMessagesCampaign(_0x2ca0bf);}}}};function getCallerIdRandom(_0x40a1ae,_0x472041){var _0x1b9c05;var _0x157428;var _0x267e6d;if(_0x472041<=0x0){_0x472041=0x1;}_0x1b9c05=new RegExp(_0x6c32('0x158')+_0x472041+'}$');_0x157428=Math['pow'](0xa,_0x472041-0x1);_0x267e6d=Math[_0x6c32('0x159')](0xa,_0x472041)-0x1;return util[_0x6c32('0x6f')]('%s',_[_0x6c32('0x15a')](_0x40a1ae,_0x1b9c05,_[_0x6c32('0x15b')](_0x157428,_0x267e6d)));}function extractCalleridName(_0x135c9c){var _0xa79865=_0x135c9c[_0x6c32('0x15c')](/"(.*?)"/);return _0xa79865?_0xa79865[0x1]:_0x135c9c;}function extractCalleridNumber(_0x23655e){var _0x1679e0=_0x23655e[_0x6c32('0x15c')](/<(.*?)>/);return _0x1679e0?_0x1679e0[0x1]:_0x23655e;}Dialer['prototype'][_0x6c32('0x15d')]=function(_0x5a3d69,_0x559cbc){var _0x98b33e=this;var _0x1a1908=uuid['v4']();this[_0x6c32('0x21')][_0x1a1908]=new Action(_0x5a3d69,_0x559cbc,_0x1a1908);return new BPromise(function(_0x5b8edf,_0x22e92a){if(_[_0x6c32('0x35')](_0x5a3d69)&&typeof _0x5a3d69!=='object'){return _0x22e92a(msgResponse('originate',_0x6c32('0x138'),'voiceQueue\x20is\x20undefine'));}if(_[_0x6c32('0x35')](_0x559cbc[_0x6c32('0x15e')][_0x6c32('0x15f')])||_0x559cbc[_0x6c32('0x15e')][_0x6c32('0x15f')]===null){return _0x22e92a(msgResponse(_0x6c32('0x160'),_0x6c32('0x138'),_0x6c32('0x161')));}var _0x332d81={'XMD-CALLERID':_0x98b33e[_0x6c32('0x21')][_0x1a1908][_0x6c32('0x162')](),'XMD-AGI':_0x5a3d69[_0x6c32('0xff')]?util[_0x6c32('0x6f')](_0x6c32('0x163'),ipAgi,_0x5a3d69['dialQueueProject']):_0x6c32('0x164'),'XMD-AGIAFTER':_0x5a3d69[_0x6c32('0x165')]?util[_0x6c32('0x6f')](_0x6c32('0x163'),ipAgi,_0x5a3d69[_0x6c32('0x165')]):_0x6c32('0x164'),'XMD-QUEUE':_0x5a3d69['type']===_0x6c32('0x43')?util[_0x6c32('0x6f')](_0x6c32('0x166'),_0x5a3d69[_0x6c32('0x37')],_0x5a3d69[_0x6c32('0x167')]||'',_0x5a3d69[_0x6c32('0x105')]?'c':'',_0x5a3d69[_0x6c32('0x10d')]||0x3):_0x6c32('0x164'),'XMD-CONTACTID':_0x559cbc[_0x6c32('0xcb')],'XMD-CDRTYPE':_0x6c32('0x8'),'CALLERID(all)':_0x98b33e[_0x6c32('0x21')][_0x1a1908]['getCaller'](),'XMD-AMD':_0x5a3d69[_0x6c32('0xdb')]?'ACTIVE':_0x6c32('0x164'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x5a3d69[_0x6c32('0xdb')]){_0x332d81[_0x6c32('0x168')]=_0x5a3d69['dialAMDInitialSilence']||0x9c4;_0x332d81[_0x6c32('0x169')]=_0x5a3d69[_0x6c32('0x16a')]||0x5dc;_0x332d81[_0x6c32('0x16b')]=_0x5a3d69['dialAMDAfterGreetingSilence']||0x320;_0x332d81[_0x6c32('0x16c')]=_0x5a3d69[_0x6c32('0x16d')]||0x1388;_0x332d81[_0x6c32('0x16e')]=_0x5a3d69[_0x6c32('0x16f')]||0x64;_0x332d81[_0x6c32('0x170')]=_0x5a3d69[_0x6c32('0x171')]||0x32;_0x332d81['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x5a3d69[_0x6c32('0x172')]||0x3;_0x332d81[_0x6c32('0x173')]=_0x5a3d69[_0x6c32('0x174')]||0x100;_0x332d81['XMD-AMDMAXIMUMWORDLENGTH']=_0x5a3d69['dialAMDMaximumWordLength']||0x1388;}if(_0x5a3d69[_0x6c32('0x42')]===_0x6c32('0x43')){_0x332d81[_0x6c32('0x175')]=_0x559cbc[_0x6c32('0xce')];}else{_0x332d81[_0x6c32('0x176')]=_0x559cbc[_0x6c32('0xcf')];}for(var _0x254a2b in _0x559cbc[_0x6c32('0x15e')]){if(typeof _0x559cbc[_0x6c32('0x15e')][_0x254a2b]!=='undefined'){if(isNotNull(_0x559cbc['Contact'][_0x254a2b])&&_0x254a2b!=='id'&&_0x254a2b!==_0x6c32('0x177')&&_0x254a2b!==_0x6c32('0x178')&&_0x254a2b!==_0x6c32('0x179')){_0x332d81[util[_0x6c32('0x6f')](_0x6c32('0x17a'),_0x6c32('0x17b'),_['toUpper'](_0x254a2b))]=_0x559cbc[_0x6c32('0x15e')][_0x254a2b];}}}var _0x3c06e9=_0x98b33e['isTrunkReachable'](_0x5a3d69[_0x6c32('0x6c')])?getCallerId(_0x5a3d69[_0x6c32('0x6c')]['callerid'],_0x5a3d69[_0x6c32('0x53')],_0x5a3d69[_0x6c32('0x17c')]>0x0?getCallerIdRandom(_0x5a3d69[_0x6c32('0x54')],_0x5a3d69[_0x6c32('0x17c')]):_0x5a3d69[_0x6c32('0x54')]):getCallerId(_[_0x6c32('0xa8')](_0x5a3d69[_0x6c32('0x132')])?_0x5a3d69[_0x6c32('0x6c')][_0x6c32('0x6e')]:_0x5a3d69[_0x6c32('0x132')][_0x6c32('0x6e')],_0x5a3d69['dialOriginateCallerIdName'],_0x5a3d69[_0x6c32('0x17c')]>0x0?getCallerIdRandom(_0x5a3d69[_0x6c32('0x54')],_0x5a3d69[_0x6c32('0x17c')]):_0x5a3d69[_0x6c32('0x54')]);if(_0x3c06e9){_0x332d81[_0x6c32('0x17d')]=_0x98b33e[_0x6c32('0x21')][_0x1a1908][_0x6c32('0x17e')]=extractCalleridName(_0x3c06e9);_0x332d81[_0x6c32('0x17f')]=_0x98b33e['actions'][_0x1a1908][_0x6c32('0x180')]=extractCalleridNumber(_0x3c06e9);}return ami[_0x6c32('0xa9')]({'actionid':_0x1a1908,'action':_0x6c32('0x160'),'channel':_0x98b33e[_0x6c32('0xd3')](_0x5a3d69['Trunk'])?util[_0x6c32('0x6f')](_0x6c32('0x181'),_0x5a3d69[_0x6c32('0x6c')][_0x6c32('0x37')],isNotNull(_0x5a3d69[_0x6c32('0x56')])?_0x5a3d69['dialPrefix']['trim']()||'':'',_0x5a3d69['dialCutDigit']>0x0?_0x559cbc[_0x6c32('0x15e')][_0x6c32('0x15f')][_0x6c32('0x182')](_0x5a3d69[_0x6c32('0x183')]):_0x559cbc['Contact'][_0x6c32('0x15f')]):util['format'](_0x6c32('0x181'),_['isNil'](_0x5a3d69[_0x6c32('0x132')])?_0x5a3d69[_0x6c32('0x6c')][_0x6c32('0x37')]:_0x5a3d69[_0x6c32('0x132')][_0x6c32('0x37')],isNotNull(_0x5a3d69[_0x6c32('0x56')])?_0x5a3d69['dialPrefix'][_0x6c32('0x184')]()||'':'',_0x5a3d69[_0x6c32('0x183')]>0x0?_0x559cbc[_0x6c32('0x15e')][_0x6c32('0x15f')][_0x6c32('0x182')](_0x5a3d69[_0x6c32('0x183')]):_0x559cbc[_0x6c32('0x15e')]['phone']),'callerid':_0x3c06e9,'Exten':_0x6c32('0x185'),'Context':_0x6c32('0x186'),'Priority':'1','variable':_0x332d81,'timeout':(_0x5a3d69[_0x6c32('0x55')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1a1908})[_0x6c32('0xb3')](function(_0x75e087){return _0x5b8edf(_0x75e087);})[_0x6c32('0xac')](function(_0x12bc83){_0x5a3d69['outboundOriginateFailureCallsDay']+=0x1;var _0x4d58c2=new History(_0x98b33e['actions'][_0x1a1908]);logger[_0x6c32('0x92')](util[_0x6c32('0x6f')](_0x6c32('0x187'),JSON[_0x6c32('0x40')](_0x12bc83)));_0x4d58c2[_0x6c32('0xa3')]=0xe;_0x4d58c2[_0x6c32('0xde')]=_0x6c32('0x188');_0x4d58c2[_0x6c32('0xa4')]=moment()[_0x6c32('0x6f')](_0x6c32('0xf3'));_0x4d58c2[_0x6c32('0x115')]=_0x4d58c2[_0x6c32('0xa4')];_0x98b33e['createHistory'](_0x4d58c2)['catch'](loggerCatch(_0x6c32('0x189')));_0x98b33e[_0x6c32('0xc3')](_0x4d58c2)[_0x6c32('0xac')](loggerCatch(_0x6c32('0x189')))[_0x6c32('0x18a')](function(){delete _0x98b33e[_0x6c32('0x21')][_0x1a1908];return _0x22e92a(msgResponse(_0x6c32('0x160'),_0x6c32('0x3f'),_0x6c32('0x18b')));});});});};Dialer[_0x6c32('0xa5')]['syncOriginateResponse']=function(_0x2abe96){var _0x2f6507=this[_0x6c32('0x21')][_0x2abe96[_0x6c32('0x11d')]];if(_0x2f6507){delete this[_0x6c32('0x21')][_0x2abe96[_0x6c32('0x11d')]];_0x2f6507['responsetime']=moment()[_0x6c32('0x6f')](_0x6c32('0xf3'));var _0x5f59ed=_0x2f6507['type']===_0x6c32('0x8e')?this[_0x6c32('0xaf')][_0x2f6507[_0x6c32('0xb0')]]:this[_0x6c32('0x1c')][_0x2f6507[_0x6c32('0x18c')]()];if(!this[_0x6c32('0xd1')](_0x2abe96['response'])){this['updateOriginated'](_0x5f59ed);return this[_0x6c32('0x18d')](_0x2f6507,_0x5f59ed,_0x2abe96)[_0x6c32('0xac')](loggerCatch('[callProgressDetecting]\x20'));}this['uniqueId'][_0x2abe96['uniqueid']]=_0x2f6507;}};Dialer[_0x6c32('0xa5')][_0x6c32('0x18e')]=function(_0x3ee3bd,_0x2c7351,_0xada7f6){var _0xd7158a=new History(_0x2c7351);if(_0xd7158a[_0x6c32('0xe6')]+_0xd7158a[_0x6c32('0xe7')]+_0xd7158a[_0x6c32('0xe8')]+_0xd7158a[_0x6c32('0xfa')]+_0xd7158a[_0x6c32('0xe9')]+_0xd7158a[_0x6c32('0xea')]+_0xd7158a[_0x6c32('0xeb')]+_0xd7158a['countagentrejectretry']>=_0xada7f6[_0x6c32('0xfb')]-0x1){return!![];}switch(_0x3ee3bd){case 0x3:if(_0xd7158a[_0x6c32('0xe8')]>=_0xada7f6[_0x6c32('0x18f')]-0x1){return!![];}this[_0x6c32('0xbc')]({'active':![],'countnoanswerretry':_0xd7158a[_0x6c32('0xe8')]+=0x1,'scheduledat':moment()[_0x6c32('0xf1')](_0xada7f6[_0x6c32('0x190')],'minutes')[_0x6c32('0x6f')](_0x6c32('0xf3')),'ContactId':_0xd7158a[_0x6c32('0xcb')],'ListId':_0xd7158a['ListId'],'VoiceQueueId':_0xd7158a[_0x6c32('0xce')]||undefined,'CampaignId':_0xd7158a['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0xd7158a[_0x6c32('0xe6')]>=_0xada7f6['dialBusyMaxRetry']-0x1){return!![];}this[_0x6c32('0xbc')]({'active':![],'countbusyretry':_0xd7158a['countbusyretry']+=0x1,'scheduledat':moment()[_0x6c32('0xf1')](_0xada7f6['dialBusyRetryFrequency'],_0x6c32('0xf2'))[_0x6c32('0x6f')](_0x6c32('0xf3')),'ContactId':_0xd7158a[_0x6c32('0xcb')],'ListId':_0xd7158a['ListId'],'VoiceQueueId':_0xd7158a[_0x6c32('0xce')]||undefined,'CampaignId':_0xd7158a[_0x6c32('0xcf')]||undefined})['catch'](loggerCatch(_0x6c32('0x191')));break;case 0x8:if(_0xd7158a[_0x6c32('0xe7')]>=_0xada7f6['dialCongestionMaxRetry']-0x1){return!![];}this[_0x6c32('0xbc')]({'active':![],'countcongestionretry':_0xd7158a[_0x6c32('0xe7')]+=0x1,'scheduledat':moment()['add'](_0xada7f6[_0x6c32('0x192')],_0x6c32('0xf2'))[_0x6c32('0x6f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xd7158a[_0x6c32('0xcb')],'ListId':_0xd7158a[_0x6c32('0xcc')],'VoiceQueueId':_0xd7158a[_0x6c32('0xce')]||undefined,'CampaignId':_0xd7158a[_0x6c32('0xcf')]||undefined})[_0x6c32('0xac')](loggerCatch(_0x6c32('0x193')));break;case 0x0:if(_0xd7158a[_0x6c32('0xfa')]>=_0xada7f6[_0x6c32('0x194')]-0x1){return!![];}else{this[_0x6c32('0xbc')]({'active':![],'countnosuchnumberretry':_0xd7158a['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x6c32('0xf1')](_0xada7f6[_0x6c32('0x195')],'minutes')[_0x6c32('0x6f')](_0x6c32('0xf3')),'ContactId':_0xd7158a[_0x6c32('0xcb')],'ListId':_0xd7158a[_0x6c32('0xcc')],'VoiceQueueId':_0xd7158a[_0x6c32('0xce')]||undefined,'CampaignId':_0xd7158a[_0x6c32('0xcf')]||undefined})[_0x6c32('0xac')](loggerCatch(_0x6c32('0x196')));}break;case 0xa:if(_0xd7158a['countdropretry']>=_0xada7f6[_0x6c32('0x112')]-0x1){return!![];}this[_0x6c32('0xbc')]({'active':![],'countdropretry':_0xd7158a['countdropretry']+=0x1,'scheduledat':moment()[_0x6c32('0xf1')](_0xada7f6[_0x6c32('0x197')],_0x6c32('0xf2'))[_0x6c32('0x6f')](_0x6c32('0xf3')),'ContactId':_0xd7158a[_0x6c32('0xcb')],'ListId':_0xd7158a[_0x6c32('0xcc')],'VoiceQueueId':_0xd7158a['VoiceQueueId']||undefined,'CampaignId':_0xd7158a[_0x6c32('0xcf')]||undefined})[_0x6c32('0xac')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0xd7158a[_0x6c32('0xea')]>=_0xada7f6[_0x6c32('0x11a')]-0x1){return!![];}this[_0x6c32('0xbc')]({'active':![],'countabandonedretry':_0xd7158a[_0x6c32('0xea')]+=0x1,'scheduledat':moment()[_0x6c32('0xf1')](_0xada7f6[_0x6c32('0x11b')],'minutes')[_0x6c32('0x6f')](_0x6c32('0xf3')),'ContactId':_0xd7158a[_0x6c32('0xcb')],'ListId':_0xd7158a['ListId'],'VoiceQueueId':_0xd7158a[_0x6c32('0xce')]||undefined,'CampaignId':_0xd7158a[_0x6c32('0xcf')]||undefined})[_0x6c32('0xac')](loggerCatch(_0x6c32('0x198')));break;case 0x13:if(_0xd7158a[_0x6c32('0xeb')]>=_0xada7f6[_0x6c32('0xef')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0xd7158a[_0x6c32('0xeb')]+=0x1,'scheduledat':moment()[_0x6c32('0xf1')](_0xada7f6['dialMachineRetryFrequency'],_0x6c32('0xf2'))['format'](_0x6c32('0xf3')),'ContactId':_0xd7158a[_0x6c32('0xcb')],'ListId':_0xd7158a[_0x6c32('0xcc')],'VoiceQueueId':_0xd7158a[_0x6c32('0xce')]||undefined,'CampaignId':_0xd7158a[_0x6c32('0xcf')]||undefined})[_0x6c32('0xac')](loggerCatch(_0x6c32('0xf4')));break;case 0x14:if(_0xd7158a[_0x6c32('0xec')]>=_0xada7f6[_0x6c32('0x199')]-0x1){return!![];}this[_0x6c32('0xbc')]({'active':![],'countagentrejectretry':_0xd7158a[_0x6c32('0xec')]+=0x1,'scheduledat':moment()['add'](_0xada7f6[_0x6c32('0x19a')],_0x6c32('0xf2'))[_0x6c32('0x6f')](_0x6c32('0xf3')),'ContactId':_0xd7158a[_0x6c32('0xcb')],'ListId':_0xd7158a[_0x6c32('0xcc')],'VoiceQueueId':_0xd7158a[_0x6c32('0xce')]||undefined,'CampaignId':_0xd7158a[_0x6c32('0xcf')]||undefined})['catch'](loggerCatch(_0x6c32('0x19b')));break;default:return!![];}};Dialer['prototype'][_0x6c32('0x18d')]=function(_0x2bedc6,_0xb94109,_0x69302e){var _0x4e4279=this;var _0x18bef=new History(_0x2bedc6);return new BPromise(function(_0x4e35d9,_0x2c79bd){if(_['isUndefined'](_0xb94109)&&typeof _0xb94109!==_0x6c32('0x19c')){return _0x2c79bd(msgResponse('[callProgressDetecting]',_0x6c32('0x138'),'entity\x20is\x20undefine'));}if(_[_0x6c32('0x35')](_0x69302e)&&typeof _0x69302e!=='object'){return _0x2c79bd(msgResponse(_0x6c32('0x19d'),_0x6c32('0x138'),_0x6c32('0x19e')));}switch(_0x69302e[_0x6c32('0x103')]){case'0':_0xb94109[_0x6c32('0x5d')]+=0x1;_0x18bef['state']=0x0;_0x18bef[_0x6c32('0xde')]=_0x6c32('0x19f');_0x18bef[_0x6c32('0xfa')]+=0x1;_0x18bef['countglobal']+=0x1;ami['emit'](_0x6c32('0x1a0'),ut[_0x6c32('0x1a1')](_0x2bedc6,_0x6c32('0x1a2')));_0x4e4279[_0x6c32('0xc5')](_0x18bef)[_0x6c32('0xac')](loggerCatch(_0x6c32('0xe5')));if(_0x4e4279[_0x6c32('0x18e')](0x0,_0x2bedc6,_0xb94109)){if(_0x18bef['countnosuchnumberretry']>=_0xb94109[_0x6c32('0x194')]){_0x4e4279['createStateFinal'](_0x18bef,_0x4e35d9,_0x2c79bd,_0x6c32('0x1a3'));}else{_0x4e4279['stateGlobal'](_0x18bef,_0x4e35d9,_0x2c79bd,_0x6c32('0x1a3'));}}break;case'3':_0xb94109[_0x6c32('0x1a4')]+=0x1;_0x18bef[_0x6c32('0xa3')]=0x3;_0x18bef['statedesc']=_0x6c32('0x1a5');_0x18bef[_0x6c32('0xe8')]+=0x1;_0x18bef[_0x6c32('0xe4')]+=0x1;ami[_0x6c32('0x1a6')](_0x6c32('0x1a7'),ut[_0x6c32('0x1a1')](_0x2bedc6,'noanswer'));_0x4e4279[_0x6c32('0xc5')](_0x18bef)['catch'](loggerCatch(_0x6c32('0x1a8')));if(_0x4e4279[_0x6c32('0x18e')](0x3,_0x2bedc6,_0xb94109)){if(_0x18bef[_0x6c32('0xe8')]>=_0xb94109[_0x6c32('0x18f')]){_0x4e4279[_0x6c32('0xfc')](_0x18bef,_0x4e35d9,_0x2c79bd,'reason\x203\x20ringing\x20no\x20answer');}else{_0x4e4279[_0x6c32('0xed')](_0x18bef,_0x4e35d9,_0x2c79bd,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0xb94109[_0x6c32('0x59')]+=0x1;_0x18bef['state']=0x5;_0x18bef[_0x6c32('0xde')]='Busy';_0x18bef[_0x6c32('0xe6')]+=0x1;_0x18bef[_0x6c32('0xe4')]+=0x1;ami['emit'](_0x6c32('0x1a9'),ut['buildObj'](_0x2bedc6,_0x6c32('0x1aa')));_0x4e4279['createHistory'](_0x18bef)[_0x6c32('0xac')](loggerCatch(_0x6c32('0x1ab')));if(_0x4e4279['checkRetriveMax'](0x5,_0x2bedc6,_0xb94109)){if(_0x18bef[_0x6c32('0xe6')]>=_0xb94109[_0x6c32('0x1ac')]){_0x4e4279['createStateFinal'](_0x18bef,_0x4e35d9,_0x2c79bd,_0x6c32('0x1ad'));}else{_0x4e4279['stateGlobal'](_0x18bef,_0x4e35d9,_0x2c79bd,_0x6c32('0x1ad'));}}break;case'8':_0xb94109[_0x6c32('0x5a')]+=0x1;_0x18bef[_0x6c32('0xa3')]=0x8;_0x18bef['statedesc']=_0x6c32('0x1ae');_0x18bef[_0x6c32('0xe7')]+=0x1;_0x18bef['countglobal']+=0x1;ami[_0x6c32('0x1a6')]('custom:agentcongestion',ut[_0x6c32('0x1a1')](_0x2bedc6,_0x6c32('0x1af')));_0x4e4279['createHistory'](_0x18bef)['catch'](loggerCatch(_0x6c32('0x1b0')));if(_0x4e4279[_0x6c32('0x18e')](0x8,_0x2bedc6,_0xb94109)){if(_0x18bef[_0x6c32('0xe7')]>=_0xb94109[_0x6c32('0x1b1')]){_0x4e4279[_0x6c32('0xfc')](_0x18bef,_0x4e35d9,_0x2c79bd,'reason\x208\x20congestion');}else{_0x4e4279['stateGlobal'](_0x18bef,_0x4e35d9,_0x2c79bd,_0x6c32('0x1b2'));}}break;case'11':_0xb94109['outboundAbandonedCallsDay']+=0x1;_0x18bef[_0x6c32('0xa3')]=0xb;_0x18bef[_0x6c32('0xde')]=_0x6c32('0x118');_0x18bef['countabandonedretry']+=0x1;_0x18bef[_0x6c32('0xe4')]+=0x1;_0x4e4279[_0x6c32('0xc5')](_0x18bef)[_0x6c32('0xac')](loggerCatch(_0x6c32('0x11c')));if(_0x4e4279['checkRetriveMax'](0xb,_0x2bedc6,_0xb94109)){if(_0x18bef[_0x6c32('0xea')]>=_0xb94109['dialAbandonedMaxRetry']){_0x4e4279[_0x6c32('0xfc')](_0x18bef,_0x4e35d9,_0x2c79bd,_0x6c32('0x1b3'));}else{_0x4e4279[_0x6c32('0xed')](_0x18bef,_0x4e35d9,_0x2c79bd,_0x6c32('0x1b3'));}}break;case'20':_0xb94109[_0x6c32('0x5e')]+=0x1;_0x18bef['state']=0x14;_0x18bef['statedesc']=_0x6c32('0x1b4');_0x18bef[_0x6c32('0xec')]+=0x1;_0x18bef['countglobal']+=0x1;ami['emit'](_0x6c32('0x1b5'),ut[_0x6c32('0x1a1')](_0x2bedc6,_0x6c32('0x1b6')));_0x4e4279['createHistory'](_0x18bef)[_0x6c32('0xac')](loggerCatch(_0x6c32('0x1b7')));if(_0x4e4279[_0x6c32('0x18e')](0x14,_0x2bedc6,_0xb94109)){if(_0x18bef[_0x6c32('0xec')]>=_0xb94109[_0x6c32('0x199')]){_0x4e4279['createStateFinal'](_0x18bef,_0x4e35d9,_0x2c79bd,_0x6c32('0x1b8'));}else{_0x4e4279[_0x6c32('0xed')](_0x18bef,_0x4e35d9,_0x2c79bd,_0x6c32('0x1b8'));}}break;default:_0xb94109['outboundUnknownCallsDay']+=0x1;_0x18bef[_0x6c32('0xa3')]=0xc;_0x18bef[_0x6c32('0xde')]=_0x69302e['reason'];_0x4e4279[_0x6c32('0xc5')](_0x18bef)[_0x6c32('0xac')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x4e4279[_0x6c32('0x18e')](_0x69302e[_0x6c32('0x103')],_0x2bedc6,_0xb94109)){if(_0x18bef[_0x6c32('0xe6')]+_0x18bef[_0x6c32('0xe7')]+_0x18bef[_0x6c32('0xe8')]+_0x18bef[_0x6c32('0xfa')]+_0x18bef[_0x6c32('0xe9')]+_0x18bef['countabandonedretry']+_0x18bef[_0x6c32('0xeb')]+_0x18bef[_0x6c32('0xec')]>=_0xb94109[_0x6c32('0xfb')]){_0x4e4279[_0x6c32('0xed')](_0x18bef,_0x4e35d9,_0x2c79bd,_0x69302e[_0x6c32('0x103')]);}else{_0x4e4279['createStateFinal'](_0x18bef,_0x4e35d9,_0x2c79bd,_0x69302e[_0x6c32('0x103')]);}}}});};Dialer[_0x6c32('0xa5')][_0x6c32('0xed')]=function(_0x126944,_0x4fe058,_0x4d9853,_0x513ae7){var _0xba4c45=new Final(_0x126944);_0xba4c45[_0x6c32('0xa3')]=0xf;_0xba4c45[_0x6c32('0xde')]='Global';this[_0x6c32('0xfc')](_0xba4c45,_0x4fe058,_0x4d9853,_0x513ae7);};Dialer[_0x6c32('0xa5')][_0x6c32('0xfc')]=function(_0x4c7383,_0x4b6533,_0x19d169,_0x3da607){this[_0x6c32('0xc3')](_0x4c7383)['then'](function(){return _0x4b6533(msgResponse(_0x6c32('0x19d'),'Success',_0x3da607));})[_0x6c32('0xac')](function(){return _0x19d169(msgResponse('[moveContactManagedDialer][0]',_0x6c32('0x138'),_0x6c32('0x1b9')));});};Dialer[_0x6c32('0xa5')][_0x6c32('0x9')]=function(_0xf4df75){var _0x154d8=_0xf4df75[_0x6c32('0x1ba')]/0x64;var _0xbcddca=_0xf4df75[_0x6c32('0x10e')]/(_0xf4df75['outboundDropCallsDayTimeout']+_0xf4df75[_0x6c32('0x57')]);var _0x4fae58=Math[_0x6c32('0x1bb')](_0xf4df75[_0x6c32('0x1bc')]*(_0xf4df75['predictiveIntervalMaxThreshold']/0x64));var _0x3aae8c=Math[_0x6c32('0x1bb')](_0xf4df75[_0x6c32('0x1bc')]*(_0xf4df75[_0x6c32('0x1bd')]/0x64));var _0x37e539=_0xf4df75[_0x6c32('0x46')]+_0xf4df75[_0x6c32('0x4c')];var _0x11b777=Math[_0x6c32('0x1be')](_0xf4df75[_0x6c32('0x83')]*_0xf4df75[_0x6c32('0x86')]*_0xf4df75[_0x6c32('0x65')]*_0xf4df75[_0x6c32('0x66')]);if(_[_0x6c32('0x35')](_0xf4df75[_0x6c32('0x25')])){if(!_[_0x6c32('0x35')](_0xf4df75[_0x6c32('0x24')])){_0xf4df75[_0x6c32('0x24')]=undefined;loggerPredictive[_0x6c32('0x92')](_0x6c32('0x1bf'),_0x6c32('0x1c0'));}if(!_['isUndefined'](_0xf4df75['handlePredictive'])){loggerPredictive[_0x6c32('0x92')]('[startMethodPredictive][StartProgressive]',_0x6c32('0x1c1'));clearInterval(_0xf4df75[_0x6c32('0x8c')]);_0xf4df75[_0x6c32('0x8c')]=undefined;}_0xf4df75[_0x6c32('0x25')]=moment()[_0x6c32('0x6f')](_0x6c32('0xf3'));loggerPredictive['info'](_0xf4df75[_0x6c32('0x37')],'collection\x20data\x20in\x20progressive\x20at',_0xf4df75['startProgressive']);this['handlePower'](_0xf4df75,0x1);}else if(ifInterval(_0xf4df75[_0x6c32('0x1c2')],_0xf4df75[_0x6c32('0x25')])){this[_0x6c32('0x14d')](_0xf4df75,0x1);loggerPredictiveCalls['info'](_0x6c32('0x1c3'),_0xf4df75['startProgressive'],_0xf4df75[_0x6c32('0x37')]);_0xf4df75[_0x6c32('0x83')]=0x0;_0xf4df75['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x154d8<_0xbcddca&&_0xf4df75[_0x6c32('0x1c4')]===_0x6c32('0x1c5')){freeVariablesPredictive(_0xf4df75);loggerPredictive['info'](_0x6c32('0x1c6'),_0x6c32('0x1c7'),_0xbcddca,_0x6c32('0x25'),_0xf4df75[_0x6c32('0x37')]);}else if(_0x11b777<_0xf4df75['predictiveIntervalErlangCallsDroppedCalls']&&_0xf4df75[_0x6c32('0x1c4')]==='dropRate'){freeVariablesPredictive(_0xf4df75);loggerPredictive[_0x6c32('0x74')](_0x6c32('0x1c8'),_0x6c32('0x1c9'),_0x11b777,_0x6c32('0x1ca'),_0xf4df75['predictiveIntervalErlangCallsDroppedCalls'],_0x6c32('0x25'),_0xf4df75[_0x6c32('0x37')]);}else if(!ifInterval(_0xf4df75[_0x6c32('0x1c2')],_0xf4df75['startProgressive'])&&_['isUndefined'](_0xf4df75['startPredictive'])&&!_[_0x6c32('0x35')](_0xf4df75[_0x6c32('0x25')])){_0xf4df75['startPredictive']=moment()['format'](_0x6c32('0xf3'));loggerPredictive['info'](_0xf4df75[_0x6c32('0x37')],_0x6c32('0x1cb'),_0xf4df75['startPredictive']);this[_0x6c32('0xb9')](_0xf4df75[_0x6c32('0x1c2')])[_0x6c32('0xb3')](this[_0x6c32('0x1cc')](_0xf4df75))['then'](mergeDataErlangB(_0xf4df75))[_0x6c32('0xb3')](this['startMethodPredictive'](_0xf4df75))['catch'](loggerCatchPredictive(_0x6c32('0x1cd'),_0xf4df75));}else if(!ifInterval(_0xf4df75['dialPredictiveInterval'],_0xf4df75['startPredictive'])){_0xf4df75[_0x6c32('0x64')]=0x0;_0xf4df75['startPredictive']=moment()['format'](_0x6c32('0xf3'));loggerPredictive[_0x6c32('0x74')](_0xf4df75[_0x6c32('0x37')],'recalculate\x20predictive\x20at',_0xf4df75[_0x6c32('0x24')]);clearInterval(_0xf4df75['handlePredictive']);_0xf4df75[_0x6c32('0x8c')]=undefined;this['averageHandleTime'](_0xf4df75[_0x6c32('0x1c2')])[_0x6c32('0xb3')](this[_0x6c32('0x1cc')](_0xf4df75))['then'](mergeDataErlangB(_0xf4df75))['then'](this[_0x6c32('0x1ce')](_0xf4df75))['catch'](loggerCatchPredictive(_0x6c32('0x1cf'),_0xf4df75));}else if(_0xf4df75[_0x6c32('0x1bc')]&&_0x37e539<_0xf4df75[_0x6c32('0x1bc')]-_0x3aae8c){freeVariablesPredictive(_0xf4df75);loggerPredictive[_0x6c32('0x74')](_0xf4df75['name'],_0x6c32('0x1d0'),_0x37e539,')\x20are\x20less\x20than\x20threshold\x20(',_0xf4df75['predictiveIntervalAvailable'],'-',_0x3aae8c,'=',_0xf4df75[_0x6c32('0x1bc')]-_0x3aae8c,')');}else if(_0xf4df75[_0x6c32('0x1bc')]&&_0x37e539>_0xf4df75[_0x6c32('0x1bc')]+_0x4fae58){freeVariablesPredictive(_0xf4df75);loggerPredictive[_0x6c32('0x74')](_0xf4df75[_0x6c32('0x37')],_0x6c32('0x1d0'),_0x37e539,_0x6c32('0x1d1'),_0xf4df75[_0x6c32('0x1bc')],'+',_0x4fae58,'=',_0xf4df75[_0x6c32('0x1bc')]+_0x4fae58,')');}};Dialer[_0x6c32('0xa5')][_0x6c32('0x1cc')]=function(_0x1b0c8e){var _0x1f32ba=this;return function(_0x49481e){return new BPromise(function(_0x4ce545,_0x2e914b){_[_0x6c32('0x88')](_0x1b0c8e,_0x49481e[0x0]);if(checkGetDataPredictive(_0x49481e[0x0])){var _0x200972=_0x1b0c8e[_0x6c32('0x1bc')]=_0x1b0c8e[_0x6c32('0x4c')]+_0x1b0c8e[_0x6c32('0x46')];var _0x51b212=_0x1b0c8e[_0x6c32('0x1c2')]*0x3c;var _0x2851c2=_0x49481e[0x0][_0x6c32('0x60')]+_0x49481e[0x0]['predictiveIntervalAvgHoldtime'];var _0x5391e2=(_0x49481e[0x0][_0x6c32('0x77')]+_0x49481e[0x0][_0x6c32('0x62')]+_0x49481e[0x0][_0x6c32('0x61')])/_0x49481e[0x0]['predictiveIntervalTotalCalls'];_0x1b0c8e['predictiveIntervalHitRate']=_0x5391e2>0x0?_0x5391e2:0x1;switch(_0x1b0c8e[_0x6c32('0x1c4')]){case _0x6c32('0x1c5'):var _0x337e79=_0x1b0c8e[_0x6c32('0x1ba')]/0x64;return _0x1f32ba[_0x6c32('0x1d2')](_0x200972,_0x51b212,_0x2851c2,_0x5391e2,_0x337e79)[_0x6c32('0xb3')](function(_0x2a2455){return _0x4ce545(_0x2a2455);});case'agentBusyFactor':var _0x197014=_0x1b0c8e['dialPredictiveOptimizationPercentage']/0x64;return _0x1f32ba['busyFactor'](_0x200972,_0x51b212,_0x2851c2,_0x5391e2,_0x197014)[_0x6c32('0xb3')](function(_0x963c46){return _0x4ce545(_0x963c46);});default:return _0x2e914b(msgResponse(_0x6c32('0x1d3'),_0x6c32('0x138'),_0x6c32('0x1d4')));}}else{return _0x2e914b(msgResponse(_0x6c32('0x1d3'),_0x6c32('0x138'),'check\x20failure'));}});};};Dialer[_0x6c32('0xa5')][_0x6c32('0x1d5')]=function(_0x13db43){var _0x582588=this;return function(_0x325929){return new BPromise(function(_0x565a0,_0x8d2c9e){_['merge'](_0x13db43,_0x325929[0x0]);if(checkGetDataPredictive(_0x325929[0x0])){loggerPredictive['info'](JSON['stringify'](_0x325929[0x0]));if(_0x13db43[_0x6c32('0x1c4')]===_0x6c32('0x1c5')){return _0x582588['getVoiceQueueRtPauses'](_0x13db43['id'])['then'](function(_0x5ca413){var _0x40c065=_0x13db43[_0x6c32('0x47')]-_0x5ca413[0x0]['outboundQueuePauses'];var _0x82e792=_0x13db43[_0x6c32('0x1c2')]*0x3c;var _0x3b5be4=_0x325929[0x0][_0x6c32('0x60')]+_0x325929[0x0][_0x6c32('0x7b')];var _0x5342ad=(_0x325929[0x0][_0x6c32('0x77')]+_0x325929[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x325929[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x325929[0x0][_0x6c32('0x68')];var _0x8e818c=_0x13db43['dialPredictiveOptimizationPercentage']/0x64;_0x13db43[_0x6c32('0x67')]=_0x5ca413[0x0][_0x6c32('0x1d6')]||0x0;_0x13db43['predictiveIntervalHitRate']=_0x5342ad>0x0?_0x5342ad:0x1;return _0x582588[_0x6c32('0x1d2')](_0x40c065,_0x82e792,_0x3b5be4,_0x5342ad,_0x8e818c);})['then'](function(_0x2ef2a0){return _0x565a0(_0x2ef2a0);})[_0x6c32('0xac')](function(_0x27ebb7){return _0x8d2c9e(msgResponse(_0x6c32('0x1d7'),_0x6c32('0x138'),JSON[_0x6c32('0x40')](_0x27ebb7)));});}if(_0x13db43[_0x6c32('0x1c4')]===_0x6c32('0x1d8')){return _0x582588[_0x6c32('0xc1')](_0x13db43['id'])[_0x6c32('0xb3')](function(_0x50c4ed){var _0x529829=_0x13db43['loggedIn']-_0x50c4ed[0x0][_0x6c32('0x1d6')];var _0x422413=_0x13db43[_0x6c32('0x1c2')]*0x3c;var _0x2f329b=_0x325929[0x0][_0x6c32('0x60')]+_0x325929[0x0][_0x6c32('0x7b')];var _0x25c158=(_0x325929[0x0][_0x6c32('0x77')]+_0x325929[0x0][_0x6c32('0x62')]+_0x325929[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x325929[0x0][_0x6c32('0x68')];var _0x30c21b=_0x13db43[_0x6c32('0x1ba')]/0x64;_0x13db43['predictiveIntervalPauses']=_0x50c4ed[0x0][_0x6c32('0x1d6')]||0x0;_0x13db43['predictiveIntervalHitRate']=_0x25c158>0x0?_0x25c158:0x1;return _0x582588[_0x6c32('0x1d9')](_0x529829,_0x422413,_0x2f329b,_0x25c158,_0x30c21b);})[_0x6c32('0xb3')](function(_0xc37189){return _0x565a0(_0xc37189);})[_0x6c32('0xac')](function(_0x3b9a34){return _0x8d2c9e(msgResponse(_0x6c32('0x1d7'),_0x6c32('0x138'),JSON['stringify'](_0x3b9a34)));});}}else{return _0x8d2c9e(msgResponse(_0x6c32('0x1d3'),_0x6c32('0x138'),_0x6c32('0x1da')));}});};};Dialer[_0x6c32('0xa5')][_0x6c32('0x1ce')]=function(_0x24cae2){var _0x3f6edc=this;return function(){var _0x3faddc=0x0;var _0x5d3d28=Math['floor'](_0x24cae2[_0x6c32('0x6a')]*0x3e8);if(_0x5d3d28>0x0){_0x5d3d28=_0x5d3d28<0x64?0x64:_0x5d3d28;loggerPredictive[_0x6c32('0x74')](_0x24cae2[_0x6c32('0x37')],_0x6c32('0x1db'),_0x5d3d28,_0x6c32('0x89'));_0x24cae2[_0x6c32('0x8c')]=setInterval(function(){_0x3f6edc[_0x6c32('0x8c')](_0x24cae2);loggerPredictiveCalls['info'](_0x6c32('0x1dc'),_0x3faddc+=0x1);},_0x5d3d28);}else{loggerPredictive[_0x6c32('0x74')](_0x24cae2[_0x6c32('0x37')],_0x6c32('0x1dd'));}};};Dialer[_0x6c32('0xa5')][_0x6c32('0x1de')]=function(_0x1a6a67,_0x231993){var _0x379ddb=this;return function(_0xf748e8){if(_[_0x6c32('0x3c')](_0xf748e8)){if(_[_0x6c32('0xa8')](_0x231993[_0x6c32('0xcd')])||!_0x231993['recallme']){if(_0x1a6a67['dialMethod']===_0x6c32('0x150')){_0x1a6a67[_0x6c32('0x122')]=_[_0x6c32('0x35')](_0x1a6a67[_0x6c32('0x122')])?!![]:_0x1a6a67[_0x6c32('0x122')];var _0x4aaf48=uuid['v4']();_0x379ddb[_0x6c32('0x21')][_0x4aaf48]=new Action(_0x1a6a67,_0x231993,_0x4aaf48);loggerBooked[_0x6c32('0x74')](_0x6c32('0x1df'),_0x4aaf48,_0x6c32('0x1e0'),JSON[_0x6c32('0x40')](_0x1a6a67[_0x6c32('0x122')]),'Queue:\x20',_0x1a6a67[_0x6c32('0x37')]);if(_0x1a6a67['queueStatusComplete']){_0x1a6a67[_0x6c32('0x122')]=![];_0x379ddb[_0x6c32('0x27')][_0x379ddb[_0x6c32('0x21')][_0x4aaf48][_0x6c32('0xb0')]]=[];ami[_0x6c32('0xa9')]({'actionid':_0x4aaf48,'action':'queuestatus','queue':_0x1a6a67[_0x6c32('0x37')]})[_0x6c32('0xac')](function(){_0x379ddb[_0x6c32('0xae')](_0x1a6a67);_0x379ddb['rescheduleContact']({'active':![],'ContactId':_0x379ddb[_0x6c32('0x21')][_0x4aaf48][_0x6c32('0xcb')],'ListId':_0x379ddb[_0x6c32('0x21')][_0x4aaf48][_0x6c32('0xcc')],'VoiceQueueId':_0x379ddb[_0x6c32('0x21')][_0x4aaf48][_0x6c32('0xce')]||undefined,'CampaignId':_0x379ddb[_0x6c32('0x21')][_0x4aaf48]['CampaignId']||undefined})[_0x6c32('0xac')](loggerCatch(_0x6c32('0x1e1')));delete _0x379ddb[_0x6c32('0x21')][_0x4aaf48];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0x6c32('0x40')](_0x1a6a67[_0x6c32('0x122')]),_0x6c32('0x1e2'),_0x1a6a67['name']);_0x379ddb[_0x6c32('0xae')](_0x1a6a67);_0x379ddb['rescheduleContact']({'active':![],'ContactId':_0x379ddb[_0x6c32('0x21')][_0x4aaf48][_0x6c32('0xcb')],'ListId':_0x379ddb[_0x6c32('0x21')][_0x4aaf48][_0x6c32('0xcc')],'VoiceQueueId':_0x379ddb['actions'][_0x4aaf48]['VoiceQueueId']||undefined,'CampaignId':_0x379ddb[_0x6c32('0x21')][_0x4aaf48]['CampaignId']||undefined})['catch'](loggerCatch(_0x6c32('0x1e1')));delete _0x379ddb['actions'][_0x4aaf48];}}else{return _0x379ddb[_0x6c32('0x15d')](_0x1a6a67,_0x231993);}}else{if(getDiff(_0x231993[_0x6c32('0x1e3')])<_0x1a6a67['dialRecallMeTimeout']*0x3c){if(_0x231993[_0x6c32('0x1e4')]&&!_0x231993[_0x6c32('0x1e4')][_0x6c32('0x1e5')]){_0x379ddb[_0x6c32('0x1b')]['run'](_0x231993['id'])['finally'](function(){_0x379ddb[_0x6c32('0xae')](_0x1a6a67);});}else{_0x379ddb['unlockContact']({'active':![]},_0x231993['id'],0x1)[_0x6c32('0x18a')](function(){_0x379ddb['updateOriginated'](_0x1a6a67);});}}else{_0x1a6a67[_0x6c32('0x1e6')]+=0x1;_0x379ddb[_0x6c32('0xae')](_0x1a6a67);if(_0x1a6a67[_0x6c32('0x1e7')]){_0x379ddb[_0x6c32('0xbc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x231993[_0x6c32('0xcb')],'ListId':_0x231993[_0x6c32('0xcc')],'VoiceQueueId':_0x231993[_0x6c32('0xce')]||undefined,'CampaignId':_0x231993[_0x6c32('0xcf')]||undefined})[_0x6c32('0xac')](loggerCatch(_0x6c32('0x1e8')));_0x379ddb[_0x6c32('0xc5')](createObjHistory(_0x1a6a67,_0x231993,_0x6c32('0x1e9'),0x17,'RecallInQueue'))[_0x6c32('0xac')](loggerCatch(_0x6c32('0x1ea')));}else{_0x379ddb[_0x6c32('0xd6')](createObjHistory(_0x1a6a67,_0x231993,_0x6c32('0x1eb'),0x16,_0x6c32('0x1ec')),_0x6c32('0x1ed'),_0x6c32('0x1ee'));}}}}else{_0x1a6a67[_0x6c32('0x58')]+=0x1;_0x379ddb[_0x6c32('0xd6')](createObjHistory(_0x1a6a67,_0x231993,_0x6c32('0x1ef'),0xd,_0x6c32('0x1f0')),_0x6c32('0x1f1'),_0x6c32('0x1f2'));throw _0x6c32('0x1f3');}};};Dialer[_0x6c32('0xa5')][_0x6c32('0x1f4')]=function(_0x437f72){var _0x2489a8=this;var _0x440b5d=_0x437f72[_0x6c32('0x1f5')]-_0x437f72[_0x6c32('0x69')]-_0x437f72[_0x6c32('0x1f6')];emitCampaignSummary(_0x437f72);if(_0x440b5d>0x0){if(_0x440b5d>this[_0x6c32('0x1f')]){_0x440b5d=this['maxNumberOriginate'];}_0x437f72[_0x6c32('0x1f6')]+=_0x440b5d;this[_0x6c32('0xc0')](_0x437f72['id'],_0x440b5d,_0x437f72['dialOrderByScheduledAt'])[_0x6c32('0xb3')](function(_0x22f7fc){_0x437f72[_0x6c32('0x1f6')]-=_0x440b5d;_0x437f72[_0x6c32('0x1f6')]=_0x437f72[_0x6c32('0x1f6')]>0x0?_0x437f72[_0x6c32('0x1f6')]:0x0;if(!checkContactEmpty(_0x22f7fc)){_0x437f72['message']=_0x6c32('0x1f7');logger[_0x6c32('0x74')](_0x6c32('0x1f8')+_0x437f72['name']);}else{_0x437f72[_0x6c32('0x69')]+=_0x22f7fc[_0x6c32('0x127')];_0x437f72[_0x6c32('0x36')]=_0x6c32('0x1f9');for(var _0x201229=0x0;_0x201229<_0x22f7fc['length'];_0x201229+=0x1){_0x437f72[_0x6c32('0x1fa')]+=0x1;if(_[_0x6c32('0xa8')](_0x22f7fc[_0x201229])||_[_0x6c32('0xa8')](_0x22f7fc[_0x201229][_0x6c32('0x15e')])||_['isNil'](_0x22f7fc[_0x201229][_0x6c32('0x15e')][_0x6c32('0x15f')])){_0x2489a8[_0x6c32('0xc9')](_0x6c32('0x1fb'),_0x437f72,_0x22f7fc[_0x201229]);}else{_0x2489a8[_0x6c32('0xb7')](_[_0x6c32('0xca')](_0x22f7fc[_0x201229],[_0x6c32('0xcf'),'Contact.phone']))[_0x6c32('0xb3')](_0x2489a8[_0x6c32('0x1de')](_0x437f72,_0x22f7fc[_0x201229]))['catch'](_0x2489a8['loggerHandler'](_0x6c32('0x1fc'),_0x437f72));}}}})['catch'](loggerGetContactDialer(_0x6c32('0x1fd'),_0x437f72,_0x440b5d));}};Dialer[_0x6c32('0xa5')][_0x6c32('0x14d')]=function(_0x4310bf,_0x702a85){var _0x2a7628=this;var _0x3b16f9=[];var _0xa9dd3a=_0x702a85>=0x1?_0x702a85:0x1;if(_0x4310bf['dialMethod']===_0x6c32('0x150')){_0xa9dd3a=0x1;}var _0x51818c=Math['floor'](_0x4310bf[_0x6c32('0x46')]*_0xa9dd3a)-_0x4310bf[_0x6c32('0x69')]-_0x4310bf[_0x6c32('0x1f6')];emitVoiceQueueSummary(_0x4310bf);if(_0x4310bf['dialLimitQueue']>0x0){var _0x2fe147=_0x4310bf['dialLimitQueue']-_0x4310bf['originated']-_0x4310bf['talking']-_0x4310bf[_0x6c32('0x1f6')]-_0x4310bf['pTalking'];if(_0x51818c>_0x2fe147){_0x51818c=_0x2fe147;}}if(_0x51818c>0x0){if(_0x4310bf[_0x6c32('0x52')]===_0x6c32('0x150')){_0x51818c=0x1;}if(_0x51818c>this[_0x6c32('0x1f')]){_0x51818c=this[_0x6c32('0x1f')];}_0x4310bf[_0x6c32('0x1f6')]+=_0x51818c;for(var _0x489d80 in this[_0x6c32('0x1d')]){if(typeof this[_0x6c32('0x1d')][_0x489d80]!=='undefined'){if(this[_0x6c32('0x1d')][_0x489d80]['state']===_0x6c32('0x1fe')&&this[_0x6c32('0x1d')][_0x489d80][_0x6c32('0xaa')]===_0x6c32('0x1ff')){_0x3b16f9[_0x6c32('0x13f')](this[_0x6c32('0x1d')][_0x489d80]['id']);}}}this[_0x6c32('0xbf')](_0x4310bf['id'],_0x3b16f9,_0x51818c,_0x4310bf[_0x6c32('0x200')])['then'](function(_0xf4fe2b){_0x4310bf[_0x6c32('0x1f6')]-=_0x51818c;_0x4310bf[_0x6c32('0x1f6')]=_0x4310bf['temp']>0x0?_0x4310bf[_0x6c32('0x1f6')]:0x0;if(!checkContactEmpty(_0xf4fe2b)){_0x2a7628[_0x6c32('0xb1')](_0x4310bf)[_0x6c32('0xb3')](sendMessageReschedule(_0x4310bf))[_0x6c32('0xac')](loggerCatch(_0x6c32('0xb4')));}else{_0x4310bf[_0x6c32('0x69')]+=_0xf4fe2b[_0x6c32('0x127')];_0x4310bf[_0x6c32('0x36')]=_0x4310bf[_0x6c32('0x52')]===_0x6c32('0x150')?_0x6c32('0x201'):_0x6c32('0x1f9');for(var _0x1c226e=0x0;_0x1c226e<_0xf4fe2b[_0x6c32('0x127')];_0x1c226e+=0x1){if(_[_0x6c32('0xa8')](_0xf4fe2b[_0x1c226e])||_[_0x6c32('0xa8')](_0xf4fe2b[_0x1c226e][_0x6c32('0x15e')])||_[_0x6c32('0xa8')](_0xf4fe2b[_0x1c226e][_0x6c32('0x15e')]['phone'])){_0x2a7628['emptyContact']('[actionOriginate]\x20',_0x4310bf,_0xf4fe2b[_0x1c226e]);}else{_0x2a7628[_0x6c32('0xb5')](_['pick'](_0xf4fe2b[_0x1c226e],['VoiceQueueId',_0x6c32('0x202')]))[_0x6c32('0xb3')](_0x2a7628[_0x6c32('0x1de')](_0x4310bf,_0xf4fe2b[_0x1c226e]))[_0x6c32('0xac')](_0x2a7628[_0x6c32('0xc8')](_0x6c32('0x1fb'),_0x4310bf));}}}})[_0x6c32('0xac')](loggerGetContactDialer(_0x6c32('0x203'),_0x4310bf,_0x51818c));}};Dialer['prototype'][_0x6c32('0x8c')]=function(_0x4ae0aa){if(_0x4ae0aa[_0x6c32('0x204')]>0x0){var _0x2e2e74=_0x4ae0aa[_0x6c32('0x204')]-_0x4ae0aa[_0x6c32('0x69')]-_0x4ae0aa[_0x6c32('0x4c')];if(_0x2e2e74>0x0){this[_0x6c32('0x205')](_0x4ae0aa);}else{loggerPredictiveCalls[_0x6c32('0x74')]('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x4ae0aa);}};Dialer[_0x6c32('0xa5')]['tryOriginatePredictive']=function(_0x3a1856){var _0x1f37a3=this;var _0xc85bb9=[];_0x3a1856[_0x6c32('0x69')]+=0x1;for(var _0x339354 in this[_0x6c32('0x1d')]){if(typeof this[_0x6c32('0x1d')][_0x339354]!==_0x6c32('0x95')){if(this[_0x6c32('0x1d')][_0x339354][_0x6c32('0xa3')]===_0x6c32('0x1fe')&&this[_0x6c32('0x1d')][_0x339354]['status']==='reachable'){_0xc85bb9[_0x6c32('0x13f')](this['agents'][_0x339354]['id']);}}}this[_0x6c32('0xbf')](_0x3a1856['id'],_0xc85bb9,0x1,_0x3a1856['dialOrderByScheduledAt'])['then'](function(_0x318307){if(!checkContactEmpty(_0x318307)){checkContactLowerLimitOriginate(_0x3a1856,0x1,0x0);_0x1f37a3[_0x6c32('0xb1')](_0x3a1856)[_0x6c32('0xb3')](sendMessageReschedule(_0x3a1856))[_0x6c32('0xac')](loggerCatch(_0x6c32('0xb4')));}else{_0x3a1856[_0x6c32('0x36')]=_0x6c32('0x1f9');if(_['isNil'](_0x318307[0x0])||_[_0x6c32('0xa8')](_0x318307[0x0][_0x6c32('0x15e')])||_[_0x6c32('0xa8')](_0x318307[0x0][_0x6c32('0x15e')][_0x6c32('0x15f')])){_0x1f37a3[_0x6c32('0xc9')](_0x6c32('0x1fb'),_0x3a1856,_0x318307[0x0]);}else{_0x1f37a3[_0x6c32('0xb5')](_['pick'](_0x318307[0x0],[_0x6c32('0xce'),_0x6c32('0x202')]))[_0x6c32('0xb3')](_0x1f37a3[_0x6c32('0x1de')](_0x3a1856,_0x318307[0x0]))[_0x6c32('0xac')](_0x1f37a3[_0x6c32('0xc8')]('[actionOriginatePredictive]\x20',_0x3a1856));}}})[_0x6c32('0xac')](loggerGetContactDialer('[getContactDialerPredictive]',_0x3a1856,0x1));emitVoiceQueueSummary(_0x3a1856);};Dialer[_0x6c32('0xa5')][_0x6c32('0x1d2')]=function(_0x3d720c,_0x1eefbd,_0x513884,_0x2155eb,_0x2c0d6a,_0x2f8457){loggerPredictive[_0x6c32('0x74')](_0x6c32('0x206'));loggerPredictive[_0x6c32('0x74')](_0x6c32('0x207'),_0x3d720c);loggerPredictive['info'](_0x6c32('0x208'),_0x1eefbd);loggerPredictive[_0x6c32('0x74')](_0x6c32('0x209'),_0x513884);loggerPredictive[_0x6c32('0x74')](_0x6c32('0x20a'),_0x2155eb);loggerPredictive[_0x6c32('0x74')](_0x6c32('0x20b'),_0x2c0d6a);loggerPredictive['info'](_0x6c32('0x7d'));return new BPromise(function(_0x493306,_0x4561ae){if(_0x3d720c<=0x0||isNaN(_0x3d720c)){return _0x4561ae(msgResponse(_0x6c32('0x20c'),_0x6c32('0x3f'),'m\x20=\x20'+_0x3d720c));}if(_0x513884<=0x0||isNaN(_0x513884)){return _0x4561ae(msgResponse(_0x6c32('0x20c'),_0x6c32('0x3f'),_0x6c32('0x20d')+_0x513884));}if(_0x2155eb<=0x0||isNaN(_0x2155eb)){return _0x4561ae(msgResponse('[abandonmentRate]',_0x6c32('0x3f'),_0x6c32('0x20e')+_0x2155eb));}if(_0x1eefbd<=0x0||isNaN(_0x1eefbd)){return _0x4561ae(msgResponse(_0x6c32('0x20c'),'Error',_0x6c32('0x20f')+_0x1eefbd));}if(_0x2c0d6a<=0x0||isNaN(_0x2c0d6a)){return _0x4561ae(msgResponse(_0x6c32('0x20c'),_0x6c32('0x3f'),_0x6c32('0x210')+_0x2c0d6a));}_0x2f8457=_0x2f8457||0x0;var _0x117f46=0x1/_0x513884;var _0x181fc4=0x0;var _0x21c512=0x0;var _0x4bad6a=0x0;var _0x28478a=0x0;for(var _0x2b28dd=0x0;_0x4bad6a<_0x2c0d6a;_0x2b28dd+=0x1){_0x21c512=_0x2b28dd/_0x1eefbd;_0x181fc4=(_0x2155eb*_0x21c512+_0x2f8457)/_0x117f46;_0x4bad6a=erlangb(_0x181fc4,_0x3d720c);_0x28478a=_0x181fc4/_0x3d720c*(0x1-erlangb(_0x181fc4,_0x3d720c));}return _0x493306({'erlangCalls':_0x2b28dd,'erlangCallToSecond':_0x1eefbd/_0x2b28dd,'erlangAbandonmentRate':_0x4bad6a,'erlangBusyFactor':_0x28478a});});};Dialer[_0x6c32('0xa5')]['busyFactor']=function(_0x5ef606,_0x1921e6,_0x1cd068,_0xfbbd0f,_0xf11786,_0x1c8b2a){loggerPredictive[_0x6c32('0x74')](_0x6c32('0x211'));loggerPredictive[_0x6c32('0x74')]('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',_0x5ef606);loggerPredictive[_0x6c32('0x74')](_0x6c32('0x208'),_0x1921e6);loggerPredictive['info'](_0x6c32('0x209'),_0x1cd068);loggerPredictive[_0x6c32('0x74')](_0x6c32('0x20a'),_0xfbbd0f);loggerPredictive[_0x6c32('0x74')](_0x6c32('0x212'),_0xf11786);loggerPredictive[_0x6c32('0x74')]('---------------------------');return new BPromise(function(_0x41fed7,_0x3e28f5){if(_0x5ef606<=0x0||isNaN(_0x5ef606)){return _0x3e28f5(msgResponse(_0x6c32('0x213'),_0x6c32('0x3f'),_0x6c32('0x214')+_0x5ef606));}if(_0x1cd068<=0x0||isNaN(_0x1cd068)){return _0x3e28f5(msgResponse(_0x6c32('0x213'),_0x6c32('0x3f'),_0x6c32('0x20d')+_0x1cd068));}if(_0xfbbd0f<=0x0||isNaN(_0xfbbd0f)){return _0x3e28f5(msgResponse(_0x6c32('0x213'),'Error',_0x6c32('0x20e')+_0xfbbd0f));}if(_0x1921e6<=0x0||isNaN(_0x1921e6)){return _0x3e28f5(msgResponse('[busyFactor]',_0x6c32('0x3f'),'interval\x20=\x20'+_0x1921e6));}if(_0xf11786<=0x0||isNaN(_0xf11786)){return _0x3e28f5(msgResponse(_0x6c32('0x213'),_0x6c32('0x3f'),_0x6c32('0x215')+_0xf11786));}_0x1c8b2a=_0x1c8b2a||0x0;var _0x5b9a2b=0x1/_0x1cd068;var _0x334a27=0x0;var _0x244d1c=0x0;var _0x2d27d4=0x0;var _0x40f267=0x0;for(var _0x35df6e=0x0;_0x40f267<_0xf11786;_0x35df6e+=0x1){_0x244d1c=_0x35df6e/_0x1921e6;_0x334a27=(_0xfbbd0f*_0x244d1c+_0x1c8b2a)/_0x5b9a2b;_0x2d27d4=erlangb(_0x334a27,_0x5ef606);_0x40f267=_0x334a27/_0x5ef606*(0x1-erlangb(_0x334a27,_0x5ef606));}return _0x41fed7({'erlangCalls':_0x35df6e,'erlangCallToSecond':_0x1921e6/_0x35df6e,'erlangAbandonmentRate':_0x2d27d4,'erlangBusyFactor':_0x40f267});});};module['exports']=Dialer; \ No newline at end of file +var _0xb9a8=['membername','AMD','MACHINE','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countbusyretry','countagentrejectretry','dialMachineRetryFrequency','VoiceQueueId','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','droptime','responsetime','Drop','TIMEOUT','dialQueueProject2','dialDropRetryFrequency','calleridname','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','calleridnum','[syncAgentComplete][createHistory][11]','channel','actionid','locked','stateinterface','push','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','booked','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','loggedIn','checkIfTime','dialGlobalInterval','dialTimezone','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','XMD-AMDINITIALSILENCE','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','trim','dialCutDigit','SIP/%s/%s%s','substring','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','response','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Drop]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','reason','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dropRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','[countReScheduled]\x20','ACTIVE','RUNNING','[handlePredictive][limitChannel]','tryOriginatePredictive','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\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','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','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\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','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','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','exports','util','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','syncAgentConnect','bind','queuecallerabandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','AGENTS_NOT_LOGGED','name','message','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','Interval','[ifTime][Action]','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','available','pTalking','sumDuration','sumHoldTime','talking','total','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','md5','voice:queue:%s','voice_queue:save','ivr','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','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\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','Agent\x20Busy\x20Factor:\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','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','clearZombieChannels','[uniqueid]','actions','[actions]','isNil','Action','status','catch','No\x20such\x20channel','updateOriginated','queue','resolve','then','checkIsBlackList','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ListId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','statedesc','HangupInAMD'];(function(_0x4a02b8,_0x71bd74){var _0x3aaa9e=function(_0x4670cc){while(--_0x4670cc){_0x4a02b8['push'](_0x4a02b8['shift']());}};_0x3aaa9e(++_0x71bd74);}(_0xb9a8,0x124));var _0x8b9a=function(_0x3178c2,_0x51b329){_0x3178c2=_0x3178c2-0x0;var _0x13bf65=_0xb9a8[_0x3178c2];return _0x13bf65;};'use strict';var util=require(_0x8b9a('0x0'));var _=require('lodash');var BPromise=require(_0x8b9a('0x1'));var uuid=require(_0x8b9a('0x2'));var moment=require(_0x8b9a('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x8b9a('0x4'));var ut=require(_0x8b9a('0x5'));var config=require(_0x8b9a('0x6'));var logger=require(_0x8b9a('0x7'))(_0x8b9a('0x8'));var loggerBooked=require(_0x8b9a('0x7'))('booked');var loggerPredictive=require(_0x8b9a('0x7'))(_0x8b9a('0x9'));var loggerPredictiveCalls=require(_0x8b9a('0x7'))(_0x8b9a('0xa'));var loggerSyncQueueSummary=require(_0x8b9a('0x7'))(_0x8b9a('0xb'));var ami=require('../ami');config[_0x8b9a('0xc')]=_[_0x8b9a('0xd')](config[_0x8b9a('0xc')],{'host':_0x8b9a('0xe'),'port':0x18eb});var io=require(_0x8b9a('0xf'))(new Redis(config[_0x8b9a('0xc')]));var cmHopper=require(_0x8b9a('0x10'));var cmHopperHistory=require(_0x8b9a('0x11'));var cmHopperBlack=require(_0x8b9a('0x12'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require('./action');var History=require(_0x8b9a('0x13'));var Final=require(_0x8b9a('0x14'));var AgentComplete=require(_0x8b9a('0x15'));var QueueCallerAbandon=require(_0x8b9a('0x16'));var Hangup=require(_0x8b9a('0x17'));var ipAgi=process[_0x8b9a('0x18')][_0x8b9a('0x19')]||_0x8b9a('0x1a');var strategy={'rrmemory':_0x8b9a('0x1b'),'roundrobin':_0x8b9a('0x1c')};var Sequence=function(){};Sequence[_0x8b9a('0x1d')][_0x8b9a('0x1e')]=function(_0x3ed6d6){this['tail']=this[_0x8b9a('0x1f')]?this[_0x8b9a('0x1f')][_0x8b9a('0x20')](_0x3ed6d6):_0x3ed6d6();};function Dialer(_0x458cb2,_0x47cd12){this[_0x8b9a('0x21')]=new Sequence();this[_0x8b9a('0x22')]=_0x47cd12;this[_0x8b9a('0x23')]=_0x458cb2[_0x8b9a('0x23')];this[_0x8b9a('0x24')]=_0x458cb2[_0x8b9a('0x24')];this[_0x8b9a('0x25')]=_0x458cb2[_0x8b9a('0x25')];this[_0x8b9a('0x26')]=_0x458cb2['trunks'];this[_0x8b9a('0x27')]=config[_0x8b9a('0x27')]||0x2;this[_0x8b9a('0x28')]={};this['actions']={};this['contactsId']={};this[_0x8b9a('0x29')]={};this[_0x8b9a('0x2a')]={};this['startPredictive']={};this[_0x8b9a('0x2b')]={};this[_0x8b9a('0x2c')]={};this[_0x8b9a('0x2d')]={};this['queueBookedRR']={};ami['on']('agentconnect',this[_0x8b9a('0x2e')][_0x8b9a('0x2f')](this));ami['on'](_0x8b9a('0x30'),this['syncQueueCallerAbandon']['bind'](this));ami['on']('originateresponse',this[_0x8b9a('0x31')][_0x8b9a('0x2f')](this));ami['on'](_0x8b9a('0x32'),this[_0x8b9a('0x33')][_0x8b9a('0x2f')](this));ami['on'](_0x8b9a('0x34'),this[_0x8b9a('0xb')][_0x8b9a('0x2f')](this));ami['on'](_0x8b9a('0x35'),this[_0x8b9a('0x36')][_0x8b9a('0x2f')](this));ami['on']('newexten',this[_0x8b9a('0x37')][_0x8b9a('0x2f')](this));ami['on'](_0x8b9a('0x38'),this[_0x8b9a('0x39')][_0x8b9a('0x2f')](this));ami['on']('queuemember',this[_0x8b9a('0x3a')][_0x8b9a('0x2f')](this));ami['on'](_0x8b9a('0x3b'),this[_0x8b9a('0x3c')][_0x8b9a('0x2f')](this));this[_0x8b9a('0x3d')]();this[_0x8b9a('0x3e')]();}function isNotNull(_0x4c88cb){return _0x4c88cb!==null&&!_['isUndefined'](_0x4c88cb);}function checkIsLoggedIn(_0xb5b387,_0x389200){return function(){if(_0x389200<=0x0){_0xb5b387['message']=_0x8b9a('0x3f');throw _0xb5b387[_0x8b9a('0x40')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x357b1a){return _0x357b1a;}function checkIsActive(_0x328ceb,_0x2edb85){return function(){if(!isActive(_0x2edb85)){_0x328ceb[_0x8b9a('0x41')]='NOT_ACTIVE';throw _0x328ceb[_0x8b9a('0x40')]+_0x8b9a('0x42');}};}function checkInterval(_0x30acad){return function(){if(!isNotNull(_0x30acad['Interval'])){_0x30acad[_0x8b9a('0x41')]=_0x8b9a('0x43');throw _0x30acad[_0x8b9a('0x40')]+_0x8b9a('0x44');}if(!isNotNull(_0x30acad['Interval'][_0x8b9a('0x45')])){_0x30acad['message']=_0x8b9a('0x43');throw _0x30acad['name']+_0x8b9a('0x44');}if(!isNotNull(_[_0x8b9a('0x46')](_0x30acad[_0x8b9a('0x47')][_0x8b9a('0x45')]))){_0x30acad[_0x8b9a('0x41')]='INTERVAL_IS_NULL';throw _0x30acad[_0x8b9a('0x40')]+_0x8b9a('0x44');}};}function msgResponse(_0x217b04,_0x2281d9,_0x4a8b6b){return{'action':_0x217b04,'response':_0x2281d9,'message':_0x4a8b6b,'stack':_0x4a8b6b};}function myreject(_0x1acafc){return function(_0x5bb183){return _0x1acafc(msgResponse(_0x8b9a('0x48'),'Error',JSON[_0x8b9a('0x49')](_0x5bb183)));};}function getSeconds(_0xffb791,_0x8982b9){var _0x222cc2=moment(_0xffb791)[_0x8b9a('0x4a')](0x0);var _0x45967b=moment(_0x8982b9)[_0x8b9a('0x4a')](0x0);return _0x222cc2[_0x8b9a('0x4b')](_0x45967b,_0x8b9a('0x4c'));}function emit(_0x3e2b15,_0x52c296,_0x58a456){io['to'](_0x3e2b15)[_0x8b9a('0x4d')](_0x52c296,_0x58a456);}function emitVoiceQueueSummary(_0x29cfb3){if(_0x29cfb3[_0x8b9a('0x4e')]===_0x8b9a('0x4f')){var _0x142cee={'id':_0x29cfb3['id'],'name':_0x29cfb3[_0x8b9a('0x40')],'strategy':_0x29cfb3[_0x8b9a('0x50')],'answered':_0x29cfb3['answered'],'available':_0x29cfb3[_0x8b9a('0x51')],'loggedIn':_0x29cfb3['loggedIn'],'pTalking':_0x29cfb3[_0x8b9a('0x52')],'sumBillable':_0x29cfb3['sumBillable'],'sumDuration':_0x29cfb3[_0x8b9a('0x53')],'sumHoldTime':_0x29cfb3[_0x8b9a('0x54')]||0x0,'talking':_0x29cfb3[_0x8b9a('0x55')],'total':_0x29cfb3[_0x8b9a('0x56')],'type':_0x29cfb3[_0x8b9a('0x4e')],'unmanaged':_0x29cfb3['unmanaged'],'abandoned':_0x29cfb3['abandoned'],'waiting':_0x29cfb3[_0x8b9a('0x57')],'loggedInDb':_0x29cfb3[_0x8b9a('0x58')],'dialActive':_0x29cfb3['dialActive'],'dialMethod':_0x29cfb3[_0x8b9a('0x59')],'dialOriginateCallerIdName':_0x29cfb3[_0x8b9a('0x5a')],'dialOriginateCallerIdNumber':_0x29cfb3[_0x8b9a('0x5b')],'dialOriginateTimeout':_0x29cfb3[_0x8b9a('0x5c')],'dialPrefix':_0x29cfb3[_0x8b9a('0x5d')],'outboundAnswerAgiCallsDay':_0x29cfb3[_0x8b9a('0x5e')],'outboundAnswerCallsDay':_0x29cfb3[_0x8b9a('0x5f')],'outboundBlacklistCallsDay':_0x29cfb3[_0x8b9a('0x60')],'outboundBusyCallsDay':_0x29cfb3[_0x8b9a('0x61')],'outboundCongestionCallsDay':_0x29cfb3['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x29cfb3['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x29cfb3['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x29cfb3['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x29cfb3['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x29cfb3[_0x8b9a('0x62')],'outboundOriginateFailureCallsDay':_0x29cfb3[_0x8b9a('0x63')],'outboundReCallsDay':_0x29cfb3[_0x8b9a('0x64')],'outboundRejectCallsDay':_0x29cfb3[_0x8b9a('0x65')],'outboundUnknownCallsDay':_0x29cfb3[_0x8b9a('0x66')],'predictiveIntervalAnsweredCalls':_0x29cfb3[_0x8b9a('0x67')],'predictiveIntervalAvgHoldtime':_0x29cfb3[_0x8b9a('0x68')],'predictiveIntervalAvgTalktime':_0x29cfb3['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x29cfb3[_0x8b9a('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x29cfb3[_0x8b9a('0x6a')],'predictiveIntervalErlangCalls':_0x29cfb3['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x29cfb3[_0x8b9a('0x6b')],'predictiveIntervalHitRate':_0x29cfb3['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x29cfb3[_0x8b9a('0x6c')],'predictiveIntervalPauses':_0x29cfb3[_0x8b9a('0x6d')],'predictiveIntervalAvailable':_0x29cfb3[_0x8b9a('0x6e')],'predictiveIntervalTotalCalls':_0x29cfb3[_0x8b9a('0x6f')],'message':_0x29cfb3[_0x8b9a('0x41')],'originated':_0x29cfb3[_0x8b9a('0x70')],'erlangCalls':_0x29cfb3[_0x8b9a('0x71')],'erlangCallToSecond':_0x29cfb3[_0x8b9a('0x72')],'erlangAbandonmentRate':_0x29cfb3[_0x8b9a('0x73')],'erlangBusyFactor':_0x29cfb3[_0x8b9a('0x74')],'startPredictive':_0x29cfb3[_0x8b9a('0x75')],'startProgressive':_0x29cfb3[_0x8b9a('0x2b')]};if(_0x29cfb3['Trunk']){_0x142cee[_0x8b9a('0x76')]={'id':_0x29cfb3['Trunk']['id'],'name':_0x29cfb3[_0x8b9a('0x76')]['name'],'active':_0x29cfb3[_0x8b9a('0x76')][_0x8b9a('0x77')],'callerid':_0x29cfb3['Trunk'][_0x8b9a('0x78')]};}if(_0x29cfb3['Interval']){_0x142cee['Interval']={'id':_0x29cfb3[_0x8b9a('0x47')]['id'],'name':_0x29cfb3[_0x8b9a('0x47')][_0x8b9a('0x40')]};}var _0x3bc827=md5(JSON[_0x8b9a('0x49')](_0x142cee));if(_0x29cfb3[_0x8b9a('0x79')]!==_0x3bc827){_0x29cfb3[_0x8b9a('0x79')]=_0x3bc827;emit(util['format'](_0x8b9a('0x7a'),_0x142cee[_0x8b9a('0x40')]),_0x8b9a('0x7b'),_0x142cee);}}}function emitCampaignSummary(_0x5de693){if(_0x5de693[_0x8b9a('0x4e')]===_0x8b9a('0x7c')){emit(util['format']('campaign:ivr:%s',_0x5de693['name']),_0x8b9a('0x7d'),_0x5de693);}}function checkGetDataPredictive(_0x296931){if(isNotNull(_0x296931)&&!_['isEmpty'](_0x296931)){loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x7f'));loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x80'),_0x296931[_0x8b9a('0x6f')]);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x81'),_0x296931['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x82'),_0x296931[_0x8b9a('0x6a')]);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x83'),_0x296931[_0x8b9a('0x69')]);loggerPredictive[_0x8b9a('0x7e')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x296931[_0x8b9a('0x68')]);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x84'),_0x296931['predictiveIntervalAvgTalktime']);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x85'));if(_0x296931[_0x8b9a('0x6f')]>0x0){if(!_[_0x8b9a('0x86')](_0x296931[_0x8b9a('0x87')])&&_0x296931[_0x8b9a('0x87')]>0x0){return!![];}loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x88'));if(!_['isUndefined'](_0x296931[_0x8b9a('0x68')])&&_0x296931[_0x8b9a('0x68')]>0x0){return!![];}loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x89'));}else{loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x8a'));}}else{loggerPredictive['info'](_0x8b9a('0x8b'));}return![];}function mergeDataErlangB(_0x3182e4){return function(_0x289a32){loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x8c'));loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x8d'),_0x289a32[_0x8b9a('0x71')]);loggerPredictive[_0x8b9a('0x7e')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x289a32[_0x8b9a('0x72')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x289a32[_0x8b9a('0x73')]);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x8e'),_0x289a32[_0x8b9a('0x74')]);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x8f'),_0x289a32['erlangAbandonmentRate']);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x85'));_[_0x8b9a('0x90')](_0x3182e4,_0x289a32);};}function getDiff(_0x59f947){var _0x26d19d=moment()[_0x8b9a('0x4a')](0x0);var _0x3ed6f5=moment(_0x59f947)[_0x8b9a('0x4a')](0x0);return _0x26d19d['diff'](_0x3ed6f5,_0x8b9a('0x4c'));}function ifInterval(_0x212d91,_0x42d387){if(_[_0x8b9a('0x86')](_0x42d387)){return![];}return getDiff(_0x42d387)<_0x212d91*0x3c;}function freeVariablesPredictive(_0xd82098){if(isNotNull(_0xd82098)){if(!_[_0x8b9a('0x86')](_0xd82098['startProgressive'])){_0xd82098[_0x8b9a('0x2b')]=undefined;loggerPredictive['info'](_0xd82098[_0x8b9a('0x40')],_0x8b9a('0x91'));}if(!_[_0x8b9a('0x86')](_0xd82098[_0x8b9a('0x75')])){_0xd82098[_0x8b9a('0x75')]=undefined;loggerPredictive[_0x8b9a('0x7e')](_0xd82098[_0x8b9a('0x40')],_0x8b9a('0x92'));}if(!_[_0x8b9a('0x86')](_0xd82098[_0x8b9a('0x93')])){clearInterval(_0xd82098[_0x8b9a('0x93')]);_0xd82098[_0x8b9a('0x93')]=undefined;loggerPredictive[_0x8b9a('0x7e')](_0xd82098[_0x8b9a('0x40')],_0x8b9a('0x94'));}}}function erlangb(_0x4a9df7,_0x6f01d7){if(_0x6f01d7===0x0){return 0x0;}var _0x3ad549=0x1;for(var _0x7a6d3a=0x1;_0x7a6d3a<=_0x6f01d7;_0x7a6d3a+=0x1){_0x3ad549=0x1+_0x3ad549*_0x7a6d3a/_0x4a9df7;}return 0x1/_0x3ad549;}function isVoiceQueueOutbound(_0xe30409){return _0xe30409===_0x8b9a('0x4f');}function isNotPreview(_0x3d8bc0){return _0x3d8bc0!==_0x8b9a('0x22');}function isCampaignIvr(_0x417dcc){return _0x417dcc===_0x8b9a('0x7c');}function getCallerId(_0x16d900,_0x2396ce,_0x5c0d6f){if(!_[_0x8b9a('0x86')](_0x5c0d6f)&&typeof _0x5c0d6f===_0x8b9a('0x95')&&!_[_0x8b9a('0x46')](_0x5c0d6f)){if(!_[_0x8b9a('0x86')](_0x2396ce)&&typeof _0x2396ce===_0x8b9a('0x95')&&!_[_0x8b9a('0x46')](_0x2396ce)){return util[_0x8b9a('0x96')](_0x8b9a('0x97'),_0x2396ce,_0x5c0d6f);}return util[_0x8b9a('0x96')]('\x22%s\x22\x20<%s>',_0x5c0d6f,_0x5c0d6f);}if(!_[_0x8b9a('0x86')](_0x16d900)&&typeof _0x16d900===_0x8b9a('0x95')&&!_[_0x8b9a('0x46')](_0x16d900)){return _0x16d900;}return _0x8b9a('0x98');}function loggerCatchQueueSummary(_0x4c2d2e,_0x1b9aa9){return function(_0x8bd119){freeVariablesPredictive(_0x1b9aa9);emitVoiceQueueSummary(_0x1b9aa9);emitCampaignSummary(_0x1b9aa9);loggerSyncQueueSummary['error'](_0x4c2d2e,util['inspect'](_0x8bd119,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0xffdd92,_0x2ac522){return function(_0x59cdef){loggerPredictive[_0x8b9a('0x99')](_0x2ac522[_0x8b9a('0x40')],_0xffdd92);loggerPredictive[_0x8b9a('0x99')](_0x59cdef[_0x8b9a('0x9a')]);freeVariablesPredictive(_0x2ac522);};}function loggerCatch(_0x1f59f4){return function(_0x24bd9f){logger[_0x8b9a('0x99')](_0x1f59f4,util[_0x8b9a('0x9b')](_0x24bd9f,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x185737){return _0x185737&&!_['isUndefined'](_0x185737)&&_0x185737[_0x8b9a('0x9c')]>0x0;}function decremetOriginate(_0x501de7){if(!_[_0x8b9a('0x86')](_0x501de7)&&_0x501de7!==null){if(typeof _0x501de7[_0x8b9a('0x70')]!==_0x8b9a('0x9d')){if(_0x501de7['originated']>0x0){_0x501de7['originated']-=0x1;}else{logger[_0x8b9a('0x99')](_0x8b9a('0x9e'));}}}else{logger[_0x8b9a('0x99')](_0x8b9a('0x9f'));}}function checkContactLowerLimitOriginate(_0x23016,_0x3b8be6,_0x59af42){if(_0x3b8be6>_0x59af42){for(var _0x11d911=0x0;_0x11d911<_0x3b8be6-_0x59af42;_0x11d911+=0x1){decremetOriginate(_0x23016);}}}function loggerGetContactDialer(_0x44cb25,_0x3b867b,_0x31ca82){return function(_0x24b483){checkContactLowerLimitOriginate(_0x3b867b,_0x31ca82,0x0);logger['error'](_0x44cb25,util[_0x8b9a('0x9b')](_0x24b483,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2cf51a){return function(_0x442feb){if(isNotNull(_0x442feb)&&isNotNull(_0x442feb[0x0])){if(_0x442feb[0x0][_0x8b9a('0xa0')]>0x0){_0x2cf51a[_0x8b9a('0x41')]=_0x8b9a('0xa1');logger[_0x8b9a('0x7e')](_0x8b9a('0xa2')+_0x2cf51a[_0x8b9a('0x40')],_0x442feb[0x0][_0x8b9a('0xa0')],_0x8b9a('0xa3'));}else{_0x2cf51a[_0x8b9a('0x41')]=_0x8b9a('0xa4');logger[_0x8b9a('0x7e')](_0x8b9a('0xa5')+_0x2cf51a[_0x8b9a('0x40')]);}}};}function notSendMessagesQueue(_0x52e3df){if(_0x52e3df[_0x8b9a('0xa6')]){freeVariablesPredictive(_0x52e3df);if(_0x52e3df[_0x8b9a('0x70')]===0x0&&_0x52e3df[_0x8b9a('0x55')]===0x0&&_0x52e3df[_0x8b9a('0x57')]===0x0&&(_0x52e3df[_0x8b9a('0x52')]||0x0)===0x0){_0x52e3df[_0x8b9a('0xa6')]=![];_0x52e3df['available']=0x0;_0x52e3df['message']=_0x8b9a('0xa7');loggerSyncQueueSummary['error'](_0x8b9a('0xa8'),_0x52e3df[_0x8b9a('0x40')],_0x8b9a('0xa9'));}else{_0x52e3df[_0x8b9a('0x41')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x8b9a('0x99')](_0x8b9a('0xa8'),_0x52e3df['name'],_0x8b9a('0xaa'));}emitVoiceQueueSummary(_0x52e3df);}}function notSendMessagesCampaign(_0x21e77a){if(_0x21e77a[_0x8b9a('0xa6')]){if(_0x21e77a['originated']===0x0){_0x21e77a[_0x8b9a('0xa6')]=![];_0x21e77a['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x8b9a('0x99')](_0x8b9a('0xab'),_0x21e77a[_0x8b9a('0x40')],_0x8b9a('0xa9'));}else{_0x21e77a[_0x8b9a('0x41')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x8b9a('0x99')](_0x8b9a('0xab'),_0x21e77a[_0x8b9a('0x40')],_0x8b9a('0xaa'));}emitCampaignSummary(_0x21e77a);}}function createObjHistory(_0x212155,_0x142d79,_0x917c0c,_0x4a2de0,_0x81752f){_0x212155[_0x8b9a('0x41')]=_0x917c0c;var _0x5be5de=new Action(_0x212155,_0x142d79);var _0x5c4f35=new History(_0x5be5de);_0x5c4f35[_0x8b9a('0xac')]=_0x4a2de0;_0x5c4f35['statedesc']=_0x81752f;_0x5c4f35[_0x8b9a('0xad')]=_0x5be5de[_0x8b9a('0xae')];return _0x5c4f35;}Dialer[_0x8b9a('0x1d')][_0x8b9a('0x3e')]=function(){var _0x2621b2=this;setInterval(function(){_0x2621b2[_0x8b9a('0xaf')](_0x2621b2[_0x8b9a('0x29')],_0x8b9a('0xb0'));_0x2621b2[_0x8b9a('0xaf')](_0x2621b2[_0x8b9a('0xb1')],_0x8b9a('0xb2'));},0x32c8);};Dialer['prototype'][_0x8b9a('0xaf')]=function(_0x5cd757,_0x511d33){var _0x247b24=this;for(var _0xc7d9cc in _0x5cd757){if(typeof _0x5cd757[_0xc7d9cc]!==_0x8b9a('0x9d')){this[_0x8b9a('0x21')][_0x8b9a('0x1e')](function(){if(!_[_0x8b9a('0xb3')](_0x5cd757[_0xc7d9cc])){return ami[_0x8b9a('0xb4')]({'action':_0x8b9a('0xb5'),'channel':_0x5cd757[_0xc7d9cc]['channel']})[_0x8b9a('0xb6')](function(_0x1f6b0d){if(_0x1f6b0d[_0x8b9a('0x41')]===_0x8b9a('0xb7')){setTimeout(function(){if(_0x5cd757[_0xc7d9cc]&&_0x5cd757[_0xc7d9cc][_0x8b9a('0x4e')]!=='ivr'){_0x247b24[_0x8b9a('0xb8')](_0x247b24['voiceQueues'][_0x5cd757[_0xc7d9cc][_0x8b9a('0xb9')]]);logger['error']('[Dialer][checkChannel]',_0x511d33,_0xc7d9cc,_0x5cd757[_0xc7d9cc][_0x8b9a('0xb9')]);delete _0x5cd757[_0xc7d9cc];}if(_0x5cd757[_0xc7d9cc]&&_0x5cd757[_0xc7d9cc][_0x8b9a('0x4e')]===_0x8b9a('0x7c')){_0x247b24[_0x8b9a('0xb8')](_0x247b24['campaigns'][_0x5cd757[_0xc7d9cc][_0x8b9a('0xb9')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x511d33,_0xc7d9cc,_0x5cd757[_0xc7d9cc][_0x8b9a('0xb9')]);delete _0x5cd757[_0xc7d9cc];}},0x2328);}});}});}}};Dialer[_0x8b9a('0x1d')]['countReScheduled']=function(_0x24b649){return BPromise[_0x8b9a('0xba')]()[_0x8b9a('0xbb')](cmHopper['countReScheduled'](_0x24b649))[_0x8b9a('0xb6')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0x8b9a('0xbc')]=function(_0x152c24){return BPromise[_0x8b9a('0xba')]()[_0x8b9a('0xbb')](cmHopperBlack[_0x8b9a('0xbc')](_0x152c24))[_0x8b9a('0xb6')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x8b9a('0x1d')]['checkIsBlackListIvr']=function(_0x5800af){return BPromise[_0x8b9a('0xba')]()[_0x8b9a('0xbb')](cmHopperBlack[_0x8b9a('0xbd')](_0x5800af))[_0x8b9a('0xb6')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer['prototype'][_0x8b9a('0xbe')]=function(_0x37f623){return BPromise[_0x8b9a('0xba')]()[_0x8b9a('0xbb')](cmHopperHistory[_0x8b9a('0xbf')](_0x37f623))['catch'](loggerCatch(_0x8b9a('0xc0')));};Dialer['prototype']['rescheduleContact']=function(_0x59cad4){return BPromise['resolve']()[_0x8b9a('0xbb')](cmHopper[_0x8b9a('0xc1')](_0x59cad4))[_0x8b9a('0xb6')](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype'][_0x8b9a('0xc2')]=function(_0x38893d,_0x1cef87,_0x516d2e){return BPromise['resolve']()[_0x8b9a('0xbb')](cmHopper[_0x8b9a('0xc2')](_0x38893d,_0x1cef87,_0x516d2e))[_0x8b9a('0xb6')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x8b9a('0x1d')][_0x8b9a('0xc3')]=function(_0x2193f2,_0x4a0d4c,_0x2c7c34,_0x117bd0){return BPromise[_0x8b9a('0xba')]()['then'](cmHopper[_0x8b9a('0xc3')](_0x2193f2,_0x4a0d4c,_0x2c7c34,_0x117bd0))[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0xc4')));};Dialer[_0x8b9a('0x1d')]['getContactDialerIvr']=function(_0x30b237,_0x599269,_0x506eae){return BPromise[_0x8b9a('0xba')]()[_0x8b9a('0xbb')](cmHopper[_0x8b9a('0xc5')](_0x30b237,_0x599269,_0x506eae))[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0xc4')));};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x136f7a){return BPromise[_0x8b9a('0xba')]()[_0x8b9a('0xbb')](voiceQueueRt[_0x8b9a('0xc6')](_0x136f7a))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x8b9a('0x1d')]['moveContactManagedDialer']=function(_0x250b5c){return BPromise[_0x8b9a('0xba')]()[_0x8b9a('0xbb')](cmHopper[_0x8b9a('0xc7')](_0x250b5c))['catch'](loggerCatch(_0x8b9a('0xc8')));};Dialer[_0x8b9a('0x1d')][_0x8b9a('0xc9')]=function(_0x54914c){return BPromise[_0x8b9a('0xba')]()[_0x8b9a('0xbb')](cmHopperHistory[_0x8b9a('0xc9')](_0x54914c))['catch'](loggerCatch(_0x8b9a('0xca')));};Dialer[_0x8b9a('0x1d')][_0x8b9a('0xb8')]=function(_0x51807e){if(!_[_0x8b9a('0x86')](_0x51807e)&&_0x51807e!==null){if(typeof _0x51807e[_0x8b9a('0x70')]!=='undefined'){if(_0x51807e[_0x8b9a('0x70')]>0x0){_0x51807e[_0x8b9a('0x70')]-=0x1;}else{logger[_0x8b9a('0x99')](_0x8b9a('0xcb'));}}}else{logger[_0x8b9a('0x99')](_0x8b9a('0xcc'));}};Dialer['prototype'][_0x8b9a('0xcd')]=function(_0x38f182,_0xe2db90){var _0x4507b2=this;return function(_0x35ce40){_0x4507b2[_0x8b9a('0xb8')](_0xe2db90);logger[_0x8b9a('0x99')](_0x38f182,util[_0x8b9a('0x9b')](_0x35ce40,{'showHidden':![],'depth':null}));};};Dialer[_0x8b9a('0x1d')][_0x8b9a('0xce')]=function(_0x5a2706,_0x3a3021,_0x32c61c){var _0xf8a48={'state':0x19,'statedesc':_0x8b9a('0xcf')};this[_0x8b9a('0xb8')](_0x3a3021);this[_0x8b9a('0xd0')](_[_0x8b9a('0x90')](_0xf8a48,_[_0x8b9a('0xd1')](_0x32c61c,['ContactId',_0x8b9a('0xd2'),'UserId','VoiceQueueId',_0x8b9a('0xd3')])),_0x8b9a('0xd4'),_0x8b9a('0xd5'));logger[_0x8b9a('0x99')](_0x5a2706);};Dialer[_0x8b9a('0x1d')][_0x8b9a('0xd6')]=function(_0x492cfe){return _0x492cfe===_0x8b9a('0xd7');};Dialer[_0x8b9a('0x1d')][_0x8b9a('0xd8')]=function(_0x59be09){return!_[_0x8b9a('0x86')](_0x59be09)&&_0x59be09&&!_['isUndefined'](_0x59be09[_0x8b9a('0x40')])&&!_['isUndefined'](_0x59be09[_0x8b9a('0x77')])&&_0x59be09['active']&&(this[_0x8b9a('0x26')][util['format']('SIP/%s',_0x59be09['name'])][_0x8b9a('0xb5')]===_0x8b9a('0xd9')||this[_0x8b9a('0x26')][util[_0x8b9a('0x96')]('SIP/%s',_0x59be09['name'])][_0x8b9a('0xb5')]===_0x8b9a('0xda'));};Dialer['prototype'][_0x8b9a('0xd0')]=function(_0x57d3b,_0xa7e2ec,_0x4fe326){this[_0x8b9a('0xc9')](_0x57d3b)[_0x8b9a('0xb6')](loggerCatch(_0xa7e2ec));this[_0x8b9a('0xc7')](_0x57d3b)['catch'](loggerCatch(_0x4fe326));};Dialer['prototype'][_0x8b9a('0x39')]=function(_0x2cf8af){var _0x754ce=this[_0x8b9a('0x29')][_0x2cf8af[_0x8b9a('0xdb')]];var _0x3adb01;if(!_[_0x8b9a('0xb3')](_0x2cf8af)&&!_[_0x8b9a('0xb3')](_0x2cf8af[_0x8b9a('0xdc')])&&!_[_0x8b9a('0xb3')](_0x2cf8af[_0x8b9a('0xdc')][_0x8b9a('0xdd')])&&_0x2cf8af[_0x8b9a('0xde')]===_0x8b9a('0xdf')&&_0x754ce){if(_0x754ce['type']!==_0x8b9a('0x7c')&&this[_0x8b9a('0x23')][_0x754ce[_0x8b9a('0xb9')]][_0x8b9a('0xe0')]&&_0x2cf8af[_0x8b9a('0xe1')]===_0x8b9a('0xe2')){delete this[_0x8b9a('0x29')][_0x2cf8af['uniqueid']];this[_0x8b9a('0xb8')](this[_0x8b9a('0x23')][_0x754ce[_0x8b9a('0xb9')]]);this['voiceQueues'][_0x754ce[_0x8b9a('0xb9')]]['outboundAnswerCallsDay']+=0x1;this[_0x8b9a('0x23')][_0x754ce[_0x8b9a('0xb9')]][_0x8b9a('0x5e')]+=0x1;_0x3adb01=new Hangup(_0x754ce,_0x2cf8af);_0x3adb01[_0x8b9a('0xac')]=0x12;_0x3adb01[_0x8b9a('0xe3')]=_0x8b9a('0xe4');_0x3adb01[_0x8b9a('0xe5')]=_0x8b9a('0xe6');this[_0x8b9a('0xd0')](_0x3adb01,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x754ce[_0x8b9a('0x4e')]!=='ivr'&&this[_0x8b9a('0x23')][_0x754ce[_0x8b9a('0xb9')]][_0x8b9a('0xe0')]&&_0x2cf8af[_0x8b9a('0xe1')]===_0x8b9a('0xe7')){var _0xf66d06=this;return new BPromise(function(_0x3a5d68,_0x2f502d){delete _0xf66d06[_0x8b9a('0x29')][_0x2cf8af[_0x8b9a('0xdb')]];_0xf66d06['updateOriginated'](_0xf66d06['voiceQueues'][_0x754ce[_0x8b9a('0xb9')]]);_0xf66d06[_0x8b9a('0x23')][_0x754ce[_0x8b9a('0xb9')]][_0x8b9a('0x5f')]+=0x1;_0xf66d06['voiceQueues'][_0x754ce[_0x8b9a('0xb9')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x43ce2e=_0xf66d06[_0x8b9a('0x23')][_0x754ce[_0x8b9a('0xb9')]];var _0x31dfc3=new Hangup(_0x754ce,_0x2cf8af);_0x31dfc3[_0x8b9a('0xac')]=0x13;_0x31dfc3['statedesc']=_0x8b9a('0xe8');_0x31dfc3[_0x8b9a('0xe5')]=_0x8b9a('0xe6');_0x31dfc3[_0x8b9a('0xe9')]+=0x1;_0x31dfc3[_0x8b9a('0xea')]+=0x1;_0x31dfc3[_0x8b9a('0xeb')]=!![];_0xf66d06[_0x8b9a('0xc9')](_0x31dfc3)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0xec')));if(_0x31dfc3['countbusyretry']+_0x31dfc3[_0x8b9a('0xed')]+_0x31dfc3[_0x8b9a('0xee')]+_0x31dfc3[_0x8b9a('0xef')]+_0x31dfc3[_0x8b9a('0xf0')]+_0x31dfc3[_0x8b9a('0xf1')]+_0x31dfc3[_0x8b9a('0xe9')]+_0x31dfc3['countagentrejectretry']>=_0x43ce2e[_0x8b9a('0xf2')]){_0xf66d06[_0x8b9a('0xf3')](_0x31dfc3,_0x3a5d68,_0x2f502d,_0x8b9a('0xf4'));}else{if(_0x31dfc3[_0x8b9a('0xe9')]>=_0x43ce2e[_0x8b9a('0xf5')]){_0xf66d06[_0x8b9a('0xf6')](_0x31dfc3,_0x3a5d68,_0x2f502d,_0x8b9a('0xf7'));}else{_0xf66d06['rescheduleContact']({'active':![],'countmachineretry':_0x31dfc3[_0x8b9a('0xe9')],'scheduledat':moment()[_0x8b9a('0xf8')](_0x43ce2e['dialMachineRetryFrequency'],_0x8b9a('0xf9'))[_0x8b9a('0x96')](_0x8b9a('0xfa')),'ContactId':_0x31dfc3[_0x8b9a('0xfb')],'ListId':_0x31dfc3[_0x8b9a('0xd2')],'VoiceQueueId':_0x31dfc3['VoiceQueueId']||undefined,'CampaignId':_0x31dfc3[_0x8b9a('0xd3')]||undefined})[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0xfc')));_0x3a5d68({'reschedule':0x1});}}});}if(_0x754ce['type']===_0x8b9a('0x7c')&&this[_0x8b9a('0x24')][_0x754ce['queue']][_0x8b9a('0xe0')]&&_0x2cf8af[_0x8b9a('0xe1')]===_0x8b9a('0xe2')){delete this['uniqueId'][_0x2cf8af[_0x8b9a('0xdb')]];this[_0x8b9a('0xb8')](this['campaigns'][_0x754ce[_0x8b9a('0xb9')]]);_0x3adb01=new Hangup(_0x754ce,_0x2cf8af);_0x3adb01[_0x8b9a('0xac')]=0x12;_0x3adb01[_0x8b9a('0xe3')]=_0x8b9a('0xe4');_0x3adb01[_0x8b9a('0xe5')]=_0x8b9a('0xe6');this[_0x8b9a('0xd0')](_0x3adb01,_0x8b9a('0xfd'),_0x8b9a('0xfe'));}if(_0x754ce[_0x8b9a('0x4e')]===_0x8b9a('0x7c')&&this[_0x8b9a('0x24')][_0x754ce[_0x8b9a('0xb9')]][_0x8b9a('0xe0')]&&_0x2cf8af[_0x8b9a('0xe1')]===_0x8b9a('0xe7')){var _0xf66d06=this;return new BPromise(function(_0x1d6acc,_0x3bcd33){delete _0xf66d06[_0x8b9a('0x29')][_0x2cf8af[_0x8b9a('0xdb')]];_0xf66d06['updateOriginated'](_0xf66d06[_0x8b9a('0x24')][_0x754ce['queue']]);_0xf66d06['campaigns'][_0x754ce['queue']]['outboundAnswerCallsDay']+=0x1;_0xf66d06[_0x8b9a('0x24')][_0x754ce[_0x8b9a('0xb9')]][_0x8b9a('0x5e')]+=0x1;var _0x153546=_0xf66d06[_0x8b9a('0x24')][_0x754ce[_0x8b9a('0xb9')]];var _0x43479a=new Hangup(_0x754ce,_0x2cf8af);_0x43479a[_0x8b9a('0xac')]=0x13;_0x43479a[_0x8b9a('0xe3')]='Machine';_0x43479a[_0x8b9a('0xe5')]='AMD';_0x43479a[_0x8b9a('0xe9')]+=0x1;_0x43479a['countglobal']+=0x1;_0x43479a[_0x8b9a('0xeb')]=!![];_0xf66d06[_0x8b9a('0xc9')](_0x43479a)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0xec')));if(_0x43479a[_0x8b9a('0xff')]+_0x43479a[_0x8b9a('0xed')]+_0x43479a[_0x8b9a('0xee')]+_0x43479a['countnosuchnumberretry']+_0x43479a['countdropretry']+_0x43479a[_0x8b9a('0xf1')]+_0x43479a[_0x8b9a('0xe9')]+_0x43479a[_0x8b9a('0x100')]>=_0x153546[_0x8b9a('0xf2')]){_0xf66d06[_0x8b9a('0xf3')](_0x43479a,_0x1d6acc,_0x3bcd33,_0x8b9a('0xf4'));}else{if(_0x43479a['countmachineretry']>=_0x153546['dialMachineMaxRetry']){_0xf66d06[_0x8b9a('0xf6')](_0x43479a,_0x1d6acc,_0x3bcd33,_0x8b9a('0xf7'));}else{_0xf66d06[_0x8b9a('0xc1')]({'active':![],'countmachineretry':_0x43479a['countmachineretry'],'scheduledat':moment()[_0x8b9a('0xf8')](_0x153546[_0x8b9a('0x101')],_0x8b9a('0xf9'))[_0x8b9a('0x96')](_0x8b9a('0xfa')),'ContactId':_0x43479a[_0x8b9a('0xfb')],'ListId':_0x43479a[_0x8b9a('0xd2')],'VoiceQueueId':_0x43479a[_0x8b9a('0x102')]||undefined,'CampaignId':_0x43479a[_0x8b9a('0xd3')]||undefined})[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0xfc')));_0x1d6acc({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x8b9a('0x36')]=function(_0x14d8fe){var _0x12a755=this['uniqueId'][_0x14d8fe[_0x8b9a('0xdb')]];var _0x248236=this;var _0x22a6cb;if(_0x12a755&&_0x12a755['type']==='ivr'){delete this[_0x8b9a('0x29')][_0x14d8fe[_0x8b9a('0xdb')]];this['updateOriginated'](this[_0x8b9a('0x24')][_0x12a755[_0x8b9a('0xb9')]]);this['campaigns'][_0x12a755[_0x8b9a('0xb9')]]['ivrAnswerCallsDay']+=0x1;_0x22a6cb=new Hangup(_0x12a755,_0x14d8fe);this['createHistory'](_0x22a6cb)[_0x8b9a('0xb6')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x8b9a('0xc7')](_0x22a6cb)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x103')));}if(_0x12a755&&_0x12a755[_0x8b9a('0x4e')]!==_0x8b9a('0x7c')&&isNotNull(this[_0x8b9a('0x23')][_0x12a755[_0x8b9a('0xb9')]][_0x8b9a('0x104')])){delete this['uniqueId'][_0x14d8fe[_0x8b9a('0xdb')]];this['updateOriginated'](this['voiceQueues'][_0x12a755['queue']]);this['voiceQueues'][_0x12a755[_0x8b9a('0xb9')]][_0x8b9a('0x5f')]+=0x1;this[_0x8b9a('0x23')][_0x12a755[_0x8b9a('0xb9')]][_0x8b9a('0x5e')]+=0x1;_0x22a6cb=new Hangup(_0x12a755,_0x14d8fe);_0x22a6cb[_0x8b9a('0xac')]=0x10;_0x22a6cb[_0x8b9a('0xe3')]=_0x8b9a('0x105');_0x22a6cb[_0x8b9a('0xe5')]=_0x8b9a('0x106');this[_0x8b9a('0xc9')](_0x22a6cb)[_0x8b9a('0xb6')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x22a6cb)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x103')));}if(_0x12a755&&_0x12a755[_0x8b9a('0x4e')]!==_0x8b9a('0x7c')&&!isNotNull(this[_0x8b9a('0x23')][_0x12a755[_0x8b9a('0xb9')]]['dialQueueProject'])){delete this['uniqueId'][_0x14d8fe['uniqueid']];this[_0x8b9a('0xb8')](this['voiceQueues'][_0x12a755[_0x8b9a('0xb9')]]);this['voiceQueues'][_0x12a755[_0x8b9a('0xb9')]]['outboundUnknownCallsDay']+=0x1;_0x22a6cb=new Hangup(_0x12a755,_0x14d8fe);_0x22a6cb[_0x8b9a('0xac')]=0xc;_0x22a6cb[_0x8b9a('0xe3')]=_0x14d8fe[_0x8b9a('0x107')];_0x22a6cb[_0x8b9a('0xe5')]='Unknow';this[_0x8b9a('0xc9')](_0x22a6cb)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x8b9a('0xc7')](_0x22a6cb)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x103')));}};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x33')]=function(_0x3f5fac){var _0x4aa3b3=this[_0x8b9a('0x29')][_0x3f5fac[_0x8b9a('0xdb')]];var _0x5c35b6=this;if(this[_0x8b9a('0x23')][_0x3f5fac['queue']]){if(_0x4aa3b3&&_0x4aa3b3[_0x8b9a('0x4e')]!==_0x8b9a('0x7c')){delete this[_0x8b9a('0x29')][_0x3f5fac[_0x8b9a('0xdb')]];this[_0x8b9a('0x23')][_0x3f5fac[_0x8b9a('0xb9')]][_0x8b9a('0x5f')]+=0x1;var _0x1b88b5=new AgentComplete(_0x4aa3b3,_0x3f5fac);if(_0x3f5fac['reason']===_0x8b9a('0x108')){_0x1b88b5[_0x8b9a('0x109')]=this[_0x8b9a('0x23')][_0x3f5fac[_0x8b9a('0xb9')]]['dialQueueProject2']&&this[_0x8b9a('0x23')][_0x3f5fac[_0x8b9a('0xb9')]][_0x8b9a('0x10a')]?moment()[_0x8b9a('0x96')](_0x8b9a('0xfa')):undefined;}this['createHistory'](_0x1b88b5)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x10b')));this[_0x8b9a('0xc7')](_0x1b88b5)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x10c')));}}};Dialer['prototype']['syncAgentConnect']=function(_0x2bac3f){if(this[_0x8b9a('0x23')][_0x2bac3f[_0x8b9a('0xb9')]]){if(this['uniqueId'][_0x2bac3f[_0x8b9a('0xdb')]]&&this[_0x8b9a('0x29')][_0x2bac3f['uniqueid']][_0x8b9a('0x4e')]!==_0x8b9a('0x7c')){this[_0x8b9a('0xb8')](this['voiceQueues'][_0x2bac3f[_0x8b9a('0xb9')]]);this[_0x8b9a('0x29')][_0x2bac3f['uniqueid']]['answertime']=moment()[_0x8b9a('0x96')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x10d')]=function(_0x4aef91){this[_0x8b9a('0xc9')](_0x4aef91)[_0x8b9a('0xb6')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x8b9a('0xc7')](_0x4aef91)[_0x8b9a('0xb6')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x8b9a('0x1d')]['syncQueueCallerAbandon']=function(_0x6db64c){var _0x382cbd=this[_0x8b9a('0x29')][_0x6db64c[_0x8b9a('0xdb')]];var _0x43d7e8=this;if(this['voiceQueues'][_0x6db64c[_0x8b9a('0xb9')]]){if(_0x382cbd&&_0x382cbd[_0x8b9a('0x4e')]!=='ivr'){delete this[_0x8b9a('0x29')][_0x6db64c[_0x8b9a('0xdb')]];this[_0x8b9a('0xb8')](this['voiceQueues'][_0x6db64c[_0x8b9a('0xb9')]]);_0x382cbd[_0x8b9a('0x10e')]=moment()[_0x8b9a('0x96')](_0x8b9a('0xfa'));var _0x422a81=new QueueCallerAbandon(_0x382cbd,_0x6db64c);if(getSeconds(_0x382cbd[_0x8b9a('0x10e')],_0x382cbd[_0x8b9a('0x10f')])>=_0x382cbd['dialQueueTimeout']){this[_0x8b9a('0x23')][_0x6db64c[_0x8b9a('0xb9')]][_0x8b9a('0x6a')]+=0x1;this[_0x8b9a('0x23')][_0x6db64c[_0x8b9a('0xb9')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x6db64c[_0x8b9a('0xb9')]][_0x8b9a('0x6b')]+=0x1;_0x422a81['state']=0xa;_0x422a81[_0x8b9a('0xe3')]=_0x8b9a('0x110');_0x422a81['dropreason']=_0x8b9a('0x111');_0x422a81[_0x8b9a('0x109')]=this[_0x8b9a('0x23')][_0x6db64c[_0x8b9a('0xb9')]][_0x8b9a('0x112')]?moment()[_0x8b9a('0x96')](_0x8b9a('0xfa')):undefined;_0x422a81['countdropretry']+=0x1;_0x422a81['countglobal']+=0x1;if(_0x422a81[_0x8b9a('0xf0')]>=this[_0x8b9a('0x23')][_0x6db64c[_0x8b9a('0xb9')]]['dialDropMaxRetry']){this[_0x8b9a('0x10d')](_0x422a81);}else{this[_0x8b9a('0xc1')]({'active':![],'countdropretry':_0x422a81[_0x8b9a('0xf0')],'scheduledat':moment()[_0x8b9a('0xf8')](this['voiceQueues'][_0x6db64c[_0x8b9a('0xb9')]][_0x8b9a('0x113')],_0x8b9a('0xf9'))[_0x8b9a('0x96')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x382cbd[_0x8b9a('0xfb')],'ListId':_0x382cbd[_0x8b9a('0xd2')],'VoiceQueueId':_0x382cbd['VoiceQueueId']||undefined,'CampaignId':_0x382cbd[_0x8b9a('0xd3')]||undefined})[_0x8b9a('0xb6')](loggerCatch('[rescheduleContact][Drop]'));var _0x34e3ec=new History(_0x422a81);_0x34e3ec[_0x8b9a('0xac')]=0xa;_0x34e3ec['statedesc']=_0x8b9a('0x110');_0x34e3ec[_0x8b9a('0xae')]=moment()[_0x8b9a('0x96')](_0x8b9a('0xfa'));_0x34e3ec[_0x8b9a('0xad')]=_0x34e3ec['starttime'];_0x34e3ec[_0x8b9a('0x114')]=_0x422a81[_0x8b9a('0x114')];_0x34e3ec['calleridnum']=_0x422a81['calleridnum'];this[_0x8b9a('0xc9')](_0x34e3ec)[_0x8b9a('0xb6')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x8b9a('0x23')][_0x6db64c[_0x8b9a('0xb9')]][_0x8b9a('0x69')]+=0x1;this[_0x8b9a('0x23')][_0x6db64c['queue']][_0x8b9a('0x115')]+=0x1;_0x422a81[_0x8b9a('0xac')]=0xb;_0x422a81[_0x8b9a('0xe3')]=_0x8b9a('0x116');_0x422a81[_0x8b9a('0x117')]=_0x8b9a('0x118');_0x422a81[_0x8b9a('0xf1')]+=0x1;_0x422a81[_0x8b9a('0xea')]+=0x1;if(_0x422a81[_0x8b9a('0xf1')]>=this['voiceQueues'][_0x6db64c[_0x8b9a('0xb9')]][_0x8b9a('0x119')]){this['queueCallerAbandonCreateState'](_0x422a81);}else{this[_0x8b9a('0xc1')]({'active':![],'countabandonedretry':_0x422a81[_0x8b9a('0xf1')],'scheduledat':moment()[_0x8b9a('0xf8')](this['voiceQueues'][_0x6db64c[_0x8b9a('0xb9')]][_0x8b9a('0x11a')],'minutes')[_0x8b9a('0x96')](_0x8b9a('0xfa')),'ContactId':_0x382cbd[_0x8b9a('0xfb')],'ListId':_0x382cbd[_0x8b9a('0xd2')],'VoiceQueueId':_0x382cbd[_0x8b9a('0x102')]||undefined,'CampaignId':_0x382cbd[_0x8b9a('0xd3')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x34e3ec=new History(_0x422a81);_0x34e3ec[_0x8b9a('0xac')]=0xb;_0x34e3ec['statedesc']='Abandoned';_0x34e3ec[_0x8b9a('0xae')]=moment()['format'](_0x8b9a('0xfa'));_0x34e3ec[_0x8b9a('0xad')]=_0x34e3ec['starttime'];_0x34e3ec['calleridname']=_0x422a81[_0x8b9a('0x114')];_0x34e3ec[_0x8b9a('0x11b')]=_0x422a81[_0x8b9a('0x11b')];this[_0x8b9a('0xc9')](_0x34e3ec)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x11c')));}}}}};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x37')]=function(_0xe4ec2d){if(this['actions'][_0xe4ec2d[_0x8b9a('0xdb')]]){this['actions'][_0xe4ec2d[_0x8b9a('0xdb')]][_0x8b9a('0x11d')]=_0xe4ec2d[_0x8b9a('0x11d')];}if(this[_0x8b9a('0x29')][_0xe4ec2d[_0x8b9a('0xdb')]]){this[_0x8b9a('0x29')][_0xe4ec2d[_0x8b9a('0xdb')]][_0x8b9a('0x11d')]=_0xe4ec2d['channel'];}};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x3a')]=function(_0x2b79f5){if(strategy[this[_0x8b9a('0x23')][this['actions'][_0x2b79f5[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]][_0x8b9a('0x50')]]==='roundrobin'){if(this[_0x8b9a('0xb1')][_0x2b79f5['actionid']]&&_[_0x8b9a('0xb3')](this[_0x8b9a('0xb1')][_0x2b79f5[_0x8b9a('0x11e')]][_0x8b9a('0x11f')])&&_0x2b79f5[_0x8b9a('0xb5')]==='1'&&_0x2b79f5['paused']==='0'){if(this[_0x8b9a('0x25')][_0x2b79f5[_0x8b9a('0x120')]]){if(!this[_0x8b9a('0x25')][_0x2b79f5[_0x8b9a('0x120')]][_0x8b9a('0x11f')]){this[_0x8b9a('0x25')][_0x2b79f5[_0x8b9a('0x120')]]['locked']=!![];this['actions'][_0x2b79f5[_0x8b9a('0x11e')]][_0x8b9a('0x11f')]=!![];this[_0x8b9a('0xb1')][_0x2b79f5[_0x8b9a('0x11e')]][_0x8b9a('0x120')]=_0x2b79f5['stateinterface'];}}}}else if((strategy[this[_0x8b9a('0x23')][this[_0x8b9a('0xb1')][_0x2b79f5[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]][_0x8b9a('0x50')]]||'rrmemory')===_0x8b9a('0x1b')){if(this['actions'][_0x2b79f5[_0x8b9a('0x11e')]]){if(this['agents'][_0x2b79f5[_0x8b9a('0x120')]]){this[_0x8b9a('0xb1')][_0x2b79f5[_0x8b9a('0x11e')]][_0x8b9a('0x120')]=_0x2b79f5[_0x8b9a('0x120')];if(_[_0x8b9a('0xb3')](this[_0x8b9a('0x2d')][this[_0x8b9a('0xb1')][_0x2b79f5[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]])){this[_0x8b9a('0x2d')][this[_0x8b9a('0xb1')][_0x2b79f5[_0x8b9a('0x11e')]]['queue']]=[];}this[_0x8b9a('0x2d')][this[_0x8b9a('0xb1')][_0x2b79f5['actionid']][_0x8b9a('0xb9')]][_0x8b9a('0x121')](_[_0x8b9a('0x90')](_[_0x8b9a('0xd1')](this[_0x8b9a('0xb1')][_0x2b79f5[_0x8b9a('0x11e')]],['idHopper',_0x8b9a('0x120')]),{'status':_0x2b79f5[_0x8b9a('0xb5')],'paused':_0x2b79f5[_0x8b9a('0x122')]}));}}}};function unlockQueueStatus(_0x743f56,_0x59faa1){setTimeout(function(){if(_[_0x8b9a('0x86')](_0x743f56[_0x8b9a('0x123')])){loggerBooked[_0x8b9a('0x99')](_0x8b9a('0x124'),_0x59faa1);}_0x743f56[_0x8b9a('0x123')]=!![];loggerBooked['info'](_0x8b9a('0x125'),_0x59faa1,JSON['stringify'](_[_0x8b9a('0xd1')](_0x743f56,[_0x8b9a('0x40'),'queueStatusComplete'])));},0x1f3);}Dialer['prototype'][_0x8b9a('0x3c')]=function(_0x20948b){var _0x33494d=this;var _0x51fdf4=_0x33494d[_0x8b9a('0x23')][_0x33494d[_0x8b9a('0xb1')][_0x20948b['actionid']][_0x8b9a('0xb9')]];if(strategy[this[_0x8b9a('0x23')][this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]][_0x8b9a('0x50')]]===_0x8b9a('0x1c')){if(this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]]&&this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0x120')]){this[_0x8b9a('0x22')][_0x8b9a('0x126')](this[_0x8b9a('0xb1')][_0x20948b['actionid']][_0x8b9a('0x127')],this[_0x8b9a('0xb1')][_0x20948b['actionid']][_0x8b9a('0x120')])[_0x8b9a('0xb6')](function(_0x4bc79d){logger['error'](_0x8b9a('0x128'),util[_0x8b9a('0x9b')](_0x4bc79d,{'showHidden':![],'depth':null}));})[_0x8b9a('0x20')](function(){_0x33494d[_0x8b9a('0xb8')](_0x33494d[_0x8b9a('0x23')][_0x33494d[_0x8b9a('0xb1')][_0x20948b['actionid']][_0x8b9a('0xb9')]]);_0x33494d[_0x8b9a('0x25')][_0x33494d['actions'][_0x20948b[_0x8b9a('0x11e')]]['stateinterface']][_0x8b9a('0x11f')]=![];delete _0x33494d[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]];unlockQueueStatus(_0x51fdf4);});}else{this[_0x8b9a('0xb8')](this[_0x8b9a('0x23')][this[_0x8b9a('0xb1')][_0x20948b['actionid']][_0x8b9a('0xb9')]]);this[_0x8b9a('0xc1')]({'active':![],'ContactId':this['actions'][_0x20948b['actionid']][_0x8b9a('0xfb')],'ListId':this['actions'][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0xd2')],'VoiceQueueId':this['actions'][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0x102')]||undefined,'CampaignId':this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0xd3')]||undefined})['catch'](loggerCatch(_0x8b9a('0x129')));delete this[_0x8b9a('0xb1')][_0x20948b['actionid']];unlockQueueStatus(_0x51fdf4);}}else if((strategy[this[_0x8b9a('0x23')][this[_0x8b9a('0xb1')][_0x20948b['actionid']][_0x8b9a('0xb9')]][_0x8b9a('0x50')]]||_0x8b9a('0x1b'))===_0x8b9a('0x1b')){var _0x2a3a51;if(this['actions'][_0x20948b['actionid']]&&!_['isEmpty'](this[_0x8b9a('0x2d')][this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]])){if(this[_0x8b9a('0x12a')][_0x33494d[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]]){this[_0x8b9a('0x12a')][_0x33494d['actions'][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]]=this[_0x8b9a('0x12a')][this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]]?this['queueBookedRR'][this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]]['queue']]:this['queueBooked'][this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]]?this['queueBooked'][this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]]['queue']][_0x8b9a('0x12b')]||0x0:0x0;}this[_0x8b9a('0x2d')][this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]][_0x8b9a('0x12b')]=this[_0x8b9a('0x12a')][this[_0x8b9a('0xb1')][_0x20948b[_0x8b9a('0x11e')]][_0x8b9a('0xb9')]];for(var _0x2ff76e=0x0;_0x2ff76e=0x0;})['catch'](myreject(_0x42bb0c)));}}else{_0x3c0b7e[_0x8b9a('0x121')](ami[_0x8b9a('0xb4')]({'action':'command','command':util['format']('iftime\x20%s,%s',_0x13521a,!_[_0x8b9a('0x86')](config['timezones'][_0x481299])?_0x481299:'')})[_0x8b9a('0xbb')](function(_0x3485b1){return _0x3485b1['content']['indexOf'](_0x8b9a('0x143'))>=0x0;})[_0x8b9a('0xb6')](myreject(_0x42bb0c)));}BPromise[_0x8b9a('0x144')](_0x3c0b7e)[_0x8b9a('0xbb')](function(_0x3915bc){var _0x2ccc46=_['some'](_0x3915bc);if(_0x2ccc46){return _0x10d36d(_0x2ccc46);}else{_0x5146c5[_0x8b9a('0x41')]=_0x59614d?_0x8b9a('0x145'):_0x8b9a('0x146');return _0x42bb0c(msgResponse(_0x8b9a('0x147'),_0x8b9a('0x13a'),_0x8b9a('0x148')+_0x59614d+'\x20'+_0xda19c+_0x8b9a('0x149')+util[_0x8b9a('0x9b')](_0x13521a,{'showHidden':![],'depth':null})+_0x8b9a('0x14a')+_0x481299));}})[_0x8b9a('0xb6')](function(_0x4c70b9){return _0x42bb0c(msgResponse(_0x8b9a('0x138'),'Failure',JSON[_0x8b9a('0x49')](_0x4c70b9)));});});};Dialer['prototype'][_0x8b9a('0x14b')]=function(_0x32396d){var _0x1618c2=this;return function(){switch(_0x32396d['dialMethod']){case _0x8b9a('0x14c'):freeVariablesPredictive(_0x32396d);_0x1618c2[_0x8b9a('0x14d')](_0x32396d,0x1);break;case'power':freeVariablesPredictive(_0x32396d);_0x1618c2[_0x8b9a('0x14d')](_0x32396d,_0x32396d['dialPowerLevel']);break;case _0x8b9a('0x9'):_0x1618c2['predictive'](_0x32396d);break;case _0x8b9a('0x14e'):freeVariablesPredictive(_0x32396d);_0x1618c2[_0x8b9a('0x14d')](_0x32396d,0x1);break;default:freeVariablesPredictive(_0x32396d);logger[_0x8b9a('0x99')]('Queue',_0x32396d[_0x8b9a('0x40')],_0x8b9a('0x14f'));}};};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x150')]=function(_0x583156){var _0x453ffc=this;return function(){_0x453ffc[_0x8b9a('0x151')](_0x583156);};};Dialer[_0x8b9a('0x1d')][_0x8b9a('0xb')]=function(_0x4cfa13){var _0x562642=this;if(isNotPreview(_0x4cfa13[_0x8b9a('0x59')])){if(isVoiceQueueOutbound(_0x4cfa13[_0x8b9a('0x4e')])&&isActive(_0x4cfa13[_0x8b9a('0x152')])){_0x4cfa13[_0x8b9a('0xa6')]=!![];BPromise['resolve']()[_0x8b9a('0xbb')](checkIsLoggedIn(_0x4cfa13,_0x4cfa13[_0x8b9a('0x153')]))['then'](checkIsActive(_0x4cfa13,_0x4cfa13[_0x8b9a('0x152')]))[_0x8b9a('0xbb')](checkInterval(_0x4cfa13))[_0x8b9a('0xbb')](_0x562642['checkIsTrunkReachable'](_0x4cfa13))[_0x8b9a('0xbb')](_0x562642[_0x8b9a('0x154')](_0x4cfa13[_0x8b9a('0x155')],_0x4cfa13['dialTimezone'],_0x4cfa13[_0x8b9a('0x40')],_0x4cfa13))[_0x8b9a('0xbb')](_0x562642[_0x8b9a('0x139')](_0x4cfa13[_0x8b9a('0x47')],_0x4cfa13['dialTimezone'],_0x4cfa13[_0x8b9a('0x40')],_0x4cfa13))[_0x8b9a('0xbb')](_0x562642[_0x8b9a('0x14b')](_0x4cfa13))[_0x8b9a('0xb6')](loggerCatchQueueSummary('[syncQueueSummary]',_0x4cfa13));}else{notSendMessagesQueue(_0x4cfa13);}}else{freeVariablesPredictive(_0x4cfa13);}};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x133')]=function(){var _0x384670=this;var _0x29552f;for(var _0x497ca9 in this[_0x8b9a('0x24')]){if(typeof this[_0x8b9a('0x24')][_0x497ca9]!==_0x8b9a('0x9d')){_0x29552f=this[_0x8b9a('0x24')][_0x497ca9];if(isCampaignIvr(_0x29552f[_0x8b9a('0x4e')])&&isActive(_0x29552f[_0x8b9a('0x77')])){_0x29552f[_0x8b9a('0xa6')]=!![];BPromise['resolve']()[_0x8b9a('0xbb')](checkIsActive(_0x29552f,_0x29552f[_0x8b9a('0x77')]))[_0x8b9a('0xbb')](checkInterval(_0x29552f))['then'](_0x384670[_0x8b9a('0x134')](_0x29552f))[_0x8b9a('0xbb')](_0x384670['checkIfTime'](_0x29552f[_0x8b9a('0x155')],_0x29552f['dialTimezone'],_0x29552f[_0x8b9a('0x40')],_0x29552f))[_0x8b9a('0xbb')](_0x384670[_0x8b9a('0x139')](_0x29552f[_0x8b9a('0x47')],_0x29552f[_0x8b9a('0x156')],_0x29552f[_0x8b9a('0x40')],_0x29552f))[_0x8b9a('0xbb')](_0x384670[_0x8b9a('0x150')](_0x29552f))[_0x8b9a('0xb6')](loggerCatchQueueSummary(_0x8b9a('0x157'),_0x29552f));}else{notSendMessagesCampaign(_0x29552f);}}}};function getCallerIdRandom(_0x56452f,_0x3a2cb3){var _0xe004d6;var _0xf8783d;var _0x205372;if(_0x3a2cb3<=0x0){_0x3a2cb3=0x1;}_0xe004d6=new RegExp(_0x8b9a('0x158')+_0x3a2cb3+'}$');_0xf8783d=Math[_0x8b9a('0x159')](0xa,_0x3a2cb3-0x1);_0x205372=Math[_0x8b9a('0x159')](0xa,_0x3a2cb3)-0x1;return util[_0x8b9a('0x96')]('%s',_['replace'](_0x56452f,_0xe004d6,_[_0x8b9a('0x15a')](_0xf8783d,_0x205372)));}function extractCalleridName(_0x2118fa){var _0x10ab31=_0x2118fa[_0x8b9a('0x15b')](/"(.*?)"/);return _0x10ab31?_0x10ab31[0x1]:_0x2118fa;}function extractCalleridNumber(_0x2f6d8b){var _0x504e71=_0x2f6d8b[_0x8b9a('0x15b')](/<(.*?)>/);return _0x504e71?_0x504e71[0x1]:_0x2f6d8b;}Dialer[_0x8b9a('0x1d')][_0x8b9a('0x15c')]=function(_0x2abf72,_0x2d5184){var _0x5774b9=this;var _0x1080cf=uuid['v4']();this['actions'][_0x1080cf]=new Action(_0x2abf72,_0x2d5184,_0x1080cf);return new BPromise(function(_0x518fb3,_0x30c0e6){if(_[_0x8b9a('0x86')](_0x2abf72)&&typeof _0x2abf72!=='object'){return _0x30c0e6(msgResponse(_0x8b9a('0x15d'),_0x8b9a('0x13a'),_0x8b9a('0x15e')));}if(_['isUndefined'](_0x2d5184[_0x8b9a('0x15f')]['phone'])||_0x2d5184['Contact'][_0x8b9a('0x160')]===null){return _0x30c0e6(msgResponse('originate',_0x8b9a('0x13a'),'contact\x20is\x20undefine'));}var _0x57ae6a={'XMD-CALLERID':_0x5774b9[_0x8b9a('0xb1')][_0x1080cf][_0x8b9a('0x161')](),'XMD-AGI':_0x2abf72['dialQueueProject']?util[_0x8b9a('0x96')](_0x8b9a('0x162'),ipAgi,_0x2abf72[_0x8b9a('0x104')]):_0x8b9a('0x163'),'XMD-AGIAFTER':_0x2abf72[_0x8b9a('0x112')]?util['format'](_0x8b9a('0x162'),ipAgi,_0x2abf72['dialQueueProject2']):_0x8b9a('0x163'),'XMD-QUEUE':_0x2abf72[_0x8b9a('0x4e')]===_0x8b9a('0x4f')?util[_0x8b9a('0x96')](_0x8b9a('0x164'),_0x2abf72[_0x8b9a('0x40')],_0x2abf72[_0x8b9a('0x165')]||'',_0x2abf72[_0x8b9a('0x10a')]?'c':'',_0x2abf72[_0x8b9a('0x166')]||0x3):_0x8b9a('0x163'),'XMD-CONTACTID':_0x2d5184[_0x8b9a('0xfb')],'XMD-CDRTYPE':_0x8b9a('0x8'),'CALLERID(all)':_0x5774b9[_0x8b9a('0xb1')][_0x1080cf][_0x8b9a('0x161')](),'XMD-AMD':_0x2abf72['dialAMDActive']?'ACTIVE':'NONE','XMD-DESTINATION':_0x8b9a('0xdf')};if(_0x2abf72['dialAMDActive']){_0x57ae6a[_0x8b9a('0x167')]=_0x2abf72['dialAMDInitialSilence']||0x9c4;_0x57ae6a['XMD-AMDGREETING']=_0x2abf72[_0x8b9a('0x168')]||0x5dc;_0x57ae6a[_0x8b9a('0x169')]=_0x2abf72['dialAMDAfterGreetingSilence']||0x320;_0x57ae6a[_0x8b9a('0x16a')]=_0x2abf72['dialAMDTotalAnalysisTime']||0x1388;_0x57ae6a['XMD-AMDMINWORDLENGTH']=_0x2abf72['dialAMDMinWordLength']||0x64;_0x57ae6a['XMD-AMDBETWEENWORDSSILENCE']=_0x2abf72['dialAMDBetweenWordsSilence']||0x32;_0x57ae6a['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x2abf72[_0x8b9a('0x16b')]||0x3;_0x57ae6a['XMD-AMDSILENCETHRESHOLD']=_0x2abf72['dialAMDSilenceThreshold']||0x100;_0x57ae6a['XMD-AMDMAXIMUMWORDLENGTH']=_0x2abf72[_0x8b9a('0x16c')]||0x1388;}if(_0x2abf72[_0x8b9a('0x4e')]===_0x8b9a('0x4f')){_0x57ae6a[_0x8b9a('0x16d')]=_0x2d5184[_0x8b9a('0x102')];}else{_0x57ae6a[_0x8b9a('0x16e')]=_0x2d5184[_0x8b9a('0xd3')];}for(var _0x3181af in _0x2d5184[_0x8b9a('0x15f')]){if(typeof _0x2d5184[_0x8b9a('0x15f')][_0x3181af]!==_0x8b9a('0x9d')){if(isNotNull(_0x2d5184[_0x8b9a('0x15f')][_0x3181af])&&_0x3181af!=='id'&&_0x3181af!==_0x8b9a('0x16f')&&_0x3181af!==_0x8b9a('0x170')&&_0x3181af!=='updatedAt'){_0x57ae6a[util[_0x8b9a('0x96')](_0x8b9a('0x171'),'XMD-',_[_0x8b9a('0x172')](_0x3181af))]=_0x2d5184[_0x8b9a('0x15f')][_0x3181af];}}}var _0x765117=_0x5774b9[_0x8b9a('0xd8')](_0x2abf72['Trunk'])?getCallerId(_0x2abf72[_0x8b9a('0x76')]['callerid'],_0x2abf72[_0x8b9a('0x5a')],_0x2abf72[_0x8b9a('0x173')]>0x0?getCallerIdRandom(_0x2abf72[_0x8b9a('0x5b')],_0x2abf72[_0x8b9a('0x173')]):_0x2abf72[_0x8b9a('0x5b')]):getCallerId(_[_0x8b9a('0xb3')](_0x2abf72['TrunkBackup'])?_0x2abf72[_0x8b9a('0x76')][_0x8b9a('0x78')]:_0x2abf72['TrunkBackup'][_0x8b9a('0x78')],_0x2abf72[_0x8b9a('0x5a')],_0x2abf72[_0x8b9a('0x173')]>0x0?getCallerIdRandom(_0x2abf72[_0x8b9a('0x5b')],_0x2abf72['dialRandomLastDigitCallerIdNumber']):_0x2abf72[_0x8b9a('0x5b')]);if(_0x765117){_0x57ae6a['XMD-ORIGINATECALLERIDNAME']=_0x5774b9['actions'][_0x1080cf][_0x8b9a('0x174')]=extractCalleridName(_0x765117);_0x57ae6a['XMD-ORIGINATECALLERIDNUM']=_0x5774b9[_0x8b9a('0xb1')][_0x1080cf][_0x8b9a('0x175')]=extractCalleridNumber(_0x765117);}return ami[_0x8b9a('0xb4')]({'actionid':_0x1080cf,'action':_0x8b9a('0x15d'),'channel':_0x5774b9[_0x8b9a('0xd8')](_0x2abf72[_0x8b9a('0x76')])?util[_0x8b9a('0x96')]('SIP/%s/%s%s',_0x2abf72['Trunk'][_0x8b9a('0x40')],isNotNull(_0x2abf72['dialPrefix'])?_0x2abf72['dialPrefix'][_0x8b9a('0x176')]()||'':'',_0x2abf72[_0x8b9a('0x177')]>0x0?_0x2d5184[_0x8b9a('0x15f')][_0x8b9a('0x160')]['substring'](_0x2abf72[_0x8b9a('0x177')]):_0x2d5184[_0x8b9a('0x15f')][_0x8b9a('0x160')]):util[_0x8b9a('0x96')](_0x8b9a('0x178'),_[_0x8b9a('0xb3')](_0x2abf72[_0x8b9a('0x135')])?_0x2abf72[_0x8b9a('0x76')][_0x8b9a('0x40')]:_0x2abf72['TrunkBackup']['name'],isNotNull(_0x2abf72['dialPrefix'])?_0x2abf72[_0x8b9a('0x5d')][_0x8b9a('0x176')]()||'':'',_0x2abf72['dialCutDigit']>0x0?_0x2d5184['Contact'][_0x8b9a('0x160')][_0x8b9a('0x179')](_0x2abf72[_0x8b9a('0x177')]):_0x2d5184[_0x8b9a('0x15f')]['phone']),'callerid':_0x765117,'Exten':_0x8b9a('0xdf'),'Context':'from-sip','Priority':'1','variable':_0x57ae6a,'timeout':(_0x2abf72['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1080cf})[_0x8b9a('0xbb')](function(_0x12da83){return _0x518fb3(_0x12da83);})[_0x8b9a('0xb6')](function(_0x566e4c){_0x2abf72[_0x8b9a('0x63')]+=0x1;var _0x12746a=new History(_0x5774b9['actions'][_0x1080cf]);logger[_0x8b9a('0x99')](util[_0x8b9a('0x96')](_0x8b9a('0x17a'),JSON[_0x8b9a('0x49')](_0x566e4c)));_0x12746a[_0x8b9a('0xac')]=0xe;_0x12746a[_0x8b9a('0xe3')]=_0x8b9a('0x17b');_0x12746a['starttime']=moment()[_0x8b9a('0x96')](_0x8b9a('0xfa'));_0x12746a[_0x8b9a('0xad')]=_0x12746a[_0x8b9a('0xae')];_0x5774b9['createHistory'](_0x12746a)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x17c')));_0x5774b9['moveContactManagedDialer'](_0x12746a)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x17c')))['finally'](function(){delete _0x5774b9[_0x8b9a('0xb1')][_0x1080cf];return _0x30c0e6(msgResponse(_0x8b9a('0x15d'),_0x8b9a('0x17d'),_0x8b9a('0x17e')));});});});};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x31')]=function(_0x4ef5b8){var _0x3ffb81=this[_0x8b9a('0xb1')][_0x4ef5b8[_0x8b9a('0x11e')]];if(_0x3ffb81){delete this[_0x8b9a('0xb1')][_0x4ef5b8[_0x8b9a('0x11e')]];_0x3ffb81[_0x8b9a('0x10f')]=moment()[_0x8b9a('0x96')](_0x8b9a('0xfa'));var _0x25cebf=_0x3ffb81[_0x8b9a('0x4e')]==='ivr'?this[_0x8b9a('0x24')][_0x3ffb81[_0x8b9a('0xb9')]]:this['voiceQueues'][_0x3ffb81['getQueue']()];if(!this[_0x8b9a('0xd6')](_0x4ef5b8[_0x8b9a('0x17f')])){this['updateOriginated'](_0x25cebf);return this['callProgressDetecting'](_0x3ffb81,_0x25cebf,_0x4ef5b8)['catch'](loggerCatch('[callProgressDetecting]\x20'));}this[_0x8b9a('0x29')][_0x4ef5b8['uniqueid']]=_0x3ffb81;}};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x180')]=function(_0x1baa15,_0x33527d,_0x2c06a8){var _0x33cc5a=new History(_0x33527d);if(_0x33cc5a[_0x8b9a('0xff')]+_0x33cc5a[_0x8b9a('0xed')]+_0x33cc5a[_0x8b9a('0xee')]+_0x33cc5a[_0x8b9a('0xef')]+_0x33cc5a[_0x8b9a('0xf0')]+_0x33cc5a[_0x8b9a('0xf1')]+_0x33cc5a[_0x8b9a('0xe9')]+_0x33cc5a[_0x8b9a('0x100')]>=_0x2c06a8['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x1baa15){case 0x3:if(_0x33cc5a[_0x8b9a('0xee')]>=_0x2c06a8[_0x8b9a('0x181')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x33cc5a[_0x8b9a('0xee')]+=0x1,'scheduledat':moment()[_0x8b9a('0xf8')](_0x2c06a8[_0x8b9a('0x182')],_0x8b9a('0xf9'))['format'](_0x8b9a('0xfa')),'ContactId':_0x33cc5a[_0x8b9a('0xfb')],'ListId':_0x33cc5a[_0x8b9a('0xd2')],'VoiceQueueId':_0x33cc5a[_0x8b9a('0x102')]||undefined,'CampaignId':_0x33cc5a['CampaignId']||undefined})['catch'](loggerCatch(_0x8b9a('0x183')));break;case 0x5:if(_0x33cc5a[_0x8b9a('0xff')]>=_0x2c06a8[_0x8b9a('0x184')]-0x1){return!![];}this[_0x8b9a('0xc1')]({'active':![],'countbusyretry':_0x33cc5a[_0x8b9a('0xff')]+=0x1,'scheduledat':moment()['add'](_0x2c06a8['dialBusyRetryFrequency'],_0x8b9a('0xf9'))[_0x8b9a('0x96')](_0x8b9a('0xfa')),'ContactId':_0x33cc5a[_0x8b9a('0xfb')],'ListId':_0x33cc5a[_0x8b9a('0xd2')],'VoiceQueueId':_0x33cc5a[_0x8b9a('0x102')]||undefined,'CampaignId':_0x33cc5a['CampaignId']||undefined})[_0x8b9a('0xb6')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x33cc5a[_0x8b9a('0xed')]>=_0x2c06a8[_0x8b9a('0x185')]-0x1){return!![];}this[_0x8b9a('0xc1')]({'active':![],'countcongestionretry':_0x33cc5a['countcongestionretry']+=0x1,'scheduledat':moment()[_0x8b9a('0xf8')](_0x2c06a8[_0x8b9a('0x186')],_0x8b9a('0xf9'))[_0x8b9a('0x96')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33cc5a[_0x8b9a('0xfb')],'ListId':_0x33cc5a[_0x8b9a('0xd2')],'VoiceQueueId':_0x33cc5a[_0x8b9a('0x102')]||undefined,'CampaignId':_0x33cc5a[_0x8b9a('0xd3')]||undefined})[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x187')));break;case 0x0:if(_0x33cc5a[_0x8b9a('0xef')]>=_0x2c06a8[_0x8b9a('0x188')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x33cc5a['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x8b9a('0xf8')](_0x2c06a8[_0x8b9a('0x189')],_0x8b9a('0xf9'))[_0x8b9a('0x96')](_0x8b9a('0xfa')),'ContactId':_0x33cc5a['ContactId'],'ListId':_0x33cc5a[_0x8b9a('0xd2')],'VoiceQueueId':_0x33cc5a['VoiceQueueId']||undefined,'CampaignId':_0x33cc5a[_0x8b9a('0xd3')]||undefined})[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x18a')));}break;case 0xa:if(_0x33cc5a['countdropretry']>=_0x2c06a8[_0x8b9a('0x18b')]-0x1){return!![];}this[_0x8b9a('0xc1')]({'active':![],'countdropretry':_0x33cc5a[_0x8b9a('0xf0')]+=0x1,'scheduledat':moment()['add'](_0x2c06a8[_0x8b9a('0x113')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33cc5a['ContactId'],'ListId':_0x33cc5a[_0x8b9a('0xd2')],'VoiceQueueId':_0x33cc5a[_0x8b9a('0x102')]||undefined,'CampaignId':_0x33cc5a[_0x8b9a('0xd3')]||undefined})[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x18c')));break;case 0xb:if(_0x33cc5a['countabandonedretry']>=_0x2c06a8[_0x8b9a('0x119')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x33cc5a['countabandonedretry']+=0x1,'scheduledat':moment()[_0x8b9a('0xf8')](_0x2c06a8[_0x8b9a('0x11a')],'minutes')[_0x8b9a('0x96')](_0x8b9a('0xfa')),'ContactId':_0x33cc5a[_0x8b9a('0xfb')],'ListId':_0x33cc5a[_0x8b9a('0xd2')],'VoiceQueueId':_0x33cc5a[_0x8b9a('0x102')]||undefined,'CampaignId':_0x33cc5a['CampaignId']||undefined})[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x18d')));break;case 0x13:if(_0x33cc5a[_0x8b9a('0xe9')]>=_0x2c06a8[_0x8b9a('0xf5')]-0x1){return!![];}this[_0x8b9a('0xc1')]({'active':![],'countmachineretry':_0x33cc5a[_0x8b9a('0xe9')]+=0x1,'scheduledat':moment()['add'](_0x2c06a8[_0x8b9a('0x101')],_0x8b9a('0xf9'))[_0x8b9a('0x96')](_0x8b9a('0xfa')),'ContactId':_0x33cc5a[_0x8b9a('0xfb')],'ListId':_0x33cc5a[_0x8b9a('0xd2')],'VoiceQueueId':_0x33cc5a['VoiceQueueId']||undefined,'CampaignId':_0x33cc5a[_0x8b9a('0xd3')]||undefined})[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0xfc')));break;case 0x14:if(_0x33cc5a[_0x8b9a('0x100')]>=_0x2c06a8[_0x8b9a('0x18e')]-0x1){return!![];}this[_0x8b9a('0xc1')]({'active':![],'countagentrejectretry':_0x33cc5a[_0x8b9a('0x100')]+=0x1,'scheduledat':moment()[_0x8b9a('0xf8')](_0x2c06a8['dialAgentRejectRetryFrequency'],_0x8b9a('0xf9'))[_0x8b9a('0x96')](_0x8b9a('0xfa')),'ContactId':_0x33cc5a[_0x8b9a('0xfb')],'ListId':_0x33cc5a[_0x8b9a('0xd2')],'VoiceQueueId':_0x33cc5a[_0x8b9a('0x102')]||undefined,'CampaignId':_0x33cc5a['CampaignId']||undefined})[_0x8b9a('0xb6')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x8b9a('0x1d')]['callProgressDetecting']=function(_0x5e319c,_0x45a3e4,_0x458f0c){var _0x58a57e=this;var _0x15a7c2=new History(_0x5e319c);return new BPromise(function(_0x3d125d,_0x4f7d4b){if(_[_0x8b9a('0x86')](_0x45a3e4)&&typeof _0x45a3e4!==_0x8b9a('0x18f')){return _0x4f7d4b(msgResponse(_0x8b9a('0x190'),_0x8b9a('0x13a'),_0x8b9a('0x191')));}if(_[_0x8b9a('0x86')](_0x458f0c)&&typeof _0x458f0c!=='object'){return _0x4f7d4b(msgResponse(_0x8b9a('0x190'),_0x8b9a('0x13a'),_0x8b9a('0x192')));}switch(_0x458f0c['reason']){case'0':_0x45a3e4[_0x8b9a('0x62')]+=0x1;_0x15a7c2[_0x8b9a('0xac')]=0x0;_0x15a7c2[_0x8b9a('0xe3')]='NoSuchNumber';_0x15a7c2[_0x8b9a('0xef')]+=0x1;_0x15a7c2[_0x8b9a('0xea')]+=0x1;ami['emit'](_0x8b9a('0x193'),ut[_0x8b9a('0x194')](_0x5e319c,_0x8b9a('0x195')));_0x58a57e['createHistory'](_0x15a7c2)['catch'](loggerCatch(_0x8b9a('0xec')));if(_0x58a57e[_0x8b9a('0x180')](0x0,_0x5e319c,_0x45a3e4)){if(_0x15a7c2['countnosuchnumberretry']>=_0x45a3e4['dialNoSuchNumberMaxRetry']){_0x58a57e[_0x8b9a('0xf6')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x8b9a('0x196'));}else{_0x58a57e[_0x8b9a('0xf3')](_0x15a7c2,_0x3d125d,_0x4f7d4b,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x45a3e4[_0x8b9a('0x197')]+=0x1;_0x15a7c2[_0x8b9a('0xac')]=0x3;_0x15a7c2['statedesc']=_0x8b9a('0x198');_0x15a7c2[_0x8b9a('0xee')]+=0x1;_0x15a7c2[_0x8b9a('0xea')]+=0x1;ami[_0x8b9a('0x4d')]('custom:agentnoanswer',ut['buildObj'](_0x5e319c,_0x8b9a('0x199')));_0x58a57e['createHistory'](_0x15a7c2)[_0x8b9a('0xb6')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x58a57e[_0x8b9a('0x180')](0x3,_0x5e319c,_0x45a3e4)){if(_0x15a7c2['countnoanswerretry']>=_0x45a3e4['dialNoAnswerMaxRetry']){_0x58a57e[_0x8b9a('0xf6')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x8b9a('0x19a'));}else{_0x58a57e[_0x8b9a('0xf3')](_0x15a7c2,_0x3d125d,_0x4f7d4b,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x45a3e4['outboundBusyCallsDay']+=0x1;_0x15a7c2['state']=0x5;_0x15a7c2[_0x8b9a('0xe3')]=_0x8b9a('0x19b');_0x15a7c2[_0x8b9a('0xff')]+=0x1;_0x15a7c2[_0x8b9a('0xea')]+=0x1;ami[_0x8b9a('0x4d')](_0x8b9a('0x19c'),ut['buildObj'](_0x5e319c,_0x8b9a('0x19d')));_0x58a57e[_0x8b9a('0xc9')](_0x15a7c2)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x19e')));if(_0x58a57e[_0x8b9a('0x180')](0x5,_0x5e319c,_0x45a3e4)){if(_0x15a7c2[_0x8b9a('0xff')]>=_0x45a3e4[_0x8b9a('0x184')]){_0x58a57e['createStateFinal'](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x8b9a('0x19f'));}else{_0x58a57e[_0x8b9a('0xf3')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x8b9a('0x19f'));}}break;case'8':_0x45a3e4[_0x8b9a('0x1a0')]+=0x1;_0x15a7c2[_0x8b9a('0xac')]=0x8;_0x15a7c2['statedesc']=_0x8b9a('0x1a1');_0x15a7c2[_0x8b9a('0xed')]+=0x1;_0x15a7c2[_0x8b9a('0xea')]+=0x1;ami['emit']('custom:agentcongestion',ut[_0x8b9a('0x194')](_0x5e319c,_0x8b9a('0x1a2')));_0x58a57e[_0x8b9a('0xc9')](_0x15a7c2)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x1a3')));if(_0x58a57e[_0x8b9a('0x180')](0x8,_0x5e319c,_0x45a3e4)){if(_0x15a7c2['countcongestionretry']>=_0x45a3e4[_0x8b9a('0x185')]){_0x58a57e[_0x8b9a('0xf6')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x8b9a('0x1a4'));}else{_0x58a57e[_0x8b9a('0xf3')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x8b9a('0x1a4'));}}break;case'11':_0x45a3e4['outboundAbandonedCallsDay']+=0x1;_0x15a7c2[_0x8b9a('0xac')]=0xb;_0x15a7c2[_0x8b9a('0xe3')]='Abandoned';_0x15a7c2[_0x8b9a('0xf1')]+=0x1;_0x15a7c2[_0x8b9a('0xea')]+=0x1;_0x58a57e[_0x8b9a('0xc9')](_0x15a7c2)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x11c')));if(_0x58a57e[_0x8b9a('0x180')](0xb,_0x5e319c,_0x45a3e4)){if(_0x15a7c2[_0x8b9a('0xf1')]>=_0x45a3e4[_0x8b9a('0x119')]){_0x58a57e[_0x8b9a('0xf6')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x8b9a('0x1a5'));}else{_0x58a57e[_0x8b9a('0xf3')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x8b9a('0x1a5'));}}break;case'20':_0x45a3e4[_0x8b9a('0x65')]+=0x1;_0x15a7c2[_0x8b9a('0xac')]=0x14;_0x15a7c2[_0x8b9a('0xe3')]=_0x8b9a('0x1a6');_0x15a7c2[_0x8b9a('0x100')]+=0x1;_0x15a7c2[_0x8b9a('0xea')]+=0x1;ami[_0x8b9a('0x4d')](_0x8b9a('0x1a7'),ut[_0x8b9a('0x194')](_0x5e319c,_0x8b9a('0x1a8')));_0x58a57e[_0x8b9a('0xc9')](_0x15a7c2)['catch'](loggerCatch(_0x8b9a('0x1a9')));if(_0x58a57e[_0x8b9a('0x180')](0x14,_0x5e319c,_0x45a3e4)){if(_0x15a7c2['countagentrejectretry']>=_0x45a3e4[_0x8b9a('0x18e')]){_0x58a57e[_0x8b9a('0xf6')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x8b9a('0x1aa'));}else{_0x58a57e[_0x8b9a('0xf3')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x8b9a('0x1aa'));}}break;default:_0x45a3e4[_0x8b9a('0x66')]+=0x1;_0x15a7c2[_0x8b9a('0xac')]=0xc;_0x15a7c2['statedesc']=_0x458f0c[_0x8b9a('0x1ab')];_0x58a57e['createHistory'](_0x15a7c2)[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x1ac')));if(_0x58a57e[_0x8b9a('0x180')](_0x458f0c[_0x8b9a('0x1ab')],_0x5e319c,_0x45a3e4)){if(_0x15a7c2['countbusyretry']+_0x15a7c2[_0x8b9a('0xed')]+_0x15a7c2[_0x8b9a('0xee')]+_0x15a7c2['countnosuchnumberretry']+_0x15a7c2[_0x8b9a('0xf0')]+_0x15a7c2[_0x8b9a('0xf1')]+_0x15a7c2['countmachineretry']+_0x15a7c2[_0x8b9a('0x100')]>=_0x45a3e4[_0x8b9a('0xf2')]){_0x58a57e[_0x8b9a('0xf3')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x458f0c[_0x8b9a('0x1ab')]);}else{_0x58a57e[_0x8b9a('0xf6')](_0x15a7c2,_0x3d125d,_0x4f7d4b,_0x458f0c[_0x8b9a('0x1ab')]);}}}});};Dialer[_0x8b9a('0x1d')][_0x8b9a('0xf3')]=function(_0x31b12f,_0x462838,_0x282fb4,_0x52bce1){var _0x50cee7=new Final(_0x31b12f);_0x50cee7['state']=0xf;_0x50cee7[_0x8b9a('0xe3')]=_0x8b9a('0x1ad');this[_0x8b9a('0xf6')](_0x50cee7,_0x462838,_0x282fb4,_0x52bce1);};Dialer[_0x8b9a('0x1d')][_0x8b9a('0xf6')]=function(_0x3fdde9,_0x4675fa,_0x2705b2,_0x46e4b0){this[_0x8b9a('0xc7')](_0x3fdde9)[_0x8b9a('0xbb')](function(){return _0x4675fa(msgResponse(_0x8b9a('0x190'),'Success',_0x46e4b0));})['catch'](function(){return _0x2705b2(msgResponse(_0x8b9a('0x1ae'),_0x8b9a('0x13a'),'contact\x20not\x20moved'));});};Dialer['prototype']['predictive']=function(_0x36f74d){var _0x1e26fe=_0x36f74d[_0x8b9a('0x1af')]/0x64;var _0x1e3952=_0x36f74d['outboundDropCallsDayTimeout']/(_0x36f74d[_0x8b9a('0x1b0')]+_0x36f74d[_0x8b9a('0x5f')]);var _0xe94a9d=Math[_0x8b9a('0x1b1')](_0x36f74d[_0x8b9a('0x6e')]*(_0x36f74d[_0x8b9a('0x1b2')]/0x64));var _0x211f27=Math[_0x8b9a('0x1b1')](_0x36f74d['predictiveIntervalAvailable']*(_0x36f74d[_0x8b9a('0x1b3')]/0x64));var _0x2d3e99=_0x36f74d[_0x8b9a('0x51')]+_0x36f74d[_0x8b9a('0x55')];var _0x4e467e=Math['floor'](_0x36f74d[_0x8b9a('0x71')]*_0x36f74d[_0x8b9a('0x73')]*_0x36f74d[_0x8b9a('0x1b4')]*_0x36f74d['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x36f74d['startProgressive'])){if(!_[_0x8b9a('0x86')](_0x36f74d[_0x8b9a('0x75')])){_0x36f74d[_0x8b9a('0x75')]=undefined;loggerPredictive[_0x8b9a('0x99')](_0x8b9a('0x1b5'),_0x8b9a('0x1b6'));}if(!_[_0x8b9a('0x86')](_0x36f74d[_0x8b9a('0x93')])){loggerPredictive['error'](_0x8b9a('0x1b5'),_0x8b9a('0x1b7'));clearInterval(_0x36f74d['handlePredictive']);_0x36f74d[_0x8b9a('0x93')]=undefined;}_0x36f74d['startProgressive']=moment()[_0x8b9a('0x96')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x8b9a('0x7e')](_0x36f74d[_0x8b9a('0x40')],_0x8b9a('0x1b8'),_0x36f74d['startProgressive']);this[_0x8b9a('0x14d')](_0x36f74d,0x1);}else if(ifInterval(_0x36f74d[_0x8b9a('0x1b9')],_0x36f74d[_0x8b9a('0x2b')])){this[_0x8b9a('0x14d')](_0x36f74d,0x1);loggerPredictiveCalls[_0x8b9a('0x7e')](_0x8b9a('0x1ba'),_0x36f74d[_0x8b9a('0x2b')],_0x36f74d[_0x8b9a('0x40')]);_0x36f74d[_0x8b9a('0x71')]=0x0;_0x36f74d[_0x8b9a('0x6b')]=0x0;}else if(_0x1e26fe<_0x1e3952&&_0x36f74d[_0x8b9a('0x1bb')]==='dropRate'){freeVariablesPredictive(_0x36f74d);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x1bc'),'Dropped\x20calls\x20day',_0x1e3952,_0x8b9a('0x2b'),_0x36f74d[_0x8b9a('0x40')]);}else if(_0x4e467e<_0x36f74d[_0x8b9a('0x6b')]&&_0x36f74d[_0x8b9a('0x1bb')]==='dropRate'){freeVariablesPredictive(_0x36f74d);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x1bd'),_0x8b9a('0x1be'),_0x4e467e,'Drop\x20in\x20this\x20interval',_0x36f74d[_0x8b9a('0x6b')],'startProgressive',_0x36f74d[_0x8b9a('0x40')]);}else if(!ifInterval(_0x36f74d[_0x8b9a('0x1b9')],_0x36f74d[_0x8b9a('0x2b')])&&_[_0x8b9a('0x86')](_0x36f74d['startPredictive'])&&!_['isUndefined'](_0x36f74d[_0x8b9a('0x2b')])){_0x36f74d[_0x8b9a('0x75')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x36f74d[_0x8b9a('0x40')],_0x8b9a('0x1bf'),_0x36f74d[_0x8b9a('0x75')]);this['averageHandleTime'](_0x36f74d[_0x8b9a('0x1b9')])[_0x8b9a('0xbb')](this[_0x8b9a('0x1c0')](_0x36f74d))[_0x8b9a('0xbb')](mergeDataErlangB(_0x36f74d))[_0x8b9a('0xbb')](this[_0x8b9a('0x1c1')](_0x36f74d))['catch'](loggerCatchPredictive(_0x8b9a('0x1c2'),_0x36f74d));}else if(!ifInterval(_0x36f74d['dialPredictiveInterval'],_0x36f74d['startPredictive'])){_0x36f74d[_0x8b9a('0x6b')]=0x0;_0x36f74d[_0x8b9a('0x75')]=moment()[_0x8b9a('0x96')](_0x8b9a('0xfa'));loggerPredictive['info'](_0x36f74d[_0x8b9a('0x40')],'recalculate\x20predictive\x20at',_0x36f74d[_0x8b9a('0x75')]);clearInterval(_0x36f74d[_0x8b9a('0x93')]);_0x36f74d[_0x8b9a('0x93')]=undefined;this[_0x8b9a('0xbe')](_0x36f74d['dialPredictiveInterval'])[_0x8b9a('0xbb')](this[_0x8b9a('0x1c0')](_0x36f74d))[_0x8b9a('0xbb')](mergeDataErlangB(_0x36f74d))[_0x8b9a('0xbb')](this['startMethodPredictive'](_0x36f74d))[_0x8b9a('0xb6')](loggerCatchPredictive(_0x8b9a('0x1c3'),_0x36f74d));}else if(_0x36f74d[_0x8b9a('0x6e')]&&_0x2d3e99<_0x36f74d['predictiveIntervalAvailable']-_0x211f27){freeVariablesPredictive(_0x36f74d);loggerPredictive['info'](_0x36f74d[_0x8b9a('0x40')],_0x8b9a('0x1c4'),_0x2d3e99,')\x20are\x20less\x20than\x20threshold\x20(',_0x36f74d[_0x8b9a('0x6e')],'-',_0x211f27,'=',_0x36f74d[_0x8b9a('0x6e')]-_0x211f27,')');}else if(_0x36f74d[_0x8b9a('0x6e')]&&_0x2d3e99>_0x36f74d[_0x8b9a('0x6e')]+_0xe94a9d){freeVariablesPredictive(_0x36f74d);loggerPredictive[_0x8b9a('0x7e')](_0x36f74d[_0x8b9a('0x40')],_0x8b9a('0x1c4'),_0x2d3e99,_0x8b9a('0x1c5'),_0x36f74d[_0x8b9a('0x6e')],'+',_0xe94a9d,'=',_0x36f74d[_0x8b9a('0x6e')]+_0xe94a9d,')');}};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x1c0')]=function(_0x103fbc){var _0x5a4777=this;return function(_0x184476){return new BPromise(function(_0x21132d,_0x2dd4e){_['merge'](_0x103fbc,_0x184476[0x0]);if(checkGetDataPredictive(_0x184476[0x0])){var _0x5a7de8=_0x103fbc[_0x8b9a('0x6e')]=_0x103fbc[_0x8b9a('0x55')]+_0x103fbc[_0x8b9a('0x51')];var _0x51e061=_0x103fbc['dialPredictiveInterval']*0x3c;var _0x222090=_0x184476[0x0][_0x8b9a('0x87')]+_0x184476[0x0][_0x8b9a('0x68')];var _0xa300f=(_0x184476[0x0][_0x8b9a('0x67')]+_0x184476[0x0][_0x8b9a('0x6a')]+_0x184476[0x0][_0x8b9a('0x69')])/_0x184476[0x0][_0x8b9a('0x6f')];_0x103fbc['predictiveIntervalHitRate']=_0xa300f>0x0?_0xa300f:0x1;switch(_0x103fbc[_0x8b9a('0x1bb')]){case _0x8b9a('0x1c6'):var _0x236e8d=_0x103fbc[_0x8b9a('0x1af')]/0x64;return _0x5a4777['abandonmentRate'](_0x5a7de8,_0x51e061,_0x222090,_0xa300f,_0x236e8d)[_0x8b9a('0xbb')](function(_0x2ebabb){return _0x21132d(_0x2ebabb);});case _0x8b9a('0x1c7'):var _0xa6f54e=_0x103fbc[_0x8b9a('0x1af')]/0x64;return _0x5a4777[_0x8b9a('0x1c8')](_0x5a7de8,_0x51e061,_0x222090,_0xa300f,_0xa6f54e)[_0x8b9a('0xbb')](function(_0x2091b4){return _0x21132d(_0x2091b4);});default:return _0x2dd4e(msgResponse(_0x8b9a('0x1c9'),_0x8b9a('0x13a'),_0x8b9a('0x1ca')));}}else{return _0x2dd4e(msgResponse(_0x8b9a('0x1c9'),_0x8b9a('0x13a'),_0x8b9a('0x1cb')));}});};};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x1cc')]=function(_0x25b8b9){var _0x34f7dc=this;return function(_0x454e66){return new BPromise(function(_0x9359e9,_0x52eca8){_[_0x8b9a('0x90')](_0x25b8b9,_0x454e66[0x0]);if(checkGetDataPredictive(_0x454e66[0x0])){loggerPredictive[_0x8b9a('0x7e')](JSON['stringify'](_0x454e66[0x0]));if(_0x25b8b9['dialPredictiveOptimization']==='dropRate'){return _0x34f7dc['getVoiceQueueRtPauses'](_0x25b8b9['id'])[_0x8b9a('0xbb')](function(_0x26bddd){var _0x5bd1dc=_0x25b8b9['loggedIn']-_0x26bddd[0x0][_0x8b9a('0x1cd')];var _0x2a3941=_0x25b8b9[_0x8b9a('0x1b9')]*0x3c;var _0x51ef32=_0x454e66[0x0]['predictiveIntervalAvgTalktime']+_0x454e66[0x0][_0x8b9a('0x68')];var _0x2730d1=(_0x454e66[0x0][_0x8b9a('0x67')]+_0x454e66[0x0][_0x8b9a('0x6a')]+_0x454e66[0x0][_0x8b9a('0x69')])/_0x454e66[0x0]['predictiveIntervalTotalCalls'];var _0x11c424=_0x25b8b9[_0x8b9a('0x1af')]/0x64;_0x25b8b9[_0x8b9a('0x6d')]=_0x26bddd[0x0][_0x8b9a('0x1cd')]||0x0;_0x25b8b9[_0x8b9a('0x1b4')]=_0x2730d1>0x0?_0x2730d1:0x1;return _0x34f7dc[_0x8b9a('0x1ce')](_0x5bd1dc,_0x2a3941,_0x51ef32,_0x2730d1,_0x11c424);})[_0x8b9a('0xbb')](function(_0x2b40d2){return _0x9359e9(_0x2b40d2);})[_0x8b9a('0xb6')](function(_0x592f8f){return _0x52eca8(msgResponse(_0x8b9a('0x1cf'),_0x8b9a('0x13a'),JSON[_0x8b9a('0x49')](_0x592f8f)));});}if(_0x25b8b9[_0x8b9a('0x1bb')]==='agentBusyFactor'){return _0x34f7dc[_0x8b9a('0xc6')](_0x25b8b9['id'])[_0x8b9a('0xbb')](function(_0x1f18c7){var _0x15635c=_0x25b8b9[_0x8b9a('0x153')]-_0x1f18c7[0x0]['outboundQueuePauses'];var _0x42ccd7=_0x25b8b9[_0x8b9a('0x1b9')]*0x3c;var _0x420d89=_0x454e66[0x0][_0x8b9a('0x87')]+_0x454e66[0x0][_0x8b9a('0x68')];var _0x52fd82=(_0x454e66[0x0][_0x8b9a('0x67')]+_0x454e66[0x0][_0x8b9a('0x6a')]+_0x454e66[0x0][_0x8b9a('0x69')])/_0x454e66[0x0][_0x8b9a('0x6f')];var _0x46c216=_0x25b8b9[_0x8b9a('0x1af')]/0x64;_0x25b8b9[_0x8b9a('0x6d')]=_0x1f18c7[0x0][_0x8b9a('0x1cd')]||0x0;_0x25b8b9['predictiveIntervalHitRate']=_0x52fd82>0x0?_0x52fd82:0x1;return _0x34f7dc[_0x8b9a('0x1c8')](_0x15635c,_0x42ccd7,_0x420d89,_0x52fd82,_0x46c216);})[_0x8b9a('0xbb')](function(_0xf9511c){return _0x9359e9(_0xf9511c);})[_0x8b9a('0xb6')](function(_0x1fcb29){return _0x52eca8(msgResponse(_0x8b9a('0x1cf'),_0x8b9a('0x13a'),JSON[_0x8b9a('0x49')](_0x1fcb29)));});}}else{return _0x52eca8(msgResponse(_0x8b9a('0x1c9'),_0x8b9a('0x13a'),'check\x20failure'));}});};};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x1c1')]=function(_0x3003dd){var _0xfb53f1=this;return function(){var _0x3dbf38=0x0;var _0x21d363=Math['floor'](_0x3003dd[_0x8b9a('0x72')]*0x3e8);if(_0x21d363>0x0){_0x21d363=_0x21d363<0x64?0x64:_0x21d363;loggerPredictive['info'](_0x3003dd['name'],_0x8b9a('0x1d0'),_0x21d363,'milliseconds');_0x3003dd['handlePredictive']=setInterval(function(){_0xfb53f1[_0x8b9a('0x93')](_0x3003dd);loggerPredictiveCalls[_0x8b9a('0x7e')](_0x8b9a('0x1d1'),_0x3dbf38+=0x1);},_0x21d363);}else{loggerPredictive[_0x8b9a('0x7e')](_0x3003dd[_0x8b9a('0x40')],_0x8b9a('0x1d2'));}};};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x1d3')]=function(_0x2afdc6,_0x12a267){var _0x4d274d=this;return function(_0x167e7d){if(_[_0x8b9a('0x46')](_0x167e7d)){if(_[_0x8b9a('0xb3')](_0x12a267[_0x8b9a('0x1d4')])||!_0x12a267[_0x8b9a('0x1d5')]){if(_0x2afdc6[_0x8b9a('0x59')]===_0x8b9a('0x14e')){_0x2afdc6['queueStatusComplete']=_[_0x8b9a('0x86')](_0x2afdc6[_0x8b9a('0x123')])?!![]:_0x2afdc6[_0x8b9a('0x123')];var _0x40dbbd=uuid['v4']();_0x4d274d['actions'][_0x40dbbd]=new Action(_0x2afdc6,_0x12a267,_0x40dbbd);loggerBooked['info'](_0x8b9a('0x1d6'),_0x40dbbd,_0x8b9a('0x1d7'),JSON['stringify'](_0x2afdc6[_0x8b9a('0x123')]),_0x8b9a('0x1d8'),_0x2afdc6[_0x8b9a('0x40')]);if(_0x2afdc6[_0x8b9a('0x123')]){_0x2afdc6[_0x8b9a('0x123')]=![];_0x4d274d[_0x8b9a('0x2d')][_0x4d274d[_0x8b9a('0xb1')][_0x40dbbd][_0x8b9a('0xb9')]]=[];ami['Action']({'actionid':_0x40dbbd,'action':_0x8b9a('0x1d9'),'queue':_0x2afdc6[_0x8b9a('0x40')]})[_0x8b9a('0xb6')](function(){_0x4d274d[_0x8b9a('0xb8')](_0x2afdc6);_0x4d274d[_0x8b9a('0xc1')]({'active':![],'ContactId':_0x4d274d['actions'][_0x40dbbd][_0x8b9a('0xfb')],'ListId':_0x4d274d[_0x8b9a('0xb1')][_0x40dbbd]['ListId'],'VoiceQueueId':_0x4d274d[_0x8b9a('0xb1')][_0x40dbbd][_0x8b9a('0x102')]||undefined,'CampaignId':_0x4d274d['actions'][_0x40dbbd][_0x8b9a('0xd3')]||undefined})[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x1da')));delete _0x4d274d[_0x8b9a('0xb1')][_0x40dbbd];});}else{loggerBooked[_0x8b9a('0x7e')](_0x8b9a('0x1db'),JSON[_0x8b9a('0x49')](_0x2afdc6[_0x8b9a('0x123')]),'Queue:\x20',_0x2afdc6[_0x8b9a('0x40')]);_0x4d274d[_0x8b9a('0xb8')](_0x2afdc6);_0x4d274d[_0x8b9a('0xc1')]({'active':![],'ContactId':_0x4d274d['actions'][_0x40dbbd][_0x8b9a('0xfb')],'ListId':_0x4d274d[_0x8b9a('0xb1')][_0x40dbbd][_0x8b9a('0xd2')],'VoiceQueueId':_0x4d274d[_0x8b9a('0xb1')][_0x40dbbd][_0x8b9a('0x102')]||undefined,'CampaignId':_0x4d274d[_0x8b9a('0xb1')][_0x40dbbd]['CampaignId']||undefined})[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x1da')));delete _0x4d274d[_0x8b9a('0xb1')][_0x40dbbd];}}else{return _0x4d274d[_0x8b9a('0x15c')](_0x2afdc6,_0x12a267);}}else{if(getDiff(_0x12a267[_0x8b9a('0x1dc')])<_0x2afdc6[_0x8b9a('0x1dd')]*0x3c){if(_0x12a267['Agent']&&!_0x12a267['Agent']['voicePause']){_0x4d274d[_0x8b9a('0x22')][_0x8b9a('0x126')](_0x12a267['id'])['finally'](function(){_0x4d274d['updateOriginated'](_0x2afdc6);});}else{_0x4d274d['unlockContact']({'active':![]},_0x12a267['id'],0x1)[_0x8b9a('0x20')](function(){_0x4d274d[_0x8b9a('0xb8')](_0x2afdc6);});}}else{_0x2afdc6[_0x8b9a('0x64')]+=0x1;_0x4d274d[_0x8b9a('0xb8')](_0x2afdc6);if(_0x2afdc6[_0x8b9a('0x1de')]){_0x4d274d['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x12a267[_0x8b9a('0xfb')],'ListId':_0x12a267['ListId'],'VoiceQueueId':_0x12a267[_0x8b9a('0x102')]||undefined,'CampaignId':_0x12a267[_0x8b9a('0xd3')]||undefined})[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x1df')));_0x4d274d[_0x8b9a('0xc9')](createObjHistory(_0x2afdc6,_0x12a267,_0x8b9a('0x1e0'),0x17,_0x8b9a('0x1e1')))[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x1e2')));}else{_0x4d274d[_0x8b9a('0xd0')](createObjHistory(_0x2afdc6,_0x12a267,'RECALLFAILEDTIMEOUT',0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]',_0x8b9a('0x1e3'));}}}}else{_0x2afdc6[_0x8b9a('0x60')]+=0x1;_0x4d274d[_0x8b9a('0xd0')](createObjHistory(_0x2afdc6,_0x12a267,_0x8b9a('0x1e4'),0xd,'Blacklist'),_0x8b9a('0x1e5'),_0x8b9a('0x1e6'));throw _0x8b9a('0x1e7');}};};Dialer['prototype'][_0x8b9a('0x151')]=function(_0x425fd0){var _0x4bff75=this;var _0xaed662=_0x425fd0[_0x8b9a('0x1e8')]-_0x425fd0['originated']-_0x425fd0[_0x8b9a('0x1e9')];emitCampaignSummary(_0x425fd0);if(_0xaed662>0x0){if(_0xaed662>this[_0x8b9a('0x27')]){_0xaed662=this[_0x8b9a('0x27')];}_0x425fd0[_0x8b9a('0x1e9')]+=_0xaed662;this[_0x8b9a('0xc5')](_0x425fd0['id'],_0xaed662,_0x425fd0['dialOrderByScheduledAt'])[_0x8b9a('0xbb')](function(_0x58466e){_0x425fd0[_0x8b9a('0x1e9')]-=_0xaed662;_0x425fd0[_0x8b9a('0x1e9')]=_0x425fd0[_0x8b9a('0x1e9')]>0x0?_0x425fd0[_0x8b9a('0x1e9')]:0x0;if(!checkContactEmpty(_0x58466e)){_0x425fd0[_0x8b9a('0x41')]=_0x8b9a('0xa4');logger['info']('[getContactCampaign2][Empty]'+_0x425fd0[_0x8b9a('0x40')]);}else{_0x425fd0[_0x8b9a('0x70')]+=_0x58466e[_0x8b9a('0x9c')];_0x425fd0['message']='RUNNING';for(var _0x5780f0=0x0;_0x5780f0<_0x58466e[_0x8b9a('0x9c')];_0x5780f0+=0x1){_0x425fd0[_0x8b9a('0x1ea')]+=0x1;if(_[_0x8b9a('0xb3')](_0x58466e[_0x5780f0])||_[_0x8b9a('0xb3')](_0x58466e[_0x5780f0][_0x8b9a('0x15f')])||_[_0x8b9a('0xb3')](_0x58466e[_0x5780f0][_0x8b9a('0x15f')][_0x8b9a('0x160')])){_0x4bff75[_0x8b9a('0xce')](_0x8b9a('0x1eb'),_0x425fd0,_0x58466e[_0x5780f0]);}else{_0x4bff75[_0x8b9a('0xbd')](_[_0x8b9a('0xd1')](_0x58466e[_0x5780f0],[_0x8b9a('0xd3'),_0x8b9a('0x1ec')]))[_0x8b9a('0xbb')](_0x4bff75['checkContactBlack'](_0x425fd0,_0x58466e[_0x5780f0]))[_0x8b9a('0xb6')](_0x4bff75[_0x8b9a('0xcd')](_0x8b9a('0x1ed'),_0x425fd0));}}}})[_0x8b9a('0xb6')](loggerGetContactDialer(_0x8b9a('0x1ee'),_0x425fd0,_0xaed662));}};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x14d')]=function(_0x1f8087,_0x2b9eaa){var _0x49f071=this;var _0x39d484=[];var _0x412cce=_0x2b9eaa>=0x1?_0x2b9eaa:0x1;if(_0x1f8087[_0x8b9a('0x59')]===_0x8b9a('0x14e')){_0x412cce=0x1;}var _0x108a08=Math['floor'](_0x1f8087[_0x8b9a('0x51')]*_0x412cce)-_0x1f8087[_0x8b9a('0x70')]-_0x1f8087['temp'];emitVoiceQueueSummary(_0x1f8087);if(_0x1f8087[_0x8b9a('0x1ef')]>0x0){var _0x589d01=_0x1f8087[_0x8b9a('0x1ef')]-_0x1f8087[_0x8b9a('0x70')]-_0x1f8087[_0x8b9a('0x55')]-_0x1f8087[_0x8b9a('0x1e9')]-_0x1f8087[_0x8b9a('0x52')];if(_0x108a08>_0x589d01){_0x108a08=_0x589d01;}}if(_0x108a08>0x0){if(_0x1f8087[_0x8b9a('0x59')]===_0x8b9a('0x14e')){_0x108a08=0x1;}if(_0x108a08>this[_0x8b9a('0x27')]){_0x108a08=this[_0x8b9a('0x27')];}_0x1f8087[_0x8b9a('0x1e9')]+=_0x108a08;for(var _0xe1855a in this[_0x8b9a('0x25')]){if(typeof this[_0x8b9a('0x25')][_0xe1855a]!==_0x8b9a('0x9d')){if(this[_0x8b9a('0x25')][_0xe1855a]['state']===_0x8b9a('0x1f0')&&this['agents'][_0xe1855a]['status']==='reachable'){_0x39d484['push'](this[_0x8b9a('0x25')][_0xe1855a]['id']);}}}this[_0x8b9a('0xc3')](_0x1f8087['id'],_0x39d484,_0x108a08,_0x1f8087['dialOrderByScheduledAt'])['then'](function(_0x7c11e6){_0x1f8087[_0x8b9a('0x1e9')]-=_0x108a08;_0x1f8087[_0x8b9a('0x1e9')]=_0x1f8087[_0x8b9a('0x1e9')]>0x0?_0x1f8087[_0x8b9a('0x1e9')]:0x0;if(!checkContactEmpty(_0x7c11e6)){_0x49f071[_0x8b9a('0x1f1')](_0x1f8087)[_0x8b9a('0xbb')](sendMessageReschedule(_0x1f8087))['catch'](loggerCatch(_0x8b9a('0x1f2')));}else{_0x1f8087['originated']+=_0x7c11e6[_0x8b9a('0x9c')];_0x1f8087['message']=_0x1f8087['dialMethod']===_0x8b9a('0x14e')?_0x8b9a('0x1f3'):_0x8b9a('0x1f4');for(var _0x19f847=0x0;_0x19f847<_0x7c11e6[_0x8b9a('0x9c')];_0x19f847+=0x1){if(_['isNil'](_0x7c11e6[_0x19f847])||_[_0x8b9a('0xb3')](_0x7c11e6[_0x19f847][_0x8b9a('0x15f')])||_[_0x8b9a('0xb3')](_0x7c11e6[_0x19f847]['Contact']['phone'])){_0x49f071[_0x8b9a('0xce')](_0x8b9a('0x1eb'),_0x1f8087,_0x7c11e6[_0x19f847]);}else{_0x49f071[_0x8b9a('0xbc')](_['pick'](_0x7c11e6[_0x19f847],[_0x8b9a('0x102'),_0x8b9a('0x1ec')]))[_0x8b9a('0xbb')](_0x49f071[_0x8b9a('0x1d3')](_0x1f8087,_0x7c11e6[_0x19f847]))['catch'](_0x49f071[_0x8b9a('0xcd')](_0x8b9a('0x1eb'),_0x1f8087));}}}})[_0x8b9a('0xb6')](loggerGetContactDialer('[getContactDialer2]',_0x1f8087,_0x108a08));}};Dialer['prototype'][_0x8b9a('0x93')]=function(_0x3321f0){if(_0x3321f0[_0x8b9a('0x1ef')]>0x0){var _0x2d4e26=_0x3321f0[_0x8b9a('0x1ef')]-_0x3321f0[_0x8b9a('0x70')]-_0x3321f0[_0x8b9a('0x55')];if(_0x2d4e26>0x0){this['tryOriginatePredictive'](_0x3321f0);}else{loggerPredictiveCalls[_0x8b9a('0x7e')](_0x8b9a('0x1f5'));}}else{this[_0x8b9a('0x1f6')](_0x3321f0);}};Dialer['prototype'][_0x8b9a('0x1f6')]=function(_0x569e3b){var _0x52911e=this;var _0x19c8a1=[];_0x569e3b[_0x8b9a('0x70')]+=0x1;for(var _0x16f731 in this[_0x8b9a('0x25')]){if(typeof this[_0x8b9a('0x25')][_0x16f731]!==_0x8b9a('0x9d')){if(this[_0x8b9a('0x25')][_0x16f731]['state']==='not_inuse'&&this[_0x8b9a('0x25')][_0x16f731][_0x8b9a('0xb5')]===_0x8b9a('0xd9')){_0x19c8a1[_0x8b9a('0x121')](this[_0x8b9a('0x25')][_0x16f731]['id']);}}}this[_0x8b9a('0xc3')](_0x569e3b['id'],_0x19c8a1,0x1,_0x569e3b[_0x8b9a('0x1f7')])[_0x8b9a('0xbb')](function(_0x95afcf){if(!checkContactEmpty(_0x95afcf)){checkContactLowerLimitOriginate(_0x569e3b,0x1,0x0);_0x52911e[_0x8b9a('0x1f1')](_0x569e3b)[_0x8b9a('0xbb')](sendMessageReschedule(_0x569e3b))[_0x8b9a('0xb6')](loggerCatch(_0x8b9a('0x1f2')));}else{_0x569e3b[_0x8b9a('0x41')]=_0x8b9a('0x1f4');if(_[_0x8b9a('0xb3')](_0x95afcf[0x0])||_['isNil'](_0x95afcf[0x0]['Contact'])||_[_0x8b9a('0xb3')](_0x95afcf[0x0][_0x8b9a('0x15f')][_0x8b9a('0x160')])){_0x52911e['emptyContact'](_0x8b9a('0x1eb'),_0x569e3b,_0x95afcf[0x0]);}else{_0x52911e[_0x8b9a('0xbc')](_[_0x8b9a('0xd1')](_0x95afcf[0x0],['VoiceQueueId',_0x8b9a('0x1ec')]))[_0x8b9a('0xbb')](_0x52911e[_0x8b9a('0x1d3')](_0x569e3b,_0x95afcf[0x0]))[_0x8b9a('0xb6')](_0x52911e[_0x8b9a('0xcd')](_0x8b9a('0x1f8'),_0x569e3b));}}})[_0x8b9a('0xb6')](loggerGetContactDialer(_0x8b9a('0x1f9'),_0x569e3b,0x1));emitVoiceQueueSummary(_0x569e3b);};Dialer['prototype'][_0x8b9a('0x1ce')]=function(_0x95d6b6,_0x5ed152,_0x5d8232,_0x4deb90,_0x2cdf3b,_0x49ea18){loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x1fa'));loggerPredictive['info'](_0x8b9a('0x1fb'),_0x95d6b6);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5ed152);loggerPredictive['info']('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',_0x5d8232);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x1fc'),_0x4deb90);loggerPredictive[_0x8b9a('0x7e')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2cdf3b);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x85'));return new BPromise(function(_0x701bd7,_0x328fbc){if(_0x95d6b6<=0x0||isNaN(_0x95d6b6)){return _0x328fbc(msgResponse(_0x8b9a('0x1fd'),_0x8b9a('0x17d'),_0x8b9a('0x1fe')+_0x95d6b6));}if(_0x5d8232<=0x0||isNaN(_0x5d8232)){return _0x328fbc(msgResponse(_0x8b9a('0x1fd'),_0x8b9a('0x17d'),_0x8b9a('0x1ff')+_0x5d8232));}if(_0x4deb90<=0x0||isNaN(_0x4deb90)){return _0x328fbc(msgResponse(_0x8b9a('0x1fd'),'Error',_0x8b9a('0x200')+_0x4deb90));}if(_0x5ed152<=0x0||isNaN(_0x5ed152)){return _0x328fbc(msgResponse(_0x8b9a('0x1fd'),_0x8b9a('0x17d'),_0x8b9a('0x201')+_0x5ed152));}if(_0x2cdf3b<=0x0||isNaN(_0x2cdf3b)){return _0x328fbc(msgResponse('[abandonmentRate]',_0x8b9a('0x17d'),'Amax\x20=\x20'+_0x2cdf3b));}_0x49ea18=_0x49ea18||0x0;var _0x501279=0x1/_0x5d8232;var _0x33f075=0x0;var _0x33fef2=0x0;var _0x208405=0x0;var _0x23f972=0x0;for(var _0x272c0a=0x0;_0x208405<_0x2cdf3b;_0x272c0a+=0x1){_0x33fef2=_0x272c0a/_0x5ed152;_0x33f075=(_0x4deb90*_0x33fef2+_0x49ea18)/_0x501279;_0x208405=erlangb(_0x33f075,_0x95d6b6);_0x23f972=_0x33f075/_0x95d6b6*(0x1-erlangb(_0x33f075,_0x95d6b6));}return _0x701bd7({'erlangCalls':_0x272c0a,'erlangCallToSecond':_0x5ed152/_0x272c0a,'erlangAbandonmentRate':_0x208405,'erlangBusyFactor':_0x23f972});});};Dialer[_0x8b9a('0x1d')][_0x8b9a('0x1c8')]=function(_0x1483d2,_0x370135,_0x5355ad,_0x2fe1b2,_0x11874d,_0x39b182){loggerPredictive['info'](_0x8b9a('0x202'));loggerPredictive['info'](_0x8b9a('0x1fb'),_0x1483d2);loggerPredictive['info'](_0x8b9a('0x203'),_0x370135);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x204'),_0x5355ad);loggerPredictive[_0x8b9a('0x7e')]('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',_0x2fe1b2);loggerPredictive['info'](_0x8b9a('0x205'),_0x11874d);loggerPredictive[_0x8b9a('0x7e')](_0x8b9a('0x85'));return new BPromise(function(_0x4cdc36,_0x5298c8){if(_0x1483d2<=0x0||isNaN(_0x1483d2)){return _0x5298c8(msgResponse('[busyFactor]',_0x8b9a('0x17d'),_0x8b9a('0x1fe')+_0x1483d2));}if(_0x5355ad<=0x0||isNaN(_0x5355ad)){return _0x5298c8(msgResponse(_0x8b9a('0x206'),_0x8b9a('0x17d'),_0x8b9a('0x1ff')+_0x5355ad));}if(_0x2fe1b2<=0x0||isNaN(_0x2fe1b2)){return _0x5298c8(msgResponse(_0x8b9a('0x206'),_0x8b9a('0x17d'),_0x8b9a('0x200')+_0x2fe1b2));}if(_0x370135<=0x0||isNaN(_0x370135)){return _0x5298c8(msgResponse(_0x8b9a('0x206'),_0x8b9a('0x17d'),_0x8b9a('0x201')+_0x370135));}if(_0x11874d<=0x0||isNaN(_0x11874d)){return _0x5298c8(msgResponse(_0x8b9a('0x206'),_0x8b9a('0x17d'),_0x8b9a('0x207')+_0x11874d));}_0x39b182=_0x39b182||0x0;var _0x2e1f9e=0x1/_0x5355ad;var _0x550224=0x0;var _0x379215=0x0;var _0xc3ff9e=0x0;var _0x3fc453=0x0;for(var _0xc50fae=0x0;_0x3fc453<_0x11874d;_0xc50fae+=0x1){_0x379215=_0xc50fae/_0x370135;_0x550224=(_0x2fe1b2*_0x379215+_0x39b182)/_0x2e1f9e;_0xc3ff9e=erlangb(_0x550224,_0x1483d2);_0x3fc453=_0x550224/_0x1483d2*(0x1-erlangb(_0x550224,_0x1483d2));}return _0x4cdc36({'erlangCalls':_0xc50fae,'erlangCallToSecond':_0x370135/_0xc50fae,'erlangAbandonmentRate':_0xc3ff9e,'erlangBusyFactor':_0x3fc453});});};module[_0x8b9a('0x208')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index d3457a8..be679c1 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 _0xda0b=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat'];(function(_0x1b56cd,_0x3ae5fe){var _0xbd58df=function(_0x451e9e){while(--_0x451e9e){_0x1b56cd['push'](_0x1b56cd['shift']());}};_0xbd58df(++_0x3ae5fe);}(_0xda0b,0x1e2));var _0xbda0=function(_0x2a6a05,_0x1c569d){_0x2a6a05=_0x2a6a05-0x0;var _0xf13753=_0xda0b[_0x2a6a05];return _0xf13753;};'use strict';var util=require(_0xbda0('0x0'));var _=require(_0xbda0('0x1'));var moment=require(_0xbda0('0x2'));function getSeconds(_0xf8221e,_0x557d19){var _0x44f124=moment(_0xf8221e)['milliseconds'](0x0);var _0x2c2c49=moment(_0x557d19)['milliseconds'](0x0);return _0x44f124[_0xbda0('0x3')](_0x2c2c49,'seconds');}function QueueCallerAbandon(_0x13bce6,_0xcb2361){this['scheduledat']=_0x13bce6[_0xbda0('0x4')];this[_0xbda0('0x5')]=_0x13bce6['type'];this[_0xbda0('0x6')]=_0x13bce6[_0xbda0('0x5')]===_0xbda0('0x7')?_0xbda0('0x8'):_0x13bce6[_0xbda0('0x5')];this[_0xbda0('0x9')]=_0x13bce6[_0xbda0('0x9')];this['countcongestionretry']=_0x13bce6[_0xbda0('0xa')];this[_0xbda0('0xb')]=_0x13bce6[_0xbda0('0xb')];this[_0xbda0('0xc')]=_0x13bce6[_0xbda0('0x9')]+_0x13bce6[_0xbda0('0xa')]+_0x13bce6[_0xbda0('0xb')]+_0x13bce6[_0xbda0('0xd')]+_0x13bce6[_0xbda0('0xe')]+_0x13bce6[_0xbda0('0xf')]+_0x13bce6[_0xbda0('0x10')]+_0x13bce6['countagentrejectretry'];this[_0xbda0('0xd')]=_0x13bce6[_0xbda0('0xd')];this[_0xbda0('0xe')]=_0x13bce6[_0xbda0('0xe')];this[_0xbda0('0xf')]=_0x13bce6[_0xbda0('0xf')];this[_0xbda0('0x10')]=_0x13bce6['countmachineretry'];this[_0xbda0('0x11')]=_0x13bce6[_0xbda0('0x11')];this['uniqueid']=_0xcb2361[_0xbda0('0x12')];this[_0xbda0('0x13')]=_0x13bce6['name'];this[_0xbda0('0x14')]=_0x13bce6[_0xbda0('0x15')];this[_0xbda0('0x16')]=_0x13bce6[_0xbda0('0x16')];this['responsetime']=_0x13bce6[_0xbda0('0x17')];this[_0xbda0('0x18')]=_0x13bce6[_0xbda0('0x18')];this[_0xbda0('0x19')]=this[_0xbda0('0x18')];this[_0xbda0('0x1a')]=getSeconds(_0x13bce6['responsetime'],_0x13bce6[_0xbda0('0x16')]);this[_0xbda0('0x1b')]=getSeconds(this['droptime'],_0x13bce6['responsetime']);this['talktime']=0x0;this[_0xbda0('0x8')]=_0xcb2361[_0xbda0('0x8')];this[_0xbda0('0x1c')]=_0xcb2361[_0xbda0('0x1d')];this[_0xbda0('0x1e')]=_0xcb2361[_0xbda0('0x1e')];this[_0xbda0('0x1f')]=_0x13bce6[_0xbda0('0x1f')];this[_0xbda0('0x20')]=_0x13bce6[_0xbda0('0x20')];this[_0xbda0('0x21')]=_0x13bce6[_0xbda0('0x21')];this[_0xbda0('0x22')]=_0x13bce6[_0xbda0('0x22')];this[_0xbda0('0x23')]=_0x13bce6[_0xbda0('0x23')];this[_0xbda0('0x24')]=_0x13bce6[_0xbda0('0x24')];this[_0xbda0('0x25')]=_0x13bce6['UserId'];this[_0xbda0('0x26')]=_0x13bce6[_0xbda0('0x26')];this['CampaignId']=_0x13bce6[_0xbda0('0x27')];this[_0xbda0('0x28')]=_0x13bce6[_0xbda0('0x28')]||'';this[_0xbda0('0x29')]=_0x13bce6[_0xbda0('0x29')]||'';}module[_0xbda0('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0x7f4d=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','calleridnum','starttime','responsetime','droptime','endtime','ringtime','talktime','reason'];(function(_0x51cd4e,_0x5cfbab){var _0x4974e9=function(_0x2d2fdf){while(--_0x2d2fdf){_0x51cd4e['push'](_0x51cd4e['shift']());}};_0x4974e9(++_0x5cfbab);}(_0x7f4d,0x188));var _0xd7f4=function(_0x2404ac,_0x3b464b){_0x2404ac=_0x2404ac-0x0;var _0x4b26cd=_0x7f4d[_0x2404ac];return _0x4b26cd;};'use strict';var util=require('util');var _=require(_0xd7f4('0x0'));var moment=require('moment');function getSeconds(_0x550c23,_0x5e26aa){var _0x323cf7=moment(_0x550c23)[_0xd7f4('0x1')](0x0);var _0x11538f=moment(_0x5e26aa)[_0xd7f4('0x1')](0x0);return _0x323cf7['diff'](_0x11538f,_0xd7f4('0x2'));}function QueueCallerAbandon(_0x5ae692,_0x2457c6){this[_0xd7f4('0x3')]=_0x5ae692[_0xd7f4('0x3')];this[_0xd7f4('0x4')]=_0x5ae692[_0xd7f4('0x4')];this[_0xd7f4('0x5')]=_0x5ae692[_0xd7f4('0x4')]===_0xd7f4('0x6')?_0xd7f4('0x7'):_0x5ae692[_0xd7f4('0x4')];this[_0xd7f4('0x8')]=_0x5ae692['countbusyretry'];this[_0xd7f4('0x9')]=_0x5ae692[_0xd7f4('0x9')];this[_0xd7f4('0xa')]=_0x5ae692['countnoanswerretry'];this[_0xd7f4('0xb')]=_0x5ae692[_0xd7f4('0x8')]+_0x5ae692['countcongestionretry']+_0x5ae692[_0xd7f4('0xa')]+_0x5ae692[_0xd7f4('0xc')]+_0x5ae692['countdropretry']+_0x5ae692[_0xd7f4('0xd')]+_0x5ae692[_0xd7f4('0xe')]+_0x5ae692['countagentrejectretry'];this[_0xd7f4('0xc')]=_0x5ae692[_0xd7f4('0xc')];this[_0xd7f4('0xf')]=_0x5ae692['countdropretry'];this['countabandonedretry']=_0x5ae692['countabandonedretry'];this[_0xd7f4('0xe')]=_0x5ae692[_0xd7f4('0xe')];this[_0xd7f4('0x10')]=_0x5ae692[_0xd7f4('0x10')];this['uniqueid']=_0x2457c6[_0xd7f4('0x11')];this['calleridname']=_0x5ae692['name'];this[_0xd7f4('0x12')]=_0x5ae692['number'];this['starttime']=_0x5ae692[_0xd7f4('0x13')];this['responsetime']=_0x5ae692[_0xd7f4('0x14')];this[_0xd7f4('0x15')]=_0x5ae692[_0xd7f4('0x15')];this[_0xd7f4('0x16')]=this['droptime'];this[_0xd7f4('0x17')]=getSeconds(_0x5ae692['responsetime'],_0x5ae692['starttime']);this['holdtime']=getSeconds(this[_0xd7f4('0x15')],_0x5ae692[_0xd7f4('0x14')]);this[_0xd7f4('0x18')]=0x0;this['queue']=_0x2457c6[_0xd7f4('0x7')];this['membername']=_0x2457c6['connectedlinename'];this[_0xd7f4('0x19')]=_0x2457c6[_0xd7f4('0x19')];this[_0xd7f4('0x1a')]=_0x5ae692['callback'];this[_0xd7f4('0x1b')]=_0x5ae692[_0xd7f4('0x1b')];this[_0xd7f4('0x1c')]=_0x5ae692[_0xd7f4('0x1c')];this[_0xd7f4('0x1d')]=_0x5ae692[_0xd7f4('0x1d')];this[_0xd7f4('0x1e')]=_0x5ae692[_0xd7f4('0x1e')];this[_0xd7f4('0x1f')]=_0x5ae692['ListId'];this[_0xd7f4('0x20')]=_0x5ae692[_0xd7f4('0x20')];this['VoiceQueueId']=_0x5ae692[_0xd7f4('0x21')];this[_0xd7f4('0x22')]=_0x5ae692[_0xd7f4('0x22')];this[_0xd7f4('0x23')]=_0x5ae692[_0xd7f4('0x23')]||'';this[_0xd7f4('0x24')]=_0x5ae692['originatecalleridname']||'';}module[_0xd7f4('0x25')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index a977e76..5f45b09 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 _0xf37f=['moment','uniqueid','channel','format','%s/%s/%s','tech','Trunk','fax','localstationid','headerinfo','path','AttachmentId','exports','util'];(function(_0x103be5,_0xe24819){var _0x306562=function(_0x3fbcdc){while(--_0x3fbcdc){_0x103be5['push'](_0x103be5['shift']());}};_0x306562(++_0xe24819);}(_0xf37f,0x1e9));var _0xff37=function(_0x597351,_0x5aed9f){_0x597351=_0x597351-0x0;var _0x410cd7=_0xf37f[_0x597351];return _0x410cd7;};'use strict';var util=require(_0xff37('0x0'));var _=require('lodash');var moment=require(_0xff37('0x1'));function Action(_0x400c45,_0x35a22b,_0x4868de){this[_0xff37('0x2')]=_0x400c45||undefined;this[_0xff37('0x3')]=util[_0xff37('0x4')](_0xff37('0x5'),_0x35a22b[_0xff37('0x6')],_0x35a22b[_0xff37('0x7')]['name'],_0x4868de[_0xff37('0x8')]);this[_0xff37('0x9')]=_0x35a22b[_0xff37('0x9')];this[_0xff37('0xa')]=_0x35a22b['headerinfo'];this['path']=_0x4868de[_0xff37('0xb')];this[_0xff37('0xc')]=_0x4868de[_0xff37('0xc')];}module[_0xff37('0xd')]=Action; \ No newline at end of file +var _0x4745=['lodash','moment','channel','format','%s/%s/%s','Trunk','localstationid','headerinfo','path','exports','util'];(function(_0x23e490,_0x5768db){var _0x5c9aaa=function(_0x2f486c){while(--_0x2f486c){_0x23e490['push'](_0x23e490['shift']());}};_0x5c9aaa(++_0x5768db);}(_0x4745,0x1ee));var _0x5474=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x4745[_0x1ac595];return _0x455fff;};'use strict';var util=require(_0x5474('0x0'));var _=require(_0x5474('0x1'));var moment=require(_0x5474('0x2'));function Action(_0x2c1c80,_0x29164f,_0x2d5a80){this['uniqueid']=_0x2c1c80||undefined;this[_0x5474('0x3')]=util[_0x5474('0x4')](_0x5474('0x5'),_0x29164f['tech'],_0x29164f[_0x5474('0x6')]['name'],_0x2d5a80['fax']);this[_0x5474('0x7')]=_0x29164f[_0x5474('0x7')];this[_0x5474('0x8')]=_0x29164f['headerinfo'];this[_0x5474('0x9')]=_0x2d5a80[_0x5474('0x9')];this['AttachmentId']=_0x2d5a80['AttachmentId'];}module[_0x5474('0xa')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index d0918e0..291961a 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 _0xf107=['trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','filename','syncReceiveFax','remotestationid','resolution','transferrate','calleridnum','pagestransferred','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','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','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Is\x20Valid','exports','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf107,0x155));var _0x7f10=function(_0x415741,_0x103fcf){_0x415741=_0x415741-0x0;var _0x43659e=_0xf107[_0x415741];return _0x43659e;};'use strict';var util=require(_0x7f10('0x0'));var _=require(_0x7f10('0x1'));var BPromise=require('bluebird');var uuid=require(_0x7f10('0x2'));var moment=require(_0x7f10('0x3'));var path=require(_0x7f10('0x4'));var tiff2pdf=require(_0x7f10('0x5'));var gs=require(_0x7f10('0x6'));var logger=require(_0x7f10('0x7'))(_0x7f10('0x8'));var ami=require(_0x7f10('0x9'));var rpcDb=require(_0x7f10('0xa'));var Channel=require(_0x7f10('0xb'));var ut=require(_0x7f10('0xc'));var Action=require(_0x7f10('0xd'));var faxAccount=require(_0x7f10('0xe'));var attachment=require(_0x7f10('0xf'));var faxMessage=require(_0x7f10('0x10'));function Fax(_0x481df6){this[_0x7f10('0x11')]={};this[_0x7f10('0x12')]=_0x481df6['faxAccounts'];this[_0x7f10('0x13')]=_0x481df6['trunks'];this[_0x7f10('0x14')]={};ami['on'](_0x7f10('0x15'),this[_0x7f10('0x16')][_0x7f10('0x17')](this));ami['on']('varset',this[_0x7f10('0x18')][_0x7f10('0x17')](this));ami['on'](_0x7f10('0x19'),this['syncNewState']['bind'](this));ami['on'](_0x7f10('0x1a'),this[_0x7f10('0x1b')][_0x7f10('0x17')](this));ami['on'](_0x7f10('0x1c'),this[_0x7f10('0x1d')][_0x7f10('0x17')](this));ami['on']('receivefax',this['syncReceiveFax']['bind'](this));ami['on'](_0x7f10('0x1e'),this[_0x7f10('0x1f')][_0x7f10('0x17')](this));ami['on'](_0x7f10('0x20'),this['syncOriginateResponse']['bind'](this));}Fax[_0x7f10('0x21')][_0x7f10('0x16')]=function(_0x3abda5){if(_0x3abda5[_0x7f10('0x22')]===_0x7f10('0x23')){for(var _0x59035d in this[_0x7f10('0x12')]){if(this['faxAccounts'][_0x7f10('0x24')](_0x59035d)){if(_0x3abda5[_0x7f10('0x25')]===this[_0x7f10('0x12')][_0x59035d][_0x7f10('0x26')]){this[_0x7f10('0x11')][_0x3abda5[_0x7f10('0x27')]]={};this[_0x7f10('0x11')][_0x3abda5['uniqueid']][_0x7f10('0x28')]=_0x3abda5[_0x7f10('0x28')];this[_0x7f10('0x11')][_0x3abda5[_0x7f10('0x27')]]['id']=this[_0x7f10('0x12')][_0x59035d]['id'];this[_0x7f10('0x11')][_0x3abda5[_0x7f10('0x27')]][_0x7f10('0x29')]=this[_0x7f10('0x12')][_0x59035d][_0x7f10('0x29')];logger[_0x7f10('0x2a')](_0x3abda5[_0x7f10('0x27')],_0x7f10('0x2b'));}}}}if(this[_0x7f10('0x14')][_0x3abda5[_0x7f10('0x27')]]){this[_0x7f10('0x11')][_0x3abda5[_0x7f10('0x27')]]={};this[_0x7f10('0x11')][_0x3abda5[_0x7f10('0x27')]][_0x7f10('0x28')]=_0x3abda5['channel'];logger[_0x7f10('0x2a')](_0x3abda5[_0x7f10('0x27')],_0x7f10('0x2b'));}};Fax[_0x7f10('0x21')]['syncVarSet']=function(_0x618e6c){if(this['channels'][_0x618e6c[_0x7f10('0x27')]]){for(var _0x3bf5a8 in _0x618e6c[_0x7f10('0x2c')]){if(_0x618e6c[_0x7f10('0x2c')][_0x7f10('0x24')](_0x3bf5a8)){this['channels'][_0x618e6c['uniqueid']][_0x3bf5a8]=_0x618e6c[_0x7f10('0x2d')];}}}};Fax['prototype'][_0x7f10('0x2e')]=function(_0xdfbedb){if(this[_0x7f10('0x11')][_0xdfbedb[_0x7f10('0x27')]]){this[_0x7f10('0x11')][_0xdfbedb[_0x7f10('0x27')]][_0x7f10('0x2f')]=_0xdfbedb[_0x7f10('0x2f')];this[_0x7f10('0x11')][_0xdfbedb[_0x7f10('0x27')]][_0x7f10('0x30')]=_0xdfbedb[_0x7f10('0x30')];}};Fax['prototype'][_0x7f10('0x1b')]=function(_0x463f74){if(this[_0x7f10('0x11')][_0x463f74[_0x7f10('0x27')]]){for(var _0x3b331b in _0x463f74['variable']){if(_0x463f74[_0x7f10('0x2c')][_0x7f10('0x24')](_0x3b331b)){this[_0x7f10('0x11')][_0x463f74['uniqueid']][_0x3b331b]=_0x463f74['value'];}}}};Fax[_0x7f10('0x21')][_0x7f10('0x1d')]=function(_0xcdb0a8){if(this['channels'][_0xcdb0a8['uniqueid']]){this[_0x7f10('0x11')][_0xcdb0a8[_0x7f10('0x27')]][_0x7f10('0x31')]=_0xcdb0a8[_0x7f10('0x31')];this['channels'][_0xcdb0a8[_0x7f10('0x27')]][_0x7f10('0x32')]=_0xcdb0a8[_0x7f10('0x32')];this[_0x7f10('0x11')][_0xcdb0a8['uniqueid']][_0x7f10('0x26')]=_0xcdb0a8['localstationid'];this[_0x7f10('0x11')][_0xcdb0a8[_0x7f10('0x27')]][_0x7f10('0x33')]=_0xcdb0a8[_0x7f10('0x33')];logger[_0x7f10('0x2a')](_0xcdb0a8[_0x7f10('0x27')],'\x20syncFaxStatus\x20');}};Fax[_0x7f10('0x21')][_0x7f10('0x34')]=function(_0x3c6f58){var _0x338459=this;if(this[_0x7f10('0x11')][_0x3c6f58[_0x7f10('0x27')]]){var _0x2ca4c8=this[_0x7f10('0x11')][_0x3c6f58['uniqueid']]['id'];this[_0x7f10('0x11')][_0x3c6f58[_0x7f10('0x27')]][_0x7f10('0x35')]=_0x3c6f58[_0x7f10('0x35')];this[_0x7f10('0x11')][_0x3c6f58[_0x7f10('0x27')]]['pagestransferred']=_0x3c6f58['pagestransferred'];this[_0x7f10('0x11')][_0x3c6f58['uniqueid']][_0x7f10('0x26')]=_0x3c6f58[_0x7f10('0x26')];this[_0x7f10('0x11')][_0x3c6f58[_0x7f10('0x27')]][_0x7f10('0x36')]=_0x3c6f58[_0x7f10('0x36')];this[_0x7f10('0x11')][_0x3c6f58['uniqueid']][_0x7f10('0x37')]=_0x3c6f58[_0x7f10('0x37')];this[_0x7f10('0x11')][_0x3c6f58[_0x7f10('0x27')]][_0x7f10('0x33')]=_0x3c6f58[_0x7f10('0x33')];this[_0x7f10('0x11')][_0x3c6f58[_0x7f10('0x27')]]['calleridnum']=_0x3c6f58[_0x7f10('0x38')];if(this[_0x7f10('0x11')][_0x3c6f58['uniqueid']][_0x7f10('0x39')]>0x0){tiff2pdf(_0x3c6f58[_0x7f10('0x33')],_0x7f10('0x3a'),function(_0x5c52af){logger[_0x7f10('0x2a')](_0x3c6f58['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x5c52af[_0x7f10('0x3b')]);attachment[_0x7f10('0x3c')]({'name':path[_0x7f10('0x3d')](_0x3c6f58[_0x7f10('0x33')])[_0x7f10('0x29')],'basename':path[_0x7f10('0x3d')](_0x3c6f58[_0x7f10('0x33')])[_0x7f10('0x29')]+_0x7f10('0x3e'),'type':_0x7f10('0x3f')})['then'](function(_0x2e8cf3){faxAccount[_0x7f10('0x40')](_0x2ca4c8,{'from':_0x3c6f58[_0x7f10('0x38')],'mapKey':_0x7f10('0x8'),'body':path[_0x7f10('0x3d')](_0x3c6f58['filename'])['name']+_0x7f10('0x3e'),'AttachmentId':_0x2e8cf3['id']})[_0x7f10('0x41')](function(_0x3a031a){logger[_0x7f10('0x42')](_0x3c6f58[_0x7f10('0x27')],_0x7f10('0x43'),JSON[_0x7f10('0x44')](_0x3a031a));});})[_0x7f10('0x41')](function(_0x5e6eaa){logger['error'](_0x3c6f58['uniqueid'],_0x7f10('0x45'),JSON['stringify'](_0x5e6eaa));});});}logger[_0x7f10('0x2a')](_0x3c6f58['uniqueid'],_0x7f10('0x45'));}};Fax[_0x7f10('0x21')][_0x7f10('0x46')]=function(_0x132989){if(this['actions'][_0x132989[_0x7f10('0x27')]]){_[_0x7f10('0x47')](this[_0x7f10('0x11')][_0x132989[_0x7f10('0x27')]],_[_0x7f10('0x48')](_0x132989,[_0x7f10('0x49'),_0x7f10('0x4a')]));}};function updateStatus(_0x433032){if(_0x433032[_0x7f10('0x4b')]){faxMessage['update'](_0x433032[_0x7f10('0x4b')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x7f10('0x4c')](function(_0x463bbc){ut[_0x7f10('0x4d')](_0x7f10('0x4e'),_0x463bbc);})[_0x7f10('0x41')](function(_0x7bb123){ut[_0x7f10('0x4d')]('[Fax][Message][Error][NoUpdate1]',_0x7bb123);});}else{ut[_0x7f10('0x4d')](_0x7f10('0x4f'));}}Fax[_0x7f10('0x21')][_0x7f10('0x50')]=function(_0x212ec2,_0x52381e,_0x5b01e0){var _0x2657de=this;var _0x2669a9={};if(_0x52381e){_0x2669a9={'read':_0x52381e};}else{_0x2669a9={'failMessage':_0x5b01e0};}if(this[_0x7f10('0x14')][_0x212ec2][_0x7f10('0x4b')]){faxMessage['update'](this[_0x7f10('0x14')][_0x212ec2][_0x7f10('0x4b')],_0x2669a9)['then'](function(_0x321bf5){ut[_0x7f10('0x4d')](_0x7f10('0x51'),_0x321bf5);})['catch'](function(_0x3b47db){ut[_0x7f10('0x4d')](_0x7f10('0x52'),_0x3b47db);})['finally'](function(){delete _0x2657de[_0x7f10('0x11')][_0x212ec2];delete _0x2657de[_0x7f10('0x14')][_0x212ec2];});}else{ut[_0x7f10('0x4d')](_0x7f10('0x53'));delete this['channels'][_0x212ec2];delete this['actions'][_0x212ec2];}};Fax[_0x7f10('0x21')][_0x7f10('0x1f')]=function(_0x2a1dd6){var _0x34bbf5=this;if(this[_0x7f10('0x11')][_0x2a1dd6['uniqueid']]){if(this['actions'][_0x2a1dd6[_0x7f10('0x27')]]){this['channels'][_0x2a1dd6[_0x7f10('0x27')]]['id']=this['actions'][_0x2a1dd6[_0x7f10('0x27')]]['id'];this[_0x7f10('0x11')][_0x2a1dd6[_0x7f10('0x27')]][_0x7f10('0x29')]=this['actions'][_0x2a1dd6[_0x7f10('0x27')]][_0x7f10('0x29')];}logger[_0x7f10('0x2a')](_0x2a1dd6['uniqueid'],this['actions'][_0x2a1dd6[_0x7f10('0x27')]]?_0x7f10('0x54'):_0x7f10('0x55'),JSON[_0x7f10('0x44')](this[_0x7f10('0x11')][_0x2a1dd6['uniqueid']]));if(this[_0x7f10('0x14')][_0x2a1dd6['uniqueid']]){if(this[_0x7f10('0x11')][_0x2a1dd6[_0x7f10('0x27')]][_0x7f10('0x56')]>0x0&&this['channels'][_0x2a1dd6[_0x7f10('0x27')]][_0x7f10('0x1c')]==='SUCCESS'){this['updateStatus'](_0x2a1dd6[_0x7f10('0x27')],!![]);}else{this['updateStatus'](_0x2a1dd6[_0x7f10('0x27')],![],this['channels'][_0x2a1dd6[_0x7f10('0x27')]]['faxstatusstring']?_0x7f10('0x57')+this[_0x7f10('0x11')][_0x2a1dd6[_0x7f10('0x27')]]['faxstatusstring']:_0x7f10('0x58'));}}}};Fax['prototype']['send']=function(_0x22288d){var _0x24d796=this;return new BPromise(function(_0x2e11d9,_0x487336){_0x24d796[_0x7f10('0x59')](_0x22288d,_0x24d796['faxAccounts'][_0x22288d['FaxAccountId']])[_0x7f10('0x4c')](function(_0x4644b6){ut[_0x7f10('0x4d')]('[Fax][execOriginate][success]',_0x4644b6);_0x2e11d9(ut[_0x7f10('0x3b')](_0x7f10('0x5a')));})[_0x7f10('0x41')](function(_0x250abc){ut['logger'](_0x7f10('0x5b'),_0x250abc);updateStatus(_0x22288d);_0x487336(ut['message'](_0x7f10('0x5c')));});});};Fax[_0x7f10('0x21')][_0x7f10('0x5d')]=function(_0x3afdf8){var _0x332b5c=this;return new BPromise(function(_0x5406a0,_0x327f17){var _0x343428=_0x332b5c[_0x7f10('0x5e')](_0x332b5c[_0x7f10('0x12')][_0x3afdf8[_0x7f10('0x5f')]][_0x7f10('0x60')],_0x3afdf8);if(_0x343428[_0x7f10('0x61')]){_0x5406a0(ut['message'](_0x7f10('0x62')));}else{_0x327f17(ut['message'](_0x343428[_0x7f10('0x3b')]));}});};function originate(_0x313021,_0x2d8b98,_0x1e6325){return new BPromise(function(_0x10f670,_0x58d305){if(_0x1e6325){var _0x3709ac=util[_0x7f10('0x63')](_0x7f10('0x64'),path['parse'](_0x313021[_0x7f10('0x4')])[_0x7f10('0x29')],_0x313021[_0x7f10('0x4')]);gs[_0x7f10('0x65')](_0x3709ac)['then'](function(){_0x313021[_0x7f10('0x4')]=util[_0x7f10('0x63')](_0x7f10('0x66'),path['parse'](_0x313021[_0x7f10('0x4')])[_0x7f10('0x67')],path['parse'](_0x313021[_0x7f10('0x4')])[_0x7f10('0x29')]);_0x2d8b98[_0x7f10('0x68')]=_0x313021[_0x7f10('0x4')];ut[_0x7f10('0x4d')](_0x7f10('0x69'),'');ami['Action'](ut[_0x7f10('0x6a')](_0x313021,_0x2d8b98))[_0x7f10('0x4c')](function(_0x867725){_0x10f670(_0x867725);})[_0x7f10('0x41')](function(_0x180476){_0x58d305(_0x180476);});})[_0x7f10('0x41')](function(_0x330297){_0x58d305(_0x330297);});}else{ami['Action'](ut[_0x7f10('0x6a')](_0x313021,_0x2d8b98))[_0x7f10('0x4c')](function(_0x19fb1c){_0x10f670(_0x19fb1c);})[_0x7f10('0x41')](function(_0x282bfe){_0x58d305(_0x282bfe);});}});}Fax[_0x7f10('0x21')][_0x7f10('0x59')]=function(_0x38c92d,_0x224837){var _0x11fafa=this;return new BPromise(function(_0x18fd7d,_0x70e494){var _0x4429bc=uuid['v4']();var _0x481b76=ut[_0x7f10('0x6b')](_0x38c92d,_0x224837);_0x11fafa['actions'][_0x4429bc]=new Action(_0x4429bc,_0x224837,_0x38c92d);var _0x5f2a94=_0x11fafa[_0x7f10('0x14')][_0x4429bc];if(path[_0x7f10('0x3d')](_0x38c92d['path'])[_0x7f10('0x6c')]==='.pdf'){originate(_0x5f2a94,_0x481b76,!![])['then'](function(_0x30899a){_0x18fd7d(_0x30899a);})['catch'](function(_0xa8212a){_0x70e494(_0xa8212a);});}else{originate(_0x5f2a94,_0x481b76,![])[_0x7f10('0x4c')](function(_0x2c01ef){_0x18fd7d(_0x2c01ef);})[_0x7f10('0x41')](function(_0x563190){_0x70e494(_0x563190);});}});};Fax[_0x7f10('0x21')][_0x7f10('0x6d')]=function(_0x1b355c){return!_[_0x7f10('0x6e')](_0x1b355c)&&!_[_0x7f10('0x6e')](_0x1b355c['name'])&&!_[_0x7f10('0x6e')](_0x1b355c[_0x7f10('0x6f')])&&_0x1b355c[_0x7f10('0x6f')]&&!_['isNil'](this[_0x7f10('0x13')][util[_0x7f10('0x63')]('SIP/%s',_0x1b355c[_0x7f10('0x29')])])&&!_[_0x7f10('0x6e')](this[_0x7f10('0x13')][util[_0x7f10('0x63')](_0x7f10('0x70'),_0x1b355c[_0x7f10('0x29')])]['status'])&&(this[_0x7f10('0x13')][util[_0x7f10('0x63')]('SIP/%s',_0x1b355c[_0x7f10('0x29')])]['status']==='reachable'||this[_0x7f10('0x13')][util[_0x7f10('0x63')]('SIP/%s',_0x1b355c[_0x7f10('0x29')])]['status']===_0x7f10('0x71'));};Fax['prototype'][_0x7f10('0x5e')]=function(_0x65e0b5,_0x473f4b){if(!this[_0x7f10('0x6d')](_0x65e0b5)){ut[_0x7f10('0x4d')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_['isNil'](_0x65e0b5)?'':_0x65e0b5['name']+_0x7f10('0x72'));return{'isValid':![],'message':_0x7f10('0x73')};}if(_[_0x7f10('0x6e')](_0x473f4b[_0x7f10('0x8')])){ut[_0x7f10('0x4d')](_0x7f10('0x74'),JSON[_0x7f10('0x44')](_0x473f4b));return{'isValid':![],'message':_0x7f10('0x75')};}if(_[_0x7f10('0x6e')](_0x473f4b[_0x7f10('0x4')])){ut[_0x7f10('0x4d')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x7f10('0x44')](_0x473f4b));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x7f10('0x76')};};module[_0x7f10('0x77')]=Fax; \ No newline at end of file +var _0x5580=['\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','parse','.pdf','application/pdf','then','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','actions','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','Trunk','message','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','execute','%s/%s.tif','Convert\x20pdf\x20to\x20tif','variablesAction','Action','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','Trunk\x20not\x20working','fax','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','Is\x20Valid','exports','util','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../ami','./rpcDb','./channel','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','localstationid','filename','info'];(function(_0x1eb186,_0x3e8197){var _0x49079e=function(_0x2ebd6f){while(--_0x2ebd6f){_0x1eb186['push'](_0x1eb186['shift']());}};_0x49079e(++_0x3e8197);}(_0x5580,0xbd));var _0x0558=function(_0x1cc9b3,_0x3369cd){_0x1cc9b3=_0x1cc9b3-0x0;var _0xbd541d=_0x5580[_0x1cc9b3];return _0xbd541d;};'use strict';var util=require(_0x0558('0x0'));var _=require('lodash');var BPromise=require(_0x0558('0x1'));var uuid=require(_0x0558('0x2'));var moment=require(_0x0558('0x3'));var path=require(_0x0558('0x4'));var tiff2pdf=require(_0x0558('0x5'));var gs=require(_0x0558('0x6'));var logger=require('../../../config/logger')('fax');var ami=require(_0x0558('0x7'));var rpcDb=require(_0x0558('0x8'));var Channel=require(_0x0558('0x9'));var ut=require('./util/util');var Action=require(_0x0558('0xa'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x0558('0xb'));var faxMessage=require(_0x0558('0xc'));function Fax(_0xb9d2ed){this[_0x0558('0xd')]={};this['faxAccounts']=_0xb9d2ed[_0x0558('0xe')];this[_0x0558('0xf')]=_0xb9d2ed[_0x0558('0xf')];this['actions']={};ami['on'](_0x0558('0x10'),this['syncNewchannel'][_0x0558('0x11')](this));ami['on'](_0x0558('0x12'),this[_0x0558('0x13')][_0x0558('0x11')](this));ami['on'](_0x0558('0x14'),this[_0x0558('0x15')][_0x0558('0x11')](this));ami['on'](_0x0558('0x16'),this['syncNewExten'][_0x0558('0x11')](this));ami['on'](_0x0558('0x17'),this[_0x0558('0x18')][_0x0558('0x11')](this));ami['on'](_0x0558('0x19'),this[_0x0558('0x1a')][_0x0558('0x11')](this));ami['on'](_0x0558('0x1b'),this['syncHangup']['bind'](this));ami['on']('originateresponse',this[_0x0558('0x1c')][_0x0558('0x11')](this));}Fax[_0x0558('0x1d')][_0x0558('0x1e')]=function(_0x3efbe1){if(_0x3efbe1[_0x0558('0x1f')]===_0x0558('0x20')){for(var _0x3f8b67 in this[_0x0558('0xe')]){if(this[_0x0558('0xe')][_0x0558('0x21')](_0x3f8b67)){if(_0x3efbe1[_0x0558('0x22')]===this['faxAccounts'][_0x3f8b67]['localstationid']){this['channels'][_0x3efbe1[_0x0558('0x23')]]={};this[_0x0558('0xd')][_0x3efbe1[_0x0558('0x23')]][_0x0558('0x24')]=_0x3efbe1[_0x0558('0x24')];this[_0x0558('0xd')][_0x3efbe1[_0x0558('0x23')]]['id']=this['faxAccounts'][_0x3f8b67]['id'];this[_0x0558('0xd')][_0x3efbe1[_0x0558('0x23')]]['name']=this[_0x0558('0xe')][_0x3f8b67][_0x0558('0x25')];logger['info'](_0x3efbe1[_0x0558('0x23')],_0x0558('0x26'));}}}}if(this['actions'][_0x3efbe1[_0x0558('0x23')]]){this['channels'][_0x3efbe1[_0x0558('0x23')]]={};this['channels'][_0x3efbe1[_0x0558('0x23')]][_0x0558('0x24')]=_0x3efbe1[_0x0558('0x24')];logger['info'](_0x3efbe1[_0x0558('0x23')],'\x20syncNewchannel\x20');}};Fax[_0x0558('0x1d')][_0x0558('0x13')]=function(_0x4d3b06){if(this[_0x0558('0xd')][_0x4d3b06[_0x0558('0x23')]]){for(var _0x27dbc4 in _0x4d3b06['variable']){if(_0x4d3b06[_0x0558('0x27')][_0x0558('0x21')](_0x27dbc4)){this[_0x0558('0xd')][_0x4d3b06[_0x0558('0x23')]][_0x27dbc4]=_0x4d3b06[_0x0558('0x28')];}}}};Fax[_0x0558('0x1d')][_0x0558('0x15')]=function(_0x27d277){if(this[_0x0558('0xd')][_0x27d277[_0x0558('0x23')]]){this['channels'][_0x27d277['uniqueid']][_0x0558('0x29')]=_0x27d277[_0x0558('0x29')];this[_0x0558('0xd')][_0x27d277[_0x0558('0x23')]][_0x0558('0x2a')]=_0x27d277['channelstatedesc'];}};Fax[_0x0558('0x1d')][_0x0558('0x2b')]=function(_0x1e039f){if(this[_0x0558('0xd')][_0x1e039f[_0x0558('0x23')]]){for(var _0xf57aad in _0x1e039f[_0x0558('0x27')]){if(_0x1e039f[_0x0558('0x27')][_0x0558('0x21')](_0xf57aad)){this['channels'][_0x1e039f[_0x0558('0x23')]][_0xf57aad]=_0x1e039f[_0x0558('0x28')];}}}};Fax[_0x0558('0x1d')][_0x0558('0x18')]=function(_0x383cc9){if(this[_0x0558('0xd')][_0x383cc9[_0x0558('0x23')]]){this[_0x0558('0xd')][_0x383cc9[_0x0558('0x23')]][_0x0558('0x2c')]=_0x383cc9[_0x0558('0x2c')];this[_0x0558('0xd')][_0x383cc9[_0x0558('0x23')]][_0x0558('0x2d')]=_0x383cc9[_0x0558('0x2d')];this[_0x0558('0xd')][_0x383cc9[_0x0558('0x23')]][_0x0558('0x2e')]=_0x383cc9[_0x0558('0x2e')];this[_0x0558('0xd')][_0x383cc9['uniqueid']][_0x0558('0x2f')]=_0x383cc9[_0x0558('0x2f')];logger[_0x0558('0x30')](_0x383cc9[_0x0558('0x23')],_0x0558('0x31'));}};Fax[_0x0558('0x1d')][_0x0558('0x1a')]=function(_0x2c8c2){var _0x85bc32=this;if(this['channels'][_0x2c8c2[_0x0558('0x23')]]){var _0x1153c8=this[_0x0558('0xd')][_0x2c8c2[_0x0558('0x23')]]['id'];this[_0x0558('0xd')][_0x2c8c2[_0x0558('0x23')]][_0x0558('0x32')]=_0x2c8c2[_0x0558('0x32')];this['channels'][_0x2c8c2[_0x0558('0x23')]][_0x0558('0x33')]=_0x2c8c2[_0x0558('0x33')];this[_0x0558('0xd')][_0x2c8c2[_0x0558('0x23')]][_0x0558('0x2e')]=_0x2c8c2[_0x0558('0x2e')];this['channels'][_0x2c8c2[_0x0558('0x23')]][_0x0558('0x34')]=_0x2c8c2[_0x0558('0x34')];this[_0x0558('0xd')][_0x2c8c2['uniqueid']]['transferrate']=_0x2c8c2[_0x0558('0x35')];this[_0x0558('0xd')][_0x2c8c2['uniqueid']][_0x0558('0x2f')]=_0x2c8c2[_0x0558('0x2f')];this['channels'][_0x2c8c2[_0x0558('0x23')]][_0x0558('0x36')]=_0x2c8c2['calleridnum'];if(this[_0x0558('0xd')][_0x2c8c2[_0x0558('0x23')]]['pagestransferred']>0x0){tiff2pdf(_0x2c8c2[_0x0558('0x2f')],_0x0558('0x37'),function(_0x1002b8){logger['info'](_0x2c8c2['uniqueid'],_0x0558('0x38'),_0x1002b8['message']);attachment['create']({'name':path[_0x0558('0x39')](_0x2c8c2['filename'])[_0x0558('0x25')],'basename':path[_0x0558('0x39')](_0x2c8c2['filename'])[_0x0558('0x25')]+_0x0558('0x3a'),'type':_0x0558('0x3b')})[_0x0558('0x3c')](function(_0xe90ccf){faxAccount['notify'](_0x1153c8,{'from':_0x2c8c2[_0x0558('0x36')],'mapKey':'fax','body':path[_0x0558('0x39')](_0x2c8c2[_0x0558('0x2f')])['name']+_0x0558('0x3a'),'AttachmentId':_0xe90ccf['id']})[_0x0558('0x3d')](function(_0x14a2ae){logger[_0x0558('0x3e')](_0x2c8c2['uniqueid'],_0x0558('0x3f'),JSON[_0x0558('0x40')](_0x14a2ae));});})[_0x0558('0x3d')](function(_0x5bf65e){logger[_0x0558('0x3e')](_0x2c8c2[_0x0558('0x23')],'\x20receiveFax\x20',JSON[_0x0558('0x40')](_0x5bf65e));});});}logger[_0x0558('0x30')](_0x2c8c2[_0x0558('0x23')],_0x0558('0x41'));}};Fax[_0x0558('0x1d')][_0x0558('0x1c')]=function(_0x4edaaa){if(this[_0x0558('0x42')][_0x4edaaa[_0x0558('0x23')]]){_[_0x0558('0x43')](this[_0x0558('0xd')][_0x4edaaa[_0x0558('0x23')]],_[_0x0558('0x44')](_0x4edaaa,[_0x0558('0x45'),_0x0558('0x46')]));}};function updateStatus(_0x47157c){if(_0x47157c[_0x0558('0x47')]){faxMessage[_0x0558('0x48')](_0x47157c[_0x0558('0x47')],{'failMessage':_0x0558('0x49')})[_0x0558('0x3c')](function(_0x1b739c){ut[_0x0558('0x4a')](_0x0558('0x4b'),_0x1b739c);})[_0x0558('0x3d')](function(_0x4468ab){ut[_0x0558('0x4a')](_0x0558('0x4c'),_0x4468ab);});}else{ut[_0x0558('0x4a')](_0x0558('0x4d'));}}Fax[_0x0558('0x1d')][_0x0558('0x4e')]=function(_0x20e2b4,_0x256fc4,_0x220320){var _0x2e0ec7=this;var _0x9a0dd1={};if(_0x256fc4){_0x9a0dd1={'read':_0x256fc4};}else{_0x9a0dd1={'failMessage':_0x220320};}if(this[_0x0558('0x42')][_0x20e2b4][_0x0558('0x47')]){faxMessage[_0x0558('0x48')](this['actions'][_0x20e2b4][_0x0558('0x47')],_0x9a0dd1)[_0x0558('0x3c')](function(_0x3aeab2){ut[_0x0558('0x4a')](_0x0558('0x4f'),_0x3aeab2);})['catch'](function(_0x11e753){ut['logger'](_0x0558('0x50'),_0x11e753);})[_0x0558('0x51')](function(){delete _0x2e0ec7[_0x0558('0xd')][_0x20e2b4];delete _0x2e0ec7[_0x0558('0x42')][_0x20e2b4];});}else{ut[_0x0558('0x4a')]('[Fax][Message][NoUpdate2]');delete this[_0x0558('0xd')][_0x20e2b4];delete this[_0x0558('0x42')][_0x20e2b4];}};Fax['prototype'][_0x0558('0x52')]=function(_0x2d947e){var _0xf24a4b=this;if(this[_0x0558('0xd')][_0x2d947e[_0x0558('0x23')]]){if(this[_0x0558('0x42')][_0x2d947e['uniqueid']]){this[_0x0558('0xd')][_0x2d947e[_0x0558('0x23')]]['id']=this[_0x0558('0x42')][_0x2d947e[_0x0558('0x23')]]['id'];this[_0x0558('0xd')][_0x2d947e[_0x0558('0x23')]][_0x0558('0x25')]=this[_0x0558('0x42')][_0x2d947e[_0x0558('0x23')]][_0x0558('0x25')];}logger['info'](_0x2d947e[_0x0558('0x23')],this[_0x0558('0x42')][_0x2d947e[_0x0558('0x23')]]?_0x0558('0x53'):_0x0558('0x54'),JSON['stringify'](this[_0x0558('0xd')][_0x2d947e[_0x0558('0x23')]]));if(this[_0x0558('0x42')][_0x2d947e[_0x0558('0x23')]]){if(this['channels'][_0x2d947e['uniqueid']][_0x0558('0x55')]>0x0&&this[_0x0558('0xd')][_0x2d947e[_0x0558('0x23')]]['faxstatus']===_0x0558('0x56')){this[_0x0558('0x4e')](_0x2d947e[_0x0558('0x23')],!![]);}else{this['updateStatus'](_0x2d947e[_0x0558('0x23')],![],this[_0x0558('0xd')][_0x2d947e['uniqueid']][_0x0558('0x57')]?_0x0558('0x58')+this[_0x0558('0xd')][_0x2d947e[_0x0558('0x23')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0x0558('0x1d')][_0x0558('0x59')]=function(_0x1c30cc){var _0x58f5f8=this;return new BPromise(function(_0xaabc59,_0x51df72){_0x58f5f8[_0x0558('0x5a')](_0x1c30cc,_0x58f5f8[_0x0558('0xe')][_0x1c30cc['FaxAccountId']])[_0x0558('0x3c')](function(_0x3542dc){ut['logger'](_0x0558('0x5b'),_0x3542dc);_0xaabc59(ut['message'](_0x0558('0x5c')));})['catch'](function(_0x14dea5){ut[_0x0558('0x4a')](_0x0558('0x5d'),_0x14dea5);updateStatus(_0x1c30cc);_0x51df72(ut['message'](_0x0558('0x5e')));});});};Fax[_0x0558('0x1d')]['checkAfterSend']=function(_0x4f25e0){var _0x1af78f=this;return new BPromise(function(_0x5923b0,_0xa2a854){var _0x52a348=_0x1af78f['checkTrunk'](_0x1af78f['faxAccounts'][_0x4f25e0['FaxAccountId']][_0x0558('0x5f')],_0x4f25e0);if(_0x52a348['isValid']){_0x5923b0(ut[_0x0558('0x60')](_0x0558('0x61')));}else{_0xa2a854(ut[_0x0558('0x60')](_0x52a348['message']));}});};function originate(_0x186784,_0x592306,_0xe30fc2){return new BPromise(function(_0x240911,_0xb6805c){if(_0xe30fc2){var _0x109fd2=util[_0x0558('0x62')](_0x0558('0x63'),path[_0x0558('0x39')](_0x186784[_0x0558('0x4')])['name'],_0x186784[_0x0558('0x4')]);gs[_0x0558('0x64')](_0x109fd2)['then'](function(){_0x186784['path']=util[_0x0558('0x62')](_0x0558('0x65'),path[_0x0558('0x39')](_0x186784[_0x0558('0x4')])['dir'],path['parse'](_0x186784[_0x0558('0x4')])[_0x0558('0x25')]);_0x592306['XMF-PATH']=_0x186784[_0x0558('0x4')];ut[_0x0558('0x4a')](_0x0558('0x66'),'');ami['Action'](ut[_0x0558('0x67')](_0x186784,_0x592306))[_0x0558('0x3c')](function(_0x413950){_0x240911(_0x413950);})['catch'](function(_0x3174c5){_0xb6805c(_0x3174c5);});})[_0x0558('0x3d')](function(_0x297529){_0xb6805c(_0x297529);});}else{ami[_0x0558('0x68')](ut[_0x0558('0x67')](_0x186784,_0x592306))[_0x0558('0x3c')](function(_0x2ea695){_0x240911(_0x2ea695);})['catch'](function(_0x572a08){_0xb6805c(_0x572a08);});}});}Fax[_0x0558('0x1d')][_0x0558('0x5a')]=function(_0x32e2b4,_0x229e85){var _0x51648f=this;return new BPromise(function(_0x18be0e,_0x5caab3){var _0x3c935d=uuid['v4']();var _0x38696b=ut['addVariables'](_0x32e2b4,_0x229e85);_0x51648f[_0x0558('0x42')][_0x3c935d]=new Action(_0x3c935d,_0x229e85,_0x32e2b4);var _0x5b17f3=_0x51648f[_0x0558('0x42')][_0x3c935d];if(path[_0x0558('0x39')](_0x32e2b4[_0x0558('0x4')])[_0x0558('0x69')]==='.pdf'){originate(_0x5b17f3,_0x38696b,!![])[_0x0558('0x3c')](function(_0x335a06){_0x18be0e(_0x335a06);})['catch'](function(_0x555870){_0x5caab3(_0x555870);});}else{originate(_0x5b17f3,_0x38696b,![])['then'](function(_0x3aba52){_0x18be0e(_0x3aba52);})[_0x0558('0x3d')](function(_0xdb0daa){_0x5caab3(_0xdb0daa);});}});};Fax[_0x0558('0x1d')][_0x0558('0x6a')]=function(_0x2d59da){return!_['isNil'](_0x2d59da)&&!_[_0x0558('0x6b')](_0x2d59da[_0x0558('0x25')])&&!_[_0x0558('0x6b')](_0x2d59da[_0x0558('0x6c')])&&_0x2d59da['active']&&!_[_0x0558('0x6b')](this[_0x0558('0xf')][util[_0x0558('0x62')](_0x0558('0x6d'),_0x2d59da[_0x0558('0x25')])])&&!_['isNil'](this[_0x0558('0xf')][util['format'](_0x0558('0x6d'),_0x2d59da[_0x0558('0x25')])][_0x0558('0x2d')])&&(this[_0x0558('0xf')][util['format'](_0x0558('0x6d'),_0x2d59da[_0x0558('0x25')])][_0x0558('0x2d')]===_0x0558('0x6e')||this[_0x0558('0xf')][util[_0x0558('0x62')](_0x0558('0x6d'),_0x2d59da['name'])][_0x0558('0x2d')]===_0x0558('0x6f'));};Fax[_0x0558('0x1d')][_0x0558('0x70')]=function(_0x352911,_0x5c00a9){if(!this[_0x0558('0x6a')](_0x352911)){ut[_0x0558('0x4a')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x0558('0x6b')](_0x352911)?'':_0x352911[_0x0558('0x25')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x0558('0x71')};}if(_[_0x0558('0x6b')](_0x5c00a9[_0x0558('0x72')])){ut['logger'](_0x0558('0x73'),JSON[_0x0558('0x40')](_0x5c00a9));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x0558('0x6b')](_0x5c00a9[_0x0558('0x4')])){ut[_0x0558('0x4a')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x0558('0x40')](_0x5c00a9));return{'isValid':![],'message':_0x0558('0x74')};}return{'isValid':!![],'message':_0x0558('0x75')};};module[_0x0558('0x76')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 95f919f..985ebda 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 _0xa7a8=['inspect','notify','resolve','then','catch','../../../config/logger','preview','error'];(function(_0x58342a,_0x343d15){var _0x223208=function(_0x316e09){while(--_0x316e09){_0x58342a['push'](_0x58342a['shift']());}};_0x223208(++_0x343d15);}(_0xa7a8,0x105));var _0x8a7a=function(_0x38b9fe,_0x4eba88){_0x38b9fe=_0x38b9fe-0x0;var _0x6e3aa9=_0xa7a8[_0x38b9fe];return _0x6e3aa9;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x8a7a('0x0'))(_0x8a7a('0x1'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x240d49){return function(_0x2ed7b4){logger[_0x8a7a('0x2')](_0x240d49,util[_0x8a7a('0x3')](_0x2ed7b4,{'showHidden':![],'depth':null}));};}exports[_0x8a7a('0x4')]=function(_0x4f1bd3,_0x4ca32a){return BPromise[_0x8a7a('0x5')]()[_0x8a7a('0x6')](faxAccount[_0x8a7a('0x4')](_0x4f1bd3,_0x4ca32a))[_0x8a7a('0x7')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xbb1f=['notify','catch','bluebird','../../../config/logger','lodash','../rpc/faxAccount','inspect'];(function(_0x5661bc,_0x591294){var _0x5207e0=function(_0x54e714){while(--_0x54e714){_0x5661bc['push'](_0x5661bc['shift']());}};_0x5207e0(++_0x591294);}(_0xbb1f,0x105));var _0xfbb1=function(_0x4b2cc6,_0x29ef43){_0x4b2cc6=_0x4b2cc6-0x0;var _0x3e0b08=_0xbb1f[_0x4b2cc6];return _0x3e0b08;};'use strict';var util=require('util');var BPromise=require(_0xfbb1('0x0'));var logger=require(_0xfbb1('0x1'))('preview');var _=require(_0xfbb1('0x2'));var faxAccount=require(_0xfbb1('0x3'));function loggerCatch(_0x5a25a3){return function(_0x495962){logger['error'](_0x5a25a3,util[_0xfbb1('0x4')](_0x495962,{'showHidden':![],'depth':null}));};}exports[_0xfbb1('0x5')]=function(_0x4a8b29,_0x17d168){return BPromise['resolve']()['then'](faxAccount[_0xfbb1('0x5')](_0x4a8b29,_0x17d168))[_0xfbb1('0x6')](loggerCatch('[Notify]\x20'));}; \ 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 276acf7..d287bd6 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 _0x87b8=['Exec\x20gs','info','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute'];(function(_0x5d75a4,_0x41dc12){var _0x5cf8e3=function(_0x302453){while(--_0x302453){_0x5d75a4['push'](_0x5d75a4['shift']());}};_0x5cf8e3(++_0x41dc12);}(_0x87b8,0xcb));var _0x887b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x87b8[_0x501510];return _0x1e6ee5;};'use strict';var util=require(_0x887b('0x0'));var logger=require(_0x887b('0x1'))(_0x887b('0x2'));var BPromise=require(_0x887b('0x3'));var exec=require(_0x887b('0x4'))[_0x887b('0x5')];exports[_0x887b('0x6')]=function(_0x4e8979){return new BPromise(function(_0x4d57d5,_0x38d8ca){exec(_0x4e8979,function(_0x44d42b,_0x12545c,_0x8355cf){logger['info'](_0x887b('0x7'),_0x12545c);if(_0x44d42b){logger[_0x887b('0x8')](_0x887b('0x7'),'\x20Error\x20:',util[_0x887b('0x9')](_0x44d42b,{'showHidden':![],'depth':null}),_0x12545c,_0x8355cf);_0x38d8ca(_0x44d42b);}_0x4d57d5(_0x12545c);});});}; \ No newline at end of file +var _0xd53b=['info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute'];(function(_0x2ad817,_0x53b557){var _0xec51b0=function(_0x4ed5e2){while(--_0x4ed5e2){_0x2ad817['push'](_0x2ad817['shift']());}};_0xec51b0(++_0x53b557);}(_0xd53b,0x143));var _0xbd53=function(_0x5df987,_0xcc5aab){_0x5df987=_0x5df987-0x0;var _0xa37be6=_0xd53b[_0x5df987];return _0xa37be6;};'use strict';var util=require(_0xbd53('0x0'));var logger=require(_0xbd53('0x1'))(_0xbd53('0x2'));var BPromise=require(_0xbd53('0x3'));var exec=require(_0xbd53('0x4'))[_0xbd53('0x5')];exports[_0xbd53('0x6')]=function(_0x19d01f){return new BPromise(function(_0x13410d,_0x50f169){exec(_0x19d01f,function(_0x14389f,_0xd3549c,_0x3f112a){logger[_0xbd53('0x7')](_0xbd53('0x8'),_0xd3549c);if(_0x14389f){logger[_0xbd53('0x7')]('Exec\x20gs',_0xbd53('0x9'),util[_0xbd53('0xa')](_0x14389f,{'showHidden':![],'depth':null}),_0xd3549c,_0x3f112a);_0x50f169(_0x14389f);}_0x13410d(_0xd3549c);});});}; \ 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 cc51966..8cff138 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 _0xde2c=['message','logger','info','inspect','addVariables','ecm','headerinfo','format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','uniqueid','originate','channel','xcally-motion-fax','util','lodash','moment','../../../../config/logger','fax'];(function(_0x1e81a8,_0x43ab07){var _0x54d328=function(_0x3a9d7e){while(--_0x3a9d7e){_0x1e81a8['push'](_0x1e81a8['shift']());}};_0x54d328(++_0x43ab07);}(_0xde2c,0x7f));var _0xcde2=function(_0x42bafd,_0x3f0fe3){_0x42bafd=_0x42bafd-0x0;var _0x2ed705=_0xde2c[_0x42bafd];return _0x2ed705;};'use strict';var util=require(_0xcde2('0x0'));var _=require(_0xcde2('0x1'));var moment=require(_0xcde2('0x2'));var logger=require(_0xcde2('0x3'))(_0xcde2('0x4'));exports[_0xcde2('0x5')]=function(_0x33bb0c){return{'message':_0x33bb0c};};exports[_0xcde2('0x6')]=function(_0x55c175,_0x4353c8){logger[_0xcde2('0x7')](_0x55c175,util[_0xcde2('0x8')](_0x4353c8,{'showHidden':![],'depth':null}));};exports[_0xcde2('0x9')]=function(_0x401b16,_0x53c558){var _0x2b27ef={'XMF-ECM':_0x53c558[_0xcde2('0xa')],'XMF-HEADERINFO':_0x53c558[_0xcde2('0xb')],'XMF-MINRATE':_0x53c558['minrate'],'XMF-MAXRATE':_0x53c558['maxrate'],'XMF-MODEM':util[_0xcde2('0xc')](_0xcde2('0xd'),_0x53c558['modem']),'XMF-GATEWAY':_0x53c558[_0xcde2('0xe')],'XMF-FAXDETECT':_0x53c558[_0xcde2('0xf')],'XMF-T38TIMEOUT':_0x53c558[_0xcde2('0x10')],'XMF-LOCALSTATIONID':_0x53c558[_0xcde2('0x11')],'XMF-PATH':_0x401b16['path']};return _0x2b27ef;};exports['variablesAction']=function(_0x25677f,_0x1bc697){return{'actionid':_0x25677f[_0xcde2('0x12')],'action':_0xcde2('0x13'),'channel':_0x25677f[_0xcde2('0x14')],'Exten':_0xcde2('0x15'),'Context':'from-sip','Priority':'1','callerid':util[_0xcde2('0xc')]('\x22%s\x22\x20<%s>',_0x25677f[_0xcde2('0xb')]?_0x25677f['headerinfo']:'',_0x25677f['localstationid']),'variable':_0x1bc697,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x25677f[_0xcde2('0x12')]};}; \ No newline at end of file +var _0xb821=['format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','lodash','moment','message','info','inspect','ecm','headerinfo','minrate','maxrate'];(function(_0x1026d2,_0x42fe66){var _0x4a6773=function(_0x1a295f){while(--_0x1a295f){_0x1026d2['push'](_0x1026d2['shift']());}};_0x4a6773(++_0x42fe66);}(_0xb821,0xa7));var _0x1b82=function(_0x2b2d92,_0x3e148e){_0x2b2d92=_0x2b2d92-0x0;var _0x9e8ccd=_0xb821[_0x2b2d92];return _0x9e8ccd;};'use strict';var util=require('util');var _=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var logger=require('../../../../config/logger')('fax');exports[_0x1b82('0x2')]=function(_0x578a10){return{'message':_0x578a10};};exports['logger']=function(_0x3b1d14,_0x1403ab){logger[_0x1b82('0x3')](_0x3b1d14,util[_0x1b82('0x4')](_0x1403ab,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x3e27c4,_0x192434){var _0x202a5f={'XMF-ECM':_0x192434[_0x1b82('0x5')],'XMF-HEADERINFO':_0x192434[_0x1b82('0x6')],'XMF-MINRATE':_0x192434[_0x1b82('0x7')],'XMF-MAXRATE':_0x192434[_0x1b82('0x8')],'XMF-MODEM':util[_0x1b82('0x9')](_0x1b82('0xa'),_0x192434['modem']),'XMF-GATEWAY':_0x192434[_0x1b82('0xb')],'XMF-FAXDETECT':_0x192434[_0x1b82('0xc')],'XMF-T38TIMEOUT':_0x192434[_0x1b82('0xd')],'XMF-LOCALSTATIONID':_0x192434[_0x1b82('0xe')],'XMF-PATH':_0x3e27c4[_0x1b82('0xf')]};return _0x202a5f;};exports[_0x1b82('0x10')]=function(_0x739f99,_0x1ce719){return{'actionid':_0x739f99['uniqueid'],'action':_0x1b82('0x11'),'channel':_0x739f99[_0x1b82('0x12')],'Exten':_0x1b82('0x13'),'Context':_0x1b82('0x14'),'Priority':'1','callerid':util['format'](_0x1b82('0x15'),_0x739f99['headerinfo']?_0x739f99['headerinfo']:'',_0x739f99[_0x1b82('0xe')]),'variable':_0x1ce719,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x739f99['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 6a19b83..be7f592 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 _0x85a3=['then','getAgents','initTelephones','getTrunks','initTrunks','initVoiceQueues','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','sync','bluebird','util','moment','./server','./realtime','./report','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve'];(function(_0x4f7fef,_0x107359){var _0x3abbe0=function(_0x44b7c1){while(--_0x44b7c1){_0x4f7fef['push'](_0x4f7fef['shift']());}};_0x3abbe0(++_0x107359);}(_0x85a3,0x1e3));var _0x385a=function(_0x486262,_0x11ccc2){_0x486262=_0x486262-0x0;var _0x1d13dc=_0x85a3[_0x486262];return _0x1d13dc;};'use strict';var BPromise=require(_0x385a('0x0'));var util=require(_0x385a('0x1'));var moment=require(_0x385a('0x2'));var server=require(_0x385a('0x3'));var Realtime=require(_0x385a('0x4'));var Report=require(_0x385a('0x5'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0x385a('0x6'));var Preview=require(_0x385a('0x7'));var Fax=require(_0x385a('0x8'));var user=require(_0x385a('0x9'));var voiceQueue=require(_0x385a('0xa'));var voiceQueueReport=require(_0x385a('0xb'));var voiceCallReport=require(_0x385a('0xc'));var trunk=require(_0x385a('0xd'));var trigger=require(_0x385a('0xe'));var template=require('./rpc/template');var cmHopperHistory=require(_0x385a('0xf'));var campaign=require(_0x385a('0x10'));var voiceExtension=require(_0x385a('0x11'));var faxAccount=require(_0x385a('0x12'));var zendesk=require(_0x385a('0x13'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x385a('0x14'));var freshdesk=require(_0x385a('0x15'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x385a('0x16'));var freshsales=require(_0x385a('0x17'));var servicenow=require(_0x385a('0x18'));var dynamics365=require(_0x385a('0x19'));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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x385a('0x1a')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x385a('0x1a')](_0x385a('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x385a('0x1c')]()[_0x385a('0x1d')](user[_0x385a('0x1e')]())[_0x385a('0x1d')](realtime['initAgents']())['then'](user['getTelephones']())[_0x385a('0x1d')](realtime[_0x385a('0x1f')]())[_0x385a('0x1d')](trunk[_0x385a('0x20')]())[_0x385a('0x1d')](realtime[_0x385a('0x21')]())[_0x385a('0x1d')](voiceQueue['getVoiceQueues']())[_0x385a('0x1d')](realtime[_0x385a('0x22')]())[_0x385a('0x1d')](trigger['getTriggers']())[_0x385a('0x1d')](realtime[_0x385a('0x23')]())[_0x385a('0x1d')](template['getTemplates']())['then'](realtime[_0x385a('0x24')]())['then'](zendesk[_0x385a('0x25')]())[_0x385a('0x1d')](realtime[_0x385a('0x26')]())[_0x385a('0x1d')](salesforce[_0x385a('0x27')]())[_0x385a('0x1d')](realtime[_0x385a('0x28')]())[_0x385a('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0x385a('0x1d')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x385a('0x29')]())['then'](realtime['initFreshdeskAccounts']())[_0x385a('0x1d')](desk['getDeskAccounts']())['then'](realtime[_0x385a('0x2a')]())[_0x385a('0x1d')](zoho[_0x385a('0x2b')]())[_0x385a('0x1d')](realtime[_0x385a('0x2c')]())[_0x385a('0x1d')](vtiger[_0x385a('0x2d')]())[_0x385a('0x1d')](realtime['initVtigerAccounts']())['then'](freshsales[_0x385a('0x2e')]())['then'](realtime[_0x385a('0x2f')]())[_0x385a('0x1d')](servicenow[_0x385a('0x30')]())[_0x385a('0x1d')](realtime['initServicenowAccounts']())[_0x385a('0x1d')](dynamics365[_0x385a('0x31')]())['then'](realtime[_0x385a('0x32')]())[_0x385a('0x1d')](campaign[_0x385a('0x33')]())[_0x385a('0x1d')](realtime[_0x385a('0x34')]())['then'](voiceExtension[_0x385a('0x35')]())[_0x385a('0x1d')](realtime['initVoiceExtensions']())[_0x385a('0x1d')](faxAccount['getFaxAccounts']())[_0x385a('0x1d')](realtime['initFaxAccounts']())[_0x385a('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0x385a('0x1c')]()[_0x385a('0x1d')](voiceQueueReport[_0x385a('0x36')]())[_0x385a('0x1d')](realtime['initVoiceQueueReports']())[_0x385a('0x1d')](cmHopperHistory[_0x385a('0x37')]())[_0x385a('0x1d')](realtime[_0x385a('0x38')]())[_0x385a('0x1d')](cmHopperHistory[_0x385a('0x39')]())[_0x385a('0x1d')](realtime[_0x385a('0x3a')]())[_0x385a('0x1d')](voiceCallReport[_0x385a('0x3b')]())[_0x385a('0x1d')](realtime[_0x385a('0x3c')]())[_0x385a('0x1d')](function(_0x161b0a){})[_0x385a('0x3d')](function(_0x45b81f){console[_0x385a('0x3e')](_0x45b81f);});}function main(){return server['listen'](realtime,preview,fax)[_0x385a('0x1d')](function(_0x3fb820){return initRealtime();})[_0x385a('0x1d')](function(){return initParams();})[_0x385a('0x1d')](function(){report[_0x385a('0x3f')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x2a1a9d){console[_0x385a('0x3e')](_0x2a1a9d);});}main(); \ No newline at end of file +var _0x52ba=['get','resolve','then','getAgents','getTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','listen','log','bluebird','util','moment','./server','./acw','./trigger','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','hour'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x52ba,0x14f));var _0xa52b=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x52ba[_0x2c91e9];return _0x13f0ff;};'use strict';var BPromise=require(_0xa52b('0x0'));var util=require(_0xa52b('0x1'));var moment=require(_0xa52b('0x2'));var server=require(_0xa52b('0x3'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0xa52b('0x4'));var Trigger=require(_0xa52b('0x5'));var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require(_0xa52b('0x6'));var user=require(_0xa52b('0x7'));var voiceQueue=require(_0xa52b('0x8'));var voiceQueueReport=require(_0xa52b('0x9'));var voiceCallReport=require(_0xa52b('0xa'));var trunk=require('./rpc/trunk');var trigger=require(_0xa52b('0xb'));var template=require(_0xa52b('0xc'));var cmHopperHistory=require(_0xa52b('0xd'));var campaign=require(_0xa52b('0xe'));var voiceExtension=require(_0xa52b('0xf'));var faxAccount=require(_0xa52b('0x10'));var zendesk=require(_0xa52b('0x11'));var salesforce=require(_0xa52b('0x12'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xa52b('0x13'));var desk=require(_0xa52b('0x14'));var zoho=require(_0xa52b('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xa52b('0x16'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xa52b('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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xa52b('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xa52b('0x19')](_0xa52b('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xa52b('0x1a')]()[_0xa52b('0x1b')](user[_0xa52b('0x1c')]())['then'](realtime['initAgents']())[_0xa52b('0x1b')](user[_0xa52b('0x1d')]())[_0xa52b('0x1b')](realtime['initTelephones']())[_0xa52b('0x1b')](trunk['getTrunks']())[_0xa52b('0x1b')](realtime[_0xa52b('0x1e')]())[_0xa52b('0x1b')](voiceQueue[_0xa52b('0x1f')]())[_0xa52b('0x1b')](realtime[_0xa52b('0x20')]())[_0xa52b('0x1b')](trigger[_0xa52b('0x21')]())[_0xa52b('0x1b')](realtime[_0xa52b('0x22')]())[_0xa52b('0x1b')](template['getTemplates']())['then'](realtime[_0xa52b('0x23')]())[_0xa52b('0x1b')](zendesk['getZendeskAccounts']())['then'](realtime['initZendeskAccounts']())[_0xa52b('0x1b')](salesforce[_0xa52b('0x24')]())[_0xa52b('0x1b')](realtime[_0xa52b('0x25')]())[_0xa52b('0x1b')](sugarcrm[_0xa52b('0x26')]())['then'](realtime[_0xa52b('0x27')]())[_0xa52b('0x1b')](freshdesk[_0xa52b('0x28')]())[_0xa52b('0x1b')](realtime['initFreshdeskAccounts']())[_0xa52b('0x1b')](desk['getDeskAccounts']())[_0xa52b('0x1b')](realtime['initDeskAccounts']())['then'](zoho['getZohoAccounts']())[_0xa52b('0x1b')](realtime[_0xa52b('0x29')]())[_0xa52b('0x1b')](vtiger[_0xa52b('0x2a')]())[_0xa52b('0x1b')](realtime[_0xa52b('0x2b')]())[_0xa52b('0x1b')](freshsales[_0xa52b('0x2c')]())[_0xa52b('0x1b')](realtime[_0xa52b('0x2d')]())[_0xa52b('0x1b')](servicenow[_0xa52b('0x2e')]())[_0xa52b('0x1b')](realtime[_0xa52b('0x2f')]())[_0xa52b('0x1b')](dynamics365['getDynamics365Accounts']())[_0xa52b('0x1b')](realtime[_0xa52b('0x30')]())[_0xa52b('0x1b')](campaign['getCampaigns']())[_0xa52b('0x1b')](realtime['initCampaigns']())[_0xa52b('0x1b')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0xa52b('0x31')]())[_0xa52b('0x1b')](faxAccount[_0xa52b('0x32')]())['then'](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xa52b('0x1a')]()[_0xa52b('0x1b')](voiceQueueReport[_0xa52b('0x33')]())[_0xa52b('0x1b')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0xa52b('0x34')]())[_0xa52b('0x1b')](realtime[_0xa52b('0x35')]())[_0xa52b('0x1b')](cmHopperHistory[_0xa52b('0x36')]())[_0xa52b('0x1b')](realtime[_0xa52b('0x37')]())['then'](voiceCallReport[_0xa52b('0x38')]())['then'](realtime['initVoiceCallReports']())[_0xa52b('0x1b')](function(_0x23e874){})[_0xa52b('0x39')](function(_0x17b8f1){console['log'](_0x17b8f1);});}function main(){return server[_0xa52b('0x3a')](realtime,preview,fax)[_0xa52b('0x1b')](function(_0x28a5d0){return initRealtime();})[_0xa52b('0x1b')](function(){return initParams();})[_0xa52b('0x1b')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xa52b('0x39')](function(_0x88208b){console[_0xa52b('0x3b')](_0x88208b);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index d5e7407..89dcad0 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 _0x6dd5=['format','status','voiceStatusQueue','stringify','user:%s','emit','user:save','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','address','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','prototype','toLowerCase','not_inuse','inuse','talking','voiceStatusTime','toNumber'];(function(_0x35a6f1,_0xbdeefe){var _0xef5463=function(_0x22adcb){while(--_0x22adcb){_0x35a6f1['push'](_0x35a6f1['shift']());}};_0xef5463(++_0xbdeefe);}(_0x6dd5,0x93));var _0x56dd=function(_0x5f4694,_0x5b270b){_0x5f4694=_0x5f4694-0x0;var _0x29f58c=_0x6dd5[_0x5f4694];return _0x29f58c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x56dd('0x0'));var md5=require(_0x56dd('0x1'));var Redis=require(_0x56dd('0x2'));var config=require(_0x56dd('0x3'));config[_0x56dd('0x4')]=_[_0x56dd('0x5')](config[_0x56dd('0x4')],{'host':_0x56dd('0x6'),'port':0x18eb});var io=require(_0x56dd('0x7'))(new Redis(config[_0x56dd('0x4')]));function Agent(_0x261e40){this['id']=_0x261e40['id']||0x0;this['name']=_0x261e40[_0x56dd('0x8')]||'';this['email']=_0x261e40[_0x56dd('0x9')]||'';this[_0x56dd('0xa')]=_0x261e40[_0x56dd('0xa')]||'';this[_0x56dd('0xb')]=_0x261e40[_0x56dd('0xb')]||'';this[_0x56dd('0xc')]=_0x56dd('0xd');this[_0x56dd('0xe')]=0x0;this['status']='unknown';this[_0x56dd('0xf')]='';this['phone']='';this['mobile']='';this[_0x56dd('0x10')]='';this[_0x56dd('0x11')]=_0x261e40[_0x56dd('0x11')]||![];this[_0x56dd('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x56dd('0x13')]='';this['voiceStatusQueue']='';this[_0x56dd('0x14')]=![];this['local']=![];this[_0x56dd('0x1')]='';}Agent[_0x56dd('0x15')]['updateStatusRealtime']=function(_0x4826ab){var _0x49ccdb;if(_0x4826ab&&_0x4826ab[_0x56dd('0xc')]){_0x49ccdb=_0x4826ab[_0x56dd('0xc')][_0x56dd('0x16')]();switch(_0x49ccdb){case _0x56dd('0x17'):_0x49ccdb='idle';break;case _0x56dd('0x18'):_0x49ccdb=_0x56dd('0x19');break;}}if(_0x49ccdb&&this[_0x56dd('0x12')]!==_0x49ccdb||_0x4826ab['statePause']){this[_0x56dd('0x1a')]=_[_0x56dd('0x1b')](moment()[_0x56dd('0x1c')]('x'));}if(_0x49ccdb){this['voiceStatus']=_0x49ccdb;}var _0x346a81={'id':this['id'],'name':this[_0x56dd('0x8')],'email':this[_0x56dd('0x9')],'accountcode':this[_0x56dd('0xa')],'fullname':this[_0x56dd('0xb')],'state':this[_0x56dd('0xc')],'stateTime':this[_0x56dd('0xe')],'status':this[_0x56dd('0x1d')],'address':this[_0x56dd('0xf')],'online':this[_0x56dd('0x11')],'voiceStatus':this[_0x56dd('0x12')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x56dd('0x13')],'voiceStatusQueue':this[_0x56dd('0x1e')],'interface':this[_0x56dd('0x10')],'onhold':this[_0x56dd('0x14')]};var _0x16672c=md5(JSON[_0x56dd('0x1f')](_0x346a81));if(this[_0x56dd('0x1')]!==_0x16672c){this[_0x56dd('0x1')]=_0x16672c;io['to'](util[_0x56dd('0x1c')](_0x56dd('0x20'),_0x346a81['name']))[_0x56dd('0x21')](_0x56dd('0x22'),_0x346a81);}};module['exports']=Agent; \ No newline at end of file +var _0xafbd=['emit','user:save','exports','lodash','util','moment','ioredis','defaults','localhost','name','email','accountcode','fullname','state','unknown','stateTime','address','phone','mobile','online','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','toLowerCase','idle','inuse','talking','voiceStatus','statePause','voiceStatusTime','toNumber','status','interface','stringify','md5'];(function(_0x2a7b2a,_0x4f6ba6){var _0x599221=function(_0x29fc8d){while(--_0x29fc8d){_0x2a7b2a['push'](_0x2a7b2a['shift']());}};_0x599221(++_0x4f6ba6);}(_0xafbd,0x1b3));var _0xdafb=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0xafbd[_0x5a6644];return _0x3a2a5d;};'use strict';var _=require(_0xdafb('0x0'));var util=require(_0xdafb('0x1'));var moment=require(_0xdafb('0x2'));var md5=require('md5');var Redis=require(_0xdafb('0x3'));var config=require('../../../config/environment');config['redis']=_[_0xdafb('0x4')](config['redis'],{'host':_0xdafb('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x215e13){this['id']=_0x215e13['id']||0x0;this['name']=_0x215e13[_0xdafb('0x6')]||'';this[_0xdafb('0x7')]=_0x215e13[_0xdafb('0x7')]||'';this[_0xdafb('0x8')]=_0x215e13[_0xdafb('0x8')]||'';this[_0xdafb('0x9')]=_0x215e13[_0xdafb('0x9')]||'';this[_0xdafb('0xa')]=_0xdafb('0xb');this[_0xdafb('0xc')]=0x0;this['status']='unknown';this[_0xdafb('0xd')]='';this[_0xdafb('0xe')]='';this[_0xdafb('0xf')]='';this['interface']='';this[_0xdafb('0x10')]=_0x215e13['online']||![];this['voiceStatus']=_0xdafb('0xb');this['voiceStatusTime']=0x0;this[_0xdafb('0x11')]='';this[_0xdafb('0x12')]='';this[_0xdafb('0x13')]=![];this['local']=![];this['md5']='';}Agent[_0xdafb('0x14')]['updateStatusRealtime']=function(_0x15a04f){var _0x51a386;if(_0x15a04f&&_0x15a04f['state']){_0x51a386=_0x15a04f[_0xdafb('0xa')][_0xdafb('0x15')]();switch(_0x51a386){case'not_inuse':_0x51a386=_0xdafb('0x16');break;case _0xdafb('0x17'):_0x51a386=_0xdafb('0x18');break;}}if(_0x51a386&&this[_0xdafb('0x19')]!==_0x51a386||_0x15a04f[_0xdafb('0x1a')]){this[_0xdafb('0x1b')]=_[_0xdafb('0x1c')](moment()['format']('x'));}if(_0x51a386){this[_0xdafb('0x19')]=_0x51a386;}var _0x3fb670={'id':this['id'],'name':this[_0xdafb('0x6')],'email':this[_0xdafb('0x7')],'accountcode':this[_0xdafb('0x8')],'fullname':this['fullname'],'state':this[_0xdafb('0xa')],'stateTime':this['stateTime'],'status':this[_0xdafb('0x1d')],'address':this[_0xdafb('0xd')],'online':this[_0xdafb('0x10')],'voiceStatus':this[_0xdafb('0x19')],'voiceStatusTime':this[_0xdafb('0x1b')],'voiceStatusCallerIdNumber':this[_0xdafb('0x11')],'voiceStatusQueue':this[_0xdafb('0x12')],'interface':this[_0xdafb('0x1e')],'onhold':this['onhold']};var _0x9f2040=md5(JSON[_0xdafb('0x1f')](_0x3fb670));if(this[_0xdafb('0x20')]!==_0x9f2040){this[_0xdafb('0x20')]=_0x9f2040;io['to'](util['format']('user:%s',_0x3fb670[_0xdafb('0x6')]))[_0xdafb('0x21')](_0xdafb('0x22'),_0x3fb670);}};module[_0xdafb('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 26d6f1d..3457add 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 _0x250c=['dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive'];(function(_0x2db9ef,_0x12a5c0){var _0x47eaf5=function(_0x47c3d6){while(--_0x47c3d6){_0x2db9ef['push'](_0x2db9ef['shift']());}};_0x47eaf5(++_0x12a5c0);}(_0x250c,0x135));var _0xc250=function(_0x74ebe8,_0x5680c4){_0x74ebe8=_0x74ebe8-0x0;var _0x5649df=_0x250c[_0x74ebe8];return _0x5649df;};'use strict';function Campaign(_0x450bae){this['id']=_0x450bae['id']||0x0;this['name']=_0x450bae[_0xc250('0x0')]||'';this[_0xc250('0x1')]=_0x450bae[_0xc250('0x1')]||'campaign';this[_0xc250('0x2')]=0x0;this[_0xc250('0x3')]=0x0;this[_0xc250('0x4')]=0x0;this[_0xc250('0x5')]=0x0;this['message']='';this[_0xc250('0x6')]=!![];this['active']=_0x450bae[_0xc250('0x7')];this[_0xc250('0x8')]=_0x450bae[_0xc250('0x8')];this[_0xc250('0x9')]=_0x450bae['dialTimezone']||null;this[_0xc250('0xa')]=_0x450bae[_0xc250('0xa')]?_0x450bae['dialGlobalInterval']:null;this[_0xc250('0xb')]=_0x450bae['dialOriginateCallerIdName'];this[_0xc250('0xc')]=_0x450bae[_0xc250('0xc')];this[_0xc250('0xd')]=_0x450bae['dialOriginateTimeout']||0x1e;this[_0xc250('0xe')]=_0x450bae['dialCongestionMaxRetry'];this[_0xc250('0xf')]=_0x450bae['dialCongestionRetryFrequency'];this[_0xc250('0x10')]=_0x450bae[_0xc250('0x10')];this[_0xc250('0x11')]=_0x450bae[_0xc250('0x11')];this[_0xc250('0x12')]=_0x450bae['dialNoAnswerMaxRetry'];this[_0xc250('0x13')]=_0x450bae[_0xc250('0x13')];this[_0xc250('0x14')]=_0x450bae[_0xc250('0x14')];this[_0xc250('0x15')]=_0x450bae[_0xc250('0x15')]||0x3;this[_0xc250('0x16')]=_0x450bae['dialNoSuchNumberRetryFrequency']||0x96;this[_0xc250('0x17')]=_0x450bae[_0xc250('0x17')]||0x3;this[_0xc250('0x18')]=_0x450bae[_0xc250('0x18')]||0x96;this['dialAbandonedMaxRetry']=_0x450bae[_0xc250('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x450bae[_0xc250('0x1a')]||0x96;this[_0xc250('0x1b')]=_0x450bae[_0xc250('0x1b')]||0x3;this[_0xc250('0x1c')]=_0x450bae[_0xc250('0x1c')]||0x96;this[_0xc250('0x1d')]=_0x450bae[_0xc250('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x450bae['dialAgentRejectRetryFrequency']||0x96;this[_0xc250('0x1e')]=_0x450bae[_0xc250('0x1e')]||_0xc250('0x1f');this[_0xc250('0x20')]=_0x450bae[_0xc250('0x20')]||undefined;this[_0xc250('0x21')]=_0x450bae[_0xc250('0x21')]||undefined;this[_0xc250('0x22')]=_0x450bae['dialCutDigit']||undefined;this[_0xc250('0x23')]=_0x450bae[_0xc250('0x23')]?_0x450bae[_0xc250('0x23')]:undefined;this[_0xc250('0x24')]=_0x450bae[_0xc250('0x24')]?_0x450bae[_0xc250('0x24')]:undefined;this[_0xc250('0x25')]=_0x450bae[_0xc250('0x25')]?_0x450bae[_0xc250('0x25')]:undefined;this[_0xc250('0x26')]=_0x450bae[_0xc250('0x26')]?_0x450bae[_0xc250('0x26')]:undefined;this[_0xc250('0x27')]=_0x450bae['SquareProject']?_0x450bae[_0xc250('0x26')][_0xc250('0x0')]:undefined;this['dialAMDActive']=_0x450bae[_0xc250('0x28')]||![];this[_0xc250('0x29')]=_0x450bae[_0xc250('0x29')];this[_0xc250('0x2a')]=_0x450bae['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x450bae[_0xc250('0x2b')];this['dialAMDTotalAnalysisTime']=_0x450bae[_0xc250('0x2c')];this[_0xc250('0x2d')]=_0x450bae['dialAMDMinWordLength'];this[_0xc250('0x2e')]=_0x450bae[_0xc250('0x2e')];this[_0xc250('0x2f')]=_0x450bae[_0xc250('0x2f')];this['dialAMDSilenceThreshold']=_0x450bae['dialAMDSilenceThreshold'];this[_0xc250('0x30')]=_0x450bae[_0xc250('0x30')];}module[_0xc250('0x31')]=Campaign; \ No newline at end of file +var _0x02de=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval'];(function(_0x2331b2,_0x39a00c){var _0x44b719=function(_0xb247c5){while(--_0xb247c5){_0x2331b2['push'](_0x2331b2['shift']());}};_0x44b719(++_0x39a00c);}(_0x02de,0x15a));var _0xe02d=function(_0x38d309,_0x17e52d){_0x38d309=_0x38d309-0x0;var _0x2cc9b3=_0x02de[_0x38d309];return _0x2cc9b3;};'use strict';function Campaign(_0x43231d){this['id']=_0x43231d['id']||0x0;this[_0xe02d('0x0')]=_0x43231d[_0xe02d('0x0')]||'';this[_0xe02d('0x1')]=_0x43231d['type']||_0xe02d('0x2');this[_0xe02d('0x3')]=0x0;this['temp']=0x0;this[_0xe02d('0x4')]=0x0;this[_0xe02d('0x5')]=0x0;this[_0xe02d('0x6')]='';this[_0xe02d('0x7')]=!![];this['active']=_0x43231d['active'];this[_0xe02d('0x8')]=_0x43231d[_0xe02d('0x8')];this[_0xe02d('0x9')]=_0x43231d[_0xe02d('0x9')]||null;this[_0xe02d('0xa')]=_0x43231d['dialGlobalInterval']?_0x43231d[_0xe02d('0xa')]:null;this[_0xe02d('0xb')]=_0x43231d[_0xe02d('0xb')];this[_0xe02d('0xc')]=_0x43231d['dialOriginateCallerIdNumber'];this[_0xe02d('0xd')]=_0x43231d[_0xe02d('0xd')]||0x1e;this[_0xe02d('0xe')]=_0x43231d[_0xe02d('0xe')];this[_0xe02d('0xf')]=_0x43231d[_0xe02d('0xf')];this[_0xe02d('0x10')]=_0x43231d[_0xe02d('0x10')];this[_0xe02d('0x11')]=_0x43231d[_0xe02d('0x11')];this['dialNoAnswerMaxRetry']=_0x43231d[_0xe02d('0x12')];this[_0xe02d('0x13')]=_0x43231d[_0xe02d('0x13')];this[_0xe02d('0x14')]=_0x43231d['dialGlobalMaxRetry'];this[_0xe02d('0x15')]=_0x43231d[_0xe02d('0x15')]||0x3;this[_0xe02d('0x16')]=_0x43231d[_0xe02d('0x16')]||0x96;this[_0xe02d('0x17')]=_0x43231d[_0xe02d('0x17')]||0x3;this[_0xe02d('0x18')]=_0x43231d[_0xe02d('0x18')]||0x96;this['dialAbandonedMaxRetry']=_0x43231d['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x43231d[_0xe02d('0x19')]||0x96;this[_0xe02d('0x1a')]=_0x43231d['dialMachineMaxRetry']||0x3;this[_0xe02d('0x1b')]=_0x43231d[_0xe02d('0x1b')]||0x96;this[_0xe02d('0x1c')]=_0x43231d['dialAgentRejectMaxRetry']||0x3;this[_0xe02d('0x1d')]=_0x43231d[_0xe02d('0x1d')]||0x96;this[_0xe02d('0x1e')]=_0x43231d[_0xe02d('0x1e')]||_0xe02d('0x1f');this['dialPrefix']=_0x43231d[_0xe02d('0x20')]||undefined;this[_0xe02d('0x21')]=_0x43231d[_0xe02d('0x21')]||undefined;this['dialCutDigit']=_0x43231d[_0xe02d('0x22')]||undefined;this[_0xe02d('0x23')]=_0x43231d[_0xe02d('0x23')]?_0x43231d['TrunkBackup']:undefined;this['Trunk']=_0x43231d[_0xe02d('0x24')]?_0x43231d[_0xe02d('0x24')]:undefined;this[_0xe02d('0x25')]=_0x43231d[_0xe02d('0x25')]?_0x43231d[_0xe02d('0x25')]:undefined;this[_0xe02d('0x26')]=_0x43231d['SquareProject']?_0x43231d[_0xe02d('0x26')]:undefined;this[_0xe02d('0x27')]=_0x43231d[_0xe02d('0x26')]?_0x43231d[_0xe02d('0x26')][_0xe02d('0x0')]:undefined;this[_0xe02d('0x28')]=_0x43231d['dialAMDActive']||![];this[_0xe02d('0x29')]=_0x43231d[_0xe02d('0x29')];this['dialAMDGreeting']=_0x43231d[_0xe02d('0x2a')];this[_0xe02d('0x2b')]=_0x43231d['dialAMDAfterGreetingSilence'];this[_0xe02d('0x2c')]=_0x43231d[_0xe02d('0x2c')];this[_0xe02d('0x2d')]=_0x43231d['dialAMDMinWordLength'];this[_0xe02d('0x2e')]=_0x43231d[_0xe02d('0x2e')];this[_0xe02d('0x2f')]=_0x43231d[_0xe02d('0x2f')];this[_0xe02d('0x30')]=_0x43231d['dialAMDSilenceThreshold'];this[_0xe02d('0x31')]=_0x43231d[_0xe02d('0x31')];}module[_0xe02d('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 8d6e4fa..eb343a5 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 _0x6da1=['abandoned','lastapplication','lastdata','billableseconds','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','channel','calleridnum','calleridname','connectedlinenum','accountcode','context','linkedid','exten','answered','unmanaged'];(function(_0x641145,_0x4a6429){var _0x39af3f=function(_0x3a2274){while(--_0x3a2274){_0x641145['push'](_0x641145['shift']());}};_0x39af3f(++_0x4a6429);}(_0x6da1,0x1b8));var _0x16da=function(_0x285824,_0x3da647){_0x285824=_0x285824-0x0;var _0x311d7e=_0x6da1[_0x285824];return _0x311d7e;};'use strict';function Channel(){this['starttime']=null;this[_0x16da('0x0')]='';this['destinationchannel']='';this[_0x16da('0x1')]=0x0;this[_0x16da('0x2')]='';this[_0x16da('0x3')]=undefined;this['connectedlinename']=undefined;this[_0x16da('0x4')]=0x0;this[_0x16da('0x5')]='';this['uniqueid']=0x0;this[_0x16da('0x6')]=0x0;this[_0x16da('0x7')]=0x0;this[_0x16da('0x8')]=![];this['answertime']=null;this['endtime']=null;this[_0x16da('0x9')]=![];this[_0x16da('0xa')]=![];this[_0x16da('0xb')]='';this[_0x16da('0xc')]='';this['duration']=0x0;this[_0x16da('0xd')]=0x0;this['holdtime']=0x0;this[_0x16da('0xe')]=null;this[_0x16da('0xf')]=null;this[_0x16da('0x10')]=null;this[_0x16da('0x11')]=![];this[_0x16da('0x12')]=null;this[_0x16da('0x13')]=null;this[_0x16da('0x14')]=[];this[_0x16da('0x15')]=undefined;this[_0x16da('0x16')]=undefined;this[_0x16da('0x17')]=0x0;}module[_0x16da('0x18')]=Channel; \ No newline at end of file +var _0xd7a5=['abandoned','lastapplication','duration','billableseconds','holdtime','type','tag','disposition','monitor','queue','monitors','transfercalleridnum','exports','starttime','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd7a5,0x1ad));var _0x5d7a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xd7a5[_0x1694f5];return _0x5b4321;};'use strict';function Channel(){this[_0x5d7a('0x0')]=null;this['channel']='';this[_0x5d7a('0x1')]='';this[_0x5d7a('0x2')]=0x0;this['calleridname']='';this[_0x5d7a('0x3')]=undefined;this[_0x5d7a('0x4')]=undefined;this[_0x5d7a('0x5')]=0x0;this[_0x5d7a('0x6')]='';this[_0x5d7a('0x7')]=0x0;this[_0x5d7a('0x8')]=0x0;this[_0x5d7a('0x9')]=0x0;this[_0x5d7a('0xa')]=![];this[_0x5d7a('0xb')]=null;this[_0x5d7a('0xc')]=null;this['unmanaged']=![];this[_0x5d7a('0xd')]=![];this[_0x5d7a('0xe')]='';this['lastdata']='';this[_0x5d7a('0xf')]=0x0;this[_0x5d7a('0x10')]=0x0;this[_0x5d7a('0x11')]=0x0;this[_0x5d7a('0x12')]=null;this[_0x5d7a('0x13')]=null;this[_0x5d7a('0x14')]=null;this[_0x5d7a('0x15')]=![];this['monitorFilename']=null;this[_0x5d7a('0x16')]=null;this[_0x5d7a('0x17')]=[];this[_0x5d7a('0x18')]=undefined;this['transferconnectedlinenum']=undefined;this['mohtime']=0x0;}module[_0x5d7a('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 305dbfd..093c540 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 _0xe77f=['type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x29650d,_0x1b473f){var _0x5df2c9=function(_0x249d31){while(--_0x249d31){_0x29650d['push'](_0x29650d['shift']());}};_0x5df2c9(++_0x1b473f);}(_0xe77f,0xba));var _0xfe77=function(_0x5885be,_0x102e04){_0x5885be=_0x5885be-0x0;var _0x58a0f1=_0xe77f[_0x5885be];return _0x58a0f1;};'use strict';function DeskAccount(_0x141b79){this['id']=_0x141b79['id']||0x0;this[_0xfe77('0x0')]=_0x141b79['name']||'';this[_0xfe77('0x1')]=_0x141b79[_0xfe77('0x1')]||'';this['remoteUri']=_0x141b79[_0xfe77('0x2')]||'';this[_0xfe77('0x3')]=_0x141b79['authType']||'';this[_0xfe77('0x4')]=_0x141b79[_0xfe77('0x4')]||'';this[_0xfe77('0x5')]=_0x141b79[_0xfe77('0x5')]||'';this[_0xfe77('0x6')]=_0x141b79['consumerSecret']||'';this['token']=_0x141b79[_0xfe77('0x7')]||'';this[_0xfe77('0x8')]=_0x141b79[_0xfe77('0x8')]||'';this[_0xfe77('0x9')]=_0x141b79[_0xfe77('0x9')]||'';this[_0xfe77('0xa')]=_0x141b79['serverUrl']||'';this['Configurations']=_0x141b79[_0xfe77('0xb')]||{};}module[_0xfe77('0xc')]=DeskAccount; \ No newline at end of file +var _0x6f72=['consumerSecret','token','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey'];(function(_0x4dbd57,_0xf3a2b6){var _0x39efae=function(_0x5ab133){while(--_0x5ab133){_0x4dbd57['push'](_0x4dbd57['shift']());}};_0x39efae(++_0xf3a2b6);}(_0x6f72,0xae));var _0x26f7=function(_0x3b6d19,_0x1f9afd){_0x3b6d19=_0x3b6d19-0x0;var _0x55b646=_0x6f72[_0x3b6d19];return _0x55b646;};'use strict';function DeskAccount(_0x2d351f){this['id']=_0x2d351f['id']||0x0;this[_0x26f7('0x0')]=_0x2d351f[_0x26f7('0x0')]||'';this[_0x26f7('0x1')]=_0x2d351f['username']||'';this[_0x26f7('0x2')]=_0x2d351f[_0x26f7('0x2')]||'';this['authType']=_0x2d351f[_0x26f7('0x3')]||'';this[_0x26f7('0x4')]=_0x2d351f['password']||'';this[_0x26f7('0x5')]=_0x2d351f['consumerKey']||'';this[_0x26f7('0x6')]=_0x2d351f['consumerSecret']||'';this[_0x26f7('0x7')]=_0x2d351f[_0x26f7('0x7')]||'';this['tokenSecret']=_0x2d351f['tokenSecret']||'';this[_0x26f7('0x8')]=_0x2d351f[_0x26f7('0x8')]||'';this[_0x26f7('0x9')]=_0x2d351f[_0x26f7('0x9')]||'';this[_0x26f7('0xa')]=_0x2d351f[_0x26f7('0xa')]||{};}module[_0x26f7('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 22517fb..a3d7d8a 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 _0x0501=['name','username','password','remoteUri','tenantId','clientSecret','serverUrl','Configurations','exports'];(function(_0x567c9c,_0x44acf1){var _0x53c098=function(_0xf76c02){while(--_0xf76c02){_0x567c9c['push'](_0x567c9c['shift']());}};_0x53c098(++_0x44acf1);}(_0x0501,0x1ef));var _0x1050=function(_0x410bad,_0x1cecc3){_0x410bad=_0x410bad-0x0;var _0x12cfab=_0x0501[_0x410bad];return _0x12cfab;};'use strict';function Dynamics365Account(_0x43106d){this['id']=_0x43106d['id']||0x0;this[_0x1050('0x0')]=_0x43106d[_0x1050('0x0')]||'';this[_0x1050('0x1')]=_0x43106d['username']||'';this[_0x1050('0x2')]=_0x43106d[_0x1050('0x2')]||'';this['remoteUri']=_0x43106d[_0x1050('0x3')]||'';this['tenantId']=_0x43106d[_0x1050('0x4')]||'';this['clientId']=_0x43106d['clientId']||'';this[_0x1050('0x5')]=_0x43106d[_0x1050('0x5')]||{};this[_0x1050('0x6')]=_0x43106d[_0x1050('0x6')]||'';this[_0x1050('0x7')]=_0x43106d[_0x1050('0x7')]||{};}module[_0x1050('0x8')]=Dynamics365Account; \ No newline at end of file +var _0xdf5c=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0x451481,_0xd97ad4){var _0x4903cd=function(_0x2121e3){while(--_0x2121e3){_0x451481['push'](_0x451481['shift']());}};_0x4903cd(++_0xd97ad4);}(_0xdf5c,0x1eb));var _0xcdf5=function(_0x5ba30f,_0x58f7e7){_0x5ba30f=_0x5ba30f-0x0;var _0xc44718=_0xdf5c[_0x5ba30f];return _0xc44718;};'use strict';function Dynamics365Account(_0x2bd558){this['id']=_0x2bd558['id']||0x0;this[_0xcdf5('0x0')]=_0x2bd558[_0xcdf5('0x0')]||'';this[_0xcdf5('0x1')]=_0x2bd558['username']||'';this['password']=_0x2bd558[_0xcdf5('0x2')]||'';this[_0xcdf5('0x3')]=_0x2bd558[_0xcdf5('0x3')]||'';this['tenantId']=_0x2bd558[_0xcdf5('0x4')]||'';this[_0xcdf5('0x5')]=_0x2bd558['clientId']||'';this[_0xcdf5('0x6')]=_0x2bd558[_0xcdf5('0x6')]||{};this[_0xcdf5('0x7')]=_0x2bd558[_0xcdf5('0x7')]||'';this[_0xcdf5('0x8')]=_0x2bd558[_0xcdf5('0x8')]||{};}module[_0xcdf5('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 445ef34..51b33f4 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 _0xae0e=['SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech'];(function(_0x840e53,_0x4e89f5){var _0x2f30bc=function(_0x58c5a1){while(--_0x58c5a1){_0x840e53['push'](_0x840e53['shift']());}};_0x2f30bc(++_0x4e89f5);}(_0xae0e,0x149));var _0xeae0=function(_0x3f6c52,_0x237b04){_0x3f6c52=_0x3f6c52-0x0;var _0x5a7a6e=_0xae0e[_0x3f6c52];return _0x5a7a6e;};'use strict';function FaxAccount(_0x383c8f){this['id']=_0x383c8f['id']||0x0;this['name']=_0x383c8f[_0xeae0('0x0')]||'';this[_0xeae0('0x1')]=_0x383c8f[_0xeae0('0x1')];this['ecm']=_0x383c8f[_0xeae0('0x2')];this[_0xeae0('0x3')]=_0x383c8f[_0xeae0('0x3')];this[_0xeae0('0x4')]=_0x383c8f[_0xeae0('0x4')];this[_0xeae0('0x5')]=_0x383c8f[_0xeae0('0x5')]||0x960;this['maxrate']=_0x383c8f[_0xeae0('0x6')]||0x3840;this[_0xeae0('0x7')]=_0x383c8f[_0xeae0('0x7')]||_0xeae0('0x8');this[_0xeae0('0x9')]=_0x383c8f[_0xeae0('0x9')]||'no';this[_0xeae0('0xa')]=_0x383c8f['faxdetect']||'no';this[_0xeae0('0xb')]=_0x383c8f[_0xeae0('0xb')]||0x1388;this[_0xeae0('0xc')]=_0x383c8f['tech']||_0xeae0('0xd');this[_0xeae0('0xe')]=_0x383c8f['Trunk']?_0x383c8f['Trunk']:undefined;this[_0xeae0('0xf')]=_0x383c8f[_0xeae0('0xf')];this['key']=_0x383c8f[_0xeae0('0x10')];}module[_0xeae0('0x11')]=FaxAccount; \ No newline at end of file +var _0x9fa2=['faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway'];(function(_0x48ce53,_0x162529){var _0x5cf816=function(_0x569148){while(--_0x569148){_0x48ce53['push'](_0x48ce53['shift']());}};_0x5cf816(++_0x162529);}(_0x9fa2,0x67));var _0x29fa=function(_0x1f5a63,_0x511504){_0x1f5a63=_0x1f5a63-0x0;var _0x30bb7a=_0x9fa2[_0x1f5a63];return _0x30bb7a;};'use strict';function FaxAccount(_0x4c6556){this['id']=_0x4c6556['id']||0x0;this[_0x29fa('0x0')]=_0x4c6556[_0x29fa('0x0')]||'';this[_0x29fa('0x1')]=_0x4c6556[_0x29fa('0x1')];this['ecm']=_0x4c6556[_0x29fa('0x2')];this['headerinfo']=_0x4c6556['headerinfo'];this[_0x29fa('0x3')]=_0x4c6556['localstationid'];this[_0x29fa('0x4')]=_0x4c6556[_0x29fa('0x4')]||0x960;this[_0x29fa('0x5')]=_0x4c6556[_0x29fa('0x5')]||0x3840;this[_0x29fa('0x6')]=_0x4c6556[_0x29fa('0x6')]||_0x29fa('0x7');this[_0x29fa('0x8')]=_0x4c6556[_0x29fa('0x8')]||'no';this['faxdetect']=_0x4c6556[_0x29fa('0x9')]||'no';this['t38timeout']=_0x4c6556[_0x29fa('0xa')]||0x1388;this[_0x29fa('0xb')]=_0x4c6556[_0x29fa('0xb')]||'SIP';this[_0x29fa('0xc')]=_0x4c6556[_0x29fa('0xc')]?_0x4c6556[_0x29fa('0xc')]:undefined;this[_0x29fa('0xd')]=_0x4c6556[_0x29fa('0xd')];this[_0x29fa('0xe')]=_0x4c6556['key'];}module[_0x29fa('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 86a1edd..5d57fb5 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 _0x59f5=['Configurations','exports','name','username','apiKey','remoteUri','serverUrl'];(function(_0x35154b,_0x6a9ca1){var _0x46825a=function(_0x2fc24b){while(--_0x2fc24b){_0x35154b['push'](_0x35154b['shift']());}};_0x46825a(++_0x6a9ca1);}(_0x59f5,0x167));var _0x559f=function(_0x48d094,_0x985054){_0x48d094=_0x48d094-0x0;var _0x227654=_0x59f5[_0x48d094];return _0x227654;};'use strict';function FreshdeskAccount(_0x1a682e){this['id']=_0x1a682e['id']||0x0;this[_0x559f('0x0')]=_0x1a682e['name']||'';this[_0x559f('0x1')]=_0x1a682e['username']||'';this[_0x559f('0x2')]=_0x1a682e['token']||'';this[_0x559f('0x3')]=_0x1a682e['remoteUri']||'';this[_0x559f('0x4')]=_0x1a682e[_0x559f('0x4')]||'';this['Configurations']=_0x1a682e[_0x559f('0x5')]||{};}module[_0x559f('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x8b1b=['remoteUri','Configurations','exports','name','username','apiKey','token'];(function(_0x2ec00a,_0x23412a){var _0x27b616=function(_0x1bb2c5){while(--_0x1bb2c5){_0x2ec00a['push'](_0x2ec00a['shift']());}};_0x27b616(++_0x23412a);}(_0x8b1b,0xea));var _0xb8b1=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x8b1b[_0x4ae829];return _0x256b31;};'use strict';function FreshdeskAccount(_0x14159d){this['id']=_0x14159d['id']||0x0;this[_0xb8b1('0x0')]=_0x14159d[_0xb8b1('0x0')]||'';this[_0xb8b1('0x1')]=_0x14159d['username']||'';this[_0xb8b1('0x2')]=_0x14159d[_0xb8b1('0x3')]||'';this[_0xb8b1('0x4')]=_0x14159d[_0xb8b1('0x4')]||'';this['serverUrl']=_0x14159d['serverUrl']||'';this[_0xb8b1('0x5')]=_0x14159d[_0xb8b1('0x5')]||{};}module[_0xb8b1('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 e897ce1..553c186 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 _0xcdcf=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x54e916,_0x5582da){var _0x2481b8=function(_0x402e84){while(--_0x402e84){_0x54e916['push'](_0x54e916['shift']());}};_0x2481b8(++_0x5582da);}(_0xcdcf,0xe5));var _0xfcdc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdcf[_0x3dd15e];return _0x231fd0;};'use strict';function FreshsalesAccount(_0x4927e4){this['id']=_0x4927e4['id']||0x0;this[_0xfcdc('0x0')]=_0x4927e4[_0xfcdc('0x0')]||'';this['username']=_0x4927e4[_0xfcdc('0x1')]||'';this[_0xfcdc('0x2')]=_0x4927e4[_0xfcdc('0x3')]||'';this[_0xfcdc('0x4')]=_0x4927e4[_0xfcdc('0x4')]||'';this[_0xfcdc('0x5')]=_0x4927e4[_0xfcdc('0x5')]||'';this[_0xfcdc('0x6')]=_0x4927e4[_0xfcdc('0x6')]||{};}module[_0xfcdc('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x34b3=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0xcf4569,_0x1ce755){var _0x7fef=function(_0x374ab8){while(--_0x374ab8){_0xcf4569['push'](_0xcf4569['shift']());}};_0x7fef(++_0x1ce755);}(_0x34b3,0x18e));var _0x334b=function(_0x2a8855,_0x404cc8){_0x2a8855=_0x2a8855-0x0;var _0x4fb8ae=_0x34b3[_0x2a8855];return _0x4fb8ae;};'use strict';function FreshsalesAccount(_0x5e2002){this['id']=_0x5e2002['id']||0x0;this[_0x334b('0x0')]=_0x5e2002['name']||'';this[_0x334b('0x1')]=_0x5e2002[_0x334b('0x1')]||'';this[_0x334b('0x2')]=_0x5e2002[_0x334b('0x3')]||'';this['remoteUri']=_0x5e2002[_0x334b('0x4')]||'';this[_0x334b('0x5')]=_0x5e2002[_0x334b('0x5')]||'';this[_0x334b('0x6')]=_0x5e2002[_0x334b('0x6')]||{};}module[_0x334b('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index b2d961a..f903462 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 _0xef96=['type','inbound','uniqueid','calleridname','queue','position','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','context','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports'];(function(_0x3c0af9,_0xed258a){var _0x22350b=function(_0x3aef38){while(--_0x3aef38){_0x3c0af9['push'](_0x3c0af9['shift']());}};_0x22350b(++_0xed258a);}(_0xef96,0x150));var _0x6ef9=function(_0x15a2b8,_0x559b11){_0x15a2b8=_0x15a2b8-0x0;var _0x590c4a=_0xef96[_0x15a2b8];return _0x590c4a;};'use strict';function QueueReport(){this[_0x6ef9('0x0')]=_0x6ef9('0x1');this[_0x6ef9('0x2')]='';this['calleridnum']='';this[_0x6ef9('0x3')]='';this[_0x6ef9('0x4')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0x6ef9('0x5')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0x6ef9('0x6')]=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this[_0x6ef9('0x7')]=![];this[_0x6ef9('0x8')]=null;this[_0x6ef9('0x9')]=0x1;this[_0x6ef9('0xa')]='';this['connectedlinenum']='';this[_0x6ef9('0xb')]='';this[_0x6ef9('0xc')]='';this[_0x6ef9('0xd')]='';this['exten']='';this[_0x6ef9('0xe')]='';this[_0x6ef9('0xf')]=0x0;this[_0x6ef9('0x10')]=![];this[_0x6ef9('0x11')]='';this[_0x6ef9('0x12')]=0x0;this[_0x6ef9('0x13')]={};}module[_0x6ef9('0x14')]=QueueReport; \ No newline at end of file +var _0xb3d3=['priority','holdtime','assigned','lastAssignedTo','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerabandon','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','accountcode','context','exten'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb3d3,0xdc));var _0x3b3d=function(_0x4fc80b,_0xfe1b3d){_0x4fc80b=_0x4fc80b-0x0;var _0x119dba=_0xb3d3[_0x4fc80b];return _0x119dba;};'use strict';function QueueReport(){this[_0x3b3d('0x0')]='inbound';this[_0x3b3d('0x1')]='';this[_0x3b3d('0x2')]='';this[_0x3b3d('0x3')]='';this['queue']='';this[_0x3b3d('0x4')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this['count']=0x1;this[_0x3b3d('0x5')]=![];this['queuecallerabandonAt']=null;this[_0x3b3d('0x6')]=![];this['queuecallercompleteAt']=null;this[_0x3b3d('0x7')]=![];this[_0x3b3d('0x8')]=null;this[_0x3b3d('0x9')]=0x1;this[_0x3b3d('0xa')]='';this['connectedlinenum']='';this['connectedlinename']='';this[_0x3b3d('0xb')]='';this[_0x3b3d('0xc')]='';this[_0x3b3d('0xd')]='';this[_0x3b3d('0xe')]='';this[_0x3b3d('0xf')]=0x0;this[_0x3b3d('0x10')]=![];this[_0x3b3d('0x11')]='';this['mohtime']=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index dc501bb..412d971 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 _0xe472=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','integrationTab','serverUrl'];(function(_0x1428e0,_0x39621f){var _0x3d6c39=function(_0x56a212){while(--_0x56a212){_0x1428e0['push'](_0x1428e0['shift']());}};_0x3d6c39(++_0x39621f);}(_0xe472,0xff));var _0x2e47=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe472[_0x2dafbe];return _0x58a45a;};'use strict';function SalesforceAccount(_0xac85f5){this['id']=_0xac85f5['id']||0x0;this[_0x2e47('0x0')]=_0xac85f5[_0x2e47('0x0')]||'';this['username']=_0xac85f5[_0x2e47('0x1')]||'';this['remoteUri']=_0xac85f5[_0x2e47('0x2')]||'';this[_0x2e47('0x3')]=_0xac85f5[_0x2e47('0x3')]||'';this['clientId']=_0xac85f5[_0x2e47('0x4')]||'';this[_0x2e47('0x5')]=_0xac85f5['clientSecret']||'';this[_0x2e47('0x6')]=_0xac85f5[_0x2e47('0x6')]||'';this['type']=_0xac85f5['type']||_0x2e47('0x7');this[_0x2e47('0x8')]=_0xac85f5['serverUrl']||'';this[_0x2e47('0x9')]=_0xac85f5[_0x2e47('0x9')]||{};}module[_0x2e47('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xbb87=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','password','clientId'];(function(_0x5038d4,_0x4ff6c1){var _0x14f3f3=function(_0x5926d3){while(--_0x5926d3){_0x5038d4['push'](_0x5038d4['shift']());}};_0x14f3f3(++_0x4ff6c1);}(_0xbb87,0xa1));var _0x7bb8=function(_0x4197d7,_0x3f6556){_0x4197d7=_0x4197d7-0x0;var _0x1971ad=_0xbb87[_0x4197d7];return _0x1971ad;};'use strict';function SalesforceAccount(_0x369c8b){this['id']=_0x369c8b['id']||0x0;this[_0x7bb8('0x0')]=_0x369c8b[_0x7bb8('0x0')]||'';this[_0x7bb8('0x1')]=_0x369c8b['username']||'';this['remoteUri']=_0x369c8b['remoteUri']||'';this[_0x7bb8('0x2')]=_0x369c8b[_0x7bb8('0x2')]||'';this['clientId']=_0x369c8b[_0x7bb8('0x3')]||'';this[_0x7bb8('0x4')]=_0x369c8b[_0x7bb8('0x4')]||'';this['securityToken']=_0x369c8b[_0x7bb8('0x5')]||'';this[_0x7bb8('0x6')]=_0x369c8b[_0x7bb8('0x6')]||_0x7bb8('0x7');this['serverUrl']=_0x369c8b[_0x7bb8('0x8')]||'';this[_0x7bb8('0x9')]=_0x369c8b[_0x7bb8('0x9')]||{};}module[_0x7bb8('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index b3e9e5d..b525c32 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 _0x5169=['Configurations','name','username','remoteUri','serverUrl'];(function(_0x4b758c,_0xbcbf86){var _0x3de836=function(_0x1b74c1){while(--_0x1b74c1){_0x4b758c['push'](_0x4b758c['shift']());}};_0x3de836(++_0xbcbf86);}(_0x5169,0x123));var _0x9516=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5169[_0x19950b];return _0x3c6b41;};'use strict';function ServicenowAccount(_0x4fb397){this['id']=_0x4fb397['id']||0x0;this['name']=_0x4fb397[_0x9516('0x0')]||'';this['username']=_0x4fb397[_0x9516('0x1')]||'';this['password']=_0x4fb397['password']||'';this[_0x9516('0x2')]=_0x4fb397[_0x9516('0x2')]||'';this[_0x9516('0x3')]=_0x4fb397[_0x9516('0x3')]||'';this[_0x9516('0x4')]=_0x4fb397[_0x9516('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x1bbf=['serverUrl','Configurations','exports','username','password'];(function(_0x447f30,_0xcd4a00){var _0x4a0982=function(_0x37c081){while(--_0x37c081){_0x447f30['push'](_0x447f30['shift']());}};_0x4a0982(++_0xcd4a00);}(_0x1bbf,0x12a));var _0xf1bb=function(_0xea35d1,_0x302471){_0xea35d1=_0xea35d1-0x0;var _0x1d7a7c=_0x1bbf[_0xea35d1];return _0x1d7a7c;};'use strict';function ServicenowAccount(_0x54ec19){this['id']=_0x54ec19['id']||0x0;this['name']=_0x54ec19['name']||'';this[_0xf1bb('0x0')]=_0x54ec19['username']||'';this[_0xf1bb('0x1')]=_0x54ec19[_0xf1bb('0x1')]||'';this['remoteUri']=_0x54ec19['remoteUri']||'';this['serverUrl']=_0x54ec19[_0xf1bb('0x2')]||'';this[_0xf1bb('0x3')]=_0x54ec19[_0xf1bb('0x3')]||{};}module[_0xf1bb('0x4')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index cdd0026..afdd7c5 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 _0xf7dd=['Configurations','exports','name','username','remoteUri','serverUrl'];(function(_0x560355,_0x519541){var _0xd86b7a=function(_0x932469){while(--_0x932469){_0x560355['push'](_0x560355['shift']());}};_0xd86b7a(++_0x519541);}(_0xf7dd,0x19a));var _0xdf7d=function(_0x39d711,_0xe11eb7){_0x39d711=_0x39d711-0x0;var _0xee1d0c=_0xf7dd[_0x39d711];return _0xee1d0c;};'use strict';function SugarcrmAccount(_0x19d300){this['id']=_0x19d300['id']||0x0;this['name']=_0x19d300[_0xdf7d('0x0')]||'';this[_0xdf7d('0x1')]=_0x19d300[_0xdf7d('0x1')]||'';this['password']=_0x19d300['password']||'';this[_0xdf7d('0x2')]=_0x19d300[_0xdf7d('0x2')]||'';this[_0xdf7d('0x3')]=_0x19d300[_0xdf7d('0x3')]||'';this[_0xdf7d('0x4')]=_0x19d300['Configurations']||{};}module[_0xdf7d('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x349e=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2452b9,_0x2f9989){var _0x51542d=function(_0x3e24be){while(--_0x3e24be){_0x2452b9['push'](_0x2452b9['shift']());}};_0x51542d(++_0x2f9989);}(_0x349e,0x6f));var _0xe349=function(_0x583a0f,_0x1549ee){_0x583a0f=_0x583a0f-0x0;var _0x557100=_0x349e[_0x583a0f];return _0x557100;};'use strict';function SugarcrmAccount(_0x4b1e54){this['id']=_0x4b1e54['id']||0x0;this[_0xe349('0x0')]=_0x4b1e54[_0xe349('0x0')]||'';this[_0xe349('0x1')]=_0x4b1e54[_0xe349('0x1')]||'';this[_0xe349('0x2')]=_0x4b1e54['password']||'';this[_0xe349('0x3')]=_0x4b1e54['remoteUri']||'';this[_0xe349('0x4')]=_0x4b1e54[_0xe349('0x4')]||'';this['Configurations']=_0x4b1e54[_0xe349('0x5')]||{};}module[_0xe349('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 4729035..88d0b47 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 _0x2d31=['stateTime','status','exports','name','accountcode','state','unknown'];(function(_0x25875c,_0xc144a9){var _0x48a9e6=function(_0x3b4ff5){while(--_0x3b4ff5){_0x25875c['push'](_0x25875c['shift']());}};_0x48a9e6(++_0xc144a9);}(_0x2d31,0x65));var _0x12d3=function(_0xd1a252,_0x16396f){_0xd1a252=_0xd1a252-0x0;var _0x560ee1=_0x2d31[_0xd1a252];return _0x560ee1;};'use strict';function Telephone(_0x1b361e){this['id']=_0x1b361e['id']||0x0;this[_0x12d3('0x0')]=_0x1b361e['name']||'';this['accountcode']=_0x1b361e[_0x12d3('0x1')]||'';this[_0x12d3('0x2')]=_0x12d3('0x3');this[_0x12d3('0x4')]=0x0;this[_0x12d3('0x5')]=_0x12d3('0x3');this['address']='';}module[_0x12d3('0x6')]=Telephone; \ No newline at end of file +var _0xbe8c=['name','accountcode','unknown','stateTime','status','address','exports'];(function(_0x5b636d,_0x15dfef){var _0x2c769c=function(_0x1927fb){while(--_0x1927fb){_0x5b636d['push'](_0x5b636d['shift']());}};_0x2c769c(++_0x15dfef);}(_0xbe8c,0x1c0));var _0xcbe8=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xbe8c[_0xfae23b];return _0x200640;};'use strict';function Telephone(_0x23ed1e){this['id']=_0x23ed1e['id']||0x0;this['name']=_0x23ed1e[_0xcbe8('0x0')]||'';this[_0xcbe8('0x1')]=_0x23ed1e[_0xcbe8('0x1')]||'';this['state']=_0xcbe8('0x2');this[_0xcbe8('0x3')]=0x0;this[_0xcbe8('0x4')]=_0xcbe8('0x2');this[_0xcbe8('0x5')]='';}module[_0xcbe8('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index eeddad1..356be21 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 _0xddbf=['exports','name','html'];(function(_0x2cc426,_0x33bdb9){var _0x3837e2=function(_0x222fb9){while(--_0x222fb9){_0x2cc426['push'](_0x2cc426['shift']());}};_0x3837e2(++_0x33bdb9);}(_0xddbf,0xca));var _0xfddb=function(_0x304bec,_0xbec8df){_0x304bec=_0x304bec-0x0;var _0x23db01=_0xddbf[_0x304bec];return _0x23db01;};'use strict';function template(_0x323daf){this['id']=_0x323daf['id']||0x0;this[_0xfddb('0x0')]=_0x323daf['name']||'';this[_0xfddb('0x1')]=_0x323daf[_0xfddb('0x1')]||'';}module[_0xfddb('0x2')]=template; \ No newline at end of file +var _0xe49a=['html','exports','name'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0xe49a,0xd7));var _0xae49=function(_0x48449b,_0xb5ab3f){_0x48449b=_0x48449b-0x0;var _0x5288ec=_0xe49a[_0x48449b];return _0x5288ec;};'use strict';function template(_0x5a2668){this['id']=_0x5a2668['id']||0x0;this[_0xae49('0x0')]=_0x5a2668[_0xae49('0x0')]||'';this[_0xae49('0x1')]=_0x5a2668[_0xae49('0x1')]||'';}module[_0xae49('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 8121b2e..69b77d3 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 _0x3e74=['Actions','name','channel','status','AllConditions','AnyConditions'];(function(_0x1a2155,_0x5501c6){var _0x3b7cc9=function(_0x1f11c6){while(--_0x1f11c6){_0x1a2155['push'](_0x1a2155['shift']());}};_0x3b7cc9(++_0x5501c6);}(_0x3e74,0x175));var _0x43e7=function(_0x4b5a9d,_0x4dc62d){_0x4b5a9d=_0x4b5a9d-0x0;var _0x275ad3=_0x3e74[_0x4b5a9d];return _0x275ad3;};'use strict';function Trigger(_0x284ef8){this['id']=_0x284ef8['id']||0x0;this['name']=_0x284ef8[_0x43e7('0x0')]||'';this[_0x43e7('0x1')]=_0x284ef8[_0x43e7('0x1')]||'voice';this['status']=_0x284ef8[_0x43e7('0x2')]||![];this['AllConditions']=_0x284ef8[_0x43e7('0x3')]||[];this[_0x43e7('0x4')]=_0x284ef8[_0x43e7('0x4')]||[];this[_0x43e7('0x5')]=_0x284ef8[_0x43e7('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x7217=['voice','status','AllConditions','AnyConditions','Actions','exports','name','channel'];(function(_0x26945c,_0x46865c){var _0x1845f6=function(_0x23cbd8){while(--_0x23cbd8){_0x26945c['push'](_0x26945c['shift']());}};_0x1845f6(++_0x46865c);}(_0x7217,0x19e));var _0x7721=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x7217[_0x2576d7];return _0x16a08c;};'use strict';function Trigger(_0x516f0e){this['id']=_0x516f0e['id']||0x0;this['name']=_0x516f0e[_0x7721('0x0')]||'';this[_0x7721('0x1')]=_0x516f0e[_0x7721('0x1')]||_0x7721('0x2');this[_0x7721('0x3')]=_0x516f0e['status']||![];this['AllConditions']=_0x516f0e[_0x7721('0x4')]||[];this[_0x7721('0x5')]=_0x516f0e[_0x7721('0x5')]||[];this[_0x7721('0x6')]=_0x516f0e[_0x7721('0x6')]||[];}module[_0x7721('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 907fb17..f68d5b9 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 _0x7b0b=['stateTime','status','indexOf','split','port','domain','domainport','refresh','registrationtime','address','exports','active','name','unknown'];(function(_0x5af91b,_0x3f75aa){var _0xe6d46d=function(_0x5264cd){while(--_0x5264cd){_0x5af91b['push'](_0x5af91b['shift']());}};_0xe6d46d(++_0x3f75aa);}(_0x7b0b,0x1a1));var _0xb7b0=function(_0xcd1d92,_0xdb2d0a){_0xcd1d92=_0xcd1d92-0x0;var _0x216ab0=_0x7b0b[_0xcd1d92];return _0x216ab0;};'use strict';function Trunk(_0x45dd91){this['id']=_0x45dd91['id']||0x0;this[_0xb7b0('0x0')]=_0x45dd91[_0xb7b0('0x0')]||![];this[_0xb7b0('0x1')]=_0x45dd91[_0xb7b0('0x1')]||'';this['state']=_0xb7b0('0x2');this[_0xb7b0('0x3')]=0x0;this[_0xb7b0('0x4')]=_0xb7b0('0x2');this['registry']=_0x45dd91['registry']&&_0x45dd91['registry'][_0xb7b0('0x5')](':')?_0x45dd91['registry'][_0xb7b0('0x6')](':')[0x0]:'';this['host']='';this[_0xb7b0('0x7')]='';this[_0xb7b0('0x8')]='';this[_0xb7b0('0x9')]='';this[_0xb7b0('0xa')]='';this['stateRegistry']=_0xb7b0('0x2');this[_0xb7b0('0xb')]='';this[_0xb7b0('0xc')]='';}module[_0xb7b0('0xd')]=Trunk; \ No newline at end of file +var _0xdafa=['domain','domainport','stateRegistry','registrationtime','address','active','name','state','unknown','stateTime','status','registry','split','host','port'];(function(_0x16b667,_0xadec02){var _0x58620e=function(_0x5db60b){while(--_0x5db60b){_0x16b667['push'](_0x16b667['shift']());}};_0x58620e(++_0xadec02);}(_0xdafa,0x113));var _0xadaf=function(_0xdd156e,_0xb43250){_0xdd156e=_0xdd156e-0x0;var _0x3426b6=_0xdafa[_0xdd156e];return _0x3426b6;};'use strict';function Trunk(_0x2c0818){this['id']=_0x2c0818['id']||0x0;this[_0xadaf('0x0')]=_0x2c0818[_0xadaf('0x0')]||![];this[_0xadaf('0x1')]=_0x2c0818['name']||'';this[_0xadaf('0x2')]=_0xadaf('0x3');this[_0xadaf('0x4')]=0x0;this[_0xadaf('0x5')]=_0xadaf('0x3');this[_0xadaf('0x6')]=_0x2c0818[_0xadaf('0x6')]&&_0x2c0818[_0xadaf('0x6')]['indexOf'](':')?_0x2c0818[_0xadaf('0x6')][_0xadaf('0x7')](':')[0x0]:'';this[_0xadaf('0x8')]='';this[_0xadaf('0x9')]='';this[_0xadaf('0xa')]='';this[_0xadaf('0xb')]='';this['refresh']='';this[_0xadaf('0xc')]=_0xadaf('0x3');this[_0xadaf('0xd')]='';this[_0xadaf('0xe')]='';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 75594fb..f907f58 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 _0xcb69=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x55daf2,_0x1b48de){var _0x1c8500=function(_0x4686b5){while(--_0x4686b5){_0x55daf2['push'](_0x55daf2['shift']());}};_0x1c8500(++_0x1b48de);}(_0xcb69,0x1bf));var _0x9cb6=function(_0x41a46a,_0x4810b8){_0x41a46a=_0x41a46a-0x0;var _0x3e66db=_0xcb69[_0x41a46a];return _0x3e66db;};'use strict';function voiceExtension(_0xbc27fb){this['id']=_0xbc27fb['id']||0x0;this['exten']=_0xbc27fb[_0x9cb6('0x0')]||'';this[_0x9cb6('0x1')]=_0xbc27fb['recordingFormat']||_0x9cb6('0x2');this[_0x9cb6('0x3')]=_0xbc27fb[_0x9cb6('0x3')]||![];}module[_0x9cb6('0x4')]=voiceExtension; \ No newline at end of file +var _0xcad5=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x282146,_0x38df2a){var _0x4eece=function(_0x3683a8){while(--_0x3683a8){_0x282146['push'](_0x282146['shift']());}};_0x4eece(++_0x38df2a);}(_0xcad5,0x173));var _0x5cad=function(_0x50314a,_0xa4ecf8){_0x50314a=_0x50314a-0x0;var _0x295b7d=_0xcad5[_0x50314a];return _0x295b7d;};'use strict';function voiceExtension(_0x453662){this['id']=_0x453662['id']||0x0;this[_0x5cad('0x0')]=_0x453662[_0x5cad('0x0')]||'';this[_0x5cad('0x1')]=_0x453662[_0x5cad('0x1')]||_0x5cad('0x2');this[_0x5cad('0x3')]=_0x453662[_0x5cad('0x3')]||![];}module[_0x5cad('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index fe96f8e..2d4b34e 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 _0x46f4=['queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','answered','sumHoldTime','sumBillable','unmanaged','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy'];(function(_0x4a404f,_0x239620){var _0x21b50a=function(_0x505d60){while(--_0x505d60){_0x4a404f['push'](_0x4a404f['shift']());}};_0x21b50a(++_0x239620);}(_0x46f4,0xb0));var _0x446f=function(_0x113696,_0x1843cc){_0x113696=_0x113696-0x0;var _0x1fb234=_0x46f4[_0x113696];return _0x1fb234;};'use strict';var statusDesc=['unknown','not_inuse',_0x446f('0x0'),_0x446f('0x1'),_0x446f('0x2'),_0x446f('0x3'),_0x446f('0x4'),_0x446f('0x5'),_0x446f('0x6')];var monitorFormat={'wav':_0x446f('0x7'),'wav49':_0x446f('0x8'),'gsm':_0x446f('0x9')};var strategy={'rrmemory':_0x446f('0xa'),'roundrobin':_0x446f('0xb')};function VoiceQueue(_0x26fc49){this['id']=_0x26fc49['id']||0x0;this['name']=_0x26fc49[_0x446f('0xc')]||'';this[_0x446f('0xd')]=_0x26fc49[_0x446f('0xd')]||'';this[_0x446f('0xe')]=_0x26fc49['type']||_0x446f('0xf');this[_0x446f('0x10')]=0x0;this[_0x446f('0x11')]=0x0;this['total']=0x0;this[_0x446f('0x12')]=0x0;this['sumDuration']=0x0;this[_0x446f('0x13')]=0x0;this[_0x446f('0x14')]=0x0;this[_0x446f('0x15')]=0x0;this[_0x446f('0x16')]=0x0;this['loggedIn']=0x0;this[_0x446f('0x17')]=0x0;this[_0x446f('0x18')]=_0x26fc49[_0x446f('0x18')]||![];this[_0x446f('0x19')]=_0x26fc49[_0x446f('0x19')]||0xa;this[_0x446f('0x1a')]=_0x26fc49['autopause']||'no';this[_0x446f('0x1b')]=!![];this[_0x446f('0x1c')]='';this[_0x446f('0x1d')]=0x0;this[_0x446f('0x1e')]=0x0;this['dialTimezone']=_0x26fc49[_0x446f('0x1f')]||null;this[_0x446f('0x20')]=_0x26fc49[_0x446f('0x20')]?_0x26fc49['dialGlobalInterval']:null;this[_0x446f('0x21')]=_0x26fc49['dialActive'];this[_0x446f('0x22')]=_0x26fc49[_0x446f('0x22')]||_0x446f('0x23');this[_0x446f('0x24')]=_0x26fc49[_0x446f('0x24')]||0x0;this[_0x446f('0x25')]=_0x26fc49[_0x446f('0x25')]||0x0;this[_0x446f('0x26')]=_0x26fc49['dialPowerLevel']||0x1;this[_0x446f('0x27')]=_0x26fc49[_0x446f('0x27')]||_0x446f('0x28');this[_0x446f('0x29')]=_0x26fc49[_0x446f('0x29')]||0.03;this[_0x446f('0x2a')]=_0x26fc49[_0x446f('0x2a')]||0x258;this['dialOriginateCallerIdName']=_0x26fc49['dialOriginateCallerIdName']||_0x446f('0x2b');this['dialOriginateCallerIdNumber']=_0x26fc49['dialOriginateCallerIdNumber']||_0x446f('0x2b');this[_0x446f('0x2c')]=_0x26fc49[_0x446f('0x2c')]||0x1e;this['dialQueueOptions']=_0x26fc49[_0x446f('0x2d')]||'tTxX';this[_0x446f('0x2e')]=_0x26fc49[_0x446f('0x2e')]||0x3;this[_0x446f('0x2f')]=_0x26fc49['dialQueueProject']||undefined;this[_0x446f('0x30')]=_0x26fc49[_0x446f('0x30')]||0x3;this[_0x446f('0x31')]=_0x26fc49[_0x446f('0x31')]||0x96;this['dialBusyMaxRetry']=_0x26fc49[_0x446f('0x32')]||0x3;this[_0x446f('0x33')]=_0x26fc49[_0x446f('0x33')]||0x96;this[_0x446f('0x34')]=_0x26fc49[_0x446f('0x34')]||0x3;this[_0x446f('0x35')]=_0x26fc49[_0x446f('0x35')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x26fc49[_0x446f('0x36')]||0x3;this[_0x446f('0x37')]=_0x26fc49[_0x446f('0x37')]||0x96;this[_0x446f('0x38')]=_0x26fc49['dialDropMaxRetry']||0x3;this[_0x446f('0x39')]=_0x26fc49[_0x446f('0x39')]||0x96;this[_0x446f('0x3a')]=_0x26fc49[_0x446f('0x3a')]||0x3;this[_0x446f('0x3b')]=_0x26fc49['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x26fc49[_0x446f('0x3c')]||0x3;this[_0x446f('0x3d')]=_0x26fc49[_0x446f('0x3d')]||0x96;this[_0x446f('0x3e')]=_0x26fc49[_0x446f('0x3e')]||0x3;this[_0x446f('0x3f')]=_0x26fc49[_0x446f('0x3f')]||0x96;this['dialGlobalMaxRetry']=_0x26fc49[_0x446f('0x40')]||0x4;this[_0x446f('0x41')]=_0x26fc49[_0x446f('0x41')]?_0x26fc49['Trunk']:undefined;this[_0x446f('0x42')]=_0x26fc49[_0x446f('0x42')]?_0x26fc49['TrunkBackup']:undefined;this[_0x446f('0x43')]=_0x26fc49[_0x446f('0x43')]||undefined;this[_0x446f('0x44')]=_0x26fc49['Interval']?_0x26fc49[_0x446f('0x44')]:undefined;this[_0x446f('0x45')]=_0x26fc49[_0x446f('0x45')]||_0x446f('0x46');this[_0x446f('0x47')]=_0x26fc49[_0x446f('0x47')]||undefined;this[_0x446f('0x48')]=_0x26fc49[_0x446f('0x48')]||undefined;this[_0x446f('0x49')]=strategy[_0x26fc49[_0x446f('0x49')]]||_0x446f('0xa');this[_0x446f('0x4a')]=!![];this[_0x446f('0x4b')]=_0x26fc49[_0x446f('0x4b')]||![];this[_0x446f('0x4c')]=_0x26fc49[_0x446f('0x4c')];this[_0x446f('0x4d')]=_0x26fc49['dialAMDGreeting'];this[_0x446f('0x4e')]=_0x26fc49[_0x446f('0x4e')];this[_0x446f('0x4f')]=_0x26fc49['dialAMDTotalAnalysisTime'];this[_0x446f('0x50')]=_0x26fc49[_0x446f('0x50')];this[_0x446f('0x51')]=_0x26fc49[_0x446f('0x51')];this[_0x446f('0x52')]=_0x26fc49['dialAMDMaximumNumberOfWords'];this[_0x446f('0x53')]=_0x26fc49[_0x446f('0x53')];this[_0x446f('0x54')]=_0x26fc49[_0x446f('0x54')];this[_0x446f('0x55')]=0x0;this[_0x446f('0x56')]=0x0;this[_0x446f('0x57')]=_0x26fc49[_0x446f('0x57')];this[_0x446f('0x58')]=0x0;this[_0x446f('0x59')]=0x0;this[_0x446f('0x5a')]=0x0;this[_0x446f('0x5b')]=0x0;this[_0x446f('0x5c')]=0x0;this[_0x446f('0x5d')]=0x0;this[_0x446f('0x5e')]=0x0;this[_0x446f('0x5f')]=0x0;this[_0x446f('0x60')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x446f('0x61')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this[_0x446f('0x62')]=0x0;this[_0x446f('0x63')]=undefined;this[_0x446f('0x64')]=undefined;this[_0x446f('0x65')]=undefined;this[_0x446f('0x66')]=1.05;this[_0x446f('0x67')]=0x0;this[_0x446f('0x68')]=0x0;this[_0x446f('0x69')]=0x0;this[_0x446f('0x6a')]=0x0;this[_0x446f('0x6b')]=0x0;this[_0x446f('0x6c')]=0x0;this[_0x446f('0x6d')]=0x0;this[_0x446f('0x6e')]=0x0;this['predictiveIntervalMaxThreshold']=_0x26fc49[_0x446f('0x6f')]||0x14;this[_0x446f('0x70')]=_0x26fc49[_0x446f('0x6f')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x446f('0x71')]=0x0;this[_0x446f('0x72')]=0x1;this[_0x446f('0x73')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0x446f('0x74')]=0x0;this[_0x446f('0x75')]=_0x26fc49[_0x446f('0x75')]||0x1e;this[_0x446f('0x76')]=_0x26fc49[_0x446f('0x76')]||![];this[_0x446f('0x77')]=_0x26fc49[_0x446f('0x77')]||undefined;this[_0x446f('0x78')]=_0x26fc49[_0x446f('0x78')]||![];this[_0x446f('0x79')]=_0x26fc49[_0x446f('0x79')]||![];this[_0x446f('0xd')]=monitorFormat[_0x26fc49[_0x446f('0xd')]]?monitorFormat[_0x26fc49[_0x446f('0xd')]]:undefined;this[_0x446f('0x7a')]=_0x26fc49['mandatoryDisposition']||![];this[_0x446f('0x7b')]=_0x26fc49[_0x446f('0x7b')]?_0x26fc49[_0x446f('0x7b')]:undefined;}module[_0x446f('0x7c')]=VoiceQueue; \ No newline at end of file +var _0x0b6b=['outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','unavailable','ringing','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','type','waiting','talking','total','answered','sumDuration','sumHoldTime','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay'];(function(_0x26c0cc,_0x4630bb){var _0x5e9332=function(_0x40b0ed){while(--_0x40b0ed){_0x26c0cc['push'](_0x26c0cc['shift']());}};_0x5e9332(++_0x4630bb);}(_0x0b6b,0x188));var _0xb0b6=function(_0x467cb0,_0x303070){_0x467cb0=_0x467cb0-0x0;var _0x2153f7=_0x0b6b[_0x467cb0];return _0x2153f7;};'use strict';var statusDesc=['unknown',_0xb0b6('0x0'),_0xb0b6('0x1'),'busy','invalid',_0xb0b6('0x2'),_0xb0b6('0x3'),'ringinuse',_0xb0b6('0x4')];var monitorFormat={'wav':_0xb0b6('0x5'),'wav49':_0xb0b6('0x6'),'gsm':_0xb0b6('0x7')};var strategy={'rrmemory':'rrmemory','roundrobin':_0xb0b6('0x8')};function VoiceQueue(_0x42a469){this['id']=_0x42a469['id']||0x0;this[_0xb0b6('0x9')]=_0x42a469[_0xb0b6('0x9')]||'';this['monitor_format']=_0x42a469[_0xb0b6('0xa')]||'';this[_0xb0b6('0xb')]=_0x42a469['type']||'inbound';this[_0xb0b6('0xc')]=0x0;this[_0xb0b6('0xd')]=0x0;this[_0xb0b6('0xe')]=0x0;this[_0xb0b6('0xf')]=0x0;this[_0xb0b6('0x10')]=0x0;this[_0xb0b6('0x11')]=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0xb0b6('0x12')]=0x0;this['loggedIn']=0x0;this[_0xb0b6('0x13')]=0x0;this[_0xb0b6('0x14')]=_0x42a469[_0xb0b6('0x14')]||![];this['acwTimeout']=_0x42a469[_0xb0b6('0x15')]||0xa;this[_0xb0b6('0x16')]=_0x42a469[_0xb0b6('0x16')]||'no';this[_0xb0b6('0x17')]=!![];this[_0xb0b6('0x18')]='';this[_0xb0b6('0x19')]=0x0;this[_0xb0b6('0x1a')]=0x0;this[_0xb0b6('0x1b')]=_0x42a469[_0xb0b6('0x1b')]||null;this[_0xb0b6('0x1c')]=_0x42a469['dialGlobalInterval']?_0x42a469[_0xb0b6('0x1c')]:null;this[_0xb0b6('0x1d')]=_0x42a469[_0xb0b6('0x1d')];this[_0xb0b6('0x1e')]=_0x42a469[_0xb0b6('0x1e')]||_0xb0b6('0x1f');this[_0xb0b6('0x20')]=_0x42a469[_0xb0b6('0x20')]||0x0;this[_0xb0b6('0x21')]=_0x42a469['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x42a469['dialPowerLevel']||0x1;this[_0xb0b6('0x22')]=_0x42a469[_0xb0b6('0x22')]||'dropRate';this[_0xb0b6('0x23')]=_0x42a469['dialPredictiveOptimizationPercentage']||0.03;this[_0xb0b6('0x24')]=_0x42a469['dialPredictiveInterval']||0x258;this[_0xb0b6('0x25')]=_0x42a469['dialOriginateCallerIdName']||_0xb0b6('0x26');this[_0xb0b6('0x27')]=_0x42a469[_0xb0b6('0x27')]||'anonymous';this[_0xb0b6('0x28')]=_0x42a469['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x42a469[_0xb0b6('0x29')]||_0xb0b6('0x2a');this[_0xb0b6('0x2b')]=_0x42a469[_0xb0b6('0x2b')]||0x3;this[_0xb0b6('0x2c')]=_0x42a469['dialQueueProject']||undefined;this[_0xb0b6('0x2d')]=_0x42a469[_0xb0b6('0x2d')]||0x3;this[_0xb0b6('0x2e')]=_0x42a469[_0xb0b6('0x2e')]||0x96;this[_0xb0b6('0x2f')]=_0x42a469['dialBusyMaxRetry']||0x3;this[_0xb0b6('0x30')]=_0x42a469[_0xb0b6('0x30')]||0x96;this[_0xb0b6('0x31')]=_0x42a469[_0xb0b6('0x31')]||0x3;this[_0xb0b6('0x32')]=_0x42a469[_0xb0b6('0x32')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x42a469[_0xb0b6('0x33')]||0x3;this[_0xb0b6('0x34')]=_0x42a469[_0xb0b6('0x34')]||0x96;this[_0xb0b6('0x35')]=_0x42a469[_0xb0b6('0x35')]||0x3;this[_0xb0b6('0x36')]=_0x42a469[_0xb0b6('0x36')]||0x96;this[_0xb0b6('0x37')]=_0x42a469['dialAbandonedMaxRetry']||0x3;this[_0xb0b6('0x38')]=_0x42a469[_0xb0b6('0x38')]||0x96;this[_0xb0b6('0x39')]=_0x42a469[_0xb0b6('0x39')]||0x3;this[_0xb0b6('0x3a')]=_0x42a469[_0xb0b6('0x3a')]||0x96;this['dialAgentRejectMaxRetry']=_0x42a469['dialAgentRejectMaxRetry']||0x3;this[_0xb0b6('0x3b')]=_0x42a469[_0xb0b6('0x3b')]||0x96;this[_0xb0b6('0x3c')]=_0x42a469[_0xb0b6('0x3c')]||0x4;this[_0xb0b6('0x3d')]=_0x42a469[_0xb0b6('0x3d')]?_0x42a469[_0xb0b6('0x3d')]:undefined;this[_0xb0b6('0x3e')]=_0x42a469[_0xb0b6('0x3e')]?_0x42a469[_0xb0b6('0x3e')]:undefined;this['dialPrefix']=_0x42a469[_0xb0b6('0x3f')]||undefined;this[_0xb0b6('0x40')]=_0x42a469[_0xb0b6('0x40')]?_0x42a469[_0xb0b6('0x40')]:undefined;this['dialOrderByScheduledAt']=_0x42a469['dialOrderByScheduledAt']||_0xb0b6('0x41');this[_0xb0b6('0x42')]=_0x42a469[_0xb0b6('0x42')]||undefined;this[_0xb0b6('0x43')]=_0x42a469[_0xb0b6('0x43')]||undefined;this['strategy']=strategy[_0x42a469[_0xb0b6('0x44')]]||'rrmemory';this[_0xb0b6('0x45')]=!![];this['dialAMDActive']=_0x42a469[_0xb0b6('0x46')]||![];this['dialAMDInitialSilence']=_0x42a469[_0xb0b6('0x47')];this[_0xb0b6('0x48')]=_0x42a469[_0xb0b6('0x48')];this[_0xb0b6('0x49')]=_0x42a469[_0xb0b6('0x49')];this['dialAMDTotalAnalysisTime']=_0x42a469[_0xb0b6('0x4a')];this[_0xb0b6('0x4b')]=_0x42a469[_0xb0b6('0x4b')];this[_0xb0b6('0x4c')]=_0x42a469[_0xb0b6('0x4c')];this[_0xb0b6('0x4d')]=_0x42a469['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x42a469[_0xb0b6('0x4e')];this[_0xb0b6('0x4f')]=_0x42a469[_0xb0b6('0x4f')];this['outboundRejectCallsDay']=0x0;this[_0xb0b6('0x50')]=0x0;this[_0xb0b6('0x51')]=_0x42a469[_0xb0b6('0x51')];this[_0xb0b6('0x52')]=0x0;this[_0xb0b6('0x53')]=0x0;this[_0xb0b6('0x54')]=0x0;this[_0xb0b6('0x55')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xb0b6('0x56')]=0x0;this[_0xb0b6('0x57')]=0x0;this[_0xb0b6('0x58')]=0x0;this[_0xb0b6('0x59')]=0x0;this[_0xb0b6('0x5a')]=0x0;this[_0xb0b6('0x5b')]=0x0;this[_0xb0b6('0x5c')]=0x0;this[_0xb0b6('0x5d')]=0x0;this[_0xb0b6('0x5e')]=0x0;this[_0xb0b6('0x5f')]=undefined;this['startPredictive']=undefined;this[_0xb0b6('0x60')]=undefined;this[_0xb0b6('0x61')]=1.05;this[_0xb0b6('0x62')]=0x0;this[_0xb0b6('0x63')]=0x0;this[_0xb0b6('0x64')]=0x0;this[_0xb0b6('0x65')]=0x0;this[_0xb0b6('0x66')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xb0b6('0x67')]=0x0;this[_0xb0b6('0x68')]=0x0;this[_0xb0b6('0x69')]=_0x42a469['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xb0b6('0x6a')]=_0x42a469[_0xb0b6('0x6b')]||0xa;this[_0xb0b6('0x6c')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xb0b6('0x6d')]=0x0;this[_0xb0b6('0x6e')]=0x0;this[_0xb0b6('0x6f')]=0x0;this['erlangBusyFactor']=0x0;this[_0xb0b6('0x70')]=_0x42a469[_0xb0b6('0x70')]||0x1e;this[_0xb0b6('0x71')]=_0x42a469[_0xb0b6('0x71')]||![];this[_0xb0b6('0x72')]=_0x42a469[_0xb0b6('0x72')]||undefined;this[_0xb0b6('0x73')]=_0x42a469[_0xb0b6('0x73')]||![];this[_0xb0b6('0x74')]=_0x42a469[_0xb0b6('0x74')]||![];this['monitor_format']=monitorFormat[_0x42a469['monitor_format']]?monitorFormat[_0x42a469['monitor_format']]:undefined;this[_0xb0b6('0x75')]=_0x42a469['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x42a469[_0xb0b6('0x76')]?_0x42a469['mandatoryDispositionPause']:undefined;}module[_0xb0b6('0x77')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index c0492de..5eec3ac 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 _0xbc17=['exports','name','username','remoteUri','serverUrl','Configurations'];(function(_0x1feb3b,_0x54f735){var _0x28b0a2=function(_0xdfe1d3){while(--_0xdfe1d3){_0x1feb3b['push'](_0x1feb3b['shift']());}};_0x28b0a2(++_0x54f735);}(_0xbc17,0x1ab));var _0x7bc1=function(_0x4f96b4,_0x22cc57){_0x4f96b4=_0x4f96b4-0x0;var _0x67821b=_0xbc17[_0x4f96b4];return _0x67821b;};'use strict';function VtigerAccount(_0x5525b0){this['id']=_0x5525b0['id']||0x0;this[_0x7bc1('0x0')]=_0x5525b0['name']||'';this[_0x7bc1('0x1')]=_0x5525b0[_0x7bc1('0x1')]||'';this['accessKey']=_0x5525b0['accessKey']||'';this[_0x7bc1('0x2')]=_0x5525b0[_0x7bc1('0x2')]||'';this['serverUrl']=_0x5525b0[_0x7bc1('0x3')]||'';this['Configurations']=_0x5525b0[_0x7bc1('0x4')]||{};}module[_0x7bc1('0x5')]=VtigerAccount; \ No newline at end of file +var _0x3de0=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x50a2bd,_0xbf1971){var _0x3b08f5=function(_0x140ea6){while(--_0x140ea6){_0x50a2bd['push'](_0x50a2bd['shift']());}};_0x3b08f5(++_0xbf1971);}(_0x3de0,0x1ef));var _0x03de=function(_0x33805b,_0x3a256b){_0x33805b=_0x33805b-0x0;var _0x500d01=_0x3de0[_0x33805b];return _0x500d01;};'use strict';function VtigerAccount(_0x17845e){this['id']=_0x17845e['id']||0x0;this[_0x03de('0x0')]=_0x17845e[_0x03de('0x0')]||'';this[_0x03de('0x1')]=_0x17845e[_0x03de('0x1')]||'';this[_0x03de('0x2')]=_0x17845e['accessKey']||'';this[_0x03de('0x3')]=_0x17845e[_0x03de('0x3')]||'';this['serverUrl']=_0x17845e[_0x03de('0x4')]||'';this[_0x03de('0x5')]=_0x17845e[_0x03de('0x5')]||{};}module[_0x03de('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 f77acb6..e026951 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 _0x2032=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','name','username','password'];(function(_0x18884c,_0x45b7ad){var _0x1b2b78=function(_0x3b710a){while(--_0x3b710a){_0x18884c['push'](_0x18884c['shift']());}};_0x1b2b78(++_0x45b7ad);}(_0x2032,0xd9));var _0x2203=function(_0x32bf82,_0x5cbbdc){_0x32bf82=_0x32bf82-0x0;var _0x40f8b9=_0x2032[_0x32bf82];return _0x40f8b9;};'use strict';function ZendeskAccount(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['username']||'';this[_0x2203('0x2')]=_0x4d6c97[_0x2203('0x2')]||'';this['token']=_0x4d6c97[_0x2203('0x3')]||'';this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||'';this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||'';this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||_0x2203('0x7');this[_0x2203('0x8')]=_0x4d6c97[_0x2203('0x8')]||'';this[_0x2203('0x9')]=_0x4d6c97['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x5f66=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x99b8f0,_0x6c6efd){var _0x18e939=function(_0x34f44a){while(--_0x34f44a){_0x99b8f0['push'](_0x99b8f0['shift']());}};_0x18e939(++_0x6c6efd);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';function ZendeskAccount(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||'';this[_0x65f6('0x2')]=_0x253044[_0x65f6('0x2')]||'';this[_0x65f6('0x3')]=_0x253044['token']||'';this[_0x65f6('0x4')]=_0x253044['remoteUri']||'';this[_0x65f6('0x5')]=_0x253044[_0x65f6('0x5')]||'';this['type']=_0x253044['type']||_0x65f6('0x6');this[_0x65f6('0x7')]=_0x253044[_0x65f6('0x7')]||'';this[_0x65f6('0x8')]=_0x253044[_0x65f6('0x8')]||{};}module[_0x65f6('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index fcdb148..ca3160b 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 _0x7af9=['clientId','serverUrl','code','refreshToken','Configurations','name','description','host','zone'];(function(_0x534ce8,_0x2f809a){var _0x2e42cd=function(_0xbd8beb){while(--_0xbd8beb){_0x534ce8['push'](_0x534ce8['shift']());}};_0x2e42cd(++_0x2f809a);}(_0x7af9,0x95));var _0x97af=function(_0x188a9b,_0x323f7b){_0x188a9b=_0x188a9b-0x0;var _0x248d21=_0x7af9[_0x188a9b];return _0x248d21;};'use strict';function ZohoAccount(_0x524dbe){this['id']=_0x524dbe['id']||0x0;this['name']=_0x524dbe[_0x97af('0x0')]||'';this[_0x97af('0x1')]=_0x524dbe['description']||'';this[_0x97af('0x2')]=_0x524dbe[_0x97af('0x2')]||'';this[_0x97af('0x3')]=_0x524dbe[_0x97af('0x3')]||'';this[_0x97af('0x4')]=_0x524dbe['clientId']||'';this['clientSecret']=_0x524dbe['clientSecret']||'';this[_0x97af('0x5')]=_0x524dbe[_0x97af('0x5')]||'';this[_0x97af('0x6')]=_0x524dbe[_0x97af('0x6')]||'';this['refreshToken']=_0x524dbe[_0x97af('0x7')]||'';this[_0x97af('0x8')]=_0x524dbe[_0x97af('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0xae1b=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x347cb4,_0x3d335a){var _0x5a1236=function(_0x3f5b25){while(--_0x3f5b25){_0x347cb4['push'](_0x347cb4['shift']());}};_0x5a1236(++_0x3d335a);}(_0xae1b,0x96));var _0xbae1=function(_0x56dda8,_0x19b495){_0x56dda8=_0x56dda8-0x0;var _0x39aa50=_0xae1b[_0x56dda8];return _0x39aa50;};'use strict';function ZohoAccount(_0x4b0f62){this['id']=_0x4b0f62['id']||0x0;this[_0xbae1('0x0')]=_0x4b0f62['name']||'';this[_0xbae1('0x1')]=_0x4b0f62[_0xbae1('0x1')]||'';this[_0xbae1('0x2')]=_0x4b0f62[_0xbae1('0x2')]||'';this[_0xbae1('0x3')]=_0x4b0f62[_0xbae1('0x3')]||'';this['clientId']=_0x4b0f62[_0xbae1('0x4')]||'';this[_0xbae1('0x5')]=_0x4b0f62['clientSecret']||'';this[_0xbae1('0x6')]=_0x4b0f62['serverUrl']||'';this[_0xbae1('0x7')]=_0x4b0f62['code']||'';this[_0xbae1('0x8')]=_0x4b0f62[_0xbae1('0x8')]||'';this['Configurations']=_0x4b0f62[_0xbae1('0x9')]||{};}module[_0xbae1('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 9c3bc89..4458c8c 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 _0x00f1=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','getCaller','number','exports','util','lodash','moment','isNil','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','callback'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x00f1,0x8f));var _0x100f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x00f1[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x100f('0x0'));var _=require(_0x100f('0x1'));var moment=require(_0x100f('0x2'));function checkNameSurname(_0x68fa77,_0x3c1f90,_0x23350d){var _0x5af0ad='';if(!_[_0x100f('0x3')](_0x3c1f90)&&'string'===typeof _0x3c1f90){_0x5af0ad+=_0x3c1f90;}if(!_[_0x100f('0x3')](_0x23350d)&&'string'===typeof _0x23350d){_0x5af0ad+='\x20'+_0x23350d;}if(_0x5af0ad!==''){return _0x5af0ad;}return _0x68fa77;}function Action(_0x4902c8,_0x591288,_0x19b423,_0x129c67,_0x3bc9cf){this[_0x100f('0x4')]=_0x19b423||undefined;this[_0x100f('0x5')]=_0x4902c8['id'];this[_0x100f('0x6')]=_0x591288[_0x100f('0x7')];this[_0x100f('0x8')]=_0x591288[_0x100f('0x8')];this[_0x100f('0x9')]=_0x100f('0x6');this[_0x100f('0xa')]=![];this[_0x100f('0xb')]=_['isNil'](_0x4902c8[_0x100f('0xc')])?undefined:_0x4902c8['Agent'][_0x100f('0x7')];this[_0x100f('0xd')]=this[_0x100f('0xb')]?util[_0x100f('0xe')](_0x100f('0xf'),this[_0x100f('0xb')]):_0x129c67||undefined;this[_0x100f('0x10')]=checkNameSurname(_0x4902c8[_0x100f('0x11')][_0x100f('0x12')],_0x4902c8[_0x100f('0x11')][_0x100f('0x13')],_0x4902c8[_0x100f('0x11')][_0x100f('0x14')]);this[_0x100f('0x15')]=_0x4902c8[_0x100f('0x15')]||![];this['calleridnum']=_0x4902c8[_0x100f('0x11')][_0x100f('0x12')];this['scheduledat']=_0x4902c8[_0x100f('0x16')];this[_0x100f('0x17')]=_0x4902c8['countbusyretry']||0x0;this[_0x100f('0x18')]=_0x4902c8[_0x100f('0x18')]||0x0;this[_0x100f('0x19')]=_0x4902c8[_0x100f('0x19')]||0x0;this[_0x100f('0x1a')]=(_0x4902c8['countbusyretry']||0x0)+(_0x4902c8[_0x100f('0x18')]||0x0)+(_0x4902c8['countnoanswerretry']||0x0)+(_0x4902c8[_0x100f('0x1b')]||0x0)+(_0x4902c8['countdropretry']||0x0)+(_0x4902c8[_0x100f('0x1c')]||0x0)+(_0x4902c8['countmachineretry']||0x0)+(_0x4902c8[_0x100f('0x1d')]||0x0);this[_0x100f('0x1b')]=_0x4902c8[_0x100f('0x1b')]||0x0;this[_0x100f('0x1e')]=_0x4902c8[_0x100f('0x1e')]||0x0;this[_0x100f('0x1c')]=_0x4902c8[_0x100f('0x1c')]||0x0;this['countmachineretry']=_0x4902c8[_0x100f('0x1f')]||0x0;this[_0x100f('0x1d')]=_0x4902c8['countagentrejectretry']||0x0;this['callback']=_0x4902c8[_0x100f('0x20')];this[_0x100f('0x21')]=_0x4902c8[_0x100f('0x21')];this[_0x100f('0x22')]=_0x4902c8[_0x100f('0x22')];this['recallme']=_0x4902c8[_0x100f('0x23')];this['ContactId']=_0x4902c8[_0x100f('0x24')];this[_0x100f('0x25')]=_0x4902c8[_0x100f('0x25')];this[_0x100f('0x26')]=_['isNil'](_0x4902c8[_0x100f('0xc')])?_0x4902c8[_0x100f('0x26')]:_0x4902c8[_0x100f('0xc')]['id'];this[_0x100f('0x27')]=_0x4902c8[_0x100f('0x27')];this['originatecalleridnum']='';this[_0x100f('0x28')]='';}Action['prototype'][_0x100f('0x29')]=function(){return util['format']('\x22%s\x22\x20<%s>',this['calleridname'],this[_0x100f('0x2a')]);};module[_0x100f('0x2b')]=Action; \ No newline at end of file +var _0xa652=['isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','channelAgent','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','calleridname','exports','util','lodash','moment'];(function(_0x27b4c7,_0xd847e6){var _0x3000b9=function(_0x57ef4b){while(--_0x57ef4b){_0x27b4c7['push'](_0x27b4c7['shift']());}};_0x3000b9(++_0xd847e6);}(_0xa652,0x138));var _0x2a65=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa652[_0x297fd3];return _0x2af381;};'use strict';var util=require(_0x2a65('0x0'));var _=require(_0x2a65('0x1'));var moment=require(_0x2a65('0x2'));function checkNameSurname(_0x3e6f23,_0x3c073f,_0x4953ba){var _0x12dfab='';if(!_[_0x2a65('0x3')](_0x3c073f)&&'string'===typeof _0x3c073f){_0x12dfab+=_0x3c073f;}if(!_['isNil'](_0x4953ba)&&_0x2a65('0x4')===typeof _0x4953ba){_0x12dfab+='\x20'+_0x4953ba;}if(_0x12dfab!==''){return _0x12dfab;}return _0x3e6f23;}function Action(_0xb30dd3,_0x5528d,_0x2f73ba,_0x4be68f,_0x975aa4){this[_0x2a65('0x5')]=_0x2f73ba||undefined;this[_0x2a65('0x6')]=_0xb30dd3['id'];this[_0x2a65('0x7')]=_0x5528d[_0x2a65('0x8')];this[_0x2a65('0x9')]=_0x5528d[_0x2a65('0x9')];this[_0x2a65('0xa')]=_0x2a65('0x7');this['dialAnswer']=![];this[_0x2a65('0xb')]=_[_0x2a65('0x3')](_0xb30dd3[_0x2a65('0xc')])?undefined:_0xb30dd3[_0x2a65('0xc')][_0x2a65('0x8')];this[_0x2a65('0xd')]=this[_0x2a65('0xb')]?util[_0x2a65('0xe')](_0x2a65('0xf'),this['membername']):_0x4be68f||undefined;this['calleridname']=checkNameSurname(_0xb30dd3[_0x2a65('0x10')][_0x2a65('0x11')],_0xb30dd3['Contact'][_0x2a65('0x12')],_0xb30dd3['Contact'][_0x2a65('0x13')]);this[_0x2a65('0x14')]=_0xb30dd3['active']||![];this[_0x2a65('0x15')]=_0xb30dd3[_0x2a65('0x10')][_0x2a65('0x11')];this[_0x2a65('0x16')]=_0xb30dd3['scheduledat'];this[_0x2a65('0x17')]=_0xb30dd3[_0x2a65('0x17')]||0x0;this['countcongestionretry']=_0xb30dd3[_0x2a65('0x18')]||0x0;this[_0x2a65('0x19')]=_0xb30dd3['countnoanswerretry']||0x0;this[_0x2a65('0x1a')]=(_0xb30dd3['countbusyretry']||0x0)+(_0xb30dd3[_0x2a65('0x18')]||0x0)+(_0xb30dd3['countnoanswerretry']||0x0)+(_0xb30dd3[_0x2a65('0x1b')]||0x0)+(_0xb30dd3['countdropretry']||0x0)+(_0xb30dd3[_0x2a65('0x1c')]||0x0)+(_0xb30dd3[_0x2a65('0x1d')]||0x0)+(_0xb30dd3[_0x2a65('0x1e')]||0x0);this[_0x2a65('0x1b')]=_0xb30dd3[_0x2a65('0x1b')]||0x0;this[_0x2a65('0x1f')]=_0xb30dd3[_0x2a65('0x1f')]||0x0;this['countabandonedretry']=_0xb30dd3[_0x2a65('0x1c')]||0x0;this[_0x2a65('0x1d')]=_0xb30dd3[_0x2a65('0x1d')]||0x0;this['countagentrejectretry']=_0xb30dd3[_0x2a65('0x1e')]||0x0;this[_0x2a65('0x20')]=_0xb30dd3['callback'];this[_0x2a65('0x21')]=_0xb30dd3[_0x2a65('0x21')];this['callbackat']=_0xb30dd3['callbackat'];this[_0x2a65('0x22')]=_0xb30dd3[_0x2a65('0x22')];this['ContactId']=_0xb30dd3[_0x2a65('0x23')];this[_0x2a65('0x24')]=_0xb30dd3['ListId'];this[_0x2a65('0x25')]=_[_0x2a65('0x3')](_0xb30dd3['Agent'])?_0xb30dd3[_0x2a65('0x25')]:_0xb30dd3['Agent']['id'];this[_0x2a65('0x26')]=_0xb30dd3[_0x2a65('0x26')];this[_0x2a65('0x27')]='';this[_0x2a65('0x28')]='';}Action['prototype'][_0x2a65('0x29')]=function(){return util[_0x2a65('0xe')](_0x2a65('0x2a'),this[_0x2a65('0x2b')],this['number']);};module[_0x2a65('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 0b27ecd..2267fce 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 _0xe706=['uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','connect','acw','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','sumBillable','talktime','BUSY','outboundBusyCallsDay','countglobal','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','scheduledAt','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','[default]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','starttime','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','logLookAgent','responsetime','isFailure','response','idContact','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','destuniqueid','dialstatus','variables','filterKey','keys','addVariable','variable','value','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','bind','hanguprequest','syncDialEnd','syncVarSet','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','strategy','answered','available','pTalking','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','name','stringify','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','sendMessageOneNotActive','originated','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','syncCampaigns','clockClearZombieChannels','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','status','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','size','hasOwnProperty','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','logger2','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','[syncHangup][talking][increment]'];(function(_0x1a3ca2,_0xe144e7){var _0x30ea08=function(_0x37a9f6){while(--_0x37a9f6){_0x1a3ca2['push'](_0x1a3ca2['shift']());}};_0x30ea08(++_0xe144e7);}(_0xe706,0xa3));var _0x6e70=function(_0x4e752e,_0x479543){_0x4e752e=_0x4e752e-0x0;var _0x2392b0=_0xe706[_0x4e752e];return _0x2392b0;};'use strict';var util=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var uuid=require('uuid');var moment=require(_0x6e70('0x3'));var md5=require(_0x6e70('0x4'));var Redis=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var loggerAction=require(_0x6e70('0x7'))(_0x6e70('0x9'));var ami=require(_0x6e70('0xa'));var rpcDb=require(_0x6e70('0xb'));var Action=require(_0x6e70('0xc'));var ut=require(_0x6e70('0xd'));config[_0x6e70('0xe')]=_[_0x6e70('0xf')](config[_0x6e70('0xe')],{'host':_0x6e70('0x10'),'port':0x18eb});var io=require(_0x6e70('0x11'))(new Redis(config[_0x6e70('0xe')]));var Sequence=function(){};Sequence[_0x6e70('0x12')][_0x6e70('0x13')]=function(_0x743eb5){this[_0x6e70('0x14')]=this[_0x6e70('0x14')]?this[_0x6e70('0x14')]['finally'](_0x743eb5):_0x743eb5();};function Preview(_0x47f6b2){this[_0x6e70('0x15')]=new Sequence();this[_0x6e70('0x16')]=_0x47f6b2[_0x6e70('0x17')];this[_0x6e70('0x18')]=_0x47f6b2[_0x6e70('0x18')];this[_0x6e70('0x19')]={};this[_0x6e70('0x1a')]=_0x47f6b2[_0x6e70('0x1a')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x6e70('0x1b')](this));ami['on']('hangup',this['syncHangup'][_0x6e70('0x1b')](this));ami['on'](_0x6e70('0x1c'),this['syncHangupRequest'][_0x6e70('0x1b')](this));ami['on']('dialend',this[_0x6e70('0x1d')][_0x6e70('0x1b')](this));ami['on']('newexten',this['syncNewExten'][_0x6e70('0x1b')](this));ami['on']('varset',this[_0x6e70('0x1e')][_0x6e70('0x1b')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x6e70('0x1b')](this));ami['on'](_0x6e70('0x1f'),this[_0x6e70('0x20')][_0x6e70('0x1b')](this));this[_0x6e70('0x21')](this[_0x6e70('0x16')]);}function emit(_0x1b2453,_0x44a49f,_0x29326f){io['to'](_0x1b2453)[_0x6e70('0x22')](_0x44a49f,_0x29326f);}function emitCampaignPreview(_0x4a0cfe){if(_0x4a0cfe[_0x6e70('0x23')]===_0x6e70('0x24')){var _0x27b294={'id':_0x4a0cfe['id'],'name':_0x4a0cfe['name'],'strategy':_0x4a0cfe[_0x6e70('0x25')],'answered':_0x4a0cfe[_0x6e70('0x26')],'available':_0x4a0cfe[_0x6e70('0x27')],'loggedIn':_0x4a0cfe['loggedIn'],'pTalking':_0x4a0cfe[_0x6e70('0x28')],'sumBillable':_0x4a0cfe['sumBillable'],'sumDuration':_0x4a0cfe['sumDuration'],'sumHoldTime':_0x4a0cfe['sumHoldTime']||0x0,'talking':_0x4a0cfe[_0x6e70('0x29')],'total':_0x4a0cfe[_0x6e70('0x2a')],'type':_0x4a0cfe['type'],'unmanaged':_0x4a0cfe[_0x6e70('0x2b')],'abandoned':_0x4a0cfe[_0x6e70('0x2c')],'waiting':_0x4a0cfe['waiting'],'loggedInDb':_0x4a0cfe[_0x6e70('0x2d')],'dialActive':_0x4a0cfe[_0x6e70('0x2e')],'dialMethod':_0x4a0cfe[_0x6e70('0x2f')],'dialOriginateCallerIdName':_0x4a0cfe['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4a0cfe['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x4a0cfe[_0x6e70('0x30')],'dialPrefix':_0x4a0cfe[_0x6e70('0x31')],'outboundAnswerAgiCallsDay':_0x4a0cfe[_0x6e70('0x32')],'outboundAnswerCallsDay':_0x4a0cfe[_0x6e70('0x33')],'outboundBlacklistCallsDay':_0x4a0cfe[_0x6e70('0x34')],'outboundBusyCallsDay':_0x4a0cfe['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4a0cfe[_0x6e70('0x35')],'outboundDropCallsDayACS':_0x4a0cfe[_0x6e70('0x36')],'outboundDropCallsDayCallersExit':_0x4a0cfe[_0x6e70('0x37')],'outboundDropCallsDayTimeout':_0x4a0cfe[_0x6e70('0x38')],'outboundNoAnswerCallsDay':_0x4a0cfe[_0x6e70('0x39')],'outboundNoSuchCallsDay':_0x4a0cfe[_0x6e70('0x3a')],'outboundOriginateFailureCallsDay':_0x4a0cfe[_0x6e70('0x3b')],'outboundReCallsDay':_0x4a0cfe[_0x6e70('0x3c')],'outboundRejectCallsDay':_0x4a0cfe[_0x6e70('0x3d')],'outboundUnknownCallsDay':_0x4a0cfe[_0x6e70('0x3e')],'outboundAbandonedCallsDay':_0x4a0cfe['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x4a0cfe[_0x6e70('0x3f')],'predictiveIntervalAvgHoldtime':_0x4a0cfe['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x4a0cfe[_0x6e70('0x40')],'predictiveIntervalDroppedCallsCallersExit':_0x4a0cfe['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4a0cfe[_0x6e70('0x41')],'predictiveIntervalErlangCalls':_0x4a0cfe[_0x6e70('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x4a0cfe[_0x6e70('0x43')],'predictiveIntervalHitRate':_0x4a0cfe['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x4a0cfe[_0x6e70('0x44')],'predictiveIntervalPauses':_0x4a0cfe[_0x6e70('0x45')],'predictiveIntervalAvailable':_0x4a0cfe['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x4a0cfe[_0x6e70('0x46')],'message':_0x4a0cfe[_0x6e70('0x47')],'originated':_0x4a0cfe['originated'],'erlangCalls':_0x4a0cfe[_0x6e70('0x48')],'erlangCallToSecond':_0x4a0cfe[_0x6e70('0x49')],'erlangAbandonmentRate':_0x4a0cfe[_0x6e70('0x4a')],'erlangBusyFactor':_0x4a0cfe[_0x6e70('0x4b')],'startPredictive':_0x4a0cfe[_0x6e70('0x4c')],'startProgressive':_0x4a0cfe[_0x6e70('0x4d')]};if(_0x4a0cfe[_0x6e70('0x4e')]){_0x27b294[_0x6e70('0x4e')]={'id':_0x4a0cfe[_0x6e70('0x4e')]['id'],'name':_0x4a0cfe[_0x6e70('0x4e')]['name'],'active':_0x4a0cfe[_0x6e70('0x4e')]['active'],'callerid':_0x4a0cfe[_0x6e70('0x4e')][_0x6e70('0x4f')]};}if(_0x4a0cfe[_0x6e70('0x50')]){_0x27b294[_0x6e70('0x50')]={'id':_0x4a0cfe[_0x6e70('0x50')]['id'],'name':_0x4a0cfe[_0x6e70('0x50')][_0x6e70('0x51')]};}var _0xdd0bee=md5(JSON[_0x6e70('0x52')](_0x27b294));if(_0x4a0cfe[_0x6e70('0x4')]!==_0xdd0bee){_0x4a0cfe[_0x6e70('0x4')]=_0xdd0bee;emit(util[_0x6e70('0x53')](_0x6e70('0x54'),_0x27b294['name']),'voice_queue:save',_0x27b294);}}}function emitVoiceQueueChannelRemove(_0x5424eb){logger[_0x6e70('0x55')](_0x6e70('0x56'),JSON[_0x6e70('0x52')](_0x5424eb));emit(util[_0x6e70('0x53')](_0x6e70('0x54'),_0x5424eb[_0x6e70('0x51')]),'voice_queue_channel:remove',_0x5424eb);}function notSendMessagesQueue(_0x3b508c){if(_0x3b508c[_0x6e70('0x57')]){if(_0x3b508c[_0x6e70('0x58')]===0x0&&_0x3b508c[_0x6e70('0x28')]===0x0){_0x3b508c[_0x6e70('0x57')]=![];_0x3b508c[_0x6e70('0x27')]=0x0;_0x3b508c[_0x6e70('0x59')]=0x0;_0x3b508c[_0x6e70('0x47')]='NOT_ACTIVE';ut[_0x6e70('0x5a')](_0x6e70('0x5b'),_0x3b508c[_0x6e70('0x51')]+_0x6e70('0x5c'));}else{_0x3b508c[_0x6e70('0x47')]=_0x6e70('0x5d');ut[_0x6e70('0x5a')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3b508c['name']+'\x20is\x20disactive');}emitCampaignPreview(_0x3b508c);}}Preview[_0x6e70('0x12')][_0x6e70('0x21')]=function(){var _0x83847b=this;setInterval(function(){_0x83847b[_0x6e70('0x5e')]();},0x7cf);};Preview[_0x6e70('0x12')]['syncCampaigns']=function(){var _0x225d44=this[_0x6e70('0x16')];this[_0x6e70('0x5f')]+=0x1;for(var _0x52b197 in _0x225d44){if(_0x225d44['hasOwnProperty'](_0x52b197)&&(_0x225d44[_0x52b197]['dialMethod']===_0x6e70('0x8')||_0x225d44[_0x52b197]['dialMethod']===_0x6e70('0x60'))&&_0x225d44[_0x52b197][_0x6e70('0x23')]===_0x6e70('0x24')){if(this[_0x6e70('0x5f')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x6e70('0x61')]();}}if(_0x225d44['hasOwnProperty'](_0x52b197)&&_0x225d44[_0x52b197][_0x6e70('0x2f')]===_0x6e70('0x8')&&_0x225d44[_0x52b197][_0x6e70('0x23')]===_0x6e70('0x24')){if(_0x225d44[_0x52b197]['dialActive']){this[_0x6e70('0x62')](_0x225d44[_0x52b197]);this[_0x6e70('0x63')](_0x225d44[_0x52b197]);}else{notSendMessagesQueue(_0x225d44[_0x52b197]);}}}};Preview[_0x6e70('0x12')][_0x6e70('0x64')]=function(_0x8f243d){var _0x3fcb2d=this;this[_0x6e70('0x15')]['enqueue'](function(){if(!_[_0x6e70('0x65')](_0x3fcb2d[_0x6e70('0x19')][_0x8f243d])){loggerAction[_0x6e70('0x55')](_0x6e70('0x66'),_0x8f243d,_0x6e70('0x67'),_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')],'originated:\x20',JSON[_0x6e70('0x52')](_0x3fcb2d['campaignsPreview'][_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')]]['originated']),'pTalking:\x20',JSON[_0x6e70('0x52')](_0x3fcb2d[_0x6e70('0x16')][_0x3fcb2d[_0x6e70('0x19')][_0x8f243d]['queue']]['pTalking']),JSON[_0x6e70('0x52')](_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x69')]),JSON[_0x6e70('0x52')](_[_0x6e70('0x6a')](_0x3fcb2d[_0x6e70('0x19')][_0x8f243d],['contactId',_0x6e70('0x6b'),_0x6e70('0x6c'),_0x6e70('0x6d')])));return ami[_0x6e70('0x6e')]({'action':_0x6e70('0x6f'),'channel':_0x3fcb2d['actions'][_0x8f243d]['channel']})[_0x6e70('0x70')](function(_0x2e3ea6){if(_0x2e3ea6[_0x6e70('0x47')]===_0x6e70('0x71')){setTimeout(function(){if(_0x3fcb2d[_0x6e70('0x19')][_0x8f243d]){ut['updateOriginated'](_0x3fcb2d[_0x6e70('0x16')][_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')]],_0x6e70('0x72'));if(_0x3fcb2d[_0x6e70('0x19')][_0x8f243d]['dialAnswer']===!![]){ut[_0x6e70('0x73')](_0x3fcb2d[_0x6e70('0x16')][_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')]],_0x6e70('0x72'));ut[_0x6e70('0x74')]('[Dialer][checkChannel][pTalking][Preview]'+_0x8f243d,_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')]);}ut['loggerError'](_0x6e70('0x75')+_0x8f243d,_0x3fcb2d[_0x6e70('0x19')][_0x8f243d]['queue']);delete _0x3fcb2d[_0x6e70('0x19')][_0x8f243d];}},0x2328);}});}});};Preview[_0x6e70('0x12')][_0x6e70('0x61')]=function(){var _0x46d536=this;loggerAction[_0x6e70('0x55')]('[action]',_[_0x6e70('0x76')](this[_0x6e70('0x19')]));for(var _0x10d655 in this[_0x6e70('0x19')]){if(_0x46d536[_0x6e70('0x19')][_0x6e70('0x77')](_0x10d655)){_0x46d536[_0x6e70('0x64')](_0x10d655);}}};Preview[_0x6e70('0x12')][_0x6e70('0x63')]=function(_0x344676){var _0x13dd17=this;rpcDb[_0x6e70('0x78')](_0x344676['id'],ut[_0x6e70('0x79')](this[_0x6e70('0x1a')]))[_0x6e70('0x7a')](function(_0x2240a1){if(!_[_0x6e70('0x65')](_0x2240a1)){for(var _0x4329a6=0x0;_0x4329a6<_0x2240a1[_0x6e70('0x7b')];_0x4329a6+=0x1){if(ut[_0x6e70('0x7c')](_0x2240a1[_0x4329a6]['scheduledat'])<_0x344676[_0x6e70('0x7d')]*0x3c){if(_0x2240a1[_0x4329a6][_0x6e70('0x7e')]&&!_0x2240a1[_0x4329a6][_0x6e70('0x7e')][_0x6e70('0x7f')]){_0x13dd17[_0x6e70('0x80')](_0x2240a1[_0x4329a6]['id'])[_0x6e70('0x7a')](ut['logger2'](_0x6e70('0x81')))[_0x6e70('0x70')](ut['logger2'](_0x6e70('0x81')));}else{rpcDb[_0x6e70('0x82')](_0x2240a1[_0x4329a6]['id']);}}else{var _0x459a30=new Action(_0x2240a1[_0x4329a6],_0x344676);_0x459a30['starttime']=moment()['format'](_0x6e70('0x83'));_0x344676[_0x6e70('0x3c')]+=0x1;ut[_0x6e70('0x84')](_0x459a30,0x17,_0x6e70('0x85'));if(_0x344676[_0x6e70('0x86')]){rpcDb[_0x6e70('0x87')](ut[_0x6e70('0x88')](_0x2240a1[_0x4329a6]));rpcDb['createCustomerHistory'](_0x459a30,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x6e70('0x84')](_0x459a30,0x16,_0x6e70('0x89'));rpcDb[_0x6e70('0x8a')](_0x459a30,_0x6e70('0x8b'));rpcDb['createCustomerFinal'](_0x459a30,'[HistoryRecallClose]');}}}}})[_0x6e70('0x70')](ut[_0x6e70('0x8c')]('[getContactRecallMe]'));};Preview['prototype'][_0x6e70('0x62')]=function(_0x47fbed){_0x47fbed[_0x6e70('0x57')]=!![];if(ut[_0x6e70('0x8d')](_0x47fbed[_0x6e70('0x8e')])){_0x47fbed[_0x6e70('0x47')]=_0x6e70('0x8f');}else if(!ut[_0x6e70('0x90')](_0x47fbed[_0x6e70('0x2e')])){_0x47fbed[_0x6e70('0x47')]='NOT_ACTIVE';}else if(!this[_0x6e70('0x91')](_0x47fbed[_0x6e70('0x4e')])){if(!this[_0x6e70('0x91')](_0x47fbed[_0x6e70('0x92')])){_0x47fbed[_0x6e70('0x47')]='TRUNK_IS_NOT_REACHABLE';}else{_0x47fbed['message']='ACTIVE';}}else{_0x47fbed[_0x6e70('0x47')]=_0x6e70('0x93');}emitCampaignPreview(_0x47fbed);};Preview[_0x6e70('0x12')]['callProgressDetectingCustomer']=function(_0x58cf1c,_0x2fc2a2,_0x3dae08){var _0x3c2830=this;var _0x195166=this[_0x6e70('0x19')][_0x2fc2a2];var _0x32b884=this['campaignsPreview'][_0x195166[_0x6e70('0x68')]];var _0x3f5896;if(_0x32b884){switch(_0x3dae08){case'1':_0x32b884[_0x6e70('0x3a')]+=0x1;_0x195166[_0x6e70('0x94')]+=0x1;_0x195166['countglobal']=ut[_0x6e70('0x95')](_0x195166);ut['logCustomer'](_0x195166,0x0,'NoSuchNumber');ami[_0x6e70('0x22')](_0x6e70('0x96'),ut[_0x6e70('0x97')](_0x195166,_0x6e70('0x98')));rpcDb[_0x6e70('0x8a')](_0x195166,_0x6e70('0x99'));if(ut['totalGlobal'](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0x9e'));}else{if(_0x195166[_0x6e70('0x94')]>=_0x32b884[_0x6e70('0x9f')]){rpcDb[_0x6e70('0x9d')](_0x195166,_0x6e70('0x9e'));}else{rpcDb[_0x6e70('0xa0')](ut['scheduledAt'](_0x195166,_0x6e70('0x94'),_0x32b884[_0x6e70('0xa1')]),_0x195166[_0x6e70('0xa2')],_0x195166['activeContact']);}}delete this['actions'][_0x58cf1c[_0x6e70('0xa3')]];break;case _0x6e70('0xa4'):var _0x25e685=moment()[_0x6e70('0x53')](_0x6e70('0x83'));_0x195166['responsetime']=_0x25e685;_0x195166['answertime']=_0x25e685;_0x195166[_0x6e70('0x69')]=!![];_0x32b884[_0x6e70('0x28')]+=0x1;logger['info'](_0x6e70('0xa5'),_0x195166[_0x6e70('0xa6')],_0x6e70('0xa7'),_0x32b884[_0x6e70('0x51')],_0x6e70('0xa8'),_0x32b884[_0x6e70('0x28')]);ami[_0x6e70('0x22')](_0x6e70('0xa9'),ut[_0x6e70('0x97')](_0x195166,_0x6e70('0xaa'),this[_0x6e70('0x16')][_0x195166[_0x6e70('0x68')]]));if(_0x32b884[_0x6e70('0xab')]){ami[_0x6e70('0x22')]('custom:agentConnectPreview',ut['buildAcw'](_0x195166));}break;case'16':ami[_0x6e70('0x22')]('custom:agentcomplete',ut[_0x6e70('0x97')](_0x195166,'complete',this['campaignsPreview'][_0x195166[_0x6e70('0x68')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x195166,'complete'));_0x32b884[_0x6e70('0x33')]+=0x1;_0x32b884[_0x6e70('0x2a')]+=0x1;_0x32b884[_0x6e70('0x26')]+=0x1;ut['decrementTalkink'](_0x32b884,'[16]');_0x195166['countglobal']=ut[_0x6e70('0x95')](_0x195166);ut['logCustomer'](_0x195166,0x4,_0x6e70('0xac'));rpcDb[_0x6e70('0x8a')](_0x195166,_0x6e70('0xad'));rpcDb[_0x6e70('0x9d')](_0x195166,_0x6e70('0xae'));rpcDb[_0x6e70('0xaf')](_0x195166);_0x32b884[_0x6e70('0xb0')]+=_0x195166['talktime'];_0x32b884[_0x6e70('0xb1')]+=_0x195166[_0x6e70('0xb2')];logger[_0x6e70('0x55')]('[syncHangup][talking][decrement]',_0x195166[_0x6e70('0xa6')],_0x6e70('0xa7'),_0x32b884[_0x6e70('0x51')],_0x6e70('0xa8'),_0x32b884[_0x6e70('0x28')]);delete this[_0x6e70('0x19')][_0x58cf1c[_0x6e70('0xa3')]];break;case _0x6e70('0xb3'):_0x32b884[_0x6e70('0xb4')]+=0x1;_0x195166['countbusyretry']+=0x1;_0x195166[_0x6e70('0xb5')]=ut[_0x6e70('0x95')](_0x195166);ut['logCustomer'](_0x195166,0x5,_0x6e70('0xb6'));ami[_0x6e70('0x22')]('custom:agentbusy',ut['buildObj'](_0x195166,_0x6e70('0xb7')));rpcDb['createCustomerHistory'](_0x195166,_0x6e70('0xb8'));if(ut['totalGlobal'](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xb9'));}else{if(_0x195166[_0x6e70('0xba')]>=_0x32b884[_0x6e70('0xbb')]){rpcDb['createCustomerFinal'](_0x195166,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x6e70('0xa0')](ut['scheduledAt'](_0x195166,_0x6e70('0xba'),_0x32b884[_0x6e70('0xbc')]),_0x195166[_0x6e70('0xa2')],_0x195166[_0x6e70('0xbd')]);}}break;case'NOANSWER':_0x32b884[_0x6e70('0x39')]+=0x1;_0x195166['countnoanswerretry']+=0x1;_0x195166[_0x6e70('0xb5')]=ut[_0x6e70('0x95')](_0x195166);ut[_0x6e70('0x84')](_0x195166,0x3,_0x6e70('0xbe'));ami[_0x6e70('0x22')](_0x6e70('0xbf'),ut[_0x6e70('0x97')](_0x195166,'noanswer'));rpcDb[_0x6e70('0x8a')](_0x195166,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884['dialGlobalMaxRetry']){_0x3f5896=ut['cloneAction'](_0x195166,0xf,'Global');rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xc0'));}else{if(_0x195166[_0x6e70('0xc1')]>=_0x32b884[_0x6e70('0xc2')]){rpcDb[_0x6e70('0x9d')](_0x195166,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x6e70('0xa0')](ut[_0x6e70('0xc3')](_0x195166,'countnoanswerretry',_0x32b884[_0x6e70('0xc4')]),_0x195166['unlockAgent'],_0x195166[_0x6e70('0xbd')]);}}break;case'CONGESTION':_0x32b884['outboundCongestionCallsDay']+=0x1;_0x195166[_0x6e70('0xc5')]+=0x1;_0x195166[_0x6e70('0xb5')]=ut[_0x6e70('0x95')](_0x195166);ut[_0x6e70('0x84')](_0x195166,0x8,_0x6e70('0xc6'));ami[_0x6e70('0x22')](_0x6e70('0xc7'),ut['buildObj'](_0x195166,_0x6e70('0xc8')));rpcDb['createCustomerHistory'](_0x195166,_0x6e70('0xc9'));if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xca'));}else{if(_0x195166['countcongestionretry']>=_0x32b884[_0x6e70('0xcb')]){rpcDb['createCustomerFinal'](_0x195166,_0x6e70('0xc9'));}else{rpcDb[_0x6e70('0xa0')](ut[_0x6e70('0xc3')](_0x195166,_0x6e70('0xc5'),_0x32b884[_0x6e70('0xbc')]),_0x195166[_0x6e70('0xa2')],_0x195166[_0x6e70('0xbd')]);}}break;case _0x6e70('0xcc'):_0x32b884[_0x6e70('0x3d')]+=0x1;_0x195166[_0x6e70('0xcd')]+=0x1;_0x195166['countglobal']=ut[_0x6e70('0x95')](_0x195166);ut[_0x6e70('0x84')](_0x195166,0x14,_0x6e70('0xce'));ami[_0x6e70('0x22')](_0x6e70('0xcf'),ut['buildObj'](_0x195166,'agentreject'));rpcDb['createCustomerHistory'](_0x195166,_0x6e70('0xd0'));if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0x14,_0x6e70('0xce'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xd1'));}else{if(_0x195166[_0x6e70('0xcd')]>=_0x32b884[_0x6e70('0xd2')]){rpcDb[_0x6e70('0x9d')](_0x195166,_0x6e70('0xd1'));}else{rpcDb[_0x6e70('0xa0')](ut[_0x6e70('0xc3')](_0x195166,_0x6e70('0xcd'),_0x32b884[_0x6e70('0xd3')]),_0x195166['unlockAgent'],_0x195166[_0x6e70('0xbd')]);}}break;case _0x6e70('0xd4'):_0x32b884[_0x6e70('0xd5')]+=0x1;_0x195166[_0x6e70('0xd6')]+=0x1;_0x195166[_0x6e70('0xb5')]=ut[_0x6e70('0x95')](_0x195166);ut['logCustomer'](_0x195166,0xb,'Abandoned');rpcDb[_0x6e70('0x8a')](_0x195166,_0x6e70('0xd7'));if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x195166[_0x6e70('0xd8')]>=_0x32b884['dialAbandonedMaxRety']){rpcDb[_0x6e70('0x9d')](_0x195166,_0x6e70('0xd7'));}else{rpcDb[_0x6e70('0xa0')](ut[_0x6e70('0xc3')](_0x195166,'countabandonedretry',_0x32b884[_0x6e70('0xd9')]),_0x195166[_0x6e70('0xa2')],_0x195166['activeContact']);}}break;default:if(_0x195166[_0x6e70('0x69')]){ut['decrementTalkink'](_0x32b884,_0x6e70('0xda'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x32b884[_0x6e70('0x51')],_0x58cf1c);}_0x32b884[_0x6e70('0x3e')]+=0x1;_0x195166[_0x6e70('0xb5')]=ut['totalGlobal'](_0x195166);ut[_0x6e70('0x84')](_0x195166,0xc,_0x58cf1c[_0x6e70('0xdb')]||_0x58cf1c['dialstatus']);rpcDb[_0x6e70('0x8a')](_0x195166,_0x6e70('0xdc'));if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xdd'));}else{rpcDb[_0x6e70('0x9d')](_0x195166,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x58cf1c[_0x6e70('0xa3')]];}if(!(_0x195166['dialAnswer']&&_0x3dae08==='16')){ut[_0x6e70('0xde')](_0x32b884,_0x6e70('0xdf'));logger['info'](_0x6e70('0xe0'),_0x195166[_0x6e70('0xa6')],_0x6e70('0xa7'),_0x32b884['name'],_0x6e70('0xe1'),_0x32b884[_0x6e70('0x58')]);}if(_0x3dae08!==_0x6e70('0xa4')){delete this[_0x6e70('0x19')][_0x58cf1c[_0x6e70('0xa3')]];delete this[_0x6e70('0x19')][_0x58cf1c[_0x6e70('0xe2')]];}}};Preview[_0x6e70('0x12')][_0x6e70('0xe3')]=function(_0x33a93c,_0x273ed6,_0x41b70a){if(_[_0x6e70('0xe4')](_0x273ed6)&&'object'!==typeof _0x273ed6){return;}if(_[_0x6e70('0xe4')](_0x41b70a)&&_0x6e70('0xe5')!==typeof _0x41b70a){return;}switch(_0x41b70a[_0x6e70('0xe6')]){case'0':ut[_0x6e70('0xe7')](_0x33a93c,0x0,_0x6e70('0xe8'));rpcDb['createAgentHistory'](_0x33a93c,_0x6e70('0xe9'));break;case'3':ut[_0x6e70('0xe7')](_0x33a93c,0x3,_0x6e70('0xbe'));rpcDb['createAgentHistory'](_0x33a93c,_0x6e70('0xea'));break;case'5':ut['logAgent'](_0x33a93c,0x5,'Busy');rpcDb[_0x6e70('0xeb')](_0x33a93c,_0x6e70('0xec'));break;case'8':ut[_0x6e70('0xe7')](_0x33a93c,0x8,_0x6e70('0xc6'));rpcDb['createAgentHistory'](_0x33a93c,_0x6e70('0xed'));break;case'22':ut[_0x6e70('0xe7')](_0x33a93c,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x33a93c,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x6e70('0xe7')](_0x33a93c,0xc,_0x41b70a[_0x6e70('0xe6')]);rpcDb[_0x6e70('0xeb')](_0x33a93c,_0x6e70('0xed'));}ut[_0x6e70('0xde')](_0x273ed6,_0x6e70('0xee'));logger[_0x6e70('0x55')]('[originated][decrement][callProgressDetectingAgent]',_0x33a93c[_0x6e70('0xa6')],_0x6e70('0xa7'),_0x273ed6[_0x6e70('0x51')],_0x6e70('0xe1'),_0x273ed6[_0x6e70('0x58')]);delete this[_0x6e70('0x19')][_0x33a93c[_0x6e70('0xa6')]];};Preview[_0x6e70('0x12')][_0x6e70('0xef')]=function(_0x541c25,_0x1a2a44,_0x321da8,_0x5b4a66,_0x2a1205){var _0x1f1b96=this;return new BPromise(function(_0x397289,_0x551c7e){if(_[_0x6e70('0x65')](_0x1a2a44)||_[_0x6e70('0x65')](_0x1a2a44[_0x6e70('0xf0')])||_[_0x6e70('0x65')](_0x1a2a44[_0x6e70('0xf0')][_0x6e70('0xf1')])||_['isNil'](_0x1a2a44['VoiceQueueId'])){_0x551c7e(ut[_0x6e70('0x47')](_0x6e70('0xf2'),_0x5b4a66,_0x2a1205));return;}var _0xc93d60=uuid['v4']();var _0x432794=_0x1f1b96[_0x6e70('0x16')][_0x1a2a44[_0x6e70('0x67')]['name']];var _0x3df7bd=_0x321da8?_0x1f1b96[_0x6e70('0x1a')][_0x321da8]['id']:undefined;_0x1f1b96[_0x6e70('0x19')][_0xc93d60]=new Action(_0x1a2a44,_0x432794,_0xc93d60,_0x321da8,_0x3df7bd);var _0x154697=_0x1f1b96[_0x6e70('0x19')][_0xc93d60];_0x154697[_0x6e70('0xa2')]=_0x5b4a66;_0x154697[_0x6e70('0xbd')]=_0x2a1205;_0x154697[_0x6e70('0xf3')]=_0x321da8;if(_[_0x6e70('0xf4')](_0x541c25)){_0x1f1b96[_0x6e70('0xf5')](_0x154697,_0x432794,_0x1a2a44,_0x321da8)[_0x6e70('0x7a')](function(_0x8b237a){logger[_0x6e70('0x55')](_0x6e70('0xf6'),_0x6e70('0xf7')+_0x154697[_0x6e70('0x68')]+_0x6e70('0xf8')+_0x154697['idContact'],JSON['stringify'](_0x8b237a));ami[_0x6e70('0x22')](_0x6e70('0xf9'),ut[_0x6e70('0x97')](_0x154697,_0x6e70('0xfa'),_0x1f1b96[_0x6e70('0x16')][_0x154697[_0x6e70('0x68')]]));_0x397289(ut['message'](_0x6e70('0xfb')));})['catch'](function(_0x2f05b2){ut['logger'](_0x6e70('0xfc'),_0x2f05b2);_0x551c7e(ut['message'](_0x6e70('0xfd'),_0x5b4a66,_0x2a1205));});}else{_0x432794[_0x6e70('0x34')]+=0x1;ut[_0x6e70('0xfe')](_0x154697);rpcDb['createHistory'](_0x154697,_0x6e70('0xff'));delete _0x1f1b96[_0x6e70('0x19')][_0xc93d60];_0x551c7e(ut[_0x6e70('0x47')](_0x6e70('0x100'),_0x5b4a66,_0x2a1205));}});};Preview[_0x6e70('0x12')][_0x6e70('0x91')]=function(_0x1e8bfd){return!_['isNil'](_0x1e8bfd)&&!_[_0x6e70('0x65')](_0x1e8bfd[_0x6e70('0x51')])&&!_['isNil'](_0x1e8bfd[_0x6e70('0x101')])&&_0x1e8bfd[_0x6e70('0x101')]&&!_['isNil'](this['trunks'][util[_0x6e70('0x53')]('SIP/%s',_0x1e8bfd[_0x6e70('0x51')])])&&!_[_0x6e70('0x65')](this[_0x6e70('0x18')][util[_0x6e70('0x53')](_0x6e70('0x102'),_0x1e8bfd[_0x6e70('0x51')])][_0x6e70('0x6f')])&&(this[_0x6e70('0x18')][util[_0x6e70('0x53')](_0x6e70('0x102'),_0x1e8bfd[_0x6e70('0x51')])][_0x6e70('0x6f')]===_0x6e70('0x103')||this['trunks'][util[_0x6e70('0x53')](_0x6e70('0x102'),_0x1e8bfd[_0x6e70('0x51')])][_0x6e70('0x6f')]===_0x6e70('0x104'));};Preview[_0x6e70('0x12')][_0x6e70('0x80')]=function(_0xac161,_0x44ebd6){var _0x568799=this;return new BPromise(function(_0x4bdcc,_0xa512d1){_0x568799[_0x6e70('0x105')](_0xac161,_0x44ebd6)['then'](function(_0x88522){_0x4bdcc(_[_0x6e70('0x6a')](_0x88522,[_0x6e70('0x47')]));})[_0x6e70('0x70')](function(_0x4af0bc){if(_0x4af0bc['unlock']){rpcDb[_0x6e70('0x106')](_0xac161);}if(_0x4af0bc['active']){rpcDb['disableContact'](_0xac161);}_0xa512d1(_[_0x6e70('0x6a')](_0x4af0bc,[_0x6e70('0x47')]));});});};Preview[_0x6e70('0x12')][_0x6e70('0x105')]=function(_0x3bc12b,_0x22827){var _0xf7e813=this;return new BPromise(function(_0x3fef9d,_0x20fe70){var _0x41df1b,_0x484806;rpcDb[_0x6e70('0x107')](_0x3bc12b)[_0x6e70('0x7a')](function(_0xad1b46){if(!_[_0x6e70('0x65')](_0xad1b46[0x0])){_0x484806=_0xad1b46[0x0][_0x6e70('0x108')]?![]:!![];_0x41df1b=_0xad1b46[0x0][_0x6e70('0x108')]?!![]:![];_0x41df1b=_0x22827?!![]:_0x41df1b;}var _0x2033fa=_0xf7e813[_0x6e70('0x109')](_0xad1b46);if(_0x2033fa[_0x6e70('0x10a')]){rpcDb[_0x6e70('0x10b')](_['pick'](_0xad1b46[0x0],['VoiceQueueId','Contact.phone']))['then'](function(_0x2198fa){_0xf7e813[_0x6e70('0xef')](_0x2198fa,_0xad1b46[0x0],_0x22827,_0x484806,_0x41df1b)[_0x6e70('0x7a')](function(_0x596bbd){_0x3fef9d(_0x596bbd);})[_0x6e70('0x70')](function(_0x5c8b78){_0x20fe70(_0x5c8b78);});})[_0x6e70('0x70')](function(_0x59e8bf){ut['logger'](_0x6e70('0x10c'),_0x59e8bf);_0x20fe70(ut[_0x6e70('0x47')](_0x6e70('0x10d'),_0x484806,_0x41df1b));});}else{_0x20fe70(ut[_0x6e70('0x47')](_0x2033fa[_0x6e70('0x47')],_0x484806,_0x41df1b));}})[_0x6e70('0x70')](function(_0x2cfb23){ut['logger'](_0x6e70('0x10e'),_0x2cfb23);_0x20fe70(ut[_0x6e70('0x47')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x6e70('0x12')][_0x6e70('0x109')]=function(_0x151c30){if(_['isNil'](_0x151c30)||_[_0x6e70('0xf4')](_0x151c30)||!_[_0x6e70('0x65')](_0x151c30[0x0]['Agent'])&&_['isNil'](_0x151c30[0x0][_0x6e70('0x7e')][_0x6e70('0x51')])){ut[_0x6e70('0x5a')](_0x6e70('0x10f'),_0x151c30);return{'isValid':![],'message':_0x6e70('0x110')};}var _0x48556b=this['campaignsPreview'][_0x151c30[0x0][_0x6e70('0x67')][_0x6e70('0x51')]];_0x48556b[_0x6e70('0x47')]='ACTIVE';if(_[_0x6e70('0x65')](_0x48556b)){ut[_0x6e70('0x5a')](_0x6e70('0x111'),_0x48556b);return{'isValid':![],'message':_0x6e70('0x112')};}if(!this[_0x6e70('0x91')](_0x48556b[_0x6e70('0x4e')])){ut[_0x6e70('0x5a')](_0x6e70('0x113'),_0x6e70('0x114')+_0x48556b[_0x6e70('0x51')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x6e70('0x91')](_0x48556b[_0x6e70('0x92')])){ut[_0x6e70('0x5a')](_0x6e70('0x113'),_0x48556b['name']+_0x6e70('0x115'));return{'isValid':![],'message':_0x6e70('0x116')};}}if(!ut[_0x6e70('0x90')](_0x48556b['dialActive'])){ut[_0x6e70('0x5a')](_0x6e70('0x117'),_0x48556b[_0x6e70('0x51')]+_0x6e70('0x118'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x48556b[_0x6e70('0x51')]+_0x6e70('0x118')};}return{'isValid':!![],'message':_0x6e70('0x119')};};Preview[_0x6e70('0x12')][_0x6e70('0xf5')]=function(_0x24ebf4,_0xa08f5,_0x28bc96,_0x2eb49f){var _0x46a4c2=this;return new BPromise(function(_0x4e0788,_0x53f283){var _0x11b784=_0x24ebf4[_0x6e70('0xa6')];var _0x323887=_0x46a4c2[_0x6e70('0x91')](_0xa08f5[_0x6e70('0x4e')])?util[_0x6e70('0x53')](_0x6e70('0x11a'),_0xa08f5[_0x6e70('0x4e')][_0x6e70('0x51')],_[_0x6e70('0x65')](_0xa08f5[_0x6e70('0x31')])?'':_0xa08f5[_0x6e70('0x31')][_0x6e70('0x11b')]()||'',_0xa08f5[_0x6e70('0x11c')]>0x0?_0x28bc96[_0x6e70('0xf0')]['phone'][_0x6e70('0x11d')](_0xa08f5[_0x6e70('0x11c')]):_0x28bc96[_0x6e70('0xf0')]['phone']):util[_0x6e70('0x53')](_0x6e70('0x11a'),_[_0x6e70('0x65')](_0xa08f5[_0x6e70('0x92')])?_0xa08f5[_0x6e70('0x4e')][_0x6e70('0x51')]:_0xa08f5['TrunkBackup'][_0x6e70('0x51')],_[_0x6e70('0x65')](_0xa08f5['dialPrefix'])?'':_0xa08f5[_0x6e70('0x31')][_0x6e70('0x11b')]()||'',_0xa08f5[_0x6e70('0x11c')]>0x0?_0x28bc96[_0x6e70('0xf0')][_0x6e70('0xf1')]['substring'](_0xa08f5['dialCutDigit']):_0x28bc96[_0x6e70('0xf0')]['phone']);var _0x337b18=_0x46a4c2[_0x6e70('0x91')](_0xa08f5[_0x6e70('0x4e')])?ut[_0x6e70('0x11e')](_0xa08f5[_0x6e70('0x4e')]['callerid'],_0xa08f5[_0x6e70('0x11f')],_0xa08f5[_0x6e70('0x120')]>0x0?ut[_0x6e70('0x121')](_0xa08f5[_0x6e70('0x122')],_0xa08f5[_0x6e70('0x120')]):_0xa08f5[_0x6e70('0x122')]):ut['getCallerId'](_['isNil'](_0xa08f5[_0x6e70('0x92')])?_0xa08f5[_0x6e70('0x4e')][_0x6e70('0x4f')]:_0xa08f5[_0x6e70('0x92')]['callerid'],_0xa08f5['dialOriginateCallerIdName'],_0xa08f5[_0x6e70('0x120')]>0x0?ut[_0x6e70('0x121')](_0xa08f5['dialOriginateCallerIdNumber'],_0xa08f5[_0x6e70('0x120')]):_0xa08f5[_0x6e70('0x122')]);if(_0x337b18){_0x24ebf4[_0x6e70('0x123')]=ut['extractCalleridName'](_0x337b18);_0x24ebf4[_0x6e70('0x124')]=ut[_0x6e70('0x125')](_0x337b18);}var _0x4b28d2=ut[_0x6e70('0x126')](_0xa08f5,_0x28bc96,_0x323887,_0x337b18,_0x11b784,_0x24ebf4);_['merge'](_0x24ebf4,ut[_0x6e70('0x127')](_0x4b28d2));_0x24ebf4[_0x6e70('0x128')]=moment()[_0x6e70('0x53')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x6e70('0x6e')](ut[_0x6e70('0x129')](_0x24ebf4,_0xa08f5,_0x4b28d2,_0x24ebf4[_0x6e70('0xbd')],_0x2eb49f))[_0x6e70('0x7a')](function(_0x1da95e){_0xa08f5['originated']+=0x1;logger[_0x6e70('0x55')]('[originated][increment]',_0x11b784,_0x6e70('0xa7'),_0xa08f5[_0x6e70('0x51')],_0x6e70('0xe1'),_0xa08f5[_0x6e70('0x58')]);_0x4e0788(_0x1da95e);})[_0x6e70('0x70')](function(_0x26a56c){ut[_0x6e70('0xe7')](_0x24ebf4,0xe,_0x6e70('0x12a'));rpcDb['createAgentHistory'](_0x24ebf4,_0x6e70('0x12b'));_0x53f283(_0x26a56c);});});};Preview['prototype'][_0x6e70('0x12c')]=function(_0x35e889){if(this[_0x6e70('0x19')][_0x35e889[_0x6e70('0xa3')]]){this['actions'][_0x35e889[_0x6e70('0xa3')]]['channel']=_0x35e889['channel'];}};Preview[_0x6e70('0x12')]['syncOriginateResponse']=function(_0x114df8){var _0x19cc83=this;var _0x14bdfb=this['actions'][_0x114df8['actionid']];if(_0x14bdfb){if(_0x14bdfb[_0x6e70('0xf3')]&&this[_0x6e70('0x1a')][_0x14bdfb[_0x6e70('0xf3')]]){ut[_0x6e70('0x12d')](_0x14bdfb,this[_0x6e70('0x1a')][_0x14bdfb[_0x6e70('0xf3')]]['name'],this[_0x6e70('0x1a')][_0x14bdfb['lookAgent']]['id']);}var _0x5771e5=_['clone'](_0x14bdfb);_0x5771e5[_0x6e70('0x12e')]=moment()[_0x6e70('0x53')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1e479d=_0x19cc83['campaignsPreview'][_0x14bdfb[_0x6e70('0x68')]];if(ut[_0x6e70('0x12f')](_0x114df8[_0x6e70('0x130')])){if(_0x14bdfb[_0x6e70('0xa2')]){rpcDb[_0x6e70('0x106')](_0x14bdfb[_0x6e70('0x131')]);}if(_0x14bdfb[_0x6e70('0xbd')]){rpcDb[_0x6e70('0x82')](_0x14bdfb[_0x6e70('0x131')]);}ami[_0x6e70('0x22')](_0x6e70('0x132'),ut[_0x6e70('0x97')](_0x14bdfb,'rejected',this['campaignsPreview'][_0x14bdfb[_0x6e70('0x68')]]));this[_0x6e70('0xe3')](_0x5771e5,_0x1e479d,_0x114df8);}else{_0x14bdfb[_0x6e70('0x128')]=moment()[_0x6e70('0x53')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x5771e5,0x4,_0x6e70('0xac'));rpcDb[_0x6e70('0xeb')](_0x5771e5,_0x6e70('0x133'));}}};Preview[_0x6e70('0x12')]['syncHangup']=function(_0x25b5ce){var _0x4a7ce3=this;var _0x44799d=this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]];var _0x4605e5;if(_0x44799d){_0x4605e5=this[_0x6e70('0x16')][_0x44799d['queue']];logger[_0x6e70('0x55')](_0x6e70('0x134'),_0x25b5ce[_0x6e70('0xa3')],'\x20Queue',_0x4605e5[_0x6e70('0x51')],_0x6e70('0xa8'),_0x4605e5[_0x6e70('0x28')]);}if(this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]]&&_0x25b5ce[_0x6e70('0xa3')]!==_0x25b5ce[_0x6e70('0xa6')]){if(_0x25b5ce[_0x6e70('0x135')]==='16'&&this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]][_0x6e70('0x69')]){this[_0x6e70('0x136')](_0x25b5ce,_0x25b5ce[_0x6e70('0xa3')],_0x25b5ce[_0x6e70('0x135')]);}else if(this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]][_0x6e70('0x69')]){logger[_0x6e70('0x55')](_0x6e70('0x137'),_0x25b5ce[_0x6e70('0xa3')],_0x25b5ce[_0x6e70('0x135')],'\x20Queue',_0x4605e5[_0x6e70('0x51')],'pTalking:\x20',_0x4605e5['pTalking']);this['callProgressDetectingCustomer'](_0x25b5ce,_0x25b5ce['linkedid'],_0x25b5ce[_0x6e70('0x135')]);}}else if(_0x44799d&&_[_0x6e70('0x65')](_0x44799d[_0x6e70('0x138')])&&_0x4605e5[_0x6e70('0x139')]&&_0x25b5ce[_0x6e70('0xa3')]===_0x25b5ce[_0x6e70('0xa6')]&&_[_0x6e70('0x65')](_0x25b5ce['reason'])&&_0x25b5ce[_0x6e70('0x135')]==='16'&&_0x25b5ce[_0x6e70('0x13a')]==='6'&&_['isUndefined'](_0x44799d['transfer'])){if(_0x44799d[_0x6e70('0xa2')]){rpcDb[_0x6e70('0x106')](_0x44799d[_0x6e70('0x131')]);}if(_0x44799d[_0x6e70('0xbd')]){rpcDb[_0x6e70('0x82')](_0x44799d['idContact']);}_0x25b5ce['reason']='22';this[_0x6e70('0xe3')](_0x44799d,_0x4605e5,_0x25b5ce);}else if(_0x44799d&&_0x44799d[_0x6e70('0x13b')]){if(_0x25b5ce[_0x6e70('0x135')]==='16'&&this['actions'][_0x25b5ce[_0x6e70('0xa3')]][_0x6e70('0x69')]){logger[_0x6e70('0x55')]('[syncHangup][talking][transfer]',_0x25b5ce['linkedid'],_0x25b5ce[_0x6e70('0x135')],_0x6e70('0xa7'),_0x4605e5[_0x6e70('0x51')],_0x6e70('0xa8'),_0x4605e5[_0x6e70('0x28')]);this['callProgressDetectingCustomer'](_0x25b5ce,_0x25b5ce['linkedid'],_0x25b5ce[_0x6e70('0x135')]);}else if(this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]]['dialAnswer']){logger[_0x6e70('0x55')](_0x6e70('0x137'),_0x25b5ce[_0x6e70('0xa3')],_0x25b5ce['cause'],_0x6e70('0xa7'),_0x4605e5['name'],_0x6e70('0xa8'),_0x4605e5[_0x6e70('0x28')]);this['callProgressDetectingCustomer'](_0x25b5ce,_0x25b5ce[_0x6e70('0xa3')],_0x25b5ce[_0x6e70('0x135')]);}}};Preview['prototype'][_0x6e70('0x1d')]=function(_0x2e8a43){if(this[_0x6e70('0x19')][_0x2e8a43[_0x6e70('0xe2')]]&&_0x2e8a43[_0x6e70('0xe2')]!==_0x2e8a43[_0x6e70('0x13c')]){this[_0x6e70('0x136')](_0x2e8a43,_0x2e8a43[_0x6e70('0xe2')],_0x2e8a43[_0x6e70('0x13d')]);}};Preview[_0x6e70('0x12')]['syncHangupRequest']=function(_0x52ce1a){if(this[_0x6e70('0x19')][_0x52ce1a['linkedid']]&&_0x52ce1a[_0x6e70('0xa3')]!==_0x52ce1a[_0x6e70('0xa6')]&&!this[_0x6e70('0x19')][_0x52ce1a[_0x6e70('0xa3')]][_0x6e70('0x69')]){if(_0x52ce1a[_0x6e70('0x135')]==='1'){this[_0x6e70('0x136')](_0x52ce1a,_0x52ce1a[_0x6e70('0xa3')],_0x52ce1a[_0x6e70('0x135')]);}}};Preview['prototype']['addVariable']=function(_0x4f8e39,_0x2bab68,_0x5f208c){if(this[_0x6e70('0x19')][_0x4f8e39]){if(_[_0x6e70('0x65')](this[_0x6e70('0x19')][_0x4f8e39][_0x6e70('0x13e')])){this[_0x6e70('0x19')][_0x4f8e39][_0x6e70('0x13e')]={};}this['actions'][_0x4f8e39][_0x6e70('0x13e')][_0x2bab68]=_0x5f208c;}};Preview[_0x6e70('0x12')][_0x6e70('0x1e')]=function(_0x2bafad){try{if(!_[_0x6e70('0x65')](_0x2bafad)){if(ut[_0x6e70('0x13f')](_[_0x6e70('0x140')](_0x2bafad['variable'])[0x0])){this[_0x6e70('0x141')](_0x2bafad[_0x6e70('0xa6')],_['keys'](_0x2bafad[_0x6e70('0x142')])[0x0],_0x2bafad[_0x6e70('0x143')]);}}}catch(_0x5734d6){logger['error'](_0x6e70('0x144'),util[_0x6e70('0x145')](_0x5734d6,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x6e70('0x146')]=function(_0x1bc156){if(_0x1bc156){if(this[_0x6e70('0x19')][_0x1bc156[_0x6e70('0x147')]]){this[_0x6e70('0x19')][_0x1bc156['transfertargetlinkedid']][_0x6e70('0x13b')]=!![];}}};Preview[_0x6e70('0x12')]['syncBlindTransfer']=function(_0x2e7e4a){if(_0x2e7e4a){if(this['actions'][_0x2e7e4a['transfererlinkedid']]){this['actions'][_0x2e7e4a[_0x6e70('0x148')]][_0x6e70('0x13b')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0xa9e0=['sumBillable','sumDuration','sumHoldTime','talking','total','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','Interval','stringify','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','outbound','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','dialAnswer','loggerError','clearZombieChannels','size','getContactRecallMe','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','then','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','pTalking:\x20','buildObj','connect','custom:agentConnectPreview','buildAcw','complete','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','busy','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','NOANSWER','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','rescheduleContact','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','[default]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent]','checkInBlack','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','format','reachable','unmonitored','run','execRun','unlock','unlockContact','disableContact','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','Contact','substring','trim','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','[originated][increment]','\x20Queue','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','callProgressDetectingAgent','[syncHangup][talking][transfer]','syncHangupRequest','variables','filterKey','keys','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','md5','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','name','strategy','answered','available','pTalking'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var uuid=require('uuid');var moment=require('moment');var md5=require(_0x0a9e('0x3'));var Redis=require('ioredis');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x7'));var ami=require('../ami');var rpcDb=require(_0x0a9e('0x8'));var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));config['redis']=_['defaults'](config[_0x0a9e('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xb')]));var Sequence=function(){};Sequence[_0x0a9e('0xc')][_0x0a9e('0xd')]=function(_0x3ab53f){this[_0x0a9e('0xe')]=this[_0x0a9e('0xe')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0xf')]=_0x527cdd[_0x0a9e('0x10')];this[_0x0a9e('0x11')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]={};this[_0x0a9e('0x13')]=_0x527cdd['agents'];this[_0x0a9e('0x14')]=0x0;ami['on'](_0x0a9e('0x15'),this[_0x0a9e('0x16')][_0x0a9e('0x17')](this));ami['on'](_0x0a9e('0x18'),this[_0x0a9e('0x19')]['bind'](this));ami['on'](_0x0a9e('0x1a'),this['syncHangupRequest'][_0x0a9e('0x17')](this));ami['on']('dialend',this[_0x0a9e('0x1b')][_0x0a9e('0x17')](this));ami['on']('newexten',this[_0x0a9e('0x1c')]['bind'](this));ami['on'](_0x0a9e('0x1d'),this[_0x0a9e('0x1e')][_0x0a9e('0x17')](this));ami['on'](_0x0a9e('0x1f'),this[_0x0a9e('0x20')][_0x0a9e('0x17')](this));ami['on'](_0x0a9e('0x21'),this[_0x0a9e('0x22')][_0x0a9e('0x17')](this));this[_0x0a9e('0x23')](this[_0x0a9e('0xf')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x24')](_0x4bb1e3,_0x2c3407);}function emitCampaignPreview(_0x53682f){if(_0x53682f[_0x0a9e('0x25')]==='outbound'){var _0x588269={'id':_0x53682f['id'],'name':_0x53682f[_0x0a9e('0x26')],'strategy':_0x53682f[_0x0a9e('0x27')],'answered':_0x53682f[_0x0a9e('0x28')],'available':_0x53682f[_0x0a9e('0x29')],'loggedIn':_0x53682f['loggedIn'],'pTalking':_0x53682f[_0x0a9e('0x2a')],'sumBillable':_0x53682f[_0x0a9e('0x2b')],'sumDuration':_0x53682f[_0x0a9e('0x2c')],'sumHoldTime':_0x53682f[_0x0a9e('0x2d')]||0x0,'talking':_0x53682f[_0x0a9e('0x2e')],'total':_0x53682f[_0x0a9e('0x2f')],'type':_0x53682f[_0x0a9e('0x25')],'unmanaged':_0x53682f['unmanaged'],'abandoned':_0x53682f['abandoned'],'waiting':_0x53682f[_0x0a9e('0x30')],'loggedInDb':_0x53682f[_0x0a9e('0x31')],'dialActive':_0x53682f[_0x0a9e('0x32')],'dialMethod':_0x53682f[_0x0a9e('0x33')],'dialOriginateCallerIdName':_0x53682f['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x53682f[_0x0a9e('0x34')],'dialOriginateTimeout':_0x53682f['dialOriginateTimeout'],'dialPrefix':_0x53682f[_0x0a9e('0x35')],'outboundAnswerAgiCallsDay':_0x53682f['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x53682f[_0x0a9e('0x36')],'outboundBlacklistCallsDay':_0x53682f[_0x0a9e('0x37')],'outboundBusyCallsDay':_0x53682f[_0x0a9e('0x38')],'outboundCongestionCallsDay':_0x53682f[_0x0a9e('0x39')],'outboundDropCallsDayACS':_0x53682f[_0x0a9e('0x3a')],'outboundDropCallsDayCallersExit':_0x53682f[_0x0a9e('0x3b')],'outboundDropCallsDayTimeout':_0x53682f[_0x0a9e('0x3c')],'outboundNoAnswerCallsDay':_0x53682f[_0x0a9e('0x3d')],'outboundNoSuchCallsDay':_0x53682f['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x53682f[_0x0a9e('0x3e')],'outboundReCallsDay':_0x53682f[_0x0a9e('0x3f')],'outboundRejectCallsDay':_0x53682f[_0x0a9e('0x40')],'outboundUnknownCallsDay':_0x53682f[_0x0a9e('0x41')],'outboundAbandonedCallsDay':_0x53682f['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x53682f[_0x0a9e('0x42')],'predictiveIntervalAvgHoldtime':_0x53682f[_0x0a9e('0x43')],'predictiveIntervalAvgTalktime':_0x53682f[_0x0a9e('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x53682f[_0x0a9e('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x53682f[_0x0a9e('0x46')],'predictiveIntervalErlangCalls':_0x53682f[_0x0a9e('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x53682f[_0x0a9e('0x48')],'predictiveIntervalHitRate':_0x53682f[_0x0a9e('0x49')],'predictiveIntervalMultiplicativeFactor':_0x53682f[_0x0a9e('0x4a')],'predictiveIntervalPauses':_0x53682f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x53682f[_0x0a9e('0x4b')],'predictiveIntervalTotalCalls':_0x53682f['predictiveIntervalTotalCalls'],'message':_0x53682f[_0x0a9e('0x4c')],'originated':_0x53682f[_0x0a9e('0x4d')],'erlangCalls':_0x53682f[_0x0a9e('0x4e')],'erlangCallToSecond':_0x53682f[_0x0a9e('0x4f')],'erlangAbandonmentRate':_0x53682f[_0x0a9e('0x50')],'erlangBusyFactor':_0x53682f['erlangBusyFactor'],'startPredictive':_0x53682f[_0x0a9e('0x51')],'startProgressive':_0x53682f[_0x0a9e('0x52')]};if(_0x53682f[_0x0a9e('0x53')]){_0x588269[_0x0a9e('0x53')]={'id':_0x53682f[_0x0a9e('0x53')]['id'],'name':_0x53682f[_0x0a9e('0x53')][_0x0a9e('0x26')],'active':_0x53682f[_0x0a9e('0x53')]['active'],'callerid':_0x53682f[_0x0a9e('0x53')]['callerid']};}if(_0x53682f[_0x0a9e('0x54')]){_0x588269[_0x0a9e('0x54')]={'id':_0x53682f[_0x0a9e('0x54')]['id'],'name':_0x53682f[_0x0a9e('0x54')]['name']};}var _0x191e91=md5(JSON[_0x0a9e('0x55')](_0x588269));if(_0x53682f[_0x0a9e('0x3')]!==_0x191e91){_0x53682f[_0x0a9e('0x3')]=_0x191e91;emit(util['format']('voice:queue:%s',_0x588269[_0x0a9e('0x26')]),'voice_queue:save',_0x588269);}}}function emitVoiceQueueChannelRemove(_0x24936a){logger[_0x0a9e('0x56')](_0x0a9e('0x57'),JSON[_0x0a9e('0x55')](_0x24936a));emit(util['format'](_0x0a9e('0x58'),_0x24936a[_0x0a9e('0x26')]),_0x0a9e('0x59'),_0x24936a);}function notSendMessagesQueue(_0x533942){if(_0x533942[_0x0a9e('0x5a')]){if(_0x533942[_0x0a9e('0x4d')]===0x0&&_0x533942[_0x0a9e('0x2a')]===0x0){_0x533942['sendMessageOneNotActive']=![];_0x533942['available']=0x0;_0x533942[_0x0a9e('0x5b')]=0x0;_0x533942[_0x0a9e('0x4c')]='NOT_ACTIVE';ut[_0x0a9e('0x5c')](_0x0a9e('0x5d'),_0x533942[_0x0a9e('0x26')]+_0x0a9e('0x5e'));}else{_0x533942['message']='IS_DISACTIVED';ut[_0x0a9e('0x5c')](_0x0a9e('0x5d'),_0x533942['name']+_0x0a9e('0x5f'));}emitCampaignPreview(_0x533942);}}Preview[_0x0a9e('0xc')][_0x0a9e('0x23')]=function(){var _0x5b4f5e=this;setInterval(function(){_0x5b4f5e[_0x0a9e('0x60')]();},0x7cf);};Preview[_0x0a9e('0xc')][_0x0a9e('0x60')]=function(){var _0x43dd5b=this[_0x0a9e('0xf')];this[_0x0a9e('0x14')]+=0x1;for(var _0x2881b3 in _0x43dd5b){if(_0x43dd5b[_0x0a9e('0x61')](_0x2881b3)&&(_0x43dd5b[_0x2881b3][_0x0a9e('0x33')]===_0x0a9e('0x6')||_0x43dd5b[_0x2881b3][_0x0a9e('0x33')]===_0x0a9e('0x62'))&&_0x43dd5b[_0x2881b3][_0x0a9e('0x25')]===_0x0a9e('0x63')){if(this[_0x0a9e('0x14')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x43dd5b[_0x0a9e('0x61')](_0x2881b3)&&_0x43dd5b[_0x2881b3][_0x0a9e('0x33')]===_0x0a9e('0x6')&&_0x43dd5b[_0x2881b3][_0x0a9e('0x25')]===_0x0a9e('0x63')){if(_0x43dd5b[_0x2881b3][_0x0a9e('0x32')]){this[_0x0a9e('0x64')](_0x43dd5b[_0x2881b3]);this[_0x0a9e('0x65')](_0x43dd5b[_0x2881b3]);}else{notSendMessagesQueue(_0x43dd5b[_0x2881b3]);}}}};Preview[_0x0a9e('0xc')][_0x0a9e('0x66')]=function(_0x2c2cb0){var _0x35ed4a=this;this['sequence'][_0x0a9e('0xd')](function(){if(!_[_0x0a9e('0x67')](_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0])){loggerAction[_0x0a9e('0x56')](_0x0a9e('0x68'),_0x2c2cb0,_0x0a9e('0x69'),_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')],'originated:\x20',JSON[_0x0a9e('0x55')](_0x35ed4a['campaignsPreview'][_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]][_0x0a9e('0x4d')]),'pTalking:\x20',JSON[_0x0a9e('0x55')](_0x35ed4a[_0x0a9e('0xf')][_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]][_0x0a9e('0x2a')]),JSON[_0x0a9e('0x55')](_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0]['dialAnswer']),JSON[_0x0a9e('0x55')](_[_0x0a9e('0x6b')](_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0],[_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),_0x0a9e('0x6f')])));return ami[_0x0a9e('0x70')]({'action':_0x0a9e('0x71'),'channel':_0x35ed4a['actions'][_0x2c2cb0][_0x0a9e('0x72')]})[_0x0a9e('0x73')](function(_0x4f7240){if(_0x4f7240['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0]){ut[_0x0a9e('0x74')](_0x35ed4a[_0x0a9e('0xf')][_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]],_0x0a9e('0x75'));if(_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x76')]===!![]){ut['decrementTalkink'](_0x35ed4a['campaignsPreview'][_0x35ed4a['actions'][_0x2c2cb0][_0x0a9e('0x6a')]],_0x0a9e('0x75'));ut[_0x0a9e('0x77')]('[Dialer][checkChannel][pTalking][Preview]'+_0x2c2cb0,_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0][_0x0a9e('0x6a')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x2c2cb0,_0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0]['queue']);delete _0x35ed4a[_0x0a9e('0x12')][_0x2c2cb0];}},0x2328);}});}});};Preview['prototype'][_0x0a9e('0x78')]=function(){var _0x3c20b2=this;loggerAction[_0x0a9e('0x56')]('[action]',_[_0x0a9e('0x79')](this[_0x0a9e('0x12')]));for(var _0x508b47 in this['actions']){if(_0x3c20b2[_0x0a9e('0x12')][_0x0a9e('0x61')](_0x508b47)){_0x3c20b2['clearZombieChannel'](_0x508b47);}}};Preview[_0x0a9e('0xc')]['recallMe']=function(_0x211ef9){var _0x523cd2=this;rpcDb[_0x0a9e('0x7a')](_0x211ef9['id'],ut['agentReadyId'](this['agents']))['then'](function(_0x2da03c){if(!_['isNil'](_0x2da03c)){for(var _0x2f7092=0x0;_0x2f7092<_0x2da03c[_0x0a9e('0x7b')];_0x2f7092+=0x1){if(ut[_0x0a9e('0x7c')](_0x2da03c[_0x2f7092][_0x0a9e('0x7d')])<_0x211ef9[_0x0a9e('0x7e')]*0x3c){if(_0x2da03c[_0x2f7092][_0x0a9e('0x7f')]&&!_0x2da03c[_0x2f7092][_0x0a9e('0x7f')][_0x0a9e('0x80')]){_0x523cd2['run'](_0x2da03c[_0x2f7092]['id'])[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x0a9e('0x83')))[_0x0a9e('0x73')](ut[_0x0a9e('0x82')](_0x0a9e('0x83')));}else{rpcDb['disableContact'](_0x2da03c[_0x2f7092]['id']);}}else{var _0x956fbe=new Action(_0x2da03c[_0x2f7092],_0x211ef9);_0x956fbe[_0x0a9e('0x84')]=moment()['format'](_0x0a9e('0x85'));_0x211ef9['outboundReCallsDay']+=0x1;ut[_0x0a9e('0x86')](_0x956fbe,0x17,'RecallInQueue');if(_0x211ef9['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0x0a9e('0x87')](_0x2da03c[_0x2f7092]));rpcDb['createCustomerHistory'](_0x956fbe,_0x0a9e('0x88'));}else{ut[_0x0a9e('0x86')](_0x956fbe,0x16,_0x0a9e('0x89'));rpcDb[_0x0a9e('0x8a')](_0x956fbe,_0x0a9e('0x8b'));rpcDb[_0x0a9e('0x8c')](_0x956fbe,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x73')](ut['logger2'](_0x0a9e('0x8d')));};Preview[_0x0a9e('0xc')][_0x0a9e('0x64')]=function(_0x5adf8f){_0x5adf8f[_0x0a9e('0x5a')]=!![];if(ut[_0x0a9e('0x8e')](_0x5adf8f[_0x0a9e('0x8f')])){_0x5adf8f[_0x0a9e('0x4c')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x0a9e('0x90')](_0x5adf8f[_0x0a9e('0x32')])){_0x5adf8f['message']=_0x0a9e('0x91');}else if(!this[_0x0a9e('0x92')](_0x5adf8f[_0x0a9e('0x53')])){if(!this[_0x0a9e('0x92')](_0x5adf8f[_0x0a9e('0x93')])){_0x5adf8f['message']=_0x0a9e('0x94');}else{_0x5adf8f[_0x0a9e('0x4c')]=_0x0a9e('0x95');}}else{_0x5adf8f['message']=_0x0a9e('0x95');}emitCampaignPreview(_0x5adf8f);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x242745,_0x4556c5,_0x9375fb){var _0x19c995=this;var _0x186f39=this[_0x0a9e('0x12')][_0x4556c5];var _0x387489=this[_0x0a9e('0xf')][_0x186f39[_0x0a9e('0x6a')]];var _0x1cc4f3;if(_0x387489){switch(_0x9375fb){case'1':_0x387489[_0x0a9e('0x96')]+=0x1;_0x186f39[_0x0a9e('0x97')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x0,_0x0a9e('0x9a'));ami[_0x0a9e('0x24')](_0x0a9e('0x9b'),ut['buildObj'](_0x186f39,_0x0a9e('0x9c')));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0x9d'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0xf,'Global');rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,_0x0a9e('0xa0'));}else{if(_0x186f39[_0x0a9e('0x97')]>=_0x387489[_0x0a9e('0xa1')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x186f39,_0x0a9e('0x97'),_0x387489[_0x0a9e('0xa2')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}delete this[_0x0a9e('0x12')][_0x242745[_0x0a9e('0xa5')]];break;case _0x0a9e('0xa6'):var _0x1a0677=moment()['format'](_0x0a9e('0x85'));_0x186f39[_0x0a9e('0xa7')]=_0x1a0677;_0x186f39[_0x0a9e('0xa8')]=_0x1a0677;_0x186f39['dialAnswer']=!![];_0x387489[_0x0a9e('0x2a')]+=0x1;logger['info'](_0x0a9e('0xa9'),_0x186f39[_0x0a9e('0xaa')],'\x20Queue',_0x387489[_0x0a9e('0x26')],_0x0a9e('0xab'),_0x387489[_0x0a9e('0x2a')]);ami[_0x0a9e('0x24')]('custom:agentconnect',ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xad'),this[_0x0a9e('0xf')][_0x186f39[_0x0a9e('0x6a')]]));if(_0x387489['acw']){ami[_0x0a9e('0x24')](_0x0a9e('0xae'),ut[_0x0a9e('0xaf')](_0x186f39));}break;case'16':ami[_0x0a9e('0x24')]('custom:agentcomplete',ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xb0'),this[_0x0a9e('0xf')][_0x186f39[_0x0a9e('0x6a')]]));emitVoiceQueueChannelRemove(ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xb0')));_0x387489[_0x0a9e('0x36')]+=0x1;_0x387489[_0x0a9e('0x2f')]+=0x1;_0x387489[_0x0a9e('0x28')]+=0x1;ut[_0x0a9e('0xb1')](_0x387489,_0x0a9e('0xb2'));_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x4,'Answer');rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xb3'));rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x0a9e('0xb4')](_0x186f39);_0x387489[_0x0a9e('0x2c')]+=_0x186f39[_0x0a9e('0xb5')];_0x387489[_0x0a9e('0x2b')]+=_0x186f39['talktime'];logger['info'](_0x0a9e('0xb6'),_0x186f39[_0x0a9e('0xaa')],'\x20Queue',_0x387489[_0x0a9e('0x26')],'pTalking:\x20',_0x387489[_0x0a9e('0x2a')]);delete this[_0x0a9e('0x12')][_0x242745['linkedid']];break;case _0x0a9e('0xb7'):_0x387489[_0x0a9e('0x38')]+=0x1;_0x186f39[_0x0a9e('0xb8')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x5,_0x0a9e('0xb9'));ami['emit'](_0x0a9e('0xba'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xbb')));rpcDb[_0x0a9e('0x8a')](_0x186f39,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x0a9e('0x99')](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut['cloneAction'](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb['createCustomerFinal'](_0x1cc4f3,_0x0a9e('0xbd'));}else{if(_0x186f39[_0x0a9e('0xb8')]>=_0x387489[_0x0a9e('0xbe')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0x0a9e('0xbf')](_0x186f39,_0x0a9e('0xb8'),_0x387489[_0x0a9e('0xc0')]),_0x186f39['unlockAgent'],_0x186f39[_0x0a9e('0xa4')]);}}break;case _0x0a9e('0xc1'):_0x387489['outboundNoAnswerCallsDay']+=0x1;_0x186f39['countnoanswerretry']+=0x1;_0x186f39[_0x0a9e('0x98')]=ut['totalGlobal'](_0x186f39);ut['logCustomer'](_0x186f39,0x3,'NoAnswer');ami[_0x0a9e('0x24')](_0x0a9e('0xc2'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xc3')));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xc4'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut['cloneAction'](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,_0x0a9e('0xc5'));}else{if(_0x186f39[_0x0a9e('0xc6')]>=_0x387489['dialNoAnswerMaxRetry']){rpcDb[_0x0a9e('0x8c')](_0x186f39,_0x0a9e('0xc4'));}else{rpcDb[_0x0a9e('0xc7')](ut['scheduledAt'](_0x186f39,_0x0a9e('0xc6'),_0x387489[_0x0a9e('0xc8')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}break;case _0x0a9e('0xc9'):_0x387489[_0x0a9e('0x39')]+=0x1;_0x186f39[_0x0a9e('0xca')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut['totalGlobal'](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x8,_0x0a9e('0xcb'));ami['emit'](_0x0a9e('0xcc'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xcd')));rpcDb['createCustomerHistory'](_0x186f39,_0x0a9e('0xce'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,_0x0a9e('0xcf'));}else{if(_0x186f39[_0x0a9e('0xca')]>=_0x387489[_0x0a9e('0xd0')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x0a9e('0xc7')](ut[_0x0a9e('0xbf')](_0x186f39,_0x0a9e('0xca'),_0x387489[_0x0a9e('0xc0')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}break;case _0x0a9e('0xd1'):_0x387489[_0x0a9e('0x40')]+=0x1;_0x186f39[_0x0a9e('0xd2')]+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0x14,_0x0a9e('0xd3'));ami['emit'](_0x0a9e('0xd4'),ut[_0x0a9e('0xac')](_0x186f39,_0x0a9e('0xd5')));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xd6'));if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0x14,'AgentReject');rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x186f39[_0x0a9e('0xd2')]>=_0x387489[_0x0a9e('0xd7')]){rpcDb[_0x0a9e('0x8c')](_0x186f39,_0x0a9e('0xd8'));}else{rpcDb['rescheduleContact'](ut[_0x0a9e('0xbf')](_0x186f39,'countagentrejectretry',_0x387489[_0x0a9e('0xd9')]),_0x186f39[_0x0a9e('0xa3')],_0x186f39['activeContact']);}}break;case _0x0a9e('0xda'):_0x387489[_0x0a9e('0xdb')]+=0x1;_0x186f39[_0x0a9e('0xdc')]+=0x1;_0x186f39['countglobal']=ut['totalGlobal'](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0xb,_0x0a9e('0xdd'));rpcDb[_0x0a9e('0x8a')](_0x186f39,_0x0a9e('0xde'));if(ut[_0x0a9e('0x99')](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut[_0x0a9e('0x9f')](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb[_0x0a9e('0x8c')](_0x1cc4f3,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x186f39[_0x0a9e('0xdf')]>=_0x387489['dialAbandonedMaxRety']){rpcDb[_0x0a9e('0x8c')](_0x186f39,_0x0a9e('0xde'));}else{rpcDb[_0x0a9e('0xc7')](ut[_0x0a9e('0xbf')](_0x186f39,_0x0a9e('0xdc'),_0x387489['dialAbandonedRetryFrequency']),_0x186f39[_0x0a9e('0xa3')],_0x186f39[_0x0a9e('0xa4')]);}}break;default:if(_0x186f39[_0x0a9e('0x76')]){ut[_0x0a9e('0xb1')](_0x387489,_0x0a9e('0xe0'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x387489[_0x0a9e('0x26')],_0x242745);}_0x387489['outboundUnknownCallsDay']+=0x1;_0x186f39[_0x0a9e('0x98')]=ut[_0x0a9e('0x99')](_0x186f39);ut[_0x0a9e('0x86')](_0x186f39,0xc,_0x242745[_0x0a9e('0xe1')]||_0x242745[_0x0a9e('0xe2')]);rpcDb[_0x0a9e('0x8a')](_0x186f39,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x186f39)>=_0x387489[_0x0a9e('0x9e')]){_0x1cc4f3=ut['cloneAction'](_0x186f39,0xf,_0x0a9e('0xbc'));rpcDb['createCustomerFinal'](_0x1cc4f3,_0x0a9e('0xe3'));}else{rpcDb['createCustomerFinal'](_0x186f39,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x0a9e('0x12')][_0x242745[_0x0a9e('0xa5')]];}if(!(_0x186f39['dialAnswer']&&_0x9375fb==='16')){ut[_0x0a9e('0x74')](_0x387489,_0x0a9e('0xe4'));logger[_0x0a9e('0x56')](_0x0a9e('0xe5'),_0x186f39[_0x0a9e('0xaa')],'\x20Queue',_0x387489['name'],_0x0a9e('0xe6'),_0x387489[_0x0a9e('0x4d')]);}if(_0x9375fb!==_0x0a9e('0xa6')){delete this[_0x0a9e('0x12')][_0x242745[_0x0a9e('0xa5')]];delete this['actions'][_0x242745[_0x0a9e('0xe7')]];}}};Preview[_0x0a9e('0xc')]['callProgressDetectingAgent']=function(_0x3c313d,_0x19fd11,_0xcacabb){if(_[_0x0a9e('0xe8')](_0x19fd11)&&_0x0a9e('0xe9')!==typeof _0x19fd11){return;}if(_[_0x0a9e('0xe8')](_0xcacabb)&&_0x0a9e('0xe9')!==typeof _0xcacabb){return;}switch(_0xcacabb[_0x0a9e('0xea')]){case'0':ut[_0x0a9e('0xeb')](_0x3c313d,0x0,_0x0a9e('0x9a'));rpcDb['createAgentHistory'](_0x3c313d,_0x0a9e('0xec'));break;case'3':ut[_0x0a9e('0xeb')](_0x3c313d,0x3,_0x0a9e('0xed'));rpcDb[_0x0a9e('0xee')](_0x3c313d,_0x0a9e('0xef'));break;case'5':ut['logAgent'](_0x3c313d,0x5,'Busy');rpcDb[_0x0a9e('0xee')](_0x3c313d,_0x0a9e('0xf0'));break;case'8':ut[_0x0a9e('0xeb')](_0x3c313d,0x8,_0x0a9e('0xcb'));rpcDb[_0x0a9e('0xee')](_0x3c313d,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x0a9e('0xeb')](_0x3c313d,0x16,_0x0a9e('0xf1'));rpcDb[_0x0a9e('0xee')](_0x3c313d,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x0a9e('0xeb')](_0x3c313d,0xc,_0xcacabb['reason']);rpcDb[_0x0a9e('0xee')](_0x3c313d,'[callProgressDetectingAgent][logCongestion]');}ut[_0x0a9e('0x74')](_0x19fd11,_0x0a9e('0xf2'));logger[_0x0a9e('0x56')]('[originated][decrement][callProgressDetectingAgent]',_0x3c313d[_0x0a9e('0xaa')],'\x20Queue',_0x19fd11[_0x0a9e('0x26')],_0x0a9e('0xe6'),_0x19fd11[_0x0a9e('0x4d')]);delete this[_0x0a9e('0x12')][_0x3c313d[_0x0a9e('0xaa')]];};Preview[_0x0a9e('0xc')][_0x0a9e('0xf3')]=function(_0xe89aaa,_0x2aaf07,_0x27d1f5,_0x4262d0,_0xc876d4){var _0x2415fe=this;return new BPromise(function(_0x399def,_0x98c62c){if(_[_0x0a9e('0x67')](_0x2aaf07)||_['isNil'](_0x2aaf07['Contact'])||_[_0x0a9e('0x67')](_0x2aaf07['Contact'][_0x0a9e('0xf4')])||_[_0x0a9e('0x67')](_0x2aaf07['VoiceQueueId'])){_0x98c62c(ut[_0x0a9e('0x4c')](_0x0a9e('0xf5'),_0x4262d0,_0xc876d4));return;}var _0x387bbe=uuid['v4']();var _0x18adc8=_0x2415fe['campaignsPreview'][_0x2aaf07[_0x0a9e('0x69')][_0x0a9e('0x26')]];var _0x374f0b=_0x27d1f5?_0x2415fe[_0x0a9e('0x13')][_0x27d1f5]['id']:undefined;_0x2415fe['actions'][_0x387bbe]=new Action(_0x2aaf07,_0x18adc8,_0x387bbe,_0x27d1f5,_0x374f0b);var _0x19e9ed=_0x2415fe[_0x0a9e('0x12')][_0x387bbe];_0x19e9ed[_0x0a9e('0xa3')]=_0x4262d0;_0x19e9ed['activeContact']=_0xc876d4;_0x19e9ed[_0x0a9e('0xf6')]=_0x27d1f5;if(_[_0x0a9e('0xf7')](_0xe89aaa)){_0x2415fe[_0x0a9e('0xf8')](_0x19e9ed,_0x18adc8,_0x2aaf07,_0x27d1f5)['then'](function(_0x303f75){logger[_0x0a9e('0x56')](_0x0a9e('0xf9'),_0x0a9e('0xfa')+_0x19e9ed[_0x0a9e('0x6a')]+'\x20IdHopper:\x20'+_0x19e9ed[_0x0a9e('0xfb')],JSON[_0x0a9e('0x55')](_0x303f75));ami['emit'](_0x0a9e('0xfc'),ut[_0x0a9e('0xac')](_0x19e9ed,_0x0a9e('0xfd'),_0x2415fe['campaignsPreview'][_0x19e9ed['queue']]));_0x399def(ut['message'](_0x0a9e('0xfe')));})[_0x0a9e('0x73')](function(_0x55f91a){ut[_0x0a9e('0x5c')](_0x0a9e('0xff'),_0x55f91a);_0x98c62c(ut[_0x0a9e('0x4c')]('Call\x20failed',_0x4262d0,_0xc876d4));});}else{_0x18adc8[_0x0a9e('0x37')]+=0x1;ut[_0x0a9e('0x100')](_0x19e9ed);rpcDb[_0x0a9e('0x101')](_0x19e9ed,_0x0a9e('0x102'));delete _0x2415fe[_0x0a9e('0x12')][_0x387bbe];_0x98c62c(ut[_0x0a9e('0x4c')](_0x0a9e('0x103'),_0x4262d0,_0xc876d4));}});};Preview[_0x0a9e('0xc')][_0x0a9e('0x92')]=function(_0x5a1848){return!_[_0x0a9e('0x67')](_0x5a1848)&&!_['isNil'](_0x5a1848[_0x0a9e('0x26')])&&!_[_0x0a9e('0x67')](_0x5a1848[_0x0a9e('0x104')])&&_0x5a1848[_0x0a9e('0x104')]&&!_[_0x0a9e('0x67')](this[_0x0a9e('0x11')][util['format'](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])])&&!_[_0x0a9e('0x67')](this[_0x0a9e('0x11')][util['format'](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])][_0x0a9e('0x71')])&&(this[_0x0a9e('0x11')][util[_0x0a9e('0x106')](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])][_0x0a9e('0x71')]===_0x0a9e('0x107')||this[_0x0a9e('0x11')][util['format'](_0x0a9e('0x105'),_0x5a1848[_0x0a9e('0x26')])][_0x0a9e('0x71')]===_0x0a9e('0x108'));};Preview[_0x0a9e('0xc')][_0x0a9e('0x109')]=function(_0x2895c5,_0x20ae21){var _0x566b90=this;return new BPromise(function(_0x3b581c,_0xd2391){_0x566b90[_0x0a9e('0x10a')](_0x2895c5,_0x20ae21)['then'](function(_0x1402c7){_0x3b581c(_[_0x0a9e('0x6b')](_0x1402c7,[_0x0a9e('0x4c')]));})[_0x0a9e('0x73')](function(_0x370b5e){if(_0x370b5e[_0x0a9e('0x10b')]){rpcDb[_0x0a9e('0x10c')](_0x2895c5);}if(_0x370b5e[_0x0a9e('0x104')]){rpcDb[_0x0a9e('0x10d')](_0x2895c5);}_0xd2391(_[_0x0a9e('0x6b')](_0x370b5e,['message']));});});};Preview[_0x0a9e('0xc')][_0x0a9e('0x10a')]=function(_0x15a9ed,_0x3db98f){var _0x2b624e=this;return new BPromise(function(_0x3942fd,_0x5cb48d){var _0x382687,_0x4f854b;rpcDb['getContactPreview'](_0x15a9ed)['then'](function(_0x19e4e6){if(!_[_0x0a9e('0x67')](_0x19e4e6[0x0])){_0x4f854b=_0x19e4e6[0x0][_0x0a9e('0x10e')]?![]:!![];_0x382687=_0x19e4e6[0x0][_0x0a9e('0x10e')]?!![]:![];_0x382687=_0x3db98f?!![]:_0x382687;}var _0x4d99a8=_0x2b624e[_0x0a9e('0x10f')](_0x19e4e6);if(_0x4d99a8[_0x0a9e('0x110')]){rpcDb[_0x0a9e('0x111')](_[_0x0a9e('0x6b')](_0x19e4e6[0x0],[_0x0a9e('0x6e'),'Contact.phone']))['then'](function(_0x9484c8){_0x2b624e[_0x0a9e('0xf3')](_0x9484c8,_0x19e4e6[0x0],_0x3db98f,_0x4f854b,_0x382687)[_0x0a9e('0x81')](function(_0x5e85d0){_0x3942fd(_0x5e85d0);})[_0x0a9e('0x73')](function(_0x248a9a){_0x5cb48d(_0x248a9a);});})[_0x0a9e('0x73')](function(_0x4cee8c){ut[_0x0a9e('0x5c')](_0x0a9e('0x112'),_0x4cee8c);_0x5cb48d(ut[_0x0a9e('0x4c')]('Call\x20unsuccessful',_0x4f854b,_0x382687));});}else{_0x5cb48d(ut[_0x0a9e('0x4c')](_0x4d99a8[_0x0a9e('0x4c')],_0x4f854b,_0x382687));}})[_0x0a9e('0x73')](function(_0x549e03){ut['logger']('[Preview][getContactPreview]',_0x549e03);_0x5cb48d(ut[_0x0a9e('0x4c')](_0x0a9e('0x113'),![],!![]));});});};Preview[_0x0a9e('0xc')][_0x0a9e('0x10f')]=function(_0x5d83fd){if(_[_0x0a9e('0x67')](_0x5d83fd)||_['isEmpty'](_0x5d83fd)||!_[_0x0a9e('0x67')](_0x5d83fd[0x0][_0x0a9e('0x7f')])&&_[_0x0a9e('0x67')](_0x5d83fd[0x0]['Agent'][_0x0a9e('0x26')])){ut[_0x0a9e('0x5c')](_0x0a9e('0x114'),_0x5d83fd);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x40eb5d=this['campaignsPreview'][_0x5d83fd[0x0][_0x0a9e('0x69')]['name']];_0x40eb5d[_0x0a9e('0x4c')]='ACTIVE';if(_[_0x0a9e('0x67')](_0x40eb5d)){ut[_0x0a9e('0x5c')](_0x0a9e('0x115'),_0x40eb5d);return{'isValid':![],'message':_0x0a9e('0x116')};}if(!this[_0x0a9e('0x92')](_0x40eb5d[_0x0a9e('0x53')])){ut[_0x0a9e('0x5c')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x0a9e('0x117')+_0x40eb5d[_0x0a9e('0x26')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x0a9e('0x92')](_0x40eb5d[_0x0a9e('0x93')])){ut['logger'](_0x0a9e('0x118'),_0x40eb5d[_0x0a9e('0x26')]+_0x0a9e('0x119'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0x0a9e('0x90')](_0x40eb5d[_0x0a9e('0x32')])){ut[_0x0a9e('0x5c')](_0x0a9e('0x11a'),_0x40eb5d[_0x0a9e('0x26')]+_0x0a9e('0x11b'));return{'isValid':![],'message':_0x0a9e('0x117')+_0x40eb5d[_0x0a9e('0x26')]+_0x0a9e('0x11b')};}return{'isValid':!![],'message':_0x0a9e('0x11c')};};Preview['prototype'][_0x0a9e('0xf8')]=function(_0x53c7de,_0x3c9854,_0x2968e2,_0x5b9c76){var _0x315e31=this;return new BPromise(function(_0x5d577b,_0x2d45db){var _0x5691ac=_0x53c7de[_0x0a9e('0xaa')];var _0x469035=_0x315e31[_0x0a9e('0x92')](_0x3c9854['Trunk'])?util[_0x0a9e('0x106')](_0x0a9e('0x11d'),_0x3c9854[_0x0a9e('0x53')][_0x0a9e('0x26')],_[_0x0a9e('0x67')](_0x3c9854[_0x0a9e('0x35')])?'':_0x3c9854[_0x0a9e('0x35')]['trim']()||'',_0x3c9854[_0x0a9e('0x11e')]>0x0?_0x2968e2[_0x0a9e('0x11f')][_0x0a9e('0xf4')][_0x0a9e('0x120')](_0x3c9854[_0x0a9e('0x11e')]):_0x2968e2[_0x0a9e('0x11f')][_0x0a9e('0xf4')]):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x67')](_0x3c9854[_0x0a9e('0x93')])?_0x3c9854[_0x0a9e('0x53')][_0x0a9e('0x26')]:_0x3c9854[_0x0a9e('0x93')][_0x0a9e('0x26')],_[_0x0a9e('0x67')](_0x3c9854['dialPrefix'])?'':_0x3c9854[_0x0a9e('0x35')][_0x0a9e('0x121')]()||'',_0x3c9854[_0x0a9e('0x11e')]>0x0?_0x2968e2[_0x0a9e('0x11f')][_0x0a9e('0xf4')][_0x0a9e('0x120')](_0x3c9854[_0x0a9e('0x11e')]):_0x2968e2['Contact'][_0x0a9e('0xf4')]);var _0x294310=_0x315e31[_0x0a9e('0x92')](_0x3c9854['Trunk'])?ut[_0x0a9e('0x122')](_0x3c9854[_0x0a9e('0x53')][_0x0a9e('0x123')],_0x3c9854[_0x0a9e('0x124')],_0x3c9854['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x0a9e('0x125')](_0x3c9854[_0x0a9e('0x34')],_0x3c9854[_0x0a9e('0x126')]):_0x3c9854[_0x0a9e('0x34')]):ut[_0x0a9e('0x122')](_[_0x0a9e('0x67')](_0x3c9854[_0x0a9e('0x93')])?_0x3c9854[_0x0a9e('0x53')]['callerid']:_0x3c9854[_0x0a9e('0x93')][_0x0a9e('0x123')],_0x3c9854[_0x0a9e('0x124')],_0x3c9854[_0x0a9e('0x126')]>0x0?ut['getCallerIdRandom'](_0x3c9854['dialOriginateCallerIdNumber'],_0x3c9854[_0x0a9e('0x126')]):_0x3c9854[_0x0a9e('0x34')]);if(_0x294310){_0x53c7de[_0x0a9e('0x127')]=ut['extractCalleridName'](_0x294310);_0x53c7de[_0x0a9e('0x128')]=ut[_0x0a9e('0x129')](_0x294310);}var _0x4d8a67=ut[_0x0a9e('0x12a')](_0x3c9854,_0x2968e2,_0x469035,_0x294310,_0x5691ac,_0x53c7de);_['merge'](_0x53c7de,ut[_0x0a9e('0x12b')](_0x4d8a67));_0x53c7de['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0x0a9e('0x70')](ut[_0x0a9e('0x12c')](_0x53c7de,_0x3c9854,_0x4d8a67,_0x53c7de[_0x0a9e('0xa4')],_0x5b9c76))[_0x0a9e('0x81')](function(_0x7d59a9){_0x3c9854[_0x0a9e('0x4d')]+=0x1;logger['info'](_0x0a9e('0x12d'),_0x5691ac,_0x0a9e('0x12e'),_0x3c9854[_0x0a9e('0x26')],_0x0a9e('0xe6'),_0x3c9854[_0x0a9e('0x4d')]);_0x5d577b(_0x7d59a9);})[_0x0a9e('0x73')](function(_0x31c937){ut['logAgent'](_0x53c7de,0xe,'OriginateError');rpcDb[_0x0a9e('0xee')](_0x53c7de,'[originateFailure][logOriginateFailure]');_0x2d45db(_0x31c937);});});};Preview[_0x0a9e('0xc')][_0x0a9e('0x1c')]=function(_0x1f0318){if(this[_0x0a9e('0x12')][_0x1f0318[_0x0a9e('0xa5')]]){this[_0x0a9e('0x12')][_0x1f0318['linkedid']][_0x0a9e('0x72')]=_0x1f0318['channel'];}};Preview['prototype'][_0x0a9e('0x16')]=function(_0x593f9e){var _0x38dceb=this;var _0x5dc978=this['actions'][_0x593f9e[_0x0a9e('0x12f')]];if(_0x5dc978){if(_0x5dc978['lookAgent']&&this[_0x0a9e('0x13')][_0x5dc978[_0x0a9e('0xf6')]]){ut[_0x0a9e('0x130')](_0x5dc978,this['agents'][_0x5dc978[_0x0a9e('0xf6')]][_0x0a9e('0x26')],this[_0x0a9e('0x13')][_0x5dc978['lookAgent']]['id']);}var _0x5236c9=_[_0x0a9e('0x131')](_0x5dc978);_0x5236c9[_0x0a9e('0xa7')]=moment()[_0x0a9e('0x106')](_0x0a9e('0x85'));var _0x3b0db2=_0x38dceb[_0x0a9e('0xf')][_0x5dc978[_0x0a9e('0x6a')]];if(ut[_0x0a9e('0x132')](_0x593f9e[_0x0a9e('0x133')])){if(_0x5dc978[_0x0a9e('0xa3')]){rpcDb['unlockContact'](_0x5dc978['idContact']);}if(_0x5dc978['activeContact']){rpcDb[_0x0a9e('0x10d')](_0x5dc978[_0x0a9e('0xfb')]);}ami[_0x0a9e('0x24')](_0x0a9e('0x134'),ut[_0x0a9e('0xac')](_0x5dc978,_0x0a9e('0x135'),this[_0x0a9e('0xf')][_0x5dc978[_0x0a9e('0x6a')]]));this['callProgressDetectingAgent'](_0x5236c9,_0x3b0db2,_0x593f9e);}else{_0x5dc978['starttime']=moment()[_0x0a9e('0x106')](_0x0a9e('0x85'));ut['logAgent'](_0x5236c9,0x4,_0x0a9e('0x136'));rpcDb[_0x0a9e('0xee')](_0x5236c9,_0x0a9e('0x137'));}}};Preview[_0x0a9e('0xc')][_0x0a9e('0x19')]=function(_0x2683ad){var _0x167196=this;var _0x262281=this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]];var _0xbd1af3;if(_0x262281){_0xbd1af3=this[_0x0a9e('0xf')][_0x262281['queue']];logger[_0x0a9e('0x56')](_0x0a9e('0x138'),_0x2683ad[_0x0a9e('0xa5')],_0x0a9e('0x12e'),_0xbd1af3[_0x0a9e('0x26')],_0x0a9e('0xab'),_0xbd1af3[_0x0a9e('0x2a')]);}if(this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]]&&_0x2683ad[_0x0a9e('0xa5')]!==_0x2683ad[_0x0a9e('0xaa')]){if(_0x2683ad[_0x0a9e('0x139')]==='16'&&this['actions'][_0x2683ad['linkedid']][_0x0a9e('0x76')]){this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}else if(this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]][_0x0a9e('0x76')]){logger['info'](_0x0a9e('0x13b'),_0x2683ad['linkedid'],_0x2683ad[_0x0a9e('0x139')],_0x0a9e('0x12e'),_0xbd1af3[_0x0a9e('0x26')],_0x0a9e('0xab'),_0xbd1af3[_0x0a9e('0x2a')]);this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}}else if(_0x262281&&_[_0x0a9e('0x67')](_0x262281[_0x0a9e('0x13c')])&&_0xbd1af3[_0x0a9e('0x13d')]&&_0x2683ad[_0x0a9e('0xa5')]===_0x2683ad[_0x0a9e('0xaa')]&&_[_0x0a9e('0x67')](_0x2683ad[_0x0a9e('0xea')])&&_0x2683ad[_0x0a9e('0x139')]==='16'&&_0x2683ad['channelstate']==='6'&&_['isUndefined'](_0x262281[_0x0a9e('0x13e')])){if(_0x262281[_0x0a9e('0xa3')]){rpcDb['unlockContact'](_0x262281['idContact']);}if(_0x262281[_0x0a9e('0xa4')]){rpcDb[_0x0a9e('0x10d')](_0x262281[_0x0a9e('0xfb')]);}_0x2683ad['reason']='22';this[_0x0a9e('0x13f')](_0x262281,_0xbd1af3,_0x2683ad);}else if(_0x262281&&_0x262281['transfer']){if(_0x2683ad[_0x0a9e('0x139')]==='16'&&this['actions'][_0x2683ad[_0x0a9e('0xa5')]]['dialAnswer']){logger[_0x0a9e('0x56')](_0x0a9e('0x140'),_0x2683ad[_0x0a9e('0xa5')],_0x2683ad['cause'],_0x0a9e('0x12e'),_0xbd1af3['name'],'pTalking:\x20',_0xbd1af3[_0x0a9e('0x2a')]);this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}else if(this[_0x0a9e('0x12')][_0x2683ad[_0x0a9e('0xa5')]][_0x0a9e('0x76')]){logger[_0x0a9e('0x56')](_0x0a9e('0x13b'),_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')],_0x0a9e('0x12e'),_0xbd1af3[_0x0a9e('0x26')],_0x0a9e('0xab'),_0xbd1af3[_0x0a9e('0x2a')]);this[_0x0a9e('0x13a')](_0x2683ad,_0x2683ad[_0x0a9e('0xa5')],_0x2683ad[_0x0a9e('0x139')]);}}};Preview[_0x0a9e('0xc')]['syncDialEnd']=function(_0x233e48){if(this[_0x0a9e('0x12')][_0x233e48[_0x0a9e('0xe7')]]&&_0x233e48[_0x0a9e('0xe7')]!==_0x233e48['destuniqueid']){this['callProgressDetectingCustomer'](_0x233e48,_0x233e48['destlinkedid'],_0x233e48[_0x0a9e('0xe2')]);}};Preview['prototype'][_0x0a9e('0x141')]=function(_0x1fafc2){if(this[_0x0a9e('0x12')][_0x1fafc2[_0x0a9e('0xa5')]]&&_0x1fafc2[_0x0a9e('0xa5')]!==_0x1fafc2[_0x0a9e('0xaa')]&&!this[_0x0a9e('0x12')][_0x1fafc2[_0x0a9e('0xa5')]][_0x0a9e('0x76')]){if(_0x1fafc2[_0x0a9e('0x139')]==='1'){this['callProgressDetectingCustomer'](_0x1fafc2,_0x1fafc2[_0x0a9e('0xa5')],_0x1fafc2['cause']);}}};Preview[_0x0a9e('0xc')]['addVariable']=function(_0xf4de86,_0x2c5385,_0x216791){if(this['actions'][_0xf4de86]){if(_[_0x0a9e('0x67')](this[_0x0a9e('0x12')][_0xf4de86]['variables'])){this['actions'][_0xf4de86][_0x0a9e('0x142')]={};}this[_0x0a9e('0x12')][_0xf4de86][_0x0a9e('0x142')][_0x2c5385]=_0x216791;}};Preview['prototype']['syncVarSet']=function(_0x4869c1){try{if(!_[_0x0a9e('0x67')](_0x4869c1)){if(ut[_0x0a9e('0x143')](_[_0x0a9e('0x144')](_0x4869c1[_0x0a9e('0x145')])[0x0])){this[_0x0a9e('0x146')](_0x4869c1[_0x0a9e('0xaa')],_[_0x0a9e('0x144')](_0x4869c1[_0x0a9e('0x145')])[0x0],_0x4869c1[_0x0a9e('0x147')]);}}}catch(_0x18e38b){logger[_0x0a9e('0x148')](_0x0a9e('0x149'),util[_0x0a9e('0x14a')](_0x18e38b,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xc')][_0x0a9e('0x20')]=function(_0x1a74c4){if(_0x1a74c4){if(this[_0x0a9e('0x12')][_0x1a74c4[_0x0a9e('0x14b')]]){this['actions'][_0x1a74c4[_0x0a9e('0x14b')]][_0x0a9e('0x13e')]=!![];}}};Preview[_0x0a9e('0xc')][_0x0a9e('0x22')]=function(_0x4790f7){if(_0x4790f7){if(this[_0x0a9e('0x12')][_0x4790f7['transfererlinkedid']]){this[_0x0a9e('0x12')][_0x4790f7[_0x0a9e('0x14c')]][_0x0a9e('0x13e')]=!![];}}};module[_0x0a9e('0x14d')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 98f51ec..6cf21af 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 _0x425d=['[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','holdtime','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact'];(function(_0x4e0863,_0x1ec822){var _0x3133d7=function(_0x3fca7d){while(--_0x3fca7d){_0x4e0863['push'](_0x4e0863['shift']());}};_0x3133d7(++_0x1ec822);}(_0x425d,0x1e0));var _0xd425=function(_0x3d118e,_0x439760){_0x3d118e=_0x3d118e-0x0;var _0x4564fd=_0x425d[_0x3d118e];return _0x4564fd;};'use strict';var util=require(_0xd425('0x0'));var BPromise=require('bluebird');var logger=require(_0xd425('0x1'))(_0xd425('0x2'));var _=require(_0xd425('0x3'));var cmHopper=require(_0xd425('0x4'));var cmHopperFinal=require(_0xd425('0x5'));var cmHopperHistory=require(_0xd425('0x6'));var cmHopperBlack=require(_0xd425('0x7'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xd425('0x8'));var voiceQueueReport=require(_0xd425('0x9'));function loggerCatch(_0xc4e080){return function(_0x36866e){logger[_0xd425('0xa')](_0xc4e080,util[_0xd425('0xb')](_0x36866e,{'showHidden':![],'depth':null}));};}function create(_0x50b061){return BPromise[_0xd425('0xc')]()[_0xd425('0xd')](cmHopperHistory[_0xd425('0xe')](_0x50b061))[_0xd425('0xf')](loggerCatch(_0xd425('0x10')));}function createAgent(_0x2beb20){return BPromise[_0xd425('0xc')]()[_0xd425('0xd')](agentReportPreview[_0xd425('0xe')](_0x2beb20))[_0xd425('0xf')](loggerCatch(_0xd425('0x10')));}function moveContact(_0x10d463){return BPromise[_0xd425('0xc')]()[_0xd425('0xd')](cmHopper[_0xd425('0x11')](_0x10d463,!![]))[_0xd425('0xf')](loggerCatch(_0xd425('0x12')));}exports[_0xd425('0x13')]=function(_0x3b5de8){return BPromise[_0xd425('0xc')]()['then'](cmHopperBlack[_0xd425('0x13')](_0x3b5de8))[_0xd425('0xf')](loggerCatch(_0xd425('0x14')));};exports['getContactPreview']=function(_0x309263){return BPromise[_0xd425('0xc')]()[_0xd425('0xd')](cmHopper[_0xd425('0x15')](_0x309263))[_0xd425('0xf')](loggerCatch('[getContactPreview]\x20'));};exports[_0xd425('0xe')]=function(_0x471267,_0x7e267e){create(_0x471267)[_0xd425('0xf')](loggerCatch(_0x7e267e));moveContact(_0x471267)['catch'](loggerCatch(_0x7e267e));};exports[_0xd425('0x16')]=function(_0x434d97,_0x467a6c){createAgent(_0x434d97)[_0xd425('0xf')](loggerCatch(_0x467a6c));};exports['createCustomerHistory']=function(_0x58a0c1,_0x5debc3){create(_0x58a0c1)['catch'](loggerCatch(_0x5debc3));};exports[_0xd425('0x17')]=function(_0xb92870,_0x3c98db){moveContact(_0xb92870)['catch'](loggerCatch(_0x3c98db));};exports[_0xd425('0x18')]=function(_0x7e982e,_0x5f1e7e,_0x2e1ec4){if(_0x5f1e7e){_0x7e982e[_0xd425('0x19')]=null;}if(_0x2e1ec4){_0x7e982e[_0xd425('0x1a')]=![];}return BPromise[_0xd425('0xc')]()[_0xd425('0xd')](cmHopper[_0xd425('0x18')](_0x7e982e))[_0xd425('0xf')](loggerCatch(_0xd425('0x1b')));};exports[_0xd425('0x1c')]=function(_0x2b030b){return BPromise[_0xd425('0xc')]()[_0xd425('0xd')](cmHopper['countReScheduled'](_0x2b030b))[_0xd425('0xf')](loggerCatch(_0xd425('0x1d')));};exports[_0xd425('0x1e')]=function(_0x1908a5){return BPromise[_0xd425('0xc')]()[_0xd425('0xd')](cmHopper[_0xd425('0x1e')]({'UserId':null},_0x1908a5,0x1))['catch'](loggerCatch(_0xd425('0x1f')));};exports[_0xd425('0x20')]=function(_0x1d8861){return BPromise['resolve']()[_0xd425('0xd')](cmHopper[_0xd425('0x1e')]({'active':![]},_0x1d8861,0x1))[_0xd425('0xf')](loggerCatch(_0xd425('0x21')));};exports[_0xd425('0x22')]=function(_0x185d7e){var _0x2fd17a={};_0x2fd17a[_0xd425('0x23')]=_0x185d7e[_0xd425('0x23')];_0x2fd17a[_0xd425('0x24')]=_0x185d7e['uniqueid'];_0x2fd17a[_0xd425('0x25')]=_0x185d7e[_0xd425('0x25')];_0x2fd17a[_0xd425('0x26')]=_0x185d7e[_0xd425('0x26')];_0x2fd17a[_0xd425('0x27')]=_0x185d7e[_0xd425('0x27')];_0x2fd17a[_0xd425('0x28')]=_0x185d7e[_0xd425('0x29')];_0x2fd17a[_0xd425('0x2a')]=_0x185d7e[_0xd425('0x29')];_0x2fd17a[_0xd425('0x2b')]=0x1;_0x2fd17a['queuecallercompleteAt']=_0x185d7e[_0xd425('0x2c')];_0x2fd17a[_0xd425('0x2d')]=_0x185d7e[_0xd425('0x2e')];_0x2fd17a[_0xd425('0x2f')]=_0xd425('0x30');_0x2fd17a['exten']=_0xd425('0x31');_0x2fd17a[_0xd425('0x32')]=0x0;_0x2fd17a['assigned']=0x1;_0x2fd17a['lastAssignedTo']=_0x185d7e['membername'];_0x2fd17a[_0xd425('0x33')]=_0xd425('0x34');return BPromise[_0xd425('0xc')]()[_0xd425('0xd')](voiceQueueReport['create'](_0x2fd17a))[_0xd425('0xf')](loggerCatch(_0xd425('0x35')));};exports[_0xd425('0x36')]=function(_0x1c7f72,_0x27b9e2){return BPromise[_0xd425('0xc')]()[_0xd425('0xd')](cmHopper['getContactRecallMe'](_0x1c7f72,_0x27b9e2))[_0xd425('0xf')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xd425('0x37')]=function(_0x29cca9){return BPromise[_0xd425('0xc')]()['then'](cmHopper[_0xd425('0x18')](_0x29cca9,!![],!![]))[_0xd425('0xf')](loggerCatch(_0xd425('0x38')));}; \ No newline at end of file +var _0xe14b=['xcally-motion-preview','assigned','lastAssignedTo','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','util','bluebird','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','countReScheduled','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context'];(function(_0x650e11,_0x284f86){var _0x1a9b47=function(_0x6e15e3){while(--_0x6e15e3){_0x650e11['push'](_0x650e11['shift']());}};_0x1a9b47(++_0x284f86);}(_0xe14b,0x93));var _0xbe14=function(_0x450cef,_0x309639){_0x450cef=_0x450cef-0x0;var _0x337f5d=_0xe14b[_0x450cef];return _0x337f5d;};'use strict';var util=require(_0xbe14('0x0'));var BPromise=require(_0xbe14('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0xbe14('0x2'));var cmHopper=require(_0xbe14('0x3'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xbe14('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xbe14('0x5'));var voiceQueueReport=require(_0xbe14('0x6'));function loggerCatch(_0x1fe204){return function(_0x1ff100){logger[_0xbe14('0x7')](_0x1fe204,util[_0xbe14('0x8')](_0x1ff100,{'showHidden':![],'depth':null}));};}function create(_0x196fca){return BPromise['resolve']()['then'](cmHopperHistory['createHistory'](_0x196fca))[_0xbe14('0x9')](loggerCatch(_0xbe14('0xa')));}function createAgent(_0xd68cd7){return BPromise[_0xbe14('0xb')]()['then'](agentReportPreview['createHistory'](_0xd68cd7))[_0xbe14('0x9')](loggerCatch(_0xbe14('0xa')));}function moveContact(_0x4935cc){return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](cmHopper[_0xbe14('0xd')](_0x4935cc,!![]))[_0xbe14('0x9')](loggerCatch(_0xbe14('0xe')));}exports[_0xbe14('0xf')]=function(_0x23a730){return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](cmHopperBlack[_0xbe14('0xf')](_0x23a730))[_0xbe14('0x9')](loggerCatch(_0xbe14('0x10')));};exports[_0xbe14('0x11')]=function(_0x530538){return BPromise['resolve']()[_0xbe14('0xc')](cmHopper[_0xbe14('0x11')](_0x530538))[_0xbe14('0x9')](loggerCatch(_0xbe14('0x12')));};exports['createHistory']=function(_0x21c789,_0xe9c3ec){create(_0x21c789)[_0xbe14('0x9')](loggerCatch(_0xe9c3ec));moveContact(_0x21c789)[_0xbe14('0x9')](loggerCatch(_0xe9c3ec));};exports[_0xbe14('0x13')]=function(_0x29ab73,_0x17ae86){createAgent(_0x29ab73)['catch'](loggerCatch(_0x17ae86));};exports[_0xbe14('0x14')]=function(_0x456ca8,_0x329588){create(_0x456ca8)[_0xbe14('0x9')](loggerCatch(_0x329588));};exports[_0xbe14('0x15')]=function(_0x37e4c1,_0x59a9e3){moveContact(_0x37e4c1)[_0xbe14('0x9')](loggerCatch(_0x59a9e3));};exports[_0xbe14('0x16')]=function(_0x417c8d,_0xc12977,_0x188ec4){if(_0xc12977){_0x417c8d['UserId']=null;}if(_0x188ec4){_0x417c8d[_0xbe14('0x17')]=![];}return BPromise['resolve']()[_0xbe14('0xc')](cmHopper['rescheduleContact'](_0x417c8d))[_0xbe14('0x9')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xbe14('0x18')]=function(_0x3d3608){return BPromise['resolve']()[_0xbe14('0xc')](cmHopper['countReScheduled'](_0x3d3608))[_0xbe14('0x9')](loggerCatch('[countReScheduled]\x20'));};exports[_0xbe14('0x19')]=function(_0x5fa043){return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](cmHopper[_0xbe14('0x19')]({'UserId':null},_0x5fa043,0x1))[_0xbe14('0x9')](loggerCatch('[unlockContact]\x20'));};exports[_0xbe14('0x1a')]=function(_0x1ba46a){return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](cmHopper['unlockContact']({'active':![]},_0x1ba46a,0x1))[_0xbe14('0x9')](loggerCatch(_0xbe14('0x1b')));};exports['crateCustomerReportQueue']=function(_0x3c3613){var _0x3b3e84={};_0x3b3e84[_0xbe14('0x1c')]=_0x3c3613[_0xbe14('0x1c')];_0x3b3e84[_0xbe14('0x1d')]=_0x3c3613[_0xbe14('0x1d')];_0x3b3e84[_0xbe14('0x1e')]=_0x3c3613[_0xbe14('0x1e')];_0x3b3e84[_0xbe14('0x1f')]=_0x3c3613[_0xbe14('0x1f')];_0x3b3e84[_0xbe14('0x20')]=_0x3c3613[_0xbe14('0x20')];_0x3b3e84[_0xbe14('0x21')]=_0x3c3613[_0xbe14('0x22')];_0x3b3e84[_0xbe14('0x23')]=_0x3c3613[_0xbe14('0x22')];_0x3b3e84[_0xbe14('0x24')]=0x1;_0x3b3e84[_0xbe14('0x25')]=_0x3c3613[_0xbe14('0x26')];_0x3b3e84[_0xbe14('0x27')]=_0x3c3613['membername'];_0x3b3e84[_0xbe14('0x28')]='from-sip';_0x3b3e84['exten']=_0xbe14('0x29');_0x3b3e84['holdtime']=0x0;_0x3b3e84[_0xbe14('0x2a')]=0x1;_0x3b3e84[_0xbe14('0x2b')]=_0x3c3613['membername'];_0x3b3e84['queuecallerexitreason']='COMPLETED';return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](voiceQueueReport['create'](_0x3b3e84))[_0xbe14('0x9')](loggerCatch(_0xbe14('0x2c')));};exports[_0xbe14('0x2d')]=function(_0x1aa849,_0x29c23e){return BPromise['resolve']()['then'](cmHopper[_0xbe14('0x2d')](_0x1aa849,_0x29c23e))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x163ef7){return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](cmHopper[_0xbe14('0x16')](_0x163ef7,!![],!![]))[_0xbe14('0x9')](loggerCatch(_0xbe14('0x2e')));}; \ 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 46eba5e..fb4c5b7 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 _0xd65e=['callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','pow','replace','random','match','extractCalleridNumber','util','moment','../../../../config/logger','preview','env','127.0.0.1','milliseconds','diff','loggerCatch','error','inspect','logger2','info','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','isActive','isNil','addVariables','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','dialPreviewUrl','dialQueueProject','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','XMD-','toUpper','toLowerVariables','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','ringtime','membername','UserId','logCustomer','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','originate','channelAgent','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','minutes','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','interface','mandatoryDisposition','queue','uniqueid','agentReadyId','not_inuse','status','reachable','push','getDiff','seconds','createBody','CampaignId','filterKey','idContact','campaigntype','calleridnum','scheduledat','countglobal'];(function(_0x2b888c,_0x799a8c){var _0x9263b6=function(_0x3ccac9){while(--_0x3ccac9){_0x2b888c['push'](_0x2b888c['shift']());}};_0x9263b6(++_0x799a8c);}(_0xd65e,0xa2));var _0xed65=function(_0x26adbb,_0x3462c7){_0x26adbb=_0x26adbb-0x0;var _0x4e9a1b=_0xd65e[_0x26adbb];return _0x4e9a1b;};'use strict';var util=require(_0xed65('0x0'));var _=require('lodash');var moment=require(_0xed65('0x1'));var logger=require(_0xed65('0x2'))(_0xed65('0x3'));var ipAgi=process[_0xed65('0x4')]['XCALLY_IP_AGI']||_0xed65('0x5');function getSeconds(_0x46e583,_0x2a3f1c){var _0x2b7bf1=moment(_0x46e583)[_0xed65('0x6')](0x0);var _0x4fcd76=moment(_0x2a3f1c)[_0xed65('0x6')](0x0);return _0x2b7bf1[_0xed65('0x7')](_0x4fcd76,'seconds');}exports[_0xed65('0x8')]=function(_0x1be0a9){return function(_0x447053){logger[_0xed65('0x9')](_0x1be0a9,util[_0xed65('0xa')](_0x447053,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x2f5828,_0x1f2168){logger['info'](_0x2f5828,util[_0xed65('0xa')](_0x1f2168,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x1d00ba,_0x2cbb45){logger[_0xed65('0x9')](_0x1d00ba,util[_0xed65('0xa')](_0x2cbb45,{'showHidden':![],'depth':null}));};exports[_0xed65('0xb')]=function(_0xc66b0d){return function(_0x1e1d36){logger[_0xed65('0xc')](_0xc66b0d,util[_0xed65('0xa')](_0x1e1d36,{'showHidden':![],'depth':null}));};};exports[_0xed65('0xd')]=function(_0x3c3a9f,_0x1ac037,_0x7928a4){return{'message':_0x3c3a9f,'unlock':_0x1ac037,'active':_0x7928a4};};exports[_0xed65('0xe')]=function(_0x5c7a02,_0x26bfd9,_0x5dd818){if(!_[_0xed65('0xf')](_0x5dd818)&&_0xed65('0x10')===typeof _0x5dd818&&!_['isEmpty'](_0x5dd818)){if(!_[_0xed65('0xf')](_0x26bfd9)&&'string'===typeof _0x26bfd9&&!_[_0xed65('0x11')](_0x26bfd9)){return util['format'](_0xed65('0x12'),_0x26bfd9,_0x5dd818);}return util[_0xed65('0x13')](_0xed65('0x12'),_0x5dd818,_0x5dd818);}if(!_[_0xed65('0xf')](_0x5c7a02)&&_0xed65('0x10')===typeof _0x5c7a02&&!_[_0xed65('0x11')](_0x5c7a02)){return _0x5c7a02;}return'\x22\x22\x20<>';};exports[_0xed65('0x14')]=function(_0x1cdf9d){if(_[_0xed65('0x15')](_0x1cdf9d)){return![];}return _0x1cdf9d;};exports[_0xed65('0x16')]=function(_0x67f2e6,_0x4e5e7f,_0x59a1c7,_0xe5090f,_0x2ec244,_0x41b681){var _0x22559f={'XMD-QUEUE':_0x4e5e7f[_0xed65('0x17')]?_0x4e5e7f[_0xed65('0x17')][_0xed65('0x18')]:'','XMD-CALLERID':_0xe5090f,'XMD-CALLERID-PREVIEW':_0x41b681?util['format']('\x22%s\x22\x20<%s>',_0x41b681[_0xed65('0x19')],_0x41b681['calleridnum']):_0xe5090f,'XMD-DIALID':_0x2ec244,'XMD-CONTACTID':_0x4e5e7f[_0xed65('0x1a')],'XMD-CDRTYPE':_0xed65('0x1b'),'CALLERID(all)':_0xe5090f,'XMD-VOICEQUEUEID':_0x4e5e7f[_0xed65('0x1c')],'XMD-DIALCHANNEL':_0x59a1c7,'XMD-DIALTIMEOUT':_0x67f2e6[_0xed65('0x1d')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xed65('0x1e'),_0x67f2e6['dialQueueProject2']?'g':'',_['isEmpty'](_0x67f2e6[_0xed65('0x1f')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x67f2e6[_0xed65('0x20')]||'','XMD-AGI':_0x67f2e6[_0xed65('0x21')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x67f2e6['dialQueueProject']):_0xed65('0x22'),'XMD-AGIAFTER':_0x67f2e6[_0xed65('0x23')]?util[_0xed65('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x67f2e6[_0xed65('0x23')]):_0xed65('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x41b681?_0x41b681[_0xed65('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x41b681?_0x41b681[_0xed65('0x25')]:'','XMD-DESTINATION':_0xed65('0x26')};if(!_['isEmpty'](_0x67f2e6[_0xed65('0x1f')])){_0x22559f[util[_0xed65('0x13')]('%s',_0xed65('0x27'))]=_0x67f2e6[_0xed65('0x1f')];_0x22559f[util[_0xed65('0x13')]('%s',_0xed65('0x28'))]=_0x2ec244;}if(_0x4e5e7f&&_0x4e5e7f[_0xed65('0x29')]){for(var _0x5033d0 in _0x4e5e7f[_0xed65('0x29')]){if(_0x4e5e7f[_0xed65('0x29')][_0xed65('0x2a')](_0x5033d0)){if(!_[_0xed65('0x15')](_0x4e5e7f[_0xed65('0x29')][_0x5033d0])&&_0x5033d0!=='id'&&_0x5033d0!==_0xed65('0x2b')&&_0x5033d0!=='createdAt'&&_0x5033d0!=='updatedAt'){_0x22559f[util[_0xed65('0x13')]('%s%s',_0xed65('0x2c'),_[_0xed65('0x2d')](_0x5033d0))]=_0x4e5e7f[_0xed65('0x29')][_0x5033d0];}}}}return _0x22559f;};exports[_0xed65('0x2e')]=function(_0x77450a){var _0x146b9c={};for(var _0x3591ed in _0x77450a){if(_0x77450a['hasOwnProperty'](_0x3591ed)){_0x146b9c[util[_0xed65('0x13')]('%s',_['toLower'](_0x3591ed))]=_0x77450a[_0x3591ed];}}return{'variables':_0x146b9c};};exports['updateOriginated']=function(_0x6cefe6,_0x23c4af){if(!_[_0xed65('0x15')](_0x6cefe6)){if(_0x6cefe6[_0xed65('0x2a')](_0xed65('0x2f'))){if(_0x6cefe6[_0xed65('0x2f')]>0x0){_0x6cefe6['originated']-=0x1;}else{logger[_0xed65('0x9')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x23c4af);}}}else{logger[_0xed65('0x9')](_0xed65('0x30'),_0x23c4af);}};exports['logBlacklist']=function(_0xf7de49){var _0x5da4d6=moment()[_0xed65('0x13')](_0xed65('0x31'));_0xf7de49[_0xed65('0x32')]=0xd;_0xf7de49[_0xed65('0x33')]=_0xed65('0x34');_0xf7de49[_0xed65('0x35')]=_0x5da4d6;_0xf7de49[_0xed65('0x36')]=_0x5da4d6;_0xf7de49[_0xed65('0x37')]=_0x5da4d6;};exports['logAgent']=function(_0x1a2944,_0x3a6f66,_0x49dd09){var _0x142323=moment()[_0xed65('0x13')](_0xed65('0x31'));_0x1a2944[_0xed65('0x32')]=_0x3a6f66;_0x1a2944[_0xed65('0x33')]=_0x49dd09;_0x1a2944[_0xed65('0x36')]=_0x142323;_0x1a2944[_0xed65('0x38')]=getSeconds(_0x1a2944['responsetime'],_0x1a2944['starttime']);};exports['logLookAgent']=function(_0x1581ad,_0xa8378b,_0x3cc656){_0x1581ad[_0xed65('0x39')]=_0xa8378b;_0x1581ad[_0xed65('0x3a')]=_0x3cc656;};exports[_0xed65('0x3b')]=function(_0x4e49c0,_0x1bd71d,_0x35efa3){var _0x4373ec=moment()['format'](_0xed65('0x31'));_0x4e49c0['state']=_0x1bd71d;_0x4e49c0[_0xed65('0x33')]=_0x35efa3;_0x4e49c0['responsetime']=_0x4e49c0[_0xed65('0x36')]?_0x4e49c0[_0xed65('0x36')]:_0x4373ec;_0x4e49c0['endtime']=_0x4e49c0['endtime']?_0x4e49c0[_0xed65('0x37')]:_0x4373ec;_0x4e49c0['ringtime']=getSeconds(_0x4e49c0[_0xed65('0x36')]||0x0,_0x4e49c0[_0xed65('0x35')]||0x0);_0x4e49c0['talktime']=_0x4e49c0[_0xed65('0x3c')]?getSeconds(_0x4e49c0[_0xed65('0x37')],_0x4e49c0['answertime']):0x0;};exports[_0xed65('0x3d')]=function(_0x2aeb2e){return _0x2aeb2e===_0xed65('0x3e');};exports[_0xed65('0x3f')]=function(_0x37902f,_0x2cfdc1,_0x17abe9,_0x4bf6f3,_0x5651da){var _0x10e5b5=_0x4bf6f3?_0xed65('0x40'):_0x37902f[_0xed65('0x19')];_0x10e5b5=_0x5651da?_0xed65('0x41'):_0x10e5b5;return{'actionid':_0x37902f['uniqueid'],'action':_0xed65('0x42'),'channel':_0x37902f[_0xed65('0x43')],'callerid':util[_0xed65('0x13')](_0xed65('0x12'),_0x10e5b5,_0x37902f['calleridnum']),'Exten':_0xed65('0x26'),'Context':_0xed65('0x44'),'Priority':'1','variable':_0x17abe9,'timeout':(_0x2cfdc1['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x37902f['uniqueid']};};exports[_0xed65('0x45')]=function(_0x179da2){return _0x179da2[_0xed65('0x46')]+_0x179da2[_0xed65('0x47')]+_0x179da2[_0xed65('0x48')]+_0x179da2[_0xed65('0x49')]+_0x179da2[_0xed65('0x4a')];};exports[_0xed65('0x4b')]=function(_0x430a6b){var _0x3ad628=_[_0xed65('0x4c')](_0x430a6b);_0x3ad628['state']=0xf;_0x3ad628['statedesc']=_0xed65('0x4d');return _0x3ad628;};exports[_0xed65('0x4e')]=function(_0x2a6a51,_0x3e7292,_0x24338e){var _0x1bde91={};_0x1bde91[_0x3e7292]=_0x2a6a51[_0x3e7292];_0x1bde91[_0xed65('0x4f')]=![];_0x1bde91['scheduledat']=moment()[_0xed65('0x50')](_0x24338e,_0xed65('0x51'))[_0xed65('0x13')](_0xed65('0x31'));_0x1bde91[_0xed65('0x1a')]=_0x2a6a51[_0xed65('0x1a')];_0x1bde91['ListId']=_0x2a6a51['ListId'];_0x1bde91[_0xed65('0x1c')]=_0x2a6a51[_0xed65('0x1c')]||undefined;return _0x1bde91;};exports[_0xed65('0x52')]=function(_0x108c11,_0x3a86b4){if(!_[_0xed65('0x15')](_0x108c11)){if(_0x108c11['pTalking']>0x0){_0x108c11[_0xed65('0x53')]-=0x1;}else{logger[_0xed65('0x9')](_0x3a86b4,_0xed65('0x54'));}}else{logger['error'](_0x3a86b4,_0xed65('0x55'));}};exports[_0xed65('0x56')]=function(_0x36fcb8){if(_0x36fcb8<=0x0){return!![];}return![];};exports['buildObj']=function(_0x2a2506,_0x427e4a,_0x25f9cb){_0x2a2506['lastevent']=_0x427e4a;_0x2a2506['name']=_0x2a2506['queue'];_0x2a2506[_0xed65('0x57')]=_0x2a2506[_0xed65('0x43')];if(_0x25f9cb){_0x2a2506[_0xed65('0x58')]=_0x25f9cb['mandatoryDisposition'];}return _0x2a2506;};exports['buildAcw']=function(_0x9f4767){var _0x325592={};_0x325592[_0xed65('0x59')]=_0x9f4767[_0xed65('0x59')];_0x325592[_0xed65('0x57')]=_0x9f4767[_0xed65('0x43')];_0x325592['uniqueid']=_0x9f4767[_0xed65('0x5a')];return _0x325592;};exports[_0xed65('0x5b')]=function(_0x2b47ec){var _0x2c3370=[];for(var _0x4d1a68 in _0x2b47ec){if(_0x2b47ec[_0xed65('0x2a')](_0x4d1a68)){if(!_[_0xed65('0x15')](_0x2b47ec[_0x4d1a68])&&_0x2b47ec[_0x4d1a68][_0xed65('0x32')]===_0xed65('0x5c')&&_0x2b47ec[_0x4d1a68][_0xed65('0x5d')]===_0xed65('0x5e')){_0x2c3370[_0xed65('0x5f')](_0x2b47ec[_0x4d1a68]['id']);}}}return _0x2c3370;};exports[_0xed65('0x60')]=function(_0x25f990){var _0x7d2d7a=moment()[_0xed65('0x6')](0x0);var _0x1c5477=moment(_0x25f990)[_0xed65('0x6')](0x0);return _0x7d2d7a['diff'](_0x1c5477,_0xed65('0x61'));};exports[_0xed65('0x62')]=function(_0xbb2a75){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xbb2a75[_0xed65('0x1a')],'ListId':_0xbb2a75['ListId'],'VoiceQueueId':_0xbb2a75[_0xed65('0x1c')]||undefined,'CampaignId':_0xbb2a75[_0xed65('0x63')]||undefined};};exports[_0xed65('0x64')]=function(_0x3f01b6){if(_0x3f01b6===_0xed65('0x5a')||_0x3f01b6===_0xed65('0x65')||_0x3f01b6==='queue'||_0x3f01b6==='type'||_0x3f01b6===_0xed65('0x66')||_0x3f01b6==='dialAnswer'||_0x3f01b6===_0xed65('0x39')||_0x3f01b6===_0xed65('0x43')||_0x3f01b6===_0xed65('0x19')||_0x3f01b6===_0xed65('0x4f')||_0x3f01b6===_0xed65('0x67')||_0x3f01b6===_0xed65('0x68')||_0x3f01b6===_0xed65('0x46')||_0x3f01b6===_0xed65('0x47')||_0x3f01b6==='countnoanswerretry'||_0x3f01b6===_0xed65('0x69')||_0x3f01b6===_0xed65('0x6a')||_0x3f01b6==='callbackuniqueid'||_0x3f01b6===_0xed65('0x6b')||_0x3f01b6===_0xed65('0x6c')||_0x3f01b6===_0xed65('0x1a')||_0x3f01b6==='ListId'||_0x3f01b6===_0xed65('0x3a')||_0x3f01b6===_0xed65('0x1c')||_0x3f01b6===_0xed65('0x6d')||_0x3f01b6===_0xed65('0x6e')||_0x3f01b6===_0xed65('0x6f')||_0x3f01b6===_0xed65('0x70')||_0x3f01b6==='xmd-listid'||_0x3f01b6==='xmd-dialurl'||_0x3f01b6===_0xed65('0x71')||_0x3f01b6===_0xed65('0x72')||_0x3f01b6==='xmd-dialid'||_0x3f01b6===_0xed65('0x73')||_0x3f01b6===_0xed65('0x74')||_0x3f01b6===_0xed65('0x75')||_0x3f01b6==='xmd-callerid'||_0x3f01b6===_0xed65('0x76')||_0x3f01b6===_0xed65('0x77')||_0x3f01b6===_0xed65('0x78')||_0x3f01b6===_0xed65('0x79')||_0x3f01b6===_0xed65('0x7a')||_0x3f01b6===_0xed65('0x7b')||_0x3f01b6==='rtpaudioqosloss'||_0x3f01b6===_0xed65('0x7c')||_0x3f01b6==='rtpaudioqosrtt'||_0x3f01b6===_0xed65('0x7d')||_0x3f01b6===_0xed65('0x78')||_0x3f01b6===_0xed65('0x79')||_0x3f01b6===_0xed65('0x7a')||_0x3f01b6===_0xed65('0x7b')||_0x3f01b6===_0xed65('0x7e')||_0x3f01b6===_0xed65('0x7c')||_0x3f01b6==='rtpaudioqosrtt'||_0x3f01b6===_0xed65('0x7d')||_0x3f01b6===_0xed65('0x7f')||_0x3f01b6===_0xed65('0x80')||_0x3f01b6===_0xed65('0x32')||_0x3f01b6===_0xed65('0x33')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x14a17c,_0x33014c){var _0xe8cb89,_0x3e376a,_0x4cb34e;if(_0x33014c<=0x0){_0x33014c=0x1;}_0xe8cb89=new RegExp('\x5cw{0,'+_0x33014c+'}$');_0x3e376a=Math[_0xed65('0x81')](0xa,_0x33014c-0x1);_0x4cb34e=Math['pow'](0xa,_0x33014c)-0x1;return util['format']('%s',_[_0xed65('0x82')](_0x14a17c,_0xe8cb89,_[_0xed65('0x83')](_0x3e376a,_0x4cb34e)));};exports['extractCalleridName']=function(_0x22abe1){var _0x3d3f98=_0x22abe1[_0xed65('0x84')](/"(.*?)"/);return _0x3d3f98?_0x3d3f98[0x1]:_0x22abe1;};exports[_0xed65('0x85')]=function(_0xa53ef3){var _0x1757f4=_0xa53ef3[_0xed65('0x84')](/<(.*?)>/);return _0x1757f4?_0x1757f4[0x1]:_0xa53ef3;}; \ No newline at end of file +var _0x9413=['diff','seconds','loggerCatch','inspect','logger','info','loggerError','error','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','calleridname','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','updatedAt','%s%s','toUpper','toLowerVariables','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','statedesc','ringtime','logLookAgent','membername','UserId','logCustomer','answertime','RECALL','BOOKED','uniqueid','originate','calleridnum','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','minutes','ContactId','ListId','decrementTalkink','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','queue','interface','channelAgent','not_inuse','status','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','countnoanswerretry','countglobal','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds'];(function(_0x3dbb87,_0x47419d){var _0x141ca0=function(_0x3c101c){while(--_0x3c101c){_0x3dbb87['push'](_0x3dbb87['shift']());}};_0x141ca0(++_0x47419d);}(_0x9413,0x85));var _0x3941=function(_0x26bcec,_0xe13f50){_0x26bcec=_0x26bcec-0x0;var _0x1049dc=_0x9413[_0x26bcec];return _0x1049dc;};'use strict';var util=require('util');var _=require(_0x3941('0x0'));var moment=require(_0x3941('0x1'));var logger=require(_0x3941('0x2'))(_0x3941('0x3'));var ipAgi=process[_0x3941('0x4')][_0x3941('0x5')]||'127.0.0.1';function getSeconds(_0x300e49,_0x4f35d1){var _0x17639e=moment(_0x300e49)[_0x3941('0x6')](0x0);var _0x338071=moment(_0x4f35d1)['milliseconds'](0x0);return _0x17639e[_0x3941('0x7')](_0x338071,_0x3941('0x8'));}exports[_0x3941('0x9')]=function(_0x26cc76){return function(_0x507968){logger['error'](_0x26cc76,util[_0x3941('0xa')](_0x507968,{'showHidden':![],'depth':null}));};};exports[_0x3941('0xb')]=function(_0x4dd784,_0x494bbe){logger[_0x3941('0xc')](_0x4dd784,util[_0x3941('0xa')](_0x494bbe,{'showHidden':![],'depth':null}));};exports[_0x3941('0xd')]=function(_0xdfddad,_0x3b3685){logger[_0x3941('0xe')](_0xdfddad,util[_0x3941('0xa')](_0x3b3685,{'showHidden':![],'depth':null}));};exports[_0x3941('0xf')]=function(_0x443bdf){return function(_0x2d4a61){logger[_0x3941('0xc')](_0x443bdf,util[_0x3941('0xa')](_0x2d4a61,{'showHidden':![],'depth':null}));};};exports[_0x3941('0x10')]=function(_0x2b2f05,_0x3c4fd2,_0x140c84){return{'message':_0x2b2f05,'unlock':_0x3c4fd2,'active':_0x140c84};};exports[_0x3941('0x11')]=function(_0x5d4cdf,_0x407976,_0x2c5f71){if(!_[_0x3941('0x12')](_0x2c5f71)&&_0x3941('0x13')===typeof _0x2c5f71&&!_[_0x3941('0x14')](_0x2c5f71)){if(!_[_0x3941('0x12')](_0x407976)&&_0x3941('0x13')===typeof _0x407976&&!_[_0x3941('0x14')](_0x407976)){return util['format']('\x22%s\x22\x20<%s>',_0x407976,_0x2c5f71);}return util[_0x3941('0x15')](_0x3941('0x16'),_0x2c5f71,_0x2c5f71);}if(!_[_0x3941('0x12')](_0x5d4cdf)&&_0x3941('0x13')===typeof _0x5d4cdf&&!_['isEmpty'](_0x5d4cdf)){return _0x5d4cdf;}return _0x3941('0x17');};exports[_0x3941('0x18')]=function(_0x2b97d8){if(_[_0x3941('0x19')](_0x2b97d8)){return![];}return _0x2b97d8;};exports['addVariables']=function(_0x39f98d,_0x55aec2,_0x53d30a,_0x5b9e68,_0x39d9f0,_0x77b29f){var _0x26424c={'XMD-QUEUE':_0x55aec2['Queue']?_0x55aec2[_0x3941('0x1a')]['name']:'','XMD-CALLERID':_0x5b9e68,'XMD-CALLERID-PREVIEW':_0x77b29f?util[_0x3941('0x15')](_0x3941('0x16'),_0x77b29f[_0x3941('0x1b')],_0x77b29f['calleridnum']):_0x5b9e68,'XMD-DIALID':_0x39d9f0,'XMD-CONTACTID':_0x55aec2['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5b9e68,'XMD-VOICEQUEUEID':_0x55aec2[_0x3941('0x1c')],'XMD-DIALCHANNEL':_0x53d30a,'XMD-DIALTIMEOUT':_0x39f98d[_0x3941('0x1d')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x3941('0x1e'),_0x39f98d[_0x3941('0x1f')]?'g':'',_[_0x3941('0x14')](_0x39f98d[_0x3941('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x39f98d['dialPreviewUrl']||'','XMD-AGI':_0x39f98d[_0x3941('0x21')]?util[_0x3941('0x15')](_0x3941('0x22'),ipAgi,_0x39f98d[_0x3941('0x21')]):'NONE','XMD-AGIAFTER':_0x39f98d[_0x3941('0x1f')]?util[_0x3941('0x15')](_0x3941('0x22'),ipAgi,_0x39f98d[_0x3941('0x1f')]):_0x3941('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x77b29f?_0x77b29f[_0x3941('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x77b29f?_0x77b29f[_0x3941('0x25')]:'','XMD-DESTINATION':_0x3941('0x26')};if(!_[_0x3941('0x14')](_0x39f98d[_0x3941('0x20')])){_0x26424c[util[_0x3941('0x15')]('%s',_0x3941('0x27'))]=_0x39f98d[_0x3941('0x20')];_0x26424c[util['format']('%s',_0x3941('0x28'))]=_0x39d9f0;}if(_0x55aec2&&_0x55aec2['Contact']){for(var _0x2e6b00 in _0x55aec2[_0x3941('0x29')]){if(_0x55aec2['Contact']['hasOwnProperty'](_0x2e6b00)){if(!_[_0x3941('0x19')](_0x55aec2[_0x3941('0x29')][_0x2e6b00])&&_0x2e6b00!=='id'&&_0x2e6b00!=='tags'&&_0x2e6b00!=='createdAt'&&_0x2e6b00!==_0x3941('0x2a')){_0x26424c[util[_0x3941('0x15')](_0x3941('0x2b'),'XMD-',_[_0x3941('0x2c')](_0x2e6b00))]=_0x55aec2[_0x3941('0x29')][_0x2e6b00];}}}}return _0x26424c;};exports[_0x3941('0x2d')]=function(_0x459ada){var _0x482a08={};for(var _0x1923fb in _0x459ada){if(_0x459ada[_0x3941('0x2e')](_0x1923fb)){_0x482a08[util[_0x3941('0x15')]('%s',_['toLower'](_0x1923fb))]=_0x459ada[_0x1923fb];}}return{'variables':_0x482a08};};exports['updateOriginated']=function(_0x43d18e,_0x1deda6){if(!_[_0x3941('0x19')](_0x43d18e)){if(_0x43d18e[_0x3941('0x2e')]('originated')){if(_0x43d18e[_0x3941('0x2f')]>0x0){_0x43d18e[_0x3941('0x2f')]-=0x1;}else{logger['error'](_0x3941('0x30'),_0x1deda6);}}}else{logger[_0x3941('0xe')](_0x3941('0x31'),_0x1deda6);}};exports['logBlacklist']=function(_0xc93b2){var _0x3a4353=moment()[_0x3941('0x15')](_0x3941('0x32'));_0xc93b2[_0x3941('0x33')]=0xd;_0xc93b2['statedesc']=_0x3941('0x34');_0xc93b2[_0x3941('0x35')]=_0x3a4353;_0xc93b2[_0x3941('0x36')]=_0x3a4353;_0xc93b2[_0x3941('0x37')]=_0x3a4353;};exports[_0x3941('0x38')]=function(_0x3ab23d,_0x35ed17,_0x140e22){var _0x5d0026=moment()['format'](_0x3941('0x32'));_0x3ab23d['state']=_0x35ed17;_0x3ab23d[_0x3941('0x39')]=_0x140e22;_0x3ab23d[_0x3941('0x36')]=_0x5d0026;_0x3ab23d[_0x3941('0x3a')]=getSeconds(_0x3ab23d[_0x3941('0x36')],_0x3ab23d['starttime']);};exports[_0x3941('0x3b')]=function(_0xf1c4a7,_0xa13ad3,_0x41fd9f){_0xf1c4a7[_0x3941('0x3c')]=_0xa13ad3;_0xf1c4a7[_0x3941('0x3d')]=_0x41fd9f;};exports[_0x3941('0x3e')]=function(_0x4d733d,_0x11e36b,_0x1e10c3){var _0x93286a=moment()[_0x3941('0x15')](_0x3941('0x32'));_0x4d733d[_0x3941('0x33')]=_0x11e36b;_0x4d733d[_0x3941('0x39')]=_0x1e10c3;_0x4d733d[_0x3941('0x36')]=_0x4d733d['responsetime']?_0x4d733d[_0x3941('0x36')]:_0x93286a;_0x4d733d['endtime']=_0x4d733d[_0x3941('0x37')]?_0x4d733d[_0x3941('0x37')]:_0x93286a;_0x4d733d['ringtime']=getSeconds(_0x4d733d[_0x3941('0x36')]||0x0,_0x4d733d[_0x3941('0x35')]||0x0);_0x4d733d['talktime']=_0x4d733d['answertime']?getSeconds(_0x4d733d['endtime'],_0x4d733d[_0x3941('0x3f')]):0x0;};exports['isFailure']=function(_0x47311a){return _0x47311a==='Failure';};exports['variablesAction']=function(_0x173a91,_0x4b368d,_0x227897,_0x1f6955,_0x5ba180){var _0xd1a24f=_0x1f6955?_0x3941('0x40'):_0x173a91['calleridname'];_0xd1a24f=_0x5ba180?_0x3941('0x41'):_0xd1a24f;return{'actionid':_0x173a91[_0x3941('0x42')],'action':_0x3941('0x43'),'channel':_0x173a91['channelAgent'],'callerid':util['format']('\x22%s\x22\x20<%s>',_0xd1a24f,_0x173a91[_0x3941('0x44')]),'Exten':'xcally-motion-preview','Context':_0x3941('0x45'),'Priority':'1','variable':_0x227897,'timeout':(_0x4b368d[_0x3941('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x173a91[_0x3941('0x42')]};};exports[_0x3941('0x47')]=function(_0x201061){return _0x201061[_0x3941('0x48')]+_0x201061[_0x3941('0x49')]+_0x201061['countnoanswerretry']+_0x201061[_0x3941('0x4a')]+_0x201061[_0x3941('0x4b')];};exports[_0x3941('0x4c')]=function(_0x2e7b4b){var _0xfa1295=_[_0x3941('0x4d')](_0x2e7b4b);_0xfa1295[_0x3941('0x33')]=0xf;_0xfa1295['statedesc']='Global';return _0xfa1295;};exports[_0x3941('0x4e')]=function(_0x14c213,_0x48e774,_0x478013){var _0x1d15ed={};_0x1d15ed[_0x48e774]=_0x14c213[_0x48e774];_0x1d15ed[_0x3941('0x4f')]=![];_0x1d15ed['scheduledat']=moment()['add'](_0x478013,_0x3941('0x50'))[_0x3941('0x15')](_0x3941('0x32'));_0x1d15ed[_0x3941('0x51')]=_0x14c213[_0x3941('0x51')];_0x1d15ed[_0x3941('0x52')]=_0x14c213[_0x3941('0x52')];_0x1d15ed[_0x3941('0x1c')]=_0x14c213[_0x3941('0x1c')]||undefined;return _0x1d15ed;};exports[_0x3941('0x53')]=function(_0x55fc47,_0x148d18){if(!_['isNil'](_0x55fc47)){if(_0x55fc47['pTalking']>0x0){_0x55fc47['pTalking']-=0x1;}else{logger[_0x3941('0xe')](_0x148d18,_0x3941('0x54'));}}else{logger[_0x3941('0xe')](_0x148d18,_0x3941('0x55'));}};exports[_0x3941('0x56')]=function(_0x4ff214){if(_0x4ff214<=0x0){return!![];}return![];};exports[_0x3941('0x57')]=function(_0x17577c,_0x46b144,_0x244585){_0x17577c[_0x3941('0x58')]=_0x46b144;_0x17577c[_0x3941('0x59')]=_0x17577c[_0x3941('0x5a')];_0x17577c['interface']=_0x17577c['channelAgent'];if(_0x244585){_0x17577c['mandatoryDisposition']=_0x244585['mandatoryDisposition'];}return _0x17577c;};exports['buildAcw']=function(_0x1f3390){var _0xa2de96={};_0xa2de96['queue']=_0x1f3390[_0x3941('0x5a')];_0xa2de96[_0x3941('0x5b')]=_0x1f3390[_0x3941('0x5c')];_0xa2de96['uniqueid']=_0x1f3390[_0x3941('0x42')];return _0xa2de96;};exports['agentReadyId']=function(_0x2c7ab8){var _0x555787=[];for(var _0x511700 in _0x2c7ab8){if(_0x2c7ab8[_0x3941('0x2e')](_0x511700)){if(!_['isNil'](_0x2c7ab8[_0x511700])&&_0x2c7ab8[_0x511700][_0x3941('0x33')]===_0x3941('0x5d')&&_0x2c7ab8[_0x511700][_0x3941('0x5e')]==='reachable'){_0x555787['push'](_0x2c7ab8[_0x511700]['id']);}}}return _0x555787;};exports[_0x3941('0x5f')]=function(_0x1d259d){var _0x446042=moment()[_0x3941('0x6')](0x0);var _0x52a864=moment(_0x1d259d)[_0x3941('0x6')](0x0);return _0x446042[_0x3941('0x7')](_0x52a864,_0x3941('0x8'));};exports[_0x3941('0x60')]=function(_0x524644){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x524644['ContactId'],'ListId':_0x524644[_0x3941('0x52')],'VoiceQueueId':_0x524644[_0x3941('0x1c')]||undefined,'CampaignId':_0x524644[_0x3941('0x61')]||undefined};};exports[_0x3941('0x62')]=function(_0x53e15d){if(_0x53e15d===_0x3941('0x42')||_0x53e15d===_0x3941('0x63')||_0x53e15d==='queue'||_0x53e15d===_0x3941('0x64')||_0x53e15d===_0x3941('0x65')||_0x53e15d==='dialAnswer'||_0x53e15d==='membername'||_0x53e15d===_0x3941('0x5c')||_0x53e15d===_0x3941('0x1b')||_0x53e15d===_0x3941('0x4f')||_0x53e15d===_0x3941('0x44')||_0x53e15d==='scheduledat'||_0x53e15d==='countbusyretry'||_0x53e15d==='countcongestionretry'||_0x53e15d===_0x3941('0x66')||_0x53e15d===_0x3941('0x67')||_0x53e15d==='callback'||_0x53e15d===_0x3941('0x68')||_0x53e15d===_0x3941('0x69')||_0x53e15d===_0x3941('0x6a')||_0x53e15d==='ContactId'||_0x53e15d===_0x3941('0x52')||_0x53e15d===_0x3941('0x3d')||_0x53e15d===_0x3941('0x1c')||_0x53e15d===_0x3941('0x6b')||_0x53e15d===_0x3941('0x6c')||_0x53e15d===_0x3941('0x6d')||_0x53e15d===_0x3941('0x6e')||_0x53e15d===_0x3941('0x6f')||_0x53e15d===_0x3941('0x70')||_0x53e15d===_0x3941('0x71')||_0x53e15d===_0x3941('0x72')||_0x53e15d===_0x3941('0x73')||_0x53e15d===_0x3941('0x74')||_0x53e15d===_0x3941('0x75')||_0x53e15d===_0x3941('0x76')||_0x53e15d===_0x3941('0x77')||_0x53e15d===_0x3941('0x78')||_0x53e15d===_0x3941('0x79')||_0x53e15d===_0x3941('0x7a')||_0x53e15d===_0x3941('0x7b')||_0x53e15d===_0x3941('0x7c')||_0x53e15d===_0x3941('0x7d')||_0x53e15d===_0x3941('0x7e')||_0x53e15d===_0x3941('0x7f')||_0x53e15d===_0x3941('0x80')||_0x53e15d===_0x3941('0x81')||_0x53e15d===_0x3941('0x7a')||_0x53e15d===_0x3941('0x7b')||_0x53e15d===_0x3941('0x7c')||_0x53e15d==='rtpaudioqosjitterbridged'||_0x53e15d===_0x3941('0x7e')||_0x53e15d===_0x3941('0x7f')||_0x53e15d===_0x3941('0x80')||_0x53e15d===_0x3941('0x81')||_0x53e15d===_0x3941('0x82')||_0x53e15d===_0x3941('0x83')||_0x53e15d==='state'||_0x53e15d==='statedesc'){return![];}return!![];};exports[_0x3941('0x84')]=function(_0x2202d6,_0xe88460){var _0x184841,_0x269497,_0x4e1a77;if(_0xe88460<=0x0){_0xe88460=0x1;}_0x184841=new RegExp(_0x3941('0x85')+_0xe88460+'}$');_0x269497=Math[_0x3941('0x86')](0xa,_0xe88460-0x1);_0x4e1a77=Math[_0x3941('0x86')](0xa,_0xe88460)-0x1;return util['format']('%s',_[_0x3941('0x87')](_0x2202d6,_0x184841,_[_0x3941('0x88')](_0x269497,_0x4e1a77)));};exports[_0x3941('0x89')]=function(_0x2e23b1){var _0x4ccc66=_0x2e23b1[_0x3941('0x8a')](/"(.*?)"/);return _0x4ccc66?_0x4ccc66[0x1]:_0x2e23b1;};exports[_0x3941('0x8b')]=function(_0x5c3925){var _0x19b25e=_0x5c3925[_0x3941('0x8a')](/<(.*?)>/);return _0x19b25e?_0x19b25e[0x1]:_0x5c3925;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 167a463..c0d65f5 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 _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x390cb3,_0x3230be){var _0x35c44e=function(_0x11eb37){while(--_0x11eb37){_0x390cb3['push'](_0x390cb3['shift']());}};_0x35c44e(++_0x3230be);}(_0x7a54,0x106));var _0x47a5=function(_0x8d0875,_0x539566){_0x8d0875=_0x8d0875-0x0;var _0x31f066=_0x7a54[_0x8d0875];return _0x31f066;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x476962,_0x48d0ad){var _0x24258=function(_0x2c0a53){while(--_0x2c0a53){_0x476962['push'](_0x476962['shift']());}};_0x24258(++_0x48d0ad);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4c3c8b,_0x4c4917){_0x4c3c8b=_0x4c3c8b-0x0;var _0x4a154e=_0x5f2f[_0x4c3c8b];return _0x4a154e;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 28bb83b..1511899 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 _0xd34e=['mergeFromDatabase','initTelephones','telephones','initTrunks','isUndefined','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercompleteAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isNil'];(function(_0x59c5b7,_0x4fb175){var _0x1a79ff=function(_0x419869){while(--_0x419869){_0x59c5b7['push'](_0x59c5b7['shift']());}};_0x1a79ff(++_0x4fb175);}(_0xd34e,0x175));var _0xed34=function(_0x921ce,_0x4a42a0){_0x921ce=_0x921ce-0x0;var _0x226349=_0xd34e[_0x921ce];return _0x226349;};'use strict';var BPromise=require(_0xed34('0x0'));var util=require(_0xed34('0x1'));var _=require(_0xed34('0x2'));var moment=require(_0xed34('0x3'));var Agent=require(_0xed34('0x4'));var Telephone=require(_0xed34('0x5'));var Trunk=require(_0xed34('0x6'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xed34('0x7'));var Template=require(_0xed34('0x8'));var Campaign=require(_0xed34('0x9'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xed34('0xa'));var SalesforceAccount=require(_0xed34('0xb'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xed34('0xc'));var ZohoAccount=require(_0xed34('0xd'));var DeskAccount=require(_0xed34('0xe'));var VtigerAccount=require(_0xed34('0xf'));var ServicenowAccount=require(_0xed34('0x10'));var Dynamics365Account=require(_0xed34('0x11'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xed34('0x12'));var Realtime=function(){this['agents']={};this['telephones']={};this[_0xed34('0x13')]={};this[_0xed34('0x14')]={};this[_0xed34('0x15')]={};this[_0xed34('0x16')]={};this[_0xed34('0x17')]={};this[_0xed34('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xed34('0x19')]={};this[_0xed34('0x1a')]={};this[_0xed34('0x1b')]={};this['outboundChannels']={};this[_0xed34('0x1c')]={};this[_0xed34('0x1d')]={};this[_0xed34('0x1e')]={};this[_0xed34('0x1f')]={};this[_0xed34('0x20')]={};this[_0xed34('0x21')]={};this[_0xed34('0x22')]={};this[_0xed34('0x23')]={};this[_0xed34('0x24')]={};this[_0xed34('0x25')]={};this['freshsalesAccounts']={};this[_0xed34('0x26')]={};};function freeIsNotKey(_0x1190b8,_0x15bbd3,_0x206465){var _0x5ad308=_[_0xed34('0x27')](_0x1190b8,function(_0x2e7cb0,_0x4b699d){return _0x2e7cb0[_0x206465];});for(var _0x32d53d in _0x15bbd3){if(_0x15bbd3[_0xed34('0x28')](_0x32d53d)){if(!_0x5ad308[_0x32d53d]){delete _0x15bbd3[_0x32d53d];}}}}function freeIsNotKeySip(_0x48296f,_0x500bbe){var _0x243c4d=_[_0xed34('0x27')](_0x48296f,function(_0x5cdec7,_0x17f4af){return util[_0xed34('0x29')](_0xed34('0x2a'),_0x5cdec7[_0xed34('0x2b')]);});for(var _0x1c885d in _0x500bbe){if(_0x500bbe[_0xed34('0x28')](_0x1c885d)){if(!_0x243c4d[_0x1c885d]){delete _0x500bbe[_0x1c885d];}}}}function freeIsNotKeyAgent(_0x49de73,_0x2d11ad){var _0x2514fb=_['mapKeys'](_0x49de73,function(_0x2cb224,_0x403323){var _0x247fa1=_['isNil'](_0x2cb224[_0xed34('0x2c')])?util[_0xed34('0x29')]('SIP/%s',_0x2cb224[_0xed34('0x2b')]):_0x2cb224[_0xed34('0x2c')];return _0x247fa1;});for(var _0x1e6f77 in _0x2d11ad){if(_0x2d11ad[_0xed34('0x28')](_0x1e6f77)){if(!_0x2514fb[_0x1e6f77]){delete _0x2d11ad[_0x1e6f77];}}}}function clearVoiceCallReports(_0x547b84){_0x547b84[_0xed34('0x2d')]=0x0;_0x547b84[_0xed34('0x2e')]=0x0;_0x547b84[_0xed34('0x2f')]=0x0;_0x547b84[_0xed34('0x30')]=0x0;_0x547b84[_0xed34('0x31')]=0x0;}function clearCampaigns(_0x354744){if(!_[_0xed34('0x32')](_0x354744)){for(var _0x131b4c in _0x354744){if(_0x354744[_0xed34('0x28')](_0x131b4c)){_0x354744[_0x131b4c][_0xed34('0x33')]=0x0;_0x354744[_0x131b4c][_0xed34('0x34')]=0x0;}}}}function clearVoiceQueues(_0x2aea8){if(!_[_0xed34('0x32')](_0x2aea8)){for(var _0x1aa768 in _0x2aea8){if(_0x2aea8[_0xed34('0x28')](_0x1aa768)){_0x2aea8[_0x1aa768][_0xed34('0x2d')]=0x0;_0x2aea8[_0x1aa768][_0xed34('0x2e')]=0x0;_0x2aea8[_0x1aa768][_0xed34('0x35')]=0x0;_0x2aea8[_0x1aa768][_0xed34('0x36')]=0x0;_0x2aea8[_0x1aa768][_0xed34('0x2f')]=0x0;_0x2aea8[_0x1aa768][_0xed34('0x30')]=0x0;_0x2aea8[_0x1aa768][_0xed34('0x31')]=0x0;_0x2aea8[_0x1aa768]['outboundAnswerAgiCallsDay']=0x0;_0x2aea8[_0x1aa768][_0xed34('0x37')]=0x0;_0x2aea8[_0x1aa768][_0xed34('0x38')]=0x0;_0x2aea8[_0x1aa768][_0xed34('0x39')]=0x0;_0x2aea8[_0x1aa768][_0xed34('0x3a')]=0x0;_0x2aea8[_0x1aa768]['outboundUnknownCallsDay']=0x0;_0x2aea8[_0x1aa768][_0xed34('0x3b')]=0x0;_0x2aea8[_0x1aa768]['outboundDropCallsDayCallersExit']=0x0;_0x2aea8[_0x1aa768][_0xed34('0x3c')]=0x0;_0x2aea8[_0x1aa768][_0xed34('0x3d')]=0x0;_0x2aea8[_0x1aa768][_0xed34('0x3e')]=0x0;_0x2aea8[_0x1aa768][_0xed34('0x3f')]=0x0;_0x2aea8[_0x1aa768]['outboundAnswerAgiCallsDay']=0x0;_0x2aea8[_0x1aa768][_0xed34('0x40')]=0x0;_0x2aea8[_0x1aa768][_0xed34('0x41')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x553f32,_0x6f136d){for(var _0x361374 in _0x6f136d){if(_0x553f32['hasOwnProperty'](_0x361374)){_0x553f32[_0x361374]=_0x6f136d[_0x361374];}}};Realtime[_0xed34('0x42')][_0xed34('0x43')]=function(){var _0x492d5d=this;return function(_0x474eba){if(_0x474eba){freeIsNotKeyAgent(_0x474eba,_0x492d5d[_0xed34('0x44')]);for(var _0x506f21=0x0,_0x3b6966={},_0x4a59f9={};_0x506f21<_0x474eba[_0xed34('0x45')];_0x506f21+=0x1){_0x3b6966=_0x474eba[_0x506f21];var _0x2642ef=_[_0xed34('0x46')](_0x3b6966['interface'])?util[_0xed34('0x29')](_0xed34('0x2a'),_0x3b6966[_0xed34('0x2b')]):_0x3b6966[_0xed34('0x2c')];if(_['isUndefined'](_0x492d5d[_0xed34('0x44')][_0x2642ef])){_0x492d5d['agents'][_0x2642ef]=new Agent(_0x3b6966);}else{_0x492d5d[_0xed34('0x47')](_0x492d5d[_0xed34('0x44')][_0x2642ef],_0x3b6966);}}}return _0x492d5d[_0xed34('0x44')];};};Realtime[_0xed34('0x42')][_0xed34('0x48')]=function(){var _0x2e786c=this;return function(_0x314934){if(_0x314934){freeIsNotKeySip(_0x314934,_0x2e786c[_0xed34('0x49')]);for(var _0x4c7b90=0x0,_0x2b8fd4={},_0x1befdf={};_0x4c7b90<_0x314934[_0xed34('0x45')];_0x4c7b90+=0x1){_0x2b8fd4=_0x314934[_0x4c7b90];if(_['isUndefined'](_0x2e786c[_0xed34('0x49')][util[_0xed34('0x29')](_0xed34('0x2a'),_0x2b8fd4[_0xed34('0x2b')])])){_0x2e786c[_0xed34('0x49')][util[_0xed34('0x29')](_0xed34('0x2a'),_0x2b8fd4[_0xed34('0x2b')])]=new Telephone(_0x2b8fd4);}else{_0x2e786c[_0xed34('0x47')](_0x2e786c[_0xed34('0x49')][util[_0xed34('0x29')](_0xed34('0x2a'),_0x2b8fd4['name'])],_0x2b8fd4);}}}return _0x2e786c[_0xed34('0x49')];};};Realtime[_0xed34('0x42')][_0xed34('0x4a')]=function(){var _0x413430=this;return function(_0x7762d3){if(_0x7762d3){freeIsNotKeySip(_0x7762d3,_0x413430[_0xed34('0x13')]);for(var _0x33184d=0x0,_0x1519a6={},_0x48b3cc={};_0x33184d<_0x7762d3[_0xed34('0x45')];_0x33184d+=0x1){_0x1519a6=_0x7762d3[_0x33184d];if(_[_0xed34('0x4b')](_0x413430[_0xed34('0x13')][util[_0xed34('0x29')](_0xed34('0x2a'),_0x1519a6[_0xed34('0x2b')])])){_0x413430[_0xed34('0x13')][util[_0xed34('0x29')]('SIP/%s',_0x1519a6['name'])]=new Trunk(_0x1519a6);}else{_0x413430[_0xed34('0x47')](_0x413430[_0xed34('0x13')][util[_0xed34('0x29')](_0xed34('0x2a'),_0x1519a6[_0xed34('0x2b')])],_0x1519a6);}}}return _0x413430[_0xed34('0x13')];};};Realtime[_0xed34('0x42')][_0xed34('0x4c')]=function(){var _0x4a907c=this;return function(_0x34b05e){if(_0x34b05e){freeIsNotKey(_0x34b05e,_0x4a907c[_0xed34('0x14')],_0xed34('0x2b'));for(var _0x200f64=0x0,_0x493567={},_0x3a6d79={};_0x200f64<_0x34b05e['length'];_0x200f64+=0x1){_0x493567=_0x34b05e[_0x200f64];if(_[_0xed34('0x4b')](_0x4a907c[_0xed34('0x14')][_0x493567['name']])){_0x4a907c['voiceQueues'][_0x493567[_0xed34('0x2b')]]=new VoiceQueue(_0x493567);}else{_0x4a907c[_0xed34('0x47')](_0x4a907c[_0xed34('0x14')][_0x493567[_0xed34('0x2b')]],_0x493567);}}}return _0x4a907c[_0xed34('0x14')];};};Realtime[_0xed34('0x42')][_0xed34('0x4d')]=function(){var _0x5bf117=this;return function(_0x239f90){if(_0x239f90){freeIsNotKey(_0x239f90,_0x5bf117['triggers'],'id');for(var _0x13f10c=0x0,_0x14c580={},_0x5a6eeb={};_0x13f10c<_0x239f90[_0xed34('0x45')];_0x13f10c+=0x1){_0x14c580=_0x239f90[_0x13f10c];if(_[_0xed34('0x4b')](_0x5bf117[_0xed34('0x15')][_0x14c580['id']])){_0x5bf117[_0xed34('0x15')][_0x14c580['id']]=new Trigger(_0x14c580);}else{_0x5bf117['mergeFromDatabase'](_0x5bf117[_0xed34('0x15')][_0x14c580['id']],_0x14c580);}}}return _0x5bf117[_0xed34('0x15')];};};Realtime[_0xed34('0x42')][_0xed34('0x4e')]=function(){var _0x1ca271=this;return function(_0x5d2e60){if(_0x5d2e60){freeIsNotKey(_0x5d2e60,_0x1ca271[_0xed34('0x17')],'id');for(var _0x1fc988=0x0,_0xc57087={},_0x18062c={};_0x1fc988<_0x5d2e60[_0xed34('0x45')];_0x1fc988+=0x1){_0xc57087=_0x5d2e60[_0x1fc988];if(_[_0xed34('0x4b')](_0x1ca271[_0xed34('0x17')][_0xc57087['id']])){_0x1ca271[_0xed34('0x17')][_0xc57087['id']]=new Template(_0xc57087);}else{_0x1ca271[_0xed34('0x47')](_0x1ca271[_0xed34('0x17')][_0xc57087['id']],_0xc57087);}}}return _0x1ca271[_0xed34('0x17')];};};Realtime[_0xed34('0x42')][_0xed34('0x4f')]=function(){var _0x246156=this;return function(_0x3b03bd){if(_0x3b03bd){freeIsNotKey(_0x3b03bd,_0x246156['zendeskAccounts'],'id');for(var _0x57b203=0x0,_0x2ff7b8={},_0xd6d6f9={};_0x57b203<_0x3b03bd[_0xed34('0x45')];_0x57b203+=0x1){_0x2ff7b8=_0x3b03bd[_0x57b203];if(_[_0xed34('0x4b')](_0x246156[_0xed34('0x1d')][_0x2ff7b8['id']])){_0x246156['zendeskAccounts'][_0x2ff7b8['id']]=new ZendeskAccount(_0x2ff7b8);}else{_0x246156[_0xed34('0x47')](_0x246156[_0xed34('0x1d')][_0x2ff7b8['id']],_0x2ff7b8);}}}return _0x246156[_0xed34('0x1d')];};};Realtime[_0xed34('0x42')][_0xed34('0x50')]=function(){var _0x5cd6ae=this;return function(_0x131c73){if(_0x131c73){freeIsNotKey(_0x131c73,_0x5cd6ae['salesforceAccounts'],'id');for(var _0x311fdd=0x0,_0x24af0d={},_0x4c19ec={};_0x311fdd<_0x131c73['length'];_0x311fdd+=0x1){_0x24af0d=_0x131c73[_0x311fdd];if(_[_0xed34('0x4b')](_0x5cd6ae[_0xed34('0x1e')][_0x24af0d['id']])){_0x5cd6ae[_0xed34('0x1e')][_0x24af0d['id']]=new SalesforceAccount(_0x24af0d);}else{_0x5cd6ae[_0xed34('0x47')](_0x5cd6ae['salesforceAccounts'][_0x24af0d['id']],_0x24af0d);}}}return _0x5cd6ae[_0xed34('0x1e')];};};Realtime[_0xed34('0x42')][_0xed34('0x51')]=function(){var _0x26376f=this;return function(_0x2bec0b){if(_0x2bec0b){freeIsNotKey(_0x2bec0b,_0x26376f[_0xed34('0x20')],'id');for(var _0x4b1340=0x0,_0x162f16={},_0x4f0d38={};_0x4b1340<_0x2bec0b['length'];_0x4b1340+=0x1){_0x162f16=_0x2bec0b[_0x4b1340];if(_[_0xed34('0x4b')](_0x26376f[_0xed34('0x20')][_0x162f16['id']])){_0x26376f['freshdeskAccounts'][_0x162f16['id']]=new FreshdeskAccount(_0x162f16);}else{_0x26376f[_0xed34('0x47')](_0x26376f[_0xed34('0x20')][_0x162f16['id']],_0x162f16);}}}return _0x26376f[_0xed34('0x20')];};};Realtime[_0xed34('0x42')]['initZohoAccounts']=function(){var _0x5e5b1a=this;return function(_0x33a23b){if(_0x33a23b){freeIsNotKey(_0x33a23b,_0x5e5b1a[_0xed34('0x21')],'id');for(var _0x154d12=0x0,_0x51c7f8={},_0x569993={};_0x154d12<_0x33a23b[_0xed34('0x45')];_0x154d12+=0x1){_0x51c7f8=_0x33a23b[_0x154d12];if(_[_0xed34('0x4b')](_0x5e5b1a[_0xed34('0x21')][_0x51c7f8['id']])){_0x5e5b1a['zohoAccounts'][_0x51c7f8['id']]=new ZohoAccount(_0x51c7f8);}else{_0x5e5b1a['mergeFromDatabase'](_0x5e5b1a['zohoAccounts'][_0x51c7f8['id']],_0x51c7f8);}}}return _0x5e5b1a['zohoAccounts'];};};Realtime['prototype']['initDeskAccounts']=function(){var _0x47e876=this;return function(_0x535df9){if(_0x535df9){freeIsNotKey(_0x535df9,_0x47e876[_0xed34('0x22')],'id');for(var _0x638cdc=0x0,_0x1a4f34={},_0x4e9a72={};_0x638cdc<_0x535df9[_0xed34('0x45')];_0x638cdc+=0x1){_0x1a4f34=_0x535df9[_0x638cdc];if(_[_0xed34('0x4b')](_0x47e876[_0xed34('0x22')][_0x1a4f34['id']])){_0x47e876[_0xed34('0x22')][_0x1a4f34['id']]=new DeskAccount(_0x1a4f34);}else{_0x47e876[_0xed34('0x47')](_0x47e876[_0xed34('0x22')][_0x1a4f34['id']],_0x1a4f34);}}}return _0x47e876['deskAccounts'];};};Realtime[_0xed34('0x42')][_0xed34('0x52')]=function(){var _0x28accc=this;return function(_0x5d26b7){if(_0x5d26b7){freeIsNotKey(_0x5d26b7,_0x28accc['sugarcrmAccounts'],'id');for(var _0x2f5436=0x0,_0x2fa2e8={},_0xf15eb0={};_0x2f5436<_0x5d26b7[_0xed34('0x45')];_0x2f5436+=0x1){_0x2fa2e8=_0x5d26b7[_0x2f5436];if(_[_0xed34('0x4b')](_0x28accc[_0xed34('0x1f')][_0x2fa2e8['id']])){_0x28accc[_0xed34('0x1f')][_0x2fa2e8['id']]=new SugarcrmAccount(_0x2fa2e8);}else{_0x28accc[_0xed34('0x47')](_0x28accc[_0xed34('0x1f')][_0x2fa2e8['id']],_0x2fa2e8);}}}return _0x28accc[_0xed34('0x1f')];};};Realtime[_0xed34('0x42')][_0xed34('0x53')]=function(){var _0x84aa2d=this;return function(_0x42533a){if(_0x42533a){freeIsNotKey(_0x42533a,_0x84aa2d['vtigerAccounts'],'id');for(var _0x25d333=0x0,_0x567b6c={},_0x2f26d4={};_0x25d333<_0x42533a[_0xed34('0x45')];_0x25d333+=0x1){_0x567b6c=_0x42533a[_0x25d333];if(_[_0xed34('0x4b')](_0x84aa2d[_0xed34('0x23')][_0x567b6c['id']])){_0x84aa2d[_0xed34('0x23')][_0x567b6c['id']]=new VtigerAccount(_0x567b6c);}else{_0x84aa2d[_0xed34('0x47')](_0x84aa2d[_0xed34('0x23')][_0x567b6c['id']],_0x567b6c);}}}return _0x84aa2d['vtigerAccounts'];};};Realtime[_0xed34('0x42')][_0xed34('0x54')]=function(){var _0x1a6bc3=this;return function(_0x925a2){if(_0x925a2){freeIsNotKey(_0x925a2,_0x1a6bc3[_0xed34('0x24')],'id');for(var _0x3b96da=0x0,_0x6b6770={},_0x1c1ec6={};_0x3b96da<_0x925a2[_0xed34('0x45')];_0x3b96da+=0x1){_0x6b6770=_0x925a2[_0x3b96da];if(_[_0xed34('0x4b')](_0x1a6bc3[_0xed34('0x24')][_0x6b6770['id']])){_0x1a6bc3[_0xed34('0x24')][_0x6b6770['id']]=new ServicenowAccount(_0x6b6770);}else{_0x1a6bc3[_0xed34('0x47')](_0x1a6bc3[_0xed34('0x24')][_0x6b6770['id']],_0x6b6770);}}}return _0x1a6bc3[_0xed34('0x24')];};};Realtime[_0xed34('0x42')][_0xed34('0x55')]=function(){var _0x51f037=this;return function(_0x27a513){if(_0x27a513){freeIsNotKey(_0x27a513,_0x51f037[_0xed34('0x25')],'id');for(var _0x27b107=0x0,_0x5f9aeb={},_0x1dfe6b={};_0x27b107<_0x27a513[_0xed34('0x45')];_0x27b107+=0x1){_0x5f9aeb=_0x27a513[_0x27b107];if(_[_0xed34('0x4b')](_0x51f037[_0xed34('0x25')][_0x5f9aeb['id']])){_0x51f037[_0xed34('0x25')][_0x5f9aeb['id']]=new Dynamics365Account(_0x5f9aeb);}else{_0x51f037['mergeFromDatabase'](_0x51f037[_0xed34('0x25')][_0x5f9aeb['id']],_0x5f9aeb);}}}return _0x51f037['dynamics365Accounts'];};};Realtime[_0xed34('0x42')][_0xed34('0x56')]=function(){var _0x2f4735=this;return function(_0x19b325){if(_0x19b325){freeIsNotKey(_0x19b325,_0x2f4735['freshsalesAccounts'],'id');for(var _0x740026=0x0,_0x4ddf4a={},_0x303f61={};_0x740026<_0x19b325[_0xed34('0x45')];_0x740026+=0x1){_0x4ddf4a=_0x19b325[_0x740026];if(_[_0xed34('0x4b')](_0x2f4735[_0xed34('0x57')][_0x4ddf4a['id']])){_0x2f4735[_0xed34('0x57')][_0x4ddf4a['id']]=new FreshsalesAccount(_0x4ddf4a);}else{_0x2f4735['mergeFromDatabase'](_0x2f4735[_0xed34('0x57')][_0x4ddf4a['id']],_0x4ddf4a);}}}return _0x2f4735[_0xed34('0x57')];};};Realtime[_0xed34('0x42')][_0xed34('0x58')]=function(){var _0xb15d14=this;return function(_0x48bb49){for(var _0x4138a4=0x0;_0x4138a4<_0x48bb49['length'];_0x4138a4+=0x1){_[_0xed34('0x59')](_0xb15d14[_0xed34('0x14')][_0x48bb49[_0x4138a4]['name']],_0x48bb49[_0x4138a4]);}return _0xb15d14[_0xed34('0x14')];};};Realtime[_0xed34('0x42')][_0xed34('0x5a')]=function(){var _0x6b4aee=this;return function(_0x12ac97){clearVoiceQueues(_0x6b4aee[_0xed34('0x14')]);if(_0x12ac97){_0x12ac97=_['groupBy'](_0x12ac97,_0xed34('0x5b'));for(var _0x49d5b2 in _0x12ac97){if(_0x12ac97[_0xed34('0x28')](_0x49d5b2)){var _0x2884a0={};for(var _0x1d6bab=0x0;_0x1d6bab<_0x12ac97[_0x49d5b2][_0xed34('0x45')];_0x1d6bab+=0x1){var _0x1134d6=_0x12ac97[_0x49d5b2][_0x1d6bab][_0xed34('0x5c')];if(_0x6b4aee[_0xed34('0x14')][_0x1134d6]){if(_0x12ac97[_0x49d5b2][_0x1d6bab][_0xed34('0x5d')]){_0x6b4aee[_0xed34('0x14')][_0x1134d6]['unmanaged']+=0x1;}if(_0x12ac97[_0x49d5b2][_0x1d6bab]['queuecallerabandon']){_0x6b4aee[_0xed34('0x14')][_0x1134d6][_0xed34('0x36')]+=0x1;}_0x6b4aee[_0xed34('0x14')][_0x1134d6][_0xed34('0x2f')]+=moment(_0x12ac97[_0x49d5b2][_0x1d6bab][_0xed34('0x5e')])[_0xed34('0x5f')](moment(_0x12ac97[_0x49d5b2][_0x1d6bab]['queuecallerjoinAt']),_0xed34('0x60'))||0x0;if(_0x1d6bab===_0x12ac97[_0x49d5b2][_0xed34('0x45')]-0x1){_0x6b4aee[_0xed34('0x14')][_0x1134d6][_0xed34('0x30')]+=moment(_0x12ac97[_0x49d5b2][_0x1d6bab]['queuecallercompleteAt']||_0x12ac97[_0x49d5b2][_0x1d6bab][_0xed34('0x61')]||_0x12ac97[_0x49d5b2][_0x1d6bab][_0xed34('0x62')])[_0xed34('0x5f')](moment(_0x12ac97[_0x49d5b2][_0x1d6bab][_0xed34('0x63')]),_0xed34('0x60'))||0x0;_0x6b4aee[_0xed34('0x14')][_0x1134d6][_0xed34('0x2d')]+=0x1;if(_0x12ac97[_0x49d5b2][_0x1d6bab]['queuecallercomplete']){_0x6b4aee['voiceQueues'][_0x1134d6][_0xed34('0x2e')]+=0x1;_0x6b4aee['voiceQueues'][_0x1134d6][_0xed34('0x31')]+=moment(_0x12ac97[_0x49d5b2][_0x1d6bab][_0xed34('0x64')])['diff'](moment(_0x12ac97[_0x49d5b2][_0x1d6bab][_0xed34('0x5e')]),_0xed34('0x60'))||0x0;}}else{_0x6b4aee[_0xed34('0x14')][_0x1134d6][_0xed34('0x30')]+=_0x6b4aee[_0xed34('0x14')][_0x1134d6]['sumHoldTime']||0x0;}}}}}}return _0x6b4aee[_0xed34('0x14')];};};Realtime[_0xed34('0x42')][_0xed34('0x65')]=function(){var _0x6184e=this;return function(_0x1af107){clearVoiceCallReports(_0x6184e['outbound']);if(_0x1af107){for(var _0x439183=0x0;_0x439183<_0x1af107['length'];_0x439183+=0x1){_0x6184e[_0xed34('0x18')][_0xed34('0x2d')]+=0x1;_0x6184e['outbound'][_0xed34('0x30')]+=_0x1af107[_0x439183][_0xed34('0x66')];if(_0x1af107[_0x439183][_0xed34('0x67')]===_0xed34('0x68')){_0x6184e['outbound'][_0xed34('0x2e')]+=0x1;_0x6184e[_0xed34('0x18')][_0xed34('0x2f')]+=_0x1af107[_0x439183][_0xed34('0x66')]-_0x1af107[_0x439183][_0xed34('0x69')]||0x0;_0x6184e[_0xed34('0x18')][_0xed34('0x31')]+=_0x1af107[_0x439183][_0xed34('0x69')];}}}return _0x6184e[_0xed34('0x18')];};};Realtime['prototype']['initCampaigns']=function(){var _0x17d0f5=this;return function(_0x1e7b0f){if(_0x1e7b0f){freeIsNotKey(_0x1e7b0f,_0x17d0f5['campaigns'],_0xed34('0x2b'));for(var _0x1f52e2=0x0,_0x2cdbeb={};_0x1f52e2<_0x1e7b0f[_0xed34('0x45')];_0x1f52e2+=0x1){_0x2cdbeb=_0x1e7b0f[_0x1f52e2];if(_[_0xed34('0x4b')](_0x17d0f5[_0xed34('0x16')][_0x2cdbeb['name']])){_0x17d0f5['campaigns'][_0x2cdbeb[_0xed34('0x2b')]]=new Campaign(_0x2cdbeb);}else{_0x17d0f5['mergeFromDatabase'](_0x17d0f5['campaigns'][_0x2cdbeb[_0xed34('0x2b')]],_0x2cdbeb);_0x17d0f5[_0xed34('0x16')][_0x2cdbeb['name']]['dialQueueProject']=_0x2cdbeb[_0xed34('0x6a')]?_0x2cdbeb[_0xed34('0x6a')][_0xed34('0x2b')]:undefined;}}}return _0x17d0f5[_0xed34('0x16')];};};Realtime[_0xed34('0x42')][_0xed34('0x6b')]=function(){var _0x331d09=this;return function(_0x87fe6){if(_0x87fe6){freeIsNotKey(_0x87fe6,_0x331d09[_0xed34('0x19')],'id');for(var _0x30dd19=0x0,_0x30cff2={};_0x30dd19<_0x87fe6['length'];_0x30dd19+=0x1){_0x30cff2=_0x87fe6[_0x30dd19];if(_[_0xed34('0x4b')](_0x331d09[_0xed34('0x19')][_0x30cff2['id']])){_0x331d09[_0xed34('0x19')][_0x30cff2['id']]=new VoiceExtension(_0x30cff2);}else{_0x331d09[_0xed34('0x47')](_0x331d09['voiceExtensions'][_0x30cff2['id']],_0x30cff2);}}}return _0x331d09[_0xed34('0x19')];};};Realtime[_0xed34('0x42')][_0xed34('0x6c')]=function(){var _0x1832e0=this;return function(_0x255125){clearCampaigns(_0x1832e0[_0xed34('0x16')]);for(var _0x36378d=0x0;_0x36378d<_0x255125[_0xed34('0x45')];_0x36378d+=0x1){_[_0xed34('0x59')](_0x1832e0['campaigns'][_0x255125[_0x36378d][_0xed34('0x2b')]],_0x255125[_0x36378d]);}return _0x1832e0[_0xed34('0x16')];};};Realtime[_0xed34('0x42')][_0xed34('0x6d')]=function(){var _0x3e54d7=this;return function(_0x290bc7){if(_0x290bc7){freeIsNotKey(_0x290bc7,_0x3e54d7[_0xed34('0x26')],'id');for(var _0x3c56ab=0x0,_0x1d7664={},_0xc5fd17={};_0x3c56ab<_0x290bc7['length'];_0x3c56ab+=0x1){_0x1d7664=_0x290bc7[_0x3c56ab];if(_[_0xed34('0x4b')](_0x3e54d7[_0xed34('0x26')][_0x1d7664['id']])){_0x3e54d7['faxAccounts'][_0x1d7664['id']]=new FaxAccount(_0x1d7664);}else{_0x3e54d7['mergeFromDatabase'](_0x3e54d7[_0xed34('0x26')][_0x1d7664['id']],_0x1d7664);}}}return _0x3e54d7[_0xed34('0x26')];};};module[_0xed34('0x6e')]=Realtime; \ No newline at end of file +var _0x64b7=['initVoiceCallReports','outbound','disposition','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','SIP/%s','name','interface','total','sumHoldTime','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','abandoned','sumDuration','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','initTelephones','initTrunks','isUndefined','initVoiceQueues','voiceQueues','initTriggers','triggers','initTemplates','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','zohoAccounts','deskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallerleaveAt'];(function(_0x22ee66,_0x4cb001){var _0x127c6f=function(_0x57cb1b){while(--_0x57cb1b){_0x22ee66['push'](_0x22ee66['shift']());}};_0x127c6f(++_0x4cb001);}(_0x64b7,0x78));var _0x764b=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x64b7[_0x1035c1];return _0x308d67;};'use strict';var BPromise=require(_0x764b('0x0'));var util=require(_0x764b('0x1'));var _=require(_0x764b('0x2'));var moment=require(_0x764b('0x3'));var Agent=require(_0x764b('0x4'));var Telephone=require('../model/telephone');var Trunk=require(_0x764b('0x5'));var VoiceQueue=require(_0x764b('0x6'));var Trigger=require(_0x764b('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0x764b('0x8'));var ZendeskAccount=require(_0x764b('0x9'));var SalesforceAccount=require(_0x764b('0xa'));var FreshdeskAccount=require(_0x764b('0xb'));var SugarcrmAccount=require(_0x764b('0xc'));var ZohoAccount=require(_0x764b('0xd'));var DeskAccount=require(_0x764b('0xe'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x764b('0xf'));var FreshsalesAccount=require(_0x764b('0x10'));var FaxAccount=require(_0x764b('0x11'));var Realtime=function(){this[_0x764b('0x12')]={};this[_0x764b('0x13')]={};this[_0x764b('0x14')]={};this['voiceQueues']={};this['triggers']={};this['campaigns']={};this[_0x764b('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x764b('0x16')]={};this[_0x764b('0x17')]={};this[_0x764b('0x18')]={};this[_0x764b('0x19')]={};this[_0x764b('0x1a')]={};this['zendeskAccounts']={};this[_0x764b('0x1b')]={};this[_0x764b('0x1c')]={};this[_0x764b('0x1d')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0x764b('0x1e')]={};this[_0x764b('0x1f')]={};this[_0x764b('0x20')]={};this[_0x764b('0x21')]={};this[_0x764b('0x22')]={};};function freeIsNotKey(_0x4a5d20,_0x3253cb,_0x50cfcc){var _0x44b2fd=_['mapKeys'](_0x4a5d20,function(_0x5d71e0,_0x416265){return _0x5d71e0[_0x50cfcc];});for(var _0xd9bb40 in _0x3253cb){if(_0x3253cb[_0x764b('0x23')](_0xd9bb40)){if(!_0x44b2fd[_0xd9bb40]){delete _0x3253cb[_0xd9bb40];}}}}function freeIsNotKeySip(_0x3a1e3f,_0x2094a3){var _0x3c665e=_[_0x764b('0x24')](_0x3a1e3f,function(_0x5abfba,_0x23f5cb){return util[_0x764b('0x25')](_0x764b('0x26'),_0x5abfba[_0x764b('0x27')]);});for(var _0x141eda in _0x2094a3){if(_0x2094a3[_0x764b('0x23')](_0x141eda)){if(!_0x3c665e[_0x141eda]){delete _0x2094a3[_0x141eda];}}}}function freeIsNotKeyAgent(_0x1d8839,_0x4c7db2){var _0x20b994=_['mapKeys'](_0x1d8839,function(_0x52ac82,_0x2ee69e){var _0x2c1015=_['isNil'](_0x52ac82['interface'])?util[_0x764b('0x25')](_0x764b('0x26'),_0x52ac82[_0x764b('0x27')]):_0x52ac82[_0x764b('0x28')];return _0x2c1015;});for(var _0x575803 in _0x4c7db2){if(_0x4c7db2[_0x764b('0x23')](_0x575803)){if(!_0x20b994[_0x575803]){delete _0x4c7db2[_0x575803];}}}}function clearVoiceCallReports(_0x871be){_0x871be[_0x764b('0x29')]=0x0;_0x871be['answered']=0x0;_0x871be[_0x764b('0x2a')]=0x0;_0x871be['sumDuration']=0x0;_0x871be['sumBillable']=0x0;}function clearCampaigns(_0x3716d0){if(!_[_0x764b('0x2b')](_0x3716d0)){for(var _0x344c28 in _0x3716d0){if(_0x3716d0['hasOwnProperty'](_0x344c28)){_0x3716d0[_0x344c28][_0x764b('0x2c')]=0x0;_0x3716d0[_0x344c28][_0x764b('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x1b2f17){if(!_[_0x764b('0x2b')](_0x1b2f17)){for(var _0x53bfce in _0x1b2f17){if(_0x1b2f17[_0x764b('0x23')](_0x53bfce)){_0x1b2f17[_0x53bfce]['total']=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x2e')]=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x2f')]=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x30')]=0x0;_0x1b2f17[_0x53bfce]['sumHoldTime']=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x31')]=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x32')]=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x33')]=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x34')]=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x35')]=0x0;_0x1b2f17[_0x53bfce]['outboundCongestionCallsDay']=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x36')]=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x37')]=0x0;_0x1b2f17[_0x53bfce]['outboundDropCallsDayTimeout']=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x38')]=0x0;_0x1b2f17[_0x53bfce]['outboundBlacklistCallsDay']=0x0;_0x1b2f17[_0x53bfce]['outboundOriginateFailureCallsDay']=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x39')]=0x0;_0x1b2f17[_0x53bfce]['outboundReCallsDay']=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x33')]=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x3a')]=0x0;_0x1b2f17[_0x53bfce][_0x764b('0x3b')]=!![];}}}}Realtime[_0x764b('0x3c')][_0x764b('0x3d')]=function(_0x2803c7,_0x5a2484){for(var _0x51b522 in _0x5a2484){if(_0x2803c7[_0x764b('0x23')](_0x51b522)){_0x2803c7[_0x51b522]=_0x5a2484[_0x51b522];}}};Realtime[_0x764b('0x3c')][_0x764b('0x3e')]=function(){var _0x4dc9fc=this;return function(_0x1cc061){if(_0x1cc061){freeIsNotKeyAgent(_0x1cc061,_0x4dc9fc[_0x764b('0x12')]);for(var _0x79ec1e=0x0,_0x11465c={},_0x2a42be={};_0x79ec1e<_0x1cc061[_0x764b('0x3f')];_0x79ec1e+=0x1){_0x11465c=_0x1cc061[_0x79ec1e];var _0x5d928e=_['isNil'](_0x11465c[_0x764b('0x28')])?util['format'](_0x764b('0x26'),_0x11465c['name']):_0x11465c[_0x764b('0x28')];if(_['isUndefined'](_0x4dc9fc['agents'][_0x5d928e])){_0x4dc9fc['agents'][_0x5d928e]=new Agent(_0x11465c);}else{_0x4dc9fc[_0x764b('0x3d')](_0x4dc9fc[_0x764b('0x12')][_0x5d928e],_0x11465c);}}}return _0x4dc9fc[_0x764b('0x12')];};};Realtime['prototype'][_0x764b('0x40')]=function(){var _0x3faead=this;return function(_0x2f9af5){if(_0x2f9af5){freeIsNotKeySip(_0x2f9af5,_0x3faead['telephones']);for(var _0x4d82c9=0x0,_0x2e1457={},_0x40873c={};_0x4d82c9<_0x2f9af5[_0x764b('0x3f')];_0x4d82c9+=0x1){_0x2e1457=_0x2f9af5[_0x4d82c9];if(_['isUndefined'](_0x3faead[_0x764b('0x13')][util[_0x764b('0x25')]('SIP/%s',_0x2e1457[_0x764b('0x27')])])){_0x3faead['telephones'][util[_0x764b('0x25')](_0x764b('0x26'),_0x2e1457['name'])]=new Telephone(_0x2e1457);}else{_0x3faead[_0x764b('0x3d')](_0x3faead[_0x764b('0x13')][util['format'](_0x764b('0x26'),_0x2e1457[_0x764b('0x27')])],_0x2e1457);}}}return _0x3faead['telephones'];};};Realtime['prototype'][_0x764b('0x41')]=function(){var _0x2043fb=this;return function(_0x8cefa4){if(_0x8cefa4){freeIsNotKeySip(_0x8cefa4,_0x2043fb['trunks']);for(var _0x140434=0x0,_0x1262e9={},_0x365e46={};_0x140434<_0x8cefa4[_0x764b('0x3f')];_0x140434+=0x1){_0x1262e9=_0x8cefa4[_0x140434];if(_[_0x764b('0x42')](_0x2043fb['trunks'][util['format'](_0x764b('0x26'),_0x1262e9['name'])])){_0x2043fb[_0x764b('0x14')][util[_0x764b('0x25')](_0x764b('0x26'),_0x1262e9[_0x764b('0x27')])]=new Trunk(_0x1262e9);}else{_0x2043fb[_0x764b('0x3d')](_0x2043fb[_0x764b('0x14')][util['format'](_0x764b('0x26'),_0x1262e9[_0x764b('0x27')])],_0x1262e9);}}}return _0x2043fb['trunks'];};};Realtime[_0x764b('0x3c')][_0x764b('0x43')]=function(){var _0x358885=this;return function(_0x152e7d){if(_0x152e7d){freeIsNotKey(_0x152e7d,_0x358885[_0x764b('0x44')],'name');for(var _0x467f50=0x0,_0xc987e6={},_0x5283ad={};_0x467f50<_0x152e7d[_0x764b('0x3f')];_0x467f50+=0x1){_0xc987e6=_0x152e7d[_0x467f50];if(_['isUndefined'](_0x358885[_0x764b('0x44')][_0xc987e6['name']])){_0x358885[_0x764b('0x44')][_0xc987e6['name']]=new VoiceQueue(_0xc987e6);}else{_0x358885[_0x764b('0x3d')](_0x358885[_0x764b('0x44')][_0xc987e6[_0x764b('0x27')]],_0xc987e6);}}}return _0x358885[_0x764b('0x44')];};};Realtime[_0x764b('0x3c')][_0x764b('0x45')]=function(){var _0x1b9d3a=this;return function(_0x1e8dd6){if(_0x1e8dd6){freeIsNotKey(_0x1e8dd6,_0x1b9d3a[_0x764b('0x46')],'id');for(var _0x669eda=0x0,_0x3b8796={},_0x52ed71={};_0x669eda<_0x1e8dd6[_0x764b('0x3f')];_0x669eda+=0x1){_0x3b8796=_0x1e8dd6[_0x669eda];if(_['isUndefined'](_0x1b9d3a['triggers'][_0x3b8796['id']])){_0x1b9d3a['triggers'][_0x3b8796['id']]=new Trigger(_0x3b8796);}else{_0x1b9d3a[_0x764b('0x3d')](_0x1b9d3a[_0x764b('0x46')][_0x3b8796['id']],_0x3b8796);}}}return _0x1b9d3a[_0x764b('0x46')];};};Realtime[_0x764b('0x3c')][_0x764b('0x47')]=function(){var _0x2b25b8=this;return function(_0x3b8197){if(_0x3b8197){freeIsNotKey(_0x3b8197,_0x2b25b8['templates'],'id');for(var _0x3f41fb=0x0,_0x39f858={},_0x156d61={};_0x3f41fb<_0x3b8197[_0x764b('0x3f')];_0x3f41fb+=0x1){_0x39f858=_0x3b8197[_0x3f41fb];if(_['isUndefined'](_0x2b25b8[_0x764b('0x15')][_0x39f858['id']])){_0x2b25b8['templates'][_0x39f858['id']]=new Template(_0x39f858);}else{_0x2b25b8[_0x764b('0x3d')](_0x2b25b8[_0x764b('0x15')][_0x39f858['id']],_0x39f858);}}}return _0x2b25b8[_0x764b('0x15')];};};Realtime[_0x764b('0x3c')]['initZendeskAccounts']=function(){var _0x44671b=this;return function(_0x1be0c2){if(_0x1be0c2){freeIsNotKey(_0x1be0c2,_0x44671b['zendeskAccounts'],'id');for(var _0x54fcb6=0x0,_0x483bab={},_0x40a769={};_0x54fcb6<_0x1be0c2['length'];_0x54fcb6+=0x1){_0x483bab=_0x1be0c2[_0x54fcb6];if(_[_0x764b('0x42')](_0x44671b[_0x764b('0x48')][_0x483bab['id']])){_0x44671b[_0x764b('0x48')][_0x483bab['id']]=new ZendeskAccount(_0x483bab);}else{_0x44671b[_0x764b('0x3d')](_0x44671b[_0x764b('0x48')][_0x483bab['id']],_0x483bab);}}}return _0x44671b[_0x764b('0x48')];};};Realtime['prototype'][_0x764b('0x49')]=function(){var _0x511b5b=this;return function(_0x3c3445){if(_0x3c3445){freeIsNotKey(_0x3c3445,_0x511b5b['salesforceAccounts'],'id');for(var _0x29c2bd=0x0,_0x56e4d7={},_0xc6b897={};_0x29c2bd<_0x3c3445['length'];_0x29c2bd+=0x1){_0x56e4d7=_0x3c3445[_0x29c2bd];if(_[_0x764b('0x42')](_0x511b5b[_0x764b('0x1b')][_0x56e4d7['id']])){_0x511b5b['salesforceAccounts'][_0x56e4d7['id']]=new SalesforceAccount(_0x56e4d7);}else{_0x511b5b[_0x764b('0x3d')](_0x511b5b[_0x764b('0x1b')][_0x56e4d7['id']],_0x56e4d7);}}}return _0x511b5b[_0x764b('0x1b')];};};Realtime[_0x764b('0x3c')][_0x764b('0x4a')]=function(){var _0x2ace43=this;return function(_0x28e794){if(_0x28e794){freeIsNotKey(_0x28e794,_0x2ace43[_0x764b('0x1d')],'id');for(var _0x322b93=0x0,_0x5d2a5f={},_0x27ae15={};_0x322b93<_0x28e794[_0x764b('0x3f')];_0x322b93+=0x1){_0x5d2a5f=_0x28e794[_0x322b93];if(_[_0x764b('0x42')](_0x2ace43[_0x764b('0x1d')][_0x5d2a5f['id']])){_0x2ace43[_0x764b('0x1d')][_0x5d2a5f['id']]=new FreshdeskAccount(_0x5d2a5f);}else{_0x2ace43[_0x764b('0x3d')](_0x2ace43[_0x764b('0x1d')][_0x5d2a5f['id']],_0x5d2a5f);}}}return _0x2ace43[_0x764b('0x1d')];};};Realtime[_0x764b('0x3c')]['initZohoAccounts']=function(){var _0x4ae5c5=this;return function(_0xb7f4bf){if(_0xb7f4bf){freeIsNotKey(_0xb7f4bf,_0x4ae5c5[_0x764b('0x4b')],'id');for(var _0x55650a=0x0,_0x4d796b={},_0x517eac={};_0x55650a<_0xb7f4bf[_0x764b('0x3f')];_0x55650a+=0x1){_0x4d796b=_0xb7f4bf[_0x55650a];if(_['isUndefined'](_0x4ae5c5['zohoAccounts'][_0x4d796b['id']])){_0x4ae5c5[_0x764b('0x4b')][_0x4d796b['id']]=new ZohoAccount(_0x4d796b);}else{_0x4ae5c5[_0x764b('0x3d')](_0x4ae5c5['zohoAccounts'][_0x4d796b['id']],_0x4d796b);}}}return _0x4ae5c5[_0x764b('0x4b')];};};Realtime['prototype']['initDeskAccounts']=function(){var _0x473978=this;return function(_0x18c5da){if(_0x18c5da){freeIsNotKey(_0x18c5da,_0x473978[_0x764b('0x4c')],'id');for(var _0x4f5faa=0x0,_0x22dc61={},_0x119efc={};_0x4f5faa<_0x18c5da[_0x764b('0x3f')];_0x4f5faa+=0x1){_0x22dc61=_0x18c5da[_0x4f5faa];if(_[_0x764b('0x42')](_0x473978[_0x764b('0x4c')][_0x22dc61['id']])){_0x473978[_0x764b('0x4c')][_0x22dc61['id']]=new DeskAccount(_0x22dc61);}else{_0x473978[_0x764b('0x3d')](_0x473978[_0x764b('0x4c')][_0x22dc61['id']],_0x22dc61);}}}return _0x473978[_0x764b('0x4c')];};};Realtime[_0x764b('0x3c')]['initSugarcrmAccounts']=function(){var _0x24774b=this;return function(_0x2b2434){if(_0x2b2434){freeIsNotKey(_0x2b2434,_0x24774b[_0x764b('0x1c')],'id');for(var _0x476b85=0x0,_0x5c89c0={},_0x190665={};_0x476b85<_0x2b2434['length'];_0x476b85+=0x1){_0x5c89c0=_0x2b2434[_0x476b85];if(_[_0x764b('0x42')](_0x24774b[_0x764b('0x1c')][_0x5c89c0['id']])){_0x24774b[_0x764b('0x1c')][_0x5c89c0['id']]=new SugarcrmAccount(_0x5c89c0);}else{_0x24774b[_0x764b('0x3d')](_0x24774b['sugarcrmAccounts'][_0x5c89c0['id']],_0x5c89c0);}}}return _0x24774b[_0x764b('0x1c')];};};Realtime[_0x764b('0x3c')][_0x764b('0x4d')]=function(){var _0x129387=this;return function(_0xf811bb){if(_0xf811bb){freeIsNotKey(_0xf811bb,_0x129387[_0x764b('0x1e')],'id');for(var _0x3b6554=0x0,_0x186a58={},_0xf84dcf={};_0x3b6554<_0xf811bb[_0x764b('0x3f')];_0x3b6554+=0x1){_0x186a58=_0xf811bb[_0x3b6554];if(_[_0x764b('0x42')](_0x129387[_0x764b('0x1e')][_0x186a58['id']])){_0x129387['vtigerAccounts'][_0x186a58['id']]=new VtigerAccount(_0x186a58);}else{_0x129387[_0x764b('0x3d')](_0x129387[_0x764b('0x1e')][_0x186a58['id']],_0x186a58);}}}return _0x129387[_0x764b('0x1e')];};};Realtime['prototype'][_0x764b('0x4e')]=function(){var _0x5e6e35=this;return function(_0x59a53f){if(_0x59a53f){freeIsNotKey(_0x59a53f,_0x5e6e35['servicenowAccounts'],'id');for(var _0x233c2b=0x0,_0x43e314={},_0xf9edc6={};_0x233c2b<_0x59a53f[_0x764b('0x3f')];_0x233c2b+=0x1){_0x43e314=_0x59a53f[_0x233c2b];if(_[_0x764b('0x42')](_0x5e6e35[_0x764b('0x1f')][_0x43e314['id']])){_0x5e6e35[_0x764b('0x1f')][_0x43e314['id']]=new ServicenowAccount(_0x43e314);}else{_0x5e6e35['mergeFromDatabase'](_0x5e6e35[_0x764b('0x1f')][_0x43e314['id']],_0x43e314);}}}return _0x5e6e35[_0x764b('0x1f')];};};Realtime['prototype'][_0x764b('0x4f')]=function(){var _0x37780b=this;return function(_0x289f83){if(_0x289f83){freeIsNotKey(_0x289f83,_0x37780b[_0x764b('0x20')],'id');for(var _0x147f4a=0x0,_0x5396d7={},_0x3c1afd={};_0x147f4a<_0x289f83[_0x764b('0x3f')];_0x147f4a+=0x1){_0x5396d7=_0x289f83[_0x147f4a];if(_[_0x764b('0x42')](_0x37780b[_0x764b('0x20')][_0x5396d7['id']])){_0x37780b[_0x764b('0x20')][_0x5396d7['id']]=new Dynamics365Account(_0x5396d7);}else{_0x37780b[_0x764b('0x3d')](_0x37780b['dynamics365Accounts'][_0x5396d7['id']],_0x5396d7);}}}return _0x37780b[_0x764b('0x20')];};};Realtime['prototype'][_0x764b('0x50')]=function(){var _0x5f13b9=this;return function(_0x511675){if(_0x511675){freeIsNotKey(_0x511675,_0x5f13b9['freshsalesAccounts'],'id');for(var _0x396873=0x0,_0x2545eb={},_0x59b2f6={};_0x396873<_0x511675['length'];_0x396873+=0x1){_0x2545eb=_0x511675[_0x396873];if(_[_0x764b('0x42')](_0x5f13b9[_0x764b('0x21')][_0x2545eb['id']])){_0x5f13b9[_0x764b('0x21')][_0x2545eb['id']]=new FreshsalesAccount(_0x2545eb);}else{_0x5f13b9['mergeFromDatabase'](_0x5f13b9['freshsalesAccounts'][_0x2545eb['id']],_0x2545eb);}}}return _0x5f13b9[_0x764b('0x21')];};};Realtime['prototype'][_0x764b('0x51')]=function(){var _0x29cb8e=this;return function(_0x1f98c0){for(var _0x55eb35=0x0;_0x55eb35<_0x1f98c0[_0x764b('0x3f')];_0x55eb35+=0x1){_[_0x764b('0x52')](_0x29cb8e[_0x764b('0x44')][_0x1f98c0[_0x55eb35][_0x764b('0x27')]],_0x1f98c0[_0x55eb35]);}return _0x29cb8e[_0x764b('0x44')];};};Realtime[_0x764b('0x3c')]['initVoiceQueueReports']=function(){var _0x2080e9=this;return function(_0x1e363c){clearVoiceQueues(_0x2080e9[_0x764b('0x44')]);if(_0x1e363c){_0x1e363c=_[_0x764b('0x53')](_0x1e363c,_0x764b('0x54'));for(var _0x4cffec in _0x1e363c){if(_0x1e363c['hasOwnProperty'](_0x4cffec)){var _0x341d20={};for(var _0x13c27e=0x0;_0x13c27e<_0x1e363c[_0x4cffec]['length'];_0x13c27e+=0x1){var _0x2b3de0=_0x1e363c[_0x4cffec][_0x13c27e][_0x764b('0x55')];if(_0x2080e9[_0x764b('0x44')][_0x2b3de0]){if(_0x1e363c[_0x4cffec][_0x13c27e][_0x764b('0x56')]){_0x2080e9[_0x764b('0x44')][_0x2b3de0][_0x764b('0x2f')]+=0x1;}if(_0x1e363c[_0x4cffec][_0x13c27e][_0x764b('0x57')]){_0x2080e9[_0x764b('0x44')][_0x2b3de0][_0x764b('0x30')]+=0x1;}_0x2080e9[_0x764b('0x44')][_0x2b3de0][_0x764b('0x2a')]+=moment(_0x1e363c[_0x4cffec][_0x13c27e]['queuecallerleaveAt'])[_0x764b('0x58')](moment(_0x1e363c[_0x4cffec][_0x13c27e]['queuecallerjoinAt']),_0x764b('0x59'))||0x0;if(_0x13c27e===_0x1e363c[_0x4cffec]['length']-0x1){_0x2080e9[_0x764b('0x44')][_0x2b3de0][_0x764b('0x31')]+=moment(_0x1e363c[_0x4cffec][_0x13c27e][_0x764b('0x5a')]||_0x1e363c[_0x4cffec][_0x13c27e][_0x764b('0x5b')]||_0x1e363c[_0x4cffec][_0x13c27e][_0x764b('0x5c')])[_0x764b('0x58')](moment(_0x1e363c[_0x4cffec][_0x13c27e][_0x764b('0x5d')]),_0x764b('0x59'))||0x0;_0x2080e9[_0x764b('0x44')][_0x2b3de0][_0x764b('0x29')]+=0x1;if(_0x1e363c[_0x4cffec][_0x13c27e][_0x764b('0x5e')]){_0x2080e9[_0x764b('0x44')][_0x2b3de0][_0x764b('0x2e')]+=0x1;_0x2080e9[_0x764b('0x44')][_0x2b3de0][_0x764b('0x32')]+=moment(_0x1e363c[_0x4cffec][_0x13c27e][_0x764b('0x5a')])[_0x764b('0x58')](moment(_0x1e363c[_0x4cffec][_0x13c27e][_0x764b('0x5f')]),_0x764b('0x59'))||0x0;}}else{_0x2080e9[_0x764b('0x44')][_0x2b3de0][_0x764b('0x31')]+=_0x2080e9[_0x764b('0x44')][_0x2b3de0][_0x764b('0x2a')]||0x0;}}}}}}return _0x2080e9[_0x764b('0x44')];};};Realtime['prototype'][_0x764b('0x60')]=function(){var _0x4ede56=this;return function(_0x189da3){clearVoiceCallReports(_0x4ede56[_0x764b('0x61')]);if(_0x189da3){for(var _0x36da54=0x0;_0x36da54<_0x189da3[_0x764b('0x3f')];_0x36da54+=0x1){_0x4ede56[_0x764b('0x61')][_0x764b('0x29')]+=0x1;_0x4ede56['outbound'][_0x764b('0x31')]+=_0x189da3[_0x36da54]['duration'];if(_0x189da3[_0x36da54][_0x764b('0x62')]==='ANSWERED'){_0x4ede56[_0x764b('0x61')][_0x764b('0x2e')]+=0x1;_0x4ede56[_0x764b('0x61')][_0x764b('0x2a')]+=_0x189da3[_0x36da54][_0x764b('0x63')]-_0x189da3[_0x36da54][_0x764b('0x64')]||0x0;_0x4ede56[_0x764b('0x61')][_0x764b('0x32')]+=_0x189da3[_0x36da54][_0x764b('0x64')];}}}return _0x4ede56[_0x764b('0x61')];};};Realtime[_0x764b('0x3c')][_0x764b('0x65')]=function(){var _0x315238=this;return function(_0x4a2869){if(_0x4a2869){freeIsNotKey(_0x4a2869,_0x315238[_0x764b('0x66')],_0x764b('0x27'));for(var _0x13daa8=0x0,_0x1a7656={};_0x13daa8<_0x4a2869[_0x764b('0x3f')];_0x13daa8+=0x1){_0x1a7656=_0x4a2869[_0x13daa8];if(_[_0x764b('0x42')](_0x315238[_0x764b('0x66')][_0x1a7656['name']])){_0x315238['campaigns'][_0x1a7656[_0x764b('0x27')]]=new Campaign(_0x1a7656);}else{_0x315238[_0x764b('0x3d')](_0x315238[_0x764b('0x66')][_0x1a7656[_0x764b('0x27')]],_0x1a7656);_0x315238['campaigns'][_0x1a7656[_0x764b('0x27')]][_0x764b('0x67')]=_0x1a7656[_0x764b('0x68')]?_0x1a7656['SquareProject'][_0x764b('0x27')]:undefined;}}}return _0x315238[_0x764b('0x66')];};};Realtime[_0x764b('0x3c')][_0x764b('0x69')]=function(){var _0x1db066=this;return function(_0x4fa42c){if(_0x4fa42c){freeIsNotKey(_0x4fa42c,_0x1db066[_0x764b('0x16')],'id');for(var _0x562162=0x0,_0x5d7b77={};_0x562162<_0x4fa42c[_0x764b('0x3f')];_0x562162+=0x1){_0x5d7b77=_0x4fa42c[_0x562162];if(_[_0x764b('0x42')](_0x1db066[_0x764b('0x16')][_0x5d7b77['id']])){_0x1db066['voiceExtensions'][_0x5d7b77['id']]=new VoiceExtension(_0x5d7b77);}else{_0x1db066['mergeFromDatabase'](_0x1db066['voiceExtensions'][_0x5d7b77['id']],_0x5d7b77);}}}return _0x1db066[_0x764b('0x16')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x303bb4=this;return function(_0xb4d340){clearCampaigns(_0x303bb4[_0x764b('0x66')]);for(var _0x52ff75=0x0;_0x52ff75<_0xb4d340[_0x764b('0x3f')];_0x52ff75+=0x1){_[_0x764b('0x52')](_0x303bb4[_0x764b('0x66')][_0xb4d340[_0x52ff75][_0x764b('0x27')]],_0xb4d340[_0x52ff75]);}return _0x303bb4['campaigns'];};};Realtime[_0x764b('0x3c')][_0x764b('0x6a')]=function(){var _0x1898d8=this;return function(_0x4b2d70){if(_0x4b2d70){freeIsNotKey(_0x4b2d70,_0x1898d8['faxAccounts'],'id');for(var _0xf2eb4f=0x0,_0x5a89fc={},_0x4b043e={};_0xf2eb4f<_0x4b2d70[_0x764b('0x3f')];_0xf2eb4f+=0x1){_0x5a89fc=_0x4b2d70[_0xf2eb4f];if(_[_0x764b('0x42')](_0x1898d8['faxAccounts'][_0x5a89fc['id']])){_0x1898d8[_0x764b('0x22')][_0x5a89fc['id']]=new FaxAccount(_0x5a89fc);}else{_0x1898d8[_0x764b('0x3d')](_0x1898d8[_0x764b('0x22')][_0x5a89fc['id']],_0x5a89fc);}}}return _0x1898d8[_0x764b('0x22')];};};module[_0x764b('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 008dbef..54633d2 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 _0x46cf=['../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','xdr','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','bind','blindtransfer','blindTransfer','attendedtransfer','prototype','find','accountcode','name','interface','SIP/%s','length','findAgent','connectedlinenum','assigned','lastAssignedTo','isNil','format','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','destination','exten','type','lastapplication','queue','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','calleridnum','destinationchannel','channel','originatecalleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitorFilename','monitors','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','phone','lastIndexOf','membername','transfererlinkedid','attendedTransfer','moment','util','../../../config/environment','../rpc/voiceDialReport','../rpc/memberReport'];(function(_0x424edd,_0x19b97b){var _0x58ca72=function(_0x426cd8){while(--_0x426cd8){_0x424edd['push'](_0x424edd['shift']());}};_0x58ca72(++_0x19b97b);}(_0x46cf,0x14b));var _0xf46c=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x46cf[_0xef8146];return _0x5a6cb0;};'use strict';var _=require('lodash');var moment=require(_0xf46c('0x0'));var util=require(_0xf46c('0x1'));var config=require(_0xf46c('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xf46c('0x3'));var RpcMemberReport=require(_0xf46c('0x4'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xf46c('0x5'));var RpcVoiceTransferReport=require(_0xf46c('0x6'));var VoiceQueueReport=require(_0xf46c('0x7'));var VoiceCallReport=require(_0xf46c('0x8'));var VoiceAgentReport=require(_0xf46c('0x9'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xf46c('0xa'));function Report(_0x2a9acc){this[_0xf46c('0xb')]=_0x2a9acc;this['agents']=_0x2a9acc[_0xf46c('0xc')];this['telephones']=_0x2a9acc[_0xf46c('0xd')];}Report['prototype']['sync']=function(_0x40b6d4){var _0x564e2d=new VoiceQueueReport(this[_0xf46c('0xb')]);var _0x1d286e=new VoiceAgentReport(this[_0xf46c('0xb')]);var _0xb89733=new VoiceDialReport(this[_0xf46c('0xb')]);var _0x3a177a=new VoiceCallReport(this[_0xf46c('0xb')]);var _0x30ba06=new UserReport(this[_0xf46c('0xb')]);if(config[_0xf46c('0xe')]&&config[_0xf46c('0xe')]['disabled']){ami['on'](_0xf46c('0xf'),this[_0xf46c('0x10')]['bind'](this));ami['on'](_0xf46c('0x11'),this[_0xf46c('0x12')]['bind'](this));ami['on'](_0xf46c('0x13'),this[_0xf46c('0x14')]['bind'](this));ami['on'](_0xf46c('0x15'),this[_0xf46c('0x16')][_0xf46c('0x17')](this));ami['on'](_0xf46c('0x18'),this[_0xf46c('0x19')][_0xf46c('0x17')](this));ami['on'](_0xf46c('0x1a'),this['attendedTransfer']['bind'](this));}};Report[_0xf46c('0x1b')]['findAgent']=function(_0x106a7a){var _0x542745;_0x542745=_[_0xf46c('0x1c')](this[_0xf46c('0xc')],function(_0x671067){return _0x671067[_0xf46c('0x1d')]==_0x106a7a||_0x671067[_0xf46c('0x1e')]==_0x106a7a;});if(_['isNil'](_0x542745)){var _0x3cba76=_[_0xf46c('0x1c')](this['telephones'],function(_0x5b8077){return _0x5b8077[_0xf46c('0x1d')]==_0x106a7a||_0x5b8077['name']==_0x106a7a;});if(_0x3cba76){_0x542745=_[_0xf46c('0x1c')](this[_0xf46c('0xc')],function(_0x46a2cb){return _0x46a2cb[_0xf46c('0x1f')]==util['format'](_0xf46c('0x20'),_0x3cba76[_0xf46c('0x1e')]);});}}return _0x542745;};Report[_0xf46c('0x1b')]['voiceQueueReport']=function(_0x44787a){for(var _0x3a3741=0x0;_0x3a3741<_0x44787a[_0xf46c('0x21')];_0x3a3741+=0x1){var _0x5946dd=this[_0xf46c('0x22')](_0x44787a[_0x3a3741][_0xf46c('0x23')]);if(_0x5946dd){_0x44787a[_0x3a3741][_0xf46c('0x1d')]=_0x5946dd['accountcode'];_0x44787a[_0x3a3741][_0xf46c('0x24')]=!![];_0x44787a[_0x3a3741][_0xf46c('0x25')]=_0x5946dd[_0xf46c('0x1e')];_0x44787a[_0x3a3741]['interface']=_[_0xf46c('0x26')](_0x5946dd[_0xf46c('0x1f')])?util[_0xf46c('0x27')](_0xf46c('0x20'),_0x5946dd[_0xf46c('0x1e')]):_0x5946dd[_0xf46c('0x1f')];if(_0x44787a[_0x3a3741]['queuecallercomplete']){_0x44787a[_0x3a3741][_0xf46c('0x28')]=moment()[_0xf46c('0x27')](_0xf46c('0x29'));}if(_0x44787a[_0x3a3741][_0xf46c('0x2a')]){_0x44787a[_0x3a3741]['queuecallerexitAt']=moment()['format'](_0xf46c('0x29'));}RpcMemberReport[_0xf46c('0x10')](_0x44787a[_0x3a3741]);}RpcVoiceQueueReport[_0xf46c('0x2b')](_0x44787a[_0x3a3741]);}};function extractCalleridNumber(_0x39a391){var _0x223260=_0x39a391[_0xf46c('0x2c')](/<(.*?)>/);return _0x223260?_0x223260[0x1]:_0x39a391;}Report[_0xf46c('0x1b')]['voiceCallReport']=function(_0x141439){_0x141439[_0xf46c('0x2d')]=_0x141439[_0xf46c('0x2d')]||_0x141439[_0xf46c('0x2e')];if(_0x141439[_0xf46c('0x2f')]=='dialer'){_0x141439[_0xf46c('0x30')]=_0xf46c('0x31');_0x141439[_0xf46c('0x32')]=_0x141439[_0xf46c('0x31')];if(_0x141439[_0xf46c('0x33')]==_0xf46c('0x34')){_0x141439[_0xf46c('0x1d')]='';_0x141439['destination']=extractCalleridNumber(_0x141439[_0xf46c('0x35')]);}else if(_0x141439[_0xf46c('0x33')]=='from-sip'){if(_0x141439[_0xf46c('0x2d')]==_0xf46c('0x36')){_0x141439[_0xf46c('0x2d')]=extractCalleridNumber(_0x141439['calleridpreview']);_0x141439[_0xf46c('0x37')]=_0x141439['originatecalleridnum'];_0x141439[_0xf46c('0x38')]=[_0x141439[_0xf46c('0x39')],_0x141439['channel']=_0x141439['destinationchannel']][0x0];_0x141439[_0xf46c('0x35')]=_0x141439['calleridpreview'];}else{_0x141439[_0xf46c('0x2d')]=_0x141439['calleridnum'];_0x141439['calleridnum']=_0x141439[_0xf46c('0x3a')];if(_0x141439[_0xf46c('0x3b')]==_0xf46c('0x3c')){_0x141439[_0xf46c('0x1d')]=_0x141439[_0xf46c('0x23')];}else{_0x141439['accountcode']='';}}}}else{_0x141439['callerid']=util[_0xf46c('0x27')](_0xf46c('0x3d'),_0x141439[_0xf46c('0x3e')],_0x141439[_0xf46c('0x37')]);}if(RpcVoiceTransferReport[_0xf46c('0x3f')][_0x141439[_0xf46c('0x40')]]){var _0x4e8faa=RpcVoiceTransferReport[_0xf46c('0x3f')][_0x141439[_0xf46c('0x40')]];_0x4e8faa[_0xf46c('0x41')]=_0x141439[_0xf46c('0x42')];RpcVoiceTransferReport[_0xf46c('0x19')](_0x4e8faa);delete RpcVoiceTransferReport[_0xf46c('0x3f')][_0x141439[_0xf46c('0x40')]];}RpcVoiceCallReport[_0xf46c('0x2b')](_0x141439);if(_0x141439['monitor']){for(var _0x48f0b4=0x0;_0x48f0b4<_0x141439['monitors'][_0xf46c('0x21')];_0x48f0b4+=0x1){_0x141439[_0xf46c('0x43')]=_0x141439[_0xf46c('0x44')][_0x48f0b4][_0xf46c('0x45')];_0x141439[_0xf46c('0x46')]=_0x141439[_0xf46c('0x44')][_0x48f0b4][_0xf46c('0x46')];if(_0x141439['exten']=='xcally-motion-preview'){_0x141439['calleridnum']=_0x141439[_0xf46c('0x23')];_0x141439['calleridname']=_0x141439[_0xf46c('0x47')];_0x141439[_0xf46c('0x23')]=_0x141439[_0xf46c('0x1d')];_0x141439['connectedlinename']=_0x141439['membername'];_0x141439[_0xf46c('0x2e')]=_0x141439[_0xf46c('0x3a')];}else if(_0x141439[_0xf46c('0x2e')]==_0xf46c('0x48')){_0x141439['calleridnum']=_0x141439['destination'];_0x141439[_0xf46c('0x2e')]=_0x141439[_0xf46c('0x3a')];}RpcVoiceRecording[_0xf46c('0x2b')](_0x141439);}}};Report['prototype'][_0xf46c('0x14')]=function(_0x14b5e2){if(_[_0xf46c('0x49')](_0x14b5e2)){_0x14b5e2[_0xf46c('0x4a')](function(_0x111ec2){RpcVoiceAgentReport[_0xf46c('0x2b')](_0x111ec2);});}else{RpcVoiceAgentReport[_0xf46c('0x2b')](_0x14b5e2);}};Report[_0xf46c('0x1b')]['voiceDialReport']=function(_0x347b8c){RpcVoiceDialReport[_0xf46c('0x2b')](_0x347b8c);var _0x2c3220;var _0x29917d;var _0x267f65=_0x347b8c[_0xf46c('0x39')];if(_[_0xf46c('0x4b')](_0x267f65,_0xf46c('0x4c'))){_0x29917d=_0x267f65[_0xf46c('0x4d')](_0x267f65[_0xf46c('0x4e')]('/')+0x1,_0x267f65[_0xf46c('0x4e')]('@'));_0x2c3220=_[_0xf46c('0x1c')](this[_0xf46c('0xc')],function(_0x53c0ba){return _0x53c0ba['mobile']==_0x29917d||_0x53c0ba[_0xf46c('0x4f')]==_0x29917d||_0x53c0ba['accountcode']==_0x29917d;});}else{_0x29917d=_0x267f65[_0xf46c('0x4d')](_0x267f65['indexOf']('/')+0x1,_0x267f65[_0xf46c('0x50')]('-'));_0x2c3220=this[_0xf46c('0x22')](_0x29917d);}if(_0x2c3220){_0x347b8c[_0xf46c('0x1f')]=_[_0xf46c('0x26')](_0x2c3220['interface'])?util[_0xf46c('0x27')]('SIP/%s',_0x2c3220[_0xf46c('0x1e')]):_0x2c3220['interface'];_0x347b8c[_0xf46c('0x51')]=_0x2c3220[_0xf46c('0x1e')];_0x347b8c['accountcode']=_0x2c3220['accountcode'];RpcMemberReport[_0xf46c('0x16')](_0x347b8c);}};Report['prototype'][_0xf46c('0x19')]=function(_0x3b6da6){RpcVoiceTransferReport['transfers'][_0x3b6da6[_0xf46c('0x52')]]=_0x3b6da6;};Report[_0xf46c('0x1b')]['attendedTransfer']=function(_0x1f38ca){RpcVoiceTransferReport[_0xf46c('0x53')](_0x1f38ca);};module['exports']=Report; \ No newline at end of file +var _0xc412=['transfereelinkedid','uniqueid','create','monitor','monitors','length','createdAt','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','isArray','forEach','Local','indexOf','mobile','substring','lastIndexOf','transfererlinkedid','exports','lodash','moment','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','SIP/%s','assigned','lastAssignedTo','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','destination','exten','type','queue','context','from-voip-provider','callerid','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','ANSWERED','connectedlinenum','calleridname','transfers','linkedid'];(function(_0x21900c,_0x36dccc){var _0x138370=function(_0x551ac7){while(--_0x551ac7){_0x21900c['push'](_0x21900c['shift']());}};_0x138370(++_0x36dccc);}(_0xc412,0x1ae));var _0x2c41=function(_0x2f2b37,_0x5a545b){_0x2f2b37=_0x2f2b37-0x0;var _0x170f0b=_0xc412[_0x2f2b37];return _0x170f0b;};'use strict';var _=require(_0x2c41('0x0'));var moment=require(_0x2c41('0x1'));var util=require('util');var config=require(_0x2c41('0x2'));var ami=require(_0x2c41('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x2c41('0x4'));var RpcVoiceDialReport=require(_0x2c41('0x5'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x2c41('0x6'));var RpcVoiceRecording=require(_0x2c41('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x2c41('0x8'));var VoiceCallReport=require(_0x2c41('0x9'));var VoiceAgentReport=require(_0x2c41('0xa'));var VoiceDialReport=require(_0x2c41('0xb'));var UserReport=require(_0x2c41('0xc'));function Report(_0x3b3b18){this[_0x2c41('0xd')]=_0x3b3b18;this[_0x2c41('0xe')]=_0x3b3b18['agents'];this['telephones']=_0x3b3b18[_0x2c41('0xf')];}Report[_0x2c41('0x10')][_0x2c41('0x11')]=function(_0xaf13f6){var _0x5e78a0=new VoiceQueueReport(this[_0x2c41('0xd')]);var _0x1402e7=new VoiceAgentReport(this[_0x2c41('0xd')]);var _0x4b2c55=new VoiceDialReport(this[_0x2c41('0xd')]);var _0x340e5b=new VoiceCallReport(this[_0x2c41('0xd')]);var _0x12a94d=new UserReport(this[_0x2c41('0xd')]);if(config[_0x2c41('0x12')]&&config[_0x2c41('0x12')]['disabled']){ami['on'](_0x2c41('0x13'),this[_0x2c41('0x14')][_0x2c41('0x15')](this));ami['on']('custom:voiceCallReport',this[_0x2c41('0x16')][_0x2c41('0x15')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport'][_0x2c41('0x15')](this));ami['on'](_0x2c41('0x17'),this[_0x2c41('0x18')][_0x2c41('0x15')](this));ami['on']('blindtransfer',this[_0x2c41('0x19')][_0x2c41('0x15')](this));ami['on']('attendedtransfer',this[_0x2c41('0x1a')][_0x2c41('0x15')](this));}};Report[_0x2c41('0x10')][_0x2c41('0x1b')]=function(_0x54b36d){var _0x4e9ae1;_0x4e9ae1=_[_0x2c41('0x1c')](this['agents'],function(_0x398ee9){return _0x398ee9[_0x2c41('0x1d')]==_0x54b36d||_0x398ee9[_0x2c41('0x1e')]==_0x54b36d;});if(_[_0x2c41('0x1f')](_0x4e9ae1)){var _0x390a3b=_['find'](this[_0x2c41('0xf')],function(_0x3f4445){return _0x3f4445['accountcode']==_0x54b36d||_0x3f4445[_0x2c41('0x1e')]==_0x54b36d;});if(_0x390a3b){_0x4e9ae1=_[_0x2c41('0x1c')](this[_0x2c41('0xe')],function(_0x5aad75){return _0x5aad75[_0x2c41('0x20')]==util['format'](_0x2c41('0x21'),_0x390a3b['name']);});}}return _0x4e9ae1;};Report[_0x2c41('0x10')]['voiceQueueReport']=function(_0x3d3cac){for(var _0x25c688=0x0;_0x25c688<_0x3d3cac['length'];_0x25c688+=0x1){var _0x40adac=this[_0x2c41('0x1b')](_0x3d3cac[_0x25c688]['connectedlinenum']);if(_0x40adac){_0x3d3cac[_0x25c688][_0x2c41('0x1d')]=_0x40adac['accountcode'];_0x3d3cac[_0x25c688][_0x2c41('0x22')]=!![];_0x3d3cac[_0x25c688][_0x2c41('0x23')]=_0x40adac[_0x2c41('0x1e')];_0x3d3cac[_0x25c688][_0x2c41('0x20')]=_[_0x2c41('0x1f')](_0x40adac[_0x2c41('0x20')])?util[_0x2c41('0x24')](_0x2c41('0x21'),_0x40adac[_0x2c41('0x1e')]):_0x40adac[_0x2c41('0x20')];if(_0x3d3cac[_0x25c688][_0x2c41('0x25')]){_0x3d3cac[_0x25c688][_0x2c41('0x26')]=moment()[_0x2c41('0x24')](_0x2c41('0x27'));}if(_0x3d3cac[_0x25c688][_0x2c41('0x28')]){_0x3d3cac[_0x25c688][_0x2c41('0x29')]=moment()['format'](_0x2c41('0x27'));}RpcMemberReport[_0x2c41('0x14')](_0x3d3cac[_0x25c688]);}RpcVoiceQueueReport['create'](_0x3d3cac[_0x25c688]);}};function extractCalleridNumber(_0x2b8763){var _0x3cefcb=_0x2b8763[_0x2c41('0x2a')](/<(.*?)>/);return _0x3cefcb?_0x3cefcb[0x1]:_0x2b8763;}Report[_0x2c41('0x10')]['voiceCallReport']=function(_0x25efd7){_0x25efd7[_0x2c41('0x2b')]=_0x25efd7['destination']||_0x25efd7[_0x2c41('0x2c')];if(_0x25efd7[_0x2c41('0x2d')]=='dialer'){_0x25efd7['lastapplication']=_0x2c41('0x2e');_0x25efd7['lastdata']=_0x25efd7[_0x2c41('0x2e')];if(_0x25efd7[_0x2c41('0x2f')]==_0x2c41('0x30')){_0x25efd7[_0x2c41('0x1d')]='';_0x25efd7[_0x2c41('0x2b')]=extractCalleridNumber(_0x25efd7[_0x2c41('0x31')]);}else if(_0x25efd7[_0x2c41('0x2f')]=='from-sip'){if(_0x25efd7['destination']==_0x2c41('0x32')){_0x25efd7['destination']=extractCalleridNumber(_0x25efd7['calleridpreview']);_0x25efd7[_0x2c41('0x33')]=_0x25efd7[_0x2c41('0x34')];_0x25efd7[_0x2c41('0x35')]=[_0x25efd7[_0x2c41('0x36')],_0x25efd7[_0x2c41('0x36')]=_0x25efd7[_0x2c41('0x35')]][0x0];_0x25efd7['callerid']=_0x25efd7[_0x2c41('0x37')];}else{_0x25efd7[_0x2c41('0x2b')]=_0x25efd7[_0x2c41('0x33')];_0x25efd7['calleridnum']=_0x25efd7[_0x2c41('0x34')];if(_0x25efd7[_0x2c41('0x38')]==_0x2c41('0x39')){_0x25efd7[_0x2c41('0x1d')]=_0x25efd7[_0x2c41('0x3a')];}else{_0x25efd7[_0x2c41('0x1d')]='';}}}}else{_0x25efd7[_0x2c41('0x31')]=util[_0x2c41('0x24')]('\x22%s\x22\x20<%s>',_0x25efd7[_0x2c41('0x3b')],_0x25efd7[_0x2c41('0x33')]);}if(RpcVoiceTransferReport['transfers'][_0x25efd7['linkedid']]){var _0x18a640=RpcVoiceTransferReport[_0x2c41('0x3c')][_0x25efd7[_0x2c41('0x3d')]];_0x18a640[_0x2c41('0x3e')]=_0x25efd7[_0x2c41('0x3f')];RpcVoiceTransferReport[_0x2c41('0x19')](_0x18a640);delete RpcVoiceTransferReport['transfers'][_0x25efd7['linkedid']];}RpcVoiceCallReport[_0x2c41('0x40')](_0x25efd7);if(_0x25efd7[_0x2c41('0x41')]){for(var _0x212eb8=0x0;_0x212eb8<_0x25efd7[_0x2c41('0x42')][_0x2c41('0x43')];_0x212eb8+=0x1){_0x25efd7['monitorFilename']=_0x25efd7['monitors'][_0x212eb8]['filename'];_0x25efd7[_0x2c41('0x44')]=_0x25efd7[_0x2c41('0x42')][_0x212eb8][_0x2c41('0x44')];if(_0x25efd7[_0x2c41('0x2c')]==_0x2c41('0x32')){_0x25efd7[_0x2c41('0x33')]=_0x25efd7[_0x2c41('0x3a')];_0x25efd7[_0x2c41('0x3b')]=_0x25efd7['connectedlinename'];_0x25efd7[_0x2c41('0x3a')]=_0x25efd7[_0x2c41('0x1d')];_0x25efd7[_0x2c41('0x45')]=_0x25efd7[_0x2c41('0x46')];_0x25efd7[_0x2c41('0x2c')]=_0x25efd7[_0x2c41('0x34')];}else if(_0x25efd7['exten']==_0x2c41('0x47')){_0x25efd7[_0x2c41('0x33')]=_0x25efd7['destination'];_0x25efd7[_0x2c41('0x2c')]=_0x25efd7[_0x2c41('0x34')];}RpcVoiceRecording[_0x2c41('0x40')](_0x25efd7);}}};Report[_0x2c41('0x10')][_0x2c41('0x48')]=function(_0x4c7d2d){if(_[_0x2c41('0x49')](_0x4c7d2d)){_0x4c7d2d[_0x2c41('0x4a')](function(_0x5d2257){RpcVoiceAgentReport[_0x2c41('0x40')](_0x5d2257);});}else{RpcVoiceAgentReport['create'](_0x4c7d2d);}};Report[_0x2c41('0x10')][_0x2c41('0x18')]=function(_0x153db8){RpcVoiceDialReport[_0x2c41('0x40')](_0x153db8);var _0x2d87ed;var _0x130577;var _0x53ae11=_0x153db8[_0x2c41('0x36')];if(_['startsWith'](_0x53ae11,_0x2c41('0x4b'))){_0x130577=_0x53ae11['substring'](_0x53ae11['indexOf']('/')+0x1,_0x53ae11[_0x2c41('0x4c')]('@'));_0x2d87ed=_[_0x2c41('0x1c')](this['agents'],function(_0x1501bb){return _0x1501bb[_0x2c41('0x4d')]==_0x130577||_0x1501bb['phone']==_0x130577||_0x1501bb['accountcode']==_0x130577;});}else{_0x130577=_0x53ae11[_0x2c41('0x4e')](_0x53ae11[_0x2c41('0x4c')]('/')+0x1,_0x53ae11[_0x2c41('0x4f')]('-'));_0x2d87ed=this[_0x2c41('0x1b')](_0x130577);}if(_0x2d87ed){_0x153db8[_0x2c41('0x20')]=_[_0x2c41('0x1f')](_0x2d87ed[_0x2c41('0x20')])?util['format'](_0x2c41('0x21'),_0x2d87ed[_0x2c41('0x1e')]):_0x2d87ed[_0x2c41('0x20')];_0x153db8[_0x2c41('0x46')]=_0x2d87ed[_0x2c41('0x1e')];_0x153db8[_0x2c41('0x1d')]=_0x2d87ed[_0x2c41('0x1d')];RpcMemberReport[_0x2c41('0x18')](_0x153db8);}};Report['prototype']['blindTransfer']=function(_0x5a4adf){RpcVoiceTransferReport[_0x2c41('0x3c')][_0x5a4adf[_0x2c41('0x50')]]=_0x5a4adf;};Report['prototype'][_0x2c41('0x1a')]=function(_0x4aeb5d){RpcVoiceTransferReport['attendedTransfer'](_0x4aeb5d);};module[_0x2c41('0x51')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index d4eac16..c7b243a 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 _0x9cae=['device','local','toLowerCase','inuse','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','toNumber','startsWith','Local','substring','indexOf','mobile','accountcode','updateStatusRealtime','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','[userReport][peerstatus]','registered','address','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','redis','localhost','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncPeerStatus','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','resolve','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','isNotNull','isUndefined','emit','prototype','username','state','debug','[userReport][registry]','find','omit','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','syncDeviceState','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]'];(function(_0x500ad9,_0x35878a){var _0x584c9a=function(_0x307883){while(--_0x307883){_0x500ad9['push'](_0x500ad9['shift']());}};_0x584c9a(++_0x35878a);}(_0x9cae,0xeb));var _0xe9ca=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9cae[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var moment=require(_0xe9ca('0x0'));var util=require(_0xe9ca('0x1'));var Redis=require(_0xe9ca('0x2'));var BPromise=require(_0xe9ca('0x3'));var config=require(_0xe9ca('0x4'));var logger=require(_0xe9ca('0x5'))('ami');var ami=require('../ami');config[_0xe9ca('0x6')]=_['defaults'](config[_0xe9ca('0x6')],{'host':_0xe9ca('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function UserReport(_0x376e2c){this['trunks']=_0x376e2c[_0xe9ca('0x8')];this[_0xe9ca('0x9')]=_0x376e2c[_0xe9ca('0x9')];this['telephones']=_0x376e2c[_0xe9ca('0xa')];ami['on'](_0xe9ca('0xb'),this[_0xe9ca('0xc')][_0xe9ca('0xd')](this));ami['on']('registry',this['syncRegistry'][_0xe9ca('0xd')](this));ami['on'](_0xe9ca('0xe'),this['syncDeviceState'][_0xe9ca('0xd')](this));ami['on']('peerstatus',this[_0xe9ca('0xf')][_0xe9ca('0xd')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise['resolve']()[_0xe9ca('0x10')](ami[_0xe9ca('0x11')]())[_0xe9ca('0x12')](function(_0x144f5a){logger[_0xe9ca('0x13')](_0xe9ca('0x14'),util['inspect'](_0x144f5a,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xe9ca('0x15')]()[_0xe9ca('0x10')](ami['actionDeviceStateList']())[_0xe9ca('0x12')](function(_0x5e7cf7){logger[_0xe9ca('0x13')]('[userReport][devicestatelist]',util[_0xe9ca('0x16')](_0x5e7cf7,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()['then'](ami[_0xe9ca('0x17')]())[_0xe9ca('0x12')](function(_0x184b11){logger[_0xe9ca('0x13')](_0xe9ca('0x18'),util[_0xe9ca('0x16')](_0x184b11,{'showHidden':![],'depth':null}));});}UserReport['prototype']['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0xe9ca('0x15')]()[_0xe9ca('0x10')](showSipRegistrations())[_0xe9ca('0x10')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport['prototype'][_0xe9ca('0x19')]=function(_0x59ff80){return _0x59ff80!==null&&!_[_0xe9ca('0x1a')](_0x59ff80);};UserReport['prototype']['emit']=function(_0x1a78c4,_0x49eb1e,_0xfef4e5){io['to'](_0x1a78c4)[_0xe9ca('0x1b')](_0x49eb1e,_0xfef4e5);};UserReport[_0xe9ca('0x1c')]['syncRegistry']=function(_0x3d0c69){try{if(this[_0xe9ca('0x19')](_0x3d0c69)){logger['info']('[userReport][registry]\x20registry:%s\x20state:%s',_0x3d0c69[_0xe9ca('0x1d')],_0x3d0c69[_0xe9ca('0x1e')]);logger[_0xe9ca('0x1f')](_0xe9ca('0x20'),util[_0xe9ca('0x16')](_0x3d0c69,{'showHidden':![],'depth':null}));var _0x1c4d52=_[_0xe9ca('0x21')](this[_0xe9ca('0x8')],{'registry':_0x3d0c69[_0xe9ca('0x1d')]});if(_0x1c4d52){_0x3d0c69['stateRegistry']=_0x3d0c69[_0xe9ca('0x1e')];_['merge'](_0x1c4d52,_[_0xe9ca('0x22')](_0x3d0c69,[_0xe9ca('0x23'),'actionid',_0xe9ca('0x1d'),_0xe9ca('0x1e')]));logger['debug'](_0xe9ca('0x24'),util[_0xe9ca('0x16')](_0x1c4d52,{'showHidden':![],'depth':null}));this[_0xe9ca('0x1b')](util[_0xe9ca('0x25')](_0xe9ca('0x26'),_0x1c4d52[_0xe9ca('0x27')]),_0xe9ca('0x28'),_0x1c4d52);}}}catch(_0x2fd613){logger[_0xe9ca('0x13')](_0xe9ca('0x20'),util['inspect'](_0x2fd613,{'showHidden':![],'depth':null}));}};UserReport[_0xe9ca('0x1c')][_0xe9ca('0x29')]=function(_0x5bad6f){try{if(this[_0xe9ca('0x19')](_0x5bad6f)){logger[_0xe9ca('0x2a')](_0xe9ca('0x2b'),_0x5bad6f['device'],_0x5bad6f['state']);logger[_0xe9ca('0x1f')](_0xe9ca('0x2c'),util['inspect'](_0x5bad6f,{'showHidden':![],'depth':null}));if(this[_0xe9ca('0x9')][_0x5bad6f[_0xe9ca('0x2d')]]){if(!this['agents'][_0x5bad6f['device']][_0xe9ca('0x2e')]||_0x5bad6f[_0xe9ca('0x1e')][_0xe9ca('0x2f')]()==_0xe9ca('0x30')){this[_0xe9ca('0x9')][_0x5bad6f[_0xe9ca('0x2d')]][_0xe9ca('0x2e')]=![];if(this[_0xe9ca('0x9')][_0x5bad6f[_0xe9ca('0x2d')]][_0xe9ca('0x1e')]!==_0x5bad6f[_0xe9ca('0x1e')][_0xe9ca('0x2f')]()){this['agents'][_0x5bad6f[_0xe9ca('0x2d')]][_0xe9ca('0x31')]=_['toNumber'](moment()['format']('x'));}this[_0xe9ca('0x9')][_0x5bad6f['device']]['state']=_0x5bad6f[_0xe9ca('0x1e')][_0xe9ca('0x2f')]();this['agents'][_0x5bad6f[_0xe9ca('0x2d')]]['updateStatusRealtime'](_0x5bad6f);}}else if(this[_0xe9ca('0xa')][_0x5bad6f['device']]){if(this[_0xe9ca('0xa')][_0x5bad6f[_0xe9ca('0x2d')]]['state']!==_0x5bad6f['state'][_0xe9ca('0x2f')]()){this[_0xe9ca('0xa')][_0x5bad6f[_0xe9ca('0x2d')]]['stateTime']=_['toNumber'](moment()[_0xe9ca('0x25')]('x'));}this[_0xe9ca('0xa')][_0x5bad6f['device']][_0xe9ca('0x1e')]=_0x5bad6f[_0xe9ca('0x1e')]['toLowerCase']();logger[_0xe9ca('0x1f')](_0xe9ca('0x32'),util[_0xe9ca('0x16')](this[_0xe9ca('0xa')][_0x5bad6f[_0xe9ca('0x2d')]],{'showHidden':![],'depth':null}));this[_0xe9ca('0x1b')](util[_0xe9ca('0x25')](_0xe9ca('0x33'),this[_0xe9ca('0xa')][_0x5bad6f['device']][_0xe9ca('0x27')]),'telephone:save',this[_0xe9ca('0xa')][_0x5bad6f[_0xe9ca('0x2d')]]);}else if(this[_0xe9ca('0x8')][_0x5bad6f[_0xe9ca('0x2d')]]){if(this[_0xe9ca('0x8')][_0x5bad6f[_0xe9ca('0x2d')]][_0xe9ca('0x1e')]!==_0x5bad6f[_0xe9ca('0x1e')][_0xe9ca('0x2f')]()){this[_0xe9ca('0x8')][_0x5bad6f[_0xe9ca('0x2d')]][_0xe9ca('0x31')]=_[_0xe9ca('0x34')](moment()[_0xe9ca('0x25')]('x'));}this[_0xe9ca('0x8')][_0x5bad6f[_0xe9ca('0x2d')]][_0xe9ca('0x1e')]=_0x5bad6f[_0xe9ca('0x1e')]['toLowerCase']();logger[_0xe9ca('0x1f')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util['inspect'](this[_0xe9ca('0x8')][_0x5bad6f[_0xe9ca('0x2d')]],{'showHidden':![],'depth':null}));this[_0xe9ca('0x1b')](util[_0xe9ca('0x25')]('trunk:%s',this[_0xe9ca('0x8')][_0x5bad6f[_0xe9ca('0x2d')]][_0xe9ca('0x27')]),_0xe9ca('0x28'),this[_0xe9ca('0x8')][_0x5bad6f[_0xe9ca('0x2d')]]);}else if(_[_0xe9ca('0x35')](_0x5bad6f[_0xe9ca('0x2d')],_0xe9ca('0x36'))){var _0x4399ec=_0x5bad6f[_0xe9ca('0x2d')];var _0x345f52=_0x4399ec[_0xe9ca('0x37')](_0x4399ec[_0xe9ca('0x38')]('/')+0x1,_0x4399ec['indexOf']('@'));var _0x91397a=_[_0xe9ca('0x21')](this[_0xe9ca('0x9')],function(_0x437a08){return _0x437a08[_0xe9ca('0x39')]==_0x345f52||_0x437a08['phone']==_0x345f52||_0x437a08[_0xe9ca('0x3a')]==_0x345f52;});if(_0x91397a){if(_0x91397a[_0xe9ca('0x1e')]!==_0x5bad6f['state'][_0xe9ca('0x2f')]()){_0x91397a[_0xe9ca('0x31')]=_[_0xe9ca('0x34')](moment()[_0xe9ca('0x25')]('x'));}_0x91397a[_0xe9ca('0x1e')]=_0x5bad6f[_0xe9ca('0x1e')][_0xe9ca('0x2f')]();_0x91397a['local']=!![];_0x91397a[_0xe9ca('0x3b')](_0x5bad6f);}}}}catch(_0x3ab814){logger[_0xe9ca('0x13')](_0xe9ca('0x2c'),util[_0xe9ca('0x16')](_0x3ab814,{'showHidden':![],'depth':null}));}};UserReport[_0xe9ca('0x1c')][_0xe9ca('0xf')]=function(_0x3f0ec8){try{if(this[_0xe9ca('0x19')](_0x3f0ec8)&&this[_0xe9ca('0x19')](_0x3f0ec8[_0xe9ca('0x3c')])){logger['info'](_0xe9ca('0x3d'),_0x3f0ec8[_0xe9ca('0x3e')],_0x3f0ec8['address'],_0x3f0ec8['peerstatus']);logger[_0xe9ca('0x1f')](_0xe9ca('0x3f'),util[_0xe9ca('0x16')](_0x3f0ec8,{'showHidden':![],'depth':null}));if(this[_0xe9ca('0x9')][_0x3f0ec8[_0xe9ca('0x3e')]]){if(!this[_0xe9ca('0x9')][_0x3f0ec8[_0xe9ca('0x3e')]][_0xe9ca('0x2e')]||_0x3f0ec8[_0xe9ca('0x3c')][_0xe9ca('0x2f')]()==_0xe9ca('0x40')){this[_0xe9ca('0x9')][_0x3f0ec8[_0xe9ca('0x3e')]][_0xe9ca('0x2e')]=![];this[_0xe9ca('0x9')][_0x3f0ec8[_0xe9ca('0x3e')]]['status']=_0x3f0ec8['peerstatus']['toLowerCase']();this[_0xe9ca('0x9')][_0x3f0ec8[_0xe9ca('0x3e')]][_0xe9ca('0x41')]=_0x3f0ec8[_0xe9ca('0x41')];this[_0xe9ca('0x9')][_0x3f0ec8['peer']][_0xe9ca('0x3b')](_0x3f0ec8);}}else if(this['telephones'][_0x3f0ec8['peer']]){this[_0xe9ca('0xa')][_0x3f0ec8['peer']][_0xe9ca('0x42')]=_0x3f0ec8[_0xe9ca('0x3c')]['toLowerCase']();this[_0xe9ca('0xa')][_0x3f0ec8[_0xe9ca('0x3e')]]['address']=_0x3f0ec8[_0xe9ca('0x41')];logger['debug'](_0xe9ca('0x43'),util[_0xe9ca('0x16')](this[_0xe9ca('0xa')][_0x3f0ec8['peer']],{'showHidden':![],'depth':null}));this[_0xe9ca('0x1b')](util[_0xe9ca('0x25')]('telephone:%s',this[_0xe9ca('0xa')][_0x3f0ec8[_0xe9ca('0x3e')]][_0xe9ca('0x27')]),_0xe9ca('0x44'),this[_0xe9ca('0xa')][_0x3f0ec8[_0xe9ca('0x3e')]]);}else if(this[_0xe9ca('0x8')][_0x3f0ec8[_0xe9ca('0x3e')]]){this['trunks'][_0x3f0ec8['peer']][_0xe9ca('0x42')]=_0x3f0ec8[_0xe9ca('0x3c')][_0xe9ca('0x2f')]();this[_0xe9ca('0x8')][_0x3f0ec8[_0xe9ca('0x3e')]]['address']=_0x3f0ec8[_0xe9ca('0x41')];logger[_0xe9ca('0x1f')](_0xe9ca('0x45'),util[_0xe9ca('0x16')](this[_0xe9ca('0x8')][_0x3f0ec8[_0xe9ca('0x3e')]],{'showHidden':![],'depth':null}));this[_0xe9ca('0x1b')](util['format']('trunk:%s',this['trunks'][_0x3f0ec8[_0xe9ca('0x3e')]][_0xe9ca('0x27')]),_0xe9ca('0x28'),this['trunks'][_0x3f0ec8[_0xe9ca('0x3e')]]);}}}catch(_0x3ec900){logger[_0xe9ca('0x13')](_0xe9ca('0x3f'),util[_0xe9ca('0x16')](_0x3ec900,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0xa017=['redis','defaults','agents','telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','actionSipPeerStatus','[userReport][sippeerstatus]','syncRealtimeShow','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','[userReport][registry]','find','trunks','stateRegistry','merge','actionid','debug','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','phone','accountcode','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami'];(function(_0x3fa529,_0x3c341e){var _0x350134=function(_0x47368e){while(--_0x47368e){_0x3fa529['push'](_0x3fa529['shift']());}};_0x350134(++_0x3c341e);}(_0xa017,0x1f1));var _0x7a01=function(_0x55cba1,_0x45e97e){_0x55cba1=_0x55cba1-0x0;var _0x2eaee9=_0xa017[_0x55cba1];return _0x2eaee9;};'use strict';var _=require(_0x7a01('0x0'));var moment=require(_0x7a01('0x1'));var util=require(_0x7a01('0x2'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0x7a01('0x3'));var logger=require(_0x7a01('0x4'))(_0x7a01('0x5'));var ami=require(_0x7a01('0x6'));config[_0x7a01('0x7')]=_[_0x7a01('0x8')](config[_0x7a01('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7a01('0x7')]));function UserReport(_0x2ba0cd){this['trunks']=_0x2ba0cd['trunks'];this['agents']=_0x2ba0cd[_0x7a01('0x9')];this['telephones']=_0x2ba0cd[_0x7a01('0xa')];ami['on'](_0x7a01('0xb'),this[_0x7a01('0xc')][_0x7a01('0xd')](this));ami['on'](_0x7a01('0xe'),this[_0x7a01('0xc')][_0x7a01('0xd')](this));ami['on']('devicestatechange',this[_0x7a01('0xf')]['bind'](this));ami['on'](_0x7a01('0x10'),this[_0x7a01('0x11')][_0x7a01('0xd')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x7a01('0x12')]()[_0x7a01('0x13')](ami[_0x7a01('0x14')]())[_0x7a01('0x15')](function(_0x2781d6){logger[_0x7a01('0x16')](_0x7a01('0x17'),util[_0x7a01('0x18')](_0x2781d6,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x7a01('0x12')]()[_0x7a01('0x13')](ami[_0x7a01('0x19')]())[_0x7a01('0x15')](function(_0x558d65){logger['error']('[userReport][devicestatelist]',util[_0x7a01('0x18')](_0x558d65,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0x7a01('0x13')](ami[_0x7a01('0x1a')]())[_0x7a01('0x15')](function(_0x489ad9){logger[_0x7a01('0x16')](_0x7a01('0x1b'),util[_0x7a01('0x18')](_0x489ad9,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0x7a01('0x1c')]=function(){setInterval(function(){BPromise[_0x7a01('0x12')]()[_0x7a01('0x13')](showSipRegistrations())[_0x7a01('0x13')](listDeviceStates())[_0x7a01('0x13')](showPeersStatus());},0x32c8);};UserReport[_0x7a01('0x1d')][_0x7a01('0x1e')]=function(_0x19e753){return _0x19e753!==null&&!_[_0x7a01('0x1f')](_0x19e753);};UserReport[_0x7a01('0x1d')][_0x7a01('0x20')]=function(_0x2f1177,_0x404cc1,_0x1690bb){io['to'](_0x2f1177)[_0x7a01('0x20')](_0x404cc1,_0x1690bb);};UserReport[_0x7a01('0x1d')]['syncRegistry']=function(_0x2005bf){try{if(this['isNotNull'](_0x2005bf)){logger[_0x7a01('0x21')](_0x7a01('0x22'),_0x2005bf[_0x7a01('0x23')],_0x2005bf[_0x7a01('0x24')]);logger['debug'](_0x7a01('0x25'),util[_0x7a01('0x18')](_0x2005bf,{'showHidden':![],'depth':null}));var _0x1ea7b9=_[_0x7a01('0x26')](this[_0x7a01('0x27')],{'registry':_0x2005bf[_0x7a01('0x23')]});if(_0x1ea7b9){_0x2005bf[_0x7a01('0x28')]=_0x2005bf[_0x7a01('0x24')];_[_0x7a01('0x29')](_0x1ea7b9,_['omit'](_0x2005bf,['event',_0x7a01('0x2a'),_0x7a01('0x23'),_0x7a01('0x24')]));logger[_0x7a01('0x2b')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x7a01('0x18')](_0x1ea7b9,{'showHidden':![],'depth':null}));this[_0x7a01('0x20')](util[_0x7a01('0x2c')](_0x7a01('0x2d'),_0x1ea7b9[_0x7a01('0x2e')]),_0x7a01('0x2f'),_0x1ea7b9);}}}catch(_0x55b7dc){logger[_0x7a01('0x16')]('[userReport][registry]',util[_0x7a01('0x18')](_0x55b7dc,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x7a01('0xf')]=function(_0x55c08f){try{if(this[_0x7a01('0x1e')](_0x55c08f)){logger['info'](_0x7a01('0x30'),_0x55c08f['device'],_0x55c08f['state']);logger[_0x7a01('0x2b')](_0x7a01('0x31'),util[_0x7a01('0x18')](_0x55c08f,{'showHidden':![],'depth':null}));if(this[_0x7a01('0x9')][_0x55c08f['device']]){if(!this[_0x7a01('0x9')][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x33')]||_0x55c08f[_0x7a01('0x24')][_0x7a01('0x34')]()==_0x7a01('0x35')){this[_0x7a01('0x9')][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x33')]=![];if(this[_0x7a01('0x9')][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x24')]!==_0x55c08f['state'][_0x7a01('0x34')]()){this[_0x7a01('0x9')][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x36')]=_[_0x7a01('0x37')](moment()['format']('x'));}this[_0x7a01('0x9')][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x24')]=_0x55c08f[_0x7a01('0x24')][_0x7a01('0x34')]();this[_0x7a01('0x9')][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x38')](_0x55c08f);}}else if(this['telephones'][_0x55c08f[_0x7a01('0x32')]]){if(this['telephones'][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x24')]!==_0x55c08f['state'][_0x7a01('0x34')]()){this[_0x7a01('0xa')][_0x55c08f['device']][_0x7a01('0x36')]=_[_0x7a01('0x37')](moment()[_0x7a01('0x2c')]('x'));}this[_0x7a01('0xa')][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x24')]=_0x55c08f[_0x7a01('0x24')]['toLowerCase']();logger[_0x7a01('0x2b')](_0x7a01('0x39'),util[_0x7a01('0x18')](this[_0x7a01('0xa')][_0x55c08f[_0x7a01('0x32')]],{'showHidden':![],'depth':null}));this[_0x7a01('0x20')](util['format'](_0x7a01('0x3a'),this[_0x7a01('0xa')][_0x55c08f['device']]['name']),'telephone:save',this[_0x7a01('0xa')][_0x55c08f[_0x7a01('0x32')]]);}else if(this[_0x7a01('0x27')][_0x55c08f['device']]){if(this[_0x7a01('0x27')][_0x55c08f[_0x7a01('0x32')]]['state']!==_0x55c08f[_0x7a01('0x24')][_0x7a01('0x34')]()){this[_0x7a01('0x27')][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x36')]=_[_0x7a01('0x37')](moment()[_0x7a01('0x2c')]('x'));}this[_0x7a01('0x27')][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x24')]=_0x55c08f[_0x7a01('0x24')][_0x7a01('0x34')]();logger[_0x7a01('0x2b')](_0x7a01('0x3b'),util[_0x7a01('0x18')](this['trunks'][_0x55c08f[_0x7a01('0x32')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x7a01('0x2c')](_0x7a01('0x2d'),this[_0x7a01('0x27')][_0x55c08f[_0x7a01('0x32')]][_0x7a01('0x2e')]),_0x7a01('0x2f'),this['trunks'][_0x55c08f['device']]);}else if(_[_0x7a01('0x3c')](_0x55c08f[_0x7a01('0x32')],_0x7a01('0x3d'))){var _0x49d0fc=_0x55c08f['device'];var _0x358acb=_0x49d0fc[_0x7a01('0x3e')](_0x49d0fc[_0x7a01('0x3f')]('/')+0x1,_0x49d0fc[_0x7a01('0x3f')]('@'));var _0x3632a9=_['find'](this[_0x7a01('0x9')],function(_0x537baa){return _0x537baa[_0x7a01('0x40')]==_0x358acb||_0x537baa[_0x7a01('0x41')]==_0x358acb||_0x537baa[_0x7a01('0x42')]==_0x358acb;});if(_0x3632a9){if(_0x3632a9[_0x7a01('0x24')]!==_0x55c08f['state'][_0x7a01('0x34')]()){_0x3632a9[_0x7a01('0x36')]=_[_0x7a01('0x37')](moment()[_0x7a01('0x2c')]('x'));}_0x3632a9[_0x7a01('0x24')]=_0x55c08f[_0x7a01('0x24')]['toLowerCase']();_0x3632a9['local']=!![];_0x3632a9['updateStatusRealtime'](_0x55c08f);}}}}catch(_0x958a12){logger['error'](_0x7a01('0x31'),util[_0x7a01('0x18')](_0x958a12,{'showHidden':![],'depth':null}));}};UserReport[_0x7a01('0x1d')][_0x7a01('0x11')]=function(_0x39c2ad){try{if(this['isNotNull'](_0x39c2ad)&&this[_0x7a01('0x1e')](_0x39c2ad[_0x7a01('0x10')])){logger[_0x7a01('0x21')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x39c2ad[_0x7a01('0x43')],_0x39c2ad[_0x7a01('0x44')],_0x39c2ad['peerstatus']);logger[_0x7a01('0x2b')](_0x7a01('0x45'),util[_0x7a01('0x18')](_0x39c2ad,{'showHidden':![],'depth':null}));if(this[_0x7a01('0x9')][_0x39c2ad[_0x7a01('0x43')]]){if(!this[_0x7a01('0x9')][_0x39c2ad[_0x7a01('0x43')]][_0x7a01('0x33')]||_0x39c2ad[_0x7a01('0x10')][_0x7a01('0x34')]()=='registered'){this[_0x7a01('0x9')][_0x39c2ad[_0x7a01('0x43')]]['local']=![];this['agents'][_0x39c2ad[_0x7a01('0x43')]]['status']=_0x39c2ad[_0x7a01('0x10')][_0x7a01('0x34')]();this['agents'][_0x39c2ad['peer']][_0x7a01('0x44')]=_0x39c2ad[_0x7a01('0x44')];this[_0x7a01('0x9')][_0x39c2ad[_0x7a01('0x43')]][_0x7a01('0x38')](_0x39c2ad);}}else if(this[_0x7a01('0xa')][_0x39c2ad[_0x7a01('0x43')]]){this['telephones'][_0x39c2ad[_0x7a01('0x43')]][_0x7a01('0x46')]=_0x39c2ad['peerstatus']['toLowerCase']();this[_0x7a01('0xa')][_0x39c2ad[_0x7a01('0x43')]][_0x7a01('0x44')]=_0x39c2ad[_0x7a01('0x44')];logger[_0x7a01('0x2b')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0x7a01('0xa')][_0x39c2ad[_0x7a01('0x43')]],{'showHidden':![],'depth':null}));this[_0x7a01('0x20')](util[_0x7a01('0x2c')](_0x7a01('0x3a'),this['telephones'][_0x39c2ad[_0x7a01('0x43')]]['name']),'telephone:save',this[_0x7a01('0xa')][_0x39c2ad[_0x7a01('0x43')]]);}else if(this['trunks'][_0x39c2ad[_0x7a01('0x43')]]){this[_0x7a01('0x27')][_0x39c2ad[_0x7a01('0x43')]]['status']=_0x39c2ad[_0x7a01('0x10')][_0x7a01('0x34')]();this[_0x7a01('0x27')][_0x39c2ad[_0x7a01('0x43')]][_0x7a01('0x44')]=_0x39c2ad['address'];logger['debug'](_0x7a01('0x47'),util[_0x7a01('0x18')](this[_0x7a01('0x27')][_0x39c2ad[_0x7a01('0x43')]],{'showHidden':![],'depth':null}));this[_0x7a01('0x20')](util[_0x7a01('0x2c')](_0x7a01('0x2d'),this[_0x7a01('0x27')][_0x39c2ad[_0x7a01('0x43')]][_0x7a01('0x2e')]),_0x7a01('0x2f'),this['trunks'][_0x39c2ad[_0x7a01('0x43')]]);}}}catch(_0x2745bf){logger[_0x7a01('0x16')](_0x7a01('0x45'),util[_0x7a01('0x18')](_0x2745bf,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 142767f..e4d8e4a 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 _0x15a2=['memberinterface','memberlastcall','memberpenalty','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','agentcompleteAt','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','talktime','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','syncAgentCalled','agentconnect','syncAgentConnect','bind','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','omit','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','user:%s','membername','user:called','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','interface','pick','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','reason','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','complete','transfer','acw','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','value','keys','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic'];(function(_0x178a78,_0x354a4f){var _0x5c07dd=function(_0x5e1a05){while(--_0x5e1a05){_0x178a78['push'](_0x178a78['shift']());}};_0x5c07dd(++_0x354a4f);}(_0x15a2,0x1e9));var _0x215a=function(_0x1d89c3,_0x9c8b86){_0x1d89c3=_0x1d89c3-0x0;var _0x308a10=_0x15a2[_0x1d89c3];return _0x308a10;};'use strict';var _=require(_0x215a('0x0'));var moment=require(_0x215a('0x1'));var util=require('util');var Redis=require(_0x215a('0x2'));var config=require(_0x215a('0x3'));var logger=require(_0x215a('0x4'))(_0x215a('0x5'));var ami=require(_0x215a('0x6'));config[_0x215a('0x7')]=_[_0x215a('0x8')](config[_0x215a('0x7')],{'host':_0x215a('0x9'),'port':0x18eb});var io=require(_0x215a('0xa'))(new Redis(config[_0x215a('0x7')]));function VoiceAgentReport(_0x113f70){this[_0x215a('0xb')]={};this[_0x215a('0xc')]=_0x113f70[_0x215a('0xc')];this[_0x215a('0xd')]=_0x113f70[_0x215a('0xd')];this[_0x215a('0xe')]={};ami['on']('agentcalled',this[_0x215a('0xf')]['bind'](this));ami['on'](_0x215a('0x10'),this[_0x215a('0x11')][_0x215a('0x12')](this));ami['on']('agentringnoanswer',this[_0x215a('0x13')][_0x215a('0x12')](this));ami['on'](_0x215a('0x14'),this[_0x215a('0x15')]['bind'](this));ami['on'](_0x215a('0x16'),this[_0x215a('0x17')][_0x215a('0x12')](this));ami['on'](_0x215a('0x18'),this['syncVarSet'][_0x215a('0x12')](this));ami['on'](_0x215a('0x19'),this[_0x215a('0x1a')][_0x215a('0x12')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x215a('0x12')](this));ami['on'](_0x215a('0x1b'),this[_0x215a('0x1c')][_0x215a('0x12')](this));ami['on'](_0x215a('0x1d'),this[_0x215a('0x1e')][_0x215a('0x12')](this));ami['on'](_0x215a('0x1f'),this[_0x215a('0x20')][_0x215a('0x12')](this));}VoiceAgentReport[_0x215a('0x21')][_0x215a('0x22')]=function(_0x5e7568,_0x3fc618,_0x2b0e33){io['to'](_0x5e7568)[_0x215a('0x22')](_0x3fc618,_0x2b0e33);};VoiceAgentReport[_0x215a('0x21')][_0x215a('0x23')]=function(_0x5c6520){return _0x5c6520!==null&&!_[_0x215a('0x24')](_0x5c6520);};VoiceAgentReport[_0x215a('0x21')][_0x215a('0xf')]=function(_0x7fe02c){try{if(this['isNotNull'](_0x7fe02c)){logger[_0x215a('0x25')](_0x215a('0x26'),_0x7fe02c['uniqueid'],_0x7fe02c['membername'],_0x7fe02c[_0x215a('0x27')]);logger[_0x215a('0x28')](_0x215a('0x29'),_0x7fe02c[_0x215a('0x2a')],util[_0x215a('0x2b')](_0x7fe02c,{'showHidden':![],'depth':null}));if(_[_0x215a('0x24')](this['channels'][_0x7fe02c[_0x215a('0x2a')]])){this['channels'][_0x7fe02c[_0x215a('0x2a')]]={};}if(_[_0x215a('0x24')](this[_0x215a('0xb')][_0x7fe02c[_0x215a('0x2a')]][_0x7fe02c[_0x215a('0x27')]])){this['channels'][_0x7fe02c['uniqueid']][_0x7fe02c[_0x215a('0x27')]]={'agentcalledAt':moment()[_0x215a('0x2c')](_0x215a('0x2d')),'lastevent':_0x215a('0x2e'),'mandatoryDisposition':this[_0x215a('0xc')][_0x7fe02c['queue']]?this['voiceQueues'][_0x7fe02c[_0x215a('0x2f')]]['mandatoryDisposition']||![]:![],'type':this[_0x215a('0xc')][_0x7fe02c[_0x215a('0x2f')]]?this[_0x215a('0xc')][_0x7fe02c[_0x215a('0x2f')]][_0x215a('0x30')]||_0x215a('0x31'):_0x215a('0x31'),'variables':this[_0x215a('0xe')][_0x7fe02c['uniqueid']]};}_[_0x215a('0x32')](this[_0x215a('0xb')][_0x7fe02c[_0x215a('0x2a')]][_0x7fe02c[_0x215a('0x27')]],_[_0x215a('0x33')](_0x7fe02c,['event','privilege']));logger['debug'](_0x215a('0x34'),_0x7fe02c['uniqueid'],util[_0x215a('0x2b')](this[_0x215a('0xb')][_0x7fe02c[_0x215a('0x2a')]][_0x7fe02c['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x215a('0x22')]('custom:agentcalled',this[_0x215a('0xb')][_0x7fe02c['uniqueid']][_0x7fe02c[_0x215a('0x27')]]);logger[_0x215a('0x28')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x7fe02c[_0x215a('0x2a')],util[_0x215a('0x2b')](this[_0x215a('0xb')][_0x7fe02c[_0x215a('0x2a')]][_0x7fe02c[_0x215a('0x27')]],{'showHidden':![],'depth':null}));this[_0x215a('0x22')](util['format'](_0x215a('0x35'),_0x7fe02c[_0x215a('0x36')]),_0x215a('0x37'),this['channels'][_0x7fe02c[_0x215a('0x2a')]][_0x7fe02c['destuniqueid']]);}}catch(_0x2ff9e3){logger['error'](_0x215a('0x38'),_0x7fe02c[_0x215a('0x2a')],util['inspect'](_0x2ff9e3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x215a('0x21')][_0x215a('0x11')]=function(_0x2de00c){try{if(this['isNotNull'](_0x2de00c)){if(this[_0x215a('0xb')][_0x2de00c[_0x215a('0x2a')]]){logger['debug'](_0x215a('0x39'),_0x2de00c['uniqueid'],util[_0x215a('0x2b')](_0x2de00c,{'showHidden':![],'depth':null}));for(var _0x48f365 in this[_0x215a('0xb')][_0x2de00c[_0x215a('0x2a')]]){if(this['channels'][_0x2de00c[_0x215a('0x2a')]][_0x215a('0x3a')](_0x48f365)){if(_0x2de00c['destuniqueid']===_0x48f365){logger[_0x215a('0x25')](_0x215a('0x3b'),_0x2de00c[_0x215a('0x2a')],_0x2de00c[_0x215a('0x36')],_0x2de00c['destuniqueid']);this['channels'][_0x2de00c['uniqueid']][_0x48f365][_0x215a('0x3c')]=moment()[_0x215a('0x2c')](_0x215a('0x2d'));this[_0x215a('0xb')][_0x2de00c[_0x215a('0x2a')]][_0x48f365][_0x215a('0x3d')]=_0x2de00c[_0x215a('0x3d')];this[_0x215a('0xb')][_0x2de00c[_0x215a('0x2a')]][_0x48f365]['connectedlinenum']=_0x2de00c[_0x215a('0x3e')];this[_0x215a('0xb')][_0x2de00c[_0x215a('0x2a')]][_0x48f365][_0x215a('0x3f')]=_0x2de00c[_0x215a('0x3f')];this[_0x215a('0xb')][_0x2de00c[_0x215a('0x2a')]][_0x48f365][_0x215a('0x40')]=_0x2de00c['destchannelstatedesc'];this[_0x215a('0xb')][_0x2de00c[_0x215a('0x2a')]][_0x48f365][_0x215a('0x41')]=_0x2de00c[_0x215a('0x41')];this[_0x215a('0xb')][_0x2de00c[_0x215a('0x2a')]][_0x48f365][_0x215a('0x42')]=_0x215a('0x43');_[_0x215a('0x32')](this[_0x215a('0xd')][_0x2de00c[_0x215a('0x44')]],_[_0x215a('0x45')](_0x2de00c,['queue','destconnectedlinenum']));logger[_0x215a('0x28')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x2de00c[_0x215a('0x2a')],util[_0x215a('0x2b')](this[_0x215a('0xb')][_0x2de00c[_0x215a('0x2a')]][_0x2de00c[_0x215a('0x27')]],{'showHidden':![],'depth':null}));ami[_0x215a('0x22')]('custom:agentconnect',this[_0x215a('0xb')][_0x2de00c[_0x215a('0x2a')]][_0x2de00c['destuniqueid']]);logger[_0x215a('0x28')](_0x215a('0x46'),_0x2de00c[_0x215a('0x2a')],util[_0x215a('0x2b')](this[_0x215a('0xb')][_0x2de00c[_0x215a('0x2a')]][_0x2de00c[_0x215a('0x27')]],{'showHidden':![],'depth':null}));this[_0x215a('0x22')](util['format'](_0x215a('0x35'),_0x2de00c[_0x215a('0x36')]),_0x215a('0x47'),this[_0x215a('0xb')][_0x2de00c[_0x215a('0x2a')]][_0x2de00c[_0x215a('0x27')]]);}else if(!this[_0x215a('0xb')][_0x2de00c[_0x215a('0x2a')]][_0x48f365][_0x215a('0x48')]&&!this[_0x215a('0xb')][_0x2de00c[_0x215a('0x2a')]][_0x48f365][_0x215a('0x16')]){logger[_0x215a('0x25')](_0x215a('0x49'),_0x2de00c[_0x215a('0x2a')],this[_0x215a('0xb')][_0x2de00c['uniqueid']][_0x48f365][_0x215a('0x36')],_0x48f365);this[_0x215a('0xb')][_0x2de00c[_0x215a('0x2a')]][_0x48f365][_0x215a('0x48')]=!![];this['channels'][_0x2de00c['uniqueid']][_0x48f365][_0x215a('0x4a')]=moment()[_0x215a('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x2de00c['uniqueid']][_0x48f365][_0x215a('0x4b')]=_0x2de00c[_0x215a('0x27')];this['channels'][_0x2de00c[_0x215a('0x2a')]][_0x48f365][_0x215a('0x4c')]=_0x2de00c[_0x215a('0x36')];this[_0x215a('0xb')][_0x2de00c[_0x215a('0x2a')]][_0x48f365]['lastevent']=_0x215a('0x4d');this[_0x215a('0xb')][_0x2de00c[_0x215a('0x2a')]][_0x48f365]['reason']='answered_elsewhere';logger['debug'](_0x215a('0x4e'),_0x2de00c['uniqueid'],util[_0x215a('0x2b')](this['channels'][_0x2de00c[_0x215a('0x2a')]][_0x48f365],{'showHidden':![],'depth':null}));ami['emit'](_0x215a('0x4f'),this[_0x215a('0xb')][_0x2de00c[_0x215a('0x2a')]][_0x48f365]);}}}}}}catch(_0x542a58){logger[_0x215a('0x50')](_0x215a('0x51'),_0x2de00c[_0x215a('0x2a')],util[_0x215a('0x2b')](_0x542a58,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x215a('0x21')][_0x215a('0x13')]=function(_0x5b54c0){try{if(this[_0x215a('0x23')](_0x5b54c0)){logger[_0x215a('0x28')](_0x215a('0x52'),_0x5b54c0[_0x215a('0x2a')],util[_0x215a('0x2b')](_0x5b54c0,{'showHidden':![],'depth':null}));if(this[_0x215a('0xb')][_0x5b54c0['uniqueid']]&&this['channels'][_0x5b54c0['uniqueid']][_0x5b54c0['destuniqueid']]){logger['info'](_0x215a('0x53'),_0x5b54c0[_0x215a('0x2a')],_0x5b54c0[_0x215a('0x36')],_0x5b54c0[_0x215a('0x27')]);this[_0x215a('0xb')][_0x5b54c0[_0x215a('0x2a')]][_0x5b54c0[_0x215a('0x27')]]['agentringnoanswer']=!![];this[_0x215a('0xb')][_0x5b54c0[_0x215a('0x2a')]][_0x5b54c0['destuniqueid']][_0x215a('0x4a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x215a('0xb')][_0x5b54c0[_0x215a('0x2a')]][_0x5b54c0[_0x215a('0x27')]][_0x215a('0x42')]=_0x215a('0x54');this['channels'][_0x5b54c0[_0x215a('0x2a')]][_0x5b54c0[_0x215a('0x27')]]['reason']=_0x215a('0x54');logger[_0x215a('0x28')](_0x215a('0x55'),_0x5b54c0['uniqueid'],util[_0x215a('0x2b')](this[_0x215a('0xb')][_0x5b54c0['uniqueid']][_0x5b54c0[_0x215a('0x27')]],{'showHidden':![],'depth':null}));ami[_0x215a('0x22')](_0x215a('0x56'),this[_0x215a('0xb')][_0x5b54c0[_0x215a('0x2a')]][_0x5b54c0[_0x215a('0x27')]]);}}}catch(_0x1ec961){logger[_0x215a('0x50')](_0x215a('0x57'),_0x5b54c0['uniqueid'],util[_0x215a('0x2b')](_0x1ec961,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x215a('0x21')][_0x215a('0x15')]=function(_0x3926eb){try{if(this[_0x215a('0x23')](_0x3926eb)){logger[_0x215a('0x28')](_0x215a('0x58'),_0x3926eb['uniqueid'],util[_0x215a('0x2b')](_0x3926eb,{'showHidden':![],'depth':null}));if(this[_0x215a('0xb')][_0x3926eb['uniqueid']]){for(var _0x543a9b in this[_0x215a('0xb')][_0x3926eb['uniqueid']]){if(this['channels'][_0x3926eb['uniqueid']][_0x215a('0x3a')](_0x543a9b)&&!this[_0x215a('0xb')][_0x3926eb[_0x215a('0x2a')]][_0x543a9b]['agentringnoanswer']&&!this['channels'][_0x3926eb[_0x215a('0x2a')]][_0x543a9b][_0x215a('0x16')]){logger[_0x215a('0x25')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x3926eb[_0x215a('0x2a')],this[_0x215a('0xb')][_0x3926eb[_0x215a('0x2a')]][_0x543a9b][_0x215a('0x36')],_0x543a9b);this[_0x215a('0xb')][_0x3926eb['uniqueid']][_0x543a9b][_0x215a('0x48')]=!![];this['channels'][_0x3926eb[_0x215a('0x2a')]][_0x543a9b][_0x215a('0x4a')]=moment()['format'](_0x215a('0x2d'));this[_0x215a('0xb')][_0x3926eb[_0x215a('0x2a')]][_0x543a9b][_0x215a('0x42')]=_0x215a('0x59');this[_0x215a('0xb')][_0x3926eb[_0x215a('0x2a')]][_0x543a9b][_0x215a('0x5a')]=_0x215a('0x59');logger['debug']('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x3926eb[_0x215a('0x2a')],util['inspect'](this[_0x215a('0xb')][_0x3926eb['uniqueid']][_0x543a9b],{'showHidden':![],'depth':null}));ami[_0x215a('0x22')](_0x215a('0x5b'),this['channels'][_0x3926eb[_0x215a('0x2a')]][_0x543a9b]);}}}}}catch(_0x112045){logger[_0x215a('0x50')](_0x215a('0x5c'),_0x3926eb['uniqueid'],util['inspect'](_0x112045,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x215a('0x21')][_0x215a('0x17')]=function(_0x62eceb){try{if(this[_0x215a('0x23')](_0x62eceb)){logger[_0x215a('0x28')](_0x215a('0x5d'),_0x62eceb[_0x215a('0x2a')],util[_0x215a('0x2b')](_0x62eceb,{'showHidden':![],'depth':null}));if(this[_0x215a('0xb')][_0x62eceb[_0x215a('0x2a')]]){for(var _0x5ecdd6 in this[_0x215a('0xb')][_0x62eceb[_0x215a('0x2a')]]){if(this[_0x215a('0xb')][_0x62eceb[_0x215a('0x2a')]]['hasOwnProperty'](_0x5ecdd6)){if(this[_0x215a('0xb')][_0x62eceb['uniqueid']][_0x5ecdd6][_0x215a('0x3c')]&&!this[_0x215a('0xb')][_0x62eceb[_0x215a('0x2a')]][_0x5ecdd6]['agentcomplete']){logger[_0x215a('0x25')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x62eceb[_0x215a('0x2a')],this[_0x215a('0xb')][_0x62eceb['uniqueid']][_0x5ecdd6]['membername'],_0x5ecdd6);this['channels'][_0x62eceb[_0x215a('0x2a')]][_0x5ecdd6]['agentcomplete']=!![];this[_0x215a('0xb')][_0x62eceb[_0x215a('0x2a')]][_0x5ecdd6]['agentcompleteAt']=moment()[_0x215a('0x2c')](_0x215a('0x2d'));this[_0x215a('0xb')][_0x62eceb['uniqueid']][_0x5ecdd6]['lastevent']=_0x215a('0x5e');this['channels'][_0x62eceb[_0x215a('0x2a')]][_0x5ecdd6]['reason']=_0x62eceb[_0x215a('0x5a')]==_0x215a('0x5f')?'agent':_0x62eceb[_0x215a('0x5a')];this[_0x215a('0xb')][_0x62eceb['uniqueid']][_0x5ecdd6]['talktime']=_0x62eceb['talktime'];if(this[_0x215a('0xc')][_0x62eceb['queue']]&&this[_0x215a('0xc')][_0x62eceb[_0x215a('0x2f')]][_0x215a('0x60')]){this[_0x215a('0xb')][_0x62eceb[_0x215a('0x2a')]][_0x5ecdd6]['acwtime']=this[_0x215a('0xc')][_0x62eceb[_0x215a('0x2f')]][_0x215a('0x61')];this['channels'][_0x62eceb[_0x215a('0x2a')]][_0x5ecdd6][_0x215a('0x62')]=!![];}this[_0x215a('0xd')][_0x62eceb[_0x215a('0x44')]]=_['omit'](this[_0x215a('0xd')][_0x62eceb[_0x215a('0x44')]],['queue','destconnectedlinenum']);logger[_0x215a('0x28')](_0x215a('0x63'),_0x62eceb['uniqueid'],util[_0x215a('0x2b')](this[_0x215a('0xb')][_0x62eceb[_0x215a('0x2a')]][_0x5ecdd6],{'showHidden':![],'depth':null}));ami[_0x215a('0x22')](_0x215a('0x64'),this[_0x215a('0xb')][_0x62eceb[_0x215a('0x2a')]][_0x5ecdd6]);logger[_0x215a('0x28')](_0x215a('0x65'),_0x62eceb['uniqueid'],util[_0x215a('0x2b')](this['channels'][_0x62eceb['uniqueid']][_0x5ecdd6],{'showHidden':![],'depth':null}));this[_0x215a('0x22')](util[_0x215a('0x2c')]('user:%s',_0x62eceb[_0x215a('0x36')]),_0x215a('0x66'),this[_0x215a('0xb')][_0x62eceb['uniqueid']][_0x5ecdd6]);}}}}}}catch(_0x3e2de8){logger[_0x215a('0x50')](_0x215a('0x67'),_0x62eceb[_0x215a('0x2a')],util[_0x215a('0x2b')](_0x3e2de8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x215a('0x21')]['syncVarSet']=function(_0x206856){try{if(this[_0x215a('0x23')](_0x206856)){logger[_0x215a('0x28')](_0x215a('0x68'),_0x206856[_0x215a('0x2a')],util[_0x215a('0x2b')](_0x206856,{'showHidden':![],'depth':null}));this['addVariable'](_0x206856[_0x215a('0x2a')],_['keys'](_0x206856['variable'])[0x0],_0x206856[_0x215a('0x69')]);if(this[_0x215a('0xb')][_0x206856[_0x215a('0x2a')]]){for(var _0x424670 in this[_0x215a('0xb')][_0x206856['uniqueid']]){if(this[_0x215a('0xb')][_0x206856[_0x215a('0x2a')]][_0x215a('0x3a')](_0x424670)){logger[_0x215a('0x25')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x206856[_0x215a('0x2a')],_0x424670,_[_0x215a('0x6a')](_0x206856['variable'])[0x0],_0x206856[_0x215a('0x69')]);if(_['isUndefined'](this[_0x215a('0xb')][_0x206856['uniqueid']][_0x424670][_0x215a('0xe')])){this[_0x215a('0xb')][_0x206856['uniqueid']][_0x424670][_0x215a('0xe')]={};}this[_0x215a('0xb')][_0x206856[_0x215a('0x2a')]][_0x424670]['variables']=this[_0x215a('0xe')][_0x206856[_0x215a('0x2a')]];}}}}}catch(_0x5eb6de){logger['error']('[%s][voiceAgentReport][varset]',_0x206856['uniqueid'],util[_0x215a('0x2b')](_0x5eb6de,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x215a('0x21')][_0x215a('0x6b')]=function(_0x564ca4,_0x328bf6,_0x40d3f1){var _0x29c104=[_0x215a('0x6c'),_0x215a('0x6d'),_0x215a('0x6e'),_0x215a('0x6f'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x215a('0x70'),_0x215a('0x71'),_0x215a('0x72'),_0x215a('0x73'),_0x215a('0x74'),'bridgepvtcallid',_0x215a('0x75'),_0x215a('0x76'),_0x215a('0x77'),_0x215a('0x78'),_0x215a('0x36'),_0x215a('0x79'),'memberrealtime'];if(!_[_0x215a('0x7a')](_0x328bf6)&&!_[_0x215a('0x7b')](_0x29c104,_0x328bf6)){if(_[_0x215a('0x24')](this[_0x215a('0xe')][_0x564ca4])){this[_0x215a('0xe')][_0x564ca4]={};}this[_0x215a('0xe')][_0x564ca4][_0x328bf6]=_0x40d3f1;}};VoiceAgentReport[_0x215a('0x21')]['syncHangup']=function(_0x5d6ed9){try{if(this[_0x215a('0x23')](_0x5d6ed9)){logger['debug'](_0x215a('0x7c'),_0x5d6ed9['uniqueid'],util[_0x215a('0x2b')](_0x5d6ed9,{'showHidden':![],'depth':null}));if(this['channels'][_0x5d6ed9[_0x215a('0x2a')]]){for(var _0x57407a in this[_0x215a('0xb')][_0x5d6ed9[_0x215a('0x2a')]]){if(this[_0x215a('0xb')][_0x5d6ed9[_0x215a('0x2a')]][_0x215a('0x3a')](_0x57407a)){if(this[_0x215a('0xb')][_0x5d6ed9[_0x215a('0x2a')]][_0x57407a][_0x215a('0x5a')]==_0x215a('0x5f')&&this[_0x215a('0xb')][_0x5d6ed9['uniqueid']][_0x57407a][_0x215a('0x16')]){logger['info'](_0x215a('0x7d'),_0x5d6ed9[_0x215a('0x2a')],_0x57407a);this[_0x215a('0xb')][_0x5d6ed9[_0x215a('0x2a')]][_0x57407a][_0x215a('0x7e')]=moment()[_0x215a('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x215a('0x28')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x5d6ed9[_0x215a('0x2a')],util[_0x215a('0x2b')](_[_0x215a('0x7f')](this[_0x215a('0xb')][_0x5d6ed9[_0x215a('0x2a')]]),{'showHidden':![],'depth':null}));ami[_0x215a('0x22')](_0x215a('0x80'),_[_0x215a('0x7f')](this[_0x215a('0xb')][_0x5d6ed9[_0x215a('0x2a')]]));delete this[_0x215a('0xb')][_0x5d6ed9[_0x215a('0x2a')]];}if(this[_0x215a('0xe')][_0x5d6ed9[_0x215a('0x2a')]]){delete this[_0x215a('0xe')][_0x5d6ed9[_0x215a('0x2a')]];}}}catch(_0x50ddc0){logger[_0x215a('0x50')](_0x215a('0x81'),_0x5d6ed9[_0x215a('0x2a')],util['inspect'](_0x50ddc0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAttendedTransfer']=function(_0x240cc8){try{if(this[_0x215a('0x23')](_0x240cc8)){logger[_0x215a('0x28')](_0x215a('0x82'),_0x240cc8[_0x215a('0x2a')],util['inspect'](_0x240cc8,{'showHidden':![],'depth':null}));if(this[_0x215a('0xb')][_0x240cc8[_0x215a('0x83')]]){for(var _0x4c03d9 in this[_0x215a('0xb')][_0x240cc8[_0x215a('0x83')]]){if(this[_0x215a('0xb')][_0x240cc8['transfereeuniqueid']][_0x215a('0x3a')](_0x4c03d9)){if(_0x240cc8[_0x215a('0x84')]===_0x4c03d9){logger[_0x215a('0x25')](_0x215a('0x85'),_0x240cc8[_0x215a('0x2a')],this['channels'][_0x240cc8[_0x215a('0x83')]][_0x4c03d9][_0x215a('0x36')],_0x4c03d9);var _0x3a30f8=moment();this[_0x215a('0xb')][_0x240cc8['transfereeuniqueid']][_0x4c03d9][_0x215a('0x16')]=!![];this['channels'][_0x240cc8['transfereeuniqueid']][_0x4c03d9][_0x215a('0x7e')]=moment()[_0x215a('0x2c')](_0x215a('0x2d'));this[_0x215a('0xb')][_0x240cc8[_0x215a('0x83')]][_0x4c03d9][_0x215a('0x42')]=_0x215a('0x5e');this[_0x215a('0xb')][_0x240cc8['transfereeuniqueid']][_0x4c03d9][_0x215a('0x5a')]='transfer';this[_0x215a('0xb')][_0x240cc8[_0x215a('0x83')]][_0x4c03d9][_0x215a('0x86')]=_0x3a30f8[_0x215a('0x87')](this[_0x215a('0xb')][_0x240cc8[_0x215a('0x83')]][_0x4c03d9][_0x215a('0x3c')],_0x215a('0x88'));}}}}if(this[_0x215a('0xb')][_0x240cc8['secondtransfereruniqueid']]){var _0x2a0ecd=this[_0x215a('0xb')][_0x240cc8['secondtransfereruniqueid']];this[_0x215a('0xb')][_0x240cc8[_0x215a('0x89')]]=this[_0x215a('0xb')][_0x240cc8[_0x215a('0x83')]];this[_0x215a('0xb')][_0x240cc8[_0x215a('0x83')]]=_0x2a0ecd;}}}catch(_0x409b52){logger['error'](_0x215a('0x8a'),_0x240cc8[_0x215a('0x2a')],util[_0x215a('0x2b')](_0x409b52,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x215a('0x21')][_0x215a('0x20')]=function(_0x3a0909){try{if(this[_0x215a('0x23')](_0x3a0909)){logger[_0x215a('0x28')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x3a0909[_0x215a('0x2a')],util[_0x215a('0x2b')](_0x3a0909,{'showHidden':![],'depth':null}));if(this[_0x215a('0xb')][_0x3a0909[_0x215a('0x83')]]){for(var _0x446872 in this[_0x215a('0xb')][_0x3a0909[_0x215a('0x83')]]){if(this[_0x215a('0xb')][_0x3a0909[_0x215a('0x83')]][_0x215a('0x3a')](_0x446872)){if(_0x3a0909[_0x215a('0x8b')]===_0x446872){logger[_0x215a('0x25')](_0x215a('0x8c'),_0x3a0909[_0x215a('0x2a')],this['channels'][_0x3a0909[_0x215a('0x83')]][_0x446872]['membername'],_0x446872);var _0x3fc338=moment();this['channels'][_0x3a0909[_0x215a('0x83')]][_0x446872][_0x215a('0x16')]=!![];this['channels'][_0x3a0909[_0x215a('0x83')]][_0x446872][_0x215a('0x7e')]=_0x3fc338;this[_0x215a('0xb')][_0x3a0909['transfereeuniqueid']][_0x446872][_0x215a('0x42')]=_0x215a('0x5e');this[_0x215a('0xb')][_0x3a0909[_0x215a('0x83')]][_0x446872][_0x215a('0x5a')]=_0x215a('0x5f');this[_0x215a('0xb')][_0x3a0909[_0x215a('0x83')]][_0x446872]['talktime']=_0x3fc338[_0x215a('0x87')](this[_0x215a('0xb')][_0x3a0909[_0x215a('0x83')]][_0x446872][_0x215a('0x3c')],'seconds');}}}}}}catch(_0x4848ea){logger[_0x215a('0x50')](_0x215a('0x8d'),_0x3a0909[_0x215a('0x2a')],util[_0x215a('0x2b')](_0x4848ea,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x215a('0x21')][_0x215a('0x8e')]=function(_0x24d5ec){var _0x230be7='';try{if(this[_0x215a('0x23')](_0x24d5ec)){logger['debug'](_0x215a('0x8f'),_0x24d5ec[_0x215a('0x2a')],util['inspect'](_0x24d5ec,{'showHidden':![],'depth':null}));if(_0x24d5ec[_0x215a('0x90')]){_0x230be7=_0x24d5ec[_0x215a('0x90')][_0x215a('0x91')](0x0,_0x24d5ec[_0x215a('0x90')][_0x215a('0x92')]('-'));if(this['agents'][_0x230be7]){logger[_0x215a('0x25')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x24d5ec['uniqueid'],_0x230be7);this[_0x215a('0xd')][_0x230be7][_0x215a('0x93')]=!![];}}}}catch(_0x68eb46){logger[_0x215a('0x50')](_0x215a('0x94'),_0x24d5ec[_0x215a('0x2a')],util['inspect'](_0x68eb46,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x215a('0x21')][_0x215a('0x1c')]=function(_0x1c9729){var _0x470bee='';try{if(this['isNotNull'](_0x1c9729)){logger['debug']('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x1c9729[_0x215a('0x2a')],util['inspect'](_0x1c9729,{'showHidden':![],'depth':null}));if(_0x1c9729[_0x215a('0x90')]){_0x470bee=_0x1c9729[_0x215a('0x90')]['substring'](0x0,_0x1c9729[_0x215a('0x90')][_0x215a('0x92')]('-'));if(this[_0x215a('0xd')][_0x470bee]){logger[_0x215a('0x25')](_0x215a('0x95'),_0x1c9729[_0x215a('0x2a')],_0x470bee);this['agents'][_0x470bee]['onhold']=![];}}}}catch(_0x2ec958){logger['error'](_0x215a('0x96'),_0x1c9729['uniqueid'],util[_0x215a('0x2b')](_0x2ec958,{'showHidden':![],'depth':null}));}};module[_0x215a('0x97')]=VoiceAgentReport; \ No newline at end of file +var _0x443c=['[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','syncVarSet','addVariable','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','agentcompleteAt','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','talktime','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','defaults','redis','localhost','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','hangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','channels','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','variables','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','inspect','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','user:called','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','reason','transfer','acw','acwtime','acwTimeout','agentacw','interface'];(function(_0x5e2f89,_0x7b2df8){var _0x30ebe6=function(_0xfc58c1){while(--_0xfc58c1){_0x5e2f89['push'](_0x5e2f89['shift']());}};_0x30ebe6(++_0x7b2df8);}(_0x443c,0xd0));var _0xc443=function(_0x53538f,_0x3b129d){_0x53538f=_0x53538f-0x0;var _0x4a5ffc=_0x443c[_0x53538f];return _0x4a5ffc;};'use strict';var _=require(_0xc443('0x0'));var moment=require(_0xc443('0x1'));var util=require(_0xc443('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')('ami');var ami=require('../ami');config['redis']=_[_0xc443('0x3')](config[_0xc443('0x4')],{'host':_0xc443('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0x2c8874){this['channels']={};this[_0xc443('0x6')]=_0x2c8874[_0xc443('0x6')];this[_0xc443('0x7')]=_0x2c8874['agents'];this['variables']={};ami['on'](_0xc443('0x8'),this[_0xc443('0x9')][_0xc443('0xa')](this));ami['on'](_0xc443('0xb'),this[_0xc443('0xc')]['bind'](this));ami['on'](_0xc443('0xd'),this[_0xc443('0xe')][_0xc443('0xa')](this));ami['on'](_0xc443('0xf'),this[_0xc443('0x10')][_0xc443('0xa')](this));ami['on'](_0xc443('0x11'),this[_0xc443('0x12')][_0xc443('0xa')](this));ami['on']('varset',this['syncVarSet'][_0xc443('0xa')](this));ami['on'](_0xc443('0x13'),this['syncHangup'][_0xc443('0xa')](this));ami['on'](_0xc443('0x14'),this['syncMusicOnHoldStart'][_0xc443('0xa')](this));ami['on'](_0xc443('0x15'),this[_0xc443('0x16')][_0xc443('0xa')](this));ami['on'](_0xc443('0x17'),this['syncAttendedTransfer'][_0xc443('0xa')](this));ami['on'](_0xc443('0x18'),this[_0xc443('0x19')][_0xc443('0xa')](this));}VoiceAgentReport[_0xc443('0x1a')][_0xc443('0x1b')]=function(_0x49cd07,_0x46d727,_0x27dddf){io['to'](_0x49cd07)[_0xc443('0x1b')](_0x46d727,_0x27dddf);};VoiceAgentReport[_0xc443('0x1a')][_0xc443('0x1c')]=function(_0x1cc423){return _0x1cc423!==null&&!_[_0xc443('0x1d')](_0x1cc423);};VoiceAgentReport[_0xc443('0x1a')][_0xc443('0x9')]=function(_0x2ddf3){try{if(this[_0xc443('0x1c')](_0x2ddf3)){logger[_0xc443('0x1e')](_0xc443('0x1f'),_0x2ddf3['uniqueid'],_0x2ddf3[_0xc443('0x20')],_0x2ddf3[_0xc443('0x21')]);logger[_0xc443('0x22')](_0xc443('0x23'),_0x2ddf3[_0xc443('0x24')],util['inspect'](_0x2ddf3,{'showHidden':![],'depth':null}));if(_[_0xc443('0x1d')](this['channels'][_0x2ddf3[_0xc443('0x24')]])){this[_0xc443('0x25')][_0x2ddf3[_0xc443('0x24')]]={};}if(_['isUndefined'](this[_0xc443('0x25')][_0x2ddf3[_0xc443('0x24')]][_0x2ddf3[_0xc443('0x21')]])){this['channels'][_0x2ddf3[_0xc443('0x24')]][_0x2ddf3[_0xc443('0x21')]]={'agentcalledAt':moment()['format'](_0xc443('0x26')),'lastevent':_0xc443('0x27'),'mandatoryDisposition':this['voiceQueues'][_0x2ddf3[_0xc443('0x28')]]?this['voiceQueues'][_0x2ddf3[_0xc443('0x28')]][_0xc443('0x29')]||![]:![],'type':this[_0xc443('0x6')][_0x2ddf3['queue']]?this[_0xc443('0x6')][_0x2ddf3[_0xc443('0x28')]][_0xc443('0x2a')]||_0xc443('0x2b'):_0xc443('0x2b'),'variables':this[_0xc443('0x2c')][_0x2ddf3['uniqueid']]};}_['merge'](this[_0xc443('0x25')][_0x2ddf3[_0xc443('0x24')]][_0x2ddf3[_0xc443('0x21')]],_[_0xc443('0x2d')](_0x2ddf3,[_0xc443('0x2e'),_0xc443('0x2f')]));logger[_0xc443('0x22')](_0xc443('0x30'),_0x2ddf3['uniqueid'],util[_0xc443('0x31')](this[_0xc443('0x25')][_0x2ddf3[_0xc443('0x24')]][_0x2ddf3[_0xc443('0x21')]],{'showHidden':![],'depth':null}));ami[_0xc443('0x1b')](_0xc443('0x32'),this[_0xc443('0x25')][_0x2ddf3[_0xc443('0x24')]][_0x2ddf3[_0xc443('0x21')]]);logger[_0xc443('0x22')](_0xc443('0x33'),_0x2ddf3[_0xc443('0x24')],util[_0xc443('0x31')](this[_0xc443('0x25')][_0x2ddf3[_0xc443('0x24')]][_0x2ddf3[_0xc443('0x21')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xc443('0x34')](_0xc443('0x35'),_0x2ddf3[_0xc443('0x20')]),_0xc443('0x36'),this[_0xc443('0x25')][_0x2ddf3[_0xc443('0x24')]][_0x2ddf3[_0xc443('0x21')]]);}}catch(_0x2d04d2){logger['error'](_0xc443('0x37'),_0x2ddf3[_0xc443('0x24')],util[_0xc443('0x31')](_0x2d04d2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc443('0x1a')][_0xc443('0xc')]=function(_0x4269c5){try{if(this['isNotNull'](_0x4269c5)){if(this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]]){logger['debug']('[%s][voiceAgentReport][agentconnect]\x20event:',_0x4269c5[_0xc443('0x24')],util[_0xc443('0x31')](_0x4269c5,{'showHidden':![],'depth':null}));for(var _0xbd0e23 in this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]]){if(this['channels'][_0x4269c5[_0xc443('0x24')]][_0xc443('0x38')](_0xbd0e23)){if(_0x4269c5[_0xc443('0x21')]===_0xbd0e23){logger['info'](_0xc443('0x39'),_0x4269c5[_0xc443('0x24')],_0x4269c5[_0xc443('0x20')],_0x4269c5[_0xc443('0x21')]);this[_0xc443('0x25')][_0x4269c5['uniqueid']][_0xbd0e23][_0xc443('0x3a')]=moment()[_0xc443('0x34')](_0xc443('0x26'));this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23][_0xc443('0x3b')]=_0x4269c5[_0xc443('0x3b')];this[_0xc443('0x25')][_0x4269c5['uniqueid']][_0xbd0e23][_0xc443('0x3c')]=_0x4269c5[_0xc443('0x3c')];this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23][_0xc443('0x3d')]=_0x4269c5[_0xc443('0x3d')];this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23][_0xc443('0x3e')]=_0x4269c5[_0xc443('0x3e')];this['channels'][_0x4269c5['uniqueid']][_0xbd0e23][_0xc443('0x3f')]=_0x4269c5[_0xc443('0x3f')];this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23][_0xc443('0x40')]=_0xc443('0x41');_['merge'](this[_0xc443('0x7')][_0x4269c5['interface']],_[_0xc443('0x42')](_0x4269c5,[_0xc443('0x28'),_0xc443('0x43')]));logger['debug']('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x4269c5['uniqueid'],util[_0xc443('0x31')](this['channels'][_0x4269c5[_0xc443('0x24')]][_0x4269c5['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xc443('0x44'),this[_0xc443('0x25')][_0x4269c5['uniqueid']][_0x4269c5[_0xc443('0x21')]]);logger[_0xc443('0x22')](_0xc443('0x45'),_0x4269c5[_0xc443('0x24')],util[_0xc443('0x31')](this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0x4269c5[_0xc443('0x21')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xc443('0x34')](_0xc443('0x35'),_0x4269c5[_0xc443('0x20')]),'user:agentconnect',this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0x4269c5[_0xc443('0x21')]]);}else if(!this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23]['agentringnoanswer']&&!this['channels'][_0x4269c5['uniqueid']][_0xbd0e23][_0xc443('0x11')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4269c5[_0xc443('0x24')],this['channels'][_0x4269c5[_0xc443('0x24')]][_0xbd0e23][_0xc443('0x20')],_0xbd0e23);this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23][_0xc443('0xd')]=!![];this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23][_0xc443('0x46')]=moment()['format'](_0xc443('0x26'));this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23][_0xc443('0x47')]=_0x4269c5[_0xc443('0x21')];this[_0xc443('0x25')][_0x4269c5['uniqueid']][_0xbd0e23][_0xc443('0x48')]=_0x4269c5[_0xc443('0x20')];this['channels'][_0x4269c5[_0xc443('0x24')]][_0xbd0e23][_0xc443('0x40')]='answered_elsewhere';this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23]['reason']=_0xc443('0x49');logger[_0xc443('0x22')](_0xc443('0x4a'),_0x4269c5[_0xc443('0x24')],util[_0xc443('0x31')](this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23],{'showHidden':![],'depth':null}));ami['emit'](_0xc443('0x4b'),this[_0xc443('0x25')][_0x4269c5[_0xc443('0x24')]][_0xbd0e23]);}}}}}}catch(_0x2ee2ff){logger[_0xc443('0x4c')](_0xc443('0x4d'),_0x4269c5['uniqueid'],util[_0xc443('0x31')](_0x2ee2ff,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc443('0x1a')][_0xc443('0xe')]=function(_0xa9edcc){try{if(this[_0xc443('0x1c')](_0xa9edcc)){logger[_0xc443('0x22')](_0xc443('0x4e'),_0xa9edcc[_0xc443('0x24')],util[_0xc443('0x31')](_0xa9edcc,{'showHidden':![],'depth':null}));if(this[_0xc443('0x25')][_0xa9edcc[_0xc443('0x24')]]&&this[_0xc443('0x25')][_0xa9edcc['uniqueid']][_0xa9edcc[_0xc443('0x21')]]){logger[_0xc443('0x1e')](_0xc443('0x4f'),_0xa9edcc[_0xc443('0x24')],_0xa9edcc[_0xc443('0x20')],_0xa9edcc[_0xc443('0x21')]);this[_0xc443('0x25')][_0xa9edcc[_0xc443('0x24')]][_0xa9edcc[_0xc443('0x21')]][_0xc443('0xd')]=!![];this[_0xc443('0x25')][_0xa9edcc[_0xc443('0x24')]][_0xa9edcc[_0xc443('0x21')]][_0xc443('0x46')]=moment()[_0xc443('0x34')](_0xc443('0x26'));this[_0xc443('0x25')][_0xa9edcc['uniqueid']][_0xa9edcc[_0xc443('0x21')]]['lastevent']=_0xc443('0x50');this[_0xc443('0x25')][_0xa9edcc[_0xc443('0x24')]][_0xa9edcc[_0xc443('0x21')]]['reason']=_0xc443('0x50');logger[_0xc443('0x22')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0xa9edcc[_0xc443('0x24')],util[_0xc443('0x31')](this[_0xc443('0x25')][_0xa9edcc[_0xc443('0x24')]][_0xa9edcc['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xc443('0x1b')](_0xc443('0x51'),this[_0xc443('0x25')][_0xa9edcc[_0xc443('0x24')]][_0xa9edcc[_0xc443('0x21')]]);}}}catch(_0x2b84c8){logger[_0xc443('0x4c')](_0xc443('0x52'),_0xa9edcc['uniqueid'],util[_0xc443('0x31')](_0x2b84c8,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xc443('0x10')]=function(_0x4ee6b6){try{if(this[_0xc443('0x1c')](_0x4ee6b6)){logger[_0xc443('0x22')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x4ee6b6[_0xc443('0x24')],util[_0xc443('0x31')](_0x4ee6b6,{'showHidden':![],'depth':null}));if(this[_0xc443('0x25')][_0x4ee6b6[_0xc443('0x24')]]){for(var _0x56d007 in this[_0xc443('0x25')][_0x4ee6b6[_0xc443('0x24')]]){if(this['channels'][_0x4ee6b6['uniqueid']][_0xc443('0x38')](_0x56d007)&&!this[_0xc443('0x25')][_0x4ee6b6[_0xc443('0x24')]][_0x56d007][_0xc443('0xd')]&&!this['channels'][_0x4ee6b6[_0xc443('0x24')]][_0x56d007][_0xc443('0x11')]){logger[_0xc443('0x1e')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x4ee6b6[_0xc443('0x24')],this[_0xc443('0x25')][_0x4ee6b6[_0xc443('0x24')]][_0x56d007][_0xc443('0x20')],_0x56d007);this[_0xc443('0x25')][_0x4ee6b6['uniqueid']][_0x56d007][_0xc443('0xd')]=!![];this[_0xc443('0x25')][_0x4ee6b6[_0xc443('0x24')]][_0x56d007][_0xc443('0x46')]=moment()[_0xc443('0x34')](_0xc443('0x26'));this[_0xc443('0x25')][_0x4ee6b6[_0xc443('0x24')]][_0x56d007][_0xc443('0x40')]=_0xc443('0x53');this[_0xc443('0x25')][_0x4ee6b6[_0xc443('0x24')]][_0x56d007]['reason']=_0xc443('0x53');logger[_0xc443('0x22')](_0xc443('0x54'),_0x4ee6b6[_0xc443('0x24')],util['inspect'](this[_0xc443('0x25')][_0x4ee6b6[_0xc443('0x24')]][_0x56d007],{'showHidden':![],'depth':null}));ami['emit']('custom:agentqueuecallerabandon',this[_0xc443('0x25')][_0x4ee6b6[_0xc443('0x24')]][_0x56d007]);}}}}}catch(_0x4d3aaf){logger[_0xc443('0x4c')](_0xc443('0x55'),_0x4ee6b6[_0xc443('0x24')],util[_0xc443('0x31')](_0x4d3aaf,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xc443('0x12')]=function(_0x14f839){try{if(this['isNotNull'](_0x14f839)){logger[_0xc443('0x22')](_0xc443('0x56'),_0x14f839[_0xc443('0x24')],util[_0xc443('0x31')](_0x14f839,{'showHidden':![],'depth':null}));if(this[_0xc443('0x25')][_0x14f839[_0xc443('0x24')]]){for(var _0x16ffcc in this['channels'][_0x14f839[_0xc443('0x24')]]){if(this['channels'][_0x14f839[_0xc443('0x24')]][_0xc443('0x38')](_0x16ffcc)){if(this['channels'][_0x14f839['uniqueid']][_0x16ffcc][_0xc443('0x3a')]&&!this['channels'][_0x14f839['uniqueid']][_0x16ffcc]['agentcomplete']){logger[_0xc443('0x1e')](_0xc443('0x57'),_0x14f839['uniqueid'],this[_0xc443('0x25')][_0x14f839[_0xc443('0x24')]][_0x16ffcc][_0xc443('0x20')],_0x16ffcc);this[_0xc443('0x25')][_0x14f839[_0xc443('0x24')]][_0x16ffcc][_0xc443('0x11')]=!![];this[_0xc443('0x25')][_0x14f839[_0xc443('0x24')]][_0x16ffcc]['agentcompleteAt']=moment()[_0xc443('0x34')](_0xc443('0x26'));this[_0xc443('0x25')][_0x14f839['uniqueid']][_0x16ffcc][_0xc443('0x40')]=_0xc443('0x58');this[_0xc443('0x25')][_0x14f839[_0xc443('0x24')]][_0x16ffcc]['reason']=_0x14f839[_0xc443('0x59')]==_0xc443('0x5a')?'agent':_0x14f839['reason'];this[_0xc443('0x25')][_0x14f839[_0xc443('0x24')]][_0x16ffcc]['talktime']=_0x14f839['talktime'];if(this[_0xc443('0x6')][_0x14f839[_0xc443('0x28')]]&&this[_0xc443('0x6')][_0x14f839[_0xc443('0x28')]][_0xc443('0x5b')]){this[_0xc443('0x25')][_0x14f839[_0xc443('0x24')]][_0x16ffcc][_0xc443('0x5c')]=this[_0xc443('0x6')][_0x14f839['queue']][_0xc443('0x5d')];this[_0xc443('0x25')][_0x14f839[_0xc443('0x24')]][_0x16ffcc][_0xc443('0x5e')]=!![];}this[_0xc443('0x7')][_0x14f839[_0xc443('0x5f')]]=_['omit'](this[_0xc443('0x7')][_0x14f839[_0xc443('0x5f')]],['queue','destconnectedlinenum']);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x14f839[_0xc443('0x24')],util['inspect'](this['channels'][_0x14f839['uniqueid']][_0x16ffcc],{'showHidden':![],'depth':null}));ami[_0xc443('0x1b')]('custom:agentcomplete',this[_0xc443('0x25')][_0x14f839[_0xc443('0x24')]][_0x16ffcc]);logger[_0xc443('0x22')](_0xc443('0x60'),_0x14f839[_0xc443('0x24')],util[_0xc443('0x31')](this[_0xc443('0x25')][_0x14f839[_0xc443('0x24')]][_0x16ffcc],{'showHidden':![],'depth':null}));this['emit'](util[_0xc443('0x34')](_0xc443('0x35'),_0x14f839[_0xc443('0x20')]),_0xc443('0x61'),this['channels'][_0x14f839[_0xc443('0x24')]][_0x16ffcc]);}}}}}}catch(_0x70813){logger['error']('[%s][voiceAgentReport][agentcomplete]',_0x14f839[_0xc443('0x24')],util['inspect'](_0x70813,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc443('0x1a')][_0xc443('0x62')]=function(_0x2dfaa4){try{if(this[_0xc443('0x1c')](_0x2dfaa4)){logger['debug']('[%s][voiceAgentReport][varset]\x20event:',_0x2dfaa4['uniqueid'],util[_0xc443('0x31')](_0x2dfaa4,{'showHidden':![],'depth':null}));this[_0xc443('0x63')](_0x2dfaa4['uniqueid'],_['keys'](_0x2dfaa4[_0xc443('0x64')])[0x0],_0x2dfaa4[_0xc443('0x65')]);if(this['channels'][_0x2dfaa4['uniqueid']]){for(var _0x221aaf in this['channels'][_0x2dfaa4[_0xc443('0x24')]]){if(this[_0xc443('0x25')][_0x2dfaa4[_0xc443('0x24')]][_0xc443('0x38')](_0x221aaf)){logger['info'](_0xc443('0x66'),_0x2dfaa4[_0xc443('0x24')],_0x221aaf,_[_0xc443('0x67')](_0x2dfaa4['variable'])[0x0],_0x2dfaa4[_0xc443('0x65')]);if(_['isUndefined'](this[_0xc443('0x25')][_0x2dfaa4[_0xc443('0x24')]][_0x221aaf]['variables'])){this[_0xc443('0x25')][_0x2dfaa4[_0xc443('0x24')]][_0x221aaf][_0xc443('0x2c')]={};}this['channels'][_0x2dfaa4[_0xc443('0x24')]][_0x221aaf]['variables']=this['variables'][_0x2dfaa4[_0xc443('0x24')]];}}}}}catch(_0x156093){logger[_0xc443('0x4c')](_0xc443('0x68'),_0x2dfaa4['uniqueid'],util[_0xc443('0x31')](_0x156093,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc443('0x1a')][_0xc443('0x63')]=function(_0x430a69,_0x1ecdc5,_0x33afca){var _0xc1f168=[_0xc443('0x69'),_0xc443('0x6a'),_0xc443('0x6b'),_0xc443('0x6c'),_0xc443('0x6d'),_0xc443('0x6e'),'rtpaudioqosrtt',_0xc443('0x6f'),_0xc443('0x70'),'sipuri',_0xc443('0x71'),_0xc443('0x72'),_0xc443('0x73'),_0xc443('0x74'),_0xc443('0x75'),_0xc443('0x76'),_0xc443('0x20'),'memberpenalty',_0xc443('0x77')];if(!_['isNil'](_0x1ecdc5)&&!_[_0xc443('0x78')](_0xc1f168,_0x1ecdc5)){if(_[_0xc443('0x1d')](this['variables'][_0x430a69])){this[_0xc443('0x2c')][_0x430a69]={};}this['variables'][_0x430a69][_0x1ecdc5]=_0x33afca;}};VoiceAgentReport[_0xc443('0x1a')][_0xc443('0x79')]=function(_0x55994e){try{if(this[_0xc443('0x1c')](_0x55994e)){logger[_0xc443('0x22')](_0xc443('0x7a'),_0x55994e[_0xc443('0x24')],util[_0xc443('0x31')](_0x55994e,{'showHidden':![],'depth':null}));if(this[_0xc443('0x25')][_0x55994e[_0xc443('0x24')]]){for(var _0x3b643d in this[_0xc443('0x25')][_0x55994e[_0xc443('0x24')]]){if(this[_0xc443('0x25')][_0x55994e[_0xc443('0x24')]][_0xc443('0x38')](_0x3b643d)){if(this['channels'][_0x55994e[_0xc443('0x24')]][_0x3b643d][_0xc443('0x59')]=='transfer'&&this[_0xc443('0x25')][_0x55994e[_0xc443('0x24')]][_0x3b643d][_0xc443('0x11')]){logger[_0xc443('0x1e')](_0xc443('0x7b'),_0x55994e[_0xc443('0x24')],_0x3b643d);this[_0xc443('0x25')][_0x55994e['uniqueid']][_0x3b643d][_0xc443('0x7c')]=moment()[_0xc443('0x34')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug']('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x55994e[_0xc443('0x24')],util[_0xc443('0x31')](_[_0xc443('0x7d')](this[_0xc443('0x25')][_0x55994e[_0xc443('0x24')]]),{'showHidden':![],'depth':null}));ami[_0xc443('0x1b')](_0xc443('0x7e'),_[_0xc443('0x7d')](this[_0xc443('0x25')][_0x55994e[_0xc443('0x24')]]));delete this[_0xc443('0x25')][_0x55994e['uniqueid']];}if(this[_0xc443('0x2c')][_0x55994e['uniqueid']]){delete this['variables'][_0x55994e[_0xc443('0x24')]];}}}catch(_0x22ecee){logger[_0xc443('0x4c')](_0xc443('0x7f'),_0x55994e['uniqueid'],util['inspect'](_0x22ecee,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xc443('0x80')]=function(_0x452cf1){try{if(this[_0xc443('0x1c')](_0x452cf1)){logger[_0xc443('0x22')](_0xc443('0x81'),_0x452cf1['uniqueid'],util['inspect'](_0x452cf1,{'showHidden':![],'depth':null}));if(this['channels'][_0x452cf1[_0xc443('0x82')]]){for(var _0x1071c4 in this['channels'][_0x452cf1[_0xc443('0x82')]]){if(this[_0xc443('0x25')][_0x452cf1[_0xc443('0x82')]][_0xc443('0x38')](_0x1071c4)){if(_0x452cf1[_0xc443('0x83')]===_0x1071c4){logger[_0xc443('0x1e')](_0xc443('0x84'),_0x452cf1['uniqueid'],this[_0xc443('0x25')][_0x452cf1['transfereeuniqueid']][_0x1071c4][_0xc443('0x20')],_0x1071c4);var _0xc366c8=moment();this['channels'][_0x452cf1[_0xc443('0x82')]][_0x1071c4][_0xc443('0x11')]=!![];this[_0xc443('0x25')][_0x452cf1[_0xc443('0x82')]][_0x1071c4][_0xc443('0x7c')]=moment()[_0xc443('0x34')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x452cf1[_0xc443('0x82')]][_0x1071c4][_0xc443('0x40')]=_0xc443('0x58');this[_0xc443('0x25')][_0x452cf1['transfereeuniqueid']][_0x1071c4][_0xc443('0x59')]=_0xc443('0x5a');this['channels'][_0x452cf1[_0xc443('0x82')]][_0x1071c4][_0xc443('0x85')]=_0xc366c8['diff'](this[_0xc443('0x25')][_0x452cf1[_0xc443('0x82')]][_0x1071c4][_0xc443('0x3a')],_0xc443('0x86'));}}}}if(this[_0xc443('0x25')][_0x452cf1[_0xc443('0x87')]]){var _0x390096=this[_0xc443('0x25')][_0x452cf1[_0xc443('0x87')]];this[_0xc443('0x25')][_0x452cf1[_0xc443('0x87')]]=this[_0xc443('0x25')][_0x452cf1[_0xc443('0x82')]];this[_0xc443('0x25')][_0x452cf1['transfereeuniqueid']]=_0x390096;}}}catch(_0x31011c){logger[_0xc443('0x4c')](_0xc443('0x88'),_0x452cf1[_0xc443('0x24')],util[_0xc443('0x31')](_0x31011c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncBlindTransfer']=function(_0x3b994a){try{if(this['isNotNull'](_0x3b994a)){logger[_0xc443('0x22')](_0xc443('0x89'),_0x3b994a[_0xc443('0x24')],util[_0xc443('0x31')](_0x3b994a,{'showHidden':![],'depth':null}));if(this[_0xc443('0x25')][_0x3b994a['transfereeuniqueid']]){for(var _0x15bbad in this[_0xc443('0x25')][_0x3b994a[_0xc443('0x82')]]){if(this[_0xc443('0x25')][_0x3b994a[_0xc443('0x82')]][_0xc443('0x38')](_0x15bbad)){if(_0x3b994a[_0xc443('0x8a')]===_0x15bbad){logger[_0xc443('0x1e')](_0xc443('0x8b'),_0x3b994a[_0xc443('0x24')],this[_0xc443('0x25')][_0x3b994a[_0xc443('0x82')]][_0x15bbad][_0xc443('0x20')],_0x15bbad);var _0x520176=moment();this[_0xc443('0x25')][_0x3b994a['transfereeuniqueid']][_0x15bbad]['agentcomplete']=!![];this[_0xc443('0x25')][_0x3b994a[_0xc443('0x82')]][_0x15bbad][_0xc443('0x7c')]=_0x520176;this[_0xc443('0x25')][_0x3b994a[_0xc443('0x82')]][_0x15bbad][_0xc443('0x40')]=_0xc443('0x58');this[_0xc443('0x25')][_0x3b994a[_0xc443('0x82')]][_0x15bbad]['reason']=_0xc443('0x5a');this[_0xc443('0x25')][_0x3b994a[_0xc443('0x82')]][_0x15bbad][_0xc443('0x85')]=_0x520176[_0xc443('0x8c')](this[_0xc443('0x25')][_0x3b994a['transfereeuniqueid']][_0x15bbad][_0xc443('0x3a')],_0xc443('0x86'));}}}}}}catch(_0xba2323){logger[_0xc443('0x4c')](_0xc443('0x8d'),_0x3b994a[_0xc443('0x24')],util['inspect'](_0xba2323,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc443('0x1a')][_0xc443('0x8e')]=function(_0x45d9b7){var _0x291f3a='';try{if(this['isNotNull'](_0x45d9b7)){logger[_0xc443('0x22')](_0xc443('0x8f'),_0x45d9b7[_0xc443('0x24')],util[_0xc443('0x31')](_0x45d9b7,{'showHidden':![],'depth':null}));if(_0x45d9b7[_0xc443('0x90')]){_0x291f3a=_0x45d9b7[_0xc443('0x90')][_0xc443('0x91')](0x0,_0x45d9b7[_0xc443('0x90')][_0xc443('0x92')]('-'));if(this[_0xc443('0x7')][_0x291f3a]){logger[_0xc443('0x1e')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x45d9b7[_0xc443('0x24')],_0x291f3a);this[_0xc443('0x7')][_0x291f3a][_0xc443('0x93')]=!![];}}}}catch(_0x3e786d){logger[_0xc443('0x4c')](_0xc443('0x94'),_0x45d9b7['uniqueid'],util[_0xc443('0x31')](_0x3e786d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc443('0x1a')][_0xc443('0x16')]=function(_0x5b6f54){var _0x188520='';try{if(this['isNotNull'](_0x5b6f54)){logger[_0xc443('0x22')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x5b6f54[_0xc443('0x24')],util[_0xc443('0x31')](_0x5b6f54,{'showHidden':![],'depth':null}));if(_0x5b6f54[_0xc443('0x90')]){_0x188520=_0x5b6f54['channel'][_0xc443('0x91')](0x0,_0x5b6f54[_0xc443('0x90')][_0xc443('0x92')]('-'));if(this[_0xc443('0x7')][_0x188520]){logger[_0xc443('0x1e')](_0xc443('0x95'),_0x5b6f54[_0xc443('0x24')],_0x188520);this[_0xc443('0x7')][_0x188520][_0xc443('0x93')]=![];}}}}catch(_0x2077da){logger[_0xc443('0x4c')](_0xc443('0x96'),_0x5b6f54[_0xc443('0x24')],util[_0xc443('0x31')](_0x2077da,{'showHidden':![],'depth':null}));}};module[_0xc443('0x97')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index e692a62..f2e2ce3 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 _0x02ff=['[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','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','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','answertime','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','event','BlindTransfer','outbound','blindTransfers','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','exports','bluebird','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','../model/channel','unknown','invalid','ringing','ringinuse','onhold','set','queue','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','newexten','newchannel','syncNewChannel','newstate','syncNewState','bind','syncVarSet','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','prototype','isNotNull','isUndefined','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','inspect','linkedid','merge','pick','keys','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','format','channelstate','from-sip','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','split','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','appdata','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','cdr(','match','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','holdtime','diff','connectedlinename','destinationchannel','toNumber','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','find','monitors','isNil','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-callerid','callerid','xmd-cdrtype','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum'];(function(_0x280d29,_0x4d12b8){var _0x14464a=function(_0x2eea47){while(--_0x2eea47){_0x280d29['push'](_0x280d29['shift']());}};_0x14464a(++_0x4d12b8);}(_0x02ff,0xef));var _0xf02f=function(_0x1752a7,_0x1f3f3e){_0x1752a7=_0x1752a7-0x0;var _0x5086a4=_0x02ff[_0x1752a7];return _0x5086a4;};'use strict';var BPromise=require(_0xf02f('0x0'));var _=require(_0xf02f('0x1'));var moment=require(_0xf02f('0x2'));var util=require(_0xf02f('0x3'));var path=require('path');var Redis=require(_0xf02f('0x4'));var config=require(_0xf02f('0x5'));var logger=require(_0xf02f('0x6'))('ami');var ami=require('../ami');var Channel=require(_0xf02f('0x7'));var statusDesc=[_0xf02f('0x8'),'not_inuse','inuse','busy',_0xf02f('0x9'),'unavailable',_0xf02f('0xa'),_0xf02f('0xb'),_0xf02f('0xc')];var applications=[_0xf02f('0xd'),_0xf02f('0xe'),'agi',_0xf02f('0xf'),_0xf02f('0x10'),_0xf02f('0x11')];var dispositions=[_0xf02f('0x12'),_0xf02f('0x13'),_0xf02f('0x13'),'NO\x20ANSWER',_0xf02f('0x12'),_0xf02f('0x12'),_0xf02f('0x14'),_0xf02f('0x15'),_0xf02f('0x13'),_0xf02f('0x13'),_0xf02f('0x13')];var actions={};config['redis']=_[_0xf02f('0x16')](config[_0xf02f('0x17')],{'host':_0xf02f('0x18'),'port':0x18eb});var io=require(_0xf02f('0x19'))(new Redis(config[_0xf02f('0x17')]));function VoiceCallReport(_0x7c4698){this[_0xf02f('0x1a')]=_0x7c4698[_0xf02f('0x1a')];this['agents']=_0x7c4698[_0xf02f('0x1b')];this['blindTransfers']={};ami['on'](_0xf02f('0x1c'),this[_0xf02f('0x1d')]['bind'](this));ami['on'](_0xf02f('0x1e'),this['syncNewExten']['bind'](this));ami['on'](_0xf02f('0x1f'),this[_0xf02f('0x20')]['bind'](this));ami['on'](_0xf02f('0x21'),this[_0xf02f('0x22')][_0xf02f('0x23')](this));ami['on']('varset',this[_0xf02f('0x24')]['bind'](this));ami['on']('hangup',this[_0xf02f('0x25')][_0xf02f('0x23')](this));ami['on'](_0xf02f('0x26'),this['syncNewCallerId'][_0xf02f('0x23')](this));ami['on'](_0xf02f('0x27'),this[_0xf02f('0x28')][_0xf02f('0x23')](this));ami['on'](_0xf02f('0x29'),this[_0xf02f('0x2a')][_0xf02f('0x23')](this));ami['on'](_0xf02f('0x2b'),this[_0xf02f('0x2c')][_0xf02f('0x23')](this));ami['on'](_0xf02f('0x2d'),this['syncMusicOnHoldStop'][_0xf02f('0x23')](this));try{logger[_0xf02f('0x2e')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0xf02f('0x2f')]();}catch(_0xcf4265){logger[_0xf02f('0x30')](_0xf02f('0x31'),util['inspect'](_0xcf4265,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xf02f('0x32')][_0xf02f('0x33')]=function(_0x4863f9){return _0x4863f9!==null&&!_[_0xf02f('0x34')](_0x4863f9);};VoiceCallReport[_0xf02f('0x32')]['emit']=function(_0x491e32,_0x199af3,_0xe69f66){io['to'](_0x491e32)[_0xf02f('0x35')](_0x199af3,_0xe69f66);};VoiceCallReport[_0xf02f('0x32')][_0xf02f('0x36')]=function(_0x4d369b){try{if(this['isNotNull'](_0x4d369b)){logger[_0xf02f('0x2e')](_0xf02f('0x37'),_0x4d369b[_0xf02f('0x38')],_0x4d369b[_0xf02f('0x39')],_0x4d369b['calleridnum']);logger[_0xf02f('0x3a')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x4d369b[_0xf02f('0x38')],util[_0xf02f('0x3b')](_0x4d369b,{'showHidden':![],'depth':null}));if(_0x4d369b[_0xf02f('0x38')]===_0x4d369b[_0xf02f('0x3c')]){if(!_[_0xf02f('0x34')](this[_0xf02f('0x1a')][_0x4d369b[_0xf02f('0x38')]])){_[_0xf02f('0x3d')](this[_0xf02f('0x1a')][_0x4d369b[_0xf02f('0x38')]],_[_0xf02f('0x3e')](_0x4d369b,_[_0xf02f('0x3f')](this['channels'][_0x4d369b[_0xf02f('0x38')]])));}}}}catch(_0x57cf6e){logger[_0xf02f('0x30')](_0xf02f('0x40'),_0x4d369b['uniqueid'],util[_0xf02f('0x3b')](_0x57cf6e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf02f('0x32')][_0xf02f('0x20')]=function(_0x23b1d2){try{if(this[_0xf02f('0x33')](_0x23b1d2)){logger['debug'](_0xf02f('0x41'),_0x23b1d2[_0xf02f('0x38')],util[_0xf02f('0x3b')](_0x23b1d2,{'showHidden':![],'depth':null}));if(_0x23b1d2['uniqueid']===_0x23b1d2['linkedid']&&_0x23b1d2[_0xf02f('0x42')]!=_0xf02f('0x43')){if(_[_0xf02f('0x34')](this['channels'][_0x23b1d2[_0xf02f('0x38')]])){logger['info'](_0xf02f('0x44'),_0x23b1d2[_0xf02f('0x38')],_0x23b1d2[_0xf02f('0x45')],_0x23b1d2[_0xf02f('0x46')]);this['channels'][_0x23b1d2[_0xf02f('0x38')]]=new Channel();this[_0xf02f('0x1a')][_0x23b1d2[_0xf02f('0x38')]][_0xf02f('0x47')]=moment()[_0xf02f('0x48')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xf02f('0x1a')][_0x23b1d2['uniqueid']]['disposition']=dispositions[_['toNumber'](_0x23b1d2[_0xf02f('0x49')])];_[_0xf02f('0x3d')](this[_0xf02f('0x1a')][_0x23b1d2[_0xf02f('0x38')]],_[_0xf02f('0x3e')](_0x23b1d2,_[_0xf02f('0x3f')](this[_0xf02f('0x1a')][_0x23b1d2['uniqueid']])));if(_0x23b1d2[_0xf02f('0x45')]===_0xf02f('0x4a')){if(this[_0xf02f('0x1b')][_0x23b1d2[_0xf02f('0x42')]['split']('-')[0x0]]){this['agents'][_0x23b1d2[_0xf02f('0x42')]['split']('-')[0x0]][_0xf02f('0x4b')]=_0x23b1d2[_0xf02f('0x46')];logger['debug'](_0xf02f('0x4c'),_0x23b1d2['uniqueid'],util[_0xf02f('0x3b')]({'destaccountcode':this['agents'][_0x23b1d2[_0xf02f('0x42')][_0xf02f('0x4d')]('-')[0x0]][_0xf02f('0x4e')],'destconnectedlinenum':_0x23b1d2[_0xf02f('0x46')]},{'showHidden':![],'depth':null}));this[_0xf02f('0x35')](util[_0xf02f('0x48')](_0xf02f('0x4f'),this[_0xf02f('0x1b')][_0x23b1d2[_0xf02f('0x42')][_0xf02f('0x4d')]('-')[0x0]][_0xf02f('0x50')]),_0xf02f('0x51'),{'destaccountcode':this[_0xf02f('0x1b')][_0x23b1d2[_0xf02f('0x42')][_0xf02f('0x4d')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x23b1d2[_0xf02f('0x46')]});}}}}}}catch(_0xccd127){logger['error'](_0xf02f('0x52'),_0x23b1d2[_0xf02f('0x38')],util[_0xf02f('0x3b')](_0xccd127,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf02f('0x32')][_0xf02f('0x1d')]=function(_0x138dc3){try{if(this[_0xf02f('0x33')](_0x138dc3)){logger[_0xf02f('0x3a')](_0xf02f('0x53'),_0x138dc3[_0xf02f('0x38')],util['inspect'](_0x138dc3,{'showHidden':![],'depth':null}));if(_0x138dc3[_0xf02f('0x38')]===_0x138dc3['linkedid']&&_0x138dc3[_0xf02f('0x46')]!='h'&&_0x138dc3['channel']!=_0xf02f('0x43')){_0x138dc3[_0xf02f('0x54')]=_0x138dc3['application'][_0xf02f('0x55')]();_0x138dc3['applicationdata']=(_0x138dc3[_0xf02f('0x56')]||_0x138dc3[_0xf02f('0x57')])[_0xf02f('0x55')]();logger['info'](_0xf02f('0x58'),_0x138dc3[_0xf02f('0x38')],_0x138dc3[_0xf02f('0x54')],_0x138dc3[_0xf02f('0x57')]);if(_[_0xf02f('0x34')](this[_0xf02f('0x1a')][_0x138dc3[_0xf02f('0x38')]])){this['channels'][_0x138dc3[_0xf02f('0x38')]]=new Channel();this[_0xf02f('0x1a')][_0x138dc3['uniqueid']][_0xf02f('0x47')]=_0x138dc3[_0xf02f('0x59')]?moment()[_0xf02f('0x5a')](moment[_0xf02f('0x59')](_0x138dc3['duration'])['seconds'](),_0xf02f('0x5b'))[_0xf02f('0x48')](_0xf02f('0x5c')):moment()[_0xf02f('0x48')](_0xf02f('0x5c'));this[_0xf02f('0x1a')][_0x138dc3[_0xf02f('0x38')]]['disposition']=_0xf02f('0x12');}_['merge'](this[_0xf02f('0x1a')][_0x138dc3[_0xf02f('0x38')]],_[_0xf02f('0x3e')](_0x138dc3,_[_0xf02f('0x3f')](this[_0xf02f('0x1a')][_0x138dc3['uniqueid']])));if(_[_0xf02f('0x5d')](applications,_0x138dc3[_0xf02f('0x54')])){this[_0xf02f('0x1a')][_0x138dc3[_0xf02f('0x38')]][_0xf02f('0x5e')]=_0x138dc3[_0xf02f('0x54')];this[_0xf02f('0x1a')][_0x138dc3[_0xf02f('0x38')]]['lastdata']=_0x138dc3[_0xf02f('0x57')];if(_0x138dc3[_0xf02f('0x54')]===_0xf02f('0xd')&&_['startsWith'](_0x138dc3['applicationdata'],_0xf02f('0x5f'))){var _0x37e7a2=_0x138dc3[_0xf02f('0x57')][_0xf02f('0x4d')]('=');var _0x18d8c5=_0x37e7a2[0x0][_0xf02f('0x60')](/cdr\((.*)\)/);if(_0x18d8c5){this[_0xf02f('0x1a')][_0x138dc3[_0xf02f('0x38')]][_0x18d8c5[0x1]]=_0x37e7a2[0x1];}}else if(_0x138dc3[_0xf02f('0x54')]==='queue'){this['channels'][_0x138dc3[_0xf02f('0x38')]]['queue']=_0x138dc3[_0xf02f('0x57')][_0xf02f('0x4d')](',')[0x0];}}}}}catch(_0x5107be){logger[_0xf02f('0x30')]('[%s][voiceCallReport][newexten]',_0x138dc3[_0xf02f('0x38')],util[_0xf02f('0x3b')](_0x5107be,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf02f('0x32')][_0xf02f('0x22')]=function(_0x153e43){try{if(this[_0xf02f('0x33')](_0x153e43)){logger[_0xf02f('0x2e')](_0xf02f('0x61'),_0x153e43['uniqueid'],_0x153e43[_0xf02f('0x3c')],_0x153e43[_0xf02f('0x39')],_0x153e43[_0xf02f('0x62')]);logger[_0xf02f('0x3a')](_0xf02f('0x63'),_0x153e43[_0xf02f('0x38')],util[_0xf02f('0x3b')](_0x153e43,{'showHidden':![],'depth':null}));if(_0x153e43[_0xf02f('0x38')]!==_0x153e43[_0xf02f('0x3c')]){if(this[_0xf02f('0x1a')][_0x153e43[_0xf02f('0x3c')]]){if(_0x153e43[_0xf02f('0x49')]==='6'){if(!this[_0xf02f('0x1a')][_0x153e43[_0xf02f('0x3c')]][_0xf02f('0x64')]){var _0x5a9d1a=moment();this['channels'][_0x153e43[_0xf02f('0x3c')]]['answered']=!![];this[_0xf02f('0x1a')][_0x153e43[_0xf02f('0x3c')]]['answertime']=_0x5a9d1a[_0xf02f('0x48')](_0xf02f('0x5c'));if(this[_0xf02f('0x1a')][_0x153e43[_0xf02f('0x3c')]][_0xf02f('0x47')]){this[_0xf02f('0x1a')][_0x153e43[_0xf02f('0x3c')]][_0xf02f('0x65')]=_0x5a9d1a[_0xf02f('0x66')](this[_0xf02f('0x1a')][_0x153e43[_0xf02f('0x3c')]][_0xf02f('0x47')],'seconds');}}this['channels'][_0x153e43['linkedid']][_0xf02f('0x3c')]=_0x153e43[_0xf02f('0x38')];if(_0x153e43[_0xf02f('0x62')]!=='xcally-motion-preview'){this[_0xf02f('0x1a')][_0x153e43[_0xf02f('0x3c')]]['connectedlinenum']=_0x153e43['calleridnum'];}this[_0xf02f('0x1a')][_0x153e43['linkedid']][_0xf02f('0x67')]=_0x153e43[_0xf02f('0x39')];this[_0xf02f('0x1a')][_0x153e43[_0xf02f('0x3c')]][_0xf02f('0x68')]=_0x153e43[_0xf02f('0x42')];this[_0xf02f('0x1a')][_0x153e43[_0xf02f('0x3c')]]['disposition']=dispositions[_[_0xf02f('0x69')](_0x153e43[_0xf02f('0x49')])];if(this['agents'][_0x153e43[_0xf02f('0x42')][_0xf02f('0x4d')]('-')[0x0]]){this['channels'][_0x153e43[_0xf02f('0x3c')]][_0xf02f('0x6a')]=this[_0xf02f('0x1b')][_0x153e43[_0xf02f('0x42')][_0xf02f('0x4d')]('-')[0x0]]['id'];this[_0xf02f('0x1a')][_0x153e43[_0xf02f('0x3c')]][_0xf02f('0x6b')]=this[_0xf02f('0x1b')][_0x153e43[_0xf02f('0x42')]['split']('-')[0x0]][_0xf02f('0x50')];}}}}else{if(this[_0xf02f('0x1a')][_0x153e43[_0xf02f('0x38')]]){if(_0x153e43['channelstate']==='6'){if(this[_0xf02f('0x1b')][_0x153e43[_0xf02f('0x42')][_0xf02f('0x4d')]('-')[0x0]]){this[_0xf02f('0x1a')][_0x153e43[_0xf02f('0x38')]]['UserId']=this['agents'][_0x153e43[_0xf02f('0x42')][_0xf02f('0x4d')]('-')[0x0]]['id'];this[_0xf02f('0x1a')][_0x153e43[_0xf02f('0x38')]]['membername']=this[_0xf02f('0x1b')][_0x153e43[_0xf02f('0x42')][_0xf02f('0x4d')]('-')[0x0]][_0xf02f('0x50')];}}}}}}catch(_0x38e3ee){logger[_0xf02f('0x30')](_0xf02f('0x6c'),_0x153e43[_0xf02f('0x38')],util[_0xf02f('0x3b')](_0x38e3ee,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf02f('0x32')][_0xf02f('0x6d')]=function(_0x5b3461,_0x4415fd){try{if(this[_0xf02f('0x1a')][_0x5b3461]){logger[_0xf02f('0x2e')](_0xf02f('0x6e'),_0x5b3461,_0x4415fd);this[_0xf02f('0x1a')][_0x5b3461][_0xf02f('0x6f')]=!![];if(_[_0xf02f('0x70')](_0x4415fd,_0xf02f('0x71'))){_0x4415fd=_0x4415fd[_0xf02f('0x72')]('.wav49',_0xf02f('0x73'));}this[_0xf02f('0x1a')][_0x5b3461]['monitorFilename']=_0x4415fd;var _0x3e35d6=_[_0xf02f('0x74')](this[_0xf02f('0x1a')][_0x5b3461][_0xf02f('0x75')],{'filename':_0x4415fd});if(_[_0xf02f('0x76')](_0x3e35d6)){this['channels'][_0x5b3461][_0xf02f('0x75')]['push']({'filename':_0x4415fd,'createdAt':moment()[_0xf02f('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xf02f('0x77')});}}}catch(_0x354b0b){logger['error'](_0xf02f('0x78'),_0x5b3461,util[_0xf02f('0x3b')](_0x354b0b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf02f('0x32')][_0xf02f('0x24')]=function(_0x47df8d){try{if(this[_0xf02f('0x33')](_0x47df8d)){logger['debug'](_0xf02f('0x79'),_0x47df8d[_0xf02f('0x38')],util['inspect'](_0x47df8d,{'showHidden':![],'depth':null}));if(this[_0xf02f('0x1a')][_0x47df8d[_0xf02f('0x38')]]&&_0x47df8d[_0xf02f('0x42')]!=_0xf02f('0x43')){if(this[_0xf02f('0x33')](_0x47df8d[_0xf02f('0x7a')])){if(this[_0xf02f('0x33')](_0x47df8d['variable'][_0xf02f('0x7b')])){logger['info'](_0xf02f('0x7c'),_0x47df8d['uniqueid'],_0x47df8d[_0xf02f('0x7d')]);this['syncMixMonitorFilename'](_0x47df8d[_0xf02f('0x38')],_0x47df8d[_0xf02f('0x7d')]);}else if(this[_0xf02f('0x33')](_0x47df8d[_0xf02f('0x7a')]['xmd-phone'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x47df8d[_0xf02f('0x38')],_0x47df8d[_0xf02f('0x7d')]);this[_0xf02f('0x1a')][_0x47df8d['uniqueid']][_0xf02f('0x62')]=_0x47df8d[_0xf02f('0x7d')];}else if(this[_0xf02f('0x33')](_0x47df8d[_0xf02f('0x7a')][_0xf02f('0x7e')])){logger[_0xf02f('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x47df8d[_0xf02f('0x38')],_0x47df8d[_0xf02f('0x7d')]);this['channels'][_0x47df8d[_0xf02f('0x38')]][_0xf02f('0x7f')]=_0x47df8d[_0xf02f('0x7d')];}else if(this[_0xf02f('0x33')](_0x47df8d[_0xf02f('0x7a')][_0xf02f('0x80')])){logger[_0xf02f('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x47df8d[_0xf02f('0x38')],_0x47df8d[_0xf02f('0x7d')]);this['channels'][_0x47df8d[_0xf02f('0x38')]][_0xf02f('0x81')]=_0x47df8d[_0xf02f('0x7d')];}else if(this['isNotNull'](_0x47df8d[_0xf02f('0x7a')][_0xf02f('0x82')])){logger[_0xf02f('0x2e')](_0xf02f('0x83'),_0x47df8d[_0xf02f('0x38')],_0x47df8d[_0xf02f('0x7d')][_0xf02f('0x4d')](',')[0x0]);this[_0xf02f('0x1a')][_0x47df8d[_0xf02f('0x38')]][_0xf02f('0xe')]=_0x47df8d[_0xf02f('0x7d')][_0xf02f('0x4d')](',')[0x0];}else if(this[_0xf02f('0x33')](_0x47df8d[_0xf02f('0x7a')][_0xf02f('0x84')])){logger[_0xf02f('0x2e')](_0xf02f('0x85'),_0x47df8d['uniqueid'],_0x47df8d['value']);this[_0xf02f('0x1a')][_0x47df8d[_0xf02f('0x38')]][_0xf02f('0x86')]=_0x47df8d[_0xf02f('0x7d')];}else if(this[_0xf02f('0x33')](_0x47df8d[_0xf02f('0x7a')][_0xf02f('0x87')])){logger[_0xf02f('0x2e')](_0xf02f('0x88'),_0x47df8d['uniqueid'],_0x47df8d[_0xf02f('0x7d')]);this[_0xf02f('0x1a')][_0x47df8d[_0xf02f('0x38')]][_0xf02f('0x89')]=_0x47df8d[_0xf02f('0x7d')];}else if(this[_0xf02f('0x33')](_0x47df8d[_0xf02f('0x7a')][_0xf02f('0x8a')])){logger[_0xf02f('0x2e')](_0xf02f('0x8b'),_0x47df8d[_0xf02f('0x38')],_0x47df8d[_0xf02f('0x7d')]);this['channels'][_0x47df8d[_0xf02f('0x38')]][_0xf02f('0x8c')]=_0x47df8d[_0xf02f('0x7d')];}else if(this['isNotNull'](_0x47df8d[_0xf02f('0x7a')][_0xf02f('0x8d')])){logger[_0xf02f('0x2e')](_0xf02f('0x8e'),_0x47df8d[_0xf02f('0x38')],_0x47df8d[_0xf02f('0x7d')]);this[_0xf02f('0x1a')][_0x47df8d[_0xf02f('0x38')]][_0xf02f('0xe')]=_0x47df8d[_0xf02f('0x7d')];}else if(this[_0xf02f('0x33')](_0x47df8d[_0xf02f('0x7a')][_0xf02f('0x8f')])){logger['info'](_0xf02f('0x90'),_0x47df8d[_0xf02f('0x38')],_0x47df8d[_0xf02f('0x7d')]);this['channels'][_0x47df8d['uniqueid']][_0xf02f('0x91')]=_0x47df8d[_0xf02f('0x7d')];}}}else if(this['isNotNull'](_0x47df8d[_0xf02f('0x7a')][_0xf02f('0x7b')])){if(_0x47df8d[_0xf02f('0x7d')]){var _0x36d4df=path[_0xf02f('0x92')](_0x47df8d[_0xf02f('0x7d')])[_0xf02f('0x50')];logger[_0xf02f('0x2e')](_0xf02f('0x7c'),_0x36d4df,_0x47df8d['value']);this[_0xf02f('0x6d')](_0x36d4df,_0x47df8d[_0xf02f('0x7d')]);}}else if(this['channels'][_0x47df8d['linkedid']]){if(this['isNotNull'](_0x47df8d['variable'])){if(this[_0xf02f('0x33')](_0x47df8d[_0xf02f('0x7a')][_0xf02f('0x8f')])){logger[_0xf02f('0x2e')](_0xf02f('0x90'),_0x47df8d['linkedid'],_0x47df8d[_0xf02f('0x7d')]);this['channels'][_0x47df8d[_0xf02f('0x3c')]][_0xf02f('0x93')]=_0x47df8d[_0xf02f('0x7d')];}}}}}catch(_0x1ad814){logger[_0xf02f('0x30')](_0xf02f('0x94'),_0x47df8d[_0xf02f('0x38')],util[_0xf02f('0x3b')](_0x1ad814,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf02f('0x32')][_0xf02f('0x25')]=function(_0x504f1b){try{if(this['isNotNull'](_0x504f1b)){logger[_0xf02f('0x3a')](_0xf02f('0x95'),_0x504f1b[_0xf02f('0x38')],util['inspect'](_0x504f1b,{'showHidden':![],'depth':null}));if(this[_0xf02f('0x1a')][_0x504f1b[_0xf02f('0x38')]]){logger['info'](_0xf02f('0x96'),_0x504f1b['uniqueid'],_0x504f1b['cause-txt']);var _0x18a2e2=moment();this[_0xf02f('0x1a')][_0x504f1b[_0xf02f('0x38')]]['endtime']=_0x18a2e2[_0xf02f('0x48')](_0xf02f('0x5c'));this[_0xf02f('0x1a')][_0x504f1b['uniqueid']]['duration']=_0x18a2e2[_0xf02f('0x66')](this[_0xf02f('0x1a')][_0x504f1b[_0xf02f('0x38')]][_0xf02f('0x47')],_0xf02f('0x5b'));if(this['channels'][_0x504f1b[_0xf02f('0x38')]]['answered']){this[_0xf02f('0x1a')][_0x504f1b['uniqueid']]['billableseconds']=_0x18a2e2['diff'](this['channels'][_0x504f1b[_0xf02f('0x38')]][_0xf02f('0x97')],'seconds');this[_0xf02f('0x1a')][_0x504f1b['uniqueid']][_0xf02f('0x65')]=this[_0xf02f('0x1a')][_0x504f1b[_0xf02f('0x38')]][_0xf02f('0x59')]-this[_0xf02f('0x1a')][_0x504f1b['uniqueid']][_0xf02f('0x98')];}if(_0x504f1b[_0xf02f('0x45')]===_0xf02f('0x4a')){if(this['agents'][_0x504f1b['channel'][_0xf02f('0x4d')]('-')[0x0]]){this[_0xf02f('0x1b')][_0x504f1b[_0xf02f('0x42')][_0xf02f('0x4d')]('-')[0x0]]=_['omit'](this[_0xf02f('0x1b')][_0x504f1b[_0xf02f('0x42')]['split']('-')[0x0]],['destconnectedlinenum']);logger[_0xf02f('0x3a')](_0xf02f('0x99'),_0x504f1b[_0xf02f('0x38')],util[_0xf02f('0x3b')]({'destaccountcode':this[_0xf02f('0x1b')][_0x504f1b['channel'][_0xf02f('0x4d')]('-')[0x0]][_0xf02f('0x4e')]},{'showHidden':![],'depth':null}));this[_0xf02f('0x35')](util[_0xf02f('0x48')](_0xf02f('0x4f'),this['agents'][_0x504f1b['channel'][_0xf02f('0x4d')]('-')[0x0]][_0xf02f('0x50')]),_0xf02f('0x9a'),{'destaccountcode':this['agents'][_0x504f1b[_0xf02f('0x42')][_0xf02f('0x4d')]('-')[0x0]][_0xf02f('0x4e')]});}}if(_0x504f1b[_0xf02f('0x9b')]===_0xf02f('0x9c')){this['blindTransfers'][_0x504f1b[_0xf02f('0x38')]]=this[_0xf02f('0x1a')][_0x504f1b[_0xf02f('0x38')]];}else{if(this[_0xf02f('0x1a')][_0x504f1b[_0xf02f('0x38')]][_0xf02f('0x81')]===_0xf02f('0x9d')&&this[_0xf02f('0x9e')][_0x504f1b['uniqueid']]){this['channels'][_0x504f1b[_0xf02f('0x38')]][_0xf02f('0x38')]=[this[_0xf02f('0x1a')][_0x504f1b[_0xf02f('0x38')]]['linkedid'],this[_0xf02f('0x1a')][_0x504f1b[_0xf02f('0x38')]][_0xf02f('0x3c')]=this[_0xf02f('0x1a')][_0x504f1b['uniqueid']][_0xf02f('0x38')]][0x0];delete this[_0xf02f('0x9e')][_0x504f1b[_0xf02f('0x38')]];}}logger[_0xf02f('0x3a')](_0xf02f('0x9f'),_0x504f1b[_0xf02f('0x38')],util['inspect'](this[_0xf02f('0x1a')][_0x504f1b[_0xf02f('0x38')]],{'showHidden':![],'depth':null}));ami[_0xf02f('0x35')](_0xf02f('0xa0'),this[_0xf02f('0x1a')][_0x504f1b[_0xf02f('0x38')]]);delete this[_0xf02f('0x1a')][_0x504f1b[_0xf02f('0x38')]];}}}catch(_0x528189){logger[_0xf02f('0x30')](_0xf02f('0xa1'),_0x504f1b[_0xf02f('0x38')],util[_0xf02f('0x3b')](_0x528189,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf02f('0x32')]['syncAttendedTransfer']=function(_0x331566){try{if(this[_0xf02f('0x33')](_0x331566)){logger[_0xf02f('0x2e')](_0xf02f('0xa2'),_0x331566[_0xf02f('0x38')],_0x331566['origtransferercalleridnum'],_0x331566[_0xf02f('0xa3')]);logger['debug'](_0xf02f('0xa4'),_0x331566['uniqueid'],util[_0xf02f('0x3b')](_0x331566,{'showHidden':![],'depth':null}));if(this[_0xf02f('0x1a')][_0x331566[_0xf02f('0xa5')]]){this[_0xf02f('0x1a')][_0x331566[_0xf02f('0xa5')]][_0xf02f('0xa6')]=_0x331566[_0xf02f('0xa7')];this['channels'][_0x331566['transfereeuniqueid']][_0xf02f('0xa8')]=_0x331566[_0xf02f('0xa3')];if(this['channels'][_0x331566[_0xf02f('0xa9')]]){var _0x31f69a=this[_0xf02f('0x1a')][_0x331566[_0xf02f('0xa9')]];this[_0xf02f('0x1a')][_0x331566['secondtransfereruniqueid']]=this['channels'][_0x331566[_0xf02f('0xa5')]];this[_0xf02f('0x1a')][_0x331566['transfereeuniqueid']]=_0x31f69a;}}else if(this[_0xf02f('0x1a')][_0x331566[_0xf02f('0xaa')]]){this[_0xf02f('0x1a')][_0x331566[_0xf02f('0xaa')]][_0xf02f('0xa6')]=_0x331566[_0xf02f('0xa7')];this[_0xf02f('0x1a')][_0x331566['transfertargetuniqueid']]['transferconnectedlinenum']=_0x331566['transfertargetcalleridnum'];if(this[_0xf02f('0x1a')][_0x331566[_0xf02f('0xab')]]){var _0x31f69a=this[_0xf02f('0x1a')][_0x331566[_0xf02f('0xab')]];this[_0xf02f('0x1a')][_0x331566[_0xf02f('0xab')]]=this[_0xf02f('0x1a')][_0x331566[_0xf02f('0xaa')]];this[_0xf02f('0x1a')][_0x331566[_0xf02f('0xaa')]]=_0x31f69a;}}}}catch(_0x1fdb8f){logger[_0xf02f('0x30')]('[%s][voiceCallReport][attendedtransfer]',_0x331566[_0xf02f('0x38')],util['inspect'](_0x1fdb8f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf02f('0x32')][_0xf02f('0x2a')]=function(_0x32da11){try{if(this[_0xf02f('0x33')](_0x32da11)){logger[_0xf02f('0x2e')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x32da11[_0xf02f('0x38')],_0x32da11[_0xf02f('0xac')],_0x32da11[_0xf02f('0xad')]);logger['debug'](_0xf02f('0xae'),_0x32da11[_0xf02f('0x38')],util['inspect'](_0x32da11,{'showHidden':![],'depth':null}));if(this[_0xf02f('0x1a')][_0x32da11['transfereeuniqueid']]){this[_0xf02f('0x1a')][_0x32da11['transfereeuniqueid']]['transfercalleridnum']=_0x32da11[_0xf02f('0xac')];this[_0xf02f('0x1a')][_0x32da11[_0xf02f('0xa5')]][_0xf02f('0xa8')]=_0x32da11['extension'];this[_0xf02f('0x25')]({'event':_0xf02f('0x9c'),'uniqueid':_0x32da11[_0xf02f('0xa5')],'context':_0x32da11[_0xf02f('0x45')],'channel':_0x32da11[_0xf02f('0xaf')]});}}}catch(_0x133405){logger[_0xf02f('0x30')](_0xf02f('0xb0'),_0x32da11[_0xf02f('0x38')],util[_0xf02f('0x3b')](_0x133405,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf02f('0x32')][_0xf02f('0x2c')]=function(_0x39a82f){try{if(this[_0xf02f('0x33')](_0x39a82f)){logger[_0xf02f('0x3a')](_0xf02f('0xb1'),_0x39a82f[_0xf02f('0x38')],util[_0xf02f('0x3b')](_0x39a82f,{'showHidden':![],'depth':null}));if(this['channels'][_0x39a82f[_0xf02f('0x38')]]){if(!_[_0xf02f('0x76')](this[_0xf02f('0x1a')][_0x39a82f[_0xf02f('0x38')]][_0xf02f('0x97')])){this[_0xf02f('0x1a')][_0x39a82f['uniqueid']]['mohstarttime']=moment()[_0xf02f('0x48')](_0xf02f('0x5c'));logger[_0xf02f('0x2e')](_0xf02f('0xb2'),_0x39a82f[_0xf02f('0x38')],this[_0xf02f('0x1a')][_0x39a82f[_0xf02f('0x38')]][_0xf02f('0xb3')]);}}}}catch(_0x314aa8){logger[_0xf02f('0x30')](_0xf02f('0xb4'),_0x39a82f['uniqueid'],util['inspect'](_0x314aa8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf02f('0x32')][_0xf02f('0xb5')]=function(_0x56fdaf){try{if(this['isNotNull'](_0x56fdaf)){logger[_0xf02f('0x3a')](_0xf02f('0xb6'),_0x56fdaf[_0xf02f('0x38')],util[_0xf02f('0x3b')](_0x56fdaf,{'showHidden':![],'depth':null}));if(this[_0xf02f('0x1a')][_0x56fdaf['uniqueid']]){if(!_['isNil'](this['channels'][_0x56fdaf[_0xf02f('0x38')]][_0xf02f('0xb3')])){this[_0xf02f('0x1a')][_0x56fdaf[_0xf02f('0x38')]][_0xf02f('0xb7')]+=moment()[_0xf02f('0xb8')](0x0)[_0xf02f('0x66')](this[_0xf02f('0x1a')][_0x56fdaf['uniqueid']][_0xf02f('0xb3')],_0xf02f('0x5b'));logger[_0xf02f('0x2e')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x56fdaf['uniqueid'],this[_0xf02f('0x1a')][_0x56fdaf[_0xf02f('0x38')]][_0xf02f('0xb7')]);delete this[_0xf02f('0x1a')][_0x56fdaf[_0xf02f('0x38')]][_0xf02f('0xb3')];}}}}catch(_0x4b96cf){logger['error']('[%s][voiceCallReport][musiconholdstop]',_0x56fdaf['uniqueid'],util[_0xf02f('0x3b')](_0x4b96cf,{'showHidden':![],'depth':null}));}};module[_0xf02f('0xb9')]=VoiceCallReport; \ No newline at end of file +var _0xc9c1=['calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','holdtime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','event','BlindTransfer','blindTransfers','type','outbound','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','not_inuse','inuse','busy','ringinuse','onhold','set','queue','agi','dial','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','bind','newexten','syncNewExten','syncNewChannel','syncNewState','varset','syncVarSet','hangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','uniqueid','merge','pick','keys','error','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','info','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','format','YYYY-MM-DD\x20HH:mm:ss','disposition','from-sip','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','duration','subtract','seconds','startsWith','applicationdata','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','linkedid','answered','answertime','starttime','diff','xcally-motion-preview','connectedlinename','toNumber','channelstate','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s'];(function(_0x166313,_0x426cb7){var _0x5129e5=function(_0x16781e){while(--_0x16781e){_0x166313['push'](_0x166313['shift']());}};_0x5129e5(++_0x426cb7);}(_0xc9c1,0x1a9));var _0x1c9c=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xc9c1[_0x3635ce];return _0x97ecd0;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var moment=require('moment');var util=require(_0x1c9c('0x0'));var path=require(_0x1c9c('0x1'));var Redis=require(_0x1c9c('0x2'));var config=require(_0x1c9c('0x3'));var logger=require(_0x1c9c('0x4'))(_0x1c9c('0x5'));var ami=require('../ami');var Channel=require(_0x1c9c('0x6'));var statusDesc=['unknown',_0x1c9c('0x7'),_0x1c9c('0x8'),_0x1c9c('0x9'),'invalid','unavailable','ringing',_0x1c9c('0xa'),_0x1c9c('0xb')];var applications=[_0x1c9c('0xc'),_0x1c9c('0xd'),_0x1c9c('0xe'),_0x1c9c('0xf'),'playback','voicemail'];var dispositions=['NO\x20ANSWER',_0x1c9c('0x10'),_0x1c9c('0x10'),_0x1c9c('0x11'),_0x1c9c('0x11'),_0x1c9c('0x11'),_0x1c9c('0x12'),_0x1c9c('0x13'),_0x1c9c('0x10'),_0x1c9c('0x10'),'FAILED'];var actions={};config[_0x1c9c('0x14')]=_[_0x1c9c('0x15')](config['redis'],{'host':_0x1c9c('0x16'),'port':0x18eb});var io=require(_0x1c9c('0x17'))(new Redis(config[_0x1c9c('0x14')]));function VoiceCallReport(_0x8e8aab){this[_0x1c9c('0x18')]=_0x8e8aab[_0x1c9c('0x18')];this[_0x1c9c('0x19')]=_0x8e8aab[_0x1c9c('0x19')];this['blindTransfers']={};ami['on'](_0x1c9c('0x1a'),this['syncNewExten'][_0x1c9c('0x1b')](this));ami['on'](_0x1c9c('0x1c'),this[_0x1c9c('0x1d')]['bind'](this));ami['on']('newchannel',this[_0x1c9c('0x1e')][_0x1c9c('0x1b')](this));ami['on']('newstate',this[_0x1c9c('0x1f')][_0x1c9c('0x1b')](this));ami['on'](_0x1c9c('0x20'),this[_0x1c9c('0x21')][_0x1c9c('0x1b')](this));ami['on'](_0x1c9c('0x22'),this['syncHangup'][_0x1c9c('0x1b')](this));ami['on'](_0x1c9c('0x23'),this[_0x1c9c('0x24')][_0x1c9c('0x1b')](this));ami['on'](_0x1c9c('0x25'),this[_0x1c9c('0x26')][_0x1c9c('0x1b')](this));ami['on'](_0x1c9c('0x27'),this[_0x1c9c('0x28')][_0x1c9c('0x1b')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x1c9c('0x1b')](this));ami['on']('musiconholdstop',this[_0x1c9c('0x29')]['bind'](this));try{logger['info'](_0x1c9c('0x2a'));ami[_0x1c9c('0x2b')]();}catch(_0x5f2fa9){logger['error'](_0x1c9c('0x2c'),util[_0x1c9c('0x2d')](_0x5f2fa9,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0x2f')]=function(_0x1a9be1){return _0x1a9be1!==null&&!_[_0x1c9c('0x30')](_0x1a9be1);};VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0x31')]=function(_0x1be26c,_0x17377f,_0x358f47){io['to'](_0x1be26c)[_0x1c9c('0x31')](_0x17377f,_0x358f47);};VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0x24')]=function(_0x863e1d){try{if(this[_0x1c9c('0x2f')](_0x863e1d)){logger['info'](_0x1c9c('0x32'),_0x863e1d['uniqueid'],_0x863e1d[_0x1c9c('0x33')],_0x863e1d[_0x1c9c('0x34')]);logger[_0x1c9c('0x35')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x863e1d[_0x1c9c('0x36')],util['inspect'](_0x863e1d,{'showHidden':![],'depth':null}));if(_0x863e1d[_0x1c9c('0x36')]===_0x863e1d['linkedid']){if(!_[_0x1c9c('0x30')](this[_0x1c9c('0x18')][_0x863e1d[_0x1c9c('0x36')]])){_[_0x1c9c('0x37')](this[_0x1c9c('0x18')][_0x863e1d[_0x1c9c('0x36')]],_[_0x1c9c('0x38')](_0x863e1d,_[_0x1c9c('0x39')](this['channels'][_0x863e1d[_0x1c9c('0x36')]])));}}}}catch(_0x37aebe){logger[_0x1c9c('0x3a')](_0x1c9c('0x3b'),_0x863e1d[_0x1c9c('0x36')],util[_0x1c9c('0x2d')](_0x37aebe,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0x1e')]=function(_0x689b64){try{if(this[_0x1c9c('0x2f')](_0x689b64)){logger[_0x1c9c('0x35')](_0x1c9c('0x3c'),_0x689b64['uniqueid'],util[_0x1c9c('0x2d')](_0x689b64,{'showHidden':![],'depth':null}));if(_0x689b64[_0x1c9c('0x36')]===_0x689b64['linkedid']&&_0x689b64[_0x1c9c('0x3d')]!=_0x1c9c('0x3e')){if(_[_0x1c9c('0x30')](this[_0x1c9c('0x18')][_0x689b64[_0x1c9c('0x36')]])){logger[_0x1c9c('0x3f')](_0x1c9c('0x40'),_0x689b64[_0x1c9c('0x36')],_0x689b64[_0x1c9c('0x41')],_0x689b64[_0x1c9c('0x42')]);this[_0x1c9c('0x18')][_0x689b64[_0x1c9c('0x36')]]=new Channel();this[_0x1c9c('0x18')][_0x689b64[_0x1c9c('0x36')]]['starttime']=moment()[_0x1c9c('0x43')](_0x1c9c('0x44'));this['channels'][_0x689b64['uniqueid']][_0x1c9c('0x45')]=dispositions[_['toNumber'](_0x689b64['channelstate'])];_['merge'](this[_0x1c9c('0x18')][_0x689b64[_0x1c9c('0x36')]],_['pick'](_0x689b64,_[_0x1c9c('0x39')](this[_0x1c9c('0x18')][_0x689b64[_0x1c9c('0x36')]])));if(_0x689b64[_0x1c9c('0x41')]===_0x1c9c('0x46')){if(this[_0x1c9c('0x19')][_0x689b64[_0x1c9c('0x3d')][_0x1c9c('0x47')]('-')[0x0]]){this['agents'][_0x689b64[_0x1c9c('0x3d')][_0x1c9c('0x47')]('-')[0x0]][_0x1c9c('0x48')]=_0x689b64[_0x1c9c('0x42')];logger['debug'](_0x1c9c('0x49'),_0x689b64['uniqueid'],util['inspect']({'destaccountcode':this[_0x1c9c('0x19')][_0x689b64[_0x1c9c('0x3d')]['split']('-')[0x0]][_0x1c9c('0x4a')],'destconnectedlinenum':_0x689b64[_0x1c9c('0x42')]},{'showHidden':![],'depth':null}));this[_0x1c9c('0x31')](util[_0x1c9c('0x43')](_0x1c9c('0x4b'),this[_0x1c9c('0x19')][_0x689b64['channel'][_0x1c9c('0x47')]('-')[0x0]][_0x1c9c('0x4c')]),_0x1c9c('0x4d'),{'destaccountcode':this['agents'][_0x689b64['channel'][_0x1c9c('0x47')]('-')[0x0]][_0x1c9c('0x4a')],'destconnectedlinenum':_0x689b64[_0x1c9c('0x42')]});}}}}}}catch(_0x329ebe){logger[_0x1c9c('0x3a')](_0x1c9c('0x4e'),_0x689b64['uniqueid'],util['inspect'](_0x329ebe,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1c9c('0x1d')]=function(_0xf82840){try{if(this[_0x1c9c('0x2f')](_0xf82840)){logger['debug'](_0x1c9c('0x4f'),_0xf82840[_0x1c9c('0x36')],util[_0x1c9c('0x2d')](_0xf82840,{'showHidden':![],'depth':null}));if(_0xf82840[_0x1c9c('0x36')]===_0xf82840['linkedid']&&_0xf82840[_0x1c9c('0x42')]!='h'&&_0xf82840[_0x1c9c('0x3d')]!=_0x1c9c('0x3e')){_0xf82840[_0x1c9c('0x50')]=_0xf82840[_0x1c9c('0x50')][_0x1c9c('0x51')]();_0xf82840['applicationdata']=(_0xf82840['appdata']||_0xf82840['applicationdata'])[_0x1c9c('0x51')]();logger[_0x1c9c('0x3f')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0xf82840[_0x1c9c('0x36')],_0xf82840['application'],_0xf82840['applicationdata']);if(_[_0x1c9c('0x30')](this[_0x1c9c('0x18')][_0xf82840[_0x1c9c('0x36')]])){this['channels'][_0xf82840[_0x1c9c('0x36')]]=new Channel();this['channels'][_0xf82840[_0x1c9c('0x36')]]['starttime']=_0xf82840[_0x1c9c('0x52')]?moment()[_0x1c9c('0x53')](moment[_0x1c9c('0x52')](_0xf82840['duration'])[_0x1c9c('0x54')](),_0x1c9c('0x54'))['format'](_0x1c9c('0x44')):moment()[_0x1c9c('0x43')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1c9c('0x18')][_0xf82840[_0x1c9c('0x36')]][_0x1c9c('0x45')]=_0x1c9c('0x11');}_[_0x1c9c('0x37')](this['channels'][_0xf82840[_0x1c9c('0x36')]],_[_0x1c9c('0x38')](_0xf82840,_['keys'](this[_0x1c9c('0x18')][_0xf82840[_0x1c9c('0x36')]])));if(_['includes'](applications,_0xf82840['application'])){this[_0x1c9c('0x18')][_0xf82840[_0x1c9c('0x36')]]['lastapplication']=_0xf82840['application'];this[_0x1c9c('0x18')][_0xf82840[_0x1c9c('0x36')]]['lastdata']=_0xf82840['applicationdata'];if(_0xf82840[_0x1c9c('0x50')]===_0x1c9c('0xc')&&_[_0x1c9c('0x55')](_0xf82840[_0x1c9c('0x56')],'cdr(')){var _0x38c3ed=_0xf82840[_0x1c9c('0x56')][_0x1c9c('0x47')]('=');var _0x51913f=_0x38c3ed[0x0]['match'](/cdr\((.*)\)/);if(_0x51913f){this[_0x1c9c('0x18')][_0xf82840[_0x1c9c('0x36')]][_0x51913f[0x1]]=_0x38c3ed[0x1];}}else if(_0xf82840[_0x1c9c('0x50')]==='queue'){this[_0x1c9c('0x18')][_0xf82840[_0x1c9c('0x36')]][_0x1c9c('0xd')]=_0xf82840[_0x1c9c('0x56')][_0x1c9c('0x47')](',')[0x0];}}}}}catch(_0x216fcc){logger['error'](_0x1c9c('0x57'),_0xf82840[_0x1c9c('0x36')],util['inspect'](_0x216fcc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0x1f')]=function(_0x3c4e1e){try{if(this[_0x1c9c('0x2f')](_0x3c4e1e)){logger[_0x1c9c('0x3f')](_0x1c9c('0x58'),_0x3c4e1e['uniqueid'],_0x3c4e1e[_0x1c9c('0x59')],_0x3c4e1e[_0x1c9c('0x33')],_0x3c4e1e[_0x1c9c('0x34')]);logger[_0x1c9c('0x35')]('[%s][voiceCallReport][newstate]\x20event:',_0x3c4e1e[_0x1c9c('0x36')],util[_0x1c9c('0x2d')](_0x3c4e1e,{'showHidden':![],'depth':null}));if(_0x3c4e1e[_0x1c9c('0x36')]!==_0x3c4e1e['linkedid']){if(this[_0x1c9c('0x18')][_0x3c4e1e[_0x1c9c('0x59')]]){if(_0x3c4e1e['channelstate']==='6'){if(!this[_0x1c9c('0x18')][_0x3c4e1e['linkedid']][_0x1c9c('0x5a')]){var _0x5a83a3=moment();this[_0x1c9c('0x18')][_0x3c4e1e[_0x1c9c('0x59')]]['answered']=!![];this[_0x1c9c('0x18')][_0x3c4e1e['linkedid']][_0x1c9c('0x5b')]=_0x5a83a3[_0x1c9c('0x43')](_0x1c9c('0x44'));if(this[_0x1c9c('0x18')][_0x3c4e1e[_0x1c9c('0x59')]][_0x1c9c('0x5c')]){this[_0x1c9c('0x18')][_0x3c4e1e['linkedid']]['holdtime']=_0x5a83a3[_0x1c9c('0x5d')](this[_0x1c9c('0x18')][_0x3c4e1e[_0x1c9c('0x59')]][_0x1c9c('0x5c')],_0x1c9c('0x54'));}}this[_0x1c9c('0x18')][_0x3c4e1e['linkedid']][_0x1c9c('0x59')]=_0x3c4e1e[_0x1c9c('0x36')];if(_0x3c4e1e['calleridnum']!==_0x1c9c('0x5e')){this[_0x1c9c('0x18')][_0x3c4e1e[_0x1c9c('0x59')]]['connectedlinenum']=_0x3c4e1e[_0x1c9c('0x34')];}this[_0x1c9c('0x18')][_0x3c4e1e[_0x1c9c('0x59')]][_0x1c9c('0x5f')]=_0x3c4e1e['calleridname'];this['channels'][_0x3c4e1e['linkedid']]['destinationchannel']=_0x3c4e1e[_0x1c9c('0x3d')];this['channels'][_0x3c4e1e['linkedid']][_0x1c9c('0x45')]=dispositions[_[_0x1c9c('0x60')](_0x3c4e1e[_0x1c9c('0x61')])];if(this[_0x1c9c('0x19')][_0x3c4e1e[_0x1c9c('0x3d')]['split']('-')[0x0]]){this[_0x1c9c('0x18')][_0x3c4e1e['linkedid']][_0x1c9c('0x62')]=this[_0x1c9c('0x19')][_0x3c4e1e[_0x1c9c('0x3d')]['split']('-')[0x0]]['id'];this[_0x1c9c('0x18')][_0x3c4e1e[_0x1c9c('0x59')]][_0x1c9c('0x63')]=this[_0x1c9c('0x19')][_0x3c4e1e[_0x1c9c('0x3d')][_0x1c9c('0x47')]('-')[0x0]][_0x1c9c('0x4c')];}}}}else{if(this[_0x1c9c('0x18')][_0x3c4e1e[_0x1c9c('0x36')]]){if(_0x3c4e1e[_0x1c9c('0x61')]==='6'){if(this[_0x1c9c('0x19')][_0x3c4e1e[_0x1c9c('0x3d')][_0x1c9c('0x47')]('-')[0x0]]){this[_0x1c9c('0x18')][_0x3c4e1e[_0x1c9c('0x36')]]['UserId']=this[_0x1c9c('0x19')][_0x3c4e1e[_0x1c9c('0x3d')]['split']('-')[0x0]]['id'];this[_0x1c9c('0x18')][_0x3c4e1e['uniqueid']][_0x1c9c('0x63')]=this['agents'][_0x3c4e1e[_0x1c9c('0x3d')][_0x1c9c('0x47')]('-')[0x0]][_0x1c9c('0x4c')];}}}}}}catch(_0x4f6a78){logger['error'](_0x1c9c('0x64'),_0x3c4e1e[_0x1c9c('0x36')],util[_0x1c9c('0x2d')](_0x4f6a78,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0x65')]=function(_0x5e1a46,_0x184ed4){try{if(this[_0x1c9c('0x18')][_0x5e1a46]){logger[_0x1c9c('0x3f')](_0x1c9c('0x66'),_0x5e1a46,_0x184ed4);this[_0x1c9c('0x18')][_0x5e1a46][_0x1c9c('0x67')]=!![];if(_[_0x1c9c('0x68')](_0x184ed4,_0x1c9c('0x69'))){_0x184ed4=_0x184ed4['replace'](_0x1c9c('0x69'),_0x1c9c('0x6a'));}this[_0x1c9c('0x18')][_0x5e1a46][_0x1c9c('0x6b')]=_0x184ed4;var _0x25e8da=_[_0x1c9c('0x6c')](this[_0x1c9c('0x18')][_0x5e1a46][_0x1c9c('0x6d')],{'filename':_0x184ed4});if(_['isNil'](_0x25e8da)){this[_0x1c9c('0x18')][_0x5e1a46]['monitors'][_0x1c9c('0x6e')]({'filename':_0x184ed4,'createdAt':moment()[_0x1c9c('0x43')](_0x1c9c('0x44')),'mixmonitorid':'','status':_0x1c9c('0x6f')});}}}catch(_0x23ce30){logger['error'](_0x1c9c('0x70'),_0x5e1a46,util[_0x1c9c('0x2d')](_0x23ce30,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0x21')]=function(_0x123612){try{if(this[_0x1c9c('0x2f')](_0x123612)){logger[_0x1c9c('0x35')](_0x1c9c('0x71'),_0x123612[_0x1c9c('0x36')],util[_0x1c9c('0x2d')](_0x123612,{'showHidden':![],'depth':null}));if(this[_0x1c9c('0x18')][_0x123612[_0x1c9c('0x36')]]&&_0x123612['channel']!='OutgoingSpoolFailed'){if(this[_0x1c9c('0x2f')](_0x123612[_0x1c9c('0x72')])){if(this[_0x1c9c('0x2f')](_0x123612[_0x1c9c('0x72')][_0x1c9c('0x73')])){logger[_0x1c9c('0x3f')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x123612[_0x1c9c('0x36')],_0x123612['value']);this['syncMixMonitorFilename'](_0x123612[_0x1c9c('0x36')],_0x123612[_0x1c9c('0x74')]);}else if(this[_0x1c9c('0x2f')](_0x123612[_0x1c9c('0x72')][_0x1c9c('0x75')])){logger['info'](_0x1c9c('0x76'),_0x123612[_0x1c9c('0x36')],_0x123612[_0x1c9c('0x74')]);this[_0x1c9c('0x18')][_0x123612[_0x1c9c('0x36')]][_0x1c9c('0x34')]=_0x123612[_0x1c9c('0x74')];}else if(this[_0x1c9c('0x2f')](_0x123612[_0x1c9c('0x72')]['xmd-callerid'])){logger[_0x1c9c('0x3f')](_0x1c9c('0x77'),_0x123612[_0x1c9c('0x36')],_0x123612[_0x1c9c('0x74')]);this[_0x1c9c('0x18')][_0x123612[_0x1c9c('0x36')]][_0x1c9c('0x78')]=_0x123612['value'];}else if(this[_0x1c9c('0x2f')](_0x123612['variable'][_0x1c9c('0x79')])){logger['info'](_0x1c9c('0x7a'),_0x123612[_0x1c9c('0x36')],_0x123612[_0x1c9c('0x74')]);this[_0x1c9c('0x18')][_0x123612['uniqueid']]['type']=_0x123612['value'];}else if(this[_0x1c9c('0x2f')](_0x123612['variable'][_0x1c9c('0x7b')])){logger[_0x1c9c('0x3f')](_0x1c9c('0x7c'),_0x123612[_0x1c9c('0x36')],_0x123612[_0x1c9c('0x74')]['split'](',')[0x0]);this[_0x1c9c('0x18')][_0x123612[_0x1c9c('0x36')]][_0x1c9c('0xd')]=_0x123612['value'][_0x1c9c('0x47')](',')[0x0];}else if(this[_0x1c9c('0x2f')](_0x123612[_0x1c9c('0x72')][_0x1c9c('0x7d')])){logger[_0x1c9c('0x3f')](_0x1c9c('0x7e'),_0x123612[_0x1c9c('0x36')],_0x123612[_0x1c9c('0x74')]);this[_0x1c9c('0x18')][_0x123612[_0x1c9c('0x36')]][_0x1c9c('0x7f')]=_0x123612[_0x1c9c('0x74')];}else if(this[_0x1c9c('0x2f')](_0x123612['variable'][_0x1c9c('0x80')])){logger[_0x1c9c('0x3f')](_0x1c9c('0x81'),_0x123612[_0x1c9c('0x36')],_0x123612[_0x1c9c('0x74')]);this['channels'][_0x123612[_0x1c9c('0x36')]][_0x1c9c('0x82')]=_0x123612['value'];}else if(this[_0x1c9c('0x2f')](_0x123612[_0x1c9c('0x72')][_0x1c9c('0x83')])){logger[_0x1c9c('0x3f')](_0x1c9c('0x84'),_0x123612[_0x1c9c('0x36')],_0x123612['value']);this[_0x1c9c('0x18')][_0x123612[_0x1c9c('0x36')]][_0x1c9c('0x85')]=_0x123612[_0x1c9c('0x74')];}else if(this['isNotNull'](_0x123612[_0x1c9c('0x72')][_0x1c9c('0x86')])){logger[_0x1c9c('0x3f')](_0x1c9c('0x87'),_0x123612[_0x1c9c('0x36')],_0x123612[_0x1c9c('0x74')]);this[_0x1c9c('0x18')][_0x123612[_0x1c9c('0x36')]]['queue']=_0x123612['value'];}else if(this[_0x1c9c('0x2f')](_0x123612[_0x1c9c('0x72')][_0x1c9c('0x88')])){logger[_0x1c9c('0x3f')](_0x1c9c('0x89'),_0x123612['uniqueid'],_0x123612['value']);this['channels'][_0x123612[_0x1c9c('0x36')]]['sipcalluniqueid']=_0x123612['value'];}}}else if(this[_0x1c9c('0x2f')](_0x123612[_0x1c9c('0x72')][_0x1c9c('0x73')])){if(_0x123612[_0x1c9c('0x74')]){var _0x1c06cc=path[_0x1c9c('0x8a')](_0x123612[_0x1c9c('0x74')])[_0x1c9c('0x4c')];logger[_0x1c9c('0x3f')](_0x1c9c('0x8b'),_0x1c06cc,_0x123612[_0x1c9c('0x74')]);this[_0x1c9c('0x65')](_0x1c06cc,_0x123612['value']);}}else if(this['channels'][_0x123612['linkedid']]){if(this[_0x1c9c('0x2f')](_0x123612[_0x1c9c('0x72')])){if(this['isNotNull'](_0x123612[_0x1c9c('0x72')][_0x1c9c('0x88')])){logger[_0x1c9c('0x3f')](_0x1c9c('0x89'),_0x123612['linkedid'],_0x123612['value']);this['channels'][_0x123612['linkedid']][_0x1c9c('0x8c')]=_0x123612['value'];}}}}}catch(_0x343696){logger[_0x1c9c('0x3a')](_0x1c9c('0x8d'),_0x123612['uniqueid'],util[_0x1c9c('0x2d')](_0x343696,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0x8e')]=function(_0x35974a){try{if(this[_0x1c9c('0x2f')](_0x35974a)){logger[_0x1c9c('0x35')](_0x1c9c('0x8f'),_0x35974a[_0x1c9c('0x36')],util[_0x1c9c('0x2d')](_0x35974a,{'showHidden':![],'depth':null}));if(this[_0x1c9c('0x18')][_0x35974a[_0x1c9c('0x36')]]){logger['info'](_0x1c9c('0x90'),_0x35974a[_0x1c9c('0x36')],_0x35974a[_0x1c9c('0x91')]);var _0x458268=moment();this[_0x1c9c('0x18')][_0x35974a[_0x1c9c('0x36')]][_0x1c9c('0x92')]=_0x458268[_0x1c9c('0x43')](_0x1c9c('0x44'));this['channels'][_0x35974a[_0x1c9c('0x36')]][_0x1c9c('0x52')]=_0x458268[_0x1c9c('0x5d')](this[_0x1c9c('0x18')][_0x35974a[_0x1c9c('0x36')]][_0x1c9c('0x5c')],'seconds');if(this[_0x1c9c('0x18')][_0x35974a[_0x1c9c('0x36')]][_0x1c9c('0x5a')]){this[_0x1c9c('0x18')][_0x35974a['uniqueid']][_0x1c9c('0x93')]=_0x458268[_0x1c9c('0x5d')](this[_0x1c9c('0x18')][_0x35974a[_0x1c9c('0x36')]][_0x1c9c('0x5b')],_0x1c9c('0x54'));this['channels'][_0x35974a[_0x1c9c('0x36')]][_0x1c9c('0x94')]=this['channels'][_0x35974a[_0x1c9c('0x36')]]['duration']-this[_0x1c9c('0x18')][_0x35974a[_0x1c9c('0x36')]]['billableseconds'];}if(_0x35974a[_0x1c9c('0x41')]===_0x1c9c('0x46')){if(this[_0x1c9c('0x19')][_0x35974a[_0x1c9c('0x3d')][_0x1c9c('0x47')]('-')[0x0]]){this['agents'][_0x35974a[_0x1c9c('0x3d')][_0x1c9c('0x47')]('-')[0x0]]=_[_0x1c9c('0x95')](this[_0x1c9c('0x19')][_0x35974a[_0x1c9c('0x3d')]['split']('-')[0x0]],[_0x1c9c('0x48')]);logger[_0x1c9c('0x35')](_0x1c9c('0x96'),_0x35974a['uniqueid'],util[_0x1c9c('0x2d')]({'destaccountcode':this['agents'][_0x35974a[_0x1c9c('0x3d')]['split']('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x1c9c('0x31')](util['format'](_0x1c9c('0x4b'),this['agents'][_0x35974a['channel'][_0x1c9c('0x47')]('-')[0x0]][_0x1c9c('0x4c')]),_0x1c9c('0x97'),{'destaccountcode':this[_0x1c9c('0x19')][_0x35974a[_0x1c9c('0x3d')][_0x1c9c('0x47')]('-')[0x0]][_0x1c9c('0x4a')]});}}if(_0x35974a[_0x1c9c('0x98')]===_0x1c9c('0x99')){this[_0x1c9c('0x9a')][_0x35974a[_0x1c9c('0x36')]]=this[_0x1c9c('0x18')][_0x35974a['uniqueid']];}else{if(this[_0x1c9c('0x18')][_0x35974a['uniqueid']][_0x1c9c('0x9b')]===_0x1c9c('0x9c')&&this[_0x1c9c('0x9a')][_0x35974a[_0x1c9c('0x36')]]){this[_0x1c9c('0x18')][_0x35974a[_0x1c9c('0x36')]]['uniqueid']=[this[_0x1c9c('0x18')][_0x35974a['uniqueid']][_0x1c9c('0x59')],this['channels'][_0x35974a[_0x1c9c('0x36')]]['linkedid']=this[_0x1c9c('0x18')][_0x35974a[_0x1c9c('0x36')]][_0x1c9c('0x36')]][0x0];delete this[_0x1c9c('0x9a')][_0x35974a[_0x1c9c('0x36')]];}}logger[_0x1c9c('0x35')]('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x35974a[_0x1c9c('0x36')],util['inspect'](this[_0x1c9c('0x18')][_0x35974a['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x1c9c('0x31')](_0x1c9c('0x9d'),this['channels'][_0x35974a[_0x1c9c('0x36')]]);delete this[_0x1c9c('0x18')][_0x35974a['uniqueid']];}}}catch(_0x184522){logger[_0x1c9c('0x3a')](_0x1c9c('0x9e'),_0x35974a[_0x1c9c('0x36')],util['inspect'](_0x184522,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1c9c('0x2e')]['syncAttendedTransfer']=function(_0x17d796){try{if(this[_0x1c9c('0x2f')](_0x17d796)){logger[_0x1c9c('0x3f')](_0x1c9c('0x9f'),_0x17d796[_0x1c9c('0x36')],_0x17d796[_0x1c9c('0xa0')],_0x17d796[_0x1c9c('0xa1')]);logger[_0x1c9c('0x35')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x17d796[_0x1c9c('0x36')],util[_0x1c9c('0x2d')](_0x17d796,{'showHidden':![],'depth':null}));if(this[_0x1c9c('0x18')][_0x17d796[_0x1c9c('0xa2')]]){this['channels'][_0x17d796['transfereeuniqueid']]['transfercalleridnum']=_0x17d796[_0x1c9c('0xa0')];this[_0x1c9c('0x18')][_0x17d796['transfereeuniqueid']][_0x1c9c('0xa3')]=_0x17d796[_0x1c9c('0xa1')];if(this[_0x1c9c('0x18')][_0x17d796['secondtransfereruniqueid']]){var _0x4b35b7=this[_0x1c9c('0x18')][_0x17d796['secondtransfereruniqueid']];this['channels'][_0x17d796[_0x1c9c('0xa4')]]=this[_0x1c9c('0x18')][_0x17d796[_0x1c9c('0xa2')]];this[_0x1c9c('0x18')][_0x17d796['transfereeuniqueid']]=_0x4b35b7;}}else if(this['channels'][_0x17d796[_0x1c9c('0xa5')]]){this[_0x1c9c('0x18')][_0x17d796['transfertargetuniqueid']][_0x1c9c('0xa6')]=_0x17d796[_0x1c9c('0xa0')];this[_0x1c9c('0x18')][_0x17d796[_0x1c9c('0xa5')]][_0x1c9c('0xa3')]=_0x17d796[_0x1c9c('0xa1')];if(this[_0x1c9c('0x18')][_0x17d796['origtransfereruniqueid']]){var _0x4b35b7=this[_0x1c9c('0x18')][_0x17d796[_0x1c9c('0xa7')]];this[_0x1c9c('0x18')][_0x17d796[_0x1c9c('0xa7')]]=this[_0x1c9c('0x18')][_0x17d796[_0x1c9c('0xa5')]];this[_0x1c9c('0x18')][_0x17d796[_0x1c9c('0xa5')]]=_0x4b35b7;}}}}catch(_0xe1dbcf){logger['error']('[%s][voiceCallReport][attendedtransfer]',_0x17d796[_0x1c9c('0x36')],util[_0x1c9c('0x2d')](_0xe1dbcf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0x28')]=function(_0x5fd120){try{if(this['isNotNull'](_0x5fd120)){logger[_0x1c9c('0x3f')](_0x1c9c('0xa8'),_0x5fd120['uniqueid'],_0x5fd120[_0x1c9c('0xa9')],_0x5fd120[_0x1c9c('0xaa')]);logger[_0x1c9c('0x35')](_0x1c9c('0xab'),_0x5fd120[_0x1c9c('0x36')],util['inspect'](_0x5fd120,{'showHidden':![],'depth':null}));if(this[_0x1c9c('0x18')][_0x5fd120[_0x1c9c('0xa2')]]){this[_0x1c9c('0x18')][_0x5fd120[_0x1c9c('0xa2')]][_0x1c9c('0xa6')]=_0x5fd120[_0x1c9c('0xa9')];this[_0x1c9c('0x18')][_0x5fd120['transfereeuniqueid']][_0x1c9c('0xa3')]=_0x5fd120[_0x1c9c('0xaa')];this['syncHangup']({'event':'BlindTransfer','uniqueid':_0x5fd120[_0x1c9c('0xa2')],'context':_0x5fd120['context'],'channel':_0x5fd120[_0x1c9c('0xac')]});}}}catch(_0x55d9fb){logger[_0x1c9c('0x3a')](_0x1c9c('0xad'),_0x5fd120['uniqueid'],util['inspect'](_0x55d9fb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0xae')]=function(_0x10ccdf){try{if(this[_0x1c9c('0x2f')](_0x10ccdf)){logger[_0x1c9c('0x35')](_0x1c9c('0xaf'),_0x10ccdf[_0x1c9c('0x36')],util['inspect'](_0x10ccdf,{'showHidden':![],'depth':null}));if(this[_0x1c9c('0x18')][_0x10ccdf[_0x1c9c('0x36')]]){if(!_[_0x1c9c('0xb0')](this[_0x1c9c('0x18')][_0x10ccdf['uniqueid']][_0x1c9c('0x5b')])){this[_0x1c9c('0x18')][_0x10ccdf[_0x1c9c('0x36')]][_0x1c9c('0xb1')]=moment()[_0x1c9c('0x43')](_0x1c9c('0x44'));logger[_0x1c9c('0x3f')](_0x1c9c('0xb2'),_0x10ccdf[_0x1c9c('0x36')],this[_0x1c9c('0x18')][_0x10ccdf['uniqueid']][_0x1c9c('0xb1')]);}}}}catch(_0x9ff79a){logger['error'](_0x1c9c('0xb3'),_0x10ccdf[_0x1c9c('0x36')],util['inspect'](_0x9ff79a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1c9c('0x2e')][_0x1c9c('0x29')]=function(_0x159b02){try{if(this[_0x1c9c('0x2f')](_0x159b02)){logger[_0x1c9c('0x35')](_0x1c9c('0xb4'),_0x159b02[_0x1c9c('0x36')],util[_0x1c9c('0x2d')](_0x159b02,{'showHidden':![],'depth':null}));if(this[_0x1c9c('0x18')][_0x159b02['uniqueid']]){if(!_[_0x1c9c('0xb0')](this['channels'][_0x159b02[_0x1c9c('0x36')]][_0x1c9c('0xb1')])){this[_0x1c9c('0x18')][_0x159b02['uniqueid']][_0x1c9c('0xb5')]+=moment()[_0x1c9c('0xb6')](0x0)[_0x1c9c('0x5d')](this[_0x1c9c('0x18')][_0x159b02[_0x1c9c('0x36')]][_0x1c9c('0xb1')],_0x1c9c('0x54'));logger[_0x1c9c('0x3f')](_0x1c9c('0xb7'),_0x159b02['uniqueid'],this[_0x1c9c('0x18')][_0x159b02[_0x1c9c('0x36')]][_0x1c9c('0xb5')]);delete this[_0x1c9c('0x18')][_0x159b02[_0x1c9c('0x36')]][_0x1c9c('0xb1')];}}}}catch(_0x1d5379){logger[_0x1c9c('0x3a')](_0x1c9c('0xb8'),_0x159b02['uniqueid'],util['inspect'](_0x1d5379,{'showHidden':![],'depth':null}));}};module[_0x1c9c('0xb9')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 9ac61c6..4ae07f6 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24a8=['rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','variables','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','diff','starttime','seconds','complete','total','answered','holdtime','billableseconds','sumHoldTime','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','voice_outbound:save','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outbound','dialbegin','syncDialBegin','syncDialEnd','bind','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','format','channel','substring','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','emit','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','[%s][voiceDialReport][dialbegin]','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','error','[%s][voiceDialReport][dialend]','addVariable','keys','value','variable','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqosbridged'];(function(_0x16e7c0,_0x56e353){var _0x2153cd=function(_0x40dc36){while(--_0x40dc36){_0x16e7c0['push'](_0x16e7c0['shift']());}};_0x2153cd(++_0x56e353);}(_0x24a8,0x8e));var _0x824a=function(_0x1578a7,_0x2610ff){_0x1578a7=_0x1578a7-0x0;var _0xefd7fa=_0x24a8[_0x1578a7];return _0xefd7fa;};'use strict';var _=require(_0x824a('0x0'));var moment=require(_0x824a('0x1'));var util=require(_0x824a('0x2'));var Redis=require(_0x824a('0x3'));var config=require(_0x824a('0x4'));var logger=require(_0x824a('0x5'))(_0x824a('0x6'));var ami=require(_0x824a('0x7'));config[_0x824a('0x8')]=_[_0x824a('0x9')](config['redis'],{'host':_0x824a('0xa'),'port':0x18eb});var io=require(_0x824a('0xb'))(new Redis(config[_0x824a('0x8')]));function VoiceDialReport(_0x3aeb6f){this[_0x824a('0xc')]=_0x3aeb6f['outboundChannels'];this[_0x824a('0xd')]=_0x3aeb6f[_0x824a('0xd')];this['variables']={};ami['on'](_0x824a('0xe'),this[_0x824a('0xf')]['bind'](this));ami['on']('dialend',this[_0x824a('0x10')][_0x824a('0x11')](this));ami['on'](_0x824a('0x12'),this[_0x824a('0x13')][_0x824a('0x11')](this));ami['on'](_0x824a('0x14'),this[_0x824a('0x15')][_0x824a('0x11')](this));}VoiceDialReport[_0x824a('0x16')][_0x824a('0x17')]=function(_0x5c8b0a){return _0x5c8b0a!==null&&!_[_0x824a('0x18')](_0x5c8b0a);};VoiceDialReport[_0x824a('0x16')]['emit']=function(_0x2144ad,_0x45b849,_0x5297af){io['to'](_0x2144ad)['emit'](_0x45b849,_0x5297af);};VoiceDialReport[_0x824a('0x16')][_0x824a('0xf')]=function(_0xad9dd2){try{if(this[_0x824a('0x17')](_0xad9dd2)){logger[_0x824a('0x19')](_0x824a('0x1a'),_0xad9dd2[_0x824a('0x1b')],util[_0x824a('0x1c')](_0xad9dd2,{'showHidden':![],'depth':null}));if(this[_0x824a('0xc')][_0xad9dd2[_0x824a('0x1b')]]){_['merge'](this[_0x824a('0xc')][_0xad9dd2[_0x824a('0x1b')]],{'starttime':moment()[_0x824a('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','interface':_0xad9dd2[_0x824a('0x1e')][_0x824a('0x1f')](0x0,_0xad9dd2[_0x824a('0x1e')][_0x824a('0x20')]('-')),'membername':_0xad9dd2[_0x824a('0x1e')][_0x824a('0x1f')](_0xad9dd2['channel'][_0x824a('0x20')]('/')+0x1,_0xad9dd2[_0x824a('0x1e')][_0x824a('0x20')]('-'))},_[_0x824a('0x21')](_0xad9dd2,[_0x824a('0x22'),_0x824a('0x23')]));logger[_0x824a('0x24')](_0x824a('0x25'),_0xad9dd2[_0x824a('0x1b')],this[_0x824a('0xc')][_0xad9dd2[_0x824a('0x1b')]]['membername'],this[_0x824a('0xc')][_0xad9dd2[_0x824a('0x1b')]][_0x824a('0x26')]);logger[_0x824a('0x19')](_0x824a('0x27'),_0xad9dd2[_0x824a('0x1b')],util[_0x824a('0x1c')](this[_0x824a('0xc')][_0xad9dd2[_0x824a('0x1b')]],{'showHidden':![],'depth':null}));this[_0x824a('0x28')](_0x824a('0x29'),_0x824a('0x2a'),this[_0x824a('0xc')][_0xad9dd2[_0x824a('0x1b')]]);logger[_0x824a('0x19')](_0x824a('0x2b'),_0xad9dd2['uniqueid'],util[_0x824a('0x1c')](this['channels'][_0xad9dd2[_0x824a('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x824a('0x28')](_0x824a('0x2c'),this[_0x824a('0xc')][_0xad9dd2[_0x824a('0x1b')]]);}}}catch(_0x180dd0){logger['error'](_0x824a('0x2d'),_0xad9dd2[_0x824a('0x1b')],util[_0x824a('0x1c')](_0x180dd0,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x824a('0x16')][_0x824a('0x10')]=function(_0x5c7f91){try{if(this[_0x824a('0x17')](_0x5c7f91)){logger[_0x824a('0x19')]('[%s][voiceDialReport][dialend]\x20event:',_0x5c7f91[_0x824a('0x1b')],util[_0x824a('0x1c')](_0x5c7f91,{'showHidden':![],'depth':null}));if(this[_0x824a('0xc')][_0x5c7f91['uniqueid']]){this[_0x824a('0xc')][_0x5c7f91['uniqueid']][_0x824a('0x2e')]=_0x5c7f91[_0x824a('0x2e')];if(_0x5c7f91[_0x824a('0x2e')]===_0x824a('0x2f')){this['channels'][_0x5c7f91[_0x824a('0x1b')]][_0x824a('0x30')]=_0x5c7f91[_0x824a('0x30')];this[_0x824a('0xc')][_0x5c7f91[_0x824a('0x1b')]][_0x824a('0x31')]=_0x5c7f91[_0x824a('0x31')];this[_0x824a('0xc')][_0x5c7f91[_0x824a('0x1b')]][_0x824a('0x32')]=moment()[_0x824a('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x824a('0xc')][_0x5c7f91[_0x824a('0x1b')]]['lastevent']=_0x824a('0x33');logger[_0x824a('0x24')](_0x824a('0x34'),_0x5c7f91['uniqueid'],_0x5c7f91[_0x824a('0x1e')][_0x824a('0x1f')](_0x5c7f91['channel'][_0x824a('0x20')]('/')+0x1,_0x5c7f91[_0x824a('0x1e')][_0x824a('0x20')]('-')));logger['debug'](_0x824a('0x35'),_0x5c7f91[_0x824a('0x1b')],util[_0x824a('0x1c')](this[_0x824a('0xc')][_0x5c7f91[_0x824a('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x824a('0x28')](_0x824a('0x36'),this[_0x824a('0xc')][_0x5c7f91[_0x824a('0x1b')]]);}logger[_0x824a('0x19')](_0x824a('0x37'),_0x5c7f91[_0x824a('0x1b')],util[_0x824a('0x1c')](this['channels'][_0x5c7f91[_0x824a('0x1b')]],{'showHidden':![],'depth':null}));this['emit'](_0x824a('0x29'),'voice_outbound_channel:save',this[_0x824a('0xc')][_0x5c7f91['uniqueid']]);}}}catch(_0x14ca5f){logger[_0x824a('0x38')](_0x824a('0x39'),_0x5c7f91[_0x824a('0x1b')],util[_0x824a('0x1c')](_0x14ca5f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x824a('0x16')][_0x824a('0x13')]=function(_0x2af9d0){try{if(this['isNotNull'](_0x2af9d0)){logger[_0x824a('0x19')]('[%s][voiceDialReport][varset]\x20event:',_0x2af9d0['uniqueid'],util[_0x824a('0x1c')](_0x2af9d0,{'showHidden':![],'depth':null}));this[_0x824a('0x3a')](_0x2af9d0[_0x824a('0x1b')],_[_0x824a('0x3b')](_0x2af9d0['variable'])[0x0],_0x2af9d0[_0x824a('0x3c')]);if(this[_0x824a('0x17')](_0x2af9d0[_0x824a('0x3d')])&&this[_0x824a('0x17')](_0x2af9d0[_0x824a('0x3d')][_0x824a('0x3e')])){if(_['isUndefined'](this[_0x824a('0xc')][_0x2af9d0[_0x824a('0x1b')]])){this[_0x824a('0xc')][_0x2af9d0[_0x824a('0x1b')]]={'routeId':_0x2af9d0[_0x824a('0x3c')],'variables':this['variables'][_0x2af9d0[_0x824a('0x1b')]]};logger[_0x824a('0x24')](_0x824a('0x3f'),_0x2af9d0[_0x824a('0x1b')],_0x2af9d0[_0x824a('0x3d')]['outboundrouteid'],_[_0x824a('0x3b')](_0x2af9d0[_0x824a('0x3d')])[0x0],_0x2af9d0['value']);logger[_0x824a('0x19')](_0x824a('0x40'),_0x2af9d0['uniqueid'],util[_0x824a('0x1c')](this[_0x824a('0xc')][_0x2af9d0[_0x824a('0x1b')]],{'showHidden':![],'depth':null}));this[_0x824a('0x28')]('voice:outbound',_0x824a('0x2a'),this[_0x824a('0xc')][_0x2af9d0[_0x824a('0x1b')]]);}}}}catch(_0x537b9b){logger[_0x824a('0x38')]('[%s][voiceDialReport][varset]',_0x2af9d0[_0x824a('0x1b')],util[_0x824a('0x1c')](_0x537b9b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x824a('0x16')][_0x824a('0x3a')]=function(_0xdab1e4,_0x43f5f7,_0xc5144d){var _0x29835b=['rtpaudioqos',_0x824a('0x41'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x824a('0x42'),_0x824a('0x43'),_0x824a('0x44'),_0x824a('0x45'),'sipcallid',_0x824a('0x46'),_0x824a('0x47'),_0x824a('0x48'),_0x824a('0x49'),_0x824a('0x4a'),_0x824a('0x4b'),_0x824a('0x4c'),_0x824a('0x4d'),_0x824a('0x4e'),_0x824a('0x4f')];if(!_[_0x824a('0x50')](_0x43f5f7)&&!_[_0x824a('0x51')](_0x29835b,_0x43f5f7)){if(_[_0x824a('0x18')](this['variables'][_0xdab1e4])){this['variables'][_0xdab1e4]={};}this[_0x824a('0x52')][_0xdab1e4][_0x43f5f7]=_0xc5144d;}};VoiceDialReport['prototype'][_0x824a('0x15')]=function(_0x453ebc){try{if(this[_0x824a('0x17')](_0x453ebc)){logger[_0x824a('0x19')](_0x824a('0x53'),_0x453ebc[_0x824a('0x1b')],util[_0x824a('0x1c')](_0x453ebc,{'showHidden':![],'depth':null}));if(this[_0x824a('0xc')][_0x453ebc[_0x824a('0x1b')]]){logger[_0x824a('0x24')](_0x824a('0x54'),_0x453ebc[_0x824a('0x1b')],_0x453ebc['cause-txt']);this['channels'][_0x453ebc[_0x824a('0x1b')]]['endtime']=moment()[_0x824a('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x824a('0xc')][_0x453ebc['uniqueid']]['duration']=moment(this[_0x824a('0xc')][_0x453ebc[_0x824a('0x1b')]][_0x824a('0x55')])[_0x824a('0x56')](this['channels'][_0x453ebc[_0x824a('0x1b')]][_0x824a('0x57')],_0x824a('0x58'));this['channels'][_0x453ebc['uniqueid']]['lastevent']=_0x824a('0x59');this[_0x824a('0xd')][_0x824a('0x5a')]+=0x1;if(this[_0x824a('0xc')][_0x453ebc[_0x824a('0x1b')]]['answertime']){this[_0x824a('0xd')][_0x824a('0x5b')]+=0x1;this[_0x824a('0xc')][_0x453ebc[_0x824a('0x1b')]][_0x824a('0x5c')]=moment(this[_0x824a('0xc')][_0x453ebc[_0x824a('0x1b')]]['answertime'])[_0x824a('0x56')](this['channels'][_0x453ebc['uniqueid']]['starttime'],_0x824a('0x58'));this[_0x824a('0xc')][_0x453ebc['uniqueid']][_0x824a('0x5d')]=moment(this[_0x824a('0xc')][_0x453ebc['uniqueid']][_0x824a('0x55')])['diff'](this[_0x824a('0xc')][_0x453ebc[_0x824a('0x1b')]][_0x824a('0x32')],'seconds');this[_0x824a('0xd')][_0x824a('0x5e')]+=this[_0x824a('0xc')][_0x453ebc['uniqueid']]['holdtime']||0x0;this['outbound']['sumBillable']+=this['channels'][_0x453ebc[_0x824a('0x1b')]][_0x824a('0x5d')];}this[_0x824a('0xd')][_0x824a('0x5f')]+=this['channels'][_0x453ebc['uniqueid']]['duration'];logger[_0x824a('0x19')](_0x824a('0x60'),_0x453ebc[_0x824a('0x1b')],util[_0x824a('0x1c')](this[_0x824a('0xc')][_0x453ebc[_0x824a('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x824a('0x28')](_0x824a('0x61'),this[_0x824a('0xc')][_0x453ebc[_0x824a('0x1b')]]);logger[_0x824a('0x19')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x453ebc['uniqueid'],util[_0x824a('0x1c')](this[_0x824a('0xc')][_0x453ebc[_0x824a('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x824a('0x28')](_0x824a('0x62'),this[_0x824a('0xc')][_0x453ebc[_0x824a('0x1b')]]);logger[_0x824a('0x19')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x453ebc[_0x824a('0x1b')],util[_0x824a('0x1c')](this[_0x824a('0xc')][_0x453ebc[_0x824a('0x1b')]],{'showHidden':![],'depth':null}));this[_0x824a('0x28')]('voice:outbound',_0x824a('0x63'),this[_0x824a('0xd')]);logger['info']('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x824a('0x64')](this[_0x824a('0xc')][_0x453ebc[_0x824a('0x1b')]]));logger['debug'](_0x824a('0x65'),_0x453ebc[_0x824a('0x1b')],util['inspect'](this[_0x824a('0xc')][_0x453ebc[_0x824a('0x1b')]],{'showHidden':![],'depth':null}));this[_0x824a('0x28')](_0x824a('0x29'),_0x824a('0x66'),this['channels'][_0x453ebc[_0x824a('0x1b')]]);delete this[_0x824a('0xc')][_0x453ebc[_0x824a('0x1b')]];}else if(this[_0x824a('0xc')][_0x453ebc[_0x824a('0x67')]]){this[_0x824a('0xc')][_0x453ebc[_0x824a('0x67')]]['uniqueid']=this[_0x824a('0xc')][_0x453ebc[_0x824a('0x67')]]['destuniqueid'];}if(this[_0x824a('0x52')][_0x453ebc[_0x824a('0x1b')]]){delete this[_0x824a('0x52')][_0x453ebc[_0x824a('0x1b')]];}}}catch(_0x559d13){logger[_0x824a('0x38')]('[%s][voiceDialReport][hangup]',_0x453ebc[_0x824a('0x1b')],util['inspect'](_0x559d13,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0xf332=['debug','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','privilege','info','membername','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','outboundrouteid','value','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','variables','cause-txt','duration','endtime','diff','starttime','seconds','complete','answered','sumHoldTime','holdtime','sumBillable','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','dialbegin','syncDialBegin','dialend','syncDialEnd','bind','varset','syncVarSet','hangup','syncHangup','isNotNull','isUndefined','emit','prototype'];(function(_0x511b76,_0x4727fa){var _0x5424ff=function(_0x24b7c0){while(--_0x24b7c0){_0x511b76['push'](_0x511b76['shift']());}};_0x5424ff(++_0x4727fa);}(_0xf332,0xbd));var _0x2f33=function(_0x13b0c8,_0x329a9b){_0x13b0c8=_0x13b0c8-0x0;var _0x400bfa=_0xf332[_0x13b0c8];return _0x400bfa;};'use strict';var _=require(_0x2f33('0x0'));var moment=require(_0x2f33('0x1'));var util=require(_0x2f33('0x2'));var Redis=require(_0x2f33('0x3'));var config=require(_0x2f33('0x4'));var logger=require(_0x2f33('0x5'))(_0x2f33('0x6'));var ami=require('../ami');config[_0x2f33('0x7')]=_[_0x2f33('0x8')](config[_0x2f33('0x7')],{'host':_0x2f33('0x9'),'port':0x18eb});var io=require(_0x2f33('0xa'))(new Redis(config[_0x2f33('0x7')]));function VoiceDialReport(_0x2a3ccf){this[_0x2f33('0xb')]=_0x2a3ccf[_0x2f33('0xc')];this['outbound']=_0x2a3ccf[_0x2f33('0xd')];this['variables']={};ami['on'](_0x2f33('0xe'),this[_0x2f33('0xf')]['bind'](this));ami['on'](_0x2f33('0x10'),this[_0x2f33('0x11')][_0x2f33('0x12')](this));ami['on'](_0x2f33('0x13'),this[_0x2f33('0x14')][_0x2f33('0x12')](this));ami['on'](_0x2f33('0x15'),this[_0x2f33('0x16')][_0x2f33('0x12')](this));}VoiceDialReport['prototype'][_0x2f33('0x17')]=function(_0x271752){return _0x271752!==null&&!_[_0x2f33('0x18')](_0x271752);};VoiceDialReport['prototype']['emit']=function(_0x59d32e,_0x33fc7a,_0x1bb41c){io['to'](_0x59d32e)[_0x2f33('0x19')](_0x33fc7a,_0x1bb41c);};VoiceDialReport[_0x2f33('0x1a')][_0x2f33('0xf')]=function(_0x1e7fa8){try{if(this[_0x2f33('0x17')](_0x1e7fa8)){logger[_0x2f33('0x1b')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x1e7fa8[_0x2f33('0x1c')],util[_0x2f33('0x1d')](_0x1e7fa8,{'showHidden':![],'depth':null}));if(this['channels'][_0x1e7fa8[_0x2f33('0x1c')]]){_[_0x2f33('0x1e')](this[_0x2f33('0xb')][_0x1e7fa8['uniqueid']],{'starttime':moment()[_0x2f33('0x1f')](_0x2f33('0x20')),'lastevent':'called','interface':_0x1e7fa8[_0x2f33('0x21')][_0x2f33('0x22')](0x0,_0x1e7fa8['channel'][_0x2f33('0x23')]('-')),'membername':_0x1e7fa8[_0x2f33('0x21')]['substring'](_0x1e7fa8[_0x2f33('0x21')][_0x2f33('0x23')]('/')+0x1,_0x1e7fa8[_0x2f33('0x21')]['lastIndexOf']('-'))},_[_0x2f33('0x24')](_0x1e7fa8,['event',_0x2f33('0x25')]));logger[_0x2f33('0x26')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x1e7fa8['uniqueid'],this[_0x2f33('0xb')][_0x1e7fa8[_0x2f33('0x1c')]][_0x2f33('0x27')],this[_0x2f33('0xb')][_0x1e7fa8[_0x2f33('0x1c')]]['interface']);logger[_0x2f33('0x1b')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x1e7fa8[_0x2f33('0x1c')],util[_0x2f33('0x1d')](this[_0x2f33('0xb')][_0x1e7fa8[_0x2f33('0x1c')]],{'showHidden':![],'depth':null}));this[_0x2f33('0x19')]('voice:outbound',_0x2f33('0x28'),this[_0x2f33('0xb')][_0x1e7fa8[_0x2f33('0x1c')]]);logger[_0x2f33('0x1b')](_0x2f33('0x29'),_0x1e7fa8['uniqueid'],util['inspect'](this[_0x2f33('0xb')][_0x1e7fa8[_0x2f33('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x2f33('0x19')](_0x2f33('0x2a'),this[_0x2f33('0xb')][_0x1e7fa8['uniqueid']]);}}}catch(_0x2124ce){logger[_0x2f33('0x2b')](_0x2f33('0x2c'),_0x1e7fa8[_0x2f33('0x1c')],util[_0x2f33('0x1d')](_0x2124ce,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2f33('0x1a')]['syncDialEnd']=function(_0x52a47e){try{if(this[_0x2f33('0x17')](_0x52a47e)){logger[_0x2f33('0x1b')]('[%s][voiceDialReport][dialend]\x20event:',_0x52a47e['uniqueid'],util['inspect'](_0x52a47e,{'showHidden':![],'depth':null}));if(this['channels'][_0x52a47e[_0x2f33('0x1c')]]){this[_0x2f33('0xb')][_0x52a47e['uniqueid']][_0x2f33('0x2d')]=_0x52a47e[_0x2f33('0x2d')];if(_0x52a47e[_0x2f33('0x2d')]===_0x2f33('0x2e')){this['channels'][_0x52a47e[_0x2f33('0x1c')]][_0x2f33('0x2f')]=_0x52a47e[_0x2f33('0x2f')];this[_0x2f33('0xb')][_0x52a47e[_0x2f33('0x1c')]]['connectedlinename']=_0x52a47e[_0x2f33('0x30')];this['channels'][_0x52a47e['uniqueid']][_0x2f33('0x31')]=moment()[_0x2f33('0x1f')](_0x2f33('0x20'));this['channels'][_0x52a47e[_0x2f33('0x1c')]][_0x2f33('0x32')]=_0x2f33('0x33');logger[_0x2f33('0x26')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x52a47e[_0x2f33('0x1c')],_0x52a47e[_0x2f33('0x21')][_0x2f33('0x22')](_0x52a47e[_0x2f33('0x21')][_0x2f33('0x23')]('/')+0x1,_0x52a47e[_0x2f33('0x21')]['lastIndexOf']('-')));logger[_0x2f33('0x1b')](_0x2f33('0x34'),_0x52a47e['uniqueid'],util[_0x2f33('0x1d')](this[_0x2f33('0xb')][_0x52a47e[_0x2f33('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x2f33('0x19')](_0x2f33('0x35'),this[_0x2f33('0xb')][_0x52a47e[_0x2f33('0x1c')]]);}logger['debug'](_0x2f33('0x36'),_0x52a47e[_0x2f33('0x1c')],util[_0x2f33('0x1d')](this[_0x2f33('0xb')][_0x52a47e[_0x2f33('0x1c')]],{'showHidden':![],'depth':null}));this[_0x2f33('0x19')]('voice:outbound','voice_outbound_channel:save',this[_0x2f33('0xb')][_0x52a47e['uniqueid']]);}}}catch(_0x2a422b){logger[_0x2f33('0x2b')](_0x2f33('0x37'),_0x52a47e[_0x2f33('0x1c')],util[_0x2f33('0x1d')](_0x2a422b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2f33('0x1a')]['syncVarSet']=function(_0x935c1d){try{if(this[_0x2f33('0x17')](_0x935c1d)){logger['debug'](_0x2f33('0x38'),_0x935c1d[_0x2f33('0x1c')],util[_0x2f33('0x1d')](_0x935c1d,{'showHidden':![],'depth':null}));this[_0x2f33('0x39')](_0x935c1d[_0x2f33('0x1c')],_[_0x2f33('0x3a')](_0x935c1d[_0x2f33('0x3b')])[0x0],_0x935c1d['value']);if(this['isNotNull'](_0x935c1d['variable'])&&this[_0x2f33('0x17')](_0x935c1d[_0x2f33('0x3b')][_0x2f33('0x3c')])){if(_['isUndefined'](this[_0x2f33('0xb')][_0x935c1d[_0x2f33('0x1c')]])){this['channels'][_0x935c1d[_0x2f33('0x1c')]]={'routeId':_0x935c1d[_0x2f33('0x3d')],'variables':this['variables'][_0x935c1d[_0x2f33('0x1c')]]};logger[_0x2f33('0x26')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x935c1d[_0x2f33('0x1c')],_0x935c1d[_0x2f33('0x3b')][_0x2f33('0x3c')],_[_0x2f33('0x3a')](_0x935c1d['variable'])[0x0],_0x935c1d['value']);logger[_0x2f33('0x1b')](_0x2f33('0x3e'),_0x935c1d[_0x2f33('0x1c')],util[_0x2f33('0x1d')](this[_0x2f33('0xb')][_0x935c1d['uniqueid']],{'showHidden':![],'depth':null}));this[_0x2f33('0x19')](_0x2f33('0x3f'),_0x2f33('0x28'),this[_0x2f33('0xb')][_0x935c1d[_0x2f33('0x1c')]]);}}}}catch(_0x50efdd){logger[_0x2f33('0x2b')]('[%s][voiceDialReport][varset]',_0x935c1d['uniqueid'],util[_0x2f33('0x1d')](_0x50efdd,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['addVariable']=function(_0x1684ad,_0x2f8bed,_0x385029){var _0x295200=[_0x2f33('0x40'),'rtpaudioqosbridged',_0x2f33('0x41'),_0x2f33('0x42'),_0x2f33('0x43'),'rtpaudioqoslossbridged',_0x2f33('0x44'),_0x2f33('0x45'),_0x2f33('0x46'),_0x2f33('0x47'),_0x2f33('0x48'),_0x2f33('0x49'),_0x2f33('0x4a'),_0x2f33('0x4b'),_0x2f33('0x4c'),_0x2f33('0x4d'),_0x2f33('0x27'),_0x2f33('0x4e'),_0x2f33('0x4f')];if(!_[_0x2f33('0x50')](_0x2f8bed)&&!_[_0x2f33('0x51')](_0x295200,_0x2f8bed)){if(_[_0x2f33('0x18')](this[_0x2f33('0x52')][_0x1684ad])){this[_0x2f33('0x52')][_0x1684ad]={};}this[_0x2f33('0x52')][_0x1684ad][_0x2f8bed]=_0x385029;}};VoiceDialReport[_0x2f33('0x1a')]['syncHangup']=function(_0x4ece60){try{if(this[_0x2f33('0x17')](_0x4ece60)){logger[_0x2f33('0x1b')]('[%s][voiceDialReport][hangup]\x20event:',_0x4ece60[_0x2f33('0x1c')],util[_0x2f33('0x1d')](_0x4ece60,{'showHidden':![],'depth':null}));if(this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]]){logger[_0x2f33('0x26')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x4ece60[_0x2f33('0x1c')],_0x4ece60[_0x2f33('0x53')]);this[_0x2f33('0xb')][_0x4ece60['uniqueid']]['endtime']=moment()[_0x2f33('0x1f')](_0x2f33('0x20'));this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]][_0x2f33('0x54')]=moment(this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]][_0x2f33('0x55')])[_0x2f33('0x56')](this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]][_0x2f33('0x57')],_0x2f33('0x58'));this[_0x2f33('0xb')][_0x4ece60['uniqueid']][_0x2f33('0x32')]=_0x2f33('0x59');this[_0x2f33('0xd')]['total']+=0x1;if(this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]][_0x2f33('0x31')]){this['outbound'][_0x2f33('0x5a')]+=0x1;this[_0x2f33('0xb')][_0x4ece60['uniqueid']]['holdtime']=moment(this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]]['answertime'])[_0x2f33('0x56')](this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]][_0x2f33('0x57')],_0x2f33('0x58'));this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]]['billableseconds']=moment(this[_0x2f33('0xb')][_0x4ece60['uniqueid']][_0x2f33('0x55')])[_0x2f33('0x56')](this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]]['answertime'],_0x2f33('0x58'));this['outbound'][_0x2f33('0x5b')]+=this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]][_0x2f33('0x5c')]||0x0;this[_0x2f33('0xd')][_0x2f33('0x5d')]+=this[_0x2f33('0xb')][_0x4ece60['uniqueid']][_0x2f33('0x5e')];}this[_0x2f33('0xd')][_0x2f33('0x5f')]+=this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]][_0x2f33('0x54')];logger[_0x2f33('0x1b')](_0x2f33('0x60'),_0x4ece60['uniqueid'],util['inspect'](this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x2f33('0x19')](_0x2f33('0x61'),this['channels'][_0x4ece60[_0x2f33('0x1c')]]);logger['debug'](_0x2f33('0x62'),_0x4ece60[_0x2f33('0x1c')],util[_0x2f33('0x1d')](this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x2f33('0x19')]('custom:dialend',this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]]);logger['debug'](_0x2f33('0x63'),_0x4ece60[_0x2f33('0x1c')],util[_0x2f33('0x1d')](this[_0x2f33('0xb')][_0x4ece60['uniqueid']],{'showHidden':![],'depth':null}));this[_0x2f33('0x19')]('voice:outbound',_0x2f33('0x64'),this[_0x2f33('0xd')]);logger[_0x2f33('0x26')](_0x2f33('0x65'),JSON[_0x2f33('0x66')](this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x1c')]]));logger[_0x2f33('0x1b')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x4ece60[_0x2f33('0x1c')],util[_0x2f33('0x1d')](this['channels'][_0x4ece60[_0x2f33('0x1c')]],{'showHidden':![],'depth':null}));this[_0x2f33('0x19')](_0x2f33('0x3f'),_0x2f33('0x67'),this['channels'][_0x4ece60['uniqueid']]);delete this[_0x2f33('0xb')][_0x4ece60['uniqueid']];}else if(this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x68')]]){this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x68')]][_0x2f33('0x1c')]=this[_0x2f33('0xb')][_0x4ece60[_0x2f33('0x68')]][_0x2f33('0x69')];}if(this[_0x2f33('0x52')][_0x4ece60[_0x2f33('0x1c')]]){delete this[_0x2f33('0x52')][_0x4ece60[_0x2f33('0x1c')]];}}}catch(_0x573cd7){logger[_0x2f33('0x2b')](_0x2f33('0x6a'),_0x4ece60[_0x2f33('0x1c')],util[_0x2f33('0x1d')](_0x573cd7,{'showHidden':![],'depth':null}));}};module[_0x2f33('0x6b')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 81befb1..3b61fc9 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3315=['milliseconds','answered','sumBillable','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','transfereeuniqueid','transferexten','secondtransfererexten','secondtransfereruniqueid','ATTENDED','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][attendedtransfer]','BLINDTRANSFER','extension','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceQueueReport][musiconholdstop]','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','mohtime','exports','lodash','moment','util','md5','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','agentcomplete','agentconnect','syncAgentConnect','varset','syncVarSet','syncHangup','fullybooted','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopQueueSummary','isEmpty','hasOwnProperty','originated','pTalking','waiting','unlockRR','clearZombieChannels','sequence','isNil','Action','catch','message','No\x20such\x20channel','error','inspect','[%s][voiceQueueReport][checkQueueReport]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','clearqueuereport','emit','debug','[%s][voiceQueueReport][','format','name','voice_queue_channel:save','emitVoiceQueueChannelRemove',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','voice:queue:%s','voice_queue_channel:remove','type','strategy','available','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','Trunk','active','callerid','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','loopQueueShow','queues','[voiceQueueReport][queues]','[voiceQueueReport][queuesummary]','queue','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','callers','toNumber','loggedIn','loggedin','emitVoiceQueueSummary','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','inbound','queuecallerjoinAt','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','emitVoiceQueueChannelSave','[%s][voiceQueueReport][queuecallerjoin]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitreason','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','syncQueueCallerLeave','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexitAt','transfer','reason','COMPLETED','local/','linkedid','queuecallerexit','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','value','variable','CONTINUE','TIMEOUT','lastevent','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','keys','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberrealtime','includes','[%s][voiceQueueReport][hangup]','length','diff'];(function(_0x284773,_0x46c4b8){var _0x1f257c=function(_0xa8dab1){while(--_0xa8dab1){_0x284773['push'](_0x284773['shift']());}};_0x1f257c(++_0x46c4b8);}(_0x3315,0x1e3));var _0x5331=function(_0x1b8c87,_0x15a5cd){_0x1b8c87=_0x1b8c87-0x0;var _0x1a27ec=_0x3315[_0x1b8c87];return _0x1a27ec;};'use strict';var _=require(_0x5331('0x0'));var moment=require(_0x5331('0x1'));var util=require(_0x5331('0x2'));var md5=require(_0x5331('0x3'));var Redis=require(_0x5331('0x4'));var config=require(_0x5331('0x5'));var logger=require(_0x5331('0x6'))(_0x5331('0x7'));var ami=require(_0x5331('0x8'));var QueueReport=require(_0x5331('0x9'));config[_0x5331('0xa')]=_[_0x5331('0xb')](config[_0x5331('0xa')],{'host':_0x5331('0xc'),'port':0x18eb});var io=require(_0x5331('0xd'))(new Redis(config[_0x5331('0xa')]));var Sequence=function(){};Sequence[_0x5331('0xe')][_0x5331('0xf')]=function(_0x6c5ccd){this[_0x5331('0x10')]=this[_0x5331('0x10')]?this[_0x5331('0x10')][_0x5331('0x11')](_0x6c5ccd):_0x6c5ccd();};function VoiceQueueReport(_0x3ab6e0){this['sequence']=new Sequence();this[_0x5331('0x12')]={};this[_0x5331('0x13')]=_0x3ab6e0[_0x5331('0x13')];this[_0x5331('0x14')]=_0x3ab6e0[_0x5331('0x15')];this[_0x5331('0x16')]=_0x3ab6e0[_0x5331('0x16')];this[_0x5331('0x17')]=!![];this[_0x5331('0x18')]=_0x3ab6e0[_0x5331('0x18')];this[_0x5331('0x19')]={};ami['on'](_0x5331('0x1a'),this[_0x5331('0x1b')][_0x5331('0x1c')](this));ami['on'](_0x5331('0x1d'),this[_0x5331('0x1e')][_0x5331('0x1c')](this));ami['on'](_0x5331('0x1f'),this[_0x5331('0x20')]['bind'](this));ami['on'](_0x5331('0x21'),this[_0x5331('0x22')][_0x5331('0x1c')](this));ami['on'](_0x5331('0x23'),this['syncQueueCallerLeave'][_0x5331('0x1c')](this));ami['on'](_0x5331('0x24'),this['syncAgentComplete'][_0x5331('0x1c')](this));ami['on'](_0x5331('0x25'),this[_0x5331('0x26')]['bind'](this));ami['on'](_0x5331('0x27'),this[_0x5331('0x28')][_0x5331('0x1c')](this));ami['on']('hangup',this[_0x5331('0x29')][_0x5331('0x1c')](this));ami['on'](_0x5331('0x2a'),this['syncFullyBooted'][_0x5331('0x1c')](this));ami['on'](_0x5331('0x2b'),this['syncMusicOnHoldStart'][_0x5331('0x1c')](this));ami['on'](_0x5331('0x2c'),this[_0x5331('0x2d')]['bind'](this));ami['on'](_0x5331('0x2e'),this[_0x5331('0x2f')][_0x5331('0x1c')](this));ami['on']('blindtransfer',this[_0x5331('0x30')][_0x5331('0x1c')](this));this[_0x5331('0x31')]();this['loopQueueShow']();}function clearChannels(_0x4bf57a){if(!_[_0x5331('0x32')](_0x4bf57a)){for(var _0x3f2926 in _0x4bf57a){if(_0x4bf57a[_0x5331('0x33')](_0x3f2926)){delete _0x4bf57a[_0x3f2926];}}}}function clearCampaigns(_0x3a26e5){if(!_[_0x5331('0x32')](_0x3a26e5)){for(var _0xc49c3d in _0x3a26e5){if(_0x3a26e5['hasOwnProperty'](_0xc49c3d)){_0x3a26e5[_0xc49c3d][_0x5331('0x34')]=0x0;}}}}function clearVoiceQueues(_0x3eccd5){if(!_[_0x5331('0x32')](_0x3eccd5)){for(var _0x19cbca in _0x3eccd5){if(_0x3eccd5[_0x5331('0x33')](_0x19cbca)){_0x3eccd5[_0x19cbca][_0x5331('0x34')]=0x0;_0x3eccd5[_0x19cbca]['talking']=0x0;_0x3eccd5[_0x19cbca][_0x5331('0x35')]=0x0;_0x3eccd5[_0x19cbca][_0x5331('0x36')]=0x0;_0x3eccd5[_0x19cbca]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x14fc41){if(!_[_0x5331('0x32')](_0x14fc41)){for(var _0x81bfa5 in _0x14fc41){if(_0x14fc41['hasOwnProperty'](_0x81bfa5)){_0x14fc41[_0x81bfa5][_0x5331('0x37')]=!![];}}}}VoiceQueueReport[_0x5331('0xe')][_0x5331('0x38')]=function(){var _0x2dc1d4=this;for(var _0x16538f in this[_0x5331('0x14')]){if(this['channels'][_0x5331('0x33')](_0x16538f)&&!this[_0x5331('0x14')][_0x16538f]['switch']){this[_0x5331('0x39')][_0x5331('0xf')](function(){if(!_[_0x5331('0x3a')](_0x2dc1d4[_0x5331('0x14')][_0x16538f])){return ami[_0x5331('0x3b')]({'action':'status','channel':_0x2dc1d4[_0x5331('0x14')][_0x16538f]['channel']})[_0x5331('0x3c')](function(_0x3b6246){if(_0x3b6246[_0x5331('0x3d')]===_0x5331('0x3e')){setTimeout(function(){if(_0x2dc1d4[_0x5331('0x14')][_0x16538f]){delete _0x2dc1d4[_0x5331('0x14')][_0x16538f];logger[_0x5331('0x3f')]('[%s][voiceQueueReport][checkChannel]',_0x16538f,util[_0x5331('0x40')](_0x3b6246,{'showHidden':![],'depth':null}));}if(_0x2dc1d4[_0x5331('0x12')][_0x16538f]){delete _0x2dc1d4[_0x5331('0x12')][_0x16538f];logger['error'](_0x5331('0x41'),_0x16538f,util[_0x5331('0x40')](_0x3b6246,{'showHidden':![],'depth':null}));}if(_0x2dc1d4[_0x5331('0x19')][_0x16538f]){delete _0x2dc1d4[_0x5331('0x19')][_0x16538f];logger['error']('[%s][voiceQueueReport][checkVariables]',_0x16538f,util[_0x5331('0x40')](_0x3b6246,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x5331('0xe')]['syncFullyBooted']=function(){logger[_0x5331('0x3f')](_0x5331('0x42'));clearChannels(this[_0x5331('0x14')]);this['clearQueueReport'](this[_0x5331('0x12')]);clearAgentBooked(this[_0x5331('0x13')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0x5331('0x18')]);};VoiceQueueReport[_0x5331('0xe')][_0x5331('0x43')]=function(_0x1ab0d0){var _0x316c25=this;if(!_[_0x5331('0x32')](_0x1ab0d0)){for(var _0x3d97f6 in _0x1ab0d0){if(_0x1ab0d0['hasOwnProperty'](_0x3d97f6)){_0x316c25['emitVoiceQueueChannelRemove'](_0x1ab0d0[_0x3d97f6],_0x5331('0x44'));delete _0x1ab0d0[_0x3d97f6];}}}};VoiceQueueReport[_0x5331('0xe')][_0x5331('0x45')]=function(_0x10ac12,_0x4e85fa,_0x3bb315){io['to'](_0x10ac12)[_0x5331('0x45')](_0x4e85fa,_0x3bb315);};VoiceQueueReport[_0x5331('0xe')]['emitVoiceQueueChannelSave']=function(_0x2bcec1,_0x5be531){logger[_0x5331('0x46')](_0x5331('0x47')+_0x5be531+']\x20sending\x20voice_queue_channel:save\x20event:',_0x2bcec1['uniqueid'],util[_0x5331('0x40')](_0x2bcec1,{'showHidden':![],'depth':null}));this[_0x5331('0x45')](util[_0x5331('0x48')]('voice:queue:%s',_0x2bcec1[_0x5331('0x49')]),_0x5331('0x4a'),_0x2bcec1);};VoiceQueueReport['prototype'][_0x5331('0x4b')]=function(_0x2884d9,_0x4fc289){logger[_0x5331('0x46')]('[%s][voiceQueueReport]['+_0x4fc289+_0x5331('0x4c'),_0x2884d9[_0x5331('0x4d')],util[_0x5331('0x40')](_0x2884d9,{'showHidden':![],'depth':null}));this[_0x5331('0x45')](util[_0x5331('0x48')](_0x5331('0x4e'),_0x2884d9[_0x5331('0x49')]),_0x5331('0x4f'),_0x2884d9);};VoiceQueueReport[_0x5331('0xe')]['emitVoiceQueueSummary']=function(_0x968c9d,_0x4ff3a5){if(_0x968c9d[_0x5331('0x50')]==='inbound'){var _0x3ab322={'id':_0x968c9d['id'],'name':_0x968c9d[_0x5331('0x49')],'strategy':_0x968c9d[_0x5331('0x51')],'answered':_0x968c9d['answered'],'available':_0x968c9d[_0x5331('0x52')],'loggedIn':_0x968c9d['loggedIn'],'pTalking':_0x968c9d[_0x5331('0x35')],'sumBillable':_0x968c9d['sumBillable'],'sumDuration':_0x968c9d[_0x5331('0x53')],'sumHoldTime':_0x968c9d[_0x5331('0x54')]||0x0,'talking':_0x968c9d[_0x5331('0x55')],'total':_0x968c9d[_0x5331('0x56')],'type':_0x968c9d[_0x5331('0x50')],'unmanaged':_0x968c9d[_0x5331('0x57')],'abandoned':_0x968c9d[_0x5331('0x58')],'waiting':_0x968c9d[_0x5331('0x36')]};if(_0x968c9d['Trunk']){_0x3ab322[_0x5331('0x59')]={'id':_0x968c9d[_0x5331('0x59')]['id'],'name':_0x968c9d[_0x5331('0x59')]['name'],'active':_0x968c9d[_0x5331('0x59')][_0x5331('0x5a')],'callerid':_0x968c9d[_0x5331('0x59')][_0x5331('0x5b')]};}if(_0x968c9d[_0x5331('0x5c')]){_0x3ab322[_0x5331('0x5c')]={'id':_0x968c9d[_0x5331('0x5c')]['id'],'name':_0x968c9d[_0x5331('0x5c')][_0x5331('0x49')]};}var _0x4218a5=md5(JSON[_0x5331('0x5d')](_0x3ab322));if(_0x968c9d[_0x5331('0x3')]!==_0x4218a5){_0x968c9d['md5']=_0x4218a5;logger[_0x5331('0x46')](_0x5331('0x5e')+_0x4ff3a5+_0x5331('0x5f'),util['inspect'](_0x3ab322,{'showHidden':![],'depth':null}));this[_0x5331('0x45')](util[_0x5331('0x48')]('voice:queue:%s',_0x3ab322[_0x5331('0x49')]),_0x5331('0x60'),_0x3ab322);}}};VoiceQueueReport[_0x5331('0xe')][_0x5331('0x61')]=function(_0x55802f){return _0x55802f!==null&&!_[_0x5331('0x62')](_0x55802f);};VoiceQueueReport[_0x5331('0xe')][_0x5331('0x63')]=function(){var _0x3ca823=this;setInterval(function(){_0x3ca823[_0x5331('0x38')]();ami[_0x5331('0x3b')]({'action':_0x5331('0x64')})['catch'](function(_0xe4a843){logger['error'](_0x5331('0x65'),util[_0x5331('0x40')](_0xe4a843,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype'][_0x5331('0x31')]=function(){var _0x3c4703=this;setInterval(function(){if(_0x3c4703[_0x5331('0x17')]){return ami[_0x5331('0x3b')]({'action':'queuesummary'})['then'](function(_0x5b235d){_0x3c4703['flagQueueSummary']=![];})[_0x5331('0x3c')](function(_0x59bcea){logger[_0x5331('0x3f')](_0x5331('0x66'),util[_0x5331('0x40')](_0x59bcea,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x5331('0xe')][_0x5331('0x1b')]=function(_0x4073dd){try{if(this[_0x5331('0x61')](_0x4073dd)&&this[_0x5331('0x61')](_0x4073dd[_0x5331('0x67')])){logger['debug'](_0x5331('0x68'),util['inspect'](_0x4073dd,{'showHidden':![],'depth':null}));if(this['voiceQueues'][_0x4073dd[_0x5331('0x67')]]){logger[_0x5331('0x69')](_0x5331('0x6a'),_0x4073dd['queue']);var _0x1e2cf0=_['countBy'](this['channels'],_0x5331('0x67'))[_0x4073dd['queue']]||0x0;var _0x59d586=_0x1e2cf0-_0x4073dd[_0x5331('0x6b')];if(this['voiceQueues'][_0x4073dd['queue']][_0x5331('0x36')]!==_[_0x5331('0x6c')](_0x4073dd[_0x5331('0x6b')])||this[_0x5331('0x16')][_0x4073dd[_0x5331('0x67')]][_0x5331('0x6d')]!==_['toNumber'](_0x4073dd[_0x5331('0x6e')])||this[_0x5331('0x16')][_0x4073dd[_0x5331('0x67')]]['available']!==_['toNumber'](_0x4073dd[_0x5331('0x52')])||this[_0x5331('0x16')][_0x4073dd[_0x5331('0x67')]]['talking']!==_0x59d586){this[_0x5331('0x16')][_0x4073dd[_0x5331('0x67')]][_0x5331('0x36')]=_[_0x5331('0x6c')](_0x4073dd[_0x5331('0x6b')]);this[_0x5331('0x16')][_0x4073dd[_0x5331('0x67')]]['loggedIn']=_[_0x5331('0x6c')](_0x4073dd['loggedin']);this['voiceQueues'][_0x4073dd['queue']][_0x5331('0x52')]=_[_0x5331('0x6c')](_0x4073dd[_0x5331('0x52')]);this['voiceQueues'][_0x4073dd[_0x5331('0x67')]][_0x5331('0x55')]=_0x59d586>0x0?_0x59d586:0x0;this[_0x5331('0x16')][_0x4073dd[_0x5331('0x67')]][_0x5331('0x55')]=this['voiceQueues'][_0x4073dd[_0x5331('0x67')]][_0x5331('0x55')]>_[_0x5331('0x6c')](_0x4073dd['loggedin'])?_[_0x5331('0x6c')](_0x4073dd[_0x5331('0x6e')]):this[_0x5331('0x16')][_0x4073dd[_0x5331('0x67')]]['talking'];this[_0x5331('0x6f')](this[_0x5331('0x16')][_0x4073dd[_0x5331('0x67')]],_0x5331('0x1a'));}logger['debug'](_0x5331('0x70'),util[_0x5331('0x40')](this[_0x5331('0x16')][_0x4073dd[_0x5331('0x67')]],{'showHidden':![],'depth':null}));ami[_0x5331('0x45')](_0x5331('0x71'),this[_0x5331('0x16')][_0x4073dd['queue']]);}}}catch(_0x5ad0e9){logger[_0x5331('0x3f')](_0x5331('0x66'),util['inspect'](_0x5ad0e9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x4d0b93){logger[_0x5331('0x46')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x5331('0x40')](_0x4d0b93,{'showHidden':![],'depth':null}));this[_0x5331('0x17')]=!![];};VoiceQueueReport[_0x5331('0xe')][_0x5331('0x20')]=function(_0x16f572){try{if(this['isNotNull'](_0x16f572)){logger[_0x5331('0x46')]('[%s][voiceQueueReport][queuecallerjoin]',_0x16f572[_0x5331('0x4d')],util[_0x5331('0x40')](_0x16f572,{'showHidden':![],'depth':null}));if(_[_0x5331('0x62')](this[_0x5331('0x12')][_0x16f572[_0x5331('0x4d')]])){this[_0x5331('0x12')][_0x16f572['uniqueid']]=[];this[_0x5331('0x14')][_0x16f572[_0x5331('0x4d')]]={};}var _0x3453b7=new QueueReport();_0x3453b7['name']=_0x16f572[_0x5331('0x67')];_0x3453b7[_0x5331('0x50')]=this[_0x5331('0x16')][_0x3453b7[_0x5331('0x49')]]&&this[_0x5331('0x16')][_0x3453b7[_0x5331('0x49')]][_0x5331('0x50')]?this[_0x5331('0x16')][_0x3453b7[_0x5331('0x49')]][_0x5331('0x50')]||'inbound':_0x5331('0x72');_0x3453b7[_0x5331('0x67')]=_0x16f572[_0x5331('0x67')];_0x3453b7[_0x5331('0x73')]=moment()[_0x5331('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x3453b7[_0x5331('0x74')]=_0x16f572[_0x5331('0x74')];_0x3453b7[_0x5331('0x75')]=_0x16f572['count'];_0x3453b7[_0x5331('0x4d')]=_0x16f572[_0x5331('0x4d')];logger[_0x5331('0x69')](_0x5331('0x76'),_0x3453b7[_0x5331('0x49')],_0x3453b7[_0x5331('0x50')]);_[_0x5331('0x77')](_0x3453b7,_[_0x5331('0x78')](_0x16f572,_['keys'](_0x3453b7)));this[_0x5331('0x12')][_0x16f572[_0x5331('0x4d')]]['push'](_0x3453b7);this[_0x5331('0x14')][_0x16f572[_0x5331('0x4d')]]=_0x3453b7;this[_0x5331('0x79')](_0x3453b7,_0x5331('0x1f'));}}catch(_0x25fad0){logger[_0x5331('0x3f')](_0x5331('0x7a'),_0x16f572[_0x5331('0x4d')],util[_0x5331('0x40')](_0x25fad0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5331('0xe')][_0x5331('0x22')]=function(_0x2f9de3){try{if(this['isNotNull'](_0x2f9de3)){logger[_0x5331('0x46')]('[%s][voiceQueueReport][queuecallerabandon]',_0x2f9de3[_0x5331('0x4d')],util[_0x5331('0x40')](_0x2f9de3,{'showHidden':![],'depth':null}));if(this[_0x5331('0x12')][_0x2f9de3[_0x5331('0x4d')]]){var _0x394a58=_[_0x5331('0x7b')](this[_0x5331('0x12')][_0x2f9de3[_0x5331('0x4d')]]);_0x394a58[_0x5331('0x7c')]=![];_0x394a58[_0x5331('0x7d')]=null;_0x394a58[_0x5331('0x7e')]=_0x2f9de3[_0x5331('0x7e')];_0x394a58['originalposition']=_0x2f9de3[_0x5331('0x7f')];_0x394a58[_0x5331('0x21')]=!![];_0x394a58[_0x5331('0x80')]=moment()[_0x5331('0x48')](_0x5331('0x81'));_0x394a58[_0x5331('0x82')]='ABANDONED';_0x394a58[_0x5331('0x83')]=null;logger[_0x5331('0x69')](_0x5331('0x84'),_0x394a58[_0x5331('0x49')],_0x394a58['type']);this['channels'][_0x2f9de3['uniqueid']]=_0x394a58;this[_0x5331('0x4b')](_0x394a58,_0x5331('0x21'));}}}catch(_0x46cf7d){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x2f9de3[_0x5331('0x4d')],util[_0x5331('0x40')](_0x46cf7d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5331('0xe')][_0x5331('0x85')]=function(_0x2df28f){try{if(this[_0x5331('0x61')](_0x2df28f)){logger[_0x5331('0x46')](_0x5331('0x86'),_0x2df28f[_0x5331('0x4d')],util['inspect'](_0x2df28f,{'showHidden':![],'depth':null}));if(this[_0x5331('0x12')][_0x2df28f['uniqueid']]){var _0x2a5d1b=_[_0x5331('0x7b')](this[_0x5331('0x12')][_0x2df28f[_0x5331('0x4d')]]);_0x2a5d1b[_0x5331('0x87')]=moment()[_0x5331('0x48')](_0x5331('0x81'));_0x2a5d1b[_0x5331('0x88')]=_0x2df28f[_0x5331('0x88')];_0x2a5d1b['connectedlinename']=_0x2df28f['connectedlinename'];logger[_0x5331('0x69')](_0x5331('0x89'),_0x2a5d1b[_0x5331('0x49')],_0x2a5d1b[_0x5331('0x50')],_0x2df28f[_0x5331('0x88')],_0x2df28f[_0x5331('0x8a')]);this[_0x5331('0x14')][_0x2df28f[_0x5331('0x4d')]]=_0x2a5d1b;this['emitVoiceQueueChannelSave'](_0x2a5d1b,_0x5331('0x23'));}}}catch(_0x3f0583){logger[_0x5331('0x3f')]('[%s][voiceQueueReport][queuecallerleave]',_0x2df28f[_0x5331('0x4d')],util[_0x5331('0x40')](_0x3f0583,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5331('0xe')]['syncAgentConnect']=function(_0x2bc972){try{if(this[_0x5331('0x61')](_0x2bc972)){logger[_0x5331('0x46')]('[%s][voiceQueueReport][agentconnect]',_0x2bc972[_0x5331('0x4d')],util[_0x5331('0x40')](_0x2bc972,{'showHidden':![],'depth':null}));if(this[_0x5331('0x12')][_0x2bc972['uniqueid']]){var _0x4998b2=_[_0x5331('0x7b')](this[_0x5331('0x12')][_0x2bc972['uniqueid']]);_0x4998b2[_0x5331('0x7c')]=!![];_0x4998b2['queuecallerexitreason']=_0x5331('0x8b');logger['info'](_0x5331('0x8c'),_0x4998b2['name'],_0x4998b2[_0x5331('0x50')]);}}}catch(_0x3885fe){logger[_0x5331('0x3f')](_0x5331('0x8d'),_0x2bc972[_0x5331('0x4d')],util[_0x5331('0x40')](_0x3885fe,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5331('0xe')]['syncAgentComplete']=function(_0x2d1082){try{if(this[_0x5331('0x61')](_0x2d1082)){logger[_0x5331('0x46')](_0x5331('0x8e'),_0x2d1082[_0x5331('0x4d')],util[_0x5331('0x40')](_0x2d1082,{'showHidden':![],'depth':null}));if(this[_0x5331('0x12')][_0x2d1082[_0x5331('0x4d')]]){var _0x3e470b=_[_0x5331('0x7b')](this['queueReports'][_0x2d1082['uniqueid']]);_0x3e470b[_0x5331('0x21')]=![];_0x3e470b['queuecallerabandonAt']=null;_0x3e470b[_0x5331('0x8f')]=!![];_0x3e470b[_0x5331('0x83')]=_0x2d1082[_0x5331('0x90')];_0x3e470b[_0x5331('0x7e')]=_0x2d1082[_0x5331('0x7e')];_0x3e470b[_0x5331('0x7c')]=!![];_0x3e470b['queuecallerexit']=![];_0x3e470b[_0x5331('0x91')]=null;if(!_0x3e470b[_0x5331('0x92')]){if(_0x2d1082[_0x5331('0x93')]==_0x5331('0x92')){_0x3e470b[_0x5331('0x82')]=_0x5331('0x94');logger[_0x5331('0x69')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x3e470b[_0x5331('0x49')],_0x3e470b[_0x5331('0x50')]);}else{if(_['startsWith'](_0x2d1082['channel']['toLowerCase'](),_0x5331('0x95'))){if(this['queueReports'][_0x2d1082[_0x5331('0x96')]]){var _0x3a99d2=_['last'](this['queueReports'][_0x2d1082[_0x5331('0x96')]]);_0x3a99d2[_0x5331('0x7c')]=![];_0x3a99d2[_0x5331('0x97')]=!![];_0x3a99d2[_0x5331('0x91')]=moment(_0x3e470b[_0x5331('0x73')])['add'](_0x2d1082[_0x5331('0x7e')],_0x5331('0x98'))['format'](_0x5331('0x81'));_0x3a99d2[_0x5331('0x82')]=_0x5331('0x99');_0x3a99d2[_0x5331('0x92')]=!![];_0x3a99d2[_0x5331('0x9a')]=_0x5331('0x9b');_0x3a99d2['transferexten']=_0x2d1082['destexten'];_0x3a99d2[_0x5331('0x9c')]=_0x2d1082[_0x5331('0x4d')];logger[_0x5331('0x69')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x3a99d2[_0x5331('0x49')],_0x3a99d2[_0x5331('0x50')]);var _0x3b69e6=this[_0x5331('0x12')][_0x2d1082[_0x5331('0x96')]];this[_0x5331('0x12')][_0x2d1082['linkedid']]=this['queueReports'][_0x2d1082['uniqueid']];this[_0x5331('0x12')][_0x2d1082['uniqueid']]=_0x3b69e6;}}else{_0x3e470b[_0x5331('0x82')]='COMPLETEDBY'+_0x2d1082[_0x5331('0x93')]['toUpperCase']();logger[_0x5331('0x69')](_0x5331('0x9d'),_0x3e470b[_0x5331('0x49')],_0x3e470b[_0x5331('0x50')],_0x3e470b[_0x5331('0x82')]);}}}this[_0x5331('0x14')][_0x2d1082[_0x5331('0x4d')]]=_0x3e470b;this[_0x5331('0x4b')](_0x3e470b,'agentcomplete');}}}catch(_0x3d696a){logger['error']('[%s][voiceQueueReport][agentcomplete]',_0x2d1082[_0x5331('0x4d')],util[_0x5331('0x40')](_0x3d696a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5331('0xe')]['syncVarSet']=function(_0x3092fe){try{if(this['isNotNull'](_0x3092fe)){logger[_0x5331('0x46')](_0x5331('0x9e'),_0x3092fe[_0x5331('0x4d')],util[_0x5331('0x40')](_0x3092fe,{'showHidden':![],'depth':null}));this[_0x5331('0x9f')](_0x3092fe[_0x5331('0x4d')],_['keys'](_0x3092fe['variable'])[0x0],_0x3092fe[_0x5331('0xa0')]);if(this[_0x5331('0x12')][_0x3092fe[_0x5331('0x4d')]]){var _0x4796b7=_[_0x5331('0x7b')](this[_0x5331('0x12')][_0x3092fe[_0x5331('0x4d')]]);if(_0x4796b7){if(this[_0x5331('0x61')](_0x3092fe[_0x5331('0xa1')])&&this['isNotNull'](_0x3092fe[_0x5331('0xa1')]['queuestatus'])){switch(_0x3092fe[_0x5331('0xa0')]){case _0x5331('0xa2'):_0x4796b7[_0x5331('0x97')]=![];_0x4796b7[_0x5331('0x91')]=null;break;case _0x5331('0xa3'):_0x4796b7[_0x5331('0xa4')]='timeout';_0x4796b7[_0x5331('0x97')]=!![];_0x4796b7['queuecallerexitAt']=moment()[_0x5331('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x4796b7['queuecallerleaveAt']=moment()[_0x5331('0x48')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x5331('0x46')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x3092fe[_0x5331('0x4d')],util[_0x5331('0x40')](_0x4796b7,{'showHidden':![],'depth':null}));ami[_0x5331('0x45')]('custom:timeout',_0x4796b7);break;default:_0x4796b7[_0x5331('0x97')]=!![];_0x4796b7[_0x5331('0x91')]=moment()[_0x5331('0x48')](_0x5331('0x81'));_0x4796b7[_0x5331('0x87')]=moment()[_0x5331('0x48')](_0x5331('0x81'));}_0x4796b7[_0x5331('0x21')]=![];_0x4796b7[_0x5331('0x80')]=null;_0x4796b7[_0x5331('0x82')]=_0x3092fe[_0x5331('0xa0')];this[_0x5331('0x14')][_0x3092fe[_0x5331('0x4d')]]=_0x4796b7;this[_0x5331('0x4b')](_0x4796b7,_0x5331('0x27'));}else if(this[_0x5331('0x61')](_0x3092fe[_0x5331('0xa1')])&&this['isNotNull'](_0x3092fe['variable']['queueposition'])){if(!_0x4796b7[_0x5331('0x21')]){_0x4796b7['queuecallerexit']=!![];_0x4796b7[_0x5331('0x91')]=moment()['format'](_0x5331('0x81'));_0x4796b7[_0x5331('0x82')]=_0x5331('0xa5');_0x4796b7[_0x5331('0x87')]=moment()[_0x5331('0x48')](_0x5331('0x81'));this[_0x5331('0x14')][_0x3092fe['uniqueid']]=_0x4796b7;}}logger[_0x5331('0x69')](_0x5331('0xa6'),_0x3092fe['uniqueid'],_0x4796b7[_0x5331('0x49')],_0x4796b7[_0x5331('0x50')],_[_0x5331('0xa7')](_0x3092fe[_0x5331('0xa1')])[0x0],_0x3092fe[_0x5331('0xa0')]);_0x4796b7[_0x5331('0x19')]=this[_0x5331('0x19')][_0x3092fe[_0x5331('0x4d')]];}}}}catch(_0x122a03){logger[_0x5331('0x3f')]('[%s][voiceQueueReport][varset]',_0x3092fe[_0x5331('0x4d')],util[_0x5331('0x40')](_0x122a03,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5331('0xe')][_0x5331('0x9f')]=function(_0x91f95,_0x23a6d1,_0x5b3454){var _0x28adcd=[_0x5331('0xa8'),_0x5331('0xa9'),_0x5331('0xaa'),_0x5331('0xab'),_0x5331('0xac'),_0x5331('0xad'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x5331('0xae'),_0x5331('0xaf'),_0x5331('0xb0'),_0x5331('0xb1'),'membercalls',_0x5331('0xb2'),_0x5331('0xb3'),_0x5331('0xb4'),_0x5331('0x90'),'memberpenalty',_0x5331('0xb5')];if(!_[_0x5331('0x3a')](_0x23a6d1)&&!_[_0x5331('0xb6')](_0x28adcd,_0x23a6d1)){if(_[_0x5331('0x62')](this['variables'][_0x91f95])){this[_0x5331('0x19')][_0x91f95]={};}this[_0x5331('0x19')][_0x91f95][_0x23a6d1]=_0x5b3454;}};VoiceQueueReport[_0x5331('0xe')][_0x5331('0x29')]=function(_0x2d198a){try{if(this[_0x5331('0x61')](_0x2d198a)){logger['debug'](_0x5331('0xb7'),_0x2d198a[_0x5331('0x4d')],util[_0x5331('0x40')](_0x2d198a,{'showHidden':![],'depth':null}));if(this[_0x5331('0x12')][_0x2d198a[_0x5331('0x4d')]]){for(var _0x2690d6=0x0,_0x4d5695={};_0x2690d60x0?_0xb9bf27:0x0;this[_0x6d48('0x12')][_0x5acf98['queue']][_0x6d48('0x34')]=this[_0x6d48('0x12')][_0x5acf98['queue']][_0x6d48('0x34')]>_[_0x6d48('0x6d')](_0x5acf98[_0x6d48('0x6e')])?_[_0x6d48('0x6d')](_0x5acf98[_0x6d48('0x6e')]):this[_0x6d48('0x12')][_0x5acf98['queue']][_0x6d48('0x34')];this[_0x6d48('0x54')](this[_0x6d48('0x12')][_0x5acf98[_0x6d48('0x68')]],_0x6d48('0x6f'));}logger[_0x6d48('0x4b')](_0x6d48('0x70'),util[_0x6d48('0x43')](this[_0x6d48('0x12')][_0x5acf98['queue']],{'showHidden':![],'depth':null}));ami['emit'](_0x6d48('0x71'),this[_0x6d48('0x12')][_0x5acf98[_0x6d48('0x68')]]);}}}catch(_0x527357){logger['error']('[voiceQueueReport][queuesummary]',util[_0x6d48('0x43')](_0x527357,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6d48('0x39')][_0x6d48('0x17')]=function(_0x5ec99d){logger['debug'](_0x6d48('0x72'),util[_0x6d48('0x43')](_0x5ec99d,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0x6d48('0x39')]['syncQueueCallerJoin']=function(_0x36cd58){try{if(this['isNotNull'](_0x36cd58)){logger[_0x6d48('0x4b')](_0x6d48('0x73'),_0x36cd58[_0x6d48('0x4d')],util[_0x6d48('0x43')](_0x36cd58,{'showHidden':![],'depth':null}));if(_[_0x6d48('0x63')](this['queueReports'][_0x36cd58['uniqueid']])){this['queueReports'][_0x36cd58[_0x6d48('0x4d')]]=[];this['channels'][_0x36cd58[_0x6d48('0x4d')]]={};}var _0x4c934c=new QueueReport();_0x4c934c[_0x6d48('0x53')]=_0x36cd58[_0x6d48('0x68')];_0x4c934c['type']=this['voiceQueues'][_0x4c934c[_0x6d48('0x53')]]&&this['voiceQueues'][_0x4c934c['name']][_0x6d48('0x5c')]?this[_0x6d48('0x12')][_0x4c934c[_0x6d48('0x53')]][_0x6d48('0x5c')]||_0x6d48('0x74'):_0x6d48('0x74');_0x4c934c[_0x6d48('0x68')]=_0x36cd58['queue'];_0x4c934c['queuecallerjoinAt']=moment()[_0x6d48('0x4e')](_0x6d48('0x75'));_0x4c934c['position']=_0x36cd58['position'];_0x4c934c[_0x6d48('0x76')]=_0x36cd58[_0x6d48('0x76')];_0x4c934c[_0x6d48('0x4d')]=_0x36cd58[_0x6d48('0x4d')];logger['info'](_0x6d48('0x77'),_0x4c934c[_0x6d48('0x53')],_0x4c934c[_0x6d48('0x5c')]);_[_0x6d48('0x78')](_0x4c934c,_[_0x6d48('0x79')](_0x36cd58,_[_0x6d48('0x7a')](_0x4c934c)));this[_0x6d48('0xe')][_0x36cd58[_0x6d48('0x4d')]][_0x6d48('0x7b')](_0x4c934c);this[_0x6d48('0x10')][_0x36cd58[_0x6d48('0x4d')]]=_0x4c934c;this[_0x6d48('0x7c')](_0x4c934c,'queuecallerjoin');}}catch(_0x1353a5){logger[_0x6d48('0x41')]('[%s][voiceQueueReport][queuecallerjoin]',_0x36cd58['uniqueid'],util[_0x6d48('0x43')](_0x1353a5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6d48('0x39')][_0x6d48('0x1c')]=function(_0x136358){try{if(this[_0x6d48('0x67')](_0x136358)){logger[_0x6d48('0x4b')]('[%s][voiceQueueReport][queuecallerabandon]',_0x136358[_0x6d48('0x4d')],util[_0x6d48('0x43')](_0x136358,{'showHidden':![],'depth':null}));if(this[_0x6d48('0xe')][_0x136358[_0x6d48('0x4d')]]){var _0x117b2b=_[_0x6d48('0x7d')](this[_0x6d48('0xe')][_0x136358[_0x6d48('0x4d')]]);_0x117b2b[_0x6d48('0x7e')]=![];_0x117b2b[_0x6d48('0x7f')]=null;_0x117b2b['holdtime']=_0x136358[_0x6d48('0x80')];_0x117b2b['originalposition']=_0x136358[_0x6d48('0x81')];_0x117b2b[_0x6d48('0x1b')]=!![];_0x117b2b[_0x6d48('0x82')]=moment()[_0x6d48('0x4e')](_0x6d48('0x75'));_0x117b2b[_0x6d48('0x83')]=_0x6d48('0x84');_0x117b2b[_0x6d48('0x85')]=null;logger[_0x6d48('0x86')](_0x6d48('0x87'),_0x117b2b[_0x6d48('0x53')],_0x117b2b[_0x6d48('0x5c')]);this['channels'][_0x136358[_0x6d48('0x4d')]]=_0x117b2b;this[_0x6d48('0x51')](_0x117b2b,_0x6d48('0x1b'));}}}catch(_0x12cf88){logger[_0x6d48('0x41')](_0x6d48('0x88'),_0x136358[_0x6d48('0x4d')],util[_0x6d48('0x43')](_0x12cf88,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6d48('0x39')][_0x6d48('0x1e')]=function(_0x1e4e4f){try{if(this[_0x6d48('0x67')](_0x1e4e4f)){logger[_0x6d48('0x4b')]('[%s][voiceQueueReport][queuecallerleave]',_0x1e4e4f[_0x6d48('0x4d')],util[_0x6d48('0x43')](_0x1e4e4f,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1e4e4f[_0x6d48('0x4d')]]){var _0x3bff43=_[_0x6d48('0x7d')](this['queueReports'][_0x1e4e4f[_0x6d48('0x4d')]]);_0x3bff43[_0x6d48('0x89')]=moment()[_0x6d48('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x3bff43['connectedlinenum']=_0x1e4e4f['connectedlinenum'];_0x3bff43[_0x6d48('0x8a')]=_0x1e4e4f[_0x6d48('0x8a')];logger[_0x6d48('0x86')](_0x6d48('0x8b'),_0x3bff43[_0x6d48('0x53')],_0x3bff43[_0x6d48('0x5c')],_0x1e4e4f[_0x6d48('0x8c')],_0x1e4e4f[_0x6d48('0x8a')]);this[_0x6d48('0x10')][_0x1e4e4f[_0x6d48('0x4d')]]=_0x3bff43;this[_0x6d48('0x7c')](_0x3bff43,'queuecallerleave');}}}catch(_0x500078){logger[_0x6d48('0x41')](_0x6d48('0x8d'),_0x1e4e4f[_0x6d48('0x4d')],util[_0x6d48('0x43')](_0x500078,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6d48('0x39')]['syncAgentConnect']=function(_0x363fed){try{if(this['isNotNull'](_0x363fed)){logger['debug'](_0x6d48('0x8e'),_0x363fed['uniqueid'],util[_0x6d48('0x43')](_0x363fed,{'showHidden':![],'depth':null}));if(this[_0x6d48('0xe')][_0x363fed['uniqueid']]){var _0x1e8b79=_[_0x6d48('0x7d')](this[_0x6d48('0xe')][_0x363fed[_0x6d48('0x4d')]]);_0x1e8b79[_0x6d48('0x7e')]=!![];_0x1e8b79[_0x6d48('0x83')]='COMPLETEDBYAGENT';logger[_0x6d48('0x86')](_0x6d48('0x8f'),_0x1e8b79[_0x6d48('0x53')],_0x1e8b79[_0x6d48('0x5c')]);}}}catch(_0x48fc51){logger[_0x6d48('0x41')](_0x6d48('0x8e'),_0x363fed[_0x6d48('0x4d')],util[_0x6d48('0x43')](_0x48fc51,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6d48('0x39')][_0x6d48('0x20')]=function(_0x1d2dc5){try{if(this[_0x6d48('0x67')](_0x1d2dc5)){logger['debug'](_0x6d48('0x90'),_0x1d2dc5[_0x6d48('0x4d')],util[_0x6d48('0x43')](_0x1d2dc5,{'showHidden':![],'depth':null}));if(this[_0x6d48('0xe')][_0x1d2dc5[_0x6d48('0x4d')]]){var _0x50ce9a=_[_0x6d48('0x7d')](this[_0x6d48('0xe')][_0x1d2dc5[_0x6d48('0x4d')]]);_0x50ce9a[_0x6d48('0x1b')]=![];_0x50ce9a[_0x6d48('0x82')]=null;_0x50ce9a[_0x6d48('0x91')]=!![];_0x50ce9a['lastAssignedTo']=_0x1d2dc5[_0x6d48('0x92')];_0x50ce9a['holdtime']=_0x1d2dc5[_0x6d48('0x80')];_0x50ce9a[_0x6d48('0x7e')]=!![];_0x50ce9a[_0x6d48('0x93')]=![];_0x50ce9a['queuecallerexitAt']=null;if(!_0x50ce9a['transfer']){if(_0x1d2dc5[_0x6d48('0x94')]==_0x6d48('0x95')){_0x50ce9a[_0x6d48('0x83')]=_0x6d48('0x96');logger[_0x6d48('0x86')](_0x6d48('0x97'),_0x50ce9a[_0x6d48('0x53')],_0x50ce9a[_0x6d48('0x5c')]);}else{if(_[_0x6d48('0x98')](_0x1d2dc5['channel']['toLowerCase'](),_0x6d48('0x99'))){if(this[_0x6d48('0xe')][_0x1d2dc5['linkedid']]){var _0xf3440b=_[_0x6d48('0x7d')](this[_0x6d48('0xe')][_0x1d2dc5[_0x6d48('0x9a')]]);_0xf3440b[_0x6d48('0x7e')]=![];_0xf3440b[_0x6d48('0x93')]=!![];_0xf3440b[_0x6d48('0x9b')]=moment(_0x50ce9a[_0x6d48('0x9c')])[_0x6d48('0x9d')](_0x1d2dc5[_0x6d48('0x80')],'seconds')[_0x6d48('0x4e')](_0x6d48('0x75'));_0xf3440b['queuecallerexitreason']=_0x6d48('0x9e');_0xf3440b[_0x6d48('0x95')]=!![];_0xf3440b[_0x6d48('0x9f')]=_0x6d48('0xa0');_0xf3440b[_0x6d48('0xa1')]=_0x1d2dc5[_0x6d48('0xa2')];_0xf3440b[_0x6d48('0xa3')]=_0x1d2dc5[_0x6d48('0x4d')];logger[_0x6d48('0x86')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0xf3440b[_0x6d48('0x53')],_0xf3440b['type']);var _0x35dbf2=this[_0x6d48('0xe')][_0x1d2dc5[_0x6d48('0x9a')]];this[_0x6d48('0xe')][_0x1d2dc5['linkedid']]=this[_0x6d48('0xe')][_0x1d2dc5[_0x6d48('0x4d')]];this['queueReports'][_0x1d2dc5[_0x6d48('0x4d')]]=_0x35dbf2;}}else{_0x50ce9a[_0x6d48('0x83')]='COMPLETEDBY'+_0x1d2dc5[_0x6d48('0x94')][_0x6d48('0xa4')]();logger[_0x6d48('0x86')](_0x6d48('0xa5'),_0x50ce9a['name'],_0x50ce9a[_0x6d48('0x5c')],_0x50ce9a[_0x6d48('0x83')]);}}}this[_0x6d48('0x10')][_0x1d2dc5[_0x6d48('0x4d')]]=_0x50ce9a;this['emitVoiceQueueChannelRemove'](_0x50ce9a,_0x6d48('0x1f'));}}}catch(_0x41cd92){logger[_0x6d48('0x41')]('[%s][voiceQueueReport][agentcomplete]',_0x1d2dc5['uniqueid'],util[_0x6d48('0x43')](_0x41cd92,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6d48('0x39')][_0x6d48('0x23')]=function(_0x253925){try{if(this['isNotNull'](_0x253925)){logger[_0x6d48('0x4b')](_0x6d48('0xa6'),_0x253925[_0x6d48('0x4d')],util['inspect'](_0x253925,{'showHidden':![],'depth':null}));this[_0x6d48('0xa7')](_0x253925[_0x6d48('0x4d')],_[_0x6d48('0x7a')](_0x253925[_0x6d48('0xa8')])[0x0],_0x253925[_0x6d48('0xa9')]);if(this[_0x6d48('0xe')][_0x253925[_0x6d48('0x4d')]]){var _0x551938=_[_0x6d48('0x7d')](this[_0x6d48('0xe')][_0x253925['uniqueid']]);if(_0x551938){if(this['isNotNull'](_0x253925[_0x6d48('0xa8')])&&this[_0x6d48('0x67')](_0x253925['variable'][_0x6d48('0xaa')])){switch(_0x253925[_0x6d48('0xa9')]){case _0x6d48('0xab'):_0x551938[_0x6d48('0x93')]=![];_0x551938[_0x6d48('0x9b')]=null;break;case _0x6d48('0xac'):_0x551938[_0x6d48('0xad')]=_0x6d48('0xae');_0x551938['queuecallerexit']=!![];_0x551938[_0x6d48('0x9b')]=moment()[_0x6d48('0x4e')](_0x6d48('0x75'));_0x551938[_0x6d48('0x89')]=moment()[_0x6d48('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x6d48('0x4b')](_0x6d48('0xaf'),_0x253925[_0x6d48('0x4d')],util[_0x6d48('0x43')](_0x551938,{'showHidden':![],'depth':null}));ami[_0x6d48('0x4a')]('custom:timeout',_0x551938);break;default:_0x551938[_0x6d48('0x93')]=!![];_0x551938[_0x6d48('0x9b')]=moment()[_0x6d48('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x551938[_0x6d48('0x89')]=moment()[_0x6d48('0x4e')](_0x6d48('0x75'));}_0x551938['queuecallerabandon']=![];_0x551938[_0x6d48('0x82')]=null;_0x551938[_0x6d48('0x83')]=_0x253925[_0x6d48('0xa9')];this[_0x6d48('0x10')][_0x253925[_0x6d48('0x4d')]]=_0x551938;this['emitVoiceQueueChannelRemove'](_0x551938,_0x6d48('0x22'));}else if(this[_0x6d48('0x67')](_0x253925['variable'])&&this[_0x6d48('0x67')](_0x253925[_0x6d48('0xa8')][_0x6d48('0xb0')])){if(!_0x551938[_0x6d48('0x1b')]){_0x551938[_0x6d48('0x93')]=!![];_0x551938['queuecallerexitAt']=moment()[_0x6d48('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x551938[_0x6d48('0x83')]='EXITWITHKEY';_0x551938[_0x6d48('0x89')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x253925[_0x6d48('0x4d')]]=_0x551938;}}logger['info'](_0x6d48('0xb1'),_0x253925[_0x6d48('0x4d')],_0x551938[_0x6d48('0x53')],_0x551938['type'],_[_0x6d48('0x7a')](_0x253925[_0x6d48('0xa8')])[0x0],_0x253925[_0x6d48('0xa9')]);_0x551938[_0x6d48('0x45')]=this['variables'][_0x253925['uniqueid']];}}}}catch(_0x24556f){logger['error'](_0x6d48('0xa6'),_0x253925[_0x6d48('0x4d')],util['inspect'](_0x24556f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6d48('0x39')][_0x6d48('0xa7')]=function(_0x1aefe4,_0x1f0272,_0x4961fe){var _0x375ef3=[_0x6d48('0xb2'),'rtpaudioqosbridged',_0x6d48('0xb3'),_0x6d48('0xb4'),_0x6d48('0xb5'),_0x6d48('0xb6'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x6d48('0xb7'),_0x6d48('0xb8'),'bridgepeer','bridgepvtcallid',_0x6d48('0xb9'),'memberdynamic',_0x6d48('0xba'),'memberlastcall','membername',_0x6d48('0xbb'),_0x6d48('0xbc')];if(!_['isNil'](_0x1f0272)&&!_[_0x6d48('0xbd')](_0x375ef3,_0x1f0272)){if(_[_0x6d48('0x63')](this[_0x6d48('0x45')][_0x1aefe4])){this[_0x6d48('0x45')][_0x1aefe4]={};}this[_0x6d48('0x45')][_0x1aefe4][_0x1f0272]=_0x4961fe;}};VoiceQueueReport[_0x6d48('0x39')]['syncHangup']=function(_0x5f4632){try{if(this[_0x6d48('0x67')](_0x5f4632)){logger['debug'](_0x6d48('0xbe'),_0x5f4632[_0x6d48('0x4d')],util['inspect'](_0x5f4632,{'showHidden':![],'depth':null}));if(this[_0x6d48('0xe')][_0x5f4632[_0x6d48('0x4d')]]){for(var _0x534580=0x0,_0x5a6745={};_0x534580=0x0?moment(_0x61809b[_0xab93('0x1b')])[_0xab93('0xc')](_0x61809b[_0xab93('0x1a')],_0xab93('0xe')):null,'data1':'outbound','data2':_0x61809b['accountcode'],'data3':_0x61809b[_0xab93('0x10')],'data4':_0x61809b[_0xab93('0x1c')]||null,'role':_0xab93('0x12'),'internal':_0x61809b[_0xab93('0x13')]?_[_0xab93('0x14')](_0x61809b[_0xab93('0x13')]):undefined,'uniqueid':_0x61809b[_0xab93('0x15')]},'log':_0xab93('0x16')});}; \ No newline at end of file +var _0x0d90=['seconds','exten','dialstring','moment','lodash','util','../client','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','isNil','interface','SIP/%s','queuecallerleaveAt','diff','inbound','calleridnum','agent','accountcode','toNumber','uniqueid','membername','TALKING','endtime'];(function(_0x288377,_0x4f9be5){var _0x5a76c2=function(_0x1ae2d7){while(--_0x1ae2d7){_0x288377['push'](_0x288377['shift']());}};_0x5a76c2(++_0x4f9be5);}(_0x0d90,0x155));var _0x00d9=function(_0x1f3f80,_0x353b8f){_0x1f3f80=_0x1f3f80-0x0;var _0x525335=_0x0d90[_0x1f3f80];return _0x525335;};'use strict';var moment=require(_0x00d9('0x0'));var _=require(_0x00d9('0x1'));var util=require(_0x00d9('0x2'));var client=require(_0x00d9('0x3'));exports['voiceQueueReport']=function(_0x8d75da){var _0x3facfd=_0x8d75da[_0x00d9('0x4')]||_0x8d75da[_0x00d9('0x5')];return client[_0x00d9('0x6')](_0x00d9('0x7'),{'body':{'channel':_0x00d9('0x8'),'membername':_0x8d75da['lastAssignedTo'],'interface':_[_0x00d9('0x9')](_0x8d75da[_0x00d9('0xa')])?util['format'](_0x00d9('0xb'),_0x8d75da['lastAssignedTo']):_0x8d75da[_0x00d9('0xa')],'type':'TALKING','enterAt':_0x8d75da[_0x00d9('0xc')],'exitAt':_0x3facfd,'duration':moment(_0x3facfd)[_0x00d9('0xd')](_0x8d75da[_0x00d9('0xc')],'seconds'),'data1':_0x00d9('0xe'),'data2':_0x8d75da[_0x00d9('0xf')],'data3':_0x8d75da['exten'],'data4':null,'data5':_0x8d75da['queue'],'role':_0x00d9('0x10'),'internal':_0x8d75da[_0x00d9('0x11')]?_[_0x00d9('0x12')](_0x8d75da[_0x00d9('0x11')]):undefined,'uniqueid':_0x8d75da[_0x00d9('0x13')]},'log':_0x00d9('0x7')});};exports['voiceDialReport']=function(_0x254f14){return client[_0x00d9('0x6')](_0x00d9('0x7'),{'body':{'channel':_0x00d9('0x8'),'membername':_0x254f14[_0x00d9('0x14')],'interface':_0x254f14['interface'],'type':_0x00d9('0x15'),'enterAt':_0x254f14['starttime'],'exitAt':_0x254f14['endtime'],'duration':moment(_0x254f14[_0x00d9('0x16')])['diff'](_0x254f14['starttime'],_0x00d9('0x17'))>=0x0?moment(_0x254f14[_0x00d9('0x16')])[_0x00d9('0xd')](_0x254f14['starttime'],_0x00d9('0x17')):null,'data1':'outbound','data2':_0x254f14['accountcode'],'data3':_0x254f14[_0x00d9('0x18')],'data4':_0x254f14[_0x00d9('0x19')]||null,'role':_0x00d9('0x10'),'internal':_0x254f14[_0x00d9('0x11')]?_[_0x00d9('0x12')](_0x254f14['accountcode']):undefined,'uniqueid':_0x254f14[_0x00d9('0x13')]},'log':_0x00d9('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index b1ea1f1..09f7775 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 _0xb4e6=['../client','Request','GetTemplate','name','html'];(function(_0x29af73,_0x5634fd){var _0x132295=function(_0x5d5f8d){while(--_0x5d5f8d){_0x29af73['push'](_0x29af73['shift']());}};_0x132295(++_0x5634fd);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x59dccc,_0x184c1c){_0x59dccc=_0x59dccc-0x0;var _0xc97bcb=_0xb4e6[_0x59dccc];return _0xc97bcb;};'use strict';var client=require(_0x6b4e('0x0'));exports['getTemplates']=function(_0x2708ca){return function(_0x1afd20){return client[_0x6b4e('0x1')](_0x6b4e('0x2'),{'options':{'raw':!![],'attributes':['id',_0x6b4e('0x3'),_0x6b4e('0x4')]},'log':_0x6b4e('0x2')});};}; \ No newline at end of file +var _0x57f8=['GetTemplate','name','html','getTemplates','Request'];(function(_0x414bcd,_0x5e88b5){var _0x9ca809=function(_0x2ec505){while(--_0x2ec505){_0x414bcd['push'](_0x414bcd['shift']());}};_0x9ca809(++_0x5e88b5);}(_0x57f8,0x198));var _0x857f=function(_0x17d713,_0x19b690){_0x17d713=_0x17d713-0x0;var _0x452666=_0x57f8[_0x17d713];return _0x452666;};'use strict';var client=require('../client');exports[_0x857f('0x0')]=function(_0x57a538){return function(_0x1e6e52){return client[_0x857f('0x1')](_0x857f('0x2'),{'options':{'raw':!![],'attributes':['id',_0x857f('0x3'),_0x857f('0x4')]},'log':_0x857f('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 7eac6b8..f2bb6dd 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 _0x8d6e=['GetTrigger','getTriggers','Request','channel','status','Condition','AllConditions','operator','value','AnyConditions','Action','Actions','data1','data3','data4','data5','data7'];(function(_0x21fd6c,_0x4f9620){var _0x4ca2ae=function(_0x47b1b7){while(--_0x47b1b7){_0x21fd6c['push'](_0x21fd6c['shift']());}};_0x4ca2ae(++_0x4f9620);}(_0x8d6e,0x188));var _0xe8d6=function(_0xd82c5c,_0x274116){_0xd82c5c=_0xd82c5c-0x0;var _0x5a9e19=_0x8d6e[_0xd82c5c];return _0x5a9e19;};'use strict';var client=require('../client');exports[_0xe8d6('0x0')]=function(_0x338c78){return function(_0x6fc26f){return client[_0xe8d6('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0xe8d6('0x2'),_0xe8d6('0x3')],'include':[{'model':_0xe8d6('0x4'),'as':_0xe8d6('0x5'),'attributes':['id','field',_0xe8d6('0x6'),_0xe8d6('0x7')]},{'model':_0xe8d6('0x4'),'as':_0xe8d6('0x8'),'attributes':['id','field',_0xe8d6('0x6'),_0xe8d6('0x7')]},{'model':_0xe8d6('0x9'),'as':_0xe8d6('0xa'),'attributes':['id','action',_0xe8d6('0xb'),'data2',_0xe8d6('0xc'),_0xe8d6('0xd'),_0xe8d6('0xe'),'data6',_0xe8d6('0xf')]}]},'log':_0xe8d6('0x10')});};}; \ No newline at end of file +var _0x4b4e=['operator','value','AnyConditions','Action','Actions','action','data2','data3','data4','data5','getTriggers','Request','GetTrigger','name','channel','Condition','field'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0x4b4e,0x81));var _0xe4b4=function(_0x486d9a,_0x34e400){_0x486d9a=_0x486d9a-0x0;var _0x46f0be=_0x4b4e[_0x486d9a];return _0x46f0be;};'use strict';var client=require('../client');exports[_0xe4b4('0x0')]=function(_0x4e1ff6){return function(_0x58ed52){return client[_0xe4b4('0x1')](_0xe4b4('0x2'),{'options':{'raw':![],'attributes':['id',_0xe4b4('0x3'),_0xe4b4('0x4'),'status'],'include':[{'model':_0xe4b4('0x5'),'as':'AllConditions','attributes':['id',_0xe4b4('0x6'),_0xe4b4('0x7'),_0xe4b4('0x8')]},{'model':_0xe4b4('0x5'),'as':_0xe4b4('0x9'),'attributes':['id',_0xe4b4('0x6'),'operator','value']},{'model':_0xe4b4('0xa'),'as':_0xe4b4('0xb'),'attributes':['id',_0xe4b4('0xc'),'data1',_0xe4b4('0xd'),_0xe4b4('0xe'),_0xe4b4('0xf'),_0xe4b4('0x10'),'data6','data7']}]},'log':_0xe4b4('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 11e9207..7ad714c 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 _0x90f6=['name','../client','GetTrunk'];(function(_0xdfdbbf,_0x475c86){var _0x5debb3=function(_0x397deb){while(--_0x397deb){_0xdfdbbf['push'](_0xdfdbbf['shift']());}};_0x5debb3(++_0x475c86);}(_0x90f6,0xc1));var _0x690f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x90f6[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x690f('0x0'));exports['getTrunks']=function(_0xd05141){return function(_0x60a5c9){return client['Request'](_0x690f('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x690f('0x2'),'registry']},'log':_0x690f('0x1')});};}; \ No newline at end of file +var _0xb3a0=['GetTrunk','name','registry'];(function(_0x215499,_0xc2ac8b){var _0x4724d2=function(_0x3b66d7){while(--_0x3b66d7){_0x215499['push'](_0x215499['shift']());}};_0x4724d2(++_0xc2ac8b);}(_0xb3a0,0xa3));var _0x0b3a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb3a0[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x37304c){return function(_0x2b4589){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x0b3a('0x0'),_0x0b3a('0x1')]},'log':_0x0b3a('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index d1e6830..a413c38 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 _0x62c9=['Request','name','email','fullname','lastLoginAt','lastPauseAt','voicePause','phone','interface','getTelephones','GetUser','telephone','accountcode','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','online','../client','getAgents'];(function(_0x586c29,_0x5ca941){var _0x5d0e2e=function(_0x1d4226){while(--_0x1d4226){_0x586c29['push'](_0x586c29['shift']());}};_0x5d0e2e(++_0x5ca941);}(_0x62c9,0x15e));var _0x962c=function(_0x46dee2,_0x1eab2e){_0x46dee2=_0x46dee2-0x0;var _0x268d1c=_0x62c9[_0x46dee2];return _0x268d1c;};'use strict';var client=require(_0x962c('0x0'));exports[_0x962c('0x1')]=function(){return function(){return client[_0x962c('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x962c('0x3'),_0x962c('0x4'),'accountcode',_0x962c('0x5'),'online',_0x962c('0x6'),'pauseType',_0x962c('0x7'),_0x962c('0x8'),_0x962c('0x9'),'mobile',_0x962c('0xa')]},'log':'getAgents'});};};exports[_0x962c('0xb')]=function(){return function(){return client[_0x962c('0x2')](_0x962c('0xc'),{'options':{'raw':!![],'where':{'role':_0x962c('0xd')},'attributes':['id',_0x962c('0x3'),_0x962c('0xe'),'internal']},'log':_0x962c('0xb')});};};exports[_0x962c('0xf')]=function(_0x297b17,_0x318ca9,_0x2fe255){return client[_0x962c('0x2')](_0x962c('0x10'),{'body':{'type':_0x318ca9,'uniqueid':_0x2fe255},'options':{'where':{'id':_0x297b17['id']}},'log':_0x962c('0xf')});};exports[_0x962c('0x11')]=function(_0x2b955d){return client['Request'](_0x962c('0x12'),{'body':{},'options':{'where':{'id':_0x2b955d['id']}},'log':_0x962c('0xf')});};exports[_0x962c('0x13')]=function(_0x1bb6f3){return client[_0x962c('0x2')](_0x962c('0x14'),{'options':{'raw':![],'where':{'role':'agent','id':_0x1bb6f3},'attributes':['id',_0x962c('0x3'),_0x962c('0x4'),'accountcode',_0x962c('0x5'),_0x962c('0x15'),_0x962c('0x6'),'pauseType',_0x962c('0x7'),_0x962c('0x8'),_0x962c('0xa')]},'log':_0x962c('0x13')});}; \ No newline at end of file +var _0xd84c=['getAgents','getTelephones','Request','name','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','../client','GetUser','agent','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xd84c,0xec));var _0xcd84=function(_0x214f81,_0x560be6){_0x214f81=_0x214f81-0x0;var _0x5e5ae3=_0xd84c[_0x214f81];return _0x5e5ae3;};'use strict';var client=require(_0xcd84('0x0'));exports['getAgents']=function(){return function(){return client['Request'](_0xcd84('0x1'),{'options':{'raw':![],'where':{'role':_0xcd84('0x2')},'attributes':['id','name',_0xcd84('0x3'),_0xcd84('0x4'),_0xcd84('0x5'),_0xcd84('0x6'),_0xcd84('0x7'),_0xcd84('0x8'),_0xcd84('0x9'),_0xcd84('0xa'),_0xcd84('0xb'),_0xcd84('0xc'),_0xcd84('0xd')]},'log':_0xcd84('0xe')});};};exports[_0xcd84('0xf')]=function(){return function(){return client[_0xcd84('0x10')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0xcd84('0x11'),_0xcd84('0x4'),_0xcd84('0x12')]},'log':_0xcd84('0xf')});};};exports[_0xcd84('0x13')]=function(_0x26c9ac,_0x5c29e7,_0x20e12c){return client['Request'](_0xcd84('0x14'),{'body':{'type':_0x5c29e7,'uniqueid':_0x20e12c},'options':{'where':{'id':_0x26c9ac['id']}},'log':'savePause'});};exports[_0xcd84('0x15')]=function(_0x4e294b){return client[_0xcd84('0x10')](_0xcd84('0x16'),{'body':{},'options':{'where':{'id':_0x4e294b['id']}},'log':'savePause'});};exports[_0xcd84('0x17')]=function(_0x2d6190){return client[_0xcd84('0x10')](_0xcd84('0x18'),{'options':{'raw':![],'where':{'role':_0xcd84('0x2'),'id':_0x2d6190},'attributes':['id',_0xcd84('0x11'),_0xcd84('0x3'),_0xcd84('0x4'),_0xcd84('0x5'),_0xcd84('0x6'),'lastLoginAt',_0xcd84('0x8'),'lastPauseAt',_0xcd84('0xa'),_0xcd84('0xd')]},'log':_0xcd84('0x17')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index a7dcb82..8beeb22 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 _0xd4de=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create'];(function(_0x321acb,_0x513b36){var _0x2619a5=function(_0x3eed49){while(--_0x3eed49){_0x321acb['push'](_0x321acb['shift']());}};_0x2619a5(++_0x513b36);}(_0xd4de,0x1ac));var _0xed4d=function(_0x2a4926,_0x835943){_0x2a4926=_0x2a4926-0x0;var _0xc730ad=_0xd4de[_0x2a4926];return _0xc730ad;};'use strict';var client=require(_0xed4d('0x0'));exports[_0xed4d('0x1')]=function(_0x35fbc4){return client[_0xed4d('0x2')](_0xed4d('0x3'),{'body':_0x35fbc4,'log':_0xed4d('0x3')});};exports['update']=function(_0xc06a14,_0x1436b3,_0x125dbe){return client[_0xed4d('0x2')](_0xed4d('0x4'),{'body':_0xc06a14,'options':{'where':{'uniqueid':_0x1436b3,'interface':_0x125dbe,'agentcomplete':!![]}},'log':_0xed4d('0x4')});}; \ No newline at end of file +var _0xf8c7=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x10aa73,_0xc744f4){var _0x3496d9=function(_0x71c780){while(--_0x71c780){_0x10aa73['push'](_0x10aa73['shift']());}};_0x3496d9(++_0xc744f4);}(_0xf8c7,0x110));var _0x7f8c=function(_0x455839,_0x261111){_0x455839=_0x455839-0x0;var _0x1e2e80=_0xf8c7[_0x455839];return _0x1e2e80;};'use strict';var client=require(_0x7f8c('0x0'));exports[_0x7f8c('0x1')]=function(_0x249f23){return client[_0x7f8c('0x2')]('CreateVoiceAgentReport',{'body':_0x249f23,'log':_0x7f8c('0x3')});};exports[_0x7f8c('0x4')]=function(_0x37652e,_0x1fef72,_0x565bc0){return client[_0x7f8c('0x2')](_0x7f8c('0x5'),{'body':_0x37652e,'options':{'where':{'uniqueid':_0x1fef72,'interface':_0x565bc0,'agentcomplete':!![]}},'log':_0x7f8c('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 726425f..e2d3b27 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 _0x4de1=['YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','util','lodash','create','Request','CreateVoiceCallReport','merge','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','endOf'];(function(_0x3ccac2,_0x3b1a8a){var _0x43aa10=function(_0x57e8ee){while(--_0x57e8ee){_0x3ccac2['push'](_0x3ccac2['shift']());}};_0x43aa10(++_0x3b1a8a);}(_0x4de1,0x149));var _0x14de=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0x4de1[_0x4bb581];return _0x316bf5;};'use strict';var moment=require('moment');var util=require(_0x14de('0x0'));var _=require(_0x14de('0x1'));var client=require('../client');exports[_0x14de('0x2')]=function(_0x3cb7e4){return client[_0x14de('0x3')](_0x14de('0x4'),{'body':_[_0x14de('0x5')](_0x3cb7e4,{'source':_0x3cb7e4['calleridnum'],'destinationcontext':_0x3cb7e4['context'],'callerid':_0x3cb7e4['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0x14de('0x4')});};exports[_0x14de('0x6')]=function(){return function(){return client['Request'](_0x14de('0x7'),{'options':{'where':{'type':[_0x14de('0x8')],'createdAt':{'$between':[moment()[_0x14de('0x9')](_0x14de('0xa'))[_0x14de('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x14de('0xc')](_0x14de('0xa'))['format'](_0x14de('0xd'))]}},'attributes':[_0x14de('0xe'),_0x14de('0xf'),_0x14de('0x10'),_0x14de('0x11')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0xb62a=['YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','CreateVoiceCallReport','calleridnum','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format'];(function(_0x47e824,_0xbb033e){var _0x1d4497=function(_0xa075ea){while(--_0xa075ea){_0x47e824['push'](_0x47e824['shift']());}};_0x1d4497(++_0xbb033e);}(_0xb62a,0xc4));var _0xab62=function(_0x1691dc,_0x5ded3e){_0x1691dc=_0x1691dc-0x0;var _0x2b1eab=_0xb62a[_0x1691dc];return _0x2b1eab;};'use strict';var moment=require(_0xab62('0x0'));var util=require(_0xab62('0x1'));var _=require(_0xab62('0x2'));var client=require(_0xab62('0x3'));exports['create']=function(_0x5cdefb){return client['Request'](_0xab62('0x4'),{'body':_['merge'](_0x5cdefb,{'source':_0x5cdefb[_0xab62('0x5')],'destinationcontext':_0x5cdefb[_0xab62('0x6')],'callerid':_0x5cdefb['callerid'],'amaflags':_0xab62('0x7')}),'log':_0xab62('0x4')});};exports[_0xab62('0x8')]=function(){return function(){return client['Request'](_0xab62('0x9'),{'options':{'where':{'type':[_0xab62('0xa')],'createdAt':{'$between':[moment()[_0xab62('0xb')](_0xab62('0xc'))[_0xab62('0xd')](_0xab62('0xe')),moment()[_0xab62('0xf')](_0xab62('0xc'))[_0xab62('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xab62('0x10'),_0xab62('0x11'),_0xab62('0x12'),_0xab62('0x13')]},'log':_0xab62('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 261dbd8..ebf588d 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 _0x896b=['create','Request','CreateVoiceDialReport'];(function(_0x2f2d88,_0x32815c){var _0x4742ee=function(_0x19b8ba){while(--_0x19b8ba){_0x2f2d88['push'](_0x2f2d88['shift']());}};_0x4742ee(++_0x32815c);}(_0x896b,0x87));var _0xb896=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x896b[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports[_0xb896('0x0')]=function(_0x4c0ca1){return client[_0xb896('0x1')](_0xb896('0x2'),{'body':_0x4c0ca1,'log':_0xb896('0x2')});}; \ No newline at end of file +var _0x9f5e=['../client','create','Request','CreateVoiceDialReport'];(function(_0x502e76,_0x4f21ae){var _0x3c42c8=function(_0x2f1cf0){while(--_0x2f1cf0){_0x502e76['push'](_0x502e76['shift']());}};_0x3c42c8(++_0x4f21ae);}(_0x9f5e,0x1d8));var _0xe9f5=function(_0x45f4e3,_0x157a21){_0x45f4e3=_0x45f4e3-0x0;var _0x446259=_0x9f5e[_0x45f4e3];return _0x446259;};'use strict';var client=require(_0xe9f5('0x0'));exports[_0xe9f5('0x1')]=function(_0x265fbc){return client[_0xe9f5('0x2')](_0xe9f5('0x3'),{'body':_0x265fbc,'log':_0xe9f5('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 7c41e0d..685e478 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 _0xee4f=['recordingFormat','../client','GetVoiceExtension','exten'];(function(_0x2bb27a,_0x1288e8){var _0x16a29e=function(_0x16cba0){while(--_0x16cba0){_0x2bb27a['push'](_0x2bb27a['shift']());}};_0x16a29e(++_0x1288e8);}(_0xee4f,0xad));var _0xfee4=function(_0x3da035,_0x2cc569){_0x3da035=_0x3da035-0x0;var _0x47dfe5=_0xee4f[_0x3da035];return _0x47dfe5;};'use strict';var client=require(_0xfee4('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0xfee4('0x1'),{'options':{'raw':!![],'attributes':['id',_0xfee4('0x2'),_0xfee4('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x317b=['getVoiceExtensions','GetVoiceExtension','exten','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x317b,0x1c7));var _0xb317=function(_0x2b2a52,_0x4b6e5d){_0x2b2a52=_0x2b2a52-0x0;var _0x5d592d=_0x317b[_0x2b2a52];return _0x5d592d;};'use strict';var client=require(_0xb317('0x0'));exports[_0xb317('0x1')]=function(){return function(){return client['Request'](_0xb317('0x2'),{'options':{'raw':!![],'attributes':['id',_0xb317('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xb317('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 54d25b2..1e50c62 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 _0x4737=['callerid','active','Pause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','autopause','monitor_format','type','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','name'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x4737,0x1e6));var _0x7473=function(_0x267f9e,_0x100727){_0x267f9e=_0x267f9e-0x0;var _0x47a5b0=_0x4737[_0x267f9e];return _0x47a5b0;};'use strict';var client=require(_0x7473('0x0'));exports[_0x7473('0x1')]=function(){return function(){return client[_0x7473('0x2')](_0x7473('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x7473('0x4'),'acwTimeout',_0x7473('0x5'),_0x7473('0x6'),_0x7473('0x7'),'dialActive',_0x7473('0x8'),'dialLimitChannel',_0x7473('0x9'),_0x7473('0xa'),_0x7473('0xb'),'dialPredictiveOptimizationPercentage',_0x7473('0xc'),_0x7473('0xd'),_0x7473('0xe'),'dialOriginateTimeout',_0x7473('0xf'),'dialQueueTimeout',_0x7473('0x10'),_0x7473('0x11'),_0x7473('0x12'),_0x7473('0x13'),'dialBusyRetryFrequency',_0x7473('0x14'),_0x7473('0x15'),_0x7473('0x16'),_0x7473('0x17'),_0x7473('0x18'),_0x7473('0x19'),_0x7473('0x1a'),_0x7473('0x1b'),_0x7473('0x1c'),_0x7473('0x1d'),'dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime',_0x7473('0x1e'),_0x7473('0x1f'),_0x7473('0x20'),'dialAMDSilenceThreshold',_0x7473('0x21'),_0x7473('0x22'),'dialRecallMeTimeout',_0x7473('0x23'),_0x7473('0x24'),_0x7473('0x25'),_0x7473('0x26'),_0x7473('0x27'),_0x7473('0x6'),_0x7473('0x28'),'dialRandomLastDigitCallerIdNumber',_0x7473('0x29'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0x7473('0x2a'),_0x7473('0x2b'),_0x7473('0x2c'),'dialAbandonedRetryFrequency',_0x7473('0x2d'),_0x7473('0x2e'),_0x7473('0x2f'),_0x7473('0x30'),_0x7473('0x31'),_0x7473('0x32'),_0x7473('0x33')],'include':[{'model':'Trunk','as':_0x7473('0x34'),'attributes':['id',_0x7473('0x35'),_0x7473('0x36'),_0x7473('0x37')]},{'model':_0x7473('0x38'),'as':'mandatoryDispositionPause','attributes':['id',_0x7473('0x35')]},{'model':'Trunk','as':_0x7473('0x39'),'attributes':['id',_0x7473('0x35'),_0x7473('0x36'),_0x7473('0x37')]},{'model':'Interval','as':_0x7473('0x3a'),'attributes':['id',_0x7473('0x35')],'include':[{'model':_0x7473('0x3a'),'as':'Intervals','attributes':['id','name',_0x7473('0x3b')]}]}]},'log':_0x7473('0x1')});};}; \ No newline at end of file +var _0x7bc0=['dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7bc0,0x9c));var _0x07bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bc0[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x07bc('0x0'));exports[_0x07bc('0x1')]=function(){return function(){return client[_0x07bc('0x2')](_0x07bc('0x3'),{'options':{'raw':![],'attributes':['id','name','acw',_0x07bc('0x4'),_0x07bc('0x5'),_0x07bc('0x6'),_0x07bc('0x7'),_0x07bc('0x8'),_0x07bc('0x9'),_0x07bc('0xa'),_0x07bc('0xb'),_0x07bc('0xc'),_0x07bc('0xd'),'dialPredictiveOptimizationPercentage',_0x07bc('0xe'),_0x07bc('0xf'),_0x07bc('0x10'),_0x07bc('0x11'),_0x07bc('0x12'),_0x07bc('0x13'),_0x07bc('0x14'),_0x07bc('0x15'),_0x07bc('0x16'),'dialBusyMaxRetry',_0x07bc('0x17'),_0x07bc('0x18'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x07bc('0x19'),_0x07bc('0x1a'),_0x07bc('0x1b'),_0x07bc('0x1c'),_0x07bc('0x1d'),_0x07bc('0x1e'),_0x07bc('0x1f'),'dialAMDAfterGreetingSilence',_0x07bc('0x20'),_0x07bc('0x21'),'dialAMDBetweenWordsSilence',_0x07bc('0x22'),_0x07bc('0x23'),_0x07bc('0x24'),_0x07bc('0x25'),_0x07bc('0x26'),_0x07bc('0x27'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent',_0x07bc('0x28'),'dialQueueProject2',_0x07bc('0x6'),_0x07bc('0x29'),'dialRandomLastDigitCallerIdNumber',_0x07bc('0x2a'),_0x07bc('0x2b'),'dialNoSuchNumberRetryFrequency',_0x07bc('0x2c'),_0x07bc('0x2d'),_0x07bc('0x2e'),_0x07bc('0x2f'),'dialMachineMaxRetry',_0x07bc('0x30'),_0x07bc('0x31'),_0x07bc('0x32'),_0x07bc('0x33'),_0x07bc('0x34'),_0x07bc('0x35')],'include':[{'model':_0x07bc('0x36'),'as':_0x07bc('0x36'),'attributes':['id',_0x07bc('0x37'),_0x07bc('0x38'),_0x07bc('0x39')]},{'model':_0x07bc('0x3a'),'as':_0x07bc('0x3b'),'attributes':['id',_0x07bc('0x37')]},{'model':_0x07bc('0x36'),'as':_0x07bc('0x3c'),'attributes':['id','name','callerid',_0x07bc('0x39')]},{'model':_0x07bc('0x3d'),'as':_0x07bc('0x3d'),'attributes':['id','name'],'include':[{'model':_0x07bc('0x3d'),'as':_0x07bc('0x3e'),'attributes':['id','name',_0x07bc('0x3f')]}]}]},'log':_0x07bc('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 10d1f15..149a9b8 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 _0x7227=['day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','create','Request','getVoiceQueueReports','startOf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7227,0xad));var _0x7722=function(_0x5d37c2,_0x28edc2){_0x5d37c2=_0x5d37c2-0x0;var _0x1a89c2=_0x7227[_0x5d37c2];return _0x1a89c2;};'use strict';var moment=require(_0x7722('0x0'));var _=require(_0x7722('0x1'));var client=require(_0x7722('0x2'));exports[_0x7722('0x3')]=function(_0x35792c){return client[_0x7722('0x4')]('CreateVoiceQueueReport',{'body':_0x35792c,'log':'CreateVoiceQueueReport'});};exports[_0x7722('0x5')]=function(){return function(){return client[_0x7722('0x4')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0x7722('0x6')](_0x7722('0x7'))[_0x7722('0x8')](_0x7722('0x9')),moment()[_0x7722('0xa')](_0x7722('0x7'))['format'](_0x7722('0x9'))]}},'attributes':['uniqueid',_0x7722('0xb'),_0x7722('0xc'),_0x7722('0xd'),_0x7722('0xe'),'queuecallercompleteAt',_0x7722('0xf'),_0x7722('0x10'),_0x7722('0x11'),_0x7722('0x12')]},'log':_0x7722('0x13')});};}; \ No newline at end of file +var _0x4874=['Request','CreateVoiceQueueReport','GetVoiceQueueReport','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','../client','create'];(function(_0x714308,_0x1e1bce){var _0x54db09=function(_0x5edc16){while(--_0x5edc16){_0x714308['push'](_0x714308['shift']());}};_0x54db09(++_0x1e1bce);}(_0x4874,0x12a));var _0x4487=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x4874[_0xc0a3d3];return _0x3386e8;};'use strict';var moment=require('moment');var _=require('lodash');var client=require(_0x4487('0x0'));exports[_0x4487('0x1')]=function(_0x3f51e7){return client[_0x4487('0x2')](_0x4487('0x3'),{'body':_0x3f51e7,'log':_0x4487('0x3')});};exports['getVoiceQueueReports']=function(){return function(){return client['Request'](_0x4487('0x4'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x4487('0x5')](_0x4487('0x6'))[_0x4487('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x4487('0x8')](_0x4487('0x6'))[_0x4487('0x7')](_0x4487('0x9'))]}},'attributes':[_0x4487('0xa'),_0x4487('0xb'),_0x4487('0xc'),_0x4487('0xd'),_0x4487('0xe'),_0x4487('0xf'),_0x4487('0x10'),_0x4487('0x11'),_0x4487('0x12'),_0x4487('0x13')]},'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 9ad8df1..d9a344a 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 _0xbdd4=['Request','GetVoiceQueueRtPauses','../client'];(function(_0xf84870,_0x4dc38f){var _0x4541a4=function(_0x3ff5d5){while(--_0x3ff5d5){_0xf84870['push'](_0xf84870['shift']());}};_0x4541a4(++_0x4dc38f);}(_0xbdd4,0xe6));var _0x4bdd=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0xbdd4[_0x4bb66f];return _0xf2772f;};'use strict';var client=require(_0x4bdd('0x0'));exports['getVoiceQueueRtPauses']=function(_0x39ce5c){return function(){return client[_0x4bdd('0x1')](_0x4bdd('0x2'),{'options':{'where':{'VoiceQueueId':_0x39ce5c,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x1243=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x1243,0xa0));var _0x3124=function(_0x46a6f9,_0x50203c){_0x46a6f9=_0x46a6f9-0x0;var _0x17084a=_0x1243[_0x46a6f9];return _0x17084a;};'use strict';var client=require('../client');exports[_0x3124('0x0')]=function(_0x1a6df3){return function(){return client[_0x3124('0x1')](_0x3124('0x2'),{'options':{'where':{'VoiceQueueId':_0x1a6df3,'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 6d8987c..4720a47 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 _0x565a=['CreateVoiceRecording','Request','merge'];(function(_0x10dc64,_0x11bb29){var _0x9cf98d=function(_0x558d71){while(--_0x558d71){_0x10dc64['push'](_0x10dc64['shift']());}};_0x9cf98d(++_0x11bb29);}(_0x565a,0x151));var _0xa565=function(_0x3942de,_0x31a6ff){_0x3942de=_0x3942de-0x0;var _0x3b6ad6=_0x565a[_0x3942de];return _0x3b6ad6;};'use strict';var _=require('lodash');var client=require('../client');exports['create']=function(_0x1208ca){return client[_0xa565('0x0')]('CreateVoiceRecording',{'body':_[_0xa565('0x1')](_0x1208ca,{'value':_0x1208ca['monitorFilename']}),'log':_0xa565('0x2')});}; \ No newline at end of file +var _0xaebd=['lodash','create','CreateVoiceRecording','merge'];(function(_0x1de6d1,_0x455da7){var _0x391dce=function(_0x424c20){while(--_0x424c20){_0x1de6d1['push'](_0x1de6d1['shift']());}};_0x391dce(++_0x455da7);}(_0xaebd,0x18c));var _0xdaeb=function(_0x1953ba,_0x328bc2){_0x1953ba=_0x1953ba-0x0;var _0x514132=_0xaebd[_0x1953ba];return _0x514132;};'use strict';var _=require(_0xdaeb('0x0'));var client=require('../client');exports[_0xdaeb('0x1')]=function(_0x34dd41){return client['Request'](_0xdaeb('0x2'),{'body':_[_0xdaeb('0x3')](_0x34dd41,{'value':_0x34dd41['monitorFilename']}),'log':_0xdaeb('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index b6927b3..f1d68f4 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 _0x539f=['transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereecontext','transfereelinkedid','isexternal','context','blind','Request','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext'];(function(_0x225f50,_0x48a77d){var _0x19d003=function(_0x58965d){while(--_0x58965d){_0x225f50['push'](_0x225f50['shift']());}};_0x19d003(++_0x48a77d);}(_0x539f,0xa2));var _0xf539=function(_0x426d28,_0x287fc9){_0x426d28=_0x426d28-0x0;var _0xd1ff18=_0x539f[_0x426d28];return _0xd1ff18;};'use strict';var client=require(_0xf539('0x0'));exports[_0xf539('0x1')]={};exports[_0xf539('0x2')]=function(_0x701bd2){return client['Request'](_0xf539('0x3'),{'body':{'result':_0x701bd2[_0xf539('0x4')],'transfererchannel':_0x701bd2[_0xf539('0x5')],'transferercalleridnum':_0x701bd2[_0xf539('0x6')],'transferercalleridname':_0x701bd2[_0xf539('0x7')],'transfererconnectedlinenum':_0x701bd2[_0xf539('0x8')],'transfererconnectedlinename':_0x701bd2[_0xf539('0x9')],'transfereraccountcode':_0x701bd2[_0xf539('0xa')],'transferercontext':_0x701bd2[_0xf539('0xb')],'transfererexten':_0x701bd2['transfererexten'],'transfererlinkedid':_0x701bd2[_0xf539('0xc')],'transfereechannel':_0x701bd2[_0xf539('0xd')],'transfereecalleridnum':_0x701bd2[_0xf539('0xe')],'transfereecalleridname':_0x701bd2[_0xf539('0xf')],'transfereeconnectedlinenum':_0x701bd2[_0xf539('0x10')],'transfereeconnectedlinename':_0x701bd2['transfereeconnectedlinename'],'transfereeaccountcode':_0x701bd2['transfereeaccountcode'],'transfereecontext':_0x701bd2[_0xf539('0x11')],'transfereeexten':_0x701bd2['transfereeexten'],'transfereelinkedid':_0x701bd2[_0xf539('0x12')],'isexternal':_0x701bd2[_0xf539('0x13')],'context':_0x701bd2[_0xf539('0x14')],'extension':_0x701bd2['extension'],'type':_0xf539('0x15')},'log':_0xf539('0x3')});};exports['attendedTransfer']=function(_0x31aa4e){return client[_0xf539('0x16')](_0xf539('0x3'),{'body':{'result':_0x31aa4e['result'],'transfererchannel':_0x31aa4e[_0xf539('0x17')],'transferercalleridnum':_0x31aa4e[_0xf539('0x18')],'transferercalleridname':_0x31aa4e['origtransferercalleridname'],'transfererconnectedlinenum':_0x31aa4e['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x31aa4e[_0xf539('0x19')],'transfereraccountcode':_0x31aa4e[_0xf539('0x1a')],'transferercontext':_0x31aa4e[_0xf539('0x1b')],'transfererexten':_0x31aa4e['secondtransfererexten'],'transfererlinkedid':_0x31aa4e['origtransfererlinkedid'],'transfereechannel':_0x31aa4e[_0xf539('0x1c')],'transfereecalleridnum':_0x31aa4e[_0xf539('0x1d')],'transfereecalleridname':_0x31aa4e[_0xf539('0x1e')],'transfereeconnectedlinenum':_0x31aa4e[_0xf539('0x1f')],'transfereeconnectedlinename':_0x31aa4e[_0xf539('0x20')],'transfereeaccountcode':_0x31aa4e[_0xf539('0x21')],'transfereecontext':_0x31aa4e[_0xf539('0x22')],'transfereeexten':_0x31aa4e['transfertargetexten'],'transfereelinkedid':_0x31aa4e['transfertargetlinkedid'],'isexternal':_0x31aa4e[_0xf539('0x13')],'context':_0x31aa4e[_0xf539('0x23')],'extension':_0x31aa4e[_0xf539('0x24')],'type':_0xf539('0x25')},'log':_0xf539('0x3')});}; \ No newline at end of file +var _0xe945=['transfertargetcalleridname','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','transfers','blindTransfer','Request','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','transfertargetcalleridnum'];(function(_0x4b0eab,_0x4862cb){var _0x373dd3=function(_0x4a81ed){while(--_0x4a81ed){_0x4b0eab['push'](_0x4b0eab['shift']());}};_0x373dd3(++_0x4862cb);}(_0xe945,0xf0));var _0x5e94=function(_0x1a70c0,_0x1bd82b){_0x1a70c0=_0x1a70c0-0x0;var _0x9f7333=_0xe945[_0x1a70c0];return _0x9f7333;};'use strict';var client=require('../client');exports[_0x5e94('0x0')]={};exports[_0x5e94('0x1')]=function(_0x582100){return client[_0x5e94('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x582100[_0x5e94('0x3')],'transfererchannel':_0x582100['transfererchannel'],'transferercalleridnum':_0x582100[_0x5e94('0x4')],'transferercalleridname':_0x582100[_0x5e94('0x5')],'transfererconnectedlinenum':_0x582100[_0x5e94('0x6')],'transfererconnectedlinename':_0x582100[_0x5e94('0x7')],'transfereraccountcode':_0x582100[_0x5e94('0x8')],'transferercontext':_0x582100[_0x5e94('0x9')],'transfererexten':_0x582100[_0x5e94('0xa')],'transfererlinkedid':_0x582100[_0x5e94('0xb')],'transfereechannel':_0x582100[_0x5e94('0xc')],'transfereecalleridnum':_0x582100[_0x5e94('0xd')],'transfereecalleridname':_0x582100[_0x5e94('0xe')],'transfereeconnectedlinenum':_0x582100[_0x5e94('0xf')],'transfereeconnectedlinename':_0x582100[_0x5e94('0x10')],'transfereeaccountcode':_0x582100[_0x5e94('0x11')],'transfereecontext':_0x582100[_0x5e94('0x12')],'transfereeexten':_0x582100[_0x5e94('0x13')],'transfereelinkedid':_0x582100[_0x5e94('0x14')],'isexternal':_0x582100[_0x5e94('0x15')],'context':_0x582100[_0x5e94('0x16')],'extension':_0x582100[_0x5e94('0x17')],'type':_0x5e94('0x18')},'log':_0x5e94('0x19')});};exports[_0x5e94('0x1a')]=function(_0x3d2c06){return client[_0x5e94('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x3d2c06[_0x5e94('0x3')],'transfererchannel':_0x3d2c06[_0x5e94('0x1b')],'transferercalleridnum':_0x3d2c06[_0x5e94('0x1c')],'transferercalleridname':_0x3d2c06[_0x5e94('0x1d')],'transfererconnectedlinenum':_0x3d2c06['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x3d2c06[_0x5e94('0x1e')],'transfereraccountcode':_0x3d2c06[_0x5e94('0x1f')],'transferercontext':_0x3d2c06['secondtransferercontext'],'transfererexten':_0x3d2c06['secondtransfererexten'],'transfererlinkedid':_0x3d2c06['origtransfererlinkedid'],'transfereechannel':_0x3d2c06['transfertargetchannel'],'transfereecalleridnum':_0x3d2c06[_0x5e94('0x20')],'transfereecalleridname':_0x3d2c06[_0x5e94('0x21')],'transfereeconnectedlinenum':_0x3d2c06['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3d2c06['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3d2c06['transfertargetaccountcode'],'transfereecontext':_0x3d2c06[_0x5e94('0x22')],'transfereeexten':_0x3d2c06[_0x5e94('0x23')],'transfereelinkedid':_0x3d2c06[_0x5e94('0x24')],'isexternal':_0x3d2c06['isexternal'],'context':_0x3d2c06[_0x5e94('0x25')],'extension':_0x3d2c06[_0x5e94('0x26')],'type':'attended'},'log':_0x5e94('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 6a7fcf1..fb4d638 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 _0x36f5=['hasOwnProperty','strategy','answered','loggedIn','pTalking','sumBillable','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','callerid','Interval','push','length','values','channels','voicechannel','map','find','uniqueid','channel','filename','wav','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','%s.%s','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','exten','context','telephones','outboundChannels','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','checkAfterSend','server','http','127.0.0.1','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','SIP','name','timers','timer','agents','QueuePause','isConnected','error','asterisk','username','join','pick','keys','module','then','message','catch','ami\x20disconnected','command','action','Command','Action','content','voiceQueues'];(function(_0x26d0b6,_0x263ced){var _0xdf4729=function(_0x114720){while(--_0x114720){_0x26d0b6['push'](_0x26d0b6['shift']());}};_0xdf4729(++_0x263ced);}(_0x36f5,0xe7));var _0x536f=function(_0x4443f5,_0x3ebbbc){_0x4443f5=_0x4443f5-0x0;var _0x4206c3=_0x36f5[_0x4443f5];return _0x4206c3;};'use strict';var _=require(_0x536f('0x0'));var util=require(_0x536f('0x1'));var jayson=require(_0x536f('0x2'));var schema=require(_0x536f('0x3'));var BPromise=require(_0x536f('0x4'));var moment=require('moment');var config=require(_0x536f('0x5'));var properties=require(_0x536f('0x6'));var ami=require(_0x536f('0x7'));exports[_0x536f('0x8')]=function(_0x13426e,_0x16e88c,_0x1aa461){return new BPromise(function(_0x1f3090,_0x510630){var _0x285bda={'QueuePause':function(_0x5b5cdc){return new Promise(function(_0x2bc444,_0x273d14){var _0x1b5f29=util[_0x536f('0x9')](_0x536f('0xa'),_0x536f('0xb'),_0x5b5cdc[_0x536f('0xc')]);if(_0x13426e[_0x536f('0xd')]&&_0x13426e['timers'][_0x1b5f29]&&_0x13426e[_0x536f('0xd')][_0x1b5f29][_0x536f('0xe')]){_0x13426e[_0x536f('0xd')][_0x1b5f29]['updateAcw']();}if(_0x13426e[_0x536f('0xf')][_0x1b5f29]){_0x13426e[_0x536f('0xf')][_0x1b5f29]['updateStatusRealtime']({'statePause':_0x5b5cdc['pause']?!![]:![]});}_0x2bc444({'code':0xc8,'message':_0x536f('0x10')});});},'Reload':function(_0x18e723){var _0x1d8a64=this;return new Promise(function(_0x2a0fff,_0x40b750){if(ami[_0x536f('0x11')]()==![]){return _0x40b750(_0x1d8a64[_0x536f('0x12')](0x1f4,[config[_0x536f('0x13')]['ip'],config[_0x536f('0x13')][_0x536f('0x14')],'ami\x20disconnected'][_0x536f('0x15')]('\x20')));}_0x18e723=_[_0x536f('0x16')](_0x18e723,_[_0x536f('0x17')](properties[_0x536f('0x18')]));_0x18e723['action']='Reload';return ami['Action'](_0x18e723)[_0x536f('0x19')](function(_0x3f4853){_0x2a0fff({'code':0xc8,'message':_0x3f4853[_0x536f('0x1a')]});})[_0x536f('0x1b')](function(_0x24d38c){_0x40b750(_0x1d8a64[_0x536f('0x12')](0x1f5,_0x24d38c[_0x536f('0x1a')]));});});},'Command':function(_0x233f04){var _0x447114=this;return new Promise(function(_0x5ca3e1,_0xb921d7){if(ami['isConnected']()==![]){return _0xb921d7(_0x447114[_0x536f('0x12')](0x1f4,[config[_0x536f('0x13')]['ip'],config[_0x536f('0x13')][_0x536f('0x14')],_0x536f('0x1c')][_0x536f('0x15')]('\x20')));}_0x233f04=_['pick'](_0x233f04,_0x536f('0x1d'));_0x233f04[_0x536f('0x1e')]=_0x536f('0x1f');return ami[_0x536f('0x20')](_0x233f04)[_0x536f('0x19')](function(_0x11edb6){_0x5ca3e1({'code':0xc8,'message':_0x11edb6[_0x536f('0x21')]});})[_0x536f('0x1b')](function(_0x425281){_0xb921d7(_0x447114[_0x536f('0x12')](0x1f5,_0x425281[_0x536f('0x1a')]));});});},'VoiceQueues':function(_0x574d17){return new Promise(function(_0x456fab,_0x47e494){var _0x1d4f21=[];for(var _0x559359 in _0x13426e[_0x536f('0x22')]){if(_0x13426e['voiceQueues'][_0x536f('0x23')](_0x559359)){var _0x2ff4bd=_0x13426e['voiceQueues'][_0x559359];var _0x1c9a76={'id':_0x2ff4bd['id'],'name':_0x2ff4bd[_0x536f('0xc')],'strategy':_0x2ff4bd[_0x536f('0x24')],'answered':_0x2ff4bd[_0x536f('0x25')],'available':_0x2ff4bd['available'],'loggedIn':_0x2ff4bd[_0x536f('0x26')],'pTalking':_0x2ff4bd[_0x536f('0x27')],'sumBillable':_0x2ff4bd[_0x536f('0x28')],'sumDuration':_0x2ff4bd['sumDuration'],'sumHoldTime':_0x2ff4bd[_0x536f('0x29')]||0x0,'talking':_0x2ff4bd['talking'],'total':_0x2ff4bd[_0x536f('0x2a')],'type':_0x2ff4bd['type'],'unmanaged':_0x2ff4bd[_0x536f('0x2b')],'abandoned':_0x2ff4bd[_0x536f('0x2c')],'waiting':_0x2ff4bd[_0x536f('0x2d')],'loggedInDb':_0x2ff4bd[_0x536f('0x2e')]};if(_0x2ff4bd['type']===_0x536f('0x2f')){_0x1c9a76[_0x536f('0x30')]=_0x2ff4bd[_0x536f('0x30')];_0x1c9a76['dialMethod']=_0x2ff4bd[_0x536f('0x31')];_0x1c9a76[_0x536f('0x32')]=_0x2ff4bd[_0x536f('0x32')];_0x1c9a76[_0x536f('0x33')]=_0x2ff4bd[_0x536f('0x33')];_0x1c9a76[_0x536f('0x34')]=_0x2ff4bd[_0x536f('0x34')];_0x1c9a76[_0x536f('0x35')]=_0x2ff4bd['dialPrefix'];_0x1c9a76[_0x536f('0x36')]=_0x2ff4bd[_0x536f('0x36')];_0x1c9a76[_0x536f('0x37')]=_0x2ff4bd['outboundAnswerCallsDay'];_0x1c9a76['outboundBlacklistCallsDay']=_0x2ff4bd[_0x536f('0x38')];_0x1c9a76[_0x536f('0x39')]=_0x2ff4bd['outboundBusyCallsDay'];_0x1c9a76['outboundCongestionCallsDay']=_0x2ff4bd[_0x536f('0x3a')];_0x1c9a76[_0x536f('0x3b')]=_0x2ff4bd[_0x536f('0x3b')];_0x1c9a76[_0x536f('0x3c')]=_0x2ff4bd[_0x536f('0x3c')];_0x1c9a76[_0x536f('0x3d')]=_0x2ff4bd[_0x536f('0x3d')];_0x1c9a76['outboundNoAnswerCallsDay']=_0x2ff4bd[_0x536f('0x3e')];_0x1c9a76[_0x536f('0x3f')]=_0x2ff4bd[_0x536f('0x3f')];_0x1c9a76[_0x536f('0x40')]=_0x2ff4bd[_0x536f('0x40')];_0x1c9a76[_0x536f('0x41')]=_0x2ff4bd['outboundReCallsDay'];_0x1c9a76[_0x536f('0x42')]=_0x2ff4bd[_0x536f('0x42')];_0x1c9a76[_0x536f('0x43')]=_0x2ff4bd['outboundUnknownCallsDay'];_0x1c9a76[_0x536f('0x44')]=_0x2ff4bd[_0x536f('0x44')];_0x1c9a76['predictiveIntervalAvgHoldtime']=_0x2ff4bd['predictiveIntervalAvgHoldtime'];_0x1c9a76[_0x536f('0x45')]=_0x2ff4bd['predictiveIntervalAvgTalktime'];_0x1c9a76[_0x536f('0x46')]=_0x2ff4bd[_0x536f('0x46')];_0x1c9a76['predictiveIntervalDroppedCallsTimeout']=_0x2ff4bd[_0x536f('0x47')];_0x1c9a76[_0x536f('0x48')]=_0x2ff4bd[_0x536f('0x48')];_0x1c9a76['predictiveIntervalErlangCallsDroppedCalls']=_0x2ff4bd[_0x536f('0x49')];_0x1c9a76[_0x536f('0x4a')]=_0x2ff4bd[_0x536f('0x4a')];_0x1c9a76[_0x536f('0x4b')]=_0x2ff4bd['predictiveIntervalMultiplicativeFactor'];_0x1c9a76[_0x536f('0x4c')]=_0x2ff4bd['predictiveIntervalPauses'];_0x1c9a76[_0x536f('0x4d')]=_0x2ff4bd['predictiveIntervalAvailable'];_0x1c9a76[_0x536f('0x4e')]=_0x2ff4bd[_0x536f('0x4e')];_0x1c9a76[_0x536f('0x1a')]=_0x2ff4bd[_0x536f('0x1a')];_0x1c9a76[_0x536f('0x4f')]=_0x2ff4bd[_0x536f('0x4f')];_0x1c9a76[_0x536f('0x50')]=_0x2ff4bd[_0x536f('0x50')];_0x1c9a76[_0x536f('0x51')]=_0x2ff4bd[_0x536f('0x51')];_0x1c9a76[_0x536f('0x52')]=_0x2ff4bd['erlangAbandonmentRate'];_0x1c9a76[_0x536f('0x53')]=_0x2ff4bd[_0x536f('0x53')];_0x1c9a76['startPredictive']=_0x2ff4bd['startPredictive'];_0x1c9a76[_0x536f('0x54')]=_0x2ff4bd[_0x536f('0x54')];}if(_0x2ff4bd[_0x536f('0x55')]){_0x1c9a76['Trunk']={'id':_0x2ff4bd[_0x536f('0x55')]['id'],'name':_0x2ff4bd['Trunk'][_0x536f('0xc')],'active':_0x2ff4bd[_0x536f('0x55')]['active'],'callerid':_0x2ff4bd[_0x536f('0x55')][_0x536f('0x56')]};}if(_0x2ff4bd[_0x536f('0x57')]){_0x1c9a76['Interval']={'id':_0x2ff4bd['Interval']['id'],'name':_0x2ff4bd[_0x536f('0x57')][_0x536f('0xc')]};}_0x1d4f21[_0x536f('0x58')](_0x1c9a76);}}_0x456fab({'count':_0x1d4f21[_0x536f('0x59')],'rows':_0x1d4f21});});},'VoiceChannels':function(_0x32ede1){return new Promise(function(_0x7d1ab,_0x3e2ece){var _0x1d4f81=_[_0x536f('0x5a')](_0x13426e[_0x536f('0x5b')]);_0x7d1ab({'count':_0x1d4f81[_0x536f('0x59')],'rows':_0x1d4f81});});},'VoiceChannelMixMonitor':function(_0x4d6c11){var _0xe53c=this;return new Promise(function(_0x24eb2d,_0x3b7f0c){if(ami['isConnected']()==![]){return _0x3b7f0c(_0xe53c[_0x536f('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x536f('0x13')][_0x536f('0x14')],'ami\x20disconnected'][_0x536f('0x15')]('\x20')));}var _0x3417b8=schema(properties[_0x536f('0x5c')])['validate'](_0x4d6c11);if(_0x3417b8['length']>0x0){return _0x3b7f0c(_0xe53c[_0x536f('0x12')](0x1f4,_[_0x536f('0x5d')](_0x3417b8,_0x536f('0x1a'))[_0x536f('0x15')](',\x20')));}var _0x1a42d3=_[_0x536f('0x5e')](_0x13426e[_0x536f('0x5b')],{'uniqueid':_0x4d6c11[_0x536f('0x5f')]});if(_0x1a42d3&&_0x1a42d3[_0x536f('0x60')]){var _0x15e131=util[_0x536f('0x9')]('%s.%s',_0x4d6c11[_0x536f('0x61')]||_0x4d6c11[_0x536f('0x5f')],_0x4d6c11[_0x536f('0x9')]||_0x536f('0x62'));return ami['Action']({'action':'MixMonitor','channel':_0x1a42d3[_0x536f('0x60')],'file':_0x15e131,'options':'ai(mixmonitorid)'})[_0x536f('0x19')](function(_0x3accfb){var _0x390662=_[_0x536f('0x5e')](_0x1a42d3['monitors'],{'filename':_0x536f('0x63')+_0x15e131['toLowerCase']()});if(_['isNil'](_0x390662)){_0x1a42d3['monitors'][_0x536f('0x58')]({'filename':_0x536f('0x63')+_0x15e131[_0x536f('0x64')](),'createdAt':moment()[_0x536f('0x9')](_0x536f('0x65')),'mixmonitorid':_0x3accfb[_0x536f('0x66')],'status':_0x536f('0x67')});}else{_0x390662['mixmonitorid']=_0x3accfb[_0x536f('0x66')];_0x390662[_0x536f('0x68')]=_0x536f('0x67');}_0x24eb2d({'code':0xc8,'message':[_0x4d6c11[_0x536f('0x5f')],'MixMonitor\x20Success',_0x3accfb[_0x536f('0x66')]][_0x536f('0x15')]('\x20'),'mixmonitorid':_0x3accfb[_0x536f('0x66')]});})[_0x536f('0x1b')](function(_0x2f8c74){_0x3b7f0c(_0xe53c[_0x536f('0x12')](0x1f5,[_0x4d6c11[_0x536f('0x5f')],_0x2f8c74['message']['toLowerCase']()][_0x536f('0x15')]('\x20')));});}else{return _0x3b7f0c(_0xe53c[_0x536f('0x12')](0x1f5,_0x536f('0x69')));}});},'VoiceChannelStopMixMonitor':function(_0x5763ee){var _0x32defb=this;return new Promise(function(_0x3e89ee,_0x399f9a){if(ami['isConnected']()==![]){return _0x399f9a(_0x32defb[_0x536f('0x12')](0x1f4,[config[_0x536f('0x13')]['ip'],config[_0x536f('0x13')][_0x536f('0x14')],_0x536f('0x1c')][_0x536f('0x15')]('\x20')));}var _0x5ee91c=schema(properties[_0x536f('0x5c')])[_0x536f('0x3')](_0x5763ee);if(_0x5ee91c[_0x536f('0x59')]>0x0){return _0x399f9a(_0x32defb[_0x536f('0x12')](0x1f4,_[_0x536f('0x5d')](_0x5ee91c,'message')[_0x536f('0x15')](',\x20')));}var _0x5d6b2e=_[_0x536f('0x5e')](_0x13426e[_0x536f('0x5b')],{'uniqueid':_0x5763ee[_0x536f('0x5f')]});if(_0x5d6b2e){return BPromise[_0x536f('0x6a')]()[_0x536f('0x19')](function(){if(_0x5d6b2e[_0x536f('0x60')]){return ami[_0x536f('0x20')]({'action':_0x536f('0x6b'),'channel':_0x5d6b2e[_0x536f('0x60')],'mixmonitorid':_0x5763ee['mixmonitorid']})['catch'](function(_0x4fcb93){});}})[_0x536f('0x19')](function(){if(_0x5d6b2e['destinationchannel']){return ami[_0x536f('0x20')]({'action':'StopMixMonitor','channel':_0x5d6b2e[_0x536f('0x6c')],'mixmonitorid':_0x5763ee[_0x536f('0x66')]})[_0x536f('0x1b')](function(_0x189694){});}})[_0x536f('0x19')](function(_0x1dfc74){var _0x2e569f=_[_0x536f('0x5e')](_0x5d6b2e[_0x536f('0x6d')],{'mixmonitorid':_0x5763ee[_0x536f('0x66')]});if(_0x2e569f){_0x2e569f['status']='stop';}})[_0x536f('0x19')](function(){var _0x49aec5=util['format'](_0x536f('0x6e'),_0x5763ee[_0x536f('0x61')]||_0x5763ee[_0x536f('0x5f')],_0x5763ee['format']||_0x536f('0x62'));var _0x2fd442=_[_0x536f('0x5e')](_0x5d6b2e[_0x536f('0x6d')],{'filename':_0x536f('0x63')+_0x49aec5[_0x536f('0x64')]()});if(_0x2fd442){_0x2fd442['status']='stop';}})[_0x536f('0x19')](function(){_0x3e89ee({'code':0xc8,'message':[_0x5763ee[_0x536f('0x5f')],_0x536f('0x6f')][_0x536f('0x15')]('\x20')});})[_0x536f('0x1b')](function(_0x53c960){_0x399f9a(_0x32defb[_0x536f('0x12')](0x1f5,[_0x5763ee[_0x536f('0x5f')],_0x53c960['message'][_0x536f('0x64')]()]['join']('\x20')));});}else{return _0x399f9a(_0x32defb[_0x536f('0x12')](0x1f5,_0x536f('0x69')));}});},'VoiceQueuesChannels':function(_0x41ffd3){return new Promise(function(_0x380db9,_0x375495){var _0x3a794b=_[_0x536f('0x5a')](_0x13426e[_0x536f('0x70')]);_0x380db9({'count':_0x3a794b[_0x536f('0x59')],'rows':_0x3a794b});});},'VoiceQueuesChannel':function(_0x4c38d6){var _0x288b85=this;return new Promise(function(_0x1ce636,_0x342d58){var _0x24504e=schema(properties[_0x536f('0x71')])[_0x536f('0x3')](_0x4c38d6);if(_0x24504e[_0x536f('0x59')]>0x0){return _0x342d58(_0x288b85['error'](0x1f4,_['map'](_0x24504e,_0x536f('0x1a'))[_0x536f('0x15')](',\x20')));}var _0x5f45ca=_['find'](_0x13426e[_0x536f('0x70')],{'uniqueid':_0x4c38d6[_0x536f('0x5f')]});if(_0x5f45ca){_0x1ce636(_0x5f45ca);}else{return _0x342d58(_0x288b85['error'](0x1f5,_0x536f('0x69')));}});},'VoiceQueuesChannelHangup':function(_0x3ac5e4){var _0x2ea7c8=this;return new Promise(function(_0x5c15c6,_0x3fb984){if(ami['isConnected']()==![]){return _0x3fb984(_0x2ea7c8[_0x536f('0x12')](0x1f4,[config[_0x536f('0x13')]['ip'],config[_0x536f('0x13')][_0x536f('0x14')],'ami\x20disconnected']['join']('\x20')));}var _0x24800f=schema(properties[_0x536f('0x72')])[_0x536f('0x3')](_0x3ac5e4);if(_0x24800f[_0x536f('0x59')]>0x0){return _0x3fb984(_0x2ea7c8['error'](0x1f4,_[_0x536f('0x5d')](_0x24800f,_0x536f('0x1a'))[_0x536f('0x15')](',\x20')));}var _0x36df56=_[_0x536f('0x5e')](_0x13426e[_0x536f('0x70')],{'uniqueid':_0x3ac5e4[_0x536f('0x5f')]});if(_0x36df56&&_0x36df56[_0x536f('0x60')]){return ami[_0x536f('0x20')]({'action':_0x536f('0x73'),'channel':_0x36df56[_0x536f('0x60')]})['then'](function(_0x89d46f){_0x5c15c6({'code':0xc8,'message':[_0x3ac5e4[_0x536f('0x5f')],_0x89d46f[_0x536f('0x1a')]['toLowerCase']()][_0x536f('0x15')]('\x20')});})[_0x536f('0x1b')](function(_0x512940){_0x3fb984(_0x2ea7c8[_0x536f('0x12')](0x1f5,[_0x3ac5e4[_0x536f('0x5f')],_0x512940['message']['toLowerCase']()]['join']('\x20')));});}else{return _0x3fb984(_0x2ea7c8['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x20d3b2){var _0x1d8656=this;return new Promise(function(_0x5f138e,_0x35a31c){if(ami['isConnected']()==![]){return _0x35a31c(_0x1d8656[_0x536f('0x12')](0x1f4,[config[_0x536f('0x13')]['ip'],config['asterisk'][_0x536f('0x14')],_0x536f('0x1c')][_0x536f('0x15')]('\x20')));}var _0x5e10d5=schema(properties[_0x536f('0x74')])['validate'](_0x20d3b2);if(_0x5e10d5[_0x536f('0x59')]>0x0){return _0x35a31c(_0x1d8656[_0x536f('0x12')](0x1f4,_['map'](_0x5e10d5,'message')[_0x536f('0x15')](',\x20')));}var _0x4de746=_[_0x536f('0x5e')](_0x13426e[_0x536f('0x70')],{'uniqueid':_0x20d3b2['uniqueid']});if(_0x4de746&&_0x4de746[_0x536f('0x60')]){return ami[_0x536f('0x20')]({'action':'Redirect','channel':_0x4de746[_0x536f('0x60')],'exten':_0x20d3b2[_0x536f('0x75')],'context':_0x20d3b2['context']||_0x4de746[_0x536f('0x76')],'priority':0x1})['then'](function(_0x1d5e91){_0x5f138e({'code':0xc8,'message':[_0x20d3b2[_0x536f('0x5f')],_0x1d5e91[_0x536f('0x1a')]['toLowerCase']()][_0x536f('0x15')]('\x20')});})[_0x536f('0x1b')](function(_0x592601){_0x35a31c(_0x1d8656[_0x536f('0x12')](0x1f5,[_0x20d3b2['uniqueid'],_0x592601[_0x536f('0x1a')][_0x536f('0x64')]()][_0x536f('0x15')]('\x20')));});}else{return _0x35a31c(_0x1d8656[_0x536f('0x12')](0x1f5,_0x536f('0x69')));}});},'Agents':function(_0x3f5c11){return new Promise(function(_0x10b25d,_0x5df696){var _0xb1f728=_[_0x536f('0x5a')](_0x13426e['agents']);_0x10b25d({'count':_0xb1f728[_0x536f('0x59')],'rows':_0xb1f728});});},'Telephones':function(_0x3839fd){return new Promise(function(_0xf1d295,_0x26f622){var _0x10f019=_['values'](_0x13426e[_0x536f('0x77')]);_0xf1d295({'count':_0x10f019[_0x536f('0x59')],'rows':_0x10f019});});},'Trunks':function(_0x3373b8){return new Promise(function(_0x179400,_0x5347b3){var _0x5524c0=_[_0x536f('0x5a')](_0x13426e['trunks']);_0x179400({'count':_0x5524c0[_0x536f('0x59')],'rows':_0x5524c0});});},'OutboundChannels':function(_0x20fd70){return new Promise(function(_0x4c050c,_0x21469f){var _0x170c67=_[_0x536f('0x5a')](_0x13426e[_0x536f('0x78')]);_0x4c050c({'count':_0x170c67['length'],'rows':_0x170c67});});},'Outbound':function(_0x4583d8){return new Promise(function(_0x37cb3e,_0x5d49d6){_0x37cb3e(_0x13426e[_0x536f('0x2f')]);});},'Campaigns':function(_0x30df5){return new Promise(function(_0x253bc7,_0x595884){var _0xefebe7=_[_0x536f('0x5a')](_0x13426e['campaigns']);_0x253bc7({'count':_0xefebe7[_0x536f('0x59')],'rows':_0xefebe7});});},'VoiceQueuesPreview':function(_0x3b842e){var _0x58b4db=this;return new Promise(function(_0x3bad18,_0x49038f){_0x16e88c[_0x536f('0x79')](_0x3b842e['id'])[_0x536f('0x19')](function(_0x55c924){_0x3bad18({'code':0xc8,'message':_0x55c924[_0x536f('0x1a')]});})[_0x536f('0x1b')](function(_0x451dda){_0x49038f(_0x58b4db[_0x536f('0x12')](0x1f4,_0x451dda['message']));});});},'EventManager':function(_0x1a17fe){var _0x4b24e2=this;return new Promise(function(_0x528a71,_0x295b64){if(!_0x1a17fe[_0x536f('0x7a')]){return _0x295b64(_0x4b24e2[_0x536f('0x12')](0x1f4,_0x536f('0x7b')));}ami[_0x536f('0x7c')](_0x536f('0x7d')+_0x1a17fe[_0x536f('0x7a')],_0x1a17fe['message']);_0x528a71({'code':0xc8,'message':_0x1a17fe});});},'FaxAccounts':function(_0x1453e9){return new Promise(function(_0x36dbdd,_0x1f7186){var _0x3f861d=_[_0x536f('0x5a')](_0x13426e[_0x536f('0x7e')]);_0x36dbdd({'count':_0x3f861d[_0x536f('0x59')],'rows':_0x3f861d});});},'SendFax':function(_0x54a168){var _0xc79388=this;return new Promise(function(_0x39c1c5,_0x4b6258){_0x1aa461['send'](_0x54a168)[_0x536f('0x19')](function(_0x5dd91f){_0x39c1c5({'code':0xc8,'message':_0x5dd91f['message']});})[_0x536f('0x1b')](function(_0xf5dda1){_0x4b6258(_0xc79388['error'](0x1f4,_0xf5dda1[_0x536f('0x1a')]));});});},'CheckAfterSend':function(_0x91de8c){var _0xce84c7=this;return new Promise(function(_0x44512c,_0x12fe4b){_0x1aa461[_0x536f('0x7f')](_0x91de8c)['then'](function(_0x2e2721){_0x44512c({'code':0xc8,'message':_0x2e2721[_0x536f('0x1a')]});})['catch'](function(_0x4ba348){_0x12fe4b(_0xce84c7['error'](0x1f4,_0x4ba348['message']));});});}};var _0x14706d=jayson[_0x536f('0x80')](_0x285bda)[_0x536f('0x81')]();_0x14706d['on']('error',function(_0x29d655){return _0x510630(_0x29d655);});_0x14706d[_0x536f('0x8')](0x232a,_0x536f('0x82'),function(){console['log'](_0x536f('0x83'),0x232a);return _0x1f3090(_0x536f('0x84')+0x232a);});});}; \ No newline at end of file +var _0xebcc=['event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','validate','bluebird','../properties','../ami','listen','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','asterisk','username','join','pick','keys','module','action','Reload','Action','then','catch','error','message','isConnected','ami\x20disconnected','command','Command','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','values','channels','voicechannel','length','map','find','uniqueid','channel','format','%s.%s','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','campaigns','run'];(function(_0x4b03c6,_0x3a9381){var _0x4bb581=function(_0x243b05){while(--_0x243b05){_0x4b03c6['push'](_0x4b03c6['shift']());}};_0x4bb581(++_0x3a9381);}(_0xebcc,0x96));var _0xcebc=function(_0x3716c8,_0xa1ab08){_0x3716c8=_0x3716c8-0x0;var _0x541202=_0xebcc[_0x3716c8];return _0x541202;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0xcebc('0x0'));var schema=require(_0xcebc('0x1'));var BPromise=require(_0xcebc('0x2'));var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0xcebc('0x3'));var ami=require(_0xcebc('0x4'));exports[_0xcebc('0x5')]=function(_0x55fd3a,_0x1b28e5,_0x4ae14f){return new BPromise(function(_0x3ccbfc,_0x3aa7a8){var _0x25d789={'QueuePause':function(_0x54b21f){return new Promise(function(_0x234fe4,_0x507dd5){var _0x1572f5=util['format'](_0xcebc('0x6'),_0xcebc('0x7'),_0x54b21f[_0xcebc('0x8')]);if(_0x55fd3a['timers']&&_0x55fd3a[_0xcebc('0x9')][_0x1572f5]&&_0x55fd3a['timers'][_0x1572f5]['timer']){_0x55fd3a[_0xcebc('0x9')][_0x1572f5][_0xcebc('0xa')]();}if(_0x55fd3a[_0xcebc('0xb')][_0x1572f5]){_0x55fd3a[_0xcebc('0xb')][_0x1572f5][_0xcebc('0xc')]({'statePause':_0x54b21f[_0xcebc('0xd')]?!![]:![]});}_0x234fe4({'code':0xc8,'message':_0xcebc('0xe')});});},'Reload':function(_0x4085d0){var _0x4928bb=this;return new Promise(function(_0x553048,_0x246325){if(ami['isConnected']()==![]){return _0x246325(_0x4928bb['error'](0x1f4,[config[_0xcebc('0xf')]['ip'],config[_0xcebc('0xf')][_0xcebc('0x10')],'ami\x20disconnected'][_0xcebc('0x11')]('\x20')));}_0x4085d0=_[_0xcebc('0x12')](_0x4085d0,_[_0xcebc('0x13')](properties[_0xcebc('0x14')]));_0x4085d0[_0xcebc('0x15')]=_0xcebc('0x16');return ami[_0xcebc('0x17')](_0x4085d0)[_0xcebc('0x18')](function(_0x291439){_0x553048({'code':0xc8,'message':_0x291439['message']});})[_0xcebc('0x19')](function(_0x221faa){_0x246325(_0x4928bb[_0xcebc('0x1a')](0x1f5,_0x221faa[_0xcebc('0x1b')]));});});},'Command':function(_0x49b67e){var _0x53dfda=this;return new Promise(function(_0x176250,_0x20f98a){if(ami[_0xcebc('0x1c')]()==![]){return _0x20f98a(_0x53dfda[_0xcebc('0x1a')](0x1f4,[config[_0xcebc('0xf')]['ip'],config[_0xcebc('0xf')]['username'],_0xcebc('0x1d')][_0xcebc('0x11')]('\x20')));}_0x49b67e=_['pick'](_0x49b67e,_0xcebc('0x1e'));_0x49b67e[_0xcebc('0x15')]=_0xcebc('0x1f');return ami[_0xcebc('0x17')](_0x49b67e)['then'](function(_0x4eeb29){_0x176250({'code':0xc8,'message':_0x4eeb29[_0xcebc('0x20')]});})[_0xcebc('0x19')](function(_0x31c556){_0x20f98a(_0x53dfda['error'](0x1f5,_0x31c556['message']));});});},'VoiceQueues':function(_0xc6df85){return new Promise(function(_0x29176b,_0x48b403){var _0x32e461=[];for(var _0x5d945f in _0x55fd3a[_0xcebc('0x21')]){if(_0x55fd3a[_0xcebc('0x21')][_0xcebc('0x22')](_0x5d945f)){var _0x47463d=_0x55fd3a[_0xcebc('0x21')][_0x5d945f];var _0x57a4fd={'id':_0x47463d['id'],'name':_0x47463d[_0xcebc('0x8')],'strategy':_0x47463d[_0xcebc('0x23')],'answered':_0x47463d[_0xcebc('0x24')],'available':_0x47463d[_0xcebc('0x25')],'loggedIn':_0x47463d[_0xcebc('0x26')],'pTalking':_0x47463d[_0xcebc('0x27')],'sumBillable':_0x47463d[_0xcebc('0x28')],'sumDuration':_0x47463d[_0xcebc('0x29')],'sumHoldTime':_0x47463d[_0xcebc('0x2a')]||0x0,'talking':_0x47463d[_0xcebc('0x2b')],'total':_0x47463d[_0xcebc('0x2c')],'type':_0x47463d[_0xcebc('0x2d')],'unmanaged':_0x47463d[_0xcebc('0x2e')],'abandoned':_0x47463d['abandoned'],'waiting':_0x47463d['waiting'],'loggedInDb':_0x47463d[_0xcebc('0x2f')]};if(_0x47463d['type']===_0xcebc('0x30')){_0x57a4fd[_0xcebc('0x31')]=_0x47463d['dialActive'];_0x57a4fd[_0xcebc('0x32')]=_0x47463d[_0xcebc('0x32')];_0x57a4fd[_0xcebc('0x33')]=_0x47463d[_0xcebc('0x33')];_0x57a4fd[_0xcebc('0x34')]=_0x47463d[_0xcebc('0x34')];_0x57a4fd[_0xcebc('0x35')]=_0x47463d[_0xcebc('0x35')];_0x57a4fd[_0xcebc('0x36')]=_0x47463d[_0xcebc('0x36')];_0x57a4fd[_0xcebc('0x37')]=_0x47463d[_0xcebc('0x37')];_0x57a4fd[_0xcebc('0x38')]=_0x47463d[_0xcebc('0x38')];_0x57a4fd[_0xcebc('0x39')]=_0x47463d[_0xcebc('0x39')];_0x57a4fd[_0xcebc('0x3a')]=_0x47463d[_0xcebc('0x3a')];_0x57a4fd[_0xcebc('0x3b')]=_0x47463d[_0xcebc('0x3b')];_0x57a4fd[_0xcebc('0x3c')]=_0x47463d[_0xcebc('0x3c')];_0x57a4fd[_0xcebc('0x3d')]=_0x47463d[_0xcebc('0x3d')];_0x57a4fd[_0xcebc('0x3e')]=_0x47463d[_0xcebc('0x3e')];_0x57a4fd[_0xcebc('0x3f')]=_0x47463d['outboundNoAnswerCallsDay'];_0x57a4fd[_0xcebc('0x40')]=_0x47463d[_0xcebc('0x40')];_0x57a4fd[_0xcebc('0x41')]=_0x47463d[_0xcebc('0x41')];_0x57a4fd[_0xcebc('0x42')]=_0x47463d[_0xcebc('0x42')];_0x57a4fd[_0xcebc('0x43')]=_0x47463d[_0xcebc('0x43')];_0x57a4fd[_0xcebc('0x44')]=_0x47463d['outboundUnknownCallsDay'];_0x57a4fd['predictiveIntervalAnsweredCalls']=_0x47463d['predictiveIntervalAnsweredCalls'];_0x57a4fd[_0xcebc('0x45')]=_0x47463d[_0xcebc('0x45')];_0x57a4fd[_0xcebc('0x46')]=_0x47463d['predictiveIntervalAvgTalktime'];_0x57a4fd[_0xcebc('0x47')]=_0x47463d[_0xcebc('0x47')];_0x57a4fd[_0xcebc('0x48')]=_0x47463d[_0xcebc('0x48')];_0x57a4fd[_0xcebc('0x49')]=_0x47463d[_0xcebc('0x49')];_0x57a4fd[_0xcebc('0x4a')]=_0x47463d[_0xcebc('0x4a')];_0x57a4fd['predictiveIntervalHitRate']=_0x47463d['predictiveIntervalHitRate'];_0x57a4fd['predictiveIntervalMultiplicativeFactor']=_0x47463d['predictiveIntervalMultiplicativeFactor'];_0x57a4fd[_0xcebc('0x4b')]=_0x47463d[_0xcebc('0x4b')];_0x57a4fd[_0xcebc('0x4c')]=_0x47463d['predictiveIntervalAvailable'];_0x57a4fd[_0xcebc('0x4d')]=_0x47463d[_0xcebc('0x4d')];_0x57a4fd[_0xcebc('0x1b')]=_0x47463d[_0xcebc('0x1b')];_0x57a4fd[_0xcebc('0x4e')]=_0x47463d[_0xcebc('0x4e')];_0x57a4fd[_0xcebc('0x4f')]=_0x47463d[_0xcebc('0x4f')];_0x57a4fd[_0xcebc('0x50')]=_0x47463d[_0xcebc('0x50')];_0x57a4fd[_0xcebc('0x51')]=_0x47463d[_0xcebc('0x51')];_0x57a4fd['erlangBusyFactor']=_0x47463d[_0xcebc('0x52')];_0x57a4fd[_0xcebc('0x53')]=_0x47463d[_0xcebc('0x53')];_0x57a4fd[_0xcebc('0x54')]=_0x47463d['startProgressive'];}if(_0x47463d[_0xcebc('0x55')]){_0x57a4fd[_0xcebc('0x55')]={'id':_0x47463d['Trunk']['id'],'name':_0x47463d[_0xcebc('0x55')]['name'],'active':_0x47463d[_0xcebc('0x55')][_0xcebc('0x56')],'callerid':_0x47463d[_0xcebc('0x55')][_0xcebc('0x57')]};}if(_0x47463d[_0xcebc('0x58')]){_0x57a4fd[_0xcebc('0x58')]={'id':_0x47463d[_0xcebc('0x58')]['id'],'name':_0x47463d[_0xcebc('0x58')]['name']};}_0x32e461[_0xcebc('0x59')](_0x57a4fd);}}_0x29176b({'count':_0x32e461['length'],'rows':_0x32e461});});},'VoiceChannels':function(_0x3c5fbe){return new Promise(function(_0x3687bb,_0x1535a8){var _0x516e83=_[_0xcebc('0x5a')](_0x55fd3a[_0xcebc('0x5b')]);_0x3687bb({'count':_0x516e83['length'],'rows':_0x516e83});});},'VoiceChannelMixMonitor':function(_0x30b0ca){var _0x3f2826=this;return new Promise(function(_0x98ecbe,_0x1eb3e7){if(ami['isConnected']()==![]){return _0x1eb3e7(_0x3f2826['error'](0x1f4,[config[_0xcebc('0xf')]['ip'],config[_0xcebc('0xf')][_0xcebc('0x10')],_0xcebc('0x1d')]['join']('\x20')));}var _0x30623c=schema(properties[_0xcebc('0x5c')])[_0xcebc('0x1')](_0x30b0ca);if(_0x30623c[_0xcebc('0x5d')]>0x0){return _0x1eb3e7(_0x3f2826[_0xcebc('0x1a')](0x1f4,_[_0xcebc('0x5e')](_0x30623c,_0xcebc('0x1b'))[_0xcebc('0x11')](',\x20')));}var _0x5be0f3=_[_0xcebc('0x5f')](_0x55fd3a[_0xcebc('0x5b')],{'uniqueid':_0x30b0ca[_0xcebc('0x60')]});if(_0x5be0f3&&_0x5be0f3[_0xcebc('0x61')]){var _0x518867=util[_0xcebc('0x62')](_0xcebc('0x63'),_0x30b0ca['filename']||_0x30b0ca['uniqueid'],_0x30b0ca[_0xcebc('0x62')]||_0xcebc('0x64'));return ami[_0xcebc('0x17')]({'action':'MixMonitor','channel':_0x5be0f3[_0xcebc('0x61')],'file':_0x518867,'options':_0xcebc('0x65')})[_0xcebc('0x18')](function(_0x4778bb){var _0x43a46d=_[_0xcebc('0x5f')](_0x5be0f3[_0xcebc('0x66')],{'filename':_0xcebc('0x67')+_0x518867[_0xcebc('0x68')]()});if(_['isNil'](_0x43a46d)){_0x5be0f3[_0xcebc('0x66')][_0xcebc('0x59')]({'filename':_0xcebc('0x67')+_0x518867[_0xcebc('0x68')](),'createdAt':moment()[_0xcebc('0x62')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x4778bb[_0xcebc('0x69')],'status':'rec'});}else{_0x43a46d[_0xcebc('0x69')]=_0x4778bb[_0xcebc('0x69')];_0x43a46d[_0xcebc('0x6a')]='rec';}_0x98ecbe({'code':0xc8,'message':[_0x30b0ca[_0xcebc('0x60')],_0xcebc('0x6b'),_0x4778bb[_0xcebc('0x69')]][_0xcebc('0x11')]('\x20'),'mixmonitorid':_0x4778bb[_0xcebc('0x69')]});})[_0xcebc('0x19')](function(_0x528a91){_0x1eb3e7(_0x3f2826[_0xcebc('0x1a')](0x1f5,[_0x30b0ca['uniqueid'],_0x528a91[_0xcebc('0x1b')][_0xcebc('0x68')]()][_0xcebc('0x11')]('\x20')));});}else{return _0x1eb3e7(_0x3f2826[_0xcebc('0x1a')](0x1f5,_0xcebc('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x2d0cc4){var _0x4f2991=this;return new Promise(function(_0x4762d7,_0x35c978){if(ami[_0xcebc('0x1c')]()==![]){return _0x35c978(_0x4f2991[_0xcebc('0x1a')](0x1f4,[config[_0xcebc('0xf')]['ip'],config[_0xcebc('0xf')]['username'],'ami\x20disconnected'][_0xcebc('0x11')]('\x20')));}var _0xf0c756=schema(properties['voicechannel'])[_0xcebc('0x1')](_0x2d0cc4);if(_0xf0c756[_0xcebc('0x5d')]>0x0){return _0x35c978(_0x4f2991[_0xcebc('0x1a')](0x1f4,_[_0xcebc('0x5e')](_0xf0c756,_0xcebc('0x1b'))[_0xcebc('0x11')](',\x20')));}var _0x23f03d=_[_0xcebc('0x5f')](_0x55fd3a[_0xcebc('0x5b')],{'uniqueid':_0x2d0cc4[_0xcebc('0x60')]});if(_0x23f03d){return BPromise[_0xcebc('0x6d')]()[_0xcebc('0x18')](function(){if(_0x23f03d[_0xcebc('0x61')]){return ami[_0xcebc('0x17')]({'action':_0xcebc('0x6e'),'channel':_0x23f03d['channel'],'mixmonitorid':_0x2d0cc4['mixmonitorid']})['catch'](function(_0x228f56){});}})[_0xcebc('0x18')](function(){if(_0x23f03d['destinationchannel']){return ami['Action']({'action':_0xcebc('0x6e'),'channel':_0x23f03d['destinationchannel'],'mixmonitorid':_0x2d0cc4['mixmonitorid']})[_0xcebc('0x19')](function(_0x1c3ff0){});}})['then'](function(_0x4baf9c){var _0xda6f2e=_[_0xcebc('0x5f')](_0x23f03d[_0xcebc('0x66')],{'mixmonitorid':_0x2d0cc4['mixmonitorid']});if(_0xda6f2e){_0xda6f2e[_0xcebc('0x6a')]=_0xcebc('0x6f');}})[_0xcebc('0x18')](function(){var _0x276b48=util[_0xcebc('0x62')](_0xcebc('0x63'),_0x2d0cc4['filename']||_0x2d0cc4[_0xcebc('0x60')],_0x2d0cc4['format']||_0xcebc('0x64'));var _0x44191b=_['find'](_0x23f03d[_0xcebc('0x66')],{'filename':_0xcebc('0x67')+_0x276b48[_0xcebc('0x68')]()});if(_0x44191b){_0x44191b['status']=_0xcebc('0x6f');}})[_0xcebc('0x18')](function(){_0x4762d7({'code':0xc8,'message':[_0x2d0cc4['uniqueid'],_0xcebc('0x70')][_0xcebc('0x11')]('\x20')});})['catch'](function(_0x5d858c){_0x35c978(_0x4f2991['error'](0x1f5,[_0x2d0cc4[_0xcebc('0x60')],_0x5d858c['message'][_0xcebc('0x68')]()][_0xcebc('0x11')]('\x20')));});}else{return _0x35c978(_0x4f2991[_0xcebc('0x1a')](0x1f5,_0xcebc('0x6c')));}});},'VoiceQueuesChannels':function(_0x34b5bd){return new Promise(function(_0x3f3084,_0x258900){var _0x3a1d90=_['values'](_0x55fd3a[_0xcebc('0x71')]);_0x3f3084({'count':_0x3a1d90[_0xcebc('0x5d')],'rows':_0x3a1d90});});},'VoiceQueuesChannel':function(_0x2ea5ce){var _0x37d511=this;return new Promise(function(_0x5c7007,_0x3ef59d){var _0x195f33=schema(properties[_0xcebc('0x72')])[_0xcebc('0x1')](_0x2ea5ce);if(_0x195f33['length']>0x0){return _0x3ef59d(_0x37d511[_0xcebc('0x1a')](0x1f4,_[_0xcebc('0x5e')](_0x195f33,_0xcebc('0x1b'))[_0xcebc('0x11')](',\x20')));}var _0x5a2520=_[_0xcebc('0x5f')](_0x55fd3a[_0xcebc('0x71')],{'uniqueid':_0x2ea5ce['uniqueid']});if(_0x5a2520){_0x5c7007(_0x5a2520);}else{return _0x3ef59d(_0x37d511['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x482e9f){var _0x6f699a=this;return new Promise(function(_0x1d56a5,_0xe819df){if(ami[_0xcebc('0x1c')]()==![]){return _0xe819df(_0x6f699a[_0xcebc('0x1a')](0x1f4,[config[_0xcebc('0xf')]['ip'],config[_0xcebc('0xf')][_0xcebc('0x10')],'ami\x20disconnected'][_0xcebc('0x11')]('\x20')));}var _0x58b792=schema(properties[_0xcebc('0x73')])[_0xcebc('0x1')](_0x482e9f);if(_0x58b792['length']>0x0){return _0xe819df(_0x6f699a[_0xcebc('0x1a')](0x1f4,_['map'](_0x58b792,'message')[_0xcebc('0x11')](',\x20')));}var _0x119f2c=_[_0xcebc('0x5f')](_0x55fd3a[_0xcebc('0x71')],{'uniqueid':_0x482e9f[_0xcebc('0x60')]});if(_0x119f2c&&_0x119f2c[_0xcebc('0x61')]){return ami[_0xcebc('0x17')]({'action':_0xcebc('0x74'),'channel':_0x119f2c[_0xcebc('0x61')]})[_0xcebc('0x18')](function(_0x33ac07){_0x1d56a5({'code':0xc8,'message':[_0x482e9f[_0xcebc('0x60')],_0x33ac07[_0xcebc('0x1b')][_0xcebc('0x68')]()][_0xcebc('0x11')]('\x20')});})[_0xcebc('0x19')](function(_0x154432){_0xe819df(_0x6f699a[_0xcebc('0x1a')](0x1f5,[_0x482e9f[_0xcebc('0x60')],_0x154432['message'][_0xcebc('0x68')]()][_0xcebc('0x11')]('\x20')));});}else{return _0xe819df(_0x6f699a[_0xcebc('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3e49e9){var _0x335229=this;return new Promise(function(_0x346dd7,_0x5db6d2){if(ami[_0xcebc('0x1c')]()==![]){return _0x5db6d2(_0x335229[_0xcebc('0x1a')](0x1f4,[config[_0xcebc('0xf')]['ip'],config['asterisk'][_0xcebc('0x10')],_0xcebc('0x1d')]['join']('\x20')));}var _0x509011=schema(properties[_0xcebc('0x75')])[_0xcebc('0x1')](_0x3e49e9);if(_0x509011[_0xcebc('0x5d')]>0x0){return _0x5db6d2(_0x335229[_0xcebc('0x1a')](0x1f4,_['map'](_0x509011,'message')['join'](',\x20')));}var _0x13e8c8=_[_0xcebc('0x5f')](_0x55fd3a[_0xcebc('0x71')],{'uniqueid':_0x3e49e9['uniqueid']});if(_0x13e8c8&&_0x13e8c8[_0xcebc('0x61')]){return ami[_0xcebc('0x17')]({'action':_0xcebc('0x76'),'channel':_0x13e8c8['channel'],'exten':_0x3e49e9['exten'],'context':_0x3e49e9[_0xcebc('0x77')]||_0x13e8c8['context'],'priority':0x1})[_0xcebc('0x18')](function(_0x436728){_0x346dd7({'code':0xc8,'message':[_0x3e49e9[_0xcebc('0x60')],_0x436728[_0xcebc('0x1b')]['toLowerCase']()]['join']('\x20')});})[_0xcebc('0x19')](function(_0x24d889){_0x5db6d2(_0x335229[_0xcebc('0x1a')](0x1f5,[_0x3e49e9[_0xcebc('0x60')],_0x24d889[_0xcebc('0x1b')][_0xcebc('0x68')]()][_0xcebc('0x11')]('\x20')));});}else{return _0x5db6d2(_0x335229[_0xcebc('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0xd2141a){return new Promise(function(_0x3ca712,_0x49d6f2){var _0x897992=_['values'](_0x55fd3a[_0xcebc('0xb')]);_0x3ca712({'count':_0x897992[_0xcebc('0x5d')],'rows':_0x897992});});},'Telephones':function(_0x3f8042){return new Promise(function(_0x29b79f,_0x31b5ac){var _0x3af0d1=_[_0xcebc('0x5a')](_0x55fd3a[_0xcebc('0x78')]);_0x29b79f({'count':_0x3af0d1[_0xcebc('0x5d')],'rows':_0x3af0d1});});},'Trunks':function(_0x161b39){return new Promise(function(_0x35583c,_0x40325c){var _0x147379=_[_0xcebc('0x5a')](_0x55fd3a[_0xcebc('0x79')]);_0x35583c({'count':_0x147379['length'],'rows':_0x147379});});},'OutboundChannels':function(_0x4b2303){return new Promise(function(_0x3baf5f,_0x347619){var _0x240937=_[_0xcebc('0x5a')](_0x55fd3a['outboundChannels']);_0x3baf5f({'count':_0x240937['length'],'rows':_0x240937});});},'Outbound':function(_0x4cc5c5){return new Promise(function(_0x2b0807,_0x47d34c){_0x2b0807(_0x55fd3a['outbound']);});},'Campaigns':function(_0x5f41dd){return new Promise(function(_0xaef26f,_0x3a6cf8){var _0x59dd77=_[_0xcebc('0x5a')](_0x55fd3a[_0xcebc('0x7a')]);_0xaef26f({'count':_0x59dd77[_0xcebc('0x5d')],'rows':_0x59dd77});});},'VoiceQueuesPreview':function(_0xf191c8){var _0x2edc46=this;return new Promise(function(_0x39a9e6,_0x54e596){_0x1b28e5[_0xcebc('0x7b')](_0xf191c8['id'])['then'](function(_0x399659){_0x39a9e6({'code':0xc8,'message':_0x399659[_0xcebc('0x1b')]});})[_0xcebc('0x19')](function(_0xec0ab){_0x54e596(_0x2edc46[_0xcebc('0x1a')](0x1f4,_0xec0ab[_0xcebc('0x1b')]));});});},'EventManager':function(_0x1c6c01){var _0x29732f=this;return new Promise(function(_0x418d90,_0x16d3c9){if(!_0x1c6c01[_0xcebc('0x7c')]){return _0x16d3c9(_0x29732f[_0xcebc('0x1a')](0x1f4,_0xcebc('0x7d')));}ami[_0xcebc('0x7e')](_0xcebc('0x7f')+_0x1c6c01['event'],_0x1c6c01[_0xcebc('0x1b')]);_0x418d90({'code':0xc8,'message':_0x1c6c01});});},'FaxAccounts':function(_0x313f72){return new Promise(function(_0x3e40b2,_0xea152){var _0x70faf3=_[_0xcebc('0x5a')](_0x55fd3a[_0xcebc('0x80')]);_0x3e40b2({'count':_0x70faf3['length'],'rows':_0x70faf3});});},'SendFax':function(_0x52f929){var _0x13f017=this;return new Promise(function(_0x5a67aa,_0x31c75f){_0x4ae14f[_0xcebc('0x81')](_0x52f929)[_0xcebc('0x18')](function(_0x502ad8){_0x5a67aa({'code':0xc8,'message':_0x502ad8['message']});})[_0xcebc('0x19')](function(_0x5e1fa8){_0x31c75f(_0x13f017[_0xcebc('0x1a')](0x1f4,_0x5e1fa8['message']));});});},'CheckAfterSend':function(_0x3eb6e0){var _0xd8b5d=this;return new Promise(function(_0x23a675,_0x471a08){_0x4ae14f[_0xcebc('0x82')](_0x3eb6e0)[_0xcebc('0x18')](function(_0x21df49){_0x23a675({'code':0xc8,'message':_0x21df49[_0xcebc('0x1b')]});})[_0xcebc('0x19')](function(_0x56de60){_0x471a08(_0xd8b5d[_0xcebc('0x1a')](0x1f4,_0x56de60[_0xcebc('0x1b')]));});});}};var _0x35e5d7=jayson[_0xcebc('0x83')](_0x25d789)[_0xcebc('0x84')]();_0x35e5d7['on']('error',function(_0x41ac6b){return _0x3aa7a8(_0x41ac6b);});_0x35e5d7[_0xcebc('0x5')](0x232a,_0xcebc('0x85'),function(){console[_0xcebc('0x86')](_0xcebc('0x87'),0x232a);return _0x3ccbfc(_0xcebc('0x88')+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 ab74e12..64dce91 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 _0xf3fd=['isNil','format','user:%s','name','trigger:%s','action','toLowerCase','merge','length','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','stringify','emit','exec','data2','xmd-contactid','ListId','data3','split','destcalleridnum','calleridnum','firstName','lastName','phone','mobile','createdAt','scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','calleridname','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled'];(function(_0x795b85,_0xa0ddc9){var _0x48516a=function(_0x340f30){while(--_0x340f30){_0x795b85['push'](_0x795b85['shift']());}};_0x48516a(++_0xa0ddc9);}(_0xf3fd,0x7f));var _0xdf3f=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xf3fd[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xdf3f('0x0'));var BPromise=require(_0xdf3f('0x1'));var Redis=require('ioredis');var util=require(_0xdf3f('0x2'));var config=require(_0xdf3f('0x3'));var logger=require(_0xdf3f('0x4'))(_0xdf3f('0x5'));var cmContactRpc=require(_0xdf3f('0x6'));config[_0xdf3f('0x7')]=_[_0xdf3f('0x8')](config[_0xdf3f('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xdf3f('0x9'))(new Redis(config['redis']));function emit(_0x20cd43,_0x2e6073,_0x263a2a,_0xdbe17c,_0x1f40e0){logger[_0xdf3f('0xa')]('[CM][%s][%s]',_0x20cd43,_0x2e6073['id'],_0x263a2a,_0xdbe17c,JSON[_0xdf3f('0xb')](_0x1f40e0));io['to'](_0x263a2a)[_0xdf3f('0xc')](_0xdbe17c,_0x1f40e0);}exports[_0xdf3f('0xd')]=function(_0x36645e,_0x396b47,_0x17cd68,_0x4fa68c){var _0x1a513e,_0x41ba36;var _0x566907={};var _0x4adca8=Number(_0x17cd68['data1']);var _0x1379ab=_0x17cd68[_0xdf3f('0xe')]?Boolean(Number(_0x17cd68[_0xdf3f('0xe')])):![];var _0x28e14d;if(_0x4fa68c['xmd-contactid']){_0x566907['id']=_0x4fa68c[_0xdf3f('0xf')];}if(!_0x566907['id']){_0x566907[_0xdf3f('0x10')]=_0x4adca8;_0x28e14d=_0x17cd68['data3']&&_0x17cd68[_0xdf3f('0x11')]!=='0'?_0x17cd68[_0xdf3f('0x11')][_0xdf3f('0x12')](','):['phone'];_0x566907['$or']=_['map'](_0x28e14d,function(_0x545a2a){var _0x384c39={};_0x384c39[_0x545a2a]=_0x4fa68c['routeId']?_0x4fa68c[_0xdf3f('0x13')]:_0x4fa68c[_0xdf3f('0x14')];return _0x384c39;});}var _0x359b71=['id',_0xdf3f('0x15'),_0xdf3f('0x16'),_0xdf3f('0x17'),_0xdf3f('0x18'),'fax','ListId',_0xdf3f('0x19'),_0xdf3f('0x1a'),_0xdf3f('0x1b')];var _0x157a2f=_[_0xdf3f('0x1c')](_0x359b71,_0x28e14d);BPromise[_0xdf3f('0x1d')]()['then'](cmContactRpc[_0xdf3f('0x1e')]({'attributes':_0x157a2f,'where':_0x566907}))[_0xdf3f('0x1f')](function(_0x4131f5){_0x41ba36=_0x4131f5;if(!_[_0xdf3f('0x20')](_0x41ba36)){if(_0x41ba36['length']===0x1){_0x1a513e=_0x41ba36[0x0];logger[_0xdf3f('0xa')](_0xdf3f('0x21'),_0x4fa68c[_0xdf3f('0x22')],_0x396b47['id'],_0x1a513e['id']);}else{logger['info'](_0xdf3f('0x23'),_0x4fa68c[_0xdf3f('0x22')],_0x396b47['id'],_[_0xdf3f('0x24')](_0x41ba36,'id')[_0xdf3f('0x25')](','));}return;}else{logger[_0xdf3f('0xa')](_0xdf3f('0x26'),_0x4fa68c[_0xdf3f('0x22')],_0x396b47['id']);var _0x16e2bb={'ListId':_0x4adca8};var _0x4c2c65=_0x17cd68[_0xdf3f('0x27')]&&_0x17cd68['data4']!=='0'?_0x17cd68['data4']:_0xdf3f('0x17');if(_0x1379ab){logger[_0xdf3f('0xa')](_0xdf3f('0x28'),_0x4fa68c[_0xdf3f('0x22')],_0x396b47['id']);_0x16e2bb[_0x4c2c65]=_['isNil'](_0x4fa68c[_0xdf3f('0x29')])?_0x4fa68c[_0xdf3f('0x14')]:_0x4fa68c['destcalleridnum'];if(_['isNil'](_0x4fa68c[_0xdf3f('0x29')])){_0x16e2bb[_0xdf3f('0x15')]=_0x4fa68c[_0xdf3f('0x2a')]&&_0x4fa68c[_0xdf3f('0x2a')]!==''?_0x4fa68c[_0xdf3f('0x2a')]:_0xdf3f('0x2b');}else{_0x16e2bb[_0xdf3f('0x15')]=_0x4fa68c['destcalleridname']&&_0x4fa68c[_0xdf3f('0x2c')]!==_0xdf3f('0x2d')?_0x4fa68c[_0xdf3f('0x2c')]:_0xdf3f('0x2b');}return BPromise[_0xdf3f('0x1d')]()[_0xdf3f('0x1f')](cmContactRpc[_0xdf3f('0x2e')](_0x16e2bb))['then'](function(_0x55228a){_0x1a513e=_0x55228a;_0x41ba36[_0xdf3f('0x2f')](_0x55228a);if(_0x1a513e){logger[_0xdf3f('0xa')](_0xdf3f('0x30'),_0x4fa68c['uniqueid'],_0x396b47['id'],_0x1a513e['id']);}return;});}else{logger[_0xdf3f('0xa')](_0xdf3f('0x31'),_0x4fa68c[_0xdf3f('0x22')],_0x396b47['id']);_0x16e2bb[_0x4c2c65]=_[_0xdf3f('0x32')](_0x4fa68c[_0xdf3f('0x29')])?_0x4fa68c[_0xdf3f('0x14')]:_0x4fa68c[_0xdf3f('0x13')];if(_[_0xdf3f('0x32')](_0x4fa68c[_0xdf3f('0x29')])){_0x16e2bb[_0xdf3f('0x15')]=_0x4fa68c[_0xdf3f('0x2a')]&&_0x4fa68c[_0xdf3f('0x2a')]!==_0xdf3f('0x2d')?_0x4fa68c['calleridname']:'Unknown';}else{_0x16e2bb[_0xdf3f('0x15')]=_0x4fa68c['destcalleridname']&&_0x4fa68c[_0xdf3f('0x2c')]!==_0xdf3f('0x2d')?_0x4fa68c[_0xdf3f('0x2c')]:'Unknown';}_0x1a513e=_0x16e2bb;_0x41ba36['push'](_0x16e2bb);return;}}})['then'](function(){if(_0x36645e){emit(_0x4fa68c[_0xdf3f('0x22')],_0x396b47,util[_0xdf3f('0x33')](_0xdf3f('0x34'),_0x36645e[_0xdf3f('0x35')]),util[_0xdf3f('0x33')](_0xdf3f('0x36'),_0x17cd68[_0xdf3f('0x37')][_0xdf3f('0x38')]()),{'evt':_[_0xdf3f('0x39')](_0x4fa68c,{'autoCreate':_0x1379ab}),'contact':_0x1a513e===undefined?{}:_0x1a513e,'contacts':_0x41ba36[_0xdf3f('0x3a')]===0x0?undefined:_0x41ba36});}});}; \ No newline at end of file +var _0xbc7a=['format','user:%s','name','trigger:%s','merge','lodash','bluebird','ioredis','util','../../../../config/logger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','phone','$or','map','routeId','destcalleridnum','calleridnum','lastName','createdAt','scheduledAt','updatedAt','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','firstName','','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','calleridname'];(function(_0x2f224d,_0x38f8ec){var _0x38364c=function(_0x4e57d4){while(--_0x4e57d4){_0x2f224d['push'](_0x2f224d['shift']());}};_0x38364c(++_0x38f8ec);}(_0xbc7a,0x149));var _0xabc7=function(_0x1d0678,_0x2ed2b8){_0x1d0678=_0x1d0678-0x0;var _0x462fc6=_0xbc7a[_0x1d0678];return _0x462fc6;};'use strict';var _=require(_0xabc7('0x0'));var BPromise=require(_0xabc7('0x1'));var Redis=require(_0xabc7('0x2'));var util=require(_0xabc7('0x3'));var config=require('../../../../config/environment');var logger=require(_0xabc7('0x4'))('trigger');var cmContactRpc=require(_0xabc7('0x5'));config[_0xabc7('0x6')]=_[_0xabc7('0x7')](config[_0xabc7('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xabc7('0x8'))(new Redis(config[_0xabc7('0x6')]));function emit(_0x3f5134,_0x1e0508,_0x1cf5a9,_0x5285aa,_0x48e52d){logger[_0xabc7('0x9')](_0xabc7('0xa'),_0x3f5134,_0x1e0508['id'],_0x1cf5a9,_0x5285aa,JSON[_0xabc7('0xb')](_0x48e52d));io['to'](_0x1cf5a9)[_0xabc7('0xc')](_0x5285aa,_0x48e52d);}exports[_0xabc7('0xd')]=function(_0x24535a,_0x2a78bc,_0x13e4db,_0x18d05c){var _0xa790d7,_0x1faa0d;var _0x324300={};var _0x33a7e0=Number(_0x13e4db[_0xabc7('0xe')]);var _0x145fab=_0x13e4db['data2']?Boolean(Number(_0x13e4db[_0xabc7('0xf')])):![];var _0x1126e9;if(_0x18d05c[_0xabc7('0x10')]){_0x324300['id']=_0x18d05c[_0xabc7('0x10')];}if(!_0x324300['id']){_0x324300[_0xabc7('0x11')]=_0x33a7e0;_0x1126e9=_0x13e4db[_0xabc7('0x12')]&&_0x13e4db['data3']!=='0'?_0x13e4db[_0xabc7('0x12')]['split'](','):[_0xabc7('0x13')];_0x324300[_0xabc7('0x14')]=_[_0xabc7('0x15')](_0x1126e9,function(_0x10ddf5){var _0x27e727={};_0x27e727[_0x10ddf5]=_0x18d05c[_0xabc7('0x16')]?_0x18d05c[_0xabc7('0x17')]:_0x18d05c[_0xabc7('0x18')];return _0x27e727;});}var _0x10031f=['id','firstName',_0xabc7('0x19'),_0xabc7('0x13'),'mobile','fax',_0xabc7('0x11'),_0xabc7('0x1a'),_0xabc7('0x1b'),_0xabc7('0x1c')];var _0x7d1848=_['union'](_0x10031f,_0x1126e9);BPromise['resolve']()[_0xabc7('0x1d')](cmContactRpc['getContacts']({'attributes':_0x7d1848,'where':_0x324300}))[_0xabc7('0x1d')](function(_0x15d03b){_0x1faa0d=_0x15d03b;if(!_[_0xabc7('0x1e')](_0x1faa0d)){if(_0x1faa0d[_0xabc7('0x1f')]===0x1){_0xa790d7=_0x1faa0d[0x0];logger[_0xabc7('0x9')](_0xabc7('0x20'),_0x18d05c[_0xabc7('0x21')],_0x2a78bc['id'],_0xa790d7['id']);}else{logger[_0xabc7('0x9')](_0xabc7('0x22'),_0x18d05c['uniqueid'],_0x2a78bc['id'],_[_0xabc7('0x15')](_0x1faa0d,'id')['join'](','));}return;}else{logger['info'](_0xabc7('0x23'),_0x18d05c[_0xabc7('0x21')],_0x2a78bc['id']);var _0x2792dd={'ListId':_0x33a7e0};var _0x586e97=_0x13e4db[_0xabc7('0x24')]&&_0x13e4db['data4']!=='0'?_0x13e4db[_0xabc7('0x24')]:_0xabc7('0x13');if(_0x145fab){logger[_0xabc7('0x9')](_0xabc7('0x25'),_0x18d05c['uniqueid'],_0x2a78bc['id']);_0x2792dd[_0x586e97]=_['isNil'](_0x18d05c[_0xabc7('0x16')])?_0x18d05c[_0xabc7('0x18')]:_0x18d05c[_0xabc7('0x17')];if(_[_0xabc7('0x26')](_0x18d05c[_0xabc7('0x16')])){_0x2792dd[_0xabc7('0x27')]=_0x18d05c['calleridname']&&_0x18d05c['calleridname']!==_0xabc7('0x28')?_0x18d05c['calleridname']:_0xabc7('0x29');}else{_0x2792dd[_0xabc7('0x27')]=_0x18d05c['destcalleridname']&&_0x18d05c[_0xabc7('0x2a')]!==_0xabc7('0x28')?_0x18d05c['destcalleridname']:_0xabc7('0x29');}return BPromise[_0xabc7('0x2b')]()[_0xabc7('0x1d')](cmContactRpc[_0xabc7('0x2c')](_0x2792dd))['then'](function(_0x3a459c){_0xa790d7=_0x3a459c;_0x1faa0d[_0xabc7('0x2d')](_0x3a459c);if(_0xa790d7){logger[_0xabc7('0x9')](_0xabc7('0x2e'),_0x18d05c['uniqueid'],_0x2a78bc['id'],_0xa790d7['id']);}return;});}else{logger['info'](_0xabc7('0x2f'),_0x18d05c[_0xabc7('0x21')],_0x2a78bc['id']);_0x2792dd[_0x586e97]=_[_0xabc7('0x26')](_0x18d05c['routeId'])?_0x18d05c[_0xabc7('0x18')]:_0x18d05c['destcalleridnum'];if(_[_0xabc7('0x26')](_0x18d05c[_0xabc7('0x16')])){_0x2792dd['firstName']=_0x18d05c[_0xabc7('0x30')]&&_0x18d05c['calleridname']!==_0xabc7('0x28')?_0x18d05c['calleridname']:_0xabc7('0x29');}else{_0x2792dd[_0xabc7('0x27')]=_0x18d05c[_0xabc7('0x2a')]&&_0x18d05c['destcalleridname']!==''?_0x18d05c['destcalleridname']:_0xabc7('0x29');}_0xa790d7=_0x2792dd;_0x1faa0d[_0xabc7('0x2d')](_0x2792dd);return;}}})[_0xabc7('0x1d')](function(){if(_0x24535a){emit(_0x18d05c[_0xabc7('0x21')],_0x2a78bc,util[_0xabc7('0x31')](_0xabc7('0x32'),_0x24535a[_0xabc7('0x33')]),util[_0xabc7('0x31')](_0xabc7('0x34'),_0x13e4db['action']['toLowerCase']()),{'evt':_[_0xabc7('0x35')](_0x18d05c,{'autoCreate':_0x145fab}),'contact':_0xa790d7===undefined?{}:_0xa790d7,'contacts':_0x1faa0d[_0xabc7('0x1f')]===0x0?undefined:_0x1faa0d});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 47bee01..4d17d7f 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 _0x6752=['winArguments','format','name','data1','jscripty','user:%s','exec','queue','routeId','urlforward','script','parse','search','replace','AllConditions','every','checkConditions','channel','some','field','account','chat','operator','value','upperFirst','AccountId','interaction','message','event','membername','lastevent','exports','util','lodash','url','mustache','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','custom:dialend','syncAgentDial','custom:newinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','action','toLowerCase','browser','TemplateId','data2','html','render','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','600'];(function(_0x4f188a,_0x3a892d){var _0x21fd89=function(_0xbcd9ee){while(--_0xbcd9ee){_0x4f188a['push'](_0x4f188a['shift']());}};_0x21fd89(++_0x3a892d);}(_0x6752,0x96));var _0x2675=function(_0x356882,_0x35b140){_0x356882=_0x356882-0x0;var _0x4c062b=_0x6752[_0x356882];return _0x4c062b;};'use strict';var util=require(_0x2675('0x0'));var _=require(_0x2675('0x1'));var url=require(_0x2675('0x2'));var Mustache=require(_0x2675('0x3'));var Redis=require('ioredis');var urlforward=require(_0x2675('0x4'));var integration=require(_0x2675('0x5'));var cmContact=require(_0x2675('0x6'));var script=require(_0x2675('0x7'));var config=require(_0x2675('0x8'));var logger=require(_0x2675('0x9'))(_0x2675('0xa'));var ami=require(_0x2675('0xb'));config[_0x2675('0xc')]=_['defaults'](config[_0x2675('0xc')],{'host':_0x2675('0xd'),'port':0x18eb});var io=require(_0x2675('0xe'))(new Redis(config[_0x2675('0xc')]));var operators={'equals':function(_0xfb4db4,_0x5c8994){return _0xfb4db4==_0x5c8994;},'not_equals':function(_0x5d12c6,_0x28f988){return _0x5d12c6!=_0x28f988;}};var barAndWebActions=[_0x2675('0xf'),_0x2675('0x2'),_0x2675('0x10')];function Trigger(_0x438df7){this[_0x2675('0x11')]=_0x438df7['triggers'];this[_0x2675('0x12')]=_0x438df7[_0x2675('0x12')];this[_0x2675('0x13')]=_0x438df7[_0x2675('0x13')];this[_0x2675('0x14')]=_0x438df7[_0x2675('0x14')];this[_0x2675('0x15')]=_0x438df7[_0x2675('0x15')];this[_0x2675('0x16')]=_0x438df7['zendeskAccounts'];this[_0x2675('0x17')]=_0x438df7[_0x2675('0x17')];this['salesforceAccounts']=_0x438df7[_0x2675('0x18')];this['sugarcrmAccounts']=_0x438df7[_0x2675('0x19')];this['zohoAccounts']=_0x438df7[_0x2675('0x1a')];this['deskAccounts']=_0x438df7[_0x2675('0x1b')];this[_0x2675('0x1c')]=_0x438df7[_0x2675('0x1c')];this[_0x2675('0x1d')]=_0x438df7['servicenowAccounts'];this['dynamics365Accounts']=_0x438df7[_0x2675('0x1e')];this['freshsalesAccounts']=_0x438df7[_0x2675('0x1f')];this[_0x2675('0x20')]={'zendesk':this[_0x2675('0x16')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x2675('0x17')],'sugarcrm':this[_0x2675('0x19')],'zoho':this[_0x2675('0x1a')],'desk':this[_0x2675('0x1b')],'vtiger':this[_0x2675('0x1c')],'dynamics365':this[_0x2675('0x1e')],'freshsales':this[_0x2675('0x1f')],'servicenow':this[_0x2675('0x1d')]};ami['on'](_0x2675('0x21'),this[_0x2675('0x22')][_0x2675('0x23')](this));ami['on'](_0x2675('0x24'),this[_0x2675('0x22')]['bind'](this));ami['on'](_0x2675('0x25'),this['syncCustomEvent'][_0x2675('0x23')](this));ami['on'](_0x2675('0x26'),this[_0x2675('0x22')][_0x2675('0x23')](this));ami['on'](_0x2675('0x27'),this[_0x2675('0x22')][_0x2675('0x23')](this));ami['on'](_0x2675('0x28'),this[_0x2675('0x22')][_0x2675('0x23')](this));ami['on']('custom:agentbusy',this[_0x2675('0x22')]['bind'](this));ami['on'](_0x2675('0x29'),this[_0x2675('0x22')][_0x2675('0x23')](this));ami['on'](_0x2675('0x2a'),this[_0x2675('0x22')]['bind'](this));ami['on'](_0x2675('0x2b'),this[_0x2675('0x22')][_0x2675('0x23')](this));ami['on'](_0x2675('0x2c'),this[_0x2675('0x22')][_0x2675('0x23')](this));ami['on'](_0x2675('0x2d'),this['syncAgentDial']['bind'](this));ami['on'](_0x2675('0x2e'),this['syncAgentDial'][_0x2675('0x23')](this));ami['on'](_0x2675('0x2f'),this[_0x2675('0x30')][_0x2675('0x23')](this));ami['on'](_0x2675('0x31'),this[_0x2675('0x22')][_0x2675('0x23')](this));ami['on']('custom:closedinteraction',this[_0x2675('0x22')][_0x2675('0x23')](this));ami['on'](_0x2675('0x32'),this[_0x2675('0x22')][_0x2675('0x23')](this));ami['on'](_0x2675('0x33'),this[_0x2675('0x22')][_0x2675('0x23')](this));ami['on'](_0x2675('0x34'),this['syncCustomEvent'][_0x2675('0x23')](this));ami['on'](_0x2675('0x35'),this[_0x2675('0x22')][_0x2675('0x23')](this));}Trigger[_0x2675('0x36')][_0x2675('0x37')]=function(_0x2d823f,_0x346a5a,_0x16385d){logger[_0x2675('0x38')](_0x2d823f,_0x346a5a,JSON['stringify'](_0x16385d));io['to'](_0x2d823f)['emit'](_0x346a5a,_0x16385d);};Trigger[_0x2675('0x36')][_0x2675('0x22')]=function(_0x3bf301){var _0xd0ad0f=_['clone'](_0x3bf301);this[_0x2675('0x39')](_0xd0ad0f);};Trigger[_0x2675('0x36')][_0x2675('0x30')]=function(_0x289420){if(this[_0x2675('0x12')][_0x289420[_0x2675('0x3a')]]){this[_0x2675('0x22')](_0x289420);}};Trigger[_0x2675('0x36')]['checkTriggers']=function(_0x105ee3){var _0x43e84c;for(var _0x1147af in this[_0x2675('0x11')]){if(this[_0x2675('0x11')][_0x2675('0x3b')](_0x1147af)){if(this[_0x2675('0x11')][_0x1147af][_0x2675('0x3c')]){_0x43e84c=this[_0x2675('0x3d')](this[_0x2675('0x11')][_0x1147af],_0x105ee3);if(_0x43e84c){_[_0x2675('0x3e')](_0x105ee3,_0x105ee3[_0x2675('0x3f')]);for(var _0x5c528d=0x0,_0x46663f,_0x208d11,_0x23ab3a;_0x5c528d0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file +var _0xa9e0=['Getting\x20agent\x20with\x20email','format','total_entries','find','_embedded','entries','then','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','%s/customers/search','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','work','length','map','forEach','type','string','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','custom_fields','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','phone','Motion','CTI','Tags','Descriptions','user','Fields','%s/customers/%d/cases','POST','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','catch','monitor_format','lastevent','lodash','request-promise','md5','./util','../../../../config/logger','desk','redis','defaults','socket.io-emitter','emit','validateEmail','info'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var md5=require(_0x0a9e('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x0a9e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));config[_0x0a9e('0x6')]=_[_0x0a9e('0x7')](config[_0x0a9e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0x8'))(new Redis(config[_0x0a9e('0x6')]));function emit(_0x2cc193,_0x5f41ea,_0x503809){io['to'](_0x2cc193)[_0x0a9e('0x9')](_0x5f41ea,_0x503809);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x39753a,_0xf81284){if(intUtil[_0x0a9e('0xa')](_0xf81284)===!![]){logger[_0x0a9e('0xb')](_0x0a9e('0xc'),_0xf81284);return request({'uri':util[_0x0a9e('0xd')]('%s/users',_0x39753a['remoteUri'])})['then'](function(_0x4cfe67){if(_0x4cfe67[_0x0a9e('0xe')]){return _[_0x0a9e('0xf')](_0x4cfe67[_0x0a9e('0x10')][_0x0a9e('0x11')],{'email':_0xf81284});}})[_0x0a9e('0x12')](function(_0x69aeb7){if(_0x69aeb7){logger['info'](_0x0a9e('0x13'));return _0x69aeb7;}else{logger[_0x0a9e('0xb')](_0x0a9e('0x14'));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x15'),_0x39753a[_0x0a9e('0x16')])});}});}else{logger['info'](_0x0a9e('0x17'));return request({'uri':util['format'](_0x0a9e('0x15'),_0x39753a['remoteUri'])});}}function request(_0x16033c){logger[_0x0a9e('0x18')]('[HTTP]',JSON[_0x0a9e('0x19')](_0x16033c));return rp(_['defaults'](_0x16033c,{'method':_0x0a9e('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x478723){var _0x106033;if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x1c')){_0x106033=util[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x1f')]);}else if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x20')){_0x106033=util[_0x0a9e('0xd')]('%s/token:%s',_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x20')]);}return util['format'](_0x0a9e('0x21'),new Buffer(_0x106033)['toString']('base64'));}function getEndUser(_0x3a02e1,_0x432e56,_0x38e7c4){logger[_0x0a9e('0xb')]('Searching\x20enduser\x20with\x20phone',_0x38e7c4);return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x22'),_0x3a02e1[_0x0a9e('0x16')]),'qs':{'phone':_0x38e7c4}})[_0x0a9e('0x12')](function(_0x370d86){if(_0x370d86[_0x0a9e('0xe')]){logger[_0x0a9e('0xb')]('Enduser\x20found!');return _0x370d86['_embedded'][_0x0a9e('0x11')][0x0];}else{logger[_0x0a9e('0xb')](_0x0a9e('0x23'));return request({'uri':util[_0x0a9e('0xd')]('%s/customers',_0x3a02e1[_0x0a9e('0x16')]),'method':'POST','body':{'first_name':_0x432e56,'title':_0x432e56,'phone_numbers':[{'type':_0x0a9e('0x24'),'value':_0x38e7c4}]}});}});}function getTags(_0x5bfb33,_0x1dc186){var _0x34dc65=[];if(_0x5bfb33&&_0x5bfb33[_0x0a9e('0x25')]>0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ 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 53c1b3d..146f2d6 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 _0x3431=['info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','catch','outbound','destcalleridnum','calleridnum','contacts','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','value','toLowerCase','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','string','nameField','customField','idField','indexOf','content','ticketType','incident','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecall','assign','queue','callDirection','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','lodash','util','./util','ioredis','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','length','internalemailaddress','isdisabled'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x3431,0xa1));var _0x1343=function(_0x4ea6af,_0x4aa32e){_0x4ea6af=_0x4ea6af-0x0;var _0x4cb1e6=_0x3431[_0x4ea6af];return _0x4cb1e6;};'use strict';var _=require(_0x1343('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var util=require(_0x1343('0x1'));var intUtil=require(_0x1343('0x2'));var md5=require('md5');var Redis=require(_0x1343('0x3'));var logger=require('../../../../config/logger')(_0x1343('0x4'));var config=require(_0x1343('0x5'));config[_0x1343('0x6')]=_['defaults'](config[_0x1343('0x6')],{'host':_0x1343('0x7'),'port':0x18eb});var io=require(_0x1343('0x8'))(new Redis(config['redis']));function getAuthToken(_0x46cc42,_0x3f48f6,_0x17a9de){var _0x458545={'method':_0x1343('0x9'),'uri':_0x3f48f6,'form':{'client_id':_0x46cc42[_0x1343('0xa')],'resource':_0x46cc42[_0x1343('0xb')],'username':_0x46cc42[_0x1343('0xc')],'password':_0x46cc42['password'],'grant_type':'password','client_secret':_0x46cc42['clientSecret']},'json':!![]};return rp(_0x458545)[_0x1343('0xd')](function(_0x2004e7){return _0x2004e7[_0x1343('0xe')];})['catch'](function(_0x3c50ca){logger[_0x1343('0xf')]('['+[_0x17a9de[_0x1343('0x10')]()]+_0x1343('0x11'));return _0x3c50ca[_0x1343('0x12')];});}function getUser(_0xc8a5d0,_0x139b29,_0x5cdb58,_0x24ac4c,_0x53dc71,_0x5d3104){return new BPromise(function(_0x3ec0fd,_0x21d3d9){return getAuthToken(_0x139b29,_0x24ac4c,_0x5d3104)[_0x1343('0xd')](function(_0x373266){var _0x295818={'method':_0x1343('0x13'),'uri':_0x53dc71+_0x1343('0x14'),'headers':{'Authorization':_0x1343('0x15')+_0x373266,'OData-Version':_0x1343('0x16')},'json':!![]};return rp(_0x295818);})[_0x1343('0xd')](function(_0x414e69){var _0x1666e9=_0x414e69['value'];var _0x1f2252=![];var _0x27dfce=null;if(!_[_0x1343('0x17')](_0x5cdb58)){if(intUtil[_0x1343('0x18')](_0x5cdb58['email'])){_0xc8a5d0['userEmail']=_0x5cdb58[_0x1343('0x19')];for(_0x27dfce=0x0;_0x27dfce<_0x1666e9[_0x1343('0x1a')];_0x27dfce++){if(_0x1666e9[_0x27dfce][_0x1343('0x1b')]===_0x5cdb58[_0x1343('0x19')]&&!_0x1666e9[_0x27dfce][_0x1343('0x1c')]){_0x1f2252=!![];logger[_0x1343('0x1d')]('['+[_0x5d3104[_0x1343('0x10')]()]+_0x1343('0x1e')+_0x1666e9[_0x27dfce][_0x1343('0x1f')]+'!');_0xc8a5d0[_0x1343('0x20')]=_0x1666e9[_0x27dfce]['systemuserid'];}}}}if(!_0x1f2252){logger[_0x1343('0x1d')]('['+[_0x5d3104[_0x1343('0x10')]()]+_0x1343('0x21'));_0xc8a5d0[_0x1343('0x22')]=_0x139b29[_0x1343('0xc')];for(_0x27dfce=0x0;_0x27dfce<_0x1666e9['length'];_0x27dfce++){if(_0x1666e9[_0x27dfce][_0x1343('0x1b')]===_0x139b29[_0x1343('0xc')]){_0xc8a5d0['userId']=_0x1666e9[_0x27dfce][_0x1343('0x1f')];}}}_0x3ec0fd(_0xc8a5d0);})[_0x1343('0x23')](function(_0x3a067f){_0x21d3d9(_0x3a067f[_0x1343('0x12')]);});});}function createEndUser(_0xf126c4,_0xae9f0,_0x380050,_0x3d3e04,_0x438c0e,_0x4e0929){return new BPromise(function(_0x42c254,_0x4ee1be){return getAuthToken(_0xae9f0,_0x380050,_0x4e0929)[_0x1343('0xd')](function(_0x168a83){var _0x4cea52=_0x4e0929['toLowerCase']()===_0x1343('0x24')?_0x438c0e[_0x1343('0x25')]:_0x438c0e[_0x1343('0x26')];var _0x13ce9c={'method':'POST','uri':_0x3d3e04+_0x1343('0x27'),'body':{'telephone1':_0x4cea52,'fullname':_0x4cea52,'firstname':_0x4cea52,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0xf126c4[_0x1343('0x20')]+')'},'headers':{'Authorization':_0x1343('0x15')+_0x168a83,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x13ce9c);})['then'](function(_0x25fd34){var _0x2ed114=_0x25fd34[_0x1343('0x28')][_0x1343('0x29')];var _0xf20737=_0x2ed114[_0x1343('0x2a')](_0x2ed114[_0x1343('0x2b')]('(')+0x1,_0x2ed114['lastIndexOf'](')'));_0xf126c4[_0x1343('0x2c')]=_0xf20737;_0x42c254(_0xf126c4);})[_0x1343('0x23')](function(_0x191685){_0x4ee1be(_0x191685[_0x1343('0x12')]);});});}function getEndUser(_0x343ab7,_0x450ee5,_0xfe202d,_0x32aa72,_0x251cb8,_0x294d2e){return new BPromise(function(_0x221a11,_0x24576d){return getAuthToken(_0x450ee5,_0xfe202d,_0x294d2e)['then'](function(_0x57d861){var _0x19a466={'method':_0x1343('0x13'),'uri':_0x32aa72+_0x1343('0x2d'),'headers':{'Authorization':_0x1343('0x15')+_0x57d861,'If-None-Match':null,'OData-Version':_0x1343('0x16')},'json':!![]};return rp(_0x19a466);})[_0x1343('0xd')](function(_0x1ae943){var _0x21fd3c=null;if(_0x1ae943){var _0x585632=_0x1ae943[_0x1343('0x2e')];var _0x3ec1a7=![];for(_0x21fd3c=0x0;_0x21fd3c<_0x585632['length'];_0x21fd3c++){var _0x5051d6=_0x294d2e[_0x1343('0x2f')]()===_0x1343('0x24')?_0x251cb8['destcalleridnum']:_0x251cb8[_0x1343('0x26')];if(_0x585632[_0x21fd3c][_0x1343('0x30')]===_0x5051d6){_0x3ec1a7=!![];_0x343ab7[_0x1343('0x2c')]=_0x585632[_0x21fd3c][_0x1343('0x31')];}}if(_0x3ec1a7){_0x221a11(_0x343ab7);}else{return createEndUser(_0x343ab7,_0x450ee5,_0xfe202d,_0x32aa72,_0x251cb8,_0x294d2e)[_0x1343('0xd')](function(_0x4943da){logger['info']('['+[_0x294d2e[_0x1343('0x10')]()]+_0x1343('0x32'),_0x4943da[_0x1343('0x2c')]);_0x221a11(_0x4943da);});}}else{return createEndUser(_0x343ab7,_0x450ee5,_0xfe202d,_0x32aa72,_0x251cb8,_0x294d2e)[_0x1343('0xd')](function(_0x2b4462){logger[_0x1343('0x1d')]('['+[_0x294d2e['toUpperCase']()]+_0x1343('0x33'),_0x2b4462['enduserId']);_0x221a11(_0x2b4462);});}});});}function getCustomFields(_0x4a2902,_0x36020d,_0x52e0d1){var _0x2c49bb={};if(_0x4a2902[_0x1343('0x1a')]>0x0){_[_0x1343('0x34')](_0x4a2902,function(_0x547d3e){if(_0x547d3e[_0x1343('0x35')]===_0x1343('0x36')&&_0x547d3e[_0x1343('0x37')]&&!_0x547d3e[_0x1343('0x38')]){var _0x2abac4=_0x547d3e[_0x1343('0x39')][_0x1343('0x2f')]();var _0x5d47c2=_0x2abac4[_0x1343('0x2a')](0x0,_0x2abac4['indexOf']('_'));var _0x53a21e=_0x2abac4[_0x1343('0x2a')](_0x2abac4[_0x1343('0x3a')]('_')+0x1);if(_0x5d47c2===_0x52e0d1){_0x2c49bb[_0x53a21e]=_0x547d3e[_0x1343('0x3b')];}}});}return _0x2c49bb;}function getTicket(_0x10c487,_0x29347a,_0x32def7,_0x334019,_0x2a60f4,_0x3c8991,_0x5b176f){return new BPromise(function(_0x4c700e,_0x15d582){var _0x10227;return getAuthToken(_0x29347a,_0x32def7,_0x5b176f)[_0x1343('0xd')](function(_0x45b355){if(_0x3c8991[_0x1343('0x3c')]===_0x1343('0x3d')){_0x10227={'method':_0x1343('0x9'),'uri':_0x334019+'incidents','body':Object['assign']({},{'title':intUtil[_0x1343('0x3e')](_0x3c8991[_0x1343('0x3f')],_0x2a60f4,'\x20'),'description':intUtil[_0x1343('0x3e')](_0x3c8991[_0x1343('0x40')],_0x2a60f4,'\x0a'),'customerid_contact@odata.bind':_0x1343('0x41')+_0x10c487[_0x1343('0x2c')]+')','ownerid@odata.bind':_0x1343('0x42')+_0x10c487[_0x1343('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x3c8991[_0x1343('0x43')],_0x2a60f4,_0x3c8991[_0x1343('0x3c')])),'headers':{'Authorization':_0x1343('0x15')+_0x45b355,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3c8991['ticketType']===_0x1343('0x44')){_0x10227={'method':'POST','uri':_0x334019+'phonecalls','body':Object[_0x1343('0x45')]({},{'subject':intUtil[_0x1343('0x3e')](_0x3c8991[_0x1343('0x3f')],_0x2a60f4,'\x20'),'phonenumber':String(_0x2a60f4[_0x1343('0x26')]),'description':intUtil['getString'](_0x3c8991[_0x1343('0x40')],_0x2a60f4,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x10c487[_0x1343('0x2c')]+')','ownerid@odata.bind':_0x1343('0x42')+_0x10c487['userId']+')','directioncode':_0x10c487['callDirection']===_0x1343('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x1343('0x42')+_0x10c487[_0x1343('0x20')]+')','participationtypemask':_0x10c487[_0x1343('0x47')]===_0x1343('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0x1343('0x41')+_0x10c487['enduserId']+')','participationtypemask':_0x10c487[_0x1343('0x47')]===_0x1343('0x46')?0x1:0x2}]},getCustomFields(_0x3c8991[_0x1343('0x43')],_0x2a60f4,_0x3c8991['ticketType'])),'headers':{'Authorization':_0x1343('0x15')+_0x45b355,'OData-Version':_0x1343('0x16')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x10227);})[_0x1343('0xd')](function(_0x447f9c){var _0x533e41=_0x447f9c[_0x1343('0x28')][_0x1343('0x29')];var _0x831901=_0x533e41[_0x1343('0x2a')](_0x533e41[_0x1343('0x2b')]('(')+0x1,_0x533e41['lastIndexOf'](')'));_0x10c487[_0x1343('0x48')]=_0x831901;_0x4c700e(_0x10c487);})[_0x1343('0x23')](function(_0x1626d3){_0x15d582(_0x1626d3[_0x1343('0x12')]);});});}function emit(_0x49b857,_0xef6bfa,_0x9511d1,_0x164332){var _0x1a8cda={'uri':util[_0x1343('0x49')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x49b857,_0x9511d1,_0x164332)};io['to'](util[_0x1343('0x49')](_0x1343('0x4a'),_0xef6bfa))[_0x1343('0x4b')](_0x1343('0x4c'),_0x1a8cda);}exports['cs']=function(_0x30314b,_0x102aa7,_0x4598f9,_0x15173d,_0x369862,_0x49c254,_0x832c52,_0xa9608f){var _0x4a12d7={};_0x49c254[_0x1343('0xb')]=intUtil[_0x1343('0x4d')](_0x49c254['remoteUri']);_0x49c254['serverUrl']=intUtil[_0x1343('0x4d')](_0x49c254[_0x1343('0x4e')]);_0x4a12d7[_0x1343('0x47')]=_0xa9608f==='queue'||_0xa9608f==='unmanaged'?_0x1343('0x46'):_0x1343('0x24');var _0x2004af=util[_0x1343('0x49')]('%s/api/data/v9.0/',_0x49c254['remoteUri']);var _0x4be3f1=util[_0x1343('0x49')](_0x1343('0x4f'),_0x49c254['tenantId']);var _0x2f0713=util[_0x1343('0x49')](_0x1343('0x50'),_0x49c254[_0x1343('0x4e')],_0x102aa7[_0x1343('0x51')],md5(_0x102aa7[_0x1343('0x51')]));if(_0x369862&&_0x369862[_0x1343('0x52')]){logger[_0x1343('0x1d')](_0x1343('0x53'),_0x1343('0x54'));_0x102aa7['recordingURL']=_0x2f0713;}else if(_0x832c52&&_0x832c52[_0x1343('0x55')]&&_0x832c52[_0x1343('0x55')]!==_0x1343('0x56')){logger[_0x1343('0x1d')]('[OUTBOUND]',_0x1343('0x54'));_0x102aa7['recordingURL']=_0x2f0713;}else{_0x102aa7[_0x1343('0x57')]='';}return getUser(_0x4a12d7,_0x49c254,_0x15173d,_0x4be3f1,_0x2004af,_0xa9608f)[_0x1343('0xd')](function(_0x2cc9ea){logger[_0x1343('0x1d')]('['+_0xa9608f[_0x1343('0x10')]()+_0x1343('0x58'),_0x2cc9ea[_0x1343('0x20')]);logger[_0x1343('0x1d')]('['+_0xa9608f[_0x1343('0x10')]()+']\x20The\x20User\x20email\x20is:',_0x2cc9ea['userEmail']);return getEndUser(_0x2cc9ea,_0x49c254,_0x4be3f1,_0x2004af,_0x102aa7,_0xa9608f);})['then'](function(_0x55c3f3){logger[_0x1343('0x1d')]('['+_0xa9608f['toUpperCase']()+_0x1343('0x59'),_0x55c3f3['enduserId']);logger[_0x1343('0x1d')]('['+_0xa9608f[_0x1343('0x10')]()+_0x1343('0x5a'),_0x102aa7['calleridnum']);return getTicket(_0x55c3f3,_0x49c254,_0x4be3f1,_0x2004af,_0x102aa7,_0x4598f9,_0xa9608f);})['then'](function(_0x33a0c2){logger[_0x1343('0x1d')](util['format']('['+_0xa9608f['toUpperCase']()+_0x1343('0x5b'),_0x4598f9['ticketType'],_0x33a0c2['ticketId']));logger['info'](util[_0x1343('0x49')]('['+_0xa9608f[_0x1343('0x10')]()+_0x1343('0x5c'),_0xa9608f));if(_0xa9608f!=='unmanaged'){logger[_0x1343('0x1d')]('['+_0xa9608f[_0x1343('0x10')]()+']',_0x1343('0x5d'));emit(_0x49c254[_0x1343('0xb')],_0x15173d[_0x1343('0x5e')],_0x4598f9[_0x1343('0x3c')],_0x33a0c2[_0x1343('0x48')]);}})['catch'](function(_0x5a3f28){logger[_0x1343('0xf')]('['+_0xa9608f[_0x1343('0x10')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util['inspect'](_0x5a3f28,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe8d5=['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:','userEmail',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','bluebird','request-promise','util','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','POST','clientId','remoteUri','username','password','then','access_token','error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','string','nameField','customField','idField','indexOf','incident','incidents','assign','getString','Descriptions','/contacts(','ticketType','phonecalls','Subjects','callDirection','queue','Fields','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/'];(function(_0x5e8a97,_0x168a0b){var _0x194f31=function(_0x2d24ad){while(--_0x2d24ad){_0x5e8a97['push'](_0x5e8a97['shift']());}};_0x194f31(++_0x168a0b);}(_0xe8d5,0xd7));var _0x5e8d=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0xe8d5[_0x576170];return _0x397c70;};'use strict';var _=require(_0x5e8d('0x0'));var BPromise=require(_0x5e8d('0x1'));var rp=require(_0x5e8d('0x2'));var util=require(_0x5e8d('0x3'));var intUtil=require('./util');var md5=require('md5');var Redis=require('ioredis');var logger=require(_0x5e8d('0x4'))(_0x5e8d('0x5'));var config=require(_0x5e8d('0x6'));config[_0x5e8d('0x7')]=_[_0x5e8d('0x8')](config[_0x5e8d('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5e8d('0x7')]));function getAuthToken(_0x59672f,_0x528d14,_0xbb73c){var _0x57033e={'method':_0x5e8d('0x9'),'uri':_0x528d14,'form':{'client_id':_0x59672f[_0x5e8d('0xa')],'resource':_0x59672f[_0x5e8d('0xb')],'username':_0x59672f[_0x5e8d('0xc')],'password':_0x59672f[_0x5e8d('0xd')],'grant_type':_0x5e8d('0xd'),'client_secret':_0x59672f['clientSecret']},'json':!![]};return rp(_0x57033e)[_0x5e8d('0xe')](function(_0x512d5d){return _0x512d5d[_0x5e8d('0xf')];})['catch'](function(_0x1fc454){logger[_0x5e8d('0x10')]('['+[_0xbb73c[_0x5e8d('0x11')]()]+']\x20Wrong\x20credentials!');return _0x1fc454[_0x5e8d('0x12')];});}function getUser(_0x137847,_0x2e9a51,_0x2e277e,_0x14c23d,_0x31fe11,_0x3a8e32){return new BPromise(function(_0x5714b3,_0x4f8004){return getAuthToken(_0x2e9a51,_0x14c23d,_0x3a8e32)[_0x5e8d('0xe')](function(_0x1f40c3){var _0x59c916={'method':_0x5e8d('0x13'),'uri':_0x31fe11+_0x5e8d('0x14'),'headers':{'Authorization':_0x5e8d('0x15')+_0x1f40c3,'OData-Version':_0x5e8d('0x16')},'json':!![]};return rp(_0x59c916);})[_0x5e8d('0xe')](function(_0x39d0db){var _0x459231=_0x39d0db[_0x5e8d('0x17')];var _0x17f875=![];var _0xf2db0d=null;if(!_[_0x5e8d('0x18')](_0x2e277e)){if(intUtil[_0x5e8d('0x19')](_0x2e277e[_0x5e8d('0x1a')])){_0x137847['userEmail']=_0x2e277e[_0x5e8d('0x1a')];for(_0xf2db0d=0x0;_0xf2db0d<_0x459231[_0x5e8d('0x1b')];_0xf2db0d++){if(_0x459231[_0xf2db0d][_0x5e8d('0x1c')]===_0x2e277e['email']&&!_0x459231[_0xf2db0d]['isdisabled']){_0x17f875=!![];logger[_0x5e8d('0x1d')]('['+[_0x3a8e32[_0x5e8d('0x11')]()]+_0x5e8d('0x1e')+_0x459231[_0xf2db0d][_0x5e8d('0x1f')]+'!');_0x137847[_0x5e8d('0x20')]=_0x459231[_0xf2db0d]['systemuserid'];}}}}if(!_0x17f875){logger['info']('['+[_0x3a8e32[_0x5e8d('0x11')]()]+_0x5e8d('0x21'));_0x137847['userEmail']=_0x2e9a51[_0x5e8d('0xc')];for(_0xf2db0d=0x0;_0xf2db0d<_0x459231[_0x5e8d('0x1b')];_0xf2db0d++){if(_0x459231[_0xf2db0d][_0x5e8d('0x1c')]===_0x2e9a51[_0x5e8d('0xc')]){_0x137847[_0x5e8d('0x20')]=_0x459231[_0xf2db0d][_0x5e8d('0x1f')];}}}_0x5714b3(_0x137847);})[_0x5e8d('0x22')](function(_0x27c42d){_0x4f8004(_0x27c42d[_0x5e8d('0x12')]);});});}function createEndUser(_0x5ec04c,_0x305853,_0x3f1059,_0x2d2a5c,_0x520f73,_0x192445){return new BPromise(function(_0xbb86ef,_0x4e7933){return getAuthToken(_0x305853,_0x3f1059,_0x192445)['then'](function(_0x212932){var _0x88a511=_0x192445[_0x5e8d('0x23')]()===_0x5e8d('0x24')?_0x520f73[_0x5e8d('0x25')]:_0x520f73[_0x5e8d('0x26')];var _0x18403b={'method':_0x5e8d('0x9'),'uri':_0x2d2a5c+_0x5e8d('0x27'),'body':{'telephone1':_0x88a511,'fullname':_0x88a511,'firstname':_0x88a511,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5e8d('0x28')+_0x5ec04c[_0x5e8d('0x20')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x212932,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x18403b);})['then'](function(_0xa965c7){var _0x105688=_0xa965c7['headers'][_0x5e8d('0x29')];var _0x34a04a=_0x105688[_0x5e8d('0x2a')](_0x105688[_0x5e8d('0x2b')]('(')+0x1,_0x105688[_0x5e8d('0x2b')](')'));_0x5ec04c[_0x5e8d('0x2c')]=_0x34a04a;_0xbb86ef(_0x5ec04c);})['catch'](function(_0x30b278){_0x4e7933(_0x30b278['message']);});});}function getEndUser(_0x1c7ee1,_0x561c3a,_0x32fd7f,_0x1fa5a9,_0x18ad73,_0x4d9790){return new BPromise(function(_0x10bab3,_0x2b2902){return getAuthToken(_0x561c3a,_0x32fd7f,_0x4d9790)[_0x5e8d('0xe')](function(_0x3b500b){var _0x414635={'method':_0x5e8d('0x13'),'uri':_0x1fa5a9+'contacts?$select=telephone1','headers':{'Authorization':'Bearer\x20'+_0x3b500b,'If-None-Match':null,'OData-Version':_0x5e8d('0x16')},'json':!![]};return rp(_0x414635);})[_0x5e8d('0xe')](function(_0x4324d3){var _0x361b96=null;if(_0x4324d3){var _0x117530=_0x4324d3['value'];var _0x3ef2c1=![];for(_0x361b96=0x0;_0x361b96<_0x117530[_0x5e8d('0x1b')];_0x361b96++){var _0x34d8cd=_0x4d9790[_0x5e8d('0x23')]()===_0x5e8d('0x24')?_0x18ad73[_0x5e8d('0x25')]:_0x18ad73['calleridnum'];if(_0x117530[_0x361b96][_0x5e8d('0x2d')]===_0x34d8cd){_0x3ef2c1=!![];_0x1c7ee1['enduserId']=_0x117530[_0x361b96][_0x5e8d('0x2e')];}}if(_0x3ef2c1){_0x10bab3(_0x1c7ee1);}else{return createEndUser(_0x1c7ee1,_0x561c3a,_0x32fd7f,_0x1fa5a9,_0x18ad73,_0x4d9790)[_0x5e8d('0xe')](function(_0x3c6cab){logger[_0x5e8d('0x1d')]('['+[_0x4d9790[_0x5e8d('0x11')]()]+_0x5e8d('0x2f'),_0x3c6cab['enduserId']);_0x10bab3(_0x3c6cab);});}}else{return createEndUser(_0x1c7ee1,_0x561c3a,_0x32fd7f,_0x1fa5a9,_0x18ad73,_0x4d9790)[_0x5e8d('0xe')](function(_0x32816a){logger[_0x5e8d('0x1d')]('['+[_0x4d9790[_0x5e8d('0x11')]()]+_0x5e8d('0x30'),_0x32816a[_0x5e8d('0x2c')]);_0x10bab3(_0x32816a);});}});});}function getCustomFields(_0x16cbab,_0x325432,_0x277c1f){var _0x245d5c={};if(_0x16cbab[_0x5e8d('0x1b')]>0x0){_[_0x5e8d('0x31')](_0x16cbab,function(_0x1cfd0e){if(_0x1cfd0e[_0x5e8d('0x32')]===_0x5e8d('0x33')&&_0x1cfd0e[_0x5e8d('0x34')]&&!_0x1cfd0e[_0x5e8d('0x35')]){var _0x1f2893=_0x1cfd0e[_0x5e8d('0x36')][_0x5e8d('0x23')]();var _0x3f2e95=_0x1f2893[_0x5e8d('0x2a')](0x0,_0x1f2893['indexOf']('_'));var _0x5d733d=_0x1f2893[_0x5e8d('0x2a')](_0x1f2893[_0x5e8d('0x37')]('_')+0x1);if(_0x3f2e95===_0x277c1f){_0x245d5c[_0x5d733d]=_0x1cfd0e['content'];}}});}return _0x245d5c;}function getTicket(_0x170b2e,_0x1d142a,_0x53a048,_0x3c2a09,_0x1d5641,_0x94b987,_0x42ccc9){return new BPromise(function(_0x42c4f6,_0x26dd61){var _0x448988;return getAuthToken(_0x1d142a,_0x53a048,_0x42ccc9)[_0x5e8d('0xe')](function(_0x23d4b5){if(_0x94b987['ticketType']===_0x5e8d('0x38')){_0x448988={'method':_0x5e8d('0x9'),'uri':_0x3c2a09+_0x5e8d('0x39'),'body':Object[_0x5e8d('0x3a')]({},{'title':intUtil[_0x5e8d('0x3b')](_0x94b987['Subjects'],_0x1d5641,'\x20'),'description':intUtil['getString'](_0x94b987[_0x5e8d('0x3c')],_0x1d5641,'\x0a'),'customerid_contact@odata.bind':_0x5e8d('0x3d')+_0x170b2e[_0x5e8d('0x2c')]+')','ownerid@odata.bind':_0x5e8d('0x28')+_0x170b2e[_0x5e8d('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x94b987['Fields'],_0x1d5641,_0x94b987['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x23d4b5,'OData-Version':_0x5e8d('0x16')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x94b987[_0x5e8d('0x3e')]==='phonecall'){_0x448988={'method':_0x5e8d('0x9'),'uri':_0x3c2a09+_0x5e8d('0x3f'),'body':Object['assign']({},{'subject':intUtil[_0x5e8d('0x3b')](_0x94b987[_0x5e8d('0x40')],_0x1d5641,'\x20'),'phonenumber':String(_0x1d5641[_0x5e8d('0x26')]),'description':intUtil[_0x5e8d('0x3b')](_0x94b987[_0x5e8d('0x3c')],_0x1d5641,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5e8d('0x3d')+_0x170b2e['enduserId']+')','ownerid@odata.bind':_0x5e8d('0x28')+_0x170b2e[_0x5e8d('0x20')]+')','directioncode':_0x170b2e[_0x5e8d('0x41')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x5e8d('0x28')+_0x170b2e[_0x5e8d('0x20')]+')','participationtypemask':_0x170b2e['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x5e8d('0x3d')+_0x170b2e[_0x5e8d('0x2c')]+')','participationtypemask':_0x170b2e[_0x5e8d('0x41')]===_0x5e8d('0x42')?0x1:0x2}]},getCustomFields(_0x94b987[_0x5e8d('0x43')],_0x1d5641,_0x94b987['ticketType'])),'headers':{'Authorization':_0x5e8d('0x15')+_0x23d4b5,'OData-Version':_0x5e8d('0x16')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x448988);})[_0x5e8d('0xe')](function(_0x47911b){var _0x156467=_0x47911b[_0x5e8d('0x44')][_0x5e8d('0x29')];var _0x1a011a=_0x156467[_0x5e8d('0x2a')](_0x156467[_0x5e8d('0x2b')]('(')+0x1,_0x156467[_0x5e8d('0x2b')](')'));_0x170b2e[_0x5e8d('0x45')]=_0x1a011a;_0x42c4f6(_0x170b2e);})[_0x5e8d('0x22')](function(_0x55b9dc){_0x26dd61(_0x55b9dc['message']);});});}function emit(_0x472499,_0x3a1634,_0xaf6134,_0x10b5d8){var _0x507f8f={'uri':util[_0x5e8d('0x46')](_0x5e8d('0x47'),_0x472499,_0xaf6134,_0x10b5d8)};io['to'](util['format'](_0x5e8d('0x48'),_0x3a1634))[_0x5e8d('0x49')](_0x5e8d('0x4a'),_0x507f8f);}exports['cs']=function(_0x41abc3,_0x433ce4,_0x33b8ba,_0x319c5a,_0x2e1c13,_0x439ec9,_0x426290,_0x52efbd){var _0xa0333={};_0x439ec9['remoteUri']=intUtil[_0x5e8d('0x4b')](_0x439ec9[_0x5e8d('0xb')]);_0x439ec9[_0x5e8d('0x4c')]=intUtil[_0x5e8d('0x4b')](_0x439ec9['serverUrl']);_0xa0333['callDirection']=_0x52efbd===_0x5e8d('0x42')||_0x52efbd===_0x5e8d('0x4d')?_0x5e8d('0x42'):'outbound';var _0x410d61=util['format'](_0x5e8d('0x4e'),_0x439ec9[_0x5e8d('0xb')]);var _0x255e39=util[_0x5e8d('0x46')](_0x5e8d('0x4f'),_0x439ec9[_0x5e8d('0x50')]);var _0xb0a863=util[_0x5e8d('0x46')](_0x5e8d('0x51'),_0x439ec9[_0x5e8d('0x4c')],_0x433ce4[_0x5e8d('0x52')],md5(_0x433ce4[_0x5e8d('0x52')]));if(_0x2e1c13&&_0x2e1c13[_0x5e8d('0x53')]){logger[_0x5e8d('0x1d')](_0x5e8d('0x54'),_0x5e8d('0x55'));_0x433ce4[_0x5e8d('0x56')]=_0xb0a863;}else if(_0x426290&&_0x426290[_0x5e8d('0x57')]&&_0x426290[_0x5e8d('0x57')]!==_0x5e8d('0x58')){logger[_0x5e8d('0x1d')]('[OUTBOUND]',_0x5e8d('0x55'));_0x433ce4[_0x5e8d('0x56')]=_0xb0a863;}else{_0x433ce4[_0x5e8d('0x56')]='';}return getUser(_0xa0333,_0x439ec9,_0x319c5a,_0x255e39,_0x410d61,_0x52efbd)[_0x5e8d('0xe')](function(_0xc75d3e){logger[_0x5e8d('0x1d')]('['+_0x52efbd['toUpperCase']()+_0x5e8d('0x59'),_0xc75d3e[_0x5e8d('0x20')]);logger[_0x5e8d('0x1d')]('['+_0x52efbd['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0xc75d3e[_0x5e8d('0x5a')]);return getEndUser(_0xc75d3e,_0x439ec9,_0x255e39,_0x410d61,_0x433ce4,_0x52efbd);})['then'](function(_0x3ddf8e){logger[_0x5e8d('0x1d')]('['+_0x52efbd['toUpperCase']()+_0x5e8d('0x5b'),_0x3ddf8e['enduserId']);logger[_0x5e8d('0x1d')]('['+_0x52efbd['toUpperCase']()+_0x5e8d('0x5c'),_0x433ce4[_0x5e8d('0x26')]);return getTicket(_0x3ddf8e,_0x439ec9,_0x255e39,_0x410d61,_0x433ce4,_0x33b8ba,_0x52efbd);})[_0x5e8d('0xe')](function(_0x22c698){logger['info'](util['format']('['+_0x52efbd[_0x5e8d('0x11')]()+_0x5e8d('0x5d'),_0x33b8ba[_0x5e8d('0x3e')],_0x22c698[_0x5e8d('0x45')]));logger[_0x5e8d('0x1d')](util['format']('['+_0x52efbd[_0x5e8d('0x11')]()+_0x5e8d('0x5e'),_0x52efbd));if(_0x52efbd!==_0x5e8d('0x4d')){logger['info']('['+_0x52efbd['toUpperCase']()+']',_0x5e8d('0x5f'));emit(_0x439ec9['remoteUri'],_0x319c5a[_0x5e8d('0x60')],_0x33b8ba['ticketType'],_0x22c698['ticketId']);}})['catch'](function(_0x59373b){logger[_0x5e8d('0x10')]('['+_0x52efbd[_0x5e8d('0x11')]()+_0x5e8d('0x61'),util['inspect'](_0x59373b,{'showHidden':!![],'depth':null}));});}; \ 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 b08d78e..4e27583 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 _0x8db4=['%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','toString','base64','debug','stringify','GET','map','forEach','string','nameField','customField','toLowerCase','content','type','idField','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','%s/helpdesk/tickets/%d','lastevent','toUpperCase','catch','md5','util','ioredis','./util','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.'];(function(_0x2e523c,_0x34280b){var _0x3d3b84=function(_0x3e2ced){while(--_0x3e2ced){_0x2e523c['push'](_0x2e523c['shift']());}};_0x3d3b84(++_0x34280b);}(_0x8db4,0xe8));var _0x48db=function(_0x17df30,_0x28b2c4){_0x17df30=_0x17df30-0x0;var _0x578594=_0x8db4[_0x17df30];return _0x578594;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x48db('0x0'));var util=require(_0x48db('0x1'));var Redis=require(_0x48db('0x2'));var intUtil=require(_0x48db('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('freshdesk');config[_0x48db('0x4')]=_[_0x48db('0x5')](config[_0x48db('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x48db('0x6'))(new Redis(config[_0x48db('0x4')]));var headers={'Content-Type':_0x48db('0x7'),'Accept':'application/json'};function emit(_0x56c91e,_0x13a59f,_0x18fca1){io['to'](_0x56c91e)[_0x48db('0x8')](_0x13a59f,_0x18fca1);}function getTicket(_0x4fb0b4,_0x466678,_0x45307d,_0x192c33,_0x3ecab6){logger[_0x48db('0x9')](_0x48db('0xa'));var _0x28e2ac=_[_0x48db('0xb')]({'responder_id':_0x466678['id'],'requester_id':_0x45307d['id'],'name':util[_0x48db('0xc')](_0x48db('0xd'),_0x3ecab6[_0x48db('0xe')]),'phone':_0x3ecab6[_0x48db('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x48db('0x10')](_0x192c33[_0x48db('0x11')],_0x3ecab6,'\x20'),'description':intUtil[_0x48db('0x10')](_0x192c33[_0x48db('0x12')],_0x3ecab6,_0x48db('0x13')),'tags':getTags(_0x192c33[_0x48db('0x14')],_0x48db('0x15'))},getCustomFields(_0x192c33[_0x48db('0x16')],_0x3ecab6));_0x28e2ac['custom_fields']=_[_0x48db('0x17')](_[_0x48db('0x18')](_0x28e2ac[_0x48db('0x19')],'id'),_0x48db('0x1a'));return request({'uri':util[_0x48db('0xc')](_0x48db('0x1b'),_0x4fb0b4[_0x48db('0x1c')]),'method':'POST','body':_0x28e2ac})['then'](function(_0x19ec92){logger['info'](_0x48db('0x1d'));return _0x19ec92;});}function getUser(_0x220c70,_0x2f3805){if(intUtil[_0x48db('0x1e')](_0x2f3805)){return request({'uri':util[_0x48db('0xc')](_0x48db('0x1f'),_0x220c70['remoteUri']),'qs':{'email':_0x2f3805}})[_0x48db('0x20')](function(_0x279664){if(_0x279664[_0x48db('0x21')]){logger['info'](_0x48db('0x22'));return _[_0x48db('0x23')](_0x279664,function(_0x153802){return _0x153802[_0x48db('0x24')]['email']===_0x2f3805;});}else{logger[_0x48db('0x9')](_0x48db('0x25'));return request({'uri':util[_0x48db('0xc')]('%s/api/v2/agents/me',_0x220c70[_0x48db('0x1c')])})[_0x48db('0x20')](function(_0x3ce351){logger[_0x48db('0x9')]('Admin\x20account\x20selected.');return _0x3ce351;});}});}else{logger[_0x48db('0x9')](_0x48db('0x26'));return request({'uri':util[_0x48db('0xc')](_0x48db('0x27'),_0x220c70[_0x48db('0x1c')])})[_0x48db('0x20')](function(_0x30aed8){logger[_0x48db('0x9')](_0x48db('0x28'));return _0x30aed8;});}}function getEndUser(_0x3776a5,_0x5098d3,_0x4c9f9f){logger[_0x48db('0x9')]('Searching\x20enduser\x20with\x20phone',_0x4c9f9f);return request({'uri':util['format'](_0x48db('0x29'),_0x3776a5[_0x48db('0x1c')]),'qs':{'phone':_0x4c9f9f}})[_0x48db('0x20')](function(_0x6f64a4){if(_0x6f64a4['length']){logger[_0x48db('0x9')](_0x48db('0x2a'));return _[_0x48db('0x23')](_0x6f64a4,{'phone':_0x4c9f9f});}else{logger['info'](_0x48db('0x2b'));return request({'uri':util[_0x48db('0xc')](_0x48db('0x29'),_0x3776a5['remoteUri']),'method':_0x48db('0x2c'),'body':{'name':_0x5098d3,'phone':_0x4c9f9f}})[_0x48db('0x20')](function(_0x49f793){logger[_0x48db('0x9')](_0x48db('0x2d'));return _0x49f793;});}});}function getAuth(_0x452d53){return util[_0x48db('0xc')]('Basic\x20%s',new Buffer(_0x452d53['apiKey']+':X')[_0x48db('0x2e')](_0x48db('0x2f')));}function request(_0xe9c9e8){logger[_0x48db('0x30')]('[HTTP]',JSON[_0x48db('0x31')](_0xe9c9e8));return rp(_[_0x48db('0x5')](_0xe9c9e8,{'method':_0x48db('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x5d0df3,_0x3d9e2a){var _0x4038bf=[];if(_0x5d0df3&&_0x5d0df3[_0x48db('0x21')]>0x0){_0x4038bf=_[_0x48db('0x33')](_0x5d0df3,_0x3d9e2a);}return _0x4038bf;}function getCustomFields(_0x14545b,_0x705700){var _0x340257=[];var _0x4bcac9={'custom_fields':[]};if(_0x14545b[_0x48db('0x21')]>0x0){_[_0x48db('0x34')](_0x14545b,function(_0x309d44){if(_0x309d44['type']===_0x48db('0x35')&&_0x309d44[_0x48db('0x36')]&&!_0x309d44[_0x48db('0x37')]){_0x4bcac9[_0x309d44[_0x48db('0x36')][_0x48db('0x38')]()]=_0x309d44[_0x48db('0x39')][_0x48db('0x2e')]();}else if(_0x309d44[_0x48db('0x3a')]===_0x48db('0x35')&&_0x309d44[_0x48db('0x3b')]&&_0x309d44['customField']){_0x4bcac9['custom_fields'][_0x48db('0x3c')]({'id':_0x309d44[_0x48db('0x3b')],'value':_0x309d44[_0x48db('0x39')][_0x48db('0x2e')]()});}else if(_0x309d44[_0x48db('0x3a')]===_0x48db('0x3d')&&_0x309d44[_0x48db('0x3e')]&&_0x309d44[_0x48db('0x3b')]&&_0x309d44[_0x48db('0x37')]){_0x705700[_0x309d44['variableName']]&&_0x4bcac9[_0x48db('0x19')][_0x48db('0x3c')]({'id':_0x309d44[_0x48db('0x3b')],'value':_0x705700[_0x309d44[_0x48db('0x3e')]][_0x48db('0x2e')]()});}else if(_0x309d44['type']==='customVariable'&&_0x309d44[_0x48db('0x3f')]&&_0x309d44[_0x48db('0x3f')][_0x48db('0x15')]&&_0x309d44['idField']&&_0x309d44[_0x48db('0x37')]){_0x705700[_0x309d44[_0x48db('0x3f')]['name'][_0x48db('0x38')]()]&&_0x4bcac9[_0x48db('0x19')][_0x48db('0x3c')]({'id':_0x309d44[_0x48db('0x3b')],'value':_0x705700[_0x309d44['Variable']['name']['toLowerCase']()][_0x48db('0x2e')]()});}});}return _0x4bcac9;}exports[_0x48db('0x40')]=function(_0x3f9150,_0x117d3d,_0x399df5,_0x5e61c1,_0x1e2340,_0xf85c54){var _0xec9fd9,_0x2f02cf;_0xf85c54[_0x48db('0x1c')]=intUtil[_0x48db('0x41')](_0xf85c54[_0x48db('0x1c')]);_0xf85c54['serverUrl']=intUtil[_0x48db('0x41')](_0xf85c54[_0x48db('0x42')]);if(_0x1e2340&&_0x1e2340['monitor_format']){logger[_0x48db('0x9')](_0x48db('0x43'),_0x48db('0x44'));_0x117d3d[_0x48db('0x45')]=util['format'](_0x48db('0x46'),_0xf85c54['serverUrl'],_0x117d3d[_0x48db('0x47')],md5(_0x117d3d[_0x48db('0x47')]));}else{_0x117d3d[_0x48db('0x45')]='';}headers[_0x48db('0x48')]=getAuth(_0xf85c54);return getUser(_0xf85c54,_0x5e61c1['email'])[_0x48db('0x20')](function(_0x24a9d8){_0xec9fd9=_0x24a9d8;logger['info'](_0x48db('0x49'),_0xec9fd9['id']);return getEndUser(_0xf85c54,_0x117d3d[_0x48db('0xe')],_0x117d3d[_0x48db('0xf')]);})['then'](function(_0x1e4334){_0x2f02cf=_0x1e4334;logger[_0x48db('0x9')](_0x48db('0x4a'),_0x2f02cf['id']);return getTicket(_0xf85c54,_0xec9fd9,_0x2f02cf,_0x399df5,_0x117d3d);})[_0x48db('0x20')](function(_0x26dec2){if(_0x26dec2&&_0x26dec2['id']){logger[_0x48db('0x9')](_0x48db('0x1d'));logger['info'](_0x48db('0x4b'),_0x26dec2['id']);logger[_0x48db('0x9')](_0x48db('0x43'),_0x48db('0x4c'));emit(util[_0x48db('0xc')](_0x48db('0x4d'),_0x5e61c1[_0x48db('0x15')]),_0x48db('0x4e'),{'uri':util[_0x48db('0xc')]('%s/helpdesk/tickets/%d',_0xf85c54['remoteUri'],_0x26dec2['id'])});}})['catch'](function(_0x188c24){logger[_0x48db('0x4f')](_0x48db('0x43'),JSON[_0x48db('0x31')](_0x188c24));});};exports[_0x48db('0x50')]=function(_0x16b720,_0x178f46,_0x5dcf2d,_0x566c4f,_0x148a2c,_0xd61982,_0x2979e4){var _0x29699f,_0x2db32b;_0xd61982[_0x48db('0x1c')]=intUtil['stripTrailingSlash'](_0xd61982[_0x48db('0x1c')]);_0xd61982[_0x48db('0x42')]=intUtil[_0x48db('0x41')](_0xd61982['serverUrl']);if(_0x2979e4&&_0x2979e4[_0x48db('0x51')]&&_0x2979e4[_0x48db('0x51')]!==_0x48db('0x52')){logger[_0x48db('0x9')](_0x48db('0x53'),'Recording\x20is\x20enabled!');_0x178f46[_0x48db('0x45')]=util[_0x48db('0xc')](_0x48db('0x46'),_0xd61982[_0x48db('0x42')],_0x178f46[_0x48db('0x47')],md5(_0x178f46['uniqueid']));}headers['Authorization']=getAuth(_0xd61982);return getUser(_0xd61982,_0x566c4f[_0x48db('0x54')])[_0x48db('0x20')](function(_0x4ca7fd){_0x29699f=_0x4ca7fd;logger[_0x48db('0x9')]('The\x20User\x20ID\x20is:',_0x29699f['id']);return getEndUser(_0xd61982,_0x178f46[_0x48db('0x55')],_0x178f46[_0x48db('0x56')]);})[_0x48db('0x20')](function(_0x21c4f6){_0x2db32b=_0x21c4f6;logger[_0x48db('0x9')](_0x48db('0x4a'),_0x2db32b['id']);return getTicket(_0xd61982,_0x29699f,_0x2db32b,_0x5dcf2d,_0x178f46);})[_0x48db('0x20')](function(_0x527059){if(_0x527059&&_0x527059['id']){logger[_0x48db('0x9')]('Ticket\x20created!');logger[_0x48db('0x9')](_0x48db('0x4b'),_0x527059['id']);logger['info'](_0x48db('0x53'),_0x48db('0x4c'));emit(util[_0x48db('0xc')]('user:%s',_0x566c4f['name']),_0x48db('0x4e'),{'uri':util[_0x48db('0xc')](_0x48db('0x57'),_0xd61982['remoteUri'],_0x527059['id'])});}})['catch'](function(_0x29df71){logger[_0x48db('0x4f')](_0x48db('0x53'),JSON[_0x48db('0x31')](_0x29df71));});};exports['unmanaged']=function(_0x36820a,_0x3e0699,_0x2c88f4,_0x2226e2,_0xea5c5c,_0x31d210){var _0x5c5eec,_0x13bcdc;_0x31d210['remoteUri']=intUtil[_0x48db('0x41')](_0x31d210[_0x48db('0x1c')]);_0x31d210[_0x48db('0x42')]=intUtil[_0x48db('0x41')](_0x31d210[_0x48db('0x42')]);if(_0xea5c5c&&_0xea5c5c['monitor_format']){logger['info']('['+_0x3e0699[_0x48db('0x58')][_0x48db('0x59')]()+']',_0x48db('0x44'));_0x3e0699[_0x48db('0x45')]=util[_0x48db('0xc')](_0x48db('0x46'),_0x31d210[_0x48db('0x42')],_0x3e0699[_0x48db('0x47')],md5(_0x3e0699[_0x48db('0x47')]));}else{_0x3e0699['recordingURL']='';}headers[_0x48db('0x48')]=getAuth(_0x31d210);return getUser(_0x31d210,'')[_0x48db('0x20')](function(_0x321301){_0x5c5eec=_0x321301;logger[_0x48db('0x9')](_0x48db('0x49'),_0x5c5eec['id']);return getEndUser(_0x31d210,_0x3e0699[_0x48db('0xe')],_0x3e0699['calleridnum']);})[_0x48db('0x20')](function(_0x52db29){_0x13bcdc=_0x52db29;logger['info']('The\x20Enduser\x20ID\x20is:',_0x13bcdc['id']);return getTicket(_0x31d210,_0x5c5eec,_0x13bcdc,_0x2c88f4,_0x3e0699);})[_0x48db('0x20')](function(_0x5c32af){if(_0x5c32af){logger['info'](_0x48db('0x1d'));logger[_0x48db('0x9')](_0x48db('0x4b'),_0x5c32af['id']);}})[_0x48db('0x5a')](function(_0x17dce9){logger[_0x48db('0x4f')]('['+_0x3e0699[_0x48db('0x58')][_0x48db('0x59')]()+']',JSON[_0x48db('0x31')](_0x17dce9));});}; \ No newline at end of file +var _0xc01e=['destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','unmanaged','lastevent','toUpperCase','lodash','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','application/json','emit','info','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','Fields','custom_fields','keyBy','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','length','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','POST','Basic\x20%s','toString','base64','stringify','map','nameField','customField','content','type','string','push','idField','variable','variableName','Variable','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','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]','The\x20User\x20ID\x20is:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc01e,0x14e));var _0xec01=function(_0x1e6d24,_0x5b266a){_0x1e6d24=_0x1e6d24-0x0;var _0x3831b7=_0xc01e[_0x1e6d24];return _0x3831b7;};'use strict';var _=require(_0xec01('0x0'));var rp=require('request-promise');var md5=require(_0xec01('0x1'));var util=require(_0xec01('0x2'));var Redis=require(_0xec01('0x3'));var intUtil=require('./util');var config=require(_0xec01('0x4'));var logger=require(_0xec01('0x5'))(_0xec01('0x6'));config[_0xec01('0x7')]=_['defaults'](config[_0xec01('0x7')],{'host':_0xec01('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xec01('0x7')]));var headers={'Content-Type':_0xec01('0x9'),'Accept':_0xec01('0x9')};function emit(_0x221a0b,_0x29067d,_0x2b86aa){io['to'](_0x221a0b)[_0xec01('0xa')](_0x29067d,_0x2b86aa);}function getTicket(_0x1d8a9d,_0xaa6a6c,_0x4f6e50,_0x330240,_0x1d4505){logger[_0xec01('0xb')]('Creating\x20new\x20ticket...');var _0x5ec453=_[_0xec01('0xc')]({'responder_id':_0xaa6a6c['id'],'requester_id':_0x4f6e50['id'],'name':util[_0xec01('0xd')]('Caller\x20-\x20%s',_0x1d4505[_0xec01('0xe')]),'phone':_0x1d4505[_0xec01('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xec01('0x10')](_0x330240[_0xec01('0x11')],_0x1d4505,'\x20'),'description':intUtil[_0xec01('0x10')](_0x330240[_0xec01('0x12')],_0x1d4505,_0xec01('0x13')),'tags':getTags(_0x330240['Tags'],_0xec01('0x14'))},getCustomFields(_0x330240[_0xec01('0x15')],_0x1d4505));_0x5ec453[_0xec01('0x16')]=_['mapValues'](_[_0xec01('0x17')](_0x5ec453[_0xec01('0x16')],'id'),'value');return request({'uri':util[_0xec01('0xd')](_0xec01('0x18'),_0x1d8a9d[_0xec01('0x19')]),'method':'POST','body':_0x5ec453})[_0xec01('0x1a')](function(_0x3983e3){logger[_0xec01('0xb')](_0xec01('0x1b'));return _0x3983e3;});}function getUser(_0x44cd32,_0x49d6c8){if(intUtil[_0xec01('0x1c')](_0x49d6c8)){return request({'uri':util['format']('%s/api/v2/agents',_0x44cd32[_0xec01('0x19')]),'qs':{'email':_0x49d6c8}})[_0xec01('0x1a')](function(_0x2e5240){if(_0x2e5240[_0xec01('0x1d')]){logger[_0xec01('0xb')]('Agent\x20found!');return _[_0xec01('0x1e')](_0x2e5240,function(_0x4b3fef){return _0x4b3fef[_0xec01('0x1f')]['email']===_0x49d6c8;});}else{logger[_0xec01('0xb')](_0xec01('0x20'));return request({'uri':util[_0xec01('0xd')]('%s/api/v2/agents/me',_0x44cd32[_0xec01('0x19')])})[_0xec01('0x1a')](function(_0x2e7be4){logger[_0xec01('0xb')](_0xec01('0x21'));return _0x2e7be4;});}});}else{logger[_0xec01('0xb')](_0xec01('0x22'));return request({'uri':util[_0xec01('0xd')]('%s/api/v2/agents/me',_0x44cd32[_0xec01('0x19')])})[_0xec01('0x1a')](function(_0x2766ba){logger[_0xec01('0xb')](_0xec01('0x21'));return _0x2766ba;});}}function getEndUser(_0x222c19,_0x340527,_0x3a5863){logger[_0xec01('0xb')]('Searching\x20enduser\x20with\x20phone',_0x3a5863);return request({'uri':util[_0xec01('0xd')](_0xec01('0x23'),_0x222c19[_0xec01('0x19')]),'qs':{'phone':_0x3a5863}})[_0xec01('0x1a')](function(_0x30c647){if(_0x30c647[_0xec01('0x1d')]){logger[_0xec01('0xb')](_0xec01('0x24'));return _['find'](_0x30c647,{'phone':_0x3a5863});}else{logger[_0xec01('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xec01('0xd')](_0xec01('0x23'),_0x222c19[_0xec01('0x19')]),'method':_0xec01('0x25'),'body':{'name':_0x340527,'phone':_0x3a5863}})[_0xec01('0x1a')](function(_0x4a79d4){logger['info']('Enduser\x20created.');return _0x4a79d4;});}});}function getAuth(_0x1397bd){return util[_0xec01('0xd')](_0xec01('0x26'),new Buffer(_0x1397bd['apiKey']+':X')[_0xec01('0x27')](_0xec01('0x28')));}function request(_0x379d2e){logger['debug']('[HTTP]',JSON[_0xec01('0x29')](_0x379d2e));return rp(_['defaults'](_0x379d2e,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4bd2b8,_0x3e9a75){var _0x375550=[];if(_0x4bd2b8&&_0x4bd2b8[_0xec01('0x1d')]>0x0){_0x375550=_[_0xec01('0x2a')](_0x4bd2b8,_0x3e9a75);}return _0x375550;}function getCustomFields(_0x2493a8,_0x2af620){var _0x42c1f9=[];var _0x251e70={'custom_fields':[]};if(_0x2493a8['length']>0x0){_['forEach'](_0x2493a8,function(_0x208f92){if(_0x208f92['type']==='string'&&_0x208f92[_0xec01('0x2b')]&&!_0x208f92[_0xec01('0x2c')]){_0x251e70[_0x208f92['nameField']['toLowerCase']()]=_0x208f92[_0xec01('0x2d')][_0xec01('0x27')]();}else if(_0x208f92[_0xec01('0x2e')]===_0xec01('0x2f')&&_0x208f92['idField']&&_0x208f92[_0xec01('0x2c')]){_0x251e70[_0xec01('0x16')][_0xec01('0x30')]({'id':_0x208f92[_0xec01('0x31')],'value':_0x208f92[_0xec01('0x2d')]['toString']()});}else if(_0x208f92[_0xec01('0x2e')]===_0xec01('0x32')&&_0x208f92[_0xec01('0x33')]&&_0x208f92[_0xec01('0x31')]&&_0x208f92[_0xec01('0x2c')]){_0x2af620[_0x208f92['variableName']]&&_0x251e70[_0xec01('0x16')][_0xec01('0x30')]({'id':_0x208f92[_0xec01('0x31')],'value':_0x2af620[_0x208f92[_0xec01('0x33')]][_0xec01('0x27')]()});}else if(_0x208f92[_0xec01('0x2e')]==='customVariable'&&_0x208f92[_0xec01('0x34')]&&_0x208f92[_0xec01('0x34')][_0xec01('0x14')]&&_0x208f92[_0xec01('0x31')]&&_0x208f92['customField']){_0x2af620[_0x208f92[_0xec01('0x34')][_0xec01('0x14')][_0xec01('0x35')]()]&&_0x251e70[_0xec01('0x16')][_0xec01('0x30')]({'id':_0x208f92[_0xec01('0x31')],'value':_0x2af620[_0x208f92[_0xec01('0x34')]['name'][_0xec01('0x35')]()][_0xec01('0x27')]()});}});}return _0x251e70;}exports['queue']=function(_0xa4f461,_0x4ead08,_0x104418,_0x436bd3,_0x538230,_0x575094){var _0x2a0ffc,_0x2c126d;_0x575094['remoteUri']=intUtil[_0xec01('0x36')](_0x575094[_0xec01('0x19')]);_0x575094[_0xec01('0x37')]=intUtil[_0xec01('0x36')](_0x575094[_0xec01('0x37')]);if(_0x538230&&_0x538230[_0xec01('0x38')]){logger[_0xec01('0xb')](_0xec01('0x39'),_0xec01('0x3a'));_0x4ead08['recordingURL']=util[_0xec01('0xd')](_0xec01('0x3b'),_0x575094[_0xec01('0x37')],_0x4ead08['uniqueid'],md5(_0x4ead08[_0xec01('0x3c')]));}else{_0x4ead08[_0xec01('0x3d')]='';}headers[_0xec01('0x3e')]=getAuth(_0x575094);return getUser(_0x575094,_0x436bd3[_0xec01('0x3f')])[_0xec01('0x1a')](function(_0x35acd3){_0x2a0ffc=_0x35acd3;logger[_0xec01('0xb')]('The\x20User\x20ID\x20is:',_0x2a0ffc['id']);return getEndUser(_0x575094,_0x4ead08[_0xec01('0xe')],_0x4ead08[_0xec01('0xf')]);})[_0xec01('0x1a')](function(_0x459a52){_0x2c126d=_0x459a52;logger[_0xec01('0xb')]('The\x20Enduser\x20ID\x20is:',_0x2c126d['id']);return getTicket(_0x575094,_0x2a0ffc,_0x2c126d,_0x104418,_0x4ead08);})['then'](function(_0x47909d){if(_0x47909d&&_0x47909d['id']){logger[_0xec01('0xb')]('Ticket\x20created!');logger[_0xec01('0xb')](_0xec01('0x40'),_0x47909d['id']);logger['info'](_0xec01('0x39'),_0xec01('0x41'));emit(util[_0xec01('0xd')](_0xec01('0x42'),_0x436bd3['name']),_0xec01('0x43'),{'uri':util[_0xec01('0xd')](_0xec01('0x44'),_0x575094['remoteUri'],_0x47909d['id'])});}})[_0xec01('0x45')](function(_0x4c7679){logger[_0xec01('0x46')](_0xec01('0x39'),JSON[_0xec01('0x29')](_0x4c7679));});};exports[_0xec01('0x47')]=function(_0x32fba1,_0x236dee,_0xe2327,_0x5259dc,_0x204e4d,_0x5402d3,_0x102357){var _0x1d7227,_0x464dc6;_0x5402d3[_0xec01('0x19')]=intUtil['stripTrailingSlash'](_0x5402d3[_0xec01('0x19')]);_0x5402d3[_0xec01('0x37')]=intUtil[_0xec01('0x36')](_0x5402d3[_0xec01('0x37')]);if(_0x102357&&_0x102357['recordingFormat']&&_0x102357[_0xec01('0x48')]!==_0xec01('0x49')){logger[_0xec01('0xb')](_0xec01('0x4a'),'Recording\x20is\x20enabled!');_0x236dee[_0xec01('0x3d')]=util[_0xec01('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5402d3['serverUrl'],_0x236dee['uniqueid'],md5(_0x236dee[_0xec01('0x3c')]));}headers[_0xec01('0x3e')]=getAuth(_0x5402d3);return getUser(_0x5402d3,_0x5259dc[_0xec01('0x3f')])[_0xec01('0x1a')](function(_0xc44622){_0x1d7227=_0xc44622;logger[_0xec01('0xb')](_0xec01('0x4b'),_0x1d7227['id']);return getEndUser(_0x5402d3,_0x236dee[_0xec01('0x4c')],_0x236dee[_0xec01('0x4d')]);})['then'](function(_0x4c627e){_0x464dc6=_0x4c627e;logger[_0xec01('0xb')](_0xec01('0x4e'),_0x464dc6['id']);return getTicket(_0x5402d3,_0x1d7227,_0x464dc6,_0xe2327,_0x236dee);})[_0xec01('0x1a')](function(_0x25cc16){if(_0x25cc16&&_0x25cc16['id']){logger[_0xec01('0xb')](_0xec01('0x1b'));logger[_0xec01('0xb')](_0xec01('0x40'),_0x25cc16['id']);logger[_0xec01('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xec01('0xd')](_0xec01('0x42'),_0x5259dc[_0xec01('0x14')]),_0xec01('0x43'),{'uri':util[_0xec01('0xd')](_0xec01('0x44'),_0x5402d3[_0xec01('0x19')],_0x25cc16['id'])});}})[_0xec01('0x45')](function(_0x544a93){logger[_0xec01('0x46')](_0xec01('0x4a'),JSON['stringify'](_0x544a93));});};exports[_0xec01('0x4f')]=function(_0x4a11d3,_0x17d578,_0x5e6fb1,_0x434a7d,_0x4ac5ca,_0x510c48){var _0x756d34,_0x25219e;_0x510c48['remoteUri']=intUtil[_0xec01('0x36')](_0x510c48[_0xec01('0x19')]);_0x510c48[_0xec01('0x37')]=intUtil[_0xec01('0x36')](_0x510c48['serverUrl']);if(_0x4ac5ca&&_0x4ac5ca['monitor_format']){logger[_0xec01('0xb')]('['+_0x17d578[_0xec01('0x50')][_0xec01('0x51')]()+']',_0xec01('0x3a'));_0x17d578[_0xec01('0x3d')]=util[_0xec01('0xd')](_0xec01('0x3b'),_0x510c48[_0xec01('0x37')],_0x17d578[_0xec01('0x3c')],md5(_0x17d578[_0xec01('0x3c')]));}else{_0x17d578[_0xec01('0x3d')]='';}headers['Authorization']=getAuth(_0x510c48);return getUser(_0x510c48,'')[_0xec01('0x1a')](function(_0x3a34a5){_0x756d34=_0x3a34a5;logger[_0xec01('0xb')](_0xec01('0x4b'),_0x756d34['id']);return getEndUser(_0x510c48,_0x17d578[_0xec01('0xe')],_0x17d578[_0xec01('0xf')]);})[_0xec01('0x1a')](function(_0x39433){_0x25219e=_0x39433;logger[_0xec01('0xb')](_0xec01('0x4e'),_0x25219e['id']);return getTicket(_0x510c48,_0x756d34,_0x25219e,_0x5e6fb1,_0x17d578);})['then'](function(_0x208a7f){if(_0x208a7f){logger[_0xec01('0xb')]('Ticket\x20created!');logger[_0xec01('0xb')](_0xec01('0x40'),_0x208a7f['id']);}})[_0xec01('0x45')](function(_0x498f05){logger['error']('['+_0x17d578[_0xec01('0x50')][_0xec01('0x51')]()+']',JSON['stringify'](_0x498f05));});}; \ 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 1edb84b..9702627 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 _0x7b27=['/api/lookup?q=','&f=','&entities=contact','find','contacts','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Creating\x20new\x20task','/api/tasks','getString','Descriptions','add','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','md5','util','moment','bluebird','./util','../../../../config/environment','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','users','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','headers','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','adminEmail','toUpperCase','message'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0x7b27,0x186));var _0x77b2=function(_0x58aa08,_0x5109db){_0x58aa08=_0x58aa08-0x0;var _0x5c9a07=_0x7b27[_0x58aa08];return _0x5c9a07;};'use strict';var _=require(_0x77b2('0x0'));var rp=require('request-promise');var md5=require(_0x77b2('0x1'));var util=require(_0x77b2('0x2'));var moment=require(_0x77b2('0x3'));var Promise=require(_0x77b2('0x4'));var Redis=require('ioredis');var intUtil=require(_0x77b2('0x5'));var config=require(_0x77b2('0x6'));var logger=require('../../../../config/logger')(_0x77b2('0x7'));config[_0x77b2('0x8')]=_[_0x77b2('0x9')](config['redis'],{'host':_0x77b2('0xa'),'port':0x18eb});var io=require(_0x77b2('0xb'))(new Redis(config[_0x77b2('0x8')]));function getAdminId(_0x1308f7,_0x5139eb,_0x13c0bc,_0x27a03d){return new Promise(function(_0x734122,_0x3611c3){var _0x1a6cc9=![];var _0x3abfbc={'method':_0x77b2('0xc'),'uri':_0x27a03d+_0x77b2('0xd'),'json':!![]};_0x3abfbc['headers']=_0x13c0bc;logger[_0x77b2('0xe')](_0x77b2('0xf'));return rp(_0x3abfbc)['then'](function(_0xfbadc6){if(_0xfbadc6){var _0x4918c4=_0xfbadc6[_0x77b2('0x10')];var _0x29385b=null;for(_0x29385b=0x0;_0x29385b<_0x4918c4['length'];_0x29385b++){if(_0x4918c4[_0x29385b][_0x77b2('0x11')]===_0x1308f7['adminEmail']){_0x1308f7[_0x77b2('0x12')]=_0x4918c4[_0x29385b]['id'];_0x1a6cc9=!![];}}if(_0x1a6cc9){logger[_0x77b2('0xe')](_0x77b2('0x13'),_0x1308f7[_0x77b2('0x12')]);_0x734122(_0x1308f7);}else{_0x3611c3({'statusCode':0x194,'message':_0x77b2('0x14')});}}else{_0x3611c3({'statusCode':0x194,'message':_0x77b2('0x14')});}})[_0x77b2('0x15')](function(_0x284e2c){logger[_0x77b2('0x16')]('['+[_0x5139eb['toUpperCase']()]+']',_0x284e2c['message']);_0x3611c3(_0x284e2c);});});}function getUser(_0x2cea4a,_0x2a85a3,_0x21d169){return function(_0x68c16e){return new Promise(function(_0x65e134,_0x3a346c){var _0x30d05a={'method':'GET','uri':_0x21d169+_0x77b2('0xd'),'json':!![]};_0x30d05a[_0x77b2('0x17')]=_0x2a85a3;logger[_0x77b2('0xe')](_0x77b2('0x18'));return rp(_0x30d05a)[_0x77b2('0x19')](function(_0x497d98){if(_0x497d98){var _0x3a012f=_0x497d98['users'];var _0x298871=![];var _0x1d8132=null;if(_0x68c16e[_0x77b2('0x1a')]!==null){logger[_0x77b2('0xe')](_0x77b2('0x1b'),_0x68c16e[_0x77b2('0x1a')]);_0x68c16e[_0x77b2('0x1c')]=_0x68c16e['agentEmail'];for(_0x1d8132=0x0;_0x1d8132<_0x3a012f['length'];_0x1d8132++){if(_0x3a012f[_0x1d8132]['email']===_0x68c16e[_0x77b2('0x1a')]){_0x298871=!![];_0x68c16e[_0x77b2('0x1d')]=_0x3a012f[_0x1d8132]['id'];logger[_0x77b2('0xe')](_0x77b2('0x1e'),_0x68c16e[_0x77b2('0x1d')]);}}}if(!_0x298871){logger[_0x77b2('0xe')](_0x77b2('0x1f'));_0x68c16e['userEmail']=_0x68c16e[_0x77b2('0x20')];_0x68c16e[_0x77b2('0x1d')]=_0x68c16e[_0x77b2('0x12')];_0x298871=!![];}if(_0x298871){_0x65e134(_0x68c16e);}else{_0x3a346c({'statusCode':0x194,'message':_0x77b2('0x14')});}}else{_0x3a346c({'statusCode':0x194,'message':_0x77b2('0x14')});}})[_0x77b2('0x15')](function(_0x9995){logger[_0x77b2('0x16')]('['+[_0x2cea4a[_0x77b2('0x21')]()]+']',_0x9995[_0x77b2('0x22')]);_0x3a346c(_0x9995);});});};}function searchContact(_0x5c50a1,_0x3cc4d9,_0x3af0ef,_0x20cbcc){return new Promise(function(_0x1df3ce,_0x21d161){var _0x5dc412={'method':_0x77b2('0xc'),'headers':_0x3cc4d9,'uri':_0x5c50a1+_0x77b2('0x23')+_0x20cbcc+_0x77b2('0x24')+_0x3af0ef+_0x77b2('0x25'),'json':!![]};rp(_0x5dc412)[_0x77b2('0x19')](function(_0x1bb3d8){var _0x7f7814=_[_0x77b2('0x26')](_0x1bb3d8[_0x77b2('0x27')][_0x77b2('0x27')],[_0x3af0ef,_0x20cbcc]);_0x1df3ce(_0x7f7814);})[_0x77b2('0x15')](function(_0xdc9cb6){_0x21d161(_0xdc9cb6);});});}function getEndUser(_0x5c4421,_0x5cd688,_0x5c2db3){return function(_0x4d1d36){return new Promise(function(_0xa5f89a,_0xcd8de){logger['info'](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x4d1d36[_0x77b2('0x28')]));searchContact(_0x5c2db3,_0x5cd688,_0x77b2('0x29'),_0x4d1d36[_0x77b2('0x28')])[_0x77b2('0x19')](function(_0x4e3a30){if(_0x4e3a30){_0x4d1d36[_0x77b2('0x2a')]=_0x4e3a30['id'];logger['info'](_0x77b2('0x2b'),_0x4d1d36[_0x77b2('0x2a')]);return _0xa5f89a(_0x4d1d36);}searchContact(_0x5c2db3,_0x5cd688,_0x77b2('0x2c'),_0x4d1d36[_0x77b2('0x28')])[_0x77b2('0x19')](function(_0x2bccdc){if(_0x2bccdc){_0x4d1d36['endUserId']=_0x2bccdc['id'];logger[_0x77b2('0xe')](_0x77b2('0x2d'),_0x4d1d36[_0x77b2('0x2a')]);return _0xa5f89a(_0x4d1d36);}createEndUser(_0x4d1d36,_0x5c4421,_0x5cd688,_0x5c2db3)['then'](function(_0x222ca7){logger['info'](_0x77b2('0x2e'),_0x222ca7[_0x77b2('0x2a')]);return _0xa5f89a(_0x222ca7);});});})[_0x77b2('0x15')](function(_0x4e281c){_0xcd8de(_0x4e281c);});});};}function createEndUser(_0x49dd03,_0x4c4cc6,_0x4d5a45,_0x6fe687){return new Promise(function(_0x5d9357,_0x870384){var _0x1feb9f=moment();var _0x748434={'method':_0x77b2('0x2f'),'uri':_0x6fe687+_0x77b2('0x30'),'body':{'contact':{'last_name':_0x49dd03[_0x77b2('0x28')],'work_number':_0x49dd03[_0x77b2('0x28')],'mobile_number':_0x49dd03['contactNumber'],'owner_id':_0x49dd03['userId'],'created_at':_0x1feb9f[_0x77b2('0x31')](_0x77b2('0x32'))}},'json':!![]};_0x748434[_0x77b2('0x17')]=_0x4d5a45;logger[_0x77b2('0xe')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x748434)[_0x77b2('0x19')](function(_0x376ead){_0x49dd03[_0x77b2('0x2a')]=_0x376ead['contact']['id'];_0x5d9357(_0x49dd03);})['catch'](function(_0x155266){logger[_0x77b2('0x16')]('['+[_0x4c4cc6[_0x77b2('0x21')]()]+']',_0x155266[_0x77b2('0x22')]);_0x870384(_0x155266['message']);});});}function getTicket(_0x436bec,_0x116721,_0x379f01,_0x3e8047,_0x177ce9){return function(_0x54602a){logger['info'](_0x77b2('0x33'));return new Promise(function(_0x3c15df,_0x344b0b){var _0x2d400c=moment();var _0x23724a={'method':_0x77b2('0x2f'),'uri':_0x379f01+_0x77b2('0x34'),'body':{'title':intUtil['getString'](_0x3e8047['Subjects'],_0x177ce9,'\x20'),'description':intUtil[_0x77b2('0x35')](_0x3e8047[_0x77b2('0x36')],_0x177ce9,'\x0a'),'owner_id':_0x54602a[_0x77b2('0x1d')],'creater_id':_0x54602a[_0x77b2('0x12')],'targetable_id':_0x54602a['endUserId'],'targetable_type':'Contact','created_at':_0x2d400c[_0x77b2('0x31')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x2d400c[_0x77b2('0x37')](0x1e,'m')[_0x77b2('0x31')](_0x77b2('0x32'))},'json':!![]};_0x23724a['headers']=_0x116721;return rp(_0x23724a)['then'](function(_0x288d0){_0x54602a['ticketId']=_0x288d0[_0x77b2('0x38')]['id'];logger[_0x77b2('0xe')](_0x77b2('0x39'),_0x54602a['ticketId']);_0x3c15df(_0x54602a);})[_0x77b2('0x15')](function(_0x3aa617){logger[_0x77b2('0x16')]('['+[_0x436bec[_0x77b2('0x21')]()]+']',_0x3aa617[_0x77b2('0x22')]);_0x344b0b(_0x3aa617[_0x77b2('0x22')]);});});};}function emit(_0x14560b,_0xde052a,_0xa1c11c){var _0x6418e4={'uri':_0x14560b+_0x77b2('0x3a')+_0xa1c11c};io['to'](util[_0x77b2('0x31')](_0x77b2('0x3b'),_0xde052a))[_0x77b2('0x3c')](_0x77b2('0x3d'),_0x6418e4);}exports['cs']=function(_0x3230a1,_0x218f72,_0x3ed7d0,_0x35b69e,_0x2d353e,_0x5dd399,_0xc8fb81,_0x411a12){var _0x4388f5={};var _0x44dad3={'Authorization':_0x77b2('0x3e')+_0x5dd399[_0x77b2('0x3f')]};_0x5dd399[_0x77b2('0x40')]=intUtil[_0x77b2('0x41')](_0x5dd399[_0x77b2('0x40')]);_0x5dd399[_0x77b2('0x42')]=intUtil[_0x77b2('0x41')](_0x5dd399[_0x77b2('0x42')]);var _0x39cd8c=_0x5dd399['remoteUri'];_0x4388f5[_0x77b2('0x20')]=_0x5dd399[_0x77b2('0x43')];_0x4388f5[_0x77b2('0x28')]=_0x411a12[_0x77b2('0x44')]()==='outbound'?_0x218f72[_0x77b2('0x45')]:_0x218f72[_0x77b2('0x46')];_0x4388f5['callDirection']=_0x411a12===_0x77b2('0x47')||_0x411a12===_0x77b2('0x48')?_0x77b2('0x47'):_0x77b2('0x49');if(_0x35b69e){_0x4388f5['agentEmail']=_0x35b69e[_0x77b2('0x11')];}var _0x56736b=util[_0x77b2('0x31')](_0x77b2('0x4a'),_0x5dd399[_0x77b2('0x42')],_0x218f72['uniqueid'],md5(_0x218f72[_0x77b2('0x4b')]));if(_0x2d353e&&_0x2d353e[_0x77b2('0x4c')]){logger[_0x77b2('0xe')](_0x77b2('0x4d'),'Recording\x20is\x20enabled!');_0x218f72['recordingURL']=_0x56736b;}else if(_0xc8fb81&&_0xc8fb81[_0x77b2('0x4e')]&&_0xc8fb81['recordingFormat']!==_0x77b2('0x4f')){logger['info']('[OUTBOUND]',_0x77b2('0x50'));_0x218f72['recordingURL']=_0x56736b;}else{_0x218f72['recordingURL']='';}return getAdminId(_0x4388f5,_0x411a12,_0x44dad3,_0x39cd8c)[_0x77b2('0x19')](getUser(_0x411a12,_0x44dad3,_0x39cd8c))[_0x77b2('0x19')](getEndUser(_0x411a12,_0x44dad3,_0x39cd8c))[_0x77b2('0x19')](getTicket(_0x411a12,_0x44dad3,_0x39cd8c,_0x3ed7d0,_0x218f72))[_0x77b2('0x19')](function(_0x1c97f4){logger[_0x77b2('0xe')](util[_0x77b2('0x31')](_0x77b2('0x51'),_0x1c97f4['ticketId']));if(_0x411a12!=='unmanaged'){logger[_0x77b2('0xe')]('['+[_0x411a12[_0x77b2('0x21')]()]+']',_0x77b2('0x52'));emit(_0x39cd8c,_0x35b69e[_0x77b2('0x53')],_0x1c97f4[_0x77b2('0x2a')]);}})[_0x77b2('0x15')](function(_0x2df45f){logger[_0x77b2('0x16')]('['+[_0x411a12[_0x77b2('0x21')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x77b2('0x54')](_0x2df45f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x644f=['toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','users','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','headers','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','error','toUpperCase','/api/lookup?q=','&f=','&entities=contact','contacts','contactNumber','mobile_number','endUserId','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','message','/api/tasks','getString','Subjects','Descriptions','Contact','format','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','adminEmail','username'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x644f,0xc2));var _0xf644=function(_0x189305,_0x46c43f){_0x189305=_0x189305-0x0;var _0xea3406=_0x644f[_0x189305];return _0xea3406;};'use strict';var _=require(_0xf644('0x0'));var rp=require(_0xf644('0x1'));var md5=require('md5');var util=require('util');var moment=require(_0xf644('0x2'));var Promise=require(_0xf644('0x3'));var Redis=require(_0xf644('0x4'));var intUtil=require(_0xf644('0x5'));var config=require(_0xf644('0x6'));var logger=require(_0xf644('0x7'))(_0xf644('0x8'));config[_0xf644('0x9')]=_[_0xf644('0xa')](config[_0xf644('0x9')],{'host':_0xf644('0xb'),'port':0x18eb});var io=require(_0xf644('0xc'))(new Redis(config['redis']));function getAdminId(_0x2c2868,_0x11fa91,_0x5c11c7,_0x127499){return new Promise(function(_0x5746ae,_0x4efb6b){var _0x390284=![];var _0x4a490d={'method':_0xf644('0xd'),'uri':_0x127499+_0xf644('0xe'),'json':!![]};_0x4a490d['headers']=_0x5c11c7;logger[_0xf644('0xf')](_0xf644('0x10'));return rp(_0x4a490d)[_0xf644('0x11')](function(_0x5911d3){if(_0x5911d3){var _0x296647=_0x5911d3[_0xf644('0x12')];var _0x516f19=null;for(_0x516f19=0x0;_0x516f19<_0x296647[_0xf644('0x13')];_0x516f19++){if(_0x296647[_0x516f19][_0xf644('0x14')]===_0x2c2868['adminEmail']){_0x2c2868[_0xf644('0x15')]=_0x296647[_0x516f19]['id'];_0x390284=!![];}}if(_0x390284){logger[_0xf644('0xf')](_0xf644('0x16'),_0x2c2868[_0xf644('0x15')]);_0x5746ae(_0x2c2868);}else{_0x4efb6b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4efb6b({'statusCode':0x194,'message':_0xf644('0x17')});}})[_0xf644('0x18')](function(_0x52f74a){logger['error']('['+[_0x11fa91['toUpperCase']()]+']',_0x52f74a['message']);_0x4efb6b(_0x52f74a);});});}function getUser(_0x2587f5,_0x331478,_0x34dec2){return function(_0x329bb9){return new Promise(function(_0x5f38f9,_0x5bd03c){var _0x15d065={'method':_0xf644('0xd'),'uri':_0x34dec2+_0xf644('0xe'),'json':!![]};_0x15d065[_0xf644('0x19')]=_0x331478;logger['info']('Getting\x20user\x20list');return rp(_0x15d065)[_0xf644('0x11')](function(_0x305515){if(_0x305515){var _0x6d3229=_0x305515[_0xf644('0x12')];var _0x29f81a=![];var _0x2bc954=null;if(_0x329bb9[_0xf644('0x1a')]!==null){logger[_0xf644('0xf')]('Getting\x20user\x20with\x20email',_0x329bb9[_0xf644('0x1a')]);_0x329bb9[_0xf644('0x1b')]=_0x329bb9[_0xf644('0x1a')];for(_0x2bc954=0x0;_0x2bc954<_0x6d3229[_0xf644('0x13')];_0x2bc954++){if(_0x6d3229[_0x2bc954]['email']===_0x329bb9[_0xf644('0x1a')]){_0x29f81a=!![];_0x329bb9[_0xf644('0x1c')]=_0x6d3229[_0x2bc954]['id'];logger[_0xf644('0xf')](_0xf644('0x1d'),_0x329bb9[_0xf644('0x1c')]);}}}if(!_0x29f81a){logger[_0xf644('0xf')](_0xf644('0x1e'));_0x329bb9['userEmail']=_0x329bb9['adminEmail'];_0x329bb9[_0xf644('0x1c')]=_0x329bb9[_0xf644('0x15')];_0x29f81a=!![];}if(_0x29f81a){_0x5f38f9(_0x329bb9);}else{_0x5bd03c({'statusCode':0x194,'message':_0xf644('0x17')});}}else{_0x5bd03c({'statusCode':0x194,'message':_0xf644('0x17')});}})[_0xf644('0x18')](function(_0x20d683){logger[_0xf644('0x1f')]('['+[_0x2587f5[_0xf644('0x20')]()]+']',_0x20d683['message']);_0x5bd03c(_0x20d683);});});};}function searchContact(_0x32e8d8,_0x3705a0,_0x54f81b,_0x5acb2a){return new Promise(function(_0x21fbc8,_0x31343f){var _0x16c745={'method':_0xf644('0xd'),'headers':_0x3705a0,'uri':_0x32e8d8+_0xf644('0x21')+_0x5acb2a+_0xf644('0x22')+_0x54f81b+_0xf644('0x23'),'json':!![]};rp(_0x16c745)['then'](function(_0x448c6e){var _0x23c750=_['find'](_0x448c6e['contacts'][_0xf644('0x24')],[_0x54f81b,_0x5acb2a]);_0x21fbc8(_0x23c750);})[_0xf644('0x18')](function(_0x2cdca1){_0x31343f(_0x2cdca1);});});}function getEndUser(_0x423d3d,_0x3e7a5b,_0xa039cf){return function(_0x1fd581){return new Promise(function(_0x390b34,_0x3fd3b2){logger[_0xf644('0xf')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x1fd581[_0xf644('0x25')]));searchContact(_0xa039cf,_0x3e7a5b,_0xf644('0x26'),_0x1fd581[_0xf644('0x25')])[_0xf644('0x11')](function(_0x228321){if(_0x228321){_0x1fd581[_0xf644('0x27')]=_0x228321['id'];logger[_0xf644('0xf')]('Contact\x20found\x20mobile_number:',_0x1fd581[_0xf644('0x27')]);return _0x390b34(_0x1fd581);}searchContact(_0xa039cf,_0x3e7a5b,'work_number',_0x1fd581['contactNumber'])[_0xf644('0x11')](function(_0x316d24){if(_0x316d24){_0x1fd581[_0xf644('0x27')]=_0x316d24['id'];logger['info']('Contact\x20found\x20work_number:',_0x1fd581[_0xf644('0x27')]);return _0x390b34(_0x1fd581);}createEndUser(_0x1fd581,_0x423d3d,_0x3e7a5b,_0xa039cf)[_0xf644('0x11')](function(_0x290693){logger['info'](_0xf644('0x28'),_0x290693[_0xf644('0x27')]);return _0x390b34(_0x290693);});});})['catch'](function(_0xd39316){_0x3fd3b2(_0xd39316);});});};}function createEndUser(_0x67cbfc,_0x27fbc7,_0x4d2aeb,_0x2ab38a){return new Promise(function(_0x42d6e8,_0x5e5e9b){var _0x2686db=moment();var _0x4e51fd={'method':_0xf644('0x29'),'uri':_0x2ab38a+_0xf644('0x2a'),'body':{'contact':{'last_name':_0x67cbfc[_0xf644('0x25')],'work_number':_0x67cbfc[_0xf644('0x25')],'mobile_number':_0x67cbfc[_0xf644('0x25')],'owner_id':_0x67cbfc[_0xf644('0x1c')],'created_at':_0x2686db['format'](_0xf644('0x2b'))}},'json':!![]};_0x4e51fd[_0xf644('0x19')]=_0x4d2aeb;logger[_0xf644('0xf')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x4e51fd)['then'](function(_0x117884){_0x67cbfc[_0xf644('0x27')]=_0x117884[_0xf644('0x2c')]['id'];_0x42d6e8(_0x67cbfc);})[_0xf644('0x18')](function(_0x5c8948){logger[_0xf644('0x1f')]('['+[_0x27fbc7['toUpperCase']()]+']',_0x5c8948[_0xf644('0x2d')]);_0x5e5e9b(_0x5c8948['message']);});});}function getTicket(_0x2d9f52,_0x3475cf,_0x19f508,_0x769e36,_0x52f73d){return function(_0xf0d5d){logger[_0xf644('0xf')]('Creating\x20new\x20task');return new Promise(function(_0x29b511,_0x34c4b9){var _0x54f83d=moment();var _0x101f71={'method':'POST','uri':_0x19f508+_0xf644('0x2e'),'body':{'title':intUtil[_0xf644('0x2f')](_0x769e36[_0xf644('0x30')],_0x52f73d,'\x20'),'description':intUtil[_0xf644('0x2f')](_0x769e36[_0xf644('0x31')],_0x52f73d,'\x0a'),'owner_id':_0xf0d5d['userId'],'creater_id':_0xf0d5d[_0xf644('0x15')],'targetable_id':_0xf0d5d[_0xf644('0x27')],'targetable_type':_0xf644('0x32'),'created_at':_0x54f83d[_0xf644('0x33')](_0xf644('0x2b')),'due_date':_0x54f83d['add'](0x1e,'m')[_0xf644('0x33')](_0xf644('0x2b'))},'json':!![]};_0x101f71[_0xf644('0x19')]=_0x3475cf;return rp(_0x101f71)['then'](function(_0x3c530){_0xf0d5d[_0xf644('0x34')]=_0x3c530[_0xf644('0x35')]['id'];logger[_0xf644('0xf')]('Task\x20created:',_0xf0d5d['ticketId']);_0x29b511(_0xf0d5d);})[_0xf644('0x18')](function(_0x3345e7){logger[_0xf644('0x1f')]('['+[_0x2d9f52[_0xf644('0x20')]()]+']',_0x3345e7['message']);_0x34c4b9(_0x3345e7['message']);});});};}function emit(_0x3c0068,_0xaae13c,_0x8966d6){var _0x4c9838={'uri':_0x3c0068+_0xf644('0x36')+_0x8966d6};io['to'](util[_0xf644('0x33')](_0xf644('0x37'),_0xaae13c))[_0xf644('0x38')](_0xf644('0x39'),_0x4c9838);}exports['cs']=function(_0x3a224b,_0x2139cb,_0x2f04c3,_0x101c35,_0x4b7b07,_0x3c5356,_0x333195,_0x1756bc){var _0x212a99={};var _0x264bd1={'Authorization':_0xf644('0x3a')+_0x3c5356[_0xf644('0x3b')]};_0x3c5356['remoteUri']=intUtil[_0xf644('0x3c')](_0x3c5356[_0xf644('0x3d')]);_0x3c5356['serverUrl']=intUtil['stripTrailingSlash'](_0x3c5356['serverUrl']);var _0x25802b=_0x3c5356['remoteUri'];_0x212a99[_0xf644('0x3e')]=_0x3c5356[_0xf644('0x3f')];_0x212a99['contactNumber']=_0x1756bc[_0xf644('0x40')]()===_0xf644('0x41')?_0x2139cb[_0xf644('0x42')]:_0x2139cb[_0xf644('0x43')];_0x212a99[_0xf644('0x44')]=_0x1756bc===_0xf644('0x45')||_0x1756bc===_0xf644('0x46')?_0xf644('0x45'):'outbound';if(_0x101c35){_0x212a99[_0xf644('0x1a')]=_0x101c35[_0xf644('0x14')];}var _0x2294ef=util['format'](_0xf644('0x47'),_0x3c5356[_0xf644('0x48')],_0x2139cb[_0xf644('0x49')],md5(_0x2139cb['uniqueid']));if(_0x4b7b07&&_0x4b7b07[_0xf644('0x4a')]){logger['info'](_0xf644('0x4b'),'Recording\x20is\x20enabled!');_0x2139cb[_0xf644('0x4c')]=_0x2294ef;}else if(_0x333195&&_0x333195[_0xf644('0x4d')]&&_0x333195['recordingFormat']!==_0xf644('0x4e')){logger[_0xf644('0xf')](_0xf644('0x4f'),_0xf644('0x50'));_0x2139cb[_0xf644('0x4c')]=_0x2294ef;}else{_0x2139cb['recordingURL']='';}return getAdminId(_0x212a99,_0x1756bc,_0x264bd1,_0x25802b)['then'](getUser(_0x1756bc,_0x264bd1,_0x25802b))[_0xf644('0x11')](getEndUser(_0x1756bc,_0x264bd1,_0x25802b))[_0xf644('0x11')](getTicket(_0x1756bc,_0x264bd1,_0x25802b,_0x2f04c3,_0x2139cb))[_0xf644('0x11')](function(_0x406394){logger[_0xf644('0xf')](util[_0xf644('0x33')](_0xf644('0x51'),_0x406394[_0xf644('0x34')]));if(_0x1756bc!==_0xf644('0x46')){logger[_0xf644('0xf')]('['+[_0x1756bc[_0xf644('0x20')]()]+']',_0xf644('0x52'));emit(_0x25802b,_0x101c35[_0xf644('0x53')],_0x406394[_0xf644('0x27')]);}})['catch'](function(_0x11ed35){logger[_0xf644('0x1f')]('['+[_0x1756bc[_0xf644('0x20')]()]+_0xf644('0x54'),util[_0xf644('0x55')](_0x11ed35,{'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 6caecd3..979b90d 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 _0x14a0=['../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./dynamics365','./freshsales','zendesk','freshdesk','zoho','desk','freshsales','data1','toLowerCase','data2','find','Configurations','queue','outbound','log','unmanaged','salesforce','sugarcrm','vtiger','servicenow','dynamics365'];(function(_0x492c27,_0x75ef3c){var _0x266bde=function(_0x420db5){while(--_0x420db5){_0x492c27['push'](_0x492c27['shift']());}};_0x266bde(++_0x75ef3c);}(_0x14a0,0x8e));var _0x014a=function(_0xc20bd9,_0x3a7618){_0xc20bd9=_0xc20bd9-0x0;var _0x41c6ce=_0x14a0[_0xc20bd9];return _0x41c6ce;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var zendesk=require(_0x014a('0x1'));var salesforce=require(_0x014a('0x2'));var sugarcrm=require(_0x014a('0x3'));var freshdesk=require(_0x014a('0x4'));var zoho=require(_0x014a('0x5'));var desk=require(_0x014a('0x6'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0x014a('0x7'));var freshsales=require(_0x014a('0x8'));var integrations=[_0x014a('0x9'),'salesforce','sugarcrm',_0x014a('0xa'),_0x014a('0xb'),_0x014a('0xc'),'vtiger','dynamics365',_0x014a('0xd'),'servicenow'];exports['exec']=function(_0x5aa52f,_0x4f3539,_0x330469,_0x4c7418,_0x431be8,_0x168c70){if(_0x330469){if(_['includes'](integrations,_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')]())){try{var _0x2c84ad=null;var _0x43bfeb='';var _0x1bcd1=_0x330469[_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')]()];if(_0x1bcd1){var _0x23c917=_0x1bcd1[_0x5aa52f[_0x014a('0x10')]];if(_0x23c917){var _0x71535d=_[_0x014a('0x11')](_0x23c917[_0x014a('0x12')],{'id':parseInt(_0x5aa52f['data3'],0xa)});if(_0x71535d){if(_0x4c7418){if(_0x431be8&&_0x4f3539[_0x014a('0x13')]){_0x43bfeb=_0x014a('0x13');}else if(_0x4f3539['routeId']){_0x43bfeb=_0x014a('0x14');}else{console[_0x014a('0x15')]('EVENT\x20UNKNOWN',_0x4f3539);}}else{_0x43bfeb=_0x014a('0x16');}switch(_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')]()){case _0x014a('0x9'):zendesk[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0x17'):salesforce[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0x18'):sugarcrm[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0xa'):freshdesk[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0xb'):zoho[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0xc'):desk[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0x19'):vtiger[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0xd'):freshsales['cs'](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70,_0x43bfeb);break;case _0x014a('0x1a'):servicenow['cs'](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70,_0x43bfeb);break;case _0x014a('0x1b'):dynamics365['cs'](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70,_0x43bfeb);break;default:console[_0x014a('0x15')]('unknown\x20integration');}}else{_0x2c84ad=require(_0x014a('0x1c'))(_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')]());_0x2c84ad[_0x014a('0x1d')](_0x014a('0x1e'),util[_0x014a('0x1f')](_0x014a('0x20'),_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')](),_0x5aa52f['data3']));}}else{_0x2c84ad=require(_0x014a('0x1c'))(_0x5aa52f['data1'][_0x014a('0xf')]());_0x2c84ad[_0x014a('0x1d')](_0x014a('0x1e'),util[_0x014a('0x1f')](_0x014a('0x21'),_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')](),_0x5aa52f[_0x014a('0x10')]));}}else{}}catch(_0x165a42){console['error'](_0x165a42);}}}}; \ No newline at end of file +var _0x955f=['%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./servicenow','./freshsales','zendesk','salesforce','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','unmanaged','desk','unknown\x20integration','error','format','../../../../config/logger','[EXEC]'];(function(_0x12c456,_0x1f4f92){var _0x24e1f3=function(_0x4dda32){while(--_0x4dda32){_0x12c456['push'](_0x12c456['shift']());}};_0x24e1f3(++_0x1f4f92);}(_0x955f,0x1eb));var _0xf955=function(_0x27f633,_0x23c85e){_0x27f633=_0x27f633-0x0;var _0x402544=_0x955f[_0x27f633];return _0x402544;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var zendesk=require(_0xf955('0x2'));var salesforce=require(_0xf955('0x3'));var sugarcrm=require(_0xf955('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0xf955('0x5'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0xf955('0x6'));var dynamics365=require('./dynamics365');var freshsales=require(_0xf955('0x7'));var integrations=[_0xf955('0x8'),_0xf955('0x9'),'sugarcrm',_0xf955('0xa'),_0xf955('0xb'),'desk',_0xf955('0xc'),_0xf955('0xd'),_0xf955('0xe'),_0xf955('0xf')];exports[_0xf955('0x10')]=function(_0x421e4a,_0x186719,_0x4d213a,_0xf7e3e,_0x5b0afa,_0x2d59e9){if(_0x4d213a){if(_[_0xf955('0x11')](integrations,_0x421e4a[_0xf955('0x12')]['toLowerCase']())){try{var _0x2f61b8=null;var _0x542347='';var _0x23e0c6=_0x4d213a[_0x421e4a['data1'][_0xf955('0x13')]()];if(_0x23e0c6){var _0x2ff7e5=_0x23e0c6[_0x421e4a[_0xf955('0x14')]];if(_0x2ff7e5){var _0x109bc5=_[_0xf955('0x15')](_0x2ff7e5[_0xf955('0x16')],{'id':parseInt(_0x421e4a[_0xf955('0x17')],0xa)});if(_0x109bc5){if(_0xf7e3e){if(_0x5b0afa&&_0x186719[_0xf955('0x18')]){_0x542347=_0xf955('0x18');}else if(_0x186719[_0xf955('0x19')]){_0x542347='outbound';}else{console[_0xf955('0x1a')]('EVENT\x20UNKNOWN',_0x186719);}}else{_0x542347=_0xf955('0x1b');}switch(_0x421e4a[_0xf955('0x12')][_0xf955('0x13')]()){case _0xf955('0x8'):zendesk[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case'salesforce':salesforce[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case'sugarcrm':sugarcrm[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case _0xf955('0xa'):freshdesk[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case _0xf955('0xb'):zoho[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case _0xf955('0x1c'):desk[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case'vtiger':vtiger[_0x542347](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9);break;case _0xf955('0xe'):freshsales['cs'](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9,_0x542347);break;case _0xf955('0xf'):servicenow['cs'](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9,_0x542347);break;case _0xf955('0xd'):dynamics365['cs'](_0x421e4a,_0x186719,_0x109bc5,_0xf7e3e,_0x5b0afa,_0x2ff7e5,_0x2d59e9,_0x542347);break;default:console[_0xf955('0x1a')](_0xf955('0x1d'));}}else{_0x2f61b8=require('../../../../config/logger')(_0x421e4a[_0xf955('0x12')][_0xf955('0x13')]());_0x2f61b8[_0xf955('0x1e')]('[EXEC]',util[_0xf955('0x1f')]('%s\x20configuration\x20#%s\x20not\x20found',_0x421e4a[_0xf955('0x12')][_0xf955('0x13')](),_0x421e4a[_0xf955('0x17')]));}}else{_0x2f61b8=require(_0xf955('0x20'))(_0x421e4a[_0xf955('0x12')]['toLowerCase']());_0x2f61b8[_0xf955('0x1e')](_0xf955('0x21'),util[_0xf955('0x1f')](_0xf955('0x22'),_0x421e4a[_0xf955('0x12')][_0xf955('0x13')](),_0x421e4a[_0xf955('0x14')]));}}else{}}catch(_0x552cf3){console[_0xf955('0x1e')](_0x552cf3);}}}}; \ 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 8fec146..36a6e71 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 _0x99cf=['lead','Company','upperFirst','forEach','idField','content','toString','variable','variableName','type','Variable','name','toLowerCase','password','concat','Connection','https://login.salesforce.com','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','remoteUri','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','Fields','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','instanceUrl','error','[OUTBOUND]','monitor_format','lastevent','calleridnum','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','defaults','redis','socket.io-emitter','emit','ticketType','Task','assign','utc','WhoId','Case','getString','Subjects','ContactId','sobject','create','isNil','validateEmail','find','execute','length','Email','info','resolve','identity','then','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','moduleSearch','contact_lead','Contact','Lead','contact','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','Phone','Name','Enduser\x20with\x20phone\x20%s\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x99cf,0x10e));var _0xf99c=function(_0x3c7502,_0xd1cb4b){_0x3c7502=_0x3c7502-0x0;var _0x8a3da3=_0x99cf[_0x3c7502];return _0x8a3da3;};'use strict';var _=require(_0xf99c('0x0'));var rp=require(_0xf99c('0x1'));var moment=require(_0xf99c('0x2'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0xf99c('0x3'));var util=require(_0xf99c('0x4'));var Redis=require(_0xf99c('0x5'));var intUtil=require(_0xf99c('0x6'));var config=require(_0xf99c('0x7'));var logger=require('../../../../config/logger')(_0xf99c('0x8'));config['redis']=_[_0xf99c('0x9')](config[_0xf99c('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xf99c('0xb'))(new Redis(config[_0xf99c('0xa')]));function emit(_0x54bcd5,_0x201599,_0x260054){io['to'](_0x54bcd5)[_0xf99c('0xc')](_0x201599,_0x260054);}function getTicket(_0x572a81,_0x889200,_0x4b96e0,_0x6c9301,_0x4d597b,_0x30f7e2,_0x346b0d,_0x5212df){var _0x3dbad7={};if(_0x6c9301[_0xf99c('0xd')]===_0xf99c('0xe')){_0x3dbad7=Object[_0xf99c('0xf')]({},{'OwnerId':_0x889200['id'],'ActivityDate':moment[_0xf99c('0x10')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x6c9301['Subjects'],_0x4d597b,'\x20'),'Description':intUtil['getString'](_0x6c9301['Descriptions'],_0x4d597b,'\x0a')},getCustomFields(_0x30f7e2,_0x4d597b));if(_0x4b96e0){_0x3dbad7[_0xf99c('0x11')]=_0x4b96e0['id'];}}else if(_0x6c9301[_0xf99c('0xd')]===_0xf99c('0x12')){_0x3dbad7=Object[_0xf99c('0xf')]({},{'OwnerId':_0x889200['id'],'Subject':intUtil[_0xf99c('0x13')](_0x6c9301[_0xf99c('0x14')],_0x4d597b,'\x20'),'Description':intUtil[_0xf99c('0x13')](_0x6c9301['Descriptions'],_0x4d597b,'\x0a')},getCustomFields(_0x30f7e2,_0x4d597b));if(_0x4b96e0){_0x3dbad7[_0xf99c('0x15')]=_0x4b96e0['id'];}}return _0x346b0d[_0xf99c('0x16')](_0x6c9301[_0xf99c('0xd')])[_0xf99c('0x17')](_0x3dbad7);}function getUser(_0x57c24a,_0x567921,_0x55da97){if(!_[_0xf99c('0x18')](_0x567921)&&intUtil[_0xf99c('0x19')](_0x567921)){var _0x33a01a={'Email':_0x567921};var _0x64b46c={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x55da97[_0xf99c('0x16')]('User')[_0xf99c('0x1a')](_0x33a01a,_0x64b46c)[_0xf99c('0x1b')]()['then'](function(_0x33f2c3){if(_0x33f2c3[_0xf99c('0x1c')]){var _0xa43bed=_[_0xf99c('0x1a')](_0x33f2c3,function(_0x1f6ad7){return _0x1f6ad7[_0xf99c('0x1d')]===_0x567921;});if(_0xa43bed){logger[_0xf99c('0x1e')]('Agent\x20%s\x20found.',_0x567921);return BPromise[_0xf99c('0x1f')]({'id':_0xa43bed['Id'],'name':_0xa43bed['Name']});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x567921);return _0x55da97[_0xf99c('0x20')]()[_0xf99c('0x21')](function(_0x24cd88){return BPromise['resolve']({'id':_0x24cd88[_0xf99c('0x22')],'name':_0x24cd88[_0xf99c('0x23')]});});}});}else{logger[_0xf99c('0x1e')](_0xf99c('0x24'),_0x567921);return _0x55da97[_0xf99c('0x20')]()[_0xf99c('0x21')](function(_0x3bb9a4){return BPromise['resolve']({'id':_0x3bb9a4[_0xf99c('0x22')],'name':_0x3bb9a4[_0xf99c('0x23')]});});}}function getEndUser(_0x20458f,_0x1f94d7,_0x4ac993,_0x4c2206,_0x2ae487){var _0x5a549f={'Phone':_0x4c2206};var _0x37396c={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xf99c('0x21')](function(){if(_0x1f94d7[_0xf99c('0xd')]==='Task'){logger[_0xf99c('0x1e')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x4c2206,_0x1f94d7[_0xf99c('0x25')]);switch(_0x1f94d7[_0xf99c('0x25')]){case _0xf99c('0x26'):return _0x2ae487[_0xf99c('0x16')](_0xf99c('0x27'))[_0xf99c('0x1a')](_0x5a549f,_0x37396c)[_0xf99c('0x1b')]()['then'](function(_0x390737){if(_0x390737&&_0x390737[_0xf99c('0x1c')]){return _0x390737;}else{return _0x2ae487[_0xf99c('0x16')](_0xf99c('0x28'))[_0xf99c('0x1a')](_0x5a549f,_0x37396c);}});case _0xf99c('0x29'):return _0x2ae487['sobject'](_0xf99c('0x27'))['find'](_0x5a549f,_0x37396c)[_0xf99c('0x1b')]();case'lead':return _0x2ae487['sobject'](_0xf99c('0x28'))['find'](_0x5a549f,_0x37396c);default:return null;}}else if(_0x1f94d7['ticketType']===_0xf99c('0x12')){logger[_0xf99c('0x1e')](_0xf99c('0x2a'),_0x4c2206,'contact');return _0x2ae487['sobject'](_0xf99c('0x27'))[_0xf99c('0x1a')](_0x5a549f,_0x37396c)[_0xf99c('0x1b')]();}})['then'](function(_0x3a3913){if(_0x3a3913&&_0x3a3913[_0xf99c('0x1c')]){var _0x281ae4=_['find'](_0x3a3913,function(_0x475ba5){return _0x475ba5[_0xf99c('0x2b')]===_0x4c2206;});if(_0x281ae4){return BPromise[_0xf99c('0x1f')]({'id':_0x281ae4['Id'],'name':_0x281ae4[_0xf99c('0x2c')],'phone':_0x281ae4[_0xf99c('0x2b')]});}}})['then'](function(_0x3b71fc){if(_0x3b71fc){logger[_0xf99c('0x1e')](_0xf99c('0x2d'),_0x4c2206);return BPromise['resolve'](_0x3b71fc);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x4c2206);var _0x3669c3={'LastName':_0x4ac993!==_0xf99c('0x2e')?_0x4ac993:util[_0xf99c('0x2f')](_0xf99c('0x30'),_0x4c2206),'Phone':_0x4c2206};if(_0x1f94d7[_0xf99c('0x31')]){if(_0x1f94d7[_0xf99c('0x31')]===_0xf99c('0x29')){logger[_0xf99c('0x1e')](_0xf99c('0x32'),_0x4c2206,_0x1f94d7['moduleCreate']);}else if(_0x1f94d7['moduleCreate']===_0xf99c('0x33')&&_0x1f94d7['ticketType']===_0xf99c('0xe')){logger[_0xf99c('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4c2206,_0x1f94d7[_0xf99c('0x31')]);_0x3669c3[_0xf99c('0x34')]='No\x20Company';}else{return null;}}return _0x2ae487[_0xf99c('0x16')](_[_0xf99c('0x35')](_0x1f94d7[_0xf99c('0x31')]))[_0xf99c('0x17')](_0x3669c3);}});}function getCustomFields(_0x5e65cd,_0x953214){var _0x1c55fe={};if(_0x5e65cd['length']>0x0){_[_0xf99c('0x36')](_0x5e65cd,function(_0x2fc8db){if(_0x2fc8db['type']==='string'&&_0x2fc8db[_0xf99c('0x37')]){_0x1c55fe[_0x2fc8db[_0xf99c('0x37')]]=_0x2fc8db[_0xf99c('0x38')][_0xf99c('0x39')]();}else if(_0x2fc8db['type']===_0xf99c('0x3a')&&_0x2fc8db[_0xf99c('0x3b')]&&_0x2fc8db[_0xf99c('0x37')]){_0x953214[_0x2fc8db['variableName']]&&(_0x1c55fe[_0x2fc8db[_0xf99c('0x37')]]=_0x953214[_0x2fc8db[_0xf99c('0x3b')]][_0xf99c('0x39')]());}else if(_0x2fc8db[_0xf99c('0x3c')]==='customVariable'&&_0x2fc8db[_0xf99c('0x3d')]&&_0x2fc8db[_0xf99c('0x3d')][_0xf99c('0x3e')]&&_0x2fc8db[_0xf99c('0x37')]){_0x953214[_0x2fc8db['Variable'][_0xf99c('0x3e')][_0xf99c('0x3f')]()]&&(_0x1c55fe[_0x2fc8db[_0xf99c('0x37')]]=_0x953214[_0x2fc8db[_0xf99c('0x3d')][_0xf99c('0x3e')][_0xf99c('0x3f')]()]['toString']());}});}return _0x1c55fe;}function getConnection(_0x37326c){var _0x5689e0=_0x37326c[_0xf99c('0x40')][_0xf99c('0x41')](_0x37326c['securityToken']);var _0x1279cc=new jsforce[(_0xf99c('0x42'))]({'oauth2':{'loginUrl':_0x37326c['remoteUri']||_0xf99c('0x43'),'clientId':_0x37326c['clientId'],'clientSecret':_0x37326c[_0xf99c('0x44')]}});return _0x1279cc[_0xf99c('0x45')](_0x37326c[_0xf99c('0x46')],_0x5689e0)[_0xf99c('0x21')](function(){logger[_0xf99c('0x1e')]('Connection\x20established.');return _0x1279cc;});}exports[_0xf99c('0x47')]=function(_0x327d36,_0x21ed36,_0x413242,_0x332023,_0x4fc240,_0x23e7ba){var _0x9a114,_0x34a1ef,_0x26853c,_0x2cb999;_0x23e7ba[_0xf99c('0x48')]=intUtil[_0xf99c('0x49')](_0x23e7ba[_0xf99c('0x48')]);_0x23e7ba[_0xf99c('0x4a')]=intUtil['stripTrailingSlash'](_0x23e7ba[_0xf99c('0x4a')]);if(_0x4fc240&&_0x4fc240['monitor_format']){logger[_0xf99c('0x1e')](_0xf99c('0x4b'),'Recording\x20is\x20enabled!');_0x21ed36['recordingURL']=util[_0xf99c('0x2f')](_0xf99c('0x4c'),_0x23e7ba[_0xf99c('0x48')],_0x21ed36[_0xf99c('0x4d')],md5(_0x21ed36[_0xf99c('0x4d')]));}else{_0x21ed36[_0xf99c('0x4e')]='';}return getConnection(_0x23e7ba)[_0xf99c('0x21')](function(_0x534ca3){_0x2cb999=_0x534ca3;return getUser(_0x23e7ba,_0x332023[_0xf99c('0x4f')],_0x2cb999);})[_0xf99c('0x21')](function(_0x3dc59a){_0x9a114=_0x3dc59a;return getEndUser(_0x23e7ba,_0x413242,_0x21ed36[_0xf99c('0x50')],_0x21ed36['calleridnum'],_0x2cb999);})[_0xf99c('0x21')](function(_0x12e10){_0x34a1ef=_0x12e10;return getTicket(_0x23e7ba,_0x9a114,_0x34a1ef,_0x413242,_0x21ed36,_0x413242[_0xf99c('0x51')],_0x2cb999,_0xf99c('0x47'));})[_0xf99c('0x21')](function(_0x3a6cd9){_0x26853c=_0x3a6cd9;logger[_0xf99c('0x1e')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x26853c['id']);logger[_0xf99c('0x1e')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x26853c['id'],_0x332023[_0xf99c('0x3e')],_0x23e7ba['type']);switch(_0x23e7ba['type']){case _0xf99c('0x52'):emit(util[_0xf99c('0x2f')]('user:%s',_0x332023[_0xf99c('0x3e')]),_0xf99c('0x53'),{'recordId':_0x26853c['id']});break;case _0xf99c('0x54'):emit(util['format'](_0xf99c('0x55'),_0x332023['name']),_0xf99c('0x56'),{'uri':util['format'](_0xf99c('0x57'),_0x2cb999['instanceUrl'],_0x26853c['id'])});break;default:logger['error'](_0xf99c('0x58'));}})[_0xf99c('0x59')](function(_0x1a7347){logger['error']('[QUEUE]',JSON[_0xf99c('0x5a')](_0x1a7347));});};exports['outbound']=function(_0x404282,_0xac14e7,_0x3c3796,_0x23e3cd,_0x1bef93,_0x298c12,_0x386fd8){var _0x3f407f,_0x50958f,_0x3354c8,_0x3ff43e;_0x298c12[_0xf99c('0x48')]=intUtil[_0xf99c('0x49')](_0x298c12['serverUrl']);_0x298c12[_0xf99c('0x4a')]=intUtil[_0xf99c('0x49')](_0x298c12[_0xf99c('0x4a')]);if(_0x386fd8&&_0x386fd8[_0xf99c('0x5b')]&&_0x386fd8[_0xf99c('0x5b')]!==_0xf99c('0x5c')){logger['info']('[OUTBOUND]',_0xf99c('0x5d'));_0xac14e7[_0xf99c('0x4e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x298c12[_0xf99c('0x48')],_0xac14e7['uniqueid'],md5(_0xac14e7[_0xf99c('0x4d')]));}return getConnection(_0x298c12)[_0xf99c('0x21')](function(_0x18f4d4){_0x3ff43e=_0x18f4d4;return getUser(_0x298c12,_0x23e3cd[_0xf99c('0x4f')],_0x3ff43e);})['then'](function(_0x16a133){_0x3f407f=_0x16a133;return getEndUser(_0x298c12,_0x3c3796,_0xac14e7[_0xf99c('0x5e')],_0xac14e7[_0xf99c('0x5f')],_0x3ff43e);})[_0xf99c('0x21')](function(_0x4b306d){_0x50958f=_0x4b306d;return getTicket(_0x298c12,_0x3f407f,_0x50958f,_0x3c3796,_0xac14e7,_0x3c3796['Fields'],_0x3ff43e,_0xf99c('0x60'));})[_0xf99c('0x21')](function(_0x269fa8){_0x3354c8=_0x269fa8;logger[_0xf99c('0x1e')](_0xf99c('0x61'),_0x3354c8['id']);logger[_0xf99c('0x1e')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x3354c8['id'],_0x23e3cd[_0xf99c('0x3e')],_0x298c12[_0xf99c('0x3c')]);switch(_0x298c12[_0xf99c('0x3c')]){case _0xf99c('0x52'):emit(util['format']('user:%s',_0x23e3cd[_0xf99c('0x3e')]),_0xf99c('0x53'),{'recordId':_0x3354c8['id']});break;case _0xf99c('0x54'):emit(util['format']('user:%s',_0x23e3cd[_0xf99c('0x3e')]),'trigger:browser:url',{'uri':util[_0xf99c('0x2f')](_0xf99c('0x57'),_0x3ff43e[_0xf99c('0x62')],_0x3354c8['id'])});break;default:logger[_0xf99c('0x63')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x30be8c){logger[_0xf99c('0x63')](_0xf99c('0x64'),JSON[_0xf99c('0x5a')](_0x30be8c));});};exports['unmanaged']=function(_0x1ebe9d,_0x1af2eb,_0x2a86ec,_0x188e71,_0x49abac,_0x2797ff){var _0x277387,_0x315288,_0x411edc,_0x1cb607;_0x2797ff[_0xf99c('0x48')]=intUtil['stripTrailingSlash'](_0x2797ff[_0xf99c('0x48')]);_0x2797ff[_0xf99c('0x4a')]=intUtil[_0xf99c('0x49')](_0x2797ff[_0xf99c('0x4a')]);if(_0x49abac&&_0x49abac[_0xf99c('0x65')]){logger[_0xf99c('0x1e')]('['+_0x1af2eb[_0xf99c('0x66')]['toUpperCase']()+']',_0xf99c('0x5d'));_0x1af2eb[_0xf99c('0x4e')]=util[_0xf99c('0x2f')](_0xf99c('0x4c'),_0x2797ff[_0xf99c('0x48')],_0x1af2eb[_0xf99c('0x4d')],md5(_0x1af2eb[_0xf99c('0x4d')]));}else{_0x1af2eb[_0xf99c('0x4e')]='';}return getConnection(_0x2797ff)[_0xf99c('0x21')](function(_0x4768c0){_0x1cb607=_0x4768c0;if(!_['isNil'](_0x188e71)){return getUser(_0x2797ff,_0x188e71[_0xf99c('0x3e')],_0x1cb607);}else{return getUser(_0x2797ff,null,_0x1cb607);}})[_0xf99c('0x21')](function(_0x589875){_0x277387=_0x589875;return getEndUser(_0x2797ff,_0x2a86ec,_0x1af2eb[_0xf99c('0x50')],_0x1af2eb[_0xf99c('0x67')],_0x1cb607);})[_0xf99c('0x21')](function(_0x2028a9){_0x315288=_0x2028a9;return getTicket(_0x2797ff,_0x277387,_0x315288,_0x2a86ec,_0x1af2eb,_0x2a86ec[_0xf99c('0x51')],_0x1cb607);})[_0xf99c('0x21')](function(_0x5d5be7){_0x411edc=_0x5d5be7;logger[_0xf99c('0x1e')]('['+_0x1af2eb[_0xf99c('0x66')][_0xf99c('0x68')]()+_0xf99c('0x69'),_0x411edc['id']);logger[_0xf99c('0x1e')]('['+_0x1af2eb[_0xf99c('0x66')][_0xf99c('0x68')]()+_0xf99c('0x6a'),_0x2797ff[_0xf99c('0x3c')]);})['catch'](function(_0x27008f){logger['error']('['+_0x1af2eb[_0xf99c('0x66')]['toUpperCase']()+']',JSON[_0xf99c('0x5a')](_0x27008f));});}; \ No newline at end of file +var _0x25d7=['Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','upperFirst','forEach','type','string','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','calleridnum','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','bluebird','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','Task','assign','utc','getString','Descriptions','ticketType','Case','Subjects','ContactId','sobject','create','isNil','validateEmail','find','execute','then','length','Email','info','Agent\x20%s\x20found.','Name','user_id','display_name','identity','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Lead','Contact','lead','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format'];(function(_0x2c72f0,_0x2e182e){var _0x297da1=function(_0x216d7d){while(--_0x216d7d){_0x2c72f0['push'](_0x2c72f0['shift']());}};_0x297da1(++_0x2e182e);}(_0x25d7,0x18c));var _0x725d=function(_0x7a112,_0x2eb4a0){_0x7a112=_0x7a112-0x0;var _0x136dc5=_0x25d7[_0x7a112];return _0x136dc5;};'use strict';var _=require(_0x725d('0x0'));var rp=require(_0x725d('0x1'));var moment=require(_0x725d('0x2'));var BPromise=require(_0x725d('0x3'));var md5=require(_0x725d('0x4'));var jsforce=require(_0x725d('0x5'));var util=require(_0x725d('0x6'));var Redis=require('ioredis');var intUtil=require(_0x725d('0x7'));var config=require(_0x725d('0x8'));var logger=require(_0x725d('0x9'))(_0x725d('0xa'));config[_0x725d('0xb')]=_[_0x725d('0xc')](config['redis'],{'host':_0x725d('0xd'),'port':0x18eb});var io=require(_0x725d('0xe'))(new Redis(config[_0x725d('0xb')]));function emit(_0x3bdb44,_0x5840db,_0x81e8a3){io['to'](_0x3bdb44)['emit'](_0x5840db,_0x81e8a3);}function getTicket(_0x143f2a,_0x595713,_0x226676,_0x69bbce,_0x442864,_0x55c6df,_0x310fcc,_0x6cb274){var _0x50d934={};if(_0x69bbce['ticketType']===_0x725d('0xf')){_0x50d934=Object[_0x725d('0x10')]({},{'OwnerId':_0x595713['id'],'ActivityDate':moment[_0x725d('0x11')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x725d('0x12')](_0x69bbce['Subjects'],_0x442864,'\x20'),'Description':intUtil['getString'](_0x69bbce[_0x725d('0x13')],_0x442864,'\x0a')},getCustomFields(_0x55c6df,_0x442864));if(_0x226676){_0x50d934['WhoId']=_0x226676['id'];}}else if(_0x69bbce[_0x725d('0x14')]===_0x725d('0x15')){_0x50d934=Object[_0x725d('0x10')]({},{'OwnerId':_0x595713['id'],'Subject':intUtil[_0x725d('0x12')](_0x69bbce[_0x725d('0x16')],_0x442864,'\x20'),'Description':intUtil[_0x725d('0x12')](_0x69bbce[_0x725d('0x13')],_0x442864,'\x0a')},getCustomFields(_0x55c6df,_0x442864));if(_0x226676){_0x50d934[_0x725d('0x17')]=_0x226676['id'];}}return _0x310fcc[_0x725d('0x18')](_0x69bbce['ticketType'])[_0x725d('0x19')](_0x50d934);}function getUser(_0x46f861,_0x33b8f0,_0x2caaa3){if(!_[_0x725d('0x1a')](_0x33b8f0)&&intUtil[_0x725d('0x1b')](_0x33b8f0)){var _0x5e5779={'Email':_0x33b8f0};var _0x2eca3a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2caaa3[_0x725d('0x18')]('User')[_0x725d('0x1c')](_0x5e5779,_0x2eca3a)[_0x725d('0x1d')]()[_0x725d('0x1e')](function(_0xe1ce86){if(_0xe1ce86[_0x725d('0x1f')]){var _0x5a469e=_[_0x725d('0x1c')](_0xe1ce86,function(_0xeb2577){return _0xeb2577[_0x725d('0x20')]===_0x33b8f0;});if(_0x5a469e){logger[_0x725d('0x21')](_0x725d('0x22'),_0x33b8f0);return BPromise['resolve']({'id':_0x5a469e['Id'],'name':_0x5a469e[_0x725d('0x23')]});}}else{logger[_0x725d('0x21')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x33b8f0);return _0x2caaa3['identity']()['then'](function(_0x148f09){return BPromise['resolve']({'id':_0x148f09[_0x725d('0x24')],'name':_0x148f09[_0x725d('0x25')]});});}});}else{logger[_0x725d('0x21')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x33b8f0);return _0x2caaa3[_0x725d('0x26')]()['then'](function(_0x3fb35a){return BPromise[_0x725d('0x27')]({'id':_0x3fb35a[_0x725d('0x24')],'name':_0x3fb35a[_0x725d('0x25')]});});}}function getEndUser(_0x53f9ad,_0x110ddc,_0x3de549,_0x5a02d6,_0x5cdaa8){var _0x379931={'Phone':_0x5a02d6};var _0x513bdd={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x725d('0x27')]()[_0x725d('0x1e')](function(){if(_0x110ddc[_0x725d('0x14')]==='Task'){logger[_0x725d('0x21')](_0x725d('0x28'),_0x5a02d6,_0x110ddc[_0x725d('0x29')]);switch(_0x110ddc[_0x725d('0x29')]){case _0x725d('0x2a'):return _0x5cdaa8[_0x725d('0x18')]('Contact')[_0x725d('0x1c')](_0x379931,_0x513bdd)['execute']()['then'](function(_0x2d5f9f){if(_0x2d5f9f&&_0x2d5f9f[_0x725d('0x1f')]){return _0x2d5f9f;}else{return _0x5cdaa8[_0x725d('0x18')](_0x725d('0x2b'))[_0x725d('0x1c')](_0x379931,_0x513bdd);}});case'contact':return _0x5cdaa8[_0x725d('0x18')](_0x725d('0x2c'))[_0x725d('0x1c')](_0x379931,_0x513bdd)[_0x725d('0x1d')]();case _0x725d('0x2d'):return _0x5cdaa8['sobject'](_0x725d('0x2b'))['find'](_0x379931,_0x513bdd);default:return null;}}else if(_0x110ddc[_0x725d('0x14')]==='Case'){logger[_0x725d('0x21')](_0x725d('0x28'),_0x5a02d6,_0x725d('0x2e'));return _0x5cdaa8[_0x725d('0x18')](_0x725d('0x2c'))[_0x725d('0x1c')](_0x379931,_0x513bdd)[_0x725d('0x1d')]();}})['then'](function(_0x43bdd5){if(_0x43bdd5&&_0x43bdd5[_0x725d('0x1f')]){var _0x2f377e=_[_0x725d('0x1c')](_0x43bdd5,function(_0x99b1f7){return _0x99b1f7['Phone']===_0x5a02d6;});if(_0x2f377e){return BPromise['resolve']({'id':_0x2f377e['Id'],'name':_0x2f377e[_0x725d('0x23')],'phone':_0x2f377e[_0x725d('0x2f')]});}}})['then'](function(_0x271726){if(_0x271726){logger[_0x725d('0x21')](_0x725d('0x30'),_0x5a02d6);return BPromise['resolve'](_0x271726);}else{logger[_0x725d('0x21')](_0x725d('0x31'),_0x5a02d6);var _0x4f2730={'LastName':_0x3de549!==_0x725d('0x32')?_0x3de549:util[_0x725d('0x33')](_0x725d('0x34'),_0x5a02d6),'Phone':_0x5a02d6};if(_0x110ddc[_0x725d('0x35')]){if(_0x110ddc[_0x725d('0x35')]===_0x725d('0x2e')){logger[_0x725d('0x21')](_0x725d('0x36'),_0x5a02d6,_0x110ddc[_0x725d('0x35')]);}else if(_0x110ddc['moduleCreate']===_0x725d('0x2d')&&_0x110ddc[_0x725d('0x14')]===_0x725d('0xf')){logger[_0x725d('0x21')](_0x725d('0x36'),_0x5a02d6,_0x110ddc[_0x725d('0x35')]);_0x4f2730[_0x725d('0x37')]='No\x20Company';}else{return null;}}return _0x5cdaa8[_0x725d('0x18')](_[_0x725d('0x38')](_0x110ddc[_0x725d('0x35')]))[_0x725d('0x19')](_0x4f2730);}});}function getCustomFields(_0x4184b2,_0x25c74d){var _0x2ddb33={};if(_0x4184b2[_0x725d('0x1f')]>0x0){_[_0x725d('0x39')](_0x4184b2,function(_0x18349c){if(_0x18349c[_0x725d('0x3a')]===_0x725d('0x3b')&&_0x18349c[_0x725d('0x3c')]){_0x2ddb33[_0x18349c[_0x725d('0x3c')]]=_0x18349c[_0x725d('0x3d')][_0x725d('0x3e')]();}else if(_0x18349c[_0x725d('0x3a')]==='variable'&&_0x18349c['variableName']&&_0x18349c[_0x725d('0x3c')]){_0x25c74d[_0x18349c[_0x725d('0x3f')]]&&(_0x2ddb33[_0x18349c[_0x725d('0x3c')]]=_0x25c74d[_0x18349c[_0x725d('0x3f')]]['toString']());}else if(_0x18349c[_0x725d('0x3a')]===_0x725d('0x40')&&_0x18349c[_0x725d('0x41')]&&_0x18349c[_0x725d('0x41')]['name']&&_0x18349c[_0x725d('0x3c')]){_0x25c74d[_0x18349c['Variable'][_0x725d('0x42')][_0x725d('0x43')]()]&&(_0x2ddb33[_0x18349c[_0x725d('0x3c')]]=_0x25c74d[_0x18349c[_0x725d('0x41')][_0x725d('0x42')][_0x725d('0x43')]()]['toString']());}});}return _0x2ddb33;}function getConnection(_0x5a77de){var _0x22a62d=_0x5a77de['password'][_0x725d('0x44')](_0x5a77de[_0x725d('0x45')]);var _0x4567ce=new jsforce[(_0x725d('0x46'))]({'oauth2':{'loginUrl':_0x5a77de[_0x725d('0x47')]||_0x725d('0x48'),'clientId':_0x5a77de['clientId'],'clientSecret':_0x5a77de[_0x725d('0x49')]}});return _0x4567ce[_0x725d('0x4a')](_0x5a77de[_0x725d('0x4b')],_0x22a62d)[_0x725d('0x1e')](function(){logger[_0x725d('0x21')]('Connection\x20established.');return _0x4567ce;});}exports[_0x725d('0x4c')]=function(_0xfe3e7c,_0xa79aa,_0x2cd6db,_0x5d41e1,_0x2d0b2f,_0x949b98){var _0x54f6e8,_0x3a0784,_0x2d8184,_0xe1847b;_0x949b98[_0x725d('0x4d')]=intUtil['stripTrailingSlash'](_0x949b98[_0x725d('0x4d')]);_0x949b98['remoteUri']=intUtil[_0x725d('0x4e')](_0x949b98[_0x725d('0x47')]);if(_0x2d0b2f&&_0x2d0b2f['monitor_format']){logger[_0x725d('0x21')](_0x725d('0x4f'),_0x725d('0x50'));_0xa79aa['recordingURL']=util[_0x725d('0x33')](_0x725d('0x51'),_0x949b98['serverUrl'],_0xa79aa[_0x725d('0x52')],md5(_0xa79aa[_0x725d('0x52')]));}else{_0xa79aa[_0x725d('0x53')]='';}return getConnection(_0x949b98)[_0x725d('0x1e')](function(_0x4ccefd){_0xe1847b=_0x4ccefd;return getUser(_0x949b98,_0x5d41e1['email'],_0xe1847b);})[_0x725d('0x1e')](function(_0x346197){_0x54f6e8=_0x346197;return getEndUser(_0x949b98,_0x2cd6db,_0xa79aa[_0x725d('0x54')],_0xa79aa['calleridnum'],_0xe1847b);})[_0x725d('0x1e')](function(_0x255882){_0x3a0784=_0x255882;return getTicket(_0x949b98,_0x54f6e8,_0x3a0784,_0x2cd6db,_0xa79aa,_0x2cd6db[_0x725d('0x55')],_0xe1847b,'queue');})[_0x725d('0x1e')](function(_0xb0309){_0x2d8184=_0xb0309;logger[_0x725d('0x21')](_0x725d('0x56'),_0x2d8184['id']);logger[_0x725d('0x21')](_0x725d('0x57'),_0x2d8184['id'],_0x5d41e1[_0x725d('0x42')],_0x949b98[_0x725d('0x3a')]);switch(_0x949b98[_0x725d('0x3a')]){case _0x725d('0x58'):emit(util['format']('user:%s',_0x5d41e1['name']),_0x725d('0x59'),{'recordId':_0x2d8184['id']});break;case'newTab':emit(util['format'](_0x725d('0x5a'),_0x5d41e1[_0x725d('0x42')]),_0x725d('0x5b'),{'uri':util[_0x725d('0x33')](_0x725d('0x5c'),_0xe1847b[_0x725d('0x5d')],_0x2d8184['id'])});break;default:logger['error'](_0x725d('0x5e'));}})[_0x725d('0x5f')](function(_0x5283e8){logger[_0x725d('0x60')](_0x725d('0x4f'),JSON[_0x725d('0x61')](_0x5283e8));});};exports[_0x725d('0x62')]=function(_0x56c8b3,_0x2126de,_0x445914,_0x495410,_0x441b86,_0x3000cb,_0x5a7b97){var _0x4663f5,_0x125d33,_0x19a55a,_0x429930;_0x3000cb[_0x725d('0x4d')]=intUtil[_0x725d('0x4e')](_0x3000cb[_0x725d('0x4d')]);_0x3000cb[_0x725d('0x47')]=intUtil['stripTrailingSlash'](_0x3000cb[_0x725d('0x47')]);if(_0x5a7b97&&_0x5a7b97[_0x725d('0x63')]&&_0x5a7b97['recordingFormat']!==_0x725d('0x64')){logger['info'](_0x725d('0x65'),_0x725d('0x50'));_0x2126de[_0x725d('0x53')]=util['format'](_0x725d('0x51'),_0x3000cb[_0x725d('0x4d')],_0x2126de['uniqueid'],md5(_0x2126de[_0x725d('0x52')]));}return getConnection(_0x3000cb)[_0x725d('0x1e')](function(_0x5eb023){_0x429930=_0x5eb023;return getUser(_0x3000cb,_0x495410['email'],_0x429930);})['then'](function(_0x29791b){_0x4663f5=_0x29791b;return getEndUser(_0x3000cb,_0x445914,_0x2126de[_0x725d('0x66')],_0x2126de[_0x725d('0x67')],_0x429930);})[_0x725d('0x1e')](function(_0x254d69){_0x125d33=_0x254d69;return getTicket(_0x3000cb,_0x4663f5,_0x125d33,_0x445914,_0x2126de,_0x445914[_0x725d('0x55')],_0x429930,_0x725d('0x62'));})[_0x725d('0x1e')](function(_0x1e06a9){_0x19a55a=_0x1e06a9;logger[_0x725d('0x21')](_0x725d('0x68'),_0x19a55a['id']);logger[_0x725d('0x21')](_0x725d('0x69'),_0x19a55a['id'],_0x495410[_0x725d('0x42')],_0x3000cb[_0x725d('0x3a')]);switch(_0x3000cb[_0x725d('0x3a')]){case _0x725d('0x58'):emit(util[_0x725d('0x33')]('user:%s',_0x495410[_0x725d('0x42')]),_0x725d('0x59'),{'recordId':_0x19a55a['id']});break;case _0x725d('0x6a'):emit(util['format'](_0x725d('0x5a'),_0x495410[_0x725d('0x42')]),'trigger:browser:url',{'uri':util[_0x725d('0x33')](_0x725d('0x5c'),_0x429930[_0x725d('0x5d')],_0x19a55a['id'])});break;default:logger[_0x725d('0x60')](_0x725d('0x65'),_0x725d('0x6b'));}})[_0x725d('0x5f')](function(_0x4bc26a){logger[_0x725d('0x60')](_0x725d('0x65'),JSON[_0x725d('0x61')](_0x4bc26a));});};exports['unmanaged']=function(_0x4f8ac1,_0x4f5a22,_0xd72431,_0x104883,_0x4adba3,_0x412e00){var _0x5e89c4,_0x1c7f18,_0x24d7ee,_0x222a97;_0x412e00[_0x725d('0x4d')]=intUtil[_0x725d('0x4e')](_0x412e00[_0x725d('0x4d')]);_0x412e00[_0x725d('0x47')]=intUtil[_0x725d('0x4e')](_0x412e00[_0x725d('0x47')]);if(_0x4adba3&&_0x4adba3['monitor_format']){logger[_0x725d('0x21')]('['+_0x4f5a22[_0x725d('0x6c')]['toUpperCase']()+']',_0x725d('0x50'));_0x4f5a22[_0x725d('0x53')]=util['format'](_0x725d('0x51'),_0x412e00[_0x725d('0x4d')],_0x4f5a22[_0x725d('0x52')],md5(_0x4f5a22[_0x725d('0x52')]));}else{_0x4f5a22[_0x725d('0x53')]='';}return getConnection(_0x412e00)[_0x725d('0x1e')](function(_0x8d1e8d){_0x222a97=_0x8d1e8d;if(!_[_0x725d('0x1a')](_0x104883)){return getUser(_0x412e00,_0x104883['name'],_0x222a97);}else{return getUser(_0x412e00,null,_0x222a97);}})['then'](function(_0x3216da){_0x5e89c4=_0x3216da;return getEndUser(_0x412e00,_0xd72431,_0x4f5a22[_0x725d('0x54')],_0x4f5a22[_0x725d('0x6d')],_0x222a97);})[_0x725d('0x1e')](function(_0x276b34){_0x1c7f18=_0x276b34;return getTicket(_0x412e00,_0x5e89c4,_0x1c7f18,_0xd72431,_0x4f5a22,_0xd72431[_0x725d('0x55')],_0x222a97);})[_0x725d('0x1e')](function(_0x3ed26d){_0x24d7ee=_0x3ed26d;logger['info']('['+_0x4f5a22[_0x725d('0x6c')][_0x725d('0x6e')]()+_0x725d('0x6f'),_0x24d7ee['id']);logger['info']('['+_0x4f5a22[_0x725d('0x6c')][_0x725d('0x6e')]()+']\x20Integration\x20account\x20type\x20%s.',_0x412e00[_0x725d('0x3a')]);})[_0x725d('0x5f')](function(_0x3df937){logger[_0x725d('0x60')]('['+_0x4f5a22[_0x725d('0x6c')][_0x725d('0x6e')]()+']',JSON[_0x725d('0x61')](_0x3df937));});}; \ 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 7f4eec9..3c8383d 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 _0xc4aa=['all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','remoteUri','stripTrailingSlash','isNil','email','destcalleridnum','calleridnum','queue','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','POST','ticketNumber','push'];(function(_0x4c2d0e,_0x1b440e){var _0x22ee8e=function(_0x50cc77){while(--_0x50cc77){_0x4c2d0e['push'](_0x4c2d0e['shift']());}};_0x22ee8e(++_0x1b440e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xc4aa[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0xac4a('0x0'));var Promise=require(_0xac4a('0x1'));var rp=require(_0xac4a('0x2'));var util=require(_0xac4a('0x3'));var md5=require(_0xac4a('0x4'));var Redis=require(_0xac4a('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xac4a('0x6'));config[_0xac4a('0x7')]=_[_0xac4a('0x8')](config[_0xac4a('0x7')],{'host':_0xac4a('0x9'),'port':0x18eb});var io=require(_0xac4a('0xa'))(new Redis(config[_0xac4a('0x7')]));function getAdminUser(_0x10525b,_0x5c6179,_0x5b8339,_0x1aba6d,_0x2a4d53,_0x26ec84){return new Promise(function(_0x4f4146,_0x1d182e){var _0x3a82de={'method':_0xac4a('0xb'),'uri':_0x1aba6d+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x2a4d53+'&'+_0x26ec84,'auth':_0x5c6179,'json':!![]};return rp(_0x3a82de)[_0xac4a('0xc')](function(_0x488e3c){if(_0x488e3c[_0xac4a('0xd')]['length']>0x0){_0x5b8339[_0xac4a('0xe')]=_0x488e3c[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}logger['info']('['+[_0x10525b[_0xac4a('0x10')]()]+_0xac4a('0x11'),_0x5b8339);_0x4f4146(_0x5b8339);})[_0xac4a('0x12')](function(_0x6e00d4){logger[_0xac4a('0x13')]('['+[_0x10525b[_0xac4a('0x10')]()]+']',_0x6e00d4[_0xac4a('0x14')]);_0x1d182e(_0x6e00d4[_0xac4a('0x14')]);});});}function getUser(_0x190418,_0x42c7fc,_0x11e101,_0x26dbb8,_0x4a2119){return function(_0x402fff){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x16'),_0x402fff);return new Promise(function(_0x3e88e3,_0x387a54){if(intUtil[_0xac4a('0x17')](_0x402fff[_0xac4a('0x18')])){var _0x546c5d={'method':'GET','uri':_0x11e101+_0xac4a('0x19')+_0x402fff[_0xac4a('0x18')]+'&'+_0x26dbb8+'&'+_0x4a2119,'auth':_0x42c7fc,'json':!![]};logger[_0xac4a('0x15')]('['+[_0x190418['toUpperCase']()]+_0xac4a('0x1a'),_0x546c5d);return rp(_0x546c5d)[_0xac4a('0xc')](function(_0x3752e4){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x1b'),_0x3752e4);if(_0x3752e4[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0&&String(_0x3752e4['result'][0x0][_0xac4a('0x1d')])===_0xac4a('0x1e')){_0x402fff['userId']=_0x3752e4[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}else{_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff['userEmail']=_0x402fff[_0xac4a('0x20')];}logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x21'),_0x402fff);_0x3e88e3(_0x402fff);})[_0xac4a('0x12')](function(_0x2b0dc2){logger[_0xac4a('0x13')]('['+[_0x190418[_0xac4a('0x10')]()]+']',_0x2b0dc2[_0xac4a('0x14')]);_0x387a54(_0x2b0dc2[_0xac4a('0x14')]);});}else{logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x22'));_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff[_0xac4a('0x18')]=_0x402fff['adminEmail'];_0x3e88e3(_0x402fff);}});};}function createEndUser(_0x23b061,_0x267a22,_0x42a33c,_0x2772fe,_0x116700){logger['info']('['+[_0x23b061['toUpperCase']()]+_0xac4a('0x23'),_0x42a33c);return new Promise(function(_0x7a948b,_0x1f12d5){var _0x546b65={'method':'POST','uri':_0x2772fe+_0xac4a('0x24')+_0x116700,'body':{'user_name':_0x42a33c[_0xac4a('0x25')],'roles':_0xac4a('0x26'),'first_name':_0x42a33c[_0xac4a('0x25')],'active':_0xac4a('0x1e'),'date_format':'System','phone':_0x42a33c[_0xac4a('0x25')]},'auth':_0x267a22,'json':!![]};return rp(_0x546b65)['then'](function(_0x30364b){logger['info']('['+[_0x23b061[_0xac4a('0x10')]()]+_0xac4a('0x27'),_0x30364b[_0xac4a('0xd')]);_0x42a33c[_0xac4a('0x28')]=_0x30364b[_0xac4a('0xd')][_0xac4a('0xf')];_0x7a948b(_0x42a33c);})[_0xac4a('0x12')](function(_0x1f13f3){logger[_0xac4a('0x13')]('['+[_0x23b061[_0xac4a('0x10')]()]+']',_0x1f13f3[_0xac4a('0x14')]);_0x1f12d5(_0x1f13f3[_0xac4a('0x14')]);});});}function getEndUser(_0x1a9be2,_0x1a9d4e,_0x5634e2,_0x30442d,_0x1c41fb){return function(_0x5a4e2b){logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0x5a4e2b);return new Promise(function(_0x58804b,_0x11f0be){var _0x1ba096={'method':_0xac4a('0xb'),'uri':_0x5634e2+_0xac4a('0x29')+_0x5a4e2b['endUserNumber']+'&'+_0x30442d+'&'+_0x1c41fb,'auth':_0x1a9d4e,'json':!![]};return rp(_0x1ba096)[_0xac4a('0xc')](function(_0x2e56c6){if(_0x2e56c6['result'][_0xac4a('0x1c')]>0x0){_0x5a4e2b[_0xac4a('0x28')]=_0x2e56c6[_0xac4a('0xd')][0x0]['sys_id'];logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+_0xac4a('0x2a'),_0x5a4e2b);_0x58804b(_0x5a4e2b);}else{return createEndUser(_0x1a9be2,_0x1a9d4e,_0x5a4e2b,_0x5634e2,_0x30442d)['then'](function(_0x35bc94){logger[_0xac4a('0x15')]('['+[_0x1a9be2['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x35bc94);_0x58804b(_0x35bc94);});}})[_0xac4a('0x12')](function(_0x5e0926){logger['error']('['+[_0x1a9be2['toUpperCase']()]+']',_0x5e0926['message']);_0x11f0be(_0x5e0926[_0xac4a('0x14')]);});});};}function getCustomFields(_0x2bf8e8,_0x37834b){var _0x472484={};if(_0x2bf8e8[_0xac4a('0x1c')]>0x0){_[_0xac4a('0x2b')](_0x2bf8e8,function(_0x4220e2){if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x2e')]&&!_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')]['toLowerCase']()]=_0x4220e2['content']['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x4220e2[_0xac4a('0x32')][_0xac4a('0x33')]();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x34')&&_0x4220e2['variableName']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x35')]]['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x36')&&_0x4220e2['Variable']&&_0x4220e2[_0xac4a('0x37')]['name']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x37')][_0xac4a('0x38')][_0xac4a('0x31')]()][_0xac4a('0x33')]();}});}return _0x472484;}function getTicket(_0x98e0c4,_0xcb002b,_0x4fa9eb,_0x3b68b3,_0x569812,_0x1646ea){return function(_0x41d11d){logger[_0xac4a('0x15')]('['+[_0x98e0c4['toUpperCase']()]+_0xac4a('0x39'),_0x41d11d);return new Promise(function(_0x19276e,_0x5f54ff){var _0x42969b=_0x98e0c4['toLowerCase']()===_0xac4a('0x3a')?_0x41d11d[_0xac4a('0x1f')]:_0x41d11d[_0xac4a('0x28')];var _0x5e3581={'method':'POST','uri':_0x4fa9eb+_0xac4a('0x3b')+'?'+_0x1646ea,'body':Object['assign']({},{'active':_0xac4a('0x1e'),'caller_id':_0x42969b,'assigned_to':_0x41d11d['userId'],'short_description':intUtil[_0xac4a('0x3c')](_0x3b68b3['Subjects'],_0x569812,'\x20'),'description':intUtil[_0xac4a('0x3c')](_0x3b68b3[_0xac4a('0x3d')],_0x569812,'\x0a')},getCustomFields(_0x3b68b3[_0xac4a('0x3e')],_0x569812)),'auth':_0xcb002b,'json':!![]};return rp(_0x5e3581)[_0xac4a('0xc')](function(_0x54782f){logger[_0xac4a('0x15')]('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x3f'),_0x54782f[_0xac4a('0xd')]);_0x41d11d[_0xac4a('0x40')]=_0x54782f[_0xac4a('0xd')][_0xac4a('0xf')];_0x41d11d['ticketNumber']=_0x54782f[_0xac4a('0xd')][_0xac4a('0x41')];logger['info']('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x42'),_0x41d11d);_0x19276e(_0x41d11d);})[_0xac4a('0x12')](function(_0x3ac36e){logger['error']('['+[_0x98e0c4[_0xac4a('0x10')]()]+']',_0x3ac36e[_0xac4a('0x14')]);_0x5f54ff(_0x3ac36e[_0xac4a('0x14')]);});});};}function createRemoteTag(_0x129d58,_0x890910,_0x49fbc3,_0x179373){return new Promise(function(_0x564b10,_0x307441){var _0x2c04af={'method':'POST','uri':_0x49fbc3+'label'+'?'+_0x179373,'body':{'short_description':_0x129d58,'global':!![],'active':!![],'name':_0x129d58},'auth':_0x890910,'json':!![]};return rp(_0x2c04af)[_0xac4a('0xc')](function(_0x70fdc3){var _0x4d448f=_0x70fdc3[_0xac4a('0xd')][_0xac4a('0xf')];_0x564b10(_0x4d448f);});});}function getRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6,_0x108f7c){return new Promise(function(_0xb43fdb,_0xb5897b){var _0xdc80e3={'method':_0xac4a('0xb'),'uri':_0x48900f+_0xac4a('0x43')+'?sysparm_query=name%3D'+_0x26b582+'&'+_0x3057d6,'auth':_0x103d05,'json':!![]};return rp(_0xdc80e3)[_0xac4a('0xc')](function(_0xef51d0){if(_0xef51d0[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0){var _0x1b7231=_0xef51d0[_0xac4a('0xd')][0x0][_0xac4a('0xf')];_0xb43fdb(_0x1b7231);}else{return createRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6)[_0xac4a('0xc')](function(_0x159e43){_0xb43fdb(_0x159e43);});}});});}function assignTagToIncident(_0x786d9,_0x3b175a,_0x38dd4f,_0x400ac4,_0x2fe7df){return new Promise(function(_0x5222f3,_0x11c753){var _0x492aae={'method':_0xac4a('0x44'),'uri':_0x38dd4f+'label_entry'+'?'+_0x2fe7df,'body':{'label':_0x786d9,'table':_0xac4a('0x3b'),'id_type':'Incident','table_key':_0x400ac4[_0xac4a('0x40')],'title':'Incident\x20-\x20'+_0x400ac4[_0xac4a('0x45')],'id_display':_0x400ac4['ticketNumber']},'auth':_0x3b175a,'json':!![]};return rp(_0x492aae)['then'](function(_0x52c957){_0x5222f3();})[_0xac4a('0x12')](function(){_0x5222f3();});});}function manageTags(_0x3bcae2,_0x3c2f84,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa,_0x50dece){return new Promise(function(_0x34215e,_0x5d03e5){var _0x347880=[];_0x3c2f84[_0xac4a('0x2b')](function(_0x3da7e7){_0x347880[_0xac4a('0x46')](getRemoteTag(_0x3da7e7,_0x2f9940,_0xb7b884,_0x1e1ffa,_0x50dece));});return Promise[_0xac4a('0x47')](_0x347880)[_0xac4a('0xc')](function(_0x3abd57){if(_0x3abd57[_0xac4a('0x1c')]){logger[_0xac4a('0x15')]('['+[_0x3bcae2[_0xac4a('0x10')]()]+_0xac4a('0x48'),_0x3abd57);var _0x2498ad=[];_0x3abd57[_0xac4a('0x2b')](function(_0x2cc410){_0x2498ad[_0xac4a('0x46')](assignTagToIncident(_0x2cc410,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa));});return Promise[_0xac4a('0x47')](_0x2498ad)[_0xac4a('0xc')](function(){_0x34215e();})['catch'](function(){_0x34215e();});}else{_0x34215e();}});});}function getTags(_0xa90d71,_0x1672c0,_0x4fb812,_0x3c3576,_0x34bd1c,_0x2d24c7){return function(_0x2b8562){return new Promise(function(_0x357cac,_0x4d1440){var _0x47c6d8=[];var _0x45f3c3=_0x3c3576[_0xac4a('0x49')];if(_0x45f3c3&&_0x45f3c3[_0xac4a('0x1c')]>0x0){_0x47c6d8=_[_0xac4a('0x4a')](_0x45f3c3,_0xac4a('0x38'));}if(_0x47c6d8[_0xac4a('0x1c')]>0x0){return manageTags(_0xa90d71,_0x47c6d8,_0x1672c0,_0x4fb812,_0x2b8562,_0x34bd1c,_0x2d24c7)[_0xac4a('0xc')](function(){_0x357cac(_0x2b8562);});}else{_0x357cac(_0x2b8562);}});};}function emit(_0x2988d7,_0x44c60b,_0x295f21){var _0x278c09='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xac4a('0x4b')+_0xac4a('0x4c');var _0x2954fc={'uri':_0x2988d7+_0xac4a('0x4d')+_0x295f21+_0x278c09};io['to'](util[_0xac4a('0x4e')](_0xac4a('0x4f'),_0x44c60b))[_0xac4a('0x50')](_0xac4a('0x51'),_0x2954fc);}exports['cs']=function(_0x453d62,_0x2a5acc,_0xb09b89,_0xb12cc5,_0x5f0173,_0x13c854,_0xc74ce8,_0x26bd31){var _0x231932={};var _0x513976={'user':_0x13c854[_0xac4a('0x52')],'pass':_0x13c854['password']};var _0xab4305=_0xac4a('0x53');var _0x499abc='sysparm_display_value=true';_0x13c854[_0xac4a('0x54')]=intUtil[_0xac4a('0x55')](_0x13c854[_0xac4a('0x54')]);_0x13c854['serverUrl']=intUtil[_0xac4a('0x55')](_0x13c854['serverUrl']);var _0x114b11=util['format']('%s/api/now/table/',_0x13c854[_0xac4a('0x54')]);_0x231932['userEmail']=!_[_0xac4a('0x56')](_0xb12cc5)?_0xb12cc5['email']:null;_0x231932[_0xac4a('0x20')]=_0x13c854[_0xac4a('0x57')];_0x231932['endUserNumber']=_0x26bd31[_0xac4a('0x31')]()==='outbound'?_0x2a5acc[_0xac4a('0x58')]:_0x2a5acc[_0xac4a('0x59')];_0x231932['callDirection']=_0x26bd31===_0xac4a('0x5a')||_0x26bd31==='unmanaged'?'queue':_0xac4a('0x3a');var _0x4e3129=util[_0xac4a('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13c854['serverUrl'],_0x2a5acc[_0xac4a('0x5b')],md5(_0x2a5acc[_0xac4a('0x5b')]));if(_0x5f0173&&_0x5f0173[_0xac4a('0x5c')]){logger['info']('[QUEUE]',_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else if(_0xc74ce8&&_0xc74ce8['recordingFormat']&&_0xc74ce8['recordingFormat']!==_0xac4a('0x5f')){logger[_0xac4a('0x15')](_0xac4a('0x60'),_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else{_0x2a5acc[_0xac4a('0x5e')]='';}return getAdminUser(_0x26bd31,_0x513976,_0x231932,_0x114b11,_0x499abc,_0xab4305)[_0xac4a('0xc')](getUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getEndUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getTicket(_0x26bd31,_0x513976,_0x114b11,_0xb09b89,_0x2a5acc,_0x499abc))['then'](function(_0x1201e8){logger[_0xac4a('0x15')](util[_0xac4a('0x4e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1201e8[_0xac4a('0x40')]));logger[_0xac4a('0x15')](util[_0xac4a('0x4e')](_0xac4a('0x61'),_0x26bd31));if(_0x26bd31!==_0xac4a('0x62')){logger['info']('['+[_0x26bd31[_0xac4a('0x10')]()]+']',_0xac4a('0x63'));emit(_0x13c854[_0xac4a('0x54')],_0xb12cc5[_0xac4a('0x38')],_0x1201e8[_0xac4a('0x40')]);}})[_0xac4a('0x12')](function(_0xd7bdd6){logger['error']('['+[_0x26bd31[_0xac4a('0x10')]()]+_0xac4a('0x64'),util[_0xac4a('0x65')](_0xd7bdd6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5fc3=['],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','content','toString','string','toLowerCase','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','incident','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','socket.io-emitter','GET','then','length','adminId','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','userEmail','],\x20getUser\x20entity','result','active','true','sys_id','userId','message','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System'];(function(_0x4a2ff1,_0x13de3b){var _0x106aa7=function(_0x433dca){while(--_0x433dca){_0x4a2ff1['push'](_0x4a2ff1['shift']());}};_0x106aa7(++_0x13de3b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x11ca63,_0xea9f9c){_0x11ca63=_0x11ca63-0x0;var _0x41f1f6=_0x5fc3[_0x11ca63];return _0x41f1f6;};'use strict';var _=require(_0x35fc('0x0'));var Promise=require(_0x35fc('0x1'));var rp=require('request-promise');var util=require(_0x35fc('0x2'));var md5=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var intUtil=require(_0x35fc('0x5'));var config=require(_0x35fc('0x6'));var logger=require('../../../../config/logger')(_0x35fc('0x7'));config[_0x35fc('0x8')]=_[_0x35fc('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0xa'))(new Redis(config['redis']));function getAdminUser(_0x16e153,_0x27524f,_0xc72d93,_0x1e5f90,_0x34ff19,_0xf9d3a6){return new Promise(function(_0x2051ab,_0x565f95){var _0x1083a9={'method':_0x35fc('0xb'),'uri':_0x1e5f90+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x34ff19+'&'+_0xf9d3a6,'auth':_0x27524f,'json':!![]};return rp(_0x1083a9)[_0x35fc('0xc')](function(_0x33f491){if(_0x33f491['result'][_0x35fc('0xd')]>0x0){_0xc72d93[_0x35fc('0xe')]=_0x33f491['result'][0x0]['sys_id'];}logger[_0x35fc('0xf')]('['+[_0x16e153['toUpperCase']()]+_0x35fc('0x10'),_0xc72d93);_0x2051ab(_0xc72d93);})[_0x35fc('0x11')](function(_0x2a6ad2){logger[_0x35fc('0x12')]('['+[_0x16e153[_0x35fc('0x13')]()]+']',_0x2a6ad2['message']);_0x565f95(_0x2a6ad2['message']);});});}function getUser(_0x5eac0f,_0x558364,_0x398b67,_0x229d56,_0x53b898){return function(_0x154958){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x154958);return new Promise(function(_0x26ba54,_0x45c8b7){if(intUtil['validateEmail'](_0x154958[_0x35fc('0x14')])){var _0x363e47={'method':_0x35fc('0xb'),'uri':_0x398b67+'sys_user?sysparm_query=email%3D'+_0x154958[_0x35fc('0x14')]+'&'+_0x229d56+'&'+_0x53b898,'auth':_0x558364,'json':!![]};logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20rp\x20obj',_0x363e47);return rp(_0x363e47)[_0x35fc('0xc')](function(_0x350a27){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+_0x35fc('0x15'),_0x350a27);if(_0x350a27[_0x35fc('0x16')][_0x35fc('0xd')]>0x0&&String(_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x17')])===_0x35fc('0x18')){_0x154958['userId']=_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x19')];}else{_0x154958[_0x35fc('0x1a')]=_0x154958[_0x35fc('0xe')];_0x154958[_0x35fc('0x14')]=_0x154958['adminEmail'];}logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20crm',_0x154958);_0x26ba54(_0x154958);})[_0x35fc('0x11')](function(_0x5a93df){logger[_0x35fc('0x12')]('['+[_0x5eac0f['toUpperCase']()]+']',_0x5a93df[_0x35fc('0x1b')]);_0x45c8b7(_0x5a93df['message']);});}else{logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+']\x20using\x20admin\x20profile');_0x154958['userId']=_0x154958[_0x35fc('0xe')];_0x154958['userEmail']=_0x154958[_0x35fc('0x1c')];_0x26ba54(_0x154958);}});};}function createEndUser(_0x1a5d92,_0x57001c,_0x26b7cb,_0x645eac,_0x383837){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x1d'),_0x26b7cb);return new Promise(function(_0x11ccdb,_0x451f0c){var _0x54aedc={'method':_0x35fc('0x1e'),'uri':_0x645eac+_0x35fc('0x1f')+_0x383837,'body':{'user_name':_0x26b7cb[_0x35fc('0x20')],'roles':'user','first_name':_0x26b7cb[_0x35fc('0x20')],'active':_0x35fc('0x18'),'date_format':_0x35fc('0x21'),'phone':_0x26b7cb[_0x35fc('0x20')]},'auth':_0x57001c,'json':!![]};return rp(_0x54aedc)[_0x35fc('0xc')](function(_0x103181){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x22'),_0x103181[_0x35fc('0x16')]);_0x26b7cb['endUserId']=_0x103181['result'][_0x35fc('0x19')];_0x11ccdb(_0x26b7cb);})['catch'](function(_0x37b394){logger[_0x35fc('0x12')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+']',_0x37b394[_0x35fc('0x1b')]);_0x451f0c(_0x37b394[_0x35fc('0x1b')]);});});}function getEndUser(_0x12e78f,_0x4e43b4,_0x3fe193,_0x330a14,_0x46b9ef){return function(_0x4441d8){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+'],\x20getEndUser\x20input\x20crm',_0x4441d8);return new Promise(function(_0x2483be,_0x38193d){var _0x1fecdf={'method':'GET','uri':_0x3fe193+_0x35fc('0x23')+_0x4441d8['endUserNumber']+'&'+_0x330a14+'&'+_0x46b9ef,'auth':_0x4e43b4,'json':!![]};return rp(_0x1fecdf)[_0x35fc('0xc')](function(_0x33a377){if(_0x33a377[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){_0x4441d8['endUserId']=_0x33a377['result'][0x0]['sys_id'];logger[_0x35fc('0xf')]('['+[_0x12e78f['toUpperCase']()]+_0x35fc('0x24'),_0x4441d8);_0x2483be(_0x4441d8);}else{return createEndUser(_0x12e78f,_0x4e43b4,_0x4441d8,_0x3fe193,_0x330a14)['then'](function(_0x9c6b65){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+_0x35fc('0x25'),_0x9c6b65);_0x2483be(_0x9c6b65);});}})[_0x35fc('0x11')](function(_0x3313fa){logger[_0x35fc('0x12')]('['+[_0x12e78f['toUpperCase']()]+']',_0x3313fa[_0x35fc('0x1b')]);_0x38193d(_0x3313fa[_0x35fc('0x1b')]);});});};}function getCustomFields(_0x4e0ce3,_0x1feda5){var _0x1ccc41={};if(_0x4e0ce3[_0x35fc('0xd')]>0x0){_[_0x35fc('0x26')](_0x4e0ce3,function(_0x813866){if(_0x813866[_0x35fc('0x27')]==='string'&&_0x813866[_0x35fc('0x28')]&&!_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')]['toLowerCase']()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866['type']===_0x35fc('0x2d')&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')][_0x35fc('0x2e')]()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='variable'&&_0x813866['variableName']&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['variableName']][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='customVariable'&&_0x813866[_0x35fc('0x2f')]&&_0x813866[_0x35fc('0x2f')][_0x35fc('0x30')]&&_0x813866[_0x35fc('0x2a')]&&_0x813866['customField']){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['Variable']['name'][_0x35fc('0x2e')]()][_0x35fc('0x2c')]();}});}return _0x1ccc41;}function getTicket(_0x4fc5bc,_0x119925,_0x56cf1f,_0x13d16c,_0x40797d,_0x350237){return function(_0x2de5d1){logger[_0x35fc('0xf')]('['+[_0x4fc5bc['toUpperCase']()]+_0x35fc('0x31'),_0x2de5d1);return new Promise(function(_0x2c25d5,_0x4fd3d8){var _0x18181b=_0x4fc5bc[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2de5d1[_0x35fc('0x1a')]:_0x2de5d1['endUserId'];var _0x3666a5={'method':'POST','uri':_0x56cf1f+'incident'+'?'+_0x350237,'body':Object[_0x35fc('0x33')]({},{'active':_0x35fc('0x18'),'caller_id':_0x18181b,'assigned_to':_0x2de5d1[_0x35fc('0x1a')],'short_description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x35')],_0x40797d,'\x20'),'description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x36')],_0x40797d,'\x0a')},getCustomFields(_0x13d16c[_0x35fc('0x37')],_0x40797d)),'auth':_0x119925,'json':!![]};return rp(_0x3666a5)['then'](function(_0x3e2961){logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x38'),_0x3e2961[_0x35fc('0x16')]);_0x2de5d1[_0x35fc('0x39')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x19')];_0x2de5d1[_0x35fc('0x3a')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x3b')];logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x3c'),_0x2de5d1);_0x2c25d5(_0x2de5d1);})['catch'](function(_0x553ed6){logger[_0x35fc('0x12')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+']',_0x553ed6[_0x35fc('0x1b')]);_0x4fd3d8(_0x553ed6[_0x35fc('0x1b')]);});});};}function createRemoteTag(_0x3ee296,_0x3e6494,_0x4a4798,_0x4f024c){return new Promise(function(_0x388521,_0x19b2ce){var _0x395d63={'method':_0x35fc('0x1e'),'uri':_0x4a4798+'label'+'?'+_0x4f024c,'body':{'short_description':_0x3ee296,'global':!![],'active':!![],'name':_0x3ee296},'auth':_0x3e6494,'json':!![]};return rp(_0x395d63)[_0x35fc('0xc')](function(_0x13281f){var _0x4965d2=_0x13281f[_0x35fc('0x16')][_0x35fc('0x19')];_0x388521(_0x4965d2);});});}function getRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e,_0x18f18b){return new Promise(function(_0x5e4018,_0x4de34b){var _0x502a15={'method':_0x35fc('0xb'),'uri':_0x1ab472+_0x35fc('0x3d')+'?sysparm_query=name%3D'+_0x590faa+'&'+_0x26118e,'auth':_0x3e12e4,'json':!![]};return rp(_0x502a15)[_0x35fc('0xc')](function(_0x1f89b3){if(_0x1f89b3[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){var _0x46c59b=_0x1f89b3['result'][0x0][_0x35fc('0x19')];_0x5e4018(_0x46c59b);}else{return createRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e)[_0x35fc('0xc')](function(_0x39d470){_0x5e4018(_0x39d470);});}});});}function assignTagToIncident(_0x509e77,_0x304dba,_0x1dbf5a,_0x47fb1a,_0x35a676){return new Promise(function(_0x164c7b,_0x1c46b1){var _0x1c4c33={'method':_0x35fc('0x1e'),'uri':_0x1dbf5a+_0x35fc('0x3e')+'?'+_0x35a676,'body':{'label':_0x509e77,'table':_0x35fc('0x3f'),'id_type':_0x35fc('0x40'),'table_key':_0x47fb1a['ticketId'],'title':_0x35fc('0x41')+_0x47fb1a[_0x35fc('0x3a')],'id_display':_0x47fb1a[_0x35fc('0x3a')]},'auth':_0x304dba,'json':!![]};return rp(_0x1c4c33)['then'](function(_0x243871){_0x164c7b();})['catch'](function(){_0x164c7b();});});}function manageTags(_0x4ceacc,_0x5d4a39,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c,_0x3d06b8){return new Promise(function(_0x4bbea0,_0x579f5a){var _0x5353ea=[];_0x5d4a39['forEach'](function(_0x51d231){_0x5353ea[_0x35fc('0x42')](getRemoteTag(_0x51d231,_0x23b54f,_0xb1c68a,_0x13901c,_0x3d06b8));});return Promise[_0x35fc('0x43')](_0x5353ea)[_0x35fc('0xc')](function(_0x3ef680){if(_0x3ef680['length']){logger[_0x35fc('0xf')]('['+[_0x4ceacc[_0x35fc('0x13')]()]+_0x35fc('0x44'),_0x3ef680);var _0x1b0063=[];_0x3ef680[_0x35fc('0x26')](function(_0x1d0e53){_0x1b0063[_0x35fc('0x42')](assignTagToIncident(_0x1d0e53,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c));});return Promise[_0x35fc('0x43')](_0x1b0063)[_0x35fc('0xc')](function(){_0x4bbea0();})['catch'](function(){_0x4bbea0();});}else{_0x4bbea0();}});});}function getTags(_0x35d7c8,_0x47c75f,_0xfbd737,_0x9029e3,_0x2ac8e1,_0x2bc76c){return function(_0x4bdde7){return new Promise(function(_0x465c14,_0x4af592){var _0x4e2835=[];var _0x5f1d4a=_0x9029e3[_0x35fc('0x45')];if(_0x5f1d4a&&_0x5f1d4a['length']>0x0){_0x4e2835=_[_0x35fc('0x46')](_0x5f1d4a,'name');}if(_0x4e2835[_0x35fc('0xd')]>0x0){return manageTags(_0x35d7c8,_0x4e2835,_0x47c75f,_0xfbd737,_0x4bdde7,_0x2ac8e1,_0x2bc76c)['then'](function(){_0x465c14(_0x4bdde7);});}else{_0x465c14(_0x4bdde7);}});};}function emit(_0x42a53a,_0x455b84,_0x3400f0){var _0x1d81a5='%26sysparm_record_target%3Dincident'+_0x35fc('0x47')+_0x35fc('0x48')+_0x35fc('0x49');var _0x5df92d={'uri':_0x42a53a+_0x35fc('0x4a')+_0x3400f0+_0x1d81a5};io['to'](util[_0x35fc('0x4b')](_0x35fc('0x4c'),_0x455b84))[_0x35fc('0x4d')](_0x35fc('0x4e'),_0x5df92d);}exports['cs']=function(_0x2c4309,_0x2ee98b,_0x4464d5,_0x5159a0,_0x28a44b,_0x2008b3,_0x2600d2,_0x4a926d){var _0x1c88d8={};var _0x1b76f0={'user':_0x2008b3['username'],'pass':_0x2008b3['password']};var _0x3969d3='sysparm_limit=1';var _0x223ad3=_0x35fc('0x4f');_0x2008b3[_0x35fc('0x50')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x50')]);_0x2008b3[_0x35fc('0x52')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x52')]);var _0x10b725=util[_0x35fc('0x4b')](_0x35fc('0x53'),_0x2008b3[_0x35fc('0x50')]);_0x1c88d8[_0x35fc('0x14')]=!_[_0x35fc('0x54')](_0x5159a0)?_0x5159a0[_0x35fc('0x55')]:null;_0x1c88d8[_0x35fc('0x1c')]=_0x2008b3[_0x35fc('0x55')];_0x1c88d8[_0x35fc('0x20')]=_0x4a926d[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2ee98b['destcalleridnum']:_0x2ee98b[_0x35fc('0x56')];_0x1c88d8['callDirection']=_0x4a926d===_0x35fc('0x57')||_0x4a926d===_0x35fc('0x58')?_0x35fc('0x57'):_0x35fc('0x32');var _0x25af78=util[_0x35fc('0x4b')](_0x35fc('0x59'),_0x2008b3[_0x35fc('0x52')],_0x2ee98b[_0x35fc('0x5a')],md5(_0x2ee98b[_0x35fc('0x5a')]));if(_0x28a44b&&_0x28a44b[_0x35fc('0x5b')]){logger['info'](_0x35fc('0x5c'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else if(_0x2600d2&&_0x2600d2[_0x35fc('0x5f')]&&_0x2600d2[_0x35fc('0x5f')]!==_0x35fc('0x60')){logger['info'](_0x35fc('0x61'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else{_0x2ee98b[_0x35fc('0x5e')]='';}return getAdminUser(_0x4a926d,_0x1b76f0,_0x1c88d8,_0x10b725,_0x223ad3,_0x3969d3)[_0x35fc('0xc')](getUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getEndUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getTicket(_0x4a926d,_0x1b76f0,_0x10b725,_0x4464d5,_0x2ee98b,_0x223ad3))[_0x35fc('0xc')](function(_0xa92234){logger['info'](util[_0x35fc('0x4b')]('The\x20ticket\x20ID\x20is:\x20%s',_0xa92234[_0x35fc('0x39')]));logger[_0x35fc('0xf')](util['format'](_0x35fc('0x62'),_0x4a926d));if(_0x4a926d!==_0x35fc('0x58')){logger[_0x35fc('0xf')]('['+[_0x4a926d[_0x35fc('0x13')]()]+']',_0x35fc('0x63'));emit(_0x2008b3[_0x35fc('0x50')],_0x5159a0[_0x35fc('0x30')],_0xa92234[_0x35fc('0x39')]);}})[_0x35fc('0x11')](function(_0x5806bf){logger['error']('['+[_0x4a926d['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x35fc('0x64')](_0x5806bf,{'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 b7f596e..448c28d 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 _0xe24e=['emit','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','merge','map','type','string','nameField','toLowerCase','content','customField','custom_fields','variable','customVariable','Variable','login','password','xCALLY\x20Motion\x20integration','queue','serverUrl','uri','%s/service/v4_1/rest.php','remoteUri','[QUEUE]','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','users','contacts','version','%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','user:%s','trigger:browser:url','catch','error','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','Outbound','Ticket\x20created!','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','monitor_format','lastevent','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Inbound','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','redis','localhost','socket.io-emitter','POST'];(function(_0x2e53b0,_0x135abe){var _0x2bf9f6=function(_0x35711c){while(--_0x35711c){_0x2e53b0['push'](_0x2e53b0['shift']());}};_0x2bf9f6(++_0x135abe);}(_0xe24e,0x15f));var _0xee24=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0xe24e[_0x19b3f9];return _0x18c3f6;};'use strict';var _=require(_0xee24('0x0'));var rp=require(_0xee24('0x1'));var BPromise=require(_0xee24('0x2'));var md5=require(_0xee24('0x3'));var util=require(_0xee24('0x4'));var Redis=require(_0xee24('0x5'));var intUtil=require(_0xee24('0x6'));var config=require('../../../../config/environment');var logger=require(_0xee24('0x7'))('sugarcrm');config['redis']=_['defaults'](config[_0xee24('0x8')],{'host':_0xee24('0x9'),'port':0x18eb});var io=require(_0xee24('0xa'))(new Redis(config[_0xee24('0x8')]));var def={'method':_0xee24('0xb'),'json':!![]};function emit(_0x4c6585,_0xf73710,_0xb9b347){io['to'](_0x4c6585)[_0xee24('0xc')](_0xf73710,_0xb9b347);}function getTicket(_0x105eaf,_0x346647,_0x1cb7d6,_0x3a928d,_0x2fa6e1,_0x47f87f,_0x266881,_0x1cfbf4){logger[_0xee24('0xd')](_0xee24('0xe'));var _0x1a74ee=new Date();var _0x3b273a=[{'name':_0xee24('0xf'),'value':intUtil[_0xee24('0x10')](_0x3a928d['Subjects'],_0x2fa6e1,'\x20')},{'name':_0xee24('0x11'),'value':_0x346647['id']},{'name':_0xee24('0x12'),'value':_0x346647['id']},{'name':_0xee24('0x13'),'value':intUtil[_0xee24('0x10')](_0x3a928d[_0xee24('0x14')],_0x2fa6e1,'\x0a')},{'name':_0xee24('0x15'),'value':_0x1a74ee[_0xee24('0x16')]()[_0xee24('0x17')](0x0,0x13)[_0xee24('0x18')]('T','\x20')},{'name':_0xee24('0x19'),'value':'0'},{'name':_0xee24('0x1a'),'value':'15'},{'name':_0xee24('0x1b'),'value':_0x1cb7d6['id']},{'name':_0xee24('0x1c'),'value':_0xee24('0x1d')},{'name':_0xee24('0x1e'),'value':_0x1cb7d6['name']},{'name':'direction','value':_0x1cfbf4}];if(_0x47f87f[_0xee24('0x1f')]){_[_0xee24('0x20')](_0x47f87f,function(_0x971882){if(_0x2fa6e1[_0x971882[_0xee24('0x21')]]){_0x3b273a[_0xee24('0x22')]({'name':_0x971882[_0xee24('0x23')],'value':_0x2fa6e1[_0x971882[_0xee24('0x21')]]});}});}return request({'form':{'method':_0xee24('0x24'),'input_type':_0xee24('0x25'),'response_type':_0xee24('0x25'),'rest_data':JSON[_0xee24('0x26')]({'session':_0x266881['id'],'module_name':_0xee24('0x27'),'name_value_list':_0x3b273a})}});}function getAuth(_0x3ec49f){return util[_0xee24('0x28')](_0xee24('0x29'),new Buffer(_0x3ec49f[_0xee24('0x2a')]+':X')[_0xee24('0x2b')](_0xee24('0x2c')));}function getServerInfo(_0x443592){return request({'form':{'method':_0xee24('0x2d'),'input_type':_0xee24('0x25'),'response_type':_0xee24('0x25'),'rest_data':JSON[_0xee24('0x26')]({'session':_0x443592['id']})}});}function getUser(_0x19ea1e,_0x677ce6,_0x19f587){if(!_[_0xee24('0x2e')](_0x677ce6)){logger[_0xee24('0xd')](_0xee24('0x2f'),_0x677ce6);return request({'form':{'method':_0xee24('0x30'),'input_type':_0xee24('0x25'),'response_type':_0xee24('0x25'),'rest_data':JSON[_0xee24('0x26')]({'session':_0x19f587['id'],'module_name':_0xee24('0x31'),'query':util[_0xee24('0x28')](_0xee24('0x32'),_0x677ce6),'order_by':'','offset':'0','select_fields':['id',_0xee24('0xf'),_0xee24('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xee24('0x34')](function(_0x5617b6){if(_0x5617b6[_0xee24('0x35')][_0xee24('0x1f')]){var _0xfcb7b3=_[_0xee24('0x36')](_0x5617b6[_0xee24('0x35')],function(_0x3d4964){return _0x3d4964[_0xee24('0x37')][_0xee24('0x33')][_0xee24('0x38')]===_0x677ce6;});if(_0xfcb7b3){logger['info'](_0xee24('0x39'));return BPromise[_0xee24('0x3a')]({'id':_0xfcb7b3[_0xee24('0x37')]['id']['value'],'name':_0xfcb7b3[_0xee24('0x37')]['name'][_0xee24('0x38')]});}}logger[_0xee24('0xd')](_0xee24('0x3b'));return BPromise[_0xee24('0x3a')]({'id':_0x19f587[_0xee24('0x37')][_0xee24('0x3c')][_0xee24('0x38')],'name':_0x19f587[_0xee24('0x37')][_0xee24('0x33')][_0xee24('0x38')]});});}else{logger[_0xee24('0xd')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xee24('0x3a')]({'id':_0x19f587[_0xee24('0x37')][_0xee24('0x3c')]['value'],'name':_0x19f587[_0xee24('0x37')][_0xee24('0x33')]['value']});}}function getEndUser(_0x10209b,_0x2c7f4c,_0x5adc5f,_0x31e5a9){logger['info'](_0xee24('0x3d'),_0x5adc5f);return request({'form':{'method':'get_entry_list','input_type':_0xee24('0x25'),'response_type':_0xee24('0x25'),'rest_data':JSON[_0xee24('0x26')]({'session':_0x31e5a9['id'],'module_name':_0xee24('0x1d'),'query':util[_0xee24('0x28')](_0xee24('0x3e'),_0x5adc5f),'order_by':'','offset':'0','select_fields':['id','name',_0xee24('0x3f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xee24('0x34')](function(_0x153deb){if(_0x153deb['entry_list']['length']){var _0x2ba3e6=_['find'](_0x153deb['entry_list'],function(_0x5d194d){return _0x5d194d['name_value_list'][_0xee24('0x3f')][_0xee24('0x38')]===_0x5adc5f;});if(_0x2ba3e6){logger[_0xee24('0xd')]('Enduser\x20found!');return BPromise[_0xee24('0x3a')]({'id':_0x2ba3e6[_0xee24('0x37')]['id'][_0xee24('0x38')],'name':_0x2ba3e6['name_value_list'][_0xee24('0xf')][_0xee24('0x38')],'phone':_0x2ba3e6['name_value_list'][_0xee24('0x3f')][_0xee24('0x38')]});}}else{logger[_0xee24('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xee24('0x24'),'input_type':_0xee24('0x25'),'response_type':_0xee24('0x25'),'rest_data':JSON['stringify']({'session':_0x31e5a9['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x2c7f4c!==_0xee24('0x40')?_0x2c7f4c:util[_0xee24('0x28')](_0xee24('0x41'),_0x5adc5f)},{'name':_0xee24('0x3f'),'value':_0x5adc5f}]})}})['then'](function(_0x911109){logger[_0xee24('0xd')](_0xee24('0x42'));return BPromise[_0xee24('0x3a')]({'id':_0x911109['id'],'name':_0x911109[_0xee24('0x35')][_0xee24('0x43')][_0xee24('0x38')],'phone':_0x911109[_0xee24('0x35')][_0xee24('0x3f')]['value']});});}});}function request(_0x200415){logger[_0xee24('0x44')]('[HTTP]',JSON[_0xee24('0x26')](_0x200415));return rp(_[_0xee24('0x45')](def,_0x200415));}function getTags(_0x58363c,_0x324c79){var _0x3d23fa=[];if(_0x58363c&&_0x58363c[_0xee24('0x1f')]>0x0){_0x3d23fa=_[_0xee24('0x46')](_0x58363c,_0x324c79);}return _0x3d23fa;}function getCustomFields(_0x43d02f,_0x1042cf){var _0x59c8b1=[];var _0x48f188={'custom_fields':[]};if(_0x43d02f[_0xee24('0x1f')]>0x0){_[_0xee24('0x20')](_0x43d02f,function(_0x122f97){if(_0x122f97[_0xee24('0x47')]===_0xee24('0x48')&&_0x122f97[_0xee24('0x49')]&&!_0x122f97['customField']){_0x48f188[_0x122f97['nameField'][_0xee24('0x4a')]()]=_0x122f97[_0xee24('0x4b')][_0xee24('0x2b')]();}else if(_0x122f97[_0xee24('0x47')]===_0xee24('0x48')&&_0x122f97['idField']&&_0x122f97[_0xee24('0x4c')]){_0x48f188[_0xee24('0x4d')][_0xee24('0x22')]({'id':_0x122f97[_0xee24('0x23')],'value':_0x122f97[_0xee24('0x4b')][_0xee24('0x2b')]()});}else if(_0x122f97[_0xee24('0x47')]===_0xee24('0x4e')&&_0x122f97[_0xee24('0x21')]&&_0x122f97[_0xee24('0x23')]&&_0x122f97['customField']){_0x1042cf[_0x122f97['variableName']]&&_0x48f188['custom_fields']['push']({'id':_0x122f97[_0xee24('0x23')],'value':_0x1042cf[_0x122f97['variableName']]['toString']()});}else if(_0x122f97['type']===_0xee24('0x4f')&&_0x122f97['Variable']&&_0x122f97[_0xee24('0x50')]['name']&&_0x122f97['idField']&&_0x122f97[_0xee24('0x4c')]){_0x1042cf[_0x122f97[_0xee24('0x50')][_0xee24('0xf')][_0xee24('0x4a')]()]&&_0x48f188[_0xee24('0x4d')][_0xee24('0x22')]({'id':_0x122f97[_0xee24('0x23')],'value':_0x1042cf[_0x122f97[_0xee24('0x50')][_0xee24('0xf')][_0xee24('0x4a')]()][_0xee24('0x2b')]()});}});}return _0x48f188;}function getConnection(_0x3da88f){return request({'method':_0xee24('0xb'),'form':{'method':_0xee24('0x51'),'input_type':'JSON','response_type':_0xee24('0x25'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3da88f['username'],'password':_0x3da88f[_0xee24('0x52')],'encryption':'PLAIN'},'application':_0xee24('0x53')})}})[_0xee24('0x34')](function(_0x215390){var _0x2a5d51=_0x215390;if(_0x2a5d51['id']){def['sessionID']=_0x2a5d51['id'];return BPromise[_0xee24('0x3a')](_0x2a5d51);}else{throw new Error(util[_0xee24('0x28')]('Account\x20%d\x20is\x20not\x20valid',_0x3da88f['id']));}});}function setRelationship(_0x31dd43,_0x105f6e,_0x4a55d2,_0x1ae9cb){return request({'form':{'method':'set_relationship','input_type':_0xee24('0x25'),'response_type':_0xee24('0x25'),'rest_data':JSON[_0xee24('0x26')]({'session':_0x31dd43['id'],'module_name':_0xee24('0x27'),'module_id':_0x4a55d2['id'],'link_field_name':_0x1ae9cb,'related_ids':[_0x105f6e['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xee24('0x54')]=function(_0x362296,_0x216b28,_0x105374,_0x29d910,_0xcda75d,_0x2c8961){var _0x48141f,_0x274e6d,_0x1b0263,_0x3c4345;_0x2c8961['remoteUri']=intUtil['stripTrailingSlash'](_0x2c8961['remoteUri']);_0x2c8961[_0xee24('0x55')]=intUtil['stripTrailingSlash'](_0x2c8961[_0xee24('0x55')]);def[_0xee24('0x56')]=util['format'](_0xee24('0x57'),_0x2c8961[_0xee24('0x58')]);if(_0xcda75d&&_0xcda75d['monitor_format']){logger['info'](_0xee24('0x59'),'Recording\x20is\x20enabled!');_0x216b28[_0xee24('0x5a')]=util[_0xee24('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2c8961[_0xee24('0x55')],_0x216b28[_0xee24('0x5b')],md5(_0x216b28['uniqueid']));}else{_0x216b28[_0xee24('0x5a')]='';}return getConnection(_0x2c8961)[_0xee24('0x34')](function(_0x4fd391){_0x3c4345=_0x4fd391;return getUser(_0x2c8961,_0x29d910[_0xee24('0xf')],_0x3c4345);})[_0xee24('0x34')](function(_0x1d0f69){_0x48141f=_0x1d0f69;logger[_0xee24('0xd')](_0xee24('0x5c'),_0x48141f['id']);return getEndUser(_0x2c8961,_0x216b28[_0xee24('0x5d')],_0x216b28[_0xee24('0x5e')],_0x3c4345);})['then'](function(_0x5c882d){_0x274e6d=_0x5c882d;logger['info'](_0xee24('0x5f'),_0x274e6d['id']);return getTicket(_0x2c8961,_0x48141f,_0x274e6d,_0x105374,_0x216b28,_0x105374['Fields'],_0x3c4345,'Inbound');})[_0xee24('0x34')](function(_0xec7170){_0x1b0263=_0xec7170;logger[_0xee24('0xd')]('Ticket\x20created!');logger['info'](_0xee24('0x60'),_0x1b0263['id']);return setRelationship(_0x3c4345,_0x48141f,_0x1b0263,_0xee24('0x61'));})[_0xee24('0x34')](function(){return setRelationship(_0x3c4345,_0x274e6d,_0x1b0263,_0xee24('0x62'));})[_0xee24('0x34')](function(){return getServerInfo(_0x3c4345);})['then'](function(_0x376986){var _0x54a732=parseInt(_0x376986[_0xee24('0x63')]['charAt'](0x0));var _0x1f5d53=util[_0xee24('0x28')](_0xee24('0x64'),_0x2c8961[_0xee24('0x58')],_0x1b0263['id']);if(_0x54a732>0x6){_0x1f5d53=util[_0xee24('0x28')](_0xee24('0x65'),_0x2c8961[_0xee24('0x58')],_0x1b0263['id']);}logger[_0xee24('0xd')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xee24('0x66'),_0x29d910[_0xee24('0xf')]),_0xee24('0x67'),{'uri':_0x1f5d53});})[_0xee24('0x68')](function(_0xda196){logger[_0xee24('0x69')](_0xee24('0x59'),JSON[_0xee24('0x26')](_0xda196));});};exports['outbound']=function(_0x4a3e1f,_0x365edc,_0x4c4ddb,_0x192151,_0x29e185,_0x407279,_0x2ee2d8){var _0x1d4cc8,_0x1cc465,_0x466935,_0x2f9912;_0x407279[_0xee24('0x58')]=intUtil[_0xee24('0x6a')](_0x407279[_0xee24('0x58')]);_0x407279[_0xee24('0x55')]=intUtil[_0xee24('0x6a')](_0x407279[_0xee24('0x55')]);def[_0xee24('0x56')]=util[_0xee24('0x28')]('%s/service/v4_1/rest.php',_0x407279[_0xee24('0x58')]);if(_0x2ee2d8&&_0x2ee2d8[_0xee24('0x6b')]&&_0x2ee2d8[_0xee24('0x6b')]!==_0xee24('0x6c')){logger['info'](_0xee24('0x6d'),_0xee24('0x6e'));_0x365edc[_0xee24('0x5a')]=util[_0xee24('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x407279[_0xee24('0x55')],_0x365edc[_0xee24('0x5b')],md5(_0x365edc['uniqueid']));}return getConnection(_0x407279)[_0xee24('0x34')](function(_0x300d1a){_0x2f9912=_0x300d1a;return getUser(_0x407279,_0x192151[_0xee24('0xf')],_0x2f9912);})[_0xee24('0x34')](function(_0x16ad4c){_0x1d4cc8=_0x16ad4c;logger[_0xee24('0xd')](_0xee24('0x5c'),_0x1d4cc8['id']);return getEndUser(_0x407279,_0x365edc['destcalleridname'],_0x365edc[_0xee24('0x6f')],_0x2f9912);})[_0xee24('0x34')](function(_0x1420e4){_0x1cc465=_0x1420e4;logger['info'](_0xee24('0x5f'),_0x1cc465['id']);return getTicket(_0x407279,_0x1d4cc8,_0x1cc465,_0x4c4ddb,_0x365edc,_0x4c4ddb['Fields'],_0x2f9912,_0xee24('0x70'));})[_0xee24('0x34')](function(_0x333062){_0x466935=_0x333062;logger[_0xee24('0xd')](_0xee24('0x71'));logger[_0xee24('0xd')](_0xee24('0x60'),_0x466935['id']);return setRelationship(_0x2f9912,_0x1d4cc8,_0x466935,'users');})[_0xee24('0x34')](function(){return setRelationship(_0x2f9912,_0x1cc465,_0x466935,'contacts');})['then'](function(){return getServerInfo(_0x2f9912);})[_0xee24('0x34')](function(_0x542025){var _0x3dc73b=parseInt(_0x542025['version'][_0xee24('0x72')](0x0));var _0x30285c=util['format'](_0xee24('0x64'),_0x407279[_0xee24('0x58')],_0x466935['id']);if(_0x3dc73b>0x6){_0x30285c=util[_0xee24('0x28')](_0xee24('0x65'),_0x407279[_0xee24('0x58')],_0x466935['id']);}logger['info']('[OUTBOUND]',_0xee24('0x73'));emit(util[_0xee24('0x28')](_0xee24('0x66'),_0x192151[_0xee24('0xf')]),'trigger:browser:url',{'uri':_0x30285c});})[_0xee24('0x68')](function(_0x3cbfa5){logger['error'](_0xee24('0x6d'),JSON['stringify'](_0x3cbfa5));});};exports['unmanaged']=function(_0x88fe36,_0x11b957,_0x39e293,_0x7cd33f,_0x37c981,_0x44adac){var _0x1e8b38,_0xd92869,_0x31a2b6,_0x3039fd;_0x44adac['remoteUri']=intUtil['stripTrailingSlash'](_0x44adac[_0xee24('0x58')]);_0x44adac[_0xee24('0x55')]=intUtil[_0xee24('0x6a')](_0x44adac['serverUrl']);def[_0xee24('0x56')]=util['format']('%s/service/v4_1/rest.php',_0x44adac['remoteUri']);if(_0x37c981&&_0x37c981[_0xee24('0x74')]){logger['info']('['+_0x11b957[_0xee24('0x75')]['toUpperCase']()+']',_0xee24('0x6e'));_0x11b957['recordingURL']=util['format'](_0xee24('0x76'),_0x44adac['serverUrl'],_0x11b957[_0xee24('0x5b')],md5(_0x11b957[_0xee24('0x5b')]));}else{_0x11b957[_0xee24('0x5a')]='';}return getConnection(_0x44adac)['then'](function(_0x44526a){_0x3039fd=_0x44526a;if(!_[_0xee24('0x2e')](_0x7cd33f)){return getUser(_0x44adac,_0x7cd33f[_0xee24('0xf')],_0x3039fd);}else{return getUser(_0x44adac,null,_0x3039fd);}})[_0xee24('0x34')](function(_0x17f876){_0x1e8b38=_0x17f876;logger[_0xee24('0xd')](_0xee24('0x5c'),_0x1e8b38['id']);return getEndUser(_0x44adac,_0x11b957['calleridname'],_0x11b957[_0xee24('0x5e')],_0x3039fd);})['then'](function(_0x14f0ab){_0xd92869=_0x14f0ab;logger[_0xee24('0xd')](_0xee24('0x5f'),_0xd92869['id']);return getTicket(_0x44adac,_0x1e8b38,_0xd92869,_0x39e293,_0x11b957,_0x39e293['Fields'],_0x3039fd,_0xee24('0x77'));})[_0xee24('0x34')](function(_0x12f3bc){_0x31a2b6=_0x12f3bc;logger['info'](_0xee24('0x71'));logger[_0xee24('0xd')]('The\x20Ticket\x20ID\x20is:',_0x31a2b6['id']);return setRelationship(_0x3039fd,_0x1e8b38,_0x31a2b6,_0xee24('0x61'));})[_0xee24('0x34')](function(){return setRelationship(_0x3039fd,_0xd92869,_0x31a2b6,_0xee24('0x62'));})[_0xee24('0x34')](function(){return getServerInfo(_0x3039fd);})[_0xee24('0x68')](function(_0x2f9815){logger[_0xee24('0x69')]('['+_0x11b957['lastevent'][_0xee24('0x78')]()+']',JSON[_0xee24('0x26')](_0x2f9815));});}; \ No newline at end of file +var _0xf330=['parent_type','Contacts','parent_name','direction','variableName','idField','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','name_value_list','value','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','then','length','find','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','debug','merge','forEach','type','nameField','customField','toLowerCase','content','string','custom_fields','push','variable','customVariable','Variable','POST','username','password','PLAIN','sessionID','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','[QUEUE]','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','%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','error','outbound','uri','%s/service/v4_1/rest.php','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','Outbound','users','version','charAt','unmanaged','monitor_format','lastevent','bluebird','md5','util','./util','../../../../config/environment','sugarcrm','defaults','redis','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','getString','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_id'];(function(_0x1f0314,_0x1a8c61){var _0xb4de5f=function(_0xe6d511){while(--_0xe6d511){_0x1f0314['push'](_0x1f0314['shift']());}};_0xb4de5f(++_0x1a8c61);}(_0xf330,0x147));var _0x0f33=function(_0x5d624d,_0xb2d43c){_0x5d624d=_0x5d624d-0x0;var _0x1bd17e=_0xf330[_0x5d624d];return _0x1bd17e;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x0f33('0x0'));var md5=require(_0x0f33('0x1'));var util=require(_0x0f33('0x2'));var Redis=require('ioredis');var intUtil=require(_0x0f33('0x3'));var config=require(_0x0f33('0x4'));var logger=require('../../../../config/logger')(_0x0f33('0x5'));config['redis']=_[_0x0f33('0x6')](config[_0x0f33('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x0f33('0x8'))(new Redis(config[_0x0f33('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x56b673,_0x10b9cb,_0x54a7aa){io['to'](_0x56b673)[_0x0f33('0x9')](_0x10b9cb,_0x54a7aa);}function getTicket(_0x5790d5,_0x3960bc,_0x3de741,_0x56c117,_0x55f169,_0x7f2b66,_0x40e15b,_0x1d61f7){logger[_0x0f33('0xa')](_0x0f33('0xb'));var _0x310d46=new Date();var _0x2eec70=[{'name':_0x0f33('0xc'),'value':intUtil['getString'](_0x56c117[_0x0f33('0xd')],_0x55f169,'\x20')},{'name':_0x0f33('0xe'),'value':_0x3960bc['id']},{'name':_0x0f33('0xf'),'value':_0x3960bc['id']},{'name':'description','value':intUtil[_0x0f33('0x10')](_0x56c117[_0x0f33('0x11')],_0x55f169,'\x0a')},{'name':_0x0f33('0x12'),'value':_0x310d46['toISOString']()[_0x0f33('0x13')](0x0,0x13)[_0x0f33('0x14')]('T','\x20')},{'name':_0x0f33('0x15'),'value':'0'},{'name':_0x0f33('0x16'),'value':'15'},{'name':_0x0f33('0x17'),'value':_0x3de741['id']},{'name':_0x0f33('0x18'),'value':_0x0f33('0x19')},{'name':_0x0f33('0x1a'),'value':_0x3de741['name']},{'name':_0x0f33('0x1b'),'value':_0x1d61f7}];if(_0x7f2b66['length']){_['forEach'](_0x7f2b66,function(_0x19f26b){if(_0x55f169[_0x19f26b[_0x0f33('0x1c')]]){_0x2eec70['push']({'name':_0x19f26b[_0x0f33('0x1d')],'value':_0x55f169[_0x19f26b['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0x0f33('0x1e'),'response_type':_0x0f33('0x1e'),'rest_data':JSON['stringify']({'session':_0x40e15b['id'],'module_name':_0x0f33('0x1f'),'name_value_list':_0x2eec70})}});}function getAuth(_0x5dd4e3){return util[_0x0f33('0x20')](_0x0f33('0x21'),new Buffer(_0x5dd4e3[_0x0f33('0x22')]+':X')[_0x0f33('0x23')](_0x0f33('0x24')));}function getServerInfo(_0x3ff738){return request({'form':{'method':_0x0f33('0x25'),'input_type':_0x0f33('0x1e'),'response_type':'JSON','rest_data':JSON[_0x0f33('0x26')]({'session':_0x3ff738['id']})}});}function getUser(_0x54c30d,_0xe79e34,_0x106410){if(!_[_0x0f33('0x27')](_0xe79e34)){logger['info'](_0x0f33('0x28'),_0xe79e34);return request({'form':{'method':'get_entry_list','input_type':_0x0f33('0x1e'),'response_type':_0x0f33('0x1e'),'rest_data':JSON[_0x0f33('0x26')]({'session':_0x106410['id'],'module_name':'Employees','query':util[_0x0f33('0x20')](_0x0f33('0x29'),_0xe79e34),'order_by':'','offset':'0','select_fields':['id','name',_0x0f33('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x153894){if(_0x153894[_0x0f33('0x2b')]['length']){var _0x76c30a=_['find'](_0x153894[_0x0f33('0x2b')],function(_0xa6556e){return _0xa6556e[_0x0f33('0x2c')][_0x0f33('0x2a')][_0x0f33('0x2d')]===_0xe79e34;});if(_0x76c30a){logger[_0x0f33('0xa')]('Agent\x20found!');return BPromise['resolve']({'id':_0x76c30a[_0x0f33('0x2c')]['id'][_0x0f33('0x2d')],'name':_0x76c30a[_0x0f33('0x2c')][_0x0f33('0xc')][_0x0f33('0x2d')]});}}logger[_0x0f33('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x0f33('0x2e')]({'id':_0x106410['name_value_list']['user_id']['value'],'name':_0x106410[_0x0f33('0x2c')][_0x0f33('0x2a')][_0x0f33('0x2d')]});});}else{logger[_0x0f33('0xa')](_0x0f33('0x2f'));return BPromise['resolve']({'id':_0x106410[_0x0f33('0x2c')][_0x0f33('0x30')]['value'],'name':_0x106410[_0x0f33('0x2c')][_0x0f33('0x2a')][_0x0f33('0x2d')]});}}function getEndUser(_0x5a2dc7,_0x337e96,_0x19c06f,_0x551e6c){logger[_0x0f33('0xa')](_0x0f33('0x31'),_0x19c06f);return request({'form':{'method':_0x0f33('0x32'),'input_type':_0x0f33('0x1e'),'response_type':_0x0f33('0x1e'),'rest_data':JSON[_0x0f33('0x26')]({'session':_0x551e6c['id'],'module_name':_0x0f33('0x19'),'query':util[_0x0f33('0x20')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x19c06f),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0f33('0x33')](function(_0x5428d0){if(_0x5428d0[_0x0f33('0x2b')][_0x0f33('0x34')]){var _0x358cae=_[_0x0f33('0x35')](_0x5428d0[_0x0f33('0x2b')],function(_0x224c9e){return _0x224c9e[_0x0f33('0x2c')][_0x0f33('0x36')]['value']===_0x19c06f;});if(_0x358cae){logger[_0x0f33('0xa')](_0x0f33('0x37'));return BPromise[_0x0f33('0x2e')]({'id':_0x358cae[_0x0f33('0x2c')]['id'][_0x0f33('0x2d')],'name':_0x358cae['name_value_list']['name'][_0x0f33('0x2d')],'phone':_0x358cae[_0x0f33('0x2c')][_0x0f33('0x36')][_0x0f33('0x2d')]});}}else{logger[_0x0f33('0xa')](_0x0f33('0x38'));return request({'form':{'method':'set_entry','input_type':_0x0f33('0x1e'),'response_type':_0x0f33('0x1e'),'rest_data':JSON['stringify']({'session':_0x551e6c['id'],'module_name':_0x0f33('0x19'),'name_value_list':[{'name':_0x0f33('0x39'),'value':_0x337e96!==''?_0x337e96:util['format'](_0x0f33('0x3a'),_0x19c06f)},{'name':_0x0f33('0x36'),'value':_0x19c06f}]})}})[_0x0f33('0x33')](function(_0x3fa167){logger[_0x0f33('0xa')]('Enduser\x20created.');return BPromise[_0x0f33('0x2e')]({'id':_0x3fa167['id'],'name':_0x3fa167[_0x0f33('0x2b')]['first_name'][_0x0f33('0x2d')],'phone':_0x3fa167['entry_list'][_0x0f33('0x36')][_0x0f33('0x2d')]});});}});}function request(_0x2e6775){logger[_0x0f33('0x3b')]('[HTTP]',JSON[_0x0f33('0x26')](_0x2e6775));return rp(_[_0x0f33('0x3c')](def,_0x2e6775));}function getTags(_0x1c8c40,_0x2ab907){var _0x240133=[];if(_0x1c8c40&&_0x1c8c40[_0x0f33('0x34')]>0x0){_0x240133=_['map'](_0x1c8c40,_0x2ab907);}return _0x240133;}function getCustomFields(_0x5be2de,_0x434a59){var _0x54d538=[];var _0x13dac1={'custom_fields':[]};if(_0x5be2de['length']>0x0){_[_0x0f33('0x3d')](_0x5be2de,function(_0x4808d0){if(_0x4808d0[_0x0f33('0x3e')]==='string'&&_0x4808d0[_0x0f33('0x3f')]&&!_0x4808d0[_0x0f33('0x40')]){_0x13dac1[_0x4808d0[_0x0f33('0x3f')][_0x0f33('0x41')]()]=_0x4808d0[_0x0f33('0x42')][_0x0f33('0x23')]();}else if(_0x4808d0[_0x0f33('0x3e')]===_0x0f33('0x43')&&_0x4808d0[_0x0f33('0x1d')]&&_0x4808d0[_0x0f33('0x40')]){_0x13dac1[_0x0f33('0x44')][_0x0f33('0x45')]({'id':_0x4808d0[_0x0f33('0x1d')],'value':_0x4808d0[_0x0f33('0x42')]['toString']()});}else if(_0x4808d0[_0x0f33('0x3e')]===_0x0f33('0x46')&&_0x4808d0[_0x0f33('0x1c')]&&_0x4808d0['idField']&&_0x4808d0[_0x0f33('0x40')]){_0x434a59[_0x4808d0['variableName']]&&_0x13dac1['custom_fields'][_0x0f33('0x45')]({'id':_0x4808d0[_0x0f33('0x1d')],'value':_0x434a59[_0x4808d0[_0x0f33('0x1c')]][_0x0f33('0x23')]()});}else if(_0x4808d0[_0x0f33('0x3e')]===_0x0f33('0x47')&&_0x4808d0['Variable']&&_0x4808d0['Variable'][_0x0f33('0xc')]&&_0x4808d0[_0x0f33('0x1d')]&&_0x4808d0[_0x0f33('0x40')]){_0x434a59[_0x4808d0[_0x0f33('0x48')][_0x0f33('0xc')][_0x0f33('0x41')]()]&&_0x13dac1[_0x0f33('0x44')][_0x0f33('0x45')]({'id':_0x4808d0[_0x0f33('0x1d')],'value':_0x434a59[_0x4808d0[_0x0f33('0x48')][_0x0f33('0xc')]['toLowerCase']()][_0x0f33('0x23')]()});}});}return _0x13dac1;}function getConnection(_0x580b1f){return request({'method':_0x0f33('0x49'),'form':{'method':'login','input_type':_0x0f33('0x1e'),'response_type':_0x0f33('0x1e'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x580b1f[_0x0f33('0x4a')],'password':_0x580b1f[_0x0f33('0x4b')],'encryption':_0x0f33('0x4c')},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x23a01b){var _0x563805=_0x23a01b;if(_0x563805['id']){def[_0x0f33('0x4d')]=_0x563805['id'];return BPromise[_0x0f33('0x2e')](_0x563805);}else{throw new Error(util[_0x0f33('0x20')]('Account\x20%d\x20is\x20not\x20valid',_0x580b1f['id']));}});}function setRelationship(_0x3ab6bd,_0x37620f,_0x3a2dd2,_0xff4867){return request({'form':{'method':_0x0f33('0x4e'),'input_type':_0x0f33('0x1e'),'response_type':_0x0f33('0x1e'),'rest_data':JSON[_0x0f33('0x26')]({'session':_0x3ab6bd['id'],'module_name':_0x0f33('0x1f'),'module_id':_0x3a2dd2['id'],'link_field_name':_0xff4867,'related_ids':[_0x37620f['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x0f33('0x4f')]=function(_0x244d1a,_0x3a722b,_0x4e49a7,_0x552229,_0x1564e0,_0x34507c){var _0x52bb85,_0x5a4687,_0x4c46a1,_0x34f6e1;_0x34507c['remoteUri']=intUtil[_0x0f33('0x50')](_0x34507c[_0x0f33('0x51')]);_0x34507c['serverUrl']=intUtil[_0x0f33('0x50')](_0x34507c[_0x0f33('0x52')]);def['uri']=util[_0x0f33('0x20')]('%s/service/v4_1/rest.php',_0x34507c['remoteUri']);if(_0x1564e0&&_0x1564e0['monitor_format']){logger[_0x0f33('0xa')](_0x0f33('0x53'),'Recording\x20is\x20enabled!');_0x3a722b[_0x0f33('0x54')]=util[_0x0f33('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x34507c[_0x0f33('0x52')],_0x3a722b[_0x0f33('0x55')],md5(_0x3a722b[_0x0f33('0x55')]));}else{_0x3a722b[_0x0f33('0x54')]='';}return getConnection(_0x34507c)[_0x0f33('0x33')](function(_0x125434){_0x34f6e1=_0x125434;return getUser(_0x34507c,_0x552229[_0x0f33('0xc')],_0x34f6e1);})['then'](function(_0x2f7ecd){_0x52bb85=_0x2f7ecd;logger[_0x0f33('0xa')](_0x0f33('0x56'),_0x52bb85['id']);return getEndUser(_0x34507c,_0x3a722b[_0x0f33('0x57')],_0x3a722b[_0x0f33('0x58')],_0x34f6e1);})['then'](function(_0x325572){_0x5a4687=_0x325572;logger[_0x0f33('0xa')]('The\x20Enduser\x20ID\x20is:',_0x5a4687['id']);return getTicket(_0x34507c,_0x52bb85,_0x5a4687,_0x4e49a7,_0x3a722b,_0x4e49a7['Fields'],_0x34f6e1,_0x0f33('0x59'));})[_0x0f33('0x33')](function(_0x374140){_0x4c46a1=_0x374140;logger['info'](_0x0f33('0x5a'));logger[_0x0f33('0xa')](_0x0f33('0x5b'),_0x4c46a1['id']);return setRelationship(_0x34f6e1,_0x52bb85,_0x4c46a1,'users');})[_0x0f33('0x33')](function(){return setRelationship(_0x34f6e1,_0x5a4687,_0x4c46a1,_0x0f33('0x5c'));})[_0x0f33('0x33')](function(){return getServerInfo(_0x34f6e1);})['then'](function(_0x5be2e5){var _0x50de66=parseInt(_0x5be2e5['version']['charAt'](0x0));var _0x3958db=util[_0x0f33('0x20')](_0x0f33('0x5d'),_0x34507c[_0x0f33('0x51')],_0x4c46a1['id']);if(_0x50de66>0x6){_0x3958db=util['format'](_0x0f33('0x5e'),_0x34507c['remoteUri'],_0x4c46a1['id']);}logger[_0x0f33('0xa')](_0x0f33('0x53'),_0x0f33('0x5f'));emit(util[_0x0f33('0x20')](_0x0f33('0x60'),_0x552229[_0x0f33('0xc')]),_0x0f33('0x61'),{'uri':_0x3958db});})[_0x0f33('0x62')](function(_0x318349){logger[_0x0f33('0x63')](_0x0f33('0x53'),JSON[_0x0f33('0x26')](_0x318349));});};exports[_0x0f33('0x64')]=function(_0x21344b,_0x58272b,_0x215120,_0x4abbce,_0x524eec,_0x3f6ac5,_0x2241f4){var _0x468c71,_0x115f20,_0x50a3da,_0xb35728;_0x3f6ac5[_0x0f33('0x51')]=intUtil[_0x0f33('0x50')](_0x3f6ac5['remoteUri']);_0x3f6ac5['serverUrl']=intUtil[_0x0f33('0x50')](_0x3f6ac5[_0x0f33('0x52')]);def[_0x0f33('0x65')]=util[_0x0f33('0x20')](_0x0f33('0x66'),_0x3f6ac5[_0x0f33('0x51')]);if(_0x2241f4&&_0x2241f4['recordingFormat']&&_0x2241f4['recordingFormat']!==_0x0f33('0x67')){logger[_0x0f33('0xa')](_0x0f33('0x68'),_0x0f33('0x69'));_0x58272b[_0x0f33('0x54')]=util[_0x0f33('0x20')](_0x0f33('0x6a'),_0x3f6ac5[_0x0f33('0x52')],_0x58272b['uniqueid'],md5(_0x58272b[_0x0f33('0x55')]));}return getConnection(_0x3f6ac5)[_0x0f33('0x33')](function(_0x267b85){_0xb35728=_0x267b85;return getUser(_0x3f6ac5,_0x4abbce[_0x0f33('0xc')],_0xb35728);})[_0x0f33('0x33')](function(_0x30af23){_0x468c71=_0x30af23;logger[_0x0f33('0xa')](_0x0f33('0x56'),_0x468c71['id']);return getEndUser(_0x3f6ac5,_0x58272b[_0x0f33('0x6b')],_0x58272b['destcalleridnum'],_0xb35728);})[_0x0f33('0x33')](function(_0x2f43d4){_0x115f20=_0x2f43d4;logger['info'](_0x0f33('0x6c'),_0x115f20['id']);return getTicket(_0x3f6ac5,_0x468c71,_0x115f20,_0x215120,_0x58272b,_0x215120[_0x0f33('0x6d')],_0xb35728,_0x0f33('0x6e'));})[_0x0f33('0x33')](function(_0xddd847){_0x50a3da=_0xddd847;logger[_0x0f33('0xa')](_0x0f33('0x5a'));logger[_0x0f33('0xa')]('The\x20Ticket\x20ID\x20is:',_0x50a3da['id']);return setRelationship(_0xb35728,_0x468c71,_0x50a3da,_0x0f33('0x6f'));})[_0x0f33('0x33')](function(){return setRelationship(_0xb35728,_0x115f20,_0x50a3da,_0x0f33('0x5c'));})[_0x0f33('0x33')](function(){return getServerInfo(_0xb35728);})[_0x0f33('0x33')](function(_0x1f918){var _0x27c8f5=parseInt(_0x1f918[_0x0f33('0x70')][_0x0f33('0x71')](0x0));var _0x18e64f=util[_0x0f33('0x20')](_0x0f33('0x5d'),_0x3f6ac5[_0x0f33('0x51')],_0x50a3da['id']);if(_0x27c8f5>0x6){_0x18e64f=util[_0x0f33('0x20')](_0x0f33('0x5e'),_0x3f6ac5['remoteUri'],_0x50a3da['id']);}logger[_0x0f33('0xa')]('[OUTBOUND]',_0x0f33('0x5f'));emit(util[_0x0f33('0x20')](_0x0f33('0x60'),_0x4abbce[_0x0f33('0xc')]),'trigger:browser:url',{'uri':_0x18e64f});})['catch'](function(_0x7473c8){logger[_0x0f33('0x63')](_0x0f33('0x68'),JSON[_0x0f33('0x26')](_0x7473c8));});};exports[_0x0f33('0x72')]=function(_0x330c0b,_0x57e082,_0x58a958,_0xeaa324,_0x39d687,_0x1d69de){var _0x4c3a46,_0x55314a,_0x1ddc86,_0x203019;_0x1d69de[_0x0f33('0x51')]=intUtil['stripTrailingSlash'](_0x1d69de[_0x0f33('0x51')]);_0x1d69de[_0x0f33('0x52')]=intUtil['stripTrailingSlash'](_0x1d69de[_0x0f33('0x52')]);def[_0x0f33('0x65')]=util[_0x0f33('0x20')](_0x0f33('0x66'),_0x1d69de[_0x0f33('0x51')]);if(_0x39d687&&_0x39d687[_0x0f33('0x73')]){logger['info']('['+_0x57e082['lastevent']['toUpperCase']()+']',_0x0f33('0x69'));_0x57e082['recordingURL']=util[_0x0f33('0x20')](_0x0f33('0x6a'),_0x1d69de['serverUrl'],_0x57e082[_0x0f33('0x55')],md5(_0x57e082[_0x0f33('0x55')]));}else{_0x57e082[_0x0f33('0x54')]='';}return getConnection(_0x1d69de)[_0x0f33('0x33')](function(_0x174f49){_0x203019=_0x174f49;if(!_[_0x0f33('0x27')](_0xeaa324)){return getUser(_0x1d69de,_0xeaa324['name'],_0x203019);}else{return getUser(_0x1d69de,null,_0x203019);}})[_0x0f33('0x33')](function(_0x2494cf){_0x4c3a46=_0x2494cf;logger[_0x0f33('0xa')](_0x0f33('0x56'),_0x4c3a46['id']);return getEndUser(_0x1d69de,_0x57e082[_0x0f33('0x57')],_0x57e082[_0x0f33('0x58')],_0x203019);})[_0x0f33('0x33')](function(_0x478832){_0x55314a=_0x478832;logger['info'](_0x0f33('0x6c'),_0x55314a['id']);return getTicket(_0x1d69de,_0x4c3a46,_0x55314a,_0x58a958,_0x57e082,_0x58a958[_0x0f33('0x6d')],_0x203019,'Inbound');})['then'](function(_0x29a29a){_0x1ddc86=_0x29a29a;logger['info'](_0x0f33('0x5a'));logger[_0x0f33('0xa')](_0x0f33('0x5b'),_0x1ddc86['id']);return setRelationship(_0x203019,_0x4c3a46,_0x1ddc86,_0x0f33('0x6f'));})[_0x0f33('0x33')](function(){return setRelationship(_0x203019,_0x55314a,_0x1ddc86,'contacts');})[_0x0f33('0x33')](function(){return getServerInfo(_0x203019);})[_0x0f33('0x62')](function(_0x4fd913){logger['error']('['+_0x57e082[_0x0f33('0x74')]['toUpperCase']()+']',JSON[_0x0f33('0x26')](_0x4fd913));});}; \ 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 568b55b..4cf8a30 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 _0xe0bc=['keyType','key','%s:\x20%s','format','customVariable','join','substring','lastIndexOf','validateEmail','isNil','util','getString','length','type','string','push','content','variable','variableName','toString','Variable','name','toLowerCase','keyValue'];(function(_0x1f6d4a,_0xc7036f){var _0x342511=function(_0x5dfade){while(--_0x5dfade){_0x1f6d4a['push'](_0x1f6d4a['shift']());}};_0x342511(++_0xc7036f);}(_0xe0bc,0x18a));var _0xce0b=function(_0x5d0549,_0x132e25){_0x5d0549=_0x5d0549-0x0;var _0x11a98e=_0xe0bc[_0x5d0549];return _0x11a98e;};'use strict';var _=require('lodash');var util=require(_0xce0b('0x0'));exports[_0xce0b('0x1')]=function(_0x5f188e,_0x1eeff1,_0x5d0b8c){var _0x410ed2=[];if(_0x5f188e[_0xce0b('0x2')]>0x0){var _0x41cc80=_['sortBy'](_0x5f188e,['id']);for(var _0x4e3696=0x0;_0x4e3696<_0x41cc80[_0xce0b('0x2')];_0x4e3696++){var _0x1e96f9=_0x41cc80[_0x4e3696];if(_0x1e96f9[_0xce0b('0x3')]===_0xce0b('0x4')){_0x410ed2[_0xce0b('0x5')](_0x1e96f9[_0xce0b('0x6')]);}else if(_0x1e96f9['type']===_0xce0b('0x7')&&_0x1e96f9[_0xce0b('0x8')]){_0x1eeff1[_0x1e96f9['variableName']]&&_0x410ed2['push'](_0x1eeff1[_0x1e96f9[_0xce0b('0x8')]][_0xce0b('0x9')]());}else if(_0x1e96f9['type']==='customVariable'&&_0x1e96f9[_0xce0b('0xa')]&&_0x1e96f9[_0xce0b('0xa')][_0xce0b('0xb')]){_0x1eeff1[_0x1e96f9[_0xce0b('0xa')][_0xce0b('0xb')][_0xce0b('0xc')]()]&&_0x410ed2['push'](_0x1eeff1[_0x1e96f9['Variable'][_0xce0b('0xb')]['toLowerCase']()][_0xce0b('0x9')]());}else if(_0x1e96f9[_0xce0b('0x3')]===_0xce0b('0xd')){if(_0x1e96f9[_0xce0b('0xe')]===_0xce0b('0x4')&&_0x1e96f9[_0xce0b('0xf')]){_0x410ed2[_0xce0b('0x5')](util['format'](_0xce0b('0x10'),_0x1e96f9['key'],_0x1e96f9['keyContent']));}else if(_0x1e96f9['keyType']===_0xce0b('0x7')&&_0x1e96f9[_0xce0b('0x8')]&&_0x1e96f9[_0xce0b('0xf')]){_0x1eeff1[_0x1e96f9[_0xce0b('0x8')]]&&_0x410ed2[_0xce0b('0x5')](util[_0xce0b('0x11')]('%s:\x20%s',_0x1e96f9[_0xce0b('0xf')],_0x1eeff1[_0x1e96f9[_0xce0b('0x8')]]));}else if(_0x1e96f9['keyType']===_0xce0b('0x12')&&_0x1e96f9[_0xce0b('0xa')]&&_0x1e96f9['Variable'][_0xce0b('0xb')]&&_0x1e96f9['key']){_0x1eeff1[_0x1e96f9['Variable'][_0xce0b('0xb')][_0xce0b('0xc')]()]&&_0x410ed2[_0xce0b('0x5')](util[_0xce0b('0x11')](_0xce0b('0x10'),_0x1e96f9[_0xce0b('0xf')],_0x1eeff1[_0x1e96f9[_0xce0b('0xa')][_0xce0b('0xb')][_0xce0b('0xc')]()]));}}}}return _0x410ed2[_0xce0b('0x13')](_0x5d0b8c);};exports['stripTrailingSlash']=function(_0x19f3f3){var _0x21908e=_0x19f3f3['slice'](-0x1);if(_0x21908e==='/'){_0x19f3f3=_0x19f3f3[_0xce0b('0x14')](0x0,_0x19f3f3[_0xce0b('0x15')](_0x21908e));}return _0x19f3f3;};exports[_0xce0b('0x16')]=function(_0x3075c8){if(!_[_0xce0b('0x17')](_0x3075c8)&&_0x3075c8!==''){var _0x2c26e6=/^(([^<>()\[\]\\.,;:\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 _0x2c26e6['test'](String(_0x3075c8)[_0xce0b('0xc')]());}else{return![];}}; \ No newline at end of file +var _0xcacb=['test','lodash','util','length','sortBy','type','string','push','variable','variableName','toString','customVariable','Variable','name','keyValue','keyType','key','format','%s:\x20%s','keyContent','toLowerCase','stripTrailingSlash','slice','substring','lastIndexOf'];(function(_0x4ab0f5,_0x3f5260){var _0x3b2cc8=function(_0x43e0bb){while(--_0x43e0bb){_0x4ab0f5['push'](_0x4ab0f5['shift']());}};_0x3b2cc8(++_0x3f5260);}(_0xcacb,0x1c3));var _0xbcac=function(_0x54381d,_0x247b2c){_0x54381d=_0x54381d-0x0;var _0x5308a7=_0xcacb[_0x54381d];return _0x5308a7;};'use strict';var _=require(_0xbcac('0x0'));var util=require(_0xbcac('0x1'));exports['getString']=function(_0xdb2dc7,_0x1835e3,_0x24ce30){var _0x5456f9=[];if(_0xdb2dc7[_0xbcac('0x2')]>0x0){var _0x438b73=_[_0xbcac('0x3')](_0xdb2dc7,['id']);for(var _0x4ce3c3=0x0;_0x4ce3c3<_0x438b73['length'];_0x4ce3c3++){var _0x2f566b=_0x438b73[_0x4ce3c3];if(_0x2f566b[_0xbcac('0x4')]===_0xbcac('0x5')){_0x5456f9[_0xbcac('0x6')](_0x2f566b['content']);}else if(_0x2f566b['type']===_0xbcac('0x7')&&_0x2f566b[_0xbcac('0x8')]){_0x1835e3[_0x2f566b['variableName']]&&_0x5456f9[_0xbcac('0x6')](_0x1835e3[_0x2f566b['variableName']][_0xbcac('0x9')]());}else if(_0x2f566b['type']===_0xbcac('0xa')&&_0x2f566b[_0xbcac('0xb')]&&_0x2f566b[_0xbcac('0xb')][_0xbcac('0xc')]){_0x1835e3[_0x2f566b[_0xbcac('0xb')][_0xbcac('0xc')]['toLowerCase']()]&&_0x5456f9[_0xbcac('0x6')](_0x1835e3[_0x2f566b[_0xbcac('0xb')][_0xbcac('0xc')]['toLowerCase']()][_0xbcac('0x9')]());}else if(_0x2f566b['type']===_0xbcac('0xd')){if(_0x2f566b[_0xbcac('0xe')]===_0xbcac('0x5')&&_0x2f566b[_0xbcac('0xf')]){_0x5456f9[_0xbcac('0x6')](util[_0xbcac('0x10')](_0xbcac('0x11'),_0x2f566b['key'],_0x2f566b[_0xbcac('0x12')]));}else if(_0x2f566b[_0xbcac('0xe')]===_0xbcac('0x7')&&_0x2f566b[_0xbcac('0x8')]&&_0x2f566b['key']){_0x1835e3[_0x2f566b[_0xbcac('0x8')]]&&_0x5456f9[_0xbcac('0x6')](util[_0xbcac('0x10')](_0xbcac('0x11'),_0x2f566b[_0xbcac('0xf')],_0x1835e3[_0x2f566b[_0xbcac('0x8')]]));}else if(_0x2f566b['keyType']===_0xbcac('0xa')&&_0x2f566b[_0xbcac('0xb')]&&_0x2f566b['Variable'][_0xbcac('0xc')]&&_0x2f566b[_0xbcac('0xf')]){_0x1835e3[_0x2f566b[_0xbcac('0xb')][_0xbcac('0xc')]['toLowerCase']()]&&_0x5456f9[_0xbcac('0x6')](util[_0xbcac('0x10')](_0xbcac('0x11'),_0x2f566b[_0xbcac('0xf')],_0x1835e3[_0x2f566b[_0xbcac('0xb')][_0xbcac('0xc')][_0xbcac('0x13')]()]));}}}}return _0x5456f9['join'](_0x24ce30);};exports[_0xbcac('0x14')]=function(_0x1ed37d){var _0x4599b3=_0x1ed37d[_0xbcac('0x15')](-0x1);if(_0x4599b3==='/'){_0x1ed37d=_0x1ed37d[_0xbcac('0x16')](0x0,_0x1ed37d[_0xbcac('0x17')](_0x4599b3));}return _0x1ed37d;};exports['validateEmail']=function(_0xef25f9){if(!_['isNil'](_0xef25f9)&&_0xef25f9!==''){var _0x1ad61e=/^(([^<>()\[\]\\.,;:\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 _0x1ad61e[_0xbcac('0x18')](String(_0xef25f9)[_0xbcac('0x13')]());}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 fb67ecf..56d54c1 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 _0xa76b=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','user:%s','trigger:browser:url','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','monitor_format','lastevent','toUpperCase','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','forEach','idField','content','toString','type','variable','variableName','customVariable','Variable','name','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','remoteUri','create','sessionName','stringify','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','username','length','first_name','last_name','userId','admin','[vTiger],\x20%s,\x20%s,\x20%s','getUser','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20end\x20user\x20with\x20phone','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;','then','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','accessKey','getchallenge','login','Account\x20%d\x20is\x20not\x20valid','queue','[QUEUE]','Recording\x20is\x20enabled!'];(function(_0x1a18ed,_0xbc2127){var _0x15d49f=function(_0x387ecd){while(--_0x387ecd){_0x1a18ed['push'](_0x1a18ed['shift']());}};_0x15d49f(++_0xbc2127);}(_0xa76b,0x1a1));var _0xba76=function(_0x4faefc,_0x230d2f){_0x4faefc=_0x4faefc-0x0;var _0x7bbf=_0xa76b[_0x4faefc];return _0x7bbf;};'use strict';var _=require('lodash');var rp=require(_0xba76('0x0'));var BPromise=require(_0xba76('0x1'));var md5=require(_0xba76('0x2'));var util=require(_0xba76('0x3'));var Redis=require(_0xba76('0x4'));var intUtil=require(_0xba76('0x5'));var config=require(_0xba76('0x6'));var logger=require(_0xba76('0x7'))('vTiger');config[_0xba76('0x8')]=_[_0xba76('0x9')](config[_0xba76('0x8')],{'host':_0xba76('0xa'),'port':0x18eb});var io=require(_0xba76('0xb'))(new Redis(config[_0xba76('0x8')]));function emit(_0x23471c,_0x580c22,_0x9b0d89){io['to'](_0x23471c)['emit'](_0x580c22,_0x9b0d89);}function getCustomFields(_0x5ba74c,_0x3ecccb){var _0x4bf362={};if(_0x5ba74c['length']>0x0){_[_0xba76('0xc')](_0x5ba74c,function(_0x4c70d2){if(_0x4c70d2['type']==='string'&&_0x4c70d2[_0xba76('0xd')]){_0x4bf362[_0x4c70d2[_0xba76('0xd')]]=_0x4c70d2[_0xba76('0xe')][_0xba76('0xf')]();}else if(_0x4c70d2[_0xba76('0x10')]===_0xba76('0x11')&&_0x4c70d2[_0xba76('0x12')]&&_0x4c70d2[_0xba76('0xd')]&&_0x3ecccb[_0x4c70d2[_0xba76('0x12')]]){_0x4bf362[_0x4c70d2[_0xba76('0xd')]]=_0x3ecccb[_0x4c70d2[_0xba76('0x12')]]['toString']();}else if(_0x4c70d2['type']===_0xba76('0x13')&&_0x4c70d2[_0xba76('0x14')]&&_0x4c70d2['Variable']['name']&&_0x4c70d2[_0xba76('0xd')]&&_0x3ecccb[_0x4c70d2[_0xba76('0x14')][_0xba76('0x15')]['toLowerCase']()]){_0x4bf362[_0x4c70d2['idField']]=_0x3ecccb[_0x4c70d2['Variable'][_0xba76('0x15')]['toLowerCase']()][_0xba76('0xf')]();}});}return _0x4bf362;}function createTicket(_0x14b3e8,_0x1f6068,_0x3ba09b,_0x2d00d6,_0x363c84,_0x1d1904,_0x4c97cf){logger[_0xba76('0x16')](_0xba76('0x17'));var _0x31bf05=_['merge']({'parent_id':'','assigned_user_id':_0x1f6068['id'],'ticketpriorities':_0xba76('0x18'),'ticketstatus':_0xba76('0x19'),'ticket_title':intUtil['getString'](_0x2d00d6[_0xba76('0x1a')],_0x363c84,'\x20'),'description':intUtil[_0xba76('0x1b')](_0x2d00d6[_0xba76('0x1c')],_0x363c84,'\x0a'),'contact_id':_0x3ba09b['id']},getCustomFields(_0x1d1904,_0x363c84));var _0x43b19b={'method':_0xba76('0x1d'),'uri':util[_0xba76('0x1e')](_0xba76('0x1f'),_0x14b3e8[_0xba76('0x20')]),'form':{'operation':_0xba76('0x21'),'username':_0x14b3e8['username'],'sessionName':_0x4c97cf[_0xba76('0x22')],'elementType':'HelpDesk','element':JSON[_0xba76('0x23')](_0x31bf05)},'json':!![]};return request(_0x43b19b)['then'](function(_0x5b4e18){if(_0x5b4e18[_0xba76('0x24')]){return BPromise[_0xba76('0x25')]({'id':_0x5b4e18[_0xba76('0x26')]['id']});}else{throw new Error(util[_0xba76('0x1e')](_0xba76('0x27'),JSON[_0xba76('0x23')](_0x5b4e18['error'])));}})[_0xba76('0x28')](function(_0x46e110){var _0x56f3ca=_0x46e110[_0xba76('0x29')]||0x1f4;logger[_0xba76('0x2a')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xba76('0x2b'),_0x56f3ca,JSON[_0xba76('0x23')](_0x46e110));});}function getUser(_0x454942,_0x394e2b,_0x1ce80e){if(intUtil[_0xba76('0x2c')](_0x394e2b)){logger[_0xba76('0x16')](_0xba76('0x2d'),_0x394e2b);return request({'method':_0xba76('0x2e'),'uri':util[_0xba76('0x1e')]('%s/webservice.php',_0x454942[_0xba76('0x20')]),'qs':{'operation':_0xba76('0x2f'),'username':_0x454942[_0xba76('0x30')],'sessionName':_0x1ce80e[_0xba76('0x22')],'query':util[_0xba76('0x1e')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x394e2b)},'json':!![]})['then'](function(_0x15ada4){if(_0x15ada4[_0xba76('0x24')]&&_0x15ada4[_0xba76('0x26')][_0xba76('0x31')]){logger[_0xba76('0x16')]('Agent\x20found!');return BPromise[_0xba76('0x25')]({'id':_0x15ada4[_0xba76('0x26')][0x0]['id'],'email':_0x15ada4[_0xba76('0x26')][0x0]['email1'],'name':_0x15ada4[_0xba76('0x26')][0x0][_0xba76('0x32')]+'\x20'+_0x15ada4['result'][_0xba76('0x33')]});}else{logger[_0xba76('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xba76('0x25')]({'id':_0x1ce80e[_0xba76('0x34')],'email':_0x454942[_0xba76('0x30')],'name':_0xba76('0x35')});}})[_0xba76('0x28')](function(_0x46a750){var _0x28ad9d=_0x46a750[_0xba76('0x29')]||0x1f4;logger[_0xba76('0x2a')](_0xba76('0x36'),_0xba76('0x37'),_0x28ad9d,JSON['stringify'](_0x46a750));});}else{logger['info'](_0xba76('0x38'));return BPromise[_0xba76('0x25')]({'id':_0x1ce80e['userId'],'email':_0x454942['username'],'name':'admin'})[_0xba76('0x28')](function(_0x5d1181){var _0x2d2cd6=_0x5d1181[_0xba76('0x29')]||0x1f4;logger[_0xba76('0x2a')](_0xba76('0x36'),_0xba76('0x37'),_0x2d2cd6,JSON[_0xba76('0x23')](_0x5d1181));});}}function getEndUser(_0x2c795d,_0x4498bd,_0x14e3dc,_0x37d3f3){logger['info'](_0xba76('0x39'),_0x14e3dc);return request({'method':_0xba76('0x2e'),'uri':util[_0xba76('0x1e')](_0xba76('0x1f'),_0x2c795d[_0xba76('0x20')]),'qs':{'operation':_0xba76('0x2f'),'username':_0x2c795d[_0xba76('0x30')],'sessionName':_0x37d3f3[_0xba76('0x22')],'query':util[_0xba76('0x1e')](_0xba76('0x3a'),_0x14e3dc,_0x14e3dc,_0x14e3dc,_0x14e3dc,_0x14e3dc)},'json':!![]})[_0xba76('0x3b')](function(_0x3f79d8){if(_0x3f79d8['success']&&_0x3f79d8['result']['length']){logger[_0xba76('0x16')](_0xba76('0x3c'));return BPromise[_0xba76('0x25')]({'id':_0x3f79d8[_0xba76('0x26')][0x0]['id'],'name':_0x3f79d8[_0xba76('0x26')][0x0][_0xba76('0x3d')]+'\x20'+_0x3f79d8[_0xba76('0x26')][0x0][_0xba76('0x3e')],'phone':_0x14e3dc});}else{logger[_0xba76('0x16')](_0xba76('0x3f'));return request({'method':_0xba76('0x1d'),'uri':util[_0xba76('0x1e')]('%s/webservice.php',_0x2c795d[_0xba76('0x20')]),'form':{'operation':_0xba76('0x21'),'sessionName':_0x37d3f3['sessionName'],'elementType':_0xba76('0x40'),'element':JSON[_0xba76('0x23')]({'lastname':_0x4498bd,'phone':_0x14e3dc,'assigned_user_id':'\x20'})},'json':!![]})[_0xba76('0x3b')](function(_0x1a3feb){logger[_0xba76('0x16')]('Enduser\x20created.');return BPromise[_0xba76('0x25')]({'id':_0x1a3feb['result']['id'],'name':_0x1a3feb[_0xba76('0x26')][_0xba76('0x3e')],'phone':_0x1a3feb[_0xba76('0x26')][_0xba76('0x41')]});})[_0xba76('0x28')](function(_0x38f41b){var _0x479309=_0x38f41b['statusCode']||0x1f4;logger[_0xba76('0x2a')](_0xba76('0x36'),'getEndUser',_0x479309,JSON[_0xba76('0x23')](_0x38f41b));});}});}function getConnection(_0x3e5b4a){var _0x5bd617=_0x3e5b4a[_0xba76('0x30')];var _0x5ca37d=_0x3e5b4a[_0xba76('0x42')];return request({'method':_0xba76('0x2e'),'uri':util['format'](_0xba76('0x1f'),_0x3e5b4a['remoteUri']),'qs':{'operation':_0xba76('0x43'),'username':_0x5bd617},'json':!![]})[_0xba76('0x3b')](function(_0x3f72e2){if(_0x3f72e2['success']){return request({'method':'POST','uri':util[_0xba76('0x1e')]('%s/webservice.php',_0x3e5b4a[_0xba76('0x20')]),'form':{'operation':_0xba76('0x44'),'username':_0x5bd617,'accessKey':md5(_0x3f72e2[_0xba76('0x26')]['token']+_0x5ca37d)},'json':!![]});}})[_0xba76('0x3b')](function(_0x3f06a6){if(_0x3f06a6[_0xba76('0x24')]){return BPromise[_0xba76('0x25')](_0x3f06a6['result']);}else{throw new Error(util[_0xba76('0x1e')](_0xba76('0x45'),_0x3e5b4a['id']));}})['catch'](function(_0x2a63c1){var _0x45ee27=_0x2a63c1[_0xba76('0x29')]||0x1f4;logger[_0xba76('0x2a')]('[vTiger],\x20%s,\x20%s,\x20%s','getConnection',_0x45ee27,JSON['stringify'](_0x2a63c1));});}function request(_0x2f8916){logger[_0xba76('0x16')]('[HTTP]',JSON[_0xba76('0x23')](_0x2f8916));return rp(_0x2f8916);}exports[_0xba76('0x46')]=function(_0x162c5b,_0x5c67ef,_0x3c29e3,_0x22e62d,_0xfd1e09,_0x5e0201){var _0x10d9cd,_0x186f4a,_0x6320b7,_0x2d327f;_0x5e0201[_0xba76('0x20')]=intUtil['stripTrailingSlash'](_0x5e0201['remoteUri']);if(_0xfd1e09&&_0xfd1e09['monitor_format']){logger['info'](_0xba76('0x47'),_0xba76('0x48'));_0x5c67ef['recordingURL']=util[_0xba76('0x1e')](_0xba76('0x49'),_0x5e0201[_0xba76('0x4a')],_0x5c67ef[_0xba76('0x4b')],md5(_0x5c67ef['uniqueid']));}else{_0x5c67ef[_0xba76('0x4c')]='';}return getConnection(_0x5e0201)[_0xba76('0x3b')](function(_0x21ef01){_0x2d327f=_0x21ef01;return getUser(_0x5e0201,_0x22e62d[_0xba76('0x4d')],_0x2d327f);})[_0xba76('0x3b')](function(_0x510111){_0x10d9cd=_0x510111;logger[_0xba76('0x16')]('The\x20User\x20ID\x20is:',_0x10d9cd['id']);return getEndUser(_0x5e0201,_0x5c67ef[_0xba76('0x4e')],_0x5c67ef[_0xba76('0x4f')],_0x2d327f);})[_0xba76('0x3b')](function(_0x1ca4bc){_0x186f4a=_0x1ca4bc;logger['info'](_0xba76('0x50'),_0x186f4a['id']);return createTicket(_0x5e0201,_0x10d9cd,_0x186f4a,_0x3c29e3,_0x5c67ef,_0x3c29e3[_0xba76('0x51')],_0x2d327f);})['then'](function(_0x42ad17){_0x6320b7=_0x42ad17;logger[_0xba76('0x16')]('Ticket\x20created!');logger[_0xba76('0x16')]('The\x20Ticket\x20ID\x20is:',_0x6320b7['id']);var _0x57a2c5=util[_0xba76('0x1e')](_0xba76('0x52'),_0x5e0201['remoteUri'],_[_0xba76('0x53')](_0x6320b7['id'],'x')[0x1]);logger['info'](_0xba76('0x47'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xba76('0x1e')](_0xba76('0x54'),_0x22e62d[_0xba76('0x15')]),_0xba76('0x55'),{'uri':_0x57a2c5});})[_0xba76('0x28')](function(_0x478ced){logger[_0xba76('0x2a')](_0xba76('0x47'),JSON[_0xba76('0x23')](_0x478ced));});};exports['outbound']=function(_0x52278b,_0x21e564,_0x3a692b,_0x2baef8,_0x257aba,_0x10961e,_0x552d88){var _0x45f610,_0x1ecb39,_0x303a88,_0x3b7e0c;_0x10961e['remoteUri']=intUtil[_0xba76('0x56')](_0x10961e[_0xba76('0x20')]);_0x10961e[_0xba76('0x4a')]=intUtil[_0xba76('0x56')](_0x10961e[_0xba76('0x4a')]);if(_0x552d88&&_0x552d88[_0xba76('0x57')]&&_0x552d88['recordingFormat']!==_0xba76('0x58')){logger[_0xba76('0x16')](_0xba76('0x59'),_0xba76('0x48'));_0x21e564[_0xba76('0x4c')]=util[_0xba76('0x1e')](_0xba76('0x49'),_0x10961e[_0xba76('0x4a')],_0x21e564[_0xba76('0x4b')],md5(_0x21e564['uniqueid']));}return getConnection(_0x10961e)[_0xba76('0x3b')](function(_0x4d6fcf){_0x3b7e0c=_0x4d6fcf;return getUser(_0x10961e,_0x2baef8[_0xba76('0x4d')],_0x3b7e0c);})[_0xba76('0x3b')](function(_0x145a45){_0x45f610=_0x145a45;logger['info'](_0xba76('0x5a'),_0x45f610['id']);return getEndUser(_0x10961e,_0x21e564[_0xba76('0x5b')],_0x21e564[_0xba76('0x5c')],_0x3b7e0c);})[_0xba76('0x3b')](function(_0x596ab6){_0x1ecb39=_0x596ab6;logger[_0xba76('0x16')](_0xba76('0x50'),_0x1ecb39['id']);return createTicket(_0x10961e,_0x45f610,_0x1ecb39,_0x3a692b,_0x21e564,_0x3a692b[_0xba76('0x51')],_0x3b7e0c);})[_0xba76('0x3b')](function(_0xe316dd){_0x303a88=_0xe316dd;logger[_0xba76('0x16')](_0xba76('0x5d'));logger['info'](_0xba76('0x5e'),_0x303a88['id']);var _0x311785=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x10961e[_0xba76('0x20')],_[_0xba76('0x53')](_0x303a88['id'],'x')[0x1]);logger[_0xba76('0x16')](_0xba76('0x59'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xba76('0x1e')]('user:%s',_0x2baef8['name']),_0xba76('0x55'),{'uri':_0x311785});})[_0xba76('0x28')](function(_0x31ef48){logger[_0xba76('0x2a')](_0xba76('0x59'),JSON[_0xba76('0x23')](_0x31ef48));});};exports['unmanaged']=function(_0xd0e8a5,_0x75f707,_0x46f973,_0x4b58cf,_0x322080,_0x123905){var _0x4e566c,_0x59947c,_0x13c3f3,_0x23c612;_0x123905[_0xba76('0x20')]=intUtil[_0xba76('0x56')](_0x123905['remoteUri']);_0x123905['serverUrl']=intUtil[_0xba76('0x56')](_0x123905['serverUrl']);if(_0x322080&&_0x322080[_0xba76('0x5f')]){logger['info']('['+_0x75f707[_0xba76('0x60')][_0xba76('0x61')]()+']',_0xba76('0x48'));_0x75f707[_0xba76('0x4c')]=util[_0xba76('0x1e')](_0xba76('0x49'),_0x123905[_0xba76('0x4a')],_0x75f707[_0xba76('0x4b')],md5(_0x75f707[_0xba76('0x4b')]));}else{_0x75f707[_0xba76('0x4c')]='';}return getConnection(_0x123905)[_0xba76('0x3b')](function(_0x41944b){_0x23c612=_0x41944b;return getUser(_0x123905,'',_0x23c612);})['then'](function(_0x48e12f){_0x4e566c=_0x48e12f;logger['info']('The\x20User\x20ID\x20is:',_0x4e566c['id']);return getEndUser(_0x123905,_0x75f707[_0xba76('0x4e')],_0x75f707[_0xba76('0x4f')],_0x23c612);})[_0xba76('0x3b')](function(_0x227bd5){_0x59947c=_0x227bd5;logger['info']('The\x20Enduser\x20ID\x20is:',_0x59947c['id']);return createTicket(_0x123905,_0x4e566c,_0x59947c,_0x46f973,_0x75f707,_0x46f973[_0xba76('0x51')],_0x23c612);})[_0xba76('0x3b')](function(_0x3b6407){_0x13c3f3=_0x3b6407;logger[_0xba76('0x16')](_0xba76('0x5d'));logger[_0xba76('0x16')]('The\x20Ticket\x20ID\x20is:',_0x13c3f3['id']);})[_0xba76('0x28')](function(_0x286548){logger['error']('['+_0x75f707[_0xba76('0x60')][_0xba76('0x61')]()+']',JSON['stringify'](_0x286548));});}; \ No newline at end of file +var _0x3203=['Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20Enduser\x20ID\x20is:','Fields','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','user:%s','unmanaged','lastevent','toUpperCase','calleridname','calleridnum','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','defaults','socket.io-emitter','redis','emit','forEach','string','idField','content','toString','variable','variableName','type','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Subjects','Descriptions','POST','%s/webservice.php','remoteUri','create','username','HelpDesk','stringify','then','resolve','result','format','error','catch','statusCode','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','length','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','[vTiger],\x20%s,\x20%s,\x20%s','getUser','userId','Searching\x20end\x20user\x20with\x20phone','query','success','firstname','lastname','Contacts','phone','accessKey','getchallenge','login','token'];(function(_0x480385,_0x1913b1){var _0x5cd332=function(_0x74b2c5){while(--_0x74b2c5){_0x480385['push'](_0x480385['shift']());}};_0x5cd332(++_0x1913b1);}(_0x3203,0x83));var _0x3320=function(_0x408d22,_0x53eef9){_0x408d22=_0x408d22-0x0;var _0x58effd=_0x3203[_0x408d22];return _0x58effd;};'use strict';var _=require(_0x3320('0x0'));var rp=require(_0x3320('0x1'));var BPromise=require(_0x3320('0x2'));var md5=require(_0x3320('0x3'));var util=require(_0x3320('0x4'));var Redis=require(_0x3320('0x5'));var intUtil=require(_0x3320('0x6'));var config=require(_0x3320('0x7'));var logger=require('../../../../config/logger')('vTiger');config['redis']=_[_0x3320('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3320('0x9'))(new Redis(config[_0x3320('0xa')]));function emit(_0x2777dc,_0x45cd76,_0x1875e9){io['to'](_0x2777dc)[_0x3320('0xb')](_0x45cd76,_0x1875e9);}function getCustomFields(_0x30b31b,_0x1dedf2){var _0x2bc03d={};if(_0x30b31b['length']>0x0){_[_0x3320('0xc')](_0x30b31b,function(_0x5af55c){if(_0x5af55c['type']===_0x3320('0xd')&&_0x5af55c[_0x3320('0xe')]){_0x2bc03d[_0x5af55c[_0x3320('0xe')]]=_0x5af55c[_0x3320('0xf')][_0x3320('0x10')]();}else if(_0x5af55c['type']===_0x3320('0x11')&&_0x5af55c[_0x3320('0x12')]&&_0x5af55c[_0x3320('0xe')]&&_0x1dedf2[_0x5af55c[_0x3320('0x12')]]){_0x2bc03d[_0x5af55c[_0x3320('0xe')]]=_0x1dedf2[_0x5af55c[_0x3320('0x12')]][_0x3320('0x10')]();}else if(_0x5af55c[_0x3320('0x13')]===_0x3320('0x14')&&_0x5af55c[_0x3320('0x15')]&&_0x5af55c[_0x3320('0x15')][_0x3320('0x16')]&&_0x5af55c[_0x3320('0xe')]&&_0x1dedf2[_0x5af55c['Variable'][_0x3320('0x16')][_0x3320('0x17')]()]){_0x2bc03d[_0x5af55c[_0x3320('0xe')]]=_0x1dedf2[_0x5af55c[_0x3320('0x15')][_0x3320('0x16')][_0x3320('0x17')]()][_0x3320('0x10')]();}});}return _0x2bc03d;}function createTicket(_0x33767d,_0x27ce17,_0x1c2059,_0x7d3298,_0x4ef71c,_0x1c7d88,_0x264787){logger[_0x3320('0x18')](_0x3320('0x19'));var _0x1ba299=_['merge']({'parent_id':'','assigned_user_id':_0x27ce17['id'],'ticketpriorities':'Normal','ticketstatus':'Open','ticket_title':intUtil['getString'](_0x7d3298[_0x3320('0x1a')],_0x4ef71c,'\x20'),'description':intUtil['getString'](_0x7d3298[_0x3320('0x1b')],_0x4ef71c,'\x0a'),'contact_id':_0x1c2059['id']},getCustomFields(_0x1c7d88,_0x4ef71c));var _0x412d34={'method':_0x3320('0x1c'),'uri':util['format'](_0x3320('0x1d'),_0x33767d[_0x3320('0x1e')]),'form':{'operation':_0x3320('0x1f'),'username':_0x33767d[_0x3320('0x20')],'sessionName':_0x264787['sessionName'],'elementType':_0x3320('0x21'),'element':JSON[_0x3320('0x22')](_0x1ba299)},'json':!![]};return request(_0x412d34)[_0x3320('0x23')](function(_0x17a376){if(_0x17a376['success']){return BPromise[_0x3320('0x24')]({'id':_0x17a376[_0x3320('0x25')]['id']});}else{throw new Error(util[_0x3320('0x26')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x3320('0x22')](_0x17a376[_0x3320('0x27')])));}})[_0x3320('0x28')](function(_0x40d978){var _0xda709c=_0x40d978[_0x3320('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0x3320('0x2a'),_0xda709c,JSON[_0x3320('0x22')](_0x40d978));});}function getUser(_0x2b5557,_0x2da367,_0x498750){if(intUtil[_0x3320('0x2b')](_0x2da367)){logger[_0x3320('0x18')](_0x3320('0x2c'),_0x2da367);return request({'method':_0x3320('0x2d'),'uri':util[_0x3320('0x26')](_0x3320('0x1d'),_0x2b5557[_0x3320('0x1e')]),'qs':{'operation':'query','username':_0x2b5557[_0x3320('0x20')],'sessionName':_0x498750[_0x3320('0x2e')],'query':util[_0x3320('0x26')](_0x3320('0x2f'),_0x2da367)},'json':!![]})[_0x3320('0x23')](function(_0x482b8e){if(_0x482b8e['success']&&_0x482b8e[_0x3320('0x25')][_0x3320('0x30')]){logger[_0x3320('0x18')]('Agent\x20found!');return BPromise[_0x3320('0x24')]({'id':_0x482b8e[_0x3320('0x25')][0x0]['id'],'email':_0x482b8e['result'][0x0][_0x3320('0x31')],'name':_0x482b8e[_0x3320('0x25')][0x0][_0x3320('0x32')]+'\x20'+_0x482b8e[_0x3320('0x25')][_0x3320('0x33')]});}else{logger['info'](_0x3320('0x34'));return BPromise[_0x3320('0x24')]({'id':_0x498750['userId'],'email':_0x2b5557['username'],'name':'admin'});}})['catch'](function(_0x434fb6){var _0x2638d6=_0x434fb6['statusCode']||0x1f4;logger[_0x3320('0x27')](_0x3320('0x35'),_0x3320('0x36'),_0x2638d6,JSON[_0x3320('0x22')](_0x434fb6));});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x3320('0x24')]({'id':_0x498750[_0x3320('0x37')],'email':_0x2b5557[_0x3320('0x20')],'name':'admin'})[_0x3320('0x28')](function(_0x12657b){var _0x45515a=_0x12657b[_0x3320('0x29')]||0x1f4;logger[_0x3320('0x27')](_0x3320('0x35'),'getUser',_0x45515a,JSON['stringify'](_0x12657b));});}}function getEndUser(_0x48968d,_0xf9365c,_0x4ee716,_0x22b7b9){logger[_0x3320('0x18')](_0x3320('0x38'),_0x4ee716);return request({'method':_0x3320('0x2d'),'uri':util[_0x3320('0x26')]('%s/webservice.php',_0x48968d['remoteUri']),'qs':{'operation':_0x3320('0x39'),'username':_0x48968d[_0x3320('0x20')],'sessionName':_0x22b7b9['sessionName'],'query':util[_0x3320('0x26')]('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;',_0x4ee716,_0x4ee716,_0x4ee716,_0x4ee716,_0x4ee716)},'json':!![]})[_0x3320('0x23')](function(_0xd608e0){if(_0xd608e0[_0x3320('0x3a')]&&_0xd608e0[_0x3320('0x25')][_0x3320('0x30')]){logger[_0x3320('0x18')]('Enduser\x20found!');return BPromise[_0x3320('0x24')]({'id':_0xd608e0[_0x3320('0x25')][0x0]['id'],'name':_0xd608e0[_0x3320('0x25')][0x0][_0x3320('0x3b')]+'\x20'+_0xd608e0[_0x3320('0x25')][0x0][_0x3320('0x3c')],'phone':_0x4ee716});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x3320('0x1c'),'uri':util[_0x3320('0x26')](_0x3320('0x1d'),_0x48968d[_0x3320('0x1e')]),'form':{'operation':_0x3320('0x1f'),'sessionName':_0x22b7b9[_0x3320('0x2e')],'elementType':_0x3320('0x3d'),'element':JSON[_0x3320('0x22')]({'lastname':_0xf9365c,'phone':_0x4ee716,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0xe01c9f){logger[_0x3320('0x18')]('Enduser\x20created.');return BPromise['resolve']({'id':_0xe01c9f[_0x3320('0x25')]['id'],'name':_0xe01c9f[_0x3320('0x25')][_0x3320('0x3c')],'phone':_0xe01c9f['result'][_0x3320('0x3e')]});})[_0x3320('0x28')](function(_0x552b58){var _0x132169=_0x552b58[_0x3320('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x132169,JSON['stringify'](_0x552b58));});}});}function getConnection(_0x507c27){var _0x44e588=_0x507c27[_0x3320('0x20')];var _0x112771=_0x507c27[_0x3320('0x3f')];return request({'method':_0x3320('0x2d'),'uri':util[_0x3320('0x26')]('%s/webservice.php',_0x507c27[_0x3320('0x1e')]),'qs':{'operation':_0x3320('0x40'),'username':_0x44e588},'json':!![]})[_0x3320('0x23')](function(_0x2af77a){if(_0x2af77a[_0x3320('0x3a')]){return request({'method':_0x3320('0x1c'),'uri':util[_0x3320('0x26')](_0x3320('0x1d'),_0x507c27[_0x3320('0x1e')]),'form':{'operation':_0x3320('0x41'),'username':_0x44e588,'accessKey':md5(_0x2af77a[_0x3320('0x25')][_0x3320('0x42')]+_0x112771)},'json':!![]});}})[_0x3320('0x23')](function(_0x4beea2){if(_0x4beea2[_0x3320('0x3a')]){return BPromise[_0x3320('0x24')](_0x4beea2[_0x3320('0x25')]);}else{throw new Error(util[_0x3320('0x26')](_0x3320('0x43'),_0x507c27['id']));}})[_0x3320('0x28')](function(_0x3dd265){var _0x4120ae=_0x3dd265[_0x3320('0x29')]||0x1f4;logger[_0x3320('0x27')](_0x3320('0x35'),'getConnection',_0x4120ae,JSON[_0x3320('0x22')](_0x3dd265));});}function request(_0x378cf3){logger[_0x3320('0x18')](_0x3320('0x44'),JSON[_0x3320('0x22')](_0x378cf3));return rp(_0x378cf3);}exports[_0x3320('0x45')]=function(_0x54da32,_0x3d459a,_0x315336,_0x2a7888,_0x49c15e,_0x35b6b3){var _0x5d2551,_0x3edac1,_0xc46c2,_0x2e4b5e;_0x35b6b3[_0x3320('0x1e')]=intUtil['stripTrailingSlash'](_0x35b6b3[_0x3320('0x1e')]);if(_0x49c15e&&_0x49c15e[_0x3320('0x46')]){logger['info'](_0x3320('0x47'),'Recording\x20is\x20enabled!');_0x3d459a[_0x3320('0x48')]=util[_0x3320('0x26')](_0x3320('0x49'),_0x35b6b3[_0x3320('0x4a')],_0x3d459a['uniqueid'],md5(_0x3d459a[_0x3320('0x4b')]));}else{_0x3d459a[_0x3320('0x48')]='';}return getConnection(_0x35b6b3)['then'](function(_0x92cd5b){_0x2e4b5e=_0x92cd5b;return getUser(_0x35b6b3,_0x2a7888[_0x3320('0x4c')],_0x2e4b5e);})[_0x3320('0x23')](function(_0x19ab8f){_0x5d2551=_0x19ab8f;logger[_0x3320('0x18')]('The\x20User\x20ID\x20is:',_0x5d2551['id']);return getEndUser(_0x35b6b3,_0x3d459a['calleridname'],_0x3d459a['calleridnum'],_0x2e4b5e);})[_0x3320('0x23')](function(_0x282c72){_0x3edac1=_0x282c72;logger[_0x3320('0x18')](_0x3320('0x4d'),_0x3edac1['id']);return createTicket(_0x35b6b3,_0x5d2551,_0x3edac1,_0x315336,_0x3d459a,_0x315336[_0x3320('0x4e')],_0x2e4b5e);})['then'](function(_0x454bb8){_0xc46c2=_0x454bb8;logger['info']('Ticket\x20created!');logger[_0x3320('0x18')]('The\x20Ticket\x20ID\x20is:',_0xc46c2['id']);var _0x5a7742=util[_0x3320('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x35b6b3[_0x3320('0x1e')],_[_0x3320('0x4f')](_0xc46c2['id'],'x')[0x1]);logger[_0x3320('0x18')]('[QUEUE]',_0x3320('0x50'));emit(util[_0x3320('0x26')]('user:%s',_0x2a7888['name']),_0x3320('0x51'),{'uri':_0x5a7742});})['catch'](function(_0x5d3462){logger[_0x3320('0x27')]('[QUEUE]',JSON[_0x3320('0x22')](_0x5d3462));});};exports[_0x3320('0x52')]=function(_0x445ea4,_0x52f627,_0x3fc3e1,_0x5046a7,_0x106de7,_0x3b47d5,_0x28e007){var _0x4da118,_0x462ffb,_0x4ba2a2,_0x42cd08;_0x3b47d5['remoteUri']=intUtil[_0x3320('0x53')](_0x3b47d5[_0x3320('0x1e')]);_0x3b47d5[_0x3320('0x4a')]=intUtil[_0x3320('0x53')](_0x3b47d5[_0x3320('0x4a')]);if(_0x28e007&&_0x28e007['recordingFormat']&&_0x28e007[_0x3320('0x54')]!=='none'){logger[_0x3320('0x18')](_0x3320('0x55'),_0x3320('0x56'));_0x52f627[_0x3320('0x48')]=util[_0x3320('0x26')](_0x3320('0x49'),_0x3b47d5[_0x3320('0x4a')],_0x52f627[_0x3320('0x4b')],md5(_0x52f627['uniqueid']));}return getConnection(_0x3b47d5)['then'](function(_0x5c1e80){_0x42cd08=_0x5c1e80;return getUser(_0x3b47d5,_0x5046a7[_0x3320('0x4c')],_0x42cd08);})['then'](function(_0x4a693a){_0x4da118=_0x4a693a;logger[_0x3320('0x18')](_0x3320('0x57'),_0x4da118['id']);return getEndUser(_0x3b47d5,_0x52f627[_0x3320('0x58')],_0x52f627[_0x3320('0x59')],_0x42cd08);})[_0x3320('0x23')](function(_0x46af3f){_0x462ffb=_0x46af3f;logger[_0x3320('0x18')]('The\x20Enduser\x20ID\x20is:',_0x462ffb['id']);return createTicket(_0x3b47d5,_0x4da118,_0x462ffb,_0x3fc3e1,_0x52f627,_0x3fc3e1['Fields'],_0x42cd08);})[_0x3320('0x23')](function(_0x4a8711){_0x4ba2a2=_0x4a8711;logger[_0x3320('0x18')](_0x3320('0x5a'));logger[_0x3320('0x18')](_0x3320('0x5b'),_0x4ba2a2['id']);var _0x4cf652=util['format'](_0x3320('0x5c'),_0x3b47d5[_0x3320('0x1e')],_[_0x3320('0x4f')](_0x4ba2a2['id'],'x')[0x1]);logger[_0x3320('0x18')](_0x3320('0x55'),_0x3320('0x50'));emit(util[_0x3320('0x26')](_0x3320('0x5d'),_0x5046a7[_0x3320('0x16')]),'trigger:browser:url',{'uri':_0x4cf652});})[_0x3320('0x28')](function(_0x2d43a7){logger[_0x3320('0x27')](_0x3320('0x55'),JSON[_0x3320('0x22')](_0x2d43a7));});};exports[_0x3320('0x5e')]=function(_0x195e21,_0x43e703,_0x24e576,_0x42bdab,_0x2b3f18,_0x355ade){var _0x530021,_0x5be4f4,_0x25e42b,_0x3544be;_0x355ade[_0x3320('0x1e')]=intUtil['stripTrailingSlash'](_0x355ade[_0x3320('0x1e')]);_0x355ade['serverUrl']=intUtil[_0x3320('0x53')](_0x355ade['serverUrl']);if(_0x2b3f18&&_0x2b3f18[_0x3320('0x46')]){logger[_0x3320('0x18')]('['+_0x43e703[_0x3320('0x5f')][_0x3320('0x60')]()+']','Recording\x20is\x20enabled!');_0x43e703[_0x3320('0x48')]=util[_0x3320('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x355ade[_0x3320('0x4a')],_0x43e703[_0x3320('0x4b')],md5(_0x43e703[_0x3320('0x4b')]));}else{_0x43e703[_0x3320('0x48')]='';}return getConnection(_0x355ade)[_0x3320('0x23')](function(_0x448150){_0x3544be=_0x448150;return getUser(_0x355ade,'',_0x3544be);})[_0x3320('0x23')](function(_0x42a811){_0x530021=_0x42a811;logger[_0x3320('0x18')](_0x3320('0x57'),_0x530021['id']);return getEndUser(_0x355ade,_0x43e703[_0x3320('0x61')],_0x43e703[_0x3320('0x62')],_0x3544be);})[_0x3320('0x23')](function(_0x548fa3){_0x5be4f4=_0x548fa3;logger[_0x3320('0x18')](_0x3320('0x4d'),_0x5be4f4['id']);return createTicket(_0x355ade,_0x530021,_0x5be4f4,_0x24e576,_0x43e703,_0x24e576[_0x3320('0x4e')],_0x3544be);})[_0x3320('0x23')](function(_0x425f8d){_0x25e42b=_0x425f8d;logger[_0x3320('0x18')](_0x3320('0x5a'));logger[_0x3320('0x18')](_0x3320('0x5b'),_0x25e42b['id']);})[_0x3320('0x28')](function(_0x4492ca){logger['error']('['+_0x43e703[_0x3320('0x5f')][_0x3320('0x60')]()+']',JSON[_0x3320('0x22')](_0x4492ca));});}; \ 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 95c39e7..7062b24 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 _0x2bce=['destcalleridname','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','../../../../config/environment','../../../../config/logger','redis','localhost','application/json','format','%s/tickets.json','remoteUri','merge','Tags','name','Subjects','getString','Descriptions','Fields','info','Ticket\x20created!','ticket','%s/search.json','then','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','length','filter','first','Enduser\x20found!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','defaults','GET','map','forEach','type','string','toLowerCase','idField','customField','content','variable','variableName','Variable','custom_fields','push','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Authorization','email'];(function(_0x583693,_0x464b12){var _0x2cdb7f=function(_0x36df43){while(--_0x36df43){_0x583693['push'](_0x583693['shift']());}};_0x2cdb7f(++_0x464b12);}(_0x2bce,0xd6));var _0xe2bc=function(_0x384bcb,_0x30a2dd){_0x384bcb=_0x384bcb-0x0;var _0x59dfba=_0x2bce[_0x384bcb];return _0x59dfba;};'use strict';var _=require(_0xe2bc('0x0'));var rp=require(_0xe2bc('0x1'));var md5=require('md5');var util=require(_0xe2bc('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xe2bc('0x3'));var logger=require(_0xe2bc('0x4'))('zendesk');config[_0xe2bc('0x5')]=_['defaults'](config[_0xe2bc('0x5')],{'host':_0xe2bc('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x21ded5,_0x209051,_0x425ebf){io['to'](_0x21ded5)['emit'](_0x209051,_0x425ebf);}var headers={'Content-Type':_0xe2bc('0x7'),'Accept':_0xe2bc('0x7')};function getTicket(_0x39248b,_0x918b6c,_0x55e744,_0x3e2ef8,_0x43ee6d){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0xe2bc('0x8')](_0xe2bc('0x9'),_0x39248b[_0xe2bc('0xa')]),'method':'POST','body':{'ticket':_[_0xe2bc('0xb')]({'requester_id':_0x55e744['id'],'submitter_id':_0x918b6c?_0x918b6c['id']:undefined,'assignee_id':_0x918b6c?_0x918b6c['id']:undefined,'tags':getTags(_0x3e2ef8[_0xe2bc('0xc')],_0xe2bc('0xd')),'subject':intUtil['getString'](_0x3e2ef8[_0xe2bc('0xe')],_0x43ee6d,'\x20'),'description':intUtil['getString'](_0x3e2ef8['Descriptions'],_0x43ee6d,'\x0a'),'comment':{'public':![],'body':intUtil[_0xe2bc('0xf')](_0x3e2ef8[_0xe2bc('0x10')],_0x43ee6d,'\x0a')}},getCustomFields(_0x3e2ef8[_0xe2bc('0x11')],_0x43ee6d))}})['then'](function(_0x529f86){logger[_0xe2bc('0x12')](_0xe2bc('0x13'));return _0x529f86[_0xe2bc('0x14')];});}function getUser(_0x2cf3ad,_0x5f0bba){if(intUtil['validateEmail'](_0x5f0bba)){logger[_0xe2bc('0x12')]('Getting\x20agent\x20with\x20email',_0x5f0bba);return request({'uri':util['format'](_0xe2bc('0x15'),_0x2cf3ad[_0xe2bc('0xa')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x5f0bba)}})[_0xe2bc('0x16')](function(_0x74a1c7){if(_0x74a1c7[_0xe2bc('0x17')]){logger[_0xe2bc('0x12')](_0xe2bc('0x18'));return _[_0xe2bc('0x19')](_0x74a1c7[_0xe2bc('0x1a')],{'email':_0x5f0bba,'role':_0xe2bc('0x1b')});}else{logger['info'](_0xe2bc('0x1c'));return request({'uri':util['format'](_0xe2bc('0x1d'),_0x2cf3ad[_0xe2bc('0xa')])})['then'](function(_0x1275cb){logger[_0xe2bc('0x12')](_0xe2bc('0x1e'));return _0x1275cb[_0xe2bc('0x1f')];});}});}else{logger[_0xe2bc('0x12')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xe2bc('0x8')](_0xe2bc('0x1d'),_0x2cf3ad[_0xe2bc('0xa')])})[_0xe2bc('0x16')](function(_0xc6536d){logger[_0xe2bc('0x12')](_0xe2bc('0x1e'));return _0xc6536d[_0xe2bc('0x1f')];});}}function getEndUser(_0xc74773,_0x4c14ee,_0x406ace){logger[_0xe2bc('0x12')]('Searching\x20enduser\x20with\x20phone',_0x406ace);return request({'uri':util[_0xe2bc('0x8')](_0xe2bc('0x15'),_0xc74773[_0xe2bc('0xa')]),'qs':{'query':util[_0xe2bc('0x8')]('type:user\x20role:end-user\x20phone:%s',_0x406ace)}})[_0xe2bc('0x16')](function(_0x4308ea){var _0x3e8354;if(_0x4308ea[_0xe2bc('0x1a')][_0xe2bc('0x20')]){_0x4308ea[_0xe2bc('0x1a')]=_[_0xe2bc('0x21')](_0x4308ea[_0xe2bc('0x1a')],{'suspended':![],'role':'end-user'});if(_0x4308ea[_0xe2bc('0x1a')][_0xe2bc('0x20')]){_0x3e8354=_[_0xe2bc('0x22')](_0x4308ea[_0xe2bc('0x1a')]);}}if(_0x3e8354){logger['info'](_0xe2bc('0x23'));return _0x3e8354;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xe2bc('0x24'),_0xc74773['remoteUri']),'method':'POST','body':{'user':{'role':_0xe2bc('0x25'),'name':util[_0xe2bc('0x8')](_0xe2bc('0x26'),_0x4c14ee||_0x406ace),'phone':_0x406ace}}})['then'](function(_0xf9a91c){logger[_0xe2bc('0x12')](_0xe2bc('0x27'));return _0xf9a91c[_0xe2bc('0x1f')];});}});}function getAuth(_0x9c1483){var _0x42034b;if(_0x9c1483[_0xe2bc('0x28')]==='password'){_0x42034b=util[_0xe2bc('0x8')]('%s:%s',_0x9c1483[_0xe2bc('0x29')],_0x9c1483[_0xe2bc('0x2a')]);}else if(_0x9c1483[_0xe2bc('0x28')]===_0xe2bc('0x2b')){_0x42034b=util[_0xe2bc('0x8')](_0xe2bc('0x2c'),_0x9c1483[_0xe2bc('0x29')],_0x9c1483[_0xe2bc('0x2b')]);}return util[_0xe2bc('0x8')](_0xe2bc('0x2d'),new Buffer(_0x42034b)[_0xe2bc('0x2e')](_0xe2bc('0x2f')));}function request(_0x4bff57){logger[_0xe2bc('0x30')](_0xe2bc('0x31'),JSON['stringify'](_0x4bff57));return rp(_[_0xe2bc('0x32')](_0x4bff57,{'method':_0xe2bc('0x33'),'headers':headers,'json':!![]}));}function getTags(_0xc17397,_0xc58f84){var _0x1a66d7=[];if(_0xc17397&&_0xc17397[_0xe2bc('0x20')]>0x0){_0x1a66d7=_[_0xe2bc('0x34')](_0xc17397,_0xc58f84);}return _0x1a66d7;}function getCustomFields(_0x5f47d0,_0x181d76){var _0x15f460=[];var _0xc57cc0={'custom_fields':[]};if(_0x5f47d0[_0xe2bc('0x20')]>0x0){_[_0xe2bc('0x35')](_0x5f47d0,function(_0x2ea902){if(_0x2ea902[_0xe2bc('0x36')]===_0xe2bc('0x37')&&_0x2ea902['nameField']&&!_0x2ea902['customField']){_0xc57cc0[_0x2ea902['nameField'][_0xe2bc('0x38')]()]=_0x2ea902['content'][_0xe2bc('0x2e')]();}else if(_0x2ea902[_0xe2bc('0x36')]==='string'&&_0x2ea902[_0xe2bc('0x39')]&&_0x2ea902[_0xe2bc('0x3a')]){_0xc57cc0['custom_fields']['push']({'id':_0x2ea902[_0xe2bc('0x39')],'value':_0x2ea902[_0xe2bc('0x3b')]['toString']()});}else if(_0x2ea902[_0xe2bc('0x36')]===_0xe2bc('0x3c')&&_0x2ea902[_0xe2bc('0x3d')]&&_0x2ea902[_0xe2bc('0x39')]&&_0x2ea902[_0xe2bc('0x3a')]){_0x181d76[_0x2ea902[_0xe2bc('0x3d')]]&&_0xc57cc0['custom_fields']['push']({'id':_0x2ea902[_0xe2bc('0x39')],'value':_0x181d76[_0x2ea902[_0xe2bc('0x3d')]][_0xe2bc('0x2e')]()});}else if(_0x2ea902['type']==='customVariable'&&_0x2ea902['Variable']&&_0x2ea902[_0xe2bc('0x3e')][_0xe2bc('0xd')]&&_0x2ea902[_0xe2bc('0x39')]&&_0x2ea902['customField']){_0x181d76[_0x2ea902[_0xe2bc('0x3e')][_0xe2bc('0xd')][_0xe2bc('0x38')]()]&&_0xc57cc0[_0xe2bc('0x3f')][_0xe2bc('0x40')]({'id':_0x2ea902[_0xe2bc('0x39')],'value':_0x181d76[_0x2ea902[_0xe2bc('0x3e')][_0xe2bc('0xd')][_0xe2bc('0x38')]()]['toString']()});}});}return _0xc57cc0;}exports['queue']=function(_0x5d01fd,_0x8ac35e,_0x578afb,_0x30028f,_0x38e59f,_0x17f06d){var _0x44fde4,_0x57cc27;_0x17f06d[_0xe2bc('0xa')]=intUtil[_0xe2bc('0x41')](_0x17f06d[_0xe2bc('0xa')]);_0x17f06d[_0xe2bc('0x42')]=intUtil['stripTrailingSlash'](_0x17f06d[_0xe2bc('0x42')]);if(_0x38e59f&&_0x38e59f[_0xe2bc('0x43')]){logger[_0xe2bc('0x12')](_0xe2bc('0x44'),'Recording\x20is\x20enabled!');_0x8ac35e[_0xe2bc('0x45')]=util['format'](_0xe2bc('0x46'),_0x17f06d['serverUrl'],_0x8ac35e[_0xe2bc('0x47')],md5(_0x8ac35e[_0xe2bc('0x47')]));}else{_0x8ac35e[_0xe2bc('0x45')]='';}headers['Authorization']=getAuth(_0x17f06d);return getUser(_0x17f06d,_0x30028f['email'])['then'](function(_0x57594c){_0x44fde4=_0x57594c;logger[_0xe2bc('0x12')](_0xe2bc('0x48'),_0x44fde4['id']);return getEndUser(_0x17f06d,_0x8ac35e[_0xe2bc('0x49')],_0x8ac35e['calleridnum']);})['then'](function(_0x4e0540){_0x57cc27=_0x4e0540;logger[_0xe2bc('0x12')](_0xe2bc('0x4a'),_0x57cc27['id']);return getTicket(_0x17f06d,_0x44fde4,_0x57cc27,_0x578afb,_0x8ac35e);})[_0xe2bc('0x16')](function(_0x109ef6){if(_0x109ef6){logger[_0xe2bc('0x12')](_0xe2bc('0x4b'),_0x109ef6['id']);switch(_0x17f06d['type']){case _0xe2bc('0x4c'):logger[_0xe2bc('0x12')](_0xe2bc('0x44'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0xe2bc('0x4d'),_0x17f06d['remoteUri'],_0x44fde4['id'],_0x109ef6['id']),'method':_0xe2bc('0x4e')});case _0xe2bc('0x4f'):logger[_0xe2bc('0x12')](_0xe2bc('0x44'),_0xe2bc('0x50'));emit(util[_0xe2bc('0x8')](_0xe2bc('0x51'),_0x30028f[_0xe2bc('0xd')]),_0xe2bc('0x52'),{'uri':util[_0xe2bc('0x8')](_0xe2bc('0x53'),_0x17f06d[_0xe2bc('0xa')][_0xe2bc('0x54')](_0xe2bc('0x55'),''),_0x109ef6['id'])});break;default:logger[_0xe2bc('0x56')](_0xe2bc('0x44'),_0xe2bc('0x57'));}}})[_0xe2bc('0x58')](function(_0x39f3da){logger[_0xe2bc('0x56')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x39f3da,{'showHidden':!![],'depth':null}));});};exports[_0xe2bc('0x59')]=function(_0x1035b6,_0x2d729a,_0x18bc58,_0x1b0c56,_0x572289,_0x5d9869,_0x49e7f4){var _0x15b945,_0x5ccef3;_0x5d9869[_0xe2bc('0xa')]=intUtil[_0xe2bc('0x41')](_0x5d9869['remoteUri']);_0x5d9869[_0xe2bc('0x42')]=intUtil[_0xe2bc('0x41')](_0x5d9869[_0xe2bc('0x42')]);if(_0x49e7f4&&_0x49e7f4[_0xe2bc('0x5a')]&&_0x49e7f4[_0xe2bc('0x5a')]!==_0xe2bc('0x5b')){logger[_0xe2bc('0x12')](_0xe2bc('0x5c'),'Recording\x20is\x20enabled!');_0x2d729a[_0xe2bc('0x45')]=util['format'](_0xe2bc('0x46'),_0x5d9869[_0xe2bc('0x42')],_0x2d729a['uniqueid'],md5(_0x2d729a[_0xe2bc('0x47')]));}headers[_0xe2bc('0x5d')]=getAuth(_0x5d9869);return getUser(_0x5d9869,_0x1b0c56[_0xe2bc('0x5e')])['then'](function(_0x24934e){_0x15b945=_0x24934e;logger['info'](_0xe2bc('0x48'),_0x15b945['id']);return getEndUser(_0x5d9869,_0x2d729a[_0xe2bc('0x5f')],_0x2d729a['destcalleridnum']);})[_0xe2bc('0x16')](function(_0x5105d8){_0x5ccef3=_0x5105d8;logger[_0xe2bc('0x12')](_0xe2bc('0x4a'),_0x5ccef3['id']);return getTicket(_0x5d9869,_0x15b945,_0x5ccef3,_0x18bc58,_0x2d729a);})[_0xe2bc('0x16')](function(_0x34e61d){if(_0x34e61d){logger[_0xe2bc('0x12')]('The\x20Ticket\x20ID\x20is:',_0x34e61d['id']);switch(_0x5d9869[_0xe2bc('0x36')]){case'integrationTab':logger[_0xe2bc('0x12')](_0xe2bc('0x5c'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xe2bc('0x8')](_0xe2bc('0x4d'),_0x5d9869[_0xe2bc('0xa')],_0x15b945['id'],_0x34e61d['id']),'method':_0xe2bc('0x4e')});case'newTab':logger[_0xe2bc('0x12')](_0xe2bc('0x5c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe2bc('0x8')](_0xe2bc('0x51'),_0x1b0c56[_0xe2bc('0xd')]),_0xe2bc('0x52'),{'uri':util[_0xe2bc('0x8')]('%s/agent/tickets/%s',_0x5d9869[_0xe2bc('0xa')][_0xe2bc('0x54')](_0xe2bc('0x55'),''),_0x34e61d['id'])});break;default:logger['error'](_0xe2bc('0x5c'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xe2bc('0x58')](function(_0xe4b8f8){logger[_0xe2bc('0x56')](_0xe2bc('0x60'),util[_0xe2bc('0x61')](_0xe4b8f8,{'showHidden':!![],'depth':null}));});};exports[_0xe2bc('0x62')]=function(_0x16360c,_0x14a846,_0x1d05ea,_0x256252,_0x1f81c2,_0x3600d7){var _0x5d97b9,_0x1d6e4c;_0x3600d7[_0xe2bc('0xa')]=intUtil[_0xe2bc('0x41')](_0x3600d7[_0xe2bc('0xa')]);_0x3600d7[_0xe2bc('0x42')]=intUtil[_0xe2bc('0x41')](_0x3600d7['serverUrl']);if(_0x1f81c2&&_0x1f81c2[_0xe2bc('0x43')]){logger[_0xe2bc('0x12')]('['+_0x14a846[_0xe2bc('0x63')][_0xe2bc('0x64')]()+']','Recording\x20is\x20enabled!');_0x14a846[_0xe2bc('0x45')]=util[_0xe2bc('0x8')](_0xe2bc('0x46'),_0x3600d7[_0xe2bc('0x42')],_0x14a846[_0xe2bc('0x47')],md5(_0x14a846[_0xe2bc('0x47')]));}else{_0x14a846[_0xe2bc('0x45')]='';}headers[_0xe2bc('0x5d')]=getAuth(_0x3600d7);return getUser(_0x3600d7)['then'](function(_0x5222fb){_0x5d97b9=_0x5222fb;logger['info'](_0xe2bc('0x48'),_0x5d97b9['id']);return getEndUser(_0x3600d7,_0x14a846[_0xe2bc('0x49')],_0x14a846[_0xe2bc('0x65')]);})[_0xe2bc('0x16')](function(_0x3dc453){_0x1d6e4c=_0x3dc453;logger['info'](_0xe2bc('0x4a'),_0x1d6e4c['id']);return getTicket(_0x3600d7,_0x5d97b9,_0x1d6e4c,_0x1d05ea,_0x14a846);})[_0xe2bc('0x16')](function(_0x3272da){if(_0x3272da){logger['info'](_0xe2bc('0x4b'),_0x3272da['id']);}})[_0xe2bc('0x58')](function(_0x165b24){logger[_0xe2bc('0x56')]('['+_0x14a846[_0xe2bc('0x63')][_0xe2bc('0x64')]()+']'+_0xe2bc('0x66'),util['inspect'](_0x165b24,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x61dd=['idField','variable','variableName','push','customVariable','Variable','name','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','newTab','user:%s','trigger:browser:url','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','destcalleridname','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','lastevent','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','Tags','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','token','%s/token:%s','username','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','string','nameField','customField','toLowerCase','content','type','custom_fields'];(function(_0x482326,_0x414a20){var _0x46d357=function(_0x1f243c){while(--_0x1f243c){_0x482326['push'](_0x482326['shift']());}};_0x46d357(++_0x414a20);}(_0x61dd,0x9d));var _0xd61d=function(_0x213c63,_0x420de6){_0x213c63=_0x213c63-0x0;var _0x300bfb=_0x61dd[_0x213c63];return _0x300bfb;};'use strict';var _=require('lodash');var rp=require(_0xd61d('0x0'));var md5=require(_0xd61d('0x1'));var util=require(_0xd61d('0x2'));var Redis=require('ioredis');var intUtil=require(_0xd61d('0x3'));var config=require(_0xd61d('0x4'));var logger=require(_0xd61d('0x5'))(_0xd61d('0x6'));config['redis']=_[_0xd61d('0x7')](config[_0xd61d('0x8')],{'host':_0xd61d('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd61d('0x8')]));function emit(_0x2c55a4,_0x234833,_0x401c82){io['to'](_0x2c55a4)[_0xd61d('0xa')](_0x234833,_0x401c82);}var headers={'Content-Type':_0xd61d('0xb'),'Accept':'application/json'};function getTicket(_0x3f453d,_0x3cb34a,_0x2f464f,_0xb9911f,_0x2649b4){logger[_0xd61d('0xc')](_0xd61d('0xd'));return request({'uri':util[_0xd61d('0xe')](_0xd61d('0xf'),_0x3f453d[_0xd61d('0x10')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x2f464f['id'],'submitter_id':_0x3cb34a?_0x3cb34a['id']:undefined,'assignee_id':_0x3cb34a?_0x3cb34a['id']:undefined,'tags':getTags(_0xb9911f[_0xd61d('0x11')],'name'),'subject':intUtil[_0xd61d('0x12')](_0xb9911f[_0xd61d('0x13')],_0x2649b4,'\x20'),'description':intUtil['getString'](_0xb9911f[_0xd61d('0x14')],_0x2649b4,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0xb9911f[_0xd61d('0x14')],_0x2649b4,'\x0a')}},getCustomFields(_0xb9911f[_0xd61d('0x15')],_0x2649b4))}})[_0xd61d('0x16')](function(_0x36124d){logger[_0xd61d('0xc')]('Ticket\x20created!');return _0x36124d[_0xd61d('0x17')];});}function getUser(_0x1516d4,_0x556cdb){if(intUtil[_0xd61d('0x18')](_0x556cdb)){logger[_0xd61d('0xc')]('Getting\x20agent\x20with\x20email',_0x556cdb);return request({'uri':util['format'](_0xd61d('0x19'),_0x1516d4[_0xd61d('0x10')]),'qs':{'query':util[_0xd61d('0xe')](_0xd61d('0x1a'),_0x556cdb)}})[_0xd61d('0x16')](function(_0x489170){if(_0x489170[_0xd61d('0x1b')]){logger[_0xd61d('0xc')]('Agent\x20found!');return _[_0xd61d('0x1c')](_0x489170['results'],{'email':_0x556cdb,'role':_0xd61d('0x1d')});}else{logger[_0xd61d('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xd61d('0xe')](_0xd61d('0x1e'),_0x1516d4[_0xd61d('0x10')])})['then'](function(_0x2f6639){logger[_0xd61d('0xc')](_0xd61d('0x1f'));return _0x2f6639[_0xd61d('0x20')];});}});}else{logger[_0xd61d('0xc')](_0xd61d('0x21'));return request({'uri':util[_0xd61d('0xe')](_0xd61d('0x1e'),_0x1516d4[_0xd61d('0x10')])})[_0xd61d('0x16')](function(_0x87da9b){logger[_0xd61d('0xc')](_0xd61d('0x1f'));return _0x87da9b[_0xd61d('0x20')];});}}function getEndUser(_0x18fa4a,_0x36da50,_0x54ee56){logger['info'](_0xd61d('0x22'),_0x54ee56);return request({'uri':util[_0xd61d('0xe')](_0xd61d('0x19'),_0x18fa4a['remoteUri']),'qs':{'query':util['format'](_0xd61d('0x23'),_0x54ee56)}})[_0xd61d('0x16')](function(_0x11a1e8){var _0x5698ba;if(_0x11a1e8[_0xd61d('0x24')][_0xd61d('0x25')]){_0x11a1e8[_0xd61d('0x24')]=_['filter'](_0x11a1e8[_0xd61d('0x24')],{'suspended':![],'role':'end-user'});if(_0x11a1e8[_0xd61d('0x24')][_0xd61d('0x25')]){_0x5698ba=_[_0xd61d('0x26')](_0x11a1e8['results']);}}if(_0x5698ba){logger[_0xd61d('0xc')](_0xd61d('0x27'));return _0x5698ba;}else{logger['info'](_0xd61d('0x28'));return request({'uri':util[_0xd61d('0xe')]('%s/users.json',_0x18fa4a[_0xd61d('0x10')]),'method':'POST','body':{'user':{'role':_0xd61d('0x29'),'name':util[_0xd61d('0xe')](_0xd61d('0x2a'),_0x36da50||_0x54ee56),'phone':_0x54ee56}}})[_0xd61d('0x16')](function(_0x48272b){logger[_0xd61d('0xc')](_0xd61d('0x2b'));return _0x48272b[_0xd61d('0x20')];});}});}function getAuth(_0x32e0db){var _0x3f463a;if(_0x32e0db[_0xd61d('0x2c')]==='password'){_0x3f463a=util[_0xd61d('0xe')]('%s:%s',_0x32e0db['username'],_0x32e0db[_0xd61d('0x2d')]);}else if(_0x32e0db[_0xd61d('0x2c')]===_0xd61d('0x2e')){_0x3f463a=util[_0xd61d('0xe')](_0xd61d('0x2f'),_0x32e0db[_0xd61d('0x30')],_0x32e0db[_0xd61d('0x2e')]);}return util[_0xd61d('0xe')](_0xd61d('0x31'),new Buffer(_0x3f463a)[_0xd61d('0x32')](_0xd61d('0x33')));}function request(_0x143fd9){logger[_0xd61d('0x34')](_0xd61d('0x35'),JSON[_0xd61d('0x36')](_0x143fd9));return rp(_[_0xd61d('0x7')](_0x143fd9,{'method':_0xd61d('0x37'),'headers':headers,'json':!![]}));}function getTags(_0xd0f49e,_0x4463d4){var _0x5e0eb8=[];if(_0xd0f49e&&_0xd0f49e['length']>0x0){_0x5e0eb8=_[_0xd61d('0x38')](_0xd0f49e,_0x4463d4);}return _0x5e0eb8;}function getCustomFields(_0x4ff312,_0x185342){var _0x5b7258=[];var _0x5bdb8f={'custom_fields':[]};if(_0x4ff312['length']>0x0){_[_0xd61d('0x39')](_0x4ff312,function(_0x2181f6){if(_0x2181f6['type']===_0xd61d('0x3a')&&_0x2181f6[_0xd61d('0x3b')]&&!_0x2181f6[_0xd61d('0x3c')]){_0x5bdb8f[_0x2181f6[_0xd61d('0x3b')][_0xd61d('0x3d')]()]=_0x2181f6[_0xd61d('0x3e')]['toString']();}else if(_0x2181f6[_0xd61d('0x3f')]===_0xd61d('0x3a')&&_0x2181f6['idField']&&_0x2181f6[_0xd61d('0x3c')]){_0x5bdb8f[_0xd61d('0x40')]['push']({'id':_0x2181f6[_0xd61d('0x41')],'value':_0x2181f6[_0xd61d('0x3e')][_0xd61d('0x32')]()});}else if(_0x2181f6[_0xd61d('0x3f')]===_0xd61d('0x42')&&_0x2181f6[_0xd61d('0x43')]&&_0x2181f6[_0xd61d('0x41')]&&_0x2181f6['customField']){_0x185342[_0x2181f6[_0xd61d('0x43')]]&&_0x5bdb8f[_0xd61d('0x40')][_0xd61d('0x44')]({'id':_0x2181f6['idField'],'value':_0x185342[_0x2181f6[_0xd61d('0x43')]]['toString']()});}else if(_0x2181f6[_0xd61d('0x3f')]===_0xd61d('0x45')&&_0x2181f6['Variable']&&_0x2181f6[_0xd61d('0x46')][_0xd61d('0x47')]&&_0x2181f6[_0xd61d('0x41')]&&_0x2181f6[_0xd61d('0x3c')]){_0x185342[_0x2181f6[_0xd61d('0x46')][_0xd61d('0x47')][_0xd61d('0x3d')]()]&&_0x5bdb8f['custom_fields']['push']({'id':_0x2181f6[_0xd61d('0x41')],'value':_0x185342[_0x2181f6[_0xd61d('0x46')][_0xd61d('0x47')][_0xd61d('0x3d')]()]['toString']()});}});}return _0x5bdb8f;}exports[_0xd61d('0x48')]=function(_0x33b923,_0x3055c6,_0x4d579b,_0x15a9e2,_0x2a6226,_0x4960b1){var _0x583bb0,_0x2c9c05;_0x4960b1['remoteUri']=intUtil['stripTrailingSlash'](_0x4960b1[_0xd61d('0x10')]);_0x4960b1[_0xd61d('0x49')]=intUtil[_0xd61d('0x4a')](_0x4960b1['serverUrl']);if(_0x2a6226&&_0x2a6226[_0xd61d('0x4b')]){logger[_0xd61d('0xc')](_0xd61d('0x4c'),_0xd61d('0x4d'));_0x3055c6[_0xd61d('0x4e')]=util[_0xd61d('0xe')](_0xd61d('0x4f'),_0x4960b1['serverUrl'],_0x3055c6[_0xd61d('0x50')],md5(_0x3055c6[_0xd61d('0x50')]));}else{_0x3055c6[_0xd61d('0x4e')]='';}headers[_0xd61d('0x51')]=getAuth(_0x4960b1);return getUser(_0x4960b1,_0x15a9e2[_0xd61d('0x52')])[_0xd61d('0x16')](function(_0x18cb9e){_0x583bb0=_0x18cb9e;logger[_0xd61d('0xc')](_0xd61d('0x53'),_0x583bb0['id']);return getEndUser(_0x4960b1,_0x3055c6[_0xd61d('0x54')],_0x3055c6[_0xd61d('0x55')]);})[_0xd61d('0x16')](function(_0x29ecdf){_0x2c9c05=_0x29ecdf;logger[_0xd61d('0xc')](_0xd61d('0x56'),_0x2c9c05['id']);return getTicket(_0x4960b1,_0x583bb0,_0x2c9c05,_0x4d579b,_0x3055c6);})['then'](function(_0x7344a5){if(_0x7344a5){logger[_0xd61d('0xc')](_0xd61d('0x57'),_0x7344a5['id']);switch(_0x4960b1[_0xd61d('0x3f')]){case _0xd61d('0x58'):logger[_0xd61d('0xc')](_0xd61d('0x4c'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0xd61d('0x59'),_0x4960b1[_0xd61d('0x10')],_0x583bb0['id'],_0x7344a5['id']),'method':_0xd61d('0x5a')});case _0xd61d('0x5b'):logger[_0xd61d('0xc')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd61d('0xe')](_0xd61d('0x5c'),_0x15a9e2[_0xd61d('0x47')]),_0xd61d('0x5d'),{'uri':util['format']('%s/agent/tickets/%s',_0x4960b1[_0xd61d('0x10')]['replace'](_0xd61d('0x5e'),''),_0x7344a5['id'])});break;default:logger[_0xd61d('0x5f')]('[QUEUE]',_0xd61d('0x60'));}}})[_0xd61d('0x61')](function(_0x1e374f){logger[_0xd61d('0x5f')](_0xd61d('0x62'),util[_0xd61d('0x63')](_0x1e374f,{'showHidden':!![],'depth':null}));});};exports[_0xd61d('0x64')]=function(_0x5008a5,_0x3d2e4e,_0x430949,_0xdb35e5,_0x5ee3e9,_0x25f56e,_0x5d5d56){var _0x10efaf,_0x4f8fa0;_0x25f56e[_0xd61d('0x10')]=intUtil[_0xd61d('0x4a')](_0x25f56e[_0xd61d('0x10')]);_0x25f56e[_0xd61d('0x49')]=intUtil[_0xd61d('0x4a')](_0x25f56e[_0xd61d('0x49')]);if(_0x5d5d56&&_0x5d5d56['recordingFormat']&&_0x5d5d56[_0xd61d('0x65')]!==_0xd61d('0x66')){logger['info']('[OUTBOUND]',_0xd61d('0x4d'));_0x3d2e4e['recordingURL']=util[_0xd61d('0xe')](_0xd61d('0x4f'),_0x25f56e[_0xd61d('0x49')],_0x3d2e4e[_0xd61d('0x50')],md5(_0x3d2e4e['uniqueid']));}headers[_0xd61d('0x51')]=getAuth(_0x25f56e);return getUser(_0x25f56e,_0xdb35e5[_0xd61d('0x52')])['then'](function(_0x42ce1a){_0x10efaf=_0x42ce1a;logger[_0xd61d('0xc')]('The\x20User\x20ID\x20is:',_0x10efaf['id']);return getEndUser(_0x25f56e,_0x3d2e4e[_0xd61d('0x67')],_0x3d2e4e['destcalleridnum']);})['then'](function(_0xbae79a){_0x4f8fa0=_0xbae79a;logger[_0xd61d('0xc')](_0xd61d('0x56'),_0x4f8fa0['id']);return getTicket(_0x25f56e,_0x10efaf,_0x4f8fa0,_0x430949,_0x3d2e4e);})[_0xd61d('0x16')](function(_0x43ba62){if(_0x43ba62){logger[_0xd61d('0xc')](_0xd61d('0x57'),_0x43ba62['id']);switch(_0x25f56e[_0xd61d('0x3f')]){case'integrationTab':logger[_0xd61d('0xc')](_0xd61d('0x68'),_0xd61d('0x69'));return request({'uri':util['format'](_0xd61d('0x59'),_0x25f56e['remoteUri'],_0x10efaf['id'],_0x43ba62['id']),'method':_0xd61d('0x5a')});case'newTab':logger[_0xd61d('0xc')]('[OUTBOUND]',_0xd61d('0x6a'));emit(util['format']('user:%s',_0xdb35e5[_0xd61d('0x47')]),'trigger:browser:url',{'uri':util[_0xd61d('0xe')]('%s/agent/tickets/%s',_0x25f56e['remoteUri']['replace'](_0xd61d('0x5e'),''),_0x43ba62['id'])});break;default:logger[_0xd61d('0x5f')](_0xd61d('0x68'),_0xd61d('0x60'));}}})[_0xd61d('0x61')](function(_0x136f7f){logger[_0xd61d('0x5f')](_0xd61d('0x6b'),util[_0xd61d('0x63')](_0x136f7f,{'showHidden':!![],'depth':null}));});};exports[_0xd61d('0x6c')]=function(_0xdf9daf,_0x57def1,_0x5f503d,_0xc853a9,_0x1de555,_0x243501){var _0x1c4a07,_0x218e9d;_0x243501[_0xd61d('0x10')]=intUtil['stripTrailingSlash'](_0x243501['remoteUri']);_0x243501[_0xd61d('0x49')]=intUtil[_0xd61d('0x4a')](_0x243501[_0xd61d('0x49')]);if(_0x1de555&&_0x1de555['monitor_format']){logger['info']('['+_0x57def1['lastevent'][_0xd61d('0x6d')]()+']',_0xd61d('0x4d'));_0x57def1[_0xd61d('0x4e')]=util['format'](_0xd61d('0x4f'),_0x243501[_0xd61d('0x49')],_0x57def1['uniqueid'],md5(_0x57def1['uniqueid']));}else{_0x57def1['recordingURL']='';}headers['Authorization']=getAuth(_0x243501);return getUser(_0x243501)[_0xd61d('0x16')](function(_0x182c08){_0x1c4a07=_0x182c08;logger[_0xd61d('0xc')](_0xd61d('0x53'),_0x1c4a07['id']);return getEndUser(_0x243501,_0x57def1[_0xd61d('0x54')],_0x57def1[_0xd61d('0x55')]);})[_0xd61d('0x16')](function(_0x48bef5){_0x218e9d=_0x48bef5;logger[_0xd61d('0xc')](_0xd61d('0x56'),_0x218e9d['id']);return getTicket(_0x243501,_0x1c4a07,_0x218e9d,_0x5f503d,_0x57def1);})[_0xd61d('0x16')](function(_0x2a8451){if(_0x2a8451){logger[_0xd61d('0xc')](_0xd61d('0x57'),_0x2a8451['id']);}})[_0xd61d('0x61')](function(_0x1c0c93){logger[_0xd61d('0x5f')]('['+_0x57def1[_0xd61d('0x6e')][_0xd61d('0x6d')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xd61d('0x63')](_0x1c0c93,{'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 16813bd..e5fe259 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 _0xd142=['string','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','stack','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','profile','user','Administrator','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','data','code','details','Error:\x20','log','CREATE\x20ERROR','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','Creating\x20new\x20call...','Owner','administrator','getString','Description','Who_Id','Full_Name','Last_Name','First_Name','$se_module','talktime','utc','format','mm:ss','answertime','endtime','Call_Duration','diff','starttime','YYYY-MM-DDTHH:mm:ss','Call_Result','Called','complete','connect','rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','uniqueid','recordingURL','zoho.eu','com','The\x20Call\x20ID\x20is:','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','/api/voice/recordings/','The\x20User\x20ID\x20is:','destcalleridname','Outbound','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','unmanaged','monitor_format','lastevent','Recording\x20is\x20enabled!','/downloads?type=uniqueid&token=','calleridnum','toUpperCase','lodash','request-promise','md5','util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','type'];(function(_0x1d4a48,_0x1b289c){var _0x100d67=function(_0x7ba067){while(--_0x7ba067){_0x1d4a48['push'](_0x1d4a48['shift']());}};_0x100d67(++_0x1b289c);}(_0xd142,0x11a));var _0x2d14=function(_0x4b2407,_0x3fa63e){_0x4b2407=_0x4b2407-0x0;var _0x5defa2=_0xd142[_0x4b2407];return _0x5defa2;};'use strict';var _=require(_0x2d14('0x0'));var rp=require(_0x2d14('0x1'));var md5=require(_0x2d14('0x2'));var util=require(_0x2d14('0x3'));var intUtil=require('./util');var moment=require('moment');var Redis=require(_0x2d14('0x4'));var BPromise=require(_0x2d14('0x5'));var config=require(_0x2d14('0x6'));var logger=require(_0x2d14('0x7'))(_0x2d14('0x8'));config[_0x2d14('0x9')]=_[_0x2d14('0xa')](config[_0x2d14('0x9')],{'host':_0x2d14('0xb'),'port':0x18eb});var io=require(_0x2d14('0xc'))(new Redis(config[_0x2d14('0x9')]));function emit(_0x1b2d92,_0x4e5f73,_0x2683f0){io['to'](_0x1b2d92)[_0x2d14('0xd')](_0x4e5f73,_0x2683f0);}function request(_0x581f76){logger[_0x2d14('0xe')](_0x2d14('0xf'),JSON[_0x2d14('0x10')](_0x581f76));return rp(_0x581f76);}function getCustomFields(_0x4909a5,_0x25cc79){var _0x163b35={};if(_0x4909a5['length']>0x0){_['forEach'](_0x4909a5,function(_0xbfa026){if(_0xbfa026[_0x2d14('0x11')]===_0x2d14('0x12')&&_0xbfa026['idField']){_0x163b35[_0xbfa026[_0x2d14('0x13')]]=_0xbfa026[_0x2d14('0x14')][_0x2d14('0x15')]();}else if(_0xbfa026[_0x2d14('0x11')]==='variable'&&_0xbfa026[_0x2d14('0x16')]&&_0xbfa026[_0x2d14('0x13')]&&_0x25cc79[_0xbfa026['variableName']]){_0x163b35[_0xbfa026[_0x2d14('0x13')]]=_0x25cc79[_0xbfa026[_0x2d14('0x16')]][_0x2d14('0x15')]();}else if(_0xbfa026[_0x2d14('0x11')]===_0x2d14('0x17')&&_0xbfa026['Variable']&&_0xbfa026[_0x2d14('0x18')][_0x2d14('0x19')]&&_0xbfa026[_0x2d14('0x13')]&&_0x25cc79[_0xbfa026[_0x2d14('0x18')][_0x2d14('0x19')]['toLowerCase']()]){_0x163b35[_0xbfa026[_0x2d14('0x13')]]=_0x25cc79[_0xbfa026[_0x2d14('0x18')][_0x2d14('0x19')][_0x2d14('0x1a')]()]['toString']();}});}return _0x163b35;}function getName(_0x4c4436){if(_0x4c4436[_0x2d14('0x1b')]('\x20')>0x0){var _0x5a53fe=_0x4c4436['split'](/ (.+)/);if(_0x5a53fe[0x1]){return _0x5a53fe;}}return[_0x4c4436,_0x4c4436];}var accountsTokens={};function getAccessToken(_0x8dde24){return new Promise(function(_0x3c930f,_0x17d686){if(!_['isNil'](accountsTokens[_0x8dde24['id']])&&!_[_0x2d14('0x1c')](accountsTokens[_0x8dde24['id']][_0x2d14('0x1d')])){if(moment()['isBefore'](accountsTokens[_0x8dde24['id']][_0x2d14('0x1e')])){_0x3c930f(accountsTokens[_0x8dde24['id']][_0x2d14('0x1d')]);}}var _0x5b117a;switch(_0x8dde24[_0x2d14('0x1f')]){case'US':_0x5b117a=_0x2d14('0x20');break;case'AU':_0x5b117a=_0x2d14('0x21');break;case'EU':_0x5b117a=_0x2d14('0x22');break;case'IN':_0x5b117a=_0x2d14('0x23');break;case'CN':_0x5b117a='https://accounts.zoho.com.cn';break;default:_0x5b117a=_0x2d14('0x22');break;}var _0x5d6ab5={'method':_0x2d14('0x24'),'uri':_0x5b117a+'/oauth/v2/token','qs':{'refresh_token':_0x8dde24['refreshToken'],'client_id':_0x8dde24[_0x2d14('0x25')],'client_secret':_0x8dde24[_0x2d14('0x26')],'grant_type':_0x2d14('0x27')},'json':!![]};return rp(_0x5d6ab5)[_0x2d14('0x28')](function(_0x51b609){accountsTokens[_0x8dde24['id']]={'access_token':_0x51b609[_0x2d14('0x1d')],'expires_in':moment()[_0x2d14('0x29')](_0x51b609['expires_in'],_0x2d14('0x2a'))};_0x3c930f(_0x51b609[_0x2d14('0x1d')]);})[_0x2d14('0x2b')](function(_0x104e0e){logger[_0x2d14('0x2c')]('Failing\x20creating\x20the\x20access_token',_0x104e0e[_0x2d14('0x2d')]);_0x17d686(_0x104e0e);});});}function getUser(_0x468972,_0x44b129,_0x250c6c,_0xdb2a4d){logger[_0x2d14('0x2e')](_0x2d14('0x2f'));return request({'method':_0x2d14('0x30'),'uri':util['format'](_0x2d14('0x31'),_0x44b129),'qs':{'type':_0x2d14('0x32')},'headers':{'Authorization':_0x2d14('0x33')+_0x468972},'json':!![]})[_0x2d14('0x28')](function(_0x55ccb5){if(_0x55ccb5[_0x2d14('0x34')]){var _0x2b0849=-0x1;if(_[_0x2d14('0x35')](_0x55ccb5['users'])){if(!_[_0x2d14('0x1c')](_0xdb2a4d)){_0x2b0849=_[_0x2d14('0x36')](_0x55ccb5[_0x2d14('0x34')],function(_0xf7a7b7){return _0xf7a7b7[_0x2d14('0x37')]===_0xdb2a4d;});}if(_0x2b0849>=0x0){logger[_0x2d14('0x2e')](_0x2d14('0x38'));}else{logger[_0x2d14('0x2e')]('Using\x20the\x20admin\x20account!');_0x2b0849=_[_0x2d14('0x36')](_0x55ccb5[_0x2d14('0x34')],function(_0x1a7ed8){return _0x1a7ed8[_0x2d14('0x39')][_0x2d14('0x19')]==='Administrator';});}return _0x55ccb5[_0x2d14('0x34')][_0x2b0849];}else{if(_0x55ccb5[_0x2d14('0x3a')][_0x2d14('0x39')][_0x2d14('0x19')]===_0x2d14('0x3b')){logger['info'](_0x2d14('0x3c'));user=_0x55ccb5[_0x2d14('0x3a')];return user;}else{logger[_0x2d14('0x2c')](_0x2d14('0x3d'),JSON[_0x2d14('0x10')](_0x55ccb5));throw new Error(_0x2d14('0x3e')+JSON['stringify'](_0x55ccb5));}}}else{logger[_0x2d14('0x2c')]('The\x20failing\x20result\x20is',JSON[_0x2d14('0x10')](_0x55ccb5));throw new Error(_0x2d14('0x3e')+JSON[_0x2d14('0x10')](_0x55ccb5));}})[_0x2d14('0x2b')](function(_0x9b9cb9){console[_0x2d14('0x2c')](_0x9b9cb9);});}function getZohoUser(_0xa747a7,_0x588e48){return new BPromise(function(_0x34ca0c,_0x3114cd){request(_0xa747a7)[_0x2d14('0x28')](function(_0xbfe4c7){var _0x34e77d=null;if(_0xbfe4c7){_0x34e77d=_0xbfe4c7['data'][0x0];_0x34e77d[_0x2d14('0x3f')]=_0x588e48;}_0x34ca0c(_0x34e77d);})[_0x2d14('0x2b')](function(_0x474e9f){_0x3114cd(_0x474e9f);});});}function createEndUser(_0x39cc9a,_0x2a4342,_0x435844,_0x2324d9,_0xf25786,_0x27804e){var _0x435844=getName(_0x435844);return request({'method':_0x2d14('0x24'),'uri':_0x2d14('0x40')+_0x2a4342+_0x2d14('0x41')+_[_0x2d14('0x42')](_0x27804e[_0x2d14('0x43')])+'s','body':{'data':[{'Last_Name':_0x435844[0x1],'First_Name':_0x435844[0x0],'Phone':_0x2324d9,'Owner':{'name':!_['isNil'](_0xf25786[_0x2d14('0x44')][_0x2d14('0x19')])?_0xf25786[_0x2d14('0x44')][_0x2d14('0x19')]:!_['isNil'](_0xf25786[_0x2d14('0x45')])?_0xf25786[_0x2d14('0x45')]+'\x20'+_0xf25786['last_name']:_0xf25786[_0x2d14('0x46')],'id':_0xf25786['id']}}]},'headers':{'Authorization':_0x2d14('0x33')+_0x39cc9a},'json':!![]})[_0x2d14('0x28')](function(_0x1954a2){if(_0x1954a2&&_0x1954a2[_0x2d14('0x47')][0x0][_0x2d14('0x48')]==='SUCCESS'){var _0x5588b0=_0x1954a2[_0x2d14('0x47')][0x0][_0x2d14('0x49')];_0x5588b0[_0x2d14('0x3f')]=_[_0x2d14('0x42')](_0x27804e['moduleCreate'])+'s';return _0x5588b0;}logger[_0x2d14('0x2c')](_0x2d14('0x3d'),JSON[_0x2d14('0x10')](data));throw new Error(_0x2d14('0x4a')+JSON[_0x2d14('0x10')](data));})[_0x2d14('0x2b')](function(_0x88a280){console[_0x2d14('0x4b')](_0x2d14('0x4c'),_0x88a280);});}function getEndUser(_0x12bd68,_0x480952,_0x33bd62,_0x35565c,_0x2588c1,_0x331a13,_0x49f42f){var _0x4ab8b8={'method':_0x2d14('0x30'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x12bd68},'json':!![]};switch(_0x49f42f['moduleSearch']){case'contact_lead':_0x4ab8b8[_0x2d14('0x4d')]='https://www.zohoapis.'+_0x480952+_0x2d14('0x4e')+_0x2588c1+'))';return getZohoUser(_0x4ab8b8,_0x2d14('0x4f'))[_0x2d14('0x28')](function(_0x2aa2bc){if(_0x2aa2bc)return _0x2aa2bc;_0x4ab8b8['uri']=_0x2d14('0x40')+_0x480952+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2588c1+'))';return getZohoUser(_0x4ab8b8,_0x2d14('0x50'))[_0x2d14('0x28')](function(_0x501fff){if(_0x501fff)return _0x501fff;if(_0x49f42f['moduleCreate']!=_0x2d14('0x51')){return createEndUser(_0x12bd68,_0x480952,_0x35565c,_0x2588c1,_0x331a13,_0x49f42f);}else{return{};}});});break;case _0x2d14('0x52'):_0x4ab8b8[_0x2d14('0x4d')]=_0x2d14('0x40')+_0x480952+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2588c1+'))';return getZohoUser(_0x4ab8b8,'Contacts')[_0x2d14('0x28')](function(_0x3920c3){if(_0x3920c3)return _0x3920c3;if(_0x49f42f[_0x2d14('0x43')]!='nothing'){return createEndUser(_0x12bd68,_0x480952,_0x35565c,_0x2588c1,_0x331a13,_0x49f42f);}else{return{};}});break;case'lead':_0x4ab8b8['uri']=_0x2d14('0x40')+_0x480952+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2588c1+'))';return getZohoUser(_0x4ab8b8,_0x2d14('0x50'))[_0x2d14('0x28')](function(_0x18dba4){if(_0x18dba4)return _0x18dba4;if(_0x49f42f[_0x2d14('0x43')]!='nothing'){return createEndUser(_0x12bd68,_0x480952,_0x35565c,_0x2588c1,_0x331a13,_0x49f42f);}else{return{};}});break;}}function getCall(_0x170304,_0x4a46f8,_0x4c9655,_0x5c7e6c,_0x338cd3,_0x2a1754,_0x56cd4f,_0x3c9bb0){logger['info'](_0x2d14('0x53'));var _0xa214ea={};_0xa214ea[_0x2d14('0x54')]={'name':!_[_0x2d14('0x1c')](_0x5c7e6c[_0x2d14('0x44')]['name'])&&!_['isNil'](_0x5c7e6c[_0x2d14('0x39')]['name'])&&_0x5c7e6c[_0x2d14('0x39')]['name']===_0x2d14('0x55')?_0x5c7e6c['role'][_0x2d14('0x19')]:!_[_0x2d14('0x1c')](_0x5c7e6c['first_name'])?_0x5c7e6c[_0x2d14('0x45')]+'\x20'+_0x5c7e6c['last_name']:_0x5c7e6c[_0x2d14('0x46')],'id':_0x5c7e6c['id']};_0xa214ea['Subject']=intUtil[_0x2d14('0x56')](_0x2a1754['Subjects'],_0x56cd4f,'\x20');_0xa214ea[_0x2d14('0x57')]=intUtil[_0x2d14('0x56')](_0x2a1754['Descriptions'],_0x56cd4f,'\x0a');if(_0x338cd3['enduserType']===_0x2d14('0x4f')){_0xa214ea[_0x2d14('0x58')]={'name':!_[_0x2d14('0x1c')](_0x338cd3[_0x2d14('0x59')])?_0x338cd3[_0x2d14('0x59')]:!_[_0x2d14('0x1c')](_0x338cd3['First_Name'])?_0x338cd3['First_Name']+'\x20'+_0x338cd3[_0x2d14('0x5a')]:_0x338cd3[_0x2d14('0x5a')],'id':_0x338cd3['id']};}if(_0x338cd3[_0x2d14('0x3f')]==='Leads'){_0xa214ea['What_Id']={'name':!_[_0x2d14('0x1c')](_0x338cd3[_0x2d14('0x59')])?_0x338cd3['Full_Name']:!_[_0x2d14('0x1c')](_0x338cd3[_0x2d14('0x5b')])?_0x338cd3['First_Name']+'\x20'+_0x338cd3[_0x2d14('0x5a')]:_0x338cd3[_0x2d14('0x5a')],'id':_0x338cd3['id']};_0xa214ea[_0x2d14('0x5c')]=_[_0x2d14('0x42')](_0x338cd3[_0x2d14('0x3f')]);}if(_0x56cd4f[_0x2d14('0x5d')]){_0xa214ea['Call_Duration']=moment[_0x2d14('0x5e')](parseInt(_0x56cd4f[_0x2d14('0x5d')])*0x3e8)[_0x2d14('0x5f')](_0x2d14('0x60'));}else if(_0x56cd4f[_0x2d14('0x61')]&&_0x56cd4f[_0x2d14('0x62')]){_0xa214ea[_0x2d14('0x63')]=moment[_0x2d14('0x5e')](moment(_0x56cd4f['endtime'],'YYYY-MM-DDTHH:mm:ss')[_0x2d14('0x64')](moment(_0x56cd4f[_0x2d14('0x65')],_0x2d14('0x66'))))[_0x2d14('0x5f')](_0x2d14('0x60'));}switch(_0x56cd4f['lastevent']){case'called':_0xa214ea[_0x2d14('0x67')]=_0x2d14('0x68');break;case _0x2d14('0x69'):case _0x2d14('0x6a'):_0xa214ea[_0x2d14('0x67')]='Answered';break;case _0x2d14('0x6b'):_0xa214ea['Call_Result']='Rejected';break;case _0x2d14('0x6c'):_0xa214ea[_0x2d14('0x67')]=_0x2d14('0x6d');break;case _0x2d14('0x6e'):_0xa214ea[_0x2d14('0x67')]=_0x2d14('0x6f');default:}_0xa214ea[_0x2d14('0x70')]=(_0x3c9bb0===_0x2d14('0x71')?moment(_0x56cd4f[_0x2d14('0x65')])[_0x2d14('0x5f')](_0x2d14('0x66')):moment(_0x56cd4f[_0x2d14('0x72')])[_0x2d14('0x5f')](_0x2d14('0x66')))||moment()[_0x2d14('0x5f')](_0x2d14('0x66'));_0xa214ea[_0x2d14('0x73')]=_0x3c9bb0||_0x2d14('0x74');_0xa214ea=_[_0x2d14('0x75')](_0xa214ea,getCustomFields(_0x2a1754['Fields'],_0x56cd4f));return request({'method':'POST','uri':_0x2d14('0x40')+_0x4a46f8+_0x2d14('0x76'),'headers':{'Authorization':_0x2d14('0x33')+_0x170304},'body':{'data':[_0xa214ea]},'json':!![]})[_0x2d14('0x28')](function(_0x5b39e9){if(_0x5b39e9&&_0x5b39e9[_0x2d14('0x47')][0x0][_0x2d14('0x48')]==='SUCCESS'){logger['info'](_0x2d14('0x77'));return{'id':_0x5b39e9[_0x2d14('0x47')][0x0][_0x2d14('0x49')]['id']};}})[_0x2d14('0x2b')](function(_0x2d8df6){logger[_0x2d14('0x2e')](_0x2d14('0x78'),_0x2d8df6['stack']);console[_0x2d14('0x4b')](_0x2d14('0x78'),_0x2d8df6);});}exports[_0x2d14('0x79')]=function(_0x494510,_0x73423d,_0x1642c9,_0x567b8d,_0x14131a,_0x2a5403){var _0x5ef440,_0x536220,_0x4207c4;_0x2a5403[_0x2d14('0x7a')]=intUtil[_0x2d14('0x7b')](_0x2a5403[_0x2d14('0x7a')]);_0x2a5403[_0x2d14('0x7c')]=intUtil[_0x2d14('0x7b')](_0x2a5403[_0x2d14('0x7c')]);if(_0x14131a&&_0x14131a['monitor_format']){logger[_0x2d14('0x2e')](_0x2d14('0x7d'),'Recording\x20is\x20enabled!');_0x73423d['recordingURL']=_0x2a5403[_0x2d14('0x7c')]+'/api/voice/recordings/'+_0x73423d[_0x2d14('0x7e')]+'/downloads?type=uniqueid&token='+md5(_0x73423d['uniqueid']);}else{_0x73423d[_0x2d14('0x7f')]='';}var _0x403498=_0x2a5403[_0x2d14('0x7a')]===_0x2d14('0x80')?'eu':_0x2d14('0x81');return getAccessToken(_0x2a5403)['then'](function(_0x362958){_0x4207c4=_0x362958;return getUser(_0x4207c4,_0x403498,_0x2a5403,_0x567b8d[_0x2d14('0x37')]);})[_0x2d14('0x28')](function(_0x4d571a){_0x5ef440=_0x4d571a;logger['info']('The\x20User\x20ID\x20is:',_0x5ef440['id']);return getEndUser(_0x4207c4,_0x403498,_0x2a5403,_0x73423d['calleridname'],_0x73423d['calleridnum'],_0x5ef440,_0x1642c9);})['then'](function(_0x17a69c){_0x536220=_0x17a69c;return getCall(_0x4207c4,_0x403498,_0x2a5403,_0x5ef440,_0x536220,_0x1642c9,_0x73423d,_0x2d14('0x74'));})['then'](function(_0x37bf7f){if(_0x37bf7f){logger['info'](_0x2d14('0x82'),_0x37bf7f['id']);logger[_0x2d14('0x2e')](_0x2d14('0x7d'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x2d14('0x83'),_0x567b8d[_0x2d14('0x19')]),'trigger:browser:url',{'uri':_0x2d14('0x84')+_0x2a5403['host']+_0x2d14('0x85')+_0x37bf7f['id']});}})[_0x2d14('0x2b')](function(_0x3fbe52){logger[_0x2d14('0x2c')](_0x2d14('0x7d'),JSON[_0x2d14('0x10')](_0x3fbe52));});};exports['outbound']=function(_0x43b1a3,_0x2713c3,_0x272547,_0xc561fb,_0x5c1315,_0x288df1,_0x205519){var _0x256788,_0x105114,_0x59e29a;_0x288df1[_0x2d14('0x7a')]=intUtil[_0x2d14('0x7b')](_0x288df1['host']);_0x288df1[_0x2d14('0x7c')]=intUtil[_0x2d14('0x7b')](_0x288df1[_0x2d14('0x7c')]);if(_0x205519&&_0x205519[_0x2d14('0x86')]&&_0x205519['recordingFormat']!==_0x2d14('0x87')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2713c3[_0x2d14('0x7f')]=_0x288df1[_0x2d14('0x7c')]+_0x2d14('0x88')+_0x2713c3[_0x2d14('0x7e')]+'/downloads?type=uniqueid&token='+md5(_0x2713c3['uniqueid']);}var _0x28f6e2=_0x288df1[_0x2d14('0x7a')]===_0x2d14('0x80')?'eu':'com';return getAccessToken(_0x288df1)[_0x2d14('0x28')](function(_0x249b09){_0x59e29a=_0x249b09;return getUser(_0x59e29a,_0x28f6e2,_0x288df1,_0xc561fb[_0x2d14('0x37')]);})[_0x2d14('0x28')](function(_0x495c90){_0x256788=_0x495c90;logger['info'](_0x2d14('0x89'),_0x256788['id']);return getEndUser(_0x59e29a,_0x28f6e2,_0x288df1,_0x2713c3[_0x2d14('0x8a')],_0x2713c3['destcalleridnum'],_0x256788,_0x272547);})[_0x2d14('0x28')](function(_0x42b932){_0x105114=_0x42b932;return getCall(_0x59e29a,_0x28f6e2,_0x288df1,_0x256788,_0x105114,_0x272547,_0x2713c3,_0x2d14('0x8b'));})[_0x2d14('0x28')](function(_0x58da03){if(_0x58da03){logger[_0x2d14('0x2e')]('The\x20Call\x20ID\x20is:',_0x58da03['id']);logger['info'](_0x2d14('0x8c'),_0x2d14('0x8d'));emit(util[_0x2d14('0x5f')](_0x2d14('0x83'),_0xc561fb[_0x2d14('0x19')]),_0x2d14('0x8e'),{'uri':'https://crm.'+_0x288df1['host']+_0x2d14('0x85')+_0x58da03['id']});}})[_0x2d14('0x2b')](function(_0x289647){logger[_0x2d14('0x2c')](_0x2d14('0x8c'),JSON['stringify'](_0x289647));});};exports[_0x2d14('0x8f')]=function(_0x4315e0,_0x5c493b,_0x44793c,_0xe9f4e5,_0x43442a,_0x11bae3){var _0x7a630e,_0x1e33f8,_0x404273;_0x11bae3[_0x2d14('0x7a')]=intUtil[_0x2d14('0x7b')](_0x11bae3['host']);_0x11bae3['serverUrl']=intUtil[_0x2d14('0x7b')](_0x11bae3[_0x2d14('0x7c')]);if(_0x43442a&&_0x43442a[_0x2d14('0x90')]){logger[_0x2d14('0x2e')]('['+_0x5c493b[_0x2d14('0x91')]['toUpperCase']()+']',_0x2d14('0x92'));_0x5c493b[_0x2d14('0x7f')]=_0x11bae3[_0x2d14('0x7c')]+_0x2d14('0x88')+_0x5c493b[_0x2d14('0x7e')]+_0x2d14('0x93')+md5(_0x5c493b[_0x2d14('0x7e')]);}else{_0x5c493b[_0x2d14('0x7f')]='';}var _0x53678b=_0x11bae3[_0x2d14('0x7a')]===_0x2d14('0x80')?'eu':_0x2d14('0x81');return getAccessToken(_0x11bae3)[_0x2d14('0x28')](function(_0x3216f5){_0x404273=_0x3216f5;return getUser(_0x404273,_0x53678b,_0x11bae3);})[_0x2d14('0x28')](function(_0x5f4e05){_0x7a630e=_0x5f4e05;logger[_0x2d14('0x2e')](_0x2d14('0x89'),_0x7a630e['id']);return getEndUser(_0x404273,_0x53678b,_0x11bae3,_0x5c493b['calleridname'],_0x5c493b[_0x2d14('0x94')],_0x7a630e,_0x44793c);})[_0x2d14('0x28')](function(_0x408910){_0x1e33f8=_0x408910;return getCall(_0x404273,_0x53678b,_0x11bae3,_0x7a630e,_0x1e33f8,_0x44793c,_0x5c493b,_0x2d14('0x74'));})[_0x2d14('0x28')](function(_0x3e6c6e){if(_0x3e6c6e){logger[_0x2d14('0x2e')]('The\x20Call\x20ID\x20is:',_0x3e6c6e['id']);}})[_0x2d14('0x2b')](function(_0x5889dd){logger[_0x2d14('0x2c')]('['+_0x5c493b[_0x2d14('0x91')][_0x2d14('0x95')]()+']',JSON[_0x2d14('0x10')](_0x5889dd));});}; \ No newline at end of file +var _0x236c=['starttime','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','err','queue','host','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','zoho.eu','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','serverUrl','recordingFormat','none','/api/voice/recordings/','/downloads?type=uniqueid&token=','destcalleridnum','Outbound','[OUTBOUND]','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','com','lodash','md5','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','type','string','idField','variable','variableName','customVariable','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.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','then','seconds','catch','error','stack','info','Search\x20user','GET','ActiveUsers','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','details','Error:\x20','log','moduleSearch','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','format','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','mm:ss','lastevent','called','Call_Result','Called','Answered','rejected','Rejected','Call_Start_Time'];(function(_0x1ab806,_0x890bc4){var _0xbb964d=function(_0x2c57a2){while(--_0x2c57a2){_0x1ab806['push'](_0x1ab806['shift']());}};_0xbb964d(++_0x890bc4);}(_0x236c,0x155));var _0xc236=function(_0x1ad0c3,_0x21bdf4){_0x1ad0c3=_0x1ad0c3-0x0;var _0x43bad9=_0x236c[_0x1ad0c3];return _0x43bad9;};'use strict';var _=require(_0xc236('0x0'));var rp=require('request-promise');var md5=require(_0xc236('0x1'));var util=require(_0xc236('0x2'));var intUtil=require(_0xc236('0x3'));var moment=require(_0xc236('0x4'));var Redis=require(_0xc236('0x5'));var BPromise=require('bluebird');var config=require(_0xc236('0x6'));var logger=require(_0xc236('0x7'))(_0xc236('0x8'));config[_0xc236('0x9')]=_[_0xc236('0xa')](config[_0xc236('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xc236('0xb'))(new Redis(config[_0xc236('0x9')]));function emit(_0x51a13b,_0x5bc6a2,_0x5cdee5){io['to'](_0x51a13b)[_0xc236('0xc')](_0x5bc6a2,_0x5cdee5);}function request(_0x4b8dc6){logger[_0xc236('0xd')](_0xc236('0xe'),JSON[_0xc236('0xf')](_0x4b8dc6));return rp(_0x4b8dc6);}function getCustomFields(_0x2f8b72,_0xaf651b){var _0x5bc8d8={};if(_0x2f8b72[_0xc236('0x10')]>0x0){_[_0xc236('0x11')](_0x2f8b72,function(_0x58acb0){if(_0x58acb0[_0xc236('0x12')]===_0xc236('0x13')&&_0x58acb0['idField']){_0x5bc8d8[_0x58acb0[_0xc236('0x14')]]=_0x58acb0['content']['toString']();}else if(_0x58acb0[_0xc236('0x12')]===_0xc236('0x15')&&_0x58acb0[_0xc236('0x16')]&&_0x58acb0[_0xc236('0x14')]&&_0xaf651b[_0x58acb0['variableName']]){_0x5bc8d8[_0x58acb0[_0xc236('0x14')]]=_0xaf651b[_0x58acb0['variableName']]['toString']();}else if(_0x58acb0[_0xc236('0x12')]===_0xc236('0x17')&&_0x58acb0[_0xc236('0x18')]&&_0x58acb0[_0xc236('0x18')][_0xc236('0x19')]&&_0x58acb0['idField']&&_0xaf651b[_0x58acb0['Variable']['name'][_0xc236('0x1a')]()]){_0x5bc8d8[_0x58acb0[_0xc236('0x14')]]=_0xaf651b[_0x58acb0[_0xc236('0x18')]['name'][_0xc236('0x1a')]()]['toString']();}});}return _0x5bc8d8;}function getName(_0x59e448){if(_0x59e448[_0xc236('0x1b')]('\x20')>0x0){var _0x30adeb=_0x59e448[_0xc236('0x1c')](/ (.+)/);if(_0x30adeb[0x1]){return _0x30adeb;}}return[_0x59e448,_0x59e448];}var accountsTokens={};function getAccessToken(_0x46bc69){return new Promise(function(_0x2b6d3f,_0x27c6ab){if(!_[_0xc236('0x1d')](accountsTokens[_0x46bc69['id']])&&!_[_0xc236('0x1d')](accountsTokens[_0x46bc69['id']][_0xc236('0x1e')])){if(moment()[_0xc236('0x1f')](accountsTokens[_0x46bc69['id']][_0xc236('0x20')])){_0x2b6d3f(accountsTokens[_0x46bc69['id']]['access_token']);}}var _0x208c3f;switch(_0x46bc69[_0xc236('0x21')]){case'US':_0x208c3f=_0xc236('0x22');break;case'AU':_0x208c3f=_0xc236('0x23');break;case'EU':_0x208c3f=_0xc236('0x24');break;case'IN':_0x208c3f=_0xc236('0x25');break;case'CN':_0x208c3f=_0xc236('0x26');break;default:_0x208c3f=_0xc236('0x24');break;}var _0x1d65e2={'method':_0xc236('0x27'),'uri':_0x208c3f+_0xc236('0x28'),'qs':{'refresh_token':_0x46bc69['refreshToken'],'client_id':_0x46bc69[_0xc236('0x29')],'client_secret':_0x46bc69[_0xc236('0x2a')],'grant_type':_0xc236('0x2b')},'json':!![]};return rp(_0x1d65e2)[_0xc236('0x2c')](function(_0x561da1){accountsTokens[_0x46bc69['id']]={'access_token':_0x561da1[_0xc236('0x1e')],'expires_in':moment()['add'](_0x561da1['expires_in'],_0xc236('0x2d'))};_0x2b6d3f(_0x561da1['access_token']);})[_0xc236('0x2e')](function(_0x4f753c){logger[_0xc236('0x2f')]('Failing\x20creating\x20the\x20access_token',_0x4f753c[_0xc236('0x30')]);_0x27c6ab(_0x4f753c);});});}function getUser(_0x1d144b,_0x4f5175,_0x5a61b5,_0x265c8d){logger[_0xc236('0x31')](_0xc236('0x32'));return request({'method':_0xc236('0x33'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x4f5175),'qs':{'type':_0xc236('0x34')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1d144b},'json':!![]})[_0xc236('0x2c')](function(_0x4ddc87){if(_0x4ddc87[_0xc236('0x35')]){var _0x40a6c8=-0x1;if(_['isArrayLikeObject'](_0x4ddc87['users'])){if(!_[_0xc236('0x1d')](_0x265c8d)){_0x40a6c8=_[_0xc236('0x36')](_0x4ddc87[_0xc236('0x35')],function(_0x2f64bd){return _0x2f64bd[_0xc236('0x37')]===_0x265c8d;});}if(_0x40a6c8>=0x0){logger[_0xc236('0x31')](_0xc236('0x38'));}else{logger[_0xc236('0x31')](_0xc236('0x39'));_0x40a6c8=_['findIndex'](_0x4ddc87['users'],function(_0x5c151a){return _0x5c151a[_0xc236('0x3a')][_0xc236('0x19')]===_0xc236('0x3b');});}return _0x4ddc87[_0xc236('0x35')][_0x40a6c8];}else{if(_0x4ddc87[_0xc236('0x3c')][_0xc236('0x3a')][_0xc236('0x19')]==='Administrator'){logger[_0xc236('0x31')](_0xc236('0x39'));user=_0x4ddc87[_0xc236('0x3c')];return user;}else{logger['error'](_0xc236('0x3d'),JSON[_0xc236('0xf')](_0x4ddc87));throw new Error(_0xc236('0x3e')+JSON[_0xc236('0xf')](_0x4ddc87));}}}else{logger['error'](_0xc236('0x3d'),JSON[_0xc236('0xf')](_0x4ddc87));throw new Error(_0xc236('0x3e')+JSON[_0xc236('0xf')](_0x4ddc87));}})[_0xc236('0x2e')](function(_0x1edab3){console[_0xc236('0x2f')](_0x1edab3);});}function getZohoUser(_0x11ca1c,_0x131212){return new BPromise(function(_0x1251af,_0x2bb05e){request(_0x11ca1c)[_0xc236('0x2c')](function(_0x2664ba){var _0x237193=null;if(_0x2664ba){_0x237193=_0x2664ba[_0xc236('0x3f')][0x0];_0x237193[_0xc236('0x40')]=_0x131212;}_0x1251af(_0x237193);})[_0xc236('0x2e')](function(_0x4f5490){_0x2bb05e(_0x4f5490);});});}function createEndUser(_0x5606b0,_0x54225a,_0x4c5a50,_0x369a79,_0x5c4739,_0x35905c){var _0x4c5a50=getName(_0x4c5a50);return request({'method':_0xc236('0x27'),'uri':_0xc236('0x41')+_0x54225a+_0xc236('0x42')+_[_0xc236('0x43')](_0x35905c[_0xc236('0x44')])+'s','body':{'data':[{'Last_Name':_0x4c5a50[0x1],'First_Name':_0x4c5a50[0x0],'Phone':_0x369a79,'Owner':{'name':!_[_0xc236('0x1d')](_0x5c4739[_0xc236('0x45')][_0xc236('0x19')])?_0x5c4739[_0xc236('0x45')][_0xc236('0x19')]:!_[_0xc236('0x1d')](_0x5c4739[_0xc236('0x46')])?_0x5c4739[_0xc236('0x46')]+'\x20'+_0x5c4739['last_name']:_0x5c4739[_0xc236('0x47')],'id':_0x5c4739['id']}}]},'headers':{'Authorization':_0xc236('0x48')+_0x5606b0},'json':!![]})['then'](function(_0xb90a83){if(_0xb90a83&&_0xb90a83['data'][0x0][_0xc236('0x49')]==='SUCCESS'){var _0x30f391=_0xb90a83[_0xc236('0x3f')][0x0][_0xc236('0x4a')];_0x30f391['enduserType']=_[_0xc236('0x43')](_0x35905c[_0xc236('0x44')])+'s';return _0x30f391;}logger[_0xc236('0x2f')]('The\x20failing\x20result\x20is',JSON[_0xc236('0xf')](data));throw new Error(_0xc236('0x4b')+JSON[_0xc236('0xf')](data));})[_0xc236('0x2e')](function(_0xc35ef9){console[_0xc236('0x4c')]('CREATE\x20ERROR',_0xc35ef9);});}function getEndUser(_0x359f21,_0x543aa8,_0x382a72,_0x3f1965,_0x21b7ff,_0x2bd744,_0x3cf9f8){var _0xcd341c={'method':_0xc236('0x33'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x359f21},'json':!![]};switch(_0x3cf9f8[_0xc236('0x4d')]){case'contact_lead':_0xcd341c[_0xc236('0x4e')]=_0xc236('0x41')+_0x543aa8+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x21b7ff+'))';return getZohoUser(_0xcd341c,_0xc236('0x4f'))[_0xc236('0x2c')](function(_0x3c1c5c){if(_0x3c1c5c)return _0x3c1c5c;_0xcd341c[_0xc236('0x4e')]=_0xc236('0x41')+_0x543aa8+_0xc236('0x50')+_0x21b7ff+'))';return getZohoUser(_0xcd341c,_0xc236('0x51'))['then'](function(_0x50dd50){if(_0x50dd50)return _0x50dd50;if(_0x3cf9f8[_0xc236('0x44')]!=_0xc236('0x52')){return createEndUser(_0x359f21,_0x543aa8,_0x3f1965,_0x21b7ff,_0x2bd744,_0x3cf9f8);}else{return{};}});});break;case'contact':_0xcd341c[_0xc236('0x4e')]=_0xc236('0x41')+_0x543aa8+_0xc236('0x53')+_0x21b7ff+'))';return getZohoUser(_0xcd341c,_0xc236('0x4f'))[_0xc236('0x2c')](function(_0x1683f4){if(_0x1683f4)return _0x1683f4;if(_0x3cf9f8[_0xc236('0x44')]!=_0xc236('0x52')){return createEndUser(_0x359f21,_0x543aa8,_0x3f1965,_0x21b7ff,_0x2bd744,_0x3cf9f8);}else{return{};}});break;case _0xc236('0x54'):_0xcd341c['uri']=_0xc236('0x41')+_0x543aa8+_0xc236('0x50')+_0x21b7ff+'))';return getZohoUser(_0xcd341c,_0xc236('0x51'))[_0xc236('0x2c')](function(_0x172e66){if(_0x172e66)return _0x172e66;if(_0x3cf9f8[_0xc236('0x44')]!=_0xc236('0x52')){return createEndUser(_0x359f21,_0x543aa8,_0x3f1965,_0x21b7ff,_0x2bd744,_0x3cf9f8);}else{return{};}});break;}}function getCall(_0x53724f,_0x18d7e1,_0x3788ff,_0x17c86b,_0x16ff63,_0x4860d8,_0xa34c01,_0x3e6da6){logger[_0xc236('0x31')](_0xc236('0x55'));var _0x9d81c8={};_0x9d81c8['Owner']={'name':!_[_0xc236('0x1d')](_0x17c86b['role'][_0xc236('0x19')])&&!_[_0xc236('0x1d')](_0x17c86b[_0xc236('0x3a')][_0xc236('0x19')])&&_0x17c86b[_0xc236('0x3a')]['name']==='administrator'?_0x17c86b[_0xc236('0x45')][_0xc236('0x19')]:!_[_0xc236('0x1d')](_0x17c86b[_0xc236('0x46')])?_0x17c86b[_0xc236('0x46')]+'\x20'+_0x17c86b[_0xc236('0x47')]:_0x17c86b[_0xc236('0x47')],'id':_0x17c86b['id']};_0x9d81c8[_0xc236('0x56')]=intUtil[_0xc236('0x57')](_0x4860d8[_0xc236('0x58')],_0xa34c01,'\x20');_0x9d81c8['Description']=intUtil['getString'](_0x4860d8[_0xc236('0x59')],_0xa34c01,'\x0a');if(_0x16ff63[_0xc236('0x40')]===_0xc236('0x4f')){_0x9d81c8[_0xc236('0x5a')]={'name':!_['isNil'](_0x16ff63[_0xc236('0x5b')])?_0x16ff63[_0xc236('0x5b')]:!_['isNil'](_0x16ff63[_0xc236('0x5c')])?_0x16ff63[_0xc236('0x5c')]+'\x20'+_0x16ff63[_0xc236('0x5d')]:_0x16ff63[_0xc236('0x5d')],'id':_0x16ff63['id']};}if(_0x16ff63['enduserType']===_0xc236('0x51')){_0x9d81c8[_0xc236('0x5e')]={'name':!_[_0xc236('0x1d')](_0x16ff63[_0xc236('0x5b')])?_0x16ff63[_0xc236('0x5b')]:!_[_0xc236('0x1d')](_0x16ff63[_0xc236('0x5c')])?_0x16ff63['First_Name']+'\x20'+_0x16ff63[_0xc236('0x5d')]:_0x16ff63['Last_Name'],'id':_0x16ff63['id']};_0x9d81c8[_0xc236('0x5f')]=_[_0xc236('0x43')](_0x16ff63[_0xc236('0x40')]);}if(_0xa34c01[_0xc236('0x60')]){_0x9d81c8['Call_Duration']=moment[_0xc236('0x61')](parseInt(_0xa34c01[_0xc236('0x60')])*0x3e8)[_0xc236('0x62')]('mm:ss');}else if(_0xa34c01[_0xc236('0x63')]&&_0xa34c01[_0xc236('0x64')]){_0x9d81c8[_0xc236('0x65')]=moment[_0xc236('0x61')](moment(_0xa34c01[_0xc236('0x64')],_0xc236('0x66'))['diff'](moment(_0xa34c01['starttime'],_0xc236('0x66'))))[_0xc236('0x62')](_0xc236('0x67'));}switch(_0xa34c01[_0xc236('0x68')]){case _0xc236('0x69'):_0x9d81c8[_0xc236('0x6a')]=_0xc236('0x6b');break;case'complete':case'connect':_0x9d81c8['Call_Result']=_0xc236('0x6c');break;case _0xc236('0x6d'):_0x9d81c8[_0xc236('0x6a')]=_0xc236('0x6e');break;case'abandoned':_0x9d81c8['Call_Result']='Abandoned';break;case'timeout':_0x9d81c8[_0xc236('0x6a')]='Timeout';default:}_0x9d81c8[_0xc236('0x6f')]=(_0x3e6da6==='outbound'?moment(_0xa34c01[_0xc236('0x70')])[_0xc236('0x62')](_0xc236('0x66')):moment(_0xa34c01[_0xc236('0x71')])[_0xc236('0x62')](_0xc236('0x66')))||moment()[_0xc236('0x62')]('YYYY-MM-DDTHH:mm:ss');_0x9d81c8[_0xc236('0x72')]=_0x3e6da6||'Inbound';_0x9d81c8=_[_0xc236('0x73')](_0x9d81c8,getCustomFields(_0x4860d8[_0xc236('0x74')],_0xa34c01));return request({'method':_0xc236('0x27'),'uri':_0xc236('0x41')+_0x18d7e1+_0xc236('0x75'),'headers':{'Authorization':_0xc236('0x48')+_0x53724f},'body':{'data':[_0x9d81c8]},'json':!![]})['then'](function(_0x17113a){if(_0x17113a&&_0x17113a[_0xc236('0x3f')][0x0]['code']===_0xc236('0x76')){logger[_0xc236('0x31')](_0xc236('0x77'));return{'id':_0x17113a['data'][0x0][_0xc236('0x4a')]['id']};}})[_0xc236('0x2e')](function(_0x5897a1){logger[_0xc236('0x31')](_0xc236('0x78'),_0x5897a1[_0xc236('0x30')]);console[_0xc236('0x4c')](_0xc236('0x78'),_0x5897a1);});}exports[_0xc236('0x79')]=function(_0x26b8a8,_0x2e7a06,_0x3de937,_0x5d627d,_0x35922d,_0x2b9fd8){var _0x205e26,_0x5d395b,_0x44f9bf;_0x2b9fd8[_0xc236('0x7a')]=intUtil[_0xc236('0x7b')](_0x2b9fd8[_0xc236('0x7a')]);_0x2b9fd8['serverUrl']=intUtil[_0xc236('0x7b')](_0x2b9fd8['serverUrl']);if(_0x35922d&&_0x35922d[_0xc236('0x7c')]){logger['info'](_0xc236('0x7d'),_0xc236('0x7e'));_0x2e7a06['recordingURL']=_0x2b9fd8['serverUrl']+'/api/voice/recordings/'+_0x2e7a06[_0xc236('0x7f')]+'/downloads?type=uniqueid&token='+md5(_0x2e7a06[_0xc236('0x7f')]);}else{_0x2e7a06[_0xc236('0x80')]='';}var _0x4be322=_0x2b9fd8[_0xc236('0x7a')]===_0xc236('0x81')?'eu':'com';return getAccessToken(_0x2b9fd8)[_0xc236('0x2c')](function(_0x2181aa){_0x44f9bf=_0x2181aa;return getUser(_0x44f9bf,_0x4be322,_0x2b9fd8,_0x5d627d[_0xc236('0x37')]);})[_0xc236('0x2c')](function(_0x511858){_0x205e26=_0x511858;logger[_0xc236('0x31')](_0xc236('0x82'),_0x205e26['id']);return getEndUser(_0x44f9bf,_0x4be322,_0x2b9fd8,_0x2e7a06[_0xc236('0x83')],_0x2e7a06[_0xc236('0x84')],_0x205e26,_0x3de937);})[_0xc236('0x2c')](function(_0x8b7651){_0x5d395b=_0x8b7651;return getCall(_0x44f9bf,_0x4be322,_0x2b9fd8,_0x205e26,_0x5d395b,_0x3de937,_0x2e7a06,_0xc236('0x85'));})['then'](function(_0x5b720c){if(_0x5b720c){logger[_0xc236('0x31')](_0xc236('0x86'),_0x5b720c['id']);logger[_0xc236('0x31')](_0xc236('0x7d'),_0xc236('0x87'));emit(util[_0xc236('0x62')](_0xc236('0x88'),_0x5d627d[_0xc236('0x19')]),'trigger:browser:url',{'uri':'https://crm.'+_0x2b9fd8[_0xc236('0x7a')]+'/crm/EntityInfo.do?module=Calls&id='+_0x5b720c['id']});}})[_0xc236('0x2e')](function(_0x1c4835){logger[_0xc236('0x2f')]('[QUEUE]',JSON[_0xc236('0xf')](_0x1c4835));});};exports['outbound']=function(_0x239f37,_0x411559,_0x39be39,_0x3766a9,_0x48cf03,_0x41c76d,_0x22b942){var _0x59c80f,_0x41478d,_0x237209;_0x41c76d[_0xc236('0x7a')]=intUtil[_0xc236('0x7b')](_0x41c76d[_0xc236('0x7a')]);_0x41c76d[_0xc236('0x89')]=intUtil[_0xc236('0x7b')](_0x41c76d['serverUrl']);if(_0x22b942&&_0x22b942[_0xc236('0x8a')]&&_0x22b942[_0xc236('0x8a')]!==_0xc236('0x8b')){logger[_0xc236('0x31')]('[OUTBOUND]',_0xc236('0x7e'));_0x411559[_0xc236('0x80')]=_0x41c76d['serverUrl']+_0xc236('0x8c')+_0x411559['uniqueid']+_0xc236('0x8d')+md5(_0x411559[_0xc236('0x7f')]);}var _0x5e6274=_0x41c76d[_0xc236('0x7a')]===_0xc236('0x81')?'eu':'com';return getAccessToken(_0x41c76d)['then'](function(_0x2a9308){_0x237209=_0x2a9308;return getUser(_0x237209,_0x5e6274,_0x41c76d,_0x3766a9[_0xc236('0x37')]);})[_0xc236('0x2c')](function(_0x4b2050){_0x59c80f=_0x4b2050;logger[_0xc236('0x31')](_0xc236('0x82'),_0x59c80f['id']);return getEndUser(_0x237209,_0x5e6274,_0x41c76d,_0x411559['destcalleridname'],_0x411559[_0xc236('0x8e')],_0x59c80f,_0x39be39);})[_0xc236('0x2c')](function(_0x413d88){_0x41478d=_0x413d88;return getCall(_0x237209,_0x5e6274,_0x41c76d,_0x59c80f,_0x41478d,_0x39be39,_0x411559,_0xc236('0x8f'));})['then'](function(_0x149eeb){if(_0x149eeb){logger[_0xc236('0x31')](_0xc236('0x86'),_0x149eeb['id']);logger[_0xc236('0x31')](_0xc236('0x90'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xc236('0x88'),_0x3766a9['name']),_0xc236('0x91'),{'uri':_0xc236('0x92')+_0x41c76d[_0xc236('0x7a')]+_0xc236('0x93')+_0x149eeb['id']});}})['catch'](function(_0x94aac2){logger['error'](_0xc236('0x90'),JSON['stringify'](_0x94aac2));});};exports[_0xc236('0x94')]=function(_0x400353,_0x3ede1c,_0x461341,_0x21a24b,_0x3f4feb,_0x45cc00){var _0x1c9f87,_0x21da06,_0x577ace;_0x45cc00['host']=intUtil[_0xc236('0x7b')](_0x45cc00[_0xc236('0x7a')]);_0x45cc00[_0xc236('0x89')]=intUtil[_0xc236('0x7b')](_0x45cc00[_0xc236('0x89')]);if(_0x3f4feb&&_0x3f4feb[_0xc236('0x7c')]){logger['info']('['+_0x3ede1c[_0xc236('0x68')][_0xc236('0x95')]()+']',_0xc236('0x7e'));_0x3ede1c[_0xc236('0x80')]=_0x45cc00[_0xc236('0x89')]+_0xc236('0x8c')+_0x3ede1c[_0xc236('0x7f')]+_0xc236('0x8d')+md5(_0x3ede1c[_0xc236('0x7f')]);}else{_0x3ede1c[_0xc236('0x80')]='';}var _0x44652e=_0x45cc00[_0xc236('0x7a')]===_0xc236('0x81')?'eu':_0xc236('0x96');return getAccessToken(_0x45cc00)[_0xc236('0x2c')](function(_0x486a2a){_0x577ace=_0x486a2a;return getUser(_0x577ace,_0x44652e,_0x45cc00);})[_0xc236('0x2c')](function(_0x767d7b){_0x1c9f87=_0x767d7b;logger[_0xc236('0x31')](_0xc236('0x82'),_0x1c9f87['id']);return getEndUser(_0x577ace,_0x44652e,_0x45cc00,_0x3ede1c[_0xc236('0x83')],_0x3ede1c['calleridnum'],_0x1c9f87,_0x461341);})[_0xc236('0x2c')](function(_0x7bbb2c){_0x21da06=_0x7bbb2c;return getCall(_0x577ace,_0x44652e,_0x45cc00,_0x1c9f87,_0x21da06,_0x461341,_0x3ede1c,_0xc236('0x85'));})['then'](function(_0x42633c){if(_0x42633c){logger['info']('The\x20Call\x20ID\x20is:',_0x42633c['id']);}})[_0xc236('0x2e')](function(_0x436845){logger[_0xc236('0x2f')]('['+_0x3ede1c[_0xc236('0x68')][_0xc236('0x95')]()+']',JSON['stringify'](_0x436845));});}; \ 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 5ac02d7..33dbee8 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 _0x7a54=['mustache','trigger','exec','data2','Script','data3','%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'];(function(_0x78412,_0x292a18){var _0x30b86e=function(_0x57fe0a){while(--_0x57fe0a){_0x78412['push'](_0x78412['shift']());}};_0x30b86e(++_0x292a18);}(_0x7a54,0x106));var _0x47a5=function(_0x65dced,_0x79e633){_0x65dced=_0x65dced-0x0;var _0x60cb74=_0x7a54[_0x65dced];return _0x60cb74;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file +var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%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'];(function(_0x37aa33,_0x1cbb62){var _0x1f142e=function(_0x1e199d){while(--_0x1e199d){_0x37aa33['push'](_0x37aa33['shift']());}};_0x1f142e(++_0x1cbb62);}(_0x7a54,0x106));var _0x47a5=function(_0x1189e8,_0x19fbcb){_0x1189e8=_0x1189e8-0x0;var _0x180f36=_0x7a54[_0x1189e8];return _0x180f36;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ 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 fd715b4..60fa278 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 _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%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'];(function(_0x5622d5,_0x37d717){var _0x4c6c7f=function(_0x59d4a2){while(--_0x59d4a2){_0x5622d5['push'](_0x5622d5['shift']());}};_0x4c6c7f(++_0x37d717);}(_0x5f2f,0x73));var _0xf5f2=function(_0x124049,_0xb888a8){_0x124049=_0x124049-0x0;var _0x464b44=_0x5f2f[_0x124049];return _0x464b44;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%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'];(function(_0x12266c,_0x3dd371){var _0x524b4f=function(_0x1c3816){while(--_0x1c3816){_0x12266c['push'](_0x12266c['shift']());}};_0x524b4f(++_0x3dd371);}(_0x5f2f,0x73));var _0xf5f2=function(_0x328073,_0x27e5b5){_0x328073=_0x328073-0x0;var _0x5cacac=_0x5f2f[_0x328073];return _0x5cacac;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 222c333..c8b84ee 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 _0xcabc=['routing','client','http','request','then','debug','rpc','error','message','result','exports','bluebird','../../config/logger'];(function(_0x5cf783,_0x5af095){var _0x4cd30f=function(_0x32e2bc){while(--_0x32e2bc){_0x5cf783['push'](_0x5cf783['shift']());}};_0x4cd30f(++_0x5af095);}(_0xcabc,0x16a));var _0xccab=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xcabc[_0x5d6456];return _0x4d66c1;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xccab('0x0'));var logger=require(_0xccab('0x1'))(_0xccab('0x2'));var client=jayson[_0xccab('0x3')][_0xccab('0x4')]({'port':0x2329});client['Request']=function(_0x2b1e99,_0x38a3af){return new BPromise(function(_0x59a105,_0x391c81){return client[_0xccab('0x5')](_0x2b1e99,_0x38a3af)[_0xccab('0x6')](function(_0x492d75){logger[_0xccab('0x7')](_0xccab('0x8'),_0xccab('0x2'),_0x2b1e99,_0x38a3af,_0x492d75);if(_0x492d75['error']){logger[_0xccab('0x9')](_0xccab('0x8'),'routing',_0x2b1e99,_0x492d75[_0xccab('0x9')][_0xccab('0xa')],_0x38a3af);return _0x391c81(_0x492d75[_0xccab('0x9')][_0xccab('0xa')]);}else{return _0x59a105(_0x492d75[_0xccab('0xb')]);}})['catch'](function(_0x557654){logger[_0xccab('0x9')](_0xccab('0x8'),_0xccab('0x2'),_0x2b1e99,_0x557654,_0x38a3af);return _0x391c81(_0x557654);});});};module[_0xccab('0xc')]=client; \ No newline at end of file +var _0x6bdc=['../../config/logger','routing','client','http','Request','request','then','debug','rpc','error','result','exports','jayson/promise','bluebird'];(function(_0x56967a,_0x57ebf7){var _0x28e8df=function(_0x467dd4){while(--_0x467dd4){_0x56967a['push'](_0x56967a['shift']());}};_0x28e8df(++_0x57ebf7);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x126d51,_0x462dca){_0x126d51=_0x126d51-0x0;var _0x1b9535=_0x6bdc[_0x126d51];return _0x1b9535;};'use strict';var jayson=require(_0xc6bd('0x0'));var BPromise=require(_0xc6bd('0x1'));var logger=require(_0xc6bd('0x2'))(_0xc6bd('0x3'));var client=jayson[_0xc6bd('0x4')][_0xc6bd('0x5')]({'port':0x2329});client[_0xc6bd('0x6')]=function(_0x529c4b,_0x1bb923){return new BPromise(function(_0xd0f13,_0x580a26){return client[_0xc6bd('0x7')](_0x529c4b,_0x1bb923)[_0xc6bd('0x8')](function(_0x158271){logger[_0xc6bd('0x9')](_0xc6bd('0xa'),_0xc6bd('0x3'),_0x529c4b,_0x1bb923,_0x158271);if(_0x158271['error']){logger[_0xc6bd('0xb')](_0xc6bd('0xa'),_0xc6bd('0x3'),_0x529c4b,_0x158271['error']['message'],_0x1bb923);return _0x580a26(_0x158271[_0xc6bd('0xb')]['message']);}else{return _0xd0f13(_0x158271[_0xc6bd('0xc')]);}})['catch'](function(_0x3150d8){logger[_0xc6bd('0xb')](_0xc6bd('0xa'),_0xc6bd('0x3'),_0x529c4b,_0x3150d8,_0x1bb923);return _0x580a26(_0x3150d8);});});};module[_0xc6bd('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index a6abf79..2cb6d88 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 _0x0a52=['findOne','loginMailFrequency','catch','log','bluebird','./server','./lib/email','./rpc/mailAccount','../../mysqldb','then','getMailAccounts','initMailAccounts','refresh','Setting'];(function(_0x533a07,_0x212274){var _0x3d299d=function(_0x5d0e1d){while(--_0x5d0e1d){_0x533a07['push'](_0x533a07['shift']());}};_0x3d299d(++_0x212274);}(_0x0a52,0xe4));var _0x20a5=function(_0x2d9f91,_0x390e31){_0x2d9f91=_0x2d9f91-0x0;var _0x4e777f=_0x0a52[_0x2d9f91];return _0x4e777f;};'use strict';var BPromise=require(_0x20a5('0x0'));var server=require(_0x20a5('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0x20a5('0x2'));var mailAccount=require(_0x20a5('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x20a5('0x4'))['db'];function initRealtime(){return BPromise['resolve']()[_0x20a5('0x5')](mailAccount[_0x20a5('0x6')]())[_0x20a5('0x5')](realtime[_0x20a5('0x7')]())[_0x20a5('0x5')](function(){email[_0x20a5('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0x20a5('0x5')](function(_0x1f44fd){return initRealtime();})['then'](function(_0x37196c){return db[_0x20a5('0x9')][_0x20a5('0xa')]({'attributes':['id',_0x20a5('0xb')],'raw':!![]});})['then'](function(_0x10f589){return setInterval(initRealtime,_0x10f589[_0x20a5('0xb')]*0x3e8);})[_0x20a5('0xc')](function(_0x759b14){console[_0x20a5('0xd')](_0x759b14);});}main(); \ No newline at end of file +var _0xea1c=['initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','log','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','then','getMailAccounts'];(function(_0x423b03,_0x37d5d7){var _0x35ece9=function(_0x84ce7e){while(--_0x84ce7e){_0x423b03['push'](_0x423b03['shift']());}};_0x35ece9(++_0x37d5d7);}(_0xea1c,0x117));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0xcea1('0x0'));var EmailChannel=require(_0xcea1('0x1'));var mailAccount=require(_0xcea1('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xcea1('0x3'))['db'];function initRealtime(){return BPromise['resolve']()[_0xcea1('0x4')](mailAccount[_0xcea1('0x5')]())[_0xcea1('0x4')](realtime[_0xcea1('0x6')]())[_0xcea1('0x4')](function(){email[_0xcea1('0x7')](realtime[_0xcea1('0x8')]);return realtime;});}function main(){return server[_0xcea1('0x9')](realtime,email)[_0xcea1('0x4')](function(_0x1441c6){return initRealtime();})[_0xcea1('0x4')](function(_0x49554b){return db[_0xcea1('0xa')][_0xcea1('0xb')]({'attributes':['id',_0xcea1('0xc')],'raw':!![]});})['then'](function(_0x4613d4){return setInterval(initRealtime,_0x4613d4[_0xcea1('0xc')]*0x3e8);})[_0xcea1('0xd')](function(_0x4097ed){console[_0xcea1('0xe')](_0x4097ed);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index e984ccc..a8eda38 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 _0x14b5=['refresh','hasOwnProperty','box','handleImapBox','bind','error','isNil','disabled','messageStatus','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','send','verifySmtp','Smtp','catch','verify','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','total','md5'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14b5,0x158));var _0x514b=function(_0x2d863b,_0x15df5d){_0x2d863b=_0x2d863b-0x0;var _0x42fc23=_0x14b5[_0x2d863b];return _0x42fc23;};'use strict';var _=require(_0x514b('0x0'));var moment=require(_0x514b('0x1'));var BPromise=require(_0x514b('0x2'));var md5=require('md5');var Redis=require(_0x514b('0x3'));var config=require(_0x514b('0x4'));var logger=require(_0x514b('0x5'))(_0x514b('0x6'));config[_0x514b('0x7')]=_[_0x514b('0x8')](config[_0x514b('0x7')],{'host':_0x514b('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x514b('0x7')]));var EmailImap=require(_0x514b('0xa'));var EmailSmtp=require(_0x514b('0xb'));var mailAccount=require(_0x514b('0xc'));var md5Accounts={};function EmailChannel(_0x4f890f){logger[_0x514b('0xd')](_0x514b('0xe'));this[_0x514b('0xf')]=_0x4f890f['mailAccounts'];this[_0x514b('0x10')]={};this[_0x514b('0x11')]=new EmailSmtp();}EmailChannel[_0x514b('0x12')][_0x514b('0x13')]=function(_0x23e581){var _0x2b3d73=this[_0x514b('0xf')][_0x23e581];var _0x52340c={'id':_0x2b3d73['id'],'name':_0x2b3d73[_0x514b('0x14')],'key':_0x2b3d73[_0x514b('0x15')],'active':_0x2b3d73[_0x514b('0x16')],'Imap':{'status':_0x2b3d73[_0x514b('0x17')][_0x514b('0x18')],'messageStatus':_0x2b3d73[_0x514b('0x17')]['messageStatus'],'total':_0x2b3d73['Imap'][_0x514b('0x19')]}};if(_['isNil'](md5Accounts[_0x23e581])){md5Accounts[_0x23e581]={};}var _0x24672b=md5(JSON['stringify'](_0x52340c));if(md5Accounts[_0x23e581][_0x514b('0x1a')]!==_0x24672b){md5Accounts[_0x23e581][_0x514b('0x1a')]=_0x24672b;io[_0x514b('0x13')]('mailAccount:update',_0x52340c);}};EmailChannel['prototype'][_0x514b('0x1b')]=function(_0x31da86){for(var _0x26aa3a in _0x31da86){if(_0x31da86[_0x514b('0x1c')](_0x26aa3a)){if(_0x31da86[_0x26aa3a]['Imap']&&_0x31da86[_0x26aa3a][_0x514b('0x16')]){var _0x1bf1ea=_0x31da86[_0x26aa3a]['Imap'];if(!this[_0x514b('0x10')][_0x514b('0x1c')](_0x1bf1ea['id'])){this[_0x514b('0x10')][_0x1bf1ea['id']]=new EmailImap(_0x1bf1ea,_0x31da86[_0x26aa3a]['email']);this[_0x514b('0x10')][_0x1bf1ea['id']]['on'](_0x514b('0x1d'),this[_0x514b('0x1e')][_0x514b('0x1f')](this,_0x26aa3a));this['imapAccounts'][_0x1bf1ea['id']]['on'](_0x514b('0x6'),this['handleImapEmail'][_0x514b('0x1f')](this,_0x26aa3a));this['imapAccounts'][_0x1bf1ea['id']]['on']('end',this['handleImapEnd'][_0x514b('0x1f')](this,_0x26aa3a));this[_0x514b('0x10')][_0x1bf1ea['id']]['on'](_0x514b('0x20'),this['handleImapError'][_0x514b('0x1f')](this,_0x26aa3a));}}else{if(_[_0x514b('0x21')](this[_0x514b('0xf')][_0x26aa3a][_0x514b('0x17')])){this[_0x514b('0xf')][_0x26aa3a][_0x514b('0x17')]={};}this[_0x514b('0xf')][_0x26aa3a][_0x514b('0x17')][_0x514b('0x18')]=_0x514b('0x22');this[_0x514b('0xf')][_0x26aa3a]['Imap'][_0x514b('0x23')]='';this[_0x514b('0x13')](_0x26aa3a);}}}};EmailChannel[_0x514b('0x12')]['handleImapBox']=function(_0x4999d1,_0x18e7b3){if(this[_0x514b('0xf')][_0x4999d1]){this['mailAccounts'][_0x4999d1][_0x514b('0x17')][_0x514b('0x18')]=_0x514b('0x24');this[_0x514b('0xf')][_0x4999d1][_0x514b('0x17')]['messageStatus']=_0x18e7b3[_0x514b('0x14')];if(_0x18e7b3[_0x514b('0x25')]){this['mailAccounts'][_0x4999d1][_0x514b('0x17')][_0x514b('0x19')]=_0x18e7b3[_0x514b('0x25')]['total'];}return this['emit'](_0x4999d1);}};EmailChannel['prototype']['handleImapEmail']=function(_0x40e614,_0x30ecae){logger[_0x514b('0xd')](_0x514b('0x26'),_0x30ecae[_0x514b('0x27')],_0x30ecae['lastName'],_0x30ecae[_0x514b('0x28')],_0x40e614);if(this[_0x514b('0xf')][_0x40e614]){return mailAccount[_0x514b('0x29')](_0x40e614,_0x30ecae)[_0x514b('0x2a')](function(_0x4a0c5b){if(_0x4a0c5b){logger[_0x514b('0xd')](_0x514b('0x2b'));}})['catch'](function(_0x20abf5){logger[_0x514b('0x20')](_0x514b('0x2c'),JSON[_0x514b('0x2d')](_0x20abf5));});}};EmailChannel[_0x514b('0x12')]['handleImapEnd']=function(_0x488aa1){if(this[_0x514b('0xf')][_0x488aa1]&&this[_0x514b('0xf')][_0x488aa1][_0x514b('0x17')]){if(this[_0x514b('0x10')][this[_0x514b('0xf')][_0x488aa1][_0x514b('0x17')]['id']]){delete this['imapAccounts'][this[_0x514b('0xf')][_0x488aa1][_0x514b('0x17')]['id']];}this[_0x514b('0xf')][_0x488aa1][_0x514b('0x17')][_0x514b('0x2e')]=moment();this[_0x514b('0x13')](_0x488aa1);}};EmailChannel['prototype']['handleImapError']=function(_0x91bc3a,_0x492bf7){if(this[_0x514b('0xf')][_0x91bc3a]){this['mailAccounts'][_0x91bc3a][_0x514b('0x17')][_0x514b('0x18')]='error';this[_0x514b('0xf')][_0x91bc3a]['Imap'][_0x514b('0x23')]=_0x492bf7;return this[_0x514b('0x13')](_0x91bc3a);}};EmailChannel[_0x514b('0x12')]['sendMail']=function(_0x120dd8,_0x47819a){return this[_0x514b('0x11')][_0x514b('0x2f')](_0x120dd8,_0x47819a);};EmailChannel['prototype'][_0x514b('0x30')]=function(_0x3d4a55){var _0x145f91=this;if(this[_0x514b('0xf')][_0x3d4a55['id']]){if(_[_0x514b('0x21')](this[_0x514b('0xf')][_0x3d4a55['id']][_0x514b('0x31')])){this[_0x514b('0xf')][_0x3d4a55['id']][_0x514b('0x31')]={};}this[_0x514b('0xf')][_0x3d4a55['id']][_0x514b('0x31')][_0x514b('0x2e')]=moment();return new BPromise(function(_0x2585ec,_0xb981ed){return _0x145f91[_0x514b('0x11')]['verify'](_0x3d4a55)['then'](function(_0x470396){_0x145f91['mailAccounts'][_0x3d4a55['id']][_0x514b('0x31')][_0x514b('0x18')]='verified';_0x145f91[_0x514b('0xf')][_0x3d4a55['id']]['Smtp']['messageStatus']='';_0x145f91['emit'](_0x3d4a55['id']);_0x2585ec(_0x470396);})[_0x514b('0x32')](function(_0x5bde5b){_0x145f91[_0x514b('0xf')][_0x3d4a55['id']][_0x514b('0x31')]['status']=_0x514b('0x20');_0x145f91[_0x514b('0xf')][_0x3d4a55['id']][_0x514b('0x31')][_0x514b('0x23')]=_0x5bde5b;_0x145f91[_0x514b('0x13')](_0x3d4a55['id']);_0xb981ed(_0x5bde5b);});});}return this[_0x514b('0x11')][_0x514b('0x33')](_0x3d4a55);};module[_0x514b('0x34')]=EmailChannel; \ No newline at end of file +var _0x309e=['stringify','mailAccount:update','refresh','hasOwnProperty','active','imapAccounts','handleImapBox','bind','end','handleImapEnd','error','handleImapError','disabled','messageStatus','connected','messages','total','handleImapEmail','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','smtp','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','socket.io-emitter','./smtp','info','mailAccounts','prototype','emit','name','key','Imap','status','isNil'];(function(_0x5bc27a,_0x32e2d1){var _0x2c8a4d=function(_0x1a7dd9){while(--_0x1a7dd9){_0x5bc27a['push'](_0x5bc27a['shift']());}};_0x2c8a4d(++_0x32e2d1);}(_0x309e,0x8c));var _0xe309=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x309e[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0xe309('0x0'));var moment=require(_0xe309('0x1'));var BPromise=require('bluebird');var md5=require(_0xe309('0x2'));var Redis=require(_0xe309('0x3'));var config=require(_0xe309('0x4'));var logger=require(_0xe309('0x5'))(_0xe309('0x6'));config[_0xe309('0x7')]=_['defaults'](config[_0xe309('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xe309('0x8'))(new Redis(config[_0xe309('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xe309('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x1e3c2f){logger[_0xe309('0xa')]('start\x20email\x20channel');this[_0xe309('0xb')]=_0x1e3c2f[_0xe309('0xb')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0xe309('0xc')][_0xe309('0xd')]=function(_0x3d0fa3){var _0x3960b3=this[_0xe309('0xb')][_0x3d0fa3];var _0x152296={'id':_0x3960b3['id'],'name':_0x3960b3[_0xe309('0xe')],'key':_0x3960b3[_0xe309('0xf')],'active':_0x3960b3['active'],'Imap':{'status':_0x3960b3[_0xe309('0x10')][_0xe309('0x11')],'messageStatus':_0x3960b3[_0xe309('0x10')]['messageStatus'],'total':_0x3960b3[_0xe309('0x10')]['total']}};if(_[_0xe309('0x12')](md5Accounts[_0x3d0fa3])){md5Accounts[_0x3d0fa3]={};}var _0xf61ce7=md5(JSON[_0xe309('0x13')](_0x152296));if(md5Accounts[_0x3d0fa3][_0xe309('0x2')]!==_0xf61ce7){md5Accounts[_0x3d0fa3][_0xe309('0x2')]=_0xf61ce7;io[_0xe309('0xd')](_0xe309('0x14'),_0x152296);}};EmailChannel[_0xe309('0xc')][_0xe309('0x15')]=function(_0x496b2e){for(var _0x36077c in _0x496b2e){if(_0x496b2e[_0xe309('0x16')](_0x36077c)){if(_0x496b2e[_0x36077c][_0xe309('0x10')]&&_0x496b2e[_0x36077c][_0xe309('0x17')]){var _0x60c9a4=_0x496b2e[_0x36077c][_0xe309('0x10')];if(!this[_0xe309('0x18')]['hasOwnProperty'](_0x60c9a4['id'])){this[_0xe309('0x18')][_0x60c9a4['id']]=new EmailImap(_0x60c9a4,_0x496b2e[_0x36077c]['email']);this[_0xe309('0x18')][_0x60c9a4['id']]['on']('box',this[_0xe309('0x19')][_0xe309('0x1a')](this,_0x36077c));this['imapAccounts'][_0x60c9a4['id']]['on'](_0xe309('0x6'),this['handleImapEmail']['bind'](this,_0x36077c));this[_0xe309('0x18')][_0x60c9a4['id']]['on'](_0xe309('0x1b'),this[_0xe309('0x1c')][_0xe309('0x1a')](this,_0x36077c));this[_0xe309('0x18')][_0x60c9a4['id']]['on'](_0xe309('0x1d'),this[_0xe309('0x1e')]['bind'](this,_0x36077c));}}else{if(_[_0xe309('0x12')](this['mailAccounts'][_0x36077c][_0xe309('0x10')])){this[_0xe309('0xb')][_0x36077c]['Imap']={};}this['mailAccounts'][_0x36077c][_0xe309('0x10')][_0xe309('0x11')]=_0xe309('0x1f');this['mailAccounts'][_0x36077c][_0xe309('0x10')][_0xe309('0x20')]='';this[_0xe309('0xd')](_0x36077c);}}}};EmailChannel[_0xe309('0xc')]['handleImapBox']=function(_0x3ba77b,_0x203a26){if(this['mailAccounts'][_0x3ba77b]){this['mailAccounts'][_0x3ba77b][_0xe309('0x10')][_0xe309('0x11')]=_0xe309('0x21');this[_0xe309('0xb')][_0x3ba77b][_0xe309('0x10')][_0xe309('0x20')]=_0x203a26['name'];if(_0x203a26[_0xe309('0x22')]){this[_0xe309('0xb')][_0x3ba77b][_0xe309('0x10')][_0xe309('0x23')]=_0x203a26[_0xe309('0x22')][_0xe309('0x23')];}return this[_0xe309('0xd')](_0x3ba77b);}};EmailChannel[_0xe309('0xc')][_0xe309('0x24')]=function(_0x55abcf,_0x48d637){logger[_0xe309('0xa')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x48d637[_0xe309('0x25')],_0x48d637[_0xe309('0x26')],_0x48d637[_0xe309('0x27')],_0x55abcf);if(this[_0xe309('0xb')][_0x55abcf]){return mailAccount['notify'](_0x55abcf,_0x48d637)[_0xe309('0x28')](function(_0xe85e00){if(_0xe85e00){logger[_0xe309('0xa')](_0xe309('0x29'));}})[_0xe309('0x2a')](function(_0x47d046){logger[_0xe309('0x1d')](_0xe309('0x2b'),JSON['stringify'](_0x47d046));});}};EmailChannel[_0xe309('0xc')]['handleImapEnd']=function(_0x5383cc){if(this['mailAccounts'][_0x5383cc]&&this[_0xe309('0xb')][_0x5383cc][_0xe309('0x10')]){if(this[_0xe309('0x18')][this['mailAccounts'][_0x5383cc][_0xe309('0x10')]['id']]){delete this[_0xe309('0x18')][this['mailAccounts'][_0x5383cc]['Imap']['id']];}this[_0xe309('0xb')][_0x5383cc][_0xe309('0x10')][_0xe309('0x2c')]=moment();this['emit'](_0x5383cc);}};EmailChannel[_0xe309('0xc')][_0xe309('0x1e')]=function(_0x47b34e,_0x102ba3){if(this[_0xe309('0xb')][_0x47b34e]){this[_0xe309('0xb')][_0x47b34e][_0xe309('0x10')][_0xe309('0x11')]=_0xe309('0x1d');this['mailAccounts'][_0x47b34e][_0xe309('0x10')][_0xe309('0x20')]=_0x102ba3;return this['emit'](_0x47b34e);}};EmailChannel[_0xe309('0xc')][_0xe309('0x2d')]=function(_0x24db38,_0x4e21f7){return this[_0xe309('0x2e')][_0xe309('0x2f')](_0x24db38,_0x4e21f7);};EmailChannel[_0xe309('0xc')][_0xe309('0x30')]=function(_0x15b5b8){var _0x35c09e=this;if(this[_0xe309('0xb')][_0x15b5b8['id']]){if(_[_0xe309('0x12')](this[_0xe309('0xb')][_0x15b5b8['id']]['Smtp'])){this[_0xe309('0xb')][_0x15b5b8['id']][_0xe309('0x31')]={};}this[_0xe309('0xb')][_0x15b5b8['id']][_0xe309('0x31')][_0xe309('0x2c')]=moment();return new BPromise(function(_0x24e098,_0x5f3df3){return _0x35c09e[_0xe309('0x2e')][_0xe309('0x32')](_0x15b5b8)[_0xe309('0x28')](function(_0x2030cb){_0x35c09e['mailAccounts'][_0x15b5b8['id']][_0xe309('0x31')][_0xe309('0x11')]=_0xe309('0x33');_0x35c09e[_0xe309('0xb')][_0x15b5b8['id']]['Smtp'][_0xe309('0x20')]='';_0x35c09e[_0xe309('0xd')](_0x15b5b8['id']);_0x24e098(_0x2030cb);})[_0xe309('0x2a')](function(_0x4d3c4c){_0x35c09e['mailAccounts'][_0x15b5b8['id']][_0xe309('0x31')][_0xe309('0x11')]=_0xe309('0x1d');_0x35c09e[_0xe309('0xb')][_0x15b5b8['id']][_0xe309('0x31')][_0xe309('0x20')]=_0x4d3c4c;_0x35c09e[_0xe309('0xd')](_0x15b5b8['id']);_0x5f3df3(_0x4d3c4c);});});}return this[_0xe309('0x2e')][_0xe309('0x32')](_0x15b5b8);};module[_0xe309('0x34')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index b18fd28..c1aba77 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 _0x19e7=['handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','lodash','mailparser','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','account','once','ready','bind','end','handleEnd','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','required','getHost','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody'];(function(_0x260253,_0x3caf25){var _0x5ba551=function(_0x300d2b){while(--_0x300d2b){_0x260253['push'](_0x260253['shift']());}};_0x5ba551(++_0x3caf25);}(_0x19e7,0xcd));var _0x719e=function(_0x393115,_0x2fe4f1){_0x393115=_0x393115-0x0;var _0x46adfa=_0x19e7[_0x393115];return _0x46adfa;};'use strict';var fs=require('fs');var path=require(_0x719e('0x0'));var util=require(_0x719e('0x1'));var Imap=require(_0x719e('0x2'));var _=require(_0x719e('0x3'));var rs=require('randomstring');var simpleParser=require(_0x719e('0x4'))[_0x719e('0x5')];var Iconv=require(_0x719e('0x6'))[_0x719e('0x7')];var EventEmitter=require(_0x719e('0x8'))['EventEmitter'];var utils=require(_0x719e('0x9'));var logger=require(_0x719e('0xa'))(_0x719e('0xb'));function EmailImap(_0xdb373e,_0x54b861){this[_0x719e('0xc')]=_0x719e('0xd');this['account']=this[_0x719e('0xe')](_0xdb373e,_0x54b861);this[_0x719e('0x2')]=new Imap(this[_0x719e('0xf')]);this['imap'][_0x719e('0x10')](_0x719e('0x11'),this['handleReady'][_0x719e('0x12')](this));this['imap'][_0x719e('0x10')](_0x719e('0x13'),this[_0x719e('0x14')][_0x719e('0x12')](this));this[_0x719e('0x2')]['on']('error',this[_0x719e('0x15')]['bind'](this));this[_0x719e('0x2')][_0x719e('0x16')]();}util[_0x719e('0x17')](EmailImap,EventEmitter);EmailImap[_0x719e('0x18')][_0x719e('0xe')]=function(_0x45ca6c,_0x30d787){var _0x4abb6d={'connTimeout':_0x45ca6c[_0x719e('0x19')]?_0x45ca6c['connTimeout']*0x3e8:0x2710,'authTimeout':_0x45ca6c[_0x719e('0x1a')]?_0x45ca6c[_0x719e('0x1a')]*0x3e8:0x1388};if(_[_0x719e('0x1b')](_0x45ca6c[_0x719e('0x1c')])){if(_0x45ca6c[_0x719e('0x1d')]){_0x4abb6d['user']=_0x45ca6c[_0x719e('0x1e')];_0x4abb6d[_0x719e('0x1f')]=_0x45ca6c['password'];}_0x4abb6d[_0x719e('0x20')]=_0x45ca6c[_0x719e('0x20')];_0x4abb6d[_0x719e('0x21')]=_0x45ca6c[_0x719e('0x21')]||0x3e1;if(_0x45ca6c[_0x719e('0x22')]){_0x4abb6d[_0x719e('0x22')]=!![];}else{_0x4abb6d[_0x719e('0x22')]=![];_0x4abb6d['autotls']=_0x719e('0x23');}}else{_0x4abb6d[_0x719e('0x1e')]=_0x45ca6c[_0x719e('0x1e')];_0x4abb6d['password']=_0x45ca6c[_0x719e('0x1f')];_0x4abb6d[_0x719e('0x20')]=utils[_0x719e('0x24')](_0x45ca6c[_0x719e('0x1c')]);_0x4abb6d[_0x719e('0x21')]=0x3e1;_0x4abb6d[_0x719e('0x22')]=!![];}_0x4abb6d[_0x719e('0xb')]=_0x30d787||_0x45ca6c[_0x719e('0x1e')]||'anonymous@xcally.com';return _0x4abb6d;};EmailImap[_0x719e('0x18')]['handleReady']=function(){this[_0x719e('0x2')][_0x719e('0x25')](this[_0x719e('0xc')],![],this[_0x719e('0x26')]['bind'](this));};EmailImap[_0x719e('0x18')][_0x719e('0x26')]=function(_0x35dde4,_0x3487fb){if(_0x35dde4){this[_0x719e('0x15')](_0x35dde4,!![]);}else{this[_0x719e('0x27')](_0x719e('0x28'),_0x3487fb);this[_0x719e('0x29')]();}};EmailImap[_0x719e('0x18')][_0x719e('0x2a')]=function(_0x306acb){if(_0x306acb){this[_0x719e('0x15')](_0x306acb,!![]);}else{this['imap'][_0x719e('0x13')]();}};EmailImap['prototype'][_0x719e('0x29')]=function(){this['imap'][_0x719e('0x2b')]([_0x719e('0x2c')],this[_0x719e('0x2d')]['bind'](this));};EmailImap[_0x719e('0x18')][_0x719e('0x2d')]=function(_0x562b23,_0x6d81){if(_0x562b23){this[_0x719e('0x15')](_0x562b23,!![]);}else{if(_0x6d81[_0x719e('0x2e')]){try{var _0x555811=this[_0x719e('0x2')][_0x719e('0x2f')](_0x6d81,{'bodies':'','markSeen':!![]});_0x555811['on'](_0x719e('0x30'),this[_0x719e('0x31')][_0x719e('0x12')](this));_0x555811[_0x719e('0x10')](_0x719e('0x32'),this[_0x719e('0x33')][_0x719e('0x12')](this));_0x555811[_0x719e('0x10')](_0x719e('0x13'),this[_0x719e('0x34')][_0x719e('0x12')](this));}catch(_0x597573){logger[_0x719e('0x32')](_0x597573);}}else{this['imap'][_0x719e('0x35')](!![],this[_0x719e('0x2a')][_0x719e('0x12')](this));}}};EmailImap[_0x719e('0x18')][_0x719e('0x31')]=function(_0x12dc6b,_0x3a2acd){_0x12dc6b['on'](_0x719e('0x36'),this['handleMessageBody']['bind'](this));_0x12dc6b['once'](_0x719e('0x37'),this[_0x719e('0x38')][_0x719e('0x12')](this));_0x12dc6b[_0x719e('0x10')](_0x719e('0x13'),this[_0x719e('0x39')][_0x719e('0x12')](this));};EmailImap[_0x719e('0x18')][_0x719e('0x3a')]=function(_0x4ff1c8,_0x5df67d){simpleParser(_0x4ff1c8,{'Iconv':Iconv},this[_0x719e('0x3b')][_0x719e('0x12')](this));};EmailImap[_0x719e('0x18')][_0x719e('0x38')]=function(_0x5a5696){};EmailImap[_0x719e('0x18')][_0x719e('0x39')]=function(){};EmailImap[_0x719e('0x18')][_0x719e('0x3b')]=function(_0x11b33d,_0x5063b2){if(_0x11b33d){logger[_0x719e('0x32')](_0x11b33d);}else{var _0x689de2=this;utils[_0x719e('0x3c')](this[_0x719e('0xf')],_0x5063b2,function(_0x4f308e){_0x689de2[_0x719e('0x27')](_0x719e('0xb'),_0x4f308e);});}};EmailImap[_0x719e('0x18')][_0x719e('0x34')]=function(){this[_0x719e('0x2')][_0x719e('0x35')](!![],this[_0x719e('0x2a')][_0x719e('0x12')](this));};EmailImap[_0x719e('0x18')]['handleFetchError']=function(_0x316c79){this[_0x719e('0x15')](_0x316c79);this['imap'][_0x719e('0x35')](!![],this['handleCloseBox'][_0x719e('0x12')](this));};EmailImap['prototype'][_0x719e('0x14')]=function(){this['emit'](_0x719e('0x13'));};EmailImap['prototype'][_0x719e('0x15')]=function(_0x35488a,_0x177ec6){logger['error'](_0x719e('0x15'),this[_0x719e('0xf')][_0x719e('0xb')],JSON[_0x719e('0x3d')](_0x35488a));var _0x513bbd='';if(_0x35488a){if(_0x35488a['textCode']){_0x513bbd=_0x35488a[_0x719e('0x3e')];}else{for(var _0x362278 in _0x35488a){if(_0x35488a[_0x719e('0x3f')](_0x362278)){_0x513bbd+=_[_0x719e('0x40')](_0x362278)+':\x20'+_0x35488a[_0x362278]+'\x0a';}}}}if(_0x177ec6){this[_0x719e('0x2')][_0x719e('0x13')]();}else{this[_0x719e('0x27')]('error',_0x513bbd);this[_0x719e('0x27')](_0x719e('0x13'));}};module[_0x719e('0x41')]=EmailImap; \ No newline at end of file +var _0x98c7=['once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','authTimeout','service','user','password','host','port','autotls','getHost','tls','anonymous@xcally.com','openBox','mailbox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','randomstring','mailparser','iconv','events','EventEmitter','./utils','email','INBOX','account','getAccount'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x98c7,0x129));var _0x798c=function(_0x3dee92,_0x55e1eb){_0x3dee92=_0x3dee92-0x0;var _0x44d36e=_0x98c7[_0x3dee92];return _0x44d36e;};'use strict';var fs=require('fs');var path=require(_0x798c('0x0'));var util=require(_0x798c('0x1'));var Imap=require(_0x798c('0x2'));var _=require('lodash');var rs=require(_0x798c('0x3'));var simpleParser=require(_0x798c('0x4'))['simpleParser'];var Iconv=require(_0x798c('0x5'))['Iconv'];var EventEmitter=require(_0x798c('0x6'))[_0x798c('0x7')];var utils=require(_0x798c('0x8'));var logger=require('../../../config/logger')(_0x798c('0x9'));function EmailImap(_0x1067bd,_0x9d09b){this['mailbox']=_0x798c('0xa');this[_0x798c('0xb')]=this[_0x798c('0xc')](_0x1067bd,_0x9d09b);this[_0x798c('0x2')]=new Imap(this['account']);this[_0x798c('0x2')][_0x798c('0xd')](_0x798c('0xe'),this[_0x798c('0xf')][_0x798c('0x10')](this));this['imap'][_0x798c('0xd')](_0x798c('0x11'),this[_0x798c('0x12')][_0x798c('0x10')](this));this['imap']['on'](_0x798c('0x13'),this[_0x798c('0x14')][_0x798c('0x10')](this));this[_0x798c('0x2')][_0x798c('0x15')]();}util[_0x798c('0x16')](EmailImap,EventEmitter);EmailImap[_0x798c('0x17')][_0x798c('0xc')]=function(_0x30696c,_0x5e926a){var _0x2addfa={'connTimeout':_0x30696c['connTimeout']?_0x30696c['connTimeout']*0x3e8:0x2710,'authTimeout':_0x30696c[_0x798c('0x18')]?_0x30696c[_0x798c('0x18')]*0x3e8:0x1388};if(_['isNil'](_0x30696c[_0x798c('0x19')])){if(_0x30696c['authentication']){_0x2addfa[_0x798c('0x1a')]=_0x30696c[_0x798c('0x1a')];_0x2addfa[_0x798c('0x1b')]=_0x30696c[_0x798c('0x1b')];}_0x2addfa[_0x798c('0x1c')]=_0x30696c['host'];_0x2addfa[_0x798c('0x1d')]=_0x30696c[_0x798c('0x1d')]||0x3e1;if(_0x30696c['tls']){_0x2addfa['tls']=!![];}else{_0x2addfa['tls']=![];_0x2addfa[_0x798c('0x1e')]='required';}}else{_0x2addfa[_0x798c('0x1a')]=_0x30696c[_0x798c('0x1a')];_0x2addfa[_0x798c('0x1b')]=_0x30696c[_0x798c('0x1b')];_0x2addfa[_0x798c('0x1c')]=utils[_0x798c('0x1f')](_0x30696c[_0x798c('0x19')]);_0x2addfa[_0x798c('0x1d')]=0x3e1;_0x2addfa[_0x798c('0x20')]=!![];}_0x2addfa[_0x798c('0x9')]=_0x5e926a||_0x30696c[_0x798c('0x1a')]||_0x798c('0x21');return _0x2addfa;};EmailImap[_0x798c('0x17')][_0x798c('0xf')]=function(){this['imap'][_0x798c('0x22')](this[_0x798c('0x23')],![],this[_0x798c('0x24')][_0x798c('0x10')](this));};EmailImap[_0x798c('0x17')][_0x798c('0x24')]=function(_0x18cb9b,_0x27c266){if(_0x18cb9b){this[_0x798c('0x14')](_0x18cb9b,!![]);}else{this[_0x798c('0x25')](_0x798c('0x26'),_0x27c266);this[_0x798c('0x27')]();}};EmailImap[_0x798c('0x17')]['handleCloseBox']=function(_0x4ed92b){if(_0x4ed92b){this[_0x798c('0x14')](_0x4ed92b,!![]);}else{this[_0x798c('0x2')][_0x798c('0x11')]();}};EmailImap[_0x798c('0x17')][_0x798c('0x27')]=function(){this['imap'][_0x798c('0x28')]([_0x798c('0x29')],this['handleReadUnseen'][_0x798c('0x10')](this));};EmailImap[_0x798c('0x17')][_0x798c('0x2a')]=function(_0x333e36,_0x106174){if(_0x333e36){this['handleError'](_0x333e36,!![]);}else{if(_0x106174[_0x798c('0x2b')]){try{var _0x21a52b=this[_0x798c('0x2')][_0x798c('0x2c')](_0x106174,{'bodies':'','markSeen':!![]});_0x21a52b['on']('message',this[_0x798c('0x2d')][_0x798c('0x10')](this));_0x21a52b[_0x798c('0xd')](_0x798c('0x13'),this[_0x798c('0x2e')][_0x798c('0x10')](this));_0x21a52b[_0x798c('0xd')](_0x798c('0x11'),this['handleFetchEnd']['bind'](this));}catch(_0x12860a){logger[_0x798c('0x13')](_0x12860a);}}else{this[_0x798c('0x2')][_0x798c('0x2f')](!![],this[_0x798c('0x30')][_0x798c('0x10')](this));}}};EmailImap[_0x798c('0x17')]['handleFetchMessage']=function(_0x1426c4,_0x2019b9){_0x1426c4['on'](_0x798c('0x31'),this[_0x798c('0x32')][_0x798c('0x10')](this));_0x1426c4['once'](_0x798c('0x33'),this[_0x798c('0x34')][_0x798c('0x10')](this));_0x1426c4[_0x798c('0xd')](_0x798c('0x11'),this[_0x798c('0x35')][_0x798c('0x10')](this));};EmailImap['prototype'][_0x798c('0x32')]=function(_0x4b84d2,_0x3874d7){simpleParser(_0x4b84d2,{'Iconv':Iconv},this['handleSimpleParser'][_0x798c('0x10')](this));};EmailImap['prototype'][_0x798c('0x34')]=function(_0x309253){};EmailImap[_0x798c('0x17')][_0x798c('0x35')]=function(){};EmailImap[_0x798c('0x17')][_0x798c('0x36')]=function(_0x10fc7d,_0x234d07){if(_0x10fc7d){logger[_0x798c('0x13')](_0x10fc7d);}else{var _0x1cc987=this;utils[_0x798c('0x37')](this['account'],_0x234d07,function(_0x5e1a06){_0x1cc987[_0x798c('0x25')]('email',_0x5e1a06);});}};EmailImap[_0x798c('0x17')][_0x798c('0x38')]=function(){this['imap']['closeBox'](!![],this['handleCloseBox'][_0x798c('0x10')](this));};EmailImap[_0x798c('0x17')][_0x798c('0x2e')]=function(_0x19acfd){this[_0x798c('0x14')](_0x19acfd);this['imap']['closeBox'](!![],this['handleCloseBox'][_0x798c('0x10')](this));};EmailImap[_0x798c('0x17')]['handleEnd']=function(){this[_0x798c('0x25')](_0x798c('0x11'));};EmailImap[_0x798c('0x17')][_0x798c('0x14')]=function(_0x18c8ff,_0x1cd275){logger['error'](_0x798c('0x14'),this[_0x798c('0xb')]['email'],JSON[_0x798c('0x39')](_0x18c8ff));var _0x47e0a1='';if(_0x18c8ff){if(_0x18c8ff[_0x798c('0x3a')]){_0x47e0a1=_0x18c8ff[_0x798c('0x3a')];}else{for(var _0x348c3f in _0x18c8ff){if(_0x18c8ff[_0x798c('0x3b')](_0x348c3f)){_0x47e0a1+=_[_0x798c('0x3c')](_0x348c3f)+':\x20'+_0x18c8ff[_0x348c3f]+'\x0a';}}}}if(_0x1cd275){this[_0x798c('0x2')][_0x798c('0x11')]();}else{this['emit'](_0x798c('0x13'),_0x47e0a1);this[_0x798c('0x25')](_0x798c('0x11'));}};module[_0x798c('0x3d')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index df91b44..1f3d545 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 _0x1373=['send','createTransport','toString','Not\x20verifired','exports','bluebird','nodemailer-plugin-inline-base64','prototype'];(function(_0x56a27a,_0x18a327){var _0x420171=function(_0x2c3959){while(--_0x2c3959){_0x56a27a['push'](_0x56a27a['shift']());}};_0x420171(++_0x18a327);}(_0x1373,0x9d));var _0x3137=function(_0x24ee86,_0x33ad9d){_0x24ee86=_0x24ee86-0x0;var _0x107331=_0x1373[_0x24ee86];return _0x107331;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x3137('0x0'));var inlineBase64=require(_0x3137('0x1'));function EmailSmtp(){}EmailSmtp[_0x3137('0x2')][_0x3137('0x3')]=function(_0x58a9d4,_0x5c43bc){return new BPromise(function(_0x1d4b4b,_0x54607f){var _0x4d0073=nodemailer[_0x3137('0x4')](_0x58a9d4);_0x4d0073['use']('compile',inlineBase64());_0x4d0073['sendMail'](_0x5c43bc,function(_0xfde6f6,_0x2fc90){if(_0xfde6f6){_0x54607f(_0xfde6f6[_0x3137('0x5')]());}else{_0x1d4b4b(_0x2fc90);}});});};EmailSmtp['prototype']['verify']=function(_0x22e7d4){return new BPromise(function(_0x3cfde0,_0x53cd4d){var _0x514ed0=nodemailer['createTransport'](_0x22e7d4);_0x514ed0['verify'](function(_0x2975bb,_0x456255){if(_0x2975bb){_0x53cd4d(_0x2975bb[_0x3137('0x5')]());}else{if(_0x456255){_0x3cfde0(_0x456255);}else{_0x53cd4d(_0x3137('0x6'));}}});});};module[_0x3137('0x7')]=EmailSmtp; \ No newline at end of file +var _0xd164=['nodemailer','bluebird','nodemailer-plugin-inline-base64','use','compile','sendMail','toString','prototype','verify','Not\x20verifired'];(function(_0x16bfde,_0x2e0333){var _0x4f01f8=function(_0x28fb71){while(--_0x28fb71){_0x16bfde['push'](_0x16bfde['shift']());}};_0x4f01f8(++_0x2e0333);}(_0xd164,0x172));var _0x4d16=function(_0x1e6c58,_0x19678d){_0x1e6c58=_0x1e6c58-0x0;var _0x48a7f7=_0xd164[_0x1e6c58];return _0x48a7f7;};'use strict';var nodemailer=require(_0x4d16('0x0'));var BPromise=require(_0x4d16('0x1'));var inlineBase64=require(_0x4d16('0x2'));function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x52dd9a,_0x4a8c71){return new BPromise(function(_0x1cb167,_0x192aba){var _0x5ee896=nodemailer['createTransport'](_0x52dd9a);_0x5ee896[_0x4d16('0x3')](_0x4d16('0x4'),inlineBase64());_0x5ee896[_0x4d16('0x5')](_0x4a8c71,function(_0x258451,_0x1d7ae9){if(_0x258451){_0x192aba(_0x258451[_0x4d16('0x6')]());}else{_0x1cb167(_0x1d7ae9);}});});};EmailSmtp[_0x4d16('0x7')][_0x4d16('0x8')]=function(_0x180064){return new BPromise(function(_0x4c2ca6,_0x37ae4d){var _0xbebfad=nodemailer['createTransport'](_0x180064);_0xbebfad['verify'](function(_0x257f77,_0xc2d767){if(_0x257f77){_0x37ae4d(_0x257f77['toString']());}else{if(_0xc2d767){_0x4c2ca6(_0xc2d767);}else{_0x37ae4d(_0x4d16('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 0f637d9..65385db 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 _0xae2f=['bcc','attach','type','attachment','attachment-','now','writeFileSync','contentType','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','content','Attachments','Title','Data','getHost','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','split','length','join','Anonymous','pop','html','replace','\x20[Attachment:\x20','\x20]','body','textAsHtml','isEmpty','message','originCc','originTo'];(function(_0x18d5d7,_0x19074b){var _0x30a9ea=function(_0x514f3f){while(--_0x514f3f){_0x18d5d7['push'](_0x18d5d7['shift']());}};_0x30a9ea(++_0x19074b);}(_0xae2f,0xb0));var _0xfae2=function(_0x15bbf1,_0x40ef96){_0x15bbf1=_0x15bbf1-0x0;var _0x5c4b47=_0xae2f[_0x15bbf1];return _0x5c4b47;};'use strict';var _=require(_0xfae2('0x0'));var moment=require('moment');var random=require(_0xfae2('0x1'));var fs=require('fs');var path=require(_0xfae2('0x2'));var util=require(_0xfae2('0x3'));var tnef=require(_0xfae2('0x4'));var logger=require(_0xfae2('0x5'))(_0xfae2('0x6'));var config=require(_0xfae2('0x7'));function getAddress(_0x4f5162){var _0x446cfc=_['head'](_0x4f5162[_0xfae2('0x8')]);return _0x446cfc&&_0x446cfc[_0xfae2('0x9')]?_0x446cfc[_0xfae2('0x9')]:_0xfae2('0xa')+random[_0xfae2('0xb')](0x6)+_0xfae2('0xc');}function getFirstName(_0x13aa1b){var _0x4fdcc6=_[_0xfae2('0xd')](_0x13aa1b['value']);if(_0x4fdcc6&&_0x4fdcc6['name']){var _0x455b6a=_0x4fdcc6[_0xfae2('0xe')][_0xfae2('0xf')](/\s+/);return _0x455b6a[_0xfae2('0x10')]?_0x455b6a['slice'](0x0,-0x1)[_0xfae2('0x11')]('\x20'):_0x4fdcc6[_0xfae2('0xe')];}return _0xfae2('0x12');}function getLastName(_0x172eca){var _0xb68cfd=_[_0xfae2('0xd')](_0x172eca[_0xfae2('0x8')]);if(_0xb68cfd&&_0xb68cfd[_0xfae2('0xe')]){var _0x59a280=_0xb68cfd[_0xfae2('0xe')]['split'](/\s+/);return _0x59a280[_0xfae2('0x10')]>0x1?_0x59a280[_0xfae2('0x13')]():'';}return'';}function getMails(_0x4ade58,_0x4b5dc4){var _0x5e8ad5='';for(var _0xcb97e3=0x0;_0xcb97e3<_0x4b5dc4[_0xfae2('0x8')][_0xfae2('0x10')];_0xcb97e3+=0x1){if(_0x4b5dc4[_0xfae2('0x8')][_0xcb97e3][_0xfae2('0x9')]!==_0x4ade58){if(!_['isEmpty'](_0x5e8ad5)){_0x5e8ad5+=',';}_0x5e8ad5+=_0x4b5dc4[_0xfae2('0x8')][_0xcb97e3][_0xfae2('0xe')]||_0x4b5dc4['value'][_0xcb97e3]['address']||'';_0x5e8ad5+='\x20<';_0x5e8ad5+=_0x4b5dc4[_0xfae2('0x8')][_0xcb97e3]['address']?_0x4b5dc4[_0xfae2('0x8')][_0xcb97e3][_0xfae2('0x9')]:_0xfae2('0xa')+random[_0xfae2('0xb')](0x6)+_0xfae2('0xc');_0x5e8ad5+='>';}}return _0x5e8ad5;}function parseEmail(_0x3dfbb7,_0x3485df,_0x5a9fdf){if(_0x3485df[_0xfae2('0x14')]){var _0x12de5a=/)<[^<]*)*<\/script>/gi;while(_0x12de5a['test'](_0x3485df['html'])){_0x3485df[_0xfae2('0x14')]=_0x3485df['html'][_0xfae2('0x15')](_0x12de5a,'');}if(_0x3485df['html']['includes'](_0xfae2('0x16'))){var _0x4ddbb1=[];_0x3485df[_0xfae2('0x17')][_0xfae2('0x18')](_0x4ae322=>{_0x4ddbb1[_0xfae2('0x19')](_0x4ae322[_0xfae2('0x1a')]);});var _0xc96ae8=/]+>/g;var _0x4d108d=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x27634c=_0x3485df['html'][_0xfae2('0x15')](_0x4d108d,_0xfae2('0x1b'));var _0x195ca0=_0x27634c[_0xfae2('0x15')](_0xc96ae8,_0xfae2('0x1c'));for(let _0x51896b=0x0;_0x51896b<_0x4ddbb1[_0xfae2('0x10')];_0x51896b++){var _0x3282cf=_0x195ca0[_0xfae2('0x15')](_0xfae2('0x1c'),_0xfae2('0x1d')+_0x4ddbb1[_0x51896b]+_0xfae2('0x1e'));_0x195ca0=_0x3282cf;}_0x3485df[_0xfae2('0x14')]=_0x195ca0;}_0x5a9fdf['body']=_0x3485df[_0xfae2('0x14')];}else{_0x5a9fdf[_0xfae2('0x1f')]=_0x3485df[_0xfae2('0x20')];}if(_0x5a9fdf[_0xfae2('0x1f')]){_0x5a9fdf[_0xfae2('0x1f')]=_0x5a9fdf[_0xfae2('0x1f')]['replace'](/Empty\x20message

';if(_0x503051[_0xfae2('0x3b')]){for(var _0x4ae7d0=0x0;_0x4ae7d0<_0x503051[_0xfae2('0x3b')]['length'];_0x4ae7d0++){var _0xd60563=_0x503051[_0xfae2('0x3b')][_0x4ae7d0];_0x2aab5e[_0xfae2('0x22')][_0xfae2('0x17')][_0xfae2('0x19')]({'filename':_0xd60563[_0xfae2('0x3c')],'content':new Buffer(_0xd60563[_0xfae2('0x3d')])});}}}_0x28444a(parseEmail(_0x23b953,_0x31e8b4,_0x2aab5e));});}else{_0x31e8b4[_0xfae2('0x14')]='

Empty\x20message

';_0x28444a(parseEmail(_0x23b953,_0x31e8b4,_0x2aab5e));}}else{_0x28444a(parseEmail(_0x23b953,_0x31e8b4,_0x2aab5e));}};exports[_0xfae2('0x3e')]=function(_0x3ec187){switch(_0x3ec187){case'gmail':return _0xfae2('0x3f');case _0xfae2('0x40'):return _0xfae2('0x41');case _0xfae2('0x42'):return _0xfae2('0x43');case _0xfae2('0x44'):return _0xfae2('0x45');}return _0xfae2('0x46');}; \ No newline at end of file +var _0x9b82=['address','anonymous','generate','@xcally.com','name','split','length','Anonymous','pop','isEmpty','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','0x1?_0x5dfd65[_0x29b8('0x13')]():'';}return'';}function getMails(_0x15c1f8,_0x1c5d23){var _0x164235='';for(var _0x199294=0x0;_0x199294<_0x1c5d23[_0x29b8('0xa')][_0x29b8('0x11')];_0x199294+=0x1){if(_0x1c5d23[_0x29b8('0xa')][_0x199294][_0x29b8('0xb')]!==_0x15c1f8){if(!_[_0x29b8('0x14')](_0x164235)){_0x164235+=',';}_0x164235+=_0x1c5d23[_0x29b8('0xa')][_0x199294]['name']||_0x1c5d23[_0x29b8('0xa')][_0x199294][_0x29b8('0xb')]||'';_0x164235+='\x20<';_0x164235+=_0x1c5d23[_0x29b8('0xa')][_0x199294][_0x29b8('0xb')]?_0x1c5d23[_0x29b8('0xa')][_0x199294][_0x29b8('0xb')]:_0x29b8('0xc')+random[_0x29b8('0xd')](0x6)+'@xcally.com';_0x164235+='>';}}return _0x164235;}function parseEmail(_0x5ba183,_0x16b10a,_0x1d7846){if(_0x16b10a[_0x29b8('0x15')]){var _0x128ad6=/)<[^<]*)*<\/script>/gi;while(_0x128ad6[_0x29b8('0x16')](_0x16b10a[_0x29b8('0x15')])){_0x16b10a[_0x29b8('0x15')]=_0x16b10a[_0x29b8('0x15')][_0x29b8('0x17')](_0x128ad6,'');}if(_0x16b10a[_0x29b8('0x15')][_0x29b8('0x18')](_0x29b8('0x19'))){var _0x541678=[];_0x16b10a[_0x29b8('0x1a')][_0x29b8('0x1b')](_0x1987c3=>{_0x541678[_0x29b8('0x1c')](_0x1987c3[_0x29b8('0x1d')]);});var _0x3012c6=/]+>/g;var _0x455d7f=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x4aadb6=_0x16b10a[_0x29b8('0x15')][_0x29b8('0x17')](_0x455d7f,_0x29b8('0x1e'));var _0x224884=_0x4aadb6['replace'](_0x3012c6,_0x29b8('0x1f'));for(let _0x48d07d=0x0;_0x48d07d<_0x541678[_0x29b8('0x11')];_0x48d07d++){var _0x4abca5=_0x224884[_0x29b8('0x17')](_0x29b8('0x1f'),_0x29b8('0x20')+_0x541678[_0x48d07d]+_0x29b8('0x21'));_0x224884=_0x4abca5;}_0x16b10a[_0x29b8('0x15')]=_0x224884;}_0x1d7846[_0x29b8('0x22')]=_0x16b10a[_0x29b8('0x15')];}else{_0x1d7846[_0x29b8('0x22')]=_0x16b10a['textAsHtml'];}if(_0x1d7846[_0x29b8('0x22')]){_0x1d7846['body']=_0x1d7846[_0x29b8('0x22')][_0x29b8('0x17')](/Empty\x20message

';if(_0x531921[_0x29b8('0x3f')]){for(var _0x46d3ab=0x0;_0x46d3ab<_0x531921[_0x29b8('0x3f')]['length'];_0x46d3ab++){var _0xa51069=_0x531921[_0x29b8('0x3f')][_0x46d3ab];_0x2fc2a5[_0x29b8('0x24')][_0x29b8('0x1a')][_0x29b8('0x1c')]({'filename':_0xa51069[_0x29b8('0x40')],'content':new Buffer(_0xa51069[_0x29b8('0x41')])});}}}_0x33756b(parseEmail(_0x3dbcc1,_0x19aa99,_0x2fc2a5));});}else{_0x19aa99[_0x29b8('0x15')]='

Empty\x20message

';_0x33756b(parseEmail(_0x3dbcc1,_0x19aa99,_0x2fc2a5));}}else{_0x33756b(parseEmail(_0x3dbcc1,_0x19aa99,_0x2fc2a5));}};exports['getHost']=function(_0x2e507d){switch(_0x2e507d){case'gmail':return _0x29b8('0x42');case _0x29b8('0x43'):return _0x29b8('0x44');case _0x29b8('0x45'):return _0x29b8('0x46');case'outlook365':return'outlook.office365.com';}return'127.0.0.1';}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 36ca3aa..d186005 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 _0x104e=['lodash','name','Service','key','Imap','Smtp'];(function(_0x1e355e,_0x170062){var _0x5e372d=function(_0x3f56c3){while(--_0x3f56c3){_0x1e355e['push'](_0x1e355e['shift']());}};_0x5e372d(++_0x170062);}(_0x104e,0x66));var _0xe104=function(_0x301dab,_0x38050a){_0x301dab=_0x301dab-0x0;var _0x2500a2=_0x104e[_0x301dab];return _0x2500a2;};'use strict';var _=require(_0xe104('0x0'));function MailAccount(_0x52181a){this['id']=_0x52181a['id']||0x0;this[_0xe104('0x1')]=_0x52181a['name']||_0xe104('0x2');this[_0xe104('0x3')]=_0x52181a[_0xe104('0x3')]||'SERV';this['active']=_0x52181a['active']||![];this[_0xe104('0x4')]=_0x52181a[_0xe104('0x4')]||[];this['Smtp']=_0x52181a[_0xe104('0x5')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x961f=['key','SERV','active','Imap','Smtp','exports','lodash','name','Service'];(function(_0x2a2e72,_0x1de962){var _0x3cfb4a=function(_0x3d435c){while(--_0x3d435c){_0x2a2e72['push'](_0x2a2e72['shift']());}};_0x3cfb4a(++_0x1de962);}(_0x961f,0x180));var _0xf961=function(_0x429370,_0x46ff4c){_0x429370=_0x429370-0x0;var _0x41a3ad=_0x961f[_0x429370];return _0x41a3ad;};'use strict';var _=require(_0xf961('0x0'));function MailAccount(_0x4e993a){this['id']=_0x4e993a['id']||0x0;this[_0xf961('0x1')]=_0x4e993a[_0xf961('0x1')]||_0xf961('0x2');this[_0xf961('0x3')]=_0x4e993a['key']||_0xf961('0x4');this['active']=_0x4e993a[_0xf961('0x5')]||![];this[_0xf961('0x6')]=_0x4e993a[_0xf961('0x6')]||[];this['Smtp']=_0x4e993a[_0xf961('0x7')]||[];}module[_0xf961('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 db1e370..57418d5 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 _0xf0e4=['lodash','../model/mailAccount','mailAccounts','prototype','initMailAccounts','isUndefined','merge','exports'];(function(_0x5d824a,_0x595c3d){var _0x37ee5f=function(_0xca1e){while(--_0xca1e){_0x5d824a['push'](_0x5d824a['shift']());}};_0x37ee5f(++_0x595c3d);}(_0xf0e4,0xe0));var _0x4f0e=function(_0x3f349c,_0x162b5d){_0x3f349c=_0x3f349c-0x0;var _0x5a623b=_0xf0e4[_0x3f349c];return _0x5a623b;};'use strict';var _=require(_0x4f0e('0x0'));var MailAccount=require(_0x4f0e('0x1'));var Realtime=function(){this[_0x4f0e('0x2')]={};};function freeIsNotKey(_0x14f5d8,_0x88051d,_0x44cb69){var _0x16d6ce=_['mapKeys'](_0x14f5d8,function(_0x5b2e9b,_0x1654b2){return _0x5b2e9b[_0x44cb69];});for(var _0x1109c3 in _0x88051d){if(_0x88051d['hasOwnProperty'](_0x1109c3)){if(!_0x16d6ce[_0x1109c3]){delete _0x88051d[_0x1109c3];}}}}Realtime[_0x4f0e('0x3')]['mergeFromDatabase']=function(_0x13df07,_0x240a1d){for(var _0x2ba753 in _0x240a1d){if(_0x13df07['hasOwnProperty'](_0x2ba753)){_0x13df07[_0x2ba753]=_0x240a1d[_0x2ba753];}}};Realtime[_0x4f0e('0x3')][_0x4f0e('0x4')]=function(){var _0x307f3d=this;return function(_0x4bc73f){if(_0x4bc73f){freeIsNotKey(_0x4bc73f,_0x307f3d[_0x4f0e('0x2')],'id');for(var _0x2ac346=0x0,_0x17f1c1={},_0x358c6b={};_0x2ac346<_0x4bc73f['length'];_0x2ac346+=0x1){_0x17f1c1=_0x4bc73f[_0x2ac346];if(_[_0x4f0e('0x5')](_0x307f3d['mailAccounts'][_0x17f1c1['id']])){_0x307f3d[_0x4f0e('0x2')][_0x17f1c1['id']]=new MailAccount(_0x17f1c1);}else{_[_0x4f0e('0x6')](_0x307f3d[_0x4f0e('0x2')][_0x17f1c1['id']],_0x17f1c1);}}}return _0x307f3d[_0x4f0e('0x2')];};};module[_0x4f0e('0x7')]=Realtime; \ No newline at end of file +var _0x0efc=['mergeFromDatabase','hasOwnProperty','prototype','length','isUndefined','merge','../model/mailAccount','mailAccounts'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x0efc,0x1ee));var _0xc0ef=function(_0x27d10a,_0x35ff44){_0x27d10a=_0x27d10a-0x0;var _0x63302e=_0x0efc[_0x27d10a];return _0x63302e;};'use strict';var _=require('lodash');var MailAccount=require(_0xc0ef('0x0'));var Realtime=function(){this[_0xc0ef('0x1')]={};};function freeIsNotKey(_0x348994,_0x3ffc80,_0x51c881){var _0x4cde0d=_['mapKeys'](_0x348994,function(_0x55b5c1,_0x58a84e){return _0x55b5c1[_0x51c881];});for(var _0x7e6b04 in _0x3ffc80){if(_0x3ffc80['hasOwnProperty'](_0x7e6b04)){if(!_0x4cde0d[_0x7e6b04]){delete _0x3ffc80[_0x7e6b04];}}}}Realtime['prototype'][_0xc0ef('0x2')]=function(_0x48f485,_0x3a1707){for(var _0x30dd5b in _0x3a1707){if(_0x48f485[_0xc0ef('0x3')](_0x30dd5b)){_0x48f485[_0x30dd5b]=_0x3a1707[_0x30dd5b];}}};Realtime[_0xc0ef('0x4')]['initMailAccounts']=function(){var _0x257170=this;return function(_0x279c48){if(_0x279c48){freeIsNotKey(_0x279c48,_0x257170[_0xc0ef('0x1')],'id');for(var _0x37fa20=0x0,_0x22df79={},_0x2229d2={};_0x37fa20<_0x279c48[_0xc0ef('0x5')];_0x37fa20+=0x1){_0x22df79=_0x279c48[_0x37fa20];if(_[_0xc0ef('0x6')](_0x257170[_0xc0ef('0x1')][_0x22df79['id']])){_0x257170['mailAccounts'][_0x22df79['id']]=new MailAccount(_0x22df79);}else{_[_0xc0ef('0x7')](_0x257170[_0xc0ef('0x1')][_0x22df79['id']],_0x22df79);}}}return _0x257170[_0xc0ef('0x1')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 216809c..20a5fa1 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 _0x0f4d=['GetMailAccount','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','Smtp','getMailAccount','NotifyMailAccount'];(function(_0x2a6cbe,_0x19ea08){var _0xbe2f4b=function(_0x58d4b3){while(--_0x58d4b3){_0x2a6cbe['push'](_0x2a6cbe['shift']());}};_0xbe2f4b(++_0x19ea08);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x5aaccc,_0x46b60c){_0x5aaccc=_0x5aaccc-0x0;var _0xf5bae3=_0x0f4d[_0x5aaccc];return _0xf5bae3;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client['Request'](_0xd0f4('0x0'),{'options':{'attributes':['id','name',_0xd0f4('0x1'),_0xd0f4('0x2'),_0xd0f4('0x3'),_0xd0f4('0x4'),_0xd0f4('0x5'),_0xd0f4('0x6')],'raw':![],'include':[{'model':_0xd0f4('0x7'),'as':_0xd0f4('0x8')},{'model':'MailServerOut','as':_0xd0f4('0x9')}]},'log':_0xd0f4('0xa')});};};exports['notify']=function(_0x3992be,_0x2a0057){return client['Request'](_0xd0f4('0xb'),{'account':{'id':_0x3992be},'body':_0x2a0057,'log':_0xd0f4('0xb')});}; \ No newline at end of file +var _0xaa37=['notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','service','email','active','key','ListId','TemplateId','MailServerIn','MailServerOut','Smtp'];(function(_0x5c40e8,_0x5a528f){var _0x13a16e=function(_0x4d48bc){while(--_0x4d48bc){_0x5c40e8['push'](_0x5c40e8['shift']());}};_0x13a16e(++_0x5a528f);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xaa37[_0x279d37];return _0x530173;};'use strict';var client=require(_0x7aa3('0x0'));exports[_0x7aa3('0x1')]=function(){return function(){return client[_0x7aa3('0x2')](_0x7aa3('0x3'),{'options':{'attributes':['id','name',_0x7aa3('0x4'),_0x7aa3('0x5'),_0x7aa3('0x6'),_0x7aa3('0x7'),_0x7aa3('0x8'),_0x7aa3('0x9')],'raw':![],'include':[{'model':_0x7aa3('0xa'),'as':'Imap'},{'model':_0x7aa3('0xb'),'as':_0x7aa3('0xc')}]},'log':'getMailAccount'});};};exports[_0x7aa3('0xd')]=function(_0x390c82,_0x394097){return client['Request'](_0x7aa3('0xe'),{'account':{'id':_0x390c82},'body':_0x394097,'log':_0x7aa3('0xe')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 7320697..ab9c67c 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 _0x9e62=['mailAccounts','Imap','password','Smtp','pass','length','server','stringify','127.0.0.1','log','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','../../../config/logger','email','listen','sendMail','account','message','catch','error','then','Verified','values'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9e62,0x182));var _0x29e6=function(_0x21ccfc,_0x48834e){_0x21ccfc=_0x21ccfc-0x0;var _0x279454=_0x9e62[_0x21ccfc];return _0x279454;};'use strict';var jayson=require(_0x29e6('0x0'));var BPromise=require(_0x29e6('0x1'));var _=require(_0x29e6('0x2'));var logger=require(_0x29e6('0x3'))(_0x29e6('0x4'));exports[_0x29e6('0x5')]=function(_0x2246ac,_0x2d0a62){return new BPromise(function(_0x1e03c3,_0x14cac7){var _0x3ceed9={'SendMail':function(_0x2da786){var _0x339521=this;return new Promise(function(_0x8ae1cf,_0x1a954f){_0x2d0a62[_0x29e6('0x6')](_0x2da786[_0x29e6('0x7')],_0x2da786[_0x29e6('0x8')])['then'](function(_0x354d55){_0x8ae1cf({'code':0xc8,'message':_0x354d55});})[_0x29e6('0x9')](function(_0x86f841){_0x1a954f(_0x339521[_0x29e6('0xa')](0x1f4,_0x86f841));});});},'VerifySmtp':function(_0x32072e){var _0x2c32c6=this;return new Promise(function(_0x41af10,_0x5ce5f7){_0x2d0a62['verifySmtp'](_0x32072e[_0x29e6('0x7')])[_0x29e6('0xb')](function(_0x354ca5){_0x41af10({'code':0xc8,'message':_0x29e6('0xc')});})[_0x29e6('0x9')](function(_0x68f237){_0x5ce5f7(_0x2c32c6[_0x29e6('0xa')](0x1f4,_0x68f237));});});},'MailAccounts':function(_0x3ba828){return new Promise(function(_0x4a4104,_0x18c870){var _0x266703=_[_0x29e6('0xd')](_0x2246ac[_0x29e6('0xe')]);for(var _0x4fead2=0x0;_0x4fead2<_0x266703['length'];_0x4fead2+=0x1){if(_0x266703[_0x4fead2]['Imap']&&_0x266703[_0x4fead2][_0x29e6('0xf')][_0x29e6('0x10')]){delete _0x266703[_0x4fead2]['Imap']['password'];}if(_0x266703[_0x4fead2][_0x29e6('0x11')]&&_0x266703[_0x4fead2][_0x29e6('0x11')][_0x29e6('0x12')]){delete _0x266703[_0x4fead2]['Smtp'][_0x29e6('0x12')];}}_0x4a4104({'count':_0x266703[_0x29e6('0x13')],'rows':_0x266703});});}};var _0x3edac3=jayson[_0x29e6('0x14')](_0x3ceed9)['http']();_0x3edac3['on']('error',function(_0x346dd0){logger['error'](JSON[_0x29e6('0x15')](_0x346dd0));return _0x14cac7(_0x346dd0);});_0x3edac3[_0x29e6('0x5')](0x232b,_0x29e6('0x16'),function(){console[_0x29e6('0x17')]('Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232b);return _0x1e03c3(_0x29e6('0x18')+0x232b);});});}; \ No newline at end of file +var _0x6b60=['Smtp','pass','http','stringify','listen','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','jayson/promise','bluebird','lodash','email','account','message','error','verifySmtp','then','Verified','catch','values','mailAccounts','length','Imap','password'];(function(_0x4296b3,_0x58c241){var _0x146ad8=function(_0x2e5079){while(--_0x2e5079){_0x4296b3['push'](_0x4296b3['shift']());}};_0x146ad8(++_0x58c241);}(_0x6b60,0x1ea));var _0x06b6=function(_0x2f54b6,_0x3cc6cb){_0x2f54b6=_0x2f54b6-0x0;var _0x169f21=_0x6b60[_0x2f54b6];return _0x169f21;};'use strict';var jayson=require(_0x06b6('0x0'));var BPromise=require(_0x06b6('0x1'));var _=require(_0x06b6('0x2'));var logger=require('../../../config/logger')(_0x06b6('0x3'));exports['listen']=function(_0x362d7b,_0x1f1f76){return new BPromise(function(_0x5c422f,_0x4902b4){var _0xaf86ac={'SendMail':function(_0x59c050){var _0xad6e92=this;return new Promise(function(_0xb51f46,_0x2617d2){_0x1f1f76['sendMail'](_0x59c050[_0x06b6('0x4')],_0x59c050[_0x06b6('0x5')])['then'](function(_0x187f8b){_0xb51f46({'code':0xc8,'message':_0x187f8b});})['catch'](function(_0x53f3c5){_0x2617d2(_0xad6e92[_0x06b6('0x6')](0x1f4,_0x53f3c5));});});},'VerifySmtp':function(_0x1f1f42){var _0xe68262=this;return new Promise(function(_0x4dd525,_0x1d57e1){_0x1f1f76[_0x06b6('0x7')](_0x1f1f42[_0x06b6('0x4')])[_0x06b6('0x8')](function(_0x5560f2){_0x4dd525({'code':0xc8,'message':_0x06b6('0x9')});})[_0x06b6('0xa')](function(_0x4a7db2){_0x1d57e1(_0xe68262[_0x06b6('0x6')](0x1f4,_0x4a7db2));});});},'MailAccounts':function(_0x483869){return new Promise(function(_0x1cf2fe,_0x4f64bb){var _0x1b5138=_[_0x06b6('0xb')](_0x362d7b[_0x06b6('0xc')]);for(var _0x3f8254=0x0;_0x3f8254<_0x1b5138[_0x06b6('0xd')];_0x3f8254+=0x1){if(_0x1b5138[_0x3f8254][_0x06b6('0xe')]&&_0x1b5138[_0x3f8254]['Imap'][_0x06b6('0xf')]){delete _0x1b5138[_0x3f8254][_0x06b6('0xe')]['password'];}if(_0x1b5138[_0x3f8254]['Smtp']&&_0x1b5138[_0x3f8254][_0x06b6('0x10')][_0x06b6('0x11')]){delete _0x1b5138[_0x3f8254][_0x06b6('0x10')]['pass'];}}_0x1cf2fe({'count':_0x1b5138[_0x06b6('0xd')],'rows':_0x1b5138});});}};var _0x17b275=jayson['server'](_0xaf86ac)[_0x06b6('0x12')]();_0x17b275['on'](_0x06b6('0x6'),function(_0x3e13d8){logger[_0x06b6('0x6')](JSON[_0x06b6('0x13')](_0x3e13d8));return _0x4902b4(_0x3e13d8);});_0x17b275[_0x06b6('0x14')](0x232b,'127.0.0.1',function(){console['log'](_0x06b6('0x15'),0x232b);return _0x5c422f('RPC\x20listening\x20on\x20port:'+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index a17338f..da192f9 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 _0x6ad4=['../../config/express','default','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','http','ioredis','createServer','timeout','socket.io','websocket','polling','redis','localhost','adapter','socket.io-redis','../../config/socketio'];(function(_0x5b853a,_0x349594){var _0x5d0621=function(_0x2b11a6){while(--_0x2b11a6){_0x5b853a['push'](_0x5b853a['shift']());}};_0x5d0621(++_0x349594);}(_0x6ad4,0x197));var _0x46ad=function(_0x2c4920,_0x30f3d7){_0x2c4920=_0x2c4920-0x0;var _0x7a18f3=_0x6ad4[_0x2c4920];return _0x7a18f3;};'use strict';var _=require(_0x46ad('0x0'));var http=require(_0x46ad('0x1'));var express=require('express');var sticky=require('sticky-session');var Redis=require(_0x46ad('0x2'));var config=require('../../config/environment');var app=express();var server=http[_0x46ad('0x3')](app);server[_0x46ad('0x4')]=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0x46ad('0x5'))(server,{'transports':[_0x46ad('0x6'),_0x46ad('0x7')]});config['redis']=_['defaults'](config[_0x46ad('0x8')],{'host':_0x46ad('0x9'),'port':0x18eb});socketio[_0x46ad('0xa')](require(_0x46ad('0xb'))({'pubClient':new Redis(config[_0x46ad('0x8')]),'subClient':new Redis(config[_0x46ad('0x8')])}));require('../../config/triggers')['default']();require(_0x46ad('0xc'))['default'](socketio);require(_0x46ad('0xd'))['default'](app);require('../../routes')[_0x46ad('0xe')](app);}else{server[_0x46ad('0xf')]('listening',function(){console[_0x46ad('0x10')](_0x46ad('0x11'),config[_0x46ad('0x12')]);});}exports=module[_0x46ad('0x13')]=app; \ No newline at end of file +var _0xec6b=['Express\x20server\x20listening\x20on\x20port\x20%d!','exports','express','sticky-session','../../config/environment','createServer','listen','port','socket.io','websocket','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xec6b,0x1bb));var _0xbec6=function(_0x75e300,_0x190b9f){_0x75e300=_0x75e300-0x0;var _0x23dd88=_0xec6b[_0x75e300];return _0x23dd88;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0xbec6('0x0'));var sticky=require(_0xbec6('0x1'));var Redis=require('ioredis');var config=require(_0xbec6('0x2'));var app=express();var server=http[_0xbec6('0x3')](app);server['timeout']=0xdbba0;if(sticky[_0xbec6('0x4')](server,config[_0xbec6('0x5')])){var socketio=require(_0xbec6('0x6'))(server,{'transports':[_0xbec6('0x7'),'polling']});config[_0xbec6('0x8')]=_['defaults'](config[_0xbec6('0x8')],{'host':_0xbec6('0x9'),'port':0x18eb});socketio[_0xbec6('0xa')](require(_0xbec6('0xb'))({'pubClient':new Redis(config[_0xbec6('0x8')]),'subClient':new Redis(config[_0xbec6('0x8')])}));require(_0xbec6('0xc'))[_0xbec6('0xd')]();require(_0xbec6('0xe'))[_0xbec6('0xd')](socketio);require(_0xbec6('0xf'))[_0xbec6('0xd')](app);require(_0xbec6('0x10'))[_0xbec6('0xd')](app);}else{server[_0xbec6('0x11')](_0xbec6('0x12'),function(){console['log'](_0xbec6('0x13'),config[_0xbec6('0x5')]);});}exports=module[_0xbec6('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 79d11c0..73e6bc0 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 _0x1c88=['rpc','error','message','catch','exports','jayson/promise','../../config/logger','routing','client','request','then','debug'];(function(_0xaf49d5,_0x48c4bf){var _0x28467d=function(_0x3dcd8a){while(--_0x3dcd8a){_0xaf49d5['push'](_0xaf49d5['shift']());}};_0x28467d(++_0x48c4bf);}(_0x1c88,0x1a9));var _0x81c8=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0x1c88[_0x34d346];return _0x122d76;};'use strict';var jayson=require(_0x81c8('0x0'));var BPromise=require('bluebird');var logger=require(_0x81c8('0x1'))(_0x81c8('0x2'));var client=jayson[_0x81c8('0x3')]['http']({'port':0x2329});client['Request']=function(_0x2bf7b0,_0x4049a1){return new BPromise(function(_0x5dbe5,_0x1cd685){return client[_0x81c8('0x4')](_0x2bf7b0,_0x4049a1)[_0x81c8('0x5')](function(_0x3f4e27){logger[_0x81c8('0x6')](_0x81c8('0x7'),_0x81c8('0x2'),_0x2bf7b0,_0x4049a1,_0x3f4e27);if(_0x3f4e27[_0x81c8('0x8')]){logger[_0x81c8('0x8')](_0x81c8('0x7'),'routing',_0x2bf7b0,_0x3f4e27[_0x81c8('0x8')][_0x81c8('0x9')],_0x4049a1);return _0x1cd685(_0x3f4e27[_0x81c8('0x8')]['message']);}else{return _0x5dbe5(_0x3f4e27['result']);}})[_0x81c8('0xa')](function(_0x401156){logger[_0x81c8('0x8')]('rpc',_0x81c8('0x2'),_0x2bf7b0,_0x401156,_0x4049a1);return _0x1cd685(_0x401156);});});};module[_0x81c8('0xb')]=client; \ No newline at end of file +var _0xc569=['request','then','debug','routing','error','rpc','message','result','exports','jayson/promise','bluebird','../../config/logger','client','http'];(function(_0x267d8d,_0xe90f65){var _0x11a98f=function(_0x5703c9){while(--_0x5703c9){_0x267d8d['push'](_0x267d8d['shift']());}};_0x11a98f(++_0xe90f65);}(_0xc569,0x159));var _0x9c56=function(_0x119409,_0xd03c1a){_0x119409=_0x119409-0x0;var _0x52331c=_0xc569[_0x119409];return _0x52331c;};'use strict';var jayson=require(_0x9c56('0x0'));var BPromise=require(_0x9c56('0x1'));var logger=require(_0x9c56('0x2'))('routing');var client=jayson[_0x9c56('0x3')][_0x9c56('0x4')]({'port':0x2329});client['Request']=function(_0x5d76de,_0x24527a){return new BPromise(function(_0x23402b,_0x4e81f8){return client[_0x9c56('0x5')](_0x5d76de,_0x24527a)[_0x9c56('0x6')](function(_0xe6ba11){logger[_0x9c56('0x7')]('rpc',_0x9c56('0x8'),_0x5d76de,_0x24527a,_0xe6ba11);if(_0xe6ba11[_0x9c56('0x9')]){logger[_0x9c56('0x9')](_0x9c56('0xa'),_0x9c56('0x8'),_0x5d76de,_0xe6ba11['error']['message'],_0x24527a);return _0x4e81f8(_0xe6ba11['error'][_0x9c56('0xb')]);}else{return _0x23402b(_0xe6ba11[_0x9c56('0xc')]);}})['catch'](function(_0xf66397){logger['error'](_0x9c56('0xa'),_0x9c56('0x8'),_0x5d76de,_0xf66397,_0x24527a);return _0x4e81f8(_0xf66397);});});};module[_0x9c56('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index ba25486..e60ebbc 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 _0x1a9f=['./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','log','bluebird','./server'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a9f,0xbe));var _0xf1a9=function(_0x3c3439,_0x51a4fd){_0x3c3439=_0x3c3439-0x0;var _0x1a2fbc=_0x1a9f[_0x3c3439];return _0x1a2fbc;};'use strict';var BPromise=require(_0xf1a9('0x0'));var server=require(_0xf1a9('0x1'));var Realtime=require(_0xf1a9('0x2'));var user=require(_0xf1a9('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xf1a9('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xf1a9('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xf1a9('0x6'));var whatsappQueue=require(_0xf1a9('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xf1a9('0x8')]()[_0xf1a9('0x9')](user[_0xf1a9('0xa')]())[_0xf1a9('0x9')](realtime['initAgents']())[_0xf1a9('0x9')](interval[_0xf1a9('0xb')]())[_0xf1a9('0x9')](realtime[_0xf1a9('0xc')]())['then'](openchannelQueue[_0xf1a9('0xd')]())[_0xf1a9('0x9')](realtime[_0xf1a9('0xe')]())[_0xf1a9('0x9')](chatQueue[_0xf1a9('0xf')]())[_0xf1a9('0x9')](realtime['initChatQueues']())[_0xf1a9('0x9')](smsQueue[_0xf1a9('0x10')]())['then'](realtime[_0xf1a9('0x11')]())[_0xf1a9('0x9')](mailQueue['getMailQueues']())[_0xf1a9('0x9')](realtime[_0xf1a9('0x12')]())['then'](faxQueue[_0xf1a9('0x13')]())['then'](realtime[_0xf1a9('0x14')]())[_0xf1a9('0x9')](whatsappQueue[_0xf1a9('0x15')]())[_0xf1a9('0x9')](realtime['initWhatsappQueues']())['then'](function(){return realtime;});}function main(){return server[_0xf1a9('0x16')](realtime)['then'](function(_0xbfdc44){return initRealtime();})[_0xf1a9('0x9')](function(_0x398b66){return setInterval(initRealtime,0x1388);})['catch'](function(_0x107d5e){console[_0xf1a9('0x17')](_0x107d5e);});}main(); \ No newline at end of file +var _0x6648=['./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','catch','log','bluebird'];(function(_0x51b07c,_0x3da195){var _0x4a2047=function(_0x46a0b3){while(--_0x46a0b3){_0x51b07c['push'](_0x51b07c['shift']());}};_0x4a2047(++_0x3da195);}(_0x6648,0x7c));var _0x8664=function(_0x266d2d,_0x3399f6){_0x266d2d=_0x266d2d-0x0;var _0x1e2b2a=_0x6648[_0x266d2d];return _0x1e2b2a;};'use strict';var BPromise=require(_0x8664('0x0'));var server=require('./server');var Realtime=require(_0x8664('0x1'));var user=require('./rpc/user');var interval=require(_0x8664('0x2'));var openchannelQueue=require(_0x8664('0x3'));var chatQueue=require(_0x8664('0x4'));var smsQueue=require(_0x8664('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x8664('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x8664('0x7')]()[_0x8664('0x8')](user[_0x8664('0x9')]())['then'](realtime[_0x8664('0xa')]())['then'](interval[_0x8664('0xb')]())['then'](realtime[_0x8664('0xc')]())[_0x8664('0x8')](openchannelQueue[_0x8664('0xd')]())[_0x8664('0x8')](realtime[_0x8664('0xe')]())[_0x8664('0x8')](chatQueue[_0x8664('0xf')]())['then'](realtime[_0x8664('0x10')]())[_0x8664('0x8')](smsQueue[_0x8664('0x11')]())[_0x8664('0x8')](realtime[_0x8664('0x12')]())['then'](mailQueue[_0x8664('0x13')]())[_0x8664('0x8')](realtime[_0x8664('0x14')]())['then'](faxQueue[_0x8664('0x15')]())[_0x8664('0x8')](realtime[_0x8664('0x16')]())[_0x8664('0x8')](whatsappQueue['getWhatsappQueues']())[_0x8664('0x8')](realtime['initWhatsappQueues']())[_0x8664('0x8')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x8664('0x8')](function(_0x4d9cf2){return initRealtime();})[_0x8664('0x8')](function(_0xbebc5f){return setInterval(initRealtime,0x1388);})[_0x8664('0x17')](function(_0x3ef96f){console[_0x8664('0x18')](_0x3ef96f);});}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 be9c5b7..41a2ea9 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 _0x5ff2=['init','ignoreFactChanges','inherits','prototype','rules','activeRules','register','isArray','concat','isObject','push','sync','isNil','orderBy','asc','execute','result','clone','ruleRef','name','nextTick','call','next','restart','length','condition','matchPath','noop','findRules','matches','filter','turn','prioritize','priority','toJSON','map','toString','consequence','fromJSON','isString','object','exports','util','events','EventEmitter'];(function(_0x2ae8ce,_0x2a5a1f){var _0x4bf686=function(_0x41cabf){while(--_0x41cabf){_0x2ae8ce['push'](_0x2ae8ce['shift']());}};_0x4bf686(++_0x2a5a1f);}(_0x5ff2,0xde));var _0x25ff=function(_0x3ad191,_0x29e58b){_0x3ad191=_0x3ad191-0x0;var _0x4384e5=_0x5ff2[_0x3ad191];return _0x4384e5;};'use strict';var _=require('lodash');var util=require(_0x25ff('0x0'));var EventEmitter=require(_0x25ff('0x1'))[_0x25ff('0x2')];function RuleEngine(_0x32af56,_0x4cfa8d){this[_0x25ff('0x3')]();if(!_['isNil'](_0x32af56)){this['register'](_0x32af56);}if(_0x4cfa8d){this[_0x25ff('0x4')]=_0x4cfa8d[_0x25ff('0x4')];}return this;}util[_0x25ff('0x5')](RuleEngine,EventEmitter);RuleEngine[_0x25ff('0x6')][_0x25ff('0x3')]=function(_0x2ace0e){this[_0x25ff('0x7')]=[];this[_0x25ff('0x8')]=[];};RuleEngine[_0x25ff('0x6')][_0x25ff('0x9')]=function(_0x4f94b4){if(Array[_0x25ff('0xa')](_0x4f94b4)){this[_0x25ff('0x7')]=this[_0x25ff('0x7')][_0x25ff('0xb')](_0x4f94b4);}else if(_0x4f94b4!==null&&_[_0x25ff('0xc')](_0x4f94b4)){this[_0x25ff('0x7')][_0x25ff('0xd')](_0x4f94b4);}this[_0x25ff('0xe')]();};RuleEngine[_0x25ff('0x6')][_0x25ff('0xe')]=function(){this[_0x25ff('0x8')]=this[_0x25ff('0x7')]['filter'](function(_0x4df701){if(_[_0x25ff('0xf')](_0x4df701['on'])){_0x4df701['on']=!![];}if(_0x4df701['on']===!![]){return _0x4df701;}});this[_0x25ff('0x8')]=_[_0x25ff('0x10')](this[_0x25ff('0x8')],['p'],[_0x25ff('0x11')]);};RuleEngine[_0x25ff('0x6')][_0x25ff('0x12')]=function(_0x4931bd,_0x15a367){var _0x3bcc7e=![];_0x4931bd[_0x25ff('0x13')]=!![];var _0x59c23a=_[_0x25ff('0x14')](_0x4931bd);var _0x26883c=_['clone'](_0x4931bd);var _0xbfe467=this[_0x25ff('0x8')];var _0x1bceca=[];var _0x5cae62=this[_0x25ff('0x4')];(function FnRuleLoop(_0x48eb31){var _0x59b07d={'rules':function(){return _0xbfe467;},'rule':function(){return _0xbfe467[_0x48eb31];},'when':function(_0x238642){if(_0x238642){var _0x2b1dfd=_0xbfe467[_0x48eb31]['consequence'];_0x2b1dfd[_0x25ff('0x15')]=_0xbfe467[_0x48eb31]['id']||_0xbfe467[_0x48eb31][_0x25ff('0x16')]||'index_'+_0x48eb31;process[_0x25ff('0x17')](function(){_0x1bceca['push'](_0x2b1dfd['ruleRef']);_0x2b1dfd[_0x25ff('0x18')](_0x59c23a,_0x59b07d);});}else{process[_0x25ff('0x17')](function(){_0x59b07d[_0x25ff('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x3bcc7e=!![];return FnRuleLoop(0x0);},'next':function(_0x3a146c){if(!_0x5cae62&&!_['isEqual'](_0x26883c,_0x59c23a)){_0x26883c=_[_0x25ff('0x14')](_0x59c23a);process[_0x25ff('0x17')](function(){_0x59b07d[_0x25ff('0x1a')]();});}else{process[_0x25ff('0x17')](function(){if(_[_0x25ff('0xf')](_0x3a146c)){return FnRuleLoop(_0x48eb31+0x1);}else{return FnRuleLoop(_0x3a146c);}});}}};if(_0x48eb31<_0xbfe467[_0x25ff('0x1b')]&&_0x3bcc7e===![]){var _0x51f8ca=_0xbfe467[_0x48eb31][_0x25ff('0x1c')];_0x51f8ca[_0x25ff('0x18')](_0x59c23a,_0x59b07d);}else{process[_0x25ff('0x17')](function(){_0x59c23a[_0x25ff('0x1d')]=_0x1bceca;return _0x15a367?_0x15a367(_0x59c23a):_[_0x25ff('0x1e')]();});}}(0x0));};RuleEngine[_0x25ff('0x6')][_0x25ff('0x1f')]=function(_0x11a322){if(_[_0x25ff('0xf')](_0x11a322)){return this[_0x25ff('0x7')];}else{var _0x339b50=_[_0x25ff('0x20')](_0x11a322);return _[_0x25ff('0x21')](this[_0x25ff('0x7')],_0x339b50);}};RuleEngine['prototype'][_0x25ff('0x22')]=function(_0x1dc154,_0x174378){var _0x50d507=_0x1dc154==='on'||_0x1dc154==='ON'?!![]:![];var _0x349ed6=this[_0x25ff('0x1f')](_0x174378);for(var _0x41a068=0x0,_0x51ba9a=_0x349ed6[_0x25ff('0x1b')];_0x41a068<_0x51ba9a;_0x41a068+=0x1){_0x349ed6[_0x41a068]['on']=_0x50d507;}this['sync']();};RuleEngine[_0x25ff('0x6')][_0x25ff('0x23')]=function(_0x2322a3,_0x194152){_0x2322a3=parseInt(_0x2322a3,0xa);var _0x217037=this[_0x25ff('0x1f')](_0x194152);for(var _0x565ccb=0x0,_0x2f2f02=_0x217037[_0x25ff('0x1b')];_0x565ccb<_0x2f2f02;_0x565ccb+=0x1){_0x217037[_0x565ccb][_0x25ff('0x24')]=_0x2322a3;}this[_0x25ff('0xe')]();};RuleEngine['prototype'][_0x25ff('0x25')]=function(){var _0x57f157=this[_0x25ff('0x7')];if(_0x57f157 instanceof Array){_0x57f157=_0x57f157[_0x25ff('0x26')](function(_0x372722){_0x372722['condition']=_0x372722[_0x25ff('0x1c')][_0x25ff('0x27')]();_0x372722[_0x25ff('0x28')]=_0x372722[_0x25ff('0x28')]['toString']();return _0x372722;});}else if(!_[_0x25ff('0xf')](_0x57f157)){_0x57f157[_0x25ff('0x1c')]=_0x57f157['condition'][_0x25ff('0x27')]();_0x57f157['consequence']=_0x57f157['consequence'][_0x25ff('0x27')]();}return _0x57f157;};RuleEngine[_0x25ff('0x6')][_0x25ff('0x29')]=function(_0xd90298){this['init']();if(_[_0x25ff('0x2a')](_0xd90298)){_0xd90298=JSON['parse'](_0xd90298);}if(_0xd90298 instanceof Array){_0xd90298=_0xd90298[_0x25ff('0x26')](function(_0xf3eb9b){_0xf3eb9b[_0x25ff('0x1c')]=eval('('+_0xf3eb9b[_0x25ff('0x1c')]+')');_0xf3eb9b[_0x25ff('0x28')]=eval('('+_0xf3eb9b[_0x25ff('0x28')]+')');return _0xf3eb9b;});}else if(_0xd90298!==null&&typeof _0xd90298==_0x25ff('0x2b')){_0xd90298[_0x25ff('0x1c')]=eval('('+_0xd90298[_0x25ff('0x1c')]+')');_0xd90298[_0x25ff('0x28')]=eval('('+_0xd90298[_0x25ff('0x28')]+')');}this[_0x25ff('0x9')](_0xd90298);};module[_0x25ff('0x2c')]=RuleEngine; \ No newline at end of file +var _0x69e2=['register','ignoreFactChanges','inherits','rules','activeRules','prototype','sync','asc','execute','clone','consequence','ruleRef','index_','push','call','nextTick','next','isEqual','restart','length','condition','noop','findRules','matches','prioritize','priority','toJSON','map','toString','fromJSON','isString','parse','exports','lodash','util','events','EventEmitter','init','isNil'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x69e2,0x6f));var _0x269e=function(_0x12bd8a,_0x2046f3){_0x12bd8a=_0x12bd8a-0x0;var _0x2795d5=_0x69e2[_0x12bd8a];return _0x2795d5;};'use strict';var _=require(_0x269e('0x0'));var util=require(_0x269e('0x1'));var EventEmitter=require(_0x269e('0x2'))[_0x269e('0x3')];function RuleEngine(_0x4c4249,_0x4acd0f){this[_0x269e('0x4')]();if(!_[_0x269e('0x5')](_0x4c4249)){this[_0x269e('0x6')](_0x4c4249);}if(_0x4acd0f){this[_0x269e('0x7')]=_0x4acd0f[_0x269e('0x7')];}return this;}util[_0x269e('0x8')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x5f1a28){this[_0x269e('0x9')]=[];this[_0x269e('0xa')]=[];};RuleEngine[_0x269e('0xb')][_0x269e('0x6')]=function(_0x2daea7){if(Array['isArray'](_0x2daea7)){this[_0x269e('0x9')]=this[_0x269e('0x9')]['concat'](_0x2daea7);}else if(_0x2daea7!==null&&_['isObject'](_0x2daea7)){this[_0x269e('0x9')]['push'](_0x2daea7);}this['sync']();};RuleEngine[_0x269e('0xb')][_0x269e('0xc')]=function(){this[_0x269e('0xa')]=this[_0x269e('0x9')]['filter'](function(_0x5cd10f){if(_[_0x269e('0x5')](_0x5cd10f['on'])){_0x5cd10f['on']=!![];}if(_0x5cd10f['on']===!![]){return _0x5cd10f;}});this['activeRules']=_['orderBy'](this[_0x269e('0xa')],['p'],[_0x269e('0xd')]);};RuleEngine[_0x269e('0xb')][_0x269e('0xe')]=function(_0x34903f,_0x3ec296){var _0x2b6f21=![];_0x34903f['result']=!![];var _0x4e76d5=_[_0x269e('0xf')](_0x34903f);var _0x27282e=_[_0x269e('0xf')](_0x34903f);var _0x128d44=this[_0x269e('0xa')];var _0x4b1d33=[];var _0x54bc4b=this[_0x269e('0x7')];(function FnRuleLoop(_0x58b8a0){var _0x1c0270={'rules':function(){return _0x128d44;},'rule':function(){return _0x128d44[_0x58b8a0];},'when':function(_0x5adf55){if(_0x5adf55){var _0x192d74=_0x128d44[_0x58b8a0][_0x269e('0x10')];_0x192d74[_0x269e('0x11')]=_0x128d44[_0x58b8a0]['id']||_0x128d44[_0x58b8a0]['name']||_0x269e('0x12')+_0x58b8a0;process['nextTick'](function(){_0x4b1d33[_0x269e('0x13')](_0x192d74[_0x269e('0x11')]);_0x192d74[_0x269e('0x14')](_0x4e76d5,_0x1c0270);});}else{process[_0x269e('0x15')](function(){_0x1c0270[_0x269e('0x16')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x2b6f21=!![];return FnRuleLoop(0x0);},'next':function(_0x44c3ac){if(!_0x54bc4b&&!_[_0x269e('0x17')](_0x27282e,_0x4e76d5)){_0x27282e=_['clone'](_0x4e76d5);process['nextTick'](function(){_0x1c0270[_0x269e('0x18')]();});}else{process[_0x269e('0x15')](function(){if(_['isNil'](_0x44c3ac)){return FnRuleLoop(_0x58b8a0+0x1);}else{return FnRuleLoop(_0x44c3ac);}});}}};if(_0x58b8a0<_0x128d44[_0x269e('0x19')]&&_0x2b6f21===![]){var _0x3e9ab9=_0x128d44[_0x58b8a0][_0x269e('0x1a')];_0x3e9ab9[_0x269e('0x14')](_0x4e76d5,_0x1c0270);}else{process[_0x269e('0x15')](function(){_0x4e76d5['matchPath']=_0x4b1d33;return _0x3ec296?_0x3ec296(_0x4e76d5):_[_0x269e('0x1b')]();});}}(0x0));};RuleEngine['prototype'][_0x269e('0x1c')]=function(_0x4cbda7){if(_[_0x269e('0x5')](_0x4cbda7)){return this[_0x269e('0x9')];}else{var _0x17a190=_[_0x269e('0x1d')](_0x4cbda7);return _['filter'](this[_0x269e('0x9')],_0x17a190);}};RuleEngine[_0x269e('0xb')]['turn']=function(_0x49e322,_0x1bcba8){var _0x4febce=_0x49e322==='on'||_0x49e322==='ON'?!![]:![];var _0x5ab56b=this[_0x269e('0x1c')](_0x1bcba8);for(var _0x4fe7d0=0x0,_0x52f7c4=_0x5ab56b['length'];_0x4fe7d0<_0x52f7c4;_0x4fe7d0+=0x1){_0x5ab56b[_0x4fe7d0]['on']=_0x4febce;}this[_0x269e('0xc')]();};RuleEngine[_0x269e('0xb')][_0x269e('0x1e')]=function(_0x29694f,_0x56b1de){_0x29694f=parseInt(_0x29694f,0xa);var _0x69c9fc=this[_0x269e('0x1c')](_0x56b1de);for(var _0x331395=0x0,_0x3cf687=_0x69c9fc[_0x269e('0x19')];_0x331395<_0x3cf687;_0x331395+=0x1){_0x69c9fc[_0x331395][_0x269e('0x1f')]=_0x29694f;}this[_0x269e('0xc')]();};RuleEngine[_0x269e('0xb')][_0x269e('0x20')]=function(){var _0x5cb3f6=this[_0x269e('0x9')];if(_0x5cb3f6 instanceof Array){_0x5cb3f6=_0x5cb3f6[_0x269e('0x21')](function(_0x25f53e){_0x25f53e[_0x269e('0x1a')]=_0x25f53e[_0x269e('0x1a')][_0x269e('0x22')]();_0x25f53e[_0x269e('0x10')]=_0x25f53e['consequence']['toString']();return _0x25f53e;});}else if(!_[_0x269e('0x5')](_0x5cb3f6)){_0x5cb3f6['condition']=_0x5cb3f6[_0x269e('0x1a')]['toString']();_0x5cb3f6[_0x269e('0x10')]=_0x5cb3f6[_0x269e('0x10')][_0x269e('0x22')]();}return _0x5cb3f6;};RuleEngine[_0x269e('0xb')][_0x269e('0x23')]=function(_0x41d28c){this['init']();if(_[_0x269e('0x24')](_0x41d28c)){_0x41d28c=JSON[_0x269e('0x25')](_0x41d28c);}if(_0x41d28c instanceof Array){_0x41d28c=_0x41d28c['map'](function(_0x58b52a){_0x58b52a[_0x269e('0x1a')]=eval('('+_0x58b52a[_0x269e('0x1a')]+')');_0x58b52a[_0x269e('0x10')]=eval('('+_0x58b52a[_0x269e('0x10')]+')');return _0x58b52a;});}else if(_0x41d28c!==null&&typeof _0x41d28c=='object'){_0x41d28c['condition']=eval('('+_0x41d28c['condition']+')');_0x41d28c[_0x269e('0x10')]=eval('('+_0x41d28c[_0x269e('0x10')]+')');}this[_0x269e('0x6')](_0x41d28c);};module[_0x269e('0x26')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 6c70576..28ded58 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 _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x22d6cd,_0x44defa){var _0x507d03=function(_0x34c8a9){while(--_0x34c8a9){_0x22d6cd['push'](_0x22d6cd['shift']());}};_0x507d03(++_0x44defa);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x24cf4a,_0x5437cf){var _0x35bc13=function(_0x592ef7){while(--_0x592ef7){_0x24cf4a['push'](_0x24cf4a['shift']());}};_0x35bc13(++_0x5437cf);}(_0x34e8,0x12c));var _0x834e=function(_0x30c4f3,_0xd2b77e){_0x30c4f3=_0x30c4f3-0x0;var _0x472975=_0x34e8[_0x30c4f3];return _0x472975;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 52081b5..990d0e2 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 _0xa413=['busyQueue','stringify','emit','user:save','exports','lodash','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCurrentCapacity','busy','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime','mail','chat','fax','sms','whatsapp','length','Status','toNumber','faxPause','chatStatusTime','mailStatusTime','smsStatusTime','smsCurrentCapacity','whatsappStatus'];(function(_0x369974,_0x3bdc0b){var _0x5aa864=function(_0x2b4473){while(--_0x2b4473){_0x369974['push'](_0x369974['shift']());}};_0x5aa864(++_0x3bdc0b);}(_0xa413,0x1e5));var _0x3a41=function(_0x30db0e,_0x5bc053){_0x30db0e=_0x30db0e-0x0;var _0x21b22e=_0xa413[_0x30db0e];return _0x21b22e;};'use strict';var _=require(_0x3a41('0x0'));var moment=require('moment');var md5=require(_0x3a41('0x1'));var Redis=require('ioredis');var config=require(_0x3a41('0x2'));config[_0x3a41('0x3')]=_['defaults'](config['redis'],{'host':_0x3a41('0x4'),'port':0x18eb});var io=require(_0x3a41('0x5'))(new Redis(config[_0x3a41('0x3')]));function Agent(_0x2405b8){this['id']=_0x2405b8['id']||0x0;this[_0x3a41('0x6')]=_0x2405b8[_0x3a41('0x6')]||'';this[_0x3a41('0x7')]=_0x2405b8[_0x3a41('0x7')]||!![];this[_0x3a41('0x8')]=_0x2405b8[_0x3a41('0x8')]||![];this[_0x3a41('0x9')]=_0x2405b8['chatPause']||![];this[_0x3a41('0xa')]=_0x2405b8['mailPause']||![];this['faxPause']=_0x2405b8['faxPause']||![];this[_0x3a41('0xb')]=_0x2405b8['smsPause']||![];this[_0x3a41('0xc')]=_0x2405b8['openchannelPause']||![];this[_0x3a41('0xd')]=_0x3a41('0xe');this['chatStatusTime']=0x0;this[_0x3a41('0xf')]=_0x2405b8[_0x3a41('0xf')]||0x0;this[_0x3a41('0x10')]=0x0;this[_0x3a41('0x11')]=_0x3a41('0xe');this['mailStatusTime']=0x0;this[_0x3a41('0x12')]=_0x2405b8[_0x3a41('0x12')]||0x0;this[_0x3a41('0x13')]=0x0;this[_0x3a41('0x14')]=_0x3a41('0xe');this[_0x3a41('0x15')]=0x0;this[_0x3a41('0x16')]=_0x2405b8[_0x3a41('0x16')]||0x0;this[_0x3a41('0x17')]=0x0;this[_0x3a41('0x18')]=_0x3a41('0xe');this['smsStatusTime']=0x0;this[_0x3a41('0x19')]=_0x2405b8[_0x3a41('0x19')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']=_0x3a41('0xe');this[_0x3a41('0x1a')]=0x0;this[_0x3a41('0x1b')]=_0x2405b8[_0x3a41('0x1b')]||0x0;this[_0x3a41('0x1c')]=0x0;this[_0x3a41('0x1d')]=_0x3a41('0xe');this[_0x3a41('0x1e')]=0x0;this['openchannelCapacity']=_0x2405b8['openchannelCapacity']||0x0;this[_0x3a41('0x1f')]=0x0;this[_0x3a41('0x20')]=![];this['busyQueue']=undefined;this['md5']='';this['updateRealtime']();}Agent[_0x3a41('0x21')][_0x3a41('0x22')]=function(_0x1914d7){if(this[_0x1914d7+_0x3a41('0x23')]>0x0){if(this[_0x1914d7+'Capacity']>0x0&&this[_0x1914d7+'CurrentCapacity']>=this[_0x1914d7+_0x3a41('0x24')]){return _0x3a41('0x25');}else{return _0x3a41('0x26');}}else{return _0x3a41('0x27');}};Agent[_0x3a41('0x21')][_0x3a41('0x28')]=function(){var _0x52fede=[_0x3a41('0x29'),_0x3a41('0x2a'),'openchannel',_0x3a41('0x2b'),_0x3a41('0x2c'),_0x3a41('0x2d')];for(var _0x2d5f59=0x0;_0x2d5f59<_0x52fede[_0x3a41('0x2e')];_0x2d5f59+=0x1){var _0x549390=this[_0x3a41('0x22')](_0x52fede[_0x2d5f59]);if(this[_0x52fede[_0x2d5f59]+_0x3a41('0x2f')]!==_0x549390){this[_0x52fede[_0x2d5f59]+'StatusTime']=_[_0x3a41('0x30')](moment()['format']('x'));}this[_0x52fede[_0x2d5f59]+_0x3a41('0x2f')]=_0x549390;}var _0x566d35={'id':this['id'],'name':this[_0x3a41('0x6')],'online':this['online'],'voicePause':this[_0x3a41('0x8')],'chatPause':this[_0x3a41('0x9')],'mailPause':this[_0x3a41('0xa')],'smsPause':this[_0x3a41('0xb')],'faxPause':this[_0x3a41('0x31')],'openchannelPause':this[_0x3a41('0xc')],'chatStatus':this[_0x3a41('0xd')],'chatStatusTime':this[_0x3a41('0x32')],'chatCapacity':this[_0x3a41('0xf')],'chatCurrentCapacity':this[_0x3a41('0x10')],'mailStatus':this[_0x3a41('0x11')],'mailStatusTime':this[_0x3a41('0x33')],'mailCapacity':this[_0x3a41('0x12')],'mailCurrentCapacity':this[_0x3a41('0x13')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x3a41('0x18')],'smsStatusTime':this[_0x3a41('0x34')],'smsCapacity':this[_0x3a41('0x19')],'smsCurrentCapacity':this[_0x3a41('0x35')],'whatsappStatus':this[_0x3a41('0x36')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x3a41('0x1d')],'openchannelStatusTime':this[_0x3a41('0x1e')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x3a41('0x1f')],'busy':this[_0x3a41('0x20')],'busyQueue':this[_0x3a41('0x37')]};var _0x28390b=md5(JSON[_0x3a41('0x38')](_0x566d35));if(this[_0x3a41('0x1')]!==_0x28390b){this[_0x3a41('0x1')]=_0x28390b;io[_0x3a41('0x39')](_0x3a41('0x3a'),_0x566d35);}};module[_0x3a41('0x3b')]=Agent; \ No newline at end of file +var _0xadcc=['smsStatusTime','whatsappStatusTime','openchannelCurrentCapacity','stringify','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busyQueue','prototype','getChannelStatus','Capacity','working','idle','updateRealtime','fax','sms','Status','StatusTime','toNumber','format','chatCapacity','mailCurrentCapacity','smsStatus'];(function(_0x4ef4e2,_0x4faf5f){var _0x3a96a4=function(_0x4694b0){while(--_0x4694b0){_0x4ef4e2['push'](_0x4ef4e2['shift']());}};_0x3a96a4(++_0x4faf5f);}(_0xadcc,0x76));var _0xcadc=function(_0x2071ac,_0x511a5c){_0x2071ac=_0x2071ac-0x0;var _0x91ee44=_0xadcc[_0x2071ac];return _0x91ee44;};'use strict';var _=require(_0xcadc('0x0'));var moment=require('moment');var md5=require(_0xcadc('0x1'));var Redis=require(_0xcadc('0x2'));var config=require(_0xcadc('0x3'));config[_0xcadc('0x4')]=_[_0xcadc('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xcadc('0x6'))(new Redis(config[_0xcadc('0x4')]));function Agent(_0x40f07f){this['id']=_0x40f07f['id']||0x0;this[_0xcadc('0x7')]=_0x40f07f[_0xcadc('0x7')]||'';this[_0xcadc('0x8')]=_0x40f07f[_0xcadc('0x8')]||!![];this[_0xcadc('0x9')]=_0x40f07f[_0xcadc('0x9')]||![];this[_0xcadc('0xa')]=_0x40f07f[_0xcadc('0xa')]||![];this[_0xcadc('0xb')]=_0x40f07f[_0xcadc('0xb')]||![];this[_0xcadc('0xc')]=_0x40f07f['faxPause']||![];this['smsPause']=_0x40f07f[_0xcadc('0xd')]||![];this[_0xcadc('0xe')]=_0x40f07f['openchannelPause']||![];this[_0xcadc('0xf')]=_0xcadc('0x10');this[_0xcadc('0x11')]=0x0;this['chatCapacity']=_0x40f07f['chatCapacity']||0x0;this[_0xcadc('0x12')]=0x0;this[_0xcadc('0x13')]=_0xcadc('0x10');this[_0xcadc('0x14')]=0x0;this['mailCapacity']=_0x40f07f[_0xcadc('0x15')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xcadc('0x16')]=_0xcadc('0x10');this[_0xcadc('0x17')]=0x0;this['faxCapacity']=_0x40f07f[_0xcadc('0x18')]||0x0;this[_0xcadc('0x19')]=0x0;this['smsStatus']=_0xcadc('0x10');this['smsStatusTime']=0x0;this[_0xcadc('0x1a')]=_0x40f07f[_0xcadc('0x1a')]||0x0;this[_0xcadc('0x1b')]=0x0;this[_0xcadc('0x1c')]=_0xcadc('0x10');this['whatsappStatusTime']=0x0;this[_0xcadc('0x1d')]=_0x40f07f[_0xcadc('0x1d')]||0x0;this[_0xcadc('0x1e')]=0x0;this[_0xcadc('0x1f')]=_0xcadc('0x10');this[_0xcadc('0x20')]=0x0;this[_0xcadc('0x21')]=_0x40f07f[_0xcadc('0x21')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0xcadc('0x22')]=undefined;this[_0xcadc('0x1')]='';this['updateRealtime']();}Agent[_0xcadc('0x23')][_0xcadc('0x24')]=function(_0x4b9eb9){if(this[_0x4b9eb9+'CurrentCapacity']>0x0){if(this[_0x4b9eb9+_0xcadc('0x25')]>0x0&&this[_0x4b9eb9+'CurrentCapacity']>=this[_0x4b9eb9+_0xcadc('0x25')]){return'maxcapacity';}else{return _0xcadc('0x26');}}else{return _0xcadc('0x27');}};Agent['prototype'][_0xcadc('0x28')]=function(){var _0x3e8311=['mail','chat','openchannel',_0xcadc('0x29'),_0xcadc('0x2a'),'whatsapp'];for(var _0x1c07c5=0x0;_0x1c07c5<_0x3e8311['length'];_0x1c07c5+=0x1){var _0x277d1e=this[_0xcadc('0x24')](_0x3e8311[_0x1c07c5]);if(this[_0x3e8311[_0x1c07c5]+_0xcadc('0x2b')]!==_0x277d1e){this[_0x3e8311[_0x1c07c5]+_0xcadc('0x2c')]=_[_0xcadc('0x2d')](moment()[_0xcadc('0x2e')]('x'));}this[_0x3e8311[_0x1c07c5]+'Status']=_0x277d1e;}var _0x4b4754={'id':this['id'],'name':this['name'],'online':this[_0xcadc('0x8')],'voicePause':this[_0xcadc('0x9')],'chatPause':this[_0xcadc('0xa')],'mailPause':this[_0xcadc('0xb')],'smsPause':this[_0xcadc('0xd')],'faxPause':this[_0xcadc('0xc')],'openchannelPause':this[_0xcadc('0xe')],'chatStatus':this[_0xcadc('0xf')],'chatStatusTime':this[_0xcadc('0x11')],'chatCapacity':this[_0xcadc('0x2f')],'chatCurrentCapacity':this[_0xcadc('0x12')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xcadc('0x15')],'mailCurrentCapacity':this[_0xcadc('0x30')],'faxStatus':this[_0xcadc('0x16')],'faxStatusTime':this[_0xcadc('0x17')],'faxCapacity':this[_0xcadc('0x18')],'faxCurrentCapacity':this[_0xcadc('0x19')],'smsStatus':this[_0xcadc('0x31')],'smsStatusTime':this[_0xcadc('0x32')],'smsCapacity':this[_0xcadc('0x1a')],'smsCurrentCapacity':this[_0xcadc('0x1b')],'whatsappStatus':this[_0xcadc('0x1c')],'whatsappStatusTime':this[_0xcadc('0x33')],'whatsappCapacity':this[_0xcadc('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xcadc('0x34')],'busy':this['busy'],'busyQueue':this['busyQueue']};var _0x407152=md5(JSON[_0xcadc('0x35')](_0x4b4754));if(this[_0xcadc('0x1')]!==_0x407152){this[_0xcadc('0x1')]=_0x407152;io[_0xcadc('0x36')]('user:save',_0x4b4754);}};module[_0xcadc('0x37')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index aefaccc..b8ac5dc 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 _0x248a=['waiting','md5','updateRouting','_rr','prototype','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','chat_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x2c237d,_0x3419ce){var _0x58f1d9=function(_0x24050a){while(--_0x24050a){_0x2c237d['push'](_0x2c237d['shift']());}};_0x58f1d9(++_0x3419ce);}(_0x248a,0xf8));var _0xa248=function(_0x153f3d,_0x2d5544){_0x153f3d=_0x153f3d-0x0;var _0x2d3348=_0x248a[_0x153f3d];return _0x2d3348;};'use strict';var _=require(_0xa248('0x0'));var md5=require('md5');var util=require(_0xa248('0x1'));var Redis=require('ioredis');var config=require(_0xa248('0x2'));config[_0xa248('0x3')]=_[_0xa248('0x4')](config[_0xa248('0x3')],{'host':_0xa248('0x5'),'port':0x18eb});var io=require(_0xa248('0x6'))(new Redis(config[_0xa248('0x3')]));function ChatQueue(_0x34626d){this['id']=_0x34626d['id']||0x0;this[_0xa248('0x7')]=_0x34626d[_0xa248('0x7')]||'';this[_0xa248('0x8')]=_0x34626d[_0xa248('0x8')]||0xa;this[_0xa248('0x9')]=_0x34626d[_0xa248('0x9')]||_0xa248('0xa');this[_0xa248('0xb')]=_0x34626d[_0xa248('0xb')];this[_0xa248('0xc')]={};this[_0xa248('0xd')]=0x0;this[_0xa248('0xe')]='';this[_0xa248('0xf')]();this['updateRealtime']();}ChatQueue['prototype'][_0xa248('0xf')]=function(){var _0x3ddfc8=this['mapAgentsId'][_0xa248('0x10')];this[_0xa248('0xc')]=_['map'](this[_0xa248('0xb')],'id');this[_0xa248('0xc')]['_rr']=_0x3ddfc8;};ChatQueue[_0xa248('0x11')]['updateRealtime']=function(){this[_0xa248('0x12')]=0x0;this[_0xa248('0x13')]=0x0;for(var _0x2acd65=0x0;_0x2acd65=0x0?this[_0xa248('0x17')]:0x0;var _0x3d9ef6={'id':this['id'],'available':this[_0xa248('0x17')],'loggedIn':this['loggedIn'],'name':this[_0xa248('0x7')],'paused':this[_0xa248('0x13')],'waiting':this[_0xa248('0xd')]};var _0x1a9fd8=md5(JSON[_0xa248('0x18')](_0x3d9ef6));if(this[_0xa248('0xe')]!==_0x1a9fd8){this[_0xa248('0xe')]=_0x1a9fd8;io['to'](util[_0xa248('0x19')](_0xa248('0x1a'),_0x3d9ef6[_0xa248('0x7')]))['emit'](_0xa248('0x1b'),_0x3d9ef6);}};module[_0xa248('0x1c')]=ChatQueue; \ No newline at end of file +var _0xf5e3=['beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','online','chatPause','available','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x677c63,_0x4373d5){var _0x41cb67=function(_0x2025e6){while(--_0x2025e6){_0x677c63['push'](_0x677c63['shift']());}};_0x41cb67(++_0x4373d5);}(_0xf5e3,0x18c));var _0x3f5e=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xf5e3[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x3f5e('0x0'));var md5=require(_0x3f5e('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x3f5e('0x2'));config[_0x3f5e('0x3')]=_['defaults'](config['redis'],{'host':_0x3f5e('0x4'),'port':0x18eb});var io=require(_0x3f5e('0x5'))(new Redis(config[_0x3f5e('0x3')]));function ChatQueue(_0x4d7289){this['id']=_0x4d7289['id']||0x0;this['name']=_0x4d7289[_0x3f5e('0x6')]||'';this[_0x3f5e('0x7')]=_0x4d7289['timeout']||0xa;this[_0x3f5e('0x8')]=_0x4d7289['strategy']||_0x3f5e('0x9');this[_0x3f5e('0xa')]=_0x4d7289['Agents'];this[_0x3f5e('0xb')]={};this[_0x3f5e('0xc')]=0x0;this['md5']='';this[_0x3f5e('0xd')]();this[_0x3f5e('0xe')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x1e66ad=this['mapAgentsId'][_0x3f5e('0xf')];this[_0x3f5e('0xb')]=_[_0x3f5e('0x10')](this[_0x3f5e('0xa')],'id');this[_0x3f5e('0xb')][_0x3f5e('0xf')]=_0x1e66ad;};ChatQueue['prototype'][_0x3f5e('0xe')]=function(){this[_0x3f5e('0x11')]=0x0;this[_0x3f5e('0x12')]=0x0;for(var _0x278706=0x0;_0x278706=0x0?this[_0x3f5e('0x15')]:0x0;var _0x4973ff={'id':this['id'],'available':this[_0x3f5e('0x15')],'loggedIn':this[_0x3f5e('0x11')],'name':this[_0x3f5e('0x6')],'paused':this[_0x3f5e('0x12')],'waiting':this[_0x3f5e('0xc')]};var _0x52c38f=md5(JSON['stringify'](_0x4973ff));if(this[_0x3f5e('0x1')]!==_0x52c38f){this[_0x3f5e('0x1')]=_0x52c38f;io['to'](util[_0x3f5e('0x16')](_0x3f5e('0x17'),_0x4973ff[_0x3f5e('0x6')]))[_0x3f5e('0x18')](_0x3f5e('0x19'),_0x4973ff);}};module[_0x3f5e('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 11fc260..f67443e 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 _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x497091,_0x35174c){var _0x1df5db=function(_0x42615a){while(--_0x42615a){_0x497091['push'](_0x497091['shift']());}};_0x1df5db(++_0x35174c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file +var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x7cabe2,_0x469c2f){var _0x4dd3c3=function(_0x529aad){while(--_0x529aad){_0x7cabe2['push'](_0x7cabe2['shift']());}};_0x4dd3c3(++_0x469c2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 5295270..68d14d2 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 _0xc908=['exports','name','Intervals'];(function(_0x4831c9,_0x28ebff){var _0x1c8e45=function(_0x5953a2){while(--_0x5953a2){_0x4831c9['push'](_0x4831c9['shift']());}};_0x1c8e45(++_0x28ebff);}(_0xc908,0xfa));var _0x8c90=function(_0x2d61ac,_0x18ff36){_0x2d61ac=_0x2d61ac-0x0;var _0x3f7d3c=_0xc908[_0x2d61ac];return _0x3f7d3c;};'use strict';function Interval(_0x3657c6){this['id']=_0x3657c6['id']||0x0;this[_0x8c90('0x0')]=_0x3657c6['name']||'';this[_0x8c90('0x1')]=_0x3657c6[_0x8c90('0x1')]||{};}module[_0x8c90('0x2')]=Interval; \ No newline at end of file +var _0xb5ca=['name','Intervals','exports'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xb5ca,0x90));var _0xab5c=function(_0x44c43d,_0x5198f1){_0x44c43d=_0x44c43d-0x0;var _0x15b6a7=_0xb5ca[_0x44c43d];return _0x15b6a7;};'use strict';function Interval(_0x453054){this['id']=_0x453054['id']||0x0;this[_0xab5c('0x0')]=_0x453054[_0xab5c('0x0')]||'';this[_0xab5c('0x1')]=_0x453054[_0xab5c('0x1')]||{};}module[_0xab5c('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 db6761a..6854f87 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 _0x605b=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map','loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','name','timeout'];(function(_0x1eedfb,_0x4e8c25){var _0x5e6b75=function(_0x10f964){while(--_0x10f964){_0x1eedfb['push'](_0x1eedfb['shift']());}};_0x5e6b75(++_0x4e8c25);}(_0x605b,0xf4));var _0xb605=function(_0x486a0e,_0x373f76){_0x486a0e=_0x486a0e-0x0;var _0x4aad97=_0x605b[_0x486a0e];return _0x4aad97;};'use strict';var _=require(_0xb605('0x0'));var md5=require(_0xb605('0x1'));var util=require(_0xb605('0x2'));var Redis=require(_0xb605('0x3'));var config=require('../../../config/environment');config[_0xb605('0x4')]=_['defaults'](config['redis'],{'host':_0xb605('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb605('0x4')]));function MailQueue(_0x15f8a9){this['id']=_0x15f8a9['id']||0x0;this[_0xb605('0x6')]=_0x15f8a9['name']||'';this[_0xb605('0x7')]=_0x15f8a9[_0xb605('0x7')]||0xa;this[_0xb605('0x8')]=_0x15f8a9[_0xb605('0x8')]||_0xb605('0x9');this[_0xb605('0xa')]=_0x15f8a9[_0xb605('0xa')];this[_0xb605('0xb')]={};this[_0xb605('0xc')]=0x0;this[_0xb605('0x1')]='';this[_0xb605('0xd')]();this['updateRealtime']();}MailQueue[_0xb605('0xe')][_0xb605('0xd')]=function(){var _0x485cea=this[_0xb605('0xb')]['_rr'];this[_0xb605('0xb')]=_[_0xb605('0xf')](this[_0xb605('0xa')],'id');this[_0xb605('0xb')]['_rr']=_0x485cea;};MailQueue[_0xb605('0xe')]['updateRealtime']=function(){this[_0xb605('0x10')]=0x0;this[_0xb605('0x11')]=0x0;for(var _0x2b740c=0x0;_0x2b740c=0x0?this[_0xb605('0x15')]:0x0;var _0x251829={'id':this['id'],'available':this[_0xb605('0x15')],'loggedIn':this['loggedIn'],'name':this[_0xb605('0x6')],'paused':this[_0xb605('0x11')],'waiting':this['waiting']};var _0x131ce3=md5(JSON[_0xb605('0x16')](_0x251829));if(this[_0xb605('0x1')]!==_0x131ce3){this[_0xb605('0x1')]=_0x131ce3;io['to'](util[_0xb605('0x17')](_0xb605('0x18'),_0x251829['name']))[_0xb605('0x19')](_0xb605('0x1a'),_0x251829);}};module[_0xb605('0x1b')]=MailQueue; \ No newline at end of file +var _0x2613=['emit','mail_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','mapAgentsId','_rr','map','paused','online','loggedIn','available','stringify','format','mail:queue:%s'];(function(_0x44b58a,_0x53f8b5){var _0x58d928=function(_0x30476d){while(--_0x30476d){_0x44b58a['push'](_0x44b58a['shift']());}};_0x58d928(++_0x53f8b5);}(_0x2613,0xc0));var _0x3261=function(_0x26b428,_0xfd42f8){_0x26b428=_0x26b428-0x0;var _0x4c187d=_0x2613[_0x26b428];return _0x4c187d;};'use strict';var _=require('lodash');var md5=require(_0x3261('0x0'));var util=require(_0x3261('0x1'));var Redis=require(_0x3261('0x2'));var config=require(_0x3261('0x3'));config[_0x3261('0x4')]=_[_0x3261('0x5')](config[_0x3261('0x4')],{'host':_0x3261('0x6'),'port':0x18eb});var io=require(_0x3261('0x7'))(new Redis(config[_0x3261('0x4')]));function MailQueue(_0x1033e9){this['id']=_0x1033e9['id']||0x0;this[_0x3261('0x8')]=_0x1033e9['name']||'';this[_0x3261('0x9')]=_0x1033e9[_0x3261('0x9')]||0xa;this[_0x3261('0xa')]=_0x1033e9[_0x3261('0xa')]||_0x3261('0xb');this[_0x3261('0xc')]=_0x1033e9[_0x3261('0xc')];this['mapAgentsId']={};this[_0x3261('0xd')]=0x0;this[_0x3261('0x0')]='';this['updateRouting']();this['updateRealtime']();}MailQueue['prototype']['updateRouting']=function(){var _0x513a6c=this[_0x3261('0xe')][_0x3261('0xf')];this['mapAgentsId']=_[_0x3261('0x10')](this[_0x3261('0xc')],'id');this['mapAgentsId'][_0x3261('0xf')]=_0x513a6c;};MailQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x3261('0x11')]=0x0;for(var _0x404dfe=0x0;_0x404dfe=0x0?this['available']:0x0;var _0xa309={'id':this['id'],'available':this[_0x3261('0x14')],'loggedIn':this[_0x3261('0x13')],'name':this['name'],'paused':this[_0x3261('0x11')],'waiting':this['waiting']};var _0x3c12bd=md5(JSON[_0x3261('0x15')](_0xa309));if(this[_0x3261('0x0')]!==_0x3c12bd){this[_0x3261('0x0')]=_0x3c12bd;io['to'](util[_0x3261('0x16')](_0x3261('0x17'),_0xa309[_0x3261('0x8')]))[_0x3261('0x18')](_0x3261('0x19'),_0xa309);}};module[_0x3261('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index b4955f7..ea33f7c 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 _0x44a0=['_rr','map','length','online','loggedIn','paused','available','stringify','format','openchannel:queue:%s','openchannel_queue:save','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype'];(function(_0x297381,_0x458b0f){var _0xb53903=function(_0x4a8ac8){while(--_0x4a8ac8){_0x297381['push'](_0x297381['shift']());}};_0xb53903(++_0x458b0f);}(_0x44a0,0x77));var _0x044a=function(_0x78632d,_0x149237){_0x78632d=_0x78632d-0x0;var _0xf510b8=_0x44a0[_0x78632d];return _0xf510b8;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x044a('0x0'));var Redis=require(_0x044a('0x1'));var config=require(_0x044a('0x2'));config[_0x044a('0x3')]=_['defaults'](config[_0x044a('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x044a('0x4'))(new Redis(config[_0x044a('0x3')]));function OpenchannelQueue(_0x4e210b){this['id']=_0x4e210b['id']||0x0;this['name']=_0x4e210b[_0x044a('0x5')]||'';this[_0x044a('0x6')]=_0x4e210b[_0x044a('0x6')]||0xa;this['strategy']=_0x4e210b[_0x044a('0x7')]||_0x044a('0x8');this[_0x044a('0x9')]=_0x4e210b[_0x044a('0x9')];this[_0x044a('0xa')]={};this[_0x044a('0xb')]=0x0;this[_0x044a('0xc')]='';this[_0x044a('0xd')]();this[_0x044a('0xe')]();}OpenchannelQueue[_0x044a('0xf')][_0x044a('0xd')]=function(){var _0x182a0c=this[_0x044a('0xa')][_0x044a('0x10')];this[_0x044a('0xa')]=_[_0x044a('0x11')](this[_0x044a('0x9')],'id');this[_0x044a('0xa')][_0x044a('0x10')]=_0x182a0c;};OpenchannelQueue[_0x044a('0xf')][_0x044a('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x49d031=0x0;_0x49d031=0x0?this['available']:0x0;var _0x2aa374={'id':this['id'],'available':this[_0x044a('0x16')],'loggedIn':this[_0x044a('0x14')],'name':this['name'],'paused':this[_0x044a('0x15')],'waiting':this[_0x044a('0xb')]};var _0x5b3420=md5(JSON[_0x044a('0x17')](_0x2aa374));if(this[_0x044a('0xc')]!==_0x5b3420){this[_0x044a('0xc')]=_0x5b3420;io['to'](util[_0x044a('0x18')](_0x044a('0x19'),_0x2aa374[_0x044a('0x5')]))['emit'](_0x044a('0x1a'),_0x2aa374);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x27b1=['_rr','map','paused','loggedIn','openchannelPause','available','stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId'];(function(_0x16b152,_0x103ad5){var _0x4e0dcb=function(_0x510f1d){while(--_0x510f1d){_0x16b152['push'](_0x16b152['shift']());}};_0x4e0dcb(++_0x103ad5);}(_0x27b1,0x1de));var _0x127b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x27b1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x127b('0x0'));var md5=require(_0x127b('0x1'));var util=require(_0x127b('0x2'));var Redis=require(_0x127b('0x3'));var config=require('../../../config/environment');config[_0x127b('0x4')]=_['defaults'](config['redis'],{'host':_0x127b('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x127b('0x4')]));function OpenchannelQueue(_0x3eade7){this['id']=_0x3eade7['id']||0x0;this[_0x127b('0x6')]=_0x3eade7[_0x127b('0x6')]||'';this[_0x127b('0x7')]=_0x3eade7[_0x127b('0x7')]||0xa;this[_0x127b('0x8')]=_0x3eade7[_0x127b('0x8')]||_0x127b('0x9');this['Agents']=_0x3eade7[_0x127b('0xa')];this['mapAgentsId']={};this[_0x127b('0xb')]=0x0;this[_0x127b('0x1')]='';this[_0x127b('0xc')]();this[_0x127b('0xd')]();}OpenchannelQueue[_0x127b('0xe')][_0x127b('0xc')]=function(){var _0x4d81c9=this[_0x127b('0xf')][_0x127b('0x10')];this['mapAgentsId']=_[_0x127b('0x11')](this[_0x127b('0xa')],'id');this[_0x127b('0xf')][_0x127b('0x10')]=_0x4d81c9;};OpenchannelQueue[_0x127b('0xe')][_0x127b('0xd')]=function(){this['loggedIn']=0x0;this[_0x127b('0x12')]=0x0;for(var _0x541185=0x0;_0x541185=0x0?this[_0x127b('0x15')]:0x0;var _0x7cd79a={'id':this['id'],'available':this[_0x127b('0x15')],'loggedIn':this[_0x127b('0x13')],'name':this[_0x127b('0x6')],'paused':this[_0x127b('0x12')],'waiting':this[_0x127b('0xb')]};var _0x590b24=md5(JSON[_0x127b('0x16')](_0x7cd79a));if(this[_0x127b('0x1')]!==_0x590b24){this[_0x127b('0x1')]=_0x590b24;io['to'](util[_0x127b('0x17')]('openchannel:queue:%s',_0x7cd79a[_0x127b('0x6')]))['emit'](_0x127b('0x18'),_0x7cd79a);}};module[_0x127b('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 4c6afc5..62efd9b 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 _0xcb91=['loggedIn','paused','length','online','available','stringify','sms:queue:%s','emit','sms_queue:save','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map'];(function(_0x3c4c46,_0x558f85){var _0x34edb9=function(_0x58b71a){while(--_0x58b71a){_0x3c4c46['push'](_0x3c4c46['shift']());}};_0x34edb9(++_0x558f85);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3cf4d3,_0x48065e){_0x3cf4d3=_0x3cf4d3-0x0;var _0x4e547b=_0xcb91[_0x3cf4d3];return _0x4e547b;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x1cb9('0x0'));var Redis=require(_0x1cb9('0x1'));var config=require(_0x1cb9('0x2'));config[_0x1cb9('0x3')]=_['defaults'](config[_0x1cb9('0x3')],{'host':_0x1cb9('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1cb9('0x3')]));function SmsQueue(_0x1b26cd){this['id']=_0x1b26cd['id']||0x0;this['name']=_0x1b26cd[_0x1cb9('0x5')]||'';this[_0x1cb9('0x6')]=_0x1b26cd['timeout']||0xa;this[_0x1cb9('0x7')]=_0x1b26cd[_0x1cb9('0x7')]||'beepall';this[_0x1cb9('0x8')]=_0x1b26cd['Agents'];this['mapAgentsId']={};this[_0x1cb9('0x9')]=0x0;this[_0x1cb9('0xa')]='';this[_0x1cb9('0xb')]();this[_0x1cb9('0xc')]();}SmsQueue[_0x1cb9('0xd')]['updateRouting']=function(){var _0x9b58f1=this[_0x1cb9('0xe')][_0x1cb9('0xf')];this[_0x1cb9('0xe')]=_[_0x1cb9('0x10')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x9b58f1;};SmsQueue[_0x1cb9('0xd')][_0x1cb9('0xc')]=function(){this[_0x1cb9('0x11')]=0x0;this[_0x1cb9('0x12')]=0x0;for(var _0x56884d=0x0;_0x56884d=0x0?this[_0x1cb9('0x15')]:0x0;var _0x4e1340={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1cb9('0x11')],'name':this[_0x1cb9('0x5')],'paused':this[_0x1cb9('0x12')],'waiting':this[_0x1cb9('0x9')]};var _0x280a84=md5(JSON[_0x1cb9('0x16')](_0x4e1340));if(this[_0x1cb9('0xa')]!==_0x280a84){this['md5']=_0x280a84;io['to'](util['format'](_0x1cb9('0x17'),_0x4e1340['name']))[_0x1cb9('0x18')](_0x1cb9('0x19'),_0x4e1340);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xd8b0=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x111104,_0x403420){var _0xe1ca96=function(_0x17f015){while(--_0x17f015){_0x111104['push'](_0x111104['shift']());}};_0xe1ca96(++_0x403420);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var md5=require(_0x0d8b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0d8b('0x2')]=_[_0x0d8b('0x3')](config[_0x0d8b('0x2')],{'host':_0x0d8b('0x4'),'port':0x18eb});var io=require(_0x0d8b('0x5'))(new Redis(config['redis']));function SmsQueue(_0x5e15e6){this['id']=_0x5e15e6['id']||0x0;this[_0x0d8b('0x6')]=_0x5e15e6[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5e15e6['timeout']||0xa;this[_0x0d8b('0x8')]=_0x5e15e6[_0x0d8b('0x8')]||'beepall';this[_0x0d8b('0x9')]=_0x5e15e6[_0x0d8b('0x9')];this[_0x0d8b('0xa')]={};this[_0x0d8b('0xb')]=0x0;this[_0x0d8b('0x1')]='';this[_0x0d8b('0xc')]();this[_0x0d8b('0xd')]();}SmsQueue[_0x0d8b('0xe')]['updateRouting']=function(){var _0x3c4bfa=this['mapAgentsId'][_0x0d8b('0xf')];this[_0x0d8b('0xa')]=_[_0x0d8b('0x10')](this[_0x0d8b('0x9')],'id');this[_0x0d8b('0xa')][_0x0d8b('0xf')]=_0x3c4bfa;};SmsQueue[_0x0d8b('0xe')][_0x0d8b('0xd')]=function(){this[_0x0d8b('0x11')]=0x0;this[_0x0d8b('0x12')]=0x0;for(var _0x5ad086=0x0;_0x5ad086=0x0?this[_0x0d8b('0x15')]:0x0;var _0x333674={'id':this['id'],'available':this[_0x0d8b('0x15')],'loggedIn':this[_0x0d8b('0x11')],'name':this[_0x0d8b('0x6')],'paused':this['paused'],'waiting':this[_0x0d8b('0xb')]};var _0x23d58f=md5(JSON[_0x0d8b('0x16')](_0x333674));if(this[_0x0d8b('0x1')]!==_0x23d58f){this[_0x0d8b('0x1')]=_0x23d58f;io['to'](util[_0x0d8b('0x17')](_0x0d8b('0x18'),_0x333674[_0x0d8b('0x6')]))['emit']('sms_queue:save',_0x333674);}};module[_0x0d8b('0x19')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index ab416a6..b5c151e 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 _0x4286=['md5','util','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','whatsappPause','available','paused','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash'];(function(_0x17a4aa,_0x5c72c7){var _0x485504=function(_0x3edc4f){while(--_0x3edc4f){_0x17a4aa['push'](_0x17a4aa['shift']());}};_0x485504(++_0x5c72c7);}(_0x4286,0x149));var _0x6428=function(_0x4d2ac8,_0x5597bc){_0x4d2ac8=_0x4d2ac8-0x0;var _0x555ffa=_0x4286[_0x4d2ac8];return _0x555ffa;};'use strict';var _=require(_0x6428('0x0'));var md5=require(_0x6428('0x1'));var util=require(_0x6428('0x2'));var Redis=require('ioredis');var config=require(_0x6428('0x3'));config['redis']=_[_0x6428('0x4')](config[_0x6428('0x5')],{'host':_0x6428('0x6'),'port':0x18eb});var io=require(_0x6428('0x7'))(new Redis(config[_0x6428('0x5')]));function WhatsappQueue(_0xebba1a){this['id']=_0xebba1a['id']||0x0;this[_0x6428('0x8')]=_0xebba1a[_0x6428('0x8')]||'';this['timeout']=_0xebba1a['timeout']||0xa;this[_0x6428('0x9')]=_0xebba1a['strategy']||_0x6428('0xa');this['Agents']=_0xebba1a[_0x6428('0xb')];this[_0x6428('0xc')]={};this[_0x6428('0xd')]=0x0;this[_0x6428('0x1')]='';this['updateRouting']();this[_0x6428('0xe')]();}WhatsappQueue[_0x6428('0xf')][_0x6428('0x10')]=function(){var _0x528e44=this['mapAgentsId'][_0x6428('0x11')];this[_0x6428('0xc')]=_[_0x6428('0x12')](this[_0x6428('0xb')],'id');this[_0x6428('0xc')][_0x6428('0x11')]=_0x528e44;};WhatsappQueue[_0x6428('0xf')][_0x6428('0xe')]=function(){this[_0x6428('0x13')]=0x0;this['paused']=0x0;for(var _0x3d86d3=0x0;_0x3d86d3=0x0?this['available']:0x0;var _0x50308a={'id':this['id'],'available':this[_0x6428('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x6428('0x8')],'paused':this[_0x6428('0x18')],'waiting':this[_0x6428('0xd')]};var _0x228e21=md5(JSON[_0x6428('0x19')](_0x50308a));if(this[_0x6428('0x1')]!==_0x228e21){this[_0x6428('0x1')]=_0x228e21;io['to'](util[_0x6428('0x1a')](_0x6428('0x1b'),_0x50308a['name']))['emit'](_0x6428('0x1c'),_0x50308a);}};module[_0x6428('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0xc51f=['whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','map','_rr','paused','length','loggedIn','available'];(function(_0x15f6f7,_0x305040){var _0x37c435=function(_0x51929b){while(--_0x51929b){_0x15f6f7['push'](_0x15f6f7['shift']());}};_0x37c435(++_0x305040);}(_0xc51f,0xc1));var _0xfc51=function(_0x3db0ba,_0x2be65c){_0x3db0ba=_0x3db0ba-0x0;var _0x2d8e9a=_0xc51f[_0x3db0ba];return _0x2d8e9a;};'use strict';var _=require(_0xfc51('0x0'));var md5=require('md5');var util=require(_0xfc51('0x1'));var Redis=require(_0xfc51('0x2'));var config=require(_0xfc51('0x3'));config['redis']=_['defaults'](config[_0xfc51('0x4')],{'host':_0xfc51('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfc51('0x4')]));function WhatsappQueue(_0x3ccda6){this['id']=_0x3ccda6['id']||0x0;this[_0xfc51('0x6')]=_0x3ccda6[_0xfc51('0x6')]||'';this[_0xfc51('0x7')]=_0x3ccda6[_0xfc51('0x7')]||0xa;this['strategy']=_0x3ccda6[_0xfc51('0x8')]||_0xfc51('0x9');this[_0xfc51('0xa')]=_0x3ccda6[_0xfc51('0xa')];this[_0xfc51('0xb')]={};this[_0xfc51('0xc')]=0x0;this[_0xfc51('0xd')]='';this[_0xfc51('0xe')]();this[_0xfc51('0xf')]();}WhatsappQueue[_0xfc51('0x10')]['updateRouting']=function(){var _0x455006=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0xfc51('0x11')](this[_0xfc51('0xa')],'id');this[_0xfc51('0xb')][_0xfc51('0x12')]=_0x455006;};WhatsappQueue['prototype'][_0xfc51('0xf')]=function(){this['loggedIn']=0x0;this[_0xfc51('0x13')]=0x0;for(var _0x45ccf1=0x0;_0x45ccf1=0x0?this['available']:0x0;var _0xf50273={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xfc51('0x6')],'paused':this[_0xfc51('0x13')],'waiting':this[_0xfc51('0xc')]};var _0x5f29bb=md5(JSON['stringify'](_0xf50273));if(this[_0xfc51('0xd')]!==_0x5f29bb){this[_0xfc51('0xd')]=_0x5f29bb;io['to'](util['format'](_0xfc51('0x17'),_0xf50273[_0xfc51('0x6')]))[_0xfc51('0x18')](_0xfc51('0x19'),_0xf50273);}};module[_0xfc51('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 198a9c1..180fc23 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 _0x00bb=['openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','agents','intervals','updateRealtime','initSmsQueues','updateRouting','initMailQueues','initWhatsappQueues','exports','bluebird','util','lodash','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/mailQueue','../model/faxQueue'];(function(_0x2000c8,_0x5bfe96){var _0x4f3ec8=function(_0x552cbd){while(--_0x552cbd){_0x2000c8['push'](_0x2000c8['shift']());}};_0x4f3ec8(++_0x5bfe96);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x00bb[_0x5c351c];return _0x26f3b3;};'use strict';var BPromise=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var _=require(_0xb00b('0x2'));var moment=require('moment');var Agent=require(_0xb00b('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xb00b('0x4'));var ChatQueue=require(_0xb00b('0x5'));var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0xb00b('0x6'));var FaxQueue=require(_0xb00b('0x7'));var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this['agents']={};this['intervals']={};this[_0xb00b('0x8')]={};this[_0xb00b('0x9')]={};this[_0xb00b('0xa')]={};this[_0xb00b('0xb')]={};this[_0xb00b('0xc')]={};this[_0xb00b('0xd')]={};this['chatQueuesWaitingInteractions']={};this['mailQueuesWaitingInteractions']={};this[_0xb00b('0xe')]={};this[_0xb00b('0xf')]={};this[_0xb00b('0x10')]={};this[_0xb00b('0x11')]={};};function freeIsNotKey(_0x28d3cc,_0x48e125,_0x3182db){var _0x5a63ed=_['mapKeys'](_0x28d3cc,function(_0x594075,_0x4ff792){return _0x594075[_0x3182db];});for(var _0x2d8ddf in _0x48e125){if(_0x48e125[_0xb00b('0x12')](_0x2d8ddf)){if(!_0x5a63ed[_0x2d8ddf]){delete _0x48e125[_0x2d8ddf];}}}}Realtime[_0xb00b('0x13')][_0xb00b('0x14')]=function(_0x1f1c1d,_0x4ada81){for(var _0x218de2 in _0x4ada81){if(_0x1f1c1d[_0xb00b('0x12')](_0x218de2)){_0x1f1c1d[_0x218de2]=_0x4ada81[_0x218de2];}}};Realtime['prototype'][_0xb00b('0x15')]=function(){var _0x1084a6=this;return function(_0x540b79){if(_0x540b79){freeIsNotKey(_0x540b79,_0x1084a6['agents'],'id');for(var _0x9b471e=0x0,_0x4dcd45={},_0x51d136={};_0x9b471e<_0x540b79[_0xb00b('0x16')];_0x9b471e+=0x1){_0x4dcd45=_0x540b79[_0x9b471e];if(_[_0xb00b('0x17')](_0x1084a6[_0xb00b('0x18')][_0x4dcd45['id']])){_0x1084a6[_0xb00b('0x18')][_0x4dcd45['id']]=new Agent(_0x4dcd45);}else{_0x1084a6['mergeFromDatabase'](_0x1084a6[_0xb00b('0x18')][_0x4dcd45['id']],_0x4dcd45);}}}return _0x1084a6['agents'];};};Realtime[_0xb00b('0x13')]['initIntervals']=function(){var _0x25d7a0=this;return function(_0x5e8d7b){if(_0x5e8d7b){freeIsNotKey(_0x5e8d7b,_0x25d7a0[_0xb00b('0x19')],'id');for(var _0x3355a3=0x0,_0x53ee68={},_0x55770c={};_0x3355a3<_0x5e8d7b[_0xb00b('0x16')];_0x3355a3+=0x1){_0x53ee68=_0x5e8d7b[_0x3355a3];if(_['isUndefined'](_0x25d7a0[_0xb00b('0x19')][_0x53ee68['id']])){_0x25d7a0[_0xb00b('0x19')][_0x53ee68['id']]=new Interval(_0x53ee68);}else{_0x25d7a0[_0xb00b('0x14')](_0x25d7a0[_0xb00b('0x19')][_0x53ee68['id']],_0x53ee68);}}}return _0x25d7a0['intervals'];};};Realtime[_0xb00b('0x13')]['initOpenchannelQueues']=function(){var _0x25a973=this;return function(_0x121ec7){if(_0x121ec7){freeIsNotKey(_0x121ec7,_0x25a973['openchannelQueues'],'id');for(var _0x231293=0x0,_0x2896d1={},_0x520444={};_0x231293<_0x121ec7[_0xb00b('0x16')];_0x231293+=0x1){_0x2896d1=_0x121ec7[_0x231293];if(_[_0xb00b('0x17')](_0x25a973['openchannelQueues'][_0x2896d1['id']])){_0x25a973[_0xb00b('0x8')][_0x2896d1['id']]=new OpenchannelQueue(_0x2896d1);}else{_0x25a973[_0xb00b('0x14')](_0x25a973[_0xb00b('0x8')][_0x2896d1['id']],_0x2896d1);}_0x25a973[_0xb00b('0x8')][_0x2896d1['id']]['updateRouting']();_0x25a973['openchannelQueues'][_0x2896d1['id']][_0xb00b('0x1a')]();}}return _0x25a973['openchannelQueues'];};};Realtime['prototype']['initChatQueues']=function(){var _0x16ac55=this;return function(_0x73b6b0){if(_0x73b6b0){freeIsNotKey(_0x73b6b0,_0x16ac55[_0xb00b('0x9')],'id');for(var _0x3825af=0x0,_0x1f14fa={},_0x197379={};_0x3825af<_0x73b6b0[_0xb00b('0x16')];_0x3825af+=0x1){_0x1f14fa=_0x73b6b0[_0x3825af];if(_['isUndefined'](_0x16ac55[_0xb00b('0x9')][_0x1f14fa['id']])){_0x16ac55['chatQueues'][_0x1f14fa['id']]=new ChatQueue(_0x1f14fa);}else{_0x16ac55[_0xb00b('0x14')](_0x16ac55[_0xb00b('0x9')][_0x1f14fa['id']],_0x1f14fa);}_0x16ac55[_0xb00b('0x9')][_0x1f14fa['id']]['updateRouting']();_0x16ac55[_0xb00b('0x9')][_0x1f14fa['id']][_0xb00b('0x1a')]();}}return _0x16ac55[_0xb00b('0x9')];};};Realtime[_0xb00b('0x13')][_0xb00b('0x1b')]=function(){var _0x2b9824=this;return function(_0x2e160a){if(_0x2e160a){freeIsNotKey(_0x2e160a,_0x2b9824[_0xb00b('0xa')],'id');for(var _0x149c1a=0x0,_0x54e247={},_0x2b5f41={};_0x149c1a<_0x2e160a[_0xb00b('0x16')];_0x149c1a+=0x1){_0x54e247=_0x2e160a[_0x149c1a];if(_['isUndefined'](_0x2b9824[_0xb00b('0xa')][_0x54e247['id']])){_0x2b9824[_0xb00b('0xa')][_0x54e247['id']]=new SmsQueue(_0x54e247);}else{_0x2b9824['mergeFromDatabase'](_0x2b9824[_0xb00b('0xa')][_0x54e247['id']],_0x54e247);}_0x2b9824['smsQueues'][_0x54e247['id']][_0xb00b('0x1c')]();_0x2b9824[_0xb00b('0xa')][_0x54e247['id']][_0xb00b('0x1a')]();}}return _0x2b9824[_0xb00b('0xa')];};};Realtime[_0xb00b('0x13')][_0xb00b('0x1d')]=function(){var _0x17f613=this;return function(_0x594840){if(_0x594840){freeIsNotKey(_0x594840,_0x17f613['mailQueues'],'id');for(var _0x5b04c2=0x0,_0x347e73={},_0xc21102={};_0x5b04c2<_0x594840[_0xb00b('0x16')];_0x5b04c2+=0x1){_0x347e73=_0x594840[_0x5b04c2];if(_[_0xb00b('0x17')](_0x17f613['mailQueues'][_0x347e73['id']])){_0x17f613[_0xb00b('0xb')][_0x347e73['id']]=new MailQueue(_0x347e73);}else{_0x17f613[_0xb00b('0x14')](_0x17f613[_0xb00b('0xb')][_0x347e73['id']],_0x347e73);}_0x17f613[_0xb00b('0xb')][_0x347e73['id']][_0xb00b('0x1c')]();_0x17f613[_0xb00b('0xb')][_0x347e73['id']][_0xb00b('0x1a')]();}}return _0x17f613[_0xb00b('0xb')];};};Realtime['prototype']['initFaxQueues']=function(){var _0x2ea41d=this;return function(_0x56022e){if(_0x56022e){freeIsNotKey(_0x56022e,_0x2ea41d[_0xb00b('0xc')],'id');for(var _0x1c5400=0x0,_0x29579b={},_0x45ca74={};_0x1c5400<_0x56022e[_0xb00b('0x16')];_0x1c5400+=0x1){_0x29579b=_0x56022e[_0x1c5400];if(_[_0xb00b('0x17')](_0x2ea41d[_0xb00b('0xc')][_0x29579b['id']])){_0x2ea41d['faxQueues'][_0x29579b['id']]=new FaxQueue(_0x29579b);}else{_0x2ea41d[_0xb00b('0x14')](_0x2ea41d[_0xb00b('0xc')][_0x29579b['id']],_0x29579b);}_0x2ea41d[_0xb00b('0xc')][_0x29579b['id']][_0xb00b('0x1c')]();_0x2ea41d[_0xb00b('0xc')][_0x29579b['id']][_0xb00b('0x1a')]();}}return _0x2ea41d['faxQueues'];};};Realtime[_0xb00b('0x13')][_0xb00b('0x1e')]=function(){var _0x4801e7=this;return function(_0x17ff34){if(_0x17ff34){freeIsNotKey(_0x17ff34,_0x4801e7[_0xb00b('0xd')],'id');for(var _0xa2ae04=0x0,_0x2d8620={},_0x2954e8={};_0xa2ae04<_0x17ff34['length'];_0xa2ae04+=0x1){_0x2d8620=_0x17ff34[_0xa2ae04];if(_[_0xb00b('0x17')](_0x4801e7[_0xb00b('0xd')][_0x2d8620['id']])){_0x4801e7[_0xb00b('0xd')][_0x2d8620['id']]=new WhatsappQueue(_0x2d8620);}else{_0x4801e7[_0xb00b('0x14')](_0x4801e7['whatsappQueues'][_0x2d8620['id']],_0x2d8620);}_0x4801e7['whatsappQueues'][_0x2d8620['id']][_0xb00b('0x1c')]();_0x4801e7[_0xb00b('0xd')][_0x2d8620['id']][_0xb00b('0x1a')]();}}return _0x4801e7[_0xb00b('0xd')];};};module[_0xb00b('0x1f')]=Realtime; \ No newline at end of file +var _0xa41a=['../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','agents','intervals','smsQueues','mailQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','openchannelQueues','initChatQueues','chatQueues','initSmsQueues','updateRouting','updateRealtime','initFaxQueues','faxQueues','bluebird','util','moment','../model/agent'];(function(_0x3047e7,_0xc64826){var _0x572aca=function(_0x366ea4){while(--_0x366ea4){_0x3047e7['push'](_0x3047e7['shift']());}};_0x572aca(++_0xc64826);}(_0xa41a,0x6b));var _0xaa41=function(_0x5224f1,_0x1f1256){_0x5224f1=_0x5224f1-0x0;var _0x3bea9c=_0xa41a[_0x5224f1];return _0x3bea9c;};'use strict';var BPromise=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var _=require('lodash');var moment=require(_0xaa41('0x2'));var Agent=require(_0xaa41('0x3'));var Interval=require(_0xaa41('0x4'));var OpenchannelQueue=require(_0xaa41('0x5'));var ChatQueue=require(_0xaa41('0x6'));var SmsQueue=require(_0xaa41('0x7'));var MailQueue=require(_0xaa41('0x8'));var FaxQueue=require(_0xaa41('0x9'));var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this[_0xaa41('0xa')]={};this[_0xaa41('0xb')]={};this['openchannelQueues']={};this['chatQueues']={};this[_0xaa41('0xc')]={};this[_0xaa41('0xd')]={};this['faxQueues']={};this[_0xaa41('0xe')]={};this[_0xaa41('0xf')]={};this[_0xaa41('0x10')]={};this[_0xaa41('0x11')]={};this[_0xaa41('0x12')]={};this[_0xaa41('0x13')]={};this[_0xaa41('0x14')]={};};function freeIsNotKey(_0x423a19,_0x1c291e,_0x5c9fc7){var _0x1d3aac=_[_0xaa41('0x15')](_0x423a19,function(_0x524cab,_0x54827c){return _0x524cab[_0x5c9fc7];});for(var _0x1d0a54 in _0x1c291e){if(_0x1c291e['hasOwnProperty'](_0x1d0a54)){if(!_0x1d3aac[_0x1d0a54]){delete _0x1c291e[_0x1d0a54];}}}}Realtime[_0xaa41('0x16')][_0xaa41('0x17')]=function(_0x2f64bc,_0x889d44){for(var _0x6f9ade in _0x889d44){if(_0x2f64bc['hasOwnProperty'](_0x6f9ade)){_0x2f64bc[_0x6f9ade]=_0x889d44[_0x6f9ade];}}};Realtime[_0xaa41('0x16')][_0xaa41('0x18')]=function(){var _0x1934e9=this;return function(_0x1ef7d9){if(_0x1ef7d9){freeIsNotKey(_0x1ef7d9,_0x1934e9[_0xaa41('0xa')],'id');for(var _0x2005ae=0x0,_0x1e1e02={},_0x550ad5={};_0x2005ae<_0x1ef7d9[_0xaa41('0x19')];_0x2005ae+=0x1){_0x1e1e02=_0x1ef7d9[_0x2005ae];if(_[_0xaa41('0x1a')](_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']])){_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']]=new Agent(_0x1e1e02);}else{_0x1934e9[_0xaa41('0x17')](_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']],_0x1e1e02);}}}return _0x1934e9[_0xaa41('0xa')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1b')]=function(){var _0x4fe1a4=this;return function(_0x5cd936){if(_0x5cd936){freeIsNotKey(_0x5cd936,_0x4fe1a4[_0xaa41('0xb')],'id');for(var _0x22de55=0x0,_0x35c753={},_0x54c488={};_0x22de55<_0x5cd936[_0xaa41('0x19')];_0x22de55+=0x1){_0x35c753=_0x5cd936[_0x22de55];if(_[_0xaa41('0x1a')](_0x4fe1a4['intervals'][_0x35c753['id']])){_0x4fe1a4['intervals'][_0x35c753['id']]=new Interval(_0x35c753);}else{_0x4fe1a4[_0xaa41('0x17')](_0x4fe1a4['intervals'][_0x35c753['id']],_0x35c753);}}}return _0x4fe1a4[_0xaa41('0xb')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1c')]=function(){var _0x1f27f3=this;return function(_0x1d623c){if(_0x1d623c){freeIsNotKey(_0x1d623c,_0x1f27f3['openchannelQueues'],'id');for(var _0x43c430=0x0,_0x43a85c={},_0x448a21={};_0x43c430<_0x1d623c[_0xaa41('0x19')];_0x43c430+=0x1){_0x43a85c=_0x1d623c[_0x43c430];if(_[_0xaa41('0x1a')](_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']])){_0x1f27f3['openchannelQueues'][_0x43a85c['id']]=new OpenchannelQueue(_0x43a85c);}else{_0x1f27f3['mergeFromDatabase'](_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']],_0x43a85c);}_0x1f27f3['openchannelQueues'][_0x43a85c['id']]['updateRouting']();_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']]['updateRealtime']();}}return _0x1f27f3['openchannelQueues'];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1e')]=function(){var _0x392214=this;return function(_0x632fd2){if(_0x632fd2){freeIsNotKey(_0x632fd2,_0x392214[_0xaa41('0x1f')],'id');for(var _0xa7269f=0x0,_0x57ef96={},_0x30a174={};_0xa7269f<_0x632fd2[_0xaa41('0x19')];_0xa7269f+=0x1){_0x57ef96=_0x632fd2[_0xa7269f];if(_[_0xaa41('0x1a')](_0x392214[_0xaa41('0x1f')][_0x57ef96['id']])){_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]=new ChatQueue(_0x57ef96);}else{_0x392214[_0xaa41('0x17')](_0x392214[_0xaa41('0x1f')][_0x57ef96['id']],_0x57ef96);}_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]['updateRouting']();_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]['updateRealtime']();}}return _0x392214['chatQueues'];};};Realtime[_0xaa41('0x16')][_0xaa41('0x20')]=function(){var _0x534a85=this;return function(_0x392b5d){if(_0x392b5d){freeIsNotKey(_0x392b5d,_0x534a85[_0xaa41('0xc')],'id');for(var _0x4e3b44=0x0,_0x5022fb={},_0x5c25fb={};_0x4e3b44<_0x392b5d[_0xaa41('0x19')];_0x4e3b44+=0x1){_0x5022fb=_0x392b5d[_0x4e3b44];if(_[_0xaa41('0x1a')](_0x534a85[_0xaa41('0xc')][_0x5022fb['id']])){_0x534a85[_0xaa41('0xc')][_0x5022fb['id']]=new SmsQueue(_0x5022fb);}else{_0x534a85['mergeFromDatabase'](_0x534a85[_0xaa41('0xc')][_0x5022fb['id']],_0x5022fb);}_0x534a85[_0xaa41('0xc')][_0x5022fb['id']][_0xaa41('0x21')]();_0x534a85['smsQueues'][_0x5022fb['id']][_0xaa41('0x22')]();}}return _0x534a85[_0xaa41('0xc')];};};Realtime[_0xaa41('0x16')]['initMailQueues']=function(){var _0x252c62=this;return function(_0x374117){if(_0x374117){freeIsNotKey(_0x374117,_0x252c62['mailQueues'],'id');for(var _0x23eb50=0x0,_0x13b6d4={},_0x2298ed={};_0x23eb50<_0x374117['length'];_0x23eb50+=0x1){_0x13b6d4=_0x374117[_0x23eb50];if(_[_0xaa41('0x1a')](_0x252c62['mailQueues'][_0x13b6d4['id']])){_0x252c62[_0xaa41('0xd')][_0x13b6d4['id']]=new MailQueue(_0x13b6d4);}else{_0x252c62[_0xaa41('0x17')](_0x252c62[_0xaa41('0xd')][_0x13b6d4['id']],_0x13b6d4);}_0x252c62['mailQueues'][_0x13b6d4['id']]['updateRouting']();_0x252c62['mailQueues'][_0x13b6d4['id']][_0xaa41('0x22')]();}}return _0x252c62[_0xaa41('0xd')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x23')]=function(){var _0x4fbb92=this;return function(_0x53a2e4){if(_0x53a2e4){freeIsNotKey(_0x53a2e4,_0x4fbb92[_0xaa41('0x24')],'id');for(var _0x5673c=0x0,_0x951e52={},_0x4e8d2e={};_0x5673c<_0x53a2e4[_0xaa41('0x19')];_0x5673c+=0x1){_0x951e52=_0x53a2e4[_0x5673c];if(_[_0xaa41('0x1a')](_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']])){_0x4fbb92['faxQueues'][_0x951e52['id']]=new FaxQueue(_0x951e52);}else{_0x4fbb92[_0xaa41('0x17')](_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']],_0x951e52);}_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']][_0xaa41('0x21')]();_0x4fbb92['faxQueues'][_0x951e52['id']]['updateRealtime']();}}return _0x4fbb92[_0xaa41('0x24')];};};Realtime[_0xaa41('0x16')]['initWhatsappQueues']=function(){var _0x4101ab=this;return function(_0x563687){if(_0x563687){freeIsNotKey(_0x563687,_0x4101ab[_0xaa41('0xe')],'id');for(var _0x25f2df=0x0,_0x1a2d11={},_0x466eee={};_0x25f2df<_0x563687[_0xaa41('0x19')];_0x25f2df+=0x1){_0x1a2d11=_0x563687[_0x25f2df];if(_[_0xaa41('0x1a')](_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']])){_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']]=new WhatsappQueue(_0x1a2d11);}else{_0x4101ab['mergeFromDatabase'](_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']],_0x1a2d11);}_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']][_0xaa41('0x21')]();_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']][_0xaa41('0x22')]();}}return _0x4101ab[_0xaa41('0xe')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index b679f9e..3255893 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 _0x2da7=['updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction'];(function(_0xa07152,_0x7d2cd4){var _0x1152f2=function(_0x54183a){while(--_0x54183a){_0xa07152['push'](_0xa07152['shift']());}};_0x1152f2(++_0x7d2cd4);}(_0x2da7,0x81));var _0x72da=function(_0x1bcb45,_0x25bd7d){_0x1bcb45=_0x1bcb45-0x0;var _0x4a4c33=_0x2da7[_0x1bcb45];return _0x4a4c33;};'use strict';var client=require(_0x72da('0x0'));exports[_0x72da('0x1')]=function(_0x521cb1,_0xf2a5e6){return client[_0x72da('0x2')](_0x72da('0x3'),{'body':_0xf2a5e6,'options':{'where':{'id':_0x521cb1}},'log':_0x72da('0x4')});};exports['addTags']=function(_0x2a348f,_0x31186e){return client['Request'](_0x72da('0x5'),{'body':_0x31186e,'options':{'where':{'id':_0x2a348f}},'log':_0x72da('0x6')});}; \ No newline at end of file +var _0xb094=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','../client'];(function(_0x24e48c,_0x3b6352){var _0x5be973=function(_0x3b176e){while(--_0x3b176e){_0x24e48c['push'](_0x24e48c['shift']());}};_0x5be973(++_0x3b6352);}(_0xb094,0x1f1));var _0x4b09=function(_0x2c39c3,_0x3d9848){_0x2c39c3=_0x2c39c3-0x0;var _0x74f703=_0xb094[_0x2c39c3];return _0x74f703;};'use strict';var client=require(_0x4b09('0x0'));exports[_0x4b09('0x1')]=function(_0x1b6f40,_0x17e492){return client[_0x4b09('0x2')](_0x4b09('0x3'),{'body':_0x17e492,'options':{'where':{'id':_0x1b6f40}},'log':_0x4b09('0x4')});};exports[_0x4b09('0x5')]=function(_0x990175,_0x484e97){return client[_0x4b09('0x2')]('AddTagsToChatInteraction',{'body':_0x484e97,'options':{'where':{'id':_0x990175}},'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 ed8a07d..c8302b8 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 _0x0e48=['CreateChatMessage','createChatMessage','Request'];(function(_0x2a0b48,_0x1573f3){var _0x2d0297=function(_0x50832d){while(--_0x50832d){_0x2a0b48['push'](_0x2a0b48['shift']());}};_0x2d0297(++_0x1573f3);}(_0x0e48,0x143));var _0x80e4=function(_0x196495,_0x483d34){_0x196495=_0x196495-0x0;var _0x467233=_0x0e48[_0x196495];return _0x467233;};'use strict';var client=require('../client');exports['create']=function(_0x2ff27e){return client[_0x80e4('0x0')](_0x80e4('0x1'),{'body':_0x2ff27e,'log':_0x80e4('0x2')});}; \ No newline at end of file +var _0x7087=['createChatMessage'];(function(_0x4607e1,_0x1b8d24){var _0x7a18c0=function(_0x1deae4){while(--_0x1deae4){_0x4607e1['push'](_0x4607e1['shift']());}};_0x7a18c0(++_0x1b8d24);}(_0x7087,0x1bd));var _0x7708=function(_0x1b1e7c,_0x5ac786){_0x1b1e7c=_0x1b1e7c-0x0;var _0x26c9e4=_0x7087[_0x1b1e7c];return _0x26c9e4;};'use strict';var client=require('../client');exports['create']=function(_0x12a8fb){return client['Request']('CreateChatMessage',{'body':_0x12a8fb,'log':_0x7708('0x0')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 91c7ea4..0a4cd17 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 _0xde94=['User','Agents','../client','getChatQueues','GetChatQueue','name','timeout','strategy'];(function(_0xdd27d1,_0xb6f0da){var _0x58220e=function(_0x52bbff){while(--_0x52bbff){_0xdd27d1['push'](_0xdd27d1['shift']());}};_0x58220e(++_0xb6f0da);}(_0xde94,0xaa));var _0x4de9=function(_0x35ec33,_0x31dfa1){_0x35ec33=_0x35ec33-0x0;var _0x18c22e=_0xde94[_0x35ec33];return _0x18c22e;};'use strict';var client=require(_0x4de9('0x0'));exports[_0x4de9('0x1')]=function(){return function(){return client['Request'](_0x4de9('0x2'),{'options':{'raw':![],'attributes':['id',_0x4de9('0x3'),_0x4de9('0x4'),_0x4de9('0x5')],'include':[{'model':_0x4de9('0x6'),'as':_0x4de9('0x7'),'attributes':['id',_0x4de9('0x3'),'online','chatPause']}]},'log':_0x4de9('0x1')});};}; \ No newline at end of file +var _0x5de4=['../client','getChatQueues','Request','GetChatQueue','timeout','strategy','Agents','name','online'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x5de4,0x1b0));var _0x45de=function(_0x196edc,_0x2867b2){_0x196edc=_0x196edc-0x0;var _0x454c26=_0x5de4[_0x196edc];return _0x454c26;};'use strict';var client=require(_0x45de('0x0'));exports[_0x45de('0x1')]=function(){return function(){return client[_0x45de('0x2')](_0x45de('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x45de('0x4'),_0x45de('0x5')],'include':[{'model':'User','as':_0x45de('0x6'),'attributes':['id',_0x45de('0x7'),_0x45de('0x8'),'chatPause']}]},'log':_0x45de('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 8dc984f..8c1b17d 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 _0x5127=['update','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x1569e0,_0x287637){var _0x507fa4=function(_0x2998a5){while(--_0x2998a5){_0x1569e0['push'](_0x1569e0['shift']());}};_0x507fa4(++_0x287637);}(_0x5127,0x18f));var _0x7512=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5127[_0x502c7d];return _0x30b7ed;};'use strict';var client=require(_0x7512('0x0'));exports[_0x7512('0x1')]=function(_0x3abf2c){return client[_0x7512('0x2')]('CreateChatQueueReport',{'body':_0x3abf2c,'log':'CreateChatQueueReport'});};exports[_0x7512('0x3')]=function(_0x58a754,_0x3fbca7){return client[_0x7512('0x2')](_0x7512('0x4'),{'body':_0x3fbca7,'options':{'where':{'uniqueid':_0x58a754},'order':[['id',_0x7512('0x5')]],'limit':0x1},'log':_0x7512('0x4')});}; \ No newline at end of file +var _0x8a1b=['UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport'];(function(_0x447ec0,_0x98a7ec){var _0x30e572=function(_0x178b4c){while(--_0x178b4c){_0x447ec0['push'](_0x447ec0['shift']());}};_0x30e572(++_0x98a7ec);}(_0x8a1b,0xf8));var _0xb8a1=function(_0x184bfa,_0x2fdf77){_0x184bfa=_0x184bfa-0x0;var _0x47999b=_0x8a1b[_0x184bfa];return _0x47999b;};'use strict';var client=require(_0xb8a1('0x0'));exports[_0xb8a1('0x1')]=function(_0x50a877){return client[_0xb8a1('0x2')](_0xb8a1('0x3'),{'body':_0x50a877,'log':'CreateChatQueueReport'});};exports['update']=function(_0x3784e8,_0x3b6246){return client[_0xb8a1('0x2')](_0xb8a1('0x4'),{'body':_0x3b6246,'options':{'where':{'uniqueid':_0x3784e8},'order':[['id',_0xb8a1('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 47ce172..3f133db 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 _0x02d2=['update','Request','UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction','../client'];(function(_0x47f1ac,_0x58a91c){var _0x1b1379=function(_0x4e6d14){while(--_0x4e6d14){_0x47f1ac['push'](_0x47f1ac['shift']());}};_0x1b1379(++_0x58a91c);}(_0x02d2,0x11e));var _0x202d=function(_0x27e231,_0x5c71e8){_0x27e231=_0x27e231-0x0;var _0x2b3cf1=_0x02d2[_0x27e231];return _0x2b3cf1;};'use strict';var client=require(_0x202d('0x0'));exports[_0x202d('0x1')]=function(_0x3cffe3,_0x52aeba){return client[_0x202d('0x2')](_0x202d('0x3'),{'body':_0x52aeba,'options':{'where':{'id':_0x3cffe3}},'log':_0x202d('0x4')});};exports[_0x202d('0x5')]=function(_0x36dc97,_0x3aca32){return client['Request'](_0x202d('0x6'),{'body':_0x3aca32,'options':{'where':{'id':_0x36dc97}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0xcb7f=['updateFaxInteraction','addTags','Request','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction'];(function(_0x43f9ac,_0x279c97){var _0x5e7fb4=function(_0x31408c){while(--_0x31408c){_0x43f9ac['push'](_0x43f9ac['shift']());}};_0x5e7fb4(++_0x279c97);}(_0xcb7f,0xa5));var _0xfcb7=function(_0x560514,_0x1e71b0){_0x560514=_0x560514-0x0;var _0x187b23=_0xcb7f[_0x560514];return _0x187b23;};'use strict';var client=require(_0xfcb7('0x0'));exports[_0xfcb7('0x1')]=function(_0x52a511,_0x2673db){return client['Request'](_0xfcb7('0x2'),{'body':_0x2673db,'options':{'where':{'id':_0x52a511}},'log':_0xfcb7('0x3')});};exports[_0xfcb7('0x4')]=function(_0x1a0789,_0x4b2cfb){return client[_0xfcb7('0x5')]('AddTagsToFaxInteraction',{'body':_0x4b2cfb,'options':{'where':{'id':_0x1a0789}},'log':_0xfcb7('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 5afde68..f762e1b 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 _0x86f9=['CreateFaxMessage','createFaxMessage','create','Request'];(function(_0x38cda0,_0x34eb18){var _0x10cf26=function(_0x5e335d){while(--_0x5e335d){_0x38cda0['push'](_0x38cda0['shift']());}};_0x10cf26(++_0x34eb18);}(_0x86f9,0x66));var _0x986f=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0x86f9[_0x2601b4];return _0x3e3661;};'use strict';var client=require('../client');exports[_0x986f('0x0')]=function(_0x5c16d2){return client[_0x986f('0x1')](_0x986f('0x2'),{'body':_0x5c16d2,'log':_0x986f('0x3')});}; \ No newline at end of file +var _0x8ce2=['create','../client'];(function(_0x55522e,_0x598c57){var _0x160054=function(_0x387b2a){while(--_0x387b2a){_0x55522e['push'](_0x55522e['shift']());}};_0x160054(++_0x598c57);}(_0x8ce2,0x6f));var _0x28ce=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x8ce2[_0x58afd5];return _0x3e503b;};'use strict';var client=require(_0x28ce('0x0'));exports[_0x28ce('0x1')]=function(_0x17fd4d){return client['Request']('CreateFaxMessage',{'body':_0x17fd4d,'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 df645b7..023b4c8 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 _0x2384=['../client','getFaxQueues','Request','name','timeout','strategy','Agents','online','faxPause'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0x2384,0x90));var _0x4238=function(_0x214f58,_0x5a462d){_0x214f58=_0x214f58-0x0;var _0x116fc0=_0x2384[_0x214f58];return _0x116fc0;};'use strict';var client=require(_0x4238('0x0'));exports[_0x4238('0x1')]=function(){return function(){return client[_0x4238('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x4238('0x3'),_0x4238('0x4'),_0x4238('0x5')],'include':[{'model':'User','as':_0x4238('0x6'),'attributes':['id',_0x4238('0x3'),_0x4238('0x7'),_0x4238('0x8')]}]},'log':_0x4238('0x1')});};}; \ No newline at end of file +var _0x2094=['Request','GetFaxQueue','name','timeout','strategy','User','Agents','online','faxPause','getFaxQueues'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0x2094,0x190));var _0x4209=function(_0x33414c,_0x36167f){_0x33414c=_0x33414c-0x0;var _0x55ee86=_0x2094[_0x33414c];return _0x55ee86;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x4209('0x0')](_0x4209('0x1'),{'options':{'raw':![],'attributes':['id',_0x4209('0x2'),_0x4209('0x3'),_0x4209('0x4')],'include':[{'model':_0x4209('0x5'),'as':_0x4209('0x6'),'attributes':['id',_0x4209('0x2'),_0x4209('0x7'),_0x4209('0x8')]}]},'log':_0x4209('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index b399066..0147396 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 _0xaa19=['DESC','../client','create','Request','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0x303986,_0x5c751c){var _0x4c4431=function(_0x161de3){while(--_0x161de3){_0x303986['push'](_0x303986['shift']());}};_0x4c4431(++_0x5c751c);}(_0xaa19,0x79));var _0x9aa1=function(_0x467dec,_0x4178f0){_0x467dec=_0x467dec-0x0;var _0x3a0189=_0xaa19[_0x467dec];return _0x3a0189;};'use strict';var client=require(_0x9aa1('0x0'));exports[_0x9aa1('0x1')]=function(_0xa7aed3){return client[_0x9aa1('0x2')]('CreateFaxQueueReport',{'body':_0xa7aed3,'log':_0x9aa1('0x3')});};exports['update']=function(_0x15dd20,_0x58fb46){return client[_0x9aa1('0x2')](_0x9aa1('0x4'),{'body':_0x58fb46,'options':{'where':{'uniqueid':_0x15dd20},'order':[['id',_0x9aa1('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x4d33=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0xb23c62,_0x40ccce){var _0xec7ab7=function(_0x3a4f00){while(--_0x3a4f00){_0xb23c62['push'](_0xb23c62['shift']());}};_0xec7ab7(++_0x40ccce);}(_0x4d33,0x140));var _0x34d3=function(_0x3792e6,_0x32bd91){_0x3792e6=_0x3792e6-0x0;var _0x441e44=_0x4d33[_0x3792e6];return _0x441e44;};'use strict';var client=require(_0x34d3('0x0'));exports[_0x34d3('0x1')]=function(_0x51db66){return client[_0x34d3('0x2')](_0x34d3('0x3'),{'body':_0x51db66,'log':_0x34d3('0x3')});};exports[_0x34d3('0x4')]=function(_0x47778d,_0x5c0626){return client['Request'](_0x34d3('0x5'),{'body':_0x5c0626,'options':{'where':{'uniqueid':_0x47778d},'order':[['id',_0x34d3('0x6')]],'limit':0x1},'log':_0x34d3('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 342103a..d350143 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 _0xb03e=['interval','getIntervals','Request','GetInterval','name','Interval','Intervals'];(function(_0x22038b,_0x3bbae5){var _0x1b5303=function(_0x1a8f5f){while(--_0x1a8f5f){_0x22038b['push'](_0x22038b['shift']());}};_0x1b5303(++_0x3bbae5);}(_0xb03e,0x1eb));var _0xeb03=function(_0x3f60d1,_0x3df38f){_0x3f60d1=_0x3f60d1-0x0;var _0x20d4ed=_0xb03e[_0x3f60d1];return _0x20d4ed;};'use strict';var client=require('../client');exports[_0xeb03('0x0')]=function(){return function(){return client[_0xeb03('0x1')](_0xeb03('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xeb03('0x3')],'include':[{'model':_0xeb03('0x4'),'as':_0xeb03('0x5'),'attributes':['id',_0xeb03('0x3'),_0xeb03('0x6')]}]},'log':_0xeb03('0x0')});};}; \ No newline at end of file +var _0x2547=['Request','GetInterval','name','Interval','Intervals','interval','getIntervals'];(function(_0x55b3b5,_0x254983){var _0x5297a9=function(_0x5f302f){while(--_0x5f302f){_0x55b3b5['push'](_0x55b3b5['shift']());}};_0x5297a9(++_0x254983);}(_0x2547,0x1cd));var _0x7254=function(_0x134139,_0x6d3f3d){_0x134139=_0x134139-0x0;var _0x350a0b=_0x2547[_0x134139];return _0x350a0b;};'use strict';var client=require('../client');exports[_0x7254('0x0')]=function(){return function(){return client[_0x7254('0x1')](_0x7254('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x7254('0x3')],'include':[{'model':_0x7254('0x4'),'as':_0x7254('0x5'),'attributes':['id',_0x7254('0x3'),_0x7254('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 4324d94..4987864 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 _0xfd65=['../client','update','UpdateMailInteraction','updateMailInteraction','addTags','Request','AddTagsToMailInteraction'];(function(_0x411b72,_0x31d73c){var _0x9988d6=function(_0x2bdf8c){while(--_0x2bdf8c){_0x411b72['push'](_0x411b72['shift']());}};_0x9988d6(++_0x31d73c);}(_0xfd65,0x1dc));var _0x5fd6=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xfd65[_0x45d55e];return _0x29812a;};'use strict';var client=require(_0x5fd6('0x0'));exports[_0x5fd6('0x1')]=function(_0x39fd2e,_0x949b93){return client['Request'](_0x5fd6('0x2'),{'body':_0x949b93,'options':{'where':{'id':_0x39fd2e}},'log':_0x5fd6('0x3')});};exports[_0x5fd6('0x4')]=function(_0x510656,_0x2b54d7){return client[_0x5fd6('0x5')](_0x5fd6('0x6'),{'body':_0x2b54d7,'options':{'where':{'id':_0x510656}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x2c32=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x17e36d,_0x4d3012){var _0x598756=function(_0x2e924a){while(--_0x2e924a){_0x17e36d['push'](_0x17e36d['shift']());}};_0x598756(++_0x4d3012);}(_0x2c32,0xb2));var _0x22c3=function(_0x2e2ae1,_0x9af0a8){_0x2e2ae1=_0x2e2ae1-0x0;var _0xf9c4b0=_0x2c32[_0x2e2ae1];return _0xf9c4b0;};'use strict';var client=require(_0x22c3('0x0'));exports[_0x22c3('0x1')]=function(_0x462aae,_0xedde61){return client[_0x22c3('0x2')](_0x22c3('0x3'),{'body':_0xedde61,'options':{'where':{'id':_0x462aae}},'log':_0x22c3('0x4')});};exports[_0x22c3('0x5')]=function(_0x1c4643,_0x11d455){return client[_0x22c3('0x2')](_0x22c3('0x6'),{'body':_0x11d455,'options':{'where':{'id':_0x1c4643}},'log':_0x22c3('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 5ebc829..5a57aa5 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 _0x7aa2=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x7aa2,0xe0));var _0x27aa=function(_0x14a84e,_0xffb06){_0x14a84e=_0x14a84e-0x0;var _0x2aca47=_0x7aa2[_0x14a84e];return _0x2aca47;};'use strict';var client=require(_0x27aa('0x0'));exports[_0x27aa('0x1')]=function(_0x5d9489){return client[_0x27aa('0x2')](_0x27aa('0x3'),{'body':_0x5d9489,'log':_0x27aa('0x4')});}; \ No newline at end of file +var _0x6928=['create','Request','CreateMailMessage','../client'];(function(_0x4fc421,_0x94e88){var _0x8c6d63=function(_0x5b8b42){while(--_0x5b8b42){_0x4fc421['push'](_0x4fc421['shift']());}};_0x8c6d63(++_0x94e88);}(_0x6928,0x11f));var _0x8692=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x6928[_0x9cd4c3];return _0x4c9025;};'use strict';var client=require(_0x8692('0x0'));exports[_0x8692('0x1')]=function(_0xecb79b){return client[_0x8692('0x2')](_0x8692('0x3'),{'body':_0xecb79b,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index bd538dc..9e62d05 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 _0x1ea1=['strategy','User','name','online','mailPause','getMailQueues','Request','GetMailQueue','timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1ea1,0x10a));var _0x11ea=function(_0x3a6de3,_0x57412c){_0x3a6de3=_0x3a6de3-0x0;var _0x667e3=_0x1ea1[_0x3a6de3];return _0x667e3;};'use strict';var client=require('../client');exports[_0x11ea('0x0')]=function(){return function(){return client[_0x11ea('0x1')](_0x11ea('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x11ea('0x3'),_0x11ea('0x4')],'include':[{'model':_0x11ea('0x5'),'as':'Agents','attributes':['id',_0x11ea('0x6'),_0x11ea('0x7'),_0x11ea('0x8')]}]},'log':_0x11ea('0x0')});};}; \ No newline at end of file +var _0xebe4=['User','Agents','mailPause','getMailQueues','Request','name','timeout'];(function(_0x5f5b62,_0x5246f9){var _0x5adce8=function(_0xc9198b){while(--_0xc9198b){_0x5f5b62['push'](_0x5f5b62['shift']());}};_0x5adce8(++_0x5246f9);}(_0xebe4,0x176));var _0x4ebe=function(_0x4b8181,_0x243ff7){_0x4b8181=_0x4b8181-0x0;var _0x372056=_0xebe4[_0x4b8181];return _0x372056;};'use strict';var client=require('../client');exports[_0x4ebe('0x0')]=function(){return function(){return client[_0x4ebe('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x4ebe('0x2'),_0x4ebe('0x3'),'strategy'],'include':[{'model':_0x4ebe('0x4'),'as':_0x4ebe('0x5'),'attributes':['id',_0x4ebe('0x2'),'online',_0x4ebe('0x6')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 00df7f8..11374eb 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 _0xcd9b=['CreateMailQueueReport','UpdateMailQueueReport','../client','create','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcd9b,0x188));var _0xbcd9=function(_0x48fc11,_0x535bc8){_0x48fc11=_0x48fc11-0x0;var _0x3179b0=_0xcd9b[_0x48fc11];return _0x3179b0;};'use strict';var client=require(_0xbcd9('0x0'));exports[_0xbcd9('0x1')]=function(_0x4218fa){return client[_0xbcd9('0x2')]('CreateMailQueueReport',{'body':_0x4218fa,'log':_0xbcd9('0x3')});};exports['update']=function(_0x280e3d,_0x563b0e){return client[_0xbcd9('0x2')](_0xbcd9('0x4'),{'body':_0x563b0e,'options':{'where':{'uniqueid':_0x280e3d},'order':[['id','DESC']],'limit':0x1},'log':_0xbcd9('0x4')});}; \ No newline at end of file +var _0xef05=['Request','DESC','UpdateMailQueueReport','../client','create','CreateMailQueueReport','update'];(function(_0x4b6bee,_0x23f984){var _0x167259=function(_0x419bfc){while(--_0x419bfc){_0x4b6bee['push'](_0x4b6bee['shift']());}};_0x167259(++_0x23f984);}(_0xef05,0x1f4));var _0x5ef0=function(_0x442008,_0x5e9f96){_0x442008=_0x442008-0x0;var _0x1d05da=_0xef05[_0x442008];return _0x1d05da;};'use strict';var client=require(_0x5ef0('0x0'));exports[_0x5ef0('0x1')]=function(_0x62fd5){return client['Request'](_0x5ef0('0x2'),{'body':_0x62fd5,'log':_0x5ef0('0x2')});};exports[_0x5ef0('0x3')]=function(_0x5f0cb8,_0x5572fb){return client[_0x5ef0('0x4')]('UpdateMailQueueReport',{'body':_0x5572fb,'options':{'where':{'uniqueid':_0x5f0cb8},'order':[['id',_0x5ef0('0x5')]],'limit':0x1},'log':_0x5ef0('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 066059f..6883b19 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 _0x749c=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','addTags'];(function(_0x377268,_0x46c995){var _0x461ab7=function(_0x4df3b4){while(--_0x4df3b4){_0x377268['push'](_0x377268['shift']());}};_0x461ab7(++_0x46c995);}(_0x749c,0x1b7));var _0xc749=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0x749c[_0x1a89a1];return _0x3d5b46;};'use strict';var client=require(_0xc749('0x0'));exports[_0xc749('0x1')]=function(_0x32ff15,_0x2b7697){return client[_0xc749('0x2')](_0xc749('0x3'),{'body':_0x2b7697,'options':{'where':{'id':_0x32ff15}},'log':'updateOpenchannelInteraction'});};exports[_0xc749('0x4')]=function(_0x34d3b9,_0x13016c){return client[_0xc749('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x13016c,'options':{'where':{'id':_0x34d3b9}},'log':_0xc749('0x5')});}; \ No newline at end of file +var _0x1c95=['updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x4d9a42,_0x4baeaa){var _0x5833d3=function(_0x28f854){while(--_0x28f854){_0x4d9a42['push'](_0x4d9a42['shift']());}};_0x5833d3(++_0x4baeaa);}(_0x1c95,0x14c));var _0x51c9=function(_0x2636f2,_0x24a579){_0x2636f2=_0x2636f2-0x0;var _0x4b73c6=_0x1c95[_0x2636f2];return _0x4b73c6;};'use strict';var client=require(_0x51c9('0x0'));exports[_0x51c9('0x1')]=function(_0x3e7fee,_0x38fc81){return client[_0x51c9('0x2')](_0x51c9('0x3'),{'body':_0x38fc81,'options':{'where':{'id':_0x3e7fee}},'log':_0x51c9('0x4')});};exports['addTags']=function(_0x3be57b,_0x1d3009){return client['Request'](_0x51c9('0x5'),{'body':_0x1d3009,'options':{'where':{'id':_0x3be57b}},'log':_0x51c9('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 3206324..d85c8eb 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 _0x91a7=['create','Request','createOpenchannelMessage'];(function(_0x11f64b,_0x12e24e){var _0x3aa3c1=function(_0xe47b6c){while(--_0xe47b6c){_0x11f64b['push'](_0x11f64b['shift']());}};_0x3aa3c1(++_0x12e24e);}(_0x91a7,0xe7));var _0x791a=function(_0x3762f3,_0x213d87){_0x3762f3=_0x3762f3-0x0;var _0x522b01=_0x91a7[_0x3762f3];return _0x522b01;};'use strict';var client=require('../client');exports[_0x791a('0x0')]=function(_0x3d6eab){return client[_0x791a('0x1')]('CreateOpenchannelMessage',{'body':_0x3d6eab,'log':_0x791a('0x2')});}; \ No newline at end of file +var _0xbec5=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0xabdff3,_0x47dff3){var _0x41e5d4=function(_0x315d75){while(--_0x315d75){_0xabdff3['push'](_0xabdff3['shift']());}};_0x41e5d4(++_0x47dff3);}(_0xbec5,0xe5));var _0x5bec=function(_0x5235a6,_0x680b76){_0x5235a6=_0x5235a6-0x0;var _0x1cf37e=_0xbec5[_0x5235a6];return _0x1cf37e;};'use strict';var client=require(_0x5bec('0x0'));exports[_0x5bec('0x1')]=function(_0x4cfc3b){return client[_0x5bec('0x2')](_0x5bec('0x3'),{'body':_0x4cfc3b,'log':_0x5bec('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index ecd21fc..b46f1e1 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 _0x4cdd=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','User','Agents','online','../client'];(function(_0x5594d9,_0x2d8b20){var _0x52cf95=function(_0x5c875b){while(--_0x5c875b){_0x5594d9['push'](_0x5594d9['shift']());}};_0x52cf95(++_0x2d8b20);}(_0x4cdd,0xe9));var _0xd4cd=function(_0x89dc64,_0x335a67){_0x89dc64=_0x89dc64-0x0;var _0x4a60d7=_0x4cdd[_0x89dc64];return _0x4a60d7;};'use strict';var client=require(_0xd4cd('0x0'));exports[_0xd4cd('0x1')]=function(){return function(){return client[_0xd4cd('0x2')](_0xd4cd('0x3'),{'options':{'raw':![],'attributes':['id',_0xd4cd('0x4'),'timeout',_0xd4cd('0x5')],'include':[{'model':_0xd4cd('0x6'),'as':_0xd4cd('0x7'),'attributes':['id',_0xd4cd('0x4'),_0xd4cd('0x8'),'openchannelPause']}]},'log':_0xd4cd('0x1')});};}; \ No newline at end of file +var _0x7b97=['name','strategy','User','Agents','online','../client','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x563a1e,_0x4581f2){var _0x516582=function(_0x2aed4a){while(--_0x2aed4a){_0x563a1e['push'](_0x563a1e['shift']());}};_0x516582(++_0x4581f2);}(_0x7b97,0x83));var _0x77b9=function(_0x362e87,_0x38d17c){_0x362e87=_0x362e87-0x0;var _0x334244=_0x7b97[_0x362e87];return _0x334244;};'use strict';var client=require(_0x77b9('0x0'));exports[_0x77b9('0x1')]=function(){return function(){return client[_0x77b9('0x2')](_0x77b9('0x3'),{'options':{'raw':![],'attributes':['id',_0x77b9('0x4'),'timeout',_0x77b9('0x5')],'include':[{'model':_0x77b9('0x6'),'as':_0x77b9('0x7'),'attributes':['id',_0x77b9('0x4'),_0x77b9('0x8'),'openchannelPause']}]},'log':_0x77b9('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index ffbeb9a..b5f9010 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 _0x63a9=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0x63a9,0x14f));var _0x963a=function(_0x5255b5,_0x249b51){_0x5255b5=_0x5255b5-0x0;var _0x6f40d8=_0x63a9[_0x5255b5];return _0x6f40d8;};'use strict';var client=require(_0x963a('0x0'));exports['create']=function(_0x4367c7){return client[_0x963a('0x1')](_0x963a('0x2'),{'body':_0x4367c7,'log':_0x963a('0x2')});};exports[_0x963a('0x3')]=function(_0x1ebeb1,_0x12ac7b){return client[_0x963a('0x1')](_0x963a('0x4'),{'body':_0x12ac7b,'options':{'where':{'uniqueid':_0x1ebeb1},'order':[['id',_0x963a('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x08a1=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','create'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x08a1,0xe3));var _0x108a=function(_0x14f06e,_0x2aab44){_0x14f06e=_0x14f06e-0x0;var _0x484e92=_0x08a1[_0x14f06e];return _0x484e92;};'use strict';var client=require('../client');exports[_0x108a('0x0')]=function(_0x50b4e1){return client[_0x108a('0x1')](_0x108a('0x2'),{'body':_0x50b4e1,'log':'CreateOpenchannelQueueReport'});};exports[_0x108a('0x3')]=function(_0x127075,_0xa8245d){return client[_0x108a('0x1')](_0x108a('0x4'),{'body':_0xa8245d,'options':{'where':{'uniqueid':_0x127075},'order':[['id',_0x108a('0x5')]],'limit':0x1},'log':_0x108a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 8921a24..18e7653 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 _0x78b9=['../client','update','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0xe45118,_0x5dffbc){var _0x15e15d=function(_0x17eaec){while(--_0x17eaec){_0xe45118['push'](_0xe45118['shift']());}};_0x15e15d(++_0x5dffbc);}(_0x78b9,0x9a));var _0x978b=function(_0x540fc7,_0x2460ec){_0x540fc7=_0x540fc7-0x0;var _0x16b2ee=_0x78b9[_0x540fc7];return _0x16b2ee;};'use strict';var client=require(_0x978b('0x0'));exports[_0x978b('0x1')]=function(_0x267d78,_0x84f95a){return client['Request'](_0x978b('0x2'),{'body':_0x84f95a,'options':{'where':{'id':_0x267d78}},'log':_0x978b('0x3')});};exports[_0x978b('0x4')]=function(_0x260cc3,_0xc8ee6f){return client['Request'](_0x978b('0x5'),{'body':_0xc8ee6f,'options':{'where':{'id':_0x260cc3}},'log':_0x978b('0x6')});}; \ No newline at end of file +var _0xdc9e=['UpdateSmsInteraction','updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','update'];(function(_0x51203f,_0x56c9a6){var _0x1a0fd6=function(_0x3649ce){while(--_0x3649ce){_0x51203f['push'](_0x51203f['shift']());}};_0x1a0fd6(++_0x56c9a6);}(_0xdc9e,0x76));var _0xedc9=function(_0x576dee,_0x4efe1b){_0x576dee=_0x576dee-0x0;var _0x302971=_0xdc9e[_0x576dee];return _0x302971;};'use strict';var client=require('../client');exports[_0xedc9('0x0')]=function(_0x22bb16,_0x4e0a42){return client['Request'](_0xedc9('0x1'),{'body':_0x4e0a42,'options':{'where':{'id':_0x22bb16}},'log':_0xedc9('0x2')});};exports[_0xedc9('0x3')]=function(_0x56cbcf,_0x5ebaa1){return client[_0xedc9('0x4')](_0xedc9('0x5'),{'body':_0x5ebaa1,'options':{'where':{'id':_0x56cbcf}},'log':_0xedc9('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index b202761..ad9b60e 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 _0xab44=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x28fecf,_0x158e9d){var _0x4ce4e1=function(_0x62484e){while(--_0x62484e){_0x28fecf['push'](_0x28fecf['shift']());}};_0x4ce4e1(++_0x158e9d);}(_0xab44,0xe2));var _0x4ab4=function(_0x1a42ef,_0x102d35){_0x1a42ef=_0x1a42ef-0x0;var _0x4f24af=_0xab44[_0x1a42ef];return _0x4f24af;};'use strict';var client=require(_0x4ab4('0x0'));exports[_0x4ab4('0x1')]=function(_0x3b09a0){return client[_0x4ab4('0x2')](_0x4ab4('0x3'),{'body':_0x3b09a0,'log':_0x4ab4('0x4')});}; \ No newline at end of file +var _0x176d=['create','Request','../client'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x176d,0x16d));var _0xd176=function(_0x3faa16,_0x22900e){_0x3faa16=_0x3faa16-0x0;var _0x7f37c8=_0x176d[_0x3faa16];return _0x7f37c8;};'use strict';var client=require(_0xd176('0x0'));exports[_0xd176('0x1')]=function(_0xf6ec0){return client[_0xd176('0x2')]('CreateSmsMessage',{'body':_0xf6ec0,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index d9f93f2..aaab752 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 _0xc387=['Request','GetSmsQueue','name','timeout','strategy','online','smsPause','getSmsQueues'];(function(_0x3dc128,_0x36c9de){var _0x3d047e=function(_0x567f43){while(--_0x567f43){_0x3dc128['push'](_0x3dc128['shift']());}};_0x3d047e(++_0x36c9de);}(_0xc387,0x128));var _0x7c38=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc387[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x7c38('0x0')](_0x7c38('0x1'),{'options':{'raw':![],'attributes':['id',_0x7c38('0x2'),_0x7c38('0x3'),_0x7c38('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x7c38('0x2'),_0x7c38('0x5'),_0x7c38('0x6')]}]},'log':_0x7c38('0x7')});};}; \ No newline at end of file +var _0x4db1=['Agents','name','online','smsPause','../client','getSmsQueues','Request','timeout','User'];(function(_0x345b1b,_0x14f1ef){var _0x36379a=function(_0x2a85b0){while(--_0x2a85b0){_0x345b1b['push'](_0x345b1b['shift']());}};_0x36379a(++_0x14f1ef);}(_0x4db1,0xa6));var _0x14db=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0x4db1[_0x2dd390];return _0x3afe47;};'use strict';var client=require(_0x14db('0x0'));exports[_0x14db('0x1')]=function(){return function(){return client[_0x14db('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x14db('0x3'),'strategy'],'include':[{'model':_0x14db('0x4'),'as':_0x14db('0x5'),'attributes':['id',_0x14db('0x6'),_0x14db('0x7'),_0x14db('0x8')]}]},'log':_0x14db('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 9976ac6..770eebc 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 _0x40ac=['CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0x40ac,0x1de));var _0xc40a=function(_0x42e7ce,_0x375d2e){_0x42e7ce=_0x42e7ce-0x0;var _0x3d5428=_0x40ac[_0x42e7ce];return _0x3d5428;};'use strict';var client=require(_0xc40a('0x0'));exports['create']=function(_0x10d6e7){return client[_0xc40a('0x1')](_0xc40a('0x2'),{'body':_0x10d6e7,'log':_0xc40a('0x2')});};exports[_0xc40a('0x3')]=function(_0x28699d,_0x12c54e){return client['Request'](_0xc40a('0x4'),{'body':_0x12c54e,'options':{'where':{'uniqueid':_0x28699d},'order':[['id',_0xc40a('0x5')]],'limit':0x1},'log':_0xc40a('0x4')});}; \ No newline at end of file +var _0xcac2=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','create'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xcac2,0x1e8));var _0x2cac=function(_0x5537b3,_0x224235){_0x5537b3=_0x5537b3-0x0;var _0x3f4175=_0xcac2[_0x5537b3];return _0x3f4175;};'use strict';var client=require(_0x2cac('0x0'));exports[_0x2cac('0x1')]=function(_0x26e82c){return client['Request'](_0x2cac('0x2'),{'body':_0x26e82c,'log':_0x2cac('0x2')});};exports['update']=function(_0x5f217f,_0x4a493b){return client['Request'](_0x2cac('0x3'),{'body':_0x4a493b,'options':{'where':{'uniqueid':_0x5f217f},'order':[['id',_0x2cac('0x4')]],'limit':0x1},'log':_0x2cac('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index f4e7d86..c1e3a0e 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 _0xb828=['voicePause','chatPause','mailPause','faxPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','name','online','pauseType'];(function(_0x5dd6d8,_0xe461ae){var _0x271126=function(_0x1536f8){while(--_0x1536f8){_0x5dd6d8['push'](_0x5dd6d8['shift']());}};_0x271126(++_0xe461ae);}(_0xb828,0xad));var _0x8b82=function(_0x4ccd32,_0x3b11c9){_0x4ccd32=_0x4ccd32-0x0;var _0x30b693=_0xb828[_0x4ccd32];return _0x30b693;};'use strict';var client=require(_0x8b82('0x0'));exports[_0x8b82('0x1')]=function(){return function(){return client[_0x8b82('0x2')](_0x8b82('0x3'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x8b82('0x4'),_0x8b82('0x5'),_0x8b82('0x6'),'lastPauseAt',_0x8b82('0x7'),_0x8b82('0x8'),_0x8b82('0x9'),_0x8b82('0xa'),_0x8b82('0xb'),_0x8b82('0xc'),_0x8b82('0xd'),_0x8b82('0xe'),_0x8b82('0xf'),_0x8b82('0x10'),'smsCapacity','whatsappCapacity',_0x8b82('0x11')]},'log':_0x8b82('0x1')});};}; \ No newline at end of file +var _0x0395=['smsCapacity','whatsappCapacity','openchannelCapacity','getAgents','../client','agent','name','online','pauseType','lastPauseAt','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity'];(function(_0x40bfaa,_0x243486){var _0x14be7c=function(_0x19909e){while(--_0x19909e){_0x40bfaa['push'](_0x40bfaa['shift']());}};_0x14be7c(++_0x243486);}(_0x0395,0x1c6));var _0x5039=function(_0x4a489f,_0x5402ab){_0x4a489f=_0x4a489f-0x0;var _0x4a4137=_0x0395[_0x4a489f];return _0x4a4137;};'use strict';var client=require(_0x5039('0x0'));exports['getAgents']=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x5039('0x1')},'attributes':['id',_0x5039('0x2'),_0x5039('0x3'),_0x5039('0x4'),_0x5039('0x5'),'voicePause',_0x5039('0x6'),_0x5039('0x7'),_0x5039('0x8'),_0x5039('0x9'),'whatsappPause',_0x5039('0xa'),_0x5039('0xb'),_0x5039('0xc'),_0x5039('0xd'),_0x5039('0xe'),_0x5039('0xf'),_0x5039('0x10')]},'log':_0x5039('0x11')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 5e19628..1f3a042 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 _0x3ae9=['updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','Request'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x3ae9,0xdb));var _0x93ae=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x3ae9[_0x2a6809];return _0x11c371;};'use strict';var client=require('../client');exports['update']=function(_0x32d9e9,_0x22e01d){return client[_0x93ae('0x0')]('UpdateWhatsappInteraction',{'body':_0x22e01d,'options':{'where':{'id':_0x32d9e9}},'log':_0x93ae('0x1')});};exports[_0x93ae('0x2')]=function(_0x2dc540,_0x2af5aa){return client['Request'](_0x93ae('0x3'),{'body':_0x2af5aa,'options':{'where':{'id':_0x2dc540}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0xf3cd=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','addTags'];(function(_0x2581fb,_0xb8c3d){var _0x5027ab=function(_0x5a7377){while(--_0x5a7377){_0x2581fb['push'](_0x2581fb['shift']());}};_0x5027ab(++_0xb8c3d);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3a723e,_0x59d99a){_0x3a723e=_0x3a723e-0x0;var _0x3e9c03=_0xf3cd[_0x3a723e];return _0x3e9c03;};'use strict';var client=require(_0xdf3c('0x0'));exports[_0xdf3c('0x1')]=function(_0x31e5a5,_0x1e0814){return client[_0xdf3c('0x2')](_0xdf3c('0x3'),{'body':_0x1e0814,'options':{'where':{'id':_0x31e5a5}},'log':'updateWhatsappInteraction'});};exports[_0xdf3c('0x4')]=function(_0x71b446,_0x9f71cb){return client['Request'](_0xdf3c('0x5'),{'body':_0x9f71cb,'options':{'where':{'id':_0x71b446}},'log':_0xdf3c('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 600bc2d..ff90489 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 _0xb820=['createWhatsappMessage','../client','Request','CreateWhatsappMessage'];(function(_0x4527a9,_0x2035cc){var _0x4acc44=function(_0x4c965e){while(--_0x4c965e){_0x4527a9['push'](_0x4527a9['shift']());}};_0x4acc44(++_0x2035cc);}(_0xb820,0xad));var _0x0b82=function(_0x287723,_0x434638){_0x287723=_0x287723-0x0;var _0x585059=_0xb820[_0x287723];return _0x585059;};'use strict';var client=require(_0x0b82('0x0'));exports['create']=function(_0x42a5f0){return client[_0x0b82('0x1')](_0x0b82('0x2'),{'body':_0x42a5f0,'log':_0x0b82('0x3')});}; \ No newline at end of file +var _0x02fb=['CreateWhatsappMessage','../client','create','Request'];(function(_0x42c876,_0xbc454b){var _0x3d46ef=function(_0x298f17){while(--_0x298f17){_0x42c876['push'](_0x42c876['shift']());}};_0x3d46ef(++_0xbc454b);}(_0x02fb,0x101));var _0xb02f=function(_0x1e62cd,_0x1db9bb){_0x1e62cd=_0x1e62cd-0x0;var _0x2cc8e6=_0x02fb[_0x1e62cd];return _0x2cc8e6;};'use strict';var client=require(_0xb02f('0x0'));exports[_0xb02f('0x1')]=function(_0x16aa94){return client[_0xb02f('0x2')](_0xb02f('0x3'),{'body':_0x16aa94,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index d9adddd..2a83420 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 _0x1339=['name','timeout','strategy','User','Agents','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0x201043,_0x57e46b){var _0x29e5f2=function(_0x1043ec){while(--_0x1043ec){_0x201043['push'](_0x201043['shift']());}};_0x29e5f2(++_0x57e46b);}(_0x1339,0x1ed));var _0x9133=function(_0x46f7d4,_0x36f9a8){_0x46f7d4=_0x46f7d4-0x0;var _0x12b317=_0x1339[_0x46f7d4];return _0x12b317;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0x9133('0x0')](_0x9133('0x1'),{'options':{'raw':![],'attributes':['id',_0x9133('0x2'),_0x9133('0x3'),_0x9133('0x4')],'include':[{'model':_0x9133('0x5'),'as':_0x9133('0x6'),'attributes':['id',_0x9133('0x2'),'online',_0x9133('0x7')]}]},'log':_0x9133('0x8')});};}; \ No newline at end of file +var _0x94d2=['timeout','strategy','online','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name'];(function(_0x8cea57,_0x290172){var _0x25ce1d=function(_0x152c9a){while(--_0x152c9a){_0x8cea57['push'](_0x8cea57['shift']());}};_0x25ce1d(++_0x290172);}(_0x94d2,0x1cd));var _0x294d=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0x94d2[_0x1ee351];return _0x245aaf;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0x294d('0x0')](_0x294d('0x1'),{'options':{'raw':![],'attributes':['id',_0x294d('0x2'),_0x294d('0x3'),_0x294d('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x294d('0x2'),_0x294d('0x5'),_0x294d('0x6')]}]},'log':_0x294d('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 28918de..d3adbf0 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 _0x45ad=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','create','Request'];(function(_0x17bca7,_0x4c5ab6){var _0x320157=function(_0x34500f){while(--_0x34500f){_0x17bca7['push'](_0x17bca7['shift']());}};_0x320157(++_0x4c5ab6);}(_0x45ad,0xbe));var _0xd45a=function(_0x30a6d6,_0x603c35){_0x30a6d6=_0x30a6d6-0x0;var _0x361ea1=_0x45ad[_0x30a6d6];return _0x361ea1;};'use strict';var client=require('../client');exports[_0xd45a('0x0')]=function(_0x52317b){return client[_0xd45a('0x1')](_0xd45a('0x2'),{'body':_0x52317b,'log':_0xd45a('0x2')});};exports[_0xd45a('0x3')]=function(_0x3a9f40,_0x2d0570){return client[_0xd45a('0x1')](_0xd45a('0x4'),{'body':_0x2d0570,'options':{'where':{'uniqueid':_0x3a9f40},'order':[['id',_0xd45a('0x5')]],'limit':0x1},'log':_0xd45a('0x4')});}; \ No newline at end of file +var _0x9f73=['UpdateWhatsappQueueReport','DESC','../client','Request','CreateWhatsappQueueReport'];(function(_0x4a73f5,_0xc00711){var _0x37eece=function(_0x2cb815){while(--_0x2cb815){_0x4a73f5['push'](_0x4a73f5['shift']());}};_0x37eece(++_0xc00711);}(_0x9f73,0x11f));var _0x39f7=function(_0x532d55,_0x2a9e7a){_0x532d55=_0x532d55-0x0;var _0x30bafa=_0x9f73[_0x532d55];return _0x30bafa;};'use strict';var client=require(_0x39f7('0x0'));exports['create']=function(_0xd9c2b3){return client[_0x39f7('0x1')](_0x39f7('0x2'),{'body':_0xd9c2b3,'log':_0x39f7('0x2')});};exports['update']=function(_0x472182,_0x429ae5){return client[_0x39f7('0x1')](_0x39f7('0x3'),{'body':_0x429ae5,'options':{'where':{'uniqueid':_0x472182},'order':[['id',_0x39f7('0x4')]],'limit':0x1},'log':_0x39f7('0x3')});}; \ 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 8297c4a..a4a898b 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 _0x7e8f=['number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','message','join','stop','find','agents','timeout','createQueue','START:%s','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','rules','complete','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','routing','./strategy','string'];(function(_0x1a3243,_0x201872){var _0x33f2ca=function(_0x59d32e){while(--_0x59d32e){_0x1a3243['push'](_0x1a3243['shift']());}};_0x33f2ca(++_0x201872);}(_0x7e8f,0x17a));var _0xf7e8=function(_0x44e031,_0x4d7c1a){_0x44e031=_0x44e031-0x0;var _0x41876f=_0x7e8f[_0x44e031];return _0x41876f;};'use strict';var schema=require(_0xf7e8('0x0'));var _=require(_0xf7e8('0x1'));var util=require(_0xf7e8('0x2'));var seqqueue=require('seq-queue');var logger=require(_0xf7e8('0x3'))(_0xf7e8('0x4'));var strategy=require(_0xf7e8('0x5'));var queue=schema({'name':{'type':_0xf7e8('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xf7e8('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0xe216c4,_0x48b6a9,_0x190c8d){return logger['info'](util[_0xf7e8('0x8')](_0xf7e8('0x9'),_0xe216c4,_0x48b6a9['name'],_0x190c8d));}function handleFindAgent(_0x463d26){return function(_0xae079e){return _0xae079e[_0xf7e8('0xa')][_0xf7e8('0xb')]()===_0x463d26[_0xf7e8('0xb')]();};}exports[_0xf7e8('0xc')]=function(_0x5a7e9a,_0x4f1ef5,_0x184d13,_0x3ad977){return function(_0x4ad746){try{var _0x1a8bcc={'name':_0x4f1ef5[0x0],'timeout':_0x4f1ef5[0x1]};var _0x3c6da2=queue[_0xf7e8('0x0')](_0x1a8bcc,{'typecast':!![]});if(_0x3c6da2[_0xf7e8('0xd')]){logger['error'](_0xf7e8('0xe'),_0x5a7e9a,_['map'](_0x3c6da2,_0xf7e8('0xf'))[_0xf7e8('0x10')](',\x20'));_0x4ad746[_0xf7e8('0x11')]();}else{var _0x569994=_[_0xf7e8('0x12')](_0x184d13[_0xf7e8('0x13')],handleFindAgent(_0x1a8bcc[_0xf7e8('0xa')]));if(_0x569994){var _0x2b46c2=(_0x1a8bcc[_0xf7e8('0x14')]||0xa)*0x3e8;var _0x5a6f4c,_0x5b23f3;var _0x48d614=seqqueue[_0xf7e8('0x15')](_0x2b46c2);_0x48d614['id']=_0x5a7e9a;_0x48d614['atimeout']=_0x2b46c2;_0x48d614['channel']=_0x3ad977['channel'];writeLog(_0x5a7e9a,_0x569994,util[_0xf7e8('0x8')](_0xf7e8('0x16'),_0x2b46c2));_0x184d13['rules'][_0x5a7e9a]['on'](_0xf7e8('0x17'),function(){logger[_0xf7e8('0x18')](_0xf7e8('0x19'),_0x5a7e9a);clearTimeout(_0x5b23f3);_0x5b23f3=undefined;_0x48d614['close']();if(_0x184d13[_0xf7e8('0x1a')][_0x5a7e9a]){delete _0x184d13['rules'][_0x5a7e9a];}_0x4ad746[_0xf7e8('0x11')]();});_0x184d13[_0xf7e8('0x1a')][_0x5a7e9a]['on'](_0xf7e8('0x1b'),function(){if(_0x184d13[_0xf7e8('0x1a')][_0x5a7e9a]){delete _0x184d13[_0xf7e8('0x1a')][_0x5a7e9a];}});_0x5b23f3=setTimeout(function(){logger[_0xf7e8('0x18')]('[%s][AGENT]\x20ROUTING\x20END',_0x5a7e9a);clearTimeout(_0x5b23f3);_0x48d614[_0xf7e8('0x1c')]();_0x4ad746[_0xf7e8('0x1d')]();},_0x2b46c2);strategy[_0xf7e8('0x1e')](_0x48d614,_0x569994,_0x184d13,_0x3ad977);}else{logger['error'](_0xf7e8('0x1f'),_0x5a7e9a,_0x1a8bcc[_0xf7e8('0xa')]);_0x4ad746['stop']();}}}catch(_0x401158){console[_0xf7e8('0x20')](_0x401158);logger['error'](_0xf7e8('0x21'),_0x5a7e9a,_0x401158[_0xf7e8('0x22')]);_0x4ad746['stop']();}};}; \ No newline at end of file +var _0x8c38=['error','map','join','stop','agents','timeout','createQueue','atimeout','channel','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','name','toLowerCase','consequence','validate'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x8c38,0x1b1));var _0x88c3=function(_0xff1489,_0x9c4794){_0xff1489=_0xff1489-0x0;var _0x1507c2=_0x8c38[_0xff1489];return _0x1507c2;};'use strict';var schema=require('validate');var _=require(_0x88c3('0x0'));var util=require(_0x88c3('0x1'));var seqqueue=require(_0x88c3('0x2'));var logger=require(_0x88c3('0x3'))(_0x88c3('0x4'));var strategy=require(_0x88c3('0x5'));var queue=schema({'name':{'type':_0x88c3('0x6'),'required':!![],'message':_0x88c3('0x7')},'timeout':{'type':_0x88c3('0x8'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x4a66a2,_0x32bc20,_0x1bdf92){return logger[_0x88c3('0x9')](util[_0x88c3('0xa')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x4a66a2,_0x32bc20[_0x88c3('0xb')],_0x1bdf92));}function handleFindAgent(_0x176847){return function(_0x4abb61){return _0x4abb61['name'][_0x88c3('0xc')]()===_0x176847[_0x88c3('0xc')]();};}exports[_0x88c3('0xd')]=function(_0x20f45e,_0x3b1a12,_0x1bb542,_0x8cc31f){return function(_0x153b32){try{var _0x22900e={'name':_0x3b1a12[0x0],'timeout':_0x3b1a12[0x1]};var _0x5aa87a=queue[_0x88c3('0xe')](_0x22900e,{'typecast':!![]});if(_0x5aa87a['length']){logger[_0x88c3('0xf')]('[%s][AGENT]\x20%s',_0x20f45e,_[_0x88c3('0x10')](_0x5aa87a,'message')[_0x88c3('0x11')](',\x20'));_0x153b32[_0x88c3('0x12')]();}else{var _0x5c77d4=_['find'](_0x1bb542[_0x88c3('0x13')],handleFindAgent(_0x22900e[_0x88c3('0xb')]));if(_0x5c77d4){var _0x5c2a30=(_0x22900e[_0x88c3('0x14')]||0xa)*0x3e8;var _0x41356a,_0xeb7ebb;var _0x4831bc=seqqueue[_0x88c3('0x15')](_0x5c2a30);_0x4831bc['id']=_0x20f45e;_0x4831bc[_0x88c3('0x16')]=_0x5c2a30;_0x4831bc[_0x88c3('0x17')]=_0x8cc31f[_0x88c3('0x17')];writeLog(_0x20f45e,_0x5c77d4,util['format']('START:%s',_0x5c2a30));_0x1bb542['rules'][_0x20f45e]['on'](_0x88c3('0x18'),function(){logger['info'](_0x88c3('0x19'),_0x20f45e);clearTimeout(_0xeb7ebb);_0xeb7ebb=undefined;_0x4831bc[_0x88c3('0x1a')]();if(_0x1bb542['rules'][_0x20f45e]){delete _0x1bb542[_0x88c3('0x1b')][_0x20f45e];}_0x153b32['stop']();});_0x1bb542[_0x88c3('0x1b')][_0x20f45e]['on'](_0x88c3('0x1c'),function(){if(_0x1bb542[_0x88c3('0x1b')][_0x20f45e]){delete _0x1bb542[_0x88c3('0x1b')][_0x20f45e];}});_0xeb7ebb=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x20f45e);clearTimeout(_0xeb7ebb);_0x4831bc[_0x88c3('0x1a')]();_0x153b32[_0x88c3('0x1d')]();},_0x5c2a30);strategy['agent'](_0x4831bc,_0x5c77d4,_0x1bb542,_0x8cc31f);}else{logger[_0x88c3('0xf')](_0x88c3('0x1e'),_0x20f45e,_0x22900e['name']);_0x153b32[_0x88c3('0x12')]();}}}catch(_0x49332c){console['log'](_0x49332c);logger['error']('[%s][QUEUE]\x20%s',_0x20f45e,_0x49332c[_0x88c3('0x1f')]);_0x153b32[_0x88c3('0x12')]();}};}; \ 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 ac5f617..53b8d30 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 _0x6869=['UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','whatsapp','phone','interaction','channel','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','next','lodash','moment','aws-sdk','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x20aae1,_0x51efd4){var _0x510601=function(_0x20895f){while(--_0x20895f){_0x20aae1['push'](_0x20aae1['shift']());}};_0x510601(++_0x51efd4);}(_0x6869,0xe2));var _0x9686=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6869[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x9686('0x0'));var moment=require(_0x9686('0x1'));var AWS=require(_0x9686('0x2'));var utils=require('./utils');var logger=require(_0x9686('0x3'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x9686('0x4')),'mailMessage':require(_0x9686('0x5')),'smsMessage':require(_0x9686('0x6')),'faxMessage':require(_0x9686('0x7')),'whatsappMessage':require(_0x9686('0x8'))};exports['consequence']=function(_0x35591e,_0x1e4b89){return function(_0x55ec19){try{if(!_['isNil'](this['interaction'][_0x9686('0x9')])){logger[_0x9686('0xa')](_0x9686('0xb'),_0x35591e,_0x9686('0xc'));return _0x55ec19['next']();}var _0x464155={'ContactId':this[_0x9686('0xd')]['id'],'sentAt':moment()[_0x9686('0xe')](_0x9686('0xf')),'direction':_0x9686('0x10')};if(this['channel']==='sms'||this['channel']===_0x9686('0x11')){_0x464155[_0x9686('0x12')]=this[_0x9686('0x13')][_0x9686('0x12')];}var _0xfc9759=this[_0x9686('0x14')];if(_0xfc9759==='chat'){_0x464155[_0x9686('0x15')]=this[_0x9686('0x16')]['id'];}else{_0x464155[_['upperFirst'](_0xfc9759)+_0x9686('0x17')]=this[_0x9686('0x16')]['id'];}_0x464155[_[_0x9686('0x18')](_0xfc9759)+_0x9686('0x19')]=this[_0x9686('0x13')]['id'];if(this[_0x9686('0x13')]['created']){var _0x3c0056=_0x1e4b89[0x4];if(!_[_0x9686('0x1a')](_0x3c0056)){_0x464155[_0x9686('0x1b')]=utils[_0x9686('0x1c')](_0x3c0056,this);return rpc[_0xfc9759+_0x9686('0x1d')][_0x9686('0x1e')](_0x464155)[_0x9686('0x1f')](function(_0x2c3919){logger[_0x9686('0xa')]('[%s][AMAZONLEX]\x20%s',_0x35591e,_0x464155[_0x9686('0x1b')]);})[_0x9686('0x20')](function(_0x83595b){logger[_0x9686('0x21')](_0x9686('0xb'),_0x35591e,JSON[_0x9686('0x22')](_0x83595b));})[_0x9686('0x23')](function(){logger[_0x9686('0xa')](_0x9686('0x24'),_0x35591e);_0x55ec19[_0x9686('0x25')]();});}else{logger[_0x9686('0xa')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x35591e);_0x55ec19[_0x9686('0x25')]();}}else{var _0x5e7ba2=this;var _0x2689d1=new AWS[(_0x9686('0x26'))]({'accessKeyId':_0x1e4b89[0x0],'secretAccessKey':_0x1e4b89[0x1],'region':_0x1e4b89[0x2]});var _0x41b9cc={'botAlias':_0x9686('0x27'),'botName':_0x1e4b89[0x3],'inputText':this[_0x9686('0x28')]['body'],'userId':this[_0x9686('0x14')]+':'+this[_0x9686('0x13')]['id'][_0x9686('0x29')]()};_0x2689d1[_0x9686('0x2a')](_0x41b9cc,function(_0x160654,_0x17bdf5){if(_0x160654){logger[_0x9686('0x21')](_0x9686('0xb'),_0x35591e,_0x160654['message']);_0x55ec19['next']();}else if(_0x17bdf5&&_0x17bdf5['message']){_0x5e7ba2[_0x9686('0x1b')][_0x9686('0x2b')]=_0x17bdf5;_0x464155[_0x9686('0x1b')]=_0x17bdf5[_0x9686('0x28')];_0x464155[_0x9686('0x2c')]=_0x9686('0x2b');_0x464155[_0x9686('0x2d')]=JSON[_0x9686('0x22')](_0x17bdf5);return rpc[_0xfc9759+_0x9686('0x1d')][_0x9686('0x1e')](_0x464155)[_0x9686('0x1f')](function(_0x44a530){logger['info']('[%s][AMAZONLEX]\x20%s',_0x35591e,_0x464155[_0x9686('0x1b')]);if(_0x17bdf5['dialogState']=='Failed'){_0x55ec19[_0x9686('0x2e')]();}else{_0x55ec19['stop']();}})[_0x9686('0x20')](function(_0x4d6495){logger[_0x9686('0x21')](_0x9686('0xb'),_0x35591e,JSON[_0x9686('0x22')](_0x4d6495));_0x55ec19['next']();});}else{_0x55ec19[_0x9686('0x2e')]();}});}}catch(_0x2ba324){logger[_0x9686('0x21')]('[%s][AMAZONLEX]\x20%s',_0x35591e,JSON[_0x9686('0x22')](_0x2ba324));_0x55ec19[_0x9686('0x25')]();}};}; \ No newline at end of file +var _0x9f4d=['../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','create','then','catch','error','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','postText','amazonlex','providerName','providerResponse','stringify','Message','dialogState','Failed','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x9f4d,0x8f));var _0xd9f4=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0x9f4d[_0x4bf96c];return _0x281d09;};'use strict';var _=require(_0xd9f4('0x0'));var moment=require(_0xd9f4('0x1'));var AWS=require('aws-sdk');var utils=require(_0xd9f4('0x2'));var logger=require('../../../../config/logger')(_0xd9f4('0x3'));var rpc={'chatMessage':require(_0xd9f4('0x4')),'openchannelMessage':require(_0xd9f4('0x5')),'mailMessage':require(_0xd9f4('0x6')),'smsMessage':require(_0xd9f4('0x7')),'faxMessage':require(_0xd9f4('0x8')),'whatsappMessage':require(_0xd9f4('0x9'))};exports['consequence']=function(_0x210b4a,_0x44091c){return function(_0x519bbe){try{if(!_[_0xd9f4('0xa')](this[_0xd9f4('0xb')]['UserId'])){logger['info'](_0xd9f4('0xc'),_0x210b4a,_0xd9f4('0xd'));return _0x519bbe[_0xd9f4('0xe')]();}var _0x2559ff={'ContactId':this['contact']['id'],'sentAt':moment()[_0xd9f4('0xf')](_0xd9f4('0x10')),'direction':_0xd9f4('0x11')};if(this[_0xd9f4('0x12')]===_0xd9f4('0x13')||this['channel']===_0xd9f4('0x14')){_0x2559ff['phone']=this[_0xd9f4('0xb')]['phone'];}var _0x4f76d2=this['channel'];if(_0x4f76d2===_0xd9f4('0x15')){_0x2559ff[_0xd9f4('0x16')]=this[_0xd9f4('0x17')]['id'];}else{_0x2559ff[_[_0xd9f4('0x18')](_0x4f76d2)+_0xd9f4('0x19')]=this['account']['id'];}_0x2559ff[_[_0xd9f4('0x18')](_0x4f76d2)+_0xd9f4('0x1a')]=this[_0xd9f4('0xb')]['id'];if(this[_0xd9f4('0xb')][_0xd9f4('0x1b')]){var _0x5c290b=_0x44091c[0x4];if(!_[_0xd9f4('0x1c')](_0x5c290b)){_0x2559ff[_0xd9f4('0x1d')]=utils[_0xd9f4('0x1e')](_0x5c290b,this);return rpc[_0x4f76d2+'Message'][_0xd9f4('0x1f')](_0x2559ff)[_0xd9f4('0x20')](function(_0x405067){logger['info']('[%s][AMAZONLEX]\x20%s',_0x210b4a,_0x2559ff[_0xd9f4('0x1d')]);})[_0xd9f4('0x21')](function(_0x5661b2){logger[_0xd9f4('0x22')](_0xd9f4('0xc'),_0x210b4a,JSON['stringify'](_0x5661b2));})[_0xd9f4('0x23')](function(){logger[_0xd9f4('0x24')](_0xd9f4('0x25'),_0x210b4a);_0x519bbe[_0xd9f4('0x26')]();});}else{logger['info'](_0xd9f4('0x27'),_0x210b4a);_0x519bbe[_0xd9f4('0x26')]();}}else{var _0x246c0e=this;var _0x5e3411=new AWS[(_0xd9f4('0x28'))]({'accessKeyId':_0x44091c[0x0],'secretAccessKey':_0x44091c[0x1],'region':_0x44091c[0x2]});var _0x4fe0b5={'botAlias':'$LATEST','botName':_0x44091c[0x3],'inputText':this[_0xd9f4('0x29')]['body'],'userId':this['channel']+':'+this['interaction']['id']['toString']()};_0x5e3411[_0xd9f4('0x2a')](_0x4fe0b5,function(_0x4d4eb2,_0x5ad004){if(_0x4d4eb2){logger[_0xd9f4('0x22')]('[%s][AMAZONLEX]\x20%s',_0x210b4a,_0x4d4eb2['message']);_0x519bbe['next']();}else if(_0x5ad004&&_0x5ad004[_0xd9f4('0x29')]){_0x246c0e['body'][_0xd9f4('0x2b')]=_0x5ad004;_0x2559ff[_0xd9f4('0x1d')]=_0x5ad004[_0xd9f4('0x29')];_0x2559ff[_0xd9f4('0x2c')]=_0xd9f4('0x2b');_0x2559ff[_0xd9f4('0x2d')]=JSON[_0xd9f4('0x2e')](_0x5ad004);return rpc[_0x4f76d2+_0xd9f4('0x2f')][_0xd9f4('0x1f')](_0x2559ff)[_0xd9f4('0x20')](function(_0x3835fe){logger[_0xd9f4('0x24')](_0xd9f4('0xc'),_0x210b4a,_0x2559ff['body']);if(_0x5ad004[_0xd9f4('0x30')]==_0xd9f4('0x31')){_0x519bbe[_0xd9f4('0xe')]();}else{_0x519bbe[_0xd9f4('0x26')]();}})[_0xd9f4('0x21')](function(_0x38590f){logger[_0xd9f4('0x22')]('[%s][AMAZONLEX]\x20%s',_0x210b4a,JSON[_0xd9f4('0x2e')](_0x38590f));_0x519bbe[_0xd9f4('0xe')]();});}else{_0x519bbe[_0xd9f4('0xe')]();}});}}catch(_0x150f97){logger[_0xd9f4('0x22')]('[%s][AMAZONLEX]\x20%s',_0x210b4a,JSON[_0xd9f4('0x2e')](_0x150f97));_0x519bbe[_0xd9f4('0x26')]();}};}; \ 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 b443995..4b6d580 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 _0x2133=['finally','error','stop','moment','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','body','message','from','phone','read','subject','startsWith','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','catch','stringify'];(function(_0x37d809,_0x397086){var _0x1c4a67=function(_0xb78b00){while(--_0xb78b00){_0x37d809['push'](_0x37d809['shift']());}};_0x1c4a67(++_0x397086);}(_0x2133,0x1d1));var _0x3213=function(_0x2a67c1,_0x2d32be){_0x2a67c1=_0x2a67c1-0x0;var _0x4734f0=_0x2133[_0x2a67c1];return _0x4734f0;};'use strict';var _=require('lodash');var moment=require(_0x3213('0x0'));var utils=require(_0x3213('0x1'));var logger=require(_0x3213('0x2'))(_0x3213('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x3213('0x4')),'smsMessage':require(_0x3213('0x5')),'faxMessage':require(_0x3213('0x6')),'whatsappMessage':require(_0x3213('0x7'))};var mailRpc=require(_0x3213('0x8'));exports[_0x3213('0x9')]=function(_0x5844a8,_0x176cbb){return function(_0x2cec16){try{if(_0x176cbb[0x0]==='1'&&(_[_0x3213('0xa')](this[_0x3213('0xb')][_0x3213('0xc')])||!this[_0x3213('0xb')][_0x3213('0xc')])){logger[_0x3213('0xd')](_0x3213('0xe'),_0x5844a8,_0x3213('0xf'));return _0x2cec16[_0x3213('0x10')]();}var _0x296dca=this[_0x3213('0x11')];var _0x1157a3={'ContactId':this[_0x3213('0x12')]['id'],'sentAt':moment()[_0x3213('0x13')](_0x3213('0x14')),'direction':_0x3213('0x15')};if(this[_0x3213('0x11')]===_0x3213('0x16')){_0x1157a3[_0x3213('0x17')]=utils['getMustacheRender'](_0x176cbb[0x2],this);}else{_0x1157a3[_0x3213('0x17')]=utils['getMustacheRender'](_0x176cbb[0x1],this);}if(this[_0x3213('0x18')]){_0x1157a3['to']=this[_0x3213('0x18')][_0x3213('0x19')]||'';if(this[_0x3213('0x11')]===_0x3213('0x16')&&_0x176cbb[0x1]==='1'){_0x1157a3['cc']=this[_0x3213('0x18')]['cc']||'';}_0x1157a3['from']=this['message']['to']||'';_0x1157a3['phone']=this[_0x3213('0x18')][_0x3213('0x1a')]||'';_0x1157a3[_0x3213('0x1b')]=!![];if(this[_0x3213('0x18')][_0x3213('0x1c')]){_0x1157a3[_0x3213('0x1c')]='';_0x1157a3[_0x3213('0x1c')]+=_[_0x3213('0x1d')](this[_0x3213('0x18')][_0x3213('0x1c')],'Re:')?'':_0x3213('0x1e');_0x1157a3[_0x3213('0x1c')]+=this[_0x3213('0x18')]['subject'];}}if(this[_0x3213('0x11')]==='chat'){_0x1157a3[_0x3213('0x1f')]=this[_0x3213('0x20')]['id'];}else{_0x1157a3[_[_0x3213('0x21')](this[_0x3213('0x11')])+_0x3213('0x22')]=this[_0x3213('0x20')]['id'];}_0x1157a3[_[_0x3213('0x21')](this['channel'])+_0x3213('0x23')]=this[_0x3213('0xb')]['id'];if(rpc[this[_0x3213('0x11')]+_0x3213('0x24')]){if(this[_0x3213('0x11')]===_0x3213('0x16')){var _0x3c4eeb={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x3213('0x25')][_0x3213('0x26')]){_0x3c4eeb[_0x3213('0x26')]=this[_0x3213('0x20')][_0x3213('0x25')][_0x3213('0x26')];}else{_0x3c4eeb[_0x3213('0x27')]=this['account'][_0x3213('0x25')][_0x3213('0x27')];_0x3c4eeb[_0x3213('0x28')]=this[_0x3213('0x20')]['Smtp']['port'];_0x3c4eeb['secure']=this[_0x3213('0x20')]['Smtp'][_0x3213('0x29')];}if(this['account'][_0x3213('0x25')][_0x3213('0x2a')]){_0x3c4eeb[_0x3213('0x2b')]={'user':this[_0x3213('0x20')][_0x3213('0x25')][_0x3213('0x2c')],'pass':this['account']['Smtp'][_0x3213('0x2d')]};}_0x1157a3[_0x3213('0x2e')]=this[_0x3213('0x18')]['messageId'];_0x1157a3[_0x3213('0x2f')]=_0x3213('0x30')+_[_0x3213('0x31')](_0x1157a3[_0x3213('0x17')],_0x3213('0x32'),'','replace','','headers','auto-replied','All','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','then','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../mailRpc','consequence'];(function(_0x329d13,_0x1aff27){var _0x33efd9=function(_0x265b7d){while(--_0x265b7d){_0x329d13['push'](_0x329d13['shift']());}};_0x33efd9(++_0x1aff27);}(_0xf470,0xfd));var _0x0f47=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xf470[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x0f47('0x0'));var moment=require(_0x0f47('0x1'));var utils=require(_0x0f47('0x2'));var logger=require(_0x0f47('0x3'))(_0x0f47('0x4'));var rpc={'chatMessage':require(_0x0f47('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x0f47('0x6')),'smsMessage':require(_0x0f47('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x0f47('0x8'))};var mailRpc=require(_0x0f47('0x9'));exports[_0x0f47('0xa')]=function(_0x428c24,_0x42c33a){return function(_0x3c1886){try{if(_0x42c33a[0x0]==='1'&&(_[_0x0f47('0xb')](this[_0x0f47('0xc')][_0x0f47('0xd')])||!this[_0x0f47('0xc')][_0x0f47('0xd')])){logger[_0x0f47('0xe')](_0x0f47('0xf'),_0x428c24,_0x0f47('0x10'));return _0x3c1886[_0x0f47('0x11')]();}var _0x2196d2=this[_0x0f47('0x12')];var _0x423b4a={'ContactId':this[_0x0f47('0x13')]['id'],'sentAt':moment()['format'](_0x0f47('0x14')),'direction':_0x0f47('0x15')};if(this[_0x0f47('0x12')]===_0x0f47('0x16')){_0x423b4a[_0x0f47('0x17')]=utils['getMustacheRender'](_0x42c33a[0x2],this);}else{_0x423b4a['body']=utils[_0x0f47('0x18')](_0x42c33a[0x1],this);}if(this[_0x0f47('0x19')]){_0x423b4a['to']=this[_0x0f47('0x19')][_0x0f47('0x1a')]||'';if(this[_0x0f47('0x12')]==='mail'&&_0x42c33a[0x1]==='1'){_0x423b4a['cc']=this[_0x0f47('0x19')]['cc']||'';}_0x423b4a['from']=this['message']['to']||'';_0x423b4a[_0x0f47('0x1b')]=this[_0x0f47('0x19')][_0x0f47('0x1b')]||'';_0x423b4a[_0x0f47('0x1c')]=!![];if(this[_0x0f47('0x19')][_0x0f47('0x1d')]){_0x423b4a[_0x0f47('0x1d')]='';_0x423b4a['subject']+=_[_0x0f47('0x1e')](this[_0x0f47('0x19')]['subject'],_0x0f47('0x1f'))?'':_0x0f47('0x20');_0x423b4a[_0x0f47('0x1d')]+=this[_0x0f47('0x19')][_0x0f47('0x1d')];}}if(this[_0x0f47('0x12')]===_0x0f47('0x21')){_0x423b4a[_0x0f47('0x22')]=this[_0x0f47('0x23')]['id'];}else{_0x423b4a[_[_0x0f47('0x24')](this[_0x0f47('0x12')])+'AccountId']=this['account']['id'];}_0x423b4a[_['upperFirst'](this[_0x0f47('0x12')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x0f47('0x12')]+_0x0f47('0x25')]){if(this[_0x0f47('0x12')]===_0x0f47('0x16')){var _0x28edc5={'tls':{'rejectUnauthorized':![]}};if(this[_0x0f47('0x23')][_0x0f47('0x26')]['service']){_0x28edc5['service']=this[_0x0f47('0x23')][_0x0f47('0x26')][_0x0f47('0x27')];}else{_0x28edc5['host']=this[_0x0f47('0x23')][_0x0f47('0x26')][_0x0f47('0x28')];_0x28edc5[_0x0f47('0x29')]=this['account'][_0x0f47('0x26')][_0x0f47('0x29')];_0x28edc5[_0x0f47('0x2a')]=this[_0x0f47('0x23')][_0x0f47('0x26')][_0x0f47('0x2a')];}if(this[_0x0f47('0x23')][_0x0f47('0x26')][_0x0f47('0x2b')]){_0x28edc5[_0x0f47('0x2c')]={'user':this[_0x0f47('0x23')][_0x0f47('0x26')]['user'],'pass':this[_0x0f47('0x23')][_0x0f47('0x26')][_0x0f47('0x2d')]};}_0x423b4a[_0x0f47('0x2e')]=this[_0x0f47('0x19')]['messageId'];_0x423b4a[_0x0f47('0x2f')]=_0x0f47('0x30')+_[_0x0f47('0x31')](_0x423b4a['body'],_0x0f47('0x32'),_0x0f47('0x33'))+_0x0f47('0x34');_0x423b4a[_0x0f47('0x35')]={'Auto-Submitted':_0x0f47('0x36'),'X-Auto-Response-Suppress':_0x0f47('0x37'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](_0x28edc5,_0x423b4a)['then'](function(_0x29d2e9){logger['info'](_0x0f47('0x38'),_0x428c24);_0x423b4a['messageId']=_0x29d2e9[_0x0f47('0x19')][_0x0f47('0x39')];return rpc[_0x2196d2+_0x0f47('0x25')][_0x0f47('0x3a')](_0x423b4a);})['then'](function(_0x38470b){logger[_0x0f47('0xe')](_0x0f47('0xf'),_0x428c24,JSON[_0x0f47('0x3b')](_0x38470b));})[_0x0f47('0x3c')](function(_0x4d7d38){logger[_0x0f47('0x3d')](_0x0f47('0x3e'),_0x428c24,JSON[_0x0f47('0x3b')](_0x4d7d38));})[_0x0f47('0x3f')](function(){_0x3c1886[_0x0f47('0x11')]();});}else{return rpc[this['channel']+'Message']['create'](_0x423b4a)[_0x0f47('0x40')](function(_0x813d0d){logger[_0x0f47('0xe')]('[%s][AUTOREPLY]\x20%s',_0x428c24,_0x423b4a[_0x0f47('0x17')]);})[_0x0f47('0x3c')](function(_0x4814fe){logger['error']('[%s][AUTOREPLY]\x20%s',_0x428c24,JSON[_0x0f47('0x3b')](_0x4814fe));})['finally'](function(){_0x3c1886[_0x0f47('0x11')]();});}}}catch(_0x332e55){logger['error'](_0x0f47('0xf'),_0x428c24,JSON[_0x0f47('0x3b')](_0x332e55));_0x3c1886[_0x0f47('0x41')]();}};}; \ 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 dcbeebf..8930127 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 _0x22e3=['[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','finally','stop','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x22e3,0xf3));var _0x322e=function(_0xb54cb8,_0x4f35b1){_0xb54cb8=_0xb54cb8-0x0;var _0x492e41=_0x22e3[_0xb54cb8];return _0x492e41;};'use strict';var moment=require(_0x322e('0x0'));var logger=require(_0x322e('0x1'))(_0x322e('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x322e('0x3')),'smsInteraction':require(_0x322e('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x322e('0x5')),'whatsappInteraction':require(_0x322e('0x6'))};exports[_0x322e('0x7')]=function(_0x371172,_0x445987,_0x539bdb,_0x41afa2){return function(_0x2b8360){try{logger[_0x322e('0x8')](_0x322e('0x9'),_0x371172,_0x445987[0x0]);var _0xaba26c={'closed':0x1,'closedAt':moment()[_0x322e('0xa')](_0x322e('0xb')),'closeReason':_0x322e('0xc'),'disposition':_0x445987[0x0]};if(rpc[_0x41afa2[_0x322e('0xd')]+'Interaction']){rpc[_0x41afa2['channel']+_0x322e('0xe')]['update'](_0x41afa2[_0x322e('0xf')]['id'],_0xaba26c)['then'](function(_0x59abbb){logger['info'](_0x322e('0x10'),_0x371172,_0x41afa2[_0x322e('0xf')]['id']);})['catch'](function(_0x3f4694){logger[_0x322e('0x11')](_0x322e('0x12'),_0x371172,JSON['stringify'](_0x3f4694));})[_0x322e('0x13')](function(){_0x2b8360[_0x322e('0x14')]();});}}catch(_0x1276b2){logger[_0x322e('0x11')]('[%s][CLOSE]\x20%s',_0x371172,JSON['stringify'](_0x1276b2));_0x2b8360[_0x322e('0x14')]();}};}; \ No newline at end of file +var _0x9e2e=['error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format','system','channel','Interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!'];(function(_0x56949c,_0xae6760){var _0x496cdf=function(_0x214dae){while(--_0x214dae){_0x56949c['push'](_0x56949c['shift']());}};_0x496cdf(++_0xae6760);}(_0x9e2e,0xd6));var _0xe9e2=function(_0x1fe0cb,_0x452e1a){_0x1fe0cb=_0x1fe0cb-0x0;var _0xcb8a22=_0x9e2e[_0x1fe0cb];return _0xcb8a22;};'use strict';var moment=require(_0xe9e2('0x0'));var logger=require(_0xe9e2('0x1'))(_0xe9e2('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xe9e2('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xe9e2('0x4')),'whatsappInteraction':require(_0xe9e2('0x5'))};exports[_0xe9e2('0x6')]=function(_0x212d98,_0x396f0f,_0x281ef5,_0x2e4d19){return function(_0x5ca0aa){try{logger[_0xe9e2('0x7')]('[%s][CLOSE]\x20reason\x20%s',_0x212d98,_0x396f0f[0x0]);var _0x2bec58={'closed':0x1,'closedAt':moment()[_0xe9e2('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xe9e2('0x9'),'disposition':_0x396f0f[0x0]};if(rpc[_0x2e4d19[_0xe9e2('0xa')]+'Interaction']){rpc[_0x2e4d19[_0xe9e2('0xa')]+_0xe9e2('0xb')]['update'](_0x2e4d19['interaction']['id'],_0x2bec58)[_0xe9e2('0xc')](function(_0x359f9c){logger[_0xe9e2('0x7')](_0xe9e2('0xd'),_0x212d98,_0x2e4d19['interaction']['id']);})['catch'](function(_0x1b6493){logger[_0xe9e2('0xe')](_0xe9e2('0xf'),_0x212d98,JSON[_0xe9e2('0x10')](_0x1b6493));})[_0xe9e2('0x11')](function(){_0x5ca0aa[_0xe9e2('0x12')]();});}}catch(_0x41ea08){logger[_0xe9e2('0xe')](_0xe9e2('0xf'),_0x212d98,JSON[_0xe9e2('0x10')](_0x41ea08));_0x5ca0aa['stop']();}};}; \ 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 1f926b0..910ad87 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 _0x5c7a=['routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','channel','sms','whatsapp','phone','chat','upperFirst','InteractionId','body','Message','create','then','catch','error','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','dialogflow','result','fulfillment','speech','providerName','metadata','endConversation','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger'];(function(_0x331a2c,_0xc59b3e){var _0x508e83=function(_0x5e8d02){while(--_0x5e8d02){_0x331a2c['push'](_0x331a2c['shift']());}};_0x508e83(++_0xc59b3e);}(_0x5c7a,0x8d));var _0xa5c7=function(_0x3b76f7,_0x566c53){_0x3b76f7=_0x3b76f7-0x0;var _0x43984e=_0x5c7a[_0x3b76f7];return _0x43984e;};'use strict';var _=require(_0xa5c7('0x0'));var moment=require(_0xa5c7('0x1'));var apiai=require(_0xa5c7('0x2'));var md5=require(_0xa5c7('0x3'));var utils=require(_0xa5c7('0x4'));var logger=require(_0xa5c7('0x5'))(_0xa5c7('0x6'));var rpc={'chatMessage':require(_0xa5c7('0x7')),'openchannelMessage':require(_0xa5c7('0x8')),'mailMessage':require(_0xa5c7('0x9')),'smsMessage':require(_0xa5c7('0xa')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xa5c7('0xb'))};exports[_0xa5c7('0xc')]=function(_0x5e1940,_0x214e3f){return function(_0x5cc82f){try{if(!_[_0xa5c7('0xd')](this[_0xa5c7('0xe')][_0xa5c7('0xf')])){logger[_0xa5c7('0x10')](_0xa5c7('0x11'),_0x5e1940,_0xa5c7('0x12'));return _0x5cc82f[_0xa5c7('0x13')]();}var _0x3a5fa9={'ContactId':this[_0xa5c7('0x14')]['id'],'sentAt':moment()[_0xa5c7('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0xa5c7('0x16')]===_0xa5c7('0x17')||this[_0xa5c7('0x16')]===_0xa5c7('0x18')){_0x3a5fa9['phone']=this['interaction'][_0xa5c7('0x19')];}var _0x5a8fae=this[_0xa5c7('0x16')];if(_0x5a8fae===_0xa5c7('0x1a')){_0x3a5fa9['ChatWebsiteId']=this['account']['id'];}else{_0x3a5fa9[_['upperFirst'](_0x5a8fae)+'AccountId']=this['account']['id'];}_0x3a5fa9[_[_0xa5c7('0x1b')](_0x5a8fae)+_0xa5c7('0x1c')]=this['interaction']['id'];if(this[_0xa5c7('0xe')]['created']){var _0x59aa63=_0x214e3f[0x2];if(!_['isEmpty'](_0x59aa63)){_0x3a5fa9[_0xa5c7('0x1d')]=utils['getMustacheRender'](_0x59aa63,this);return rpc[_0x5a8fae+_0xa5c7('0x1e')][_0xa5c7('0x1f')](_0x3a5fa9)[_0xa5c7('0x20')](function(_0x32963d){logger['info'](_0xa5c7('0x11'),_0x5e1940,_0x3a5fa9[_0xa5c7('0x1d')]);})[_0xa5c7('0x21')](function(_0x1b8784){logger[_0xa5c7('0x22')](_0xa5c7('0x11'),_0x5e1940,JSON[_0xa5c7('0x23')](_0x1b8784));})[_0xa5c7('0x24')](function(){logger[_0xa5c7('0x10')](_0xa5c7('0x25'),_0x5e1940);_0x5cc82f[_0xa5c7('0x26')]();});}else{logger[_0xa5c7('0x10')](_0xa5c7('0x27'),_0x5e1940);_0x5cc82f[_0xa5c7('0x26')]();}}else{var _0x18fca9=this;var _0x2815fa=apiai(_0x214e3f[0x0],{'language':_0x214e3f[0x1]||'en'});return _0x2815fa[_0xa5c7('0x28')](this[_0xa5c7('0x29')][_0xa5c7('0x1d')],{'sessionId':md5(this[_0xa5c7('0xe')]['id'])})[_0xa5c7('0x20')](function(_0x4defe0){_0x18fca9[_0xa5c7('0x1d')][_0xa5c7('0x2a')]=_0x4defe0;_0x3a5fa9['body']=_0x4defe0[_0xa5c7('0x2b')][_0xa5c7('0x2c')][_0xa5c7('0x2d')];_0x3a5fa9[_0xa5c7('0x2e')]=_0xa5c7('0x2a');_0x3a5fa9['providerResponse']=JSON[_0xa5c7('0x23')](_0x4defe0);return rpc[_0x5a8fae+'Message'][_0xa5c7('0x1f')](_0x3a5fa9)[_0xa5c7('0x20')](function(_0x27b26c){logger[_0xa5c7('0x10')](_0xa5c7('0x11'),_0x5e1940,_0x3a5fa9[_0xa5c7('0x1d')]);if(_0x4defe0[_0xa5c7('0x2b')][_0xa5c7('0x2f')][_0xa5c7('0x30')]){_0x5cc82f['next']();}else{_0x5cc82f['stop']();}})[_0xa5c7('0x21')](function(_0x5dbecd){logger[_0xa5c7('0x22')](_0xa5c7('0x11'),_0x5e1940,JSON[_0xa5c7('0x23')](_0x5dbecd));_0x5cc82f['next']();});})[_0xa5c7('0x21')](function(_0x545641){logger[_0xa5c7('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x5e1940,_0x545641[_0xa5c7('0x29')]);_0x5cc82f['next']();});}}catch(_0x28de0f){logger[_0xa5c7('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x5e1940,JSON[_0xa5c7('0x23')](_0x28de0f));_0x5cc82f[_0xa5c7('0x26')]();}};}; \ No newline at end of file +var _0xe021=['then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','message','result','fulfillment','speech','providerName','dialogflow','Message','create','metadata','endConversation','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','account','upperFirst','isEmpty','body','getMustacheRender'];(function(_0x5d439a,_0x26e5dd){var _0x260eed=function(_0x11f503){while(--_0x11f503){_0x5d439a['push'](_0x5d439a['shift']());}};_0x260eed(++_0x26e5dd);}(_0xe021,0x138));var _0x1e02=function(_0xc73f97,_0x52dcbc){_0xc73f97=_0xc73f97-0x0;var _0x3bc64b=_0xe021[_0xc73f97];return _0x3bc64b;};'use strict';var _=require(_0x1e02('0x0'));var moment=require(_0x1e02('0x1'));var apiai=require(_0x1e02('0x2'));var md5=require(_0x1e02('0x3'));var utils=require(_0x1e02('0x4'));var logger=require(_0x1e02('0x5'))(_0x1e02('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x1e02('0x7')),'mailMessage':require(_0x1e02('0x8')),'smsMessage':require(_0x1e02('0x9')),'faxMessage':require(_0x1e02('0xa')),'whatsappMessage':require(_0x1e02('0xb'))};exports['consequence']=function(_0x1dc9a1,_0x54f139){return function(_0x598282){try{if(!_[_0x1e02('0xc')](this[_0x1e02('0xd')][_0x1e02('0xe')])){logger[_0x1e02('0xf')](_0x1e02('0x10'),_0x1dc9a1,_0x1e02('0x11'));return _0x598282[_0x1e02('0x12')]();}var _0x3bbe6e={'ContactId':this[_0x1e02('0x13')]['id'],'sentAt':moment()['format'](_0x1e02('0x14')),'direction':_0x1e02('0x15')};if(this[_0x1e02('0x16')]==='sms'||this['channel']===_0x1e02('0x17')){_0x3bbe6e[_0x1e02('0x18')]=this['interaction'][_0x1e02('0x18')];}var _0x15f1fc=this[_0x1e02('0x16')];if(_0x15f1fc===_0x1e02('0x19')){_0x3bbe6e['ChatWebsiteId']=this[_0x1e02('0x1a')]['id'];}else{_0x3bbe6e[_[_0x1e02('0x1b')](_0x15f1fc)+'AccountId']=this[_0x1e02('0x1a')]['id'];}_0x3bbe6e[_['upperFirst'](_0x15f1fc)+'InteractionId']=this[_0x1e02('0xd')]['id'];if(this['interaction']['created']){var _0x2012e0=_0x54f139[0x2];if(!_[_0x1e02('0x1c')](_0x2012e0)){_0x3bbe6e[_0x1e02('0x1d')]=utils[_0x1e02('0x1e')](_0x2012e0,this);return rpc[_0x15f1fc+'Message']['create'](_0x3bbe6e)[_0x1e02('0x1f')](function(_0x5cad8b){logger[_0x1e02('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x1dc9a1,_0x3bbe6e[_0x1e02('0x1d')]);})[_0x1e02('0x20')](function(_0x49f6d7){logger[_0x1e02('0x21')](_0x1e02('0x10'),_0x1dc9a1,JSON[_0x1e02('0x22')](_0x49f6d7));})[_0x1e02('0x23')](function(){logger[_0x1e02('0xf')](_0x1e02('0x24'),_0x1dc9a1);_0x598282['stop']();});}else{logger[_0x1e02('0xf')](_0x1e02('0x25'),_0x1dc9a1);_0x598282[_0x1e02('0x26')]();}}else{var _0x3b4efd=this;var _0x2086c5=apiai(_0x54f139[0x0],{'language':_0x54f139[0x1]||'en'});return _0x2086c5['textRequest'](this[_0x1e02('0x27')][_0x1e02('0x1d')],{'sessionId':md5(this[_0x1e02('0xd')]['id'])})[_0x1e02('0x1f')](function(_0xa3d4c7){_0x3b4efd['body']['dialogflow']=_0xa3d4c7;_0x3bbe6e['body']=_0xa3d4c7[_0x1e02('0x28')][_0x1e02('0x29')][_0x1e02('0x2a')];_0x3bbe6e[_0x1e02('0x2b')]=_0x1e02('0x2c');_0x3bbe6e['providerResponse']=JSON['stringify'](_0xa3d4c7);return rpc[_0x15f1fc+_0x1e02('0x2d')][_0x1e02('0x2e')](_0x3bbe6e)[_0x1e02('0x1f')](function(_0x13bc42){logger[_0x1e02('0xf')](_0x1e02('0x10'),_0x1dc9a1,_0x3bbe6e[_0x1e02('0x1d')]);if(_0xa3d4c7[_0x1e02('0x28')][_0x1e02('0x2f')][_0x1e02('0x30')]){_0x598282[_0x1e02('0x12')]();}else{_0x598282[_0x1e02('0x26')]();}})['catch'](function(_0x2f9546){logger[_0x1e02('0x21')](_0x1e02('0x10'),_0x1dc9a1,JSON[_0x1e02('0x22')](_0x2f9546));_0x598282[_0x1e02('0x12')]();});})[_0x1e02('0x20')](function(_0x3d5eb9){logger[_0x1e02('0x21')](_0x1e02('0x10'),_0x1dc9a1,_0x3d5eb9['message']);_0x598282[_0x1e02('0x12')]();});}}catch(_0x15deb8){logger[_0x1e02('0x21')](_0x1e02('0x10'),_0x1dc9a1,JSON[_0x1e02('0x22')](_0x15deb8));_0x598282[_0x1e02('0x26')]();}};}; \ 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 3b1b1f0..ef373c6 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 _0x69ee=['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','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','message','detectIntent','length','queryResult','diagnosticInfo','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','fields','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','providerResponse','fulfillmentText','push','lodash','dialogflow','md5','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error'];(function(_0x511d3a,_0x2d490d){var _0x2faf25=function(_0x279e3a){while(--_0x279e3a){_0x511d3a['push'](_0x511d3a['shift']());}};_0x2faf25(++_0x2d490d);}(_0x69ee,0x1b5));var _0xe69e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x69ee[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xe69e('0x0'));var dialogflow=require(_0xe69e('0x1'));var md5=require(_0xe69e('0x2'));var moment=require('moment');var Promise=require('bluebird');var logger=require(_0xe69e('0x3'))(_0xe69e('0x4'));var utils=require(_0xe69e('0x5'));var rpc={'chatMessage':require(_0xe69e('0x6')),'openchannelMessage':require(_0xe69e('0x7')),'mailMessage':require(_0xe69e('0x8')),'smsMessage':require(_0xe69e('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xe69e('0xa'))};function createMessage(_0x5da30f,_0x221e18,_0x548eec,_0x90d22f){return new Promise(function(_0x5ed117,_0x3c2a91){var _0x13bd12=_['clone'](_0x548eec);_0x13bd12['body']=_0x90d22f;return rpc[_0x221e18+_0xe69e('0xb')][_0xe69e('0xc')](_0x13bd12)[_0xe69e('0xd')](function(){logger[_0xe69e('0xe')](_0xe69e('0xf'),_0x5da30f,_0x13bd12[_0xe69e('0x10')]);_0x5ed117();})[_0xe69e('0x11')](function(_0x371913){logger[_0xe69e('0x12')](_0xe69e('0xf'),_0x5da30f,JSON[_0xe69e('0x13')](_0x371913));_0x3c2a91(_0x371913);});});}exports[_0xe69e('0x14')]=function(_0x59a18c,_0x51edf8){return function(_0x4d7d76){try{if(!_[_0xe69e('0x15')](this[_0xe69e('0x16')][_0xe69e('0x17')])){logger[_0xe69e('0xe')](_0xe69e('0xf'),_0x59a18c,_0xe69e('0x18'));return _0x4d7d76[_0xe69e('0x19')]();}var _0x58e211={'ContactId':this[_0xe69e('0x1a')]['id'],'sentAt':moment()[_0xe69e('0x1b')](_0xe69e('0x1c')),'direction':_0xe69e('0x1d')};if(this['channel']===_0xe69e('0x1e')||this[_0xe69e('0x1f')]==='whatsapp'){_0x58e211[_0xe69e('0x20')]=this[_0xe69e('0x16')][_0xe69e('0x20')];}var _0x2b2ea0=this['channel'];if(_0x2b2ea0===_0xe69e('0x21')){_0x58e211[_0xe69e('0x22')]=this[_0xe69e('0x23')]['id'];}else{_0x58e211[_[_0xe69e('0x24')](_0x2b2ea0)+'AccountId']=this[_0xe69e('0x23')]['id'];}_0x58e211[_['upperFirst'](_0x2b2ea0)+_0xe69e('0x25')]=this[_0xe69e('0x16')]['id'];if(this['interaction'][_0xe69e('0x26')]){var _0x28d5b1=_0x51edf8[0x4];if(!_[_0xe69e('0x27')](_0x28d5b1)){_0x58e211[_0xe69e('0x10')]=utils[_0xe69e('0x28')](_0x28d5b1,this);return rpc[_0x2b2ea0+_0xe69e('0xb')]['create'](_0x58e211)[_0xe69e('0xd')](function(_0x35a597){logger[_0xe69e('0xe')](_0xe69e('0xf'),_0x59a18c,_0x58e211[_0xe69e('0x10')]);})['catch'](function(_0x234b11){logger['error'](_0xe69e('0xf'),_0x59a18c,JSON[_0xe69e('0x13')](_0x234b11));})[_0xe69e('0x29')](function(){logger[_0xe69e('0xe')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x59a18c);_0x4d7d76[_0xe69e('0x2a')]();});}else{logger[_0xe69e('0xe')](_0xe69e('0x2b'),_0x59a18c);_0x4d7d76['stop']();}}else{var _0x240f82=this;var _0x223273=_0x51edf8[0x2]['replace'](/\\n/g,'\x0a');var _0x16f4c9={'credentials':{'private_key':_0x223273,'client_email':_0x51edf8[0x1]}};var _0x4d19a7=new dialogflow[(_0xe69e('0x2c'))](_0x16f4c9);var _0x1d10d7=_0x4d19a7[_0xe69e('0x2d')](_0x51edf8[0x0],md5(_0x240f82[_0xe69e('0x16')]['id']));var _0x2ccb7d={'session':_0x1d10d7,'queryInput':{'text':{'text':_0x240f82[_0xe69e('0x2e')][_0xe69e('0x10')],'languageCode':_0x51edf8[0x3]||'en'}}};return _0x4d19a7[_0xe69e('0x2f')](_0x2ccb7d)['then'](function(_0x442856){if(_0x442856&&_0x442856[_0xe69e('0x30')]){_0x240f82[_0xe69e('0x10')]['dialogflowV2']=_0x442856;var _0x59ac76=_0x442856[0x0];var _0xf141be=_0x59ac76[_0xe69e('0x31')]['diagnosticInfo']&&_0x59ac76['queryResult'][_0xe69e('0x32')]['fields']?_0x59ac76['queryResult'][_0xe69e('0x32')]['fields'][_0xe69e('0x33')][_0xe69e('0x34')]:![];_0x240f82['body'][_0xe69e('0x35')]=_0x59ac76[_0xe69e('0x31')][_0xe69e('0x36')];_0x240f82['body'][_0xe69e('0x37')]=_0x59ac76[_0xe69e('0x31')][_0xe69e('0x38')];_0x240f82[_0xe69e('0x10')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x59ac76[_0xe69e('0x31')][_0xe69e('0x32')]&&_0x59ac76[_0xe69e('0x31')][_0xe69e('0x32')]['fields']?_0x59ac76['queryResult'][_0xe69e('0x32')][_0xe69e('0x39')][_0xe69e('0x33')][_0xe69e('0x34')]:![];_0x240f82[_0xe69e('0x10')][_0xe69e('0x3a')]=_0x59ac76[_0xe69e('0x31')][_0xe69e('0x3b')][_0xe69e('0x3c')];_0x240f82[_0xe69e('0x10')][_0xe69e('0x3d')]=_0x59ac76['queryResult']['intent'][_0xe69e('0x3e')];_0x240f82[_0xe69e('0x10')][_0xe69e('0x3f')]=_0x59ac76[_0xe69e('0x31')]['intent'][_0xe69e('0x40')];_0x240f82[_0xe69e('0x10')][_0xe69e('0x41')]=_0x59ac76[_0xe69e('0x31')][_0xe69e('0x42')];_0x240f82[_0xe69e('0x10')][_0xe69e('0x43')]=_0x59ac76[_0xe69e('0x31')][_0xe69e('0x44')];_0x240f82[_0xe69e('0x10')][_0xe69e('0x45')]=_0x59ac76[_0xe69e('0x31')][_0xe69e('0x46')];_0x58e211[_0xe69e('0x47')]=_0xe69e('0x48');_0x58e211[_0xe69e('0x49')]=JSON[_0xe69e('0x13')](_0x442856);var _0x4b35e1=[];for(var _0x2d2687=0x0;_0x2d2687<_0x442856[_0xe69e('0x30')];_0x2d2687++){var _0x4bd42d=_0x442856[_0x2d2687];if(_0x4bd42d&&_0x4bd42d['queryResult']&&_0x4bd42d['queryResult'][_0xe69e('0x4a')]){_0x4b35e1[_0xe69e('0x4b')](createMessage(_0x59a18c,_0x2b2ea0,_0x58e211,_0x4bd42d[_0xe69e('0x31')]['fulfillmentText']));}}return Promise['all'](_0x4b35e1)[_0xe69e('0xd')](function(){if(_0xf141be){_0x4d7d76[_0xe69e('0x19')]();}else{_0x4d7d76['stop']();}})['catch'](function(_0x491c7e){logger[_0xe69e('0x12')](_0xe69e('0xf'),_0x59a18c,JSON[_0xe69e('0x13')](_0x491c7e));_0x4d7d76['next']();});}})[_0xe69e('0x11')](function(_0x263c4f){logger[_0xe69e('0x12')](_0xe69e('0xf'),_0x59a18c,_0x263c4f['message']);_0x4d7d76[_0xe69e('0x19')]();});}}catch(_0x5875a8){logger[_0xe69e('0x12')](_0xe69e('0xf'),_0x59a18c,JSON['stringify'](_0x5875a8));_0x4d7d76[_0xe69e('0x2a')]();}};}; \ No newline at end of file +var _0x663d=['info','catch','error','stringify','consequence','isNil','interaction','[%s][DIALOGFLOWV2]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','upperFirst','AccountId','account','created','body','create','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','message','detectIntent','dialogflowV2','diagnosticInfo','queryResult','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText','push','next','lodash','md5','moment','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','Message','then'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x663d,0x7f));var _0xd663=function(_0x586b6f,_0xc6acbf){_0x586b6f=_0x586b6f-0x0;var _0x2ce935=_0x663d[_0x586b6f];return _0x2ce935;};'use strict';var _=require(_0xd663('0x0'));var dialogflow=require('dialogflow');var md5=require(_0xd663('0x1'));var moment=require(_0xd663('0x2'));var Promise=require(_0xd663('0x3'));var logger=require(_0xd663('0x4'))(_0xd663('0x5'));var utils=require('./utils');var rpc={'chatMessage':require(_0xd663('0x6')),'openchannelMessage':require(_0xd663('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xd663('0x8')),'faxMessage':require(_0xd663('0x9')),'whatsappMessage':require(_0xd663('0xa'))};function createMessage(_0x27cd4c,_0x3180e5,_0x5c2358,_0x4abc21){return new Promise(function(_0x158edc,_0x54d632){var _0x416da7=_['clone'](_0x5c2358);_0x416da7['body']=_0x4abc21;return rpc[_0x3180e5+_0xd663('0xb')]['create'](_0x416da7)[_0xd663('0xc')](function(){logger[_0xd663('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x27cd4c,_0x416da7['body']);_0x158edc();})[_0xd663('0xe')](function(_0x32fdf1){logger[_0xd663('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x27cd4c,JSON[_0xd663('0x10')](_0x32fdf1));_0x54d632(_0x32fdf1);});});}exports[_0xd663('0x11')]=function(_0x2544b9,_0x139b09){return function(_0x45962e){try{if(!_[_0xd663('0x12')](this[_0xd663('0x13')]['UserId'])){logger[_0xd663('0xd')](_0xd663('0x14'),_0x2544b9,_0xd663('0x15'));return _0x45962e['next']();}var _0x306ed3={'ContactId':this[_0xd663('0x16')]['id'],'sentAt':moment()['format'](_0xd663('0x17')),'direction':_0xd663('0x18')};if(this['channel']===_0xd663('0x19')||this[_0xd663('0x1a')]===_0xd663('0x1b')){_0x306ed3[_0xd663('0x1c')]=this[_0xd663('0x13')][_0xd663('0x1c')];}var _0x3aff48=this[_0xd663('0x1a')];if(_0x3aff48==='chat'){_0x306ed3['ChatWebsiteId']=this['account']['id'];}else{_0x306ed3[_[_0xd663('0x1d')](_0x3aff48)+_0xd663('0x1e')]=this[_0xd663('0x1f')]['id'];}_0x306ed3[_[_0xd663('0x1d')](_0x3aff48)+'InteractionId']=this[_0xd663('0x13')]['id'];if(this['interaction'][_0xd663('0x20')]){var _0x3281a3=_0x139b09[0x4];if(!_['isEmpty'](_0x3281a3)){_0x306ed3[_0xd663('0x21')]=utils['getMustacheRender'](_0x3281a3,this);return rpc[_0x3aff48+_0xd663('0xb')][_0xd663('0x22')](_0x306ed3)['then'](function(_0x764a02){logger[_0xd663('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x2544b9,_0x306ed3[_0xd663('0x21')]);})[_0xd663('0xe')](function(_0x393e8a){logger[_0xd663('0xf')](_0xd663('0x14'),_0x2544b9,JSON[_0xd663('0x10')](_0x393e8a));})[_0xd663('0x23')](function(){logger['info'](_0xd663('0x24'),_0x2544b9);_0x45962e[_0xd663('0x25')]();});}else{logger[_0xd663('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2544b9);_0x45962e[_0xd663('0x25')]();}}else{var _0x426ac1=this;var _0x3f929c=_0x139b09[0x2][_0xd663('0x26')](/\\n/g,'\x0a');var _0x5ed5cf={'credentials':{'private_key':_0x3f929c,'client_email':_0x139b09[0x1]}};var _0x4b1ef8=new dialogflow[(_0xd663('0x27'))](_0x5ed5cf);var _0x5ab69e=_0x4b1ef8[_0xd663('0x28')](_0x139b09[0x0],md5(_0x426ac1[_0xd663('0x13')]['id']));var _0x181696={'session':_0x5ab69e,'queryInput':{'text':{'text':_0x426ac1[_0xd663('0x29')]['body'],'languageCode':_0x139b09[0x3]||'en'}}};return _0x4b1ef8[_0xd663('0x2a')](_0x181696)[_0xd663('0xc')](function(_0x526883){if(_0x526883&&_0x526883['length']){_0x426ac1[_0xd663('0x21')][_0xd663('0x2b')]=_0x526883;var _0x26c882=_0x526883[0x0];var _0x4b8580=_0x26c882['queryResult'][_0xd663('0x2c')]&&_0x26c882[_0xd663('0x2d')]['diagnosticInfo'][_0xd663('0x2e')]?_0x26c882[_0xd663('0x2d')][_0xd663('0x2c')][_0xd663('0x2e')]['end_conversation'][_0xd663('0x2f')]:![];_0x426ac1[_0xd663('0x21')][_0xd663('0x30')]=_0x26c882['queryResult'][_0xd663('0x31')];_0x426ac1[_0xd663('0x21')][_0xd663('0x32')]=_0x26c882[_0xd663('0x2d')][_0xd663('0x33')];_0x426ac1[_0xd663('0x21')][_0xd663('0x34')]=_0x26c882['queryResult'][_0xd663('0x2c')]&&_0x26c882['queryResult']['diagnosticInfo'][_0xd663('0x2e')]?_0x26c882[_0xd663('0x2d')][_0xd663('0x2c')]['fields'][_0xd663('0x35')][_0xd663('0x2f')]:![];_0x426ac1[_0xd663('0x21')][_0xd663('0x36')]=_0x26c882[_0xd663('0x2d')]['intent'][_0xd663('0x37')];_0x426ac1['body'][_0xd663('0x38')]=_0x26c882[_0xd663('0x2d')][_0xd663('0x39')][_0xd663('0x3a')];_0x426ac1['body'][_0xd663('0x3b')]=_0x26c882[_0xd663('0x2d')]['intent'][_0xd663('0x3c')];_0x426ac1[_0xd663('0x21')][_0xd663('0x3d')]=_0x26c882[_0xd663('0x2d')][_0xd663('0x3e')];_0x426ac1[_0xd663('0x21')]['DIALOGFLOWV2_QUERYTEXT']=_0x26c882[_0xd663('0x2d')][_0xd663('0x3f')];_0x426ac1['body'][_0xd663('0x40')]=_0x26c882[_0xd663('0x2d')][_0xd663('0x41')];_0x306ed3['providerName']=_0xd663('0x2b');_0x306ed3[_0xd663('0x42')]=JSON['stringify'](_0x526883);var _0x44ae5f=[];for(var _0x1bcdb2=0x0;_0x1bcdb2<_0x526883['length'];_0x1bcdb2++){var _0x1db6e3=_0x526883[_0x1bcdb2];if(_0x1db6e3&&_0x1db6e3[_0xd663('0x2d')]&&_0x1db6e3[_0xd663('0x2d')][_0xd663('0x43')]){_0x44ae5f[_0xd663('0x44')](createMessage(_0x2544b9,_0x3aff48,_0x306ed3,_0x1db6e3[_0xd663('0x2d')][_0xd663('0x43')]));}}return Promise['all'](_0x44ae5f)[_0xd663('0xc')](function(){if(_0x4b8580){_0x45962e[_0xd663('0x45')]();}else{_0x45962e[_0xd663('0x25')]();}})[_0xd663('0xe')](function(_0x7e5b22){logger[_0xd663('0xf')](_0xd663('0x14'),_0x2544b9,JSON[_0xd663('0x10')](_0x7e5b22));_0x45962e[_0xd663('0x45')]();});}})[_0xd663('0xe')](function(_0x25e869){logger[_0xd663('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x2544b9,_0x25e869[_0xd663('0x29')]);_0x45962e[_0xd663('0x45')]();});}}catch(_0x377cae){logger[_0xd663('0xf')](_0xd663('0x14'),_0x2544b9,JSON['stringify'](_0x377cae));_0x45962e['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 39fb06a..3d50f5f 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 _0xe8d0=['stop','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','length','error','[%s][GOTOIF]\x20%s','message','join','priorityTrue','priorityFalse','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s'];(function(_0x53759c,_0x1af346){var _0x4dd952=function(_0x5ba248){while(--_0x5ba248){_0x53759c['push'](_0x53759c['shift']());}};_0x4dd952(++_0x1af346);}(_0xe8d0,0x153));var _0x0e8d=function(_0x3bb601,_0x50e988){_0x3bb601=_0x3bb601-0x0;var _0x4faf04=_0xe8d0[_0x3bb601];return _0x4faf04;};'use strict';var schema=require(_0x0e8d('0x0'));var _=require(_0x0e8d('0x1'));var htmlToText=require(_0x0e8d('0x2'));var utils=require(_0x0e8d('0x3'));var logger=require(_0x0e8d('0x4'))(_0x0e8d('0x5'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x0e8d('0x6')},'priorityTrue':{'type':'number','message':_0x0e8d('0x7')},'priorityFalse':{'type':'number','message':_0x0e8d('0x8')}});exports[_0x0e8d('0x9')]=function(_0x11d7fb,_0x5033eb){return function(_0x1b4ecb){try{var _0x4efd56={'condition':htmlToText[_0x0e8d('0xa')](utils['getMustacheRender'](_0x5033eb[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5033eb[0x1],'priorityFalse':_0x5033eb[0x2]};var _0x30f455=gotoif[_0x0e8d('0x0')](_0x4efd56,{'typecast':!![]});if(_0x30f455[_0x0e8d('0xb')]){logger[_0x0e8d('0xc')](_0x0e8d('0xd'),_0x11d7fb,_['map'](_0x30f455,_0x0e8d('0xe'))[_0x0e8d('0xf')](',\x20'));_0x1b4ecb['stop']();}else{try{var _0xd76dcc=eval('('+_0x4efd56['condition']+')');var _0x380969=_0xd76dcc?_0x4efd56[_0x0e8d('0x10')]:_0x4efd56[_0x0e8d('0x11')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x11d7fb,_0x4efd56['condition'],_0xd76dcc,_0x380969||_0x0e8d('0x12'));if(_0x380969){var _0x132db8=_[_0x0e8d('0x13')](_0x1b4ecb[_0x0e8d('0x14')](),{'p':_0x380969});if(_0x132db8>=0x0){logger['info'](_0x0e8d('0x15'),_0x11d7fb,_0x380969||_0x0e8d('0x12'),_0x132db8);_0x1b4ecb['next'](_0x132db8);}else{logger[_0x0e8d('0x16')](_0x0e8d('0x17'),_0x11d7fb,_0x380969||_0x0e8d('0x12'));_0x1b4ecb['stop']();}}else{_0x1b4ecb[_0x0e8d('0x12')]();}}catch(_0x30a9e8){logger['error'](_0x0e8d('0x18'),_0x11d7fb,_0x30a9e8[_0x0e8d('0xe')]);_0x1b4ecb[_0x0e8d('0x19')]();}}}catch(_0x32ec11){logger['error'](_0x0e8d('0xd'),_0x11d7fb,JSON['stringify'](_0x32ec11));_0x1b4ecb[_0x0e8d('0x19')]();}};}; \ No newline at end of file +var _0x0ae9=['info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','error','map','message','join','stop','condition','priorityTrue','priorityFalse'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0ae9,0xdb));var _0x90ae=function(_0x224998,_0x2960e2){_0x224998=_0x224998-0x0;var _0x5677f9=_0x0ae9[_0x224998];return _0x5677f9;};'use strict';var schema=require(_0x90ae('0x0'));var _=require(_0x90ae('0x1'));var htmlToText=require(_0x90ae('0x2'));var utils=require(_0x90ae('0x3'));var logger=require(_0x90ae('0x4'))('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x90ae('0x5')},'priorityTrue':{'type':'number','message':_0x90ae('0x6')},'priorityFalse':{'type':_0x90ae('0x7'),'message':_0x90ae('0x8')}});exports[_0x90ae('0x9')]=function(_0x37a220,_0x11de7f){return function(_0x53b35b){try{var _0x421921={'condition':htmlToText[_0x90ae('0xa')](utils[_0x90ae('0xb')](_0x11de7f[0x0],this),{'wordwrap':![]})[_0x90ae('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x11de7f[0x1],'priorityFalse':_0x11de7f[0x2]};var _0x1fb615=gotoif[_0x90ae('0x0')](_0x421921,{'typecast':!![]});if(_0x1fb615['length']){logger[_0x90ae('0xd')]('[%s][GOTOIF]\x20%s',_0x37a220,_[_0x90ae('0xe')](_0x1fb615,_0x90ae('0xf'))[_0x90ae('0x10')](',\x20'));_0x53b35b[_0x90ae('0x11')]();}else{try{var _0x5ac6f2=eval('('+_0x421921[_0x90ae('0x12')]+')');var _0x2be7a4=_0x5ac6f2?_0x421921[_0x90ae('0x13')]:_0x421921[_0x90ae('0x14')];logger[_0x90ae('0x15')](_0x90ae('0x16'),_0x37a220,_0x421921[_0x90ae('0x12')],_0x5ac6f2,_0x2be7a4||_0x90ae('0x17'));if(_0x2be7a4){var _0x403afa=_[_0x90ae('0x18')](_0x53b35b[_0x90ae('0x19')](),{'p':_0x2be7a4});if(_0x403afa>=0x0){logger[_0x90ae('0x15')](_0x90ae('0x1a'),_0x37a220,_0x2be7a4||'next',_0x403afa);_0x53b35b['next'](_0x403afa);}else{logger[_0x90ae('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x37a220,_0x2be7a4||_0x90ae('0x17'));_0x53b35b[_0x90ae('0x11')]();}}else{_0x53b35b[_0x90ae('0x17')]();}}catch(_0x4ba9de){logger[_0x90ae('0xd')](_0x90ae('0x1b'),_0x37a220,_0x4ba9de[_0x90ae('0xf')]);_0x53b35b[_0x90ae('0x11')]();}}}catch(_0x21382e){logger[_0x90ae('0xd')](_0x90ae('0x1c'),_0x37a220,JSON[_0x90ae('0x1d')](_0x21382e));_0x53b35b[_0x90ae('0x11')]();}};}; \ 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 6684eed..7f3293b 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 _0x1881=['message','join','stop','info','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','error','[%s][GOTOP]\x20%s','map'];(function(_0x583473,_0x4dfa56){var _0x5bb789=function(_0x3b365b){while(--_0x3b365b){_0x583473['push'](_0x583473['shift']());}};_0x5bb789(++_0x4dfa56);}(_0x1881,0x190));var _0x1188=function(_0x5b1097,_0x3ed62f){_0x5b1097=_0x5b1097-0x0;var _0x57979c=_0x1881[_0x5b1097];return _0x57979c;};'use strict';var schema=require('validate');var _=require(_0x1188('0x0'));var logger=require(_0x1188('0x1'))(_0x1188('0x2'));var gotop=schema({'priority':{'type':_0x1188('0x3'),'required':!![],'message':_0x1188('0x4')}});exports['consequence']=function(_0x5aa83b,_0x5c13d6){return function(_0x517ced){try{var _0x5f8767={'priority':_0x5c13d6[0x0]};var _0x5e2081=gotop['validate'](_0x5f8767,{'typecast':!![]});if(_0x5e2081['length']){logger[_0x1188('0x5')](_0x1188('0x6'),_0x5aa83b,_[_0x1188('0x7')](_0x5e2081,_0x1188('0x8'))[_0x1188('0x9')](',\x20'));_0x517ced[_0x1188('0xa')]();}else{logger[_0x1188('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x5aa83b,_0x5f8767[_0x1188('0xc')]);if(_0x5f8767['priority']){var _0x2034b6=_['findIndex'](_0x517ced[_0x1188('0xd')](),{'p':_0x5f8767[_0x1188('0xc')]});if(_0x2034b6>=0x0){logger[_0x1188('0xb')](_0x1188('0xe'),_0x5aa83b,_0x5f8767[_0x1188('0xc')]||_0x1188('0xf'),_0x2034b6);_0x517ced[_0x1188('0xf')](_0x2034b6);}else{logger[_0x1188('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x5aa83b,_0x5f8767[_0x1188('0xc')]||'next');_0x517ced[_0x1188('0xa')]();}}else{_0x517ced[_0x1188('0xf')]();}}}catch(_0x172dfb){logger[_0x1188('0x5')](_0x1188('0x6'),_0x5aa83b,JSON[_0x1188('0x10')](_0x172dfb));_0x517ced['stop']();}};}; \ No newline at end of file +var _0xe567=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','message','join','stop','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x1a8447,_0x36530a){var _0x395a51=function(_0x4c2d74){while(--_0x4c2d74){_0x1a8447['push'](_0x1a8447['shift']());}};_0x395a51(++_0x36530a);}(_0xe567,0xc0));var _0x7e56=function(_0x3f3f85,_0x4e39c6){_0x3f3f85=_0x3f3f85-0x0;var _0x5db842=_0xe567[_0x3f3f85];return _0x5db842;};'use strict';var schema=require(_0x7e56('0x0'));var _=require(_0x7e56('0x1'));var logger=require(_0x7e56('0x2'))(_0x7e56('0x3'));var gotop=schema({'priority':{'type':_0x7e56('0x4'),'required':!![],'message':_0x7e56('0x5')}});exports[_0x7e56('0x6')]=function(_0x5ae895,_0x45960d){return function(_0x21106d){try{var _0x723242={'priority':_0x45960d[0x0]};var _0x4fddf3=gotop[_0x7e56('0x0')](_0x723242,{'typecast':!![]});if(_0x4fddf3[_0x7e56('0x7')]){logger[_0x7e56('0x8')](_0x7e56('0x9'),_0x5ae895,_['map'](_0x4fddf3,_0x7e56('0xa'))[_0x7e56('0xb')](',\x20'));_0x21106d[_0x7e56('0xc')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x5ae895,_0x723242[_0x7e56('0xd')]);if(_0x723242[_0x7e56('0xd')]){var _0xbc60fd=_[_0x7e56('0xe')](_0x21106d[_0x7e56('0xf')](),{'p':_0x723242['priority']});if(_0xbc60fd>=0x0){logger[_0x7e56('0x10')](_0x7e56('0x11'),_0x5ae895,_0x723242[_0x7e56('0xd')]||'next',_0xbc60fd);_0x21106d[_0x7e56('0x12')](_0xbc60fd);}else{logger[_0x7e56('0x10')](_0x7e56('0x13'),_0x5ae895,_0x723242[_0x7e56('0xd')]||_0x7e56('0x12'));_0x21106d[_0x7e56('0xc')]();}}else{_0x21106d[_0x7e56('0x12')]();}}}catch(_0x2eea7c){logger['error']('[%s][GOTOP]\x20%s',_0x5ae895,JSON[_0x7e56('0x14')](_0x2eea7c));_0x21106d['stop']();}};}; \ 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 5ac89ec..c2772ca 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 _0x0c4b=['../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','account','AccountId','upperFirst','InteractionId','Message','create','then','info','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','../../../../config/logger','routing'];(function(_0x2ba988,_0x205b21){var _0x414e3b=function(_0x1fe77f){while(--_0x1fe77f){_0x2ba988['push'](_0x2ba988['shift']());}};_0x414e3b(++_0x205b21);}(_0x0c4b,0x11d));var _0xb0c4=function(_0x25e221,_0x3c16c7){_0x25e221=_0x25e221-0x0;var _0x84fb0a=_0x0c4b[_0x25e221];return _0x84fb0a;};'use strict';var _=require(_0xb0c4('0x0'));var utils=require('./utils');var logger=require(_0xb0c4('0x1'))(_0xb0c4('0x2'));var rpc={'chatMessage':require(_0xb0c4('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb0c4('0x4')),'faxMessage':require(_0xb0c4('0x5')),'whatsappMessage':require(_0xb0c4('0x6'))};exports[_0xb0c4('0x7')]=function(_0x1ba706,_0x280f0a){return function(_0x1cd55f){try{var _0x50f97d={'body':utils['getMustacheRender'](_0x280f0a[0x0],this),'ContactId':this[_0xb0c4('0x8')]['id']};if(this[_0xb0c4('0x9')]===_0xb0c4('0xa')){_0x50f97d['ChatWebsiteId']=this[_0xb0c4('0xb')]['id'];}else{_0x50f97d[_['upperFirst'](this['channel'])+_0xb0c4('0xc')]=this[_0xb0c4('0xb')]['id'];}_0x50f97d[_[_0xb0c4('0xd')](this[_0xb0c4('0x9')])+_0xb0c4('0xe')]=this['interaction']['id'];if(rpc[this['channel']+_0xb0c4('0xf')]){return rpc[this[_0xb0c4('0x9')]+_0xb0c4('0xf')][_0xb0c4('0x10')](_0x50f97d)[_0xb0c4('0x11')](function(_0x4bb425){logger[_0xb0c4('0x12')]('[%s][MESSAGE]\x20%s',_0x1ba706,_0x50f97d['body']);_0x1cd55f['next']();})[_0xb0c4('0x13')](function(_0xd47180){logger[_0xb0c4('0x14')](_0xb0c4('0x15'),_0x1ba706,JSON[_0xb0c4('0x16')](_0xd47180));_0x1cd55f[_0xb0c4('0x17')]();});}}catch(_0x4e3185){logger[_0xb0c4('0x14')](_0xb0c4('0x15'),_0x1ba706,JSON[_0xb0c4('0x16')](_0x4e3185));_0x1cd55f[_0xb0c4('0x17')]();}};}; \ No newline at end of file +var _0x56f7=['then','info','[%s][MESSAGE]\x20%s','body','catch','stringify','stop','error','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','consequence','getMustacheRender','contact','channel','chat','account','AccountId','interaction','Message','create'];(function(_0x340756,_0xad31ae){var _0x2ef745=function(_0x59ffde){while(--_0x59ffde){_0x340756['push'](_0x340756['shift']());}};_0x2ef745(++_0xad31ae);}(_0x56f7,0x1aa));var _0x756f=function(_0x309879,_0x29f94a){_0x309879=_0x309879-0x0;var _0x480e63=_0x56f7[_0x309879];return _0x480e63;};'use strict';var _=require('lodash');var utils=require(_0x756f('0x0'));var logger=require(_0x756f('0x1'))('routing');var rpc={'chatMessage':require(_0x756f('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x756f('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x756f('0x4')]=function(_0x5c5afa,_0x2804dc){return function(_0x1486b8){try{var _0x4bafd7={'body':utils[_0x756f('0x5')](_0x2804dc[0x0],this),'ContactId':this[_0x756f('0x6')]['id']};if(this[_0x756f('0x7')]===_0x756f('0x8')){_0x4bafd7['ChatWebsiteId']=this[_0x756f('0x9')]['id'];}else{_0x4bafd7[_['upperFirst'](this[_0x756f('0x7')])+_0x756f('0xa')]=this[_0x756f('0x9')]['id'];}_0x4bafd7[_['upperFirst'](this['channel'])+'InteractionId']=this[_0x756f('0xb')]['id'];if(rpc[this[_0x756f('0x7')]+'Message']){return rpc[this[_0x756f('0x7')]+_0x756f('0xc')][_0x756f('0xd')](_0x4bafd7)[_0x756f('0xe')](function(_0x515ee2){logger[_0x756f('0xf')](_0x756f('0x10'),_0x5c5afa,_0x4bafd7[_0x756f('0x11')]);_0x1486b8['next']();})[_0x756f('0x12')](function(_0x21811a){logger['error'](_0x756f('0x10'),_0x5c5afa,JSON[_0x756f('0x13')](_0x21811a));_0x1486b8[_0x756f('0x14')]();});}}catch(_0x3c6b6e){logger[_0x756f('0x15')](_0x756f('0x10'),_0x5c5afa,JSON[_0x756f('0x13')](_0x3c6b6e));_0x1486b8[_0x756f('0x14')]();}};}; \ 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 4ec361d..72f7d93 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 _0xf85c=['stringify','./utils','../../../../config/logger','info','[%s][NOOP]\x20%s','getMustacheRender','error'];(function(_0x10ed54,_0x2f5328){var _0x5ca84e=function(_0x153d26){while(--_0x153d26){_0x10ed54['push'](_0x10ed54['shift']());}};_0x5ca84e(++_0x2f5328);}(_0xf85c,0x1d6));var _0xcf85=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0xf85c[_0x4ae829];return _0x256b31;};'use strict';var utils=require(_0xcf85('0x0'));var logger=require(_0xcf85('0x1'))('routing');exports['consequence']=function(_0x3ffcaf,_0x4c427a){return function(_0x434f7b){try{logger[_0xcf85('0x2')](_0xcf85('0x3'),_0x3ffcaf,utils[_0xcf85('0x4')](_0x4c427a[0x0],this));_0x434f7b['next']();}catch(_0x265413){logger[_0xcf85('0x5')](_0xcf85('0x3'),_0x3ffcaf,JSON[_0xcf85('0x6')](_0x265413));_0x434f7b['stop']();}};}; \ No newline at end of file +var _0xfd42=['error','stringify','stop','./utils','routing','consequence','info','[%s][NOOP]\x20%s','next'];(function(_0x5cddcd,_0x2f8e4a){var _0x3ab9ba=function(_0x2e3821){while(--_0x2e3821){_0x5cddcd['push'](_0x5cddcd['shift']());}};_0x3ab9ba(++_0x2f8e4a);}(_0xfd42,0x162));var _0x2fd4=function(_0x542b0b,_0x5bfce8){_0x542b0b=_0x542b0b-0x0;var _0x6aed5e=_0xfd42[_0x542b0b];return _0x6aed5e;};'use strict';var utils=require(_0x2fd4('0x0'));var logger=require('../../../../config/logger')(_0x2fd4('0x1'));exports[_0x2fd4('0x2')]=function(_0x2f9638,_0x208103){return function(_0x5bd2cf){try{logger[_0x2fd4('0x3')](_0x2fd4('0x4'),_0x2f9638,utils['getMustacheRender'](_0x208103[0x0],this));_0x5bd2cf[_0x2fd4('0x5')]();}catch(_0xa48522){logger[_0x2fd4('0x6')](_0x2fd4('0x4'),_0x2f9638,JSON[_0x2fd4('0x7')](_0xa48522));_0x5bd2cf[_0x2fd4('0x8')]();}};}; \ 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 9c592ec..f7fe2da 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 _0x008c=['contact','list','upperFirst','QueueId','InteractionId','interaction','message','channel','info','[%s][START:QUEUE][NAME:%s]','name','account','QueueReport','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','body','update','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','timeout','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','rrmemory','beepall','log','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','clone','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x255d0a,_0x558802){var _0x502aed=function(_0x16993f){while(--_0x16993f){_0x255d0a['push'](_0x255d0a['shift']());}};_0x502aed(++_0x558802);}(_0x008c,0x188));var _0xc008=function(_0x3cfdfc,_0x1171e5){_0x3cfdfc=_0x3cfdfc-0x0;var _0x2863db=_0x008c[_0x3cfdfc];return _0x2863db;};'use strict';var schema=require(_0xc008('0x0'));var _=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var seqqueue=require(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var Redis=require('ioredis');var config=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var strategy=require(_0xc008('0x8'));config[_0xc008('0x9')]=_[_0xc008('0xa')](config[_0xc008('0x9')],{'host':_0xc008('0xb'),'port':0x18eb});var io=require(_0xc008('0xc'))(new Redis(config['redis']));var attributes=['id',_0xc008('0xd'),'account',_0xc008('0xe'),'from','joinAt'];function emit(_0x27830d,_0x7231b4,_0x57c46d){io['to'](_0x27830d)['emit'](_0x7231b4,_0x57c46d);}function emitChannelQueueInteraction(_0x543eb8,_0x1eacfa,_0xc881aa,_0x5b2004,_0xae2dab,_0x332fd4,_0x2ea200,_0x2a5b4e){var _0x9ffa93=_[_0xc008('0xf')](_0xc881aa);_0x9ffa93[_0xc008('0xd')]=_0x2a5b4e;_0x9ffa93['queue']=_0x1eacfa;_0x9ffa93['account']=_0x5b2004;_0x9ffa93['id']=_0xae2dab;if(_0x332fd4){_0x2ea200[util[_0xc008('0x10')]('%sQueuesWaitingInteractions',_0x543eb8)][_0xae2dab]=_[_0xc008('0x11')](_0x9ffa93,attributes);}else{delete _0x2ea200[util[_0xc008('0x10')](_0xc008('0x12'),_0x543eb8)][_0xae2dab];}emit(util[_0xc008('0x10')](_0xc008('0x13'),_0x543eb8,_0x1eacfa),util['format']('%s_queue_waiting_interaction:%s',_0x543eb8,_0x332fd4?'save':_0xc008('0x14')),_[_0xc008('0x11')](_0x9ffa93,attributes));}var rpc={'openchannelQueueReport':require(_0xc008('0x15')),'mailQueueReport':require(_0xc008('0x16')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xc008('0x17'),'required':!![],'message':_0xc008('0x18')},'timeout':{'type':'number','message':_0xc008('0x19')}});function startRouting(_0x5906e6,_0x4bd611,_0x543e5d,_0x50261c){if(_0x5906e6&&_0x4bd611&&_0x543e5d){_0x4bd611[_0xc008('0x1a')]+=0x1;var _0x4b9726={'uniqueid':_0x5906e6,'from':_0x543e5d['body']?_0x543e5d['body']['from']:'','joinAt':moment()['format'](_0xc008('0x1b')),'ContactId':_0x543e5d[_0xc008('0x1c')]?_0x543e5d[_0xc008('0x1c')]['id']:null,'ListId':_0x543e5d[_0xc008('0x1d')]?_0x543e5d[_0xc008('0x1d')]['id']:null};_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+_0xc008('0x1f')]=_0x4bd611['id']||null;_0x4b9726[_['upperFirst'](_0x543e5d['channel'])+_0xc008('0x20')]=_0x543e5d[_0xc008('0x21')]?_0x543e5d[_0xc008('0x21')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+'MessageId']=_0x543e5d['message']?_0x543e5d[_0xc008('0x22')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d[_0xc008('0x23')])+(_0x543e5d[_0xc008('0x23')]!=='chat'?'AccountId':'WebsiteId')]=_0x543e5d['account']?_0x543e5d['account']['id']:null;logger[_0xc008('0x24')](util[_0xc008('0x10')](_0xc008('0x25'),_0x5906e6,_0x4bd611['name']));emitChannelQueueInteraction(_0x543e5d[_0xc008('0x23')],_0x4bd611[_0xc008('0x26')],_0x4b9726,_0x543e5d[_0xc008('0x27')][_0xc008('0x26')],_0x543e5d['message']['id'],!![],_0x50261c,_0x4bd611['id']);if(rpc[_0x543e5d[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x543e5d['channel']+'QueueReport']['create'](_0x4b9726)[_0xc008('0x29')](function(_0x267abd){logger[_0xc008('0x2a')](_0xc008('0x2b'));});}}}function stopRouting(_0x1de04b,_0xceebc3,_0x294f97,_0x22d8e8){if(_0x1de04b&&_0xceebc3){_0xceebc3[_0xc008('0x1a')]-=0x1;var _0x2b862d={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'acceptAt':moment()['format'](_0xc008('0x1b')),'reason':_0xc008('0x2c')};logger['info'](util[_0xc008('0x10')](_0xc008('0x2d'),_0x1de04b,_0xceebc3[_0xc008('0x26')]));emitChannelQueueInteraction(_0x294f97[_0xc008('0x23')],_0xceebc3[_0xc008('0x26')],_0x294f97[_0xc008('0x2e')],_0x294f97[_0xc008('0x27')][_0xc008('0x26')],_0x294f97[_0xc008('0x22')]['id'],![],_0x22d8e8,_0xceebc3['id']);if(rpc[_0x294f97['channel']+_0xc008('0x28')]){return rpc[_0x294f97[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x1de04b,_0x2b862d)[_0xc008('0x29')](function(_0x315562){logger[_0xc008('0x2a')]('update\x20queue\x20report');});}}}function endRouting(_0x35f360,_0x21763f,_0x50e1d4,_0x399b64){if(_0x35f360&&_0x21763f){_0x21763f[_0xc008('0x1a')]-=0x1;var _0x5e38d5={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'exitAt':moment()[_0xc008('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger['info'](util[_0xc008('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x35f360,_0x21763f[_0xc008('0x26')]));emitChannelQueueInteraction(_0x50e1d4[_0xc008('0x23')],_0x21763f[_0xc008('0x26')],_0x50e1d4[_0xc008('0x2e')],_0x50e1d4[_0xc008('0x27')][_0xc008('0x26')],_0x50e1d4[_0xc008('0x22')]['id'],![],_0x399b64);if(rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x35f360,_0x5e38d5)[_0xc008('0x29')](function(_0x2bf3fd){logger['error'](_0xc008('0x30'));});}}}function handleFindQueue(_0x23c4db){return function(_0x30b7df){return _0x30b7df[_0xc008('0x26')]['toLowerCase']()===_0x23c4db[_0xc008('0x31')]();};}exports[_0xc008('0x32')]=function(_0xc8cb91,_0x36e7ae,_0x2d142d,_0x5706bb){return function(_0x398cdd){try{var _0x3323f4={'name':_0x36e7ae[0x0],'timeout':_0x36e7ae[0x1]};var _0x3794b0=queue[_0xc008('0x0')](_0x3323f4,{'typecast':!![]});if(_0x3794b0[_0xc008('0x33')]){logger['error'](_0xc008('0x34'),_0xc8cb91,_[_0xc008('0x35')](_0x3794b0,_0xc008('0x22'))[_0xc008('0x36')](',\x20'));_0x398cdd['stop']();}else{var _0x26cd05=_[_0xc008('0x37')](_0x2d142d[_0x5706bb[_0xc008('0x23')]+'Queues'],handleFindQueue(_0x3323f4[_0xc008('0x26')]));if(_0x26cd05){startRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);var _0x49a176=(_0x26cd05[_0xc008('0x38')]||0xa)*0x3e8;var _0x5d3a72=(_0x3323f4[_0xc008('0x38')]||0x14)*0x3e8;var _0x213014,_0x5a5d85;if(_0x49a176>_0x5d3a72){_0x5d3a72=_0x49a176;}var _0x31007c=seqqueue[_0xc008('0x39')](_0x49a176);_0x31007c['id']=_0xc8cb91;_0x31007c[_0xc008('0x3a')]=_0x49a176;_0x31007c['qtimeout']=_0x5d3a72;_0x31007c[_0xc008('0x23')]=_0x5706bb[_0xc008('0x23')];_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3c'),function(){logger[_0xc008('0x24')](_0xc008('0x3d'),_0xc8cb91);stopRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x213014=undefined;_0x31007c['close'](!![]);if(_0x2d142d['rules'][_0xc8cb91]){delete _0x2d142d['rules'][_0xc8cb91];}_0x398cdd[_0xc008('0x3e')]();});_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3f'),function(){if(_0x2d142d[_0xc008('0x3b')][_0xc8cb91]){delete _0x2d142d[_0xc008('0x3b')][_0xc8cb91];}});_0x213014=setTimeout(function(){logger[_0xc008('0x24')](_0xc008('0x40'),_0xc8cb91);endRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x31007c[_0xc008('0x41')](!![]);_0x398cdd['next']();},_0x5d3a72);switch(_0x26cd05['strategy']){case'rrmemory':strategy[_0xc008('0x42')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);break;default:strategy[_0xc008('0x43')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);}}else{logger[_0xc008('0x2a')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xc8cb91,_0x3323f4[_0xc008('0x26')]);_0x398cdd[_0xc008('0x3e')]();}}}catch(_0x17ab1a){console[_0xc008('0x44')](_0x17ab1a);logger[_0xc008('0x2a')](_0xc008('0x34'),_0xc8cb91,_0x17ab1a[_0xc008('0x45')]);_0x398cdd[_0xc008('0x3e')]();}};}; \ No newline at end of file +var _0x9957=['seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','account','queue','joinAt','emit','clone','queue_id','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','create','catch','error','waiting','accepted','body','[%s][END:QUEUE][NAME:%s]','update','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','timeout','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util'];(function(_0x576bd8,_0x4cc9aa){var _0x1b4407=function(_0xd27242){while(--_0xd27242){_0x576bd8['push'](_0x576bd8['shift']());}};_0x1b4407(++_0x4cc9aa);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var seqqueue=require(_0x7995('0x3'));var moment=require('moment');var Redis=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var strategy=require('./strategy');config[_0x7995('0x8')]=_[_0x7995('0x9')](config[_0x7995('0x8')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x8')]));var attributes=['id','queue_id',_0x7995('0xc'),_0x7995('0xd'),'from',_0x7995('0xe')];function emit(_0x3116fb,_0x18c8a3,_0x35b5fe){io['to'](_0x3116fb)[_0x7995('0xf')](_0x18c8a3,_0x35b5fe);}function emitChannelQueueInteraction(_0x1e400a,_0x341672,_0x524f7b,_0x245143,_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e=_[_0x7995('0x10')](_0x524f7b);_0x19a27e[_0x7995('0x11')]=_0x2cb37a;_0x19a27e[_0x7995('0xd')]=_0x341672;_0x19a27e[_0x7995('0xc')]=_0x245143;_0x19a27e['id']=_0x41c652;if(_0x581f22){_0xb0c872[util['format']('%sQueuesWaitingInteractions',_0x1e400a)][_0x41c652]=_[_0x7995('0x12')](_0x19a27e,attributes);}else{delete _0xb0c872[util[_0x7995('0x13')](_0x7995('0x14'),_0x1e400a)][_0x41c652];}emit(util[_0x7995('0x13')](_0x7995('0x15'),_0x1e400a,_0x341672),util[_0x7995('0x13')](_0x7995('0x16'),_0x1e400a,_0x581f22?_0x7995('0x17'):'remove'),_[_0x7995('0x12')](_0x19a27e,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x7995('0x18')),'chatQueueReport':require(_0x7995('0x19')),'smsQueueReport':require(_0x7995('0x1a')),'faxQueueReport':require(_0x7995('0x1b')),'whatsappQueueReport':require(_0x7995('0x1c'))};var queue=schema({'name':{'type':_0x7995('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x7995('0x1e')}});function startRouting(_0x5e6f90,_0x555f74,_0x3ec178,_0x3d463e){if(_0x5e6f90&&_0x555f74&&_0x3ec178){_0x555f74['waiting']+=0x1;var _0x3a9b54={'uniqueid':_0x5e6f90,'from':_0x3ec178['body']?_0x3ec178['body'][_0x7995('0x1f')]:'','joinAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'ContactId':_0x3ec178[_0x7995('0x21')]?_0x3ec178[_0x7995('0x21')]['id']:null,'ListId':_0x3ec178[_0x7995('0x22')]?_0x3ec178['list']['id']:null};_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x25')]=_0x555f74['id']||null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x26')]=_0x3ec178[_0x7995('0x27')]?_0x3ec178[_0x7995('0x27')]['id']:null;_0x3a9b54[_['upperFirst'](_0x3ec178[_0x7995('0x24')])+_0x7995('0x28')]=_0x3ec178[_0x7995('0x29')]?_0x3ec178[_0x7995('0x29')]['id']:null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+(_0x3ec178['channel']!==_0x7995('0x2a')?'AccountId':_0x7995('0x2b'))]=_0x3ec178[_0x7995('0xc')]?_0x3ec178[_0x7995('0xc')]['id']:null;logger[_0x7995('0x2c')](util[_0x7995('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x5e6f90,_0x555f74[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x3ec178['channel'],_0x555f74[_0x7995('0x2d')],_0x3a9b54,_0x3ec178[_0x7995('0xc')][_0x7995('0x2d')],_0x3ec178['message']['id'],!![],_0x3d463e,_0x555f74['id']);if(rpc[_0x3ec178['channel']+'QueueReport']){return rpc[_0x3ec178[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x2f')](_0x3a9b54)[_0x7995('0x30')](function(_0x2e3493){logger[_0x7995('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x481c74,_0xfa8f15,_0x5524af,_0x553671){if(_0x481c74&&_0xfa8f15){_0xfa8f15[_0x7995('0x32')]-=0x1;var _0x29fac5={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'acceptAt':moment()['format'](_0x7995('0x20')),'reason':_0x7995('0x33')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x481c74,_0xfa8f15[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x5524af[_0x7995('0x24')],_0xfa8f15['name'],_0x5524af[_0x7995('0x34')],_0x5524af['account'][_0x7995('0x2d')],_0x5524af[_0x7995('0x29')]['id'],![],_0x553671,_0xfa8f15['id']);if(rpc[_0x5524af[_0x7995('0x24')]+'QueueReport']){return rpc[_0x5524af['channel']+_0x7995('0x2e')]['update'](_0x481c74,_0x29fac5)['catch'](function(_0x3e99cd){logger[_0x7995('0x31')]('update\x20queue\x20report');});}}}function endRouting(_0x1baa15,_0x1922b4,_0x2b772f,_0x18667c){if(_0x1baa15&&_0x1922b4){_0x1922b4[_0x7995('0x32')]-=0x1;var _0x53002a={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'exitAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'reason':'timeout'};logger[_0x7995('0x2c')](util[_0x7995('0x13')](_0x7995('0x35'),_0x1baa15,_0x1922b4[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x2b772f[_0x7995('0x24')],_0x1922b4[_0x7995('0x2d')],_0x2b772f['body'],_0x2b772f[_0x7995('0xc')][_0x7995('0x2d')],_0x2b772f[_0x7995('0x29')]['id'],![],_0x18667c);if(rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')]){return rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x36')](_0x1baa15,_0x53002a)[_0x7995('0x30')](function(_0x447981){logger[_0x7995('0x31')](_0x7995('0x37'));});}}}function handleFindQueue(_0x7b4e67){return function(_0x53cda2){return _0x53cda2['name'][_0x7995('0x38')]()===_0x7b4e67[_0x7995('0x38')]();};}exports['consequence']=function(_0x4b0855,_0x3f8522,_0x4a9fef,_0x504a33){return function(_0x23da6b){try{var _0x36e28b={'name':_0x3f8522[0x0],'timeout':_0x3f8522[0x1]};var _0x35c8ff=queue['validate'](_0x36e28b,{'typecast':!![]});if(_0x35c8ff[_0x7995('0x39')]){logger['error'](_0x7995('0x3a'),_0x4b0855,_['map'](_0x35c8ff,'message')[_0x7995('0x3b')](',\x20'));_0x23da6b[_0x7995('0x3c')]();}else{var _0xc04e5=_[_0x7995('0x3d')](_0x4a9fef[_0x504a33['channel']+_0x7995('0x3e')],handleFindQueue(_0x36e28b[_0x7995('0x2d')]));if(_0xc04e5){startRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);var _0x31b347=(_0xc04e5[_0x7995('0x3f')]||0xa)*0x3e8;var _0x4e09b7=(_0x36e28b['timeout']||0x14)*0x3e8;var _0x1c37c6,_0x55791b;if(_0x31b347>_0x4e09b7){_0x4e09b7=_0x31b347;}var _0x23c41d=seqqueue['createQueue'](_0x31b347);_0x23c41d['id']=_0x4b0855;_0x23c41d[_0x7995('0x40')]=_0x31b347;_0x23c41d['qtimeout']=_0x4e09b7;_0x23c41d[_0x7995('0x24')]=_0x504a33[_0x7995('0x24')];_0x4a9fef['rules'][_0x4b0855]['on'](_0x7995('0x41'),function(){logger[_0x7995('0x2c')](_0x7995('0x42'),_0x4b0855);stopRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x1c37c6=undefined;_0x23c41d[_0x7995('0x43')](!![]);if(_0x4a9fef['rules'][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}_0x23da6b[_0x7995('0x3c')]();});_0x4a9fef[_0x7995('0x44')][_0x4b0855]['on']('complete',function(){if(_0x4a9fef[_0x7995('0x44')][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}});_0x1c37c6=setTimeout(function(){logger[_0x7995('0x2c')](_0x7995('0x45'),_0x4b0855);endRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x23c41d[_0x7995('0x43')](!![]);_0x23da6b['next']();},_0x4e09b7);switch(_0xc04e5[_0x7995('0x46')]){case _0x7995('0x47'):strategy['rrmemory'](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);break;default:strategy[_0x7995('0x48')](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);}}else{logger['error'](_0x7995('0x49'),_0x4b0855,_0x36e28b[_0x7995('0x2d')]);_0x23da6b[_0x7995('0x3c')]();}}}catch(_0x30e220){console[_0x7995('0x4a')](_0x30e220);logger[_0x7995('0x31')](_0x7995('0x3a'),_0x4b0855,_0x30e220['stack']);_0x23da6b[_0x7995('0x3c')]();}};}; \ 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 c9706be..bc9a73f 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 _0x3228=['lodash','../../../../../config/logger','routing','notificationId','squeue','agent','handleRun','bind','handleTimeout','timeout','drained','handleDrained','push','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','STOP','TIMEOUT','exports'];(function(_0x26ffb0,_0x41f8ef){var _0x30de1e=function(_0x330e56){while(--_0x330e56){_0x26ffb0['push'](_0x26ffb0['shift']());}};_0x30de1e(++_0x41f8ef);}(_0x3228,0x181));var _0x8322=function(_0x2a7f5e,_0x19dc14){_0x2a7f5e=_0x2a7f5e-0x0;var _0x4696b2=_0x3228[_0x2a7f5e];return _0x4696b2;};'use strict';var _=require(_0x8322('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0x8322('0x1'))(_0x8322('0x2'));var Agent=function(_0x438853,_0x427136,_0x1bbf32,_0xd34918){this[_0x8322('0x3')]=uuid['v4']();this[_0x8322('0x4')]=_0x438853;this[_0x8322('0x5')]=_0x427136;this['realtime']=_0x1bbf32;this[_0x8322('0x2')]=_0xd34918;this[_0x8322('0x4')]['push'](this[_0x8322('0x6')][_0x8322('0x7')](this),this[_0x8322('0x8')][_0x8322('0x7')](this));this[_0x8322('0x4')]['on'](_0x8322('0x9'),this[_0x8322('0x8')][_0x8322('0x7')](this));this[_0x8322('0x4')]['on'](_0x8322('0xa'),this[_0x8322('0xb')]['bind'](this));};Agent['prototype'][_0x8322('0xc')]=function(){this[_0x8322('0x4')][_0x8322('0xc')](this[_0x8322('0x6')][_0x8322('0x7')](this),this[_0x8322('0x8')][_0x8322('0x7')](this));};Agent[_0x8322('0xd')][_0x8322('0xb')]=function(){this[_0x8322('0x8')](!![]);};Agent[_0x8322('0xd')][_0x8322('0x6')]=function(_0x11c3b1){logger[_0x8322('0xe')](_0x8322('0xf'),this[_0x8322('0x4')]['id'],this[_0x8322('0x5')]['id']);if(_[_0x8322('0x10')](this[_0x8322('0x11')]['agents'][this[_0x8322('0x5')]['id']])){logger['info'](_0x8322('0x12'),this[_0x8322('0x4')]['id'],this[_0x8322('0x5')]['id']);setTimeout(this[_0x8322('0xc')][_0x8322('0x7')](this),0x3e8);}else{if(this[_0x8322('0x2')][_0x8322('0x13')]||util[_0x8322('0x14')](this['squeue']['id'],this[_0x8322('0x11')][_0x8322('0x15')][this[_0x8322('0x5')]['id']],this[_0x8322('0x4')][_0x8322('0x16')],![])){this[_0x8322('0x11')][_0x8322('0x15')][this['agent']['id']]['busy']=!![];this['realtime'][_0x8322('0x15')][this[_0x8322('0x5')]['id']][_0x8322('0x17')]=undefined;util[_0x8322('0x18')](this[_0x8322('0x3')],this[_0x8322('0x4')]['id'],this[_0x8322('0x11')][_0x8322('0x15')][this[_0x8322('0x5')]['id']],null,this[_0x8322('0x2')]);util[_0x8322('0x19')](this[_0x8322('0x4')]['id'],this[_0x8322('0x11')][_0x8322('0x15')][this['agent']['id']],_0x8322('0x1a')+(this[_0x8322('0x2')][_0x8322('0x13')]?_0x8322('0x1b'):''));}else{logger[_0x8322('0xe')](_0x8322('0x1c'),this[_0x8322('0x4')]['id'],this[_0x8322('0x5')]['id']);setTimeout(this[_0x8322('0xc')][_0x8322('0x7')](this),0x3e8);}}};Agent[_0x8322('0xd')]['handleTimeout']=function(_0x4e93b2){if(_[_0x8322('0x10')](this['realtime'][_0x8322('0x15')][this['agent']['id']])){return logger[_0x8322('0xe')](_0x8322('0x12'),this['squeue']['id'],this[_0x8322('0x5')]['id']);}else{logger[_0x8322('0xe')](_0x8322('0x1d'),this[_0x8322('0x4')]['id'],this[_0x8322('0x5')]['id']);util[_0x8322('0x1e')](this[_0x8322('0x3')],this[_0x8322('0x4')]['id'],this[_0x8322('0x11')][_0x8322('0x15')][this[_0x8322('0x5')]['id']],null,this[_0x8322('0x2')]);this[_0x8322('0x11')][_0x8322('0x15')][this[_0x8322('0x5')]['id']][_0x8322('0x1f')]=![];this['realtime'][_0x8322('0x15')][this['agent']['id']][_0x8322('0x17')]=undefined;util[_0x8322('0x19')](this['squeue']['id'],this[_0x8322('0x11')][_0x8322('0x15')][this[_0x8322('0x5')]['id']],_0x4e93b2?_0x8322('0x20'):_0x8322('0x21'));}if(!_0x4e93b2){setTimeout(this['push'][_0x8322('0x7')](this),0x3e8);}};function agent(_0x20914b,_0x3b85b0,_0x4459e7,_0x36b687){return new Agent(_0x20914b,_0x3b85b0,_0x4459e7,_0x36b687);}module[_0x8322('0x22')]=agent; \ No newline at end of file +var _0xc112=['handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','busyQueue','showNotification','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','squeue','agent','realtime','push'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc112,0xec));var _0x2c11=function(_0x2eb71c,_0x5a4b4d){_0x2eb71c=_0x2eb71c-0x0;var _0x41338c=_0xc112[_0x2eb71c];return _0x41338c;};'use strict';var _=require(_0x2c11('0x0'));var uuid=require(_0x2c11('0x1'));var util=require(_0x2c11('0x2'));var logger=require('../../../../../config/logger')(_0x2c11('0x3'));var Agent=function(_0x40da2e,_0x26e2a3,_0x170832,_0xaa8492){this[_0x2c11('0x4')]=uuid['v4']();this[_0x2c11('0x5')]=_0x40da2e;this[_0x2c11('0x6')]=_0x26e2a3;this[_0x2c11('0x7')]=_0x170832;this['routing']=_0xaa8492;this['squeue'][_0x2c11('0x8')](this[_0x2c11('0x9')][_0x2c11('0xa')](this),this[_0x2c11('0xb')]['bind'](this));this[_0x2c11('0x5')]['on'](_0x2c11('0xc'),this['handleTimeout'][_0x2c11('0xa')](this));this[_0x2c11('0x5')]['on'](_0x2c11('0xd'),this[_0x2c11('0xe')][_0x2c11('0xa')](this));};Agent['prototype'][_0x2c11('0x8')]=function(){this[_0x2c11('0x5')][_0x2c11('0x8')](this[_0x2c11('0x9')][_0x2c11('0xa')](this),this[_0x2c11('0xb')][_0x2c11('0xa')](this));};Agent['prototype'][_0x2c11('0xe')]=function(){this[_0x2c11('0xb')](!![]);};Agent[_0x2c11('0xf')][_0x2c11('0x9')]=function(_0x11e3ac){logger[_0x2c11('0x10')](_0x2c11('0x11'),this[_0x2c11('0x5')]['id'],this[_0x2c11('0x6')]['id']);if(_[_0x2c11('0x12')](this[_0x2c11('0x7')]['agents'][this[_0x2c11('0x6')]['id']])){logger[_0x2c11('0x10')](_0x2c11('0x13'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x2c11('0x8')][_0x2c11('0xa')](this),0x3e8);}else{if(this[_0x2c11('0x3')]['forcedOwnership']||util[_0x2c11('0x14')](this['squeue']['id'],this[_0x2c11('0x7')][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']],this[_0x2c11('0x5')][_0x2c11('0x16')],![])){this[_0x2c11('0x7')]['agents'][this['agent']['id']]['busy']=!![];this[_0x2c11('0x7')][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']][_0x2c11('0x17')]=undefined;util[_0x2c11('0x18')](this[_0x2c11('0x4')],this['squeue']['id'],this[_0x2c11('0x7')][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']],null,this[_0x2c11('0x3')]);util[_0x2c11('0x19')](this[_0x2c11('0x5')]['id'],this[_0x2c11('0x7')][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']],_0x2c11('0x1a')+(this['routing'][_0x2c11('0x1b')]?_0x2c11('0x1c'):''));}else{logger[_0x2c11('0x10')](_0x2c11('0x1d'),this[_0x2c11('0x5')]['id'],this[_0x2c11('0x6')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x2c11('0xf')][_0x2c11('0xb')]=function(_0x21d905){if(_[_0x2c11('0x12')](this[_0x2c11('0x7')][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']])){return logger['info'](_0x2c11('0x13'),this[_0x2c11('0x5')]['id'],this[_0x2c11('0x6')]['id']);}else{logger[_0x2c11('0x10')](_0x2c11('0x1e'),this['squeue']['id'],this['agent']['id']);util[_0x2c11('0x1f')](this[_0x2c11('0x4')],this[_0x2c11('0x5')]['id'],this['realtime']['agents'][this['agent']['id']],null,this[_0x2c11('0x3')]);this[_0x2c11('0x7')][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']][_0x2c11('0x20')]=![];this['realtime'][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']]['busyQueue']=undefined;util[_0x2c11('0x19')](this[_0x2c11('0x5')]['id'],this[_0x2c11('0x7')][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']],_0x21d905?'STOP':_0x2c11('0x21'));}if(!_0x21d905){setTimeout(this[_0x2c11('0x8')][_0x2c11('0xa')](this),0x3e8);}};function agent(_0xeba389,_0x415309,_0x471741,_0x3998aa){return new Agent(_0xeba389,_0x415309,_0x471741,_0x3998aa);}module[_0x2c11('0x22')]=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 470f3a9..54273ee 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 _0x11f4=['busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','notificationId','STOP','exports','lodash','uuid','../../../../../config/logger','queue','realtime','routing','push','bind','timeout','handleDrained','prototype','squeue','handleRun','handleTimeout','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','busy'];(function(_0x3a3d68,_0x4208f7){var _0x304693=function(_0x37e0b7){while(--_0x37e0b7){_0x3a3d68['push'](_0x3a3d68['shift']());}};_0x304693(++_0x4208f7);}(_0x11f4,0xae));var _0x411f=function(_0x120bc2,_0x57a253){_0x120bc2=_0x120bc2-0x0;var _0x454a41=_0x11f4[_0x120bc2];return _0x454a41;};'use strict';var _=require(_0x411f('0x0'));var uuid=require(_0x411f('0x1'));var util=require('./util');var logger=require(_0x411f('0x2'))('routing');var Beepall=function(_0x32ebd9,_0x23c4a7,_0x1865c7,_0x1950ab){this['notificationId']=uuid['v4']();this['squeue']=_0x32ebd9;this[_0x411f('0x3')]=_0x23c4a7;this[_0x411f('0x4')]=_0x1865c7;this[_0x411f('0x5')]=_0x1950ab;this['squeue'][_0x411f('0x6')](this['handleRun'][_0x411f('0x7')](this),this['handleTimeout']['bind'](this));this['squeue']['on'](_0x411f('0x8'),this['handleTimeout']['bind'](this));this['squeue']['on']('drained',this[_0x411f('0x9')][_0x411f('0x7')](this));};Beepall[_0x411f('0xa')]['push']=function(){this[_0x411f('0xb')]['push'](this[_0x411f('0xc')][_0x411f('0x7')](this),this[_0x411f('0xd')][_0x411f('0x7')](this));};Beepall[_0x411f('0xa')][_0x411f('0x9')]=function(_0x55b63b){this['handleTimeout'](!![]);};Beepall[_0x411f('0xa')]['handleRun']=function(_0x55a871){var _0x239624=!![];if(!_[_0x411f('0xe')](this[_0x411f('0x3')])&&!_[_0x411f('0xe')](this[_0x411f('0x3')][_0x411f('0xf')])&&this[_0x411f('0x3')][_0x411f('0xf')][_0x411f('0x10')]>0x0){for(var _0x19c7fa=0x0,_0x5daf39;_0x19c7fa0x0){for(var _0x50196c=0x0,_0x443c72;_0x50196c0x0&&_0x274f4e[_0x565b2a+_0xbb37('0x25')]>=_0x274f4e[_0x565b2a+_0xbb37('0x26')]){writeLog(_0x20f4de,_0x274f4e,_0x565b2a[_0xbb37('0x27')]()+_0xbb37('0x28'));return![];}}return!![];};exports[_0xbb37('0x29')]=function(_0x4770ba,_0x11f25e,_0x4e750e,_0x44d173,_0x26ecd0){return sendNotification(!![],_0x4770ba,_0x11f25e,_0x4e750e,_0x44d173,_0x26ecd0);};exports['hideNotification']=function(_0x4d3b68,_0x2959eb,_0x5af88e,_0xa16056,_0x37a54f){return sendNotification(![],_0x4d3b68,_0x2959eb,_0x5af88e,_0xa16056,_0x37a54f);};exports[_0xbb37('0x2a')]=writeLog; \ No newline at end of file +var _0xceb0=['user:save','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','info','busy','Pause','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','ioredis','../../../../../config/logger','routing','redis','localhost','socket.io-emitter','user:%s','name','emit'];(function(_0x290b25,_0xbf7c44){var _0x36311c=function(_0x496a13){while(--_0x496a13){_0x290b25['push'](_0x290b25['shift']());}};_0x36311c(++_0xbf7c44);}(_0xceb0,0x173));var _0x0ceb=function(_0x32813a,_0x12acdd){_0x32813a=_0x32813a-0x0;var _0xde0c8f=_0xceb0[_0x32813a];return _0xde0c8f;};'use strict';var _=require('lodash');var util=require('util');var utils=require('../utils');var Mustache=require('mustache');var Redis=require(_0x0ceb('0x0'));var config=require('../../../../../config/environment');var logger=require(_0x0ceb('0x1'))(_0x0ceb('0x2'));config[_0x0ceb('0x3')]=_['defaults'](config['redis'],{'host':_0x0ceb('0x4'),'port':0x18eb});var io=require(_0x0ceb('0x5'))(new Redis(config[_0x0ceb('0x3')]));function emit(_0x52e6bb,_0x448bf8,_0x19e438){io['to'](_0x52e6bb)['emit'](_0x448bf8,_0x19e438);}function sendNotification(_0x9e53b7,_0x579edd,_0x3a1205,_0x3e71f4,_0x376790,_0x5cf8a1){io['to'](util['format'](_0x0ceb('0x6'),_0x3e71f4[_0x0ceb('0x7')]))[_0x0ceb('0x8')](_0x0ceb('0x9'),_0x3e71f4);var _0xe82279=_0x5cf8a1||{};var _0x3b1d4e=_0x3a1205['split']('.');var _0x11ebb2={'uniqueid':_0x579edd,'channel':_0x3b1d4e[0x0],'id':_0x3b1d4e[0x1],'title':_0x3b1d4e[0x0]+_0x0ceb('0xa'),'interactionId':_0x3b1d4e[0x2],'queue':_0x376790?_0x376790[_0x0ceb('0x7')]:null,'sound':_0xe82279[_0x0ceb('0xb')][_0x0ceb('0xc')],'shake':_0xe82279[_0x0ceb('0xb')][_0x0ceb('0xd')]};try{if(!_0xe82279['body']){_0xe82279[_0x0ceb('0xe')]={};}if(_0x376790){_0xe82279['body']['queue']=_0x376790;}else if(_0xe82279[_0x0ceb('0xe')][_0x0ceb('0xf')]){delete _0xe82279[_0x0ceb('0xe')]['queue'];}_0x11ebb2[_0x0ceb('0x10')]=utils[_0x0ceb('0x11')](_0xe82279['account'][_0x0ceb('0x12')],_0xe82279);}catch(_0x221377){_0x11ebb2[_0x0ceb('0x10')]=_0x0ceb('0x13');logger[_0x0ceb('0x14')](util[_0x0ceb('0x15')](_0x0ceb('0x16'),_0x579edd,_0x221377[_0x0ceb('0x17')]));}io['to'](util[_0x0ceb('0x15')](_0x0ceb('0x6'),_0x3e71f4[_0x0ceb('0x7')]))[_0x0ceb('0x8')](util[_0x0ceb('0x15')](_0x0ceb('0x18'),_0x9e53b7?_0x0ceb('0x19'):_0x0ceb('0x1a')),_0x11ebb2);}function writeLog(_0x241c07,_0x5e13ad,_0x4eb712){return logger[_0x0ceb('0x1b')](util[_0x0ceb('0x15')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x241c07,_0x5e13ad[_0x0ceb('0x7')],_0x4eb712));}exports['isAgentAvailable']=function(_0x38a716,_0xc2b85c,_0x28fb61,_0x17efd7){if(_0xc2b85c[_0x0ceb('0x1c')]){writeLog(_0x38a716,_0xc2b85c,'BUSY');return![];}if(!_0xc2b85c['online']){writeLog(_0x38a716,_0xc2b85c,'OFFLINE');return![];}if(_0xc2b85c[_0x28fb61+_0x0ceb('0x1d')]){writeLog(_0x38a716,_0xc2b85c,'PAUSE');return![];}if(_0x17efd7&&_0xc2b85c[_0x0ceb('0x1e')](_0x28fb61+'Capacity')&&_0xc2b85c[_0x0ceb('0x1e')](_0x28fb61+_0x0ceb('0x1f'))){if(_0xc2b85c[_0x28fb61+_0x0ceb('0x20')]>0x0&&_0xc2b85c[_0x28fb61+_0x0ceb('0x1f')]>=_0xc2b85c[_0x28fb61+'Capacity']){writeLog(_0x38a716,_0xc2b85c,_0x28fb61[_0x0ceb('0x21')]()+_0x0ceb('0x22'));return![];}}return!![];};exports[_0x0ceb('0x23')]=function(_0x1451d3,_0x2432a8,_0x4aa831,_0x2de4f3,_0x3792bb){return sendNotification(!![],_0x1451d3,_0x2432a8,_0x4aa831,_0x2de4f3,_0x3792bb);};exports[_0x0ceb('0x24')]=function(_0x4427b8,_0x1ca4cb,_0x16265d,_0x58aa8b,_0x30adcb){return sendNotification(![],_0x4427b8,_0x1ca4cb,_0x16265d,_0x58aa8b,_0x30adcb);};exports[_0x0ceb('0x25')]=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 6eafd08..b08a6a7 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 _0xcb64=['stringify','validate','lodash','./utils','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','info','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject'];(function(_0x463edd,_0xd219b){var _0x68e148=function(_0x5453df){while(--_0x5453df){_0x463edd['push'](_0x463edd['shift']());}};_0x68e148(++_0xd219b);}(_0xcb64,0x1b9));var _0x4cb6=function(_0xf5d1ff,_0x1289bc){_0xf5d1ff=_0xf5d1ff-0x0;var _0x1b3e30=_0xcb64[_0xf5d1ff];return _0x1b3e30;};'use strict';var schema=require(_0x4cb6('0x0'));var sh=require('shelljs');var _=require(_0x4cb6('0x1'));var utils=require(_0x4cb6('0x2'));var logger=require('../../../../config/logger')(_0x4cb6('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0x4cb6('0x4')}});exports[_0x4cb6('0x5')]=function(_0x582895,_0x5bfdcd){return function(_0x450063){try{var _0x5a854f={'command':_0x5bfdcd[0x0]};var _0x58ae27=system[_0x4cb6('0x0')](_0x5a854f,{'typecast':!![]});if(_0x58ae27[_0x4cb6('0x6')]){logger[_0x4cb6('0x7')](_0x4cb6('0x8'),_0x582895,_[_0x4cb6('0x9')](_0x58ae27,_0x4cb6('0xa'))['join'](',\x20'));logger['info'](_0x4cb6('0xb'),_0x582895);_0x450063[_0x4cb6('0xc')]();}else{var _0x2bcc23=this;var _0x3bd2d4=utils['getMustacheRender'](_0x5bfdcd[0x0],this);logger[_0x4cb6('0xd')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x582895,_0x3bd2d4);sh[_0x4cb6('0xe')](_['trim'](_0x3bd2d4),function(_0x21ee05,_0x33a2c6){logger[_0x4cb6('0xd')](_0x4cb6('0xf'),_0x582895,_0x21ee05);if(_0x21ee05==0x0){var _0x294a86=_0x33a2c6[_0x4cb6('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x4cb6('0x11')](_0x5bfdcd[0x1])||_['isEmpty'](_0x5bfdcd[0x1])){logger[_0x4cb6('0xd')]('[%s][SYSTEM]\x20no\x20variable',_0x582895);_0x2bcc23[_0x4cb6('0x12')][_0x5bfdcd[0x1]]=_0x294a86;}else{logger[_0x4cb6('0xd')](_0x4cb6('0x13'),_0x582895,_0x5bfdcd[0x1],_0x294a86);_0x2bcc23[_0x4cb6('0x12')][_0x5bfdcd[0x1]]=_0x294a86;}}_0x450063[_0x4cb6('0xc')]();});}}catch(_0xb33142){logger[_0x4cb6('0x7')](_0x4cb6('0x8'),_0x582895,_[_0x4cb6('0x14')](_0xb33142)?JSON[_0x4cb6('0x15')](_0xb33142):_0xb33142);logger[_0x4cb6('0xd')](_0x4cb6('0xb'),_0x582895);_0x450063[_0x4cb6('0xc')]();}};}; \ No newline at end of file +var _0xa190=['join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','next','isObject','stringify','validate','shelljs','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','log','SYS\x20obj','error','[%s][SYSTEM]\x20%s'];(function(_0x11a7c9,_0x2de6e8){var _0x2bf3d8=function(_0x294db5){while(--_0x294db5){_0x11a7c9['push'](_0x11a7c9['shift']());}};_0x2bf3d8(++_0x2de6e8);}(_0xa190,0x100));var _0x0a19=function(_0x540018,_0x541233){_0x540018=_0x540018-0x0;var _0x47e698=_0xa190[_0x540018];return _0x47e698;};'use strict';var schema=require(_0x0a19('0x0'));var sh=require(_0x0a19('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':_0x0a19('0x2'),'required':!![],'message':_0x0a19('0x3')}});exports['consequence']=function(_0x321d98,_0x13eb5f){console[_0x0a19('0x4')]('CONSEQ');return function(_0x379afc){try{var _0x3deb1b={'command':_0x13eb5f[0x0]};console[_0x0a19('0x4')](_0x0a19('0x5'),_0x3deb1b);var _0x210f66=system['validate'](_0x3deb1b,{'typecast':!![]});if(_0x210f66['length']){logger[_0x0a19('0x6')](_0x0a19('0x7'),_0x321d98,_['map'](_0x210f66,'message')[_0x0a19('0x8')](',\x20'));logger[_0x0a19('0x9')](_0x0a19('0xa'),_0x321d98);_0x379afc['next']();}else{var _0xcf7489=this;var _0x385354=utils[_0x0a19('0xb')](_0x13eb5f[0x0],this);logger[_0x0a19('0x9')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x321d98,_0x385354);sh['exec'](_[_0x0a19('0xc')](_0x385354),function(_0xfe4a3d,_0x528a33){logger['info'](_0x0a19('0xd'),_0x321d98,_0xfe4a3d);if(_0xfe4a3d==0x0){var _0x4b0448=_0x528a33[_0x0a19('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0x0a19('0xf')](_0x13eb5f[0x1])||_['isEmpty'](_0x13eb5f[0x1])){logger[_0x0a19('0x9')](_0x0a19('0x10'),_0x321d98);_0xcf7489['body'][_0x13eb5f[0x1]]=_0x4b0448;}else{logger[_0x0a19('0x9')](_0x0a19('0x11'),_0x321d98,_0x13eb5f[0x1],_0x4b0448);_0xcf7489[_0x0a19('0x12')][_0x13eb5f[0x1]]=_0x4b0448;}}_0x379afc[_0x0a19('0x13')]();});}}catch(_0x1a3538){logger[_0x0a19('0x6')](_0x0a19('0x7'),_0x321d98,_[_0x0a19('0x14')](_0x1a3538)?JSON[_0x0a19('0x15')](_0x1a3538):_0x1a3538);logger[_0x0a19('0x9')](_0x0a19('0xa'),_0x321d98);_0x379afc[_0x0a19('0x13')]();}};}; \ 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 8b09a05..1c811f1 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 _0x9815=['isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','error','[%s][TAG]\x20%s','map','message','join','info','next','Interaction','channel','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally'];(function(_0x36e49d,_0x203962){var _0x14fb01=function(_0x5537f4){while(--_0x5537f4){_0x36e49d['push'](_0x36e49d['shift']());}};_0x14fb01(++_0x203962);}(_0x9815,0x6d));var _0x5981=function(_0x2ff6e2,_0x345dba){_0x2ff6e2=_0x2ff6e2-0x0;var _0x3bc8ca=_0x9815[_0x2ff6e2];return _0x3bc8ca;};'use strict';var schema=require(_0x5981('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x5981('0x1')),'openchannelInteraction':require(_0x5981('0x2')),'smsInteraction':require(_0x5981('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x5981('0x4')),'whatsappInteraction':require(_0x5981('0x5'))};var logger=require(_0x5981('0x6'))(_0x5981('0x7'));var tag=schema({'tag':{'type':_0x5981('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x5981('0x9')]=function(_0x17c1ac,_0x38b4a7,_0x53aa0d,_0x3e513c){return function(_0x1d4514){try{var _0x35bcd3={'tag':_0x38b4a7[0x0]};var _0x3c1bd2=tag[_0x5981('0x0')](_0x35bcd3,{'typecast':!![]});if(_0x3c1bd2['length']){logger[_0x5981('0xa')](_0x5981('0xb'),_0x17c1ac,_[_0x5981('0xc')](_0x3c1bd2,_0x5981('0xd'))[_0x5981('0xe')](',\x20'));logger[_0x5981('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x17c1ac);_0x1d4514[_0x5981('0x10')]();}else{var _0x332763={'ids':[_0x38b4a7[0x0]]};if(rpc[_0x3e513c['channel']+_0x5981('0x11')]){rpc[_0x3e513c[_0x5981('0x12')]+_0x5981('0x11')]['addTags'](_0x3e513c[_0x5981('0x13')]['id'],_0x332763)[_0x5981('0x14')](function(_0x1fbe32){logger[_0x5981('0xf')](_0x5981('0x15'),_0x17c1ac,_0x38b4a7[0x1],_0x3e513c[_0x5981('0x12')],_0x3e513c['interaction']['id']);})[_0x5981('0x16')](function(_0xeeb818){logger['error'](_0x5981('0xb'),_0x17c1ac,JSON[_0x5981('0x17')](_0xeeb818));logger[_0x5981('0xf')](_0x5981('0x18'),_0x17c1ac);})[_0x5981('0x19')](function(){_0x1d4514[_0x5981('0x10')]();});}}}catch(_0x4175cd){logger['error'](_0x5981('0xb'),_0x17c1ac,_[_0x5981('0x1a')](_0x4175cd)?JSON['stringify'](_0x4175cd):_0x4175cd);logger[_0x5981('0xf')](_0x5981('0x18'),_0x17c1ac);_0x1d4514[_0x5981('0x10')]();}};}; \ No newline at end of file +var _0x74a1=['info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','finally','next','error','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','map','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then'];(function(_0x5374eb,_0x4e5e18){var _0x406a25=function(_0x3dfa42){while(--_0x3dfa42){_0x5374eb['push'](_0x5374eb['shift']());}};_0x406a25(++_0x4e5e18);}(_0x74a1,0x1ac));var _0x174a=function(_0x589f05,_0x1c5a16){_0x589f05=_0x589f05-0x0;var _0x3a11b4=_0x74a1[_0x589f05];return _0x3a11b4;};'use strict';var schema=require(_0x174a('0x0'));var _=require(_0x174a('0x1'));var rpc={'chatInteraction':require(_0x174a('0x2')),'openchannelInteraction':require(_0x174a('0x3')),'smsInteraction':require(_0x174a('0x4')),'mailInteraction':require(_0x174a('0x5')),'faxInteraction':require(_0x174a('0x6')),'whatsappInteraction':require(_0x174a('0x7'))};var logger=require(_0x174a('0x8'))('routing');var tag=schema({'tag':{'type':_0x174a('0x9'),'required':!![],'message':_0x174a('0xa')}});exports[_0x174a('0xb')]=function(_0x4f0b2a,_0x272665,_0x47b15c,_0x19fda7){return function(_0x17d316){try{var _0x10be8a={'tag':_0x272665[0x0]};var _0x2990c7=tag[_0x174a('0x0')](_0x10be8a,{'typecast':!![]});if(_0x2990c7['length']){logger['error']('[%s][TAG]\x20%s',_0x4f0b2a,_[_0x174a('0xc')](_0x2990c7,'message')[_0x174a('0xd')](',\x20'));logger['info'](_0x174a('0xe'),_0x4f0b2a);_0x17d316['next']();}else{var _0x54704e={'ids':[_0x272665[0x0]]};if(rpc[_0x19fda7[_0x174a('0xf')]+_0x174a('0x10')]){rpc[_0x19fda7[_0x174a('0xf')]+_0x174a('0x10')][_0x174a('0x11')](_0x19fda7[_0x174a('0x12')]['id'],_0x54704e)[_0x174a('0x13')](function(_0x5ec9d8){logger[_0x174a('0x14')](_0x174a('0x15'),_0x4f0b2a,_0x272665[0x1],_0x19fda7[_0x174a('0xf')],_0x19fda7[_0x174a('0x12')]['id']);})[_0x174a('0x16')](function(_0x3b7ed5){logger['error'](_0x174a('0x17'),_0x4f0b2a,JSON['stringify'](_0x3b7ed5));logger['info'](_0x174a('0xe'),_0x4f0b2a);})[_0x174a('0x18')](function(){_0x17d316[_0x174a('0x19')]();});}}}catch(_0x538133){logger[_0x174a('0x1a')](_0x174a('0x17'),_0x4f0b2a,_['isObject'](_0x538133)?JSON[_0x174a('0x1b')](_0x538133):_0x538133);logger[_0x174a('0x14')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4f0b2a);_0x17d316['next']();}};}; \ 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 4c19cba..d1c6588 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 _0xf430=['contact','message','account','list','mustache','lodash','exports','render'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf430,0x1e4));var _0x0f43=function(_0x2d2e85,_0x22faa9){_0x2d2e85=_0x2d2e85-0x0;var _0x3e9f5e=_0xf430[_0x2d2e85];return _0x3e9f5e;};'use strict';var Mustache=require(_0x0f43('0x0'));var _=require(_0x0f43('0x1'));module[_0x0f43('0x2')]={'getMustacheRender':function(_0x55400e,_0x379dd5){return Mustache[_0x0f43('0x3')](_0x55400e,_['merge'](_0x379dd5['body'],{'contact':_0x379dd5[_0x0f43('0x4')],'message':_0x379dd5[_0x0f43('0x5')],'account':_0x379dd5[_0x0f43('0x6')],'interaction':_0x379dd5['interaction'],'list':_0x379dd5[_0x0f43('0x7')]}))||'';}}; \ No newline at end of file +var _0x4e83=['list','lodash','exports','merge','body','contact','message','account','interaction'];(function(_0x870b62,_0x2143f9){var _0x2dcb39=function(_0x2fb63d){while(--_0x2fb63d){_0x870b62['push'](_0x870b62['shift']());}};_0x2dcb39(++_0x2143f9);}(_0x4e83,0x88));var _0x34e8=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x4e83[_0x16b9ed];return _0x66b1f8;};'use strict';var Mustache=require('mustache');var _=require(_0x34e8('0x0'));module[_0x34e8('0x1')]={'getMustacheRender':function(_0x3345c6,_0x3d2157){return Mustache['render'](_0x3345c6,_[_0x34e8('0x2')](_0x3d2157[_0x34e8('0x3')],{'contact':_0x3d2157[_0x34e8('0x4')],'message':_0x3d2157[_0x34e8('0x5')],'account':_0x3d2157[_0x34e8('0x6')],'interaction':_0x3d2157[_0x34e8('0x7')],'list':_0x3d2157[_0x34e8('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 9c47a0b..15dc703 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 _0x9a19=['map','interval','listen','rules','channel','interaction','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','message','tag','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','priority','info','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','Applications\x20executed','stringify','matchPath','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','emit','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','lodash','util','path','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','isNil','IntervalId','Intervals'];(function(_0x504c88,_0x1c3016){var _0xb5611e=function(_0x2beaf8){while(--_0x2beaf8){_0x504c88['push'](_0x504c88['shift']());}};_0xb5611e(++_0x1c3016);}(_0x9a19,0x114));var _0x99a1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9a19[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var path=require(_0x99a1('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x99a1('0x3'));var uuid=require(_0x99a1('0x4'));var config=require(_0x99a1('0x5'));var logger=require(_0x99a1('0x6'))(_0x99a1('0x7'));var rpc={'openchannelQueueReport':require(_0x99a1('0x8')),'mailQueueReport':require(_0x99a1('0x9')),'chatQueueReport':require(_0x99a1('0xa')),'smsQueueReport':require(_0x99a1('0xb')),'faxQueueReport':require(_0x99a1('0xc')),'whatsappQueueReport':require(_0x99a1('0xd'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x4d2a5c,_0x5aa6c2,_0x56f50){return util[_0x99a1('0xe')]('%s.%s.%s',_0x4d2a5c,_0x5aa6c2||0x0,_0x56f50||0x0);}function getIntervals(_0x5874fc,_0x4696f6){var _0xd7b568=[];if(!_[_0x99a1('0xf')](_0x4696f6[_0x99a1('0x10')])&&!_[_0x99a1('0xf')](_0x5874fc[_0x4696f6['IntervalId']])&&!_[_0x99a1('0xf')](_0x5874fc[_0x4696f6[_0x99a1('0x10')]][_0x99a1('0x11')])){_0xd7b568=_[_0x99a1('0x12')](_0x5874fc[_0x4696f6[_0x99a1('0x10')]][_0x99a1('0x11')],_0x99a1('0x13'));}else if(!_[_0x99a1('0xf')](_0x4696f6[_0x99a1('0x13')])){_0xd7b568=[_0x4696f6[_0x99a1('0x13')]];}return _0xd7b568;}exports[_0x99a1('0x14')]=function(_0x47815e){_0x47815e[_0x99a1('0x15')]={};return new BPromise(function(_0x3c9ef4,_0x39ee55){var _0x4d73de={'Start':function(_0x2d81ed){var _0x3e45d4=this;return new Promise(function(_0x1bb464,_0x3d40cc){if(_0x2d81ed){try{var _0x384f05=[];var _0x33e2c1=getId(_0x2d81ed[_0x99a1('0x16')],_0x2d81ed['message']?_0x2d81ed['message']['id']:0x0,_0x2d81ed[_0x99a1('0x17')]?_0x2d81ed[_0x99a1('0x17')]['id']:0x0);if(_0x2d81ed[_0x99a1('0x18')]&&_[_0x99a1('0x19')](_0x2d81ed[_0x99a1('0x18')])&&_0x2d81ed[_0x99a1('0x18')][_0x99a1('0x1a')]){for(var _0x3cd62c=0x0;_0x3cd62c<_0x2d81ed[_0x99a1('0x18')][_0x99a1('0x1a')];_0x3cd62c+=0x1){var _0x3c23c0=_0x2d81ed['applications'][_0x3cd62c];if(fs[_0x99a1('0x1b')](path[_0x99a1('0x1c')](__dirname,'applications',_0x3c23c0[_0x99a1('0x1d')]+'.js'))){var _0x458ed3=[];switch(_0x3c23c0[_0x99a1('0x1d')][_0x99a1('0x1e')]()){case _0x99a1('0x1f'):var _0x5a88c6=_0x3c23c0[_0x99a1('0x20')][_0x99a1('0x21')](',');if(_0x2d81ed['channel']===_0x99a1('0x22')){_0x458ed3['push'](_0x5a88c6[0x0]);_0x458ed3[_0x99a1('0x23')](_0x5a88c6[0x1]);_0x458ed3[_0x99a1('0x23')](_0x5a88c6[_0x99a1('0x24')](0x2,_0x5a88c6[_0x99a1('0x1a')])[_0x99a1('0x1c')](','));}else{_0x458ed3[_0x99a1('0x23')](_0x5a88c6[0x0]);_0x458ed3['push'](_0x5a88c6[_0x99a1('0x24')](0x1,_0x5a88c6['length'])['join'](','));}break;case _0x99a1('0x25'):var _0x440879=_0x3c23c0[_0x99a1('0x20')][_0x99a1('0x21')](',');_0x458ed3[_0x99a1('0x23')](_0x440879[0x0]);_0x458ed3[_0x99a1('0x23')](_0x440879[0x1]);_0x458ed3[_0x99a1('0x23')](_0x440879['slice'](0x2,_0x440879[_0x99a1('0x1a')])['join'](','));break;case _0x99a1('0x26'):var _0x1137f2=_0x3c23c0[_0x99a1('0x20')]['split'](',');_0x458ed3[_0x99a1('0x23')](_0x1137f2[0x0]);_0x458ed3[_0x99a1('0x23')](_0x1137f2[0x1]);_0x458ed3['push'](_0x1137f2[0x2]);_0x458ed3[_0x99a1('0x23')](_0x1137f2[0x3]);_0x458ed3[_0x99a1('0x23')](_0x1137f2[_0x99a1('0x24')](0x4,_0x1137f2[_0x99a1('0x1a')])[_0x99a1('0x1c')](','));break;case _0x99a1('0x27'):var _0x327fb4=_0x3c23c0[_0x99a1('0x20')]['split'](',');_0x458ed3['push'](_0x327fb4[0x0]);_0x458ed3[_0x99a1('0x23')](_0x327fb4[0x1]);_0x458ed3['push'](_0x327fb4[0x2]);_0x458ed3[_0x99a1('0x23')](_0x327fb4[0x3]);_0x458ed3[_0x99a1('0x23')](_0x327fb4['slice'](0x4,_0x327fb4[_0x99a1('0x1a')])[_0x99a1('0x1c')](','));break;case _0x99a1('0x28'):_0x458ed3[_0x99a1('0x23')](_0x3c23c0[_0x99a1('0x20')]);break;case _0x99a1('0x29'):_0x458ed3[_0x99a1('0x23')](_0x3c23c0[_0x99a1('0x2a')]);_0x458ed3[_0x99a1('0x23')](_0x3c23c0[_0x99a1('0x20')]);break;default:_0x458ed3=_[_0x99a1('0xf')](_0x3c23c0[_0x99a1('0x20')])?[]:_0x3c23c0[_0x99a1('0x20')][_0x99a1('0x21')](',');}var _0x55005e={'id':util['format'](_0x99a1('0x2b'),_0x33e2c1,_0x3c23c0['id'],_0x3c23c0[_0x99a1('0x1d')]),'condition':require(_0x99a1('0x2c'))[_0x99a1('0x2d')](_0x33e2c1,getIntervals(_0x47815e[_0x99a1('0x2e')],_0x3c23c0),_0x47815e),'consequence':require(_0x99a1('0x2f')+_0x3c23c0[_0x99a1('0x1d')])['consequence'](_0x33e2c1,_0x458ed3,_0x47815e,_0x2d81ed),'p':_0x3c23c0[_0x99a1('0x30')]||0x0};logger[_0x99a1('0x31')]('Push\x20new\x20rule',_0x55005e['id'],_0x99a1('0x32'),getIntervals(_0x47815e[_0x99a1('0x2e')],_0x3c23c0)[_0x99a1('0x1c')](_0x99a1('0x33')));_0x384f05[_0x99a1('0x23')](_0x55005e);}else{logger[_0x99a1('0x34')](_0x99a1('0x35'),path[_0x99a1('0x1c')](__dirname,_0x99a1('0x18'),_0x3c23c0[_0x99a1('0x1d')]+_0x99a1('0x36')));}}_0x47815e[_0x99a1('0x15')][_0x33e2c1]=new RuleEngine(_0x384f05);_0x47815e[_0x99a1('0x15')][_0x33e2c1]['execute'](_0x2d81ed,function(_0x5553e4){logger['info'](_0x99a1('0x37'),JSON[_0x99a1('0x38')](_0x5553e4[_0x99a1('0x39')]));if(_0x47815e[_0x99a1('0x15')][_0x33e2c1]){_0x47815e[_0x99a1('0x15')][_0x33e2c1]['emit'](_0x99a1('0x3a'));}});return _0x1bb464({'code':0xc8,'message':_0x2d81ed});}else{logger[_0x99a1('0x31')](_0x99a1('0x3b'));return _0x1bb464({'code':0xc8,'message':_0x2d81ed});}}catch(_0x51efe5){logger['error'](_0x51efe5[_0x99a1('0x3c')]);return _0x3d40cc(_0x3e45d4[_0x99a1('0x34')](0x1f4,_0x51efe5));}}return _0x3d40cc(_0x99a1('0x3d'));});},'AcceptMessage':function(_0x5424e8){var _0x6c4cb=this;return new Promise(function(_0xa028d,_0x1b5d2d){if(_0x5424e8[_0x99a1('0x3e')]&&_0x5424e8[_0x99a1('0x3e')]['id']){if(_0x47815e[_0x99a1('0x3f')][_0x5424e8[_0x99a1('0x3e')]['id']]){_0x47815e[_0x99a1('0x3f')][_0x5424e8[_0x99a1('0x3e')]['id']][_0x99a1('0x40')]=![];_0x47815e['agents'][_0x5424e8[_0x99a1('0x3e')]['id']][_0x99a1('0x41')]=undefined;}}if(_0x5424e8[_0x99a1('0x28')]&&_0x5424e8['message']['id']){try{var _0x1beed2=getId(_0x5424e8['channel'],_0x5424e8[_0x99a1('0x28')]?_0x5424e8[_0x99a1('0x28')]['id']:0x0,_0x5424e8[_0x99a1('0x17')]?_0x5424e8[_0x99a1('0x17')]['id']:0x0);if(_0x47815e[_0x99a1('0x15')][_0x1beed2]){_0x47815e[_0x99a1('0x15')][_0x1beed2]['emit'](_0x99a1('0x42'));if(rpc[_0x5424e8['channel']+_0x99a1('0x43')]){rpc[_0x5424e8[_0x99a1('0x16')]+_0x99a1('0x43')][_0x99a1('0x44')](_0x1beed2,{'UserId':_0x5424e8[_0x99a1('0x28')][_0x99a1('0x45')]})[_0x99a1('0x46')](function(_0x3861b6){logger[_0x99a1('0x34')](_0x99a1('0x47'));});}}return _0xa028d({'code':0xc8,'message':_0x5424e8});}catch(_0x2d6212){logger['error'](_0x2d6212[_0x99a1('0x3c')]);return _0x1b5d2d(_0x6c4cb[_0x99a1('0x34')](0x1f4,_0x2d6212));}}logger['error'](_0x99a1('0x48'));return _0x1b5d2d(_0x6c4cb[_0x99a1('0x34')](0x1f4,_0x99a1('0x48')));});},'RejectMessage':function(_0x2e377b){var _0x113dd9=this;return new Promise(function(_0x254c41,_0x2e3bef){if(_0x2e377b['agent']&&_0x2e377b[_0x99a1('0x3e')]['id']){try{if(_0x47815e['agents'][_0x2e377b[_0x99a1('0x3e')]['id']]){_0x47815e[_0x99a1('0x3f')][_0x2e377b['agent']['id']]['busy']=![];_0x47815e[_0x99a1('0x3f')][_0x2e377b[_0x99a1('0x3e')]['id']][_0x99a1('0x41')]=undefined;}return _0x254c41({'code':0xc8,'message':_0x2e377b});}catch(_0x4519fb){logger[_0x99a1('0x34')](_0x4519fb['stack']);return _0x2e3bef(_0x113dd9['error'](0x1f4,_0x4519fb));}}logger['error'](_0x99a1('0x48'));return _0x2e3bef(_0x113dd9[_0x99a1('0x34')](0x1f4,_0x99a1('0x48')));});},'AbandonInteraction':function(_0x30fdfb){var _0x2065ea=this;return new Promise(function(_0x9d9148,_0x1059b1){if(_0x30fdfb['channel']&&_0x30fdfb[_0x99a1('0x17')]&&_0x30fdfb[_0x99a1('0x17')]['id']){try{var _0x451824=getId(_0x30fdfb['channel'],_0x30fdfb[_0x99a1('0x28')]?_0x30fdfb['message']['id']:0x0,_0x30fdfb['interaction']?_0x30fdfb[_0x99a1('0x17')]['id']:0x0);if(_0x47815e[_0x99a1('0x15')][_0x451824]){_0x47815e[_0x99a1('0x15')][_0x451824][_0x99a1('0x49')](_0x99a1('0x42'));}return _0x9d9148({'code':0xc8,'message':_0x30fdfb});}catch(_0xf8208a){logger[_0x99a1('0x34')](_0xf8208a[_0x99a1('0x3c')]);return _0x1059b1(_0x2065ea[_0x99a1('0x34')](0x1f4,_0xf8208a));}}logger['error'](_0x99a1('0x48'));return _0x1059b1(_0x2065ea['error'](0x1f4,_0x99a1('0x48')));});},'AgentCapacity':function(_0x14e29f){var _0x5dc042=this;return new Promise(function(_0x2cc320,_0x1cf53b){if(_0x47815e[_0x99a1('0x3f')][_0x99a1('0x4a')](_0x14e29f['id'])){for(var _0x2800d5 in _0x14e29f[_0x99a1('0x4b')]){if(_0x14e29f[_0x99a1('0x4b')][_0x99a1('0x4a')](_0x2800d5)){if(_0x47815e[_0x99a1('0x3f')][_0x14e29f['id']][_0x99a1('0x4a')](_0x2800d5+_0x99a1('0x4c'))){_0x47815e[_0x99a1('0x3f')][_0x14e29f['id']][_0x2800d5+'CurrentCapacity']=parseInt(_0x14e29f['capacity'][_0x2800d5],0xa);}}}_0x47815e[_0x99a1('0x3f')][_0x14e29f['id']][_0x99a1('0x4d')]();return _0x2cc320({'code':0xc8,'message':_0x47815e[_0x99a1('0x3f')][_0x14e29f['id']]});}else{return _0x1cf53b(_0x5dc042[_0x99a1('0x34')](0x1f4,_0x99a1('0x4e')));}});},'Agents':function(_0x572557){return new Promise(function(_0x4e815d,_0x35f4a8){var _0x529f66=_[_0x99a1('0x4f')](_0x47815e[_0x99a1('0x3f')]);_0x4e815d({'count':_0x529f66[_0x99a1('0x1a')],'rows':_0x529f66});});},'ChatQueues':function(_0x17130d){return new Promise(function(_0x2b0e5f,_0x4f1c74){var _0x222bd3=[];for(var _0x257331 in _0x47815e[_0x99a1('0x50')]){if(_0x47815e[_0x99a1('0x50')][_0x99a1('0x4a')](_0x257331)){var _0x10289c=_0x47815e['chatQueues'][_0x257331];var _0x45113b={'id':_0x10289c['id'],'available':_0x10289c[_0x99a1('0x51')],'loggedIn':_0x10289c['loggedIn'],'name':_0x10289c[_0x99a1('0x52')],'paused':_0x10289c[_0x99a1('0x53')],'waiting':_0x10289c[_0x99a1('0x54')]};_0x222bd3[_0x99a1('0x23')](_0x45113b);}}_0x2b0e5f({'count':_0x222bd3[_0x99a1('0x1a')],'rows':_0x222bd3});});},'MailQueues':function(_0x4ab52d){return new Promise(function(_0x52f450,_0x5d250a){var _0x50b5ab=[];for(var _0x5cbf98 in _0x47815e[_0x99a1('0x55')]){if(_0x47815e[_0x99a1('0x55')]['hasOwnProperty'](_0x5cbf98)){var _0x594198=_0x47815e[_0x99a1('0x55')][_0x5cbf98];var _0x49f8fa={'id':_0x594198['id'],'available':_0x594198[_0x99a1('0x51')],'loggedIn':_0x594198[_0x99a1('0x56')],'name':_0x594198[_0x99a1('0x52')],'paused':_0x594198[_0x99a1('0x53')],'waiting':_0x594198['waiting']};_0x50b5ab[_0x99a1('0x23')](_0x49f8fa);}}_0x52f450({'count':_0x50b5ab[_0x99a1('0x1a')],'rows':_0x50b5ab});});},'OpenchannelQueues':function(_0x11b1c1){return new Promise(function(_0x4fbfb3,_0x3a62c6){var _0x5c5481=[];for(var _0x4ddfcf in _0x47815e[_0x99a1('0x57')]){if(_0x47815e[_0x99a1('0x57')][_0x99a1('0x4a')](_0x4ddfcf)){var _0x25fc39=_0x47815e['openchannelQueues'][_0x4ddfcf];var _0x4d37f8={'id':_0x25fc39['id'],'available':_0x25fc39['available'],'loggedIn':_0x25fc39[_0x99a1('0x56')],'name':_0x25fc39[_0x99a1('0x52')],'paused':_0x25fc39['paused'],'waiting':_0x25fc39['waiting']};_0x5c5481[_0x99a1('0x23')](_0x4d37f8);}}_0x4fbfb3({'count':_0x5c5481[_0x99a1('0x1a')],'rows':_0x5c5481});});},'SmsQueues':function(_0x401c8f){return new Promise(function(_0x509d4f,_0x50285f){var _0x2b8df8=[];for(var _0x5409b9 in _0x47815e[_0x99a1('0x58')]){if(_0x47815e[_0x99a1('0x58')][_0x99a1('0x4a')](_0x5409b9)){var _0x4b946b=_0x47815e[_0x99a1('0x58')][_0x5409b9];var _0x28c7d8={'id':_0x4b946b['id'],'available':_0x4b946b['available'],'loggedIn':_0x4b946b['loggedIn'],'name':_0x4b946b[_0x99a1('0x52')],'paused':_0x4b946b['paused'],'waiting':_0x4b946b[_0x99a1('0x54')]};_0x2b8df8[_0x99a1('0x23')](_0x28c7d8);}}_0x509d4f({'count':_0x2b8df8[_0x99a1('0x1a')],'rows':_0x2b8df8});});},'FaxQueues':function(_0x57817e){return new Promise(function(_0x1b7bde,_0x35278b){var _0x367c55=[];for(var _0x2a12bf in _0x47815e[_0x99a1('0x59')]){if(_0x47815e['faxQueues']['hasOwnProperty'](_0x2a12bf)){var _0x149293=_0x47815e[_0x99a1('0x59')][_0x2a12bf];var _0x1750d5={'id':_0x149293['id'],'available':_0x149293[_0x99a1('0x51')],'loggedIn':_0x149293['loggedIn'],'name':_0x149293[_0x99a1('0x52')],'paused':_0x149293['paused'],'waiting':_0x149293['waiting']};_0x367c55[_0x99a1('0x23')](_0x1750d5);}}_0x1b7bde({'count':_0x367c55[_0x99a1('0x1a')],'rows':_0x367c55});});},'WhatsappQueues':function(_0x1abc9f){return new Promise(function(_0x525969,_0x17a012){var _0x2d7b17=[];for(var _0x25a738 in _0x47815e[_0x99a1('0x5a')]){if(_0x47815e[_0x99a1('0x5a')]['hasOwnProperty'](_0x25a738)){var _0x3d1537=_0x47815e[_0x99a1('0x5a')][_0x25a738];var _0x95efd2={'id':_0x3d1537['id'],'available':_0x3d1537[_0x99a1('0x51')],'loggedIn':_0x3d1537[_0x99a1('0x56')],'name':_0x3d1537[_0x99a1('0x52')],'paused':_0x3d1537['paused'],'waiting':_0x3d1537[_0x99a1('0x54')]};_0x2d7b17[_0x99a1('0x23')](_0x95efd2);}}_0x525969({'count':_0x2d7b17[_0x99a1('0x1a')],'rows':_0x2d7b17});});},'ChatQueuesWaitingInteractions':function(_0x1b3b83){return new Promise(function(_0x2172c3,_0x579271){var _0x18843d=_[_0x99a1('0x4f')](_0x47815e[_0x99a1('0x5b')]);_0x2172c3({'count':_0x18843d[_0x99a1('0x1a')],'rows':_0x18843d});});},'MailQueuesWaitingInteractions':function(_0xeeeb6c){return new Promise(function(_0x34d9aa,_0x48adaa){var _0xaa953e=_[_0x99a1('0x4f')](_0x47815e['mailQueuesWaitingInteractions']);_0x34d9aa({'count':_0xaa953e['length'],'rows':_0xaa953e});});},'OpenchannelQueuesWaitingInteractions':function(_0x2af5cc){return new Promise(function(_0x414370,_0x5ecf95){var _0x2f2b17=_[_0x99a1('0x4f')](_0x47815e[_0x99a1('0x5c')]);_0x414370({'count':_0x2f2b17[_0x99a1('0x1a')],'rows':_0x2f2b17});});},'SmsQueuesWaitingInteractions':function(_0x43156f){return new Promise(function(_0x22d32d,_0x2e5a54){var _0x4d007d=_[_0x99a1('0x4f')](_0x47815e[_0x99a1('0x5d')]);_0x22d32d({'count':_0x4d007d[_0x99a1('0x1a')],'rows':_0x4d007d});});},'FaxQueuesWaitingInteractions':function(_0x19ebd9){return new Promise(function(_0x16973f,_0x597cb7){var _0x285897=_['values'](_0x47815e['faxQueuesWaitingInteractions']);_0x16973f({'count':_0x285897[_0x99a1('0x1a')],'rows':_0x285897});});},'WhatsappQueuesWaitingInteractions':function(_0x29bc9b){return new Promise(function(_0x188f81,_0x3676eb){var _0xbbbe26=_[_0x99a1('0x4f')](_0x47815e[_0x99a1('0x5e')]);_0x188f81({'count':_0xbbbe26[_0x99a1('0x1a')],'rows':_0xbbbe26});});}};var _0x361ce6=jayson['server'](_0x4d73de)[_0x99a1('0x5f')]();_0x361ce6['on'](_0x99a1('0x34'),function(_0x20a414){logger[_0x99a1('0x34')](JSON[_0x99a1('0x38')](_0x20a414));return _0x39ee55(_0x20a414);});_0x361ce6[_0x99a1('0x14')](0x232c,_0x99a1('0x60'),function(){console[_0x99a1('0x61')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x3c9ef4('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x6c32=['openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','isArray','applications','length','toLowerCase','split','channel','mail','push','slice','join','dialogflow','appdata','amazonlex','tag','TagId','%s:%s:%s','app','./interval','condition','./applications/','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','stringify','matchPath','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','emit','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','capacity','hasOwnProperty','CurrentCapacity','values','chatQueues','loggedIn','name','paused','waiting','mailQueues','available'];(function(_0x4a9801,_0x548afb){var _0x2b089a=function(_0x4b4074){while(--_0x4b4074){_0x4a9801['push'](_0x4a9801['shift']());}};_0x2b089a(++_0x548afb);}(_0x6c32,0x6e));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x26c3('0x0'));var util=require(_0x26c3('0x1'));var path=require(_0x26c3('0x2'));var fs=require('fs');var jayson=require(_0x26c3('0x3'));var BPromise=require(_0x26c3('0x4'));var uuid=require(_0x26c3('0x5'));var config=require(_0x26c3('0x6'));var logger=require(_0x26c3('0x7'))(_0x26c3('0x8'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x26c3('0x9')),'chatQueueReport':require(_0x26c3('0xa')),'smsQueueReport':require(_0x26c3('0xb')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x26c3('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x3dde22,_0x3ff8e7,_0x1a4c5b){return util[_0x26c3('0xd')](_0x26c3('0xe'),_0x3dde22,_0x3ff8e7||0x0,_0x1a4c5b||0x0);}function getIntervals(_0xda2203,_0x155187){var _0x380194=[];if(!_[_0x26c3('0xf')](_0x155187[_0x26c3('0x10')])&&!_['isNil'](_0xda2203[_0x155187['IntervalId']])&&!_['isNil'](_0xda2203[_0x155187['IntervalId']][_0x26c3('0x11')])){_0x380194=_[_0x26c3('0x12')](_0xda2203[_0x155187[_0x26c3('0x10')]][_0x26c3('0x11')],'interval');}else if(!_['isNil'](_0x155187[_0x26c3('0x13')])){_0x380194=[_0x155187[_0x26c3('0x13')]];}return _0x380194;}exports[_0x26c3('0x14')]=function(_0x3cd3c7){_0x3cd3c7[_0x26c3('0x15')]={};return new BPromise(function(_0x568d0b,_0x5d4e9d){var _0x2acfb1={'Start':function(_0xc14c69){var _0x4f4256=this;return new Promise(function(_0x4ed7c1,_0x124cb3){if(_0xc14c69){try{var _0x5e863f=[];var _0x3ce1ea=getId(_0xc14c69['channel'],_0xc14c69['message']?_0xc14c69[_0x26c3('0x16')]['id']:0x0,_0xc14c69['interaction']?_0xc14c69[_0x26c3('0x17')]['id']:0x0);if(_0xc14c69['applications']&&_[_0x26c3('0x18')](_0xc14c69[_0x26c3('0x19')])&&_0xc14c69[_0x26c3('0x19')][_0x26c3('0x1a')]){for(var _0x20317d=0x0;_0x20317d<_0xc14c69['applications']['length'];_0x20317d+=0x1){var _0x47657d=_0xc14c69[_0x26c3('0x19')][_0x20317d];if(fs['existsSync'](path['join'](__dirname,_0x26c3('0x19'),_0x47657d['app']+'.js'))){var _0x128fca=[];switch(_0x47657d['app'][_0x26c3('0x1b')]()){case'autoreply':var _0x367b62=_0x47657d['appdata'][_0x26c3('0x1c')](',');if(_0xc14c69[_0x26c3('0x1d')]===_0x26c3('0x1e')){_0x128fca[_0x26c3('0x1f')](_0x367b62[0x0]);_0x128fca[_0x26c3('0x1f')](_0x367b62[0x1]);_0x128fca[_0x26c3('0x1f')](_0x367b62[_0x26c3('0x20')](0x2,_0x367b62[_0x26c3('0x1a')])[_0x26c3('0x21')](','));}else{_0x128fca[_0x26c3('0x1f')](_0x367b62[0x0]);_0x128fca['push'](_0x367b62[_0x26c3('0x20')](0x1,_0x367b62['length'])['join'](','));}break;case _0x26c3('0x22'):var _0x13f843=_0x47657d['appdata'][_0x26c3('0x1c')](',');_0x128fca['push'](_0x13f843[0x0]);_0x128fca[_0x26c3('0x1f')](_0x13f843[0x1]);_0x128fca[_0x26c3('0x1f')](_0x13f843[_0x26c3('0x20')](0x2,_0x13f843[_0x26c3('0x1a')])[_0x26c3('0x21')](','));break;case'dialogflowv2':var _0x1d3331=_0x47657d[_0x26c3('0x23')][_0x26c3('0x1c')](',');_0x128fca[_0x26c3('0x1f')](_0x1d3331[0x0]);_0x128fca[_0x26c3('0x1f')](_0x1d3331[0x1]);_0x128fca[_0x26c3('0x1f')](_0x1d3331[0x2]);_0x128fca['push'](_0x1d3331[0x3]);_0x128fca[_0x26c3('0x1f')](_0x1d3331[_0x26c3('0x20')](0x4,_0x1d3331[_0x26c3('0x1a')])['join'](','));break;case _0x26c3('0x24'):var _0x19316e=_0x47657d[_0x26c3('0x23')][_0x26c3('0x1c')](',');_0x128fca[_0x26c3('0x1f')](_0x19316e[0x0]);_0x128fca[_0x26c3('0x1f')](_0x19316e[0x1]);_0x128fca['push'](_0x19316e[0x2]);_0x128fca[_0x26c3('0x1f')](_0x19316e[0x3]);_0x128fca[_0x26c3('0x1f')](_0x19316e['slice'](0x4,_0x19316e['length'])['join'](','));break;case'message':_0x128fca['push'](_0x47657d[_0x26c3('0x23')]);break;case _0x26c3('0x25'):_0x128fca['push'](_0x47657d[_0x26c3('0x26')]);_0x128fca[_0x26c3('0x1f')](_0x47657d['appdata']);break;default:_0x128fca=_['isNil'](_0x47657d[_0x26c3('0x23')])?[]:_0x47657d['appdata'][_0x26c3('0x1c')](',');}var _0x4fc9ff={'id':util[_0x26c3('0xd')](_0x26c3('0x27'),_0x3ce1ea,_0x47657d['id'],_0x47657d[_0x26c3('0x28')]),'condition':require(_0x26c3('0x29'))[_0x26c3('0x2a')](_0x3ce1ea,getIntervals(_0x3cd3c7['intervals'],_0x47657d),_0x3cd3c7),'consequence':require(_0x26c3('0x2b')+_0x47657d[_0x26c3('0x28')])[_0x26c3('0x2c')](_0x3ce1ea,_0x128fca,_0x3cd3c7,_0xc14c69),'p':_0x47657d[_0x26c3('0x2d')]||0x0};logger[_0x26c3('0x2e')](_0x26c3('0x2f'),_0x4fc9ff['id'],'on\x20interval',getIntervals(_0x3cd3c7['intervals'],_0x47657d)[_0x26c3('0x21')](_0x26c3('0x30')));_0x5e863f[_0x26c3('0x1f')](_0x4fc9ff);}else{logger[_0x26c3('0x31')](_0x26c3('0x32'),path['join'](__dirname,'applications',_0x47657d['app']+_0x26c3('0x33')));}}_0x3cd3c7[_0x26c3('0x15')][_0x3ce1ea]=new RuleEngine(_0x5e863f);_0x3cd3c7[_0x26c3('0x15')][_0x3ce1ea][_0x26c3('0x34')](_0xc14c69,function(_0x124690){logger['info']('Applications\x20executed',JSON[_0x26c3('0x35')](_0x124690[_0x26c3('0x36')]));if(_0x3cd3c7[_0x26c3('0x15')][_0x3ce1ea]){_0x3cd3c7[_0x26c3('0x15')][_0x3ce1ea]['emit'](_0x26c3('0x37'));}});return _0x4ed7c1({'code':0xc8,'message':_0xc14c69});}else{logger[_0x26c3('0x2e')](_0x26c3('0x38'));return _0x4ed7c1({'code':0xc8,'message':_0xc14c69});}}catch(_0x203c54){logger[_0x26c3('0x31')](_0x203c54[_0x26c3('0x39')]);return _0x124cb3(_0x4f4256[_0x26c3('0x31')](0x1f4,_0x203c54));}}return _0x124cb3(_0x26c3('0x3a'));});},'AcceptMessage':function(_0x306ef1){var _0x1c0d6c=this;return new Promise(function(_0x1b415e,_0xafc671){if(_0x306ef1[_0x26c3('0x3b')]&&_0x306ef1['agent']['id']){if(_0x3cd3c7[_0x26c3('0x3c')][_0x306ef1[_0x26c3('0x3b')]['id']]){_0x3cd3c7[_0x26c3('0x3c')][_0x306ef1[_0x26c3('0x3b')]['id']][_0x26c3('0x3d')]=![];_0x3cd3c7[_0x26c3('0x3c')][_0x306ef1['agent']['id']][_0x26c3('0x3e')]=undefined;}}if(_0x306ef1['message']&&_0x306ef1[_0x26c3('0x16')]['id']){try{var _0x50f5cb=getId(_0x306ef1[_0x26c3('0x1d')],_0x306ef1[_0x26c3('0x16')]?_0x306ef1['message']['id']:0x0,_0x306ef1[_0x26c3('0x17')]?_0x306ef1[_0x26c3('0x17')]['id']:0x0);if(_0x3cd3c7[_0x26c3('0x15')][_0x50f5cb]){_0x3cd3c7[_0x26c3('0x15')][_0x50f5cb][_0x26c3('0x3f')]('end');if(rpc[_0x306ef1[_0x26c3('0x1d')]+'QueueReport']){rpc[_0x306ef1[_0x26c3('0x1d')]+'QueueReport']['update'](_0x50f5cb,{'UserId':_0x306ef1[_0x26c3('0x16')][_0x26c3('0x40')]})[_0x26c3('0x41')](function(_0x50f4de){logger[_0x26c3('0x31')](_0x26c3('0x42'));});}}return _0x1b415e({'code':0xc8,'message':_0x306ef1});}catch(_0xe2a7e){logger[_0x26c3('0x31')](_0xe2a7e[_0x26c3('0x39')]);return _0xafc671(_0x1c0d6c[_0x26c3('0x31')](0x1f4,_0xe2a7e));}}logger['error'](_0x26c3('0x43'));return _0xafc671(_0x1c0d6c[_0x26c3('0x31')](0x1f4,_0x26c3('0x43')));});},'RejectMessage':function(_0x133cf7){var _0x551e22=this;return new Promise(function(_0x2f87de,_0x3f4ca9){if(_0x133cf7['agent']&&_0x133cf7[_0x26c3('0x3b')]['id']){try{if(_0x3cd3c7[_0x26c3('0x3c')][_0x133cf7['agent']['id']]){_0x3cd3c7[_0x26c3('0x3c')][_0x133cf7['agent']['id']][_0x26c3('0x3d')]=![];_0x3cd3c7[_0x26c3('0x3c')][_0x133cf7[_0x26c3('0x3b')]['id']][_0x26c3('0x3e')]=undefined;}return _0x2f87de({'code':0xc8,'message':_0x133cf7});}catch(_0x4365e4){logger[_0x26c3('0x31')](_0x4365e4[_0x26c3('0x39')]);return _0x3f4ca9(_0x551e22['error'](0x1f4,_0x4365e4));}}logger[_0x26c3('0x31')]('message\x20is\x20empty');return _0x3f4ca9(_0x551e22['error'](0x1f4,_0x26c3('0x43')));});},'AbandonInteraction':function(_0x3a46f9){var _0x3037ae=this;return new Promise(function(_0x4dc997,_0x4832a2){if(_0x3a46f9[_0x26c3('0x1d')]&&_0x3a46f9[_0x26c3('0x17')]&&_0x3a46f9[_0x26c3('0x17')]['id']){try{var _0x4d1ec7=getId(_0x3a46f9[_0x26c3('0x1d')],_0x3a46f9[_0x26c3('0x16')]?_0x3a46f9[_0x26c3('0x16')]['id']:0x0,_0x3a46f9['interaction']?_0x3a46f9[_0x26c3('0x17')]['id']:0x0);if(_0x3cd3c7['rules'][_0x4d1ec7]){_0x3cd3c7[_0x26c3('0x15')][_0x4d1ec7][_0x26c3('0x3f')](_0x26c3('0x44'));}return _0x4dc997({'code':0xc8,'message':_0x3a46f9});}catch(_0x499445){logger[_0x26c3('0x31')](_0x499445[_0x26c3('0x39')]);return _0x4832a2(_0x3037ae[_0x26c3('0x31')](0x1f4,_0x499445));}}logger[_0x26c3('0x31')](_0x26c3('0x43'));return _0x4832a2(_0x3037ae[_0x26c3('0x31')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x370b2e){var _0x306fef=this;return new Promise(function(_0x5be7d1,_0x394187){if(_0x3cd3c7['agents']['hasOwnProperty'](_0x370b2e['id'])){for(var _0x14a37a in _0x370b2e['capacity']){if(_0x370b2e[_0x26c3('0x45')][_0x26c3('0x46')](_0x14a37a)){if(_0x3cd3c7[_0x26c3('0x3c')][_0x370b2e['id']][_0x26c3('0x46')](_0x14a37a+'CurrentCapacity')){_0x3cd3c7['agents'][_0x370b2e['id']][_0x14a37a+_0x26c3('0x47')]=parseInt(_0x370b2e['capacity'][_0x14a37a],0xa);}}}_0x3cd3c7['agents'][_0x370b2e['id']]['updateRealtime']();return _0x5be7d1({'code':0xc8,'message':_0x3cd3c7[_0x26c3('0x3c')][_0x370b2e['id']]});}else{return _0x394187(_0x306fef['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x1c7d72){return new Promise(function(_0x531e38,_0xa7f1ad){var _0x30299d=_[_0x26c3('0x48')](_0x3cd3c7[_0x26c3('0x3c')]);_0x531e38({'count':_0x30299d['length'],'rows':_0x30299d});});},'ChatQueues':function(_0x400c6d){return new Promise(function(_0x47749e,_0x1fcbb6){var _0x2680f5=[];for(var _0x5926f7 in _0x3cd3c7[_0x26c3('0x49')]){if(_0x3cd3c7[_0x26c3('0x49')][_0x26c3('0x46')](_0x5926f7)){var _0x7aa03a=_0x3cd3c7[_0x26c3('0x49')][_0x5926f7];var _0x28cde2={'id':_0x7aa03a['id'],'available':_0x7aa03a['available'],'loggedIn':_0x7aa03a[_0x26c3('0x4a')],'name':_0x7aa03a[_0x26c3('0x4b')],'paused':_0x7aa03a[_0x26c3('0x4c')],'waiting':_0x7aa03a[_0x26c3('0x4d')]};_0x2680f5['push'](_0x28cde2);}}_0x47749e({'count':_0x2680f5[_0x26c3('0x1a')],'rows':_0x2680f5});});},'MailQueues':function(_0x452643){return new Promise(function(_0xf10de,_0x416373){var _0x4d4970=[];for(var _0x396de4 in _0x3cd3c7[_0x26c3('0x4e')]){if(_0x3cd3c7[_0x26c3('0x4e')][_0x26c3('0x46')](_0x396de4)){var _0x5d0453=_0x3cd3c7[_0x26c3('0x4e')][_0x396de4];var _0x595fdd={'id':_0x5d0453['id'],'available':_0x5d0453[_0x26c3('0x4f')],'loggedIn':_0x5d0453['loggedIn'],'name':_0x5d0453[_0x26c3('0x4b')],'paused':_0x5d0453[_0x26c3('0x4c')],'waiting':_0x5d0453['waiting']};_0x4d4970[_0x26c3('0x1f')](_0x595fdd);}}_0xf10de({'count':_0x4d4970[_0x26c3('0x1a')],'rows':_0x4d4970});});},'OpenchannelQueues':function(_0x266e2b){return new Promise(function(_0xe5c060,_0x41767d){var _0x4fbd2e=[];for(var _0x1dcf53 in _0x3cd3c7[_0x26c3('0x50')]){if(_0x3cd3c7[_0x26c3('0x50')][_0x26c3('0x46')](_0x1dcf53)){var _0x26cb5b=_0x3cd3c7[_0x26c3('0x50')][_0x1dcf53];var _0x38cd7e={'id':_0x26cb5b['id'],'available':_0x26cb5b['available'],'loggedIn':_0x26cb5b[_0x26c3('0x4a')],'name':_0x26cb5b[_0x26c3('0x4b')],'paused':_0x26cb5b[_0x26c3('0x4c')],'waiting':_0x26cb5b[_0x26c3('0x4d')]};_0x4fbd2e['push'](_0x38cd7e);}}_0xe5c060({'count':_0x4fbd2e[_0x26c3('0x1a')],'rows':_0x4fbd2e});});},'SmsQueues':function(_0x965869){return new Promise(function(_0x5f1c25,_0x4df2f){var _0x46f622=[];for(var _0x43da27 in _0x3cd3c7[_0x26c3('0x51')]){if(_0x3cd3c7[_0x26c3('0x51')][_0x26c3('0x46')](_0x43da27)){var _0x2addd3=_0x3cd3c7[_0x26c3('0x51')][_0x43da27];var _0x3afdc7={'id':_0x2addd3['id'],'available':_0x2addd3[_0x26c3('0x4f')],'loggedIn':_0x2addd3[_0x26c3('0x4a')],'name':_0x2addd3[_0x26c3('0x4b')],'paused':_0x2addd3['paused'],'waiting':_0x2addd3['waiting']};_0x46f622['push'](_0x3afdc7);}}_0x5f1c25({'count':_0x46f622['length'],'rows':_0x46f622});});},'FaxQueues':function(_0x15a6c1){return new Promise(function(_0x27869f,_0x2464c7){var _0x3fe81e=[];for(var _0x2c136c in _0x3cd3c7[_0x26c3('0x52')]){if(_0x3cd3c7[_0x26c3('0x52')][_0x26c3('0x46')](_0x2c136c)){var _0x55cdc8=_0x3cd3c7[_0x26c3('0x52')][_0x2c136c];var _0x134cee={'id':_0x55cdc8['id'],'available':_0x55cdc8[_0x26c3('0x4f')],'loggedIn':_0x55cdc8[_0x26c3('0x4a')],'name':_0x55cdc8[_0x26c3('0x4b')],'paused':_0x55cdc8[_0x26c3('0x4c')],'waiting':_0x55cdc8['waiting']};_0x3fe81e[_0x26c3('0x1f')](_0x134cee);}}_0x27869f({'count':_0x3fe81e[_0x26c3('0x1a')],'rows':_0x3fe81e});});},'WhatsappQueues':function(_0x4dc47c){return new Promise(function(_0x25a2cb,_0x252534){var _0x538e3f=[];for(var _0x153509 in _0x3cd3c7[_0x26c3('0x53')]){if(_0x3cd3c7[_0x26c3('0x53')]['hasOwnProperty'](_0x153509)){var _0x35890f=_0x3cd3c7[_0x26c3('0x53')][_0x153509];var _0x39fe7e={'id':_0x35890f['id'],'available':_0x35890f[_0x26c3('0x4f')],'loggedIn':_0x35890f[_0x26c3('0x4a')],'name':_0x35890f[_0x26c3('0x4b')],'paused':_0x35890f[_0x26c3('0x4c')],'waiting':_0x35890f['waiting']};_0x538e3f['push'](_0x39fe7e);}}_0x25a2cb({'count':_0x538e3f[_0x26c3('0x1a')],'rows':_0x538e3f});});},'ChatQueuesWaitingInteractions':function(_0x1ce607){return new Promise(function(_0x1c7387,_0x18189a){var _0x56b282=_[_0x26c3('0x48')](_0x3cd3c7['chatQueuesWaitingInteractions']);_0x1c7387({'count':_0x56b282['length'],'rows':_0x56b282});});},'MailQueuesWaitingInteractions':function(_0x407c93){return new Promise(function(_0x338ea0,_0x5d9223){var _0x3c6f6f=_['values'](_0x3cd3c7[_0x26c3('0x54')]);_0x338ea0({'count':_0x3c6f6f[_0x26c3('0x1a')],'rows':_0x3c6f6f});});},'OpenchannelQueuesWaitingInteractions':function(_0x3f0e89){return new Promise(function(_0x5bbaae,_0xc40965){var _0x585e76=_[_0x26c3('0x48')](_0x3cd3c7[_0x26c3('0x55')]);_0x5bbaae({'count':_0x585e76[_0x26c3('0x1a')],'rows':_0x585e76});});},'SmsQueuesWaitingInteractions':function(_0x3f3b87){return new Promise(function(_0x3d3144,_0x496135){var _0x52d532=_[_0x26c3('0x48')](_0x3cd3c7[_0x26c3('0x56')]);_0x3d3144({'count':_0x52d532['length'],'rows':_0x52d532});});},'FaxQueuesWaitingInteractions':function(_0x346429){return new Promise(function(_0x211668,_0x295463){var _0x4dd8a2=_[_0x26c3('0x48')](_0x3cd3c7[_0x26c3('0x57')]);_0x211668({'count':_0x4dd8a2['length'],'rows':_0x4dd8a2});});},'WhatsappQueuesWaitingInteractions':function(_0x5ebeab){return new Promise(function(_0x1440c9,_0x3d5bab){var _0x3da815=_[_0x26c3('0x48')](_0x3cd3c7[_0x26c3('0x58')]);_0x1440c9({'count':_0x3da815[_0x26c3('0x1a')],'rows':_0x3da815});});}};var _0x483458=jayson[_0x26c3('0x59')](_0x2acfb1)[_0x26c3('0x5a')]();_0x483458['on']('error',function(_0x4326a){logger[_0x26c3('0x31')](JSON[_0x26c3('0x35')](_0x4326a));return _0x5d4e9d(_0x4326a);});_0x483458['listen'](0x232c,_0x26c3('0x5b'),function(){console[_0x26c3('0x5c')](_0x26c3('0x5d'),0x232c);return _0x568d0b(_0x26c3('0x5e')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index a7012d8..b35cfaa 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 _0xe9d4=['lodash','../../../config/logger','routing','client','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','Command','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','stack','stop','util','jayson/promise'];(function(_0x56eeb2,_0x49afed){var _0x302a44=function(_0x40f118){while(--_0x40f118){_0x56eeb2['push'](_0x56eeb2['shift']());}};_0x302a44(++_0x49afed);}(_0xe9d4,0xb2));var _0x4e9d=function(_0xfa4aa2,_0x2f92b6){_0xfa4aa2=_0xfa4aa2-0x0;var _0x228b11=_0xe9d4[_0xfa4aa2];return _0x228b11;};'use strict';var util=require(_0x4e9d('0x0'));var BPromise=require('bluebird');var jayson=require(_0x4e9d('0x1'));var _=require(_0x4e9d('0x2'));var logger=require(_0x4e9d('0x3'))(_0x4e9d('0x4'));var client=jayson[_0x4e9d('0x5')][_0x4e9d('0x6')]({'port':0x232a});function request(_0x318cd7,_0x292ae7){return new BPromise(function(_0x3b0d08,_0x551cd1){return client[_0x4e9d('0x7')](_0x318cd7,_0x292ae7)[_0x4e9d('0x8')](function(_0x4a1fb0){if(_0x4a1fb0[_0x4e9d('0x9')]){return _0x551cd1(_0x4a1fb0[_0x4e9d('0x9')][_0x4e9d('0xa')]);}else{return _0x3b0d08(_0x4a1fb0[_0x4e9d('0xb')]);}})[_0x4e9d('0xc')](function(_0x4ad129){return _0x551cd1(_0x4ad129);});});}exports[_0x4e9d('0xd')]=function(_0x312556,_0x9ed95a,_0x3c438a){return function(_0x2f01b7){if(_0x3c438a[_0x4e9d('0xe')]&&!_0x3c438a[_0x4e9d('0xe')][_0x312556]){logger[_0x4e9d('0xf')](_0x4e9d('0x10'),_0x312556);return _0x2f01b7['stop']();}var _0xdf9277=[];for(var _0x3ff0ca=0x0;_0x3ff0ca<_0x9ed95a['length'];_0x3ff0ca+=0x1){_0xdf9277['push'](request(_0x4e9d('0x11'),{'command':util['format']('iftime\x20%s',_0x9ed95a[_0x3ff0ca])})['then'](function(_0x3251da){return _0x3251da&&_0x3251da[_0x4e9d('0xa')]&&_0x3251da[_0x4e9d('0xa')][_0x4e9d('0x12')](_0x4e9d('0x13'))>=0x0?!![]:![];})[_0x4e9d('0xc')](function(_0x596e2f){logger[_0x4e9d('0x9')](_0x4e9d('0x14'),_0x312556,_0x9ed95a[_0x3ff0ca]);}));}BPromise[_0x4e9d('0x15')](_0xdf9277)[_0x4e9d('0x8')](function(_0x13262e){var _0x122750=_[_0x4e9d('0x16')](_0x13262e);logger[_0x4e9d('0xf')](_0x4e9d('0x17'),_0x312556,_0x9ed95a['join'](_0x4e9d('0x18')),_0x122750);_0x2f01b7[_0x4e9d('0x19')](_0x122750);})['catch'](function(_0x27d8b5){console[_0x4e9d('0x1a')](_0x27d8b5);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x312556,_0x9ed95a[_0x4e9d('0x1b')]('\x20|\x20'),_0x27d8b5[_0x4e9d('0x1c')]);_0x2f01b7[_0x4e9d('0x1d')]();});};}; \ No newline at end of file +var _0xb5bc=['request','then','message','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','iftime\x20%s','indexOf','true','error','[%s][INTERVAL]\x20%s','all','when','log','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http'];(function(_0x5845b5,_0x3ca40b){var _0x38f8b6=function(_0x317ae8){while(--_0x317ae8){_0x5845b5['push'](_0x5845b5['shift']());}};_0x38f8b6(++_0x3ca40b);}(_0xb5bc,0x12e));var _0xcb5b=function(_0x3eb4a9,_0x359d73){_0x3eb4a9=_0x3eb4a9-0x0;var _0x48dbad=_0xb5bc[_0x3eb4a9];return _0x48dbad;};'use strict';var util=require(_0xcb5b('0x0'));var BPromise=require(_0xcb5b('0x1'));var jayson=require(_0xcb5b('0x2'));var _=require(_0xcb5b('0x3'));var logger=require(_0xcb5b('0x4'))(_0xcb5b('0x5'));var client=jayson[_0xcb5b('0x6')][_0xcb5b('0x7')]({'port':0x232a});function request(_0x11cf79,_0x590250){return new BPromise(function(_0x4504e8,_0x25a3e7){return client[_0xcb5b('0x8')](_0x11cf79,_0x590250)[_0xcb5b('0x9')](function(_0x102e40){if(_0x102e40['error']){return _0x25a3e7(_0x102e40['error'][_0xcb5b('0xa')]);}else{return _0x4504e8(_0x102e40[_0xcb5b('0xb')]);}})[_0xcb5b('0xc')](function(_0xae6511){return _0x25a3e7(_0xae6511);});});}exports['condition']=function(_0x840935,_0x313d47,_0x12db6d){return function(_0x1ba88c){if(_0x12db6d[_0xcb5b('0xd')]&&!_0x12db6d[_0xcb5b('0xd')][_0x840935]){logger[_0xcb5b('0xe')](_0xcb5b('0xf'),_0x840935);return _0x1ba88c[_0xcb5b('0x10')]();}var _0x21325b=[];for(var _0x3976c9=0x0;_0x3976c9<_0x313d47[_0xcb5b('0x11')];_0x3976c9+=0x1){_0x21325b[_0xcb5b('0x12')](request(_0xcb5b('0x13'),{'command':util['format'](_0xcb5b('0x14'),_0x313d47[_0x3976c9])})[_0xcb5b('0x9')](function(_0x4ace15){return _0x4ace15&&_0x4ace15[_0xcb5b('0xa')]&&_0x4ace15[_0xcb5b('0xa')][_0xcb5b('0x15')](_0xcb5b('0x16'))>=0x0?!![]:![];})[_0xcb5b('0xc')](function(_0x34c9c8){logger[_0xcb5b('0x17')](_0xcb5b('0x18'),_0x840935,_0x313d47[_0x3976c9]);}));}BPromise[_0xcb5b('0x19')](_0x21325b)['then'](function(_0xc809c3){var _0x34650c=_['some'](_0xc809c3);logger[_0xcb5b('0xe')]('[%s][INTERVAL]\x20%s\x20%s',_0x840935,_0x313d47['join']('\x20|\x20'),_0x34650c);_0x1ba88c[_0xcb5b('0x1a')](_0x34650c);})[_0xcb5b('0xc')](function(_0x566489){console[_0xcb5b('0x1b')](_0x566489);logger[_0xcb5b('0x17')](_0xcb5b('0x1c'),_0x840935,_0x313d47[_0xcb5b('0x1d')](_0xcb5b('0x1e')),_0x566489['stack']);_0x1ba88c[_0xcb5b('0x10')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index b9df38f..06ba54b 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 _0xef81=['connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','timeout','reason','holdtime','ringtime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','talktime','diffTime','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','secondtransfererexten','transfertargetuniqueid','cause','rejected','indexOf','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','complete','[%s][agents][hangup]','util','./utils','info','format','queue','membername','calleridnum','lastevent','getVoiceQueueByName','type','agentacw','acw','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt'];(function(_0x2da57e,_0xf1f59c){var _0x2b5a2f=function(_0x43c70c){while(--_0x43c70c){_0x2da57e['push'](_0x2da57e['shift']());}};_0x2b5a2f(++_0xf1f59c);}(_0xef81,0x185));var _0x1ef8=function(_0x47e60d,_0x7acd67){_0x47e60d=_0x47e60d-0x0;var _0xe3e34d=_0xef81[_0x47e60d];return _0xe3e34d;};'use strict';var _=require('lodash');var util=require(_0x1ef8('0x0'));var utils=require(_0x1ef8('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x102eb3,_0x3d6cc5){utils[_0x1ef8('0x2')](util[_0x1ef8('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x102eb3['uniqueid'],_0x102eb3['channel'],_0x102eb3[_0x1ef8('0x4')],_0x102eb3[_0x1ef8('0x5')],_0x102eb3['interface'],_0x102eb3[_0x1ef8('0x6')],_0x102eb3['connectedlinenum'],_0x102eb3[_0x1ef8('0x7')]));if(_0x102eb3[_0x1ef8('0x4')]){utils[_0x1ef8('0x8')](_0x102eb3['queue'])['then'](function(_0x4083c0){if(_0x4083c0){_0x102eb3[_0x1ef8('0x9')]=_0x4083c0[_0x1ef8('0x9')];_0x102eb3[_0x1ef8('0xa')]=_0x102eb3['agentcomplete']?_0x4083c0[_0x1ef8('0xb')]:![];_0x102eb3['acwtime']=_0x102eb3['agentacw']?_0x4083c0[_0x1ef8('0xc')]:0x0;}utils[_0x1ef8('0xd')](_0x1ef8('0xe'),_0x102eb3);});}else{utils[_0x1ef8('0xd')](_0x1ef8('0xe'),_0x102eb3);}if(_0x3d6cc5){delete transfers[_0x102eb3[_0x1ef8('0xf')]];}else{delete agents[_0x102eb3[_0x1ef8('0x10')]];}}exports[_0x1ef8('0x11')]=function(_0x51403b){try{utils[_0x1ef8('0x12')](util['format'](_0x1ef8('0x13'),_0x51403b[_0x1ef8('0xf')]),_0x51403b);agents[_0x51403b[_0x1ef8('0x10')]]=_0x51403b;agents[_0x51403b['destuniqueid']][_0x1ef8('0x14')]=utils['now']();agents[_0x51403b[_0x1ef8('0x10')]]['lastevent']='called';agents[_0x51403b['destuniqueid']]['connectedlinenum']=null;agents[_0x51403b[_0x1ef8('0x10')]][_0x1ef8('0x15')]=null;utils[_0x1ef8('0x2')](util['format'](_0x1ef8('0x16'),_0x51403b['uniqueid'],agents[_0x51403b['destuniqueid']][_0x1ef8('0x5')],_0x51403b[_0x1ef8('0x10')]));}catch(_0x19746d){utils[_0x1ef8('0x17')](util['format']('[%s][agents][agentcalled]',_0x51403b[_0x1ef8('0xf')]),_0x19746d);}};exports[_0x1ef8('0x18')]=function(_0xf2b56a){try{if(!_[_0x1ef8('0x19')](agents[_0xf2b56a['destuniqueid']])){utils['debug'](util[_0x1ef8('0x3')](_0x1ef8('0x1a'),_0xf2b56a[_0x1ef8('0xf')]),_0xf2b56a);utils[_0x1ef8('0x2')](util[_0x1ef8('0x3')](_0x1ef8('0x1b'),_0xf2b56a[_0x1ef8('0xf')],agents[_0xf2b56a[_0x1ef8('0x10')]][_0x1ef8('0x5')],_0xf2b56a[_0x1ef8('0x10')]));agents[_0xf2b56a[_0x1ef8('0x10')]]['agentringnoanswer']=!![];agents[_0xf2b56a[_0x1ef8('0x10')]][_0x1ef8('0x1c')]=utils[_0x1ef8('0x1d')]();agents[_0xf2b56a[_0x1ef8('0x10')]][_0x1ef8('0x7')]=_0x1ef8('0x1e');agents[_0xf2b56a[_0x1ef8('0x10')]][_0x1ef8('0x1f')]=_0x1ef8('0x1e');agents[_0xf2b56a[_0x1ef8('0x10')]][_0x1ef8('0x20')]=_0xf2b56a['ringtime']?parseInt(_0xf2b56a[_0x1ef8('0x21')])/0x3e8:0x0;agents[_0xf2b56a['destuniqueid']]['talktime']=0x0;unanswered[_0x1ef8('0x22')](_0xf2b56a[_0x1ef8('0x10')]);}}catch(_0x4cf933){utils[_0x1ef8('0x17')](util[_0x1ef8('0x3')](_0x1ef8('0x1a'),_0xf2b56a[_0x1ef8('0xf')]),_0x4cf933);}};exports[_0x1ef8('0x23')]=function(_0x53e9da){try{_[_0x1ef8('0x24')](agents,function(_0x46d310,_0x59d7bb){if(_0x46d310[_0x1ef8('0xf')]==_0x53e9da[_0x1ef8('0xf')]&&!_[_0x1ef8('0x25')](unanswered,_0x46d310['destuniqueid'])){utils[_0x1ef8('0x12')](util['format'](_0x1ef8('0x26'),_0x53e9da[_0x1ef8('0xf')]),_0x53e9da);utils[_0x1ef8('0x2')](util[_0x1ef8('0x3')](_0x1ef8('0x27'),_0x53e9da['uniqueid'],_0x46d310[_0x1ef8('0x5')],_0x46d310[_0x1ef8('0x10')]));_0x46d310[_0x1ef8('0x18')]=!![];_0x46d310[_0x1ef8('0x1c')]=utils[_0x1ef8('0x1d')]();_0x46d310[_0x1ef8('0x7')]='abandoned';_0x46d310[_0x1ef8('0x1f')]=_0x1ef8('0x28');_0x46d310['holdtime']=_0x53e9da[_0x1ef8('0x20')];_0x46d310['talktime']=0x0;writeDB(_0x46d310);}});}catch(_0x134627){utils[_0x1ef8('0x17')](util[_0x1ef8('0x3')](_0x1ef8('0x26'),_0x53e9da[_0x1ef8('0xf')]),_0x134627);}};exports[_0x1ef8('0x29')]=function(_0x5ebb67){try{if(agents[_0x5ebb67[_0x1ef8('0x10')]]){utils[_0x1ef8('0x12')](util['format'](_0x1ef8('0x2a'),_0x5ebb67[_0x1ef8('0xf')]),_0x5ebb67);utils[_0x1ef8('0x2')](util[_0x1ef8('0x3')](_0x1ef8('0x2b'),_0x5ebb67[_0x1ef8('0xf')],agents[_0x5ebb67['destuniqueid']][_0x1ef8('0x5')],_0x5ebb67[_0x1ef8('0x10')]));agents[_0x5ebb67['destuniqueid']][_0x1ef8('0x2c')]=utils[_0x1ef8('0x1d')]();agents[_0x5ebb67[_0x1ef8('0x10')]]['connectedlinenum']=_0x5ebb67['connectedlinenum'];agents[_0x5ebb67[_0x1ef8('0x10')]]['connectedlinename']=_0x5ebb67['connectedlinename'];agents[_0x5ebb67[_0x1ef8('0x10')]][_0x1ef8('0x20')]=_0x5ebb67[_0x1ef8('0x21')];agents[_0x5ebb67[_0x1ef8('0x10')]][_0x1ef8('0x7')]=_0x1ef8('0x2d');_['forIn'](agents,function(_0x3bb336,_0x5aba46){if(_0x3bb336['destuniqueid']!=_0x5ebb67[_0x1ef8('0x10')]&&_0x3bb336[_0x1ef8('0xf')]==_0x5ebb67[_0x1ef8('0xf')]){_0x3bb336['talktime']=0x0;_0x3bb336[_0x1ef8('0x20')]=_0x5ebb67[_0x1ef8('0x21')];_0x3bb336['agentringnoanswer']=!![];_0x3bb336[_0x1ef8('0x1c')]=utils[_0x1ef8('0x1d')]();_0x3bb336['lastevent']=_0x1ef8('0x2e');_0x3bb336[_0x1ef8('0x1f')]=_0x1ef8('0x2e');_0x3bb336[_0x1ef8('0x2f')]=_0x5ebb67[_0x1ef8('0x10')];_0x3bb336['answeredelsewheremembername']=_0x5ebb67[_0x1ef8('0x5')];writeDB(_0x3bb336);}});}}catch(_0x47ac87){utils['error'](util['format']('[%s][agents][agentconnect]',_0x5ebb67[_0x1ef8('0xf')]),_0x47ac87);}};exports[_0x1ef8('0x30')]=function(_0x44dd3d){try{if(!_['isNil'](agents[_0x44dd3d['destuniqueid']])){utils[_0x1ef8('0x12')](util[_0x1ef8('0x3')](_0x1ef8('0x31'),_0x44dd3d[_0x1ef8('0xf')]),_0x44dd3d);utils[_0x1ef8('0x2')](util['format'](_0x1ef8('0x32'),_0x44dd3d[_0x1ef8('0xf')],agents[_0x44dd3d[_0x1ef8('0x10')]][_0x1ef8('0x5')],_0x44dd3d[_0x1ef8('0x10')]));agents[_0x44dd3d[_0x1ef8('0x10')]][_0x1ef8('0x30')]=!![];agents[_0x44dd3d['destuniqueid']][_0x1ef8('0x33')]=utils[_0x1ef8('0x1d')]();agents[_0x44dd3d[_0x1ef8('0x10')]][_0x1ef8('0x34')]=utils[_0x1ef8('0x35')](agents[_0x44dd3d[_0x1ef8('0x10')]][_0x1ef8('0x33')],agents[_0x44dd3d['destuniqueid']][_0x1ef8('0x2c')]);agents[_0x44dd3d[_0x1ef8('0x10')]][_0x1ef8('0x1f')]=_0x44dd3d[_0x1ef8('0x1f')];agents[_0x44dd3d[_0x1ef8('0x10')]]['lastevent']='complete';writeDB(agents[_0x44dd3d[_0x1ef8('0x10')]]);}}catch(_0x36e576){utils[_0x1ef8('0x17')](util['format'](_0x1ef8('0x31'),_0x44dd3d['uniqueid']),_0x36e576);}};exports['blindtransfer']=function(_0x5092f8){try{if(!_[_0x1ef8('0x19')](agents[_0x5092f8[_0x1ef8('0x36')]])){utils['debug'](util[_0x1ef8('0x3')](_0x1ef8('0x37'),_0x5092f8[_0x1ef8('0xf')]),_0x5092f8);utils[_0x1ef8('0x2')](util['format'](_0x1ef8('0x38'),_0x5092f8[_0x1ef8('0xf')],agents[_0x5092f8[_0x1ef8('0x36')]]['membername'],agents[_0x5092f8[_0x1ef8('0x36')]][_0x1ef8('0xf')]));agents[_0x5092f8['transfereruniqueid']][_0x1ef8('0x39')]=!![];agents[_0x5092f8[_0x1ef8('0x36')]][_0x1ef8('0x3a')]='blind';agents[_0x5092f8[_0x1ef8('0x36')]][_0x1ef8('0x3b')]=_0x5092f8['extension'];agents[_0x5092f8['transfereruniqueid']][_0x1ef8('0x3c')]=agents[_0x5092f8[_0x1ef8('0x36')]][_0x1ef8('0xf')];}}catch(_0x4173b0){utils[_0x1ef8('0x17')](util[_0x1ef8('0x3')](_0x1ef8('0x37'),_0x5092f8[_0x1ef8('0xf')]),_0x4173b0);}};exports[_0x1ef8('0x3d')]=function(_0x3089cf){try{utils[_0x1ef8('0x12')](util[_0x1ef8('0x3')](_0x1ef8('0x3e'),_0x3089cf[_0x1ef8('0x3f')]),_0x3089cf);if(_0x3089cf[_0x1ef8('0x3f')]==_0x3089cf['origtransfererlinkedid']){if(!_[_0x1ef8('0x19')](agents[_0x3089cf[_0x1ef8('0x40')]])){utils[_0x1ef8('0x2')](util[_0x1ef8('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x3089cf['origtransfereruniqueid'],agents[_0x3089cf[_0x1ef8('0x40')]]['membername']));agents[_0x3089cf[_0x1ef8('0x40')]][_0x1ef8('0x39')]=!![];agents[_0x3089cf[_0x1ef8('0x40')]][_0x1ef8('0x3a')]='ATTENDED';agents[_0x3089cf[_0x1ef8('0x40')]]['transferexten']=_0x3089cf[_0x1ef8('0x41')];agents[_0x3089cf['secondtransfereruniqueid']][_0x1ef8('0x3c')]=_0x3089cf['origtransfereruniqueid'];}if(_0x3089cf[_0x1ef8('0x42')]&&agents[_0x3089cf[_0x1ef8('0x42')]]){agents[_0x3089cf[_0x1ef8('0x42')]][_0x1ef8('0x43')]=0x1;transfers[_0x3089cf[_0x1ef8('0x42')]]=_[_0x1ef8('0x44')](agents[_0x3089cf[_0x1ef8('0x42')]]);transfers[_0x3089cf[_0x1ef8('0x42')]][_0x1ef8('0x6')]=agents[_0x3089cf[_0x1ef8('0x40')]]['calleridnum'];transfers[_0x3089cf[_0x1ef8('0x42')]][_0x1ef8('0x45')]=agents[_0x3089cf['secondtransfereruniqueid']][_0x1ef8('0x45')];transfers[_0x3089cf[_0x1ef8('0x42')]][_0x1ef8('0x14')]=utils[_0x1ef8('0x1d')]();transfers[_0x3089cf[_0x1ef8('0x42')]][_0x1ef8('0x2c')]=utils[_0x1ef8('0x1d')]();transfers[_0x3089cf[_0x1ef8('0x42')]][_0x1ef8('0x20')]=0x0;transfers[_0x3089cf[_0x1ef8('0x42')]][_0x1ef8('0x43')]=0x2;}}else if(_0x3089cf[_0x1ef8('0x40')]==_0x3089cf[_0x1ef8('0x46')]){if(!_[_0x1ef8('0x19')](agents[_0x3089cf[_0x1ef8('0x3f')]])){utils[_0x1ef8('0x2')](util[_0x1ef8('0x3')](_0x1ef8('0x47'),_0x3089cf['origtransfereruniqueid'],agents[_0x3089cf['origtransfereruniqueid']]['membername']));agents[_0x3089cf[_0x1ef8('0x3f')]]['transfer']=!![];agents[_0x3089cf[_0x1ef8('0x3f')]]['transfertype']=_0x1ef8('0x48');agents[_0x3089cf[_0x1ef8('0x3f')]][_0x1ef8('0x3b')]=_0x3089cf[_0x1ef8('0x49')];agents[_0x3089cf[_0x1ef8('0x3f')]][_0x1ef8('0x3c')]=_0x3089cf[_0x1ef8('0x40')];}if(_0x3089cf['transfertargetuniqueid']&&agents[_0x3089cf[_0x1ef8('0x4a')]]){agents[_0x3089cf['transfertargetuniqueid']][_0x1ef8('0x43')]=0x1;transfers[_0x3089cf[_0x1ef8('0x4a')]]=_['clone'](agents[_0x3089cf[_0x1ef8('0x4a')]]);transfers[_0x3089cf[_0x1ef8('0x4a')]][_0x1ef8('0x6')]=agents[_0x3089cf['origtransfereruniqueid']][_0x1ef8('0x6')];transfers[_0x3089cf[_0x1ef8('0x4a')]][_0x1ef8('0x45')]=agents[_0x3089cf[_0x1ef8('0x3f')]][_0x1ef8('0x45')];transfers[_0x3089cf[_0x1ef8('0x4a')]][_0x1ef8('0x14')]=utils[_0x1ef8('0x1d')]();transfers[_0x3089cf['transfertargetuniqueid']][_0x1ef8('0x2c')]=utils[_0x1ef8('0x1d')]();transfers[_0x3089cf[_0x1ef8('0x4a')]][_0x1ef8('0x20')]=0x0;transfers[_0x3089cf[_0x1ef8('0x4a')]][_0x1ef8('0x43')]=0x2;}}}catch(_0x4dae31){utils[_0x1ef8('0x17')](util[_0x1ef8('0x3')]('[%s][agents][attendedtransfer]',_0x3089cf[_0x1ef8('0x3f')]),_0x4dae31);}};exports['hangup']=function(_0x5a2bc8){try{utils[_0x1ef8('0x12')](util[_0x1ef8('0x3')]('[%s][agents][hangup]',_0x5a2bc8[_0x1ef8('0xf')]),_0x5a2bc8);if(agents[_0x5a2bc8[_0x1ef8('0xf')]]&&agents[_0x5a2bc8['uniqueid']][_0x1ef8('0x1f')]===_0x1ef8('0x1e')){if(_0x5a2bc8[_0x1ef8('0x4b')]==='21'){agents[_0x5a2bc8['uniqueid']][_0x1ef8('0x1f')]='rejected';agents[_0x5a2bc8[_0x1ef8('0xf')]]['lastevent']=_0x1ef8('0x4c');}utils[_0x1ef8('0x2')](util[_0x1ef8('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5a2bc8['uniqueid'],agents[_0x5a2bc8['uniqueid']][_0x1ef8('0x5')],agents[_0x5a2bc8['uniqueid']]['reason'],agents[_0x5a2bc8['uniqueid']][_0x1ef8('0x7')]));writeDB(agents[_0x5a2bc8[_0x1ef8('0xf')]]);var _0x10dd01=unanswered[_0x1ef8('0x4d')](_0x5a2bc8[_0x1ef8('0xf')]);if(_0x10dd01>-0x1){unanswered['splice'](_0x10dd01,0x1);}}if(transfers[_0x5a2bc8[_0x1ef8('0xf')]]){transfers[_0x5a2bc8['uniqueid']]['agentcomplete']=!![];transfers[_0x5a2bc8[_0x1ef8('0xf')]][_0x1ef8('0x33')]=utils[_0x1ef8('0x1d')]();transfers[_0x5a2bc8['uniqueid']][_0x1ef8('0x34')]=utils[_0x1ef8('0x35')](transfers[_0x5a2bc8[_0x1ef8('0xf')]][_0x1ef8('0x33')],transfers[_0x5a2bc8[_0x1ef8('0xf')]][_0x1ef8('0x2c')]);transfers[_0x5a2bc8['uniqueid']][_0x1ef8('0x1f')]=_0x1ef8('0x4e');transfers[_0x5a2bc8[_0x1ef8('0xf')]]['lastevent']='complete';utils[_0x1ef8('0x2')](util[_0x1ef8('0x3')](_0x1ef8('0x4f'),_0x5a2bc8['uniqueid'],transfers[_0x5a2bc8[_0x1ef8('0xf')]]['membername'],transfers[_0x5a2bc8['uniqueid']][_0x1ef8('0x1f')],transfers[_0x5a2bc8['uniqueid']][_0x1ef8('0x7')]));writeDB(transfers[_0x5a2bc8['uniqueid']],!![]);}if(agents[_0x5a2bc8['uniqueid']]&&agents[_0x5a2bc8['uniqueid']][_0x1ef8('0x2c')]){agents[_0x5a2bc8[_0x1ef8('0xf')]][_0x1ef8('0x30')]=!![];agents[_0x5a2bc8[_0x1ef8('0xf')]][_0x1ef8('0x33')]=utils[_0x1ef8('0x1d')]();agents[_0x5a2bc8['uniqueid']][_0x1ef8('0x34')]=utils[_0x1ef8('0x35')](agents[_0x5a2bc8[_0x1ef8('0xf')]]['agentcompleteAt'],agents[_0x5a2bc8[_0x1ef8('0xf')]]['agentconnectAt']);agents[_0x5a2bc8[_0x1ef8('0xf')]][_0x1ef8('0x1f')]=agents[_0x5a2bc8['uniqueid']][_0x1ef8('0x39')]?_0x1ef8('0x39'):_0x1ef8('0x4e');agents[_0x5a2bc8[_0x1ef8('0xf')]]['lastevent']=_0x1ef8('0x50');utils['info'](util['format'](_0x1ef8('0x4f'),_0x5a2bc8[_0x1ef8('0xf')],agents[_0x5a2bc8[_0x1ef8('0xf')]][_0x1ef8('0x5')],agents[_0x5a2bc8[_0x1ef8('0xf')]]['reason'],agents[_0x5a2bc8[_0x1ef8('0xf')]]['lastevent']));writeDB(agents[_0x5a2bc8[_0x1ef8('0xf')]]);}}catch(_0x357956){utils[_0x1ef8('0x17')](util['format'](_0x1ef8('0x51'),_0x5a2bc8[_0x1ef8('0xf')]),_0x357956);}}; \ No newline at end of file +var _0x7819=['forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','reason','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','blindtransfer','[%s][agents][blindtransfer]','transfereruniqueid','transfer','transfertype','blind','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','calleridnum','connectedlinenum','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','lastevent','connectedlinename','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','timeout','holdtime','ringtime','talktime','push','queuecallerabandon'];(function(_0x50e8ac,_0x3de22e){var _0x41a7b9=function(_0xa903d0){while(--_0xa903d0){_0x50e8ac['push'](_0x50e8ac['shift']());}};_0x41a7b9(++_0x3de22e);}(_0x7819,0x8a));var _0x9781=function(_0x46d04a,_0x1322ec){_0x46d04a=_0x46d04a-0x0;var _0xcc551d=_0x7819[_0x46d04a];return _0xcc551d;};'use strict';var _=require(_0x9781('0x0'));var util=require(_0x9781('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1cfde2,_0x44a1df){utils[_0x9781('0x2')](util[_0x9781('0x3')](_0x9781('0x4'),_0x1cfde2[_0x9781('0x5')],_0x1cfde2[_0x9781('0x6')],_0x1cfde2[_0x9781('0x7')],_0x1cfde2['membername'],_0x1cfde2['interface'],_0x1cfde2[_0x9781('0x8')],_0x1cfde2[_0x9781('0x9')],_0x1cfde2['lastevent']));if(_0x1cfde2['queue']){utils[_0x9781('0xa')](_0x1cfde2['queue'])['then'](function(_0x45fceb){if(_0x45fceb){_0x1cfde2[_0x9781('0xb')]=_0x45fceb['type'];_0x1cfde2[_0x9781('0xc')]=_0x1cfde2[_0x9781('0xd')]?_0x45fceb[_0x9781('0xe')]:![];_0x1cfde2[_0x9781('0xf')]=_0x1cfde2[_0x9781('0xc')]?_0x45fceb[_0x9781('0x10')]:0x0;}utils[_0x9781('0x11')](_0x9781('0x12'),_0x1cfde2);});}else{utils[_0x9781('0x11')](_0x9781('0x12'),_0x1cfde2);}if(_0x44a1df){delete transfers[_0x1cfde2[_0x9781('0x5')]];}else{delete agents[_0x1cfde2['destuniqueid']];}}exports[_0x9781('0x13')]=function(_0x260183){try{utils[_0x9781('0x14')](util['format'](_0x9781('0x15'),_0x260183[_0x9781('0x5')]),_0x260183);agents[_0x260183['destuniqueid']]=_0x260183;agents[_0x260183[_0x9781('0x16')]][_0x9781('0x17')]=utils[_0x9781('0x18')]();agents[_0x260183[_0x9781('0x16')]][_0x9781('0x19')]='called';agents[_0x260183['destuniqueid']][_0x9781('0x9')]=null;agents[_0x260183['destuniqueid']][_0x9781('0x1a')]=null;utils[_0x9781('0x2')](util[_0x9781('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x260183[_0x9781('0x5')],agents[_0x260183[_0x9781('0x16')]][_0x9781('0x1b')],_0x260183[_0x9781('0x16')]));}catch(_0x27f8d0){utils[_0x9781('0x1c')](util[_0x9781('0x3')]('[%s][agents][agentcalled]',_0x260183[_0x9781('0x5')]),_0x27f8d0);}};exports[_0x9781('0x1d')]=function(_0x252a7f){try{if(!_[_0x9781('0x1e')](agents[_0x252a7f['destuniqueid']])){utils['debug'](util[_0x9781('0x3')](_0x9781('0x1f'),_0x252a7f[_0x9781('0x5')]),_0x252a7f);utils[_0x9781('0x2')](util[_0x9781('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x252a7f[_0x9781('0x5')],agents[_0x252a7f[_0x9781('0x16')]][_0x9781('0x1b')],_0x252a7f[_0x9781('0x16')]));agents[_0x252a7f['destuniqueid']][_0x9781('0x1d')]=!![];agents[_0x252a7f[_0x9781('0x16')]]['agentringnoanswerAt']=utils[_0x9781('0x18')]();agents[_0x252a7f['destuniqueid']][_0x9781('0x19')]=_0x9781('0x20');agents[_0x252a7f[_0x9781('0x16')]]['reason']=_0x9781('0x20');agents[_0x252a7f[_0x9781('0x16')]][_0x9781('0x21')]=_0x252a7f['ringtime']?parseInt(_0x252a7f[_0x9781('0x22')])/0x3e8:0x0;agents[_0x252a7f[_0x9781('0x16')]][_0x9781('0x23')]=0x0;unanswered[_0x9781('0x24')](_0x252a7f[_0x9781('0x16')]);}}catch(_0x13066f){utils[_0x9781('0x1c')](util[_0x9781('0x3')](_0x9781('0x1f'),_0x252a7f[_0x9781('0x5')]),_0x13066f);}};exports[_0x9781('0x25')]=function(_0x3438f8){try{_[_0x9781('0x26')](agents,function(_0x3f31a6,_0x21e08b){if(_0x3f31a6[_0x9781('0x5')]==_0x3438f8[_0x9781('0x5')]&&!_[_0x9781('0x27')](unanswered,_0x3f31a6[_0x9781('0x16')])){utils['debug'](util[_0x9781('0x3')]('[%s][agents][queuecallerabandon]',_0x3438f8[_0x9781('0x5')]),_0x3438f8);utils[_0x9781('0x2')](util[_0x9781('0x3')](_0x9781('0x28'),_0x3438f8['uniqueid'],_0x3f31a6[_0x9781('0x1b')],_0x3f31a6[_0x9781('0x16')]));_0x3f31a6[_0x9781('0x1d')]=!![];_0x3f31a6[_0x9781('0x29')]=utils[_0x9781('0x18')]();_0x3f31a6[_0x9781('0x19')]='abandoned';_0x3f31a6['reason']=_0x9781('0x2a');_0x3f31a6[_0x9781('0x21')]=_0x3438f8['holdtime'];_0x3f31a6['talktime']=0x0;writeDB(_0x3f31a6);}});}catch(_0x48bada){utils[_0x9781('0x1c')](util['format'](_0x9781('0x2b'),_0x3438f8['uniqueid']),_0x48bada);}};exports[_0x9781('0x2c')]=function(_0x305893){try{if(agents[_0x305893[_0x9781('0x16')]]){utils[_0x9781('0x14')](util[_0x9781('0x3')](_0x9781('0x2d'),_0x305893[_0x9781('0x5')]),_0x305893);utils[_0x9781('0x2')](util['format'](_0x9781('0x2e'),_0x305893['uniqueid'],agents[_0x305893['destuniqueid']][_0x9781('0x1b')],_0x305893[_0x9781('0x16')]));agents[_0x305893[_0x9781('0x16')]][_0x9781('0x2f')]=utils[_0x9781('0x18')]();agents[_0x305893[_0x9781('0x16')]][_0x9781('0x9')]=_0x305893[_0x9781('0x9')];agents[_0x305893[_0x9781('0x16')]][_0x9781('0x1a')]=_0x305893[_0x9781('0x1a')];agents[_0x305893[_0x9781('0x16')]]['holdtime']=_0x305893['ringtime'];agents[_0x305893[_0x9781('0x16')]][_0x9781('0x19')]='connect';_[_0x9781('0x26')](agents,function(_0x399d5e,_0x3d229b){if(_0x399d5e[_0x9781('0x16')]!=_0x305893[_0x9781('0x16')]&&_0x399d5e[_0x9781('0x5')]==_0x305893[_0x9781('0x5')]){_0x399d5e[_0x9781('0x23')]=0x0;_0x399d5e['holdtime']=_0x305893[_0x9781('0x22')];_0x399d5e[_0x9781('0x1d')]=!![];_0x399d5e[_0x9781('0x29')]=utils[_0x9781('0x18')]();_0x399d5e[_0x9781('0x19')]=_0x9781('0x30');_0x399d5e[_0x9781('0x31')]='answered_elsewhere';_0x399d5e[_0x9781('0x32')]=_0x305893['destuniqueid'];_0x399d5e[_0x9781('0x33')]=_0x305893[_0x9781('0x1b')];writeDB(_0x399d5e);}});}}catch(_0x18bb45){utils[_0x9781('0x1c')](util['format'](_0x9781('0x2d'),_0x305893[_0x9781('0x5')]),_0x18bb45);}};exports[_0x9781('0xd')]=function(_0x48e699){try{if(!_[_0x9781('0x1e')](agents[_0x48e699['destuniqueid']])){utils['debug'](util[_0x9781('0x3')]('[%s][agents][agentcomplete]',_0x48e699[_0x9781('0x5')]),_0x48e699);utils[_0x9781('0x2')](util[_0x9781('0x3')](_0x9781('0x34'),_0x48e699['uniqueid'],agents[_0x48e699[_0x9781('0x16')]][_0x9781('0x1b')],_0x48e699['destuniqueid']));agents[_0x48e699['destuniqueid']]['agentcomplete']=!![];agents[_0x48e699[_0x9781('0x16')]][_0x9781('0x35')]=utils['now']();agents[_0x48e699['destuniqueid']][_0x9781('0x23')]=utils[_0x9781('0x36')](agents[_0x48e699[_0x9781('0x16')]][_0x9781('0x35')],agents[_0x48e699[_0x9781('0x16')]]['agentconnectAt']);agents[_0x48e699[_0x9781('0x16')]][_0x9781('0x31')]=_0x48e699[_0x9781('0x31')];agents[_0x48e699[_0x9781('0x16')]][_0x9781('0x19')]=_0x9781('0x37');writeDB(agents[_0x48e699[_0x9781('0x16')]]);}}catch(_0x37e955){utils[_0x9781('0x1c')](util[_0x9781('0x3')](_0x9781('0x38'),_0x48e699[_0x9781('0x5')]),_0x37e955);}};exports[_0x9781('0x39')]=function(_0x14ac68){try{if(!_[_0x9781('0x1e')](agents[_0x14ac68['transfereruniqueid']])){utils['debug'](util['format'](_0x9781('0x3a'),_0x14ac68[_0x9781('0x5')]),_0x14ac68);utils[_0x9781('0x2')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x14ac68['uniqueid'],agents[_0x14ac68[_0x9781('0x3b')]]['membername'],agents[_0x14ac68['transfereruniqueid']][_0x9781('0x5')]));agents[_0x14ac68['transfereruniqueid']][_0x9781('0x3c')]=!![];agents[_0x14ac68[_0x9781('0x3b')]][_0x9781('0x3d')]=_0x9781('0x3e');agents[_0x14ac68[_0x9781('0x3b')]]['transferexten']=_0x14ac68['extension'];agents[_0x14ac68['transfereruniqueid']][_0x9781('0x3f')]=agents[_0x14ac68[_0x9781('0x3b')]][_0x9781('0x5')];}}catch(_0x49a764){utils[_0x9781('0x1c')](util[_0x9781('0x3')]('[%s][agents][blindtransfer]',_0x14ac68['uniqueid']),_0x49a764);}};exports[_0x9781('0x40')]=function(_0x15a9b1){try{utils[_0x9781('0x14')](util['format'](_0x9781('0x41'),_0x15a9b1[_0x9781('0x42')]),_0x15a9b1);if(_0x15a9b1[_0x9781('0x42')]==_0x15a9b1[_0x9781('0x43')]){if(!_[_0x9781('0x1e')](agents[_0x15a9b1['secondtransfereruniqueid']])){utils[_0x9781('0x2')](util[_0x9781('0x3')](_0x9781('0x44'),_0x15a9b1[_0x9781('0x42')],agents[_0x15a9b1['secondtransfereruniqueid']]['membername']));agents[_0x15a9b1[_0x9781('0x45')]]['transfer']=!![];agents[_0x15a9b1[_0x9781('0x45')]][_0x9781('0x3d')]=_0x9781('0x46');agents[_0x15a9b1['secondtransfereruniqueid']][_0x9781('0x47')]=_0x15a9b1[_0x9781('0x48')];agents[_0x15a9b1['secondtransfereruniqueid']][_0x9781('0x3f')]=_0x15a9b1['origtransfereruniqueid'];}if(_0x15a9b1[_0x9781('0x49')]&&agents[_0x15a9b1['transfereeuniqueid']]){agents[_0x15a9b1['transfereeuniqueid']][_0x9781('0x4a')]=0x1;transfers[_0x15a9b1[_0x9781('0x49')]]=_[_0x9781('0x4b')](agents[_0x15a9b1[_0x9781('0x49')]]);transfers[_0x15a9b1[_0x9781('0x49')]][_0x9781('0x8')]=agents[_0x15a9b1['secondtransfereruniqueid']][_0x9781('0x8')];transfers[_0x15a9b1['transfereeuniqueid']]['calleridname']=agents[_0x15a9b1[_0x9781('0x45')]][_0x9781('0x4c')];transfers[_0x15a9b1[_0x9781('0x49')]][_0x9781('0x17')]=utils[_0x9781('0x18')]();transfers[_0x15a9b1[_0x9781('0x49')]][_0x9781('0x2f')]=utils['now']();transfers[_0x15a9b1['transfereeuniqueid']][_0x9781('0x21')]=0x0;transfers[_0x15a9b1[_0x9781('0x49')]][_0x9781('0x4a')]=0x2;}}else if(_0x15a9b1[_0x9781('0x45')]==_0x15a9b1[_0x9781('0x4d')]){if(!_['isNil'](agents[_0x15a9b1[_0x9781('0x42')]])){utils[_0x9781('0x2')](util[_0x9781('0x3')](_0x9781('0x44'),_0x15a9b1['origtransfereruniqueid'],agents[_0x15a9b1[_0x9781('0x42')]][_0x9781('0x1b')]));agents[_0x15a9b1[_0x9781('0x42')]][_0x9781('0x3c')]=!![];agents[_0x15a9b1['origtransfereruniqueid']]['transfertype']=_0x9781('0x46');agents[_0x15a9b1[_0x9781('0x42')]][_0x9781('0x47')]=_0x15a9b1[_0x9781('0x4e')];agents[_0x15a9b1[_0x9781('0x42')]]['transferuniqueid']=_0x15a9b1[_0x9781('0x45')];}if(_0x15a9b1[_0x9781('0x4f')]&&agents[_0x15a9b1[_0x9781('0x4f')]]){agents[_0x15a9b1[_0x9781('0x4f')]]['agententerreason']=0x1;transfers[_0x15a9b1['transfertargetuniqueid']]=_[_0x9781('0x4b')](agents[_0x15a9b1['transfertargetuniqueid']]);transfers[_0x15a9b1['transfertargetuniqueid']][_0x9781('0x8')]=agents[_0x15a9b1[_0x9781('0x42')]][_0x9781('0x8')];transfers[_0x15a9b1[_0x9781('0x4f')]][_0x9781('0x4c')]=agents[_0x15a9b1[_0x9781('0x42')]]['calleridname'];transfers[_0x15a9b1['transfertargetuniqueid']][_0x9781('0x17')]=utils['now']();transfers[_0x15a9b1['transfertargetuniqueid']][_0x9781('0x2f')]=utils['now']();transfers[_0x15a9b1[_0x9781('0x4f')]][_0x9781('0x21')]=0x0;transfers[_0x15a9b1[_0x9781('0x4f')]][_0x9781('0x4a')]=0x2;}}}catch(_0x614dec){utils[_0x9781('0x1c')](util[_0x9781('0x3')](_0x9781('0x41'),_0x15a9b1[_0x9781('0x42')]),_0x614dec);}};exports[_0x9781('0x50')]=function(_0x5515b7){try{utils[_0x9781('0x14')](util['format'](_0x9781('0x51'),_0x5515b7[_0x9781('0x5')]),_0x5515b7);if(agents[_0x5515b7[_0x9781('0x5')]]&&agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x31')]===_0x9781('0x20')){if(_0x5515b7[_0x9781('0x52')]==='21'){agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x31')]=_0x9781('0x53');agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x19')]='rejected';}utils[_0x9781('0x2')](util[_0x9781('0x3')](_0x9781('0x54'),_0x5515b7[_0x9781('0x5')],agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x1b')],agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x31')],agents[_0x5515b7['uniqueid']][_0x9781('0x19')]));writeDB(agents[_0x5515b7[_0x9781('0x5')]]);var _0x4f522f=unanswered[_0x9781('0x55')](_0x5515b7[_0x9781('0x5')]);if(_0x4f522f>-0x1){unanswered[_0x9781('0x56')](_0x4f522f,0x1);}}if(transfers[_0x5515b7[_0x9781('0x5')]]){transfers[_0x5515b7[_0x9781('0x5')]][_0x9781('0xd')]=!![];transfers[_0x5515b7[_0x9781('0x5')]][_0x9781('0x35')]=utils['now']();transfers[_0x5515b7['uniqueid']][_0x9781('0x23')]=utils['diffTime'](transfers[_0x5515b7[_0x9781('0x5')]][_0x9781('0x35')],transfers[_0x5515b7[_0x9781('0x5')]][_0x9781('0x2f')]);transfers[_0x5515b7[_0x9781('0x5')]][_0x9781('0x31')]=_0x9781('0x57');transfers[_0x5515b7[_0x9781('0x5')]][_0x9781('0x19')]='complete';utils[_0x9781('0x2')](util[_0x9781('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5515b7['uniqueid'],transfers[_0x5515b7[_0x9781('0x5')]][_0x9781('0x1b')],transfers[_0x5515b7[_0x9781('0x5')]][_0x9781('0x31')],transfers[_0x5515b7[_0x9781('0x5')]][_0x9781('0x19')]));writeDB(transfers[_0x5515b7[_0x9781('0x5')]],!![]);}if(agents[_0x5515b7[_0x9781('0x5')]]&&agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x2f')]){agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0xd')]=!![];agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x35')]=utils[_0x9781('0x18')]();agents[_0x5515b7['uniqueid']][_0x9781('0x23')]=utils['diffTime'](agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x35')],agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x2f')]);agents[_0x5515b7['uniqueid']][_0x9781('0x31')]=agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x3c')]?_0x9781('0x3c'):_0x9781('0x57');agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x19')]=_0x9781('0x37');utils[_0x9781('0x2')](util[_0x9781('0x3')](_0x9781('0x54'),_0x5515b7[_0x9781('0x5')],agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x1b')],agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x31')],agents[_0x5515b7[_0x9781('0x5')]][_0x9781('0x19')]));writeDB(agents[_0x5515b7[_0x9781('0x5')]]);}}catch(_0x16a871){utils[_0x9781('0x1c')](util[_0x9781('0x3')](_0x9781('0x51'),_0x5515b7[_0x9781('0x5')]),_0x16a871);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index b7f914b..66d1b57 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 _0x5d69=['[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','set','lastapplication','lodash','util','./utils','NO\x20ANSWER','FAILED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','calleridnum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','now','error','[%s][calls][newchannel]','debug','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','context','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','ANSWERED','[%s][calls][newstate]','callerid','cause-txt','endtime','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','secondtransfererchannel','userfield','transfertargetchannel'];(function(_0x24dc21,_0x47b28c){var _0x392c77=function(_0x3e55de){while(--_0x3e55de){_0x24dc21['push'](_0x24dc21['shift']());}};_0x392c77(++_0x47b28c);}(_0x5d69,0x1de));var _0x95d6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5d69[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x95d6('0x0'));var util=require(_0x95d6('0x1'));var utils=require(_0x95d6('0x2'));var dispositions=[_0x95d6('0x3'),_0x95d6('0x4'),_0x95d6('0x4'),'NO\x20ANSWER',_0x95d6('0x3'),_0x95d6('0x3'),'ANSWERED',_0x95d6('0x5'),_0x95d6('0x4'),_0x95d6('0x4'),'FAILED'];var channels={};function writeDB(_0x129c8b){utils[_0x95d6('0x6')](util[_0x95d6('0x7')](_0x95d6('0x8'),_0x129c8b[_0x95d6('0x9')],_0x129c8b['channel'],_0x129c8b[_0x95d6('0xa')],_0x129c8b[_0x95d6('0xb')],_0x129c8b[_0x95d6('0xc')],_0x129c8b[_0x95d6('0xd')],_0x129c8b['connectedlinenum'],_0x129c8b[_0x95d6('0xe')]));if(_0x129c8b[_0x95d6('0xf')]){utils[_0x95d6('0x10')](_0x129c8b[_0x95d6('0xf')])[_0x95d6('0x11')](function(_0x4d2902){if(_0x4d2902){_0x129c8b[_0x95d6('0x12')]=_0x4d2902['id'];}utils[_0x95d6('0x13')]('CreateVoiceCallReport',_0x129c8b);});}else{utils[_0x95d6('0x13')](_0x95d6('0x14'),_0x129c8b);}if(channels[_0x129c8b[_0x95d6('0x9')]]){delete channels[_0x129c8b[_0x95d6('0x9')]];}}exports[_0x95d6('0x15')]=function(_0x58a807){try{utils['debug'](util[_0x95d6('0x7')]('[%s][calls][newchannel]',_0x58a807['uniqueid']),_0x58a807);if(_0x58a807[_0x95d6('0x9')]==_0x58a807[_0x95d6('0x16')]&&_0x58a807[_0x95d6('0x17')]!=_0x95d6('0x18')){utils['info'](util['format'](_0x95d6('0x19'),_0x58a807['uniqueid'],_0x58a807['context'],_0x58a807['exten']));channels[_0x58a807[_0x95d6('0x9')]]={'uniqueid':_0x58a807[_0x95d6('0x9')],'accountcode':_0x58a807[_0x95d6('0xf')],'source':_0x58a807[_0x95d6('0xd')],'destination':_0x58a807[_0x95d6('0x1a')],'destinationcontext':_0x58a807['context'],'channel':_0x58a807[_0x95d6('0x17')],'starttime':utils[_0x95d6('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x179015){utils[_0x95d6('0x1c')](util['format'](_0x95d6('0x1d'),_0x58a807[_0x95d6('0x9')]),_0x179015);}};exports['newstate']=function(_0x6e96b5){try{utils[_0x95d6('0x1e')](util['format']('[%s][calls][newstate]',_0x6e96b5['uniqueid']),_0x6e96b5);if(!_[_0x95d6('0x1f')](channels[_0x6e96b5[_0x95d6('0x9')]])&&_0x6e96b5[_0x95d6('0x20')]==0x6){utils[_0x95d6('0x6')](util[_0x95d6('0x7')](_0x95d6('0x21'),_0x6e96b5[_0x95d6('0x9')],_0x6e96b5['context'],_0x6e96b5[_0x95d6('0x17')]));if(_[_0x95d6('0x1f')](channels[_0x6e96b5[_0x95d6('0x9')]][_0x95d6('0x22')])){channels[_0x6e96b5[_0x95d6('0x9')]][_0x95d6('0x22')]=utils[_0x95d6('0x1b')]();}}else if(!_[_0x95d6('0x1f')](channels[_0x6e96b5[_0x95d6('0x16')]])&&_0x6e96b5['channelstate']==0x6&&_0x6e96b5[_0x95d6('0x23')]!=_0x95d6('0x24')){utils[_0x95d6('0x6')](util[_0x95d6('0x7')](_0x95d6('0x25'),_0x6e96b5[_0x95d6('0x9')],_0x6e96b5[_0x95d6('0x16')],_0x6e96b5[_0x95d6('0x23')],_0x6e96b5[_0x95d6('0x17')]));channels[_0x6e96b5[_0x95d6('0x16')]][_0x95d6('0xf')]=_0x6e96b5[_0x95d6('0xf')];channels[_0x6e96b5['linkedid']][_0x95d6('0x26')]=_0x6e96b5['channel'];if(_['isNil'](channels[_0x6e96b5[_0x95d6('0x16')]][_0x95d6('0x27')])){channels[_0x6e96b5[_0x95d6('0x16')]][_0x95d6('0x27')]=utils[_0x95d6('0x1b')]();}channels[_0x6e96b5[_0x95d6('0x16')]][_0x95d6('0x28')]=dispositions[_['toNumber'](_0x6e96b5['channelstate'])]||_0x95d6('0x29');}}catch(_0x5d1860){utils[_0x95d6('0x1c')](util[_0x95d6('0x7')](_0x95d6('0x2a'),_0x6e96b5[_0x95d6('0x9')]),_0x5d1860);}};exports['hangup']=function(_0x35ef17){try{if(!_[_0x95d6('0x1f')](channels[_0x35ef17[_0x95d6('0x9')]])){utils['debug'](util['format']('[%s][calls][hangup]',_0x35ef17[_0x95d6('0x9')]),_0x35ef17);if(_[_0x95d6('0x1f')](channels[_0x35ef17['uniqueid']][_0x95d6('0x2b')])){channels[_0x35ef17[_0x95d6('0x9')]][_0x95d6('0x2b')]=_0x35ef17['calleridname']+'\x20<'+_0x35ef17[_0x95d6('0xd')]+'>';}utils['info'](util[_0x95d6('0x7')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x35ef17[_0x95d6('0x9')],channels[_0x35ef17[_0x95d6('0x9')]]['callerid'],_0x35ef17[_0x95d6('0x2c')]));channels[_0x35ef17[_0x95d6('0x9')]][_0x95d6('0x2d')]=utils[_0x95d6('0x1b')]();channels[_0x35ef17[_0x95d6('0x9')]]['duration']=utils[_0x95d6('0x2e')](channels[_0x35ef17[_0x95d6('0x9')]][_0x95d6('0x2d')],channels[_0x35ef17[_0x95d6('0x9')]][_0x95d6('0x2f')]);channels[_0x35ef17[_0x95d6('0x9')]][_0x95d6('0x30')]=channels[_0x35ef17['uniqueid']][_0x95d6('0x27')]?utils[_0x95d6('0x2e')](channels[_0x35ef17[_0x95d6('0x9')]][_0x95d6('0x2d')],channels[_0x35ef17[_0x95d6('0x9')]][_0x95d6('0x27')]):0x0;writeDB(channels[_0x35ef17[_0x95d6('0x9')]]);}}catch(_0x52997b){utils[_0x95d6('0x1c')](util[_0x95d6('0x7')](_0x95d6('0x31'),_0x35ef17[_0x95d6('0x9')]),_0x52997b);}};exports[_0x95d6('0x32')]=function(_0xc3beff){try{if(!_[_0x95d6('0x1f')](channels[_0xc3beff['localtwolinkedid']])){utils['debug'](util['format'](_0x95d6('0x33'),_0xc3beff[_0x95d6('0x34')]),_0xc3beff);if(channels[_0xc3beff[_0x95d6('0x35')]][_0x95d6('0x17')]==_0xc3beff['transfereechannel']){utils[_0x95d6('0x6')](util[_0x95d6('0x7')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0xc3beff[_0x95d6('0x34')],_0xc3beff[_0x95d6('0x35')],_0xc3beff[_0x95d6('0x36')]));channels[_0xc3beff['localtwolinkedid']][_0x95d6('0x26')]=_0xc3beff[_0x95d6('0x36')];channels[_0xc3beff['localtwolinkedid']][_0x95d6('0x37')]='_attended';}else if(channels[_0xc3beff[_0x95d6('0x35')]][_0x95d6('0x17')]=_0xc3beff[_0x95d6('0x38')]){utils[_0x95d6('0x6')](util[_0x95d6('0x7')](_0x95d6('0x39'),_0xc3beff['origtransfereruniqueid'],_0xc3beff['localtwolinkedid'],_0xc3beff[_0x95d6('0x3a')]));channels[_0xc3beff['localtwolinkedid']][_0x95d6('0x26')]=_0xc3beff[_0x95d6('0x3a')];channels[_0xc3beff[_0x95d6('0x35')]][_0x95d6('0x37')]='_attended';}}}catch(_0x432db0){utils[_0x95d6('0x1c')](util['format'](_0x95d6('0x33'),_0xc3beff[_0x95d6('0x34')]),_0x432db0);}};exports[_0x95d6('0x3b')]=function(_0x216ad9){try{if(!_['isNil'](channels[_0x216ad9[_0x95d6('0x9')]])){utils[_0x95d6('0x1e')](util[_0x95d6('0x7')](_0x95d6('0x3c'),_0x216ad9[_0x95d6('0x9')]),_0x216ad9);channels[_0x216ad9['uniqueid']][_0x95d6('0x3d')]=utils['now']();utils[_0x95d6('0x6')](util[_0x95d6('0x7')](_0x95d6('0x3e'),_0x216ad9[_0x95d6('0x9')],channels[_0x216ad9['uniqueid']][_0x95d6('0x3d')]));}}catch(_0x2aefd0){utils[_0x95d6('0x1c')](util[_0x95d6('0x7')](_0x95d6('0x3c'),_0x216ad9['uniqueid']),_0x2aefd0);}};exports[_0x95d6('0x3f')]=function(_0x1a8256){try{if(!_[_0x95d6('0x1f')](channels[_0x1a8256['uniqueid']])){utils[_0x95d6('0x1e')](util[_0x95d6('0x7')]('[%s][calls][musiconholdstop]',_0x1a8256[_0x95d6('0x9')]),_0x1a8256);if(!_[_0x95d6('0x1f')](channels[_0x1a8256[_0x95d6('0x9')]][_0x95d6('0x3d')])){channels[_0x1a8256[_0x95d6('0x9')]][_0x95d6('0x40')]+=utils[_0x95d6('0x2e')](utils[_0x95d6('0x1b')](),channels[_0x1a8256[_0x95d6('0x9')]][_0x95d6('0x3d')]);utils[_0x95d6('0x6')](util[_0x95d6('0x7')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x1a8256[_0x95d6('0x9')],channels[_0x1a8256[_0x95d6('0x9')]][_0x95d6('0x40')]));delete channels[_0x1a8256[_0x95d6('0x9')]]['musiconholdstartAt'];}}}catch(_0x1a8bb8){utils[_0x95d6('0x1c')](util[_0x95d6('0x7')](_0x95d6('0x41'),_0x1a8256[_0x95d6('0x9')]),_0x1a8bb8);}};exports[_0x95d6('0x42')]=function(_0x3af33d){try{if(!_[_0x95d6('0x1f')](channels[_0x3af33d[_0x95d6('0x9')]])){utils['debug'](util[_0x95d6('0x7')](_0x95d6('0x43'),_0x3af33d['uniqueid']),_0x3af33d);if(!_[_0x95d6('0x1f')](_0x3af33d[_0x95d6('0x44')][_0x95d6('0x45')])){utils['info'](util['format'](_0x95d6('0x46'),_0x3af33d['uniqueid'],_0x3af33d['value']));channels[_0x3af33d[_0x95d6('0x9')]][_0x95d6('0x47')]=_0x3af33d['value'];}if(!_[_0x95d6('0x1f')](_0x3af33d[_0x95d6('0x44')]['xmd-phone'])){utils[_0x95d6('0x6')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x3af33d[_0x95d6('0x9')],_0x3af33d[_0x95d6('0x48')]));channels[_0x3af33d[_0x95d6('0x9')]][_0x95d6('0x49')]=_0x3af33d[_0x95d6('0x48')];channels[_0x3af33d[_0x95d6('0x9')]][_0x95d6('0x2b')]='\x22'+_0x3af33d[_0x95d6('0x48')]+_0x95d6('0x4a')+_0x3af33d[_0x95d6('0x48')]+'>';}if(!_['isNil'](_0x3af33d['variable']['xmd-callerid-preview'])||!_[_0x95d6('0x1f')](_0x3af33d[_0x95d6('0x44')][_0x95d6('0x4b')])){utils[_0x95d6('0x6')](util[_0x95d6('0x7')](_0x95d6('0x4c'),_0x3af33d[_0x95d6('0x9')],!_[_0x95d6('0x1f')](_0x3af33d[_0x95d6('0x44')][_0x95d6('0x4d')])?_0x95d6('0x4d'):'xmd-callerid',_0x3af33d['value']));channels[_0x3af33d[_0x95d6('0x9')]][_0x95d6('0x2b')]=_0x3af33d[_0x95d6('0x48')];}if(!_[_0x95d6('0x1f')](_0x3af33d[_0x95d6('0x44')][_0x95d6('0x4e')])||!_[_0x95d6('0x1f')](_0x3af33d[_0x95d6('0x44')]['xmcs-queue'])){utils['info'](util[_0x95d6('0x7')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x3af33d[_0x95d6('0x9')],!_[_0x95d6('0x1f')](_0x3af33d['variable'][_0x95d6('0x4e')])?_0x95d6('0x4e'):_0x95d6('0x4f'),_0x3af33d[_0x95d6('0x48')]));channels[_0x3af33d[_0x95d6('0x9')]]['lastapplication']=_0x95d6('0x50');channels[_0x3af33d['uniqueid']][_0x95d6('0x51')]=_0x3af33d[_0x95d6('0x48')];channels[_0x3af33d[_0x95d6('0x9')]][_0x95d6('0xa')]=!![];}if(!_[_0x95d6('0x1f')](_0x3af33d[_0x95d6('0x44')][_0x95d6('0x52')])){utils[_0x95d6('0x6')](util['format'](_0x95d6('0x53'),_0x3af33d['uniqueid'],_0x3af33d[_0x95d6('0x48')]));channels[_0x3af33d[_0x95d6('0x9')]][_0x95d6('0x54')]=_0x3af33d[_0x95d6('0x48')];}if(!_[_0x95d6('0x1f')](_0x3af33d[_0x95d6('0x44')]['xmd-cdrtype'])){utils[_0x95d6('0x6')](util[_0x95d6('0x7')](_0x95d6('0x55'),_0x3af33d[_0x95d6('0x9')],_0x3af33d[_0x95d6('0x48')]));channels[_0x3af33d['uniqueid']][_0x95d6('0x56')]=_0x3af33d[_0x95d6('0x48')];}if(!_[_0x95d6('0x1f')](_0x3af33d[_0x95d6('0x44')]['outboundrouteid'])){utils[_0x95d6('0x6')](util[_0x95d6('0x7')](_0x95d6('0x57'),_0x3af33d[_0x95d6('0x9')],_0x3af33d[_0x95d6('0x48')]));channels[_0x3af33d[_0x95d6('0x9')]][_0x95d6('0x58')]=_0x3af33d[_0x95d6('0x48')];}if(!_[_0x95d6('0x1f')](_0x3af33d[_0x95d6('0x44')][_0x95d6('0x59')])){utils[_0x95d6('0x6')](util['format']('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x3af33d[_0x95d6('0x9')],_0x3af33d[_0x95d6('0x48')]));channels[_0x3af33d['uniqueid']][_0x95d6('0x59')]=_0x3af33d[_0x95d6('0x48')];}}}catch(_0x32f4db){utils[_0x95d6('0x1c')](util[_0x95d6('0x7')]('[%s][calls][varset]',_0x3af33d[_0x95d6('0x9')]),_0x32f4db);}};exports[_0x95d6('0x5a')]=function(_0x3fdf58){try{if(!_['isNil'](channels[_0x3fdf58[_0x95d6('0x9')]])){utils[_0x95d6('0x1e')](util[_0x95d6('0x7')](_0x95d6('0x5b'),_0x3fdf58['uniqueid']),_0x3fdf58);utils['info'](util[_0x95d6('0x7')](_0x95d6('0x5c'),_0x3fdf58['uniqueid'],_0x3fdf58['application'],_0x3fdf58[_0x95d6('0x5d')]));if(_0x3fdf58[_0x95d6('0x5e')][_0x95d6('0x5f')]()=='set'&&_[_0x95d6('0x60')](_0x3fdf58[_0x95d6('0x5d')][_0x95d6('0x5f')](),_0x95d6('0x61'))){var _0x24872d=_0x3fdf58[_0x95d6('0x5d')][_0x95d6('0x62')]('=');var _0x2fd2db=_0x24872d[0x0][_0x95d6('0x63')](_0x24872d[0x0]['lastIndexOf']('(')+0x1,_0x24872d[0x0][_0x95d6('0x64')](')'));var _0x3c38c1=_0x24872d[0x1];channels[_0x3fdf58[_0x95d6('0x9')]][_0x2fd2db]=_0x3c38c1;}if(!_[_0x95d6('0x65')]([_0x95d6('0x66'),_0x95d6('0x67'),_0x95d6('0x68'),_0x95d6('0x69'),'gotoif'],_0x3fdf58[_0x95d6('0x5e')][_0x95d6('0x5f')]())){channels[_0x3fdf58[_0x95d6('0x9')]][_0x95d6('0x6a')]=_0x3fdf58['application'];channels[_0x3fdf58[_0x95d6('0x9')]][_0x95d6('0x51')]=_0x3fdf58[_0x95d6('0x5d')];}}}catch(_0x4220e7){utils[_0x95d6('0x1c')](util['format'](_0x95d6('0x5b'),_0x3fdf58[_0x95d6('0x9')]),_0x4220e7);}}; \ No newline at end of file +var _0xeb36=['calleridnum','getUserByInternal','accountcode','then','UserId','request','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','[%s][calls][newchannel]','newstate','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','error','[%s][calls][newstate]','hangup','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','_attended','origtransfererchannel','userfield','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','includes','noop','execif','set','[%s][calls][newexten]','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface'];(function(_0x4cf477,_0x5cc807){var _0x22e59e=function(_0x21f0cc){while(--_0x21f0cc){_0x4cf477['push'](_0x4cf477['shift']());}};_0x22e59e(++_0x5cc807);}(_0xeb36,0xc1));var _0x6eb3=function(_0x42f7d0,_0x49438e){_0x42f7d0=_0x42f7d0-0x0;var _0x1b2a20=_0xeb36[_0x42f7d0];return _0x1b2a20;};'use strict';var _=require(_0x6eb3('0x0'));var util=require(_0x6eb3('0x1'));var utils=require(_0x6eb3('0x2'));var dispositions=[_0x6eb3('0x3'),_0x6eb3('0x4'),'FAILED',_0x6eb3('0x3'),_0x6eb3('0x3'),'NO\x20ANSWER',_0x6eb3('0x5'),_0x6eb3('0x6'),_0x6eb3('0x4'),'FAILED',_0x6eb3('0x4')];var channels={};function writeDB(_0x5181af){utils[_0x6eb3('0x7')](util[_0x6eb3('0x8')](_0x6eb3('0x9'),_0x5181af[_0x6eb3('0xa')],_0x5181af[_0x6eb3('0xb')],_0x5181af[_0x6eb3('0xc')],_0x5181af[_0x6eb3('0xd')],_0x5181af[_0x6eb3('0xe')],_0x5181af[_0x6eb3('0xf')],_0x5181af['connectedlinenum'],_0x5181af['lastevent']));if(_0x5181af['accountcode']){utils[_0x6eb3('0x10')](_0x5181af[_0x6eb3('0x11')])[_0x6eb3('0x12')](function(_0x246290){if(_0x246290){_0x5181af[_0x6eb3('0x13')]=_0x246290['id'];}utils[_0x6eb3('0x14')]('CreateVoiceCallReport',_0x5181af);});}else{utils[_0x6eb3('0x14')]('CreateVoiceCallReport',_0x5181af);}if(channels[_0x5181af[_0x6eb3('0xa')]]){delete channels[_0x5181af['uniqueid']];}}exports['newchannel']=function(_0x2831ce){try{utils[_0x6eb3('0x15')](util[_0x6eb3('0x8')]('[%s][calls][newchannel]',_0x2831ce[_0x6eb3('0xa')]),_0x2831ce);if(_0x2831ce[_0x6eb3('0xa')]==_0x2831ce[_0x6eb3('0x16')]&&_0x2831ce[_0x6eb3('0xb')]!=_0x6eb3('0x17')){utils['info'](util[_0x6eb3('0x8')](_0x6eb3('0x18'),_0x2831ce['uniqueid'],_0x2831ce[_0x6eb3('0x19')],_0x2831ce['exten']));channels[_0x2831ce[_0x6eb3('0xa')]]={'uniqueid':_0x2831ce[_0x6eb3('0xa')],'accountcode':_0x2831ce[_0x6eb3('0x11')],'source':_0x2831ce['calleridnum'],'destination':_0x2831ce[_0x6eb3('0x1a')],'destinationcontext':_0x2831ce[_0x6eb3('0x19')],'channel':_0x2831ce[_0x6eb3('0xb')],'starttime':utils[_0x6eb3('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x27d8c3){utils['error'](util[_0x6eb3('0x8')](_0x6eb3('0x1c'),_0x2831ce[_0x6eb3('0xa')]),_0x27d8c3);}};exports[_0x6eb3('0x1d')]=function(_0x3bb8e5){try{utils[_0x6eb3('0x15')](util[_0x6eb3('0x8')]('[%s][calls][newstate]',_0x3bb8e5[_0x6eb3('0xa')]),_0x3bb8e5);if(!_['isNil'](channels[_0x3bb8e5[_0x6eb3('0xa')]])&&_0x3bb8e5[_0x6eb3('0x1e')]==0x6){utils[_0x6eb3('0x7')](util[_0x6eb3('0x8')](_0x6eb3('0x1f'),_0x3bb8e5[_0x6eb3('0xa')],_0x3bb8e5['context'],_0x3bb8e5[_0x6eb3('0xb')]));if(_[_0x6eb3('0x20')](channels[_0x3bb8e5[_0x6eb3('0xa')]][_0x6eb3('0x21')])){channels[_0x3bb8e5['uniqueid']][_0x6eb3('0x21')]=utils[_0x6eb3('0x1b')]();}}else if(!_[_0x6eb3('0x20')](channels[_0x3bb8e5[_0x6eb3('0x16')]])&&_0x3bb8e5[_0x6eb3('0x1e')]==0x6&&_0x3bb8e5[_0x6eb3('0x19')]!=_0x6eb3('0x22')){utils['info'](util[_0x6eb3('0x8')](_0x6eb3('0x23'),_0x3bb8e5[_0x6eb3('0xa')],_0x3bb8e5[_0x6eb3('0x16')],_0x3bb8e5['context'],_0x3bb8e5['channel']));channels[_0x3bb8e5[_0x6eb3('0x16')]]['accountcode']=_0x3bb8e5[_0x6eb3('0x11')];channels[_0x3bb8e5[_0x6eb3('0x16')]]['destinationchannel']=_0x3bb8e5[_0x6eb3('0xb')];if(_[_0x6eb3('0x20')](channels[_0x3bb8e5['linkedid']]['answertime'])){channels[_0x3bb8e5['linkedid']][_0x6eb3('0x24')]=utils[_0x6eb3('0x1b')]();}channels[_0x3bb8e5[_0x6eb3('0x16')]][_0x6eb3('0x25')]=dispositions[_[_0x6eb3('0x26')](_0x3bb8e5[_0x6eb3('0x1e')])]||'ANSWERED';}}catch(_0x312d8e){utils[_0x6eb3('0x27')](util[_0x6eb3('0x8')](_0x6eb3('0x28'),_0x3bb8e5['uniqueid']),_0x312d8e);}};exports[_0x6eb3('0x29')]=function(_0x4b0d98){try{if(!_[_0x6eb3('0x20')](channels[_0x4b0d98[_0x6eb3('0xa')]])){utils[_0x6eb3('0x15')](util[_0x6eb3('0x8')]('[%s][calls][hangup]',_0x4b0d98['uniqueid']),_0x4b0d98);if(_[_0x6eb3('0x20')](channels[_0x4b0d98['uniqueid']][_0x6eb3('0x2a')])){channels[_0x4b0d98[_0x6eb3('0xa')]][_0x6eb3('0x2a')]=_0x4b0d98[_0x6eb3('0x2b')]+'\x20<'+_0x4b0d98['calleridnum']+'>';}utils['info'](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x4b0d98['uniqueid'],channels[_0x4b0d98[_0x6eb3('0xa')]][_0x6eb3('0x2a')],_0x4b0d98[_0x6eb3('0x2c')]));channels[_0x4b0d98[_0x6eb3('0xa')]][_0x6eb3('0x2d')]=utils[_0x6eb3('0x1b')]();channels[_0x4b0d98[_0x6eb3('0xa')]][_0x6eb3('0x2e')]=utils[_0x6eb3('0x2f')](channels[_0x4b0d98[_0x6eb3('0xa')]][_0x6eb3('0x2d')],channels[_0x4b0d98[_0x6eb3('0xa')]][_0x6eb3('0x30')]);channels[_0x4b0d98[_0x6eb3('0xa')]]['billableseconds']=channels[_0x4b0d98['uniqueid']]['answertime']?utils['diffTime'](channels[_0x4b0d98['uniqueid']][_0x6eb3('0x2d')],channels[_0x4b0d98[_0x6eb3('0xa')]]['answertime']):0x0;writeDB(channels[_0x4b0d98[_0x6eb3('0xa')]]);}}catch(_0x303b8e){utils[_0x6eb3('0x27')](util['format'](_0x6eb3('0x31'),_0x4b0d98['uniqueid']),_0x303b8e);}};exports[_0x6eb3('0x32')]=function(_0x1a1ddd){try{if(!_['isNil'](channels[_0x1a1ddd[_0x6eb3('0x33')]])){utils[_0x6eb3('0x15')](util[_0x6eb3('0x8')]('[%s][calls][attendedtransfer]',_0x1a1ddd[_0x6eb3('0x34')]),_0x1a1ddd);if(channels[_0x1a1ddd['localtwolinkedid']]['channel']==_0x1a1ddd['transfereechannel']){utils['info'](util['format'](_0x6eb3('0x35'),_0x1a1ddd[_0x6eb3('0x34')],_0x1a1ddd[_0x6eb3('0x33')],_0x1a1ddd[_0x6eb3('0x36')]));channels[_0x1a1ddd[_0x6eb3('0x33')]][_0x6eb3('0x37')]=_0x1a1ddd[_0x6eb3('0x36')];channels[_0x1a1ddd[_0x6eb3('0x33')]]['userfield']=_0x6eb3('0x38');}else if(channels[_0x1a1ddd[_0x6eb3('0x33')]]['channel']=_0x1a1ddd['transfertargetchannel']){utils['info'](util[_0x6eb3('0x8')](_0x6eb3('0x35'),_0x1a1ddd[_0x6eb3('0x34')],_0x1a1ddd[_0x6eb3('0x33')],_0x1a1ddd[_0x6eb3('0x39')]));channels[_0x1a1ddd[_0x6eb3('0x33')]][_0x6eb3('0x37')]=_0x1a1ddd[_0x6eb3('0x39')];channels[_0x1a1ddd[_0x6eb3('0x33')]][_0x6eb3('0x3a')]=_0x6eb3('0x38');}}}catch(_0x3b2562){utils[_0x6eb3('0x27')](util[_0x6eb3('0x8')]('[%s][calls][attendedtransfer]',_0x1a1ddd[_0x6eb3('0x34')]),_0x3b2562);}};exports[_0x6eb3('0x3b')]=function(_0x509da8){try{if(!_[_0x6eb3('0x20')](channels[_0x509da8[_0x6eb3('0xa')]])){utils['debug'](util['format']('[%s][calls][musiconholdstart]',_0x509da8[_0x6eb3('0xa')]),_0x509da8);channels[_0x509da8[_0x6eb3('0xa')]][_0x6eb3('0x3c')]=utils[_0x6eb3('0x1b')]();utils[_0x6eb3('0x7')](util['format'](_0x6eb3('0x3d'),_0x509da8[_0x6eb3('0xa')],channels[_0x509da8[_0x6eb3('0xa')]][_0x6eb3('0x3c')]));}}catch(_0x32521b){utils[_0x6eb3('0x27')](util[_0x6eb3('0x8')]('[%s][calls][musiconholdstart]',_0x509da8[_0x6eb3('0xa')]),_0x32521b);}};exports[_0x6eb3('0x3e')]=function(_0x55228d){try{if(!_[_0x6eb3('0x20')](channels[_0x55228d[_0x6eb3('0xa')]])){utils[_0x6eb3('0x15')](util['format'](_0x6eb3('0x3f'),_0x55228d['uniqueid']),_0x55228d);if(!_[_0x6eb3('0x20')](channels[_0x55228d[_0x6eb3('0xa')]][_0x6eb3('0x3c')])){channels[_0x55228d[_0x6eb3('0xa')]]['mohtime']+=utils[_0x6eb3('0x2f')](utils[_0x6eb3('0x1b')](),channels[_0x55228d[_0x6eb3('0xa')]][_0x6eb3('0x3c')]);utils[_0x6eb3('0x7')](util[_0x6eb3('0x8')](_0x6eb3('0x40'),_0x55228d['uniqueid'],channels[_0x55228d[_0x6eb3('0xa')]]['mohtime']));delete channels[_0x55228d[_0x6eb3('0xa')]]['musiconholdstartAt'];}}}catch(_0x4ac69f){utils[_0x6eb3('0x27')](util[_0x6eb3('0x8')](_0x6eb3('0x3f'),_0x55228d[_0x6eb3('0xa')]),_0x4ac69f);}};exports['varset']=function(_0x578802){try{if(!_['isNil'](channels[_0x578802['uniqueid']])){utils[_0x6eb3('0x15')](util['format'](_0x6eb3('0x41'),_0x578802[_0x6eb3('0xa')]),_0x578802);if(!_[_0x6eb3('0x20')](_0x578802[_0x6eb3('0x42')][_0x6eb3('0x43')])){utils[_0x6eb3('0x7')](util[_0x6eb3('0x8')](_0x6eb3('0x44'),_0x578802[_0x6eb3('0xa')],_0x578802['value']));channels[_0x578802['uniqueid']][_0x6eb3('0x45')]=_0x578802[_0x6eb3('0x46')];}if(!_['isNil'](_0x578802[_0x6eb3('0x42')][_0x6eb3('0x47')])){utils[_0x6eb3('0x7')](util[_0x6eb3('0x8')](_0x6eb3('0x48'),_0x578802[_0x6eb3('0xa')],_0x578802[_0x6eb3('0x46')]));channels[_0x578802[_0x6eb3('0xa')]]['destination']=_0x578802[_0x6eb3('0x46')];channels[_0x578802[_0x6eb3('0xa')]][_0x6eb3('0x2a')]='\x22'+_0x578802['value']+_0x6eb3('0x49')+_0x578802[_0x6eb3('0x46')]+'>';}if(!_[_0x6eb3('0x20')](_0x578802[_0x6eb3('0x42')][_0x6eb3('0x4a')])||!_[_0x6eb3('0x20')](_0x578802[_0x6eb3('0x42')][_0x6eb3('0x4b')])){utils['info'](util[_0x6eb3('0x8')](_0x6eb3('0x4c'),_0x578802[_0x6eb3('0xa')],!_[_0x6eb3('0x20')](_0x578802['variable'][_0x6eb3('0x4a')])?'xmd-callerid-preview':_0x6eb3('0x4b'),_0x578802[_0x6eb3('0x46')]));channels[_0x578802['uniqueid']][_0x6eb3('0x2a')]=_0x578802[_0x6eb3('0x46')];}if(!_['isNil'](_0x578802['variable'][_0x6eb3('0x4d')])||!_['isNil'](_0x578802[_0x6eb3('0x42')][_0x6eb3('0x4e')])){utils['info'](util['format'](_0x6eb3('0x4c'),_0x578802[_0x6eb3('0xa')],!_[_0x6eb3('0x20')](_0x578802[_0x6eb3('0x42')]['xmd-queue'])?_0x6eb3('0x4d'):_0x6eb3('0x4e'),_0x578802[_0x6eb3('0x46')]));channels[_0x578802[_0x6eb3('0xa')]][_0x6eb3('0x4f')]='Queue';channels[_0x578802[_0x6eb3('0xa')]][_0x6eb3('0x50')]=_0x578802[_0x6eb3('0x46')];channels[_0x578802['uniqueid']]['queue']=!![];}if(!_[_0x6eb3('0x20')](_0x578802[_0x6eb3('0x42')][_0x6eb3('0x51')])){utils[_0x6eb3('0x7')](util[_0x6eb3('0x8')](_0x6eb3('0x52'),_0x578802[_0x6eb3('0xa')],_0x578802[_0x6eb3('0x46')]));channels[_0x578802[_0x6eb3('0xa')]][_0x6eb3('0x53')]=_0x578802[_0x6eb3('0x46')];}if(!_['isNil'](_0x578802[_0x6eb3('0x42')][_0x6eb3('0x54')])){utils[_0x6eb3('0x7')](util[_0x6eb3('0x8')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x578802[_0x6eb3('0xa')],_0x578802['value']));channels[_0x578802[_0x6eb3('0xa')]][_0x6eb3('0x55')]=_0x578802[_0x6eb3('0x46')];}if(!_[_0x6eb3('0x20')](_0x578802[_0x6eb3('0x42')]['outboundrouteid'])){utils[_0x6eb3('0x7')](util[_0x6eb3('0x8')](_0x6eb3('0x56'),_0x578802[_0x6eb3('0xa')],_0x578802[_0x6eb3('0x46')]));channels[_0x578802[_0x6eb3('0xa')]][_0x6eb3('0x57')]=_0x578802[_0x6eb3('0x46')];}if(!_[_0x6eb3('0x20')](_0x578802[_0x6eb3('0x42')][_0x6eb3('0x58')])){utils[_0x6eb3('0x7')](util[_0x6eb3('0x8')](_0x6eb3('0x59'),_0x578802[_0x6eb3('0xa')],_0x578802[_0x6eb3('0x46')]));channels[_0x578802[_0x6eb3('0xa')]]['sipcallid']=_0x578802[_0x6eb3('0x46')];}}}catch(_0x37657f){utils[_0x6eb3('0x27')](util['format'](_0x6eb3('0x41'),_0x578802[_0x6eb3('0xa')]),_0x37657f);}};exports['newexten']=function(_0x888d7d){try{if(!_[_0x6eb3('0x20')](channels[_0x888d7d[_0x6eb3('0xa')]])){utils[_0x6eb3('0x15')](util['format']('[%s][calls][newexten]',_0x888d7d['uniqueid']),_0x888d7d);utils[_0x6eb3('0x7')](util[_0x6eb3('0x8')](_0x6eb3('0x5a'),_0x888d7d[_0x6eb3('0xa')],_0x888d7d[_0x6eb3('0x5b')],_0x888d7d['appdata']));if(_0x888d7d[_0x6eb3('0x5b')][_0x6eb3('0x5c')]()=='set'&&_[_0x6eb3('0x5d')](_0x888d7d[_0x6eb3('0x5e')][_0x6eb3('0x5c')](),_0x6eb3('0x5f'))){var _0x5056d4=_0x888d7d[_0x6eb3('0x5e')][_0x6eb3('0x60')]('=');var _0x57191d=_0x5056d4[0x0][_0x6eb3('0x61')](_0x5056d4[0x0][_0x6eb3('0x62')]('(')+0x1,_0x5056d4[0x0][_0x6eb3('0x62')](')'));var _0x3c59a4=_0x5056d4[0x1];channels[_0x888d7d[_0x6eb3('0xa')]][_0x57191d]=_0x3c59a4;}if(!_[_0x6eb3('0x63')]([_0x6eb3('0x29'),_0x6eb3('0x64'),_0x6eb3('0x65'),_0x6eb3('0x66'),'gotoif'],_0x888d7d[_0x6eb3('0x5b')][_0x6eb3('0x5c')]())){channels[_0x888d7d[_0x6eb3('0xa')]][_0x6eb3('0x4f')]=_0x888d7d['application'];channels[_0x888d7d['uniqueid']][_0x6eb3('0x50')]=_0x888d7d[_0x6eb3('0x5e')];}}}catch(_0xd442fd){utils[_0x6eb3('0x27')](util[_0x6eb3('0x8')](_0x6eb3('0x67'),_0x888d7d[_0x6eb3('0xa')]),_0xd442fd);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index e6bc041..3c42b43 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 _0x1809=['error','[core]\x20error','[core]\x20close','managerevent','./utils','[core]\x20connected','shutdown','info','[core]\x20shutdown','fullybooted'];(function(_0x128487,_0x402c33){var _0x2ccf10=function(_0x38ed98){while(--_0x38ed98){_0x128487['push'](_0x128487['shift']());}};_0x2ccf10(++_0x402c33);}(_0x1809,0x19e));var _0x9180=function(_0x24d92f,_0x5042ce){_0x24d92f=_0x24d92f-0x0;var _0x9f6ba=_0x1809[_0x24d92f];return _0x9f6ba;};'use strict';var utils=require(_0x9180('0x0'));exports['connect']=function(){utils['info'](_0x9180('0x1'));};exports[_0x9180('0x2')]=function(){utils[_0x9180('0x3')](_0x9180('0x4'));};exports[_0x9180('0x5')]=function(){utils[_0x9180('0x3')]('[core]\x20fullybooted');};exports[_0x9180('0x6')]=function(_0x44b058){utils[_0x9180('0x6')](_0x9180('0x7'),_0x44b058);};exports['close']=function(){utils[_0x9180('0x3')](_0x9180('0x8'));};exports[_0x9180('0x9')]=function(_0x2e67c6){}; \ No newline at end of file +var _0x2b8e=['[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0x4807ea,_0x30e153){var _0x2f4b90=function(_0x5a6269){while(--_0x5a6269){_0x4807ea['push'](_0x4807ea['shift']());}};_0x2f4b90(++_0x30e153);}(_0x2b8e,0x70));var _0xe2b8=function(_0x557b63,_0x3db65a){_0x557b63=_0x557b63-0x0;var _0x15b6af=_0x2b8e[_0x557b63];return _0x15b6af;};'use strict';var utils=require(_0xe2b8('0x0'));exports[_0xe2b8('0x1')]=function(){utils[_0xe2b8('0x2')]('[core]\x20connected');};exports[_0xe2b8('0x3')]=function(){utils[_0xe2b8('0x2')](_0xe2b8('0x4'));};exports[_0xe2b8('0x5')]=function(){utils[_0xe2b8('0x2')](_0xe2b8('0x6'));};exports[_0xe2b8('0x7')]=function(_0x35ebb3){utils['error'](_0xe2b8('0x8'),_0x35ebb3);};exports[_0xe2b8('0x9')]=function(){utils[_0xe2b8('0x2')](_0xe2b8('0xa'));};exports[_0xe2b8('0xb')]=function(_0x49b4ab){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 7786a50..6c00739 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 _0xb149=['CreateVoiceDialReport','newexten','format','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','error','[%s][dials][newexten]','varset','debug','[%s][dials][varset]','isNil','variable','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request'];(function(_0x23ba9b,_0x2fd1e3){var _0x1b620e=function(_0x5f3127){while(--_0x5f3127){_0x23ba9b['push'](_0x23ba9b['shift']());}};_0x1b620e(++_0x2fd1e3);}(_0xb149,0xfe));var _0x9b14=function(_0x462545,_0x3c0f1b){_0x462545=_0x462545-0x0;var _0x680d51=_0xb149[_0x462545];return _0x680d51;};'use strict';var _=require(_0x9b14('0x0'));var util=require(_0x9b14('0x1'));var utils=require(_0x9b14('0x2'));var dials={};function writeDB(_0x151c9e){utils['info'](util['format'](_0x9b14('0x3'),_0x151c9e[_0x9b14('0x4')],_0x151c9e[_0x9b14('0x5')],_0x151c9e[_0x9b14('0x6')],_0x151c9e[_0x9b14('0x7')],_0x151c9e[_0x9b14('0x8')],_0x151c9e[_0x9b14('0x9')]));utils[_0x9b14('0xa')](_0x9b14('0xb'),_0x151c9e);delete dials[_0x151c9e[_0x9b14('0x4')]];}exports[_0x9b14('0xc')]=function(_0x485e8e){try{utils['debug'](util[_0x9b14('0xd')]('[%s][dials][newexten]',_0x485e8e[_0x9b14('0x4')]),_0x485e8e);utils[_0x9b14('0xe')](util[_0x9b14('0xd')](_0x9b14('0xf'),_0x485e8e[_0x9b14('0x4')],_0x485e8e[_0x9b14('0x10')],_0x485e8e[_0x9b14('0x11')]));if(_0x485e8e[_0x9b14('0x10')][_0x9b14('0x12')]()=='set'&&_[_0x9b14('0x13')](_0x485e8e[_0x9b14('0x11')][_0x9b14('0x12')](),_0x9b14('0x14'))){var _0x54af2a=_0x485e8e[_0x9b14('0x11')]['split']('=');dials[_0x485e8e[_0x9b14('0x4')]]={'routeId':_0x54af2a[0x1]};}}catch(_0x214955){utils[_0x9b14('0x15')](util['format'](_0x9b14('0x16'),_0x485e8e[_0x9b14('0x4')]),_0x214955);}};exports[_0x9b14('0x17')]=function(_0x32d100){try{utils[_0x9b14('0x18')](util[_0x9b14('0xd')](_0x9b14('0x19'),_0x32d100[_0x9b14('0x4')]),_0x32d100);if(!_[_0x9b14('0x1a')](_0x32d100[_0x9b14('0x1b')]['outboundrouteid'])){utils[_0x9b14('0xe')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x32d100[_0x9b14('0x4')],_0x32d100[_0x9b14('0x1c')]));dials[_0x32d100[_0x9b14('0x4')]]={'routeId':_0x32d100['value']};}}catch(_0x1495c7){utils['error'](util['format'](_0x9b14('0x19'),_0x32d100['uniqueid']),_0x1495c7);}};exports[_0x9b14('0x1d')]=function(_0x1d3c20){try{if(!_[_0x9b14('0x1a')](dials[_0x1d3c20['uniqueid']])){utils[_0x9b14('0x18')](util['format'](_0x9b14('0x1e'),_0x1d3c20['uniqueid']),_0x1d3c20);dials[_0x1d3c20[_0x9b14('0x4')]]=_[_0x9b14('0x1f')](dials[_0x1d3c20[_0x9b14('0x4')]],_0x1d3c20);dials[_0x1d3c20['uniqueid']][_0x9b14('0x20')]=utils[_0x9b14('0x21')]();dials[_0x1d3c20['uniqueid']][_0x9b14('0x22')]=_0x9b14('0x23');utils[_0x9b14('0xe')](util[_0x9b14('0xd')](_0x9b14('0x24'),_0x1d3c20[_0x9b14('0x4')],dials[_0x1d3c20['uniqueid']]['starttime']));}}catch(_0x134042){utils['error'](util['format'](_0x9b14('0x1e'),_0x1d3c20[_0x9b14('0x4')]),_0x134042);}};exports[_0x9b14('0x25')]=function(_0x5d085e){try{if(!_[_0x9b14('0x1a')](dials[_0x5d085e['uniqueid']])){utils[_0x9b14('0x18')](util['format'](_0x9b14('0x26'),_0x5d085e[_0x9b14('0x4')]),_0x5d085e);dials[_0x5d085e[_0x9b14('0x4')]][_0x9b14('0x9')]=_0x5d085e['dialstatus'];if(_0x5d085e['dialstatus']==_0x9b14('0x27')){dials[_0x5d085e['uniqueid']]=_[_0x9b14('0x1f')](dials[_0x5d085e['uniqueid']],_0x5d085e);dials[_0x5d085e[_0x9b14('0x4')]]['answertime']=utils[_0x9b14('0x21')]();dials[_0x5d085e['uniqueid']][_0x9b14('0x22')]=_0x9b14('0x28');utils['info'](util[_0x9b14('0xd')](_0x9b14('0x29'),_0x5d085e['uniqueid'],_0x5d085e[_0x9b14('0x9')],dials[_0x5d085e[_0x9b14('0x4')]][_0x9b14('0x2a')]));}else{utils[_0x9b14('0xe')](util['format'](_0x9b14('0x2b'),_0x5d085e[_0x9b14('0x4')],_0x5d085e['dialstatus']));}}}catch(_0xd9bfd7){utils['error'](util[_0x9b14('0xd')](_0x9b14('0x26'),_0x5d085e[_0x9b14('0x4')]),_0xd9bfd7);}};exports[_0x9b14('0x2c')]=function(_0x3cf8b7){try{if(!_[_0x9b14('0x1a')](dials[_0x3cf8b7['uniqueid']])){utils[_0x9b14('0x18')](util['format'](_0x9b14('0x2d'),_0x3cf8b7[_0x9b14('0x4')]),_0x3cf8b7);utils[_0x9b14('0xe')](util[_0x9b14('0xd')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x3cf8b7['uniqueid'],_0x3cf8b7['calleridnum'],_0x3cf8b7[_0x9b14('0x2e')],_0x3cf8b7['cause-txt']));dials[_0x3cf8b7[_0x9b14('0x4')]]=_['assign'](dials[_0x3cf8b7[_0x9b14('0x4')]],{'endtime':utils['now'](),'lastevent':_0x9b14('0x2f')});dials[_0x3cf8b7[_0x9b14('0x4')]][_0x9b14('0x30')]=utils[_0x9b14('0x31')](dials[_0x3cf8b7[_0x9b14('0x4')]][_0x9b14('0x32')],dials[_0x3cf8b7[_0x9b14('0x4')]][_0x9b14('0x20')]);dials[_0x3cf8b7[_0x9b14('0x4')]][_0x9b14('0x33')]=utils[_0x9b14('0x31')](dials[_0x3cf8b7[_0x9b14('0x4')]][_0x9b14('0x2a')]||dials[_0x3cf8b7[_0x9b14('0x4')]][_0x9b14('0x32')],dials[_0x3cf8b7[_0x9b14('0x4')]][_0x9b14('0x20')]);dials[_0x3cf8b7['uniqueid']][_0x9b14('0x34')]=dials[_0x3cf8b7[_0x9b14('0x4')]][_0x9b14('0x2a')]?utils['diffTime'](dials[_0x3cf8b7[_0x9b14('0x4')]][_0x9b14('0x32')],dials[_0x3cf8b7[_0x9b14('0x4')]][_0x9b14('0x2a')]):0x0;writeDB(dials[_0x3cf8b7[_0x9b14('0x4')]]);}}catch(_0x3454f3){utils[_0x9b14('0x15')](util['format'](_0x9b14('0x2d'),_0x3cf8b7[_0x9b14('0x4')]),_0x3454f3);}}; \ No newline at end of file +var _0x6096=['request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','split','varset','[%s][dials][varset]','isNil','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','assign','starttime','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','error','[%s][dials][dialend]','ANSWER','answertime','now','connect','hangup','[%s][dials][hangup]','complete','duration','diffTime','endtime','holdtime','billableseconds','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus'];(function(_0x1244f7,_0x27e231){var _0x46b05a=function(_0x35a843){while(--_0x35a843){_0x1244f7['push'](_0x1244f7['shift']());}};_0x46b05a(++_0x27e231);}(_0x6096,0xd7));var _0x6609=function(_0x3d46ec,_0x1583d9){_0x3d46ec=_0x3d46ec-0x0;var _0x4d1a34=_0x6096[_0x3d46ec];return _0x4d1a34;};'use strict';var _=require('lodash');var util=require(_0x6609('0x0'));var utils=require(_0x6609('0x1'));var dials={};function writeDB(_0x1276d5){utils[_0x6609('0x2')](util[_0x6609('0x3')](_0x6609('0x4'),_0x1276d5[_0x6609('0x5')],_0x1276d5['channel'],_0x1276d5[_0x6609('0x6')],_0x1276d5[_0x6609('0x7')],_0x1276d5[_0x6609('0x8')],_0x1276d5[_0x6609('0x9')]));utils[_0x6609('0xa')](_0x6609('0xb'),_0x1276d5);delete dials[_0x1276d5[_0x6609('0x5')]];}exports[_0x6609('0xc')]=function(_0x326947){try{utils[_0x6609('0xd')](util['format'](_0x6609('0xe'),_0x326947[_0x6609('0x5')]),_0x326947);utils['info'](util['format'](_0x6609('0xf'),_0x326947[_0x6609('0x5')],_0x326947[_0x6609('0x10')],_0x326947[_0x6609('0x11')]));if(_0x326947[_0x6609('0x10')][_0x6609('0x12')]()==_0x6609('0x13')&&_['startsWith'](_0x326947[_0x6609('0x11')]['toLowerCase'](),'cdr(routeid)')){var _0x300e34=_0x326947[_0x6609('0x11')][_0x6609('0x14')]('=');dials[_0x326947[_0x6609('0x5')]]={'routeId':_0x300e34[0x1]};}}catch(_0x150ebd){utils['error'](util[_0x6609('0x3')](_0x6609('0xe'),_0x326947[_0x6609('0x5')]),_0x150ebd);}};exports[_0x6609('0x15')]=function(_0x13dafd){try{utils[_0x6609('0xd')](util[_0x6609('0x3')](_0x6609('0x16'),_0x13dafd[_0x6609('0x5')]),_0x13dafd);if(!_[_0x6609('0x17')](_0x13dafd['variable']['outboundrouteid'])){utils['info'](util['format'](_0x6609('0x18'),_0x13dafd[_0x6609('0x5')],_0x13dafd[_0x6609('0x19')]));dials[_0x13dafd['uniqueid']]={'routeId':_0x13dafd[_0x6609('0x19')]};}}catch(_0x539221){utils['error'](util[_0x6609('0x3')](_0x6609('0x16'),_0x13dafd['uniqueid']),_0x539221);}};exports['dialbegin']=function(_0x3ea751){try{if(!_[_0x6609('0x17')](dials[_0x3ea751[_0x6609('0x5')]])){utils[_0x6609('0xd')](util['format'](_0x6609('0x1a'),_0x3ea751[_0x6609('0x5')]),_0x3ea751);dials[_0x3ea751[_0x6609('0x5')]]=_[_0x6609('0x1b')](dials[_0x3ea751['uniqueid']],_0x3ea751);dials[_0x3ea751[_0x6609('0x5')]][_0x6609('0x1c')]=utils['now']();dials[_0x3ea751[_0x6609('0x5')]]['lastevent']=_0x6609('0x1d');utils[_0x6609('0x2')](util['format'](_0x6609('0x1e'),_0x3ea751[_0x6609('0x5')],dials[_0x3ea751[_0x6609('0x5')]]['starttime']));}}catch(_0x53ad58){utils[_0x6609('0x1f')](util['format']('[%s][dials][dialbegin]',_0x3ea751[_0x6609('0x5')]),_0x53ad58);}};exports['dialend']=function(_0x3c3f14){try{if(!_[_0x6609('0x17')](dials[_0x3c3f14[_0x6609('0x5')]])){utils[_0x6609('0xd')](util['format'](_0x6609('0x20'),_0x3c3f14[_0x6609('0x5')]),_0x3c3f14);dials[_0x3c3f14[_0x6609('0x5')]][_0x6609('0x9')]=_0x3c3f14[_0x6609('0x9')];if(_0x3c3f14['dialstatus']==_0x6609('0x21')){dials[_0x3c3f14[_0x6609('0x5')]]=_[_0x6609('0x1b')](dials[_0x3c3f14['uniqueid']],_0x3c3f14);dials[_0x3c3f14[_0x6609('0x5')]][_0x6609('0x22')]=utils[_0x6609('0x23')]();dials[_0x3c3f14['uniqueid']]['lastevent']=_0x6609('0x24');utils[_0x6609('0x2')](util[_0x6609('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x3c3f14['uniqueid'],_0x3c3f14[_0x6609('0x9')],dials[_0x3c3f14['uniqueid']]['answertime']));}else{utils[_0x6609('0x2')](util[_0x6609('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x3c3f14[_0x6609('0x5')],_0x3c3f14[_0x6609('0x9')]));}}}catch(_0x5f5cee){utils[_0x6609('0x1f')](util[_0x6609('0x3')](_0x6609('0x20'),_0x3c3f14['uniqueid']),_0x5f5cee);}};exports[_0x6609('0x25')]=function(_0x75c56f){try{if(!_[_0x6609('0x17')](dials[_0x75c56f['uniqueid']])){utils[_0x6609('0xd')](util[_0x6609('0x3')](_0x6609('0x26'),_0x75c56f[_0x6609('0x5')]),_0x75c56f);utils[_0x6609('0x2')](util[_0x6609('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x75c56f[_0x6609('0x5')],_0x75c56f[_0x6609('0x7')],_0x75c56f['calleridname'],_0x75c56f['cause-txt']));dials[_0x75c56f[_0x6609('0x5')]]=_['assign'](dials[_0x75c56f['uniqueid']],{'endtime':utils[_0x6609('0x23')](),'lastevent':_0x6609('0x27')});dials[_0x75c56f[_0x6609('0x5')]][_0x6609('0x28')]=utils[_0x6609('0x29')](dials[_0x75c56f[_0x6609('0x5')]][_0x6609('0x2a')],dials[_0x75c56f['uniqueid']][_0x6609('0x1c')]);dials[_0x75c56f[_0x6609('0x5')]][_0x6609('0x2b')]=utils[_0x6609('0x29')](dials[_0x75c56f[_0x6609('0x5')]][_0x6609('0x22')]||dials[_0x75c56f[_0x6609('0x5')]]['endtime'],dials[_0x75c56f[_0x6609('0x5')]]['starttime']);dials[_0x75c56f[_0x6609('0x5')]][_0x6609('0x2c')]=dials[_0x75c56f[_0x6609('0x5')]][_0x6609('0x22')]?utils[_0x6609('0x29')](dials[_0x75c56f['uniqueid']][_0x6609('0x2a')],dials[_0x75c56f[_0x6609('0x5')]][_0x6609('0x22')]):0x0;writeDB(dials[_0x75c56f[_0x6609('0x5')]]);}}catch(_0x218edb){utils[_0x6609('0x1f')](util[_0x6609('0x3')]('[%s][dials][hangup]',_0x75c56f['uniqueid']),_0x218edb);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index c792b95..c9d707f 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 _0xbf9a=['agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][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','asterisk','port','username','keepConnected','disabled','info','XDR\x20DISABLED','./agents.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','error','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]'];(function(_0x14af87,_0x149ac3){var _0x4ff770=function(_0x6b8516){while(--_0x6b8516){_0x14af87['push'](_0x14af87['shift']());}};_0x4ff770(++_0x149ac3);}(_0xbf9a,0xa3));var _0xabf9=function(_0x3f6b1b,_0x58d3d6){_0x3f6b1b=_0x3f6b1b-0x0;var _0x4a3d2b=_0xbf9a[_0x3f6b1b];return _0x4a3d2b;};var AsteriskManager=require(_0xabf9('0x0'));var config=require(_0xabf9('0x1'));var utils=require(_0xabf9('0x2'));var util=require('util');var ami=new AsteriskManager(config[_0xabf9('0x3')][_0xabf9('0x4')],config['asterisk']['ip'],config[_0xabf9('0x3')][_0xabf9('0x5')],config[_0xabf9('0x3')]['password'],!![]);ami[_0xabf9('0x6')]();if(config['xdr']&&config['xdr'][_0xabf9('0x7')]){utils[_0xabf9('0x8')](_0xabf9('0x9'));}else{var agents=require(_0xabf9('0xa'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0xabf9('0xb'));var dials=require(_0xabf9('0xc'));var transfers=require(_0xabf9('0xd'));var core=require('./core.controller');ami['on'](_0xabf9('0xe'),core[_0xabf9('0xe')]);ami['on'](_0xabf9('0xf'),core['shutdown']);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0xabf9('0x10'),core['error']);ami['on'](_0xabf9('0x11'),core[_0xabf9('0x11')]);ami['on'](_0xabf9('0x12'),core['managerevent']);ami['on'](_0xabf9('0x13'),function(_0x470b11){try{utils[_0xabf9('0x14')](util[_0xabf9('0x15')]('[%s][index][devicestatechange]',_0x470b11[_0xabf9('0x16')]),_0x470b11);members['devicestatechange'](_0x470b11);}catch(_0x29e72f){utils['error'](util[_0xabf9('0x15')](_0xabf9('0x17'),_0x470b11[_0xabf9('0x16')]),_0x29e72f);}});ami['on'](_0xabf9('0x18'),function(_0x41e895){try{utils[_0xabf9('0x14')](util[_0xabf9('0x15')]('[%s][index][agentcalled]',_0x41e895[_0xabf9('0x19')]),_0x41e895);agents[_0xabf9('0x18')](_0x41e895);}catch(_0x481cb8){utils[_0xabf9('0x10')](util['format'](_0xabf9('0x1a'),_0x41e895[_0xabf9('0x19')]),_0x481cb8);}});ami['on'](_0xabf9('0x1b'),function(_0x45ae0e){try{utils[_0xabf9('0x14')](util[_0xabf9('0x15')](_0xabf9('0x1c'),_0x45ae0e['uniqueid']),_0x45ae0e);agents[_0xabf9('0x1b')](_0x45ae0e);}catch(_0x33bdaa){utils[_0xabf9('0x10')](util[_0xabf9('0x15')](_0xabf9('0x1c'),_0x45ae0e[_0xabf9('0x19')]),_0x33bdaa);}});ami['on'](_0xabf9('0x1d'),function(_0x1b5819){try{utils[_0xabf9('0x14')](util['format'](_0xabf9('0x1e'),_0x1b5819[_0xabf9('0x19')]),_0x1b5819);agents['agentconnect'](_0x1b5819);queues[_0xabf9('0x1d')](_0x1b5819);}catch(_0x4a8788){utils['error'](util[_0xabf9('0x15')](_0xabf9('0x1e'),_0x1b5819[_0xabf9('0x19')]),_0x4a8788);}});ami['on'](_0xabf9('0x1f'),function(_0x916197){try{utils[_0xabf9('0x14')](util[_0xabf9('0x15')](_0xabf9('0x20'),_0x916197[_0xabf9('0x19')]),_0x916197);agents[_0xabf9('0x1f')](_0x916197);queues[_0xabf9('0x1f')](_0x916197);members[_0xabf9('0x1f')](_0x916197);}catch(_0x413583){utils[_0xabf9('0x10')](util['format'](_0xabf9('0x20'),_0x916197['uniqueid']),_0x413583);}});ami['on']('queuecallerabandon',function(_0x5e47a2){try{utils[_0xabf9('0x14')](util[_0xabf9('0x15')]('[%s][index][queuecallerabandon]',_0x5e47a2[_0xabf9('0x19')]),_0x5e47a2);agents[_0xabf9('0x21')](_0x5e47a2);queues[_0xabf9('0x21')](_0x5e47a2);}catch(_0x4cac47){utils['error'](util['format']('[%s][index][queuecallerabandon]',_0x5e47a2['uniqueid']),_0x4cac47);}});ami['on'](_0xabf9('0x22'),function(_0x29ca72){try{utils[_0xabf9('0x14')](util['format'](_0xabf9('0x23'),_0x29ca72[_0xabf9('0x19')]),_0x29ca72);queues['queuecallerjoin'](_0x29ca72);recordings[_0xabf9('0x22')](_0x29ca72);}catch(_0x2cd39c){utils[_0xabf9('0x10')](util[_0xabf9('0x15')](_0xabf9('0x23'),_0x29ca72[_0xabf9('0x19')]),_0x2cd39c);}});ami['on']('queuecallerleave',function(_0x360d28){try{utils['debug'](util[_0xabf9('0x15')](_0xabf9('0x24'),_0x360d28['uniqueid']),_0x360d28);queues[_0xabf9('0x25')](_0x360d28);}catch(_0x4beae2){utils[_0xabf9('0x10')](util[_0xabf9('0x15')](_0xabf9('0x24'),_0x360d28[_0xabf9('0x19')]),_0x4beae2);}});ami['on']('musiconholdstart',function(_0x39f11e){try{utils[_0xabf9('0x14')](util['format'](_0xabf9('0x26'),_0x39f11e['uniqueid']),_0x39f11e);queues[_0xabf9('0x27')](_0x39f11e);calls['musiconholdstart'](_0x39f11e);}catch(_0xf13d1a){utils['error'](util[_0xabf9('0x15')](_0xabf9('0x26'),_0x39f11e['uniqueid']),_0xf13d1a);}});ami['on']('musiconholdstop',function(_0x53fcae){try{utils[_0xabf9('0x14')](util['format']('[%s][index][musiconholdstop]',_0x53fcae['uniqueid']),_0x53fcae);queues[_0xabf9('0x28')](_0x53fcae);calls['musiconholdstop'](_0x53fcae);}catch(_0x2db26c){utils[_0xabf9('0x10')](util[_0xabf9('0x15')](_0xabf9('0x29'),_0x53fcae[_0xabf9('0x19')]),_0x2db26c);}});ami['on'](_0xabf9('0x2a'),function(_0x5464bf){try{utils[_0xabf9('0x14')](util[_0xabf9('0x15')](_0xabf9('0x2b'),_0x5464bf[_0xabf9('0x19')]),_0x5464bf);calls[_0xabf9('0x2a')](_0x5464bf);recordings['newstate'](_0x5464bf);}catch(_0xfd29b3){utils[_0xabf9('0x10')](util['format']('[%s][index][newstate]',_0x5464bf[_0xabf9('0x19')]),_0xfd29b3);}});ami['on'](_0xabf9('0x2c'),function(_0x19df29){try{utils[_0xabf9('0x14')](util['format']('[%s][index][hangup]',_0x19df29[_0xabf9('0x19')]),_0x19df29);calls[_0xabf9('0x2c')](_0x19df29);recordings['hangup'](_0x19df29);dials[_0xabf9('0x2c')](_0x19df29);agents[_0xabf9('0x2c')](_0x19df29);queues[_0xabf9('0x2c')](_0x19df29);}catch(_0x8021ec){utils['error'](util[_0xabf9('0x15')](_0xabf9('0x2d'),_0x19df29[_0xabf9('0x19')]),_0x8021ec);}});ami['on'](_0xabf9('0x2e'),function(_0x288f07){try{utils['debug'](util[_0xabf9('0x15')](_0xabf9('0x2f'),_0x288f07[_0xabf9('0x19')]),_0x288f07);members[_0xabf9('0x2e')](_0x288f07);}catch(_0x14099c){utils[_0xabf9('0x10')](util[_0xabf9('0x15')]('[%s][index][cdr]',_0x288f07['uniqueid']),_0x14099c);}});ami['on'](_0xabf9('0x30'),function(_0x1462da){try{utils['debug'](util[_0xabf9('0x15')](_0xabf9('0x31'),_0x1462da[_0xabf9('0x19')]),_0x1462da);queues[_0xabf9('0x30')](_0x1462da);agents[_0xabf9('0x30')](_0x1462da);transfers[_0xabf9('0x30')](_0x1462da);}catch(_0x3b7229){utils[_0xabf9('0x10')](util[_0xabf9('0x15')](_0xabf9('0x31'),_0x1462da[_0xabf9('0x19')]),_0x3b7229);}});ami['on'](_0xabf9('0x32'),function(_0x3b8dd7){try{utils[_0xabf9('0x14')](util['format']('[%s][index][attendedtransfer]',_0x3b8dd7[_0xabf9('0x33')]),_0x3b8dd7);queues['attendedtransfer'](_0x3b8dd7);transfers['attendedtransfer'](_0x3b8dd7);agents['attendedtransfer'](_0x3b8dd7);calls[_0xabf9('0x32')](_0x3b8dd7);}catch(_0x9b5931){utils[_0xabf9('0x10')](util['format'](_0xabf9('0x34'),_0x3b8dd7[_0xabf9('0x33')]),_0x9b5931);}});ami['on'](_0xabf9('0x35'),function(_0x3798d8){try{utils[_0xabf9('0x14')](util[_0xabf9('0x15')](_0xabf9('0x36'),_0x3798d8[_0xabf9('0x19')]),_0x3798d8);queues[_0xabf9('0x35')](_0x3798d8);recordings[_0xabf9('0x35')](_0x3798d8);calls[_0xabf9('0x35')](_0x3798d8);dials[_0xabf9('0x35')](_0x3798d8);}catch(_0x376f5c){utils[_0xabf9('0x10')](util[_0xabf9('0x15')](_0xabf9('0x36'),_0x3798d8[_0xabf9('0x19')]),_0x376f5c);}});ami['on'](_0xabf9('0x37'),function(_0x140d12){try{utils[_0xabf9('0x14')](util[_0xabf9('0x15')](_0xabf9('0x38'),_0x140d12[_0xabf9('0x19')]),_0x140d12);calls['newexten'](_0x140d12);recordings[_0xabf9('0x37')](_0x140d12);dials[_0xabf9('0x37')](_0x140d12);}catch(_0x209a8c){utils['error'](util[_0xabf9('0x15')](_0xabf9('0x38'),_0x140d12[_0xabf9('0x19')]),_0x209a8c);}});ami['on'](_0xabf9('0x39'),function(_0x3244e7){try{utils['debug'](util['format']('[%s][index][newchannel]',_0x3244e7[_0xabf9('0x19')]),_0x3244e7);calls[_0xabf9('0x39')](_0x3244e7);recordings[_0xabf9('0x39')](_0x3244e7);}catch(_0x22acaf){utils['error'](util[_0xabf9('0x15')](_0xabf9('0x3a'),_0x3244e7['uniqueid']),_0x22acaf);}});ami['on'](_0xabf9('0x3b'),function(_0x29865d){try{utils[_0xabf9('0x14')](util[_0xabf9('0x15')](_0xabf9('0x3c'),_0x29865d[_0xabf9('0x19')]),_0x29865d);dials[_0xabf9('0x3b')](_0x29865d);}catch(_0x5b0d17){utils[_0xabf9('0x10')](util['format'](_0xabf9('0x3d'),_0x29865d[_0xabf9('0x19')]),_0x5b0d17);}});ami['on'](_0xabf9('0x3e'),function(_0x1ab77b){try{utils['debug'](util[_0xabf9('0x15')](_0xabf9('0x3f'),_0x1ab77b['uniqueid']),_0x1ab77b);dials[_0xabf9('0x3e')](_0x1ab77b);}catch(_0xba78){utils[_0xabf9('0x10')](util[_0xabf9('0x15')]('[%s][index][dialend]',_0x1ab77b[_0xabf9('0x19')]),_0xba78);}});} \ No newline at end of file +var _0x748d=['queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][hangup]','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','[%s][index][dialend]','dialend','asterisk-manager','./utils','util','asterisk','port','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','error','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','[%s][index][agentcalled]','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x748d,0x1ea));var _0xd748=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x748d[_0x14add3];return _0x4a174f;};var AsteriskManager=require(_0xd748('0x0'));var config=require('../../config/environment');var utils=require(_0xd748('0x1'));var util=require(_0xd748('0x2'));var ami=new AsteriskManager(config[_0xd748('0x3')][_0xd748('0x4')],config[_0xd748('0x3')]['ip'],config[_0xd748('0x3')]['username'],config['asterisk']['password'],!![]);ami[_0xd748('0x5')]();if(config[_0xd748('0x6')]&&config[_0xd748('0x6')][_0xd748('0x7')]){utils[_0xd748('0x8')](_0xd748('0x9'));}else{var agents=require(_0xd748('0xa'));var calls=require('./calls.controller');var queues=require(_0xd748('0xb'));var recordings=require(_0xd748('0xc'));var members=require(_0xd748('0xd'));var dials=require(_0xd748('0xe'));var transfers=require(_0xd748('0xf'));var core=require(_0xd748('0x10'));ami['on'](_0xd748('0x11'),core[_0xd748('0x11')]);ami['on'](_0xd748('0x12'),core[_0xd748('0x12')]);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0xd748('0x13'),core[_0xd748('0x13')]);ami['on'](_0xd748('0x14'),core[_0xd748('0x14')]);ami['on'](_0xd748('0x15'),core[_0xd748('0x15')]);ami['on'](_0xd748('0x16'),function(_0x19fd9a){try{utils[_0xd748('0x17')](util[_0xd748('0x18')]('[%s][index][devicestatechange]',_0x19fd9a[_0xd748('0x19')]),_0x19fd9a);members[_0xd748('0x16')](_0x19fd9a);}catch(_0x4bd4b5){utils[_0xd748('0x13')](util[_0xd748('0x18')](_0xd748('0x1a'),_0x19fd9a[_0xd748('0x19')]),_0x4bd4b5);}});ami['on']('agentcalled',function(_0x1a3d69){try{utils['debug'](util['format'](_0xd748('0x1b'),_0x1a3d69['uniqueid']),_0x1a3d69);agents[_0xd748('0x1c')](_0x1a3d69);}catch(_0x1a4a54){utils[_0xd748('0x13')](util[_0xd748('0x18')](_0xd748('0x1b'),_0x1a3d69[_0xd748('0x1d')]),_0x1a4a54);}});ami['on'](_0xd748('0x1e'),function(_0x1d90e7){try{utils[_0xd748('0x17')](util['format'](_0xd748('0x1f'),_0x1d90e7[_0xd748('0x1d')]),_0x1d90e7);agents[_0xd748('0x1e')](_0x1d90e7);}catch(_0x5a00a3){utils[_0xd748('0x13')](util[_0xd748('0x18')](_0xd748('0x1f'),_0x1d90e7[_0xd748('0x1d')]),_0x5a00a3);}});ami['on']('agentconnect',function(_0x3fd23d){try{utils[_0xd748('0x17')](util[_0xd748('0x18')]('[%s][index][agentconnect]',_0x3fd23d[_0xd748('0x1d')]),_0x3fd23d);agents['agentconnect'](_0x3fd23d);queues[_0xd748('0x20')](_0x3fd23d);}catch(_0x4418e9){utils[_0xd748('0x13')](util['format'](_0xd748('0x21'),_0x3fd23d['uniqueid']),_0x4418e9);}});ami['on']('agentcomplete',function(_0x4d0ed1){try{utils[_0xd748('0x17')](util['format'](_0xd748('0x22'),_0x4d0ed1['uniqueid']),_0x4d0ed1);agents['agentcomplete'](_0x4d0ed1);queues[_0xd748('0x23')](_0x4d0ed1);members['agentcomplete'](_0x4d0ed1);}catch(_0x595d2a){utils['error'](util[_0xd748('0x18')](_0xd748('0x22'),_0x4d0ed1['uniqueid']),_0x595d2a);}});ami['on'](_0xd748('0x24'),function(_0x1bc704){try{utils[_0xd748('0x17')](util[_0xd748('0x18')](_0xd748('0x25'),_0x1bc704['uniqueid']),_0x1bc704);agents[_0xd748('0x24')](_0x1bc704);queues[_0xd748('0x24')](_0x1bc704);}catch(_0x4e110b){utils[_0xd748('0x13')](util[_0xd748('0x18')](_0xd748('0x25'),_0x1bc704['uniqueid']),_0x4e110b);}});ami['on'](_0xd748('0x26'),function(_0x4eadcc){try{utils[_0xd748('0x17')](util[_0xd748('0x18')](_0xd748('0x27'),_0x4eadcc[_0xd748('0x1d')]),_0x4eadcc);queues[_0xd748('0x26')](_0x4eadcc);recordings[_0xd748('0x26')](_0x4eadcc);}catch(_0x2640f0){utils['error'](util['format'](_0xd748('0x27'),_0x4eadcc[_0xd748('0x1d')]),_0x2640f0);}});ami['on'](_0xd748('0x28'),function(_0x21ef5c){try{utils[_0xd748('0x17')](util[_0xd748('0x18')]('[%s][index][queuecallerleave]',_0x21ef5c[_0xd748('0x1d')]),_0x21ef5c);queues[_0xd748('0x28')](_0x21ef5c);}catch(_0xe262de){utils[_0xd748('0x13')](util['format'](_0xd748('0x29'),_0x21ef5c['uniqueid']),_0xe262de);}});ami['on']('musiconholdstart',function(_0x5d9dfc){try{utils[_0xd748('0x17')](util[_0xd748('0x18')](_0xd748('0x2a'),_0x5d9dfc[_0xd748('0x1d')]),_0x5d9dfc);queues[_0xd748('0x2b')](_0x5d9dfc);calls[_0xd748('0x2b')](_0x5d9dfc);}catch(_0x264298){utils[_0xd748('0x13')](util[_0xd748('0x18')](_0xd748('0x2a'),_0x5d9dfc[_0xd748('0x1d')]),_0x264298);}});ami['on']('musiconholdstop',function(_0xcfbf29){try{utils[_0xd748('0x17')](util[_0xd748('0x18')](_0xd748('0x2c'),_0xcfbf29[_0xd748('0x1d')]),_0xcfbf29);queues[_0xd748('0x2d')](_0xcfbf29);calls[_0xd748('0x2d')](_0xcfbf29);}catch(_0xbcd7f5){utils[_0xd748('0x13')](util[_0xd748('0x18')]('[%s][index][musiconholdstop]',_0xcfbf29[_0xd748('0x1d')]),_0xbcd7f5);}});ami['on'](_0xd748('0x2e'),function(_0xce69f9){try{utils['debug'](util[_0xd748('0x18')]('[%s][index][newstate]',_0xce69f9[_0xd748('0x1d')]),_0xce69f9);calls[_0xd748('0x2e')](_0xce69f9);recordings['newstate'](_0xce69f9);}catch(_0x3c3ca9){utils[_0xd748('0x13')](util['format']('[%s][index][newstate]',_0xce69f9[_0xd748('0x1d')]),_0x3c3ca9);}});ami['on']('hangup',function(_0x5dd5ba){try{utils[_0xd748('0x17')](util[_0xd748('0x18')](_0xd748('0x2f'),_0x5dd5ba[_0xd748('0x1d')]),_0x5dd5ba);calls[_0xd748('0x30')](_0x5dd5ba);recordings['hangup'](_0x5dd5ba);dials[_0xd748('0x30')](_0x5dd5ba);agents[_0xd748('0x30')](_0x5dd5ba);queues['hangup'](_0x5dd5ba);}catch(_0x93f164){utils['error'](util[_0xd748('0x18')](_0xd748('0x2f'),_0x5dd5ba[_0xd748('0x1d')]),_0x93f164);}});ami['on'](_0xd748('0x31'),function(_0x4aec6b){try{utils[_0xd748('0x17')](util[_0xd748('0x18')](_0xd748('0x32'),_0x4aec6b[_0xd748('0x1d')]),_0x4aec6b);members['cdr'](_0x4aec6b);}catch(_0x51c731){utils[_0xd748('0x13')](util[_0xd748('0x18')](_0xd748('0x32'),_0x4aec6b[_0xd748('0x1d')]),_0x51c731);}});ami['on']('blindtransfer',function(_0x3c8ea5){try{utils[_0xd748('0x17')](util['format']('[%s][index][blindtransfer]',_0x3c8ea5[_0xd748('0x1d')]),_0x3c8ea5);queues[_0xd748('0x33')](_0x3c8ea5);agents[_0xd748('0x33')](_0x3c8ea5);transfers[_0xd748('0x33')](_0x3c8ea5);}catch(_0x12f18a){utils[_0xd748('0x13')](util[_0xd748('0x18')](_0xd748('0x34'),_0x3c8ea5['uniqueid']),_0x12f18a);}});ami['on'](_0xd748('0x35'),function(_0x2b3827){try{utils[_0xd748('0x17')](util[_0xd748('0x18')](_0xd748('0x36'),_0x2b3827[_0xd748('0x37')]),_0x2b3827);queues['attendedtransfer'](_0x2b3827);transfers['attendedtransfer'](_0x2b3827);agents[_0xd748('0x35')](_0x2b3827);calls[_0xd748('0x35')](_0x2b3827);}catch(_0x55e3d9){utils[_0xd748('0x13')](util['format'](_0xd748('0x36'),_0x2b3827[_0xd748('0x37')]),_0x55e3d9);}});ami['on'](_0xd748('0x38'),function(_0x29aa7d){try{utils[_0xd748('0x17')](util['format'](_0xd748('0x39'),_0x29aa7d[_0xd748('0x1d')]),_0x29aa7d);queues[_0xd748('0x38')](_0x29aa7d);recordings[_0xd748('0x38')](_0x29aa7d);calls[_0xd748('0x38')](_0x29aa7d);dials[_0xd748('0x38')](_0x29aa7d);}catch(_0x3ca0f9){utils[_0xd748('0x13')](util[_0xd748('0x18')](_0xd748('0x39'),_0x29aa7d[_0xd748('0x1d')]),_0x3ca0f9);}});ami['on'](_0xd748('0x3a'),function(_0x3b892c){try{utils[_0xd748('0x17')](util[_0xd748('0x18')](_0xd748('0x3b'),_0x3b892c[_0xd748('0x1d')]),_0x3b892c);calls['newexten'](_0x3b892c);recordings[_0xd748('0x3a')](_0x3b892c);dials[_0xd748('0x3a')](_0x3b892c);}catch(_0x21c7dd){utils[_0xd748('0x13')](util['format'](_0xd748('0x3b'),_0x3b892c[_0xd748('0x1d')]),_0x21c7dd);}});ami['on']('newchannel',function(_0x498f53){try{utils[_0xd748('0x17')](util[_0xd748('0x18')]('[%s][index][newchannel]',_0x498f53[_0xd748('0x1d')]),_0x498f53);calls[_0xd748('0x3c')](_0x498f53);recordings[_0xd748('0x3c')](_0x498f53);}catch(_0xeb5c5e){utils[_0xd748('0x13')](util[_0xd748('0x18')](_0xd748('0x3d'),_0x498f53[_0xd748('0x1d')]),_0xeb5c5e);}});ami['on']('dialbegin',function(_0x2714c0){try{utils[_0xd748('0x17')](util[_0xd748('0x18')](_0xd748('0x3e'),_0x2714c0[_0xd748('0x1d')]),_0x2714c0);dials[_0xd748('0x3f')](_0x2714c0);}catch(_0x488a19){utils[_0xd748('0x13')](util[_0xd748('0x18')]('[%s]dialbegin',_0x2714c0[_0xd748('0x1d')]),_0x488a19);}});ami['on']('dialend',function(_0x1a1d5c){try{utils[_0xd748('0x17')](util['format'](_0xd748('0x40'),_0x1a1d5c[_0xd748('0x1d')]),_0x1a1d5c);dials[_0xd748('0x41')](_0x1a1d5c);}catch(_0x7b75fc){utils[_0xd748('0x13')](util[_0xd748('0x18')]('[%s][index][dialend]',_0x1a1d5c['uniqueid']),_0x7b75fc);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index a516562..4e8fd73 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 _0x9c45=['[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2','membername','type','getUserByInterface','interface','then','internal','request','CreateMemberReport','getUserByName','name','catch','error','some','devicestatechange','debug','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','agent','isNil','now','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','assign','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','exitAt','destinationchannel','split','data3','Local/_attended@transfer','Queue:','format'];(function(_0x3fa296,_0x2bd315){var _0x10b19f=function(_0x2c868d){while(--_0x2c868d){_0x3fa296['push'](_0x3fa296['shift']());}};_0x10b19f(++_0x2bd315);}(_0x9c45,0x123));var _0x59c4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9c45[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var members={};var exclude=[_0x59c4('0x0'),_0x59c4('0x1')];function writeDB(_0x24cf7b){utils['info'](util[_0x59c4('0x2')](_0x59c4('0x3'),_0x24cf7b[_0x59c4('0x4')],_0x24cf7b['interface'],_0x24cf7b[_0x59c4('0x5')],_0x24cf7b[_0x59c4('0x6')],_0x24cf7b[_0x59c4('0x7')],_0x24cf7b[_0x59c4('0x8')]));if(_0x24cf7b['interface']){utils[_0x59c4('0x9')](_0x24cf7b[_0x59c4('0xa')])[_0x59c4('0xb')](function(_0x4aa629){if(_0x4aa629){_0x24cf7b['membername']=_0x4aa629['name'];_0x24cf7b['internal']=_0x4aa629[_0x59c4('0xc')];utils[_0x59c4('0xd')](_0x59c4('0xe'),_0x24cf7b);}else{utils[_0x59c4('0xf')](_0x24cf7b[_0x59c4('0xa')]['split']('/')[0x1])[_0x59c4('0xb')](function(_0x523259){if(_0x523259){_0x24cf7b['membername']=_0x523259[_0x59c4('0x10')];_0x24cf7b[_0x59c4('0xc')]=_0x523259[_0x59c4('0xc')];utils[_0x59c4('0xd')]('CreateMemberReport',_0x24cf7b);}});}})[_0x59c4('0x11')](function(_0x4f3acb){utils[_0x59c4('0x12')](util[_0x59c4('0x2')]('[%s][members][writeDB]',_0x24cf7b[_0x59c4('0x4')]),_0x4f3acb);});}delete members[_0x24cf7b[_0x59c4('0xa')]];}function startsWith(_0x2cc355,_0x4f0f0a){return _[_0x59c4('0x13')](_0x2cc355,function(_0x3c83c4){return _['startsWith'](_0x4f0f0a,_0x3c83c4);});}exports[_0x59c4('0x14')]=function(_0x2c496b){try{utils[_0x59c4('0x15')](util[_0x59c4('0x2')](_0x59c4('0x16'),members[_0x2c496b[_0x59c4('0x17')]]?members[_0x2c496b[_0x59c4('0x17')]][_0x59c4('0x4')]:_0x2c496b[_0x59c4('0x17')]),_0x2c496b);utils[_0x59c4('0x18')](util[_0x59c4('0x2')](_0x59c4('0x19'),members[_0x2c496b[_0x59c4('0x17')]]?members[_0x2c496b['device']][_0x59c4('0x4')]:_0x2c496b[_0x59c4('0x17')],_0x2c496b[_0x59c4('0x1a')],_0x2c496b[_0x59c4('0x17')]));switch(_0x2c496b['state']){case'INUSE':case _0x59c4('0x1b'):if(!startsWith(exclude,_0x2c496b['device'])){members[_0x2c496b[_0x59c4('0x17')]]={'channel':_0x59c4('0x1c'),'interface':_0x2c496b[_0x59c4('0x17')],'type':_0x59c4('0x1d'),'enterAt':utils['now'](),'role':_0x59c4('0x1e')};}break;case'NOT_INUSE':if(!_[_0x59c4('0x1f')](members[_0x2c496b[_0x59c4('0x17')]])){members[_0x2c496b[_0x59c4('0x17')]]['exitAt']=utils[_0x59c4('0x20')]();members[_0x2c496b['device']]['duration']=utils[_0x59c4('0x21')](members[_0x2c496b[_0x59c4('0x17')]]['exitAt'],members[_0x2c496b[_0x59c4('0x17')]][_0x59c4('0x22')]);if(members[_0x2c496b[_0x59c4('0x17')]][_0x59c4('0x4')]){writeDB(members[_0x2c496b[_0x59c4('0x17')]]);}}break;default:break;}}catch(_0x2b07fd){utils[_0x59c4('0x12')](util['format'](_0x59c4('0x16'),members[_0x2c496b[_0x59c4('0x17')]]?members[_0x2c496b['device']][_0x59c4('0x4')]:_0x2c496b[_0x59c4('0x17')]),_0x2b07fd);}};exports[_0x59c4('0x23')]=function(_0xcfc041){try{if(!_[_0x59c4('0x1f')](members[_0xcfc041['interface']])){utils[_0x59c4('0x15')](util['format'](_0x59c4('0x24'),_0xcfc041[_0x59c4('0x4')]),_0xcfc041);utils['info'](util[_0x59c4('0x2')](_0x59c4('0x25'),_0xcfc041[_0x59c4('0x4')],_0xcfc041[_0x59c4('0xa')],_0xcfc041[_0x59c4('0x26')]));members[_0xcfc041['interface']]=_['assign'](members[_0xcfc041[_0x59c4('0xa')]],{'data4':_0xcfc041['queue'],'uniqueid':_0xcfc041['uniqueid']});}}catch(_0x4107fa){utils[_0x59c4('0x12')](util['format']('[%s][members][agentcomplete]',_0xcfc041['uniqueid']),_0x4107fa);}};exports[_0x59c4('0x27')]=function(_0x59d16a){try{utils[_0x59c4('0x15')](util[_0x59c4('0x2')]('[%s][members][cdr]',_0x59d16a[_0x59c4('0x4')]),_0x59d16a);if(_0x59d16a[_0x59c4('0x5')]){var _0xfe698d=_0x59d16a[_0x59c4('0x5')]['split']('-')[0x0];if(!_[_0x59c4('0x1f')](members[_0xfe698d])){members[_0xfe698d]=_[_0x59c4('0x28')](members[_0xfe698d],{'data1':members[_0xfe698d][_0x59c4('0x29')]||_0x59d16a[_0x59c4('0x8')],'data2':members[_0xfe698d][_0x59c4('0x6')]||_0x59d16a[_0x59c4('0x2a')],'data3':members[_0xfe698d]['data3']||_0x59d16a[_0x59c4('0x2b')],'uniqueid':members[_0xfe698d]['uniqueid']||_0x59d16a['uniqueid']});utils[_0x59c4('0x18')](util[_0x59c4('0x2')](_0x59c4('0x2c'),_0x59d16a['uniqueid'],members[_0xfe698d][_0x59c4('0x29')],members[_0xfe698d]['data2'],members[_0xfe698d]['data3']));if(members[_0xfe698d][_0x59c4('0x2d')]){writeDB(members[_0xfe698d]);}}}if(_0x59d16a[_0x59c4('0x2e')]){var _0x57adc=_0x59d16a['destinationchannel'][_0x59c4('0x2f')]('-')[0x0];if(!_[_0x59c4('0x1f')](members[_0x57adc])){members[_0x57adc]=_['assign'](members[_0x57adc],{'data1':members[_0x57adc][_0x59c4('0x29')]||_0x59d16a['type'],'data2':members[_0x57adc][_0x59c4('0x6')]||_0x59d16a[_0x59c4('0x2a')],'data3':members[_0x57adc][_0x59c4('0x30')]||_0x59d16a[_0x59c4('0x2b')],'uniqueid':members[_0x57adc][_0x59c4('0x4')]||_0x59d16a[_0x59c4('0x4')]});utils[_0x59c4('0x18')](util[_0x59c4('0x2')](_0x59c4('0x2c'),_0x59d16a[_0x59c4('0x4')],members[_0x57adc][_0x59c4('0x29')],members[_0x57adc]['data2'],members[_0x57adc][_0x59c4('0x30')]));if(members[_0x57adc][_0x59c4('0x2d')]){writeDB(members[_0x57adc]);}}}}catch(_0x3e1322){utils[_0x59c4('0x12')](util[_0x59c4('0x2')]('[%s][members][cdr]',_0x59d16a[_0x59c4('0x4')]),_0x3e1322);}}; \ No newline at end of file +var _0x823b=['request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','format','[%s][members][devicestatechange]','device','info','state','INUSE','voice','TALKING','now','NOT_INUSE','isNil','diffTime','exitAt','enterAt','agentcomplete','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','data2','source','destination','data1','data3','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','./utils','Local/_attended@transfer','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','type','getUserByInterface','then','membername','name','internal'];(function(_0x26ebc3,_0x53c440){var _0x23d08b=function(_0x36d4a1){while(--_0x36d4a1){_0x26ebc3['push'](_0x26ebc3['shift']());}};_0x23d08b(++_0x53c440);}(_0x823b,0xed));var _0xb823=function(_0x47a539,_0x41d609){_0x47a539=_0x47a539-0x0;var _0x456304=_0x823b[_0x47a539];return _0x456304;};'use strict';var _=require(_0xb823('0x0'));var util=require('util');var utils=require(_0xb823('0x1'));var members={};var exclude=[_0xb823('0x2'),'Queue:'];function writeDB(_0x1a4937){utils['info'](util['format'](_0xb823('0x3'),_0x1a4937[_0xb823('0x4')],_0x1a4937[_0xb823('0x5')],_0x1a4937[_0xb823('0x6')],_0x1a4937['data2'],_0x1a4937['membername'],_0x1a4937[_0xb823('0x7')]));if(_0x1a4937[_0xb823('0x5')]){utils[_0xb823('0x8')](_0x1a4937[_0xb823('0x5')])[_0xb823('0x9')](function(_0xcee62a){if(_0xcee62a){_0x1a4937[_0xb823('0xa')]=_0xcee62a[_0xb823('0xb')];_0x1a4937[_0xb823('0xc')]=_0xcee62a[_0xb823('0xc')];utils[_0xb823('0xd')](_0xb823('0xe'),_0x1a4937);}else{utils[_0xb823('0xf')](_0x1a4937[_0xb823('0x5')][_0xb823('0x10')]('/')[0x1])[_0xb823('0x9')](function(_0xe62c94){if(_0xe62c94){_0x1a4937[_0xb823('0xa')]=_0xe62c94[_0xb823('0xb')];_0x1a4937[_0xb823('0xc')]=_0xe62c94[_0xb823('0xc')];utils[_0xb823('0xd')]('CreateMemberReport',_0x1a4937);}});}})[_0xb823('0x11')](function(_0x26ee46){utils[_0xb823('0x12')](util['format'](_0xb823('0x13'),_0x1a4937[_0xb823('0x4')]),_0x26ee46);});}delete members[_0x1a4937[_0xb823('0x5')]];}function startsWith(_0x37e9c7,_0x35e1c4){return _[_0xb823('0x14')](_0x37e9c7,function(_0x271e71){return _['startsWith'](_0x35e1c4,_0x271e71);});}exports['devicestatechange']=function(_0x11105e){try{utils['debug'](util[_0xb823('0x15')](_0xb823('0x16'),members[_0x11105e[_0xb823('0x17')]]?members[_0x11105e[_0xb823('0x17')]][_0xb823('0x4')]:_0x11105e[_0xb823('0x17')]),_0x11105e);utils[_0xb823('0x18')](util[_0xb823('0x15')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x11105e[_0xb823('0x17')]]?members[_0x11105e[_0xb823('0x17')]][_0xb823('0x4')]:_0x11105e[_0xb823('0x17')],_0x11105e['state'],_0x11105e[_0xb823('0x17')]));switch(_0x11105e[_0xb823('0x19')]){case _0xb823('0x1a'):case'BUSY':if(!startsWith(exclude,_0x11105e['device'])){members[_0x11105e[_0xb823('0x17')]]={'channel':_0xb823('0x1b'),'interface':_0x11105e[_0xb823('0x17')],'type':_0xb823('0x1c'),'enterAt':utils[_0xb823('0x1d')](),'role':'agent'};}break;case _0xb823('0x1e'):if(!_[_0xb823('0x1f')](members[_0x11105e[_0xb823('0x17')]])){members[_0x11105e[_0xb823('0x17')]]['exitAt']=utils[_0xb823('0x1d')]();members[_0x11105e[_0xb823('0x17')]]['duration']=utils[_0xb823('0x20')](members[_0x11105e[_0xb823('0x17')]][_0xb823('0x21')],members[_0x11105e[_0xb823('0x17')]][_0xb823('0x22')]);if(members[_0x11105e['device']]['uniqueid']){writeDB(members[_0x11105e[_0xb823('0x17')]]);}}break;default:break;}}catch(_0x2058c1){utils['error'](util['format'](_0xb823('0x16'),members[_0x11105e['device']]?members[_0x11105e[_0xb823('0x17')]][_0xb823('0x4')]:_0x11105e[_0xb823('0x17')]),_0x2058c1);}};exports[_0xb823('0x23')]=function(_0x6d3690){try{if(!_[_0xb823('0x1f')](members[_0x6d3690['interface']])){utils[_0xb823('0x24')](util[_0xb823('0x15')](_0xb823('0x25'),_0x6d3690['uniqueid']),_0x6d3690);utils['info'](util[_0xb823('0x15')](_0xb823('0x26'),_0x6d3690[_0xb823('0x4')],_0x6d3690[_0xb823('0x5')],_0x6d3690['queue']));members[_0x6d3690[_0xb823('0x5')]]=_[_0xb823('0x27')](members[_0x6d3690['interface']],{'data4':_0x6d3690[_0xb823('0x28')],'uniqueid':_0x6d3690[_0xb823('0x4')]});}}catch(_0x1488a4){utils[_0xb823('0x12')](util[_0xb823('0x15')](_0xb823('0x25'),_0x6d3690[_0xb823('0x4')]),_0x1488a4);}};exports[_0xb823('0x29')]=function(_0x562dae){try{utils[_0xb823('0x24')](util[_0xb823('0x15')](_0xb823('0x2a'),_0x562dae['uniqueid']),_0x562dae);if(_0x562dae[_0xb823('0x6')]){var _0x57cdec=_0x562dae['channel'][_0xb823('0x10')]('-')[0x0];if(!_[_0xb823('0x1f')](members[_0x57cdec])){members[_0x57cdec]=_[_0xb823('0x27')](members[_0x57cdec],{'data1':members[_0x57cdec]['data1']||_0x562dae[_0xb823('0x7')],'data2':members[_0x57cdec][_0xb823('0x2b')]||_0x562dae[_0xb823('0x2c')],'data3':members[_0x57cdec]['data3']||_0x562dae[_0xb823('0x2d')],'uniqueid':members[_0x57cdec][_0xb823('0x4')]||_0x562dae[_0xb823('0x4')]});utils[_0xb823('0x18')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x562dae[_0xb823('0x4')],members[_0x57cdec][_0xb823('0x2e')],members[_0x57cdec]['data2'],members[_0x57cdec][_0xb823('0x2f')]));if(members[_0x57cdec][_0xb823('0x21')]){writeDB(members[_0x57cdec]);}}}if(_0x562dae['destinationchannel']){var _0x1dca90=_0x562dae[_0xb823('0x30')]['split']('-')[0x0];if(!_[_0xb823('0x1f')](members[_0x1dca90])){members[_0x1dca90]=_[_0xb823('0x27')](members[_0x1dca90],{'data1':members[_0x1dca90][_0xb823('0x2e')]||_0x562dae[_0xb823('0x7')],'data2':members[_0x1dca90][_0xb823('0x2b')]||_0x562dae['source'],'data3':members[_0x1dca90][_0xb823('0x2f')]||_0x562dae[_0xb823('0x2d')],'uniqueid':members[_0x1dca90][_0xb823('0x4')]||_0x562dae[_0xb823('0x4')]});utils['info'](util[_0xb823('0x15')](_0xb823('0x31'),_0x562dae[_0xb823('0x4')],members[_0x1dca90][_0xb823('0x2e')],members[_0x1dca90][_0xb823('0x2b')],members[_0x1dca90][_0xb823('0x2f')]));if(members[_0x1dca90][_0xb823('0x21')]){writeDB(members[_0x1dca90]);}}}}catch(_0x464c97){utils[_0xb823('0x12')](util[_0xb823('0x15')](_0xb823('0x2a'),_0x562dae[_0xb823('0x4')]),_0x464c97);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 6cdcbd5..80a2177 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 _0xc224=['[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','origtransfererlinkedid','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','queuecallerjoin','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerexitreason','transfereduniqueid','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','value','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','membername','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime'];(function(_0x1b0caa,_0x10e702){var _0x21b2d8=function(_0x452639){while(--_0x452639){_0x1b0caa['push'](_0x1b0caa['shift']());}};_0x21b2d8(++_0x10e702);}(_0xc224,0x1af));var _0x4c22=function(_0x472f4d,_0x1a88f9){_0x472f4d=_0x472f4d-0x0;var _0x5bc85a=_0xc224[_0x472f4d];return _0x5bc85a;};'use strict';var _=require(_0x4c22('0x0'));var util=require(_0x4c22('0x1'));var utils=require(_0x4c22('0x2'));var queues={};function writeDB(_0x55fe83){utils[_0x4c22('0x3')](util[_0x4c22('0x4')](_0x4c22('0x5'),_0x55fe83[_0x4c22('0x6')],_0x55fe83[_0x4c22('0x7')],_0x55fe83[_0x4c22('0x8')],_0x55fe83[_0x4c22('0x9')],_0x55fe83[_0x4c22('0xa')],_0x55fe83['accountcode'],_0x55fe83['queuecallerexitreason']));if(_0x55fe83['queue']){utils[_0x4c22('0xb')](_0x55fe83[_0x4c22('0x8')])[_0x4c22('0xc')](function(_0x309dad){if(_0x309dad){_0x55fe83[_0x4c22('0xd')]=_0x309dad[_0x4c22('0xd')];}utils[_0x4c22('0xe')]('CreateVoiceQueueReport',_0x55fe83);});}else{utils[_0x4c22('0xe')](_0x4c22('0xf'),_0x55fe83);}if(_0x55fe83['transfereduniqueid']){delete queues[_0x55fe83['transfereduniqueid']];}else{delete queues[_0x55fe83[_0x4c22('0x6')]];}}exports[_0x4c22('0x10')]=function(_0x3f64fc){try{utils['debug'](util[_0x4c22('0x4')]('[%s][queues][queuecallerjoin]',_0x3f64fc['uniqueid']),_0x3f64fc);utils['info'](util[_0x4c22('0x4')](_0x4c22('0x11'),_0x3f64fc[_0x4c22('0x6')],_0x3f64fc[_0x4c22('0x8')],_0x3f64fc[_0x4c22('0x12')]));queues[_0x3f64fc['uniqueid']]=_[_0x4c22('0x13')](_0x3f64fc,{'originalposition':_0x3f64fc[_0x4c22('0x12')],'queuecallerjoinAt':utils[_0x4c22('0x14')](),'mohtime':0x0});}catch(_0x31bbd0){utils[_0x4c22('0x15')](util['format']('[%s][queues][queuecallerjoin]',_0x3f64fc[_0x4c22('0x6')]),_0x31bbd0);}};exports[_0x4c22('0x16')]=function(_0x46aaaa){try{if(!_[_0x4c22('0x17')](queues[_0x46aaaa[_0x4c22('0x6')]])){utils[_0x4c22('0x18')](util[_0x4c22('0x4')](_0x4c22('0x19'),_0x46aaaa[_0x4c22('0x6')]),_0x46aaaa);if(queues[_0x46aaaa['uniqueid']][_0x4c22('0x1a')]){if(!queues[_0x46aaaa['uniqueid']]['queuecallerabandon']&&!queues[_0x46aaaa[_0x4c22('0x6')]][_0x4c22('0x1b')]){queues[_0x46aaaa[_0x4c22('0x6')]][_0x4c22('0x1c')]=!![];queues[_0x46aaaa[_0x4c22('0x6')]][_0x4c22('0x1d')]=utils['now']();queues[_0x46aaaa[_0x4c22('0x6')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0x4c22('0x3')](util[_0x4c22('0x4')](_0x4c22('0x1e'),_0x46aaaa[_0x4c22('0x6')],queues[_0x46aaaa[_0x4c22('0x6')]][_0x4c22('0x1f')],queues[_0x46aaaa[_0x4c22('0x6')]][_0x4c22('0x20')]));writeDB(queues[_0x46aaaa[_0x4c22('0x6')]]);}else if(queues[_0x46aaaa[_0x4c22('0x6')]][_0x4c22('0x21')]){utils[_0x4c22('0x3')](util[_0x4c22('0x4')](_0x4c22('0x22'),_0x46aaaa[_0x4c22('0x6')],queues[_0x46aaaa['uniqueid']][_0x4c22('0x1f')],queues[_0x46aaaa[_0x4c22('0x6')]]['transfereduniqueid']));queues[queues[_0x46aaaa[_0x4c22('0x6')]][_0x4c22('0x21')]]=queues[_0x46aaaa['uniqueid']];queues[queues[_0x46aaaa[_0x4c22('0x6')]][_0x4c22('0x21')]][_0x4c22('0x23')]=0x2;delete queues[_0x46aaaa[_0x4c22('0x6')]];}}}catch(_0x49193f){utils[_0x4c22('0x15')](util[_0x4c22('0x4')](_0x4c22('0x19'),_0x46aaaa['uniqueid']),_0x49193f);}};exports[_0x4c22('0x24')]=function(_0x24f42e){try{utils[_0x4c22('0x18')](util[_0x4c22('0x4')](_0x4c22('0x25'),_0x24f42e[_0x4c22('0x6')]),_0x24f42e);if(!_['isNil'](_0x24f42e[_0x4c22('0x26')]['queuestatus'])&&_0x24f42e['value']['toUpperCase']()!==_0x4c22('0x27')){if(!_[_0x4c22('0x17')](queues[_0x24f42e[_0x4c22('0x6')]])){queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x28')]=![];queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x29')]=null;queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x1b')]=!![];queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x2a')]=utils[_0x4c22('0x14')]();queues[_0x24f42e['uniqueid']]['queuecallerexitreason']=_0x24f42e[_0x4c22('0x2b')][_0x4c22('0x2c')]();utils[_0x4c22('0x3')](util[_0x4c22('0x4')](_0x4c22('0x2d'),_0x24f42e[_0x4c22('0x6')],queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x1f')],_0x24f42e['value'],queues[_0x24f42e['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x24f42e['uniqueid']]);}}else if(!_[_0x4c22('0x17')](_0x24f42e[_0x4c22('0x26')][_0x4c22('0x2e')])){if(!_[_0x4c22('0x17')](queues[_0x24f42e[_0x4c22('0x6')]])&&!queues[_0x24f42e['uniqueid']][_0x4c22('0x28')]){queues[_0x24f42e['uniqueid']][_0x4c22('0x28')]=![];queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x29')]=null;queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x1b')]=!![];queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x2a')]=utils[_0x4c22('0x14')]();queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x20')]='EXITWITHKEY';utils[_0x4c22('0x3')](util[_0x4c22('0x4')](_0x4c22('0x2f'),_0x24f42e[_0x4c22('0x6')],queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x1f')],_0x24f42e[_0x4c22('0x2b')],queues[_0x24f42e[_0x4c22('0x6')]][_0x4c22('0x20')]));}}}catch(_0x5122e0){utils[_0x4c22('0x15')](util[_0x4c22('0x4')](_0x4c22('0x25'),_0x24f42e[_0x4c22('0x6')]),_0x5122e0);}};exports['queuecallerabandon']=function(_0x21f1b9){try{if(!_['isNil'](queues[_0x21f1b9['uniqueid']])){utils[_0x4c22('0x18')](util[_0x4c22('0x4')](_0x4c22('0x30'),_0x21f1b9[_0x4c22('0x6')]),_0x21f1b9);queues[_0x21f1b9[_0x4c22('0x6')]][_0x4c22('0x1b')]=![];queues[_0x21f1b9['uniqueid']][_0x4c22('0x2a')]=null;queues[_0x21f1b9[_0x4c22('0x6')]][_0x4c22('0x28')]=!![];queues[_0x21f1b9[_0x4c22('0x6')]]['queuecallerabandonAt']=utils['now']();queues[_0x21f1b9[_0x4c22('0x6')]]['queuecallerexitreason']=_0x4c22('0x31');utils[_0x4c22('0x3')](util['format']('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x21f1b9[_0x4c22('0x6')],queues[_0x21f1b9['uniqueid']][_0x4c22('0x1f')],queues[_0x21f1b9[_0x4c22('0x6')]]['queuecallerexitreason']));}}catch(_0x146424){utils[_0x4c22('0x15')](util[_0x4c22('0x4')](_0x4c22('0x30'),_0x21f1b9['uniqueid']),_0x146424);}};exports[_0x4c22('0x32')]=function(_0x48b804){try{if(!_[_0x4c22('0x17')](queues[_0x48b804[_0x4c22('0x6')]])){utils[_0x4c22('0x18')](util['format'](_0x4c22('0x33'),_0x48b804[_0x4c22('0x6')]),_0x48b804);utils['info'](util[_0x4c22('0x4')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x48b804[_0x4c22('0x6')],queues[_0x48b804[_0x4c22('0x6')]][_0x4c22('0x1f')],_0x48b804[_0x4c22('0x34')],_0x48b804[_0x4c22('0x35')]));queues[_0x48b804['uniqueid']][_0x4c22('0x32')]=!![];queues[_0x48b804[_0x4c22('0x6')]][_0x4c22('0x1a')]=utils['now']();queues[_0x48b804['uniqueid']][_0x4c22('0x36')]=utils['diffTime'](queues[_0x48b804[_0x4c22('0x6')]][_0x4c22('0x1a')],queues[_0x48b804[_0x4c22('0x6')]]['queuecallerjoinAt']);queues[_0x48b804[_0x4c22('0x6')]]['position']=_0x48b804['position'];queues[_0x48b804[_0x4c22('0x6')]][_0x4c22('0x37')]=_0x48b804['count'];queues[_0x48b804[_0x4c22('0x6')]][_0x4c22('0x34')]=_0x48b804[_0x4c22('0x34')];queues[_0x48b804[_0x4c22('0x6')]]['connectedlinename']=_0x48b804[_0x4c22('0x35')];}}catch(_0x8102d7){utils[_0x4c22('0x15')](util[_0x4c22('0x4')](_0x4c22('0x33'),_0x48b804[_0x4c22('0x6')]),_0x8102d7);}};exports[_0x4c22('0x38')]=function(_0x5938db){try{if(!_[_0x4c22('0x17')](queues[_0x5938db[_0x4c22('0x6')]])){utils[_0x4c22('0x18')](util[_0x4c22('0x4')](_0x4c22('0x39'),_0x5938db['uniqueid']),_0x5938db);utils[_0x4c22('0x3')](util['format'](_0x4c22('0x3a'),_0x5938db['uniqueid'],queues[_0x5938db[_0x4c22('0x6')]][_0x4c22('0x1f')],_0x5938db['membername'],_0x5938db[_0x4c22('0x3b')]));queues[_0x5938db[_0x4c22('0x6')]][_0x4c22('0x28')]=![];queues[_0x5938db[_0x4c22('0x6')]]['queuecallerabandon']=![];queues[_0x5938db['uniqueid']][_0x4c22('0x29')]=null;queues[_0x5938db[_0x4c22('0x6')]]['queuecallerexit']=![];queues[_0x5938db['uniqueid']][_0x4c22('0x20')]=null;queues[_0x5938db[_0x4c22('0x6')]]['queuecallerexitAt']=null;queues[_0x5938db[_0x4c22('0x6')]][_0x4c22('0x3c')]=!![];queues[_0x5938db[_0x4c22('0x6')]][_0x4c22('0x3d')]=_0x5938db[_0x4c22('0x3b')];queues[_0x5938db[_0x4c22('0x6')]][_0x4c22('0x9')]=_0x5938db['membername'];}}catch(_0x200a95){utils[_0x4c22('0x15')](util[_0x4c22('0x4')](_0x4c22('0x39'),_0x5938db['uniqueid']),_0x200a95);}};exports[_0x4c22('0x3e')]=function(_0x2a3418){try{if(!_['isNil'](queues[_0x2a3418[_0x4c22('0x6')]])){if(queues[_0x2a3418[_0x4c22('0x6')]][_0x4c22('0x1a')]){utils[_0x4c22('0x18')](util['format'](_0x4c22('0x3f'),_0x2a3418['uniqueid']),_0x2a3418);queues[_0x2a3418[_0x4c22('0x6')]][_0x4c22('0x28')]=![];queues[_0x2a3418[_0x4c22('0x6')]]['queuecallerabandon']=![];queues[_0x2a3418[_0x4c22('0x6')]][_0x4c22('0x29')]=null;queues[_0x2a3418[_0x4c22('0x6')]][_0x4c22('0x1b')]=![];queues[_0x2a3418[_0x4c22('0x6')]]['queuecallerexitAt']=null;queues[_0x2a3418[_0x4c22('0x6')]][_0x4c22('0x3c')]=!![];queues[_0x2a3418['uniqueid']][_0x4c22('0x9')]=_0x2a3418['membername'];queues[_0x2a3418[_0x4c22('0x6')]][_0x4c22('0x1c')]=!![];queues[_0x2a3418[_0x4c22('0x6')]][_0x4c22('0x1d')]=utils['now']();if(_0x2a3418[_0x4c22('0x40')]==_0x4c22('0x41')){if(!queues[_0x2a3418[_0x4c22('0x6')]][_0x4c22('0x41')]){queues[_0x2a3418[_0x4c22('0x6')]][_0x4c22('0x20')]=_0x4c22('0x42');}}else{queues[_0x2a3418[_0x4c22('0x6')]]['queuecallerexitreason']=_0x4c22('0x43')+_0x2a3418['reason']['toUpperCase']();}utils[_0x4c22('0x3')](util[_0x4c22('0x4')](_0x4c22('0x44'),_0x2a3418['uniqueid'],queues[_0x2a3418['uniqueid']][_0x4c22('0x1f')],_0x2a3418[_0x4c22('0x45')],queues[_0x2a3418['uniqueid']][_0x4c22('0x20')]));writeDB(queues[_0x2a3418[_0x4c22('0x6')]]);}}}catch(_0x4ae0fd){utils['error'](util[_0x4c22('0x4')](_0x4c22('0x3f'),_0x2a3418[_0x4c22('0x6')]),_0x4ae0fd);}};exports['blindtransfer']=function(_0x4a4f3f){try{if(!_[_0x4c22('0x17')](queues[_0x4a4f3f[_0x4c22('0x46')]])){utils[_0x4c22('0x18')](util['format'](_0x4c22('0x47'),_0x4a4f3f[_0x4c22('0x6')]),_0x4a4f3f);queues[_0x4a4f3f[_0x4c22('0x46')]][_0x4c22('0x41')]=!![];queues[_0x4a4f3f[_0x4c22('0x46')]][_0x4c22('0x48')]=_0x4c22('0x49');queues[_0x4a4f3f[_0x4c22('0x46')]][_0x4c22('0x4a')]=_0x4a4f3f[_0x4c22('0x4b')];queues[_0x4a4f3f[_0x4c22('0x46')]][_0x4c22('0x4c')]=_0x4a4f3f['transfereeuniqueid'];queues[_0x4a4f3f[_0x4c22('0x46')]]['queuecallerexitreason']=_0x4c22('0x4d');utils[_0x4c22('0x3')](util[_0x4c22('0x4')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x4a4f3f[_0x4c22('0x6')],queues[_0x4a4f3f[_0x4c22('0x46')]][_0x4c22('0x1f')],_0x4a4f3f['transfereeuniqueid'],_0x4a4f3f[_0x4c22('0x4b')]));}}catch(_0xc496c3){utils[_0x4c22('0x15')](util[_0x4c22('0x4')](_0x4c22('0x47'),_0x4a4f3f[_0x4c22('0x6')]),_0xc496c3);}};exports['attendedtransfer']=function(_0x1ff27d){try{utils['debug'](util['format'](_0x4c22('0x4e'),_0x1ff27d[_0x4c22('0x4f')]),_0x1ff27d);if(_0x1ff27d['origtransfereruniqueid']==_0x1ff27d['origtransfererlinkedid']){if(!_[_0x4c22('0x17')](queues[_0x1ff27d[_0x4c22('0x50')]])){utils['info'](util[_0x4c22('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x1ff27d[_0x4c22('0x4f')],queues[_0x1ff27d['secondtransfererlinkedid']]['name'],_0x1ff27d['origtransfererexten']));queues[_0x1ff27d[_0x4c22('0x50')]]['transfer']=!![];queues[_0x1ff27d[_0x4c22('0x50')]]['transfertype']=_0x4c22('0x51');queues[_0x1ff27d[_0x4c22('0x50')]]['transferexten']=_0x1ff27d[_0x4c22('0x52')];queues[_0x1ff27d[_0x4c22('0x50')]][_0x4c22('0x4c')]=_0x1ff27d['origtransfereruniqueid'];queues[_0x1ff27d[_0x4c22('0x50')]][_0x4c22('0x20')]=_0x4c22('0x53');}if(!_[_0x4c22('0x17')](queues[_0x1ff27d['origtransfererlinkedid']])){if(_0x1ff27d['transfereelinkedid']&&queues[_0x1ff27d[_0x4c22('0x54')]]){queues[_0x1ff27d['transfereelinkedid']][_0x4c22('0x23')]=0x1;queues[_0x1ff27d['transfereeuniqueid']]=_[_0x4c22('0x55')](queues[_0x1ff27d[_0x4c22('0x54')]]);queues[_0x1ff27d[_0x4c22('0x46')]][_0x4c22('0x21')]=_0x1ff27d[_0x4c22('0x56')];queues[_0x1ff27d[_0x4c22('0x46')]]['queuecallerenterreason']=0x2;queues[_0x1ff27d['transfereeuniqueid']][_0x4c22('0xa')]=queues[_0x1ff27d['secondtransfererlinkedid']]['calleridnum'];queues[_0x1ff27d[_0x4c22('0x46')]][_0x4c22('0x57')]=queues[_0x1ff27d[_0x4c22('0x50')]][_0x4c22('0x57')];queues[_0x1ff27d[_0x4c22('0x46')]]['queuecallerjoinAt']=utils[_0x4c22('0x14')]();queues[_0x1ff27d[_0x4c22('0x46')]][_0x4c22('0x1a')]=utils[_0x4c22('0x14')]();queues[_0x1ff27d[_0x4c22('0x46')]]['holdtime']=0x0;queues[_0x1ff27d[_0x4c22('0x46')]][_0x4c22('0x58')]=0x0;utils[_0x4c22('0x3')](util['format'](_0x4c22('0x59'),_0x1ff27d['origtransfereruniqueid'],queues[_0x1ff27d[_0x4c22('0x46')]][_0x4c22('0x1f')],queues[_0x1ff27d[_0x4c22('0x46')]][_0x4c22('0xa')],queues[_0x1ff27d[_0x4c22('0x46')]][_0x4c22('0x57')]));}else{utils[_0x4c22('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1ff27d['origtransfereruniqueid'],queues[_0x1ff27d[_0x4c22('0x5a')]][_0x4c22('0x1f')],_0x1ff27d[_0x4c22('0x50')]));queues[_0x1ff27d['origtransfererlinkedid']]['transfereduniqueid']=_0x1ff27d['secondtransfererlinkedid'];}}}else if(_0x1ff27d[_0x4c22('0x5b')]==_0x1ff27d[_0x4c22('0x50')]){if(!_['isNil'](queues[_0x1ff27d[_0x4c22('0x5a')]])){utils[_0x4c22('0x3')](util[_0x4c22('0x4')](_0x4c22('0x5c'),_0x1ff27d['origtransfereruniqueid'],queues[_0x1ff27d[_0x4c22('0x5a')]]['name'],_0x1ff27d[_0x4c22('0x5b')],_0x1ff27d['secondtransfererexten']));queues[_0x1ff27d[_0x4c22('0x5a')]][_0x4c22('0x41')]=!![];queues[_0x1ff27d[_0x4c22('0x5a')]][_0x4c22('0x48')]='ATTENDED';queues[_0x1ff27d[_0x4c22('0x5a')]][_0x4c22('0x4a')]=_0x1ff27d[_0x4c22('0x5d')];queues[_0x1ff27d[_0x4c22('0x5a')]][_0x4c22('0x4c')]=_0x1ff27d[_0x4c22('0x5b')];queues[_0x1ff27d['origtransfererlinkedid']]['queuecallerexitreason']=_0x4c22('0x53');}if(!_[_0x4c22('0x17')](queues[_0x1ff27d[_0x4c22('0x50')]])){if(_0x1ff27d[_0x4c22('0x5e')]&&queues[_0x1ff27d[_0x4c22('0x5e')]]){queues[_0x1ff27d[_0x4c22('0x5e')]][_0x4c22('0x23')]=0x1;queues[_0x1ff27d['transfertargetuniqueid']]=_[_0x4c22('0x55')](queues[_0x1ff27d['transfertargetlinkedid']]);queues[_0x1ff27d['transfertargetuniqueid']]['transfereduniqueid']=_0x1ff27d[_0x4c22('0x56')];queues[_0x1ff27d[_0x4c22('0x56')]][_0x4c22('0x23')]=0x2;queues[_0x1ff27d[_0x4c22('0x56')]][_0x4c22('0xa')]=queues[_0x1ff27d[_0x4c22('0x5a')]][_0x4c22('0xa')];queues[_0x1ff27d['transfertargetuniqueid']]['calleridname']=queues[_0x1ff27d[_0x4c22('0x5a')]][_0x4c22('0x57')];queues[_0x1ff27d['transfertargetuniqueid']][_0x4c22('0x5f')]=utils[_0x4c22('0x14')]();queues[_0x1ff27d[_0x4c22('0x56')]][_0x4c22('0x1a')]=utils[_0x4c22('0x14')]();queues[_0x1ff27d['transfertargetuniqueid']][_0x4c22('0x36')]=0x0;queues[_0x1ff27d['transfertargetuniqueid']]['mohtime']=0x0;utils[_0x4c22('0x3')](util[_0x4c22('0x4')](_0x4c22('0x60'),_0x1ff27d[_0x4c22('0x4f')],queues[_0x1ff27d[_0x4c22('0x56')]][_0x4c22('0x1f')],queues[_0x1ff27d[_0x4c22('0x56')]][_0x4c22('0x21')],queues[_0x1ff27d[_0x4c22('0x56')]]['calleridnum'],queues[_0x1ff27d['transfertargetuniqueid']][_0x4c22('0x57')]));}else{utils['info'](util[_0x4c22('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1ff27d[_0x4c22('0x4f')],queues[_0x1ff27d[_0x4c22('0x50')]][_0x4c22('0x1f')],_0x1ff27d[_0x4c22('0x5a')]));queues[_0x1ff27d[_0x4c22('0x50')]][_0x4c22('0x21')]=_0x1ff27d[_0x4c22('0x5a')];}}}}catch(_0x1af7af){utils[_0x4c22('0x15')](util[_0x4c22('0x4')](_0x4c22('0x4e'),_0x1ff27d[_0x4c22('0x4f')]),_0x1af7af);}};exports[_0x4c22('0x61')]=function(_0xdd89f7){try{if(!_[_0x4c22('0x17')](queues[_0xdd89f7[_0x4c22('0x6')]])){utils[_0x4c22('0x18')](util[_0x4c22('0x4')](_0x4c22('0x62'),_0xdd89f7[_0x4c22('0x6')]),_0xdd89f7);queues[_0xdd89f7[_0x4c22('0x6')]][_0x4c22('0x63')]=utils['now']();utils[_0x4c22('0x3')](util['format'](_0x4c22('0x64'),_0xdd89f7[_0x4c22('0x6')],queues[_0xdd89f7[_0x4c22('0x6')]]['name'],queues[_0xdd89f7['uniqueid']][_0x4c22('0x63')]));}}catch(_0x509d1d){utils[_0x4c22('0x15')](util[_0x4c22('0x4')](_0x4c22('0x62'),_0xdd89f7[_0x4c22('0x6')]),_0x509d1d);}};exports['musiconholdstop']=function(_0x82936a){try{if(!_[_0x4c22('0x17')](queues[_0x82936a[_0x4c22('0x6')]])){if(!_[_0x4c22('0x17')](queues[_0x82936a['uniqueid']][_0x4c22('0x63')])){utils['debug'](util[_0x4c22('0x4')](_0x4c22('0x65'),_0x82936a[_0x4c22('0x6')]),_0x82936a);queues[_0x82936a[_0x4c22('0x6')]][_0x4c22('0x58')]+=utils[_0x4c22('0x66')](utils[_0x4c22('0x14')](),queues[_0x82936a[_0x4c22('0x6')]][_0x4c22('0x63')]);utils['info'](util[_0x4c22('0x4')](_0x4c22('0x67'),_0x82936a['uniqueid'],queues[_0x82936a[_0x4c22('0x6')]][_0x4c22('0x1f')],queues[_0x82936a[_0x4c22('0x6')]]['mohtime']));delete queues[_0x82936a[_0x4c22('0x6')]][_0x4c22('0x63')];}}}catch(_0x5cdae5){utils[_0x4c22('0x15')](util[_0x4c22('0x4')](_0x4c22('0x65'),_0x82936a[_0x4c22('0x6')]),_0x5cdae5);}}; \ No newline at end of file +var _0x0120=['[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','position','assign','error','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','now','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerleaveAt','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','accountcode','destaccountcode','agentcomplete','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','clone'];(function(_0x545f6b,_0x473084){var _0x5aafa1=function(_0x28a3ce){while(--_0x28a3ce){_0x545f6b['push'](_0x545f6b['shift']());}};_0x5aafa1(++_0x473084);}(_0x0120,0x6f));var _0x0012=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x0120[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var utils=require(_0x0012('0x2'));var queues={};function writeDB(_0xb8d57c){utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x5'),_0xb8d57c[_0x0012('0x6')],_0xb8d57c[_0x0012('0x7')],_0xb8d57c[_0x0012('0x8')],_0xb8d57c[_0x0012('0x9')],_0xb8d57c[_0x0012('0xa')],_0xb8d57c['accountcode'],_0xb8d57c['queuecallerexitreason']));if(_0xb8d57c['queue']){utils[_0x0012('0xb')](_0xb8d57c[_0x0012('0x8')])[_0x0012('0xc')](function(_0x30176d){if(_0x30176d){_0xb8d57c[_0x0012('0xd')]=_0x30176d['type'];}utils[_0x0012('0xe')](_0x0012('0xf'),_0xb8d57c);});}else{utils[_0x0012('0xe')](_0x0012('0xf'),_0xb8d57c);}if(_0xb8d57c['transfereduniqueid']){delete queues[_0xb8d57c[_0x0012('0x10')]];}else{delete queues[_0xb8d57c['uniqueid']];}}exports[_0x0012('0x11')]=function(_0x1d1c02){try{utils[_0x0012('0x12')](util[_0x0012('0x4')](_0x0012('0x13'),_0x1d1c02['uniqueid']),_0x1d1c02);utils[_0x0012('0x3')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x1d1c02['uniqueid'],_0x1d1c02['queue'],_0x1d1c02[_0x0012('0x14')]));queues[_0x1d1c02['uniqueid']]=_[_0x0012('0x15')](_0x1d1c02,{'originalposition':_0x1d1c02[_0x0012('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x24f4ed){utils[_0x0012('0x16')](util[_0x0012('0x4')](_0x0012('0x13'),_0x1d1c02['uniqueid']),_0x24f4ed);}};exports['hangup']=function(_0x1e7fbe){try{if(!_[_0x0012('0x17')](queues[_0x1e7fbe[_0x0012('0x6')]])){utils[_0x0012('0x12')](util[_0x0012('0x4')](_0x0012('0x18'),_0x1e7fbe[_0x0012('0x6')]),_0x1e7fbe);if(queues[_0x1e7fbe[_0x0012('0x6')]]['queuecallerleaveAt']){if(!queues[_0x1e7fbe[_0x0012('0x6')]][_0x0012('0x19')]&&!queues[_0x1e7fbe['uniqueid']][_0x0012('0x1a')]){queues[_0x1e7fbe[_0x0012('0x6')]][_0x0012('0x1b')]=!![];queues[_0x1e7fbe[_0x0012('0x6')]]['queuecallercompleteAt']=utils['now']();queues[_0x1e7fbe[_0x0012('0x6')]][_0x0012('0x1c')]=_0x0012('0x1d');}utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x1e'),_0x1e7fbe[_0x0012('0x6')],queues[_0x1e7fbe[_0x0012('0x6')]]['name'],queues[_0x1e7fbe[_0x0012('0x6')]][_0x0012('0x1c')]));writeDB(queues[_0x1e7fbe['uniqueid']]);}else if(queues[_0x1e7fbe[_0x0012('0x6')]][_0x0012('0x10')]){utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x1f'),_0x1e7fbe['uniqueid'],queues[_0x1e7fbe[_0x0012('0x6')]][_0x0012('0x20')],queues[_0x1e7fbe[_0x0012('0x6')]][_0x0012('0x10')]));queues[queues[_0x1e7fbe[_0x0012('0x6')]][_0x0012('0x10')]]=queues[_0x1e7fbe[_0x0012('0x6')]];queues[queues[_0x1e7fbe[_0x0012('0x6')]][_0x0012('0x10')]][_0x0012('0x21')]=0x2;delete queues[_0x1e7fbe[_0x0012('0x6')]];}}}catch(_0x20b78f){utils[_0x0012('0x16')](util[_0x0012('0x4')](_0x0012('0x18'),_0x1e7fbe[_0x0012('0x6')]),_0x20b78f);}};exports[_0x0012('0x22')]=function(_0x1f4a0a){try{utils[_0x0012('0x12')](util[_0x0012('0x4')](_0x0012('0x23'),_0x1f4a0a['uniqueid']),_0x1f4a0a);if(!_[_0x0012('0x17')](_0x1f4a0a[_0x0012('0x24')]['queuestatus'])&&_0x1f4a0a[_0x0012('0x25')][_0x0012('0x26')]()!==_0x0012('0x27')){if(!_[_0x0012('0x17')](queues[_0x1f4a0a[_0x0012('0x6')]])){queues[_0x1f4a0a['uniqueid']][_0x0012('0x19')]=![];queues[_0x1f4a0a[_0x0012('0x6')]][_0x0012('0x28')]=null;queues[_0x1f4a0a['uniqueid']][_0x0012('0x1a')]=!![];queues[_0x1f4a0a[_0x0012('0x6')]][_0x0012('0x29')]=utils[_0x0012('0x2a')]();queues[_0x1f4a0a[_0x0012('0x6')]][_0x0012('0x1c')]=_0x1f4a0a['value'][_0x0012('0x26')]();utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x2b'),_0x1f4a0a['uniqueid'],queues[_0x1f4a0a['uniqueid']][_0x0012('0x20')],_0x1f4a0a[_0x0012('0x25')],queues[_0x1f4a0a[_0x0012('0x6')]][_0x0012('0x1c')]));writeDB(queues[_0x1f4a0a[_0x0012('0x6')]]);}}else if(!_[_0x0012('0x17')](_0x1f4a0a[_0x0012('0x24')]['queueposition'])){if(!_[_0x0012('0x17')](queues[_0x1f4a0a[_0x0012('0x6')]])&&!queues[_0x1f4a0a['uniqueid']][_0x0012('0x19')]){queues[_0x1f4a0a[_0x0012('0x6')]][_0x0012('0x19')]=![];queues[_0x1f4a0a[_0x0012('0x6')]][_0x0012('0x28')]=null;queues[_0x1f4a0a[_0x0012('0x6')]][_0x0012('0x1a')]=!![];queues[_0x1f4a0a['uniqueid']][_0x0012('0x29')]=utils['now']();queues[_0x1f4a0a[_0x0012('0x6')]]['queuecallerexitreason']='EXITWITHKEY';utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x2c'),_0x1f4a0a['uniqueid'],queues[_0x1f4a0a[_0x0012('0x6')]][_0x0012('0x20')],_0x1f4a0a[_0x0012('0x25')],queues[_0x1f4a0a[_0x0012('0x6')]][_0x0012('0x1c')]));}}}catch(_0x379780){utils[_0x0012('0x16')](util[_0x0012('0x4')]('[%s][queues][varset]',_0x1f4a0a[_0x0012('0x6')]),_0x379780);}};exports[_0x0012('0x19')]=function(_0x559751){try{if(!_[_0x0012('0x17')](queues[_0x559751[_0x0012('0x6')]])){utils[_0x0012('0x12')](util[_0x0012('0x4')]('[%s][queues][queuecallerabandon]',_0x559751['uniqueid']),_0x559751);queues[_0x559751[_0x0012('0x6')]]['queuecallerexit']=![];queues[_0x559751[_0x0012('0x6')]][_0x0012('0x29')]=null;queues[_0x559751[_0x0012('0x6')]][_0x0012('0x19')]=!![];queues[_0x559751[_0x0012('0x6')]]['queuecallerabandonAt']=utils[_0x0012('0x2a')]();queues[_0x559751[_0x0012('0x6')]]['queuecallerexitreason']=_0x0012('0x2d');utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x2e'),_0x559751['uniqueid'],queues[_0x559751['uniqueid']][_0x0012('0x20')],queues[_0x559751['uniqueid']][_0x0012('0x1c')]));}}catch(_0x56fac8){utils[_0x0012('0x16')](util[_0x0012('0x4')](_0x0012('0x2f'),_0x559751[_0x0012('0x6')]),_0x56fac8);}};exports['queuecallerleave']=function(_0x1de7d5){try{if(!_['isNil'](queues[_0x1de7d5[_0x0012('0x6')]])){utils[_0x0012('0x12')](util[_0x0012('0x4')](_0x0012('0x30'),_0x1de7d5[_0x0012('0x6')]),_0x1de7d5);utils[_0x0012('0x3')](util[_0x0012('0x4')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x1de7d5[_0x0012('0x6')],queues[_0x1de7d5[_0x0012('0x6')]][_0x0012('0x20')],_0x1de7d5[_0x0012('0x31')],_0x1de7d5[_0x0012('0x32')]));queues[_0x1de7d5[_0x0012('0x6')]]['queuecallerleave']=!![];queues[_0x1de7d5['uniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x1de7d5[_0x0012('0x6')]][_0x0012('0x33')]=utils[_0x0012('0x34')](queues[_0x1de7d5[_0x0012('0x6')]][_0x0012('0x35')],queues[_0x1de7d5['uniqueid']][_0x0012('0x36')]);queues[_0x1de7d5[_0x0012('0x6')]][_0x0012('0x14')]=_0x1de7d5[_0x0012('0x14')];queues[_0x1de7d5[_0x0012('0x6')]][_0x0012('0x37')]=_0x1de7d5[_0x0012('0x37')];queues[_0x1de7d5[_0x0012('0x6')]][_0x0012('0x31')]=_0x1de7d5[_0x0012('0x31')];queues[_0x1de7d5[_0x0012('0x6')]]['connectedlinename']=_0x1de7d5[_0x0012('0x32')];}}catch(_0x12cb8f){utils[_0x0012('0x16')](util['format'](_0x0012('0x30'),_0x1de7d5[_0x0012('0x6')]),_0x12cb8f);}};exports[_0x0012('0x38')]=function(_0x3e803b){try{if(!_[_0x0012('0x17')](queues[_0x3e803b['uniqueid']])){utils[_0x0012('0x12')](util['format'](_0x0012('0x39'),_0x3e803b[_0x0012('0x6')]),_0x3e803b);utils['info'](util[_0x0012('0x4')](_0x0012('0x3a'),_0x3e803b[_0x0012('0x6')],queues[_0x3e803b[_0x0012('0x6')]][_0x0012('0x20')],_0x3e803b[_0x0012('0x3b')],_0x3e803b['destaccountcode']));queues[_0x3e803b[_0x0012('0x6')]][_0x0012('0x19')]=![];queues[_0x3e803b[_0x0012('0x6')]][_0x0012('0x19')]=![];queues[_0x3e803b['uniqueid']][_0x0012('0x28')]=null;queues[_0x3e803b[_0x0012('0x6')]][_0x0012('0x1a')]=![];queues[_0x3e803b['uniqueid']][_0x0012('0x1c')]=null;queues[_0x3e803b[_0x0012('0x6')]][_0x0012('0x29')]=null;queues[_0x3e803b[_0x0012('0x6')]][_0x0012('0x3c')]=!![];queues[_0x3e803b[_0x0012('0x6')]][_0x0012('0x3d')]=_0x3e803b[_0x0012('0x3e')];queues[_0x3e803b[_0x0012('0x6')]][_0x0012('0x9')]=_0x3e803b[_0x0012('0x3b')];}}catch(_0x5651e8){utils['error'](util[_0x0012('0x4')](_0x0012('0x39'),_0x3e803b[_0x0012('0x6')]),_0x5651e8);}};exports[_0x0012('0x3f')]=function(_0x5b5a02){try{if(!_[_0x0012('0x17')](queues[_0x5b5a02[_0x0012('0x6')]])){if(queues[_0x5b5a02[_0x0012('0x6')]][_0x0012('0x35')]){utils[_0x0012('0x12')](util[_0x0012('0x4')]('[%s][queues][agentcomplete]',_0x5b5a02[_0x0012('0x6')]),_0x5b5a02);queues[_0x5b5a02['uniqueid']][_0x0012('0x19')]=![];queues[_0x5b5a02[_0x0012('0x6')]][_0x0012('0x19')]=![];queues[_0x5b5a02[_0x0012('0x6')]][_0x0012('0x28')]=null;queues[_0x5b5a02['uniqueid']][_0x0012('0x1a')]=![];queues[_0x5b5a02[_0x0012('0x6')]][_0x0012('0x29')]=null;queues[_0x5b5a02[_0x0012('0x6')]][_0x0012('0x3c')]=!![];queues[_0x5b5a02[_0x0012('0x6')]]['lastAssignedTo']=_0x5b5a02['membername'];queues[_0x5b5a02['uniqueid']][_0x0012('0x1b')]=!![];queues[_0x5b5a02[_0x0012('0x6')]]['queuecallercompleteAt']=utils['now']();if(_0x5b5a02['reason']==_0x0012('0x40')){if(!queues[_0x5b5a02[_0x0012('0x6')]][_0x0012('0x40')]){queues[_0x5b5a02[_0x0012('0x6')]][_0x0012('0x1c')]=_0x0012('0x41');}}else{queues[_0x5b5a02[_0x0012('0x6')]][_0x0012('0x1c')]=_0x0012('0x42')+_0x5b5a02[_0x0012('0x43')]['toUpperCase']();}utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x44'),_0x5b5a02['uniqueid'],queues[_0x5b5a02[_0x0012('0x6')]][_0x0012('0x20')],_0x5b5a02[_0x0012('0x3b')],queues[_0x5b5a02[_0x0012('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x5b5a02[_0x0012('0x6')]]);}}}catch(_0x1661c2){utils[_0x0012('0x16')](util[_0x0012('0x4')]('[%s][queues][agentcomplete]',_0x5b5a02[_0x0012('0x6')]),_0x1661c2);}};exports[_0x0012('0x45')]=function(_0x2c93e8){try{if(!_[_0x0012('0x17')](queues[_0x2c93e8[_0x0012('0x46')]])){utils[_0x0012('0x12')](util[_0x0012('0x4')]('[%s][queues][blindtransfer]',_0x2c93e8['uniqueid']),_0x2c93e8);queues[_0x2c93e8[_0x0012('0x46')]][_0x0012('0x40')]=!![];queues[_0x2c93e8[_0x0012('0x46')]][_0x0012('0x47')]=_0x0012('0x48');queues[_0x2c93e8[_0x0012('0x46')]][_0x0012('0x49')]=_0x2c93e8[_0x0012('0x4a')];queues[_0x2c93e8['transfereeuniqueid']][_0x0012('0x4b')]=_0x2c93e8[_0x0012('0x46')];queues[_0x2c93e8[_0x0012('0x46')]][_0x0012('0x1c')]=_0x0012('0x4c');utils[_0x0012('0x3')](util['format']('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x2c93e8['uniqueid'],queues[_0x2c93e8['transfereeuniqueid']]['name'],_0x2c93e8['transfereeuniqueid'],_0x2c93e8[_0x0012('0x4a')]));}}catch(_0x140bd5){utils['error'](util[_0x0012('0x4')](_0x0012('0x4d'),_0x2c93e8[_0x0012('0x6')]),_0x140bd5);}};exports[_0x0012('0x4e')]=function(_0xd350bc){try{utils['debug'](util[_0x0012('0x4')](_0x0012('0x4f'),_0xd350bc[_0x0012('0x50')]),_0xd350bc);if(_0xd350bc[_0x0012('0x50')]==_0xd350bc[_0x0012('0x51')]){if(!_[_0x0012('0x17')](queues[_0xd350bc['secondtransfererlinkedid']])){utils['info'](util[_0x0012('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0xd350bc[_0x0012('0x50')],queues[_0xd350bc[_0x0012('0x52')]][_0x0012('0x20')],_0xd350bc[_0x0012('0x53')]));queues[_0xd350bc['secondtransfererlinkedid']]['transfer']=!![];queues[_0xd350bc[_0x0012('0x52')]][_0x0012('0x47')]=_0x0012('0x54');queues[_0xd350bc['secondtransfererlinkedid']][_0x0012('0x49')]=_0xd350bc['origtransfererexten'];queues[_0xd350bc['secondtransfererlinkedid']]['transferuniqueid']=_0xd350bc[_0x0012('0x50')];queues[_0xd350bc[_0x0012('0x52')]]['queuecallerexitreason']=_0x0012('0x55');}if(!_[_0x0012('0x17')](queues[_0xd350bc['origtransfererlinkedid']])){if(_0xd350bc['transfereelinkedid']&&queues[_0xd350bc[_0x0012('0x56')]]){queues[_0xd350bc['transfereelinkedid']][_0x0012('0x21')]=0x1;queues[_0xd350bc[_0x0012('0x46')]]=_['clone'](queues[_0xd350bc['transfereelinkedid']]);queues[_0xd350bc[_0x0012('0x46')]][_0x0012('0x10')]=_0xd350bc[_0x0012('0x57')];queues[_0xd350bc[_0x0012('0x46')]]['queuecallerenterreason']=0x2;queues[_0xd350bc['transfereeuniqueid']][_0x0012('0xa')]=queues[_0xd350bc['secondtransfererlinkedid']][_0x0012('0xa')];queues[_0xd350bc[_0x0012('0x46')]]['calleridname']=queues[_0xd350bc[_0x0012('0x52')]][_0x0012('0x58')];queues[_0xd350bc[_0x0012('0x46')]][_0x0012('0x36')]=utils[_0x0012('0x2a')]();queues[_0xd350bc[_0x0012('0x46')]][_0x0012('0x35')]=utils[_0x0012('0x2a')]();queues[_0xd350bc[_0x0012('0x46')]][_0x0012('0x33')]=0x0;queues[_0xd350bc['transfereeuniqueid']][_0x0012('0x59')]=0x0;utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0xd350bc['origtransfereruniqueid'],queues[_0xd350bc['transfereeuniqueid']][_0x0012('0x20')],queues[_0xd350bc['transfereeuniqueid']][_0x0012('0xa')],queues[_0xd350bc[_0x0012('0x46')]][_0x0012('0x58')]));}else{utils['info'](util[_0x0012('0x4')](_0x0012('0x5a'),_0xd350bc[_0x0012('0x50')],queues[_0xd350bc[_0x0012('0x51')]][_0x0012('0x20')],_0xd350bc[_0x0012('0x52')]));queues[_0xd350bc[_0x0012('0x51')]]['transfereduniqueid']=_0xd350bc[_0x0012('0x52')];}}}else if(_0xd350bc['secondtransfereruniqueid']==_0xd350bc['secondtransfererlinkedid']){if(!_[_0x0012('0x17')](queues[_0xd350bc[_0x0012('0x51')]])){utils['info'](util[_0x0012('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0xd350bc[_0x0012('0x50')],queues[_0xd350bc[_0x0012('0x51')]][_0x0012('0x20')],_0xd350bc[_0x0012('0x5b')],_0xd350bc['secondtransfererexten']));queues[_0xd350bc[_0x0012('0x51')]][_0x0012('0x40')]=!![];queues[_0xd350bc[_0x0012('0x51')]][_0x0012('0x47')]=_0x0012('0x54');queues[_0xd350bc['origtransfererlinkedid']][_0x0012('0x49')]=_0xd350bc[_0x0012('0x5c')];queues[_0xd350bc[_0x0012('0x51')]][_0x0012('0x4b')]=_0xd350bc[_0x0012('0x5b')];queues[_0xd350bc['origtransfererlinkedid']][_0x0012('0x1c')]='ATTENDEDTRANSFER';}if(!_[_0x0012('0x17')](queues[_0xd350bc[_0x0012('0x52')]])){if(_0xd350bc['transfertargetlinkedid']&&queues[_0xd350bc[_0x0012('0x5d')]]){queues[_0xd350bc[_0x0012('0x5d')]]['queuecallerenterreason']=0x1;queues[_0xd350bc[_0x0012('0x57')]]=_[_0x0012('0x5e')](queues[_0xd350bc[_0x0012('0x5d')]]);queues[_0xd350bc[_0x0012('0x57')]][_0x0012('0x10')]=_0xd350bc[_0x0012('0x57')];queues[_0xd350bc[_0x0012('0x57')]]['queuecallerenterreason']=0x2;queues[_0xd350bc[_0x0012('0x57')]][_0x0012('0xa')]=queues[_0xd350bc[_0x0012('0x51')]][_0x0012('0xa')];queues[_0xd350bc[_0x0012('0x57')]][_0x0012('0x58')]=queues[_0xd350bc[_0x0012('0x51')]]['calleridname'];queues[_0xd350bc[_0x0012('0x57')]][_0x0012('0x36')]=utils[_0x0012('0x2a')]();queues[_0xd350bc[_0x0012('0x57')]][_0x0012('0x35')]=utils[_0x0012('0x2a')]();queues[_0xd350bc[_0x0012('0x57')]]['holdtime']=0x0;queues[_0xd350bc[_0x0012('0x57')]]['mohtime']=0x0;utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x5f'),_0xd350bc[_0x0012('0x50')],queues[_0xd350bc['transfertargetuniqueid']][_0x0012('0x20')],queues[_0xd350bc[_0x0012('0x57')]][_0x0012('0x10')],queues[_0xd350bc[_0x0012('0x57')]][_0x0012('0xa')],queues[_0xd350bc[_0x0012('0x57')]][_0x0012('0x58')]));}else{utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x5a'),_0xd350bc[_0x0012('0x50')],queues[_0xd350bc[_0x0012('0x52')]]['name'],_0xd350bc['origtransfererlinkedid']));queues[_0xd350bc['secondtransfererlinkedid']][_0x0012('0x10')]=_0xd350bc[_0x0012('0x51')];}}}}catch(_0x5b451d){utils[_0x0012('0x16')](util['format'](_0x0012('0x4f'),_0xd350bc['origtransfereruniqueid']),_0x5b451d);}};exports[_0x0012('0x60')]=function(_0x538eaa){try{if(!_['isNil'](queues[_0x538eaa['uniqueid']])){utils[_0x0012('0x12')](util[_0x0012('0x4')]('[%s][queues][musiconholdstart]',_0x538eaa[_0x0012('0x6')]),_0x538eaa);queues[_0x538eaa[_0x0012('0x6')]][_0x0012('0x61')]=utils['now']();utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x62'),_0x538eaa['uniqueid'],queues[_0x538eaa[_0x0012('0x6')]][_0x0012('0x20')],queues[_0x538eaa[_0x0012('0x6')]][_0x0012('0x61')]));}}catch(_0x4dfb27){utils[_0x0012('0x16')](util['format'](_0x0012('0x63'),_0x538eaa['uniqueid']),_0x4dfb27);}};exports[_0x0012('0x64')]=function(_0x1b57d8){try{if(!_[_0x0012('0x17')](queues[_0x1b57d8[_0x0012('0x6')]])){if(!_['isNil'](queues[_0x1b57d8[_0x0012('0x6')]][_0x0012('0x61')])){utils['debug'](util[_0x0012('0x4')](_0x0012('0x65'),_0x1b57d8[_0x0012('0x6')]),_0x1b57d8);queues[_0x1b57d8[_0x0012('0x6')]][_0x0012('0x59')]+=utils[_0x0012('0x34')](utils['now'](),queues[_0x1b57d8['uniqueid']]['musiconholdstartAt']);utils[_0x0012('0x3')](util[_0x0012('0x4')](_0x0012('0x66'),_0x1b57d8[_0x0012('0x6')],queues[_0x1b57d8[_0x0012('0x6')]][_0x0012('0x20')],queues[_0x1b57d8[_0x0012('0x6')]][_0x0012('0x59')]));delete queues[_0x1b57d8[_0x0012('0x6')]][_0x0012('0x61')];}}}catch(_0x3f5aac){utils[_0x0012('0x16')](util[_0x0012('0x4')](_0x0012('0x65'),_0x1b57d8[_0x0012('0x6')]),_0x3f5aac);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index fd9cbed..60dc5c4 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 _0x13f7=['uniqueid','accountcode','getUserByInternal','membername','name','CreateVoiceRecording','newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','info','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','lodash','util','./utils','format'];(function(_0x8d088c,_0x323325){var _0x2abbc0=function(_0x4bb968){while(--_0x4bb968){_0x8d088c['push'](_0x8d088c['shift']());}};_0x2abbc0(++_0x323325);}(_0x13f7,0x164));var _0x713f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x13f7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x713f('0x0'));var util=require(_0x713f('0x1'));var utils=require(_0x713f('0x2'));var recordings={};function writeDB(_0x1adbdb){utils['info'](util[_0x713f('0x3')]('[%s][recordings][writeDB]',_0x1adbdb[_0x713f('0x4')]));if(_0x1adbdb[_0x713f('0x5')]){utils[_0x713f('0x6')](_0x1adbdb['accountcode'])['then'](function(_0x5ea16f){if(_0x5ea16f){_0x1adbdb[_0x713f('0x7')]=_0x5ea16f[_0x713f('0x8')];_0x1adbdb['UserId']=_0x5ea16f['id'];}utils['request'](_0x713f('0x9'),_0x1adbdb);});}else{utils['request'](_0x713f('0x9'),_0x1adbdb);}}exports[_0x713f('0xa')]=function(_0x3f594c){try{utils[_0x713f('0xb')](util[_0x713f('0x3')]('[%s][recordings][newchannel]',_0x3f594c[_0x713f('0x4')]),_0x3f594c);if(_0x3f594c[_0x713f('0x4')]==_0x3f594c[_0x713f('0xc')]){utils['info'](util[_0x713f('0x3')](_0x713f('0xd'),_0x3f594c[_0x713f('0x4')],_0x3f594c[_0x713f('0xe')],_0x3f594c[_0x713f('0xf')]));recordings[_0x3f594c[_0x713f('0x4')]]={'uniqueid':_0x3f594c[_0x713f('0x4')],'accountcode':_0x3f594c[_0x713f('0x5')],'exten':_0x3f594c[_0x713f('0xf')],'context':_0x3f594c[_0x713f('0xe')],'channel':_0x3f594c[_0x713f('0x10')],'monitors':[]};}}catch(_0x352641){utils[_0x713f('0x11')](util[_0x713f('0x3')]('[%s][recordings][newchannel]',_0x3f594c[_0x713f('0x4')]),_0x352641);}};exports[_0x713f('0x12')]=function(_0x56e0a1){try{utils[_0x713f('0xb')](util[_0x713f('0x3')](_0x713f('0x13'),_0x56e0a1[_0x713f('0x4')]),_0x56e0a1);if(!_[_0x713f('0x14')](recordings[_0x56e0a1[_0x713f('0x4')]])&&_0x56e0a1[_0x713f('0x15')]==0x6){utils['info'](util['format'](_0x713f('0x16'),_0x56e0a1[_0x713f('0x4')],_0x56e0a1[_0x713f('0xe')],_0x56e0a1[_0x713f('0x10')]));}else if(!_[_0x713f('0x14')](recordings[_0x56e0a1[_0x713f('0xc')]])&&_0x56e0a1['channelstate']==0x6&&_0x56e0a1['context']!=_0x713f('0x17')){utils[_0x713f('0x18')](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x56e0a1['uniqueid'],_0x56e0a1[_0x713f('0xc')],_0x56e0a1[_0x713f('0xe')],_0x56e0a1['channel']));recordings[_0x56e0a1[_0x713f('0xc')]][_0x713f('0x5')]=_0x56e0a1[_0x713f('0x5')];}}catch(_0x2e6478){utils[_0x713f('0x11')](util[_0x713f('0x3')](_0x713f('0x13'),_0x56e0a1[_0x713f('0x4')]),_0x2e6478);}};exports[_0x713f('0x19')]=function(_0x3dc44c){try{if(!_[_0x713f('0x14')](_0x3dc44c[_0x713f('0x1a')])&&!_[_0x713f('0x14')](_0x3dc44c[_0x713f('0x1a')][_0x713f('0x1b')])){utils[_0x713f('0xb')](util[_0x713f('0x3')]('[%s][recordings][varset]',_0x3dc44c[_0x713f('0x4')]),_0x3dc44c);utils[_0x713f('0x18')](util[_0x713f('0x3')](_0x713f('0x1c'),_0x3dc44c[_0x713f('0x4')],_0x3dc44c[_0x713f('0x1a')],_0x3dc44c[_0x713f('0x1d')]));if(_['endsWith'](_0x3dc44c[_0x713f('0x1d')],_0x713f('0x1e'))){_0x3dc44c[_0x713f('0x1d')]=_0x3dc44c[_0x713f('0x1d')]['replace']('.wav49','.WAV');}if(recordings[_0x3dc44c[_0x713f('0xc')]]){var _0x5c6f5d=_[_0x713f('0x1f')](recordings[_0x3dc44c[_0x713f('0xc')]][_0x713f('0x20')],{'value':_0x3dc44c[_0x713f('0x1d')]});if(_[_0x713f('0x14')](_0x5c6f5d)){recordings[_0x3dc44c[_0x713f('0xc')]][_0x713f('0x20')][_0x713f('0x21')]({'value':_0x3dc44c[_0x713f('0x1d')]});}}}}catch(_0x18f7c6){utils['error'](util['format'](_0x713f('0x22'),_0x3dc44c[_0x713f('0x4')]),_0x18f7c6);}};exports[_0x713f('0x23')]=function(_0x2bdc98){try{if(!_['isNil'](recordings[_0x2bdc98[_0x713f('0x4')]])){utils[_0x713f('0xb')](util[_0x713f('0x3')](_0x713f('0x24'),_0x2bdc98[_0x713f('0x4')]),_0x2bdc98);utils[_0x713f('0x18')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x2bdc98[_0x713f('0x4')],_0x2bdc98[_0x713f('0x25')],_0x2bdc98['calleridname'],_0x2bdc98['cause-txt']));recordings[_0x2bdc98[_0x713f('0x4')]][_0x713f('0x25')]=_0x2bdc98[_0x713f('0x25')];recordings[_0x2bdc98[_0x713f('0x4')]][_0x713f('0x26')]=_0x2bdc98['calleridname'];recordings[_0x2bdc98[_0x713f('0x4')]][_0x713f('0x27')]=_0x2bdc98[_0x713f('0x27')];recordings[_0x2bdc98[_0x713f('0x4')]][_0x713f('0x28')]=_0x2bdc98['connectedlinename'];if(recordings[_0x2bdc98['uniqueid']][_0x713f('0x29')]==_0x713f('0x2a')&&recordings[_0x2bdc98[_0x713f('0x4')]][_0x713f('0x5')]){recordings[_0x2bdc98[_0x713f('0x4')]][_0x713f('0x27')]=recordings[_0x2bdc98['uniqueid']]['accountcode'];recordings[_0x2bdc98['uniqueid']][_0x713f('0x28')]='';}recordings[_0x2bdc98[_0x713f('0x4')]][_0x713f('0x20')][_0x713f('0x2b')](function(_0x35cb80){var _0x1345fd=_[_0x713f('0x2c')](recordings[_0x2bdc98[_0x713f('0x4')]]);_0x1345fd[_0x713f('0x1d')]=_0x35cb80[_0x713f('0x1d')];writeDB(_0x1345fd);});delete recordings[_0x2bdc98['uniqueid']];}}catch(_0x29d360){utils[_0x713f('0x11')](util[_0x713f('0x3')](_0x713f('0x24'),_0x2bdc98[_0x713f('0x4')]),_0x29d360);}};exports['newexten']=function(_0x4d38e6){try{if(!_[_0x713f('0x14')](recordings[_0x4d38e6[_0x713f('0x4')]])){utils[_0x713f('0xb')](util['format']('[%s][recordings][newexten]',_0x4d38e6[_0x713f('0x4')]),_0x4d38e6);utils['info'](util[_0x713f('0x3')](_0x713f('0x2d'),_0x4d38e6['uniqueid'],_0x4d38e6[_0x713f('0x2e')],_0x4d38e6['appdata']));if(_0x4d38e6[_0x713f('0x2e')][_0x713f('0x2f')]()==_0x713f('0x30')&&_[_0x713f('0x31')](_0x4d38e6[_0x713f('0x32')][_0x713f('0x2f')](),_0x713f('0x33'))){var _0x4fda85=_0x4d38e6[_0x713f('0x32')][_0x713f('0x34')]('=');var _0x219b3b=_0x4fda85[0x0][_0x713f('0x35')](_0x4fda85[0x0][_0x713f('0x36')]('(')+0x1,_0x4fda85[0x0][_0x713f('0x36')](')'));var _0x33361c=_0x4fda85[0x1];recordings[_0x4d38e6[_0x713f('0x4')]][_0x219b3b]=_0x33361c;}}}catch(_0x32066c){utils[_0x713f('0x11')](util['format'](_0x713f('0x37'),_0x4d38e6[_0x713f('0x4')]),_0x32066c);}};exports[_0x713f('0x38')]=function(_0x59d70e){try{if(!_[_0x713f('0x14')](recordings[_0x59d70e[_0x713f('0x4')]])){utils[_0x713f('0xb')](util[_0x713f('0x3')]('[%s][recordings][queuecallerjoin]',_0x59d70e[_0x713f('0x4')]),_0x59d70e);utils['info'](util[_0x713f('0x3')](_0x713f('0x39'),_0x59d70e[_0x713f('0x4')],_0x59d70e['queue']));recordings[_0x59d70e[_0x713f('0x4')]][_0x713f('0x3a')]=_0x59d70e[_0x713f('0x3a')];}}catch(_0x1bf0c4){utils['error'](util[_0x713f('0x3')](_0x713f('0x3b'),_0x59d70e[_0x713f('0x4')]),_0x1bf0c4);}}; \ No newline at end of file +var _0xbf7f=['replace','.wav49','.WAV','monitors','push','hangup','[%s][recordings][hangup]','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','info','format','uniqueid','accountcode','then','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xbf7f,0x14e));var _0xfbf7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbf7f[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x3a3bcb){utils[_0xfbf7('0x0')](util[_0xfbf7('0x1')]('[%s][recordings][writeDB]',_0x3a3bcb[_0xfbf7('0x2')]));if(_0x3a3bcb[_0xfbf7('0x3')]){utils['getUserByInternal'](_0x3a3bcb[_0xfbf7('0x3')])[_0xfbf7('0x4')](function(_0x4ae59b){if(_0x4ae59b){_0x3a3bcb['membername']=_0x4ae59b[_0xfbf7('0x5')];_0x3a3bcb[_0xfbf7('0x6')]=_0x4ae59b['id'];}utils['request']('CreateVoiceRecording',_0x3a3bcb);});}else{utils[_0xfbf7('0x7')](_0xfbf7('0x8'),_0x3a3bcb);}}exports[_0xfbf7('0x9')]=function(_0x3ee508){try{utils[_0xfbf7('0xa')](util['format'](_0xfbf7('0xb'),_0x3ee508[_0xfbf7('0x2')]),_0x3ee508);if(_0x3ee508['uniqueid']==_0x3ee508[_0xfbf7('0xc')]){utils[_0xfbf7('0x0')](util[_0xfbf7('0x1')](_0xfbf7('0xd'),_0x3ee508['uniqueid'],_0x3ee508[_0xfbf7('0xe')],_0x3ee508[_0xfbf7('0xf')]));recordings[_0x3ee508[_0xfbf7('0x2')]]={'uniqueid':_0x3ee508['uniqueid'],'accountcode':_0x3ee508['accountcode'],'exten':_0x3ee508['exten'],'context':_0x3ee508['context'],'channel':_0x3ee508[_0xfbf7('0x10')],'monitors':[]};}}catch(_0x1ec2df){utils[_0xfbf7('0x11')](util['format'](_0xfbf7('0xb'),_0x3ee508['uniqueid']),_0x1ec2df);}};exports[_0xfbf7('0x12')]=function(_0x5b5ec7){try{utils[_0xfbf7('0xa')](util[_0xfbf7('0x1')]('[%s][recordings][newstate]',_0x5b5ec7[_0xfbf7('0x2')]),_0x5b5ec7);if(!_[_0xfbf7('0x13')](recordings[_0x5b5ec7[_0xfbf7('0x2')]])&&_0x5b5ec7[_0xfbf7('0x14')]==0x6){utils[_0xfbf7('0x0')](util[_0xfbf7('0x1')](_0xfbf7('0x15'),_0x5b5ec7[_0xfbf7('0x2')],_0x5b5ec7['context'],_0x5b5ec7[_0xfbf7('0x10')]));}else if(!_[_0xfbf7('0x13')](recordings[_0x5b5ec7['linkedid']])&&_0x5b5ec7[_0xfbf7('0x14')]==0x6&&_0x5b5ec7[_0xfbf7('0xe')]!=_0xfbf7('0x16')){utils[_0xfbf7('0x0')](util[_0xfbf7('0x1')](_0xfbf7('0x17'),_0x5b5ec7[_0xfbf7('0x2')],_0x5b5ec7[_0xfbf7('0xc')],_0x5b5ec7[_0xfbf7('0xe')],_0x5b5ec7['channel']));recordings[_0x5b5ec7[_0xfbf7('0xc')]]['accountcode']=_0x5b5ec7[_0xfbf7('0x3')];}}catch(_0x1d3d67){utils[_0xfbf7('0x11')](util['format'](_0xfbf7('0x18'),_0x5b5ec7['uniqueid']),_0x1d3d67);}};exports[_0xfbf7('0x19')]=function(_0x274018){try{if(!_[_0xfbf7('0x13')](_0x274018[_0xfbf7('0x1a')])&&!_[_0xfbf7('0x13')](_0x274018[_0xfbf7('0x1a')][_0xfbf7('0x1b')])){utils[_0xfbf7('0xa')](util[_0xfbf7('0x1')](_0xfbf7('0x1c'),_0x274018[_0xfbf7('0x2')]),_0x274018);utils[_0xfbf7('0x0')](util['format'](_0xfbf7('0x1d'),_0x274018[_0xfbf7('0x2')],_0x274018['variable'],_0x274018[_0xfbf7('0x1e')]));if(_[_0xfbf7('0x1f')](_0x274018['value'],'.wav49')){_0x274018['value']=_0x274018['value'][_0xfbf7('0x20')](_0xfbf7('0x21'),_0xfbf7('0x22'));}if(recordings[_0x274018[_0xfbf7('0xc')]]){var _0x56ef95=_['find'](recordings[_0x274018['linkedid']]['monitors'],{'value':_0x274018[_0xfbf7('0x1e')]});if(_[_0xfbf7('0x13')](_0x56ef95)){recordings[_0x274018[_0xfbf7('0xc')]][_0xfbf7('0x23')][_0xfbf7('0x24')]({'value':_0x274018[_0xfbf7('0x1e')]});}}}}catch(_0x2d6de8){utils[_0xfbf7('0x11')](util[_0xfbf7('0x1')](_0xfbf7('0x1c'),_0x274018[_0xfbf7('0x2')]),_0x2d6de8);}};exports[_0xfbf7('0x25')]=function(_0x2b964b){try{if(!_[_0xfbf7('0x13')](recordings[_0x2b964b[_0xfbf7('0x2')]])){utils['debug'](util[_0xfbf7('0x1')](_0xfbf7('0x26'),_0x2b964b[_0xfbf7('0x2')]),_0x2b964b);utils[_0xfbf7('0x0')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x2b964b['uniqueid'],_0x2b964b['calleridnum'],_0x2b964b[_0xfbf7('0x27')],_0x2b964b[_0xfbf7('0x28')]));recordings[_0x2b964b[_0xfbf7('0x2')]][_0xfbf7('0x29')]=_0x2b964b[_0xfbf7('0x29')];recordings[_0x2b964b['uniqueid']][_0xfbf7('0x27')]=_0x2b964b[_0xfbf7('0x27')];recordings[_0x2b964b[_0xfbf7('0x2')]][_0xfbf7('0x2a')]=_0x2b964b[_0xfbf7('0x2a')];recordings[_0x2b964b[_0xfbf7('0x2')]][_0xfbf7('0x2b')]=_0x2b964b[_0xfbf7('0x2b')];if(recordings[_0x2b964b[_0xfbf7('0x2')]]['type']==_0xfbf7('0x2c')&&recordings[_0x2b964b[_0xfbf7('0x2')]][_0xfbf7('0x3')]){recordings[_0x2b964b[_0xfbf7('0x2')]]['connectedlinenum']=recordings[_0x2b964b[_0xfbf7('0x2')]][_0xfbf7('0x3')];recordings[_0x2b964b['uniqueid']][_0xfbf7('0x2b')]='';}recordings[_0x2b964b[_0xfbf7('0x2')]][_0xfbf7('0x23')][_0xfbf7('0x2d')](function(_0x4c5fa3){var _0xce0c0=_[_0xfbf7('0x2e')](recordings[_0x2b964b[_0xfbf7('0x2')]]);_0xce0c0[_0xfbf7('0x1e')]=_0x4c5fa3['value'];writeDB(_0xce0c0);});delete recordings[_0x2b964b[_0xfbf7('0x2')]];}}catch(_0x4c0034){utils[_0xfbf7('0x11')](util['format'](_0xfbf7('0x26'),_0x2b964b[_0xfbf7('0x2')]),_0x4c0034);}};exports[_0xfbf7('0x2f')]=function(_0x4169dd){try{if(!_[_0xfbf7('0x13')](recordings[_0x4169dd[_0xfbf7('0x2')]])){utils[_0xfbf7('0xa')](util[_0xfbf7('0x1')](_0xfbf7('0x30'),_0x4169dd[_0xfbf7('0x2')]),_0x4169dd);utils[_0xfbf7('0x0')](util[_0xfbf7('0x1')](_0xfbf7('0x31'),_0x4169dd[_0xfbf7('0x2')],_0x4169dd[_0xfbf7('0x32')],_0x4169dd[_0xfbf7('0x33')]));if(_0x4169dd[_0xfbf7('0x32')][_0xfbf7('0x34')]()=='set'&&_['startsWith'](_0x4169dd[_0xfbf7('0x33')][_0xfbf7('0x34')](),_0xfbf7('0x35'))){var _0x4ea111=_0x4169dd[_0xfbf7('0x33')][_0xfbf7('0x36')]('=');var _0x8e35dc=_0x4ea111[0x0][_0xfbf7('0x37')](_0x4ea111[0x0][_0xfbf7('0x38')]('(')+0x1,_0x4ea111[0x0][_0xfbf7('0x38')](')'));var _0x1ce4d6=_0x4ea111[0x1];recordings[_0x4169dd['uniqueid']][_0x8e35dc]=_0x1ce4d6;}}}catch(_0x4e0119){utils[_0xfbf7('0x11')](util['format']('[%s][recordings][newexten]',_0x4169dd[_0xfbf7('0x2')]),_0x4e0119);}};exports[_0xfbf7('0x39')]=function(_0x11ad69){try{if(!_[_0xfbf7('0x13')](recordings[_0x11ad69[_0xfbf7('0x2')]])){utils['debug'](util[_0xfbf7('0x1')](_0xfbf7('0x3a'),_0x11ad69[_0xfbf7('0x2')]),_0x11ad69);utils[_0xfbf7('0x0')](util[_0xfbf7('0x1')](_0xfbf7('0x3b'),_0x11ad69[_0xfbf7('0x2')],_0x11ad69[_0xfbf7('0x3c')]));recordings[_0x11ad69[_0xfbf7('0x2')]][_0xfbf7('0x3c')]=_0x11ad69[_0xfbf7('0x3c')];}}catch(_0x150d92){utils[_0xfbf7('0x11')](util['format'](_0xfbf7('0x3a'),_0x11ad69[_0xfbf7('0x2')]),_0x150d92);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index f2e7847..178cf91 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 _0xeaf3=['assign','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','error','./utils','info','format','type','attended','uniqueid','request','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransfereruniqueid','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname'];(function(_0x45de5a,_0x584cad){var _0x2890b5=function(_0x4a02bd){while(--_0x4a02bd){_0x45de5a['push'](_0x45de5a['shift']());}};_0x2890b5(++_0x584cad);}(_0xeaf3,0x1b3));var _0x3eaf=function(_0x2a8c5e,_0x34c22f){_0x2a8c5e=_0x2a8c5e-0x0;var _0x4667af=_0xeaf3[_0x2a8c5e];return _0x4667af;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x3eaf('0x0'));function writeDB(_0x1d75c0){utils[_0x3eaf('0x1')](util[_0x3eaf('0x2')]('[%s][transfers][writeDB]\x20type:%s',_0x1d75c0[_0x3eaf('0x3')]===_0x3eaf('0x4')?_0x1d75c0['origtransfereruniqueid']:_0x1d75c0[_0x3eaf('0x5')],_0x1d75c0[_0x3eaf('0x3')]));utils[_0x3eaf('0x6')](_0x3eaf('0x7'),_0x1d75c0);}exports['blindtransfer']=function(_0x3f5e8d){try{utils[_0x3eaf('0x8')](util[_0x3eaf('0x2')](_0x3eaf('0x9'),_0x3f5e8d[_0x3eaf('0x5')]),_0x3f5e8d);utils[_0x3eaf('0x1')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3f5e8d[_0x3eaf('0x5')],_0x3f5e8d[_0x3eaf('0xa')],_0x3f5e8d[_0x3eaf('0xb')],_0x3f5e8d['transfereecalleridnum'],_0x3f5e8d[_0x3eaf('0xc')]));_0x3f5e8d[_0x3eaf('0x3')]=_0x3eaf('0xd');writeDB(_0x3f5e8d);}catch(_0x16f3df){utils['error'](util[_0x3eaf('0x2')](_0x3eaf('0x9'),_0x3f5e8d['uniqueid']),_0x16f3df);}};exports[_0x3eaf('0xe')]=function(_0x21b3cb){try{utils[_0x3eaf('0x8')](util['format'](_0x3eaf('0xf'),_0x21b3cb['origtransfereruniqueid']),_0x21b3cb);utils[_0x3eaf('0x1')](util[_0x3eaf('0x2')](_0x3eaf('0x10'),_0x21b3cb[_0x3eaf('0x11')],_0x21b3cb['origtransferercalleridnum'],_0x21b3cb[_0x3eaf('0x12')],_0x21b3cb[_0x3eaf('0x13')],_0x21b3cb[_0x3eaf('0x14')]));_0x21b3cb=_[_0x3eaf('0x15')](_0x21b3cb,{'transfererchannel':_0x21b3cb['origtransfererchannel'],'transferercalleridnum':_0x21b3cb[_0x3eaf('0x16')],'transferercalleridname':_0x21b3cb[_0x3eaf('0x12')],'transfererconnectedlinenum':_0x21b3cb[_0x3eaf('0x17')],'transfererconnectedlinename':_0x21b3cb[_0x3eaf('0x18')],'transfereraccountcode':_0x21b3cb['origtransfereraccountcode'],'transferercontext':_0x21b3cb[_0x3eaf('0x19')],'transfererexten':_0x21b3cb[_0x3eaf('0x1a')],'transfererlinkedid':_0x21b3cb[_0x3eaf('0x1b')],'context':_0x21b3cb[_0x3eaf('0x1c')],'extension':_0x21b3cb['origtransfererexten'],'type':'attended'});if(_[_0x3eaf('0x1d')](_0x21b3cb[_0x3eaf('0x1e')])){_0x21b3cb=_[_0x3eaf('0x15')](_0x21b3cb,{'transfereechannel':_0x21b3cb[_0x3eaf('0x1f')],'transfereecalleridnum':_0x21b3cb[_0x3eaf('0x13')],'transfereecalleridname':_0x21b3cb['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x21b3cb[_0x3eaf('0x20')],'transfereeconnectedlinename':_0x21b3cb[_0x3eaf('0x21')],'transfereeaccountcode':_0x21b3cb[_0x3eaf('0x22')],'transfereecontext':_0x21b3cb['transfertargetcontext'],'transfereeexten':_0x21b3cb[_0x3eaf('0x23')],'transfereelinkedid':_0x21b3cb[_0x3eaf('0x24')]});}writeDB(_0x21b3cb);}catch(_0x5ea8e6){utils[_0x3eaf('0x25')](util[_0x3eaf('0x2')](_0x3eaf('0xf'),_0x21b3cb[_0x3eaf('0x11')]),_0x5ea8e6);}}; \ No newline at end of file +var _0x265c=['transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridname','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransferercontext','origtransfererexten','transfereechannel','assign','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','attended','uniqueid','type','request','CreateVoiceTransferReport','blindtransfer','debug','format','[%s][transfers][blindtransfer]'];(function(_0x1efc12,_0x29c7d7){var _0xb117dc=function(_0x433019){while(--_0x433019){_0x1efc12['push'](_0x1efc12['shift']());}};_0xb117dc(++_0x29c7d7);}(_0x265c,0x9a));var _0xc265=function(_0x55ff09,_0x4285ce){_0x55ff09=_0x55ff09-0x0;var _0x245060=_0x265c[_0x55ff09];return _0x245060;};'use strict';var _=require(_0xc265('0x0'));var util=require(_0xc265('0x1'));var utils=require(_0xc265('0x2'));function writeDB(_0x13fea9){utils[_0xc265('0x3')](util['format'](_0xc265('0x4'),_0x13fea9['type']===_0xc265('0x5')?_0x13fea9['origtransfereruniqueid']:_0x13fea9[_0xc265('0x6')],_0x13fea9[_0xc265('0x7')]));utils[_0xc265('0x8')](_0xc265('0x9'),_0x13fea9);}exports[_0xc265('0xa')]=function(_0x4609d){try{utils[_0xc265('0xb')](util[_0xc265('0xc')](_0xc265('0xd'),_0x4609d[_0xc265('0x6')]),_0x4609d);utils[_0xc265('0x3')](util[_0xc265('0xc')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4609d[_0xc265('0x6')],_0x4609d[_0xc265('0xe')],_0x4609d[_0xc265('0xf')],_0x4609d[_0xc265('0x10')],_0x4609d[_0xc265('0x11')]));_0x4609d[_0xc265('0x7')]='blind';writeDB(_0x4609d);}catch(_0x2802f9){utils[_0xc265('0x12')](util[_0xc265('0xc')]('[%s][transfers][blindtransfer]',_0x4609d[_0xc265('0x6')]),_0x2802f9);}};exports[_0xc265('0x13')]=function(_0x4e90b3){try{utils['debug'](util[_0xc265('0xc')](_0xc265('0x14'),_0x4e90b3[_0xc265('0x15')]),_0x4e90b3);utils[_0xc265('0x3')](util[_0xc265('0xc')](_0xc265('0x16'),_0x4e90b3[_0xc265('0x15')],_0x4e90b3[_0xc265('0x17')],_0x4e90b3['origtransferercalleridname'],_0x4e90b3['transfertargetcalleridnum'],_0x4e90b3[_0xc265('0x18')]));_0x4e90b3=_['assign'](_0x4e90b3,{'transfererchannel':_0x4e90b3[_0xc265('0x19')],'transferercalleridnum':_0x4e90b3[_0xc265('0x17')],'transferercalleridname':_0x4e90b3[_0xc265('0x1a')],'transfererconnectedlinenum':_0x4e90b3[_0xc265('0x1b')],'transfererconnectedlinename':_0x4e90b3[_0xc265('0x1c')],'transfereraccountcode':_0x4e90b3['origtransfereraccountcode'],'transferercontext':_0x4e90b3['secondtransferercontext'],'transfererexten':_0x4e90b3[_0xc265('0x1d')],'transfererlinkedid':_0x4e90b3['origtransfererlinkedid'],'context':_0x4e90b3[_0xc265('0x1e')],'extension':_0x4e90b3[_0xc265('0x1f')],'type':_0xc265('0x5')});if(_['isNil'](_0x4e90b3[_0xc265('0x20')])){_0x4e90b3=_[_0xc265('0x21')](_0x4e90b3,{'transfereechannel':_0x4e90b3[_0xc265('0x22')],'transfereecalleridnum':_0x4e90b3[_0xc265('0x23')],'transfereecalleridname':_0x4e90b3['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4e90b3[_0xc265('0x24')],'transfereeconnectedlinename':_0x4e90b3[_0xc265('0x25')],'transfereeaccountcode':_0x4e90b3[_0xc265('0x26')],'transfereecontext':_0x4e90b3[_0xc265('0x27')],'transfereeexten':_0x4e90b3[_0xc265('0x28')],'transfereelinkedid':_0x4e90b3[_0xc265('0x29')]});}writeDB(_0x4e90b3);}catch(_0x320302){utils[_0xc265('0x12')](util['format'](_0xc265('0x14'),_0x4e90b3[_0xc265('0x15')]),_0x320302);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index e526b29..66da27b 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 _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb10b,0x12a));var _0xbb10=function(_0x231a42,_0x39f4db){_0x231a42=_0x231a42-0x0;var _0x3c2a56=_0xb10b[_0x231a42];return _0x3c2a56;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file +var _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xb10b,0x12a));var _0xbb10=function(_0x5613de,_0x479c93){_0x5613de=_0x5613de-0x0;var _0x5b40cb=_0xb10b[_0x5613de];return _0x5b40cb;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file